From 931fced027399f364f57ab7c3b0cad1bb9d91d4b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 22 Mar 2016 21:03:27 -0700 Subject: [PATCH 0001/1833] Remove dependency apt-transport-sftp --- build_debian.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 453a6c1d6cf6..35b8c8d4ccb3 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -169,7 +169,6 @@ sudo LANG=C chroot $FILESYSTEM_ROOT pip uninstall -y pip echo '[INFO] Install apt-transport-sftp package from deps directory' sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install libssh2-1 -sudo dpkg --root=$FILESYSTEM_ROOT -i deps/apt-transport-sftp_*.deb ## Config DHCP for eth0 sudo tee -a $FILESYSTEM_ROOT/etc/network/interfaces > /dev/null < Date: Tue, 22 Mar 2016 21:23:05 -0700 Subject: [PATCH 0002/1833] (document) --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d6525945899e..36f51966773a 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,23 @@ # Description Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS. +# Prerequisite +## 1. Linux kernel with switch drivers +Build the [Azure/sonic-linux-kernel](https://github.com/Azure/sonic-linux-kernel) project and copy the output .deb file into ./deps directory. + +## 2. initramfs-tools with loop device support +Run the script to build the .deb file into ./deps directory. + + ./get_deps.sh + # Usage ## Build NOS installer image ./build_debian USERNAME PASSWORD_ENCRYPTED && ./build_image.sh -For example, the user name is 'acsadmin' and the password is 'YourPaSsWoRd'. +For example, the user name is 'admin' and the password is 'YourPaSsWoRd'. - ./build_debian.sh "acsadmin" "$(perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"')" && ./build_image.sh + ./build_debian.sh "admin" "$(perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"')" && ./build_image.sh The root is disabled, but the created user could sudo. From e39d3b8299b570a2e7bb8980a4792bdcfe1fdcc0 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 23 Mar 2016 17:47:37 -0700 Subject: [PATCH 0003/1833] sswsyncd container: add python to be ansible --- docker-sswsyncd/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-sswsyncd/Dockerfile b/docker-sswsyncd/Dockerfile index d260f442b392..9894d46c3153 100755 --- a/docker-sswsyncd/Dockerfile +++ b/docker-sswsyncd/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get clean && apt-get update ## Pre-install the fundamental packages ## TODO: sswsyncd depends on ifupdown RUN apt-get -y install \ + python \ ifupdown \ rsyslog From 537242d213788e3ac29ac006f510381d3c3b4525 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 6 Apr 2016 11:55:25 -0700 Subject: [PATCH 0004/1833] Update README.md with build environment --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 36f51966773a..d311061174ac 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,12 @@ Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS. # Prerequisite -## 1. Linux kernel with switch drivers +## 1. Build environment +Preferably use [the Dockerfile](https://github.com/Azure/sonic-build-tools/blob/master/sonic-slave/Dockerfile), or use Debian Jessie and manually install packages appearing in the Dockerfile. +## 2. Linux kernel with switch drivers Build the [Azure/sonic-linux-kernel](https://github.com/Azure/sonic-linux-kernel) project and copy the output .deb file into ./deps directory. -## 2. initramfs-tools with loop device support +## 3. initramfs-tools with loop device support Run the script to build the .deb file into ./deps directory. ./get_deps.sh From 85f354b77b0121aeabd1cd9f2fe08a71862479d4 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 27 May 2016 13:30:13 -0700 Subject: [PATCH 0005/1833] Sqush merge latest code to github branch --- .gitmodules | 3 ++ README.md | 1 + build_debian.sh | 32 ++++++++++----- build_docker.sh | 31 +++++++++----- build_image.sh | 2 +- docker-base | 1 + docker-basic_router/Dockerfile | 17 ++++++++ docker-bgp/Dockerfile | 15 +++---- docker-database/Dockerfile | 20 ++++----- docker-fpm/Dockerfile | 21 ++++++++++ docker-lldp/Dockerfile | 24 +++++++---- docker-mlnx-sswsyncd-rpc/Dockerfile | 38 +++++++++++++++++ docker-mlnx-sswsyncd/Dockerfile | 30 ++++++++++++++ docker-orchagent/Dockerfile | 22 ++++++++++ docker-platform-monitor/Dockerfile | 16 ++++++++ docker-snmp/Dockerfile | 30 ++++++++++---- docker-sswsyncd/Dockerfile | 18 ++++----- docker-syncd-mlnx/Dockerfile | 33 +++++++++++++++ docker-syncd/Dockerfile | 24 +++++++++++ docker-vas/Dockerfile | 36 +++++++++++++++++ files/apt/apt.conf.d/81norecommends | 3 ++ files/dhcp/rfc3442-classless-routes | 63 +++++++++++++++++++++++++++++ files/sources.list | 8 ---- 23 files changed, 413 insertions(+), 75 deletions(-) create mode 100644 .gitmodules create mode 160000 docker-base create mode 100644 docker-basic_router/Dockerfile create mode 100755 docker-fpm/Dockerfile create mode 100644 docker-mlnx-sswsyncd-rpc/Dockerfile create mode 100755 docker-mlnx-sswsyncd/Dockerfile create mode 100755 docker-orchagent/Dockerfile create mode 100755 docker-platform-monitor/Dockerfile create mode 100755 docker-syncd-mlnx/Dockerfile create mode 100755 docker-syncd/Dockerfile create mode 100755 docker-vas/Dockerfile create mode 100644 files/apt/apt.conf.d/81norecommends create mode 100644 files/dhcp/rfc3442-classless-routes delete mode 100644 files/sources.list diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000000..267fb9435909 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "docker-base"] + path = docker-base + url = https://github.com/Azure/sonic-docker-base.git diff --git a/README.md b/README.md index d311061174ac..07ec85b1569b 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ The root is disabled, but the created user could sudo. ./build_docker.sh docker-bgp ./build_docker.sh docker-snmp ./build_docker.sh docker-lldp + ./build_docker.sh docker-basic_router # Contribution guide diff --git a/build_debian.sh b/build_debian.sh index 35b8c8d4ccb3..a8149ca72289 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -61,7 +61,7 @@ mkdir -p $FILESYSTEM_ROOT ## Build a basic Debian system by debootstrap echo '[INFO] Debootstrap...' -sudo debootstrap --arch amd64 jessie $FILESYSTEM_ROOT http://ftp.us.debian.org/debian +sudo debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://ftp.us.debian.org/debian ## Config hostname and hosts, otherwise 'sudo ...' will complain 'sudo: unable to resolve host ...' sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '$HOSTNAME' > /etc/hostname" @@ -82,11 +82,13 @@ clean_sys() { $FILESYSTEM_ROOT/sys/fs/cgroup \ $FILESYSTEM_ROOT/sys || true } -trap_push 'sudo umount $FILESYSTEM_ROOT/sys || true' +trap_push clean_sys sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs ## Pointing apt to public apt mirrors and getting latest packages, needed for latest security updates -sudo cp files/sources.list $FILESYSTEM_ROOT/etc/apt/ +sudo cp docker-base/sources.list $FILESYSTEM_ROOT/etc/apt/ +sudo cp files/apt/apt.conf.d/81norecommends $FILESYSTEM_ROOT/etc/apt/apt.conf.d/ +sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'apt-mark auto `apt-mark showmanual`' ## Note: set lang to prevent locale warnings in your chroot sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y update @@ -110,7 +112,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i deps/initramfs-tools_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f sudo dpkg --root=$FILESYSTEM_ROOT -i deps/linux-image-3.16.0-4-amd64_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f - + ## Update initramfs for booting with squashfs+aufs cat files/initramfs-tools/modules | sudo tee -a $FILESYSTEM_ROOT/etc/initramfs-tools/modules > /dev/null @@ -129,7 +131,6 @@ curl -sSL https://get.docker.com/ | sudo LANG=C chroot $FILESYSTEM_ROOT sh ## Remove garbage left by docker installation script sudo rm $FILESYSTEM_ROOT/etc/apt/sources.list.d/docker.list sudo chroot $FILESYSTEM_ROOT service docker stop -sudo chroot $FILESYSTEM_ROOT service dbus stop ## Add docker config drop-in to select aufs, otherwise it may other storage driver ## Note: $_ means last argument of last command sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/ @@ -149,16 +150,23 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ ## Note: gdisk is needed for sgdisk in install.sh ## Note: parted is needed for partprobe in install.sh sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ + file \ + ifupdown \ + iproute2 \ + isc-dhcp-client \ sudo \ vim \ tcpdump \ ntp \ + ntpstat \ openssh-server \ python \ python-setuptools \ + rsyslog \ python-apt \ - gdisk \ - parted \ + traceroute \ + iputils-ping \ + net-tools \ efibootmgr ## docker-py is needed by Ansible docker module @@ -167,9 +175,6 @@ sudo LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0' ## Remove pip which is unnecessary in the base image sudo LANG=C chroot $FILESYSTEM_ROOT pip uninstall -y pip -echo '[INFO] Install apt-transport-sftp package from deps directory' -sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install libssh2-1 - ## Config DHCP for eth0 sudo tee -a $FILESYSTEM_ROOT/etc/network/interfaces > /dev/null </dev/null 2>&1; then + mkdir -p $DOCKER_BUILD_DIR/deps + cp -r deps/* $DOCKER_BUILD_DIR/deps +fi ## Copy the suggested Debian sources ## ref: https://wiki.debian.org/SourcesList -mkdir -p $DOCKER_BUILD_DIR/files -cp files/sources.list $DOCKER_BUILD_DIR/files -docker build -t $docker_image_name $DOCKER_BUILD_DIR +cp -r files $DOCKER_BUILD_DIR/files +docker build --no-cache -t $docker_image_name $DOCKER_BUILD_DIR + +## Flatten the image by importing an exported container on this image +## Note: it will squash the image with only one layer and lost all metadata such as ENTRYPOINT, +## so apply only to the base image +## TODO: wait docker-squash supporting Docker 1.10+ +## ref: https://github.com/jwilder/docker-squash/issues/45 +if [ "$docker_image_name" = "docker-base" ]; then + tmp_container=$(docker run -d ${docker_image_name} /bin/bash) + docker export $tmp_container | docker import - ${docker_image_name} + docker rm -f $tmp_container || true +fi if [ -n "$REGISTRY_SERVER" ] && [ -n "$REGISTRY_PORT" ]; then ## Add registry information as tag, so will push as latest ## Temporarily add -f option to prevent error message of Docker engine version < 1.10.0 - docker tag -f $docker_image_name $REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name - + docker tag -f $docker_image_name $remote_image_name + ## Login the docker image registry server ## Note: user name and password are passed from command line, use fake email address to bypass login check docker login -u $REGISTRY_USERNAME -p "$REGISTRY_PASSWD" -e "@" $REGISTRY_SERVER:$REGISTRY_PORT - docker push $REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name + docker push $remote_image_name fi docker save $docker_image_name | gzip -c > $docker_image_gz diff --git a/build_image.sh b/build_image.sh index 34e5d783956b..75a3bce521af 100755 --- a/build_image.sh +++ b/build_image.sh @@ -13,7 +13,7 @@ } ## Retrieval short version of Git revision hash for partition metadata -[ -z $(git status --untracked-files=no -s) ] || { +[ -z "$(git status --untracked-files=no -s)" ] || { echo "Error: There is local changes not committed to git repo. Cannot get a revision hash for partition metadata." exit 1 } diff --git a/docker-base b/docker-base new file mode 160000 index 000000000000..915f0fc71276 --- /dev/null +++ b/docker-base @@ -0,0 +1 @@ +Subproject commit 915f0fc71276e8819107edf605ab891764a01870 diff --git a/docker-basic_router/Dockerfile b/docker-basic_router/Dockerfile new file mode 100644 index 000000000000..095de44b02e2 --- /dev/null +++ b/docker-basic_router/Dockerfile @@ -0,0 +1,17 @@ +FROM docker-base + +MAINTAINER Xudong Wu + +## Set the apt source +RUN apt-get clean && apt-get update + +COPY deps /deps +RUN dpkg -i /deps/libopennsl_*.deb; \ + dpkg -i /deps/libsaibcm_*.deb; \ + apt-get -y install -f + + +RUN mv /deps/basic_router /usr/sbin/basic_router + +ENTRYPOINT service rsyslog start \ + && /bin/bash diff --git a/docker-bgp/Dockerfile b/docker-bgp/Dockerfile index 711e48fee206..bf286a14ab86 100755 --- a/docker-bgp/Dockerfile +++ b/docker-bgp/Dockerfile @@ -1,17 +1,12 @@ -FROM debian:jessie - -## Set the apt source -COPY files/sources.list /etc/sources.list -RUN apt-get clean && apt-get update - -## Pre-install the fundamental packages -RUN apt-get -y install \ - rsyslog \ - python +FROM docker-base COPY deps /deps RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + ENTRYPOINT service rsyslog start \ && service quagga start \ && /bin/bash diff --git a/docker-database/Dockerfile b/docker-database/Dockerfile index e830385d4fb8..2282f7cadca9 100755 --- a/docker-database/Dockerfile +++ b/docker-database/Dockerfile @@ -1,14 +1,14 @@ -FROM debian:jessie - -## Set the apt source -COPY files/sources.list /etc/sources.list -RUN apt-get clean && apt-get update +FROM docker-base ## Pre-install the fundamental packages -RUN apt-get -y install \ - rsyslog \ +RUN apt-get update && apt-get -y install \ redis-server -ENTRYPOINT service rsyslog start \ - && service redis-server start \ - && /bin/bash +RUN sed -ri 's/^daemonize yes$/daemonize no/' /etc/redis/redis.conf \ + && sed -ri 's/^logfile .*$/logfile ""/' /etc/redis/redis.conf \ + && sed -ri 's/^# syslog-enabled no$/syslog-enabled no/' /etc/redis/redis.conf + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y + +ENTRYPOINT service redis-server start diff --git a/docker-fpm/Dockerfile b/docker-fpm/Dockerfile new file mode 100755 index 000000000000..c223a746fffe --- /dev/null +++ b/docker-fpm/Dockerfile @@ -0,0 +1,21 @@ +FROM docker-base + +RUN apt-get update + +COPY deps /deps +## Get fpmsyncd +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb +COPY /deps/fpmsyncd /usr/local/bin/fpmsyncd + +## Get Quagga +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT service rsyslog start \ + && service quagga start \ + && (fpmsyncd &) \ + && /bin/bash diff --git a/docker-lldp/Dockerfile b/docker-lldp/Dockerfile index 322a92f57ea3..176270c3ec81 100755 --- a/docker-lldp/Dockerfile +++ b/docker-lldp/Dockerfile @@ -1,12 +1,7 @@ -FROM debian:jessie - -## Set the apt source -COPY files/sources.list /etc/sources.list -RUN apt-get clean && apt-get update +FROM docker-base ## Pre-install the fundamental packages -RUN apt-get -y install \ - rsyslog \ +RUN apt-get update && apt-get -y install \ lldpd COPY deps /deps @@ -18,6 +13,21 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return ## Note: dpkg_apt function has the benefit to detect missing .deb file RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/lldpsyncd_*.deb +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +## There is a known bug: agetty processes at 100% cpu +## When: +## 1. running container in --privileged mode +## 2. container runs /sbin/init +## ref: https://github.com/docker/docker/issues/4040 +## Temporary solution: +## Disable tty services permanently +RUN systemctl --no-pager list-unit-files --type=service | grep getty | awk '{print $1}' | xargs systemctl mask +## Note: getty@.service in last grep output will not mask below cases +RUN systemctl mask getty@tty1.service + ## Specify init as CMD to enable systemd ## Note: don't provide ENTRYPOINT at the same time CMD ["/sbin/init"] diff --git a/docker-mlnx-sswsyncd-rpc/Dockerfile b/docker-mlnx-sswsyncd-rpc/Dockerfile new file mode 100644 index 000000000000..2e53ab64f752 --- /dev/null +++ b/docker-mlnx-sswsyncd-rpc/Dockerfile @@ -0,0 +1,38 @@ +FROM docker-base + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools + +COPY deps /deps +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/python-tabulate_*.deb \ + && dpkg_apt /deps/applibs_*.deb \ + && dpkg_apt /deps/applibs-dev_*.deb \ + && dpkg_apt /deps/sx-complib_*.deb \ + && dpkg_apt /deps/sxd-libs_*.deb \ + && dpkg_apt /deps/sx-scew_*.deb \ + && dpkg_apt /deps/sx-examples_*.deb \ + && dpkg_apt /deps/sx-gen-utils_*.deb \ + && dpkg_apt /deps/python-sdk-api_*.deb \ + && dpkg_apt /deps/sx-libnl_*.deb \ + && dpkg_apt /deps/iproute2_*.deb \ + && dpkg_apt /deps/libsswsdk_*.deb \ + && dpkg_apt /deps/libthrift-0.9.2_*.deb \ + && dpkg_apt /deps/libthrift-dev_*.deb + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/mlnx-sai_*.deb \ + && dpkg_apt /deps/sswsyncd-saithrift_*.deb + +## Clean up +RUN apt-get clean -y ; apt-get autoclean -y ; apt-get autoremove -y ; rm -rf /deps + +ENTRYPOINT service rsyslog start \ + && mkdir -p /dev/sxdevs && ( [ -e /dev/sxdevs/sxcdev ] || mknod /dev/sxdevs/sxcdev c 231 193 ) \ + && service sswsyncd start \ + && /bin/bash diff --git a/docker-mlnx-sswsyncd/Dockerfile b/docker-mlnx-sswsyncd/Dockerfile new file mode 100755 index 000000000000..4ce980aee35f --- /dev/null +++ b/docker-mlnx-sswsyncd/Dockerfile @@ -0,0 +1,30 @@ +FROM docker-base + +RUN apt-get update + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools + +COPY deps /deps +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-tabulate_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/applibs_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/applibs-dev_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-complib_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sxd-libs_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-scew_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-examples_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-gen-utils_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-sdk-api_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-libnl_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/iproute2_*.deb + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/mlnx-sai_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsswsdk_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sswsyncd_*.deb + +ENTRYPOINT service rsyslog start \ + && mkdir -p /dev/sxdevs && ( [ -e /dev/sxdevs/sxcdev ] || mknod /dev/sxdevs/sxcdev c 231 193 ) \ + && sleep 5 && service sswsyncd start \ + && /bin/bash diff --git a/docker-orchagent/Dockerfile b/docker-orchagent/Dockerfile new file mode 100755 index 000000000000..3c674c9bb4c5 --- /dev/null +++ b/docker-orchagent/Dockerfile @@ -0,0 +1,22 @@ +FROM docker-base + +RUN apt-get update + +COPY deps /deps + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb + +## TODO: add ifupdown into Depends +RUN apt-get install -f -y ifupdown + +## Copy executable binaries +COPY ["/deps/orchagent","/deps/swssconfig","/deps/portsyncd","/deps/intfsyncd","/deps/neighsyncd","/usr/local/bin/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT service rsyslog start \ + && /bin/bash diff --git a/docker-platform-monitor/Dockerfile b/docker-platform-monitor/Dockerfile new file mode 100755 index 000000000000..7cda4d4f4d91 --- /dev/null +++ b/docker-platform-monitor/Dockerfile @@ -0,0 +1,16 @@ +FROM docker-base + +## Pre-install the fundamental packages +RUN apt-get update && apt-get -y install \ + smartmontools \ + sensord + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT service rsyslog start \ + && service lm-sensors start \ + && service smartmontools start \ + && service sensord start \ + && /bin/bash diff --git a/docker-snmp/Dockerfile b/docker-snmp/Dockerfile index 2afc5eddeee8..1f64fe7d0b9d 100755 --- a/docker-snmp/Dockerfile +++ b/docker-snmp/Dockerfile @@ -1,13 +1,8 @@ -FROM debian:jessie - -## Set the apt source -COPY files/sources.list /etc/sources.list -RUN apt-get clean && apt-get update +FROM docker-base ## Pre-install the fundamental packages -RUN apt-get -y install \ - rsyslog \ - snmp \ +RUN apt-get update && apt-get -y install \ + snmp \ snmpd COPY deps /deps @@ -18,6 +13,25 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return ## Install SNMP subagent RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/acs-snmp-subagent_*.deb +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +## There is a known bug: agetty processes at 100% cpu +## When: +## 1. running container in --privileged mode +## 2. container runs /sbin/init +## ref: https://github.com/docker/docker/issues/4040 +## Temporary solution: +## Disable tty services permanently +RUN systemctl --no-pager list-unit-files --type=service | grep getty | awk '{print $1}' | xargs systemctl mask +## Note: getty@.service in last grep output will not mask below cases +RUN systemctl mask getty@tty1.service + +## Although exposing ports is not need for host net mode, keep it for possible bridge mode +EXPOSE 161/udp +EXPOSE 162/udp + ## Specify init as CMD to enable systemd ## Note: don't provide ENTRYPOINT at the same time CMD ["/sbin/init"] diff --git a/docker-sswsyncd/Dockerfile b/docker-sswsyncd/Dockerfile index 9894d46c3153..9af14c2a561e 100755 --- a/docker-sswsyncd/Dockerfile +++ b/docker-sswsyncd/Dockerfile @@ -1,22 +1,18 @@ -FROM debian:jessie +FROM docker-base -## Set the apt source -COPY files/sources.list /etc/sources.list -RUN apt-get clean && apt-get update - -## Pre-install the fundamental packages -## TODO: sswsyncd depends on ifupdown -RUN apt-get -y install \ - python \ - ifupdown \ - rsyslog +RUN apt-get update COPY deps /deps +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-tabulate_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libopennsl_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsaibcm_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsswsdk_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sswsyncd_*.deb +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + ENTRYPOINT service rsyslog start \ && service sswsyncd start \ && /bin/bash diff --git a/docker-syncd-mlnx/Dockerfile b/docker-syncd-mlnx/Dockerfile new file mode 100755 index 000000000000..d422374fc479 --- /dev/null +++ b/docker-syncd-mlnx/Dockerfile @@ -0,0 +1,33 @@ +FROM docker-base + +RUN apt-get update + +COPY deps /deps + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/applibs_*.deb \ + && dpkg_apt /deps/applibs-dev_*.deb \ + && dpkg_apt /deps/sx-complib_*.deb \ + && dpkg_apt /deps/sxd-libs_*.deb \ + && dpkg_apt /deps/sx-scew_*.deb \ + && dpkg_apt /deps/sx-examples_*.deb \ + && dpkg_apt /deps/sx-gen-utils_*.deb \ + && dpkg_apt /deps/python-sdk-api_*.deb \ + && dpkg_apt /deps/sx-libnl_*.deb \ + && dpkg_apt /deps/iproute2_*.deb \ + && dpkg_apt /deps/mft*.deb \ + + && dpkg_apt /deps/libhiredis0.13*.deb \ + && dpkg_apt /deps/libswsscommon_*.deb \ + && dpkg_apt /deps/mlnx-sai_*.deb \ + && dpkg_apt /deps/libsairedis_*.deb + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT service rsyslog start \ + && service syncd start \ + && /bin/bash diff --git a/docker-syncd/Dockerfile b/docker-syncd/Dockerfile new file mode 100755 index 000000000000..f720b6c19bbd --- /dev/null +++ b/docker-syncd/Dockerfile @@ -0,0 +1,24 @@ +FROM docker-base + +RUN apt-get update + +COPY deps /deps + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libopennsl_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsaibcm_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb + +## TODO: add kmod into Depends +RUN apt-get install -f kmod + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT service rsyslog start \ + && service syncd start \ + && /bin/bash diff --git a/docker-vas/Dockerfile b/docker-vas/Dockerfile new file mode 100755 index 000000000000..cd9378523ea2 --- /dev/null +++ b/docker-vas/Dockerfile @@ -0,0 +1,36 @@ +FROM docker-base + +## Pre-install the fundamental packages +RUN apt-get update && apt-get -y install \ + sudo + +COPY deps /deps +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/vasclnt_*.deb && \ + dpkg_apt /deps/vasgp_*.deb + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +## Expose to host, ie. image content will copy to host when container started +## For .so +VOLUME /host/lib/x86_64-linux-gnu +## For config +VOLUME /etc/pam.d/ +VOLUME /host/etc +## For domain socket and local caches +VOLUME /var/opt/quest/vas/vasd/ +## For home directory +VOLUME /home/ + +## Delete the symlinks and create full copies to host folder +ENTRYPOINT service rsyslog start \ + && cp --remove-destination /opt/quest/lib64/nss/libnss_vas4.so.2 \ + /host/lib/x86_64-linux-gnu/ \ + && cp --remove-destination /opt/quest/lib64/security/pam_vas3.so \ + /host/lib/x86_64-linux-gnu/security/ \ + && cp --remove-destination /etc/nsswitch.conf \ + /host/etc/ \ + && service vasd start \ + && /bin/bash diff --git a/files/apt/apt.conf.d/81norecommends b/files/apt/apt.conf.d/81norecommends new file mode 100644 index 000000000000..d868eb45e228 --- /dev/null +++ b/files/apt/apt.conf.d/81norecommends @@ -0,0 +1,3 @@ +APT::Install-Recommends "false"; +APT::AutoRemove::RecommendsImportant "false"; +APT::AutoRemove::SuggestsImportant "false"; diff --git a/files/dhcp/rfc3442-classless-routes b/files/dhcp/rfc3442-classless-routes new file mode 100644 index 000000000000..64e24192816b --- /dev/null +++ b/files/dhcp/rfc3442-classless-routes @@ -0,0 +1,63 @@ +# set classless routes based on the format specified in RFC3442 +# e.g.: +# new_rfc3442_classless_static_routes='24 192 168 10 192 168 1 1 8 10 10 17 66 41' +# specifies the routes: +# 192.168.10.0/24 via 192.168.1.1 +# 10.0.0.0/8 via 10.10.17.66.41 + +RUN="yes" + + +if [ "$RUN" = "yes" ]; then + if [ -n "$new_rfc3442_classless_static_routes" ]; then + if [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then + + set -- $new_rfc3442_classless_static_routes + + while [ $# -gt 0 ]; do + net_length=$1 + via_arg='' + + case $net_length in + 32|31|30|29|28|27|26|25) + net_address="${2}.${3}.${4}.${5}" + gateway="${6}.${7}.${8}.${9}" + shift 9 + ;; + 24|23|22|21|20|19|18|17) + net_address="${2}.${3}.${4}.0" + gateway="${5}.${6}.${7}.${8}" + shift 8 + ;; + 16|15|14|13|12|11|10|9) + net_address="${2}.${3}.0.0" + gateway="${4}.${5}.${6}.${7}" + shift 7 + ;; + 8|7|6|5|4|3|2|1) + net_address="${2}.0.0.0" + gateway="${3}.${4}.${5}.${6}" + shift 6 + ;; + 0) # default route + net_address="0.0.0.0" + gateway="${2}.${3}.${4}.${5}" + shift 5 + ;; + *) # error + return 1 + ;; + esac + + # take care of link-local routes + if [ "${gateway}" != '0.0.0.0' ]; then + via_arg="via ${gateway}" + fi + + # set route (ip detects host routes automatically) + ip -4 route add "${net_address}/${net_length}" \ + ${via_arg} dev "${interface}" table default >/dev/null 2>&1 + done + fi + fi +fi diff --git a/files/sources.list b/files/sources.list deleted file mode 100644 index d2aaf4251bb3..000000000000 --- a/files/sources.list +++ /dev/null @@ -1,8 +0,0 @@ -deb http://httpredir.debian.org/debian jessie main contrib non-free -deb-src http://httpredir.debian.org/debian jessie main contrib non-free - -deb http://httpredir.debian.org/debian jessie-updates main contrib non-free -deb-src http://httpredir.debian.org/debian jessie-updates main contrib non-free - -deb http://security.debian.org/ jessie/updates main contrib non-free -deb-src http://security.debian.org/ jessie/updates main contrib non-free From 9b387bfd24097dd235fb9ad75ecbd707bd764cc6 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 16 Jun 2016 13:54:41 -0700 Subject: [PATCH 0006/1833] Update README.md Refine document about git submodule --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 07ec85b1569b..1789c09487c2 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,11 @@ Build the [Azure/sonic-linux-kernel](https://github.com/Azure/sonic-linux-kernel Run the script to build the .deb file into ./deps directory. ./get_deps.sh + +## 4. Fetch the git submodule +If there is no files under ./docker-base, manually fetch them. + + git submodule update --init --recursive # Usage ## Build NOS installer image From a79b519618295c006a2d06f0c7189070809ab320 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 21 Jun 2016 12:14:24 -0700 Subject: [PATCH 0007/1833] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1789c09487c2..27171d288cde 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ The root is disabled, but the created user could sudo. # Contribution guide -All contributors must sign a contribution license agreement before contributions can be accepted. Contact kasubra@microsoft.com or daloher@microsoft.com. Later this will be automated. +All contributors must sign a contribution license agreement before contributions can be accepted. Contact daloher@microsoft.com. Later this will be automated. ### GitHub Workflow @@ -76,3 +76,5 @@ For example: * Push your changes to your private fork and do "pull-request" to this repository * Use a pull request to do code review * Use issues to keep track of what is going on + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. From a79966998a3652887c8374524e99e5cf19ee4a59 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 26 Jul 2016 12:01:58 -0700 Subject: [PATCH 0008/1833] Squash merge latest code to github branch --- build_debian.sh | 46 ++++++++- build_docker.sh | 98 ++++++++++++++----- build_image.sh | 4 - docker-base | 2 +- docker-bgp/Dockerfile | 11 ++- docker-bgp/daemons | 31 ++++++ docker-database/Dockerfile | 10 +- docker-fpm/Dockerfile | 13 +-- docker-fpm/start.sh | 5 + docker-lldp/Dockerfile | 19 ++-- docker-orchagent/Dockerfile | 13 +-- docker-orchagent/start.sh | 25 +++++ docker-platform-monitor/Dockerfile | 11 +-- docker-snmp/Dockerfile | 51 +++++++--- docker-sswsyncd/Dockerfile | 26 +++-- docker-syncd-mlnx-rpc/Dockerfile | 46 +++++++++ docker-syncd/Dockerfile | 23 ++--- docker-syncd/start.sh | 4 + docker-vas/Dockerfile | 21 ++-- docker-vas/user-override | 2 + files/Aboot/boot0 | 25 ++++- files/docker/docker.service.conf | 2 +- files/initramfs-tools/union-mount | 13 ++- files/sshd/host-ssh-keygen.sh | 10 ++ files/sshd/sshd.service | 16 +++ functions.sh | 7 ++ installer/x86_64/dell-s6000-replace-reboot.sh | 16 +++ installer/x86_64/install.sh | 36 ++++++- onie-mk-demo.sh | 11 +-- 29 files changed, 461 insertions(+), 136 deletions(-) create mode 100644 docker-bgp/daemons create mode 100755 docker-fpm/start.sh mode change 100755 => 100644 docker-lldp/Dockerfile create mode 100755 docker-orchagent/start.sh mode change 100755 => 100644 docker-snmp/Dockerfile create mode 100644 docker-syncd-mlnx-rpc/Dockerfile create mode 100755 docker-syncd/start.sh create mode 100644 docker-vas/user-override create mode 100755 files/sshd/host-ssh-keygen.sh create mode 100644 files/sshd/sshd.service create mode 100755 installer/x86_64/dell-s6000-replace-reboot.sh diff --git a/build_debian.sh b/build_debian.sh index a8149ca72289..e283e5965ead 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -32,6 +32,9 @@ PASSWORD_ENCRYPTED=$2 ## Enable debug output for script set -x -e +## docker engine version (with platform) +DOCKER_VERSION=1.11.1-0~jessie_amd64 + ## Working directory to prepare the file system FILESYSTEM_ROOT=./fsroot ## Hostname for the linux image @@ -127,13 +130,21 @@ sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Install docker echo '[INFO] Install docker' -curl -sSL https://get.docker.com/ | sudo LANG=C chroot $FILESYSTEM_ROOT sh -## Remove garbage left by docker installation script -sudo rm $FILESYSTEM_ROOT/etc/apt/sources.list.d/docker.list +## Install apparmor utils since they're missing and apparmor is enabled in the kernel +## Otherwise Docker will fail to start +sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install apparmor +docker_deb_url=https://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine_${DOCKER_VERSION}.deb +docker_deb_temp=`mktemp` +trap_push "rm -f $docker_deb_temp" +wget $docker_deb_url -qO $docker_deb_temp && { \ + sudo dpkg --root=$FILESYSTEM_ROOT -i $docker_deb_temp || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f; \ +} +sudo chroot $FILESYSTEM_ROOT docker version sudo chroot $FILESYSTEM_ROOT service docker stop ## Add docker config drop-in to select aufs, otherwise it may other storage driver -## Note: $_ means last argument of last command 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 $_ ## Create default user @@ -149,6 +160,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ ## Pre-install the fundamental packages ## Note: gdisk is needed for sgdisk in install.sh ## Note: parted is needed for partprobe in install.sh +## Note: ca-certificates is needed for easy_install sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ file \ ifupdown \ @@ -167,8 +179,34 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ traceroute \ iputils-ping \ net-tools \ + bsdmainutils \ + ca-certificates \ + i2c-tools \ efibootmgr +## Remove sshd host keys, and will regenerate on first sshd start +sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* +sudo cp files/sshd/host-ssh-keygen.sh $FILESYSTEM_ROOT/usr/local/bin/ +sudo cp -f files/sshd/sshd.service $FILESYSTEM_ROOT/lib/systemd/system/ssh.service +## Config sshd +sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTEM_ROOT + +## Config sysctl +sudo mkdir -p $FILESYSTEM_ROOT/var/core +sudo augtool --autosave " +set /files/etc/sysctl.conf/kernel.core_pattern '|/usr/bin/coredump-compress %e %p' +set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_accept 0 +set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_announce 0 +set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_filter 0 +set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_notify 0 +set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_ignore 0 +set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_accept 0 +set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_announce 1 +set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_filter 0 +set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_notify 1 +set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_ignore 2 +" -r $FILESYSTEM_ROOT + ## docker-py is needed by Ansible docker module sudo LANG=C chroot $FILESYSTEM_ROOT easy_install pip sudo LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0' diff --git a/build_docker.sh b/build_docker.sh index 177c1e6a64b8..14a545bfc73b 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -1,10 +1,45 @@ #!/bin/bash ## This script is to automate the preparation for docker images for ACS. ## If registry server and port provided, the images will be pushed there. -## Usage: -## sudo ./build_docker.sh DOCKER_BUILD_DIR [REGISTRY_SERVER REGISTRY_PORT] -set -x -e +set -e + +. ./functions.sh + +usage() { + cat >&2 <&2 + usage + exit 1 + ;; + esac +done +shift "$((OPTIND - 1))" ## Dockerfile directory DOCKER_BUILD_DIR=$1 @@ -18,36 +53,39 @@ REGISTRY_PASSWD=$5 exit 1 } -## Docker image label, so no need to remember its hash -docker_image_name=$DOCKER_BUILD_DIR -remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name - -## File name for docker image -docker_image_gz=$docker_image_name.gz - -[ -n "$docker_image_gz" ] || { - echo "Error: Output docker image filename is empty" - exit 1 +[ -n "$docker_image_name" ] || { + docker_image_name=$DOCKER_BUILD_DIR } -function cleanup { - rm -rf $DOCKER_BUILD_DIR/files - rm -rf $DOCKER_BUILD_DIR/deps - docker rmi $remote_image_name || true +[ ${BUILD_NUMBER} ] || { + echo "No BUILD_NUMBER found, setting to 0." + BUILD_NUMBER="0" } -trap cleanup exit + +remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:latest +timestamp="$(date -u +%Y%m%d)" +build_version="${timestamp}.${BUILD_NUMBER}" +build_remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$build_version ## Copy dependencies ## Note: Dockerfile ADD doesn't support reference files outside the folder, so copy it locally if ls deps/* 1>/dev/null 2>&1; then + trap_push "rm -rf $DOCKER_BUILD_DIR/deps" mkdir -p $DOCKER_BUILD_DIR/deps cp -r deps/* $DOCKER_BUILD_DIR/deps fi ## Copy the suggested Debian sources ## ref: https://wiki.debian.org/SourcesList +trap_push "rm -rf $DOCKER_BUILD_DIR/deps" cp -r files $DOCKER_BUILD_DIR/files +docker_try_rmi $docker_image_name + +## Build the docker image docker build --no-cache -t $docker_image_name $DOCKER_BUILD_DIR +## Get the ID of the built image +## Note: inspect output has quotation characters, so sed to remove it as an argument +image_id=$(docker inspect --format="{{json .Id}}" $docker_image_name | sed -e 's/^"//' -e 's/"$//') ## Flatten the image by importing an exported container on this image ## Note: it will squash the image with only one layer and lost all metadata such as ENTRYPOINT, @@ -57,18 +95,30 @@ docker build --no-cache -t $docker_image_name $DOCKER_BUILD_DIR if [ "$docker_image_name" = "docker-base" ]; then tmp_container=$(docker run -d ${docker_image_name} /bin/bash) docker export $tmp_container | docker import - ${docker_image_name} - docker rm -f $tmp_container || true + trap_push "docker rmi $image_id" + trap_push "docker rm -f $tmp_container || true" fi +image_sha='' if [ -n "$REGISTRY_SERVER" ] && [ -n "$REGISTRY_PORT" ]; then ## Add registry information as tag, so will push as latest + ## Add additional tag with build information ## Temporarily add -f option to prevent error message of Docker engine version < 1.10.0 - docker tag -f $docker_image_name $remote_image_name + docker tag $docker_image_name $remote_image_name + docker tag $docker_image_name $build_remote_image_name ## Login the docker image registry server - ## Note: user name and password are passed from command line, use fake email address to bypass login check - docker login -u $REGISTRY_USERNAME -p "$REGISTRY_PASSWD" -e "@" $REGISTRY_SERVER:$REGISTRY_PORT - docker push $remote_image_name + ## Note: user name and password are passed from command line + docker login -u $REGISTRY_USERNAME -p "$REGISTRY_PASSWD" $REGISTRY_SERVER:$REGISTRY_PORT + + ## Push image to registry server + ## And get the image digest SHA256 + trap_push "docker rmi $remote_image_name" + trap_push "docker rmi $build_remote_image_name" + image_sha=$(docker push $remote_image_name | sed -n "s/.*: digest: sha256:\([0-9a-f]*\).*/\\1/p") + docker push $build_remote_image_name fi -docker save $docker_image_name | gzip -c > $docker_image_gz +mkdir -p target +rm -f target/$docker_image_name.*.gz +docker save $docker_image_name | gzip -c > target/$docker_image_name.$image_sha.gz diff --git a/build_image.sh b/build_image.sh index 75a3bce521af..e4a93d8dfbf8 100755 --- a/build_image.sh +++ b/build_image.sh @@ -23,10 +23,6 @@ sudo rm -f $OUTPUT_ONIE_IMAGE if [ "$TARGET_MACHINE" = "generic" ]; then ## Generate an ONIE installer image ## Note: Don't leave blank between lines. It is single line command. - CONSOLE_SPEED=9600 \ - CONSOLE_DEV=0 \ - CONSOLE_FLAG=0 \ - CONSOLE_PORT=0x3f8 \ ./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \ installer $TARGET_MACHINE/platform.conf $OUTPUT_ONIE_IMAGE OS $GIT_REVISION $ONIE_IMAGE_PART_SIZE \ $ONIE_INSTALLER_PAYLOAD diff --git a/docker-base b/docker-base index 915f0fc71276..dfb5c2f46bf9 160000 --- a/docker-base +++ b/docker-base @@ -1 +1 @@ -Subproject commit 915f0fc71276e8819107edf605ab891764a01870 +Subproject commit dfb5c2f46bf982207c8dbc2c5af589a0ba1b3ddc diff --git a/docker-bgp/Dockerfile b/docker-bgp/Dockerfile index bf286a14ab86..b01698e31118 100755 --- a/docker-bgp/Dockerfile +++ b/docker-bgp/Dockerfile @@ -1,11 +1,12 @@ FROM docker-base -COPY deps /deps -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb +COPY deps/quagga_*.deb /deps/ +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ + dpkg_apt /deps/quagga_*.deb && \ + apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ + rm -rf /deps -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +COPY daemons /etc/quagga/ ENTRYPOINT service rsyslog start \ && service quagga start \ diff --git a/docker-bgp/daemons b/docker-bgp/daemons new file mode 100644 index 000000000000..cb7c2322c9fb --- /dev/null +++ b/docker-bgp/daemons @@ -0,0 +1,31 @@ +# This file tells the quagga package which daemons to start. +# +# Entries are in the format: =(yes|no|priority) +# 0, "no" = disabled +# 1, "yes" = highest priority +# 2 .. 10 = lower priorities +# Read /usr/share/doc/quagga/README.Debian for details. +# +# Sample configurations for these daemons can be found in +# /usr/share/doc/quagga/examples/. +# +# ATTENTION: +# +# When activation a daemon at the first time, a config file, even if it is +# empty, has to be present *and* be owned by the user and group "quagga", else +# the daemon will not be started by /etc/init.d/quagga. The permissions should +# be u=rw,g=r,o=. +# When using "vtysh" such a config file is also needed. It should be owned by +# group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. +# +# The watchquagga daemon is always started. Per default in monitoring-only but +# that can be changed via /etc/quagga/debian.conf. +# +zebra=yes +bgpd=yes +ospfd=no +ospf6d=no +ripd=no +ripngd=no +isisd=no +babeld=no diff --git a/docker-database/Dockerfile b/docker-database/Dockerfile index 2282f7cadca9..4499f4a8f8fa 100755 --- a/docker-database/Dockerfile +++ b/docker-database/Dockerfile @@ -1,14 +1,14 @@ FROM docker-base ## Pre-install the fundamental packages -RUN apt-get update && apt-get -y install \ - redis-server +## Clean up +RUN apt-get -y install \ + redis-server \ + && \ + apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y RUN sed -ri 's/^daemonize yes$/daemonize no/' /etc/redis/redis.conf \ && sed -ri 's/^logfile .*$/logfile ""/' /etc/redis/redis.conf \ && sed -ri 's/^# syslog-enabled no$/syslog-enabled no/' /etc/redis/redis.conf -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y - ENTRYPOINT service redis-server start diff --git a/docker-fpm/Dockerfile b/docker-fpm/Dockerfile index c223a746fffe..d877c408baab 100755 --- a/docker-fpm/Dockerfile +++ b/docker-fpm/Dockerfile @@ -2,20 +2,21 @@ FROM docker-base RUN apt-get update -COPY deps /deps +COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/quagga_*", "/deps/"] + ## Get fpmsyncd RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb -COPY /deps/fpmsyncd /usr/local/bin/fpmsyncd +COPY deps/fpmsyncd /usr/local/bin/ ## Get Quagga RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb +COPY start.sh /usr/bin/start.sh + ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps -ENTRYPOINT service rsyslog start \ - && service quagga start \ - && (fpmsyncd &) \ - && /bin/bash +ENTRYPOINT /usr/bin/start.sh \ + && /bin/bash diff --git a/docker-fpm/start.sh b/docker-fpm/start.sh new file mode 100755 index 000000000000..90a1d515fa3a --- /dev/null +++ b/docker-fpm/start.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +service rsyslog start +service quagga start +fpmsyncd & diff --git a/docker-lldp/Dockerfile b/docker-lldp/Dockerfile old mode 100755 new mode 100644 index 176270c3ec81..bcfd378a73da --- a/docker-lldp/Dockerfile +++ b/docker-lldp/Dockerfile @@ -1,21 +1,18 @@ FROM docker-base -## Pre-install the fundamental packages -RUN apt-get update && apt-get -y install \ - lldpd - -COPY deps /deps +COPY deps/*py2*.whl deps/python-sswsdk_*.deb deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ +## Pre-install the fundamental packages ## Install Python SSWSDK (lldpsyncd dependancy) -## Note: dpkg_apt function has the benefit to detect missing .deb file -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-sswsdk_*.deb ## Install LLDP Sync Daemon ## Note: dpkg_apt function has the benefit to detect missing .deb file -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/lldpsyncd_*.deb - ## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ + dpkg_apt /deps/lldpd_*.deb && \ + dpkg_apt /deps/lldpsyncd_*.deb && \ + apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ + pip install --no-cache-dir /deps/*.whl && \ + rm -rf /deps ## There is a known bug: agetty processes at 100% cpu ## When: diff --git a/docker-orchagent/Dockerfile b/docker-orchagent/Dockerfile index 3c674c9bb4c5..17fbfe9e7274 100755 --- a/docker-orchagent/Dockerfile +++ b/docker-orchagent/Dockerfile @@ -2,21 +2,22 @@ FROM docker-base RUN apt-get update -COPY deps /deps +COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb -## TODO: add ifupdown into Depends -RUN apt-get install -f -y ifupdown +RUN apt-get install -f -y ifupdown bridge-utils ## Copy executable binaries -COPY ["/deps/orchagent","/deps/swssconfig","/deps/portsyncd","/deps/intfsyncd","/deps/neighsyncd","/usr/local/bin/"] +COPY ["deps/orchagent","deps/swssconfig","deps/portsyncd","deps/intfsyncd","deps/neighsyncd","/usr/local/bin/"] + +COPY start.sh /usr/bin/start.sh ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps -ENTRYPOINT service rsyslog start \ - && /bin/bash +ENTRYPOINT /usr/bin/start.sh \ + && /bin/bash diff --git a/docker-orchagent/start.sh b/docker-orchagent/start.sh new file mode 100755 index 000000000000..a5155e0513ad --- /dev/null +++ b/docker-orchagent/start.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +. /host/machine.conf + +MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` + +ORCHAGENT_ARGS="" + +PORTSYNCD_ARGS="" + +if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" + PORTSYNCD_ARGS+="-p /etc/ssw/ACS-S6000/port_config.ini" +elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then + ORCHAGENT_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini" +fi + +service rsyslog start +orchagent $ORCHAGENT_ARGS & +sleep 5 +portsyncd $PORTSYNCD_ARGS & +sleep 5 +intfsyncd & +sleep 5 +neighsyncd & diff --git a/docker-platform-monitor/Dockerfile b/docker-platform-monitor/Dockerfile index 7cda4d4f4d91..041f03f69927 100755 --- a/docker-platform-monitor/Dockerfile +++ b/docker-platform-monitor/Dockerfile @@ -1,13 +1,12 @@ FROM docker-base ## Pre-install the fundamental packages -RUN apt-get update && apt-get -y install \ - smartmontools \ - sensord - ## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN apt-get -y install \ + smartmontools \ + sensord \ + && \ + apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y ENTRYPOINT service rsyslog start \ && service lm-sensors start \ diff --git a/docker-snmp/Dockerfile b/docker-snmp/Dockerfile old mode 100755 new mode 100644 index 1f64fe7d0b9d..7286b7fe570d --- a/docker-snmp/Dockerfile +++ b/docker-snmp/Dockerfile @@ -1,21 +1,47 @@ FROM docker-base -## Pre-install the fundamental packages -RUN apt-get update && apt-get -y install \ - snmp \ - snmpd +COPY deps/snmp_*.deb deps/snmpd_*.deb deps/libsnmp-base_*.deb deps/libsnmp30_*.deb /deps/ +COPY deps/python3/*.whl /python3/ -COPY deps /deps +# enable -O for all Python calls +ENV PYTHONOPTIMIZE 1 +## Pre-install the fundamental packages ## Install Python SSWSDK (SNMP subagent dependancy) -## Note: dpkg_apt function has the benefit to detect missing .deb file -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-sswsdk_*.deb ## Install SNMP subagent -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/acs-snmp-subagent_*.deb - +## Note: dpkg_apt function has the benefit to detect missing .deb file ## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ + dpkg_apt /deps/libsnmp-base_*.deb && \ + dpkg_apt /deps/libsnmp30_*.deb && \ + dpkg_apt /deps/snmp_*.deb && \ + dpkg_apt /deps/snmpd_*.deb && \ + rm -rf /deps + +# install subagent +RUN apt-get -y install build-essential wget libssl-dev openssl && \ + rm -rf /var/lib/apt/lists/* && \ + wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz && \ + tar xvf Python-3.5.2.tgz && cd Python-3.5.2 && \ + ./configure --without-doc-strings --prefix=/usr --without-pymalloc --enable-shared && \ + make && make install && \ + ldconfig && \ + cd .. && rm -rf Python-3.5.2 && rm Python-3.5.2.tgz && \ + pip3 install --no-cache-dir /python3/*py3*.whl hiredis && \ + rm -rf /python3 && \ + python3 -m pip uninstall -y pip setuptools && \ + rm -rf /usr/lib/python3.5/unittest && \ + rm -rf /usr/lib/python3.5/lib2to3 && \ + rm -rf /usr/lib/python3.5/tkinter && \ + rm -rf /usr/lib/python3.5/idlelib && \ + rm -rf /usr/lib/python3.5/email && \ + rm -rf /usr/lib/python3.5/test && \ + apt-get -y remove build-essential wget libssl-dev openssl && \ + apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ + python3 -m acs_ax_impl install && \ + find / | grep -E "__pycache__" | xargs rm -rf && \ + rm -rf ~/.cache && \ + systemctl enable acs-snmp-subagent.service ## There is a known bug: agetty processes at 100% cpu ## When: @@ -29,8 +55,7 @@ RUN systemctl --no-pager list-unit-files --type=service | grep getty | awk '{pri RUN systemctl mask getty@tty1.service ## Although exposing ports is not need for host net mode, keep it for possible bridge mode -EXPOSE 161/udp -EXPOSE 162/udp +EXPOSE 161/udp 162/udp ## Specify init as CMD to enable systemd ## Note: don't provide ENTRYPOINT at the same time diff --git a/docker-sswsyncd/Dockerfile b/docker-sswsyncd/Dockerfile index 9af14c2a561e..7d83c67a259b 100755 --- a/docker-sswsyncd/Dockerfile +++ b/docker-sswsyncd/Dockerfile @@ -1,17 +1,23 @@ FROM docker-base -RUN apt-get update - -COPY deps /deps -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-tabulate_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libopennsl_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsaibcm_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsswsdk_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sswsyncd_*.deb +COPY \ + deps/python-tabulate_*.deb \ + deps/libopennsl_*.deb \ + deps/libsaibcm_*.deb \ + deps/libsswsdk_*.deb \ + deps/sswsyncd_*.deb \ + /deps/ +## Install packages ## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ + dpkg_apt /deps/python-tabulate_*.deb && \ + dpkg_apt /deps/libopennsl_*.deb && \ + dpkg_apt /deps/libsaibcm_*.deb && \ + dpkg_apt /deps/libsswsdk_*.deb && \ + dpkg_apt /deps/sswsyncd_*.deb && \ + apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ + rm -rf /deps ENTRYPOINT service rsyslog start \ && service sswsyncd start \ diff --git a/docker-syncd-mlnx-rpc/Dockerfile b/docker-syncd-mlnx-rpc/Dockerfile new file mode 100644 index 000000000000..3aed6f080506 --- /dev/null +++ b/docker-syncd-mlnx-rpc/Dockerfile @@ -0,0 +1,46 @@ +FROM docker-syncd-mlnx + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + python-pip \ + build-essential \ + libssl-dev \ + libffi-dev \ + python-dev \ + wget \ + cmake \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && pip install cffi \ + && pip install --upgrade cffi \ + && pip install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py + +COPY deps /deps + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ + && dpkg -r syncd \ + && dpkg_apt /deps/syncd_*.deb \ + && dpkg_apt /deps/libthrift-0.9.2_*.deb + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT service rsyslog start \ + && service syncd start \ + && /bin/bash diff --git a/docker-syncd/Dockerfile b/docker-syncd/Dockerfile index f720b6c19bbd..a3d45eb71fe7 100755 --- a/docker-syncd/Dockerfile +++ b/docker-syncd/Dockerfile @@ -2,23 +2,24 @@ FROM docker-base RUN apt-get update -COPY deps /deps +COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/libopennsl_*.deb", "deps/libsaibcm_*.deb", "deps/libsairedis_*.deb", "deps/syncd_*.deb", "/deps/"] -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libopennsl_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsaibcm_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/libhiredis0.13*.deb \ + && dpkg_apt /deps/libswsscommon_*.deb \ + && dpkg_apt /deps/libopennsl_*.deb \ + && dpkg_apt /deps/libsaibcm_*.deb \ + && dpkg_apt /deps/libsairedis_*.deb \ + && dpkg_apt /deps/syncd_*.deb ## TODO: add kmod into Depends RUN apt-get install -f kmod +COPY ["deps/dsserve", "deps/bcmcmd", "start.sh", "/usr/local/bin/"] + ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps -ENTRYPOINT service rsyslog start \ - && service syncd start \ - && /bin/bash +ENTRYPOINT /usr/local/bin/start.sh \ + && /bin/bash diff --git a/docker-syncd/start.sh b/docker-syncd/start.sh new file mode 100755 index 000000000000..346936ff2f59 --- /dev/null +++ b/docker-syncd/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +service rsyslog start +service syncd start diff --git a/docker-vas/Dockerfile b/docker-vas/Dockerfile index cd9378523ea2..1b51bb968cff 100755 --- a/docker-vas/Dockerfile +++ b/docker-vas/Dockerfile @@ -1,17 +1,18 @@ FROM docker-base -## Pre-install the fundamental packages -RUN apt-get update && apt-get -y install \ - sudo - -COPY deps /deps -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/vasclnt_*.deb && \ - dpkg_apt /deps/vasgp_*.deb +COPY deps/vasclnt_*.deb deps/vasgp_*.deb /deps/ +COPY user-override /etc/opt/quest/vas/user-override +## Pre-install the fundamental packages ## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ + apt-get -y install \ + sudo \ + && \ + dpkg_apt /deps/vasclnt_*.deb && \ + dpkg_apt /deps/vasgp_*.deb && \ + apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ + rm -rf /deps ## Expose to host, ie. image content will copy to host when container started ## For .so diff --git a/docker-vas/user-override b/docker-vas/user-override new file mode 100644 index 000000000000..cb16ea6ded0f --- /dev/null +++ b/docker-vas/user-override @@ -0,0 +1,2 @@ +# Overrides every member to have the bash shell +::::::/bin/bash diff --git a/files/Aboot/boot0 b/files/Aboot/boot0 index 98522bdfe647..8a0d0b77cf11 100644 --- a/files/Aboot/boot0 +++ b/files/Aboot/boot0 @@ -1,3 +1,4 @@ +#!/bin/sh # Copyright (C) 2016 Arista Networks, Inc. # # This program is free software: you can redistribute it and/or modify @@ -37,11 +38,33 @@ if [ -d "${swipath}" ]; then exit 1 fi -## Determine whether installing by hash file in the image +## Check the hash file in the image, and determine to install or just skip GIT_REVISION=$(unzip -p ${swipath} .imagehash) LOCAL_IMAGEHASH=$(cat $TARGET_PATH/.imagehash 2>/dev/null || true) if [ "$GIT_REVISION" != "$LOCAL_IMAGEHASH" ]; then + ## Clean old directory for read-write layer + rm -rf ${TARGET_PATH}/rw + + ## Unzip the image unzip -oq ${swipath} -x boot0 -d ${TARGET_PATH} + + ## Detect SKU and create a hardware description file + aboot_version=`grep ^Aboot /etc/cmdline | sed 's/^.*norcal.-//'` + aboot_build_date=`stat -c %y /bin/sysinit | sed 's/ /T/'` + if `grep -q platform=raven /etc/cmdline`; then + aboot_machine=arista_7050_qx32 + else + aboot_machine=arista_7050_qx32s + fi + cat < ${TARGET_PATH}/machine.conf +aboot_version=$aboot_version +aboot_vendor=arista +aboot_platform=x86_64-$aboot_machine +aboot_machine=$aboot_machine +aboot_arch=x86_64 +aboot_build_date=$aboot_build_date +EOF + fi echo "${append}" >/tmp/append diff --git a/files/docker/docker.service.conf b/files/docker/docker.service.conf index 2d6d3cfaa6fb..bfc44fb48f99 100644 --- a/files/docker/docker.service.conf +++ b/files/docker/docker.service.conf @@ -1,3 +1,3 @@ [Service] ExecStart= -ExecStart=/usr/bin/docker daemon -H fd:// --storage-driver=aufs +ExecStart=/usr/bin/docker daemon -H fd:// --storage-driver=aufs --bip=240.127.1.1/24 diff --git a/files/initramfs-tools/union-mount b/files/initramfs-tools/union-mount index 85fba9df3a0a..b343d56c6e22 100644 --- a/files/initramfs-tools/union-mount +++ b/files/initramfs-tools/union-mount @@ -4,10 +4,15 @@ case $1 in exit 0 ;; esac + +## Mount the aufs file system: rw layer over squashfs mkdir -p ${rootmnt}/host/rw mount -n -o dirs=${rootmnt}/host/rw:${rootmnt}=ro -t aufs root-aufs ${rootmnt} +## Mount the raw partition again mount ${ROOT} ${rootmnt}/host -mkdir -p /root/var/lib/docker -mount --bind /root/host/var/lib/docker /root/var/lib/docker -mkdir -p /root/boot -mount --bind /root/host/boot /root/boot +## Mount the working directory of docker engine in the raw partition, bypass the aufs +mkdir -p ${rootmnt}/var/lib/docker +mount --bind ${rootmnt}/host/var/lib/docker ${rootmnt}/var/lib/docker +## Mount the boot directory in the raw partition, bypass the aufs +mkdir -p ${rootmnt}/boot +mount --bind ${rootmnt}/host/boot ${rootmnt}/boot diff --git a/files/sshd/host-ssh-keygen.sh b/files/sshd/host-ssh-keygen.sh new file mode 100755 index 000000000000..476dd00a2800 --- /dev/null +++ b/files/sshd/host-ssh-keygen.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +[ -r /etc/ssh/ssh_host_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/files/sshd/sshd.service b/files/sshd/sshd.service new file mode 100644 index 000000000000..d79c574da516 --- /dev/null +++ b/files/sshd/sshd.service @@ -0,0 +1,16 @@ +[Unit] +Description=OpenBSD Secure Shell server +After=network.target auditd.service +ConditionPathExists=!/etc/ssh/sshd_not_to_be_run + +[Service] +EnvironmentFile=-/etc/default/ssh +ExecStartPre=-/usr/local/bin/host-ssh-keygen.sh +ExecStart=/usr/sbin/sshd -D $SSHD_OPTS +ExecReload=/bin/kill -HUP $MAINPID +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target +Alias=sshd.service diff --git a/functions.sh b/functions.sh index b9e7ee0b55e6..99dfcb9db3f1 100644 --- a/functions.sh +++ b/functions.sh @@ -36,3 +36,10 @@ die() { warn "$message" exit 1 } + +docker_try_rmi() { + local image_name="$1" + ## Note: inspect output has quotation characters, so sed to remove it as an argument + local image_id=$(docker inspect --format="{{json .Id}}" $image_name | sed -e 's/^"//' -e 's/"$//') + [ -z "$image_id" ] || docker rmi $image_name +} diff --git a/installer/x86_64/dell-s6000-replace-reboot.sh b/installer/x86_64/dell-s6000-replace-reboot.sh new file mode 100755 index 000000000000..48ac8a62f548 --- /dev/null +++ b/installer/x86_64/dell-s6000-replace-reboot.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +echo "Replace ONIE reboot with Dell reset commands" + +# set I2C GPIO mux +echo 1 > /sys/class/gpio/export +echo 2 > /sys/class/gpio/export +echo out > /sys/class/gpio/gpio1/direction +echo out > /sys/class/gpio/gpio2/direction +echo 0 > /sys/class/gpio/gpio1/value +echo 0 > /sys/class/gpio/gpio2/value + +# replace the original reboot binary with the following command +rm /sbin/reboot +echo 'i2cset -y 0 0x31 1 0xfd' > /sbin/reboot +chmod a+x /sbin/reboot diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 528c14727280..58243be24283 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -39,6 +39,28 @@ if [ $(id -u) -ne 0 ] exit 1 fi +# get running machine from conf file +[ -r /etc/machine.conf ] && . /etc/machine.conf + +echo "onie_platform: $onie_platform" + +# default console settings +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=9600 + +# Get platform specific linux kernel command line arguments +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" +# platform specific configurations +if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then + `pwd`/dell-s6000-replace-reboot.sh +elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then + ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" +elif [ "$onie_platform" == "x86_64-dell_s6100_c2538-r0" ]; then + CONSOLE_PORT=0x2f8 + CONSOLE_DEV=1 +fi + # Install demo on same block device as ONIE onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') blk_dev=$(echo $onie_dev | sed -e 's/[1-9][0-9]*$//' | sed -e 's/\([0-9]\)\(p\)/\1/') @@ -180,6 +202,7 @@ create_demo_gpt_partition() --attributes=${demo_part}:=:$attr_bitmask \ --change-name=${demo_part}:$demo_volume_revision_label $blk_dev \ || { + echo "Warning: The first trial of creating partition failed, trying the largest aligned available block of sectors on the disk" begin=$(sgdisk -F $blk_dev) end=$(sgdisk -E $blk_dev) sgdisk --new=${demo_part}:$begin:$end \ @@ -379,7 +402,10 @@ ${onie_bin} mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || { # Decompress the file for the file system directly to the partition unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt -# store installation log in demo file system +# Store machine description in target file system +cp /etc/machine.conf $demo_mnt + +# Store installation log in target file system rm -f $onie_initrd_tmp/tmp/onie-support.tar.bz2 ${onie_bin} onie-support /tmp mv $onie_initrd_tmp/tmp/onie-support.tar.bz2 $demo_mnt @@ -408,8 +434,8 @@ trap_push "rm $grub_cfg || true" [ -r ./platform.conf ] && . ./platform.conf -DEFAULT_GRUB_SERIAL_COMMAND="serial --port=%%CONSOLE_PORT%% --speed=%%CONSOLE_SPEED%% --word=8 --parity=no --stop=1" -DEFAULT_GRUB_CMDLINE_LINUX="console=tty0 console=ttyS%%CONSOLE_DEV%%,%%CONSOLE_SPEED%%n8 quiet" +DEFAULT_GRUB_SERIAL_COMMAND="serial --port=${CONSOLE_PORT} --speed=${CONSOLE_SPEED} --word=8 --parity=no --stop=1" +DEFAULT_GRUB_CMDLINE_LINUX="console=tty0 console=ttyS${CONSOLE_DEV},${CONSOLE_SPEED}n8 quiet" GRUB_SERIAL_COMMAND=${GRUB_SERIAL_COMMAND:-"$DEFAULT_GRUB_SERIAL_COMMAND"} GRUB_CMDLINE_LINUX=${GRUB_CMDLINE_LINUX:-"$DEFAULT_GRUB_CMDLINE_LINUX"} export GRUB_SERIAL_COMMAND @@ -460,7 +486,7 @@ menuentry '$demo_grub_entry' { insmod ext2 linux /boot/vmlinuz-3.16.0-4-amd64 root=$demo_dev rw $GRUB_CMDLINE_LINUX \ loop=$FILESYSTEM_SQUASHFS loopfstype=squashfs \ - apparmor=1 security=apparmor + apparmor=1 security=apparmor $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_revision_label $demo_type initial ramdisk ...' initrd /boot/initrd.img-3.16.0-4-amd64 } @@ -474,3 +500,5 @@ mkdir -p $onie_initrd_tmp/$demo_mnt/grub cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg cd / + +echo "Installed SONiC base image $demo_volume_revision_label successfully" diff --git a/onie-mk-demo.sh b/onie-mk-demo.sh index 3dd81b876fd6..992558e23f3a 100755 --- a/onie-mk-demo.sh +++ b/onie-mk-demo.sh @@ -39,11 +39,6 @@ fi exit 1 } -[ -n "$CONSOLE_SPEED" ] || { - echo "Error: Invalid CONSOLE_SPEED" - exit 1 -} - [ -r "$platform_conf" ] || { echo "Error: Unable to read installer platform configuration file: $platform_conf" exit 1 @@ -81,7 +76,7 @@ tmp_dir=$(mktemp --directory) tmp_installdir="$tmp_dir/installer" mkdir $tmp_installdir || clean_up 1 -cp $installer_dir/$arch/install.sh $tmp_installdir || clean_up 1 +cp $installer_dir/$arch/* $tmp_installdir || clean_up 1 cp onie-image.conf $tmp_installdir # Escape special chars in the user provide kernel cmdline string for use in @@ -92,10 +87,6 @@ EXTRA_CMDLINE_LINUX=`echo $EXTRA_CMDLINE_LINUX | sed -e 's/[\/&]/\\\&/g'` sed -i -e "s/%%DEMO_TYPE%%/$demo_type/g" \ -e "s/%%GIT_REVISION%%/$git_revision/g" \ -e "s/%%ONIE_IMAGE_PART_SIZE%%/$onie_image_part_size/" \ - -e "s/%%CONSOLE_SPEED%%/$CONSOLE_SPEED/g" \ - -e "s/%%CONSOLE_DEV%%/$CONSOLE_DEV/g" \ - -e "s/%%CONSOLE_FLAG%%/$CONSOLE_FLAG/g" \ - -e "s/%%CONSOLE_PORT%%/$CONSOLE_PORT/g" \ -e "s/%%EXTRA_CMDLINE_LINUX%%/$EXTRA_CMDLINE_LINUX/" \ $tmp_installdir/install.sh || clean_up 1 echo -n "." From 854d12f8484684ce1a6b9c9d59b720aa3386f6a3 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 27 Jul 2016 11:55:18 -0700 Subject: [PATCH 0009/1833] Add .gitignore, creat a symlink --- .gitignore | 2 ++ docker-orchagent-mlnx | 1 + 2 files changed, 3 insertions(+) create mode 100644 .gitignore create mode 120000 docker-orchagent-mlnx diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..0288d69b6418 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +deps/ + diff --git a/docker-orchagent-mlnx b/docker-orchagent-mlnx new file mode 120000 index 000000000000..8d52609c56e5 --- /dev/null +++ b/docker-orchagent-mlnx @@ -0,0 +1 @@ +docker-orchagent \ No newline at end of file From e4bd20c18a1a479957b63775d9a9f1880bf91f0e Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 4 Aug 2016 10:39:33 -0700 Subject: [PATCH 0010/1833] Squash merge master (11de390) --- .gitmodules | 14 ++- Makefile | 111 ++++++++++++++++++ README.md | 46 ++++---- build_debian.sh | 4 +- build_docker.sh | 18 +-- build_image.sh | 1 + docker-ptf/Dockerfile | 48 -------- docker-base => dockers/docker-base | 0 .../docker-basic_router}/Dockerfile | 0 {docker-bgp => dockers/docker-bgp}/Dockerfile | 0 {docker-bgp => dockers/docker-bgp}/daemons | 0 .../docker-database}/Dockerfile | 0 {docker-fpm => dockers/docker-fpm}/Dockerfile | 0 {docker-fpm => dockers/docker-fpm}/start.sh | 0 .../docker-lldp}/Dockerfile | 6 +- .../docker-mlnx-sswsyncd-rpc}/Dockerfile | 0 .../docker-mlnx-sswsyncd}/Dockerfile | 0 .../docker-orchagent-mlnx | 0 .../docker-orchagent}/Dockerfile | 0 .../docker-orchagent}/start.sh | 2 +- .../docker-platform-monitor}/Dockerfile | 0 dockers/docker-ptf/Dockerfile | 75 ++++++++++++ .../docker-ptf}/supervisord.conf | 0 .../docker-snmp}/Dockerfile | 0 .../docker-sswsyncd}/Dockerfile | 0 .../docker-syncd-mlnx-rpc}/Dockerfile | 0 .../docker-syncd-mlnx}/Dockerfile | 0 .../docker-syncd}/Dockerfile | 4 +- .../docker-syncd}/start.sh | 0 {docker-vas => dockers/docker-vas}/Dockerfile | 0 .../docker-vas}/user-override | 0 functions.sh | 8 +- get_deps.sh | 19 --- onie-image.conf | 4 +- src/Makefile | 67 +++++++++++ src/brcm-sdk/filelist.txt | 4 + src/hiredis/build.sh | 14 +++ src/initramfs-tools/build.sh | 19 +++ .../loopback-file-system-support.patch | 0 src/mlnx-sdk/filelist.txt | 32 +++++ src/quagga/build.sh | 36 ++++++ src/redis/build.sh | 14 +++ src/sonic-linux-kernel | 1 + src/sonic-sairedis | 1 + src/sonic-swss | 1 + src/sonic-swss-common | 1 + 46 files changed, 441 insertions(+), 109 deletions(-) create mode 100644 Makefile delete mode 100644 docker-ptf/Dockerfile rename docker-base => dockers/docker-base (100%) rename {docker-basic_router => dockers/docker-basic_router}/Dockerfile (100%) rename {docker-bgp => dockers/docker-bgp}/Dockerfile (100%) rename {docker-bgp => dockers/docker-bgp}/daemons (100%) rename {docker-database => dockers/docker-database}/Dockerfile (100%) rename {docker-fpm => dockers/docker-fpm}/Dockerfile (100%) rename {docker-fpm => dockers/docker-fpm}/start.sh (100%) rename {docker-lldp => dockers/docker-lldp}/Dockerfile (87%) rename {docker-mlnx-sswsyncd-rpc => dockers/docker-mlnx-sswsyncd-rpc}/Dockerfile (100%) rename {docker-mlnx-sswsyncd => dockers/docker-mlnx-sswsyncd}/Dockerfile (100%) rename docker-orchagent-mlnx => dockers/docker-orchagent-mlnx (100%) rename {docker-orchagent => dockers/docker-orchagent}/Dockerfile (100%) rename {docker-orchagent => dockers/docker-orchagent}/start.sh (88%) rename {docker-platform-monitor => dockers/docker-platform-monitor}/Dockerfile (100%) create mode 100644 dockers/docker-ptf/Dockerfile rename {docker-ptf => dockers/docker-ptf}/supervisord.conf (100%) rename {docker-snmp => dockers/docker-snmp}/Dockerfile (100%) rename {docker-sswsyncd => dockers/docker-sswsyncd}/Dockerfile (100%) rename {docker-syncd-mlnx-rpc => dockers/docker-syncd-mlnx-rpc}/Dockerfile (100%) rename {docker-syncd-mlnx => dockers/docker-syncd-mlnx}/Dockerfile (100%) rename {docker-syncd => dockers/docker-syncd}/Dockerfile (86%) rename {docker-syncd => dockers/docker-syncd}/start.sh (100%) rename {docker-vas => dockers/docker-vas}/Dockerfile (100%) rename {docker-vas => dockers/docker-vas}/user-override (100%) delete mode 100755 get_deps.sh create mode 100644 src/Makefile create mode 100644 src/brcm-sdk/filelist.txt create mode 100755 src/hiredis/build.sh create mode 100755 src/initramfs-tools/build.sh rename {patch => src}/initramfs-tools/loopback-file-system-support.patch (100%) create mode 100644 src/mlnx-sdk/filelist.txt create mode 100755 src/quagga/build.sh create mode 100755 src/redis/build.sh create mode 160000 src/sonic-linux-kernel create mode 160000 src/sonic-sairedis create mode 160000 src/sonic-swss create mode 160000 src/sonic-swss-common diff --git a/.gitmodules b/.gitmodules index 267fb9435909..88123322f032 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,15 @@ [submodule "docker-base"] - path = docker-base + path = dockers/docker-base url = https://github.com/Azure/sonic-docker-base.git +[submodule "sonic-swss-common"] + path = src/sonic-swss-common + url = https://github.com/Azure/sonic-swss-common +[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 +[submodule "sonic-swss"] + path = src/sonic-swss + url = https://github.com/Azure/sonic-swss diff --git a/Makefile b/Makefile new file mode 100644 index 000000000000..743cb4e7689d --- /dev/null +++ b/Makefile @@ -0,0 +1,111 @@ +## TODO: if install dev package really happens, rebuild the depending project + +## Arguments from make command line +USERNAME= +PASSWORD_ENCRYPTED= + +## Select bash for commands +SHELL := /bin/bash + +## Capture all the files in SDK directories +MLNX-SDK-DEBS=$(notdir $(wildcard src/mlnx-sdk/*.deb)) +BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb)) + +## Function: build_docker, image_name save_file +## build a docker image and save to a file +define build_docker + docker build --no-cache -t $(1) dockers/$(1) + mkdir -p `dirname $(2)` + docker save $(1) | gzip -c > $(2) +endef + +## Rules +.phony : brcm-all mlnx-all + +src/%: + $(MAKE) -C src $(subst src/,,$@) + +dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-fpm/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-orchagent-mlnx/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-orchagent-mlnx/deps/%: src/mlnx/% + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-orchagent/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-orchagent/deps/%: src/brcm/% + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-%-mlnx/deps/syncd_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-%/deps/syncd_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-%-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-%/deps/libsairedis_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $@ + +$(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb + mkdir -p `dirname $@` && cp $< $@ + +$(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-syncd/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $@ + +deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb + mkdir -p `dirname $@` && cp $< $@ + +deps/initramfs-tools_%.deb: src/initramfs-tools/initramfs-tools_%.deb + mkdir -p `dirname $@` && cp $< $@ + +target/docker-base.gz: + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb) + ## TODO: remove placeholders for the dependencies + touch dockers/docker-syncd/deps/{dsserve,bcmcmd} + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb orchagent swssconfig portsyncd intfsyncd neighsyncd) + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb orchagent swssconfig portsyncd intfsyncd neighsyncd) + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb fpmsyncd) + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/acs-generic.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb + ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=generic ./build_image.sh + +target/acs-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb + ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh + +## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd +brcm-all: target/acs-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz) + +## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd +mlnx-all: target/acs-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz) diff --git a/README.md b/README.md index 27171d288cde..736990f11157 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,42 @@ -# Build Switch Images - buildimage +# Build SONiC Switch Images - buildimage # Description Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS. # Prerequisite -## 1. Build environment -Preferably use [the Dockerfile](https://github.com/Azure/sonic-build-tools/blob/master/sonic-slave/Dockerfile), or use Debian Jessie and manually install packages appearing in the Dockerfile. -## 2. Linux kernel with switch drivers -Build the [Azure/sonic-linux-kernel](https://github.com/Azure/sonic-linux-kernel) project and copy the output .deb file into ./deps directory. +## 1. Clone or fetch the code repository with all git submodules +To clone the code repository recursively, assuming git version 1.9 or newer -## 3. initramfs-tools with loop device support -Run the script to build the .deb file into ./deps directory. + git clone --recursive https://github.com/Azure/sonic-buildimage.git - ./get_deps.sh - -## 4. Fetch the git submodule -If there is no files under ./docker-base, manually fetch them. +If it is already cloned, however there is no files under ./dockers/docker-base/ or ./src/sonic-linux-kernel/, manually fetch all the git submodules. git submodule update --init --recursive +## 2. Build environment +Build a docker image by [the Dockerfile](https://github.com/Azure/sonic-build-tools/blob/master/sonic-slave/Dockerfile) and build all remains in the docker container. + # Usage -## Build NOS installer image +## Build NOS installer image and docker images - ./build_debian USERNAME PASSWORD_ENCRYPTED && ./build_image.sh - -For example, the user name is 'admin' and the password is 'YourPaSsWoRd'. + make [VENDOR]-all USERNAME=[USERNAME] PASSWORD_ENCRYPTED=[PASSWORD_ENCRYPTED] - ./build_debian.sh "admin" "$(perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"')" && ./build_image.sh +Supported VENDOR are: +- brcm: Broadcom +- mlnx: Mellanox -The root is disabled, but the created user could sudo. +For example, the user name is 'admin' and the password is 'YourPaSsWoRd'. To build all the images for Broadcom platform, use the command: + make brcm-all USERNAME="admin" PASSWORD_ENCRYPTED="$(perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"')" -## Build docker images +The root is disabled, but the created user could sudo. - ./build_docker.sh docker-sswsyncd - ./build_docker.sh docker-database - ./build_docker.sh docker-bgp - ./build_docker.sh docker-snmp - ./build_docker.sh docker-lldp - ./build_docker.sh docker-basic_router +The target directory is ./target, containing the NOS installer image and docker images. +- acs-generic.bin: SONiC switch installer image (ONIE compatiable) +- docker-base.gz: base docker image where others are built from (gzip tar archive) +- docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive) +- docker-orchagent.gz: docker image for SWitch State Service (SWSS) +- docker-syncd.gz: docker image for the daemon to sync database and switch ASIC # Contribution guide diff --git a/build_debian.sh b/build_debian.sh index e283e5965ead..5ad7c7d46676 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -89,7 +89,7 @@ trap_push clean_sys sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs ## Pointing apt to public apt mirrors and getting latest packages, needed for latest security updates -sudo cp docker-base/sources.list $FILESYSTEM_ROOT/etc/apt/ +sudo cp dockers/docker-base/sources.list $FILESYSTEM_ROOT/etc/apt/ sudo cp files/apt/apt.conf.d/81norecommends $FILESYSTEM_ROOT/etc/apt/apt.conf.d/ sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'apt-mark auto `apt-mark showmanual`' @@ -142,7 +142,7 @@ wget $docker_deb_url -qO $docker_deb_temp && { } sudo chroot $FILESYSTEM_ROOT docker version sudo chroot $FILESYSTEM_ROOT service docker stop -## Add docker config drop-in to select aufs, otherwise it may other storage driver +## Add docker config drop-in to select aufs, otherwise it may select other storage driver 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 $_ diff --git a/build_docker.sh b/build_docker.sh index 14a545bfc73b..0088a72e278f 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -42,19 +42,19 @@ done shift "$((OPTIND - 1))" ## Dockerfile directory -DOCKER_BUILD_DIR=$1 +DOCKER_BUILD_DIR=dockers/$1 REGISTRY_SERVER=$2 REGISTRY_PORT=$3 REGISTRY_USERNAME=$4 REGISTRY_PASSWD=$5 -[ -d "$DOCKER_BUILD_DIR" ] || { +[ -f "$DOCKER_BUILD_DIR"/Dockerfile ] || { echo "Invalid DOCKER_BUILD_DIR directory" >&2 exit 1 } [ -n "$docker_image_name" ] || { - docker_image_name=$DOCKER_BUILD_DIR + docker_image_name=$(basename $DOCKER_BUILD_DIR) } [ ${BUILD_NUMBER} ] || { @@ -93,10 +93,14 @@ image_id=$(docker inspect --format="{{json .Id}}" $docker_image_name | sed -e 's ## TODO: wait docker-squash supporting Docker 1.10+ ## ref: https://github.com/jwilder/docker-squash/issues/45 if [ "$docker_image_name" = "docker-base" ]; then + ## Run old image in a container tmp_container=$(docker run -d ${docker_image_name} /bin/bash) + ## Export the container's filesystem, then import as a new image docker export $tmp_container | docker import - ${docker_image_name} - trap_push "docker rmi $image_id" - trap_push "docker rm -f $tmp_container || true" + ## Remove the container + docker rm -f $tmp_container || true + ## Remove the old image + docker rmi -f $image_id || true fi image_sha='' @@ -113,8 +117,8 @@ if [ -n "$REGISTRY_SERVER" ] && [ -n "$REGISTRY_PORT" ]; then ## Push image to registry server ## And get the image digest SHA256 - trap_push "docker rmi $remote_image_name" - trap_push "docker rmi $build_remote_image_name" + trap_push "docker rmi $remote_image_name || true" + trap_push "docker rmi $build_remote_image_name || true" image_sha=$(docker push $remote_image_name | sed -n "s/.*: digest: sha256:\([0-9a-f]*\).*/\\1/p") docker push $build_remote_image_name fi diff --git a/build_image.sh b/build_image.sh index e4a93d8dfbf8..887d63ae049f 100755 --- a/build_image.sh +++ b/build_image.sh @@ -19,6 +19,7 @@ } GIT_REVISION=$(git rev-parse --short HEAD) +mkdir -p `dirname $OUTPUT_ONIE_IMAGE` sudo rm -f $OUTPUT_ONIE_IMAGE if [ "$TARGET_MACHINE" = "generic" ]; then ## Generate an ONIE installer image diff --git a/docker-ptf/Dockerfile b/docker-ptf/Dockerfile deleted file mode 100644 index 6c35e524a91d..000000000000 --- a/docker-ptf/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -FROM debian:jessie - -MAINTAINER Pavel Shirshov - -## Copy dependencies -COPY deps /root/deps - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -## Set the apt source, update package cache and install necessary packages -RUN echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" > /etc/apt/sources.list \ - && apt-get update \ - && apt-get upgrade -y \ - && apt-get dist-upgrade -y \ - && apt-get install -y --no-install-recommends \ - openssh-server \ - vim-tiny \ - python \ - python-scapy \ - net-tools \ - python-setuptools \ - supervisor \ - traceroute \ - lsof \ - tcpdump \ - && dpkg -i /root/deps/python-ptf_*.deb \ - && dpkg -i --force-depends /root/deps/libthrift-0.9.2_*.deb \ - && dpkg -i --force-depends /root/deps/python-thrift_*.deb \ - && apt-get -y install -f \ - && rm -rf /root/deps \ - && apt-get -y autoclean \ - && apt-get -y autoremove \ - && rm -rf /var/lib/apt/lists/* - -## Adjust sshd settings -RUN mkdir /var/run/sshd \ - && echo 'root:root' | chpasswd \ - && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config \ - && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config \ - && sed -i '$aUseDNS no' /etc/ssh/sshd_config \ - && mkdir /root/deps - -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf - -EXPOSE 22 - -ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/docker-base b/dockers/docker-base similarity index 100% rename from docker-base rename to dockers/docker-base diff --git a/docker-basic_router/Dockerfile b/dockers/docker-basic_router/Dockerfile similarity index 100% rename from docker-basic_router/Dockerfile rename to dockers/docker-basic_router/Dockerfile diff --git a/docker-bgp/Dockerfile b/dockers/docker-bgp/Dockerfile similarity index 100% rename from docker-bgp/Dockerfile rename to dockers/docker-bgp/Dockerfile diff --git a/docker-bgp/daemons b/dockers/docker-bgp/daemons similarity index 100% rename from docker-bgp/daemons rename to dockers/docker-bgp/daemons diff --git a/docker-database/Dockerfile b/dockers/docker-database/Dockerfile similarity index 100% rename from docker-database/Dockerfile rename to dockers/docker-database/Dockerfile diff --git a/docker-fpm/Dockerfile b/dockers/docker-fpm/Dockerfile similarity index 100% rename from docker-fpm/Dockerfile rename to dockers/docker-fpm/Dockerfile diff --git a/docker-fpm/start.sh b/dockers/docker-fpm/start.sh similarity index 100% rename from docker-fpm/start.sh rename to dockers/docker-fpm/start.sh diff --git a/docker-lldp/Dockerfile b/dockers/docker-lldp/Dockerfile similarity index 87% rename from docker-lldp/Dockerfile rename to dockers/docker-lldp/Dockerfile index bcfd378a73da..aa66c24b659d 100644 --- a/docker-lldp/Dockerfile +++ b/dockers/docker-lldp/Dockerfile @@ -1,6 +1,6 @@ FROM docker-base -COPY deps/*py2*.whl deps/python-sswsdk_*.deb deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ +COPY deps/*py2*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ ## Pre-install the fundamental packages ## Install Python SSWSDK (lldpsyncd dependancy) @@ -10,8 +10,10 @@ COPY deps/*py2*.whl deps/python-sswsdk_*.deb deps/lldpsyncd_*.deb deps/lldpd_*.d RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ dpkg_apt /deps/lldpd_*.deb && \ dpkg_apt /deps/lldpsyncd_*.deb && \ + apt-get install -y python-pip && \ + pip install /deps/*.whl && \ + apt-get remove -y python-pip && \ apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ - pip install --no-cache-dir /deps/*.whl && \ rm -rf /deps ## There is a known bug: agetty processes at 100% cpu diff --git a/docker-mlnx-sswsyncd-rpc/Dockerfile b/dockers/docker-mlnx-sswsyncd-rpc/Dockerfile similarity index 100% rename from docker-mlnx-sswsyncd-rpc/Dockerfile rename to dockers/docker-mlnx-sswsyncd-rpc/Dockerfile diff --git a/docker-mlnx-sswsyncd/Dockerfile b/dockers/docker-mlnx-sswsyncd/Dockerfile similarity index 100% rename from docker-mlnx-sswsyncd/Dockerfile rename to dockers/docker-mlnx-sswsyncd/Dockerfile diff --git a/docker-orchagent-mlnx b/dockers/docker-orchagent-mlnx similarity index 100% rename from docker-orchagent-mlnx rename to dockers/docker-orchagent-mlnx diff --git a/docker-orchagent/Dockerfile b/dockers/docker-orchagent/Dockerfile similarity index 100% rename from docker-orchagent/Dockerfile rename to dockers/docker-orchagent/Dockerfile diff --git a/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh similarity index 88% rename from docker-orchagent/start.sh rename to dockers/docker-orchagent/start.sh index a5155e0513ad..5eca68ed4e5b 100755 --- a/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -12,7 +12,7 @@ if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" PORTSYNCD_ARGS+="-p /etc/ssw/ACS-S6000/port_config.ini" elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then - ORCHAGENT_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini" + PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini" fi service rsyslog start diff --git a/docker-platform-monitor/Dockerfile b/dockers/docker-platform-monitor/Dockerfile similarity index 100% rename from docker-platform-monitor/Dockerfile rename to dockers/docker-platform-monitor/Dockerfile diff --git a/dockers/docker-ptf/Dockerfile b/dockers/docker-ptf/Dockerfile new file mode 100644 index 000000000000..dff8f7196a6a --- /dev/null +++ b/dockers/docker-ptf/Dockerfile @@ -0,0 +1,75 @@ +FROM debian:jessie + +MAINTAINER Pavel Shirshov + +## Copy dependencies +COPY deps /root/deps + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +## Set the apt source, update package cache and install necessary packages +RUN echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" > /etc/apt/sources.list \ + && apt-get update \ + && apt-get upgrade -y \ + && apt-get dist-upgrade -y \ + && apt-get install -y --no-install-recommends \ + openssh-server \ + vim \ + python \ + python-scapy \ + net-tools \ + python-setuptools \ + supervisor \ + traceroute \ + lsof \ + tcpdump \ + unzip \ + pkg-config \ + binutils \ + net-tools \ + python-pip \ + build-essential \ + libssl-dev \ + libffi-dev \ + python-dev \ + wget \ + cmake \ + && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ + && dpkg_apt /root/deps/python-ptf_*.deb \ + && dpkg_apt /root/deps/libthrift-0.9.2_*.deb \ + && dpkg_apt /root/deps/python-thrift_*.deb \ + && rm -rf /root/deps \ + && apt-get -y autoclean \ + && apt-get -y autoremove \ + && rm -rf /var/lib/apt/lists/* \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ + && pip install cffi \ + && pip install --upgrade cffi \ + && pip install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py + +## Adjust sshd settings +RUN mkdir /var/run/sshd \ + && echo 'root:root' | chpasswd \ + && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config \ + && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config \ + && sed -i '$aUseDNS no' /etc/ssh/sshd_config \ + && mkdir /root/deps + +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +EXPOSE 22 + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/docker-ptf/supervisord.conf b/dockers/docker-ptf/supervisord.conf similarity index 100% rename from docker-ptf/supervisord.conf rename to dockers/docker-ptf/supervisord.conf diff --git a/docker-snmp/Dockerfile b/dockers/docker-snmp/Dockerfile similarity index 100% rename from docker-snmp/Dockerfile rename to dockers/docker-snmp/Dockerfile diff --git a/docker-sswsyncd/Dockerfile b/dockers/docker-sswsyncd/Dockerfile similarity index 100% rename from docker-sswsyncd/Dockerfile rename to dockers/docker-sswsyncd/Dockerfile diff --git a/docker-syncd-mlnx-rpc/Dockerfile b/dockers/docker-syncd-mlnx-rpc/Dockerfile similarity index 100% rename from docker-syncd-mlnx-rpc/Dockerfile rename to dockers/docker-syncd-mlnx-rpc/Dockerfile diff --git a/docker-syncd-mlnx/Dockerfile b/dockers/docker-syncd-mlnx/Dockerfile similarity index 100% rename from docker-syncd-mlnx/Dockerfile rename to dockers/docker-syncd-mlnx/Dockerfile diff --git a/docker-syncd/Dockerfile b/dockers/docker-syncd/Dockerfile similarity index 86% rename from docker-syncd/Dockerfile rename to dockers/docker-syncd/Dockerfile index a3d45eb71fe7..16b70961a497 100755 --- a/docker-syncd/Dockerfile +++ b/dockers/docker-syncd/Dockerfile @@ -15,11 +15,11 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return ## TODO: add kmod into Depends RUN apt-get install -f kmod -COPY ["deps/dsserve", "deps/bcmcmd", "start.sh", "/usr/local/bin/"] +COPY ["deps/dsserve", "deps/bcmcmd", "start.sh", "/usr/bin/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps -ENTRYPOINT /usr/local/bin/start.sh \ +ENTRYPOINT /usr/bin/start.sh \ && /bin/bash diff --git a/docker-syncd/start.sh b/dockers/docker-syncd/start.sh similarity index 100% rename from docker-syncd/start.sh rename to dockers/docker-syncd/start.sh diff --git a/docker-vas/Dockerfile b/dockers/docker-vas/Dockerfile similarity index 100% rename from docker-vas/Dockerfile rename to dockers/docker-vas/Dockerfile diff --git a/docker-vas/user-override b/dockers/docker-vas/user-override similarity index 100% rename from docker-vas/user-override rename to dockers/docker-vas/user-override diff --git a/functions.sh b/functions.sh index 99dfcb9db3f1..b808f727278f 100644 --- a/functions.sh +++ b/functions.sh @@ -41,5 +41,11 @@ docker_try_rmi() { local image_name="$1" ## Note: inspect output has quotation characters, so sed to remove it as an argument local image_id=$(docker inspect --format="{{json .Id}}" $image_name | sed -e 's/^"//' -e 's/"$//') - [ -z "$image_id" ] || docker rmi $image_name + [ -z "$image_id" ] || { + ## Remove all the exited containers from this image + docker ps -a -q -f "status=exited" -f "ancestor=$1" | xargs --no-run-if-empty docker rm + ## Note: If there are running containers from this image, the build system is in an + ## unexpected state. The 'rmi' will fail and we need investigate the build environment. + docker rmi $image_name + } } diff --git a/get_deps.sh b/get_deps.sh deleted file mode 100755 index 145caf620af9..000000000000 --- a/get_deps.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -## This script is to build the dependencies of an ONIE installer image -## -## USAGE: -## ./get_deps.sh - -# Obtaining the initramfs-tools -rm -rf deps/initramfs-tools -git clone --branch v0.120 https://anonscm.debian.org/git/kernel/initramfs-tools.git deps/initramfs-tools - -# Patch -pushd deps/initramfs-tools -patch -p1 < $OLDPWD/patch/initramfs-tools/loopback-file-system-support.patch - -# Build the package -fakeroot debian/rules clean -fakeroot debian/rules binary - -popd diff --git a/onie-image.conf b/onie-image.conf index 25c631563cd9..b7e43b6a0a74 100644 --- a/onie-image.conf +++ b/onie-image.conf @@ -1,5 +1,5 @@ ## DESCRIPTION: -## partition related config +## config for ONIE image ## ## Partition size in MB @@ -19,4 +19,4 @@ FILESYSTEM_SQUASHFS=fs.squashfs ONIE_INSTALLER_PAYLOAD=fs.zip ## Output file name for onie installer -OUTPUT_ONIE_IMAGE=acs-$TARGET_MACHINE.bin +OUTPUT_ONIE_IMAGE=target/acs-$TARGET_MACHINE.bin diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 000000000000..09e1152dec48 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,67 @@ +## TODO: if install dev package really happens, rebuild the depending project + +.ONESHELL: +SHELL := /bin/bash + +## Function: build_project, directory +## Build the project and save the .deb target in the same directory +## TRICK: clean dh state so it will force recreating .deb later +define build_project + rm -f $(1)/debian/*.debhelper.log + pushd $(1) + [ ! -f ./autogen.sh ] || ./autogen.sh + dpkg-buildpackage -rfakeroot -b -us -uc + popd +endef + +## Function: install_deb, debfile +install_deb = \ + [ -f $(1) ] && { sudo dpkg -i $(1) || sudo apt-get -y install -f; } || return 1; + +## Rules +quagga_0.99.24.1-2_amd64.deb: + pushd quagga; ./build.sh; popd + +redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0.7-2_amd64.deb: + pushd redis; ./build.sh; popd + +libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0.7-2_amd64.deb + pushd hiredis; ./build.sh; popd + +libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + $(call build_project, sonic-swss-common) + +brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb brcm-sdk/libopennsl_*_amd64.deb brcm-sdk/libsaibcm_1.0.2*_amd64.deb brcm-sdk/libsaibcm-dev_1.0.2*_amd64.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + $(call build_project, sonic-sairedis) + mkdir -p brcm + cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb brcm/ + +mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/applibs_1.mlnx.4.2.2100_amd64.deb mlnx-sdk/*.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + $(call build_project, sonic-sairedis) + mkdir -p mlnx + cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb mlnx/ + +## Note: fpmsyncd is one implicit target +brcm/swss_1.0.0_amd64.deb brcm/intfsyncd brcm/neighsyncd brcm/orchagent brcm/portsyncd brcm/routeresync brcm/swssconfig: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + $(call build_project, sonic-swss) + cp swss_1.0.0_amd64.deb brcm/ + cp sonic-swss/debian/swss/usr/bin/* brcm/ + cp sonic-swss/debian/swss/usr/bin/fpmsyncd . + +## Note: fpmsyncd is one implicit target +mlnx/swss_1.0.0_amd64.deb mlnx/intfsyncd mlnx/neighsyncd mlnx/orchagent mlnx/portsyncd mlnx/routeresync mlnx/swssconfig: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + $(call build_project, sonic-swss) + cp swss_1.0.0_amd64.deb mlnx/ + cp sonic-swss/debian/swss/usr/bin/* mlnx/ + cp sonic-swss/debian/swss/usr/bin/fpmsyncd . + +$(addprefix sonic-linux-kernel/,linux-headers-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb linux-headers-3.16.0-4-common_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64-dbg_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb xen-linux-system-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb): + pushd sonic-linux-kernel; sudo ./build.sh; popd + +initramfs-tools/initramfs-tools_0.120_all.deb: + pushd initramfs-tools; ./build.sh; popd diff --git a/src/brcm-sdk/filelist.txt b/src/brcm-sdk/filelist.txt new file mode 100644 index 000000000000..211759436536 --- /dev/null +++ b/src/brcm-sdk/filelist.txt @@ -0,0 +1,4 @@ +libopennsl_6.4.11-1+0~20160719212144.23~1.gbp8ec2d1_amd64.deb +libsaibcm-dbg_1.0.2~20160727172452.52_amd64.deb +libsaibcm-dev_1.0.2~20160727172452.52_amd64.deb +libsaibcm_1.0.2~20160727172452.52_amd64.deb diff --git a/src/hiredis/build.sh b/src/hiredis/build.sh new file mode 100755 index 000000000000..de8ab036f06c --- /dev/null +++ b/src/hiredis/build.sh @@ -0,0 +1,14 @@ +#!/bin/bash -x + +sudo apt-get install -y libjemalloc-dev + +# Install redis-server +sudo dpkg -i redis/*.deb + +wget http://http.debian.net/debian/pool/main/h/hiredis/hiredis_0.13.3.orig.tar.gz +wget http://http.debian.net/debian/pool/main/h/hiredis/hiredis_0.13.3-2.debian.tar.xz +wget http://http.debian.net/debian/pool/main/h/hiredis/hiredis_0.13.3-2.dsc +dpkg-source -x hiredis_0.13.3-2.dsc +pushd hiredis-0.13.3; fakeroot debian/rules binary; popd + +cp *.deb .. diff --git a/src/initramfs-tools/build.sh b/src/initramfs-tools/build.sh new file mode 100755 index 000000000000..335b834a538b --- /dev/null +++ b/src/initramfs-tools/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash +## This script is to build the initramfs-tools with patches +## +## USAGE: +## ./build.sh + +# Obtaining the initramfs-tools +rm -rf ./initramfs-tools +git clone --branch v0.120 https://anonscm.debian.org/git/kernel/initramfs-tools.git ./initramfs-tools + +# Patch +pushd ./initramfs-tools +patch -p1 < $OLDPWD/loopback-file-system-support.patch + +# Build the package +rm -f debian/*.debhelper.log +dpkg-buildpackage -rfakeroot -b -us -uc + +popd diff --git a/patch/initramfs-tools/loopback-file-system-support.patch b/src/initramfs-tools/loopback-file-system-support.patch similarity index 100% rename from patch/initramfs-tools/loopback-file-system-support.patch rename to src/initramfs-tools/loopback-file-system-support.patch diff --git a/src/mlnx-sdk/filelist.txt b/src/mlnx-sdk/filelist.txt new file mode 100644 index 000000000000..16f482f334e9 --- /dev/null +++ b/src/mlnx-sdk/filelist.txt @@ -0,0 +1,32 @@ +applibs-dev_1.mlnx.4.2.2100_amd64.deb +applibs_1.mlnx.4.2.2100_amd64.deb +iproute2-dev_1.mlnx.4.2.2100_amd64.deb +iproute2_1.mlnx.4.2.2100_amd64.deb +mft_4.1.0-28_amd64.deb +mlnx-sai_1.mlnx.160712_amd64.deb +python-sdk-api_1.mlnx.4.2.2100_amd64.deb +sx-acl-rm-dev_1.mlnx.4.2.2100_amd64.deb +sx-acl-rm_1.mlnx.4.2.2100_amd64.deb +sx-complib-dev-static_1.mlnx.4.2.2100_amd64.deb +sx-complib-dev_1.mlnx.4.2.2100_amd64.deb +sx-complib_1.mlnx.4.2.2100_amd64.deb +sx-examples-dev_1.mlnx.4.2.2100_amd64.deb +sx-examples_1.mlnx.4.2.2100_amd64.deb +sx-gen-utils-dev_1.mlnx.4.2.2100_amd64.deb +sx-gen-utils_1.mlnx.4.2.2100_amd64.deb +sx-kernel-dev_1.mlnx.4.2.2100_amd64.deb +sx-kernel_1.mlnx.4.2.2100_amd64.deb +sx-libnl-dev-static_1.mlnx.4.2.2100_amd64.deb +sx-libnl-dev_1.mlnx.4.2.2100_amd64.deb +sx-libnl_1.mlnx.4.2.2100_amd64.deb +sx-scew-dev-static_1.mlnx.4.2.2100_amd64.deb +sx-scew-dev_1.mlnx.4.2.2100_amd64.deb +sx-scew_1.mlnx.4.2.2100_amd64.deb +sx-sdn-hal-dev-static_1.mlnx.4.2.2100_amd64.deb +sx-sdn-hal-dev_1.mlnx.4.2.2100_amd64.deb +sx-sdn-hal_1.mlnx.4.2.2100_amd64.deb +sxd-libs-dev-static_1.mlnx.4.2.2100_amd64.deb +sxd-libs-dev_1.mlnx.4.2.2100_amd64.deb +sxd-libs_1.mlnx.4.2.2100_amd64.deb +testx-dev_1.mlnx.4.2.2100_amd64.deb +testx_1.mlnx.4.2.2100_amd64.deb diff --git a/src/quagga/build.sh b/src/quagga/build.sh new file mode 100755 index 000000000000..03ea3bf5cd5a --- /dev/null +++ b/src/quagga/build.sh @@ -0,0 +1,36 @@ +#!/bin/bash -x + +mkdir quagga + +# Get debian source for 0.9.24.1-2 +wget -O quagga_0.99.24.1.orig.tar.gz 'https://sonicstorage.blob.core.windows.net/packages/quagga_0.99.24.1.orig.tar.gz?sv=2015-04-05&sr=b&sig=7g3AC%2FkoX3wYztJYtXFt6Wl7zj%2BYwLkbXVNaSaRvUDU%3D&se=2026-07-21T00%3A07%3A31Z&sp=r' +tar -xzf quagga_0.99.24.1.orig.tar.gz --strip-components=1 -C quagga +ls -lrt + +# Get debian packaging for 0.99.24.1-2 +wget -O quagga_0.99.24.1-2.debian.tar.xz 'https://sonicstorage.blob.core.windows.net/packages/quagga_0.99.24.1-2.debian.tar.xz?sv=2015-04-05&sr=b&sig=VFEq4ec99OjVaypAx14DkO5I8N4CIBIPOuSw79qHUXg%3D&se=2026-07-21T00%3A03%3A10Z&sp=r' +tar -xJf quagga_0.99.24.1-2.debian.tar.xz -C quagga +ls -lrt + +cd quagga +ls -lrt + +# Enable FPM in debian/rules +awk '/--with-libpam/ { print; print " --enable-fpm \\"; next }1' debian/rules > tmp && mv tmp debian/rules + +# Update changelog +#echo 'quagga (0.99.24.1-2.1) unstable; urgency=medium +# +# * Non-maintainer upload. +# * enable fpm +# +# -- Guohan Lu Sat, 18 Jul 2015 16:10:47 -0700 +#' > tmp && cat debian/changelog >> tmp && mv tmp debian/changelog + +#./configure --enable-fpm +#make + +sudo chmod a+x debian/rules +dpkg-buildpackage -rfakeroot -b -us -uc +cd .. +cp *.deb .. diff --git a/src/redis/build.sh b/src/redis/build.sh new file mode 100755 index 000000000000..44f3e06018cb --- /dev/null +++ b/src/redis/build.sh @@ -0,0 +1,14 @@ +#!/bin/bash -x + +export REDIS_DOWNLOAD_URL=http://http.debian.net/debian/pool/main/r/redis/redis_3.0.7.orig.tar.gz +export REDIS_PACKAGING_URL=http://http.debian.net/debian/pool/main/r/redis/redis_3.0.7-2.debian.tar.xz + +wget -O redis_3.0.7-2.dsc 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7-2.dsc?sv=2015-04-05&sr=b&sig=evQtsWTIUFlgWbzLLifS1lDgop%2BzlqIP8ehZl3p%2FCKI%3D&se=2026-07-24T01%3A48%3A19Z&sp=r' +wget -O redis_3.0.7.orig.tar.gz 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7.orig.tar.gz?sv=2015-04-05&sr=b&sig=0ht16%2Fi8%2FPZQHp1PrDPYW0iRwcLfUPw1JpKUapizu8o%3D&se=2026-07-24T01%3A48%3A49Z&sp=r' +wget -O redis_3.0.7-2.debian.tar.xz 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7-2.debian.tar.xz?sv=2015-04-05&sr=b&sig=4a33ECTvURfNUEDkS436ZlSsIpLIC9QdJrBBRIoWpW0%3D&se=2026-07-24T01%3A49%3A22Z&sp=r' + +dpkg-source -x redis_3.0.7-2.dsc + +pushd redis-3.0.7; fakeroot debian/rules binary; popd + +cp *.deb .. diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel new file mode 160000 index 000000000000..9794d29a08a4 --- /dev/null +++ b/src/sonic-linux-kernel @@ -0,0 +1 @@ +Subproject commit 9794d29a08a4f81fbcd900e03072561f42b81074 diff --git a/src/sonic-sairedis b/src/sonic-sairedis new file mode 160000 index 000000000000..68b0a9b914c3 --- /dev/null +++ b/src/sonic-sairedis @@ -0,0 +1 @@ +Subproject commit 68b0a9b914c3a3816c809d7951de70136d09dc27 diff --git a/src/sonic-swss b/src/sonic-swss new file mode 160000 index 000000000000..b56c9cc507cd --- /dev/null +++ b/src/sonic-swss @@ -0,0 +1 @@ +Subproject commit b56c9cc507cdfc473d6d0d1159f134dfd83a96df diff --git a/src/sonic-swss-common b/src/sonic-swss-common new file mode 160000 index 000000000000..38b461a168a6 --- /dev/null +++ b/src/sonic-swss-common @@ -0,0 +1 @@ +Subproject commit 38b461a168a6154aad978d3a97f08c2c933e943a From 47093642a26eec29fd8606cd80dfc9da6b09c0bd Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 5 Aug 2016 11:27:03 -0700 Subject: [PATCH 0011/1833] Update README: Get vendor SAI SDK --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 736990f11157..86a755ed86d0 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,15 @@ If it is already cloned, however there is no files under ./dockers/docker-base/ ## 2. Build environment Build a docker image by [the Dockerfile](https://github.com/Azure/sonic-build-tools/blob/master/sonic-slave/Dockerfile) and build all remains in the docker container. +## 3. Get vendor SAI SDK +Obtain Switch Abstraction Interface (SAI) SDK from one of supported vendors (see the list in [Usage](#usage) Section), and place it in the directory ./src/[VENDOR]-sdk/ as filelist.txt in that directory. + # Usage -## Build NOS installer image and docker images +To build NOS installer image and docker images, run command line make [VENDOR]-all USERNAME=[USERNAME] PASSWORD_ENCRYPTED=[PASSWORD_ENCRYPTED] -Supported VENDOR are: +Supported VENDORs are: - brcm: Broadcom - mlnx: Mellanox From b647bb59d441240bd50102476eced496a83b6f45 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 8 Aug 2016 10:38:36 -0700 Subject: [PATCH 0012/1833] (comment) --- README.md | 2 +- src/brcm-sdk/filelist.txt | 3 +++ src/mlnx-sdk/filelist.txt | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 86a755ed86d0..cd972cac71da 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ The target directory is ./target, containing the NOS installer image and docker # Contribution guide -All contributors must sign a contribution license agreement before contributions can be accepted. Contact daloher@microsoft.com. Later this will be automated. +All contributors must sign a contribution license agreement before contributions can be accepted. Contact sonic-cla-agreements@microsoft.com. ### GitHub Workflow diff --git a/src/brcm-sdk/filelist.txt b/src/brcm-sdk/filelist.txt index 211759436536..549d89f54567 100644 --- a/src/brcm-sdk/filelist.txt +++ b/src/brcm-sdk/filelist.txt @@ -1,3 +1,6 @@ +## Get vendor SAI SDK +## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk + libopennsl_6.4.11-1+0~20160719212144.23~1.gbp8ec2d1_amd64.deb libsaibcm-dbg_1.0.2~20160727172452.52_amd64.deb libsaibcm-dev_1.0.2~20160727172452.52_amd64.deb diff --git a/src/mlnx-sdk/filelist.txt b/src/mlnx-sdk/filelist.txt index 16f482f334e9..de603733b860 100644 --- a/src/mlnx-sdk/filelist.txt +++ b/src/mlnx-sdk/filelist.txt @@ -1,3 +1,6 @@ +## Get vendor SAI SDK +## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk + applibs-dev_1.mlnx.4.2.2100_amd64.deb applibs_1.mlnx.4.2.2100_amd64.deb iproute2-dev_1.mlnx.4.2.2100_amd64.deb From d5d7168f10da33b8e329f3597d98a8a873926614 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 29 Aug 2016 11:45:57 -0700 Subject: [PATCH 0013/1833] Top level Makefile will build docker-database --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 743cb4e7689d..990c42b54a85 100644 --- a/Makefile +++ b/Makefile @@ -97,6 +97,10 @@ target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docke target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb fpmsyncd) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/docker-database.gz: target/docker-base.gz + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) target/acs-generic.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=generic ./build_image.sh @@ -105,7 +109,7 @@ target/acs-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd6 ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -brcm-all: target/acs-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz) +brcm-all: target/acs-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-database.gz) ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -mlnx-all: target/acs-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz) +mlnx-all: target/acs-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-database.gz) From 4843e0671f9adbee207c09f386bdbcfc4b27b34d Mon Sep 17 00:00:00 2001 From: "John Arnold (AZURE)" Date: Tue, 6 Sep 2016 13:15:10 -0700 Subject: [PATCH 0014/1833] Changed ACS references to SONiC in image, added timestamp to base image volume label --- Makefile | 8 ++++---- README.md | 2 +- build_debian.sh | 2 +- build_docker.sh | 2 +- installer/x86_64/install.sh | 13 ++++++++----- onie-image.conf | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 990c42b54a85..7694de6a41d4 100644 --- a/Makefile +++ b/Makefile @@ -102,14 +102,14 @@ target/docker-database.gz: target/docker-base.gz docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/acs-generic.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb +target/sonic-generic.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=generic ./build_image.sh -target/acs-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb +target/sonic-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -brcm-all: target/acs-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-database.gz) +brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-database.gz) ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -mlnx-all: target/acs-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-database.gz) +mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-database.gz) diff --git a/README.md b/README.md index cd972cac71da..48cfd8bfde56 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ For example, the user name is 'admin' and the password is 'YourPaSsWoRd'. To bui The root is disabled, but the created user could sudo. The target directory is ./target, containing the NOS installer image and docker images. -- acs-generic.bin: SONiC switch installer image (ONIE compatiable) +- sonic-generic.bin: SONiC switch installer image (ONIE compatiable) - docker-base.gz: base docker image where others are built from (gzip tar archive) - docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive) - docker-orchagent.gz: docker image for SWitch State Service (SWSS) diff --git a/build_debian.sh b/build_debian.sh index 5ad7c7d46676..fee836538d6f 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -109,7 +109,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'cd /dev && MAKEDEV generic' ## However, 'dpkg -i' plus 'apt-get install -f' will ignore the recommended dependency. So ## we install busybox explicitly sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install busybox -echo '[INFO] Install ACS linux kernel image' +echo '[INFO] Install SONiC linux kernel image' ## Note: duplicate apt-get command to ensure every line return zero sudo dpkg --root=$FILESYSTEM_ROOT -i deps/initramfs-tools_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f diff --git a/build_docker.sh b/build_docker.sh index 0088a72e278f..f37e13334d2d 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -1,5 +1,5 @@ #!/bin/bash -## This script is to automate the preparation for docker images for ACS. +## This script is to automate the preparation for docker images for SONiC. ## If registry server and port provided, the images will be pushed there. set -e diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 58243be24283..555bfdde53c3 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -111,9 +111,10 @@ demo_type="%%DEMO_TYPE%%" # The build system prepares this script by replacing %%GIT_REVISION%% # with git revision hash as a version identifier git_revision="%%GIT_REVISION%%" +timestamp="$(date -u +%Y%m%d)" -demo_volume_label="ACS-${demo_type}" -demo_volume_revision_label="ACS-${demo_type}-${git_revision}" +demo_volume_label="SONiC-${demo_type}" +demo_volume_revision_label="SONiC-${demo_type}-${timestamp}-${git_revision}" # auto-detect whether BIOS or UEFI if [ -d "/sys/firmware/efi/efivars" ] ; then @@ -143,6 +144,8 @@ fi # # Returns the created partition number in $demo_part demo_part="" +# TODO: remove reference to "ACS-OS" after all baseimages are upgraded +legacy_volume_label="ACS_OS" create_demo_gpt_partition() { blk_dev="$1" @@ -153,7 +156,7 @@ create_demo_gpt_partition() mkfifo -m 600 "$tmpfifo" # See if demo partition already exists - demo_part=$(sgdisk -p $blk_dev | grep "$demo_volume_label" | awk '{print $1}') + demo_part=$(sgdisk -p $blk_dev | grep -e "$demo_volume_label" -e "$legacy_volume_label" | awk '{print $1}') if [ -n "$demo_part" ] ; then # delete existing partitions # if there are multiple partitions matched, we should delete each one, except the current OS's @@ -225,7 +228,7 @@ create_demo_msdos_partition() # See if demo partition already exists -- look for the filesystem # label. - part_info="$(blkid | grep $demo_volume_label | awk -F: '{print $1}')" + part_info="$(blkid | grep -e "$demo_volume_label" -e "$legacy_volume_label" | awk -F: '{print $1}')" if [ -n "$part_info" ] ; then # delete existing partition demo_part="$(echo -n $part_info | sed -e s#${blk_dev}##)" @@ -268,7 +271,7 @@ create_demo_uefi_partition() create_demo_gpt_partition "$1" # erase any related EFI BootOrder variables from NVRAM. - for b in $(efibootmgr | grep "$demo_volume_label" | awk '{ print $1 }') ; do + for b in $(efibootmgr | grep -e "$demo_volume_label" -e "$legacy_volume_label" | awk '{ print $1 }') ; do local num=${b#Boot} # Remove trailing '*' num=${num%\*} diff --git a/onie-image.conf b/onie-image.conf index b7e43b6a0a74..389c4dd50256 100644 --- a/onie-image.conf +++ b/onie-image.conf @@ -19,4 +19,4 @@ FILESYSTEM_SQUASHFS=fs.squashfs ONIE_INSTALLER_PAYLOAD=fs.zip ## Output file name for onie installer -OUTPUT_ONIE_IMAGE=target/acs-$TARGET_MACHINE.bin +OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin From 06ed5f61f7b4f2ff453862dbc1c3a07f3da19838 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 10 Sep 2016 00:19:12 +0000 Subject: [PATCH 0015/1833] PR 50374: bug fix: fix legacy partition name from ACS_OS to ACS-OS - bug fix: fix legacy partition name from ACS_OS to ACS-OS --- installer/x86_64/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 555bfdde53c3..3b585332af49 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -145,7 +145,7 @@ fi # Returns the created partition number in $demo_part demo_part="" # TODO: remove reference to "ACS-OS" after all baseimages are upgraded -legacy_volume_label="ACS_OS" +legacy_volume_label="ACS-OS" create_demo_gpt_partition() { blk_dev="$1" From cc7f15094cb0f07d9461e40eb69b66f3ddeac7ae Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 9 Sep 2016 17:53:41 -0700 Subject: [PATCH 0016/1833] Squashed merge master --- .gitignore | 14 +++++- README.md | 3 +- build_docker.sh | 5 +- dockers/docker-lldp/Dockerfile | 19 ++------ dockers/docker-lldp/supervisord.conf | 16 +++++++ dockers/docker-orchagent/Dockerfile | 6 +-- dockers/docker-orchagent/start.sh | 17 +++++++ dockers/docker-ptf/Dockerfile | 22 +++++---- dockers/docker-ptf/ptf_nn_agent.conf | 10 ++++ dockers/docker-ptf/sshd.conf | 10 ++++ dockers/docker-ptf/supervisord.conf | 11 ----- dockers/docker-snmp/Dockerfile | 23 ++------- dockers/docker-snmp/supervisord.conf | 11 +++++ dockers/docker-syncd-mlnx-rpc/Dockerfile | 26 +++++----- .../docker-syncd-mlnx-rpc/ptf_nn_agent.conf | 10 ++++ .../docker-syncd-mlnx-rpc/supervisord.conf | 2 + dockers/docker-syncd-mlnx/Dockerfile | 7 +-- dockers/docker-syncd-mlnx/start.sh | 14 ++++++ dockers/docker-syncd-rpc/Dockerfile | 48 +++++++++++++++++++ dockers/docker-syncd-rpc/ptf_nn_agent.conf | 10 ++++ dockers/docker-syncd-rpc/supervisord.conf | 2 + dockers/docker-syncd/Dockerfile | 4 +- dockers/docker-syncd/start.sh | 10 ++++ installer/x86_64/install.sh | 12 +---- .../platforms/x86_64-dell_s6000_s1220-r0 | 2 + .../platforms/x86_64-dell_s6100_c2538-r0 | 2 + .../platforms/x86_64-mlnx_x86-r5.0.1400 | 1 + onie-mk-demo.sh | 2 +- 28 files changed, 231 insertions(+), 88 deletions(-) create mode 100644 dockers/docker-lldp/supervisord.conf create mode 100644 dockers/docker-ptf/ptf_nn_agent.conf create mode 100644 dockers/docker-ptf/sshd.conf create mode 100644 dockers/docker-snmp/supervisord.conf create mode 100644 dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf create mode 100644 dockers/docker-syncd-mlnx-rpc/supervisord.conf create mode 100755 dockers/docker-syncd-mlnx/start.sh create mode 100644 dockers/docker-syncd-rpc/Dockerfile create mode 100644 dockers/docker-syncd-rpc/ptf_nn_agent.conf create mode 100644 dockers/docker-syncd-rpc/supervisord.conf create mode 100644 installer/x86_64/platforms/x86_64-dell_s6000_s1220-r0 create mode 100644 installer/x86_64/platforms/x86_64-dell_s6100_c2538-r0 create mode 100644 installer/x86_64/platforms/x86_64-mlnx_x86-r5.0.1400 diff --git a/.gitignore b/.gitignore index 0288d69b6418..18225c156201 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,14 @@ deps/ - +dockers/*/files/ +*.bin +*.deb +*.zip +fsroot/ +fs.* +src/hiredis/hiredis_* +src/hiredis/hiredis-*/ +src/quagga/quagga_* +src/quagga/quagga/ +src/initramfs-tools/initramfs-tools/ +src/redis/redis_* +src/redis/redis-*/ diff --git a/README.md b/README.md index 48cfd8bfde56..c257b9334903 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,8 @@ The target directory is ./target, containing the NOS installer image and docker - docker-base.gz: base docker image where others are built from (gzip tar archive) - docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive) - docker-orchagent.gz: docker image for SWitch State Service (SWSS) -- docker-syncd.gz: docker image for the daemon to sync database and switch ASIC +- docker-syncd.gz: docker image for the daemon to sync database and Broadcom switch ASIC +- docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC # Contribution guide diff --git a/build_docker.sh b/build_docker.sh index f37e13334d2d..67c21ba4d6ce 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -9,7 +9,7 @@ set -e usage() { cat >&2 < target/$docker_image_name.$image_sha.gz +docker save $docker_image_name | gzip -c > target/$docker_image_name.$build_version.gz +echo "Image sha256: $image_sha" diff --git a/dockers/docker-lldp/Dockerfile b/dockers/docker-lldp/Dockerfile index aa66c24b659d..6167a735f7d0 100644 --- a/dockers/docker-lldp/Dockerfile +++ b/dockers/docker-lldp/Dockerfile @@ -10,23 +10,12 @@ COPY deps/*py2*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ dpkg_apt /deps/lldpd_*.deb && \ dpkg_apt /deps/lldpsyncd_*.deb && \ - apt-get install -y python-pip && \ + apt-get install -y python-pip supervisor && \ pip install /deps/*.whl && \ apt-get remove -y python-pip && \ - apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ + apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ rm -rf /deps -## There is a known bug: agetty processes at 100% cpu -## When: -## 1. running container in --privileged mode -## 2. container runs /sbin/init -## ref: https://github.com/docker/docker/issues/4040 -## Temporary solution: -## Disable tty services permanently -RUN systemctl --no-pager list-unit-files --type=service | grep getty | awk '{print $1}' | xargs systemctl mask -## Note: getty@.service in last grep output will not mask below cases -RUN systemctl mask getty@tty1.service +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -## Specify init as CMD to enable systemd -## Note: don't provide ENTRYPOINT at the same time -CMD ["/sbin/init"] +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-lldp/supervisord.conf b/dockers/docker-lldp/supervisord.conf new file mode 100644 index 000000000000..161c0ab38a2b --- /dev/null +++ b/dockers/docker-lldp/supervisord.conf @@ -0,0 +1,16 @@ +[supervisord] +nodaemon=true + +[program:lldpd] +## -d: Do not daemonize. If this option is specified, lldpd will run in +## the foreground and log to stderr. This option can be specified +## many times to increase verbosity +command=/usr/sbin/lldpd -dd +## route stderr to the syslog service instead of being saved to files +stderr_logfile=syslog + +[program:lldpsyncd] +command=/usr/sbin/lldpsyncd + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n diff --git a/dockers/docker-orchagent/Dockerfile b/dockers/docker-orchagent/Dockerfile index 17fbfe9e7274..9f677cd34cdc 100755 --- a/dockers/docker-orchagent/Dockerfile +++ b/dockers/docker-orchagent/Dockerfile @@ -11,7 +11,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return RUN apt-get install -f -y ifupdown bridge-utils ## Copy executable binaries -COPY ["deps/orchagent","deps/swssconfig","deps/portsyncd","deps/intfsyncd","deps/neighsyncd","/usr/local/bin/"] +COPY ["deps/orchagent","deps/swssconfig","deps/portsyncd","deps/intfsyncd","deps/neighsyncd","/usr/bin/"] COPY start.sh /usr/bin/start.sh @@ -19,5 +19,5 @@ COPY start.sh /usr/bin/start.sh RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps -ENTRYPOINT /usr/bin/start.sh \ - && /bin/bash +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 5eca68ed4e5b..2f29e98abdd1 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -1,5 +1,16 @@ #!/bin/bash +function clean_up { + kill -9 $ORCHAGENT_PID + kill -9 $PORTSYNCD_PID + kill -9 $INTFSYNCD_PID + kill -9 $NEIGHSYNCD_PID + service rsyslog stop + exit +} + +trap clean_up SIGTERM SIGKILL + . /host/machine.conf MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` @@ -17,9 +28,15 @@ fi service rsyslog start orchagent $ORCHAGENT_ARGS & +ORCHAGENT_PID=$! sleep 5 portsyncd $PORTSYNCD_ARGS & +PORTSYNCD_PID=$! sleep 5 intfsyncd & +INTFSYNCD_PID=$! sleep 5 neighsyncd & +NEIGHSYNCD_PID=$! + +read diff --git a/dockers/docker-ptf/Dockerfile b/dockers/docker-ptf/Dockerfile index dff8f7196a6a..cf458af61949 100644 --- a/dockers/docker-ptf/Dockerfile +++ b/dockers/docker-ptf/Dockerfile @@ -9,11 +9,11 @@ COPY deps /root/deps ENV DEBIAN_FRONTEND=noninteractive ## Set the apt source, update package cache and install necessary packages -RUN echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" > /etc/apt/sources.list \ - && apt-get update \ - && apt-get upgrade -y \ +RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /etc/apt/sources.list \ + && apt-get update \ + && apt-get upgrade -y \ && apt-get dist-upgrade -y \ - && apt-get install -y --no-install-recommends \ + && apt-get install -y \ openssh-server \ vim \ python \ @@ -47,14 +47,15 @@ RUN echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" > / && tar xvfz 1.0.0.tar.gz \ && cd nanomsg-1.0.0 \ && mkdir -p build \ - && cmake . \ + && cd build \ + && cmake .. \ && make install \ && ldconfig \ - && cd .. \ + && cd ../.. \ && rm -fr nanomsg-1.0.0 \ && rm -f 1.0.0.tar.gz \ - && pip install cffi \ - && pip install --upgrade cffi \ + && pip install cffi==1.7.0 \ + && pip install --upgrade cffi==1.7.0 \ && pip install nnpy \ && mkdir -p /opt \ && cd /opt \ @@ -69,7 +70,10 @@ RUN mkdir /var/run/sshd \ && mkdir /root/deps COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY sshd.conf /etc/supervisor/conf.d/sshd.conf +COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf EXPOSE 22 -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT while [ "x$( ifconfig eth3 | grep RUNNING )" = 'x' ] ; do sleep 1 ; done \ + && /usr/bin/supervisord diff --git a/dockers/docker-ptf/ptf_nn_agent.conf b/dockers/docker-ptf/ptf_nn_agent.conf new file mode 100644 index 000000000000..6fb30d61d7c2 --- /dev/null +++ b/dockers/docker-ptf/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 0@tcp://127.0.0.1:10900 -i 0-3@eth3 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/dockers/docker-ptf/sshd.conf b/dockers/docker-ptf/sshd.conf new file mode 100644 index 000000000000..8238e7762fbf --- /dev/null +++ b/dockers/docker-ptf/sshd.conf @@ -0,0 +1,10 @@ +[program:sshd] +command=/usr/sbin/sshd -D +process_name=sshd +stdout_logfile=/tmp/sshd.out.log +stderr_logfile=/tmp/sshd.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/dockers/docker-ptf/supervisord.conf b/dockers/docker-ptf/supervisord.conf index 94559fd0785c..54296b8b254e 100644 --- a/dockers/docker-ptf/supervisord.conf +++ b/dockers/docker-ptf/supervisord.conf @@ -1,13 +1,2 @@ [supervisord] nodaemon=true - -[program:sshd] -command=/usr/sbin/sshd -D -process_name=sshd -stdout_logfile=/tmp/sshd.out.log -stderr_logfile=/tmp/sshd.err.log -redirect_stderr=false -autostart=true -autorestart=true -startsecs=1 -numprocs=1 \ No newline at end of file diff --git a/dockers/docker-snmp/Dockerfile b/dockers/docker-snmp/Dockerfile index 7286b7fe570d..ad08f754a423 100644 --- a/dockers/docker-snmp/Dockerfile +++ b/dockers/docker-snmp/Dockerfile @@ -19,7 +19,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return rm -rf /deps # install subagent -RUN apt-get -y install build-essential wget libssl-dev openssl && \ +RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ rm -rf /var/lib/apt/lists/* && \ wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz && \ tar xvf Python-3.5.2.tgz && cd Python-3.5.2 && \ @@ -36,27 +36,14 @@ RUN apt-get -y install build-essential wget libssl-dev openssl && \ rm -rf /usr/lib/python3.5/idlelib && \ rm -rf /usr/lib/python3.5/email && \ rm -rf /usr/lib/python3.5/test && \ - apt-get -y remove build-essential wget libssl-dev openssl && \ + apt-get -y purge build-essential wget libssl-dev openssl && \ apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ - python3 -m acs_ax_impl install && \ find / | grep -E "__pycache__" | xargs rm -rf && \ - rm -rf ~/.cache && \ - systemctl enable acs-snmp-subagent.service + rm -rf ~/.cache -## There is a known bug: agetty processes at 100% cpu -## When: -## 1. running container in --privileged mode -## 2. container runs /sbin/init -## ref: https://github.com/docker/docker/issues/4040 -## Temporary solution: -## Disable tty services permanently -RUN systemctl --no-pager list-unit-files --type=service | grep getty | awk '{print $1}' | xargs systemctl mask -## Note: getty@.service in last grep output will not mask below cases -RUN systemctl mask getty@tty1.service +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf ## Although exposing ports is not need for host net mode, keep it for possible bridge mode EXPOSE 161/udp 162/udp -## Specify init as CMD to enable systemd -## Note: don't provide ENTRYPOINT at the same time -CMD ["/sbin/init"] +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-snmp/supervisord.conf b/dockers/docker-snmp/supervisord.conf new file mode 100644 index 000000000000..f799d33d97aa --- /dev/null +++ b/dockers/docker-snmp/supervisord.conf @@ -0,0 +1,11 @@ +[supervisord] +nodaemon=true + +[program:snmpd] +command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable -p /run/snmpd.pid + +[program:acs-snmp-subagent] +command=/usr/bin/env python3 -m acs_ax_impl + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n diff --git a/dockers/docker-syncd-mlnx-rpc/Dockerfile b/dockers/docker-syncd-mlnx-rpc/Dockerfile index 3aed6f080506..0e13887adf43 100644 --- a/dockers/docker-syncd-mlnx-rpc/Dockerfile +++ b/dockers/docker-syncd-mlnx-rpc/Dockerfile @@ -3,6 +3,8 @@ FROM docker-syncd-mlnx ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +COPY deps /deps + ## Pre-install the fundamental packages RUN apt-get update \ && apt-get -y install \ @@ -23,24 +25,24 @@ RUN apt-get update \ && ldconfig \ && cd .. \ && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ && pip install cffi \ && pip install --upgrade cffi \ && pip install nnpy \ && mkdir -p /opt \ && cd /opt \ - && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py - -COPY deps /deps - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ - && dpkg -r syncd \ - && dpkg_apt /deps/syncd_*.deb \ - && dpkg_apt /deps/libthrift-0.9.2_*.deb + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ + && dpkg -r syncd \ + && dpkg_apt /deps/syncd_*.deb \ + && dpkg_apt /deps/libthrift-0.9.2_*.deb \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /deps -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf ENTRYPOINT service rsyslog start \ && service syncd start \ - && /bin/bash + && while [ "x$( ifconfig Ethernet12 | grep RUNNING )" = 'x' ] ; do sleep 1 ; done \ + && /usr/bin/supervisord diff --git a/dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf b/dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf new file mode 100644 index 000000000000..b16159a996e8 --- /dev/null +++ b/dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/dockers/docker-syncd-mlnx-rpc/supervisord.conf b/dockers/docker-syncd-mlnx-rpc/supervisord.conf new file mode 100644 index 000000000000..54296b8b254e --- /dev/null +++ b/dockers/docker-syncd-mlnx-rpc/supervisord.conf @@ -0,0 +1,2 @@ +[supervisord] +nodaemon=true diff --git a/dockers/docker-syncd-mlnx/Dockerfile b/dockers/docker-syncd-mlnx/Dockerfile index d422374fc479..afed7dae38bb 100755 --- a/dockers/docker-syncd-mlnx/Dockerfile +++ b/dockers/docker-syncd-mlnx/Dockerfile @@ -24,10 +24,11 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb +COPY ["start.sh", "/usr/bin/"] + ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps -ENTRYPOINT service rsyslog start \ - && service syncd start \ - && /bin/bash +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-syncd-mlnx/start.sh b/dockers/docker-syncd-mlnx/start.sh new file mode 100755 index 000000000000..3e5b941a7658 --- /dev/null +++ b/dockers/docker-syncd-mlnx/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +function clean_up { + service syncd stop + service rsyslog stop + exit +} + +trap clean_up SIGTERM SIGKILL + +service rsyslog start +service syncd start + +read diff --git a/dockers/docker-syncd-rpc/Dockerfile b/dockers/docker-syncd-rpc/Dockerfile new file mode 100644 index 000000000000..7a34a46a1756 --- /dev/null +++ b/dockers/docker-syncd-rpc/Dockerfile @@ -0,0 +1,48 @@ +FROM docker-syncd + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +COPY deps /deps + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + python-pip \ + build-essential \ + libssl-dev \ + libffi-dev \ + python-dev \ + wget \ + cmake \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ + && pip install cffi \ + && pip install --upgrade cffi \ + && pip install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ + && dpkg -r syncd \ + && dpkg_apt /deps/syncd_*.deb \ + && dpkg_apt /deps/libthrift-0.9.2_*.deb \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /deps + +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf + +ENTRYPOINT service rsyslog start \ + && service syncd start \ + && while [ "x$( ifconfig Ethernet12 | grep RUNNING )" = 'x' ] ; do sleep 1 ; done \ + && /usr/bin/supervisord diff --git a/dockers/docker-syncd-rpc/ptf_nn_agent.conf b/dockers/docker-syncd-rpc/ptf_nn_agent.conf new file mode 100644 index 000000000000..b16159a996e8 --- /dev/null +++ b/dockers/docker-syncd-rpc/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/dockers/docker-syncd-rpc/supervisord.conf b/dockers/docker-syncd-rpc/supervisord.conf new file mode 100644 index 000000000000..54296b8b254e --- /dev/null +++ b/dockers/docker-syncd-rpc/supervisord.conf @@ -0,0 +1,2 @@ +[supervisord] +nodaemon=true diff --git a/dockers/docker-syncd/Dockerfile b/dockers/docker-syncd/Dockerfile index 16b70961a497..63d9f3cbf113 100755 --- a/dockers/docker-syncd/Dockerfile +++ b/dockers/docker-syncd/Dockerfile @@ -21,5 +21,5 @@ COPY ["deps/dsserve", "deps/bcmcmd", "start.sh", "/usr/bin/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps -ENTRYPOINT /usr/bin/start.sh \ - && /bin/bash +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-syncd/start.sh b/dockers/docker-syncd/start.sh index 346936ff2f59..3e5b941a7658 100755 --- a/dockers/docker-syncd/start.sh +++ b/dockers/docker-syncd/start.sh @@ -1,4 +1,14 @@ #!/bin/bash +function clean_up { + service syncd stop + service rsyslog stop + exit +} + +trap clean_up SIGTERM SIGKILL + service rsyslog start service syncd start + +read diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 3b585332af49..10fe63671438 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -51,15 +51,7 @@ CONSOLE_SPEED=9600 # Get platform specific linux kernel command line arguments ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" -# platform specific configurations -if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then - `pwd`/dell-s6000-replace-reboot.sh -elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then - ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" -elif [ "$onie_platform" == "x86_64-dell_s6100_c2538-r0" ]; then - CONSOLE_PORT=0x2f8 - CONSOLE_DEV=1 -fi +source platforms/$onie_platform # Install demo on same block device as ONIE onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') @@ -362,7 +354,7 @@ demo_install_uefi_grub() grub_install_log=$(mktemp) grub-install \ --no-nvram \ - --bootloader-id="$onie_initrd_tmp/$demo_volume_label" \ + --bootloader-id="$demo_volume_label" \ --efi-directory="/boot/efi" \ --boot-directory="$demo_mnt" \ --recheck \ diff --git a/installer/x86_64/platforms/x86_64-dell_s6000_s1220-r0 b/installer/x86_64/platforms/x86_64-dell_s6000_s1220-r0 new file mode 100644 index 000000000000..f778372ded1e --- /dev/null +++ b/installer/x86_64/platforms/x86_64-dell_s6000_s1220-r0 @@ -0,0 +1,2 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="processor.max_cstate=1 intel_idle.max_cstate=0" +./dell-s6000-replace-reboot.sh diff --git a/installer/x86_64/platforms/x86_64-dell_s6100_c2538-r0 b/installer/x86_64/platforms/x86_64-dell_s6100_c2538-r0 new file mode 100644 index 000000000000..26ee5ef89de6 --- /dev/null +++ b/installer/x86_64/platforms/x86_64-dell_s6100_c2538-r0 @@ -0,0 +1,2 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 diff --git a/installer/x86_64/platforms/x86_64-mlnx_x86-r5.0.1400 b/installer/x86_64/platforms/x86_64-mlnx_x86-r5.0.1400 new file mode 100644 index 000000000000..c9c9493a5404 --- /dev/null +++ b/installer/x86_64/platforms/x86_64-mlnx_x86-r5.0.1400 @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" diff --git a/onie-mk-demo.sh b/onie-mk-demo.sh index 992558e23f3a..8997fa8c8317 100755 --- a/onie-mk-demo.sh +++ b/onie-mk-demo.sh @@ -76,7 +76,7 @@ tmp_dir=$(mktemp --directory) tmp_installdir="$tmp_dir/installer" mkdir $tmp_installdir || clean_up 1 -cp $installer_dir/$arch/* $tmp_installdir || clean_up 1 +cp -r $installer_dir/$arch/* $tmp_installdir || clean_up 1 cp onie-image.conf $tmp_installdir # Escape special chars in the user provide kernel cmdline string for use in From c14bfde3c0e5f6475fa0975a7a8bb31eddd99248 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 11 Sep 2016 07:19:59 +0000 Subject: [PATCH 0017/1833] PR 50464: remove timestamp from sonic disk partition label - remove timestamp from sonic disk partition label Ext2 filesystem labels can be at most 16 characters long Related work items: #615372 --- installer/x86_64/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 10fe63671438..e49a6484e00c 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -106,7 +106,7 @@ git_revision="%%GIT_REVISION%%" timestamp="$(date -u +%Y%m%d)" demo_volume_label="SONiC-${demo_type}" -demo_volume_revision_label="SONiC-${demo_type}-${timestamp}-${git_revision}" +demo_volume_revision_label="SONiC-${demo_type}-${git_revision}" # auto-detect whether BIOS or UEFI if [ -d "/sys/firmware/efi/efivars" ] ; then From 20d1ed42d58d0ea200aeb17cad839912214248d5 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 12 Sep 2016 17:49:15 -0700 Subject: [PATCH 0018/1833] Manually sync disk to prevent hardware reboot lost --- installer/x86_64/dell-s6000-replace-reboot.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/installer/x86_64/dell-s6000-replace-reboot.sh b/installer/x86_64/dell-s6000-replace-reboot.sh index 48ac8a62f548..b77c33f70ee7 100755 --- a/installer/x86_64/dell-s6000-replace-reboot.sh +++ b/installer/x86_64/dell-s6000-replace-reboot.sh @@ -12,5 +12,10 @@ echo 0 > /sys/class/gpio/gpio2/value # replace the original reboot binary with the following command rm /sbin/reboot -echo 'i2cset -y 0 0x31 1 0xfd' > /sbin/reboot +cat <> /sbin/reboot +#!/bin/sh +sync +i2cset -y 0 0x31 1 0xfd +EOF + chmod a+x /sbin/reboot From 7b0b44ef122e8de8d3de2593e9d66f37e0839880 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 14 Sep 2016 17:08:05 -0700 Subject: [PATCH 0019/1833] (comment) --- installer/x86_64/dell-s6000-replace-reboot.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/installer/x86_64/dell-s6000-replace-reboot.sh b/installer/x86_64/dell-s6000-replace-reboot.sh index b77c33f70ee7..5854133cc4a4 100755 --- a/installer/x86_64/dell-s6000-replace-reboot.sh +++ b/installer/x86_64/dell-s6000-replace-reboot.sh @@ -11,6 +11,8 @@ echo 0 > /sys/class/gpio/gpio1/value echo 0 > /sys/class/gpio/gpio2/value # replace the original reboot binary with the following command +# sync flushes file system buffers +# i2cset command triggers a hard system reboot, required by ASIC to operate correctly rm /sbin/reboot cat <> /sbin/reboot #!/bin/sh From 83c48fe9fc7b735084d4d781d33b6b1084e25c5b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 15 Sep 2016 15:22:29 -0700 Subject: [PATCH 0020/1833] Rename hostname (#6) --- build_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index fee836538d6f..b1cf2e67d8d8 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -38,7 +38,7 @@ DOCKER_VERSION=1.11.1-0~jessie_amd64 ## Working directory to prepare the file system FILESYSTEM_ROOT=./fsroot ## Hostname for the linux image -HOSTNAME=acs +HOSTNAME=sonic DEFAULT_USERINFO="Default admin user,,," ## Read ONIE image related config file From f19d445d4feb36ab0d569af604d87a9af86dbb22 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 16 Sep 2016 17:00:37 -0700 Subject: [PATCH 0021/1833] Update readme on build targets (#8) --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c257b9334903..e6b4764d8972 100644 --- a/README.md +++ b/README.md @@ -36,11 +36,13 @@ The root is disabled, but the created user could sudo. The target directory is ./target, containing the NOS installer image and docker images. - sonic-generic.bin: SONiC switch installer image (ONIE compatiable) -- docker-base.gz: base docker image where others are built from (gzip tar archive) +- sonic-aboot.bin: SONiC switch installer image (Aboot compatiable) +- docker-base.gz: base docker image where other docker images are built from, only used in build process (gzip tar archive) +- docker-database.gz: docker image for in-memory key-value store, used as inter-process communication (gzip tar archive) - docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive) -- docker-orchagent.gz: docker image for SWitch State Service (SWSS) -- docker-syncd.gz: docker image for the daemon to sync database and Broadcom switch ASIC -- docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC +- docker-orchagent.gz: docker image for SWitch State Service (SWSS) (gzip tar archive) +- docker-syncd.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive) +- docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) # Contribution guide From 623fdbf7f61202087b7ab73d251874c9f9f7fd5c Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 22 Sep 2016 16:16:26 -0700 Subject: [PATCH 0022/1833] Updating docker-orchagent/syncd Dockerfile and start.sh (#9) --- dockers/docker-orchagent/Dockerfile | 22 ++++++++-------- dockers/docker-orchagent/start.sh | 38 +++++++++++++++------------- dockers/docker-syncd-mlnx/Dockerfile | 9 ++++--- dockers/docker-syncd/Dockerfile | 15 ++++++----- 4 files changed, 48 insertions(+), 36 deletions(-) diff --git a/dockers/docker-orchagent/Dockerfile b/dockers/docker-orchagent/Dockerfile index 9f677cd34cdc..dbdf01f3dd98 100755 --- a/dockers/docker-orchagent/Dockerfile +++ b/dockers/docker-orchagent/Dockerfile @@ -2,16 +2,18 @@ FROM docker-base RUN apt-get update -COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "/deps/"] - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb - -RUN apt-get install -f -y ifupdown bridge-utils - -## Copy executable binaries -COPY ["deps/orchagent","deps/swssconfig","deps/portsyncd","deps/intfsyncd","deps/neighsyncd","/usr/bin/"] +COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/swss_*.deb", "/deps/"] + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/libhiredis0.13*.deb \ + && dpkg_apt /deps/libnl-3-200_*.deb \ + && dpkg_apt /deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /deps/libnl-route-3-200_*.deb \ + && dpkg_apt /deps/libswsscommon_*.deb \ + && dpkg_apt /deps/libsairedis_*.deb \ + && dpkg_apt /deps/swss_*.deb + +RUN apt-get install -f -y ifupdown bridge-utils redis-tools COPY start.sh /usr/bin/start.sh diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 2f29e98abdd1..1fdee5117f89 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -1,10 +1,18 @@ #!/bin/bash +function start_app { + orchagent $ORCHAGENT_ARGS & + portsyncd $PORTSYNCD_ARGS & + intfsyncd & + neighsyncd & + swssconfig & +} + function clean_up { - kill -9 $ORCHAGENT_PID - kill -9 $PORTSYNCD_PID - kill -9 $INTFSYNCD_PID - kill -9 $NEIGHSYNCD_PID + pkill -9 orchagent + pkill -9 portsyncd + pkill -9 intfsyncd + pkill -9 neighsyncd service rsyslog stop exit } @@ -27,16 +35,12 @@ elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then fi service rsyslog start -orchagent $ORCHAGENT_ARGS & -ORCHAGENT_PID=$! -sleep 5 -portsyncd $PORTSYNCD_ARGS & -PORTSYNCD_PID=$! -sleep 5 -intfsyncd & -INTFSYNCD_PID=$! -sleep 5 -neighsyncd & -NEIGHSYNCD_PID=$! - -read +while true; do + # Check if syncd starts + result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p` + if [ "$result" != "0" ]; then + start_app + read + fi + sleep 1 +done diff --git a/dockers/docker-syncd-mlnx/Dockerfile b/dockers/docker-syncd-mlnx/Dockerfile index afed7dae38bb..578782c1f15e 100755 --- a/dockers/docker-syncd-mlnx/Dockerfile +++ b/dockers/docker-syncd-mlnx/Dockerfile @@ -17,9 +17,12 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/iproute2_*.deb \ && dpkg_apt /deps/mft*.deb \ - && dpkg_apt /deps/libhiredis0.13*.deb \ - && dpkg_apt /deps/libswsscommon_*.deb \ - && dpkg_apt /deps/mlnx-sai_*.deb \ + && dpkg_apt /deps/libhiredis0.13*.deb \ + && dpkg_apt /deps/libnl-3-200_*.deb \ + && dpkg_apt /deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /deps/libnl-route-3-200_*.deb \ + && dpkg_apt /deps/libswsscommon_*.deb \ + && dpkg_apt /deps/mlnx-sai_*.deb \ && dpkg_apt /deps/libsairedis_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb diff --git a/dockers/docker-syncd/Dockerfile b/dockers/docker-syncd/Dockerfile index 63d9f3cbf113..9ad7e432cef9 100755 --- a/dockers/docker-syncd/Dockerfile +++ b/dockers/docker-syncd/Dockerfile @@ -2,14 +2,17 @@ FROM docker-base RUN apt-get update -COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/libopennsl_*.deb", "deps/libsaibcm_*.deb", "deps/libsairedis_*.deb", "deps/syncd_*.deb", "/deps/"] +COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libopennsl_*.deb", "deps/libsaibcm_*.deb", "deps/libsairedis_*.deb", "deps/syncd_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/libhiredis0.13*.deb \ - && dpkg_apt /deps/libswsscommon_*.deb \ - && dpkg_apt /deps/libopennsl_*.deb \ - && dpkg_apt /deps/libsaibcm_*.deb \ - && dpkg_apt /deps/libsairedis_*.deb \ + dpkg_apt /deps/libhiredis0.13*.deb \ + && dpkg_apt /deps/libnl-3-200_*.deb \ + && dpkg_apt /deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /deps/libnl-route-3-200_*.deb \ + && dpkg_apt /deps/libswsscommon_*.deb \ + && dpkg_apt /deps/libopennsl_*.deb \ + && dpkg_apt /deps/libsaibcm_*.deb \ + && dpkg_apt /deps/libsairedis_*.deb \ && dpkg_apt /deps/syncd_*.deb ## TODO: add kmod into Depends From 59d13d0feb0bc0ea77e9573746ceca670d431157 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 23 Sep 2016 11:57:16 -0700 Subject: [PATCH 0023/1833] Makefile: Use swss_*.deb file to for docker-orchagent (#10) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7694de6a41d4..4fec69a41699 100644 --- a/Makefile +++ b/Makefile @@ -86,11 +86,11 @@ target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-sy docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb orchagent swssconfig portsyncd intfsyncd neighsyncd) +target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb orchagent swssconfig portsyncd intfsyncd neighsyncd) +target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) From b4f27357858029c583ea95df6840c982216cba17 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 23 Sep 2016 14:11:35 -0700 Subject: [PATCH 0024/1833] src: Add libnl3 build.sh script (#11) --- src/libnl3/build.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 src/libnl3/build.sh diff --git a/src/libnl3/build.sh b/src/libnl3/build.sh new file mode 100755 index 000000000000..a23b8f7e3dc2 --- /dev/null +++ b/src/libnl3/build.sh @@ -0,0 +1,22 @@ +#!/bin/bash +## This script is to build the libnl3 3.2.27-1 +## +## USAGE: +## ./build.sh + +# Obtaining the libnl3 +rm -rf ./libnl3 +git clone https://anonscm.debian.org/git/collab-maint/libnl3.git +pushd ./libnl3 +git checkout -f b77c0e49cb + +# Patch +export QUILT_PATCHES=debian/patches +quilt push +quilt push +quilt push +quilt push +quilt push +dpkg-buildpackage -rfakeroot -b -us -uc + +popd From 146c88100b4f4c5b0178d73f7d203637a818aba4 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 23 Sep 2016 21:23:43 -0700 Subject: [PATCH 0025/1833] add saiserver docker for mlnx sn2700 platform (#12) * add saiserver docker for mlnx sn2700 platform --- dockers/docker-saiserver-mlnx/Dockerfile | 32 +++ dockers/docker-saiserver-mlnx/portmap.ini | 33 +++ dockers/docker-saiserver-mlnx/profile.ini | 1 + dockers/docker-saiserver-mlnx/sai_2700.xml | 243 +++++++++++++++++++++ dockers/docker-saiserver-mlnx/start.sh | 18 ++ 5 files changed, 327 insertions(+) create mode 100755 dockers/docker-saiserver-mlnx/Dockerfile create mode 100644 dockers/docker-saiserver-mlnx/portmap.ini create mode 100644 dockers/docker-saiserver-mlnx/profile.ini create mode 100644 dockers/docker-saiserver-mlnx/sai_2700.xml create mode 100755 dockers/docker-saiserver-mlnx/start.sh diff --git a/dockers/docker-saiserver-mlnx/Dockerfile b/dockers/docker-saiserver-mlnx/Dockerfile new file mode 100755 index 000000000000..bdeec7748332 --- /dev/null +++ b/dockers/docker-saiserver-mlnx/Dockerfile @@ -0,0 +1,32 @@ +FROM docker-base + +RUN apt-get update + +COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/sx-libnl_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.2_*.deb", "/deps/"] + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/applibs_*.deb \ + && dpkg_apt /deps/applibs-dev_*.deb \ + && dpkg_apt /deps/sx-complib_*.deb \ + && dpkg_apt /deps/sxd-libs_*.deb \ + && dpkg_apt /deps/sx-scew_*.deb \ + && dpkg_apt /deps/sx-examples_*.deb \ + && dpkg_apt /deps/sx-gen-utils_*.deb \ + && dpkg_apt /deps/python-sdk-api_*.deb \ + && dpkg_apt /deps/sx-libnl_*.deb \ + && dpkg_apt /deps/iproute2_*.deb \ + && dpkg_apt /deps/mlnx-sai_*.deb \ + && dpkg_apt /deps/libthrift-0.9.2_*.deb + +COPY ["deps/saiserver", "start.sh", "/usr/bin/"] + +COPY ["profile.ini", "portmap.ini", "/etc/sai/"] + +COPY ["sai_2700.xml", "/usr/share/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-saiserver-mlnx/portmap.ini b/dockers/docker-saiserver-mlnx/portmap.ini new file mode 100644 index 000000000000..4d3be08ce5f8 --- /dev/null +++ b/dockers/docker-saiserver-mlnx/portmap.ini @@ -0,0 +1,33 @@ +# alias lanes +Ethernet1 0,1,2,3 +Ethernet2 4,5,6,7 +Ethernet3 8,9,10,11 +Ethernet4 12,13,14,15 +Ethernet5 16,17,18,19 +Ethernet6 20,21,22,23 +Ethernet7 24,25,26,27 +Ethernet8 28,29,30,31 +Ethernet9 32,33,34,35 +Ethernet10 36,37,38,39 +Ethernet11 40,41,42,43 +Ethernet12 44,45,46,47 +Ethernet13 48,49,50,51 +Ethernet14 52,53,54,55 +Ethernet15 56,57,58,59 +Ethernet16 60,61,62,63 +Ethernet17 64,65,66,67 +Ethernet18 68,69,70,71 +Ethernet19 72,73,74,75 +Ethernet20 76,77,78,79 +Ethernet21 80,81,82,83 +Ethernet22 84,85,86,87 +Ethernet23 88,89,90,91 +Ethernet24 92,93,94,95 +Ethernet25 96,97,98,99 +Ethernet26 100,101,102,103 +Ethernet27 104,105,106,107 +Ethernet28 108,109,110,111 +Ethernet29 112,113,114,115 +Ethernet30 116,117,118,119 +Ethernet31 120,121,122,123 +Ethernet32 124,125,126,127 \ No newline at end of file diff --git a/dockers/docker-saiserver-mlnx/profile.ini b/dockers/docker-saiserver-mlnx/profile.ini new file mode 100644 index 000000000000..c67be49f3c45 --- /dev/null +++ b/dockers/docker-saiserver-mlnx/profile.ini @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sai_2700.xml \ No newline at end of file diff --git a/dockers/docker-saiserver-mlnx/sai_2700.xml b/dockers/docker-saiserver-mlnx/sai_2700.xml new file mode 100644 index 000000000000..42b576311453 --- /dev/null +++ b/dockers/docker-saiserver-mlnx/sai_2700.xml @@ -0,0 +1,243 @@ + + + + + + 00:77:66:55:44:00 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 98368 + + + 3 + 4 + 17 + 1 + 98368 + + + 5 + 4 + 18 + 3 + 98368 + + + 7 + 4 + 19 + 1 + 98368 + + + 9 + 4 + 20 + 3 + 98368 + + + 11 + 4 + 21 + 1 + 98368 + + + 13 + 4 + 22 + 3 + 98368 + + + 15 + 4 + 23 + 1 + 98368 + + + 17 + 4 + 24 + 3 + 98368 + + + 19 + 4 + 25 + 1 + 98368 + + + 21 + 4 + 26 + 3 + 98368 + + + 23 + 4 + 27 + 1 + 98368 + + + 25 + 4 + 28 + 3 + 98368 + + + 27 + 4 + 29 + 1 + 98368 + + + 29 + 4 + 30 + 3 + 98368 + + + 31 + 4 + 31 + 1 + 98368 + + + 33 + 4 + 14 + 3 + 98368 + + + 35 + 4 + 15 + 1 + 98368 + + + 37 + 4 + 12 + 3 + 98368 + + + 39 + 4 + 13 + 1 + 98368 + + + 41 + 4 + 10 + 3 + 98368 + + + 43 + 4 + 11 + 1 + 98368 + + + 45 + 4 + 8 + 3 + 98368 + + + 47 + 4 + 9 + 1 + 98368 + + + 49 + 4 + 6 + 3 + 98368 + + + 51 + 4 + 7 + 1 + 98368 + + + 53 + 4 + 4 + 3 + 98368 + + + 55 + 4 + 5 + 1 + 98368 + + + 57 + 4 + 2 + 3 + 98368 + + + 59 + 4 + 3 + 1 + 98368 + + + 61 + 4 + 0 + 3 + 98368 + + + 63 + 4 + 1 + 1 + 98368 + + + + diff --git a/dockers/docker-saiserver-mlnx/start.sh b/dockers/docker-saiserver-mlnx/start.sh new file mode 100755 index 000000000000..4e1aa752d3a5 --- /dev/null +++ b/dockers/docker-saiserver-mlnx/start.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +function clean_up { + service rsyslog stop +} + +start_mlnx() +{ + [ -e /dev/sxdevs/sxcdev ] || ( mkdir -p /dev/sxdevs && mknod /dev/sxdevs/sxcdev c 231 193 ) +} + +trap clean_up SIGTERM SIGKILL + +service rsyslog start + +start_mlnx + +/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini From 9c3b7ccaf762683b26222a861db026a394c546cf Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Mon, 26 Sep 2016 07:48:25 +0300 Subject: [PATCH 0026/1833] Add support for cavium SAI (#5) --- Makefile | 32 +++++++++++++++++++++++++++- build_debian.sh | 1 + dockers/docker-orchagent-cavm | 1 + dockers/docker-orchagent/start.sh | 8 +++++++ dockers/docker-syncd-cavm/Dockerfile | 26 ++++++++++++++++++++++ dockers/docker-syncd-cavm/start.sh | 6 ++++++ src/Makefile | 14 ++++++++++++ src/cavm-sdk/filelist.txt | 7 ++++++ src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 11 files changed, 97 insertions(+), 4 deletions(-) create mode 120000 dockers/docker-orchagent-cavm create mode 100755 dockers/docker-syncd-cavm/Dockerfile create mode 100755 dockers/docker-syncd-cavm/start.sh create mode 100644 src/cavm-sdk/filelist.txt diff --git a/Makefile b/Makefile index 4fec69a41699..80378a51ecbb 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ SHELL := /bin/bash ## Capture all the files in SDK directories MLNX-SDK-DEBS=$(notdir $(wildcard src/mlnx-sdk/*.deb)) BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb)) +CAVM-SDK-DEBS=$(notdir $(wildcard src/cavm-sdk/*.deb)) ## Function: build_docker, image_name save_file ## build a docker image and save to a file @@ -20,7 +21,7 @@ define build_docker endef ## Rules -.phony : brcm-all mlnx-all +.phony : brcm-all mlnx-all cavm-all src/%: $(MAKE) -C src $(subst src/,,$@) @@ -42,30 +43,48 @@ dockers/docker-orchagent/deps/%.deb: src/%.deb dockers/docker-orchagent/deps/%: src/brcm/% mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-orchagent-cavm/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-orchagent-cavm/deps/%: src/cavm/% + mkdir -p `dirname $@` && cp $< $@ dockers/docker-%-mlnx/deps/syncd_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb mkdir -p `dirname $@` && cp $< $@ dockers/docker-%/deps/syncd_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-%-cavm/deps/syncd_1.0.0_amd64.deb: src/cavm/syncd_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $@ dockers/docker-%-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb mkdir -p `dirname $@` && cp $< $@ dockers/docker-%/deps/libsairedis_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-%-cavm/deps/libsairedis_1.0.0_amd64.deb: src/cavm/libsairedis_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $@ $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb mkdir -p `dirname $@` && cp $< $@ $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb mkdir -p `dirname $@` && cp $< $@ + +$(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb + mkdir -p `dirname $@` && cp $< $@ dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $@ dockers/docker-syncd/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $@ + +dockers/docker-syncd-cavm/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $@ deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb mkdir -p `dirname $@` && cp $< $@ @@ -85,6 +104,10 @@ target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/d target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/docker-syncd-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb) docker load < $< @@ -93,6 +116,10 @@ target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orc target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb orchagent swssconfig portsyncd intfsyncd neighsyncd) + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb fpmsyncd) docker load < $< @@ -113,3 +140,6 @@ brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-or ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-database.gz) + +## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd +cavm-all: $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-database.gz) diff --git a/build_debian.sh b/build_debian.sh index b1cf2e67d8d8..95d80f5a03d5 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -69,6 +69,7 @@ sudo debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://f ## Config hostname and hosts, otherwise 'sudo ...' will complain 'sudo: unable to resolve host ...' sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '$HOSTNAME' > /etc/hostname" sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '127.0.0.1 $HOSTNAME' >> /etc/hosts" +sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '127.0.0.1 localhost' >> /etc/hosts" ## Config basic fstab sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'echo "proc /proc proc defaults 0 0" >> /etc/fstab' diff --git a/dockers/docker-orchagent-cavm b/dockers/docker-orchagent-cavm new file mode 120000 index 000000000000..8d52609c56e5 --- /dev/null +++ b/dockers/docker-orchagent-cavm @@ -0,0 +1 @@ +docker-orchagent \ No newline at end of file diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 1fdee5117f89..46376c4ea55d 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -32,9 +32,17 @@ if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then PORTSYNCD_ARGS+="-p /etc/ssw/ACS-S6000/port_config.ini" elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini" +elif [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" + PORTSYNCD_ARGS+="-p /etc/ssw/AS7512/port_config.ini" fi service rsyslog start + +if [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then + swssconfig /etc/ssw/AS7512/copp.json +fi + while true; do # Check if syncd starts result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p` diff --git a/dockers/docker-syncd-cavm/Dockerfile b/dockers/docker-syncd-cavm/Dockerfile new file mode 100755 index 000000000000..bbb5195901b7 --- /dev/null +++ b/dockers/docker-syncd-cavm/Dockerfile @@ -0,0 +1,26 @@ +FROM docker-base + +RUN apt-get update + +COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/syncd_*.deb", "deps/sai*.deb", "deps/libsai*.deb", "deps/xp-tools*.deb", "deps/xpshell*.deb", "/deps/"] + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/libhiredis0.13*.deb \ + && dpkg_apt /deps/libswsscommon_*.deb \ + && dpkg_apt /deps/sai*.deb \ + && dpkg_apt /deps/libsai*.deb \ + && dpkg_apt /deps/xp-tools*.deb \ + && dpkg_apt /deps/xpshell*.deb \ + && dpkg_apt /deps/libsairedis_*.deb \ + && dpkg_apt /deps/syncd_*.deb + +RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev + +COPY ["start.sh", "/usr/bin/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT /usr/bin/start.sh \ + && /bin/bash diff --git a/dockers/docker-syncd-cavm/start.sh b/dockers/docker-syncd-cavm/start.sh new file mode 100755 index 000000000000..04c5a3a1835f --- /dev/null +++ b/dockers/docker-syncd-cavm/start.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +export XP_ROOT=/usr/bin/ + +service rsyslog start +syncd -p /etc/ssw/AS7512/profile.ini -N diff --git a/src/Makefile b/src/Makefile index 09e1152dec48..d310f069d438 100644 --- a/src/Makefile +++ b/src/Makefile @@ -43,6 +43,12 @@ mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev $(call build_project, sonic-sairedis) mkdir -p mlnx cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb mlnx/ + +cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb cavm-sdk/libsai.deb cavm-sdk/xp-tools.deb cavm-sdk/xpshell.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + $(call build_project, sonic-sairedis) + mkdir -p cavm + cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb cavm/ ## Note: fpmsyncd is one implicit target brcm/swss_1.0.0_amd64.deb brcm/intfsyncd brcm/neighsyncd brcm/orchagent brcm/portsyncd brcm/routeresync brcm/swssconfig: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb @@ -59,6 +65,14 @@ mlnx/swss_1.0.0_amd64.deb mlnx/intfsyncd mlnx/neighsyncd mlnx/orchagent mlnx/por cp swss_1.0.0_amd64.deb mlnx/ cp sonic-swss/debian/swss/usr/bin/* mlnx/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . + +## Note: fpmsyncd is one implicit target +cavm/swss_1.0.0_amd64.deb cavm/intfsyncd cavm/neighsyncd cavm/orchagent cavm/portsyncd cavm/routeresync cavm/swssconfig: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + $(call build_project, sonic-swss) + cp swss_1.0.0_amd64.deb cavm/ + cp sonic-swss/debian/swss/usr/bin/* cavm/ + cp sonic-swss/debian/swss/usr/bin/fpmsyncd . $(addprefix sonic-linux-kernel/,linux-headers-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb linux-headers-3.16.0-4-common_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64-dbg_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb xen-linux-system-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb): pushd sonic-linux-kernel; sudo ./build.sh; popd diff --git a/src/cavm-sdk/filelist.txt b/src/cavm-sdk/filelist.txt new file mode 100644 index 000000000000..bc40295dfbdc --- /dev/null +++ b/src/cavm-sdk/filelist.txt @@ -0,0 +1,7 @@ +## Get vendor SAI SDK +## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk + +libsai.deb +sai.deb +xp-tools.deb +xpshell.deb diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 68b0a9b914c3..74fa427ab6a7 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 68b0a9b914c3a3816c809d7951de70136d09dc27 +Subproject commit 74fa427ab6a70f293c0d487904bc06db3339fa84 diff --git a/src/sonic-swss b/src/sonic-swss index b56c9cc507cd..60b0fb279551 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit b56c9cc507cdfc473d6d0d1159f134dfd83a96df +Subproject commit 60b0fb279551ad3447b802ec602e28902245b4f2 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 38b461a168a6..efd594d51da6 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 38b461a168a6154aad978d3a97f08c2c933e943a +Subproject commit efd594d51da6d2dcc8a494bf43d3aadf3bdd71d2 From d3b3f63537d123401d16924f252787cbfce9b27b Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 25 Sep 2016 22:59:41 -0700 Subject: [PATCH 0027/1833] Sync submodules (linux-kernel, sairedis, swss, and swss-common to latest master) (#13) --- src/sonic-linux-kernel | 2 +- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 9794d29a08a4..206a8936a7af 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 9794d29a08a4f81fbcd900e03072561f42b81074 +Subproject commit 206a8936a7af2fdc30101c64be42dd2dadde0dad diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 74fa427ab6a7..59ec36035eb9 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 74fa427ab6a70f293c0d487904bc06db3339fa84 +Subproject commit 59ec36035eb9fd0ff64d4977a2553380367f97ce diff --git a/src/sonic-swss b/src/sonic-swss index 60b0fb279551..6784f7bf236a 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 60b0fb279551ad3447b802ec602e28902245b4f2 +Subproject commit 6784f7bf236ab0e90676d3ec9d0a771f232995ca diff --git a/src/sonic-swss-common b/src/sonic-swss-common index efd594d51da6..e612cefd8890 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit efd594d51da6d2dcc8a494bf43d3aadf3bdd71d2 +Subproject commit e612cefd889067f1cfa8c9a68a40a1abdac59433 From f09a554f9afbe93b01b21cee2dbfcb53e5e072a8 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 27 Sep 2016 11:42:35 -0700 Subject: [PATCH 0028/1833] Fix rules in Makefiles (#15) --- Makefile | 110 ++++++++++++++++++++------------------------ src/Makefile | 6 +-- src/libnl3/build.sh | 1 + 3 files changed, 55 insertions(+), 62 deletions(-) diff --git a/Makefile b/Makefile index 80378a51ecbb..6dab5d440311 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ MLNX-SDK-DEBS=$(notdir $(wildcard src/mlnx-sdk/*.deb)) BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb)) CAVM-SDK-DEBS=$(notdir $(wildcard src/cavm-sdk/*.deb)) +LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb + ## Function: build_docker, image_name save_file ## build a docker image and save to a file define build_docker @@ -20,88 +22,72 @@ define build_docker docker save $(1) | gzip -c > $(2) endef -## Rules +## Rules: phony targets .phony : brcm-all mlnx-all cavm-all +## Rules: redirect to sub directory src/%: $(MAKE) -C src $(subst src/,,$@) +## Rules: docker-fpm dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd - mkdir -p `dirname $@` && cp $< $@ - + mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-fpm/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $@ + mkdir -p `dirname $@` && cp $< $(dir $@) +## Rules: docker-orchagent-mlnx +dockers/docker-orchagent-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/libsairedis_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent-mlnx/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $@ - -dockers/docker-orchagent-mlnx/deps/%: src/mlnx/% - mkdir -p `dirname $@` && cp $< $@ - -dockers/docker-orchagent/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $@ + mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-orchagent/deps/%: src/brcm/% - mkdir -p `dirname $@` && cp $< $@ - +## Rules: docker-orchagent-cavm +dockers/docker-orchagent-cavm/deps/libsairedis_1.0.0_amd64.deb: src/cavm/libsairedis_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent-cavm/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $@ + mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-orchagent-cavm/deps/%: src/cavm/% - mkdir -p `dirname $@` && cp $< $@ - -dockers/docker-%-mlnx/deps/syncd_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb - mkdir -p `dirname $@` && cp $< $@ - -dockers/docker-%/deps/syncd_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb - mkdir -p `dirname $@` && cp $< $@ - -dockers/docker-%-cavm/deps/syncd_1.0.0_amd64.deb: src/cavm/syncd_1.0.0_amd64.deb - mkdir -p `dirname $@` && cp $< $@ - -dockers/docker-%-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb - mkdir -p `dirname $@` && cp $< $@ - -dockers/docker-%/deps/libsairedis_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb - mkdir -p `dirname $@` && cp $< $@ - -dockers/docker-%-cavm/deps/libsairedis_1.0.0_amd64.deb: src/cavm/libsairedis_1.0.0_amd64.deb - mkdir -p `dirname $@` && cp $< $@ +## Rules: docker-orchagent (brcm) +dockers/docker-orchagent/deps/libsairedis_1.0.0_amd64.deb: src/brcm/libsairedis_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $(dir $@) +dockers/docker-orchagent/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) +## Rules: docker-syncd-mlnx $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb - mkdir -p `dirname $@` && cp $< $@ - -$(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb - mkdir -p `dirname $@` && cp $< $@ - -$(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb - mkdir -p `dirname $@` && cp $< $@ - + mkdir -p `dirname $@` && cp $< $(dir $@) +$(addprefix dockers/docker-syncd-mlnx/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $@ + mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-syncd/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $@ - +## Rules: docker-syncd-cavm +$(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) +$(addprefix dockers/docker-syncd-cavm/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-syncd-cavm/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $@ - -deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb - mkdir -p `dirname $@` && cp $< $@ + mkdir -p `dirname $@` && cp $< $(dir $@) -deps/initramfs-tools_%.deb: src/initramfs-tools/initramfs-tools_%.deb - mkdir -p `dirname $@` && cp $< $@ +## Rules: docker-syncd (brcm) +$(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) +$(addprefix dockers/docker-syncd/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb): dockers/docker-syncd/deps/%.deb : src/brcm/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) +dockers/docker-syncd/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) +## Rules: docker images target/docker-base.gz: $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb) +target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb $(LIBNL-DEBS)) ## TODO: remove placeholders for the dependencies touch dockers/docker-syncd/deps/{dsserve,bcmcmd} docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) +target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb $(LIBNL-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) @@ -109,15 +95,15 @@ target/docker-syncd-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-sy docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb) +target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb) +target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb orchagent swssconfig portsyncd intfsyncd neighsyncd) +target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) @@ -129,9 +115,15 @@ target/docker-database.gz: target/docker-base.gz docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) +## Rules: linux image content +deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) +deps/initramfs-tools_%.deb: src/initramfs-tools/initramfs-tools_%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) + +## Rules: linux image target/sonic-generic.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=generic ./build_image.sh - target/sonic-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh diff --git a/src/Makefile b/src/Makefile index d310f069d438..da9670a95f22 100644 --- a/src/Makefile +++ b/src/Makefile @@ -19,6 +19,9 @@ install_deb = \ [ -f $(1) ] && { sudo dpkg -i $(1) || sudo apt-get -y install -f; } || return 1; ## Rules +libnl-%.deb: + pushd libnl3; ./build.sh; popd + quagga_0.99.24.1-2_amd64.deb: pushd quagga; ./build.sh; popd @@ -55,7 +58,6 @@ brcm/swss_1.0.0_amd64.deb brcm/intfsyncd brcm/neighsyncd brcm/orchagent brcm/por $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb brcm/ - cp sonic-swss/debian/swss/usr/bin/* brcm/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . ## Note: fpmsyncd is one implicit target @@ -63,7 +65,6 @@ mlnx/swss_1.0.0_amd64.deb mlnx/intfsyncd mlnx/neighsyncd mlnx/orchagent mlnx/por $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb mlnx/ - cp sonic-swss/debian/swss/usr/bin/* mlnx/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . ## Note: fpmsyncd is one implicit target @@ -71,7 +72,6 @@ cavm/swss_1.0.0_amd64.deb cavm/intfsyncd cavm/neighsyncd cavm/orchagent cavm/por $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb cavm/ - cp sonic-swss/debian/swss/usr/bin/* cavm/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . $(addprefix sonic-linux-kernel/,linux-headers-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb linux-headers-3.16.0-4-common_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64-dbg_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb xen-linux-system-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb): diff --git a/src/libnl3/build.sh b/src/libnl3/build.sh index a23b8f7e3dc2..47eb0048f45d 100755 --- a/src/libnl3/build.sh +++ b/src/libnl3/build.sh @@ -20,3 +20,4 @@ quilt push dpkg-buildpackage -rfakeroot -b -us -uc popd +cp *.deb .. From 10e403d7c4ccb6ba53c315498d877c15f7445c24 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 27 Sep 2016 17:25:48 -0700 Subject: [PATCH 0029/1833] Add platform dependency swss (#16) --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 6dab5d440311..f26ab0c29b98 100644 --- a/Makefile +++ b/Makefile @@ -38,18 +38,24 @@ dockers/docker-fpm/deps/%.deb: src/%.deb ## Rules: docker-orchagent-mlnx dockers/docker-orchagent-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/libsairedis_1.0.0_amd64.deb mkdir -p `dirname $@` && cp $< $(dir $@) +dockers/docker-orchagent-mlnx/deps/swss_1.0.0_amd64.deb: src/mlnx/swss_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent-mlnx/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) ## Rules: docker-orchagent-cavm dockers/docker-orchagent-cavm/deps/libsairedis_1.0.0_amd64.deb: src/cavm/libsairedis_1.0.0_amd64.deb mkdir -p `dirname $@` && cp $< $(dir $@) +dockers/docker-orchagent-cavm/deps/swss_1.0.0_amd64.deb: src/cavm/swss_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent-cavm/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) ## Rules: docker-orchagent (brcm) dockers/docker-orchagent/deps/libsairedis_1.0.0_amd64.deb: src/brcm/libsairedis_1.0.0_amd64.deb mkdir -p `dirname $@` && cp $< $(dir $@) +dockers/docker-orchagent/deps/swss_1.0.0_amd64.deb: src/brcm/swss_1.0.0_amd64.deb + mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) From 7c0ff3e9e3db34457d62b9464522df1044209f3a Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 28 Sep 2016 11:15:02 -0700 Subject: [PATCH 0030/1833] build p4-based sonic docker (#14) * add docker-sonic for p4 switch * update build instructions --- .gitmodules | 12 +++++ Makefile | 17 +++++-- README.md | 10 +++- dockers/docker-sonic-p4/Dockerfile | 32 ++++++++++++ dockers/docker-sonic-p4/port_config.ini | 5 ++ dockers/docker-sonic-p4/rsyslog.conf | 68 +++++++++++++++++++++++++ dockers/docker-sonic-p4/startup.sh | 39 ++++++++++++++ src/Makefile | 31 +++++++++++ src/p4-bmv2/behavioral-model | 1 + src/p4-bmv2/build.sh | 5 ++ src/p4-hlir/build.sh | 7 +++ src/p4-hlir/p4-hlir | 1 + src/p4-switch/build.sh | 17 +++++++ src/p4-switch/switch | 1 + src/p4c-bm/build.sh | 7 +++ src/p4c-bm/p4c-bm | 1 + src/tenjin/build.sh | 8 +++ src/thrift/build.sh | 10 ++++ 18 files changed, 268 insertions(+), 4 deletions(-) create mode 100644 dockers/docker-sonic-p4/Dockerfile create mode 100644 dockers/docker-sonic-p4/port_config.ini create mode 100644 dockers/docker-sonic-p4/rsyslog.conf create mode 100755 dockers/docker-sonic-p4/startup.sh create mode 160000 src/p4-bmv2/behavioral-model create mode 100755 src/p4-bmv2/build.sh create mode 100755 src/p4-hlir/build.sh create mode 160000 src/p4-hlir/p4-hlir create mode 100755 src/p4-switch/build.sh create mode 160000 src/p4-switch/switch create mode 100755 src/p4c-bm/build.sh create mode 160000 src/p4c-bm/p4c-bm create mode 100755 src/tenjin/build.sh create mode 100755 src/thrift/build.sh diff --git a/.gitmodules b/.gitmodules index 88123322f032..a6a4a1a9f611 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,15 @@ [submodule "sonic-swss"] path = src/sonic-swss url = https://github.com/Azure/sonic-swss +[submodule "src/p4-switch/switch"] + path = src/p4-switch/switch + url = https://github.com/lguohan/switch +[submodule "src/p4-bmv2/behavioral-model"] + path = src/p4-bmv2/behavioral-model + url = https://github.com/lguohan/behavioral-model +[submodule "src/p4c-bm/p4c-bm"] + path = src/p4c-bm/p4c-bm + url = https://github.com/krambn/p4c-bm +[submodule "src/p4-hlir/p4-hlir"] + path = src/p4-hlir/p4-hlir + url = https://github.com/p4lang/p4-hlir diff --git a/Makefile b/Makefile index f26ab0c29b98..d71ed93fb449 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ define build_docker endef ## Rules: phony targets -.phony : brcm-all mlnx-all cavm-all +.phony : brcm-all mlnx-all cavm-all p4-all ## Rules: redirect to sub directory src/%: @@ -66,7 +66,7 @@ $(addprefix dockers/docker-syncd-mlnx/deps/,syncd_1.0.0_amd64.deb libsairedis_1. mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) - + ## Rules: docker-syncd-cavm $(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) @@ -83,6 +83,12 @@ $(addprefix dockers/docker-syncd/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_a dockers/docker-syncd/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) +## Rules: docker-sonic (p4) +$(addprefix dockers/docker-sonic-p4/deps/,swss_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) : dockers/docker-sonic-p4/deps/%.deb : src/p4/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) +dockers/docker-sonic-p4/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) + ## Rules: docker images target/docker-base.gz: $(call build_docker,$(patsubst target/%.gz,%,$@),$@) @@ -121,13 +127,16 @@ target/docker-database.gz: target/docker-base.gz docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) +target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb) + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + ## Rules: linux image content deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb mkdir -p `dirname $@` && cp $< $(dir $@) deps/initramfs-tools_%.deb: src/initramfs-tools/initramfs-tools_%.deb mkdir -p `dirname $@` && cp $< $(dir $@) -## Rules: linux image target/sonic-generic.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=generic ./build_image.sh target/sonic-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb @@ -141,3 +150,5 @@ mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz dock ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd cavm-all: $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-database.gz) + +p4-all: $(addprefix target/,docker-sonic-p4.gz) diff --git a/README.md b/README.md index e6b4764d8972..dd894887f0d9 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,13 @@ If it is already cloned, however there is no files under ./dockers/docker-base/ ## 2. Build environment Build a docker image by [the Dockerfile](https://github.com/Azure/sonic-build-tools/blob/master/sonic-slave/Dockerfile) and build all remains in the docker container. + git clone https://github.com/Azure/sonic-build-tools + cd sonic-build-tools + ./build.sh sonic-slave + docker run -v /var/run/docker.sock:/var/run/docker.sock -it local/sonic-slave bash + ## 3. Get vendor SAI SDK -Obtain Switch Abstraction Interface (SAI) SDK from one of supported vendors (see the list in [Usage](#usage) Section), and place it in the directory ./src/[VENDOR]-sdk/ as filelist.txt in that directory. +Obtain Switch Abstraction Interface (SAI) SDK from one of supported vendors (see the list in [Usage](#usage) Section), and place it in the directory ./src/[VENDOR]-sdk/ as filelist.txt in that directory. Skip this step for p4 since it is an open source software switch. # Usage To build NOS installer image and docker images, run command line @@ -27,6 +32,8 @@ To build NOS installer image and docker images, run command line Supported VENDORs are: - brcm: Broadcom - mlnx: Mellanox +- cavm: Cavium +- p4: barefoot For example, the user name is 'admin' and the password is 'YourPaSsWoRd'. To build all the images for Broadcom platform, use the command: @@ -43,6 +50,7 @@ The target directory is ./target, containing the NOS installer image and docker - docker-orchagent.gz: docker image for SWitch State Service (SWSS) (gzip tar archive) - docker-syncd.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive) - docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) +- docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive) # Contribution guide diff --git a/dockers/docker-sonic-p4/Dockerfile b/dockers/docker-sonic-p4/Dockerfile new file mode 100644 index 000000000000..d5470bbd8837 --- /dev/null +++ b/dockers/docker-sonic-p4/Dockerfile @@ -0,0 +1,32 @@ +FROM docker-base + +RUN apt-get update + +RUN apt-get install -y net-tools ethtool tcpdump ifupdown + +COPY ["deps/libthrift-0.9.3_*.deb", "deps/libhiredis0.13*.deb", "deps/redis-tools_*.deb", "deps/redis-server_*.deb", "deps/libswsscommon_*.deb", "deps/p4-bmv2_*.deb", "deps/p4-switch_*.deb", "deps/libsairedis_*.deb", "deps/syncd_*.deb", "deps/swss_*.deb", "deps/quagga_*.deb", "/deps/"] + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libthrift-0.9.3_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/redis-tools_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/redis-server_*.deb + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/p4-bmv2_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/p4-switch_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/swss_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb + +ADD port_config.ini /port_config.ini +ADD startup.sh /scripts/startup.sh + +ADD rsyslog.conf /etc/rsyslog.conf + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT /bin/bash diff --git a/dockers/docker-sonic-p4/port_config.ini b/dockers/docker-sonic-p4/port_config.ini new file mode 100644 index 000000000000..574f8f976ef9 --- /dev/null +++ b/dockers/docker-sonic-p4/port_config.ini @@ -0,0 +1,5 @@ +# alias lanes +Ethernet0 1 +Ethernet1 2 +Ethernet2 3 +Ethernet3 4 diff --git a/dockers/docker-sonic-p4/rsyslog.conf b/dockers/docker-sonic-p4/rsyslog.conf new file mode 100644 index 000000000000..d82ea610d6a7 --- /dev/null +++ b/dockers/docker-sonic-p4/rsyslog.conf @@ -0,0 +1,68 @@ +############################################################################### +# Managed by Ansible +# file: ansible/roles/acs/templates/rsyslog.conf.j2 +############################################################################### +# +# /etc/rsyslog.conf Configuration file for rsyslog. +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html + + +################# +#### MODULES #### +################# + +$ModLoad imuxsock # provides support for local system logging +#$ModLoad imklog # provides kernel logging support +#$ModLoad immark # provides --MARK-- message capability + +# provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 + +# provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +########################### +#### GLOBAL DIRECTIVES #### +########################### +#Set remote syslog server +*.* @172.17.0.1:514 + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# Define a custom template +$template ACSFileFormat,"%TIMESTAMP% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" +$ActionFileDefaultTemplate ACSFileFormat + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# +# Where to place spool and state files +# +$WorkDirectory /var/spool/rsyslog + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + + +############### +#### RULES #### +############### + diff --git a/dockers/docker-sonic-p4/startup.sh b/dockers/docker-sonic-p4/startup.sh new file mode 100755 index 000000000000..319ac8e57850 --- /dev/null +++ b/dockers/docker-sonic-p4/startup.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +echo "Start rsyslog" +service rsyslog start + +echo "Start redis server" +service redis-server start + +echo "Veth setup" +/usr/share/bmpd/tools/veth_setup.sh > /tmp/veth_setup.log 2>&1 + +echo "Disable IPv6" +/usr/share/bmpd/tools/veth_disable_ipv6.sh > /tmp/veth_disable.log 2>&1 + +echo "Start BMV2" +/run_bm.sh > /tmp/run_bm.log 2>&1 & +sleep 15 + +redis-cli -n 1 set LOGLEVEL DEBUG + +echo "Start Syncd" +syncd -N > /tmp/syncd.log 2>&1 & +sleep 10 + +echo "Start Orchagent" +orchagent $* > /tmp/orchagent.log 2>&1 & +sleep 10 + +echo "Start Portsyncd" +portsyncd -p /port_config.ini > /tmp/portsyncd.log 2>&1 & + +echo "Start Intfsync" +intfsyncd > /tmp/intfsyncd.log 2>&1 & + +echo "Start Neighsyncd" +neighsyncd > /tmp/neighsyncd.log 2>&1 & + +echo "Start Fpmsyncd" +fpmsyncd > /tmp/fpmsyncd.log 2>&1 & diff --git a/src/Makefile b/src/Makefile index da9670a95f22..dc0d05decf59 100644 --- a/src/Makefile +++ b/src/Makefile @@ -31,6 +31,26 @@ redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0. libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0.7-2_amd64.deb pushd hiredis; ./build.sh; popd +libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb thrift-compiler_0.9.3-2_amd64.deb: + pushd thrift; ./build.sh; popd + +p4-bmv2_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + pushd p4-bmv2; ./build.sh; popd + +python-p4-hlir_0.9.36-1_all.deb: + pushd p4-hlir; ./build.sh; popd + +python-p4c-bm_1.0.0-5415c416-1_all.deb: + pushd p4c-bm; ./build.sh; popd + +python-tenjin_1.1.1-1_all.deb: + pushd tenjin; ./build.sh; popd + +p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-p4-hlir_0.9.36-1_all.deb python-p4c-bm_1.0.0-5415c416-1_all.deb p4-bmv2_1.0.0_amd64.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + pushd p4-switch; ./build.sh; popd + libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss-common) @@ -53,6 +73,12 @@ cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev mkdir -p cavm cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb cavm/ +p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb p4-bmv2_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + $(call build_project, sonic-sairedis) + mkdir -p p4 + cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb p4/ + ## Note: fpmsyncd is one implicit target brcm/swss_1.0.0_amd64.deb brcm/intfsyncd brcm/neighsyncd brcm/orchagent brcm/portsyncd brcm/routeresync brcm/swssconfig: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) @@ -74,6 +100,11 @@ cavm/swss_1.0.0_amd64.deb cavm/intfsyncd cavm/neighsyncd cavm/orchagent cavm/por cp swss_1.0.0_amd64.deb cavm/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . +p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb + $(foreach dep, $^, $(call install_deb, $(dep))) + $(call build_project, sonic-swss) + cp swss_1.0.0_amd64.deb p4/ + $(addprefix sonic-linux-kernel/,linux-headers-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb linux-headers-3.16.0-4-common_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64-dbg_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb xen-linux-system-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb): pushd sonic-linux-kernel; sudo ./build.sh; popd diff --git a/src/p4-bmv2/behavioral-model b/src/p4-bmv2/behavioral-model new file mode 160000 index 000000000000..0eb0d51736ee --- /dev/null +++ b/src/p4-bmv2/behavioral-model @@ -0,0 +1 @@ +Subproject commit 0eb0d51736eeadd75384edfa8589e43a9ba734f4 diff --git a/src/p4-bmv2/build.sh b/src/p4-bmv2/build.sh new file mode 100755 index 000000000000..779da0b3caf6 --- /dev/null +++ b/src/p4-bmv2/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash -x + +pushd behavioral-model; ./autogen.sh; dpkg-buildpackage -us -uc -b -j4; popd + +cp *.deb ../ diff --git a/src/p4-hlir/build.sh b/src/p4-hlir/build.sh new file mode 100755 index 000000000000..68c7807ad648 --- /dev/null +++ b/src/p4-hlir/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash -x + +pushd p4-hlir +python setup.py --command-packages=stdeb.command bdist_deb +popd + +cp p4-hlir/deb_dist/*.deb ../ diff --git a/src/p4-hlir/p4-hlir b/src/p4-hlir/p4-hlir new file mode 160000 index 000000000000..0ab8e58f8a92 --- /dev/null +++ b/src/p4-hlir/p4-hlir @@ -0,0 +1 @@ +Subproject commit 0ab8e58f8a92ee469235028430795088af9cda77 diff --git a/src/p4-switch/build.sh b/src/p4-switch/build.sh new file mode 100755 index 000000000000..eb0f0bcc7676 --- /dev/null +++ b/src/p4-switch/build.sh @@ -0,0 +1,17 @@ +#!/bin/bash -x + +sudo pip install ctypesgen + +sudo pip install crc16 + +pushd switch + +mkdir -p p4-build/bmv2/switch +mkdir -p p4-build/bmv2/pd_thrift_gen + +./autogen.sh +dpkg-buildpackage -us -uc -b -j4 + +popd + +cp *.deb ../ diff --git a/src/p4-switch/switch b/src/p4-switch/switch new file mode 160000 index 000000000000..8c80a17cb884 --- /dev/null +++ b/src/p4-switch/switch @@ -0,0 +1 @@ +Subproject commit 8c80a17cb884db6d8eaebbc52cb8b6a99a0784bc diff --git a/src/p4c-bm/build.sh b/src/p4c-bm/build.sh new file mode 100755 index 000000000000..83fa649005eb --- /dev/null +++ b/src/p4c-bm/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash -x + +pushd p4c-bm +python setup.py --command-packages=stdeb.command bdist_deb +popd + +cp p4c-bm/deb_dist/*.deb ../ diff --git a/src/p4c-bm/p4c-bm b/src/p4c-bm/p4c-bm new file mode 160000 index 000000000000..5415c4160aff --- /dev/null +++ b/src/p4c-bm/p4c-bm @@ -0,0 +1 @@ +Subproject commit 5415c4160aff025f27fe45301c62aa9aeb4bab40 diff --git a/src/tenjin/build.sh b/src/tenjin/build.sh new file mode 100755 index 000000000000..37b8f9051d5b --- /dev/null +++ b/src/tenjin/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash -x + +wget -nc http://pypi.python.org/packages/source/T/Tenjin/Tenjin-1.1.1.tar.gz +tar xzf Tenjin-1.1.1.tar.gz +pushd Tenjin-1.1.1 +python setup.py --command-packages=stdeb.command bdist_deb +popd +cp Tenjin-1.1.1/deb_dist/*.deb ../ diff --git a/src/thrift/build.sh b/src/thrift/build.sh new file mode 100755 index 000000000000..12aa1479e9c2 --- /dev/null +++ b/src/thrift/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash -x + +wget -nc http://http.debian.net/debian/pool/main/t/thrift/thrift_0.9.3.orig.tar.gz +wget -nc http://http.debian.net/debian/pool/main/t/thrift/thrift_0.9.3-2.debian.tar.xz +wget -nc http://http.debian.net/debian/pool/main/t/thrift/thrift_0.9.3-2.dsc +dpkg-source -x thrift_0.9.3-2.dsc +cd thrift-0.9.3 +dpkg-buildpackage -d -rfakeroot -b -us -uc +cd .. +cp *.deb ../ From 9fe462fefc99884858bbdc1240b03d4a6d98c6fd Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 28 Sep 2016 17:23:22 -0700 Subject: [PATCH 0031/1833] Update README.md (#17) Adjust the steps to make it clear everything is built inside builder container. --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index dd894887f0d9..897c03c7b337 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,17 @@ Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS. # Prerequisite -## 1. Clone or fetch the code repository with all git submodules +## 1. Build environment +Build a docker image by [the Dockerfile](https://github.com/Azure/sonic-build-tools/blob/master/sonic-slave/Dockerfile) and build all remains in the docker container. + + git clone https://github.com/Azure/sonic-build-tools + cd sonic-build-tools + ./build.sh sonic-slave + docker run -v /var/run/docker.sock:/var/run/docker.sock -it local/sonic-slave bash + +Note that all the below steps should be executed in the docker container, not in the host machine. + +## 2. Clone or fetch the code repository with all git submodules To clone the code repository recursively, assuming git version 1.9 or newer git clone --recursive https://github.com/Azure/sonic-buildimage.git @@ -13,14 +23,6 @@ If it is already cloned, however there is no files under ./dockers/docker-base/ git submodule update --init --recursive -## 2. Build environment -Build a docker image by [the Dockerfile](https://github.com/Azure/sonic-build-tools/blob/master/sonic-slave/Dockerfile) and build all remains in the docker container. - - git clone https://github.com/Azure/sonic-build-tools - cd sonic-build-tools - ./build.sh sonic-slave - docker run -v /var/run/docker.sock:/var/run/docker.sock -it local/sonic-slave bash - ## 3. Get vendor SAI SDK Obtain Switch Abstraction Interface (SAI) SDK from one of supported vendors (see the list in [Usage](#usage) Section), and place it in the directory ./src/[VENDOR]-sdk/ as filelist.txt in that directory. Skip this step for p4 since it is an open source software switch. From 8bf3ae9ae9a84479cec279619872960f465fe4de Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 29 Sep 2016 21:16:37 -0700 Subject: [PATCH 0032/1833] Chang port_config.ini directory for s6000 (#19) --- dockers/docker-orchagent/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 46376c4ea55d..384b9dbc74a8 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -29,7 +29,7 @@ PORTSYNCD_ARGS="" if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - PORTSYNCD_ARGS+="-p /etc/ssw/ACS-S6000/port_config.ini" + PORTSYNCD_ARGS+="-p /etc/ssw/Force10-S6000/port_config.ini" elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini" elif [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then From 35880cf30f5d63e2d32300ebda1ab75dc6b08ce6 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 29 Sep 2016 23:36:26 -0700 Subject: [PATCH 0033/1833] Makefile: add build dependency for python-p4c-bm (#20) --- src/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index dc0d05decf59..29e911baa31f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -41,7 +41,8 @@ p4-bmv2_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2 python-p4-hlir_0.9.36-1_all.deb: pushd p4-hlir; ./build.sh; popd -python-p4c-bm_1.0.0-5415c416-1_all.deb: +python-p4c-bm_1.0.0-5415c416-1_all.deb: python-tenjin_1.1.1-1_all.deb + $(foreach dep, $^, $(call install_deb, $(dep))) pushd p4c-bm; ./build.sh; popd python-tenjin_1.1.1-1_all.deb: From 70fc7ecd2f6ff2175e898b0680ed08bb61534dbc Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 30 Sep 2016 23:32:53 -0700 Subject: [PATCH 0034/1833] update sonic-swss and p4-switch submodule to fix docker sonic p4 bug (#21) --- src/p4-switch/switch | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p4-switch/switch b/src/p4-switch/switch index 8c80a17cb884..d6346b9b3339 160000 --- a/src/p4-switch/switch +++ b/src/p4-switch/switch @@ -1 +1 @@ -Subproject commit 8c80a17cb884db6d8eaebbc52cb8b6a99a0784bc +Subproject commit d6346b9b3339a2a1243c1e7a1b00b71c66fa6cb5 diff --git a/src/sonic-swss b/src/sonic-swss index 6784f7bf236a..134a1d46b2eb 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 6784f7bf236ab0e90676d3ec9d0a771f232995ca +Subproject commit 134a1d46b2ebd0f5cd5338f368a86bb18bb63c17 From d667d13b9042784657e8303877ef81c4853ca3e8 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 2 Oct 2016 02:52:07 -0700 Subject: [PATCH 0035/1833] sonic-swss: update sonic-swss submodule reference (#23) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 134a1d46b2eb..bdbe77ce879d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 134a1d46b2ebd0f5cd5338f368a86bb18bb63c17 +Subproject commit bdbe77ce879de16334fcc53bd2a749e627f2c76c From 21ba8a009af629f316214b8adac37361f64e7bdc Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 2 Oct 2016 09:33:15 -0700 Subject: [PATCH 0036/1833] add python-tenjin as build dependency for p4-switch (#22) --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 29e911baa31f..b4f296967d1b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -48,7 +48,7 @@ python-p4c-bm_1.0.0-5415c416-1_all.deb: python-tenjin_1.1.1-1_all.deb python-tenjin_1.1.1-1_all.deb: pushd tenjin; ./build.sh; popd -p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-p4-hlir_0.9.36-1_all.deb python-p4c-bm_1.0.0-5415c416-1_all.deb p4-bmv2_1.0.0_amd64.deb +p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-p4-hlir_0.9.36-1_all.deb python-tenjin_1.1.1-1_all.deb python-p4c-bm_1.0.0-5415c416-1_all.deb p4-bmv2_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) pushd p4-switch; ./build.sh; popd From 144114c301dfce0a852bd79ebbd362989662663a Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Mon, 3 Oct 2016 05:25:58 +0300 Subject: [PATCH 0037/1833] Makefile : Added swss and libnl into cavm orchagent dependencies (#24) * Makefile : Added swss and libnl into cavm orchagent dependencies * docker-orchagent/start.sh : Removed Cavium specific copp config --- Makefile | 2 +- dockers/docker-orchagent/start.sh | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d71ed93fb449..660880ae718a 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docke docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) +target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 384b9dbc74a8..8531125018d7 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -39,10 +39,6 @@ fi service rsyslog start -if [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then - swssconfig /etc/ssw/AS7512/copp.json -fi - while true; do # Check if syncd starts result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p` From 457591a3657967a79a78cd130b3ec3ce3eec20c8 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 2 Oct 2016 23:42:11 -0700 Subject: [PATCH 0038/1833] p4: fix build dependency for python-p4c-bm (#25) --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index b4f296967d1b..38bcaf7cfaf1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -41,7 +41,7 @@ p4-bmv2_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2 python-p4-hlir_0.9.36-1_all.deb: pushd p4-hlir; ./build.sh; popd -python-p4c-bm_1.0.0-5415c416-1_all.deb: python-tenjin_1.1.1-1_all.deb +python-p4c-bm_1.0.0-5415c416-1_all.deb: python-tenjin_1.1.1-1_all.deb python-p4-hlir_0.9.36-1_all.deb $(foreach dep, $^, $(call install_deb, $(dep))) pushd p4c-bm; ./build.sh; popd From 94ae04d2a7195f14152be8f779ece3c2c3e034ac Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Thu, 15 Sep 2016 16:14:34 -0700 Subject: [PATCH 0039/1833] Use cffi version 1.7.0. Newest versions doesn't work with nanomsg --- dockers/docker-syncd-mlnx-rpc/Dockerfile | 4 ++-- dockers/docker-syncd-rpc/Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dockers/docker-syncd-mlnx-rpc/Dockerfile b/dockers/docker-syncd-mlnx-rpc/Dockerfile index 0e13887adf43..ca68b8a29304 100644 --- a/dockers/docker-syncd-mlnx-rpc/Dockerfile +++ b/dockers/docker-syncd-mlnx-rpc/Dockerfile @@ -26,8 +26,8 @@ RUN apt-get update \ && cd .. \ && rm -fr nanomsg-1.0.0 \ && rm -f 1.0.0.tar.gz \ - && pip install cffi \ - && pip install --upgrade cffi \ + && pip install cffi==1.7.0 \ + && pip install --upgrade cffi==1.7.0 \ && pip install nnpy \ && mkdir -p /opt \ && cd /opt \ diff --git a/dockers/docker-syncd-rpc/Dockerfile b/dockers/docker-syncd-rpc/Dockerfile index 7a34a46a1756..e7f6912746fe 100644 --- a/dockers/docker-syncd-rpc/Dockerfile +++ b/dockers/docker-syncd-rpc/Dockerfile @@ -26,8 +26,8 @@ RUN apt-get update \ && cd .. \ && rm -fr nanomsg-1.0.0 \ && rm -f 1.0.0.tar.gz \ - && pip install cffi \ - && pip install --upgrade cffi \ + && pip install cffi==1.7.0 \ + && pip install --upgrade cffi==1.7.0 \ && pip install nnpy \ && mkdir -p /opt \ && cd /opt \ From 28fa109e426dcaaf4643641bc0bd38b715a62cc5 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Wed, 5 Oct 2016 21:18:37 +0300 Subject: [PATCH 0040/1833] Changed docker-syncd-mlnx docker-saiserver-mlnx dependencies to use libnl provided by build system instead of sx-libnl. (#26) --- dockers/docker-saiserver-mlnx/Dockerfile | 8 +++++--- dockers/docker-syncd-mlnx/Dockerfile | 1 - src/mlnx-sdk/filelist.txt | 3 --- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dockers/docker-saiserver-mlnx/Dockerfile b/dockers/docker-saiserver-mlnx/Dockerfile index bdeec7748332..9390d19e88a0 100755 --- a/dockers/docker-saiserver-mlnx/Dockerfile +++ b/dockers/docker-saiserver-mlnx/Dockerfile @@ -2,7 +2,7 @@ FROM docker-base RUN apt-get update -COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/sx-libnl_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.2_*.deb", "/deps/"] +COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.2_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ dpkg_apt /deps/applibs_*.deb \ @@ -13,10 +13,12 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/sx-examples_*.deb \ && dpkg_apt /deps/sx-gen-utils_*.deb \ && dpkg_apt /deps/python-sdk-api_*.deb \ - && dpkg_apt /deps/sx-libnl_*.deb \ && dpkg_apt /deps/iproute2_*.deb \ && dpkg_apt /deps/mlnx-sai_*.deb \ - && dpkg_apt /deps/libthrift-0.9.2_*.deb + && dpkg_apt /deps/libthrift-0.9.2_*.deb \ + && dpkg_apt /deps/libnl-3-200_*.deb \ + && dpkg_apt /deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /deps/libnl-route-3-200_*.deb COPY ["deps/saiserver", "start.sh", "/usr/bin/"] diff --git a/dockers/docker-syncd-mlnx/Dockerfile b/dockers/docker-syncd-mlnx/Dockerfile index 578782c1f15e..5dcca1402a39 100755 --- a/dockers/docker-syncd-mlnx/Dockerfile +++ b/dockers/docker-syncd-mlnx/Dockerfile @@ -13,7 +13,6 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/sx-examples_*.deb \ && dpkg_apt /deps/sx-gen-utils_*.deb \ && dpkg_apt /deps/python-sdk-api_*.deb \ - && dpkg_apt /deps/sx-libnl_*.deb \ && dpkg_apt /deps/iproute2_*.deb \ && dpkg_apt /deps/mft*.deb \ diff --git a/src/mlnx-sdk/filelist.txt b/src/mlnx-sdk/filelist.txt index de603733b860..4426909780d1 100644 --- a/src/mlnx-sdk/filelist.txt +++ b/src/mlnx-sdk/filelist.txt @@ -19,9 +19,6 @@ sx-gen-utils-dev_1.mlnx.4.2.2100_amd64.deb sx-gen-utils_1.mlnx.4.2.2100_amd64.deb sx-kernel-dev_1.mlnx.4.2.2100_amd64.deb sx-kernel_1.mlnx.4.2.2100_amd64.deb -sx-libnl-dev-static_1.mlnx.4.2.2100_amd64.deb -sx-libnl-dev_1.mlnx.4.2.2100_amd64.deb -sx-libnl_1.mlnx.4.2.2100_amd64.deb sx-scew-dev-static_1.mlnx.4.2.2100_amd64.deb sx-scew-dev_1.mlnx.4.2.2100_amd64.deb sx-scew_1.mlnx.4.2.2100_amd64.deb From 4373c518cf0b12c39b0830bca53bf1562d077615 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 7 Oct 2016 10:41:44 -0700 Subject: [PATCH 0041/1833] libteam: Adding build.sh script and docker-team (#18) --- Makefile | 23 +++++++++++++++++------ dockers/docker-fpm/Dockerfile | 3 +-- dockers/docker-team/Dockerfile | 25 +++++++++++++++++++++++++ dockers/docker-team/start.sh | 24 ++++++++++++++++++++++++ src/Makefile | 18 ++++++++++++------ src/libteam/build.sh | 26 ++++++++++++++++++++++++++ 6 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 dockers/docker-team/Dockerfile create mode 100755 dockers/docker-team/start.sh create mode 100755 src/libteam/build.sh diff --git a/Makefile b/Makefile index 660880ae718a..4241e856246e 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb)) CAVM-SDK-DEBS=$(notdir $(wildcard src/cavm-sdk/*.deb)) LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb +LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb ## Function: build_docker, image_name save_file ## build a docker image and save to a file @@ -34,6 +35,12 @@ dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-fpm/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) + +## Rules: docker-team +dockers/docker-team/deps/teamsyncd: src/teamsyncd + mkdir -p `dirname $@` && cp $< $(dir $@) +dockers/docker-team/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) ## Rules: docker-orchagent-mlnx dockers/docker-orchagent-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/libsairedis_1.0.0_amd64.deb @@ -107,21 +114,25 @@ target/docker-syncd-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-sy docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS)) +target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS)) +target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS)) +target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb fpmsyncd) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/docker-team.gz: target/docker-base.gz $(addprefix dockers/docker-team/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb $(LIBTEAM-DEBS)) + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) target/docker-database.gz: target/docker-base.gz docker load < $< @@ -143,12 +154,12 @@ target/sonic-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_am ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-database.gz) +brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-team.gz docker-database.gz) ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-database.gz) +mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-team.gz docker-database.gz) ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -cavm-all: $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-database.gz) +cavm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-team.gz docker-database.gz) p4-all: $(addprefix target/,docker-sonic-p4.gz) diff --git a/dockers/docker-fpm/Dockerfile b/dockers/docker-fpm/Dockerfile index d877c408baab..287aba29ec82 100755 --- a/dockers/docker-fpm/Dockerfile +++ b/dockers/docker-fpm/Dockerfile @@ -7,12 +7,11 @@ COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/quagga_*", " ## Get fpmsyncd RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb -COPY deps/fpmsyncd /usr/local/bin/ ## Get Quagga RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb -COPY start.sh /usr/bin/start.sh +COPY ["deps/fpmsyncd", "start.sh", "/usr/bin/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/dockers/docker-team/Dockerfile b/dockers/docker-team/Dockerfile new file mode 100644 index 000000000000..8ba298043be1 --- /dev/null +++ b/dockers/docker-team/Dockerfile @@ -0,0 +1,25 @@ +FROM docker-base + +COPY ["deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "libnl-route-3-200_*.deb", "deps/libnl-cli-3-200_*.deb", "deps/libteam5_*.deb", "deps/libteam-dev_*.deb", "deps/libteam-utils_*.deb", "deps/libteamdctl0_*.deb", "deps/libhiredis0.13_*.deb", "deps/libswsscommon_*.deb", "/deps/"] + + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/libnl-3-200_*.deb \ + && dpkg_apt /deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /deps/libnl-route-3-200_*.deb \ + && dpkg_apt /deps/libnl-cli-3-200_*.deb \ + && dpkg_apt /deps/libteam5_*.deb \ + && dpkg_apt /deps/libteam-dev_*.deb \ + && dpkg_apt /deps/libteam-utils_*.deb \ + && dpkg_apt /deps/libteamdctl0_*.deb \ + && dpkg_apt /deps/libhiredis0.13_*.deb \ + && dpkg_apt /deps/libswsscommon_*.deb + +COPY ["deps/teamsyncd", "start.sh", "/usr/bin/"] + +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] + diff --git a/dockers/docker-team/start.sh b/dockers/docker-team/start.sh new file mode 100755 index 000000000000..61251cd82d86 --- /dev/null +++ b/dockers/docker-team/start.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +TEAMD_CONF_PATH=/etc/teamd + +function clean_up { + pkill -9 teamd + pkill -9 teamsyncd + service rsyslog stop + exit +} + +trap clean_up SIGTERM SIGKILL + +service rsyslog start + +if [ -d $TEAMD_CONF_PATH ]; then + for f in $TEAMD_CONF_PATH/*; do + teamd -f $f -d + done +fi + +teamsyncd & + +read diff --git a/src/Makefile b/src/Makefile index 38bcaf7cfaf1..9dd79d5b9bd6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -22,6 +22,9 @@ install_deb = \ libnl-%.deb: pushd libnl3; ./build.sh; popd +libteam5_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb: libnl-%.deb + pushd libteam; ./build.sh; popd + quagga_0.99.24.1-2_amd64.deb: pushd quagga; ./build.sh; popd @@ -80,26 +83,29 @@ p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0 mkdir -p p4 cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb p4/ -## Note: fpmsyncd is one implicit target -brcm/swss_1.0.0_amd64.deb brcm/intfsyncd brcm/neighsyncd brcm/orchagent brcm/portsyncd brcm/routeresync brcm/swssconfig: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb +## Note: fpmsyncd and teamsyncd are two implicit targets +brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb brcm/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . + cp sonic-swss/debian/swss/usr/bin/teamsyncd . -## Note: fpmsyncd is one implicit target -mlnx/swss_1.0.0_amd64.deb mlnx/intfsyncd mlnx/neighsyncd mlnx/orchagent mlnx/portsyncd mlnx/routeresync mlnx/swssconfig: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb +## Note: fpmsyncd and teamsyncd are two implicit targets +mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb mlnx/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . + cp sonic-swss/debian/swss/usr/bin/teamsyncd . -## Note: fpmsyncd is one implicit target -cavm/swss_1.0.0_amd64.deb cavm/intfsyncd cavm/neighsyncd cavm/orchagent cavm/portsyncd cavm/routeresync cavm/swssconfig: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb +## Note: fpmsyncd and teamsyncd are two implicit targets +cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb cavm/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . + cp sonic-swss/debian/swss/usr/bin/teamsyncd . p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) diff --git a/src/libteam/build.sh b/src/libteam/build.sh new file mode 100755 index 000000000000..8a7e69cfb1a2 --- /dev/null +++ b/src/libteam/build.sh @@ -0,0 +1,26 @@ +#!/bin/bash +## This script is to build libteam +## +## USAGE: +## ./build.sh + +# Obtain libteam +rm -rf ./libteam +git clone https://github.com/jpirko/libteam.git +pushd ./libteam +git checkout -f v1.26 +popd + +git clone https://anonscm.debian.org/git/collab-maint/libteam.git tmp +pushd ./tmp +git checkout -f da006f2 # v1.26 +popd +mv tmp/debian libteam/ +rm -rf tmp + +pushd ./libteam +dpkg-buildpackage -rfakeroot -b -us -uc + +popd +cp *.deb .. + From dcf691ecaa7eef66b34a942e09d3ed27d4a87c33 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sun, 9 Oct 2016 14:40:55 -0700 Subject: [PATCH 0042/1833] Add libnl-nf-3-200 to docker-team (#28) --- dockers/docker-team/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-team/Dockerfile b/dockers/docker-team/Dockerfile index 8ba298043be1..885b99674b85 100644 --- a/dockers/docker-team/Dockerfile +++ b/dockers/docker-team/Dockerfile @@ -1,12 +1,13 @@ FROM docker-base -COPY ["deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "libnl-route-3-200_*.deb", "deps/libnl-cli-3-200_*.deb", "deps/libteam5_*.deb", "deps/libteam-dev_*.deb", "deps/libteam-utils_*.deb", "deps/libteamdctl0_*.deb", "deps/libhiredis0.13_*.deb", "deps/libswsscommon_*.deb", "/deps/"] +COPY ["deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libnl-nf-3-200_*.deb", "deps/libnl-cli-3-200_*.deb", "deps/libteam5_*.deb", "deps/libteam-dev_*.deb", "deps/libteam-utils_*.deb", "deps/libteamdctl0_*.deb", "deps/libhiredis0.13_*.deb", "deps/libswsscommon_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ dpkg_apt /deps/libnl-3-200_*.deb \ && dpkg_apt /deps/libnl-genl-3-200_*.deb \ && dpkg_apt /deps/libnl-route-3-200_*.deb \ + && dpkg_apt /deps/libnl-nf-3-200_*.deb \ && dpkg_apt /deps/libnl-cli-3-200_*.deb \ && dpkg_apt /deps/libteam5_*.deb \ && dpkg_apt /deps/libteam-dev_*.deb \ From d5696f742dca12f690c5a68b85dec5da7f5d3be8 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 9 Oct 2016 18:05:24 -0700 Subject: [PATCH 0043/1833] Add support for Arista a7050 qx32 platform (#30) --- dockers/docker-orchagent/start.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 8531125018d7..fe9528d99b65 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -30,6 +30,9 @@ PORTSYNCD_ARGS="" if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" PORTSYNCD_ARGS+="-p /etc/ssw/Force10-S6000/port_config.ini" +elif [ "$aboot_platform" == "x86_64-arista_7050_qx32" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" + PORTSYNCD_ARGS+="-p /etc/ssw/Arista-7050-QX32/port_config.ini" elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini" elif [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then From 6042f526f2903e5131c8a52b40f307070c0de7c6 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 12 Oct 2016 10:29:14 -0700 Subject: [PATCH 0044/1833] Update README.md Run the sonic-slave container with --privileged. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 897c03c7b337..f79e78746776 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Build a docker image by [the Dockerfile](https://github.com/Azure/sonic-build-to git clone https://github.com/Azure/sonic-build-tools cd sonic-build-tools ./build.sh sonic-slave - docker run -v /var/run/docker.sock:/var/run/docker.sock -it local/sonic-slave bash + docker run -v /var/run/docker.sock:/var/run/docker.sock -it --privileged local/sonic-slave bash Note that all the below steps should be executed in the docker container, not in the host machine. From e5d8289f0b51469dc1ea4ca2e1adafeba5bbb095 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 14 Oct 2016 14:12:54 -0700 Subject: [PATCH 0045/1833] Use quagga sources as a git submodule (#32) --- .gitmodules | 4 ++++ src/Makefile | 6 +++--- src/quagga/build.sh | 36 ------------------------------------ src/sonic-quagga | 1 + 4 files changed, 8 insertions(+), 39 deletions(-) delete mode 100755 src/quagga/build.sh create mode 160000 src/sonic-quagga diff --git a/.gitmodules b/.gitmodules index a6a4a1a9f611..8b5f020f356e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,7 @@ [submodule "src/p4-hlir/p4-hlir"] path = src/p4-hlir/p4-hlir url = https://github.com/p4lang/p4-hlir +[submodule "quagga"] + path = src/sonic-quagga + url = https://github.com/Azure/sonic-quagga + branch = debian/0.99.24.1 diff --git a/src/Makefile b/src/Makefile index 9dd79d5b9bd6..9b7cc582a59d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -25,9 +25,6 @@ libnl-%.deb: libteam5_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb: libnl-%.deb pushd libteam; ./build.sh; popd -quagga_0.99.24.1-2_amd64.deb: - pushd quagga; ./build.sh; popd - redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0.7-2_amd64.deb: pushd redis; ./build.sh; popd @@ -55,6 +52,9 @@ p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3 $(foreach dep, $^, $(call install_deb, $(dep))) pushd p4-switch; ./build.sh; popd +quagga_0.99.24.1-2.1_amd64.deb: + $(call build_project, sonic-quagga) + libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss-common) diff --git a/src/quagga/build.sh b/src/quagga/build.sh deleted file mode 100755 index 03ea3bf5cd5a..000000000000 --- a/src/quagga/build.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -x - -mkdir quagga - -# Get debian source for 0.9.24.1-2 -wget -O quagga_0.99.24.1.orig.tar.gz 'https://sonicstorage.blob.core.windows.net/packages/quagga_0.99.24.1.orig.tar.gz?sv=2015-04-05&sr=b&sig=7g3AC%2FkoX3wYztJYtXFt6Wl7zj%2BYwLkbXVNaSaRvUDU%3D&se=2026-07-21T00%3A07%3A31Z&sp=r' -tar -xzf quagga_0.99.24.1.orig.tar.gz --strip-components=1 -C quagga -ls -lrt - -# Get debian packaging for 0.99.24.1-2 -wget -O quagga_0.99.24.1-2.debian.tar.xz 'https://sonicstorage.blob.core.windows.net/packages/quagga_0.99.24.1-2.debian.tar.xz?sv=2015-04-05&sr=b&sig=VFEq4ec99OjVaypAx14DkO5I8N4CIBIPOuSw79qHUXg%3D&se=2026-07-21T00%3A03%3A10Z&sp=r' -tar -xJf quagga_0.99.24.1-2.debian.tar.xz -C quagga -ls -lrt - -cd quagga -ls -lrt - -# Enable FPM in debian/rules -awk '/--with-libpam/ { print; print " --enable-fpm \\"; next }1' debian/rules > tmp && mv tmp debian/rules - -# Update changelog -#echo 'quagga (0.99.24.1-2.1) unstable; urgency=medium -# -# * Non-maintainer upload. -# * enable fpm -# -# -- Guohan Lu Sat, 18 Jul 2015 16:10:47 -0700 -#' > tmp && cat debian/changelog >> tmp && mv tmp debian/changelog - -#./configure --enable-fpm -#make - -sudo chmod a+x debian/rules -dpkg-buildpackage -rfakeroot -b -us -uc -cd .. -cp *.deb .. diff --git a/src/sonic-quagga b/src/sonic-quagga new file mode 160000 index 000000000000..1997fb28efe4 --- /dev/null +++ b/src/sonic-quagga @@ -0,0 +1 @@ +Subproject commit 1997fb28efe441a761b16559775006a2e37913e0 From 51fa77fa8dfec25f9f8cdaf43f87daaad2744d75 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 18 Oct 2016 21:22:29 +0300 Subject: [PATCH 0046/1833] Automatic fw upgrade for mlnx platform (#31) * Automatic fw upgrade for mlnx platform Implement script for firmware upgrade to required version Add firmware binary and script to ops-syncd-mlnx container Add pciutils and usbutils to sonic-generic.bin * Update firmware installation message It is possible to do both upgrade and downgrade Change "Upgrading" to "Installing compatible version" Signed-off-by: marian-pritsak --- Makefile | 4 +- build_debian.sh | 4 +- dockers/docker-syncd-mlnx/Dockerfile | 2 + dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh | 53 ++++++++++++++++++++ dockers/docker-syncd-mlnx/start.sh | 4 ++ 5 files changed, 65 insertions(+), 2 deletions(-) create mode 100755 dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh diff --git a/Makefile b/Makefile index 4241e856246e..81c1b3e9a084 100644 --- a/Makefile +++ b/Makefile @@ -73,6 +73,8 @@ $(addprefix dockers/docker-syncd-mlnx/deps/,syncd_1.0.0_amd64.deb libsairedis_1. mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) +dockers/docker-syncd-mlnx/deps/fw-SPC.mfa: src/mlnx-sdk/fw-SPC.mfa + mkdir -p `dirname $@` && cp $< $(dir $@) ## Rules: docker-syncd-cavm $(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb @@ -106,7 +108,7 @@ target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/d docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb $(LIBNL-DEBS)) +target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb $(LIBNL-DEBS)) dockers/docker-syncd-mlnx/deps/fw-SPC.mfa docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) diff --git a/build_debian.sh b/build_debian.sh index 95d80f5a03d5..304b474e9a60 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -183,7 +183,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ bsdmainutils \ ca-certificates \ i2c-tools \ - efibootmgr + efibootmgr \ + usbutils \ + pciutils ## Remove sshd host keys, and will regenerate on first sshd start sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* diff --git a/dockers/docker-syncd-mlnx/Dockerfile b/dockers/docker-syncd-mlnx/Dockerfile index 5dcca1402a39..fb7a5fcad01e 100755 --- a/dockers/docker-syncd-mlnx/Dockerfile +++ b/dockers/docker-syncd-mlnx/Dockerfile @@ -27,6 +27,8 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb COPY ["start.sh", "/usr/bin/"] +COPY ["mlnx-fw-upgrade.sh", "/usr/bin/"] +COPY ["/deps/fw-SPC.mfa", "/etc/mlnx/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh b/dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh new file mode 100755 index 000000000000..2ef46685f801 --- /dev/null +++ b/dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +query_retry_count_max="10" +required_fw_version="13.1130.0010" +fw_file=/etc/mlnx/fw-SPC.mfa + +run_or_fail() { + $1 + if [[ $? != 0 ]]; then + echo $1 failed + exit 1 + fi +} + +# wait until devices will be available +query_retry_count="0" +mlxfwmanager --query > /dev/null + +while [[ (${query_retry_count} -lt ${query_retry_count_max}) && ($? -ne "0") ]]; do + sleep 1 + query_retry_count=$[${query_retry_count}+1] + mlxfwmanager --query > /dev/null +done + +run_or_fail "mlxfwmanager --query" > /tmp/mlnxfwmanager-query.txt + +# get current firmware version +found_fw=false +for word in `cat /tmp/mlnxfwmanager-query.txt` +do + if [[ ${found_fw} == true ]]; then + fw_version=${word} + break + fi + if [[ ${word} == FW ]]; then + found_fw=true + fi +done + +if [[ -z ${fw_version} ]]; then + echo "Could not retreive current FW version." + exit 1 +fi + +if [[ ${required_fw_version} == ${fw_version} ]]; then + echo "Mellanox firmware is up to date." +else + echo "Mellanox firmware required version is ${required_fw_version}. Installing compatible version..." + run_or_fail "mlxfwmanager -i ${fw_file} -u -f -y" + + # exit from here so that syncd service will restart + exit 0 +fi diff --git a/dockers/docker-syncd-mlnx/start.sh b/dockers/docker-syncd-mlnx/start.sh index 3e5b941a7658..63dbc8bfb2c4 100755 --- a/dockers/docker-syncd-mlnx/start.sh +++ b/dockers/docker-syncd-mlnx/start.sh @@ -8,6 +8,10 @@ function clean_up { trap clean_up SIGTERM SIGKILL +# fw-upgrade will exit if firmware was actually upgraded or if some error +# occures +. mlnx-fw-upgrade.sh + service rsyslog start service syncd start From 93852194eb9bcda6810ae556b5e757b32631371b Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 19 Oct 2016 14:39:44 -0700 Subject: [PATCH 0047/1833] start.sh: Remove rsyslogd.pid file on mlnx syncd docker (#35) --- dockers/docker-syncd-mlnx/start.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-syncd-mlnx/start.sh b/dockers/docker-syncd-mlnx/start.sh index 63dbc8bfb2c4..3c07069ba26e 100755 --- a/dockers/docker-syncd-mlnx/start.sh +++ b/dockers/docker-syncd-mlnx/start.sh @@ -12,6 +12,9 @@ trap clean_up SIGTERM SIGKILL # occures . mlnx-fw-upgrade.sh +# FIXME: the script cannot trap SIGTERM signal and it exits without clean_up +# Remove rsyslogd.pid file manually so that to start the rsyslog instantly +[ -e /var/run/rsyslogd.pid ] && rm /var/run/rsyslogd.pid service rsyslog start service syncd start From d45ff354e21ea86b001659a15e5b7a87c514b071 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 21 Oct 2016 00:29:27 -0700 Subject: [PATCH 0048/1833] check the existence of platforms/ before including it (#37) --- installer/x86_64/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index e49a6484e00c..90253e56f26e 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -51,7 +51,7 @@ CONSOLE_SPEED=9600 # Get platform specific linux kernel command line arguments ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" -source platforms/$onie_platform +[ -r platforms/$onie_platform ] && source platforms/$onie_platform # Install demo on same block device as ONIE onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') From 7d9fd3c4f8501c6f8d9cd0a271d145ea1e8b9ddd Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 22 Oct 2016 00:56:50 -0700 Subject: [PATCH 0049/1833] build mft-kernel binary debian package (#36) --- src/Makefile | 3 +++ src/mft/build.sh | 22 ++++++++++++++++++++++ src/mlnx-sdk/filelist.txt | 1 - 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 src/mft/build.sh diff --git a/src/Makefile b/src/Makefile index 9b7cc582a59d..c1bfb78bf839 100644 --- a/src/Makefile +++ b/src/Makefile @@ -38,6 +38,9 @@ p4-bmv2_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2 $(foreach dep, $^, $(call install_deb, $(dep))) pushd p4-bmv2; ./build.sh; popd +kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb mft-4.5.0-31.amd64.deb: + pushd mft; ./build.sh; popd + python-p4-hlir_0.9.36-1_all.deb: pushd p4-hlir; ./build.sh; popd diff --git a/src/mft/build.sh b/src/mft/build.sh new file mode 100755 index 000000000000..44aa233a3124 --- /dev/null +++ b/src/mft/build.sh @@ -0,0 +1,22 @@ +#!/bin/bash +## This script is to build the kernel-mft-dkms_4.5.0-3.16.0-4-amd64 kernel modules +## +## USAGE: +## ./build.sh + +MFT_NAME=mft-4.5.0-31-x86_64-deb +MFT_TGZ=${MFT_NAME}.tgz +MFT_KERNEL_DEB=kernel-mft-dkms_4.5.0-31_all.deb +KERNELVER=3.16.0-4-amd64 + +wget -N http://www.mellanox.com/downloads/MFT/${MFT_TGZ} +tar xzf $MFT_TGZ +pushd $MFT_NAME/SDEBS +dpkg -i $MFT_KERNEL_DEB +TARBALL_PATH=$(dkms mkdriverdisk kernel-mft-dkms/4.5.0 -a all -d ubuntu -k ${KERNELVER} --media tar | grep "Disk image location" | cut -d':' -f2) +echo $TARBALL_PATH +tar xvf $TARBALL_PATH +popd + +cp $MFT_NAME/SDEBS/ubuntu-drivers/3.16.0/kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb ../ +cp $MFT_NAME/DEBS/mft-4.5.0-31.amd64.deb ../ diff --git a/src/mlnx-sdk/filelist.txt b/src/mlnx-sdk/filelist.txt index 4426909780d1..52583c7f79c7 100644 --- a/src/mlnx-sdk/filelist.txt +++ b/src/mlnx-sdk/filelist.txt @@ -5,7 +5,6 @@ applibs-dev_1.mlnx.4.2.2100_amd64.deb applibs_1.mlnx.4.2.2100_amd64.deb iproute2-dev_1.mlnx.4.2.2100_amd64.deb iproute2_1.mlnx.4.2.2100_amd64.deb -mft_4.1.0-28_amd64.deb mlnx-sai_1.mlnx.160712_amd64.deb python-sdk-api_1.mlnx.4.2.2100_amd64.deb sx-acl-rm-dev_1.mlnx.4.2.2100_amd64.deb From 293db925506f5bdf873f1a82fad32c2cd29a9377 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 24 Oct 2016 14:05:56 -0700 Subject: [PATCH 0050/1833] Apply swss configuration in a deterministic way (#39) * Apply swss configuration in determine way * Apply configs in small chunks * Add qos settings for Arista --- dockers/docker-orchagent/start.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index fe9528d99b65..0cea8e4de988 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -5,7 +5,11 @@ function start_app { portsyncd $PORTSYNCD_ARGS & intfsyncd & neighsyncd & - swssconfig & + for file in $SWSSCONFIG_ARGS + do + swssconfig /etc/swss/config.d/$file + sleep 1 + done } function clean_up { @@ -27,12 +31,18 @@ ORCHAGENT_ARGS="" PORTSYNCD_ARGS="" +SWSSCONFIG_ARGS="00-copp.config.json " + if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" PORTSYNCD_ARGS+="-p /etc/ssw/Force10-S6000/port_config.ini" + SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " + SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " elif [ "$aboot_platform" == "x86_64-arista_7050_qx32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" PORTSYNCD_ARGS+="-p /etc/ssw/Arista-7050-QX32/port_config.ini" + SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " + SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini" elif [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then From 42f1b55ec7559ac84f2b628b7dda0c3c0f54e6a0 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 26 Oct 2016 13:19:50 -0700 Subject: [PATCH 0051/1833] add get docker base script to download pre-compiled docker base image (#40) --- get_docker-base.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 get_docker-base.sh diff --git a/get_docker-base.sh b/get_docker-base.sh new file mode 100755 index 000000000000..088b6bf46b29 --- /dev/null +++ b/get_docker-base.sh @@ -0,0 +1,17 @@ +#!/bin/bash +## This script is to retrieve and import the docker-base image from +## local folder where the image is built on the local machine +## +## USAGE: +## ./get_docker-base.sh + +set -x -e + +. ./functions.sh + +## [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Read-only link of Azure Blob storage with shared access signature (SAS)")] +BASE_URL="https://sonicstorage.blob.core.windows.net/packages/docker-base.ea507753d98b0769e2a15be13003331f8ad38d1c15b40a683e05fc53b1463b10.gz?sv=2015-04-05&sr=b&sig=DjbdpLaslHeiaZLwFuauhPA2wR0v7kOH5yPHiAbzgBc%3D&se=2016-10-28T13%3A04%3A23Z&sp=r" + +base_image_name=docker-base +docker_try_rmi $base_image_name +curl "$BASE_URL" | docker load From 515346abf48c258ed9802dcdbe9c3bdfe7c0d99f Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 26 Oct 2016 15:19:41 -0700 Subject: [PATCH 0052/1833] Dockerfile: Add libsaimetadata dependency (#42) * Dockerfile: Add libsaimetadata dependency * Makefile: Add saimetadata --- Makefile | 34 ++++++++++++---------------- dockers/docker-orchagent/Dockerfile | 3 ++- dockers/docker-sonic-p4/Dockerfile | 3 ++- dockers/docker-syncd-cavm/Dockerfile | 3 ++- dockers/docker-syncd-mlnx/Dockerfile | 3 ++- dockers/docker-syncd/Dockerfile | 3 ++- src/Makefile | 24 ++++++++++---------- src/sonic-swss | 2 +- 8 files changed, 37 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index 81c1b3e9a084..03a67bde0937 100644 --- a/Makefile +++ b/Makefile @@ -43,25 +43,19 @@ dockers/docker-team/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) ## Rules: docker-orchagent-mlnx -dockers/docker-orchagent-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/libsairedis_1.0.0_amd64.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-orchagent-mlnx/deps/swss_1.0.0_amd64.deb: src/mlnx/swss_1.0.0_amd64.deb +$(addprefix dockers/docker-orchagent-mlnx/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent-mlnx/deps/%.deb : src/mlnx/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent-mlnx/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) ## Rules: docker-orchagent-cavm -dockers/docker-orchagent-cavm/deps/libsairedis_1.0.0_amd64.deb: src/cavm/libsairedis_1.0.0_amd64.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-orchagent-cavm/deps/swss_1.0.0_amd64.deb: src/cavm/swss_1.0.0_amd64.deb +$(addprefix dockers/docker-orchagent-cavm/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent-cavm/deps/%.deb : src/cavm/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent-cavm/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) ## Rules: docker-orchagent (brcm) -dockers/docker-orchagent/deps/libsairedis_1.0.0_amd64.deb: src/brcm/libsairedis_1.0.0_amd64.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-orchagent/deps/swss_1.0.0_amd64.deb: src/brcm/swss_1.0.0_amd64.deb +$(addprefix dockers/docker-orchagent/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent/deps/%.deb : src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) @@ -69,7 +63,7 @@ dockers/docker-orchagent/deps/%.deb: src/%.deb ## Rules: docker-syncd-mlnx $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) -$(addprefix dockers/docker-syncd-mlnx/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx/%.deb +$(addprefix dockers/docker-syncd-mlnx/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) @@ -79,7 +73,7 @@ dockers/docker-syncd-mlnx/deps/fw-SPC.mfa: src/mlnx-sdk/fw-SPC.mfa ## Rules: docker-syncd-cavm $(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) -$(addprefix dockers/docker-syncd-cavm/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm/%.deb +$(addprefix dockers/docker-syncd-cavm/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-syncd-cavm/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) @@ -87,13 +81,13 @@ dockers/docker-syncd-cavm/deps/%.deb: src/%.deb ## Rules: docker-syncd (brcm) $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) -$(addprefix dockers/docker-syncd/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb): dockers/docker-syncd/deps/%.deb : src/brcm/%.deb +$(addprefix dockers/docker-syncd/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb): dockers/docker-syncd/deps/%.deb : src/brcm/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-syncd/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) ## Rules: docker-sonic (p4) -$(addprefix dockers/docker-sonic-p4/deps/,swss_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) : dockers/docker-sonic-p4/deps/%.deb : src/p4/%.deb +$(addprefix dockers/docker-sonic-p4/deps/,swss_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-sonic-p4/deps/%.deb : src/p4/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-sonic-p4/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) @@ -102,29 +96,29 @@ dockers/docker-sonic-p4/deps/%.deb: src/%.deb target/docker-base.gz: $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb $(LIBNL-DEBS)) +target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) ## TODO: remove placeholders for the dependencies touch dockers/docker-syncd/deps/{dsserve,bcmcmd} docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb $(LIBNL-DEBS)) dockers/docker-syncd-mlnx/deps/fw-SPC.mfa +target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) dockers/docker-syncd-mlnx/deps/fw-SPC.mfa docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-syncd-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) +target/docker-syncd-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) +target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) +target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) +target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) @@ -140,7 +134,7 @@ target/docker-database.gz: target/docker-base.gz docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb) +target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) diff --git a/dockers/docker-orchagent/Dockerfile b/dockers/docker-orchagent/Dockerfile index dbdf01f3dd98..311fba152a64 100755 --- a/dockers/docker-orchagent/Dockerfile +++ b/dockers/docker-orchagent/Dockerfile @@ -2,7 +2,7 @@ FROM docker-base RUN apt-get update -COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/swss_*.deb", "/deps/"] +COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/swss_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ dpkg_apt /deps/libhiredis0.13*.deb \ @@ -11,6 +11,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/libnl-route-3-200_*.deb \ && dpkg_apt /deps/libswsscommon_*.deb \ && dpkg_apt /deps/libsairedis_*.deb \ + && dpkg_apt /deps/libsaimetadata_*.deb \ && dpkg_apt /deps/swss_*.deb RUN apt-get install -f -y ifupdown bridge-utils redis-tools diff --git a/dockers/docker-sonic-p4/Dockerfile b/dockers/docker-sonic-p4/Dockerfile index d5470bbd8837..163aa46296e5 100644 --- a/dockers/docker-sonic-p4/Dockerfile +++ b/dockers/docker-sonic-p4/Dockerfile @@ -4,7 +4,7 @@ RUN apt-get update RUN apt-get install -y net-tools ethtool tcpdump ifupdown -COPY ["deps/libthrift-0.9.3_*.deb", "deps/libhiredis0.13*.deb", "deps/redis-tools_*.deb", "deps/redis-server_*.deb", "deps/libswsscommon_*.deb", "deps/p4-bmv2_*.deb", "deps/p4-switch_*.deb", "deps/libsairedis_*.deb", "deps/syncd_*.deb", "deps/swss_*.deb", "deps/quagga_*.deb", "/deps/"] +COPY ["deps/libthrift-0.9.3_*.deb", "deps/libhiredis0.13*.deb", "deps/redis-tools_*.deb", "deps/redis-server_*.deb", "deps/libswsscommon_*.deb", "deps/p4-bmv2_*.deb", "deps/p4-switch_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/syncd_*.deb", "deps/swss_*.deb", "deps/quagga_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libthrift-0.9.3_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb @@ -15,6 +15,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/p4-bmv2_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/p4-switch_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsaimetadata_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/swss_*.deb diff --git a/dockers/docker-syncd-cavm/Dockerfile b/dockers/docker-syncd-cavm/Dockerfile index bbb5195901b7..3fdbf1f516b8 100755 --- a/dockers/docker-syncd-cavm/Dockerfile +++ b/dockers/docker-syncd-cavm/Dockerfile @@ -2,7 +2,7 @@ FROM docker-base RUN apt-get update -COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/syncd_*.deb", "deps/sai*.deb", "deps/libsai*.deb", "deps/xp-tools*.deb", "deps/xpshell*.deb", "/deps/"] +COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/syncd_*.deb", "deps/sai*.deb", "deps/libsai*.deb", "deps/xp-tools*.deb", "deps/xpshell*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ dpkg_apt /deps/libhiredis0.13*.deb \ @@ -12,6 +12,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/xp-tools*.deb \ && dpkg_apt /deps/xpshell*.deb \ && dpkg_apt /deps/libsairedis_*.deb \ + && dpkg_apt /deps/libsaimetadata_*.deb\ && dpkg_apt /deps/syncd_*.deb RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev diff --git a/dockers/docker-syncd-mlnx/Dockerfile b/dockers/docker-syncd-mlnx/Dockerfile index fb7a5fcad01e..77229a333d11 100755 --- a/dockers/docker-syncd-mlnx/Dockerfile +++ b/dockers/docker-syncd-mlnx/Dockerfile @@ -22,7 +22,8 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/libnl-route-3-200_*.deb \ && dpkg_apt /deps/libswsscommon_*.deb \ && dpkg_apt /deps/mlnx-sai_*.deb \ - && dpkg_apt /deps/libsairedis_*.deb + && dpkg_apt /deps/libsairedis_*.deb \ + && dpkg_apt /deps/libsaimetadata_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb diff --git a/dockers/docker-syncd/Dockerfile b/dockers/docker-syncd/Dockerfile index 9ad7e432cef9..88c521ffef68 100755 --- a/dockers/docker-syncd/Dockerfile +++ b/dockers/docker-syncd/Dockerfile @@ -2,7 +2,7 @@ FROM docker-base RUN apt-get update -COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libopennsl_*.deb", "deps/libsaibcm_*.deb", "deps/libsairedis_*.deb", "deps/syncd_*.deb", "/deps/"] +COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libopennsl_*.deb", "deps/libsaibcm_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/syncd_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ dpkg_apt /deps/libhiredis0.13*.deb \ @@ -13,6 +13,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/libopennsl_*.deb \ && dpkg_apt /deps/libsaibcm_*.deb \ && dpkg_apt /deps/libsairedis_*.deb \ + && dpkg_apt /deps/libsaimetadata_*.deb \ && dpkg_apt /deps/syncd_*.deb ## TODO: add kmod into Depends diff --git a/src/Makefile b/src/Makefile index c1bfb78bf839..0fc5aff8c3c2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -62,32 +62,32 @@ libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_3. $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss-common) -brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb brcm-sdk/libopennsl_*_amd64.deb brcm-sdk/libsaibcm_1.0.2*_amd64.deb brcm-sdk/libsaibcm-dev_1.0.2*_amd64.deb +brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb brcm/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb brcm-sdk/libopennsl_*_amd64.deb brcm-sdk/libsaibcm_1.0.2*_amd64.deb brcm-sdk/libsaibcm-dev_1.0.2*_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-sairedis) mkdir -p brcm - cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb brcm/ + cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb brcm/ -mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/applibs_1.mlnx.4.2.2100_amd64.deb mlnx-sdk/*.deb +mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/applibs_1.mlnx.4.2.2100_amd64.deb mlnx-sdk/*.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-sairedis) mkdir -p mlnx - cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb mlnx/ + cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb mlnx/ -cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb cavm-sdk/libsai.deb cavm-sdk/xp-tools.deb cavm-sdk/xpshell.deb +cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb cavm/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb cavm-sdk/libsai.deb cavm-sdk/xp-tools.deb cavm-sdk/xpshell.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-sairedis) mkdir -p cavm - cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb cavm/ + cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb cavm/ -p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb p4-bmv2_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb +p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb p4-bmv2_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-sairedis) mkdir -p p4 - cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb p4/ + cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb p4/ ## Note: fpmsyncd and teamsyncd are two implicit targets -brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb +brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb brcm/ @@ -95,7 +95,7 @@ brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd cp sonic-swss/debian/swss/usr/bin/teamsyncd . ## Note: fpmsyncd and teamsyncd are two implicit targets -mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb +mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb mlnx/ @@ -103,14 +103,14 @@ mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd cp sonic-swss/debian/swss/usr/bin/teamsyncd . ## Note: fpmsyncd and teamsyncd are two implicit targets -cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb +cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb cavm/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . cp sonic-swss/debian/swss/usr/bin/teamsyncd . -p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb +p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb p4/ diff --git a/src/sonic-swss b/src/sonic-swss index bdbe77ce879d..a025ab0019e7 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit bdbe77ce879de16334fcc53bd2a749e627f2c76c +Subproject commit a025ab0019e7c24bf4a22a0165a9d5b1ddecd528 From c4630f54c7390c880277cbf99956bc5f9a1647f8 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 26 Oct 2016 21:27:31 -0700 Subject: [PATCH 0053/1833] Dockerfile: Add bridge-utils to p4 docker (#43) --- dockers/docker-sonic-p4/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-sonic-p4/Dockerfile b/dockers/docker-sonic-p4/Dockerfile index 163aa46296e5..a0c7cc99219e 100644 --- a/dockers/docker-sonic-p4/Dockerfile +++ b/dockers/docker-sonic-p4/Dockerfile @@ -2,7 +2,7 @@ FROM docker-base RUN apt-get update -RUN apt-get install -y net-tools ethtool tcpdump ifupdown +RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils COPY ["deps/libthrift-0.9.3_*.deb", "deps/libhiredis0.13*.deb", "deps/redis-tools_*.deb", "deps/redis-server_*.deb", "deps/libswsscommon_*.deb", "deps/p4-bmv2_*.deb", "deps/p4-switch_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/syncd_*.deb", "deps/swss_*.deb", "deps/quagga_*.deb", "/deps/"] From 23542f3e024c15ade1ef6c0321ffda21084a4dd4 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 27 Oct 2016 18:02:32 -0700 Subject: [PATCH 0054/1833] Add docker configuration for saiserver-brcm (#44) --- dockers/docker-saiserver-brcm/Dockerfile | 24 +++++++++++++++++ dockers/docker-saiserver-brcm/portmap.ini | 33 +++++++++++++++++++++++ dockers/docker-saiserver-brcm/profile.ini | 1 + dockers/docker-saiserver-brcm/start.sh | 20 ++++++++++++++ 4 files changed, 78 insertions(+) create mode 100755 dockers/docker-saiserver-brcm/Dockerfile create mode 100644 dockers/docker-saiserver-brcm/portmap.ini create mode 100644 dockers/docker-saiserver-brcm/profile.ini create mode 100755 dockers/docker-saiserver-brcm/start.sh diff --git a/dockers/docker-saiserver-brcm/Dockerfile b/dockers/docker-saiserver-brcm/Dockerfile new file mode 100755 index 000000000000..a85e7023204e --- /dev/null +++ b/dockers/docker-saiserver-brcm/Dockerfile @@ -0,0 +1,24 @@ +FROM docker-base + +RUN apt-get update + +COPY ["/deps/libsaibcm*.deb","/deps/libopennsl_*.deb","/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/libthrift-0.9.3_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"] + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/libopennsl_*.deb \ + && dpkg_apt /deps/libsaibcm_*.deb \ + && dpkg_apt /deps/libthrift-0.9.3_*.deb \ + && dpkg_apt /deps/libnl-3-200_*.deb \ + && dpkg_apt /deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /deps/libnl-route-3-200_*.deb + +COPY ["deps/saiserver", "start.sh", "/usr/bin/"] + +COPY ["profile.ini", "portmap.ini", "/etc/sai/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-saiserver-brcm/portmap.ini b/dockers/docker-saiserver-brcm/portmap.ini new file mode 100644 index 000000000000..7161416e4d4c --- /dev/null +++ b/dockers/docker-saiserver-brcm/portmap.ini @@ -0,0 +1,33 @@ +# alias lanes +Ethernet0 29,30,31,32 +Ethernet4 25,26,27,28 +Ethernet8 37,38,39,40 +Ethernet12 33,34,35,36 +Ethernet16 41,42,43,44 +Ethernet20 45,46,47,48 +Ethernet24 5,6,7,8 +Ethernet28 1,2,3,4 +Ethernet32 9,10,11,12 +Ethernet36 13,14,15,16 +Ethernet40 21,22,23,24 +Ethernet44 17,18,19,20 +Ethernet48 49,50,51,52 +Ethernet52 53,54,55,56 +Ethernet56 61,62,63,64 +Ethernet60 57,58,59,60 +Ethernet64 65,66,67,68 +Ethernet68 69,70,71,72 +Ethernet72 77,78,79,80 +Ethernet76 73,74,75,76 +Ethernet80 105,106,107,108 +Ethernet84 109,110,111,112 +Ethernet88 117,118,119,120 +Ethernet92 113,114,115,116 +Ethernet96 121,122,123,124 +Ethernet100 125,126,127,128 +Ethernet104 85,86,87,88 +Ethernet108 81,82,83,84 +Ethernet112 89,90,91,92 +Ethernet116 93,94,95,96 +Ethernet120 97,98,99,100 +Ethernet124 101,102,103,104 diff --git a/dockers/docker-saiserver-brcm/profile.ini b/dockers/docker-saiserver-brcm/profile.ini new file mode 100644 index 000000000000..b64d997fb451 --- /dev/null +++ b/dockers/docker-saiserver-brcm/profile.ini @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/td2-s6000-32x40G.config.bcm diff --git a/dockers/docker-saiserver-brcm/start.sh b/dockers/docker-saiserver-brcm/start.sh new file mode 100755 index 000000000000..07d03b41a9ba --- /dev/null +++ b/dockers/docker-saiserver-brcm/start.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +function clean_up { + service rsyslog stop +} + +start_bcm() +{ + [ -e /dev/linux-bcm-knet ] || mknod /dev/linux-bcm-knet c 122 0 + [ -e /dev/linux-user-bde ] || mknod /dev/linux-user-bde c 126 0 + [ -e /dev/linux-kernel-bde ] || mknod /dev/linux-kernel-bde c 127 0 +} + +trap clean_up SIGTERM SIGKILL + +service rsyslog start + +start_bcm + +/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini From 135ba232ca8d52d52ceead67783fc3e3850c0e74 Mon Sep 17 00:00:00 2001 From: thomasbo Date: Tue, 25 Oct 2016 18:52:13 -0700 Subject: [PATCH 0055/1833] SNMP/LLDP Containers: Sonic V2 Support (#41) * Adding support for V2 in SNMP/LLDP (-sv2 postfix) * Fixes for V1 containers: logging * Fixes for V1 LLDP: limit LLDP to Front-panel or MGMT interfaces. --- dockers/docker-lldp-sv2/Dockerfile | 22 ++++++++++++ dockers/docker-lldp-sv2/supervisord.conf | 19 ++++++++++ dockers/docker-lldp/Dockerfile | 17 ++++----- dockers/docker-lldp/supervisord.conf | 15 ++++---- dockers/docker-snmp-sv2/Dockerfile | 46 ++++++++++++++++++++++++ dockers/docker-snmp-sv2/supervisord.conf | 14 ++++++++ dockers/docker-snmp/Dockerfile | 15 ++++---- dockers/docker-snmp/supervisord.conf | 3 ++ 8 files changed, 128 insertions(+), 23 deletions(-) create mode 100644 dockers/docker-lldp-sv2/Dockerfile create mode 100644 dockers/docker-lldp-sv2/supervisord.conf create mode 100644 dockers/docker-snmp-sv2/Dockerfile create mode 100644 dockers/docker-snmp-sv2/supervisord.conf diff --git a/dockers/docker-lldp-sv2/Dockerfile b/dockers/docker-lldp-sv2/Dockerfile new file mode 100644 index 000000000000..4933e6414993 --- /dev/null +++ b/dockers/docker-lldp-sv2/Dockerfile @@ -0,0 +1,22 @@ +FROM docker-base + +COPY deps/sswsdk*.whl deps/sonic_d*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ + +## Pre-install the fundamental packages +## Install Python SSWSDK (lldpsyncd dependency) +## Install LLDP Sync Daemon +## Note: dpkg_apt function has the benefit to detect missing .deb file +## Clean up +RUN apt-get update && \ + dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ + dpkg_apt /deps/lldpd_*.deb && \ + apt-get install -y python-pip supervisor && \ + pip install /deps/sswsdk*.whl && \ + pip install /deps/sonic_d*.whl && \ + apt-get remove -y python-pip && \ + apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ + rm -rf /deps ~/.cache + +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-lldp-sv2/supervisord.conf b/dockers/docker-lldp-sv2/supervisord.conf new file mode 100644 index 000000000000..4ed43f02b9bb --- /dev/null +++ b/dockers/docker-lldp-sv2/supervisord.conf @@ -0,0 +1,19 @@ +[supervisord] +nodaemon=true + +[program:lldpd] +# https://github.com/vincentbernat/lldpd/commit/9856f2792c301116cc4a3fcfba91b9672ee5db1f +# - `-d` means to stay in foreground, log to syslog +# - `-dd` means to stay in foreground, log warnings to console +# - `-ddd` means to stay in foreground, log warnings and info to console +# - `-dddd` means to stay in foreground, log all to console +command=/usr/sbin/lldpd -d -I Ethernet*,eth* +priority=100 + +[program:lldp-syncd] +command=/usr/bin/env python2 -m lldp_syncd +priority=200 + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=1 diff --git a/dockers/docker-lldp/Dockerfile b/dockers/docker-lldp/Dockerfile index 6167a735f7d0..528ac65a4080 100644 --- a/dockers/docker-lldp/Dockerfile +++ b/dockers/docker-lldp/Dockerfile @@ -1,20 +1,21 @@ FROM docker-base -COPY deps/*py2*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ +COPY deps/sswsdk*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ ## Pre-install the fundamental packages -## Install Python SSWSDK (lldpsyncd dependancy) +## Install Python SSWSDK (lldpsyncd dependency) ## Install LLDP Sync Daemon ## Note: dpkg_apt function has the benefit to detect missing .deb file ## Clean up -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ - dpkg_apt /deps/lldpd_*.deb && \ - dpkg_apt /deps/lldpsyncd_*.deb && \ +RUN apt-get update && \ + dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ + dpkg_apt /deps/lldpd_*.deb && \ + dpkg_apt /deps/lldpsyncd_*.deb && \ apt-get install -y python-pip supervisor && \ - pip install /deps/*.whl && \ + pip install /deps/sswsdk*.whl && \ apt-get remove -y python-pip && \ - apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ - rm -rf /deps + apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ + rm -rf /deps ~/.cache COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf diff --git a/dockers/docker-lldp/supervisord.conf b/dockers/docker-lldp/supervisord.conf index 161c0ab38a2b..faff70ed06fa 100644 --- a/dockers/docker-lldp/supervisord.conf +++ b/dockers/docker-lldp/supervisord.conf @@ -2,15 +2,18 @@ nodaemon=true [program:lldpd] -## -d: Do not daemonize. If this option is specified, lldpd will run in -## the foreground and log to stderr. This option can be specified -## many times to increase verbosity -command=/usr/sbin/lldpd -dd -## route stderr to the syslog service instead of being saved to files -stderr_logfile=syslog +# https://github.com/vincentbernat/lldpd/commit/9856f2792c301116cc4a3fcfba91b9672ee5db1f +# - `-d` means to stay in foreground, log to syslog +# - `-dd` means to stay in foreground, log warnings to console +# - `-ddd` means to stay in foreground, log warnings and info to console +# - `-dddd` means to stay in foreground, log all to console +command=/usr/sbin/lldpd -d -I Ethernet*,eth* +priority=100 [program:lldpsyncd] command=/usr/sbin/lldpsyncd +priority=200 [program:rsyslogd] command=/usr/sbin/rsyslogd -n +priority=1 diff --git a/dockers/docker-snmp-sv2/Dockerfile b/dockers/docker-snmp-sv2/Dockerfile new file mode 100644 index 000000000000..68a2ae0e7f25 --- /dev/null +++ b/dockers/docker-snmp-sv2/Dockerfile @@ -0,0 +1,46 @@ +FROM docker-base + +COPY deps/snmp_*.deb deps/snmpd_*.deb deps/libsnmp-base_*.deb deps/libsnmp30_*.deb /deps/ +COPY deps/python3/*.whl /python3/ + +# enable -O for all Python calls +ENV PYTHONOPTIMIZE 1 + +## Pre-install the fundamental packages +## Install Python SSWSDK (SNMP subagent dependency) +## Install SNMP subagent +## Note: dpkg_apt function has the benefit to detect missing .deb file +## Clean up +RUN apt-get update && \ + dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ + dpkg_apt /deps/libsnmp-base_*.deb && \ + dpkg_apt /deps/libsnmp30_*.deb && \ + dpkg_apt /deps/snmp_*.deb && \ + dpkg_apt /deps/snmpd_*.deb && \ + rm -rf /deps + +# install subagent +RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ + rm -rf /var/lib/apt/lists/* && \ + wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz && \ + tar xvf Python-3.5.2.tgz && cd Python-3.5.2 && \ + ./configure --without-doc-strings --prefix=/usr --without-pymalloc --enable-shared && \ + make && make install && \ + ldconfig && \ + cd .. && rm -rf Python-3.5.2 && rm Python-3.5.2.tgz && \ + pip3 install --no-cache-dir /python3/*py3*.whl hiredis && \ + rm -rf /python3 && \ + python3 -m sonic_ax_impl install && \ + python3 -m pip uninstall -y pip setuptools && \ + /bin/bash -c "rm -rf /usr/lib/python3.5/{unittest,lib2to3,tkinter,idlelib,email,test}" && \ + apt-get -y purge build-essential wget libssl-dev openssl && \ + apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ + find / | grep -E "__pycache__" | xargs rm -rf && \ + rm -rf ~/.cache + +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +## Although exposing ports is not need for host net mode, keep it for possible bridge mode +EXPOSE 161/udp 162/udp + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf new file mode 100644 index 000000000000..50b510063d75 --- /dev/null +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -0,0 +1,14 @@ +[supervisord] +nodaemon=true + +[program:snmpd] +command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable -p /run/snmpd.pid +priority=100 + +[program:snmp-subagent] +command=/usr/bin/env python3 -m sonic_ax_impl +priority=200 + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=1 diff --git a/dockers/docker-snmp/Dockerfile b/dockers/docker-snmp/Dockerfile index ad08f754a423..29bad3d746b4 100644 --- a/dockers/docker-snmp/Dockerfile +++ b/dockers/docker-snmp/Dockerfile @@ -7,15 +7,16 @@ COPY deps/python3/*.whl /python3/ ENV PYTHONOPTIMIZE 1 ## Pre-install the fundamental packages -## Install Python SSWSDK (SNMP subagent dependancy) +## Install Python SSWSDK (SNMP subagent dependency) ## Install SNMP subagent ## Note: dpkg_apt function has the benefit to detect missing .deb file ## Clean up -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ +RUN apt-get update && \ + dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ dpkg_apt /deps/libsnmp-base_*.deb && \ dpkg_apt /deps/libsnmp30_*.deb && \ dpkg_apt /deps/snmp_*.deb && \ - dpkg_apt /deps/snmpd_*.deb && \ + dpkg_apt /deps/snmpd_*.deb && \ rm -rf /deps # install subagent @@ -29,13 +30,9 @@ RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ cd .. && rm -rf Python-3.5.2 && rm Python-3.5.2.tgz && \ pip3 install --no-cache-dir /python3/*py3*.whl hiredis && \ rm -rf /python3 && \ + python3 -m acs_ax_impl install && \ python3 -m pip uninstall -y pip setuptools && \ - rm -rf /usr/lib/python3.5/unittest && \ - rm -rf /usr/lib/python3.5/lib2to3 && \ - rm -rf /usr/lib/python3.5/tkinter && \ - rm -rf /usr/lib/python3.5/idlelib && \ - rm -rf /usr/lib/python3.5/email && \ - rm -rf /usr/lib/python3.5/test && \ + /bin/bash -c "rm -rf /usr/lib/python3.5/{unittest,lib2to3,tkinter,idlelib,email,test}" && \ apt-get -y purge build-essential wget libssl-dev openssl && \ apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ find / | grep -E "__pycache__" | xargs rm -rf && \ diff --git a/dockers/docker-snmp/supervisord.conf b/dockers/docker-snmp/supervisord.conf index f799d33d97aa..c954add628d0 100644 --- a/dockers/docker-snmp/supervisord.conf +++ b/dockers/docker-snmp/supervisord.conf @@ -3,9 +3,12 @@ nodaemon=true [program:snmpd] command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable -p /run/snmpd.pid +priority=100 [program:acs-snmp-subagent] command=/usr/bin/env python3 -m acs_ax_impl +priority=200 [program:rsyslogd] command=/usr/sbin/rsyslogd -n +priority=1 From b2322d17485e5a5eb09677615af0921644ea9efb Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 28 Oct 2016 15:16:08 -0700 Subject: [PATCH 0056/1833] Modification to saiserver-brcm/Dockerfile (#45) --- dockers/docker-saiserver-brcm/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dockers/docker-saiserver-brcm/Dockerfile b/dockers/docker-saiserver-brcm/Dockerfile index a85e7023204e..054da7866fbf 100755 --- a/dockers/docker-saiserver-brcm/Dockerfile +++ b/dockers/docker-saiserver-brcm/Dockerfile @@ -2,7 +2,7 @@ FROM docker-base RUN apt-get update -COPY ["/deps/libsaibcm*.deb","/deps/libopennsl_*.deb","/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/libthrift-0.9.3_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"] +COPY ["deps/libsaibcm_*.deb","deps/libopennsl_*.deb","deps/python-sdk-api_*.deb", "deps/iproute2_*.deb", "deps/libthrift-0.9.3_*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ dpkg_apt /deps/libopennsl_*.deb \ @@ -17,8 +17,7 @@ COPY ["deps/saiserver", "start.sh", "/usr/bin/"] COPY ["profile.ini", "portmap.ini", "/etc/sai/"] ## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; rm -rf /deps ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] From 076c847bf89bcf7eab7d3fd2ce5c754c89ed8f92 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Sat, 29 Oct 2016 19:38:31 -0700 Subject: [PATCH 0057/1833] Update get_docker-base.sh (#47) --- get_docker-base.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get_docker-base.sh b/get_docker-base.sh index 088b6bf46b29..b85ab4166104 100755 --- a/get_docker-base.sh +++ b/get_docker-base.sh @@ -10,7 +10,7 @@ set -x -e . ./functions.sh ## [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Read-only link of Azure Blob storage with shared access signature (SAS)")] -BASE_URL="https://sonicstorage.blob.core.windows.net/packages/docker-base.ea507753d98b0769e2a15be13003331f8ad38d1c15b40a683e05fc53b1463b10.gz?sv=2015-04-05&sr=b&sig=DjbdpLaslHeiaZLwFuauhPA2wR0v7kOH5yPHiAbzgBc%3D&se=2016-10-28T13%3A04%3A23Z&sp=r" +BASE_URL="https://sonicstorage.blob.core.windows.net/packages/docker-base.ea507753d98b0769e2a15be13003331f8ad38d1c15b40a683e05fc53b1463b10.gz?sv=2015-04-05&sr=b&sig=YNN6eYVMEFndUaiHIRnqcZFdDZwIG%2BaAuVj0IoyDWPw%3D&se=2026-10-27T20%3A46%3A18Z&sp=r" base_image_name=docker-base docker_try_rmi $base_image_name From 73cbf6ccb243e007f9a8cf2f0ac1073321ce7209 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 31 Oct 2016 12:03:54 -0700 Subject: [PATCH 0058/1833] update swss, sairedis and swss-common submodules (#48) --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 59ec36035eb9..494b231a6658 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 59ec36035eb9fd0ff64d4977a2553380367f97ce +Subproject commit 494b231a6658a5b21b71e35ab0f078701e938742 diff --git a/src/sonic-swss b/src/sonic-swss index a025ab0019e7..02621bcdb568 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit a025ab0019e7c24bf4a22a0165a9d5b1ddecd528 +Subproject commit 02621bcdb5689450446ea0d618a879a110af86c7 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index e612cefd8890..947fa0733965 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit e612cefd889067f1cfa8c9a68a40a1abdac59433 +Subproject commit 947fa0733965450ad5b108cfd17a251ae3b7b709 From 30438bb9877fb8f374203446fad62dad4630a88d Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 31 Oct 2016 12:25:09 -0700 Subject: [PATCH 0059/1833] update port configurations in lldpd as soon as port created --- dockers/docker-lldp-sv2/Dockerfile | 1 + dockers/docker-lldp-sv2/reconfigure.sh | 58 ++++++++++++++++++++++++ dockers/docker-lldp-sv2/supervisord.conf | 4 ++ 3 files changed, 63 insertions(+) create mode 100755 dockers/docker-lldp-sv2/reconfigure.sh diff --git a/dockers/docker-lldp-sv2/Dockerfile b/dockers/docker-lldp-sv2/Dockerfile index 4933e6414993..0ad91cf70518 100644 --- a/dockers/docker-lldp-sv2/Dockerfile +++ b/dockers/docker-lldp-sv2/Dockerfile @@ -18,5 +18,6 @@ RUN apt-get update && \ rm -rf /deps ~/.cache COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY reconfigure.sh /opt/reconfigure.sh ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-lldp-sv2/reconfigure.sh b/dockers/docker-lldp-sv2/reconfigure.sh new file mode 100755 index 000000000000..e91c1c017534 --- /dev/null +++ b/dockers/docker-lldp-sv2/reconfigure.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +set -e + +num_of_interfaces=32 +if_step=4 +last_if_idx=$((num_of_interfaces*if_step - if_step)) + +function wait_until_if_exists +{ + while /bin/true ; + do + if [ -L /sys/class/net/"$if" ]; + then + break + fi + sleep 1 + done + echo interface "$if" is up +} + + +function wait_until_if_not_exists +{ + while /bin/true ; + do + if [ ! -L /sys/class/net/"$if" ]; + then + break + fi + sleep 1 + done + echo interface "$if" is down +} + + +while /bin/true ; +do + # wait until all interfaces are up + echo Wait until all ifaces are up + for i in $(seq 0 $if_step $last_if_idx) + do + if=Ethernet${i} + wait_until_if_exists + done + + # apply lldpd configuration + echo apply lldpd configuration + lldpcli -c /etc/lldpd.conf + + # wait until all interfaces are down + echo Wait until all ifaces are down + for i in $(seq 0 $if_step $last_if_idx) + do + if=Ethernet${i} + wait_until_if_not_exists + done +done diff --git a/dockers/docker-lldp-sv2/supervisord.conf b/dockers/docker-lldp-sv2/supervisord.conf index 4ed43f02b9bb..844348b471b6 100644 --- a/dockers/docker-lldp-sv2/supervisord.conf +++ b/dockers/docker-lldp-sv2/supervisord.conf @@ -10,6 +10,10 @@ nodaemon=true command=/usr/sbin/lldpd -d -I Ethernet*,eth* priority=100 +[program:lldpd-conf-reload] +command=/opt/reconfigure.sh +priority=150 + [program:lldp-syncd] command=/usr/bin/env python2 -m lldp_syncd priority=200 From 62af66a1f0bbc44c362fb7a6d917991aeab9d471 Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 31 Oct 2016 12:54:53 -0700 Subject: [PATCH 0060/1833] Add a pause before pushing port configuration --- dockers/docker-lldp-sv2/reconfigure.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-lldp-sv2/reconfigure.sh b/dockers/docker-lldp-sv2/reconfigure.sh index e91c1c017534..11c83bad079f 100755 --- a/dockers/docker-lldp-sv2/reconfigure.sh +++ b/dockers/docker-lldp-sv2/reconfigure.sh @@ -44,6 +44,9 @@ do wait_until_if_exists done + echo Wait 10 seconds + sleep 10 + # apply lldpd configuration echo apply lldpd configuration lldpcli -c /etc/lldpd.conf From ac64c1c29b86c6068377078d5033d070ddee9c5a Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 31 Oct 2016 13:56:45 -0700 Subject: [PATCH 0061/1833] Address CR suggestions --- dockers/docker-lldp-sv2/reconfigure.sh | 34 ++++++++++---------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/dockers/docker-lldp-sv2/reconfigure.sh b/dockers/docker-lldp-sv2/reconfigure.sh index 11c83bad079f..9f42a33a24b4 100755 --- a/dockers/docker-lldp-sv2/reconfigure.sh +++ b/dockers/docker-lldp-sv2/reconfigure.sh @@ -8,54 +8,46 @@ last_if_idx=$((num_of_interfaces*if_step - if_step)) function wait_until_if_exists { - while /bin/true ; + if=$1 + while [ ! -L /sys/class/net/"$if" ] ; do - if [ -L /sys/class/net/"$if" ]; - then - break - fi sleep 1 done - echo interface "$if" is up + echo interface "$if" is created } function wait_until_if_not_exists { - while /bin/true ; + if=$1 + while [ -L /sys/class/net/"$if" ] ; do - if [ ! -L /sys/class/net/"$if" ]; - then - break - fi sleep 1 done - echo interface "$if" is down + echo interface "$if" is destroyed } while /bin/true ; do - # wait until all interfaces are up - echo Wait until all ifaces are up + # wait until all interfaces are created + echo Wait until all ifaces are created for i in $(seq 0 $if_step $last_if_idx) do - if=Ethernet${i} - wait_until_if_exists + wait_until_if_exists "Ethernet$i" done - echo Wait 10 seconds + echo Wait 10 seconds while lldpd finds new interfaces sleep 10 # apply lldpd configuration echo apply lldpd configuration lldpcli -c /etc/lldpd.conf - # wait until all interfaces are down - echo Wait until all ifaces are down + # wait until all interfaces are destroyed + echo Wait until all ifaces are destroyed for i in $(seq 0 $if_step $last_if_idx) do - if=Ethernet${i} - wait_until_if_not_exists + wait_until_if_not_exists "Ethernet$i" done done From e89c7be76ded4ff694eb0ed41df96cacbc76c1fd Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 31 Oct 2016 21:50:59 -0700 Subject: [PATCH 0062/1833] Install redis-server>=3.2.4 in docker-database image (#46) * Install redis-server>=3.2.4 * Reformat * Build redis from source code * Add Makefile var: REDIS_VERSION --- Makefile | 33 ++++++++++++++++++------------ dockers/docker-database/Dockerfile | 11 ++++++---- src/Makefile | 8 +++++--- src/redis/build.sh | 13 +++++------- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 03a67bde0937..fc48ee3294e5 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ USERNAME= PASSWORD_ENCRYPTED= +## Redis server/tools version +REDIS_VERSION=3.2.4-1~bpo8+1_amd64 + ## Select bash for commands SHELL := /bin/bash @@ -22,14 +25,14 @@ define build_docker mkdir -p `dirname $(2)` docker save $(1) | gzip -c > $(2) endef - + ## Rules: phony targets .phony : brcm-all mlnx-all cavm-all p4-all ## Rules: redirect to sub directory src/%: - $(MAKE) -C src $(subst src/,,$@) - + $(MAKE) REDIS_VERSION=$(REDIS_VERSION) -C src $(subst src/,,$@) + ## Rules: docker-fpm dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd mkdir -p `dirname $@` && cp $< $(dir $@) @@ -41,13 +44,13 @@ dockers/docker-team/deps/teamsyncd: src/teamsyncd mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-team/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) - + ## Rules: docker-orchagent-mlnx $(addprefix dockers/docker-orchagent-mlnx/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent-mlnx/deps/%.deb : src/mlnx/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent-mlnx/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) - + ## Rules: docker-orchagent-cavm $(addprefix dockers/docker-orchagent-cavm/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent-cavm/deps/%.deb : src/cavm/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) @@ -59,7 +62,7 @@ $(addprefix dockers/docker-orchagent/deps/,libsairedis_1.0.0_amd64.deb libsaimet mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) - + ## Rules: docker-syncd-mlnx $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) @@ -86,6 +89,10 @@ $(addprefix dockers/docker-syncd/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_a dockers/docker-syncd/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) +## Rules: docker-database +dockers/docker-database/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) + ## Rules: docker-sonic (p4) $(addprefix dockers/docker-sonic-p4/deps/,swss_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-sonic-p4/deps/%.deb : src/p4/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) @@ -101,7 +108,7 @@ target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/d touch dockers/docker-syncd/deps/{dsserve,bcmcmd} docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - + target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) dockers/docker-syncd-mlnx/deps/fw-SPC.mfa docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) @@ -109,11 +116,11 @@ target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-sy target/docker-syncd-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - + target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - + target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) @@ -121,7 +128,7 @@ target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docke target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - + target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb fpmsyncd) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) @@ -129,12 +136,12 @@ target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/ target/docker-team.gz: target/docker-base.gz $(addprefix dockers/docker-team/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb $(LIBTEAM-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-database.gz: target/docker-base.gz + +target/docker-database.gz: target/docker-base.gz $(addprefix dockers/docker-database/deps/,redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb) +target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) diff --git a/dockers/docker-database/Dockerfile b/dockers/docker-database/Dockerfile index 4499f4a8f8fa..2014cd8919f0 100755 --- a/dockers/docker-database/Dockerfile +++ b/dockers/docker-database/Dockerfile @@ -1,10 +1,13 @@ FROM docker-base -## Pre-install the fundamental packages +COPY ["deps/redis-tools_*.deb", "deps/redis-server_*.deb", "/deps/"] + +## Install packages ## Clean up -RUN apt-get -y install \ - redis-server \ - && \ +RUN apt-get update && \ + dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/redis-tools_*.deb && \ + dpkg_apt /deps/redis-server_*.deb && \ apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y RUN sed -ri 's/^daemonize yes$/daemonize no/' /etc/redis/redis.conf \ diff --git a/src/Makefile b/src/Makefile index 0fc5aff8c3c2..e9f415e272ac 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,6 +3,8 @@ .ONESHELL: SHELL := /bin/bash +REDIS_VERSION=3.2.4-1~bpo8+1_amd64 + ## Function: build_project, directory ## Build the project and save the .deb target in the same directory ## TRICK: clean dh state so it will force recreating .deb later @@ -25,10 +27,10 @@ libnl-%.deb: libteam5_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb: libnl-%.deb pushd libteam; ./build.sh; popd -redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0.7-2_amd64.deb: +redis-sentinel_$(REDIS_VERSION).deb redis-$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb: pushd redis; ./build.sh; popd -libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb redis-sentinel_3.0.7-2_amd64.deb +libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb redis-sentinel_$(REDIS_VERSION).deb pushd hiredis; ./build.sh; popd libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb thrift-compiler_0.9.3-2_amd64.deb: @@ -58,7 +60,7 @@ p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3 quagga_0.99.24.1-2.1_amd64.deb: $(call build_project, sonic-quagga) -libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_3.0.7-2_amd64.deb redis-tools_3.0.7-2_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb +libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss-common) diff --git a/src/redis/build.sh b/src/redis/build.sh index 44f3e06018cb..9ff33de6d137 100755 --- a/src/redis/build.sh +++ b/src/redis/build.sh @@ -1,14 +1,11 @@ #!/bin/bash -x -export REDIS_DOWNLOAD_URL=http://http.debian.net/debian/pool/main/r/redis/redis_3.0.7.orig.tar.gz -export REDIS_PACKAGING_URL=http://http.debian.net/debian/pool/main/r/redis/redis_3.0.7-2.debian.tar.xz +wget -N 'http://mirrors.accretive-networks.net/debian/pool/main/r/redis/redis_3.2.4.orig.tar.gz' +wget -N 'http://mirrors.accretive-networks.net/debian/pool/main/r/redis/redis_3.2.4-1~bpo8+1.dsc' +wget -N 'http://mirrors.accretive-networks.net/debian/pool/main/r/redis/redis_3.2.4-1~bpo8+1.debian.tar.xz' -wget -O redis_3.0.7-2.dsc 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7-2.dsc?sv=2015-04-05&sr=b&sig=evQtsWTIUFlgWbzLLifS1lDgop%2BzlqIP8ehZl3p%2FCKI%3D&se=2026-07-24T01%3A48%3A19Z&sp=r' -wget -O redis_3.0.7.orig.tar.gz 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7.orig.tar.gz?sv=2015-04-05&sr=b&sig=0ht16%2Fi8%2FPZQHp1PrDPYW0iRwcLfUPw1JpKUapizu8o%3D&se=2026-07-24T01%3A48%3A49Z&sp=r' -wget -O redis_3.0.7-2.debian.tar.xz 'https://sonicstorage.blob.core.windows.net/packages/redis_3.0.7-2.debian.tar.xz?sv=2015-04-05&sr=b&sig=4a33ECTvURfNUEDkS436ZlSsIpLIC9QdJrBBRIoWpW0%3D&se=2026-07-24T01%3A49%3A22Z&sp=r' +dpkg-source -x redis_3.2.4-1~bpo8+1.dsc -dpkg-source -x redis_3.0.7-2.dsc - -pushd redis-3.0.7; fakeroot debian/rules binary; popd +pushd redis-3.2.4; fakeroot debian/rules binary; popd cp *.deb .. From 68363e17a012f66ec05f1e45bf69211d487ec00b Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 1 Nov 2016 07:39:08 -0700 Subject: [PATCH 0063/1833] bug fix: fix the redis-server deb package name (#50) --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index e9f415e272ac..f44691d3899c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -27,7 +27,7 @@ libnl-%.deb: libteam5_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb: libnl-%.deb pushd libteam; ./build.sh; popd -redis-sentinel_$(REDIS_VERSION).deb redis-$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb: +redis-sentinel_$(REDIS_VERSION).deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb: pushd redis; ./build.sh; popd libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb redis-sentinel_$(REDIS_VERSION).deb From 530d2ac202cc0277d99a629cdd29ae08ca802d38 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 2 Nov 2016 16:26:24 +0200 Subject: [PATCH 0064/1833] update sonic-linux-kernel submodule (#52) Signed-off-by: marian-pritsak --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 206a8936a7af..fbd5604bf748 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 206a8936a7af2fdc30101c64be42dd2dadde0dad +Subproject commit fbd5604bf7480bd6f861ad35acd5ec41bb4dd067 From afab1ae4eec955dbd90936fa774307bad763d9a9 Mon Sep 17 00:00:00 2001 From: jiacao Date: Wed, 2 Nov 2016 12:05:31 -0700 Subject: [PATCH 0065/1833] Fix Quagga build name inconsistency (#53) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fc48ee3294e5..01ac0f96942e 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,7 @@ target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docke docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb fpmsyncd) +target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2.1_amd64.deb fpmsyncd) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) @@ -141,7 +141,7 @@ target/docker-database.gz: target/docker-base.gz $(addprefix dockers/docker-data docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb) +target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2.1_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) From aed2ab5b7af738fdea5df804ced10510dba38e08 Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Tue, 1 Nov 2016 17:00:54 -0700 Subject: [PATCH 0066/1833] Install supervisor to docker-ptf --- dockers/docker-syncd-mlnx-rpc/Dockerfile | 2 +- dockers/docker-syncd-rpc/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-syncd-mlnx-rpc/Dockerfile b/dockers/docker-syncd-mlnx-rpc/Dockerfile index ca68b8a29304..734171ffb3e0 100644 --- a/dockers/docker-syncd-mlnx-rpc/Dockerfile +++ b/dockers/docker-syncd-mlnx-rpc/Dockerfile @@ -16,6 +16,7 @@ RUN apt-get update \ python-dev \ wget \ cmake \ + supervisor \ && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && tar xvfz 1.0.0.tar.gz \ && cd nanomsg-1.0.0 \ @@ -44,5 +45,4 @@ COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf ENTRYPOINT service rsyslog start \ && service syncd start \ - && while [ "x$( ifconfig Ethernet12 | grep RUNNING )" = 'x' ] ; do sleep 1 ; done \ && /usr/bin/supervisord diff --git a/dockers/docker-syncd-rpc/Dockerfile b/dockers/docker-syncd-rpc/Dockerfile index e7f6912746fe..28108a82582c 100644 --- a/dockers/docker-syncd-rpc/Dockerfile +++ b/dockers/docker-syncd-rpc/Dockerfile @@ -16,6 +16,7 @@ RUN apt-get update \ python-dev \ wget \ cmake \ + supervisor \ && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && tar xvfz 1.0.0.tar.gz \ && cd nanomsg-1.0.0 \ @@ -44,5 +45,4 @@ COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf ENTRYPOINT service rsyslog start \ && service syncd start \ - && while [ "x$( ifconfig Ethernet12 | grep RUNNING )" = 'x' ] ; do sleep 1 ; done \ && /usr/bin/supervisord From 2456860cd2d87f6817e9600fac86366662875ca4 Mon Sep 17 00:00:00 2001 From: jiacao Date: Wed, 2 Nov 2016 15:33:16 -0700 Subject: [PATCH 0067/1833] Add saimetadata-dev dependency (#55) --- src/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index f44691d3899c..cd33142ac829 100644 --- a/src/Makefile +++ b/src/Makefile @@ -89,7 +89,7 @@ p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0 cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb p4/ ## Note: fpmsyncd and teamsyncd are two implicit targets -brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb +brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb brcm/libsaimetadata-dev_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb brcm/ @@ -97,7 +97,7 @@ brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd cp sonic-swss/debian/swss/usr/bin/teamsyncd . ## Note: fpmsyncd and teamsyncd are two implicit targets -mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb +mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb mlnx/ @@ -105,14 +105,14 @@ mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd cp sonic-swss/debian/swss/usr/bin/teamsyncd . ## Note: fpmsyncd and teamsyncd are two implicit targets -cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb +cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb cavm/libsaimetadata-dev_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb cavm/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . cp sonic-swss/debian/swss/usr/bin/teamsyncd . -p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb +p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb p4/ From 0f10cd4a4d7700a3cacac3e4be1e4b759d01a93c Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Thu, 3 Nov 2016 19:22:59 +0200 Subject: [PATCH 0068/1833] Update Makefile to fix to swss package compilation (#57) Add dependency to libteam for swss package to fix compilation issue. --- src/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index cd33142ac829..1f277fbaeb36 100644 --- a/src/Makefile +++ b/src/Makefile @@ -89,7 +89,7 @@ p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0 cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb p4/ ## Note: fpmsyncd and teamsyncd are two implicit targets -brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb brcm/libsaimetadata-dev_1.0.0_amd64.deb +brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb brcm/libsaimetadata-dev_1.0.0_amd64.deb libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb brcm/ @@ -97,7 +97,7 @@ brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd cp sonic-swss/debian/swss/usr/bin/teamsyncd . ## Note: fpmsyncd and teamsyncd are two implicit targets -mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb +mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb mlnx/ @@ -105,14 +105,14 @@ mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd cp sonic-swss/debian/swss/usr/bin/teamsyncd . ## Note: fpmsyncd and teamsyncd are two implicit targets -cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb cavm/libsaimetadata-dev_1.0.0_amd64.deb +cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb cavm/libsaimetadata-dev_1.0.0_amd64.deb libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb cavm/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . cp sonic-swss/debian/swss/usr/bin/teamsyncd . -p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb +p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb p4/ From 5405b576e61a1cce0cc1b048a6385fd291c73482 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 3 Nov 2016 12:15:00 -0700 Subject: [PATCH 0069/1833] build_debian: Disable IPv6 DAD (#56) This change disables DAD (IPv6's Duplicate Address Detection). DAD protects against IP address conflicts. The way it works is that after an address is added to an interface, the operating system uses the Neighbor Discovery Protocol to check if any other host on the network has the same address. If it finds a neighbor with the same address, the address is removed from the interface. The problem here is that the time waiting for DAD to be done is fairly long and because that we set the host interface operating status to be down at first, the port cannot exchange the Neighbor Discovery Protocol and DAD will time out. The host interface is only brought up after we have received the port admin status up notification from the kernel, which happens only after the DAD is done or times out. This makes the whole host interfaces bringing up procedure very slow. This the DAD is disabled. When it is disabled, addresses are immediately usable. Without DAD, we need to make sure that the IPv6 addresses don't have conflicts. For now, we have two IPv6 addresses. One is assigned manually, which prevents conflicts at first. Another one is the IPv6 link-local address. It is derived from the MAC address and thus all the link-local addresses are the same on one box. Because link-local addresses are not used, it will not trigger issues even if they are the same. --- build_debian.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index 304b474e9a60..e231242ce489 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -203,11 +203,13 @@ set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_announce 0 set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_filter 0 set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_notify 0 set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_ignore 0 +set /files/etc/sysctl.conf/net.ipv6.conf.default.accept_dad 0 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_accept 0 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_announce 1 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_filter 0 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_notify 1 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_ignore 2 +set /files/etc/sysctl.conf/net.ipv6.conf.all.accept_dad 0 " -r $FILESYSTEM_ROOT ## docker-py is needed by Ansible docker module From ce895ee22844df7c658b8acf09937559b413a189 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 3 Nov 2016 14:11:11 -0700 Subject: [PATCH 0070/1833] Add ptf docker with saithrift installed (#58) --- dockers/docker-ptf-saithrift/Dockerfile | 12 +++++++ .../brcm_interface_to_front_map.ini | 33 +++++++++++++++++++ .../msn_2700_interface_to_front_map.ini | 33 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 dockers/docker-ptf-saithrift/Dockerfile create mode 100644 dockers/docker-ptf-saithrift/brcm_interface_to_front_map.ini create mode 100644 dockers/docker-ptf-saithrift/msn_2700_interface_to_front_map.ini diff --git a/dockers/docker-ptf-saithrift/Dockerfile b/dockers/docker-ptf-saithrift/Dockerfile new file mode 100644 index 000000000000..88176faffb5f --- /dev/null +++ b/dockers/docker-ptf-saithrift/Dockerfile @@ -0,0 +1,12 @@ +FROM docker-ptf + +RUN apt-get update + +COPY ["deps/saithrift-0.9.tar.gz", "/deps/"] +COPY ["*.ini", "/etc/ptf/"] +COPY ["deps/SAI/test/saithrift/tests/*", "/usr/share/ptf-tests/"] + +RUN tar xzf /deps/saithrift-0.9.tar.gz -C /usr/share/; \ + cd usr/share/saithrift-0.9; \ + python setup.py install; \ + rm -rf /deps diff --git a/dockers/docker-ptf-saithrift/brcm_interface_to_front_map.ini b/dockers/docker-ptf-saithrift/brcm_interface_to_front_map.ini new file mode 100644 index 000000000000..0db110025b8a --- /dev/null +++ b/dockers/docker-ptf-saithrift/brcm_interface_to_front_map.ini @@ -0,0 +1,33 @@ +# ptf host interface @ switch front port name +0@Ethernet0 +1@Ethernet4 +2@Ethernet8 +3@Ethernet12 +4@Ethernet16 +5@Ethernet20 +6@Ethernet24 +7@Ethernet28 +8@Ethernet32 +9@Ethernet36 +10@Ethernet40 +11@Ethernet44 +12@Ethernet48 +13@Ethernet52 +14@Ethernet56 +15@Ethernet60 +16@Ethernet64 +17@Ethernet68 +18@Ethernet72 +19@Ethernet76 +20@Ethernet80 +21@Ethernet84 +22@Ethernet88 +23@Ethernet92 +24@Ethernet96 +25@Ethernet100 +26@Ethernet104 +27@Ethernet108 +28@Ethernet112 +29@Ethernet116 +30@Ethernet120 +31@Ethernet124 diff --git a/dockers/docker-ptf-saithrift/msn_2700_interface_to_front_map.ini b/dockers/docker-ptf-saithrift/msn_2700_interface_to_front_map.ini new file mode 100644 index 000000000000..4421812aeef9 --- /dev/null +++ b/dockers/docker-ptf-saithrift/msn_2700_interface_to_front_map.ini @@ -0,0 +1,33 @@ +# ptf host interface @ switch front port name +0@Ethernet1 +1@Ethernet2 +2@Ethernet3 +3@Ethernet4 +4@Ethernet5 +5@Ethernet6 +6@Ethernet7 +7@Ethernet8 +8@Ethernet9 +9@Ethernet10 +10@Ethernet11 +11@Ethernet12 +12@Ethernet13 +13@Ethernet14 +14@Ethernet15 +15@Ethernet16 +16@Ethernet17 +17@Ethernet18 +18@Ethernet19 +19@Ethernet20 +20@Ethernet21 +21@Ethernet22 +22@Ethernet23 +23@Ethernet24 +24@Ethernet25 +25@Ethernet26 +26@Ethernet27 +27@Ethernet28 +28@Ethernet29 +29@Ethernet30 +30@Ethernet31 +31@Ethernet32 From 0b80c625c42e66e4ea4164a513e5d4a663dcb7c6 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 4 Nov 2016 19:17:12 +0200 Subject: [PATCH 0071/1833] Fix issue with team docker build (#59) Added required docker-team dependency to Makefile to copy dep packages to dockers/docker-team/deps/ directory. Changed order of deb packages installation to fix dependency issue. --- Makefile | 2 +- dockers/docker-team/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 01ac0f96942e..3af2d859096c 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/ docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-team.gz: target/docker-base.gz $(addprefix dockers/docker-team/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb $(LIBTEAM-DEBS)) +target/docker-team.gz: target/docker-base.gz $(addprefix dockers/docker-team/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb $(LIBNL-DEBS) libnl-cli-3-200_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb $(LIBTEAM-DEBS) teamsyncd) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) diff --git a/dockers/docker-team/Dockerfile b/dockers/docker-team/Dockerfile index 885b99674b85..345b671c7d56 100644 --- a/dockers/docker-team/Dockerfile +++ b/dockers/docker-team/Dockerfile @@ -10,9 +10,9 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/libnl-nf-3-200_*.deb \ && dpkg_apt /deps/libnl-cli-3-200_*.deb \ && dpkg_apt /deps/libteam5_*.deb \ - && dpkg_apt /deps/libteam-dev_*.deb \ && dpkg_apt /deps/libteam-utils_*.deb \ && dpkg_apt /deps/libteamdctl0_*.deb \ + && dpkg_apt /deps/libteam-dev_*.deb \ && dpkg_apt /deps/libhiredis0.13_*.deb \ && dpkg_apt /deps/libswsscommon_*.deb From 27cddbcb62258b02cbf49be8b877da9a2ad1f995 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 4 Nov 2016 19:47:36 -0700 Subject: [PATCH 0072/1833] build_debian: Enable IPv6 forwarding (#60) Router behavior is assumed. 1. IsRouter flag is set in Neighbor Advertisements 2. Router Solicitations are not sent. 3. Router Advertisements are ignored. 4. Redirects are ignored. ref: http://mirrors.deepspace6.net/Linux+IPv6-HOWTO/proc-sys-net-ipv6..html --- build_debian.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index e231242ce489..1027a00b2437 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -198,17 +198,27 @@ sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTE sudo mkdir -p $FILESYSTEM_ROOT/var/core sudo augtool --autosave " set /files/etc/sysctl.conf/kernel.core_pattern '|/usr/bin/coredump-compress %e %p' + +set /files/etc/sysctl.conf/net.ipv4.conf.default.forwarding 1 +set /files/etc/sysctl.conf/net.ipv4.conf.all.forwarding 1 +set /files/etc/sysctl.conf/net.ipv4.conf.eth0.forwarding 0 + set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_accept 0 set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_announce 0 set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_filter 0 set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_notify 0 set /files/etc/sysctl.conf/net.ipv4.conf.default.arp_ignore 0 -set /files/etc/sysctl.conf/net.ipv6.conf.default.accept_dad 0 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_accept 0 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_announce 1 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_filter 0 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_notify 1 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_ignore 2 + +set /files/etc/sysctl.conf/net.ipv6.conf.default.forwarding 1 +set /files/etc/sysctl.conf/net.ipv6.conf.all.forwarding 1 +set /files/etc/sysctl.conf/net.ipv6.conf.eth0.forwarding 0 + +set /files/etc/sysctl.conf/net.ipv6.conf.default.accept_dad 0 set /files/etc/sysctl.conf/net.ipv6.conf.all.accept_dad 0 " -r $FILESYSTEM_ROOT From 0d10feca1163b663cb87dd0ec23f9cb5091cf9c4 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Mon, 7 Nov 2016 18:57:59 +0200 Subject: [PATCH 0073/1833] Added libteam5 package to orchagent docker to resolve instalation dependencies. (#62) --- Makefile | 4 ++-- dockers/docker-orchagent/Dockerfile | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3af2d859096c..87465c04562a 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ MLNX-SDK-DEBS=$(notdir $(wildcard src/mlnx-sdk/*.deb)) BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb)) CAVM-SDK-DEBS=$(notdir $(wildcard src/cavm-sdk/*.deb)) -LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb +LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb libnl-cli-3-200_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb ## Function: build_docker, image_name save_file @@ -133,7 +133,7 @@ target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/ docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-team.gz: target/docker-base.gz $(addprefix dockers/docker-team/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb $(LIBNL-DEBS) libnl-cli-3-200_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb $(LIBTEAM-DEBS) teamsyncd) +target/docker-team.gz: target/docker-base.gz $(addprefix dockers/docker-team/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS) teamsyncd) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) diff --git a/dockers/docker-orchagent/Dockerfile b/dockers/docker-orchagent/Dockerfile index 311fba152a64..cc95cf0f7f0b 100755 --- a/dockers/docker-orchagent/Dockerfile +++ b/dockers/docker-orchagent/Dockerfile @@ -2,16 +2,19 @@ FROM docker-base RUN apt-get update -COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/swss_*.deb", "/deps/"] +COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libnl-cli-3-200_*.deb", "deps/libnl-nf-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/libteam5_*.deb", "deps/swss_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ dpkg_apt /deps/libhiredis0.13*.deb \ && dpkg_apt /deps/libnl-3-200_*.deb \ && dpkg_apt /deps/libnl-genl-3-200_*.deb \ && dpkg_apt /deps/libnl-route-3-200_*.deb \ + && dpkg_apt /deps/libnl-nf-3-200_*.deb \ + && dpkg_apt /deps/libnl-cli-3-200_*.deb \ && dpkg_apt /deps/libswsscommon_*.deb \ && dpkg_apt /deps/libsairedis_*.deb \ - && dpkg_apt /deps/libsaimetadata_*.deb \ + && dpkg_apt /deps/libsaimetadata_*.deb \ + && dpkg_apt /deps/libteam5_*.deb \ && dpkg_apt /deps/swss_*.deb RUN apt-get install -f -y ifupdown bridge-utils redis-tools From 81d6382321ad7bbe21f4590c7a77c20388f375a3 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 8 Nov 2016 03:04:52 -0800 Subject: [PATCH 0074/1833] use seperate sources.list for debian base image build (#61) --- build_debian.sh | 2 +- files/apt/sources.list | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 files/apt/sources.list diff --git a/build_debian.sh b/build_debian.sh index 1027a00b2437..367c5814fefb 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -90,7 +90,7 @@ trap_push clean_sys sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs ## Pointing apt to public apt mirrors and getting latest packages, needed for latest security updates -sudo cp dockers/docker-base/sources.list $FILESYSTEM_ROOT/etc/apt/ +sudo cp files/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ sudo cp files/apt/apt.conf.d/81norecommends $FILESYSTEM_ROOT/etc/apt/apt.conf.d/ sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'apt-mark auto `apt-mark showmanual`' diff --git a/files/apt/sources.list b/files/apt/sources.list new file mode 100644 index 000000000000..2ed195cff416 --- /dev/null +++ b/files/apt/sources.list @@ -0,0 +1,7 @@ +## Debian mirror on Microsoft Azure +## Ref: http://debian-archive.trafficmanager.net/ + +deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free +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 From 5c44521c5f5a6205379b52f9a290e69eb33e6945 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 9 Nov 2016 19:50:53 -0800 Subject: [PATCH 0075/1833] update asic firmware version to 13.1200.0116 --- dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh b/dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh index 2ef46685f801..81514f77b062 100755 --- a/dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh +++ b/dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh @@ -1,7 +1,7 @@ #!/bin/bash query_retry_count_max="10" -required_fw_version="13.1130.0010" +required_fw_version="13.1200.0116" fw_file=/etc/mlnx/fw-SPC.mfa run_or_fail() { From 75d7987dda21cc74789eb27747dc59b90c16a792 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 10 Nov 2016 14:41:29 -0800 Subject: [PATCH 0076/1833] Fix build: Makefile (#63) * Fix Makefile: libnl and libteam dependencies * Fix rule for docker-orchagent deps (brcm) * Install libteam libs by the right order --- Makefile | 12 ++++++++---- src/Makefile | 18 +++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 87465c04562a..528d483ddc35 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,8 @@ MLNX-SDK-DEBS=$(notdir $(wildcard src/mlnx-sdk/*.deb)) BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb)) CAVM-SDK-DEBS=$(notdir $(wildcard src/cavm-sdk/*.deb)) -LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb libnl-cli-3-200_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb -LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb +LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-3-dev_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-genl-3-dev_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb libnl-route-3-dev_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb libnl-nf-3-dev_3.2.27-1_amd64.deb libnl-cli-3-200_3.2.27-1_amd64.deb libnl-cli-3-dev_3.2.27-1_amd64.deb +LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb ## Function: build_docker, image_name save_file ## build a docker image and save to a file @@ -31,7 +31,11 @@ endef ## Rules: redirect to sub directory src/%: - $(MAKE) REDIS_VERSION=$(REDIS_VERSION) -C src $(subst src/,,$@) + $(MAKE) \ + REDIS_VERSION=$(REDIS_VERSION) \ + LIBNL-DEBS="$(LIBNL-DEBS)" \ + LIBTEAM-DEBS="$(LIBTEAM-DEBS)" \ + -C src $(subst src/,,$@) ## Rules: docker-fpm dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd @@ -58,7 +62,7 @@ dockers/docker-orchagent-cavm/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) ## Rules: docker-orchagent (brcm) -$(addprefix dockers/docker-orchagent/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent/deps/%.deb : src/%.deb +$(addprefix dockers/docker-orchagent/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent/deps/%.deb : src/brcm/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) dockers/docker-orchagent/deps/%.deb: src/%.deb mkdir -p `dirname $@` && cp $< $(dir $@) diff --git a/src/Makefile b/src/Makefile index 1f277fbaeb36..0dabdfcf617d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,6 +4,8 @@ SHELL := /bin/bash REDIS_VERSION=3.2.4-1~bpo8+1_amd64 +LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-3-dev_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-genl-3-dev_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb libnl-route-3-dev_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb libnl-nf-3-dev_3.2.27-1_amd64.deb libnl-cli-3-200_3.2.27-1_amd64.deb libnl-cli-3-dev_3.2.27-1_amd64.deb +LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb ## Function: build_project, directory ## Build the project and save the .deb target in the same directory @@ -21,16 +23,18 @@ install_deb = \ [ -f $(1) ] && { sudo dpkg -i $(1) || sudo apt-get -y install -f; } || return 1; ## Rules -libnl-%.deb: +$(LIBNL-DEBS): pushd libnl3; ./build.sh; popd -libteam5_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb: libnl-%.deb +$(LIBTEAM-DEBS): $(LIBNL-DEBS) + $(foreach dep, $^, $(call install_deb, $(dep))) pushd libteam; ./build.sh; popd redis-sentinel_$(REDIS_VERSION).deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb: pushd redis; ./build.sh; popd libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb redis-sentinel_$(REDIS_VERSION).deb + $(foreach dep, $^, $(call install_deb, $(dep))) pushd hiredis; ./build.sh; popd libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb thrift-compiler_0.9.3-2_amd64.deb: @@ -60,7 +64,7 @@ p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3 quagga_0.99.24.1-2.1_amd64.deb: $(call build_project, sonic-quagga) -libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb +libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb $(LIBNL-DEBS) $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss-common) @@ -89,7 +93,7 @@ p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0 cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb p4/ ## Note: fpmsyncd and teamsyncd are two implicit targets -brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb brcm/libsaimetadata-dev_1.0.0_amd64.deb libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb +brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb brcm/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS) $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb brcm/ @@ -97,7 +101,7 @@ brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd cp sonic-swss/debian/swss/usr/bin/teamsyncd . ## Note: fpmsyncd and teamsyncd are two implicit targets -mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb +mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS) $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb mlnx/ @@ -105,14 +109,14 @@ mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd cp sonic-swss/debian/swss/usr/bin/teamsyncd . ## Note: fpmsyncd and teamsyncd are two implicit targets -cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb cavm/libsaimetadata-dev_1.0.0_amd64.deb libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb +cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb cavm/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS) $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb cavm/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . cp sonic-swss/debian/swss/usr/bin/teamsyncd . -p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb +p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS) $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) cp swss_1.0.0_amd64.deb p4/ From f8524e74f5a582455d5fdfbb88776a2276a00e37 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 11 Nov 2016 12:09:25 -0800 Subject: [PATCH 0077/1833] Fix dependencies in Dockerfiles (#65) --- Makefile | 2 +- dockers/docker-fpm/Dockerfile | 13 ++++++++----- dockers/docker-syncd-cavm/Dockerfile | 21 ++++++++++++--------- dockers/docker-team/Dockerfile | 5 +---- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 528d483ddc35..f106a96137e9 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docke docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2.1_amd64.deb fpmsyncd) +target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2.1_amd64.deb fpmsyncd $(LIBNL-DEBS)) docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) diff --git a/dockers/docker-fpm/Dockerfile b/dockers/docker-fpm/Dockerfile index 287aba29ec82..ca5b811f1949 100755 --- a/dockers/docker-fpm/Dockerfile +++ b/dockers/docker-fpm/Dockerfile @@ -2,14 +2,17 @@ FROM docker-base RUN apt-get update -COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/quagga_*", "/deps/"] +COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/quagga_*", "/deps/"] ## Get fpmsyncd -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb - ## Get Quagga -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/libhiredis0.13*.deb \ + && dpkg_apt /deps/libnl-3-200_*.deb \ + && dpkg_apt /deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /deps/libnl-route-3-200_*.deb \ + && dpkg_apt /deps/libswsscommon_*.deb \ + && dpkg_apt /deps/quagga_*.deb COPY ["deps/fpmsyncd", "start.sh", "/usr/bin/"] diff --git a/dockers/docker-syncd-cavm/Dockerfile b/dockers/docker-syncd-cavm/Dockerfile index 3fdbf1f516b8..e8025011bb70 100755 --- a/dockers/docker-syncd-cavm/Dockerfile +++ b/dockers/docker-syncd-cavm/Dockerfile @@ -2,17 +2,20 @@ FROM docker-base RUN apt-get update -COPY ["deps/libhiredis0.13*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/syncd_*.deb", "deps/sai*.deb", "deps/libsai*.deb", "deps/xp-tools*.deb", "deps/xpshell*.deb", "/deps/"] +COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/syncd_*.deb", "deps/sai*.deb", "deps/libsai*.deb", "deps/xp-tools*.deb", "deps/xpshell*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/libhiredis0.13*.deb \ - && dpkg_apt /deps/libswsscommon_*.deb \ - && dpkg_apt /deps/sai*.deb \ - && dpkg_apt /deps/libsai*.deb \ - && dpkg_apt /deps/xp-tools*.deb \ - && dpkg_apt /deps/xpshell*.deb \ - && dpkg_apt /deps/libsairedis_*.deb \ - && dpkg_apt /deps/libsaimetadata_*.deb\ + dpkg_apt /deps/libhiredis0.13*.deb \ + && dpkg_apt /deps/libnl-3-200_*.deb \ + && dpkg_apt /deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /deps/libnl-route-3-200_*.deb \ + && dpkg_apt /deps/libswsscommon_*.deb \ + && dpkg_apt /deps/sai*.deb \ + && dpkg_apt /deps/libsai*.deb \ + && dpkg_apt /deps/xp-tools*.deb \ + && dpkg_apt /deps/xpshell*.deb \ + && dpkg_apt /deps/libsairedis_*.deb \ + && dpkg_apt /deps/libsaimetadata_*.deb \ && dpkg_apt /deps/syncd_*.deb RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev diff --git a/dockers/docker-team/Dockerfile b/dockers/docker-team/Dockerfile index 345b671c7d56..607a990b4f23 100644 --- a/dockers/docker-team/Dockerfile +++ b/dockers/docker-team/Dockerfile @@ -1,7 +1,6 @@ FROM docker-base -COPY ["deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libnl-nf-3-200_*.deb", "deps/libnl-cli-3-200_*.deb", "deps/libteam5_*.deb", "deps/libteam-dev_*.deb", "deps/libteam-utils_*.deb", "deps/libteamdctl0_*.deb", "deps/libhiredis0.13_*.deb", "deps/libswsscommon_*.deb", "/deps/"] - +COPY ["deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libnl-nf-3-200_*.deb", "deps/libnl-cli-3-200_*.deb", "deps/libteam5_*.deb", "deps/libteam-utils_*.deb", "deps/libteamdctl0_*.deb", "deps/libhiredis0.13_*.deb", "deps/libswsscommon_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ dpkg_apt /deps/libnl-3-200_*.deb \ @@ -12,7 +11,6 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/libteam5_*.deb \ && dpkg_apt /deps/libteam-utils_*.deb \ && dpkg_apt /deps/libteamdctl0_*.deb \ - && dpkg_apt /deps/libteam-dev_*.deb \ && dpkg_apt /deps/libhiredis0.13_*.deb \ && dpkg_apt /deps/libswsscommon_*.deb @@ -23,4 +21,3 @@ RUN rm -rf /deps ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] - From 21c8322055fc445abaf7110abc222f088b08f79d Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Sat, 12 Nov 2016 01:14:41 +0000 Subject: [PATCH 0078/1833] Change redis conf: listen on unix socket (#66) By default, redis-server is listening on localhost TCP port. This change will make it also listen to the domain socket (unix socket), which will have better client-server performance. --- dockers/docker-database/Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dockers/docker-database/Dockerfile b/dockers/docker-database/Dockerfile index 2014cd8919f0..445ac44b12b0 100755 --- a/dockers/docker-database/Dockerfile +++ b/dockers/docker-database/Dockerfile @@ -10,8 +10,10 @@ RUN apt-get update && dpkg_apt /deps/redis-server_*.deb && \ apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y -RUN sed -ri 's/^daemonize yes$/daemonize no/' /etc/redis/redis.conf \ - && sed -ri 's/^logfile .*$/logfile ""/' /etc/redis/redis.conf \ - && sed -ri 's/^# syslog-enabled no$/syslog-enabled no/' /etc/redis/redis.conf +RUN sed -ri 's/^daemonize yes$/daemonize no/; \ + s/^logfile .*$/logfile ""/; \ + s/^# syslog-enabled no$/syslog-enabled no/; \ + s/^# unixsocket/unixsocket/ \ + ' /etc/redis/redis.conf ENTRYPOINT service redis-server start From 31420370b07997f7f2b6c35f3a134f28b82ec939 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 14 Nov 2016 13:52:12 +0200 Subject: [PATCH 0079/1833] Remove packages that are not required for SONiC (#67) Remove mlnx sx-sdn-hal, sx-acl-rm and testx. They are neither used nor installed in SONiC. --- src/mlnx-sdk/filelist.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/mlnx-sdk/filelist.txt b/src/mlnx-sdk/filelist.txt index 52583c7f79c7..f901164e9fd6 100644 --- a/src/mlnx-sdk/filelist.txt +++ b/src/mlnx-sdk/filelist.txt @@ -7,8 +7,6 @@ iproute2-dev_1.mlnx.4.2.2100_amd64.deb iproute2_1.mlnx.4.2.2100_amd64.deb mlnx-sai_1.mlnx.160712_amd64.deb python-sdk-api_1.mlnx.4.2.2100_amd64.deb -sx-acl-rm-dev_1.mlnx.4.2.2100_amd64.deb -sx-acl-rm_1.mlnx.4.2.2100_amd64.deb sx-complib-dev-static_1.mlnx.4.2.2100_amd64.deb sx-complib-dev_1.mlnx.4.2.2100_amd64.deb sx-complib_1.mlnx.4.2.2100_amd64.deb @@ -21,11 +19,6 @@ sx-kernel_1.mlnx.4.2.2100_amd64.deb sx-scew-dev-static_1.mlnx.4.2.2100_amd64.deb sx-scew-dev_1.mlnx.4.2.2100_amd64.deb sx-scew_1.mlnx.4.2.2100_amd64.deb -sx-sdn-hal-dev-static_1.mlnx.4.2.2100_amd64.deb -sx-sdn-hal-dev_1.mlnx.4.2.2100_amd64.deb -sx-sdn-hal_1.mlnx.4.2.2100_amd64.deb sxd-libs-dev-static_1.mlnx.4.2.2100_amd64.deb sxd-libs-dev_1.mlnx.4.2.2100_amd64.deb sxd-libs_1.mlnx.4.2.2100_amd64.deb -testx-dev_1.mlnx.4.2.2100_amd64.deb -testx_1.mlnx.4.2.2100_amd64.deb From af5c61c73aa7c8288967b58761ba7a84f9236e78 Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Thu, 10 Nov 2016 18:29:44 -0800 Subject: [PATCH 0080/1833] Add set rcv buffer for syncd rpc (#64) --- dockers/docker-syncd-mlnx-rpc/Dockerfile | 1 + dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf | 2 +- dockers/docker-syncd-rpc/Dockerfile | 1 + dockers/docker-syncd-rpc/ptf_nn_agent.conf | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dockers/docker-syncd-mlnx-rpc/Dockerfile b/dockers/docker-syncd-mlnx-rpc/Dockerfile index 734171ffb3e0..c22145d1d69c 100644 --- a/dockers/docker-syncd-mlnx-rpc/Dockerfile +++ b/dockers/docker-syncd-mlnx-rpc/Dockerfile @@ -44,5 +44,6 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf ENTRYPOINT service rsyslog start \ + && sysctl -w net.core.rmem_max=509430500 \ && service syncd start \ && /usr/bin/supervisord diff --git a/dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf b/dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf index b16159a996e8..fa1ed0eb1622 100644 --- a/dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf +++ b/dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf @@ -1,5 +1,5 @@ [program:ptf_nn_agent] -command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 process_name=ptf_nn_agent stdout_logfile=/tmp/ptf_nn_agent.out.log stderr_logfile=/tmp/ptf_nn_agent.err.log diff --git a/dockers/docker-syncd-rpc/Dockerfile b/dockers/docker-syncd-rpc/Dockerfile index 28108a82582c..214230491e34 100644 --- a/dockers/docker-syncd-rpc/Dockerfile +++ b/dockers/docker-syncd-rpc/Dockerfile @@ -44,5 +44,6 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf ENTRYPOINT service rsyslog start \ + && sysctl -w net.core.rmem_max=509430500 \ && service syncd start \ && /usr/bin/supervisord diff --git a/dockers/docker-syncd-rpc/ptf_nn_agent.conf b/dockers/docker-syncd-rpc/ptf_nn_agent.conf index b16159a996e8..fa1ed0eb1622 100644 --- a/dockers/docker-syncd-rpc/ptf_nn_agent.conf +++ b/dockers/docker-syncd-rpc/ptf_nn_agent.conf @@ -1,5 +1,5 @@ [program:ptf_nn_agent] -command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 process_name=ptf_nn_agent stdout_logfile=/tmp/ptf_nn_agent.out.log stderr_logfile=/tmp/ptf_nn_agent.err.log From dc84c4130a32f3c48769e7edc1ed757fdcd59528 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 15 Nov 2016 03:57:44 +0000 Subject: [PATCH 0081/1833] update mlnx sdk to 4.2.3002 and remove mlnx sai package --- src/mlnx-sdk/filelist.txt | 41 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/mlnx-sdk/filelist.txt b/src/mlnx-sdk/filelist.txt index f901164e9fd6..521de44de76a 100644 --- a/src/mlnx-sdk/filelist.txt +++ b/src/mlnx-sdk/filelist.txt @@ -1,24 +1,23 @@ ## Get vendor SAI SDK ## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk -applibs-dev_1.mlnx.4.2.2100_amd64.deb -applibs_1.mlnx.4.2.2100_amd64.deb -iproute2-dev_1.mlnx.4.2.2100_amd64.deb -iproute2_1.mlnx.4.2.2100_amd64.deb -mlnx-sai_1.mlnx.160712_amd64.deb -python-sdk-api_1.mlnx.4.2.2100_amd64.deb -sx-complib-dev-static_1.mlnx.4.2.2100_amd64.deb -sx-complib-dev_1.mlnx.4.2.2100_amd64.deb -sx-complib_1.mlnx.4.2.2100_amd64.deb -sx-examples-dev_1.mlnx.4.2.2100_amd64.deb -sx-examples_1.mlnx.4.2.2100_amd64.deb -sx-gen-utils-dev_1.mlnx.4.2.2100_amd64.deb -sx-gen-utils_1.mlnx.4.2.2100_amd64.deb -sx-kernel-dev_1.mlnx.4.2.2100_amd64.deb -sx-kernel_1.mlnx.4.2.2100_amd64.deb -sx-scew-dev-static_1.mlnx.4.2.2100_amd64.deb -sx-scew-dev_1.mlnx.4.2.2100_amd64.deb -sx-scew_1.mlnx.4.2.2100_amd64.deb -sxd-libs-dev-static_1.mlnx.4.2.2100_amd64.deb -sxd-libs-dev_1.mlnx.4.2.2100_amd64.deb -sxd-libs_1.mlnx.4.2.2100_amd64.deb +applibs-dev_1.mlnx.4.2.3002_amd64.deb +applibs_1.mlnx.4.2.3002_amd64.deb +iproute2-dev_1.mlnx.4.2.3002_amd64.deb +iproute2_1.mlnx.4.2.3002_amd64.deb +python-sdk-api_1.mlnx.4.2.3002_amd64.deb +sx-complib-dev-static_1.mlnx.4.2.3002_amd64.deb +sx-complib-dev_1.mlnx.4.2.3002_amd64.deb +sx-complib_1.mlnx.4.2.3002_amd64.deb +sx-examples-dev_1.mlnx.4.2.3002_amd64.deb +sx-examples_1.mlnx.4.2.3002_amd64.deb +sx-gen-utils-dev_1.mlnx.4.2.3002_amd64.deb +sx-gen-utils_1.mlnx.4.2.3002_amd64.deb +sx-kernel-dev_1.mlnx.4.2.3002_amd64.deb +sx-kernel_1.mlnx.4.2.3002_amd64.deb +sx-scew-dev-static_1.mlnx.4.2.3002_amd64.deb +sx-scew-dev_1.mlnx.4.2.3002_amd64.deb +sx-scew_1.mlnx.4.2.3002_amd64.deb +sxd-libs-dev-static_1.mlnx.4.2.3002_amd64.deb +sxd-libs-dev_1.mlnx.4.2.3002_amd64.deb +sxd-libs_1.mlnx.4.2.3002_amd64.deb From 0f0f9926c778bb634e78bf955506998d716d6d87 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 15 Nov 2016 14:09:38 +0000 Subject: [PATCH 0082/1833] reformat deb file list to make it more readable --- src/Makefile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 0dabdfcf617d..6dd92c6ff0d0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,8 +4,22 @@ SHELL := /bin/bash REDIS_VERSION=3.2.4-1~bpo8+1_amd64 -LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-3-dev_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-genl-3-dev_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb libnl-route-3-dev_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb libnl-nf-3-dev_3.2.27-1_amd64.deb libnl-cli-3-200_3.2.27-1_amd64.deb libnl-cli-3-dev_3.2.27-1_amd64.deb -LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb + +LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb \ + libnl-3-dev_3.2.27-1_amd64.deb \ + libnl-genl-3-200_3.2.27-1_amd64.deb \ + libnl-genl-3-dev_3.2.27-1_amd64.deb \ + libnl-route-3-200_3.2.27-1_amd64.deb \ + libnl-route-3-dev_3.2.27-1_amd64.deb \ + libnl-nf-3-200_3.2.27-1_amd64.deb \ + libnl-nf-3-dev_3.2.27-1_amd64.deb \ + libnl-cli-3-200_3.2.27-1_amd64.deb \ + libnl-cli-3-dev_3.2.27-1_amd64.deb + +LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb \ + libteamdctl0_1.26-1_amd64.deb \ + libteam-dev_1.26-1_amd64.deb \ + libteam-utils_1.26-1_amd64.deb ## Function: build_project, directory ## Build the project and save the .deb target in the same directory From af38c0e77df4581eb9825c94fa9a5792f8282dd3 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 16 Nov 2016 12:46:15 -0800 Subject: [PATCH 0083/1833] Config apt inside docker images to save disk space: auto clean, gz, no trans (#69) --- ThirdPartyLicenses.txt | 194 ++++++++++++++++++++++++++ build_debian.sh | 2 +- files/apt/apt.conf.d/apt-clean | 19 +++ files/apt/apt.conf.d/apt-gzip-indexes | 11 ++ files/apt/apt.conf.d/apt-no-languages | 5 + 5 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 files/apt/apt.conf.d/apt-clean create mode 100644 files/apt/apt.conf.d/apt-gzip-indexes create mode 100644 files/apt/apt.conf.d/apt-no-languages diff --git a/ThirdPartyLicenses.txt b/ThirdPartyLicenses.txt index 99bc267e11f9..376506337e79 100644 --- a/ThirdPartyLicenses.txt +++ b/ThirdPartyLicenses.txt @@ -976,3 +976,197 @@ Microsoft is offering you a license to use the following components, to the exte * Public License instead of this License. But first, please read * . */ + +4. apt-clean, apt-gzip-indexes, apt-no-languages imported from docker v1.11.1 +/* + * Apache License + * Version 2.0, January 2004 + * https://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * Copyright 2013-2016 Docker, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/build_debian.sh b/build_debian.sh index 367c5814fefb..9252646dff4b 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -91,7 +91,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs ## Pointing apt to public apt mirrors and getting latest packages, needed for latest security updates sudo cp files/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ -sudo cp files/apt/apt.conf.d/81norecommends $FILESYSTEM_ROOT/etc/apt/apt.conf.d/ +sudo cp files/apt/apt.conf.d/{81norecommends,apt-{clean,gzip-indexes,no-languages}} $FILESYSTEM_ROOT/etc/apt/apt.conf.d/ sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'apt-mark auto `apt-mark showmanual`' ## Note: set lang to prevent locale warnings in your chroot diff --git a/files/apt/apt.conf.d/apt-clean b/files/apt/apt.conf.d/apt-clean new file mode 100644 index 000000000000..886c6d829a3b --- /dev/null +++ b/files/apt/apt.conf.d/apt-clean @@ -0,0 +1,19 @@ +# Since for most Docker users, package installs happen in "docker build" steps, +# they essentially become individual layers due to the way Docker handles +# layering, especially using CoW filesystems. What this means for us is that +# the caches that APT keeps end up just wasting space in those layers, making +# our layers unnecessarily large (especially since we'll normally never use +# these caches again and will instead just "docker build" again and make a brand +# new image). + +# Ideally, these would just be invoking "apt-get clean", but in our testing, +# that ended up being cyclic and we got stuck on APT's lock, so we get this fun +# creation that's essentially just "apt-get clean". +DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; }; +APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; }; + +Dir::Cache::pkgcache ""; +Dir::Cache::srcpkgcache ""; + +# Note that we do realize this isn't the ideal way to do this, and are always +# open to better suggestions (https://github.com/docker/docker/issues). diff --git a/files/apt/apt.conf.d/apt-gzip-indexes b/files/apt/apt.conf.d/apt-gzip-indexes new file mode 100644 index 000000000000..6d29ac4474de --- /dev/null +++ b/files/apt/apt.conf.d/apt-gzip-indexes @@ -0,0 +1,11 @@ +# Since Docker users using "RUN apt-get update && apt-get install -y ..." in +# their Dockerfiles don't go delete the lists files afterwards, we want them to +# be as small as possible on-disk, so we explicitly request "gz" versions and +# tell Apt to keep them gzipped on-disk. + +# For comparison, an "apt-get update" layer without this on a pristine +# "debian:wheezy" base image was "29.88 MB", where with this it was only +# "8.273 MB". + +Acquire::GzipIndexes "true"; +Acquire::CompressionTypes::Order:: "gz"; diff --git a/files/apt/apt.conf.d/apt-no-languages b/files/apt/apt.conf.d/apt-no-languages new file mode 100644 index 000000000000..964d83d6c5b9 --- /dev/null +++ b/files/apt/apt.conf.d/apt-no-languages @@ -0,0 +1,5 @@ +# In Docker, we don't often need the "Translations" files, so we're just wasting +# time and space by downloading them, and this inhibits that. For users that do +# need them, it's a simple matter to delete this file and "apt-get update". :) + +Acquire::Languages "none"; From e8b96abb6381bb279c93e4eb2e7ac63b1f45865a Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 16 Nov 2016 18:40:19 -0800 Subject: [PATCH 0084/1833] add build badge for mellnaox --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f79e78746776..11171ecefe96 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Mellanox[![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) + # Build SONiC Switch Images - buildimage # Description From 590f2cb0b985f32fba25b9a56216cb037606c9b7 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 21 Nov 2016 10:27:23 -0800 Subject: [PATCH 0085/1833] add fw-SPC.mfa in the filelist.txt (#71) --- src/mlnx-sdk/filelist.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mlnx-sdk/filelist.txt b/src/mlnx-sdk/filelist.txt index 521de44de76a..354c84140927 100644 --- a/src/mlnx-sdk/filelist.txt +++ b/src/mlnx-sdk/filelist.txt @@ -1,6 +1,7 @@ ## Get vendor SAI SDK ## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk +fw-SPC.mfa applibs-dev_1.mlnx.4.2.3002_amd64.deb applibs_1.mlnx.4.2.3002_amd64.deb iproute2-dev_1.mlnx.4.2.3002_amd64.deb From 14c86bbd25d7df9c0a5b4ab29b32e7f1969c1e75 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 21 Nov 2016 17:25:45 -0800 Subject: [PATCH 0086/1833] remove applibs_*.deb to fix mlnx build (#70) --- Makefile | 2 +- src/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f106a96137e9..2e4e17080430 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,7 @@ target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/d docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) -target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) dockers/docker-syncd-mlnx/deps/fw-SPC.mfa +target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) dockers/docker-syncd-mlnx/deps/fw-SPC.mfa docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) diff --git a/src/Makefile b/src/Makefile index 6dd92c6ff0d0..f84aec1f32fb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -88,7 +88,7 @@ brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev mkdir -p brcm cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb brcm/ -mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/applibs_1.mlnx.4.2.2100_amd64.deb mlnx-sdk/*.deb +mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/*.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-sairedis) mkdir -p mlnx From 5621082dbb8463c3ae9332d1234f2373fa6eef09 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 21 Nov 2016 17:44:16 -0800 Subject: [PATCH 0087/1833] LLDP docker: Remove outdated dependency (#73) --- dockers/docker-lldp-sv2/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-lldp-sv2/Dockerfile b/dockers/docker-lldp-sv2/Dockerfile index 0ad91cf70518..727d4ce38c56 100644 --- a/dockers/docker-lldp-sv2/Dockerfile +++ b/dockers/docker-lldp-sv2/Dockerfile @@ -1,9 +1,9 @@ FROM docker-base -COPY deps/sswsdk*.whl deps/sonic_d*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ +COPY deps/sswsdk*.whl deps/sonic_d*.whl deps/lldpd_*.deb /deps/ ## Pre-install the fundamental packages -## Install Python SSWSDK (lldpsyncd dependency) +## Install Python SSWSDK ## Install LLDP Sync Daemon ## Note: dpkg_apt function has the benefit to detect missing .deb file ## Clean up From f25188e3a46d3b06e3998066160e6d584ab8f327 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 22 Nov 2016 21:08:55 -0800 Subject: [PATCH 0088/1833] Add python3 build script (#76) * build python 3.5 * update to 3.5.2-8 * add python3.5 and mpdecimal to Makefile --- src/Makefile | 19 +++++++++++++++++++ src/mpdecimal/build.sh | 20 ++++++++++++++++++++ src/python3.5/build.sh | 18 ++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100755 src/mpdecimal/build.sh create mode 100755 src/python3.5/build.sh diff --git a/src/Makefile b/src/Makefile index f84aec1f32fb..f8cb2889d877 100644 --- a/src/Makefile +++ b/src/Makefile @@ -21,6 +21,18 @@ LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb \ libteam-dev_1.26-1_amd64.deb \ libteam-utils_1.26-1_amd64.deb +MPDECIMAL_VER=2.4.2-1 + +MPDECIMAL-DEBS=libmpdec2_$(MPDECIMAL_VER)_amd64.deb \ + libmpdec-dev_$(MPDECIMAL_VER)_amd64.deb + +PYTHON3_5_VER=3.5.2-8 + +PYTHON3_5-DEBS=libpython3.5-minimal_$(PYTHON3_5_VER)_amd64.deb \ + python3.5-minimal_$(PYTHON3_5_VER)_amd64.deb \ + libpython3.5-stdlib_$(PYTHON3_5_VER)_amd64.deb \ + python3.5_$(PYTHON3_5_VER)_amd64.deb + ## Function: build_project, directory ## Build the project and save the .deb target in the same directory ## TRICK: clean dh state so it will force recreating .deb later @@ -44,6 +56,13 @@ $(LIBTEAM-DEBS): $(LIBNL-DEBS) $(foreach dep, $^, $(call install_deb, $(dep))) pushd libteam; ./build.sh; popd +$(MPDECIMAL-DEBS): + pushd mpdecimal; ./build.sh; popd + +$(PYTHON3_5-DEBS): $(MPDECIMAL-DEBS) + $(foreach dep, $^, $(call install_deb, $(dep))) + pushd python3.5; ./build.sh; popd + redis-sentinel_$(REDIS_VERSION).deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb: pushd redis; ./build.sh; popd diff --git a/src/mpdecimal/build.sh b/src/mpdecimal/build.sh new file mode 100755 index 000000000000..be06c35766cf --- /dev/null +++ b/src/mpdecimal/build.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +MPDECIMAL_VER=2.4.2 +MPDECIMAL_DEB_VER=1 + +wget -N http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_${MPDECIMAL_VER}.orig.tar.gz +wget -N http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_${MPDECIMAL_VER}-${MPDECIMAL_DEB_VER}.debian.tar.xz +wget -N http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_${MPDECIMAL_VER}-${MPDECIMAL_DEB_VER}.dsc + +dpkg-source -x mpdecimal_${MPDECIMAL_VER}-${MPDECIMAL_DEB_VER}.dsc + +pushd mpdecimal-${MPDECIMAL_VER} + +sudo apt-get -y build-dep mpdecimal + +dpkg-buildpackage -us -uc -b + +popd + +cp *.deb ../ diff --git a/src/python3.5/build.sh b/src/python3.5/build.sh new file mode 100755 index 000000000000..ebada5397e1b --- /dev/null +++ b/src/python3.5/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +PYTHON_VER=3.5.2 +PYTHON_DEB_VER=8 + +wget -N http://http.debian.net/debian/pool/main/p/python3.5/python3.5_${PYTHON_VER}.orig.tar.xz +wget -N http://http.debian.net/debian/pool/main/p/python3.5/python3.5_${PYTHON_VER}-${PYTHON_DEB_VER}.debian.tar.xz +wget -N http://http.debian.net/debian/pool/main/p/python3.5/python3.5_${PYTHON_VER}-${PYTHON_DEB_VER}.dsc + +dpkg-source -x python3.5_${PYTHON_VER}-${PYTHON_DEB_VER}.dsc + +pushd python3.5-${PYTHON_VER} + +dpkg-buildpackage -us -uc -b + +popd + +cp *.deb ../ From ff14e9c72404cd6cedb7e4a7263b09d77c3a1b85 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 23 Nov 2016 12:59:47 -0800 Subject: [PATCH 0089/1833] build_docker.sh: Tag docker image before pushed to registry (#75) --- build_docker.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/build_docker.sh b/build_docker.sh index 67c21ba4d6ce..a7b6c0511801 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -9,11 +9,13 @@ set -e usage() { cat >&2 <&2 usage @@ -62,7 +68,7 @@ REGISTRY_PASSWD=$5 BUILD_NUMBER="0" } -remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:latest +remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$docker_image_tag timestamp="$(date -u +%Y%m%d)" build_version="${timestamp}.${BUILD_NUMBER}" build_remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$build_version From 0532ee4ed6f47b59cfd225575c3328cd483e27d2 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Wed, 23 Nov 2016 23:47:19 +0200 Subject: [PATCH 0090/1833] platform: Cavium serial settings change (#72) Signed-off-by: Nadiya.Stetskovych --- installer/x86_64/platforms/x86_64-accton_as7512_32x-r0 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 installer/x86_64/platforms/x86_64-accton_as7512_32x-r0 diff --git a/installer/x86_64/platforms/x86_64-accton_as7512_32x-r0 b/installer/x86_64/platforms/x86_64-accton_as7512_32x-r0 new file mode 100644 index 000000000000..9b49af780817 --- /dev/null +++ b/installer/x86_64/platforms/x86_64-accton_as7512_32x-r0 @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=9600 From 691b787811873144cdb04e6ae6dc9ec6710bdf0b Mon Sep 17 00:00:00 2001 From: mbrar Date: Wed, 23 Nov 2016 16:09:43 -0800 Subject: [PATCH 0091/1833] dockers: Add DHCP Relay docker (#38) --- dockers/docker-dhcp-relay/Dockerfile | 17 +++++++++++++++++ dockers/docker-dhcp-relay/isc-dhcp-relay | 6 ++++++ 2 files changed, 23 insertions(+) create mode 100644 dockers/docker-dhcp-relay/Dockerfile create mode 100644 dockers/docker-dhcp-relay/isc-dhcp-relay diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile new file mode 100644 index 000000000000..efc1f7f5c317 --- /dev/null +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -0,0 +1,17 @@ +FROM docker-base + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +## Install isc-dhcp-relay +## Clean up +RUN apt-get update && apt-get -y install \ + isc-dhcp-relay && \ + apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y + +COPY isc-dhcp-relay /etc/default/isc-dhcp-relay + +ENTRYPOINT service rsyslog start \ + && service isc-dhcp-relay start \ + && /bin/bash + diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay b/dockers/docker-dhcp-relay/isc-dhcp-relay new file mode 100644 index 000000000000..8aef56c7e19f --- /dev/null +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay @@ -0,0 +1,6 @@ +SERVERS="" + +INTERFACES="" + +#-a provides option 82 circuit id information +OPTIONS="-a" From f45e7817825c85c3b20dd686dca70ee7144e2f2f Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 23 Nov 2016 16:10:35 -0800 Subject: [PATCH 0092/1833] update sonic-linux-kernel submodule (#77) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index fbd5604bf748..db5ba1485acd 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit fbd5604bf7480bd6f861ad35acd5ec41bb4dd067 +Subproject commit db5ba1485acd7dd9620bf3216c21bb4c3efebfb5 From f83460bdb7e951fa99c96a2d9f83e78f343edcba Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 23 Nov 2016 16:18:35 -0800 Subject: [PATCH 0093/1833] Add Makefile target: lldp/snmp docker images (#74) * Add sonic-dbsyncd submodule * Add sonic-py-swsssdk submodule * Add lldpd submodule * Add sonic-snmpagent submodule * Add Makefile target: lldp/snmp docker images * Fix docker-snmp-sv2.gz dependency * Add lldp/snmp sources to the top level targets --- .gitmodules | 12 +++++++++ Makefile | 27 ++++++++++++++++--- src/Makefile | 62 +++++++++++++++++++++++++++++++++++++++----- src/lldpd | 1 + src/snmpd/build.sh | 19 ++++++++++++++ src/sonic-dbsyncd | 1 + src/sonic-py-swsssdk | 1 + src/sonic-snmpagent | 1 + 8 files changed, 114 insertions(+), 10 deletions(-) create mode 160000 src/lldpd create mode 100755 src/snmpd/build.sh create mode 160000 src/sonic-dbsyncd create mode 160000 src/sonic-py-swsssdk create mode 160000 src/sonic-snmpagent diff --git a/.gitmodules b/.gitmodules index 8b5f020f356e..54f3671effee 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,3 +29,15 @@ path = src/sonic-quagga url = https://github.com/Azure/sonic-quagga branch = debian/0.99.24.1 +[submodule "sonic-dbsyncd"] + path = src/sonic-dbsyncd + url = https://github.com/Azure/sonic-dbsyncd +[submodule "src/sonic-py-swsssdk"] + path = src/sonic-py-swsssdk + url = https://github.com/Azure/sonic-py-swsssdk.git +[submodule "src/lldpd"] + path = src/lldpd + url = https://github.com/vincentbernat/lldpd.git +[submodule "src/sonic-snmpagent"] + path = src/sonic-snmpagent + url = https://github.com/Azure/sonic-snmpagent diff --git a/Makefile b/Makefile index 2e4e17080430..1f572c987756 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb)) CAVM-SDK-DEBS=$(notdir $(wildcard src/cavm-sdk/*.deb)) LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-3-dev_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-genl-3-dev_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb libnl-route-3-dev_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb libnl-nf-3-dev_3.2.27-1_amd64.deb libnl-cli-3-200_3.2.27-1_amd64.deb libnl-cli-3-dev_3.2.27-1_amd64.deb + LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb ## Function: build_docker, image_name save_file @@ -37,6 +38,18 @@ src/%: LIBTEAM-DEBS="$(LIBTEAM-DEBS)" \ -C src $(subst src/,,$@) +## Rules: docker-snmp-sv2 +dockers/docker-snmp-sv2/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) +dockers/docker-snmp-sv2/deps/python3/%.whl: src/%.whl + mkdir -p `dirname $@` && cp $< $(dir $@) + +## Rules: docker-lldp-sv2 +dockers/docker-lldp-sv2/deps/%.deb: src/%.deb + mkdir -p `dirname $@` && cp $< $(dir $@) +dockers/docker-lldp-sv2/deps/%.whl: src/%.whl + mkdir -p `dirname $@` && cp $< $(dir $@) + ## Rules: docker-fpm dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd mkdir -p `dirname $@` && cp $< $(dir $@) @@ -107,6 +120,14 @@ dockers/docker-sonic-p4/deps/%.deb: src/%.deb target/docker-base.gz: $(call build_docker,$(patsubst target/%.gz,%,$@),$@) +target/docker-snmp-sv2.gz: target/docker-base.gz $(addprefix dockers/docker-snmp-sv2/deps/,python3/sswsdk-2.0.1-py3-none-any.whl python3/asyncsnmp-2.1.0-py3-none-any.whl libsnmp-base_5.7.3+dfsg-1.5_all.deb libsnmp30_5.7.3+dfsg-1.5_amd64.deb snmp_5.7.3+dfsg-1.5_amd64.deb snmpd_5.7.3+dfsg-1.5_amd64.deb) + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + +target/docker-lldp-sv2.gz: target/docker-base.gz $(addprefix dockers/docker-lldp-sv2/deps/,sswsdk-2.0.1-py2-none-any.whl sonic_d-2.0.0-py2-none-any.whl lldpd_0.9.5-0_amd64.deb) + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) ## TODO: remove placeholders for the dependencies touch dockers/docker-syncd/deps/{dsserve,bcmcmd} @@ -161,12 +182,12 @@ target/sonic-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_am ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-team.gz docker-database.gz) +brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz) ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-team.gz docker-database.gz) +mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz) ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -cavm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-team.gz docker-database.gz) +cavm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz) p4-all: $(addprefix target/,docker-sonic-p4.gz) diff --git a/src/Makefile b/src/Makefile index f8cb2889d877..0ac9d491b331 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,10 +44,34 @@ define build_project popd endef +## Function: build_project_py2, directory +## Build the project and save the .deb target in the same directory +define build_project_py2 + pushd $(1) + python2 setup.py bdist_wheel + popd +endef + +## Function: build_project_py3, directory +## Build the project and save the .deb target in the same directory +define build_project_py3 + pushd $(1) + python3 setup.py bdist_wheel + popd +endef + ## Function: install_deb, debfile install_deb = \ [ -f $(1) ] && { sudo dpkg -i $(1) || sudo apt-get -y install -f; } || return 1; +## Function: install_py2, whlfile +install_py2 = \ + sudo pip install $(1) + +## Function: install_py3, whlfile +install_py3 = \ + sudo pip3 install $(1) + ## Rules $(LIBNL-DEBS): pushd libnl3; ./build.sh; popd @@ -65,7 +89,7 @@ $(PYTHON3_5-DEBS): $(MPDECIMAL-DEBS) redis-sentinel_$(REDIS_VERSION).deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb: pushd redis; ./build.sh; popd - + libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb redis-sentinel_$(REDIS_VERSION).deb $(foreach dep, $^, $(call install_deb, $(dep))) pushd hiredis; ./build.sh; popd @@ -90,13 +114,37 @@ python-p4c-bm_1.0.0-5415c416-1_all.deb: python-tenjin_1.1.1-1_all.deb python-p4- python-tenjin_1.1.1-1_all.deb: pushd tenjin; ./build.sh; popd -p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-p4-hlir_0.9.36-1_all.deb python-tenjin_1.1.1-1_all.deb python-p4c-bm_1.0.0-5415c416-1_all.deb p4-bmv2_1.0.0_amd64.deb +snmpd_5.7.3+dfsg-1.5_amd64.deb snmptrapd_5.7.3+dfsg-1.5_amd64.deb snmp_5.7.3+dfsg-1.5_amd64.deb libsnmp-base_5.7.3+dfsg-1.5_all.deb libsnmp30_5.7.3+dfsg-1.5_amd64.deb libsnmp30-dbg_5.7.3+dfsg-1.5_amd64.deb libsnmp-dev_5.7.3+dfsg-1.5_amd64.deb libsnmp-perl_5.7.3+dfsg-1.5_amd64.deb python-netsnmp_5.7.3+dfsg-1.5_amd64.deb tkmib_5.7.3+dfsg-1.5_all.deb: + pushd snmpd; ./build.sh; popd + +sswsdk-2.0.1-py2-none-any.whl: + $(call build_project_py2, sonic-py-swsssdk) + cp sonic-py-swsssdk/dist/$@ . + +sswsdk-2.0.1-py3-none-any.whl: + $(call build_project_py3, sonic-py-swsssdk) + cp sonic-py-swsssdk/dist/$@ . + +sonic_d-2.0.0-py2-none-any.whl: sswsdk-2.0.1-py2-none-any.whl + $(foreach dep, $^, $(call install_py2, $(dep))) + $(call build_project_py2, sonic-dbsyncd) + cp sonic-dbsyncd/dist/$@ . + +asyncsnmp-2.1.0-py3-none-any.whl: sswsdk-2.0.1-py3-none-any.whl + $(foreach dep, $^, $(call install_py3, $(dep))) + $(call build_project_py3, sonic-snmpagent) + cp sonic-snmpagent/dist/$@ . + +p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-p4-hlir_0.9.36-1_all.deb python-tenjin_1.1.1-1_all.deb python-p4c-bm_1.0.0-5415c416-1_all.deb p4-bmv2_1.0.0_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) pushd p4-switch; ./build.sh; popd - + +lldpd_0.9.5-0_amd64.deb liblldpctl-dev_0.9.5-0_amd64.deb: + $(call build_project, lldpd) + quagga_0.99.24.1-2.1_amd64.deb: $(call build_project, sonic-quagga) - + libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb $(LIBNL-DEBS) $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss-common) @@ -106,7 +154,7 @@ brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev $(call build_project, sonic-sairedis) mkdir -p brcm cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb brcm/ - + mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/*.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-sairedis) @@ -118,7 +166,7 @@ cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev $(call build_project, sonic-sairedis) mkdir -p cavm cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb cavm/ - + p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb p4-bmv2_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-sairedis) @@ -148,7 +196,7 @@ cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd cp swss_1.0.0_amd64.deb cavm/ cp sonic-swss/debian/swss/usr/bin/fpmsyncd . cp sonic-swss/debian/swss/usr/bin/teamsyncd . - + p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS) $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-swss) diff --git a/src/lldpd b/src/lldpd new file mode 160000 index 000000000000..396961a038a3 --- /dev/null +++ b/src/lldpd @@ -0,0 +1 @@ +Subproject commit 396961a038a38675d46f96eaa7b430b2a1f8701b diff --git a/src/snmpd/build.sh b/src/snmpd/build.sh new file mode 100755 index 000000000000..65d47d9def81 --- /dev/null +++ b/src/snmpd/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Install build dependency for snmpd +sudo apt-get -y build-dep snmpd + +# download debian net-snmp 5.7.3 +wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_5.7.3+dfsg-1.5.dsc +wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_5.7.3+dfsg.orig.tar.xz +wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_5.7.3+dfsg-1.5.debian.tar.xz + +dpkg-source -x net-snmp_5.7.3+dfsg-1.5.dsc + +pushd net-snmp-5.7.3+dfsg + +fakeroot debian/rules binary + +popd + +cp *.deb ../ diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd new file mode 160000 index 000000000000..3d30cfc9318d --- /dev/null +++ b/src/sonic-dbsyncd @@ -0,0 +1 @@ +Subproject commit 3d30cfc9318d03652df01c0871090f5ef6c8ccb2 diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk new file mode 160000 index 000000000000..7bbe8419f719 --- /dev/null +++ b/src/sonic-py-swsssdk @@ -0,0 +1 @@ +Subproject commit 7bbe8419f719f577fdf923c8eadd0d462a9ce72a diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent new file mode 160000 index 000000000000..2e7fe1b2a9c3 --- /dev/null +++ b/src/sonic-snmpagent @@ -0,0 +1 @@ +Subproject commit 2e7fe1b2a9c3fafdc49d0063d1fb9e5396fd3649 From 96c2834cad93c5e80555871a3e8cfc59e252576f Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 28 Nov 2016 12:03:12 -0800 Subject: [PATCH 0094/1833] Refine installation order of mlnx-sdk debs (#78) --- src/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Makefile b/src/Makefile index 0ac9d491b331..f47dc99dd668 100644 --- a/src/Makefile +++ b/src/Makefile @@ -156,6 +156,8 @@ brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb brcm/ mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/*.deb + ## Install applibs first for late depending packages + $(call install_deb, mlnx-sdk/applibs_1.mlnx.*.deb) $(foreach dep, $^, $(call install_deb, $(dep))) $(call build_project, sonic-sairedis) mkdir -p mlnx From 57ff53ea605bc5823661580d8d07f75993956c10 Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Mon, 28 Nov 2016 22:14:27 +0200 Subject: [PATCH 0095/1833] docker-syncd-cavm : Added synchronization between syncd and redis (#79) --- dockers/docker-syncd-cavm/Dockerfile | 2 +- dockers/docker-syncd-cavm/start.sh | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/dockers/docker-syncd-cavm/Dockerfile b/dockers/docker-syncd-cavm/Dockerfile index e8025011bb70..41298a29ede4 100755 --- a/dockers/docker-syncd-cavm/Dockerfile +++ b/dockers/docker-syncd-cavm/Dockerfile @@ -18,7 +18,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/libsaimetadata_*.deb \ && dpkg_apt /deps/syncd_*.deb -RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev +RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev redis-tools COPY ["start.sh", "/usr/bin/"] diff --git a/dockers/docker-syncd-cavm/start.sh b/dockers/docker-syncd-cavm/start.sh index 04c5a3a1835f..21d61e707344 100755 --- a/dockers/docker-syncd-cavm/start.sh +++ b/dockers/docker-syncd-cavm/start.sh @@ -3,4 +3,21 @@ export XP_ROOT=/usr/bin/ service rsyslog start -syncd -p /etc/ssw/AS7512/profile.ini -N + +while true; do + + # Check if redis-server starts + + result=$(redis-cli ping) + + if [ "$result" == "PONG" ]; then + + redis-cli FLUSHALL + syncd -p /etc/ssw/AS7512/profile.ini -N + break + + fi + + sleep 1 + +done From 543def350b23e7d936255cdf30f44eca2c46cf4c Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 28 Nov 2016 12:15:39 -0800 Subject: [PATCH 0096/1833] Install lldpd Build-Depends (#81) --- src/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Makefile b/src/Makefile index f47dc99dd668..5aea155cc43c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -140,6 +140,9 @@ p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3 pushd p4-switch; ./build.sh; popd lldpd_0.9.5-0_amd64.deb liblldpctl-dev_0.9.5-0_amd64.deb: + ## Install build dependency for lldpd + ## Note: lldpd and snmpd conflict on Build-Depends, so install before build + sudo apt-get -y build-dep lldpd $(call build_project, lldpd) quagga_0.99.24.1-2.1_amd64.deb: From 7cf0f31a7dafa45e7c7a43c7008abd19d0411976 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 28 Nov 2016 13:49:06 -0800 Subject: [PATCH 0097/1833] Fix getopts option-string (#82) --- build_docker.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build_docker.sh b/build_docker.sh index a7b6c0511801..18402a2e51f9 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -30,7 +30,10 @@ EOF docker_image_name='' docker_image_tag=latest -while getopts ":it:" opt; do +## The option-string tells getopts which options to expect and which of them must have an argument +## When you want getopts to expect an argument for an option, just place a : (colon) after the proper option flag +## If the very first character of the option-string is a :, getopts switches to "silent error reporting mode". +while getopts "i:t:" opt; do case $opt in i) docker_image_name=$OPTARG From 6665c6ad2cfdf94e7a2d12089c2f48d6ac1118f2 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 28 Nov 2016 15:30:06 -0800 Subject: [PATCH 0098/1833] Fetch redis source packages from mirror links (#83) * Fetch redis source packages from mirror links * Replace more version strings with macros --- src/redis/build.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/redis/build.sh b/src/redis/build.sh index 9ff33de6d137..b69a707d3cad 100755 --- a/src/redis/build.sh +++ b/src/redis/build.sh @@ -1,11 +1,15 @@ #!/bin/bash -x -wget -N 'http://mirrors.accretive-networks.net/debian/pool/main/r/redis/redis_3.2.4.orig.tar.gz' -wget -N 'http://mirrors.accretive-networks.net/debian/pool/main/r/redis/redis_3.2.4-1~bpo8+1.dsc' -wget -N 'http://mirrors.accretive-networks.net/debian/pool/main/r/redis/redis_3.2.4-1~bpo8+1.debian.tar.xz' +REDIS_VERION=3.2.4 +REDIS_VERION_FULL=$REDIS_VERION-1~bpo8+1 -dpkg-source -x redis_3.2.4-1~bpo8+1.dsc +wget -O redis_$REDIS_VERION.orig.tar.gz -N "https://sonicstorage.blob.core.windows.net/packages/redis_$REDIS_VERION.orig.tar.gz?sv=2015-04-05&sr=b&sig=B3qGEoSHe%2FBh5rVwvXHpKijgBtKF7dHeuJWp1p17UnU%3D&se=2026-11-26T22%3A31%3A31Z&sp=r" +wget -O redis_$REDIS_VERION_FULL.dsc -N "https://sonicstorage.blob.core.windows.net/packages/redis_$REDIS_VERION_FULL.dsc?sv=2015-04-05&sr=b&sig=LoUtjLXa%2BCcoM%2BsPewRLkY7YPRvSJTbsvQoW%2BL%2B3QWM%3D&se=2026-11-26T22%3A32%3A11Z&sp=r" -pushd redis-3.2.4; fakeroot debian/rules binary; popd +wget -O redis_$REDIS_VERION_FULL.debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/redis_$REDIS_VERION_FULL.debian.tar.xz?sv=2015-04-05&sr=b&sig=I33UsbDHiffEkQRndpFwY9y3I%2FrKTu0wmG%2FMXB98kys%3D&se=2026-11-26T22%3A32%3A34Z&sp=r" + +dpkg-source -x redis_$REDIS_VERION_FULL.dsc + +pushd redis-$REDIS_VERION; fakeroot debian/rules binary; popd cp *.deb .. From c3257e1a9c8896b3a4a40c1f96b065912570427d Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 29 Nov 2016 11:34:46 -0800 Subject: [PATCH 0099/1833] Modify docker_ptf and docker_saiserver_mlnx to use libthrift0.9.3 (#84) --- dockers/docker-ptf/Dockerfile | 2 +- dockers/docker-saiserver-mlnx/Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockers/docker-ptf/Dockerfile b/dockers/docker-ptf/Dockerfile index cf458af61949..d72391a7ba43 100644 --- a/dockers/docker-ptf/Dockerfile +++ b/dockers/docker-ptf/Dockerfile @@ -37,7 +37,7 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / cmake \ && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ && dpkg_apt /root/deps/python-ptf_*.deb \ - && dpkg_apt /root/deps/libthrift-0.9.2_*.deb \ + && dpkg_apt /root/deps/libthrift-0.9.3_*.deb \ && dpkg_apt /root/deps/python-thrift_*.deb \ && rm -rf /root/deps \ && apt-get -y autoclean \ diff --git a/dockers/docker-saiserver-mlnx/Dockerfile b/dockers/docker-saiserver-mlnx/Dockerfile index 9390d19e88a0..49f7842c7a41 100755 --- a/dockers/docker-saiserver-mlnx/Dockerfile +++ b/dockers/docker-saiserver-mlnx/Dockerfile @@ -2,7 +2,7 @@ FROM docker-base RUN apt-get update -COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.2_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"] +COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.3_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ dpkg_apt /deps/applibs_*.deb \ @@ -15,7 +15,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/python-sdk-api_*.deb \ && dpkg_apt /deps/iproute2_*.deb \ && dpkg_apt /deps/mlnx-sai_*.deb \ - && dpkg_apt /deps/libthrift-0.9.2_*.deb \ + && dpkg_apt /deps/libthrift-0.9.3_*.deb \ && dpkg_apt /deps/libnl-3-200_*.deb \ && dpkg_apt /deps/libnl-genl-3-200_*.deb \ && dpkg_apt /deps/libnl-route-3-200_*.deb From 55ee247f0269089d9ba6934c8650f716d8bc338a Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 29 Nov 2016 17:07:50 -0800 Subject: [PATCH 0100/1833] Change to thrift 0.9.3 for docker-mlnx-sswstncd-rpc, docker-syncd-mlnx-rpc, and docker-syncd-rpc (#86) --- dockers/docker-mlnx-sswsyncd-rpc/Dockerfile | 2 +- dockers/docker-syncd-mlnx-rpc/Dockerfile | 2 +- dockers/docker-syncd-rpc/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockers/docker-mlnx-sswsyncd-rpc/Dockerfile b/dockers/docker-mlnx-sswsyncd-rpc/Dockerfile index 2e53ab64f752..4d1b3e49bcda 100644 --- a/dockers/docker-mlnx-sswsyncd-rpc/Dockerfile +++ b/dockers/docker-mlnx-sswsyncd-rpc/Dockerfile @@ -22,7 +22,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return && dpkg_apt /deps/sx-libnl_*.deb \ && dpkg_apt /deps/iproute2_*.deb \ && dpkg_apt /deps/libsswsdk_*.deb \ - && dpkg_apt /deps/libthrift-0.9.2_*.deb \ + && dpkg_apt /deps/libthrift-0.9.3_*.deb \ && dpkg_apt /deps/libthrift-dev_*.deb RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ diff --git a/dockers/docker-syncd-mlnx-rpc/Dockerfile b/dockers/docker-syncd-mlnx-rpc/Dockerfile index c22145d1d69c..3b891784b226 100644 --- a/dockers/docker-syncd-mlnx-rpc/Dockerfile +++ b/dockers/docker-syncd-mlnx-rpc/Dockerfile @@ -36,7 +36,7 @@ RUN apt-get update \ && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ && dpkg -r syncd \ && dpkg_apt /deps/syncd_*.deb \ - && dpkg_apt /deps/libthrift-0.9.2_*.deb \ + && dpkg_apt /deps/libthrift-0.9.3_*.deb \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ && rm -rf /deps diff --git a/dockers/docker-syncd-rpc/Dockerfile b/dockers/docker-syncd-rpc/Dockerfile index 214230491e34..ed75d1a1f0ec 100644 --- a/dockers/docker-syncd-rpc/Dockerfile +++ b/dockers/docker-syncd-rpc/Dockerfile @@ -36,7 +36,7 @@ RUN apt-get update \ && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ && dpkg -r syncd \ && dpkg_apt /deps/syncd_*.deb \ - && dpkg_apt /deps/libthrift-0.9.2_*.deb \ + && dpkg_apt /deps/libthrift-0.9.3_*.deb \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ && rm -rf /deps From 6888eb74b27632a689b85c8fc6c9518b662780a8 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 30 Nov 2016 15:44:54 -0800 Subject: [PATCH 0101/1833] dockers: Add docker-platform-monitor to make all (#87) --- Makefile | 10 +++++++--- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 1f572c987756..44fde4de25ca 100644 --- a/Makefile +++ b/Makefile @@ -170,6 +170,10 @@ target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-soni docker load < $< $(call build_docker,$(patsubst target/%.gz,%,$@),$@) +target/docker-platform-monitor.gz: target/docker-base.gz + docker load < $< + $(call build_docker,$(patsubst target/%.gz,%,$@),$@) + ## Rules: linux image content deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb mkdir -p `dirname $@` && cp $< $(dir $@) @@ -182,12 +186,12 @@ target/sonic-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_am ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz) +brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz docker-platform-monitor.gz) ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz) +mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz docker-platform-monitor.gz) ## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -cavm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz) +cavm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz docker-platform-monitor.gz) p4-all: $(addprefix target/,docker-sonic-p4.gz) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 494b231a6658..96bcb6382a12 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 494b231a6658a5b21b71e35ab0f078701e938742 +Subproject commit 96bcb6382a12d789830d848fe05681ee75238162 diff --git a/src/sonic-swss b/src/sonic-swss index 02621bcdb568..05bac483585d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 02621bcdb5689450446ea0d618a879a110af86c7 +Subproject commit 05bac483585dd5e564ed5db43efb1020fa25c703 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 947fa0733965..136aca5ff74d 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 947fa0733965450ad5b108cfd17a251ae3b7b709 +Subproject commit 136aca5ff74d7082d0a1def8b02032689ce3507e From 923b13afb4894fc8ec65b465be8e55789aba8f19 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 30 Nov 2016 17:03:09 -0800 Subject: [PATCH 0102/1833] src: Remove libjemalloc-dev from hiredis build.sh (#88) libjemalloc-dev is installed in sonic-slave --- src/hiredis/build.sh | 2 -- src/redis/build.sh | 1 - 2 files changed, 3 deletions(-) diff --git a/src/hiredis/build.sh b/src/hiredis/build.sh index de8ab036f06c..fbaed5f15028 100755 --- a/src/hiredis/build.sh +++ b/src/hiredis/build.sh @@ -1,7 +1,5 @@ #!/bin/bash -x -sudo apt-get install -y libjemalloc-dev - # Install redis-server sudo dpkg -i redis/*.deb diff --git a/src/redis/build.sh b/src/redis/build.sh index b69a707d3cad..b0727c03a1f6 100755 --- a/src/redis/build.sh +++ b/src/redis/build.sh @@ -5,7 +5,6 @@ REDIS_VERION_FULL=$REDIS_VERION-1~bpo8+1 wget -O redis_$REDIS_VERION.orig.tar.gz -N "https://sonicstorage.blob.core.windows.net/packages/redis_$REDIS_VERION.orig.tar.gz?sv=2015-04-05&sr=b&sig=B3qGEoSHe%2FBh5rVwvXHpKijgBtKF7dHeuJWp1p17UnU%3D&se=2026-11-26T22%3A31%3A31Z&sp=r" wget -O redis_$REDIS_VERION_FULL.dsc -N "https://sonicstorage.blob.core.windows.net/packages/redis_$REDIS_VERION_FULL.dsc?sv=2015-04-05&sr=b&sig=LoUtjLXa%2BCcoM%2BsPewRLkY7YPRvSJTbsvQoW%2BL%2B3QWM%3D&se=2026-11-26T22%3A32%3A11Z&sp=r" - wget -O redis_$REDIS_VERION_FULL.debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/redis_$REDIS_VERION_FULL.debian.tar.xz?sv=2015-04-05&sr=b&sig=I33UsbDHiffEkQRndpFwY9y3I%2FrKTu0wmG%2FMXB98kys%3D&se=2026-11-26T22%3A32%3A34Z&sp=r" dpkg-source -x redis_$REDIS_VERION_FULL.dsc From b68ec0eee86d2a50dbf845ec52ce6903387d949b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 1 Dec 2016 02:18:59 -0800 Subject: [PATCH 0103/1833] Split script: push_docker.sh (#89) --- build_docker.sh | 42 ++++++------------------------------------ push_docker.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 36 deletions(-) create mode 100755 push_docker.sh diff --git a/build_docker.sh b/build_docker.sh index 18402a2e51f9..ec07698d6615 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -52,10 +52,7 @@ shift "$((OPTIND - 1))" ## Dockerfile directory DOCKER_BUILD_DIR=dockers/$1 -REGISTRY_SERVER=$2 -REGISTRY_PORT=$3 -REGISTRY_USERNAME=$4 -REGISTRY_PASSWD=$5 +shift 1 [ -f "$DOCKER_BUILD_DIR"/Dockerfile ] || { echo "Invalid DOCKER_BUILD_DIR directory" >&2 @@ -66,16 +63,6 @@ REGISTRY_PASSWD=$5 docker_image_name=$(basename $DOCKER_BUILD_DIR) } -[ ${BUILD_NUMBER} ] || { - echo "No BUILD_NUMBER found, setting to 0." - BUILD_NUMBER="0" -} - -remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$docker_image_tag -timestamp="$(date -u +%Y%m%d)" -build_version="${timestamp}.${BUILD_NUMBER}" -build_remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$build_version - ## Copy dependencies ## Note: Dockerfile ADD doesn't support reference files outside the folder, so copy it locally if ls deps/* 1>/dev/null 2>&1; then @@ -112,27 +99,10 @@ if [ "$docker_image_name" = "docker-base" ]; then docker rmi -f $image_id || true fi -image_sha='' -if [ -n "$REGISTRY_SERVER" ] && [ -n "$REGISTRY_PORT" ]; then - ## Add registry information as tag, so will push as latest - ## Add additional tag with build information - ## Temporarily add -f option to prevent error message of Docker engine version < 1.10.0 - docker tag $docker_image_name $remote_image_name - docker tag $docker_image_name $build_remote_image_name +## Save the docker image in a gz file +mkdir -p target +docker save $docker_image_name | gzip -c > target/$docker_image_name.gz - ## Login the docker image registry server - ## Note: user name and password are passed from command line - docker login -u $REGISTRY_USERNAME -p "$REGISTRY_PASSWD" $REGISTRY_SERVER:$REGISTRY_PORT - - ## Push image to registry server - ## And get the image digest SHA256 - trap_push "docker rmi $remote_image_name || true" - trap_push "docker rmi $build_remote_image_name || true" - image_sha=$(docker push $remote_image_name | sed -n "s/.*: digest: sha256:\([0-9a-f]*\).*/\\1/p") - docker push $build_remote_image_name +if [ -n "$1" ]; then + ./push_docker.sh target/$docker_image_name.gz $@ $docker_image_tag fi - -mkdir -p target -rm -f target/$docker_image_name.*.gz -docker save $docker_image_name | gzip -c > target/$docker_image_name.$build_version.gz -echo "Image sha256: $image_sha" diff --git a/push_docker.sh b/push_docker.sh new file mode 100755 index 000000000000..154a64739b83 --- /dev/null +++ b/push_docker.sh @@ -0,0 +1,42 @@ +DOCKER_IMAGE_FILE=$1 +REGISTRY_SERVER=$2 +REGISTRY_PORT=$3 +REGISTRY_USERNAME=$4 +REGISTRY_PASSWD=$5 +DOCKER_IMAGE_TAG=$6 + +set -e +docker load < $DOCKER_IMAGE_FILE + +## Fetch the Jenkins build number if inside it +[ ${BUILD_NUMBER} ] || { + echo "No BUILD_NUMBER found, setting to 0." + BUILD_NUMBER="0" +} + +## Prepare tag +docker_image_name=$(basename $DOCKER_IMAGE_FILE | cut -d. -f1) +remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$DOCKER_IMAGE_TAG +timestamp="$(date -u +%Y%m%d)" +build_version="${timestamp}.${BUILD_NUMBER}" +build_remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$build_version + +## Add registry information as tag, so will push as latest +## Add additional tag with build information +## Temporarily add -f option to prevent error message of Docker engine version < 1.10.0 +docker tag $docker_image_name $remote_image_name +docker tag $docker_image_name $build_remote_image_name + +## Login the docker image registry server +## Note: user name and password are passed from command line +docker login -u $REGISTRY_USERNAME -p "$REGISTRY_PASSWD" $REGISTRY_SERVER:$REGISTRY_PORT + +## Push image to registry server +## And get the image digest SHA256 +echo "Pushing $remote_image_name" +image_sha=$(docker push $remote_image_name | sed -n "s/.*: digest: sha256:\([0-9a-f]*\).*/\\1/p") +docker rmi $remote_image_name || true +echo "Image sha256: $image_sha" +echo "Pushing $build_remote_image_name" +docker push $build_remote_image_name +docker rmi $build_remote_image_name || true From c4f0833dac48c3ca15b2d50e1bafac63e58340aa Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 1 Dec 2016 10:41:29 -0800 Subject: [PATCH 0104/1833] push_docker.sh: Remove deprecated comments (#90) --- push_docker.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/push_docker.sh b/push_docker.sh index 154a64739b83..156502ddfb7e 100755 --- a/push_docker.sh +++ b/push_docker.sh @@ -23,7 +23,6 @@ build_remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name:$buil ## Add registry information as tag, so will push as latest ## Add additional tag with build information -## Temporarily add -f option to prevent error message of Docker engine version < 1.10.0 docker tag $docker_image_name $remote_image_name docker tag $docker_image_name $build_remote_image_name From 154b281cfba60eef1aa932c3be7177f5e31d3118 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 1 Dec 2016 13:50:46 -0800 Subject: [PATCH 0105/1833] add instruction to pull sonic-slave image from docker registry --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 11171ecefe96..37be054f15c2 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,13 @@ Build a docker image by [the Dockerfile](https://github.com/Azure/sonic-build-to cd sonic-build-tools ./build.sh sonic-slave docker run -v /var/run/docker.sock:/var/run/docker.sock -it --privileged local/sonic-slave bash - + +You can also download sonic-slave docker from sonicdev docker registry using following command: + + docker login -u 1dafc8d7-d19c-4f58-8653-e8d904f30dab -p sonic sonicdev-microsoft.azurecr.io:443 + docker pull sonicdev-microsoft.azurecr.io:443/sonic-slave + docker run -v /var/run/docker.sock:/var/run/docker.sock -it --privileged sonicdev-microsoft.azurecr.io:443/sonic-slave bash + Note that all the below steps should be executed in the docker container, not in the host machine. ## 2. Clone or fetch the code repository with all git submodules From e9098b99fb0f39924a6de13167f6d95f8bd61fb8 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 5 Dec 2016 21:12:19 +0200 Subject: [PATCH 0106/1833] Build improvements (#80) * Build improvements Fix dependencies Add configuration options Automatically build sonic-slave * Set default number of jobs to 1 * Auto generate target/debs directory Signed-off-by: marian-pritsak * Automatically remove sonic-slave container after exit * Silence clean-logs * Add SONIC_CLEAN_TARGETS to clean * Use second expansion for clean dependencies * Avoid creating empty log files Remove log file on flush instead of writing empty string * Put dpkg install inside lock Use same lock as debian install targets do to avoid race condition in dpkg installation * Remove redirect to log from docker save * Add .platform dependency to all and clean targets * Remove header and footer from clean targets * Disable messages for SONIC_CLEAN_TARGETS * Exit with error if dpkg-buildpackage fails * Set new location for debs in build_debian.sh * Add recipe for docker-database * Update redis version to 3.2.4 * Add support for p4 platform * Add recipe for snmpd * Add slave targets to phony and make all target default * Remove build.sh from thrift * Add versioning to team, nl, hiredis and initramfs * Change sonic-slave to support snmpd build from sources * Remove src/tenjin * Add recipe for lldpd * Add recipe for mpdecimal * Remove hiredis directory on rebuild * Add recipe for Mellanox hw management * Remove generic image from all targets for Mellanox * Add support for python wheels * Add lldp and snmp dockers * Sync docker-database to include libjemalloc * Fix asyncsnmp variable name * Change default build configuration Redirect output to log files by default Set number of jobs to nproc value Do not print dependencies Fix logging to print log of failed job into console * Use docker inspect to check if sonic-slave image exists * Use config in slave.mk directly * Disable color output by default * Remove sswsdk dependency from lldp and snmp dockers * Fix comment in py wheels install targets * Add dependency between two versions of sswsdk * Add containers to mellanox platform lldp, snmp and database containers * Add recipe for team docker * Add team docker to mellanox platform * Encrypt password passed to build_debian.sh * Update mellanox SAI version Make version and revision setting only in main recipe * Fix error handling in makefiles As makefiles use .ONESHELL we should add -e option to shell options in order to exit after any command fails * Add recipe for platform monitor image * Add platfotm monitor to mellanox targets * Ignore submodules when building base image --- .gitmodules | 8 +- Makefile | 216 ++---------- build_debian.sh | 4 +- build_image.sh | 2 +- dockers/docker-base | 2 +- dockers/docker-database/Dockerfile | 19 -- dockers/docker-database/Dockerfile.template | 19 ++ dockers/docker-fpm/Dockerfile | 24 -- dockers/docker-fpm/Dockerfile.template | 16 + dockers/docker-lldp-sv2/Dockerfile | 23 -- dockers/docker-lldp-sv2/Dockerfile.template | 23 ++ dockers/docker-orchagent/Dockerfile | 29 -- dockers/docker-orchagent/Dockerfile.template | 18 + .../{Dockerfile => Dockerfile.template} | 21 +- dockers/docker-sonic-p4/Dockerfile | 33 -- dockers/docker-team/Dockerfile | 23 -- dockers/docker-team/Dockerfile.template | 15 + platform/broadcom/rules.mk | 20 ++ platform/cavium/rules.mk | 21 ++ platform/mellanox/docker-syncd-mlnx.mk | 8 + .../docker-syncd-mlnx/Dockerfile.template | 20 ++ .../docker-syncd-mlnx/mlnx-fw-upgrade.sh | 53 +++ platform/mellanox/docker-syncd-mlnx/start.sh | 21 ++ platform/mellanox/fw.mk | 5 + platform/mellanox/hw-management.mk | 9 + platform/mellanox/hw-management/Makefile | 17 + platform/mellanox/mft.mk | 8 + platform/mellanox/mft/Makefile | 32 ++ platform/mellanox/mlnx-sai.mk | 12 + platform/mellanox/mlnx-sai/Makefile | 21 ++ platform/mellanox/rules.mk | 21 ++ platform/mellanox/sdk.mk | 49 +++ platform/p4/docker-sonic-p4.mk | 7 + .../p4/docker-sonic-p4/Dockerfile.template | 20 ++ .../p4}/docker-sonic-p4/port_config.ini | 0 .../p4}/docker-sonic-p4/rsyslog.conf | 0 .../p4}/docker-sonic-p4/startup.sh | 0 platform/p4/p4-bmv.mk | 7 + .../p4/p4-bmv}/behavioral-model | 0 platform/p4/p4-hlir.mk | 5 + {src => platform/p4}/p4-hlir/p4-hlir | 0 platform/p4/p4-switch.mk | 7 + platform/p4/p4-switch/Makefile | 17 + {src => platform/p4}/p4-switch/switch | 0 platform/p4/p4c-bm.mk | 7 + {src => platform/p4}/p4c-bm/p4c-bm | 0 platform/p4/rules.mk | 6 + platform/p4/tenjin.mk | 5 + platform/p4/tenjin/Makefile | 19 ++ rules/asyncsnmp-py3.mk | 7 + rules/config | 33 ++ rules/dbsyncd-py2.mk | 7 + rules/docker-base.mk | 6 + rules/docker-database.mk | 7 + rules/docker-fpm.mk | 7 + rules/docker-lldp-sv2.mk | 8 + rules/docker-orchagent.mk | 7 + rules/docker-platform-monitor.mk | 7 + rules/docker-snmp-sv2.mk | 8 + rules/docker-team.mk | 7 + rules/functions | 103 ++++++ rules/hiredis.mk | 18 + rules/initramfs-tools.mk | 8 + rules/libnl3.mk | 44 +++ rules/libteam.mk | 21 ++ rules/linux-kernel.mk | 9 + rules/lldpd.mk | 12 + rules/mpdecimal.mk | 13 + rules/quagga.mk | 6 + rules/redis.mk | 15 + rules/sairedis.mk | 20 ++ rules/snmpd.mk | 53 +++ rules/sonic-aboot.mk | 6 + rules/sonic-generic.mk | 6 + rules/sswsdk-py2.mk | 6 + rules/sswsdk-py3.mk | 8 + rules/swss-common.mk | 13 + rules/swss.mk | 9 + rules/thrift.mk | 17 + slave.mk | 311 ++++++++++++++++++ sonic-slave/Dockerfile | 105 ++++++ sonic-slave/sonic-jenkins-id_rsa.pub | 1 + src/Makefile | 214 ------------ src/brcm-sdk/filelist.txt | 7 - src/cavm-sdk/filelist.txt | 7 - src/hiredis/Makefile | 22 ++ src/hiredis/build.sh | 12 - src/initramfs-tools/Makefile | 21 ++ src/initramfs-tools/build.sh | 19 -- src/libnl3/Makefile | 35 ++ src/libnl3/build.sh | 23 -- src/libteam/Makefile | 31 ++ src/libteam/build.sh | 26 -- src/mft/build.sh | 22 -- src/mlnx-sdk/filelist.txt | 24 -- src/mpdecimal/Makefile | 22 ++ src/mpdecimal/build.sh | 20 -- src/p4-bmv2/build.sh | 5 - src/p4-hlir/build.sh | 7 - src/p4-switch/build.sh | 17 - src/p4c-bm/build.sh | 7 - src/redis/Makefile | 24 ++ src/redis/build.sh | 14 - src/snmpd/Makefile | 31 ++ src/snmpd/build.sh | 19 -- src/tenjin/build.sh | 8 - src/thrift/Makefile | 27 ++ src/thrift/build.sh | 10 - 108 files changed, 1675 insertions(+), 819 deletions(-) delete mode 100755 dockers/docker-database/Dockerfile create mode 100644 dockers/docker-database/Dockerfile.template delete mode 100755 dockers/docker-fpm/Dockerfile create mode 100644 dockers/docker-fpm/Dockerfile.template delete mode 100644 dockers/docker-lldp-sv2/Dockerfile create mode 100644 dockers/docker-lldp-sv2/Dockerfile.template delete mode 100755 dockers/docker-orchagent/Dockerfile create mode 100755 dockers/docker-orchagent/Dockerfile.template rename dockers/docker-snmp-sv2/{Dockerfile => Dockerfile.template} (61%) delete mode 100644 dockers/docker-sonic-p4/Dockerfile delete mode 100644 dockers/docker-team/Dockerfile create mode 100644 dockers/docker-team/Dockerfile.template create mode 100644 platform/broadcom/rules.mk create mode 100644 platform/cavium/rules.mk create mode 100644 platform/mellanox/docker-syncd-mlnx.mk create mode 100755 platform/mellanox/docker-syncd-mlnx/Dockerfile.template create mode 100755 platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh create mode 100755 platform/mellanox/docker-syncd-mlnx/start.sh create mode 100644 platform/mellanox/fw.mk create mode 100644 platform/mellanox/hw-management.mk create mode 100644 platform/mellanox/hw-management/Makefile create mode 100644 platform/mellanox/mft.mk create mode 100644 platform/mellanox/mft/Makefile create mode 100644 platform/mellanox/mlnx-sai.mk create mode 100644 platform/mellanox/mlnx-sai/Makefile create mode 100644 platform/mellanox/rules.mk create mode 100644 platform/mellanox/sdk.mk create mode 100644 platform/p4/docker-sonic-p4.mk create mode 100644 platform/p4/docker-sonic-p4/Dockerfile.template rename {dockers => platform/p4}/docker-sonic-p4/port_config.ini (100%) rename {dockers => platform/p4}/docker-sonic-p4/rsyslog.conf (100%) rename {dockers => platform/p4}/docker-sonic-p4/startup.sh (100%) create mode 100644 platform/p4/p4-bmv.mk rename {src/p4-bmv2 => platform/p4/p4-bmv}/behavioral-model (100%) create mode 100644 platform/p4/p4-hlir.mk rename {src => platform/p4}/p4-hlir/p4-hlir (100%) create mode 100644 platform/p4/p4-switch.mk create mode 100644 platform/p4/p4-switch/Makefile rename {src => platform/p4}/p4-switch/switch (100%) create mode 100644 platform/p4/p4c-bm.mk rename {src => platform/p4}/p4c-bm/p4c-bm (100%) create mode 100644 platform/p4/rules.mk create mode 100644 platform/p4/tenjin.mk create mode 100644 platform/p4/tenjin/Makefile create mode 100644 rules/asyncsnmp-py3.mk create mode 100644 rules/config create mode 100644 rules/dbsyncd-py2.mk create mode 100644 rules/docker-base.mk create mode 100644 rules/docker-database.mk create mode 100644 rules/docker-fpm.mk create mode 100644 rules/docker-lldp-sv2.mk create mode 100644 rules/docker-orchagent.mk create mode 100644 rules/docker-platform-monitor.mk create mode 100644 rules/docker-snmp-sv2.mk create mode 100644 rules/docker-team.mk create mode 100644 rules/functions create mode 100644 rules/hiredis.mk create mode 100644 rules/initramfs-tools.mk create mode 100644 rules/libnl3.mk create mode 100644 rules/libteam.mk create mode 100644 rules/linux-kernel.mk create mode 100644 rules/lldpd.mk create mode 100644 rules/mpdecimal.mk create mode 100644 rules/quagga.mk create mode 100644 rules/redis.mk create mode 100644 rules/sairedis.mk create mode 100644 rules/snmpd.mk create mode 100644 rules/sonic-aboot.mk create mode 100644 rules/sonic-generic.mk create mode 100644 rules/sswsdk-py2.mk create mode 100644 rules/sswsdk-py3.mk create mode 100644 rules/swss-common.mk create mode 100644 rules/swss.mk create mode 100644 rules/thrift.mk create mode 100644 slave.mk create mode 100644 sonic-slave/Dockerfile create mode 100644 sonic-slave/sonic-jenkins-id_rsa.pub delete mode 100644 src/Makefile delete mode 100644 src/brcm-sdk/filelist.txt delete mode 100644 src/cavm-sdk/filelist.txt create mode 100644 src/hiredis/Makefile delete mode 100755 src/hiredis/build.sh create mode 100644 src/initramfs-tools/Makefile delete mode 100755 src/initramfs-tools/build.sh create mode 100644 src/libnl3/Makefile delete mode 100755 src/libnl3/build.sh create mode 100644 src/libteam/Makefile delete mode 100755 src/libteam/build.sh delete mode 100755 src/mft/build.sh delete mode 100644 src/mlnx-sdk/filelist.txt create mode 100644 src/mpdecimal/Makefile delete mode 100755 src/mpdecimal/build.sh delete mode 100755 src/p4-bmv2/build.sh delete mode 100755 src/p4-hlir/build.sh delete mode 100755 src/p4-switch/build.sh delete mode 100755 src/p4c-bm/build.sh create mode 100644 src/redis/Makefile delete mode 100755 src/redis/build.sh create mode 100644 src/snmpd/Makefile delete mode 100755 src/snmpd/build.sh delete mode 100755 src/tenjin/build.sh create mode 100644 src/thrift/Makefile delete mode 100755 src/thrift/build.sh diff --git a/.gitmodules b/.gitmodules index 54f3671effee..8db0758ed28c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,16 +14,16 @@ path = src/sonic-swss url = https://github.com/Azure/sonic-swss [submodule "src/p4-switch/switch"] - path = src/p4-switch/switch + path = platform/p4/p4-switch/switch url = https://github.com/lguohan/switch [submodule "src/p4-bmv2/behavioral-model"] - path = src/p4-bmv2/behavioral-model + path = platform/p4/p4-bmv/behavioral-model url = https://github.com/lguohan/behavioral-model [submodule "src/p4c-bm/p4c-bm"] - path = src/p4c-bm/p4c-bm + path = platform/p4/p4c-bm/p4c-bm url = https://github.com/krambn/p4c-bm [submodule "src/p4-hlir/p4-hlir"] - path = src/p4-hlir/p4-hlir + path = platform/p4/p4-hlir/p4-hlir url = https://github.com/p4lang/p4-hlir [submodule "quagga"] path = src/sonic-quagga diff --git a/Makefile b/Makefile index 44fde4de25ca..f68e8de4bbca 100644 --- a/Makefile +++ b/Makefile @@ -1,197 +1,39 @@ -## TODO: if install dev package really happens, rebuild the depending project +############################################################################### +## Wrapper for starting make inside sonic-slave container +############################################################################### -## Arguments from make command line -USERNAME= -PASSWORD_ENCRYPTED= +SHELL = /bin/bash -## Redis server/tools version -REDIS_VERSION=3.2.4-1~bpo8+1_amd64 +USER := $(shell id -un) +PWD := $(shell pwd) -## Select bash for commands -SHELL := /bin/bash +MAKEFLAGS += -B -## Capture all the files in SDK directories -MLNX-SDK-DEBS=$(notdir $(wildcard src/mlnx-sdk/*.deb)) -BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb)) -CAVM-SDK-DEBS=$(notdir $(wildcard src/cavm-sdk/*.deb)) +DOCKER_RUN := docker run --rm=true --privileged \ + -v $(PWD):/sonic \ + -it sonic-slave-$(USER) -LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-3-dev_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-genl-3-dev_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb libnl-route-3-dev_3.2.27-1_amd64.deb libnl-nf-3-200_3.2.27-1_amd64.deb libnl-nf-3-dev_3.2.27-1_amd64.deb libnl-cli-3-200_3.2.27-1_amd64.deb libnl-cli-3-dev_3.2.27-1_amd64.deb +DOCKER_BUILD = docker build --no-cache \ + --build-arg user=$(USER) \ + --build-arg uid=$(shell id -u) \ + --build-arg guid=$(shell id -g) \ + -t sonic-slave-$(USER) \ + sonic-slave -LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb libteamdctl0_1.26-1_amd64.deb libteam-dev_1.26-1_amd64.deb libteam-utils_1.26-1_amd64.deb +.PHONY: sonic-slave-build sonic-slave-bash -## Function: build_docker, image_name save_file -## build a docker image and save to a file -define build_docker - docker build --no-cache -t $(1) dockers/$(1) - mkdir -p `dirname $(2)` - docker save $(1) | gzip -c > $(2) -endef +.DEFAULT_GOAL := all -## Rules: phony targets -.phony : brcm-all mlnx-all cavm-all p4-all +%:: + @docker inspect --type image sonic-slave-$(USER) &> /dev/null || $(DOCKER_BUILD) + @$(DOCKER_RUN) make \ + -C sonic \ + -f slave.mk \ + PLATFORM=$(PLATFORM) \ + $@ -## Rules: redirect to sub directory -src/%: - $(MAKE) \ - REDIS_VERSION=$(REDIS_VERSION) \ - LIBNL-DEBS="$(LIBNL-DEBS)" \ - LIBTEAM-DEBS="$(LIBTEAM-DEBS)" \ - -C src $(subst src/,,$@) +sonic-slave-build : + @$(DOCKER_BUILD) -## Rules: docker-snmp-sv2 -dockers/docker-snmp-sv2/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-snmp-sv2/deps/python3/%.whl: src/%.whl - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-lldp-sv2 -dockers/docker-lldp-sv2/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-lldp-sv2/deps/%.whl: src/%.whl - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-fpm -dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-fpm/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-team -dockers/docker-team/deps/teamsyncd: src/teamsyncd - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-team/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-orchagent-mlnx -$(addprefix dockers/docker-orchagent-mlnx/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent-mlnx/deps/%.deb : src/mlnx/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-orchagent-mlnx/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-orchagent-cavm -$(addprefix dockers/docker-orchagent-cavm/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent-cavm/deps/%.deb : src/cavm/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-orchagent-cavm/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-orchagent (brcm) -$(addprefix dockers/docker-orchagent/deps/,libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb) : dockers/docker-orchagent/deps/%.deb : src/brcm/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-orchagent/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-syncd-mlnx -$(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -$(addprefix dockers/docker-syncd-mlnx/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-syncd-mlnx/deps/fw-SPC.mfa: src/mlnx-sdk/fw-SPC.mfa - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-syncd-cavm -$(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -$(addprefix dockers/docker-syncd-cavm/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-syncd-cavm/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-syncd (brcm) -$(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -$(addprefix dockers/docker-syncd/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb): dockers/docker-syncd/deps/%.deb : src/brcm/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-syncd/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-database -dockers/docker-database/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker-sonic (p4) -$(addprefix dockers/docker-sonic-p4/deps/,swss_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb) : dockers/docker-sonic-p4/deps/%.deb : src/p4/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -dockers/docker-sonic-p4/deps/%.deb: src/%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) - -## Rules: docker images -target/docker-base.gz: - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-snmp-sv2.gz: target/docker-base.gz $(addprefix dockers/docker-snmp-sv2/deps/,python3/sswsdk-2.0.1-py3-none-any.whl python3/asyncsnmp-2.1.0-py3-none-any.whl libsnmp-base_5.7.3+dfsg-1.5_all.deb libsnmp30_5.7.3+dfsg-1.5_amd64.deb snmp_5.7.3+dfsg-1.5_amd64.deb snmpd_5.7.3+dfsg-1.5_amd64.deb) - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-lldp-sv2.gz: target/docker-base.gz $(addprefix dockers/docker-lldp-sv2/deps/,sswsdk-2.0.1-py2-none-any.whl sonic_d-2.0.0-py2-none-any.whl lldpd_0.9.5-0_amd64.deb) - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) - ## TODO: remove placeholders for the dependencies - touch dockers/docker-syncd/deps/{dsserve,bcmcmd} - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) dockers/docker-syncd-mlnx/deps/fw-SPC.mfa - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-syncd-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb $(LIBNL-DEBS)) - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS)) - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-fpm.gz: target/docker-base.gz $(addprefix dockers/docker-fpm/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2.1_amd64.deb fpmsyncd $(LIBNL-DEBS)) - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-team.gz: target/docker-base.gz $(addprefix dockers/docker-team/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb $(LIBNL-DEBS) $(LIBTEAM-DEBS) teamsyncd) - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-database.gz: target/docker-base.gz $(addprefix dockers/docker-database/deps/,redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb) - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-sonic-p4.gz: target/docker-base.gz $(addprefix dockers/docker-sonic-p4/deps/,libswsscommon_1.0.0_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb quagga_0.99.24.1-2.1_amd64.deb syncd_1.0.0_amd64.deb swss_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb p4-bmv2_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb) - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -target/docker-platform-monitor.gz: target/docker-base.gz - docker load < $< - $(call build_docker,$(patsubst target/%.gz,%,$@),$@) - -## Rules: linux image content -deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) -deps/initramfs-tools_%.deb: src/initramfs-tools/initramfs-tools_%.deb - mkdir -p `dirname $@` && cp $< $(dir $@) - -target/sonic-generic.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb - ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=generic ./build_image.sh -target/sonic-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb - ./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh - -## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -brcm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd.gz docker-orchagent.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz docker-platform-monitor.gz) - -## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -mlnx-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-mlnx.gz docker-orchagent-mlnx.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz docker-platform-monitor.gz) - -## Note: docker-fpm.gz must be the last to build the implicit dependency fpmsyncd -cavm-all: target/sonic-generic.bin $(addprefix target/,docker-syncd-cavm.gz docker-orchagent-cavm.gz docker-fpm.gz docker-team.gz docker-database.gz docker-snmp-sv2.gz docker-lldp-sv2.gz docker-platform-monitor.gz) - -p4-all: $(addprefix target/,docker-sonic-p4.gz) +sonic-slave-bash : + @$(DOCKER_RUN) bash diff --git a/build_debian.sh b/build_debian.sh index 9252646dff4b..185825cf34b7 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -112,9 +112,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'cd /dev && MAKEDEV generic' sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install busybox echo '[INFO] Install SONiC linux kernel image' ## Note: duplicate apt-get command to ensure every line return zero -sudo dpkg --root=$FILESYSTEM_ROOT -i deps/initramfs-tools_*.deb || \ +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/initramfs-tools_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f -sudo dpkg --root=$FILESYSTEM_ROOT -i deps/linux-image-3.16.0-4-amd64_*.deb || \ +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-3.16.0-4-amd64_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f ## Update initramfs for booting with squashfs+aufs diff --git a/build_image.sh b/build_image.sh index 887d63ae049f..fd189ab9a38e 100755 --- a/build_image.sh +++ b/build_image.sh @@ -13,7 +13,7 @@ } ## Retrieval short version of Git revision hash for partition metadata -[ -z "$(git status --untracked-files=no -s)" ] || { +[ -z "$(git status --untracked-files=no -s --ignore-submodules)" ] || { echo "Error: There is local changes not committed to git repo. Cannot get a revision hash for partition metadata." exit 1 } diff --git a/dockers/docker-base b/dockers/docker-base index dfb5c2f46bf9..73b5fcee2840 160000 --- a/dockers/docker-base +++ b/dockers/docker-base @@ -1 +1 @@ -Subproject commit dfb5c2f46bf982207c8dbc2c5af589a0ba1b3ddc +Subproject commit 73b5fcee2840adcc64bee5e6ffb226a9928959e4 diff --git a/dockers/docker-database/Dockerfile b/dockers/docker-database/Dockerfile deleted file mode 100755 index 445ac44b12b0..000000000000 --- a/dockers/docker-database/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM docker-base - -COPY ["deps/redis-tools_*.deb", "deps/redis-server_*.deb", "/deps/"] - -## Install packages -## Clean up -RUN apt-get update && \ - dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/redis-tools_*.deb && \ - dpkg_apt /deps/redis-server_*.deb && \ - apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y - -RUN sed -ri 's/^daemonize yes$/daemonize no/; \ - s/^logfile .*$/logfile ""/; \ - s/^# syslog-enabled no$/syslog-enabled no/; \ - s/^# unixsocket/unixsocket/ \ - ' /etc/redis/redis.conf - -ENTRYPOINT service redis-server start diff --git a/dockers/docker-database/Dockerfile.template b/dockers/docker-database/Dockerfile.template new file mode 100644 index 000000000000..adc6dad9330d --- /dev/null +++ b/dockers/docker-database/Dockerfile.template @@ -0,0 +1,19 @@ +FROM docker-base + +RUN apt-get update + +COPY deps/ deps + +SED_DPKG + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +RUN sed -ri 's/^daemonize yes$/daemonize no/; \ + s/^logfile .*$/logfile ""/; \ + s/^# syslog-enabled no$/syslog-enabled no/; \ + s/^# unixsocket/unixsocket/ \ + ' /etc/redis/redis.conf + +ENTRYPOINT service redis-server start diff --git a/dockers/docker-fpm/Dockerfile b/dockers/docker-fpm/Dockerfile deleted file mode 100755 index ca5b811f1949..000000000000 --- a/dockers/docker-fpm/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM docker-base - -RUN apt-get update - -COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/quagga_*", "/deps/"] - -## Get fpmsyncd -## Get Quagga -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/libhiredis0.13*.deb \ - && dpkg_apt /deps/libnl-3-200_*.deb \ - && dpkg_apt /deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /deps/libnl-route-3-200_*.deb \ - && dpkg_apt /deps/libswsscommon_*.deb \ - && dpkg_apt /deps/quagga_*.deb - -COPY ["deps/fpmsyncd", "start.sh", "/usr/bin/"] - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps - -ENTRYPOINT /usr/bin/start.sh \ - && /bin/bash diff --git a/dockers/docker-fpm/Dockerfile.template b/dockers/docker-fpm/Dockerfile.template new file mode 100644 index 000000000000..d09a81a25155 --- /dev/null +++ b/dockers/docker-fpm/Dockerfile.template @@ -0,0 +1,16 @@ +FROM docker-base + +RUN apt-get update + +RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 + +COPY deps/ deps + +SED_DPKG + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT /usr/bin/start.sh \ + && /bin/bash diff --git a/dockers/docker-lldp-sv2/Dockerfile b/dockers/docker-lldp-sv2/Dockerfile deleted file mode 100644 index 727d4ce38c56..000000000000 --- a/dockers/docker-lldp-sv2/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM docker-base - -COPY deps/sswsdk*.whl deps/sonic_d*.whl deps/lldpd_*.deb /deps/ - -## Pre-install the fundamental packages -## Install Python SSWSDK -## Install LLDP Sync Daemon -## Note: dpkg_apt function has the benefit to detect missing .deb file -## Clean up -RUN apt-get update && \ - dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ - dpkg_apt /deps/lldpd_*.deb && \ - apt-get install -y python-pip supervisor && \ - pip install /deps/sswsdk*.whl && \ - pip install /deps/sonic_d*.whl && \ - apt-get remove -y python-pip && \ - apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ - rm -rf /deps ~/.cache - -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY reconfigure.sh /opt/reconfigure.sh - -ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-lldp-sv2/Dockerfile.template b/dockers/docker-lldp-sv2/Dockerfile.template new file mode 100644 index 000000000000..da1717f81918 --- /dev/null +++ b/dockers/docker-lldp-sv2/Dockerfile.template @@ -0,0 +1,23 @@ +FROM docker-base + +COPY deps /deps +COPY python-wheels /python-wheels + +RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 + +## Pre-install the fundamental packages +## Install Python SSWSDK +## Install LLDP Sync Daemon + +SED_DPKG + +RUN pip install /python-wheels/sswsdk-2.0.1-py2-none-any.whl && \ + pip install /python-wheels/sonic_d-2.0.0-py2-none-any.whl && \ + apt-get remove -y python-pip && \ + apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ + rm -rf /deps /python-wheels ~/.cache + +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY reconfigure.sh /opt/reconfigure.sh + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-orchagent/Dockerfile b/dockers/docker-orchagent/Dockerfile deleted file mode 100755 index cc95cf0f7f0b..000000000000 --- a/dockers/docker-orchagent/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM docker-base - -RUN apt-get update - -COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libnl-cli-3-200_*.deb", "deps/libnl-nf-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/libteam5_*.deb", "deps/swss_*.deb", "/deps/"] - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/libhiredis0.13*.deb \ - && dpkg_apt /deps/libnl-3-200_*.deb \ - && dpkg_apt /deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /deps/libnl-route-3-200_*.deb \ - && dpkg_apt /deps/libnl-nf-3-200_*.deb \ - && dpkg_apt /deps/libnl-cli-3-200_*.deb \ - && dpkg_apt /deps/libswsscommon_*.deb \ - && dpkg_apt /deps/libsairedis_*.deb \ - && dpkg_apt /deps/libsaimetadata_*.deb \ - && dpkg_apt /deps/libteam5_*.deb \ - && dpkg_apt /deps/swss_*.deb - -RUN apt-get install -f -y ifupdown bridge-utils redis-tools - -COPY start.sh /usr/bin/start.sh - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps - -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-orchagent/Dockerfile.template b/dockers/docker-orchagent/Dockerfile.template new file mode 100755 index 000000000000..04979db4d9d6 --- /dev/null +++ b/dockers/docker-orchagent/Dockerfile.template @@ -0,0 +1,18 @@ +FROM docker-base + +RUN apt-get update + +RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansson4 + +COPY deps /deps + +SED_DPKG + +COPY start.sh /usr/bin/start.sh + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-snmp-sv2/Dockerfile b/dockers/docker-snmp-sv2/Dockerfile.template similarity index 61% rename from dockers/docker-snmp-sv2/Dockerfile rename to dockers/docker-snmp-sv2/Dockerfile.template index 68a2ae0e7f25..876a7aca3445 100644 --- a/dockers/docker-snmp-sv2/Dockerfile +++ b/dockers/docker-snmp-sv2/Dockerfile.template @@ -1,7 +1,7 @@ FROM docker-base -COPY deps/snmp_*.deb deps/snmpd_*.deb deps/libsnmp-base_*.deb deps/libsnmp30_*.deb /deps/ -COPY deps/python3/*.whl /python3/ +COPY deps /deps +COPY python-wheels /python-wheels # enable -O for all Python calls ENV PYTHONOPTIMIZE 1 @@ -9,15 +9,12 @@ ENV PYTHONOPTIMIZE 1 ## Pre-install the fundamental packages ## Install Python SSWSDK (SNMP subagent dependency) ## Install SNMP subagent -## Note: dpkg_apt function has the benefit to detect missing .deb file ## Clean up -RUN apt-get update && \ - dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ - dpkg_apt /deps/libsnmp-base_*.deb && \ - dpkg_apt /deps/libsnmp30_*.deb && \ - dpkg_apt /deps/snmp_*.deb && \ - dpkg_apt /deps/snmpd_*.deb && \ - rm -rf /deps +RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev + +SED_DPKG + +RUN rm -rf /deps # install subagent RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ @@ -28,8 +25,8 @@ RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ make && make install && \ ldconfig && \ cd .. && rm -rf Python-3.5.2 && rm Python-3.5.2.tgz && \ - pip3 install --no-cache-dir /python3/*py3*.whl hiredis && \ - rm -rf /python3 && \ + pip3 install --no-cache-dir /python-wheels/*py3*.whl hiredis && \ + rm -rf /python-wheels && \ python3 -m sonic_ax_impl install && \ python3 -m pip uninstall -y pip setuptools && \ /bin/bash -c "rm -rf /usr/lib/python3.5/{unittest,lib2to3,tkinter,idlelib,email,test}" && \ diff --git a/dockers/docker-sonic-p4/Dockerfile b/dockers/docker-sonic-p4/Dockerfile deleted file mode 100644 index a0c7cc99219e..000000000000 --- a/dockers/docker-sonic-p4/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM docker-base - -RUN apt-get update - -RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils - -COPY ["deps/libthrift-0.9.3_*.deb", "deps/libhiredis0.13*.deb", "deps/redis-tools_*.deb", "deps/redis-server_*.deb", "deps/libswsscommon_*.deb", "deps/p4-bmv2_*.deb", "deps/p4-switch_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/syncd_*.deb", "deps/swss_*.deb", "deps/quagga_*.deb", "/deps/"] - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libthrift-0.9.3_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/redis-tools_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/redis-server_*.deb - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/p4-bmv2_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/p4-switch_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsaimetadata_*.deb - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/swss_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb - -ADD port_config.ini /port_config.ini -ADD startup.sh /scripts/startup.sh - -ADD rsyslog.conf /etc/rsyslog.conf - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps - -ENTRYPOINT /bin/bash diff --git a/dockers/docker-team/Dockerfile b/dockers/docker-team/Dockerfile deleted file mode 100644 index 607a990b4f23..000000000000 --- a/dockers/docker-team/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM docker-base - -COPY ["deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libnl-nf-3-200_*.deb", "deps/libnl-cli-3-200_*.deb", "deps/libteam5_*.deb", "deps/libteam-utils_*.deb", "deps/libteamdctl0_*.deb", "deps/libhiredis0.13_*.deb", "deps/libswsscommon_*.deb", "/deps/"] - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/libnl-3-200_*.deb \ - && dpkg_apt /deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /deps/libnl-route-3-200_*.deb \ - && dpkg_apt /deps/libnl-nf-3-200_*.deb \ - && dpkg_apt /deps/libnl-cli-3-200_*.deb \ - && dpkg_apt /deps/libteam5_*.deb \ - && dpkg_apt /deps/libteam-utils_*.deb \ - && dpkg_apt /deps/libteamdctl0_*.deb \ - && dpkg_apt /deps/libhiredis0.13_*.deb \ - && dpkg_apt /deps/libswsscommon_*.deb - -COPY ["deps/teamsyncd", "start.sh", "/usr/bin/"] - -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps - -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-team/Dockerfile.template b/dockers/docker-team/Dockerfile.template new file mode 100644 index 000000000000..487ff3d0434e --- /dev/null +++ b/dockers/docker-team/Dockerfile.template @@ -0,0 +1,15 @@ +FROM docker-base + +RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 + +COPY deps /deps + +SED_DPKG + +COPY start.sh /usr/bin/start.sh + +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk new file mode 100644 index 000000000000..aa5570082911 --- /dev/null +++ b/platform/broadcom/rules.mk @@ -0,0 +1,20 @@ +OPENNSL = libopennsl_6.4.11-1+0~20160719212144.23~1.gbp8ec2d1_amd64.deb +$(OPENNSL)_PATH = $(PLATFORM_PATH)/brcm_sdk +BRCM_SAI = libsaibcm_1.0.2~20160727172452.52_amd64.deb +$(BRCM_SAI)_PATH = $(PLATFORM_PATH)/brcm_sdk +BRCM_SAI_DBG = libsaibcm-dbg_1.0.2~20160727172452.52_amd64.deb +$(BRCM_SAI_DEV)_PATH = $(PLATFORM_PATH)/brcm_sdk +BRCM_SAI_DEV = libsaibcm-dev_1.0.2~20160727172452.52_amd64.deb +$(BRCM_SAI_DBG)_PATH = $(PLATFORM_PATH)/brcm_sdk + +SONIC_COPY_DEBS += $(OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DBG) $(BRCM_SAI_DEV) + +# TODO: Put dependencies for SDK packages + +SONIC_ALL += $(SONIC_GENERIC) $(DOCKER_SYNCD) $(DOCKER_ORCHAGENT) $(DOCKER_FPM) + +# Inject brcm sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(BRCM_LIBSAI) + +# Runtime dependency on brcm sai is set only for syncd +$(SYNCD)_RDEPENDS += $(BRCM_LIBSAI) diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk new file mode 100644 index 000000000000..7d8ef49177d3 --- /dev/null +++ b/platform/cavium/rules.mk @@ -0,0 +1,21 @@ +CAVM_LIBSAI = libsai.deb +$(CAVM_LIBSAI)_PATH = $(PLATFORM_PATH)/cavm_sdk +CAVM_SAI = sai.deb +$(CAVM_SAI)_PATH = $(PLATFORM_PATH)/cavm_sdk +XP_TOOLS = xp-tools.deb +$(XP_TOOLS)_PATH = $(PLATFORM_PATH)/cavm_sdk +XPSHELL = xpshell.deb +$(XPSHELL)_PATH = $(PLATFORM_PATH)/cavm_sdk + +SONIC_COPY_DEBS += $(CAVM_LIBSAI) $(CAVM_SAI) $(XP_TOOLS) $(XPSHELL) + +# TODO: Put dependencies for SDK packages + +SONIC_ALL += $(SONIC_GENERIC) $(DOCKER_SYNCD_CAVM) $(DOCKER_ORCHAGENT) \ + $(DOCKER_FPM) + +# Inject cavm sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(CAVM_LIBSAI) + +# Runtime dependency on cavm sai is set only for syncd +$(SYNCD)_RDEPENDS += $(CAVM_LIBSAI) diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk new file mode 100644 index 000000000000..990ec0f7a4cb --- /dev/null +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -0,0 +1,8 @@ +# docker image for mlnx syncd + +DOCKER_SYNCD_MLNX = docker-syncd-mlnx.gz +$(DOCKER_SYNCD_MLNX)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx +$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(MFT) +$(DOCKER_SYNCD_MLNX)_FILES += $(MLNX_FW) +$(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.template b/platform/mellanox/docker-syncd-mlnx/Dockerfile.template new file mode 100755 index 000000000000..d71245dcd8e3 --- /dev/null +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.template @@ -0,0 +1,20 @@ +FROM docker-base + +RUN apt-get update + +COPY deps /deps + +RUN apt-get install -y libxml2 + +SED_DPKG + +COPY ["start.sh", "/usr/bin/"] +COPY ["mlnx-fw-upgrade.sh", "/usr/bin/"] +COPY ["/deps/fw-SPC.mfa", "/etc/mlnx/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh b/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh new file mode 100755 index 000000000000..2ef46685f801 --- /dev/null +++ b/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +query_retry_count_max="10" +required_fw_version="13.1130.0010" +fw_file=/etc/mlnx/fw-SPC.mfa + +run_or_fail() { + $1 + if [[ $? != 0 ]]; then + echo $1 failed + exit 1 + fi +} + +# wait until devices will be available +query_retry_count="0" +mlxfwmanager --query > /dev/null + +while [[ (${query_retry_count} -lt ${query_retry_count_max}) && ($? -ne "0") ]]; do + sleep 1 + query_retry_count=$[${query_retry_count}+1] + mlxfwmanager --query > /dev/null +done + +run_or_fail "mlxfwmanager --query" > /tmp/mlnxfwmanager-query.txt + +# get current firmware version +found_fw=false +for word in `cat /tmp/mlnxfwmanager-query.txt` +do + if [[ ${found_fw} == true ]]; then + fw_version=${word} + break + fi + if [[ ${word} == FW ]]; then + found_fw=true + fi +done + +if [[ -z ${fw_version} ]]; then + echo "Could not retreive current FW version." + exit 1 +fi + +if [[ ${required_fw_version} == ${fw_version} ]]; then + echo "Mellanox firmware is up to date." +else + echo "Mellanox firmware required version is ${required_fw_version}. Installing compatible version..." + run_or_fail "mlxfwmanager -i ${fw_file} -u -f -y" + + # exit from here so that syncd service will restart + exit 0 +fi diff --git a/platform/mellanox/docker-syncd-mlnx/start.sh b/platform/mellanox/docker-syncd-mlnx/start.sh new file mode 100755 index 000000000000..3c07069ba26e --- /dev/null +++ b/platform/mellanox/docker-syncd-mlnx/start.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +function clean_up { + service syncd stop + service rsyslog stop + exit +} + +trap clean_up SIGTERM SIGKILL + +# fw-upgrade will exit if firmware was actually upgraded or if some error +# occures +. mlnx-fw-upgrade.sh + +# FIXME: the script cannot trap SIGTERM signal and it exits without clean_up +# Remove rsyslogd.pid file manually so that to start the rsyslog instantly +[ -e /var/run/rsyslogd.pid ] && rm /var/run/rsyslogd.pid +service rsyslog start +service syncd start + +read diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk new file mode 100644 index 000000000000..b1e418e697e9 --- /dev/null +++ b/platform/mellanox/fw.mk @@ -0,0 +1,5 @@ +# mellanox firmware + +MLNX_FW = fw-SPC.mfa +$(MLNX_FW)_URL = https://github.com/Mellanox/SAI-Implementation/raw/sonic/sdk/fw-SPC.mfa +SONIC_ONLINE_FILES += $(MLNX_FW) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk new file mode 100644 index 000000000000..6c6ae480db4d --- /dev/null +++ b/platform/mellanox/hw-management.mk @@ -0,0 +1,9 @@ +# Mellanox HW Management + +MLNX_HW_MANAGEMENT_VERSION = 20.7.2016 + +export MLNX_HW_MANAGEMENT_VERSION + +MLNX_HW_MANAGEMENT = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb +$(MLNX_HW_MANAGEMENT)_SRC_PATH = $(PLATFORM_PATH)/hw-management +SONIC_MAKE_DEBS += $(MLNX_HW_MANAGEMENT) diff --git a/platform/mellanox/hw-management/Makefile b/platform/mellanox/hw-management/Makefile new file mode 100644 index 000000000000..8d1dbcb79d0f --- /dev/null +++ b/platform/mellanox/hw-management/Makefile @@ -0,0 +1,17 @@ +.ONESHELL: +SHELL = /bin/bash + +MAIN_TARGET = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # get sources + sudo rm -rf hw-management + wget -N -O mlnx-hw-mgmt-$(MLNX_HW_MANAGEMENT_VERSION).tar.gz https://github.com/Mellanox/mellanox-openswitch/raw/master/hw-mgmt/mlnx-hw-mgmt-$(MLNX_HW_MANAGEMENT_VERSION).tar.gz + tar xzf mlnx-hw-mgmt-$(MLNX_HW_MANAGEMENT_VERSION).tar.gz + + # build + pushd hw-management + sudo debian/rules binary KVERSION=$(KVERSION) + popd + + mv $* $(DEST)/ diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk new file mode 100644 index 000000000000..7dea01789af2 --- /dev/null +++ b/platform/mellanox/mft.mk @@ -0,0 +1,8 @@ +# Mellanox SAI + +MFT = mft-4.5.0-31.amd64.deb +$(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft +SONIC_MAKE_DEBS += $(MFT) + +KERNEL_MFT = kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb +$(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT))) diff --git a/platform/mellanox/mft/Makefile b/platform/mellanox/mft/Makefile new file mode 100644 index 000000000000..a5b1e8609b70 --- /dev/null +++ b/platform/mellanox/mft/Makefile @@ -0,0 +1,32 @@ +.ONESHELL: +SHELL = /bin/bash + +MFT_NAME = mft-4.5.0-31-x86_64-deb +MFT_TGZ = $(MFT_NAME).tgz +KERNELVER = 3.16.0-4-amd64 +SRC_DEB = kernel-mft-dkms_4.5.0-31_all.deb + +MAIN_TARGET = mft-4.5.0-31.amd64.deb +DERIVED_TARGETS = kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf $(MFT_NAME) + wget -O $(MFT_TGZ) http://www.mellanox.com/downloads/MFT/$(MFT_TGZ) + tar xzf $(MFT_TGZ) + pushd $(MFT_NAME)/SDEBS + + # put a lock here because dpkg does not allow installing packages in parallel + while true; do + if mkdir $(DEST)/dpkg_lock &> /dev/null; then + { echo here && sudo dpkg -i $(SRC_DEB) && rm -d $(DEST)/dpkg_lock && break; } || { rm -d $(DEST)/dpkg_lock && exit 1 ; } + fi + done + + tar xvf `sudo dkms mkdriverdisk kernel-mft-dkms/4.5.0 -a all -d ubuntu -k $(KERNELVER) --media tar | grep "Disk image location" | cut -d':' -f2` + popd + + # fix timestamp because we do not actually build tools, only kernel + touch $(MFT_NAME)/DEBS/$* + mv $(MFT_NAME)/SDEBS/ubuntu-drivers/3.16.0/$(DERIVED_TARGETS) $(MFT_NAME)/DEBS/$* $(DEST) + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk new file mode 100644 index 000000000000..917fc8c4dae2 --- /dev/null +++ b/platform/mellanox/mlnx-sai.mk @@ -0,0 +1,12 @@ +# Mellanox SAI + +MLNX_SAI_VERSION = 161120 +MLNX_SAI_REVISION = c7ccc8a8ba9864b62b0c038ad57d6dd94771f5ee + +export MLNX_SAI_VERSION MLNX_SAI_REVISION + +MLNX_SAI = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb +$(MLNX_SAI)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sai +$(MLNX_SAI)_DEPENDS += $(MLNX_SDK_DEBS) +$(MLNX_SAI)_RDEPENDS += $(MLNX_SDK_RDEBS) +SONIC_MAKE_DEBS += $(MLNX_SAI) diff --git a/platform/mellanox/mlnx-sai/Makefile b/platform/mellanox/mlnx-sai/Makefile new file mode 100644 index 000000000000..9a8005e5461f --- /dev/null +++ b/platform/mellanox/mlnx-sai/Makefile @@ -0,0 +1,21 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # get sources + rm -rf SAI-Implementation + git clone https://github.com/Mellanox/SAI-Implementation.git + + # build + pushd SAI-Implementation + git checkout $(MLNX_SAI_REVISION) + pushd mlnx_sai + chmod a+x autogen.sh + debuild -e 'make_extra_flags="DEFS=-DACS_OS"' -us -uc -d -b + popd + + mv $* $(DEST)/ + popd diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk new file mode 100644 index 000000000000..d24b3e3a2e82 --- /dev/null +++ b/platform/mellanox/rules.mk @@ -0,0 +1,21 @@ +include $(PLATFORM_PATH)/sdk.mk +include $(PLATFORM_PATH)/fw.mk +include $(PLATFORM_PATH)/mft.mk +include $(PLATFORM_PATH)/mlnx-sai.mk +include $(PLATFORM_PATH)/hw-management.mk +include $(PLATFORM_PATH)/docker-syncd-mlnx.mk + +SONIC_ALL += $(DOCKER_SYNCD_MLNX) \ + $(DOCKER_ORCHAGENT) \ + $(DOCKER_FPM) \ + $(DOCKER_DATABASE) \ + $(DOCKER_LLDP_SV2) \ + $(DOCKER_SNMP_SV2) \ + $(DOCKER_TEAM) \ + $(DOCKER_PLATFORM_MONITOR) + +# Inject mlnx sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) + +# Runtime dependency on mlnx sai is set only for syncd +$(SYNCD)_RDEPENDS += $(MLNX_SAI) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk new file mode 100644 index 000000000000..b8a8e1bbc0ba --- /dev/null +++ b/platform/mellanox/sdk.mk @@ -0,0 +1,49 @@ +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/sonic/sdk +MLNX_SDK_VERSION = 4.2.3002 +MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \ + $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ + $(SXD_LIBS) $(TESTX) + +MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_DEV) $(SX_ACL_RM_DEV) \ + $(SX_COMPLIB_DEV) $(SX_COMPLIB_DEV_STATIC) $(SX_EXAMPLES_DEV) \ + $(SX_GEN_UTILS_DEV) $(SX_SCEW_DEV) $(SX_SCEW_DEV_STATIC) \ + $(SX_SDN_HAL_DEV) $(SX_SDN_HAL_DEV_STATIC) $(SXD_LIBS_DEV) \ + $(SXD_LIBS_DEV_STATIC) $(TESTX_DEV) + +APPLIBS = applibs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +APPLIBS_DEV = applibs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DEV))) +IPROUTE2 = iproute2_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +IPROUTE2_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(IPROUTE2),$(IPROUTE2_DEV))) +SX_COMPLIB = sx-complib_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV))) +SX_COMPLIB_DEV_STATIC = sx-complib-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV_STATIC))) +SX_EXAMPLES = sx-examples_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +SX_EXAMPLES_DEV = sx-examples-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(SX_EXAMPLES),$(SX_EXAMPLES_DEV))) +SX_GEN_UTILS = sx-gen-utils_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +SX_GEN_UTILS_DEV = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(SX_GEN_UTILS),$(SX_GEN_UTILS_DEV))) +SX_SCEW = sx-scew_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +SX_SCEW_DEV = sx-scew-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DEV))) +SX_SCEW_DEV_STATIC = sx-scew-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DEV_STATIC))) +SXD_LIBS = sxd-libs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +SXD_LIBS_DEV = sxd-libs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV))) +SXD_LIBS_DEV_STATIC = sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV_STATIC))) + +define make_url + $(1)_URL = $(MLNX_SDK_BASE_URL)/$(1) + +endef + +$(eval $(foreach deb,$(MLNX_SDK_DEBS),$(call make_url,$(deb)))) +$(eval $(foreach deb,$(MLNX_SDK_RDEBS),$(call make_url,$(deb)))) + +SONIC_ONLINE_DEBS += $(MLNX_SDK_RDEBS) diff --git a/platform/p4/docker-sonic-p4.mk b/platform/p4/docker-sonic-p4.mk new file mode 100644 index 000000000000..3204f1d50f97 --- /dev/null +++ b/platform/p4/docker-sonic-p4.mk @@ -0,0 +1,7 @@ +# docker image for p4 sonic docker image + +DOCKER_SONIC_P4 = docker-sonic-p4.gz +$(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4 +$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) +$(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_P4) diff --git a/platform/p4/docker-sonic-p4/Dockerfile.template b/platform/p4/docker-sonic-p4/Dockerfile.template new file mode 100644 index 000000000000..bb790950b211 --- /dev/null +++ b/platform/p4/docker-sonic-p4/Dockerfile.template @@ -0,0 +1,20 @@ +FROM docker-base + +RUN apt-get update + +RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils + +COPY deps /deps + +SED_DPKG + +ADD port_config.ini /port_config.ini +ADD startup.sh /scripts/startup.sh + +ADD rsyslog.conf /etc/rsyslog.conf + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT /bin/bash diff --git a/dockers/docker-sonic-p4/port_config.ini b/platform/p4/docker-sonic-p4/port_config.ini similarity index 100% rename from dockers/docker-sonic-p4/port_config.ini rename to platform/p4/docker-sonic-p4/port_config.ini diff --git a/dockers/docker-sonic-p4/rsyslog.conf b/platform/p4/docker-sonic-p4/rsyslog.conf similarity index 100% rename from dockers/docker-sonic-p4/rsyslog.conf rename to platform/p4/docker-sonic-p4/rsyslog.conf diff --git a/dockers/docker-sonic-p4/startup.sh b/platform/p4/docker-sonic-p4/startup.sh similarity index 100% rename from dockers/docker-sonic-p4/startup.sh rename to platform/p4/docker-sonic-p4/startup.sh diff --git a/platform/p4/p4-bmv.mk b/platform/p4/p4-bmv.mk new file mode 100644 index 000000000000..6fe00d189eb7 --- /dev/null +++ b/platform/p4/p4-bmv.mk @@ -0,0 +1,7 @@ +# p4 bmv package + +P4_BMV = p4-bmv2_1.0.0_amd64.deb +$(P4_BMV)_DEPENDS += $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) +$(P4_BMV)_RDEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(THRIFT_COMPILER) +$(P4_BMV)_SRC_PATH = $(PLATFORM_PATH)/p4-bmv/behavioral-model +SONIC_DPKG_DEBS += $(P4_BMV) diff --git a/src/p4-bmv2/behavioral-model b/platform/p4/p4-bmv/behavioral-model similarity index 100% rename from src/p4-bmv2/behavioral-model rename to platform/p4/p4-bmv/behavioral-model diff --git a/platform/p4/p4-hlir.mk b/platform/p4/p4-hlir.mk new file mode 100644 index 000000000000..2873275983a9 --- /dev/null +++ b/platform/p4/p4-hlir.mk @@ -0,0 +1,5 @@ +# p4 bmv package + +P4_HLIR = python-p4-hlir_0.9.36-1_all.deb +$(P4_HLIR)_SRC_PATH = $(PLATFORM_PATH)/p4-hlir/p4-hlir +SONIC_PYTHON_STDEB_DEBS += $(P4_HLIR) diff --git a/src/p4-hlir/p4-hlir b/platform/p4/p4-hlir/p4-hlir similarity index 100% rename from src/p4-hlir/p4-hlir rename to platform/p4/p4-hlir/p4-hlir diff --git a/platform/p4/p4-switch.mk b/platform/p4/p4-switch.mk new file mode 100644 index 000000000000..6fc07f908779 --- /dev/null +++ b/platform/p4/p4-switch.mk @@ -0,0 +1,7 @@ +# p4 switch package + +P4_SWITCH = p4-switch_1.0.0_amd64.deb +$(P4_SWITCH)_DEPENDS += $(P4C_BM) $(P4_BMV) +$(P4_SWITCH)_RDEPENDS += $(P4C_BM) $(P4_BMV) +$(P4_SWITCH)_SRC_PATH = $(PLATFORM_PATH)/p4-switch +SONIC_MAKE_DEBS += $(P4_SWITCH) diff --git a/platform/p4/p4-switch/Makefile b/platform/p4/p4-switch/Makefile new file mode 100644 index 000000000000..57f6a05999a1 --- /dev/null +++ b/platform/p4/p4-switch/Makefile @@ -0,0 +1,17 @@ +SHELL = /bin/bash +.ONESHELL: + +MAIN_TARGET = p4-switch_1.0.0_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + pushd switch + + mkdir -p p4-build/bmv2/switch + mkdir -p p4-build/bmv2/pd_thrift_gen + + ./autogen.sh + dpkg-buildpackage -us -uc -b -j4 + + popd + + mv $* $(DEST)/ diff --git a/src/p4-switch/switch b/platform/p4/p4-switch/switch similarity index 100% rename from src/p4-switch/switch rename to platform/p4/p4-switch/switch diff --git a/platform/p4/p4c-bm.mk b/platform/p4/p4c-bm.mk new file mode 100644 index 000000000000..f51595772c3a --- /dev/null +++ b/platform/p4/p4c-bm.mk @@ -0,0 +1,7 @@ +# p4c bm package + +P4C_BM = python-p4c-bm_1.0.0-5415c416-1_all.deb +$(P4C_BM)_SRC_PATH = $(PLATFORM_PATH)/p4c-bm/p4c-bm +$(P4C_BM)_DEPENDS += $(TENJIN) $(P4_HLIR) +$(P4C_BM)_RDEPENDS += $(TENJIN) $(P4_HLIR) +SONIC_PYTHON_STDEB_DEBS += $(P4C_BM) diff --git a/src/p4c-bm/p4c-bm b/platform/p4/p4c-bm/p4c-bm similarity index 100% rename from src/p4c-bm/p4c-bm rename to platform/p4/p4c-bm/p4c-bm diff --git a/platform/p4/rules.mk b/platform/p4/rules.mk new file mode 100644 index 000000000000..07ef1618f6df --- /dev/null +++ b/platform/p4/rules.mk @@ -0,0 +1,6 @@ +include $(PLATFORM_PATH)/p4-switch.mk +include $(PLATFORM_PATH)/p4-bmv.mk +include $(PLATFORM_PATH)/p4-hlir.mk +include $(PLATFORM_PATH)/p4c-bm.mk +include $(PLATFORM_PATH)/tenjin.mk +include $(PLATFORM_PATH)/docker-sonic-p4.mk diff --git a/platform/p4/tenjin.mk b/platform/p4/tenjin.mk new file mode 100644 index 000000000000..a9f38437d972 --- /dev/null +++ b/platform/p4/tenjin.mk @@ -0,0 +1,5 @@ +# tenjin package + +TENJIN = python-tenjin_1.1.1-1_all.deb +$(TENJIN)_SRC_PATH = $(PLATFORM_PATH)/tenjin +SONIC_MAKE_DEBS += $(TENJIN) diff --git a/platform/p4/tenjin/Makefile b/platform/p4/tenjin/Makefile new file mode 100644 index 000000000000..3f36866fe0de --- /dev/null +++ b/platform/p4/tenjin/Makefile @@ -0,0 +1,19 @@ +SHELL = /bin/bash +.ONESHELL: + +TENJIN_VERSION = 1.1.1 +TENJIN_VERSION_FULL = $(TENJIN_VERSION)-1 + +MAIN_TARGET = python-tenjin_$(TENJIN_VERSION_FULL)_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf Tenjin-$(TENJIN_VERSION) + + wget -nc http://pypi.python.org/packages/source/T/Tenjin/Tenjin-$(TENJIN_VERSION).tar.gz + tar xzf Tenjin-$(TENJIN_VERSION).tar.gz + + pushd Tenjin-$(TENJIN_VERSION) + python setup.py --command-packages=stdeb.command bdist_deb + popd + + mv Tenjin-$(TENJIN_VERSION)/deb_dist/$* $(DEST)/ diff --git a/rules/asyncsnmp-py3.mk b/rules/asyncsnmp-py3.mk new file mode 100644 index 000000000000..68566b1fa49d --- /dev/null +++ b/rules/asyncsnmp-py3.mk @@ -0,0 +1,7 @@ +# asyncsnmp python2 wheel + +ASYNCSNMP_PY3 = asyncsnmp-2.1.0-py3-none-any.whl +$(ASYNCSNMP_PY3)_SRC_PATH = $(SRC_PATH)/sonic-snmpagent +$(ASYNCSNMP_PY3)_PYTHON_VERSION = 3 +$(ASYNCSNMP_PY3)_DEPENDS += $(SSWSDK_PY3) +SONIC_PYTHON_WHEELS += $(ASYNCSNMP_PY3) diff --git a/rules/config b/rules/config new file mode 100644 index 000000000000..111772136429 --- /dev/null +++ b/rules/config @@ -0,0 +1,33 @@ +############################################################################### +## Configuration parameters for SONiC build system +############################################################################### + +# SONIC_CONFIG_VERBOSE - enable echoing for rules commands. +# Uncomment next line to enable: +# SONIC_CONFIG_VERBOSE = y + +# SONIC_CONFIG_PRINT_DEPENDENCIES - show dependencies for each invoked target. +# Before executing rule for each target its dependencies are printed to console. +# Uncomment next line to enable: +# SONIC_CONFIG_PRINT_DEPENDENCIES = y + +# SONIC_CONFIG_BUILD_JOBS - set number of jobs for parallel build. +# Corresponding -j argument will be passed to make command inside docker +# container. +SONIC_CONFIG_BUILD_JOBS = $(shell nproc) + +# SONIC_CONFIG_LOG_TO_FILES - print output from execution of rule for each +# target into separate log file under target/log/. +# Useful when executing parallel build +# Uncomment next line to enable: +SONIC_CONFIG_LOG_TO_FILES = y + +# SONIC_CONFIG_ENABLE_COLORS - enable colored output in build system. +# Comment next line to disable: +# SONIC_CONFIG_ENABLE_COLORS = y + +# USERNAME - username for installer build +USERNAME = admin + +# PASSWORD - password for installer build +PASSWORD = admin diff --git a/rules/dbsyncd-py2.mk b/rules/dbsyncd-py2.mk new file mode 100644 index 000000000000..cd85b9ed7f60 --- /dev/null +++ b/rules/dbsyncd-py2.mk @@ -0,0 +1,7 @@ +# sonic-dbsyncd python2 wheel + +DBSYNCD_PY2 = sonic_d-2.0.0-py2-none-any.whl +$(DBSYNCD_PY2)_SRC_PATH = $(SRC_PATH)/sonic-dbsyncd +$(DBSYNCD_PY2)_PYTHON_VERSION = 2 +$(DBSYNCD_PY2)_DEPENDS += $(SSWSDK_PY2) +SONIC_PYTHON_WHEELS += $(DBSYNCD_PY2) diff --git a/rules/docker-base.mk b/rules/docker-base.mk new file mode 100644 index 000000000000..56e42ac97b45 --- /dev/null +++ b/rules/docker-base.mk @@ -0,0 +1,6 @@ +# docker base image + +DOCKER_BASE = docker-base.gz +$(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base + +SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_BASE) diff --git a/rules/docker-database.mk b/rules/docker-database.mk new file mode 100644 index 000000000000..0bd7233acdc4 --- /dev/null +++ b/rules/docker-database.mk @@ -0,0 +1,7 @@ +# docker image for database + +DOCKER_DATABASE = docker-database.gz +$(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/docker-database +$(DOCKER_DATABASE)_DEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) +$(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE) diff --git a/rules/docker-fpm.mk b/rules/docker-fpm.mk new file mode 100644 index 000000000000..d9fa51f0eeca --- /dev/null +++ b/rules/docker-fpm.mk @@ -0,0 +1,7 @@ +# docker image for fpm + +DOCKER_FPM = docker-fpm.gz +$(DOCKER_FPM)_PATH = $(DOCKERS_PATH)/docker-fpm +$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS) +$(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_FPM) diff --git a/rules/docker-lldp-sv2.mk b/rules/docker-lldp-sv2.mk new file mode 100644 index 000000000000..17347fa79ed7 --- /dev/null +++ b/rules/docker-lldp-sv2.mk @@ -0,0 +1,8 @@ +# docker image for lldp agent + +DOCKER_LLDP_SV2 = docker-lldp-sv2.gz +$(DOCKER_LLDP_SV2)_PATH = $(DOCKERS_PATH)/docker-lldp-sv2 +$(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) +$(DOCKER_LLDP_SV2)_PYTHON_WHEELS += $(DBSYNCD_PY2) +$(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) diff --git a/rules/docker-orchagent.mk b/rules/docker-orchagent.mk new file mode 100644 index 000000000000..c4bd99fac08e --- /dev/null +++ b/rules/docker-orchagent.mk @@ -0,0 +1,7 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT = docker-orchagent.gz +$(DOCKER_ORCHAGENT)_PATH = $(DOCKERS_PATH)/docker-orchagent +$(DOCKER_ORCHAGENT)_DEPENDS += $(SWSS) +$(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT) diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk new file mode 100644 index 000000000000..1a48e4c2234a --- /dev/null +++ b/rules/docker-platform-monitor.mk @@ -0,0 +1,7 @@ +# docker platform monitor image + +DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz +$(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor +$(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_BASE) + +SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk new file mode 100644 index 000000000000..038c3fb7f002 --- /dev/null +++ b/rules/docker-snmp-sv2.mk @@ -0,0 +1,8 @@ +# docker image for snmp agent + +DOCKER_SNMP_SV2 = docker-snmp-sv2.gz +$(DOCKER_SNMP_SV2)_PATH = $(DOCKERS_PATH)/docker-snmp-sv2 +$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) +$(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(ASYNCSNMP_PY3) +$(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) diff --git a/rules/docker-team.mk b/rules/docker-team.mk new file mode 100644 index 000000000000..a11698634d57 --- /dev/null +++ b/rules/docker-team.mk @@ -0,0 +1,7 @@ +# docker image for team agent + +DOCKER_TEAM = docker-team.gz +$(DOCKER_TEAM)_PATH = $(DOCKERS_PATH)/docker-team +$(DOCKER_TEAM)_DEPENDS += $(SWSS) +$(DOCKER_TEAM)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_TEAM) diff --git a/rules/functions b/rules/functions new file mode 100644 index 000000000000..b0d7f9e68499 --- /dev/null +++ b/rules/functions @@ -0,0 +1,103 @@ +############################################################################### +## FUNCTIONS +############################################################################### + +############################################################################### +## Colored output +############################################################################### + +# Enable colored output +ifeq ($(SONIC_CONFIG_ENABLE_COLORS),y) +ifeq ($(MAKE_TERMOUT),) +RED=\033[1;31m +PURPLE=\033[1;35m +CYAN=\033[1;36m +GREEN=\033[1;32m +GRAY=\033[0m +endif +endif + +# Print red colored output +# call: +# log_red message +log_red = echo -e "$(RED)$(1)$(GRAY)" + +# Print purple colored output +# call: +# log_purple message +log_purple = echo -e "$(PURPLE)$(1)$(GRAY)" + +# Print blue colored output +# call: +# log_blue message +log_blue = echo -e "$(CYAN)$(1)$(GRAY)" + +# Print green colored output +# call: +# log_green message +log_green = echo -e "$(GREEN)$(1)$(GRAY)" + +############################################################################### +## Logging +############################################################################### + +ifeq ($(SONIC_CONFIG_LOG_TO_FILES),y) +FLUSH_LOG = rm -f $@.log + +LOG = &>> $(PROJECT_ROOT)/$@.log || { [ $$? -eq 0 ] || cat $(PROJECT_ROOT)/$@.log ; false ; } +endif + +############################################################################### +## Header and footer for each target +############################################################################### + +# Print name of target being built +PRINT_TARGET = $(call log_purple,Executing rules for $@) + +# Print name of target that finished build +PRINT_END_TARGET = $(call log_green,Finished $@) + +# Dump targets taht current depends on +ifeq ($(SONIC_CONFIG_PRINT_DEPENDENCIES),y) +PRINT_DEPENDENCIES = $(call log_blue,Dependencies for $@ are $^) +endif + +# Enable verbose mode +ifneq ($(SONIC_CONFIG_VERBOSE),y) +ENABLE_VERBOSE = @ +endif + +# header for each rule +define HEADER +$(ENABLE_VERBOSE) +$(PRINT_TARGET) +$(PRINT_DEPENDENCIES) +$(FLUSH_LOG) +endef + +# footer for each rule +define FOOTER +$(PRINT_END_TARGET) +endef + +############################################################################### +## Definition of derived target +############################################################################### + +# call: +# add_derived_package some_deb.deb, some_derived_deb +define add_derived_package +$(2)_DEPENDS += $(1) +$(2)_RDEPENDS += $($(1)_RDEPENDS) +$(2)_DERIVED_FROM = $(1) +$(1)_DERIVED_DEBS += $(2) +$(2)_URL = $($(1)_URL) +$(2)_SRC_PATH = $($(1)_SRC_PATH) +SONIC_DERIVED_DEBS += $(2) +endef + +############################################################################### +## Utility functions +############################################################################### + +expand = $(foreach d,$(1),$(call expand,$($(d)_$(2)),$(2))) $(1) diff --git a/rules/hiredis.mk b/rules/hiredis.mk new file mode 100644 index 000000000000..170a430eaba1 --- /dev/null +++ b/rules/hiredis.mk @@ -0,0 +1,18 @@ +# libhiredis package + +HIREDIS_VERSION = 0.13.3 +HIREDIS_VERSION_FULL = $(HIREDIS_VERSION)-2 + +export HIREDIS_VERSION HIREDIS_VERSION_FULL + +LIBHIREDIS = libhiredis0.13_$(HIREDIS_VERSION_FULL)_amd64.deb +$(LIBHIREDIS)_SRC_PATH = $(SRC_PATH)/hiredis +$(LIBHIREDIS)_DEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) $(REDIS_SENTINEL) +$(LIBHIREDIS)_RDEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) $(REDIS_SENTINEL) +SONIC_MAKE_DEBS += $(LIBHIREDIS) + +LIBHIREDIS_DEV = libhiredis-dev_$(HIREDIS_VERSION_FULL)_amd64.deb +$(eval $(call add_derived_package,$(LIBHIREDIS),$(LIBHIREDIS_DEV))) + +LIBHIREDIS_DBG = libhiredis-dbg_$(HIREDIS_VERSION_FULL)_amd64.deb +$(eval $(call add_derived_package,$(LIBHIREDIS),$(LIBHIREDIS_DBG))) diff --git a/rules/initramfs-tools.mk b/rules/initramfs-tools.mk new file mode 100644 index 000000000000..ef06c1056d41 --- /dev/null +++ b/rules/initramfs-tools.mk @@ -0,0 +1,8 @@ +# initramfs-tools package + +INITRAMFS_TOOLS_VERSION = 0.120 +export INITRAMFS_TOOLS_VERSION + +INITRAMFS_TOOLS = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb +$(INITRAMFS_TOOLS)_SRC_PATH = $(SRC_PATH)/initramfs-tools +SONIC_MAKE_DEBS += $(INITRAMFS_TOOLS) diff --git a/rules/libnl3.mk b/rules/libnl3.mk new file mode 100644 index 000000000000..fe43708a9399 --- /dev/null +++ b/rules/libnl3.mk @@ -0,0 +1,44 @@ +# libnl3 + +LIBNL3_VERSION = 3.2.27-1 + +export LIBNL3_VERSION + +LIBNL3 = libnl-3-200_$(LIBNL3_VERSION)_amd64.deb +$(LIBNL3)_SRC_PATH = $(SRC_PATH)/libnl3 +SONIC_MAKE_DEBS += $(LIBNL3) + +LIBNL3_DEV = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL3_DEV))) + +LIBNL_GENL3 = libnl-genl-3-200_$(LIBNL3_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_GENL3))) + +LIBNL_GENL3_DEV = libnl-genl-3-dev_$(LIBNL3_VERSION)_amd64.deb +$(LIBNL_GENL3_DEV)_DEPENDS += $(LIBNL_GENL3) $(LIBNL3_DEV) +$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_GENL3_DEV))) + +LIBNL_ROUTE3 = libnl-route-3-200_$(LIBNL3_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_ROUTE3))) + +LIBNL_ROUTE3_DEV = libnl-route-3-dev_$(LIBNL3_VERSION)_amd64.deb +$(LIBNL_ROUTE3_DEV)_DEPENDS += $(LIBNL_ROUTE3) $(LIBNL3_DEV) +$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_ROUTE3_DEV))) + +LIBNL_NF3 = libnl-nf-3-200_$(LIBNL3_VERSION)_amd64.deb +$(LIBNL_NF3)_DEPENDS += $(LIBNL_ROUTE3_DEV) +$(LIBNL_NF3)_RDEPENDS += $(LIBNL_ROUTE3) +$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_NF3))) + +LIBNL_NF3_DEV = libnl-nf-3-dev_$(LIBNL3_VERSION)_amd64.deb +$(LIBNL_NF3_DEV)_DEPENDS += $(LIBNL_NF3) +$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_NF3_DEV))) + +LIBNL_CLI = libnl-cli-3-200_$(LIBNL3_VERSION)_amd64.deb +$(LIBNL_CLI)_DEPENDS += $(LIBNL_GENL3_DEV) $(LIBNL_NF3_DEV) $(LIBNL_ROUTE3_DEV) +$(LIBNL_CLI)_RDEPENDS += $(LIBNL_GENL3) $(LIBNL_NF3) $(LIBNL_ROUTE3) +$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_CLI))) + +LIBNL_CLI_DEV = libnl-cli-3-dev_$(LIBNL3_VERSION)_amd64.deb +$(LIBNL_CLI_DEV)_DEPENDS += $(LIBNL_CLI) $(LIBNL_GENL3_DEV) $(LIBNL_NF3_DEV) $(LIBNL_ROUTE3_DEV) +$(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_CLI_DEV))) diff --git a/rules/libteam.mk b/rules/libteam.mk new file mode 100644 index 000000000000..9aecb07ce86a --- /dev/null +++ b/rules/libteam.mk @@ -0,0 +1,21 @@ +# libteam packages + +LIBTEAM_VERSION = 1.26-1 + +export LIBTEAM_VERSION + +LIBTEAM = libteam5_$(LIBTEAM_VERSION)_amd64.deb +$(LIBTEAM)_SRC_PATH = $(SRC_PATH)/libteam +$(LIBTEAM)_DEPENDS += $(LIBNL_GENL3_DEV) $(LIBNL_CLI_DEV) +SONIC_MAKE_DEBS += $(LIBTEAM) + +LIBTEAM_DEV = libteam-dev_$(LIBTEAM_VERSION)_amd64.deb +$(LIBTEAM_DEV)_DEPENDS += $(LIBTEAMDCT) +$(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAM_DEV))) + +LIBTEAMDCT = libteamdctl0_$(LIBTEAM_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAMDCT))) + +LIBTEAM_UTILS = libteam-utils_$(LIBTEAM_VERSION)_amd64.deb +$(LIBTEAM_UTILS)_DEPENDS += $(LIBTEAMDCT) +$(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAM_UTILS))) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk new file mode 100644 index 000000000000..6aae74dc2b95 --- /dev/null +++ b/rules/linux-kernel.mk @@ -0,0 +1,9 @@ +# redis package + +KVERSION = 3.16.0-4-amd64 + +export KVERSION + +LINUX_KERNEL = linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb +$(LINUX_KERNEL)_SRC_PATH = $(SRC_PATH)/sonic-linux-kernel +SONIC_MAKE_DEBS += $(LINUX_KERNEL) diff --git a/rules/lldpd.mk b/rules/lldpd.mk new file mode 100644 index 000000000000..65cfb61b3eee --- /dev/null +++ b/rules/lldpd.mk @@ -0,0 +1,12 @@ +# lldpd package + +LLDPD_VERSION = 0.9.5-0 + +LLDPD = lldpd_$(LLDPD_VERSION)_amd64.deb +$(LLDPD)_DEPENDS += $(LIBSNMP_DEV) +$(LLDPD)_RDEPENDS += $(LIBSNMP) +$(LLDPD)_SRC_PATH = $(SRC_PATH)/lldpd +SONIC_DPKG_DEBS += $(LLDPD) + +LIBLLDPCTL = liblldpctl-dev_$(LLDPD_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(LLDPD),$(LIBLLDPCTL))) diff --git a/rules/mpdecimal.mk b/rules/mpdecimal.mk new file mode 100644 index 000000000000..849c65057192 --- /dev/null +++ b/rules/mpdecimal.mk @@ -0,0 +1,13 @@ +# mpdecimal package + +MPDECIMAL_VERSION = 2.4.2 +MPDECIMAL_VERSION_FULL = $(MPDECIMAL_VERSION)-1 + +export MPDECIMAL_VERSION MPDECIMAL_VERSION_FULL + +LIBMPDECIMAL = libmpdec2_$(MPDECIMAL_VERSION_FULL)_amd64.deb +$(LIBMPDECIMAL)_SRC_PATH = $(SRC_PATH)/mpdecimal +SONIC_MAKE_DEBS += $(LIBMPDECIMAL) + +LIBMPDECIMAL_DEV = libmpdec-dev_$(MPDECIMAL_VERSION_FULL)_amd64.deb +$(eval $(call add_derived_package,$(LIBMPDECIMAL),$(LIBMPDECIMAL_DEV))) diff --git a/rules/quagga.mk b/rules/quagga.mk new file mode 100644 index 000000000000..f4ba4f2d0be8 --- /dev/null +++ b/rules/quagga.mk @@ -0,0 +1,6 @@ +# quagga package + +QUAGGA = quagga_0.99.24.1-2.1_amd64.deb +$(QUAGGA)_DEPENDS += $(LIBSNMP_DEV) +$(QUAGGA)_SRC_PATH = $(SRC_PATH)/sonic-quagga +SONIC_DPKG_DEBS += $(QUAGGA) diff --git a/rules/redis.mk b/rules/redis.mk new file mode 100644 index 000000000000..1adf209f6a6c --- /dev/null +++ b/rules/redis.mk @@ -0,0 +1,15 @@ +# redis package + +REDIS_VERSION = 3.2.4-1~bpo8+1 + +REDIS_TOOLS = redis-tools_$(REDIS_VERSION)_amd64.deb +$(REDIS_TOOLS)_SRC_PATH = $(SRC_PATH)/redis +SONIC_MAKE_DEBS += $(REDIS_TOOLS) + +REDIS_SERVER = redis-server_$(REDIS_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(REDIS_TOOLS),$(REDIS_SERVER))) + +REDIS_SENTINEL = redis-sentinel_$(REDIS_VERSION)_amd64.deb +$(REDIS_SENTINEL)_DEPENDS += $(REDIS_SERVER) +$(REDIS_SENTINEL)_RDEPENDS += $(REDIS_SERVER) +$(eval $(call add_derived_package,$(REDIS_TOOLS),$(REDIS_SENTINEL))) diff --git a/rules/sairedis.mk b/rules/sairedis.mk new file mode 100644 index 000000000000..145a0901b287 --- /dev/null +++ b/rules/sairedis.mk @@ -0,0 +1,20 @@ +# sairedis package + +LIBSAIREDIS = libsairedis_1.0.0_amd64.deb +$(LIBSAIREDIS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis +$(LIBSAIREDIS)_DEPENDS += $(LIBSWSSCOMMON_DEV) +$(LIBSAIREDIS)_RDEPENDS += $(LIBSWSSCOMMON) +SONIC_DPKG_DEBS += $(LIBSAIREDIS) + +LIBSAIREDIS_DEV = libsairedis-dev_1.0.0_amd64.deb +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIREDIS_DEV))) + +SYNCD = syncd_1.0.0_amd64.deb +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD))) + +LIBSAIMETADATA = libsaimetadata_1.0.0_amd64.deb +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA))) + +LIBSAIMETADATA_DEV = libsaimetadata-dev_1.0.0_amd64.deb +$(LIBSAIMETADATA_DEV)_DEPENDS += $(LIBSAIMETADATA) +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA_DEV))) diff --git a/rules/snmpd.mk b/rules/snmpd.mk new file mode 100644 index 000000000000..db85ca0d94a9 --- /dev/null +++ b/rules/snmpd.mk @@ -0,0 +1,53 @@ +# snmpd package + +SNMPD_VERSION = 5.7.3+dfsg +SNMPD_VERSION_FULL = $(SNMPD_VERSION)-1.5 + +export SNMPD_VERSION SNMPD_VERSION_FULL + +LIBSNMP_BASE = libsnmp-base_$(SNMPD_VERSION_FULL)_all.deb +$(LIBSNMP_BASE)_SRC_PATH = $(SRC_PATH)/snmpd +SONIC_MAKE_DEBS += $(LIBSNMP_BASE) + +SNMPTRAPD = snmptrapd_$(SNMPD_VERSION_FULL)_amd64.deb +$(SNMPTRAPD)_DEPENDS += $(LIBSNMP) $(SNMPD) +$(SNMPTRAPD)_RDEPENDS += $(LIBSNMP) $(SNMPD) +$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMPTRAPD))) + +SNMP = snmp_$(SNMPD_VERSION_FULL)_amd64.deb +$(SNMP)_DEPENDS += $(LIBSNMP) +$(SNMP)_RDEPENDS += $(LIBSNMP) +$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMP))) + +SNMPD = snmpd_$(SNMPD_VERSION_FULL)_amd64.deb +$(SNMPD)_DEPENDS += $(LIBSNMP) +$(SNMPD)_RDEPENDS += $(LIBSNMP) +$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMPD))) + +LIBSNMP = libsnmp30_$(SNMPD_VERSION_FULL)_amd64.deb +$(LIBSNMP)_RDEPENDS += $(LIBSNMP_BASE) +$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP))) + +LIBSNMP_DBG = libsnmp30-dbg_$(SNMPD_VERSION_FULL)_amd64.deb +$(LIBSNMP_DBG)_DEPENDS += $(LIBSNMP) +$(LIBSNMP_DBG)_RDEPENDS += $(LIBSNMP) +$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP_DBG))) + +LIBSNMP_DEV = libsnmp-dev_$(SNMPD_VERSION_FULL)_amd64.deb +$(LIBSNMP_DEV)_DEPENDS += $(LIBSNMP) +$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP_DEV))) + +LIBSNMP_PERL = libsnmp-perl_$(SNMPD_VERSION_FULL)_amd64.deb +$(LIBSNMP_PERL)_DEPENDS += $(LIBSNMP) +$(LIBSNMP_PERL)_RDEPENDS += $(LIBSNMP) +$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP_PERL))) + +PYTHON_NETSNMP = python-netsnmp_$(SNMPD_VERSION_FULL)_amd64.deb +$(PYTHON_NETSNMP)_DEPENDS += $(LIBSNMP) +$(PYTHON_NETSNMP)_RDEPENDS += $(LIBSNMP) +$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(PYTHON_NETSNMP))) + +TKMIB = tkmib_$(SNMPD_VERSION_FULL)_all.deb +$(TKMIB)_DEPENDS += $(LIBSNMP_PERL) +$(TKMIB)_RDEPENDS += $(LIBSNMP_PERL) +$(eval $(call add_derived_package,$(LIBSNMP_BASE),$(TKMIB))) diff --git a/rules/sonic-aboot.mk b/rules/sonic-aboot.mk new file mode 100644 index 000000000000..7db01c10d3b5 --- /dev/null +++ b/rules/sonic-aboot.mk @@ -0,0 +1,6 @@ +# sonic aboot installer + +SONIC_ABOOT = sonic-aboot.bin +$(SONIC_ABOOT)_MACHINE = aboot +$(SONIC_ABOOT)_DEPENDS += $(LINUX_KERNEL) $(INITRAMFS_TOOLS) +SONIC_INSTALLERS += $(SONIC_ABOOT) diff --git a/rules/sonic-generic.mk b/rules/sonic-generic.mk new file mode 100644 index 000000000000..a87c39c65127 --- /dev/null +++ b/rules/sonic-generic.mk @@ -0,0 +1,6 @@ +# sonic generic installer + +SONIC_GENERIC = sonic-generic.bin +$(SONIC_GENERIC)_MACHINE = generic +$(SONIC_GENERIC)_DEPENDS += $(LINUX_KERNEL) $(INITRAMFS_TOOLS) +SONIC_INSTALLERS += $(SONIC_GENERIC) diff --git a/rules/sswsdk-py2.mk b/rules/sswsdk-py2.mk new file mode 100644 index 000000000000..b50ea229ab7e --- /dev/null +++ b/rules/sswsdk-py2.mk @@ -0,0 +1,6 @@ +# sswsdk python2 wheel + +SSWSDK_PY2 = sswsdk-2.0.1-py2-none-any.whl +$(SSWSDK_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk +$(SSWSDK_PY2)_PYTHON_VERSION = 2 +SONIC_PYTHON_WHEELS += $(SSWSDK_PY2) diff --git a/rules/sswsdk-py3.mk b/rules/sswsdk-py3.mk new file mode 100644 index 000000000000..4dd0e7805bb1 --- /dev/null +++ b/rules/sswsdk-py3.mk @@ -0,0 +1,8 @@ +# sswsdk python3 wheel + +SSWSDK_PY3 = sswsdk-2.0.1-py3-none-any.whl +$(SSWSDK_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk +$(SSWSDK_PY3)_PYTHON_VERSION = 3 +# Synthetic dependency just to avoid race condition +$(SSWSDK_PY3)_DEPENDS += $(SSWSDK_PY2) +SONIC_PYTHON_WHEELS += $(SSWSDK_PY3) diff --git a/rules/swss-common.mk b/rules/swss-common.mk new file mode 100644 index 000000000000..d066714ae3a9 --- /dev/null +++ b/rules/swss-common.mk @@ -0,0 +1,13 @@ +# libswsscommon package + +LIBSWSSCOMMON = libswsscommon_1.0.0_amd64.deb +$(LIBSWSSCOMMON)_SRC_PATH = $(SRC_PATH)/sonic-swss-common +$(LIBSWSSCOMMON)_DEPENDS += $(LIBHIREDIS_DEV) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) \ + $(LIBNL_ROUTE3_DEV) $(LIBNL_NF3_DEV) \ + $(LIBNL_CLI_DEV) +$(LIBSWSSCOMMON)_RDEPENDS += $(LIBHIREDIS) $(LIBNL3) $(LIBNL_GENL3) \ + $(LIBNL_ROUTE3) $(LIBNL_NF3) $(LIBNL_CLI) +SONIC_DPKG_DEBS += $(LIBSWSSCOMMON) + +LIBSWSSCOMMON_DEV = libswsscommon-dev_1.0.0_amd64.deb +$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV))) diff --git a/rules/swss.mk b/rules/swss.mk new file mode 100644 index 000000000000..4761d2fb8876 --- /dev/null +++ b/rules/swss.mk @@ -0,0 +1,9 @@ +# swss package + +SWSS = swss_1.0.0_amd64.deb +$(SWSS)_SRC_PATH = $(SRC_PATH)/sonic-swss +$(SWSS)_DEPENDS += $(LIBSAIREDIS_DEV) $(LIBSAIMETADATA_DEV) $(LIBTEAM_DEV) \ + $(LIBTEAMDCT) $(LIBTEAM_UTILS) +$(SWSS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBTEAM) $(LIBTEAMDCT) \ + $(LIBTEAM_UTILS) +SONIC_DPKG_DEBS += $(SWSS) diff --git a/rules/thrift.mk b/rules/thrift.mk new file mode 100644 index 000000000000..20b01359a1ee --- /dev/null +++ b/rules/thrift.mk @@ -0,0 +1,17 @@ +# thrift package + +THRIFT_VERSION = 0.9.3 +THRIFT_VERSION_FULL = $(THRIFT_VERSION)-2 + +LIBTHRIFT = libthrift-$(THRIFT_VERSION)_$(THRIFT_VERSION_FULL)_amd64.deb +$(LIBTHRIFT)_SRC_PATH = $(SRC_PATH)/thrift +SONIC_MAKE_DEBS += $(LIBTHRIFT) + +LIBTHRIFT_DEV = libthrift-dev_$(THRIFT_VERSION_FULL)_amd64.deb +$(eval $(call add_derived_package,$(LIBTHRIFT),$(LIBTHRIFT_DEV))) + +PYTHON_THRIFT = python-thrift_$(THRIFT_VERSION_FULL)_amd64.deb +$(eval $(call add_derived_package,$(LIBTHRIFT),$(PYTHON_THRIFT))) + +THRIFT_COMPILER = thrift-compiler_$(THRIFT_VERSION_FULL)_amd64.deb +$(eval $(call add_derived_package,$(LIBTHRIFT),$(THRIFT_COMPILER))) diff --git a/slave.mk b/slave.mk new file mode 100644 index 000000000000..5b98d8bba2c2 --- /dev/null +++ b/slave.mk @@ -0,0 +1,311 @@ +############################################################################### +## Presettings +############################################################################### + +# Select bash for commands +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +.SECONDEXPANSION: + +SPACE := +SPACE += + +############################################################################### +## General definitions +############################################################################### + +SRC_PATH = src +RULES_PATH = rules +TARGET_PATH = target +DOCKERS_PATH = dockers +DEBS_PATH = $(TARGET_PATH)/debs +PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels +PROJECT_ROOT = $(shell pwd) + +CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo undefined) +PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM) + +############################################################################### +## Utility rules +## Define configuration, help etc. +############################################################################### + +.platform : + @echo Build system is not configured, please run make configure + @exit 1 + +configure : + @mkdir -p target/debs + @mkdir -p target/python-wheels + @echo $(PLATFORM) > .platform + +distclean : .platform clean + @rm -f .platform + +############################################################################### +## Include other rules +############################################################################### + +include $(RULES_PATH)/config +include $(RULES_PATH)/functions +include $(RULES_PATH)/*.mk +ifneq ($(CONFIGURED_PLATFORM), undefined) +include $(PLATFORM_PATH)/rules.mk +endif + +MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) + +############################################################################### +## Generic rules section +## All rules must go after includes for propper targets expansion +############################################################################### + +############################################################################### +## Online targets +############################################################################### + +# Download debian packages from online location +# Add new package for download: +# SOME_NEW_DEB = some_new_deb.deb +# $(SOME_NEW_DEB)_URL = https://url/to/this/deb.deb +# SONIC_ONLINE_DEBS += $(SOME_NEW_DEB) +$(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS)) : $(DEBS_PATH)/% : .platform + $(HEADER) + $(foreach deb,$* $($*_DERIVED_DEBS), \ + { wget -O $(DEBS_PATH)/$(deb) $($(deb)_URL) $(LOG) || exit 1 ; } ; ) + $(FOOTER) + +# Download regular files from online location +# Files are stored in deb packages directory for convenience +# Add new file for download: +# SOME_NEW_FILE = some_new_file +# $(SOME_NEW_FILE)_URL = https://url/to/this/file +# SONIC_ONLINE_FILES += $(SOME_NEW_FILE) +$(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_FILES)) : $(DEBS_PATH)/% : .platform + $(HEADER) + wget -O $@ $($*_URL) $(LOG) + $(FOOTER) + +# Copy debian packages from local directory +# Add new package for copy: +# SOME_NEW_DEB = some_new_deb.deb +# $(SOME_NEW_DEB)_PATH = path/to/some_new_deb.deb +# SONIC_COPY_DEBS += $(SOME_NEW_DEB) +$(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) : $(DEBS_PATH)/% : .platform + $(HEADER) + $(foreach deb,$* $($*_DERIVED_DEBS), \ + { cp $($(deb)_PATH) $(DEBS_PATH)/ $(LOG) || exit 1 ; } ; ) + $(FOOTER) + +############################################################################### +## Debian package related targets +############################################################################### + +# Build project using build.sh script +# They are essentially a one-time build projects that get sources from some URL +# and compile them +# Add new package for build: +# SOME_NEW_DEB = some_new_deb.deb +# $(SOME_NEW_DEB)_SRC_PATH = $(SRC_PATH)/project_name +# $(SOME_NEW_DEB)_DEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ... +# SONIC_MAKE_DEBS += $(SOME_NEW_DEB) +$(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) + $(HEADER) + # remove target to force rebuild + rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS)) + # build project and take package + make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG) + $(FOOTER) + +# Build project with dpkg-buildpackage +# Add new package for build: +# SOME_NEW_DEB = some_new_deb.deb +# $(SOME_NEW_DEB)_SRC_PATH = $(SRC_PATH)/project_name +# $(SOME_NEW_DEB)_DEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ... +# SONIC_DPKG_DEBS += $(SOME_NEW_DEB) +$(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) + $(HEADER) + # Build project and take package + rm -f $($*_SRC_PATH)/debian/*.debhelper.log + pushd $($*_SRC_PATH) $(LOG) + [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) + dpkg-buildpackage -rfakeroot -b -us -uc $(LOG) + popd $(LOG) + mv $(addprefix $($*_SRC_PATH)/../, $* $($*_DERIVED_DEBS)) $(DEBS_PATH) $(LOG) + $(FOOTER) + +# Build project with python setup.py --command-packages=stdeb.command +# Add new package for build: +# SOME_NEW_DEB = some_new_deb.deb +# $(SOME_NEW_DEB)_SRC_PATH = $(SRC_PATH)/project_name +# $(SOME_NEW_DEB)_DEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ... +# SONIC_PYTHON_STDEB_DEBS += $(SOME_NEW_DEB) +$(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) + $(HEADER) + # Build project and take package + pushd $($*_SRC_PATH) $(LOG) + python setup.py --command-packages=stdeb.command bdist_deb + popd $(LOG) + mv $(addprefix $($*_SRC_PATH)/deb_dist/, $* $($*_DERIVED_DEBS)) $(DEBS_PATH) $(LOG) + $(FOOTER) + +# Rules for derived debian packages (dev, dbg, etc.) +# All noise takes place in main deb recipe, so we are just telling that +# we depend on it and move our deb to other targets +# Add new dev package: +# $(eval $(call add_derived_package,$(ORIGINAL_DEB),derived_deb_file.deb)) +$(addprefix $(DEBS_PATH)/, $(SONIC_DERIVED_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) + $(HEADER) + # All noise takes place in main deb recipe, so we are just telling that + # we depend on it + # Put newer timestamp + [ -f $@ ] && touch $@ + $(FOOTER) + +# Targets for installing debian packages prior to build one that depends on them +SONIC_INSTALL_TARGETS = $(addsuffix -install,$(addprefix $(DEBS_PATH)/, \ + $(SONIC_ONLINE_DEBS) \ + $(SONIC_COPY_DEBS) \ + $(SONIC_MAKE_DEBS) \ + $(SONIC_DPKG_DEBS) \ + $(SONIC_PYTHON_STDEB_DEBS) \ + $(SONIC_DERIVED_DEBS))) +$(SONIC_INSTALL_TARGETS) : $(DEBS_PATH)/%-install : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(DEBS_PATH)/$$* + $(HEADER) + [ -f $(DEBS_PATH)/$* ] || { echo $(DEBS_PATH)/$* does not exist $(LOG) && exit 1; } + # put a lock here because dpkg does not allow installing packages in parallel + while true; do + if mkdir $(DEBS_PATH)/dpkg_lock &> /dev/null; then + { sudo dpkg -i $(DEBS_PATH)/$* $(LOG) && rm -d $(DEBS_PATH)/dpkg_lock && break; } || { rm -d $(DEBS_PATH)/dpkg_lock && exit 1 ; } + fi + done + $(FOOTER) + +############################################################################### +## Python packages +############################################################################### + +# Build project using python setup.py bdist_wheel +# Projects that generate python wheels +# Add new package for build: +# SOME_NEW_WHL = some_new_whl.whl +# $(SOME_NEW_WHL)_SRC_PATH = $(SRC_PATH)/project_name +# $(SOME_NEW_WHL)_PYTHON_VERSION = 2 (or 3) +# $(SOME_NEW_WHL)_DEPENDS = $(SOME_OTHER_WHL1) $(SOME_OTHER_WHL2) ... +# SONIC_PYTHON_WHEELS += $(SOME_NEW_DEB) +$(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*_DEPENDS))) + $(HEADER) + pushd $($*_SRC_PATH) $(LOG) + python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) + popd $(LOG) + mv $($*_SRC_PATH)/dist/$* $(PYTHON_WHEELS_PATH) $(LOG) + $(FOOTER) + +# Targets for installing python wheels. +# Autogenerated +SONIC_INSTALL_WHEELS = $(addsuffix -install, $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS))) +$(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuffix -install,$$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*_DEPENDS))) $(PYTHON_WHEELS_PATH)/$$* + $(HEADER) + [ -f $(PYTHON_WHEELS_PATH)/$* ] || { echo $(PYTHON_WHEELS_PATH)/$* does not exist $(LOG) && exit 1; } + # put a lock here to avoid race conditions + while true; do + if mkdir $(PYTHON_WHEELS_PATH)/pip_lock &> /dev/null; then + { sudo pip$($*_PYTHON_VERSION) install $(PYTHON_WHEELS_PATH)/$* $(LOG) && rm -d $(PYTHON_WHEELS_PATH)/pip_lock && break; } || { rm -d $(PYTHON_WHEELS_PATH)/pip_lock && exit 1 ; } + fi + done + $(FOOTER) + +############################################################################### +## Docker images related targets +############################################################################### + +# start docker daemon +docker-start : + @sudo service docker start &> /dev/null && sleep 1 + +# targets for building simple docker images that do not depend on any debian packages +$(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) + $(HEADER) + docker build --no-cache -t $* $($*.gz_PATH) $(LOG) + docker save $* | gzip -c > $@ + $(FOOTER) + +# Targets for building docker images +$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS) $$($$*.gz_FILES)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) + $(HEADER) + mkdir -p $($*.gz_PATH)/deps $(LOG) + mkdir -p $($*.gz_PATH)/python-wheels $(LOG) + sudo mount --bind $(DEBS_PATH) $($*.gz_PATH)/deps $(LOG) + sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG) + sed 's/SED_DPKG/RUN cd deps \&\& dpkg -i $(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')/g' $($*.gz_PATH)/Dockerfile.template > $($*.gz_PATH)/Dockerfile + docker build --no-cache -t $* $($*.gz_PATH) $(LOG) + docker save $* | gzip -c > $@ + $(FOOTER) + +DOCKER_LOAD_TARGETS = $(addsuffix -load,$(addprefix $(TARGET_PATH)/, \ + $(SONIC_SIMPLE_DOCKER_IMAGES) \ + $(SONIC_DOCKER_IMAGES))) +$(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TARGET_PATH)/$$*.gz + $(HEADER) + docker load -i $(TARGET_PATH)/$*.gz $(LOG) + $(FOOTER) + +############################################################################### +## Installers +############################################################################### + +# targets for building installers with base image +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) + $(HEADER) + ./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG) + TARGET_MACHINE=$($*_MACHINE) ./build_image.sh $(LOG) + $(FOOTER) + +############################################################################### +## Clean targets +############################################################################### + +SONIC_CLEAN_DEBS = $(addsuffix -clean,$(addprefix $(DEBS_PATH)/, \ + $(SONIC_ONLINE_DEBS) \ + $(SONIC_ONLINE_FILES) \ + $(SONIC_COPY_DEBS) \ + $(SONIC_MAKE_DEBS) \ + $(SONIC_DPKG_DEBS) \ + $(SONIC_PYTHON_STDEB_DEBS) \ + $(SONIC_DERIVED_DEBS))) +$(SONIC_CLEAN_DEBS) : $(DEBS_PATH)/%-clean : .platform $$(addsuffix -clean,$$(addprefix $(DEBS_PATH)/,$$($$*_DERIVED_FROM))) + @# remove derived targets if main one is removed, because we treat them + @# as part of one package + @rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS)) + +SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \ + $(SONIC_DOCKER_IMAGES) \ + $(SONIC_SIMPLE_DOCKER_IMAGES))) +$(SONIC_CLEAN_TARGETS) : $(TARGET_PATH)/%-clean : .platform + @rm -f $(TARGET_PATH)/$* + +SONIC_CLEAN_WHEELS = $(addsuffix -clean,$(addprefix $(PYTHON_WHEELS_PATH)/, \ + $(SONIC_PYTHON_WHEELS))) +$(SONIC_CLEAN_WHEELS) : $(PYTHON_WHEELS_PATH)/%-clean : .platform + @rm -f $(PYTHON_WHEELS_PATH)/$* + +clean-logs : .platform + @rm -f $(TARGET_PATH)/*.log $(DEBS_PATH)/*.log + +clean : .platform clean-logs $$(SONIC_CLEAN_DEBS) $$(SONIC_CLEAN_TARGETS) $$(SONIC_CLEAN_WHEELS) + +############################################################################### +## all +############################################################################### + +all : .platform $$(addprefix $(TARGET_PATH)/,$$(SONIC_ALL)) + +############################################################################### +## Standard targets +############################################################################### + +.PHONY : $(SONIC_CLEAN_DEBS) $(SONIC_CLEAN_TARGETS) $(SONIC_CLEAN_WHEELS) clean distclean configure + +.INTERMEDIATE : $(SONIC_INSTALL_TARGETS) $(SONIC_INSTALL_WHEELS) $(DOCKER_LOAD_TARGETS) docker-start diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile new file mode 100644 index 000000000000..4d9794cfa1b3 --- /dev/null +++ b/sonic-slave/Dockerfile @@ -0,0 +1,105 @@ +FROM debian:jessie + +MAINTAINER johnar@microsoft.com + +RUN echo "deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list +RUN echo "deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list +RUN echo "deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list +RUN echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list + +RUN apt-get clean && apt-get update && apt-get install -y apt-utils default-jre-headless openssh-server curl wget unzip git build-essential libtool lintian + +RUN apt-get update && apt-get install -y sudo dh-make dh-exec kmod libtinyxml2-2 libboost-program-options1.55-dev libtinyxml2-dev python python-pip libncurses5-dev texinfo dh-autoreconf python3-pip +RUN apt-get update && apt-get install -y doxygen devscripts git-buildpackage perl-modules libswitch-perl dh-systemd + +# For quagga build +RUN apt-get update && apt-get install -y libreadline-dev texlive-latex-base texlive-generic-recommended texlive-fonts-recommended libpam0g-dev libpam-dev libcap-dev imagemagick ghostscript groff libpcre3-dev gawk chrpath + +# For libnl3 (local) build +RUN apt-get install -y cdbs + +# For SAI meta build +RUN apt-get update && apt-get install -y libxml-simple-perl + +# For linux build +RUN apt-get update && apt-get install -y bc fakeroot build-essential devscripts quilt stgit +RUN apt-get update && apt-get -y build-dep linux + +# For platform-modules build +RUN apt-get update && apt-get install -y module-assistant + +# For thrift build +RUN apt-get update && apt-get install -y gem2deb libboost-all-dev libevent-dev libglib2.0-dev libqt4-dev python-all-dev python-twisted php5-dev phpunit libbit-vector-perl openjdk-7-jdk javahelper maven-debian-helper ant libmaven-ant-tasks-java libhttpclient-java libslf4j-java libservlet3.1-java qt5-default + +# For mellanox sdk build +RUN apt-get update && apt-get install -y libpcre3 libpcre3-dev byacc flex libglib2.0-dev bison expat libexpat1-dev dpatch libdb-dev iptables-dev swig + +# For mellanox sai build +RUN apt-get update && apt-get install -y libtool-bin libxml2-dev + +# For build image +RUN apt-get update && apt-get install -y cpio squashfs-tools zip + +# For broadcom sdk build +RUN apt-get update && apt-get install -y linux-compiler-gcc-4.8-x86 linux-kbuild-3.16 + +# teamd build +RUN apt-get update && apt-get install -y libdaemon-dev libdbus-1-dev libjansson-dev + +# For cavium sdk build +RUN apt-get update && apt-get install -y libpcap-dev dnsutils libusb-dev + +# For debian image reconfiguration +RUN apt-get update && apt-get install -y augeas-tools + +# For p4 build +RUN apt-get update && apt-get install -y libyaml-dev libevent-dev libjudy-dev libedit-dev libpcap-dev libnanomsg-dev +RUN apt-get update && apt-get install -y python-stdeb +RUN pip install ctypesgen +RUN pip install crc16 + +# For redis build +RUN apt-get update && apt-get install -y libjemalloc-dev + +# For mft kernel module build +RUN apt-get update && apt-get install -y dkms + +RUN mkdir /var/run/sshd +EXPOSE 22 + +# For gtest +RUN apt-get update && apt-get install -y libgtest-dev cmake && cd /usr/src/gtest && cmake . && make -C /usr/src/gtest + +# For Jenkins static analysis, unit testing and code coverage +RUN apt-get update && apt-get install -y cppcheck clang pylint python-pytest gcovr python-pytest=2.6.3* python-pytest-cov python-parse + +# For snmpd +RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev + +# For mpdecimal +RUN apt-get update && apt-get install -y docutils-common libjs-sphinxdoc libjs-underscore python-docutils python-jinja2 python-markupsafe python-pygments python-roman python-sphinx sphinx-common python3-sphinx + +# Install depot-tools (for git-retry) +RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /usr/share/depot_tools +ENV PATH /usr/share/depot_tools:$PATH + +# Install docker engine 1.11.2 inside docker +RUN curl -sSL https://get.docker.com/ | sh && apt-get install -y --force-yes -q docker-engine=1.11.2-0~jessie + +# Add user +ARG user +ARG uid +ARG guid + +RUN useradd $user -u $uid -g $guid -d /var/$user -m -s /bin/bash + +RUN gpasswd -a $user docker + +COPY sonic-jenkins-id_rsa.pub /var/$user/.ssh/authorized_keys2 +RUN chown $user /var/$user/.ssh -R +RUN chmod go= /var/$user/.ssh -R + +# Add user to sudoers +RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers + +USER $user diff --git a/sonic-slave/sonic-jenkins-id_rsa.pub b/sonic-slave/sonic-jenkins-id_rsa.pub new file mode 100644 index 000000000000..2a19c9e70d3c --- /dev/null +++ b/sonic-slave/sonic-jenkins-id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC769BQUJVeSIOyPsN4/Vo8xTqXQ6RI7ysVyCw/ABP3FIxf+fxmtm8t/Nbp9hq0uLHOjCw8UQbJ+XltsThFWJfH6RJY5NbfvwG7nUDjfjjp+SGEIHaVgIlpiuqiPbZ6QMjZ8Q0Sgi5p5ts1xe/4TFThwOJBHmhwydD5nk3BH7P3DDwlOCov5gjM40uMZJkketlO83zGG+25zu7O0hfDVt1vyK9bNWAhhPmGc79zdetfeFCxjimsff2m31B1KuVXiT5PDB1w+BSrUK6nNzJubnYCRgjg4prVTjA50EhlT2P7EoJAbW3TnTq8vUDkcstsGe/HZpfIB1VHBX97u4fAfGJZ root@acs-jenkins diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 5aea155cc43c..000000000000 --- a/src/Makefile +++ /dev/null @@ -1,214 +0,0 @@ -## TODO: if install dev package really happens, rebuild the depending project - -.ONESHELL: -SHELL := /bin/bash - -REDIS_VERSION=3.2.4-1~bpo8+1_amd64 - -LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb \ - libnl-3-dev_3.2.27-1_amd64.deb \ - libnl-genl-3-200_3.2.27-1_amd64.deb \ - libnl-genl-3-dev_3.2.27-1_amd64.deb \ - libnl-route-3-200_3.2.27-1_amd64.deb \ - libnl-route-3-dev_3.2.27-1_amd64.deb \ - libnl-nf-3-200_3.2.27-1_amd64.deb \ - libnl-nf-3-dev_3.2.27-1_amd64.deb \ - libnl-cli-3-200_3.2.27-1_amd64.deb \ - libnl-cli-3-dev_3.2.27-1_amd64.deb - -LIBTEAM-DEBS=libteam5_1.26-1_amd64.deb \ - libteamdctl0_1.26-1_amd64.deb \ - libteam-dev_1.26-1_amd64.deb \ - libteam-utils_1.26-1_amd64.deb - -MPDECIMAL_VER=2.4.2-1 - -MPDECIMAL-DEBS=libmpdec2_$(MPDECIMAL_VER)_amd64.deb \ - libmpdec-dev_$(MPDECIMAL_VER)_amd64.deb - -PYTHON3_5_VER=3.5.2-8 - -PYTHON3_5-DEBS=libpython3.5-minimal_$(PYTHON3_5_VER)_amd64.deb \ - python3.5-minimal_$(PYTHON3_5_VER)_amd64.deb \ - libpython3.5-stdlib_$(PYTHON3_5_VER)_amd64.deb \ - python3.5_$(PYTHON3_5_VER)_amd64.deb - -## Function: build_project, directory -## Build the project and save the .deb target in the same directory -## TRICK: clean dh state so it will force recreating .deb later -define build_project - rm -f $(1)/debian/*.debhelper.log - pushd $(1) - [ ! -f ./autogen.sh ] || ./autogen.sh - dpkg-buildpackage -rfakeroot -b -us -uc - popd -endef - -## Function: build_project_py2, directory -## Build the project and save the .deb target in the same directory -define build_project_py2 - pushd $(1) - python2 setup.py bdist_wheel - popd -endef - -## Function: build_project_py3, directory -## Build the project and save the .deb target in the same directory -define build_project_py3 - pushd $(1) - python3 setup.py bdist_wheel - popd -endef - -## Function: install_deb, debfile -install_deb = \ - [ -f $(1) ] && { sudo dpkg -i $(1) || sudo apt-get -y install -f; } || return 1; - -## Function: install_py2, whlfile -install_py2 = \ - sudo pip install $(1) - -## Function: install_py3, whlfile -install_py3 = \ - sudo pip3 install $(1) - -## Rules -$(LIBNL-DEBS): - pushd libnl3; ./build.sh; popd - -$(LIBTEAM-DEBS): $(LIBNL-DEBS) - $(foreach dep, $^, $(call install_deb, $(dep))) - pushd libteam; ./build.sh; popd - -$(MPDECIMAL-DEBS): - pushd mpdecimal; ./build.sh; popd - -$(PYTHON3_5-DEBS): $(MPDECIMAL-DEBS) - $(foreach dep, $^, $(call install_deb, $(dep))) - pushd python3.5; ./build.sh; popd - -redis-sentinel_$(REDIS_VERSION).deb redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb: - pushd redis; ./build.sh; popd - -libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dbg_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb redis-sentinel_$(REDIS_VERSION).deb - $(foreach dep, $^, $(call install_deb, $(dep))) - pushd hiredis; ./build.sh; popd - -libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb thrift-compiler_0.9.3-2_amd64.deb: - pushd thrift; ./build.sh; popd - -p4-bmv2_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb - $(foreach dep, $^, $(call install_deb, $(dep))) - pushd p4-bmv2; ./build.sh; popd - -kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb mft-4.5.0-31.amd64.deb: - pushd mft; ./build.sh; popd - -python-p4-hlir_0.9.36-1_all.deb: - pushd p4-hlir; ./build.sh; popd - -python-p4c-bm_1.0.0-5415c416-1_all.deb: python-tenjin_1.1.1-1_all.deb python-p4-hlir_0.9.36-1_all.deb - $(foreach dep, $^, $(call install_deb, $(dep))) - pushd p4c-bm; ./build.sh; popd - -python-tenjin_1.1.1-1_all.deb: - pushd tenjin; ./build.sh; popd - -snmpd_5.7.3+dfsg-1.5_amd64.deb snmptrapd_5.7.3+dfsg-1.5_amd64.deb snmp_5.7.3+dfsg-1.5_amd64.deb libsnmp-base_5.7.3+dfsg-1.5_all.deb libsnmp30_5.7.3+dfsg-1.5_amd64.deb libsnmp30-dbg_5.7.3+dfsg-1.5_amd64.deb libsnmp-dev_5.7.3+dfsg-1.5_amd64.deb libsnmp-perl_5.7.3+dfsg-1.5_amd64.deb python-netsnmp_5.7.3+dfsg-1.5_amd64.deb tkmib_5.7.3+dfsg-1.5_all.deb: - pushd snmpd; ./build.sh; popd - -sswsdk-2.0.1-py2-none-any.whl: - $(call build_project_py2, sonic-py-swsssdk) - cp sonic-py-swsssdk/dist/$@ . - -sswsdk-2.0.1-py3-none-any.whl: - $(call build_project_py3, sonic-py-swsssdk) - cp sonic-py-swsssdk/dist/$@ . - -sonic_d-2.0.0-py2-none-any.whl: sswsdk-2.0.1-py2-none-any.whl - $(foreach dep, $^, $(call install_py2, $(dep))) - $(call build_project_py2, sonic-dbsyncd) - cp sonic-dbsyncd/dist/$@ . - -asyncsnmp-2.1.0-py3-none-any.whl: sswsdk-2.0.1-py3-none-any.whl - $(foreach dep, $^, $(call install_py3, $(dep))) - $(call build_project_py3, sonic-snmpagent) - cp sonic-snmpagent/dist/$@ . - -p4-switch_1.0.0_amd64.deb: thrift-compiler_0.9.3-2_amd64.deb python-thrift_0.9.3-2_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb libthrift-dev_0.9.3-2_amd64.deb python-p4-hlir_0.9.36-1_all.deb python-tenjin_1.1.1-1_all.deb python-p4c-bm_1.0.0-5415c416-1_all.deb p4-bmv2_1.0.0_amd64.deb - $(foreach dep, $^, $(call install_deb, $(dep))) - pushd p4-switch; ./build.sh; popd - -lldpd_0.9.5-0_amd64.deb liblldpctl-dev_0.9.5-0_amd64.deb: - ## Install build dependency for lldpd - ## Note: lldpd and snmpd conflict on Build-Depends, so install before build - sudo apt-get -y build-dep lldpd - $(call build_project, lldpd) - -quagga_0.99.24.1-2.1_amd64.deb: - $(call build_project, sonic-quagga) - -libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb: redis-server_$(REDIS_VERSION).deb redis-tools_$(REDIS_VERSION).deb libhiredis0.13_0.13.3-2_amd64.deb libhiredis-dev_0.13.3-2_amd64.deb $(LIBNL-DEBS) - $(foreach dep, $^, $(call install_deb, $(dep))) - $(call build_project, sonic-swss-common) - -brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb brcm/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb brcm-sdk/libopennsl_*_amd64.deb brcm-sdk/libsaibcm_1.0.2*_amd64.deb brcm-sdk/libsaibcm-dev_1.0.2*_amd64.deb - $(foreach dep, $^, $(call install_deb, $(dep))) - $(call build_project, sonic-sairedis) - mkdir -p brcm - cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb brcm/ - -mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb mlnx-sdk/*.deb - ## Install applibs first for late depending packages - $(call install_deb, mlnx-sdk/applibs_1.mlnx.*.deb) - $(foreach dep, $^, $(call install_deb, $(dep))) - $(call build_project, sonic-sairedis) - mkdir -p mlnx - cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb mlnx/ - -cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb cavm/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb cavm-sdk/libsai.deb cavm-sdk/xp-tools.deb cavm-sdk/xpshell.deb - $(foreach dep, $^, $(call install_deb, $(dep))) - $(call build_project, sonic-sairedis) - mkdir -p cavm - cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb cavm/ - -p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb: libswsscommon_1.0.0_amd64.deb libswsscommon-dev_1.0.0_amd64.deb p4-switch_1.0.0_amd64.deb p4-bmv2_1.0.0_amd64.deb libthrift-0.9.3_0.9.3-2_amd64.deb - $(foreach dep, $^, $(call install_deb, $(dep))) - $(call build_project, sonic-sairedis) - mkdir -p p4 - cp syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb libsairedis-dev_1.0.0_amd64.deb libsaimetadata_1.0.0_amd64.deb libsaimetadata-dev_1.0.0_amd64.deb p4/ - -## Note: fpmsyncd and teamsyncd are two implicit targets -brcm/swss_1.0.0_amd64.deb: brcm/syncd_1.0.0_amd64.deb brcm/libsairedis_1.0.0_amd64.deb brcm/libsairedis-dev_1.0.0_amd64.deb brcm/libsaimetadata_1.0.0_amd64.deb brcm/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS) - $(foreach dep, $^, $(call install_deb, $(dep))) - $(call build_project, sonic-swss) - cp swss_1.0.0_amd64.deb brcm/ - cp sonic-swss/debian/swss/usr/bin/fpmsyncd . - cp sonic-swss/debian/swss/usr/bin/teamsyncd . - -## Note: fpmsyncd and teamsyncd are two implicit targets -mlnx/swss_1.0.0_amd64.deb: mlnx/syncd_1.0.0_amd64.deb mlnx/libsairedis_1.0.0_amd64.deb mlnx/libsairedis-dev_1.0.0_amd64.deb mlnx/libsaimetadata_1.0.0_amd64.deb mlnx/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS) - $(foreach dep, $^, $(call install_deb, $(dep))) - $(call build_project, sonic-swss) - cp swss_1.0.0_amd64.deb mlnx/ - cp sonic-swss/debian/swss/usr/bin/fpmsyncd . - cp sonic-swss/debian/swss/usr/bin/teamsyncd . - -## Note: fpmsyncd and teamsyncd are two implicit targets -cavm/swss_1.0.0_amd64.deb: cavm/syncd_1.0.0_amd64.deb cavm/libsairedis_1.0.0_amd64.deb cavm/libsairedis-dev_1.0.0_amd64.deb cavm/libsaimetadata_1.0.0_amd64.deb cavm/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS) - $(foreach dep, $^, $(call install_deb, $(dep))) - $(call build_project, sonic-swss) - cp swss_1.0.0_amd64.deb cavm/ - cp sonic-swss/debian/swss/usr/bin/fpmsyncd . - cp sonic-swss/debian/swss/usr/bin/teamsyncd . - -p4/swss_1.0.0_amd64.deb: p4/syncd_1.0.0_amd64.deb p4/libsairedis_1.0.0_amd64.deb p4/libsairedis-dev_1.0.0_amd64.deb p4/libsaimetadata_1.0.0_amd64.deb p4/libsaimetadata-dev_1.0.0_amd64.deb $(LIBTEAM-DEBS) $(LIBNL-DEBS) - $(foreach dep, $^, $(call install_deb, $(dep))) - $(call build_project, sonic-swss) - cp swss_1.0.0_amd64.deb p4/ - -$(addprefix sonic-linux-kernel/,linux-headers-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb linux-headers-3.16.0-4-common_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64-dbg_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb xen-linux-system-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb): - pushd sonic-linux-kernel; sudo ./build.sh; popd - -initramfs-tools/initramfs-tools_0.120_all.deb: - pushd initramfs-tools; ./build.sh; popd diff --git a/src/brcm-sdk/filelist.txt b/src/brcm-sdk/filelist.txt deleted file mode 100644 index 549d89f54567..000000000000 --- a/src/brcm-sdk/filelist.txt +++ /dev/null @@ -1,7 +0,0 @@ -## Get vendor SAI SDK -## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk - -libopennsl_6.4.11-1+0~20160719212144.23~1.gbp8ec2d1_amd64.deb -libsaibcm-dbg_1.0.2~20160727172452.52_amd64.deb -libsaibcm-dev_1.0.2~20160727172452.52_amd64.deb -libsaibcm_1.0.2~20160727172452.52_amd64.deb diff --git a/src/cavm-sdk/filelist.txt b/src/cavm-sdk/filelist.txt deleted file mode 100644 index bc40295dfbdc..000000000000 --- a/src/cavm-sdk/filelist.txt +++ /dev/null @@ -1,7 +0,0 @@ -## Get vendor SAI SDK -## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk - -libsai.deb -sai.deb -xp-tools.deb -xpshell.deb diff --git a/src/hiredis/Makefile b/src/hiredis/Makefile new file mode 100644 index 000000000000..f8d9db431483 --- /dev/null +++ b/src/hiredis/Makefile @@ -0,0 +1,22 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = libhiredis0.13_$(HIREDIS_VERSION_FULL)_amd64.deb +DERIVED_TARGETS = libhiredis-dbg_$(HIREDIS_VERSION_FULL)_amd64.deb libhiredis-dev_$(HIREDIS_VERSION_FULL)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf hiredis-$(HIREDIS_VERSION) + + wget -O hiredis_$(HIREDIS_VERSION).orig.tar.gz http://http.debian.net/debian/pool/main/h/hiredis/hiredis_$(HIREDIS_VERSION).orig.tar.gz + wget -O hiredis_$(HIREDIS_VERSION_FULL).debian.tar.xz http://http.debian.net/debian/pool/main/h/hiredis/hiredis_$(HIREDIS_VERSION_FULL).debian.tar.xz + wget -O hiredis_$(HIREDIS_VERSION_FULL).dsc http://http.debian.net/debian/pool/main/h/hiredis/hiredis_$(HIREDIS_VERSION_FULL).dsc + + dpkg-source -x hiredis_$(HIREDIS_VERSION_FULL).dsc + pushd hiredis-$(HIREDIS_VERSION) + fakeroot debian/rules binary + popd + + mv $* $(DERIVED_TARGETS) $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/hiredis/build.sh b/src/hiredis/build.sh deleted file mode 100755 index fbaed5f15028..000000000000 --- a/src/hiredis/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -x - -# Install redis-server -sudo dpkg -i redis/*.deb - -wget http://http.debian.net/debian/pool/main/h/hiredis/hiredis_0.13.3.orig.tar.gz -wget http://http.debian.net/debian/pool/main/h/hiredis/hiredis_0.13.3-2.debian.tar.xz -wget http://http.debian.net/debian/pool/main/h/hiredis/hiredis_0.13.3-2.dsc -dpkg-source -x hiredis_0.13.3-2.dsc -pushd hiredis-0.13.3; fakeroot debian/rules binary; popd - -cp *.deb .. diff --git a/src/initramfs-tools/Makefile b/src/initramfs-tools/Makefile new file mode 100644 index 000000000000..c7522aa3f66a --- /dev/null +++ b/src/initramfs-tools/Makefile @@ -0,0 +1,21 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtaining the initramfs-tools + rm -rf ./initramfs-tools + git clone --branch v0.120 https://anonscm.debian.org/git/kernel/initramfs-tools.git ./initramfs-tools + + # Patch + pushd ./initramfs-tools + patch -p1 < ../loopback-file-system-support.patch + + # Build the package + rm -f debian/*.debhelper.log + dpkg-buildpackage -rfakeroot -b -us -uc + popd + + mv $* $(DEST)/ diff --git a/src/initramfs-tools/build.sh b/src/initramfs-tools/build.sh deleted file mode 100755 index 335b834a538b..000000000000 --- a/src/initramfs-tools/build.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -## This script is to build the initramfs-tools with patches -## -## USAGE: -## ./build.sh - -# Obtaining the initramfs-tools -rm -rf ./initramfs-tools -git clone --branch v0.120 https://anonscm.debian.org/git/kernel/initramfs-tools.git ./initramfs-tools - -# Patch -pushd ./initramfs-tools -patch -p1 < $OLDPWD/loopback-file-system-support.patch - -# Build the package -rm -f debian/*.debhelper.log -dpkg-buildpackage -rfakeroot -b -us -uc - -popd diff --git a/src/libnl3/Makefile b/src/libnl3/Makefile new file mode 100644 index 000000000000..97beb746454c --- /dev/null +++ b/src/libnl3/Makefile @@ -0,0 +1,35 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = libnl-3-200_$(LIBNL3_VERSION)_amd64.deb +DERIVED_TARGETS = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb \ + libnl-genl-3-200_$(LIBNL3_VERSION)_amd64.deb \ + libnl-genl-3-dev_$(LIBNL3_VERSION)_amd64.deb \ + libnl-route-3-200_$(LIBNL3_VERSION)_amd64.deb \ + libnl-route-3-dev_$(LIBNL3_VERSION)_amd64.deb \ + libnl-nf-3-200_$(LIBNL3_VERSION)_amd64.deb \ + libnl-nf-3-dev_$(LIBNL3_VERSION)_amd64.deb \ + libnl-cli-3-200_$(LIBNL3_VERSION)_amd64.deb \ + libnl-cli-3-dev_$(LIBNL3_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtaining the libnl3 + rm -rf ./libnl3 + git clone https://anonscm.debian.org/git/collab-maint/libnl3.git + pushd ./libnl3 + git checkout -f b77c0e49cb + + # Patch + export QUILT_PATCHES=debian/patches + quilt push + quilt push + quilt push + quilt push + quilt push + dpkg-buildpackage -rfakeroot -b -us -uc + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/libnl3/build.sh b/src/libnl3/build.sh deleted file mode 100755 index 47eb0048f45d..000000000000 --- a/src/libnl3/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -## This script is to build the libnl3 3.2.27-1 -## -## USAGE: -## ./build.sh - -# Obtaining the libnl3 -rm -rf ./libnl3 -git clone https://anonscm.debian.org/git/collab-maint/libnl3.git -pushd ./libnl3 -git checkout -f b77c0e49cb - -# Patch -export QUILT_PATCHES=debian/patches -quilt push -quilt push -quilt push -quilt push -quilt push -dpkg-buildpackage -rfakeroot -b -us -uc - -popd -cp *.deb .. diff --git a/src/libteam/Makefile b/src/libteam/Makefile new file mode 100644 index 000000000000..b41487241b83 --- /dev/null +++ b/src/libteam/Makefile @@ -0,0 +1,31 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = libteam5_$(LIBTEAM_VERSION)_amd64.deb +DERIVED_TARGETS = libteam-dev_$(LIBTEAM_VERSION)_amd64.deb \ + libteamdctl0_$(LIBTEAM_VERSION)_amd64.deb \ + libteam-utils_$(LIBTEAM_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtain libteam + rm -rf ./libteam + git clone https://github.com/jpirko/libteam.git + pushd ./libteam + git checkout -f v1.26 + popd + + git clone https://anonscm.debian.org/git/collab-maint/libteam.git tmp + pushd ./tmp + git checkout -f da006f2 # v1.26 + popd + + mv tmp/debian libteam/ + rm -rf tmp + pushd ./libteam + dpkg-buildpackage -rfakeroot -b -us -uc + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/libteam/build.sh b/src/libteam/build.sh deleted file mode 100755 index 8a7e69cfb1a2..000000000000 --- a/src/libteam/build.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -## This script is to build libteam -## -## USAGE: -## ./build.sh - -# Obtain libteam -rm -rf ./libteam -git clone https://github.com/jpirko/libteam.git -pushd ./libteam -git checkout -f v1.26 -popd - -git clone https://anonscm.debian.org/git/collab-maint/libteam.git tmp -pushd ./tmp -git checkout -f da006f2 # v1.26 -popd -mv tmp/debian libteam/ -rm -rf tmp - -pushd ./libteam -dpkg-buildpackage -rfakeroot -b -us -uc - -popd -cp *.deb .. - diff --git a/src/mft/build.sh b/src/mft/build.sh deleted file mode 100755 index 44aa233a3124..000000000000 --- a/src/mft/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -## This script is to build the kernel-mft-dkms_4.5.0-3.16.0-4-amd64 kernel modules -## -## USAGE: -## ./build.sh - -MFT_NAME=mft-4.5.0-31-x86_64-deb -MFT_TGZ=${MFT_NAME}.tgz -MFT_KERNEL_DEB=kernel-mft-dkms_4.5.0-31_all.deb -KERNELVER=3.16.0-4-amd64 - -wget -N http://www.mellanox.com/downloads/MFT/${MFT_TGZ} -tar xzf $MFT_TGZ -pushd $MFT_NAME/SDEBS -dpkg -i $MFT_KERNEL_DEB -TARBALL_PATH=$(dkms mkdriverdisk kernel-mft-dkms/4.5.0 -a all -d ubuntu -k ${KERNELVER} --media tar | grep "Disk image location" | cut -d':' -f2) -echo $TARBALL_PATH -tar xvf $TARBALL_PATH -popd - -cp $MFT_NAME/SDEBS/ubuntu-drivers/3.16.0/kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb ../ -cp $MFT_NAME/DEBS/mft-4.5.0-31.amd64.deb ../ diff --git a/src/mlnx-sdk/filelist.txt b/src/mlnx-sdk/filelist.txt deleted file mode 100644 index 354c84140927..000000000000 --- a/src/mlnx-sdk/filelist.txt +++ /dev/null @@ -1,24 +0,0 @@ -## Get vendor SAI SDK -## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk - -fw-SPC.mfa -applibs-dev_1.mlnx.4.2.3002_amd64.deb -applibs_1.mlnx.4.2.3002_amd64.deb -iproute2-dev_1.mlnx.4.2.3002_amd64.deb -iproute2_1.mlnx.4.2.3002_amd64.deb -python-sdk-api_1.mlnx.4.2.3002_amd64.deb -sx-complib-dev-static_1.mlnx.4.2.3002_amd64.deb -sx-complib-dev_1.mlnx.4.2.3002_amd64.deb -sx-complib_1.mlnx.4.2.3002_amd64.deb -sx-examples-dev_1.mlnx.4.2.3002_amd64.deb -sx-examples_1.mlnx.4.2.3002_amd64.deb -sx-gen-utils-dev_1.mlnx.4.2.3002_amd64.deb -sx-gen-utils_1.mlnx.4.2.3002_amd64.deb -sx-kernel-dev_1.mlnx.4.2.3002_amd64.deb -sx-kernel_1.mlnx.4.2.3002_amd64.deb -sx-scew-dev-static_1.mlnx.4.2.3002_amd64.deb -sx-scew-dev_1.mlnx.4.2.3002_amd64.deb -sx-scew_1.mlnx.4.2.3002_amd64.deb -sxd-libs-dev-static_1.mlnx.4.2.3002_amd64.deb -sxd-libs-dev_1.mlnx.4.2.3002_amd64.deb -sxd-libs_1.mlnx.4.2.3002_amd64.deb diff --git a/src/mpdecimal/Makefile b/src/mpdecimal/Makefile new file mode 100644 index 000000000000..c7f94203f472 --- /dev/null +++ b/src/mpdecimal/Makefile @@ -0,0 +1,22 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = libmpdec2_$(MPDECIMAL_VERSION_FULL)_amd64.deb +DERIVED_TARGETS = libmpdec-dev_$(MPDECIMAL_VERSION_FULL)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf mpdecimal-$(MPDECIMAL_VERSION) + + wget -N -O mpdecimal_$(MPDECIMAL_VERSION).orig.tar.gz http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_$(MPDECIMAL_VERSION).orig.tar.gz + wget -N -O mpdecimal_$(MPDECIMAL_VERSION_FULL).debian.tar.xz http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_$(MPDECIMAL_VERSION_FULL).debian.tar.xz + wget -N -O mpdecimal_$(MPDECIMAL_VERSION_FULL).dsc http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_$(MPDECIMAL_VERSION_FULL).dsc + + dpkg-source -x mpdecimal_$(MPDECIMAL_VERSION_FULL).dsc + pushd mpdecimal-$(MPDECIMAL_VERSION) + dpkg-buildpackage -us -uc -b + popd + + mv $* $(DERIVED_TARGETS) $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/mpdecimal/build.sh b/src/mpdecimal/build.sh deleted file mode 100755 index be06c35766cf..000000000000 --- a/src/mpdecimal/build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -MPDECIMAL_VER=2.4.2 -MPDECIMAL_DEB_VER=1 - -wget -N http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_${MPDECIMAL_VER}.orig.tar.gz -wget -N http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_${MPDECIMAL_VER}-${MPDECIMAL_DEB_VER}.debian.tar.xz -wget -N http://http.debian.net/debian/pool/main/m/mpdecimal/mpdecimal_${MPDECIMAL_VER}-${MPDECIMAL_DEB_VER}.dsc - -dpkg-source -x mpdecimal_${MPDECIMAL_VER}-${MPDECIMAL_DEB_VER}.dsc - -pushd mpdecimal-${MPDECIMAL_VER} - -sudo apt-get -y build-dep mpdecimal - -dpkg-buildpackage -us -uc -b - -popd - -cp *.deb ../ diff --git a/src/p4-bmv2/build.sh b/src/p4-bmv2/build.sh deleted file mode 100755 index 779da0b3caf6..000000000000 --- a/src/p4-bmv2/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -x - -pushd behavioral-model; ./autogen.sh; dpkg-buildpackage -us -uc -b -j4; popd - -cp *.deb ../ diff --git a/src/p4-hlir/build.sh b/src/p4-hlir/build.sh deleted file mode 100755 index 68c7807ad648..000000000000 --- a/src/p4-hlir/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -x - -pushd p4-hlir -python setup.py --command-packages=stdeb.command bdist_deb -popd - -cp p4-hlir/deb_dist/*.deb ../ diff --git a/src/p4-switch/build.sh b/src/p4-switch/build.sh deleted file mode 100755 index eb0f0bcc7676..000000000000 --- a/src/p4-switch/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -x - -sudo pip install ctypesgen - -sudo pip install crc16 - -pushd switch - -mkdir -p p4-build/bmv2/switch -mkdir -p p4-build/bmv2/pd_thrift_gen - -./autogen.sh -dpkg-buildpackage -us -uc -b -j4 - -popd - -cp *.deb ../ diff --git a/src/p4c-bm/build.sh b/src/p4c-bm/build.sh deleted file mode 100755 index 83fa649005eb..000000000000 --- a/src/p4c-bm/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -x - -pushd p4c-bm -python setup.py --command-packages=stdeb.command bdist_deb -popd - -cp p4c-bm/deb_dist/*.deb ../ diff --git a/src/redis/Makefile b/src/redis/Makefile new file mode 100644 index 000000000000..a49ee4a9f015 --- /dev/null +++ b/src/redis/Makefile @@ -0,0 +1,24 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e + +REDIS_VERSION = 3.2.4 +REDIS_VERSION_FULL = $(REDIS_VERSION)-1~bpo8+1 + +MAIN_TARGET = redis-server_$(REDIS_VERSION_FULL)_amd64.deb +DERIVED_TARGETS = redis-tools_$(REDIS_VERSION_FULL)_amd64.deb \ + redis-sentinel_$(REDIS_VERSION_FULL)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + wget -O redis_$(REDIS_VERSION).orig.tar.gz -N "https://sonicstorage.blob.core.windows.net/packages/redis_$(REDIS_VERSION).orig.tar.gz?sv=2015-04-05&sr=b&sig=B3qGEoSHe%2FBh5rVwvXHpKijgBtKF7dHeuJWp1p17UnU%3D&se=2026-11-26T22%3A31%3A31Z&sp=r" + wget -O redis_$(REDIS_VERSION_FULL).dsc -N "https://sonicstorage.blob.core.windows.net/packages/redis_$(REDIS_VERSION_FULL).dsc?sv=2015-04-05&sr=b&sig=LoUtjLXa%2BCcoM%2BsPewRLkY7YPRvSJTbsvQoW%2BL%2B3QWM%3D&se=2026-11-26T22%3A32%3A11Z&sp=r" + wget -O redis_$(REDIS_VERSION_FULL).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/redis_$(REDIS_VERSION_FULL).debian.tar.xz?sv=2015-04-05&sr=b&sig=I33UsbDHiffEkQRndpFwY9y3I%2FrKTu0wmG%2FMXB98kys%3D&se=2026-11-26T22%3A32%3A34Z&sp=r" + dpkg-source -x redis_$(REDIS_VERSION_FULL).dsc + + pushd redis-$(REDIS_VERSION) + fakeroot debian/rules binary + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/redis/build.sh b/src/redis/build.sh deleted file mode 100755 index b0727c03a1f6..000000000000 --- a/src/redis/build.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -x - -REDIS_VERION=3.2.4 -REDIS_VERION_FULL=$REDIS_VERION-1~bpo8+1 - -wget -O redis_$REDIS_VERION.orig.tar.gz -N "https://sonicstorage.blob.core.windows.net/packages/redis_$REDIS_VERION.orig.tar.gz?sv=2015-04-05&sr=b&sig=B3qGEoSHe%2FBh5rVwvXHpKijgBtKF7dHeuJWp1p17UnU%3D&se=2026-11-26T22%3A31%3A31Z&sp=r" -wget -O redis_$REDIS_VERION_FULL.dsc -N "https://sonicstorage.blob.core.windows.net/packages/redis_$REDIS_VERION_FULL.dsc?sv=2015-04-05&sr=b&sig=LoUtjLXa%2BCcoM%2BsPewRLkY7YPRvSJTbsvQoW%2BL%2B3QWM%3D&se=2026-11-26T22%3A32%3A11Z&sp=r" -wget -O redis_$REDIS_VERION_FULL.debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/redis_$REDIS_VERION_FULL.debian.tar.xz?sv=2015-04-05&sr=b&sig=I33UsbDHiffEkQRndpFwY9y3I%2FrKTu0wmG%2FMXB98kys%3D&se=2026-11-26T22%3A32%3A34Z&sp=r" - -dpkg-source -x redis_$REDIS_VERION_FULL.dsc - -pushd redis-$REDIS_VERION; fakeroot debian/rules binary; popd - -cp *.deb .. diff --git a/src/snmpd/Makefile b/src/snmpd/Makefile new file mode 100644 index 000000000000..4cd036655af4 --- /dev/null +++ b/src/snmpd/Makefile @@ -0,0 +1,31 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e + +MAIN_TARGET = libsnmp-base_$(SNMPD_VERSION_FULL)_all.deb +DERIVED_TARGETS = snmptrapd_$(SNMPD_VERSION_FULL)_amd64.deb \ + snmp_$(SNMPD_VERSION_FULL)_amd64.deb \ + snmpd_$(SNMPD_VERSION_FULL)_amd64.deb \ + libsnmp30_$(SNMPD_VERSION_FULL)_amd64.deb \ + libsnmp30-dbg_$(SNMPD_VERSION_FULL)_amd64.deb \ + libsnmp-dev_$(SNMPD_VERSION_FULL)_amd64.deb \ + libsnmp-perl_$(SNMPD_VERSION_FULL)_amd64.deb \ + python-netsnmp_$(SNMPD_VERSION_FULL)_amd64.deb \ + tkmib_$(SNMPD_VERSION_FULL)_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf net-snmp-$(SNMPD_VERSION) + + # download debian net-snmp + wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_$(SNMPD_VERSION_FULL).dsc + wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_$(SNMPD_VERSION).orig.tar.xz + wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_$(SNMPD_VERSION_FULL).debian.tar.xz + dpkg-source -x net-snmp_$(SNMPD_VERSION_FULL).dsc + + pushd net-snmp-$(SNMPD_VERSION) + fakeroot debian/rules binary + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/snmpd/build.sh b/src/snmpd/build.sh deleted file mode 100755 index 65d47d9def81..000000000000 --- a/src/snmpd/build.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Install build dependency for snmpd -sudo apt-get -y build-dep snmpd - -# download debian net-snmp 5.7.3 -wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_5.7.3+dfsg-1.5.dsc -wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_5.7.3+dfsg.orig.tar.xz -wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_5.7.3+dfsg-1.5.debian.tar.xz - -dpkg-source -x net-snmp_5.7.3+dfsg-1.5.dsc - -pushd net-snmp-5.7.3+dfsg - -fakeroot debian/rules binary - -popd - -cp *.deb ../ diff --git a/src/tenjin/build.sh b/src/tenjin/build.sh deleted file mode 100755 index 37b8f9051d5b..000000000000 --- a/src/tenjin/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -x - -wget -nc http://pypi.python.org/packages/source/T/Tenjin/Tenjin-1.1.1.tar.gz -tar xzf Tenjin-1.1.1.tar.gz -pushd Tenjin-1.1.1 -python setup.py --command-packages=stdeb.command bdist_deb -popd -cp Tenjin-1.1.1/deb_dist/*.deb ../ diff --git a/src/thrift/Makefile b/src/thrift/Makefile new file mode 100644 index 000000000000..edb14e0cfa0d --- /dev/null +++ b/src/thrift/Makefile @@ -0,0 +1,27 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e + +THRIFT_VERSION = 0.9.3 +THRIFT_VERSION_FULL = $(THRIFT_VERSION)-2 + +MAIN_TARGET = libthrift-$(THRIFT_VERSION)_$(THRIFT_VERSION_FULL)_amd64.deb +DERIVED_TARGETS = libthrift-dev_$(THRIFT_VERSION_FULL)_amd64.deb \ + python-thrift_$(THRIFT_VERSION_FULL)_amd64.deb \ + thrift-compiler_$(THRIFT_VERSION_FULL)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf thrift-$(THRIFT_VERSION) + + wget -nc http://http.debian.net/debian/pool/main/t/thrift/thrift_$(THRIFT_VERSION).orig.tar.gz + wget -nc http://http.debian.net/debian/pool/main/t/thrift/thrift_$(THRIFT_VERSION_FULL).debian.tar.xz + wget -nc http://http.debian.net/debian/pool/main/t/thrift/thrift_$(THRIFT_VERSION_FULL).dsc + + dpkg-source -x thrift_$(THRIFT_VERSION_FULL).dsc + pushd thrift-$(THRIFT_VERSION) + dpkg-buildpackage -d -rfakeroot -b -us -uc + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/thrift/build.sh b/src/thrift/build.sh deleted file mode 100755 index 12aa1479e9c2..000000000000 --- a/src/thrift/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -x - -wget -nc http://http.debian.net/debian/pool/main/t/thrift/thrift_0.9.3.orig.tar.gz -wget -nc http://http.debian.net/debian/pool/main/t/thrift/thrift_0.9.3-2.debian.tar.xz -wget -nc http://http.debian.net/debian/pool/main/t/thrift/thrift_0.9.3-2.dsc -dpkg-source -x thrift_0.9.3-2.dsc -cd thrift-0.9.3 -dpkg-buildpackage -d -rfakeroot -b -us -uc -cd .. -cp *.deb ../ From edb54704abb7f26a3c74d4c167b668c7a48ee095 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 5 Dec 2016 21:20:46 +0200 Subject: [PATCH 0107/1833] Update mellanox FW version (#96) Make FW compatible with SDK 4.2.3002 --- platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh b/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh index 2ef46685f801..81514f77b062 100755 --- a/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh +++ b/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh @@ -1,7 +1,7 @@ #!/bin/bash query_retry_count_max="10" -required_fw_version="13.1130.0010" +required_fw_version="13.1200.0116" fw_file=/etc/mlnx/fw-SPC.mfa run_or_fail() { From 54a3178174a3707638a0f5cbc5d502a1a803fe15 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 5 Dec 2016 21:21:22 +0200 Subject: [PATCH 0108/1833] Add runtime dependencies for syncd (#97) Install lisairedis and libsaimetadata along with syncd --- rules/sairedis.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/sairedis.mk b/rules/sairedis.mk index 145a0901b287..02c20ef54588 100644 --- a/rules/sairedis.mk +++ b/rules/sairedis.mk @@ -10,6 +10,7 @@ LIBSAIREDIS_DEV = libsairedis-dev_1.0.0_amd64.deb $(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIREDIS_DEV))) SYNCD = syncd_1.0.0_amd64.deb +$(SYNCD)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD))) LIBSAIMETADATA = libsaimetadata_1.0.0_amd64.deb From 16a8224e23e0d227d388973bc4187a7ae57bf3a3 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 6 Dec 2016 16:31:59 +0200 Subject: [PATCH 0109/1833] Create group for user in sonic-slave if does absent (#98) --- sonic-slave/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 4d9794cfa1b3..1c484a37c4db 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -91,6 +91,8 @@ ARG user ARG uid ARG guid +RUN groupadd -f -r -g $guid g$user + RUN useradd $user -u $uid -g $guid -d /var/$user -m -s /bin/bash RUN gpasswd -a $user docker From e6aadeb9f8c150ca4c57851bafd1e91881ee9fdc Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 6 Dec 2016 16:32:12 +0200 Subject: [PATCH 0110/1833] Update Dockerfile.template (#95) --- dockers/docker-fpm/Dockerfile.template | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-fpm/Dockerfile.template b/dockers/docker-fpm/Dockerfile.template index d09a81a25155..47d250fb15fb 100644 --- a/dockers/docker-fpm/Dockerfile.template +++ b/dockers/docker-fpm/Dockerfile.template @@ -12,5 +12,7 @@ SED_DPKG RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps +COPY ["start.sh", "/usr/bin/"] + ENTRYPOINT /usr/bin/start.sh \ && /bin/bash From 6503d6a584ddef22f809d6e1d3aae0f0615d1eb5 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 6 Dec 2016 20:12:22 +0200 Subject: [PATCH 0111/1833] Add dependency on libl3 for libsnmp-base (#100) --- rules/snmpd.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/snmpd.mk b/rules/snmpd.mk index db85ca0d94a9..b7635cc7e032 100644 --- a/rules/snmpd.mk +++ b/rules/snmpd.mk @@ -7,6 +7,8 @@ export SNMPD_VERSION SNMPD_VERSION_FULL LIBSNMP_BASE = libsnmp-base_$(SNMPD_VERSION_FULL)_all.deb $(LIBSNMP_BASE)_SRC_PATH = $(SRC_PATH)/snmpd +$(LIBSNMP_BASE)_DEPENDS += $(LIBNL3_DEV) +$(LIBSNMP_BASE)_RDEPENDS += $(LIBNL3) SONIC_MAKE_DEBS += $(LIBSNMP_BASE) SNMPTRAPD = snmptrapd_$(SNMPD_VERSION_FULL)_amd64.deb From 9b415aa5cfc61a5af7e7f616f141cd3066a5e9c8 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 7 Dec 2016 01:29:25 +0200 Subject: [PATCH 0112/1833] Update README according to new build procedure (#101) * Update README according to new build procedure * Add detailed description for targets --- README.md | 53 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 37be054f15c2..ea6e2ee9e48e 100644 --- a/README.md +++ b/README.md @@ -6,23 +6,7 @@ Mellanox[![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellano Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS. # Prerequisite -## 1. Build environment -Build a docker image by [the Dockerfile](https://github.com/Azure/sonic-build-tools/blob/master/sonic-slave/Dockerfile) and build all remains in the docker container. - - git clone https://github.com/Azure/sonic-build-tools - cd sonic-build-tools - ./build.sh sonic-slave - docker run -v /var/run/docker.sock:/var/run/docker.sock -it --privileged local/sonic-slave bash - -You can also download sonic-slave docker from sonicdev docker registry using following command: - - docker login -u 1dafc8d7-d19c-4f58-8653-e8d904f30dab -p sonic sonicdev-microsoft.azurecr.io:443 - docker pull sonicdev-microsoft.azurecr.io:443/sonic-slave - docker run -v /var/run/docker.sock:/var/run/docker.sock -it --privileged sonicdev-microsoft.azurecr.io:443/sonic-slave bash - -Note that all the below steps should be executed in the docker container, not in the host machine. - -## 2. Clone or fetch the code repository with all git submodules +## Clone or fetch the code repository with all git submodules To clone the code repository recursively, assuming git version 1.9 or newer git clone --recursive https://github.com/Azure/sonic-buildimage.git @@ -31,23 +15,38 @@ If it is already cloned, however there is no files under ./dockers/docker-base/ git submodule update --init --recursive -## 3. Get vendor SAI SDK -Obtain Switch Abstraction Interface (SAI) SDK from one of supported vendors (see the list in [Usage](#usage) Section), and place it in the directory ./src/[VENDOR]-sdk/ as filelist.txt in that directory. Skip this step for p4 since it is an open source software switch. - # Usage To build NOS installer image and docker images, run command line - make [VENDOR]-all USERNAME=[USERNAME] PASSWORD_ENCRYPTED=[PASSWORD_ENCRYPTED] + make configure PLATFORM=[VENDOR] + make Supported VENDORs are: -- brcm: Broadcom -- mlnx: Mellanox -- cavm: Cavium -- p4: barefoot +- broadcom +- mellanox +- cavium +- p4 + +You can find rules/config file useful. It contains configuration options for build process, like adding more verbosity or showing dependencies, username and password for base image etc. + +Every docker image is built and saved to target/ directory. +So, for instance, to build only docker-database, execute + + make target/docker-database.gz + +Same goes for debian packages, which are under target/debs/: + + make target/debs/swss_1.0.0_amd64.deb + +Every target has a clean target, so in order to clean swss, execute + + make target/debs/swss_1.0.0_amd64.deb-clean -For example, the user name is 'admin' and the password is 'YourPaSsWoRd'. To build all the images for Broadcom platform, use the command: +It is recommended to use clean targets to clean all packages, that are built together, like dev packages for instance. - make brcm-all USERNAME="admin" PASSWORD_ENCRYPTED="$(perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"')" +# Note: +If you are running make for the first time, a sonic-slave-${USER} docker image will be built automatically. +It is a one time action, so be patient. The root is disabled, but the created user could sudo. From 709ca3c00f4d351be6854c89120e86f19611ba87 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 7 Dec 2016 01:30:20 +0200 Subject: [PATCH 0113/1833] Add mlnx hw-management to all targets (#102) * Add mlnx hw-management to all targets * Use correct path for hw-management in all targets --- platform/mellanox/rules.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index d24b3e3a2e82..b6d1056071ee 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -12,7 +12,8 @@ SONIC_ALL += $(DOCKER_SYNCD_MLNX) \ $(DOCKER_LLDP_SV2) \ $(DOCKER_SNMP_SV2) \ $(DOCKER_TEAM) \ - $(DOCKER_PLATFORM_MONITOR) + $(DOCKER_PLATFORM_MONITOR) \ + debs/$(MLNX_HW_MANAGEMENT) # Inject mlnx sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) From 7c9bffb18fb96daa4f89c08e951d7c86cd48f531 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 7 Dec 2016 07:26:07 -0800 Subject: [PATCH 0114/1833] Remove unnecessary build dependencies for hiredis (#91) --- rules/hiredis.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/hiredis.mk b/rules/hiredis.mk index 170a430eaba1..600d1c72f5b2 100644 --- a/rules/hiredis.mk +++ b/rules/hiredis.mk @@ -7,8 +7,8 @@ export HIREDIS_VERSION HIREDIS_VERSION_FULL LIBHIREDIS = libhiredis0.13_$(HIREDIS_VERSION_FULL)_amd64.deb $(LIBHIREDIS)_SRC_PATH = $(SRC_PATH)/hiredis -$(LIBHIREDIS)_DEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) $(REDIS_SENTINEL) -$(LIBHIREDIS)_RDEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) $(REDIS_SENTINEL) +$(LIBHIREDIS)_DEPENDS += $(REDIS_TOOLS) $(REDIS_SERVER) +$(LIBHIREDIS)_RDEPENDS += SONIC_MAKE_DEBS += $(LIBHIREDIS) LIBHIREDIS_DEV = libhiredis-dev_$(HIREDIS_VERSION_FULL)_amd64.deb From b31956d333e49ecb64263f9815b6eb9a909c196e Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 7 Dec 2016 07:59:21 -0800 Subject: [PATCH 0115/1833] add build dep for sai meta build and python3.5 (#103) --- sonic-slave/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 1c484a37c4db..50e96bfcd1d9 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -19,7 +19,7 @@ RUN apt-get update && apt-get install -y libreadline-dev texlive-latex-base texl RUN apt-get install -y cdbs # For SAI meta build -RUN apt-get update && apt-get install -y libxml-simple-perl +RUN apt-get update && apt-get install -y libxml-simple-perl graphviz # For linux build RUN apt-get update && apt-get install -y bc fakeroot build-essential devscripts quilt stgit @@ -64,6 +64,9 @@ RUN apt-get update && apt-get install -y libjemalloc-dev # For mft kernel module build RUN apt-get update && apt-get install -y dkms +# For python3.5 build +RUN apt-get update && apt-get install -y sharutils libncursesw5-dev libbz2-dev liblzma-dev libgdbm-dev tk-dev blt-dev libmpdec-dev libbluetooth-dev locales libsqlite3-dev libgpm2 time net-tools xvfb python-sphinx python3-sphinx + RUN mkdir /var/run/sshd EXPOSE 22 From 0d9ca53c00f47469c9ed314bf797fc810fa08209 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 8 Dec 2016 17:05:19 +0200 Subject: [PATCH 0116/1833] Enable logging for targets in SONIC_PYTHON_STDEB_DEBS (#105) --- slave.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index 5b98d8bba2c2..80308929dc05 100644 --- a/slave.mk +++ b/slave.mk @@ -146,7 +146,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platf $(HEADER) # Build project and take package pushd $($*_SRC_PATH) $(LOG) - python setup.py --command-packages=stdeb.command bdist_deb + python setup.py --command-packages=stdeb.command bdist_deb $(LOG) popd $(LOG) mv $(addprefix $($*_SRC_PATH)/deb_dist/, $* $($*_DERIVED_DEBS)) $(DEBS_PATH) $(LOG) $(FOOTER) From c42a54d7556d8b76c98089080ef19c3db7f7b175 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 8 Dec 2016 17:06:42 +0200 Subject: [PATCH 0117/1833] Add required packages for docker-p4 (#106) --- platform/p4/docker-sonic-p4/Dockerfile.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/p4/docker-sonic-p4/Dockerfile.template b/platform/p4/docker-sonic-p4/Dockerfile.template index bb790950b211..f03127502104 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.template +++ b/platform/p4/docker-sonic-p4/Dockerfile.template @@ -2,7 +2,7 @@ FROM docker-base RUN apt-get update -RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils +RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 COPY deps /deps From 44265fcffdf7a7bf76902a9e8c7c721f6e6020c7 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 8 Dec 2016 17:07:05 +0200 Subject: [PATCH 0118/1833] Add docker-p4 to all tagets for p4 platform (#107) Add dependency on p4 switch for libsairedis --- platform/p4/rules.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/p4/rules.mk b/platform/p4/rules.mk index 07ef1618f6df..408a58041f56 100644 --- a/platform/p4/rules.mk +++ b/platform/p4/rules.mk @@ -4,3 +4,8 @@ include $(PLATFORM_PATH)/p4-hlir.mk include $(PLATFORM_PATH)/p4c-bm.mk include $(PLATFORM_PATH)/tenjin.mk include $(PLATFORM_PATH)/docker-sonic-p4.mk + +SONIC_ALL += $(DOCKER_SONIC_P4) + +$(LIBSAIREDIS)_DEPENDS += $(P4_SWITCH) +$(LIBSAIREDIS)_RDEPENDS += $(P4_SWITCH) From 4e4168d1006760a4637c690edfa6c3f5da88ba83 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 8 Dec 2016 17:07:54 +0200 Subject: [PATCH 0119/1833] Rename docker-orchagent to docker-orchagent-mlnx (#108) --- platform/mellanox/docker-orchagent-mlnx.mk | 7 +++++++ platform/mellanox/rules.mk | 3 ++- rules/docker-orchagent.mk | 7 ------- 3 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 platform/mellanox/docker-orchagent-mlnx.mk delete mode 100644 rules/docker-orchagent.mk diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk new file mode 100644 index 000000000000..6db369a797c5 --- /dev/null +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -0,0 +1,7 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz +$(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent +$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) +$(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index b6d1056071ee..a31d22fc25a6 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -4,9 +4,10 @@ include $(PLATFORM_PATH)/mft.mk include $(PLATFORM_PATH)/mlnx-sai.mk include $(PLATFORM_PATH)/hw-management.mk include $(PLATFORM_PATH)/docker-syncd-mlnx.mk +include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk SONIC_ALL += $(DOCKER_SYNCD_MLNX) \ - $(DOCKER_ORCHAGENT) \ + $(DOCKER_ORCHAGENT_MLNX) \ $(DOCKER_FPM) \ $(DOCKER_DATABASE) \ $(DOCKER_LLDP_SV2) \ diff --git a/rules/docker-orchagent.mk b/rules/docker-orchagent.mk deleted file mode 100644 index c4bd99fac08e..000000000000 --- a/rules/docker-orchagent.mk +++ /dev/null @@ -1,7 +0,0 @@ -# docker image for orchagent - -DOCKER_ORCHAGENT = docker-orchagent.gz -$(DOCKER_ORCHAGENT)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT)_DEPENDS += $(SWSS) -$(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_BASE) -SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT) From dd9389febf7c27a0b2a647268261b29700d4cf9f Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 8 Dec 2016 17:08:13 +0200 Subject: [PATCH 0120/1833] Add dev sdk packages to runtime dependency (#109) Symbolic links for sx libraries are in dev packages, so we need them installed in containers too --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 917fc8c4dae2..a80bd87a0292 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -8,5 +8,5 @@ export MLNX_SAI_VERSION MLNX_SAI_REVISION MLNX_SAI = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb $(MLNX_SAI)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sai $(MLNX_SAI)_DEPENDS += $(MLNX_SDK_DEBS) -$(MLNX_SAI)_RDEPENDS += $(MLNX_SDK_RDEBS) +$(MLNX_SAI)_RDEPENDS += $(MLNX_SDK_RDEBS) $(MLNX_SDK_DEBS) SONIC_MAKE_DEBS += $(MLNX_SAI) From 9095ea0d307121c9ee44186199dd1c6205a770bd Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 8 Dec 2016 19:24:48 +0200 Subject: [PATCH 0121/1833] Integrate ptf into buildimage (#111) --- .gitmodules | 3 +++ rules/ptf.mk | 5 +++++ src/ptf | 1 + 3 files changed, 9 insertions(+) create mode 100644 rules/ptf.mk create mode 160000 src/ptf diff --git a/.gitmodules b/.gitmodules index 8db0758ed28c..a6928d64f2c4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -41,3 +41,6 @@ [submodule "src/sonic-snmpagent"] path = src/sonic-snmpagent url = https://github.com/Azure/sonic-snmpagent +[submodule "src/ptf"] + path = src/ptf + url = https://github.com/p4lang/ptf.git diff --git a/rules/ptf.mk b/rules/ptf.mk new file mode 100644 index 000000000000..5fe275bdadae --- /dev/null +++ b/rules/ptf.mk @@ -0,0 +1,5 @@ +# ptf package + +PTF = python-ptf_0.9-1_all.deb +$(PTF)_SRC_PATH = $(SRC_PATH)/ptf +SONIC_DPKG_DEBS += $(PTF) diff --git a/src/ptf b/src/ptf new file mode 160000 index 000000000000..ec33433f0276 --- /dev/null +++ b/src/ptf @@ -0,0 +1 @@ +Subproject commit ec33433f027625f4ba85c4eba8258e29f1dd6496 From 9a39142421862fe4d0c047bd7ca71ad3c77967f5 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 8 Dec 2016 20:31:02 +0200 Subject: [PATCH 0122/1833] Add python api to mlnx SDK (#110) * Add python api to mlnx SDK * Update sdk.mk * Add runtime dependency on python api Python SX SDK API is not required for build, however it is useful package to have in syncd docker --- platform/mellanox/docker-syncd-mlnx.mk | 2 +- platform/mellanox/sdk.mk | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 990ec0f7a4cb..81d27aacea46 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) $(MFT) +$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(MFT) $(PYTHON_SDK_API) $(DOCKER_SYNCD_MLNX)_FILES += $(MLNX_FW) $(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index b8a8e1bbc0ba..06b71f6847be 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -37,6 +37,8 @@ SXD_LIBS_DEV = sxd-libs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV))) SXD_LIBS_DEV_STATIC = sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV_STATIC))) +#packages that are required for runtime only +PYTHON_SDK_API = python-sdk-api_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb define make_url $(1)_URL = $(MLNX_SDK_BASE_URL)/$(1) @@ -45,5 +47,6 @@ endef $(eval $(foreach deb,$(MLNX_SDK_DEBS),$(call make_url,$(deb)))) $(eval $(foreach deb,$(MLNX_SDK_RDEBS),$(call make_url,$(deb)))) +$(eval $(foreach deb,$(PYTHON_SDK_API),$(call make_url,$(deb)))) -SONIC_ONLINE_DEBS += $(MLNX_SDK_RDEBS) +SONIC_ONLINE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) From 6ed8ff0a8ba4708e630a92c6fea2b1f49a688101 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 9 Dec 2016 16:31:11 +0200 Subject: [PATCH 0123/1833] Use permanent URL for mlnx SDK (#113) Change branch name into commit hash to have a permanent URL for SDK --- platform/mellanox/sdk.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 06b71f6847be..d7a887eb1edb 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,4 +1,4 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/sonic/sdk +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/9ae5a29e344e23cd4ce92805f990f8ce8fab292a/sdk MLNX_SDK_VERSION = 4.2.3002 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ From 1e3fdc45c4cd4b94493672f2f6b59d67959b238d Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 14 Dec 2016 00:42:43 +0200 Subject: [PATCH 0124/1833] Use same URL for mlnx FW as mlnx SDK does (#116) --- platform/mellanox/fw.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index b1e418e697e9..6f03c0fca221 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,5 +1,5 @@ # mellanox firmware MLNX_FW = fw-SPC.mfa -$(MLNX_FW)_URL = https://github.com/Mellanox/SAI-Implementation/raw/sonic/sdk/fw-SPC.mfa +$(MLNX_FW)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW) SONIC_ONLINE_FILES += $(MLNX_FW) From c199614b69be65edfecc504f6fd3042dbc3d195c Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 14 Dec 2016 18:48:59 +0200 Subject: [PATCH 0125/1833] Add redis-tools to docker-orchagent (#117) Changes done in 7c9bffb18fb96daa4f89c08e951d7c86cd48f531 removed runtime dependency on redis from hiredis. So we need to add them manually into orchagent docker --- platform/mellanox/docker-orchagent-mlnx.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index 6db369a797c5..a2138c029ff9 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -2,6 +2,6 @@ DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz $(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) +$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) From 98e3479e26c963815bb1801c61f15402c472feb0 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 14 Dec 2016 11:59:24 -0800 Subject: [PATCH 0126/1833] build orchagent and syncd docker on broadcom platform (#118) * build orchagent and syncd docker on broadcom platform --- dockers/docker-syncd/Dockerfile | 29 --------------- platform/broadcom/docker-orchagent-brcm.mk | 7 ++++ platform/broadcom/docker-syncd-brcm.mk | 8 ++++ .../docker-syncd-brcm/Dockerfile.template | 19 ++++++++++ .../broadcom/docker-syncd-brcm}/start.sh | 0 platform/broadcom/rules.mk | 26 ++++++------- platform/broadcom/sai.mk | 10 +++++ platform/broadcom/sdk.mk | 4 ++ slave.mk | 37 +++++++++++++------ 9 files changed, 87 insertions(+), 53 deletions(-) delete mode 100755 dockers/docker-syncd/Dockerfile create mode 100644 platform/broadcom/docker-orchagent-brcm.mk create mode 100644 platform/broadcom/docker-syncd-brcm.mk create mode 100755 platform/broadcom/docker-syncd-brcm/Dockerfile.template rename {dockers/docker-syncd => platform/broadcom/docker-syncd-brcm}/start.sh (100%) create mode 100644 platform/broadcom/sai.mk create mode 100644 platform/broadcom/sdk.mk diff --git a/dockers/docker-syncd/Dockerfile b/dockers/docker-syncd/Dockerfile deleted file mode 100755 index 88c521ffef68..000000000000 --- a/dockers/docker-syncd/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM docker-base - -RUN apt-get update - -COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libopennsl_*.deb", "deps/libsaibcm_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/syncd_*.deb", "/deps/"] - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/libhiredis0.13*.deb \ - && dpkg_apt /deps/libnl-3-200_*.deb \ - && dpkg_apt /deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /deps/libnl-route-3-200_*.deb \ - && dpkg_apt /deps/libswsscommon_*.deb \ - && dpkg_apt /deps/libopennsl_*.deb \ - && dpkg_apt /deps/libsaibcm_*.deb \ - && dpkg_apt /deps/libsairedis_*.deb \ - && dpkg_apt /deps/libsaimetadata_*.deb \ - && dpkg_apt /deps/syncd_*.deb - -## TODO: add kmod into Depends -RUN apt-get install -f kmod - -COPY ["deps/dsserve", "deps/bcmcmd", "start.sh", "/usr/bin/"] - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps - -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk new file mode 100644 index 000000000000..c847d93b748d --- /dev/null +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -0,0 +1,7 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_BRCM = docker-orchagent-brcm.gz +$(DOCKER_ORCHAGENT_BRCM)_PATH = $(DOCKERS_PATH)/docker-orchagent +$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk new file mode 100644 index 000000000000..42fe63c86a44 --- /dev/null +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -0,0 +1,8 @@ +# docker image for brcm syncd + +DOCKER_SYNCD_BRCM = docker-syncd-brcm.gz +$(DOCKER_SYNCD_BRCM)_PATH = $(PLATFORM_PATH)/docker-syncd-brcm +$(DOCKER_SYNCD_BRCM)_DEPENDS += $(SYNCD) +$(DOCKER_SYNCD_BRCM)_FILES += $(BRCM_DSSERVE) $(BRCM_BCMCMD) +$(DOCKER_SYNCD_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM) diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.template b/platform/broadcom/docker-syncd-brcm/Dockerfile.template new file mode 100755 index 000000000000..958c0757b283 --- /dev/null +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.template @@ -0,0 +1,19 @@ +FROM docker-base + +RUN apt-get update + +COPY deps /deps + +SED_DPKG + +## TODO: add kmod into Depends +RUN apt-get install -f kmod + +COPY ["deps/dsserve", "deps/bcmcmd", "start.sh", "/usr/bin/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-syncd/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh similarity index 100% rename from dockers/docker-syncd/start.sh rename to platform/broadcom/docker-syncd-brcm/start.sh diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index aa5570082911..6cafbbefac79 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,20 +1,20 @@ -OPENNSL = libopennsl_6.4.11-1+0~20160719212144.23~1.gbp8ec2d1_amd64.deb -$(OPENNSL)_PATH = $(PLATFORM_PATH)/brcm_sdk -BRCM_SAI = libsaibcm_1.0.2~20160727172452.52_amd64.deb -$(BRCM_SAI)_PATH = $(PLATFORM_PATH)/brcm_sdk -BRCM_SAI_DBG = libsaibcm-dbg_1.0.2~20160727172452.52_amd64.deb -$(BRCM_SAI_DEV)_PATH = $(PLATFORM_PATH)/brcm_sdk -BRCM_SAI_DEV = libsaibcm-dev_1.0.2~20160727172452.52_amd64.deb -$(BRCM_SAI_DBG)_PATH = $(PLATFORM_PATH)/brcm_sdk +include $(PLATFORM_PATH)/sdk.mk +include $(PLATFORM_PATH)/sai.mk +include $(PLATFORM_PATH)/docker-orchagent-brcm.mk +include $(PLATFORM_PATH)/docker-syncd-brcm.mk -SONIC_COPY_DEBS += $(OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DBG) $(BRCM_SAI_DEV) +BRCM_DSSERVE = dsserve +$(BRCM_DSSERVE)_PATH = $(PLATFORM_PATH)/sdk +BRCM_BCMCMD = bcmcmd +$(BRCM_BCMCMD)_PATH = $(PLATFORM_PATH)/sdk -# TODO: Put dependencies for SDK packages +SONIC_COPY_FILES += $(BRCM_DSSERVE) $(BRCM_BCMCMD) -SONIC_ALL += $(SONIC_GENERIC) $(DOCKER_SYNCD) $(DOCKER_ORCHAGENT) $(DOCKER_FPM) +SONIC_ALL += $(DOCKER_SYNCD_BRCM) \ + $(DOCKER_ORCHAGENT_MLNX) # Inject brcm sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(BRCM_LIBSAI) +$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) # Runtime dependency on brcm sai is set only for syncd -$(SYNCD)_RDEPENDS += $(BRCM_LIBSAI) +$(SYNCD)_RDEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk new file mode 100644 index 000000000000..ecedb48edd7a --- /dev/null +++ b/platform/broadcom/sai.mk @@ -0,0 +1,10 @@ +BRCM_SAI = libsaibcm_2.0.3.7~20161214010054.112_amd64.deb +$(BRCM_SAI)_PATH = $(PLATFORM_PATH)/sdk +BRCM_SAI_DEV = libsaibcm-dev_2.0.3.7~20161214010054.112_amd64.deb +$(BRCM_SAI_DEV)_PATH = $(PLATFORM_PATH)/sdk +$(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) + +SONIC_COPY_DEBS += $(BRCM_SAI) + +$(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) +$(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk new file mode 100644 index 000000000000..d3d94e606a64 --- /dev/null +++ b/platform/broadcom/sdk.mk @@ -0,0 +1,4 @@ +BRCM_OPENNSL = libopennsl_3.2.1.5+0~20161214000201.54~1.gbpb514c3_amd64.deb +$(BRCM_OPENNSL)_PATH = $(PLATFORM_PATH)/sdk + +SONIC_COPY_DEBS += $(BRCM_OPENNSL) diff --git a/slave.mk b/slave.mk index 80308929dc05..ee89df4b4c8b 100644 --- a/slave.mk +++ b/slave.mk @@ -62,6 +62,31 @@ MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) ## All rules must go after includes for propper targets expansion ############################################################################### +############################################################################### +## Local targets +############################################################################### + +# Copy debian packages from local directory +# Add new package for copy: +# SOME_NEW_DEB = some_new_deb.deb +# $(SOME_NEW_DEB)_PATH = path/to/some_new_deb.deb +# SONIC_COPY_DEBS += $(SOME_NEW_DEB) +$(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) : $(DEBS_PATH)/% : .platform + $(HEADER) + $(foreach deb,$* $($*_DERIVED_DEBS), \ + { cp $($(deb)_PATH)/$(deb) $(DEBS_PATH)/ $(LOG) || exit 1 ; } ; ) + $(FOOTER) + +# Copy regular files from local directory +# Add new package for copy: +# SOME_NEW_FILE = some_new_file +# $(SOME_NEW_FILE)_PATH = path/to/some_new_file +# SONIC_COPY_FILES += $(SOME_NEW_FILE) +$(addprefix $(DEBS_PATH)/, $(SONIC_COPY_FILES)) : $(DEBS_PATH)/% : .platform + $(HEADER) + cp $($*_PATH)/$* $(DEBS_PATH)/ $(LOG) || exit 1 + $(FOOTER) + ############################################################################### ## Online targets ############################################################################### @@ -88,17 +113,6 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_FILES)) : $(DEBS_PATH)/% : .platform wget -O $@ $($*_URL) $(LOG) $(FOOTER) -# Copy debian packages from local directory -# Add new package for copy: -# SOME_NEW_DEB = some_new_deb.deb -# $(SOME_NEW_DEB)_PATH = path/to/some_new_deb.deb -# SONIC_COPY_DEBS += $(SOME_NEW_DEB) -$(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) : $(DEBS_PATH)/% : .platform - $(HEADER) - $(foreach deb,$* $($*_DERIVED_DEBS), \ - { cp $($(deb)_PATH) $(DEBS_PATH)/ $(LOG) || exit 1 ; } ; ) - $(FOOTER) - ############################################################################### ## Debian package related targets ############################################################################### @@ -271,6 +285,7 @@ SONIC_CLEAN_DEBS = $(addsuffix -clean,$(addprefix $(DEBS_PATH)/, \ $(SONIC_ONLINE_DEBS) \ $(SONIC_ONLINE_FILES) \ $(SONIC_COPY_DEBS) \ + $(SONIC_COPY_FILES) \ $(SONIC_MAKE_DEBS) \ $(SONIC_DPKG_DEBS) \ $(SONIC_PYTHON_STDEB_DEBS) \ From a65224abc57729163605b6c25224307a580e10e2 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 14 Dec 2016 12:29:21 -0800 Subject: [PATCH 0127/1833] add build badge for broadcom platform --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea6e2ee9e48e..d6fb75c3b99c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Mellanox[![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) +Mellanox[![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all)Broadcom[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) # Build SONiC Switch Images - buildimage From 131aa6f4edbd97f5c294f46f12511de41ba06692 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 14 Dec 2016 21:02:21 -0800 Subject: [PATCH 0128/1833] bug fix: build docker orchagent brcm (#122) --- platform/broadcom/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 6cafbbefac79..79f00e16fa35 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -11,7 +11,7 @@ $(BRCM_BCMCMD)_PATH = $(PLATFORM_PATH)/sdk SONIC_COPY_FILES += $(BRCM_DSSERVE) $(BRCM_BCMCMD) SONIC_ALL += $(DOCKER_SYNCD_BRCM) \ - $(DOCKER_ORCHAGENT_MLNX) + $(DOCKER_ORCHAGENT_BRCM) # Inject brcm sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) From 82e6b1d7d4158b6d38a470c2d1ac75f73fe91a8d Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 14 Dec 2016 21:02:44 -0800 Subject: [PATCH 0129/1833] [quagga]: add bgp ipv6 ecmp support (#123) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index 1997fb28efe4..cf02de55bf00 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 1997fb28efe441a761b16559775006a2e37913e0 +Subproject commit cf02de55bf00a874fc1cc2aa53b65596294fe495 From 8886fc8286cb5f47f10407803b628bb1eae2b886 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 15 Dec 2016 16:48:22 -0800 Subject: [PATCH 0130/1833] Fix build: install libjemalloc1 when build docker images (#128) * Fix build: install libjemalloc1 when build docker images * (comment) --- dockers/docker-base | 2 +- dockers/docker-database/Dockerfile.template | 4 ++++ dockers/docker-orchagent/Dockerfile.template | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dockers/docker-base b/dockers/docker-base index 73b5fcee2840..1ae8aaa535f8 160000 --- a/dockers/docker-base +++ b/dockers/docker-base @@ -1 +1 @@ -Subproject commit 73b5fcee2840adcc64bee5e6ffb226a9928959e4 +Subproject commit 1ae8aaa535f8e2fd1ffa9d150abe5855d9ac2c70 diff --git a/dockers/docker-database/Dockerfile.template b/dockers/docker-database/Dockerfile.template index adc6dad9330d..5d26946acf0a 100644 --- a/dockers/docker-database/Dockerfile.template +++ b/dockers/docker-database/Dockerfile.template @@ -4,6 +4,10 @@ RUN apt-get update COPY deps/ deps +## Install redis-tools dependencies +## TODO: implicitly install dependencies +RUN apt-get -y install libjemalloc1 + SED_DPKG ## Clean up diff --git a/dockers/docker-orchagent/Dockerfile.template b/dockers/docker-orchagent/Dockerfile.template index 04979db4d9d6..c8c858bf2c2c 100755 --- a/dockers/docker-orchagent/Dockerfile.template +++ b/dockers/docker-orchagent/Dockerfile.template @@ -4,6 +4,10 @@ RUN apt-get update RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansson4 +## Install redis-tools dependencies +## TODO: implicitly install dependencies +RUN apt-get -y install libjemalloc1 + COPY deps /deps SED_DPKG From f20bba87a067844baab5c6e8fb160257af449ef2 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 15 Dec 2016 17:19:11 -0800 Subject: [PATCH 0131/1833] Refine get_docker-base: store the file in target directory (#129) --- get_docker-base.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/get_docker-base.sh b/get_docker-base.sh index b85ab4166104..c417ca12c111 100755 --- a/get_docker-base.sh +++ b/get_docker-base.sh @@ -9,9 +9,12 @@ set -x -e . ./functions.sh +TARGET_PATH=$(sed -n 's/TARGET_PATH\s*=\s*//p' slave.mk) + ## [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Read-only link of Azure Blob storage with shared access signature (SAS)")] BASE_URL="https://sonicstorage.blob.core.windows.net/packages/docker-base.ea507753d98b0769e2a15be13003331f8ad38d1c15b40a683e05fc53b1463b10.gz?sv=2015-04-05&sr=b&sig=YNN6eYVMEFndUaiHIRnqcZFdDZwIG%2BaAuVj0IoyDWPw%3D&se=2026-10-27T20%3A46%3A18Z&sp=r" base_image_name=docker-base docker_try_rmi $base_image_name -curl "$BASE_URL" | docker load +wget --no-use-server-timestamps -O $TARGET_PATH/$base_image_name.gz "$BASE_URL" +docker load < $TARGET_PATH/$base_image_name.gz From f92ee6937c0984ea6b6e0a9befe1be558e661c01 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 15 Dec 2016 18:16:47 -0800 Subject: [PATCH 0132/1833] Add mkdir if the target dir does not exist (#130) --- get_docker-base.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/get_docker-base.sh b/get_docker-base.sh index c417ca12c111..ff2bdeaff02b 100755 --- a/get_docker-base.sh +++ b/get_docker-base.sh @@ -16,5 +16,6 @@ BASE_URL="https://sonicstorage.blob.core.windows.net/packages/docker-base.ea5077 base_image_name=docker-base docker_try_rmi $base_image_name +mkdir -p $TARGET_PATH wget --no-use-server-timestamps -O $TARGET_PATH/$base_image_name.gz "$BASE_URL" docker load < $TARGET_PATH/$base_image_name.gz From da9022971e5e5714ff6c4fa0ab7eb4991eb2b6b2 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 15 Dec 2016 19:43:17 -0800 Subject: [PATCH 0133/1833] Makefile: Add platform generic for platform neutral targets (#127) --- platform/generic/rules.mk | 6 ++++++ slave.mk | 2 ++ 2 files changed, 8 insertions(+) create mode 100644 platform/generic/rules.mk diff --git a/platform/generic/rules.mk b/platform/generic/rules.mk new file mode 100644 index 000000000000..5ef6468b2f7e --- /dev/null +++ b/platform/generic/rules.mk @@ -0,0 +1,6 @@ +SONIC_ALL += $(DOCKER_DATABASE) \ + $(DOCKER_FPM) \ + $(DOCKER_TEAM) \ + $(DOCKER_LLDP_SV2) \ + $(DOCKER_SNMP_SV2) \ + $(DOCKER_PLATFORM_MONITOR) diff --git a/slave.mk b/slave.mk index ee89df4b4c8b..cb7cc0371583 100644 --- a/slave.mk +++ b/slave.mk @@ -26,6 +26,7 @@ PROJECT_ROOT = $(shell pwd) CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo undefined) PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM) +PLATFORM_GENERIC_PATH = platform/generic ############################################################################### ## Utility rules @@ -51,6 +52,7 @@ distclean : .platform clean include $(RULES_PATH)/config include $(RULES_PATH)/functions include $(RULES_PATH)/*.mk +include $(PLATFORM_GENERIC_PATH)/rules.mk ifneq ($(CONFIGURED_PLATFORM), undefined) include $(PLATFORM_PATH)/rules.mk endif From 775156f3bfbb259d2585b0e7020bb815cad57fbf Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 16 Dec 2016 19:12:56 -0800 Subject: [PATCH 0134/1833] [thrift]: fix thrift 0.9.3 test failure (#135) https://issues.apache.org/jira/browse/THRIFT-3577 --- src/thrift/Makefile | 1 + .../patch/THRIFT-3577-assertion-failed.patch | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/thrift/patch/THRIFT-3577-assertion-failed.patch diff --git a/src/thrift/Makefile b/src/thrift/Makefile index edb14e0cfa0d..2b450e52d4c1 100644 --- a/src/thrift/Makefile +++ b/src/thrift/Makefile @@ -19,6 +19,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-source -x thrift_$(THRIFT_VERSION_FULL).dsc pushd thrift-$(THRIFT_VERSION) + patch -p1 < ../patch/THRIFT-3577-assertion-failed.patch dpkg-buildpackage -d -rfakeroot -b -us -uc popd diff --git a/src/thrift/patch/THRIFT-3577-assertion-failed.patch b/src/thrift/patch/THRIFT-3577-assertion-failed.patch new file mode 100644 index 000000000000..ad984ebbdb73 --- /dev/null +++ b/src/thrift/patch/THRIFT-3577-assertion-failed.patch @@ -0,0 +1,27 @@ +From 9f96e358fb5bdac8a6570dc3c79e9416e4f407ce Mon Sep 17 00:00:00 2001 +From: Nobuaki Sukegawa +Date: Mon, 22 Feb 2016 01:33:27 +0900 +Subject: [PATCH] THRIFT-3577 assertion failed at line 512 of + testcontainertest.c + +--- + lib/c_glib/test/testcontainertest.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/c_glib/test/testcontainertest.c b/lib/c_glib/test/testcontainertest.c +index 852254b..1cbc55c 100644 +--- a/lib/c_glib/test/testcontainertest.c ++++ b/lib/c_glib/test/testcontainertest.c +@@ -507,9 +507,9 @@ main(int argc, char *argv[]) + + /* Make sure the server stopped only because it was interrupted (by the + child process terminating) */ +- g_assert (g_error_matches (error, +- THRIFT_SERVER_SOCKET_ERROR, +- THRIFT_SERVER_SOCKET_ERROR_ACCEPT)); ++ g_assert(!error || g_error_matches(error, ++ THRIFT_SERVER_SOCKET_ERROR, ++ THRIFT_SERVER_SOCKET_ERROR_ACCEPT)); + + /* Free our resources */ + g_object_unref (server); From b8ca9c40475dc5e826341dd4df2f5ac9ccc2400a Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 19 Dec 2016 19:39:07 +0200 Subject: [PATCH 0135/1833] Add sx-kernel to all targets (#138) Define sx-kernel pckages in sdk.mk Add them to SONIC_ALL --- platform/mellanox/rules.mk | 3 ++- platform/mellanox/sdk.mk | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index a31d22fc25a6..abeed6c1080e 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -14,7 +14,8 @@ SONIC_ALL += $(DOCKER_SYNCD_MLNX) \ $(DOCKER_SNMP_SV2) \ $(DOCKER_TEAM) \ $(DOCKER_PLATFORM_MONITOR) \ - debs/$(MLNX_HW_MANAGEMENT) + debs/$(MLNX_HW_MANAGEMENT) \ + debs/$(SX_KERNEL) # Inject mlnx sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index d7a887eb1edb..e9f4524dda5b 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -39,6 +39,9 @@ SXD_LIBS_DEV_STATIC = sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV_STATIC))) #packages that are required for runtime only PYTHON_SDK_API = python-sdk-api_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +SX_KERNEL = sx-kernel_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV))) define make_url $(1)_URL = $(MLNX_SDK_BASE_URL)/$(1) @@ -47,6 +50,6 @@ endef $(eval $(foreach deb,$(MLNX_SDK_DEBS),$(call make_url,$(deb)))) $(eval $(foreach deb,$(MLNX_SDK_RDEBS),$(call make_url,$(deb)))) -$(eval $(foreach deb,$(PYTHON_SDK_API),$(call make_url,$(deb)))) +$(eval $(foreach deb,$(PYTHON_SDK_API) $(SX_KERNEL) $(SX_KERNEL_DEV),$(call make_url,$(deb)))) -SONIC_ONLINE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) +SONIC_ONLINE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) $(SX_KERNEL) From aefb32b2e8a0afdd3438d1a2c2fd04aa2a7b2a91 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 19 Dec 2016 19:39:31 +0200 Subject: [PATCH 0136/1833] [sonic-slave]: Install j2cli for templating (#139) --- sonic-slave/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 50e96bfcd1d9..7b03e4ee8162 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -82,6 +82,9 @@ RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libper # For mpdecimal RUN apt-get update && apt-get install -y docutils-common libjs-sphinxdoc libjs-underscore python-docutils python-jinja2 python-markupsafe python-pygments python-roman python-sphinx sphinx-common python3-sphinx +# For templating +RUN pip install j2cli + # Install depot-tools (for git-retry) RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /usr/share/depot_tools ENV PATH /usr/share/depot_tools:$PATH From 506af2ecab6b94de383b53f30745be603b23a43d Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 19 Dec 2016 19:41:08 +0200 Subject: [PATCH 0137/1833] Update .gitignore (#140) --- .gitignore | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 18225c156201..372634cfb016 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,31 @@ -deps/ -dockers/*/files/ -*.bin -*.deb -*.zip +# Build system related +.platform + +# Build artifacts fsroot/ fs.* -src/hiredis/hiredis_* -src/hiredis/hiredis-*/ -src/quagga/quagga_* -src/quagga/quagga/ -src/initramfs-tools/initramfs-tools/ -src/redis/redis_* -src/redis/redis-*/ +target/ + +# Subdirectories in src +src/hiredis/* +!src/hiredis/Makefile +src/initramfs-tools/* +!src/initramfs-tools/Makefile +src/redis/* +!src/redis/Makefile +src/libnl3/* +!src/libnl3/Makefile +src/libteam/* +!src/libteam/Makefile +src/snmpd/* +!src/snmpd/Makefile +src/thrift/* +!src/thrift/Makefile + +# Autogenerated Dockerfiles +dockers/docker-database/Dockerfile +dockers/docker-fpm/Dockerfile +dockers/docker-lldp-sv2/Dockerfile +dockers/docker-orchagent/Dockerfile +dockers/docker-snmp-sv2/Dockerfile +dockers/docker-team/Dockerfile From 7039a05604b83d47a6ce4e47bcd9efba1a7d92df Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 19 Dec 2016 19:41:33 +0200 Subject: [PATCH 0138/1833] Add .gitignore for Mellanox platform (#141) --- platform/mellanox/.gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 platform/mellanox/.gitignore diff --git a/platform/mellanox/.gitignore b/platform/mellanox/.gitignore new file mode 100644 index 000000000000..3c0769067437 --- /dev/null +++ b/platform/mellanox/.gitignore @@ -0,0 +1,10 @@ +# Subdirectories +mlnx-sai/* +!mlnx-sai/Makefile +hw-management/* +!hw-management/Makefile +mft/* +!mft/Makefile + +# Autogenerated Dockerfiles +docker-syncd-mlnx/Dockerfile From 9390d54775dddc8bf41e1c1e9bdc05ca6f87a8da Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 19 Dec 2016 13:27:30 -0800 Subject: [PATCH 0139/1833] [readme]: Add P4 build status --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d6fb75c3b99c..46927d6c1396 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -Mellanox[![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all)Broadcom[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) +Broadcom[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) +Mellanox[![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) +P4[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) # Build SONiC Switch Images - buildimage From ab4a35a1d1ace48814e2e28e529d7456ff1133db Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 19 Dec 2016 14:35:09 -0800 Subject: [PATCH 0140/1833] [submodules]: Update submodules to latest commits (#143) --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 96bcb6382a12..e393930b8bc3 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 96bcb6382a12d789830d848fe05681ee75238162 +Subproject commit e393930b8bc38fcdb950139db8c2353b887128c8 diff --git a/src/sonic-swss b/src/sonic-swss index 05bac483585d..205405667396 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 05bac483585dd5e564ed5db43efb1020fa25c703 +Subproject commit 205405667396f606d9560ed6d861063f35f07d94 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 136aca5ff74d..81ed1b603add 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 136aca5ff74d7082d0a1def8b02032689ce3507e +Subproject commit 81ed1b603add087b0ea3827036910a6785dba0c5 From 4356a6bef692e1aab6877a542a80cfe2afc9c26c Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 20 Dec 2016 00:39:24 -0800 Subject: [PATCH 0141/1833] [team]: Add docker-team dependencies (#136) --- rules/docker-team.mk | 2 +- rules/swss.mk | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/rules/docker-team.mk b/rules/docker-team.mk index a11698634d57..3f5b99ac9666 100644 --- a/rules/docker-team.mk +++ b/rules/docker-team.mk @@ -2,6 +2,6 @@ DOCKER_TEAM = docker-team.gz $(DOCKER_TEAM)_PATH = $(DOCKERS_PATH)/docker-team -$(DOCKER_TEAM)_DEPENDS += $(SWSS) +$(DOCKER_TEAM)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(DOCKER_TEAM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_TEAM) diff --git a/rules/swss.mk b/rules/swss.mk index 4761d2fb8876..6b2620f81309 100644 --- a/rules/swss.mk +++ b/rules/swss.mk @@ -4,6 +4,5 @@ SWSS = swss_1.0.0_amd64.deb $(SWSS)_SRC_PATH = $(SRC_PATH)/sonic-swss $(SWSS)_DEPENDS += $(LIBSAIREDIS_DEV) $(LIBSAIMETADATA_DEV) $(LIBTEAM_DEV) \ $(LIBTEAMDCT) $(LIBTEAM_UTILS) -$(SWSS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBTEAM) $(LIBTEAMDCT) \ - $(LIBTEAM_UTILS) +$(SWSS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBTEAM) SONIC_DPKG_DEBS += $(SWSS) From 02ba3f9b5cb4741a564dfeb3930bdd5bcbf52c51 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 19 Dec 2016 02:30:09 +0200 Subject: [PATCH 0142/1833] Create first draft for buildimage readme --- README.buildsystem.md | 96 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 README.buildsystem.md diff --git a/README.buildsystem.md b/README.buildsystem.md new file mode 100644 index 000000000000..95476c88d412 --- /dev/null +++ b/README.buildsystem.md @@ -0,0 +1,96 @@ +# SONiC Buildimage Guide +## Overview +SONiC build system is a *GNU make* based environment for build process automation. +It consists of two main parts: + * Backend - collection of makefiles and other helpers that define generic target groups, used by recipes + * Frontend - collection of recipes, that define metadata for each build target + +## Structure +File structure of SONiC Buildimage is as follows: +``` +sonic-buildimage/ + Makefile + slave.mk + sonic-slave/ + Dockerfile + rules/ + config + functions + recipe1.mk + .. + dockers/ + docker1/ + Dockerfile.template + .. + src/ + submodule1/ + .. + package1/ + Makefile + .. + platform/ + vendor1/ + .. + target/ + debs/ + python-wheels/ +``` +### Backend +**Makefile**, **slave.mk** and **sonic-slave/Dockerfile** are the backend of buildimage. +*slave.mk* is the actual makefile. It defines a set of rules for *target groups* (more on that later). +You can find a make rules for every target that is defined in recipe there. +*Makefile* is a wrapper over sonic-slave docker image. +Every part of build is executed in a docker container called sonic-slave, specifically crafted for this environment. +If build is started for the first time, a new sonic-slave image will be built form *sonic-slave/Dockerfile* on the machine. +It might take some time, so be patient. +After that all subsequent make commands will be executed inside this container. +*Makefile* takes every target that is passed to make command and delegates it as an entry point to a container, +making process of running container transparent. + +### Frontend +**rules/** has a collection of recipes for platform independent targets. +Every recipe is a file that describes a metadata of a specific target, that is needed for its build. +You might find **rules/config** very useful, as it is a configuration file for a build system, which enables/disables some tweaks. +**dockers/** directory is a place where you can find Dockerfiles for generic docker images. +**src/** is a place where a source code for generic packages goes. +It has both submodules (simple case, just run dpkg-buildpackage to build), +and directories with more complcated components, that provide their own Makefiles. +**platform/** contains all vendor-specific recipes, submodules etc. +Every **platform/[VENDOR]/** directory is a derived part of buildimage frontend, that defines rules and targets for a concrete vendor. + +### Build output +**target/** is basically a build output. You can find all biuld artifacts there. +## Recipes and target groups +Now let's go over a definition of recipes and target groups. +*Recipe* is a small makefile that defines a target and set of variables for building it. +*Target group* is a set of targets that are built according to the same rulels. + +### Recipe example +Lets take a recipe for swss as an example: +```make +# libswsscommon package + +LIBSWSSCOMMON = libswsscommon_1.0.0_amd64.deb +$(LIBSWSSCOMMON)_SRC_PATH = $(SRC_PATH)/sonic-swss-common +$(LIBSWSSCOMMON)_DEPENDS += $(LIBHIREDIS_DEV) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) \ + $(LIBNL_ROUTE3_DEV) $(LIBNL_NF3_DEV) \ + $(LIBNL_CLI_DEV) +$(LIBSWSSCOMMON)_RDEPENDS += $(LIBHIREDIS) $(LIBNL3) $(LIBNL_GENL3) \ + $(LIBNL_ROUTE3) $(LIBNL_NF3) $(LIBNL_CLI) +SONIC_DPKG_DEBS += $(LIBSWSSCOMMON) + +LIBSWSSCOMMON_DEV = libswsscommon-dev_1.0.0_amd64.deb +$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV))) +``` +First we define our package swsscommon. +Then we secify **SRC_PATH** (path to sources), +**DEPENDS** (build dependencies), +and **RDEPENDS** (runtime dependencies for docker installation). +Then we add our target to SONIC_DPKG_DEBS target group. +At the end we define a dev package for swsscommon and make it derived from main one. +Using **add_derived_package** just makes a deep copy of package's metadata, so that we don't have to repeat ourselves. + +### Target groups +**TODO** +## Tips & Tricks +**TODO** From 826851f948ee5eac81b65d5cf2be51256459073c Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 20 Dec 2016 12:34:05 +0200 Subject: [PATCH 0143/1833] Update README.buildsystem.md Add section with recipes and target groups Add section with tips & tricks --- README.buildsystem.md | 126 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 117 insertions(+), 9 deletions(-) diff --git a/README.buildsystem.md b/README.buildsystem.md index 95476c88d412..947ee6b54cf8 100644 --- a/README.buildsystem.md +++ b/README.buildsystem.md @@ -1,6 +1,6 @@ # SONiC Buildimage Guide ## Overview -SONiC build system is a *GNU make* based environment for build process automation. +SONiC buildimage is a *GNU make* based environment for build process automation. It consists of two main parts: * Backend - collection of makefiles and other helpers that define generic target groups, used by recipes * Frontend - collection of recipes, that define metadata for each build target @@ -38,10 +38,11 @@ sonic-buildimage/ ### Backend **Makefile**, **slave.mk** and **sonic-slave/Dockerfile** are the backend of buildimage. *slave.mk* is the actual makefile. It defines a set of rules for *target groups* (more on that later). -You can find a make rules for every target that is defined in recipe there. -*Makefile* is a wrapper over sonic-slave docker image. +You can find a make rule for every target that is defined in recipe there. +*Makefile* is a wrapper over sonic-slave docker image. + Every part of build is executed in a docker container called sonic-slave, specifically crafted for this environment. -If build is started for the first time, a new sonic-slave image will be built form *sonic-slave/Dockerfile* on the machine. +If build is started for the first time on a particular host, a new sonic-slave image will be built form *sonic-slave/Dockerfile* on the machine. It might take some time, so be patient. After that all subsequent make commands will be executed inside this container. *Makefile* takes every target that is passed to make command and delegates it as an entry point to a container, @@ -60,13 +61,16 @@ Every **platform/[VENDOR]/** directory is a derived part of buildimage frontend, ### Build output **target/** is basically a build output. You can find all biuld artifacts there. + ## Recipes and target groups Now let's go over a definition of recipes and target groups. -*Recipe* is a small makefile that defines a target and set of variables for building it. -*Target group* is a set of targets that are built according to the same rulels. +**Recipe** is a small makefile that defines a target and set of variables for building it. +If you want to add a new target to buildimage (.deb package or docker image), you have to create a recipe for this target. +**Target group** is a set of targets that are built according to the same rulels. +Every recipe sets a target group to which this target belongs. ### Recipe example -Lets take a recipe for swss as an example: +Lets take a recipe for swsscommon as an example: ```make # libswsscommon package @@ -91,6 +95,110 @@ At the end we define a dev package for swsscommon and make it derived from main Using **add_derived_package** just makes a deep copy of package's metadata, so that we don't have to repeat ourselves. ### Target groups -**TODO** +**SONIC_DPKG_DEBS** +Main target group for building .deb packages. +Define: +```make +SOME_NEW_DEB = some_new_deb.deb # name of your package +$(SOME_NEW_DEB)_SRC_PATH = $(SRC_PATH)/project_name # path to directory with sources +$(SOME_NEW_DEB)_DEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ... # build dependencies +$(SOME_NEW_DEB)_RDEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ... # runtime dependencies +SONIC_DPKG_DEBS += $(SOME_NEW_DEB) # add package to this target group +``` + +**SONIC_PYTHON_STDEB_DEBS** +Same as above, but instead of building package using dpkg-buildpackage it executes `python setup.py --command-packages=stdeb.command bdist_deb`. +Define: +```make +SOME_NEW_DEB = some_new_deb.deb # name of your package +$(SOME_NEW_DEB)_SRC_PATH = $(SRC_PATH)/project_name # path to directory with sources +$(SOME_NEW_DEB)_DEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ... # build dependencies +$(SOME_NEW_DEB)_RDEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ... # runtime dependencies +SONIC_PYTHON_STDEB_DEBS += $(SOME_NEW_DEB) # add package to this target group +``` + +**SONIC_MAKE_DEBS** +This is a bit more flexible case. +If you have to do some specific type of build or apply pathes prior to build, just define your owm Makefile and add it to buildomage. +Define: +```make +SOME_NEW_DEB = some_new_deb.deb # name of your package +$(SOME_NEW_DEB)_SRC_PATH = $(SRC_PATH)/project_name # path to directory with sources +$(SOME_NEW_DEB)_DEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ... # build dependencies +$(SOME_NEW_DEB)_RDEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ... # runtime dependencies +SONIC_MAKE_DEBS += $(SOME_NEW_DEB) # add package to this target group +``` + +If some packages have to be built locally due to some legal issues or they are already prebuilt and available online, you might find next four target groups useful. + +**SONIC_COPY_DEBS** +Those packages will be just copied from specified location on your machine. +Define: +```make +SOME_NEW_DEB = some_new_deb.deb # name of your package +$(SOME_NEW_DEB)_PATH = path/to/some_new_deb.deb # path to file +SONIC_COPY_DEBS += $(SOME_NEW_DEB) # add package to this target group +``` + +**SONIC_COPY_FILES** +Same as above, but applicable for regular files. Use when you need some regular files for installation in docker container. +Define: +```make +SOME_NEW_FILE = some_new_file # name of your file +$(SOME_NEW_FILE)_PATH = path/to/some_new_file # path to file +SONIC_COPY_FILES += $(SOME_NEW_FILE) # add file to this target group +``` + +**SONIC_ONLINE_DEBS** +Target group for debian packages that should be fetched from an online source. +Define: +```make +SOME_NEW_DEB = some_new_deb.deb # name of your package +$(SOME_NEW_DEB)_URL = https://url/to/this/deb.deb # path to file # URL for downloading +SONIC_ONLINE_DEBS += $(SOME_NEW_DEB) # add file to this target group +``` + +**SONIC_ONLINE_FILES** +Target group for regular files that should be fetched from an online source. +Define: +```make +SOME_NEW_FILE = some_new_file # name of your file +$(SOME_NEW_FILE)_URL = https://url/to/this/file # URL for downloading +SONIC_ONLINE_FILES += $(SOME_NEW_FILE) # add file to this target group +``` + +Docker images also have their target groups. +**SONIC_SIMPLE_DOCKER_IMAGES** +As you see from a name of the group, it is intended to build a docker image from a regular Dockerfile. +Define: +```make +SOME_DOCKER = some_docker.gz # name of your docker +$(SOME_DOCKER)_PATH = path/to/your/docker # path to your Dockerfile +SONIC_SIMPLE_DOCKER_IMAGES += $(SOME_DOCKER) # add docker to this group +``` + +**SONIC_DOCKER_IMAGES** +This one is a bit more sophisticated. You can define debian packages from buildimage that will be installed to it, and corresponding Dockerfile will be dinamically generated from a template. +Define: +```make +SOME_DOCKER = some_docker.gz # name of your docker +$(SOME_DOCKER)_PATH = path/to/your/docker # path to your Dockerfile +$(SOME_DOCKER)_DEPENDS += $(SOME_DEB1) $(SOME_DEB2) # .deb packages to install into image +$(SOME_DOCKER)_PYTHON_WHEELS += $(SOME_WHL1) $(SOME_WHL2) # python wheels to install into image +$(SOME_DOCKER)_LOAD_DOCKERS += $(SOME_OTHER_DOCkER) # docker image from which this one is built +SONIC_DOCKER_IMAGES += $(SOME_DOCKER) # add docker to this group +``` + ## Tips & Tricks -**TODO** +Although every target is built inside a sonic-slave container, which exits at the end of build, you can enter bash of sonic-slave using this command: +``` +$ sonic-slave-bash +``` +It is very useful for debugging when you add a new target and facing some trubles. + +sonic-slave environment is built only once, but if sonic-slave/Dockerfile was updated, you can rebuild it with this command: +``` +$ sonic-slave-build +``` + +All target groups are used by one or another recipe, so use those recipes as a reference when adding new ones. From b1b4a0b539ed8703f260065ef222c932af1404b2 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 20 Dec 2016 14:05:22 +0200 Subject: [PATCH 0144/1833] Add link to build system documentation in README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 46927d6c1396..5e93c543e0e8 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ If it is already cloned, however there is no files under ./dockers/docker-base/ git submodule update --init --recursive # Usage + +**NOTE:** In order to be more familiar with build process and make some hanges to it, it is recommended to read this short [Documentation](README.buildsystem.md) + To build NOS installer image and docker images, run command line make configure PLATFORM=[VENDOR] From 3c01b398f48274d8cc738fe71d72ab82f620b70d Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 20 Dec 2016 13:29:00 -0800 Subject: [PATCH 0145/1833] [docker]: add support for Force10-S6100 (#145) --- dockers/docker-orchagent/start.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 0cea8e4de988..9530f39261f5 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -38,6 +38,9 @@ if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then PORTSYNCD_ARGS+="-p /etc/ssw/Force10-S6000/port_config.ini" SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " +elif [ "$onie_platform" == "x86_64-dell_s6100_c2538-r0" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" + PORTSYNCD_ARGS+="-p /etc/ssw/Force10-S6100/port_config.ini" elif [ "$aboot_platform" == "x86_64-arista_7050_qx32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" PORTSYNCD_ARGS+="-p /etc/ssw/Arista-7050-QX32/port_config.ini" From 562d8759004b3982a617d6e378fb5c319eeeda3c Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Tue, 20 Dec 2016 23:30:48 +0200 Subject: [PATCH 0146/1833] [platform]: Update Mellanox SAI and SDK version. Add SDK installation dependencies. (#142) * Update Mellanox SAI and SDK version. Add SDK installation dependencies * Update Mellanox Fimware version. * Update sdk.mk --- platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh | 2 +- platform/mellanox/mlnx-sai.mk | 2 +- platform/mellanox/sdk.mk | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh b/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh index 81514f77b062..eee5d5a45ef8 100755 --- a/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh +++ b/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh @@ -1,7 +1,7 @@ #!/bin/bash query_retry_count_max="10" -required_fw_version="13.1200.0116" +required_fw_version="13.1220.0130" fw_file=/etc/mlnx/fw-SPC.mfa run_or_fail() { diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index a80bd87a0292..3b8db59e7fc5 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = c7ccc8a8ba9864b62b0c038ad57d6dd94771f5ee +MLNX_SAI_REVISION = 35e5e8739bec80c19053b7bb9cf6d083b8144fb5 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index e9f4524dda5b..71b3d218418b 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/9ae5a29e344e23cd4ce92805f990f8ce8fab292a/sdk -MLNX_SDK_VERSION = 4.2.3002 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/35e5e8739bec80c19053b7bb9cf6d083b8144fb5/sdk +MLNX_SDK_VERSION = 4.2.3102 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) @@ -11,6 +11,7 @@ MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_DEV) $(SX_ACL_RM_DEV) \ $(SXD_LIBS_DEV_STATIC) $(TESTX_DEV) APPLIBS = applibs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(APPLIBS)_DEPENDS += $(SX_COMPLIB) $(SX_GEN_UTILS) $(SXD_LIBS) $(LIBNL3) $(LIBNL_GENL3) APPLIBS_DEV = applibs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DEV))) IPROUTE2 = iproute2_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb @@ -22,9 +23,11 @@ $(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV))) SX_COMPLIB_DEV_STATIC = sx-complib-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV_STATIC))) SX_EXAMPLES = sx-examples_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(SX_EXAMPLES)_DEPENDS += $(APPLIBS) $(SX_SCEW) $(SXD_LIBS) SX_EXAMPLES_DEV = sx-examples-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_EXAMPLES),$(SX_EXAMPLES_DEV))) SX_GEN_UTILS = sx-gen-utils_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(SX_GEN_UTILS)_DEPENDS += $(SX_COMPLIB) SX_GEN_UTILS_DEV = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_GEN_UTILS),$(SX_GEN_UTILS_DEV))) SX_SCEW = sx-scew_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb @@ -39,6 +42,7 @@ SXD_LIBS_DEV_STATIC = sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV_STATIC))) #packages that are required for runtime only PYTHON_SDK_API = python-sdk-api_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(PYTHON_SDK_API)_DEPENDS += $(APPLIBS) $(SXD_LIBS) SX_KERNEL = sx-kernel_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV))) From b77d53fd8f41ba48d03dfbfa05017595f0bff65e Mon Sep 17 00:00:00 2001 From: jiacao Date: Wed, 21 Dec 2016 02:44:41 -0800 Subject: [PATCH 0147/1833] Add redis in sonic p4 image (#146) --- platform/p4/docker-sonic-p4.mk | 2 +- platform/p4/docker-sonic-p4/Dockerfile.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/p4/docker-sonic-p4.mk b/platform/p4/docker-sonic-p4.mk index 3204f1d50f97..0e10e9e319fc 100644 --- a/platform/p4/docker-sonic-p4.mk +++ b/platform/p4/docker-sonic-p4.mk @@ -2,6 +2,6 @@ DOCKER_SONIC_P4 = docker-sonic-p4.gz $(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4 -$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) +$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) $(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_P4) diff --git a/platform/p4/docker-sonic-p4/Dockerfile.template b/platform/p4/docker-sonic-p4/Dockerfile.template index f03127502104..4f68259d02f4 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.template +++ b/platform/p4/docker-sonic-p4/Dockerfile.template @@ -2,7 +2,7 @@ FROM docker-base RUN apt-get update -RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 +RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 COPY deps /deps From 92d9f9b23a2f7ad5595666eb26f44e9469242ef1 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 21 Dec 2016 21:50:35 +0200 Subject: [PATCH 0148/1833] Fix commands in buildsystem README (#147) --- README.buildsystem.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.buildsystem.md b/README.buildsystem.md index 947ee6b54cf8..666ddf026540 100644 --- a/README.buildsystem.md +++ b/README.buildsystem.md @@ -192,13 +192,13 @@ SONIC_DOCKER_IMAGES += $(SOME_DOCKER) # add docker to this group ## Tips & Tricks Although every target is built inside a sonic-slave container, which exits at the end of build, you can enter bash of sonic-slave using this command: ``` -$ sonic-slave-bash +$ make sonic-slave-bash ``` It is very useful for debugging when you add a new target and facing some trubles. sonic-slave environment is built only once, but if sonic-slave/Dockerfile was updated, you can rebuild it with this command: ``` -$ sonic-slave-build +$ make sonic-slave-build ``` All target groups are used by one or another recipe, so use those recipes as a reference when adding new ones. From c07e54c3e1e57e0629e60213603c5b3b8c8ea933 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 21 Dec 2016 15:16:18 -0800 Subject: [PATCH 0149/1833] [platform-monitor] update apt cache (#148) --- dockers/docker-platform-monitor/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-platform-monitor/Dockerfile b/dockers/docker-platform-monitor/Dockerfile index 041f03f69927..9bd3d79d9a70 100755 --- a/dockers/docker-platform-monitor/Dockerfile +++ b/dockers/docker-platform-monitor/Dockerfile @@ -2,7 +2,8 @@ FROM docker-base ## Pre-install the fundamental packages ## Clean up -RUN apt-get -y install \ +RUN apt-get update && \ + apt-get -y install \ smartmontools \ sensord \ && \ From 48d7fe1009f38420914386022f958628aecf2e9a Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 21 Dec 2016 15:51:23 -0800 Subject: [PATCH 0150/1833] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e93c543e0e8..47f5ae33062c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,10 @@ P4[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildi Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS. # Prerequisite -## Clone or fetch the code repository with all git submodules +## SAI Version +SONiC V2 is using [SAI 0.9.4](https://github.com/opencomputeproject/SAI/tree/v0.9.4). + +# Clone or fetch the code repository with all git submodules To clone the code repository recursively, assuming git version 1.9 or newer git clone --recursive https://github.com/Azure/sonic-buildimage.git From dc4dc7ba99e8d6ab3ee9d02644b2ac77248a0912 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 21 Dec 2016 16:43:41 -0800 Subject: [PATCH 0151/1833] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 47f5ae33062c..2857038178b6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ P4[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildi Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS. # Prerequisite -## SAI Version +# SAI Version SONiC V2 is using [SAI 0.9.4](https://github.com/opencomputeproject/SAI/tree/v0.9.4). # Clone or fetch the code repository with all git submodules From 2380359059c76f6e0b2f10bbbeb1a3858320ef7d Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 21 Dec 2016 18:20:46 -0800 Subject: [PATCH 0152/1833] Add apt update in Dockerfile, since cached lists file may be obsoleted (#149) [docker]: Add apt update in Dockerfile, since cached lists file may be obsoleted --- dockers/docker-snmp/Dockerfile | 2 +- dockers/docker-vas/Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dockers/docker-snmp/Dockerfile b/dockers/docker-snmp/Dockerfile index 29bad3d746b4..7ffc0b122870 100644 --- a/dockers/docker-snmp/Dockerfile +++ b/dockers/docker-snmp/Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update && \ dpkg_apt /deps/libsnmp30_*.deb && \ dpkg_apt /deps/snmp_*.deb && \ dpkg_apt /deps/snmpd_*.deb && \ - rm -rf /deps + rm -rf /deps # install subagent RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ diff --git a/dockers/docker-vas/Dockerfile b/dockers/docker-vas/Dockerfile index 1b51bb968cff..84b5eb46d40e 100755 --- a/dockers/docker-vas/Dockerfile +++ b/dockers/docker-vas/Dockerfile @@ -5,7 +5,8 @@ COPY user-override /etc/opt/quest/vas/user-override ## Pre-install the fundamental packages ## Clean up -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ +RUN apt-get update && \ + dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ apt-get -y install \ sudo \ && \ From a01d484087f182c26cd08e38af34a774e3ea91cc Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 21 Dec 2016 20:30:26 -0800 Subject: [PATCH 0153/1833] [docker-base] Update git submodule hash (#150) --- dockers/docker-base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-base b/dockers/docker-base index 1ae8aaa535f8..4b42689e8c5b 160000 --- a/dockers/docker-base +++ b/dockers/docker-base @@ -1 +1 @@ -Subproject commit 1ae8aaa535f8e2fd1ffa9d150abe5855d9ac2c70 +Subproject commit 4b42689e8c5b14deda6ef64a287e4641bd999bf5 From a11593a7468f9ee10faf70f5aeb116542c4c2d37 Mon Sep 17 00:00:00 2001 From: jiacao Date: Wed, 21 Dec 2016 20:30:47 -0800 Subject: [PATCH 0154/1833] Fix the redis.conf file for sonic p4 image (#151) --- platform/p4/docker-sonic-p4/Dockerfile.template | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/p4/docker-sonic-p4/Dockerfile.template b/platform/p4/docker-sonic-p4/Dockerfile.template index 4f68259d02f4..357548591d1a 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.template +++ b/platform/p4/docker-sonic-p4/Dockerfile.template @@ -17,4 +17,10 @@ ADD rsyslog.conf /etc/rsyslog.conf RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps +RUN sed -ri 's/^daemonize yes$/daemonize no/; \ + s/^logfile .*$/logfile ""/; \ + s/^# syslog-enabled no$/syslog-enabled no/; \ + s/^# unixsocket/unixsocket/ \ + ' /etc/redis/redis.conf + ENTRYPOINT /bin/bash From e3b126893ba37f0fe3292f9f953c4d9a63d4f631 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 22 Dec 2016 21:32:07 -0800 Subject: [PATCH 0155/1833] [makefile]: Exclude p4 from building generic platform dockers (#155) --- platform/broadcom/rules.mk | 2 ++ platform/cavium/rules.mk | 2 ++ platform/mellanox/rules.mk | 2 ++ slave.mk | 1 - 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 79f00e16fa35..3ad72308b56f 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,3 +1,5 @@ +include $(PLATFORM_GENERIC_PATH)/rules.mk + include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 7d8ef49177d3..93f89f7382cf 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -1,3 +1,5 @@ +include $(PLATFORM_GENERIC_PATH)/rules.mk + CAVM_LIBSAI = libsai.deb $(CAVM_LIBSAI)_PATH = $(PLATFORM_PATH)/cavm_sdk CAVM_SAI = sai.deb diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index abeed6c1080e..bb07273417b7 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -1,3 +1,5 @@ +include $(PLATFORM_GENERIC_PATH)/rules.mk + include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/fw.mk include $(PLATFORM_PATH)/mft.mk diff --git a/slave.mk b/slave.mk index cb7cc0371583..74f07cad06b8 100644 --- a/slave.mk +++ b/slave.mk @@ -52,7 +52,6 @@ distclean : .platform clean include $(RULES_PATH)/config include $(RULES_PATH)/functions include $(RULES_PATH)/*.mk -include $(PLATFORM_GENERIC_PATH)/rules.mk ifneq ($(CONFIGURED_PLATFORM), undefined) include $(PLATFORM_PATH)/rules.mk endif From aefefeff0559d67a37ca191f96c2477b2d4264c9 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Sat, 24 Dec 2016 01:20:45 +0200 Subject: [PATCH 0156/1833] Fix git/stg error for linux kernel build (#156) Signed-off-by: Nadiya.Stetskovych --- sonic-slave/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 7b03e4ee8162..1a09b9d8c0f0 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -103,6 +103,10 @@ RUN useradd $user -u $uid -g $guid -d /var/$user -m -s /bin/bash RUN gpasswd -a $user docker +# Config git for stg +RUN su $user -c "git config --global user.name $user" +RUN su $user -c "git config --global user.email $user@company.com" + COPY sonic-jenkins-id_rsa.pub /var/$user/.ssh/authorized_keys2 RUN chown $user /var/$user/.ssh -R RUN chmod go= /var/$user/.ssh -R From 66aebb329ccec74e92ad25875ea3e8cc2de65055 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Sat, 24 Dec 2016 01:22:06 +0200 Subject: [PATCH 0157/1833] [docker]: Change templating method to jinja2 (#115) (#153) Move from sed to jinja2 for more readability. --- .../{Dockerfile.template => Dockerfile.j2} | 9 ++++++--- .../docker-fpm/{Dockerfile.template => Dockerfile.j2} | 9 ++++++--- .../{Dockerfile.template => Dockerfile.j2} | 9 ++++++--- .../{Dockerfile.template => Dockerfile.j2} | 9 ++++++--- .../{Dockerfile.template => Dockerfile.j2} | 9 ++++++--- .../{Dockerfile.template => Dockerfile.j2} | 9 ++++++--- .../{Dockerfile.template => Dockerfile.j2} | 11 +++++++---- .../{Dockerfile.template => Dockerfile.j2} | 11 +++++++---- .../{Dockerfile.template => Dockerfile.j2} | 9 ++++++--- slave.mk | 10 ++++++---- 10 files changed, 62 insertions(+), 33 deletions(-) rename dockers/docker-database/{Dockerfile.template => Dockerfile.j2} (83%) rename dockers/docker-fpm/{Dockerfile.template => Dockerfile.j2} (67%) rename dockers/docker-lldp-sv2/{Dockerfile.template => Dockerfile.j2} (81%) rename dockers/docker-orchagent/{Dockerfile.template => Dockerfile.j2} (74%) rename dockers/docker-snmp-sv2/{Dockerfile.template => Dockerfile.j2} (92%) rename dockers/docker-team/{Dockerfile.template => Dockerfile.j2} (66%) rename platform/broadcom/docker-syncd-brcm/{Dockerfile.template => Dockerfile.j2} (53%) rename platform/mellanox/docker-syncd-mlnx/{Dockerfile.template => Dockerfile.j2} (61%) rename platform/p4/docker-sonic-p4/{Dockerfile.template => Dockerfile.j2} (87%) diff --git a/dockers/docker-database/Dockerfile.template b/dockers/docker-database/Dockerfile.j2 similarity index 83% rename from dockers/docker-database/Dockerfile.template rename to dockers/docker-database/Dockerfile.j2 index 5d26946acf0a..cc8cd9bb206a 100644 --- a/dockers/docker-database/Dockerfile.template +++ b/dockers/docker-database/Dockerfile.j2 @@ -2,17 +2,20 @@ FROM docker-base RUN apt-get update -COPY deps/ deps +COPY debs/ debs ## Install redis-tools dependencies ## TODO: implicitly install dependencies RUN apt-get -y install libjemalloc1 -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_database_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN rm -rf /debs RUN sed -ri 's/^daemonize yes$/daemonize no/; \ s/^logfile .*$/logfile ""/; \ diff --git a/dockers/docker-fpm/Dockerfile.template b/dockers/docker-fpm/Dockerfile.j2 similarity index 67% rename from dockers/docker-fpm/Dockerfile.template rename to dockers/docker-fpm/Dockerfile.j2 index 47d250fb15fb..3007d8e1e53c 100644 --- a/dockers/docker-fpm/Dockerfile.template +++ b/dockers/docker-fpm/Dockerfile.j2 @@ -4,13 +4,16 @@ RUN apt-get update RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 -COPY deps/ deps +COPY debs/ debs -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_fpm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN rm -rf /debs COPY ["start.sh", "/usr/bin/"] diff --git a/dockers/docker-lldp-sv2/Dockerfile.template b/dockers/docker-lldp-sv2/Dockerfile.j2 similarity index 81% rename from dockers/docker-lldp-sv2/Dockerfile.template rename to dockers/docker-lldp-sv2/Dockerfile.j2 index da1717f81918..833e4673733e 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.template +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -1,6 +1,6 @@ FROM docker-base -COPY deps /deps +COPY debs /debs COPY python-wheels /python-wheels RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 @@ -9,13 +9,16 @@ RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent- ## Install Python SSWSDK ## Install LLDP Sync Daemon -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_lldp_sv2_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} RUN pip install /python-wheels/sswsdk-2.0.1-py2-none-any.whl && \ pip install /python-wheels/sonic_d-2.0.0-py2-none-any.whl && \ apt-get remove -y python-pip && \ apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ - rm -rf /deps /python-wheels ~/.cache + rm -rf /debs /python-wheels ~/.cache COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY reconfigure.sh /opt/reconfigure.sh diff --git a/dockers/docker-orchagent/Dockerfile.template b/dockers/docker-orchagent/Dockerfile.j2 similarity index 74% rename from dockers/docker-orchagent/Dockerfile.template rename to dockers/docker-orchagent/Dockerfile.j2 index c8c858bf2c2c..8b82102993dc 100755 --- a/dockers/docker-orchagent/Dockerfile.template +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -8,15 +8,18 @@ RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansso ## TODO: implicitly install dependencies RUN apt-get -y install libjemalloc1 -COPY deps /deps +COPY debs /debs -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_orchagent_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} COPY start.sh /usr/bin/start.sh ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN rm -rf /debs ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-snmp-sv2/Dockerfile.template b/dockers/docker-snmp-sv2/Dockerfile.j2 similarity index 92% rename from dockers/docker-snmp-sv2/Dockerfile.template rename to dockers/docker-snmp-sv2/Dockerfile.j2 index 876a7aca3445..9d8c068064c5 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.template +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -1,6 +1,6 @@ FROM docker-base -COPY deps /deps +COPY debs /debs COPY python-wheels /python-wheels # enable -O for all Python calls @@ -12,9 +12,12 @@ ENV PYTHONOPTIMIZE 1 ## Clean up RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_snmp_sv2_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} -RUN rm -rf /deps +RUN rm -rf /debs # install subagent RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ diff --git a/dockers/docker-team/Dockerfile.template b/dockers/docker-team/Dockerfile.j2 similarity index 66% rename from dockers/docker-team/Dockerfile.template rename to dockers/docker-team/Dockerfile.j2 index 487ff3d0434e..27c5704234ea 100644 --- a/dockers/docker-team/Dockerfile.template +++ b/dockers/docker-team/Dockerfile.j2 @@ -2,14 +2,17 @@ FROM docker-base RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 -COPY deps /deps +COPY debs /debs -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_team_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} COPY start.sh /usr/bin/start.sh RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN rm -rf /debs ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.template b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 similarity index 53% rename from platform/broadcom/docker-syncd-brcm/Dockerfile.template rename to platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 958c0757b283..163e664f0dec 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.template +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -2,18 +2,21 @@ FROM docker-base RUN apt-get update -COPY deps /deps +COPY debs /debs -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_syncd_brcm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} ## TODO: add kmod into Depends RUN apt-get install -f kmod -COPY ["deps/dsserve", "deps/bcmcmd", "start.sh", "/usr/bin/"] +COPY ["debs/dsserve", "debs/bcmcmd", "start.sh", "/usr/bin/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN rm -rf /debs ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.template b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 similarity index 61% rename from platform/mellanox/docker-syncd-mlnx/Dockerfile.template rename to platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index d71245dcd8e3..b5a58b0a0577 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.template +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -2,19 +2,22 @@ FROM docker-base RUN apt-get update -COPY deps /deps +COPY debs /debs RUN apt-get install -y libxml2 -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_syncd_mlnx_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} COPY ["start.sh", "/usr/bin/"] COPY ["mlnx-fw-upgrade.sh", "/usr/bin/"] -COPY ["/deps/fw-SPC.mfa", "/etc/mlnx/"] +COPY ["/debs/fw-SPC.mfa", "/etc/mlnx/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN rm -rf /debs ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] diff --git a/platform/p4/docker-sonic-p4/Dockerfile.template b/platform/p4/docker-sonic-p4/Dockerfile.j2 similarity index 87% rename from platform/p4/docker-sonic-p4/Dockerfile.template rename to platform/p4/docker-sonic-p4/Dockerfile.j2 index 357548591d1a..3cf775ea97f6 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.template +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -4,9 +4,12 @@ RUN apt-get update RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 -COPY deps /deps +COPY debs /debs -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_sonic_p4_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} ADD port_config.ini /port_config.ini ADD startup.sh /scripts/startup.sh @@ -15,7 +18,7 @@ ADD rsyslog.conf /etc/rsyslog.conf ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN rm -rf /debs RUN sed -ri 's/^daemonize yes$/daemonize no/; \ s/^logfile .*$/logfile ""/; \ diff --git a/slave.mk b/slave.mk index 74f07cad06b8..a97f4d83f5ba 100644 --- a/slave.mk +++ b/slave.mk @@ -248,13 +248,15 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g $(FOOTER) # Targets for building docker images -$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS) $$($$*.gz_FILES)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) +$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS) $$($$*.gz_FILES)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $$($$*.gz_PATH)/Dockerfile.j2 $(HEADER) - mkdir -p $($*.gz_PATH)/deps $(LOG) + mkdir -p $($*.gz_PATH)/debs $(LOG) mkdir -p $($*.gz_PATH)/python-wheels $(LOG) - sudo mount --bind $(DEBS_PATH) $($*.gz_PATH)/deps $(LOG) + sudo mount --bind $(DEBS_PATH) $($*.gz_PATH)/debs $(LOG) sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG) - sed 's/SED_DPKG/RUN cd deps \&\& dpkg -i $(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')/g' $($*.gz_PATH)/Dockerfile.template > $($*.gz_PATH)/Dockerfile + # Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs + $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')) + j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile docker build --no-cache -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ $(FOOTER) From b8825498daaf0a64d68db83a5962e17ff60087a0 Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Sat, 24 Dec 2016 01:26:51 +0200 Subject: [PATCH 0158/1833] Added rules to build syncd and orchagent containers for Cavium target (#152) * Cavium support in the new build infrastructure * Added a file with a list of cavium debian packages * docker-syncd-cavm : Added SAI and XDK libraries * docker-syncd-cavm : Removed redis-tools from docker template --- platform/cavium/cavm-sai.mk | 12 +++++++++ platform/cavium/cavm_sdk/filelist.txt | 7 +++++ platform/cavium/docker-orchagent-cavm.mk | 7 +++++ platform/cavium/docker-syncd-cavm.mk | 7 +++++ .../docker-syncd-cavm/Dockerfile.template | 18 +++++++++++++ platform/cavium/docker-syncd-cavm/start.sh | 23 ++++++++++++++++ platform/cavium/rules.mk | 26 +++++++------------ 7 files changed, 83 insertions(+), 17 deletions(-) create mode 100644 platform/cavium/cavm-sai.mk create mode 100644 platform/cavium/cavm_sdk/filelist.txt create mode 100644 platform/cavium/docker-orchagent-cavm.mk create mode 100644 platform/cavium/docker-syncd-cavm.mk create mode 100755 platform/cavium/docker-syncd-cavm/Dockerfile.template create mode 100755 platform/cavium/docker-syncd-cavm/start.sh diff --git a/platform/cavium/cavm-sai.mk b/platform/cavium/cavm-sai.mk new file mode 100644 index 000000000000..9f537c50f37c --- /dev/null +++ b/platform/cavium/cavm-sai.mk @@ -0,0 +1,12 @@ +# Cavium SAI + +CAVM_LIBSAI = libsai.deb +$(CAVM_LIBSAI)_PATH = $(PLATFORM_PATH)/cavm_sdk +CAVM_SAI = sai.deb +$(CAVM_SAI)_PATH = $(PLATFORM_PATH)/cavm_sdk +XP_TOOLS = xp-tools.deb +$(XP_TOOLS)_PATH = $(PLATFORM_PATH)/cavm_sdk +XPSHELL = xpshell.deb +$(XPSHELL)_PATH = $(PLATFORM_PATH)/cavm_sdk + +SONIC_COPY_DEBS += $(CAVM_LIBSAI) $(CAVM_SAI) $(XP_TOOLS) $(XPSHELL) diff --git a/platform/cavium/cavm_sdk/filelist.txt b/platform/cavium/cavm_sdk/filelist.txt new file mode 100644 index 000000000000..bc40295dfbdc --- /dev/null +++ b/platform/cavium/cavm_sdk/filelist.txt @@ -0,0 +1,7 @@ +## Get vendor SAI SDK +## https://github.com/Azure/sonic-buildimage/blob/master/README.md#3-get-vendor-sai-sdk + +libsai.deb +sai.deb +xp-tools.deb +xpshell.deb diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk new file mode 100644 index 000000000000..b66c7dbf0395 --- /dev/null +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -0,0 +1,7 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz +$(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent +$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk new file mode 100644 index 000000000000..fb0893df1eaf --- /dev/null +++ b/platform/cavium/docker-syncd-cavm.mk @@ -0,0 +1,7 @@ +# docker image for cavium syncd + +DOCKER_SYNCD_CAVM = docker-syncd-cavm.gz +$(DOCKER_SYNCD_CAVM)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm +$(DOCKER_SYNCD_CAVM)_DEPENDS += $(SYNCD) $(CAVM_LIBSAI) $(XP_TOOLS) $(XPSHELL) $(REDIS_TOOLS) +$(DOCKER_SYNCD_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.template b/platform/cavium/docker-syncd-cavm/Dockerfile.template new file mode 100755 index 000000000000..d40051e2858d --- /dev/null +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.template @@ -0,0 +1,18 @@ +FROM docker-base + +RUN apt-get update + +COPY deps /deps + +RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev + +SED_DPKG + +COPY ["start.sh", "/usr/bin/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/platform/cavium/docker-syncd-cavm/start.sh b/platform/cavium/docker-syncd-cavm/start.sh new file mode 100755 index 000000000000..21d61e707344 --- /dev/null +++ b/platform/cavium/docker-syncd-cavm/start.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +export XP_ROOT=/usr/bin/ + +service rsyslog start + +while true; do + + # Check if redis-server starts + + result=$(redis-cli ping) + + if [ "$result" == "PONG" ]; then + + redis-cli FLUSHALL + syncd -p /etc/ssw/AS7512/profile.ini -N + break + + fi + + sleep 1 + +done diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 93f89f7382cf..efb9159c34d6 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -1,23 +1,15 @@ include $(PLATFORM_GENERIC_PATH)/rules.mk -CAVM_LIBSAI = libsai.deb -$(CAVM_LIBSAI)_PATH = $(PLATFORM_PATH)/cavm_sdk -CAVM_SAI = sai.deb -$(CAVM_SAI)_PATH = $(PLATFORM_PATH)/cavm_sdk -XP_TOOLS = xp-tools.deb -$(XP_TOOLS)_PATH = $(PLATFORM_PATH)/cavm_sdk -XPSHELL = xpshell.deb -$(XPSHELL)_PATH = $(PLATFORM_PATH)/cavm_sdk +include $(PLATFORM_PATH)/cavm-sai.mk +include $(PLATFORM_PATH)/docker-syncd-cavm.mk +include $(PLATFORM_PATH)/docker-orchagent-cavm.mk -SONIC_COPY_DEBS += $(CAVM_LIBSAI) $(CAVM_SAI) $(XP_TOOLS) $(XPSHELL) +SONIC_ALL += $(DOCKER_SYNCD_CAVM) \ + $(DOCKER_ORCHAGENT_CAVM) -# TODO: Put dependencies for SDK packages +# Inject cavium sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) -SONIC_ALL += $(SONIC_GENERIC) $(DOCKER_SYNCD_CAVM) $(DOCKER_ORCHAGENT) \ - $(DOCKER_FPM) +# Runtime dependency on cavium sai is set only for syncd +$(SYNCD)_RDEPENDS += $(CAVM_SAI) -# Inject cavm sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(CAVM_LIBSAI) - -# Runtime dependency on cavm sai is set only for syncd -$(SYNCD)_RDEPENDS += $(CAVM_LIBSAI) From 38aa59787583fa57003997cf1668ddac9966000e Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 24 Dec 2016 12:07:53 -0800 Subject: [PATCH 0159/1833] [p4]: update p4-switch submodule to fix p4 qos scheduler query (#158) --- platform/p4/p4-switch/switch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/p4/p4-switch/switch b/platform/p4/p4-switch/switch index d6346b9b3339..fff59db0f28f 160000 --- a/platform/p4/p4-switch/switch +++ b/platform/p4/p4-switch/switch @@ -1 +1 @@ -Subproject commit d6346b9b3339a2a1243c1e7a1b00b71c66fa6cb5 +Subproject commit fff59db0f28fe4309d2032c1b2aba477d542f359 From 4673be0d707e6944df720c24903964bb86368e32 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 25 Dec 2016 00:44:06 -0800 Subject: [PATCH 0160/1833] add download url for broadcom sai/sdk deb packages (#159) --- platform/broadcom/docker-syncd-brcm.mk | 2 +- platform/broadcom/rules.mk | 14 ++++++++------ platform/broadcom/sai.mk | 13 ++++++++----- platform/broadcom/sdk.mk | 9 ++++++--- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index 42fe63c86a44..e1f02c59fa12 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -3,6 +3,6 @@ DOCKER_SYNCD_BRCM = docker-syncd-brcm.gz $(DOCKER_SYNCD_BRCM)_PATH = $(PLATFORM_PATH)/docker-syncd-brcm $(DOCKER_SYNCD_BRCM)_DEPENDS += $(SYNCD) -$(DOCKER_SYNCD_BRCM)_FILES += $(BRCM_DSSERVE) $(BRCM_BCMCMD) +$(DOCKER_SYNCD_BRCM)_FILES += $(DSSERVE) $(BCMCMD) $(DOCKER_SYNCD_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 3ad72308b56f..d1865d2eaf55 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -5,15 +5,17 @@ include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk -BRCM_DSSERVE = dsserve -$(BRCM_DSSERVE)_PATH = $(PLATFORM_PATH)/sdk -BRCM_BCMCMD = bcmcmd -$(BRCM_BCMCMD)_PATH = $(PLATFORM_PATH)/sdk +BCMCMD = bcmcmd +$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmcmd?sv=2015-04-05&sr=b&sig=X3bFApmsNFmcnWM9mSGRxBugPcg%2FgJCHh5hhSuV1M2c%3D&se=2030-08-23T14%3A41%3A56Z&sp=r" -SONIC_COPY_FILES += $(BRCM_DSSERVE) $(BRCM_BCMCMD) +DSSERVE = dsserve +$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv=2015-04-05&sr=b&sig=aMlnRA%2FXZNmHPgmOj%2FNMJMYLWyvva1QrN4HcsVXvqKA%3D&se=2030-08-23T14%3A42%3A32Z&sp=r" + +SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) SONIC_ALL += $(DOCKER_SYNCD_BRCM) \ - $(DOCKER_ORCHAGENT_BRCM) + $(DOCKER_ORCHAGENT_BRCM) \ + debs/$(BRCM_OPENNSL_KERNEL) # Inject brcm sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index ecedb48edd7a..2185edefe2b1 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,10 +1,13 @@ -BRCM_SAI = libsaibcm_2.0.3.7~20161214010054.112_amd64.deb -$(BRCM_SAI)_PATH = $(PLATFORM_PATH)/sdk -BRCM_SAI_DEV = libsaibcm-dev_2.0.3.7~20161214010054.112_amd64.deb -$(BRCM_SAI_DEV)_PATH = $(PLATFORM_PATH)/sdk +BRCM_SAI = libsaibcm_2.0.3.7_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.0.3.7_amd64.deb?sv=2015-04-05&sr=b&sig=3S9pY5Allql4fguipFdilJ%2BzP%2Ff4dvUFe3mNY3uhCIc%3D&se=2030-09-02T21%3A43%3A38Z&sp=r" + +BRCM_SAI_DEV = libsaibcm-dev_2.0.3.7_amd64.deb + $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -SONIC_COPY_DEBS += $(BRCM_SAI) +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.0.3.7_amd64.deb?sv=2015-04-05&sr=b&sig=KI8DfgGW8%2BOoZL6tJ9aJa%2F3RvHi%2FXD8gtOcDUD5nOPA%3D&se=2030-09-03T04%3A52%3A41Z&sp=r" + +SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index d3d94e606a64..7778e2cf5376 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.1.5+0~20161214000201.54~1.gbpb514c3_amd64.deb -$(BRCM_OPENNSL)_PATH = $(PLATFORM_PATH)/sdk +BRCM_OPENNSL = libopennsl_3.2.1.5_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5_amd64.deb?sv=2015-04-05&sr=b&sig=qm6%2BkiGuRGsFKwZcUz6yEtbgbbwQuhxEr0chLM7qJEQ%3D&se=2030-09-02T21%3A41%3A11Z&sp=r" -SONIC_COPY_DEBS += $(BRCM_OPENNSL) +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5_amd64.deb?sv=2015-04-05&sr=b&sig=c8hO5PQpvod7IX3aYOiyvFB9rICxDgGiFF5g3GDHx84%3D&se=2030-09-02T21%3A42%3A34Z&sp=r" + +SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 3f1a7895b8dc88787e593b52e0f854e12be584df Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 25 Dec 2016 09:53:47 -0800 Subject: [PATCH 0161/1833] [p4]: update p4-switch submodule (#160) --- platform/p4/p4-switch/switch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/p4/p4-switch/switch b/platform/p4/p4-switch/switch index fff59db0f28f..21adcdddac59 160000 --- a/platform/p4/p4-switch/switch +++ b/platform/p4/p4-switch/switch @@ -1 +1 @@ -Subproject commit fff59db0f28fe4309d2032c1b2aba477d542f359 +Subproject commit 21adcdddac59b75e4627255a12f1ed1a4369bb62 From 057eea849676d4d13b102210ef256e9d0494bcf7 Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Tue, 27 Dec 2016 02:16:52 +0200 Subject: [PATCH 0162/1833] docker-syncd-cavm : Changed template method to jinja2 (#161) * Cavium support in the new build infrastructure * Added a file with a list of cavium debian packages * docker-syncd-cavm : Added SAI and XDK libraries * docker-syncd-cavm : Removed redis-tools from docker template * docker-syncd-cavm : Changed templating method to jinja2 * docker-syncd-cavm : Install libjemalloc1 --- .../{Dockerfile.template => Dockerfile.j2} | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) rename platform/cavium/docker-syncd-cavm/{Dockerfile.template => Dockerfile.j2} (62%) diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.template b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 similarity index 62% rename from platform/cavium/docker-syncd-cavm/Dockerfile.template rename to platform/cavium/docker-syncd-cavm/Dockerfile.j2 index d40051e2858d..f8e48259e8be 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.template +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -2,17 +2,20 @@ FROM docker-base RUN apt-get update -COPY deps /deps +COPY debs /debs -RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev +RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev libjemalloc1 -SED_DPKG +RUN dpkg -i \ +{% for deb in docker_syncd_cavm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} COPY ["start.sh", "/usr/bin/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps +RUN rm -rf /debs ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] From 2c444590e96a0427af98c8cd2ac960609bfff91f Mon Sep 17 00:00:00 2001 From: jiacao Date: Tue, 27 Dec 2016 15:10:02 -0800 Subject: [PATCH 0163/1833] Take sonic-swss commit 96b5b523a0dedf237228b118f0420f117dca2a5b (#164) --- platform/p4/docker-sonic-p4/startup.sh | 3 +++ src/sonic-swss | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/p4/docker-sonic-p4/startup.sh b/platform/p4/docker-sonic-p4/startup.sh index 319ac8e57850..e5221f834259 100755 --- a/platform/p4/docker-sonic-p4/startup.sh +++ b/platform/p4/docker-sonic-p4/startup.sh @@ -1,5 +1,8 @@ #!/bin/bash +echo "Set onie_platform to x86_64-barefoot_p4-r0" +export onie_platform=x86_64-barefoot_p4-r0 + echo "Start rsyslog" service rsyslog start diff --git a/src/sonic-swss b/src/sonic-swss index 205405667396..96b5b523a0de 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 205405667396f606d9560ed6d861063f35f07d94 +Subproject commit 96b5b523a0dedf237228b118f0420f117dca2a5b From fe5074f48e2789dd12a28679b2d0db89cb11fc1f Mon Sep 17 00:00:00 2001 From: Nadiya Date: Wed, 28 Dec 2016 01:16:18 +0200 Subject: [PATCH 0164/1833] Update linux-kernel hash commit (#163) Signed-off-by: Nadiya.Stetskovych --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index db5ba1485acd..971c8b1b7b31 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit db5ba1485acd7dd9620bf3216c21bb4c3efebfb5 +Subproject commit 971c8b1b7b3180ae92ce1c8e8246198a2d177709 From caf5333386cb9b28096d70aacd8e53d82efca174 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 28 Dec 2016 06:10:01 -0800 Subject: [PATCH 0165/1833] [kernel]: update sonic-linux-kernel submodule to integrate with build (#165) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 971c8b1b7b31..74a38ccde0d6 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 971c8b1b7b3180ae92ce1c8e8246198a2d177709 +Subproject commit 74a38ccde0d65f7aa7b9797510fc95cd318f7919 From 8bdb59b5b0465b5ffdb45e714ddebb5a471ee6b6 Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Wed, 28 Dec 2016 22:34:41 +0200 Subject: [PATCH 0166/1833] platform/cavium : Download debian packages (#162) * platform/cavium : Download debian packages * platform/cavium : Removed obsolete Makefile rules * platform/cavium : Replaced branch name with commit id --- platform/cavium/cavm-sai.mk | 13 +++++++------ platform/cavium/docker-syncd-cavm.mk | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/platform/cavium/cavm-sai.mk b/platform/cavium/cavm-sai.mk index 9f537c50f37c..c0e16e1ebd94 100644 --- a/platform/cavium/cavm-sai.mk +++ b/platform/cavium/cavm-sai.mk @@ -1,12 +1,13 @@ # Cavium SAI +CAVM_SAI_GITHUB = https://github.com/garyachy/OpenXPS/raw/3c2dbbee23ee76570bbdb11d4955882279cc3f9a/SAI/cavm-sai + CAVM_LIBSAI = libsai.deb -$(CAVM_LIBSAI)_PATH = $(PLATFORM_PATH)/cavm_sdk CAVM_SAI = sai.deb -$(CAVM_SAI)_PATH = $(PLATFORM_PATH)/cavm_sdk XP_TOOLS = xp-tools.deb -$(XP_TOOLS)_PATH = $(PLATFORM_PATH)/cavm_sdk -XPSHELL = xpshell.deb -$(XPSHELL)_PATH = $(PLATFORM_PATH)/cavm_sdk -SONIC_COPY_DEBS += $(CAVM_LIBSAI) $(CAVM_SAI) $(XP_TOOLS) $(XPSHELL) +$(CAVM_LIBSAI)_URL = $(CAVM_SAI_GITHUB)/$(CAVM_LIBSAI) +$(CAVM_SAI)_URL = $(CAVM_SAI_GITHUB)/$(CAVM_SAI) +$(XP_TOOLS)_URL = $(CAVM_SAI_GITHUB)/$(XP_TOOLS) + +SONIC_ONLINE_DEBS += $(CAVM_LIBSAI) $(CAVM_SAI) $(XP_TOOLS) diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index fb0893df1eaf..ec410ca3052d 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -2,6 +2,6 @@ DOCKER_SYNCD_CAVM = docker-syncd-cavm.gz $(DOCKER_SYNCD_CAVM)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm -$(DOCKER_SYNCD_CAVM)_DEPENDS += $(SYNCD) $(CAVM_LIBSAI) $(XP_TOOLS) $(XPSHELL) $(REDIS_TOOLS) +$(DOCKER_SYNCD_CAVM)_DEPENDS += $(SYNCD) $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS) $(DOCKER_SYNCD_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) From 7b4d715dcca4f12f9121dd1f5ddb3dbd82aef60d Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 28 Dec 2016 17:57:07 -0800 Subject: [PATCH 0167/1833] add quagga teamd targets into docker-sonic-p4 (#166) --- platform/p4/docker-sonic-p4.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/p4/docker-sonic-p4.mk b/platform/p4/docker-sonic-p4.mk index 0e10e9e319fc..df944be4c363 100644 --- a/platform/p4/docker-sonic-p4.mk +++ b/platform/p4/docker-sonic-p4.mk @@ -2,6 +2,6 @@ DOCKER_SONIC_P4 = docker-sonic-p4.gz $(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4 -$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) +$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) $(QUAGGA) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_P4) From 26930e5e172fff73a376b7fd4cb46e55a0ecab64 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 28 Dec 2016 19:05:09 -0800 Subject: [PATCH 0168/1833] install latest intel igb driver 5.3.5.4 in the base image (#167) --- build_debian.sh | 3 ++ rules/igb.mk | 8 ++++ rules/linux-kernel.mk | 2 +- rules/sonic-aboot.mk | 2 +- rules/sonic-generic.mk | 2 +- src/igb/Makefile | 23 ++++++++++++ ...or-BCM54616-phy-for-intel-igb-driver.patch | 37 +++++++++++++++++++ 7 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 rules/igb.mk create mode 100644 src/igb/Makefile create mode 100644 src/igb/patch/0001-add-support-for-BCM54616-phy-for-intel-igb-driver.patch diff --git a/build_debian.sh b/build_debian.sh index 185825cf34b7..7a4e2f33c77c 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -129,6 +129,9 @@ sudo cp files/initramfs-tools/union-fsck $FILESYSTEM_ROOT/etc/initramfs-tools/ho sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck sudo chroot $FILESYSTEM_ROOT update-initramfs -u +## Install latest intel igb driver +sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko + ## Install docker echo '[INFO] Install docker' ## Install apparmor utils since they're missing and apparmor is enabled in the kernel diff --git a/rules/igb.mk b/rules/igb.mk new file mode 100644 index 000000000000..654c4bd77037 --- /dev/null +++ b/rules/igb.mk @@ -0,0 +1,8 @@ +# initramfs-tools package + +IGB_DRIVER_VERSION = 5.3.5.4 +export IGB_DRIVER_VERSION + +IGB_DRIVER = igb.ko +$(IGB_DRIVER)_SRC_PATH = $(SRC_PATH)/igb +SONIC_MAKE_DEBS += $(IGB_DRIVER) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 6aae74dc2b95..fbda245b8d45 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -1,4 +1,4 @@ -# redis package +# linux kernel package KVERSION = 3.16.0-4-amd64 diff --git a/rules/sonic-aboot.mk b/rules/sonic-aboot.mk index 7db01c10d3b5..c2762cfa012e 100644 --- a/rules/sonic-aboot.mk +++ b/rules/sonic-aboot.mk @@ -2,5 +2,5 @@ SONIC_ABOOT = sonic-aboot.bin $(SONIC_ABOOT)_MACHINE = aboot -$(SONIC_ABOOT)_DEPENDS += $(LINUX_KERNEL) $(INITRAMFS_TOOLS) +$(SONIC_ABOOT)_DEPENDS += $(LINUX_KERNEL) $(INITRAMFS_TOOLS) $(IGB_DRIVER) SONIC_INSTALLERS += $(SONIC_ABOOT) diff --git a/rules/sonic-generic.mk b/rules/sonic-generic.mk index a87c39c65127..807e26dbfd0e 100644 --- a/rules/sonic-generic.mk +++ b/rules/sonic-generic.mk @@ -2,5 +2,5 @@ SONIC_GENERIC = sonic-generic.bin $(SONIC_GENERIC)_MACHINE = generic -$(SONIC_GENERIC)_DEPENDS += $(LINUX_KERNEL) $(INITRAMFS_TOOLS) +$(SONIC_GENERIC)_DEPENDS += $(LINUX_KERNEL) $(INITRAMFS_TOOLS) $(IGB_DRIVER) SONIC_INSTALLERS += $(SONIC_GENERIC) diff --git a/src/igb/Makefile b/src/igb/Makefile new file mode 100644 index 000000000000..ab8c68cef32d --- /dev/null +++ b/src/igb/Makefile @@ -0,0 +1,23 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = igb.ko + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf ./igb-$(IGB_DRIVER_VERSION) + wget -O igb-$(IGB_DRIVER_VERSION).tar.gz "https://downloadmirror.intel.com/13663/eng/igb-$(IGB_DRIVER_VERSION).tar.gz" + tar xzf igb-$(IGB_DRIVER_VERSION).tar.gz + + # Patch + pushd ./igb-$(IGB_DRIVER_VERSION) + patch -p1 < ../patch/0001-add-support-for-BCM54616-phy-for-intel-igb-driver.patch + + # Build the package + pushd src + export BUILD_KERNEL=3.16.0-4-amd64 + make + popd + + popd + mv ./igb-$(IGB_DRIVER_VERSION)/src/$* $(DEST)/ diff --git a/src/igb/patch/0001-add-support-for-BCM54616-phy-for-intel-igb-driver.patch b/src/igb/patch/0001-add-support-for-BCM54616-phy-for-intel-igb-driver.patch new file mode 100644 index 000000000000..3059c5f6f951 --- /dev/null +++ b/src/igb/patch/0001-add-support-for-BCM54616-phy-for-intel-igb-driver.patch @@ -0,0 +1,37 @@ +From 548db654a498a017ce121292f12820176544e6ed Mon Sep 17 00:00:00 2001 +From: Guohan Lu +Date: Tue, 27 Dec 2016 23:21:22 +0000 +Subject: [PATCH] add support for BCM54616 phy for intel igb driver + +--- + src/e1000_82575.c | 1 + + src/e1000_defines.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/src/e1000_82575.c b/src/e1000_82575.c +index b4b973e..248c670 100644 +--- a/src/e1000_82575.c ++++ b/src/e1000_82575.c +@@ -223,6 +223,7 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) + case M88E1112_E_PHY_ID: + case M88E1340M_E_PHY_ID: + case M88E1111_I_PHY_ID: ++ case BCM54616_E_PHY_ID: + phy->type = e1000_phy_m88; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.get_info = e1000_get_phy_info_m88; +diff --git a/src/e1000_defines.h b/src/e1000_defines.h +index 6de3988..d5da148 100644 +--- a/src/e1000_defines.h ++++ b/src/e1000_defines.h +@@ -1185,6 +1185,7 @@ + #define I210_I_PHY_ID 0x01410C00 + #define IGP04E1000_E_PHY_ID 0x02A80391 + #define M88_VENDOR 0x0141 ++#define BCM54616_E_PHY_ID 0x03625D10 + + /* M88E1000 Specific Registers */ + #define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Reg */ +-- +1.9.1 + From 66e3392e8a75d5afbd1877f7851283a8855cceb0 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 29 Dec 2016 00:15:31 -0800 Subject: [PATCH 0169/1833] [linux-kernel]: update linux kernel to 3.16.36-1+deb8u2 (#168) --- rules/linux-kernel.mk | 2 +- src/sonic-linux-kernel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index fbda245b8d45..46467666539e 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -4,6 +4,6 @@ KVERSION = 3.16.0-4-amd64 export KVERSION -LINUX_KERNEL = linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb +LINUX_KERNEL = linux-image-3.16.0-4-amd64_3.16.36-1+deb8u2_amd64.deb $(LINUX_KERNEL)_SRC_PATH = $(SRC_PATH)/sonic-linux-kernel SONIC_MAKE_DEBS += $(LINUX_KERNEL) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 74a38ccde0d6..b21e14354e95 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 74a38ccde0d65f7aa7b9797510fc95cd318f7919 +Subproject commit b21e14354e959db2a0639334b7d4f6f9eaa4d1d1 From 5a5f5c26da67a9e92c60a606e7479ba659b243f8 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 29 Dec 2016 09:53:46 -0800 Subject: [PATCH 0170/1833] [linux-kernel]: fix sched: Fix race between task_group and sched_task_group (#169) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index b21e14354e95..5b652fca4fe6 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit b21e14354e959db2a0639334b7d4f6f9eaa4d1d1 +Subproject commit 5b652fca4fe6f215e2869ae1d2e6ef44b3553698 From 03660d9dd38641ddc39b066a4b1dfa71454317de Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 29 Dec 2016 10:03:59 -0800 Subject: [PATCH 0171/1833] add build badge for Cavium platform --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2857038178b6..c821fd47ecbc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ Broadcom[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) +Cavium[![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) Mellanox[![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) P4[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) @@ -64,8 +65,11 @@ The target directory is ./target, containing the NOS installer image and docker - docker-base.gz: base docker image where other docker images are built from, only used in build process (gzip tar archive) - docker-database.gz: docker image for in-memory key-value store, used as inter-process communication (gzip tar archive) - docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive) -- docker-orchagent.gz: docker image for SWitch State Service (SWSS) (gzip tar archive) -- docker-syncd.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive) +- docker-orchagent-brcm.gz: docker image for SWitch State Service (SWSS) on Broadcom platform (gzip tar archive) +- docker-orchagent-cavm.gz: docker image for SWitch State Service (SWSS) on Cavium platform (gzip tar archive) +- docker-orchagent-mlnx.gz: docker image for SWitch State Service (SWSS) on Mellanox platform (gzip tar archive) +- docker-syncd-brcm.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive) +- docker-syncd-cavm.gz: docker image for the daemon to sync database and Cavium switch ASIC (gzip tar archive) - docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) - docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive) From 4123f684f344076f1f80b5409740c351afe7157b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 29 Dec 2016 12:14:19 -0800 Subject: [PATCH 0172/1833] [sonic-slave] Use fictional company for the email adddress of sonic-slave user (#170) --- sonic-slave/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 1a09b9d8c0f0..2a06770dfed9 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -105,7 +105,7 @@ RUN gpasswd -a $user docker # Config git for stg RUN su $user -c "git config --global user.name $user" -RUN su $user -c "git config --global user.email $user@company.com" +RUN su $user -c "git config --global user.email $user@contoso.com" COPY sonic-jenkins-id_rsa.pub /var/$user/.ssh/authorized_keys2 RUN chown $user /var/$user/.ssh -R From bc03c196a4cf1c6c452b484337923f59b8db8647 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 29 Dec 2016 18:38:08 -0800 Subject: [PATCH 0173/1833] [swss]: bring swss submodule to the latest (#172) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 96b5b523a0de..4c753eb8133d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 96b5b523a0dedf237228b118f0420f117dca2a5b +Subproject commit 4c753eb8133d1ac708190c89ed75c2274bce4c5d From 930ee3f89da76374fd47562c23e785dfc1e7b6aa Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 30 Dec 2016 10:40:40 -0800 Subject: [PATCH 0174/1833] [baseimage] Install package without starting service (#171) * Install package without starting service * No need to mount /sys in chroot * (comment) --- build_debian.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 7a4e2f33c77c..fdefde3bb153 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -81,13 +81,6 @@ echo '[INFO] Mount all' mount trap_push 'sudo umount $FILESYSTEM_ROOT/proc || true' sudo LANG=C chroot $FILESYSTEM_ROOT mount proc /proc -t proc -clean_sys() { - sudo umount $FILESYSTEM_ROOT/sys/fs/cgroup/* \ - $FILESYSTEM_ROOT/sys/fs/cgroup \ - $FILESYSTEM_ROOT/sys || true -} -trap_push clean_sys -sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs ## Pointing apt to public apt mirrors and getting latest packages, needed for latest security updates sudo cp files/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ @@ -132,6 +125,15 @@ sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Install latest intel igb driver sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko +## Install package without starting service +## ref: https://wiki.debian.org/chroot +trap_push 'sudo rm -f $FILESYSTEM_ROOT/usr/sbin/policy-rc.d' +sudo tee -a $FILESYSTEM_ROOT/usr/sbin/policy-rc.d > /dev/null < Date: Fri, 30 Dec 2016 23:34:38 +0200 Subject: [PATCH 0175/1833] [docker-teamd]: rename docker-team to docker-teamd (#174) --- dockers/{docker-team => docker-teamd}/Dockerfile.j2 | 2 +- dockers/{docker-team => docker-teamd}/start.sh | 0 platform/generic/rules.mk | 2 +- platform/mellanox/rules.mk | 2 +- rules/docker-team.mk | 7 ------- rules/docker-teamd.mk | 7 +++++++ 6 files changed, 10 insertions(+), 10 deletions(-) rename dockers/{docker-team => docker-teamd}/Dockerfile.j2 (87%) rename dockers/{docker-team => docker-teamd}/start.sh (100%) delete mode 100644 rules/docker-team.mk create mode 100644 rules/docker-teamd.mk diff --git a/dockers/docker-team/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 similarity index 87% rename from dockers/docker-team/Dockerfile.j2 rename to dockers/docker-teamd/Dockerfile.j2 index 27c5704234ea..3cbb5007507d 100644 --- a/dockers/docker-team/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -5,7 +5,7 @@ RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 COPY debs /debs RUN dpkg -i \ -{% for deb in docker_team_debs.split(' ') -%} +{% for deb in docker_teamd_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/dockers/docker-team/start.sh b/dockers/docker-teamd/start.sh similarity index 100% rename from dockers/docker-team/start.sh rename to dockers/docker-teamd/start.sh diff --git a/platform/generic/rules.mk b/platform/generic/rules.mk index 5ef6468b2f7e..cff64a8b6003 100644 --- a/platform/generic/rules.mk +++ b/platform/generic/rules.mk @@ -1,6 +1,6 @@ SONIC_ALL += $(DOCKER_DATABASE) \ $(DOCKER_FPM) \ - $(DOCKER_TEAM) \ + $(DOCKER_TEAMD) \ $(DOCKER_LLDP_SV2) \ $(DOCKER_SNMP_SV2) \ $(DOCKER_PLATFORM_MONITOR) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index bb07273417b7..debf4a4606da 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -14,7 +14,7 @@ SONIC_ALL += $(DOCKER_SYNCD_MLNX) \ $(DOCKER_DATABASE) \ $(DOCKER_LLDP_SV2) \ $(DOCKER_SNMP_SV2) \ - $(DOCKER_TEAM) \ + $(DOCKER_TEAMD) \ $(DOCKER_PLATFORM_MONITOR) \ debs/$(MLNX_HW_MANAGEMENT) \ debs/$(SX_KERNEL) diff --git a/rules/docker-team.mk b/rules/docker-team.mk deleted file mode 100644 index 3f5b99ac9666..000000000000 --- a/rules/docker-team.mk +++ /dev/null @@ -1,7 +0,0 @@ -# docker image for team agent - -DOCKER_TEAM = docker-team.gz -$(DOCKER_TEAM)_PATH = $(DOCKERS_PATH)/docker-team -$(DOCKER_TEAM)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) -$(DOCKER_TEAM)_LOAD_DOCKERS += $(DOCKER_BASE) -SONIC_DOCKER_IMAGES += $(DOCKER_TEAM) diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk new file mode 100644 index 000000000000..0760f27902ae --- /dev/null +++ b/rules/docker-teamd.mk @@ -0,0 +1,7 @@ +# docker image for teamd agent + +DOCKER_TEAMD = docker-teamd.gz +$(DOCKER_TEAMD)_PATH = $(DOCKERS_PATH)/docker-teamd +$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) +$(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) From 61496a5959cff4c317f998da6605d8b3072a7de4 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 30 Dec 2016 23:35:04 +0200 Subject: [PATCH 0176/1833] [docker]: Remove obsolete dockers (#175) docker-syncd-mlnx and docker-syncd-cavm were moved to platform directories --- dockers/docker-syncd-cavm/Dockerfile | 30 ----------- dockers/docker-syncd-cavm/start.sh | 23 --------- dockers/docker-syncd-mlnx/Dockerfile | 39 -------------- dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh | 53 -------------------- dockers/docker-syncd-mlnx/start.sh | 21 -------- 5 files changed, 166 deletions(-) delete mode 100755 dockers/docker-syncd-cavm/Dockerfile delete mode 100755 dockers/docker-syncd-cavm/start.sh delete mode 100755 dockers/docker-syncd-mlnx/Dockerfile delete mode 100755 dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh delete mode 100755 dockers/docker-syncd-mlnx/start.sh diff --git a/dockers/docker-syncd-cavm/Dockerfile b/dockers/docker-syncd-cavm/Dockerfile deleted file mode 100755 index 41298a29ede4..000000000000 --- a/dockers/docker-syncd-cavm/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM docker-base - -RUN apt-get update - -COPY ["deps/libhiredis0.13*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "deps/libswsscommon_*.deb", "deps/libsairedis_*.deb", "deps/libsaimetadata_*.deb", "deps/syncd_*.deb", "deps/sai*.deb", "deps/libsai*.deb", "deps/xp-tools*.deb", "deps/xpshell*.deb", "/deps/"] - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/libhiredis0.13*.deb \ - && dpkg_apt /deps/libnl-3-200_*.deb \ - && dpkg_apt /deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /deps/libnl-route-3-200_*.deb \ - && dpkg_apt /deps/libswsscommon_*.deb \ - && dpkg_apt /deps/sai*.deb \ - && dpkg_apt /deps/libsai*.deb \ - && dpkg_apt /deps/xp-tools*.deb \ - && dpkg_apt /deps/xpshell*.deb \ - && dpkg_apt /deps/libsairedis_*.deb \ - && dpkg_apt /deps/libsaimetadata_*.deb \ - && dpkg_apt /deps/syncd_*.deb - -RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev redis-tools - -COPY ["start.sh", "/usr/bin/"] - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps - -ENTRYPOINT /usr/bin/start.sh \ - && /bin/bash diff --git a/dockers/docker-syncd-cavm/start.sh b/dockers/docker-syncd-cavm/start.sh deleted file mode 100755 index 21d61e707344..000000000000 --- a/dockers/docker-syncd-cavm/start.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -export XP_ROOT=/usr/bin/ - -service rsyslog start - -while true; do - - # Check if redis-server starts - - result=$(redis-cli ping) - - if [ "$result" == "PONG" ]; then - - redis-cli FLUSHALL - syncd -p /etc/ssw/AS7512/profile.ini -N - break - - fi - - sleep 1 - -done diff --git a/dockers/docker-syncd-mlnx/Dockerfile b/dockers/docker-syncd-mlnx/Dockerfile deleted file mode 100755 index 77229a333d11..000000000000 --- a/dockers/docker-syncd-mlnx/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -FROM docker-base - -RUN apt-get update - -COPY deps /deps - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/applibs_*.deb \ - && dpkg_apt /deps/applibs-dev_*.deb \ - && dpkg_apt /deps/sx-complib_*.deb \ - && dpkg_apt /deps/sxd-libs_*.deb \ - && dpkg_apt /deps/sx-scew_*.deb \ - && dpkg_apt /deps/sx-examples_*.deb \ - && dpkg_apt /deps/sx-gen-utils_*.deb \ - && dpkg_apt /deps/python-sdk-api_*.deb \ - && dpkg_apt /deps/iproute2_*.deb \ - && dpkg_apt /deps/mft*.deb \ - - && dpkg_apt /deps/libhiredis0.13*.deb \ - && dpkg_apt /deps/libnl-3-200_*.deb \ - && dpkg_apt /deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /deps/libnl-route-3-200_*.deb \ - && dpkg_apt /deps/libswsscommon_*.deb \ - && dpkg_apt /deps/mlnx-sai_*.deb \ - && dpkg_apt /deps/libsairedis_*.deb \ - && dpkg_apt /deps/libsaimetadata_*.deb - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb - -COPY ["start.sh", "/usr/bin/"] -COPY ["mlnx-fw-upgrade.sh", "/usr/bin/"] -COPY ["/deps/fw-SPC.mfa", "/etc/mlnx/"] - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /deps - -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh b/dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh deleted file mode 100755 index 81514f77b062..000000000000 --- a/dockers/docker-syncd-mlnx/mlnx-fw-upgrade.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -query_retry_count_max="10" -required_fw_version="13.1200.0116" -fw_file=/etc/mlnx/fw-SPC.mfa - -run_or_fail() { - $1 - if [[ $? != 0 ]]; then - echo $1 failed - exit 1 - fi -} - -# wait until devices will be available -query_retry_count="0" -mlxfwmanager --query > /dev/null - -while [[ (${query_retry_count} -lt ${query_retry_count_max}) && ($? -ne "0") ]]; do - sleep 1 - query_retry_count=$[${query_retry_count}+1] - mlxfwmanager --query > /dev/null -done - -run_or_fail "mlxfwmanager --query" > /tmp/mlnxfwmanager-query.txt - -# get current firmware version -found_fw=false -for word in `cat /tmp/mlnxfwmanager-query.txt` -do - if [[ ${found_fw} == true ]]; then - fw_version=${word} - break - fi - if [[ ${word} == FW ]]; then - found_fw=true - fi -done - -if [[ -z ${fw_version} ]]; then - echo "Could not retreive current FW version." - exit 1 -fi - -if [[ ${required_fw_version} == ${fw_version} ]]; then - echo "Mellanox firmware is up to date." -else - echo "Mellanox firmware required version is ${required_fw_version}. Installing compatible version..." - run_or_fail "mlxfwmanager -i ${fw_file} -u -f -y" - - # exit from here so that syncd service will restart - exit 0 -fi diff --git a/dockers/docker-syncd-mlnx/start.sh b/dockers/docker-syncd-mlnx/start.sh deleted file mode 100755 index 3c07069ba26e..000000000000 --- a/dockers/docker-syncd-mlnx/start.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -function clean_up { - service syncd stop - service rsyslog stop - exit -} - -trap clean_up SIGTERM SIGKILL - -# fw-upgrade will exit if firmware was actually upgraded or if some error -# occures -. mlnx-fw-upgrade.sh - -# FIXME: the script cannot trap SIGTERM signal and it exits without clean_up -# Remove rsyslogd.pid file manually so that to start the rsyslog instantly -[ -e /var/run/rsyslogd.pid ] && rm /var/run/rsyslogd.pid -service rsyslog start -service syncd start - -read From dcc9d01577c595d7125b9f4915967fb2401ffe88 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 3 Jan 2017 21:02:09 -0800 Subject: [PATCH 0177/1833] [sairedis]: update sairedis submodule (#177) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index e393930b8bc3..d1c6eb891bb4 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit e393930b8bc38fcdb950139db8c2353b887128c8 +Subproject commit d1c6eb891bb40317afa47389b8fa24212f03c24e From 0252d78aec0f0a8300eaa8fe1ab33b8ecf1cea2c Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 4 Jan 2017 08:06:38 -0800 Subject: [PATCH 0178/1833] [swss]: update sonic-swss submodule (#179) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 4c753eb8133d..9be6620bbf4d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 4c753eb8133d1ac708190c89ed75c2274bce4c5d +Subproject commit 9be6620bbf4dc0c822661920b8bbac5c419a2b4d From c19a25988c6f3e76f77ede773c350f78aba68c7f Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 4 Jan 2017 19:07:50 -0800 Subject: [PATCH 0179/1833] add sonic utilities into buildimage (#180) --- .gitmodules | 3 +++ rules/sonic-utilities.mk | 5 +++++ src/sonic-utilities | 1 + 3 files changed, 9 insertions(+) create mode 100644 rules/sonic-utilities.mk create mode 160000 src/sonic-utilities diff --git a/.gitmodules b/.gitmodules index a6928d64f2c4..c8b1acdb78ec 100644 --- a/.gitmodules +++ b/.gitmodules @@ -44,3 +44,6 @@ [submodule "src/ptf"] path = src/ptf url = https://github.com/p4lang/ptf.git +[submodule "src/sonic-utilities"] + path = src/sonic-utilities + url = https://github.com/Azure/sonic-utilities diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk new file mode 100644 index 000000000000..7f40cdc93c6c --- /dev/null +++ b/rules/sonic-utilities.mk @@ -0,0 +1,5 @@ +# sonic utilities package + +SONIC_UTILS = sonic-utilities_0.1_amd64.deb +$(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities +SONIC_DPKG_DEBS += $(SONIC_UTILS) diff --git a/src/sonic-utilities b/src/sonic-utilities new file mode 160000 index 000000000000..a3f98cdb8f07 --- /dev/null +++ b/src/sonic-utilities @@ -0,0 +1 @@ +Subproject commit a3f98cdb8f073b567c3d4f552ea53e110da960bb From 57dd634935dfbb5b6f184f11a41105d18c6025ef Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Thu, 5 Jan 2017 20:14:03 +0200 Subject: [PATCH 0180/1833] platform/cavium : Download SAI libraries from Xpliant github repo (#183) --- platform/cavium/cavm-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/cavium/cavm-sai.mk b/platform/cavium/cavm-sai.mk index c0e16e1ebd94..9308766e16e1 100644 --- a/platform/cavium/cavm-sai.mk +++ b/platform/cavium/cavm-sai.mk @@ -1,6 +1,6 @@ # Cavium SAI -CAVM_SAI_GITHUB = https://github.com/garyachy/OpenXPS/raw/3c2dbbee23ee76570bbdb11d4955882279cc3f9a/SAI/cavm-sai +CAVM_SAI_GITHUB = https://github.com/XPliant/OpenXPS/raw/d8868c604ef32dd3f254c3ba58b3453d21bc5722/SAI/cavm-sai/ CAVM_LIBSAI = libsai.deb CAVM_SAI = sai.deb From a0281f806919e23a33e62aba5ef319380463af4d Mon Sep 17 00:00:00 2001 From: Nadiya Date: Thu, 5 Jan 2017 20:14:46 +0200 Subject: [PATCH 0181/1833] Added profile.ini into docker-syncd-cavm (#184) Signed-off-by: Nadiya.Stetskovych --- platform/cavium/docker-syncd-cavm/Dockerfile.j2 | 2 ++ platform/cavium/docker-syncd-cavm/profile.ini | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 platform/cavium/docker-syncd-cavm/profile.ini diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index f8e48259e8be..840399ac5953 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -13,6 +13,8 @@ debs/{{ deb }}{{' '}} COPY ["start.sh", "/usr/bin/"] +COPY ["profile.ini", "/etc/ssw/AS7512/"] + ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs diff --git a/platform/cavium/docker-syncd-cavm/profile.ini b/platform/cavium/docker-syncd-cavm/profile.ini new file mode 100644 index 000000000000..1e5fc5f0fc0a --- /dev/null +++ b/platform/cavium/docker-syncd-cavm/profile.ini @@ -0,0 +1,3 @@ +mode=1 +hwId=as7512 + From 43b0e502de060b08874c5190e8532dea8878a953 Mon Sep 17 00:00:00 2001 From: marian-pritsak Date: Fri, 9 Dec 2016 12:24:08 +0200 Subject: [PATCH 0182/1833] Add recipe for ptf docker --- dockers/docker-ptf/{Dockerfile => Dockerfile.j2} | 16 ++++++++++------ rules/docker-ptf.mk | 6 ++++++ 2 files changed, 16 insertions(+), 6 deletions(-) rename dockers/docker-ptf/{Dockerfile => Dockerfile.j2} (89%) create mode 100644 rules/docker-ptf.mk diff --git a/dockers/docker-ptf/Dockerfile b/dockers/docker-ptf/Dockerfile.j2 similarity index 89% rename from dockers/docker-ptf/Dockerfile rename to dockers/docker-ptf/Dockerfile.j2 index d72391a7ba43..db67c3261d36 100644 --- a/dockers/docker-ptf/Dockerfile +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -3,7 +3,7 @@ FROM debian:jessie MAINTAINER Pavel Shirshov ## Copy dependencies -COPY deps /root/deps +COPY debs /debs ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -35,11 +35,15 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / python-dev \ wget \ cmake \ - && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ - && dpkg_apt /root/deps/python-ptf_*.deb \ - && dpkg_apt /root/deps/libthrift-0.9.3_*.deb \ - && dpkg_apt /root/deps/python-thrift_*.deb \ - && rm -rf /root/deps \ + libqt5core5a \ + libqt5network5 + +RUN dpkg -i \ +{% for deb in docker_ptf_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +RUN rm -rf /debs \ && apt-get -y autoclean \ && apt-get -y autoremove \ && rm -rf /var/lib/apt/lists/* \ diff --git a/rules/docker-ptf.mk b/rules/docker-ptf.mk new file mode 100644 index 000000000000..2782c45339bd --- /dev/null +++ b/rules/docker-ptf.mk @@ -0,0 +1,6 @@ +# docker image for ptf + +DOCKER_PTF = docker-ptf.gz +$(DOCKER_PTF)_PATH = $(DOCKERS_PATH)/docker-ptf +$(DOCKER_PTF)_DEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(PTF) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF) From ed9c8fbe8e4f570c66835a1455cee82a7d2ef5ac Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 6 Jan 2017 18:19:42 -0800 Subject: [PATCH 0183/1833] add sonic config render engine (#178) add sonic config render engine --- rules/sonic-config.mk | 5 + src/sonic-config-engine/minigraph.py | 381 +++++++++++++++++++++++++++ src/sonic-config-engine/setup.py | 14 + src/sonic-config-engine/sonic-cfggen | 63 +++++ 4 files changed, 463 insertions(+) create mode 100644 rules/sonic-config.mk create mode 100644 src/sonic-config-engine/minigraph.py create mode 100644 src/sonic-config-engine/setup.py create mode 100755 src/sonic-config-engine/sonic-cfggen diff --git a/rules/sonic-config.mk b/rules/sonic-config.mk new file mode 100644 index 000000000000..ba2fdacc2c50 --- /dev/null +++ b/rules/sonic-config.mk @@ -0,0 +1,5 @@ +# sonic-config-engine package + +SONIC_CONFIG_ENGINE = sonic-config-engine_1.0-1_all.deb +$(SONIC_CONFIG_ENGINE)_SRC_PATH = $(SRC_PATH)/sonic-config-engine +SONIC_PYTHON_STDEB_DEBS += $(SONIC_CONFIG_ENGINE) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py new file mode 100644 index 000000000000..2bc7bf43cdfa --- /dev/null +++ b/src/sonic-config-engine/minigraph.py @@ -0,0 +1,381 @@ +#!/usr/bin/env python +import calendar +import os +import sys +import socket +import struct +import json +import copy +import ipaddr as ipaddress +from collections import defaultdict + +from lxml import etree as ET +from lxml.etree import QName + +DOCUMENTATION = ''' +--- +module: minigraph_facts +version_added: "1.9" +author: Guohan Lu (gulv@microsoft.com) +short_description: Retrive minigraph facts for a device. +description: + - Retrieve minigraph facts for a device, the facts will be + inserted to the ansible_facts key. +options: + host: + description: + - Set to target snmp server (normally {{inventory_hostname}}) + required: true +''' + +EXAMPLES = ''' +# Gather minigraph facts +- name: Gathering minigraph facts about the device + minigraph_facts: host={{ hostname }} +''' + +ns = "Microsoft.Search.Autopilot.Evolution" +ns1 = "http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" +ns2 = "Microsoft.Search.Autopilot.NetMux" +ns3 = "http://www.w3.org/2001/XMLSchema-instance" + +class minigraph_encoder(json.JSONEncoder): + def default(self, obj): + if isinstance(obj, (ipaddress.IPv4Network, ipaddress.IPv6Network, ipaddress.IPv4Address, ipaddress.IPv6Address)): + return str(obj) + return json.JSONEncoder.default(self, obj) + +def parse_png(png, hname): + neighbors = {} + devices = {} + console_dev = '' + console_port = '' + mgmt_dev = '' + mgmt_port = '' + for child in png: + if child.tag == str(QName(ns, "DeviceInterfaceLinks")): + for link in child.findall(str(QName(ns, "DeviceLinkBase"))): + linktype = link.find(str(QName(ns, "ElementType"))).text + if linktype != "DeviceInterfaceLink" and linktype != "UnderlayInterfaceLink": + continue + + enddevice = link.find(str(QName(ns, "EndDevice"))).text + endport = link.find(str(QName(ns, "EndPort"))).text + startdevice = link.find(str(QName(ns, "StartDevice"))).text + startport = link.find(str(QName(ns, "StartPort"))).text + + if enddevice == hname: + neighbors[endport] = {'name': startdevice, 'port': startport} + else: + neighbors[startport] = {'name': enddevice, 'port': endport} + if child.tag == str(QName(ns, "Devices")): + for device in child.findall(str(QName(ns, "Device"))): + lo_addr = None + # don't shadow type() + d_type = None + mgmt_addr = None + hwsku = None + if str(QName(ns3, "type")) in device.attrib: + d_type = device.attrib[str(QName(ns3, "type"))] + + for node in device: + if node.tag == str(QName(ns, "Address")): + lo_addr = node.find(str(QName(ns2, "IPPrefix"))).text.split('/')[0] + elif node.tag == str(QName(ns, "ManagementAddress")): + mgmt_addr = node.find(str(QName(ns2, "IPPrefix"))).text.split('/')[0] + elif node.tag == str(QName(ns, "Hostname")): + name = node.text + elif node.tag == str(QName(ns, "HwSku")): + hwsku = node.text + + devices[name] = {'lo_addr': lo_addr, 'type': d_type, 'mgmt_addr': mgmt_addr, 'hwsku': hwsku} + + if child.tag == str(QName(ns, "DeviceInterfaceLinks")): + for if_link in child.findall(str(QName(ns, 'DeviceLinkBase'))): + if str(QName(ns3, "type")) in if_link.attrib: + link_type = if_link.attrib[str(QName(ns3, "type"))] + if link_type == 'DeviceSerialLink': + for node in if_link: + if node.tag == str(QName(ns, "EndPort")): + console_port = node.text.split()[-1] + elif node.tag == str(QName(ns, "EndDevice")): + console_dev = node.text + elif link_type == 'DeviceMgmtLink': + for node in if_link: + if node.tag == str(QName(ns, "EndPort")): + mgmt_port = node.text.split()[-1] + elif node.tag == str(QName(ns, "EndDevice")): + mgmt_dev = node.text + + + return (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port) + + +def parse_dpg(dpg, hname): + for child in dpg: + hostname = child.find(str(QName(ns, "Hostname"))) + if hostname.text != hname: + continue + + ipintfs = child.find(str(QName(ns, "IPInterfaces"))) + intfs = [] + vlan_map = {} + for ipintf in ipintfs.findall(str(QName(ns, "IPInterface"))): + intfname = ipintf.find(str(QName(ns, "AttachTo"))).text + ipprefix = ipintf.find(str(QName(ns, "Prefix"))).text + ipn = ipaddress.IPNetwork(ipprefix) + ipaddr = ipn.ip + prefix_len = ipn.prefixlen + addr_bits = ipn.max_prefixlen + subnet = ipaddress.IPNetwork(str(ipn.network) + '/' + str(prefix_len)) + ipmask = ipn.netmask + + intf = {'addr': ipaddr, 'subnet': subnet} + if isinstance(ipn, ipaddress.IPv4Network): + intf['mask'] = ipmask + else: + intf['mask'] = str(prefix_len) + + if intfname[0:4] == "Vlan": + if intfname in vlan_map: + vlan_map[intfname].append(intf) + + else: + vlan_map[intfname] = [intf] + else: + intf.update({'name': intfname, 'prefixlen': int(prefix_len)}) + + if port_alias_map.has_key(intfname): + intf['alias'] = port_alias_map[intfname] + else: + intf['alias'] = intfname + + # TODO: remove peer_addr after dependency removed + ipaddr_val = int(ipn.ip) + peer_addr_val = None + if int(prefix_len) == addr_bits - 2: + if ipaddr_val & 0x3 == 1: + peer_addr_val = ipaddr_val + 1 + else: + peer_addr_val = ipaddr_val - 1 + elif int(prefix_len) == addr_bits - 1: + if ipaddr_val & 0x1 == 0: + peer_addr_val = ipaddr_val + 1 + else: + peer_addr_val = ipaddr_val - 1 + + if peer_addr_val is not None: + intf['peer_addr'] = ipaddress.IPAddress(peer_addr_val) + intfs.append(intf) + + pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) + pc_intfs = [] + for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): + pcintfname = pcintf.find(str(QName(ns, "Name"))).text + pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text + pcmbr_list = pcintfmbr.split(';', 1) + pc_intfs.append({'name': pcintfname, 'members': pcmbr_list}) + + lointfs = child.find(str(QName(ns, "LoopbackIPInterfaces"))) + lo_intfs = [] + for lointf in lointfs.findall(str(QName(ns1, "LoopbackIPInterface"))): + intfname = lointf.find(str(QName(ns, "AttachTo"))).text + ipprefix = lointf.find(str(QName(ns1, "PrefixStr"))).text + ipn = ipaddress.IPNetwork(ipprefix) + ipaddr = ipn.ip + prefix_len = ipn.prefixlen + ipmask = ipn.netmask + lo_intf = {'name': intfname, 'addr': ipaddr, 'prefixlen': prefix_len} + if isinstance(ipn, ipaddress.IPv4Network): + lo_intf['mask'] = ipmask + else: + lo_intf['mask'] = str(prefix_len) + lo_intfs.append(lo_intf) + + mgmtintfs = child.find(str(QName(ns, "ManagementIPInterfaces"))) + mgmt_intf = None + for mgmtintf in mgmtintfs.findall(str(QName(ns1, "ManagementIPInterface"))): + ipprefix = mgmtintf.find(str(QName(ns1, "PrefixStr"))).text + mgmtipn = ipaddress.IPNetwork(ipprefix) + ipaddr = mgmtipn.ip + prefix_len = str(mgmtipn.prefixlen) + ipmask = mgmtipn.netmask + gwaddr = ipaddress.IPAddress(int(mgmtipn.network) + 1) + mgmt_intf = {'addr': ipaddr, 'prefixlen': prefix_len, 'mask': ipmask, 'gwaddr': gwaddr} + + vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) + vlan_intfs = [] + for vintf in vlanintfs.findall(str(QName(ns, "VlanInterface"))): + vintfname = vintf.find(str(QName(ns, "Name"))).text + vlanid = vintf.find(str(QName(ns, "VlanID"))).text + vintfmbr = vintf.find(str(QName(ns, "AttachTo"))).text + vmbr_list = vintfmbr.split(';')) + vlan_attributes = {'name': vintfname, 'members': vmbr_list, 'vlanid': vlanid} + for addrtuple in vlan_map.get(vintfname, []): + vlan_attributes.update(addrtuple) + vlan_intfs.append(copy.deepcopy(vlan_attributes)) + + return intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs + return None, None, None, None, None + +def parse_cpg(cpg, hname): + bgp_sessions = [] + myasn = None + for child in cpg: + tag = child.tag + if tag == str(QName(ns, "PeeringSessions")): + for session in child.findall(str(QName(ns, "BGPSession"))): + start_router = session.find(str(QName(ns, "StartRouter"))).text + start_peer = session.find(str(QName(ns, "StartPeer"))).text + end_router = session.find(str(QName(ns, "EndRouter"))).text + end_peer = session.find(str(QName(ns, "EndPeer"))).text + if end_router == hname: + bgp_sessions.append({ + 'name': start_router, + 'addr': start_peer, + 'peer_addr': end_peer + }) + else: + bgp_sessions.append({ + 'name': end_router, + 'addr': end_peer, + 'peer_addr': start_peer + }) + elif child.tag == str(QName(ns, "Routers")): + for router in child.findall(str(QName(ns1, "BGPRouterDeclaration"))): + asn = router.find(str(QName(ns1, "ASN"))).text + hostname = router.find(str(QName(ns1, "Hostname"))).text + if hostname == hname: + myasn = int(asn) + else: + for bgp_session in bgp_sessions: + if hostname == bgp_session['name']: + bgp_session['asn'] = int(asn) + + return bgp_sessions, myasn + + +def get_console_info(devices, dev, port): + for k, v in devices.items(): + if k == dev: + break + else: + return {} + + ret_val = v + ret_val.update({ + 'ts_port': port, + 'ts_dev': dev + }) + + return ret_val + +def get_mgmt_info(devices, dev, port): + for k, v in devices.items(): + if k == dev: + break + else: + return {} + + ret_val = v + ret_val.update({ + 'mgmt_port': port, + 'mgmt_dev': dev + }) + + return ret_val + +def parse_xml(filename): + root = ET.parse(filename).getroot() + mini_graph_path = filename + + u_neighbors = None + u_devices = None + hwsku = None + bgp_sessions = None + bgp_asn = None + intfs = None + vlan_intfs = None + pc_intfs = None + mgmt_intf = None + lo_intf = None + neighbors = None + devices = None + hostname = None + + hwsku_qn = QName(ns, "HwSku") + hostname_qn = QName(ns, "Hostname") + for child in root: + if child.tag == str(hwsku_qn): + hwsku = child.text + if child.tag == str(hostname_qn): + hostname = child.text + + # port_alias_map maps ngs port name to sonic port name + if hwsku == "Force10-S6000": + for i in range(0, 128, 4): + port_alias_map["fortyGigE0/%d" % i] = "Ethernet%d" % i + elif hwsku == "Arista-7050-QX32": + for i in range(1, 25): + port_alias_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 1) * 4) + for i in range(25, 33): + port_alias_map["Ethernet%d" % i] = "Ethernet%d" % ((i - 1) * 4) + + for child in root: + if child.tag == str(QName(ns, "DpgDec")): + (intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs) = parse_dpg(child, hostname) + elif child.tag == str(QName(ns, "CpgDec")): + (bgp_sessions, bgp_asn) = parse_cpg(child, hostname) + elif child.tag == str(QName(ns, "PngDec")): + (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port) = parse_png(child, hostname) + elif child.tag == str(QName(ns, "UngDec")): + (u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname) + + # Replace port with alias in Vlan interfaces members + for vlan in vlan_intfs: + for i,member in enumerate(vlan['members']): + vlan['members'][i] = port_alias_map[member] + + # Convert vlan members into a space-delimited string + vlan['members'] = " ".join(vlan['members']) + + # Replace port with alias in port channel interfaces members + for pc in pc_intfs: + for i,member in enumerate(pc['members']): + pc['members'][i] = port_alias_map[member] + + Tree = lambda: defaultdict(Tree) + + results = Tree() + results['minigraph_hwsku'] = hwsku + # sorting by lambdas are not easily done without custom filters. + # TODO: add jinja2 filter to accept a lambda to sort a list of dictionaries by attribute. + # TODO: alternatively (preferred), implement class containers for multiple-attribute entries, enabling sort by attr + results['minigraph_bgp'] = sorted(bgp_sessions, key=lambda x: x['addr']) + results['minigraph_bgp_asn'] = bgp_asn + # TODO: sort does not work properly on all interfaces of varying lengths. Need to sort by integer group(s). + results['minigraph_interfaces'] = sorted(intfs, key=lambda x: x['name']) + results['minigraph_vlan_interfaces'] = vlan_intfs + results['minigraph_portchannel_interfaces'] = pc_intfs + results['minigraph_mgmt_interface'] = mgmt_intf + results['minigraph_lo_interfaces'] = lo_intfs + results['minigraph_neighbors'] = neighbors + results['minigraph_devices'] = devices + results['minigraph_underlay_neighbors'] = u_neighbors + results['minigraph_underlay_devices'] = u_devices + results['minigraph_as_xml'] = mini_graph_path + results['minigraph_console'] = get_console_info(devices, console_dev, console_port) + results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port) + results['inventory_hostname'] = hostname + + return results + + +port_alias_map = {} + + +def print_parse_xml(filename): + results = parse_xml(filename) + print(json.dumps(results, indent=3, cls=minigraph_encoder)) + + diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py new file mode 100644 index 000000000000..3223735b971a --- /dev/null +++ b/src/sonic-config-engine/setup.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +from setuptools import setup + +setup(name='sonic-config-engine', + version='1.0', + description='Utilities for generating SONiC configuration files', + author='Taoyu Li', + author_email='taoyl@microsoft.com', + url='https://github.com/Azure/sonic-buildimage', + py_modules=['minigraph'], + scripts=['sonic-cfggen'], + install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'yaml'], + ) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen new file mode 100755 index 000000000000..e20b15977d18 --- /dev/null +++ b/src/sonic-config-engine/sonic-cfggen @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +import sys +import os.path +import argparse +import yaml +import jinja2 +import netaddr +from minigraph import parse_xml + + +def is_ipv4(value): + if not value: + return False + if isinstance(value, netaddr.IPAddress): + addr = value + else: + try: + addr = netaddr.IPAddress(str(value)) + except: + return False + return addr.version == 4 + +def is_ipv6(value): + if not value: + return False + if isinstance(value, netaddr.IPAddress): + addr = value + else: + try: + addr = netaddr.IPAddress(str(value)) + except: + return False + return addr.version == 6 + + +def main(): + parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") + parser.add_argument("template") + parser.add_argument("-m", "--minigraph", required=True, help="minigraph xml file") + parser.add_argument("-v", "--var-file", help="yaml file that contains addtional variables") + args = parser.parse_args() + + minigraph = args.minigraph + template_file = os.path.abspath(args.template) + + data = parse_xml(minigraph) + + if args.var_file != None: + with open(args.var_file, 'r') as stream: + additional_data = yaml.load(stream) + data.update(additional_data) + + env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) + env.filters['ipv4'] = is_ipv4 + env.filters['ipv6'] = is_ipv6 + template = env.get_template(template_file) + + print template.render(data) + +if __name__ == "__main__": + main() + From d92f99799b1f8132016e6dc115eae1f25dcb9520 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 9 Jan 2017 14:34:14 -0800 Subject: [PATCH 0184/1833] [platform]: Update Broadcom debian package versions and chmod on executables (#185) --- platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 1 + platform/broadcom/sai.mk | 10 ++++------ platform/broadcom/sdk.mk | 8 ++++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 163e664f0dec..89204c03d9be 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -13,6 +13,7 @@ debs/{{ deb }}{{' '}} RUN apt-get install -f kmod COPY ["debs/dsserve", "debs/bcmcmd", "start.sh", "/usr/bin/"] +RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 2185edefe2b1..e7366d90a2bd 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,11 +1,9 @@ -BRCM_SAI = libsaibcm_2.0.3.7_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.0.3.7_amd64.deb?sv=2015-04-05&sr=b&sig=3S9pY5Allql4fguipFdilJ%2BzP%2Ff4dvUFe3mNY3uhCIc%3D&se=2030-09-02T21%3A43%3A38Z&sp=r" - -BRCM_SAI_DEV = libsaibcm-dev_2.0.3.7_amd64.deb +BRCM_SAI = libsaibcm_2.0.3.7-1_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.0.3.7-1_amd64.deb?sv=2015-04-05&sr=b&sig=VCOFP%2FtCWJUZpN04CMHbsSXS7bKMIV%2B14fLbpNBUe4A%3D&se=2030-09-18T19%3A17%3A52Z&sp=r" +BRCM_SAI_DEV = libsaibcm-dev_2.0.3.7-1_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) - -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.0.3.7_amd64.deb?sv=2015-04-05&sr=b&sig=KI8DfgGW8%2BOoZL6tJ9aJa%2F3RvHi%2FXD8gtOcDUD5nOPA%3D&se=2030-09-03T04%3A52%3A41Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.0.3.7-1_amd64.deb?sv=2015-04-05&sr=b&sig=QeOqPjmYW%2BHqaK3x1JlgCEVeYto0cZeYj6M52vY1Wjw%3D&se=2030-09-18T19%3A18%3A55Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 7778e2cf5376..74d1d8ce145c 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.1.5_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5_amd64.deb?sv=2015-04-05&sr=b&sig=qm6%2BkiGuRGsFKwZcUz6yEtbgbbwQuhxEr0chLM7qJEQ%3D&se=2030-09-02T21%3A41%3A11Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.1.5-1_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-1_amd64.deb?sv=2015-04-05&sr=b&sig=9Mhm4cuju4P7TmVApXihECo1fHLbANWNWTKYLnHcrOk%3D&se=2030-09-18T19%3A19%3A46Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5_amd64.deb?sv=2015-04-05&sr=b&sig=c8hO5PQpvod7IX3aYOiyvFB9rICxDgGiFF5g3GDHx84%3D&se=2030-09-02T21%3A42%3A34Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-1_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-1_amd64.deb?sv=2015-04-05&sr=b&sig=iakUQ4CdHYbKc9ikiNNVrrLe0K8cMrez5vex7L%2BWD2o%3D&se=2030-09-18T19%3A20%3A14Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 5aae34ab4d6b2e56abcde0482872dc778d47c671 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 11 Jan 2017 13:54:58 -0800 Subject: [PATCH 0185/1833] [redis]: disable auto test during the build (#187) --- src/redis/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redis/Makefile b/src/redis/Makefile index a49ee4a9f015..ddc952ff75ad 100644 --- a/src/redis/Makefile +++ b/src/redis/Makefile @@ -16,7 +16,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-source -x redis_$(REDIS_VERSION_FULL).dsc pushd redis-$(REDIS_VERSION) - fakeroot debian/rules binary + DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -us -uc -b popd mv $(DERIVED_TARGETS) $* $(DEST)/ From fe5182c5b45ef744de50330bf156098bf9803c7e Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 12 Jan 2017 08:06:14 -0800 Subject: [PATCH 0186/1833] update swss, swss-common, sairedis submodules (#189) --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index d1c6eb891bb4..04ba52422ecc 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit d1c6eb891bb40317afa47389b8fa24212f03c24e +Subproject commit 04ba52422ecc038b509c072cfcf4ac2baa06db84 diff --git a/src/sonic-swss b/src/sonic-swss index 9be6620bbf4d..1bd4240f6641 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 9be6620bbf4dc0c822661920b8bbac5c419a2b4d +Subproject commit 1bd4240f6641223f70d215fb044fdf8ecf93da85 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 81ed1b603add..e06988dd2c44 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 81ed1b603add087b0ea3827036910a6785dba0c5 +Subproject commit e06988dd2c44f6c5200f16c765a0e9a64a0ce274 From 387399663f39815bddd4c08a709e06028b45d711 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 12 Jan 2017 10:40:25 -0800 Subject: [PATCH 0187/1833] [platform]: Update Broadcom debian packages (#188) --- platform/broadcom/sai.mk | 11 +++++------ platform/broadcom/sdk.mk | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index e7366d90a2bd..c89382b5fff4 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,11 +1,10 @@ -BRCM_SAI = libsaibcm_2.0.3.7-1_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.0.3.7-1_amd64.deb?sv=2015-04-05&sr=b&sig=VCOFP%2FtCWJUZpN04CMHbsSXS7bKMIV%2B14fLbpNBUe4A%3D&se=2030-09-18T19%3A17%3A52Z&sp=r" +BRCM_SAI = libsaibcm_2.0.3.7-2_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.0.3.7-2_amd64.deb?sv=2015-04-05&sr=b&sig=E9zdq7DpvZSpztO94eiNF4svl8T3wCywZxXRLpLnIpk%3D&se=2030-09-21T00%3A27%3A41Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.0.3.7-1_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.0.3.7-2_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.0.3.7-1_amd64.deb?sv=2015-04-05&sr=b&sig=QeOqPjmYW%2BHqaK3x1JlgCEVeYto0cZeYj6M52vY1Wjw%3D&se=2030-09-18T19%3A18%3A55Z&sp=r" - -SONIC_ONLINE_DEBS += $(BRCM_SAI) +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.0.3.7-2_amd64.deb?sv=2015-04-05&sr=b&sig=I11bX9%2Fo%2F2v1e0KGOnC9pN2MkDcQQZLUGtIJF8rE65w%3D&se=2030-09-21T00%3A28%3A19Z&sp=r" +SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 74d1d8ce145c..23e7881b456c 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.1.5-1_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-1_amd64.deb?sv=2015-04-05&sr=b&sig=9Mhm4cuju4P7TmVApXihECo1fHLbANWNWTKYLnHcrOk%3D&se=2030-09-18T19%3A19%3A46Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.1.5-2_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-2_amd64.deb?sv=2015-04-05&sr=b&sig=dWe5YgQv%2FG5VxC4YaKUQEDtDjIygowNhSHyN0Kv3e78%3D&se=2030-09-21T00%3A31%3A21Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-1_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-1_amd64.deb?sv=2015-04-05&sr=b&sig=iakUQ4CdHYbKc9ikiNNVrrLe0K8cMrez5vex7L%2BWD2o%3D&se=2030-09-18T19%3A20%3A14Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-2_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-2_amd64.deb?sv=2015-04-05&sr=b&sig=tupvWh%2FYdPn2%2FlCIfsUBjjbpGYSy5PHQvxHutQ4aMPc%3D&se=2030-09-21T00%3A31%3A47Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From ae4b72e866b5ebd968aaabe3e02f59f8ad0fba20 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Fri, 13 Jan 2017 04:02:19 +0200 Subject: [PATCH 0188/1833] [platform]: Add rules to build cavium platform modules (#186) * Added rules to build cavium platform modules * Use correct kernel version Signed-off-by: Nadiya.Stetskovych --- platform/cavium/cavm_platform_modules.mk | 4 +++ .../cavm_platform_modules/DEBIAN/changelog | 6 +++++ .../cavm_platform_modules/DEBIAN/control | 6 +++++ .../cavium/cavm_platform_modules/Makefile | 26 +++++++++++++++++++ platform/cavium/rules.mk | 1 + 5 files changed, 43 insertions(+) create mode 100644 platform/cavium/cavm_platform_modules.mk create mode 100644 platform/cavium/cavm_platform_modules/DEBIAN/changelog create mode 100755 platform/cavium/cavm_platform_modules/DEBIAN/control create mode 100644 platform/cavium/cavm_platform_modules/Makefile diff --git a/platform/cavium/cavm_platform_modules.mk b/platform/cavium/cavm_platform_modules.mk new file mode 100644 index 000000000000..8ed10a6b9289 --- /dev/null +++ b/platform/cavium/cavm_platform_modules.mk @@ -0,0 +1,4 @@ +CAVM_PLATFORM_DEB = cavm_platform_modules.deb +$(CAVM_PLATFORM_DEB)_SRC_PATH = $(PLATFORM_PATH)/cavm_platform_modules +SONIC_MAKE_DEBS += $(CAVM_PLATFORM_DEB) + diff --git a/platform/cavium/cavm_platform_modules/DEBIAN/changelog b/platform/cavium/cavm_platform_modules/DEBIAN/changelog new file mode 100644 index 000000000000..b138dba26289 --- /dev/null +++ b/platform/cavium/cavm_platform_modules/DEBIAN/changelog @@ -0,0 +1,6 @@ + +cavm-platform-modules (1.0) unstable; urgency=low + + * Initial release + +-- Nadiya.Stetskovych@cavium.com Thu, 12 Jan 2017 19:24:41 +0200 diff --git a/platform/cavium/cavm_platform_modules/DEBIAN/control b/platform/cavium/cavm_platform_modules/DEBIAN/control new file mode 100755 index 000000000000..75f8adc0cbd2 --- /dev/null +++ b/platform/cavium/cavm_platform_modules/DEBIAN/control @@ -0,0 +1,6 @@ +Package: cavm-platform-modules +Version: 1.0 +Architecture: amd64 +Depends: linux-image-3.16.0-4-amd64 +Maintainer: Nadiya.Stetskovych@cavium.com +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/cavium/cavm_platform_modules/Makefile b/platform/cavium/cavm_platform_modules/Makefile new file mode 100644 index 000000000000..5d2624acbebb --- /dev/null +++ b/platform/cavium/cavm_platform_modules/Makefile @@ -0,0 +1,26 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = cavm_platform_modules.deb +DEB_BUILD_DIR = cavm-platform-modules-deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # get sources + rm -rf SONiC + git clone https://github.com/edge-core/SONiC.git + + # build + pushd SONiC/AS7512-32X/module/ + + KERNEL_SRC=/lib/modules/$(KVERSION)/build make + popd + mkdir -p $(DEB_BUILD_DIR)/lib/modules/$(KVERSION) + + cp SONiC/AS7512-32X/module/*.ko $(DEB_BUILD_DIR)/lib/modules/$(KVERSION) + cp -r DEBIAN $(DEB_BUILD_DIR) + dpkg-deb -b $(DEB_BUILD_DIR) $(MAIN_TARGET) + + mv $(MAIN_TARGET) $(DEST)/ + rm -rf $(DEB_BUILD_DIR) + diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index efb9159c34d6..7ed8ea17e24b 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -3,6 +3,7 @@ include $(PLATFORM_GENERIC_PATH)/rules.mk include $(PLATFORM_PATH)/cavm-sai.mk include $(PLATFORM_PATH)/docker-syncd-cavm.mk include $(PLATFORM_PATH)/docker-orchagent-cavm.mk +include $(PLATFORM_PATH)/cavm_platform_modules.mk SONIC_ALL += $(DOCKER_SYNCD_CAVM) \ $(DOCKER_ORCHAGENT_CAVM) From 86f5c196434f4ad855ca90149a08a4ff265d8b2e Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Tue, 17 Jan 2017 11:12:43 -0800 Subject: [PATCH 0189/1833] [docker]: docker-ptf doesn't wait until eth3 is up This is done inside ptf agent now --- dockers/docker-ptf/Dockerfile.j2 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index db67c3261d36..85732eae35b0 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -79,5 +79,4 @@ COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf EXPOSE 22 -ENTRYPOINT while [ "x$( ifconfig eth3 | grep RUNNING )" = 'x' ] ; do sleep 1 ; done \ - && /usr/bin/supervisord +ENTRYPOINT ["/usr/bin/supervisord"] From e471c983234ce8207940fdda42cdc94e15512ce7 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 18 Jan 2017 10:53:58 -0800 Subject: [PATCH 0190/1833] [src]: Update sonic-sairedis/swss/common commit to latest (#193) --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 04ba52422ecc..e5d0aa91ea74 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 04ba52422ecc038b509c072cfcf4ac2baa06db84 +Subproject commit e5d0aa91ea74eccc7e63b321c43640658337a836 diff --git a/src/sonic-swss b/src/sonic-swss index 1bd4240f6641..e5683423edf1 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 1bd4240f6641223f70d215fb044fdf8ecf93da85 +Subproject commit e5683423edf1c6ec98502894a07bd8cf7cadcf7c diff --git a/src/sonic-swss-common b/src/sonic-swss-common index e06988dd2c44..31a6b40089ef 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit e06988dd2c44f6c5200f16c765a0e9a64a0ce274 +Subproject commit 31a6b40089efd42c895604b7d1d9fcc5b5c37040 From 3df2c474664f363160a7fabe9209a59135154342 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 18 Jan 2017 13:29:06 -0800 Subject: [PATCH 0191/1833] [src]: Update quagga to latest (#194) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index cf02de55bf00..77a98c2de5f8 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit cf02de55bf00a874fc1cc2aa53b65596294fe495 +Subproject commit 77a98c2de5f80421f1c671d82d3207154eca4ee9 From 6d4d54c9844da12c72026bf99e0db80ab24f473a Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 18 Jan 2017 17:11:29 -0800 Subject: [PATCH 0192/1833] [platform]: Update Broadcom debian packages (#195) Fix /proc/bcm/knet/link set wrong port status --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index c89382b5fff4..6e768856e772 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.0.3.7-2_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.0.3.7-2_amd64.deb?sv=2015-04-05&sr=b&sig=E9zdq7DpvZSpztO94eiNF4svl8T3wCywZxXRLpLnIpk%3D&se=2030-09-21T00%3A27%3A41Z&sp=r" +BRCM_SAI = libsaibcm_2.0.3.7-3-20170118215303.119_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.0.3.7-3-20170118215303.119_amd64.deb?sv=2015-04-05&sr=b&sig=lmAbkYBRtlEDUwFxAGK0bpGOZ3QIrgzrF3WD%2Ba2tvvY%3D&se=2030-09-27T22%3A51%3A39Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.0.3.7-2_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.0.3.7-3-20170118215303.119_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.0.3.7-2_amd64.deb?sv=2015-04-05&sr=b&sig=I11bX9%2Fo%2F2v1e0KGOnC9pN2MkDcQQZLUGtIJF8rE65w%3D&se=2030-09-21T00%3A28%3A19Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.0.3.7-3-20170118215303.119_amd64.deb?sv=2015-04-05&sr=b&sig=e8tPGsXcOfVtMpQdwZKNOpHplezroAkIfxASfK%2BJDR8%3D&se=2030-09-27T22%3A49%3A47Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 23e7881b456c..05c4b814d57c 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.1.5-2_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-2_amd64.deb?sv=2015-04-05&sr=b&sig=dWe5YgQv%2FG5VxC4YaKUQEDtDjIygowNhSHyN0Kv3e78%3D&se=2030-09-21T00%3A31%3A21Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.1.5-3-20170118205520.58_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-3-20170118205520.58_amd64.deb?sv=2015-04-05&sr=b&sig=R3hWzXrbe4IMSBImAUwK30iSSTIfEtXku6ZYWDX5WhI%3D&se=2030-09-27T22%3A45%3A59Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-2_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-2_amd64.deb?sv=2015-04-05&sr=b&sig=tupvWh%2FYdPn2%2FlCIfsUBjjbpGYSy5PHQvxHutQ4aMPc%3D&se=2030-09-21T00%3A31%3A47Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-3-20170118205520.58_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-3-20170118205520.58_amd64.deb?sv=2015-04-05&sr=b&sig=RArOfg5ll6uVbrD0a4VLADHvpJktcJsMSOGYwQ7RZnQ%3D&se=2030-09-27T22%3A49%3A11Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 80d0d2d43bc068dda6f559fe028b0909636c682d Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Thu, 19 Jan 2017 22:19:21 +0200 Subject: [PATCH 0193/1833] Reduce docker images size. (#196) * Reduce docker images size. Install only required dependencies. * Update Dockerfile.j2 --- dockers/docker-database/Dockerfile.j2 | 6 +++++- dockers/docker-fpm/Dockerfile.j2 | 6 +++++- dockers/docker-lldp-sv2/Dockerfile.j2 | 7 ++++++- dockers/docker-orchagent/Dockerfile.j2 | 6 +++++- dockers/docker-ptf/Dockerfile.j2 | 6 +++++- dockers/docker-snmp-sv2/Dockerfile.j2 | 7 ++++++- dockers/docker-teamd/Dockerfile.j2 | 6 +++++- platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 6 +++++- platform/cavium/docker-syncd-cavm/Dockerfile.j2 | 6 +++++- platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 6 +++++- platform/p4/docker-sonic-p4/Dockerfile.j2 | 6 +++++- 11 files changed, 57 insertions(+), 11 deletions(-) diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index cc8cd9bb206a..cca7cd535933 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -2,7 +2,11 @@ FROM docker-base RUN apt-get update -COPY debs/ debs +COPY \ +{% for deb in docker_database_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ ## Install redis-tools dependencies ## TODO: implicitly install dependencies diff --git a/dockers/docker-fpm/Dockerfile.j2 b/dockers/docker-fpm/Dockerfile.j2 index 3007d8e1e53c..ae638d078ac4 100644 --- a/dockers/docker-fpm/Dockerfile.j2 +++ b/dockers/docker-fpm/Dockerfile.j2 @@ -4,7 +4,11 @@ RUN apt-get update RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 -COPY debs/ debs +COPY \ +{% for deb in docker_fpm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ RUN dpkg -i \ {% for deb in docker_fpm_debs.split(' ') -%} diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 833e4673733e..9fdb3244e6bc 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -1,6 +1,11 @@ FROM docker-base -COPY debs /debs +COPY \ +{% for deb in docker_lldp_sv2_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + COPY python-wheels /python-wheels RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 8b82102993dc..cea7cb1a3a0e 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -8,7 +8,11 @@ RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansso ## TODO: implicitly install dependencies RUN apt-get -y install libjemalloc1 -COPY debs /debs +COPY \ +{% for deb in docker_orchagent_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ RUN dpkg -i \ {% for deb in docker_orchagent_debs.split(' ') -%} diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 85732eae35b0..ea86fd6c3cff 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -3,7 +3,11 @@ FROM debian:jessie MAINTAINER Pavel Shirshov ## Copy dependencies -COPY debs /debs +COPY \ +{% for deb in docker_ptf_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 9d8c068064c5..93436e5782fe 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -1,6 +1,11 @@ FROM docker-base -COPY debs /debs +COPY \ +{% for deb in docker_snmp_sv2_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + COPY python-wheels /python-wheels # enable -O for all Python calls diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 3cbb5007507d..ad0d4cdfe544 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -2,7 +2,11 @@ FROM docker-base RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 -COPY debs /debs +COPY \ +{% for deb in docker_teamd_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ RUN dpkg -i \ {% for deb in docker_teamd_debs.split(' ') -%} diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 89204c03d9be..0050cf9b1bf3 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -2,7 +2,11 @@ FROM docker-base RUN apt-get update -COPY debs /debs +COPY \ +{% for deb in docker_syncd_brcm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ RUN dpkg -i \ {% for deb in docker_syncd_brcm_debs.split(' ') -%} diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index 840399ac5953..9c66649420c0 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -2,7 +2,11 @@ FROM docker-base RUN apt-get update -COPY debs /debs +COPY \ +{% for deb in docker_syncd_cavm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev libjemalloc1 diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index b5a58b0a0577..d296ab4e8210 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -2,7 +2,11 @@ FROM docker-base RUN apt-get update -COPY debs /debs +COPY \ +{% for deb in docker_syncd_mlnx_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ RUN apt-get install -y libxml2 diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index 3cf775ea97f6..f285f8f0750f 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -4,7 +4,11 @@ RUN apt-get update RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 -COPY debs /debs +COPY \ +{% for deb in docker_sonic_p4_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ RUN dpkg -i \ {% for deb in docker_sonic_p4_debs.split(' ') -%} From 0d6b1e86a8a1cbc188bc81840c909f791d874ae8 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 19 Jan 2017 15:40:18 -0800 Subject: [PATCH 0194/1833] Change default password, so less confuse to sonic-mgmt playbook (#197) --- rules/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/config b/rules/config index 111772136429..d76477ce5adc 100644 --- a/rules/config +++ b/rules/config @@ -30,4 +30,4 @@ SONIC_CONFIG_LOG_TO_FILES = y USERNAME = admin # PASSWORD - password for installer build -PASSWORD = admin +PASSWORD = YourPaSsWoRd From 4fe1bdcf87119961685fdf42ab3d04f039ccf4a5 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 19 Jan 2017 20:56:26 -0800 Subject: [PATCH 0195/1833] sonic-cfggen with sonicv2 dockers (#190) Add a sonic-config-engine to help generate config file based on minigraph and other data on runtime. Modify fpm, teamd, lldp, snmp, and platform-monitor docker to use sonic-config-engine to generate config in docker upon load. --- dockers/docker-fpm/Dockerfile.j2 | 11 +- dockers/docker-fpm/bgpd.conf.j2 | 63 +++++++++ dockers/docker-fpm/config.sh | 14 ++ dockers/docker-fpm/isolate.j2 | 20 +++ dockers/docker-fpm/unisolate.j2 | 20 +++ dockers/docker-fpm/zebra.conf.j2 | 61 +++++++++ dockers/docker-lldp-sv2/Dockerfile.j2 | 10 +- dockers/docker-lldp-sv2/config.sh | 4 + dockers/docker-lldp-sv2/lldpd | 6 + dockers/docker-lldp-sv2/lldpd.conf.j2 | 3 + dockers/docker-platform-monitor/Dockerfile | 16 --- dockers/docker-platform-monitor/Dockerfile.j2 | 28 ++++ dockers/docker-platform-monitor/config.sh | 7 + dockers/docker-snmp-sv2/Dockerfile.j2 | 8 +- dockers/docker-snmp-sv2/config.sh | 13 ++ dockers/docker-snmp-sv2/snmpd | 11 ++ dockers/docker-snmp-sv2/snmpd.conf.j2 | 127 ++++++++++++++++++ dockers/docker-snmp-sv2/sysDescription.j2 | 1 + dockers/docker-teamd/Dockerfile.j2 | 10 +- dockers/docker-teamd/config.sh | 8 ++ dockers/docker-teamd/teamd.j2 | 19 +++ rules/docker-fpm.mk | 2 +- rules/docker-lldp-sv2.mk | 2 +- rules/docker-platform-monitor.mk | 3 +- rules/docker-snmp-sv2.mk | 2 +- rules/docker-teamd.mk | 2 +- rules/sonic-config.mk | 2 +- src/sonic-config-engine/MANIFEST.in | 1 + src/sonic-config-engine/minigraph.py | 36 +++-- .../platform/ACS-MSN2700/alias_map.json | 34 +++++ .../platform/ACS-MSN2700/port_config.ini | 33 +++++ .../platform/ACS-MSN2700/sensors.conf | 21 +++ .../platform/Force10-S6000/alias_map.json | 34 +++++ .../platform/Force10-S6000/port_config.ini | 33 +++++ .../platform/Force10-S6000/sensors.conf | 57 ++++++++ src/sonic-config-engine/setup.py | 17 ++- src/sonic-config-engine/sonic-cfggen | 55 +++++--- 37 files changed, 733 insertions(+), 61 deletions(-) create mode 100644 dockers/docker-fpm/bgpd.conf.j2 create mode 100755 dockers/docker-fpm/config.sh create mode 100755 dockers/docker-fpm/isolate.j2 create mode 100755 dockers/docker-fpm/unisolate.j2 create mode 100644 dockers/docker-fpm/zebra.conf.j2 create mode 100755 dockers/docker-lldp-sv2/config.sh create mode 100644 dockers/docker-lldp-sv2/lldpd create mode 100644 dockers/docker-lldp-sv2/lldpd.conf.j2 delete mode 100755 dockers/docker-platform-monitor/Dockerfile create mode 100755 dockers/docker-platform-monitor/Dockerfile.j2 create mode 100755 dockers/docker-platform-monitor/config.sh create mode 100755 dockers/docker-snmp-sv2/config.sh create mode 100644 dockers/docker-snmp-sv2/snmpd create mode 100644 dockers/docker-snmp-sv2/snmpd.conf.j2 create mode 100644 dockers/docker-snmp-sv2/sysDescription.j2 create mode 100755 dockers/docker-teamd/config.sh create mode 100644 dockers/docker-teamd/teamd.j2 create mode 100644 src/sonic-config-engine/MANIFEST.in create mode 100644 src/sonic-config-engine/platform/ACS-MSN2700/alias_map.json create mode 100644 src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini create mode 100644 src/sonic-config-engine/platform/ACS-MSN2700/sensors.conf create mode 100644 src/sonic-config-engine/platform/Force10-S6000/alias_map.json create mode 100644 src/sonic-config-engine/platform/Force10-S6000/port_config.ini create mode 100644 src/sonic-config-engine/platform/Force10-S6000/sensors.conf diff --git a/dockers/docker-fpm/Dockerfile.j2 b/dockers/docker-fpm/Dockerfile.j2 index ae638d078ac4..dfd3450743fc 100644 --- a/dockers/docker-fpm/Dockerfile.j2 +++ b/dockers/docker-fpm/Dockerfile.j2 @@ -2,7 +2,10 @@ FROM docker-base RUN apt-get update -RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 +RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 + +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml COPY \ {% for deb in docker_fpm_debs.split(' ') -%} @@ -19,7 +22,9 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -COPY ["start.sh", "/usr/bin/"] +COPY ["*.j2", "/etc/swss/bgp/"] +COPY ["start.sh", "config.sh", "/usr/bin/"] -ENTRYPOINT /usr/bin/start.sh \ +ENTRYPOINT /usr/bin/config.sh \ + && /usr/bin/start.sh \ && /bin/bash diff --git a/dockers/docker-fpm/bgpd.conf.j2 b/dockers/docker-fpm/bgpd.conf.j2 new file mode 100644 index 000000000000..25839864fbb7 --- /dev/null +++ b/dockers/docker-fpm/bgpd.conf.j2 @@ -0,0 +1,63 @@ +! +{% block banner %} +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/bgpd.conf.j2 using minigraph_facts.py +! file: bgpd.conf +! +{% endblock banner %} +! +{% block system_init %} +hostname {{ inventory_hostname }} +password zebra +log syslog informational +log facility local4 +! enable password {# {{ en_passwd }} TODO: param needed #} +{% endblock system_init %} +! +{% block bgp_init %} +! +! bgp multiple-instance +! +router bgp {{ minigraph_bgp_asn }} + bgp log-neighbor-changes + bgp bestpath as-path multipath-relax +{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} + bgp router-id {{ minigraph_lo_interfaces[0]['addr'] }} +{# advertise loopback #} +{% for lo in minigraph_lo_interfaces %} +{% if lo['addr'] | ipv4 %} + network {{ lo['addr'] }}/32 +{% elif lo['addr'] | ipv6 %} + address-family ipv6 + network {{ lo['addr'] }}/128 + exit-address-family +{% endif %} +{% endfor %} +{% endblock bgp_init %} +{% block vlan_advertisement %} +{% for interface in minigraph_interfaces %} +{% if interface['name'].startswith('Vlan') %} + network {{ interface['subnet'] }} +{% endif %} +{% endfor %} +{% endblock vlan_advertisement %} +{% block bgp_sessions %} +{% for bgp_session in minigraph_bgp %} +{% if bgp_session['asn'] != 0 %} + neighbor {{ bgp_session['addr'] }} remote-as {{ bgp_session['asn'] }} + neighbor {{ bgp_session['addr'] }} description {{ bgp_session['name'] }} +{% if bgp_session['addr'] | ipv6 %} + address-family ipv6 + neighbor {{ bgp_session['addr'] }} activate + maximum-paths 64 + exit-address-family +{% endif %} +{% endif %} +{% endfor %} +{% endblock bgp_sessions %} +! +maximum-paths 64 +! +route-map ISOLATE permit 10 +set as-path prepend {{ minigraph_bgp_asn }} +! diff --git a/dockers/docker-fpm/config.sh b/dockers/docker-fpm/config.sh new file mode 100755 index 000000000000..647d9d34ba70 --- /dev/null +++ b/dockers/docker-fpm/config.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +mkdir -p /etc/quagga +sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/bgp/bgpd.conf.j2 >/etc/quagga/bgpd.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/bgp/zebra.conf.j2 >/etc/quagga/zebra.conf + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/bgp/isolate.j2 >/usr/sbin/bgp-isolate +chown root:root /usr/sbin/bgp-isolate +chmod 0755 /usr/sbin/bgp-isolate + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/bgp/unisolate.j2 >/usr/sbin/bgp-unisolate +chown root:root /usr/sbin/bgp-unisolate +chmod 0755 /usr/sbin/bgp-unisolate + diff --git a/dockers/docker-fpm/isolate.j2 b/dockers/docker-fpm/isolate.j2 new file mode 100755 index 000000000000..35ef5bbc0209 --- /dev/null +++ b/dockers/docker-fpm/isolate.j2 @@ -0,0 +1,20 @@ +#!/bin/bash +## vtysh only accepts script in stdin, so cannot be directly used in shebang +## Cut the tail of this script and feed vtysh stdin +sed -n -e '9,$p' < "$0" | vtysh "$@" +## Exit with vtysh return code +exit $? + +## vtysh script start from next line, which line number MUST eqaul in 'sed' command above + +configure terminal + router bgp {{ minigraph_bgp_asn }} +{% for bgp_session in minigraph_bgp %} + neighbor {{ bgp_session['addr'] }} route-map ISOLATE out +{% endfor %} + exit +exit + +{% for bgp_session in minigraph_bgp %} +clear ip bgp {{ bgp_session['addr'] }} soft out +{% endfor %} diff --git a/dockers/docker-fpm/unisolate.j2 b/dockers/docker-fpm/unisolate.j2 new file mode 100755 index 000000000000..c113a74fab45 --- /dev/null +++ b/dockers/docker-fpm/unisolate.j2 @@ -0,0 +1,20 @@ +#!/bin/bash +## vtysh only accepts script in stdin, so cannot be directly used in shebang +## Cut the tail of this script and feed vtysh stdin +sed -n -e '9,$p' < "$0" | vtysh "$@" +## Exit with vtysh return code +exit $? + +## vtysh script start from next line, which line number MUST eqaul in 'sed' command above + +configure terminal + router bgp {{ minigraph_bgp_asn }} +{% for bgp_session in minigraph_bgp %} + no neighbor {{ bgp_session['addr'] }} route-map ISOLATE out +{% endfor %} + exit +exit + +{% for bgp_session in minigraph_bgp %} +clear ip bgp {{ bgp_session['addr'] }} soft out +{% endfor %} diff --git a/dockers/docker-fpm/zebra.conf.j2 b/dockers/docker-fpm/zebra.conf.j2 new file mode 100644 index 000000000000..ad05dcbe4e90 --- /dev/null +++ b/dockers/docker-fpm/zebra.conf.j2 @@ -0,0 +1,61 @@ +! +{% block banner %} +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/zebra.conf.j2 using minigraph_facts.py +! file: zebra.conf +! +{% endblock banner %} +! +{% block sys_init %} +hostname {{ inventory_hostname }} +password zebra +enable password zebra +{% endblock sys_init %} +! +{% block interfaces %} +! Enable link-detect (default disabled) +{% for interface in minigraph_interfaces %} +interface {{ interface['alias'] }} +link-detect +! +{% endfor %} +{% endblock interfaces %} +! +{% block default_route %} +! set static default route to mgmt gateway as a backup to learned default +ip route 0.0.0.0/0 {{ minigraph_mgmt_interface['gwaddr'] }} 200 +{% endblock default_route %} +! +{% block source_loopback %} +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src {{ minigraph_lo_interfaces[0]['addr'] }} +! +{% set lo_ipv6_addrs = [] %} +{% if minigraph_lo_interfaces is defined %} +{% for interface in minigraph_lo_interfaces %} +{% if interface['addr'] is defined and interface['addr']|ipv6 %} +{% if lo_ipv6_addrs.append(interface['addr']) %} +{% endif %} +{% endif %} +{% endfor %} +{% endif %} +{% if lo_ipv6_addrs|length > 0 %} +route-map RM_SET_SRC6 permit 10 + set src {{ lo_ipv6_addrs[0] }} +! +{% endif %} +ip protocol bgp route-map RM_SET_SRC +! +{% if lo_ipv6_addrs|length > 0 %} +ipv6 protocol bgp route-map RM_SET_SRC6 +! +{% endif %} +{% endblock source_loopback %} +! +{% block logging %} +log syslog informational +log facility local4 +{% endblock logging %} +! + diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 9fdb3244e6bc..399d2ca6e732 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -8,7 +8,10 @@ debs/ COPY python-wheels /python-wheels -RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 +RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 + +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml ## Pre-install the fundamental packages ## Install Python SSWSDK @@ -27,5 +30,8 @@ RUN pip install /python-wheels/sswsdk-2.0.1-py2-none-any.whl && \ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY reconfigure.sh /opt/reconfigure.sh +COPY ["config.sh", "/usr/bin/"] +COPY ["lldpd.conf.j2", "/etc/swss/lldp/"] +COPY ["lldpd", "/etc/default/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT /usr/bin/config.sh && /usr/bin/supervisord diff --git a/dockers/docker-lldp-sv2/config.sh b/dockers/docker-lldp-sv2/config.sh new file mode 100755 index 000000000000..d6ded04bc394 --- /dev/null +++ b/dockers/docker-lldp-sv2/config.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/lldp/lldpd.conf.j2 >/etc/lldpd.conf + diff --git a/dockers/docker-lldp-sv2/lldpd b/dockers/docker-lldp-sv2/lldpd new file mode 100644 index 000000000000..ba22e49b9b47 --- /dev/null +++ b/dockers/docker-lldp-sv2/lldpd @@ -0,0 +1,6 @@ +############################################################################### +# Managed by sonic-cfggen +############################################################################### + +# Uncomment to start SNMP subagent and enable CDP, SONMP and EDP protocol +DAEMON_ARGS="" diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 new file mode 100644 index 000000000000..d6be1e3ce0f2 --- /dev/null +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -0,0 +1,3 @@ +{% for member in alias_map %} +configure ports {{member['sonic']}} lldp portidsubtype local {{member['origin']}} +{% endfor %} diff --git a/dockers/docker-platform-monitor/Dockerfile b/dockers/docker-platform-monitor/Dockerfile deleted file mode 100755 index 9bd3d79d9a70..000000000000 --- a/dockers/docker-platform-monitor/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM docker-base - -## Pre-install the fundamental packages -## Clean up -RUN apt-get update && \ - apt-get -y install \ - smartmontools \ - sensord \ - && \ - apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y - -ENTRYPOINT service rsyslog start \ - && service lm-sensors start \ - && service smartmontools start \ - && service sensord start \ - && /bin/bash diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 new file mode 100755 index 000000000000..83463acf480f --- /dev/null +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -0,0 +1,28 @@ +FROM docker-base + +RUN apt-get update + +RUN apt-get install -y smartmontools sensord + +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + +COPY debs/ debs + +RUN dpkg -i \ +{% for deb in docker_fpm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +COPY ["config.sh", "/usr/bin/"] + +ENTRYPOINT /usr/bin/config.sh \ + && service rsyslog start \ + && service lm-sensors start \ + && service smartmontools start \ + && service sensord start \ + && /bin/bash diff --git a/dockers/docker-platform-monitor/config.sh b/dockers/docker-platform-monitor/config.sh new file mode 100755 index 000000000000..4267bc547934 --- /dev/null +++ b/dockers/docker-platform-monitor/config.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +mkdir -p /etc/sensors.d + +hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` +/bin/cp -rf /usr/share/sonic/$hwsku/sensors.conf /etc/sensors.d/ + diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 93436e5782fe..8e3a019b74c9 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -17,6 +17,9 @@ ENV PYTHONOPTIMIZE 1 ## Clean up RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + RUN dpkg -i \ {% for deb in docker_snmp_sv2_debs.split(' ') -%} debs/{{ deb }}{{' '}} @@ -44,8 +47,11 @@ RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ rm -rf ~/.cache COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY ["*.j2", "/etc/swss/snmp/"] +COPY ["snmpd", "/etc/default/"] +COPY ["config.sh", "/usr/bin/"] ## Although exposing ports is not need for host net mode, keep it for possible bridge mode EXPOSE 161/udp 162/udp -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT /usr/bin/config.sh && /usr/bin/supervisord diff --git a/dockers/docker-snmp-sv2/config.sh b/dockers/docker-snmp-sv2/config.sh new file mode 100755 index 000000000000..880aef593045 --- /dev/null +++ b/dockers/docker-snmp-sv2/config.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +#sysDescription is currently mounted, uncomment this line and provide version.yml instead if use copying instead of mounting +#sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/version.yml -t /etc/swss/snmp/sysDescription.j2 >/etc/ssw/sysDescription + +mkdir -p /etc/snmp + +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /etc/swss/snmp/snmpd.conf.j2 >/etc/snmp/snmpd.conf + +hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` +/bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/ + + diff --git a/dockers/docker-snmp-sv2/snmpd b/dockers/docker-snmp-sv2/snmpd new file mode 100644 index 000000000000..4b35c6cc936a --- /dev/null +++ b/dockers/docker-snmp-sv2/snmpd @@ -0,0 +1,11 @@ +# This file controls the activity of snmpd + +# Don't load any MIBs by default. +# You might comment this lines once you have the MIBs downloaded. +export MIBS= + +# snmpd control (yes means start daemon). +SNMPDRUN=yes + +# snmpd options (use syslog, close stdin/out/err). +SNMPDOPTS='-LS4d -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable -p /run/snmpd.pid' diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 new file mode 100644 index 000000000000..1f1691f987b5 --- /dev/null +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -0,0 +1,127 @@ +############################################################################### +# Managed by Ansible +# file: ansible/roles/acs/templates/snmpd.conf.j2 +############################################################################### +# +# EXAMPLE.conf: +# An example configuration file for configuring the Net-SNMP agent ('snmpd') +# See the 'snmpd.conf(5)' man page for details +# +# Some entries are deliberately commented out, and will need to be explicitly activated +# +############################################################################### +# +# AGENT BEHAVIOUR +# + +# Listen for connections on localhost, loopback ip and mgmt (eth0) ip +agentAddress udp:127.0.0.1:161 +agentAddress udp:{{ minigraph_mgmt_interface.addr }}:161 +{% for minigraph_lo_interface in minigraph_lo_interfaces %} +# TODO: only support ipv4 lo addresses, add ipv6 support later +{% if minigraph_lo_interface.addr | ipv4 %} +agentAddress udp:{{ minigraph_lo_interface.addr }}:161 +{% endif %} +{% endfor %} +############################################################################### +# +# ACCESS CONTROL +# + + # system + hrSystem groups only +view systemonly included .1.3.6.1.2.1.1 +view systemonly included .1.3.6.1.2.1.25.1 + + # Default access to basic system info +rocommunity {{ snmp_rocommunity }} + + +############################################################################### +# +# SYSTEM INFORMATION +# + +# Note that setting these values here, results in the corresponding MIB objects being 'read-only' +# See snmpd.conf(5) for more details +sysLocation {{ snmp_location }} +sysContact Azure Cloud Switch vteam + # Application + End-to-End layers +sysServices 72 + + +# +# Process Monitoring +# +# todo: should we enable snmp based monitoring of sswsyncd and other processes? + +# At least one 'sendmail' process, but no more than 10 +#proc sendmail 10 1 + +# Walk the UCD-SNMP-MIB::prTable to see the resulting output +# Note that this table will be empty if there are no "proc" entries in the snmpd.conf file + + +# +# Disk Monitoring +# + # 10MBs required on root disk, 5% free on /var, 10% free on all other disks +disk / 10000 +disk /var 5% +includeAllDisks 10% + +# Walk the UCD-SNMP-MIB::dskTable to see the resulting output +# Note that this table will be empty if there are no "disk" entries in the snmpd.conf file + + +# +# System Load +# + # Unacceptable 1-, 5-, and 15-minute load averages +load 12 10 5 + +# Walk the UCD-SNMP-MIB::laTable to see the resulting output +# Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file + + + +############################################################################### +# +# ACTIVE MONITORING +# +# Note: disabled snmp traps due to side effect of causing snmpd to listen on all ports (0.0.0.0) +# +# send SNMPv1 traps +#trapsink localhost public +# send SNMPv2c traps +#trap2sink localhost public +# send SNMPv2c INFORMs +#informsink localhost public + +# Note that you typically only want *one* of these three lines +# Uncommenting two (or all three) will result in multiple copies of each notification. + + +# +# Event MIB - automatically generate alerts +# +# Remember to activate the 'createUser' lines above +#iquerySecName internalUser +#rouser internalUser +# generate traps on UCD error conditions +#defaultMonitors yes +#note, this release of snmpd does not support linkUpDownNotifications +# generate traps on linkUp/Down +#linkUpDownNotifications yes + + +# +# AgentX Sub-agents +# + # Run as an AgentX master agent +master agentx + +# +# SysDescription pass-through +# + +pass -p 10 .1.3.6.1.2.1.1.1 /usr/share/snmp/sysDescr_pass.py diff --git a/dockers/docker-snmp-sv2/sysDescription.j2 b/dockers/docker-snmp-sv2/sysDescription.j2 new file mode 100644 index 000000000000..a4871a6ffd44 --- /dev/null +++ b/dockers/docker-snmp-sv2/sysDescription.j2 @@ -0,0 +1 @@ +SONiC Software Version: {{ sonic_baseimage_version}}.SONiC.{{ sonic_version }} - HwSku: {{ minigraph_hwsku }} diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index ad0d4cdfe544..e663b9d7d1f7 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -2,6 +2,10 @@ FROM docker-base RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 + +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + COPY \ {% for deb in docker_teamd_debs.split(' ') -%} debs/{{ deb }}{{' '}} @@ -13,10 +17,10 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY start.sh /usr/bin/start.sh +COPY ["start.sh", "config.sh", "/usr/bin/"] +COPY ["teamd.j2", "/etc/swss/teamd/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] +ENTRYPOINT /usr/bin/config.sh && /usr/bin/start.sh diff --git a/dockers/docker-teamd/config.sh b/dockers/docker-teamd/config.sh new file mode 100755 index 000000000000..482cde53bdf2 --- /dev/null +++ b/dockers/docker-teamd/config.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +mkdir -p /etc/teamd + +for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml --var-keys minigraph_portchannel_interfaces`; do + sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /etc/swss/teamd/teamd.j2 >/etc/teamd/$pc.conf +done + diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 new file mode 100644 index 000000000000..7c6e4b355e0b --- /dev/null +++ b/dockers/docker-teamd/teamd.j2 @@ -0,0 +1,19 @@ +{ + "device": "{{ pc }}", + "runner": { + "name": "lacp", + "active": true, + "min_ports": 2, + "tx_hash": ["eth", "ipv4", "ipv6"] + }, + "link_watch": { + "name": "ethtool" + }, + "ports": { + {% for member in minigraph_portchannel_interfaces[pc] %} +"{{member}}": {}{% if not loop.last %},{% endif %} + + {% endfor %} + } +} + diff --git a/rules/docker-fpm.mk b/rules/docker-fpm.mk index d9fa51f0eeca..48d35592d402 100644 --- a/rules/docker-fpm.mk +++ b/rules/docker-fpm.mk @@ -2,6 +2,6 @@ DOCKER_FPM = docker-fpm.gz $(DOCKER_FPM)_PATH = $(DOCKERS_PATH)/docker-fpm -$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS) +$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS) $(SONIC_CONFIG_ENGINE) $(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_FPM) diff --git a/rules/docker-lldp-sv2.mk b/rules/docker-lldp-sv2.mk index 17347fa79ed7..b2efe81e8b70 100644 --- a/rules/docker-lldp-sv2.mk +++ b/rules/docker-lldp-sv2.mk @@ -2,7 +2,7 @@ DOCKER_LLDP_SV2 = docker-lldp-sv2.gz $(DOCKER_LLDP_SV2)_PATH = $(DOCKERS_PATH)/docker-lldp-sv2 -$(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) +$(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) $(SONIC_CONFIG_ENGINE) $(DOCKER_LLDP_SV2)_PYTHON_WHEELS += $(DBSYNCD_PY2) $(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 1a48e4c2234a..51997cc41516 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -2,6 +2,7 @@ DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor +$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(SONIC_CONFIG_ENGINE) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_BASE) -SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) +SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk index 038c3fb7f002..619e48f5591d 100644 --- a/rules/docker-snmp-sv2.mk +++ b/rules/docker-snmp-sv2.mk @@ -2,7 +2,7 @@ DOCKER_SNMP_SV2 = docker-snmp-sv2.gz $(DOCKER_SNMP_SV2)_PATH = $(DOCKERS_PATH)/docker-snmp-sv2 -$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) +$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) $(SONIC_CONFIG_ENGINE) $(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(ASYNCSNMP_PY3) $(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index 0760f27902ae..4924b2b18891 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -2,6 +2,6 @@ DOCKER_TEAMD = docker-teamd.gz $(DOCKER_TEAMD)_PATH = $(DOCKERS_PATH)/docker-teamd -$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) +$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_CONFIG_ENGINE) $(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) diff --git a/rules/sonic-config.mk b/rules/sonic-config.mk index ba2fdacc2c50..e0f6504bf994 100644 --- a/rules/sonic-config.mk +++ b/rules/sonic-config.mk @@ -1,5 +1,5 @@ # sonic-config-engine package -SONIC_CONFIG_ENGINE = sonic-config-engine_1.0-1_all.deb +SONIC_CONFIG_ENGINE = python-sonic-config-engine_1.0-1_all.deb $(SONIC_CONFIG_ENGINE)_SRC_PATH = $(SRC_PATH)/sonic-config-engine SONIC_PYTHON_STDEB_DEBS += $(SONIC_CONFIG_ENGINE) diff --git a/src/sonic-config-engine/MANIFEST.in b/src/sonic-config-engine/MANIFEST.in new file mode 100644 index 000000000000..a98b68c2a5bb --- /dev/null +++ b/src/sonic-config-engine/MANIFEST.in @@ -0,0 +1 @@ +recursive-include platform *.json *.ini *.conf diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 2bc7bf43cdfa..8560b850c179 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -169,12 +169,12 @@ def parse_dpg(dpg, hname): intfs.append(intf) pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) - pc_intfs = [] + pc_intfs = {} for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): pcintfname = pcintf.find(str(QName(ns, "Name"))).text pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text pcmbr_list = pcintfmbr.split(';', 1) - pc_intfs.append({'name': pcintfname, 'members': pcmbr_list}) + pc_intfs[pcintfname]=pcmbr_list lointfs = child.find(str(QName(ns, "LoopbackIPInterfaces"))) lo_intfs = [] @@ -209,7 +209,7 @@ def parse_dpg(dpg, hname): vintfname = vintf.find(str(QName(ns, "Name"))).text vlanid = vintf.find(str(QName(ns, "VlanID"))).text vintfmbr = vintf.find(str(QName(ns, "AttachTo"))).text - vmbr_list = vintfmbr.split(';')) + vmbr_list = vintfmbr.split(';') vlan_attributes = {'name': vintfname, 'members': vmbr_list, 'vlanid': vlanid} for addrtuple in vlan_map.get(vintfname, []): vlan_attributes.update(addrtuple) @@ -285,6 +285,17 @@ def get_mgmt_info(devices, dev, port): return ret_val +def get_alias_map_list(hwsku): + alias_map_json = os.path.join('/usr/share/sonic', hwsku, 'alias_map.json') + if not os.path.isfile(alias_map_json): + return None + with open(alias_map_json) as data: + alias_map_dict = json.load(data) + alias_map_list = [] + for k,v in alias_map_dict.items(): + alias_map_list.append({'sonic': k, 'origin': v}) + return alias_map_list + def parse_xml(filename): root = ET.parse(filename).getroot() mini_graph_path = filename @@ -312,14 +323,10 @@ def parse_xml(filename): hostname = child.text # port_alias_map maps ngs port name to sonic port name - if hwsku == "Force10-S6000": - for i in range(0, 128, 4): - port_alias_map["fortyGigE0/%d" % i] = "Ethernet%d" % i - elif hwsku == "Arista-7050-QX32": - for i in range(1, 25): - port_alias_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 1) * 4) - for i in range(25, 33): - port_alias_map["Ethernet%d" % i] = "Ethernet%d" % ((i - 1) * 4) + alias_map_list = get_alias_map_list(hwsku) + if alias_map_list != None: + for item in alias_map_list: + port_alias_map[item['origin']] = item['sonic'] for child in root: if child.tag == str(QName(ns, "DpgDec")): @@ -340,9 +347,9 @@ def parse_xml(filename): vlan['members'] = " ".join(vlan['members']) # Replace port with alias in port channel interfaces members - for pc in pc_intfs: - for i,member in enumerate(pc['members']): - pc['members'][i] = port_alias_map[member] + for pc in pc_intfs.keys(): + for i,member in enumerate(pc_intfs[pc]): + pc_intfs[pc][i] = port_alias_map[member] Tree = lambda: defaultdict(Tree) @@ -367,6 +374,7 @@ def parse_xml(filename): results['minigraph_console'] = get_console_info(devices, console_dev, console_port) results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port) results['inventory_hostname'] = hostname + results['alias_map'] = alias_map_list return results diff --git a/src/sonic-config-engine/platform/ACS-MSN2700/alias_map.json b/src/sonic-config-engine/platform/ACS-MSN2700/alias_map.json new file mode 100644 index 000000000000..dd1324ae4360 --- /dev/null +++ b/src/sonic-config-engine/platform/ACS-MSN2700/alias_map.json @@ -0,0 +1,34 @@ +{ + "Ethernet8": "Ethernet8", + "Ethernet0": "Ethernet0", + "Ethernet4": "Ethernet4", + "Ethernet108": "Ethernet108", + "Ethernet100": "Ethernet100", + "Ethernet104": "Ethernet104", + "Ethernet96": "Ethernet96", + "Ethernet124": "Ethernet124", + "Ethernet120": "Ethernet120", + "Ethernet92": "Ethernet92", + "Ethernet28": "Ethernet28", + "Ethernet52": "Ethernet52", + "Ethernet56": "Ethernet56", + "Ethernet76": "Ethernet76", + "Ethernet72": "Ethernet72", + "Ethernet32": "Ethernet32", + "Ethernet16": "Ethernet16", + "Ethernet36": "Ethernet36", + "Ethernet12": "Ethernet12", + "Ethernet88": "Ethernet88", + "Ethernet24": "Ethernet24", + "Ethernet116": "Ethernet116", + "Ethernet80": "Ethernet80", + "Ethernet112": "Ethernet112", + "Ethernet84": "Ethernet84", + "Ethernet48": "Ethernet48", + "Ethernet44": "Ethernet44", + "Ethernet40": "Ethernet40", + "Ethernet64": "Ethernet64", + "Ethernet60": "Ethernet60", + "Ethernet20": "Ethernet20", + "Ethernet68": "Ethernet68" +} \ No newline at end of file diff --git a/src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini b/src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini new file mode 100644 index 000000000000..ae703f020de6 --- /dev/null +++ b/src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini @@ -0,0 +1,33 @@ +# alias lanes +Ethernet0 0,1,2,3 +Ethernet4 4,5,6,7 +Ethernet8 8,9,10,11 +Ethernet12 12,13,14,15 +Ethernet16 16,17,18,19 +Ethernet20 20,21,22,23 +Ethernet24 24,25,26,27 +Ethernet28 28,29,30,31 +Ethernet32 32,33,34,35 +Ethernet36 36,37,38,39 +Ethernet40 40,41,42,43 +Ethernet44 44,45,46,47 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 64,65,66,67 +Ethernet68 68,69,70,71 +Ethernet72 72,73,74,75 +Ethernet76 76,77,78,79 +Ethernet80 80,81,82,83 +Ethernet84 84,85,86,87 +Ethernet88 88,89,90,91 +Ethernet92 92,93,94,95 +Ethernet96 96,97,98,99 +Ethernet100 100,101,102,103 +Ethernet104 104,105,106,107 +Ethernet108 108,109,110,111 +Ethernet112 112,113,114,115 +Ethernet116 116,117,118,119 +Ethernet120 120,121,122,123 +Ethernet124 124,125,126,127 diff --git a/src/sonic-config-engine/platform/ACS-MSN2700/sensors.conf b/src/sonic-config-engine/platform/ACS-MSN2700/sensors.conf new file mode 100644 index 000000000000..a3e30391863e --- /dev/null +++ b/src/sonic-config-engine/platform/ACS-MSN2700/sensors.conf @@ -0,0 +1,21 @@ +bus "i2c-7" "i2c-1-mux (chan_id 5)" +chip "lm75-i2c-7-4a" + label temp1 "Ambient Port Temp" + +bus "i2c-5" "i2c-1-mux (chan_id 3)" +chip "ucd9200-i2c-5-27" + label in1 "UCD1 vin" + label in2 "ASIC 3.3 vout" + label in3 "ASIC 1.2 vout" + label temp1 "UCD1 Temp" + label temp2 "UCD1 Temp2" + +chip "ucd9200-i2c-5-41" + label in1 "UCD2 vin" + label in2 "ASIC Vcore vout" + label temp1 "UCD2 Temp1" + label temp2 "UCD2 Temp2" + +bus "i2c-17" "i2c-1-mux (chan_id 7)" +chip "lm75-i2c-17-49" + label temp1 "Ambient Board Temp" diff --git a/src/sonic-config-engine/platform/Force10-S6000/alias_map.json b/src/sonic-config-engine/platform/Force10-S6000/alias_map.json new file mode 100644 index 000000000000..b58d147f70c3 --- /dev/null +++ b/src/sonic-config-engine/platform/Force10-S6000/alias_map.json @@ -0,0 +1,34 @@ +{ + "Ethernet8": "fortyGigE0/8", + "Ethernet0": "fortyGigE0/0", + "Ethernet4": "fortyGigE0/4", + "Ethernet108": "fortyGigE0/108", + "Ethernet100": "fortyGigE0/100", + "Ethernet104": "fortyGigE0/104", + "Ethernet96": "fortyGigE0/96", + "Ethernet124": "fortyGigE0/124", + "Ethernet120": "fortyGigE0/120", + "Ethernet92": "fortyGigE0/92", + "Ethernet28": "fortyGigE0/28", + "Ethernet52": "fortyGigE0/52", + "Ethernet56": "fortyGigE0/56", + "Ethernet76": "fortyGigE0/76", + "Ethernet72": "fortyGigE0/72", + "Ethernet32": "fortyGigE0/32", + "Ethernet16": "fortyGigE0/16", + "Ethernet36": "fortyGigE0/36", + "Ethernet12": "fortyGigE0/12", + "Ethernet88": "fortyGigE0/88", + "Ethernet24": "fortyGigE0/24", + "Ethernet116": "fortyGigE0/116", + "Ethernet80": "fortyGigE0/80", + "Ethernet112": "fortyGigE0/112", + "Ethernet84": "fortyGigE0/84", + "Ethernet48": "fortyGigE0/48", + "Ethernet44": "fortyGigE0/44", + "Ethernet40": "fortyGigE0/40", + "Ethernet64": "fortyGigE0/64", + "Ethernet60": "fortyGigE0/60", + "Ethernet20": "fortyGigE0/20", + "Ethernet68": "fortyGigE0/68" +} \ No newline at end of file diff --git a/src/sonic-config-engine/platform/Force10-S6000/port_config.ini b/src/sonic-config-engine/platform/Force10-S6000/port_config.ini new file mode 100644 index 000000000000..7161416e4d4c --- /dev/null +++ b/src/sonic-config-engine/platform/Force10-S6000/port_config.ini @@ -0,0 +1,33 @@ +# alias lanes +Ethernet0 29,30,31,32 +Ethernet4 25,26,27,28 +Ethernet8 37,38,39,40 +Ethernet12 33,34,35,36 +Ethernet16 41,42,43,44 +Ethernet20 45,46,47,48 +Ethernet24 5,6,7,8 +Ethernet28 1,2,3,4 +Ethernet32 9,10,11,12 +Ethernet36 13,14,15,16 +Ethernet40 21,22,23,24 +Ethernet44 17,18,19,20 +Ethernet48 49,50,51,52 +Ethernet52 53,54,55,56 +Ethernet56 61,62,63,64 +Ethernet60 57,58,59,60 +Ethernet64 65,66,67,68 +Ethernet68 69,70,71,72 +Ethernet72 77,78,79,80 +Ethernet76 73,74,75,76 +Ethernet80 105,106,107,108 +Ethernet84 109,110,111,112 +Ethernet88 117,118,119,120 +Ethernet92 113,114,115,116 +Ethernet96 121,122,123,124 +Ethernet100 125,126,127,128 +Ethernet104 85,86,87,88 +Ethernet108 81,82,83,84 +Ethernet112 89,90,91,92 +Ethernet116 93,94,95,96 +Ethernet120 97,98,99,100 +Ethernet124 101,102,103,104 diff --git a/src/sonic-config-engine/platform/Force10-S6000/sensors.conf b/src/sonic-config-engine/platform/Force10-S6000/sensors.conf new file mode 100644 index 000000000000..2208bb6340d1 --- /dev/null +++ b/src/sonic-config-engine/platform/Force10-S6000/sensors.conf @@ -0,0 +1,57 @@ +# libsensors configuration file +# -------------------------------------------------- +# + +# tmp75-i2c-11-4c has sensors close to Networking ASIC. +# tmp75-i2c-11-4d has sensors close to NIC. +# tmp75-i2c-11-4e is an ambient temperature sensor. + +chip "tmp75-*" + set temp1_max 50 + set temp1_max_hyst 25 + +# emc1403-i2c-10-4d has following temperature sensors: +# temp1: CPU0 external Temp Sensor +# temp2: CPU1 external Temp Sensor +# temp3: CPU Internal DTS (Internal die, max of all die readings) + +chip "emc1403-*" + set temp1_crit 85 + set temp1_max 50 + set temp2_crit 85 + set temp2_max 50 + set temp3_crit 85 + set temp3_max 50 + +chip "max6620-i2c-*-2a" + ignore fan3 + ignore fan4 + +chip "w83627dhg-*" + label in0 "VCore 1" + label in1 "VCore 2" + set in0_min 0 + set in0_max 1.74 + set in1_min 0 + set in1_max 1.74 + ignore fan1 + ignore fan2 + ignore fan3 + ignore fan4 + ignore fan5 + ignore in4 + ignore in5 + ignore in6 + ignore temp1 + ignore temp2 + ignore temp3 + ignore cpu0_vid + ignore intrusion0 + +chip "jc42-*" + set temp1_max 50 + set temp1_crit 85 + +chip "dni_dps460-*" + set temp1_max 50 + set temp2_max 50 diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 3223735b971a..af2f6f414d79 100644 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -1,6 +1,20 @@ #!/usr/bin/env python from setuptools import setup +import os.path + +def get_platform_file_list(): + data_files = [] + repo_path = os.path.abspath(os.path.dirname(__file__)) + data_path = os.path.join(repo_path, 'platform') + platforms = os.listdir(data_path) + for platform in platforms: + data_files.append( (os.path.join('/usr/share/sonic', platform), + ['platform/' + platform + '/alias_map.json', + 'platform/' + platform + '/port_config.ini', + 'platform/' + platform + '/sensors.conf'] + )) + return data_files setup(name='sonic-config-engine', version='1.0', @@ -10,5 +24,6 @@ url='https://github.com/Azure/sonic-buildimage', py_modules=['minigraph'], scripts=['sonic-cfggen'], - install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'yaml'], + data_files=get_platform_file_list(), + install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml'], ) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index e20b15977d18..01774885b578 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -6,6 +6,7 @@ import argparse import yaml import jinja2 import netaddr +import json from minigraph import parse_xml @@ -36,27 +37,51 @@ def is_ipv6(value): def main(): parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") - parser.add_argument("template") - parser.add_argument("-m", "--minigraph", required=True, help="minigraph xml file") - parser.add_argument("-v", "--var-file", help="yaml file that contains addtional variables") + parser.add_argument("-m", "--minigraph", help="minigraph xml file") + parser.add_argument("-y", "--yaml", help="yaml file that contains addtional variables") + parser.add_argument("-a", "--additional-data", help="addition data, in json string") + group = parser.add_mutually_exclusive_group() + group.add_argument("-t", "--template", help="render the data with the template file") + group.add_argument("-v", "--var", help="print the value of a variable") + group.add_argument("--var-json", help="print the value of a variable, in json format") + group.add_argument("--var-keys", help="print all keys of a map variable") + group.add_argument("--print-data", help="print all data", action='store_true') args = parser.parse_args() - minigraph = args.minigraph - template_file = os.path.abspath(args.template) - - data = parse_xml(minigraph) + data = {} + + if args.minigraph != None: + minigraph = args.minigraph + data.update(parse_xml(minigraph)) - if args.var_file != None: - with open(args.var_file, 'r') as stream: - additional_data = yaml.load(stream) + if args.yaml != None: + with open(args.yaml, 'r') as stream: + additional_data = yaml.load(stream) data.update(additional_data) - env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) - env.filters['ipv4'] = is_ipv4 - env.filters['ipv6'] = is_ipv6 - template = env.get_template(template_file) + if args.additional_data != None: + data.update(json.loads(args.additional_data)) + + if args.template != None: + template_file = os.path.abspath(args.template) + env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) + env.filters['ipv4'] = is_ipv4 + env.filters['ipv6'] = is_ipv6 + template = env.get_template(template_file) + print template.render(data) + + if args.var != None: + print data[args.var] + + if args.var_json != None: + print json.dumps(data[args.var_json]) + + if args.var_keys != None: + for key in data[args.var_keys].keys(): + print key - print template.render(data) + if args.print_data: + print data if __name__ == "__main__": main() From ea65962fe4ad410e46b3f006e1d1dd28a807a1c3 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 20 Jan 2017 23:55:42 +0200 Subject: [PATCH 0196/1833] Fix compilation issue. (#198) Fix docker-platform-monitor compilation issue. Update .gitignore file --- .gitignore | 1 + dockers/docker-platform-monitor/Dockerfile.j2 | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 372634cfb016..1e87c52e6f71 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ dockers/docker-lldp-sv2/Dockerfile dockers/docker-orchagent/Dockerfile dockers/docker-snmp-sv2/Dockerfile dockers/docker-team/Dockerfile +dockers/docker-platform-monitor/Dockerfile diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 83463acf480f..c6020d113ba6 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -7,10 +7,15 @@ RUN apt-get install -y smartmontools sensord # Dependencies for sonic-cfggen RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml -COPY debs/ debs +COPY \ +{% for deb in docker_platform_monitor_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + RUN dpkg -i \ -{% for deb in docker_fpm_debs.split(' ') -%} +{% for deb in docker_platform_monitor_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} From 78f11a7ff3d723d324bfecfe06eae4c5510f79a6 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 20 Jan 2017 22:33:11 -0800 Subject: [PATCH 0197/1833] [docker]: Make line breaks consistent in DHCP relay Dockerfile (#203) --- dockers/docker-dhcp-relay/Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile index efc1f7f5c317..17cc13534241 100644 --- a/dockers/docker-dhcp-relay/Dockerfile +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -3,11 +3,12 @@ FROM docker-base ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -## Install isc-dhcp-relay -## Clean up -RUN apt-get update && apt-get -y install \ - isc-dhcp-relay && \ - apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +## Install isc-dhcp-relay and clean up afterward +RUN apt-get update \ + && apt-get -y install isc-dhcp-relay \ + && apt-get clean -y \ + && apt-get autoclean -y \ + && apt-get autoremove -y COPY isc-dhcp-relay /etc/default/isc-dhcp-relay From 9b940c3b3d65330ea272d01706307a2a0e7bec50 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Sat, 21 Jan 2017 10:30:39 -0800 Subject: [PATCH 0198/1833] Remove apt purge which wrongly remove sonic-config-engine (#204) --- dockers/docker-snmp-sv2/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 8e3a019b74c9..f975fbf845da 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -41,7 +41,7 @@ RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ python3 -m sonic_ax_impl install && \ python3 -m pip uninstall -y pip setuptools && \ /bin/bash -c "rm -rf /usr/lib/python3.5/{unittest,lib2to3,tkinter,idlelib,email,test}" && \ - apt-get -y purge build-essential wget libssl-dev openssl && \ + apt-get -y purge build-essential libssl-dev openssl && \ apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ find / | grep -E "__pycache__" | xargs rm -rf && \ rm -rf ~/.cache From 09f61a48943558297acc044925b5a8fd8048f4b7 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sun, 22 Jan 2017 22:19:43 -0800 Subject: [PATCH 0199/1833] [libteam]: Add patch 0001-libteam-Add-team_get_port_enabled-function.patch (#205) --- ...m-Add-team_get_port_enabled-function.patch | 59 +++++++++++++++++++ src/libteam/Makefile | 4 ++ 2 files changed, 63 insertions(+) create mode 100644 src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch diff --git a/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch b/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch new file mode 100644 index 000000000000..9bf08ce61308 --- /dev/null +++ b/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch @@ -0,0 +1,59 @@ +From 2f9248dd07d51361bc0a93ef70d0f8ac2631af35 Mon Sep 17 00:00:00 2001 +From: Shuotian Cheng +Date: Fri, 20 Jan 2017 12:10:13 -0800 +Subject: [PATCH] libteam: Add team_get_port_enabled function + +--- + include/team.h | 2 ++ + libteam/libteam.c | 22 ++++++++++++++++++++++ + 2 files changed, 24 insertions(+) + +diff --git a/include/team.h b/include/team.h +index 20ebcf6..9ae517d 100644 +--- a/include/team.h ++++ b/include/team.h +@@ -68,6 +68,8 @@ int team_get_bpf_hash_func(struct team_handle *th, struct sock_fprog *fp); + int team_set_bpf_hash_func(struct team_handle *th, const struct sock_fprog *fp); + int team_set_port_enabled(struct team_handle *th, + uint32_t port_ifindex, bool val); ++int team_get_port_enabled(struct team_handle *th, ++ uint32_t port_ifindex, bool *enabled); + int team_set_port_user_linkup_enabled(struct team_handle *th, + uint32_t port_ifindex, bool val); + int team_get_port_user_linkup(struct team_handle *th, +diff --git a/libteam/libteam.c b/libteam/libteam.c +index ac187aa..106e5cf 100644 +--- a/libteam/libteam.c ++++ b/libteam/libteam.c +@@ -1295,6 +1295,28 @@ int team_set_port_enabled(struct team_handle *th, + /** + * @param th libteam library context + * @param port_ifindex port interface index ++ * @param enabled where the enabled state will be stored ++ * ++ * @details Gets enabled state for port identified by port_ifindex ++ * ++ * @return Zero on success or negative number in case of an error. ++ **/ ++TEAM_EXPORT ++int team_get_port_enabled(struct team_handle *th, ++ uint32_t port_ifindex, bool *enabled) ++{ ++ struct team_option *option; ++ ++ option = team_get_option(th, "np", "enabled", port_ifindex); ++ if (!option) ++ return -ENOENT; ++ *enabled = team_get_option_value_bool(option); ++ return 0; ++} ++ ++/** ++ * @param th libteam library context ++ * @param port_ifindex port interface index + * @param val boolean value + * + * @details Enables or disable user linkup for port identified by port_ifindex +-- +2.1.4 + diff --git a/src/libteam/Makefile b/src/libteam/Makefile index b41487241b83..e6864596c98d 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -13,8 +13,12 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : git clone https://github.com/jpirko/libteam.git pushd ./libteam git checkout -f v1.26 + + # Apply patch + git apply ../0001-libteam-Add-team_get_port_enabled-function.patch popd + # Obtain debian packaging git clone https://anonscm.debian.org/git/collab-maint/libteam.git tmp pushd ./tmp git checkout -f da006f2 # v1.26 From 7bd90505a174aaaa010909a0a483b94e2d5eda4f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 23 Jan 2017 22:18:53 -0800 Subject: [PATCH 0200/1833] [docker]: Add DHCP relay docker to generic build (#207) --- platform/generic/rules.mk | 3 ++- rules/docker-dhcp-relay.mk | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 rules/docker-dhcp-relay.mk diff --git a/platform/generic/rules.mk b/platform/generic/rules.mk index cff64a8b6003..bc349ac4e7de 100644 --- a/platform/generic/rules.mk +++ b/platform/generic/rules.mk @@ -3,4 +3,5 @@ SONIC_ALL += $(DOCKER_DATABASE) \ $(DOCKER_TEAMD) \ $(DOCKER_LLDP_SV2) \ $(DOCKER_SNMP_SV2) \ - $(DOCKER_PLATFORM_MONITOR) + $(DOCKER_PLATFORM_MONITOR) \ + $(DOCKER_DHCP_RELAY) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk new file mode 100644 index 000000000000..1c68e8468a30 --- /dev/null +++ b/rules/docker-dhcp-relay.mk @@ -0,0 +1,7 @@ +# docker dhcp relay image + +DOCKER_DHCP_RELAY = docker-dhcp-relay.gz +$(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay +$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_BASE) + +SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) From 6d8f57631b66e54dbc94617daead960dc527b3ef Mon Sep 17 00:00:00 2001 From: byu343 Date: Mon, 23 Jan 2017 22:25:47 -0800 Subject: [PATCH 0201/1833] [Arista]: Add support to convert vfat file system to ext4 (#201) This commit will convert the existing file system of flash drive on Arista switches from VFAT to EXT4 in the booting of SONiC. It will take the whole flash and therefore remove the recovery partition. There is a check in the script making sure that the conversion operation will not happen on a non-Arista switch or if the existing file system is not VFAT. --- build_debian.sh | 7 + files/initramfs-tools/arista-convertfs | 170 +++++++++++++++++++++++++ files/initramfs-tools/mke2fs | 50 ++++++++ 3 files changed, 227 insertions(+) create mode 100644 files/initramfs-tools/arista-convertfs create mode 100644 files/initramfs-tools/mke2fs diff --git a/build_debian.sh b/build_debian.sh index fdefde3bb153..c4a0ab112c5c 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -113,6 +113,13 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-3.16.0-4-amd64_*.de ## Update initramfs for booting with squashfs+aufs cat files/initramfs-tools/modules | sudo tee -a $FILESYSTEM_ROOT/etc/initramfs-tools/modules > /dev/null +## Hook into initramfs: change fs type from vfat to ext4 on arista switches +sudo mkdir -p $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/ +sudo cp files/initramfs-tools/arista-convertfs $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs +sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs +sudo cp files/initramfs-tools/mke2fs $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs +sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs + ## Hook into initramfs: after partition mount and loop file mount ## 1. Prepare layered file system ## 2. Bind-mount docker working directory (docker aufs cannot work over aufs rootfs) diff --git a/files/initramfs-tools/arista-convertfs b/files/initramfs-tools/arista-convertfs new file mode 100644 index 000000000000..1aab6fa7d765 --- /dev/null +++ b/files/initramfs-tools/arista-convertfs @@ -0,0 +1,170 @@ +#!/bin/sh + +case $1 in + prereqs) + exit 0 + ;; +esac + +set -e +# set -x +total_mem=$(free | awk '/^Mem:/{print $2}') +tmpfs_size=$(( $total_mem / 20 * 17 )) +free_mem_thres=$(( $total_mem / 20 * 18 )) +tmp_mnt='/mnt/ramdisk-convfs' +root_mnt='/mnt/root-convfs' +root_dev='' +flash_dev='' +block_flash='' +aboot_flag='' +backup_file='' + +# Get the fullpath of flash device, e.g., /dev/sda +get_flash_dev() { + for dev in $(ls /sys/block); do + local is_mmc=$(echo "$dev" | grep 'mmcblk.*boot.*' | cat) + if [ -n "$is_mmc" ]; then + continue + fi + local devid=$(realpath "/sys/block/$dev/device") + local is_device=$(echo "$devid" | grep '^/sys/devices/' | cat) + local is_flash=$(echo "$devid" | grep "$block_flash" | cat) + if [ -n "$is_device" -a -n "$is_flash" ]; then + flash_dev="/dev/$dev" + return 0 + fi + done + return 1 +} + +# Wait for root_dev to be ready +wait_for_root_dev() { + local try_rounds=30 + while [ $try_rounds -gt 0 ]; do + if [ -e "$root_dev" ]; then + return 0 + fi + sleep 1 + try_rounds=$(( $try_rounds - 1 )) + done + return 1 +} + +# Alway run cleanup before exit +cleanup() { + if grep -q "$root_mnt" /proc/mounts; then + umount "$root_mnt" + fi + if grep -q "$tmp_mnt" /proc/mounts; then + umount "$tmp_mnt" + fi + [ -e "$root_mnt" ] && rmdir "$root_mnt" + [ -e "$tmp_mnt" ] && rmdir "$tmp_mnt" +} +trap cleanup EXIT + +notification() { +cat << EOF +A failure happend in modifying the root file system which stopped the upgrade. Manual interventions are needed to fix the issue. Note that: +1) files in the old root file system may have been lost and the old partition table may have been corrupted; +2) The files in the old root file system were copied to $tmp_mnt; +3) The old partition table was dumped to the file $tmp_mnt/$backup_file by sfdisk; +4) Quitting the current shell will lose all files mentioned above permanently. +EOF +} + +run_cmd() { + if ! eval "$1"; then + echo "$2" + notification + sh + exit 1 + fi +} + +# Extract kernel parameters +set -- $(cat /proc/cmdline) +for x in "$@"; do + case "$x" in + block_flash=*) + block_flash="${x#block_flash=}" + ;; + Aboot=*) + aboot_flag="${x#Aboot=}" + esac +done +root_dev="$ROOT" + +#Check aboot and root_dev is vfat +[ -z "$aboot_flag" ] && exit 0 +if [ -z "$root_dev" ]; then + echo "Error: root device name is not provided" + exit 1 +fi +if ! wait_for_root_dev; then + echo "Error: timeout in waiting for $root_dev" + exit 1 +fi +blkid | grep "$root_dev.*vfat" -q || exit 0 + + +# Get flash dev name +if [ -z "$block_flash" ]; then + echo "Error: flash device info is not provided" + exit 1 +fi +if ! get_flash_dev; then + echo "Error: flash device is not found" + exit 1 +fi + +# Check memory size for tmpfs +free_mem=$(free | awk '/^Mem:/{print $4}') +if [ "$free_mem" -lt "$free_mem_thres" ]; then + echo "Error: memory is not enough" + exit 1 +fi + +# Backup partition table +mkdir -p "$root_mnt" +mount "$root_dev" "$root_mnt" +backup_file=backup.$(date +%Y-%m-%d.%H-%M-%S) +sfdisk -d "$flash_dev" > "$root_mnt/$backup_file" + +# Check total size of files in root +total_file_size=$(du -s "$root_mnt" | awk '{print $1}') +if [ "$total_file_size" -gt "$tmpfs_size" ]; then + echo "Error: total file size is too large" + exit 1 +fi + +# Create tmpfs, and copy files to tmpfs +mkdir -p "$tmp_mnt" +mount -t tmpfs -o size="${tmpfs_size}k" tmpfs "$tmp_mnt" +cp -a "$root_mnt/." "$tmp_mnt/" +umount "$root_mnt" + +#### Lines below will modify the root file system, so any failure will be trapped to shell for manual interventions. + +# Create a new partition table (content in flash_dev will be deleted) +err_msg="Error: repartitioning $flash_dev failed" +cmd="echo ';' | sfdisk $flash_dev" +run_cmd "$cmd" "$err_msg" + +sleep 5 +err_msg="Error: timeout in waiting for $root_dev after repartition" +cmd="wait_for_root_dev" +run_cmd "$cmd" "$err_msg" + +err_msg="Error: formatting to ext4 failed" +cmd="mke2fs -t ext4 -m2 -F -O '^huge_file' $root_dev" +run_cmd "$cmd" "$err_msg" + +err_msg="Error: mounting $root_dev to $root_mnt failed" +cmd="mount -t ext4 $root_dev $root_mnt" +run_cmd "$cmd" "$err_msg" + +err_msg="Error: copying files form $tmp_mnt to $root_mnt failed" +cmd="cp -a $tmp_mnt/. $root_mnt/" +run_cmd "$cmd" "$err_msg" + diff --git a/files/initramfs-tools/mke2fs b/files/initramfs-tools/mke2fs new file mode 100644 index 000000000000..de529eb57059 --- /dev/null +++ b/files/initramfs-tools/mke2fs @@ -0,0 +1,50 @@ +#!/bin/sh +#Part of the code is revised based on initramfs-tools/hooks/fsck and initramfs-tool is under GPL v2. + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +prereqs) + prereqs + exit 0 + ;; +esac + +. /usr/share/initramfs-tools/hook-functions + +copy_exec /sbin/mke2fs +copy_exec /sbin/sfdisk +copy_exec /sbin/fdisk + +fstypes="ext4" + +for type in $fstypes; do + prog="/sbin/mkfs.${type}" + if [ -h "$prog" ]; then + link=$(readlink -f "$prog") + copy_exec "$link" + ln -s "$link" "${DESTDIR}/$prog" + elif [ -x "$prog" ] ; then + copy_exec "$prog" + else + echo "Warning: /sbin/mkfs.${type} doesn't exist, can't install to initramfs, ignoring." + fi +done + +for type in $fstypes; do + prog="/sbin/fsck.${type}" + if [ -h "$prog" ]; then + link=$(readlink -f "$prog") + copy_exec "$link" + ln -s "$link" "${DESTDIR}/$prog" + elif [ -x "$prog" ] ; then + copy_exec "$prog" + else + echo "Warning: /sbin/fsck.${type} doesn't exist, can't install to initramfs, ignoring." + fi +done From 1b49499b65d1a1498bdf5129a89f63b01042b8fd Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 24 Jan 2017 19:16:55 -0800 Subject: [PATCH 0202/1833] [docker]: Add a status file to mark that the file is generated by sonic-config-engine (#211) --- dockers/docker-fpm/config.sh | 3 +++ dockers/docker-lldp-sv2/config.sh | 3 +++ dockers/docker-platform-monitor/config.sh | 3 +++ dockers/docker-snmp-sv2/config.sh | 2 ++ dockers/docker-teamd/config.sh | 3 +++ 5 files changed, 14 insertions(+) diff --git a/dockers/docker-fpm/config.sh b/dockers/docker-fpm/config.sh index 647d9d34ba70..c1d3db29a1bd 100755 --- a/dockers/docker-fpm/config.sh +++ b/dockers/docker-fpm/config.sh @@ -12,3 +12,6 @@ sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/bgp/unisolate.j2 >/usr/sbi chown root:root /usr/sbin/bgp-unisolate chmod 0755 /usr/sbin/bgp-unisolate +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status + diff --git a/dockers/docker-lldp-sv2/config.sh b/dockers/docker-lldp-sv2/config.sh index d6ded04bc394..29c9b11f8ed5 100755 --- a/dockers/docker-lldp-sv2/config.sh +++ b/dockers/docker-lldp-sv2/config.sh @@ -2,3 +2,6 @@ sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/lldp/lldpd.conf.j2 >/etc/lldpd.conf +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status + diff --git a/dockers/docker-platform-monitor/config.sh b/dockers/docker-platform-monitor/config.sh index 4267bc547934..ece507b7cc8a 100755 --- a/dockers/docker-platform-monitor/config.sh +++ b/dockers/docker-platform-monitor/config.sh @@ -5,3 +5,6 @@ mkdir -p /etc/sensors.d hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` /bin/cp -rf /usr/share/sonic/$hwsku/sensors.conf /etc/sensors.d/ +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status + diff --git a/dockers/docker-snmp-sv2/config.sh b/dockers/docker-snmp-sv2/config.sh index 880aef593045..ac1c307ad0cb 100755 --- a/dockers/docker-snmp-sv2/config.sh +++ b/dockers/docker-snmp-sv2/config.sh @@ -10,4 +10,6 @@ sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /etc/swss/snm hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` /bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/ +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status diff --git a/dockers/docker-teamd/config.sh b/dockers/docker-teamd/config.sh index 482cde53bdf2..085a3d405af2 100755 --- a/dockers/docker-teamd/config.sh +++ b/dockers/docker-teamd/config.sh @@ -6,3 +6,6 @@ for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml --var-keys minigraph_portcha sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /etc/swss/teamd/teamd.j2 >/etc/teamd/$pc.conf done +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status + From c0aa0b9c17a8cac73fc54813eeaf014ba5f2cdd1 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Wed, 25 Jan 2017 05:17:32 +0200 Subject: [PATCH 0203/1833] [Mellanox]: Update Mellanox HW management to V1.0.0030 (#209) --- platform/mellanox/hw-management.mk | 2 +- platform/mellanox/hw-management/Makefile | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 6c6ae480db4d..1aa63862306e 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,6 +1,6 @@ # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = 20.7.2016 +MLNX_HW_MANAGEMENT_VERSION = V1.0.0030 export MLNX_HW_MANAGEMENT_VERSION diff --git a/platform/mellanox/hw-management/Makefile b/platform/mellanox/hw-management/Makefile index 8d1dbcb79d0f..ee2899d07c39 100644 --- a/platform/mellanox/hw-management/Makefile +++ b/platform/mellanox/hw-management/Makefile @@ -6,12 +6,13 @@ MAIN_TARGET = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # get sources sudo rm -rf hw-management - wget -N -O mlnx-hw-mgmt-$(MLNX_HW_MANAGEMENT_VERSION).tar.gz https://github.com/Mellanox/mellanox-openswitch/raw/master/hw-mgmt/mlnx-hw-mgmt-$(MLNX_HW_MANAGEMENT_VERSION).tar.gz - tar xzf mlnx-hw-mgmt-$(MLNX_HW_MANAGEMENT_VERSION).tar.gz + git clone https://github.com/Mellanox/hw-mgmt/ -b $(MLNX_HW_MANAGEMENT_VERSION) hw-management # build pushd hw-management - sudo debian/rules binary KVERSION=$(KVERSION) + sed "s~@SED_VERSION@~$(MLNX_HW_MANAGEMENT_VERSION)~" -i debian/changelog + chmod +x ./debian/rules + sudo ./debian/rules binary KVERSION=$(KVERSION) popd mv $* $(DEST)/ From 694e12b4b4b2898d6e6638ca58b9608d5b2be713 Mon Sep 17 00:00:00 2001 From: byu343 Date: Tue, 24 Jan 2017 19:18:01 -0800 Subject: [PATCH 0204/1833] [Arista]: Add VFAT support in initramfs (#208) --- files/initramfs-tools/modules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/initramfs-tools/modules b/files/initramfs-tools/modules index 86a1fcf20bd7..1bd0eab15996 100644 --- a/files/initramfs-tools/modules +++ b/files/initramfs-tools/modules @@ -1,2 +1,5 @@ squashfs aufs +vfat +nls_cp437 +nls_utf8 From d1399e2380a52978ca77b263d5c394f9e520764b Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 24 Jan 2017 19:18:42 -0800 Subject: [PATCH 0205/1833] [docker]: Add ptf docker to generic target (#210) --- platform/generic/rules.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/generic/rules.mk b/platform/generic/rules.mk index bc349ac4e7de..0ce1f562c0ad 100644 --- a/platform/generic/rules.mk +++ b/platform/generic/rules.mk @@ -4,4 +4,5 @@ SONIC_ALL += $(DOCKER_DATABASE) \ $(DOCKER_LLDP_SV2) \ $(DOCKER_SNMP_SV2) \ $(DOCKER_PLATFORM_MONITOR) \ - $(DOCKER_DHCP_RELAY) + $(DOCKER_DHCP_RELAY) \ + $(DOCKER_PTF) From 752062d57134125971346e06594748af296de36a Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 25 Jan 2017 00:01:14 -0800 Subject: [PATCH 0206/1833] [src]: Update sonic-sairedis/swss (#213) --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index e5d0aa91ea74..d6e7827a16af 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit e5d0aa91ea74eccc7e63b321c43640658337a836 +Subproject commit d6e7827a16af97f0fadbcf0f2da9b2d80a135cb6 diff --git a/src/sonic-swss b/src/sonic-swss index e5683423edf1..5d31f9d6db40 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit e5683423edf1c6ec98502894a07bd8cf7cadcf7c +Subproject commit 5d31f9d6db407882323ce5484a1a1e5f7648121a From ac7de25d947112b9e6436c5048ccfb20a7775358 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 25 Jan 2017 11:06:08 -0800 Subject: [PATCH 0207/1833] [src]: update linux kernel to take tg3 patch on arista qx32 platfrom (#214) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 5b652fca4fe6..7f3b4e4949aa 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 5b652fca4fe6f215e2869ae1d2e6ef44b3553698 +Subproject commit 7f3b4e4949aa39481221a0ebf88d055676091916 From e87498d16d432d11ccf7b0ec184c0c40c13a2c39 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 25 Jan 2017 18:18:25 -0800 Subject: [PATCH 0208/1833] Add platform config for 7050 and 6100 (#212) * Add platform config for 7050 and 6100 * allow certain platform to have no sensors.conf file in sonic-cfggen --- dockers/docker-platform-monitor/config.sh | 6 +- .../platform/Arista-7050-QX32/alias_map.json | 34 ++++++++ .../platform/Arista-7050-QX32/port_config.ini | 33 ++++++++ .../platform/Arista-7050-QX32/sensors.conf | 79 +++++++++++++++++++ .../platform/Force10-S6100/alias_map.json | 66 ++++++++++++++++ .../platform/Force10-S6100/port_config.ini | 65 +++++++++++++++ src/sonic-config-engine/setup.py | 10 +-- 7 files changed, 287 insertions(+), 6 deletions(-) create mode 100644 src/sonic-config-engine/platform/Arista-7050-QX32/alias_map.json create mode 100644 src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini create mode 100644 src/sonic-config-engine/platform/Arista-7050-QX32/sensors.conf create mode 100644 src/sonic-config-engine/platform/Force10-S6100/alias_map.json create mode 100644 src/sonic-config-engine/platform/Force10-S6100/port_config.ini diff --git a/dockers/docker-platform-monitor/config.sh b/dockers/docker-platform-monitor/config.sh index ece507b7cc8a..a74c2f5c9097 100755 --- a/dockers/docker-platform-monitor/config.sh +++ b/dockers/docker-platform-monitor/config.sh @@ -3,7 +3,11 @@ mkdir -p /etc/sensors.d hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` -/bin/cp -rf /usr/share/sonic/$hwsku/sensors.conf /etc/sensors.d/ + +if [ -e /usr/share/sonic/$hwsku/sensors.conf ] +then + /bin/cp -rf /usr/share/sonic/$hwsku/sensors.conf /etc/sensors.d/ +fi mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status diff --git a/src/sonic-config-engine/platform/Arista-7050-QX32/alias_map.json b/src/sonic-config-engine/platform/Arista-7050-QX32/alias_map.json new file mode 100644 index 000000000000..90b35011e2c5 --- /dev/null +++ b/src/sonic-config-engine/platform/Arista-7050-QX32/alias_map.json @@ -0,0 +1,34 @@ +{ + "Ethernet8": "Ethernet3/1", + "Ethernet0": "Ethernet1/1", + "Ethernet4": "Ethernet2/1", + "Ethernet108": "Ethernet28", + "Ethernet100": "Ethernet26", + "Ethernet104": "Ethernet27", + "Ethernet96": "Ethernet25", + "Ethernet124": "Ethernet32", + "Ethernet120": "Ethernet31", + "Ethernet92": "Ethernet24/1", + "Ethernet28": "Ethernet8/1", + "Ethernet52": "Ethernet14/1", + "Ethernet56": "Ethernet15/1", + "Ethernet76": "Ethernet20/1", + "Ethernet72": "Ethernet19/1", + "Ethernet32": "Ethernet9/1", + "Ethernet16": "Ethernet5/1", + "Ethernet36": "Ethernet10/1", + "Ethernet12": "Ethernet4/1", + "Ethernet88": "Ethernet23/1", + "Ethernet24": "Ethernet7/1", + "Ethernet116": "Ethernet30", + "Ethernet80": "Ethernet21/1", + "Ethernet112": "Ethernet29", + "Ethernet84": "Ethernet22/1", + "Ethernet48": "Ethernet13/1", + "Ethernet44": "Ethernet12/1", + "Ethernet40": "Ethernet11/1", + "Ethernet64": "Ethernet17/1", + "Ethernet60": "Ethernet16/1", + "Ethernet20": "Ethernet6/1", + "Ethernet68": "Ethernet18/1" +} \ No newline at end of file diff --git a/src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini b/src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini new file mode 100644 index 000000000000..ec12639d72bf --- /dev/null +++ b/src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini @@ -0,0 +1,33 @@ +# alias lanes +Ethernet0 125,126,127,128 +Ethernet4 121,122,123,124 +Ethernet8 13,14,15,16 +Ethernet12 9,10,11,12 +Ethernet16 17,18,19,20 +Ethernet20 21,22,23,24 +Ethernet24 25,26,27,28 +Ethernet28 29,30,31,32 +Ethernet32 37,38,39,40 +Ethernet36 33,34,35,36 +Ethernet40 45,46,47,48 +Ethernet44 41,42,43,44 +Ethernet48 53,54,55,56 +Ethernet52 49,50,51,52 +Ethernet56 69,70,71,72 +Ethernet60 65,66,67,68 +Ethernet64 77,78,79,80 +Ethernet68 73,74,75,76 +Ethernet72 93,94,95,96 +Ethernet76 89,90,91,92 +Ethernet80 101,102,103,104 +Ethernet84 97,98,99,100 +Ethernet88 109,110,111,112 +Ethernet92 105,106,107,108 +Ethernet96 61,62,63,64 +Ethernet100 57,58,59,60 +Ethernet104 81,82,83,84 +Ethernet108 85,86,87,88 +Ethernet112 117,118,119,120 +Ethernet116 113,114,115,116 +Ethernet120 5,6,7,8 +Ethernet124 1,2,3,4 diff --git a/src/sonic-config-engine/platform/Arista-7050-QX32/sensors.conf b/src/sonic-config-engine/platform/Arista-7050-QX32/sensors.conf new file mode 100644 index 000000000000..7745054a05ca --- /dev/null +++ b/src/sonic-config-engine/platform/Arista-7050-QX32/sensors.conf @@ -0,0 +1,79 @@ +# libsensors configuration file +# ---------------------------------------------- +# + +bus "i2c-2" "SCD SMBus master 0 bus 0" +bus "i2c-3" "SCD SMBus master 0 bus 1" +bus "i2c-5" "SCD SMBus master 0 bus 3" +bus "i2c-6" "SCD SMBus master 0 bus 4" +bus "i2c-7" "SCD SMBus master 0 bus 5" + +chip "k10temp-pci-00c3" + label temp1 "Cpu temp sensor" + +chip "lm73-i2c-3-48" + label temp1 "Rear Temp Sensor" + set temp1_max 65 + #set temp1_max_alarm 75 # read-only + +chip "lm86-i2c-2-4c" + label temp1 "Board Temp Sensor" + set temp1_max 65 + set temp1_crit 75 + + label temp2 "Front-panel Temp Sensor" + set temp2_max 65 + set temp2_crit 75 + +chip "pmbus-i2c-3-4e" + label temp1 "Power Controller Sensor 1" + set temp1_max 60 + set temp1_crit 70 + + label temp2 "Power Controller Sensor 2" + set temp2_max 60 + set temp2_crit 70 + + ignore curr1 + +chip "pmbus-i2c-5-58" + label temp1 "Power Supply 1 Sensor 1" + set temp1_max 60 + set temp1_crit 70 + + label temp2 "Power Supply 1 Sensor 2" + set temp2_max 60 + set temp2_crit 70 + + ignore temp3 + + set in1_max 250 + set in1_crit 255 + set power1_max 525 + set power2_max 460 + set power2_crit 462 + set curr1_max 5.28 + set curr1_crit 5.30 + set curr2_max 36 + set curr2_crit 37 + +chip "pmbus-i2c-6-58" + label temp1 "Power Supply 2 Sensor 1" + set temp1_max 60 + set temp1_crit 70 + + label temp2 "Power Supply 2 Sensor 2" + set temp2_max 60 + set temp2_crit 70 + + ignore temp3 + + set in1_max 250 + set in1_crit 255 + set power1_max 525 + set power2_max 460 + set power2_crit 462 + set curr1_max 5.28 + set curr1_crit 5.30 + set curr2_max 36 + set curr2_crit 37 diff --git a/src/sonic-config-engine/platform/Force10-S6100/alias_map.json b/src/sonic-config-engine/platform/Force10-S6100/alias_map.json new file mode 100644 index 000000000000..19a1ef662d37 --- /dev/null +++ b/src/sonic-config-engine/platform/Force10-S6100/alias_map.json @@ -0,0 +1,66 @@ +{ + "Ethernet0": "fortyGigE1/1/1", + "Ethernet1": "fortyGigE1/1/2", + "Ethernet2": "fortyGigE1/1/3", + "Ethernet3": "fortyGigE1/1/4", + "Ethernet4": "fortyGigE1/1/5", + "Ethernet5": "fortyGigE1/1/6", + "Ethernet6": "fortyGigE1/1/7", + "Ethernet7": "fortyGigE1/1/8", + "Ethernet8": "fortyGigE1/1/9", + "Ethernet9": "fortyGigE1/1/10", + "Ethernet10": "fortyGigE1/1/11", + "Ethernet11": "fortyGigE1/1/12", + "Ethernet12": "fortyGigE1/1/13", + "Ethernet13": "fortyGigE1/1/14", + "Ethernet14": "fortyGigE1/1/15", + "Ethernet15": "fortyGigE1/1/16", + "Ethernet16": "fortyGigE1/2/1", + "Ethernet17": "fortyGigE1/2/2", + "Ethernet18": "fortyGigE1/2/3", + "Ethernet19": "fortyGigE1/2/4", + "Ethernet20": "fortyGigE1/2/5", + "Ethernet21": "fortyGigE1/2/6", + "Ethernet22": "fortyGigE1/2/7", + "Ethernet23": "fortyGigE1/2/8", + "Ethernet24": "fortyGigE1/2/9", + "Ethernet25": "fortyGigE1/2/10", + "Ethernet26": "fortyGigE1/2/11", + "Ethernet27": "fortyGigE1/2/12", + "Ethernet28": "fortyGigE1/2/13", + "Ethernet29": "fortyGigE1/2/14", + "Ethernet30": "fortyGigE1/2/15", + "Ethernet31": "fortyGigE1/2/16", + "Ethernet32": "fortyGigE1/3/1", + "Ethernet33": "fortyGigE1/3/2", + "Ethernet34": "fortyGigE1/3/3", + "Ethernet34": "fortyGigE1/3/4", + "Ethernet36": "fortyGigE1/3/5", + "Ethernet37": "fortyGigE1/3/6", + "Ethernet38": "fortyGigE1/3/7", + "Ethernet39": "fortyGigE1/3/8", + "Ethernet40": "fortyGigE1/3/9", + "Ethernet41": "fortyGigE1/3/10", + "Ethernet42": "fortyGigE1/3/11", + "Ethernet43": "fortyGigE1/3/12", + "Ethernet44": "fortyGigE1/3/13", + "Ethernet45": "fortyGigE1/3/14", + "Ethernet46": "fortyGigE1/3/15", + "Ethernet47": "fortyGigE1/3/16", + "Ethernet48": "fortyGigE1/4/1", + "Ethernet49": "fortyGigE1/4/2", + "Ethernet50": "fortyGigE1/4/3", + "Ethernet51": "fortyGigE1/4/4", + "Ethernet52": "fortyGigE1/4/5", + "Ethernet53": "fortyGigE1/4/6", + "Ethernet54": "fortyGigE1/4/7", + "Ethernet55": "fortyGigE1/4/8", + "Ethernet56": "fortyGigE1/4/9", + "Ethernet57": "fortyGigE1/4/10", + "Ethernet58": "fortyGigE1/4/11", + "Ethernet59": "fortyGigE1/4/12", + "Ethernet60": "fortyGigE1/4/13", + "Ethernet61": "fortyGigE1/4/14", + "Ethernet62": "fortyGigE1/4/15", + "Ethernet63": "fortyGigE1/4/16" +} diff --git a/src/sonic-config-engine/platform/Force10-S6100/port_config.ini b/src/sonic-config-engine/platform/Force10-S6100/port_config.ini new file mode 100644 index 000000000000..d0af86ad1a4f --- /dev/null +++ b/src/sonic-config-engine/platform/Force10-S6100/port_config.ini @@ -0,0 +1,65 @@ +# alias lanes +Ethernet0 1,2 +Ethernet1 3,4 +Ethernet2 5,6 +Ethernet3 7,8 +Ethernet4 9,10 +Ethernet5 11,12 +Ethernet6 13,14 +Ethernet7 15,16 +Ethernet8 17,18 +Ethernet9 19,20 +Ethernet10 21,22 +Ethernet11 23,24 +Ethernet12 25,26 +Ethernet13 27,28 +Ethernet14 29,30 +Ethernet15 31,32 +Ethernet16 33,34 +Ethernet17 35,36 +Ethernet18 37,38 +Ethernet19 39,40 +Ethernet20 41,42 +Ethernet21 43,44 +Ethernet22 45,46 +Ethernet23 47,48 +Ethernet24 49,50 +Ethernet25 51,52 +Ethernet26 53,54 +Ethernet27 55,56 +Ethernet28 57,58 +Ethernet29 59,60 +Ethernet30 61,62 +Ethernet31 63,64 +Ethernet32 65,66 +Ethernet33 67,68 +Ethernet34 69,70 +Ethernet35 71,72 +Ethernet36 73,74 +Ethernet37 75,76 +Ethernet38 77,78 +Ethernet39 79,80 +Ethernet40 81,82 +Ethernet41 83,84 +Ethernet42 85,86 +Ethernet43 87,88 +Ethernet44 89,90 +Ethernet45 91,92 +Ethernet46 93,94 +Ethernet47 95,96 +Ethernet48 97,98 +Ethernet49 99,100 +Ethernet50 101,102 +Ethernet51 103,104 +Ethernet52 105,106 +Ethernet53 107,108 +Ethernet54 109,110 +Ethernet55 111,112 +Ethernet56 113,114 +Ethernet57 115,116 +Ethernet58 117,118 +Ethernet59 119,120 +Ethernet60 121,122 +Ethernet61 123,124 +Ethernet62 125,126 +Ethernet63 127,128 diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index af2f6f414d79..4c11ceb604ca 100644 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -9,11 +9,11 @@ def get_platform_file_list(): data_path = os.path.join(repo_path, 'platform') platforms = os.listdir(data_path) for platform in platforms: - data_files.append( (os.path.join('/usr/share/sonic', platform), - ['platform/' + platform + '/alias_map.json', - 'platform/' + platform + '/port_config.ini', - 'platform/' + platform + '/sensors.conf'] - )) + files = ['platform/' + platform + '/alias_map.json', + 'platform/' + platform + '/port_config.ini'] + if os.path.isfile( os.path.join(data_path, platform, 'sensors.conf') ): + files.append('platform/' + platform + '/sensors.conf') #Not all platforms need to have a sensors.conf file + data_files.append( (os.path.join('/usr/share/sonic', platform), files) ) return data_files setup(name='sonic-config-engine', From 608980524fcc932e9d8aba037d51fecfe3470d67 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 25 Jan 2017 18:19:15 -0800 Subject: [PATCH 0209/1833] [docker]: Install dpkt Python package in PTF docker (#216) --- dockers/docker-ptf/Dockerfile.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index ea86fd6c3cff..78f2eb260480 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -65,6 +65,7 @@ RUN rm -rf /debs \ && pip install cffi==1.7.0 \ && pip install --upgrade cffi==1.7.0 \ && pip install nnpy \ + && pip install dpkt \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py From c18b65bc167764fe182605f1f73e8cb482716fb5 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 26 Jan 2017 23:36:58 -0800 Subject: [PATCH 0210/1833] Refactor DHCP relay docker in sonicv2 style (#217) * Refactor DHCP relay docker in sonicv2 style --- dockers/docker-dhcp-relay/Dockerfile | 6 ++++-- dockers/docker-dhcp-relay/config.sh | 4 ++++ dockers/docker-dhcp-relay/isc-dhcp-relay | 6 ------ dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 7 +++++++ 4 files changed, 15 insertions(+), 8 deletions(-) create mode 100755 dockers/docker-dhcp-relay/config.sh delete mode 100644 dockers/docker-dhcp-relay/isc-dhcp-relay create mode 100644 dockers/docker-dhcp-relay/isc-dhcp-relay.j2 diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile index 17cc13534241..6ff95da88d7c 100644 --- a/dockers/docker-dhcp-relay/Dockerfile +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -10,9 +10,11 @@ RUN apt-get update \ && apt-get autoclean -y \ && apt-get autoremove -y -COPY isc-dhcp-relay /etc/default/isc-dhcp-relay +COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"] +COPY ["config.sh", "/usr/bin/"] -ENTRYPOINT service rsyslog start \ +ENTRYPOINT /usr/bin/config.sh \ + && service rsyslog start \ && service isc-dhcp-relay start \ && /bin/bash diff --git a/dockers/docker-dhcp-relay/config.sh b/dockers/docker-dhcp-relay/config.sh new file mode 100755 index 000000000000..42146b0343bc --- /dev/null +++ b/dockers/docker-dhcp-relay/config.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/dhcp_relay.yml -t /usr/share/dhcp-relay/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay + diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay b/dockers/docker-dhcp-relay/isc-dhcp-relay deleted file mode 100644 index 8aef56c7e19f..000000000000 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay +++ /dev/null @@ -1,6 +0,0 @@ -SERVERS="" - -INTERFACES="" - -#-a provides option 82 circuit id information -OPTIONS="-a" diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 new file mode 100644 index 000000000000..2d251172c543 --- /dev/null +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -0,0 +1,7 @@ +SERVERS="{{ dhcp_servers | join(' ') }}" + +INTERFACES="{{ minigraph_vlan_interfaces | join(' ') }}" + +# '-a' option provides option 82 circuit id information +OPTIONS="-a" + From 34ea91349c3d0172ac27b3d8525c46361d184c8c Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Sun, 29 Jan 2017 21:33:33 +0200 Subject: [PATCH 0211/1833] one image implementation (#215) * Single image * Fix review comments * Update syncd service. Add HW mgmt to Mellanox single image. * Add single image template for Broadcom platform. SKU should be provided during configure: make configure PLATFORM=broadcom SKU=Force10-S6000 * Add single image template for Cavium platform. SKU should be provided during configure: make configure PLATFORM=cavium SKU=AS7512 * Add description to sonic_debian_extension.j2 file. --- Makefile | 1 + build_debian.sh | 26 +- build_image.sh | 6 +- dockers/docker-snmp-sv2/config.sh | 2 +- files/build_templates/bgp.service.j2 | 12 + files/build_templates/database.service.j2 | 12 + files/build_templates/docker_image_ctl.j2 | 25 + files/build_templates/lldp.service.j2 | 12 + files/build_templates/snmp.service.j2 | 12 + .../build_templates/sonic_debian_extension.j2 | 124 ++ files/build_templates/swss.service.j2 | 13 + files/build_templates/syncd.service.j2 | 29 + files/build_templates/sysDescription.j2 | 1 + files/build_templates/teamd.service.j2 | 12 + files/image_config/apt/sonic-dev.gpg.key | 30 + .../image_config/apt/sources.list | 0 ...ian_archive_trafficmanager_net_debian.list | 1 + ...ackages_microsoft_com_repos_sonic_dev.list | 1 + files/image_config/environment/environment | 1 + files/image_config/environment/motd | 12 + .../interfaces/interfaces-config.service | 11 + .../interfaces/interfaces-config.sh | 5 + files/image_config/interfaces/interfaces.j2 | 50 + .../image_config/interfaces/lag_interfaces.j2 | 20 + .../interfaces/vlan_interfaces.j2 | 18 + .../minigraph/minigraph_ACS-MSN2700.xml | 1043 +++++++++++++++++ .../minigraph/minigraph_AS7512.xml | 1043 +++++++++++++++++ .../minigraph/minigraph_Force10-S6000.xml | 1043 +++++++++++++++++ files/image_config/ntp/ntp-config.service | 11 + files/image_config/ntp/ntp-config.sh | 3 + files/image_config/ntp/ntp.conf.j2 | 63 + files/image_config/ntp/ntp.yml | 6 + .../rsyslog/rsyslog-config.service | 11 + files/image_config/rsyslog/rsyslog-config.sh | 3 + files/image_config/rsyslog/rsyslog.conf.j2 | 71 ++ .../rsyslog/rsyslog.d/00-acs.conf | 46 + .../rsyslog/rsyslog.d/99-default.conf | 66 ++ files/image_config/rsyslog/rsyslog.yml | 1 + files/image_config/snmp/snmp.yml | 1 + files/image_config/sudoers/sudoers | 33 + installer/x86_64/install.sh | 4 + onie-image.conf | 3 + platform/broadcom/platform.conf | 0 platform/broadcom/rules.mk | 7 +- platform/broadcom/single-image.mk | 8 + platform/cavium/platform.conf | 0 platform/cavium/rules.mk | 6 +- platform/cavium/single-image.mk | 8 + platform/generic/aboot-image.mk | 9 + platform/generic/onie-image.mk | 8 + platform/generic/platform.conf | 0 platform/generic/rules.mk | 8 +- platform/mellanox/docker-orchagent-mlnx.mk | 10 + platform/mellanox/docker-syncd-mlnx.mk | 7 + platform/mellanox/platform.conf | 0 platform/mellanox/rules.mk | 14 +- platform/mellanox/single-image.mk | 8 + rules/docker-database.mk | 6 + rules/docker-fpm.mk | 6 + rules/docker-lldp-sv2.mk | 5 + rules/docker-snmp-sv2.mk | 6 + rules/docker-teamd.mk | 5 + rules/sonic-aboot.mk | 6 - rules/sonic-generic.mk | 6 - slave.mk | 62 +- .../platform/AS7512/alias_map.json | 1 + .../platform/AS7512/port_config.ini | 1 + .../platform/AS7512/sensors.conf | 1 + 68 files changed, 4025 insertions(+), 60 deletions(-) create mode 100644 files/build_templates/bgp.service.j2 create mode 100644 files/build_templates/database.service.j2 create mode 100644 files/build_templates/docker_image_ctl.j2 create mode 100644 files/build_templates/lldp.service.j2 create mode 100644 files/build_templates/snmp.service.j2 create mode 100644 files/build_templates/sonic_debian_extension.j2 create mode 100644 files/build_templates/swss.service.j2 create mode 100644 files/build_templates/syncd.service.j2 create mode 100644 files/build_templates/sysDescription.j2 create mode 100644 files/build_templates/teamd.service.j2 create mode 100644 files/image_config/apt/sonic-dev.gpg.key rename generic/platform.conf => files/image_config/apt/sources.list (100%) create mode 100644 files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list create mode 100644 files/image_config/apt/sources.list.d/packages_microsoft_com_repos_sonic_dev.list create mode 100644 files/image_config/environment/environment create mode 100644 files/image_config/environment/motd create mode 100644 files/image_config/interfaces/interfaces-config.service create mode 100755 files/image_config/interfaces/interfaces-config.sh create mode 100644 files/image_config/interfaces/interfaces.j2 create mode 100644 files/image_config/interfaces/lag_interfaces.j2 create mode 100644 files/image_config/interfaces/vlan_interfaces.j2 create mode 100644 files/image_config/minigraph/minigraph_ACS-MSN2700.xml create mode 100644 files/image_config/minigraph/minigraph_AS7512.xml create mode 100644 files/image_config/minigraph/minigraph_Force10-S6000.xml create mode 100644 files/image_config/ntp/ntp-config.service create mode 100755 files/image_config/ntp/ntp-config.sh create mode 100644 files/image_config/ntp/ntp.conf.j2 create mode 100644 files/image_config/ntp/ntp.yml create mode 100644 files/image_config/rsyslog/rsyslog-config.service create mode 100755 files/image_config/rsyslog/rsyslog-config.sh create mode 100644 files/image_config/rsyslog/rsyslog.conf.j2 create mode 100644 files/image_config/rsyslog/rsyslog.d/00-acs.conf create mode 100644 files/image_config/rsyslog/rsyslog.d/99-default.conf create mode 100644 files/image_config/rsyslog/rsyslog.yml create mode 100644 files/image_config/snmp/snmp.yml create mode 100644 files/image_config/sudoers/sudoers create mode 100644 platform/broadcom/platform.conf create mode 100644 platform/broadcom/single-image.mk create mode 100644 platform/cavium/platform.conf create mode 100644 platform/cavium/single-image.mk create mode 100644 platform/generic/aboot-image.mk create mode 100644 platform/generic/onie-image.mk create mode 100644 platform/generic/platform.conf create mode 100644 platform/mellanox/platform.conf create mode 100644 platform/mellanox/single-image.mk delete mode 100644 rules/sonic-aboot.mk delete mode 100644 rules/sonic-generic.mk create mode 100644 src/sonic-config-engine/platform/AS7512/alias_map.json create mode 100644 src/sonic-config-engine/platform/AS7512/port_config.ini create mode 100644 src/sonic-config-engine/platform/AS7512/sensors.conf diff --git a/Makefile b/Makefile index f68e8de4bbca..5c93afad6a91 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,7 @@ DOCKER_BUILD = docker build --no-cache \ -C sonic \ -f slave.mk \ PLATFORM=$(PLATFORM) \ + SKU=$(SKU) \ $@ sonic-slave-build : diff --git a/build_debian.sh b/build_debian.sh index c4a0ab112c5c..11d8217ff8bf 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -132,15 +132,6 @@ sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Install latest intel igb driver sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko -## Install package without starting service -## ref: https://wiki.debian.org/chroot -trap_push 'sudo rm -f $FILESYSTEM_ROOT/usr/sbin/policy-rc.d' -sudo tee -a $FILESYSTEM_ROOT/usr/sbin/policy-rc.d > /dev/null </etc/snmp/snmpd.conf hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` -/bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/ +/bin/cp -rf /etc/ssw/$hwsku/alias_map.json /etc/snmp/ mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status diff --git a/files/build_templates/bgp.service.j2 b/files/build_templates/bgp.service.j2 new file mode 100644 index 000000000000..7fa3c0eb1150 --- /dev/null +++ b/files/build_templates/bgp.service.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=BGP container +Requires=database.service +After=database.service + +[Service] +User={{ sonicadmin_user }} +ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStop=/usr/bin/{{docker_container_name}}.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/files/build_templates/database.service.j2 b/files/build_templates/database.service.j2 new file mode 100644 index 000000000000..fd4f34435e6a --- /dev/null +++ b/files/build_templates/database.service.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=Database container +Requires=docker.service +After=docker.service + +[Service] +User={{ sonicadmin_user }} +ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStop=/usr/bin/{{docker_container_name}}.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 new file mode 100644 index 000000000000..6f604c63aefb --- /dev/null +++ b/files/build_templates/docker_image_ctl.j2 @@ -0,0 +1,25 @@ +#!/bin/bash + +start() { + docker inspect --type container {{docker_container_name}} &>/dev/null + if [ "$?" -eq "0" ]; then + docker start -a {{docker_container_name}} + else + docker run {{docker_image_run_opt}} --name={{docker_container_name}} {{docker_image_name}} + fi +} + +stop() { + docker stop {{docker_container_name}} +} + +case "$1" in + start|stop) + $1 + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac + diff --git a/files/build_templates/lldp.service.j2 b/files/build_templates/lldp.service.j2 new file mode 100644 index 000000000000..f66e9d682af6 --- /dev/null +++ b/files/build_templates/lldp.service.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=LLDP container +Requires=database.service +After=database.service + +[Service] +User={{ sonicadmin_user }} +ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStop=/usr/bin/{{docker_container_name}}.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 new file mode 100644 index 000000000000..3744c586896f --- /dev/null +++ b/files/build_templates/snmp.service.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=SNMP container +Requires=database.service +After=database.service + +[Service] +User={{ sonicadmin_user }} +ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStop=/usr/bin/{{docker_container_name}}.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 new file mode 100644 index 000000000000..00fcf6732131 --- /dev/null +++ b/files/build_templates/sonic_debian_extension.j2 @@ -0,0 +1,124 @@ +#!/bin/bash +## This script is to automate loading of vendor specific docker images +## and instalation of configuration files and vendor specific packages +## to debian file system. +## +## USAGE: +## ./sonic_debian_extension.sh FILESYSTEM_ROOT +## PARAMETERS: +## FILESYSTEM_ROOT +## Path to debian file system root directory + +FILESYSTEM_ROOT=$1 +[ -n "$FILESYSTEM_ROOT" ] || { + echo "Error: no or empty FILESYSTEM_ROOT argument" + exit 1 +} + +## Enable debug output for script +set -x -e + +. functions.sh +BUILD_TEMPLATES=files/build_templates +IMAGE_CONFIGS=files/image_config +VENDOR_CONFIGS=src/sonic-config-engine/platform + +{% if installer_debs.strip() -%} +clean_sys() { + sudo umount $FILESYSTEM_ROOT/sys/fs/cgroup/* \ + $FILESYSTEM_ROOT/sys/fs/cgroup \ + $FILESYSTEM_ROOT/sys || true +} +trap_push clean_sys +sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs + +sudo chroot $FILESYSTEM_ROOT service docker start +sudo chroot $FILESYSTEM_ROOT docker version + +# Install config engine dependencies +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ + python-lxml \ + python-jinja2 \ + python-netaddr \ + python-ipaddr \ + python-yaml + +sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} + +# Create all needed directories +sudo mkdir -p $FILESYSTEM_ROOT/etc/ssw/ +sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ +sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/templates/ + +# Apply apt configuration files +sudo cp $IMAGE_CONFIGS/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ +sudo cp -R $IMAGE_CONFIGS/apt/sources.list.d/ $FILESYSTEM_ROOT/etc/apt/ +cat $IMAGE_CONFIGS/apt/sonic-dev.gpg.key | sudo LANG=C chroot $FILESYSTEM_ROOT apt-key add - + +# Apply environtment configuration files +sudo cp $IMAGE_CONFIGS/environment/environment $FILESYSTEM_ROOT/etc/ +sudo cp $IMAGE_CONFIGS/environment/motd $FILESYSTEM_ROOT/etc/ + +# Copy default minigraph +sudo cp $IMAGE_CONFIGS/minigraph/minigraph_{{sonic_hwsku}}.xml $FILESYSTEM_ROOT/etc/sonic/minigraph.xml + +# Copy NTP configuration files and templates +sudo cp $IMAGE_CONFIGS/ntp/ntp-config.service $FILESYSTEM_ROOT/etc/systemd/system/ +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/etc/sonic/templates/ +sudo cp $IMAGE_CONFIGS/ntp/ntp.yml $FILESYSTEM_ROOT/etc/sonic/ + +# 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 +sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.sh $FILESYSTEM_ROOT/usr/bin/ +sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.conf.j2 $FILESYSTEM_ROOT/etc/sonic/templates/ +sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.yml $FILESYSTEM_ROOT/etc/sonic/ +sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/* $FILESYSTEM_ROOT/etc/rsyslog.d/ + +# Copy interfaces configuration files and templates +sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable interfaces-config.service +sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.sh $FILESYSTEM_ROOT/usr/bin/ +sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/etc/sonic/templates/ + +# Copy SNMP configuration files +sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ + +# Generate system desription file +export git_revision=$(git rev-parse --short HEAD) +export sonic_hwsku={{sonic_hwsku}} +export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version` +export kernel_version={{kversion}} +j2 $BUILD_TEMPLATES/sysDescription.j2 > sysDescription +sudo mv sysDescription $FILESYSTEM_ROOT/etc/ssw/ + +# Copy sudoers configuration file +sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ + +# Copy vendor specific configuration files +sudo cp -R $VENDOR_CONFIGS/{{sonic_hwsku}}/ $FILESYSTEM_ROOT/etc/ssw/ + +{% for deb in installer_debs.strip().split(' ') -%} +sudo dpkg --extract {{deb}} $FILESYSTEM_ROOT +{% endfor %} +## Run depmod command for target kernel modules +sudo LANG=C chroot $FILESYSTEM_ROOT depmod -a {{kversion}} +{% endif %} +{% if installer_images.strip() -%} +{% for image in installer_images.strip().split(' ') -%} +sudo LANG=C chroot $FILESYSTEM_ROOT docker load < {{image}} +{% endfor %} +sudo chroot $FILESYSTEM_ROOT service docker stop +{% for script in installer_start_scrips.split(' ') -%} +sudo cp {{script}} $FILESYSTEM_ROOT/usr/bin/ +{% endfor %} +{% for service in installer_services.split(' ') -%} +sudo cp {{service}} $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable {{service}} +{% endfor %} +sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true +sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys +{% endif %} + diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 new file mode 100644 index 000000000000..3e7eb7cb68da --- /dev/null +++ b/files/build_templates/swss.service.j2 @@ -0,0 +1,13 @@ +[Unit] +Description=orchagent container +Requires=database.service +After=database.service + +[Service] +User={{ sonicadmin_user }} +ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStop=/usr/bin/{{docker_container_name}}.sh stop +ExecStopPost=/usr/bin/syncd.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 new file mode 100644 index 000000000000..e0fdb7e270a5 --- /dev/null +++ b/files/build_templates/syncd.service.j2 @@ -0,0 +1,29 @@ +[Unit] +Description=syncd container +Requires=database.service +After=database.service + +[Service] +User=root +{% if sonic_hwsku == 'ACS-MSN2700' %} +ExecStartPre=/etc/init.d/sxdkernel start +ExecStartPre=/usr/bin/mst start +ExecStartPre=/etc/mlnx/msn2700 start +{% elif sonic_hwsku == 'AS7512' %} +ExecStartPre=-/etc/init.d/xpnet.sh stop +ExecStartPre=/etc/init.d/xpnet.sh start +{% endif %} +ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStop=/usr/bin/{{docker_container_name}}.sh stop +{% if sonic_hwsku == 'ACS-MSN2700' %} +ExecStopPost=/etc/mlnx/msn2700 stop +ExecStopPost=/etc/init.d/sxdkernel stop +ExecStopPost=/usr/bin/mst stop +{% elif sonic_hwsku == 'AS7512' %} +ExecStopPost=/etc/init.d/xpnet.sh stop +ExecStopPost=/etc/init.d/xpnet.sh start +{% endif %} +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/files/build_templates/sysDescription.j2 b/files/build_templates/sysDescription.j2 new file mode 100644 index 000000000000..cfbdca1333d1 --- /dev/null +++ b/files/build_templates/sysDescription.j2 @@ -0,0 +1 @@ +SONiC Software Version: SONiC-OS-{{git_revision}} HwSku: {{sonic_hwsku}} - Distribution: Debian {{debian_version}} - Kernel: {{kernel_version}} diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 new file mode 100644 index 000000000000..49ecb640d895 --- /dev/null +++ b/files/build_templates/teamd.service.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=TEAMD container +Requires=database.service +After=database.service + +[Service] +User={{ sonicadmin_user }} +ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStop=/usr/bin/{{docker_container_name}}.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/files/image_config/apt/sonic-dev.gpg.key b/files/image_config/apt/sonic-dev.gpg.key new file mode 100644 index 000000000000..fb9a37901bc7 --- /dev/null +++ b/files/image_config/apt/sonic-dev.gpg.key @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQENBFQ1bTIBCAC7oGfkv/ck0XsLuG8cdcSB2ISqxFAcBvH9BitEtxmpW2uhykKk +xY4rVD/4Uys1s3PF1/64QfPR+hYcewueOwz0ZAcLyFXXk4McICXaPq3NrLiWYKKX +UZLnrPzcrGZoW/kHDDp4OmBiDmT1PGvZlpuimwkMCusUzIr7Cbbp2dIy8MERL5tA +LcgLu3KL6clJ+aTW2jgepI1D7sTepOeGd7eRSb5njKg2M7k/93v/7MipZxiVtyXH +B74YiK6jSbst5JpuYsLa/Dqryvx7Xq3n53oif892pv3euTduo1fYw8Hgh/OOYdeT +c9WCj03KA1jCSFURjdrug0kR8BPlfjqtRLXFABEBAAG0JE1TIE9wZW4gVGVjaCA8 +aW50ZXJvcEBtaWNyb3NvZnQuY29tPokBOAQTAQIAIgUCVDVtMgIbAwYLCQgHAwIG +FQgCCQoLBBYCAwECHgECF4AACgkQsCxG30F6CJO1uAf/cmL68bM8YgF/61hkaY56 +LqrppUTJH/w4fKq47Pf6KfgSLvxfNU6soi2KHYRjIvTRx3tV4vUM5n2plaQg2s8V +/Epg4FeIRTk75YwiHAzLhLnp5cdUaTvC4j4mwxoB6j9Ty+fXJwQ0MvpDhIZb9vM4 +GXw/fEQHCT4f3gx4nReeqE+FB2wVHleX9+Lpodu98JyJTKJRBRHYLqy6S+/lyp2W +aBlsI1LOqBcx1uRK24U7duIpbYwIyrx0cafSruqR2GjVdu+imkhHyUn52VbzYhq1 +af0rqYiZ1VOamVOG0By8+hVyNa1MLc1K2uWGs0o5fDe9F5/swbvLHVXI+M50Vs+m +J7kBDQRUNW0yAQgAu7DkTVj0ZQC4F7bFivAwrdby8gCakTXOl1kcK622hjRJ8nam +aZeW+eADfLRsTmdUmXgZu1YWS5Gn2ZVngC8SGPUBT071+oRETCz4uNB7IimB9QfP +++orI6o2vmnVVsq5wWCbEdNU+TCVv1zjrYev5lwckkKpjHt6o8MNoX2DFuQymSyR +eZKaqhdKmcji4Ke7OIYqwgPjch3wxzE1b5gNOR/iwxWyjjOffZPLr/VhIfIJRs86 +dSXrwjHtEh810SKDLghHM0VAdY34nyC5ZZ61yhts5HtQDFK+9mNpH1mkc4gDBlgG +266pVvknumK6lPNm/osF/cpjWmEw24ypcQIvOQARAQABiQEfBBgBAgAJBQJUNW0y +AhsMAAoJELAsRt9BegiTMBUH/0sZ6gZy7mCTSAYT+NSXLFtGC2zNUVL80SWvfgYm +k9XPVI22MrefZfQ6M01RylyxtWXjRM8UoN8SDKWPpXumzJf831f/7om5zwutaG7b +tjDPYqRKJSbAIFZu2mN+uLrNQ2SV6XK7FoV0dtcrEX9S7RICb6i19D+70+Oh/qgU +R04H1jqS29XBzqAlIzdBoA+sYAwbOIJsSL3YyNQcUv3B5+5yR/bo/L8pnUJt6iuL +nWW+mi7r8gWPHDSrcdYq1TmmlOM7CwZPgWRZzkQPSeZz52Tt7IP47eyGJ09U4PIf +FtMH1ElL2UgHoA/F9Q88e7LkztaTqE59uXWbIYyuSMJVvRU= +=sb3d +-----END PGP PUBLIC KEY BLOCK----- diff --git a/generic/platform.conf b/files/image_config/apt/sources.list similarity index 100% rename from generic/platform.conf rename to files/image_config/apt/sources.list diff --git a/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list b/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list new file mode 100644 index 000000000000..503897133ca3 --- /dev/null +++ b/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list @@ -0,0 +1 @@ +deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free diff --git a/files/image_config/apt/sources.list.d/packages_microsoft_com_repos_sonic_dev.list b/files/image_config/apt/sources.list.d/packages_microsoft_com_repos_sonic_dev.list new file mode 100644 index 000000000000..468dcccc6eec --- /dev/null +++ b/files/image_config/apt/sources.list.d/packages_microsoft_com_repos_sonic_dev.list @@ -0,0 +1 @@ +deb [arch=amd64] http://packages.microsoft.com/repos/sonic-dev/ jessie main diff --git a/files/image_config/environment/environment b/files/image_config/environment/environment new file mode 100644 index 000000000000..6c85276371bf --- /dev/null +++ b/files/image_config/environment/environment @@ -0,0 +1 @@ +VTYSH_PAGER=more diff --git a/files/image_config/environment/motd b/files/image_config/environment/motd new file mode 100644 index 000000000000..47e32505aa51 --- /dev/null +++ b/files/image_config/environment/motd @@ -0,0 +1,12 @@ +You are on + ____ ___ _ _ _ ____ + / ___| / _ \| \ | (_)/ ___| + \___ \| | | | \| | | | + ___) | |_| | |\ | | |___ + |____/ \___/|_| \_|_|\____| + +-- Software for Open Networking In the Cloud -- + +Unauthorized access and/or use are prohibited. +All access and/or use are subject to monitoring. + diff --git a/files/image_config/interfaces/interfaces-config.service b/files/image_config/interfaces/interfaces-config.service new file mode 100644 index 000000000000..48d6ede42557 --- /dev/null +++ b/files/image_config/interfaces/interfaces-config.service @@ -0,0 +1,11 @@ +[Unit] +Description=Update interfaces configuration +Before=network.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/interfaces-config.sh + +[Install] +WantedBy=multi-user.target + diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh new file mode 100755 index 000000000000..69d72e916477 --- /dev/null +++ b/files/image_config/interfaces/interfaces-config.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/interfaces.j2 >/etc/network/interfaces +sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/vlan_interfaces.j2 >/etc/network/interfaces.d/vlan_interfaces +sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/lag_interfaces.j2 >/etc/network/interfaces.d/lag_interfaces diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 new file mode 100644 index 000000000000..6d1476963ed9 --- /dev/null +++ b/files/image_config/interfaces/interfaces.j2 @@ -0,0 +1,50 @@ +# +{% block banner %} +# =========== Managed by config engine DO NOT EDIT! ======================== +# generated by templates/interfaces.j2 using sonic-cfggen +# file: interfaces +{% endblock %} +# +{% block loopback %} +# The loopback network interface +auto lo +iface lo inet loopback +# Use command 'ip addr list dev lo' to check all addresses +{% for minigraph_lo_interface in minigraph_lo_interfaces %} +iface lo {{ 'inet' if minigraph_lo_interface['addr'] | ipv4 else 'inet6' }} static + address {{ minigraph_lo_interface['addr'] }} + netmask {{ minigraph_lo_interface['mask'] }} +# +{% endfor %} +{% endblock loopback %} +# +{% block mgmt_interface %} +# The management network interface +auto eth0 +{% if minigraph_mgmt_interface['addr'] %} +iface eth0 inet static + address {{ minigraph_mgmt_interface['addr'] }} + netmask {{ minigraph_mgmt_interface['mask'] }} + ################ management network policy routing rules + #### management port up rules" + up ip route add default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default + up ip rule add from {{ minigraph_mgmt_interface['addr'] }}/32 table default + #### management port down rules" + down ip route delete default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default + down ip rule delete from {{ minigraph_mgmt_interface['addr'] }}/32 table default + {# TODO: COPP policy type rules #} +{% else %} +iface eth0 inet dhcp +{% endif %} +{% endblock mgmt_interface %} +# +{% block front_panel_interface %} +# The switch front panel interfaces +{% for interface in minigraph_interfaces %} +auto {{ interface['alias'] }} +iface {{ interface['alias'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static + address {{ interface['addr'] }} + netmask {{ interface['mask'] }} +# +{% endfor %} +{% endblock front_panel_interface %} diff --git a/files/image_config/interfaces/lag_interfaces.j2 b/files/image_config/interfaces/lag_interfaces.j2 new file mode 100644 index 000000000000..0b5e24b61893 --- /dev/null +++ b/files/image_config/interfaces/lag_interfaces.j2 @@ -0,0 +1,20 @@ +# +{% block banner %} +# =========== Managed by config engine DO NOT EDIT! ======================== +# generated by templates/lag_interfaces.j2 using sonic-cfggen +# file: lag_interfaces +{% endblock %} +# +{% block lag_interface %} +# The switch LAG interfaces +{% for interface in minigraph_interfaces %} +{% if 'PortChannel' in interface['alias'] %} +auto {{ interface['name'] }} +iface {{ interface['name'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static + address {{ interface['addr'] }} + netmask {{ interface['mask'] }} +{% endif %} +{% endfor %} +{% endblock lag_interface %} +# + diff --git a/files/image_config/interfaces/vlan_interfaces.j2 b/files/image_config/interfaces/vlan_interfaces.j2 new file mode 100644 index 000000000000..6d85d7910ed8 --- /dev/null +++ b/files/image_config/interfaces/vlan_interfaces.j2 @@ -0,0 +1,18 @@ +# +{% block banner %} +# =========== Managed by config engine DO NOT EDIT! ======================== +# generated by templates/interfaces.j2 using sonic-cfggen +# file: vlan_interfaces +{% endblock %} +# +{% block vlan_interface %} +# The switch VLAN interfaces +{% for interface in minigraph_vlan_interfaces %} +auto {{ interface['name'] }} +iface {{ interface['name'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static + bridge_ports {{ interface['members'] }} + address {{ interface['addr'] }} + netmask {{ interface['mask'] }} +{% endfor %} +{% endblock vlan_interface %} +# diff --git a/files/image_config/minigraph/minigraph_ACS-MSN2700.xml b/files/image_config/minigraph/minigraph_ACS-MSN2700.xml new file mode 100644 index 000000000000..5cfa271b19e2 --- /dev/null +++ b/files/image_config/minigraph/minigraph_ACS-MSN2700.xml @@ -0,0 +1,1043 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch2 + 10.0.0.32 + 1 + 180 + 60 + + + switch2 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch2 + 10.0.0.34 + 1 + 180 + 60 + + + switch2 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch2 + 10.0.0.36 + 1 + 180 + 60 + + + switch2 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch2 + 10.0.0.38 + 1 + 180 + 60 + + + switch2 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch2 + 10.0.0.40 + 1 + 180 + 60 + + + switch2 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch2 + 10.0.0.42 + 1 + 180 + 60 + + + switch2 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch2 + 10.0.0.44 + 1 + 180 + 60 + + + switch2 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch2 + 10.0.0.46 + 1 + 180 + 60 + + + switch2 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch2 + 10.0.0.48 + 1 + 180 + 60 + + + switch2 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch2 + 10.0.0.50 + 1 + 180 + 60 + + + switch2 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch2 + 10.0.0.52 + 1 + 180 + 60 + + + switch2 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch2 + 10.0.0.54 + 1 + 180 + 60 + + + switch2 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch2 + 10.0.0.56 + 1 + 180 + 60 + + + switch2 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch2 + 10.0.0.58 + 1 + 180 + 60 + + + switch2 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch2 + 10.0.0.60 + 1 + 180 + 60 + + + switch2 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch2 + 10.0.0.62 + 1 + 180 + 60 + + + switch2 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch2 + + +
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 + + + + + + + + switch2 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch2 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + switch2 + ACS-MSN2700 +
diff --git a/files/image_config/minigraph/minigraph_AS7512.xml b/files/image_config/minigraph/minigraph_AS7512.xml new file mode 100644 index 000000000000..5cfa271b19e2 --- /dev/null +++ b/files/image_config/minigraph/minigraph_AS7512.xml @@ -0,0 +1,1043 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch2 + 10.0.0.32 + 1 + 180 + 60 + + + switch2 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch2 + 10.0.0.34 + 1 + 180 + 60 + + + switch2 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch2 + 10.0.0.36 + 1 + 180 + 60 + + + switch2 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch2 + 10.0.0.38 + 1 + 180 + 60 + + + switch2 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch2 + 10.0.0.40 + 1 + 180 + 60 + + + switch2 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch2 + 10.0.0.42 + 1 + 180 + 60 + + + switch2 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch2 + 10.0.0.44 + 1 + 180 + 60 + + + switch2 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch2 + 10.0.0.46 + 1 + 180 + 60 + + + switch2 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch2 + 10.0.0.48 + 1 + 180 + 60 + + + switch2 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch2 + 10.0.0.50 + 1 + 180 + 60 + + + switch2 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch2 + 10.0.0.52 + 1 + 180 + 60 + + + switch2 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch2 + 10.0.0.54 + 1 + 180 + 60 + + + switch2 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch2 + 10.0.0.56 + 1 + 180 + 60 + + + switch2 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch2 + 10.0.0.58 + 1 + 180 + 60 + + + switch2 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch2 + 10.0.0.60 + 1 + 180 + 60 + + + switch2 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch2 + 10.0.0.62 + 1 + 180 + 60 + + + switch2 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch2 + + +
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 + + + + + + + + switch2 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch2 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + switch2 + ACS-MSN2700 +
diff --git a/files/image_config/minigraph/minigraph_Force10-S6000.xml b/files/image_config/minigraph/minigraph_Force10-S6000.xml new file mode 100644 index 000000000000..76ede4bc8ba5 --- /dev/null +++ b/files/image_config/minigraph/minigraph_Force10-S6000.xml @@ -0,0 +1,1043 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + fortyGigE0/0 + 10.0.0.0/31 + + + + fortyGigE0/4 + 10.0.0.2/31 + + + + fortyGigE0/8 + 10.0.0.4/31 + + + + fortyGigE0/12 + 10.0.0.6/31 + + + + fortyGigE0/16 + 10.0.0.8/31 + + + + fortyGigE0/20 + 10.0.0.10/31 + + + + fortyGigE0/24 + 10.0.0.12/31 + + + + fortyGigE0/28 + 10.0.0.14/31 + + + + fortyGigE0/32 + 10.0.0.16/31 + + + + fortyGigE0/36 + 10.0.0.18/31 + + + + fortyGigE0/40 + 10.0.0.20/31 + + + + fortyGigE0/44 + 10.0.0.22/31 + + + + fortyGigE0/48 + 10.0.0.24/31 + + + + fortyGigE0/52 + 10.0.0.26/31 + + + + fortyGigE0/56 + 10.0.0.28/31 + + + + fortyGigE0/60 + 10.0.0.30/31 + + + + fortyGigE0/64 + 10.0.0.32/31 + + + + fortyGigE0/68 + 10.0.0.34/31 + + + + fortyGigE0/72 + 10.0.0.36/31 + + + + fortyGigE0/76 + 10.0.0.38/31 + + + + fortyGigE0/80 + 10.0.0.40/31 + + + + fortyGigE0/84 + 10.0.0.42/31 + + + + fortyGigE0/88 + 10.0.0.44/31 + + + + fortyGigE0/92 + 10.0.0.46/31 + + + + fortyGigE0/96 + 10.0.0.48/31 + + + + fortyGigE0/100 + 10.0.0.50/31 + + + + fortyGigE0/104 + 10.0.0.52/31 + + + + fortyGigE0/108 + 10.0.0.54/31 + + + + fortyGigE0/112 + 10.0.0.56/31 + + + + fortyGigE0/116 + 10.0.0.58/31 + + + + fortyGigE0/120 + 10.0.0.60/31 + + + + fortyGigE0/124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + fortyGigE0/0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fortyGigE0/124 + ARISTA16T0 + Ethernet1 + + + + switch1 + Force10-S6000 +
diff --git a/files/image_config/ntp/ntp-config.service b/files/image_config/ntp/ntp-config.service new file mode 100644 index 000000000000..5cfcc72f328d --- /dev/null +++ b/files/image_config/ntp/ntp-config.service @@ -0,0 +1,11 @@ +[Unit] +Description=Update NTP configuration +Before=ntp.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/ntp-config.sh + +[Install] +WantedBy=multi-user.target + diff --git a/files/image_config/ntp/ntp-config.sh b/files/image_config/ntp/ntp-config.sh new file mode 100755 index 000000000000..0989dfae74be --- /dev/null +++ b/files/image_config/ntp/ntp-config.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/ntp.yml -t /etc/sonic/templates/ntp.conf.j2 >/etc/ntp.conf diff --git a/files/image_config/ntp/ntp.conf.j2 b/files/image_config/ntp/ntp.conf.j2 new file mode 100644 index 000000000000..3ae0c1804e52 --- /dev/null +++ b/files/image_config/ntp/ntp.conf.j2 @@ -0,0 +1,63 @@ +############################################################################### +# Managed by Ansible +# file: ansible/roles/acs/templates/ntp.conf.j2 +############################################################################### + +# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help + +driftfile /var/lib/ntp/ntp.drift + + +# Enable this if you want statistics to be logged. +#statsdir /var/log/ntpstats/ + +statistics loopstats peerstats clockstats +filegen loopstats file loopstats type day enable +filegen peerstats file peerstats type day enable +filegen clockstats file clockstats type day enable + + +# You do need to talk to an NTP server or two (or three). +#server ntp.your-provider.example + +# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will +# pick a different set every time it starts up. Please consider joining the +# pool: +{% for ntp_server in ntp_servers %} +server {{ ntp_server }} iburst +{% endfor %} + +#only listen on localhost and eth0 ips (default is to listen on all ip addresses) +interface ignore wildcard +interface listen {{ minigraph_mgmt_interface.addr }} +interface listen 127.0.0.1 + +# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for +# details. The web page +# might also be helpful. +# +# Note that "restrict" applies to both servers and clients, so a configuration +# that might be intended to block requests from certain clients could also end +# up blocking replies from your own upstream servers. + +# By default, exchange time with everybody, but don't allow configuration. +restrict -4 default kod notrap nomodify nopeer noquery +restrict -6 default kod notrap nomodify nopeer noquery + +# Local users may interrogate the ntp server more closely. +restrict 127.0.0.1 +restrict ::1 + +# Clients from this (example!) subnet have unlimited access, but only if +# cryptographically authenticated. +#restrict 192.168.123.0 mask 255.255.255.0 notrust + + +# If you want to provide time to your local subnet, change the next line. +# (Again, the address is an example only.) +#broadcast 192.168.123.255 + +# If you want to listen to time broadcasts on your local subnet, de-comment the +# next lines. Please do this only if you trust everybody on the network! +#disable auth +#broadcastclient diff --git a/files/image_config/ntp/ntp.yml b/files/image_config/ntp/ntp.yml new file mode 100644 index 000000000000..efb3a5272fcc --- /dev/null +++ b/files/image_config/ntp/ntp.yml @@ -0,0 +1,6 @@ +ntp_servers: + - 0.debian.pool.ntp.org + - 1.debian.pool.ntp.org + - 2.debian.pool.ntp.org + - 3.debian.pool.ntp.org + diff --git a/files/image_config/rsyslog/rsyslog-config.service b/files/image_config/rsyslog/rsyslog-config.service new file mode 100644 index 000000000000..37f7bc04c650 --- /dev/null +++ b/files/image_config/rsyslog/rsyslog-config.service @@ -0,0 +1,11 @@ +[Unit] +Description=Update rsyslog configuration +Before=rsyslog.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/rsyslog-config.sh + +[Install] +WantedBy=multi-user.target + diff --git a/files/image_config/rsyslog/rsyslog-config.sh b/files/image_config/rsyslog/rsyslog-config.sh new file mode 100755 index 000000000000..a5c46849183a --- /dev/null +++ b/files/image_config/rsyslog/rsyslog-config.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/rsyslog.yml -t /etc/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf diff --git a/files/image_config/rsyslog/rsyslog.conf.j2 b/files/image_config/rsyslog/rsyslog.conf.j2 new file mode 100644 index 000000000000..e00565f056eb --- /dev/null +++ b/files/image_config/rsyslog/rsyslog.conf.j2 @@ -0,0 +1,71 @@ +############################################################################### +# Managed by Ansible +# file: ansible/roles/acs/templates/rsyslog.conf.j2 +############################################################################### +# +# /etc/rsyslog.conf Configuration file for rsyslog. +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html + + +################# +#### MODULES #### +################# + +$ModLoad imuxsock # provides support for local system logging +$ModLoad imklog # provides kernel logging support +#$ModLoad immark # provides --MARK-- message capability + +# provides UDP syslog reception +$ModLoad imudp +$UDPServerAddress 127.0.0.1 # bind to localhost before udp server run +$UDPServerRun 514 + +# provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +########################### +#### GLOBAL DIRECTIVES #### +########################### +#Set remote syslog server +{% for server in syslog_servers %} +*.* @{{ server }}:514 +{% endfor %} + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# Define a custom template +$template ACSFileFormat,"%TIMESTAMP% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" +$ActionFileDefaultTemplate ACSFileFormat + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# +# Where to place spool and state files +# +$WorkDirectory /var/spool/rsyslog + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + + +############### +#### RULES #### +############### + diff --git a/files/image_config/rsyslog/rsyslog.d/00-acs.conf b/files/image_config/rsyslog/rsyslog.d/00-acs.conf new file mode 100644 index 000000000000..ec8ce919f402 --- /dev/null +++ b/files/image_config/rsyslog/rsyslog.d/00-acs.conf @@ -0,0 +1,46 @@ +## Quagga rules + +if $programname == "zebra" then { + /var/log/quagga/zebra.log + stop +} + +if $programname == "bgpd" then { + /var/log/quagga/bgpd.log + stop +} + +if $programname == "quagga" then { + /var/log/quagga/zebra.log + stop +} + +if $programname == "watchquagga" then { + /var/log/quagga/zebra.log + stop +} + +## Platform modules rules +if $programname == "platform-modules" then { + /var/log/syslog + stop +} + +## Sensord rules +if $programname == "sensord" then { + /var/log/syslog + stop +} + +## Sswsyncd rules +if $programname == "sswsyncd" then { + /var/log/syslog + stop +} + +## Ansible rules +if $programname startswith "ansible" then { + /var/log/messages + stop +} + diff --git a/files/image_config/rsyslog/rsyslog.d/99-default.conf b/files/image_config/rsyslog/rsyslog.d/99-default.conf new file mode 100644 index 000000000000..a26ba7baf8e6 --- /dev/null +++ b/files/image_config/rsyslog/rsyslog.d/99-default.conf @@ -0,0 +1,66 @@ +# +# First some standard log files. Log by facility. +# +auth,authpriv.* /var/log/auth.log +*.*;auth,authpriv.none -/var/log/syslog +cron.* /var/log/cron.log +daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +kern.* -/var/persist/log/kern.log +lpr.* -/var/log/lpr.log +mail.* -/var/log/mail.log +user.* -/var/log/user.log + +# +# Logging for the mail system. Split it up so that +# it is easy to write scripts to parse these files. +# +mail.info -/var/log/mail.info +mail.warn -/var/log/mail.warn +mail.err /var/log/mail.err + +# +# Logging for INN news system. +# +news.crit /var/log/news/news.crit +news.err /var/log/news/news.err +news.notice -/var/log/news/news.notice + +# +# Some "catch-all" log files. +# +*.=debug;\ + auth,authpriv.none;\ + news.none;mail.none -/var/log/debug +*.=info;*.=notice;*.=warn;\ + auth,authpriv.none;\ + cron,daemon.none;\ + mail,news.none -/var/log/messages +*.=crit;*.=alert;*.=emerg -/var/persist/log/alarms +# +# Emergencies are sent to everybody logged in. +# +*.emerg :omusrmsg:* + +# +# I like to have messages displayed on the console, but only on a virtual +# console I usually leave idle. +# +#daemon,mail.*;\ +# news.=crit;news.=err;news.=notice;\ +# *.=debug;*.=info;\ +# *.=notice;*.=warn /dev/tty8 + +# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, +# you must invoke `xconsole' with the `-file' option: +# +# $ xconsole -file /dev/xconsole [...] +# +# NOTE: adjust the list below, or you'll go crazy if you have a reasonably +# busy site.. +# +daemon.*;mail.*;\ + news.err;\ + *.=debug;*.=info;\ + *.=notice;*.=warn |/dev/xconsole + diff --git a/files/image_config/rsyslog/rsyslog.yml b/files/image_config/rsyslog/rsyslog.yml new file mode 100644 index 000000000000..006271123b9d --- /dev/null +++ b/files/image_config/rsyslog/rsyslog.yml @@ -0,0 +1 @@ +syslog_servers: [] diff --git a/files/image_config/snmp/snmp.yml b/files/image_config/snmp/snmp.yml new file mode 100644 index 000000000000..13c9d7bd7d77 --- /dev/null +++ b/files/image_config/snmp/snmp.yml @@ -0,0 +1 @@ +snmp_rocommunity: public diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers new file mode 100644 index 000000000000..57248ee8c1c4 --- /dev/null +++ b/files/image_config/sudoers/sudoers @@ -0,0 +1,33 @@ +# +# This file MUST be edited with the 'visudo' command as root. +# +# Please consider adding local content in /etc/sudoers.d/ instead of +# directly modifying this file. +# +# See the man page for details on how to write a sudoers file. +# +Defaults env_reset +#Defaults mail_badpass +Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" +Defaults env_keep += "VTYSH_PAGER" + +# Host alias specification + +# User alias specification + +# Cmnd alias specification +# Note: bcmcmd is dangerous for users in read only netgroups because it may operate ASIC +Cmnd_Alias READ_ONLY_CMDS = /usr/bin/portstat,\ + /usr/bin/vtysh -c "show.*" + +# User privilege specification +root ALL=(ALL:ALL) ALL + +# Allow members of group sudo to execute any command +%sudo ALL=(ALL:ALL) NOPASSWD: ALL + + +# See sudoers(5) for more information on "#include" directives: + +#includedir /etc/sudoers.d + diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 90253e56f26e..b8177462a55c 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -397,6 +397,10 @@ ${onie_bin} mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || { # Decompress the file for the file system directly to the partition unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt +if [ -f $demo_mnt/$FILESYSTEM_DOCKERFS ]; then + cd $demo_mnt && tar xf $FILESYSTEM_DOCKERFS; cd $OLDPWD +fi + # Store machine description in target file system cp /etc/machine.conf $demo_mnt diff --git a/onie-image.conf b/onie-image.conf index 389c4dd50256..61fad731b975 100644 --- a/onie-image.conf +++ b/onie-image.conf @@ -18,5 +18,8 @@ FILESYSTEM_SQUASHFS=fs.squashfs ## Filename for onie installer payload, will be the main part of onie installer ONIE_INSTALLER_PAYLOAD=fs.zip +## Filename for docker file system +FILESYSTEM_DOCKERFS=dockerfs.tar.gz + ## Output file name for onie installer OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin diff --git a/platform/broadcom/platform.conf b/platform/broadcom/platform.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index d1865d2eaf55..395d211d93d9 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,9 +1,8 @@ -include $(PLATFORM_GENERIC_PATH)/rules.mk - include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk +include $(PLATFORM_PATH)/single-image.mk BCMCMD = bcmcmd $(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmcmd?sv=2015-04-05&sr=b&sig=X3bFApmsNFmcnWM9mSGRxBugPcg%2FgJCHh5hhSuV1M2c%3D&se=2030-08-23T14%3A41%3A56Z&sp=r" @@ -13,9 +12,7 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) -SONIC_ALL += $(DOCKER_SYNCD_BRCM) \ - $(DOCKER_ORCHAGENT_BRCM) \ - debs/$(BRCM_OPENNSL_KERNEL) +SONIC_ALL += $(SONIC_SINGLE_IMAGE) # Inject brcm sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) diff --git a/platform/broadcom/single-image.mk b/platform/broadcom/single-image.mk new file mode 100644 index 000000000000..f1c9a88af767 --- /dev/null +++ b/platform/broadcom/single-image.mk @@ -0,0 +1,8 @@ +# sonic mellanox single image installer + +SONIC_SINGLE_IMAGE = sonic-broadcom.bin +$(SONIC_SINGLE_IMAGE)_MACHINE = broadcom +$(SONIC_SINGLE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_SINGLE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) +$(SONIC_SINGLE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_SINGLE_IMAGE) diff --git a/platform/cavium/platform.conf b/platform/cavium/platform.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 7ed8ea17e24b..e8d16cc73657 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -1,12 +1,10 @@ -include $(PLATFORM_GENERIC_PATH)/rules.mk - include $(PLATFORM_PATH)/cavm-sai.mk include $(PLATFORM_PATH)/docker-syncd-cavm.mk include $(PLATFORM_PATH)/docker-orchagent-cavm.mk include $(PLATFORM_PATH)/cavm_platform_modules.mk +include $(PLATFORM_PATH)/single-image.mk -SONIC_ALL += $(DOCKER_SYNCD_CAVM) \ - $(DOCKER_ORCHAGENT_CAVM) +SONIC_ALL += $(SONIC_SINGLE_IMAGE) # Inject cavium sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) diff --git a/platform/cavium/single-image.mk b/platform/cavium/single-image.mk new file mode 100644 index 000000000000..f9f6fefe57dd --- /dev/null +++ b/platform/cavium/single-image.mk @@ -0,0 +1,8 @@ +# sonic mellanox single image installer + +SONIC_SINGLE_IMAGE = sonic-cavium.bin +$(SONIC_SINGLE_IMAGE)_MACHINE = cavium +$(SONIC_SINGLE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_SINGLE_IMAGE)_DEPENDS += $(CAVM_PLATFORM_DEB) +$(SONIC_SINGLE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_SINGLE_IMAGE) diff --git a/platform/generic/aboot-image.mk b/platform/generic/aboot-image.mk new file mode 100644 index 000000000000..0f332eb75402 --- /dev/null +++ b/platform/generic/aboot-image.mk @@ -0,0 +1,9 @@ +# sonic aboot installer + +SONIC_GENERIC_ABOOT_IMAGE = sonic-aboot.bin +$(SONIC_GENERIC_ABOOT_IMAGE)_MACHINE = aboot +$(SONIC_GENERIC_ABOOT_IMAGE)_IMAGE_TYPE = aboot +$(SONIC_GENERIC_ABOOT_IMAGE)_DEPENDS = +$(SONIC_GENERIC_ABOOT_IMAGE)_DOCKERS = +SONIC_INSTALLERS += $(SONIC_GENERIC_ABOOT_IMAGE) + diff --git a/platform/generic/onie-image.mk b/platform/generic/onie-image.mk new file mode 100644 index 000000000000..67f8adba61e1 --- /dev/null +++ b/platform/generic/onie-image.mk @@ -0,0 +1,8 @@ +# sonic generic ONIE image installer + +SONIC_GENERIC_ONIE_IMAGE = sonic-generic.bin +$(SONIC_GENERIC_ONIE_IMAGE)_MACHINE = generic +$(SONIC_GENERIC_ONIE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_GENERIC_ONIE_IMAGE)_DEPENDS = +$(SONIC_GENERIC_ONIE_IMAGE)_DOCKERS = +SONIC_INSTALLERS += $(SONIC_GENERIC_ONIE_IMAGE) diff --git a/platform/generic/platform.conf b/platform/generic/platform.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/generic/rules.mk b/platform/generic/rules.mk index 0ce1f562c0ad..bc2507740277 100644 --- a/platform/generic/rules.mk +++ b/platform/generic/rules.mk @@ -1,8 +1,10 @@ +include $(PLATFORM_PATH)/aboot-image.mk +include $(PLATFORM_PATH)/onie-image.mk + SONIC_ALL += $(DOCKER_DATABASE) \ - $(DOCKER_FPM) \ - $(DOCKER_TEAMD) \ $(DOCKER_LLDP_SV2) \ $(DOCKER_SNMP_SV2) \ $(DOCKER_PLATFORM_MONITOR) \ $(DOCKER_DHCP_RELAY) \ - $(DOCKER_PTF) + $(DOCKER_PTF) \ + $(SONIC_GENERIC_ONIE_IMAGE) diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index a2138c029ff9..682c91f45c0d 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -5,3 +5,13 @@ $(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent $(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) + +$(DOCKER_ORCHAGENT_MLNX)_CONTAINER_NAME = swss +$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --volumes-from database +$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro +$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro +$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro +$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf +$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 81d27aacea46..ee15e9c3089f 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -6,3 +6,10 @@ $(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(MFT) $(PYTHON_SDK_API) $(DOCKER_SYNCD_MLNX)_FILES += $(MLNX_FW) $(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) + +$(DOCKER_SYNCD_MLNX)_CONTAINER_NAME = syncd +$(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 += --volumes-from database +$(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/mellanox/platform.conf b/platform/mellanox/platform.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index debf4a4606da..a881b7bee6ec 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -1,5 +1,3 @@ -include $(PLATFORM_GENERIC_PATH)/rules.mk - include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/fw.mk include $(PLATFORM_PATH)/mft.mk @@ -7,17 +5,9 @@ include $(PLATFORM_PATH)/mlnx-sai.mk include $(PLATFORM_PATH)/hw-management.mk include $(PLATFORM_PATH)/docker-syncd-mlnx.mk include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk +include $(PLATFORM_PATH)/single-image.mk -SONIC_ALL += $(DOCKER_SYNCD_MLNX) \ - $(DOCKER_ORCHAGENT_MLNX) \ - $(DOCKER_FPM) \ - $(DOCKER_DATABASE) \ - $(DOCKER_LLDP_SV2) \ - $(DOCKER_SNMP_SV2) \ - $(DOCKER_TEAMD) \ - $(DOCKER_PLATFORM_MONITOR) \ - debs/$(MLNX_HW_MANAGEMENT) \ - debs/$(SX_KERNEL) +SONIC_ALL += $(SONIC_SINGLE_IMAGE) # Inject mlnx sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) diff --git a/platform/mellanox/single-image.mk b/platform/mellanox/single-image.mk new file mode 100644 index 000000000000..7ed23da850ce --- /dev/null +++ b/platform/mellanox/single-image.mk @@ -0,0 +1,8 @@ +# sonic mellanox single image installer + +SONIC_SINGLE_IMAGE = sonic-mellanox.bin +$(SONIC_SINGLE_IMAGE)_MACHINE = mellanox +$(SONIC_SINGLE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_SINGLE_IMAGE)_DEPENDS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) +$(SONIC_SINGLE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_SINGLE_IMAGE) diff --git a/rules/docker-database.mk b/rules/docker-database.mk index 0bd7233acdc4..168164a02636 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -5,3 +5,9 @@ $(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/docker-database $(DOCKER_DATABASE)_DEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) $(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DATABASE) + +$(DOCKER_DATABASE)_CONTAINER_NAME = database +$(DOCKER_DATABASE)_RUN_OPT += --net=host --privileged -t +$(DOCKER_DATABASE)_RUN_OPT += -v /var/run/redis + diff --git a/rules/docker-fpm.mk b/rules/docker-fpm.mk index 48d35592d402..090c2b61cc1f 100644 --- a/rules/docker-fpm.mk +++ b/rules/docker-fpm.mk @@ -5,3 +5,9 @@ $(DOCKER_FPM)_PATH = $(DOCKERS_PATH)/docker-fpm $(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS) $(SONIC_CONFIG_ENGINE) $(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_FPM) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM) + +$(DOCKER_FPM)_CONTAINER_NAME = bgp +$(DOCKER_FPM)_RUN_OPT += --net=host --privileged -t +$(DOCKER_FPM)_RUN_OPT += --volumes-from database +$(DOCKER_FPM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/docker-lldp-sv2.mk b/rules/docker-lldp-sv2.mk index b2efe81e8b70..7041a24f81db 100644 --- a/rules/docker-lldp-sv2.mk +++ b/rules/docker-lldp-sv2.mk @@ -6,3 +6,8 @@ $(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) $(SONIC_CONFIG_ENGINE) $(DOCKER_LLDP_SV2)_PYTHON_WHEELS += $(DBSYNCD_PY2) $(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) + +$(DOCKER_LLDP_SV2)_CONTAINER_NAME = lldp +$(DOCKER_LLDP_SV2)_RUN_OPT += --net=host --privileged -t +$(DOCKER_LLDP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk index 619e48f5591d..1d55cbded808 100644 --- a/rules/docker-snmp-sv2.mk +++ b/rules/docker-snmp-sv2.mk @@ -6,3 +6,9 @@ $(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) $(SONIC_CONFIG_ENGINE) $(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(ASYNCSNMP_PY3) $(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) + +$(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp +$(DOCKER_SNMP_SV2)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro +$(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index 4924b2b18891..ec242589b290 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -5,3 +5,8 @@ $(DOCKER_TEAMD)_PATH = $(DOCKERS_PATH)/docker-teamd $(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_CONFIG_ENGINE) $(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD) + +$(DOCKER_TEAMD)_CONTAINER_NAME = teamd +$(DOCKER_TEAMD)_RUN_OPT += --net=host --privileged -t +$(DOCKER_TEAMD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/sonic-aboot.mk b/rules/sonic-aboot.mk deleted file mode 100644 index c2762cfa012e..000000000000 --- a/rules/sonic-aboot.mk +++ /dev/null @@ -1,6 +0,0 @@ -# sonic aboot installer - -SONIC_ABOOT = sonic-aboot.bin -$(SONIC_ABOOT)_MACHINE = aboot -$(SONIC_ABOOT)_DEPENDS += $(LINUX_KERNEL) $(INITRAMFS_TOOLS) $(IGB_DRIVER) -SONIC_INSTALLERS += $(SONIC_ABOOT) diff --git a/rules/sonic-generic.mk b/rules/sonic-generic.mk deleted file mode 100644 index 807e26dbfd0e..000000000000 --- a/rules/sonic-generic.mk +++ /dev/null @@ -1,6 +0,0 @@ -# sonic generic installer - -SONIC_GENERIC = sonic-generic.bin -$(SONIC_GENERIC)_MACHINE = generic -$(SONIC_GENERIC)_DEPENDS += $(LINUX_KERNEL) $(INITRAMFS_TOOLS) $(IGB_DRIVER) -SONIC_INSTALLERS += $(SONIC_GENERIC) diff --git a/slave.mk b/slave.mk index a97f4d83f5ba..485f8ff9206c 100644 --- a/slave.mk +++ b/slave.mk @@ -24,9 +24,9 @@ DEBS_PATH = $(TARGET_PATH)/debs PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels PROJECT_ROOT = $(shell pwd) -CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo undefined) +CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo generic) +CONFIGURED_SKU := $(shell [ -f .sku ] && cat .sku || echo undefined) PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM) -PLATFORM_GENERIC_PATH = platform/generic ############################################################################### ## Utility rules @@ -34,27 +34,38 @@ PLATFORM_GENERIC_PATH = platform/generic ############################################################################### .platform : +ifneq ($(CONFIGURED_PLATFORM),generic) @echo Build system is not configured, please run make configure @exit 1 +endif + +.sku : +ifneq ($(CONFIGURED_PLATFORM),generic) + @echo Build system is not configured, please run make configure + @exit 1 +endif configure : @mkdir -p target/debs @mkdir -p target/python-wheels @echo $(PLATFORM) > .platform + @echo $(SKU) > .sku -distclean : .platform clean - @rm -f .platform +distclean : .platform .sku clean + @rm -f .platform .sku ############################################################################### ## Include other rules ############################################################################### + include $(RULES_PATH)/config include $(RULES_PATH)/functions include $(RULES_PATH)/*.mk ifneq ($(CONFIGURED_PLATFORM), undefined) include $(PLATFORM_PATH)/rules.mk endif +export CONFIGURED_SKU MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) @@ -274,10 +285,47 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER)) $(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $(HEADER) + ## Pass initramfs and linux kernel explicitly. They are used for all platforms + export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" + export linux_kernel="$(DEBS_PATH)/$(LINUX_KERNEL)" + export kversion="$(KVERSION)" + export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))" + export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" + export config_engine="$(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE))" + export image_type="$($*_IMAGE_TYPE)" + export sonicadmin_user="$(USERNAME)" + export sonic_hwsku="$(CONFIGURED_SKU)" + $(foreach docker, $($*_DOCKERS),\ + export docker_image="$(docker)" + export docker_image_name="$(basename $(docker))" + export docker_container_name="$($(docker)_CONTAINER_NAME)" + export docker_image_run_opt="$($(docker)_RUN_OPT)" + j2 files/build_templates/docker_image_ctl.j2 > $($(docker)_CONTAINER_NAME).sh + j2 files/build_templates/$($(docker)_CONTAINER_NAME).service.j2 > $($(docker)_CONTAINER_NAME).service + chmod +x $($(docker)_CONTAINER_NAME).sh + ) + + export installer_start_scrips="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))" + export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(docker)_CONTAINER_NAME)))" + + $(if $($*_DOCKERS), + j2 files/build_templates/sonic_debian_extension.j2 > sonic_debian_extension.sh + chmod +x sonic_debian_extension.sh, + ) + ./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG) - TARGET_MACHINE=$($*_MACHINE) ./build_image.sh $(LOG) + TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) ./build_image.sh $(LOG) + + $(foreach docker, $($*_DOCKERS), \ + rm $($(docker)_CONTAINER_NAME).sh + rm $($(docker)_CONTAINER_NAME).service + ) + + $(if $($*_DOCKERS), + rm sonic_debian_extension.sh, + ) $(FOOTER) ############################################################################### @@ -326,4 +374,4 @@ all : .platform $$(addprefix $(TARGET_PATH)/,$$(SONIC_ALL)) .PHONY : $(SONIC_CLEAN_DEBS) $(SONIC_CLEAN_TARGETS) $(SONIC_CLEAN_WHEELS) clean distclean configure -.INTERMEDIATE : $(SONIC_INSTALL_TARGETS) $(SONIC_INSTALL_WHEELS) $(DOCKER_LOAD_TARGETS) docker-start +.INTERMEDIATE : $(SONIC_INSTALL_TARGETS) $(SONIC_INSTALL_WHEELS) $(DOCKER_LOAD_TARGETS) docker-start .platform .sku diff --git a/src/sonic-config-engine/platform/AS7512/alias_map.json b/src/sonic-config-engine/platform/AS7512/alias_map.json new file mode 100644 index 000000000000..53be265702cc --- /dev/null +++ b/src/sonic-config-engine/platform/AS7512/alias_map.json @@ -0,0 +1 @@ +#TODO: Add correct info here diff --git a/src/sonic-config-engine/platform/AS7512/port_config.ini b/src/sonic-config-engine/platform/AS7512/port_config.ini new file mode 100644 index 000000000000..1d60deaf60fc --- /dev/null +++ b/src/sonic-config-engine/platform/AS7512/port_config.ini @@ -0,0 +1 @@ +# TODO: Add correct info here diff --git a/src/sonic-config-engine/platform/AS7512/sensors.conf b/src/sonic-config-engine/platform/AS7512/sensors.conf new file mode 100644 index 000000000000..1d60deaf60fc --- /dev/null +++ b/src/sonic-config-engine/platform/AS7512/sensors.conf @@ -0,0 +1 @@ +# TODO: Add correct info here From f2eed8f8a027d840dfc28655aa900a7d07d4b47b Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Sun, 29 Jan 2017 21:34:12 +0200 Subject: [PATCH 0212/1833] Added support of ONIE version 2016.11-5.1.0001 for Mellanox platforms. (#218) --- dockers/docker-orchagent/start.sh | 2 +- installer/x86_64/platforms/x86_64-mlnx_msn2700-r0 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 installer/x86_64/platforms/x86_64-mlnx_msn2700-r0 diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 9530f39261f5..ca97c03a12f5 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -46,7 +46,7 @@ elif [ "$aboot_platform" == "x86_64-arista_7050_qx32" ]; then PORTSYNCD_ARGS+="-p /etc/ssw/Arista-7050-QX32/port_config.ini" SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " -elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ]; then +elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ] || [ "$onie_platform" == "x86_64-mlnx_msn2700-r0" ]; then PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini" elif [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" diff --git a/installer/x86_64/platforms/x86_64-mlnx_msn2700-r0 b/installer/x86_64/platforms/x86_64-mlnx_msn2700-r0 new file mode 100644 index 000000000000..c9c9493a5404 --- /dev/null +++ b/installer/x86_64/platforms/x86_64-mlnx_msn2700-r0 @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" From 4e3bbc8e1399e53fdb931f716204d6a10f542c6e Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 29 Jan 2017 16:10:35 -0800 Subject: [PATCH 0213/1833] update build instruction for one image --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c821fd47ecbc..3eae25214f93 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,14 @@ If it is already cloned, however there is no files under ./dockers/docker-base/ To build NOS installer image and docker images, run command line - make configure PLATFORM=[VENDOR] + make configure PLATFORM=[ASIC_VENDOR] SKU=[HW_SKU] make -Supported VENDORs are: -- broadcom -- mellanox -- cavium -- p4 +Supported PLATFORM AND SKU are: +- PLATFORM=broadcom SKU=Force10-S6000 +- PLATFORM=mellanox SKU=ACS-MSN2700 +- PLATFORM=cavium SKU=AS7512 +- PLATFORM=p4 You can find rules/config file useful. It contains configuration options for build process, like adding more verbosity or showing dependencies, username and password for base image etc. From be8ed80554e74d40ea5b587f1c2d889e71e35801 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 30 Jan 2017 17:33:03 -0800 Subject: [PATCH 0214/1833] teamd: Use 75% links upperbound as min-links (#224) --- dockers/docker-teamd/teamd.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 index 7c6e4b355e0b..ebc5bba43fd9 100644 --- a/dockers/docker-teamd/teamd.j2 +++ b/dockers/docker-teamd/teamd.j2 @@ -3,7 +3,8 @@ "runner": { "name": "lacp", "active": true, - "min_ports": 2, +{# Use 75% links upperbound as min-links #} + "min_ports": {{ minigraph_portchannel_interfaces[pc] | length * 0.75 | round(0, 'ceil') | int}}, "tx_hash": ["eth", "ipv4", "ipv6"] }, "link_watch": { From afe3fbf82fd70d1d06327793337a221d6b634d64 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 31 Jan 2017 11:47:52 -0800 Subject: [PATCH 0215/1833] make tty as an option in docker run (#225) --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5c93afad6a91..b819d41cfb67 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ MAKEFLAGS += -B DOCKER_RUN := docker run --rm=true --privileged \ -v $(PWD):/sonic \ - -it sonic-slave-$(USER) + -i$(SONIC_SLAVE_TTY) DOCKER_BUILD = docker build --no-cache \ --build-arg user=$(USER) \ @@ -26,7 +26,7 @@ DOCKER_BUILD = docker build --no-cache \ %:: @docker inspect --type image sonic-slave-$(USER) &> /dev/null || $(DOCKER_BUILD) - @$(DOCKER_RUN) make \ + @$(DOCKER_RUN) sonic-slave-$(USER) make \ -C sonic \ -f slave.mk \ PLATFORM=$(PLATFORM) \ @@ -37,4 +37,4 @@ sonic-slave-build : @$(DOCKER_BUILD) sonic-slave-bash : - @$(DOCKER_RUN) bash + @$(DOCKER_RUN) -t sonic-slave-$(USER) bash From 5278f1a0e5b6583388ccc7fc8d32935a44caa62c Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 31 Jan 2017 12:04:06 -0800 Subject: [PATCH 0216/1833] add instructions to change git path to relative path --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 3eae25214f93..611ff644f06d 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ If it is already cloned, however there is no files under ./dockers/docker-base/ git submodule update --init --recursive +You also need to change all git paths to relative path as we build all submodules inside the docker. + + git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $(realpath --relative-to=. $(cut -d" " -f2 .git))" > .git' + # Usage **NOTE:** In order to be more familiar with build process and make some hanges to it, it is recommended to read this short [Documentation](README.buildsystem.md) From c2b4c870c682f5868faea536545dac313e301d95 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 31 Jan 2017 22:05:24 -0800 Subject: [PATCH 0217/1833] remove fsroot after build (#228) --- build_debian.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index 11d8217ff8bf..d79a05275b17 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -271,3 +271,6 @@ pushd $FILESYSTEM_ROOT && sudo tar czf $OLDPWD/$FILESYSTEM_DOCKERFS var/lib/dock ## Compress together with /boot and /var/lib/docker as an installer payload zip file pushd $FILESYSTEM_ROOT && sudo zip $OLDPWD/$ONIE_INSTALLER_PAYLOAD -r boot/; popd sudo zip -g $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS $FILESYSTEM_DOCKERFS + +## Remove fsroot +sudo rm -rf $FILESYSTEM_ROOT From 1786a3389d5e9f7987b857478d208edcac167e31 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 31 Jan 2017 22:06:12 -0800 Subject: [PATCH 0218/1833] rename single image to one image (#220) * rename single image to one image --- platform/broadcom/one-image.mk | 8 ++++++++ platform/broadcom/rules.mk | 4 ++-- platform/broadcom/single-image.mk | 8 -------- platform/cavium/one-image.mk | 8 ++++++++ platform/cavium/rules.mk | 4 ++-- platform/cavium/single-image.mk | 8 -------- platform/mellanox/one-image.mk | 8 ++++++++ platform/mellanox/rules.mk | 4 ++-- platform/mellanox/single-image.mk | 8 -------- 9 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 platform/broadcom/one-image.mk delete mode 100644 platform/broadcom/single-image.mk create mode 100644 platform/cavium/one-image.mk delete mode 100644 platform/cavium/single-image.mk create mode 100644 platform/mellanox/one-image.mk delete mode 100644 platform/mellanox/single-image.mk diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk new file mode 100644 index 000000000000..0b91fdba3086 --- /dev/null +++ b/platform/broadcom/one-image.mk @@ -0,0 +1,8 @@ +# sonic broadcom one image installer + +SONIC_ONE_IMAGE = sonic-broadcom.bin +$(SONIC_ONE_IMAGE)_MACHINE = broadcom +$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_ONE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 395d211d93d9..80e2d3800455 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -2,7 +2,7 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk -include $(PLATFORM_PATH)/single-image.mk +include $(PLATFORM_PATH)/one-image.mk BCMCMD = bcmcmd $(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmcmd?sv=2015-04-05&sr=b&sig=X3bFApmsNFmcnWM9mSGRxBugPcg%2FgJCHh5hhSuV1M2c%3D&se=2030-08-23T14%3A41%3A56Z&sp=r" @@ -12,7 +12,7 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) -SONIC_ALL += $(SONIC_SINGLE_IMAGE) +SONIC_ALL += $(SONIC_ONE_IMAGE) # Inject brcm sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) diff --git a/platform/broadcom/single-image.mk b/platform/broadcom/single-image.mk deleted file mode 100644 index f1c9a88af767..000000000000 --- a/platform/broadcom/single-image.mk +++ /dev/null @@ -1,8 +0,0 @@ -# sonic mellanox single image installer - -SONIC_SINGLE_IMAGE = sonic-broadcom.bin -$(SONIC_SINGLE_IMAGE)_MACHINE = broadcom -$(SONIC_SINGLE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_SINGLE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) -$(SONIC_SINGLE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) -SONIC_INSTALLERS += $(SONIC_SINGLE_IMAGE) diff --git a/platform/cavium/one-image.mk b/platform/cavium/one-image.mk new file mode 100644 index 000000000000..0b011f77ac48 --- /dev/null +++ b/platform/cavium/one-image.mk @@ -0,0 +1,8 @@ +# sonic cavium one image installer + +SONIC_ONE_IMAGE = sonic-cavium.bin +$(SONIC_ONE_IMAGE)_MACHINE = cavium +$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_ONE_IMAGE)_DEPENDS += $(CAVM_PLATFORM_DEB) +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index e8d16cc73657..6fb9d8c267ef 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -2,9 +2,9 @@ include $(PLATFORM_PATH)/cavm-sai.mk include $(PLATFORM_PATH)/docker-syncd-cavm.mk include $(PLATFORM_PATH)/docker-orchagent-cavm.mk include $(PLATFORM_PATH)/cavm_platform_modules.mk -include $(PLATFORM_PATH)/single-image.mk +include $(PLATFORM_PATH)/one-image.mk -SONIC_ALL += $(SONIC_SINGLE_IMAGE) +SONIC_ALL += $(SONIC_ONE_IMAGE) # Inject cavium sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) diff --git a/platform/cavium/single-image.mk b/platform/cavium/single-image.mk deleted file mode 100644 index f9f6fefe57dd..000000000000 --- a/platform/cavium/single-image.mk +++ /dev/null @@ -1,8 +0,0 @@ -# sonic mellanox single image installer - -SONIC_SINGLE_IMAGE = sonic-cavium.bin -$(SONIC_SINGLE_IMAGE)_MACHINE = cavium -$(SONIC_SINGLE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_SINGLE_IMAGE)_DEPENDS += $(CAVM_PLATFORM_DEB) -$(SONIC_SINGLE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) -SONIC_INSTALLERS += $(SONIC_SINGLE_IMAGE) diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk new file mode 100644 index 000000000000..1aa8da3928da --- /dev/null +++ b/platform/mellanox/one-image.mk @@ -0,0 +1,8 @@ +# sonic mellanox one image installer + +SONIC_ONE_IMAGE = sonic-mellanox.bin +$(SONIC_ONE_IMAGE)_MACHINE = mellanox +$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_ONE_IMAGE)_DEPENDS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index a881b7bee6ec..2c10cf3337c8 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -5,9 +5,9 @@ include $(PLATFORM_PATH)/mlnx-sai.mk include $(PLATFORM_PATH)/hw-management.mk include $(PLATFORM_PATH)/docker-syncd-mlnx.mk include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk -include $(PLATFORM_PATH)/single-image.mk +include $(PLATFORM_PATH)/one-image.mk -SONIC_ALL += $(SONIC_SINGLE_IMAGE) +SONIC_ALL += $(SONIC_ONE_IMAGE) # Inject mlnx sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) diff --git a/platform/mellanox/single-image.mk b/platform/mellanox/single-image.mk deleted file mode 100644 index 7ed23da850ce..000000000000 --- a/platform/mellanox/single-image.mk +++ /dev/null @@ -1,8 +0,0 @@ -# sonic mellanox single image installer - -SONIC_SINGLE_IMAGE = sonic-mellanox.bin -$(SONIC_SINGLE_IMAGE)_MACHINE = mellanox -$(SONIC_SINGLE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_SINGLE_IMAGE)_DEPENDS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) -$(SONIC_SINGLE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) -SONIC_INSTALLERS += $(SONIC_SINGLE_IMAGE) From 4ce17b100fc4d9cf3beb671fb27c55d4d1756d90 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Wed, 1 Feb 2017 10:09:02 +0200 Subject: [PATCH 0219/1833] Install orchagent and syncd containers to Broadcom and Cavium images (#227) --- platform/broadcom/docker-orchagent-brcm.mk | 10 ++++++++++ platform/broadcom/docker-syncd-brcm.mk | 7 +++++++ platform/cavium/docker-orchagent-cavm.mk | 10 ++++++++++ platform/cavium/docker-syncd-cavm.mk | 7 +++++++ 4 files changed, 34 insertions(+) diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index c847d93b748d..646626ff89dd 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -5,3 +5,13 @@ $(DOCKER_ORCHAGENT_BRCM)_PATH = $(DOCKERS_PATH)/docker-orchagent $(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) + +$(DOCKER_ORCHAGENT_BRCM)_CONTAINER_NAME = swss +$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --volumes-from database +$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro +$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro +$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro +$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf +$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index e1f02c59fa12..870cba30c854 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -6,3 +6,10 @@ $(DOCKER_SYNCD_BRCM)_DEPENDS += $(SYNCD) $(DOCKER_SYNCD_BRCM)_FILES += $(DSSERVE) $(BCMCMD) $(DOCKER_SYNCD_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM) + +$(DOCKER_SYNCD_BRCM)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BRCM)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_BRCM)_RUN_OPT += --volumes-from database +$(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index b66c7dbf0395..9befdb11e87d 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -5,3 +5,13 @@ $(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent $(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) + +$(DOCKER_ORCHAGENT_CAVM)_CONTAINER_NAME = swss +$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --volumes-from database +$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro +$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro +$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro +$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf +$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index ec410ca3052d..b6efd184bd1f 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -5,3 +5,10 @@ $(DOCKER_SYNCD_CAVM)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm $(DOCKER_SYNCD_CAVM)_DEPENDS += $(SYNCD) $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS) $(DOCKER_SYNCD_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) + +$(DOCKER_SYNCD_CAVM)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CAVM)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_CAVM)_RUN_OPT += --volumes-from database +$(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro From 1c074367a160f085f8085d0279ce1ed3c31f09d6 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 1 Feb 2017 00:10:40 -0800 Subject: [PATCH 0220/1833] Add daemon file which was missing in docker-fpm (#229) --- dockers/docker-fpm/Dockerfile.j2 | 1 + dockers/docker-fpm/daemons | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 dockers/docker-fpm/daemons diff --git a/dockers/docker-fpm/Dockerfile.j2 b/dockers/docker-fpm/Dockerfile.j2 index dfd3450743fc..ea4aa226badb 100644 --- a/dockers/docker-fpm/Dockerfile.j2 +++ b/dockers/docker-fpm/Dockerfile.j2 @@ -24,6 +24,7 @@ RUN rm -rf /debs COPY ["*.j2", "/etc/swss/bgp/"] COPY ["start.sh", "config.sh", "/usr/bin/"] +COPY ["daemons", "/etc/quagga/"] ENTRYPOINT /usr/bin/config.sh \ && /usr/bin/start.sh \ diff --git a/dockers/docker-fpm/daemons b/dockers/docker-fpm/daemons new file mode 100644 index 000000000000..cb7c2322c9fb --- /dev/null +++ b/dockers/docker-fpm/daemons @@ -0,0 +1,31 @@ +# This file tells the quagga package which daemons to start. +# +# Entries are in the format: =(yes|no|priority) +# 0, "no" = disabled +# 1, "yes" = highest priority +# 2 .. 10 = lower priorities +# Read /usr/share/doc/quagga/README.Debian for details. +# +# Sample configurations for these daemons can be found in +# /usr/share/doc/quagga/examples/. +# +# ATTENTION: +# +# When activation a daemon at the first time, a config file, even if it is +# empty, has to be present *and* be owned by the user and group "quagga", else +# the daemon will not be started by /etc/init.d/quagga. The permissions should +# be u=rw,g=r,o=. +# When using "vtysh" such a config file is also needed. It should be owned by +# group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. +# +# The watchquagga daemon is always started. Per default in monitoring-only but +# that can be changed via /etc/quagga/debian.conf. +# +zebra=yes +bgpd=yes +ospfd=no +ospf6d=no +ripd=no +ripngd=no +isisd=no +babeld=no From fbe272154357e759290fc4c121627f8de929cddb Mon Sep 17 00:00:00 2001 From: Petro Karashchenko Date: Wed, 1 Feb 2017 21:56:50 +0200 Subject: [PATCH 0221/1833] [sonic-slave]: Fix issue "no space left on disk" while trying to add user in docker (#233) Note: related to https://github.com/docker/docker/issues/5419 Signed-off-by: Petro Karashchenko --- sonic-slave/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 2a06770dfed9..41c65e3465b2 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -99,7 +99,7 @@ ARG guid RUN groupadd -f -r -g $guid g$user -RUN useradd $user -u $uid -g $guid -d /var/$user -m -s /bin/bash +RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash RUN gpasswd -a $user docker From ddbda4ce2ebc8a72cb91b8352ebfde4ce02a7501 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 1 Feb 2017 22:49:43 +0200 Subject: [PATCH 0222/1833] docker: Add ipaddress python module to the PTF docker (#231) Needed for the FIB test --- dockers/docker-ptf/Dockerfile.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 78f2eb260480..3f2f1cad8276 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -66,6 +66,7 @@ RUN rm -rf /debs \ && pip install --upgrade cffi==1.7.0 \ && pip install nnpy \ && pip install dpkt \ + && pip install ipaddress \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py From d6f0c4611bf70255eed59cb406d64d4f98a31bac Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Wed, 1 Feb 2017 23:02:08 +0200 Subject: [PATCH 0223/1833] Add platform-monitor container to one image. (#232) --- files/build_templates/pmon.service.j2 | 12 ++++++++++++ rules/docker-platform-monitor.mk | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 files/build_templates/pmon.service.j2 diff --git a/files/build_templates/pmon.service.j2 b/files/build_templates/pmon.service.j2 new file mode 100644 index 000000000000..d50f5be628de --- /dev/null +++ b/files/build_templates/pmon.service.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=Platform monitor container +Requires=database.service +After=database.service + +[Service] +User={{ sonicadmin_user }} +ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStop=/usr/bin/{{docker_container_name}}.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 51997cc41516..223e87bfac78 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -6,3 +6,8 @@ $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(SONIC_CONFIG_ENGINE) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) + +$(DOCKER_PLATFORM_MONITOR)_CONTAINER_NAME = pmon +$(DOCKER_PLATFORM_MONITOR)_RUN_OPT += --net=host --privileged -t +$(DOCKER_PLATFORM_MONITOR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro From 921db0511a90096c42abdb890e4aec018258c492 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Wed, 1 Feb 2017 13:02:29 -0800 Subject: [PATCH 0224/1833] Update boot0 (#202) - Refactor of the whole script for readability purpose - Now detect the root= partition automatically - Allow more parameters to be passed to the cmdline using /mnt/flash/kernel-params - /host/machine.conf file will have to be generated at a later stage since Aboot doesn't have enough information about the platform here --- files/Aboot/boot0 | 99 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 30 deletions(-) diff --git a/files/Aboot/boot0 b/files/Aboot/boot0 index 8a0d0b77cf11..8318ccc0e071 100644 --- a/files/Aboot/boot0 +++ b/files/Aboot/boot0 @@ -18,9 +18,20 @@ set -x +kernel=boot/vmlinuz-3.16.0-4-amd64 +initrd=boot/initrd.img-3.16.0-4-amd64 +kernel_params=kernel-params + +aboot_machine="arista_unknown" + +target_path=/mnt/flash + +# expect the swi to be a non empty file +[ -s "$swipath" ] || exit 1 + bootconfigvars="SWI SWI_COPY POST_LEVEL CONSOLESPEED PASSWORD NETDEV NETAUTO NETIP NETMASK NETGW NETDOMAIN NETDNS NETHW memtest" -parseenvironmentconfig() { +parse_environment_config() { for n in ${bootconfigvars}; do eval v="\$$n" if [ "$v" ]; then @@ -29,34 +40,19 @@ parseenvironmentconfig() { done } -kernel=boot/vmlinuz-3.16.0-4-amd64 -initrd=boot/initrd.img-3.16.0-4-amd64 - -TARGET_PATH=/mnt/flash -if [ -d "${swipath}" ]; then - # Not expect a directory name for swipath - exit 1 -fi - -## Check the hash file in the image, and determine to install or just skip -GIT_REVISION=$(unzip -p ${swipath} .imagehash) -LOCAL_IMAGEHASH=$(cat $TARGET_PATH/.imagehash 2>/dev/null || true) -if [ "$GIT_REVISION" != "$LOCAL_IMAGEHASH" ]; then +extract_image() { ## Clean old directory for read-write layer - rm -rf ${TARGET_PATH}/rw + rm -rf "$target_path/rw" ## Unzip the image - unzip -oq ${swipath} -x boot0 -d ${TARGET_PATH} + unzip -oq "$swipath" -x boot0 -d "$target_path" +} +write_machine_config() { ## Detect SKU and create a hardware description file - aboot_version=`grep ^Aboot /etc/cmdline | sed 's/^.*norcal.-//'` - aboot_build_date=`stat -c %y /bin/sysinit | sed 's/ /T/'` - if `grep -q platform=raven /etc/cmdline`; then - aboot_machine=arista_7050_qx32 - else - aboot_machine=arista_7050_qx32s - fi - cat < ${TARGET_PATH}/machine.conf + aboot_version=$(grep ^Aboot /etc/cmdline | sed 's/^.*norcal.-//') + aboot_build_date=$(stat -c %y /bin/sysinit | sed 's/ /T/') + cat < ${target_path}/machine.conf aboot_version=$aboot_version aboot_vendor=arista aboot_platform=x86_64-$aboot_machine @@ -64,15 +60,58 @@ aboot_machine=$aboot_machine aboot_arch=x86_64 aboot_build_date=$aboot_build_date EOF +} -fi +platform_specific() { + local platform="$(grep -Eo 'platform=[^ ]+' /etc/cmdline | cut -f2 -d=)" + # This is temporary as the platform= parameter doesn't provide enough + # information to identify the SKU + # An initramfs hook or a later processing done by the initscripts will be + # required + if [ "$platform" = "raven" ]; then + aboot_machine=arista_7050_qx32 + echo "modprobe.blacklist=radeon" >>/tmp/append + fi + if [ "$platform" = "crow" ]; then + aboot_machine=arista_7050_qx32s + fi +} -echo "${append}" >/tmp/append -parseenvironmentconfig >>/tmp/append +echo "$append" >/tmp/append +parse_environment_config >>/tmp/append cat /etc/cmdline | sed "/^\(${bootconfigvars// /\|}\|crashkernel\|loglevel\|ignore_loglevel\)\(\$\|=\)/d;/^\$/d" >>/tmp/append -echo "root=/dev/sda1 rw loop=fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor quiet" >>/tmp/append +echo "rw loop=fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor quiet" >>/tmp/append + +# process platform specific operations +platform_specific + +# use extra parameters from kernel-params hook if the file exists +if [ -f "$target_path/$kernel_params" ]; then + cat "$target_path/$kernel_params" >>/tmp/append +fi + +# setting root partition if not overridden by kernel-params +if ! grep -q "root=" /tmp/append; then + rootdev=$(mount | grep '/mnt/flash' | cut -f1 -d' ') + rootfstype=$(mount | grep '/mnt/flash' | cut -f5 -d' ') + # reformat if vfat? + echo "root=$rootdev" >>/tmp/append +fi + +# check the hash file in the image, and determine to install or just skip +GIT_REVISION=$(unzip -p "$swipath" .imagehash) +LOCAL_IMAGEHASH=$(cat $target_path/.imagehash 2>/dev/null || true) +if [ "$GIT_REVISION" != "$LOCAL_IMAGEHASH" ]; then + extract_image + write_machine_config +fi + +# chainloading using kexec +initrd_path="$target_path/$initrd" +kernel_path="$target_path/$kernel" +cmdline="$(tr '\n' ' ' Date: Wed, 1 Feb 2017 19:44:54 -0800 Subject: [PATCH 0225/1833] Update submodule sonic-snmpagent (#236) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 2e7fe1b2a9c3..fabc4412d5df 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 2e7fe1b2a9c3fafdc49d0063d1fb9e5396fd3649 +Subproject commit fabc4412d5dfa3eb04796352ac20681eb09298c3 From 61d4509f0b44b06a542000720175ca7a3738e29e Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 1 Feb 2017 21:29:50 -0800 Subject: [PATCH 0226/1833] Add new sonic-config dependencies to dhcp_relay Dockerfile (#237) --- dockers/docker-dhcp-relay/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile index 6ff95da88d7c..fdb00bc1e211 100644 --- a/dockers/docker-dhcp-relay/Dockerfile +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -1,5 +1,8 @@ FROM docker-base +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive From caab516ea752ae771f83934a711024bec7b2461a Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 2 Feb 2017 07:53:46 -0800 Subject: [PATCH 0227/1833] [snmpd]: download source files from azure storage blob (#239) --- src/snmpd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/snmpd/Makefile b/src/snmpd/Makefile index 4cd036655af4..ace9fa6d4b87 100644 --- a/src/snmpd/Makefile +++ b/src/snmpd/Makefile @@ -17,9 +17,9 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf net-snmp-$(SNMPD_VERSION) # download debian net-snmp - wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_$(SNMPD_VERSION_FULL).dsc - wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_$(SNMPD_VERSION).orig.tar.xz - wget http://http.debian.net/debian/pool/main/n/net-snmp/net-snmp_$(SNMPD_VERSION_FULL).debian.tar.xz + wget -NO net-snmp_$(SNMPD_VERSION_FULL).dsc "https://sonicstorage.blob.core.windows.net/packages/net-snmp_5.7.3+dfsg-1.5.dsc?sv=2015-04-05&sr=b&sig=vDAYAKlwi7JjF%2FesdJUyf4VIEXPsCfLhqqTqNr75zBs%3D&se=2030-10-12T13%3A59%3A45Z&sp=r" + wget -NO net-snmp_$(SNMPD_VERSION).orig.tar.xz "https://sonicstorage.blob.core.windows.net/packages/net-snmp_5.7.3+dfsg.orig.tar.xz?sv=2015-04-05&sr=b&sig=UjIh%2FTcHrIEzEV7a%2BV2ZP4ks3xHlAA3wqyxkyV7Ms8I%3D&se=2030-10-12T13%3A58%3A19Z&sp=r" + wget -NO net-snmp_$(SNMPD_VERSION_FULL).debian.tar.xz "https://sonicstorage.blob.core.windows.net/packages/net-snmp_5.7.3+dfsg-1.5.debian.tar.xz?sv=2015-04-05&sr=b&sig=xJkmxjtKXYcPe4yR%2FuCA0TXUfT40rj4XUMBaiK9CjsA%3D&se=2030-10-12T14%3A00%3A15Z&sp=r" dpkg-source -x net-snmp_$(SNMPD_VERSION_FULL).dsc pushd net-snmp-$(SNMPD_VERSION) From 4cd3d31946398e49ad4c5f93754eef78f95ff8b7 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 2 Feb 2017 11:12:04 -0800 Subject: [PATCH 0228/1833] Update APT package lists before first attempt to install (#241) * Update APT package lists before first attempt to install * Move setting of environment variable before first call to apt-get --- dockers/docker-dhcp-relay/Dockerfile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile index fdb00bc1e211..f664d89a4a2e 100644 --- a/dockers/docker-dhcp-relay/Dockerfile +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -1,16 +1,18 @@ FROM docker-base -# Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +# Update APT package lists +RUN apt-get update + +# Dependencies for sonic-cfggen +RUN apt-get -y install python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + ## Install isc-dhcp-relay and clean up afterward -RUN apt-get update \ - && apt-get -y install isc-dhcp-relay \ - && apt-get clean -y \ - && apt-get autoclean -y \ +RUN apt-get -y install isc-dhcp-relay \ + && apt-get clean -y \ + && apt-get autoclean -y \ && apt-get autoremove -y COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"] From 793b842d600c8c29f49f04df16127e403a49df10 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Thu, 2 Feb 2017 21:19:48 +0200 Subject: [PATCH 0229/1833] Add DHCP client hook to update hostname. (#235) * Add DHCP client hook to update hostname. * Remove interface checking * Update hostname in /etc/hosts file --- build_debian.sh | 1 + files/dhcp/sethostname | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 files/dhcp/sethostname diff --git a/build_debian.sh b/build_debian.sh index d79a05275b17..e113e6925107 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -240,6 +240,7 @@ iface eth0 inet dhcp EOF sudo cp files/dhcp/rfc3442-classless-routes $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d +sudo cp files/dhcp/sethostname $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d/ if [ -f sonic_debian_extension.sh ]; then ./sonic_debian_extension.sh $FILESYSTEM_ROOT diff --git a/files/dhcp/sethostname b/files/dhcp/sethostname new file mode 100644 index 000000000000..81bd458935fc --- /dev/null +++ b/files/dhcp/sethostname @@ -0,0 +1,20 @@ +#!/bin/bash +# This script is to update hostname of the system. + +if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] \ + && [ "$reason" != REBIND ] && [ "$reason" != REBOOT ] +then + exit 0 +fi + +current_host_name=`hostname -s` + +if [ "$current_host_name" != "$new_host_name" ] +then + echo $new_host_name > /etc/hostname + line_to_replace=`grep 127.0.0.1.*$current_host_name /etc/hosts` + new_line=`echo $line_to_replace | sed "s/$current_host_name/$new_host_name/"` + sed -i "s/$line_to_replace/$new_line/" /etc/hosts + + hostname -F /etc/hostname +fi From c05a9f2fd87da6c318e70c8132b75f9a00060b41 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 2 Feb 2017 18:11:39 -0800 Subject: [PATCH 0230/1833] Update submodule sonic-snmpagent (#244) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index fabc4412d5df..5c30a369a94b 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit fabc4412d5dfa3eb04796352ac20681eb09298c3 +Subproject commit 5c30a369a94b9312a8858c3bc9a3db083d835900 From 523a738068bc1975edc44b6954c028b23d02077d Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 2 Feb 2017 18:28:06 -0800 Subject: [PATCH 0231/1833] add dell platform driver to broadcom one image (#242) --- .gitmodules | 3 +++ platform/broadcom/one-image.mk | 2 +- platform/broadcom/platform-modules-s6000.mk | 10 ++++++++++ platform/broadcom/rules.mk | 1 + .../broadcom/sonic-platform-modules-s6000 | 1 + platform/mellanox/hw-management.mk | 1 + platform/mellanox/mft.mk | 1 + rules/linux-kernel.mk | 19 ++++++++++++++----- src/sonic-linux-kernel | 2 +- 9 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 platform/broadcom/platform-modules-s6000.mk create mode 160000 platform/broadcom/sonic-platform-modules-s6000 diff --git a/.gitmodules b/.gitmodules index c8b1acdb78ec..d9188126bf7a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -47,3 +47,6 @@ [submodule "src/sonic-utilities"] path = src/sonic-utilities url = https://github.com/Azure/sonic-utilities +[submodule "platform/broadcom/sonic-platform-modules-s6000"] + path = platform/broadcom/sonic-platform-modules-s6000 + url = https://github.com/Azure/sonic-platform-modules-s6000 diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 0b91fdba3086..59939fb72e7c 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -3,6 +3,6 @@ SONIC_ONE_IMAGE = sonic-broadcom.bin $(SONIC_ONE_IMAGE)_MACHINE = broadcom $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) +$(SONIC_ONE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) $(DELL_S6000_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-s6000.mk b/platform/broadcom/platform-modules-s6000.mk new file mode 100644 index 000000000000..a32ab67c7aa8 --- /dev/null +++ b/platform/broadcom/platform-modules-s6000.mk @@ -0,0 +1,10 @@ +# Dell S6000 Platform modules + +DELL_S6000_PLATFORM_MODULE_VERSION = 1.0 + +export DELL_S6000_PLATFORM_MODULE_VERSION + +DELL_S6000_PLATFORM_MODULE = platform-modules-s6000_$(DELL_S6000_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELL_S6000_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-s6000 +$(DELL_S6000_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_DPKG_DEBS += $(DELL_S6000_PLATFORM_MODULE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 80e2d3800455..cd34b9c23bf6 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,5 +1,6 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk +include $(PLATFORM_PATH)/platform-modules-s6000.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/one-image.mk diff --git a/platform/broadcom/sonic-platform-modules-s6000 b/platform/broadcom/sonic-platform-modules-s6000 new file mode 160000 index 000000000000..1f6c70e7db89 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000 @@ -0,0 +1 @@ +Subproject commit 1f6c70e7db890851510a36892b602c534e4f41a7 diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 1aa63862306e..47863d180dbf 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -6,4 +6,5 @@ export MLNX_HW_MANAGEMENT_VERSION MLNX_HW_MANAGEMENT = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb $(MLNX_HW_MANAGEMENT)_SRC_PATH = $(PLATFORM_PATH)/hw-management +$(MLNX_HW_MANAGEMENT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_MAKE_DEBS += $(MLNX_HW_MANAGEMENT) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index 7dea01789af2..966cb48c013f 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -2,6 +2,7 @@ MFT = mft-4.5.0-31.amd64.deb $(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft +$(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_MAKE_DEBS += $(MFT) KERNEL_MFT = kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 46467666539e..228b48a9d34b 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -1,9 +1,18 @@ # linux kernel package -KVERSION = 3.16.0-4-amd64 +KVERSION_SHORT = 3.16.0-4 +KVERSION = $(KVERSION_SHORT)-amd64 +KERNEL_VERSION = 3.16.36 +KERNEL_SUBVERSION = 1+deb8u2 -export KVERSION +export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION -LINUX_KERNEL = linux-image-3.16.0-4-amd64_3.16.36-1+deb8u2_amd64.deb -$(LINUX_KERNEL)_SRC_PATH = $(SRC_PATH)/sonic-linux-kernel -SONIC_MAKE_DEBS += $(LINUX_KERNEL) +LINUX_HEADERS_COMMON = linux-headers-$(KVERSION_SHORT)-common_$(KERNEL_VERSION)-$(KERNEL_SUBVERSION)_amd64.deb +$(LINUX_HEADERS_COMMON)_SRC_PATH = $(SRC_PATH)/sonic-linux-kernel +SONIC_MAKE_DEBS += $(LINUX_HEADERS_COMMON) + +LINUX_HEADERS = linux-headers-$(KVERSION)_$(KERNEL_VERSION)-$(KERNEL_SUBVERSION)_amd64.deb +$(eval $(call add_derived_package,$(LINUX_HEADERS_COMMON),$(LINUX_HEADERS))) + +LINUX_KERNEL = linux-image-$(KVERSION)_$(KERNEL_VERSION)-$(KERNEL_SUBVERSION)_amd64.deb +$(eval $(call add_derived_package,$(LINUX_HEADERS_COMMON),$(LINUX_KERNEL))) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 7f3b4e4949aa..777792e7e8fc 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 7f3b4e4949aa39481221a0ebf88d055676091916 +Subproject commit 777792e7e8fcdcd4b994f4dfca8ea5369855960c From 60e1fc3c9812a48caf9724dd4cae1858eb4c9a93 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 2 Feb 2017 20:34:34 -0800 Subject: [PATCH 0232/1833] ONEImage - Read all platform dependent information from sonic-config-engine (#238) Read all platform dependent information from sonic-config-engine --- dockers/docker-orchagent/Dockerfile.j2 | 3 ++ dockers/docker-orchagent/start.sh | 18 ++++------ dockers/docker-snmp-sv2/config.sh | 7 ++-- dockers/docker-snmp-sv2/sysDescription.j2 | 2 +- .../build_templates/sonic_debian_extension.j2 | 11 ++---- files/build_templates/sonic_version.yml.j2 | 4 +++ files/build_templates/sysDescription.j2 | 1 - platform/broadcom/docker-orchagent-brcm.mk | 3 +- platform/cavium/docker-orchagent-cavm.mk | 3 +- platform/mellanox/docker-orchagent-mlnx.mk | 3 +- rules/docker-snmp-sv2.mk | 1 - .../platform/AS7512/alias_map.json | 1 - .../platform/AS7512/port_config.ini | 34 ++++++++++++++++++- .../platform/AS7512/sensors.conf | 1 - src/sonic-config-engine/setup.py | 5 +-- 15 files changed, 61 insertions(+), 36 deletions(-) create mode 100644 files/build_templates/sonic_version.yml.j2 delete mode 100644 files/build_templates/sysDescription.j2 delete mode 100644 src/sonic-config-engine/platform/AS7512/alias_map.json delete mode 100644 src/sonic-config-engine/platform/AS7512/sensors.conf diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index cea7cb1a3a0e..9a72faf333f2 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -8,6 +8,9 @@ RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansso ## TODO: implicitly install dependencies RUN apt-get -y install libjemalloc1 +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + COPY \ {% for deb in docker_orchagent_debs.split(' ') -%} debs/{{ deb }}{{' '}} diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index ca97c03a12f5..4ef7638809e5 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -25,32 +25,28 @@ trap clean_up SIGTERM SIGKILL . /host/machine.conf +HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` + MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` ORCHAGENT_ARGS="" -PORTSYNCD_ARGS="" +PORTSYNCD_ARGS="-p /usr/share/sonic/$HWSKU/port_config.ini" SWSSCONFIG_ARGS="00-copp.config.json " -if [ "$onie_platform" == "x86_64-dell_s6000_s1220-r0" ]; then +if [ "$HWSKU" == "Force10-S6000" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - PORTSYNCD_ARGS+="-p /etc/ssw/Force10-S6000/port_config.ini" SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " -elif [ "$onie_platform" == "x86_64-dell_s6100_c2538-r0" ]; then +elif [ "$HWSKU" == "Force10-S6100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - PORTSYNCD_ARGS+="-p /etc/ssw/Force10-S6100/port_config.ini" -elif [ "$aboot_platform" == "x86_64-arista_7050_qx32" ]; then +elif [ "$HWSKU" == "Arista-7050-QX32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - PORTSYNCD_ARGS+="-p /etc/ssw/Arista-7050-QX32/port_config.ini" SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " -elif [ "$onie_platform" == "x86_64-mlnx_x86-r5.0.1400" ] || [ "$onie_platform" == "x86_64-mlnx_msn2700-r0" ]; then - PORTSYNCD_ARGS+="-p /etc/ssw/ACS-MSN2700/port_config.ini" -elif [ "$onie_platform" == "x86_64-accton_as7512_32x-r0" ]; then +elif [ "$HWSKU" == "AS7512" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - PORTSYNCD_ARGS+="-p /etc/ssw/AS7512/port_config.ini" fi service rsyslog start diff --git a/dockers/docker-snmp-sv2/config.sh b/dockers/docker-snmp-sv2/config.sh index d100573d931b..0681416b1acb 100755 --- a/dockers/docker-snmp-sv2/config.sh +++ b/dockers/docker-snmp-sv2/config.sh @@ -1,14 +1,15 @@ #!/bin/bash -#sysDescription is currently mounted, uncomment this line and provide version.yml instead if use copying instead of mounting -#sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/version.yml -t /etc/swss/snmp/sysDescription.j2 >/etc/ssw/sysDescription +mkdir -p /etc/ssw + +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/sonic_version.yml -t /etc/swss/snmp/sysDescription.j2 >/etc/ssw/sysDescription mkdir -p /etc/snmp sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /etc/swss/snmp/snmpd.conf.j2 >/etc/snmp/snmpd.conf hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` -/bin/cp -rf /etc/ssw/$hwsku/alias_map.json /etc/snmp/ +/bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/ mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status diff --git a/dockers/docker-snmp-sv2/sysDescription.j2 b/dockers/docker-snmp-sv2/sysDescription.j2 index a4871a6ffd44..54860a229d8b 100644 --- a/dockers/docker-snmp-sv2/sysDescription.j2 +++ b/dockers/docker-snmp-sv2/sysDescription.j2 @@ -1 +1 @@ -SONiC Software Version: {{ sonic_baseimage_version}}.SONiC.{{ sonic_version }} - HwSku: {{ minigraph_hwsku }} +SONiC Software Version: {{ build_version }}.SONiC.v2 - HwSku: {{ minigraph_hwsku }} - Distribution: Debian {{ debian_version }} - Kernel: {{ kernel_version }} diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 00fcf6732131..4cebcb2227e9 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -21,7 +21,6 @@ set -x -e . functions.sh BUILD_TEMPLATES=files/build_templates IMAGE_CONFIGS=files/image_config -VENDOR_CONFIGS=src/sonic-config-engine/platform {% if installer_debs.strip() -%} clean_sys() { @@ -46,7 +45,6 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} # Create all needed directories -sudo mkdir -p $FILESYSTEM_ROOT/etc/ssw/ sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/templates/ @@ -86,20 +84,17 @@ sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/etc/sonic/templates/ # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ -# Generate system desription file +# Generate build version file export git_revision=$(git rev-parse --short HEAD) export sonic_hwsku={{sonic_hwsku}} export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version` export kernel_version={{kversion}} -j2 $BUILD_TEMPLATES/sysDescription.j2 > sysDescription -sudo mv sysDescription $FILESYSTEM_ROOT/etc/ssw/ +j2 $BUILD_TEMPLATES/sonic_version.yml.j2 > sonic_version.yml +sudo mv sonic_version.yml $FILESYSTEM_ROOT/etc/sonic/ # Copy sudoers configuration file sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ -# Copy vendor specific configuration files -sudo cp -R $VENDOR_CONFIGS/{{sonic_hwsku}}/ $FILESYSTEM_ROOT/etc/ssw/ - {% for deb in installer_debs.strip().split(' ') -%} sudo dpkg --extract {{deb}} $FILESYSTEM_ROOT {% endfor %} diff --git a/files/build_templates/sonic_version.yml.j2 b/files/build_templates/sonic_version.yml.j2 new file mode 100644 index 000000000000..d0dd45aea56d --- /dev/null +++ b/files/build_templates/sonic_version.yml.j2 @@ -0,0 +1,4 @@ +build_version: {{git_revision}} +build_hwsku: {{sonic_hwsku}} +debian_version: {{debian_version}} +kernel_version: {{kernel_version}} diff --git a/files/build_templates/sysDescription.j2 b/files/build_templates/sysDescription.j2 deleted file mode 100644 index cfbdca1333d1..000000000000 --- a/files/build_templates/sysDescription.j2 +++ /dev/null @@ -1 +0,0 @@ -SONiC Software Version: SONiC-OS-{{git_revision}} HwSku: {{sonic_hwsku}} - Distribution: Debian {{debian_version}} - Kernel: {{kernel_version}} diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index 646626ff89dd..f04103ef15b8 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_BRCM = docker-orchagent-brcm.gz $(DOCKER_ORCHAGENT_BRCM)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE) $(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) @@ -10,7 +10,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) $(DOCKER_ORCHAGENT_BRCM)_CONTAINER_NAME = swss $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --volumes-from database -$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index 9befdb11e87d..e4ea73054921 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz $(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE) $(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) @@ -10,7 +10,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) $(DOCKER_ORCHAGENT_CAVM)_CONTAINER_NAME = swss $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --volumes-from database -$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index 682c91f45c0d..5b526cc6f35d 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz $(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE) $(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) @@ -10,7 +10,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) $(DOCKER_ORCHAGENT_MLNX)_CONTAINER_NAME = swss $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --volumes-from database -$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk index 1d55cbded808..e3ed0cf1eac8 100644 --- a/rules/docker-snmp-sv2.mk +++ b/rules/docker-snmp-sv2.mk @@ -10,5 +10,4 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) $(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp $(DOCKER_SNMP_SV2)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/ssw/:/etc/ssw/:ro $(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/src/sonic-config-engine/platform/AS7512/alias_map.json b/src/sonic-config-engine/platform/AS7512/alias_map.json deleted file mode 100644 index 53be265702cc..000000000000 --- a/src/sonic-config-engine/platform/AS7512/alias_map.json +++ /dev/null @@ -1 +0,0 @@ -#TODO: Add correct info here diff --git a/src/sonic-config-engine/platform/AS7512/port_config.ini b/src/sonic-config-engine/platform/AS7512/port_config.ini index 1d60deaf60fc..c35776dcfcc5 100644 --- a/src/sonic-config-engine/platform/AS7512/port_config.ini +++ b/src/sonic-config-engine/platform/AS7512/port_config.ini @@ -1 +1,33 @@ -# TODO: Add correct info here +# alias lanes +Ethernet0 16,17,18,19 +Ethernet4 20,21,22,23 +Ethernet8 24,25,26,27 +Ethernet12 28,29,30,31 +Ethernet16 32,33,34,35 +Ethernet20 36,37,38,39 +Ethernet24 40,41,42,43 +Ethernet28 44,45,46,47 +Ethernet32 0,1,2,3 +Ethernet36 4,5,6,7 +Ethernet40 8,9,10,11 +Ethernet44 12,13,14,15 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 127,126,125,124 +Ethernet68 123,122,121,120 +Ethernet72 115,114,113,112 +Ethernet76 119,118,117,116 +Ethernet80 79,78,77,76 +Ethernet84 75,74,73,72 +Ethernet88 64,65,66,67 +Ethernet92 71,70,68,69 +Ethernet96 111,110,109,108 +Ethernet100 107,106,105,104 +Ethernet104 103,102,101,100 +Ethernet108 99,98,97,96 +Ethernet112 95,94,93,92 +Ethernet116 91,90,89,88 +Ethernet120 87,86,85,84 +Ethernet124 83,82,81,80 diff --git a/src/sonic-config-engine/platform/AS7512/sensors.conf b/src/sonic-config-engine/platform/AS7512/sensors.conf deleted file mode 100644 index 1d60deaf60fc..000000000000 --- a/src/sonic-config-engine/platform/AS7512/sensors.conf +++ /dev/null @@ -1 +0,0 @@ -# TODO: Add correct info here diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 4c11ceb604ca..92f1b2f84869 100644 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -9,8 +9,9 @@ def get_platform_file_list(): data_path = os.path.join(repo_path, 'platform') platforms = os.listdir(data_path) for platform in platforms: - files = ['platform/' + platform + '/alias_map.json', - 'platform/' + platform + '/port_config.ini'] + files = ['platform/' + platform + '/port_config.ini'] + if os.path.isfile( os.path.join(data_path, platform, 'alias_map.json') ): + files.append('platform/' + platform + '/alias_map.json') #If a platform doesnot have alias_map.json minigraph.py will fall back to no alias mapping if os.path.isfile( os.path.join(data_path, platform, 'sensors.conf') ): files.append('platform/' + platform + '/sensors.conf') #Not all platforms need to have a sensors.conf file data_files.append( (os.path.join('/usr/share/sonic', platform), files) ) From b85c8dc89e25d02c2ac1d7628e5b2c9c7e917111 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 2 Feb 2017 21:10:07 -0800 Subject: [PATCH 0233/1833] Fix isc-dhcp-relay template (#246) --- dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 index 2d251172c543..07df5e1f9a76 100644 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -1,6 +1,6 @@ -SERVERS="{{ dhcp_servers | join(' ') }}" +SERVERS="{{ dhcp_servers }}" -INTERFACES="{{ minigraph_vlan_interfaces | join(' ') }}" +INTERFACES="{{ minigraph_vlan_interfaces[0]['name'] }}" # '-a' option provides option 82 circuit id information OPTIONS="-a" From 76cfd672d13538e3606e562c27392f99b8f1e2b3 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 3 Feb 2017 14:21:57 -0800 Subject: [PATCH 0234/1833] Conform with new Docker build method (#250) --- dockers/docker-dhcp-relay/Dockerfile | 25 ----------------- dockers/docker-dhcp-relay/Dockerfile.j2 | 37 +++++++++++++++++++++++++ rules/docker-dhcp-relay.mk | 10 +++++-- 3 files changed, 45 insertions(+), 27 deletions(-) delete mode 100644 dockers/docker-dhcp-relay/Dockerfile create mode 100644 dockers/docker-dhcp-relay/Dockerfile.j2 diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile deleted file mode 100644 index f664d89a4a2e..000000000000 --- a/dockers/docker-dhcp-relay/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM docker-base - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -# Update APT package lists -RUN apt-get update - -# Dependencies for sonic-cfggen -RUN apt-get -y install python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - -## Install isc-dhcp-relay and clean up afterward -RUN apt-get -y install isc-dhcp-relay \ - && apt-get clean -y \ - && apt-get autoclean -y \ - && apt-get autoremove -y - -COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"] -COPY ["config.sh", "/usr/bin/"] - -ENTRYPOINT /usr/bin/config.sh \ - && service rsyslog start \ - && service isc-dhcp-relay start \ - && /bin/bash - diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 new file mode 100644 index 000000000000..85ea74a4b164 --- /dev/null +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -0,0 +1,37 @@ +FROM docker-base + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +## Update APT package lists +RUN apt-get update + +## Dependencies for sonic-cfggen +RUN apt-get -y install python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + + +COPY \ +{% for deb in docker_dhcp_relay_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_dhcp_relay_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## Install isc-dhcp-relay Debian package +RUN apt-get -y install isc-dhcp-relay + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"] +COPY ["config.sh", "/usr/bin/"] + +ENTRYPOINT /usr/bin/config.sh \ + && service rsyslog start \ + && service isc-dhcp-relay start \ + && /bin/bash diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 1c68e8468a30..c0d88e595fd8 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -1,7 +1,13 @@ -# docker dhcp relay image +# Docker image for DHCP relay DOCKER_DHCP_RELAY = docker-dhcp-relay.gz $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay +$(DOCKER_DHCP_RELAY)_DEPENDS += $(SONIC_CONFIG_ENGINE) $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) -SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) + +$(DOCKER_DHCP_RELAY)_CONTAINER_NAME = dhcp_relay +$(DOCKER_DHCP_RELAY)_RUN_OPT += --net=host --privileged -t +$(DOCKER_DHCP_RELAY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro From 92b32fd9102f61fcfdbb75c179bd5bd5b3bcd381 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 3 Feb 2017 16:32:42 -0800 Subject: [PATCH 0235/1833] Add DCS-7060CX-32S support in boot0 (#243) --- files/Aboot/boot0 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/files/Aboot/boot0 b/files/Aboot/boot0 index 8318ccc0e071..79161e33806f 100644 --- a/files/Aboot/boot0 +++ b/files/Aboot/boot0 @@ -64,16 +64,22 @@ EOF platform_specific() { local platform="$(grep -Eo 'platform=[^ ]+' /etc/cmdline | cut -f2 -d=)" - # This is temporary as the platform= parameter doesn't provide enough + local sid="$(grep -Eo 'sid=[^ ]+' /etc/cmdline | cut -f2 -d=)" + # This is temporary as the platform= and sid= parameters don't provide enough # information to identify the SKU # An initramfs hook or a later processing done by the initscripts will be - # required + # required to read the system eeprom if [ "$platform" = "raven" ]; then aboot_machine=arista_7050_qx32 echo "modprobe.blacklist=radeon" >>/tmp/append fi if [ "$platform" = "crow" ]; then aboot_machine=arista_7050_qx32s + echo "modprobe.blacklist=radeon" >>/tmp/append + fi + if [ "$sid" = "Upperlake" ]; then + aboot_machine=arista_7060_cx32s + echo "amd_iommu=off" >> /tmp/append fi } @@ -95,7 +101,6 @@ fi if ! grep -q "root=" /tmp/append; then rootdev=$(mount | grep '/mnt/flash' | cut -f1 -d' ') rootfstype=$(mount | grep '/mnt/flash' | cut -f5 -d' ') - # reformat if vfat? echo "root=$rootdev" >>/tmp/append fi From e4ed979b831e348a0d5502349885b837fe5420b2 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 3 Feb 2017 16:33:33 -0800 Subject: [PATCH 0236/1833] Add version file to the SWI required by newer Aboot (#254) --- build_image.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build_image.sh b/build_image.sh index 5373b8da72c1..dc8d796ca8d9 100755 --- a/build_image.sh +++ b/build_image.sh @@ -35,6 +35,9 @@ elif [ "$IMAGE_TYPE" = "aboot" ]; then echo "$GIT_REVISION" >> .imagehash zip -g $OUTPUT_ONIE_IMAGE .imagehash rm .imagehash + echo "SWI_VERSION=42.0.0" > version + zip -g $OUTPUT_ONIE_IMAGE version + rm version else echo "Error: Non supported target platform: $TARGET_PLATFORM" exit 1 From 6f5262bc2c986d7cb98ff8a7a4f5cf447e7872e4 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 3 Feb 2017 17:39:09 -0800 Subject: [PATCH 0237/1833] Fix config bug in snmp (#252) 1. Modify snmp user to Debian-snmp to fit snmpd 5.7.3 2. Fix a bug that cause sysLocation to be missing from snmpd.conf --- dockers/docker-snmp-sv2/snmpd | 2 +- files/image_config/snmp/snmp.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dockers/docker-snmp-sv2/snmpd b/dockers/docker-snmp-sv2/snmpd index 4b35c6cc936a..576c366d2ba1 100644 --- a/dockers/docker-snmp-sv2/snmpd +++ b/dockers/docker-snmp-sv2/snmpd @@ -8,4 +8,4 @@ export MIBS= SNMPDRUN=yes # snmpd options (use syslog, close stdin/out/err). -SNMPDOPTS='-LS4d -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable -p /run/snmpd.pid' +SNMPDOPTS='-LS4d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable -p /run/snmpd.pid' diff --git a/files/image_config/snmp/snmp.yml b/files/image_config/snmp/snmp.yml index 13c9d7bd7d77..86f76c3a5cc3 100644 --- a/files/image_config/snmp/snmp.yml +++ b/files/image_config/snmp/snmp.yml @@ -1 +1,3 @@ snmp_rocommunity: public +snmp_location: public + From 5890204e42b7bf81899b607b6709d7f9c2377c4b Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 3 Feb 2017 18:09:56 -0800 Subject: [PATCH 0238/1833] Update port_config.ini (#256) --- .../platform/Force10-S6100/port_config.ini | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/src/sonic-config-engine/platform/Force10-S6100/port_config.ini b/src/sonic-config-engine/platform/Force10-S6100/port_config.ini index d0af86ad1a4f..67e558963f36 100644 --- a/src/sonic-config-engine/platform/Force10-S6100/port_config.ini +++ b/src/sonic-config-engine/platform/Force10-S6100/port_config.ini @@ -1,65 +1,65 @@ # alias lanes -Ethernet0 1,2 -Ethernet1 3,4 -Ethernet2 5,6 -Ethernet3 7,8 -Ethernet4 9,10 -Ethernet5 11,12 -Ethernet6 13,14 -Ethernet7 15,16 -Ethernet8 17,18 -Ethernet9 19,20 -Ethernet10 21,22 -Ethernet11 23,24 -Ethernet12 25,26 -Ethernet13 27,28 -Ethernet14 29,30 -Ethernet15 31,32 -Ethernet16 33,34 -Ethernet17 35,36 -Ethernet18 37,38 -Ethernet19 39,40 -Ethernet20 41,42 -Ethernet21 43,44 -Ethernet22 45,46 -Ethernet23 47,48 -Ethernet24 49,50 -Ethernet25 51,52 -Ethernet26 53,54 -Ethernet27 55,56 -Ethernet28 57,58 -Ethernet29 59,60 -Ethernet30 61,62 -Ethernet31 63,64 -Ethernet32 65,66 -Ethernet33 67,68 -Ethernet34 69,70 -Ethernet35 71,72 -Ethernet36 73,74 -Ethernet37 75,76 -Ethernet38 77,78 -Ethernet39 79,80 -Ethernet40 81,82 -Ethernet41 83,84 -Ethernet42 85,86 -Ethernet43 87,88 -Ethernet44 89,90 -Ethernet45 91,92 -Ethernet46 93,94 -Ethernet47 95,96 -Ethernet48 97,98 -Ethernet49 99,100 -Ethernet50 101,102 -Ethernet51 103,104 -Ethernet52 105,106 -Ethernet53 107,108 -Ethernet54 109,110 -Ethernet55 111,112 -Ethernet56 113,114 -Ethernet57 115,116 -Ethernet58 117,118 -Ethernet59 119,120 -Ethernet60 121,122 -Ethernet61 123,124 -Ethernet62 125,126 -Ethernet63 127,128 +Ethernet0 101,102 +Ethernet1 103,104 +Ethernet2 97,98 +Ethernet3 99,100 +Ethernet4 69,70 +Ethernet5 71,72 +Ethernet6 65,66 +Ethernet7 67,68 +Ethernet8 53,54 +Ethernet9 55,56 +Ethernet10 49,50 +Ethernet11 51,52 +Ethernet12 21,22 +Ethernet13 23,24 +Ethernet14 17,18 +Ethernet15 19,20 +Ethernet16 25,26 +Ethernet17 27,28 +Ethernet18 29,30 +Ethernet19 31,32 +Ethernet20 57,58 +Ethernet21 59,60 +Ethernet22 61,62 +Ethernet23 63,64 +Ethernet24 73,74 +Ethernet25 75,76 +Ethernet26 77,78 +Ethernet27 79,80 +Ethernet28 105,106 +Ethernet29 107,108 +Ethernet30 109,110 +Ethernet31 111,112 +Ethernet32 13,14 +Ethernet33 15,16 +Ethernet34 9,10 +Ethernet35 11,12 +Ethernet36 125,126 +Ethernet37 127,128 +Ethernet38 121,122 +Ethernet39 123,124 +Ethernet40 93,94 +Ethernet41 95,96 +Ethernet42 89,90 +Ethernet43 91,92 +Ethernet44 45,46 +Ethernet45 47,48 +Ethernet46 41,42 +Ethernet47 43,44 +Ethernet48 113,114 +Ethernet49 115,116 +Ethernet50 117,118 +Ethernet51 119,120 +Ethernet52 1,2 +Ethernet53 3,4 +Ethernet54 5,6 +Ethernet55 7,8 +Ethernet56 33,34 +Ethernet57 35,36 +Ethernet58 37,38 +Ethernet59 39,40 +Ethernet60 81,82 +Ethernet61 83,84 +Ethernet62 85,86 +Ethernet63 87,88 From 00fe0784b4e16009a177aa6e0dec415fd3983d78 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 3 Feb 2017 19:44:00 -0800 Subject: [PATCH 0239/1833] [Broadcom]: Update Broadcom debian packages and m3000-r0 m3000-r1 config.bcm files (#251) Signed-off-by: Shuotian Cheng --- dockers/docker-orchagent/Dockerfile.j2 | 4 ++-- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 9a72faf333f2..f085da93a55f 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -8,8 +8,8 @@ RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansso ## TODO: implicitly install dependencies RUN apt-get -y install libjemalloc1 -# Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml COPY \ {% for deb in docker_orchagent_debs.split(' ') -%} diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 6e768856e772..89a838d872de 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.0.3.7-3-20170118215303.119_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.0.3.7-3-20170118215303.119_amd64.deb?sv=2015-04-05&sr=b&sig=lmAbkYBRtlEDUwFxAGK0bpGOZ3QIrgzrF3WD%2Ba2tvvY%3D&se=2030-09-27T22%3A51%3A39Z&sp=r" +BRCM_SAI = libsaibcm_2.1.3.1+0-20170203082839.11-1.gbp995de3_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.3.1+0-20170203082839.11-1.gbp995de3_amd64.deb?sv=2015-04-05&sr=b&sig=q%2Byg1WtnhhGHBeOjyO7LfMZejwqER%2F7Hdr%2F%2Bxs%2FUFSA%3D&se=2030-10-13T19%3A49%3A10Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.0.3.7-3-20170118215303.119_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.3.1+0-20170203082839.11-1.gbp995de3_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.0.3.7-3-20170118215303.119_amd64.deb?sv=2015-04-05&sr=b&sig=e8tPGsXcOfVtMpQdwZKNOpHplezroAkIfxASfK%2BJDR8%3D&se=2030-09-27T22%3A49%3A47Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.3.1+0-20170203082839.11-1.gbp995de3_amd64.deb?sv=2015-04-05&sr=b&sig=ihcuduBFhzV5yj%2F2kI%2BzTshm85KFtm2XGqHcXo%2FwD5U%3D&se=2030-10-13T19%3A50%3A07Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 05c4b814d57c..c9f9662a72e5 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.1.5-3-20170118205520.58_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-3-20170118205520.58_amd64.deb?sv=2015-04-05&sr=b&sig=R3hWzXrbe4IMSBImAUwK30iSSTIfEtXku6ZYWDX5WhI%3D&se=2030-09-27T22%3A45%3A59Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.1.5-5-20170203072429.19_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-5-20170203072429.19_amd64.deb?sv=2015-04-05&sr=b&sig=ay3U2TMBqVOlDmT75PlLCn0olcjixH96whjjdPM4IGI%3D&se=2030-10-13T19%3A50%3A48Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-3-20170118205520.58_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-3-20170118205520.58_amd64.deb?sv=2015-04-05&sr=b&sig=RArOfg5ll6uVbrD0a4VLADHvpJktcJsMSOGYwQ7RZnQ%3D&se=2030-09-27T22%3A49%3A11Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-5-20170203072429.19_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-5-20170203072429.19_amd64.deb?sv=2015-04-05&sr=b&sig=WttrjSL1EtqPA50ZZEn52pOUojMqmP9e7Gdcrj9a%2FVI%3D&se=2030-10-13T19%3A51%3A16Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 68270f36df66fbe2713c837798ac3f663eeb0f03 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 3 Feb 2017 20:15:55 -0800 Subject: [PATCH 0240/1833] [build break]: Revert "Conform with new Docker build method" (#257) --- dockers/docker-dhcp-relay/Dockerfile | 25 +++++++++++++++++ dockers/docker-dhcp-relay/Dockerfile.j2 | 37 ------------------------- rules/docker-dhcp-relay.mk | 10 ++----- 3 files changed, 27 insertions(+), 45 deletions(-) create mode 100644 dockers/docker-dhcp-relay/Dockerfile delete mode 100644 dockers/docker-dhcp-relay/Dockerfile.j2 diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile new file mode 100644 index 000000000000..f664d89a4a2e --- /dev/null +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -0,0 +1,25 @@ +FROM docker-base + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Update APT package lists +RUN apt-get update + +# Dependencies for sonic-cfggen +RUN apt-get -y install python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + +## Install isc-dhcp-relay and clean up afterward +RUN apt-get -y install isc-dhcp-relay \ + && apt-get clean -y \ + && apt-get autoclean -y \ + && apt-get autoremove -y + +COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"] +COPY ["config.sh", "/usr/bin/"] + +ENTRYPOINT /usr/bin/config.sh \ + && service rsyslog start \ + && service isc-dhcp-relay start \ + && /bin/bash + diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 deleted file mode 100644 index 85ea74a4b164..000000000000 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ /dev/null @@ -1,37 +0,0 @@ -FROM docker-base - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -## Update APT package lists -RUN apt-get update - -## Dependencies for sonic-cfggen -RUN apt-get -y install python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - - -COPY \ -{% for deb in docker_dhcp_relay_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ - -RUN dpkg -i \ -{% for deb in docker_dhcp_relay_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} - -## Install isc-dhcp-relay Debian package -RUN apt-get -y install isc-dhcp-relay - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs - -COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"] -COPY ["config.sh", "/usr/bin/"] - -ENTRYPOINT /usr/bin/config.sh \ - && service rsyslog start \ - && service isc-dhcp-relay start \ - && /bin/bash diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index c0d88e595fd8..1c68e8468a30 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -1,13 +1,7 @@ -# Docker image for DHCP relay +# docker dhcp relay image DOCKER_DHCP_RELAY = docker-dhcp-relay.gz $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay -$(DOCKER_DHCP_RELAY)_DEPENDS += $(SONIC_CONFIG_ENGINE) $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_BASE) -SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) - -$(DOCKER_DHCP_RELAY)_CONTAINER_NAME = dhcp_relay -$(DOCKER_DHCP_RELAY)_RUN_OPT += --net=host --privileged -t -$(DOCKER_DHCP_RELAY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) From b2e44834f1ea363d0f7203713fda0e9d3dc686d3 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 3 Feb 2017 21:01:34 -0800 Subject: [PATCH 0241/1833] SNMP will now bind on 0.0.0.0 if mgmt ip not specified in minigraph (#253) Fix an issue that snmp will fail to start if mgmt ip is not specified in minigraph (e.g. default graph in oneimage where mgmt ip is from DHCP) --- dockers/docker-snmp-sv2/snmpd.conf.j2 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index 1f1691f987b5..fe3c5cadbb47 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -1,6 +1,5 @@ ############################################################################### -# Managed by Ansible -# file: ansible/roles/acs/templates/snmpd.conf.j2 +# Managed by sonic-config-engine ############################################################################### # # EXAMPLE.conf: @@ -14,6 +13,7 @@ # AGENT BEHAVIOUR # +{% if minigraph_mgmt_interface.addr | ipv4 %} # Listen for connections on localhost, loopback ip and mgmt (eth0) ip agentAddress udp:127.0.0.1:161 agentAddress udp:{{ minigraph_mgmt_interface.addr }}:161 @@ -23,6 +23,11 @@ agentAddress udp:{{ minigraph_mgmt_interface.addr }}:161 agentAddress udp:{{ minigraph_lo_interface.addr }}:161 {% endif %} {% endfor %} +{% else %} +# Listen on all addresses as mgmt ip not specified in minigraph +agentAddress udp:161 +{% endif %} + ############################################################################### # # ACCESS CONTROL From 2b113c4175d92e62e542dda9b894a68af4adb8b7 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Sat, 4 Feb 2017 07:35:48 +0200 Subject: [PATCH 0242/1833] Add FLUSH DB commands to swss service missed during merge (#248) * Add FLUSH DB commands to swss service missed during merge * Update swss.service.j2 --- files/build_templates/swss.service.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 3e7eb7cb68da..b7e34335f5fe 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -1,10 +1,13 @@ [Unit] -Description=orchagent container +Description=switch state service container Requires=database.service After=database.service [Service] User={{ sonicadmin_user }} +ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB +ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB +ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB ExecStart=/usr/bin/{{docker_container_name}}.sh start ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStopPost=/usr/bin/syncd.sh stop From 26f4c85825a25f6b3da5ab46ba711e4de7705b3a Mon Sep 17 00:00:00 2001 From: antonpatenko Date: Sat, 4 Feb 2017 07:38:32 +0200 Subject: [PATCH 0243/1833] Add possibility to install debug packages during build. (#234) * Enabled common debug packages installation. * Update gitignore. * Make debug-packages installation disabled by default. --- .gitignore | 1 + rules/config | 3 +++ rules/docker-base.mk | 10 +++++++++- slave.mk | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1e87c52e6f71..5483ddb6e9fe 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ dockers/docker-orchagent/Dockerfile dockers/docker-snmp-sv2/Dockerfile dockers/docker-team/Dockerfile dockers/docker-platform-monitor/Dockerfile +dockers/docker-base/Dockerfile diff --git a/rules/config b/rules/config index d76477ce5adc..5ae09a1bc96d 100644 --- a/rules/config +++ b/rules/config @@ -31,3 +31,6 @@ USERNAME = admin # PASSWORD - password for installer build PASSWORD = YourPaSsWoRd + +# SONIC_CONFIG_DEBUG - install debug packages +SONIC_CONFIG_DEBUG = n diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 56e42ac97b45..f041f7d05cdd 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -3,4 +3,12 @@ DOCKER_BASE = docker-base.gz $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base -SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_BASE) +ifeq ($(SONIC_CONFIG_DEBUG),y) +GDB = gdb +VIM = vim +OPENSSH = openssh-client +SSHPASS = sshpass +$(DOCKER_BASE)_DBG_PACKAGES += $(GDB) $(VIM) $(OPENSSH) $(SSHPASS) +endif + +SONIC_DOCKER_IMAGES += $(DOCKER_BASE) diff --git a/slave.mk b/slave.mk index 485f8ff9206c..5617a936f714 100644 --- a/slave.mk +++ b/slave.mk @@ -267,6 +267,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG) # Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')) + $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile docker build --no-cache -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ From f6a509cbb7b57a3a608857d8bdb2f225ade4817d Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 3 Feb 2017 22:14:47 -0800 Subject: [PATCH 0244/1833] Revert "Add possibility to install debug packages during build." (#259) --- .gitignore | 1 - rules/config | 3 --- rules/docker-base.mk | 10 +--------- slave.mk | 1 - 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 5483ddb6e9fe..1e87c52e6f71 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,3 @@ dockers/docker-orchagent/Dockerfile dockers/docker-snmp-sv2/Dockerfile dockers/docker-team/Dockerfile dockers/docker-platform-monitor/Dockerfile -dockers/docker-base/Dockerfile diff --git a/rules/config b/rules/config index 5ae09a1bc96d..d76477ce5adc 100644 --- a/rules/config +++ b/rules/config @@ -31,6 +31,3 @@ USERNAME = admin # PASSWORD - password for installer build PASSWORD = YourPaSsWoRd - -# SONIC_CONFIG_DEBUG - install debug packages -SONIC_CONFIG_DEBUG = n diff --git a/rules/docker-base.mk b/rules/docker-base.mk index f041f7d05cdd..56e42ac97b45 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -3,12 +3,4 @@ DOCKER_BASE = docker-base.gz $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base -ifeq ($(SONIC_CONFIG_DEBUG),y) -GDB = gdb -VIM = vim -OPENSSH = openssh-client -SSHPASS = sshpass -$(DOCKER_BASE)_DBG_PACKAGES += $(GDB) $(VIM) $(OPENSSH) $(SSHPASS) -endif - -SONIC_DOCKER_IMAGES += $(DOCKER_BASE) +SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_BASE) diff --git a/slave.mk b/slave.mk index 5617a936f714..485f8ff9206c 100644 --- a/slave.mk +++ b/slave.mk @@ -267,7 +267,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG) # Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')) - $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile docker build --no-cache -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ From e75acfe6d77899cb90c35ada0a300ee9caad9a44 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 4 Feb 2017 19:42:41 +0000 Subject: [PATCH 0245/1833] Add 'One Image' implementation for DHCP relay (hopefully fix builds) --- files/build_templates/dhcp_relay.service.j2 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 files/build_templates/dhcp_relay.service.j2 diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 new file mode 100644 index 000000000000..ee0c444ccce5 --- /dev/null +++ b/files/build_templates/dhcp_relay.service.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=DHCP relay container +Requires=docker.service +After=docker.service + +[Service] +User={{ sonicadmin_user }} +ExecStart=/usr/bin/{{ docker_container_name }}.sh start +ExecStop=/usr/bin/{{ docker_container_name }}.sh stop + +[Install] +WantedBy=multi-user.target From 7abb48abff42b64810b4c6c93321cd0f09444872 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 4 Feb 2017 12:02:58 -0800 Subject: [PATCH 0246/1833] [kernel]: update kernel for arista 7260cx-32 (#258) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 777792e7e8fc..cf93afcc12cb 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 777792e7e8fcdcd4b994f4dfca8ea5369855960c +Subproject commit cf93afcc12cb77a94fafd7f828d7549fdc346027 From 7c2c5f7f422f8c011dbbd54ac512211447c6c0da Mon Sep 17 00:00:00 2001 From: krambn Date: Sat, 4 Feb 2017 18:38:05 -0800 Subject: [PATCH 0247/1833] [p4]: Update the SAI header files to v0.9.4 (#260) * change refpoints to local repos (p4) * update refpoint to different fork * added missing bm link for platform p4 --- .gitmodules | 4 ++-- platform/p4/p4-bmv/behavioral-model | 2 +- platform/p4/p4-switch/switch | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index d9188126bf7a..9e92d29e50ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -15,10 +15,10 @@ url = https://github.com/Azure/sonic-swss [submodule "src/p4-switch/switch"] path = platform/p4/p4-switch/switch - url = https://github.com/lguohan/switch + url = https://github.com/krambn/switch [submodule "src/p4-bmv2/behavioral-model"] path = platform/p4/p4-bmv/behavioral-model - url = https://github.com/lguohan/behavioral-model + url = https://github.com/krambn/behavioral-model [submodule "src/p4c-bm/p4c-bm"] path = platform/p4/p4c-bm/p4c-bm url = https://github.com/krambn/p4c-bm diff --git a/platform/p4/p4-bmv/behavioral-model b/platform/p4/p4-bmv/behavioral-model index 0eb0d51736ee..ee3615eb155f 160000 --- a/platform/p4/p4-bmv/behavioral-model +++ b/platform/p4/p4-bmv/behavioral-model @@ -1 +1 @@ -Subproject commit 0eb0d51736eeadd75384edfa8589e43a9ba734f4 +Subproject commit ee3615eb155f61c8d165281fd4f36b9ea78ba71a diff --git a/platform/p4/p4-switch/switch b/platform/p4/p4-switch/switch index 21adcdddac59..584571b17dda 160000 --- a/platform/p4/p4-switch/switch +++ b/platform/p4/p4-switch/switch @@ -1 +1 @@ -Subproject commit 21adcdddac59b75e4627255a12f1ed1a4369bb62 +Subproject commit 584571b17ddafcaa45a3d46eacc403b7e18cac1b From 8bc559eccaf1a93603825a42c72164835ecbce1d Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 4 Feb 2017 22:32:45 -0800 Subject: [PATCH 0248/1833] [sonic-aboot]: restore docker archive on arista platform (#261) --- files/Aboot/boot0 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/files/Aboot/boot0 b/files/Aboot/boot0 index 79161e33806f..b326f0e289a6 100644 --- a/files/Aboot/boot0 +++ b/files/Aboot/boot0 @@ -46,6 +46,15 @@ extract_image() { ## Unzip the image unzip -oq "$swipath" -x boot0 -d "$target_path" + + ## Clean old directory for docker + rm -rf "$target_path/var/lib/docker" + + ## Further extract docker archive + tar xf "$target_path/dockerfs.tar.gz" -C "$target_path" + + ## clean up docker archive + rm -f "$target_path/dockerfs.tar.gz" } write_machine_config() { From d41877f4ff6b849de60edfab4fab6c7ce24c7500 Mon Sep 17 00:00:00 2001 From: Kram Date: Sat, 4 Feb 2017 19:48:36 -0800 Subject: [PATCH 0249/1833] [p4]: update p4 behaviro-model refpoint --- platform/p4/p4-bmv/behavioral-model | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/p4/p4-bmv/behavioral-model b/platform/p4/p4-bmv/behavioral-model index ee3615eb155f..a6ccf267bc9c 160000 --- a/platform/p4/p4-bmv/behavioral-model +++ b/platform/p4/p4-bmv/behavioral-model @@ -1 +1 @@ -Subproject commit ee3615eb155f61c8d165281fd4f36b9ea78ba71a +Subproject commit a6ccf267bc9c5c31fd40fe5841893e38e03abeb4 From 64f26beb42c88f8815c6d6e129c88f4daeed74a2 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sun, 5 Feb 2017 14:37:34 -0800 Subject: [PATCH 0250/1833] Update PTF submodule to point to current head of master branch (#255) --- src/ptf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ptf b/src/ptf index ec33433f0276..9e762c9cdb63 160000 --- a/src/ptf +++ b/src/ptf @@ -1 +1 @@ -Subproject commit ec33433f027625f4ba85c4eba8258e29f1dd6496 +Subproject commit 9e762c9cdb63d7ab9be017a41f638e776f4f0575 From 27a0b7c1fd52b49d103a487481c66f8079b8a725 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 5 Feb 2017 15:59:59 -0800 Subject: [PATCH 0251/1833] build one aboot image on arista platform (#263) --- .gitmodules | 3 +++ build_image.sh | 27 ++++++++++++++----- files/Aboot/{boot0 => boot0.j2} | 16 +++++++---- onie-image.conf | 6 +++++ platform/broadcom/one-aboot.mk | 8 ++++++ platform/broadcom/platform-modules-arista.mk | 10 +++++++ platform/broadcom/rules.mk | 4 ++- .../broadcom/sonic-platform-modules-arista | 1 + platform/generic/aboot-image.mk | 4 +-- 9 files changed, 64 insertions(+), 15 deletions(-) rename files/Aboot/{boot0 => boot0.j2} (91%) create mode 100644 platform/broadcom/one-aboot.mk create mode 100644 platform/broadcom/platform-modules-arista.mk create mode 160000 platform/broadcom/sonic-platform-modules-arista diff --git a/.gitmodules b/.gitmodules index 9e92d29e50ad..35e7290b8000 100644 --- a/.gitmodules +++ b/.gitmodules @@ -50,3 +50,6 @@ [submodule "platform/broadcom/sonic-platform-modules-s6000"] path = platform/broadcom/sonic-platform-modules-s6000 url = https://github.com/Azure/sonic-platform-modules-s6000 +[submodule "sonic-platform-modules-arista"] + path = platform/broadcom/sonic-platform-modules-arista + url = https://github.com/lguohan/sonic-1 diff --git a/build_image.sh b/build_image.sh index dc8d796ca8d9..03e518a5fb9c 100755 --- a/build_image.sh +++ b/build_image.sh @@ -19,9 +19,10 @@ } GIT_REVISION=$(git rev-parse --short HEAD) -mkdir -p `dirname $OUTPUT_ONIE_IMAGE` -sudo rm -f $OUTPUT_ONIE_IMAGE if [ "$IMAGE_TYPE" = "onie" ]; then + echo "Build ONIE installer" + mkdir -p `dirname $OUTPUT_ONIE_IMAGE` + sudo rm -f $OUTPUT_ONIE_IMAGE ## Generate an ONIE installer image ## Note: Don't leave blank between lines. It is single line command. ./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \ @@ -29,15 +30,27 @@ if [ "$IMAGE_TYPE" = "onie" ]; then $ONIE_INSTALLER_PAYLOAD ## Use 'aboot' as target machine category which includes Aboot as bootloader elif [ "$IMAGE_TYPE" = "aboot" ]; then - ## Add Aboot boot0 file into the image - cp $ONIE_INSTALLER_PAYLOAD $OUTPUT_ONIE_IMAGE - pushd files/Aboot && sudo zip -g $OLDPWD/$OUTPUT_ONIE_IMAGE boot0; popd + echo "Build Aboot installer" + mkdir -p `dirname $OUTPUT_ABOOT_IMAGE` + sudo rm -f $OUTPUT_ABOOT_IMAGE + sudo rm -f $ABOOT_BOOT_IMAGE + ## Add main payload + cp $ONIE_INSTALLER_PAYLOAD $OUTPUT_ABOOT_IMAGE + ## Add Aboot boot0 file + j2 -f env files/Aboot/boot0.j2 ./onie-image.conf > files/Aboot/boot0 + pushd files/Aboot && zip -g $OLDPWD/$OUTPUT_ABOOT_IMAGE boot0; popd + pushd files/Aboot && zip -g $OLDPWD/$ABOOT_BOOT_IMAGE boot0; popd echo "$GIT_REVISION" >> .imagehash - zip -g $OUTPUT_ONIE_IMAGE .imagehash + zip -g $OUTPUT_ABOOT_IMAGE .imagehash + zip -g $ABOOT_BOOT_IMAGE .imagehash rm .imagehash echo "SWI_VERSION=42.0.0" > version - zip -g $OUTPUT_ONIE_IMAGE version + zip -g $OUTPUT_ABOOT_IMAGE version + zip -g $ABOOT_BOOT_IMAGE version rm version + + zip -g $OUTPUT_ABOOT_IMAGE $ABOOT_BOOT_IMAGE + rm $ABOOT_BOOT_IMAGE else echo "Error: Non supported target platform: $TARGET_PLATFORM" exit 1 diff --git a/files/Aboot/boot0 b/files/Aboot/boot0.j2 similarity index 91% rename from files/Aboot/boot0 rename to files/Aboot/boot0.j2 index b326f0e289a6..6836f780ac44 100644 --- a/files/Aboot/boot0 +++ b/files/Aboot/boot0.j2 @@ -44,17 +44,23 @@ extract_image() { ## Clean old directory for read-write layer rm -rf "$target_path/rw" + ## Clean docker directory + rm -rf "$target_path/var" + ## Unzip the image unzip -oq "$swipath" -x boot0 -d "$target_path" - ## Clean old directory for docker - rm -rf "$target_path/var/lib/docker" + ## Remove installer swi as it has lots of redundunt contents + rm -f $swipath - ## Further extract docker archive - tar xf "$target_path/dockerfs.tar.gz" -C "$target_path" + ## Further extract docker archive + tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path" ## clean up docker archive - rm -f "$target_path/dockerfs.tar.gz" + rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}" + + ## replace with boot swi + mv "$target_path/{{ ABOOT_BOOT_IMAGE }}" "$swipath" } write_machine_config() { diff --git a/onie-image.conf b/onie-image.conf index 61fad731b975..70228bbf2498 100644 --- a/onie-image.conf +++ b/onie-image.conf @@ -23,3 +23,9 @@ FILESYSTEM_DOCKERFS=dockerfs.tar.gz ## Output file name for onie installer OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin + +## Output file name for aboot installer +OUTPUT_ABOOT_IMAGE=target/sonic-aboot-$TARGET_MACHINE.swi + +## Aboot boot image name +ABOOT_BOOT_IMAGE=.sonic-boot.swi diff --git a/platform/broadcom/one-aboot.mk b/platform/broadcom/one-aboot.mk new file mode 100644 index 000000000000..fde8e06ff787 --- /dev/null +++ b/platform/broadcom/one-aboot.mk @@ -0,0 +1,8 @@ +# sonic broadcom one image installer + +SONIC_ONE_ABOOT_IMAGE = sonic-aboot-broadcom.swi +$(SONIC_ONE_ABOOT_IMAGE)_MACHINE = broadcom +$(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot +$(SONIC_ONE_ABOOT_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) $(ARISTA_PLATFORM_MODULE) +$(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_ABOOT_IMAGE) diff --git a/platform/broadcom/platform-modules-arista.mk b/platform/broadcom/platform-modules-arista.mk new file mode 100644 index 000000000000..46f8709f53e9 --- /dev/null +++ b/platform/broadcom/platform-modules-arista.mk @@ -0,0 +1,10 @@ +# Arista Platform modules + +ARISTA_PLATFORM_MODULE_VERSION = 1.0 + +export ARISTA_PLATFORM_MODULE_VERSION + +ARISTA_PLATFORM_MODULE = sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb +$(ARISTA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-arista +$(ARISTA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_DPKG_DEBS += $(ARISTA_PLATFORM_MODULE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index cd34b9c23bf6..e783f3cdbf9b 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,9 +1,11 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-s6000.mk +include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/one-image.mk +include $(PLATFORM_PATH)/one-aboot.mk BCMCMD = bcmcmd $(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmcmd?sv=2015-04-05&sr=b&sig=X3bFApmsNFmcnWM9mSGRxBugPcg%2FgJCHh5hhSuV1M2c%3D&se=2030-08-23T14%3A41%3A56Z&sp=r" @@ -13,7 +15,7 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) -SONIC_ALL += $(SONIC_ONE_IMAGE) +SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) # Inject brcm sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista new file mode 160000 index 000000000000..5a1871d8070b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-arista @@ -0,0 +1 @@ +Subproject commit 5a1871d8070b1fea0fbc30fcf91ff984ac6ec295 diff --git a/platform/generic/aboot-image.mk b/platform/generic/aboot-image.mk index 0f332eb75402..64b841f856ea 100644 --- a/platform/generic/aboot-image.mk +++ b/platform/generic/aboot-image.mk @@ -1,7 +1,7 @@ # sonic aboot installer -SONIC_GENERIC_ABOOT_IMAGE = sonic-aboot.bin -$(SONIC_GENERIC_ABOOT_IMAGE)_MACHINE = aboot +SONIC_GENERIC_ABOOT_IMAGE = sonic-aboot-generic.swi +$(SONIC_GENERIC_ABOOT_IMAGE)_MACHINE = generic $(SONIC_GENERIC_ABOOT_IMAGE)_IMAGE_TYPE = aboot $(SONIC_GENERIC_ABOOT_IMAGE)_DEPENDS = $(SONIC_GENERIC_ABOOT_IMAGE)_DOCKERS = From 0bbde7b91a0975bfbb4c413bd26c63ce6cf9f8ee Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 5 Feb 2017 22:11:52 -0800 Subject: [PATCH 0252/1833] [aboot]: extract dockerfs in initramfs stage when the root fs is vfat (#266) vfat does not support symbol links used in aufs --- files/Aboot/boot0.j2 | 18 +++++++++++++----- files/initramfs-tools/arista-convertfs | 5 ++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 6836f780ac44..edd052450ed2 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -53,11 +53,19 @@ extract_image() { ## Remove installer swi as it has lots of redundunt contents rm -f $swipath - ## Further extract docker archive - tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path" - - ## clean up docker archive - rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}" + ## detect rootfs type + rootfs_type=`grep /mnt/flash /proc/mounts | cut -d' ' -f3` + + ## vfat does not support symbol link + if [ $rootfs_type != "vfat" ]; then + ## Further extract docker archive + tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path" + + ## clean up docker archive + rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}" + else + echo "/mnt/flash is $rootfs_type, extract {{ FILESYSTEM_DOCKERFS }} in later stage" + fi ## replace with boot swi mv "$target_path/{{ ABOOT_BOOT_IMAGE }}" "$swipath" diff --git a/files/initramfs-tools/arista-convertfs b/files/initramfs-tools/arista-convertfs index 1aab6fa7d765..676cbab4cc8b 100644 --- a/files/initramfs-tools/arista-convertfs +++ b/files/initramfs-tools/arista-convertfs @@ -164,7 +164,10 @@ err_msg="Error: mounting $root_dev to $root_mnt failed" cmd="mount -t ext4 $root_dev $root_mnt" run_cmd "$cmd" "$err_msg" +err_msg="Error: extract docker directory" +cmd="[ -f $tmp_mnt/dockerfs.tar.gz ] && rm -rf $tmp_mnt/var && tar xzf $tmp_mnt/dockerfs.tar.gz -C $root_mnt && rm -f $tmp_mnt/dockerfs.tar.gz" +run_cmd "$cmd" "$err_msg" + err_msg="Error: copying files form $tmp_mnt to $root_mnt failed" cmd="cp -a $tmp_mnt/. $root_mnt/" run_cmd "$cmd" "$err_msg" - From 235867849708fb6bd22c54523286d613a2319846 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Mon, 6 Feb 2017 08:17:25 +0200 Subject: [PATCH 0253/1833] Add operational script, accton_as7512_util.py, for device initializatian and peripheral accessing (#265) Signed-off-by: Nadiya.Stetskovych --- platform/cavium/cavm_platform_modules/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/cavium/cavm_platform_modules/Makefile b/platform/cavium/cavm_platform_modules/Makefile index 5d2624acbebb..515c1571abde 100644 --- a/platform/cavium/cavm_platform_modules/Makefile +++ b/platform/cavium/cavm_platform_modules/Makefile @@ -4,6 +4,7 @@ SHELL = /bin/bash MAIN_TARGET = cavm_platform_modules.deb DEB_BUILD_DIR = cavm-platform-modules-deb +SCRIPT_SRC = $(DEB_BUILD_DIR)/ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # get sources @@ -16,8 +17,10 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : KERNEL_SRC=/lib/modules/$(KVERSION)/build make popd mkdir -p $(DEB_BUILD_DIR)/lib/modules/$(KVERSION) + mkdir -p $(DEB_BUILD_DIR)/usr/bin cp SONiC/AS7512-32X/module/*.ko $(DEB_BUILD_DIR)/lib/modules/$(KVERSION) + cp SONiC/AS7512-32X/accton_as7512_util.py $(DEB_BUILD_DIR)/usr/bin cp -r DEBIAN $(DEB_BUILD_DIR) dpkg-deb -b $(DEB_BUILD_DIR) $(MAIN_TARGET) From 8826beb5978537d0a2352fc8aaadedf4dfc9fb5f Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 6 Feb 2017 08:17:16 -0800 Subject: [PATCH 0254/1833] [docker]: change hardcoded value to DOCKERFS_DIR for docker directory on the disk (#269) --- build_debian.sh | 2 +- files/Aboot/boot0.j2 | 8 +++++--- .../{arista-convertfs => arista-convertfs.j2} | 2 +- files/initramfs-tools/{union-mount => union-mount.j2} | 2 +- installer/x86_64/install.sh | 2 +- onie-image.conf | 3 +++ slave.mk | 5 ++++- 7 files changed, 16 insertions(+), 8 deletions(-) rename files/initramfs-tools/{arista-convertfs => arista-convertfs.j2} (94%) rename files/initramfs-tools/{union-mount => union-mount.j2} (88%) diff --git a/build_debian.sh b/build_debian.sh index e113e6925107..76cd4467ce10 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -267,7 +267,7 @@ sudo du -hs $FILESYSTEM_ROOT sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker ## Compress docker files -pushd $FILESYSTEM_ROOT && sudo tar czf $OLDPWD/$FILESYSTEM_DOCKERFS var/lib/docker; popd +pushd $FILESYSTEM_ROOT && sudo tar czf $OLDPWD/$FILESYSTEM_DOCKERFS -C var/lib/docker .; popd ## Compress together with /boot and /var/lib/docker as an installer payload zip file pushd $FILESYSTEM_ROOT && sudo zip $OLDPWD/$ONIE_INSTALLER_PAYLOAD -r boot/; popd diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index edd052450ed2..8ec50ef7f9e3 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -45,7 +45,7 @@ extract_image() { rm -rf "$target_path/rw" ## Clean docker directory - rm -rf "$target_path/var" + rm -rf "$target_path/{{ DOCKERFS_DIR }}" ## Unzip the image unzip -oq "$swipath" -x boot0 -d "$target_path" @@ -58,8 +58,10 @@ extract_image() { ## vfat does not support symbol link if [ $rootfs_type != "vfat" ]; then - ## Further extract docker archive - tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path" + mkdir -p "$target_path/{{ DOCKERFS_DIR }}" + + ## extract docker archive + tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path/{{ DOCKERFS_DIR }}" ## clean up docker archive rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}" diff --git a/files/initramfs-tools/arista-convertfs b/files/initramfs-tools/arista-convertfs.j2 similarity index 94% rename from files/initramfs-tools/arista-convertfs rename to files/initramfs-tools/arista-convertfs.j2 index 676cbab4cc8b..8847bc69bdfa 100644 --- a/files/initramfs-tools/arista-convertfs +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -165,7 +165,7 @@ cmd="mount -t ext4 $root_dev $root_mnt" run_cmd "$cmd" "$err_msg" err_msg="Error: extract docker directory" -cmd="[ -f $tmp_mnt/dockerfs.tar.gz ] && rm -rf $tmp_mnt/var && tar xzf $tmp_mnt/dockerfs.tar.gz -C $root_mnt && rm -f $tmp_mnt/dockerfs.tar.gz" +cmd="[ -f $tmp_mnt/{{ FILESYSTEM_DOCKERFS }} ] && rm -rf $root_mnt/{{ DOCKERFS_DIR }} && mkdir $root_mnt/{{ DOCKERFS_DIR }} && tar xzf $tmp_mnt/{{ FILESYSTEM_DOCKERFS }} -C $root_mnt/{{ DOCKERFS_DIR }} && rm -f $tmp_mnt/{{ FILESYSTEM_DOCKERFS }}" run_cmd "$cmd" "$err_msg" err_msg="Error: copying files form $tmp_mnt to $root_mnt failed" diff --git a/files/initramfs-tools/union-mount b/files/initramfs-tools/union-mount.j2 similarity index 88% rename from files/initramfs-tools/union-mount rename to files/initramfs-tools/union-mount.j2 index b343d56c6e22..531436c39a2f 100644 --- a/files/initramfs-tools/union-mount +++ b/files/initramfs-tools/union-mount.j2 @@ -12,7 +12,7 @@ mount -n -o dirs=${rootmnt}/host/rw:${rootmnt}=ro -t aufs root-aufs ${rootmnt} mount ${ROOT} ${rootmnt}/host ## Mount the working directory of docker engine in the raw partition, bypass the aufs mkdir -p ${rootmnt}/var/lib/docker -mount --bind ${rootmnt}/host/var/lib/docker ${rootmnt}/var/lib/docker +mount --bind ${rootmnt}/host/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker ## Mount the boot directory in the raw partition, bypass the aufs mkdir -p ${rootmnt}/boot mount --bind ${rootmnt}/host/boot ${rootmnt}/boot diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index b8177462a55c..2ff663c188eb 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -398,7 +398,7 @@ ${onie_bin} mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || { unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt if [ -f $demo_mnt/$FILESYSTEM_DOCKERFS ]; then - cd $demo_mnt && tar xf $FILESYSTEM_DOCKERFS; cd $OLDPWD + cd $demo_mnt && mkdir -p $DOCKERFS_DIR && tar xf $FILESYSTEM_DOCKERFS -C $DOCKERFS_DIR; cd $OLDPWD fi # Store machine description in target file system diff --git a/onie-image.conf b/onie-image.conf index 70228bbf2498..f12e23f7414b 100644 --- a/onie-image.conf +++ b/onie-image.conf @@ -21,6 +21,9 @@ ONIE_INSTALLER_PAYLOAD=fs.zip ## Filename for docker file system FILESYSTEM_DOCKERFS=dockerfs.tar.gz +## docker directory on the root filesystem +DOCKERFS_DIR=docker + ## Output file name for onie installer OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin diff --git a/slave.mk b/slave.mk index 485f8ff9206c..68ed227cdc6a 100644 --- a/slave.mk +++ b/slave.mk @@ -285,7 +285,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER)) $(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER)) $(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $(HEADER) ## Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" @@ -310,6 +310,9 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export installer_start_scrips="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))" export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(docker)_CONTAINER_NAME)))" + j2 -f env files/initramfs-tools/union-mount.j2 onie-image.conf > files/initramfs-tools/union-mount + j2 -f env files/initramfs-tools/arista-convertfs.j2 onie-image.conf > files/initramfs-tools/arista-convertfs + $(if $($*_DOCKERS), j2 files/build_templates/sonic_debian_extension.j2 > sonic_debian_extension.sh chmod +x sonic_debian_extension.sh, From 12fa107645bd2f357ab5a3c60c273a7f394976d7 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 6 Feb 2017 08:40:57 -0800 Subject: [PATCH 0255/1833] Revert "Revert "Conform with new Docker build method"" (#264) --- dockers/docker-dhcp-relay/Dockerfile | 25 ----------------- dockers/docker-dhcp-relay/Dockerfile.j2 | 37 +++++++++++++++++++++++++ rules/docker-dhcp-relay.mk | 10 +++++-- 3 files changed, 45 insertions(+), 27 deletions(-) delete mode 100644 dockers/docker-dhcp-relay/Dockerfile create mode 100644 dockers/docker-dhcp-relay/Dockerfile.j2 diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile deleted file mode 100644 index f664d89a4a2e..000000000000 --- a/dockers/docker-dhcp-relay/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM docker-base - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -# Update APT package lists -RUN apt-get update - -# Dependencies for sonic-cfggen -RUN apt-get -y install python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - -## Install isc-dhcp-relay and clean up afterward -RUN apt-get -y install isc-dhcp-relay \ - && apt-get clean -y \ - && apt-get autoclean -y \ - && apt-get autoremove -y - -COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"] -COPY ["config.sh", "/usr/bin/"] - -ENTRYPOINT /usr/bin/config.sh \ - && service rsyslog start \ - && service isc-dhcp-relay start \ - && /bin/bash - diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 new file mode 100644 index 000000000000..85ea74a4b164 --- /dev/null +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -0,0 +1,37 @@ +FROM docker-base + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +## Update APT package lists +RUN apt-get update + +## Dependencies for sonic-cfggen +RUN apt-get -y install python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + + +COPY \ +{% for deb in docker_dhcp_relay_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_dhcp_relay_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## Install isc-dhcp-relay Debian package +RUN apt-get -y install isc-dhcp-relay + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"] +COPY ["config.sh", "/usr/bin/"] + +ENTRYPOINT /usr/bin/config.sh \ + && service rsyslog start \ + && service isc-dhcp-relay start \ + && /bin/bash diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 1c68e8468a30..c0d88e595fd8 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -1,7 +1,13 @@ -# docker dhcp relay image +# Docker image for DHCP relay DOCKER_DHCP_RELAY = docker-dhcp-relay.gz $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay +$(DOCKER_DHCP_RELAY)_DEPENDS += $(SONIC_CONFIG_ENGINE) $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) -SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) + +$(DOCKER_DHCP_RELAY)_CONTAINER_NAME = dhcp_relay +$(DOCKER_DHCP_RELAY)_RUN_OPT += --net=host --privileged -t +$(DOCKER_DHCP_RELAY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro From 8b5d05eeef15fbfdc90a6626c78c8b7da31fe365 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 6 Feb 2017 21:11:18 -0800 Subject: [PATCH 0256/1833] [sonic-slave]: upgrade docker engine in sonic-slave to 1.13.0 (#272) --- sonic-slave/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 41c65e3465b2..0398581dcd47 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -89,8 +89,9 @@ RUN pip install j2cli RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /usr/share/depot_tools ENV PATH /usr/share/depot_tools:$PATH -# Install docker engine 1.11.2 inside docker -RUN curl -sSL https://get.docker.com/ | sh && apt-get install -y --force-yes -q docker-engine=1.11.2-0~jessie +# Install docker engine 1.13.0 inside docker and enable experimental feature +RUN curl -sSL https://get.docker.com/ | sh && apt-get install -y --force-yes -q docker-engine=1.13.0-0~debian-jessie +RUN echo "DOCKER_OPTS=\"--experimental\"" >> /etc/default/docker # Add user ARG user From 8901112bf6631a58504a7ee504170fe9a5ce5179 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 7 Feb 2017 05:25:23 +0000 Subject: [PATCH 0257/1833] [git]: add more Dockerfile in .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 1e87c52e6f71..268e1f6c7d28 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ dockers/docker-orchagent/Dockerfile dockers/docker-snmp-sv2/Dockerfile dockers/docker-team/Dockerfile dockers/docker-platform-monitor/Dockerfile +dockers/docker-dhcp-relay/Dockerfile +dockers/docker-teamd/Dockerfile +platform/broadcom/docker-syncd-brcm/Dockerfile From 522585aadf89d2f712eace7cf68f1f59f65ff475 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 7 Feb 2017 00:28:30 -0800 Subject: [PATCH 0258/1833] [docker-fpm]: T0 devices receive routes containing one occurrence of their own ASN (#271) --- dockers/docker-fpm/bgpd.conf.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-fpm/bgpd.conf.j2 b/dockers/docker-fpm/bgpd.conf.j2 index 25839864fbb7..0e03561f82fe 100644 --- a/dockers/docker-fpm/bgpd.conf.j2 +++ b/dockers/docker-fpm/bgpd.conf.j2 @@ -46,6 +46,9 @@ router bgp {{ minigraph_bgp_asn }} {% if bgp_session['asn'] != 0 %} neighbor {{ bgp_session['addr'] }} remote-as {{ bgp_session['asn'] }} neighbor {{ bgp_session['addr'] }} description {{ bgp_session['name'] }} +{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} + neighbor {{ bgp_session['addr'] }} allowas-in 1 +{% endif %} {% if bgp_session['addr'] | ipv6 %} address-family ipv6 neighbor {{ bgp_session['addr'] }} activate From 53a9792014d4780e7f988bca23e0ac536fdaea00 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Tue, 7 Feb 2017 10:33:20 +0200 Subject: [PATCH 0259/1833] [Makefile]: Add possibility for docker containers to install files to base image (#240) - Add vtysh/lldpctl/sensors to baseimage --- dockers/docker-fpm/base_image_files/vtysh | 2 ++ dockers/docker-lldp-sv2/base_image_files/lldpctl | 2 ++ dockers/docker-platform-monitor/base_image_files/sensors | 2 ++ files/build_templates/sonic_debian_extension.j2 | 8 ++++++++ rules/docker-fpm.mk | 2 ++ rules/docker-lldp-sv2.mk | 2 ++ rules/docker-platform-monitor.mk | 2 ++ slave.mk | 1 + 8 files changed, 21 insertions(+) create mode 100755 dockers/docker-fpm/base_image_files/vtysh create mode 100755 dockers/docker-lldp-sv2/base_image_files/lldpctl create mode 100755 dockers/docker-platform-monitor/base_image_files/sensors diff --git a/dockers/docker-fpm/base_image_files/vtysh b/dockers/docker-fpm/base_image_files/vtysh new file mode 100755 index 000000000000..359101c06c61 --- /dev/null +++ b/dockers/docker-fpm/base_image_files/vtysh @@ -0,0 +1,2 @@ +#!/bin/bash +docker exec -i bgp vtysh "$@" diff --git a/dockers/docker-lldp-sv2/base_image_files/lldpctl b/dockers/docker-lldp-sv2/base_image_files/lldpctl new file mode 100755 index 000000000000..c55e5ce8e2fb --- /dev/null +++ b/dockers/docker-lldp-sv2/base_image_files/lldpctl @@ -0,0 +1,2 @@ +#!/bin/bash +docker exec -it lldp lldpctl "$@" diff --git a/dockers/docker-platform-monitor/base_image_files/sensors b/dockers/docker-platform-monitor/base_image_files/sensors new file mode 100755 index 000000000000..af1e57941861 --- /dev/null +++ b/dockers/docker-platform-monitor/base_image_files/sensors @@ -0,0 +1,2 @@ +#!/bin/bash +docker exec -i pmon sensors "$@" diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 4cebcb2227e9..be7f338dae81 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -117,3 +117,11 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys {% endif %} +{% for file in installer_extra_files.split(' ') -%} +{% if file.strip() -%} +{% set src = file.split(':')[0] -%} +{% set dst = file.split(':')[1] -%} +sudo cp {{src}} $FILESYSTEM_ROOT/{{dst}} +{% endif -%} +{% endfor -%} + diff --git a/rules/docker-fpm.mk b/rules/docker-fpm.mk index 090c2b61cc1f..4c9c09ffd45e 100644 --- a/rules/docker-fpm.mk +++ b/rules/docker-fpm.mk @@ -11,3 +11,5 @@ $(DOCKER_FPM)_CONTAINER_NAME = bgp $(DOCKER_FPM)_RUN_OPT += --net=host --privileged -t $(DOCKER_FPM)_RUN_OPT += --volumes-from database $(DOCKER_FPM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_FPM)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh diff --git a/rules/docker-lldp-sv2.mk b/rules/docker-lldp-sv2.mk index 7041a24f81db..e9f701a49580 100644 --- a/rules/docker-lldp-sv2.mk +++ b/rules/docker-lldp-sv2.mk @@ -11,3 +11,5 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) $(DOCKER_LLDP_SV2)_CONTAINER_NAME = lldp $(DOCKER_LLDP_SV2)_RUN_OPT += --net=host --privileged -t $(DOCKER_LLDP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_LLDP_SV2)_BASE_IMAGE_FILES += lldpctl:/usr/bin/lldpctl diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 223e87bfac78..92b64bf15b40 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -11,3 +11,5 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) $(DOCKER_PLATFORM_MONITOR)_CONTAINER_NAME = pmon $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += --net=host --privileged -t $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += sensors:/usr/bin/sensors diff --git a/slave.mk b/slave.mk index 68ed227cdc6a..e34d932c1af1 100644 --- a/slave.mk +++ b/slave.mk @@ -309,6 +309,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export installer_start_scrips="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))" export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(docker)_CONTAINER_NAME)))" + export installer_extra_files="$(foreach docker, $($*_DOCKERS), $(foreach file, $($(docker)_BASE_IMAGE_FILES), $($(docker)_PATH)/base_image_files/$(file)))" j2 -f env files/initramfs-tools/union-mount.j2 onie-image.conf > files/initramfs-tools/union-mount j2 -f env files/initramfs-tools/arista-convertfs.j2 onie-image.conf > files/initramfs-tools/arista-convertfs From a412fe16c4f03f1a33858756815195c8089e130b Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 7 Feb 2017 08:36:19 -0800 Subject: [PATCH 0260/1833] [dockers]: use docker --squash to build dockers (#273) --- slave.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slave.mk b/slave.mk index e34d932c1af1..a13178bb58e3 100644 --- a/slave.mk +++ b/slave.mk @@ -254,7 +254,7 @@ docker-start : # targets for building simple docker images that do not depend on any debian packages $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $(HEADER) - docker build --no-cache -t $* $($*.gz_PATH) $(LOG) + docker build --squash --no-cache -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ $(FOOTER) @@ -268,7 +268,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl # Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile - docker build --no-cache -t $* $($*.gz_PATH) $(LOG) + docker build --squash --no-cache -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ $(FOOTER) From b6753e7960530213623a296d0216695834ab4166 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 7 Feb 2017 18:11:19 -0800 Subject: [PATCH 0261/1833] [docker-config-engine]: introduce docker sonic config engine (#274) * [docker-config-engine]: introduce docker sonic config engine sonic config engine provide the sonic configure engine for all sonic dockers that rely on the engine to generate runtime configuration. --- .gitignore | 3 +- dockers/docker-config-engine/Dockerfile.j2 | 21 ++++++++++++ .../{Dockerfile.j2 => Dockerfile} | 17 +--------- dockers/docker-fpm/Dockerfile.j2 | 5 +-- dockers/docker-lldp-sv2/Dockerfile.j2 | 5 +-- dockers/docker-orchagent/Dockerfile.j2 | 5 +-- dockers/docker-platform-monitor/Dockerfile | 18 ++++++++++ dockers/docker-platform-monitor/Dockerfile.j2 | 33 ------------------- dockers/docker-snmp-sv2/Dockerfile.j2 | 5 +-- dockers/docker-teamd/Dockerfile.j2 | 6 +--- platform/broadcom/docker-orchagent-brcm.mk | 4 +-- platform/cavium/docker-orchagent-cavm.mk | 4 +-- platform/mellanox/docker-orchagent-mlnx.mk | 4 +-- rules/docker-config-engine.mk | 7 ++++ rules/docker-dhcp-relay.mk | 5 ++- rules/docker-fpm.mk | 4 +-- rules/docker-lldp-sv2.mk | 4 +-- rules/docker-platform-monitor.mk | 5 ++- rules/docker-snmp-sv2.mk | 4 +-- rules/docker-teamd.mk | 4 +-- 20 files changed, 71 insertions(+), 92 deletions(-) create mode 100644 dockers/docker-config-engine/Dockerfile.j2 rename dockers/docker-dhcp-relay/{Dockerfile.j2 => Dockerfile} (59%) create mode 100755 dockers/docker-platform-monitor/Dockerfile delete mode 100755 dockers/docker-platform-monitor/Dockerfile.j2 create mode 100644 rules/docker-config-engine.mk diff --git a/.gitignore b/.gitignore index 268e1f6c7d28..e9c5da1caacf 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,6 @@ dockers/docker-lldp-sv2/Dockerfile dockers/docker-orchagent/Dockerfile dockers/docker-snmp-sv2/Dockerfile dockers/docker-team/Dockerfile -dockers/docker-platform-monitor/Dockerfile -dockers/docker-dhcp-relay/Dockerfile dockers/docker-teamd/Dockerfile +dockers/docker-config-engine/Dockerfile platform/broadcom/docker-syncd-brcm/Dockerfile diff --git a/dockers/docker-config-engine/Dockerfile.j2 b/dockers/docker-config-engine/Dockerfile.j2 new file mode 100644 index 000000000000..56ed38f10f90 --- /dev/null +++ b/dockers/docker-config-engine/Dockerfile.j2 @@ -0,0 +1,21 @@ +FROM docker-base + +RUN apt-get update + +# Dependencies for sonic-cfggen +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + +COPY \ +{% for deb in docker_config_engine_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_config_engine_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile similarity index 59% rename from dockers/docker-dhcp-relay/Dockerfile.j2 rename to dockers/docker-dhcp-relay/Dockerfile index 85ea74a4b164..af7bdcb830c1 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -1,4 +1,4 @@ -FROM docker-base +FROM docker-config-engine ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -6,21 +6,6 @@ ENV DEBIAN_FRONTEND=noninteractive ## Update APT package lists RUN apt-get update -## Dependencies for sonic-cfggen -RUN apt-get -y install python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - - -COPY \ -{% for deb in docker_dhcp_relay_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ - -RUN dpkg -i \ -{% for deb in docker_dhcp_relay_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} - ## Install isc-dhcp-relay Debian package RUN apt-get -y install isc-dhcp-relay diff --git a/dockers/docker-fpm/Dockerfile.j2 b/dockers/docker-fpm/Dockerfile.j2 index ea4aa226badb..5cdbff3a0646 100644 --- a/dockers/docker-fpm/Dockerfile.j2 +++ b/dockers/docker-fpm/Dockerfile.j2 @@ -1,12 +1,9 @@ -FROM docker-base +FROM docker-config-engine RUN apt-get update RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 -# Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - COPY \ {% for deb in docker_fpm_debs.split(' ') -%} debs/{{ deb }}{{' '}} diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 399d2ca6e732..32d73ecf32c5 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-base +FROM docker-config-engine COPY \ {% for deb in docker_lldp_sv2_debs.split(' ') -%} @@ -10,9 +10,6 @@ COPY python-wheels /python-wheels RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 -# Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - ## Pre-install the fundamental packages ## Install Python SSWSDK ## Install LLDP Sync Daemon diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index f085da93a55f..dd04379f57e0 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-base +FROM docker-config-engine RUN apt-get update @@ -8,9 +8,6 @@ RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansso ## TODO: implicitly install dependencies RUN apt-get -y install libjemalloc1 -# Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - COPY \ {% for deb in docker_orchagent_debs.split(' ') -%} debs/{{ deb }}{{' '}} diff --git a/dockers/docker-platform-monitor/Dockerfile b/dockers/docker-platform-monitor/Dockerfile new file mode 100755 index 000000000000..0d5a5dcb45e9 --- /dev/null +++ b/dockers/docker-platform-monitor/Dockerfile @@ -0,0 +1,18 @@ +FROM docker-config-engine + +RUN apt-get update + +RUN apt-get install -y smartmontools sensord + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +COPY ["config.sh", "/usr/bin/"] + +ENTRYPOINT /usr/bin/config.sh \ + && service rsyslog start \ + && service lm-sensors start \ + && service smartmontools start \ + && service sensord start \ + && /bin/bash diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 deleted file mode 100755 index c6020d113ba6..000000000000 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ /dev/null @@ -1,33 +0,0 @@ -FROM docker-base - -RUN apt-get update - -RUN apt-get install -y smartmontools sensord - -# Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - -COPY \ -{% for deb in docker_platform_monitor_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ - - -RUN dpkg -i \ -{% for deb in docker_platform_monitor_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs - -COPY ["config.sh", "/usr/bin/"] - -ENTRYPOINT /usr/bin/config.sh \ - && service rsyslog start \ - && service lm-sensors start \ - && service smartmontools start \ - && service sensord start \ - && /bin/bash diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index f975fbf845da..33a2bdaa74a8 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-base +FROM docker-config-engine COPY \ {% for deb in docker_snmp_sv2_debs.split(' ') -%} @@ -17,9 +17,6 @@ ENV PYTHONOPTIMIZE 1 ## Clean up RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev -# Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - RUN dpkg -i \ {% for deb in docker_snmp_sv2_debs.split(' ') -%} debs/{{ deb }}{{' '}} diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index e663b9d7d1f7..bff5ef11d4f5 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -1,11 +1,7 @@ -FROM docker-base +FROM docker-config-engine RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 - -# Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml - COPY \ {% for deb in docker_teamd_debs.split(' ') -%} debs/{{ deb }}{{' '}} diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index f04103ef15b8..2278d89cb832 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -2,8 +2,8 @@ DOCKER_ORCHAGENT_BRCM = docker-orchagent-brcm.gz $(DOCKER_ORCHAGENT_BRCM)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE) -$(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index e4ea73054921..d9460d1c88db 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -2,8 +2,8 @@ DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz $(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE) -$(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index 5b526cc6f35d..c193a7754185 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -2,8 +2,8 @@ DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz $(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(SONIC_CONFIG_ENGINE) -$(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) diff --git a/rules/docker-config-engine.mk b/rules/docker-config-engine.mk new file mode 100644 index 000000000000..8f168cc441ac --- /dev/null +++ b/rules/docker-config-engine.mk @@ -0,0 +1,7 @@ +# docker image for sonic config engine + +DOCKER_CONFIG_ENGINE = docker-config-engine.gz +$(DOCKER_CONFIG_ENGINE)_PATH = $(DOCKERS_PATH)/docker-config-engine +$(DOCKER_CONFIG_ENGINE)_DEPENDS += $(SONIC_CONFIG_ENGINE) +$(DOCKER_CONFIG_ENGINE)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index c0d88e595fd8..7a7a1afeb4db 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -2,9 +2,8 @@ DOCKER_DHCP_RELAY = docker-dhcp-relay.gz $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay -$(DOCKER_DHCP_RELAY)_DEPENDS += $(SONIC_CONFIG_ENGINE) -$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_BASE) -SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) +$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) +SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) diff --git a/rules/docker-fpm.mk b/rules/docker-fpm.mk index 4c9c09ffd45e..d7f4d96005cf 100644 --- a/rules/docker-fpm.mk +++ b/rules/docker-fpm.mk @@ -2,8 +2,8 @@ DOCKER_FPM = docker-fpm.gz $(DOCKER_FPM)_PATH = $(DOCKERS_PATH)/docker-fpm -$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS) $(SONIC_CONFIG_ENGINE) -$(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS) +$(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_FPM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM) diff --git a/rules/docker-lldp-sv2.mk b/rules/docker-lldp-sv2.mk index e9f701a49580..d9500d1d077a 100644 --- a/rules/docker-lldp-sv2.mk +++ b/rules/docker-lldp-sv2.mk @@ -2,9 +2,9 @@ DOCKER_LLDP_SV2 = docker-lldp-sv2.gz $(DOCKER_LLDP_SV2)_PATH = $(DOCKERS_PATH)/docker-lldp-sv2 -$(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) $(SONIC_CONFIG_ENGINE) +$(DOCKER_LLDP_SV2)_DEPENDS += $(LLDPD) $(DOCKER_LLDP_SV2)_PYTHON_WHEELS += $(DBSYNCD_PY2) -$(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_LLDP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 92b64bf15b40..09bec7125c08 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -2,10 +2,9 @@ DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor -$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(SONIC_CONFIG_ENGINE) -$(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_BASE) +$(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) +SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) $(DOCKER_PLATFORM_MONITOR)_CONTAINER_NAME = pmon diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk index e3ed0cf1eac8..0cad7cb43407 100644 --- a/rules/docker-snmp-sv2.mk +++ b/rules/docker-snmp-sv2.mk @@ -2,9 +2,9 @@ DOCKER_SNMP_SV2 = docker-snmp-sv2.gz $(DOCKER_SNMP_SV2)_PATH = $(DOCKERS_PATH)/docker-snmp-sv2 -$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) $(SONIC_CONFIG_ENGINE) +$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) $(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(ASYNCSNMP_PY3) -$(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index ec242589b290..f023c3598fa1 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -2,8 +2,8 @@ DOCKER_TEAMD = docker-teamd.gz $(DOCKER_TEAMD)_PATH = $(DOCKERS_PATH)/docker-teamd -$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_CONFIG_ENGINE) -$(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) +$(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD) From 49042c0a9c1e025e6eb80df5a6ec679c2cfe656b Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Wed, 8 Feb 2017 14:13:44 -0800 Subject: [PATCH 0262/1833] Add more version information for newer aboot (#279) --- build_image.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_image.sh b/build_image.sh index 03e518a5fb9c..c6349e927eb4 100755 --- a/build_image.sh +++ b/build_image.sh @@ -45,6 +45,8 @@ elif [ "$IMAGE_TYPE" = "aboot" ]; then zip -g $ABOOT_BOOT_IMAGE .imagehash rm .imagehash echo "SWI_VERSION=42.0.0" > version + echo "SWI_MAX_HWEPOCH=1" >> version + echo "SWI_VARIANT=US" >> version zip -g $OUTPUT_ABOOT_IMAGE version zip -g $ABOOT_BOOT_IMAGE version rm version From e6753fe6f052d65303c343d48d2b751a205b3feb Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 8 Feb 2017 19:02:18 -0800 Subject: [PATCH 0263/1833] [doc]: add build space recommendation --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 611ff644f06d..5e3cffec91dc 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,13 @@ You also need to change all git paths to relative path as we build all submodule # Usage -**NOTE:** In order to be more familiar with build process and make some hanges to it, it is recommended to read this short [Documentation](README.buildsystem.md) - To build NOS installer image and docker images, run command line make configure PLATFORM=[ASIC_VENDOR] SKU=[HW_SKU] make + **NOTE**: We recommend to reserve 50G free space to build one platform. + Supported PLATFORM AND SKU are: - PLATFORM=broadcom SKU=Force10-S6000 - PLATFORM=mellanox SKU=ACS-MSN2700 @@ -55,7 +55,7 @@ Every target has a clean target, so in order to clean swss, execute make target/debs/swss_1.0.0_amd64.deb-clean -It is recommended to use clean targets to clean all packages, that are built together, like dev packages for instance. +It is recommended to use clean targets to clean all packages, that are built together, like dev packages for instance. In order to be more familiar with build process and make some changes to it, it is recommended to read this short [Documentation](README.buildsystem.md). # Note: If you are running make for the first time, a sonic-slave-${USER} docker image will be built automatically. From 822680d21b7b58ed5f870c3f4a405dc0230a49cb Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 8 Feb 2017 22:02:21 -0800 Subject: [PATCH 0264/1833] Build python3.6 deb packages and install them into docker-snmp-sv2 (#245) --- dockers/docker-snmp-sv2/Dockerfile.j2 | 60 +++++++++++------------- dockers/docker-snmp-sv2/supervisord.conf | 2 +- rules/docker-snmp-sv2.mk | 3 +- rules/python3.mk | 36 ++++++++++++++ src/python3.5/build.sh | 18 ------- src/python3/Makefile | 34 ++++++++++++++ 6 files changed, 100 insertions(+), 53 deletions(-) create mode 100644 rules/python3.mk delete mode 100755 src/python3.5/build.sh create mode 100644 src/python3/Makefile diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 33a2bdaa74a8..4e440d7f5e3a 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -1,45 +1,39 @@ FROM docker-config-engine -COPY \ +COPY [ \ {% for deb in docker_snmp_sv2_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ + "debs/{{ deb }}", +{%- endfor %} \ + "/debs/"] -COPY python-wheels /python-wheels +COPY python-wheels/sswsdk-*-py3-*.whl /python-wheels/ +COPY python-wheels/asyncsnmp-*-py3-*.whl /python-wheels/ # enable -O for all Python calls ENV PYTHONOPTIMIZE 1 -## Pre-install the fundamental packages -## Install Python SSWSDK (SNMP subagent dependency) -## Install SNMP subagent -## Clean up -RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev - -RUN dpkg -i \ -{% for deb in docker_snmp_sv2_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} - -RUN rm -rf /debs - +# install supervisor +# install libsnmp30 dependencies +# install libpython3.6-dev dependencies +# install pip dependencies +# TODO: remove libpython3.6-dev, its and pip's dependencies if we can get pip3 directly # install subagent -RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ - rm -rf /var/lib/apt/lists/* && \ - wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz && \ - tar xvf Python-3.5.2.tgz && cd Python-3.5.2 && \ - ./configure --without-doc-strings --prefix=/usr --without-pymalloc --enable-shared && \ - make && make install && \ - ldconfig && \ - cd .. && rm -rf Python-3.5.2 && rm Python-3.5.2.tgz && \ - pip3 install --no-cache-dir /python-wheels/*py3*.whl hiredis && \ +# clean up +RUN apt-get update && apt-get install -y supervisor \ + libperl5.20 libpci3 libwrap0 \ + libexpat1-dev \ + curl gcc && \ + dpkg -i \ +{% for deb in docker_snmp_sv2_debs.split(' ') -%} + debs/{{ deb }}{{' '}} +{%- endfor %} && \ + rm -rf /debs && \ + curl https://bootstrap.pypa.io/get-pip.py | python3.6 && \ + python3.6 -m pip install --no-cache-dir /python-wheels/*py3*.whl hiredis && \ rm -rf /python-wheels && \ - python3 -m sonic_ax_impl install && \ - python3 -m pip uninstall -y pip setuptools && \ - /bin/bash -c "rm -rf /usr/lib/python3.5/{unittest,lib2to3,tkinter,idlelib,email,test}" && \ - apt-get -y purge build-essential libssl-dev openssl && \ - apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ + python3.6 -m sonic_ax_impl install && \ + apt-get -y purge libpython3.6-dev libexpat1-dev curl gcc && \ + apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y --purge && \ find / | grep -E "__pycache__" | xargs rm -rf && \ rm -rf ~/.cache @@ -51,4 +45,4 @@ COPY ["config.sh", "/usr/bin/"] ## Although exposing ports is not need for host net mode, keep it for possible bridge mode EXPOSE 161/udp 162/udp -ENTRYPOINT /usr/bin/config.sh && /usr/bin/supervisord +ENTRYPOINT /usr/bin/config.sh && /usr/bin/supervisord diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index 50b510063d75..689cf5d91948 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -6,7 +6,7 @@ command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigg priority=100 [program:snmp-subagent] -command=/usr/bin/env python3 -m sonic_ax_impl +command=/usr/bin/env python3.6 -m sonic_ax_impl priority=200 [program:rsyslogd] diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk index 0cad7cb43407..95fdcc25775c 100644 --- a/rules/docker-snmp-sv2.mk +++ b/rules/docker-snmp-sv2.mk @@ -2,7 +2,8 @@ DOCKER_SNMP_SV2 = docker-snmp-sv2.gz $(DOCKER_SNMP_SV2)_PATH = $(DOCKERS_PATH)/docker-snmp-sv2 -$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) +## TODO: remove LIBPY3_DEV if we can get pip3 directly +$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) $(PY3) $(LIBPY3_DEV) $(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(ASYNCSNMP_PY3) $(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) diff --git a/rules/python3.mk b/rules/python3.mk new file mode 100644 index 000000000000..8fa02a26a462 --- /dev/null +++ b/rules/python3.mk @@ -0,0 +1,36 @@ +PYTHON_VER=3.6.0-1 +PYTHON_PNAME=python3.6 + +export PYTHON_VER +export PYTHON_PNAME + +LIBPY3_MIN = lib$(PYTHON_PNAME)-minimal_$(PYTHON_VER)_amd64.deb +$(LIBPY3_MIN)_SRC_PATH = $(SRC_PATH)/python3 +$(LIBPY3_MIN)_DEPENDS += +$(LIBPY3_MIN)_RDEPENDS += +SONIC_MAKE_DEBS += $(LIBPY3_MIN) + +LIBPY3_STD = lib$(PYTHON_PNAME)-stdlib_$(PYTHON_VER)_amd64.deb +$(eval $(call add_derived_package,$(LIBPY3_MIN),$(LIBPY3_STD))) +$(LIBPY3_STD)_DEPENDS += $(LIBMPDECIMAL) +$(LIBPY3_STD)_RDEPENDS += $(LIBPY3_MIN) $(LIBMPDECIMAL) + +LIBPY3 = lib$(PYTHON_PNAME)_$(PYTHON_VER)_amd64.deb +$(eval $(call add_derived_package,$(LIBPY3_MIN),$(LIBPY3))) +$(LIBPY3)_DEPENDS += $(LIBPY3_STD) +$(LIBPY3)_RDEPENDS += $(LIBPY3_MIN) $(LIBPY3_STD) + +PY3_MIN = $(PYTHON_PNAME)-minimal_$(PYTHON_VER)_amd64.deb +$(eval $(call add_derived_package,$(LIBPY3_MIN),$(PY3_MIN))) +$(PY3_MIN)_RDEPENDS += $(LIBPY3_MIN) + +PY3 = $(PYTHON_PNAME)_$(PYTHON_VER)_amd64.deb +$(eval $(call add_derived_package,$(LIBPY3_MIN),$(PY3))) +$(PY3)_DEPENDS += $(PY3_MIN) $(LIBPY3) +$(PY3)_RDEPENDS += $(PY3_MIN) $(LIBPY3) $(LIBPY3_MIN) + +LIBPY3_DEV = lib$(PYTHON_PNAME)-dev_$(PYTHON_VER)_amd64.deb +$(eval $(call add_derived_package,$(LIBPY3_MIN),$(LIBPY3_DEV))) +$(LIBPY3_DEV)_DEPENDS += $(LIBPY3) $($(LIBPY3)_DEPENDS) +$(LIBPY3_DEV)_RDEPENDS += $(LIBPY3) $($(LIBPY3)_RDEPENDS) + diff --git a/src/python3.5/build.sh b/src/python3.5/build.sh deleted file mode 100755 index ebada5397e1b..000000000000 --- a/src/python3.5/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -PYTHON_VER=3.5.2 -PYTHON_DEB_VER=8 - -wget -N http://http.debian.net/debian/pool/main/p/python3.5/python3.5_${PYTHON_VER}.orig.tar.xz -wget -N http://http.debian.net/debian/pool/main/p/python3.5/python3.5_${PYTHON_VER}-${PYTHON_DEB_VER}.debian.tar.xz -wget -N http://http.debian.net/debian/pool/main/p/python3.5/python3.5_${PYTHON_VER}-${PYTHON_DEB_VER}.dsc - -dpkg-source -x python3.5_${PYTHON_VER}-${PYTHON_DEB_VER}.dsc - -pushd python3.5-${PYTHON_VER} - -dpkg-buildpackage -us -uc -b - -popd - -cp *.deb ../ diff --git a/src/python3/Makefile b/src/python3/Makefile new file mode 100644 index 000000000000..63941810677b --- /dev/null +++ b/src/python3/Makefile @@ -0,0 +1,34 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +PYTHON_VER=3.6.0 +PYTHON_DEB_VER=1 +PYTHON_PNAME=python3.6 + +MAIN_TARGET = lib$(PYTHON_PNAME)-minimal_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb +DERIVED_TARGETS = lib$(PYTHON_PNAME)-stdlib_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb \ + lib$(PYTHON_PNAME)_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb \ + $(PYTHON_PNAME)-minimal_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb \ + $(PYTHON_PNAME)_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb \ + lib$(PYTHON_PNAME)-dev_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb + #$(PYTHON_PNAME)-dev_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + ## Obtaining the python3 + wget 'https://sonicstorage.blob.core.windows.net/packages/$(PYTHON_PNAME)_$(PYTHON_VER).orig.tar.xz?sv=2015-04-05&sr=b&sig=d42Wh1CA9NZvlskhW4fpWcHVgc7N3IKhdFzyeO2zbRA%3D&se=2027-02-02T01%3A00%3A57Z&sp=r' -O $(PYTHON_PNAME)_$(PYTHON_VER).orig.tar.xz + wget 'https://sonicstorage.blob.core.windows.net/packages/$(PYTHON_PNAME)_$(PYTHON_VER)-$(PYTHON_DEB_VER).debian.tar.xz?sv=2015-04-05&sr=b&sig=KLX9pMJ3zpQvGBo6ZjzoZXgooMJRUUwMx8ZaTJtywK0%3D&se=2027-02-02T00%3A59%3A34Z&sp=r' -O $(PYTHON_PNAME)_$(PYTHON_VER)-$(PYTHON_DEB_VER).debian.tar.xz + wget 'https://sonicstorage.blob.core.windows.net/packages/$(PYTHON_PNAME)_$(PYTHON_VER)-$(PYTHON_DEB_VER).dsc?sv=2015-04-05&sr=b&sig=95s%2FC4vKY6bRKtkUTz%2BmHLqOllBOYbfP3zV5ayAuzSM%3D&se=2027-02-02T01%3A00%3A26Z&sp=r' -O $(PYTHON_PNAME)_$(PYTHON_VER)-$(PYTHON_DEB_VER).dsc + + ## Build + dpkg-source -x $(PYTHON_PNAME)_$(PYTHON_VER)-$(PYTHON_DEB_VER).dsc + pushd $(PYTHON_PNAME)-$(PYTHON_VER) + sudo apt-get install devscripts + mk-build-deps + sudo dpkg -i $(PYTHON_PNAME)-build-deps_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb || sudo apt-get install -f + dpkg-buildpackage -us -uc -b + popd + + cp $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) From 064dab606fe445fe1cc862d4b825984f7735249a Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 9 Feb 2017 16:24:52 +0200 Subject: [PATCH 0265/1833] [gitignore] Add .sku (#283) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e9c5da1caacf..ee80cf8d6c5c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Build system related .platform +.sku # Build artifacts fsroot/ From e5616f236d480fdc8116ec0db5ccaafc8d197c7c Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 9 Feb 2017 06:52:20 -0800 Subject: [PATCH 0266/1833] [swss]: Wait for redis server start before database clean (#281) picked this change from sonic-mgmt repo. https://github.com/Azure/sonic-mgmt/pull/110 --- files/build_templates/swss.service.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index b7e34335f5fe..f60ef6712dd8 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -5,6 +5,8 @@ After=database.service [Service] User={{ sonicadmin_user }} +# Wait for redis server start before database clean +ExecStartPre=/bin/bash -c "while true; do if [ \"$(/usr/bin/docker exec database redis-cli ping)\" == \"PONG\" ]; then break; fi; sleep 1; done" ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB From 55acd9e9e3de63f95891b0b636ced2f268d4ff50 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 9 Feb 2017 13:36:26 -0800 Subject: [PATCH 0267/1833] [python3]: add dpkg_lock in python3 build (#285) --- src/python3/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/python3/Makefile b/src/python3/Makefile index 63941810677b..80f977ff579d 100644 --- a/src/python3/Makefile +++ b/src/python3/Makefile @@ -23,10 +23,16 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : ## Build dpkg-source -x $(PYTHON_PNAME)_$(PYTHON_VER)-$(PYTHON_DEB_VER).dsc pushd $(PYTHON_PNAME)-$(PYTHON_VER) - sudo apt-get install devscripts mk-build-deps - sudo dpkg -i $(PYTHON_PNAME)-build-deps_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb || sudo apt-get install -f - dpkg-buildpackage -us -uc -b + + # put a lock here because dpkg does not allow installing packages in parallel + while true; do + if mkdir $(DEST)/dpkg_lock &> /dev/null; then + { echo here && (sudo dpkg -i $(PYTHON_PNAME)-build-deps_$(PYTHON_VER)-$(PYTHON_DEB_VER)_amd64.deb || sudo apt-get install -f) && rm -d $(DEST)/dpkg_lock && break; } || { rm -d $(DEST)/dpkg_lock && exit 1 ; } + fi + done + + dpkg-buildpackage -rfakeroot -us -uc -b popd cp $(DERIVED_TARGETS) $* $(DEST)/ From 6119a58e4a93f8a15de48baa7132b2b8feb5eebc Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 10 Feb 2017 07:39:05 -0800 Subject: [PATCH 0268/1833] [build_debian]: install deps in rootfs instead of just extracting the packages (#280) packages contains post-install that needs to be performed --- .gitmodules | 4 ++-- build_debian.sh | 5 +---- files/build_templates/sonic_debian_extension.j2 | 15 +++++++++++++++ platform/broadcom/docker-syncd-brcm.mk | 1 + platform/broadcom/sonic-platform-modules-arista | 2 +- slave.mk | 1 + 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.gitmodules b/.gitmodules index 35e7290b8000..472c4bc60186 100644 --- a/.gitmodules +++ b/.gitmodules @@ -50,6 +50,6 @@ [submodule "platform/broadcom/sonic-platform-modules-s6000"] path = platform/broadcom/sonic-platform-modules-s6000 url = https://github.com/Azure/sonic-platform-modules-s6000 -[submodule "sonic-platform-modules-arista"] +[submodule "platform/broadcom/sonic-platform-modules-arista"] path = platform/broadcom/sonic-platform-modules-arista - url = https://github.com/lguohan/sonic-1 + url = https://github.com/aristanetworks/sonic diff --git a/build_debian.sh b/build_debian.sh index 76cd4467ce10..46d23355dd63 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -58,7 +58,7 @@ DEFAULT_USERINFO="Default admin user,,," ## Prepare the file system directory if [[ -d $FILESYSTEM_ROOT ]]; then - sudo rm -r $FILESYSTEM_ROOT || die "Failed to clean chroot directory" + sudo rm -rf $FILESYSTEM_ROOT || die "Failed to clean chroot directory" fi mkdir -p $FILESYSTEM_ROOT @@ -272,6 +272,3 @@ pushd $FILESYSTEM_ROOT && sudo tar czf $OLDPWD/$FILESYSTEM_DOCKERFS -C var/lib/d ## Compress together with /boot and /var/lib/docker as an installer payload zip file pushd $FILESYSTEM_ROOT && sudo zip $OLDPWD/$ONIE_INSTALLER_PAYLOAD -r boot/; popd sudo zip -g $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS $FILESYSTEM_DOCKERFS - -## Remove fsroot -sudo rm -rf $FILESYSTEM_ROOT diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index be7f338dae81..edb941c01904 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -95,9 +95,24 @@ sudo mv sonic_version.yml $FILESYSTEM_ROOT/etc/sonic/ # Copy sudoers configuration file sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ +## Install package without starting service +## ref: https://wiki.debian.org/chroot +sudo tee -a $FILESYSTEM_ROOT/usr/sbin/policy-rc.d > /dev/null < Date: Fri, 10 Feb 2017 10:36:39 -0800 Subject: [PATCH 0269/1833] Update submodule sonic-snmpagent (#287) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 5c30a369a94b..a3391a9c709a 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 5c30a369a94b9312a8858c3bc9a3db083d835900 +Subproject commit a3391a9c709a1160dd7d261ac1da2013127c3d45 From 815bf53de71df10f97ebd0ba8d72c9b5db44523f Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 10 Feb 2017 10:40:09 -0800 Subject: [PATCH 0270/1833] snmpd disables inetCidrRouteTable module (#286) --- dockers/docker-snmp-sv2/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index 689cf5d91948..eed4bf83cb0e 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -2,7 +2,7 @@ nodaemon=true [program:snmpd] -command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable -p /run/snmpd.pid +command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable -p /run/snmpd.pid priority=100 [program:snmp-subagent] From ec584a2cc02caa1fc11ae832f215345c2c656429 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 13 Feb 2017 01:05:12 +0200 Subject: [PATCH 0271/1833] [sonic-utilities]: integrate into base image (#282) Signed-off-by: marian-pritsak --- files/build_templates/sonic_debian_extension.j2 | 13 +++++++++++++ slave.mk | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index edb941c01904..d0d4fc7849a4 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -44,6 +44,19 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} +# Python tabulate required for sonic-utilities +python_tabulate_url=http://packages.microsoft.com/repos/sonic-dev/pool/main/p/python-tabulate/python-tabulate_0.7.7-1_all.deb +python_template_deb_temp=`mktemp` +trap_push "rm -f $python_template_deb_temp" +wget $python_tabulate_url -qO $python_template_deb_temp && { \ + sudo dpkg --root=$FILESYSTEM_ROOT -i $python_template_deb_temp || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f; \ +} + +# Sonic utilities +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-utilities_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # Create all needed directories sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/templates/ diff --git a/slave.mk b/slave.mk index 27698094657b..80ed530960c1 100644 --- a/slave.mk +++ b/slave.mk @@ -285,7 +285,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER)) $(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_UTILS)) $(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $(HEADER) ## Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" From 6a6f5a66a8d8ed4861b1a775a8f0887e407a84f4 Mon Sep 17 00:00:00 2001 From: antonpatenko Date: Mon, 13 Feb 2017 04:02:04 +0200 Subject: [PATCH 0272/1833] [docker-base]: unsubmodule docker-base. (#275) Convert docker-base from submodule into a regular directory. --- .gitmodules | 3 -- dockers/docker-base | 1 - dockers/docker-base/Dockerfile | 41 +++++++++++++++++++ dockers/docker-base/LICENSE | 14 +++++++ dockers/docker-base/dpkg_01_drop | 22 +++++++++++ dockers/docker-base/rsyslog.conf | 68 ++++++++++++++++++++++++++++++++ dockers/docker-base/sources.list | 7 ++++ 7 files changed, 152 insertions(+), 4 deletions(-) delete mode 160000 dockers/docker-base create mode 100644 dockers/docker-base/Dockerfile create mode 100644 dockers/docker-base/LICENSE create mode 100644 dockers/docker-base/dpkg_01_drop create mode 100644 dockers/docker-base/rsyslog.conf create mode 100644 dockers/docker-base/sources.list diff --git a/.gitmodules b/.gitmodules index 472c4bc60186..5b542b1499ef 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "docker-base"] - path = dockers/docker-base - url = https://github.com/Azure/sonic-docker-base.git [submodule "sonic-swss-common"] path = src/sonic-swss-common url = https://github.com/Azure/sonic-swss-common diff --git a/dockers/docker-base b/dockers/docker-base deleted file mode 160000 index 4b42689e8c5b..000000000000 --- a/dockers/docker-base +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4b42689e8c5b14deda6ef64a287e4641bd999bf5 diff --git a/dockers/docker-base/Dockerfile b/dockers/docker-base/Dockerfile new file mode 100644 index 000000000000..b5f6b7c855c5 --- /dev/null +++ b/dockers/docker-base/Dockerfile @@ -0,0 +1,41 @@ +FROM debian:jessie + +## Clean documentation in FROM image +RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true +## Clean doc directories that are empty or only contain empty directories +RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done +RUN rm -rf \ + /usr/share/man/* \ + /usr/share/groff/* \ + /usr/share/info/* \ + /usr/share/lintian/* \ + /usr/share/linda/* \ + /var/cache/man/* \ + /usr/share/locale/* + +## Set the apt source +COPY sources.list /etc/apt/sources.list +COPY dpkg_01_drop /etc/dpkg/dpkg.cfg.d/01_drop +RUN apt-get clean && apt-get update + +## Pre-install the fundamental packages +RUN apt-get -y install \ + rsyslog \ + vim-tiny \ + perl \ + python + +COPY rsyslog.conf /etc/rsyslog.conf + +RUN apt-get -y purge \ + exim4 \ + exim4-base \ + exim4-config \ + exim4-daemon-light + +## Clean up apt +## Remove /var/lib/apt/lists/*, could be obsoleted for derived images +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; \ + rm -rf /var/lib/apt/lists/*; \ + rm -rf /tmp/*; + diff --git a/dockers/docker-base/LICENSE b/dockers/docker-base/LICENSE new file mode 100644 index 000000000000..1d7131f729e9 --- /dev/null +++ b/dockers/docker-base/LICENSE @@ -0,0 +1,14 @@ +Copyright 2016 Microsoft, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + diff --git a/dockers/docker-base/dpkg_01_drop b/dockers/docker-base/dpkg_01_drop new file mode 100644 index 000000000000..e75ef3147158 --- /dev/null +++ b/dockers/docker-base/dpkg_01_drop @@ -0,0 +1,22 @@ +## Drop unnecessary files +## ref: https://wiki.ubuntu.com/ReducingDiskFootprint + +## Documentation +path-exclude /usr/share/doc/* +# we need to keep copyright files for legal reasons +path-include /usr/share/doc/*/copyright +path-exclude /usr/share/man/* +path-exclude /usr/share/groff/* +path-exclude /usr/share/info/* +# lintian stuff is small, but really unnecessary +path-exclude /usr/share/lintian/* +path-exclude /usr/share/linda/* + +## Translations +path-exclude /usr/share/locale/* + +## Landscape +path-exclude /usr/share/pyshared/twisted/test* +path-exclude /usr/lib/python*/dist-packages/twisted/test* +path-exclude /usr/share/pyshared/twisted/*/test* +path-exclude /usr/lib/python*/dist-packages/twisted/*/test* diff --git a/dockers/docker-base/rsyslog.conf b/dockers/docker-base/rsyslog.conf new file mode 100644 index 000000000000..e03df1f741c2 --- /dev/null +++ b/dockers/docker-base/rsyslog.conf @@ -0,0 +1,68 @@ +############################################################################### +# Managed by Ansible +# file: ansible/roles/acs/templates/rsyslog.conf.j2 +############################################################################### +# +# /etc/rsyslog.conf Configuration file for rsyslog. +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html + + +################# +#### MODULES #### +################# + +$ModLoad imuxsock # provides support for local system logging +#$ModLoad imklog # provides kernel logging support +#$ModLoad immark # provides --MARK-- message capability + +# provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 + +# provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +########################### +#### GLOBAL DIRECTIVES #### +########################### +#Set remote syslog server +*.* @127.0.0.1:514 + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# Define a custom template +$template ACSFileFormat,"%TIMESTAMP% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" +$ActionFileDefaultTemplate ACSFileFormat + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# +# Where to place spool and state files +# +$WorkDirectory /var/spool/rsyslog + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + + +############### +#### RULES #### +############### + diff --git a/dockers/docker-base/sources.list b/dockers/docker-base/sources.list new file mode 100644 index 000000000000..2ed195cff416 --- /dev/null +++ b/dockers/docker-base/sources.list @@ -0,0 +1,7 @@ +## Debian mirror on Microsoft Azure +## Ref: http://debian-archive.trafficmanager.net/ + +deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free +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 From 0a6565d6a490cc28c24c6409ec7bf242618965f1 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 12 Feb 2017 21:18:09 -0800 Subject: [PATCH 0273/1833] [config]: add device type in minigraph (#290) --- files/image_config/minigraph/minigraph_ACS-MSN2700.xml | 6 ++++++ files/image_config/minigraph/minigraph_AS7512.xml | 6 ++++++ files/image_config/minigraph/minigraph_Force10-S6000.xml | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/files/image_config/minigraph/minigraph_ACS-MSN2700.xml b/files/image_config/minigraph/minigraph_ACS-MSN2700.xml index 5cfa271b19e2..0fa570c7a0a8 100644 --- a/files/image_config/minigraph/minigraph_ACS-MSN2700.xml +++ b/files/image_config/minigraph/minigraph_ACS-MSN2700.xml @@ -1037,6 +1037,12 @@ Ethernet1 + + + switch2 + ACS-MSN2700 + + ` switch2 ACS-MSN2700 diff --git a/files/image_config/minigraph/minigraph_AS7512.xml b/files/image_config/minigraph/minigraph_AS7512.xml index 5cfa271b19e2..0fbd853220b2 100644 --- a/files/image_config/minigraph/minigraph_AS7512.xml +++ b/files/image_config/minigraph/minigraph_AS7512.xml @@ -1037,6 +1037,12 @@ Ethernet1 + + + switch2 + ACS-MSN2700 + + switch2 ACS-MSN2700 diff --git a/files/image_config/minigraph/minigraph_Force10-S6000.xml b/files/image_config/minigraph/minigraph_Force10-S6000.xml index 76ede4bc8ba5..436f6880da4f 100644 --- a/files/image_config/minigraph/minigraph_Force10-S6000.xml +++ b/files/image_config/minigraph/minigraph_Force10-S6000.xml @@ -1037,6 +1037,12 @@ Ethernet1 + + + switch1 + Force10-S6000 + + switch1 Force10-S6000 From ecc9f0c6d8e16fa071c62bf51b12fe53196642e7 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 13 Feb 2017 14:17:22 -0800 Subject: [PATCH 0274/1833] Properly pull vlan subnet from minigraph when writing bgpd.conf (#293) --- dockers/docker-fpm/bgpd.conf.j2 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dockers/docker-fpm/bgpd.conf.j2 b/dockers/docker-fpm/bgpd.conf.j2 index 0e03561f82fe..ed9afe0c3388 100644 --- a/dockers/docker-fpm/bgpd.conf.j2 +++ b/dockers/docker-fpm/bgpd.conf.j2 @@ -35,10 +35,8 @@ router bgp {{ minigraph_bgp_asn }} {% endfor %} {% endblock bgp_init %} {% block vlan_advertisement %} -{% for interface in minigraph_interfaces %} -{% if interface['name'].startswith('Vlan') %} - network {{ interface['subnet'] }} -{% endif %} +{% for vlan_interface in minigraph_vlan_interfaces %} + network {{ vlan_interface['subnet'] }} {% endfor %} {% endblock vlan_advertisement %} {% block bgp_sessions %} From 7e9f6b4e12a47ed58c688aceafdac8862514962e Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 13 Feb 2017 17:52:29 -0800 Subject: [PATCH 0275/1833] Remove /etc/default/snmpd from snmp docker (#294) --- dockers/docker-snmp-sv2/Dockerfile.j2 | 1 - dockers/docker-snmp-sv2/snmpd | 11 ----------- 2 files changed, 12 deletions(-) delete mode 100644 dockers/docker-snmp-sv2/snmpd diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 4e440d7f5e3a..21d1573f0e10 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -39,7 +39,6 @@ RUN apt-get update && apt-get install -y supervisor \ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ["*.j2", "/etc/swss/snmp/"] -COPY ["snmpd", "/etc/default/"] COPY ["config.sh", "/usr/bin/"] ## Although exposing ports is not need for host net mode, keep it for possible bridge mode diff --git a/dockers/docker-snmp-sv2/snmpd b/dockers/docker-snmp-sv2/snmpd deleted file mode 100644 index 576c366d2ba1..000000000000 --- a/dockers/docker-snmp-sv2/snmpd +++ /dev/null @@ -1,11 +0,0 @@ -# This file controls the activity of snmpd - -# Don't load any MIBs by default. -# You might comment this lines once you have the MIBs downloaded. -export MIBS= - -# snmpd control (yes means start daemon). -SNMPDRUN=yes - -# snmpd options (use syslog, close stdin/out/err). -SNMPDOPTS='-LS4d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable -p /run/snmpd.pid' From f5b2dccee9c2908ba22fb6ca916da300988291f4 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 14 Feb 2017 16:56:08 -0800 Subject: [PATCH 0276/1833] Allow build image with local changes for debug purpose (#247) * Allow build with local change for debug purpose Uncomment DEBUG_BUILD = y in rule.mk/config to enable local build --- Makefile | 1 + build_image.sh | 12 ++++++++---- rules/config | 4 ++++ slave.mk | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index b819d41cfb67..070c540509cf 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ DOCKER_BUILD = docker build --no-cache \ -f slave.mk \ PLATFORM=$(PLATFORM) \ SKU=$(SKU) \ + DEBUG_BUILD=$(DEBUG_BUILD) \ $@ sonic-slave-build : diff --git a/build_image.sh b/build_image.sh index c6349e927eb4..ab2e85b4836d 100755 --- a/build_image.sh +++ b/build_image.sh @@ -13,11 +13,15 @@ } ## Retrieval short version of Git revision hash for partition metadata -[ -z "$(git status --untracked-files=no -s --ignore-submodules)" ] || { - echo "Error: There is local changes not committed to git repo. Cannot get a revision hash for partition metadata." +if [ -z "$(git status --untracked-files=no -s --ignore-submodules)" ]; then + GIT_REVISION=$(git rev-parse --short HEAD) +elif [ ! "$DEBUG_BUILD" = "y" ]; then + echo "Error: There are local changes not committed to git repo. Cannot get a revision hash for partition metadata." exit 1 -} -GIT_REVISION=$(git rev-parse --short HEAD) +else + echo "Warning: There are local changes not committed to git repo, revision hash won't be tracked. Never deploy this image for other than debugging purpose." + GIT_REVISION=$(git rev-parse --short HEAD)"_local_debug" +fi if [ "$IMAGE_TYPE" = "onie" ]; then echo "Build ONIE installer" diff --git a/rules/config b/rules/config index d76477ce5adc..142a7c0d10f7 100644 --- a/rules/config +++ b/rules/config @@ -11,6 +11,10 @@ # Uncomment next line to enable: # SONIC_CONFIG_PRINT_DEPENDENCIES = y +# DEBUG_BUILD - enable building image with uncommitted local changes. +# Uncomment next line to enable: +# DEBUG_BUILD = y + # SONIC_CONFIG_BUILD_JOBS - set number of jobs for parallel build. # Corresponding -j argument will be passed to make command inside docker # container. diff --git a/slave.mk b/slave.mk index 80ed530960c1..c2d4fe983b0b 100644 --- a/slave.mk +++ b/slave.mk @@ -321,7 +321,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform ) ./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG) - TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) ./build_image.sh $(LOG) + TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) DEBUG_BUILD=$(DEBUG_BUILD) ./build_image.sh $(LOG) $(foreach docker, $($*_DOCKERS), \ rm $($(docker)_CONTAINER_NAME).sh From e439ee3152540a412912add5a429729f03922499 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 14 Feb 2017 18:51:24 -0800 Subject: [PATCH 0277/1833] [installer]: add console override for z9100 (#295) --- installer/x86_64/platforms/x86_64-dell_z9100_c2538-r0 | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 installer/x86_64/platforms/x86_64-dell_z9100_c2538-r0 diff --git a/installer/x86_64/platforms/x86_64-dell_z9100_c2538-r0 b/installer/x86_64/platforms/x86_64-dell_z9100_c2538-r0 new file mode 100644 index 000000000000..26ee5ef89de6 --- /dev/null +++ b/installer/x86_64/platforms/x86_64-dell_z9100_c2538-r0 @@ -0,0 +1,2 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 From fe519be94102f4a02d6faec3f0ce9edcb921a7b5 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 15 Feb 2017 18:48:37 +0200 Subject: [PATCH 0278/1833] [src]: Update sonic-swss submodule reference (#297) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 5d31f9d6db40..1ceb354a6742 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 5d31f9d6db407882323ce5484a1a1e5f7648121a +Subproject commit 1ceb354a6742a35d65e31fb28ea68a2e6b9643dd From e702fc07328e63a7f82c229904a47ccb0c70ab58 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 15 Feb 2017 08:48:52 -0800 Subject: [PATCH 0279/1833] [Broadcom]: Update debian packages (#296) Signed-off-by: Shuotian Cheng --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 89a838d872de..9e07ccf4b91c 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.3.1+0-20170203082839.11-1.gbp995de3_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.3.1+0-20170203082839.11-1.gbp995de3_amd64.deb?sv=2015-04-05&sr=b&sig=q%2Byg1WtnhhGHBeOjyO7LfMZejwqER%2F7Hdr%2F%2Bxs%2FUFSA%3D&se=2030-10-13T19%3A49%3A10Z&sp=r" +BRCM_SAI = libsaibcm_2.1.3.1-1-20170208221802.12_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.3.1-1-20170208221802.12_amd64.deb?sv=2015-04-05&sr=b&sig=RpHs7rvOiM%2FzBHeaA2BwP4CYRmiJFhPGBn88Hx9V5Rg%3D&se=2030-10-25T02%3A43%3A53Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.3.1+0-20170203082839.11-1.gbp995de3_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.3.1-1-20170208221802.12_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.3.1+0-20170203082839.11-1.gbp995de3_amd64.deb?sv=2015-04-05&sr=b&sig=ihcuduBFhzV5yj%2F2kI%2BzTshm85KFtm2XGqHcXo%2FwD5U%3D&se=2030-10-13T19%3A50%3A07Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.3.1-1-20170208221802.12_amd64.deb?sv=2015-04-05&sr=b&sig=DNOUenzhSfCHR4QdxkNwf5zdoecCblClau4rjoa0oJE%3D&se=2030-10-25T02%3A47%3A33Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index c9f9662a72e5..a4f2dbfeb79d 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.1.5-5-20170203072429.19_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-5-20170203072429.19_amd64.deb?sv=2015-04-05&sr=b&sig=ay3U2TMBqVOlDmT75PlLCn0olcjixH96whjjdPM4IGI%3D&se=2030-10-13T19%3A50%3A48Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.1.5-6-20170208212127.20_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-6-20170208212127.20_amd64.deb?sv=2015-04-05&sr=b&sig=VrkDUWofqRz7G70C8%2BGIVtimvNPgnSkCkZccEVPmiIM%3D&se=2030-10-25T02%3A46%3A20Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-5-20170203072429.19_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-5-20170203072429.19_amd64.deb?sv=2015-04-05&sr=b&sig=WttrjSL1EtqPA50ZZEn52pOUojMqmP9e7Gdcrj9a%2FVI%3D&se=2030-10-13T19%3A51%3A16Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-6-20170208212127.20_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-6-20170208212127.20_amd64.deb?sv=2015-04-05&sr=b&sig=FUNtA7GYpHPoP9QH72VdwLk0yxCUAmEqNmZm%2FEMOUf8%3D&se=2030-10-25T02%3A45%3A34Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 877291ae91cfa94e1125826c00b86815920b4b79 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 15 Feb 2017 08:54:10 -0800 Subject: [PATCH 0280/1833] [docker-teamd]: Automatically start the processes after host interfaces are created (#278) Signed-off-by: Shuotian Cheng --- dockers/docker-teamd/Dockerfile.j2 | 3 ++- dockers/docker-teamd/start.sh | 38 ++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index bff5ef11d4f5..35492bdb4670 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -19,4 +19,5 @@ COPY ["teamd.j2", "/etc/swss/teamd/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT /usr/bin/config.sh && /usr/bin/start.sh +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/config.sh && /usr/bin/start.sh"] diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index 61251cd82d86..268217272f6e 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -2,23 +2,35 @@ TEAMD_CONF_PATH=/etc/teamd +function start_app { + if [ -d $TEAMD_CONF_PATH ]; then + for f in $TEAMD_CONF_PATH/*; do + teamd -f $f -d + done + fi + teamsyncd & +} + function clean_up { - pkill -9 teamd - pkill -9 teamsyncd - service rsyslog stop - exit + pkill -9 teamd + pkill -9 teamsyncd + service rsyslog stop + exit } trap clean_up SIGTERM SIGKILL service rsyslog start -if [ -d $TEAMD_CONF_PATH ]; then - for f in $TEAMD_CONF_PATH/*; do - teamd -f $f -d - done -fi - -teamsyncd & - -read +# Before teamd could automatically add newly created host interfaces into the +# LAG, this workaround will wait until the host interfaces are created and then +# the processes will be started. +while true; do + # Check if front-panel ports are configured + result=`echo -en "SELECT 0\nHGETALL PORT_TABLE:ConfigDone" | redis-cli | sed -n 3p` + if [ "$result" != "0" ]; then + start_app + read + fi + sleep 1 +done From 89a695a5e79d1c4811ce3a476b672b97900f4a2a Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Wed, 15 Feb 2017 23:18:02 -0800 Subject: [PATCH 0281/1833] [union-mount] Rescan dev if root partition disapear (#298) On some platforms after the initramfs init scripts have mounted the root device its block device disapear from /dev. The union-mount script therefore can't mount the root device over the aufs. If this case happen, issue a rescan of the devices to repopulate the /dev filesystem. --- files/initramfs-tools/union-mount.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index 531436c39a2f..037a9c240333 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -8,6 +8,8 @@ esac ## Mount the aufs file system: rw layer over squashfs mkdir -p ${rootmnt}/host/rw mount -n -o dirs=${rootmnt}/host/rw:${rootmnt}=ro -t aufs root-aufs ${rootmnt} +## Check if the root block device is still there +[ -b ${ROOT} ] || mdev -s ## Mount the raw partition again mount ${ROOT} ${rootmnt}/host ## Mount the working directory of docker engine in the raw partition, bypass the aufs From 8a24c05f045436427a89f94158cfc58dc0bcf47e Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 16 Feb 2017 21:03:59 -0800 Subject: [PATCH 0282/1833] [src]: Update submodule sonic-py-swsssdk (#302) --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 7bbe8419f719..e5cbe0c8b65b 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 7bbe8419f719f577fdf923c8eadd0d462a9ce72a +Subproject commit e5cbe0c8b65bcdb1cf35cf05261521dcea0a2e3a From a845740543699ea6eeed999709d4bb6af098e190 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 16 Feb 2017 21:48:49 -0800 Subject: [PATCH 0283/1833] [All Dockerfiles]: Prevent apt asking questions on the console (#300) Add noninteractive setting into every Dockerfile in the repo Signed-off-by: Pavel Shirshov pavelsh@microsoft.com --- dockers/docker-base/Dockerfile | 3 +++ dockers/docker-basic_router/Dockerfile | 4 ++++ dockers/docker-bgp/Dockerfile | 3 +++ dockers/docker-config-engine/Dockerfile.j2 | 3 +++ dockers/docker-database/Dockerfile.j2 | 3 +++ dockers/docker-fpm/Dockerfile.j2 | 3 +++ dockers/docker-lldp-sv2/Dockerfile.j2 | 3 +++ dockers/docker-lldp/Dockerfile | 3 +++ dockers/docker-mlnx-sswsyncd/Dockerfile | 3 +++ dockers/docker-orchagent/Dockerfile.j2 | 3 +++ dockers/docker-platform-monitor/Dockerfile | 3 +++ dockers/docker-ptf-saithrift/Dockerfile | 3 +++ dockers/docker-saiserver-brcm/Dockerfile | 3 +++ dockers/docker-saiserver-mlnx/Dockerfile | 3 +++ dockers/docker-snmp-sv2/Dockerfile.j2 | 3 +++ dockers/docker-snmp/Dockerfile | 3 +++ dockers/docker-sswsyncd/Dockerfile | 3 +++ dockers/docker-teamd/Dockerfile.j2 | 3 +++ dockers/docker-vas/Dockerfile | 3 +++ platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 3 +++ platform/cavium/docker-syncd-cavm/Dockerfile.j2 | 3 +++ platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 3 +++ platform/p4/docker-sonic-p4/Dockerfile.j2 | 3 +++ sonic-slave/Dockerfile | 3 +++ 24 files changed, 73 insertions(+) diff --git a/dockers/docker-base/Dockerfile b/dockers/docker-base/Dockerfile index b5f6b7c855c5..59af1f3ac6a3 100644 --- a/dockers/docker-base/Dockerfile +++ b/dockers/docker-base/Dockerfile @@ -13,6 +13,9 @@ RUN rm -rf \ /var/cache/man/* \ /usr/share/locale/* +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + ## Set the apt source COPY sources.list /etc/apt/sources.list COPY dpkg_01_drop /etc/dpkg/dpkg.cfg.d/01_drop diff --git a/dockers/docker-basic_router/Dockerfile b/dockers/docker-basic_router/Dockerfile index 095de44b02e2..8bf1875ab98c 100644 --- a/dockers/docker-basic_router/Dockerfile +++ b/dockers/docker-basic_router/Dockerfile @@ -2,10 +2,14 @@ FROM docker-base MAINTAINER Xudong Wu +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + ## Set the apt source RUN apt-get clean && apt-get update COPY deps /deps + RUN dpkg -i /deps/libopennsl_*.deb; \ dpkg -i /deps/libsaibcm_*.deb; \ apt-get -y install -f diff --git a/dockers/docker-bgp/Dockerfile b/dockers/docker-bgp/Dockerfile index b01698e31118..17c58524a079 100755 --- a/dockers/docker-bgp/Dockerfile +++ b/dockers/docker-bgp/Dockerfile @@ -1,5 +1,8 @@ FROM docker-base +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + COPY deps/quagga_*.deb /deps/ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ dpkg_apt /deps/quagga_*.deb && \ diff --git a/dockers/docker-config-engine/Dockerfile.j2 b/dockers/docker-config-engine/Dockerfile.j2 index 56ed38f10f90..067983724014 100644 --- a/dockers/docker-config-engine/Dockerfile.j2 +++ b/dockers/docker-config-engine/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-base +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update # Dependencies for sonic-cfggen diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index cca7cd535933..af77177c58d0 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-base +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update COPY \ diff --git a/dockers/docker-fpm/Dockerfile.j2 b/dockers/docker-fpm/Dockerfile.j2 index 5cdbff3a0646..3f7445bd862c 100644 --- a/dockers/docker-fpm/Dockerfile.j2 +++ b/dockers/docker-fpm/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 32d73ecf32c5..79cdbb172f66 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -8,6 +8,9 @@ debs/ COPY python-wheels /python-wheels +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 ## Pre-install the fundamental packages diff --git a/dockers/docker-lldp/Dockerfile b/dockers/docker-lldp/Dockerfile index 528ac65a4080..044e16953e83 100644 --- a/dockers/docker-lldp/Dockerfile +++ b/dockers/docker-lldp/Dockerfile @@ -2,6 +2,9 @@ FROM docker-base COPY deps/sswsdk*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + ## Pre-install the fundamental packages ## Install Python SSWSDK (lldpsyncd dependency) ## Install LLDP Sync Daemon diff --git a/dockers/docker-mlnx-sswsyncd/Dockerfile b/dockers/docker-mlnx-sswsyncd/Dockerfile index 4ce980aee35f..631ff2e18030 100755 --- a/dockers/docker-mlnx-sswsyncd/Dockerfile +++ b/dockers/docker-mlnx-sswsyncd/Dockerfile @@ -1,5 +1,8 @@ FROM docker-base +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update ## Pre-install the fundamental packages diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index dd04379f57e0..0376c2c4d86d 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansson4 diff --git a/dockers/docker-platform-monitor/Dockerfile b/dockers/docker-platform-monitor/Dockerfile index 0d5a5dcb45e9..ea73830f8e6c 100755 --- a/dockers/docker-platform-monitor/Dockerfile +++ b/dockers/docker-platform-monitor/Dockerfile @@ -1,5 +1,8 @@ FROM docker-config-engine +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update RUN apt-get install -y smartmontools sensord diff --git a/dockers/docker-ptf-saithrift/Dockerfile b/dockers/docker-ptf-saithrift/Dockerfile index 88176faffb5f..0aa494757711 100644 --- a/dockers/docker-ptf-saithrift/Dockerfile +++ b/dockers/docker-ptf-saithrift/Dockerfile @@ -1,5 +1,8 @@ FROM docker-ptf +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update COPY ["deps/saithrift-0.9.tar.gz", "/deps/"] diff --git a/dockers/docker-saiserver-brcm/Dockerfile b/dockers/docker-saiserver-brcm/Dockerfile index 054da7866fbf..3482c2068bc5 100755 --- a/dockers/docker-saiserver-brcm/Dockerfile +++ b/dockers/docker-saiserver-brcm/Dockerfile @@ -1,5 +1,8 @@ FROM docker-base +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update COPY ["deps/libsaibcm_*.deb","deps/libopennsl_*.deb","deps/python-sdk-api_*.deb", "deps/iproute2_*.deb", "deps/libthrift-0.9.3_*.deb", "deps/libnl-3-200_*.deb", "deps/libnl-genl-3-200_*.deb", "deps/libnl-route-3-200_*.deb", "/deps/"] diff --git a/dockers/docker-saiserver-mlnx/Dockerfile b/dockers/docker-saiserver-mlnx/Dockerfile index 49f7842c7a41..5f51f5598b18 100755 --- a/dockers/docker-saiserver-mlnx/Dockerfile +++ b/dockers/docker-saiserver-mlnx/Dockerfile @@ -1,5 +1,8 @@ FROM docker-base +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.3_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"] diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 21d1573f0e10..332f485f72e6 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -12,6 +12,9 @@ COPY python-wheels/asyncsnmp-*-py3-*.whl /python-wheels/ # enable -O for all Python calls ENV PYTHONOPTIMIZE 1 +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + # install supervisor # install libsnmp30 dependencies # install libpython3.6-dev dependencies diff --git a/dockers/docker-snmp/Dockerfile b/dockers/docker-snmp/Dockerfile index 7ffc0b122870..c13428563e33 100644 --- a/dockers/docker-snmp/Dockerfile +++ b/dockers/docker-snmp/Dockerfile @@ -6,6 +6,9 @@ COPY deps/python3/*.whl /python3/ # enable -O for all Python calls ENV PYTHONOPTIMIZE 1 +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + ## Pre-install the fundamental packages ## Install Python SSWSDK (SNMP subagent dependency) ## Install SNMP subagent diff --git a/dockers/docker-sswsyncd/Dockerfile b/dockers/docker-sswsyncd/Dockerfile index 7d83c67a259b..0f555d8b51bf 100755 --- a/dockers/docker-sswsyncd/Dockerfile +++ b/dockers/docker-sswsyncd/Dockerfile @@ -8,6 +8,9 @@ COPY deps/sswsyncd_*.deb \ /deps/ +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + ## Install packages ## Clean up RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 35492bdb4670..7cb86e5b7e69 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -16,6 +16,9 @@ debs/{{ deb }}{{' '}} COPY ["start.sh", "config.sh", "/usr/bin/"] COPY ["teamd.j2", "/etc/swss/teamd/"] +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs diff --git a/dockers/docker-vas/Dockerfile b/dockers/docker-vas/Dockerfile index 84b5eb46d40e..fb207d07199e 100755 --- a/dockers/docker-vas/Dockerfile +++ b/dockers/docker-vas/Dockerfile @@ -3,6 +3,9 @@ FROM docker-base COPY deps/vasclnt_*.deb deps/vasgp_*.deb /deps/ COPY user-override /etc/opt/quest/vas/user-override +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + ## Pre-install the fundamental packages ## Clean up RUN apt-get update && \ diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 0050cf9b1bf3..ffe7b6c57397 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-base +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update COPY \ diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index 9c66649420c0..45b71e85129c 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-base +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update COPY \ diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index d296ab4e8210..cd686802f907 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-base +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update COPY \ diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index f285f8f0750f..97e3a56817e4 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-base +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 0398581dcd47..03f38a06c2ca 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -7,6 +7,9 @@ RUN echo "deb-src http://debian-archive.trafficmanager.net/debian/ jessie main c RUN echo "deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list RUN 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 + RUN apt-get clean && apt-get update && apt-get install -y apt-utils default-jre-headless openssh-server curl wget unzip git build-essential libtool lintian RUN apt-get update && apt-get install -y sudo dh-make dh-exec kmod libtinyxml2-2 libboost-program-options1.55-dev libtinyxml2-dev python python-pip libncurses5-dev texinfo dh-autoreconf python3-pip From a962c0b38666f7cebde02f2ca8e4792110493eaa Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Thu, 16 Feb 2017 22:10:29 -0800 Subject: [PATCH 0284/1833] [boot0] sync filesystem before kexec (#301) --- files/Aboot/boot0.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 8ec50ef7f9e3..d30a44e520c2 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -71,6 +71,9 @@ extract_image() { ## replace with boot swi mv "$target_path/{{ ABOOT_BOOT_IMAGE }}" "$swipath" + + ## sync disk operations + sync } write_machine_config() { From f9f31ed2969bc471066162c76fd682791a45f47b Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 17 Feb 2017 09:28:09 +0200 Subject: [PATCH 0285/1833] [installer]: limit size of /var/log (#284) Create loop device during installation of size soecified in config file for machine Signed-off-by: marian-pritsak --- files/initramfs-tools/union-mount.j2 | 2 ++ installer/x86_64/install.sh | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index 037a9c240333..2ff58ec949f9 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -18,3 +18,5 @@ mount --bind ${rootmnt}/host/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker ## Mount the boot directory in the raw partition, bypass the aufs mkdir -p ${rootmnt}/boot mount --bind ${rootmnt}/host/boot ${rootmnt}/boot +## Mount loop device for /var/log +[ -f ${rootmnt}/host/disk-img/var-log.ext4 ] && mount -t ext4 -o loop,rw ${rootmnt}/host/disk-img/var-log.ext4 ${rootmnt}/var/log diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 2ff663c188eb..0d2d76a2cd9e 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -51,6 +51,10 @@ CONSOLE_SPEED=9600 # Get platform specific linux kernel command line arguments ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" + +# Default var/log device size in MB +VAR_LOG_SIZE=4096 + [ -r platforms/$onie_platform ] && source platforms/$onie_platform # Install demo on same block device as ONIE @@ -401,6 +405,13 @@ if [ -f $demo_mnt/$FILESYSTEM_DOCKERFS ]; then cd $demo_mnt && mkdir -p $DOCKERFS_DIR && tar xf $FILESYSTEM_DOCKERFS -C $DOCKERFS_DIR; cd $OLDPWD fi +# Create loop device for /var/log to limit its size to $VAR_LOG_SIZE MB +if [ "$VAR_LOG_SIZE" != "0" ]; then + mkdir -p $demo_mnt/disk-img + dd if=/dev/zero of=$demo_mnt/disk-img/var-log.ext4 count=$((2048*$VAR_LOG_SIZE)) + mkfs.ext4 -q $demo_mnt/disk-img/var-log.ext4 -F +fi + # Store machine description in target file system cp /etc/machine.conf $demo_mnt From 2d0b41a340e3b03f423a75e7687e9bf7436aa1e4 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 17 Feb 2017 13:03:42 -0800 Subject: [PATCH 0286/1833] Combine alias_map.json with port_config.ini (#304) * Combine alias_map.json with port_config.ini --- src/sonic-config-engine/minigraph.py | 35 +++-- .../platform/ACS-MSN2700/alias_map.json | 34 ----- .../platform/ACS-MSN2700/port_config.ini | 2 +- .../platform/AS7512/port_config.ini | 2 +- .../platform/Arista-7050-QX32/alias_map.json | 34 ----- .../platform/Arista-7050-QX32/port_config.ini | 66 ++++----- .../platform/Force10-S6000/alias_map.json | 34 ----- .../platform/Force10-S6000/port_config.ini | 66 ++++----- .../platform/Force10-S6100/alias_map.json | 66 --------- .../platform/Force10-S6100/port_config.ini | 130 +++++++++--------- src/sonic-config-engine/setup.py | 2 - src/sonic-config-engine/sonic-cfggen | 23 +++- 12 files changed, 180 insertions(+), 314 deletions(-) delete mode 100644 src/sonic-config-engine/platform/ACS-MSN2700/alias_map.json delete mode 100644 src/sonic-config-engine/platform/Arista-7050-QX32/alias_map.json delete mode 100644 src/sonic-config-engine/platform/Force10-S6000/alias_map.json delete mode 100644 src/sonic-config-engine/platform/Force10-S6100/alias_map.json diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 8560b850c179..317d9c963a33 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -285,18 +285,33 @@ def get_mgmt_info(devices, dev, port): return ret_val -def get_alias_map_list(hwsku): - alias_map_json = os.path.join('/usr/share/sonic', hwsku, 'alias_map.json') - if not os.path.isfile(alias_map_json): +def get_alias_map_list(hwsku, platform=None): + port_config_candidates = [] + port_config_candidates.append('/usr/share/sonic/sku/port_config.ini') + if platform != None: + port_config_candidates.append(os.path.join('/usr/share/sonic/device', platform, hwsku, 'port_config.ini')) + port_config_candidates.append(os.path.join('/usr/share/sonic/device', hwsku, 'port_config.ini')) + port_config_candidates.append(os.path.join('/usr/share/sonic', hwsku, 'port_config.ini')) + port_config = None + for candidate in port_config_candidates: + if os.path.isfile(candidate): + port_config = candidate + break + if port_config == None: return None - with open(alias_map_json) as data: - alias_map_dict = json.load(data) + alias_map_list = [] - for k,v in alias_map_dict.items(): - alias_map_list.append({'sonic': k, 'origin': v}) + with open(port_config) as data: + for line in data: + if line.startswith('#'): + continue + tokens = line.split() + if len(tokens) < 3: + continue + alias_map_list.append({'sonic': tokens[0], 'origin': tokens[2].strip()}) return alias_map_list -def parse_xml(filename): +def parse_xml(filename, platform=None): root = ET.parse(filename).getroot() mini_graph_path = filename @@ -322,8 +337,7 @@ def parse_xml(filename): if child.tag == str(hostname_qn): hostname = child.text - # port_alias_map maps ngs port name to sonic port name - alias_map_list = get_alias_map_list(hwsku) + alias_map_list = get_alias_map_list(hwsku, platform) if alias_map_list != None: for item in alias_map_list: port_alias_map[item['origin']] = item['sonic'] @@ -373,6 +387,7 @@ def parse_xml(filename): results['minigraph_as_xml'] = mini_graph_path results['minigraph_console'] = get_console_info(devices, console_dev, console_port) results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port) + results['minigraph_hostname'] = hostname results['inventory_hostname'] = hostname results['alias_map'] = alias_map_list diff --git a/src/sonic-config-engine/platform/ACS-MSN2700/alias_map.json b/src/sonic-config-engine/platform/ACS-MSN2700/alias_map.json deleted file mode 100644 index dd1324ae4360..000000000000 --- a/src/sonic-config-engine/platform/ACS-MSN2700/alias_map.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Ethernet8": "Ethernet8", - "Ethernet0": "Ethernet0", - "Ethernet4": "Ethernet4", - "Ethernet108": "Ethernet108", - "Ethernet100": "Ethernet100", - "Ethernet104": "Ethernet104", - "Ethernet96": "Ethernet96", - "Ethernet124": "Ethernet124", - "Ethernet120": "Ethernet120", - "Ethernet92": "Ethernet92", - "Ethernet28": "Ethernet28", - "Ethernet52": "Ethernet52", - "Ethernet56": "Ethernet56", - "Ethernet76": "Ethernet76", - "Ethernet72": "Ethernet72", - "Ethernet32": "Ethernet32", - "Ethernet16": "Ethernet16", - "Ethernet36": "Ethernet36", - "Ethernet12": "Ethernet12", - "Ethernet88": "Ethernet88", - "Ethernet24": "Ethernet24", - "Ethernet116": "Ethernet116", - "Ethernet80": "Ethernet80", - "Ethernet112": "Ethernet112", - "Ethernet84": "Ethernet84", - "Ethernet48": "Ethernet48", - "Ethernet44": "Ethernet44", - "Ethernet40": "Ethernet40", - "Ethernet64": "Ethernet64", - "Ethernet60": "Ethernet60", - "Ethernet20": "Ethernet20", - "Ethernet68": "Ethernet68" -} \ No newline at end of file diff --git a/src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini b/src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini index ae703f020de6..816bb0e94a70 100644 --- a/src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini +++ b/src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini @@ -1,4 +1,4 @@ -# alias lanes +# name lanes Ethernet0 0,1,2,3 Ethernet4 4,5,6,7 Ethernet8 8,9,10,11 diff --git a/src/sonic-config-engine/platform/AS7512/port_config.ini b/src/sonic-config-engine/platform/AS7512/port_config.ini index c35776dcfcc5..c10cd2786941 100644 --- a/src/sonic-config-engine/platform/AS7512/port_config.ini +++ b/src/sonic-config-engine/platform/AS7512/port_config.ini @@ -1,4 +1,4 @@ -# alias lanes +# name lanes Ethernet0 16,17,18,19 Ethernet4 20,21,22,23 Ethernet8 24,25,26,27 diff --git a/src/sonic-config-engine/platform/Arista-7050-QX32/alias_map.json b/src/sonic-config-engine/platform/Arista-7050-QX32/alias_map.json deleted file mode 100644 index 90b35011e2c5..000000000000 --- a/src/sonic-config-engine/platform/Arista-7050-QX32/alias_map.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Ethernet8": "Ethernet3/1", - "Ethernet0": "Ethernet1/1", - "Ethernet4": "Ethernet2/1", - "Ethernet108": "Ethernet28", - "Ethernet100": "Ethernet26", - "Ethernet104": "Ethernet27", - "Ethernet96": "Ethernet25", - "Ethernet124": "Ethernet32", - "Ethernet120": "Ethernet31", - "Ethernet92": "Ethernet24/1", - "Ethernet28": "Ethernet8/1", - "Ethernet52": "Ethernet14/1", - "Ethernet56": "Ethernet15/1", - "Ethernet76": "Ethernet20/1", - "Ethernet72": "Ethernet19/1", - "Ethernet32": "Ethernet9/1", - "Ethernet16": "Ethernet5/1", - "Ethernet36": "Ethernet10/1", - "Ethernet12": "Ethernet4/1", - "Ethernet88": "Ethernet23/1", - "Ethernet24": "Ethernet7/1", - "Ethernet116": "Ethernet30", - "Ethernet80": "Ethernet21/1", - "Ethernet112": "Ethernet29", - "Ethernet84": "Ethernet22/1", - "Ethernet48": "Ethernet13/1", - "Ethernet44": "Ethernet12/1", - "Ethernet40": "Ethernet11/1", - "Ethernet64": "Ethernet17/1", - "Ethernet60": "Ethernet16/1", - "Ethernet20": "Ethernet6/1", - "Ethernet68": "Ethernet18/1" -} \ No newline at end of file diff --git a/src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini b/src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini index ec12639d72bf..b9ab8854a2ec 100644 --- a/src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini +++ b/src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini @@ -1,33 +1,33 @@ -# alias lanes -Ethernet0 125,126,127,128 -Ethernet4 121,122,123,124 -Ethernet8 13,14,15,16 -Ethernet12 9,10,11,12 -Ethernet16 17,18,19,20 -Ethernet20 21,22,23,24 -Ethernet24 25,26,27,28 -Ethernet28 29,30,31,32 -Ethernet32 37,38,39,40 -Ethernet36 33,34,35,36 -Ethernet40 45,46,47,48 -Ethernet44 41,42,43,44 -Ethernet48 53,54,55,56 -Ethernet52 49,50,51,52 -Ethernet56 69,70,71,72 -Ethernet60 65,66,67,68 -Ethernet64 77,78,79,80 -Ethernet68 73,74,75,76 -Ethernet72 93,94,95,96 -Ethernet76 89,90,91,92 -Ethernet80 101,102,103,104 -Ethernet84 97,98,99,100 -Ethernet88 109,110,111,112 -Ethernet92 105,106,107,108 -Ethernet96 61,62,63,64 -Ethernet100 57,58,59,60 -Ethernet104 81,82,83,84 -Ethernet108 85,86,87,88 -Ethernet112 117,118,119,120 -Ethernet116 113,114,115,116 -Ethernet120 5,6,7,8 -Ethernet124 1,2,3,4 +# name lanes alias +Ethernet0 125,126,127,128 Ethernet1/1 +Ethernet4 121,122,123,124 Ethernet2/1 +Ethernet8 13,14,15,16 Ethernet3/1 +Ethernet12 9,10,11,12 Ethernet4/1 +Ethernet16 17,18,19,20 Ethernet5/1 +Ethernet20 21,22,23,24 Ethernet6/1 +Ethernet24 25,26,27,28 Ethernet7/1 +Ethernet28 29,30,31,32 Ethernet8/1 +Ethernet32 37,38,39,40 Ethernet9/1 +Ethernet36 33,34,35,36 Ethernet10/1 +Ethernet40 45,46,47,48 Ethernet11/1 +Ethernet44 41,42,43,44 Ethernet12/1 +Ethernet48 53,54,55,56 Ethernet13/1 +Ethernet52 49,50,51,52 Ethernet14/1 +Ethernet56 69,70,71,72 Ethernet15/1 +Ethernet60 65,66,67,68 Ethernet16/1 +Ethernet64 77,78,79,80 Ethernet17/1 +Ethernet68 73,74,75,76 Ethernet18/1 +Ethernet72 93,94,95,96 Ethernet19/1 +Ethernet76 89,90,91,92 Ethernet20/1 +Ethernet80 101,102,103,104 Ethernet21/1 +Ethernet84 97,98,99,100 Ethernet22/1 +Ethernet88 109,110,111,112 Ethernet23/1 +Ethernet92 105,106,107,108 Ethernet24/1 +Ethernet96 61,62,63,64 Ethernet25 +Ethernet100 57,58,59,60 Ethernet26 +Ethernet104 81,82,83,84 Ethernet27 +Ethernet108 85,86,87,88 Ethernet28 +Ethernet112 117,118,119,120 Ethernet29 +Ethernet116 113,114,115,116 Ethernet30 +Ethernet120 5,6,7,8 Ethernet31 +Ethernet124 1,2,3,4 Ethernet32 diff --git a/src/sonic-config-engine/platform/Force10-S6000/alias_map.json b/src/sonic-config-engine/platform/Force10-S6000/alias_map.json deleted file mode 100644 index b58d147f70c3..000000000000 --- a/src/sonic-config-engine/platform/Force10-S6000/alias_map.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Ethernet8": "fortyGigE0/8", - "Ethernet0": "fortyGigE0/0", - "Ethernet4": "fortyGigE0/4", - "Ethernet108": "fortyGigE0/108", - "Ethernet100": "fortyGigE0/100", - "Ethernet104": "fortyGigE0/104", - "Ethernet96": "fortyGigE0/96", - "Ethernet124": "fortyGigE0/124", - "Ethernet120": "fortyGigE0/120", - "Ethernet92": "fortyGigE0/92", - "Ethernet28": "fortyGigE0/28", - "Ethernet52": "fortyGigE0/52", - "Ethernet56": "fortyGigE0/56", - "Ethernet76": "fortyGigE0/76", - "Ethernet72": "fortyGigE0/72", - "Ethernet32": "fortyGigE0/32", - "Ethernet16": "fortyGigE0/16", - "Ethernet36": "fortyGigE0/36", - "Ethernet12": "fortyGigE0/12", - "Ethernet88": "fortyGigE0/88", - "Ethernet24": "fortyGigE0/24", - "Ethernet116": "fortyGigE0/116", - "Ethernet80": "fortyGigE0/80", - "Ethernet112": "fortyGigE0/112", - "Ethernet84": "fortyGigE0/84", - "Ethernet48": "fortyGigE0/48", - "Ethernet44": "fortyGigE0/44", - "Ethernet40": "fortyGigE0/40", - "Ethernet64": "fortyGigE0/64", - "Ethernet60": "fortyGigE0/60", - "Ethernet20": "fortyGigE0/20", - "Ethernet68": "fortyGigE0/68" -} \ No newline at end of file diff --git a/src/sonic-config-engine/platform/Force10-S6000/port_config.ini b/src/sonic-config-engine/platform/Force10-S6000/port_config.ini index 7161416e4d4c..06898f1d7964 100644 --- a/src/sonic-config-engine/platform/Force10-S6000/port_config.ini +++ b/src/sonic-config-engine/platform/Force10-S6000/port_config.ini @@ -1,33 +1,33 @@ -# alias lanes -Ethernet0 29,30,31,32 -Ethernet4 25,26,27,28 -Ethernet8 37,38,39,40 -Ethernet12 33,34,35,36 -Ethernet16 41,42,43,44 -Ethernet20 45,46,47,48 -Ethernet24 5,6,7,8 -Ethernet28 1,2,3,4 -Ethernet32 9,10,11,12 -Ethernet36 13,14,15,16 -Ethernet40 21,22,23,24 -Ethernet44 17,18,19,20 -Ethernet48 49,50,51,52 -Ethernet52 53,54,55,56 -Ethernet56 61,62,63,64 -Ethernet60 57,58,59,60 -Ethernet64 65,66,67,68 -Ethernet68 69,70,71,72 -Ethernet72 77,78,79,80 -Ethernet76 73,74,75,76 -Ethernet80 105,106,107,108 -Ethernet84 109,110,111,112 -Ethernet88 117,118,119,120 -Ethernet92 113,114,115,116 -Ethernet96 121,122,123,124 -Ethernet100 125,126,127,128 -Ethernet104 85,86,87,88 -Ethernet108 81,82,83,84 -Ethernet112 89,90,91,92 -Ethernet116 93,94,95,96 -Ethernet120 97,98,99,100 -Ethernet124 101,102,103,104 +# name lanes alias +Ethernet0 29,30,31,32 fortyGigE0/0 +Ethernet4 25,26,27,28 fortyGigE0/4 +Ethernet8 37,38,39,40 fortyGigE0/8 +Ethernet12 33,34,35,36 fortyGigE0/12 +Ethernet16 41,42,43,44 fortyGigE0/16 +Ethernet20 45,46,47,48 fortyGigE0/20 +Ethernet24 5,6,7,8 fortyGigE0/24 +Ethernet28 1,2,3,4 fortyGigE0/28 +Ethernet32 9,10,11,12 fortyGigE0/32 +Ethernet36 13,14,15,16 fortyGigE0/36 +Ethernet40 21,22,23,24 fortyGigE0/40 +Ethernet44 17,18,19,20 fortyGigE0/44 +Ethernet48 49,50,51,52 fortyGigE0/48 +Ethernet52 53,54,55,56 fortyGigE0/52 +Ethernet56 61,62,63,64 fortyGigE0/56 +Ethernet60 57,58,59,60 fortyGigE0/60 +Ethernet64 65,66,67,68 fortyGigE0/64 +Ethernet68 69,70,71,72 fortyGigE0/68 +Ethernet72 77,78,79,80 fortyGigE0/72 +Ethernet76 73,74,75,76 fortyGigE0/76 +Ethernet80 105,106,107,108 fortyGigE0/80 +Ethernet84 109,110,111,112 fortyGigE0/84 +Ethernet88 117,118,119,120 fortyGigE0/88 +Ethernet92 113,114,115,116 fortyGigE0/92 +Ethernet96 121,122,123,124 fortyGigE0/96 +Ethernet100 125,126,127,128 fortyGigE0/100 +Ethernet104 85,86,87,88 fortyGigE0/104 +Ethernet108 81,82,83,84 fortyGigE0/108 +Ethernet112 89,90,91,92 fortyGigE0/112 +Ethernet116 93,94,95,96 fortyGigE0/116 +Ethernet120 97,98,99,100 fortyGigE0/120 +Ethernet124 101,102,103,104 fortyGigE0/124 diff --git a/src/sonic-config-engine/platform/Force10-S6100/alias_map.json b/src/sonic-config-engine/platform/Force10-S6100/alias_map.json deleted file mode 100644 index 19a1ef662d37..000000000000 --- a/src/sonic-config-engine/platform/Force10-S6100/alias_map.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "Ethernet0": "fortyGigE1/1/1", - "Ethernet1": "fortyGigE1/1/2", - "Ethernet2": "fortyGigE1/1/3", - "Ethernet3": "fortyGigE1/1/4", - "Ethernet4": "fortyGigE1/1/5", - "Ethernet5": "fortyGigE1/1/6", - "Ethernet6": "fortyGigE1/1/7", - "Ethernet7": "fortyGigE1/1/8", - "Ethernet8": "fortyGigE1/1/9", - "Ethernet9": "fortyGigE1/1/10", - "Ethernet10": "fortyGigE1/1/11", - "Ethernet11": "fortyGigE1/1/12", - "Ethernet12": "fortyGigE1/1/13", - "Ethernet13": "fortyGigE1/1/14", - "Ethernet14": "fortyGigE1/1/15", - "Ethernet15": "fortyGigE1/1/16", - "Ethernet16": "fortyGigE1/2/1", - "Ethernet17": "fortyGigE1/2/2", - "Ethernet18": "fortyGigE1/2/3", - "Ethernet19": "fortyGigE1/2/4", - "Ethernet20": "fortyGigE1/2/5", - "Ethernet21": "fortyGigE1/2/6", - "Ethernet22": "fortyGigE1/2/7", - "Ethernet23": "fortyGigE1/2/8", - "Ethernet24": "fortyGigE1/2/9", - "Ethernet25": "fortyGigE1/2/10", - "Ethernet26": "fortyGigE1/2/11", - "Ethernet27": "fortyGigE1/2/12", - "Ethernet28": "fortyGigE1/2/13", - "Ethernet29": "fortyGigE1/2/14", - "Ethernet30": "fortyGigE1/2/15", - "Ethernet31": "fortyGigE1/2/16", - "Ethernet32": "fortyGigE1/3/1", - "Ethernet33": "fortyGigE1/3/2", - "Ethernet34": "fortyGigE1/3/3", - "Ethernet34": "fortyGigE1/3/4", - "Ethernet36": "fortyGigE1/3/5", - "Ethernet37": "fortyGigE1/3/6", - "Ethernet38": "fortyGigE1/3/7", - "Ethernet39": "fortyGigE1/3/8", - "Ethernet40": "fortyGigE1/3/9", - "Ethernet41": "fortyGigE1/3/10", - "Ethernet42": "fortyGigE1/3/11", - "Ethernet43": "fortyGigE1/3/12", - "Ethernet44": "fortyGigE1/3/13", - "Ethernet45": "fortyGigE1/3/14", - "Ethernet46": "fortyGigE1/3/15", - "Ethernet47": "fortyGigE1/3/16", - "Ethernet48": "fortyGigE1/4/1", - "Ethernet49": "fortyGigE1/4/2", - "Ethernet50": "fortyGigE1/4/3", - "Ethernet51": "fortyGigE1/4/4", - "Ethernet52": "fortyGigE1/4/5", - "Ethernet53": "fortyGigE1/4/6", - "Ethernet54": "fortyGigE1/4/7", - "Ethernet55": "fortyGigE1/4/8", - "Ethernet56": "fortyGigE1/4/9", - "Ethernet57": "fortyGigE1/4/10", - "Ethernet58": "fortyGigE1/4/11", - "Ethernet59": "fortyGigE1/4/12", - "Ethernet60": "fortyGigE1/4/13", - "Ethernet61": "fortyGigE1/4/14", - "Ethernet62": "fortyGigE1/4/15", - "Ethernet63": "fortyGigE1/4/16" -} diff --git a/src/sonic-config-engine/platform/Force10-S6100/port_config.ini b/src/sonic-config-engine/platform/Force10-S6100/port_config.ini index 67e558963f36..dcdd6548c198 100644 --- a/src/sonic-config-engine/platform/Force10-S6100/port_config.ini +++ b/src/sonic-config-engine/platform/Force10-S6100/port_config.ini @@ -1,65 +1,65 @@ -# alias lanes -Ethernet0 101,102 -Ethernet1 103,104 -Ethernet2 97,98 -Ethernet3 99,100 -Ethernet4 69,70 -Ethernet5 71,72 -Ethernet6 65,66 -Ethernet7 67,68 -Ethernet8 53,54 -Ethernet9 55,56 -Ethernet10 49,50 -Ethernet11 51,52 -Ethernet12 21,22 -Ethernet13 23,24 -Ethernet14 17,18 -Ethernet15 19,20 -Ethernet16 25,26 -Ethernet17 27,28 -Ethernet18 29,30 -Ethernet19 31,32 -Ethernet20 57,58 -Ethernet21 59,60 -Ethernet22 61,62 -Ethernet23 63,64 -Ethernet24 73,74 -Ethernet25 75,76 -Ethernet26 77,78 -Ethernet27 79,80 -Ethernet28 105,106 -Ethernet29 107,108 -Ethernet30 109,110 -Ethernet31 111,112 -Ethernet32 13,14 -Ethernet33 15,16 -Ethernet34 9,10 -Ethernet35 11,12 -Ethernet36 125,126 -Ethernet37 127,128 -Ethernet38 121,122 -Ethernet39 123,124 -Ethernet40 93,94 -Ethernet41 95,96 -Ethernet42 89,90 -Ethernet43 91,92 -Ethernet44 45,46 -Ethernet45 47,48 -Ethernet46 41,42 -Ethernet47 43,44 -Ethernet48 113,114 -Ethernet49 115,116 -Ethernet50 117,118 -Ethernet51 119,120 -Ethernet52 1,2 -Ethernet53 3,4 -Ethernet54 5,6 -Ethernet55 7,8 -Ethernet56 33,34 -Ethernet57 35,36 -Ethernet58 37,38 -Ethernet59 39,40 -Ethernet60 81,82 -Ethernet61 83,84 -Ethernet62 85,86 -Ethernet63 87,88 +# name lanes alias +Ethernet0 101,102 fortyGigE1/1/1 +Ethernet1 103,104 fortyGigE1/1/2 +Ethernet2 97,98 fortyGigE1/1/3 +Ethernet3 99,100 fortyGigE1/1/4 +Ethernet4 69,70 fortyGigE1/1/5 +Ethernet5 71,72 fortyGigE1/1/6 +Ethernet6 65,66 fortyGigE1/1/7 +Ethernet7 67,68 fortyGigE1/1/8 +Ethernet8 53,54 fortyGigE1/1/9 +Ethernet9 55,56 fortyGigE1/1/10 +Ethernet10 49,50 fortyGigE1/1/11 +Ethernet11 51,52 fortyGigE1/1/12 +Ethernet12 21,22 fortyGigE1/1/13 +Ethernet13 23,24 fortyGigE1/1/14 +Ethernet14 17,18 fortyGigE1/1/15 +Ethernet15 19,20 fortyGigE1/1/16 +Ethernet16 25,26 fortyGigE1/2/1 +Ethernet17 27,28 fortyGigE1/2/2 +Ethernet18 29,30 fortyGigE1/2/3 +Ethernet19 31,32 fortyGigE1/2/4 +Ethernet20 57,58 fortyGigE1/2/5 +Ethernet21 59,60 fortyGigE1/2/6 +Ethernet22 61,62 fortyGigE1/2/7 +Ethernet23 63,64 fortyGigE1/2/8 +Ethernet24 73,74 fortyGigE1/2/9 +Ethernet25 75,76 fortyGigE1/2/10 +Ethernet26 77,78 fortyGigE1/2/11 +Ethernet27 79,80 fortyGigE1/2/12 +Ethernet28 105,106 fortyGigE1/2/13 +Ethernet29 107,108 fortyGigE1/2/14 +Ethernet30 109,110 fortyGigE1/2/15 +Ethernet31 111,112 fortyGigE1/2/16 +Ethernet32 13,14 fortyGigE1/3/1 +Ethernet33 15,16 fortyGigE1/3/2 +Ethernet34 9,10 fortyGigE1/3/3 +Ethernet35 11,12 fortyGigE1/3/4 +Ethernet36 125,126 fortyGigE1/3/5 +Ethernet37 127,128 fortyGigE1/3/6 +Ethernet38 121,122 fortyGigE1/3/7 +Ethernet39 123,124 fortyGigE1/3/8 +Ethernet40 93,94 fortyGigE1/3/9 +Ethernet41 95,96 fortyGigE1/3/10 +Ethernet42 89,90 fortyGigE1/3/11 +Ethernet43 91,92 fortyGigE1/3/12 +Ethernet44 45,46 fortyGigE1/3/13 +Ethernet45 47,48 fortyGigE1/3/14 +Ethernet46 41,42 fortyGigE1/3/15 +Ethernet47 43,44 fortyGigE1/3/16 +Ethernet48 113,114 fortyGigE1/4/1 +Ethernet49 115,116 fortyGigE1/4/2 +Ethernet50 117,118 fortyGigE1/4/3 +Ethernet51 119,120 fortyGigE1/4/4 +Ethernet52 1,2 fortyGigE1/4/5 +Ethernet53 3,4 fortyGigE1/4/6 +Ethernet54 5,6 fortyGigE1/4/7 +Ethernet55 7,8 fortyGigE1/4/8 +Ethernet56 33,34 fortyGigE1/4/9 +Ethernet57 35,36 fortyGigE1/4/10 +Ethernet58 37,38 fortyGigE1/4/11 +Ethernet59 39,40 fortyGigE1/4/12 +Ethernet60 81,82 fortyGigE1/4/13 +Ethernet61 83,84 fortyGigE1/4/14 +Ethernet62 85,86 fortyGigE1/4/15 +Ethernet63 87,88 fortyGigE1/4/16 diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 92f1b2f84869..37c61b84ae5f 100644 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -10,8 +10,6 @@ def get_platform_file_list(): platforms = os.listdir(data_path) for platform in platforms: files = ['platform/' + platform + '/port_config.ini'] - if os.path.isfile( os.path.join(data_path, platform, 'alias_map.json') ): - files.append('platform/' + platform + '/alias_map.json') #If a platform doesnot have alias_map.json minigraph.py will fall back to no alias mapping if os.path.isfile( os.path.join(data_path, platform, 'sensors.conf') ): files.append('platform/' + platform + '/sensors.conf') #Not all platforms need to have a sensors.conf file data_files.append( (os.path.join('/usr/share/sonic', platform), files) ) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 01774885b578..18540a548338 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -34,6 +34,18 @@ def is_ipv6(value): return False return addr.version == 6 +def get_machine_info(): + if not os.path.isfile('/host/machine.conf'): + return None + machine_vars = {} + with open('/host/machine.conf') as machine_file: + for line in machine_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + machine_vars[tokens[0]] = tokens[1].strip() + return machine_vars + def main(): parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") @@ -49,10 +61,19 @@ def main(): args = parser.parse_args() data = {} + machine_info = get_machine_info() + data.update(machine_info) + if machine_info.has_key('onie_platform'): + data['platform'] = machine_info['onie_platform'] + elif machine_info.has_key('aboot_platform'): + data['platform'] = machine_info['aboot_platform'] if args.minigraph != None: minigraph = args.minigraph - data.update(parse_xml(minigraph)) + if data.has_key('platform'): + data.update(parse_xml(minigraph, data['platform'])) + else: + data.update(parse_xml(minigraph)) if args.yaml != None: with open(args.yaml, 'r') as stream: From ea372cc7c16115ab617905eb648e81dc48aff69a Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 17 Feb 2017 13:47:01 -0800 Subject: [PATCH 0287/1833] Add get_graph service to fetch minigraph automatically (#288) - Add a functionality to get SNMP community from DHCP (option 224) - Add a functionality to get minigraph from http service instead of using default minigraph - The url for graph service is passed through DHCP option 225 - This feature is by default disabled. Modify rule/config to enable it on build time, or modify /etc/sonic/graph_service_url on run time. - Fix a bug that getting hostname from DHCP is not working correctly --- build_debian.sh | 6 ++- .../build_templates/sonic_debian_extension.j2 | 15 ++++++ files/dhcp/dhclient.conf | 24 +++++++++ files/dhcp/graphserviceurl | 9 ++++ files/dhcp/sethostname | 31 +++++------- files/dhcp/snmpcommunity | 11 ++++ files/image_config/interfaces/init_interfaces | 11 ++++ .../interfaces/interfaces-config.service | 2 +- .../interfaces/interfaces-config.sh | 3 ++ files/image_config/updategraph/updategraph | 50 +++++++++++++++++++ .../updategraph/updategraph.service | 12 +++++ rules/config | 7 +++ slave.mk | 2 + 13 files changed, 162 insertions(+), 21 deletions(-) create mode 100644 files/dhcp/dhclient.conf create mode 100644 files/dhcp/graphserviceurl create mode 100644 files/dhcp/snmpcommunity create mode 100644 files/image_config/interfaces/init_interfaces create mode 100755 files/image_config/updategraph/updategraph create mode 100644 files/image_config/updategraph/updategraph.service diff --git a/build_debian.sh b/build_debian.sh index 46d23355dd63..2d6cc35533f6 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -188,7 +188,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in usbutils \ pciutils \ iptables-persistent \ - logrotate + logrotate \ + curl ## Remove sshd host keys, and will regenerate on first sshd start sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* @@ -241,6 +242,9 @@ EOF sudo cp files/dhcp/rfc3442-classless-routes $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d sudo cp files/dhcp/sethostname $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d/ +sudo cp files/dhcp/graphserviceurl $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d/ +sudo cp files/dhcp/snmpcommunity $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d/ +sudo cp files/dhcp/dhclient.conf $FILESYSTEM_ROOT/etc/dhcp/ if [ -f sonic_debian_extension.sh ]; then ./sonic_debian_extension.sh $FILESYSTEM_ROOT diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index d0d4fc7849a4..ad7541fe0fc1 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -94,6 +94,21 @@ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable interfaces-config.service sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.sh $FILESYSTEM_ROOT/usr/bin/ sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/etc/sonic/templates/ +# Copy initial interfaces configuration file, will be overwritten on first boot +sudo cp $IMAGE_CONFIGS/interfaces/init_interfaces $FILESYSTEM_ROOT/etc/network + +# Copy updategraph script and service file +sudo cp $IMAGE_CONFIGS/updategraph/updategraph.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable updategraph.service +sudo cp $IMAGE_CONFIGS/updategraph/updategraph $FILESYSTEM_ROOT/usr/bin/ +{% if enable_dhcp_graph_service == "y" %} +sudo bash -c "echo enabled=true > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" +sudo bash -c "echo src=dhcp >> $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" +sudo bash -c "echo dhcp_as_static=true >> $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" +{% else %} +sudo bash -c "echo enabled=false > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" +{% endif %} + # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ diff --git a/files/dhcp/dhclient.conf b/files/dhcp/dhclient.conf new file mode 100644 index 000000000000..ce4ac4d9f445 --- /dev/null +++ b/files/dhcp/dhclient.conf @@ -0,0 +1,24 @@ +# Configuration file for /sbin/dhclient, which is included in Debian's +# dhcp3-client package. +# +# This is a sample configuration file for dhclient. See dhclient.conf's +# man page for more information about the syntax of this file +# and a more comprehensive list of the parameters understood by +# dhclient. +# +# Normally, if the DHCP server provides reasonable information and does +# not leave anything out (like the domain name, for example), then +# few changes must be made to this file, if any. +# + +option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; +option snmp-community code 224 = text; +option minigraph-url code 225 = text; + +send host-name = gethostname(); +request subnet-mask, broadcast-address, time-offset, routers, + domain-name, domain-name-servers, domain-search, host-name, + dhcp6.name-servers, dhcp6.domain-search, + netbios-name-servers, netbios-scope, interface-mtu, + rfc3442-classless-static-routes, ntp-servers, snmp-community, minigraph-url; + diff --git a/files/dhcp/graphserviceurl b/files/dhcp/graphserviceurl new file mode 100644 index 000000000000..0e8b1b83e141 --- /dev/null +++ b/files/dhcp/graphserviceurl @@ -0,0 +1,9 @@ +case $reason in + BOUND|RENEW|REBIND|REBOOT) + if [ -n "$new_minigraph_url" ]; then + echo $new_minigraph_url > /tmp/dhcp_graph_url + else + echo "N/A" > /tmp/dhcp_graph_url + fi + ;; +esac diff --git a/files/dhcp/sethostname b/files/dhcp/sethostname index 81bd458935fc..57f96ce63612 100644 --- a/files/dhcp/sethostname +++ b/files/dhcp/sethostname @@ -1,20 +1,13 @@ -#!/bin/bash -# This script is to update hostname of the system. +case $reason in + BOUND|RENEW|REBIND|REBOOT) + current_host_name=`hostname -s` + if [ "$current_host_name" != "$new_host_name" ] && [ -n "$new_host_name" ] + then + echo $new_host_name > /etc/hostname + hostname -F /etc/hostname + sed -i "/\s$current_host_name$/d" /etc/hosts + echo "127.0.0.1 $new_host_name" >> /etc/hosts + fi + ;; +esac -if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] \ - && [ "$reason" != REBIND ] && [ "$reason" != REBOOT ] -then - exit 0 -fi - -current_host_name=`hostname -s` - -if [ "$current_host_name" != "$new_host_name" ] -then - echo $new_host_name > /etc/hostname - line_to_replace=`grep 127.0.0.1.*$current_host_name /etc/hosts` - new_line=`echo $line_to_replace | sed "s/$current_host_name/$new_host_name/"` - sed -i "s/$line_to_replace/$new_line/" /etc/hosts - - hostname -F /etc/hostname -fi diff --git a/files/dhcp/snmpcommunity b/files/dhcp/snmpcommunity new file mode 100644 index 000000000000..63924e01fc5f --- /dev/null +++ b/files/dhcp/snmpcommunity @@ -0,0 +1,11 @@ +case $reason in + BOUND|RENEW|REBIND|REBOOT) + if [ -n "${new_snmp_community}" ]; then + if [ -f /etc/sonic/snmp.yml ]; then + sed -i "s/^snmp_rocommunity:.*/snmp_rocommunity: $new_snmp_community/g" /etc/sonic/snmp.yml + else + echo "snmp_rocommunity: "$new_snmp_community > /etc/sonic/snmp.yml + fi + fi + ;; +esac diff --git a/files/image_config/interfaces/init_interfaces b/files/image_config/interfaces/init_interfaces new file mode 100644 index 000000000000..b13a36df47f8 --- /dev/null +++ b/files/image_config/interfaces/init_interfaces @@ -0,0 +1,11 @@ +# Initial /etc/network/interface file for first boot +# Will be overwritten based on minigraph information by interfaces-config service + +# The loopback network interface +auto lo +iface lo inet loopback +# +# The management network interface +auto eth0 +iface eth0 inet dhcp + diff --git a/files/image_config/interfaces/interfaces-config.service b/files/image_config/interfaces/interfaces-config.service index 48d6ede42557..92a82aeee0b8 100644 --- a/files/image_config/interfaces/interfaces-config.service +++ b/files/image_config/interfaces/interfaces-config.service @@ -1,6 +1,6 @@ [Unit] Description=Update interfaces configuration -Before=network.target +Before=database.service [Service] Type=oneshot diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 69d72e916477..286c94796952 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -3,3 +3,6 @@ sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/interfaces.j2 >/etc/network/interfaces sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/vlan_interfaces.j2 >/etc/network/interfaces.d/vlan_interfaces sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/lag_interfaces.j2 >/etc/network/interfaces.d/lag_interfaces +ifdown eth0 && ifup eth0 +ifdown lo && ifup lo + diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph new file mode 100755 index 000000000000..203905b85c7c --- /dev/null +++ b/files/image_config/updategraph/updategraph @@ -0,0 +1,50 @@ +#!/bin/bash + +if [ ! -f /etc/sonic/updategraph.conf ]; then + echo "No updategraph.conf found, generating a default one." + echo "enabled=false" >/etc/sonic/updategraph.conf +fi + +. /etc/sonic/updategraph.conf + +if [ "$enabled" != "true" ]; then + echo "Disabled in updategraph.conf. Skipping graph update." + exit 0 +fi + +if [ "$src" = "dhcp" ]; then + while [ ! -f /tmp/dhcp_graph_url ]; do + echo "Waiting for DHCP response..." + sleep 1 + done + + if [ "`cat /tmp/dhcp_graph_url`" = "N/A" ]; then + echo "No graph_url option in DHCP response. Skipping graph update." + if [ "$dhcp_as_static" = "true" ]; then + sed -i "/enabled=/d" /etc/sonic/updategraph.conf + echo "enabled=false" >> /etc/sonic/updategraph.conf + fi + exit 0 + fi + + HOSTNAME=`hostname -s` + GRAPH_URL=`sonic-cfggen -t /tmp/dhcp_graph_url -a "{\"hostname\": \"$HOSTNAME\"}"` + if [ "$dhcp_as_static" = "true" ]; then + sed -i "/src=d/d" /etc/sonic/updategraph.conf + echo "src=$GRAPH_URL" >> /etc/sonic/updategraph.conf + fi +else + GRAPH_URL=$src +fi + +if [ -f /etc/sonic/minigraph.xml ]; then + echo "Renaming minigraph.xml to minigraph.old" + mv /etc/sonic/minigraph.xml /etc/sonic/minigraph.old +fi + +echo "Getting minigraph from $GRAPH_URL" + +while true; do + curl -f $GRAPH_URL -o /etc/sonic/minigraph.xml --connect-timeout 15 && break + sleep 5 +done diff --git a/files/image_config/updategraph/updategraph.service b/files/image_config/updategraph/updategraph.service new file mode 100644 index 000000000000..ba0b5dcb85e2 --- /dev/null +++ b/files/image_config/updategraph/updategraph.service @@ -0,0 +1,12 @@ +[Unit] +Description=download minigraph from graph service +Before=ntp-config.service +Before=rsyslog-config.service +Before=interfaces-config.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/updategraph + +[Install] +WantedBy=multi-user.target diff --git a/rules/config b/rules/config index 142a7c0d10f7..ea4f32de1481 100644 --- a/rules/config +++ b/rules/config @@ -35,3 +35,10 @@ USERNAME = admin # PASSWORD - password for installer build PASSWORD = YourPaSsWoRd + +# ENABLE_DHCP_GRAPH_SERVICE - specify the source of minigraph to generate configuration file. +# If set to y SONiC will get the minigraph from graph service. Graph service URL need to be +# passed through DHCP option 225. +# If not set (default behavior) the default minigraph built into the image will be used. +# ENABLE_DHCP_GRAPH_SERVICE = y + diff --git a/slave.mk b/slave.mk index c2d4fe983b0b..4ea96d1f4c80 100644 --- a/slave.mk +++ b/slave.mk @@ -298,6 +298,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export sonicadmin_user="$(USERNAME)" export sonic_hwsku="$(CONFIGURED_SKU)" export sonic_asic_platform="$(CONFIGURED_PLATFORM)" + export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" + $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" export docker_image_name="$(basename $(docker))" From 5573a8204eeb1209701b3d2253aa4227199be65d Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 17 Feb 2017 19:47:50 -0800 Subject: [PATCH 0288/1833] Allow sonic-cfggen to work in environment without /host/machine.conf (#307) --- src/sonic-config-engine/sonic-cfggen | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 18540a548338..02518b3ea364 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -62,11 +62,12 @@ def main(): data = {} machine_info = get_machine_info() - data.update(machine_info) - if machine_info.has_key('onie_platform'): - data['platform'] = machine_info['onie_platform'] - elif machine_info.has_key('aboot_platform'): - data['platform'] = machine_info['aboot_platform'] + if machine_info != None: + data.update(machine_info) + if machine_info.has_key('onie_platform'): + data['platform'] = machine_info['onie_platform'] + elif machine_info.has_key('aboot_platform'): + data['platform'] = machine_info['aboot_platform'] if args.minigraph != None: minigraph = args.minigraph From 81d7119c579cb056b3c7524dabc91ee6b666e566 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 18 Feb 2017 14:10:13 -0800 Subject: [PATCH 0289/1833] [platform]: change baudrate for wedge100 platform (#308) --- installer/x86_64/platforms/x86_64-facebook_wedge100-r0 | 1 + 1 file changed, 1 insertion(+) create mode 100644 installer/x86_64/platforms/x86_64-facebook_wedge100-r0 diff --git a/installer/x86_64/platforms/x86_64-facebook_wedge100-r0 b/installer/x86_64/platforms/x86_64-facebook_wedge100-r0 new file mode 100644 index 000000000000..3714ff053bb0 --- /dev/null +++ b/installer/x86_64/platforms/x86_64-facebook_wedge100-r0 @@ -0,0 +1 @@ +CONSOLE_SPEED=57600 From 073c28bf15a3a1a99ca4d30455e971f695893a13 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Sat, 18 Feb 2017 17:50:29 -0800 Subject: [PATCH 0290/1833] Move template files to /usr/share/sonic/templates (#305) --- dockers/docker-dhcp-relay/Dockerfile | 2 +- dockers/docker-dhcp-relay/config.sh | 2 +- dockers/docker-fpm/Dockerfile.j2 | 2 +- dockers/docker-fpm/config.sh | 8 ++++---- dockers/docker-lldp-sv2/Dockerfile.j2 | 2 +- dockers/docker-lldp-sv2/config.sh | 2 +- dockers/docker-snmp-sv2/Dockerfile.j2 | 2 +- dockers/docker-snmp-sv2/config.sh | 4 ++-- dockers/docker-teamd/Dockerfile.j2 | 2 +- dockers/docker-teamd/config.sh | 2 +- files/build_templates/sonic_debian_extension.j2 | 8 ++++---- files/image_config/interfaces/interfaces-config.sh | 6 +++--- files/image_config/ntp/ntp-config.sh | 2 +- files/image_config/rsyslog/rsyslog-config.sh | 2 +- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile index af7bdcb830c1..fbdabe333e6e 100644 --- a/dockers/docker-dhcp-relay/Dockerfile +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -13,7 +13,7 @@ RUN apt-get -y install isc-dhcp-relay RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"] +COPY ["isc-dhcp-relay.j2", "/usr/share/sonic/templates/"] COPY ["config.sh", "/usr/bin/"] ENTRYPOINT /usr/bin/config.sh \ diff --git a/dockers/docker-dhcp-relay/config.sh b/dockers/docker-dhcp-relay/config.sh index 42146b0343bc..f0a861cfb997 100755 --- a/dockers/docker-dhcp-relay/config.sh +++ b/dockers/docker-dhcp-relay/config.sh @@ -1,4 +1,4 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/dhcp_relay.yml -t /usr/share/dhcp-relay/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/dhcp_relay.yml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay diff --git a/dockers/docker-fpm/Dockerfile.j2 b/dockers/docker-fpm/Dockerfile.j2 index 3f7445bd862c..65b9cfa3121a 100644 --- a/dockers/docker-fpm/Dockerfile.j2 +++ b/dockers/docker-fpm/Dockerfile.j2 @@ -22,7 +22,7 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -COPY ["*.j2", "/etc/swss/bgp/"] +COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["start.sh", "config.sh", "/usr/bin/"] COPY ["daemons", "/etc/quagga/"] diff --git a/dockers/docker-fpm/config.sh b/dockers/docker-fpm/config.sh index c1d3db29a1bd..b7fbb90344e9 100755 --- a/dockers/docker-fpm/config.sh +++ b/dockers/docker-fpm/config.sh @@ -1,14 +1,14 @@ #!/bin/bash mkdir -p /etc/quagga -sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/bgp/bgpd.conf.j2 >/etc/quagga/bgpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/bgp/zebra.conf.j2 >/etc/quagga/zebra.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/quagga/bgpd.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/quagga/zebra.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/bgp/isolate.j2 >/usr/sbin/bgp-isolate +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate chown root:root /usr/sbin/bgp-isolate chmod 0755 /usr/sbin/bgp-isolate -sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/bgp/unisolate.j2 >/usr/sbin/bgp-unisolate +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate chown root:root /usr/sbin/bgp-unisolate chmod 0755 /usr/sbin/bgp-unisolate diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 79cdbb172f66..4ff66944fe07 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -31,7 +31,7 @@ RUN pip install /python-wheels/sswsdk-2.0.1-py2-none-any.whl && \ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY reconfigure.sh /opt/reconfigure.sh COPY ["config.sh", "/usr/bin/"] -COPY ["lldpd.conf.j2", "/etc/swss/lldp/"] +COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"] COPY ["lldpd", "/etc/default/"] ENTRYPOINT /usr/bin/config.sh && /usr/bin/supervisord diff --git a/dockers/docker-lldp-sv2/config.sh b/dockers/docker-lldp-sv2/config.sh index 29c9b11f8ed5..842a10306c4f 100755 --- a/dockers/docker-lldp-sv2/config.sh +++ b/dockers/docker-lldp-sv2/config.sh @@ -1,6 +1,6 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/swss/lldp/lldpd.conf.j2 >/etc/lldpd.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/lldpd.conf.j2 >/etc/lldpd.conf mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 332f485f72e6..db5a6a574f48 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -41,7 +41,7 @@ RUN apt-get update && apt-get install -y supervisor \ rm -rf ~/.cache COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY ["*.j2", "/etc/swss/snmp/"] +COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["config.sh", "/usr/bin/"] ## Although exposing ports is not need for host net mode, keep it for possible bridge mode diff --git a/dockers/docker-snmp-sv2/config.sh b/dockers/docker-snmp-sv2/config.sh index 0681416b1acb..f22dcd23b0d3 100755 --- a/dockers/docker-snmp-sv2/config.sh +++ b/dockers/docker-snmp-sv2/config.sh @@ -2,11 +2,11 @@ mkdir -p /etc/ssw -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/sonic_version.yml -t /etc/swss/snmp/sysDescription.j2 >/etc/ssw/sysDescription +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sysDescription.j2 >/etc/ssw/sysDescription mkdir -p /etc/snmp -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /etc/swss/snmp/snmpd.conf.j2 >/etc/snmp/snmpd.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 >/etc/snmp/snmpd.conf hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` /bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/ diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 7cb86e5b7e69..42d8758638af 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -14,7 +14,7 @@ debs/{{ deb }}{{' '}} {%- endfor %} COPY ["start.sh", "config.sh", "/usr/bin/"] -COPY ["teamd.j2", "/etc/swss/teamd/"] +COPY ["teamd.j2", "/usr/share/sonic/templates"] ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-teamd/config.sh b/dockers/docker-teamd/config.sh index 085a3d405af2..8259e2faf312 100755 --- a/dockers/docker-teamd/config.sh +++ b/dockers/docker-teamd/config.sh @@ -3,7 +3,7 @@ mkdir -p /etc/teamd for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml --var-keys minigraph_portchannel_interfaces`; do - sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /etc/swss/teamd/teamd.j2 >/etc/teamd/$pc.conf + sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /usr/share/sonic/templates/teamd.j2 >/etc/teamd/$pc.conf done mkdir -p /var/sonic diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index ad7541fe0fc1..f69d9ff87372 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -59,7 +59,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-utilities_*.deb || \ # Create all needed directories sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ -sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/templates/ +sudo mkdir -p $FILESYSTEM_ROOT/usr/share/sonic/templates/ # Apply apt configuration files sudo cp $IMAGE_CONFIGS/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ @@ -77,14 +77,14 @@ sudo cp $IMAGE_CONFIGS/minigraph/minigraph_{{sonic_hwsku}}.xml $FILESYSTEM_ROOT/ sudo cp $IMAGE_CONFIGS/ntp/ntp-config.service $FILESYSTEM_ROOT/etc/systemd/system/ 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/etc/sonic/templates/ +sudo cp $IMAGE_CONFIGS/ntp/ntp.conf.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/ sudo cp $IMAGE_CONFIGS/ntp/ntp.yml $FILESYSTEM_ROOT/etc/sonic/ # 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 sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.sh $FILESYSTEM_ROOT/usr/bin/ -sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.conf.j2 $FILESYSTEM_ROOT/etc/sonic/templates/ +sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.conf.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.yml $FILESYSTEM_ROOT/etc/sonic/ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/* $FILESYSTEM_ROOT/etc/rsyslog.d/ @@ -92,7 +92,7 @@ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/* $FILESYSTEM_ROOT/etc/rsyslog.d/ sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable interfaces-config.service sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.sh $FILESYSTEM_ROOT/usr/bin/ -sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/etc/sonic/templates/ +sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/ # Copy initial interfaces configuration file, will be overwritten on first boot sudo cp $IMAGE_CONFIGS/interfaces/init_interfaces $FILESYSTEM_ROOT/etc/network diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 286c94796952..f8b54790c931 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,8 +1,8 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/interfaces.j2 >/etc/network/interfaces -sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/vlan_interfaces.j2 >/etc/network/interfaces.d/vlan_interfaces -sonic-cfggen -m /etc/sonic/minigraph.xml -t /etc/sonic/templates/lag_interfaces.j2 >/etc/network/interfaces.d/lag_interfaces +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/vlan_interfaces.j2 >/etc/network/interfaces.d/vlan_interfaces +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/lag_interfaces.j2 >/etc/network/interfaces.d/lag_interfaces ifdown eth0 && ifup eth0 ifdown lo && ifup lo diff --git a/files/image_config/ntp/ntp-config.sh b/files/image_config/ntp/ntp-config.sh index 0989dfae74be..55a048a71328 100755 --- a/files/image_config/ntp/ntp-config.sh +++ b/files/image_config/ntp/ntp-config.sh @@ -1,3 +1,3 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/ntp.yml -t /etc/sonic/templates/ntp.conf.j2 >/etc/ntp.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/ntp.yml -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf diff --git a/files/image_config/rsyslog/rsyslog-config.sh b/files/image_config/rsyslog/rsyslog-config.sh index a5c46849183a..8c14b9adce9f 100755 --- a/files/image_config/rsyslog/rsyslog-config.sh +++ b/files/image_config/rsyslog/rsyslog-config.sh @@ -1,3 +1,3 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/rsyslog.yml -t /etc/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/rsyslog.yml -t /usr/share/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf From 89d052dc0fab5290fb35a798e11dada29a75175f Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 18 Feb 2017 21:24:03 -0800 Subject: [PATCH 0291/1833] [platform]: update to latest arista platform driver (#310) --- platform/broadcom/sonic-platform-modules-arista | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index db1bf4b8be53..76dddcf648ce 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit db1bf4b8be53d612a98d9468bebc3b3704ae42b1 +Subproject commit 76dddcf648cec1305eeb0ff4ba00ff234e986fd5 From 06ee8b6550a4ce9024ee431ff0f3f45d4287ebe5 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 20 Feb 2017 22:22:18 +0200 Subject: [PATCH 0292/1833] [sonic-utilities]: Update submodule pointer. (#312) Signed-off-by: marian-pritsak --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index a3f98cdb8f07..be32ae1646ce 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit a3f98cdb8f073b567c3d4f552ea53e110da960bb +Subproject commit be32ae1646ce3f98e6fbe15f70aa0629fba0735c From f57fd0bee8e9f3a40e984caabf96f38ffbb9c16a Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 21 Feb 2017 13:37:07 -0800 Subject: [PATCH 0293/1833] [platform] Add support configurations files for DCS-7060CX-32S (#313) --- dockers/docker-orchagent/start.sh | 2 + .../Arista-7060-CX32S/port_config.ini | 33 +++++++++++++ .../platform/Arista-7060-CX32S/sensors.conf | 47 +++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 src/sonic-config-engine/platform/Arista-7060-CX32S/port_config.ini create mode 100644 src/sonic-config-engine/platform/Arista-7060-CX32S/sensors.conf diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 4ef7638809e5..1a42f5146a8e 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -45,6 +45,8 @@ elif [ "$HWSKU" == "Arista-7050-QX32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " +elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "AS7512" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" fi diff --git a/src/sonic-config-engine/platform/Arista-7060-CX32S/port_config.ini b/src/sonic-config-engine/platform/Arista-7060-CX32S/port_config.ini new file mode 100644 index 000000000000..414fb94efbc1 --- /dev/null +++ b/src/sonic-config-engine/platform/Arista-7060-CX32S/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 33,34,35,36 Ethernet1/1 +Ethernet4 37,38,39,40 Ethernet2/1 +Ethernet8 41,42,43,44 Ethernet3/1 +Ethernet12 45,46,47,48 Ethernet4/1 +Ethernet16 49,50,51,52 Ethernet5/1 +Ethernet20 53,54,55,56 Ethernet6/1 +Ethernet24 57,58,59,60 Ethernet7/1 +Ethernet28 61,62,63,64 Ethernet8/1 +Ethernet32 65,66,67,68 Ethernet9/1 +Ethernet36 69,70,71,72 Ethernet10/1 +Ethernet40 73,74,75,76 Ethernet11/1 +Ethernet44 77,78,79,80 Ethernet12/1 +Ethernet48 81,82,83,84 Ethernet13/1 +Ethernet52 85,86,87,88 Ethernet14/1 +Ethernet56 89,90,91,92 Ethernet15/1 +Ethernet60 93,94,95,96 Ethernet16/1 +Ethernet64 97,98,99,100 Ethernet17/1 +Ethernet68 101,102,103,104 Ethernet18/1 +Ethernet72 105,106,107,108 Ethernet19/1 +Ethernet76 109,110,111,112 Ethernet20/1 +Ethernet80 113,114,115,116 Ethernet21/1 +Ethernet84 117,118,119,120 Ethernet22/1 +Ethernet88 121,122,123,124 Ethernet23/1 +Ethernet92 125,126,127,128 Ethernet24/1 +Ethernet96 1,2,3,4 Ethernet25/1 +Ethernet100 5,6,7,8 Ethernet26/1 +Ethernet104 9,10,11,12 Ethernet27/1 +Ethernet108 13,14,15,16 Ethernet28/1 +Ethernet112 17,18,19,20 Ethernet29/1 +Ethernet116 21,22,23,24 Ethernet30/1 +Ethernet120 25,26,27,28 Ethernet31/1 +Ethernet124 29,30,31,32 Ethernet32/1 diff --git a/src/sonic-config-engine/platform/Arista-7060-CX32S/sensors.conf b/src/sonic-config-engine/platform/Arista-7060-CX32S/sensors.conf new file mode 100644 index 000000000000..3b4dd2385322 --- /dev/null +++ b/src/sonic-config-engine/platform/Arista-7060-CX32S/sensors.conf @@ -0,0 +1,47 @@ +# libsensors configuration file for DCS-7060CX-32S +# ------------------------------------------------ +# + +bus "i2c-2" "SCD SMBus master 0 bus 0" +bus "i2c-3" "SCD SMBus master 0 bus 1" +bus "i2c-5" "SCD SMBus master 0 bus 3" +bus "i2c-6" "SCD SMBus master 0 bus 4" +bus "i2c-7" "SCD SMBus master 0 bus 5" + +chip "k10temp-pci-00c3" + label temp1 "Cpu temp sensor" + +# missing support for +# chip "max6697-i2c-2-1a" +# board sensor 65 75 +# (1) switch chip left sensor 95 105 +# (5) switch chip right sensor 95 105 +# (6) front panel temp sensor 65 75 + +chip "max6658-i2c-3-4c" + label temp1 "Cpu board temp sensor" + set temp1_max 75 + set temp1_crit 80 + + label temp2 "Back panel temp sensor" + set temp2_max 75 + set temp2_crit 80 + +chip "pmbus-i2c-3-4e" + label temp1 "Power controller 1 sensor 1" + label temp2 "Power controller 1 sensor 2" + +chip "pmbus-i2c-7-4e" + label temp1 "Power controller 2 sensor 1" + label temp2 "Power controller 2 sensor 2" + +chip "pmbus-i2c-6-58" + label temp1 "Power supply 1 hotspot sensor" + label temp2 "Power supply 1 inlet temp sensor" + label temp3 "Power supply 1 sensor" + +chip "pmbus-i2c-5-58" + label temp1 "Power supply 2 hotspot sensor" + label temp2 "Power supply 2 inlet temp sensor" + label temp3 "Power supply 2 sensor" + From a2b4bcbb615ccd847799155d4216c1c3f17b56da Mon Sep 17 00:00:00 2001 From: antonpatenko Date: Wed, 22 Feb 2017 05:04:43 +0200 Subject: [PATCH 0294/1833] [docker-base]: Enabled common debug packages installation. (#292) --- .gitignore | 1 + dockers/docker-base/{Dockerfile => Dockerfile.j2} | 9 ++++++++- rules/config | 3 +++ rules/docker-base.mk | 10 +++++++++- slave.mk | 1 + 5 files changed, 22 insertions(+), 2 deletions(-) rename dockers/docker-base/{Dockerfile => Dockerfile.j2} (89%) diff --git a/.gitignore b/.gitignore index ee80cf8d6c5c..96a073d67fc0 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,5 @@ dockers/docker-snmp-sv2/Dockerfile dockers/docker-team/Dockerfile dockers/docker-teamd/Dockerfile dockers/docker-config-engine/Dockerfile +dockers/docker-base/Dockerfile platform/broadcom/docker-syncd-brcm/Dockerfile diff --git a/dockers/docker-base/Dockerfile b/dockers/docker-base/Dockerfile.j2 similarity index 89% rename from dockers/docker-base/Dockerfile rename to dockers/docker-base/Dockerfile.j2 index 59af1f3ac6a3..5bdbf8b3d5ae 100644 --- a/dockers/docker-base/Dockerfile +++ b/dockers/docker-base/Dockerfile.j2 @@ -36,9 +36,16 @@ RUN apt-get -y purge \ exim4-config \ exim4-daemon-light +{% if docker_base_dbgs %} +## Install common debug-packages +RUN apt-get -y install \ +{% for dbg_pkg in docker_base_dbgs.split(' ') -%} + {{ dbg_pkg }}{{' '}} +{%- endfor %} +{% endif %} + ## Clean up apt ## Remove /var/lib/apt/lists/*, could be obsoleted for derived images RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; \ rm -rf /var/lib/apt/lists/*; \ rm -rf /tmp/*; - diff --git a/rules/config b/rules/config index ea4f32de1481..be8b7a9d77fb 100644 --- a/rules/config +++ b/rules/config @@ -42,3 +42,6 @@ PASSWORD = YourPaSsWoRd # If not set (default behavior) the default minigraph built into the image will be used. # ENABLE_DHCP_GRAPH_SERVICE = y +# SONIC_CONFIG_DEBUG - install debug packages +# Uncomment next line to enable: +# SONIC_CONFIG_DEBUG = y diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 56e42ac97b45..f041f7d05cdd 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -3,4 +3,12 @@ DOCKER_BASE = docker-base.gz $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base -SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_BASE) +ifeq ($(SONIC_CONFIG_DEBUG),y) +GDB = gdb +VIM = vim +OPENSSH = openssh-client +SSHPASS = sshpass +$(DOCKER_BASE)_DBG_PACKAGES += $(GDB) $(VIM) $(OPENSSH) $(SSHPASS) +endif + +SONIC_DOCKER_IMAGES += $(DOCKER_BASE) diff --git a/slave.mk b/slave.mk index 4ea96d1f4c80..2484e323c194 100644 --- a/slave.mk +++ b/slave.mk @@ -267,6 +267,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG) # Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')) + $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile docker build --squash --no-cache -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ From b5f9fcae99d2c756ce8b1d5cae0a1eb4c6eb32c9 Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Wed, 22 Feb 2017 18:15:39 +0800 Subject: [PATCH 0295/1833] [platform]: ingrasys-s9100: Add ingrasys switch s9100 (#318) Signed-off-by: Sam Yang --- dockers/docker-orchagent/start.sh | 2 + .../minigraph/minigraph_ingrasys-s9100.xml | 115 ++++++++++++++++++ .../x86_64/platforms/x86_64-ingrasys_s9100-r0 | 3 + .../platform/ingrasys-s9100/port_config.ini | 33 +++++ .../platform/ingrasys-s9100/sensors.conf | 35 ++++++ 5 files changed, 188 insertions(+) create mode 100644 files/image_config/minigraph/minigraph_ingrasys-s9100.xml create mode 100644 installer/x86_64/platforms/x86_64-ingrasys_s9100-r0 create mode 100644 src/sonic-config-engine/platform/ingrasys-s9100/port_config.ini create mode 100644 src/sonic-config-engine/platform/ingrasys-s9100/sensors.conf diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 1a42f5146a8e..9e51111927c6 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -49,6 +49,8 @@ elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "AS7512" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "ingrasys-s9100" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" fi service rsyslog start diff --git a/files/image_config/minigraph/minigraph_ingrasys-s9100.xml b/files/image_config/minigraph/minigraph_ingrasys-s9100.xml new file mode 100644 index 000000000000..c67990fc7305 --- /dev/null +++ b/files/image_config/minigraph/minigraph_ingrasys-s9100.xml @@ -0,0 +1,115 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + OCPSCH01040GGLF + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040GGLF + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + OCPSCH01040GGLF + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + OCPSCH01040GGLF + Ethernet4 + + + + OCPSCH01040GGLF + ingrasys-s9100 +
diff --git a/installer/x86_64/platforms/x86_64-ingrasys_s9100-r0 b/installer/x86_64/platforms/x86_64-ingrasys_s9100-r0 new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/installer/x86_64/platforms/x86_64-ingrasys_s9100-r0 @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/src/sonic-config-engine/platform/ingrasys-s9100/port_config.ini b/src/sonic-config-engine/platform/ingrasys-s9100/port_config.ini new file mode 100644 index 000000000000..d2b36ebf5e2a --- /dev/null +++ b/src/sonic-config-engine/platform/ingrasys-s9100/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 5,6,7,8 Ethernet0 +Ethernet4 1,2,3,4 Ethernet4 +Ethernet8 13,14,15,16 Ethernet8 +Ethernet12 9,10,11,12 Ethernet12 +Ethernet16 21,22,23,24 Ethernet16 +Ethernet20 17,18,19,20 Ethernet20 +Ethernet24 29,30,31,32 Ethernet24 +Ethernet28 25,26,27,28 Ethernet28 +Ethernet32 37,38,39,40 Ethernet32 +Ethernet36 33,34,35,36 Ethernet36 +Ethernet40 45,46,47,48 Ethernet40 +Ethernet44 41,42,43,44 Ethernet44 +Ethernet48 53,54,55,56 Ethernet48 +Ethernet52 49,50,51,52 Ethernet52 +Ethernet56 61,62,63,64 Ethernet56 +Ethernet60 57,58,59,60 Ethernet60 +Ethernet64 69,70,71,72 Ethernet64 +Ethernet68 65,66,67,68 Ethernet68 +Ethernet72 77,78,79,80 Ethernet72 +Ethernet76 73,74,75,76 Ethernet76 +Ethernet80 85,86,87,88 Ethernet80 +Ethernet84 81,82,83,84 Ethernet84 +Ethernet88 93,94,95,96 Ethernet88 +Ethernet92 89,90,91,92 Ethernet92 +Ethernet96 101,102,103,104 Ethernet96 +Ethernet100 97,98,99,100 Ethernet100 +Ethernet104 109,110,111,112 Ethernet104 +Ethernet108 105,106,107,108 Ethernet108 +Ethernet112 117,118,119,120 Ethernet112 +Ethernet116 113,114,115,116 Ethernet116 +Ethernet120 125,126,127,128 Ethernet120 +Ethernet124 121,122,123,124 Ethernet124 diff --git a/src/sonic-config-engine/platform/ingrasys-s9100/sensors.conf b/src/sonic-config-engine/platform/ingrasys-s9100/sensors.conf new file mode 100644 index 000000000000..44eedb4b11b0 --- /dev/null +++ b/src/sonic-config-engine/platform/ingrasys-s9100/sensors.conf @@ -0,0 +1,35 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + label temp1 "DIMM Temp" + set temp1_max 50 + set temp1_crit 85 + +chip "w83795adg-*" + label in0 "1.0V" + label in1 "1.0V_ROV" + label in2 "1.25V" + label in3 "1.8V" + ignore in4 + ignore in5 + ignore in6 + ignore in7 + label in12 "+3.3V" + ignore in14 + ignore in15 + ignore in16 + label fan1 "FANTRAY 1-A" + label fan2 "FANTRAY 1-B" + label fan3 "FANTRAY 2-A" + label fan4 "FANTRAY 2-B" + label fan5 "FANTRAY 3-A" + label fan6 "FANTRAY 3-B" + label fan7 "FANTRAY 4-A" + label fan8 "FANTRAY 4-B" + label temp1 "Front MAC Temp" + label temp2 "Rear MAC Temp" + ignore temp3 + ignore temp4 + ignore intrusion0 From 4feec05cf824e15c2a92504d7338e209c0e6b0d2 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 22 Feb 2017 02:16:24 -0800 Subject: [PATCH 0296/1833] [swss]: update sonic-swss to fix buffer configuration on mlnx platform (#317) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 1ceb354a6742..3c3908654ba1 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 1ceb354a6742a35d65e31fb28ea68a2e6b9643dd +Subproject commit 3c3908654ba10ad2307f2b0ac07bff55c577a47c From f087f1317bd3e3b79d821af1ca676e36f927223c Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Wed, 22 Feb 2017 12:17:33 +0200 Subject: [PATCH 0297/1833] [sonic-sairedis]: Update submodule pointer. (#314) Update Mellanox platform ONIE version. --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index d6e7827a16af..84f6221f340e 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit d6e7827a16af97f0fadbcf0f2da9b2d80a135cb6 +Subproject commit 84f6221f340ec6618b3a72da41fff4047af7eec9 From 95ad5c79fd7297205554a444c32d0c0daa9cae5b Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 22 Feb 2017 14:28:37 -0800 Subject: [PATCH 0298/1833] Fix the reference in docker-snmp-sv2 to deprecated alias_map.json (#320) --- dockers/docker-snmp-sv2/config.sh | 3 +-- src/sonic-config-engine/sonic-cfggen | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dockers/docker-snmp-sv2/config.sh b/dockers/docker-snmp-sv2/config.sh index f22dcd23b0d3..b6216e8353b0 100755 --- a/dockers/docker-snmp-sv2/config.sh +++ b/dockers/docker-snmp-sv2/config.sh @@ -8,8 +8,7 @@ mkdir -p /etc/snmp sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 >/etc/snmp/snmpd.conf -hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` -/bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/ +sonic-cfggen -m /etc/sonic/minigraph.xml -s >/etc/snmp/alias_map.json mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 02518b3ea364..3cd269805b84 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -54,6 +54,7 @@ def main(): parser.add_argument("-a", "--additional-data", help="addition data, in json string") group = parser.add_mutually_exclusive_group() group.add_argument("-t", "--template", help="render the data with the template file") + group.add_argument("-s", "--alias-mapping", help="print alias mapping json if available", action='store_true') group.add_argument("-v", "--var", help="print the value of a variable") group.add_argument("--var-json", help="print the value of a variable, in json format") group.add_argument("--var-keys", help="print all keys of a map variable") @@ -101,6 +102,13 @@ def main(): if args.var_keys != None: for key in data[args.var_keys].keys(): print key + + if args.alias_mapping != None: + mapping = {} + if data.has_key('alias_map'): + for item in data['alias_map']: + mapping[item['sonic']] = item['origin'] + print json.dumps(mapping) if args.print_data: print data From 40fdde5749fde3b5538cf3adf35cffec99edb27b Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 22 Feb 2017 17:21:03 -0800 Subject: [PATCH 0299/1833] Allow enabling dhcp graph service by cmdline input (#322) --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 070c540509cf..d17b002e66b1 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,7 @@ DOCKER_BUILD = docker build --no-cache \ PLATFORM=$(PLATFORM) \ SKU=$(SKU) \ DEBUG_BUILD=$(DEBUG_BUILD) \ + ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ $@ sonic-slave-build : From dc7c7b1de2243a14637de7259afb60d6c660eedb Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 22 Feb 2017 19:25:30 -0800 Subject: [PATCH 0300/1833] Fix an issue in cfggen that always printing alias mapping (#323) --- src/sonic-config-engine/sonic-cfggen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 3cd269805b84..169967075473 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -103,7 +103,7 @@ def main(): for key in data[args.var_keys].keys(): print key - if args.alias_mapping != None: + if args.alias_mapping: mapping = {} if data.has_key('alias_map'): for item in data['alias_map']: From 496a03bfee713aac7d6c92ba4b26306b49060729 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 23 Feb 2017 03:37:29 -0800 Subject: [PATCH 0301/1833] [platform]: add port_config.ini for dell z9100 (#328) --- .../platform/Force10-Z9100/port_config.ini | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/sonic-config-engine/platform/Force10-Z9100/port_config.ini diff --git a/src/sonic-config-engine/platform/Force10-Z9100/port_config.ini b/src/sonic-config-engine/platform/Force10-Z9100/port_config.ini new file mode 100644 index 000000000000..e06a68fadce6 --- /dev/null +++ b/src/sonic-config-engine/platform/Force10-Z9100/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 49,50,51,52 +Ethernet4 53,54,55,56 +Ethernet8 57,58,59,60 +Ethernet12 61,62,63,64 +Ethernet16 65,66,67,68 +Ethernet20 69,70,71,72 +Ethernet24 73,74,75,76 +Ethernet28 77,78,79,80 +Ethernet32 37,38,39,40 +Ethernet36 33,34,35,36 +Ethernet40 45,46,47,48 +Ethernet44 41,42,43,44 +Ethernet48 81,82,83,84 +Ethernet52 85,86,87,88 +Ethernet56 89,90,91,92 +Ethernet60 93,94,95,96 +Ethernet64 97,98,99,100 +Ethernet68 101,102,103,104 +Ethernet72 105,106,107,108 +Ethernet76 109,110,111,112 +Ethernet80 21,22,23,24 +Ethernet84 17,18,19,20 +Ethernet88 29,30,31,32 +Ethernet92 25,26,27,28 +Ethernet96 117,118,119,120 +Ethernet100 113,114,115,116 +Ethernet104 125,126,127.128 +Ethernet108 121,122,123,124 +Ethernet112 5,6,7,8 +Ethernet116 1,2,3,4 +Ethernet120 13,14,15,16 +Ethernet124 9,10,11,12 From acb909c989ba3c1d779c8c02d87d17f18faf2d36 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Thu, 23 Feb 2017 13:52:26 +0200 Subject: [PATCH 0302/1833] Update Mellanox SAI git reference (#326) New SAI commits include some fixes for ACLs on LAG member support --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 3b8db59e7fc5..b9396e2f3421 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = 35e5e8739bec80c19053b7bb9cf6d083b8144fb5 +MLNX_SAI_REVISION = b2137c6d66f7f1bcdec4a0d0d17264ec5695d31b export MLNX_SAI_VERSION MLNX_SAI_REVISION From 151a7d2a90ddf2cd08601aea96e0a9b4be96725e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 23 Feb 2017 11:21:11 -0800 Subject: [PATCH 0303/1833] Apply buffer/qos configuration for mlnx platform (#321) --- dockers/docker-orchagent/start.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 9e51111927c6..fff118f0effd 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -51,6 +51,8 @@ elif [ "$HWSKU" == "AS7512" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "ingrasys-s9100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "ACS-MSN2700" ]; then + SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " fi service rsyslog start From 873f6f8fb6b7ee06f02dedd8f351f93b237ea456 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 23 Feb 2017 13:12:54 -0800 Subject: [PATCH 0304/1833] [oneimage] Check if graph service address got from dhcp is valid url (#324) * [oneimage] Check if graph service address got from dhcp is valid url --- files/image_config/updategraph/updategraph | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 203905b85c7c..68fbe6eb9c19 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -29,9 +29,14 @@ if [ "$src" = "dhcp" ]; then HOSTNAME=`hostname -s` GRAPH_URL=`sonic-cfggen -t /tmp/dhcp_graph_url -a "{\"hostname\": \"$HOSTNAME\"}"` + URL_REGEX='^(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]$' + if [[ ! $GRAPH_URL =~ $URL_REGEX ]]; then + echo "\"$GRAPH_URL\" is not a valid url. Skipping graph update." + exit 0 + fi if [ "$dhcp_as_static" = "true" ]; then - sed -i "/src=d/d" /etc/sonic/updategraph.conf - echo "src=$GRAPH_URL" >> /etc/sonic/updategraph.conf + sed -i "/src=/d" /etc/sonic/updategraph.conf + echo "src=\"$GRAPH_URL\"" >> /etc/sonic/updategraph.conf fi else GRAPH_URL=$src From a16c780285e5d6acfef818b26cb198a9a4b3d5e9 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 23 Feb 2017 14:47:51 -0800 Subject: [PATCH 0305/1833] [teamd] Fix a bug in #305 that will break teamd (#329) --- dockers/docker-teamd/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 42d8758638af..e1e41c33ba17 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -14,7 +14,7 @@ debs/{{ deb }}{{' '}} {%- endfor %} COPY ["start.sh", "config.sh", "/usr/bin/"] -COPY ["teamd.j2", "/usr/share/sonic/templates"] +COPY ["teamd.j2", "/usr/share/sonic/templates/"] ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive From 5e42d2abb4eb1f949da8809d4b0ab69039f23289 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 23 Feb 2017 20:40:21 -0800 Subject: [PATCH 0306/1833] [platform]: add z9100 platform modules (#331) --- .gitmodules | 3 +++ platform/broadcom/platform-modules-dell.mk | 10 ++++++++++ platform/broadcom/rules.mk | 1 + platform/broadcom/sonic-platform-modules-dell | 1 + 4 files changed, 15 insertions(+) create mode 100644 platform/broadcom/platform-modules-dell.mk create mode 160000 platform/broadcom/sonic-platform-modules-dell diff --git a/.gitmodules b/.gitmodules index 5b542b1499ef..619688265221 100644 --- a/.gitmodules +++ b/.gitmodules @@ -50,3 +50,6 @@ [submodule "platform/broadcom/sonic-platform-modules-arista"] path = platform/broadcom/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic +[submodule "platform/broadcom/sonic-platform-modules-dell"] + path = platform/broadcom/sonic-platform-modules-dell + url = https://github.com/Azure/sonic-platform-modules-dell diff --git a/platform/broadcom/platform-modules-dell.mk b/platform/broadcom/platform-modules-dell.mk new file mode 100644 index 000000000000..36ca217f56ca --- /dev/null +++ b/platform/broadcom/platform-modules-dell.mk @@ -0,0 +1,10 @@ +# Dell Z9100 Platform modules + +DELL_Z9100_PLATFORM_MODULE_VERSION = 1.1 + +export DELL_Z9100_PLATFORM_MODULE_VERSION + +DELL_Z9100_PLATFORM_MODULE = platform-modules-z9100_$(DELL_Z9100_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELL_Z9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-dell +$(DELL_Z9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_DPKG_DEBS += $(DELL_Z9100_PLATFORM_MODULE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index e783f3cdbf9b..533354cdb8bb 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,6 +1,7 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-s6000.mk +include $(PLATFORM_PATH)/platform-modules-dell.mk include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell new file mode 160000 index 000000000000..af6556c488e7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell @@ -0,0 +1 @@ +Subproject commit af6556c488e7fbe0f0c074fb6cc32d27bf40cc83 From b04e3e7084334227692e313bcdabb48078338d8f Mon Sep 17 00:00:00 2001 From: wadelnn Date: Fri, 24 Feb 2017 20:10:19 +0800 Subject: [PATCH 0307/1833] Add Ingrasys S9100 platform submodule (#333) * Add Ingrasys S9100 platform submodule and .mk files. Signed-off-by: Wade He --- .gitmodules | 3 +++ platform/broadcom/platform-modules-ingrasys-s9100.mk | 10 ++++++++++ platform/broadcom/rules.mk | 1 + .../broadcom/sonic-platform-modules-ingrasys-s9100 | 1 + 4 files changed, 15 insertions(+) create mode 100755 platform/broadcom/platform-modules-ingrasys-s9100.mk mode change 100644 => 100755 platform/broadcom/rules.mk create mode 160000 platform/broadcom/sonic-platform-modules-ingrasys-s9100 diff --git a/.gitmodules b/.gitmodules index 619688265221..c8fb78edcdff 100644 --- a/.gitmodules +++ b/.gitmodules @@ -53,3 +53,6 @@ [submodule "platform/broadcom/sonic-platform-modules-dell"] path = platform/broadcom/sonic-platform-modules-dell url = https://github.com/Azure/sonic-platform-modules-dell +[submodule "platform/broadcom/sonic-platform-modules-ingrasys-s9100"] + path = platform/broadcom/sonic-platform-modules-ingrasys-s9100 + url = https://github.com/Ingrasys-sonic/sonic-platform-ingrasys-s9100 diff --git a/platform/broadcom/platform-modules-ingrasys-s9100.mk b/platform/broadcom/platform-modules-ingrasys-s9100.mk new file mode 100755 index 000000000000..1802290008b0 --- /dev/null +++ b/platform/broadcom/platform-modules-ingrasys-s9100.mk @@ -0,0 +1,10 @@ +# Ingrasys S9100 Platform modules + +INGRASYS_S9100_PLATFORM_MODULE_VERSION = 1.0.0 + +export INGRASYS_S9100_PLATFORM_MODULE_VERSION + +INGRASYS_S9100_PLATFORM_MODULE = sonic-platform-ingrasys-s9100_$(INGRASYS_S9100_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys-s9100 +$(INGRASYS_S9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_DPKG_DEBS += $(INGRASYS_S9100_PLATFORM_MODULE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk old mode 100644 new mode 100755 index 533354cdb8bb..d9dc0eccc1da --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -3,6 +3,7 @@ include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-s6000.mk include $(PLATFORM_PATH)/platform-modules-dell.mk include $(PLATFORM_PATH)/platform-modules-arista.mk +include $(PLATFORM_PATH)/platform-modules-ingrasys-s9100.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/one-image.mk diff --git a/platform/broadcom/sonic-platform-modules-ingrasys-s9100 b/platform/broadcom/sonic-platform-modules-ingrasys-s9100 new file mode 160000 index 000000000000..287f78d69417 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys-s9100 @@ -0,0 +1 @@ +Subproject commit 287f78d694174fb60e61420ca8e9de24ea300fd8 From b21d26dfe0b63c1525d5e32a1818aa8774854d04 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 24 Feb 2017 08:35:11 -0800 Subject: [PATCH 0308/1833] [platform]: add support for Force10-Z9100 32x100G (#332) * [platform]: add support for Force10-Z9100 32x100G * update sonic-swss submodule * [broadcom]: update broadcom sai/sdk --- dockers/docker-orchagent/start.sh | 2 + .../minigraph/minigraph_Force10-Z9100.xml | 1049 +++++++++++++++++ platform/broadcom/sai.mk | 8 +- platform/broadcom/sdk.mk | 8 +- .../platform/Force10-Z9100/port_config.ini | 66 +- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 7 files changed, 1094 insertions(+), 43 deletions(-) create mode 100644 files/image_config/minigraph/minigraph_Force10-Z9100.xml diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index fff118f0effd..51073fde00f4 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -41,6 +41,8 @@ if [ "$HWSKU" == "Force10-S6000" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " elif [ "$HWSKU" == "Force10-S6100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "Force10-Z9100" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Arista-7050-QX32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " diff --git a/files/image_config/minigraph/minigraph_Force10-Z9100.xml b/files/image_config/minigraph/minigraph_Force10-Z9100.xml new file mode 100644 index 000000000000..44cffcdd4378 --- /dev/null +++ b/files/image_config/minigraph/minigraph_Force10-Z9100.xml @@ -0,0 +1,1049 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + hundredGigE1/1 + 10.0.0.0/31 + + + + hundredGigE1/2 + 10.0.0.2/31 + + + + hundredGigE1/3 + 10.0.0.4/31 + + + + hundredGigE1/4 + 10.0.0.6/31 + + + + hundredGigE1/5 + 10.0.0.8/31 + + + + hundredGigE1/6 + 10.0.0.10/31 + + + + hundredGigE1/7 + 10.0.0.12/31 + + + + hundredGigE1/8 + 10.0.0.14/31 + + + + hundredGigE1/9 + 10.0.0.16/31 + + + + hundredGigE1/10 + 10.0.0.18/31 + + + + hundredGigE1/11 + 10.0.0.20/31 + + + + hundredGigE1/12 + 10.0.0.22/31 + + + + hundredGigE1/13 + 10.0.0.24/31 + + + + hundredGigE1/14 + 10.0.0.26/31 + + + + hundredGigE1/15 + 10.0.0.28/31 + + + + hundredGigE1/16 + 10.0.0.30/31 + + + + hundredGigE1/17 + 10.0.0.32/31 + + + + hundredGigE1/18 + 10.0.0.34/31 + + + + hundredGigE1/19 + 10.0.0.36/31 + + + + hundredGigE1/20 + 10.0.0.38/31 + + + + hundredGigE1/21 + 10.0.0.40/31 + + + + hundredGigE1/22 + 10.0.0.42/31 + + + + hundredGigE1/23 + 10.0.0.44/31 + + + + hundredGigE1/24 + 10.0.0.46/31 + + + + hundredGigE1/25 + 10.0.0.48/31 + + + + hundredGigE1/26 + 10.0.0.50/31 + + + + hundredGigE1/27 + 10.0.0.52/31 + + + + hundredGigE1/28 + 10.0.0.54/31 + + + + hundredGigE1/29 + 10.0.0.56/31 + + + + hundredGigE1/30 + 10.0.0.58/31 + + + + hundredGigE1/31 + 10.0.0.60/31 + + + + hundredGigE1/32 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + hundredGigE1/1 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/2 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/3 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/4 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/5 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/6 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/7 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/8 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/9 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/10 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/11 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/12 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/13 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/14 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/15 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/16 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/17 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/18 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/19 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/20 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/21 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/22 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/23 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/24 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/25 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/26 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/27 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/28 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/29 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/30 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/31 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/32 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Force10-Z9100 + + + + switch1 + Force10-Z9100 +
diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 9e07ccf4b91c..693bb7606745 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.3.1-1-20170208221802.12_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.3.1-1-20170208221802.12_amd64.deb?sv=2015-04-05&sr=b&sig=RpHs7rvOiM%2FzBHeaA2BwP4CYRmiJFhPGBn88Hx9V5Rg%3D&se=2030-10-25T02%3A43%3A53Z&sp=r" +BRCM_SAI = libsaibcm_2.1.3.1-2_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.3.1-2_amd64.deb?sv=2015-04-05&sr=b&sig=zR%2BANpuGPa6oQoYTE20eeFEWXH7QugPV8f%2BPl8N5Y5Y%3D&se=2030-11-03T11%3A18%3A37Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.3.1-1-20170208221802.12_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.3.1-2_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.3.1-1-20170208221802.12_amd64.deb?sv=2015-04-05&sr=b&sig=DNOUenzhSfCHR4QdxkNwf5zdoecCblClau4rjoa0oJE%3D&se=2030-10-25T02%3A47%3A33Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.3.1-2_amd64.deb?sv=2015-04-05&sr=b&sig=H25Jlxwkacnm1agUykzHxcr4G2quJNRQVPVwrG623vQ%3D&se=2030-11-03T11%3A20%3A56Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index a4f2dbfeb79d..8fe1cfa30de2 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.1.5-6-20170208212127.20_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-6-20170208212127.20_amd64.deb?sv=2015-04-05&sr=b&sig=VrkDUWofqRz7G70C8%2BGIVtimvNPgnSkCkZccEVPmiIM%3D&se=2030-10-25T02%3A46%3A20Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.1.5-7_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-7_amd64.deb?sv=2015-04-05&sr=b&sig=DY5BPSDturlcHXfqYcS3Gl89Ypd%2BWMYmMLZ2rlNoC5w%3D&se=2030-11-03T11%3A21%3A53Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-6-20170208212127.20_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-6-20170208212127.20_amd64.deb?sv=2015-04-05&sr=b&sig=FUNtA7GYpHPoP9QH72VdwLk0yxCUAmEqNmZm%2FEMOUf8%3D&se=2030-10-25T02%3A45%3A34Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-7_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-7_amd64.deb?sv=2015-04-05&sr=b&sig=glZblgedvf6uOW5k1YpU7NiBWnIZgX5oWvcVsDsYuXc%3D&se=2030-11-03T11%3A22%3A44Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) diff --git a/src/sonic-config-engine/platform/Force10-Z9100/port_config.ini b/src/sonic-config-engine/platform/Force10-Z9100/port_config.ini index e06a68fadce6..e000f29bef38 100644 --- a/src/sonic-config-engine/platform/Force10-Z9100/port_config.ini +++ b/src/sonic-config-engine/platform/Force10-Z9100/port_config.ini @@ -1,33 +1,33 @@ -# name lanes -Ethernet0 49,50,51,52 -Ethernet4 53,54,55,56 -Ethernet8 57,58,59,60 -Ethernet12 61,62,63,64 -Ethernet16 65,66,67,68 -Ethernet20 69,70,71,72 -Ethernet24 73,74,75,76 -Ethernet28 77,78,79,80 -Ethernet32 37,38,39,40 -Ethernet36 33,34,35,36 -Ethernet40 45,46,47,48 -Ethernet44 41,42,43,44 -Ethernet48 81,82,83,84 -Ethernet52 85,86,87,88 -Ethernet56 89,90,91,92 -Ethernet60 93,94,95,96 -Ethernet64 97,98,99,100 -Ethernet68 101,102,103,104 -Ethernet72 105,106,107,108 -Ethernet76 109,110,111,112 -Ethernet80 21,22,23,24 -Ethernet84 17,18,19,20 -Ethernet88 29,30,31,32 -Ethernet92 25,26,27,28 -Ethernet96 117,118,119,120 -Ethernet100 113,114,115,116 -Ethernet104 125,126,127.128 -Ethernet108 121,122,123,124 -Ethernet112 5,6,7,8 -Ethernet116 1,2,3,4 -Ethernet120 13,14,15,16 -Ethernet124 9,10,11,12 +# name lanes alias +Ethernet0 49,50,51,52 hundredGigE1/1 +Ethernet4 53,54,55,56 hundredGigE1/2 +Ethernet8 57,58,59,60 hundredGigE1/3 +Ethernet12 61,62,63,64 hundredGigE1/4 +Ethernet16 65,66,67,68 hundredGigE1/5 +Ethernet20 69,70,71,72 hundredGigE1/6 +Ethernet24 73,74,75,76 hundredGigE1/7 +Ethernet28 77,78,79,80 hundredGigE1/8 +Ethernet32 37,38,39,40 hundredGigE1/9 +Ethernet36 33,34,35,36 hundredGigE1/10 +Ethernet40 45,46,47,48 hundredGigE1/11 +Ethernet44 41,42,43,44 hundredGigE1/12 +Ethernet48 81,82,83,84 hundredGigE1/13 +Ethernet52 85,86,87,88 hundredGigE1/14 +Ethernet56 89,90,91,92 hundredGigE1/15 +Ethernet60 93,94,95,96 hundredGigE1/16 +Ethernet64 97,98,99,100 hundredGigE1/17 +Ethernet68 101,102,103,104 hundredGigE1/18 +Ethernet72 105,106,107,108 hundredGigE1/19 +Ethernet76 109,110,111,112 hundredGigE1/20 +Ethernet80 21,22,23,24 hundredGigE1/21 +Ethernet84 17,18,19,20 hundredGigE1/22 +Ethernet88 29,30,31,32 hundredGigE1/23 +Ethernet92 25,26,27,28 hundredGigE1/24 +Ethernet96 117,118,119,120 hundredGigE1/25 +Ethernet100 113,114,115,116 hundredGigE1/26 +Ethernet104 125,126,127,128 hundredGigE1/27 +Ethernet108 121,122,123,124 hundredGigE1/28 +Ethernet112 5,6,7,8 hundredGigE1/29 +Ethernet116 1,2,3,4 hundredGigE1/30 +Ethernet120 13,14,15,16 hundredGigE1/31 +Ethernet124 9,10,11,12 hundredGigE1/32 diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 84f6221f340e..144bbbac5b1a 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 84f6221f340ec6618b3a72da41fff4047af7eec9 +Subproject commit 144bbbac5b1a9c3167ae6ecd94ff7bdffd3b869e diff --git a/src/sonic-swss b/src/sonic-swss index 3c3908654ba1..9f0351815aef 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 3c3908654ba10ad2307f2b0ac07bff55c577a47c +Subproject commit 9f0351815aef8798a1367ef6e60e006156d7d190 From 1b240e8f37182ba8aeb3b220522226f3a78c5d76 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 24 Feb 2017 16:27:39 -0800 Subject: [PATCH 0309/1833] [boardcom]: update saibcm to 2.1.3.1-3 (#336) --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 693bb7606745..f396e030cfbf 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.3.1-2_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.3.1-2_amd64.deb?sv=2015-04-05&sr=b&sig=zR%2BANpuGPa6oQoYTE20eeFEWXH7QugPV8f%2BPl8N5Y5Y%3D&se=2030-11-03T11%3A18%3A37Z&sp=r" +BRCM_SAI = libsaibcm_2.1.3.1-3_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.3.1-3_amd64.deb?sv=2015-04-05&sr=b&sig=j5U8yxIqk4B1Wk8OZp9HbMQ7J9u5GPQNmzTDLilJDjU%3D&se=2030-11-03T20%3A45%3A59Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.3.1-2_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.3.1-3_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.3.1-2_amd64.deb?sv=2015-04-05&sr=b&sig=H25Jlxwkacnm1agUykzHxcr4G2quJNRQVPVwrG623vQ%3D&se=2030-11-03T11%3A20%3A56Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.3.1-3_amd64.deb?sv=2015-04-05&sr=b&sig=7FPU5S234yjDIPJUUasC%2BRDqPdrJjdOmSodEApzQjTo%3D&se=2030-11-03T20%3A49%3A38Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From 08734229b61aa094e1e408dad610c441997cbe94 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Sat, 25 Feb 2017 11:13:23 -0800 Subject: [PATCH 0310/1833] [cfggen] Allow sku with no alias mapping and minigraph with no png (#335) * [cfggen] Allow sku with no alias mapping and minigraph with no png * Add alias mapping for minigraph_neighbor keys --- src/sonic-config-engine/minigraph.py | 35 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 317d9c963a33..79496eee4e89 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -65,9 +65,14 @@ def parse_png(png, hname): startport = link.find(str(QName(ns, "StartPort"))).text if enddevice == hname: + if port_alias_map.has_key(endport): + endport = port_alias_map[endport] neighbors[endport] = {'name': startdevice, 'port': startport} else: + if port_alias_map.has_key(startport): + endport = port_alias_map[startport] neighbors[startport] = {'name': enddevice, 'port': endport} + if child.tag == str(QName(ns, "Devices")): for device in child.findall(str(QName(ns, "Device"))): lo_addr = None @@ -174,7 +179,10 @@ def parse_dpg(dpg, hname): pcintfname = pcintf.find(str(QName(ns, "Name"))).text pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text pcmbr_list = pcintfmbr.split(';', 1) - pc_intfs[pcintfname]=pcmbr_list + for i,member in enumerate(pcmbr_list): + if port_alias_map.has_key(member): + pcmbr_list[i] = port_alias_map[member] + pc_intfs[pcintfname] = pcmbr_list lointfs = child.find(str(QName(ns, "LoopbackIPInterfaces"))) lo_intfs = [] @@ -210,10 +218,14 @@ def parse_dpg(dpg, hname): vlanid = vintf.find(str(QName(ns, "VlanID"))).text vintfmbr = vintf.find(str(QName(ns, "AttachTo"))).text vmbr_list = vintfmbr.split(';') - vlan_attributes = {'name': vintfname, 'members': vmbr_list, 'vlanid': vlanid} + for i,member in enumerate(vmbr_list): + if port_alias_map.has_key(member): + vmbr_list[i] = port_alias_map[member] + vlan_attributes = {'name': vintfname, 'members': " ".join(vmbr_list), 'vlanid': vlanid} for addrtuple in vlan_map.get(vintfname, []): vlan_attributes.update(addrtuple) vlan_intfs.append(copy.deepcopy(vlan_attributes)) + return intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs return None, None, None, None, None @@ -352,19 +364,6 @@ def parse_xml(filename, platform=None): elif child.tag == str(QName(ns, "UngDec")): (u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname) - # Replace port with alias in Vlan interfaces members - for vlan in vlan_intfs: - for i,member in enumerate(vlan['members']): - vlan['members'][i] = port_alias_map[member] - - # Convert vlan members into a space-delimited string - vlan['members'] = " ".join(vlan['members']) - - # Replace port with alias in port channel interfaces members - for pc in pc_intfs.keys(): - for i,member in enumerate(pc_intfs[pc]): - pc_intfs[pc][i] = port_alias_map[member] - Tree = lambda: defaultdict(Tree) results = Tree() @@ -385,15 +384,15 @@ def parse_xml(filename, platform=None): results['minigraph_underlay_neighbors'] = u_neighbors results['minigraph_underlay_devices'] = u_devices results['minigraph_as_xml'] = mini_graph_path - results['minigraph_console'] = get_console_info(devices, console_dev, console_port) - results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port) + if devices != None: + results['minigraph_console'] = get_console_info(devices, console_dev, console_port) + results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port) results['minigraph_hostname'] = hostname results['inventory_hostname'] = hostname results['alias_map'] = alias_map_list return results - port_alias_map = {} From 8dc9dccaefcdfa7bd17838cade9a93ae6144cf20 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 27 Feb 2017 02:00:44 +0200 Subject: [PATCH 0311/1833] [slave.mk]: Make installer executable. (#337) Signed-off-by: marian-pritsak --- slave.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slave.mk b/slave.mk index 2484e323c194..9a31aadf11f5 100644 --- a/slave.mk +++ b/slave.mk @@ -334,6 +334,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform $(if $($*_DOCKERS), rm sonic_debian_extension.sh, ) + + chmod a+x $@ $(FOOTER) ############################################################################### From ffd65841e60a24b1daae21cb9d608507431e7f81 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 26 Feb 2017 21:55:24 -0800 Subject: [PATCH 0312/1833] [kernel]: update linux kernel to support z9100 (#339) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index cf93afcc12cb..258652dfb123 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit cf93afcc12cb77a94fafd7f828d7549fdc346027 +Subproject commit 258652dfb1234ac224930ce5bf13954165ce55e5 From 2a551d3c60396122c3e8d70b26466e3972fc73ef Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 27 Feb 2017 00:13:36 -0800 Subject: [PATCH 0313/1833] Consolidate device-specific files; install as a Debian package (#316) ( All device-specific files now reside under /device directory in a // directory structure in repo. * Device-specific files are now packaged into a Debian package (sonic-device-data) and are now installed to /usr/share/sonic/device/// directory on switch. --- .gitignore | 1 + README.md | 80 +++---- .../AS7512/port_config.ini | 33 +++ .../Arista-7050-QX32/port_config.ini | 33 +++ .../Arista-7050-QX32/sai.profile | 1 + .../x86_64-arista_7050_qx32/plugins/eeprom.py | 220 ++++++++++++++++++ .../plugins/sfputil.py | 27 +++ .../x86_64-arista_7050_qx32/sensors.conf | 79 +++++++ .../Arista-7060-CX32S/port_config.ini | 33 +++ .../x86_64-arista_7060_cx32s/sensors.conf | 47 ++++ .../Force10-S6000/port_config.ini | 33 +++ .../Force10-S6000/sai.profile | 1 + .../plugins/eeprom.py | 124 ++++++++++ .../plugins/sfputil.py | 27 +++ .../x86_64-dell_s6000_s1220-r0/sensors.conf | 57 +++++ .../Force10-S6100/port_config.ini | 65 ++++++ .../Force10-S6100/sai.profile | 1 + .../plugins/sfputil.py | 27 +++ .../INGRASYS-S9100-C32/port_config.ini | 33 +++ .../x86_64-ingrasys_s9100-r0/sensors.conf | 35 +++ .../ACS-MSN2700/port_config.ini | 33 +++ .../ACS-MSN2700/sai.profile | 1 + .../x86_64-mlnx_msn2700-r0/plugins/eeprom.py | 33 +++ .../x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 28 +++ .../x86_64-mlnx_msn2700-r0/sensors.conf | 21 ++ files/build_templates/docker_image_ctl.j2 | 9 +- .../build_templates/sonic_debian_extension.j2 | 53 +++-- rules/sonic-device-data.mk | 10 + rules/sonic-utilities.mk | 4 +- slave.mk | 2 +- src/sonic-config-engine/minigraph.py | 4 +- src/sonic-device-data/LICENSE | 15 ++ src/sonic-device-data/MAINTAINERS | 7 + src/sonic-device-data/Makefile | 22 ++ src/sonic-device-data/README.md | 4 + src/sonic-device-data/src/debian/changelog | 5 + src/sonic-device-data/src/debian/compat | 1 + src/sonic-device-data/src/debian/control | 11 + src/sonic-device-data/src/debian/copyright | 0 src/sonic-device-data/src/debian/install | 1 + src/sonic-device-data/src/debian/rules | 7 + src/sonic-utilities | 2 +- 42 files changed, 1157 insertions(+), 73 deletions(-) create mode 100644 device/accton/x86_64-accton_as7512_32x-r0/AS7512/port_config.ini create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile create mode 100644 device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py create mode 100644 device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py create mode 100644 device/arista/x86_64-arista_7050_qx32/sensors.conf create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini create mode 100644 device/arista/x86_64-arista_7060_cx32s/sensors.conf create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/port_config.ini create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/plugins/eeprom.py create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf create mode 100644 rules/sonic-device-data.mk create mode 100644 src/sonic-device-data/LICENSE create mode 100644 src/sonic-device-data/MAINTAINERS create mode 100644 src/sonic-device-data/Makefile create mode 100644 src/sonic-device-data/README.md create mode 100644 src/sonic-device-data/src/debian/changelog create mode 100644 src/sonic-device-data/src/debian/compat create mode 100644 src/sonic-device-data/src/debian/control create mode 100644 src/sonic-device-data/src/debian/copyright create mode 100644 src/sonic-device-data/src/debian/install create mode 100755 src/sonic-device-data/src/debian/rules diff --git a/.gitignore b/.gitignore index 96a073d67fc0..b2c3e81854b0 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ src/snmpd/* !src/snmpd/Makefile src/thrift/* !src/thrift/Makefile +src/sonic-device-data/src/device/ # Autogenerated Dockerfiles dockers/docker-database/Dockerfile diff --git a/README.md b/README.md index 5e3cffec91dc..ce41a8f97196 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,51 @@ -Broadcom[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) -Cavium[![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) -Mellanox[![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) -P4[![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) +Broadcom: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) +Cavium: [![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) +Mellanox: [![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) +P4: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) -# Build SONiC Switch Images - buildimage +# sonic-buildimage + +## Build SONiC Switch Images # Description Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS. -# Prerequisite -# SAI Version +# Prerequisites + +## SAI Version SONiC V2 is using [SAI 0.9.4](https://github.com/opencomputeproject/SAI/tree/v0.9.4). -# Clone or fetch the code repository with all git submodules -To clone the code repository recursively, assuming git version 1.9 or newer +## Clone or fetch the code repository with all git submodules +To clone the code repository recursively, assuming git version 1.9 or newer: git clone --recursive https://github.com/Azure/sonic-buildimage.git -If it is already cloned, however there is no files under ./dockers/docker-base/ or ./src/sonic-linux-kernel/, manually fetch all the git submodules. - +NOTE: If the repo has already been cloned, however there are no files under the submodule directories (e.g., src/lldpd, src/ptf, src/sonic-linux-kernel, etc.), you can manually fetch all the git submodules as follows: git submodule update --init --recursive -You also need to change all git paths to relative path as we build all submodules inside the docker. +You also need to change all git paths to relative path as we build all submodules inside the docker: git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $(realpath --relative-to=. $(cut -d" " -f2 .git))" > .git' -# Usage +## Usage -To build NOS installer image and docker images, run command line +To build NOS installer image and docker images, run the following commands: make configure PLATFORM=[ASIC_VENDOR] SKU=[HW_SKU] make - **NOTE**: We recommend to reserve 50G free space to build one platform. + **NOTE**: We recommend reserving 50G free space to build one platform. -Supported PLATFORM AND SKU are: +Supported PLATFORM and SKU are: - PLATFORM=broadcom SKU=Force10-S6000 - PLATFORM=mellanox SKU=ACS-MSN2700 - PLATFORM=cavium SKU=AS7512 - PLATFORM=p4 -You can find rules/config file useful. It contains configuration options for build process, like adding more verbosity or showing dependencies, username and password for base image etc. +You may find the rules/config file useful. It contains configuration options for the build process, like adding more verbosity or showing dependencies, username and password for base image etc. Every docker image is built and saved to target/ directory. -So, for instance, to build only docker-database, execute +So, for instance, to build only docker-database, execute: make target/docker-database.gz @@ -51,37 +53,37 @@ Same goes for debian packages, which are under target/debs/: make target/debs/swss_1.0.0_amd64.deb -Every target has a clean target, so in order to clean swss, execute +Every target has a clean target, so in order to clean swss, execute: make target/debs/swss_1.0.0_amd64.deb-clean -It is recommended to use clean targets to clean all packages, that are built together, like dev packages for instance. In order to be more familiar with build process and make some changes to it, it is recommended to read this short [Documentation](README.buildsystem.md). +It is recommended to use clean targets to clean all packages that are built together, like dev packages for instance. In order to be more familiar with build process and make some changes to it, it is recommended to read this short [Documentation](README.buildsystem.md). -# Note: -If you are running make for the first time, a sonic-slave-${USER} docker image will be built automatically. -It is a one time action, so be patient. +## Notes: +- If you are running make for the first time, a sonic-slave-${USER} docker image will be built automatically. +This may take a while, but it is a one-time action, so please be patient. -The root is disabled, but the created user could sudo. +- The root user account is disabled. However, the created user can sudo. -The target directory is ./target, containing the NOS installer image and docker images. -- sonic-generic.bin: SONiC switch installer image (ONIE compatiable) -- sonic-aboot.bin: SONiC switch installer image (Aboot compatiable) -- docker-base.gz: base docker image where other docker images are built from, only used in build process (gzip tar archive) -- docker-database.gz: docker image for in-memory key-value store, used as inter-process communication (gzip tar archive) -- docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive) -- docker-orchagent-brcm.gz: docker image for SWitch State Service (SWSS) on Broadcom platform (gzip tar archive) -- docker-orchagent-cavm.gz: docker image for SWitch State Service (SWSS) on Cavium platform (gzip tar archive) -- docker-orchagent-mlnx.gz: docker image for SWitch State Service (SWSS) on Mellanox platform (gzip tar archive) -- docker-syncd-brcm.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive) -- docker-syncd-cavm.gz: docker image for the daemon to sync database and Cavium switch ASIC (gzip tar archive) -- docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) -- docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive) +- The target directory is ./target, containing the NOS installer image and docker images. + - sonic-generic.bin: SONiC switch installer image (ONIE compatiable) + - sonic-aboot.bin: SONiC switch installer image (Aboot compatiable) + - docker-base.gz: base docker image where other docker images are built from, only used in build process (gzip tar archive) + - docker-database.gz: docker image for in-memory key-value store, used as inter-process communication (gzip tar archive) + - docker-fpm.gz: docker image for quagga with fpm module enabled (gzip tar archive) + - docker-orchagent-brcm.gz: docker image for SWitch State Service (SWSS) on Broadcom platform (gzip tar archive) + - docker-orchagent-cavm.gz: docker image for SWitch State Service (SWSS) on Cavium platform (gzip tar archive) + - docker-orchagent-mlnx.gz: docker image for SWitch State Service (SWSS) on Mellanox platform (gzip tar archive) + - docker-syncd-brcm.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive) + - docker-syncd-cavm.gz: docker image for the daemon to sync database and Cavium switch ASIC (gzip tar archive) + - docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) + - docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive) -# Contribution guide +## Contribution Guide All contributors must sign a contribution license agreement before contributions can be accepted. Contact sonic-cla-agreements@microsoft.com. -### GitHub Workflow +## GitHub Workflow We're following basic GitHub Flow. If you have no idea what we're talking about, check out [GitHub's official guide](https://guides.github.com/introduction/flow/). Note that merge is only performed by the repository maintainer. diff --git a/device/accton/x86_64-accton_as7512_32x-r0/AS7512/port_config.ini b/device/accton/x86_64-accton_as7512_32x-r0/AS7512/port_config.ini new file mode 100644 index 000000000000..c10cd2786941 --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/AS7512/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 16,17,18,19 +Ethernet4 20,21,22,23 +Ethernet8 24,25,26,27 +Ethernet12 28,29,30,31 +Ethernet16 32,33,34,35 +Ethernet20 36,37,38,39 +Ethernet24 40,41,42,43 +Ethernet28 44,45,46,47 +Ethernet32 0,1,2,3 +Ethernet36 4,5,6,7 +Ethernet40 8,9,10,11 +Ethernet44 12,13,14,15 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 127,126,125,124 +Ethernet68 123,122,121,120 +Ethernet72 115,114,113,112 +Ethernet76 119,118,117,116 +Ethernet80 79,78,77,76 +Ethernet84 75,74,73,72 +Ethernet88 64,65,66,67 +Ethernet92 71,70,68,69 +Ethernet96 111,110,109,108 +Ethernet100 107,106,105,104 +Ethernet104 103,102,101,100 +Ethernet108 99,98,97,96 +Ethernet112 95,94,93,92 +Ethernet116 91,90,89,88 +Ethernet120 87,86,85,84 +Ethernet124 83,82,81,80 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini new file mode 100644 index 000000000000..b9ab8854a2ec --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 125,126,127,128 Ethernet1/1 +Ethernet4 121,122,123,124 Ethernet2/1 +Ethernet8 13,14,15,16 Ethernet3/1 +Ethernet12 9,10,11,12 Ethernet4/1 +Ethernet16 17,18,19,20 Ethernet5/1 +Ethernet20 21,22,23,24 Ethernet6/1 +Ethernet24 25,26,27,28 Ethernet7/1 +Ethernet28 29,30,31,32 Ethernet8/1 +Ethernet32 37,38,39,40 Ethernet9/1 +Ethernet36 33,34,35,36 Ethernet10/1 +Ethernet40 45,46,47,48 Ethernet11/1 +Ethernet44 41,42,43,44 Ethernet12/1 +Ethernet48 53,54,55,56 Ethernet13/1 +Ethernet52 49,50,51,52 Ethernet14/1 +Ethernet56 69,70,71,72 Ethernet15/1 +Ethernet60 65,66,67,68 Ethernet16/1 +Ethernet64 77,78,79,80 Ethernet17/1 +Ethernet68 73,74,75,76 Ethernet18/1 +Ethernet72 93,94,95,96 Ethernet19/1 +Ethernet76 89,90,91,92 Ethernet20/1 +Ethernet80 101,102,103,104 Ethernet21/1 +Ethernet84 97,98,99,100 Ethernet22/1 +Ethernet88 109,110,111,112 Ethernet23/1 +Ethernet92 105,106,107,108 Ethernet24/1 +Ethernet96 61,62,63,64 Ethernet25 +Ethernet100 57,58,59,60 Ethernet26 +Ethernet104 81,82,83,84 Ethernet27 +Ethernet108 85,86,87,88 Ethernet28 +Ethernet112 117,118,119,120 Ethernet29 +Ethernet116 113,114,115,116 Ethernet30 +Ethernet120 5,6,7,8 Ethernet31 +Ethernet124 1,2,3,4 Ethernet32 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile new file mode 100644 index 000000000000..76ffdfc028ed --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/td2-a7050-qx32-32x40G.config.bcm diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py b/device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py new file mode 100644 index 000000000000..f8a3515d924f --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python + +############################################################################# +# Arista 7050-QX32 +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + import subprocess + import re + import struct + import zlib + import StringIO + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +def showMac( m ): + return ":".join([m[0:2], m[2:4], m[4:6], m[6:8], m[8:10], m[10:12]]) + +typeMap = { + "END" : ( "00", None, None, None, False ), + "SKU" : ( "03", None, None, None, False ), + "MAC" : ( "05", None, showMac, None, False ), + "SerialNumber" : ( "0E", None, None, None, False ), + } + +idToNameMap = {} +for k, v in typeMap.iteritems(): + idToNameMap[ v[0] ] = k + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + _TLV_HDR_ENABLED = 0 + + pFdl = None + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/drivers/eeprom/1-0052/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + + def _decode_eeprom(self, e): + # For format 0002 and more recent fdls use the new Prefdl class + data = e[0:4] + if data in ("0002", "0003"): + fp = StringIO.StringIO(e[4:]) + self.pFdl = PreFdl( fp, data, data ) + + def decode_eeprom(self, e): + self._decode_eeprom(e) + return self.pFdl.show() + + def is_checksum_valid(self, e): + self._decode_eeprom(e) + return (True, self.pFdl.get_crc()) + + def serial_number_str(self, e): + self._decode_eeprom(e) + return self.pFdl.get_field('SerialNumber') + + def mgmtaddrstr(self,e): + self._decode_eeprom(e) + return self.pFdl.get_field('MAC') + +def crc32( data ): + return struct.unpack("I",struct.pack("i",zlib.crc32( data )))[0] + +def validSerial( x ): + x = x.replace( " ", "" ) + x = x.replace( "-", "" ) + # All serial numbers are upper case + x = x.upper() + if re.compile( "[A-Z]{3}\d{4}[A-Z0-9]{4}$" ).match( x ): + return x + return None + +class PreFdlField( ): + def __init__( self, name, valid, show, optionName, data=None, append=False ): + self.name = name + if valid: + self.valid = valid + else: + self.valid = lambda x: x + self.show = show + self.optionName = optionName + self.data = [] + self.append = append + if data: + self.dataIs( data ) + + def dataIs( self, data ): + vd = self.valid( data ) + if not vd: + raise InvalidPrefdlData( "Invalid %s: %s" % ( self.name, data ) ) + if self.append: + self.data.append( vd ) + else: + self.data = [ vd ] + +class TlvField( PreFdlField ): + def __init__( self, name ): + args = typeMap.get( name ) + valid = None + show = None + optionName = None + append = False + if args: + self.id, valid, show, optionName, append = args + PreFdlField.__init__( self, name, valid, show, optionName, append=append ) + + +class PreFdl(): + def __init__( self, fp=None, preFdlStr=None, version="0002" ): + # populate the required fields + self.requiredFields = [] + self.mac = None + self.serial = None + + if version == "0002": + preFdlStr, offset = self.initPreFdl2( fp, preFdlStr ) + elif version == "0003": + preFdlStr, offset = self.initPreFdl3( fp, preFdlStr ) + else: + raise NotImplementedError( + "Only Prefdl data format version 0002 or 0003 are supported" ) + + # populate the tlv fileds + self.tlvFields = {} + for k in typeMap.keys(): + self.tlvFields[ k ] = TlvField( k ) + + # create the map option to field + self.optionMap = {} + for f in self.requiredFields + self.tlvFields.values(): + # Do not add the option from TLV if already added by required fields + if f.optionName and f.optionName not in self.optionMap: + self.optionMap[ f.optionName ] = f + + # save the current tlv fields + if fp: + while True: + tlv = fp.read( 6 ) + ( id, lengthStr ) = ( tlv[0:2], tlv[2:6] ) + length = int( lengthStr, base=16 ) + bytes = fp.read( length ) + what = None if id not in idToNameMap.keys() else idToNameMap[ id ] + if what and what != "END": + self.tlvFields[ what ].dataIs( bytes ) + preFdlStr += tlv + bytes + offset += 6 + length + if what == "END": + # End of the tlv list + break + self.crc = fp.read( 8 ) + # Check the CRC + computed = crc32( preFdlStr ) + if int( self.crc, 16 ) != computed: + raise Exception( "Invalid CRC -- saw %s expected %8X" % + ( self.crc, computed ) ) + + # Initialize and parse fixed section for prefdl version 2. Return the offset + # to where the TLV section starts. + def initPreFdl2( self, fp, preFdlStr ): + # if we start with an existing file + if fp: + # if no preFdlStr is specified, read the fixed section, 30 bytes. + # Otherwise, only the 4 byte data version section was written and + # read the remaining 26 bytes from the fixed section. + if not preFdlStr: + preFdlStr = fp.read( 30 ).strip() + elif preFdlStr == "0002": + preFdlStr += fp.read( 26 ).strip() + else: + raise ValueError( "preFdlStr arg has invalid data format" ) + if len( preFdlStr ) < 12: + fatal( "prefdl is too short exiting" ) + data = None if not preFdlStr else preFdlStr[ 16:16 + 11 ] + self.requiredFields.append( + PreFdlField( "SerialNumber", validSerial, None, None, data ) ) + return preFdlStr, 30 + + # Initialize and parse fixed section for prefdl version 3. Return the offset + # to where the TLV section starts. + def initPreFdl3( self, fp, preFdlStr ): + # if we start with an existing file + currPtr = 0 + if fp and not preFdlStr: + preFdlStr = fp.read( 4 ).strip() + if len( preFdlStr ) < 4: + fatal( "prefdl is too short exiting" ) + return preFdlStr, 4 + + def show( self ): + for f in self.requiredFields + self.tlvFields.values(): + for d in f.data: + dStr = d if f.show is None else f.show( d ) + print "%s: %s" % ( f.name, dStr ) + + def get_field( self, name ): + for f in self.requiredFields + self.tlvFields.values(): + for d in f.data: + if f.name == name: + dStr = d if f.show is None else f.show( d ) + return dStr + + def get_crc( self ): + return self.crc + diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py b/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py new file mode 100644 index 000000000000..5d2d28b8f328 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + eeprom_offset = 10 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) diff --git a/device/arista/x86_64-arista_7050_qx32/sensors.conf b/device/arista/x86_64-arista_7050_qx32/sensors.conf new file mode 100644 index 000000000000..7745054a05ca --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/sensors.conf @@ -0,0 +1,79 @@ +# libsensors configuration file +# ---------------------------------------------- +# + +bus "i2c-2" "SCD SMBus master 0 bus 0" +bus "i2c-3" "SCD SMBus master 0 bus 1" +bus "i2c-5" "SCD SMBus master 0 bus 3" +bus "i2c-6" "SCD SMBus master 0 bus 4" +bus "i2c-7" "SCD SMBus master 0 bus 5" + +chip "k10temp-pci-00c3" + label temp1 "Cpu temp sensor" + +chip "lm73-i2c-3-48" + label temp1 "Rear Temp Sensor" + set temp1_max 65 + #set temp1_max_alarm 75 # read-only + +chip "lm86-i2c-2-4c" + label temp1 "Board Temp Sensor" + set temp1_max 65 + set temp1_crit 75 + + label temp2 "Front-panel Temp Sensor" + set temp2_max 65 + set temp2_crit 75 + +chip "pmbus-i2c-3-4e" + label temp1 "Power Controller Sensor 1" + set temp1_max 60 + set temp1_crit 70 + + label temp2 "Power Controller Sensor 2" + set temp2_max 60 + set temp2_crit 70 + + ignore curr1 + +chip "pmbus-i2c-5-58" + label temp1 "Power Supply 1 Sensor 1" + set temp1_max 60 + set temp1_crit 70 + + label temp2 "Power Supply 1 Sensor 2" + set temp2_max 60 + set temp2_crit 70 + + ignore temp3 + + set in1_max 250 + set in1_crit 255 + set power1_max 525 + set power2_max 460 + set power2_crit 462 + set curr1_max 5.28 + set curr1_crit 5.30 + set curr2_max 36 + set curr2_crit 37 + +chip "pmbus-i2c-6-58" + label temp1 "Power Supply 2 Sensor 1" + set temp1_max 60 + set temp1_crit 70 + + label temp2 "Power Supply 2 Sensor 2" + set temp2_max 60 + set temp2_crit 70 + + ignore temp3 + + set in1_max 250 + set in1_crit 255 + set power1_max 525 + set power2_max 460 + set power2_crit 462 + set curr1_max 5.28 + set curr1_crit 5.30 + set curr2_max 36 + set curr2_crit 37 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini new file mode 100644 index 000000000000..414fb94efbc1 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 33,34,35,36 Ethernet1/1 +Ethernet4 37,38,39,40 Ethernet2/1 +Ethernet8 41,42,43,44 Ethernet3/1 +Ethernet12 45,46,47,48 Ethernet4/1 +Ethernet16 49,50,51,52 Ethernet5/1 +Ethernet20 53,54,55,56 Ethernet6/1 +Ethernet24 57,58,59,60 Ethernet7/1 +Ethernet28 61,62,63,64 Ethernet8/1 +Ethernet32 65,66,67,68 Ethernet9/1 +Ethernet36 69,70,71,72 Ethernet10/1 +Ethernet40 73,74,75,76 Ethernet11/1 +Ethernet44 77,78,79,80 Ethernet12/1 +Ethernet48 81,82,83,84 Ethernet13/1 +Ethernet52 85,86,87,88 Ethernet14/1 +Ethernet56 89,90,91,92 Ethernet15/1 +Ethernet60 93,94,95,96 Ethernet16/1 +Ethernet64 97,98,99,100 Ethernet17/1 +Ethernet68 101,102,103,104 Ethernet18/1 +Ethernet72 105,106,107,108 Ethernet19/1 +Ethernet76 109,110,111,112 Ethernet20/1 +Ethernet80 113,114,115,116 Ethernet21/1 +Ethernet84 117,118,119,120 Ethernet22/1 +Ethernet88 121,122,123,124 Ethernet23/1 +Ethernet92 125,126,127,128 Ethernet24/1 +Ethernet96 1,2,3,4 Ethernet25/1 +Ethernet100 5,6,7,8 Ethernet26/1 +Ethernet104 9,10,11,12 Ethernet27/1 +Ethernet108 13,14,15,16 Ethernet28/1 +Ethernet112 17,18,19,20 Ethernet29/1 +Ethernet116 21,22,23,24 Ethernet30/1 +Ethernet120 25,26,27,28 Ethernet31/1 +Ethernet124 29,30,31,32 Ethernet32/1 diff --git a/device/arista/x86_64-arista_7060_cx32s/sensors.conf b/device/arista/x86_64-arista_7060_cx32s/sensors.conf new file mode 100644 index 000000000000..3b4dd2385322 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/sensors.conf @@ -0,0 +1,47 @@ +# libsensors configuration file for DCS-7060CX-32S +# ------------------------------------------------ +# + +bus "i2c-2" "SCD SMBus master 0 bus 0" +bus "i2c-3" "SCD SMBus master 0 bus 1" +bus "i2c-5" "SCD SMBus master 0 bus 3" +bus "i2c-6" "SCD SMBus master 0 bus 4" +bus "i2c-7" "SCD SMBus master 0 bus 5" + +chip "k10temp-pci-00c3" + label temp1 "Cpu temp sensor" + +# missing support for +# chip "max6697-i2c-2-1a" +# board sensor 65 75 +# (1) switch chip left sensor 95 105 +# (5) switch chip right sensor 95 105 +# (6) front panel temp sensor 65 75 + +chip "max6658-i2c-3-4c" + label temp1 "Cpu board temp sensor" + set temp1_max 75 + set temp1_crit 80 + + label temp2 "Back panel temp sensor" + set temp2_max 75 + set temp2_crit 80 + +chip "pmbus-i2c-3-4e" + label temp1 "Power controller 1 sensor 1" + label temp2 "Power controller 1 sensor 2" + +chip "pmbus-i2c-7-4e" + label temp1 "Power controller 2 sensor 1" + label temp2 "Power controller 2 sensor 2" + +chip "pmbus-i2c-6-58" + label temp1 "Power supply 1 hotspot sensor" + label temp2 "Power supply 1 inlet temp sensor" + label temp3 "Power supply 1 sensor" + +chip "pmbus-i2c-5-58" + label temp1 "Power supply 2 hotspot sensor" + label temp2 "Power supply 2 inlet temp sensor" + label temp3 "Power supply 2 sensor" + diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/port_config.ini b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/port_config.ini new file mode 100644 index 000000000000..06898f1d7964 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 29,30,31,32 fortyGigE0/0 +Ethernet4 25,26,27,28 fortyGigE0/4 +Ethernet8 37,38,39,40 fortyGigE0/8 +Ethernet12 33,34,35,36 fortyGigE0/12 +Ethernet16 41,42,43,44 fortyGigE0/16 +Ethernet20 45,46,47,48 fortyGigE0/20 +Ethernet24 5,6,7,8 fortyGigE0/24 +Ethernet28 1,2,3,4 fortyGigE0/28 +Ethernet32 9,10,11,12 fortyGigE0/32 +Ethernet36 13,14,15,16 fortyGigE0/36 +Ethernet40 21,22,23,24 fortyGigE0/40 +Ethernet44 17,18,19,20 fortyGigE0/44 +Ethernet48 49,50,51,52 fortyGigE0/48 +Ethernet52 53,54,55,56 fortyGigE0/52 +Ethernet56 61,62,63,64 fortyGigE0/56 +Ethernet60 57,58,59,60 fortyGigE0/60 +Ethernet64 65,66,67,68 fortyGigE0/64 +Ethernet68 69,70,71,72 fortyGigE0/68 +Ethernet72 77,78,79,80 fortyGigE0/72 +Ethernet76 73,74,75,76 fortyGigE0/76 +Ethernet80 105,106,107,108 fortyGigE0/80 +Ethernet84 109,110,111,112 fortyGigE0/84 +Ethernet88 117,118,119,120 fortyGigE0/88 +Ethernet92 113,114,115,116 fortyGigE0/92 +Ethernet96 121,122,123,124 fortyGigE0/96 +Ethernet100 125,126,127,128 fortyGigE0/100 +Ethernet104 85,86,87,88 fortyGigE0/104 +Ethernet108 81,82,83,84 fortyGigE0/108 +Ethernet112 89,90,91,92 fortyGigE0/112 +Ethernet116 93,94,95,96 fortyGigE0/116 +Ethernet120 97,98,99,100 fortyGigE0/120 +Ethernet124 101,102,103,104 fortyGigE0/124 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile new file mode 100644 index 000000000000..b64d997fb451 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/td2-s6000-32x40G.config.bcm diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/eeprom.py b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/eeprom.py new file mode 100644 index 000000000000..f08c5ba52cec --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/eeprom.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python + +############################################################################# +# Dell S6000 +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + import subprocess + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 128 + _TLV_HDR_ENABLED = 0 + + _TLV_BLOCK_NUMBER = 3 + _TLV_BLOCK_HDR_STRING = "\x3a\x29" + + _TLV_CODE_MFG = 0x20 + _TLV_CODE_SW = 0x1f + _TLV_CODE_MAC = 0x21 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-10/10-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + + def decode_eeprom(self, e): + tlv_block_index = 0 + tlv_index = self.eeprom_start + tlv_end = self._TLV_INFO_MAX_LEN + + print "TLV Name Len Value" + print "-------------------- --- -----" + while tlv_block_index < self._TLV_BLOCK_NUMBER: + if not self.is_valid_block(e[tlv_index:]): + print "Invalid TLV field starting at EEPROM offset %d" % (tlv_index,) + return + print self.decoder(None, e[tlv_index:tlv_index + ord(e[tlv_index+2])]) + if not self.is_valid_block_checksum(e[tlv_index:tlv_index + ord(e[tlv_index+2])]): + print "(*** checksum invalid)" + tlv_index += ord(e[tlv_index+2]) + tlv_block_index += 1 + + def is_valid_block(self, e): + return (len(e) >= 8 and ord(e[2]) <= len(e) and \ + e[0:2] == self._TLV_BLOCK_HDR_STRING) + + def is_valid_block_checksum(self, e): + crc = self.compute_dell_crc(e[:-2]) + tlv_crc = ord(e[-1]) << 8 | ord(e[-2]) + return crc == tlv_crc + + def decoder(self, s, t): + ret = "" + if ord(t[4]) == self._TLV_CODE_MFG: + name = "PPID" + value = t[6:8] + "-" + t[8:14] + "-" + t[14:19] + "-" + \ + t[19:22] + "-" + t[22:26] + ret += "%-20s %3d %s\n" % (name, 20, value) + name = "DPN Rev" + ret += "%-20s %3d %s\n" % (name, 3, t[26:29]) + name = "Service Tag" + ret += "%-20s %3d %s\n" % (name, 7, t[29:36]) + name = "Part Number" + ret += "%-20s %3d %s\n" % (name, 10, t[36:46]) + name = "Part Number Rev" + ret += "%-20s %3d %s\n" % (name, 3, t[46:49]) + name = "Mfg Test Results" + ret += "%-20s %3d %s" % (name, 2, t[49:51]) + if ord(t[4]) == self._TLV_CODE_SW: + name = "Card ID" + ret += "%-20s %3d 0x%s\n" % (name, 2, t[6:8].encode('hex')) + name = "Module ID" + ret += "%-20s %3d %s" % (name, 2, ord(t[8:9])) + if ord(t[4]) == self._TLV_CODE_MAC: + name = "Base MAC Address" + value = ":".join([binascii.b2a_hex(T) for T in t[6:12]]).upper() + ret += "%-20s %3d %s" % (name, 12, value) + return ret + + def is_checksum_valid(self, e): + # Checksum is already calculated before + return (True, 0) + + def get_tlv_index(self, e, code): + tlv_index = 0 + while tlv_index < len(e): + if not self.is_valid_block(e[tlv_index:]): + return (False, 0) + if ord(e[tlv_index+4]) == code: + if not self.is_valid_block_checksum(e[tlv_index:tlv_index + ord(e[tlv_index+2])]): + print "(*** checksum invalid)" + return (True, tlv_index) + tlv_index += ord(e[tlv_index+2]) + return (Flase, 0) + + def base_mac_addr(self, e): + (is_valid, t) = self.get_tlv_index(e, self._TLV_CODE_MAC) + if not is_valid: + return "Bad base MAC address" + return ":".join([binascii.b2a_hex(T) for T in e[t:][6:12]]).upper() + + def serial_number_str(self, e): + ''' Return Service Tag ''' + (is_valid, t) = self.get_tlv_index(e, self._TLV_CODE_MFG) + if not is_valid: + return "Bad service tag" + t = e[t:] + return t[29:36] diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py new file mode 100644 index 000000000000..8b1ec277d79f --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + eeprom_offset = 20 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf b/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf new file mode 100644 index 000000000000..2208bb6340d1 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf @@ -0,0 +1,57 @@ +# libsensors configuration file +# -------------------------------------------------- +# + +# tmp75-i2c-11-4c has sensors close to Networking ASIC. +# tmp75-i2c-11-4d has sensors close to NIC. +# tmp75-i2c-11-4e is an ambient temperature sensor. + +chip "tmp75-*" + set temp1_max 50 + set temp1_max_hyst 25 + +# emc1403-i2c-10-4d has following temperature sensors: +# temp1: CPU0 external Temp Sensor +# temp2: CPU1 external Temp Sensor +# temp3: CPU Internal DTS (Internal die, max of all die readings) + +chip "emc1403-*" + set temp1_crit 85 + set temp1_max 50 + set temp2_crit 85 + set temp2_max 50 + set temp3_crit 85 + set temp3_max 50 + +chip "max6620-i2c-*-2a" + ignore fan3 + ignore fan4 + +chip "w83627dhg-*" + label in0 "VCore 1" + label in1 "VCore 2" + set in0_min 0 + set in0_max 1.74 + set in1_min 0 + set in1_max 1.74 + ignore fan1 + ignore fan2 + ignore fan3 + ignore fan4 + ignore fan5 + ignore in4 + ignore in5 + ignore in6 + ignore temp1 + ignore temp2 + ignore temp3 + ignore cpu0_vid + ignore intrusion0 + +chip "jc42-*" + set temp1_max 50 + set temp1_crit 85 + +chip "dni_dps460-*" + set temp1_max 50 + set temp2_max 50 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini new file mode 100644 index 000000000000..dcdd6548c198 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias +Ethernet0 101,102 fortyGigE1/1/1 +Ethernet1 103,104 fortyGigE1/1/2 +Ethernet2 97,98 fortyGigE1/1/3 +Ethernet3 99,100 fortyGigE1/1/4 +Ethernet4 69,70 fortyGigE1/1/5 +Ethernet5 71,72 fortyGigE1/1/6 +Ethernet6 65,66 fortyGigE1/1/7 +Ethernet7 67,68 fortyGigE1/1/8 +Ethernet8 53,54 fortyGigE1/1/9 +Ethernet9 55,56 fortyGigE1/1/10 +Ethernet10 49,50 fortyGigE1/1/11 +Ethernet11 51,52 fortyGigE1/1/12 +Ethernet12 21,22 fortyGigE1/1/13 +Ethernet13 23,24 fortyGigE1/1/14 +Ethernet14 17,18 fortyGigE1/1/15 +Ethernet15 19,20 fortyGigE1/1/16 +Ethernet16 25,26 fortyGigE1/2/1 +Ethernet17 27,28 fortyGigE1/2/2 +Ethernet18 29,30 fortyGigE1/2/3 +Ethernet19 31,32 fortyGigE1/2/4 +Ethernet20 57,58 fortyGigE1/2/5 +Ethernet21 59,60 fortyGigE1/2/6 +Ethernet22 61,62 fortyGigE1/2/7 +Ethernet23 63,64 fortyGigE1/2/8 +Ethernet24 73,74 fortyGigE1/2/9 +Ethernet25 75,76 fortyGigE1/2/10 +Ethernet26 77,78 fortyGigE1/2/11 +Ethernet27 79,80 fortyGigE1/2/12 +Ethernet28 105,106 fortyGigE1/2/13 +Ethernet29 107,108 fortyGigE1/2/14 +Ethernet30 109,110 fortyGigE1/2/15 +Ethernet31 111,112 fortyGigE1/2/16 +Ethernet32 13,14 fortyGigE1/3/1 +Ethernet33 15,16 fortyGigE1/3/2 +Ethernet34 9,10 fortyGigE1/3/3 +Ethernet35 11,12 fortyGigE1/3/4 +Ethernet36 125,126 fortyGigE1/3/5 +Ethernet37 127,128 fortyGigE1/3/6 +Ethernet38 121,122 fortyGigE1/3/7 +Ethernet39 123,124 fortyGigE1/3/8 +Ethernet40 93,94 fortyGigE1/3/9 +Ethernet41 95,96 fortyGigE1/3/10 +Ethernet42 89,90 fortyGigE1/3/11 +Ethernet43 91,92 fortyGigE1/3/12 +Ethernet44 45,46 fortyGigE1/3/13 +Ethernet45 47,48 fortyGigE1/3/14 +Ethernet46 41,42 fortyGigE1/3/15 +Ethernet47 43,44 fortyGigE1/3/16 +Ethernet48 113,114 fortyGigE1/4/1 +Ethernet49 115,116 fortyGigE1/4/2 +Ethernet50 117,118 fortyGigE1/4/3 +Ethernet51 119,120 fortyGigE1/4/4 +Ethernet52 1,2 fortyGigE1/4/5 +Ethernet53 3,4 fortyGigE1/4/6 +Ethernet54 5,6 fortyGigE1/4/7 +Ethernet55 7,8 fortyGigE1/4/8 +Ethernet56 33,34 fortyGigE1/4/9 +Ethernet57 35,36 fortyGigE1/4/10 +Ethernet58 37,38 fortyGigE1/4/11 +Ethernet59 39,40 fortyGigE1/4/12 +Ethernet60 81,82 fortyGigE1/4/13 +Ethernet61 83,84 fortyGigE1/4/14 +Ethernet62 85,86 fortyGigE1/4/15 +Ethernet63 87,88 fortyGigE1/4/16 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile new file mode 100644 index 000000000000..ee286905f907 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G.config.bcm diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py new file mode 100644 index 000000000000..534e587ae722 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 63 + ports_in_block = 64 + + eeprom_offset = 18 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini new file mode 100644 index 000000000000..d2b36ebf5e2a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 5,6,7,8 Ethernet0 +Ethernet4 1,2,3,4 Ethernet4 +Ethernet8 13,14,15,16 Ethernet8 +Ethernet12 9,10,11,12 Ethernet12 +Ethernet16 21,22,23,24 Ethernet16 +Ethernet20 17,18,19,20 Ethernet20 +Ethernet24 29,30,31,32 Ethernet24 +Ethernet28 25,26,27,28 Ethernet28 +Ethernet32 37,38,39,40 Ethernet32 +Ethernet36 33,34,35,36 Ethernet36 +Ethernet40 45,46,47,48 Ethernet40 +Ethernet44 41,42,43,44 Ethernet44 +Ethernet48 53,54,55,56 Ethernet48 +Ethernet52 49,50,51,52 Ethernet52 +Ethernet56 61,62,63,64 Ethernet56 +Ethernet60 57,58,59,60 Ethernet60 +Ethernet64 69,70,71,72 Ethernet64 +Ethernet68 65,66,67,68 Ethernet68 +Ethernet72 77,78,79,80 Ethernet72 +Ethernet76 73,74,75,76 Ethernet76 +Ethernet80 85,86,87,88 Ethernet80 +Ethernet84 81,82,83,84 Ethernet84 +Ethernet88 93,94,95,96 Ethernet88 +Ethernet92 89,90,91,92 Ethernet92 +Ethernet96 101,102,103,104 Ethernet96 +Ethernet100 97,98,99,100 Ethernet100 +Ethernet104 109,110,111,112 Ethernet104 +Ethernet108 105,106,107,108 Ethernet108 +Ethernet112 117,118,119,120 Ethernet112 +Ethernet116 113,114,115,116 Ethernet116 +Ethernet120 125,126,127,128 Ethernet120 +Ethernet124 121,122,123,124 Ethernet124 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf new file mode 100644 index 000000000000..44eedb4b11b0 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf @@ -0,0 +1,35 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + label temp1 "DIMM Temp" + set temp1_max 50 + set temp1_crit 85 + +chip "w83795adg-*" + label in0 "1.0V" + label in1 "1.0V_ROV" + label in2 "1.25V" + label in3 "1.8V" + ignore in4 + ignore in5 + ignore in6 + ignore in7 + label in12 "+3.3V" + ignore in14 + ignore in15 + ignore in16 + label fan1 "FANTRAY 1-A" + label fan2 "FANTRAY 1-B" + label fan3 "FANTRAY 2-A" + label fan4 "FANTRAY 2-B" + label fan5 "FANTRAY 3-A" + label fan6 "FANTRAY 3-B" + label fan7 "FANTRAY 4-A" + label fan8 "FANTRAY 4-B" + label temp1 "Front MAC Temp" + label temp2 "Rear MAC Temp" + ignore temp3 + ignore temp4 + ignore intrusion0 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini new file mode 100644 index 000000000000..816bb0e94a70 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 0,1,2,3 +Ethernet4 4,5,6,7 +Ethernet8 8,9,10,11 +Ethernet12 12,13,14,15 +Ethernet16 16,17,18,19 +Ethernet20 20,21,22,23 +Ethernet24 24,25,26,27 +Ethernet28 28,29,30,31 +Ethernet32 32,33,34,35 +Ethernet36 36,37,38,39 +Ethernet40 40,41,42,43 +Ethernet44 44,45,46,47 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 64,65,66,67 +Ethernet68 68,69,70,71 +Ethernet72 72,73,74,75 +Ethernet76 76,77,78,79 +Ethernet80 80,81,82,83 +Ethernet84 84,85,86,87 +Ethernet88 88,89,90,91 +Ethernet92 92,93,94,95 +Ethernet96 96,97,98,99 +Ethernet100 100,101,102,103 +Ethernet104 104,105,106,107 +Ethernet108 108,109,110,111 +Ethernet112 112,113,114,115 +Ethernet116 116,117,118,119 +Ethernet120 120,121,122,123 +Ethernet124 124,125,126,127 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile new file mode 100644 index 000000000000..9a9a38aeb068 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sai_2700.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py new file mode 100644 index 000000000000..a9e22e3e698c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + import eeprom_base + import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/bsp/eeprom/sys_eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py new file mode 100644 index 000000000000..04e9a4eff85e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -0,0 +1,28 @@ +#! /usr/bin/python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + eeprom_offset = 1 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/bsp/qsfp/qsfp{0}' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf new file mode 100644 index 000000000000..a3e30391863e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf @@ -0,0 +1,21 @@ +bus "i2c-7" "i2c-1-mux (chan_id 5)" +chip "lm75-i2c-7-4a" + label temp1 "Ambient Port Temp" + +bus "i2c-5" "i2c-1-mux (chan_id 3)" +chip "ucd9200-i2c-5-27" + label in1 "UCD1 vin" + label in2 "ASIC 3.3 vout" + label in3 "ASIC 1.2 vout" + label temp1 "UCD1 Temp" + label temp2 "UCD1 Temp2" + +chip "ucd9200-i2c-5-41" + label in1 "UCD2 vin" + label in2 "ASIC Vcore vout" + label temp1 "UCD2 Temp1" + label temp2 "UCD2 Temp2" + +bus "i2c-17" "i2c-1-mux (chan_id 7)" +chip "lm75-i2c-17-49" + label temp1 "Ambient Board Temp" diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 6f604c63aefb..5a753471911d 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -1,11 +1,18 @@ #!/bin/bash +# Obtain our platform and HWSKU as we will mount directories with these names in each docker +PLATFORM=`/usr/bin/sonic-cfggen -v platform` +HWSKU=`/usr/bin/sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` + start() { docker inspect --type container {{docker_container_name}} &>/dev/null if [ "$?" -eq "0" ]; then docker start -a {{docker_container_name}} else - docker run {{docker_image_run_opt}} --name={{docker_container_name}} {{docker_image_name}} + docker run {{docker_image_run_opt}} \ + -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ + -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ + --name={{docker_container_name}} {{docker_image_name}} fi } diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index f69d9ff87372..c02263d3e37e 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -34,45 +34,44 @@ sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs sudo chroot $FILESYSTEM_ROOT service docker start sudo chroot $FILESYSTEM_ROOT docker version -# Install config engine dependencies -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ - python-lxml \ - python-jinja2 \ - python-netaddr \ - python-ipaddr \ - python-yaml - -sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} - -# Python tabulate required for sonic-utilities -python_tabulate_url=http://packages.microsoft.com/repos/sonic-dev/pool/main/p/python-tabulate/python-tabulate_0.7.7-1_all.deb -python_template_deb_temp=`mktemp` -trap_push "rm -f $python_template_deb_temp" -wget $python_tabulate_url -qO $python_template_deb_temp && { \ - sudo dpkg --root=$FILESYSTEM_ROOT -i $python_template_deb_temp || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f; \ -} - -# Sonic utilities -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-utilities_*.deb || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f - -# Create all needed directories -sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ -sudo mkdir -p $FILESYSTEM_ROOT/usr/share/sonic/templates/ - # Apply apt configuration files sudo cp $IMAGE_CONFIGS/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ sudo cp -R $IMAGE_CONFIGS/apt/sources.list.d/ $FILESYSTEM_ROOT/etc/apt/ cat $IMAGE_CONFIGS/apt/sonic-dev.gpg.key | sudo LANG=C chroot $FILESYSTEM_ROOT apt-key add - +# Update apt's snapshot of its repos +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get update + # Apply environtment configuration files sudo cp $IMAGE_CONFIGS/environment/environment $FILESYSTEM_ROOT/etc/ sudo cp $IMAGE_CONFIGS/environment/motd $FILESYSTEM_ROOT/etc/ +# Create all needed directories +sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ +sudo mkdir -p $FILESYSTEM_ROOT/usr/share/sonic/templates/ + # Copy default minigraph sudo cp $IMAGE_CONFIGS/minigraph/minigraph_{{sonic_hwsku}}.xml $FILESYSTEM_ROOT/etc/sonic/minigraph.xml +# Install dependencies for SONiC config engine +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ + python-lxml \ + python-jinja2 \ + python-netaddr \ + python-ipaddr \ + python-yaml + +# Install SONiC config engine +sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} + +# Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + +# Install SONiC Device Data (and its dependencies via 'apt-get -y install -f') +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-device-data_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # Copy NTP configuration files and templates sudo cp $IMAGE_CONFIGS/ntp/ntp-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.service diff --git a/rules/sonic-device-data.mk b/rules/sonic-device-data.mk new file mode 100644 index 000000000000..abf7d0501f93 --- /dev/null +++ b/rules/sonic-device-data.mk @@ -0,0 +1,10 @@ +# sonic-device-data Debian package + +SONIC_DEVICE_DATA_VERSION = 1.0 +SONIC_DEVICE_DATA_VERSION_FULL = $(SONIC_DEVICE_DATA_VERSION)-1 + +export SONIC_DEVICE_DATA_VERSION SONIC_DEVICE_DATA_VERSION_FULL + +SONIC_DEVICE_DATA = sonic-device-data_$(SONIC_DEVICE_DATA_VERSION_FULL)_all.deb +$(SONIC_DEVICE_DATA)_SRC_PATH = $(SRC_PATH)/sonic-device-data +SONIC_MAKE_DEBS += $(SONIC_DEVICE_DATA) diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 7f40cdc93c6c..7377ed50cbca 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -1,5 +1,5 @@ # sonic utilities package -SONIC_UTILS = sonic-utilities_0.1_amd64.deb +SONIC_UTILS = python-sonic-utilities_1.0-1_all.deb $(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities -SONIC_DPKG_DEBS += $(SONIC_UTILS) +SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS) diff --git a/slave.mk b/slave.mk index 9a31aadf11f5..a77c2f9818f5 100644 --- a/slave.mk +++ b/slave.mk @@ -286,7 +286,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_UTILS)) $(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_CONFIG_ENGINE) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $(HEADER) ## Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 79496eee4e89..aece9dee8a50 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -299,10 +299,10 @@ def get_mgmt_info(devices, dev, port): def get_alias_map_list(hwsku, platform=None): port_config_candidates = [] - port_config_candidates.append('/usr/share/sonic/sku/port_config.ini') + port_config_candidates.append('/usr/share/sonic/hwsku/port_config.ini') if platform != None: port_config_candidates.append(os.path.join('/usr/share/sonic/device', platform, hwsku, 'port_config.ini')) - port_config_candidates.append(os.path.join('/usr/share/sonic/device', hwsku, 'port_config.ini')) + port_config_candidates.append(os.path.join('/usr/share/sonic/platform', hwsku, 'port_config.ini')) port_config_candidates.append(os.path.join('/usr/share/sonic', hwsku, 'port_config.ini')) port_config = None for candidate in port_config_candidates: diff --git a/src/sonic-device-data/LICENSE b/src/sonic-device-data/LICENSE new file mode 100644 index 000000000000..2ff086dedcdd --- /dev/null +++ b/src/sonic-device-data/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2017 Microsoft + +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/src/sonic-device-data/MAINTAINERS b/src/sonic-device-data/MAINTAINERS new file mode 100644 index 000000000000..fde1eede3214 --- /dev/null +++ b/src/sonic-device-data/MAINTAINERS @@ -0,0 +1,7 @@ +# This file describes the maintainers for sonic-device-data +# See the SONiC project governance document for more information + +Name = "Joe LeVeque" +Email = "jolevequ@microsoft.com" +Github = jleveque +Mailinglist = sonicproject@googlegroups.com diff --git a/src/sonic-device-data/Makefile b/src/sonic-device-data/Makefile new file mode 100644 index 000000000000..dc45dc6bff9f --- /dev/null +++ b/src/sonic-device-data/Makefile @@ -0,0 +1,22 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = sonic-device-data_$(SONIC_DEVICE_DATA_VERSION_FULL)_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + pushd ./src + + # Remove any stale data + rm -rf ./device + + # Create a new dir and copy all ONIE-platform-string-named dirs into it + mkdir ./device + cp -r ../../../device/*/* ./device/ + + # Build the package + dpkg-buildpackage -rfakeroot -b -us -uc + + popd + + mv $* $(DEST)/ diff --git a/src/sonic-device-data/README.md b/src/sonic-device-data/README.md new file mode 100644 index 000000000000..e8ccad58b819 --- /dev/null +++ b/src/sonic-device-data/README.md @@ -0,0 +1,4 @@ +# sonic-device-data +Device-specific data for the SONiC project + +See the [SONiC Website](http://azure.github.io/SONiC/) for more information about the SONiC project. diff --git a/src/sonic-device-data/src/debian/changelog b/src/sonic-device-data/src/debian/changelog new file mode 100644 index 000000000000..9cf0041aa890 --- /dev/null +++ b/src/sonic-device-data/src/debian/changelog @@ -0,0 +1,5 @@ +sonic-device-data (1.0-1) UNRELEASED; urgency=low + + * Initial release. (Closes: #XXXXXX) + + -- Joe LeVeque Tue, 20 Feb 2017 14:00:00 -0700 diff --git a/src/sonic-device-data/src/debian/compat b/src/sonic-device-data/src/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/src/sonic-device-data/src/debian/compat @@ -0,0 +1 @@ +9 diff --git a/src/sonic-device-data/src/debian/control b/src/sonic-device-data/src/debian/control new file mode 100644 index 000000000000..a9969efc4b84 --- /dev/null +++ b/src/sonic-device-data/src/debian/control @@ -0,0 +1,11 @@ +Source: sonic-device-data +Maintainer: Joe LeVeque +Section: misc +Priority: optional +Standards-Version: 0.1 +Build-Depends: debhelper (>=9) + +Package: sonic-device-data +Architecture: all +Depends: ${misc:Depends} +Description: Device-specific data files for SONiC diff --git a/src/sonic-device-data/src/debian/copyright b/src/sonic-device-data/src/debian/copyright new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/src/sonic-device-data/src/debian/install b/src/sonic-device-data/src/debian/install new file mode 100644 index 000000000000..707d39adfccb --- /dev/null +++ b/src/sonic-device-data/src/debian/install @@ -0,0 +1 @@ +device/ usr/share/sonic/ diff --git a/src/sonic-device-data/src/debian/rules b/src/sonic-device-data/src/debian/rules new file mode 100755 index 000000000000..e91562ccbb5a --- /dev/null +++ b/src/sonic-device-data/src/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f + +build: + +%: + dh $@ + diff --git a/src/sonic-utilities b/src/sonic-utilities index be32ae1646ce..07a8b3ab377f 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit be32ae1646ce3f98e6fbe15f70aa0629fba0735c +Subproject commit 07a8b3ab377f4ceb2ad84c82dcdbb0e592a70b4c From b9b7d7a29590c9db1c3dd04cc5e55a6edc99fd0e Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 27 Feb 2017 13:08:41 -0800 Subject: [PATCH 0314/1833] [installer]: support platform driver lazy installation (#340) allow one image to support multiple switch devices, install corresponding platform driver during the first boot time. --- build_debian.sh | 11 +++-- .../build_templates/sonic_debian_extension.j2 | 40 +++++++++++++++++-- files/image_config/platform/rc.local | 25 ++++++++++++ platform/broadcom/one-image.mk | 5 ++- platform/broadcom/platform-modules-dell.mk | 1 + .../platform-modules-ingrasys-s9100.mk | 1 + platform/broadcom/platform-modules-s6000.mk | 1 + slave.mk | 3 +- 8 files changed, 77 insertions(+), 10 deletions(-) create mode 100755 files/image_config/platform/rc.local diff --git a/build_debian.sh b/build_debian.sh index 2d6cc35533f6..16f31f980ada 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -37,6 +37,7 @@ DOCKER_VERSION=1.11.1-0~jessie_amd64 ## Working directory to prepare the file system FILESYSTEM_ROOT=./fsroot +PLATFORM_DIR=platform ## Hostname for the linux image HOSTNAME=sonic DEFAULT_USERINFO="Default admin user,,," @@ -61,6 +62,8 @@ if [[ -d $FILESYSTEM_ROOT ]]; then sudo rm -rf $FILESYSTEM_ROOT || die "Failed to clean chroot directory" fi mkdir -p $FILESYSTEM_ROOT +mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR +touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime ## Build a basic Debian system by debootstrap echo '[INFO] Debootstrap...' @@ -247,7 +250,7 @@ sudo cp files/dhcp/snmpcommunity $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d sudo cp files/dhcp/dhclient.conf $FILESYSTEM_ROOT/etc/dhcp/ if [ -f sonic_debian_extension.sh ]; then - ./sonic_debian_extension.sh $FILESYSTEM_ROOT + ./sonic_debian_extension.sh $FILESYSTEM_ROOT $PLATFORM_DIR fi ## Clean up apt @@ -268,11 +271,11 @@ sudo mkdir $FILESYSTEM_ROOT/host sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS ## Output the file system total size for diag purpose sudo du -hs $FILESYSTEM_ROOT -sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker +sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker -e $PLATFORM_DIR ## Compress docker files pushd $FILESYSTEM_ROOT && sudo tar czf $OLDPWD/$FILESYSTEM_DOCKERFS -C var/lib/docker .; popd -## Compress together with /boot and /var/lib/docker as an installer payload zip file -pushd $FILESYSTEM_ROOT && sudo zip $OLDPWD/$ONIE_INSTALLER_PAYLOAD -r boot/; popd +## Compress together with /boot, /var/lib/docker and $PLATFORM_DIR as an installer payload zip file +pushd $FILESYSTEM_ROOT && sudo zip $OLDPWD/$ONIE_INSTALLER_PAYLOAD -r boot/ $PLATFORM_DIR/; popd sudo zip -g $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS $FILESYSTEM_DOCKERFS diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index c02263d3e37e..08aaae769fa8 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -4,7 +4,7 @@ ## to debian file system. ## ## USAGE: -## ./sonic_debian_extension.sh FILESYSTEM_ROOT +## ./sonic_debian_extension.sh FILESYSTEM_ROOT PLATFORM_DIR ## PARAMETERS: ## FILESYSTEM_ROOT ## Path to debian file system root directory @@ -15,6 +15,12 @@ FILESYSTEM_ROOT=$1 exit 1 } +PLATFORM_DIR=$2 +[ -n "$PLATFORM_DIR" ] || { + echo "Error: no or empty PLATFORM_DIR argument" + exit 1 +} + ## Enable debug output for script set -x -e @@ -22,7 +28,6 @@ set -x -e BUILD_TEMPLATES=files/build_templates IMAGE_CONFIGS=files/image_config -{% if installer_debs.strip() -%} clean_sys() { sudo umount $FILESYSTEM_ROOT/sys/fs/cgroup/* \ $FILESYSTEM_ROOT/sys/fs/cgroup \ @@ -130,6 +135,7 @@ exit 101 EOF sudo chmod a+x $FILESYSTEM_ROOT/usr/sbin/policy-rc.d +{% if installer_debs.strip() -%} {% for deb in installer_debs.strip().split(' ') -%} if [ $sonic_asic_platform == "mellanox" ]; then sudo dpkg --extract {{deb}} $FILESYSTEM_ROOT @@ -137,12 +143,38 @@ else sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f fi {% endfor %} - -sudo rm -f $FILESYSTEM_ROOT/usr/sbin/policy-rc.d +{% endif %} ## Run depmod command for target kernel modules sudo LANG=C chroot $FILESYSTEM_ROOT depmod -a {{kversion}} + +## download all dependency packages for platform debian packages +{% if lazy_installer_debs.strip() -%} +{% for file in lazy_installer_debs.strip().split(' ') -%} + +{% set dev = file.split('@')[0] -%} +{% set deb = file.split('@')[1] -%} +{% set debfilename = deb.split('/')|last -%} +{% set debname = debfilename.split('_')|first -%} + +sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f --download-only + +sudo mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}} +sudo cp {{ deb }} $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/ +for f in `find $FILESYSTEM_ROOT/var/cache/apt/archives -name "*.deb"`; do + sudo mv $f $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/ +done + +sudo dpkg --root=$FILESYSTEM_ROOT -P {{ debname }} + +{% endfor %} {% endif %} + +sudo rm -f $FILESYSTEM_ROOT/usr/sbin/policy-rc.d + +## copy platform rc.local +sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/ + {% if installer_images.strip() -%} {% for image in installer_images.strip().split(' ') -%} sudo LANG=C chroot $FILESYSTEM_ROOT docker load < {{image}} diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local new file mode 100755 index 000000000000..dc5507fe234b --- /dev/null +++ b/files/image_config/platform/rc.local @@ -0,0 +1,25 @@ +#!/bin/sh -e +# +# rc.local +# +# This script is executed at the end of each multiuser runlevel. +# Make sure that the script will "exit 0" on success or any other +# value on error. +# +# In order to enable or disable this script just change the execution +# bits. +# +# By default this script does nothing. + +. /host/machine.conf + +echo "install platform dependent packages at the first boot time" + +if [ -f /host/platform/firsttime ]; then + if [ -d /host/platform/$onie_platform ]; then + dpkg -i /host/platform/$onie_platform/*.deb + fi + rm /host/platform/firsttime +fi + +exit 0 diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 59939fb72e7c..4558d6669d09 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -3,6 +3,9 @@ SONIC_ONE_IMAGE = sonic-broadcom.bin $(SONIC_ONE_IMAGE)_MACHINE = broadcom $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) $(DELL_S6000_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) +$(SONIC_ONE_IMAGE)_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ + $(DELL_Z9100_PLATFORM_MODULE) \ + $(INGRASYS_S9100_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-dell.mk b/platform/broadcom/platform-modules-dell.mk index 36ca217f56ca..ce4c29651c4f 100644 --- a/platform/broadcom/platform-modules-dell.mk +++ b/platform/broadcom/platform-modules-dell.mk @@ -7,4 +7,5 @@ export DELL_Z9100_PLATFORM_MODULE_VERSION DELL_Z9100_PLATFORM_MODULE = platform-modules-z9100_$(DELL_Z9100_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_Z9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-dell $(DELL_Z9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(DELL_Z9100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_z9100_c2538-r0 SONIC_DPKG_DEBS += $(DELL_Z9100_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-ingrasys-s9100.mk b/platform/broadcom/platform-modules-ingrasys-s9100.mk index 1802290008b0..7c7df7b1cf61 100755 --- a/platform/broadcom/platform-modules-ingrasys-s9100.mk +++ b/platform/broadcom/platform-modules-ingrasys-s9100.mk @@ -7,4 +7,5 @@ export INGRASYS_S9100_PLATFORM_MODULE_VERSION INGRASYS_S9100_PLATFORM_MODULE = sonic-platform-ingrasys-s9100_$(INGRASYS_S9100_PLATFORM_MODULE_VERSION)_amd64.deb $(INGRASYS_S9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys-s9100 $(INGRASYS_S9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(INGRASYS_S9100_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9100-r0 SONIC_DPKG_DEBS += $(INGRASYS_S9100_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-s6000.mk b/platform/broadcom/platform-modules-s6000.mk index a32ab67c7aa8..d2c105ffdc8d 100644 --- a/platform/broadcom/platform-modules-s6000.mk +++ b/platform/broadcom/platform-modules-s6000.mk @@ -7,4 +7,5 @@ export DELL_S6000_PLATFORM_MODULE_VERSION DELL_S6000_PLATFORM_MODULE = platform-modules-s6000_$(DELL_S6000_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_S6000_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-s6000 $(DELL_S6000_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(DELL_S6000_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6000_s1220-r0 SONIC_DPKG_DEBS += $(DELL_S6000_PLATFORM_MODULE) diff --git a/slave.mk b/slave.mk index a77c2f9818f5..529ece46f8cb 100644 --- a/slave.mk +++ b/slave.mk @@ -286,13 +286,14 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_CONFIG_ENGINE) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_CONFIG_ENGINE) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $(HEADER) ## Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" export linux_kernel="$(DEBS_PATH)/$(LINUX_KERNEL)" export kversion="$(KVERSION)" export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))" + export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(addprefix $($(deb)_PLATFORM)@, $(DEBS_PATH)/$(deb)))" export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" export config_engine="$(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE))" export image_type="$($*_IMAGE_TYPE)" From 7e1adeeb222f723dc40bc7119d5e57bcbdc3c0fc Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 27 Feb 2017 14:42:25 -0800 Subject: [PATCH 0315/1833] [platform]: add eeprom/sfputil support for z9100 (#342) --- .../Force10-Z9100/port_config.ini | 33 ++++++++++ .../Force10-Z9100/sai.profile | 1 + .../plugins/eeprom.py | 23 +++++++ .../plugins/sfputil.py | 60 +++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/port_config.ini create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/sai.profile create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/plugins/eeprom.py create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/port_config.ini b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/port_config.ini new file mode 100644 index 000000000000..e000f29bef38 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 49,50,51,52 hundredGigE1/1 +Ethernet4 53,54,55,56 hundredGigE1/2 +Ethernet8 57,58,59,60 hundredGigE1/3 +Ethernet12 61,62,63,64 hundredGigE1/4 +Ethernet16 65,66,67,68 hundredGigE1/5 +Ethernet20 69,70,71,72 hundredGigE1/6 +Ethernet24 73,74,75,76 hundredGigE1/7 +Ethernet28 77,78,79,80 hundredGigE1/8 +Ethernet32 37,38,39,40 hundredGigE1/9 +Ethernet36 33,34,35,36 hundredGigE1/10 +Ethernet40 45,46,47,48 hundredGigE1/11 +Ethernet44 41,42,43,44 hundredGigE1/12 +Ethernet48 81,82,83,84 hundredGigE1/13 +Ethernet52 85,86,87,88 hundredGigE1/14 +Ethernet56 89,90,91,92 hundredGigE1/15 +Ethernet60 93,94,95,96 hundredGigE1/16 +Ethernet64 97,98,99,100 hundredGigE1/17 +Ethernet68 101,102,103,104 hundredGigE1/18 +Ethernet72 105,106,107,108 hundredGigE1/19 +Ethernet76 109,110,111,112 hundredGigE1/20 +Ethernet80 21,22,23,24 hundredGigE1/21 +Ethernet84 17,18,19,20 hundredGigE1/22 +Ethernet88 29,30,31,32 hundredGigE1/23 +Ethernet92 25,26,27,28 hundredGigE1/24 +Ethernet96 117,118,119,120 hundredGigE1/25 +Ethernet100 113,114,115,116 hundredGigE1/26 +Ethernet104 125,126,127,128 hundredGigE1/27 +Ethernet108 121,122,123,124 hundredGigE1/28 +Ethernet112 5,6,7,8 hundredGigE1/29 +Ethernet116 1,2,3,4 hundredGigE1/30 +Ethernet120 13,14,15,16 hundredGigE1/31 +Ethernet124 9,10,11,12 hundredGigE1/32 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/sai.profile b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/sai.profile new file mode 100644 index 000000000000..2c9a6e54c1ac --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-z9100-32x100G.config.bcm diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/eeprom.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/eeprom.py new file mode 100644 index 000000000000..0e6b1bcfafcb --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/eeprom.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +############################################################################# +# Dell Z9100 +# +# 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-2/2-0050/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py new file mode 100644 index 000000000000..07e094db7bb8 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: 18, + 1: 19, + 2: 20, + 3: 21, + 4: 22, + 5: 23, + 6: 24, + 7: 25, + 8: 26, + 9: 27, + 10: 28, + 11: 29, + 12: 31, + 13: 30, + 14: 33, + 15: 32, + 16: 34, + 17: 35, + 18: 36, + 19: 37, + 20: 38, + 21: 39, + 22: 40, + 23: 41, + 24: 42, + 25: 43, + 26: 44, + 27: 45, + 28: 46, + 29: 47, + 30: 48, + 31: 49 + } + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(0, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + sfputilbase.__init__(self, port_num) From 66efbe4ee6e10e577e298486a7b5d6f35a23d6f9 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 27 Feb 2017 16:21:46 -0800 Subject: [PATCH 0316/1833] [README.md]: Fix formatting --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ce41a8f97196..b6b114ea3181 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ To clone the code repository recursively, assuming git version 1.9 or newer: git clone --recursive https://github.com/Azure/sonic-buildimage.git NOTE: If the repo has already been cloned, however there are no files under the submodule directories (e.g., src/lldpd, src/ptf, src/sonic-linux-kernel, etc.), you can manually fetch all the git submodules as follows: + git submodule update --init --recursive You also need to change all git paths to relative path as we build all submodules inside the docker: From d9b1000e6c74ada3da8f0d0f3a764108662396f0 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 28 Feb 2017 10:52:56 -0800 Subject: [PATCH 0317/1833] [cfggen] Add support in -v for jinja2 expression (#345) * Add support in -v for jinja2 expression * Format json output --- dockers/docker-teamd/config.sh | 2 +- src/sonic-config-engine/sonic-cfggen | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dockers/docker-teamd/config.sh b/dockers/docker-teamd/config.sh index 8259e2faf312..b3ad1401ad5f 100755 --- a/dockers/docker-teamd/config.sh +++ b/dockers/docker-teamd/config.sh @@ -2,7 +2,7 @@ mkdir -p /etc/teamd -for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml --var-keys minigraph_portchannel_interfaces`; do +for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannel_interfaces.keys()"`; do sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /usr/share/sonic/templates/teamd.j2 >/etc/teamd/$pc.conf done diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 169967075473..90a905c5b3e1 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -8,6 +8,7 @@ import jinja2 import netaddr import json from minigraph import parse_xml +from minigraph import minigraph_encoder def is_ipv4(value): @@ -55,9 +56,9 @@ def main(): group = parser.add_mutually_exclusive_group() group.add_argument("-t", "--template", help="render the data with the template file") group.add_argument("-s", "--alias-mapping", help="print alias mapping json if available", action='store_true') - group.add_argument("-v", "--var", help="print the value of a variable") + group.add_argument("-v", "--var", help="print the value of a variable, support jinja2 expression") group.add_argument("--var-json", help="print the value of a variable, in json format") - group.add_argument("--var-keys", help="print all keys of a map variable") + group.add_argument("--var-keys", help="print all keys of a map variable - to be deprecated, use -v and keys()") group.add_argument("--print-data", help="print all data", action='store_true') args = parser.parse_args() @@ -94,10 +95,11 @@ def main(): print template.render(data) if args.var != None: - print data[args.var] + template = jinja2.Template('{{' + args.var + '}}') + print template.render(data) if args.var_json != None: - print json.dumps(data[args.var_json]) + print json.dumps(data[args.var_json], indent=4, cls=minigraph_encoder) if args.var_keys != None: for key in data[args.var_keys].keys(): @@ -111,7 +113,7 @@ def main(): print json.dumps(mapping) if args.print_data: - print data + print json.dumps(data, indent=4, cls=minigraph_encoder) if __name__ == "__main__": main() From 1a3bfc223643d10424c13f53f52b662f0d4fbc54 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 28 Feb 2017 12:55:48 -0800 Subject: [PATCH 0318/1833] [kernel]: update sonic linux kernel to download source from azure storage (#347) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 258652dfb123..73e99e9126c2 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 258652dfb1234ac224930ce5bf13954165ce55e5 +Subproject commit 73e99e9126c2233a36609275a9e9bd0bb0f3d0f5 From ad1b5811117f37a660a8f7028bec5e13cdb61416 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 28 Feb 2017 13:36:59 -0800 Subject: [PATCH 0319/1833] [docker]: Add -c option in teamd docker Dockerfile (#348) CMD is not longer a file name but a command that needs to be executed, thus /bin/bash is not enough for the entrypoint and -c is needed. Signed-off-by: Shuotian Cheng --- dockers/docker-teamd/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index e1e41c33ba17..32e302971ed2 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -22,5 +22,5 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/bin/bash"] +ENTRYPOINT ["/bin/bash", "-c"] CMD ["/usr/bin/config.sh && /usr/bin/start.sh"] From e097440f58489b2f630105041354677e5e569310 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 28 Feb 2017 16:02:43 -0800 Subject: [PATCH 0320/1833] [platform]: add dell s6100 into one image (#346) --- platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-dell.mk | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 4558d6669d09..e7e20a9eb7f3 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -6,6 +6,7 @@ $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) $(SONIC_ONE_IMAGE)_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(DELL_Z9100_PLATFORM_MODULE) \ + $(DELL_S6100_PLATFORM_MODULE) \ $(INGRASYS_S9100_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-dell.mk b/platform/broadcom/platform-modules-dell.mk index ce4c29651c4f..f01d162a34a4 100644 --- a/platform/broadcom/platform-modules-dell.mk +++ b/platform/broadcom/platform-modules-dell.mk @@ -1,11 +1,19 @@ -# Dell Z9100 Platform modules +# Dell Z9100 and S6100 Platform modules DELL_Z9100_PLATFORM_MODULE_VERSION = 1.1 +DELL_S6100_PLATFORM_MODULE_VERSION = 1.1 export DELL_Z9100_PLATFORM_MODULE_VERSION +export DELL_S6100_PLATFORM_MODULE_VERSION DELL_Z9100_PLATFORM_MODULE = platform-modules-z9100_$(DELL_Z9100_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_Z9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-dell $(DELL_Z9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(DELL_Z9100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_z9100_c2538-r0 -SONIC_DPKG_DEBS += $(DELL_Z9100_PLATFORM_MODULE) + +DELL_S6100_PLATFORM_MODULE = platform-modules-s6100_$(DELL_S6100_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELL_S6100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-dell +$(DELL_S6100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(DELL_S6100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6100_c2538-r0 + +SONIC_DPKG_DEBS += $(DELL_Z9100_PLATFORM_MODULE) $(DELL_S6100_PLATFORM_MODULE) From 73fb59c52c6bdc206fd8bb62766ea4c575dc0af3 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 1 Mar 2017 08:32:58 -0800 Subject: [PATCH 0321/1833] =?UTF-8?q?[build]:=20allow=20single=20src=20fil?= =?UTF-8?q?e=20to=20build=20multiple=20independent=20debian=20p=E2=80=A6?= =?UTF-8?q?=20(#349)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add_derived_package setup dependency between the main deb and derived deb. The derived deb depends on the main deb and need to install the main deb. add_extra_package does not setup dependency between the main deb and peer deb, does not require to install the main deb. * rename add_peer_packages to add_extra_packages --- platform/broadcom/platform-modules-dell.mk | 6 ++--- rules/functions | 10 +++++++- slave.mk | 29 ++++++++++++++++------ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/platform/broadcom/platform-modules-dell.mk b/platform/broadcom/platform-modules-dell.mk index f01d162a34a4..f0b5d261e05b 100644 --- a/platform/broadcom/platform-modules-dell.mk +++ b/platform/broadcom/platform-modules-dell.mk @@ -10,10 +10,8 @@ DELL_Z9100_PLATFORM_MODULE = platform-modules-z9100_$(DELL_Z9100_PLATFORM_MODULE $(DELL_Z9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-dell $(DELL_Z9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(DELL_Z9100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_z9100_c2538-r0 +SONIC_DPKG_DEBS += $(DELL_Z9100_PLATFORM_MODULE) DELL_S6100_PLATFORM_MODULE = platform-modules-s6100_$(DELL_S6100_PLATFORM_MODULE_VERSION)_amd64.deb -$(DELL_S6100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-dell -$(DELL_S6100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(DELL_S6100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6100_c2538-r0 - -SONIC_DPKG_DEBS += $(DELL_Z9100_PLATFORM_MODULE) $(DELL_S6100_PLATFORM_MODULE) +$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S6100_PLATFORM_MODULE))) diff --git a/rules/functions b/rules/functions index b0d7f9e68499..4379d85c9ed8 100644 --- a/rules/functions +++ b/rules/functions @@ -89,13 +89,21 @@ endef define add_derived_package $(2)_DEPENDS += $(1) $(2)_RDEPENDS += $($(1)_RDEPENDS) -$(2)_DERIVED_FROM = $(1) +$(2)_MAIN_DEB = $(1) $(1)_DERIVED_DEBS += $(2) $(2)_URL = $($(1)_URL) $(2)_SRC_PATH = $($(1)_SRC_PATH) SONIC_DERIVED_DEBS += $(2) endef +# call: +# add_extra_package some_deb.deb, some_extra_deb +define add_extra_package +$(2)_MAIN_DEB = $(1) +$(1)_EXTRA_DEBS += $(2) +SONIC_EXTRA_DEBS += $(2) +endef + ############################################################################### ## Utility functions ############################################################################### diff --git a/slave.mk b/slave.mk index 529ece46f8cb..fbec243d7149 100644 --- a/slave.mk +++ b/slave.mk @@ -140,7 +140,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_FILES)) : $(DEBS_PATH)/% : .platform $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(HEADER) # remove target to force rebuild - rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS)) + rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) # build project and take package make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG) $(FOOTER) @@ -159,7 +159,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) dpkg-buildpackage -rfakeroot -b -us -uc $(LOG) popd $(LOG) - mv $(addprefix $($*_SRC_PATH)/../, $* $($*_DERIVED_DEBS)) $(DEBS_PATH) $(LOG) + mv $(addprefix $($*_SRC_PATH)/../, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) $(DEBS_PATH) $(LOG) $(FOOTER) # Build project with python setup.py --command-packages=stdeb.command @@ -190,6 +190,19 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DERIVED_DEBS)) : $(DEBS_PATH)/% : .platform $ [ -f $@ ] && touch $@ $(FOOTER) +# Rules for extra debian packages +# All noise takes place in main deb recipe, so we are just telling that +# we need to build the main deb and move our deb to other targets +# Add new dev package: +# $(eval $(call add_extra_package,$(ORIGINAL_DEB),extra_deb_file.deb)) +$(addprefix $(DEBS_PATH)/, $(SONIC_EXTRA_DEBS)) : $(DEBS_PATH)/% : .platform $$(addprefix $(DEBS_PATH)/,$$($$*_MAIN_DEB)) + $(HEADER) + # All noise takes place in main deb recipe, so we are just telling that + # we depend on it + # Put newer timestamp + [ -f $@ ] && touch $@ + $(FOOTER) + # Targets for installing debian packages prior to build one that depends on them SONIC_INSTALL_TARGETS = $(addsuffix -install,$(addprefix $(DEBS_PATH)/, \ $(SONIC_ONLINE_DEBS) \ @@ -197,7 +210,8 @@ SONIC_INSTALL_TARGETS = $(addsuffix -install,$(addprefix $(DEBS_PATH)/, \ $(SONIC_MAKE_DEBS) \ $(SONIC_DPKG_DEBS) \ $(SONIC_PYTHON_STDEB_DEBS) \ - $(SONIC_DERIVED_DEBS))) + $(SONIC_DERIVED_DEBS) \ + $(SONIC_EXTRA_DEBS))) $(SONIC_INSTALL_TARGETS) : $(DEBS_PATH)/%-install : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(DEBS_PATH)/$$* $(HEADER) [ -f $(DEBS_PATH)/$* ] || { echo $(DEBS_PATH)/$* does not exist $(LOG) && exit 1; } @@ -351,11 +365,12 @@ SONIC_CLEAN_DEBS = $(addsuffix -clean,$(addprefix $(DEBS_PATH)/, \ $(SONIC_MAKE_DEBS) \ $(SONIC_DPKG_DEBS) \ $(SONIC_PYTHON_STDEB_DEBS) \ - $(SONIC_DERIVED_DEBS))) -$(SONIC_CLEAN_DEBS) : $(DEBS_PATH)/%-clean : .platform $$(addsuffix -clean,$$(addprefix $(DEBS_PATH)/,$$($$*_DERIVED_FROM))) - @# remove derived targets if main one is removed, because we treat them + $(SONIC_DERIVED_DEBS) \ + $(SONIC_EXTRA_DEBS))) +$(SONIC_CLEAN_DEBS) : $(DEBS_PATH)/%-clean : .platform $$(addsuffix -clean,$$(addprefix $(DEBS_PATH)/,$$($$*_MAIN_DEB))) + @# remove derived or extra targets if main one is removed, because we treat them @# as part of one package - @rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS)) + @rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \ $(SONIC_DOCKER_IMAGES) \ From a8776033bfc255518eebf2f81e4cead7380a3432 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 1 Mar 2017 20:57:35 +0200 Subject: [PATCH 0322/1833] Merge swss and syncd into single service (#334) Current implementation of swss and syncd causes a lot of problems in terms of dependencies and synchronization. Instead of handling them in separate services, we now start and stop them both as a single entity. Signed-off-by: marian-pritsak --- .../build_templates/sonic_debian_extension.j2 | 6 ++-- files/build_templates/swss.service.j2 | 28 ++++++++++++++++-- files/build_templates/syncd.service.j2 | 29 ------------------- slave.mk | 8 +++-- 4 files changed, 34 insertions(+), 37 deletions(-) delete mode 100644 files/build_templates/syncd.service.j2 diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 08aaae769fa8..8a2a8f988b70 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -184,8 +184,10 @@ sudo chroot $FILESYSTEM_ROOT service docker stop sudo cp {{script}} $FILESYSTEM_ROOT/usr/bin/ {% endfor %} {% for service in installer_services.split(' ') -%} -sudo cp {{service}} $FILESYSTEM_ROOT/etc/systemd/system/ -sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable {{service}} +if [ -f {{service}} ]; then + sudo cp {{service}} $FILESYSTEM_ROOT/etc/systemd/system/ + sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable {{service}} +fi {% endfor %} sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index f60ef6712dd8..3af444a553d4 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -1,18 +1,40 @@ [Unit] -Description=switch state service container +Description=switch state service Requires=database.service After=database.service [Service] -User={{ sonicadmin_user }} # Wait for redis server start before database clean ExecStartPre=/bin/bash -c "while true; do if [ \"$(/usr/bin/docker exec database redis-cli ping)\" == \"PONG\" ]; then break; fi; sleep 1; done" ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB -ExecStart=/usr/bin/{{docker_container_name}}.sh start + +{% if sonic_hwsku == 'ACS-MSN2700' %} +ExecStartPre=/etc/init.d/sxdkernel start +ExecStartPre=/usr/bin/mst start +ExecStartPre=/etc/mlnx/msn2700 start +{% elif sonic_hwsku == 'AS7512' %} +ExecStartPre=-/etc/init.d/xpnet.sh stop +ExecStartPre=/etc/init.d/xpnet.sh start +{% endif %} + +# systemd allows only one parent process within service, +# so we spawn both dockers from single bash parent +ExecStart=/bin/bash -c "/usr/bin/{{docker_container_name}}.sh start & /usr/bin/syncd.sh start & wait -n 0" + ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStopPost=/usr/bin/syncd.sh stop +{% if sonic_hwsku == 'ACS-MSN2700' %} +ExecStopPost=/etc/mlnx/msn2700 stop +ExecStopPost=/etc/init.d/sxdkernel stop +ExecStopPost=/usr/bin/mst stop +{% elif sonic_hwsku == 'AS7512' %} +ExecStopPost=/etc/init.d/xpnet.sh stop +ExecStopPost=/etc/init.d/xpnet.sh start +{% endif %} + + [Install] WantedBy=multi-user.target diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 deleted file mode 100644 index e0fdb7e270a5..000000000000 --- a/files/build_templates/syncd.service.j2 +++ /dev/null @@ -1,29 +0,0 @@ -[Unit] -Description=syncd container -Requires=database.service -After=database.service - -[Service] -User=root -{% if sonic_hwsku == 'ACS-MSN2700' %} -ExecStartPre=/etc/init.d/sxdkernel start -ExecStartPre=/usr/bin/mst start -ExecStartPre=/etc/mlnx/msn2700 start -{% elif sonic_hwsku == 'AS7512' %} -ExecStartPre=-/etc/init.d/xpnet.sh stop -ExecStartPre=/etc/init.d/xpnet.sh start -{% endif %} -ExecStart=/usr/bin/{{docker_container_name}}.sh start -ExecStop=/usr/bin/{{docker_container_name}}.sh stop -{% if sonic_hwsku == 'ACS-MSN2700' %} -ExecStopPost=/etc/mlnx/msn2700 stop -ExecStopPost=/etc/init.d/sxdkernel stop -ExecStopPost=/usr/bin/mst stop -{% elif sonic_hwsku == 'AS7512' %} -ExecStopPost=/etc/init.d/xpnet.sh stop -ExecStopPost=/etc/init.d/xpnet.sh start -{% endif %} -Restart=always - -[Install] -WantedBy=multi-user.target diff --git a/slave.mk b/slave.mk index fbec243d7149..0a5548a29dcc 100644 --- a/slave.mk +++ b/slave.mk @@ -322,7 +322,9 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export docker_container_name="$($(docker)_CONTAINER_NAME)" export docker_image_run_opt="$($(docker)_RUN_OPT)" j2 files/build_templates/docker_image_ctl.j2 > $($(docker)_CONTAINER_NAME).sh - j2 files/build_templates/$($(docker)_CONTAINER_NAME).service.j2 > $($(docker)_CONTAINER_NAME).service + if [ -f files/build_templates/$($(docker)_CONTAINER_NAME).service.j2 ]; then + j2 files/build_templates/$($(docker)_CONTAINER_NAME).service.j2 > $($(docker)_CONTAINER_NAME).service + fi chmod +x $($(docker)_CONTAINER_NAME).sh ) @@ -342,8 +344,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) DEBUG_BUILD=$(DEBUG_BUILD) ./build_image.sh $(LOG) $(foreach docker, $($*_DOCKERS), \ - rm $($(docker)_CONTAINER_NAME).sh - rm $($(docker)_CONTAINER_NAME).service + rm -f $($(docker)_CONTAINER_NAME).sh + rm -f $($(docker)_CONTAINER_NAME).service ) $(if $($*_DOCKERS), From 38b9eb18299377a3cc2082d483cf407224be05ae Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 1 Mar 2017 21:00:59 +0200 Subject: [PATCH 0323/1833] [Makefile]: Automatically rebuild sonic-slave (#338) sonic-slave is not built upon every make call, because it takes a lot of time. So in order to track changes hash of Dockerfile is included to sonic-slave image. Signed-off-by: marian-pritsak --- Makefile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d17b002e66b1..5ae33d2cf6b0 100644 --- a/Makefile +++ b/Makefile @@ -9,24 +9,30 @@ PWD := $(shell pwd) MAKEFLAGS += -B +SLAVE_TAG = $(shell shasum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') +SLAVE_IMAGE = sonic-slave-$(USER) + DOCKER_RUN := docker run --rm=true --privileged \ -v $(PWD):/sonic \ -i$(SONIC_SLAVE_TTY) -DOCKER_BUILD = docker build --no-cache \ +DOCKER_BUILD = docker build \ --build-arg user=$(USER) \ --build-arg uid=$(shell id -u) \ --build-arg guid=$(shell id -g) \ - -t sonic-slave-$(USER) \ - sonic-slave + -t $(SLAVE_IMAGE) \ + sonic-slave && \ + docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG) .PHONY: sonic-slave-build sonic-slave-bash .DEFAULT_GOAL := all %:: - @docker inspect --type image sonic-slave-$(USER) &> /dev/null || $(DOCKER_BUILD) - @$(DOCKER_RUN) sonic-slave-$(USER) make \ + @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ + { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ + $(DOCKER_BUILD) ; } + @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) make \ -C sonic \ -f slave.mk \ PLATFORM=$(PLATFORM) \ @@ -39,4 +45,7 @@ sonic-slave-build : @$(DOCKER_BUILD) sonic-slave-bash : - @$(DOCKER_RUN) -t sonic-slave-$(USER) bash + @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ + { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ + $(DOCKER_BUILD) ; } + @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash From 7d10892dce1fae2dea052d96469e1ac248615ab3 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 2 Mar 2017 00:25:44 +0200 Subject: [PATCH 0324/1833] [Makefile]: Add --no-cache to docker build (#352) Option was removed by mistake in 38b9eb18299377a3cc2082d483cf407224be05ae Signed-off-by: marian-pritsak --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5ae33d2cf6b0..5c6b21a73941 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ DOCKER_RUN := docker run --rm=true --privileged \ -v $(PWD):/sonic \ -i$(SONIC_SLAVE_TTY) -DOCKER_BUILD = docker build \ +DOCKER_BUILD = docker build --no-cache \ --build-arg user=$(USER) \ --build-arg uid=$(shell id -u) \ --build-arg guid=$(shell id -g) \ From 903499000f90b11dcde396f37fc82ae8346dc80f Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 1 Mar 2017 14:32:52 -0800 Subject: [PATCH 0325/1833] [docker-teamd] fix a config bug introduced in #345 (#353) --- dockers/docker-teamd/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-teamd/config.sh b/dockers/docker-teamd/config.sh index b3ad1401ad5f..d1b34f426428 100755 --- a/dockers/docker-teamd/config.sh +++ b/dockers/docker-teamd/config.sh @@ -2,7 +2,7 @@ mkdir -p /etc/teamd -for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannel_interfaces.keys()"`; do +for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "' '.join(minigraph_portchannel_interfaces.keys())"`; do sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /usr/share/sonic/templates/teamd.j2 >/etc/teamd/$pc.conf done From 0ed9b3ce285b336a9305620b70db602dab759094 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 1 Mar 2017 17:05:13 -0800 Subject: [PATCH 0326/1833] [platform]: remove sku from build parameter (#350) different sku will be contained in a single one sonic image. no longer need to specify sku at the build time --- .gitignore | 2 + Makefile | 1 - README.md | 10 +- .../x86_64-accton_as7512_32x-r0/minigraph.xml | 0 .../x86_64-arista_7050_qx32/minigraph.xml | 1049 +++++++++++++++++ .../x86_64-dell_s6000_s1220-r0/minigraph.xml | 0 .../x86_64-dell_z9100_c2538-r0/minigraph.xml | 0 .../x86_64-ingrasys_s9100-r0/minigraph.xml | 0 .../x86_64-mlnx_msn2700-r0/minigraph.xml | 0 .../build_templates/sonic_debian_extension.j2 | 4 - files/build_templates/sonic_version.yml.j2 | 1 - files/build_templates/swss.service.j2 | 9 +- files/image_config/platform/rc.local | 18 +- slave.mk | 4 - 14 files changed, 1077 insertions(+), 21 deletions(-) rename files/image_config/minigraph/minigraph_AS7512.xml => device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml (100%) create mode 100644 device/arista/x86_64-arista_7050_qx32/minigraph.xml rename files/image_config/minigraph/minigraph_Force10-S6000.xml => device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml (100%) rename files/image_config/minigraph/minigraph_Force10-Z9100.xml => device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml (100%) rename files/image_config/minigraph/minigraph_ingrasys-s9100.xml => device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml (100%) rename files/image_config/minigraph/minigraph_ACS-MSN2700.xml => device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml (100%) diff --git a/.gitignore b/.gitignore index b2c3e81854b0..ffcc741d83ef 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ fsroot/ fs.* target/ +*.deb +*.changes # Subdirectories in src src/hiredis/* diff --git a/Makefile b/Makefile index 5c6b21a73941..3b9a8645ce92 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,6 @@ DOCKER_BUILD = docker build --no-cache \ -C sonic \ -f slave.mk \ PLATFORM=$(PLATFORM) \ - SKU=$(SKU) \ DEBUG_BUILD=$(DEBUG_BUILD) \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ $@ diff --git a/README.md b/README.md index b6b114ea3181..7f4e3770164c 100644 --- a/README.md +++ b/README.md @@ -32,15 +32,15 @@ You also need to change all git paths to relative path as we build all submodule To build NOS installer image and docker images, run the following commands: - make configure PLATFORM=[ASIC_VENDOR] SKU=[HW_SKU] + make configure PLATFORM=[ASIC_VENDOR] make **NOTE**: We recommend reserving 50G free space to build one platform. -Supported PLATFORM and SKU are: -- PLATFORM=broadcom SKU=Force10-S6000 -- PLATFORM=mellanox SKU=ACS-MSN2700 -- PLATFORM=cavium SKU=AS7512 +Supported PLATFORM are: +- PLATFORM=broadcom +- PLATFORM=mellanox +- PLATFORM=cavium - PLATFORM=p4 You may find the rules/config file useful. It contains configuration options for the build process, like adding more verbosity or showing dependencies, username and password for base image etc. diff --git a/files/image_config/minigraph/minigraph_AS7512.xml b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml similarity index 100% rename from files/image_config/minigraph/minigraph_AS7512.xml rename to device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml diff --git a/device/arista/x86_64-arista_7050_qx32/minigraph.xml b/device/arista/x86_64-arista_7050_qx32/minigraph.xml new file mode 100644 index 000000000000..26bf46132a25 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/minigraph.xml @@ -0,0 +1,1049 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + Ethernet1/1 + 10.0.0.0/31 + + + + Ethernet2/1 + 10.0.0.2/31 + + + + Ethernet3/1 + 10.0.0.4/31 + + + + Ethernet4/1 + 10.0.0.6/31 + + + + Ethernet5/1 + 10.0.0.8/31 + + + + Ethernet6/1 + 10.0.0.10/31 + + + + Ethernet7/1 + 10.0.0.12/31 + + + + Ethernet8/1 + 10.0.0.14/31 + + + + Ethernet9/1 + 10.0.0.16/31 + + + + Ethernet10/1 + 10.0.0.18/31 + + + + Ethernet11/1 + 10.0.0.20/31 + + + + Ethernet12/1 + 10.0.0.22/31 + + + + Ethernet13/1 + 10.0.0.24/31 + + + + Ethernet14/1 + 10.0.0.26/31 + + + + Ethernet15/1 + 10.0.0.28/31 + + + + Ethernet16/1 + 10.0.0.30/31 + + + + Ethernet17/1 + 10.0.0.32/31 + + + + Ethernet18/1 + 10.0.0.34/31 + + + + Ethernet19/1 + 10.0.0.36/31 + + + + Ethernet20/1 + 10.0.0.38/31 + + + + Ethernet21/1 + 10.0.0.40/31 + + + + Ethernet22/1 + 10.0.0.42/31 + + + + Ethernet23/1 + 10.0.0.44/31 + + + + Ethernet24/1 + 10.0.0.46/31 + + + + Ethernet25 + 10.0.0.48/31 + + + + Ethernet26 + 10.0.0.50/31 + + + + Ethernet27 + 10.0.0.52/31 + + + + Ethernet28 + 10.0.0.54/31 + + + + Ethernet29 + 10.0.0.56/31 + + + + Ethernet30 + 10.0.0.58/31 + + + + Ethernet31 + 10.0.0.60/31 + + + + Ethernet32 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet1/1 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet2/1 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet3/1 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4/1 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet5/1 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet6/1 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet7/1 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8/1 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet9/1 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet10/1 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet11/1 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12/1 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet13/1 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet14/1 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet15/1 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16/1 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet17/1 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet18/1 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet19/1 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20/1 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet21/1 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet22/1 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet23/1 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24/1 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet25 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet26 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet27 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet29 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet30 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet31 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet32 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Arista-7050-QX32 + + + + switch1 + Arista-7050-QX32 +
diff --git a/files/image_config/minigraph/minigraph_Force10-S6000.xml b/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml similarity index 100% rename from files/image_config/minigraph/minigraph_Force10-S6000.xml rename to device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml diff --git a/files/image_config/minigraph/minigraph_Force10-Z9100.xml b/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml similarity index 100% rename from files/image_config/minigraph/minigraph_Force10-Z9100.xml rename to device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml diff --git a/files/image_config/minigraph/minigraph_ingrasys-s9100.xml b/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml similarity index 100% rename from files/image_config/minigraph/minigraph_ingrasys-s9100.xml rename to device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml diff --git a/files/image_config/minigraph/minigraph_ACS-MSN2700.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml similarity index 100% rename from files/image_config/minigraph/minigraph_ACS-MSN2700.xml rename to device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 8a2a8f988b70..eaab6af01614 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -55,9 +55,6 @@ sudo cp $IMAGE_CONFIGS/environment/motd $FILESYSTEM_ROOT/etc/ sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ sudo mkdir -p $FILESYSTEM_ROOT/usr/share/sonic/templates/ -# Copy default minigraph -sudo cp $IMAGE_CONFIGS/minigraph/minigraph_{{sonic_hwsku}}.xml $FILESYSTEM_ROOT/etc/sonic/minigraph.xml - # Install dependencies for SONiC config engine sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ python-lxml \ @@ -118,7 +115,6 @@ sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ # Generate build version file export git_revision=$(git rev-parse --short HEAD) -export sonic_hwsku={{sonic_hwsku}} export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version` export kernel_version={{kversion}} j2 $BUILD_TEMPLATES/sonic_version.yml.j2 > sonic_version.yml diff --git a/files/build_templates/sonic_version.yml.j2 b/files/build_templates/sonic_version.yml.j2 index d0dd45aea56d..54eb904a1614 100644 --- a/files/build_templates/sonic_version.yml.j2 +++ b/files/build_templates/sonic_version.yml.j2 @@ -1,4 +1,3 @@ build_version: {{git_revision}} -build_hwsku: {{sonic_hwsku}} debian_version: {{debian_version}} kernel_version: {{kernel_version}} diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 3af444a553d4..3ec8161fa00a 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -4,17 +4,18 @@ Requires=database.service After=database.service [Service] +User=root # Wait for redis server start before database clean ExecStartPre=/bin/bash -c "while true; do if [ \"$(/usr/bin/docker exec database redis-cli ping)\" == \"PONG\" ]; then break; fi; sleep 1; done" ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB -{% if sonic_hwsku == 'ACS-MSN2700' %} +{% if sonic_asic_platform == 'mellanox' %} ExecStartPre=/etc/init.d/sxdkernel start ExecStartPre=/usr/bin/mst start ExecStartPre=/etc/mlnx/msn2700 start -{% elif sonic_hwsku == 'AS7512' %} +{% elif sonic_asic_platform == 'cavium' %} ExecStartPre=-/etc/init.d/xpnet.sh stop ExecStartPre=/etc/init.d/xpnet.sh start {% endif %} @@ -26,11 +27,11 @@ ExecStart=/bin/bash -c "/usr/bin/{{docker_container_name}}.sh start & /usr/bin/s ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStopPost=/usr/bin/syncd.sh stop -{% if sonic_hwsku == 'ACS-MSN2700' %} +{% if sonic_asic_platform == 'mellanox' %} ExecStopPost=/etc/mlnx/msn2700 stop ExecStopPost=/etc/init.d/sxdkernel stop ExecStopPost=/usr/bin/mst stop -{% elif sonic_hwsku == 'AS7512' %} +{% elif sonic_asic_platform == 'cavium' %} ExecStopPost=/etc/init.d/xpnet.sh stop ExecStopPost=/etc/init.d/xpnet.sh start {% endif %} diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index dc5507fe234b..1b2fadf3c343 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -16,9 +16,23 @@ echo "install platform dependent packages at the first boot time" if [ -f /host/platform/firsttime ]; then - if [ -d /host/platform/$onie_platform ]; then - dpkg -i /host/platform/$onie_platform/*.deb + + if [ -n $aboot_platform ]; then + platform=$aboot_platform + elif [ -n $onie_platform ]; then + platform=$onie_platform + else + echo "Unknown sonic platform" + rm /host/platform/firsttime + exit 0 fi + + cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ + + if [ -d /host/platform/$platform ]; then + dpkg -i /host/platform/$platform/*.deb + fi + rm /host/platform/firsttime fi diff --git a/slave.mk b/slave.mk index 0a5548a29dcc..55fc848cf9a9 100644 --- a/slave.mk +++ b/slave.mk @@ -25,7 +25,6 @@ PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels PROJECT_ROOT = $(shell pwd) CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo generic) -CONFIGURED_SKU := $(shell [ -f .sku ] && cat .sku || echo undefined) PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM) ############################################################################### @@ -49,7 +48,6 @@ configure : @mkdir -p target/debs @mkdir -p target/python-wheels @echo $(PLATFORM) > .platform - @echo $(SKU) > .sku distclean : .platform .sku clean @rm -f .platform .sku @@ -65,7 +63,6 @@ include $(RULES_PATH)/*.mk ifneq ($(CONFIGURED_PLATFORM), undefined) include $(PLATFORM_PATH)/rules.mk endif -export CONFIGURED_SKU MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) @@ -312,7 +309,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export config_engine="$(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE))" export image_type="$($*_IMAGE_TYPE)" export sonicadmin_user="$(USERNAME)" - export sonic_hwsku="$(CONFIGURED_SKU)" export sonic_asic_platform="$(CONFIGURED_PLATFORM)" export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" From 524692462c2a8d54060cd77b6870cb9a64706668 Mon Sep 17 00:00:00 2001 From: Lihua Yuan Date: Wed, 1 Mar 2017 18:03:31 -0800 Subject: [PATCH 0327/1833] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7f4e3770164c..b4230b3d6582 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,10 @@ To build NOS installer image and docker images, run the following commands: Supported PLATFORM are: - PLATFORM=broadcom +- PLATFORM=marvell (*pending*) - PLATFORM=mellanox - PLATFORM=cavium +- PLATFORM=centec (*pending*) - PLATFORM=p4 You may find the rules/config file useful. It contains configuration options for the build process, like adding more verbosity or showing dependencies, username and password for base image etc. From fd6080a3628a7c16599f17293e64be67acdfe22e Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 1 Mar 2017 18:22:47 -0800 Subject: [PATCH 0328/1833] [Broadcom]: Update debian package versions (#354) Signed-off-by: Shuotian Cheng --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index f396e030cfbf..d2d701b8ed10 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.3.1-3_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.3.1-3_amd64.deb?sv=2015-04-05&sr=b&sig=j5U8yxIqk4B1Wk8OZp9HbMQ7J9u5GPQNmzTDLilJDjU%3D&se=2030-11-03T20%3A45%3A59Z&sp=r" +BRCM_SAI = libsaibcm_2.1.3.1-4+0-20170301222525.13-1.gbp8d6580_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.3.1-4+0-20170301222525.13-1.gbp8d6580_amd64.deb?sv=2015-04-05&sr=b&sig=YhWQFb2Bz5ZgqyA8VciIT20I%2BBDhps77ksakG0jU92A%3D&se=2030-11-08T22%3A34%3A36Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.3.1-3_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.3.1-4+0-20170301222525.13-1.gbp8d6580_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.3.1-3_amd64.deb?sv=2015-04-05&sr=b&sig=7FPU5S234yjDIPJUUasC%2BRDqPdrJjdOmSodEApzQjTo%3D&se=2030-11-03T20%3A49%3A38Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.3.1-4+0-20170301222525.13-1.gbp8d6580_amd64.deb?sv=2015-04-05&sr=b&sig=QUmwuM3AZ4qe5sVFTmB6tEWApJKWU7PP5kfaDVM2dKU%3D&se=2030-11-08T22%3A35%3A34Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 8fe1cfa30de2..c15d327f96a1 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.1.5-7_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-7_amd64.deb?sv=2015-04-05&sr=b&sig=DY5BPSDturlcHXfqYcS3Gl89Ypd%2BWMYmMLZ2rlNoC5w%3D&se=2030-11-03T11%3A21%3A53Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.1.5-7-20170301212550.23_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-7-20170301212550.23_amd64.deb?sv=2015-04-05&sr=b&sig=d18xevgySzJGCbD6I9M4SX1%2B291vIOMbMXPsbkDjuFA%3D&se=2030-11-08T22%3A36%3A21Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-7_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-7_amd64.deb?sv=2015-04-05&sr=b&sig=glZblgedvf6uOW5k1YpU7NiBWnIZgX5oWvcVsDsYuXc%3D&se=2030-11-03T11%3A22%3A44Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-7-20170301212550.23_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-7-20170301212550.23_amd64.deb?sv=2015-04-05&sr=b&sig=5iudeTcf3WNlNSYgJPfaj41CVh7n71GuV7v1hmuy0OI%3D&se=2030-11-08T22%3A36%3A58Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 2a2af6a44ee76387aa2afac725488ef4a6a5c236 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 1 Mar 2017 18:23:28 -0800 Subject: [PATCH 0329/1833] [orchagent]: Update start.sh to combine td2 qos/buffers config (#344) Signed-off-by: Shuotian Cheng --- dockers/docker-orchagent/start.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 51073fde00f4..af7f2f321a0a 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -37,16 +37,14 @@ SWSSCONFIG_ARGS="00-copp.config.json " if [ "$HWSKU" == "Force10-S6000" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " - SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " + SWSSCONFIG_ARGS+="td2.32ports.qos.json td2.32ports.buffers.json " elif [ "$HWSKU" == "Force10-S6100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Force10-Z9100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Arista-7050-QX32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - SWSSCONFIG_ARGS+="td2.32ports.qos.1.json td2.32ports.qos.2.json td2.32ports.qos.3.json td2.32ports.qos.4.json td2.32ports.qos.5.json td2.32ports.qos.6.json " - SWSSCONFIG_ARGS+="td2.32ports.buffers.1.json td2.32ports.buffers.2.json td2.32ports.buffers.3.json " + SWSSCONFIG_ARGS+="td2.32ports.qos.json td2.32ports.buffers.json " elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "AS7512" ]; then From e6c2380b6f22f9ab7948a864a70214cecdcc45d0 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Thu, 2 Mar 2017 14:08:25 +0200 Subject: [PATCH 0330/1833] Remove SKU from distclean target. --- slave.mk | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/slave.mk b/slave.mk index 55fc848cf9a9..456b73ec4680 100644 --- a/slave.mk +++ b/slave.mk @@ -38,19 +38,13 @@ ifneq ($(CONFIGURED_PLATFORM),generic) @exit 1 endif -.sku : -ifneq ($(CONFIGURED_PLATFORM),generic) - @echo Build system is not configured, please run make configure - @exit 1 -endif - configure : @mkdir -p target/debs @mkdir -p target/python-wheels @echo $(PLATFORM) > .platform -distclean : .platform .sku clean - @rm -f .platform .sku +distclean : .platform clean + @rm -f .platform ############################################################################### ## Include other rules @@ -398,4 +392,4 @@ all : .platform $$(addprefix $(TARGET_PATH)/,$$(SONIC_ALL)) .PHONY : $(SONIC_CLEAN_DEBS) $(SONIC_CLEAN_TARGETS) $(SONIC_CLEAN_WHEELS) clean distclean configure -.INTERMEDIATE : $(SONIC_INSTALL_TARGETS) $(SONIC_INSTALL_WHEELS) $(DOCKER_LOAD_TARGETS) docker-start .platform .sku +.INTERMEDIATE : $(SONIC_INSTALL_TARGETS) $(SONIC_INSTALL_WHEELS) $(DOCKER_LOAD_TARGETS) docker-start .platform From adc296bf6f0fbb723d38c28a41a86dd27ae34a1b Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 2 Mar 2017 20:10:40 +0200 Subject: [PATCH 0331/1833] [rc.local]: Put variables into quotes in conditionals (#361) Signed-off-by: marian-pritsak --- files/image_config/platform/rc.local | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 1b2fadf3c343..eccba516e694 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -17,9 +17,9 @@ echo "install platform dependent packages at the first boot time" if [ -f /host/platform/firsttime ]; then - if [ -n $aboot_platform ]; then + if [ -n "$aboot_platform" ]; then platform=$aboot_platform - elif [ -n $onie_platform ]; then + elif [ -n "$onie_platform" ]; then platform=$onie_platform else echo "Unknown sonic platform" From bac738f91f785f2db84d5e754214b2e328008f81 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 2 Mar 2017 11:33:46 -0800 Subject: [PATCH 0332/1833] Add bgp container with gobgp (#358) * Add go-1.7 into docker-slave * Create container docker-fpm-gobgp with gobgpd inside --- dockers/docker-fpm-gobgp/Dockerfile.j2 | 31 ++++++++++++ dockers/docker-fpm-gobgp/config.sh | 17 +++++++ dockers/docker-fpm-gobgp/daemons | 31 ++++++++++++ dockers/docker-fpm-gobgp/gobgpd.conf.j2 | 28 +++++++++++ dockers/docker-fpm-gobgp/isolate.j2 | 24 +++++++++ dockers/docker-fpm-gobgp/start.sh | 5 ++ dockers/docker-fpm-gobgp/supervisord.conf | 6 +++ dockers/docker-fpm-gobgp/unisolate.j2 | 24 +++++++++ dockers/docker-fpm-gobgp/zebra.conf.j2 | 61 +++++++++++++++++++++++ rules/docker-fpm-gobgp.mk | 14 ++++++ rules/gobgp.mk | 5 ++ sonic-slave/Dockerfile | 4 ++ src/gobgp/Makefile | 23 +++++++++ src/gobgp/debian/changelog | 5 ++ src/gobgp/debian/compat | 1 + src/gobgp/debian/control | 12 +++++ src/gobgp/debian/gobgp.dirs | 1 + src/gobgp/debian/gobgp.init.d | 50 +++++++++++++++++++ src/gobgp/debian/gobgp.service | 16 ++++++ src/gobgp/debian/rules | 3 ++ src/gobgp/gobgpd.conf.sample | 21 ++++++++ 21 files changed, 382 insertions(+) create mode 100644 dockers/docker-fpm-gobgp/Dockerfile.j2 create mode 100755 dockers/docker-fpm-gobgp/config.sh create mode 100644 dockers/docker-fpm-gobgp/daemons create mode 100644 dockers/docker-fpm-gobgp/gobgpd.conf.j2 create mode 100755 dockers/docker-fpm-gobgp/isolate.j2 create mode 100755 dockers/docker-fpm-gobgp/start.sh create mode 100644 dockers/docker-fpm-gobgp/supervisord.conf create mode 100755 dockers/docker-fpm-gobgp/unisolate.j2 create mode 100644 dockers/docker-fpm-gobgp/zebra.conf.j2 create mode 100644 rules/docker-fpm-gobgp.mk create mode 100644 rules/gobgp.mk create mode 100644 src/gobgp/Makefile create mode 100644 src/gobgp/debian/changelog create mode 100644 src/gobgp/debian/compat create mode 100644 src/gobgp/debian/control create mode 100644 src/gobgp/debian/gobgp.dirs create mode 100644 src/gobgp/debian/gobgp.init.d create mode 100644 src/gobgp/debian/gobgp.service create mode 100755 src/gobgp/debian/rules create mode 100644 src/gobgp/gobgpd.conf.sample diff --git a/dockers/docker-fpm-gobgp/Dockerfile.j2 b/dockers/docker-fpm-gobgp/Dockerfile.j2 new file mode 100644 index 000000000000..3d89999d9758 --- /dev/null +++ b/dockers/docker-fpm-gobgp/Dockerfile.j2 @@ -0,0 +1,31 @@ +FROM docker-fpm + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y supervisor + +COPY \ +{% for deb in docker_fpm_gobgp_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_fpm_gobgp_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +COPY ["*.j2", "/usr/share/sonic/templates/"] +COPY ["start.sh", "config.sh", "/usr/bin/"] +COPY ["daemons", "/etc/quagga/"] +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +ENTRYPOINT /usr/bin/config.sh \ + && /usr/bin/start.sh \ + && /usr/bin/supervisord \ + && /bin/bash diff --git a/dockers/docker-fpm-gobgp/config.sh b/dockers/docker-fpm-gobgp/config.sh new file mode 100755 index 000000000000..07aa8c33eea1 --- /dev/null +++ b/dockers/docker-fpm-gobgp/config.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +mkdir -p /etc/quagga +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/gobgpd.conf.j2 >/etc/gobgp/gobgpd.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/quagga/zebra.conf + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate +chown root:root /usr/sbin/bgp-isolate +chmod 0755 /usr/sbin/bgp-isolate + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate +chown root:root /usr/sbin/bgp-unisolate +chmod 0755 /usr/sbin/bgp-unisolate + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status + diff --git a/dockers/docker-fpm-gobgp/daemons b/dockers/docker-fpm-gobgp/daemons new file mode 100644 index 000000000000..6832c3db78d0 --- /dev/null +++ b/dockers/docker-fpm-gobgp/daemons @@ -0,0 +1,31 @@ +# This file tells the quagga package which daemons to start. +# +# Entries are in the format: =(yes|no|priority) +# 0, "no" = disabled +# 1, "yes" = highest priority +# 2 .. 10 = lower priorities +# Read /usr/share/doc/quagga/README.Debian for details. +# +# Sample configurations for these daemons can be found in +# /usr/share/doc/quagga/examples/. +# +# ATTENTION: +# +# When activation a daemon at the first time, a config file, even if it is +# empty, has to be present *and* be owned by the user and group "quagga", else +# the daemon will not be started by /etc/init.d/quagga. The permissions should +# be u=rw,g=r,o=. +# When using "vtysh" such a config file is also needed. It should be owned by +# group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. +# +# The watchquagga daemon is always started. Per default in monitoring-only but +# that can be changed via /etc/quagga/debian.conf. +# +zebra=yes +bgpd=no +ospfd=no +ospf6d=no +ripd=no +ripngd=no +isisd=no +babeld=no diff --git a/dockers/docker-fpm-gobgp/gobgpd.conf.j2 b/dockers/docker-fpm-gobgp/gobgpd.conf.j2 new file mode 100644 index 000000000000..adbc063cfc6c --- /dev/null +++ b/dockers/docker-fpm-gobgp/gobgpd.conf.j2 @@ -0,0 +1,28 @@ +[global.config] + as = {{ minigraph_bgp_asn }} + router-id = "{{ minigraph_lo_interfaces[0]['addr'] }}" +{% for bgp_session in minigraph_bgp %} +{% if bgp_session['asn'] != 0 %} +[[neighbors]] + [neighbors.config] + peer-as = {{ bgp_session['asn'] }} + neighbor-address = "{{ bgp_session['addr'] }}" + [neighbors.graceful-restart.config] + enabled = true + [[neighbors.afi-safis]] + [neighbors.afi-safis.config] +{% if bgp_session['addr'] | ipv6 %} + afi-safi-name = "ipv6-unicast" +{% else %} + afi-safi-name = "ipv4-unicast" +{% endif %} + [neighbors.afi-safis.mp-graceful-restart.config] + enabled = true +{% endif %} +{% endfor %} +[zebra] + [zebra.config] + enabled = true + url = "unix:/var/run/quagga/zserv.api" + redistribute-route-type-list = ["connect"] + diff --git a/dockers/docker-fpm-gobgp/isolate.j2 b/dockers/docker-fpm-gobgp/isolate.j2 new file mode 100755 index 000000000000..e587623e984f --- /dev/null +++ b/dockers/docker-fpm-gobgp/isolate.j2 @@ -0,0 +1,24 @@ +#!/bin/bash + +echo Not implemented yet +exit + +## vtysh only accepts script in stdin, so cannot be directly used in shebang +## Cut the tail of this script and feed vtysh stdin +sed -n -e '9,$p' < "$0" | vtysh "$@" +## Exit with vtysh return code +exit $? + +## vtysh script start from next line, which line number MUST eqaul in 'sed' command above + +configure terminal + router bgp {{ minigraph_bgp_asn }} +{% for bgp_session in minigraph_bgp %} + neighbor {{ bgp_session['addr'] }} route-map ISOLATE out +{% endfor %} + exit +exit + +{% for bgp_session in minigraph_bgp %} +clear ip bgp {{ bgp_session['addr'] }} soft out +{% endfor %} diff --git a/dockers/docker-fpm-gobgp/start.sh b/dockers/docker-fpm-gobgp/start.sh new file mode 100755 index 000000000000..90a1d515fa3a --- /dev/null +++ b/dockers/docker-fpm-gobgp/start.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +service rsyslog start +service quagga start +fpmsyncd & diff --git a/dockers/docker-fpm-gobgp/supervisord.conf b/dockers/docker-fpm-gobgp/supervisord.conf new file mode 100644 index 000000000000..793fc5434f80 --- /dev/null +++ b/dockers/docker-fpm-gobgp/supervisord.conf @@ -0,0 +1,6 @@ +[supervisord] +nodaemon=true + +[program:gobgpd] +command=/usr/sbin/gobgpd -p -f /etc/gobgp/gobgpd.conf -r +priority=1 diff --git a/dockers/docker-fpm-gobgp/unisolate.j2 b/dockers/docker-fpm-gobgp/unisolate.j2 new file mode 100755 index 000000000000..d1310114d908 --- /dev/null +++ b/dockers/docker-fpm-gobgp/unisolate.j2 @@ -0,0 +1,24 @@ +#!/bin/bash + +echo Not implemented yet +exit + +## vtysh only accepts script in stdin, so cannot be directly used in shebang +## Cut the tail of this script and feed vtysh stdin +sed -n -e '9,$p' < "$0" | vtysh "$@" +## Exit with vtysh return code +exit $? + +## vtysh script start from next line, which line number MUST eqaul in 'sed' command above + +configure terminal + router bgp {{ minigraph_bgp_asn }} +{% for bgp_session in minigraph_bgp %} + no neighbor {{ bgp_session['addr'] }} route-map ISOLATE out +{% endfor %} + exit +exit + +{% for bgp_session in minigraph_bgp %} +clear ip bgp {{ bgp_session['addr'] }} soft out +{% endfor %} diff --git a/dockers/docker-fpm-gobgp/zebra.conf.j2 b/dockers/docker-fpm-gobgp/zebra.conf.j2 new file mode 100644 index 000000000000..ad05dcbe4e90 --- /dev/null +++ b/dockers/docker-fpm-gobgp/zebra.conf.j2 @@ -0,0 +1,61 @@ +! +{% block banner %} +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/zebra.conf.j2 using minigraph_facts.py +! file: zebra.conf +! +{% endblock banner %} +! +{% block sys_init %} +hostname {{ inventory_hostname }} +password zebra +enable password zebra +{% endblock sys_init %} +! +{% block interfaces %} +! Enable link-detect (default disabled) +{% for interface in minigraph_interfaces %} +interface {{ interface['alias'] }} +link-detect +! +{% endfor %} +{% endblock interfaces %} +! +{% block default_route %} +! set static default route to mgmt gateway as a backup to learned default +ip route 0.0.0.0/0 {{ minigraph_mgmt_interface['gwaddr'] }} 200 +{% endblock default_route %} +! +{% block source_loopback %} +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src {{ minigraph_lo_interfaces[0]['addr'] }} +! +{% set lo_ipv6_addrs = [] %} +{% if minigraph_lo_interfaces is defined %} +{% for interface in minigraph_lo_interfaces %} +{% if interface['addr'] is defined and interface['addr']|ipv6 %} +{% if lo_ipv6_addrs.append(interface['addr']) %} +{% endif %} +{% endif %} +{% endfor %} +{% endif %} +{% if lo_ipv6_addrs|length > 0 %} +route-map RM_SET_SRC6 permit 10 + set src {{ lo_ipv6_addrs[0] }} +! +{% endif %} +ip protocol bgp route-map RM_SET_SRC +! +{% if lo_ipv6_addrs|length > 0 %} +ipv6 protocol bgp route-map RM_SET_SRC6 +! +{% endif %} +{% endblock source_loopback %} +! +{% block logging %} +log syslog informational +log facility local4 +{% endblock logging %} +! + diff --git a/rules/docker-fpm-gobgp.mk b/rules/docker-fpm-gobgp.mk new file mode 100644 index 000000000000..eb9406ec0ba4 --- /dev/null +++ b/rules/docker-fpm-gobgp.mk @@ -0,0 +1,14 @@ +# docker image for fpm-gobgp + +DOCKER_FPM_GOBGP = docker-fpm-gobgp.gz +$(DOCKER_FPM_GOBGP)_PATH = $(DOCKERS_PATH)/docker-fpm-gobgp +$(DOCKER_FPM_GOBGP)_DEPENDS += $(GOBGP) +$(DOCKER_FPM_GOBGP)_LOAD_DOCKERS += $(DOCKER_FPM) +SONIC_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP) + +$(DOCKER_FPM_GOBGP)_CONTAINER_NAME = bgp +$(DOCKER_FPM_GOBGP)_RUN_OPT += --net=host --privileged -t +$(DOCKER_FPM_GOBGP)_RUN_OPT += --volumes-from database +$(DOCKER_FPM_GOBGP)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + diff --git a/rules/gobgp.mk b/rules/gobgp.mk new file mode 100644 index 000000000000..5ce566f7b630 --- /dev/null +++ b/rules/gobgp.mk @@ -0,0 +1,5 @@ +# gobgp package + +GOBGP = gobgp_1.16-01_amd64.deb +$(GOBGP)_SRC_PATH = $(SRC_PATH)/gobgp +SONIC_DPKG_DEBS += $(GOBGP) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 03f38a06c2ca..b436c5199d84 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -6,6 +6,7 @@ RUN echo "deb http://debian-archive.trafficmanager.net/debian/ jessie main contr RUN echo "deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list RUN echo "deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list RUN echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list +RUN echo 'deb http://debian-archive.trafficmanager.net/debian jessie-backports main' >> /etc/apt/sources.list ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -70,6 +71,9 @@ RUN apt-get update && apt-get install -y dkms # For python3.5 build RUN apt-get update && apt-get install -y sharutils libncursesw5-dev libbz2-dev liblzma-dev libgdbm-dev tk-dev blt-dev libmpdec-dev libbluetooth-dev locales libsqlite3-dev libgpm2 time net-tools xvfb python-sphinx python3-sphinx +# For gobgp build +RUN apt-get -yt jessie-backports install golang-go + RUN mkdir /var/run/sshd EXPOSE 22 diff --git a/src/gobgp/Makefile b/src/gobgp/Makefile new file mode 100644 index 000000000000..ec0bdc74f034 --- /dev/null +++ b/src/gobgp/Makefile @@ -0,0 +1,23 @@ +export GOPATH=/tmp/go + +INSTALL := /usr/bin/install + +all: gobgp gobgpd + +gobgpd: + go get -v github.com/osrg/gobgp/gobgpd + +gobgp: + go get -v github.com/osrg/gobgp/gobgp + +install: + $(INSTALL) -D ${GOPATH}/bin/gobgp $(DESTDIR)/usr/bin/gobgp + $(INSTALL) -D ${GOPATH}/bin/gobgpd $(DESTDIR)/usr/sbin/gobgpd + $(INSTALL) -D gobgpd.conf.sample $(DESTDIR)/etc/gobgp/gobgpd.conf.sample + +deinstall: + rm $(DESTDIR)/usr/bin/gobgp + rm $(DESTDIR)/usr/sbin/gobgpd + +clean: + rm -fr ${GOPATH} diff --git a/src/gobgp/debian/changelog b/src/gobgp/debian/changelog new file mode 100644 index 000000000000..ba412cc45ede --- /dev/null +++ b/src/gobgp/debian/changelog @@ -0,0 +1,5 @@ +gobgp (1.16-01) UNRELEASED; urgency=low + + * Initial release. + + -- Pavel Shirshov Sat, 25 Feb 2017 00:25:19 +0000 diff --git a/src/gobgp/debian/compat b/src/gobgp/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/src/gobgp/debian/compat @@ -0,0 +1 @@ +9 diff --git a/src/gobgp/debian/control b/src/gobgp/debian/control new file mode 100644 index 000000000000..7d534852a383 --- /dev/null +++ b/src/gobgp/debian/control @@ -0,0 +1,12 @@ +Source: gobgp +Maintainer: Pavel Shirshov +Build-Depends: debhelper (>= 8.0.0), + dh-systemd +Standards-Version: 3.9.3 +Section: net + +Package: gobgp +Priority: extra +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: gobgp BGP daemon diff --git a/src/gobgp/debian/gobgp.dirs b/src/gobgp/debian/gobgp.dirs new file mode 100644 index 000000000000..3e9f1c594d41 --- /dev/null +++ b/src/gobgp/debian/gobgp.dirs @@ -0,0 +1 @@ +etc/gobgp diff --git a/src/gobgp/debian/gobgp.init.d b/src/gobgp/debian/gobgp.init.d new file mode 100644 index 000000000000..189fdad05690 --- /dev/null +++ b/src/gobgp/debian/gobgp.init.d @@ -0,0 +1,50 @@ +#!/bin/bash +# +### BEGIN INIT INFO +# Provides: gobgp +# Required-Start: $local_fs $network $remote_fs $syslog +# Required-Stop: $local_fs $network $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: start and stop the gobgpd +# Description: gobgpd is an implementation of bgp daemon in Go +### END INIT INFO +# + +PATH=/bin:/usr/bin:/sbin:/usr/sbin +D_PATH=/usr/sbin +C_PATH=/etc/gobgp + +. /lib/lsb/init-functions + +######################################################### +# Main program # +######################################################### + +case "$1" in + start) + if [ -f /etc/gobgp/gobgpd.conf ] + then + /usr/sbin/gobgpd -f /etc/gobgp/gobgpd.conf -r + echo $! > /var/run/gobgpd.pid + else + echo /etc/gobgp/gobgpd.conf not found + fi + ;; + + stop) + kill -9 $(echo /var/run/gobgpd.pid) + ;; + + restart|force-reload) + $0 stop $2 + sleep 1 + $0 start $2 + ;; + *) + echo "Usage: /etc/init.d/gobgp {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/src/gobgp/debian/gobgp.service b/src/gobgp/debian/gobgp.service new file mode 100644 index 000000000000..68a0b595aa1d --- /dev/null +++ b/src/gobgp/debian/gobgp.service @@ -0,0 +1,16 @@ +[Unit] +Description=gobgp service +After=network.target +ConditionPathExists=/etc/gobgp/gobgpd.yml + +[Service] +EnvironmentFile=-/etc/default/gobgp +ExecStart=/usr/sbin/gobgpd $DAEMON_ARGS +#ExecReload=/bin/kill -HUP $MAINPID +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target +Alias=gobgpd.service + diff --git a/src/gobgp/debian/rules b/src/gobgp/debian/rules new file mode 100755 index 000000000000..b6bee2ee4e76 --- /dev/null +++ b/src/gobgp/debian/rules @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +%: + dh $@ --with systemd diff --git a/src/gobgp/gobgpd.conf.sample b/src/gobgp/gobgpd.conf.sample new file mode 100644 index 000000000000..c308df15be2c --- /dev/null +++ b/src/gobgp/gobgpd.conf.sample @@ -0,0 +1,21 @@ +[global.config] + as = 65501 + router-id = "192.168.0.1" +[[neighbors]] + [neighbors.config] + peer-as = 65502 + neighbor-address = "192.168.0.2" + [neighbors.graceful-restart.config] + enabled = true + restart-time = 120 + [[neighbors.afi-safis]] + [neighbors.afi-safis.config] + afi-safi-name = "ipv4-unicast" + [neighbors.afi-safis.mp-graceful-restart.config] + enabled = true + +[zebra] + [zebra.config] + enabled = true + url = "unix:/var/run/quagga/zserv.api" + redistribute-route-type-list = ["connect"] From 4eb549d36fdfe59fb41015fa9432da672d574c80 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 2 Mar 2017 12:17:04 -0800 Subject: [PATCH 0333/1833] [sonic_cli]: Fix bash completion for 'show' command (#355) --- .../build_templates/sonic_debian_extension.j2 | 4 ++ files/image_config/bash/bash.bashrc | 57 +++++++++++++++++++ src/sonic-utilities | 2 +- 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 files/image_config/bash/bash.bashrc diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index eaab6af01614..276fa2ef30f6 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -70,6 +70,10 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# SONiC utilities installs bash-completion as a dependency. However, it is disabled by default +# in bash.bashrc, so we copy a version of the file with it enabled here. +sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ + # Install SONiC Device Data (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-device-data_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f diff --git a/files/image_config/bash/bash.bashrc b/files/image_config/bash/bash.bashrc new file mode 100644 index 000000000000..b531c88a0601 --- /dev/null +++ b/files/image_config/bash/bash.bashrc @@ -0,0 +1,57 @@ +# System-wide .bashrc file for interactive bash(1) shells. + +# To enable the settings / commands in this file for login shells as well, +# this file has to be sourced in /etc/profile. + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, overwrite the one in /etc/profile) +PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' + +# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default. +# If this is an xterm set the title to user@host:dir +#case "$TERM" in +#xterm*|rxvt*) +# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' +# ;; +#*) +# ;; +#esac + +# enable bash completion in interactive shells +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +# if the command-not-found package is installed, use it +if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then + function command_not_found_handle { + # check because c-n-f could've been removed in the meantime + if [ -x /usr/lib/command-not-found ]; then + /usr/lib/command-not-found -- "$1" + return $? + elif [ -x /usr/share/command-not-found/command-not-found ]; then + /usr/share/command-not-found/command-not-found -- "$1" + return $? + else + printf "%s: command not found\n" "$1" >&2 + return 127 + fi + } +fi + + diff --git a/src/sonic-utilities b/src/sonic-utilities index 07a8b3ab377f..cca83512018c 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 07a8b3ab377f4ceb2ad84c82dcdbb0e592a70b4c +Subproject commit cca83512018cd48a193a7f8f3d0676c8053bcc2d From 667ef1d766510e6d2173dfe99e420cbe7da95857 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 2 Mar 2017 13:34:37 -0800 Subject: [PATCH 0334/1833] [libteam]: Add 0002-libteam-Temporarily-remove-redundant-debug-mes.patch (#357) Signed-off-by: Shuotian Cheng --- ...mporarily-remove-redundant-debug-mes.patch | 25 +++++++++++++++++++ src/libteam/Makefile | 1 + 2 files changed, 26 insertions(+) create mode 100644 src/libteam/0002-libteam-Temporarily-remove-redundant-debug-mes.patch diff --git a/src/libteam/0002-libteam-Temporarily-remove-redundant-debug-mes.patch b/src/libteam/0002-libteam-Temporarily-remove-redundant-debug-mes.patch new file mode 100644 index 000000000000..a640f40e6e07 --- /dev/null +++ b/src/libteam/0002-libteam-Temporarily-remove-redundant-debug-mes.patch @@ -0,0 +1,25 @@ +From a5c8f3f41c575ebb7018e67cb3d1f724f0685850 Mon Sep 17 00:00:00 2001 +From: Shuotian Cheng +Date: Mon, 27 Feb 2017 14:21:09 -0800 +Subject: [PATCH] libteam: Temporarily remove redundant debug messages + +--- + teamd/teamd_runner_lacp.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 9c77fae..5e37a4c 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -922,8 +922,6 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) + state |= INFO_STATE_DEFAULTED; + if (teamd_port_count(lacp_port->ctx) > 0) + state |= INFO_STATE_AGGREGATION; +- teamd_log_dbg("%s: lacp info state: 0x%02X.", lacp_port->tdport->ifname, +- state); + lacp_port->actor.state = state; + } + +-- +2.1.4 + diff --git a/src/libteam/Makefile b/src/libteam/Makefile index e6864596c98d..c2b8a09cff6f 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -16,6 +16,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Apply patch git apply ../0001-libteam-Add-team_get_port_enabled-function.patch + git apply ../0002-libteam-Temporarily-remove-redundant-debug-mes.patch popd # Obtain debian packaging From f06dc5d3f9d20e7daf0d7c660e83b1ba7b780557 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 2 Mar 2017 15:59:16 -0800 Subject: [PATCH 0335/1833] [teamd]: Update the start.sh script to clean up the docker state (#351) This change should be temporary because the current teamd cannot re-create net devices acrosss restart. Basically, it will fail when there're files in /var/run/teamd/ folder or the previously created net devices are still there. Thus, the current workaround is to remove the obsolete files to restart the docker-teamd. This workaround cannot resolve the swss restart issue. Before restarting swss, docker teamd needs to be stopped manually. After swss starts, docker teamd needs to be restarted manually. This change will only make sure that rebooting the switch will make the switch at the correct state. Signed-off-by: Shuotian Cheng --- dockers/docker-teamd/start.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index 268217272f6e..e68b3ed00b8f 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -2,9 +2,17 @@ TEAMD_CONF_PATH=/etc/teamd +# Before teamd could automatically add newly created host interfaces into the +# LAG, this workaround will be needed. It will remove the obsolete files and +# net devices that are failed to be removed in the previous run. function start_app { + # Remove *.pid and *.sock files if there are any + rm -f /var/run/teamd/* if [ -d $TEAMD_CONF_PATH ]; then for f in $TEAMD_CONF_PATH/*; do + # Remove netdevs if there are any + intf=`echo $f | awk -F'[/.]' '{print $4}'` + ip link del $intf teamd -f $f -d done fi From d3891a2a42e33f0de5320c4499997932b11c6d0d Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 2 Mar 2017 16:04:18 -0800 Subject: [PATCH 0336/1833] Keep pip in the debian image (#356) --- build_debian.sh | 4 ++-- files/build_templates/sonic_debian_extension.j2 | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 16f31f980ada..85126bf34e89 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -166,6 +166,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ ## Note: gdisk is needed for sgdisk in install.sh ## Note: parted is needed for partprobe in install.sh ## Note: ca-certificates is needed for easy_install +## Note: don't install python-apt by pip, older than Debian repo one sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ file \ ifupdown \ @@ -232,8 +233,7 @@ set /files/etc/sysctl.conf/net.ipv6.conf.all.accept_dad 0 ## docker-py is needed by Ansible docker module sudo LANG=C chroot $FILESYSTEM_ROOT easy_install pip sudo LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0' -## Remove pip which is unnecessary in the base image -sudo LANG=C chroot $FILESYSTEM_ROOT pip uninstall -y pip +## Note: keep pip installed for maintainance purpose ## Config DHCP for eth0 sudo tee -a $FILESYSTEM_ROOT/etc/network/interfaces > /dev/null < Date: Thu, 2 Mar 2017 18:07:43 -0800 Subject: [PATCH 0337/1833] [teamd]: Add redis-tools as the dependency of docker-teamd and fix bugs (#363) - Fix the if condition bug to wait till PORT_TABLE:ConfigDone before start Signed-off-by: Shuotian Cheng --- dockers/docker-teamd/Dockerfile.j2 | 4 ++++ dockers/docker-teamd/start.sh | 2 +- rules/docker-teamd.mk | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 32e302971ed2..b3f35dd3c2e5 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -2,6 +2,10 @@ FROM docker-config-engine RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 +## Install redis-tools dependencies +## TODO: implicitly install dependencies +RUN apt-get -y install libjemalloc1 + COPY \ {% for deb in docker_teamd_debs.split(' ') -%} debs/{{ deb }}{{' '}} diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index e68b3ed00b8f..6ea5eb01b328 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -36,7 +36,7 @@ service rsyslog start while true; do # Check if front-panel ports are configured result=`echo -en "SELECT 0\nHGETALL PORT_TABLE:ConfigDone" | redis-cli | sed -n 3p` - if [ "$result" != "0" ]; then + if [ "$result" == "0" ]; then start_app read fi diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index f023c3598fa1..14038fcd0381 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -2,7 +2,7 @@ DOCKER_TEAMD = docker-teamd.gz $(DOCKER_TEAMD)_PATH = $(DOCKERS_PATH)/docker-teamd -$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) +$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(REDIS_TOOLS) $(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD) From 80e3dc0df7711429b3d28512730e4711ca19db51 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 2 Mar 2017 23:53:20 -0800 Subject: [PATCH 0338/1833] [device]: add missing sai profile and minigraph for the supported devices (#362) change orchagent start.sh to use mounted hwsku directory --- .../AS7512-C32/port_config.ini | 33 + .../AS7512-C32/sai.profile | 2 + .../AS7512-S128/port_config.ini | 129 ++ .../AS7512-S128/sai.profile | 2 + .../AS7512/sai.profile | 2 + .../x86_64-accton_as7512_32x-r0/minigraph.xml | 140 +-- .../Arista-7060-CX32S/sai.profile | 1 + .../x86_64-arista_7060_cx32s/minigraph.xml | 1049 +++++++++++++++++ .../x86_64-dell_s6100_c2538-r0/minigraph.xml | 744 ++++++++++++ .../INGRASYS-S9100-C32/sai.profile | 1 + .../INGRASYS-S9100-C32/syncd.conf | 1 + dockers/docker-orchagent/start.sh | 6 +- files/build_templates/sonic_version.yml.j2 | 2 + 13 files changed, 2038 insertions(+), 74 deletions(-) create mode 100644 device/accton/x86_64-accton_as7512_32x-r0/AS7512-C32/port_config.ini create mode 100644 device/accton/x86_64-accton_as7512_32x-r0/AS7512-C32/sai.profile create mode 100644 device/accton/x86_64-accton_as7512_32x-r0/AS7512-S128/port_config.ini create mode 100644 device/accton/x86_64-accton_as7512_32x-r0/AS7512-S128/sai.profile create mode 100644 device/accton/x86_64-accton_as7512_32x-r0/AS7512/sai.profile create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile create mode 100644 device/arista/x86_64-arista_7060_cx32s/minigraph.xml create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf diff --git a/device/accton/x86_64-accton_as7512_32x-r0/AS7512-C32/port_config.ini b/device/accton/x86_64-accton_as7512_32x-r0/AS7512-C32/port_config.ini new file mode 100644 index 000000000000..c10cd2786941 --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/AS7512-C32/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 16,17,18,19 +Ethernet4 20,21,22,23 +Ethernet8 24,25,26,27 +Ethernet12 28,29,30,31 +Ethernet16 32,33,34,35 +Ethernet20 36,37,38,39 +Ethernet24 40,41,42,43 +Ethernet28 44,45,46,47 +Ethernet32 0,1,2,3 +Ethernet36 4,5,6,7 +Ethernet40 8,9,10,11 +Ethernet44 12,13,14,15 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 127,126,125,124 +Ethernet68 123,122,121,120 +Ethernet72 115,114,113,112 +Ethernet76 119,118,117,116 +Ethernet80 79,78,77,76 +Ethernet84 75,74,73,72 +Ethernet88 64,65,66,67 +Ethernet92 71,70,68,69 +Ethernet96 111,110,109,108 +Ethernet100 107,106,105,104 +Ethernet104 103,102,101,100 +Ethernet108 99,98,97,96 +Ethernet112 95,94,93,92 +Ethernet116 91,90,89,88 +Ethernet120 87,86,85,84 +Ethernet124 83,82,81,80 diff --git a/device/accton/x86_64-accton_as7512_32x-r0/AS7512-C32/sai.profile b/device/accton/x86_64-accton_as7512_32x-r0/AS7512-C32/sai.profile new file mode 100644 index 000000000000..457c339c58ab --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/AS7512-C32/sai.profile @@ -0,0 +1,2 @@ +mode=3 +hwId=as7512 diff --git a/device/accton/x86_64-accton_as7512_32x-r0/AS7512-S128/port_config.ini b/device/accton/x86_64-accton_as7512_32x-r0/AS7512-S128/port_config.ini new file mode 100644 index 000000000000..c3b669950405 --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/AS7512-S128/port_config.ini @@ -0,0 +1,129 @@ +# name lanes +Ethernet1 0 +Ethernet2 1 +Ethernet3 2 +Ethernet4 3 +Ethernet5 4 +Ethernet6 5 +Ethernet7 6 +Ethernet8 7 +Ethernet9 8 +Ethernet10 9 +Ethernet11 10 +Ethernet12 11 +Ethernet13 12 +Ethernet14 13 +Ethernet15 14 +Ethernet16 15 +Ethernet17 16 +Ethernet18 17 +Ethernet19 18 +Ethernet20 19 +Ethernet21 20 +Ethernet22 21 +Ethernet23 22 +Ethernet24 23 +Ethernet25 24 +Ethernet26 25 +Ethernet27 26 +Ethernet28 27 +Ethernet29 28 +Ethernet30 29 +Ethernet31 30 +Ethernet32 31 +Ethernet33 32 +Ethernet34 33 +Ethernet35 34 +Ethernet36 35 +Ethernet37 36 +Ethernet38 37 +Ethernet39 38 +Ethernet40 39 +Ethernet41 40 +Ethernet42 41 +Ethernet43 42 +Ethernet44 43 +Ethernet45 44 +Ethernet46 45 +Ethernet47 46 +Ethernet48 47 +Ethernet49 48 +Ethernet50 49 +Ethernet51 50 +Ethernet52 51 +Ethernet53 52 +Ethernet54 53 +Ethernet55 54 +Ethernet56 55 +Ethernet57 56 +Ethernet58 57 +Ethernet59 58 +Ethernet60 59 +Ethernet61 60 +Ethernet62 61 +Ethernet63 62 +Ethernet64 63 +Ethernet65 64 +Ethernet66 65 +Ethernet67 66 +Ethernet68 67 +Ethernet69 68 +Ethernet70 69 +Ethernet71 70 +Ethernet72 71 +Ethernet73 72 +Ethernet74 73 +Ethernet75 74 +Ethernet76 75 +Ethernet77 76 +Ethernet78 77 +Ethernet79 78 +Ethernet80 79 +Ethernet81 80 +Ethernet82 81 +Ethernet83 82 +Ethernet84 83 +Ethernet85 84 +Ethernet86 85 +Ethernet87 86 +Ethernet88 87 +Ethernet89 88 +Ethernet90 89 +Ethernet91 90 +Ethernet92 91 +Ethernet93 92 +Ethernet94 93 +Ethernet95 94 +Ethernet96 95 +Ethernet97 96 +Ethernet98 97 +Ethernet99 98 +Ethernet100 99 +Ethernet101 100 +Ethernet102 101 +Ethernet103 102 +Ethernet104 103 +Ethernet105 104 +Ethernet106 105 +Ethernet107 106 +Ethernet108 107 +Ethernet109 108 +Ethernet110 109 +Ethernet111 110 +Ethernet112 111 +Ethernet113 112 +Ethernet114 113 +Ethernet115 114 +Ethernet116 115 +Ethernet117 116 +Ethernet118 117 +Ethernet119 118 +Ethernet120 119 +Ethernet121 120 +Ethernet122 121 +Ethernet123 122 +Ethernet124 123 +Ethernet125 124 +Ethernet126 125 +Ethernet127 126 +Ethernet128 127 diff --git a/device/accton/x86_64-accton_as7512_32x-r0/AS7512-S128/sai.profile b/device/accton/x86_64-accton_as7512_32x-r0/AS7512-S128/sai.profile new file mode 100644 index 000000000000..471c4395758f --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/AS7512-S128/sai.profile @@ -0,0 +1,2 @@ +mode=0 +hwId=as7512 diff --git a/device/accton/x86_64-accton_as7512_32x-r0/AS7512/sai.profile b/device/accton/x86_64-accton_as7512_32x-r0/AS7512/sai.profile new file mode 100644 index 000000000000..017996f7d7cc --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/AS7512/sai.profile @@ -0,0 +1,2 @@ +mode=1 +hwId=as7512 diff --git a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml index 0fbd853220b2..42bb951add3a 100644 --- a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch2 + switch1 10.0.0.32 1 180 60 - switch2 + switch1 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch2 + switch1 10.0.0.34 1 180 60 - switch2 + switch1 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch2 + switch1 10.0.0.36 1 180 60 - switch2 + switch1 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch2 + switch1 10.0.0.38 1 180 60 - switch2 + switch1 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch2 + switch1 10.0.0.40 1 180 60 - switch2 + switch1 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch2 + switch1 10.0.0.42 1 180 60 - switch2 + switch1 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch2 + switch1 10.0.0.44 1 180 60 - switch2 + switch1 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch2 + switch1 10.0.0.46 1 180 60 - switch2 + switch1 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch2 + switch1 10.0.0.48 1 180 60 - switch2 + switch1 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch2 + switch1 10.0.0.50 1 180 60 - switch2 + switch1 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch2 + switch1 10.0.0.52 1 180 60 - switch2 + switch1 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch2 + switch1 10.0.0.54 1 180 60 - switch2 + switch1 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch2 + switch1 10.0.0.56 1 180 60 - switch2 + switch1 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch2 + switch1 10.0.0.58 1 180 60 - switch2 + switch1 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch2 + switch1 10.0.0.60 1 180 60 - switch2 + switch1 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch2 + switch1 10.0.0.62 1 180 60 - switch2 + switch1 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch2 + switch1
10.0.0.33
@@ -639,7 +639,7 @@ - switch2 + switch1 @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch2 + switch1 Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch2 + switch1 Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,11 +1039,11 @@ - switch2 - ACS-MSN2700 + switch1 + AS7512 - switch2 - ACS-MSN2700 + switch1 + AS7512 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile new file mode 100644 index 000000000000..29a42f07a734 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x100G.config.bcm diff --git a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml new file mode 100644 index 000000000000..3fcd713cbc79 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml @@ -0,0 +1,1049 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + Ethernet1/1 + 10.0.0.0/31 + + + + Ethernet2/1 + 10.0.0.2/31 + + + + Ethernet3/1 + 10.0.0.4/31 + + + + Ethernet4/1 + 10.0.0.6/31 + + + + Ethernet5/1 + 10.0.0.8/31 + + + + Ethernet6/1 + 10.0.0.10/31 + + + + Ethernet7/1 + 10.0.0.12/31 + + + + Ethernet8/1 + 10.0.0.14/31 + + + + Ethernet9/1 + 10.0.0.16/31 + + + + Ethernet10/1 + 10.0.0.18/31 + + + + Ethernet11/1 + 10.0.0.20/31 + + + + Ethernet12/1 + 10.0.0.22/31 + + + + Ethernet13/1 + 10.0.0.24/31 + + + + Ethernet14/1 + 10.0.0.26/31 + + + + Ethernet15/1 + 10.0.0.28/31 + + + + Ethernet16/1 + 10.0.0.30/31 + + + + Ethernet17/1 + 10.0.0.32/31 + + + + Ethernet18/1 + 10.0.0.34/31 + + + + Ethernet19/1 + 10.0.0.36/31 + + + + Ethernet20/1 + 10.0.0.38/31 + + + + Ethernet21/1 + 10.0.0.40/31 + + + + Ethernet22/1 + 10.0.0.42/31 + + + + Ethernet23/1 + 10.0.0.44/31 + + + + Ethernet24/1 + 10.0.0.46/31 + + + + Ethernet25/1 + 10.0.0.48/31 + + + + Ethernet26/1 + 10.0.0.50/31 + + + + Ethernet27/1 + 10.0.0.52/31 + + + + Ethernet28/1 + 10.0.0.54/31 + + + + Ethernet29/1 + 10.0.0.56/31 + + + + Ethernet30/1 + 10.0.0.58/31 + + + + Ethernet31/1 + 10.0.0.60/31 + + + + Ethernet32/1 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet1/1 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet2/1 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet3/1 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4/1 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet5/1 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet6/1 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet7/1 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8/1 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet9/1 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet10/1 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet11/1 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12/1 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet13/1 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet14/1 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet15/1 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16/1 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet17/1 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet18/1 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet19/1 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20/1 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet21/1 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet22/1 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet23/1 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24/1 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet25/1 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet26/1 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet27/1 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28/1 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet29/1 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet30/1 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet31/1 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet32/1 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Arista-7060-CX32S + + + + switch1 + Arista-7060-CX32S +
diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml new file mode 100644 index 000000000000..e07ec53e18e9 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml @@ -0,0 +1,744 @@ + + + + + + ARISTA01T1 + 10.0.0.1 + switch1 + 10.0.0.0 + 1 + 180 + 60 + + + ARISTA02T1 + 10.0.0.5 + switch1 + 10.0.0.4 + 1 + 180 + 60 + + + ARISTA03T1 + 10.0.0.9 + switch1 + 10.0.0.8 + 1 + 180 + 60 + + + ARISTA04T1 + 10.0.0.13 + switch1 + 10.0.0.12 + 1 + 180 + 60 + + + ARISTA01T1 + FC00::2 + switch1 + FC00::1 + 1 + 180 + 60 + + + ARISTA02T1 + FC00::A + switch1 + FC00::9 + 1 + 180 + 60 + + + ARISTA03T1 + FC00::12 + switch1 + FC00::11 + 1 + 180 + 60 + + + ARISTA04T1 + FC00::1A + switch1 + FC00::19 + 1 + 180 + 60 + + + + + 64601 + switch1 + + + BGPPeer +
10.0.0.1
+ + + +
+ + BGPPeer +
10.0.0.5
+ + + +
+ + BGPPeer +
10.0.0.9
+ + + +
+ + BGPPeer +
10.0.0.13
+ + + +
+ + BGPPeer +
FC00::2
+ + + +
+ + BGPPeer +
FC00::A
+ + + +
+ + BGPPeer +
FC00::12
+ + + +
+ + BGPPeer +
FC00::1A
+ + + +
+
+ +
+ + 64802 + ARISTA01T1 + + + + 64802 + ARISTA02T1 + + + + 64802 + ARISTA03T1 + + + + 64802 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + + + + switch1 + + + PortChannelInterface + PortChannel1 + fortyGigE1/1/1;fortyGigE1/1/2 + + + + PortChannelInterface + PortChannel5 + fortyGigE1/1/5;fortyGigE1/1/6 + + + + PortChannelInterface + PortChannel16 + fortyGigE1/2/1;fortyGigE1/2/2 + + + + PortChannelInterface + PortChannel20 + fortyGigE1/2/5;fortyGigE1/2/6 + + + + + + VlanInterface + Vlan2 + fortyGigE1/1/7;fortyGigE1/1/8;fortyGigE1/1/9;fortyGigE1/1/10;fortyGigE1/1/11;fortyGigE1/1/12;fortyGigE1/1/13;fortyGigE1/1/14;fortyGigE1/1/15;fortyGigE1/1/16;fortyGigE1/3/1;fortyGigE1/3/5;fortyGigE1/3/6;fortyGigE1/3/7;fortyGigE1/3/8;fortyGigE1/3/9;fortyGigE1/3/10;fortyGigE1/3/11;fortyGigE1/2/7;fortyGigE1/2/8;fortyGigE1/2/9;fortyGigE1/2/10;fortyGigE1/2/11;fortyGigE1/2/12;fortyGigE1/2/13;fortyGigE1/2/14;fortyGigE1/2/15;fortyGigE1/2/16;fortyGigE1/4/1;fortyGigE1/4/5;fortyGigE1/4/6;fortyGigE1/4/7;fortyGigE1/4/8;fortyGigE1/4/9;fortyGigE1/4/10;fortyGigE1/4/11 + False + 0.0.0.0/0 + + 2 + 2 + 172.0.0.0/26 + + + + + IPInterface + + PortChannel1 + 10.0.0.0/31 + + + IPInterface + + PortChannel5 + 10.0.0.4/31 + + + IPInterface + + PortChannel16 + 10.0.0.8/31 + + + IPInterface + + PortChannel20 + 10.0.0.12/31 + + + IPInterface + + PortChannel1 + FC00::1/126 + + + IPInterface + + PortChannel5 + FC00::9/126 + + + IPInterface + + PortChannel16 + FC00::11/126 + + + IPInterface + + PortChannel20 + FC00::19/126 + + + IPInterface + + Vlan2 + 172.0.0.1/26 + + + + + + + + + + + + DeviceInterfaceLink + true + 40000 + ARISTA01T1 + Ethernet1 + true + switch1 + fortyGigE1/1/1 + + + DeviceInterfaceLink + true + 40000 + ARISTA01T1 + Ethernet2 + true + switch1 + fortyGigE1/1/2 + + + DeviceInterfaceLink + true + 40000 + ARISTA02T1 + Ethernet1 + true + switch1 + fortyGigE1/1/5 + + + DeviceInterfaceLink + true + 40000 + ARISTA02T1 + Ethernet2 + true + switch1 + fortyGigE1/1/6 + + + DeviceInterfaceLink + true + 40000 + ARISTA03T1 + Ethernet1 + true + switch1 + fortyGigE1/2/1 + + + DeviceInterfaceLink + true + 40000 + ARISTA03T1 + Ethernet2 + true + switch1 + fortyGigE1/2/2 + + + DeviceInterfaceLink + true + 40000 + ARISTA04T1 + Ethernet1 + true + switch1 + fortyGigE1/2/5 + + + DeviceInterfaceLink + true + 40000 + ARISTA04T1 + Ethernet2 + true + switch1 + fortyGigE1/2/6 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/1/7 + true + server-01 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/1/8 + true + server-02 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/1/9 + true + server-03 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/1/10 + true + server-04 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/1/11 + true + server-05 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/1/12 + true + server-06 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/1/13 + true + server-07 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/1/14 + true + server-08 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/1/15 + true + server-09 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/1/16 + true + server-10 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/3/1 + true + server-11 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/3/5 + true + server-12 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/3/6 + true + server-13 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/3/7 + true + server-14 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/3/8 + true + server-15 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/3/9 + true + server-16 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/3/10 + true + server-17 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/3/11 + true + server-18 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/2/7 + true + server-19 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/2/8 + true + server-20 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/2/9 + true + server-21 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/2/10 + true + server-22 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/2/11 + true + server-23 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/2/12 + true + server-24 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/2/13 + true + server-25 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/2/14 + true + server-26 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/2/15 + true + server-27 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/2/16 + true + server-28 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/4/1 + true + server-29 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/4/5 + true + server-30 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/4/6 + true + server-31 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/4/7 + true + server-32 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/4/8 + true + server-33 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/4/9 + true + server-34 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/4/10 + true + server-35 + 0 + + + DeviceInterfaceLink + true + 40000 + switch1 + fortyGigE1/4/11 + true + server-36 + 0 + + + + + switch1 + Force10-S6100 + + + + switch1 + Force10-S6100 +
diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile new file mode 100644 index 000000000000..1b6009956e90 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-ingrasys-s9100-32x100G.config.bcm diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf new file mode 100644 index 000000000000..1b197345d308 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf @@ -0,0 +1 @@ +OPENNSL_CONFIG_POST_INIT_FILE=/etc/bcm/th-ingrasys-s9100-32x100G.soc diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index af7f2f321a0a..6e05782b3d75 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -23,15 +23,13 @@ function clean_up { trap clean_up SIGTERM SIGKILL -. /host/machine.conf - HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` ORCHAGENT_ARGS="" -PORTSYNCD_ARGS="-p /usr/share/sonic/$HWSKU/port_config.ini" +PORTSYNCD_ARGS="-p /usr/share/sonic/hwsku/port_config.ini" SWSSCONFIG_ARGS="00-copp.config.json " @@ -49,7 +47,7 @@ elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "AS7512" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "ingrasys-s9100" ]; then +elif [ "$HWSKU" == "INGRASYS-S9100-C32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "ACS-MSN2700" ]; then SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " diff --git a/files/build_templates/sonic_version.yml.j2 b/files/build_templates/sonic_version.yml.j2 index 54eb904a1614..6eb8a6d6c5e4 100644 --- a/files/build_templates/sonic_version.yml.j2 +++ b/files/build_templates/sonic_version.yml.j2 @@ -1,3 +1,5 @@ build_version: {{git_revision}} debian_version: {{debian_version}} kernel_version: {{kernel_version}} +asic_type: {{sonic_asic_platform}} + From 0f845998bb1d7cecd6a12da0ffdc8014a59b62f7 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 3 Mar 2017 01:33:44 -0800 Subject: [PATCH 0339/1833] [sonic-slave]: fix thrift test break introduced in #358 (#364) --- sonic-slave/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index b436c5199d84..f1d68c680cb8 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -72,7 +72,7 @@ RUN apt-get update && apt-get install -y dkms RUN apt-get update && apt-get install -y sharutils libncursesw5-dev libbz2-dev liblzma-dev libgdbm-dev tk-dev blt-dev libmpdec-dev libbluetooth-dev locales libsqlite3-dev libgpm2 time net-tools xvfb python-sphinx python3-sphinx # For gobgp build -RUN apt-get -yt jessie-backports install golang-go +RUN apt-get -yt jessie-backports install golang-go golang-github-golang-mock-dev RUN mkdir /var/run/sshd EXPOSE 22 From ba0f19ad549d71fbe61ef631364f389ecfc44c8d Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 3 Mar 2017 12:26:44 +0200 Subject: [PATCH 0340/1833] [build_debuian]: Fix issue #267 (docker connect failure). (#365) --- files/build_templates/sonic_debian_extension.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 6b323a3220c2..c84518576f17 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -37,7 +37,6 @@ trap_push clean_sys sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs sudo chroot $FILESYSTEM_ROOT service docker start -sudo chroot $FILESYSTEM_ROOT docker version # Apply apt configuration files sudo cp $IMAGE_CONFIGS/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ From aed03d6dd5650e64432a38ef54765efc9075511d Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 3 Mar 2017 08:43:22 -0800 Subject: [PATCH 0341/1833] [gobgp]: do not install docker-fpm-gobgp into one image (#366) * [gobgp]: do not install docker-fpm-gobgp into one image but build docker-fpm-gobgp on different platforms --- platform/broadcom/rules.mk | 3 ++- platform/cavium/rules.mk | 3 ++- platform/mellanox/rules.mk | 3 ++- rules/docker-fpm-gobgp.mk | 1 - 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index d9dc0eccc1da..37e18ba80285 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -17,7 +17,8 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) -SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) +SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ + $(DOCKER_FPM_GOBGP) # Inject brcm sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 6fb9d8c267ef..05312066719f 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -4,7 +4,8 @@ include $(PLATFORM_PATH)/docker-orchagent-cavm.mk include $(PLATFORM_PATH)/cavm_platform_modules.mk include $(PLATFORM_PATH)/one-image.mk -SONIC_ALL += $(SONIC_ONE_IMAGE) +SONIC_ALL += $(SONIC_ONE_IMAGE) \ + $(DOCKER_FPM_GOBGP) # Inject cavium sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 2c10cf3337c8..8bcb8d0278b4 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -7,7 +7,8 @@ include $(PLATFORM_PATH)/docker-syncd-mlnx.mk include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk include $(PLATFORM_PATH)/one-image.mk -SONIC_ALL += $(SONIC_ONE_IMAGE) +SONIC_ALL += $(SONIC_ONE_IMAGE) \ + $(DOCKER_FPM_GOBGP) # Inject mlnx sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) diff --git a/rules/docker-fpm-gobgp.mk b/rules/docker-fpm-gobgp.mk index eb9406ec0ba4..78bf1b840a2b 100644 --- a/rules/docker-fpm-gobgp.mk +++ b/rules/docker-fpm-gobgp.mk @@ -5,7 +5,6 @@ $(DOCKER_FPM_GOBGP)_PATH = $(DOCKERS_PATH)/docker-fpm-gobgp $(DOCKER_FPM_GOBGP)_DEPENDS += $(GOBGP) $(DOCKER_FPM_GOBGP)_LOAD_DOCKERS += $(DOCKER_FPM) SONIC_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP) $(DOCKER_FPM_GOBGP)_CONTAINER_NAME = bgp $(DOCKER_FPM_GOBGP)_RUN_OPT += --net=host --privileged -t From 0993ac2188035263833f353c8ef05f3757a52be8 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 3 Mar 2017 08:44:11 -0800 Subject: [PATCH 0342/1833] [swss]: add swssloglevel to change level log on-the-fly (#367) add swssloglevel to change level log on-the-fly and simplify syncd start logic on multiple platforms --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 144bbbac5b1a..22ea540f50dc 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 144bbbac5b1a9c3167ae6ecd94ff7bdffd3b869e +Subproject commit 22ea540f50dc05b6320b0f00f769bc5be0b2a9d3 diff --git a/src/sonic-swss b/src/sonic-swss index 9f0351815aef..dc33b7549e57 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 9f0351815aef8798a1367ef6e60e006156d7d190 +Subproject commit dc33b7549e57719d7855b1f7929b38b9b519072b diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 31a6b40089ef..b1c829a0b2f4 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 31a6b40089efd42c895604b7d1d9fcc5b5c37040 +Subproject commit b1c829a0b2f4dd0dfef8ec1e6b6cd67bcf334d7c From 1ba2111111be92fbc2ddc6061235228c9fc0e021 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Sat, 4 Mar 2017 02:23:49 +0200 Subject: [PATCH 0343/1833] [teamd]: Add volumes from database in docker-teamd.mk (#369) teamsyncd requires volumes from database to connect to DB. Signed-off-by: marian-pritsak --- rules/docker-teamd.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index 14038fcd0381..cc97e24fe4ab 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -10,3 +10,4 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD) $(DOCKER_TEAMD)_CONTAINER_NAME = teamd $(DOCKER_TEAMD)_RUN_OPT += --net=host --privileged -t $(DOCKER_TEAMD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_TEAMD)_RUN_OPT += --volumes-from database From 366775a64ec860395cb6919f1328451bcf79d5ab Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 3 Mar 2017 23:07:23 -0800 Subject: [PATCH 0344/1833] [Broadcom]: Update debian package versions (#373) Signed-off-by: Shuotian Cheng --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index d2d701b8ed10..ace7617f7ff4 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.3.1-4+0-20170301222525.13-1.gbp8d6580_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.3.1-4+0-20170301222525.13-1.gbp8d6580_amd64.deb?sv=2015-04-05&sr=b&sig=YhWQFb2Bz5ZgqyA8VciIT20I%2BBDhps77ksakG0jU92A%3D&se=2030-11-08T22%3A34%3A36Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-20170303234832.14_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-20170303234832.14_amd64.deb?sv=2015-04-05&sr=b&sig=gZKsefmpU6Xc6X0emxjlGKwf1aPsyxloulhXL0qGgFc%3D&se=2030-11-10T23%3A58%3A37Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.3.1-4+0-20170301222525.13-1.gbp8d6580_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-20170303234832.14_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.3.1-4+0-20170301222525.13-1.gbp8d6580_amd64.deb?sv=2015-04-05&sr=b&sig=QUmwuM3AZ4qe5sVFTmB6tEWApJKWU7PP5kfaDVM2dKU%3D&se=2030-11-08T22%3A35%3A34Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-20170303234832.14_amd64.deb?sv=2015-04-05&sr=b&sig=kEhXcoL0iOUpnuGJLduktluImi0eQVHAjGunGbipa28%3D&se=2030-11-10T23%3A59%3A08Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index c15d327f96a1..57583bb178f7 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.1.5-7-20170301212550.23_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.1.5-7-20170301212550.23_amd64.deb?sv=2015-04-05&sr=b&sig=d18xevgySzJGCbD6I9M4SX1%2B291vIOMbMXPsbkDjuFA%3D&se=2030-11-08T22%3A36%3A21Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.2.2-20170303224751.24_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-20170303224751.24_amd64.deb?sv=2015-04-05&sr=b&sig=rFu55R4M6M9vJ%2FlJgv6wvp2fbZnKpiHNnhzCddEidgo%3D&se=2030-11-10T23%3A59%3A41Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.1.5-7-20170301212550.23_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.1.5-7-20170301212550.23_amd64.deb?sv=2015-04-05&sr=b&sig=5iudeTcf3WNlNSYgJPfaj41CVh7n71GuV7v1hmuy0OI%3D&se=2030-11-08T22%3A36%3A58Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-20170303224751.24_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-20170303224751.24_amd64.deb?sv=2015-04-05&sr=b&sig=DMN91a5PwxG7ow15K1YyHudRF%2F2l0ipAXJ7c1dOW6QY%3D&se=2030-11-11T00%3A00%3A09Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 701d5ddb8abfe7be2edc5d8bd09ffd5636362f3c Mon Sep 17 00:00:00 2001 From: Nadiya Date: Sat, 4 Mar 2017 11:56:41 +0200 Subject: [PATCH 0345/1833] Add cavm saiserver (#137) --- dockers/docker-saiserver-cavm/Dockerfile | 30 +++++++++++++++++++++ dockers/docker-saiserver-cavm/portmap.ini | 33 +++++++++++++++++++++++ dockers/docker-saiserver-cavm/profile.ini | 4 +++ dockers/docker-saiserver-cavm/start.sh | 11 ++++++++ 4 files changed, 78 insertions(+) create mode 100644 dockers/docker-saiserver-cavm/Dockerfile create mode 100644 dockers/docker-saiserver-cavm/portmap.ini create mode 100644 dockers/docker-saiserver-cavm/profile.ini create mode 100755 dockers/docker-saiserver-cavm/start.sh diff --git a/dockers/docker-saiserver-cavm/Dockerfile b/dockers/docker-saiserver-cavm/Dockerfile new file mode 100644 index 000000000000..2ee6b8ff38cd --- /dev/null +++ b/dockers/docker-saiserver-cavm/Dockerfile @@ -0,0 +1,30 @@ + +FROM docker-base + +RUN apt-get update \ + && apt-get install -y libsensors4-dev \ + python \ + python-dev + +COPY deps /root/deps + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /root/deps/xp-tools.deb \ + && dpkg_apt /root/deps/libsai.deb \ + && dpkg_apt /root/deps/sai.deb \ + && dpkg_apt /root/deps/libthrift-0.9.3_*.deb \ + && dpkg_apt /root/deps/libnl-3-200_*.deb \ + && dpkg_apt /root/deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /root/deps/libnl-route-3-200_*.deb + + +COPY ["deps/saiserver", "start.sh", "/usr/bin/"] + +COPY ["portmap.ini", "profile.ini", "/etc/sai/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf deps + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-saiserver-cavm/portmap.ini b/dockers/docker-saiserver-cavm/portmap.ini new file mode 100644 index 000000000000..c35776dcfcc5 --- /dev/null +++ b/dockers/docker-saiserver-cavm/portmap.ini @@ -0,0 +1,33 @@ +# alias lanes +Ethernet0 16,17,18,19 +Ethernet4 20,21,22,23 +Ethernet8 24,25,26,27 +Ethernet12 28,29,30,31 +Ethernet16 32,33,34,35 +Ethernet20 36,37,38,39 +Ethernet24 40,41,42,43 +Ethernet28 44,45,46,47 +Ethernet32 0,1,2,3 +Ethernet36 4,5,6,7 +Ethernet40 8,9,10,11 +Ethernet44 12,13,14,15 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 127,126,125,124 +Ethernet68 123,122,121,120 +Ethernet72 115,114,113,112 +Ethernet76 119,118,117,116 +Ethernet80 79,78,77,76 +Ethernet84 75,74,73,72 +Ethernet88 64,65,66,67 +Ethernet92 71,70,68,69 +Ethernet96 111,110,109,108 +Ethernet100 107,106,105,104 +Ethernet104 103,102,101,100 +Ethernet108 99,98,97,96 +Ethernet112 95,94,93,92 +Ethernet116 91,90,89,88 +Ethernet120 87,86,85,84 +Ethernet124 83,82,81,80 diff --git a/dockers/docker-saiserver-cavm/profile.ini b/dockers/docker-saiserver-cavm/profile.ini new file mode 100644 index 000000000000..2b85ae77ebef --- /dev/null +++ b/dockers/docker-saiserver-cavm/profile.ini @@ -0,0 +1,4 @@ +#SKU_128X10 +mode=0 + +hwId=as7512 diff --git a/dockers/docker-saiserver-cavm/start.sh b/dockers/docker-saiserver-cavm/start.sh new file mode 100755 index 000000000000..8d683c0a016a --- /dev/null +++ b/dockers/docker-saiserver-cavm/start.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +function clean_up { + service rsyslog stop +} + +trap clean_up SIGTERM SIGKILL + +service rsyslog start + +/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini From b9c624520ed8c32709ed1e9362d616a10024a592 Mon Sep 17 00:00:00 2001 From: Min Yao Date: Sat, 4 Mar 2017 18:17:38 +0800 Subject: [PATCH 0346/1833] Support centec platform (#376) --- .../E582-48x6q/port_config.ini | 33 + .../E582-48x6q/sai.profile | 1 + .../x86_64-centec_e582_48x6q-r0/minigraph.xml | 1049 +++++++++++++++++ .../ES6428A-X48Q2H4/port_config.ini | 33 + .../ES6428A-X48Q2H4/sai.profile | 1 + .../x86_64-ew_es6220_x48q2h4-r0/minigraph.xml | 1049 +++++++++++++++++ dockers/docker-orchagent-centec | 1 + .../platforms/x86_64-centec_e582_48x6q-r0 | 1 + .../platforms/x86_64-ew_es6220_x48q2h4-r0 | 1 + platform/centec/docker-orchagent-centec.mk | 16 + platform/centec/docker-syncd-centec.mk | 15 + .../centec/docker-syncd-centec/Dockerfile.j2 | 29 + platform/centec/docker-syncd-centec/start.sh | 14 + platform/centec/one-image.mk | 8 + platform/centec/platform.conf | 0 platform/centec/rules.mk | 13 + platform/centec/sai.mk | 5 + platform/centec/sdk.mk | 4 + 18 files changed, 2273 insertions(+) create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/port_config.ini create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/sai.profile create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml create mode 100644 device/centec/x86_64-ew_es6220_x48q2h4-r0/ES6428A-X48Q2H4/port_config.ini create mode 100644 device/centec/x86_64-ew_es6220_x48q2h4-r0/ES6428A-X48Q2H4/sai.profile create mode 100644 device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml create mode 120000 dockers/docker-orchagent-centec create mode 100644 installer/x86_64/platforms/x86_64-centec_e582_48x6q-r0 create mode 100644 installer/x86_64/platforms/x86_64-ew_es6220_x48q2h4-r0 create mode 100644 platform/centec/docker-orchagent-centec.mk create mode 100644 platform/centec/docker-syncd-centec.mk create mode 100755 platform/centec/docker-syncd-centec/Dockerfile.j2 create mode 100755 platform/centec/docker-syncd-centec/start.sh create mode 100644 platform/centec/one-image.mk create mode 100644 platform/centec/platform.conf create mode 100644 platform/centec/rules.mk create mode 100644 platform/centec/sai.mk create mode 100644 platform/centec/sdk.mk diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/port_config.ini b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/port_config.ini new file mode 100644 index 000000000000..b9a831f22e8d --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 1 +Ethernet4 2 +Ethernet8 3 +Ethernet12 4 +Ethernet16 5 +Ethernet20 6 +Ethernet24 7 +Ethernet28 8 +Ethernet32 9 +Ethernet36 10 +Ethernet40 11 +Ethernet44 12 +Ethernet48 13 +Ethernet52 14 +Ethernet56 15 +Ethernet60 16 +Ethernet64 17 +Ethernet68 18 +Ethernet72 19 +Ethernet76 20 +Ethernet80 21 +Ethernet84 22 +Ethernet88 23 +Ethernet92 24 +Ethernet96 25 +Ethernet100 26 +Ethernet104 27 +Ethernet108 28 +Ethernet112 29 +Ethernet116 30 +Ethernet120 31 +Ethernet124 32 diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/sai.profile b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/sai.profile new file mode 100644 index 000000000000..2eb3ce5f612b --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/sai.profile @@ -0,0 +1 @@ +BOARD_CONFIG_FILE_PATH=/etc/centec/E582-48x6q.json diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml b/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml new file mode 100644 index 000000000000..fd35742353c9 --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml @@ -0,0 +1,1049 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + switch1 + E582-48x6q + + + + switch1 + E582-48x6q +
diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/ES6428A-X48Q2H4/port_config.ini b/device/centec/x86_64-ew_es6220_x48q2h4-r0/ES6428A-X48Q2H4/port_config.ini new file mode 100644 index 000000000000..b9a831f22e8d --- /dev/null +++ b/device/centec/x86_64-ew_es6220_x48q2h4-r0/ES6428A-X48Q2H4/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 1 +Ethernet4 2 +Ethernet8 3 +Ethernet12 4 +Ethernet16 5 +Ethernet20 6 +Ethernet24 7 +Ethernet28 8 +Ethernet32 9 +Ethernet36 10 +Ethernet40 11 +Ethernet44 12 +Ethernet48 13 +Ethernet52 14 +Ethernet56 15 +Ethernet60 16 +Ethernet64 17 +Ethernet68 18 +Ethernet72 19 +Ethernet76 20 +Ethernet80 21 +Ethernet84 22 +Ethernet88 23 +Ethernet92 24 +Ethernet96 25 +Ethernet100 26 +Ethernet104 27 +Ethernet108 28 +Ethernet112 29 +Ethernet116 30 +Ethernet120 31 +Ethernet124 32 diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/ES6428A-X48Q2H4/sai.profile b/device/centec/x86_64-ew_es6220_x48q2h4-r0/ES6428A-X48Q2H4/sai.profile new file mode 100644 index 000000000000..6a5af192a2b7 --- /dev/null +++ b/device/centec/x86_64-ew_es6220_x48q2h4-r0/ES6428A-X48Q2H4/sai.profile @@ -0,0 +1 @@ +BOARD_CONFIG_FILE_PATH=/etc/centec/ES6428A-X48Q2H4.json diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml b/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml new file mode 100644 index 000000000000..03be9a51b7c1 --- /dev/null +++ b/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml @@ -0,0 +1,1049 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + switch1 + ES6428A-X48Q2H4 + + + + switch1 + ES6428A-X48Q2H4 +
diff --git a/dockers/docker-orchagent-centec b/dockers/docker-orchagent-centec new file mode 120000 index 000000000000..8d52609c56e5 --- /dev/null +++ b/dockers/docker-orchagent-centec @@ -0,0 +1 @@ +docker-orchagent \ No newline at end of file diff --git a/installer/x86_64/platforms/x86_64-centec_e582_48x6q-r0 b/installer/x86_64/platforms/x86_64-centec_e582_48x6q-r0 new file mode 100644 index 000000000000..5e62742c11bf --- /dev/null +++ b/installer/x86_64/platforms/x86_64-centec_e582_48x6q-r0 @@ -0,0 +1 @@ +CONSOLE_SPEED=115200 diff --git a/installer/x86_64/platforms/x86_64-ew_es6220_x48q2h4-r0 b/installer/x86_64/platforms/x86_64-ew_es6220_x48q2h4-r0 new file mode 100644 index 000000000000..5e62742c11bf --- /dev/null +++ b/installer/x86_64/platforms/x86_64-ew_es6220_x48q2h4-r0 @@ -0,0 +1 @@ +CONSOLE_SPEED=115200 diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk new file mode 100644 index 000000000000..86b214cdcb85 --- /dev/null +++ b/platform/centec/docker-orchagent-centec.mk @@ -0,0 +1,16 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_CENTEC = docker-orchagent-centec.gz +$(DOCKER_ORCHAGENT_CENTEC)_PATH = $(DOCKERS_PATH)/docker-orchagent +$(DOCKER_ORCHAGENT_CENTEC)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC) + +$(DOCKER_ORCHAGENT_CENTEC)_CONTAINER_NAME = swss +$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += --volumes-from database +$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro +$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro +$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /host/machine.conf:/host/machine.conf +$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/centec/docker-syncd-centec.mk b/platform/centec/docker-syncd-centec.mk new file mode 100644 index 000000000000..2c2cec179852 --- /dev/null +++ b/platform/centec/docker-syncd-centec.mk @@ -0,0 +1,15 @@ +# docker image for centec syncd + +DOCKER_SYNCD_CENTEC = docker-syncd-centec.gz +$(DOCKER_SYNCD_CENTEC)_PATH = $(PLATFORM_PATH)/docker-syncd-centec +$(DOCKER_SYNCD_CENTEC)_DEPENDS += $(SYNCD) +$(DOCKER_SYNCD_CENTEC)_LOAD_DOCKERS += $(DOCKER_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC) + +$(DOCKER_SYNCD_CENTEC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CENTEC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_CENTEC)_RUN_OPT += --volumes-from database +$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 new file mode 100755 index 000000000000..617143215a4d --- /dev/null +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -0,0 +1,29 @@ +FROM docker-base + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +COPY \ +{% for deb in docker_syncd_centec_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_syncd_centec_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## TODO: add kmod into Depends +RUN apt-get install -f kmod + +COPY ["start.sh", "/usr/bin/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/platform/centec/docker-syncd-centec/start.sh b/platform/centec/docker-syncd-centec/start.sh new file mode 100755 index 000000000000..3e5b941a7658 --- /dev/null +++ b/platform/centec/docker-syncd-centec/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +function clean_up { + service syncd stop + service rsyslog stop + exit +} + +trap clean_up SIGTERM SIGKILL + +service rsyslog start +service syncd start + +read diff --git a/platform/centec/one-image.mk b/platform/centec/one-image.mk new file mode 100644 index 000000000000..49c27aea4261 --- /dev/null +++ b/platform/centec/one-image.mk @@ -0,0 +1,8 @@ +# sonic centec one image installer + +SONIC_ONE_IMAGE = sonic-centec.bin +$(SONIC_ONE_IMAGE)_MACHINE = centec +$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_ONE_IMAGE)_DEPENDS += $(CENTEC_SDK_KERNEL) +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/centec/platform.conf b/platform/centec/platform.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/centec/rules.mk b/platform/centec/rules.mk new file mode 100644 index 000000000000..d8c3568f0cc0 --- /dev/null +++ b/platform/centec/rules.mk @@ -0,0 +1,13 @@ +include $(PLATFORM_PATH)/sdk.mk +include $(PLATFORM_PATH)/sai.mk +include $(PLATFORM_PATH)/docker-orchagent-centec.mk +include $(PLATFORM_PATH)/docker-syncd-centec.mk +include $(PLATFORM_PATH)/one-image.mk + +SONIC_ALL += $(SONIC_ONE_IMAGE) + +# Inject centec sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(CENTEC_SAI) + +# Runtime dependency on centec sai is set only for syncd +$(SYNCD)_RDEPENDS += $(CENTEC_SAI) diff --git a/platform/centec/sai.mk b/platform/centec/sai.mk new file mode 100644 index 000000000000..de8615ac132c --- /dev/null +++ b/platform/centec/sai.mk @@ -0,0 +1,5 @@ +# Centec SAI +CENTEC_SAI = libsai_1.0.0_amd64.deb +$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_0.9.4/libsai_1.0.0_amd64.deb + +SONIC_ONLINE_DEBS += $(CENTEC_SAI) diff --git a/platform/centec/sdk.mk b/platform/centec/sdk.mk new file mode 100644 index 000000000000..1b52dcffe64d --- /dev/null +++ b/platform/centec/sdk.mk @@ -0,0 +1,4 @@ +CENTEC_SDK_KERNEL = centec-gg-sdk3.5-modules-3.16.36-1-amd64.deb +$(CENTEC_SDK_KERNEL)_URL = "https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/centec-gg-sdk3.5-modules-3.16.36-1-amd64.deb" + +SONIC_ONLINE_DEBS += $(CENTEC_SDK_KERNEL) From 32e4655b3c096132da064cb401ba6a47e9b3d21f Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 4 Mar 2017 10:11:20 -0800 Subject: [PATCH 0347/1833] Update build instruction for broadcom platform --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b4230b3d6582..eb59a9b25211 100644 --- a/README.md +++ b/README.md @@ -30,21 +30,30 @@ You also need to change all git paths to relative path as we build all submodule ## Usage -To build NOS installer image and docker images, run the following commands: +To build SONiC installer image and docker images, run the following commands: make configure PLATFORM=[ASIC_VENDOR] make **NOTE**: We recommend reserving 50G free space to build one platform. -Supported PLATFORM are: +The SONIiC installer contains all docker images needed. SONiC use one image for all switches devices of a same ASIC vendor. The supported ASIC vendors are: + - PLATFORM=broadcom - PLATFORM=marvell (*pending*) - PLATFORM=mellanox - PLATFORM=cavium -- PLATFORM=centec (*pending*) +- PLATFORM=centec - PLATFORM=p4 +For Broadcom ASIC, we build ONIE and EOS image. EOS image is used for Arista devices, ONIE image is used for all other Broadcom ASIC based devices. + + make configure PLATFORM=broadcom + # build ONIE image + make target/sonic-broadcom.bin + # build EOS image + make target/sonic-aboot-broadcom.swi + You may find the rules/config file useful. It contains configuration options for the build process, like adding more verbosity or showing dependencies, username and password for base image etc. Every docker image is built and saved to target/ directory. From 7069cefc905700c41bb9e2076f93874f1d51c1b0 Mon Sep 17 00:00:00 2001 From: Lihua Yuan Date: Sat, 4 Mar 2017 13:48:36 -0800 Subject: [PATCH 0348/1833] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eb59a9b25211..47f9b25e6e58 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,9 @@ P4: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buil ## Build SONiC Switch Images -# Description -Build an [Open Network Install Environment (ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also build docker images running inside the NOS. +# Description + +Following is the instruction on how to build an [(ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also how to build docker images running inside the NOS. Note that SONiC image are build per ASIC platform. Switches using the same ASIC platform share a common image. For a list of supported switches and ASIC, please refer to this [document](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all). # Prerequisites From 6cb5925d819753f99a75d88292aedda5d5255537 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 4 Mar 2017 18:02:15 -0800 Subject: [PATCH 0349/1833] [sairedis]: update syncd init to support centec asic (#379) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 22ea540f50dc..426589a7f6be 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 22ea540f50dc05b6320b0f00f769bc5be0b2a9d3 +Subproject commit 426589a7f6be8f021207734fd277882eb051fc5f From 45e5c147294f1ee3366e2fb002236068fa421bcb Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 5 Mar 2017 09:46:46 -0800 Subject: [PATCH 0350/1833] add badge for centec --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 47f9b25e6e58..9b9ed723e1f7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ Broadcom: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) Cavium: [![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) +Centec: [![Centec](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) Mellanox: [![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) P4: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) From 5dafa907b203a906fb452e2420036edc9a5222e9 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 6 Mar 2017 12:22:42 -0800 Subject: [PATCH 0351/1833] [dockers]: Add base image files to syncd-brcm, database and teamd (#380) --- dockers/docker-database/base_image_files/redis-cli | 4 ++++ dockers/docker-teamd/base_image_files/teamdctl | 4 ++++ platform/broadcom/docker-syncd-brcm.mk | 3 +++ platform/broadcom/docker-syncd-brcm/base_image_files/bcmcmd | 4 ++++ rules/docker-database.mk | 2 ++ rules/docker-teamd.mk | 3 +++ 6 files changed, 20 insertions(+) create mode 100755 dockers/docker-database/base_image_files/redis-cli create mode 100755 dockers/docker-teamd/base_image_files/teamdctl create mode 100755 platform/broadcom/docker-syncd-brcm/base_image_files/bcmcmd diff --git a/dockers/docker-database/base_image_files/redis-cli b/dockers/docker-database/base_image_files/redis-cli new file mode 100755 index 000000000000..646992f65abd --- /dev/null +++ b/dockers/docker-database/base_image_files/redis-cli @@ -0,0 +1,4 @@ +#!/bin/bash + +docker exec -it database redis-cli "$@" + diff --git a/dockers/docker-teamd/base_image_files/teamdctl b/dockers/docker-teamd/base_image_files/teamdctl new file mode 100755 index 000000000000..c7f59d321454 --- /dev/null +++ b/dockers/docker-teamd/base_image_files/teamdctl @@ -0,0 +1,4 @@ +#!/bin/bash + +docker exec -i teamd teamdctl "$@" + diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index b1353cc2f866..1e5e7a34adb8 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -14,3 +14,6 @@ $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_BRCM)_RUN_OPT += --volumes-from database $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd + diff --git a/platform/broadcom/docker-syncd-brcm/base_image_files/bcmcmd b/platform/broadcom/docker-syncd-brcm/base_image_files/bcmcmd new file mode 100755 index 000000000000..ee87a93cdf6e --- /dev/null +++ b/platform/broadcom/docker-syncd-brcm/base_image_files/bcmcmd @@ -0,0 +1,4 @@ +#!/bin/bash + +docker exec -i syncd bcmcmd "$@" + diff --git a/rules/docker-database.mk b/rules/docker-database.mk index 168164a02636..9a8004038150 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -11,3 +11,5 @@ $(DOCKER_DATABASE)_CONTAINER_NAME = database $(DOCKER_DATABASE)_RUN_OPT += --net=host --privileged -t $(DOCKER_DATABASE)_RUN_OPT += -v /var/run/redis +$(DOCKER_DATABASE)_BASE_IMAGE_FILES += redis-cli:/usr/bin/redis-cli + diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index cc97e24fe4ab..932e2aee0fa7 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -11,3 +11,6 @@ $(DOCKER_TEAMD)_CONTAINER_NAME = teamd $(DOCKER_TEAMD)_RUN_OPT += --net=host --privileged -t $(DOCKER_TEAMD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_TEAMD)_RUN_OPT += --volumes-from database + +$(DOCKER_TEAMD)_BASE_IMAGE_FILES += teamdctl:/usr/bin/teamdctl + From bd6bf1ff9a425b729294db89ffe7a6b04bda3973 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 6 Mar 2017 12:41:26 -0800 Subject: [PATCH 0352/1833] [config] [oneimage & dhcp relay docker] Move ntp, rsyslog, and dhcp server information into minigraph (#374) Move DHCP, rsyslog, and NTP server information into minigraph * Fix dhcp relay template according to CR --- .../x86_64-accton_as7512_32x-r0/minigraph.xml | 25 ++++++++++++++ .../x86_64-arista_7050_qx32/minigraph.xml | 25 ++++++++++++++ .../x86_64-arista_7060_cx32s/minigraph.xml | 25 ++++++++++++++ .../x86_64-dell_s6000_s1220-r0/minigraph.xml | 25 ++++++++++++++ .../x86_64-dell_s6100_c2538-r0/minigraph.xml | 25 ++++++++++++++ .../x86_64-dell_z9100_c2538-r0/minigraph.xml | 25 ++++++++++++++ .../x86_64-ingrasys_s9100-r0/minigraph.xml | 33 ++++++++++++++++++- .../x86_64-mlnx_msn2700-r0/minigraph.xml | 25 ++++++++++++++ dockers/docker-dhcp-relay/config.sh | 2 +- dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 2 +- .../build_templates/sonic_debian_extension.j2 | 2 -- files/image_config/ntp/ntp-config.sh | 2 +- files/image_config/ntp/ntp.yml | 6 ---- files/image_config/rsyslog/rsyslog-config.sh | 2 +- files/image_config/rsyslog/rsyslog.yml | 1 - src/sonic-config-engine/minigraph.py | 27 +++++++++++++++ 16 files changed, 238 insertions(+), 14 deletions(-) delete mode 100644 files/image_config/ntp/ntp.yml delete mode 100644 files/image_config/rsyslog/rsyslog.yml diff --git a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml index 42bb951add3a..f2326c44aae3 100644 --- a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml @@ -1044,6 +1044,31 @@ + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + switch1 AS7512 diff --git a/device/arista/x86_64-arista_7050_qx32/minigraph.xml b/device/arista/x86_64-arista_7050_qx32/minigraph.xml index 26bf46132a25..f2ef7b0b8bc2 100644 --- a/device/arista/x86_64-arista_7050_qx32/minigraph.xml +++ b/device/arista/x86_64-arista_7050_qx32/minigraph.xml @@ -1044,6 +1044,31 @@ + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + switch1 Arista-7050-QX32 diff --git a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml index 3fcd713cbc79..5d7dcea980ff 100644 --- a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml +++ b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml @@ -1044,6 +1044,31 @@ + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + switch1 Arista-7060-CX32S diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml b/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml index 436f6880da4f..0fd1f49ab868 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml +++ b/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml @@ -1044,6 +1044,31 @@ + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + switch1 Force10-S6000 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml index e07ec53e18e9..3ae8e77f8024 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml +++ b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml @@ -739,6 +739,31 @@ + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + switch1 Force10-S6100 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml index 44cffcdd4378..ab1ce20a69a8 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml +++ b/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml @@ -1044,6 +1044,31 @@ + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + switch1 Force10-Z9100 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml index c67990fc7305..154c1847eb20 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml @@ -109,7 +109,38 @@ Ethernet4 - + + + OCPSCH01040GGLF + ingrasys-s9100 + + + + + + + OCPSCH01040GGLF + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + OCPSCH01040GGLF ingrasys-s9100 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml index 0fa570c7a0a8..4942e64be5e9 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml @@ -1044,6 +1044,31 @@ ` + + + + switch2 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + switch2 ACS-MSN2700 diff --git a/dockers/docker-dhcp-relay/config.sh b/dockers/docker-dhcp-relay/config.sh index f0a861cfb997..99df251572d5 100755 --- a/dockers/docker-dhcp-relay/config.sh +++ b/dockers/docker-dhcp-relay/config.sh @@ -1,4 +1,4 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/dhcp_relay.yml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 index 07df5e1f9a76..812e2bb8e1e4 100644 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -1,4 +1,4 @@ -SERVERS="{{ dhcp_servers }}" +SERVERS="{{ dhcp_servers | join(' ') }}" INTERFACES="{{ minigraph_vlan_interfaces[0]['name'] }}" diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index c84518576f17..5d079ea35c7d 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -83,14 +83,12 @@ sudo cp $IMAGE_CONFIGS/ntp/ntp-config.service $FILESYSTEM_ROOT/etc/systemd/syste 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/ -sudo cp $IMAGE_CONFIGS/ntp/ntp.yml $FILESYSTEM_ROOT/etc/sonic/ # 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 sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.sh $FILESYSTEM_ROOT/usr/bin/ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.conf.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/ -sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.yml $FILESYSTEM_ROOT/etc/sonic/ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/* $FILESYSTEM_ROOT/etc/rsyslog.d/ # Copy interfaces configuration files and templates diff --git a/files/image_config/ntp/ntp-config.sh b/files/image_config/ntp/ntp-config.sh index 55a048a71328..2465058ba021 100755 --- a/files/image_config/ntp/ntp-config.sh +++ b/files/image_config/ntp/ntp-config.sh @@ -1,3 +1,3 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/ntp.yml -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf diff --git a/files/image_config/ntp/ntp.yml b/files/image_config/ntp/ntp.yml deleted file mode 100644 index efb3a5272fcc..000000000000 --- a/files/image_config/ntp/ntp.yml +++ /dev/null @@ -1,6 +0,0 @@ -ntp_servers: - - 0.debian.pool.ntp.org - - 1.debian.pool.ntp.org - - 2.debian.pool.ntp.org - - 3.debian.pool.ntp.org - diff --git a/files/image_config/rsyslog/rsyslog-config.sh b/files/image_config/rsyslog/rsyslog-config.sh index 8c14b9adce9f..044888029686 100755 --- a/files/image_config/rsyslog/rsyslog-config.sh +++ b/files/image_config/rsyslog/rsyslog-config.sh @@ -1,3 +1,3 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/rsyslog.yml -t /usr/share/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf diff --git a/files/image_config/rsyslog/rsyslog.yml b/files/image_config/rsyslog/rsyslog.yml deleted file mode 100644 index 006271123b9d..000000000000 --- a/files/image_config/rsyslog/rsyslog.yml +++ /dev/null @@ -1 +0,0 @@ -syslog_servers: [] diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index aece9dee8a50..afd4538f1346 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -266,6 +266,25 @@ def parse_cpg(cpg, hname): return bgp_sessions, myasn +def parse_meta(meta, hname): + syslog_servers = [] + dhcp_servers = [] + ntp_servers = [] + device_metas = meta.find(str(QName(ns, "Devices"))) + for device in device_metas.findall(str(QName(ns1, "DeviceMetadata"))): + if device.find(str(QName(ns1, "Name"))).text == hname: + properties = device.find(str(QName(ns1, "Properties"))) + for device_property in properties.findall(str(QName(ns1, "DeviceProperty"))): + name = device_property.find(str(QName(ns1, "Name"))).text + value = device_property.find(str(QName(ns1, "Value"))).text + value_group = value.split(';') if value and value != "" else [] + if name == "DhcpResources": + dhcp_servers = value_group + elif name == "NtpResources": + ntp_servers = value_group + elif name == "SyslogResources": + syslog_servers = value_group + return syslog_servers, dhcp_servers, ntp_servers def get_console_info(devices, dev, port): for k, v in devices.items(): @@ -340,6 +359,9 @@ def parse_xml(filename, platform=None): neighbors = None devices = None hostname = None + syslog_servers = [] + dhcp_servers = [] + ntp_servers = [] hwsku_qn = QName(ns, "HwSku") hostname_qn = QName(ns, "Hostname") @@ -363,6 +385,8 @@ def parse_xml(filename, platform=None): (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port) = parse_png(child, hostname) elif child.tag == str(QName(ns, "UngDec")): (u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname) + elif child.tag == str(QName(ns, "MetadataDeclaration")): + (syslog_servers, dhcp_servers, ntp_servers) = parse_meta(child, hostname) Tree = lambda: defaultdict(Tree) @@ -389,6 +413,9 @@ def parse_xml(filename, platform=None): results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port) results['minigraph_hostname'] = hostname results['inventory_hostname'] = hostname + results['syslog_servers'] = syslog_servers + results['dhcp_servers'] = dhcp_servers + results['ntp_servers'] = ntp_servers results['alias_map'] = alias_map_list return results From 1491bf9eaed494478185dbc6f965676fe2a2d5c7 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 7 Mar 2017 02:28:50 -0800 Subject: [PATCH 0353/1833] [src]: Update sonic-snmpagent submodule (#382) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index a3391a9c709a..c38cc59c14e3 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit a3391a9c709a1160dd7d261ac1da2013127c3d45 +Subproject commit c38cc59c14e383c2100ce996935ebc3d8c0c2c05 From 7548c36d7792f6b090cdcc135cb89c1075d4c74d Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 7 Mar 2017 12:32:39 -0800 Subject: [PATCH 0354/1833] [build]: set build jobs to 1 by default (#383) --- rules/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/config b/rules/config index be8b7a9d77fb..d016288e4776 100644 --- a/rules/config +++ b/rules/config @@ -18,7 +18,7 @@ # SONIC_CONFIG_BUILD_JOBS - set number of jobs for parallel build. # Corresponding -j argument will be passed to make command inside docker # container. -SONIC_CONFIG_BUILD_JOBS = $(shell nproc) +SONIC_CONFIG_BUILD_JOBS = 1 # SONIC_CONFIG_LOG_TO_FILES - print output from execution of rule for each # target into separate log file under target/log/. From fcffbb3ce69df0623f0b4ec92c4da552bf696f47 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 7 Mar 2017 22:34:24 +0200 Subject: [PATCH 0355/1833] [slave.mk]: Add installer to clean targets. (#384) Signed-off-by: marian-pritsak --- slave.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index 456b73ec4680..ef4cf58924dc 100644 --- a/slave.mk +++ b/slave.mk @@ -366,7 +366,8 @@ $(SONIC_CLEAN_DEBS) : $(DEBS_PATH)/%-clean : .platform $$(addsuffix -clean,$$(ad SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \ $(SONIC_DOCKER_IMAGES) \ - $(SONIC_SIMPLE_DOCKER_IMAGES))) + $(SONIC_SIMPLE_DOCKER_IMAGES) \ + $(SONIC_INSTALLERS))) $(SONIC_CLEAN_TARGETS) : $(TARGET_PATH)/%-clean : .platform @rm -f $(TARGET_PATH)/$* From 4c656824783b26c4202689f085576b915d353302 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 8 Mar 2017 09:00:58 +0200 Subject: [PATCH 0356/1833] [orchagent]: Add swssloglevel shortcut in base image (#386) Signed-off-by: marian-pritsak --- dockers/docker-orchagent/base_image_files/swssloglevel | 2 ++ platform/broadcom/docker-orchagent-brcm.mk | 2 ++ platform/cavium/docker-orchagent-cavm.mk | 2 ++ platform/centec/docker-orchagent-centec.mk | 2 ++ platform/mellanox/docker-orchagent-mlnx.mk | 2 ++ 5 files changed, 10 insertions(+) create mode 100755 dockers/docker-orchagent/base_image_files/swssloglevel diff --git a/dockers/docker-orchagent/base_image_files/swssloglevel b/dockers/docker-orchagent/base_image_files/swssloglevel new file mode 100755 index 000000000000..9282470c2645 --- /dev/null +++ b/dockers/docker-orchagent/base_image_files/swssloglevel @@ -0,0 +1,2 @@ +#!/bin/bash +docker exec -i swss swssloglevel "$@" diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index 2278d89cb832..e49b67c2c2cc 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -14,3 +14,5 @@ $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/inte $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index d9460d1c88db..8130ca8dc1cb 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -14,3 +14,5 @@ $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/inte $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk index 86b214cdcb85..0613fb510de3 100644 --- a/platform/centec/docker-orchagent-centec.mk +++ b/platform/centec/docker-orchagent-centec.mk @@ -14,3 +14,5 @@ $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces:/etc/network/in $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index c193a7754185..505804fb8c17 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -14,3 +14,5 @@ $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces:/etc/network/inte $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel From 0fbbb2be415ece58ada449dcbaa735b08bcb3cf0 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 8 Mar 2017 09:11:42 +0200 Subject: [PATCH 0357/1833] [slave.mk]: add procmail to sonic-slave. (#385) Needed for lockfile utility. Signed-off-by: marian-pritsak --- sonic-slave/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index f1d68c680cb8..dd9838e83800 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -92,6 +92,9 @@ RUN apt-get update && apt-get install -y docutils-common libjs-sphinxdoc libjs-u # For templating RUN pip install j2cli +# For lockfile +RUN apt-get update && apt-get install -y procmail + # Install depot-tools (for git-retry) RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /usr/share/depot_tools ENV PATH /usr/share/depot_tools:$PATH From b9bee5dc92f71aa60c025b5f061f384702184d7f Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Mon, 13 Mar 2017 23:31:51 +0800 Subject: [PATCH 0358/1833] [platform]: Sync hwsku name with INGRASYS-S9100-C32 (#391) Signed-off-by: Sam Yang yang.kaiyu@gmail.com --- device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml | 4 ++-- .../{ingrasys-s9100 => INGRASYS-S9100-C32}/port_config.ini | 0 .../{ingrasys-s9100 => INGRASYS-S9100-C32}/sensors.conf | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename src/sonic-config-engine/platform/{ingrasys-s9100 => INGRASYS-S9100-C32}/port_config.ini (100%) rename src/sonic-config-engine/platform/{ingrasys-s9100 => INGRASYS-S9100-C32}/sensors.conf (100%) diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml index 154c1847eb20..d56428187aa8 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml @@ -112,7 +112,7 @@ OCPSCH01040GGLF - ingrasys-s9100 + INGRASYS-S9100-C32 @@ -142,5 +142,5 @@ OCPSCH01040GGLF - ingrasys-s9100 + INGRASYS-S9100-C32 diff --git a/src/sonic-config-engine/platform/ingrasys-s9100/port_config.ini b/src/sonic-config-engine/platform/INGRASYS-S9100-C32/port_config.ini similarity index 100% rename from src/sonic-config-engine/platform/ingrasys-s9100/port_config.ini rename to src/sonic-config-engine/platform/INGRASYS-S9100-C32/port_config.ini diff --git a/src/sonic-config-engine/platform/ingrasys-s9100/sensors.conf b/src/sonic-config-engine/platform/INGRASYS-S9100-C32/sensors.conf similarity index 100% rename from src/sonic-config-engine/platform/ingrasys-s9100/sensors.conf rename to src/sonic-config-engine/platform/INGRASYS-S9100-C32/sensors.conf From 567b7901e4de8dcc640631ad61915ecb85d4a196 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 13 Mar 2017 17:37:45 -0700 Subject: [PATCH 0359/1833] Fix OneImage snmp mount (#392) --- rules/docker-lldp-sv2.mk | 1 + rules/docker-snmp-sv2.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/rules/docker-lldp-sv2.mk b/rules/docker-lldp-sv2.mk index d9500d1d077a..d19ca6b35029 100644 --- a/rules/docker-lldp-sv2.mk +++ b/rules/docker-lldp-sv2.mk @@ -11,5 +11,6 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP_SV2) $(DOCKER_LLDP_SV2)_CONTAINER_NAME = lldp $(DOCKER_LLDP_SV2)_RUN_OPT += --net=host --privileged -t $(DOCKER_LLDP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_LLDP_SV2)_RUN_OPT += --volumes-from database $(DOCKER_LLDP_SV2)_BASE_IMAGE_FILES += lldpctl:/usr/bin/lldpctl diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk index 95fdcc25775c..60ca007d3f17 100644 --- a/rules/docker-snmp-sv2.mk +++ b/rules/docker-snmp-sv2.mk @@ -12,3 +12,4 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) $(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp $(DOCKER_SNMP_SV2)_RUN_OPT += --net=host --privileged -t $(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SNMP_SV2)_RUN_OPT += --volumes-from database From 57196aa92743a8304d602a2764f265e57ad71879 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 14 Mar 2017 18:47:23 -0700 Subject: [PATCH 0360/1833] Update submodules (#394) --- src/sonic-py-swsssdk | 2 +- src/sonic-snmpagent | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index e5cbe0c8b65b..497bdfe64c3d 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit e5cbe0c8b65bcdb1cf35cf05261521dcea0a2e3a +Subproject commit 497bdfe64c3ddc2ce711ec8a2b0839d9d26f5666 diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index c38cc59c14e3..0c14bcc2bb9c 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit c38cc59c14e383c2100ce996935ebc3d8c0c2c05 +Subproject commit 0c14bcc2bb9cb35573ddcae2a23b6640db45fa01 From d3aa07e1de360108bf8c508fa3c47064e0ff82ea Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Tue, 14 Mar 2017 21:03:04 -0700 Subject: [PATCH 0361/1833] Update sonic-utilities submodule (#395) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index cca83512018c..dea6e8000f16 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit cca83512018cd48a193a7f8f3d0676c8053bcc2d +Subproject commit dea6e8000f160b30e962d59adbaaba41744fe7c2 From 831b10ea26952478f8f8168d03adb9e5ab92cc83 Mon Sep 17 00:00:00 2001 From: Min Yao Date: Tue, 14 Mar 2017 21:03:30 -0700 Subject: [PATCH 0362/1833] [Centec] update centec gg sdk3.5 kernel module debian package (#393) --- platform/centec/sdk.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/centec/sdk.mk b/platform/centec/sdk.mk index 1b52dcffe64d..ac1939122f47 100644 --- a/platform/centec/sdk.mk +++ b/platform/centec/sdk.mk @@ -1,4 +1,4 @@ -CENTEC_SDK_KERNEL = centec-gg-sdk3.5-modules-3.16.36-1-amd64.deb -$(CENTEC_SDK_KERNEL)_URL = "https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/centec-gg-sdk3.5-modules-3.16.36-1-amd64.deb" +CENTEC_SDK_KERNEL = centec-gg-sdk3.5-modules-3.16.0-4-amd64.deb +$(CENTEC_SDK_KERNEL)_URL = "https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/centec-gg-sdk3.5-modules-3.16.0-4-amd64.deb" SONIC_ONLINE_DEBS += $(CENTEC_SDK_KERNEL) From 62ddedecdce7fc763084cf54c325b4871f41b36c Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Thu, 16 Mar 2017 01:55:16 +0800 Subject: [PATCH 0363/1833] [platform]: Updated syncd.conf for INGRASYS-S9100-C32 (#396) Signed-off-by: Sam Yang yang.kaiyu@gmail.com --- .../x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf index 1b197345d308..bd5ba3938842 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf @@ -1 +1 @@ -OPENNSL_CONFIG_POST_INIT_FILE=/etc/bcm/th-ingrasys-s9100-32x100G.soc +export OPENNSL_CONFIG_POST_INIT_FILE=/etc/bcm/th-ingrasys-s9100-32x100G.soc From d7c70665de5fff3afa3f47b6a5f78b82097c3870 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 15 Mar 2017 18:38:55 -0700 Subject: [PATCH 0364/1833] [baseimage]: Add kexec-tools package into the baseimage (#397) * Include kexec-tools package which could be used for fast reboot * Use sudo for sed --- build_debian.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 85126bf34e89..46cb4bce5259 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -193,7 +193,11 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in pciutils \ iptables-persistent \ logrotate \ - curl + curl \ + kexec-tools + +## Disable kexec supported reboot which was installed by default +sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec ## Remove sshd host keys, and will regenerate on first sshd start sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* From d34cfd04a8d261a7cca5db67ca009ee61195d10c Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 15 Mar 2017 20:14:28 -0700 Subject: [PATCH 0365/1833] [motd]: Lower-case 'i' in title (#398) --- files/image_config/environment/motd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/environment/motd b/files/image_config/environment/motd index 47e32505aa51..aa96d66ba7c5 100644 --- a/files/image_config/environment/motd +++ b/files/image_config/environment/motd @@ -5,7 +5,7 @@ You are on ___) | |_| | |\ | | |___ |____/ \___/|_| \_|_|\____| --- Software for Open Networking In the Cloud -- +-- Software for Open Networking in the Cloud -- Unauthorized access and/or use are prohibited. All access and/or use are subject to monitoring. From 096690e6262ccbe2b623dcd3b9aa98be0ac2dcc2 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 16 Mar 2017 09:28:14 -0700 Subject: [PATCH 0366/1833] [snmpagent]: update sonic-snmpagent submodule (#402) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 0c14bcc2bb9c..c1b22019810c 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 0c14bcc2bb9cb35573ddcae2a23b6640db45fa01 +Subproject commit c1b22019810c0c6bf3516f5def320e1c84ca7e12 From d6bfa505b31d67ec2c6e869fb5330440c0493df4 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 16 Mar 2017 10:40:33 -0700 Subject: [PATCH 0367/1833] Wait for VLAN interface to come up before starting DHCP relay (#399) --- dockers/docker-dhcp-relay/Dockerfile | 7 ++++--- dockers/docker-dhcp-relay/start.sh | 12 ++++++++++++ files/build_templates/dhcp_relay.service.j2 | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100755 dockers/docker-dhcp-relay/start.sh diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile index fbdabe333e6e..5c9ee3fb643b 100644 --- a/dockers/docker-dhcp-relay/Dockerfile +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -15,8 +15,9 @@ RUN rm -rf /debs COPY ["isc-dhcp-relay.j2", "/usr/share/sonic/templates/"] COPY ["config.sh", "/usr/bin/"] +COPY ["start.sh", "/usr/bin/"] -ENTRYPOINT /usr/bin/config.sh \ - && service rsyslog start \ - && service isc-dhcp-relay start \ +ENTRYPOINT /usr/bin/config.sh \ + && service rsyslog start \ + && /usr/bin/start.sh \ && /bin/bash diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh new file mode 100755 index 000000000000..05a7693268dc --- /dev/null +++ b/dockers/docker-dhcp-relay/start.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +VLAN_IFACE_NAME=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_vlan_interfaces[0]['name']"` + +# Wait for the VLAN to come up (i.e., 'ip link show' returns 0) +until ip link show $VLAN_IFACE_NAME > /dev/null 2>&1; do + sleep 1 +done + +# Start the DHCP relay +service isc-dhcp-relay start + diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index ee0c444ccce5..95d66c605f85 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=DHCP relay container Requires=docker.service -After=docker.service +After=interfaces-config.service [Service] User={{ sonicadmin_user }} From 05e6b3611df5dd8c18466866dc4eca8f4f77ff6e Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 16 Mar 2017 11:22:40 -0700 Subject: [PATCH 0368/1833] [interfaces]: Combine vlan_interfaces and lag_interfaces file and add allow-hotplug (#381) * [files]: Add allow-hotplug stanza to interfaces files - start interface when the kernel detects a hotplug event from the interface ref: https://www.debian.org/doc/manuals/debian-reference/ch05.en.html * [interfaces]: Combine vlan_interfaces and lag_interfaces file and add allow-hotplug 1. Remove vlan_interfaces and lag_interfaces file and members in teamd.j2 2. Add all interfaces to /etc/network/interfaces file 3. Add allow-hotplug stanza 4. Add up to automatically add interfaces to VLAN and LAG 5. Add unique_name filter to minigraph.py to remove duplicate interface names 6. Add brctl to base image 7. Update sonic-swss submodule Signed-off-by: Shuotian Cheng --- .../docker-orchagent/base_image_files/brctl | 4 ++ .../interfaces/interfaces-config.sh | 2 - files/image_config/interfaces/interfaces.j2 | 66 +++++++++++++++---- .../image_config/interfaces/lag_interfaces.j2 | 20 ------ .../interfaces/vlan_interfaces.j2 | 18 ----- platform/broadcom/docker-orchagent-brcm.mk | 1 + platform/cavium/docker-orchagent-cavm.mk | 1 + platform/centec/docker-orchagent-centec.mk | 1 + platform/mellanox/docker-orchagent-mlnx.mk | 1 + src/sonic-config-engine/minigraph.py | 34 ++++++---- src/sonic-config-engine/sonic-cfggen | 10 +++ src/sonic-swss | 2 +- 12 files changed, 95 insertions(+), 65 deletions(-) create mode 100755 dockers/docker-orchagent/base_image_files/brctl delete mode 100644 files/image_config/interfaces/lag_interfaces.j2 delete mode 100644 files/image_config/interfaces/vlan_interfaces.j2 diff --git a/dockers/docker-orchagent/base_image_files/brctl b/dockers/docker-orchagent/base_image_files/brctl new file mode 100755 index 000000000000..b02d74479f17 --- /dev/null +++ b/dockers/docker-orchagent/base_image_files/brctl @@ -0,0 +1,4 @@ +#!/bin/bash + +docker exec -i swss brctl "$@" + diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index f8b54790c931..f36f45b55576 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,8 +1,6 @@ #!/bin/bash sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/vlan_interfaces.j2 >/etc/network/interfaces.d/vlan_interfaces -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/lag_interfaces.j2 >/etc/network/interfaces.d/lag_interfaces ifdown eth0 && ifup eth0 ifdown lo && ifup lo diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 6d1476963ed9..acf7b247fcf0 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -1,10 +1,10 @@ # {% block banner %} -# =========== Managed by config engine DO NOT EDIT! ======================== -# generated by templates/interfaces.j2 using sonic-cfggen -# file: interfaces -{% endblock %} +# =============== Managed by SONiC Config Engine DO NOT EDIT! =============== +# generated from /usr/share/sonic/templates/interfaces.j2 using sonic-cfggen +# file: /etc/network/interfaces # +{% endblock banner %} {% block loopback %} # The loopback network interface auto lo @@ -17,7 +17,6 @@ iface lo {{ 'inet' if minigraph_lo_interface['addr'] | ipv4 else 'inet6' }} stat # {% endfor %} {% endblock loopback %} -# {% block mgmt_interface %} # The management network interface auto eth0 @@ -25,26 +24,71 @@ auto eth0 iface eth0 inet static address {{ minigraph_mgmt_interface['addr'] }} netmask {{ minigraph_mgmt_interface['mask'] }} - ################ management network policy routing rules - #### management port up rules" + ########## management network policy routing rules + # management port up rules up ip route add default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default up ip rule add from {{ minigraph_mgmt_interface['addr'] }}/32 table default - #### management port down rules" + # management port down rules down ip route delete default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default down ip rule delete from {{ minigraph_mgmt_interface['addr'] }}/32 table default {# TODO: COPP policy type rules #} {% else %} iface eth0 inet dhcp {% endif %} -{% endblock mgmt_interface %} # -{% block front_panel_interface %} +{% endblock mgmt_interface %} +{% block front_panel_interfaces %} # The switch front panel interfaces {% for interface in minigraph_interfaces %} auto {{ interface['alias'] }} +allow-hotplug {{ interface['alias'] }} iface {{ interface['alias'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static address {{ interface['addr'] }} netmask {{ interface['mask'] }} # {% endfor %} -{% endblock front_panel_interface %} +{% for vlan_interface in minigraph_vlan_interfaces|unique_name %} +{% for interface in vlan_interface['members'] %} +auto {{ interface }} +allow-hotplug {{ interface }} +iface {{ interface }} inet manual + pre-up ifconfig {{ interface }} up + post-up brctl addif {{ vlan_interface['name'] }} {{ interface }} + post-down ifconfig {{ interface }} down +# +{% endfor %} +{% endfor %} +# Add || true to suppress the error when docker-teamd starts after docker-swss +{% for pc_interface in minigraph_portchannel_interfaces|unique_name %} +{% for interface in pc_interface['members'] %} +{% if pc_interface['name'] not in pc_set %} +auto {{ interface }} +allow-hotplug {{ interface }} +iface {{ interface }} inet manual + pre-up teamdctl {{ pc_interface['name'] }} port add {{ interface }} || true + post-down ifconfig {{ interface }} down +# +{% endif %} +{% endfor %} +{% endfor %} +{% endblock front_panel_interfaces %} +{% block vlan_interfaces %} +{% for vlan_interface in minigraph_vlan_interfaces %} +auto {{ vlan_interface['name'] }} +allow-hotplug {{ vlan_interface['name'] }} +iface {{ vlan_interface['name'] }} {{ 'inet' if vlan_interface['addr'] | ipv4 else 'inet6' }} static + address {{ vlan_interface['addr'] }} + netmask {{ vlan_interface['mask'] }} +# +{% endfor %} +{% endblock vlan_interfaces %} +{% block pc_interfaces %} +{% for pc_interface in minigraph_portchannel_interfaces %} +auto {{ pc_interface['name'] }} +allow-hotplug {{ pc_interface['name'] }} +iface {{ pc_interface['name'] }} {{ 'inet' if pc_interface['addr'] | ipv4 else 'inet6' }} static + address {{ pc_interface['addr'] }} + netmask {{ pc_interface['mask'] }} +# +{% endfor %} +{% endblock pc_interfaces %} diff --git a/files/image_config/interfaces/lag_interfaces.j2 b/files/image_config/interfaces/lag_interfaces.j2 deleted file mode 100644 index 0b5e24b61893..000000000000 --- a/files/image_config/interfaces/lag_interfaces.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# -{% block banner %} -# =========== Managed by config engine DO NOT EDIT! ======================== -# generated by templates/lag_interfaces.j2 using sonic-cfggen -# file: lag_interfaces -{% endblock %} -# -{% block lag_interface %} -# The switch LAG interfaces -{% for interface in minigraph_interfaces %} -{% if 'PortChannel' in interface['alias'] %} -auto {{ interface['name'] }} -iface {{ interface['name'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static - address {{ interface['addr'] }} - netmask {{ interface['mask'] }} -{% endif %} -{% endfor %} -{% endblock lag_interface %} -# - diff --git a/files/image_config/interfaces/vlan_interfaces.j2 b/files/image_config/interfaces/vlan_interfaces.j2 deleted file mode 100644 index 6d85d7910ed8..000000000000 --- a/files/image_config/interfaces/vlan_interfaces.j2 +++ /dev/null @@ -1,18 +0,0 @@ -# -{% block banner %} -# =========== Managed by config engine DO NOT EDIT! ======================== -# generated by templates/interfaces.j2 using sonic-cfggen -# file: vlan_interfaces -{% endblock %} -# -{% block vlan_interface %} -# The switch VLAN interfaces -{% for interface in minigraph_vlan_interfaces %} -auto {{ interface['name'] }} -iface {{ interface['name'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static - bridge_ports {{ interface['members'] }} - address {{ interface['addr'] }} - netmask {{ interface['mask'] }} -{% endfor %} -{% endblock vlan_interface %} -# diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index e49b67c2c2cc..37fdb9c66ac5 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += brctl:/usr/bin/brctl diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index 8130ca8dc1cb..65ddd9eac252 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += brctl:/usr/bin/brctl diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk index 0613fb510de3..a3738f6aa2ca 100644 --- a/platform/centec/docker-orchagent-centec.mk +++ b/platform/centec/docker-orchagent-centec.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += brctl:/usr/bin/brctl diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index 505804fb8c17..d081e8af5f3b 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += brctl:/usr/bin/brctl diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index afd4538f1346..7cba925928ca 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -44,7 +44,7 @@ def default(self, obj): if isinstance(obj, (ipaddress.IPv4Network, ipaddress.IPv6Network, ipaddress.IPv4Address, ipaddress.IPv6Address)): return str(obj) return json.JSONEncoder.default(self, obj) - + def parse_png(png, hname): neighbors = {} devices = {} @@ -125,6 +125,7 @@ def parse_dpg(dpg, hname): ipintfs = child.find(str(QName(ns, "IPInterfaces"))) intfs = [] vlan_map = {} + pc_map = {} for ipintf in ipintfs.findall(str(QName(ns, "IPInterface"))): intfname = ipintf.find(str(QName(ns, "AttachTo"))).text ipprefix = ipintf.find(str(QName(ns, "Prefix"))).text @@ -134,27 +135,31 @@ def parse_dpg(dpg, hname): addr_bits = ipn.max_prefixlen subnet = ipaddress.IPNetwork(str(ipn.network) + '/' + str(prefix_len)) ipmask = ipn.netmask - + intf = {'addr': ipaddr, 'subnet': subnet} if isinstance(ipn, ipaddress.IPv4Network): intf['mask'] = ipmask else: intf['mask'] = str(prefix_len) - + if intfname[0:4] == "Vlan": if intfname in vlan_map: vlan_map[intfname].append(intf) - else: vlan_map[intfname] = [intf] + elif intfname[0:11] == "PortChannel": + if intfname in pc_map: + pc_map[intfname].append(intf) + else: + pc_map[intfname] = [intf] else: intf.update({'name': intfname, 'prefixlen': int(prefix_len)}) - + if port_alias_map.has_key(intfname): intf['alias'] = port_alias_map[intfname] else: intf['alias'] = intfname - + # TODO: remove peer_addr after dependency removed ipaddr_val = int(ipn.ip) peer_addr_val = None @@ -168,13 +173,13 @@ def parse_dpg(dpg, hname): peer_addr_val = ipaddr_val + 1 else: peer_addr_val = ipaddr_val - 1 - + if peer_addr_val is not None: intf['peer_addr'] = ipaddress.IPAddress(peer_addr_val) intfs.append(intf) pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) - pc_intfs = {} + pc_intfs = [] for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): pcintfname = pcintf.find(str(QName(ns, "Name"))).text pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text @@ -182,7 +187,10 @@ def parse_dpg(dpg, hname): for i,member in enumerate(pcmbr_list): if port_alias_map.has_key(member): pcmbr_list[i] = port_alias_map[member] - pc_intfs[pcintfname] = pcmbr_list + pc_attributes = {'name': pcintfname, 'members': pcmbr_list} + for addrtuple in pc_map.get(pcintfname, []): + pc_attributes.update(addrtuple) + pc_intfs.append(copy.deepcopy(pc_attributes)) lointfs = child.find(str(QName(ns, "LoopbackIPInterfaces"))) lo_intfs = [] @@ -221,12 +229,12 @@ def parse_dpg(dpg, hname): for i,member in enumerate(vmbr_list): if port_alias_map.has_key(member): vmbr_list[i] = port_alias_map[member] - vlan_attributes = {'name': vintfname, 'members': " ".join(vmbr_list), 'vlanid': vlanid} + vlan_attributes = {'name': vintfname, 'members': vmbr_list, 'vlanid': vlanid} for addrtuple in vlan_map.get(vintfname, []): vlan_attributes.update(addrtuple) vlan_intfs.append(copy.deepcopy(vlan_attributes)) - + return intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs return None, None, None, None, None @@ -284,7 +292,7 @@ def parse_meta(meta, hname): ntp_servers = value_group elif name == "SyslogResources": syslog_servers = value_group - return syslog_servers, dhcp_servers, ntp_servers + return syslog_servers, dhcp_servers, ntp_servers def get_console_info(devices, dev, port): for k, v in devices.items(): @@ -330,7 +338,7 @@ def get_alias_map_list(hwsku, platform=None): break if port_config == None: return None - + alias_map_list = [] with open(port_config) as data: for line in data: diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 90a905c5b3e1..93f27a30442d 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -35,6 +35,15 @@ def is_ipv6(value): return False return addr.version == 6 +def unique_name(l): + name_list = [] + new_list = [] + for item in l: + if item['name'] not in name_list: + name_list.append(item['name']) + new_list.append(item) + return new_list + def get_machine_info(): if not os.path.isfile('/host/machine.conf'): return None @@ -91,6 +100,7 @@ def main(): env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) env.filters['ipv4'] = is_ipv4 env.filters['ipv6'] = is_ipv6 + env.filters['unique_name'] = unique_name template = env.get_template(template_file) print template.render(data) diff --git a/src/sonic-swss b/src/sonic-swss index dc33b7549e57..6f06b59971e5 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit dc33b7549e57719d7855b1f7929b38b9b519072b +Subproject commit 6f06b59971e5ee75b721d3630878ba03f28f9831 From 74b6c4074b3ba61fb1fbd4f4b036693c95eeeee1 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 16 Mar 2017 14:24:43 -0700 Subject: [PATCH 0369/1833] Support submodule patching if provided (#403) * Support submodule patching if provided * Replace stg with quilt, working without git branch --- slave.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slave.mk b/slave.mk index ef4cf58924dc..fd05c26620be 100644 --- a/slave.mk +++ b/slave.mk @@ -229,7 +229,9 @@ $(SONIC_INSTALL_TARGETS) : $(DEBS_PATH)/%-install : .platform $$(addsuffix -inst $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*_DEPENDS))) $(HEADER) pushd $($*_SRC_PATH) $(LOG) + if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch/series quilt push -a; fi python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) + if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then quilt pop -a; fi popd $(LOG) mv $($*_SRC_PATH)/dist/$* $(PYTHON_WHEELS_PATH) $(LOG) $(FOOTER) From 1e07284e7ae05f0f2bd81e6db1c820a7a534fb4d Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 16 Mar 2017 22:43:39 -0700 Subject: [PATCH 0370/1833] [p4]: Add openssh-client and openssh-server to Dockerfile (#405) Signed-off-by: Shuotian Cheng --- platform/p4/docker-sonic-p4/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index 97e3a56817e4..a0944cb84a70 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 +RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 openssh-client openssh-server COPY \ {% for deb in docker_sonic_p4_debs.split(' ') -%} From 36e02f76eeca7743bee4aeb779c5564b4e80d110 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 16 Mar 2017 22:57:30 -0700 Subject: [PATCH 0371/1833] Fix: support submodule patching if provided (#407) --- slave.mk | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/slave.mk b/slave.mk index fd05c26620be..bdb1ca441e08 100644 --- a/slave.mk +++ b/slave.mk @@ -132,8 +132,12 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(a $(HEADER) # remove target to force rebuild rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) + # apply series of patches if exist + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi # build project and take package make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG) + # clean up + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi $(FOOTER) # Build project with dpkg-buildpackage @@ -229,9 +233,11 @@ $(SONIC_INSTALL_TARGETS) : $(DEBS_PATH)/%-install : .platform $$(addsuffix -inst $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*_DEPENDS))) $(HEADER) pushd $($*_SRC_PATH) $(LOG) - if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch/series quilt push -a; fi + # apply series of patches if exist + if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) - if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then quilt pop -a; fi + # clean up + if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then quilt pop -a -f; fi popd $(LOG) mv $($*_SRC_PATH)/dist/$* $(PYTHON_WHEELS_PATH) $(LOG) $(FOOTER) From 799f0727a56d5caa5b96db03ad859c6a7d1e0e71 Mon Sep 17 00:00:00 2001 From: wadelnn Date: Fri, 17 Mar 2017 17:04:25 +0800 Subject: [PATCH 0372/1833] Update Ingrasys S9100 submodule (#406) * Update Ingrasys S9100 submodule * Modified debian files permission --- platform/broadcom/sonic-platform-modules-ingrasys-s9100 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-ingrasys-s9100 b/platform/broadcom/sonic-platform-modules-ingrasys-s9100 index 287f78d69417..83d62823d26a 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys-s9100 +++ b/platform/broadcom/sonic-platform-modules-ingrasys-s9100 @@ -1 +1 @@ -Subproject commit 287f78d694174fb60e61420ca8e9de24ea300fd8 +Subproject commit 83d62823d26a6b572bbe11272d00775f8123c199 From e0fd12aa2307e78ed75c09bed7735c1e8bdb2cd9 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 17 Mar 2017 11:07:12 -0700 Subject: [PATCH 0373/1833] [cfggen] Add basic functional test (#375) [cfggen] Add basic functional test --- sonic-slave/Dockerfile | 3 + src/sonic-config-engine/MANIFEST.in | 1 + src/sonic-config-engine/setup.py | 7 + src/sonic-config-engine/tests/__init__.py | 0 .../tests/sample_graph.xml | 129 ++++++++++++++++++ src/sonic-config-engine/tests/test.j2 | 3 + src/sonic-config-engine/tests/test.yml | 3 + src/sonic-config-engine/tests/test_cfggen.py | 61 +++++++++ 8 files changed, 207 insertions(+) create mode 100644 src/sonic-config-engine/tests/__init__.py create mode 100644 src/sonic-config-engine/tests/sample_graph.xml create mode 100644 src/sonic-config-engine/tests/test.j2 create mode 100644 src/sonic-config-engine/tests/test.yml create mode 100644 src/sonic-config-engine/tests/test_cfggen.py diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index dd9838e83800..b8b31940a98d 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -89,6 +89,9 @@ RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libper # For mpdecimal RUN apt-get update && apt-get install -y docutils-common libjs-sphinxdoc libjs-underscore python-docutils python-jinja2 python-markupsafe python-pygments python-roman python-sphinx sphinx-common python3-sphinx +# For sonic config engine testing +RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml + # For templating RUN pip install j2cli diff --git a/src/sonic-config-engine/MANIFEST.in b/src/sonic-config-engine/MANIFEST.in index a98b68c2a5bb..c228a249adfb 100644 --- a/src/sonic-config-engine/MANIFEST.in +++ b/src/sonic-config-engine/MANIFEST.in @@ -1 +1,2 @@ recursive-include platform *.json *.ini *.conf +recursive-include tests *.j2 *.yml *.xml diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 37c61b84ae5f..1a0cae5882fb 100644 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -2,6 +2,7 @@ from setuptools import setup import os.path +import unittest def get_platform_file_list(): data_files = [] @@ -15,6 +16,11 @@ def get_platform_file_list(): data_files.append( (os.path.join('/usr/share/sonic', platform), files) ) return data_files +def get_test_suite(): + test_loader = unittest.TestLoader() + test_suite = test_loader.discover('tests', pattern='*.py') + return test_suite + setup(name='sonic-config-engine', version='1.0', description='Utilities for generating SONiC configuration files', @@ -25,4 +31,5 @@ def get_platform_file_list(): scripts=['sonic-cfggen'], data_files=get_platform_file_list(), install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml'], + test_suite='setup.get_test_suite', ) diff --git a/src/sonic-config-engine/tests/__init__.py b/src/sonic-config-engine/tests/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/src/sonic-config-engine/tests/sample_graph.xml b/src/sonic-config-engine/tests/sample_graph.xml new file mode 100644 index 000000000000..47efabf7d81c --- /dev/null +++ b/src/sonic-config-engine/tests/sample_graph.xml @@ -0,0 +1,129 @@ + + + + + + OCPSCH0104001MS + 10.10.1.14 + OCPSCH01040DDLF + 10.10.1.13 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.14 + OCPSCH01040DDLF + 10.10.2.13 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040DDLF + + +
10.10.1.14
+ + +
+ +
10.10.2.14
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.6/32 + + 100.0.0.6/32 + + + + + ManagementIP1 + Management0 + + 192.168.200.15/24 + + 192.168.200.15/24 + + + + + + OCPSCH01040DDLF + + + + + + Ethernet0 + 10.10.1.13/30 + + + + Ethernet1 + 10.10.2.13/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH01040DDLF + Ethernet0 + OCPSCH0104012MS + Ethernet12 + + + 40000 + DeviceInterfaceLink + OCPCH01040DDLF + Ethernet1 + OCPSCH0104002MS + Ethernet12 + + + + + OCPSCH01040DDLF + Force10-Z9100 + + + + OCPSCH01040DDLF + Force10-Z9100 +
diff --git a/src/sonic-config-engine/tests/test.j2 b/src/sonic-config-engine/tests/test.j2 new file mode 100644 index 000000000000..787a1f0a2c41 --- /dev/null +++ b/src/sonic-config-engine/tests/test.j2 @@ -0,0 +1,3 @@ +{% for item in yml_item -%} +{{ item }} +{% endfor %} diff --git a/src/sonic-config-engine/tests/test.yml b/src/sonic-config-engine/tests/test.yml new file mode 100644 index 000000000000..dc08eb66bed1 --- /dev/null +++ b/src/sonic-config-engine/tests/test.yml @@ -0,0 +1,3 @@ +yml_item: + - value1 + - value2 diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py new file mode 100644 index 000000000000..894f069c1ef8 --- /dev/null +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -0,0 +1,61 @@ +from unittest import TestCase +import subprocess +import os + +class TestCfgGen(TestCase): + + def setUp(self): + self.test_dir = os.path.dirname(os.path.realpath(__file__)) + self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') + self.sample_graph = os.path.join(self.test_dir, 'sample_graph.xml') + + def run_script(self, argument): + print '\n Running sonic-cfggen ' + argument + output = subprocess.check_output(self.script_file + ' ' + argument, shell=True) + linecount = output.strip().count('\n') + if linecount <= 0: + print ' Output: ' + output.strip() + else: + print ' Output: ({0} lines, {1} bytes)'.format(linecount + 1, len(output)) + return output + + def test_dummy_run(self): + argument = '' + output = self.run_script(argument) + self.assertEqual(output, '') + + def test_minigraph_sku(self): + argument = '-v minigraph_hwsku -m "' + self.sample_graph + '"' + output = self.run_script(argument) + self.assertEqual(output.strip(), 'Force10-Z9100') + + def test_print_data(self): + argument = '-m "' + self.sample_graph + '" --print-data' + output = self.run_script(argument) + self.assertTrue(len(output.strip()) > 0) + + def test_jinja_expression(self): + argument = '-m "' + self.sample_graph + '" -v "minigraph_devices[minigraph_hostname][\'type\']"' + output = self.run_script(argument) + self.assertEqual(output.strip(), 'LeafRouter') + + def test_print_alias_mapping(self): + argument = '-s' + output = self.run_script(argument) + self.assertTrue(len(output.strip()) > 0) + + def test_additional_json_data(self): + argument = '-a \'{"key1":"value1"}\' -v key1' + output = self.run_script(argument) + self.assertEqual(output.strip(), 'value1') + + def test_read_yaml(self): + argument = '-v yml_item -y ' + os.path.join(self.test_dir, 'test.yml') + output = self.run_script(argument) + self.assertEqual(output.strip(), '[\'value1\', \'value2\']') + + def test_render_template(self): + argument = '-y ' + os.path.join(self.test_dir, 'test.yml') + ' -t' + os.path.join(self.test_dir, 'test.j2') + output = self.run_script(argument) + self.assertEqual(output.strip(), 'value1\nvalue2') + From b165ab9e5427e2dd396b5b30fe125dc30627acff Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 17 Mar 2017 11:59:07 -0700 Subject: [PATCH 0374/1833] [build]: allow install same platform module deb on multiple platforms (#410) --- slave.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index bdb1ca441e08..34d13202ecef 100644 --- a/slave.mk +++ b/slave.mk @@ -306,7 +306,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export linux_kernel="$(DEBS_PATH)/$(LINUX_KERNEL)" export kversion="$(KVERSION)" export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))" - export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(addprefix $($(deb)_PLATFORM)@, $(DEBS_PATH)/$(deb)))" + export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))" export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" export config_engine="$(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE))" export image_type="$($*_IMAGE_TYPE)" From 3643281594b03ba0c13228991ac78bc16300f41b Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 17 Mar 2017 14:51:42 -0700 Subject: [PATCH 0375/1833] [cfggen] Add tool to translate openconfig acl into sonic format (#388) * Build sonic-config-engine as whl instead of deb package * Add tool to translate openconfig acl into sonic format --- dockers/docker-config-engine/Dockerfile.j2 | 29 +- .../build_templates/sonic_debian_extension.j2 | 18 +- rules/docker-config-engine.mk | 2 +- rules/sonic-config.mk | 5 +- slave.mk | 5 +- src/sonic-config-engine/openconfig_acl.py | 7544 +++++++++++++++++ src/sonic-config-engine/setup.py | 6 +- src/sonic-config-engine/translate_acl | 139 + 8 files changed, 7730 insertions(+), 18 deletions(-) create mode 100644 src/sonic-config-engine/openconfig_acl.py create mode 100755 src/sonic-config-engine/translate_acl diff --git a/dockers/docker-config-engine/Dockerfile.j2 b/dockers/docker-config-engine/Dockerfile.j2 index 067983724014..68555d44779b 100644 --- a/dockers/docker-config-engine/Dockerfile.j2 +++ b/dockers/docker-config-engine/Dockerfile.j2 @@ -6,19 +6,42 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update # Dependencies for sonic-cfggen -RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml +RUN apt-get install -y python-lxml python-yaml python-bitarray python-pip python-dev +RUN pip install --upgrade pip + +RUN pip install netaddr ipaddr jinja2 pyangbind + +{% if docker_config_engine_debs.strip() %} COPY \ {% for deb in docker_config_engine_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ +{%- endif -%} +{% if docker_config_engine_debs.strip() %} RUN dpkg -i \ {% for deb in docker_config_engine_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} +{%- endif -%} + +{% if docker_config_engine_whls.strip() %} +COPY \ +{% for whl in docker_config_engine_whls.split(' ') -%} +python-wheels/{{ whl }}{{' '}} +{%- endfor -%} +python-wheels/ +{%- endif -%} + +{% if docker_config_engine_whls.strip() %} +RUN pip install \ +{% for whl in docker_config_engine_whls.split(' ') -%} +python-wheels/{{ whl }}{{' '}} +{%- endfor %} +{%- endif -%} ## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs +RUN apt-get remove -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs /python-wheels diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 5d079ea35c7d..cba88c4eabac 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -54,17 +54,17 @@ sudo cp $IMAGE_CONFIGS/environment/motd $FILESYSTEM_ROOT/etc/ sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ sudo mkdir -p $FILESYSTEM_ROOT/usr/share/sonic/templates/ -# Install dependencies for SONiC config engine -# TODO: pip-install instead of apt-get after config engine wrapped into a wheel, even better use pip implicitly installing dependencies +# Install dependencies for SONiC config engine sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ + python-dev \ python-lxml \ - python-jinja2 \ - python-netaddr \ - python-ipaddr \ - python-yaml + python-yaml \ + python-bitarray # Install SONiC config engine -sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} +CONFIG_ENGINE_WHL_NAME=`basename {{config_engine}}` +sudo cp {{config_engine}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHL_NAME +sudo chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHL_NAME # Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ @@ -191,6 +191,10 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys {% endif %} +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get remove -y python-dev +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get autoremove -y + {% for file in installer_extra_files.split(' ') -%} {% if file.strip() -%} {% set src = file.split(':')[0] -%} diff --git a/rules/docker-config-engine.mk b/rules/docker-config-engine.mk index 8f168cc441ac..ca0a6a739778 100644 --- a/rules/docker-config-engine.mk +++ b/rules/docker-config-engine.mk @@ -2,6 +2,6 @@ DOCKER_CONFIG_ENGINE = docker-config-engine.gz $(DOCKER_CONFIG_ENGINE)_PATH = $(DOCKERS_PATH)/docker-config-engine -$(DOCKER_CONFIG_ENGINE)_DEPENDS += $(SONIC_CONFIG_ENGINE) +$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE) $(DOCKER_CONFIG_ENGINE)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE) diff --git a/rules/sonic-config.mk b/rules/sonic-config.mk index e0f6504bf994..3dc295c44a69 100644 --- a/rules/sonic-config.mk +++ b/rules/sonic-config.mk @@ -1,5 +1,6 @@ # sonic-config-engine package -SONIC_CONFIG_ENGINE = python-sonic-config-engine_1.0-1_all.deb +SONIC_CONFIG_ENGINE = sonic_config_engine-1.0-py2-none-any.whl $(SONIC_CONFIG_ENGINE)_SRC_PATH = $(SRC_PATH)/sonic-config-engine -SONIC_PYTHON_STDEB_DEBS += $(SONIC_CONFIG_ENGINE) +$(SONIC_CONFIG_ENGINE)_PYTHON_VERSION = 2 +SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE) diff --git a/slave.mk b/slave.mk index 34d13202ecef..2b7e45a07e92 100644 --- a/slave.mk +++ b/slave.mk @@ -280,6 +280,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG) # Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')) + $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile docker build --squash --no-cache -t $* $($*.gz_PATH) $(LOG) @@ -299,7 +300,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_CONFIG_ENGINE) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) $(HEADER) ## Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" @@ -308,7 +309,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))" export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))" export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" - export config_engine="$(addprefix $(DEBS_PATH)/,$(SONIC_CONFIG_ENGINE))" + export config_engine="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))" export image_type="$($*_IMAGE_TYPE)" export sonicadmin_user="$(USERNAME)" export sonic_asic_platform="$(CONFIGURED_PLATFORM)" diff --git a/src/sonic-config-engine/openconfig_acl.py b/src/sonic-config-engine/openconfig_acl.py new file mode 100644 index 000000000000..92ff414ed23e --- /dev/null +++ b/src/sonic-config-engine/openconfig_acl.py @@ -0,0 +1,7544 @@ +# This file is auto generated by pyangbind: https://github.com/robshakir/pyangbind +# from https://github.com/openconfig/public/blob/master/release/models/acl/openconfig-acl.yang +# +# Detail step to regenerate this file: +# 1. Sync openconfig ACL yang models from https://github.com/openconfig/public/tree/master/release/models/acl +# 2. Sync inet yang models which contain type dependencies for openconfig ACL yang models from https://github.com/YangModels/yang/tree/master/standard/ietf/RFC , and put them in the same folder with models from step 1. +# 3. Install PyangBind: +# pip install pyangbind +# 4. Get PyangBind install path: +# export PYBINDPLUGIN=`/usr/bin/env python -c \ +# 'import pyangbind; import os; print "%s/plugin" % os.path.dirname(pyangbind.__file__)'` +# 5. Generate this file with pyang: +# pyang --plugindir $PYBINDPLUGIN -f pybind -o openconfig_acl.py openconfig-acl.yang + +from operator import attrgetter +from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType +from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType +from pyangbind.lib.base import PybindBase +from decimal import Decimal +from bitarray import bitarray +import __builtin__ +class yc_state_openconfig_acl__acl_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Global operational state data for ACLs + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__counter_capability',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__counter_capability = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-acl:AGGREGATE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_AGGREGATE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'AGGREGATE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'INTERFACE_AGGREGATE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'INTERFACE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'state'] + + def _get_counter_capability(self): + """ + Getter method for counter_capability, mapped from YANG variable /acl/state/counter_capability (identityref) + + YANG Description: System reported indication of how ACL counters are reported +by the target + """ + return self.__counter_capability + + def _set_counter_capability(self, v, load=False): + """ + Setter method for counter_capability, mapped from YANG variable /acl/state/counter_capability (identityref) + If this variable is read-only (config: false) in the + source YANG file, then _set_counter_capability is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_counter_capability() directly. + + YANG Description: System reported indication of how ACL counters are reported +by the target + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-acl:AGGREGATE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_AGGREGATE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'AGGREGATE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'INTERFACE_AGGREGATE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'INTERFACE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """counter_capability must be of a type compatible with identityref""", + 'defined-type': "openconfig-acl:identityref", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-acl:AGGREGATE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_AGGREGATE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'AGGREGATE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'INTERFACE_AGGREGATE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'INTERFACE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", + }) + + self.__counter_capability = t + if hasattr(self, '_set'): + self._set() + + def _unset_counter_capability(self): + self.__counter_capability = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-acl:AGGREGATE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_AGGREGATE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'AGGREGATE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'INTERFACE_AGGREGATE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'INTERFACE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:INTERFACE_ONLY': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="counter-capability", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + + counter_capability = __builtin__.property(_get_counter_capability) + + + _pyangbind_elements = {'counter_capability': counter_capability, } + + +class yc_config_openconfig_acl__acl_acl_sets_acl_set_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Access list config + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__name','__description',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__name = YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + self.__description = YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'config'] + + def _get_name(self): + """ + Getter method for name, mapped from YANG variable /acl/acl_sets/acl_set/config/name (string) + + YANG Description: The name of the access-list set + """ + return self.__name + + def _set_name(self, v, load=False): + """ + Setter method for name, mapped from YANG variable /acl/acl_sets/acl_set/config/name (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_name is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_name() directly. + + YANG Description: The name of the access-list set + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """name must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True)""", + }) + + self.__name = t + if hasattr(self, '_set'): + self._set() + + def _unset_name(self): + self.__name = YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + + + def _get_description(self): + """ + Getter method for description, mapped from YANG variable /acl/acl_sets/acl_set/config/description (string) + + YANG Description: Description, or comment, for the ACL set + """ + return self.__description + + def _set_description(self, v, load=False): + """ + Setter method for description, mapped from YANG variable /acl/acl_sets/acl_set/config/description (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_description is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_description() directly. + + YANG Description: Description, or comment, for the ACL set + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """description must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True)""", + }) + + self.__description = t + if hasattr(self, '_set'): + self._set() + + def _unset_description(self): + self.__description = YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + + name = __builtin__.property(_get_name, _set_name) + description = __builtin__.property(_get_description, _set_description) + + + _pyangbind_elements = {'name': name, 'description': description, } + + +class yc_state_openconfig_acl__acl_acl_sets_acl_set_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Access list state information + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__name','__description',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__name = YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + self.__description = YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'state'] + + def _get_name(self): + """ + Getter method for name, mapped from YANG variable /acl/acl_sets/acl_set/state/name (string) + + YANG Description: The name of the access-list set + """ + return self.__name + + def _set_name(self, v, load=False): + """ + Setter method for name, mapped from YANG variable /acl/acl_sets/acl_set/state/name (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_name is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_name() directly. + + YANG Description: The name of the access-list set + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """name must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False)""", + }) + + self.__name = t + if hasattr(self, '_set'): + self._set() + + def _unset_name(self): + self.__name = YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + + + def _get_description(self): + """ + Getter method for description, mapped from YANG variable /acl/acl_sets/acl_set/state/description (string) + + YANG Description: Description, or comment, for the ACL set + """ + return self.__description + + def _set_description(self, v, load=False): + """ + Setter method for description, mapped from YANG variable /acl/acl_sets/acl_set/state/description (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_description is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_description() directly. + + YANG Description: Description, or comment, for the ACL set + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """description must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False)""", + }) + + self.__description = t + if hasattr(self, '_set'): + self._set() + + def _unset_description(self): + self.__description = YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + + name = __builtin__.property(_get_name) + description = __builtin__.property(_get_description) + + + _pyangbind_elements = {'name': name, 'description': description, } + + +class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Access list entries config + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__description',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=True) + self.__description = YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'config'] + + def _get_sequence_id(self): + """ + Getter method for sequence_id, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/config/sequence_id (uint32) + + YANG Description: The sequence id determines the order in which ACL entries +are applied. The sequence id must be unique for each entry +in an ACL set. Target devices should apply the ACL entry +rules in the order determined by sequence id, rather than +the relying only on order in the list. + """ + return self.__sequence_id + + def _set_sequence_id(self, v, load=False): + """ + Setter method for sequence_id, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/config/sequence_id (uint32) + If this variable is read-only (config: false) in the + source YANG file, then _set_sequence_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_sequence_id() directly. + + YANG Description: The sequence id determines the order in which ACL entries +are applied. The sequence id must be unique for each entry +in an ACL set. Target devices should apply the ACL entry +rules in the order determined by sequence id, rather than +the relying only on order in the list. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """sequence_id must be of a type compatible with uint32""", + 'defined-type': "uint32", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=True)""", + }) + + self.__sequence_id = t + if hasattr(self, '_set'): + self._set() + + def _unset_sequence_id(self): + self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=True) + + + def _get_description(self): + """ + Getter method for description, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/config/description (string) + + YANG Description: A user-defined description, or comment, for this Access List +Entry. + """ + return self.__description + + def _set_description(self, v, load=False): + """ + Setter method for description, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/config/description (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_description is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_description() directly. + + YANG Description: A user-defined description, or comment, for this Access List +Entry. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """description must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True)""", + }) + + self.__description = t + if hasattr(self, '_set'): + self._set() + + def _unset_description(self): + self.__description = YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=True) + + sequence_id = __builtin__.property(_get_sequence_id, _set_sequence_id) + description = __builtin__.property(_get_description, _set_description) + + + _pyangbind_elements = {'sequence_id': sequence_id, 'description': description, } + + +class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: State information for ACL entries + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__description','__matched_packets','__matched_octets',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=False) + self.__description = YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'state'] + + def _get_sequence_id(self): + """ + Getter method for sequence_id, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/state/sequence_id (uint32) + + YANG Description: The sequence id determines the order in which ACL entries +are applied. The sequence id must be unique for each entry +in an ACL set. Target devices should apply the ACL entry +rules in the order determined by sequence id, rather than +the relying only on order in the list. + """ + return self.__sequence_id + + def _set_sequence_id(self, v, load=False): + """ + Setter method for sequence_id, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/state/sequence_id (uint32) + If this variable is read-only (config: false) in the + source YANG file, then _set_sequence_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_sequence_id() directly. + + YANG Description: The sequence id determines the order in which ACL entries +are applied. The sequence id must be unique for each entry +in an ACL set. Target devices should apply the ACL entry +rules in the order determined by sequence id, rather than +the relying only on order in the list. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """sequence_id must be of a type compatible with uint32""", + 'defined-type': "uint32", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=False)""", + }) + + self.__sequence_id = t + if hasattr(self, '_set'): + self._set() + + def _unset_sequence_id(self): + self.__sequence_id = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint32', is_config=False) + + + def _get_description(self): + """ + Getter method for description, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/state/description (string) + + YANG Description: A user-defined description, or comment, for this Access List +Entry. + """ + return self.__description + + def _set_description(self, v, load=False): + """ + Setter method for description, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/state/description (string) + If this variable is read-only (config: false) in the + source YANG file, then _set_description is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_description() directly. + + YANG Description: A user-defined description, or comment, for this Access List +Entry. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """description must be of a type compatible with string""", + 'defined-type': "string", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False)""", + }) + + self.__description = t + if hasattr(self, '_set'): + self._set() + + def _unset_description(self): + self.__description = YANGDynClass(base=unicode, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='string', is_config=False) + + + def _get_matched_packets(self): + """ + Getter method for matched_packets, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/state/matched_packets (yang:counter64) + + YANG Description: Count of the number of packets matching the current ACL +entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + return self.__matched_packets + + def _set_matched_packets(self, v, load=False): + """ + Setter method for matched_packets, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/state/matched_packets (yang:counter64) + If this variable is read-only (config: false) in the + source YANG file, then _set_matched_packets is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_matched_packets() directly. + + YANG Description: Count of the number of packets matching the current ACL +entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """matched_packets must be of a type compatible with yang:counter64""", + 'defined-type': "yang:counter64", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False)""", + }) + + self.__matched_packets = t + if hasattr(self, '_set'): + self._set() + + def _unset_matched_packets(self): + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + + + def _get_matched_octets(self): + """ + Getter method for matched_octets, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/state/matched_octets (yang:counter64) + + YANG Description: Count of the number of octets (bytes) matching the current +ACL entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + return self.__matched_octets + + def _set_matched_octets(self, v, load=False): + """ + Setter method for matched_octets, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/state/matched_octets (yang:counter64) + If this variable is read-only (config: false) in the + source YANG file, then _set_matched_octets is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_matched_octets() directly. + + YANG Description: Count of the number of octets (bytes) matching the current +ACL entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """matched_octets must be of a type compatible with yang:counter64""", + 'defined-type': "yang:counter64", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False)""", + }) + + self.__matched_octets = t + if hasattr(self, '_set'): + self._set() + + def _unset_matched_octets(self): + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + + sequence_id = __builtin__.property(_get_sequence_id) + description = __builtin__.property(_get_description) + matched_packets = __builtin__.property(_get_matched_packets) + matched_octets = __builtin__.property(_get_matched_octets) + + + _pyangbind_elements = {'sequence_id': sequence_id, 'description': description, 'matched_packets': matched_packets, 'matched_octets': matched_octets, } + + +class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/l2/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Configuration data + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__source_mac','__source_mac_mask','__destination_mac','__destination_mac_mask','__ethertype',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'1..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True) + self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'l2', u'config'] + + def _get_source_mac(self): + """ + Getter method for source_mac, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/source_mac (yang:mac-address) + + YANG Description: Source IEEE 802 MAC address. + """ + return self.__source_mac + + def _set_source_mac(self, v, load=False): + """ + Setter method for source_mac, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/source_mac (yang:mac-address) + If this variable is read-only (config: false) in the + source YANG file, then _set_source_mac is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_source_mac() directly. + + YANG Description: Source IEEE 802 MAC address. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """source_mac must be of a type compatible with yang:mac-address""", + 'defined-type': "yang:mac-address", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", + }) + + self.__source_mac = t + if hasattr(self, '_set'): + self._set() + + def _unset_source_mac(self): + self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + + + def _get_source_mac_mask(self): + """ + Getter method for source_mac_mask, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/source_mac_mask (yang:mac-address) + + YANG Description: Source IEEE 802 MAC address mask. + """ + return self.__source_mac_mask + + def _set_source_mac_mask(self, v, load=False): + """ + Setter method for source_mac_mask, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/source_mac_mask (yang:mac-address) + If this variable is read-only (config: false) in the + source YANG file, then _set_source_mac_mask is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_source_mac_mask() directly. + + YANG Description: Source IEEE 802 MAC address mask. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """source_mac_mask must be of a type compatible with yang:mac-address""", + 'defined-type': "yang:mac-address", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", + }) + + self.__source_mac_mask = t + if hasattr(self, '_set'): + self._set() + + def _unset_source_mac_mask(self): + self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + + + def _get_destination_mac(self): + """ + Getter method for destination_mac, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/destination_mac (yang:mac-address) + + YANG Description: Destination IEEE 802 MAC address. + """ + return self.__destination_mac + + def _set_destination_mac(self, v, load=False): + """ + Setter method for destination_mac, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/destination_mac (yang:mac-address) + If this variable is read-only (config: false) in the + source YANG file, then _set_destination_mac is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_destination_mac() directly. + + YANG Description: Destination IEEE 802 MAC address. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """destination_mac must be of a type compatible with yang:mac-address""", + 'defined-type': "yang:mac-address", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", + }) + + self.__destination_mac = t + if hasattr(self, '_set'): + self._set() + + def _unset_destination_mac(self): + self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + + + def _get_destination_mac_mask(self): + """ + Getter method for destination_mac_mask, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/destination_mac_mask (yang:mac-address) + + YANG Description: Destination IEEE 802 MAC address mask. + """ + return self.__destination_mac_mask + + def _set_destination_mac_mask(self, v, load=False): + """ + Setter method for destination_mac_mask, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/destination_mac_mask (yang:mac-address) + If this variable is read-only (config: false) in the + source YANG file, then _set_destination_mac_mask is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_destination_mac_mask() directly. + + YANG Description: Destination IEEE 802 MAC address mask. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """destination_mac_mask must be of a type compatible with yang:mac-address""", + 'defined-type': "yang:mac-address", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True)""", + }) + + self.__destination_mac_mask = t + if hasattr(self, '_set'): + self._set() + + def _unset_destination_mac_mask(self): + self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=True) + + + def _get_ethertype(self): + """ + Getter method for ethertype, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/ethertype (oc-pkt-match-types:ethertype-type) + + YANG Description: Ethertype field to match in Ethernet packets + """ + return self.__ethertype + + def _set_ethertype(self, v, load=False): + """ + Setter method for ethertype, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config/ethertype (oc-pkt-match-types:ethertype-type) + If this variable is read-only (config: false) in the + source YANG file, then _set_ethertype is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_ethertype() directly. + + YANG Description: Ethertype field to match in Ethernet packets + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'1..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """ethertype must be of a type compatible with oc-pkt-match-types:ethertype-type""", + 'defined-type': "oc-pkt-match-types:ethertype-type", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'1..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True)""", + }) + + self.__ethertype = t + if hasattr(self, '_set'): + self._set() + + def _unset_ethertype(self): + self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'1..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=True) + + source_mac = __builtin__.property(_get_source_mac, _set_source_mac) + source_mac_mask = __builtin__.property(_get_source_mac_mask, _set_source_mac_mask) + destination_mac = __builtin__.property(_get_destination_mac, _set_destination_mac) + destination_mac_mask = __builtin__.property(_get_destination_mac_mask, _set_destination_mac_mask) + ethertype = __builtin__.property(_get_ethertype, _set_ethertype) + + + _pyangbind_elements = {'source_mac': source_mac, 'source_mac_mask': source_mac_mask, 'destination_mac': destination_mac, 'destination_mac_mask': destination_mac_mask, 'ethertype': ethertype, } + + +class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/l2/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: State Information. + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__source_mac','__source_mac_mask','__destination_mac','__destination_mac_mask','__ethertype',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'1..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False) + self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'l2', u'state'] + + def _get_source_mac(self): + """ + Getter method for source_mac, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state/source_mac (yang:mac-address) + + YANG Description: Source IEEE 802 MAC address. + """ + return self.__source_mac + + def _set_source_mac(self, v, load=False): + """ + Setter method for source_mac, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state/source_mac (yang:mac-address) + If this variable is read-only (config: false) in the + source YANG file, then _set_source_mac is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_source_mac() directly. + + YANG Description: Source IEEE 802 MAC address. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """source_mac must be of a type compatible with yang:mac-address""", + 'defined-type': "yang:mac-address", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", + }) + + self.__source_mac = t + if hasattr(self, '_set'): + self._set() + + def _unset_source_mac(self): + self.__source_mac = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + + + def _get_source_mac_mask(self): + """ + Getter method for source_mac_mask, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state/source_mac_mask (yang:mac-address) + + YANG Description: Source IEEE 802 MAC address mask. + """ + return self.__source_mac_mask + + def _set_source_mac_mask(self, v, load=False): + """ + Setter method for source_mac_mask, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state/source_mac_mask (yang:mac-address) + If this variable is read-only (config: false) in the + source YANG file, then _set_source_mac_mask is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_source_mac_mask() directly. + + YANG Description: Source IEEE 802 MAC address mask. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """source_mac_mask must be of a type compatible with yang:mac-address""", + 'defined-type': "yang:mac-address", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", + }) + + self.__source_mac_mask = t + if hasattr(self, '_set'): + self._set() + + def _unset_source_mac_mask(self): + self.__source_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="source-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + + + def _get_destination_mac(self): + """ + Getter method for destination_mac, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state/destination_mac (yang:mac-address) + + YANG Description: Destination IEEE 802 MAC address. + """ + return self.__destination_mac + + def _set_destination_mac(self, v, load=False): + """ + Setter method for destination_mac, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state/destination_mac (yang:mac-address) + If this variable is read-only (config: false) in the + source YANG file, then _set_destination_mac is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_destination_mac() directly. + + YANG Description: Destination IEEE 802 MAC address. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """destination_mac must be of a type compatible with yang:mac-address""", + 'defined-type': "yang:mac-address", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", + }) + + self.__destination_mac = t + if hasattr(self, '_set'): + self._set() + + def _unset_destination_mac(self): + self.__destination_mac = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + + + def _get_destination_mac_mask(self): + """ + Getter method for destination_mac_mask, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state/destination_mac_mask (yang:mac-address) + + YANG Description: Destination IEEE 802 MAC address mask. + """ + return self.__destination_mac_mask + + def _set_destination_mac_mask(self, v, load=False): + """ + Setter method for destination_mac_mask, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state/destination_mac_mask (yang:mac-address) + If this variable is read-only (config: false) in the + source YANG file, then _set_destination_mac_mask is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_destination_mac_mask() directly. + + YANG Description: Destination IEEE 802 MAC address mask. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """destination_mac_mask must be of a type compatible with yang:mac-address""", + 'defined-type': "yang:mac-address", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False)""", + }) + + self.__destination_mac_mask = t + if hasattr(self, '_set'): + self._set() + + def _unset_destination_mac_mask(self): + self.__destination_mac_mask = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'}), is_leaf=True, yang_name="destination-mac-mask", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:mac-address', is_config=False) + + + def _get_ethertype(self): + """ + Getter method for ethertype, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state/ethertype (oc-pkt-match-types:ethertype-type) + + YANG Description: Ethertype field to match in Ethernet packets + """ + return self.__ethertype + + def _set_ethertype(self, v, load=False): + """ + Setter method for ethertype, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state/ethertype (oc-pkt-match-types:ethertype-type) + If this variable is read-only (config: false) in the + source YANG file, then _set_ethertype is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_ethertype() directly. + + YANG Description: Ethertype field to match in Ethernet packets + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'1..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """ethertype must be of a type compatible with oc-pkt-match-types:ethertype-type""", + 'defined-type': "oc-pkt-match-types:ethertype-type", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'1..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False)""", + }) + + self.__ethertype = t + if hasattr(self, '_set'): + self._set() + + def _unset_ethertype(self): + self.__ethertype = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'1..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_ARP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_VLAN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_ROCE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV6': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_MPLS': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:ETHERTYPE_IPV4': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'ETHERTYPE_LLDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="ethertype", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ethertype-type', is_config=False) + + source_mac = __builtin__.property(_get_source_mac) + source_mac_mask = __builtin__.property(_get_source_mac_mask) + destination_mac = __builtin__.property(_get_destination_mac) + destination_mac_mask = __builtin__.property(_get_destination_mac_mask) + ethertype = __builtin__.property(_get_ethertype) + + + _pyangbind_elements = {'source_mac': source_mac, 'source_mac_mask': source_mac_mask, 'destination_mac': destination_mac, 'destination_mac_mask': destination_mac_mask, 'ethertype': ethertype, } + + +class yc_l2_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/l2. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Ethernet header fields + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + + _yang_name = 'l2' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'l2'] + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config (container) + + YANG Description: Configuration data + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Configuration data + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state (container) + + YANG Description: State Information. + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: State Information. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + + + _pyangbind_elements = {'config': config, 'state': state, } + + +class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/ip/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Configuration data + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__ip_version','__source_ip_address','__source_ip_flow_label','__destination_ip_address','__destination_ip_flow_label','__dscp','__protocol','__hop_limit',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True) + self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..254']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True) + self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True) + self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'unknown': {'value': 0}, u'ipv4': {'value': 1}, u'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True) + self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'ip', u'config'] + + def _get_ip_version(self): + """ + Getter method for ip_version, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/ip_version (inet:ip-version) + + YANG Description: IP version of the header. + """ + return self.__ip_version + + def _set_ip_version(self, v, load=False): + """ + Setter method for ip_version, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/ip_version (inet:ip-version) + If this variable is read-only (config: false) in the + source YANG file, then _set_ip_version is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_ip_version() directly. + + YANG Description: IP version of the header. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'unknown': {'value': 0}, u'ipv4': {'value': 1}, u'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """ip_version must be of a type compatible with inet:ip-version""", + 'defined-type': "inet:ip-version", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'unknown': {'value': 0}, u'ipv4': {'value': 1}, u'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True)""", + }) + + self.__ip_version = t + if hasattr(self, '_set'): + self._set() + + def _unset_ip_version(self): + self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'unknown': {'value': 0}, u'ipv4': {'value': 1}, u'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=True) + + + def _get_source_ip_address(self): + """ + Getter method for source_ip_address, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/source_ip_address (inet:ip-prefix) + + YANG Description: Destination IP address prefix. + """ + return self.__source_ip_address + + def _set_source_ip_address(self, v, load=False): + """ + Setter method for source_ip_address, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/source_ip_address (inet:ip-prefix) + If this variable is read-only (config: false) in the + source YANG file, then _set_source_ip_address is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_source_ip_address() directly. + + YANG Description: Destination IP address prefix. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """source_ip_address must be of a type compatible with inet:ip-prefix""", + 'defined-type': "inet:ip-prefix", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True)""", + }) + + self.__source_ip_address = t + if hasattr(self, '_set'): + self._set() + + def _unset_source_ip_address(self): + self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + + + def _get_source_ip_flow_label(self): + """ + Getter method for source_ip_flow_label, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/source_ip_flow_label (inet:ipv6-flow-label) + + YANG Description: Source IPv6 Flow label. + """ + return self.__source_ip_flow_label + + def _set_source_ip_flow_label(self, v, load=False): + """ + Setter method for source_ip_flow_label, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/source_ip_flow_label (inet:ipv6-flow-label) + If this variable is read-only (config: false) in the + source YANG file, then _set_source_ip_flow_label is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_source_ip_flow_label() directly. + + YANG Description: Source IPv6 Flow label. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """source_ip_flow_label must be of a type compatible with inet:ipv6-flow-label""", + 'defined-type': "inet:ipv6-flow-label", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True)""", + }) + + self.__source_ip_flow_label = t + if hasattr(self, '_set'): + self._set() + + def _unset_source_ip_flow_label(self): + self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + + + def _get_destination_ip_address(self): + """ + Getter method for destination_ip_address, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/destination_ip_address (inet:ip-prefix) + + YANG Description: Destination IP address prefix. + """ + return self.__destination_ip_address + + def _set_destination_ip_address(self, v, load=False): + """ + Setter method for destination_ip_address, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/destination_ip_address (inet:ip-prefix) + If this variable is read-only (config: false) in the + source YANG file, then _set_destination_ip_address is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_destination_ip_address() directly. + + YANG Description: Destination IP address prefix. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """destination_ip_address must be of a type compatible with inet:ip-prefix""", + 'defined-type': "inet:ip-prefix", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True)""", + }) + + self.__destination_ip_address = t + if hasattr(self, '_set'): + self._set() + + def _unset_destination_ip_address(self): + self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=True) + + + def _get_destination_ip_flow_label(self): + """ + Getter method for destination_ip_flow_label, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/destination_ip_flow_label (inet:ipv6-flow-label) + + YANG Description: Destination IPv6 Flow label. + """ + return self.__destination_ip_flow_label + + def _set_destination_ip_flow_label(self, v, load=False): + """ + Setter method for destination_ip_flow_label, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/destination_ip_flow_label (inet:ipv6-flow-label) + If this variable is read-only (config: false) in the + source YANG file, then _set_destination_ip_flow_label is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_destination_ip_flow_label() directly. + + YANG Description: Destination IPv6 Flow label. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """destination_ip_flow_label must be of a type compatible with inet:ipv6-flow-label""", + 'defined-type': "inet:ipv6-flow-label", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True)""", + }) + + self.__destination_ip_flow_label = t + if hasattr(self, '_set'): + self._set() + + def _unset_destination_ip_flow_label(self): + self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=True) + + + def _get_dscp(self): + """ + Getter method for dscp, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/dscp (inet:dscp) + + YANG Description: Value of diffserv codepoint. + """ + return self.__dscp + + def _set_dscp(self, v, load=False): + """ + Setter method for dscp, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/dscp (inet:dscp) + If this variable is read-only (config: false) in the + source YANG file, then _set_dscp is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_dscp() directly. + + YANG Description: Value of diffserv codepoint. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """dscp must be of a type compatible with inet:dscp""", + 'defined-type': "inet:dscp", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True)""", + }) + + self.__dscp = t + if hasattr(self, '_set'): + self._set() + + def _unset_dscp(self): + self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=True) + + + def _get_protocol(self): + """ + Getter method for protocol, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/protocol (oc-pkt-match-types:ip-protocol-type) + + YANG Description: Internet Protocol number. + """ + return self.__protocol + + def _set_protocol(self, v, load=False): + """ + Setter method for protocol, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/protocol (oc-pkt-match-types:ip-protocol-type) + If this variable is read-only (config: false) in the + source YANG file, then _set_protocol is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_protocol() directly. + + YANG Description: Internet Protocol number. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..254']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """protocol must be of a type compatible with oc-pkt-match-types:ip-protocol-type""", + 'defined-type': "oc-pkt-match-types:ip-protocol-type", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..254']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True)""", + }) + + self.__protocol = t + if hasattr(self, '_set'): + self._set() + + def _unset_protocol(self): + self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..254']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=True) + + + def _get_hop_limit(self): + """ + Getter method for hop_limit, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/hop_limit (uint8) + + YANG Description: The IP packet's hop limit -- known as TTL (in hops) in +IPv4 packets, and hop limit in IPv6 + """ + return self.__hop_limit + + def _set_hop_limit(self, v, load=False): + """ + Setter method for hop_limit, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config/hop_limit (uint8) + If this variable is read-only (config: false) in the + source YANG file, then _set_hop_limit is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_hop_limit() directly. + + YANG Description: The IP packet's hop limit -- known as TTL (in hops) in +IPv4 packets, and hop limit in IPv6 + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """hop_limit must be of a type compatible with uint8""", + 'defined-type': "uint8", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True)""", + }) + + self.__hop_limit = t + if hasattr(self, '_set'): + self._set() + + def _unset_hop_limit(self): + self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=True) + + ip_version = __builtin__.property(_get_ip_version, _set_ip_version) + source_ip_address = __builtin__.property(_get_source_ip_address, _set_source_ip_address) + source_ip_flow_label = __builtin__.property(_get_source_ip_flow_label, _set_source_ip_flow_label) + destination_ip_address = __builtin__.property(_get_destination_ip_address, _set_destination_ip_address) + destination_ip_flow_label = __builtin__.property(_get_destination_ip_flow_label, _set_destination_ip_flow_label) + dscp = __builtin__.property(_get_dscp, _set_dscp) + protocol = __builtin__.property(_get_protocol, _set_protocol) + hop_limit = __builtin__.property(_get_hop_limit, _set_hop_limit) + + + _pyangbind_elements = {'ip_version': ip_version, 'source_ip_address': source_ip_address, 'source_ip_flow_label': source_ip_flow_label, 'destination_ip_address': destination_ip_address, 'destination_ip_flow_label': destination_ip_flow_label, 'dscp': dscp, 'protocol': protocol, 'hop_limit': hop_limit, } + + +class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/ip/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: State information + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__ip_version','__source_ip_address','__source_ip_flow_label','__destination_ip_address','__destination_ip_flow_label','__dscp','__protocol','__hop_limit',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False) + self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..254']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False) + self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False) + self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'unknown': {'value': 0}, u'ipv4': {'value': 1}, u'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False) + self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'ip', u'state'] + + def _get_ip_version(self): + """ + Getter method for ip_version, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/ip_version (inet:ip-version) + + YANG Description: IP version of the header. + """ + return self.__ip_version + + def _set_ip_version(self, v, load=False): + """ + Setter method for ip_version, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/ip_version (inet:ip-version) + If this variable is read-only (config: false) in the + source YANG file, then _set_ip_version is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_ip_version() directly. + + YANG Description: IP version of the header. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'unknown': {'value': 0}, u'ipv4': {'value': 1}, u'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """ip_version must be of a type compatible with inet:ip-version""", + 'defined-type': "inet:ip-version", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'unknown': {'value': 0}, u'ipv4': {'value': 1}, u'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False)""", + }) + + self.__ip_version = t + if hasattr(self, '_set'): + self._set() + + def _unset_ip_version(self): + self.__ip_version = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'unknown': {'value': 0}, u'ipv4': {'value': 1}, u'ipv6': {'value': 2}},), is_leaf=True, yang_name="ip-version", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-version', is_config=False) + + + def _get_source_ip_address(self): + """ + Getter method for source_ip_address, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/source_ip_address (inet:ip-prefix) + + YANG Description: Destination IP address prefix. + """ + return self.__source_ip_address + + def _set_source_ip_address(self, v, load=False): + """ + Setter method for source_ip_address, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/source_ip_address (inet:ip-prefix) + If this variable is read-only (config: false) in the + source YANG file, then _set_source_ip_address is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_source_ip_address() directly. + + YANG Description: Destination IP address prefix. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """source_ip_address must be of a type compatible with inet:ip-prefix""", + 'defined-type': "inet:ip-prefix", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False)""", + }) + + self.__source_ip_address = t + if hasattr(self, '_set'): + self._set() + + def _unset_source_ip_address(self): + self.__source_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="source-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + + + def _get_source_ip_flow_label(self): + """ + Getter method for source_ip_flow_label, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/source_ip_flow_label (inet:ipv6-flow-label) + + YANG Description: Source IPv6 Flow label. + """ + return self.__source_ip_flow_label + + def _set_source_ip_flow_label(self, v, load=False): + """ + Setter method for source_ip_flow_label, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/source_ip_flow_label (inet:ipv6-flow-label) + If this variable is read-only (config: false) in the + source YANG file, then _set_source_ip_flow_label is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_source_ip_flow_label() directly. + + YANG Description: Source IPv6 Flow label. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """source_ip_flow_label must be of a type compatible with inet:ipv6-flow-label""", + 'defined-type': "inet:ipv6-flow-label", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False)""", + }) + + self.__source_ip_flow_label = t + if hasattr(self, '_set'): + self._set() + + def _unset_source_ip_flow_label(self): + self.__source_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="source-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + + + def _get_destination_ip_address(self): + """ + Getter method for destination_ip_address, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/destination_ip_address (inet:ip-prefix) + + YANG Description: Destination IP address prefix. + """ + return self.__destination_ip_address + + def _set_destination_ip_address(self, v, load=False): + """ + Setter method for destination_ip_address, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/destination_ip_address (inet:ip-prefix) + If this variable is read-only (config: false) in the + source YANG file, then _set_destination_ip_address is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_destination_ip_address() directly. + + YANG Description: Destination IP address prefix. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """destination_ip_address must be of a type compatible with inet:ip-prefix""", + 'defined-type': "inet:ip-prefix", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False)""", + }) + + self.__destination_ip_address = t + if hasattr(self, '_set'): + self._set() + + def _unset_destination_ip_address(self): + self.__destination_ip_address = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'}),RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'}),], is_leaf=True, yang_name="destination-ip-address", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ip-prefix', is_config=False) + + + def _get_destination_ip_flow_label(self): + """ + Getter method for destination_ip_flow_label, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/destination_ip_flow_label (inet:ipv6-flow-label) + + YANG Description: Destination IPv6 Flow label. + """ + return self.__destination_ip_flow_label + + def _set_destination_ip_flow_label(self, v, load=False): + """ + Setter method for destination_ip_flow_label, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/destination_ip_flow_label (inet:ipv6-flow-label) + If this variable is read-only (config: false) in the + source YANG file, then _set_destination_ip_flow_label is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_destination_ip_flow_label() directly. + + YANG Description: Destination IPv6 Flow label. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """destination_ip_flow_label must be of a type compatible with inet:ipv6-flow-label""", + 'defined-type': "inet:ipv6-flow-label", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False)""", + }) + + self.__destination_ip_flow_label = t + if hasattr(self, '_set'): + self._set() + + def _unset_destination_ip_flow_label(self): + self.__destination_ip_flow_label = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': [u'0..1048575']}), is_leaf=True, yang_name="destination-ip-flow-label", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:ipv6-flow-label', is_config=False) + + + def _get_dscp(self): + """ + Getter method for dscp, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/dscp (inet:dscp) + + YANG Description: Value of diffserv codepoint. + """ + return self.__dscp + + def _set_dscp(self, v, load=False): + """ + Setter method for dscp, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/dscp (inet:dscp) + If this variable is read-only (config: false) in the + source YANG file, then _set_dscp is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_dscp() directly. + + YANG Description: Value of diffserv codepoint. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """dscp must be of a type compatible with inet:dscp""", + 'defined-type': "inet:dscp", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False)""", + }) + + self.__dscp = t + if hasattr(self, '_set'): + self._set() + + def _unset_dscp(self): + self.__dscp = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..63']}), is_leaf=True, yang_name="dscp", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='inet:dscp', is_config=False) + + + def _get_protocol(self): + """ + Getter method for protocol, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/protocol (oc-pkt-match-types:ip-protocol-type) + + YANG Description: Internet Protocol number. + """ + return self.__protocol + + def _set_protocol(self, v, load=False): + """ + Setter method for protocol, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/protocol (oc-pkt-match-types:ip-protocol-type) + If this variable is read-only (config: false) in the + source YANG file, then _set_protocol is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_protocol() directly. + + YANG Description: Internet Protocol number. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..254']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """protocol must be of a type compatible with oc-pkt-match-types:ip-protocol-type""", + 'defined-type': "oc-pkt-match-types:ip-protocol-type", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..254']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False)""", + }) + + self.__protocol = t + if hasattr(self, '_set'): + self._set() + + def _unset_protocol(self): + self.__protocol = YANGDynClass(base=[RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..254']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'oc-pkt-match-types:IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_L2TP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_TCP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_AUTH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_GRE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_RSVP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_PIM': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_UDP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:IP_IGMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'IP_ICMP': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},),], is_leaf=True, yang_name="protocol", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:ip-protocol-type', is_config=False) + + + def _get_hop_limit(self): + """ + Getter method for hop_limit, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/hop_limit (uint8) + + YANG Description: The IP packet's hop limit -- known as TTL (in hops) in +IPv4 packets, and hop limit in IPv6 + """ + return self.__hop_limit + + def _set_hop_limit(self, v, load=False): + """ + Setter method for hop_limit, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state/hop_limit (uint8) + If this variable is read-only (config: false) in the + source YANG file, then _set_hop_limit is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_hop_limit() directly. + + YANG Description: The IP packet's hop limit -- known as TTL (in hops) in +IPv4 packets, and hop limit in IPv6 + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """hop_limit must be of a type compatible with uint8""", + 'defined-type': "uint8", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False)""", + }) + + self.__hop_limit = t + if hasattr(self, '_set'): + self._set() + + def _unset_hop_limit(self): + self.__hop_limit = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), restriction_dict={'range': [u'0..255']}), is_leaf=True, yang_name="hop-limit", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='uint8', is_config=False) + + ip_version = __builtin__.property(_get_ip_version) + source_ip_address = __builtin__.property(_get_source_ip_address) + source_ip_flow_label = __builtin__.property(_get_source_ip_flow_label) + destination_ip_address = __builtin__.property(_get_destination_ip_address) + destination_ip_flow_label = __builtin__.property(_get_destination_ip_flow_label) + dscp = __builtin__.property(_get_dscp) + protocol = __builtin__.property(_get_protocol) + hop_limit = __builtin__.property(_get_hop_limit) + + + _pyangbind_elements = {'ip_version': ip_version, 'source_ip_address': source_ip_address, 'source_ip_flow_label': source_ip_flow_label, 'destination_ip_address': destination_ip_address, 'destination_ip_flow_label': destination_ip_flow_label, 'dscp': dscp, 'protocol': protocol, 'hop_limit': hop_limit, } + + +class yc_ip_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/ip. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Top level container + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + + _yang_name = 'ip' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'ip'] + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config (container) + + YANG Description: Configuration data + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Configuration data + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state (container) + + YANG Description: State information + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: State information + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + + + _pyangbind_elements = {'config': config, 'state': state, } + + +class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/transport/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Configuration data + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__source_port','__destination_port','__tcp_flags',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + self.__tcp_flags = YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'transport', u'config'] + + def _get_source_port(self): + """ + Getter method for source_port, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/config/source_port (oc-pkt-match-types:port-num-range) + + YANG Description: Source port or range + """ + return self.__source_port + + def _set_source_port(self, v, load=False): + """ + Setter method for source_port, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/config/source_port (oc-pkt-match-types:port-num-range) + If this variable is read-only (config: false) in the + source YANG file, then _set_source_port is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_source_port() directly. + + YANG Description: Source port or range + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """source_port must be of a type compatible with oc-pkt-match-types:port-num-range""", + 'defined-type': "oc-pkt-match-types:port-num-range", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True)""", + }) + + self.__source_port = t + if hasattr(self, '_set'): + self._set() + + def _unset_source_port(self): + self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + + + def _get_destination_port(self): + """ + Getter method for destination_port, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/config/destination_port (oc-pkt-match-types:port-num-range) + + YANG Description: Destination port or range + """ + return self.__destination_port + + def _set_destination_port(self, v, load=False): + """ + Setter method for destination_port, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/config/destination_port (oc-pkt-match-types:port-num-range) + If this variable is read-only (config: false) in the + source YANG file, then _set_destination_port is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_destination_port() directly. + + YANG Description: Destination port or range + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """destination_port must be of a type compatible with oc-pkt-match-types:port-num-range""", + 'defined-type': "oc-pkt-match-types:port-num-range", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True)""", + }) + + self.__destination_port = t + if hasattr(self, '_set'): + self._set() + + def _unset_destination_port(self): + self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=True) + + + def _get_tcp_flags(self): + """ + Getter method for tcp_flags, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/config/tcp_flags (identityref) + + YANG Description: List of TCP flags to match + """ + return self.__tcp_flags + + def _set_tcp_flags(self, v, load=False): + """ + Setter method for tcp_flags, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/config/tcp_flags (identityref) + If this variable is read-only (config: false) in the + source YANG file, then _set_tcp_flags is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_tcp_flags() directly. + + YANG Description: List of TCP flags to match + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=TypedListType(allowed_type=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """tcp_flags must be of a type compatible with identityref""", + 'defined-type': "openconfig-acl:identityref", + 'generated-type': """YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True)""", + }) + + self.__tcp_flags = t + if hasattr(self, '_set'): + self._set() + + def _unset_tcp_flags(self): + self.__tcp_flags = YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + + source_port = __builtin__.property(_get_source_port, _set_source_port) + destination_port = __builtin__.property(_get_destination_port, _set_destination_port) + tcp_flags = __builtin__.property(_get_tcp_flags, _set_tcp_flags) + + + _pyangbind_elements = {'source_port': source_port, 'destination_port': destination_port, 'tcp_flags': tcp_flags, } + + +class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/transport/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: State data + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__source_port','__destination_port','__tcp_flags',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + self.__tcp_flags = YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'transport', u'state'] + + def _get_source_port(self): + """ + Getter method for source_port, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/state/source_port (oc-pkt-match-types:port-num-range) + + YANG Description: Source port or range + """ + return self.__source_port + + def _set_source_port(self, v, load=False): + """ + Setter method for source_port, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/state/source_port (oc-pkt-match-types:port-num-range) + If this variable is read-only (config: false) in the + source YANG file, then _set_source_port is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_source_port() directly. + + YANG Description: Source port or range + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """source_port must be of a type compatible with oc-pkt-match-types:port-num-range""", + 'defined-type': "oc-pkt-match-types:port-num-range", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False)""", + }) + + self.__source_port = t + if hasattr(self, '_set'): + self._set() + + def _unset_source_port(self): + self.__source_port = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + + + def _get_destination_port(self): + """ + Getter method for destination_port, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/state/destination_port (oc-pkt-match-types:port-num-range) + + YANG Description: Destination port or range + """ + return self.__destination_port + + def _set_destination_port(self, v, load=False): + """ + Setter method for destination_port, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/state/destination_port (oc-pkt-match-types:port-num-range) + If this variable is read-only (config: false) in the + source YANG file, then _set_destination_port is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_destination_port() directly. + + YANG Description: Destination port or range + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """destination_port must be of a type compatible with oc-pkt-match-types:port-num-range""", + 'defined-type': "oc-pkt-match-types:port-num-range", + 'generated-type': """YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False)""", + }) + + self.__destination_port = t + if hasattr(self, '_set'): + self._set() + + def _unset_destination_port(self): + self.__destination_port = YANGDynClass(base=[RestrictedClassType(base_type=unicode, restriction_dict={'pattern': u'^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': [u'0..65535']}),RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-pkt-match-types:port-num-range', is_config=False) + + + def _get_tcp_flags(self): + """ + Getter method for tcp_flags, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/state/tcp_flags (identityref) + + YANG Description: List of TCP flags to match + """ + return self.__tcp_flags + + def _set_tcp_flags(self, v, load=False): + """ + Setter method for tcp_flags, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/state/tcp_flags (identityref) + If this variable is read-only (config: false) in the + source YANG file, then _set_tcp_flags is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_tcp_flags() directly. + + YANG Description: List of TCP flags to match + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=TypedListType(allowed_type=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """tcp_flags must be of a type compatible with identityref""", + 'defined-type': "openconfig-acl:identityref", + 'generated-type': """YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", + }) + + self.__tcp_flags = t + if hasattr(self, '_set'): + self._set() + + def _unset_tcp_flags(self): + self.__tcp_flags = YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ACK': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_SYN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_CWR': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_URG': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_RST': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_FIN': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_ECE': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}, u'oc-pkt-match-types:TCP_PSH': {'@namespace': u'http://openconfig.net/yang/packet-match-types', '@module': u'openconfig-packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + + source_port = __builtin__.property(_get_source_port) + destination_port = __builtin__.property(_get_destination_port) + tcp_flags = __builtin__.property(_get_tcp_flags) + + + _pyangbind_elements = {'source_port': source_port, 'destination_port': destination_port, 'tcp_flags': tcp_flags, } + + +class yc_transport_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/transport. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Transport fields container + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + + _yang_name = 'transport' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'transport'] + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/config (container) + + YANG Description: Configuration data + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Configuration data + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/state (container) + + YANG Description: State data + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: State data + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + + + _pyangbind_elements = {'config': config, 'state': state, } + + +class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/input-interface/interface-ref/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Configured reference to interface / subinterface + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface','__subinterface',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__interface = YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__subinterface = YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'input-interface', u'interface-ref', u'config'] + + def _get_interface(self): + """ + Getter method for interface, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/config/interface (leafref) + + YANG Description: Reference to a base interface. If a reference to a +subinterface is required, this leaf must be specified +to indicate the base interface. + """ + return self.__interface + + def _set_interface(self, v, load=False): + """ + Setter method for interface, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/config/interface (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_interface is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_interface() directly. + + YANG Description: Reference to a base interface. If a reference to a +subinterface is required, this leaf must be specified +to indicate the base interface. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """interface must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__interface = t + if hasattr(self, '_set'): + self._set() + + def _unset_interface(self): + self.__interface = YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + + def _get_subinterface(self): + """ + Getter method for subinterface, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/config/subinterface (leafref) + + YANG Description: Reference to a subinterface -- this requires the base +interface to be specified using the interface leaf in +this container. If only a reference to a base interface +is requuired, this leaf should not be set. + """ + return self.__subinterface + + def _set_subinterface(self, v, load=False): + """ + Setter method for subinterface, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/config/subinterface (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_subinterface is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_subinterface() directly. + + YANG Description: Reference to a subinterface -- this requires the base +interface to be specified using the interface leaf in +this container. If only a reference to a base interface +is requuired, this leaf should not be set. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """subinterface must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__subinterface = t + if hasattr(self, '_set'): + self._set() + + def _unset_subinterface(self): + self.__subinterface = YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + interface = __builtin__.property(_get_interface, _set_interface) + subinterface = __builtin__.property(_get_subinterface, _set_subinterface) + + + _pyangbind_elements = {'interface': interface, 'subinterface': subinterface, } + + +class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/input-interface/interface-ref/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Operational state for interface-ref + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface','__subinterface',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__interface = YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__subinterface = YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'input-interface', u'interface-ref', u'state'] + + def _get_interface(self): + """ + Getter method for interface, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/state/interface (leafref) + + YANG Description: Reference to a base interface. If a reference to a +subinterface is required, this leaf must be specified +to indicate the base interface. + """ + return self.__interface + + def _set_interface(self, v, load=False): + """ + Setter method for interface, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/state/interface (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_interface is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_interface() directly. + + YANG Description: Reference to a base interface. If a reference to a +subinterface is required, this leaf must be specified +to indicate the base interface. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """interface must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + }) + + self.__interface = t + if hasattr(self, '_set'): + self._set() + + def _unset_interface(self): + self.__interface = YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + + def _get_subinterface(self): + """ + Getter method for subinterface, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/state/subinterface (leafref) + + YANG Description: Reference to a subinterface -- this requires the base +interface to be specified using the interface leaf in +this container. If only a reference to a base interface +is requuired, this leaf should not be set. + """ + return self.__subinterface + + def _set_subinterface(self, v, load=False): + """ + Setter method for subinterface, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/state/subinterface (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_subinterface is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_subinterface() directly. + + YANG Description: Reference to a subinterface -- this requires the base +interface to be specified using the interface leaf in +this container. If only a reference to a base interface +is requuired, this leaf should not be set. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """subinterface must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + }) + + self.__subinterface = t + if hasattr(self, '_set'): + self._set() + + def _unset_subinterface(self): + self.__subinterface = YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + interface = __builtin__.property(_get_interface) + subinterface = __builtin__.property(_get_subinterface) + + + _pyangbind_elements = {'interface': interface, 'subinterface': subinterface, } + + +class yc_interface_ref_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/input-interface/interface-ref. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Reference to an interface or subinterface + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + + _yang_name = 'interface-ref' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'input-interface', u'interface-ref'] + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/config (container) + + YANG Description: Configured reference to interface / subinterface + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Configured reference to interface / subinterface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/state (container) + + YANG Description: Operational state for interface-ref + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: Operational state for interface-ref + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + + + _pyangbind_elements = {'config': config, 'state': state, } + + +class yc_input_interface_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/input-interface. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Input interface container + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface_ref',) + + _yang_name = 'input-interface' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__interface_ref = YANGDynClass(base=yc_interface_ref_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'input-interface'] + + def _get_interface_ref(self): + """ + Getter method for interface_ref, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref (container) + + YANG Description: Reference to an interface or subinterface + """ + return self.__interface_ref + + def _set_interface_ref(self, v, load=False): + """ + Setter method for interface_ref, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface/interface_ref (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_interface_ref is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_interface_ref() directly. + + YANG Description: Reference to an interface or subinterface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_interface_ref_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """interface_ref must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_interface_ref_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__interface_ref = t + if hasattr(self, '_set'): + self._set() + + def _unset_interface_ref(self): + self.__interface_ref = YANGDynClass(base=yc_interface_ref_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + interface_ref = __builtin__.property(_get_interface_ref, _set_interface_ref) + + + _pyangbind_elements = {'interface_ref': interface_ref, } + + +class yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/actions/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Config data for ACL actions + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__forwarding_action','__log_action',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), default=unicode("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'actions', u'config'] + + def _get_forwarding_action(self): + """ + Getter method for forwarding_action, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/config/forwarding_action (identityref) + + YANG Description: Specifies the forwarding action. One forwarding action +must be specified for each ACL entry + """ + return self.__forwarding_action + + def _set_forwarding_action(self, v, load=False): + """ + Setter method for forwarding_action, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/config/forwarding_action (identityref) + If this variable is read-only (config: false) in the + source YANG file, then _set_forwarding_action is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_forwarding_action() directly. + + YANG Description: Specifies the forwarding action. One forwarding action +must be specified for each ACL entry + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """forwarding_action must be of a type compatible with identityref""", + 'defined-type': "openconfig-acl:identityref", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True)""", + }) + + self.__forwarding_action = t + if hasattr(self, '_set'): + self._set() + + def _unset_forwarding_action(self): + self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + + + def _get_log_action(self): + """ + Getter method for log_action, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/config/log_action (identityref) + + YANG Description: Specifies the log action and destination for +matched packets. The default is not to log the +packet. + """ + return self.__log_action + + def _set_log_action(self, v, load=False): + """ + Setter method for log_action, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/config/log_action (identityref) + If this variable is read-only (config: false) in the + source YANG file, then _set_log_action is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_log_action() directly. + + YANG Description: Specifies the log action and destination for +matched packets. The default is not to log the +packet. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), default=unicode("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """log_action must be of a type compatible with identityref""", + 'defined-type': "openconfig-acl:identityref", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), default=unicode("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True)""", + }) + + self.__log_action = t + if hasattr(self, '_set'): + self._set() + + def _unset_log_action(self): + self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), default=unicode("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=True) + + forwarding_action = __builtin__.property(_get_forwarding_action, _set_forwarding_action) + log_action = __builtin__.property(_get_log_action, _set_log_action) + + + _pyangbind_elements = {'forwarding_action': forwarding_action, 'log_action': log_action, } + + +class yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/actions/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: State information for ACL actions + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__forwarding_action','__log_action',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), default=unicode("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'actions', u'state'] + + def _get_forwarding_action(self): + """ + Getter method for forwarding_action, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/state/forwarding_action (identityref) + + YANG Description: Specifies the forwarding action. One forwarding action +must be specified for each ACL entry + """ + return self.__forwarding_action + + def _set_forwarding_action(self, v, load=False): + """ + Setter method for forwarding_action, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/state/forwarding_action (identityref) + If this variable is read-only (config: false) in the + source YANG file, then _set_forwarding_action is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_forwarding_action() directly. + + YANG Description: Specifies the forwarding action. One forwarding action +must be specified for each ACL entry + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """forwarding_action must be of a type compatible with identityref""", + 'defined-type': "openconfig-acl:identityref", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", + }) + + self.__forwarding_action = t + if hasattr(self, '_set'): + self._set() + + def _unset_forwarding_action(self): + self.__forwarding_action = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'REJECT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:ACCEPT': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:DROP': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), is_leaf=True, yang_name="forwarding-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + + + def _get_log_action(self): + """ + Getter method for log_action, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/state/log_action (identityref) + + YANG Description: Specifies the log action and destination for +matched packets. The default is not to log the +packet. + """ + return self.__log_action + + def _set_log_action(self, v, load=False): + """ + Setter method for log_action, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/state/log_action (identityref) + If this variable is read-only (config: false) in the + source YANG file, then _set_log_action is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_log_action() directly. + + YANG Description: Specifies the log action and destination for +matched packets. The default is not to log the +packet. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), default=unicode("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """log_action must be of a type compatible with identityref""", + 'defined-type': "openconfig-acl:identityref", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), default=unicode("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False)""", + }) + + self.__log_action = t + if hasattr(self, '_set'): + self._set() + + def _unset_log_action(self): + self.__log_action = YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_SYSLOG': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}, u'oc-acl:LOG_NONE': {'@namespace': u'http://openconfig.net/yang/acl', '@module': u'openconfig-acl'}},), default=unicode("LOG_NONE"), is_leaf=True, yang_name="log-action", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='identityref', is_config=False) + + forwarding_action = __builtin__.property(_get_forwarding_action) + log_action = __builtin__.property(_get_log_action) + + + _pyangbind_elements = {'forwarding_action': forwarding_action, 'log_action': log_action, } + + +class yc_actions_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry/actions. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Enclosing container for list of ACL actions associated +with an entry + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + + _yang_name = 'actions' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry', u'actions'] + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/config (container) + + YANG Description: Config data for ACL actions + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Config data for ACL actions + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/state (container) + + YANG Description: State information for ACL actions + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: State information for ACL actions + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + + + _pyangbind_elements = {'config': config, 'state': state, } + + +class yc_acl_entry_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries/acl-entry. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: List of ACL entries comprising an ACL set + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__config','__state','__l2','__ip','__transport','__input_interface','__actions',) + + _yang_name = 'acl-entry' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__ip = YANGDynClass(base=yc_ip_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip, is_container='container', yang_name="ip", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__input_interface = YANGDynClass(base=yc_input_interface_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface, is_container='container', yang_name="input-interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__actions = YANGDynClass(base=yc_actions_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions, is_container='container', yang_name="actions", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__sequence_id = YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__l2 = YANGDynClass(base=yc_l2_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2, is_container='container', yang_name="l2", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__transport = YANGDynClass(base=yc_transport_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport, is_container='container', yang_name="transport", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries', u'acl-entry'] + + def _get_sequence_id(self): + """ + Getter method for sequence_id, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/sequence_id (leafref) + + YANG Description: references the list key + """ + return self.__sequence_id + + def _set_sequence_id(self, v, load=False): + """ + Setter method for sequence_id, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/sequence_id (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_sequence_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_sequence_id() directly. + + YANG Description: references the list key + """ + parent = getattr(self, "_parent", None) + if parent is not None and load is False: + raise AttributeError("Cannot set keys directly when" + + " within an instantiated list") + + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """sequence_id must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__sequence_id = t + if hasattr(self, '_set'): + self._set() + + def _unset_sequence_id(self): + self.__sequence_id = YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/config (container) + + YANG Description: Access list entries config + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Access list entries config + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/state (container) + + YANG Description: State information for ACL entries + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: State information for ACL entries + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_l2(self): + """ + Getter method for l2, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2 (container) + + YANG Description: Ethernet header fields + """ + return self.__l2 + + def _set_l2(self, v, load=False): + """ + Setter method for l2, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/l2 (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_l2 is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_l2() directly. + + YANG Description: Ethernet header fields + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_l2_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2, is_container='container', yang_name="l2", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """l2 must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_l2_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2, is_container='container', yang_name="l2", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__l2 = t + if hasattr(self, '_set'): + self._set() + + def _unset_l2(self): + self.__l2 = YANGDynClass(base=yc_l2_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_l2, is_container='container', yang_name="l2", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_ip(self): + """ + Getter method for ip, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip (container) + + YANG Description: Top level container + """ + return self.__ip + + def _set_ip(self, v, load=False): + """ + Setter method for ip, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/ip (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_ip is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_ip() directly. + + YANG Description: Top level container + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_ip_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip, is_container='container', yang_name="ip", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """ip must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_ip_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip, is_container='container', yang_name="ip", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__ip = t + if hasattr(self, '_set'): + self._set() + + def _unset_ip(self): + self.__ip = YANGDynClass(base=yc_ip_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_ip, is_container='container', yang_name="ip", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_transport(self): + """ + Getter method for transport, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport (container) + + YANG Description: Transport fields container + """ + return self.__transport + + def _set_transport(self, v, load=False): + """ + Setter method for transport, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/transport (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_transport is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_transport() directly. + + YANG Description: Transport fields container + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_transport_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport, is_container='container', yang_name="transport", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """transport must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_transport_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport, is_container='container', yang_name="transport", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__transport = t + if hasattr(self, '_set'): + self._set() + + def _unset_transport(self): + self.__transport = YANGDynClass(base=yc_transport_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_transport, is_container='container', yang_name="transport", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_input_interface(self): + """ + Getter method for input_interface, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface (container) + + YANG Description: Input interface container + """ + return self.__input_interface + + def _set_input_interface(self, v, load=False): + """ + Setter method for input_interface, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/input_interface (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_input_interface is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_input_interface() directly. + + YANG Description: Input interface container + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_input_interface_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface, is_container='container', yang_name="input-interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """input_interface must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_input_interface_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface, is_container='container', yang_name="input-interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__input_interface = t + if hasattr(self, '_set'): + self._set() + + def _unset_input_interface(self): + self.__input_interface = YANGDynClass(base=yc_input_interface_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_input_interface, is_container='container', yang_name="input-interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_actions(self): + """ + Getter method for actions, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions (container) + + YANG Description: Enclosing container for list of ACL actions associated +with an entry + """ + return self.__actions + + def _set_actions(self, v, load=False): + """ + Setter method for actions, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry/actions (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_actions is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_actions() directly. + + YANG Description: Enclosing container for list of ACL actions associated +with an entry + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_actions_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions, is_container='container', yang_name="actions", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """actions must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_actions_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions, is_container='container', yang_name="actions", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__actions = t + if hasattr(self, '_set'): + self._set() + + def _unset_actions(self): + self.__actions = YANGDynClass(base=yc_actions_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry_actions, is_container='container', yang_name="actions", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + sequence_id = __builtin__.property(_get_sequence_id, _set_sequence_id) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + l2 = __builtin__.property(_get_l2, _set_l2) + ip = __builtin__.property(_get_ip, _set_ip) + transport = __builtin__.property(_get_transport, _set_transport) + input_interface = __builtin__.property(_get_input_interface, _set_input_interface) + actions = __builtin__.property(_get_actions, _set_actions) + + + _pyangbind_elements = {'sequence_id': sequence_id, 'config': config, 'state': state, 'l2': l2, 'ip': ip, 'transport': transport, 'input_interface': input_interface, 'actions': actions, } + + +class yc_acl_entries_openconfig_acl__acl_acl_sets_acl_set_acl_entries(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set/acl-entries. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Access list entries container + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__acl_entry',) + + _yang_name = 'acl-entries' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set', u'acl-entries'] + + def _get_acl_entry(self): + """ + Getter method for acl_entry, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry (list) + + YANG Description: List of ACL entries comprising an ACL set + """ + return self.__acl_entry + + def _set_acl_entry(self, v, load=False): + """ + Setter method for acl_entry, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries/acl_entry (list) + If this variable is read-only (config: false) in the + source YANG file, then _set_acl_entry is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_acl_entry() directly. + + YANG Description: List of ACL entries comprising an ACL set + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """acl_entry must be of a type compatible with list""", + 'defined-type': "list", + 'generated-type': """YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True)""", + }) + + self.__acl_entry = t + if hasattr(self, '_set'): + self._set() + + def _unset_acl_entry(self): + self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_acl_sets_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + + acl_entry = __builtin__.property(_get_acl_entry, _set_acl_entry) + + + _pyangbind_elements = {'acl_entry': acl_entry, } + + +class yc_acl_set_openconfig_acl__acl_acl_sets_acl_set(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets/acl-set. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: List of ACL sets, each comprising of a list of ACL +entries + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__name','__config','__state','__acl_entries',) + + _yang_name = 'acl-set' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__name = YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_acl_sets_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets', u'acl-set'] + + def _get_name(self): + """ + Getter method for name, mapped from YANG variable /acl/acl_sets/acl_set/name (leafref) + + YANG Description: Reference to the name list key + """ + return self.__name + + def _set_name(self, v, load=False): + """ + Setter method for name, mapped from YANG variable /acl/acl_sets/acl_set/name (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_name is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_name() directly. + + YANG Description: Reference to the name list key + """ + parent = getattr(self, "_parent", None) + if parent is not None and load is False: + raise AttributeError("Cannot set keys directly when" + + " within an instantiated list") + + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """name must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__name = t + if hasattr(self, '_set'): + self._set() + + def _unset_name(self): + self.__name = YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/acl_sets/acl_set/config (container) + + YANG Description: Access list config + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/acl_sets/acl_set/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Access list config + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_acl_sets_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_acl_sets_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/acl_sets/acl_set/state (container) + + YANG Description: Access list state information + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/acl_sets/acl_set/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: Access list state information + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_acl_sets_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_acl_sets_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_acl_entries(self): + """ + Getter method for acl_entries, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries (container) + + YANG Description: Access list entries container + """ + return self.__acl_entries + + def _set_acl_entries(self, v, load=False): + """ + Setter method for acl_entries, mapped from YANG variable /acl/acl_sets/acl_set/acl_entries (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_acl_entries is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_acl_entries() directly. + + YANG Description: Access list entries container + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_acl_entries_openconfig_acl__acl_acl_sets_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """acl_entries must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_acl_sets_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__acl_entries = t + if hasattr(self, '_set'): + self._set() + + def _unset_acl_entries(self): + self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_acl_sets_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + name = __builtin__.property(_get_name, _set_name) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + acl_entries = __builtin__.property(_get_acl_entries, _set_acl_entries) + + + _pyangbind_elements = {'name': name, 'config': config, 'state': state, 'acl_entries': acl_entries, } + + +class yc_acl_sets_openconfig_acl__acl_acl_sets(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/acl-sets. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Access list entries variables enclosing container + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__acl_set',) + + _yang_name = 'acl-sets' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__acl_set = YANGDynClass(base=YANGListType("name",yc_acl_set_openconfig_acl__acl_acl_sets_acl_set, yang_name="acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'acl-sets'] + + def _get_acl_set(self): + """ + Getter method for acl_set, mapped from YANG variable /acl/acl_sets/acl_set (list) + + YANG Description: List of ACL sets, each comprising of a list of ACL +entries + """ + return self.__acl_set + + def _set_acl_set(self, v, load=False): + """ + Setter method for acl_set, mapped from YANG variable /acl/acl_sets/acl_set (list) + If this variable is read-only (config: false) in the + source YANG file, then _set_acl_set is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_acl_set() directly. + + YANG Description: List of ACL sets, each comprising of a list of ACL +entries + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=YANGListType("name",yc_acl_set_openconfig_acl__acl_acl_sets_acl_set, yang_name="acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """acl_set must be of a type compatible with list""", + 'defined-type': "list", + 'generated-type': """YANGDynClass(base=YANGListType("name",yc_acl_set_openconfig_acl__acl_acl_sets_acl_set, yang_name="acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True)""", + }) + + self.__acl_set = t + if hasattr(self, '_set'): + self._set() + + def _unset_acl_set(self): + self.__acl_set = YANGDynClass(base=YANGListType("name",yc_acl_set_openconfig_acl__acl_acl_sets_acl_set, yang_name="acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + + acl_set = __builtin__.property(_get_acl_set, _set_acl_set) + + + _pyangbind_elements = {'acl_set': acl_set, } + + +class yc_config_openconfig_acl__acl_interfaces_interface_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Configuration for ACL per-interface data + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__id',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__id = YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'config'] + + def _get_id(self): + """ + Getter method for id, mapped from YANG variable /acl/interfaces/interface/config/id (oc-if:interface-id) + + YANG Description: User-defined identifier for the interface -- a common +convention could be '.' + """ + return self.__id + + def _set_id(self, v, load=False): + """ + Setter method for id, mapped from YANG variable /acl/interfaces/interface/config/id (oc-if:interface-id) + If this variable is read-only (config: false) in the + source YANG file, then _set_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_id() directly. + + YANG Description: User-defined identifier for the interface -- a common +convention could be '.' + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """id must be of a type compatible with oc-if:interface-id""", + 'defined-type': "oc-if:interface-id", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True)""", + }) + + self.__id = t + if hasattr(self, '_set'): + self._set() + + def _unset_id(self): + self.__id = YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=True) + + id = __builtin__.property(_get_id, _set_id) + + + _pyangbind_elements = {'id': id, } + + +class yc_state_openconfig_acl__acl_interfaces_interface_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Operational state for ACL per-interface data + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__id',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__id = YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'state'] + + def _get_id(self): + """ + Getter method for id, mapped from YANG variable /acl/interfaces/interface/state/id (oc-if:interface-id) + + YANG Description: User-defined identifier for the interface -- a common +convention could be '.' + """ + return self.__id + + def _set_id(self, v, load=False): + """ + Setter method for id, mapped from YANG variable /acl/interfaces/interface/state/id (oc-if:interface-id) + If this variable is read-only (config: false) in the + source YANG file, then _set_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_id() directly. + + YANG Description: User-defined identifier for the interface -- a common +convention could be '.' + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """id must be of a type compatible with oc-if:interface-id""", + 'defined-type': "oc-if:interface-id", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False)""", + }) + + self.__id = t + if hasattr(self, '_set'): + self._set() + + def _unset_id(self): + self.__id = YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='oc-if:interface-id', is_config=False) + + id = __builtin__.property(_get_id) + + + _pyangbind_elements = {'id': id, } + + +class yc_config_openconfig_acl__acl_interfaces_interface_interface_ref_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/interface-ref/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Configured reference to interface / subinterface + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface','__subinterface',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__interface = YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__subinterface = YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'interface-ref', u'config'] + + def _get_interface(self): + """ + Getter method for interface, mapped from YANG variable /acl/interfaces/interface/interface_ref/config/interface (leafref) + + YANG Description: Reference to a base interface. If a reference to a +subinterface is required, this leaf must be specified +to indicate the base interface. + """ + return self.__interface + + def _set_interface(self, v, load=False): + """ + Setter method for interface, mapped from YANG variable /acl/interfaces/interface/interface_ref/config/interface (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_interface is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_interface() directly. + + YANG Description: Reference to a base interface. If a reference to a +subinterface is required, this leaf must be specified +to indicate the base interface. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """interface must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__interface = t + if hasattr(self, '_set'): + self._set() + + def _unset_interface(self): + self.__interface = YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + + def _get_subinterface(self): + """ + Getter method for subinterface, mapped from YANG variable /acl/interfaces/interface/interface_ref/config/subinterface (leafref) + + YANG Description: Reference to a subinterface -- this requires the base +interface to be specified using the interface leaf in +this container. If only a reference to a base interface +is requuired, this leaf should not be set. + """ + return self.__subinterface + + def _set_subinterface(self, v, load=False): + """ + Setter method for subinterface, mapped from YANG variable /acl/interfaces/interface/interface_ref/config/subinterface (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_subinterface is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_subinterface() directly. + + YANG Description: Reference to a subinterface -- this requires the base +interface to be specified using the interface leaf in +this container. If only a reference to a base interface +is requuired, this leaf should not be set. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """subinterface must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__subinterface = t + if hasattr(self, '_set'): + self._set() + + def _unset_subinterface(self): + self.__subinterface = YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + interface = __builtin__.property(_get_interface, _set_interface) + subinterface = __builtin__.property(_get_subinterface, _set_subinterface) + + + _pyangbind_elements = {'interface': interface, 'subinterface': subinterface, } + + +class yc_state_openconfig_acl__acl_interfaces_interface_interface_ref_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/interface-ref/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Operational state for interface-ref + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface','__subinterface',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__interface = YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__subinterface = YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'interface-ref', u'state'] + + def _get_interface(self): + """ + Getter method for interface, mapped from YANG variable /acl/interfaces/interface/interface_ref/state/interface (leafref) + + YANG Description: Reference to a base interface. If a reference to a +subinterface is required, this leaf must be specified +to indicate the base interface. + """ + return self.__interface + + def _set_interface(self, v, load=False): + """ + Setter method for interface, mapped from YANG variable /acl/interfaces/interface/interface_ref/state/interface (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_interface is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_interface() directly. + + YANG Description: Reference to a base interface. If a reference to a +subinterface is required, this leaf must be specified +to indicate the base interface. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """interface must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + }) + + self.__interface = t + if hasattr(self, '_set'): + self._set() + + def _unset_interface(self): + self.__interface = YANGDynClass(base=unicode, is_leaf=True, yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + + def _get_subinterface(self): + """ + Getter method for subinterface, mapped from YANG variable /acl/interfaces/interface/interface_ref/state/subinterface (leafref) + + YANG Description: Reference to a subinterface -- this requires the base +interface to be specified using the interface leaf in +this container. If only a reference to a base interface +is requuired, this leaf should not be set. + """ + return self.__subinterface + + def _set_subinterface(self, v, load=False): + """ + Setter method for subinterface, mapped from YANG variable /acl/interfaces/interface/interface_ref/state/subinterface (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_subinterface is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_subinterface() directly. + + YANG Description: Reference to a subinterface -- this requires the base +interface to be specified using the interface leaf in +this container. If only a reference to a base interface +is requuired, this leaf should not be set. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """subinterface must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + }) + + self.__subinterface = t + if hasattr(self, '_set'): + self._set() + + def _unset_subinterface(self): + self.__subinterface = YANGDynClass(base=unicode, is_leaf=True, yang_name="subinterface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + interface = __builtin__.property(_get_interface) + subinterface = __builtin__.property(_get_subinterface) + + + _pyangbind_elements = {'interface': interface, 'subinterface': subinterface, } + + +class yc_interface_ref_openconfig_acl__acl_interfaces_interface_interface_ref(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/interface-ref. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Reference to an interface or subinterface + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__config','__state',) + + _yang_name = 'interface-ref' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_interface_ref_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'interface-ref'] + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/interfaces/interface/interface_ref/config (container) + + YANG Description: Configured reference to interface / subinterface + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/interfaces/interface/interface_ref/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Configured reference to interface / subinterface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_interfaces_interface_interface_ref_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_interface_ref_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_interface_ref_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/interfaces/interface/interface_ref/state (container) + + YANG Description: Operational state for interface-ref + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/interfaces/interface/interface_ref/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: Operational state for interface-ref + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_interfaces_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_interface_ref_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + + + _pyangbind_elements = {'config': config, 'state': state, } + + +class yc_config_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/ingress-acl-sets/ingress-acl-set/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Configuration data + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set', u'config'] + + def _get_set_name(self): + """ + Getter method for set_name, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/config/set_name (leafref) + + YANG Description: Reference to the ACL set applied on ingress + """ + return self.__set_name + + def _set_set_name(self, v, load=False): + """ + Setter method for set_name, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/config/set_name (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_set_name is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_set_name() directly. + + YANG Description: Reference to the ACL set applied on ingress + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """set_name must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__set_name = t + if hasattr(self, '_set'): + self._set() + + def _unset_set_name(self): + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + set_name = __builtin__.property(_get_set_name, _set_set_name) + + + _pyangbind_elements = {'set_name': set_name, } + + +class yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/ingress-acl-sets/ingress-acl-set/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Operational state data for interface ingress ACLs + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set', u'state'] + + def _get_set_name(self): + """ + Getter method for set_name, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/state/set_name (leafref) + + YANG Description: Reference to the ACL set applied on ingress + """ + return self.__set_name + + def _set_set_name(self, v, load=False): + """ + Setter method for set_name, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/state/set_name (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_set_name is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_set_name() directly. + + YANG Description: Reference to the ACL set applied on ingress + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """set_name must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + }) + + self.__set_name = t + if hasattr(self, '_set'): + self._set() + + def _unset_set_name(self): + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + set_name = __builtin__.property(_get_set_name) + + + _pyangbind_elements = {'set_name': set_name, } + + +class yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/ingress-acl-sets/ingress-acl-set/acl-entries/acl-entry/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Operational state data for per-interface ACL entries + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__matched_packets','__matched_octets',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__sequence_id = YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set', u'acl-entries', u'acl-entry', u'state'] + + def _get_sequence_id(self): + """ + Getter method for sequence_id, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry/state/sequence_id (leafref) + + YANG Description: Reference to an entry in the ACL set applied to an +interface + """ + return self.__sequence_id + + def _set_sequence_id(self, v, load=False): + """ + Setter method for sequence_id, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry/state/sequence_id (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_sequence_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_sequence_id() directly. + + YANG Description: Reference to an entry in the ACL set applied to an +interface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """sequence_id must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + }) + + self.__sequence_id = t + if hasattr(self, '_set'): + self._set() + + def _unset_sequence_id(self): + self.__sequence_id = YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + + def _get_matched_packets(self): + """ + Getter method for matched_packets, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry/state/matched_packets (yang:counter64) + + YANG Description: Count of the number of packets matching the current ACL +entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + return self.__matched_packets + + def _set_matched_packets(self, v, load=False): + """ + Setter method for matched_packets, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry/state/matched_packets (yang:counter64) + If this variable is read-only (config: false) in the + source YANG file, then _set_matched_packets is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_matched_packets() directly. + + YANG Description: Count of the number of packets matching the current ACL +entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """matched_packets must be of a type compatible with yang:counter64""", + 'defined-type': "yang:counter64", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False)""", + }) + + self.__matched_packets = t + if hasattr(self, '_set'): + self._set() + + def _unset_matched_packets(self): + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + + + def _get_matched_octets(self): + """ + Getter method for matched_octets, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry/state/matched_octets (yang:counter64) + + YANG Description: Count of the number of octets (bytes) matching the current +ACL entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + return self.__matched_octets + + def _set_matched_octets(self, v, load=False): + """ + Setter method for matched_octets, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry/state/matched_octets (yang:counter64) + If this variable is read-only (config: false) in the + source YANG file, then _set_matched_octets is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_matched_octets() directly. + + YANG Description: Count of the number of octets (bytes) matching the current +ACL entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """matched_octets must be of a type compatible with yang:counter64""", + 'defined-type': "yang:counter64", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False)""", + }) + + self.__matched_octets = t + if hasattr(self, '_set'): + self._set() + + def _unset_matched_octets(self): + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + + sequence_id = __builtin__.property(_get_sequence_id) + matched_packets = __builtin__.property(_get_matched_packets) + matched_octets = __builtin__.property(_get_matched_octets) + + + _pyangbind_elements = {'sequence_id': sequence_id, 'matched_packets': matched_packets, 'matched_octets': matched_octets, } + + +class yc_acl_entry_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/ingress-acl-sets/ingress-acl-set/acl-entries/acl-entry. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: List of ACL entries assigned to an interface + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__state',) + + _yang_name = 'acl-entry' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__sequence_id = YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set', u'acl-entries', u'acl-entry'] + + def _get_sequence_id(self): + """ + Getter method for sequence_id, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry/sequence_id (leafref) + + YANG Description: Reference to per-interface acl entry key + """ + return self.__sequence_id + + def _set_sequence_id(self, v, load=False): + """ + Setter method for sequence_id, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry/sequence_id (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_sequence_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_sequence_id() directly. + + YANG Description: Reference to per-interface acl entry key + """ + parent = getattr(self, "_parent", None) + if parent is not None and load is False: + raise AttributeError("Cannot set keys directly when" + + " within an instantiated list") + + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """sequence_id must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + }) + + self.__sequence_id = t + if hasattr(self, '_set'): + self._set() + + def _unset_sequence_id(self): + self.__sequence_id = YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry/state (container) + + YANG Description: Operational state data for per-interface ACL entries + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: Operational state data for per-interface ACL entries + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False) + + sequence_id = __builtin__.property(_get_sequence_id) + state = __builtin__.property(_get_state) + + + _pyangbind_elements = {'sequence_id': sequence_id, 'state': state, } + + +class yc_acl_entries_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/ingress-acl-sets/ingress-acl-set/acl-entries. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Enclosing container for list of references to ACLs + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__acl_entry',) + + _yang_name = 'acl-entries' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set', u'acl-entries'] + + def _get_acl_entry(self): + """ + Getter method for acl_entry, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry (list) + + YANG Description: List of ACL entries assigned to an interface + """ + return self.__acl_entry + + def _set_acl_entry(self, v, load=False): + """ + Setter method for acl_entry, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries/acl_entry (list) + If this variable is read-only (config: false) in the + source YANG file, then _set_acl_entry is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_acl_entry() directly. + + YANG Description: List of ACL entries assigned to an interface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """acl_entry must be of a type compatible with list""", + 'defined-type': "list", + 'generated-type': """YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False)""", + }) + + self.__acl_entry = t + if hasattr(self, '_set'): + self._set() + + def _unset_acl_entry(self): + self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False) + + acl_entry = __builtin__.property(_get_acl_entry) + + + _pyangbind_elements = {'acl_entry': acl_entry, } + + +class yc_ingress_acl_set_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/ingress-acl-sets/ingress-acl-set. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: List of ingress ACLs on the interface + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name','__config','__state','__acl_entries',) + + _yang_name = 'ingress-acl-set' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets', u'ingress-acl-set'] + + def _get_set_name(self): + """ + Getter method for set_name, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/set_name (leafref) + + YANG Description: Reference to set name list key + """ + return self.__set_name + + def _set_set_name(self, v, load=False): + """ + Setter method for set_name, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/set_name (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_set_name is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_set_name() directly. + + YANG Description: Reference to set name list key + """ + parent = getattr(self, "_parent", None) + if parent is not None and load is False: + raise AttributeError("Cannot set keys directly when" + + " within an instantiated list") + + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """set_name must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__set_name = t + if hasattr(self, '_set'): + self._set() + + def _unset_set_name(self): + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/config (container) + + YANG Description: Configuration data + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Configuration data + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/state (container) + + YANG Description: Operational state data for interface ingress ACLs + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: Operational state data for interface ingress ACLs + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_acl_entries(self): + """ + Getter method for acl_entries, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries (container) + + YANG Description: Enclosing container for list of references to ACLs + """ + return self.__acl_entries + + def _set_acl_entries(self, v, load=False): + """ + Setter method for acl_entries, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set/acl_entries (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_acl_entries is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_acl_entries() directly. + + YANG Description: Enclosing container for list of references to ACLs + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """acl_entries must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__acl_entries = t + if hasattr(self, '_set'): + self._set() + + def _unset_acl_entries(self): + self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + set_name = __builtin__.property(_get_set_name, _set_set_name) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + acl_entries = __builtin__.property(_get_acl_entries, _set_acl_entries) + + + _pyangbind_elements = {'set_name': set_name, 'config': config, 'state': state, 'acl_entries': acl_entries, } + + +class yc_ingress_acl_sets_openconfig_acl__acl_interfaces_interface_ingress_acl_sets(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/ingress-acl-sets. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Enclosing container the list of ingress ACLs on the +interface + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__ingress_acl_set',) + + _yang_name = 'ingress-acl-sets' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__ingress_acl_set = YANGDynClass(base=YANGListType("set_name",yc_ingress_acl_set_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set, yang_name="ingress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="ingress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'ingress-acl-sets'] + + def _get_ingress_acl_set(self): + """ + Getter method for ingress_acl_set, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set (list) + + YANG Description: List of ingress ACLs on the interface + """ + return self.__ingress_acl_set + + def _set_ingress_acl_set(self, v, load=False): + """ + Setter method for ingress_acl_set, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets/ingress_acl_set (list) + If this variable is read-only (config: false) in the + source YANG file, then _set_ingress_acl_set is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_ingress_acl_set() directly. + + YANG Description: List of ingress ACLs on the interface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=YANGListType("set_name",yc_ingress_acl_set_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set, yang_name="ingress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="ingress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """ingress_acl_set must be of a type compatible with list""", + 'defined-type': "list", + 'generated-type': """YANGDynClass(base=YANGListType("set_name",yc_ingress_acl_set_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set, yang_name="ingress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="ingress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True)""", + }) + + self.__ingress_acl_set = t + if hasattr(self, '_set'): + self._set() + + def _unset_ingress_acl_set(self): + self.__ingress_acl_set = YANGDynClass(base=YANGListType("set_name",yc_ingress_acl_set_openconfig_acl__acl_interfaces_interface_ingress_acl_sets_ingress_acl_set, yang_name="ingress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="ingress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + + ingress_acl_set = __builtin__.property(_get_ingress_acl_set, _set_ingress_acl_set) + + + _pyangbind_elements = {'ingress_acl_set': ingress_acl_set, } + + +class yc_config_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_config(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/egress-acl-sets/egress-acl-set/config. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Configuration data + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name',) + + _yang_name = 'config' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set', u'config'] + + def _get_set_name(self): + """ + Getter method for set_name, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/config/set_name (leafref) + + YANG Description: Reference to the ACL set applied on egress + """ + return self.__set_name + + def _set_set_name(self, v, load=False): + """ + Setter method for set_name, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/config/set_name (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_set_name is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_set_name() directly. + + YANG Description: Reference to the ACL set applied on egress + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """set_name must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__set_name = t + if hasattr(self, '_set'): + self._set() + + def _unset_set_name(self): + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + set_name = __builtin__.property(_get_set_name, _set_set_name) + + + _pyangbind_elements = {'set_name': set_name, } + + +class yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/egress-acl-sets/egress-acl-set/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Operational state data for interface egress ACLs + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set', u'state'] + + def _get_set_name(self): + """ + Getter method for set_name, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/state/set_name (leafref) + + YANG Description: Reference to the ACL set applied on egress + """ + return self.__set_name + + def _set_set_name(self, v, load=False): + """ + Setter method for set_name, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/state/set_name (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_set_name is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_set_name() directly. + + YANG Description: Reference to the ACL set applied on egress + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """set_name must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + }) + + self.__set_name = t + if hasattr(self, '_set'): + self._set() + + def _unset_set_name(self): + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + set_name = __builtin__.property(_get_set_name) + + + _pyangbind_elements = {'set_name': set_name, } + + +class yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry_state(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/egress-acl-sets/egress-acl-set/acl-entries/acl-entry/state. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Operational state data for per-interface ACL entries + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__matched_packets','__matched_octets',) + + _yang_name = 'state' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__sequence_id = YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set', u'acl-entries', u'acl-entry', u'state'] + + def _get_sequence_id(self): + """ + Getter method for sequence_id, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry/state/sequence_id (leafref) + + YANG Description: Reference to an entry in the ACL set applied to an +interface + """ + return self.__sequence_id + + def _set_sequence_id(self, v, load=False): + """ + Setter method for sequence_id, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry/state/sequence_id (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_sequence_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_sequence_id() directly. + + YANG Description: Reference to an entry in the ACL set applied to an +interface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """sequence_id must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + }) + + self.__sequence_id = t + if hasattr(self, '_set'): + self._set() + + def _unset_sequence_id(self): + self.__sequence_id = YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + + def _get_matched_packets(self): + """ + Getter method for matched_packets, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry/state/matched_packets (yang:counter64) + + YANG Description: Count of the number of packets matching the current ACL +entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + return self.__matched_packets + + def _set_matched_packets(self, v, load=False): + """ + Setter method for matched_packets, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry/state/matched_packets (yang:counter64) + If this variable is read-only (config: false) in the + source YANG file, then _set_matched_packets is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_matched_packets() directly. + + YANG Description: Count of the number of packets matching the current ACL +entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """matched_packets must be of a type compatible with yang:counter64""", + 'defined-type': "yang:counter64", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False)""", + }) + + self.__matched_packets = t + if hasattr(self, '_set'): + self._set() + + def _unset_matched_packets(self): + self.__matched_packets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-packets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + + + def _get_matched_octets(self): + """ + Getter method for matched_octets, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry/state/matched_octets (yang:counter64) + + YANG Description: Count of the number of octets (bytes) matching the current +ACL entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + return self.__matched_octets + + def _set_matched_octets(self, v, load=False): + """ + Setter method for matched_octets, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry/state/matched_octets (yang:counter64) + If this variable is read-only (config: false) in the + source YANG file, then _set_matched_octets is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_matched_octets() directly. + + YANG Description: Count of the number of octets (bytes) matching the current +ACL entry. + +An implementation should provide this counter on a +per-interface per-ACL-entry if possible. + +If an implementation only supports ACL counters per entry +(i.e., not broken out per interface), then the value +should be equal to the aggregate count across all interfaces. + +An implementation that provides counters per entry per +interface is not required to also provide an aggregate count, +e.g., per entry -- the user is expected to be able implement +the required aggregation if such a count is needed. + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """matched_octets must be of a type compatible with yang:counter64""", + 'defined-type': "yang:counter64", + 'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False)""", + }) + + self.__matched_octets = t + if hasattr(self, '_set'): + self._set() + + def _unset_matched_octets(self): + self.__matched_octets = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..18446744073709551615']}, int_size=64), is_leaf=True, yang_name="matched-octets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='yang:counter64', is_config=False) + + sequence_id = __builtin__.property(_get_sequence_id) + matched_packets = __builtin__.property(_get_matched_packets) + matched_octets = __builtin__.property(_get_matched_octets) + + + _pyangbind_elements = {'sequence_id': sequence_id, 'matched_packets': matched_packets, 'matched_octets': matched_octets, } + + +class yc_acl_entry_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/egress-acl-sets/egress-acl-set/acl-entries/acl-entry. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: List of ACL entries assigned to an interface + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__sequence_id','__state',) + + _yang_name = 'acl-entry' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__sequence_id = YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set', u'acl-entries', u'acl-entry'] + + def _get_sequence_id(self): + """ + Getter method for sequence_id, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry/sequence_id (leafref) + + YANG Description: Reference to per-interface acl entry key + """ + return self.__sequence_id + + def _set_sequence_id(self, v, load=False): + """ + Setter method for sequence_id, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry/sequence_id (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_sequence_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_sequence_id() directly. + + YANG Description: Reference to per-interface acl entry key + """ + parent = getattr(self, "_parent", None) + if parent is not None and load is False: + raise AttributeError("Cannot set keys directly when" + + " within an instantiated list") + + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """sequence_id must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False)""", + }) + + self.__sequence_id = t + if hasattr(self, '_set'): + self._set() + + def _unset_sequence_id(self): + self.__sequence_id = YANGDynClass(base=unicode, is_leaf=True, yang_name="sequence-id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=False) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry/state (container) + + YANG Description: Operational state data for per-interface ACL entries + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: Operational state data for per-interface ACL entries + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=False) + + sequence_id = __builtin__.property(_get_sequence_id) + state = __builtin__.property(_get_state) + + + _pyangbind_elements = {'sequence_id': sequence_id, 'state': state, } + + +class yc_acl_entries_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/egress-acl-sets/egress-acl-set/acl-entries. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Enclosing container for list of references to ACLs + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__acl_entry',) + + _yang_name = 'acl-entries' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set', u'acl-entries'] + + def _get_acl_entry(self): + """ + Getter method for acl_entry, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry (list) + + YANG Description: List of ACL entries assigned to an interface + """ + return self.__acl_entry + + def _set_acl_entry(self, v, load=False): + """ + Setter method for acl_entry, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries/acl_entry (list) + If this variable is read-only (config: false) in the + source YANG file, then _set_acl_entry is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_acl_entry() directly. + + YANG Description: List of ACL entries assigned to an interface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """acl_entry must be of a type compatible with list""", + 'defined-type': "list", + 'generated-type': """YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False)""", + }) + + self.__acl_entry = t + if hasattr(self, '_set'): + self._set() + + def _unset_acl_entry(self): + self.__acl_entry = YANGDynClass(base=YANGListType("sequence_id",yc_acl_entry_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries_acl_entry, yang_name="acl-entry", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='sequence-id', extensions=None), is_container='list', yang_name="acl-entry", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=False) + + acl_entry = __builtin__.property(_get_acl_entry) + + + _pyangbind_elements = {'acl_entry': acl_entry, } + + +class yc_egress_acl_set_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/egress-acl-sets/egress-acl-set. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: List of egress ACLs on the interface + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__set_name','__config','__state','__acl_entries',) + + _yang_name = 'egress-acl-set' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets', u'egress-acl-set'] + + def _get_set_name(self): + """ + Getter method for set_name, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/set_name (leafref) + + YANG Description: Reference to set name list key + """ + return self.__set_name + + def _set_set_name(self, v, load=False): + """ + Setter method for set_name, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/set_name (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_set_name is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_set_name() directly. + + YANG Description: Reference to set name list key + """ + parent = getattr(self, "_parent", None) + if parent is not None and load is False: + raise AttributeError("Cannot set keys directly when" + + " within an instantiated list") + + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """set_name must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__set_name = t + if hasattr(self, '_set'): + self._set() + + def _unset_set_name(self): + self.__set_name = YANGDynClass(base=unicode, is_leaf=True, yang_name="set-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/config (container) + + YANG Description: Configuration data + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Configuration data + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/state (container) + + YANG Description: Operational state data for interface egress ACLs + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: Operational state data for interface egress ACLs + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_acl_entries(self): + """ + Getter method for acl_entries, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries (container) + + YANG Description: Enclosing container for list of references to ACLs + """ + return self.__acl_entries + + def _set_acl_entries(self, v, load=False): + """ + Setter method for acl_entries, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set/acl_entries (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_acl_entries is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_acl_entries() directly. + + YANG Description: Enclosing container for list of references to ACLs + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """acl_entries must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__acl_entries = t + if hasattr(self, '_set'): + self._set() + + def _unset_acl_entries(self): + self.__acl_entries = YANGDynClass(base=yc_acl_entries_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set_acl_entries, is_container='container', yang_name="acl-entries", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + set_name = __builtin__.property(_get_set_name, _set_set_name) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + acl_entries = __builtin__.property(_get_acl_entries, _set_acl_entries) + + + _pyangbind_elements = {'set_name': set_name, 'config': config, 'state': state, 'acl_entries': acl_entries, } + + +class yc_egress_acl_sets_openconfig_acl__acl_interfaces_interface_egress_acl_sets(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface/egress-acl-sets. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Enclosing container the list of egress ACLs on the +interface + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__egress_acl_set',) + + _yang_name = 'egress-acl-sets' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__egress_acl_set = YANGDynClass(base=YANGListType("set_name",yc_egress_acl_set_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set, yang_name="egress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="egress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface', u'egress-acl-sets'] + + def _get_egress_acl_set(self): + """ + Getter method for egress_acl_set, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set (list) + + YANG Description: List of egress ACLs on the interface + """ + return self.__egress_acl_set + + def _set_egress_acl_set(self, v, load=False): + """ + Setter method for egress_acl_set, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets/egress_acl_set (list) + If this variable is read-only (config: false) in the + source YANG file, then _set_egress_acl_set is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_egress_acl_set() directly. + + YANG Description: List of egress ACLs on the interface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=YANGListType("set_name",yc_egress_acl_set_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set, yang_name="egress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="egress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """egress_acl_set must be of a type compatible with list""", + 'defined-type': "list", + 'generated-type': """YANGDynClass(base=YANGListType("set_name",yc_egress_acl_set_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set, yang_name="egress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="egress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True)""", + }) + + self.__egress_acl_set = t + if hasattr(self, '_set'): + self._set() + + def _unset_egress_acl_set(self): + self.__egress_acl_set = YANGDynClass(base=YANGListType("set_name",yc_egress_acl_set_openconfig_acl__acl_interfaces_interface_egress_acl_sets_egress_acl_set, yang_name="egress-acl-set", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='set-name', extensions=None), is_container='list', yang_name="egress-acl-set", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + + egress_acl_set = __builtin__.property(_get_egress_acl_set, _set_egress_acl_set) + + + _pyangbind_elements = {'egress_acl_set': egress_acl_set, } + + +class yc_interface_openconfig_acl__acl_interfaces_interface(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces/interface. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: List of interfaces on which ACLs are set + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__id','__config','__state','__interface_ref','__ingress_acl_sets','__egress_acl_sets',) + + _yang_name = 'interface' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__ingress_acl_sets = YANGDynClass(base=yc_ingress_acl_sets_openconfig_acl__acl_interfaces_interface_ingress_acl_sets, is_container='container', yang_name="ingress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__egress_acl_sets = YANGDynClass(base=yc_egress_acl_sets_openconfig_acl__acl_interfaces_interface_egress_acl_sets, is_container='container', yang_name="egress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__id = YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + self.__interface_ref = YANGDynClass(base=yc_interface_ref_openconfig_acl__acl_interfaces_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces', u'interface'] + + def _get_id(self): + """ + Getter method for id, mapped from YANG variable /acl/interfaces/interface/id (leafref) + + YANG Description: Reference to the interface id list key + """ + return self.__id + + def _set_id(self, v, load=False): + """ + Setter method for id, mapped from YANG variable /acl/interfaces/interface/id (leafref) + If this variable is read-only (config: false) in the + source YANG file, then _set_id is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_id() directly. + + YANG Description: Reference to the interface id list key + """ + parent = getattr(self, "_parent", None) + if parent is not None and load is False: + raise AttributeError("Cannot set keys directly when" + + " within an instantiated list") + + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """id must be of a type compatible with leafref""", + 'defined-type': "leafref", + 'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True)""", + }) + + self.__id = t + if hasattr(self, '_set'): + self._set() + + def _unset_id(self): + self.__id = YANGDynClass(base=unicode, is_leaf=True, yang_name="id", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='leafref', is_config=True) + + + def _get_config(self): + """ + Getter method for config, mapped from YANG variable /acl/interfaces/interface/config (container) + + YANG Description: Configuration for ACL per-interface data + """ + return self.__config + + def _set_config(self, v, load=False): + """ + Setter method for config, mapped from YANG variable /acl/interfaces/interface/config (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_config is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_config() directly. + + YANG Description: Configuration for ACL per-interface data + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_config_openconfig_acl__acl_interfaces_interface_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """config must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__config = t + if hasattr(self, '_set'): + self._set() + + def _unset_config(self): + self.__config = YANGDynClass(base=yc_config_openconfig_acl__acl_interfaces_interface_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/interfaces/interface/state (container) + + YANG Description: Operational state for ACL per-interface data + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/interfaces/interface/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: Operational state for ACL per-interface data + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_interfaces_interface_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_interfaces_interface_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_interface_ref(self): + """ + Getter method for interface_ref, mapped from YANG variable /acl/interfaces/interface/interface_ref (container) + + YANG Description: Reference to an interface or subinterface + """ + return self.__interface_ref + + def _set_interface_ref(self, v, load=False): + """ + Setter method for interface_ref, mapped from YANG variable /acl/interfaces/interface/interface_ref (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_interface_ref is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_interface_ref() directly. + + YANG Description: Reference to an interface or subinterface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_interface_ref_openconfig_acl__acl_interfaces_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """interface_ref must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_interface_ref_openconfig_acl__acl_interfaces_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__interface_ref = t + if hasattr(self, '_set'): + self._set() + + def _unset_interface_ref(self): + self.__interface_ref = YANGDynClass(base=yc_interface_ref_openconfig_acl__acl_interfaces_interface_interface_ref, is_container='container', yang_name="interface-ref", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_ingress_acl_sets(self): + """ + Getter method for ingress_acl_sets, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets (container) + + YANG Description: Enclosing container the list of ingress ACLs on the +interface + """ + return self.__ingress_acl_sets + + def _set_ingress_acl_sets(self, v, load=False): + """ + Setter method for ingress_acl_sets, mapped from YANG variable /acl/interfaces/interface/ingress_acl_sets (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_ingress_acl_sets is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_ingress_acl_sets() directly. + + YANG Description: Enclosing container the list of ingress ACLs on the +interface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_ingress_acl_sets_openconfig_acl__acl_interfaces_interface_ingress_acl_sets, is_container='container', yang_name="ingress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """ingress_acl_sets must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_ingress_acl_sets_openconfig_acl__acl_interfaces_interface_ingress_acl_sets, is_container='container', yang_name="ingress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__ingress_acl_sets = t + if hasattr(self, '_set'): + self._set() + + def _unset_ingress_acl_sets(self): + self.__ingress_acl_sets = YANGDynClass(base=yc_ingress_acl_sets_openconfig_acl__acl_interfaces_interface_ingress_acl_sets, is_container='container', yang_name="ingress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_egress_acl_sets(self): + """ + Getter method for egress_acl_sets, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets (container) + + YANG Description: Enclosing container the list of egress ACLs on the +interface + """ + return self.__egress_acl_sets + + def _set_egress_acl_sets(self, v, load=False): + """ + Setter method for egress_acl_sets, mapped from YANG variable /acl/interfaces/interface/egress_acl_sets (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_egress_acl_sets is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_egress_acl_sets() directly. + + YANG Description: Enclosing container the list of egress ACLs on the +interface + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_egress_acl_sets_openconfig_acl__acl_interfaces_interface_egress_acl_sets, is_container='container', yang_name="egress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """egress_acl_sets must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_egress_acl_sets_openconfig_acl__acl_interfaces_interface_egress_acl_sets, is_container='container', yang_name="egress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__egress_acl_sets = t + if hasattr(self, '_set'): + self._set() + + def _unset_egress_acl_sets(self): + self.__egress_acl_sets = YANGDynClass(base=yc_egress_acl_sets_openconfig_acl__acl_interfaces_interface_egress_acl_sets, is_container='container', yang_name="egress-acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + id = __builtin__.property(_get_id, _set_id) + config = __builtin__.property(_get_config, _set_config) + state = __builtin__.property(_get_state, _set_state) + interface_ref = __builtin__.property(_get_interface_ref, _set_interface_ref) + ingress_acl_sets = __builtin__.property(_get_ingress_acl_sets, _set_ingress_acl_sets) + egress_acl_sets = __builtin__.property(_get_egress_acl_sets, _set_egress_acl_sets) + + + _pyangbind_elements = {'id': id, 'config': config, 'state': state, 'interface_ref': interface_ref, 'ingress_acl_sets': ingress_acl_sets, 'egress_acl_sets': egress_acl_sets, } + + +class yc_interfaces_openconfig_acl__acl_interfaces(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl/interfaces. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Enclosing container for the list of interfaces on which +ACLs are set + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__interface',) + + _yang_name = 'interfaces' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__interface = YANGDynClass(base=YANGListType("id",yc_interface_openconfig_acl__acl_interfaces_interface, yang_name="interface", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl', u'interfaces'] + + def _get_interface(self): + """ + Getter method for interface, mapped from YANG variable /acl/interfaces/interface (list) + + YANG Description: List of interfaces on which ACLs are set + """ + return self.__interface + + def _set_interface(self, v, load=False): + """ + Setter method for interface, mapped from YANG variable /acl/interfaces/interface (list) + If this variable is read-only (config: false) in the + source YANG file, then _set_interface is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_interface() directly. + + YANG Description: List of interfaces on which ACLs are set + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=YANGListType("id",yc_interface_openconfig_acl__acl_interfaces_interface, yang_name="interface", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """interface must be of a type compatible with list""", + 'defined-type': "list", + 'generated-type': """YANGDynClass(base=YANGListType("id",yc_interface_openconfig_acl__acl_interfaces_interface, yang_name="interface", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True)""", + }) + + self.__interface = t + if hasattr(self, '_set'): + self._set() + + def _unset_interface(self): + self.__interface = YANGDynClass(base=YANGListType("id",yc_interface_openconfig_acl__acl_interfaces_interface, yang_name="interface", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='id', extensions=None), is_container='list', yang_name="interface", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='list', is_config=True) + + interface = __builtin__.property(_get_interface, _set_interface) + + + _pyangbind_elements = {'interface': interface, } + + +class yc_acl_openconfig_acl__acl(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /acl. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: Top level enclosing container for ACL model config +and operational state data + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__state','__acl_sets','__interfaces',) + + _yang_name = 'acl' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__acl_sets = YANGDynClass(base=yc_acl_sets_openconfig_acl__acl_acl_sets, is_container='container', yang_name="acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + self.__interfaces = YANGDynClass(base=yc_interfaces_openconfig_acl__acl_interfaces, is_container='container', yang_name="interfaces", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [u'acl'] + + def _get_state(self): + """ + Getter method for state, mapped from YANG variable /acl/state (container) + + YANG Description: Global operational state data for ACLs + """ + return self.__state + + def _set_state(self, v, load=False): + """ + Setter method for state, mapped from YANG variable /acl/state (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_state is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_state() directly. + + YANG Description: Global operational state data for ACLs + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_state_openconfig_acl__acl_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """state must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_state_openconfig_acl__acl_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__state = t + if hasattr(self, '_set'): + self._set() + + def _unset_state(self): + self.__state = YANGDynClass(base=yc_state_openconfig_acl__acl_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_acl_sets(self): + """ + Getter method for acl_sets, mapped from YANG variable /acl/acl_sets (container) + + YANG Description: Access list entries variables enclosing container + """ + return self.__acl_sets + + def _set_acl_sets(self, v, load=False): + """ + Setter method for acl_sets, mapped from YANG variable /acl/acl_sets (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_acl_sets is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_acl_sets() directly. + + YANG Description: Access list entries variables enclosing container + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_acl_sets_openconfig_acl__acl_acl_sets, is_container='container', yang_name="acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """acl_sets must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_acl_sets_openconfig_acl__acl_acl_sets, is_container='container', yang_name="acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__acl_sets = t + if hasattr(self, '_set'): + self._set() + + def _unset_acl_sets(self): + self.__acl_sets = YANGDynClass(base=yc_acl_sets_openconfig_acl__acl_acl_sets, is_container='container', yang_name="acl-sets", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + + def _get_interfaces(self): + """ + Getter method for interfaces, mapped from YANG variable /acl/interfaces (container) + + YANG Description: Enclosing container for the list of interfaces on which +ACLs are set + """ + return self.__interfaces + + def _set_interfaces(self, v, load=False): + """ + Setter method for interfaces, mapped from YANG variable /acl/interfaces (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_interfaces is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_interfaces() directly. + + YANG Description: Enclosing container for the list of interfaces on which +ACLs are set + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_interfaces_openconfig_acl__acl_interfaces, is_container='container', yang_name="interfaces", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """interfaces must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_interfaces_openconfig_acl__acl_interfaces, is_container='container', yang_name="interfaces", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__interfaces = t + if hasattr(self, '_set'): + self._set() + + def _unset_interfaces(self): + self.__interfaces = YANGDynClass(base=yc_interfaces_openconfig_acl__acl_interfaces, is_container='container', yang_name="interfaces", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + state = __builtin__.property(_get_state, _set_state) + acl_sets = __builtin__.property(_get_acl_sets, _set_acl_sets) + interfaces = __builtin__.property(_get_interfaces, _set_interfaces) + + + _pyangbind_elements = {'state': state, 'acl_sets': acl_sets, 'interfaces': interfaces, } + + +class openconfig_acl(PybindBase): + """ + This class was auto-generated by the PythonClass plugin for PYANG + from YANG module openconfig-acl - based on the path /openconfig-acl. Each member element of + the container is represented as a class variable - with a specific + YANG type. + + YANG Description: This module defines configuration and operational state +data for network access control lists (i.e., filters, rules, +etc.). ACLs are organized into ACL sets, with each set +containing one or more ACL entries. ACL sets are identified +by a unique name, while each entry within a set is assigned +a sequence-id that determines the order in which the ACL +rules are applied to a packet. + +The model allows individual ACL rules to combine match criteria +from various fields in the packet, along with an action that +defines how matching packets should be handled. Note that some +device implementations may require separate entries for match +criteria that cross protocol layers, e.g., MAC layer and IP +layer matches. + """ + __slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_extmethods', '__acl',) + + _yang_name = 'openconfig-acl' + + _pybind_generated_by = 'container' + + def __init__(self, *args, **kwargs): + + self._path_helper = False + + self._extmethods = False + self.__acl = YANGDynClass(base=yc_acl_openconfig_acl__acl, is_container='container', yang_name="acl", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + load = kwargs.pop("load", None) + if args: + if len(args) > 1: + raise TypeError("cannot create a YANG container with >1 argument") + all_attr = True + for e in self._pyangbind_elements: + if not hasattr(args[0], e): + all_attr = False + break + if not all_attr: + raise ValueError("Supplied object did not have the correct attributes") + for e in self._pyangbind_elements: + nobj = getattr(args[0], e) + if nobj._changed() is False: + continue + setmethod = getattr(self, "_set_%s" % e) + if load is None: + setmethod(getattr(args[0], e)) + else: + setmethod(getattr(args[0], e), load=load) + + def _path(self): + if hasattr(self, "_parent"): + return self._parent._path()+[self._yang_name] + else: + return [] + + def _get_acl(self): + """ + Getter method for acl, mapped from YANG variable /acl (container) + + YANG Description: Top level enclosing container for ACL model config +and operational state data + """ + return self.__acl + + def _set_acl(self, v, load=False): + """ + Setter method for acl, mapped from YANG variable /acl (container) + If this variable is read-only (config: false) in the + source YANG file, then _set_acl is considered as a private + method. Backends looking to populate this variable should + do so via calling thisObj._set_acl() directly. + + YANG Description: Top level enclosing container for ACL model config +and operational state data + """ + if hasattr(v, "_utype"): + v = v._utype(v) + try: + t = YANGDynClass(v,base=yc_acl_openconfig_acl__acl, is_container='container', yang_name="acl", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + except (TypeError, ValueError): + raise ValueError({ + 'error-string': """acl must be of a type compatible with container""", + 'defined-type': "container", + 'generated-type': """YANGDynClass(base=yc_acl_openconfig_acl__acl, is_container='container', yang_name="acl", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True)""", + }) + + self.__acl = t + if hasattr(self, '_set'): + self._set() + + def _unset_acl(self): + self.__acl = YANGDynClass(base=yc_acl_openconfig_acl__acl, is_container='container', yang_name="acl", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/acl', defining_module='openconfig-acl', yang_type='container', is_config=True) + + acl = __builtin__.property(_get_acl, _set_acl) + + + _pyangbind_elements = {'acl': acl, } + + diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 1a0cae5882fb..5a0a144cb35d 100644 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -27,9 +27,9 @@ def get_test_suite(): author='Taoyu Li', author_email='taoyl@microsoft.com', url='https://github.com/Azure/sonic-buildimage', - py_modules=['minigraph'], - scripts=['sonic-cfggen'], + py_modules=['minigraph', 'openconfig_acl'], + scripts=['sonic-cfggen', 'translate_acl'], data_files=get_platform_file_list(), - install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml'], + install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind'], test_suite='setup.get_test_suite', ) diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl new file mode 100755 index 000000000000..29b4597b9c9c --- /dev/null +++ b/src/sonic-config-engine/translate_acl @@ -0,0 +1,139 @@ +#!/usr/bin/env python + +import openconfig_acl +import pyangbind.lib.pybindJSON as pybindJSON + +import sys +import os.path +import json +import argparse + +def dump_json(filename, data): + with open(filename, 'w') as outfile: + json.dump(data, outfile, indent=4, sort_keys=True, separators=(',', ':')) + +def generate_rule_json(table_name, rule, max_priority): + rule_idx = rule.config.sequence_id + rule_props = {} + rule_data = {} + rule_data["ACL_RULE_TABLE:"+table_name+":Rule_"+str(rule_idx)] = rule_props + rule_data["OP"] = "SET" + + rule_props["priority"] = max_priority - rule_idx + if rule.actions.config.forwarding_action == "ACCEPT": + rule_props["PACKET_ACTION"] = "FORWARD" + elif rule.actions.config.forwarding_action == "DROP": + rule_props["PACKET_ACTION"] = "DROP" + elif rule.actions.config.forwarding_action == "REJECT": + rule_props["PACKET_ACTION"] = "DROP" + else: + print "Unknown rule action %s in table %s, rule %d!" % (rule.actions.config.forwarding_action, table_name, rule_idx) + return {} + + ip_protocol_map = { + "IP_TCP" : 6, + "IP_ICMP" : 1, + "IP_UDP" : 17, + "IP_IGMP" : 2, + "IP_PIM" : 103, + "IP_RSVP" : 46, + "IP_GRE" : 47, + "IP_AUTH" : 51, + "IP_L2TP" : 115 + } + + if not rule.ip.config.protocol: + pass + elif ip_protocol_map.has_key(rule.ip.config.protocol): + rule_props["IP_PROTOCOL"] = ip_protocol_map[rule.ip.config.protocol] + else: + try: + int(rule.ip.config.protocol) + except: + print "Unknown rule protocol %s in table %s, rule %d!" % (rule.ip.config.protocol, table_name, rule_idx) + return {} + else: + rule_props["IP_PROTOCOL"] = rule.ip.config.protocol + + if rule.ip.config.source_ip_address != "": + rule_props["SRC_IP"] = rule.ip.config.source_ip_address + if rule.ip.config.destination_ip_address != "": + rule_props["DST_IP"] = rule.ip.config.destination_ip_address + + if rule.transport.config.source_port == "": + pass + elif str(rule.transport.config.source_port).find("..") < 0: + rule_props["L4_SRC_PORT"] = rule.transport.config.source_port + else: + rule_props["L4_SRC_PORT_RANGE"] = str(rule.transport.config.source_port).replace("..", "-") + + if rule.transport.config.destination_port == "": + pass + elif str(rule.transport.config.destination_port).find("..") < 0: + rule_props["L4_DST_PORT"] = rule.transport.config.destination_port + else: + rule_props["L4_DST_PORT_RANGE"] = str(rule.transport.config.destination_port).replace("..", "-") + + tcp_flags = 0x00; + for flag in rule.transport.config.tcp_flags: + if flag == "TCP_FIN": + tcp_flags = tcp_flags | 0x01 + if flag == "TCP_SYN": + tcp_flags = tcp_flags | 0x02 + if flag == "TCP_RST": + tcp_flags = tcp_flags | 0x04 + if flag == "TCP_PSH": + tcp_flags = tcp_flags | 0x08 + if flag == "TCP_ACK": + tcp_flags = tcp_flags | 0x10 + if flag == "TCP_URG": + tcp_flags = tcp_flags | 0x20 + if flag == "TCP_ECE": + tcp_flags = tcp_flags | 0x40 + if flag == "TCP_CWR": + tcp_flags = tcp_flags | 0x80 + if tcp_flags != 0x00: + rule_props["TCP_FLAGS"] = '0x{:02x}'.format(tcp_flags) + return rule_data + +def generate_table_json(aclset, aclname, port, max_priority, output_path='.'): + table_name = aclname.replace(" ", "_") + #table_name = generate_random_table_name() + + table_props = {} + table_props["policy_desc"] = table_name + table_props["type"] = "L3" + table_props["ports"] = port + + table_data = [{}] + table_data[0]["ACL_TABLE:"+table_name] = table_props + table_data[0]["OP"] = "SET" + dump_json(os.path.join(output_path, "table_"+table_name+".json"), table_data) + + rule_data = [] + for aclentryname in aclset.acl_entries.acl_entry: + aclentry = aclset.acl_entries.acl_entry[aclentryname] + rule_props = generate_rule_json(table_name, aclentry, max_priority) + if rule_props: + rule_data.append(rule_props) + + dump_json(os.path.join(output_path, "rules_for_"+table_name+".json"), rule_data) + +def translate_acl(filename, output_path, port, max_priority): + yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") + for aclsetname in yang_acl.acl.acl_sets.acl_set: + aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] + generate_table_json(aclset, aclsetname, port, max_priority, output_path) + return + +def main(): + parser = argparse.ArgumentParser(description="Translate openconfig ACL json into SONiC ACL jsons") + parser.add_argument('input', metavar='INPUT', help='input json file in openconfig format') + parser.add_argument('-p', '--port', default='Ethernet0', help='the port(s) that this ACL is binding to') + parser.add_argument('-m', '--max-priority', type=int, default=10000, help='the priority number of the first rule in ACL entries') + parser.add_argument('-o', '--output-path', default='.', help='output directory where SONiC ACL jsons will be generated') + args = parser.parse_args() + translate_acl(args.input, args.output_path, args.port, args.max_priority) + +if __name__ == "__main__": + main() From 783be14a5d1ff1a94c85141f30d9cfa464a0c320 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 17 Mar 2017 16:48:13 -0700 Subject: [PATCH 0376/1833] [minigraph]: Add portchannels/vlans dictionary and update teamd templates (#408) - minigraph_portchannel_interfaces and minigraph_vlan_interfaces are lists of interfaces and the name could duplicate due to multiple IPs - Add minigraph_portchannels and minigraph_vlans dictionaries to support querying port channels and vlans via the name - Update teamd.j2 template and config.sh file in docker-teamd - Update zebra.conf.j2 template to add port channel interfaces Signed-off-by: Shuotian Cheng --- dockers/docker-fpm/zebra.conf.j2 | 5 +++++ dockers/docker-teamd/config.sh | 2 +- dockers/docker-teamd/teamd.j2 | 4 ++-- src/sonic-config-engine/minigraph.py | 12 ++++++++++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/dockers/docker-fpm/zebra.conf.j2 b/dockers/docker-fpm/zebra.conf.j2 index ad05dcbe4e90..dc2061f8a02a 100644 --- a/dockers/docker-fpm/zebra.conf.j2 +++ b/dockers/docker-fpm/zebra.conf.j2 @@ -19,6 +19,11 @@ interface {{ interface['alias'] }} link-detect ! {% endfor %} +{% for interface in minigraph_portchannel_interfaces %} +interface {{ interface['name'] }} +link-detect +! +{% endfor %} {% endblock interfaces %} ! {% block default_route %} diff --git a/dockers/docker-teamd/config.sh b/dockers/docker-teamd/config.sh index d1b34f426428..c08a580b80d2 100755 --- a/dockers/docker-teamd/config.sh +++ b/dockers/docker-teamd/config.sh @@ -2,7 +2,7 @@ mkdir -p /etc/teamd -for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "' '.join(minigraph_portchannel_interfaces.keys())"`; do +for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannels.keys() | join(' ')"`; do sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /usr/share/sonic/templates/teamd.j2 >/etc/teamd/$pc.conf done diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 index ebc5bba43fd9..386f4465713b 100644 --- a/dockers/docker-teamd/teamd.j2 +++ b/dockers/docker-teamd/teamd.j2 @@ -4,14 +4,14 @@ "name": "lacp", "active": true, {# Use 75% links upperbound as min-links #} - "min_ports": {{ minigraph_portchannel_interfaces[pc] | length * 0.75 | round(0, 'ceil') | int}}, + "min_ports": {{ minigraph_portchannels[pc]['members'] | length * 0.75 | round(0, 'ceil') | int}}, "tx_hash": ["eth", "ipv4", "ipv6"] }, "link_watch": { "name": "ethtool" }, "ports": { - {% for member in minigraph_portchannel_interfaces[pc] %} + {% for member in minigraph_portchannels[pc]['members'] %} "{{member}}": {}{% if not loop.last %},{% endif %} {% endfor %} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 7cba925928ca..33f927a4b29e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -180,6 +180,7 @@ def parse_dpg(dpg, hname): pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) pc_intfs = [] + pcs = {} for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): pcintfname = pcintf.find(str(QName(ns, "Name"))).text pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text @@ -191,6 +192,7 @@ def parse_dpg(dpg, hname): for addrtuple in pc_map.get(pcintfname, []): pc_attributes.update(addrtuple) pc_intfs.append(copy.deepcopy(pc_attributes)) + pcs[pcintfname] = pc_attributes lointfs = child.find(str(QName(ns, "LoopbackIPInterfaces"))) lo_intfs = [] @@ -221,6 +223,7 @@ def parse_dpg(dpg, hname): vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) vlan_intfs = [] + vlans = {} for vintf in vlanintfs.findall(str(QName(ns, "VlanInterface"))): vintfname = vintf.find(str(QName(ns, "Name"))).text vlanid = vintf.find(str(QName(ns, "VlanID"))).text @@ -233,9 +236,10 @@ def parse_dpg(dpg, hname): for addrtuple in vlan_map.get(vintfname, []): vlan_attributes.update(addrtuple) vlan_intfs.append(copy.deepcopy(vlan_attributes)) + vlans[vintfname] = vlan_attributes - return intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs + return intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs, vlans, pcs return None, None, None, None, None def parse_cpg(cpg, hname): @@ -362,6 +366,8 @@ def parse_xml(filename, platform=None): intfs = None vlan_intfs = None pc_intfs = None + vlans = None + pcs = None mgmt_intf = None lo_intf = None neighbors = None @@ -386,7 +392,7 @@ def parse_xml(filename, platform=None): for child in root: if child.tag == str(QName(ns, "DpgDec")): - (intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs) = parse_dpg(child, hostname) + (intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs, vlans, pcs) = parse_dpg(child, hostname) elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_asn) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): @@ -409,6 +415,8 @@ def parse_xml(filename, platform=None): results['minigraph_interfaces'] = sorted(intfs, key=lambda x: x['name']) results['minigraph_vlan_interfaces'] = vlan_intfs results['minigraph_portchannel_interfaces'] = pc_intfs + results['minigraph_vlans'] = vlans + results['minigraph_portchannels'] = pcs results['minigraph_mgmt_interface'] = mgmt_intf results['minigraph_lo_interfaces'] = lo_intfs results['minigraph_neighbors'] = neighbors From 4212efde6c67a73c19836916c6597808567975ef Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 17 Mar 2017 17:41:23 -0700 Subject: [PATCH 0377/1833] [sonic-utilities]: update sonic-utilities module (#412) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index dea6e8000f16..22b3d7addd81 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit dea6e8000f160b30e962d59adbaaba41744fe7c2 +Subproject commit 22b3d7addd812acd65b267abc7172c00d042e47e From 7b7a61693a7d8898f5cc2b058132bec2460d65e3 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 17 Mar 2017 21:38:20 -0700 Subject: [PATCH 0378/1833] [sonic-cfggen]: Add -p option and add teamd.j2 test (#414) - Add -p --port-config option to feed sonic-cfggen with port_config.ini file when necessary. - Update minigraph.py file to accept the -p option - Add test_j2files.py test to test config.sh and all .j2 templates * Currently test_teamd is added to test both the config.sh and teamd.j2 file works well with the t0 sample minigraph and sample port config file * The sample output is added to the folder sample_output for comparison Signed-off-by: Shuotian Cheng --- dockers/docker-teamd/teamd.j2 | 6 +- src/sonic-config-engine/minigraph.py | 9 +- src/sonic-config-engine/setup.py | 0 src/sonic-config-engine/sonic-cfggen | 11 +- src/sonic-config-engine/tests/.gitignore | 1 + .../tests/sample_output/PortChannel01.conf | 16 + .../tests/sample_output/PortChannel02.conf | 16 + .../tests/sample_output/PortChannel03.conf | 16 + .../tests/sample_output/PortChannel04.conf | 16 + .../tests/t0-sample-graph.xml | 315 ++++++++++++++++++ .../tests/t0-sample-port-config.ini | 33 ++ src/sonic-config-engine/tests/test_j2files.py | 40 +++ 12 files changed, 470 insertions(+), 9 deletions(-) mode change 100644 => 100755 src/sonic-config-engine/setup.py create mode 100644 src/sonic-config-engine/tests/.gitignore create mode 100644 src/sonic-config-engine/tests/sample_output/PortChannel01.conf create mode 100644 src/sonic-config-engine/tests/sample_output/PortChannel02.conf create mode 100644 src/sonic-config-engine/tests/sample_output/PortChannel03.conf create mode 100644 src/sonic-config-engine/tests/sample_output/PortChannel04.conf create mode 100644 src/sonic-config-engine/tests/t0-sample-graph.xml create mode 100644 src/sonic-config-engine/tests/t0-sample-port-config.ini create mode 100644 src/sonic-config-engine/tests/test_j2files.py diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 index 386f4465713b..e2ef239c8266 100644 --- a/dockers/docker-teamd/teamd.j2 +++ b/dockers/docker-teamd/teamd.j2 @@ -11,10 +11,10 @@ "name": "ethtool" }, "ports": { - {% for member in minigraph_portchannels[pc]['members'] %} -"{{member}}": {}{% if not loop.last %},{% endif %} +{% for member in minigraph_portchannels[pc]['members'] %} + "{{member}}": {}{% if not loop.last %},{% endif %} - {% endfor %} +{% endfor %} } } diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 33f927a4b29e..54f9efe3c16e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -328,8 +328,10 @@ def get_mgmt_info(devices, dev, port): return ret_val -def get_alias_map_list(hwsku, platform=None): +def get_alias_map_list(hwsku, platform=None, port_config_file=None): port_config_candidates = [] + if port_config_file != None: + port_config_candidates.append(port_config_file) port_config_candidates.append('/usr/share/sonic/hwsku/port_config.ini') if platform != None: port_config_candidates.append(os.path.join('/usr/share/sonic/device', platform, hwsku, 'port_config.ini')) @@ -354,7 +356,7 @@ def get_alias_map_list(hwsku, platform=None): alias_map_list.append({'sonic': tokens[0], 'origin': tokens[2].strip()}) return alias_map_list -def parse_xml(filename, platform=None): +def parse_xml(filename, platform=None, port_config_file=None): root = ET.parse(filename).getroot() mini_graph_path = filename @@ -385,7 +387,7 @@ def parse_xml(filename, platform=None): if child.tag == str(hostname_qn): hostname = child.text - alias_map_list = get_alias_map_list(hwsku, platform) + alias_map_list = get_alias_map_list(hwsku, platform, port_config_file) if alias_map_list != None: for item in alias_map_list: port_alias_map[item['origin']] = item['sonic'] @@ -438,7 +440,6 @@ def parse_xml(filename, platform=None): port_alias_map = {} - def print_parse_xml(filename): results = parse_xml(filename) print(json.dumps(results, indent=3, cls=minigraph_encoder)) diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py old mode 100644 new mode 100755 diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 93f27a30442d..c10fb8c104cd 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -60,6 +60,7 @@ def get_machine_info(): def main(): parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") parser.add_argument("-m", "--minigraph", help="minigraph xml file") + parser.add_argument("-p", "--port-config", help="port config file, used with -m") parser.add_argument("-y", "--yaml", help="yaml file that contains addtional variables") parser.add_argument("-a", "--additional-data", help="addition data, in json string") group = parser.add_mutually_exclusive_group() @@ -83,9 +84,15 @@ def main(): if args.minigraph != None: minigraph = args.minigraph if data.has_key('platform'): - data.update(parse_xml(minigraph, data['platform'])) + if args.port_config != None: + data.update(parse_xml(minigraph, data['platform'], args.port_config)) + else: + data.update(parse_xml(minigraph, data['platform'])) else: - data.update(parse_xml(minigraph)) + if args.port_config != None: + data.update(parse_xml(minigraph, port_config_file=args.port_config)) + else: + data.update(parse_xml(minigraph)) if args.yaml != None: with open(args.yaml, 'r') as stream: diff --git a/src/sonic-config-engine/tests/.gitignore b/src/sonic-config-engine/tests/.gitignore new file mode 100644 index 000000000000..bee8a64b79a9 --- /dev/null +++ b/src/sonic-config-engine/tests/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel01.conf b/src/sonic-config-engine/tests/sample_output/PortChannel01.conf new file mode 100644 index 000000000000..95369ce06a2e --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/PortChannel01.conf @@ -0,0 +1,16 @@ +{ + "device": "PortChannel01", + "runner": { + "name": "lacp", + "active": true, + "min_ports": 1, + "tx_hash": ["eth", "ipv4", "ipv6"] + }, + "link_watch": { + "name": "ethtool" + }, + "ports": { + "Ethernet112": {} + } +} + diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel02.conf b/src/sonic-config-engine/tests/sample_output/PortChannel02.conf new file mode 100644 index 000000000000..960ca2d0db65 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/PortChannel02.conf @@ -0,0 +1,16 @@ +{ + "device": "PortChannel02", + "runner": { + "name": "lacp", + "active": true, + "min_ports": 1, + "tx_hash": ["eth", "ipv4", "ipv6"] + }, + "link_watch": { + "name": "ethtool" + }, + "ports": { + "Ethernet116": {} + } +} + diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel03.conf b/src/sonic-config-engine/tests/sample_output/PortChannel03.conf new file mode 100644 index 000000000000..d26ad7795e54 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/PortChannel03.conf @@ -0,0 +1,16 @@ +{ + "device": "PortChannel03", + "runner": { + "name": "lacp", + "active": true, + "min_ports": 1, + "tx_hash": ["eth", "ipv4", "ipv6"] + }, + "link_watch": { + "name": "ethtool" + }, + "ports": { + "Ethernet120": {} + } +} + diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel04.conf b/src/sonic-config-engine/tests/sample_output/PortChannel04.conf new file mode 100644 index 000000000000..76c97b3f7c03 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/PortChannel04.conf @@ -0,0 +1,16 @@ +{ + "device": "PortChannel04", + "runner": { + "name": "lacp", + "active": true, + "min_ports": 1, + "tx_hash": ["eth", "ipv4", "ipv6"] + }, + "link_watch": { + "name": "ethtool" + }, + "ports": { + "Ethernet124": {} + } +} + diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml new file mode 100644 index 000000000000..413aedf7e234 --- /dev/null +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -0,0 +1,315 @@ + + + + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 180 + 60 + + + switch-t0 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 180 + 60 + + + switch-t0 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 180 + 60 + + + + + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/112 + + + + PortChannel02 + fortyGigE0/116 + + + + PortChannel03 + fortyGigE0/120 + + + + PortChannel04 + fortyGigE0/124 + + + + + + Vlan1000 + fortyGigE0/4;fortyGigE0/8;fortyGigE0/12;fortyGigE0/16;fortyGigE0/20;fortyGigE0/24;fortyGigE0/28;fortyGigE0/32;fortyGigE0/36;fortyGigE0/40;fortyGigE0/44;fortyGigE0/48;fortyGigE0/52;fortyGigE0/56;fortyGigE0/60;fortyGigE0/64;fortyGigE0/68;fortyGigE0/72;fortyGigE0/76;fortyGigE0/80;fortyGigE0/84;fortyGigE0/88;fortyGigE0/92;fortyGigE0/96 + False + 0.0.0.0/0 + + 1000 + 1000 + 192.168.0.0/27 + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + PortChannel02 + 10.0.0.58/31 + + + + PortChannel02 + FC00::75/126 + + + + PortChannel03 + 10.0.0.60/31 + + + + PortChannel03 + FC00::79/126 + + + + PortChannel04 + 10.0.0.62/31 + + + + PortChannel04 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/27 + + + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1/1 + switch-t0 + fortyGigE0/112 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1/1 + switch-t0 + fortyGigE0/116 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1/1 + switch-t0 + fortyGigE0/120 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1/1 + switch-t0 + fortyGigE0/124 + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/t0-sample-port-config.ini b/src/sonic-config-engine/tests/t0-sample-port-config.ini new file mode 100644 index 000000000000..06898f1d7964 --- /dev/null +++ b/src/sonic-config-engine/tests/t0-sample-port-config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 29,30,31,32 fortyGigE0/0 +Ethernet4 25,26,27,28 fortyGigE0/4 +Ethernet8 37,38,39,40 fortyGigE0/8 +Ethernet12 33,34,35,36 fortyGigE0/12 +Ethernet16 41,42,43,44 fortyGigE0/16 +Ethernet20 45,46,47,48 fortyGigE0/20 +Ethernet24 5,6,7,8 fortyGigE0/24 +Ethernet28 1,2,3,4 fortyGigE0/28 +Ethernet32 9,10,11,12 fortyGigE0/32 +Ethernet36 13,14,15,16 fortyGigE0/36 +Ethernet40 21,22,23,24 fortyGigE0/40 +Ethernet44 17,18,19,20 fortyGigE0/44 +Ethernet48 49,50,51,52 fortyGigE0/48 +Ethernet52 53,54,55,56 fortyGigE0/52 +Ethernet56 61,62,63,64 fortyGigE0/56 +Ethernet60 57,58,59,60 fortyGigE0/60 +Ethernet64 65,66,67,68 fortyGigE0/64 +Ethernet68 69,70,71,72 fortyGigE0/68 +Ethernet72 77,78,79,80 fortyGigE0/72 +Ethernet76 73,74,75,76 fortyGigE0/76 +Ethernet80 105,106,107,108 fortyGigE0/80 +Ethernet84 109,110,111,112 fortyGigE0/84 +Ethernet88 117,118,119,120 fortyGigE0/88 +Ethernet92 113,114,115,116 fortyGigE0/92 +Ethernet96 121,122,123,124 fortyGigE0/96 +Ethernet100 125,126,127,128 fortyGigE0/100 +Ethernet104 85,86,87,88 fortyGigE0/104 +Ethernet108 81,82,83,84 fortyGigE0/108 +Ethernet112 89,90,91,92 fortyGigE0/112 +Ethernet116 93,94,95,96 fortyGigE0/116 +Ethernet120 97,98,99,100 fortyGigE0/120 +Ethernet124 101,102,103,104 fortyGigE0/124 diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py new file mode 100644 index 000000000000..e2ad2f54a2ac --- /dev/null +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -0,0 +1,40 @@ +import filecmp +import os +import subprocess + +from unittest import TestCase + +class TestJ2Files(TestCase): + def setUp(self): + self.test_dir = os.path.dirname(os.path.realpath(__file__)) + self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') + self.t0_minigraph = os.path.join(self.test_dir, 't0-sample-graph.xml') + self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') + self.output_file = os.path.join(self.test_dir, 'output') + + def run_script(self, argument): + print 'CMD: sonic-cfggen ' + argument + return subprocess.check_output(self.script_file + ' ' + argument, shell=True) + + def test_teamd(self): + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"' + output = self.run_script(argument) # Mock the output via config.sh in docker-teamd + pc_list = output.split() + + def test_render_teamd(self, pc): + teamd_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-teamd', 'teamd.j2') + sample_output_file = os.path.join(self.test_dir, 'sample_output',pc + '.conf') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -a \'{\"pc\":\"' + pc + '\"}\' -t ' + teamd_file + ' > ' + self.output_file + self.run_script(argument) + assert filecmp.cmp(sample_output_file, self.output_file) + + for i in range(1, 5): + pc_name = 'PortChannel0' + str(i) + assert pc_name in pc_list + test_render_teamd(self, pc_name) + + def tearDown(self): + try: + os.remove(self.output_file) + except OSError: + pass From 7a16e02ec158943500f56e75550afb7ba2856108 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 20 Mar 2017 14:04:18 -0700 Subject: [PATCH 0379/1833] [cfggen]: Fix the path to sonic-cfggen due to the path change in #388 (#416) The path moved from /usr/bin/ to /usr/local/bin due to the installation change from deb to whl --- files/build_templates/docker_image_ctl.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 5a753471911d..be62b4351556 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -1,8 +1,8 @@ #!/bin/bash # Obtain our platform and HWSKU as we will mount directories with these names in each docker -PLATFORM=`/usr/bin/sonic-cfggen -v platform` -HWSKU=`/usr/bin/sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` +PLATFORM=`sonic-cfggen -v platform` +HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` start() { docker inspect --type container {{docker_container_name}} &>/dev/null From 0444ca7c346f04c90ddc99d0bd6a4458a6597833 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Mon, 20 Mar 2017 15:28:49 -0700 Subject: [PATCH 0380/1833] [submodule]: Update sonic-utilities submodule (#415) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 22b3d7addd81..4da9efed9355 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 22b3d7addd812acd65b267abc7172c00d042e47e +Subproject commit 4da9efed9355fad8cdf9b1ca2c0a18dd9445eaba From 6a6bc88dcb9255bb1bf80b7a5f1b2e019c991bc4 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 20 Mar 2017 21:39:09 -0700 Subject: [PATCH 0381/1833] [interfaces]: Remove bridge-utils from swss docker and add it to base image (#417) The reason is that /etc/network/interfaces file is in base image. After booting, docker-swss is not ready and thus the empty VLAN interfaces cannot be created when the brctl is pointing to the binary inside the swss docker. Add the bridge-utils into the base image and add bridge_ports none to the /etc/network/interfaces file so that after boot-up the empty VLAN interfaces will be created to let the members to join later. Signed-off-by: Shuotian Cheng --- build_debian.sh | 1 + dockers/docker-orchagent/Dockerfile.j2 | 2 +- dockers/docker-orchagent/base_image_files/brctl | 4 ---- files/image_config/interfaces/interfaces.j2 | 2 +- platform/broadcom/docker-orchagent-brcm.mk | 1 - platform/cavium/docker-orchagent-cavm.mk | 1 - platform/centec/docker-orchagent-centec.mk | 1 - platform/mellanox/docker-orchagent-mlnx.mk | 1 - 8 files changed, 3 insertions(+), 10 deletions(-) delete mode 100755 dockers/docker-orchagent/base_image_files/brctl diff --git a/build_debian.sh b/build_debian.sh index 46cb4bce5259..a303691b1dcc 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -171,6 +171,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in file \ ifupdown \ iproute2 \ + bridge-utils \ isc-dhcp-client \ sudo \ vim \ diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 0376c2c4d86d..507b0bf03355 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansson4 +RUN apt-get install -f -y ifupdown libdbus-1-3 libdaemon0 libjansson4 ## Install redis-tools dependencies ## TODO: implicitly install dependencies diff --git a/dockers/docker-orchagent/base_image_files/brctl b/dockers/docker-orchagent/base_image_files/brctl deleted file mode 100755 index b02d74479f17..000000000000 --- a/dockers/docker-orchagent/base_image_files/brctl +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -docker exec -i swss brctl "$@" - diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index acf7b247fcf0..8cca143ed606 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -75,8 +75,8 @@ iface {{ interface }} inet manual {% block vlan_interfaces %} {% for vlan_interface in minigraph_vlan_interfaces %} auto {{ vlan_interface['name'] }} -allow-hotplug {{ vlan_interface['name'] }} iface {{ vlan_interface['name'] }} {{ 'inet' if vlan_interface['addr'] | ipv4 else 'inet6' }} static + bridge_ports none address {{ vlan_interface['addr'] }} netmask {{ vlan_interface['mask'] }} # diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index 37fdb9c66ac5..e49b67c2c2cc 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -16,4 +16,3 @@ $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += brctl:/usr/bin/brctl diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index 65ddd9eac252..8130ca8dc1cb 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -16,4 +16,3 @@ $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += brctl:/usr/bin/brctl diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk index a3738f6aa2ca..0613fb510de3 100644 --- a/platform/centec/docker-orchagent-centec.mk +++ b/platform/centec/docker-orchagent-centec.mk @@ -16,4 +16,3 @@ $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += brctl:/usr/bin/brctl diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index d081e8af5f3b..505804fb8c17 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -16,4 +16,3 @@ $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += brctl:/usr/bin/brctl From bd77f9a38ae42be60651b08bd67135cd20ee9be6 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 21 Mar 2017 21:42:07 -0700 Subject: [PATCH 0382/1833] [sonic-cfggen]: Read ACL interfaces information from minigrap (#419) * Enable translate_acl to read acl attaching from minigraph * Add AclInterfaces into test t0 graph * Expose minigraph_ports according --- src/sonic-config-engine/minigraph.py | 31 ++++++++++++--- .../tests/t0-sample-graph.xml | 9 ++++- src/sonic-config-engine/tests/test_cfggen.py | 6 +++ src/sonic-config-engine/translate_acl | 38 ++++++++++++++----- 4 files changed, 68 insertions(+), 16 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 54f9efe3c16e..144593557aac 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -124,6 +124,7 @@ def parse_dpg(dpg, hname): ipintfs = child.find(str(QName(ns, "IPInterfaces"))) intfs = [] + intfnames = {} vlan_map = {} pc_map = {} for ipintf in ipintfs.findall(str(QName(ns, "IPInterface"))): @@ -177,6 +178,7 @@ def parse_dpg(dpg, hname): if peer_addr_val is not None: intf['peer_addr'] = ipaddress.IPAddress(peer_addr_val) intfs.append(intf) + intfnames[intf['alias']] = { 'alias': intf['name'] } pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) pc_intfs = [] @@ -237,10 +239,27 @@ def parse_dpg(dpg, hname): vlan_attributes.update(addrtuple) vlan_intfs.append(copy.deepcopy(vlan_attributes)) vlans[vintfname] = vlan_attributes - - - return intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs, vlans, pcs - return None, None, None, None, None + aclintfs = child.find(str(QName(ns, "AclInterfaces"))) + acls = {} + for aclintf in aclintfs.findall(str(QName(ns, "AclInterface"))): + aclname = aclintf.find(str(QName(ns, "InAcl"))).text + aclattach = aclintf.find(str(QName(ns, "AttachTo"))).text.split(';') + acl_intfs = [] + for member in aclattach: + member = member.strip() + if port_alias_map.has_key(member): + member = port_alias_map[member] + if pcs.has_key(member): + acl_intfs.extend(pcs[member]['members']) # For ACL attaching to port channels, we break them into port channel members + elif vlans.has_key(member): + print >> sys.stderr, "Warning: ACL "+aclname+" is attached to a Vlan interface, which is currently not supported" + elif intfnames.has_key(member): + acl_intfs.append(member) + if acl_intfs: + acls[aclname] = acl_intfs + + return intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs, intfnames, vlans, pcs, acls + return None, None, None, None, None, None, None, None def parse_cpg(cpg, hname): bgp_sessions = [] @@ -394,7 +413,7 @@ def parse_xml(filename, platform=None, port_config_file=None): for child in root: if child.tag == str(QName(ns, "DpgDec")): - (intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs, vlans, pcs) = parse_dpg(child, hostname) + (intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs, ports, vlans, pcs, acls) = parse_dpg(child, hostname) elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_asn) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): @@ -418,9 +437,11 @@ def parse_xml(filename, platform=None, port_config_file=None): results['minigraph_vlan_interfaces'] = vlan_intfs results['minigraph_portchannel_interfaces'] = pc_intfs results['minigraph_vlans'] = vlans + results['minigraph_ports'] = ports results['minigraph_portchannels'] = pcs results['minigraph_mgmt_interface'] = mgmt_intf results['minigraph_lo_interfaces'] = lo_intfs + results['minigraph_acls'] = acls results['minigraph_neighbors'] = neighbors results['minigraph_devices'] = devices results['minigraph_underlay_neighbors'] = u_neighbors diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index 413aedf7e234..41e62dca29c2 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -251,7 +251,14 @@
- + + + + PortChannel01;PortChannel02;PortChannel03;PortChannel04 + + DataAcl + + diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 894f069c1ef8..0d0570acf44e 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -8,6 +8,7 @@ def setUp(self): self.test_dir = os.path.dirname(os.path.realpath(__file__)) self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') self.sample_graph = os.path.join(self.test_dir, 'sample_graph.xml') + self.sample_graph_t0 = os.path.join(self.test_dir, 't0-sample-graph.xml') def run_script(self, argument): print '\n Running sonic-cfggen ' + argument @@ -59,3 +60,8 @@ def test_render_template(self): output = self.run_script(argument) self.assertEqual(output.strip(), 'value1\nvalue2') + def test_minigraph_acl(self): + argument = '-m "' + self.sample_graph_t0 + '" -v minigraph_acls' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'DataAcl': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}") + diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl index 29b4597b9c9c..f706fe1f52e4 100755 --- a/src/sonic-config-engine/translate_acl +++ b/src/sonic-config-engine/translate_acl @@ -1,13 +1,14 @@ #!/usr/bin/env python -import openconfig_acl -import pyangbind.lib.pybindJSON as pybindJSON - import sys import os.path import json import argparse +import openconfig_acl +import pyangbind.lib.pybindJSON as pybindJSON +from minigraph import parse_xml + def dump_json(filename, data): with open(filename, 'w') as outfile: json.dump(data, outfile, indent=4, sort_keys=True, separators=(',', ':')) @@ -97,7 +98,7 @@ def generate_rule_json(table_name, rule, max_priority): return rule_data def generate_table_json(aclset, aclname, port, max_priority, output_path='.'): - table_name = aclname.replace(" ", "_") + table_name = aclname.replace(" ", "_").replace("-", "_") #table_name = generate_random_table_name() table_props = {} @@ -119,21 +120,38 @@ def generate_table_json(aclset, aclname, port, max_priority, output_path='.'): dump_json(os.path.join(output_path, "rules_for_"+table_name+".json"), rule_data) -def translate_acl(filename, output_path, port, max_priority): +def translate_acl_fixed_port(filename, output_path, port, max_priority): + yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") + for aclsetname in yang_acl.acl.acl_sets.acl_set: + aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] + generate_table_json(aclset, aclsetname, port, max_priority, output_path) + return + +def translate_acl(filename, output_path, attach_to, max_priority): yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") + print attach_to.keys() for aclsetname in yang_acl.acl.acl_sets.acl_set: - aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] - generate_table_json(aclset, aclsetname, port, max_priority, output_path) + tablename = aclsetname.replace(" ", "_").replace("-", "_") + if attach_to.has_key(tablename): + port = ','.join(attach_to[tablename]) + aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] + generate_table_json(aclset, aclsetname, port, max_priority, output_path) return def main(): parser = argparse.ArgumentParser(description="Translate openconfig ACL json into SONiC ACL jsons") parser.add_argument('input', metavar='INPUT', help='input json file in openconfig format') - parser.add_argument('-p', '--port', default='Ethernet0', help='the port(s) that this ACL is binding to') - parser.add_argument('-m', '--max-priority', type=int, default=10000, help='the priority number of the first rule in ACL entries') + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument('-p', '--port', help='the port(s) that this ACL is attached to') + group.add_argument('-m', '--minigraph', help='read ACL attaching information from minigraph') + parser.add_argument('-n', '--max-priority', type=int, default=10000, help='the priority number of the first rule in ACL entries') parser.add_argument('-o', '--output-path', default='.', help='output directory where SONiC ACL jsons will be generated') args = parser.parse_args() - translate_acl(args.input, args.output_path, args.port, args.max_priority) + if args.port: + translate_acl_fixed_port(args.input, args.output_path, args.port, args.max_priority) + elif args.minigraph: + mini_data = parse_xml(args.minigraph) + translate_acl(args.input, args.output_path, mini_data['minigraph_acls'], args.max_priority) if __name__ == "__main__": main() From 42ae02b66503a1eb10bcea59f574e3829cf6ef45 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 22 Mar 2017 13:04:48 -0700 Subject: [PATCH 0383/1833] [oneimage]: Fix race condition in systemd container services (#421) When Type=simple, systemd will consider the service activated immediately after specified in ExecStart process is started. If there is downstream service depending on the state prepared in ExecStart, there will be race condition. For example, issue #390. In this case, database.service calls database.sh, which calls docker run or docker start -a to start database container. However, systemd considers database.service successfully started at the time database.sh begins, not after docker run finishes. As database.service is consider started, bgp.service can be started. The redis database, which bgp service depends on, might or might not have been started at this time point. To fix this issue (and still keeping the functionality to monitor docker status with systemd), we split the ExecStart process into an ExecStartPre part and an ExecStart part. docker run is splitted into docker run -d then docker attach , while docker start -a is splitted into docker start and then docker attach. In this way, we make sure the downstream services are blocked until container is successfully started. --- files/build_templates/bgp.service.j2 | 3 ++- files/build_templates/database.service.j2 | 3 ++- files/build_templates/dhcp_relay.service.j2 | 3 ++- files/build_templates/docker_image_ctl.j2 | 12 ++++++++---- files/build_templates/lldp.service.j2 | 3 ++- files/build_templates/pmon.service.j2 | 3 ++- files/build_templates/snmp.service.j2 | 3 ++- files/build_templates/swss.service.j2 | 6 +++--- files/build_templates/teamd.service.j2 | 3 ++- 9 files changed, 25 insertions(+), 14 deletions(-) diff --git a/files/build_templates/bgp.service.j2 b/files/build_templates/bgp.service.j2 index 7fa3c0eb1150..c7ba8b8a5f52 100644 --- a/files/build_templates/bgp.service.j2 +++ b/files/build_templates/bgp.service.j2 @@ -5,7 +5,8 @@ After=database.service [Service] User={{ sonicadmin_user }} -ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start +ExecStart=/usr/bin/{{docker_container_name}}.sh attach ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/database.service.j2 b/files/build_templates/database.service.j2 index fd4f34435e6a..c353653e4562 100644 --- a/files/build_templates/database.service.j2 +++ b/files/build_templates/database.service.j2 @@ -5,7 +5,8 @@ After=docker.service [Service] User={{ sonicadmin_user }} -ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start +ExecStart=/usr/bin/{{docker_container_name}}.sh attach 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 95d66c605f85..c0e993eec065 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -5,7 +5,8 @@ After=interfaces-config.service [Service] User={{ sonicadmin_user }} -ExecStart=/usr/bin/{{ docker_container_name }}.sh start +ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start +ExecStart=/usr/bin/{{ docker_container_name }}.sh attach 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 be62b4351556..10679765eb3a 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -7,25 +7,29 @@ HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` start() { docker inspect --type container {{docker_container_name}} &>/dev/null if [ "$?" -eq "0" ]; then - docker start -a {{docker_container_name}} + docker start {{docker_container_name}} else - docker run {{docker_image_run_opt}} \ + docker run -d {{docker_image_run_opt}} \ -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ --name={{docker_container_name}} {{docker_image_name}} fi } +attach() { + docker attach --no-stdin {{docker_container_name}} +} + stop() { docker stop {{docker_container_name}} } case "$1" in - start|stop) + start|stop|attach) $1 ;; *) - echo "Usage: $0 {start|stop}" + echo "Usage: $0 {start|stop|attach}" exit 1 ;; esac diff --git a/files/build_templates/lldp.service.j2 b/files/build_templates/lldp.service.j2 index f66e9d682af6..1ddda15a49c4 100644 --- a/files/build_templates/lldp.service.j2 +++ b/files/build_templates/lldp.service.j2 @@ -5,7 +5,8 @@ After=database.service [Service] User={{ sonicadmin_user }} -ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start +ExecStart=/usr/bin/{{docker_container_name}}.sh attach 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 d50f5be628de..9f1a0298240c 100644 --- a/files/build_templates/pmon.service.j2 +++ b/files/build_templates/pmon.service.j2 @@ -5,7 +5,8 @@ After=database.service [Service] User={{ sonicadmin_user }} -ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start +ExecStart=/usr/bin/{{docker_container_name}}.sh attach 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 3744c586896f..493d6bd8fcfd 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -5,7 +5,8 @@ After=database.service [Service] User={{ sonicadmin_user }} -ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start +ExecStart=/usr/bin/{{docker_container_name}}.sh attach ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 3ec8161fa00a..7466e8c14577 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -20,9 +20,9 @@ ExecStartPre=-/etc/init.d/xpnet.sh stop ExecStartPre=/etc/init.d/xpnet.sh start {% endif %} -# systemd allows only one parent process within service, -# so we spawn both dockers from single bash parent -ExecStart=/bin/bash -c "/usr/bin/{{docker_container_name}}.sh start & /usr/bin/syncd.sh start & wait -n 0" +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start +ExecStartPre=/usr/bin/syncd.sh start +ExecStart=/usr/bin/{{docker_container_name}}.sh attach ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStopPost=/usr/bin/syncd.sh stop diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 49ecb640d895..e291a39b387d 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -5,7 +5,8 @@ After=database.service [Service] User={{ sonicadmin_user }} -ExecStart=/usr/bin/{{docker_container_name}}.sh start +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start +ExecStart=/usr/bin/{{docker_container_name}}.sh attach ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] From 91cca8966d0055a35820023d7ba6800486ce55e3 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 22 Mar 2017 16:38:51 -0700 Subject: [PATCH 0384/1833] [docker-syncd-*-rpc]: Fix build (#423) * Fix docker-syncd-brcm-rpc build * Fix docker-syncd-mlnx-rpc build * Rename docker-syncd-rpc to docker-syncd-brcm-rpc * Add fix for mlnx platform too --- .../Dockerfile | 10 +++++----- .../ptf_nn_agent.conf | 0 .../supervisord.conf | 0 dockers/docker-syncd-mlnx-rpc/Dockerfile | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) rename dockers/{docker-syncd-rpc => docker-syncd-brcm-rpc}/Dockerfile (88%) rename dockers/{docker-syncd-rpc => docker-syncd-brcm-rpc}/ptf_nn_agent.conf (100%) rename dockers/{docker-syncd-rpc => docker-syncd-brcm-rpc}/supervisord.conf (100%) diff --git a/dockers/docker-syncd-rpc/Dockerfile b/dockers/docker-syncd-brcm-rpc/Dockerfile similarity index 88% rename from dockers/docker-syncd-rpc/Dockerfile rename to dockers/docker-syncd-brcm-rpc/Dockerfile index ed75d1a1f0ec..23f5e7a25f6a 100644 --- a/dockers/docker-syncd-rpc/Dockerfile +++ b/dockers/docker-syncd-brcm-rpc/Dockerfile @@ -1,4 +1,4 @@ -FROM docker-syncd +FROM docker-syncd-brcm ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -43,7 +43,7 @@ RUN apt-get update \ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf -ENTRYPOINT service rsyslog start \ - && sysctl -w net.core.rmem_max=509430500 \ - && service syncd start \ - && /usr/bin/supervisord +RUN sed -i 's/read/sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord/' /usr/bin/start.sh + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/dockers/docker-syncd-rpc/ptf_nn_agent.conf b/dockers/docker-syncd-brcm-rpc/ptf_nn_agent.conf similarity index 100% rename from dockers/docker-syncd-rpc/ptf_nn_agent.conf rename to dockers/docker-syncd-brcm-rpc/ptf_nn_agent.conf diff --git a/dockers/docker-syncd-rpc/supervisord.conf b/dockers/docker-syncd-brcm-rpc/supervisord.conf similarity index 100% rename from dockers/docker-syncd-rpc/supervisord.conf rename to dockers/docker-syncd-brcm-rpc/supervisord.conf diff --git a/dockers/docker-syncd-mlnx-rpc/Dockerfile b/dockers/docker-syncd-mlnx-rpc/Dockerfile index 3b891784b226..42e24be7ecb5 100644 --- a/dockers/docker-syncd-mlnx-rpc/Dockerfile +++ b/dockers/docker-syncd-mlnx-rpc/Dockerfile @@ -43,7 +43,7 @@ RUN apt-get update \ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf -ENTRYPOINT service rsyslog start \ - && sysctl -w net.core.rmem_max=509430500 \ - && service syncd start \ - && /usr/bin/supervisord +RUN sed -i 's/read/sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord/' /usr/bin/start.sh + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] From f08874db360b940b5c1705dc05161297184393ee Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 22 Mar 2017 16:59:12 -0700 Subject: [PATCH 0385/1833] [platform-monitor]: Fix sensors.conf file path (#426) sensors.conf file was moved in #316. --- dockers/docker-platform-monitor/config.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dockers/docker-platform-monitor/config.sh b/dockers/docker-platform-monitor/config.sh index a74c2f5c9097..7021f18aacb8 100755 --- a/dockers/docker-platform-monitor/config.sh +++ b/dockers/docker-platform-monitor/config.sh @@ -1,12 +1,9 @@ #!/bin/bash mkdir -p /etc/sensors.d - -hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` - -if [ -e /usr/share/sonic/$hwsku/sensors.conf ] +if [ -e /usr/share/sonic/platform/sensors.conf ] then - /bin/cp -rf /usr/share/sonic/$hwsku/sensors.conf /etc/sensors.d/ + /bin/cp -rf /usr/share/sonic/platform/sensors.conf /etc/sensors.d/ fi mkdir -p /var/sonic From dccef8f557f933bc2c29385bce8ea8213e8ab7cb Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 22 Mar 2017 18:56:51 -0700 Subject: [PATCH 0386/1833] [submodule]: Update common/swss/sairedis submodules (#422) Signed-off-by: Shuotian Cheng --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 426589a7f6be..383ed119845a 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 426589a7f6be8f021207734fd277882eb051fc5f +Subproject commit 383ed119845ad726788c4198aa05e3e31c20c78f diff --git a/src/sonic-swss b/src/sonic-swss index 6f06b59971e5..3e713cc33b78 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 6f06b59971e5ee75b721d3630878ba03f28f9831 +Subproject commit 3e713cc33b78f0a21d51573ebb604fe3ffddc874 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index b1c829a0b2f4..68e6c409b4a9 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit b1c829a0b2f4dd0dfef8ec1e6b6cd67bcf334d7c +Subproject commit 68e6c409b4a96a677ea90a831172df7ae68acbef From a8fdd1f42d0b46b06487dcdeca792d8db67b4558 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 22 Mar 2017 20:13:55 -0700 Subject: [PATCH 0387/1833] [oneimage] Enable forcing mgmt route through minigraph (#424) --- files/image_config/interfaces/interfaces.j2 | 6 ++++++ src/sonic-config-engine/minigraph.py | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 8cca143ed606..c6156dab8bf9 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -28,9 +28,15 @@ iface eth0 inet static # management port up rules up ip route add default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default up ip rule add from {{ minigraph_mgmt_interface['addr'] }}/32 table default +{% for prefix in forced_mgmt_routes %} + up ip route add {{ prefix }} via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 +{% endfor %} # management port down rules down ip route delete default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default down ip rule delete from {{ minigraph_mgmt_interface['addr'] }}/32 table default +{% for prefix in forced_mgmt_routes %} + down ip route delete {{ prefix }} via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 +{% endfor %} {# TODO: COPP policy type rules #} {% else %} iface eth0 inet dhcp diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 144593557aac..20c5aeb5b5f1 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -301,6 +301,7 @@ def parse_meta(meta, hname): syslog_servers = [] dhcp_servers = [] ntp_servers = [] + mgmt_routes = [] device_metas = meta.find(str(QName(ns, "Devices"))) for device in device_metas.findall(str(QName(ns1, "DeviceMetadata"))): if device.find(str(QName(ns1, "Name"))).text == hname: @@ -315,7 +316,9 @@ def parse_meta(meta, hname): ntp_servers = value_group elif name == "SyslogResources": syslog_servers = value_group - return syslog_servers, dhcp_servers, ntp_servers + elif name == "ForcedMgmtRoutes": + mgmt_routes = value_group + return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes def get_console_info(devices, dev, port): for k, v in devices.items(): @@ -397,6 +400,7 @@ def parse_xml(filename, platform=None, port_config_file=None): syslog_servers = [] dhcp_servers = [] ntp_servers = [] + mgmt_routes = [] hwsku_qn = QName(ns, "HwSku") hostname_qn = QName(ns, "Hostname") @@ -421,7 +425,7 @@ def parse_xml(filename, platform=None, port_config_file=None): elif child.tag == str(QName(ns, "UngDec")): (u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname) elif child.tag == str(QName(ns, "MetadataDeclaration")): - (syslog_servers, dhcp_servers, ntp_servers) = parse_meta(child, hostname) + (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes) = parse_meta(child, hostname) Tree = lambda: defaultdict(Tree) @@ -455,6 +459,7 @@ def parse_xml(filename, platform=None, port_config_file=None): results['syslog_servers'] = syslog_servers results['dhcp_servers'] = dhcp_servers results['ntp_servers'] = ntp_servers + results['forced_mgmt_routes'] = mgmt_routes results['alias_map'] = alias_map_list return results From e2cc409f8a9dfeefccc192ba76b71c7fd4c02c10 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 23 Mar 2017 12:18:52 -0700 Subject: [PATCH 0388/1833] [database]: Mount /var/run/redis/ folder from host for all dockers (#418) - Create /var/run/redis/ folder on the host - Install Python client for Redis on the host - Mount /var/run/redis/ as read/write from host for all dockers - Enable accessing the database everywhere including on the host and from remote Signed-off-by: Shuotian Cheng --- build_debian.sh | 3 +++ files/build_templates/docker_image_ctl.j2 | 2 ++ files/build_templates/sonic_debian_extension.j2 | 5 ++++- platform/broadcom/docker-orchagent-brcm.mk | 1 - platform/broadcom/docker-syncd-brcm.mk | 1 - platform/cavium/docker-orchagent-cavm.mk | 1 - platform/cavium/docker-syncd-cavm.mk | 1 - platform/centec/docker-orchagent-centec.mk | 1 - platform/centec/docker-syncd-centec.mk | 1 - platform/mellanox/docker-orchagent-mlnx.mk | 1 - platform/mellanox/docker-syncd-mlnx.mk | 1 - rules/docker-database.mk | 2 -- rules/docker-fpm-gobgp.mk | 2 -- rules/docker-fpm.mk | 1 - rules/docker-lldp-sv2.mk | 1 - rules/docker-snmp-sv2.mk | 1 - rules/docker-teamd.mk | 2 -- 17 files changed, 9 insertions(+), 18 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index a303691b1dcc..0bce39736b9f 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -240,6 +240,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT easy_install pip sudo LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0' ## Note: keep pip installed for maintainance purpose +## Create /var/run/redis folder for docker-database to mount +sudo mkdir -p $FILESYSTEM_ROOT/var/run/redis + ## Config DHCP for eth0 sudo tee -a $FILESYSTEM_ROOT/etc/network/interfaces > /dev/null < Date: Thu, 23 Mar 2017 16:30:18 -0700 Subject: [PATCH 0389/1833] [interfaces]: Restart networking service after the file is updated (#430) Signed-off-by: Shuotian Cheng --- files/image_config/interfaces/interfaces-config.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index f36f45b55576..e26060197619 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,6 +1,4 @@ #!/bin/bash sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces -ifdown eth0 && ifup eth0 -ifdown lo && ifup lo - +service networking restart From b010e23725fcc9a36c9ed07a50d012a93f0ac3c6 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 23 Mar 2017 16:30:37 -0700 Subject: [PATCH 0390/1833] [sonic-cfggen]: Remove deprecated platform folder and update related files (#429) Signed-off-by: Shuotian Cheng --- src/sonic-config-engine/MANIFEST.in | 1 - .../platform/ACS-MSN2700/port_config.ini | 33 -------- .../platform/ACS-MSN2700/sensors.conf | 21 ----- .../platform/AS7512/port_config.ini | 33 -------- .../platform/Arista-7050-QX32/port_config.ini | 33 -------- .../platform/Arista-7050-QX32/sensors.conf | 79 ------------------- .../Arista-7060-CX32S/port_config.ini | 33 -------- .../platform/Arista-7060-CX32S/sensors.conf | 47 ----------- .../platform/Force10-S6000/port_config.ini | 33 -------- .../platform/Force10-S6000/sensors.conf | 57 ------------- .../platform/Force10-S6100/port_config.ini | 65 --------------- .../platform/Force10-Z9100/port_config.ini | 33 -------- .../INGRASYS-S9100-C32/port_config.ini | 33 -------- .../platform/INGRASYS-S9100-C32/sensors.conf | 35 -------- src/sonic-config-engine/setup.py | 13 --- 15 files changed, 549 deletions(-) delete mode 100644 src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini delete mode 100644 src/sonic-config-engine/platform/ACS-MSN2700/sensors.conf delete mode 100644 src/sonic-config-engine/platform/AS7512/port_config.ini delete mode 100644 src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini delete mode 100644 src/sonic-config-engine/platform/Arista-7050-QX32/sensors.conf delete mode 100644 src/sonic-config-engine/platform/Arista-7060-CX32S/port_config.ini delete mode 100644 src/sonic-config-engine/platform/Arista-7060-CX32S/sensors.conf delete mode 100644 src/sonic-config-engine/platform/Force10-S6000/port_config.ini delete mode 100644 src/sonic-config-engine/platform/Force10-S6000/sensors.conf delete mode 100644 src/sonic-config-engine/platform/Force10-S6100/port_config.ini delete mode 100644 src/sonic-config-engine/platform/Force10-Z9100/port_config.ini delete mode 100644 src/sonic-config-engine/platform/INGRASYS-S9100-C32/port_config.ini delete mode 100644 src/sonic-config-engine/platform/INGRASYS-S9100-C32/sensors.conf diff --git a/src/sonic-config-engine/MANIFEST.in b/src/sonic-config-engine/MANIFEST.in index c228a249adfb..a7038d546e9c 100644 --- a/src/sonic-config-engine/MANIFEST.in +++ b/src/sonic-config-engine/MANIFEST.in @@ -1,2 +1 @@ -recursive-include platform *.json *.ini *.conf recursive-include tests *.j2 *.yml *.xml diff --git a/src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini b/src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini deleted file mode 100644 index 816bb0e94a70..000000000000 --- a/src/sonic-config-engine/platform/ACS-MSN2700/port_config.ini +++ /dev/null @@ -1,33 +0,0 @@ -# name lanes -Ethernet0 0,1,2,3 -Ethernet4 4,5,6,7 -Ethernet8 8,9,10,11 -Ethernet12 12,13,14,15 -Ethernet16 16,17,18,19 -Ethernet20 20,21,22,23 -Ethernet24 24,25,26,27 -Ethernet28 28,29,30,31 -Ethernet32 32,33,34,35 -Ethernet36 36,37,38,39 -Ethernet40 40,41,42,43 -Ethernet44 44,45,46,47 -Ethernet48 48,49,50,51 -Ethernet52 52,53,54,55 -Ethernet56 56,57,58,59 -Ethernet60 60,61,62,63 -Ethernet64 64,65,66,67 -Ethernet68 68,69,70,71 -Ethernet72 72,73,74,75 -Ethernet76 76,77,78,79 -Ethernet80 80,81,82,83 -Ethernet84 84,85,86,87 -Ethernet88 88,89,90,91 -Ethernet92 92,93,94,95 -Ethernet96 96,97,98,99 -Ethernet100 100,101,102,103 -Ethernet104 104,105,106,107 -Ethernet108 108,109,110,111 -Ethernet112 112,113,114,115 -Ethernet116 116,117,118,119 -Ethernet120 120,121,122,123 -Ethernet124 124,125,126,127 diff --git a/src/sonic-config-engine/platform/ACS-MSN2700/sensors.conf b/src/sonic-config-engine/platform/ACS-MSN2700/sensors.conf deleted file mode 100644 index a3e30391863e..000000000000 --- a/src/sonic-config-engine/platform/ACS-MSN2700/sensors.conf +++ /dev/null @@ -1,21 +0,0 @@ -bus "i2c-7" "i2c-1-mux (chan_id 5)" -chip "lm75-i2c-7-4a" - label temp1 "Ambient Port Temp" - -bus "i2c-5" "i2c-1-mux (chan_id 3)" -chip "ucd9200-i2c-5-27" - label in1 "UCD1 vin" - label in2 "ASIC 3.3 vout" - label in3 "ASIC 1.2 vout" - label temp1 "UCD1 Temp" - label temp2 "UCD1 Temp2" - -chip "ucd9200-i2c-5-41" - label in1 "UCD2 vin" - label in2 "ASIC Vcore vout" - label temp1 "UCD2 Temp1" - label temp2 "UCD2 Temp2" - -bus "i2c-17" "i2c-1-mux (chan_id 7)" -chip "lm75-i2c-17-49" - label temp1 "Ambient Board Temp" diff --git a/src/sonic-config-engine/platform/AS7512/port_config.ini b/src/sonic-config-engine/platform/AS7512/port_config.ini deleted file mode 100644 index c10cd2786941..000000000000 --- a/src/sonic-config-engine/platform/AS7512/port_config.ini +++ /dev/null @@ -1,33 +0,0 @@ -# name lanes -Ethernet0 16,17,18,19 -Ethernet4 20,21,22,23 -Ethernet8 24,25,26,27 -Ethernet12 28,29,30,31 -Ethernet16 32,33,34,35 -Ethernet20 36,37,38,39 -Ethernet24 40,41,42,43 -Ethernet28 44,45,46,47 -Ethernet32 0,1,2,3 -Ethernet36 4,5,6,7 -Ethernet40 8,9,10,11 -Ethernet44 12,13,14,15 -Ethernet48 48,49,50,51 -Ethernet52 52,53,54,55 -Ethernet56 56,57,58,59 -Ethernet60 60,61,62,63 -Ethernet64 127,126,125,124 -Ethernet68 123,122,121,120 -Ethernet72 115,114,113,112 -Ethernet76 119,118,117,116 -Ethernet80 79,78,77,76 -Ethernet84 75,74,73,72 -Ethernet88 64,65,66,67 -Ethernet92 71,70,68,69 -Ethernet96 111,110,109,108 -Ethernet100 107,106,105,104 -Ethernet104 103,102,101,100 -Ethernet108 99,98,97,96 -Ethernet112 95,94,93,92 -Ethernet116 91,90,89,88 -Ethernet120 87,86,85,84 -Ethernet124 83,82,81,80 diff --git a/src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini b/src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini deleted file mode 100644 index b9ab8854a2ec..000000000000 --- a/src/sonic-config-engine/platform/Arista-7050-QX32/port_config.ini +++ /dev/null @@ -1,33 +0,0 @@ -# name lanes alias -Ethernet0 125,126,127,128 Ethernet1/1 -Ethernet4 121,122,123,124 Ethernet2/1 -Ethernet8 13,14,15,16 Ethernet3/1 -Ethernet12 9,10,11,12 Ethernet4/1 -Ethernet16 17,18,19,20 Ethernet5/1 -Ethernet20 21,22,23,24 Ethernet6/1 -Ethernet24 25,26,27,28 Ethernet7/1 -Ethernet28 29,30,31,32 Ethernet8/1 -Ethernet32 37,38,39,40 Ethernet9/1 -Ethernet36 33,34,35,36 Ethernet10/1 -Ethernet40 45,46,47,48 Ethernet11/1 -Ethernet44 41,42,43,44 Ethernet12/1 -Ethernet48 53,54,55,56 Ethernet13/1 -Ethernet52 49,50,51,52 Ethernet14/1 -Ethernet56 69,70,71,72 Ethernet15/1 -Ethernet60 65,66,67,68 Ethernet16/1 -Ethernet64 77,78,79,80 Ethernet17/1 -Ethernet68 73,74,75,76 Ethernet18/1 -Ethernet72 93,94,95,96 Ethernet19/1 -Ethernet76 89,90,91,92 Ethernet20/1 -Ethernet80 101,102,103,104 Ethernet21/1 -Ethernet84 97,98,99,100 Ethernet22/1 -Ethernet88 109,110,111,112 Ethernet23/1 -Ethernet92 105,106,107,108 Ethernet24/1 -Ethernet96 61,62,63,64 Ethernet25 -Ethernet100 57,58,59,60 Ethernet26 -Ethernet104 81,82,83,84 Ethernet27 -Ethernet108 85,86,87,88 Ethernet28 -Ethernet112 117,118,119,120 Ethernet29 -Ethernet116 113,114,115,116 Ethernet30 -Ethernet120 5,6,7,8 Ethernet31 -Ethernet124 1,2,3,4 Ethernet32 diff --git a/src/sonic-config-engine/platform/Arista-7050-QX32/sensors.conf b/src/sonic-config-engine/platform/Arista-7050-QX32/sensors.conf deleted file mode 100644 index 7745054a05ca..000000000000 --- a/src/sonic-config-engine/platform/Arista-7050-QX32/sensors.conf +++ /dev/null @@ -1,79 +0,0 @@ -# libsensors configuration file -# ---------------------------------------------- -# - -bus "i2c-2" "SCD SMBus master 0 bus 0" -bus "i2c-3" "SCD SMBus master 0 bus 1" -bus "i2c-5" "SCD SMBus master 0 bus 3" -bus "i2c-6" "SCD SMBus master 0 bus 4" -bus "i2c-7" "SCD SMBus master 0 bus 5" - -chip "k10temp-pci-00c3" - label temp1 "Cpu temp sensor" - -chip "lm73-i2c-3-48" - label temp1 "Rear Temp Sensor" - set temp1_max 65 - #set temp1_max_alarm 75 # read-only - -chip "lm86-i2c-2-4c" - label temp1 "Board Temp Sensor" - set temp1_max 65 - set temp1_crit 75 - - label temp2 "Front-panel Temp Sensor" - set temp2_max 65 - set temp2_crit 75 - -chip "pmbus-i2c-3-4e" - label temp1 "Power Controller Sensor 1" - set temp1_max 60 - set temp1_crit 70 - - label temp2 "Power Controller Sensor 2" - set temp2_max 60 - set temp2_crit 70 - - ignore curr1 - -chip "pmbus-i2c-5-58" - label temp1 "Power Supply 1 Sensor 1" - set temp1_max 60 - set temp1_crit 70 - - label temp2 "Power Supply 1 Sensor 2" - set temp2_max 60 - set temp2_crit 70 - - ignore temp3 - - set in1_max 250 - set in1_crit 255 - set power1_max 525 - set power2_max 460 - set power2_crit 462 - set curr1_max 5.28 - set curr1_crit 5.30 - set curr2_max 36 - set curr2_crit 37 - -chip "pmbus-i2c-6-58" - label temp1 "Power Supply 2 Sensor 1" - set temp1_max 60 - set temp1_crit 70 - - label temp2 "Power Supply 2 Sensor 2" - set temp2_max 60 - set temp2_crit 70 - - ignore temp3 - - set in1_max 250 - set in1_crit 255 - set power1_max 525 - set power2_max 460 - set power2_crit 462 - set curr1_max 5.28 - set curr1_crit 5.30 - set curr2_max 36 - set curr2_crit 37 diff --git a/src/sonic-config-engine/platform/Arista-7060-CX32S/port_config.ini b/src/sonic-config-engine/platform/Arista-7060-CX32S/port_config.ini deleted file mode 100644 index 414fb94efbc1..000000000000 --- a/src/sonic-config-engine/platform/Arista-7060-CX32S/port_config.ini +++ /dev/null @@ -1,33 +0,0 @@ -# name lanes alias -Ethernet0 33,34,35,36 Ethernet1/1 -Ethernet4 37,38,39,40 Ethernet2/1 -Ethernet8 41,42,43,44 Ethernet3/1 -Ethernet12 45,46,47,48 Ethernet4/1 -Ethernet16 49,50,51,52 Ethernet5/1 -Ethernet20 53,54,55,56 Ethernet6/1 -Ethernet24 57,58,59,60 Ethernet7/1 -Ethernet28 61,62,63,64 Ethernet8/1 -Ethernet32 65,66,67,68 Ethernet9/1 -Ethernet36 69,70,71,72 Ethernet10/1 -Ethernet40 73,74,75,76 Ethernet11/1 -Ethernet44 77,78,79,80 Ethernet12/1 -Ethernet48 81,82,83,84 Ethernet13/1 -Ethernet52 85,86,87,88 Ethernet14/1 -Ethernet56 89,90,91,92 Ethernet15/1 -Ethernet60 93,94,95,96 Ethernet16/1 -Ethernet64 97,98,99,100 Ethernet17/1 -Ethernet68 101,102,103,104 Ethernet18/1 -Ethernet72 105,106,107,108 Ethernet19/1 -Ethernet76 109,110,111,112 Ethernet20/1 -Ethernet80 113,114,115,116 Ethernet21/1 -Ethernet84 117,118,119,120 Ethernet22/1 -Ethernet88 121,122,123,124 Ethernet23/1 -Ethernet92 125,126,127,128 Ethernet24/1 -Ethernet96 1,2,3,4 Ethernet25/1 -Ethernet100 5,6,7,8 Ethernet26/1 -Ethernet104 9,10,11,12 Ethernet27/1 -Ethernet108 13,14,15,16 Ethernet28/1 -Ethernet112 17,18,19,20 Ethernet29/1 -Ethernet116 21,22,23,24 Ethernet30/1 -Ethernet120 25,26,27,28 Ethernet31/1 -Ethernet124 29,30,31,32 Ethernet32/1 diff --git a/src/sonic-config-engine/platform/Arista-7060-CX32S/sensors.conf b/src/sonic-config-engine/platform/Arista-7060-CX32S/sensors.conf deleted file mode 100644 index 3b4dd2385322..000000000000 --- a/src/sonic-config-engine/platform/Arista-7060-CX32S/sensors.conf +++ /dev/null @@ -1,47 +0,0 @@ -# libsensors configuration file for DCS-7060CX-32S -# ------------------------------------------------ -# - -bus "i2c-2" "SCD SMBus master 0 bus 0" -bus "i2c-3" "SCD SMBus master 0 bus 1" -bus "i2c-5" "SCD SMBus master 0 bus 3" -bus "i2c-6" "SCD SMBus master 0 bus 4" -bus "i2c-7" "SCD SMBus master 0 bus 5" - -chip "k10temp-pci-00c3" - label temp1 "Cpu temp sensor" - -# missing support for -# chip "max6697-i2c-2-1a" -# board sensor 65 75 -# (1) switch chip left sensor 95 105 -# (5) switch chip right sensor 95 105 -# (6) front panel temp sensor 65 75 - -chip "max6658-i2c-3-4c" - label temp1 "Cpu board temp sensor" - set temp1_max 75 - set temp1_crit 80 - - label temp2 "Back panel temp sensor" - set temp2_max 75 - set temp2_crit 80 - -chip "pmbus-i2c-3-4e" - label temp1 "Power controller 1 sensor 1" - label temp2 "Power controller 1 sensor 2" - -chip "pmbus-i2c-7-4e" - label temp1 "Power controller 2 sensor 1" - label temp2 "Power controller 2 sensor 2" - -chip "pmbus-i2c-6-58" - label temp1 "Power supply 1 hotspot sensor" - label temp2 "Power supply 1 inlet temp sensor" - label temp3 "Power supply 1 sensor" - -chip "pmbus-i2c-5-58" - label temp1 "Power supply 2 hotspot sensor" - label temp2 "Power supply 2 inlet temp sensor" - label temp3 "Power supply 2 sensor" - diff --git a/src/sonic-config-engine/platform/Force10-S6000/port_config.ini b/src/sonic-config-engine/platform/Force10-S6000/port_config.ini deleted file mode 100644 index 06898f1d7964..000000000000 --- a/src/sonic-config-engine/platform/Force10-S6000/port_config.ini +++ /dev/null @@ -1,33 +0,0 @@ -# name lanes alias -Ethernet0 29,30,31,32 fortyGigE0/0 -Ethernet4 25,26,27,28 fortyGigE0/4 -Ethernet8 37,38,39,40 fortyGigE0/8 -Ethernet12 33,34,35,36 fortyGigE0/12 -Ethernet16 41,42,43,44 fortyGigE0/16 -Ethernet20 45,46,47,48 fortyGigE0/20 -Ethernet24 5,6,7,8 fortyGigE0/24 -Ethernet28 1,2,3,4 fortyGigE0/28 -Ethernet32 9,10,11,12 fortyGigE0/32 -Ethernet36 13,14,15,16 fortyGigE0/36 -Ethernet40 21,22,23,24 fortyGigE0/40 -Ethernet44 17,18,19,20 fortyGigE0/44 -Ethernet48 49,50,51,52 fortyGigE0/48 -Ethernet52 53,54,55,56 fortyGigE0/52 -Ethernet56 61,62,63,64 fortyGigE0/56 -Ethernet60 57,58,59,60 fortyGigE0/60 -Ethernet64 65,66,67,68 fortyGigE0/64 -Ethernet68 69,70,71,72 fortyGigE0/68 -Ethernet72 77,78,79,80 fortyGigE0/72 -Ethernet76 73,74,75,76 fortyGigE0/76 -Ethernet80 105,106,107,108 fortyGigE0/80 -Ethernet84 109,110,111,112 fortyGigE0/84 -Ethernet88 117,118,119,120 fortyGigE0/88 -Ethernet92 113,114,115,116 fortyGigE0/92 -Ethernet96 121,122,123,124 fortyGigE0/96 -Ethernet100 125,126,127,128 fortyGigE0/100 -Ethernet104 85,86,87,88 fortyGigE0/104 -Ethernet108 81,82,83,84 fortyGigE0/108 -Ethernet112 89,90,91,92 fortyGigE0/112 -Ethernet116 93,94,95,96 fortyGigE0/116 -Ethernet120 97,98,99,100 fortyGigE0/120 -Ethernet124 101,102,103,104 fortyGigE0/124 diff --git a/src/sonic-config-engine/platform/Force10-S6000/sensors.conf b/src/sonic-config-engine/platform/Force10-S6000/sensors.conf deleted file mode 100644 index 2208bb6340d1..000000000000 --- a/src/sonic-config-engine/platform/Force10-S6000/sensors.conf +++ /dev/null @@ -1,57 +0,0 @@ -# libsensors configuration file -# -------------------------------------------------- -# - -# tmp75-i2c-11-4c has sensors close to Networking ASIC. -# tmp75-i2c-11-4d has sensors close to NIC. -# tmp75-i2c-11-4e is an ambient temperature sensor. - -chip "tmp75-*" - set temp1_max 50 - set temp1_max_hyst 25 - -# emc1403-i2c-10-4d has following temperature sensors: -# temp1: CPU0 external Temp Sensor -# temp2: CPU1 external Temp Sensor -# temp3: CPU Internal DTS (Internal die, max of all die readings) - -chip "emc1403-*" - set temp1_crit 85 - set temp1_max 50 - set temp2_crit 85 - set temp2_max 50 - set temp3_crit 85 - set temp3_max 50 - -chip "max6620-i2c-*-2a" - ignore fan3 - ignore fan4 - -chip "w83627dhg-*" - label in0 "VCore 1" - label in1 "VCore 2" - set in0_min 0 - set in0_max 1.74 - set in1_min 0 - set in1_max 1.74 - ignore fan1 - ignore fan2 - ignore fan3 - ignore fan4 - ignore fan5 - ignore in4 - ignore in5 - ignore in6 - ignore temp1 - ignore temp2 - ignore temp3 - ignore cpu0_vid - ignore intrusion0 - -chip "jc42-*" - set temp1_max 50 - set temp1_crit 85 - -chip "dni_dps460-*" - set temp1_max 50 - set temp2_max 50 diff --git a/src/sonic-config-engine/platform/Force10-S6100/port_config.ini b/src/sonic-config-engine/platform/Force10-S6100/port_config.ini deleted file mode 100644 index dcdd6548c198..000000000000 --- a/src/sonic-config-engine/platform/Force10-S6100/port_config.ini +++ /dev/null @@ -1,65 +0,0 @@ -# name lanes alias -Ethernet0 101,102 fortyGigE1/1/1 -Ethernet1 103,104 fortyGigE1/1/2 -Ethernet2 97,98 fortyGigE1/1/3 -Ethernet3 99,100 fortyGigE1/1/4 -Ethernet4 69,70 fortyGigE1/1/5 -Ethernet5 71,72 fortyGigE1/1/6 -Ethernet6 65,66 fortyGigE1/1/7 -Ethernet7 67,68 fortyGigE1/1/8 -Ethernet8 53,54 fortyGigE1/1/9 -Ethernet9 55,56 fortyGigE1/1/10 -Ethernet10 49,50 fortyGigE1/1/11 -Ethernet11 51,52 fortyGigE1/1/12 -Ethernet12 21,22 fortyGigE1/1/13 -Ethernet13 23,24 fortyGigE1/1/14 -Ethernet14 17,18 fortyGigE1/1/15 -Ethernet15 19,20 fortyGigE1/1/16 -Ethernet16 25,26 fortyGigE1/2/1 -Ethernet17 27,28 fortyGigE1/2/2 -Ethernet18 29,30 fortyGigE1/2/3 -Ethernet19 31,32 fortyGigE1/2/4 -Ethernet20 57,58 fortyGigE1/2/5 -Ethernet21 59,60 fortyGigE1/2/6 -Ethernet22 61,62 fortyGigE1/2/7 -Ethernet23 63,64 fortyGigE1/2/8 -Ethernet24 73,74 fortyGigE1/2/9 -Ethernet25 75,76 fortyGigE1/2/10 -Ethernet26 77,78 fortyGigE1/2/11 -Ethernet27 79,80 fortyGigE1/2/12 -Ethernet28 105,106 fortyGigE1/2/13 -Ethernet29 107,108 fortyGigE1/2/14 -Ethernet30 109,110 fortyGigE1/2/15 -Ethernet31 111,112 fortyGigE1/2/16 -Ethernet32 13,14 fortyGigE1/3/1 -Ethernet33 15,16 fortyGigE1/3/2 -Ethernet34 9,10 fortyGigE1/3/3 -Ethernet35 11,12 fortyGigE1/3/4 -Ethernet36 125,126 fortyGigE1/3/5 -Ethernet37 127,128 fortyGigE1/3/6 -Ethernet38 121,122 fortyGigE1/3/7 -Ethernet39 123,124 fortyGigE1/3/8 -Ethernet40 93,94 fortyGigE1/3/9 -Ethernet41 95,96 fortyGigE1/3/10 -Ethernet42 89,90 fortyGigE1/3/11 -Ethernet43 91,92 fortyGigE1/3/12 -Ethernet44 45,46 fortyGigE1/3/13 -Ethernet45 47,48 fortyGigE1/3/14 -Ethernet46 41,42 fortyGigE1/3/15 -Ethernet47 43,44 fortyGigE1/3/16 -Ethernet48 113,114 fortyGigE1/4/1 -Ethernet49 115,116 fortyGigE1/4/2 -Ethernet50 117,118 fortyGigE1/4/3 -Ethernet51 119,120 fortyGigE1/4/4 -Ethernet52 1,2 fortyGigE1/4/5 -Ethernet53 3,4 fortyGigE1/4/6 -Ethernet54 5,6 fortyGigE1/4/7 -Ethernet55 7,8 fortyGigE1/4/8 -Ethernet56 33,34 fortyGigE1/4/9 -Ethernet57 35,36 fortyGigE1/4/10 -Ethernet58 37,38 fortyGigE1/4/11 -Ethernet59 39,40 fortyGigE1/4/12 -Ethernet60 81,82 fortyGigE1/4/13 -Ethernet61 83,84 fortyGigE1/4/14 -Ethernet62 85,86 fortyGigE1/4/15 -Ethernet63 87,88 fortyGigE1/4/16 diff --git a/src/sonic-config-engine/platform/Force10-Z9100/port_config.ini b/src/sonic-config-engine/platform/Force10-Z9100/port_config.ini deleted file mode 100644 index e000f29bef38..000000000000 --- a/src/sonic-config-engine/platform/Force10-Z9100/port_config.ini +++ /dev/null @@ -1,33 +0,0 @@ -# name lanes alias -Ethernet0 49,50,51,52 hundredGigE1/1 -Ethernet4 53,54,55,56 hundredGigE1/2 -Ethernet8 57,58,59,60 hundredGigE1/3 -Ethernet12 61,62,63,64 hundredGigE1/4 -Ethernet16 65,66,67,68 hundredGigE1/5 -Ethernet20 69,70,71,72 hundredGigE1/6 -Ethernet24 73,74,75,76 hundredGigE1/7 -Ethernet28 77,78,79,80 hundredGigE1/8 -Ethernet32 37,38,39,40 hundredGigE1/9 -Ethernet36 33,34,35,36 hundredGigE1/10 -Ethernet40 45,46,47,48 hundredGigE1/11 -Ethernet44 41,42,43,44 hundredGigE1/12 -Ethernet48 81,82,83,84 hundredGigE1/13 -Ethernet52 85,86,87,88 hundredGigE1/14 -Ethernet56 89,90,91,92 hundredGigE1/15 -Ethernet60 93,94,95,96 hundredGigE1/16 -Ethernet64 97,98,99,100 hundredGigE1/17 -Ethernet68 101,102,103,104 hundredGigE1/18 -Ethernet72 105,106,107,108 hundredGigE1/19 -Ethernet76 109,110,111,112 hundredGigE1/20 -Ethernet80 21,22,23,24 hundredGigE1/21 -Ethernet84 17,18,19,20 hundredGigE1/22 -Ethernet88 29,30,31,32 hundredGigE1/23 -Ethernet92 25,26,27,28 hundredGigE1/24 -Ethernet96 117,118,119,120 hundredGigE1/25 -Ethernet100 113,114,115,116 hundredGigE1/26 -Ethernet104 125,126,127,128 hundredGigE1/27 -Ethernet108 121,122,123,124 hundredGigE1/28 -Ethernet112 5,6,7,8 hundredGigE1/29 -Ethernet116 1,2,3,4 hundredGigE1/30 -Ethernet120 13,14,15,16 hundredGigE1/31 -Ethernet124 9,10,11,12 hundredGigE1/32 diff --git a/src/sonic-config-engine/platform/INGRASYS-S9100-C32/port_config.ini b/src/sonic-config-engine/platform/INGRASYS-S9100-C32/port_config.ini deleted file mode 100644 index d2b36ebf5e2a..000000000000 --- a/src/sonic-config-engine/platform/INGRASYS-S9100-C32/port_config.ini +++ /dev/null @@ -1,33 +0,0 @@ -# name lanes alias -Ethernet0 5,6,7,8 Ethernet0 -Ethernet4 1,2,3,4 Ethernet4 -Ethernet8 13,14,15,16 Ethernet8 -Ethernet12 9,10,11,12 Ethernet12 -Ethernet16 21,22,23,24 Ethernet16 -Ethernet20 17,18,19,20 Ethernet20 -Ethernet24 29,30,31,32 Ethernet24 -Ethernet28 25,26,27,28 Ethernet28 -Ethernet32 37,38,39,40 Ethernet32 -Ethernet36 33,34,35,36 Ethernet36 -Ethernet40 45,46,47,48 Ethernet40 -Ethernet44 41,42,43,44 Ethernet44 -Ethernet48 53,54,55,56 Ethernet48 -Ethernet52 49,50,51,52 Ethernet52 -Ethernet56 61,62,63,64 Ethernet56 -Ethernet60 57,58,59,60 Ethernet60 -Ethernet64 69,70,71,72 Ethernet64 -Ethernet68 65,66,67,68 Ethernet68 -Ethernet72 77,78,79,80 Ethernet72 -Ethernet76 73,74,75,76 Ethernet76 -Ethernet80 85,86,87,88 Ethernet80 -Ethernet84 81,82,83,84 Ethernet84 -Ethernet88 93,94,95,96 Ethernet88 -Ethernet92 89,90,91,92 Ethernet92 -Ethernet96 101,102,103,104 Ethernet96 -Ethernet100 97,98,99,100 Ethernet100 -Ethernet104 109,110,111,112 Ethernet104 -Ethernet108 105,106,107,108 Ethernet108 -Ethernet112 117,118,119,120 Ethernet112 -Ethernet116 113,114,115,116 Ethernet116 -Ethernet120 125,126,127,128 Ethernet120 -Ethernet124 121,122,123,124 Ethernet124 diff --git a/src/sonic-config-engine/platform/INGRASYS-S9100-C32/sensors.conf b/src/sonic-config-engine/platform/INGRASYS-S9100-C32/sensors.conf deleted file mode 100644 index 44eedb4b11b0..000000000000 --- a/src/sonic-config-engine/platform/INGRASYS-S9100-C32/sensors.conf +++ /dev/null @@ -1,35 +0,0 @@ -# libsensors configuration file -chip "i350bb-*" - ignore loc1 - -chip "jc42-*" - label temp1 "DIMM Temp" - set temp1_max 50 - set temp1_crit 85 - -chip "w83795adg-*" - label in0 "1.0V" - label in1 "1.0V_ROV" - label in2 "1.25V" - label in3 "1.8V" - ignore in4 - ignore in5 - ignore in6 - ignore in7 - label in12 "+3.3V" - ignore in14 - ignore in15 - ignore in16 - label fan1 "FANTRAY 1-A" - label fan2 "FANTRAY 1-B" - label fan3 "FANTRAY 2-A" - label fan4 "FANTRAY 2-B" - label fan5 "FANTRAY 3-A" - label fan6 "FANTRAY 3-B" - label fan7 "FANTRAY 4-A" - label fan8 "FANTRAY 4-B" - label temp1 "Front MAC Temp" - label temp2 "Rear MAC Temp" - ignore temp3 - ignore temp4 - ignore intrusion0 diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 5a0a144cb35d..b9e6ace7cccf 100755 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -4,18 +4,6 @@ import os.path import unittest -def get_platform_file_list(): - data_files = [] - repo_path = os.path.abspath(os.path.dirname(__file__)) - data_path = os.path.join(repo_path, 'platform') - platforms = os.listdir(data_path) - for platform in platforms: - files = ['platform/' + platform + '/port_config.ini'] - if os.path.isfile( os.path.join(data_path, platform, 'sensors.conf') ): - files.append('platform/' + platform + '/sensors.conf') #Not all platforms need to have a sensors.conf file - data_files.append( (os.path.join('/usr/share/sonic', platform), files) ) - return data_files - def get_test_suite(): test_loader = unittest.TestLoader() test_suite = test_loader.discover('tests', pattern='*.py') @@ -29,7 +17,6 @@ def get_test_suite(): url='https://github.com/Azure/sonic-buildimage', py_modules=['minigraph', 'openconfig_acl'], scripts=['sonic-cfggen', 'translate_acl'], - data_files=get_platform_file_list(), install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind'], test_suite='setup.get_test_suite', ) From 6308420db913b10b8ca9eb977c4869b83cb9f180 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 24 Mar 2017 16:29:23 -0700 Subject: [PATCH 0391/1833] [swss]: Enforce swss dependency with opennsl-modules (#434) - This change ensures that when shuting down, opennsl-modules will not stop until swss stops. Otherwise it will cause kernel stack trace. Signed-off-by: Shuotian Cheng --- files/build_templates/swss.service.j2 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 7466e8c14577..87db5eb3b652 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -1,7 +1,13 @@ [Unit] Description=switch state service Requires=database.service +{% if sonic_asic_platform == 'broadcom' %} +Requires=opennsl-modules-3.16.0-4-amd64.service +{% endif %} After=database.service +{% if sonic_asic_platform == 'broadcom' %} +After=opennsl-modules-3.16.0-4-amd64.service +{% endif %} [Service] User=root @@ -36,6 +42,5 @@ ExecStopPost=/etc/init.d/xpnet.sh stop ExecStopPost=/etc/init.d/xpnet.sh start {% endif %} - [Install] WantedBy=multi-user.target From 9e8df96ca76acb1b56e87782b51135ddd0e18ce1 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 24 Mar 2017 18:12:44 -0700 Subject: [PATCH 0392/1833] [interface-config] Fix a loopback addr config bug (#437) Fix a bug introduced in PR 430 that addresses on lo are not configured correctly. --- files/image_config/interfaces/interfaces-config.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index e26060197619..3e2f852c1263 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -2,3 +2,4 @@ sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces service networking restart +ifdown lo && ifup lo From 5314230980f16ea865882dce746ce0d214e034df Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 24 Mar 2017 18:36:56 -0700 Subject: [PATCH 0393/1833] [docker-syncd-%-rpc]: Integrate syncd dockers with rpc (#431) * Build docker-syncd-*-rpc for brcm and mlnx * Fix errors * Update make files for rpc * Fix mistypes --- .gitignore | 4 +++- platform/broadcom/docker-syncd-brcm-rpc.mk | 8 ++++++++ .../docker-syncd-brcm-rpc/Dockerfile.j2 | 17 +++++++++++++---- .../docker-syncd-brcm-rpc/ptf_nn_agent.conf | 0 .../docker-syncd-brcm-rpc/supervisord.conf | 0 platform/broadcom/rules.mk | 4 +++- platform/mellanox/docker-syncd-mlnx-rpc.mk | 8 ++++++++ .../docker-syncd-mlnx-rpc/Dockerfile.j2 | 17 +++++++++++++---- .../docker-syncd-mlnx-rpc/ptf_nn_agent.conf | 0 .../docker-syncd-mlnx-rpc/supervisord.conf | 0 platform/mellanox/rules.mk | 4 +++- 11 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 platform/broadcom/docker-syncd-brcm-rpc.mk rename dockers/docker-syncd-brcm-rpc/Dockerfile => platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 (81%) rename {dockers => platform/broadcom}/docker-syncd-brcm-rpc/ptf_nn_agent.conf (100%) rename {dockers => platform/broadcom}/docker-syncd-brcm-rpc/supervisord.conf (100%) create mode 100644 platform/mellanox/docker-syncd-mlnx-rpc.mk rename dockers/docker-syncd-mlnx-rpc/Dockerfile => platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 (81%) rename {dockers => platform/mellanox}/docker-syncd-mlnx-rpc/ptf_nn_agent.conf (100%) rename {dockers => platform/mellanox}/docker-syncd-mlnx-rpc/supervisord.conf (100%) diff --git a/.gitignore b/.gitignore index ffcc741d83ef..81a7535baec7 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,6 @@ dockers/docker-team/Dockerfile dockers/docker-teamd/Dockerfile dockers/docker-config-engine/Dockerfile dockers/docker-base/Dockerfile -platform/broadcom/docker-syncd-brcm/Dockerfile +platform/*/docker-syncd-*/Dockerfile +platform/*/docker-syncd-*-rpc/Dockerfile + diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk new file mode 100644 index 000000000000..2fbca8f30978 --- /dev/null +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -0,0 +1,8 @@ +# docker image for brcm syncd with rpc + +DOCKER_SYNCD_BRCM_RPC = docker-syncd-brcm-rpc.gz +$(DOCKER_SYNCD_BRCM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-brcm-rpc +$(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD) $(LIBTHRIFT) +$(DOCKER_SYNCD_BRCM_RPC)_FILES += $(DSSERVE) $(BCMCMD) +$(DOCKER_SYNCD_BRCM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BRCM) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) diff --git a/dockers/docker-syncd-brcm-rpc/Dockerfile b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 similarity index 81% rename from dockers/docker-syncd-brcm-rpc/Dockerfile rename to platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 index 23f5e7a25f6a..912f52cf73a7 100644 --- a/dockers/docker-syncd-brcm-rpc/Dockerfile +++ b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 @@ -3,7 +3,19 @@ FROM docker-syncd-brcm ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -COPY deps /deps +COPY \ +{% for deb in docker_syncd_brcm_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -r syncd + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +dpkg_apt \ +{% for deb in docker_syncd_brcm_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} ## Pre-install the fundamental packages RUN apt-get update \ @@ -34,9 +46,6 @@ RUN apt-get update \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ - && dpkg -r syncd \ - && dpkg_apt /deps/syncd_*.deb \ - && dpkg_apt /deps/libthrift-0.9.3_*.deb \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ && rm -rf /deps diff --git a/dockers/docker-syncd-brcm-rpc/ptf_nn_agent.conf b/platform/broadcom/docker-syncd-brcm-rpc/ptf_nn_agent.conf similarity index 100% rename from dockers/docker-syncd-brcm-rpc/ptf_nn_agent.conf rename to platform/broadcom/docker-syncd-brcm-rpc/ptf_nn_agent.conf diff --git a/dockers/docker-syncd-brcm-rpc/supervisord.conf b/platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf similarity index 100% rename from dockers/docker-syncd-brcm-rpc/supervisord.conf rename to platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 37e18ba80285..79d01b02f7eb 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -6,6 +6,7 @@ include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-ingrasys-s9100.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk +include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/one-aboot.mk @@ -18,7 +19,8 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ - $(DOCKER_FPM_GOBGP) + $(DOCKER_FPM_GOBGP) \ + $(DOCKER_SYNCD_BRCM_RPC) # Inject brcm sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk new file mode 100644 index 000000000000..7aab3c802327 --- /dev/null +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -0,0 +1,8 @@ +# docker image for mlnx syncd with rpc + +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) $(LIBTHRIFT) +$(DOCKER_SYNCD_MLNX_RPC)_FILES += $(MLNX_FW) +$(DOCKER_SYNCD_MLNX_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MLNX) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) diff --git a/dockers/docker-syncd-mlnx-rpc/Dockerfile b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 similarity index 81% rename from dockers/docker-syncd-mlnx-rpc/Dockerfile rename to platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 42e24be7ecb5..15c998385abc 100644 --- a/dockers/docker-syncd-mlnx-rpc/Dockerfile +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -3,7 +3,19 @@ FROM docker-syncd-mlnx ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -COPY deps /deps +COPY \ +{% for deb in docker_syncd_mlnx_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -r syncd + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +dpkg_apt \ +{% for deb in docker_syncd_mlnx_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} ## Pre-install the fundamental packages RUN apt-get update \ @@ -34,9 +46,6 @@ RUN apt-get update \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ - && dpkg -r syncd \ - && dpkg_apt /deps/syncd_*.deb \ - && dpkg_apt /deps/libthrift-0.9.3_*.deb \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ && rm -rf /deps diff --git a/dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf b/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf similarity index 100% rename from dockers/docker-syncd-mlnx-rpc/ptf_nn_agent.conf rename to platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf diff --git a/dockers/docker-syncd-mlnx-rpc/supervisord.conf b/platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf similarity index 100% rename from dockers/docker-syncd-mlnx-rpc/supervisord.conf rename to platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 8bcb8d0278b4..5a57e57fbc4e 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -4,11 +4,13 @@ include $(PLATFORM_PATH)/mft.mk include $(PLATFORM_PATH)/mlnx-sai.mk include $(PLATFORM_PATH)/hw-management.mk include $(PLATFORM_PATH)/docker-syncd-mlnx.mk +include $(PLATFORM_PATH)/docker-syncd-mlnx-rpc.mk include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk include $(PLATFORM_PATH)/one-image.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ - $(DOCKER_FPM_GOBGP) + $(DOCKER_FPM_GOBGP) \ + $(DOCKER_SYNCD_MLNX_RPC) # Inject mlnx sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) From 713f6fc3183340e648dd576756dac2779212928f Mon Sep 17 00:00:00 2001 From: Nadiya Date: Tue, 28 Mar 2017 00:22:04 +0300 Subject: [PATCH 0394/1833] [sonic-cfggen] Add check to generate valid bgpconfig (#440) * [sonic-cfggen]Add check to generate valid bgpconfig Signed-off-by: Nadiya.Stetskovych * Use builtin none instead of None Signed-off-by: Nadiya.Stetskovych --- dockers/docker-fpm/bgpd.conf.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dockers/docker-fpm/bgpd.conf.j2 b/dockers/docker-fpm/bgpd.conf.j2 index ed9afe0c3388..5f4bb25e0010 100644 --- a/dockers/docker-fpm/bgpd.conf.j2 +++ b/dockers/docker-fpm/bgpd.conf.j2 @@ -14,6 +14,7 @@ log facility local4 ! enable password {# {{ en_passwd }} TODO: param needed #} {% endblock system_init %} ! +{% if minigraph_bgp_asn is not none %} {% block bgp_init %} ! ! bgp multiple-instance @@ -34,6 +35,7 @@ router bgp {{ minigraph_bgp_asn }} {% endif %} {% endfor %} {% endblock bgp_init %} +{% endif %} {% block vlan_advertisement %} {% for vlan_interface in minigraph_vlan_interfaces %} network {{ vlan_interface['subnet'] }} @@ -57,8 +59,10 @@ router bgp {{ minigraph_bgp_asn }} {% endfor %} {% endblock bgp_sessions %} ! +{% if minigraph_bgp_asn is not none %} maximum-paths 64 ! route-map ISOLATE permit 10 set as-path prepend {{ minigraph_bgp_asn }} +{% endif %} ! From 8caa4cccd90167d1450d7d97b4097531c01b753a Mon Sep 17 00:00:00 2001 From: krambn Date: Mon, 27 Mar 2017 15:23:43 -0700 Subject: [PATCH 0395/1833] [p4]: Update p4-switch submodule (#444) - Increase P4 IPV4_LPM_TABLE_SIZE and IPV4_HOST_TABLE_SIZE --- platform/p4/p4-switch/switch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/p4/p4-switch/switch b/platform/p4/p4-switch/switch index 584571b17dda..e934752f356d 160000 --- a/platform/p4/p4-switch/switch +++ b/platform/p4/p4-switch/switch @@ -1 +1 @@ -Subproject commit 584571b17ddafcaa45a3d46eacc403b7e18cac1b +Subproject commit e934752f356d3ad48cbec99067f47c83795ddcec From fcaba688f764ba5783e736b45a0d77dd60211fbd Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 27 Mar 2017 15:27:20 -0700 Subject: [PATCH 0396/1833] [database]: Fix ENTRYPOINT for docker-database to ensure redis-server starts as PID 1 (#442) --- dockers/docker-database/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index af77177c58d0..59f90a897a9f 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -30,4 +30,4 @@ RUN sed -ri 's/^daemonize yes$/daemonize no/; s/^# unixsocket/unixsocket/ \ ' /etc/redis/redis.conf -ENTRYPOINT service redis-server start +ENTRYPOINT ["/usr/bin/redis-server", "/etc/redis/redis.conf"] From 70cc4994ef8a8cd9fc03b5b04357f368762e3965 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 27 Mar 2017 16:38:18 -0700 Subject: [PATCH 0397/1833] Fix qos configuration for TD2 platform (#439) --- dockers/docker-orchagent/start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 6e05782b3d75..c18f2733789e 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -35,14 +35,14 @@ SWSSCONFIG_ARGS="00-copp.config.json " if [ "$HWSKU" == "Force10-S6000" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - SWSSCONFIG_ARGS+="td2.32ports.qos.json td2.32ports.buffers.json " + SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "Force10-S6100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Force10-Z9100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Arista-7050-QX32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - SWSSCONFIG_ARGS+="td2.32ports.qos.json td2.32ports.buffers.json " + SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "AS7512" ]; then From 91615c0241657dc74379d7a444167436859d2880 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Tue, 28 Mar 2017 21:27:07 +0300 Subject: [PATCH 0398/1833] [sonic-sairedis]: Update sonic-sairedis module. (#449) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 383ed119845a..81c19878217c 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 383ed119845ad726788c4198aa05e3e31c20c78f +Subproject commit 81c19878217c26d71b64e93dbdbf777faa1d3cfa From 75272f4bbfd6cabd68613747fa598c2df0044344 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 28 Mar 2017 11:32:58 -0700 Subject: [PATCH 0399/1833] [libsaithrift]: Add libsaithrift debian packages (#443) * add saithrift library for brcm, mlnx, cavm, centec platforms --- .gitmodules | 5 +++++ platform/broadcom/libsaithrift-dev.mk | 7 +++++++ platform/broadcom/python-saithrift.mk | 6 ++++++ platform/broadcom/rules.mk | 2 ++ platform/cavium/libsaithrift-dev.mk | 7 +++++++ platform/cavium/python-saithrift.mk | 6 ++++++ platform/cavium/rules.mk | 2 ++ platform/centec/libsaithrift-dev.mk | 7 +++++++ platform/centec/python-saithrift.mk | 6 ++++++ platform/centec/rules.mk | 2 ++ platform/mellanox/libsaithrift-dev.mk | 7 +++++++ platform/mellanox/python-saithrift.mk | 6 ++++++ platform/mellanox/rules.mk | 2 ++ src/SAI | 1 + 14 files changed, 66 insertions(+) create mode 100644 platform/broadcom/libsaithrift-dev.mk create mode 100644 platform/broadcom/python-saithrift.mk create mode 100644 platform/cavium/libsaithrift-dev.mk create mode 100644 platform/cavium/python-saithrift.mk create mode 100644 platform/centec/libsaithrift-dev.mk create mode 100644 platform/centec/python-saithrift.mk create mode 100644 platform/mellanox/libsaithrift-dev.mk create mode 100644 platform/mellanox/python-saithrift.mk create mode 160000 src/SAI diff --git a/.gitmodules b/.gitmodules index c8fb78edcdff..131b4634b514 100644 --- a/.gitmodules +++ b/.gitmodules @@ -56,3 +56,8 @@ [submodule "platform/broadcom/sonic-platform-modules-ingrasys-s9100"] path = platform/broadcom/sonic-platform-modules-ingrasys-s9100 url = https://github.com/Ingrasys-sonic/sonic-platform-ingrasys-s9100 +[submodule "src/SAI"] + path = src/SAI + url = https://github.com/opencomputeproject/SAI + branch = v0.9.4 + diff --git a/platform/broadcom/libsaithrift-dev.mk b/platform/broadcom/libsaithrift-dev.mk new file mode 100644 index 000000000000..c809539b47fe --- /dev/null +++ b/platform/broadcom/libsaithrift-dev.mk @@ -0,0 +1,7 @@ +# libsaithrift-dev package + +LIBSAITHRIFT_DEV_BRCM = libsaithrift-dev_0.9.4_amd64.deb +$(LIBSAITHRIFT_DEV_BRCM)_SRC_PATH = $(SRC_PATH)/SAI +$(LIBSAITHRIFT_DEV_BRCM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(BRCM_SAI) $(BRCM_SAI_DEV) +$(LIBSAITHRIFT_DEV_BRCM)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_BRCM) diff --git a/platform/broadcom/python-saithrift.mk b/platform/broadcom/python-saithrift.mk new file mode 100644 index 000000000000..f9da4143c7d9 --- /dev/null +++ b/platform/broadcom/python-saithrift.mk @@ -0,0 +1,6 @@ +# python-saithrift package + +PYTHON_SAITHRIFT_BRCM = python-saithrift_0.9.4_amd64.deb +$(PYTHON_SAITHRIFT_BRCM)_SRC_PATH = $(SRC_PATH)/SAI +$(PYTHON_SAITHRIFT_BRCM)_DEPENDS += $(BRCM_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) +SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_BRCM) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 79d01b02f7eb..aaf5f5dc5fbc 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -9,6 +9,8 @@ include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/one-aboot.mk +include $(PLATFORM_PATH)/libsaithrift-dev.mk +include $(PLATFORM_PATH)/python-saithrift.mk BCMCMD = bcmcmd $(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmcmd?sv=2015-04-05&sr=b&sig=X3bFApmsNFmcnWM9mSGRxBugPcg%2FgJCHh5hhSuV1M2c%3D&se=2030-08-23T14%3A41%3A56Z&sp=r" diff --git a/platform/cavium/libsaithrift-dev.mk b/platform/cavium/libsaithrift-dev.mk new file mode 100644 index 000000000000..4a19fabffaf2 --- /dev/null +++ b/platform/cavium/libsaithrift-dev.mk @@ -0,0 +1,7 @@ +# libsaithrift-dev package + +LIBSAITHRIFT_DEV_CAVM = libsaithrift-dev_0.9.4_amd64.deb +$(LIBSAITHRIFT_DEV_CAVM)_SRC_PATH = $(SRC_PATH)/SAI +$(LIBSAITHRIFT_DEV_CAVM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(CAVM_LIBSAI) $(CAVM_SAI) +$(LIBSAITHRIFT_DEV_CAVM)_RDEPENDS += $(LIBTHRIFT) $(CAVM_SAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_CAVM) diff --git a/platform/cavium/python-saithrift.mk b/platform/cavium/python-saithrift.mk new file mode 100644 index 000000000000..91d00ebaebc0 --- /dev/null +++ b/platform/cavium/python-saithrift.mk @@ -0,0 +1,6 @@ +# python-saithrift package + +PYTHON_SAITHRIFT_CAVM = python-saithrift_0.9.4_amd64.deb +$(PYTHON_SAITHRIFT_CAVM)_SRC_PATH = $(SRC_PATH)/SAI +$(PYTHON_SAITHRIFT_CAVM)_DEPENDS += $(CAVM_LIBSAI) $(CAVM_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) +SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_CAVM) diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 05312066719f..f72989c241b8 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -3,6 +3,8 @@ include $(PLATFORM_PATH)/docker-syncd-cavm.mk include $(PLATFORM_PATH)/docker-orchagent-cavm.mk include $(PLATFORM_PATH)/cavm_platform_modules.mk include $(PLATFORM_PATH)/one-image.mk +include $(PLATFORM_PATH)/libsaithrift-dev.mk +include $(PLATFORM_PATH)/python-saithrift.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM_GOBGP) diff --git a/platform/centec/libsaithrift-dev.mk b/platform/centec/libsaithrift-dev.mk new file mode 100644 index 000000000000..b8fddbdf7731 --- /dev/null +++ b/platform/centec/libsaithrift-dev.mk @@ -0,0 +1,7 @@ +# libsaithrift-dev package + +LIBSAITHRIFT_DEV_CENTEC = libsaithrift-dev_0.9.4_amd64.deb +$(LIBSAITHRIFT_DEV_CENTEC)_SRC_PATH = $(SRC_PATH)/SAI +$(LIBSAITHRIFT_DEV_CENTEC)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(CENTEC_SAI) +$(LIBSAITHRIFT_DEV_CENTEC)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_CENTEC) diff --git a/platform/centec/python-saithrift.mk b/platform/centec/python-saithrift.mk new file mode 100644 index 000000000000..37d1e935c041 --- /dev/null +++ b/platform/centec/python-saithrift.mk @@ -0,0 +1,6 @@ +# python-saithrift package + +PYTHON_SAITHRIFT_CENTEC = python-saithrift_0.9.4_amd64.deb +$(PYTHON_SAITHRIFT_CENTEC)_SRC_PATH = $(SRC_PATH)/SAI +$(PYTHON_SAITHRIFT_CENTEC)_DEPENDS += $(CENTEC_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) +SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_CENTEC) diff --git a/platform/centec/rules.mk b/platform/centec/rules.mk index d8c3568f0cc0..9e53996c0a36 100644 --- a/platform/centec/rules.mk +++ b/platform/centec/rules.mk @@ -3,6 +3,8 @@ include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/docker-orchagent-centec.mk include $(PLATFORM_PATH)/docker-syncd-centec.mk include $(PLATFORM_PATH)/one-image.mk +include $(PLATFORM_PATH)/libsaithrift-dev.mk +include $(PLATFORM_PATH)/python-saithrift.mk SONIC_ALL += $(SONIC_ONE_IMAGE) diff --git a/platform/mellanox/libsaithrift-dev.mk b/platform/mellanox/libsaithrift-dev.mk new file mode 100644 index 000000000000..0fc6d3f4eb84 --- /dev/null +++ b/platform/mellanox/libsaithrift-dev.mk @@ -0,0 +1,7 @@ +# libsaithrift-dev package + +LIBSAITHRIFT_DEV_MLNX = libsaithrift-dev_0.9.4_amd64.deb +$(LIBSAITHRIFT_DEV_MLNX)_SRC_PATH = $(SRC_PATH)/SAI +$(LIBSAITHRIFT_DEV_MLNX)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(MLNX_SAI) $(MLNX_SAI_DEV) +$(LIBSAITHRIFT_DEV_MLNX)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MLNX) diff --git a/platform/mellanox/python-saithrift.mk b/platform/mellanox/python-saithrift.mk new file mode 100644 index 000000000000..cbe5af29b3e2 --- /dev/null +++ b/platform/mellanox/python-saithrift.mk @@ -0,0 +1,6 @@ +# python-saithrift package + +PYTHON_SAITHRIFT_MLNX = python-saithrift_0.9.4_amd64.deb +$(PYTHON_SAITHRIFT_MLNX)_SRC_PATH = $(SRC_PATH)/SAI +$(PYTHON_SAITHRIFT_MLNX)_DEPENDS += $(MLNX_SAI_DEV) $(MLNX_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) +SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MLNX) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 5a57e57fbc4e..f0e8d4fcdb07 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -7,6 +7,8 @@ include $(PLATFORM_PATH)/docker-syncd-mlnx.mk include $(PLATFORM_PATH)/docker-syncd-mlnx-rpc.mk include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk include $(PLATFORM_PATH)/one-image.mk +include $(PLATFORM_PATH)/libsaithrift-dev.mk +include $(PLATFORM_PATH)/python-saithrift.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM_GOBGP) \ diff --git a/src/SAI b/src/SAI new file mode 160000 index 000000000000..20f7dffba5dc --- /dev/null +++ b/src/SAI @@ -0,0 +1 @@ +Subproject commit 20f7dffba5dcb0922a4af6e945804b821a3772c1 From 7a2a37491728de349113c80a3079919f7eaddaef Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 28 Mar 2017 15:48:29 -0700 Subject: [PATCH 0400/1833] [docker-snmp]: Disable snmpd IP module and use snmp subagent implementation (#447) * Disable snmpd ip module, will use snmp subagent implementation * Update git submodule --- dockers/docker-snmp-sv2/supervisord.conf | 2 +- src/sonic-snmpagent | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index eed4bf83cb0e..cf5990ec31e8 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -2,7 +2,7 @@ nodaemon=true [program:snmpd] -command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable -p /run/snmpd.pid +command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ip -p /run/snmpd.pid priority=100 [program:snmp-subagent] diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index c1b22019810c..c0e022addaaa 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit c1b22019810c0c6bf3516f5def320e1c84ca7e12 +Subproject commit c0e022addaaa0af857331d36e3766a88a2095941 From 27dae9072620b4abbcc832a54c9a126bd8b410f5 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 28 Mar 2017 15:49:48 -0700 Subject: [PATCH 0401/1833] [docker-teamd]: Clean /etc/teamd/ folder before adding new configurations (#451) Signed-off-by: Shuotian Cheng --- dockers/docker-teamd/config.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dockers/docker-teamd/config.sh b/dockers/docker-teamd/config.sh index c08a580b80d2..9351966f233f 100755 --- a/dockers/docker-teamd/config.sh +++ b/dockers/docker-teamd/config.sh @@ -1,6 +1,7 @@ #!/bin/bash mkdir -p /etc/teamd +rm -f /etc/teamd/* for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannels.keys() | join(' ')"`; do sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /usr/share/sonic/templates/teamd.j2 >/etc/teamd/$pc.conf From 423a1acac1b509da2ff14c50048092f733bc623a Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 29 Mar 2017 04:17:49 -0700 Subject: [PATCH 0402/1833] [installer]: Move platform-specific files under new device/ tree (#450) * Move platform-specific ONIE installer config files with rest of device-specific files * Merge contents of dell-s6000-replace-reboot.sh into s6000 installer conf file * Remove dell-s6000-replace-reboot.sh --- .gitignore | 3 ++- build_image.sh | 12 ++++++++++++ .../x86_64-accton_as7512_32x-r0/installer.conf | 0 .../x86_64-centec_e582_48x6q-r0/installer.conf | 0 .../dell/x86_64-dell_s6000_s1220-r0/installer.conf | 2 +- .../dell/x86_64-dell_s6100_c2538-r0/installer.conf | 0 .../dell/x86_64-dell_z9100_c2538-r0/installer.conf | 0 .../x86_64-ew_es6220_x48q2h4-r0/installer.conf | 0 .../x86_64-facebook_wedge100-r0/installer.conf | 0 .../ingrasys/x86_64-ingrasys_s9100-r0/installer.conf | 0 .../mellanox/x86_64-mlnx_msn2700-r0/installer.conf | 0 .../x86_64-mlnx_x86-r5.0.1400/installer.conf | 0 .../x86_64/platforms/x86_64-dell_s6000_s1220-r0 | 2 -- 13 files changed, 15 insertions(+), 4 deletions(-) rename installer/x86_64/platforms/x86_64-accton_as7512_32x-r0 => device/accton/x86_64-accton_as7512_32x-r0/installer.conf (100%) rename installer/x86_64/platforms/x86_64-centec_e582_48x6q-r0 => device/centec/x86_64-centec_e582_48x6q-r0/installer.conf (100%) rename installer/x86_64/dell-s6000-replace-reboot.sh => device/dell/x86_64-dell_s6000_s1220-r0/installer.conf (87%) mode change 100755 => 100644 rename installer/x86_64/platforms/x86_64-dell_s6100_c2538-r0 => device/dell/x86_64-dell_s6100_c2538-r0/installer.conf (100%) rename installer/x86_64/platforms/x86_64-dell_z9100_c2538-r0 => device/dell/x86_64-dell_z9100_c2538-r0/installer.conf (100%) rename installer/x86_64/platforms/x86_64-ew_es6220_x48q2h4-r0 => device/embedway/x86_64-ew_es6220_x48q2h4-r0/installer.conf (100%) rename installer/x86_64/platforms/x86_64-facebook_wedge100-r0 => device/facebook/x86_64-facebook_wedge100-r0/installer.conf (100%) rename installer/x86_64/platforms/x86_64-ingrasys_s9100-r0 => device/ingrasys/x86_64-ingrasys_s9100-r0/installer.conf (100%) rename installer/x86_64/platforms/x86_64-mlnx_msn2700-r0 => device/mellanox/x86_64-mlnx_msn2700-r0/installer.conf (100%) rename installer/x86_64/platforms/x86_64-mlnx_x86-r5.0.1400 => device/mellanox/x86_64-mlnx_x86-r5.0.1400/installer.conf (100%) delete mode 100644 installer/x86_64/platforms/x86_64-dell_s6000_s1220-r0 diff --git a/.gitignore b/.gitignore index 81a7535baec7..00f97edcec97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # Build system related .platform -.sku # Build artifacts fsroot/ @@ -39,3 +38,5 @@ dockers/docker-base/Dockerfile platform/*/docker-syncd-*/Dockerfile platform/*/docker-syncd-*-rpc/Dockerfile +# Installer-related files and directories +installer/x86_64/platforms/ diff --git a/build_image.sh b/build_image.sh index ab2e85b4836d..2da70ad57cf9 100755 --- a/build_image.sh +++ b/build_image.sh @@ -27,6 +27,18 @@ if [ "$IMAGE_TYPE" = "onie" ]; then echo "Build ONIE installer" mkdir -p `dirname $OUTPUT_ONIE_IMAGE` sudo rm -f $OUTPUT_ONIE_IMAGE + + # Copy platform-specific ONIE installer config files where onie-mk-demo.sh expects them + rm -rf ./installer/x86_64/platforms/ + mkdir -p ./installer/x86_64/platforms/ + for VENDOR in `ls ./device`; do + for PLATFORM in `ls ./device/$VENDOR`; do + if [ -f ./device/$VENDOR/$PLATFORM/installer.conf ]; then + cp ./device/$VENDOR/$PLATFORM/installer.conf ./installer/x86_64/platforms/$PLATFORM + fi + done + done + ## Generate an ONIE installer image ## Note: Don't leave blank between lines. It is single line command. ./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \ diff --git a/installer/x86_64/platforms/x86_64-accton_as7512_32x-r0 b/device/accton/x86_64-accton_as7512_32x-r0/installer.conf similarity index 100% rename from installer/x86_64/platforms/x86_64-accton_as7512_32x-r0 rename to device/accton/x86_64-accton_as7512_32x-r0/installer.conf diff --git a/installer/x86_64/platforms/x86_64-centec_e582_48x6q-r0 b/device/centec/x86_64-centec_e582_48x6q-r0/installer.conf similarity index 100% rename from installer/x86_64/platforms/x86_64-centec_e582_48x6q-r0 rename to device/centec/x86_64-centec_e582_48x6q-r0/installer.conf diff --git a/installer/x86_64/dell-s6000-replace-reboot.sh b/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf old mode 100755 new mode 100644 similarity index 87% rename from installer/x86_64/dell-s6000-replace-reboot.sh rename to device/dell/x86_64-dell_s6000_s1220-r0/installer.conf index 5854133cc4a4..eb135bee0ff1 --- a/installer/x86_64/dell-s6000-replace-reboot.sh +++ b/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf @@ -1,4 +1,4 @@ -#!/bin/sh +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="processor.max_cstate=1 intel_idle.max_cstate=0" echo "Replace ONIE reboot with Dell reset commands" diff --git a/installer/x86_64/platforms/x86_64-dell_s6100_c2538-r0 b/device/dell/x86_64-dell_s6100_c2538-r0/installer.conf similarity index 100% rename from installer/x86_64/platforms/x86_64-dell_s6100_c2538-r0 rename to device/dell/x86_64-dell_s6100_c2538-r0/installer.conf diff --git a/installer/x86_64/platforms/x86_64-dell_z9100_c2538-r0 b/device/dell/x86_64-dell_z9100_c2538-r0/installer.conf similarity index 100% rename from installer/x86_64/platforms/x86_64-dell_z9100_c2538-r0 rename to device/dell/x86_64-dell_z9100_c2538-r0/installer.conf diff --git a/installer/x86_64/platforms/x86_64-ew_es6220_x48q2h4-r0 b/device/embedway/x86_64-ew_es6220_x48q2h4-r0/installer.conf similarity index 100% rename from installer/x86_64/platforms/x86_64-ew_es6220_x48q2h4-r0 rename to device/embedway/x86_64-ew_es6220_x48q2h4-r0/installer.conf diff --git a/installer/x86_64/platforms/x86_64-facebook_wedge100-r0 b/device/facebook/x86_64-facebook_wedge100-r0/installer.conf similarity index 100% rename from installer/x86_64/platforms/x86_64-facebook_wedge100-r0 rename to device/facebook/x86_64-facebook_wedge100-r0/installer.conf diff --git a/installer/x86_64/platforms/x86_64-ingrasys_s9100-r0 b/device/ingrasys/x86_64-ingrasys_s9100-r0/installer.conf similarity index 100% rename from installer/x86_64/platforms/x86_64-ingrasys_s9100-r0 rename to device/ingrasys/x86_64-ingrasys_s9100-r0/installer.conf diff --git a/installer/x86_64/platforms/x86_64-mlnx_msn2700-r0 b/device/mellanox/x86_64-mlnx_msn2700-r0/installer.conf similarity index 100% rename from installer/x86_64/platforms/x86_64-mlnx_msn2700-r0 rename to device/mellanox/x86_64-mlnx_msn2700-r0/installer.conf diff --git a/installer/x86_64/platforms/x86_64-mlnx_x86-r5.0.1400 b/device/mellanox/x86_64-mlnx_x86-r5.0.1400/installer.conf similarity index 100% rename from installer/x86_64/platforms/x86_64-mlnx_x86-r5.0.1400 rename to device/mellanox/x86_64-mlnx_x86-r5.0.1400/installer.conf diff --git a/installer/x86_64/platforms/x86_64-dell_s6000_s1220-r0 b/installer/x86_64/platforms/x86_64-dell_s6000_s1220-r0 deleted file mode 100644 index f778372ded1e..000000000000 --- a/installer/x86_64/platforms/x86_64-dell_s6000_s1220-r0 +++ /dev/null @@ -1,2 +0,0 @@ -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="processor.max_cstate=1 intel_idle.max_cstate=0" -./dell-s6000-replace-reboot.sh From 4359f137f4efa9685102fe6e6b63d445a3937fb6 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 29 Mar 2017 09:14:47 -0700 Subject: [PATCH 0403/1833] [sonic-utilities]: Update sonic-utilities submodule (#452) Signed-off-by: Shuotian Cheng --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 4da9efed9355..edbda4670027 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 4da9efed9355fad8cdf9b1ca2c0a18dd9445eaba +Subproject commit edbda467002700230f89a7362a21b3d3909b1079 From 4546372f488db8c8760164aa8dff62f4e07c98ee Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 29 Mar 2017 13:33:54 -0700 Subject: [PATCH 0404/1833] [config/acl] Get ACL config from DHCP and load it in swss container (#432) Get ACL config from DHCP and load it in swss container --- dockers/docker-orchagent/start.sh | 13 ++++++++++ files/dhcp/dhclient.conf | 3 ++- files/dhcp/graphserviceurl | 3 +++ files/image_config/updategraph/updategraph | 30 ++++++++++++++++++++++ src/sonic-config-engine/translate_acl | 4 +-- 5 files changed, 50 insertions(+), 3 deletions(-) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index c18f2733789e..d73416ac9b1a 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -12,6 +12,18 @@ function start_app { done } +function config_acl { + if [ -f "/etc/sonic/acl.json" ]; then + mkdir -p /etc/swss/config.d/acl + rm -rf /etc/swss/config.d/acl/* + translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json + for filename in /etc/swss/config.d/acl/*.json; do + [ -e "$filename" ] || break + swssconfig $filename + done + fi +} + function clean_up { pkill -9 orchagent pkill -9 portsyncd @@ -60,6 +72,7 @@ while true; do result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p` if [ "$result" != "0" ]; then start_app + config_acl read fi sleep 1 diff --git a/files/dhcp/dhclient.conf b/files/dhcp/dhclient.conf index ce4ac4d9f445..4a8bb037cd68 100644 --- a/files/dhcp/dhclient.conf +++ b/files/dhcp/dhclient.conf @@ -14,11 +14,12 @@ option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; option snmp-community code 224 = text; option minigraph-url code 225 = text; +option acl-url code 226 = text; send host-name = gethostname(); request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, domain-search, host-name, dhcp6.name-servers, dhcp6.domain-search, netbios-name-servers, netbios-scope, interface-mtu, - rfc3442-classless-static-routes, ntp-servers, snmp-community, minigraph-url; + rfc3442-classless-static-routes, ntp-servers, snmp-community, minigraph-url, acl-url; diff --git a/files/dhcp/graphserviceurl b/files/dhcp/graphserviceurl index 0e8b1b83e141..f255cdff9877 100644 --- a/files/dhcp/graphserviceurl +++ b/files/dhcp/graphserviceurl @@ -5,5 +5,8 @@ case $reason in else echo "N/A" > /tmp/dhcp_graph_url fi + if [ -n "$new_acl_url" ]; then + echo $new_acl_url > /tmp/dhcp_acl_url + fi ;; esac diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 68fbe6eb9c19..0d3b248bc436 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -12,6 +12,8 @@ if [ "$enabled" != "true" ]; then exit 0 fi +ACL_URL=$acl_src + if [ "$src" = "dhcp" ]; then while [ ! -f /tmp/dhcp_graph_url ]; do echo "Waiting for DHCP response..." @@ -38,6 +40,18 @@ if [ "$src" = "dhcp" ]; then sed -i "/src=/d" /etc/sonic/updategraph.conf echo "src=\"$GRAPH_URL\"" >> /etc/sonic/updategraph.conf fi + + if [ -f /tmp/dhcp_acl_url ]; then + ACL_URL=`sonic-cfggen -t /tmp/dhcp_acl_url -a "{\"hostname\": \"$HOSTNAME\"}"` + if [[ ! $ACL_URL =~ $URL_REGEX ]]; then + echo "\"$ACL_URL\" is not a valid url. Skipping acl update." + ACL_URL="" + fi + if [ "$dhcp_as_static" = "true" ]; then + sed -i "/acl_src=/d" /etc/sonic/updategraph.conf + echo "acl_src=\"$ACL_URL\"" >> /etc/sonic/updategraph.conf + fi + fi else GRAPH_URL=$src fi @@ -53,3 +67,19 @@ while true; do curl -f $GRAPH_URL -o /etc/sonic/minigraph.xml --connect-timeout 15 && break sleep 5 done + +if [ -n "$ACL_URL" ]; then + if [ -f /etc/sonic/acl.json ]; then + echo "Renaming acl.json to acl.json.old" + mv /etc/sonic/acl.json /etc/sonic/acl.json.old + fi + echo "Getting ACL config from $ACL_URL" + + while true; do + curl -f $ACL_URL -o /etc/sonic/acl.json --connect-timeout 15 && break + sleep 5 + done +else + echo "Skip ACL config download." +fi + diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl index f706fe1f52e4..2c4410615d6e 100755 --- a/src/sonic-config-engine/translate_acl +++ b/src/sonic-config-engine/translate_acl @@ -129,7 +129,6 @@ def translate_acl_fixed_port(filename, output_path, port, max_priority): def translate_acl(filename, output_path, attach_to, max_priority): yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") - print attach_to.keys() for aclsetname in yang_acl.acl.acl_sets.acl_set: tablename = aclsetname.replace(" ", "_").replace("-", "_") if attach_to.has_key(tablename): @@ -151,7 +150,8 @@ def main(): translate_acl_fixed_port(args.input, args.output_path, args.port, args.max_priority) elif args.minigraph: mini_data = parse_xml(args.minigraph) - translate_acl(args.input, args.output_path, mini_data['minigraph_acls'], args.max_priority) + if mini_data['minigraph_acls']: + translate_acl(args.input, args.output_path, mini_data['minigraph_acls'], args.max_priority) if __name__ == "__main__": main() From 7f703a9c8fda699f6d0b436576630abbd4442c85 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 29 Mar 2017 17:47:21 -0700 Subject: [PATCH 0405/1833] [docker-lldp]: Do not use TTY mode on lldpctl command (#454) Signed-off-by: Shuotian Cheng --- dockers/docker-lldp-sv2/base_image_files/lldpctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-lldp-sv2/base_image_files/lldpctl b/dockers/docker-lldp-sv2/base_image_files/lldpctl index c55e5ce8e2fb..068a6e3b5048 100755 --- a/dockers/docker-lldp-sv2/base_image_files/lldpctl +++ b/dockers/docker-lldp-sv2/base_image_files/lldpctl @@ -1,2 +1,2 @@ #!/bin/bash -docker exec -it lldp lldpctl "$@" +docker exec -i lldp lldpctl "$@" From 814fd87e63c60dd306696a5cb4ec7610b7dcab2d Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 29 Mar 2017 18:07:25 -0700 Subject: [PATCH 0406/1833] Remove /var/run/rsyslogd.pid bofore starting rsyslog (#453) --- dockers/docker-basic_router/Dockerfile | 3 ++- dockers/docker-dhcp-relay/Dockerfile | 1 - dockers/docker-dhcp-relay/start.sh | 3 +++ dockers/docker-fpm-gobgp/start.sh | 1 + dockers/docker-fpm/start.sh | 1 + dockers/docker-lldp-sv2/config.sh | 1 + dockers/docker-orchagent/start.sh | 1 + dockers/docker-platform-monitor/config.sh | 1 + dockers/docker-saiserver-brcm/start.sh | 1 + dockers/docker-saiserver-cavm/start.sh | 1 + dockers/docker-saiserver-mlnx/start.sh | 1 + dockers/docker-snmp-sv2/config.sh | 1 + dockers/docker-teamd/start.sh | 1 + dockers/docker-vas/Dockerfile | 3 ++- platform/broadcom/docker-syncd-brcm/start.sh | 1 + platform/cavium/docker-syncd-cavm/start.sh | 1 + platform/centec/docker-syncd-centec/start.sh | 1 + platform/p4/docker-sonic-p4/startup.sh | 1 + 18 files changed, 21 insertions(+), 3 deletions(-) diff --git a/dockers/docker-basic_router/Dockerfile b/dockers/docker-basic_router/Dockerfile index 8bf1875ab98c..7176fac14b3b 100644 --- a/dockers/docker-basic_router/Dockerfile +++ b/dockers/docker-basic_router/Dockerfile @@ -17,5 +17,6 @@ RUN dpkg -i /deps/libopennsl_*.deb; \ RUN mv /deps/basic_router /usr/sbin/basic_router -ENTRYPOINT service rsyslog start \ +ENTRYPOINT rm -f /var/run/rsyslogd.pid \ + && service rsyslog start \ && /bin/bash diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile index 5c9ee3fb643b..315ea605f3ee 100644 --- a/dockers/docker-dhcp-relay/Dockerfile +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -18,6 +18,5 @@ COPY ["config.sh", "/usr/bin/"] COPY ["start.sh", "/usr/bin/"] ENTRYPOINT /usr/bin/config.sh \ - && service rsyslog start \ && /usr/bin/start.sh \ && /bin/bash diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index 05a7693268dc..ff8a629d98eb 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -1,5 +1,8 @@ #!/bin/bash +rm -f /var/run/rsyslogd.pid +service rsyslog start + VLAN_IFACE_NAME=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_vlan_interfaces[0]['name']"` # Wait for the VLAN to come up (i.e., 'ip link show' returns 0) diff --git a/dockers/docker-fpm-gobgp/start.sh b/dockers/docker-fpm-gobgp/start.sh index 90a1d515fa3a..0aa3f68091a1 100755 --- a/dockers/docker-fpm-gobgp/start.sh +++ b/dockers/docker-fpm-gobgp/start.sh @@ -1,5 +1,6 @@ #!/bin/bash +rm -f /var/run/rsyslogd.pid service rsyslog start service quagga start fpmsyncd & diff --git a/dockers/docker-fpm/start.sh b/dockers/docker-fpm/start.sh index 90a1d515fa3a..0aa3f68091a1 100755 --- a/dockers/docker-fpm/start.sh +++ b/dockers/docker-fpm/start.sh @@ -1,5 +1,6 @@ #!/bin/bash +rm -f /var/run/rsyslogd.pid service rsyslog start service quagga start fpmsyncd & diff --git a/dockers/docker-lldp-sv2/config.sh b/dockers/docker-lldp-sv2/config.sh index 842a10306c4f..1263cb7a5154 100755 --- a/dockers/docker-lldp-sv2/config.sh +++ b/dockers/docker-lldp-sv2/config.sh @@ -5,3 +5,4 @@ sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/lldpd.con mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status +rm -f /var/run/rsyslogd.pid diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index d73416ac9b1a..088d0fe1bcf0 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -65,6 +65,7 @@ elif [ "$HWSKU" == "ACS-MSN2700" ]; then SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " fi +rm -f /var/run/rsyslogd.pid service rsyslog start while true; do diff --git a/dockers/docker-platform-monitor/config.sh b/dockers/docker-platform-monitor/config.sh index 7021f18aacb8..a88bdf594f95 100755 --- a/dockers/docker-platform-monitor/config.sh +++ b/dockers/docker-platform-monitor/config.sh @@ -9,3 +9,4 @@ fi mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status +rm -f /var/run/rsyslogd.pid diff --git a/dockers/docker-saiserver-brcm/start.sh b/dockers/docker-saiserver-brcm/start.sh index 07d03b41a9ba..1d65e4a069e7 100755 --- a/dockers/docker-saiserver-brcm/start.sh +++ b/dockers/docker-saiserver-brcm/start.sh @@ -13,6 +13,7 @@ start_bcm() trap clean_up SIGTERM SIGKILL +rm -f /var/run/rsyslogd.pid service rsyslog start start_bcm diff --git a/dockers/docker-saiserver-cavm/start.sh b/dockers/docker-saiserver-cavm/start.sh index 8d683c0a016a..5c3185613184 100755 --- a/dockers/docker-saiserver-cavm/start.sh +++ b/dockers/docker-saiserver-cavm/start.sh @@ -6,6 +6,7 @@ function clean_up { trap clean_up SIGTERM SIGKILL +rm -f /var/run/rsyslogd.pid service rsyslog start /usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini diff --git a/dockers/docker-saiserver-mlnx/start.sh b/dockers/docker-saiserver-mlnx/start.sh index 4e1aa752d3a5..e3356be12025 100755 --- a/dockers/docker-saiserver-mlnx/start.sh +++ b/dockers/docker-saiserver-mlnx/start.sh @@ -11,6 +11,7 @@ start_mlnx() trap clean_up SIGTERM SIGKILL +rm -f /var/run/rsyslogd.pid service rsyslog start start_mlnx diff --git a/dockers/docker-snmp-sv2/config.sh b/dockers/docker-snmp-sv2/config.sh index b6216e8353b0..16b4507b09a2 100755 --- a/dockers/docker-snmp-sv2/config.sh +++ b/dockers/docker-snmp-sv2/config.sh @@ -13,3 +13,4 @@ sonic-cfggen -m /etc/sonic/minigraph.xml -s >/etc/snmp/alias_map.json mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status +rm -f /var/run/rsyslogd.pid diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index 6ea5eb01b328..5397475defb7 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -28,6 +28,7 @@ function clean_up { trap clean_up SIGTERM SIGKILL +rm -f /var/run/rsyslogd.pid service rsyslog start # Before teamd could automatically add newly created host interfaces into the diff --git a/dockers/docker-vas/Dockerfile b/dockers/docker-vas/Dockerfile index fb207d07199e..245bbd6baeb7 100755 --- a/dockers/docker-vas/Dockerfile +++ b/dockers/docker-vas/Dockerfile @@ -30,7 +30,8 @@ VOLUME /var/opt/quest/vas/vasd/ VOLUME /home/ ## Delete the symlinks and create full copies to host folder -ENTRYPOINT service rsyslog start \ +ENTRYPOINT rm -f /var/run/rsyslogd.pid \ + && service rsyslog start \ && cp --remove-destination /opt/quest/lib64/nss/libnss_vas4.so.2 \ /host/lib/x86_64-linux-gnu/ \ && cp --remove-destination /opt/quest/lib64/security/pam_vas3.so \ diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index 3e5b941a7658..6a08b7151432 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -8,6 +8,7 @@ function clean_up { trap clean_up SIGTERM SIGKILL +rm -f /var/run/rsyslogd.pid service rsyslog start service syncd start diff --git a/platform/cavium/docker-syncd-cavm/start.sh b/platform/cavium/docker-syncd-cavm/start.sh index 21d61e707344..b6c77ff235b5 100755 --- a/platform/cavium/docker-syncd-cavm/start.sh +++ b/platform/cavium/docker-syncd-cavm/start.sh @@ -2,6 +2,7 @@ export XP_ROOT=/usr/bin/ +rm -f /var/run/rsyslogd.pid service rsyslog start while true; do diff --git a/platform/centec/docker-syncd-centec/start.sh b/platform/centec/docker-syncd-centec/start.sh index 3e5b941a7658..6a08b7151432 100755 --- a/platform/centec/docker-syncd-centec/start.sh +++ b/platform/centec/docker-syncd-centec/start.sh @@ -8,6 +8,7 @@ function clean_up { trap clean_up SIGTERM SIGKILL +rm -f /var/run/rsyslogd.pid service rsyslog start service syncd start diff --git a/platform/p4/docker-sonic-p4/startup.sh b/platform/p4/docker-sonic-p4/startup.sh index e5221f834259..18cd4716580b 100755 --- a/platform/p4/docker-sonic-p4/startup.sh +++ b/platform/p4/docker-sonic-p4/startup.sh @@ -4,6 +4,7 @@ echo "Set onie_platform to x86_64-barefoot_p4-r0" export onie_platform=x86_64-barefoot_p4-r0 echo "Start rsyslog" +rm -f /var/run/rsyslogd.pid service rsyslog start echo "Start redis server" From 94934f7b3b55d75d1fd51602eb68003a258360c5 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 29 Mar 2017 20:11:46 -0700 Subject: [PATCH 0407/1833] Revert 432 taoyl/acl dhcp (#457) * Revert "[config/acl] Get ACL config from DHCP and load it in swss container (#432)" This reverts commit 4546372f488db8c8760164aa8dff62f4e07c98ee. --- dockers/docker-orchagent/start.sh | 13 ---------- files/dhcp/dhclient.conf | 3 +-- files/dhcp/graphserviceurl | 3 --- files/image_config/updategraph/updategraph | 30 ---------------------- src/sonic-config-engine/translate_acl | 4 +-- 5 files changed, 3 insertions(+), 50 deletions(-) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 088d0fe1bcf0..dd0a469efb93 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -12,18 +12,6 @@ function start_app { done } -function config_acl { - if [ -f "/etc/sonic/acl.json" ]; then - mkdir -p /etc/swss/config.d/acl - rm -rf /etc/swss/config.d/acl/* - translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json - for filename in /etc/swss/config.d/acl/*.json; do - [ -e "$filename" ] || break - swssconfig $filename - done - fi -} - function clean_up { pkill -9 orchagent pkill -9 portsyncd @@ -73,7 +61,6 @@ while true; do result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p` if [ "$result" != "0" ]; then start_app - config_acl read fi sleep 1 diff --git a/files/dhcp/dhclient.conf b/files/dhcp/dhclient.conf index 4a8bb037cd68..ce4ac4d9f445 100644 --- a/files/dhcp/dhclient.conf +++ b/files/dhcp/dhclient.conf @@ -14,12 +14,11 @@ option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; option snmp-community code 224 = text; option minigraph-url code 225 = text; -option acl-url code 226 = text; send host-name = gethostname(); request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, domain-search, host-name, dhcp6.name-servers, dhcp6.domain-search, netbios-name-servers, netbios-scope, interface-mtu, - rfc3442-classless-static-routes, ntp-servers, snmp-community, minigraph-url, acl-url; + rfc3442-classless-static-routes, ntp-servers, snmp-community, minigraph-url; diff --git a/files/dhcp/graphserviceurl b/files/dhcp/graphserviceurl index f255cdff9877..0e8b1b83e141 100644 --- a/files/dhcp/graphserviceurl +++ b/files/dhcp/graphserviceurl @@ -5,8 +5,5 @@ case $reason in else echo "N/A" > /tmp/dhcp_graph_url fi - if [ -n "$new_acl_url" ]; then - echo $new_acl_url > /tmp/dhcp_acl_url - fi ;; esac diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 0d3b248bc436..68fbe6eb9c19 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -12,8 +12,6 @@ if [ "$enabled" != "true" ]; then exit 0 fi -ACL_URL=$acl_src - if [ "$src" = "dhcp" ]; then while [ ! -f /tmp/dhcp_graph_url ]; do echo "Waiting for DHCP response..." @@ -40,18 +38,6 @@ if [ "$src" = "dhcp" ]; then sed -i "/src=/d" /etc/sonic/updategraph.conf echo "src=\"$GRAPH_URL\"" >> /etc/sonic/updategraph.conf fi - - if [ -f /tmp/dhcp_acl_url ]; then - ACL_URL=`sonic-cfggen -t /tmp/dhcp_acl_url -a "{\"hostname\": \"$HOSTNAME\"}"` - if [[ ! $ACL_URL =~ $URL_REGEX ]]; then - echo "\"$ACL_URL\" is not a valid url. Skipping acl update." - ACL_URL="" - fi - if [ "$dhcp_as_static" = "true" ]; then - sed -i "/acl_src=/d" /etc/sonic/updategraph.conf - echo "acl_src=\"$ACL_URL\"" >> /etc/sonic/updategraph.conf - fi - fi else GRAPH_URL=$src fi @@ -67,19 +53,3 @@ while true; do curl -f $GRAPH_URL -o /etc/sonic/minigraph.xml --connect-timeout 15 && break sleep 5 done - -if [ -n "$ACL_URL" ]; then - if [ -f /etc/sonic/acl.json ]; then - echo "Renaming acl.json to acl.json.old" - mv /etc/sonic/acl.json /etc/sonic/acl.json.old - fi - echo "Getting ACL config from $ACL_URL" - - while true; do - curl -f $ACL_URL -o /etc/sonic/acl.json --connect-timeout 15 && break - sleep 5 - done -else - echo "Skip ACL config download." -fi - diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl index 2c4410615d6e..f706fe1f52e4 100755 --- a/src/sonic-config-engine/translate_acl +++ b/src/sonic-config-engine/translate_acl @@ -129,6 +129,7 @@ def translate_acl_fixed_port(filename, output_path, port, max_priority): def translate_acl(filename, output_path, attach_to, max_priority): yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") + print attach_to.keys() for aclsetname in yang_acl.acl.acl_sets.acl_set: tablename = aclsetname.replace(" ", "_").replace("-", "_") if attach_to.has_key(tablename): @@ -150,8 +151,7 @@ def main(): translate_acl_fixed_port(args.input, args.output_path, args.port, args.max_priority) elif args.minigraph: mini_data = parse_xml(args.minigraph) - if mini_data['minigraph_acls']: - translate_acl(args.input, args.output_path, mini_data['minigraph_acls'], args.max_priority) + translate_acl(args.input, args.output_path, mini_data['minigraph_acls'], args.max_priority) if __name__ == "__main__": main() From 71d299bed4350eed6e51355baf01538ddee24654 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 30 Mar 2017 11:51:05 -0700 Subject: [PATCH 0408/1833] [swsssdk]: Update nomenclature: 'sswsdk' -> 'swsssdk' (#445) --- dockers/docker-lldp-sv2/Dockerfile.j2 | 8 ++++---- dockers/docker-lldp/Dockerfile | 16 ++++++++-------- dockers/docker-snmp-sv2/Dockerfile.j2 | 3 ++- dockers/docker-snmp/Dockerfile | 1 - rules/asyncsnmp-py3.mk | 2 +- rules/dbsyncd-py2.mk | 2 +- rules/sswsdk-py2.mk | 6 ------ rules/sswsdk-py3.mk | 8 -------- rules/swsssdk-py2.mk | 6 ++++++ rules/swsssdk-py3.mk | 8 ++++++++ src/sonic-dbsyncd | 2 +- src/sonic-py-swsssdk | 2 +- src/sonic-snmpagent | 2 +- src/sonic-utilities | 2 +- 14 files changed, 34 insertions(+), 34 deletions(-) delete mode 100644 rules/sswsdk-py2.mk delete mode 100644 rules/sswsdk-py3.mk create mode 100644 rules/swsssdk-py2.mk create mode 100644 rules/swsssdk-py3.mk diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 4ff66944fe07..1910e0d79fe3 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -13,16 +13,16 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 -## Pre-install the fundamental packages -## Install Python SSWSDK -## Install LLDP Sync Daemon +# Pre-install the fundamental packages +# Install Python SwSS SDK +# Install LLDP Sync Daemon RUN dpkg -i \ {% for deb in docker_lldp_sv2_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} -RUN pip install /python-wheels/sswsdk-2.0.1-py2-none-any.whl && \ +RUN pip install /python-wheels/swsssdk-2.0.1-py2-none-any.whl && \ pip install /python-wheels/sonic_d-2.0.0-py2-none-any.whl && \ apt-get remove -y python-pip && \ apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ diff --git a/dockers/docker-lldp/Dockerfile b/dockers/docker-lldp/Dockerfile index 044e16953e83..595c41bcd85e 100644 --- a/dockers/docker-lldp/Dockerfile +++ b/dockers/docker-lldp/Dockerfile @@ -1,21 +1,21 @@ FROM docker-base -COPY deps/sswsdk*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ +COPY deps/swsssdk*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ -## Make apt-get non-interactive +# Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -## Pre-install the fundamental packages -## Install Python SSWSDK (lldpsyncd dependency) -## Install LLDP Sync Daemon -## Note: dpkg_apt function has the benefit to detect missing .deb file -## Clean up +# Pre-install the fundamental packages +# Install Python SwSS SDK (lldpsyncd dependency) +# Install LLDP Sync Daemon +# Note: dpkg_apt function has the benefit to detect missing .deb file +# Clean up RUN apt-get update && \ dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ dpkg_apt /deps/lldpd_*.deb && \ dpkg_apt /deps/lldpsyncd_*.deb && \ apt-get install -y python-pip supervisor && \ - pip install /deps/sswsdk*.whl && \ + pip install /deps/swsssdk*.whl && \ apt-get remove -y python-pip && \ apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ rm -rf /deps ~/.cache diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index db5a6a574f48..fed2d1b85d58 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -6,7 +6,8 @@ COPY [ \ {%- endfor %} \ "/debs/"] -COPY python-wheels/sswsdk-*-py3-*.whl /python-wheels/ +# Install Python SwSSSDK (SNMP subagent dependency) +COPY python-wheels/swsssdk-*-py3-*.whl /python-wheels/ COPY python-wheels/asyncsnmp-*-py3-*.whl /python-wheels/ # enable -O for all Python calls diff --git a/dockers/docker-snmp/Dockerfile b/dockers/docker-snmp/Dockerfile index c13428563e33..6a79db976adc 100644 --- a/dockers/docker-snmp/Dockerfile +++ b/dockers/docker-snmp/Dockerfile @@ -10,7 +10,6 @@ ENV PYTHONOPTIMIZE 1 ENV DEBIAN_FRONTEND=noninteractive ## Pre-install the fundamental packages -## Install Python SSWSDK (SNMP subagent dependency) ## Install SNMP subagent ## Note: dpkg_apt function has the benefit to detect missing .deb file ## Clean up diff --git a/rules/asyncsnmp-py3.mk b/rules/asyncsnmp-py3.mk index 68566b1fa49d..a5a078e15bc3 100644 --- a/rules/asyncsnmp-py3.mk +++ b/rules/asyncsnmp-py3.mk @@ -3,5 +3,5 @@ ASYNCSNMP_PY3 = asyncsnmp-2.1.0-py3-none-any.whl $(ASYNCSNMP_PY3)_SRC_PATH = $(SRC_PATH)/sonic-snmpagent $(ASYNCSNMP_PY3)_PYTHON_VERSION = 3 -$(ASYNCSNMP_PY3)_DEPENDS += $(SSWSDK_PY3) +$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) SONIC_PYTHON_WHEELS += $(ASYNCSNMP_PY3) diff --git a/rules/dbsyncd-py2.mk b/rules/dbsyncd-py2.mk index cd85b9ed7f60..220dc5fe7a1d 100644 --- a/rules/dbsyncd-py2.mk +++ b/rules/dbsyncd-py2.mk @@ -3,5 +3,5 @@ DBSYNCD_PY2 = sonic_d-2.0.0-py2-none-any.whl $(DBSYNCD_PY2)_SRC_PATH = $(SRC_PATH)/sonic-dbsyncd $(DBSYNCD_PY2)_PYTHON_VERSION = 2 -$(DBSYNCD_PY2)_DEPENDS += $(SSWSDK_PY2) +$(DBSYNCD_PY2)_DEPENDS += $(SWSSSDK_PY2) SONIC_PYTHON_WHEELS += $(DBSYNCD_PY2) diff --git a/rules/sswsdk-py2.mk b/rules/sswsdk-py2.mk deleted file mode 100644 index b50ea229ab7e..000000000000 --- a/rules/sswsdk-py2.mk +++ /dev/null @@ -1,6 +0,0 @@ -# sswsdk python2 wheel - -SSWSDK_PY2 = sswsdk-2.0.1-py2-none-any.whl -$(SSWSDK_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk -$(SSWSDK_PY2)_PYTHON_VERSION = 2 -SONIC_PYTHON_WHEELS += $(SSWSDK_PY2) diff --git a/rules/sswsdk-py3.mk b/rules/sswsdk-py3.mk deleted file mode 100644 index 4dd0e7805bb1..000000000000 --- a/rules/sswsdk-py3.mk +++ /dev/null @@ -1,8 +0,0 @@ -# sswsdk python3 wheel - -SSWSDK_PY3 = sswsdk-2.0.1-py3-none-any.whl -$(SSWSDK_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk -$(SSWSDK_PY3)_PYTHON_VERSION = 3 -# Synthetic dependency just to avoid race condition -$(SSWSDK_PY3)_DEPENDS += $(SSWSDK_PY2) -SONIC_PYTHON_WHEELS += $(SSWSDK_PY3) diff --git a/rules/swsssdk-py2.mk b/rules/swsssdk-py2.mk new file mode 100644 index 000000000000..a45677ae5882 --- /dev/null +++ b/rules/swsssdk-py2.mk @@ -0,0 +1,6 @@ +# swsssdk python2 wheel + +SWSSSDK_PY2 = swsssdk-2.0.1-py2-none-any.whl +$(SWSSSDK_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk +$(SWSSSDK_PY2)_PYTHON_VERSION = 2 +SONIC_PYTHON_WHEELS += $(SWSSSDK_PY2) diff --git a/rules/swsssdk-py3.mk b/rules/swsssdk-py3.mk new file mode 100644 index 000000000000..e2f3519e00ca --- /dev/null +++ b/rules/swsssdk-py3.mk @@ -0,0 +1,8 @@ +# swsssdk python3 wheel + +SWSSSDK_PY3 = swsssdk-2.0.1-py3-none-any.whl +$(SWSSSDK_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk +$(SWSSSDK_PY3)_PYTHON_VERSION = 3 +# Synthetic dependency just to avoid race condition +$(SWSSSDK_PY3)_DEPENDS += $(SWSSSDK_PY2) +SONIC_PYTHON_WHEELS += $(SWSSSDK_PY3) diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd index 3d30cfc9318d..812f2cd50f83 160000 --- a/src/sonic-dbsyncd +++ b/src/sonic-dbsyncd @@ -1 +1 @@ -Subproject commit 3d30cfc9318d03652df01c0871090f5ef6c8ccb2 +Subproject commit 812f2cd50f83c1b83fbfc2688752e969cd5cd6f9 diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 497bdfe64c3d..ebb5ec6870ac 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 497bdfe64c3ddc2ce711ec8a2b0839d9d26f5666 +Subproject commit ebb5ec6870acccfde267e513d68d107873b0960e diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index c0e022addaaa..d39b66b354af 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit c0e022addaaa0af857331d36e3766a88a2095941 +Subproject commit d39b66b354af4db07313af82341fdc20762e89fc diff --git a/src/sonic-utilities b/src/sonic-utilities index edbda4670027..5c59ec6b8e06 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit edbda467002700230f89a7362a21b3d3909b1079 +Subproject commit 5c59ec6b8e067dab8c3d786432d6d2c9b961ec78 From fed908fc6bf6df77644d68df9a3ac787cea148c3 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 30 Mar 2017 15:25:31 -0700 Subject: [PATCH 0409/1833] [config-engine] minigraph.py refactoring (#448) * Refactor minigraph.py See description in https://github.com/Azure/sonic-buildimage/pull/448 for detail --- dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 2 +- dockers/docker-dhcp-relay/start.sh | 2 +- dockers/docker-fpm-gobgp/zebra.conf.j2 | 7 +- dockers/docker-fpm/zebra.conf.j2 | 6 +- dockers/docker-lldp-sv2/lldpd.conf.j2 | 4 +- dockers/docker-snmp-sv2/alias_map.j2 | 5 + dockers/docker-snmp-sv2/config.sh | 2 +- files/image_config/interfaces/interfaces.j2 | 56 ++--- slave.mk | 3 +- src/sonic-config-engine/minigraph.py | 165 +++++++------- src/sonic-config-engine/sonic-cfggen | 13 -- .../tests/simple-sample-graph.xml | 205 ++++++++++++++++++ src/sonic-config-engine/tests/test_cfggen.py | 34 ++- src/sonic-config-engine/tests/test_j2files.py | 5 + 14 files changed, 366 insertions(+), 143 deletions(-) create mode 100644 dockers/docker-snmp-sv2/alias_map.j2 create mode 100644 src/sonic-config-engine/tests/simple-sample-graph.xml diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 index 812e2bb8e1e4..aa5e21ac279a 100644 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -1,6 +1,6 @@ SERVERS="{{ dhcp_servers | join(' ') }}" -INTERFACES="{{ minigraph_vlan_interfaces[0]['name'] }}" +INTERFACES="{{ minigraph_vlan_interfaces[0]['attachto'] }}" # '-a' option provides option 82 circuit id information OPTIONS="-a" diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index ff8a629d98eb..f5bdf49396d3 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -3,7 +3,7 @@ rm -f /var/run/rsyslogd.pid service rsyslog start -VLAN_IFACE_NAME=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_vlan_interfaces[0]['name']"` +VLAN_IFACE_NAME=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_vlan_interfaces[0]['attachto']"` # Wait for the VLAN to come up (i.e., 'ip link show' returns 0) until ip link show $VLAN_IFACE_NAME > /dev/null 2>&1; do diff --git a/dockers/docker-fpm-gobgp/zebra.conf.j2 b/dockers/docker-fpm-gobgp/zebra.conf.j2 index ad05dcbe4e90..1ce06eecd2d9 100644 --- a/dockers/docker-fpm-gobgp/zebra.conf.j2 +++ b/dockers/docker-fpm-gobgp/zebra.conf.j2 @@ -15,7 +15,12 @@ enable password zebra {% block interfaces %} ! Enable link-detect (default disabled) {% for interface in minigraph_interfaces %} -interface {{ interface['alias'] }} +interface {{ interface['attachto'] }} +link-detect +! +{% endfor %} +{% for interface in minigraph_portchannels.keys() %} +interface {{ interface }} link-detect ! {% endfor %} diff --git a/dockers/docker-fpm/zebra.conf.j2 b/dockers/docker-fpm/zebra.conf.j2 index dc2061f8a02a..1ce06eecd2d9 100644 --- a/dockers/docker-fpm/zebra.conf.j2 +++ b/dockers/docker-fpm/zebra.conf.j2 @@ -15,12 +15,12 @@ enable password zebra {% block interfaces %} ! Enable link-detect (default disabled) {% for interface in minigraph_interfaces %} -interface {{ interface['alias'] }} +interface {{ interface['attachto'] }} link-detect ! {% endfor %} -{% for interface in minigraph_portchannel_interfaces %} -interface {{ interface['name'] }} +{% for interface in minigraph_portchannels.keys() %} +interface {{ interface }} link-detect ! {% endfor %} diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index d6be1e3ce0f2..1943c04ed73f 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,3 +1,3 @@ -{% for member in alias_map %} -configure ports {{member['sonic']}} lldp portidsubtype local {{member['origin']}} +{% for member in minigraph_ports.keys() %} +configure ports {{member}} lldp portidsubtype local {{minigraph_ports[member]['alias']}} {% endfor %} diff --git a/dockers/docker-snmp-sv2/alias_map.j2 b/dockers/docker-snmp-sv2/alias_map.j2 new file mode 100644 index 000000000000..76acb057480e --- /dev/null +++ b/dockers/docker-snmp-sv2/alias_map.j2 @@ -0,0 +1,5 @@ +{ +{% for member in minigraph_ports.keys() %} + "{{member}}": "{{minigraph_ports[member]['alias']}}" +{% endfor %} +} diff --git a/dockers/docker-snmp-sv2/config.sh b/dockers/docker-snmp-sv2/config.sh index 16b4507b09a2..62e8278ae41b 100755 --- a/dockers/docker-snmp-sv2/config.sh +++ b/dockers/docker-snmp-sv2/config.sh @@ -8,7 +8,7 @@ mkdir -p /etc/snmp sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 >/etc/snmp/snmpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -s >/etc/snmp/alias_map.json +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/alias_map.j2 >/etc/snmp/alias_map.json mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index c6156dab8bf9..87efc8cfa8ef 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -37,7 +37,7 @@ iface eth0 inet static {% for prefix in forced_mgmt_routes %} down ip route delete {{ prefix }} via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 {% endfor %} - {# TODO: COPP policy type rules #} +{# TODO: COPP policy type rules #} {% else %} iface eth0 inet dhcp {% endif %} @@ -46,53 +46,53 @@ iface eth0 inet dhcp {% block front_panel_interfaces %} # The switch front panel interfaces {% for interface in minigraph_interfaces %} -auto {{ interface['alias'] }} -allow-hotplug {{ interface['alias'] }} -iface {{ interface['alias'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static +auto {{ interface['attachto'] }} +allow-hotplug {{ interface['attachto'] }} +iface {{ interface['attachto'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static address {{ interface['addr'] }} netmask {{ interface['mask'] }} # {% endfor %} -{% for vlan_interface in minigraph_vlan_interfaces|unique_name %} -{% for interface in vlan_interface['members'] %} -auto {{ interface }} -allow-hotplug {{ interface }} -iface {{ interface }} inet manual - pre-up ifconfig {{ interface }} up - post-up brctl addif {{ vlan_interface['name'] }} {{ interface }} - post-down ifconfig {{ interface }} down +{% for vlan in minigraph_vlans.keys()|sort %} +{% for member in minigraph_vlans[vlan]['members'] %} +auto {{ member }} +allow-hotplug {{ member }} +iface {{ member }} inet manual + pre-up ifconfig {{ member }} up + post-up brctl addif {{ vlan }} {{ member }} + post-down ifconfig {{ member }} down # {% endfor %} {% endfor %} -# Add || true to suppress the error when docker-teamd starts after docker-swss -{% for pc_interface in minigraph_portchannel_interfaces|unique_name %} -{% for interface in pc_interface['members'] %} -{% if pc_interface['name'] not in pc_set %} -auto {{ interface }} -allow-hotplug {{ interface }} -iface {{ interface }} inet manual - pre-up teamdctl {{ pc_interface['name'] }} port add {{ interface }} || true - post-down ifconfig {{ interface }} down +# "|| true" is added to suppress the error when docker-teamd starts after docker-swss +{% for pc in minigraph_portchannels.keys()|sort %} +{% for member in minigraph_portchannels[pc]['members'] %} +auto {{ member }} +allow-hotplug {{ member }} +iface {{ member }} inet manual + pre-up teamdctl {{ pc }} port add {{ member }} || true + post-down ifconfig {{ member }} down # -{% endif %} {% endfor %} {% endfor %} {% endblock front_panel_interfaces %} {% block vlan_interfaces %} +# Vlan interfaces {% for vlan_interface in minigraph_vlan_interfaces %} -auto {{ vlan_interface['name'] }} -iface {{ vlan_interface['name'] }} {{ 'inet' if vlan_interface['addr'] | ipv4 else 'inet6' }} static +auto {{ vlan_interface['attachto'] }} +iface {{ vlan_interface['attachto'] }} {{ 'inet' if vlan_interface['addr'] | ipv4 else 'inet6' }} static bridge_ports none address {{ vlan_interface['addr'] }} netmask {{ vlan_interface['mask'] }} -# {% endfor %} +# {% endblock vlan_interfaces %} {% block pc_interfaces %} +# Portchannel interfaces {% for pc_interface in minigraph_portchannel_interfaces %} -auto {{ pc_interface['name'] }} -allow-hotplug {{ pc_interface['name'] }} -iface {{ pc_interface['name'] }} {{ 'inet' if pc_interface['addr'] | ipv4 else 'inet6' }} static +auto {{ pc_interface['attachto'] }} +allow-hotplug {{ pc_interface['attachto'] }} +iface {{ pc_interface['attachto'] }} {{ 'inet' if pc_interface['addr'] | ipv4 else 'inet6' }} static address {{ pc_interface['addr'] }} netmask {{ pc_interface['mask'] }} # diff --git a/slave.mk b/slave.mk index 2b7e45a07e92..52d06c38fd93 100644 --- a/slave.mk +++ b/slave.mk @@ -229,12 +229,13 @@ $(SONIC_INSTALL_TARGETS) : $(DEBS_PATH)/%-install : .platform $$(addsuffix -inst # $(SOME_NEW_WHL)_SRC_PATH = $(SRC_PATH)/project_name # $(SOME_NEW_WHL)_PYTHON_VERSION = 2 (or 3) # $(SOME_NEW_WHL)_DEPENDS = $(SOME_OTHER_WHL1) $(SOME_OTHER_WHL2) ... -# SONIC_PYTHON_WHEELS += $(SOME_NEW_DEB) +# SONIC_PYTHON_WHEELS += $(SOME_NEW_WHL) $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*_DEPENDS))) $(HEADER) pushd $($*_SRC_PATH) $(LOG) # apply series of patches if exist if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi + python$($*_PYTHON_VERSION) setup.py test $(LOG) python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) # clean up if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then quilt pop -a -f; fi diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 20c5aeb5b5f1..523c11ea1ada 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -39,12 +39,15 @@ ns2 = "Microsoft.Search.Autopilot.NetMux" ns3 = "http://www.w3.org/2001/XMLSchema-instance" + class minigraph_encoder(json.JSONEncoder): def default(self, obj): - if isinstance(obj, (ipaddress.IPv4Network, ipaddress.IPv6Network, ipaddress.IPv4Address, ipaddress.IPv6Address)): + if isinstance(obj, + (ipaddress.IPv4Network, ipaddress.IPv6Network, ipaddress.IPv4Address, ipaddress.IPv6Address)): return str(obj) return json.JSONEncoder.default(self, obj) + def parse_png(png, hname): neighbors = {} devices = {} @@ -112,7 +115,6 @@ def parse_png(png, hname): elif node.tag == str(QName(ns, "EndDevice")): mgmt_dev = node.text - return (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port) @@ -124,11 +126,12 @@ def parse_dpg(dpg, hname): ipintfs = child.find(str(QName(ns, "IPInterfaces"))) intfs = [] - intfnames = {} - vlan_map = {} - pc_map = {} for ipintf in ipintfs.findall(str(QName(ns, "IPInterface"))): - intfname = ipintf.find(str(QName(ns, "AttachTo"))).text + intfalias = ipintf.find(str(QName(ns, "AttachTo"))).text + if port_alias_map.has_key(intfalias): + intfname = port_alias_map[intfalias] + else: + intfname = intfalias ipprefix = ipintf.find(str(QName(ns, "Prefix"))).text ipn = ipaddress.IPNetwork(ipprefix) ipaddr = ipn.ip @@ -142,59 +145,24 @@ def parse_dpg(dpg, hname): intf['mask'] = ipmask else: intf['mask'] = str(prefix_len) - - if intfname[0:4] == "Vlan": - if intfname in vlan_map: - vlan_map[intfname].append(intf) + intf.update({'attachto': intfname, 'prefixlen': int(prefix_len)}) + + # TODO: remove peer_addr after dependency removed + ipaddr_val = int(ipn.ip) + peer_addr_val = None + if int(prefix_len) == addr_bits - 2: + if ipaddr_val & 0x3 == 1: + peer_addr_val = ipaddr_val + 1 else: - vlan_map[intfname] = [intf] - elif intfname[0:11] == "PortChannel": - if intfname in pc_map: - pc_map[intfname].append(intf) + peer_addr_val = ipaddr_val - 1 + elif int(prefix_len) == addr_bits - 1: + if ipaddr_val & 0x1 == 0: + peer_addr_val = ipaddr_val + 1 else: - pc_map[intfname] = [intf] - else: - intf.update({'name': intfname, 'prefixlen': int(prefix_len)}) - - if port_alias_map.has_key(intfname): - intf['alias'] = port_alias_map[intfname] - else: - intf['alias'] = intfname - - # TODO: remove peer_addr after dependency removed - ipaddr_val = int(ipn.ip) - peer_addr_val = None - if int(prefix_len) == addr_bits - 2: - if ipaddr_val & 0x3 == 1: - peer_addr_val = ipaddr_val + 1 - else: - peer_addr_val = ipaddr_val - 1 - elif int(prefix_len) == addr_bits - 1: - if ipaddr_val & 0x1 == 0: - peer_addr_val = ipaddr_val + 1 - else: - peer_addr_val = ipaddr_val - 1 - - if peer_addr_val is not None: - intf['peer_addr'] = ipaddress.IPAddress(peer_addr_val) - intfs.append(intf) - intfnames[intf['alias']] = { 'alias': intf['name'] } - - pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) - pc_intfs = [] - pcs = {} - for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): - pcintfname = pcintf.find(str(QName(ns, "Name"))).text - pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text - pcmbr_list = pcintfmbr.split(';', 1) - for i,member in enumerate(pcmbr_list): - if port_alias_map.has_key(member): - pcmbr_list[i] = port_alias_map[member] - pc_attributes = {'name': pcintfname, 'members': pcmbr_list} - for addrtuple in pc_map.get(pcintfname, []): - pc_attributes.update(addrtuple) - pc_intfs.append(copy.deepcopy(pc_attributes)) - pcs[pcintfname] = pc_attributes + peer_addr_val = ipaddr_val - 1 + if peer_addr_val is not None: + intf['peer_addr'] = ipaddress.IPAddress(peer_addr_val) + intfs.append(intf) lointfs = child.find(str(QName(ns, "LoopbackIPInterfaces"))) lo_intfs = [] @@ -223,6 +191,17 @@ def parse_dpg(dpg, hname): gwaddr = ipaddress.IPAddress(int(mgmtipn.network) + 1) mgmt_intf = {'addr': ipaddr, 'prefixlen': prefix_len, 'mask': ipmask, 'gwaddr': gwaddr} + pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) + pc_intfs = [] + pcs = {} + for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): + pcintfname = pcintf.find(str(QName(ns, "Name"))).text + pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text + pcmbr_list = pcintfmbr.split(';', 1) + for i, member in enumerate(pcmbr_list): + pcmbr_list[i] = port_alias_map[member] + pcs[pcintfname] = {'name': pcintfname, 'members': pcmbr_list} + vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) vlan_intfs = [] vlans = {} @@ -231,14 +210,11 @@ def parse_dpg(dpg, hname): vlanid = vintf.find(str(QName(ns, "VlanID"))).text vintfmbr = vintf.find(str(QName(ns, "AttachTo"))).text vmbr_list = vintfmbr.split(';') - for i,member in enumerate(vmbr_list): - if port_alias_map.has_key(member): - vmbr_list[i] = port_alias_map[member] + for i, member in enumerate(vmbr_list): + vmbr_list[i] = port_alias_map[member] vlan_attributes = {'name': vintfname, 'members': vmbr_list, 'vlanid': vlanid} - for addrtuple in vlan_map.get(vintfname, []): - vlan_attributes.update(addrtuple) - vlan_intfs.append(copy.deepcopy(vlan_attributes)) vlans[vintfname] = vlan_attributes + aclintfs = child.find(str(QName(ns, "AclInterfaces"))) acls = {} for aclintf in aclintfs.findall(str(QName(ns, "AclInterface"))): @@ -247,20 +223,19 @@ def parse_dpg(dpg, hname): acl_intfs = [] for member in aclattach: member = member.strip() - if port_alias_map.has_key(member): - member = port_alias_map[member] if pcs.has_key(member): acl_intfs.extend(pcs[member]['members']) # For ACL attaching to port channels, we break them into port channel members elif vlans.has_key(member): - print >> sys.stderr, "Warning: ACL "+aclname+" is attached to a Vlan interface, which is currently not supported" - elif intfnames.has_key(member): - acl_intfs.append(member) + print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a Vlan interface, which is currently not supported" + elif port_alias_map.has_key(member): + acl_intfs.append(port_alias_map[member]) if acl_intfs: acls[aclname] = acl_intfs - return intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs, intfnames, vlans, pcs, acls + return intfs, lo_intfs, mgmt_intf, vlans, pcs, acls return None, None, None, None, None, None, None, None + def parse_cpg(cpg, hname): bgp_sessions = [] myasn = None @@ -297,6 +272,7 @@ def parse_cpg(cpg, hname): return bgp_sessions, myasn + def parse_meta(meta, hname): syslog_servers = [] dhcp_servers = [] @@ -320,6 +296,7 @@ def parse_meta(meta, hname): mgmt_routes = value_group return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes + def get_console_info(devices, dev, port): for k, v in devices.items(): if k == dev: @@ -335,6 +312,7 @@ def get_console_info(devices, dev, port): return ret_val + def get_mgmt_info(devices, dev, port): for k, v in devices.items(): if k == dev: @@ -350,7 +328,8 @@ def get_mgmt_info(devices, dev, port): return ret_val -def get_alias_map_list(hwsku, platform=None, port_config_file=None): + +def parse_port_config(hwsku, platform=None, port_config_file=None): port_config_candidates = [] if port_config_file != None: port_config_candidates.append(port_config_file) @@ -367,16 +346,23 @@ def get_alias_map_list(hwsku, platform=None, port_config_file=None): if port_config == None: return None - alias_map_list = [] + ports = {} with open(port_config) as data: for line in data: if line.startswith('#'): continue tokens = line.split() - if len(tokens) < 3: + if len(tokens) < 2: continue - alias_map_list.append({'sonic': tokens[0], 'origin': tokens[2].strip()}) - return alias_map_list + name = tokens[0].strip() + if len(tokens) == 2: + alias = name + else: + alias = tokens[2].strip() + ports[name] = {'name': name, 'alias': alias} + port_alias_map[alias] = name + return ports + def parse_xml(filename, platform=None, port_config_file=None): root = ET.parse(filename).getroot() @@ -410,14 +396,11 @@ def parse_xml(filename, platform=None, port_config_file=None): if child.tag == str(hostname_qn): hostname = child.text - alias_map_list = get_alias_map_list(hwsku, platform, port_config_file) - if alias_map_list != None: - for item in alias_map_list: - port_alias_map[item['origin']] = item['sonic'] + ports = parse_port_config(hwsku, platform, port_config_file) for child in root: if child.tag == str(QName(ns, "DpgDec")): - (intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs, ports, vlans, pcs, acls) = parse_dpg(child, hostname) + (intfs, lo_intfs, mgmt_intf, vlans, pcs, acls) = parse_dpg(child, hostname) elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_asn) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): @@ -437,11 +420,24 @@ def parse_xml(filename, platform=None, port_config_file=None): results['minigraph_bgp'] = sorted(bgp_sessions, key=lambda x: x['addr']) results['minigraph_bgp_asn'] = bgp_asn # TODO: sort does not work properly on all interfaces of varying lengths. Need to sort by integer group(s). - results['minigraph_interfaces'] = sorted(intfs, key=lambda x: x['name']) - results['minigraph_vlan_interfaces'] = vlan_intfs - results['minigraph_portchannel_interfaces'] = pc_intfs - results['minigraph_vlans'] = vlans + + phyport_intfs = [] + vlan_intfs = [] + pc_intfs = [] + for intf in intfs: + intfname = intf['attachto'] + if intfname[0:4] == 'Vlan': + vlan_intfs.append(intf) + elif intfname[0:11] == 'PortChannel': + pc_intfs.append(intf) + else: + phyport_intfs.append(intf) + + results['minigraph_interfaces'] = sorted(phyport_intfs, key=lambda x: x['attachto']) + results['minigraph_vlan_interfaces'] = sorted(vlan_intfs, key=lambda x: x['attachto']) + results['minigraph_portchannel_interfaces'] = sorted(pc_intfs, key=lambda x: x['attachto']) results['minigraph_ports'] = ports + results['minigraph_vlans'] = vlans results['minigraph_portchannels'] = pcs results['minigraph_mgmt_interface'] = mgmt_intf results['minigraph_lo_interfaces'] = lo_intfs @@ -460,7 +456,6 @@ def parse_xml(filename, platform=None, port_config_file=None): results['dhcp_servers'] = dhcp_servers results['ntp_servers'] = ntp_servers results['forced_mgmt_routes'] = mgmt_routes - results['alias_map'] = alias_map_list return results @@ -469,5 +464,3 @@ def parse_xml(filename, platform=None, port_config_file=None): def print_parse_xml(filename): results = parse_xml(filename) print(json.dumps(results, indent=3, cls=minigraph_encoder)) - - diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index c10fb8c104cd..e47985cf17fc 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -65,10 +65,8 @@ def main(): parser.add_argument("-a", "--additional-data", help="addition data, in json string") group = parser.add_mutually_exclusive_group() group.add_argument("-t", "--template", help="render the data with the template file") - group.add_argument("-s", "--alias-mapping", help="print alias mapping json if available", action='store_true') group.add_argument("-v", "--var", help="print the value of a variable, support jinja2 expression") group.add_argument("--var-json", help="print the value of a variable, in json format") - group.add_argument("--var-keys", help="print all keys of a map variable - to be deprecated, use -v and keys()") group.add_argument("--print-data", help="print all data", action='store_true') args = parser.parse_args() @@ -118,17 +116,6 @@ def main(): if args.var_json != None: print json.dumps(data[args.var_json], indent=4, cls=minigraph_encoder) - if args.var_keys != None: - for key in data[args.var_keys].keys(): - print key - - if args.alias_mapping: - mapping = {} - if data.has_key('alias_map'): - for item in data['alias_map']: - mapping[item['sonic']] = item['origin'] - print json.dumps(mapping) - if args.print_data: print json.dumps(data, indent=4, cls=minigraph_encoder) diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml new file mode 100644 index 000000000000..20bfb07f00d0 --- /dev/null +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -0,0 +1,205 @@ + + + + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + + + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/4 + + + + + + Vlan1000 + fortyGigE0/8 + 1000 + 1000 + 192.168.0.0/27 + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + fortyGigE0/0 + 10.0.0.58/31 + + + + fortyGigE0/0 + FC00::75/126 + + + + Vlan1000 + 192.168.0.1/27 + + + + + + + PortChannel01 + + DataAcl + + + + + + + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 0d0570acf44e..4f04d0ea5932 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -9,6 +9,8 @@ def setUp(self): self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') self.sample_graph = os.path.join(self.test_dir, 'sample_graph.xml') self.sample_graph_t0 = os.path.join(self.test_dir, 't0-sample-graph.xml') + self.sample_graph_simple = os.path.join(self.test_dir, 'simple-sample-graph.xml') + self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') def run_script(self, argument): print '\n Running sonic-cfggen ' + argument @@ -40,11 +42,6 @@ def test_jinja_expression(self): output = self.run_script(argument) self.assertEqual(output.strip(), 'LeafRouter') - def test_print_alias_mapping(self): - argument = '-s' - output = self.run_script(argument) - self.assertTrue(len(output.strip()) > 0) - def test_additional_json_data(self): argument = '-a \'{"key1":"value1"}\' -v key1' output = self.run_script(argument) @@ -61,7 +58,32 @@ def test_render_template(self): self.assertEqual(output.strip(), 'value1\nvalue2') def test_minigraph_acl(self): - argument = '-m "' + self.sample_graph_t0 + '" -v minigraph_acls' + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v minigraph_acls' output = self.run_script(argument) self.assertEqual(output.strip(), "{'DataAcl': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}") + def test_minigraph_interfaces(self): + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_interfaces' + output = self.run_script(argument) + self.assertEqual(output.strip(), "[{'subnet': IPv4Network('10.0.0.58/31'), 'peer_addr': IPv4Address('10.0.0.59'), 'addr': IPv4Address('10.0.0.58'), 'mask': IPv4Address('255.255.255.254'), 'attachto': 'Ethernet0', 'prefixlen': 31}, {'subnet': IPv6Network('fc00::74/126'), 'peer_addr': IPv6Address('fc00::76'), 'addr': IPv6Address('fc00::75'), 'mask': '126', 'attachto': 'Ethernet0', 'prefixlen': 126}]") + + def test_minigraph_vlans(self): + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_vlans' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'Vlan1000': {'name': 'Vlan1000', 'members': ['Ethernet8'], 'vlanid': '1000'}}") + + def test_minigraph_vlan_interfaces(self): + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_vlan_interfaces' + output = self.run_script(argument) + self.assertEqual(output.strip(), "[{'prefixlen': 27, 'subnet': IPv4Network('192.168.0.0/27'), 'mask': IPv4Address('255.255.255.224'), 'addr': IPv4Address('192.168.0.1'), 'attachto': 'Vlan1000'}]") + + def test_minigraph_portchannels(self): + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannels' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'PortChannel01': {'name': 'PortChannel01', 'members': ['Ethernet4']}}") + + def test_minigraph_portchannels(self): + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannel_interfaces' + output = self.run_script(argument) + self.assertEqual(output.strip(), "[{'subnet': IPv4Network('10.0.0.56/31'), 'peer_addr': IPv4Address('10.0.0.57'), 'addr': IPv4Address('10.0.0.56'), 'mask': IPv4Address('255.255.255.254'), 'attachto': 'PortChannel01', 'prefixlen': 31}, {'subnet': IPv6Network('fc00::70/126'), 'peer_addr': IPv6Address('fc00::72'), 'addr': IPv6Address('fc00::71'), 'mask': '126', 'attachto': 'PortChannel01', 'prefixlen': 126}]") + diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index e2ad2f54a2ac..30a67f0b6cd3 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -16,6 +16,11 @@ def run_script(self, argument): print 'CMD: sonic-cfggen ' + argument return subprocess.check_output(self.script_file + ' ' + argument, shell=True) + def test_interfaces(self): + interfaces_template = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'interfaces', 'interfaces.j2') + argument = '-m "' + self.t0_minigraph + '" -p "' + self.t0_port_config + '" -t "' + interfaces_template + '"' + output = self.run_script(argument) + def test_teamd(self): argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"' output = self.run_script(argument) # Mock the output via config.sh in docker-teamd From 823bc36bd9018acd044b7e907d5823d482f8bf7e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 31 Mar 2017 13:25:39 -0700 Subject: [PATCH 0410/1833] Enable graceful restart feature for ToR router (#466) --- dockers/docker-fpm/bgpd.conf.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dockers/docker-fpm/bgpd.conf.j2 b/dockers/docker-fpm/bgpd.conf.j2 index 5f4bb25e0010..fff27678c95b 100644 --- a/dockers/docker-fpm/bgpd.conf.j2 +++ b/dockers/docker-fpm/bgpd.conf.j2 @@ -22,6 +22,10 @@ log facility local4 router bgp {{ minigraph_bgp_asn }} bgp log-neighbor-changes bgp bestpath as-path multipath-relax +{# Advertise graceful restart capability for ToR #} +{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} + bgp graceful-restart +{% endif %} {# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} bgp router-id {{ minigraph_lo_interfaces[0]['addr'] }} {# advertise loopback #} From 5604b59be50737a96ac7b1b8219644b7cbd44d02 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 31 Mar 2017 15:51:38 -0700 Subject: [PATCH 0411/1833] Remove deprecated docker-bgp (#465) --- dockers/docker-bgp/Dockerfile | 16 ---------------- dockers/docker-bgp/daemons | 31 ------------------------------- 2 files changed, 47 deletions(-) delete mode 100755 dockers/docker-bgp/Dockerfile delete mode 100644 dockers/docker-bgp/daemons diff --git a/dockers/docker-bgp/Dockerfile b/dockers/docker-bgp/Dockerfile deleted file mode 100755 index 17c58524a079..000000000000 --- a/dockers/docker-bgp/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM docker-base - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -COPY deps/quagga_*.deb /deps/ -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ - dpkg_apt /deps/quagga_*.deb && \ - apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ - rm -rf /deps - -COPY daemons /etc/quagga/ - -ENTRYPOINT service rsyslog start \ - && service quagga start \ - && /bin/bash diff --git a/dockers/docker-bgp/daemons b/dockers/docker-bgp/daemons deleted file mode 100644 index cb7c2322c9fb..000000000000 --- a/dockers/docker-bgp/daemons +++ /dev/null @@ -1,31 +0,0 @@ -# This file tells the quagga package which daemons to start. -# -# Entries are in the format: =(yes|no|priority) -# 0, "no" = disabled -# 1, "yes" = highest priority -# 2 .. 10 = lower priorities -# Read /usr/share/doc/quagga/README.Debian for details. -# -# Sample configurations for these daemons can be found in -# /usr/share/doc/quagga/examples/. -# -# ATTENTION: -# -# When activation a daemon at the first time, a config file, even if it is -# empty, has to be present *and* be owned by the user and group "quagga", else -# the daemon will not be started by /etc/init.d/quagga. The permissions should -# be u=rw,g=r,o=. -# When using "vtysh" such a config file is also needed. It should be owned by -# group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. -# -# The watchquagga daemon is always started. Per default in monitoring-only but -# that can be changed via /etc/quagga/debian.conf. -# -zebra=yes -bgpd=yes -ospfd=no -ospf6d=no -ripd=no -ripngd=no -isisd=no -babeld=no From ed746c100c8729095727c17904a930143e91e16f Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 31 Mar 2017 23:51:09 -0700 Subject: [PATCH 0412/1833] Update sairedis and utilities to get fast-reboot support (#467) --- src/sonic-sairedis | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 81c19878217c..e28e4c038572 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 81c19878217c26d71b64e93dbdbf777faa1d3cfa +Subproject commit e28e4c038572aeea65491424a86fcb4f1ac229de diff --git a/src/sonic-utilities b/src/sonic-utilities index 5c59ec6b8e06..64826397a860 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 5c59ec6b8e067dab8c3d786432d6d2c9b961ec78 +Subproject commit 64826397a860fda4495ae073b17e88020ddad56c From 9841f8338b392db7bdfbe2072e8a82c056b27ffc Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 31 Mar 2017 23:51:31 -0700 Subject: [PATCH 0413/1833] [redis]: Disable snapshotting completely (#463) Signed-off-by: Shuotian Cheng --- dockers/docker-database/Dockerfile.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 59f90a897a9f..a213dd079062 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -24,7 +24,8 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -RUN sed -ri 's/^daemonize yes$/daemonize no/; \ +RUN sed -ri 's/^(save .*$)/# \1/g; \ + s/^daemonize yes$/daemonize no/; \ s/^logfile .*$/logfile ""/; \ s/^# syslog-enabled no$/syslog-enabled no/; \ s/^# unixsocket/unixsocket/ \ From 5c8bcef1ac2a87fbd0dbcfca438a92f39732880a Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Fri, 31 Mar 2017 23:51:59 -0700 Subject: [PATCH 0414/1833] [boot0]:remove no need files before extract image (#460) * [Aboot]:remove no need files before extract image Signed-off-by: Sihui Han * use and remove boot0 in the check Signed-off-by: Sihui Han * change the comments accordingly Signed-off-by: Sihui Han --- files/Aboot/boot0.j2 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index d30a44e520c2..0905faad4c5d 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -41,11 +41,13 @@ parse_environment_config() { } extract_image() { - ## Clean old directory for read-write layer - rm -rf "$target_path/rw" - - ## Clean docker directory - rm -rf "$target_path/{{ DOCKERFS_DIR }}" + ## Remove all the other unnecssary files except swi file, boot-config + for f in $(ls -A $target_path); do + if [ $f != "${swipath##*/}" ] && [ $f != "boot-config" ]; then + rm -rf "$target_path/$f" + fi + done + ## Unzip the image unzip -oq "$swipath" -x boot0 -d "$target_path" From a0c80d8a41f5465f2c6f12816b4285e69a0cf974 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Mon, 3 Apr 2017 09:43:57 +0300 Subject: [PATCH 0415/1833] Update cavium libsai (#470) Signed-off-by: Nadiya.Stetskovych --- platform/cavium/cavm-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/cavium/cavm-sai.mk b/platform/cavium/cavm-sai.mk index 9308766e16e1..1b88b1ae1978 100644 --- a/platform/cavium/cavm-sai.mk +++ b/platform/cavium/cavm-sai.mk @@ -1,6 +1,6 @@ # Cavium SAI -CAVM_SAI_GITHUB = https://github.com/XPliant/OpenXPS/raw/d8868c604ef32dd3f254c3ba58b3453d21bc5722/SAI/cavm-sai/ +CAVM_SAI_GITHUB = https://github.com/XPliant/OpenXPS/raw/1b28b78400656114c3b1ce46381e0e8ab3ecd6da/SAI/cavm-sai/ CAVM_LIBSAI = libsai.deb CAVM_SAI = sai.deb From 8c76556efb82c834e7fda631a70b8941d0d2d4c7 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 3 Apr 2017 16:12:32 -0700 Subject: [PATCH 0416/1833] Re-commit PR #432 (SHA 4546372) (#474) * [config/acl] Get ACL config from DHCP and load it in swss container (#432) * Temporarily disable DHCP option 226 --- dockers/docker-orchagent/start.sh | 13 ++++++++++ files/dhcp/dhclient.conf | 1 + files/dhcp/graphserviceurl | 3 +++ files/image_config/updategraph/updategraph | 30 ++++++++++++++++++++++ src/sonic-config-engine/translate_acl | 4 +-- 5 files changed, 49 insertions(+), 2 deletions(-) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index dd0a469efb93..088d0fe1bcf0 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -12,6 +12,18 @@ function start_app { done } +function config_acl { + if [ -f "/etc/sonic/acl.json" ]; then + mkdir -p /etc/swss/config.d/acl + rm -rf /etc/swss/config.d/acl/* + translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json + for filename in /etc/swss/config.d/acl/*.json; do + [ -e "$filename" ] || break + swssconfig $filename + done + fi +} + function clean_up { pkill -9 orchagent pkill -9 portsyncd @@ -61,6 +73,7 @@ while true; do result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p` if [ "$result" != "0" ]; then start_app + config_acl read fi sleep 1 diff --git a/files/dhcp/dhclient.conf b/files/dhcp/dhclient.conf index ce4ac4d9f445..f97b56dfd5a6 100644 --- a/files/dhcp/dhclient.conf +++ b/files/dhcp/dhclient.conf @@ -14,6 +14,7 @@ option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; option snmp-community code 224 = text; option minigraph-url code 225 = text; +option acl-url code 226 = text; send host-name = gethostname(); request subnet-mask, broadcast-address, time-offset, routers, diff --git a/files/dhcp/graphserviceurl b/files/dhcp/graphserviceurl index 0e8b1b83e141..f255cdff9877 100644 --- a/files/dhcp/graphserviceurl +++ b/files/dhcp/graphserviceurl @@ -5,5 +5,8 @@ case $reason in else echo "N/A" > /tmp/dhcp_graph_url fi + if [ -n "$new_acl_url" ]; then + echo $new_acl_url > /tmp/dhcp_acl_url + fi ;; esac diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 68fbe6eb9c19..0d3b248bc436 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -12,6 +12,8 @@ if [ "$enabled" != "true" ]; then exit 0 fi +ACL_URL=$acl_src + if [ "$src" = "dhcp" ]; then while [ ! -f /tmp/dhcp_graph_url ]; do echo "Waiting for DHCP response..." @@ -38,6 +40,18 @@ if [ "$src" = "dhcp" ]; then sed -i "/src=/d" /etc/sonic/updategraph.conf echo "src=\"$GRAPH_URL\"" >> /etc/sonic/updategraph.conf fi + + if [ -f /tmp/dhcp_acl_url ]; then + ACL_URL=`sonic-cfggen -t /tmp/dhcp_acl_url -a "{\"hostname\": \"$HOSTNAME\"}"` + if [[ ! $ACL_URL =~ $URL_REGEX ]]; then + echo "\"$ACL_URL\" is not a valid url. Skipping acl update." + ACL_URL="" + fi + if [ "$dhcp_as_static" = "true" ]; then + sed -i "/acl_src=/d" /etc/sonic/updategraph.conf + echo "acl_src=\"$ACL_URL\"" >> /etc/sonic/updategraph.conf + fi + fi else GRAPH_URL=$src fi @@ -53,3 +67,19 @@ while true; do curl -f $GRAPH_URL -o /etc/sonic/minigraph.xml --connect-timeout 15 && break sleep 5 done + +if [ -n "$ACL_URL" ]; then + if [ -f /etc/sonic/acl.json ]; then + echo "Renaming acl.json to acl.json.old" + mv /etc/sonic/acl.json /etc/sonic/acl.json.old + fi + echo "Getting ACL config from $ACL_URL" + + while true; do + curl -f $ACL_URL -o /etc/sonic/acl.json --connect-timeout 15 && break + sleep 5 + done +else + echo "Skip ACL config download." +fi + diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl index f706fe1f52e4..2c4410615d6e 100755 --- a/src/sonic-config-engine/translate_acl +++ b/src/sonic-config-engine/translate_acl @@ -129,7 +129,6 @@ def translate_acl_fixed_port(filename, output_path, port, max_priority): def translate_acl(filename, output_path, attach_to, max_priority): yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") - print attach_to.keys() for aclsetname in yang_acl.acl.acl_sets.acl_set: tablename = aclsetname.replace(" ", "_").replace("-", "_") if attach_to.has_key(tablename): @@ -151,7 +150,8 @@ def main(): translate_acl_fixed_port(args.input, args.output_path, args.port, args.max_priority) elif args.minigraph: mini_data = parse_xml(args.minigraph) - translate_acl(args.input, args.output_path, mini_data['minigraph_acls'], args.max_priority) + if mini_data['minigraph_acls']: + translate_acl(args.input, args.output_path, mini_data['minigraph_acls'], args.max_priority) if __name__ == "__main__": main() From 4ff0f865b6d045ecdda36e4199e87bb5bc2dc751 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 3 Apr 2017 17:01:12 -0700 Subject: [PATCH 0417/1833] Update sonic-utilities (#475) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 64826397a860..03488ff6e768 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 64826397a860fda4495ae073b17e88020ddad56c +Subproject commit 03488ff6e7684c807351158db8f70d89f126d8b2 From 6f04867954f971f72a2eced978c372fd82f346ba Mon Sep 17 00:00:00 2001 From: Nadiya Date: Tue, 4 Apr 2017 05:13:29 +0300 Subject: [PATCH 0418/1833] [oneimage] Add cavium packet driver (#469) * [oneimage] Add cavium packet driver Signed-off-by: Nadiya.Stetskovych * Rename cavm_platform_modules.mk and cavm_xpnet.mk to fit naming convetion Signed-off-by: Nadiya.Stetskovych * Allow dpkg -i for cavm_xpnet Signed-off-by: Nadiya.Stetskovych --- files/build_templates/sonic_debian_extension.j2 | 6 +++--- files/build_templates/swss.service.j2 | 1 - .../{cavm_platform_modules.mk => cavm-platform-modules.mk} | 0 platform/cavium/cavm-xpnet.mk | 6 ++++++ platform/cavium/one-image.mk | 3 ++- platform/cavium/rules.mk | 3 ++- 6 files changed, 13 insertions(+), 6 deletions(-) rename platform/cavium/{cavm_platform_modules.mk => cavm-platform-modules.mk} (100%) create mode 100644 platform/cavium/cavm-xpnet.mk diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index c5df3f9ac741..2720514960a8 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -138,11 +138,11 @@ sudo chmod a+x $FILESYSTEM_ROOT/usr/sbin/policy-rc.d {% if installer_debs.strip() -%} {% for deb in installer_debs.strip().split(' ') -%} -if [ $sonic_asic_platform == "mellanox" ]; then +{% if sonic_asic_platform == "mellanox" %} sudo dpkg --extract {{deb}} $FILESYSTEM_ROOT -else +{% else %} sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f -fi +{% endif %} {% endfor %} {% endif %} diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 87db5eb3b652..6e5152223616 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -22,7 +22,6 @@ ExecStartPre=/etc/init.d/sxdkernel start ExecStartPre=/usr/bin/mst start ExecStartPre=/etc/mlnx/msn2700 start {% elif sonic_asic_platform == 'cavium' %} -ExecStartPre=-/etc/init.d/xpnet.sh stop ExecStartPre=/etc/init.d/xpnet.sh start {% endif %} diff --git a/platform/cavium/cavm_platform_modules.mk b/platform/cavium/cavm-platform-modules.mk similarity index 100% rename from platform/cavium/cavm_platform_modules.mk rename to platform/cavium/cavm-platform-modules.mk diff --git a/platform/cavium/cavm-xpnet.mk b/platform/cavium/cavm-xpnet.mk new file mode 100644 index 000000000000..0ae3c147039f --- /dev/null +++ b/platform/cavium/cavm-xpnet.mk @@ -0,0 +1,6 @@ +CAVM_SAI_URL = https://github.com/XPliant/OpenXPS/raw/18cd5fb556b6262943c0af70375e2631ac3fe08d/SAI + +CAVM_XPNET_DEB = xp80-Pcie-Endpoint.deb +$(CAVM_XPNET_DEB)_URL = $(CAVM_SAI_URL)/netdev/$(CAVM_XPNET_DEB) + +SONIC_ONLINE_DEBS += $(CAVM_XPNET_DEB) diff --git a/platform/cavium/one-image.mk b/platform/cavium/one-image.mk index 0b011f77ac48..33bcd92cc047 100644 --- a/platform/cavium/one-image.mk +++ b/platform/cavium/one-image.mk @@ -3,6 +3,7 @@ SONIC_ONE_IMAGE = sonic-cavium.bin $(SONIC_ONE_IMAGE)_MACHINE = cavium $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(CAVM_PLATFORM_DEB) +$(SONIC_ONE_IMAGE)_DEPENDS += $(CAVM_PLATFORM_DEB) +$(SONIC_ONE_IMAGE)_DEPENDS += $(CAVM_XPNET_DEB) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index f72989c241b8..0c112860192e 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -1,7 +1,8 @@ include $(PLATFORM_PATH)/cavm-sai.mk include $(PLATFORM_PATH)/docker-syncd-cavm.mk include $(PLATFORM_PATH)/docker-orchagent-cavm.mk -include $(PLATFORM_PATH)/cavm_platform_modules.mk +include $(PLATFORM_PATH)/cavm-platform-modules.mk +include $(PLATFORM_PATH)/cavm-xpnet.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk From 8391d7f8b55f79dc3c42c10825b52594418ba2d1 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 3 Apr 2017 21:34:18 -0700 Subject: [PATCH 0419/1833] [snmp] Fix a bug in SNMP alias mapping (#473) * [snmp] Fix a bug in SNMP alias mapping Which was introduced in #448. --- dockers/docker-snmp-sv2/alias_map.j2 | 2 +- src/sonic-config-engine/tests/test_j2files.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dockers/docker-snmp-sv2/alias_map.j2 b/dockers/docker-snmp-sv2/alias_map.j2 index 76acb057480e..0f91fa26eabe 100644 --- a/dockers/docker-snmp-sv2/alias_map.j2 +++ b/dockers/docker-snmp-sv2/alias_map.j2 @@ -1,5 +1,5 @@ { {% for member in minigraph_ports.keys() %} - "{{member}}": "{{minigraph_ports[member]['alias']}}" + "{{member}}": "{{minigraph_ports[member]['alias']}}"{% if not loop.last %},{% endif %} {% endfor %} } diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 30a67f0b6cd3..cf1e32aea519 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -1,6 +1,7 @@ import filecmp import os import subprocess +import json from unittest import TestCase @@ -21,6 +22,13 @@ def test_interfaces(self): argument = '-m "' + self.t0_minigraph + '" -p "' + self.t0_port_config + '" -t "' + interfaces_template + '"' output = self.run_script(argument) + def test_alias_map(self): + alias_map_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-snmp-sv2', 'alias_map.j2') + argument = '-m "' + self.t0_minigraph + '" -p "' + self.t0_port_config + '" -t "' + alias_map_template + '"' + output = self.run_script(argument) + data = json.loads(output) + self.assertEqual(data["Ethernet4"], "fortyGigE0/4") + def test_teamd(self): argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"' output = self.run_script(argument) # Mock the output via config.sh in docker-teamd From b7d2009b14f9f3728e0dbd985102c57a65813d39 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 3 Apr 2017 23:56:15 -0700 Subject: [PATCH 0420/1833] [base image]: Install SwSS SDK Python 2 package into base image (#461) * [base image]: Install SwSS SDK Python packages (Python 2 & 3) into base image * Fix typo in existing variable name * Only install Python 2 version, as Python 3 is not installed in base image --- .../build_templates/sonic_debian_extension.j2 | 21 ++++++++++++------- slave.mk | 11 +++++----- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 2720514960a8..ed9d7d0b5075 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -61,14 +61,21 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in python-yaml \ python-bitarray -# Install SONiC config engine -CONFIG_ENGINE_WHL_NAME=`basename {{config_engine}}` -sudo cp {{config_engine}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHL_NAME -sudo LANG=C chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHL_NAME +# Install SONiC config engine Python package +CONFIG_ENGINE_WHEEL_NAME=$(basename {{config_engine_wheel_path}}) +sudo cp {{config_engine_wheel_path}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHEEL_NAME +sudo LANG=C chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHEEL_NAME +sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHEEL_NAME # Install Python client for Redis sudo LANG=C chroot $FILESYSTEM_ROOT pip install redis +# Install SwSS SDK Python 2 package +SWSSSDK_PY2_WHEEL_NAME=$(basename {{swsssdk_py2_wheel_path}}) +sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME +sudo LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME +sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME + # Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f @@ -120,7 +127,7 @@ sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ # Generate build version file export git_revision=$(git rev-parse --short HEAD) -export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version` +export debian_version=$(cat $FILESYSTEM_ROOT/etc/debian_version) export kernel_version={{kversion}} j2 $BUILD_TEMPLATES/sonic_version.yml.j2 > sonic_version.yml sudo mv sonic_version.yml $FILESYSTEM_ROOT/etc/sonic/ @@ -162,7 +169,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noni sudo mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}} sudo cp {{ deb }} $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/ -for f in `find $FILESYSTEM_ROOT/var/cache/apt/archives -name "*.deb"`; do +for f in $(find $FILESYSTEM_ROOT/var/cache/apt/archives -name "*.deb"); do sudo mv $f $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/ done @@ -181,7 +188,7 @@ sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/ sudo LANG=C chroot $FILESYSTEM_ROOT docker load < {{image}} {% endfor %} sudo chroot $FILESYSTEM_ROOT service docker stop -{% for script in installer_start_scrips.split(' ') -%} +{% for script in installer_start_scripts.split(' ') -%} sudo cp {{script}} $FILESYSTEM_ROOT/usr/bin/ {% endfor %} {% for service in installer_services.split(' ') -%} diff --git a/slave.mk b/slave.mk index 52d06c38fd93..77967c858bdf 100644 --- a/slave.mk +++ b/slave.mk @@ -307,14 +307,15 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" export linux_kernel="$(DEBS_PATH)/$(LINUX_KERNEL)" export kversion="$(KVERSION)" - export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))" - export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))" - export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" - export config_engine="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))" export image_type="$($*_IMAGE_TYPE)" export sonicadmin_user="$(USERNAME)" export sonic_asic_platform="$(CONFIGURED_PLATFORM)" export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" + export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))" + export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))" + export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" + export config_engine_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))" + export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))" $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" @@ -328,7 +329,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform chmod +x $($(docker)_CONTAINER_NAME).sh ) - export installer_start_scrips="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))" + export installer_start_scripts="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))" export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(docker)_CONTAINER_NAME)))" export installer_extra_files="$(foreach docker, $($*_DOCKERS), $(foreach file, $($(docker)_BASE_IMAGE_FILES), $($(docker)_PATH)/base_image_files/$(file)))" From bd6976a6fa74f0f6a540590ccfd7eb268a2c769d Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 4 Apr 2017 01:41:42 -0700 Subject: [PATCH 0421/1833] [interfaces]: Support ifup/ifdown on VLAN/LAG members (#462) - This change is added so that when doing ifdown/ifup to flap the interface, it will success even when the interface is already enslaved as a member of VLAN. - LAG members do not have IP addresses. Thus ifconfig command is needed. - Do not display comments when not necessary. Signed-off-by: Shuotian Cheng --- files/image_config/interfaces/interfaces.j2 | 14 ++++++++++++-- src/sonic-config-engine/tests/test_cfggen.py | 12 ++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 87efc8cfa8ef..53d324d68e8d 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -53,29 +53,36 @@ iface {{ interface['attachto'] }} {{ 'inet' if interface['addr'] | ipv4 else 'in netmask {{ interface['mask'] }} # {% endfor %} +{% if minigraph_vlans.keys() | length %} +# "|| true" is added to suppress the error when interface is already a member of VLAN +{% endif %} {% for vlan in minigraph_vlans.keys()|sort %} {% for member in minigraph_vlans[vlan]['members'] %} auto {{ member }} allow-hotplug {{ member }} iface {{ member }} inet manual pre-up ifconfig {{ member }} up - post-up brctl addif {{ vlan }} {{ member }} + post-up brctl addif {{ vlan }} {{ member }} || true post-down ifconfig {{ member }} down # {% endfor %} {% endfor %} -# "|| true" is added to suppress the error when docker-teamd starts after docker-swss +{% if minigraph_portchannels.keys() | length %} +# "|| true" is added to suppress the error when interface is already a member of LAG +{% endif %} {% for pc in minigraph_portchannels.keys()|sort %} {% for member in minigraph_portchannels[pc]['members'] %} auto {{ member }} allow-hotplug {{ member }} iface {{ member }} inet manual pre-up teamdctl {{ pc }} port add {{ member }} || true + post-up ifconfig {{ member }} up post-down ifconfig {{ member }} down # {% endfor %} {% endfor %} {% endblock front_panel_interfaces %} +{% if minigraph_vlans.keys() | length %} {% block vlan_interfaces %} # Vlan interfaces {% for vlan_interface in minigraph_vlan_interfaces %} @@ -87,6 +94,8 @@ iface {{ vlan_interface['attachto'] }} {{ 'inet' if vlan_interface['addr'] | ipv {% endfor %} # {% endblock vlan_interfaces %} +{% endif %} +{% if minigraph_portchannels.keys() | length %} {% block pc_interfaces %} # Portchannel interfaces {% for pc_interface in minigraph_portchannel_interfaces %} @@ -98,3 +107,4 @@ iface {{ pc_interface['attachto'] }} {{ 'inet' if pc_interface['addr'] | ipv4 el # {% endfor %} {% endblock pc_interfaces %} +{% endif %} diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 4f04d0ea5932..eb3e355718d7 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -53,7 +53,7 @@ def test_read_yaml(self): self.assertEqual(output.strip(), '[\'value1\', \'value2\']') def test_render_template(self): - argument = '-y ' + os.path.join(self.test_dir, 'test.yml') + ' -t' + os.path.join(self.test_dir, 'test.j2') + argument = '-y ' + os.path.join(self.test_dir, 'test.yml') + ' -t ' + os.path.join(self.test_dir, 'test.j2') output = self.run_script(argument) self.assertEqual(output.strip(), 'value1\nvalue2') @@ -63,27 +63,27 @@ def test_minigraph_acl(self): self.assertEqual(output.strip(), "{'DataAcl': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}") def test_minigraph_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_interfaces' output = self.run_script(argument) self.assertEqual(output.strip(), "[{'subnet': IPv4Network('10.0.0.58/31'), 'peer_addr': IPv4Address('10.0.0.59'), 'addr': IPv4Address('10.0.0.58'), 'mask': IPv4Address('255.255.255.254'), 'attachto': 'Ethernet0', 'prefixlen': 31}, {'subnet': IPv6Network('fc00::74/126'), 'peer_addr': IPv6Address('fc00::76'), 'addr': IPv6Address('fc00::75'), 'mask': '126', 'attachto': 'Ethernet0', 'prefixlen': 126}]") def test_minigraph_vlans(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_vlans' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_vlans' output = self.run_script(argument) self.assertEqual(output.strip(), "{'Vlan1000': {'name': 'Vlan1000', 'members': ['Ethernet8'], 'vlanid': '1000'}}") def test_minigraph_vlan_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_vlan_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_vlan_interfaces' output = self.run_script(argument) self.assertEqual(output.strip(), "[{'prefixlen': 27, 'subnet': IPv4Network('192.168.0.0/27'), 'mask': IPv4Address('255.255.255.224'), 'addr': IPv4Address('192.168.0.1'), 'attachto': 'Vlan1000'}]") def test_minigraph_portchannels(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannels' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannels' output = self.run_script(argument) self.assertEqual(output.strip(), "{'PortChannel01': {'name': 'PortChannel01', 'members': ['Ethernet4']}}") def test_minigraph_portchannels(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannel_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannel_interfaces' output = self.run_script(argument) self.assertEqual(output.strip(), "[{'subnet': IPv4Network('10.0.0.56/31'), 'peer_addr': IPv4Address('10.0.0.57'), 'addr': IPv4Address('10.0.0.56'), 'mask': IPv4Address('255.255.255.254'), 'attachto': 'PortChannel01', 'prefixlen': 31}, {'subnet': IPv6Network('fc00::70/126'), 'peer_addr': IPv6Address('fc00::72'), 'addr': IPv6Address('fc00::71'), 'mask': '126', 'attachto': 'PortChannel01', 'prefixlen': 126}]") From b0537eab73a0d5def6e9126e1704b10b7e7ad316 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 5 Apr 2017 13:16:20 -0700 Subject: [PATCH 0422/1833] [oneimage] Update dhclient.conf (#479) Add option 226 back and do slight adjustment to make sure the total option amount is not 16. --- files/dhcp/dhclient.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/dhcp/dhclient.conf b/files/dhcp/dhclient.conf index f97b56dfd5a6..363a67b50f9e 100644 --- a/files/dhcp/dhclient.conf +++ b/files/dhcp/dhclient.conf @@ -19,7 +19,7 @@ option acl-url code 226 = text; send host-name = gethostname(); request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, domain-search, host-name, - dhcp6.name-servers, dhcp6.domain-search, - netbios-name-servers, netbios-scope, interface-mtu, - rfc3442-classless-static-routes, ntp-servers, snmp-community, minigraph-url; + dhcp6.name-servers, dhcp6.domain-search, interface-mtu, + rfc3442-classless-static-routes, ntp-servers, + snmp-community, minigraph-url, acl-url; From e0a3c2aa57c1fa5884dec5fba670902f48b9aad2 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 5 Apr 2017 14:20:02 -0700 Subject: [PATCH 0423/1833] [oneimage] Add ":latest" to docker run script (#477) --- files/build_templates/docker_image_ctl.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 09d39db09577..3df04b698ccb 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -14,7 +14,7 @@ start() { -v /var/run/redis:/var/run/redis:rw \ -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ - --name={{docker_container_name}} {{docker_image_name}} + --name={{docker_container_name}} {{docker_image_name}}:latest fi } From f4bc4a68b8e7296b62f28ad397e16f69851a5afb Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 5 Apr 2017 14:25:59 -0700 Subject: [PATCH 0424/1833] [sonic-cfggen]: Remove extra Nones when return (#481) Signed-off-by: Shuotian Cheng --- src/sonic-config-engine/minigraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 523c11ea1ada..db4137a44a39 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -233,7 +233,7 @@ def parse_dpg(dpg, hname): acls[aclname] = acl_intfs return intfs, lo_intfs, mgmt_intf, vlans, pcs, acls - return None, None, None, None, None, None, None, None + return None, None, None, None, None, None def parse_cpg(cpg, hname): From 803c530adf45ed75dca5931bc0210721725cfcd7 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 5 Apr 2017 14:32:03 -0700 Subject: [PATCH 0425/1833] [installer]: remove dockerfs archive file after unzip (#476) --- installer/x86_64/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 0d2d76a2cd9e..94cf0e29881c 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -402,7 +402,7 @@ ${onie_bin} mount -t ext4 -o defaults,rw $demo_dev $demo_mnt || { unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt if [ -f $demo_mnt/$FILESYSTEM_DOCKERFS ]; then - cd $demo_mnt && mkdir -p $DOCKERFS_DIR && tar xf $FILESYSTEM_DOCKERFS -C $DOCKERFS_DIR; cd $OLDPWD + cd $demo_mnt && mkdir -p $DOCKERFS_DIR && tar xf $FILESYSTEM_DOCKERFS -C $DOCKERFS_DIR && rm -f $FILESYSTEM_DOCKERFS; cd $OLDPWD fi # Create loop device for /var/log to limit its size to $VAR_LOG_SIZE MB From 6dbe979e5f4dfcaddcbbef612d76f29d39c242d8 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 6 Apr 2017 02:14:41 +0300 Subject: [PATCH 0426/1833] [build]: Include SONiC version into installer. (#472) * [build]: Include SONiC version into installer. Signed-off-by: marian-pritsak * Append dirty if contains local changes Signed-off-by: marian-pritsak * Update config * Use correct name for kernel version field * Update sysDescription.j2 --- Makefile | 3 ++- build_debian.sh | 11 +++++++++++ build_image.sh | 15 +++------------ dockers/docker-snmp-sv2/sysDescription.j2 | 2 +- files/build_templates/sonic_debian_extension.j2 | 7 ------- files/build_templates/sonic_version.yml.j2 | 5 ----- functions.sh | 15 +++++++++++++++ rules/config | 4 ---- slave.mk | 3 ++- sonic-slave/Dockerfile | 4 ++++ 10 files changed, 38 insertions(+), 31 deletions(-) delete mode 100644 files/build_templates/sonic_version.yml.j2 diff --git a/Makefile b/Makefile index 3b9a8645ce92..38e90f2bfae0 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ DOCKER_BUILD = docker build --no-cache \ --build-arg user=$(USER) \ --build-arg uid=$(shell id -u) \ --build-arg guid=$(shell id -g) \ + --build-arg hostname=$(shell echo $$HOSTNAME) \ -t $(SLAVE_IMAGE) \ sonic-slave && \ docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG) @@ -36,7 +37,7 @@ DOCKER_BUILD = docker build --no-cache \ -C sonic \ -f slave.mk \ PLATFORM=$(PLATFORM) \ - DEBUG_BUILD=$(DEBUG_BUILD) \ + BUILD_NUMBER=$(BUILD_NUMBER) \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ $@ diff --git a/build_debian.sh b/build_debian.sh index 0bce39736b9f..a796a243363d 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -257,6 +257,17 @@ sudo cp files/dhcp/graphserviceurl $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks sudo cp files/dhcp/snmpcommunity $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d/ sudo cp files/dhcp/dhclient.conf $FILESYSTEM_ROOT/etc/dhcp/ +## Version file +sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic +sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml > /dev/null < files/Aboot/boot0 pushd files/Aboot && zip -g $OLDPWD/$OUTPUT_ABOOT_IMAGE boot0; popd pushd files/Aboot && zip -g $OLDPWD/$ABOOT_BOOT_IMAGE boot0; popd - echo "$GIT_REVISION" >> .imagehash + echo "$IMAGE_VERSION" >> .imagehash zip -g $OUTPUT_ABOOT_IMAGE .imagehash zip -g $ABOOT_BOOT_IMAGE .imagehash rm .imagehash diff --git a/dockers/docker-snmp-sv2/sysDescription.j2 b/dockers/docker-snmp-sv2/sysDescription.j2 index 54860a229d8b..648ed161046e 100644 --- a/dockers/docker-snmp-sv2/sysDescription.j2 +++ b/dockers/docker-snmp-sv2/sysDescription.j2 @@ -1 +1 @@ -SONiC Software Version: {{ build_version }}.SONiC.v2 - HwSku: {{ minigraph_hwsku }} - Distribution: Debian {{ debian_version }} - Kernel: {{ kernel_version }} +SONiC Software Version: SONiC.{{ build_version }} - HwSku: {{ minigraph_hwsku }} - Distribution: Debian {{ debian_version }} - Kernel: {{ kernel_version }} diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index ed9d7d0b5075..77fcd1f38655 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -125,13 +125,6 @@ sudo bash -c "echo enabled=false > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ -# Generate build version file -export git_revision=$(git rev-parse --short HEAD) -export debian_version=$(cat $FILESYSTEM_ROOT/etc/debian_version) -export kernel_version={{kversion}} -j2 $BUILD_TEMPLATES/sonic_version.yml.j2 > sonic_version.yml -sudo mv sonic_version.yml $FILESYSTEM_ROOT/etc/sonic/ - # Copy sudoers configuration file sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ diff --git a/files/build_templates/sonic_version.yml.j2 b/files/build_templates/sonic_version.yml.j2 deleted file mode 100644 index 6eb8a6d6c5e4..000000000000 --- a/files/build_templates/sonic_version.yml.j2 +++ /dev/null @@ -1,5 +0,0 @@ -build_version: {{git_revision}} -debian_version: {{debian_version}} -kernel_version: {{kernel_version}} -asic_type: {{sonic_asic_platform}} - diff --git a/functions.sh b/functions.sh index b808f727278f..8b2cdb7c50dd 100644 --- a/functions.sh +++ b/functions.sh @@ -49,3 +49,18 @@ docker_try_rmi() { docker rmi $image_name } } + +sonic_get_version() { + local describe=$(git describe --tags) + local latest_tag=$(git describe --tags --abbrev=0) + if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then + local dirty="-dirty" + fi + BUILD_NUMBER=${BUILD_NUMBER:-0} + ## Check if we are on tagged commit + if [ "$describe" == "$latest_tag" ]; then + echo "${latest_tag}${dirty}" + else + echo "${latest_tag}.${BUILD_NUMBER}${dirty:--$(git rev-parse --short HEAD)}" + fi +} diff --git a/rules/config b/rules/config index d016288e4776..dcfa40c7459e 100644 --- a/rules/config +++ b/rules/config @@ -11,10 +11,6 @@ # Uncomment next line to enable: # SONIC_CONFIG_PRINT_DEPENDENCIES = y -# DEBUG_BUILD - enable building image with uncommitted local changes. -# Uncomment next line to enable: -# DEBUG_BUILD = y - # SONIC_CONFIG_BUILD_JOBS - set number of jobs for parallel build. # Corresponding -j argument will be passed to make command inside docker # container. diff --git a/slave.mk b/slave.mk index 77967c858bdf..4f3761aa2263 100644 --- a/slave.mk +++ b/slave.mk @@ -26,6 +26,7 @@ PROJECT_ROOT = $(shell pwd) CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo generic) PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM) +export BUILD_NUMBER ############################################################################### ## Utility rules @@ -342,7 +343,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform ) ./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG) - TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) DEBUG_BUILD=$(DEBUG_BUILD) ./build_image.sh $(LOG) + TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) ./build_image.sh $(LOG) $(foreach docker, $($*_DOCKERS), \ rm -f $($(docker)_CONTAINER_NAME).sh diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index b8b31940a98d..bec18bfbaed7 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -110,6 +110,10 @@ RUN echo "DOCKER_OPTS=\"--experimental\"" >> /etc/default/docker ARG user ARG uid ARG guid +ARG hostname + +ENV BUILD_HOSTNAME $hostname +ENV USER $user RUN groupadd -f -r -g $guid g$user From eef859baf98ec27a6ef4d46725045771b9042230 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 5 Apr 2017 16:22:19 -0700 Subject: [PATCH 0427/1833] [interfaces]: Do not bring up LAG members when LAG is not up (#480) - Do not bring up LAG member ports when LAG is not created. This is because LAG member ports must be DOWN when joining the teamd instances due to teamd design. Therefore, we cannot bring up a LAG member port first and then join the port to a LAG. Signed-off-by: Shuotian Cheng --- files/image_config/interfaces/interfaces.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 53d324d68e8d..40e127e54ce8 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -76,7 +76,7 @@ auto {{ member }} allow-hotplug {{ member }} iface {{ member }} inet manual pre-up teamdctl {{ pc }} port add {{ member }} || true - post-up ifconfig {{ member }} up + post-up ip link show {{ pc }} && ifconfig {{ member }} up post-down ifconfig {{ member }} down # {% endfor %} From 84a8b0d1f79488136560de3e38444a33950d8b8e Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 6 Apr 2017 14:59:30 -0700 Subject: [PATCH 0428/1833] [minigraph]: Fix a bug of minigraph_neighbors (#485) Signed-off-by: Shuotian Cheng --- src/sonic-config-engine/minigraph.py | 2 +- src/sonic-config-engine/tests/test_cfggen.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index db4137a44a39..2b020456475f 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -73,7 +73,7 @@ def parse_png(png, hname): neighbors[endport] = {'name': startdevice, 'port': startport} else: if port_alias_map.has_key(startport): - endport = port_alias_map[startport] + startport = port_alias_map[startport] neighbors[startport] = {'name': enddevice, 'port': endport} if child.tag == str(QName(ns, "Devices")): diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index eb3e355718d7..e4017a51f8c6 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -87,3 +87,7 @@ def test_minigraph_portchannels(self): output = self.run_script(argument) self.assertEqual(output.strip(), "[{'subnet': IPv4Network('10.0.0.56/31'), 'peer_addr': IPv4Address('10.0.0.57'), 'addr': IPv4Address('10.0.0.56'), 'mask': IPv4Address('255.255.255.254'), 'attachto': 'PortChannel01', 'prefixlen': 31}, {'subnet': IPv6Network('fc00::70/126'), 'peer_addr': IPv6Address('fc00::72'), 'addr': IPv6Address('fc00::71'), 'mask': '126', 'attachto': 'PortChannel01', 'prefixlen': 126}]") + def test_minigraph_neighbors(self): + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v minigraph_neighbors' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'Ethernet116': {'name': 'ARISTA02T1', 'port': 'Ethernet1/1'}, 'Ethernet124': {'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}, 'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}, 'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}}") From 0db93789dbd5467903d0366fa0ab9ea73652a2c6 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 6 Apr 2017 23:40:12 -0700 Subject: [PATCH 0429/1833] [sonic-utilities]: Update submodule to include CLI fixes (#484) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 03488ff6e768..52cff2aa4412 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 03488ff6e7684c807351158db8f70d89f126d8b2 +Subproject commit 52cff2aa4412d3da78f4bb7cfe3018d427fb5d01 From ebed2d0182856074635fe35ce419b9a540ce1204 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 7 Apr 2017 01:10:05 -0700 Subject: [PATCH 0430/1833] [config/acl] Support everflow config translation (#468) --- sonic-slave/Dockerfile | 1 + src/sonic-config-engine/MANIFEST.in | 2 +- src/sonic-config-engine/minigraph.py | 11 +- .../sample_output/rules_for_dataacl.json | 29 ++ .../sample_output/rules_for_everflow.json | 14 + .../tests/sample_output/table_dataacl.json | 10 + .../tests/sample_output/table_everflow.json | 10 + .../tests/t0-sample-acl.json | 97 ++++++ .../tests/t0-sample-graph-everflow.xml | 320 ++++++++++++++++++ src/sonic-config-engine/tests/test_acl.py | 58 ++++ src/sonic-config-engine/tests/test_cfggen.py | 2 +- src/sonic-config-engine/translate_acl | 31 +- 12 files changed, 567 insertions(+), 18 deletions(-) create mode 100644 src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json create mode 100644 src/sonic-config-engine/tests/sample_output/rules_for_everflow.json create mode 100644 src/sonic-config-engine/tests/sample_output/table_dataacl.json create mode 100644 src/sonic-config-engine/tests/sample_output/table_everflow.json create mode 100644 src/sonic-config-engine/tests/t0-sample-acl.json create mode 100644 src/sonic-config-engine/tests/t0-sample-graph-everflow.xml create mode 100644 src/sonic-config-engine/tests/test_acl.py diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index bec18bfbaed7..6ca6e93c5f45 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -91,6 +91,7 @@ RUN apt-get update && apt-get install -y docutils-common libjs-sphinxdoc libjs-u # For sonic config engine testing RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml +RUN pip install pyangbind # For templating RUN pip install j2cli diff --git a/src/sonic-config-engine/MANIFEST.in b/src/sonic-config-engine/MANIFEST.in index a7038d546e9c..8861dd66030e 100644 --- a/src/sonic-config-engine/MANIFEST.in +++ b/src/sonic-config-engine/MANIFEST.in @@ -1 +1 @@ -recursive-include tests *.j2 *.yml *.xml +recursive-include tests *.j2 *.yml *.xml *.json diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 2b020456475f..709a7a2846ff 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -218,9 +218,10 @@ def parse_dpg(dpg, hname): aclintfs = child.find(str(QName(ns, "AclInterfaces"))) acls = {} for aclintf in aclintfs.findall(str(QName(ns, "AclInterface"))): - aclname = aclintf.find(str(QName(ns, "InAcl"))).text + aclname = aclintf.find(str(QName(ns, "InAcl"))).text.lower().replace(" ", "_").replace("-", "_") aclattach = aclintf.find(str(QName(ns, "AttachTo"))).text.split(';') acl_intfs = [] + is_mirror = False for member in aclattach: member = member.strip() if pcs.has_key(member): @@ -229,9 +230,13 @@ def parse_dpg(dpg, hname): print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a Vlan interface, which is currently not supported" elif port_alias_map.has_key(member): acl_intfs.append(port_alias_map[member]) + elif member.lower() == 'erspan': + is_mirror = True; + # Erspan session will be attached to all front panel ports + acl_intfs = port_alias_map.values() + break; if acl_intfs: - acls[aclname] = acl_intfs - + acls[aclname] = { 'AttachTo': acl_intfs, 'IsMirror': is_mirror } return intfs, lo_intfs, mgmt_intf, vlans, pcs, acls return None, None, None, None, None, None diff --git a/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json b/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json new file mode 100644 index 000000000000..9fd0199c4cf2 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json @@ -0,0 +1,29 @@ +[ + { + "ACL_RULE_TABLE:dataacl:Rule_1":{ + "IP_PROTOCOL":17, + "PACKET_ACTION":"FORWARD", + "SRC_IP":"10.0.0.0/8", + "priority":9999 + }, + "OP":"SET" + }, + { + "ACL_RULE_TABLE:dataacl:Rule_3":{ + "IP_PROTOCOL":17, + "PACKET_ACTION":"FORWARD", + "SRC_IP":"25.0.0.0/8", + "priority":9997 + }, + "OP":"SET" + }, + { + "ACL_RULE_TABLE:dataacl:Rule_2":{ + "IP_PROTOCOL":17, + "PACKET_ACTION":"FORWARD", + "SRC_IP":"100.64.0.0/10", + "priority":9998 + }, + "OP":"SET" + } +] \ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/rules_for_everflow.json b/src/sonic-config-engine/tests/sample_output/rules_for_everflow.json new file mode 100644 index 000000000000..c31965e31e27 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/rules_for_everflow.json @@ -0,0 +1,14 @@ +[ + { + "ACL_RULE_TABLE:everflow:Rule_1":{ + "DST_IP":"127.0.0.1/32", + "IP_PROTOCOL":6, + "L4_DST_PORT":0, + "L4_SRC_PORT":0, + "MIRROR_ACTION":"everflow", + "SRC_IP":"127.0.0.1/32", + "priority":9999 + }, + "OP":"SET" + } +] \ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/table_dataacl.json b/src/sonic-config-engine/tests/sample_output/table_dataacl.json new file mode 100644 index 000000000000..ed10f3195636 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/table_dataacl.json @@ -0,0 +1,10 @@ +[ + { + "ACL_TABLE:dataacl":{ + "policy_desc":"dataacl", + "ports":"Ethernet112,Ethernet116,Ethernet120,Ethernet124", + "type":"L3" + }, + "OP":"SET" + } +] \ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/table_everflow.json b/src/sonic-config-engine/tests/sample_output/table_everflow.json new file mode 100644 index 000000000000..4f3411ed8874 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/table_everflow.json @@ -0,0 +1,10 @@ +[ + { + "ACL_TABLE:everflow":{ + "policy_desc":"everflow", + "ports":"Ethernet24,Ethernet40,Ethernet20,Ethernet44,Ethernet48,Ethernet28,Ethernet96,Ethernet92,Ethernet76,Ethernet116,Ethernet72,Ethernet112,Ethernet52,Ethernet108,Ethernet56,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet120,Ethernet8,Ethernet4,Ethernet0,Ethernet124,Ethernet68,Ethernet84,Ethernet100,Ethernet80,Ethernet60,Ethernet104,Ethernet64,Ethernet88", + "type":"mirror" + }, + "OP":"SET" + } +] \ No newline at end of file diff --git a/src/sonic-config-engine/tests/t0-sample-acl.json b/src/sonic-config-engine/tests/t0-sample-acl.json new file mode 100644 index 000000000000..e04971e5f2ec --- /dev/null +++ b/src/sonic-config-engine/tests/t0-sample-acl.json @@ -0,0 +1,97 @@ +{ + "acl": { + "acl-sets": { + "acl-set": { + "dataacl": { + "acl-entries": { + "acl-entry": { + "1": { + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "config": { + "sequence-id": 1 + }, + "ip": { + "config": { + "protocol": "IP_UDP", + "source-ip-address": "10.0.0.0/8" + } + } + }, + "2": { + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "config": { + "sequence-id": 2 + }, + "ip": { + "config": { + "protocol": "IP_UDP", + "source-ip-address": "100.64.0.0/10" + } + } + }, + "3": { + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "config": { + "sequence-id": 3 + }, + "ip": { + "config": { + "protocol": "IP_UDP", + "source-ip-address": "25.0.0.0/8" + } + } + } + } + }, + "config": { + "name": "dataacl" + } + }, + "everflow": { + "acl-entries": { + "acl-entry": { + "1": { + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "config": { + "sequence-id": 1 + }, + "ip": { + "config": { + "destination-ip-address": "127.0.0.1/32", + "protocol": "IP_TCP", + "source-ip-address": "127.0.0.1/32" + } + }, + "transport": { + "config": { + "destination-port": "0", + "source-port": "0" + } + } + } + } + }, + "config": { + "name": "everflow" + } + } + } + } + } +} diff --git a/src/sonic-config-engine/tests/t0-sample-graph-everflow.xml b/src/sonic-config-engine/tests/t0-sample-graph-everflow.xml new file mode 100644 index 000000000000..355f01122f0d --- /dev/null +++ b/src/sonic-config-engine/tests/t0-sample-graph-everflow.xml @@ -0,0 +1,320 @@ + + + + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 180 + 60 + + + switch-t0 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 180 + 60 + + + switch-t0 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 180 + 60 + + + + + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/112 + + + + PortChannel02 + fortyGigE0/116 + + + + PortChannel03 + fortyGigE0/120 + + + + PortChannel04 + fortyGigE0/124 + + + + + + Vlan1000 + fortyGigE0/4;fortyGigE0/8;fortyGigE0/12;fortyGigE0/16;fortyGigE0/20;fortyGigE0/24;fortyGigE0/28;fortyGigE0/32;fortyGigE0/36;fortyGigE0/40;fortyGigE0/44;fortyGigE0/48;fortyGigE0/52;fortyGigE0/56;fortyGigE0/60;fortyGigE0/64;fortyGigE0/68;fortyGigE0/72;fortyGigE0/76;fortyGigE0/80;fortyGigE0/84;fortyGigE0/88;fortyGigE0/92;fortyGigE0/96 + False + 0.0.0.0/0 + + 1000 + 1000 + 192.168.0.0/27 + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + PortChannel02 + 10.0.0.58/31 + + + + PortChannel02 + FC00::75/126 + + + + PortChannel03 + 10.0.0.60/31 + + + + PortChannel03 + FC00::79/126 + + + + PortChannel04 + 10.0.0.62/31 + + + + PortChannel04 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/27 + + + + + + ERSPAN + everflow + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1/1 + switch-t0 + fortyGigE0/112 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1/1 + switch-t0 + fortyGigE0/116 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1/1 + switch-t0 + fortyGigE0/120 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1/1 + switch-t0 + fortyGigE0/124 + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/test_acl.py b/src/sonic-config-engine/tests/test_acl.py new file mode 100644 index 000000000000..319b2c1f73a7 --- /dev/null +++ b/src/sonic-config-engine/tests/test_acl.py @@ -0,0 +1,58 @@ +import filecmp +import os +import subprocess + +from unittest import TestCase + +class TestAcl(TestCase): + def setUp(self): + self.test_dir = os.path.dirname(os.path.realpath(__file__)) + self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') + self.acl_script_file = os.path.join(self.test_dir, '..', 'translate_acl') + self.t0_minigraph = os.path.join(self.test_dir, 't0-sample-graph.xml') + self.t0_minigraph_everflow = os.path.join(self.test_dir, 't0-sample-graph-everflow.xml') + self.t0_acl = os.path.join(self.test_dir, 't0-sample-acl.json') + self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') + + def run_script(self, argument): + print 'CMD: sonic-cfggen ' + argument + output = '' + try: + output = subprocess.check_output(self.script_file + ' ' + argument, shell=True, stderr=subprocess.STDOUT) + except subprocess.CalledProcessError, (p): + print 'CalledProcessError: CMD:%s returncode:%s' % (p.cmd, p.returncode) + print p.output + return output + + def run_acl_script(self, argument): + print 'CMD: translate_acl ' + argument + output = '' + try: + output = subprocess.check_output(self.acl_script_file + ' ' + argument, shell=True, stderr=subprocess.STDOUT) + except subprocess.CalledProcessError, (p): + print 'CalledProcessError: CMD:%s returncode:%s' % (p.cmd, p.returncode) + print p.output + return output + + def test_translate_acl(self): + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -o ' + self.test_dir + ' ' + self.t0_acl + self.run_acl_script(argument) + for filename in ['rules_for_dataacl.json','table_dataacl.json']: + sample_output_file = os.path.join(self.test_dir, 'sample_output', filename) + output_file = os.path.join(self.test_dir, filename) + assert filecmp.cmp(sample_output_file, output_file) + + def test_translate_everflow(self): + argument = '-m ' + self.t0_minigraph_everflow + ' -p ' + self.t0_port_config + ' -o ' + self.test_dir + ' ' + self.t0_acl + self.run_acl_script(argument) + for filename in ['rules_for_everflow.json','table_everflow.json']: + sample_output_file = os.path.join(self.test_dir, 'sample_output', filename) + output_file = os.path.join(self.test_dir, filename) + assert filecmp.cmp(sample_output_file, output_file) + + def tearDown(self): + for filename in ['rules_for_dataacl.json','table_dataacl.json','rules_for_everflow.json','table_everflow.json']: + try: + os.remove(os.path.join(self.test_dir, filename)) + except OSError: + pass diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index e4017a51f8c6..83c678fff7b9 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -60,7 +60,7 @@ def test_render_template(self): def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v minigraph_acls' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'DataAcl': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}") + self.assertEqual(output.strip(), "{'dataacl': {'IsMirror': False, 'AttachTo': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") def test_minigraph_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_interfaces' diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl index 2c4410615d6e..6ee89cfd4612 100755 --- a/src/sonic-config-engine/translate_acl +++ b/src/sonic-config-engine/translate_acl @@ -13,7 +13,7 @@ def dump_json(filename, data): with open(filename, 'w') as outfile: json.dump(data, outfile, indent=4, sort_keys=True, separators=(',', ':')) -def generate_rule_json(table_name, rule, max_priority): +def generate_rule_json(table_name, rule, max_priority, mirror): rule_idx = rule.config.sequence_id rule_props = {} rule_data = {} @@ -22,7 +22,10 @@ def generate_rule_json(table_name, rule, max_priority): rule_props["priority"] = max_priority - rule_idx if rule.actions.config.forwarding_action == "ACCEPT": - rule_props["PACKET_ACTION"] = "FORWARD" + if mirror: + rule_props["MIRROR_ACTION"] = "everflow" + else: + rule_props["PACKET_ACTION"] = "FORWARD" elif rule.actions.config.forwarding_action == "DROP": rule_props["PACKET_ACTION"] = "DROP" elif rule.actions.config.forwarding_action == "REJECT": @@ -97,14 +100,14 @@ def generate_rule_json(table_name, rule, max_priority): rule_props["TCP_FLAGS"] = '0x{:02x}'.format(tcp_flags) return rule_data -def generate_table_json(aclset, aclname, port, max_priority, output_path='.'): +def generate_table_json(aclset, aclname, ports, mirror, max_priority, output_path='.'): table_name = aclname.replace(" ", "_").replace("-", "_") #table_name = generate_random_table_name() table_props = {} table_props["policy_desc"] = table_name - table_props["type"] = "L3" - table_props["ports"] = port + table_props["type"] = "mirror" if mirror else "L3" + table_props["ports"] = ports table_data = [{}] table_data[0]["ACL_TABLE:"+table_name] = table_props @@ -114,7 +117,7 @@ def generate_table_json(aclset, aclname, port, max_priority, output_path='.'): rule_data = [] for aclentryname in aclset.acl_entries.acl_entry: aclentry = aclset.acl_entries.acl_entry[aclentryname] - rule_props = generate_rule_json(table_name, aclentry, max_priority) + rule_props = generate_rule_json(table_name, aclentry, max_priority, mirror) if rule_props: rule_data.append(rule_props) @@ -127,29 +130,31 @@ def translate_acl_fixed_port(filename, output_path, port, max_priority): generate_table_json(aclset, aclsetname, port, max_priority, output_path) return -def translate_acl(filename, output_path, attach_to, max_priority): +def translate_acl(filename, output_path, mini_acl, max_priority): yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") for aclsetname in yang_acl.acl.acl_sets.acl_set: tablename = aclsetname.replace(" ", "_").replace("-", "_") - if attach_to.has_key(tablename): - port = ','.join(attach_to[tablename]) + if mini_acl.has_key(tablename): + is_mirror = mini_acl[tablename]['IsMirror'] + ports = ','.join(mini_acl[tablename]['AttachTo']) aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] - generate_table_json(aclset, aclsetname, port, max_priority, output_path) + generate_table_json(aclset, aclsetname, ports, is_mirror, max_priority, output_path) return def main(): parser = argparse.ArgumentParser(description="Translate openconfig ACL json into SONiC ACL jsons") parser.add_argument('input', metavar='INPUT', help='input json file in openconfig format') group = parser.add_mutually_exclusive_group(required=True) - group.add_argument('-p', '--port', help='the port(s) that this ACL is attached to') + group.add_argument('-a', '--attach-to', help='the port(s) that this ACL is attached to') group.add_argument('-m', '--minigraph', help='read ACL attaching information from minigraph') + parser.add_argument("-p", "--port-config", help="port config file, used with -m") parser.add_argument('-n', '--max-priority', type=int, default=10000, help='the priority number of the first rule in ACL entries') parser.add_argument('-o', '--output-path', default='.', help='output directory where SONiC ACL jsons will be generated') args = parser.parse_args() - if args.port: + if args.attach_to: translate_acl_fixed_port(args.input, args.output_path, args.port, args.max_priority) elif args.minigraph: - mini_data = parse_xml(args.minigraph) + mini_data = parse_xml(args.minigraph, port_config_file=args.port_config) if mini_data['minigraph_acls']: translate_acl(args.input, args.output_path, mini_data['minigraph_acls'], args.max_priority) From b0901ecb8ee000f83ee457650fe4b5b05d3adb7e Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 7 Apr 2017 11:26:45 -0700 Subject: [PATCH 0431/1833] [broadcom]: Update Broadcom debian packages and add config.bcm files (#478) --- .../INGRASYS-S9100-C32/sai.profile | 2 +- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile index 1b6009956e90..a431427469e3 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-ingrasys-s9100-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/etc/bcm/th-s9100-32x100G.config.bcm diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index ace7617f7ff4..4e8a740136e4 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-20170303234832.14_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-20170303234832.14_amd64.deb?sv=2015-04-05&sr=b&sig=gZKsefmpU6Xc6X0emxjlGKwf1aPsyxloulhXL0qGgFc%3D&se=2030-11-10T23%3A58%3A37Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-1-20170407044929.18_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-1-20170407044929.18_amd64.deb?sv=2015-04-05&sr=b&sig=lKKP8Ot01SW9NwbbnafZly5rTkIK2rpTdBuUwcWdr5U%3D&se=2030-12-15T04%3A51%3A54Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-20170303234832.14_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-1-20170407044929.18_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-20170303234832.14_amd64.deb?sv=2015-04-05&sr=b&sig=kEhXcoL0iOUpnuGJLduktluImi0eQVHAjGunGbipa28%3D&se=2030-11-10T23%3A59%3A08Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-1-20170407044929.18_amd64.deb?sv=2015-04-05&sr=b&sig=AsDdE0zR3aTxwdK76Iro0jGypl%2FSqVoYmwz0drr78Ho%3D&se=2030-12-15T04%3A52%3A31Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 57583bb178f7..760eee516600 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-20170303224751.24_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-20170303224751.24_amd64.deb?sv=2015-04-05&sr=b&sig=rFu55R4M6M9vJ%2FlJgv6wvp2fbZnKpiHNnhzCddEidgo%3D&se=2030-11-10T23%3A59%3A41Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.2.2-1-20170406004418.26_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-1-20170406004418.26_amd64.deb?sv=2015-04-05&sr=b&sig=aWbjpqH2A5JewLoVs8o%2BkriOCRvqDwuVTZygwy%2B1XMQ%3D&se=2030-12-14T19%3A41%3A16Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-20170303224751.24_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-20170303224751.24_amd64.deb?sv=2015-04-05&sr=b&sig=DMN91a5PwxG7ow15K1YyHudRF%2F2l0ipAXJ7c1dOW6QY%3D&se=2030-11-11T00%3A00%3A09Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-1-20170406004418.26_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-1-20170406004418.26_amd64.deb?sv=2015-04-05&sr=b&sig=fL88BnMJ9uMMozh6xDqYn7oDc%2FwhX53sd3WG1v%2BkqDA%3D&se=2030-12-14T19%3A40%3A23Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 263c1bf85281b6b509996720570971f4378fd020 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Fri, 7 Apr 2017 11:28:07 -0700 Subject: [PATCH 0432/1833] [sonic-utilities]: Update submodule (#488) [portstat]: return N/A if no counter info exists (#29) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 52cff2aa4412..ea8ceba23f10 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 52cff2aa4412d3da78f4bb7cfe3018d427fb5d01 +Subproject commit ea8ceba23f104f27453db77bcffaebcfe2f3376f From 1458e9ea6bf9a20b847354703c884d75ca373395 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 7 Apr 2017 15:28:30 -0700 Subject: [PATCH 0433/1833] [aboot]: add varlog limit file in aboot image (#487) * [aboot]: add varlog limit file in aboot image --- files/Aboot/boot0.j2 | 3 ++- files/initramfs-tools/arista-convertfs.j2 | 30 ++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 0905faad4c5d..6460ddbbecfc 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -47,7 +47,6 @@ extract_image() { rm -rf "$target_path/$f" fi done - ## Unzip the image unzip -oq "$swipath" -x boot0 -d "$target_path" @@ -102,6 +101,8 @@ platform_specific() { if [ "$platform" = "raven" ]; then aboot_machine=arista_7050_qx32 echo "modprobe.blacklist=radeon" >>/tmp/append + # set varlog size to 100MB + echo "varlog_size=100" >>/tmp/append fi if [ "$platform" = "crow" ]; then aboot_machine=arista_7050_qx32s diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 8847bc69bdfa..6e3f2d633bff 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -82,6 +82,28 @@ run_cmd() { fi } +create_varlog_file() { + local err_msg="Error: create var-log ext4 file" + local cmd="[ -n $varlog_size ] && mkdir -p $root_mnt/disk-img && dd if=/dev/zero of=$root_mnt/disk-img/var-log.ext4 count=$((2048*$varlog_size)) && mke2fs -t ext4 -q -F $root_mnt/disk-img/var-log.ext4" + run_cmd "$cmd" "$err_msg" +} + +mount_and_create_varlog_file() { + [ -z "$varlog_size" ] && exit 0 + mkdir -p "$root_mnt" + mount -t ext4 "$root_dev" "$root_mnt" + # exit when the var_log.ext4 exists and the size matches + if [ -e "$root_mnt/disk-img/var-log.ext4" ]; then + cur_varlog_size=$(ls -l $root_mnt/disk-img/var-log.ext4 | awk '{print $5}') + if [ $cur_varlog_size == $((1024*1024*$varlog_size)) ]; then + exit 0 + fi + fi + create_varlog_file + umount "$root_mnt" + exit 0 +} + # Extract kernel parameters set -- $(cat /proc/cmdline) for x in "$@"; do @@ -91,6 +113,9 @@ for x in "$@"; do ;; Aboot=*) aboot_flag="${x#Aboot=}" + ;; + varlog_size=*) + varlog_size="${x#varlog_size=}" esac done root_dev="$ROOT" @@ -105,8 +130,9 @@ if ! wait_for_root_dev; then echo "Error: timeout in waiting for $root_dev" exit 1 fi -blkid | grep "$root_dev.*vfat" -q || exit 0 +# mount, create varlog file and exit when the root is ext4 +blkid | grep "$root_dev.*vfat" -q || mount_and_create_varlog_file # Get flash dev name if [ -z "$block_flash" ]; then @@ -171,3 +197,5 @@ run_cmd "$cmd" "$err_msg" err_msg="Error: copying files form $tmp_mnt to $root_mnt failed" cmd="cp -a $tmp_mnt/. $root_mnt/" run_cmd "$cmd" "$err_msg" + +create_varlog_file From fcc9c84aa6dc3c6ee2156af87206ffb4dc92e861 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 10 Apr 2017 01:11:26 -0700 Subject: [PATCH 0434/1833] [build]: use branch name instead of latest tag for dev build (#490) --- functions.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions.sh b/functions.sh index 8b2cdb7c50dd..8ca3d5422340 100644 --- a/functions.sh +++ b/functions.sh @@ -53,6 +53,7 @@ docker_try_rmi() { sonic_get_version() { local describe=$(git describe --tags) local latest_tag=$(git describe --tags --abbrev=0) + local branch_name=$(git rev-parse --abbrev-ref HEAD) if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then local dirty="-dirty" fi @@ -61,6 +62,6 @@ sonic_get_version() { if [ "$describe" == "$latest_tag" ]; then echo "${latest_tag}${dirty}" else - echo "${latest_tag}.${BUILD_NUMBER}${dirty:--$(git rev-parse --short HEAD)}" + echo "${branch_name}.${BUILD_NUMBER}${dirty:--$(git rev-parse --short HEAD)}" fi } From 24bad71a6067ff56598a456dd12bd1860fbf34f8 Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Tue, 11 Apr 2017 02:14:08 +0800 Subject: [PATCH 0435/1833] [platform]: Add plugins for ingrasys (#486) * Adding two utilities: eeprom.py and sfputil.py --- .../plugins/eeprom.py | 22 +++++++ .../plugins/sfputil.py | 60 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/eeprom.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/eeprom.py new file mode 100644 index 000000000000..83bf65a389bd --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S9100 +# +# 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-9/9-0054/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py new file mode 100644 index 000000000000..f45502ab9ab4 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: 11, + 1: 10, + 2: 13, + 3: 12, + 4: 15, + 5: 14, + 6: 17, + 7: 16, + 8: 19, + 9: 18, + 10: 21, + 11: 20, + 12: 23, + 13: 22, + 14: 25, + 15: 24, + 16: 27, + 17: 26, + 18: 29, + 19: 28, + 20: 31, + 21: 30, + 22: 33, + 23: 32, + 24: 35, + 25: 34, + 26: 37, + 27: 36, + 28: 39, + 29: 38, + 30: 41, + 31: 40 + } + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(self.port_start, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + sfputilbase.__init__(self, port_num) From 884bd2d4673dcd812058769c09188e0f5a692e79 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 11 Apr 2017 00:36:36 +0300 Subject: [PATCH 0436/1833] [mellanox]: Add support for Mellanox MSN2410 (#491) * [device]: Add support for Mellanox MSN2410 MSN2410 runs on Spectrum silicon and has 56 ports: 48 25GbE and 8 100GbE * Avoid full path within bash -c Signed-off-by: marian-pritsak --- .../ACS-MSN2410/port_config.ini | 57 ++ .../ACS-MSN2410/sai.profile | 1 + .../x86_64-mlnx_msn2410-r0/hw-management | 1 + .../x86_64-mlnx_msn2410-r0/installer.conf | 1 + .../x86_64-mlnx_msn2410-r0/minigraph.xml | 520 ++++++++++++++++++ .../x86_64-mlnx_msn2410-r0/plugins/eeprom.py | 33 ++ .../x86_64-mlnx_msn2410-r0/plugins/sfputil.py | 28 + .../x86_64-mlnx_msn2410-r0/sensors.conf | 21 + .../x86_64-mlnx_msn2700-r0/hw-management | 1 + files/build_templates/swss.service.j2 | 5 +- 10 files changed, 666 insertions(+), 2 deletions(-) create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/port_config.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile create mode 120000 device/mellanox/x86_64-mlnx_msn2410-r0/hw-management create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf create mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/hw-management diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/port_config.ini b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/port_config.ini new file mode 100644 index 000000000000..c7db66b02274 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/port_config.ini @@ -0,0 +1,57 @@ +# name lanes +Ethernet0 0 +Ethernet4 4 +Ethernet8 8 +Ethernet12 12 +Ethernet16 16 +Ethernet20 20 +Ethernet24 24 +Ethernet28 28 +Ethernet32 32 +Ethernet36 36 +Ethernet40 40 +Ethernet44 44 +Ethernet48 48 +Ethernet52 52 +Ethernet56 56 +Ethernet60 60 +Ethernet64 64 +Ethernet68 68 +Ethernet72 72 +Ethernet76 76 +Ethernet80 80 +Ethernet84 84 +Ethernet88 88 +Ethernet92 92 +Ethernet96 96 +Ethernet100 100 +Ethernet104 104 +Ethernet108 108 +Ethernet112 112 +Ethernet116 116 +Ethernet120 120 +Ethernet124 124 +Ethernet128 128 +Ethernet132 132 +Ethernet136 136 +Ethernet140 140 +Ethernet144 144 +Ethernet148 148 +Ethernet152 152 +Ethernet156 156 +Ethernet160 160 +Ethernet164 164 +Ethernet168 168 +Ethernet172 172 +Ethernet176 176 +Ethernet180 180 +Ethernet184 184 +Ethernet188 188 +Ethernet192 192,193,194,195 +Ethernet196 196,197,198,199 +Ethernet200 200,201,202,203 +Ethernet204 204,205,206,207 +Ethernet208 208,209,210,211 +Ethernet212 212,213,214,215 +Ethernet216 216,217,218,219 +Ethernet220 220,221,222,223 diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile new file mode 100644 index 000000000000..e5dff6bfa098 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sai_2410.xml diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/hw-management b/device/mellanox/x86_64-mlnx_msn2410-r0/hw-management new file mode 120000 index 000000000000..5b9a76d3d47b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/hw-management @@ -0,0 +1 @@ +/etc/mlnx/msn2410 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf b/device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf new file mode 100644 index 000000000000..c9c9493a5404 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml new file mode 100644 index 000000000000..01cfdd03c635 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml @@ -0,0 +1,520 @@ + + + + + + + + 65100 + switch2 + + + + 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 + + + + + + + + switch2 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + Ethernet128 + 10.0.0.64/31 + + + + Ethernet132 + 10.0.0.66/31 + + + + Ethernet136 + 10.0.0.68/31 + + + + Ethernet140 + 10.0.0.70/31 + + + + Ethernet144 + 10.0.0.72/31 + + + + Ethernet148 + 10.0.0.74/31 + + + + Ethernet152 + 10.0.0.76/31 + + + + Ethernet156 + 10.0.0.78/31 + + + + Ethernet160 + 10.0.0.80/31 + + + + Ethernet164 + 10.0.0.82/31 + + + + Ethernet168 + 10.0.0.84/31 + + + + Ethernet172 + 10.0.0.86/31 + + + + Ethernet176 + 10.0.0.88/31 + + + + Ethernet180 + 10.0.0.90/31 + + + + Ethernet184 + 10.0.0.92/31 + + + + Ethernet188 + 10.0.0.94/31 + + + + Ethernet192 + 10.0.0.96/31 + + + + Ethernet196 + 10.0.0.98/31 + + + + Ethernet200 + 10.0.0.100/31 + + + + Ethernet204 + 10.0.0.102/31 + + + + Ethernet208 + 10.0.0.104/31 + + + + Ethernet212 + 10.0.0.106/31 + + + + Ethernet216 + 10.0.0.108/31 + + + + Ethernet220 + 10.0.0.110/31 + + + + + + + + + + + + + + switch2 + ACS-MSN2410 + + ` + + + + + switch2 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + switch2 + ACS-MSN2410 + diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py new file mode 100644 index 000000000000..a9e22e3e698c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + import eeprom_base + import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/bsp/eeprom/sys_eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py new file mode 100644 index 000000000000..9d4474ac1ec9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py @@ -0,0 +1,28 @@ +#! /usr/bin/python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 55 + ports_in_block = 56 + + eeprom_offset = 1 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/bsp/qsfp/qsfp{0}' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) + diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf new file mode 100644 index 000000000000..a3e30391863e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf @@ -0,0 +1,21 @@ +bus "i2c-7" "i2c-1-mux (chan_id 5)" +chip "lm75-i2c-7-4a" + label temp1 "Ambient Port Temp" + +bus "i2c-5" "i2c-1-mux (chan_id 3)" +chip "ucd9200-i2c-5-27" + label in1 "UCD1 vin" + label in2 "ASIC 3.3 vout" + label in3 "ASIC 1.2 vout" + label temp1 "UCD1 Temp" + label temp2 "UCD1 Temp2" + +chip "ucd9200-i2c-5-41" + label in1 "UCD2 vin" + label in2 "ASIC Vcore vout" + label temp1 "UCD2 Temp1" + label temp2 "UCD2 Temp2" + +bus "i2c-17" "i2c-1-mux (chan_id 7)" +chip "lm75-i2c-17-49" + label temp1 "Ambient Board Temp" diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/hw-management b/device/mellanox/x86_64-mlnx_msn2700-r0/hw-management new file mode 120000 index 000000000000..eb5e941daad7 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/hw-management @@ -0,0 +1 @@ +/etc/mlnx/msn2700 \ No newline at end of file diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 6e5152223616..1fc9127f260e 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -20,7 +20,8 @@ ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB {% if sonic_asic_platform == 'mellanox' %} ExecStartPre=/etc/init.d/sxdkernel start ExecStartPre=/usr/bin/mst start -ExecStartPre=/etc/mlnx/msn2700 start +ExecStartPre=/sbin/modprobe i2c-dev +ExecStartPre=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -v platform)/hw-management start" {% elif sonic_asic_platform == 'cavium' %} ExecStartPre=/etc/init.d/xpnet.sh start {% endif %} @@ -33,7 +34,7 @@ ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStopPost=/usr/bin/syncd.sh stop {% if sonic_asic_platform == 'mellanox' %} -ExecStopPost=/etc/mlnx/msn2700 stop +ExecStopPost=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -v platform)/hw-management stop" ExecStopPost=/etc/init.d/sxdkernel stop ExecStopPost=/usr/bin/mst stop {% elif sonic_asic_platform == 'cavium' %} From 3bd3549818edf6e61480b04f100111f0dfe8d6c8 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 10 Apr 2017 22:08:54 -0700 Subject: [PATCH 0437/1833] [cfggen] Fix a bug when portchannel has >2 members (#493) --- src/sonic-config-engine/minigraph.py | 2 +- .../tests/pc-test-graph.xml | 202 ++++++++++++++++++ src/sonic-config-engine/tests/test_cfggen.py | 8 +- 3 files changed, 210 insertions(+), 2 deletions(-) create mode 100644 src/sonic-config-engine/tests/pc-test-graph.xml diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 709a7a2846ff..eae87a37e0df 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -197,7 +197,7 @@ def parse_dpg(dpg, hname): for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): pcintfname = pcintf.find(str(QName(ns, "Name"))).text pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text - pcmbr_list = pcintfmbr.split(';', 1) + pcmbr_list = pcintfmbr.split(';') for i, member in enumerate(pcmbr_list): pcmbr_list[i] = port_alias_map[member] pcs[pcintfname] = {'name': pcintfname, 'members': pcmbr_list} diff --git a/src/sonic-config-engine/tests/pc-test-graph.xml b/src/sonic-config-engine/tests/pc-test-graph.xml new file mode 100644 index 000000000000..7d7ec74a8631 --- /dev/null +++ b/src/sonic-config-engine/tests/pc-test-graph.xml @@ -0,0 +1,202 @@ + + + + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + + + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/112;fortyGigE0/116;fortyGigE0/120;fortyGigE0/124 + + + + + + Vlan1000 + fortyGigE0/4;fortyGigE0/8;fortyGigE0/12;fortyGigE0/16;fortyGigE0/20;fortyGigE0/24;fortyGigE0/28;fortyGigE0/32;fortyGigE0/36;fortyGigE0/40;fortyGigE0/44;fortyGigE0/48;fortyGigE0/52;fortyGigE0/56;fortyGigE0/60;fortyGigE0/64;fortyGigE0/68;fortyGigE0/72;fortyGigE0/76;fortyGigE0/80;fortyGigE0/84;fortyGigE0/88;fortyGigE0/92;fortyGigE0/96 + False + 0.0.0.0/0 + + 1000 + 1000 + 192.168.0.0/27 + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + Vlan1000 + 192.168.0.1/27 + + + + + + + PortChannel01;PortChannel02;PortChannel03;PortChannel04 + + DataAcl + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1/1 + switch-t0 + fortyGigE0/112 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1/1 + switch-t0 + fortyGigE0/116 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1/1 + switch-t0 + fortyGigE0/120 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1/1 + switch-t0 + fortyGigE0/124 + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 83c678fff7b9..a4ad6cb806fc 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -10,6 +10,7 @@ def setUp(self): self.sample_graph = os.path.join(self.test_dir, 'sample_graph.xml') self.sample_graph_t0 = os.path.join(self.test_dir, 't0-sample-graph.xml') self.sample_graph_simple = os.path.join(self.test_dir, 'simple-sample-graph.xml') + self.sample_graph_pc_test = os.path.join(self.test_dir, 'pc-test-graph.xml') self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') def run_script(self, argument): @@ -82,7 +83,12 @@ def test_minigraph_portchannels(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'PortChannel01': {'name': 'PortChannel01', 'members': ['Ethernet4']}}") - def test_minigraph_portchannels(self): + def test_minigraph_portchannels_more_member(self): + argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v minigraph_portchannels' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'PortChannel01': {'name': 'PortChannel01', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + + def test_minigraph_portchannel_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannel_interfaces' output = self.run_script(argument) self.assertEqual(output.strip(), "[{'subnet': IPv4Network('10.0.0.56/31'), 'peer_addr': IPv4Address('10.0.0.57'), 'addr': IPv4Address('10.0.0.56'), 'mask': IPv4Address('255.255.255.254'), 'attachto': 'PortChannel01', 'prefixlen': 31}, {'subnet': IPv6Network('fc00::70/126'), 'peer_addr': IPv6Address('fc00::72'), 'addr': IPv6Address('fc00::71'), 'mask': '126', 'attachto': 'PortChannel01', 'prefixlen': 126}]") From 4c81204eaf686bcf49c6cff9f80a595ca1ad4233 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 11 Apr 2017 12:53:21 -0700 Subject: [PATCH 0438/1833] [sonic-slave]: add aspell in Dockerfile for SAI meta data build (#494) --- sonic-slave/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 6ca6e93c5f45..ff038e90aa9d 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -23,7 +23,7 @@ RUN apt-get update && apt-get install -y libreadline-dev texlive-latex-base texl RUN apt-get install -y cdbs # For SAI meta build -RUN apt-get update && apt-get install -y libxml-simple-perl graphviz +RUN apt-get update && apt-get install -y libxml-simple-perl graphviz aspell # For linux build RUN apt-get update && apt-get install -y bc fakeroot build-essential devscripts quilt stgit From ec73735d21f5f123bdaa89a73fca495dc5098369 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Tue, 11 Apr 2017 13:04:21 -0700 Subject: [PATCH 0439/1833] [sonic-cfggen]: Move get_machine_info function to sonic_platform.py (#489) * Move get_machine_info to lib * Add get platform info API * Create sonic_platform.py Signed-off-by: Sihui Han --- src/sonic-config-engine/minigraph.py | 1 - src/sonic-config-engine/setup.py | 2 +- src/sonic-config-engine/sonic-cfggen | 25 +++++------------- src/sonic-config-engine/sonic_platform.py | 32 +++++++++++++++++++++++ 4 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 src/sonic-config-engine/sonic_platform.py diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index eae87a37e0df..42086625bb90 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -47,7 +47,6 @@ def default(self, obj): return str(obj) return json.JSONEncoder.default(self, obj) - def parse_png(png, hname): neighbors = {} devices = {} diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index b9e6ace7cccf..ac4eb16b30e1 100755 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -15,7 +15,7 @@ def get_test_suite(): author='Taoyu Li', author_email='taoyl@microsoft.com', url='https://github.com/Azure/sonic-buildimage', - py_modules=['minigraph', 'openconfig_acl'], + py_modules=['minigraph', 'openconfig_acl', 'sonic_platform'], scripts=['sonic-cfggen', 'translate_acl'], install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind'], test_suite='setup.get_test_suite', diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index e47985cf17fc..822f02d7fcc2 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -7,9 +7,10 @@ import yaml import jinja2 import netaddr import json -from minigraph import parse_xml from minigraph import minigraph_encoder - +from minigraph import parse_xml +from sonic_platform import get_machine_info +from sonic_platform import get_platform_info def is_ipv4(value): if not value: @@ -44,19 +45,6 @@ def unique_name(l): new_list.append(item) return new_list -def get_machine_info(): - if not os.path.isfile('/host/machine.conf'): - return None - machine_vars = {} - with open('/host/machine.conf') as machine_file: - for line in machine_file: - tokens = line.split('=') - if len(tokens) < 2: - continue - machine_vars[tokens[0]] = tokens[1].strip() - return machine_vars - - def main(): parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") parser.add_argument("-m", "--minigraph", help="minigraph xml file") @@ -74,10 +62,9 @@ def main(): machine_info = get_machine_info() if machine_info != None: data.update(machine_info) - if machine_info.has_key('onie_platform'): - data['platform'] = machine_info['onie_platform'] - elif machine_info.has_key('aboot_platform'): - data['platform'] = machine_info['aboot_platform'] + platform_info = get_platform_info(machine_info) + if platform_info != None: + data['platform'] = platform_info if args.minigraph != None: minigraph = args.minigraph diff --git a/src/sonic-config-engine/sonic_platform.py b/src/sonic-config-engine/sonic_platform.py new file mode 100644 index 000000000000..fdc192d09d0a --- /dev/null +++ b/src/sonic-config-engine/sonic_platform.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +import os + +DOCUMENTATION = ''' +--- +module: sonic_platform +version_added: "1.9" +short_description: Retrive platform related facts for a device. +description: + - Retrieve platform related facts from config files. +''' + +def get_machine_info(): + if not os.path.isfile('/host/machine.conf'): + return None + machine_vars = {} + with open('/host/machine.conf') as machine_file: + for line in machine_file: + tokens = line.split('=') + if len(tokens) < 2: + continue + machine_vars[tokens[0]] = tokens[1].strip() + return machine_vars + +def get_platform_info(machine_info): + if machine_info != None: + if machine_info.has_key('onie_platform'): + return machine_info['onie_platform'] + elif machine_info.has_key('aboot_platform'): + return machine_info['aboot_platform'] + return None + From 5585221890f28f226609fc8d8094ad763daf59ef Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Tue, 11 Apr 2017 17:23:04 -0700 Subject: [PATCH 0440/1833] [sonic-utilities]: Update submodule (#495) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index ea8ceba23f10..bd6cf5d16cc4 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ea8ceba23f104f27453db77bcffaebcfe2f3376f +Subproject commit bd6cf5d16cc44128318c0ca8ec94ceba8fe48624 From 2e9b92e1c176b9f2d51c5d650b2a52c0abdb433b Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 12 Apr 2017 11:23:48 -0700 Subject: [PATCH 0441/1833] [build]: allow to customize USERNAME and PASSWORD in command line (#492) * [build]: allow to customize USERNAME and PASSWORD in command line * use default password and username if not specified in the command line --- Makefile | 2 ++ rules/config | 8 ++++---- slave.mk | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 38e90f2bfae0..3e2480891b34 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,8 @@ DOCKER_BUILD = docker build --no-cache \ PLATFORM=$(PLATFORM) \ BUILD_NUMBER=$(BUILD_NUMBER) \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ + PASSWORD=$(PASSWORD) \ + USERNAME=$(USERNAME) \ $@ sonic-slave-build : diff --git a/rules/config b/rules/config index dcfa40c7459e..ca0de68e7319 100644 --- a/rules/config +++ b/rules/config @@ -26,11 +26,11 @@ SONIC_CONFIG_LOG_TO_FILES = y # Comment next line to disable: # SONIC_CONFIG_ENABLE_COLORS = y -# USERNAME - username for installer build -USERNAME = admin +# DEFAULT_USERNAME - default username for installer build +DEFAULT_USERNAME = admin -# PASSWORD - password for installer build -PASSWORD = YourPaSsWoRd +# DEFAULT_PASSWORD - default password for installer build +DEFAULT_PASSWORD = YourPaSsWoRd # ENABLE_DHCP_GRAPH_SERVICE - specify the source of minigraph to generate configuration file. # If set to y SONiC will get the minigraph from graph service. Graph service URL need to be diff --git a/slave.mk b/slave.mk index 4f3761aa2263..fbfa9f28fa35 100644 --- a/slave.mk +++ b/slave.mk @@ -59,6 +59,14 @@ ifneq ($(CONFIGURED_PLATFORM), undefined) include $(PLATFORM_PATH)/rules.mk endif +ifeq ($(USERNAME),) +override USERNAME := $(DEFAULT_USERNAME) +endif + +ifeq ($(PASSWORD),) +override PASSWORD := $(DEFAULT_PASSWORD) +endif + MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) ############################################################################### From f76e700062d8e6a4af7205898b2d9fa753b33d96 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Wed, 12 Apr 2017 15:45:50 -0700 Subject: [PATCH 0442/1833] [sonic-utilities]: Update the submodule (#498) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index bd6cf5d16cc4..fcfefdb0b96e 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit bd6cf5d16cc44128318c0ca8ec94ceba8fe48624 +Subproject commit fcfefdb0b96ef36a18cb13669a964b196a036436 From e47b8cc0b2cba47c6e1e700da4e9cd060159011b Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 13 Apr 2017 14:07:44 +0300 Subject: [PATCH 0443/1833] [device]: Fix mellanox eeprom plugins. (#500) Signed-off-by: marian-pritsak --- device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py | 4 ++-- device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py index a9e22e3e698c..d792d1770367 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py @@ -17,8 +17,8 @@ import warnings import os import sys - import eeprom_base - import eeprom_tlvinfo + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo import subprocess except ImportError, e: raise ImportError (str(e) + "- required module not found") diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py index a9e22e3e698c..d792d1770367 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py @@ -17,8 +17,8 @@ import warnings import os import sys - import eeprom_base - import eeprom_tlvinfo + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo import subprocess except ImportError, e: raise ImportError (str(e) + "- required module not found") From b3e10d2093d398a0e2f78d5f68cc5fb0ad281c46 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 13 Apr 2017 06:08:28 -0700 Subject: [PATCH 0444/1833] [vas]: remove docker-vas (#499) --- dockers/docker-vas/Dockerfile | 42 -------------------------------- dockers/docker-vas/user-override | 2 -- 2 files changed, 44 deletions(-) delete mode 100755 dockers/docker-vas/Dockerfile delete mode 100644 dockers/docker-vas/user-override diff --git a/dockers/docker-vas/Dockerfile b/dockers/docker-vas/Dockerfile deleted file mode 100755 index 245bbd6baeb7..000000000000 --- a/dockers/docker-vas/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -FROM docker-base - -COPY deps/vasclnt_*.deb deps/vasgp_*.deb /deps/ -COPY user-override /etc/opt/quest/vas/user-override - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -## Pre-install the fundamental packages -## Clean up -RUN apt-get update && \ - dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ - apt-get -y install \ - sudo \ - && \ - dpkg_apt /deps/vasclnt_*.deb && \ - dpkg_apt /deps/vasgp_*.deb && \ - apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ - rm -rf /deps - -## Expose to host, ie. image content will copy to host when container started -## For .so -VOLUME /host/lib/x86_64-linux-gnu -## For config -VOLUME /etc/pam.d/ -VOLUME /host/etc -## For domain socket and local caches -VOLUME /var/opt/quest/vas/vasd/ -## For home directory -VOLUME /home/ - -## Delete the symlinks and create full copies to host folder -ENTRYPOINT rm -f /var/run/rsyslogd.pid \ - && service rsyslog start \ - && cp --remove-destination /opt/quest/lib64/nss/libnss_vas4.so.2 \ - /host/lib/x86_64-linux-gnu/ \ - && cp --remove-destination /opt/quest/lib64/security/pam_vas3.so \ - /host/lib/x86_64-linux-gnu/security/ \ - && cp --remove-destination /etc/nsswitch.conf \ - /host/etc/ \ - && service vasd start \ - && /bin/bash diff --git a/dockers/docker-vas/user-override b/dockers/docker-vas/user-override deleted file mode 100644 index cb16ea6ded0f..000000000000 --- a/dockers/docker-vas/user-override +++ /dev/null @@ -1,2 +0,0 @@ -# Overrides every member to have the bash shell -::::::/bin/bash From ebc343120d77a83b5ac0b676afbbd5181726548a Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Thu, 13 Apr 2017 18:29:14 +0300 Subject: [PATCH 0445/1833] Update MLNX SAI revision reference (#501) --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index b9396e2f3421..163e298553f8 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = b2137c6d66f7f1bcdec4a0d0d17264ec5695d31b +MLNX_SAI_REVISION = 1a4307f0ac40b28cd8ed8f48569458212d90366e export MLNX_SAI_VERSION MLNX_SAI_REVISION From 31e8b1ec678dfbe9b968f23b7512375778c87777 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 13 Apr 2017 22:09:00 +0300 Subject: [PATCH 0446/1833] [sonic-slave]: Refactor Dockerfile. (#502) Put all packages installation into single apt-get command. This will allow us to do apt-get update only once. Eliminate unnecessary intermediate layers where they are not required. Signed-off-by: marian-pritsak --- sonic-slave/Dockerfile | 254 +++++++++++++++++++++++++++++------------ 1 file changed, 184 insertions(+), 70 deletions(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index ff038e90aa9d..c2b5f8a11c73 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -2,102 +2,216 @@ FROM debian:jessie MAINTAINER johnar@microsoft.com -RUN echo "deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list -RUN echo "deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list -RUN echo "deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list -RUN echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list -RUN echo 'deb http://debian-archive.trafficmanager.net/debian jessie-backports main' >> /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' >> /etc/apt/sources.list ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get clean && apt-get update && apt-get install -y apt-utils default-jre-headless openssh-server curl wget unzip git build-essential libtool lintian - -RUN apt-get update && apt-get install -y sudo dh-make dh-exec kmod libtinyxml2-2 libboost-program-options1.55-dev libtinyxml2-dev python python-pip libncurses5-dev texinfo dh-autoreconf python3-pip -RUN apt-get update && apt-get install -y doxygen devscripts git-buildpackage perl-modules libswitch-perl dh-systemd - +RUN apt-get clean && apt-get update && apt-get install -y \ + apt-utils \ + default-jre-headless \ + openssh-server \ + curl \ + wget \ + unzip \ + git \ + build-essential \ + libtool \ + lintian \ + sudo \ + dh-make \ + dh-exec \ + kmod \ + libtinyxml2-2 \ + libboost-program-options1.55-dev \ + libtinyxml2-dev \ + python \ + python-pip \ + libncurses5-dev \ + texinfo \ + dh-autoreconf \ + python3-pip \ + doxygen \ + devscripts \ + git-buildpackage \ + perl-modules \ + libswitch-perl \ + dh-systemd \ # For quagga build -RUN apt-get update && apt-get install -y libreadline-dev texlive-latex-base texlive-generic-recommended texlive-fonts-recommended libpam0g-dev libpam-dev libcap-dev imagemagick ghostscript groff libpcre3-dev gawk chrpath - + libreadline-dev \ + texlive-latex-base \ + texlive-generic-recommended \ + texlive-fonts-recommended \ + libpam0g-dev \ + libpam-dev \ + libcap-dev \ + imagemagick \ + ghostscript \ + groff \ + libpcre3-dev \ + gawk \ + chrpath \ # For libnl3 (local) build -RUN apt-get install -y cdbs - + cdbs \ # For SAI meta build -RUN apt-get update && apt-get install -y libxml-simple-perl graphviz aspell - + libxml-simple-perl \ + graphviz \ + aspell \ # For linux build -RUN apt-get update && apt-get install -y bc fakeroot build-essential devscripts quilt stgit -RUN apt-get update && apt-get -y build-dep linux - + bc \ + fakeroot \ + build-essential \ + devscripts \ + quilt \ + stgit \ # For platform-modules build -RUN apt-get update && apt-get install -y module-assistant - -# For thrift build -RUN apt-get update && apt-get install -y gem2deb libboost-all-dev libevent-dev libglib2.0-dev libqt4-dev python-all-dev python-twisted php5-dev phpunit libbit-vector-perl openjdk-7-jdk javahelper maven-debian-helper ant libmaven-ant-tasks-java libhttpclient-java libslf4j-java libservlet3.1-java qt5-default - + module-assistant \ +# For thrift build\ + gem2deb \ + libboost-all-dev \ + libevent-dev \ + libglib2.0-dev \ + libqt4-dev \ + python-all-dev \ + python-twisted \ + php5-dev \ + phpunit \ + libbit-vector-perl \ + openjdk-7-jdk \ + javahelper \ + maven-debian-helper \ + ant \ + libmaven-ant-tasks-java \ + libhttpclient-java \ + libslf4j-java \ + libservlet3.1-java \ + qt5-default \ # For mellanox sdk build -RUN apt-get update && apt-get install -y libpcre3 libpcre3-dev byacc flex libglib2.0-dev bison expat libexpat1-dev dpatch libdb-dev iptables-dev swig - + libpcre3 \ + libpcre3-dev \ + byacc \ + flex \ + libglib2.0-dev \ + bison \ + expat \ + libexpat1-dev \ + dpatch \ + libdb-dev \ + iptables-dev \ + swig \ # For mellanox sai build -RUN apt-get update && apt-get install -y libtool-bin libxml2-dev - + libtool-bin \ + libxml2-dev \ # For build image -RUN apt-get update && apt-get install -y cpio squashfs-tools zip - + cpio \ + squashfs-tools \ + zip \ # For broadcom sdk build -RUN apt-get update && apt-get install -y linux-compiler-gcc-4.8-x86 linux-kbuild-3.16 - + linux-compiler-gcc-4.8-x86 \ + linux-kbuild-3.16 \ # teamd build -RUN apt-get update && apt-get install -y libdaemon-dev libdbus-1-dev libjansson-dev - + libdaemon-dev \ + libdbus-1-dev \ + libjansson-dev \ # For cavium sdk build -RUN apt-get update && apt-get install -y libpcap-dev dnsutils libusb-dev - + libpcap-dev \ + dnsutils \ + libusb-dev \ # For debian image reconfiguration -RUN apt-get update && apt-get install -y augeas-tools - + augeas-tools \ # For p4 build -RUN apt-get update && apt-get install -y libyaml-dev libevent-dev libjudy-dev libedit-dev libpcap-dev libnanomsg-dev -RUN apt-get update && apt-get install -y python-stdeb -RUN pip install ctypesgen -RUN pip install crc16 - + libyaml-dev \ + libevent-dev \ + libjudy-dev \ + libedit-dev \ + libnanomsg-dev \ + python-stdeb \ # For redis build -RUN apt-get update && apt-get install -y libjemalloc-dev - + libjemalloc-dev \ # For mft kernel module build -RUN apt-get update && apt-get install -y dkms - + dkms \ # For python3.5 build -RUN apt-get update && apt-get install -y sharutils libncursesw5-dev libbz2-dev liblzma-dev libgdbm-dev tk-dev blt-dev libmpdec-dev libbluetooth-dev locales libsqlite3-dev libgpm2 time net-tools xvfb python-sphinx python3-sphinx - -# For gobgp build -RUN apt-get -yt jessie-backports install golang-go golang-github-golang-mock-dev - -RUN mkdir /var/run/sshd -EXPOSE 22 - -# For gtest -RUN apt-get update && apt-get install -y libgtest-dev cmake && cd /usr/src/gtest && cmake . && make -C /usr/src/gtest - + sharutils \ + libncursesw5-dev \ + libbz2-dev \ + liblzma-dev \ + libgdbm-dev \ + tk-dev \ + blt-dev \ + libmpdec-dev \ + libbluetooth-dev \ + locales \ + libsqlite3-dev \ + libgpm2 \ + time \ + net-tools \ + xvfb \ + python-sphinx \ + python3-sphinx \ # For Jenkins static analysis, unit testing and code coverage -RUN apt-get update && apt-get install -y cppcheck clang pylint python-pytest gcovr python-pytest=2.6.3* python-pytest-cov python-parse - + cppcheck \ + clang \ + pylint \ + python-pytest \ + gcovr \ + python-pytest=2.6.3* \ + python-pytest-cov \ + python-parse \ # For snmpd -RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev - + libmysqlclient-dev \ + libmysqld-dev \ + libperl-dev \ + libpci-dev \ + libpci3 \ + libsensors4 \ + libsensors4-dev \ + libwrap0-dev \ # For mpdecimal -RUN apt-get update && apt-get install -y docutils-common libjs-sphinxdoc libjs-underscore python-docutils python-jinja2 python-markupsafe python-pygments python-roman python-sphinx sphinx-common python3-sphinx - + docutils-common \ + libjs-sphinxdoc \ + libjs-underscore \ + python-docutils \ + python-jinja2 \ + python-markupsafe \ + python-pygments \ + python-roman \ + python-sphinx \ + sphinx-common \ + python3-sphinx \ # For sonic config engine testing -RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml -RUN pip install pyangbind - + python-lxml \ + python-jinja2 \ + python-netaddr \ + python-ipaddr \ + python-yaml \ +# For lockfile + procmail \ +# For gtest + libgtest-dev \ + cmake \ +# For linux build + && apt-get -y build-dep linux \ +# For gobgp build + && apt-get -yt jessie-backports install \ + golang-go \ + golang-github-golang-mock-dev \ +# For p4 build + && pip install \ + ctypesgen \ + crc16 \ # For templating -RUN pip install j2cli + j2cli \ +# For sonic config engine testing + pyangbind -# For lockfile -RUN apt-get update && apt-get install -y procmail +RUN cd /usr/src/gtest && cmake . && make -C /usr/src/gtest + +RUN mkdir /var/run/sshd +EXPOSE 22 # Install depot-tools (for git-retry) RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /usr/share/depot_tools From abf54c22c4cc0cf561015b4b5318e99e1c6adf32 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 13 Apr 2017 15:40:05 -0700 Subject: [PATCH 0447/1833] [Broadcom]: Update debian package versions (#504) - OpenNSL 3.2.2.2-2 Signed-off-by: Shuotian Cheng --- platform/broadcom/sdk.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 760eee516600..0feff914f6bb 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-1-20170406004418.26_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-1-20170406004418.26_amd64.deb?sv=2015-04-05&sr=b&sig=aWbjpqH2A5JewLoVs8o%2BkriOCRvqDwuVTZygwy%2B1XMQ%3D&se=2030-12-14T19%3A41%3A16Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.2.2-2-20170413185612.27_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-2-20170413185612.27_amd64.deb?sv=2015-04-05&sr=b&sig=xEbASK6Jiug8I%2BaJFphRnuH4cOEgxIyAkhj6rGKfsOE%3D&se=2030-12-21T22%3A05%3A31Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-1-20170406004418.26_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-1-20170406004418.26_amd64.deb?sv=2015-04-05&sr=b&sig=fL88BnMJ9uMMozh6xDqYn7oDc%2FwhX53sd3WG1v%2BkqDA%3D&se=2030-12-14T19%3A40%3A23Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-2-20170413185612.27_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-2-20170413185612.27_amd64.deb?sv=2015-04-05&sr=b&sig=i%2F4NXu0wzMSAQjDcQTg%2FtpULn5%2Fn%2FVgLu3Lg24QMQM0%3D&se=2030-12-21T22%3A06%3A49Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From b305a50a78fac4f1ec3229b6d8b190ca33dc5261 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 13 Apr 2017 23:54:44 -0700 Subject: [PATCH 0448/1833] [interfaces]: Bring up LAG members before they are enslaved (#505) Signed-off-by: Shuotian Cheng --- files/image_config/interfaces/interfaces.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 40e127e54ce8..c2728e5e032d 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -69,6 +69,7 @@ iface {{ member }} inet manual {% endfor %} {% if minigraph_portchannels.keys() | length %} # "|| true" is added to suppress the error when interface is already a member of LAG +# "ip link show | grep -q master" is added to ensure interface is enslaved {% endif %} {% for pc in minigraph_portchannels.keys()|sort %} {% for member in minigraph_portchannels[pc]['members'] %} @@ -76,7 +77,7 @@ auto {{ member }} allow-hotplug {{ member }} iface {{ member }} inet manual pre-up teamdctl {{ pc }} port add {{ member }} || true - post-up ip link show {{ pc }} && ifconfig {{ member }} up + post-up ip link show {{ member }} | grep -q master && ifconfig {{ member }} up post-down ifconfig {{ member }} down # {% endfor %} From fed900fdc292bb23b9e4fbbad72862d66501e143 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 14 Apr 2017 19:43:54 +0300 Subject: [PATCH 0449/1833] [sonic-swss]: Update submodule pointer (#503) * [sonic-swss]: Update submodule pointer * [sonic-swss-common]: Update submodule pointer --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 3e713cc33b78..c5cbc69f20de 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 3e713cc33b78f0a21d51573ebb604fe3ffddc874 +Subproject commit c5cbc69f20dee3f857b00e587c0b1eb1c0856e83 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 68e6c409b4a9..46c455bd2c88 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 68e6c409b4a96a677ea90a831172df7ae68acbef +Subproject commit 46c455bd2c887f04cdbc1b3adb7263bad97afa51 From 701c1eb9b1f359ddb620034e2bbfbda0db67f6f0 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 14 Apr 2017 15:47:33 -0700 Subject: [PATCH 0450/1833] [build]: add swss dbg package into deb (#506) --- rules/swss.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rules/swss.mk b/rules/swss.mk index 6b2620f81309..f5a4ffec0251 100644 --- a/rules/swss.mk +++ b/rules/swss.mk @@ -6,3 +6,8 @@ $(SWSS)_DEPENDS += $(LIBSAIREDIS_DEV) $(LIBSAIMETADATA_DEV) $(LIBTEAM_DEV) \ $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SWSS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBTEAM) SONIC_DPKG_DEBS += $(SWSS) + +SWSS_DBG = swss-dbg_1.0.0_amd64.deb +$(SWSS_DBG)_DEPENDS += $(SWSS) +$(SWSS_DBG)_RDEPENDS += $(SWSS) +$(eval $(call add_derived_package,$(SWSS),$(SWSS_DBG))) From fae53f7ea24651a63b8f27227b3551a5605169bc Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 16 Apr 2017 01:17:22 -0700 Subject: [PATCH 0451/1833] [build]: add commit id and build number in sonic_version (#508) --- build_debian.sh | 2 ++ src/sonic-utilities | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index a796a243363d..9840280fc849 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -264,7 +264,9 @@ build_version: $(sonic_get_version) debian_version: $(cat $FILESYSTEM_ROOT/etc/debian_version) kernel_version: $kversion asic_type: $sonic_asic_platform +commit_id: $(git rev-parse --short HEAD) build_date: $(date -u) +build_number: ${BUILD_NUMBER:-0} built_by: $USER@$BUILD_HOSTNAME EOF diff --git a/src/sonic-utilities b/src/sonic-utilities index fcfefdb0b96e..5df8acb5ef48 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit fcfefdb0b96ef36a18cb13669a964b196a036436 +Subproject commit 5df8acb5ef48eb34e67b0b5a693fa9f923a79da1 From ebd9af97c40010ba118cd5c7c112fe256970e3a2 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 17 Apr 2017 15:49:47 -0700 Subject: [PATCH 0452/1833] Update SAI version (#512) --- src/SAI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SAI b/src/SAI index 20f7dffba5dc..0bbb902ec226 160000 --- a/src/SAI +++ b/src/SAI @@ -1 +1 @@ -Subproject commit 20f7dffba5dcb0922a4af6e945804b821a3772c1 +Subproject commit 0bbb902ec226a5097a8dfcc6e80b547cf2831187 From c0e292ecd208f19a7f4604bfa5e6930091b9a717 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 17 Apr 2017 17:27:42 -0700 Subject: [PATCH 0453/1833] [docker-syncd-rpc]: Fix Dockerfile (#513) * Use dpkg_apt properly * Remove unused dpkg_apt * Purge not remove previous version of syncd --- platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 | 6 ++---- platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 index 912f52cf73a7..40c573f09c79 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 @@ -9,12 +9,11 @@ debs/{{ deb }}{{' '}} {%- endfor -%} debs/ -RUN dpkg -r syncd +RUN dpkg -P syncd RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ -dpkg_apt \ {% for deb in docker_syncd_brcm_rpc_debs.split(' ') -%} -debs/{{ deb }}{{' '}} +dpkg_apt debs/{{ deb }}{{'; '}} {%- endfor %} ## Pre-install the fundamental packages @@ -45,7 +44,6 @@ RUN apt-get update \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ - && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ && rm -rf /deps diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 15c998385abc..64e208112783 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -9,12 +9,11 @@ debs/{{ deb }}{{' '}} {%- endfor -%} debs/ -RUN dpkg -r syncd +RUN dpkg -P syncd RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ -dpkg_apt \ {% for deb in docker_syncd_mlnx_rpc_debs.split(' ') -%} -debs/{{ deb }}{{' '}} +dpkg_apt debs/{{ deb }}{{'; '}} {%- endfor %} ## Pre-install the fundamental packages @@ -45,7 +44,6 @@ RUN apt-get update \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ - && dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ && rm -rf /deps From 68fcc3654986ccf82bd288d3ce030faf5c3e7a2d Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 18 Apr 2017 17:50:31 -0700 Subject: [PATCH 0454/1833] [platform]: update to latest arista drivers (#515) --- platform/broadcom/sonic-platform-modules-arista | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 76dddcf648ce..a1ca8013e952 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 76dddcf648cec1305eeb0ff4ba00ff234e986fd5 +Subproject commit a1ca8013e952d1cc0d555c24fe6eb2bf016ab694 From 9a4b0adcc7bd2f2b95ed7ecd123d2d81777809b5 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 19 Apr 2017 00:55:22 -0700 Subject: [PATCH 0455/1833] [build]: use short disk label (#516) --- installer/x86_64/install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 94cf0e29881c..94c3fcc1c3a8 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -199,14 +199,14 @@ create_demo_gpt_partition() fi sgdisk --new=${demo_part}::+${demo_part_size}MB \ --attributes=${demo_part}:=:$attr_bitmask \ - --change-name=${demo_part}:$demo_volume_revision_label $blk_dev \ + --change-name=${demo_part}:$demo_volume_label $blk_dev \ || { echo "Warning: The first trial of creating partition failed, trying the largest aligned available block of sectors on the disk" begin=$(sgdisk -F $blk_dev) end=$(sgdisk -E $blk_dev) sgdisk --new=${demo_part}:$begin:$end \ --attributes=${demo_part}:=:$attr_bitmask \ - --change-name=${demo_part}:$demo_volume_revision_label $blk_dev + --change-name=${demo_part}:$demo_volume_label $blk_dev } || { echo "Error: Unable to create partition $demo_part on $blk_dev" exit 1 @@ -385,7 +385,7 @@ eval $create_demo_partition $blk_dev demo_dev=$(echo $blk_dev | sed -e 's/\(mmcblk[0-9]\)/\1p/')$demo_part # Make filesystem -mkfs.ext4 -L $demo_volume_revision_label $demo_dev +mkfs.ext4 -L $demo_volume_label $demo_dev # Mount demo filesystem demo_mnt=$(${onie_bin} mktemp -d) || { @@ -488,7 +488,7 @@ fi demo_grub_entry="$demo_volume_revision_label" cat <> $grub_cfg menuentry '$demo_grub_entry' { - search --no-floppy --label --set=root $demo_volume_revision_label + search --no-floppy --label --set=root $demo_volume_label echo 'Loading $demo_volume_revision_label $demo_type kernel ...' insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi From fb01755d484804d0734362872721b0ee0ac36c74 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 19 Apr 2017 19:34:27 -0700 Subject: [PATCH 0456/1833] [swss]: Update sonic-swss to enable SAI_NUM_ECMP_MEMBERS option in sai.profile (#518) - Update Broadcom libsaibcm debian package to 2.1.5.1-2 - Add SAI_NUM_ECMP_MEMBERS=32 to two Trident II platforms - Update sonic-swss submodule version to support such changes Signed-off-by: Shuotian Cheng --- .../x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile | 1 + .../x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile | 1 + platform/broadcom/sai.mk | 8 ++++---- src/sonic-swss | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile index 76ffdfc028ed..938d37180676 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile @@ -1 +1,2 @@ SAI_INIT_CONFIG_FILE=/etc/bcm/td2-a7050-qx32-32x40G.config.bcm +SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile index b64d997fb451..7ee11c46566e 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile @@ -1 +1,2 @@ SAI_INIT_CONFIG_FILE=/etc/bcm/td2-s6000-32x40G.config.bcm +SAI_NUM_ECMP_MEMBERS=32 diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 4e8a740136e4..c273db78a58e 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-1-20170407044929.18_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-1-20170407044929.18_amd64.deb?sv=2015-04-05&sr=b&sig=lKKP8Ot01SW9NwbbnafZly5rTkIK2rpTdBuUwcWdr5U%3D&se=2030-12-15T04%3A51%3A54Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-2-20170419194756.21_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-2-20170419194756.21_amd64.deb?sv=2015-04-05&sr=b&sig=On9N1tlOSbYj%2Fb0JudmUjYRTbvS5cvqcGJUEIDX8wzk%3D&se=2030-12-27T20%3A56%3A24Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-1-20170407044929.18_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-2-20170419194756.21_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-1-20170407044929.18_amd64.deb?sv=2015-04-05&sr=b&sig=AsDdE0zR3aTxwdK76Iro0jGypl%2FSqVoYmwz0drr78Ho%3D&se=2030-12-15T04%3A52%3A31Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-2-20170419194756.21_amd64.deb?sv=2015-04-05&sr=b&sig=iVQRbQUTmeKqd01pMMR%2FIwlEUsAeiGIxCrqfr24lQ8k%3D&se=2030-12-27T20%3A57%3A08Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/src/sonic-swss b/src/sonic-swss index c5cbc69f20de..5ae03edfca8c 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit c5cbc69f20dee3f857b00e587c0b1eb1c0856e83 +Subproject commit 5ae03edfca8c0baac3d2a78e4cf494c306bbc506 From ea51e1c241465a90a4ad86f73f1c76247c28008e Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 19 Apr 2017 21:01:26 -0700 Subject: [PATCH 0457/1833] Add explicit dependency for swss (#519) --- rules/swss.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/swss.mk b/rules/swss.mk index f5a4ffec0251..c3f50e617e92 100644 --- a/rules/swss.mk +++ b/rules/swss.mk @@ -3,8 +3,8 @@ SWSS = swss_1.0.0_amd64.deb $(SWSS)_SRC_PATH = $(SRC_PATH)/sonic-swss $(SWSS)_DEPENDS += $(LIBSAIREDIS_DEV) $(LIBSAIMETADATA_DEV) $(LIBTEAM_DEV) \ - $(LIBTEAMDCT) $(LIBTEAM_UTILS) -$(SWSS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBTEAM) + $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(LIBSWSSCOMMON_DEV) +$(SWSS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBTEAM) $(LIBSWSSCOMMON) SONIC_DPKG_DEBS += $(SWSS) SWSS_DBG = swss-dbg_1.0.0_amd64.deb From d30fbf1d720ae73801bc6f8a20a1c029244c5bf4 Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Thu, 20 Apr 2017 09:12:27 -0700 Subject: [PATCH 0458/1833] [build]: Adding support for Free-Range-Routing stack. (#510) - Extending SONiC building infrastructure to provide users with greater flexibility, by allowing them to elect a routing-stack different than the default one (quagga). The desired routing-stack will be defined in rules/config file. - As part of these changes I'm adding support for Free-Range-Routing (FRR) stack. Quagga will continue to be the default routing-stack. Signed-off-by: Rodny Molina --- dockers/docker-fpm-frr/Dockerfile.j2 | 32 ++++++ .../base_image_files/vtysh | 0 dockers/docker-fpm-frr/bgpd.conf.j2 | 64 ++++++++++++ dockers/docker-fpm-frr/config.sh | 17 ++++ .../{docker-fpm => docker-fpm-frr}/daemons | 0 dockers/docker-fpm-frr/debian.conf | 20 ++++ .../{docker-fpm => docker-fpm-frr}/isolate.j2 | 0 dockers/docker-fpm-frr/start.sh | 6 ++ .../unisolate.j2 | 0 dockers/docker-fpm-frr/zebra.conf.j2 | 66 +++++++++++++ dockers/docker-fpm-gobgp/Dockerfile.j2 | 2 +- .../Dockerfile.j2 | 4 +- .../docker-fpm-quagga/base_image_files/vtysh | 2 + .../bgpd.conf.j2 | 0 .../config.sh | 0 dockers/docker-fpm-quagga/daemons | 31 ++++++ dockers/docker-fpm-quagga/isolate.j2 | 20 ++++ .../start.sh | 0 dockers/docker-fpm-quagga/unisolate.j2 | 20 ++++ .../zebra.conf.j2 | 0 platform/broadcom/rules.mk | 2 +- platform/cavium/rules.mk | 2 +- platform/mellanox/rules.mk | 2 +- platform/p4/docker-sonic-p4.mk | 11 ++- platform/p4/docker-sonic-p4/Dockerfile.j2 | 2 +- rules/config | 5 + rules/docker-fpm-frr.mk | 14 +++ rules/docker-fpm-gobgp.mk | 2 +- rules/docker-fpm-quagga.mk | 13 +++ rules/docker-fpm.mk | 21 ++-- rules/frr.mk | 9 ++ slave.mk | 12 +++ sonic-slave/Dockerfile | 8 ++ src/sonic-frr/Makefile | 24 +++++ src/sonic-frr/sonic_frr.install | 23 +++++ src/sonic-frr/sonic_frr.rules | 99 +++++++++++++++++++ 36 files changed, 511 insertions(+), 22 deletions(-) create mode 100644 dockers/docker-fpm-frr/Dockerfile.j2 rename dockers/{docker-fpm => docker-fpm-frr}/base_image_files/vtysh (100%) create mode 100644 dockers/docker-fpm-frr/bgpd.conf.j2 create mode 100755 dockers/docker-fpm-frr/config.sh rename dockers/{docker-fpm => docker-fpm-frr}/daemons (100%) create mode 100644 dockers/docker-fpm-frr/debian.conf rename dockers/{docker-fpm => docker-fpm-frr}/isolate.j2 (100%) create mode 100755 dockers/docker-fpm-frr/start.sh rename dockers/{docker-fpm => docker-fpm-frr}/unisolate.j2 (100%) create mode 100644 dockers/docker-fpm-frr/zebra.conf.j2 rename dockers/{docker-fpm => docker-fpm-quagga}/Dockerfile.j2 (84%) create mode 100755 dockers/docker-fpm-quagga/base_image_files/vtysh rename dockers/{docker-fpm => docker-fpm-quagga}/bgpd.conf.j2 (100%) rename dockers/{docker-fpm => docker-fpm-quagga}/config.sh (100%) create mode 100644 dockers/docker-fpm-quagga/daemons create mode 100755 dockers/docker-fpm-quagga/isolate.j2 rename dockers/{docker-fpm => docker-fpm-quagga}/start.sh (100%) create mode 100755 dockers/docker-fpm-quagga/unisolate.j2 rename dockers/{docker-fpm => docker-fpm-quagga}/zebra.conf.j2 (100%) create mode 100644 rules/docker-fpm-frr.mk create mode 100644 rules/docker-fpm-quagga.mk create mode 100644 rules/frr.mk create mode 100644 src/sonic-frr/Makefile create mode 100644 src/sonic-frr/sonic_frr.install create mode 100755 src/sonic-frr/sonic_frr.rules diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 new file mode 100644 index 000000000000..332a0cdd508d --- /dev/null +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -0,0 +1,32 @@ +FROM docker-config-engine + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 libc-ares2 iproute + +COPY \ +{% for deb in docker_fpm_frr_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_fpm_frr_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +COPY ["*.j2", "/usr/share/sonic/templates/"] +COPY ["start.sh", "config.sh", "/usr/bin/"] +COPY ["daemons", "/etc/frr/"] +COPY ["debian.conf", "/etc/frr/"] + +ENTRYPOINT /usr/bin/config.sh \ + && /usr/bin/start.sh \ + && /bin/bash diff --git a/dockers/docker-fpm/base_image_files/vtysh b/dockers/docker-fpm-frr/base_image_files/vtysh similarity index 100% rename from dockers/docker-fpm/base_image_files/vtysh rename to dockers/docker-fpm-frr/base_image_files/vtysh diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 new file mode 100644 index 000000000000..ed9afe0c3388 --- /dev/null +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -0,0 +1,64 @@ +! +{% block banner %} +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/bgpd.conf.j2 using minigraph_facts.py +! file: bgpd.conf +! +{% endblock banner %} +! +{% block system_init %} +hostname {{ inventory_hostname }} +password zebra +log syslog informational +log facility local4 +! enable password {# {{ en_passwd }} TODO: param needed #} +{% endblock system_init %} +! +{% block bgp_init %} +! +! bgp multiple-instance +! +router bgp {{ minigraph_bgp_asn }} + bgp log-neighbor-changes + bgp bestpath as-path multipath-relax +{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} + bgp router-id {{ minigraph_lo_interfaces[0]['addr'] }} +{# advertise loopback #} +{% for lo in minigraph_lo_interfaces %} +{% if lo['addr'] | ipv4 %} + network {{ lo['addr'] }}/32 +{% elif lo['addr'] | ipv6 %} + address-family ipv6 + network {{ lo['addr'] }}/128 + exit-address-family +{% endif %} +{% endfor %} +{% endblock bgp_init %} +{% block vlan_advertisement %} +{% for vlan_interface in minigraph_vlan_interfaces %} + network {{ vlan_interface['subnet'] }} +{% endfor %} +{% endblock vlan_advertisement %} +{% block bgp_sessions %} +{% for bgp_session in minigraph_bgp %} +{% if bgp_session['asn'] != 0 %} + neighbor {{ bgp_session['addr'] }} remote-as {{ bgp_session['asn'] }} + neighbor {{ bgp_session['addr'] }} description {{ bgp_session['name'] }} +{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} + neighbor {{ bgp_session['addr'] }} allowas-in 1 +{% endif %} +{% if bgp_session['addr'] | ipv6 %} + address-family ipv6 + neighbor {{ bgp_session['addr'] }} activate + maximum-paths 64 + exit-address-family +{% endif %} +{% endif %} +{% endfor %} +{% endblock bgp_sessions %} +! +maximum-paths 64 +! +route-map ISOLATE permit 10 +set as-path prepend {{ minigraph_bgp_asn }} +! diff --git a/dockers/docker-fpm-frr/config.sh b/dockers/docker-fpm-frr/config.sh new file mode 100755 index 000000000000..a57cba3cb46a --- /dev/null +++ b/dockers/docker-fpm-frr/config.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +mkdir -p /etc/frr +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/frr/bgpd.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/frr/zebra.conf + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate +chown root:root /usr/sbin/bgp-isolate +chmod 0755 /usr/sbin/bgp-isolate + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate +chown root:root /usr/sbin/bgp-unisolate +chmod 0755 /usr/sbin/bgp-unisolate + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status + diff --git a/dockers/docker-fpm/daemons b/dockers/docker-fpm-frr/daemons similarity index 100% rename from dockers/docker-fpm/daemons rename to dockers/docker-fpm-frr/daemons diff --git a/dockers/docker-fpm-frr/debian.conf b/dockers/docker-fpm-frr/debian.conf new file mode 100644 index 000000000000..4724fc87422f --- /dev/null +++ b/dockers/docker-fpm-frr/debian.conf @@ -0,0 +1,20 @@ +# +# If this option is set the /etc/init.d/frr script automatically loads +# the config via "vtysh -b" when the servers are started. +# Check /etc/pam.d/frr if you intend to use "vtysh"! +# +vtysh_enable=yes +zebra_options=" -s 90000000 --daemon -A 127.0.0.1 -M fpm" +bgpd_options=" --daemon -A 127.0.0.1" +ospfd_options=" --daemon -A 127.0.0.1" +ospf6d_options=" --daemon -A ::1" +ripd_options=" --daemon -A 127.0.0.1" +ripngd_options=" --daemon -A ::1" +isisd_options=" --daemon -A 127.0.0.1" +pimd_options=" --daemon -A 127.0.0.1" +ldpd_options=" --daemon -A 127.0.0.1" +nhrpd_options=" --daemon -A 127.0.0.1" + +# The list of daemons to watch is automatically generated by the init script. +watchfrr_enable=yes +watchfrr_options=(-adz -r /usr/sbin/servicebBfrrbBrestartbB%s -s /usr/sbin/servicebBfrrbBstartbB%s -k /usr/sbin/servicebBfrrbBstopbB%s -b bB -t 30) diff --git a/dockers/docker-fpm/isolate.j2 b/dockers/docker-fpm-frr/isolate.j2 similarity index 100% rename from dockers/docker-fpm/isolate.j2 rename to dockers/docker-fpm-frr/isolate.j2 diff --git a/dockers/docker-fpm-frr/start.sh b/dockers/docker-fpm-frr/start.sh new file mode 100755 index 000000000000..f46a42b4c34c --- /dev/null +++ b/dockers/docker-fpm-frr/start.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +rm -f /var/run/rsyslogd.pid +service rsyslog start +service frr start +fpmsyncd & diff --git a/dockers/docker-fpm/unisolate.j2 b/dockers/docker-fpm-frr/unisolate.j2 similarity index 100% rename from dockers/docker-fpm/unisolate.j2 rename to dockers/docker-fpm-frr/unisolate.j2 diff --git a/dockers/docker-fpm-frr/zebra.conf.j2 b/dockers/docker-fpm-frr/zebra.conf.j2 new file mode 100644 index 000000000000..dc2061f8a02a --- /dev/null +++ b/dockers/docker-fpm-frr/zebra.conf.j2 @@ -0,0 +1,66 @@ +! +{% block banner %} +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/quagga/zebra.conf.j2 using minigraph_facts.py +! file: zebra.conf +! +{% endblock banner %} +! +{% block sys_init %} +hostname {{ inventory_hostname }} +password zebra +enable password zebra +{% endblock sys_init %} +! +{% block interfaces %} +! Enable link-detect (default disabled) +{% for interface in minigraph_interfaces %} +interface {{ interface['alias'] }} +link-detect +! +{% endfor %} +{% for interface in minigraph_portchannel_interfaces %} +interface {{ interface['name'] }} +link-detect +! +{% endfor %} +{% endblock interfaces %} +! +{% block default_route %} +! set static default route to mgmt gateway as a backup to learned default +ip route 0.0.0.0/0 {{ minigraph_mgmt_interface['gwaddr'] }} 200 +{% endblock default_route %} +! +{% block source_loopback %} +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src {{ minigraph_lo_interfaces[0]['addr'] }} +! +{% set lo_ipv6_addrs = [] %} +{% if minigraph_lo_interfaces is defined %} +{% for interface in minigraph_lo_interfaces %} +{% if interface['addr'] is defined and interface['addr']|ipv6 %} +{% if lo_ipv6_addrs.append(interface['addr']) %} +{% endif %} +{% endif %} +{% endfor %} +{% endif %} +{% if lo_ipv6_addrs|length > 0 %} +route-map RM_SET_SRC6 permit 10 + set src {{ lo_ipv6_addrs[0] }} +! +{% endif %} +ip protocol bgp route-map RM_SET_SRC +! +{% if lo_ipv6_addrs|length > 0 %} +ipv6 protocol bgp route-map RM_SET_SRC6 +! +{% endif %} +{% endblock source_loopback %} +! +{% block logging %} +log syslog informational +log facility local4 +{% endblock logging %} +! + diff --git a/dockers/docker-fpm-gobgp/Dockerfile.j2 b/dockers/docker-fpm-gobgp/Dockerfile.j2 index 3d89999d9758..19b6caad9d99 100644 --- a/dockers/docker-fpm-gobgp/Dockerfile.j2 +++ b/dockers/docker-fpm-gobgp/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-fpm +FROM docker-fpm-quagga ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-fpm/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 similarity index 84% rename from dockers/docker-fpm/Dockerfile.j2 rename to dockers/docker-fpm-quagga/Dockerfile.j2 index 65b9cfa3121a..211275a2eb16 100644 --- a/dockers/docker-fpm/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -8,13 +8,13 @@ RUN apt-get update RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 COPY \ -{% for deb in docker_fpm_debs.split(' ') -%} +{% for deb in docker_fpm_quagga_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_fpm_debs.split(' ') -%} +{% for deb in docker_fpm_quagga_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/dockers/docker-fpm-quagga/base_image_files/vtysh b/dockers/docker-fpm-quagga/base_image_files/vtysh new file mode 100755 index 000000000000..359101c06c61 --- /dev/null +++ b/dockers/docker-fpm-quagga/base_image_files/vtysh @@ -0,0 +1,2 @@ +#!/bin/bash +docker exec -i bgp vtysh "$@" diff --git a/dockers/docker-fpm/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 similarity index 100% rename from dockers/docker-fpm/bgpd.conf.j2 rename to dockers/docker-fpm-quagga/bgpd.conf.j2 diff --git a/dockers/docker-fpm/config.sh b/dockers/docker-fpm-quagga/config.sh similarity index 100% rename from dockers/docker-fpm/config.sh rename to dockers/docker-fpm-quagga/config.sh diff --git a/dockers/docker-fpm-quagga/daemons b/dockers/docker-fpm-quagga/daemons new file mode 100644 index 000000000000..cb7c2322c9fb --- /dev/null +++ b/dockers/docker-fpm-quagga/daemons @@ -0,0 +1,31 @@ +# This file tells the quagga package which daemons to start. +# +# Entries are in the format: =(yes|no|priority) +# 0, "no" = disabled +# 1, "yes" = highest priority +# 2 .. 10 = lower priorities +# Read /usr/share/doc/quagga/README.Debian for details. +# +# Sample configurations for these daemons can be found in +# /usr/share/doc/quagga/examples/. +# +# ATTENTION: +# +# When activation a daemon at the first time, a config file, even if it is +# empty, has to be present *and* be owned by the user and group "quagga", else +# the daemon will not be started by /etc/init.d/quagga. The permissions should +# be u=rw,g=r,o=. +# When using "vtysh" such a config file is also needed. It should be owned by +# group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. +# +# The watchquagga daemon is always started. Per default in monitoring-only but +# that can be changed via /etc/quagga/debian.conf. +# +zebra=yes +bgpd=yes +ospfd=no +ospf6d=no +ripd=no +ripngd=no +isisd=no +babeld=no diff --git a/dockers/docker-fpm-quagga/isolate.j2 b/dockers/docker-fpm-quagga/isolate.j2 new file mode 100755 index 000000000000..35ef5bbc0209 --- /dev/null +++ b/dockers/docker-fpm-quagga/isolate.j2 @@ -0,0 +1,20 @@ +#!/bin/bash +## vtysh only accepts script in stdin, so cannot be directly used in shebang +## Cut the tail of this script and feed vtysh stdin +sed -n -e '9,$p' < "$0" | vtysh "$@" +## Exit with vtysh return code +exit $? + +## vtysh script start from next line, which line number MUST eqaul in 'sed' command above + +configure terminal + router bgp {{ minigraph_bgp_asn }} +{% for bgp_session in minigraph_bgp %} + neighbor {{ bgp_session['addr'] }} route-map ISOLATE out +{% endfor %} + exit +exit + +{% for bgp_session in minigraph_bgp %} +clear ip bgp {{ bgp_session['addr'] }} soft out +{% endfor %} diff --git a/dockers/docker-fpm/start.sh b/dockers/docker-fpm-quagga/start.sh similarity index 100% rename from dockers/docker-fpm/start.sh rename to dockers/docker-fpm-quagga/start.sh diff --git a/dockers/docker-fpm-quagga/unisolate.j2 b/dockers/docker-fpm-quagga/unisolate.j2 new file mode 100755 index 000000000000..c113a74fab45 --- /dev/null +++ b/dockers/docker-fpm-quagga/unisolate.j2 @@ -0,0 +1,20 @@ +#!/bin/bash +## vtysh only accepts script in stdin, so cannot be directly used in shebang +## Cut the tail of this script and feed vtysh stdin +sed -n -e '9,$p' < "$0" | vtysh "$@" +## Exit with vtysh return code +exit $? + +## vtysh script start from next line, which line number MUST eqaul in 'sed' command above + +configure terminal + router bgp {{ minigraph_bgp_asn }} +{% for bgp_session in minigraph_bgp %} + no neighbor {{ bgp_session['addr'] }} route-map ISOLATE out +{% endfor %} + exit +exit + +{% for bgp_session in minigraph_bgp %} +clear ip bgp {{ bgp_session['addr'] }} soft out +{% endfor %} diff --git a/dockers/docker-fpm/zebra.conf.j2 b/dockers/docker-fpm-quagga/zebra.conf.j2 similarity index 100% rename from dockers/docker-fpm/zebra.conf.j2 rename to dockers/docker-fpm-quagga/zebra.conf.j2 diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index aaf5f5dc5fbc..bf375575edad 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -21,7 +21,7 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ - $(DOCKER_FPM_GOBGP) \ + $(DOCKER_FPM) \ $(DOCKER_SYNCD_BRCM_RPC) # Inject brcm sai into sairedis diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 0c112860192e..0d20b1c43993 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -8,7 +8,7 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ - $(DOCKER_FPM_GOBGP) + $(DOCKER_FPM) # Inject cavium sai into sairedis $(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index f0e8d4fcdb07..967643167da9 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -11,7 +11,7 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ - $(DOCKER_FPM_GOBGP) \ + $(DOCKER_FPM) \ $(DOCKER_SYNCD_MLNX_RPC) # Inject mlnx sai into sairedis diff --git a/platform/p4/docker-sonic-p4.mk b/platform/p4/docker-sonic-p4.mk index df944be4c363..a23284e50374 100644 --- a/platform/p4/docker-sonic-p4.mk +++ b/platform/p4/docker-sonic-p4.mk @@ -2,6 +2,15 @@ DOCKER_SONIC_P4 = docker-sonic-p4.gz $(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4 -$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) $(QUAGGA) $(LIBTEAMDCT) $(LIBTEAM_UTILS) +$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) + +ifeq ($(ROUTING_STACK), quagga) +$(DOCKER_SONIC_P4)_DEPENDS += $(QUAGGA) +else ifeq ($(ROUTING_STACK), frr) +$(DOCKER_SONIC_P4)_DEPENDS += $(FRR) +else +$(DOCKER_SONIC_P4)_DEPENDS += $(GOBGP) +endif + $(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_P4) diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index a0944cb84a70..1b8d1746b2bb 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 openssh-client openssh-server +RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 openssh-client openssh-server libc-ares2 iproute COPY \ {% for deb in docker_sonic_p4_debs.split(' ') -%} diff --git a/rules/config b/rules/config index ca0de68e7319..e360c7a434c7 100644 --- a/rules/config +++ b/rules/config @@ -41,3 +41,8 @@ DEFAULT_PASSWORD = YourPaSsWoRd # SONIC_CONFIG_DEBUG - install debug packages # Uncomment next line to enable: # SONIC_CONFIG_DEBUG = y + +# SONIC_ROUTING_STACK - specify the routing-stack being elected to drive SONiC's control-plane. +# Quagga will be the default routing-stack for all the SONiC platforms. Other supported +# routing-stacks: frr, gobgp. +SONIC_ROUTING_STACK = quagga diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk new file mode 100644 index 000000000000..d246d093dced --- /dev/null +++ b/rules/docker-fpm-frr.mk @@ -0,0 +1,14 @@ +# docker image for fpm-frr + +DOCKER_FPM_FRR = docker-fpm-frr.gz +$(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/docker-fpm-frr +$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(SWSS) +$(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR) + +$(DOCKER_FPM_FRR)_CONTAINER_NAME = bgp +$(DOCKER_FPM_FRR)_RUN_OPT += --net=host --privileged -t +$(DOCKER_FPM_FRR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh + diff --git a/rules/docker-fpm-gobgp.mk b/rules/docker-fpm-gobgp.mk index ca993833f79a..12fa37dc1d97 100644 --- a/rules/docker-fpm-gobgp.mk +++ b/rules/docker-fpm-gobgp.mk @@ -3,7 +3,7 @@ DOCKER_FPM_GOBGP = docker-fpm-gobgp.gz $(DOCKER_FPM_GOBGP)_PATH = $(DOCKERS_PATH)/docker-fpm-gobgp $(DOCKER_FPM_GOBGP)_DEPENDS += $(GOBGP) -$(DOCKER_FPM_GOBGP)_LOAD_DOCKERS += $(DOCKER_FPM) +$(DOCKER_FPM_GOBGP)_LOAD_DOCKERS += $(DOCKER_FPM_QUAGGA) SONIC_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP) $(DOCKER_FPM_GOBGP)_CONTAINER_NAME = bgp diff --git a/rules/docker-fpm-quagga.mk b/rules/docker-fpm-quagga.mk new file mode 100644 index 000000000000..a9c0511ba173 --- /dev/null +++ b/rules/docker-fpm-quagga.mk @@ -0,0 +1,13 @@ +# docker image for fpm-quagga + +DOCKER_FPM_QUAGGA = docker-fpm-quagga.gz +$(DOCKER_FPM_QUAGGA)_PATH = $(DOCKERS_PATH)/docker-fpm-quagga +$(DOCKER_FPM_QUAGGA)_DEPENDS += $(QUAGGA) $(SWSS) +$(DOCKER_FPM_QUAGGA)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_FPM_QUAGGA) + +$(DOCKER_FPM_QUAGGA)_CONTAINER_NAME = bgp +$(DOCKER_FPM_QUAGGA)_RUN_OPT += --net=host --privileged -t +$(DOCKER_FPM_QUAGGA)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_FPM_QUAGGA)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh diff --git a/rules/docker-fpm.mk b/rules/docker-fpm.mk index 0fc289b37b08..b38ad99356f5 100644 --- a/rules/docker-fpm.mk +++ b/rules/docker-fpm.mk @@ -1,14 +1,9 @@ -# docker image for fpm +# Docker-fpm rule-file is simply a wrapper containing routing-stack selection logic. -DOCKER_FPM = docker-fpm.gz -$(DOCKER_FPM)_PATH = $(DOCKERS_PATH)/docker-fpm -$(DOCKER_FPM)_DEPENDS += $(QUAGGA) $(SWSS) -$(DOCKER_FPM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_FPM) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM) - -$(DOCKER_FPM)_CONTAINER_NAME = bgp -$(DOCKER_FPM)_RUN_OPT += --net=host --privileged -t -$(DOCKER_FPM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro - -$(DOCKER_FPM)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh +ifeq ($(SONIC_ROUTING_STACK), quagga) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM_QUAGGA) +else ifeq ($(SONIC_ROUTING_STACK), frr) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM_FRR) +else +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP) +endif diff --git a/rules/frr.mk b/rules/frr.mk new file mode 100644 index 000000000000..7fb1837585aa --- /dev/null +++ b/rules/frr.mk @@ -0,0 +1,9 @@ +# FRRouting (frr) package + +FRR_VERSION = 3.0 +export FRR_VERSION + +FRR = frr_$(FRR_VERSION)_amd64.deb +$(FRR)_DEPENDS += $(LIBSNMP_DEV) +$(FRR)_SRC_PATH = $(SRC_PATH)/sonic-frr +SONIC_MAKE_DEBS += $(FRR) diff --git a/slave.mk b/slave.mk index fbfa9f28fa35..d7afd6d9e5dc 100644 --- a/slave.mk +++ b/slave.mk @@ -69,6 +69,18 @@ endif MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) +############################################################################### +## Dumping key config attributes associated to current building exercise +############################################################################### + +ifndef $(CONFIGURED_PLATFORM) +$(info CONFIGURED_PLATFORM is $(CONFIGURED_PLATFORM)) +endif + +ifndef $(SONIC_ROUTING_STACK) +$(info ROUTING_STACK is $(SONIC_ROUTING_STACK)) +endif + ############################################################################### ## Generic rules section ## All rules must go after includes for propper targets expansion diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index c2b5f8a11c73..76b01ea2f608 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -55,6 +55,14 @@ RUN apt-get clean && apt-get update && apt-get install -y \ libpcre3-dev \ gawk \ chrpath \ +# For frr build + libc-ares-dev \ + hardening-wrapper \ + libsnmp-dev \ + libjson0 \ + libjson0-dev \ + libsystemd-dev \ + python-ipaddr \ # For libnl3 (local) build cdbs \ # For SAI meta build diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile new file mode 100644 index 000000000000..80d5a9ad0900 --- /dev/null +++ b/src/sonic-frr/Makefile @@ -0,0 +1,24 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = frr_$(FRR_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Cloning FRR repo if not already done + if [ ! -d "frr" ]; then \ + git clone -b stable/$(FRR_VERSION) https://github.com/FRRouting/frr.git; \ + fi + + # Replacing frr's rules/install files with SONiC's own versions to activate + # specific knobs and adjust install process to address SONiC's needs. + cp sonic_frr.rules frr/debian/rules + cp sonic_frr.install frr/debian/frr.install + + # Build the package + pushd ./frr + rm -f debian/*.debhelper.log + dpkg-buildpackage -rfakeroot -b -us -uc + popd + + mv $* $(DEST)/ diff --git a/src/sonic-frr/sonic_frr.install b/src/sonic-frr/sonic_frr.install new file mode 100644 index 000000000000..b0bf8d6909a7 --- /dev/null +++ b/src/sonic-frr/sonic_frr.install @@ -0,0 +1,23 @@ +etc/frr/ +etc/init.d/ +usr/bin/vtysh +usr/include/frr/ +usr/lib/ +tools/frr-reload.py usr/lib/frr/ +tools/frr usr/lib/frr +usr/share/doc/frr/ +usr/share/man/man1/vtysh.1 +usr/share/man/man1/frr.1 +usr/share/man/man8 +usr/share/man/man8/bgpd.8 +usr/share/man/man8/ospf6d.8 +usr/share/man/man8/ospfd.8 +usr/share/man/man8/ripd.8 +usr/share/man/man8/ripngd.8 +usr/share/man/man8/zebra.8 +usr/share/man/man8/isisd.8 +usr/share/man/man8/watchfrr.8 +usr/share/snmp/mibs/ +cumulus/etc/* etc/ +tools/*.service lib/systemd/system +debian/frr.conf usr/lib/tmpfiles.d diff --git a/src/sonic-frr/sonic_frr.rules b/src/sonic-frr/sonic_frr.rules new file mode 100755 index 000000000000..f4e0706b5c33 --- /dev/null +++ b/src/sonic-frr/sonic_frr.rules @@ -0,0 +1,99 @@ +#!/usr/bin/make -f + +export DH_VERBOSE=1 +export DEB_BUILD_HARDENING=1 +export DH_OPTIONS=-v + +ifeq ($(WANT_SNMP), 1) + USE_SNMP=--enable-snmp + $(warning "DEBIAN: SNMP enabled, sorry for your inconvenience") +else + $(warning "DEBIAN: SNMP disabled, see README.Debian") +endif + +ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + DEBIAN_JOBS := $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) +endif + +ifdef DEBIAN_JOBS +MAKEFLAGS += -j$(DEBIAN_JOBS) +endif + +%: + dh $@ --with=systemd,autoreconf --parallel --dbg-package=frr-dbg --list-missing + +override_dh_auto_configure: + # Frr needs /proc to check some BSD vs Linux specific stuff. + # Else it fails with an obscure error message pointing out that + # IPCTL_FORWARDING is an undefined symbol which is not very helpful. + @if ! [ -d /proc/1 ]; then \ + echo "./configure needs a mounted /proc"; \ + exit 1; \ + fi + + if ! [ -e config.status ]; then \ + dh_auto_configure -- \ + --enable-exampledir=/usr/share/doc/frr/examples/ \ + --localstatedir=/var/run/frr \ + --sbindir=/usr/lib/frr \ + --sysconfdir=/etc/frr \ + $(USE_SNMP) \ + --enable-vtysh=yes \ + --enable-isisd=yes \ + --enable-multipath=256 \ + --enable-user=frr \ + --enable-group=frr \ + --enable-vty-group=frrvty \ + --enable-configfile-mask=0640 \ + --enable-logfile-mask=0640 \ + --enable-werror \ + --enable-gcc-rdynamic \ + --with-libpam \ + --enable-systemd=yes \ + --enable-poll=yes \ + --enable-dependency-tracking \ + --enable-bgp-vnc=no \ + --enable-tcp-zebra \ + --enable-fpm; \ + fi + +override_dh_auto_build: + #dh_auto_build + $(MAKE) + dh_auto_build -- -C doc draft-zebra-00.txt + + + # doc/ is a bit crazy +ifeq ($(GENERATE_PDF), 1) + dh_auto_build -- -C doc frr.pdf || true # pdfetex fails with exit code 1 but still produces a good looking .pdf +endif + rm -vf doc/frr.info + dh_auto_build -- -C doc frr.info + rm -vf doc/frr.info.html* + +override_dh_auto_test: + +override_dh_auto_install: + dh_auto_install + + # cleaning up the info dir + rm -f debian/tmp/usr/share/info/dir* + + # install config files + mkdir -p debian/tmp/etc/frr/ + perl -pi -e 's#^!log file #!log file /var/log/frr/#' debian/tmp/usr/share/doc/frr/examples/*sample* + + # installing frr initialization script + mkdir -p debian/tmp/etc/init.d/ + cp debian/tmp/usr/lib/frr/frr debian/tmp/etc/init.d/ + + # installing the Frr specific SNMP MIB +ifeq ($(WANT_SNMP), 1) + install -D -m 644 ./zebra/GNOME-PRODUCT-ZEBRA-MIB debian/tmp/usr/share/snmp/mibs/GNOME-PRODUCT-ZEBRA-MIB +else + mkdir -p debian/tmp/usr/share/snmp/mibs/ +endif + + # cleaning .la files + sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/*.la + From 2c4c6e9cebd60bd6ee3223f6c32579a33c0de8ef Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 20 Apr 2017 14:37:09 -0700 Subject: [PATCH 0459/1833] Use syncd-rpc for docker-syncd-rpc (#522) * Use syncd rpc for docker-syncd-rpc. Create docker-syncd-rpc for cavium and centec --- platform/broadcom/docker-syncd-brcm-rpc.mk | 2 +- .../docker-syncd-brcm-rpc/Dockerfile.j2 | 2 +- platform/broadcom/rules.mk | 2 +- platform/cavium/docker-syncd-cavm-rpc.mk | 7 +++ .../docker-syncd-cavm-rpc/Dockerfile.j2 | 56 +++++++++++++++++++ .../docker-syncd-cavm-rpc/ptf_nn_agent.conf | 10 ++++ .../docker-syncd-cavm-rpc/supervisord.conf | 2 + platform/cavium/rules.mk | 6 +- platform/centec/docker-syncd-centec-rpc.mk | 7 +++ .../docker-syncd-centec-rpc/Dockerfile.j2 | 56 +++++++++++++++++++ .../docker-syncd-centec-rpc/ptf_nn_agent.conf | 10 ++++ .../docker-syncd-centec-rpc/supervisord.conf | 2 + platform/centec/rules.mk | 6 +- platform/mellanox/docker-syncd-mlnx-rpc.mk | 2 +- .../docker-syncd-mlnx-rpc/Dockerfile.j2 | 2 +- platform/mellanox/rules.mk | 2 +- rules/sairedis.mk | 6 +- src/sonic-sairedis | 2 +- 18 files changed, 170 insertions(+), 12 deletions(-) create mode 100644 platform/cavium/docker-syncd-cavm-rpc.mk create mode 100644 platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 create mode 100644 platform/cavium/docker-syncd-cavm-rpc/ptf_nn_agent.conf create mode 100644 platform/cavium/docker-syncd-cavm-rpc/supervisord.conf create mode 100644 platform/centec/docker-syncd-centec-rpc.mk create mode 100644 platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 create mode 100644 platform/centec/docker-syncd-centec-rpc/ptf_nn_agent.conf create mode 100644 platform/centec/docker-syncd-centec-rpc/supervisord.conf diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk index 2fbca8f30978..8efd25eb9b49 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -2,7 +2,7 @@ DOCKER_SYNCD_BRCM_RPC = docker-syncd-brcm-rpc.gz $(DOCKER_SYNCD_BRCM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-brcm-rpc -$(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD) $(LIBTHRIFT) +$(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(DOCKER_SYNCD_BRCM_RPC)_FILES += $(DSSERVE) $(BCMCMD) $(DOCKER_SYNCD_BRCM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BRCM) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) diff --git a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 index 40c573f09c79..c70920274709 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 @@ -45,7 +45,7 @@ RUN apt-get update \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ - && rm -rf /deps + && rm -rf /root/deps COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index bf375575edad..d2eb4482e96d 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -25,7 +25,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ $(DOCKER_SYNCD_BRCM_RPC) # Inject brcm sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) +$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) $(LIBSAITHRIFT_DEV_BRCM) # Runtime dependency on brcm sai is set only for syncd $(SYNCD)_RDEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) diff --git a/platform/cavium/docker-syncd-cavm-rpc.mk b/platform/cavium/docker-syncd-cavm-rpc.mk new file mode 100644 index 000000000000..ac725a1bbdeb --- /dev/null +++ b/platform/cavium/docker-syncd-cavm-rpc.mk @@ -0,0 +1,7 @@ +# docker image for cavium syncd with rpc + +DOCKER_SYNCD_CAVM_RPC = docker-syncd-cavm-rpc.gz +$(DOCKER_SYNCD_CAVM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm-rpc +$(DOCKER_SYNCD_CAVM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS) +$(DOCKER_SYNCD_CAVM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_CAVM) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC) diff --git a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 new file mode 100644 index 000000000000..1df6dc7802dd --- /dev/null +++ b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 @@ -0,0 +1,56 @@ +FROM docker-syncd-cavm + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +COPY \ +{% for deb in docker_syncd_cavm_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -P syncd + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +{% for deb in docker_syncd_cavm_rpc_debs.split(' ') -%} +dpkg_apt debs/{{ deb }}{{'; '}} +{%- endfor %} + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + python-pip \ + build-essential \ + libssl-dev \ + libffi-dev \ + python-dev \ + wget \ + cmake \ + supervisor \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ + && pip install cffi==1.7.0 \ + && pip install --upgrade cffi==1.7.0 \ + && pip install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /root/deps + +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf + +RUN sed -i 's/read/sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord/' /usr/bin/start.sh + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/platform/cavium/docker-syncd-cavm-rpc/ptf_nn_agent.conf b/platform/cavium/docker-syncd-cavm-rpc/ptf_nn_agent.conf new file mode 100644 index 000000000000..fa1ed0eb1622 --- /dev/null +++ b/platform/cavium/docker-syncd-cavm-rpc/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/platform/cavium/docker-syncd-cavm-rpc/supervisord.conf b/platform/cavium/docker-syncd-cavm-rpc/supervisord.conf new file mode 100644 index 000000000000..54296b8b254e --- /dev/null +++ b/platform/cavium/docker-syncd-cavm-rpc/supervisord.conf @@ -0,0 +1,2 @@ +[supervisord] +nodaemon=true diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 0d20b1c43993..6eeffbc7f9b2 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -1,5 +1,6 @@ include $(PLATFORM_PATH)/cavm-sai.mk include $(PLATFORM_PATH)/docker-syncd-cavm.mk +include $(PLATFORM_PATH)/docker-syncd-cavm-rpc.mk include $(PLATFORM_PATH)/docker-orchagent-cavm.mk include $(PLATFORM_PATH)/cavm-platform-modules.mk include $(PLATFORM_PATH)/cavm-xpnet.mk @@ -8,10 +9,11 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ - $(DOCKER_FPM) + $(DOCKER_FPM) \ + $(DOCKER_SYNCD_CAVM_RPC) # Inject cavium sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) +$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) $(LIBSAITHRIFT_DEV_CAVM) # Runtime dependency on cavium sai is set only for syncd $(SYNCD)_RDEPENDS += $(CAVM_SAI) diff --git a/platform/centec/docker-syncd-centec-rpc.mk b/platform/centec/docker-syncd-centec-rpc.mk new file mode 100644 index 000000000000..68b940f8d2b6 --- /dev/null +++ b/platform/centec/docker-syncd-centec-rpc.mk @@ -0,0 +1,7 @@ +# docker image for centec syncd with rpc + +DOCKER_SYNCD_CENTEC_RPC = docker-syncd-centec-rpc.gz +$(DOCKER_SYNCD_CENTEC_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-centec-rpc +$(DOCKER_SYNCD_CENTEC_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) +$(DOCKER_SYNCD_CENTEC_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_CENTEC) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) diff --git a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 new file mode 100644 index 000000000000..a0384c14f571 --- /dev/null +++ b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 @@ -0,0 +1,56 @@ +FROM docker-syncd-centec + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +COPY \ +{% for deb in docker_syncd_centec_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -P syncd + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +{% for deb in docker_syncd_centec_rpc_debs.split(' ') -%} +dpkg_apt debs/{{ deb }}{{'; '}} +{%- endfor %} + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + python-pip \ + build-essential \ + libssl-dev \ + libffi-dev \ + python-dev \ + wget \ + cmake \ + supervisor \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ + && pip install cffi==1.7.0 \ + && pip install --upgrade cffi==1.7.0 \ + && pip install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /root/deps + +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf + +RUN sed -i 's/read/sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord/' /usr/bin/start.sh + +ENTRYPOINT ["/bin/bash"] +CMD ["/usr/bin/start.sh"] diff --git a/platform/centec/docker-syncd-centec-rpc/ptf_nn_agent.conf b/platform/centec/docker-syncd-centec-rpc/ptf_nn_agent.conf new file mode 100644 index 000000000000..fa1ed0eb1622 --- /dev/null +++ b/platform/centec/docker-syncd-centec-rpc/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/platform/centec/docker-syncd-centec-rpc/supervisord.conf b/platform/centec/docker-syncd-centec-rpc/supervisord.conf new file mode 100644 index 000000000000..54296b8b254e --- /dev/null +++ b/platform/centec/docker-syncd-centec-rpc/supervisord.conf @@ -0,0 +1,2 @@ +[supervisord] +nodaemon=true diff --git a/platform/centec/rules.mk b/platform/centec/rules.mk index 9e53996c0a36..0dcf050fe417 100644 --- a/platform/centec/rules.mk +++ b/platform/centec/rules.mk @@ -2,14 +2,16 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/docker-orchagent-centec.mk include $(PLATFORM_PATH)/docker-syncd-centec.mk +include $(PLATFORM_PATH)/docker-syncd-centec-rpc.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk -SONIC_ALL += $(SONIC_ONE_IMAGE) +SONIC_ALL += $(SONIC_ONE_IMAGE) \ + $(DOCKER_SYNCD_CENTEC_RPC) # Inject centec sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(CENTEC_SAI) +$(LIBSAIREDIS)_DEPENDS += $(CENTEC_SAI) $(LIBSAITHRIFT_DEV_CENTEC) # Runtime dependency on centec sai is set only for syncd $(SYNCD)_RDEPENDS += $(CENTEC_SAI) diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index 7aab3c802327..8c5411454086 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) $(LIBTHRIFT) +$(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(DOCKER_SYNCD_MLNX_RPC)_FILES += $(MLNX_FW) $(DOCKER_SYNCD_MLNX_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MLNX) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 64e208112783..c8b312b1c677 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -45,7 +45,7 @@ RUN apt-get update \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ - && rm -rf /deps + && rm -rf /root/deps COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 967643167da9..a56d9b0d5748 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -15,7 +15,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_SYNCD_MLNX_RPC) # Inject mlnx sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) +$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) $(LIBSAITHRIFT_DEV_MLNX) # Runtime dependency on mlnx sai is set only for syncd $(SYNCD)_RDEPENDS += $(MLNX_SAI) diff --git a/rules/sairedis.mk b/rules/sairedis.mk index 02c20ef54588..87838a3aeebe 100644 --- a/rules/sairedis.mk +++ b/rules/sairedis.mk @@ -2,7 +2,7 @@ LIBSAIREDIS = libsairedis_1.0.0_amd64.deb $(LIBSAIREDIS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis -$(LIBSAIREDIS)_DEPENDS += $(LIBSWSSCOMMON_DEV) +$(LIBSAIREDIS)_DEPENDS += $(LIBSWSSCOMMON_DEV) $(LIBTHRIFT_DEV) $(LIBSAIREDIS)_RDEPENDS += $(LIBSWSSCOMMON) SONIC_DPKG_DEBS += $(LIBSAIREDIS) @@ -13,6 +13,10 @@ SYNCD = syncd_1.0.0_amd64.deb $(SYNCD)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD))) +SYNCD_RPC = syncd-rpc_1.0.0_amd64.deb +$(SYNCD_RPC)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_RPC))) + LIBSAIMETADATA = libsaimetadata_1.0.0_amd64.deb $(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA))) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index e28e4c038572..230f322b66f4 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit e28e4c038572aeea65491424a86fcb4f1ac229de +Subproject commit 230f322b66f4da67b5dba7dbedf39e70219a21f7 From 7dc1045c2606faeb88fbc70a9f8293926922a0d3 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 21 Apr 2017 08:21:41 -0700 Subject: [PATCH 0460/1833] [swss]: Export platform as env variable in docker-swss (#524) Signed-off-by: Shuotian Cheng --- dockers/docker-orchagent/start.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 088d0fe1bcf0..47fa198e0b08 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -1,5 +1,7 @@ #!/bin/bash +export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v platform` + function start_app { orchagent $ORCHAGENT_ARGS & portsyncd $PORTSYNCD_ARGS & From 6c202919b30a04930f794e2a2ee4c4d8a19c2b10 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 21 Apr 2017 08:22:44 -0700 Subject: [PATCH 0461/1833] [System logs]: Eliminate duplicate log messages and attempt rotation more frequently (#520) * Rename 'ACSFileFormat' -> 'SONiCFileFormat' * Rename '00-acs.conf' -> '00-sonic.conf' * Add logrotate.d and systemd-journald config files to image * Log all SONiC process messages to /var/log/syslog; prevent duplicate logging to /var/log/messages * Do not redirect cron and daemon logs to their own files, let them log to /var/log/syslog * Log all teamd messages to /var/log/teamd.log; Add more SONiC program names to SONiC rules clause * Remove duplicate code by condensing quagga programs into a list; Fix teamd log rule * Kernel and LPR messages no longer getting duplicated to their own log files * Now calling logrotate every minute via cron job * Need full path to logrotate in cron job * Add '.log' suffix to wildcards, otherwise logrotate will rotate already-rotated logs (e.g., bgpd.log.1.1.1.1.1...) * Add microsecond granularity to syslog messages * Don't overwrite system crontab, instead, install additional logrotate crontab file into /etc/cron.d * Removed incomplete concept of per-process SONiC logs. We can revisit again later --- dockers/docker-base/rsyslog.conf | 4 +- .../build_templates/sonic_debian_extension.j2 | 9 ++++ files/image_config/cron.d/logrotate | 3 ++ files/image_config/logrotate.d/rsyslog | 43 +++++++++++++++++ files/image_config/rsyslog/rsyslog.conf.j2 | 4 +- .../rsyslog/rsyslog.d/00-acs.conf | 46 ------------------- .../rsyslog/rsyslog.d/00-sonic.conf | 22 +++++++++ .../rsyslog/rsyslog.d/99-default.conf | 23 ++++++---- files/image_config/systemd/journald.conf | 36 +++++++++++++++ platform/p4/docker-sonic-p4/rsyslog.conf | 4 +- 10 files changed, 133 insertions(+), 61 deletions(-) create mode 100644 files/image_config/cron.d/logrotate create mode 100644 files/image_config/logrotate.d/rsyslog delete mode 100644 files/image_config/rsyslog/rsyslog.d/00-acs.conf create mode 100644 files/image_config/rsyslog/rsyslog.d/00-sonic.conf create mode 100644 files/image_config/systemd/journald.conf diff --git a/dockers/docker-base/rsyslog.conf b/dockers/docker-base/rsyslog.conf index e03df1f741c2..1132ad55ec3c 100644 --- a/dockers/docker-base/rsyslog.conf +++ b/dockers/docker-base/rsyslog.conf @@ -39,8 +39,8 @@ $ModLoad imuxsock # provides support for local system logging #$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat # Define a custom template -$template ACSFileFormat,"%TIMESTAMP% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" -$ActionFileDefaultTemplate ACSFileFormat +$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" +$ActionFileDefaultTemplate SONiCFileFormat # # Set the default permissions for all log files. diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 77fcd1f38655..16a25d2c3efc 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -88,6 +88,9 @@ sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-device-data_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Copy crontabs +sudo cp -f $IMAGE_CONFIGS/cron.d/* $FILESYSTEM_ROOT/etc/cron.d/ + # Copy NTP configuration files and templates sudo cp $IMAGE_CONFIGS/ntp/ntp-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.service @@ -101,6 +104,12 @@ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.sh $FILESYSTEM_ROOT/usr/bin/ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.conf.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/* $FILESYSTEM_ROOT/etc/rsyslog.d/ +# Copy logrotate.d configuration files +sudo cp -f $IMAGE_CONFIGS/logrotate.d/rsyslog $FILESYSTEM_ROOT/etc/logrotate.d/ + +# Copy systemd-journald configuration files +sudo cp -f $IMAGE_CONFIGS/systemd/journald.conf $FILESYSTEM_ROOT/etc/systemd/ + # Copy interfaces configuration files and templates sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable interfaces-config.service diff --git a/files/image_config/cron.d/logrotate b/files/image_config/cron.d/logrotate new file mode 100644 index 000000000000..e7813aa1f57b --- /dev/null +++ b/files/image_config/cron.d/logrotate @@ -0,0 +1,3 @@ +# Attempt to rotate system logs once per minute +* * * * * root /usr/sbin/logrotate -f /etc/logrotate.d/rsyslog + diff --git a/files/image_config/logrotate.d/rsyslog b/files/image_config/logrotate.d/rsyslog new file mode 100644 index 000000000000..c09604187f7f --- /dev/null +++ b/files/image_config/logrotate.d/rsyslog @@ -0,0 +1,43 @@ +/var/log/syslog +/var/log/quagga/*.log +/var/log/teamd.log +{ + rotate 7 +# Removed 'daily' interval, as we now call logrotate more frequently via cron +# and we want to check these logs every time +# daily + size 100M + missingok + notifempty + compress + delaycompress + postrotate + invoke-rc.d rsyslog rotate > /dev/null + endscript +} +/var/log/mail.info +/var/log/mail.warn +/var/log/mail.err +/var/log/mail.log +/var/log/daemon.log +/var/log/kern.log +/var/log/auth.log +/var/log/user.log +/var/log/lpr.log +/var/log/cron.log +/var/log/debug +/var/log/messages +{ + rotate 4 + weekly + size 100M + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + invoke-rc.d rsyslog rotate > /dev/null + endscript +} + diff --git a/files/image_config/rsyslog/rsyslog.conf.j2 b/files/image_config/rsyslog/rsyslog.conf.j2 index e00565f056eb..008f9f10e6f0 100644 --- a/files/image_config/rsyslog/rsyslog.conf.j2 +++ b/files/image_config/rsyslog/rsyslog.conf.j2 @@ -42,8 +42,8 @@ $UDPServerRun 514 #$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat # Define a custom template -$template ACSFileFormat,"%TIMESTAMP% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" -$ActionFileDefaultTemplate ACSFileFormat +$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" +$ActionFileDefaultTemplate SONiCFileFormat # # Set the default permissions for all log files. diff --git a/files/image_config/rsyslog/rsyslog.d/00-acs.conf b/files/image_config/rsyslog/rsyslog.d/00-acs.conf deleted file mode 100644 index ec8ce919f402..000000000000 --- a/files/image_config/rsyslog/rsyslog.d/00-acs.conf +++ /dev/null @@ -1,46 +0,0 @@ -## Quagga rules - -if $programname == "zebra" then { - /var/log/quagga/zebra.log - stop -} - -if $programname == "bgpd" then { - /var/log/quagga/bgpd.log - stop -} - -if $programname == "quagga" then { - /var/log/quagga/zebra.log - stop -} - -if $programname == "watchquagga" then { - /var/log/quagga/zebra.log - stop -} - -## Platform modules rules -if $programname == "platform-modules" then { - /var/log/syslog - stop -} - -## Sensord rules -if $programname == "sensord" then { - /var/log/syslog - stop -} - -## Sswsyncd rules -if $programname == "sswsyncd" then { - /var/log/syslog - stop -} - -## Ansible rules -if $programname startswith "ansible" then { - /var/log/messages - stop -} - diff --git a/files/image_config/rsyslog/rsyslog.d/00-sonic.conf b/files/image_config/rsyslog/rsyslog.d/00-sonic.conf new file mode 100644 index 000000000000..20d18e5d226d --- /dev/null +++ b/files/image_config/rsyslog/rsyslog.d/00-sonic.conf @@ -0,0 +1,22 @@ +## Quagga rules + +if $programname == ["quagga", + "watchquagga", + "zebra"] + then { + /var/log/quagga/zebra.log + stop +} + +if $programname == "bgpd" then { + /var/log/quagga/bgpd.log + stop +} + +## Teamd rules + +if $programname contains "teamd_" then { + /var/log/teamd.log + stop +} + diff --git a/files/image_config/rsyslog/rsyslog.d/99-default.conf b/files/image_config/rsyslog/rsyslog.d/99-default.conf index a26ba7baf8e6..9b129199b385 100644 --- a/files/image_config/rsyslog/rsyslog.d/99-default.conf +++ b/files/image_config/rsyslog/rsyslog.d/99-default.conf @@ -3,11 +3,13 @@ # auth,authpriv.* /var/log/auth.log *.*;auth,authpriv.none -/var/log/syslog -cron.* /var/log/cron.log -daemon.* -/var/log/daemon.log -kern.* -/var/log/kern.log -kern.* -/var/persist/log/kern.log -lpr.* -/var/log/lpr.log +# Do not redirect cron, daemon, kernel or lpr logs to +# their own files. Let them log to /var/log/syslog +#cron.* /var/log/cron.log +#daemon.* -/var/log/daemon.log +#kern.* -/var/log/kern.log +#kern.* -/var/persist/log/kern.log +#lpr.* -/var/log/lpr.log mail.* -/var/log/mail.log user.* -/var/log/user.log @@ -32,10 +34,13 @@ news.notice -/var/log/news/news.notice *.=debug;\ auth,authpriv.none;\ news.none;mail.none -/var/log/debug -*.=info;*.=notice;*.=warn;\ - auth,authpriv.none;\ - cron,daemon.none;\ - mail,news.none -/var/log/messages +# +# Removed as duplicates: +#*.=info;*.=notice;*.=warn;\ +# auth,authpriv.none;\ +# cron,daemon.none;\ +# mail,news.none -/var/log/messages +# *.=crit;*.=alert;*.=emerg -/var/persist/log/alarms # # Emergencies are sent to everybody logged in. diff --git a/files/image_config/systemd/journald.conf b/files/image_config/systemd/journald.conf new file mode 100644 index 000000000000..fc6c4a4e7a1a --- /dev/null +++ b/files/image_config/systemd/journald.conf @@ -0,0 +1,36 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# See journald.conf(5) for details + +[Journal] +#Storage=auto +#Compress=yes +#Seal=yes +#SplitMode=uid +#SyncIntervalSec=5m +#RateLimitInterval=30s +#RateLimitBurst=1000 +SystemMaxUse=50MB +#SystemKeepFree= +#SystemMaxFileSize= +RuntimeMaxUse=50MB +#RuntimeKeepFree= +#RuntimeMaxFileSize= +#MaxRetentionSec= +#MaxFileSec=1month +#ForwardToSyslog=yes +#ForwardToKMsg=no +#ForwardToConsole=no +#ForwardToWall=yes +#TTYPath=/dev/console +#MaxLevelStore=debug +#MaxLevelSyslog=debug +#MaxLevelKMsg=notice +#MaxLevelConsole=info +#MaxLevelWall=emerg + diff --git a/platform/p4/docker-sonic-p4/rsyslog.conf b/platform/p4/docker-sonic-p4/rsyslog.conf index d82ea610d6a7..e8f42bdabe50 100644 --- a/platform/p4/docker-sonic-p4/rsyslog.conf +++ b/platform/p4/docker-sonic-p4/rsyslog.conf @@ -39,8 +39,8 @@ $ModLoad imuxsock # provides support for local system logging #$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat # Define a custom template -$template ACSFileFormat,"%TIMESTAMP% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" -$ActionFileDefaultTemplate ACSFileFormat +$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" +$ActionFileDefaultTemplate SONiCFileFormat # # Set the default permissions for all log files. From 4fe9416a1435e5e0078a2cd1ff938c32fc01a5ba Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 21 Apr 2017 14:04:06 -0700 Subject: [PATCH 0462/1833] Update sairedis submodule (#526) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 230f322b66f4..f041648f874f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 230f322b66f4da67b5dba7dbedf39e70219a21f7 +Subproject commit f041648f874f21d2cd4a7255c9b3bb8870557e36 From c7ea3470ed3262b3f4f1e7531ab777e1c1b82063 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Sat, 22 Apr 2017 00:28:30 +0300 Subject: [PATCH 0463/1833] [swss]: Generate config files for Everflow and IPinIP from minigraph (#507) [swss]: Generate config files for Everflow and IPinIP from minigraph - Add Everflow DST IP to minigraph file - Extend minigraph.py to support Everflow - Add templates file for Everflow and IPinIP configuration - Add config.sh for swss docker to generate config files --- .../x86_64-accton_as7512_32x-r0/minigraph.xml | 5 +++++ .../x86_64-arista_7050_qx32/minigraph.xml | 5 +++++ .../x86_64-arista_7060_cx32s/minigraph.xml | 5 +++++ .../x86_64-dell_s6000_s1220-r0/minigraph.xml | 5 +++++ .../x86_64-dell_s6100_c2538-r0/minigraph.xml | 5 +++++ .../x86_64-dell_z9100_c2538-r0/minigraph.xml | 5 +++++ .../x86_64-ingrasys_s9100-r0/minigraph.xml | 5 +++++ .../x86_64-mlnx_msn2410-r0/minigraph.xml | 5 +++++ .../x86_64-mlnx_msn2700-r0/minigraph.xml | 5 +++++ dockers/docker-orchagent/Dockerfile.j2 | 3 +++ dockers/docker-orchagent/config.sh | 6 ++++++ dockers/docker-orchagent/ipinip.json.j2 | 19 +++++++++++++++++ dockers/docker-orchagent/mirror.json.j2 | 21 +++++++++++++++++++ dockers/docker-orchagent/start.sh | 4 +++- src/sonic-config-engine/minigraph.py | 9 ++++++-- .../tests/sample_output/ipinip.json | 14 +++++++++++++ .../tests/sample_output/mirror.json | 14 +++++++++++++ .../tests/t0-sample-graph.xml | 15 +++++++++++++ src/sonic-config-engine/tests/test_j2files.py | 19 +++++++++++++++++ 19 files changed, 166 insertions(+), 3 deletions(-) create mode 100755 dockers/docker-orchagent/config.sh create mode 100644 dockers/docker-orchagent/ipinip.json.j2 create mode 100644 dockers/docker-orchagent/mirror.json.j2 create mode 100644 src/sonic-config-engine/tests/sample_output/ipinip.json create mode 100644 src/sonic-config-engine/tests/sample_output/mirror.json diff --git a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml index f2326c44aae3..758aca3551d6 100644 --- a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml @@ -1064,6 +1064,11 @@ + + ErspanDestinationIpv4 + + 2.2.2.2 + diff --git a/device/arista/x86_64-arista_7050_qx32/minigraph.xml b/device/arista/x86_64-arista_7050_qx32/minigraph.xml index f2ef7b0b8bc2..bbf2508ce4cc 100644 --- a/device/arista/x86_64-arista_7050_qx32/minigraph.xml +++ b/device/arista/x86_64-arista_7050_qx32/minigraph.xml @@ -1064,6 +1064,11 @@ + + ErspanDestinationIpv4 + + 2.2.2.2 + diff --git a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml index 5d7dcea980ff..513a60254818 100644 --- a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml +++ b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml @@ -1064,6 +1064,11 @@ + + ErspanDestinationIpv4 + + 2.2.2.2 + diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml b/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml index 0fd1f49ab868..871a91c7fd02 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml +++ b/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml @@ -1064,6 +1064,11 @@ + + ErspanDestinationIpv4 + + 2.2.2.2 + diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml index 3ae8e77f8024..37fba6c291b1 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml +++ b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml @@ -759,6 +759,11 @@ + + ErspanDestinationIpv4 + + 2.2.2.2 + diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml index ab1ce20a69a8..b45892801ed3 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml +++ b/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml @@ -1064,6 +1064,11 @@ + + ErspanDestinationIpv4 + + 2.2.2.2 + diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml index d56428187aa8..0c4dec50942a 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml @@ -136,6 +136,11 @@ + + ErspanDestinationIpv4 + + 2.2.2.2 + diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml index 01cfdd03c635..ed21b8d6eeb9 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml @@ -510,6 +510,11 @@ + + ErspanDestinationIpv4 + + 2.2.2.2 + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml index 4942e64be5e9..ecbabba18da2 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml @@ -1064,6 +1064,11 @@ + + ErspanDestinationIpv4 + + 2.2.2.2 + diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 507b0bf03355..55f3b504f820 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -23,6 +23,9 @@ debs/{{ deb }}{{' '}} {%- endfor %} COPY start.sh /usr/bin/start.sh +COPY config.sh /usr/bin/config.sh +COPY ipinip.json.j2 /usr/share/sonic/templates/ipinip.json.j2 +COPY mirror.json.j2 /usr/share/sonic/templates/mirror.json.j2 ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/dockers/docker-orchagent/config.sh b/dockers/docker-orchagent/config.sh new file mode 100755 index 000000000000..813dad9533c5 --- /dev/null +++ b/dockers/docker-orchagent/config.sh @@ -0,0 +1,6 @@ +#!/bin/bash -e + +mkdir -p /etc/swss/config.d/ + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 new file mode 100644 index 000000000000..19e98a41295c --- /dev/null +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -0,0 +1,19 @@ +[ + { + "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { + "tunnel_type":"IPINIP", + "src_ip":"{{ minigraph_lo_interfaces[0]['addr'] }}", + "dst_ip":"{{ minigraph_lo_interfaces[0]['addr'] }}", +{% if minigraph_hwsku in [ 'ACS-MSN2700', 'ACS-MSN2410', 'ACS-MSN2100' ] %} + "dscp_mode":"uniform", + "ecn_mode":"standard", +{% else %} + "dscp_mode":"pipe", + "ecn_mode":"copy_from_outer", +{% endif %} + "ttl_mode":"pipe" + }, + "OP": "SET" + } +] + diff --git a/dockers/docker-orchagent/mirror.json.j2 b/dockers/docker-orchagent/mirror.json.j2 new file mode 100644 index 000000000000..7a3a9250d7dc --- /dev/null +++ b/dockers/docker-orchagent/mirror.json.j2 @@ -0,0 +1,21 @@ +[ +{% if erspan_dst %} + { + "MIRROR_SESSION_TABLE:everflow": { + "src_ip": "{{ minigraph_lo_interfaces[0]['addr'] }}", + "dst_ip": "{{ erspan_dst[0] }}", +{% if minigraph_hwsku in [ 'ACS-MSN2700', 'ACS-MSN2410', 'ACS-MSN2100' ] %} + "gre_type": "0x6558", + "queue": "1", +{% else %} + "gre_type": "0x88be", + "queue": "0", +{% endif %} + "dscp": "8", + "ttl": "255" + }, + "OP": "SET" + } +{% endif %} +] + diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 47fa198e0b08..7a653c442ef8 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -1,5 +1,7 @@ #!/bin/bash +. config.sh + export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v platform` function start_app { @@ -45,7 +47,7 @@ ORCHAGENT_ARGS="" PORTSYNCD_ARGS="-p /usr/share/sonic/hwsku/port_config.ini" -SWSSCONFIG_ARGS="00-copp.config.json " +SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " if [ "$HWSKU" == "Force10-S6000" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 42086625bb90..49e8b104a46e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -282,6 +282,7 @@ def parse_meta(meta, hname): dhcp_servers = [] ntp_servers = [] mgmt_routes = [] + erspan_dst = [] device_metas = meta.find(str(QName(ns, "Devices"))) for device in device_metas.findall(str(QName(ns1, "DeviceMetadata"))): if device.find(str(QName(ns1, "Name"))).text == hname: @@ -298,7 +299,9 @@ def parse_meta(meta, hname): syslog_servers = value_group elif name == "ForcedMgmtRoutes": mgmt_routes = value_group - return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes + elif name == "ErspanDestinationIpv4": + erspan_dst = value_group + return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst def get_console_info(devices, dev, port): @@ -391,6 +394,7 @@ def parse_xml(filename, platform=None, port_config_file=None): dhcp_servers = [] ntp_servers = [] mgmt_routes = [] + erspan_dst = [] hwsku_qn = QName(ns, "HwSku") hostname_qn = QName(ns, "Hostname") @@ -412,7 +416,7 @@ def parse_xml(filename, platform=None, port_config_file=None): elif child.tag == str(QName(ns, "UngDec")): (u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname) elif child.tag == str(QName(ns, "MetadataDeclaration")): - (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes) = parse_meta(child, hostname) + (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst) = parse_meta(child, hostname) Tree = lambda: defaultdict(Tree) @@ -460,6 +464,7 @@ def parse_xml(filename, platform=None, port_config_file=None): results['dhcp_servers'] = dhcp_servers results['ntp_servers'] = ntp_servers results['forced_mgmt_routes'] = mgmt_routes + results['erspan_dst'] = erspan_dst return results diff --git a/src/sonic-config-engine/tests/sample_output/ipinip.json b/src/sonic-config-engine/tests/sample_output/ipinip.json new file mode 100644 index 000000000000..00862a379281 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/ipinip.json @@ -0,0 +1,14 @@ +[ + { + "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { + "tunnel_type":"IPINIP", + "src_ip":"10.1.0.32", + "dst_ip":"10.1.0.32", + "dscp_mode":"pipe", + "ecn_mode":"copy_from_outer", + "ttl_mode":"pipe" + }, + "OP": "SET" + } +] + diff --git a/src/sonic-config-engine/tests/sample_output/mirror.json b/src/sonic-config-engine/tests/sample_output/mirror.json new file mode 100644 index 000000000000..54065700a282 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/mirror.json @@ -0,0 +1,14 @@ +[ + { + "MIRROR_SESSION_TABLE:everflow": { + "src_ip": "10.1.0.32", + "dst_ip": "2.2.2.2", + "gre_type": "0x88be", + "queue": "0", + "dscp": "8", + "ttl": "255" + }, + "OP": "SET" + } +] + diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index 41e62dca29c2..e359b4fa629f 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -317,6 +317,21 @@ + + + + switch-t0 + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + switch-t0 Force10-S6000 diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index cf1e32aea519..6ea49efc75f2 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -46,6 +46,25 @@ def test_render_teamd(self, pc): assert pc_name in pc_list test_render_teamd(self, pc_name) + def test_ipinip(self): + ipinip_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ipinip.json.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + ipinip_file + ' > ' + self.output_file + self.run_script(argument) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', 'ipinip.json') + + assert filecmp.cmp(sample_output_file, self.output_file) + + def test_everflow(self): + everflow_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'mirror.json.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + everflow_file + ' > ' + self.output_file + self.run_script(argument) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', 'mirror.json') + + assert filecmp.cmp(sample_output_file, self.output_file) + + def tearDown(self): try: os.remove(self.output_file) From 07bc0092a949e7a1b6896c4d3487e2a44c359d4f Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Fri, 21 Apr 2017 17:22:10 -0700 Subject: [PATCH 0464/1833] [sonic-utilities]:update submodules (#525) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 5df8acb5ef48..45a8d387ab55 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 5df8acb5ef48eb34e67b0b5a693fa9f923a79da1 +Subproject commit 45a8d387ab550153d90bd5964ffe534b0dbd65a2 From b549adc36c127130b22f3c2e8c1fefb5f7b073a9 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Sat, 22 Apr 2017 03:23:36 +0300 Subject: [PATCH 0465/1833] [image]: SONiC-to-SONiC update (#464) --- build_debian.sh | 6 +- build_image.sh | 1 + files/Aboot/boot0.j2 | 30 ++-- files/image_config/platform/rc.local | 12 +- files/initramfs-tools/arista-convertfs.j2 | 6 +- files/initramfs-tools/union-mount.j2 | 9 +- installer/x86_64/install.sh | 203 +++++++++++++--------- onie-mk-demo.sh | 6 +- 8 files changed, 166 insertions(+), 107 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 9840280fc849..7d763a46f2e5 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -116,8 +116,11 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-3.16.0-4-amd64_*.de ## Update initramfs for booting with squashfs+aufs cat files/initramfs-tools/modules | sudo tee -a $FILESYSTEM_ROOT/etc/initramfs-tools/modules > /dev/null +IMAGE_VERSION=$(. functions.sh && sonic_get_version) + ## Hook into initramfs: change fs type from vfat to ext4 on arista switches sudo mkdir -p $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/ +sed -i -e "s/%%IMAGE_VERSION%%/$IMAGE_VERSION/g" files/initramfs-tools/arista-convertfs sudo cp files/initramfs-tools/arista-convertfs $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs sudo cp files/initramfs-tools/mke2fs $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs @@ -195,7 +198,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in iptables-persistent \ logrotate \ curl \ - kexec-tools + kexec-tools \ + unzip ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec diff --git a/build_image.sh b/build_image.sh index 7ac3085463dd..a275c383c45d 100755 --- a/build_image.sh +++ b/build_image.sh @@ -45,6 +45,7 @@ elif [ "$IMAGE_TYPE" = "aboot" ]; then cp $ONIE_INSTALLER_PAYLOAD $OUTPUT_ABOOT_IMAGE ## Add Aboot boot0 file j2 -f env files/Aboot/boot0.j2 ./onie-image.conf > files/Aboot/boot0 + sed -i -e "s/%%IMAGE_VERSION%%/$IMAGE_VERSION/g" files/Aboot/boot0 pushd files/Aboot && zip -g $OLDPWD/$OUTPUT_ABOOT_IMAGE boot0; popd pushd files/Aboot && zip -g $OLDPWD/$ABOOT_BOOT_IMAGE boot0; popd echo "$IMAGE_VERSION" >> .imagehash diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 6460ddbbecfc..42bf0719bff9 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -25,6 +25,7 @@ kernel_params=kernel-params aboot_machine="arista_unknown" target_path=/mnt/flash +image_path="$target_path/image-%%IMAGE_VERSION%%" # expect the swi to be a non empty file [ -s "$swipath" ] || exit 1 @@ -48,8 +49,10 @@ extract_image() { fi done + mkdir "$image_path" + ## Unzip the image - unzip -oq "$swipath" -x boot0 -d "$target_path" + unzip -oq "$swipath" -x boot0 -d "$image_path" ## Remove installer swi as it has lots of redundunt contents rm -f $swipath @@ -59,19 +62,22 @@ extract_image() { ## vfat does not support symbol link if [ $rootfs_type != "vfat" ]; then - mkdir -p "$target_path/{{ DOCKERFS_DIR }}" + mkdir -p "$image_path/{{ DOCKERFS_DIR }}" ## extract docker archive - tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path/{{ DOCKERFS_DIR }}" + tar xf "$image_path/{{ FILESYSTEM_DOCKERFS }}" -C "$image_path/{{ DOCKERFS_DIR }}" ## clean up docker archive - rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}" + rm -f "$image_path/{{ FILESYSTEM_DOCKERFS }}" else echo "/mnt/flash is $rootfs_type, extract {{ FILESYSTEM_DOCKERFS }} in later stage" fi - ## replace with boot swi - mv "$target_path/{{ ABOOT_BOOT_IMAGE }}" "$swipath" + ## use new reduced-size boot swi + echo "SWI=flash:image-%%IMAGE_VERSION%%/{{ ABOOT_BOOT_IMAGE }}" > "$target_path/boot-config" + + ## remove original boot swi + rm -f "$swipath" ## sync disk operations sync @@ -118,14 +124,14 @@ echo "$append" >/tmp/append parse_environment_config >>/tmp/append cat /etc/cmdline | sed "/^\(${bootconfigvars// /\|}\|crashkernel\|loglevel\|ignore_loglevel\)\(\$\|=\)/d;/^\$/d" >>/tmp/append -echo "rw loop=fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor quiet" >>/tmp/append +echo "rw loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor quiet" >>/tmp/append # process platform specific operations platform_specific # use extra parameters from kernel-params hook if the file exists -if [ -f "$target_path/$kernel_params" ]; then - cat "$target_path/$kernel_params" >>/tmp/append +if [ -f "$image_path/$kernel_params" ]; then + cat "$image_path/$kernel_params" >>/tmp/append fi # setting root partition if not overridden by kernel-params @@ -137,15 +143,15 @@ fi # check the hash file in the image, and determine to install or just skip GIT_REVISION=$(unzip -p "$swipath" .imagehash) -LOCAL_IMAGEHASH=$(cat $target_path/.imagehash 2>/dev/null || true) +LOCAL_IMAGEHASH=$(cat $image_path/.imagehash 2>/dev/null || true) if [ "$GIT_REVISION" != "$LOCAL_IMAGEHASH" ]; then extract_image write_machine_config fi # chainloading using kexec -initrd_path="$target_path/$initrd" -kernel_path="$target_path/$kernel" +initrd_path="$image_path/$initrd" +kernel_path="$image_path/$kernel" cmdline="$(tr '\n' ' ' > $grub_cfg menuentry '$demo_grub_entry' { search --no-floppy --label --set=root $demo_volume_label - echo 'Loading $demo_volume_revision_label $demo_type kernel ...' + echo 'Loading $demo_volume_label $demo_type kernel ...' insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 - linux /boot/vmlinuz-3.16.0-4-amd64 root=$demo_dev rw $GRUB_CMDLINE_LINUX \ - loop=$FILESYSTEM_SQUASHFS loopfstype=squashfs \ + linux /$image_dir/boot/vmlinuz-3.16.0-4-amd64 root=$demo_dev rw $GRUB_CMDLINE_LINUX \ + loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ apparmor=1 security=apparmor $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX - echo 'Loading $demo_volume_revision_label $demo_type initial ramdisk ...' - initrd /boot/initrd.img-3.16.0-4-amd64 + echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' + initrd /$image_dir/boot/initrd.img-3.16.0-4-amd64 } EOF -# Add menu entries for ONIE -- use the grub fragment provided by the -# ONIE distribution. -$onie_root_dir/grub.d/50_onie_grub >> $grub_cfg +if [ "$install_env" != "sonic" ]; then + # Add menu entries for ONIE -- use the grub fragment provided by the + # ONIE distribution. + $onie_root_dir/grub.d/50_onie_grub >> $grub_cfg + mkdir -p $onie_initrd_tmp/$demo_mnt/grub +else +cat <> $grub_cfg +$old_sonic_menuentry +$onie_menuentry +EOF +fi -mkdir -p $onie_initrd_tmp/$demo_mnt/grub cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg cd / -echo "Installed SONiC base image $demo_volume_revision_label successfully" +echo "Installed SONiC base image $demo_volume_label successfully" diff --git a/onie-mk-demo.sh b/onie-mk-demo.sh index 8997fa8c8317..91d6d1b3ceb2 100755 --- a/onie-mk-demo.sh +++ b/onie-mk-demo.sh @@ -12,7 +12,7 @@ installer_dir=$4 platform_conf=$5 output_file=$6 demo_type=$7 -git_revision=$8 +image_version=$8 onie_image_part_size=$9 shift 9 @@ -29,7 +29,7 @@ if [ ! -d $installer_dir/$arch ] || \ exit 1 fi -[ -n "$git_revision" ] || { +[ -n "$image_version" ] || { echo "Error: Invalid git revisions" exit 1 } @@ -85,7 +85,7 @@ EXTRA_CMDLINE_LINUX=`echo $EXTRA_CMDLINE_LINUX | sed -e 's/[\/&]/\\\&/g'` # Tailor the demo installer for OS mode or DIAG mode sed -i -e "s/%%DEMO_TYPE%%/$demo_type/g" \ - -e "s/%%GIT_REVISION%%/$git_revision/g" \ + -e "s/%%IMAGE_VERSION%%/$image_version/g" \ -e "s/%%ONIE_IMAGE_PART_SIZE%%/$onie_image_part_size/" \ -e "s/%%EXTRA_CMDLINE_LINUX%%/$EXTRA_CMDLINE_LINUX/" \ $tmp_installdir/install.sh || clean_up 1 From ced39ccb4cfa5db3e5a5f73c13d9bb9730345157 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sat, 22 Apr 2017 21:04:07 -0700 Subject: [PATCH 0466/1833] [swss]: Update submodule (#529) - [portsortch]: Convert the oper_status to string and remove oper_status in portsyncd - [routeorch]: Remove the logic of deciding if to add temp route or not Signed-off-by: stcheng --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 5ae03edfca8c..93dd3e938024 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 5ae03edfca8c0baac3d2a78e4cf494c306bbc506 +Subproject commit 93dd3e938024619ab1b35aacba343ba4a54bd423 From 34adb715df75b279ea597a6c1d8d5a120bcd9726 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 24 Apr 2017 13:39:29 -0700 Subject: [PATCH 0467/1833] [oneimage]: use loop variable to get image dir in /proc/cmdline for aboot image (#534) --- files/initramfs-tools/arista-convertfs.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 8a1adda583a1..7f873e7771f3 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -117,7 +117,7 @@ for x in "$@"; do varlog_size=*) varlog_size="${x#varlog_size=}" ;; - image_dir=*) + loop=*) x1="${x#loop=}" image_dir="${x1%/*}" esac From f28790ce9a1d9416df21c38bd07f3512e674c046 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 24 Apr 2017 17:55:05 -0700 Subject: [PATCH 0468/1833] [System logs]: Fix logrotate bugs (#535) - rsyslog logs were being rotated regardless of whether they exceeded their maixmum size. This was due to "-f" flag passed to logrotate in cron job. - After rotation, /var/log/syslog was never written to again. Instead, logs were written to /var/log/syslog.1. This was due to rsyslog not properly closing the file descriptor to the pre-rotated log. - Also brought back time-related rotation via the new(er) maxsize option, which performs a boolean OR operation. If the log exceeds the maxsize OR the log hasn't been rotated in the specified, it will be rotated. Using the older size option, the time-based rotation was ignored. - Also addresses issue #528 --- files/image_config/cron.d/logrotate | 2 +- files/image_config/logrotate.d/rsyslog | 20 +++++++++++++------- files/image_config/systemd/journald.conf | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/files/image_config/cron.d/logrotate b/files/image_config/cron.d/logrotate index e7813aa1f57b..877e0cb6d5d7 100644 --- a/files/image_config/cron.d/logrotate +++ b/files/image_config/cron.d/logrotate @@ -1,3 +1,3 @@ # Attempt to rotate system logs once per minute -* * * * * root /usr/sbin/logrotate -f /etc/logrotate.d/rsyslog +* * * * * root /usr/sbin/logrotate /etc/logrotate.d/rsyslog diff --git a/files/image_config/logrotate.d/rsyslog b/files/image_config/logrotate.d/rsyslog index c09604187f7f..0d03e906c9b8 100644 --- a/files/image_config/logrotate.d/rsyslog +++ b/files/image_config/logrotate.d/rsyslog @@ -3,16 +3,18 @@ /var/log/teamd.log { rotate 7 -# Removed 'daily' interval, as we now call logrotate more frequently via cron -# and we want to check these logs every time -# daily - size 100M + daily + maxsize 100M missingok notifempty compress delaycompress postrotate - invoke-rc.d rsyslog rotate > /dev/null + # Calling kill directly instead of 'service rsyslog rotate >/dev/null' due + # to bug in init-system-helpers. Bug has apparently been fixed in v1.47. + # However, Debian Jessie is still using v1.22. + # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672218 + kill -HUP $(cat /var/run/rsyslogd.pid) endscript } /var/log/mail.info @@ -30,14 +32,18 @@ { rotate 4 weekly - size 100M + maxsize 100M missingok notifempty compress delaycompress sharedscripts postrotate - invoke-rc.d rsyslog rotate > /dev/null + # Calling kill directly instead of 'service rsyslog rotate >/dev/null' due + # to bug in init-system-helpers. Bug has apparently been fixed in v1.47. + # However, Debian Jessie is still using v1.22. + # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672218 + kill -HUP $(cat /var/run/rsyslogd.pid) endscript } diff --git a/files/image_config/systemd/journald.conf b/files/image_config/systemd/journald.conf index fc6c4a4e7a1a..c32fbae57051 100644 --- a/files/image_config/systemd/journald.conf +++ b/files/image_config/systemd/journald.conf @@ -15,10 +15,10 @@ #SyncIntervalSec=5m #RateLimitInterval=30s #RateLimitBurst=1000 -SystemMaxUse=50MB +SystemMaxUse=50M #SystemKeepFree= #SystemMaxFileSize= -RuntimeMaxUse=50MB +RuntimeMaxUse=50M #RuntimeKeepFree= #RuntimeMaxFileSize= #MaxRetentionSec= From 035b08b9c4588f62662a14f7e3081a72dd461325 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 25 Apr 2017 16:53:17 +0300 Subject: [PATCH 0469/1833] [installer]: Add support for grub-set-default. (#532) Its needed for Azure/sonic-utilities#40 for user to set default image for boot. grub-set-default utility writes to value of saved_entry variable to grubenv. https://www.gnu.org/software/grub/manual/legacy/Invoking-grub_002dset_002ddefault.html This patch provides support for grub-set-default to allow user choose a default image to boot from. Signed-off-by: marian-pritsak --- installer/x86_64/install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index e08895524625..451edbe3f379 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -489,11 +489,14 @@ set timeout=5 EOF -# Add the logic to support grub-reboot +# Add the logic to support grub-reboot and grub-set-default cat <> $grub_cfg if [ -s \$prefix/grubenv ]; then load_env fi +if [ "\${saved_entry}" ] ; then + set default="\${saved_entry}" +fi if [ "\${next_entry}" ] ; then set default="\${next_entry}" set next_entry= From 147b89fa43feeb4c4765a54b6b02032fe25db9ca Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 25 Apr 2017 11:07:54 -0700 Subject: [PATCH 0470/1833] [sonic-utilities]: update sonic-utilities to use redis-load-dump to dump redis db data (#530) --- files/build_templates/sonic_debian_extension.j2 | 1 + src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 16a25d2c3efc..94f8292fb955 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -69,6 +69,7 @@ sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHEEL_NAME # Install Python client for Redis sudo LANG=C chroot $FILESYSTEM_ROOT pip install redis +sudo LANG=C chroot $FILESYSTEM_ROOT pip install redis-dump-load # Install SwSS SDK Python 2 package SWSSSDK_PY2_WHEEL_NAME=$(basename {{swsssdk_py2_wheel_path}}) diff --git a/src/sonic-utilities b/src/sonic-utilities index 45a8d387ab55..11db86112b51 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 45a8d387ab550153d90bd5964ffe534b0dbd65a2 +Subproject commit 11db86112b512bf116dea293dedafe08be318505 From d597418b6c1a13c632f65fc34335a6a663e80c4d Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 26 Apr 2017 11:41:18 +0300 Subject: [PATCH 0471/1833] [rc.local]: Copy saved minigraph if available. (#533) * [rc.local]: Copy saved minigraph if available. In case of sonic-to-sonic update old image stores minigraph under /host directory. Upon first boot this minigraph will be used by new image to save configuration. Signed-off-by: marian-pritsak --- files/image_config/platform/rc.local | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index ee593aab88ae..26f59bf94aad 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -29,7 +29,12 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then exit 0 fi - cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ + # Try to take minigraph saved during installation + if [ -f /host/minigraph.xml ]; then + mv /host/minigraph.xml /etc/sonic/ + else + cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ + fi if [ -d /host/image-$sonic_version/platform/$platform ]; then dpkg -i /host/image-$sonic_version/platform/$platform/*.deb From 0bb66ddf0c05c3e1558ef45207759bfa0c5f3b27 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Wed, 26 Apr 2017 06:12:07 -0700 Subject: [PATCH 0472/1833] [sonic-utilities]:update submodules (#537) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 11db86112b51..9ea7ae4e2e76 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 11db86112b512bf116dea293dedafe08be318505 +Subproject commit 9ea7ae4e2e76b3273a2bcf12b7434a190bba85fb From 3223996404c33c9e5587106090b423a2e9092a0e Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 26 Apr 2017 06:12:23 -0700 Subject: [PATCH 0473/1833] [Broadcom]: Update debian package versions (#538) - libsaibcm 2.1.5.1-3 Signed-off-by: Shuotian Cheng --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index c273db78a58e..7b409f381433 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-2-20170419194756.21_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-2-20170419194756.21_amd64.deb?sv=2015-04-05&sr=b&sig=On9N1tlOSbYj%2Fb0JudmUjYRTbvS5cvqcGJUEIDX8wzk%3D&se=2030-12-27T20%3A56%3A24Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-3-20170426013947.22_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-3-20170426013947.22_amd64.deb?sv=2015-04-05&sr=b&sig=nhMTShwA1OeKoLNWcIY0wMyuiDSdKYWTH%2BJGlr%2BpgU4%3D&se=2031-01-03T01%3A43%3A35Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-2-20170419194756.21_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-3-20170426013947.22_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-2-20170419194756.21_amd64.deb?sv=2015-04-05&sr=b&sig=iVQRbQUTmeKqd01pMMR%2FIwlEUsAeiGIxCrqfr24lQ8k%3D&se=2030-12-27T20%3A57%3A08Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-3-20170426013947.22_amd64.deb?sv=2015-04-05&sr=b&sig=c4%2B6zRDuA%2BTeLr3MPkAqsuvG%2BAg9cd7ffgpp2mhl9bM%3D&se=2031-01-03T01%3A43%3A08Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From ce663baa1090f0bdbdbada72d2520213ff69b183 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 26 Apr 2017 18:32:23 +0300 Subject: [PATCH 0474/1833] Update MLNX SAI revision reference (#540) This fixes https://github.com/Azure/sonic-swss/issues/191 --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 163e298553f8..461f3d904a82 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = 1a4307f0ac40b28cd8ed8f48569458212d90366e +MLNX_SAI_REVISION = d84b9fd043039a8107151750299e6e510e648ed6 export MLNX_SAI_VERSION MLNX_SAI_REVISION From d083d7e79cd9614a8874a0301ff7466ee244de34 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 26 Apr 2017 11:09:58 -0700 Subject: [PATCH 0475/1833] [database]: Remove hard/soft limits for client-output-buffer in redis (#539) * Remove hard/soft limits for client-output-buffer in redis Otherwise when we have a lot of updates from orchagent to syncd latter one can't process queues fast enough and redic-database disconnect both orchagent and syncd. orchagent and syncd doesn't have logic to deal with it and just crash --- dockers/docker-database/Dockerfile.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index a213dd079062..17a416dae69d 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -28,7 +28,8 @@ RUN sed -ri 's/^(save .*$)/# \1/g; s/^daemonize yes$/daemonize no/; \ s/^logfile .*$/logfile ""/; \ s/^# syslog-enabled no$/syslog-enabled no/; \ - s/^# unixsocket/unixsocket/ \ + s/^# unixsocket/unixsocket/; \ + s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ ' /etc/redis/redis.conf ENTRYPOINT ["/usr/bin/redis-server", "/etc/redis/redis.conf"] From eed3be9b34827cc8104053de3c9525f65fd245dc Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 27 Apr 2017 05:31:33 +0300 Subject: [PATCH 0476/1833] [mellanox]: Update hw-management to V1.0.0070 (#541) Fixed temp_max attribute in ASIC driver Fixed PSU driver load for SN2100 and SN2700 platforms Signed-off-by: marian-pritsak --- platform/mellanox/hw-management.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 47863d180dbf..83c7632376f0 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,6 +1,6 @@ # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = V1.0.0030 +MLNX_HW_MANAGEMENT_VERSION = V1.0.0070 export MLNX_HW_MANAGEMENT_VERSION From f9b88e19e6bced39561e9c2755d84f7beba4c689 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Thu, 27 Apr 2017 10:32:01 +0800 Subject: [PATCH 0477/1833] [Accton]as7512-32x: change console speed to be 115200 as BIOS's & ONIE's in default. (#536) --- device/accton/x86_64-accton_as7512_32x-r0/installer.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/accton/x86_64-accton_as7512_32x-r0/installer.conf b/device/accton/x86_64-accton_as7512_32x-r0/installer.conf index 9b49af780817..14404194ef53 100644 --- a/device/accton/x86_64-accton_as7512_32x-r0/installer.conf +++ b/device/accton/x86_64-accton_as7512_32x-r0/installer.conf @@ -1,3 +1,3 @@ CONSOLE_PORT=0x2f8 CONSOLE_DEV=1 -CONSOLE_SPEED=9600 +CONSOLE_SPEED=115200 From 03cd2cef78205950ec916400f706d84057b32eef Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 26 Apr 2017 22:19:31 -0700 Subject: [PATCH 0478/1833] [Broadcom]: Update broacom SAI to 2.1.5.1-4 and opennsl to 3.2.2.2-3 (#543) --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 7b409f381433..40e2e383408e 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-3-20170426013947.22_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-3-20170426013947.22_amd64.deb?sv=2015-04-05&sr=b&sig=nhMTShwA1OeKoLNWcIY0wMyuiDSdKYWTH%2BJGlr%2BpgU4%3D&se=2031-01-03T01%3A43%3A35Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-4~20170427032904.25_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-4~20170427032904.25_amd64.deb?sv=2015-04-05&sr=b&sig=NqmcwFHarhYwoV6WTou8wGbEMCoXZUdPXuegPUDpwU0%3D&se=2154-03-20T05%3A16%3A44Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-3-20170426013947.22_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-4~20170427032904.25_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-3-20170426013947.22_amd64.deb?sv=2015-04-05&sr=b&sig=c4%2B6zRDuA%2BTeLr3MPkAqsuvG%2BAg9cd7ffgpp2mhl9bM%3D&se=2031-01-03T01%3A43%3A08Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-4~20170427032904.25_amd64.deb?sv=2015-04-05&sr=b&sig=8RErjP5TGdXqENcTbVrgQbvVAexMt4b%2BjU2BXFb4%2B0M%3D&se=2154-03-20T05%3A16%3A07Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 0feff914f6bb..81da4554d16e 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-2-20170413185612.27_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-2-20170413185612.27_amd64.deb?sv=2015-04-05&sr=b&sig=xEbASK6Jiug8I%2BaJFphRnuH4cOEgxIyAkhj6rGKfsOE%3D&se=2030-12-21T22%3A05%3A31Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.2.2-3~20170427022824.31_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-3~20170427022824.31_amd64.deb?sv=2015-04-05&sr=b&sig=z7AoBMtlWjYNEv0q3lTN47mb9OIur4HuUTClUVJWawU%3D&se=2154-03-20T05%3A14%3A41Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-2-20170413185612.27_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-2-20170413185612.27_amd64.deb?sv=2015-04-05&sr=b&sig=i%2F4NXu0wzMSAQjDcQTg%2FtpULn5%2Fn%2FVgLu3Lg24QMQM0%3D&se=2030-12-21T22%3A06%3A49Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-3~20170427022824.31_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-3~20170427022824.31_amd64.deb?sv=2015-04-05&sr=b&sig=j3TJGtIudpIFDe6ethxEHdW8j4KALG2GTAaRSMN37CM%3D&se=2154-03-20T05%3A15%3A21Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From cc9a7982edfb9c8c80271d82d1aa0b7c3e0da446 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 27 Apr 2017 13:03:06 -0700 Subject: [PATCH 0479/1833] Update SAI submodule version (#547) --- src/SAI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SAI b/src/SAI index 0bbb902ec226..499ad7272264 160000 --- a/src/SAI +++ b/src/SAI @@ -1 +1 @@ -Subproject commit 0bbb902ec226a5097a8dfcc6e80b547cf2831187 +Subproject commit 499ad727226405b425473d6ed170c3bee1112cca From dfa72077c9f6ee0e27fd50f8bf306d03cb2c1254 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 27 Apr 2017 15:59:46 -0700 Subject: [PATCH 0480/1833] [swss]: Update submodule (#546) - [aclorch]: Fix ACL range attribute enabling (#197) - [aclorch]: Fix the space and change the log level to INFO Signed-off-by: Shuotian Cheng --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 93dd3e938024..32cd0ea58fb5 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 93dd3e938024619ab1b35aacba343ba4a54bd423 +Subproject commit 32cd0ea58fb5f9c7fa2a4ea24370dbc80af3bf71 From b097492b8fd15c4b9eb67b1046a1d31f8d687a34 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 27 Apr 2017 16:07:04 -0700 Subject: [PATCH 0481/1833] [thrift]: Disable auto test in the package build (#545) --- src/thrift/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thrift/Makefile b/src/thrift/Makefile index 2b450e52d4c1..2a4f67b9175b 100644 --- a/src/thrift/Makefile +++ b/src/thrift/Makefile @@ -20,7 +20,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-source -x thrift_$(THRIFT_VERSION_FULL).dsc pushd thrift-$(THRIFT_VERSION) patch -p1 < ../patch/THRIFT-3577-assertion-failed.patch - dpkg-buildpackage -d -rfakeroot -b -us -uc + DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -d -rfakeroot -b -us -uc popd mv $(DERIVED_TARGETS) $* $(DEST)/ From f98e2f50821e715b97ff5095b57fb66132ae9c91 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 28 Apr 2017 19:03:21 +0300 Subject: [PATCH 0482/1833] [sonic-utilities]: Update submodule (#549) New revision includes sonic_installer utility. Signed-off-by: marian-pritsak --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 9ea7ae4e2e76..790aa8380d2f 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 9ea7ae4e2e76b3273a2bcf12b7434a190bba85fb +Subproject commit 790aa8380d2fb8fce0097a27556a415e69441f14 From 9dd996b3e9aea8ea04d35a51e97c796b839442a1 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 28 Apr 2017 11:20:40 -0700 Subject: [PATCH 0483/1833] Update py-swsssdk (#552) --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index ebb5ec6870ac..4cf7a59a5ffa 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit ebb5ec6870acccfde267e513d68d107873b0960e +Subproject commit 4cf7a59a5ffa74784f8067484b0dbee51433c184 From 8255c9d8ede6401968addbb3f708f56b50b4a210 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 28 Apr 2017 23:15:08 +0300 Subject: [PATCH 0484/1833] Temporary Revert "Update MLNX SAI revision reference (#540)" (#551) This reverts commit ce663baa1090f0bdbdbada72d2520213ff69b183. Revert due to issue in MLNX SAI: https://github.com/Azure/sonic-swss/issues/199 --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 461f3d904a82..163e298553f8 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = d84b9fd043039a8107151750299e6e510e648ed6 +MLNX_SAI_REVISION = 1a4307f0ac40b28cd8ed8f48569458212d90366e export MLNX_SAI_VERSION MLNX_SAI_REVISION From e2a22407b0ab65f5727615b8453303fdd723577d Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Sat, 29 Apr 2017 00:40:19 +0300 Subject: [PATCH 0485/1833] [device]: Add support for Mellanox MSN2100 (#544) * [device]: Add support for Mellanox MSN2100 MSN2100 runs on Spectrum silicon and has 16 100GbE ports. Signed-off-by: marian-pritsak --- .../ACS-MSN2100/port_config.ini | 17 + .../ACS-MSN2100/sai.profile | 1 + .../x86_64-mlnx_msn2100-r0/hw-management | 1 + .../x86_64-mlnx_msn2100-r0/installer.conf | 1 + .../x86_64-mlnx_msn2100-r0/minigraph.xml | 578 ++++++++++++++++++ .../x86_64-mlnx_msn2100-r0/plugins/eeprom.py | 33 + .../x86_64-mlnx_msn2100-r0/plugins/sfputil.py | 28 + .../x86_64-mlnx_msn2100-r0/sensors.conf | 21 + 8 files changed, 680 insertions(+) create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/port_config.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile create mode 120000 device/mellanox/x86_64-mlnx_msn2100-r0/hw-management create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/port_config.ini b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/port_config.ini new file mode 100644 index 000000000000..c792a4114b9c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/port_config.ini @@ -0,0 +1,17 @@ +# name lanes +Ethernet0 0,1,2,3 +Ethernet4 4,5,6,7 +Ethernet8 8,9,10,11 +Ethernet12 12,13,14,15 +Ethernet16 16,17,18,19 +Ethernet20 20,21,22,23 +Ethernet24 24,25,26,27 +Ethernet28 28,29,30,31 +Ethernet32 32,33,34,35 +Ethernet36 36,37,38,39 +Ethernet40 40,41,42,43 +Ethernet44 44,45,46,47 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile new file mode 100644 index 000000000000..d2a9fac29a5e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sai_2100.xml diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/hw-management b/device/mellanox/x86_64-mlnx_msn2100-r0/hw-management new file mode 120000 index 000000000000..daef0037ddae --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/hw-management @@ -0,0 +1 @@ +/etc/mlnx/msn2100 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf b/device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf new file mode 100644 index 000000000000..c9c9493a5404 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml new file mode 100644 index 000000000000..859c22a7dac3 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml @@ -0,0 +1,578 @@ + + + + + + switch2 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + switch2 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + switch2 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + switch2 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + switch2 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + switch2 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + switch2 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + switch2 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + switch2 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + switch2 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + switch2 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + switch2 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + switch2 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + switch2 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + switch2 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + switch2 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch2 + + +
10.0.0.1
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.31
+ + +
+
+ +
+ + 65200 + ARISTA01T2 + + + + 65200 + ARISTA02T2 + + + + 65200 + ARISTA03T2 + + + + 65200 + ARISTA04T2 + + + + 65200 + ARISTA05T2 + + + + 65200 + ARISTA06T2 + + + + 65200 + ARISTA07T2 + + + + 65200 + ARISTA08T2 + + + + 65200 + ARISTA09T2 + + + + 65200 + ARISTA10T2 + + + + 65200 + ARISTA11T2 + + + + 65200 + ARISTA12T2 + + + + 65200 + ARISTA13T2 + + + + 65200 + ARISTA14T2 + + + + 65200 + ARISTA15T2 + + + + 65200 + ARISTA16T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + switch2 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + + + + + + + + + DeviceInterfaceLink + switch2 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + + + switch2 + ACS-MSN2700 + + ` + + + + + switch2 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + switch2 + ACS-MSN2100 +
diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py new file mode 100644 index 000000000000..d792d1770367 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/bsp/eeprom/sys_eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py new file mode 100644 index 000000000000..c6628e66e419 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py @@ -0,0 +1,28 @@ +#! /usr/bin/python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 15 + ports_in_block = 16 + + eeprom_offset = 1 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/bsp/qsfp/qsfp{0}' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) + diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf new file mode 100644 index 000000000000..a3e30391863e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf @@ -0,0 +1,21 @@ +bus "i2c-7" "i2c-1-mux (chan_id 5)" +chip "lm75-i2c-7-4a" + label temp1 "Ambient Port Temp" + +bus "i2c-5" "i2c-1-mux (chan_id 3)" +chip "ucd9200-i2c-5-27" + label in1 "UCD1 vin" + label in2 "ASIC 3.3 vout" + label in3 "ASIC 1.2 vout" + label temp1 "UCD1 Temp" + label temp2 "UCD1 Temp2" + +chip "ucd9200-i2c-5-41" + label in1 "UCD2 vin" + label in2 "ASIC Vcore vout" + label temp1 "UCD2 Temp1" + label temp2 "UCD2 Temp2" + +bus "i2c-17" "i2c-1-mux (chan_id 7)" +chip "lm75-i2c-17-49" + label temp1 "Ambient Board Temp" From 14578d50e24f742a86a99a89c1070c0ec83a3cc7 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 28 Apr 2017 22:48:50 -0700 Subject: [PATCH 0486/1833] [docker-syncd-rpc]: Fix the issue which prevented supervisord to start (#555) service syncd start blocks docker-syncd-rpc start.sh script and supervisord doesn't start. so start supervisor in daemon mode --- platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 | 2 +- platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf | 2 +- platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 | 2 +- platform/cavium/docker-syncd-cavm-rpc/supervisord.conf | 2 +- platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 | 2 +- platform/centec/docker-syncd-centec-rpc/supervisord.conf | 2 +- platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 | 2 +- platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 index c70920274709..cc7c756f801c 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 @@ -50,7 +50,7 @@ RUN apt-get update \ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf -RUN sed -i 's/read/sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord/' /usr/bin/start.sh +RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] diff --git a/platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf b/platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf index 54296b8b254e..daf9de259d77 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf +++ b/platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf @@ -1,2 +1,2 @@ [supervisord] -nodaemon=true +nodaemon=false diff --git a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 index 1df6dc7802dd..2688e37833e1 100644 --- a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 @@ -50,7 +50,7 @@ RUN apt-get update \ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf -RUN sed -i 's/read/sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord/' /usr/bin/start.sh +RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] diff --git a/platform/cavium/docker-syncd-cavm-rpc/supervisord.conf b/platform/cavium/docker-syncd-cavm-rpc/supervisord.conf index 54296b8b254e..daf9de259d77 100644 --- a/platform/cavium/docker-syncd-cavm-rpc/supervisord.conf +++ b/platform/cavium/docker-syncd-cavm-rpc/supervisord.conf @@ -1,2 +1,2 @@ [supervisord] -nodaemon=true +nodaemon=false diff --git a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 index a0384c14f571..2199e85d85d1 100644 --- a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 @@ -50,7 +50,7 @@ RUN apt-get update \ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf -RUN sed -i 's/read/sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord/' /usr/bin/start.sh +RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] diff --git a/platform/centec/docker-syncd-centec-rpc/supervisord.conf b/platform/centec/docker-syncd-centec-rpc/supervisord.conf index 54296b8b254e..daf9de259d77 100644 --- a/platform/centec/docker-syncd-centec-rpc/supervisord.conf +++ b/platform/centec/docker-syncd-centec-rpc/supervisord.conf @@ -1,2 +1,2 @@ [supervisord] -nodaemon=true +nodaemon=false diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index c8b312b1c677..3a4b4784babd 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -50,7 +50,7 @@ RUN apt-get update \ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf -RUN sed -i 's/read/sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord/' /usr/bin/start.sh +RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh ENTRYPOINT ["/bin/bash"] CMD ["/usr/bin/start.sh"] diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf b/platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf index 54296b8b254e..daf9de259d77 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf +++ b/platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf @@ -1,2 +1,2 @@ [supervisord] -nodaemon=true +nodaemon=false From b488c0874d40fbe5bfc67c0cb729ab4dc0ca1684 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Sat, 29 Apr 2017 00:14:53 -0700 Subject: [PATCH 0487/1833] [submodule]: Update submodule sonic-swss-common (#556) --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 46c455bd2c88..7ae13ca7a973 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 46c455bd2c887f04cdbc1b3adb7263bad97afa51 +Subproject commit 7ae13ca7a973db9e6caf0dbd9e2028f77dd95fd7 From c7d540cb2fba555f4370a50641a2c99c578d510e Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sat, 29 Apr 2017 00:15:12 -0700 Subject: [PATCH 0488/1833] [ptf]: Add pip install pysubnettree (#554) >> import SubnetTree This module is used for PTF FIB test to build LPM --- dockers/docker-ptf/Dockerfile.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 3f2f1cad8276..5ae6847c265c 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -67,6 +67,7 @@ RUN rm -rf /debs \ && pip install nnpy \ && pip install dpkt \ && pip install ipaddress \ + && pip install pysubnettree \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py From 611de29ef71680326fd022ade83351dadaaf4578 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 1 May 2017 15:12:11 -0700 Subject: [PATCH 0489/1833] Relocate syncd.conf from hwsku directory to platform directory (#559) --- .../{INGRASYS-S9100-C32 => }/syncd.conf | 0 src/sonic-sairedis | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename device/ingrasys/x86_64-ingrasys_s9100-r0/{INGRASYS-S9100-C32 => }/syncd.conf (100%) diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf b/device/ingrasys/x86_64-ingrasys_s9100-r0/syncd.conf similarity index 100% rename from device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/syncd.conf rename to device/ingrasys/x86_64-ingrasys_s9100-r0/syncd.conf diff --git a/src/sonic-sairedis b/src/sonic-sairedis index f041648f874f..9fe1e696c6a9 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit f041648f874f21d2cd4a7255c9b3bb8870557e36 +Subproject commit 9fe1e696c6a9b5e99406ff2548c6f52db4e0b604 From 72a039b1deb68e0c8617b296b55b5bcf0f042937 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 1 May 2017 15:16:33 -0700 Subject: [PATCH 0490/1833] [aboot]: refactor boot0.j2 to support one image SONiC-to-SONiC upgrade (#557) * [aboot]: refactor boot0.j2 to support one image upgrade * support sonic_installer in aboot --- files/Aboot/boot0.j2 | 39 ++++++++++++++++++++++----------------- src/sonic-utilities | 2 +- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 42bf0719bff9..eca3db743131 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -24,7 +24,7 @@ kernel_params=kernel-params aboot_machine="arista_unknown" -target_path=/mnt/flash +[ -z "$target_path" ] && target_path=/mnt/flash image_path="$target_path/image-%%IMAGE_VERSION%%" # expect the swi to be a non empty file @@ -41,15 +41,18 @@ parse_environment_config() { done } -extract_image() { +clean_flash() { ## Remove all the other unnecssary files except swi file, boot-config for f in $(ls -A $target_path); do if [ $f != "${swipath##*/}" ] && [ $f != "boot-config" ]; then rm -rf "$target_path/$f" fi done +} + +extract_image() { - mkdir "$image_path" + mkdir -p "$image_path" ## Unzip the image unzip -oq "$swipath" -x boot0 -d "$image_path" @@ -58,10 +61,10 @@ extract_image() { rm -f $swipath ## detect rootfs type - rootfs_type=`grep /mnt/flash /proc/mounts | cut -d' ' -f3` + rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3` ## vfat does not support symbol link - if [ $rootfs_type != "vfat" ]; then + if [ -n "$sonic_upgrade" ] || [ "$rootfs_type" != "vfat" ]; then mkdir -p "$image_path/{{ DOCKERFS_DIR }}" ## extract docker archive @@ -70,15 +73,12 @@ extract_image() { ## clean up docker archive rm -f "$image_path/{{ FILESYSTEM_DOCKERFS }}" else - echo "/mnt/flash is $rootfs_type, extract {{ FILESYSTEM_DOCKERFS }} in later stage" + echo "$target_path is $rootfs_type, extract {{ FILESYSTEM_DOCKERFS }} in later stage" fi ## use new reduced-size boot swi echo "SWI=flash:image-%%IMAGE_VERSION%%/{{ ABOOT_BOOT_IMAGE }}" > "$target_path/boot-config" - ## remove original boot swi - rm -f "$swipath" - ## sync disk operations sync } @@ -120,6 +120,17 @@ platform_specific() { fi } +# check the hash file in the image, and determine to install or just skip +GIT_REVISION=$(unzip -p "$swipath" .imagehash) +LOCAL_IMAGEHASH=$(cat $image_path/.imagehash 2>/dev/null || true) +if [ "$GIT_REVISION" != "$LOCAL_IMAGEHASH" ]; then + [ -z "$sonic_upgrade" ] && clean_flash + extract_image +fi + +[ -z "$sonic_upgrade" ] || exit 0 + +# build the new cmdline echo "$append" >/tmp/append parse_environment_config >>/tmp/append cat /etc/cmdline | sed "/^\(${bootconfigvars// /\|}\|crashkernel\|loglevel\|ignore_loglevel\)\(\$\|=\)/d;/^\$/d" >>/tmp/append @@ -129,6 +140,8 @@ echo "rw loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 # process platform specific operations platform_specific +[ -e ${taget_path}/machine.conf ] || write_machine_config + # use extra parameters from kernel-params hook if the file exists if [ -f "$image_path/$kernel_params" ]; then cat "$image_path/$kernel_params" >>/tmp/append @@ -141,14 +154,6 @@ if ! grep -q "root=" /tmp/append; then echo "root=$rootdev" >>/tmp/append fi -# check the hash file in the image, and determine to install or just skip -GIT_REVISION=$(unzip -p "$swipath" .imagehash) -LOCAL_IMAGEHASH=$(cat $image_path/.imagehash 2>/dev/null || true) -if [ "$GIT_REVISION" != "$LOCAL_IMAGEHASH" ]; then - extract_image - write_machine_config -fi - # chainloading using kexec initrd_path="$image_path/$initrd" kernel_path="$image_path/$kernel" diff --git a/src/sonic-utilities b/src/sonic-utilities index 790aa8380d2f..452df11df5a4 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 790aa8380d2fb8fce0097a27556a415e69441f14 +Subproject commit 452df11df5a47e1d646e5ce846757112b526694f From 052532544c36b9a9b158ba9ac224edc153aadf95 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 1 May 2017 17:36:30 -0700 Subject: [PATCH 0491/1833] [Broadcom]: Update broacom SDK to 3.2.2.2-4 (#561) Signed-off-by: Shuotian Cheng --- platform/broadcom/sdk.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 81da4554d16e..3f87fb350b2f 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-3~20170427022824.31_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-3~20170427022824.31_amd64.deb?sv=2015-04-05&sr=b&sig=z7AoBMtlWjYNEv0q3lTN47mb9OIur4HuUTClUVJWawU%3D&se=2154-03-20T05%3A14%3A41Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.2.2-4-20170428181434.34_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-4-20170428181434.34_amd64.deb?sv=2015-04-05&sr=b&sig=Izxx7%2ByNMXB11E3rdBuEQNOohGMoDKMCZIsVqfdCjSI%3D&se=2031-01-08T20%3A49%3A30Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-3~20170427022824.31_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-3~20170427022824.31_amd64.deb?sv=2015-04-05&sr=b&sig=j3TJGtIudpIFDe6ethxEHdW8j4KALG2GTAaRSMN37CM%3D&se=2154-03-20T05%3A15%3A21Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-4-20170428181434.34_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-4-20170428181434.34_amd64.deb?sv=2015-04-05&sr=b&sig=18MkouZ0zMum2CzLz7ut8nXmjn36nqCNg2go9ISCwKU%3D&se=2031-01-08T20%3A52%3A39Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 4dfe2a26f3cab17e00e2f3859f83ab58575d63f1 Mon Sep 17 00:00:00 2001 From: maggiemsft Date: Mon, 1 May 2017 18:47:29 -0700 Subject: [PATCH 0492/1833] [docker-ptf]replace ping utility from inetutils-ping to iputils-ping (#523) * replace ping utility from inetutil-ping to iputils-ping * fix dup typo * change from package installing to using apt install * remove unnecessary package handling line --- dockers/docker-ptf/Dockerfile.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 5ae6847c265c..08dd7ede16fb 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -40,7 +40,9 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / wget \ cmake \ libqt5core5a \ - libqt5network5 + libqt5network5 \ + iputils-ping + RUN dpkg -i \ {% for deb in docker_ptf_debs.split(' ') -%} From 54dda14af3fbcfaa6e3260bfb801bf78c8c5459e Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 2 May 2017 06:21:41 -0700 Subject: [PATCH 0493/1833] [swss]: Update swss submodule (#565) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 32cd0ea58fb5..2f594c75036d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 32cd0ea58fb5f9c7fa2a4ea24370dbc80af3bf71 +Subproject commit 2f594c75036dfd41b6b40dd5b92f4fda7ebb7a68 From d6aef59ee83d5c1f38cae31527ab3d16d7aa4c94 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 2 May 2017 10:34:50 -0700 Subject: [PATCH 0494/1833] [swss-common]: Update swss-common submodule (#564) --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 7ae13ca7a973..b3e6f6095962 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 7ae13ca7a973db9e6caf0dbd9e2028f77dd95fd7 +Subproject commit b3e6f60959626a1f915435cd314cba57528d1204 From e90d78a143f157c0bab46621dc8b34d6ba58488f Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 3 May 2017 09:47:40 -0700 Subject: [PATCH 0495/1833] [quagga]: update quagga submodule (#567) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index 77a98c2de5f8..5da3e26ecddf 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 77a98c2de5f80421f1c671d82d3207154eca4ee9 +Subproject commit 5da3e26ecddfec6f5983f34b27056b64f67e09d3 From 1da68f98819932477b21a6a60c32cb1a44a7f395 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 3 May 2017 09:49:45 -0700 Subject: [PATCH 0496/1833] [swss]: update submodule (#568) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 2f594c75036d..cbdc13de86c5 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 2f594c75036dfd41b6b40dd5b92f4fda7ebb7a68 +Subproject commit cbdc13de86c5b7787f29d7cbba6fe2c0b6756f5c From dfe85a0039de39fa2b9cfd099cec19778fdb0087 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 3 May 2017 17:01:27 -0700 Subject: [PATCH 0497/1833] [image]: build debug symbol packages for swss-common, libsairedis, libsaimetadata, syncd, syncd-rpc (#560) --- rules/sairedis.mk | 20 ++++++++++++++++++++ rules/swss-common.mk | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/rules/sairedis.mk b/rules/sairedis.mk index 87838a3aeebe..4a62954f4d1c 100644 --- a/rules/sairedis.mk +++ b/rules/sairedis.mk @@ -23,3 +23,23 @@ $(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA))) LIBSAIMETADATA_DEV = libsaimetadata-dev_1.0.0_amd64.deb $(LIBSAIMETADATA_DEV)_DEPENDS += $(LIBSAIMETADATA) $(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA_DEV))) + +LIBSAIREDIS_DBG = libsairedis-dbg_1.0.0_amd64.deb +$(LIBSAIREDIS_DBG)_DEPENDS += $(LIBSAIREDIS) +$(LIBSAIREDIS_DBG)_RDEPENDS += $(LIBSAIREDIS) +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIREDIS_DBG))) + +SYNCD_DBG = syncd-dbg_1.0.0_amd64.deb +$(SYNCD_DBG)_DEPENDS += $(SYNCD) +$(SYNCD_DBG)_RDEPENDS += $(SYNCD) +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_DBG))) + +SYNCD_RPC_DBG = syncd-rpc-dbg_1.0.0_amd64.deb +$(SYNCD_RPC_DBG)_DEPENDS += $(SYNCD_RPC) +$(SYNCD_RPC_DBG)_RDEPENDS += $(SYNCD_RPC) +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_RPC_DBG))) + +LIBSAIMETADATA_DBG = libsaimetadata-dbg_1.0.0_amd64.deb +$(LIBSAIMETADATA_DBG)_DEPENDS += $(LIBSAIMETADATA) +$(LIBSAIMETADATA_DBG)_RDEPENDS += $(LIBSAIMETADATA) +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA_DBG))) diff --git a/rules/swss-common.mk b/rules/swss-common.mk index d066714ae3a9..a4ccdafc2376 100644 --- a/rules/swss-common.mk +++ b/rules/swss-common.mk @@ -11,3 +11,8 @@ SONIC_DPKG_DEBS += $(LIBSWSSCOMMON) LIBSWSSCOMMON_DEV = libswsscommon-dev_1.0.0_amd64.deb $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV))) + +LIBSWSSCOMMON_DBG = libswsscommon-dbg_1.0.0_amd64.deb +$(LIBSWSSCOMMON_DBG)_DEPENDS += $(LIBSWSSCOMMON) +$(LIBSWSSCOMMON_DBG)_RDEPENDS += $(LIBSWSSCOMMON) +$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DBG))) From 2810f256351e107812a2900b992bfe2cdae09b18 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 5 May 2017 17:19:19 -0700 Subject: [PATCH 0498/1833] [swss]: Update swss/common submodules (#571) Signed-off-by: Shuotian Cheng --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index cbdc13de86c5..49c556ce7cdd 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit cbdc13de86c5b7787f29d7cbba6fe2c0b6756f5c +Subproject commit 49c556ce7cdd9a00952cf093191c8c7871b7913e diff --git a/src/sonic-swss-common b/src/sonic-swss-common index b3e6f6095962..bf2dde2b30cb 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit b3e6f60959626a1f915435cd314cba57528d1204 +Subproject commit bf2dde2b30cb33e35c6b55305fa00b99c3b4bac1 From 6cab3bc852654421f7ce0ef18574a3966d1ae9fa Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 5 May 2017 17:44:36 -0700 Subject: [PATCH 0499/1833] Add rotation feature to docker logs (#563) * Add rotation feature to docker logs * Fix: only apply log rotation for json-file log driver --- files/build_templates/docker_image_ctl.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 3df04b698ccb..9a1f79c4ed5a 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -11,6 +11,9 @@ start() { else docker run -d {{docker_image_run_opt}} \ +{%- if '--log-driver=json-file' in docker_image_run_opt or '--log-driver' not in docker_image_run_opt %} + --log-opt max-size=2M --log-opt max-file=5 \ +{%- endif %} -v /var/run/redis:/var/run/redis:rw \ -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ From 97b4924476543800a449962486e72be260e368e6 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 8 May 2017 11:31:00 -0700 Subject: [PATCH 0500/1833] [Broadcom]: Update broacom SDK to 3.2.2.2-5 and SAI to 2.1.5.1-5 (#570) Signed-off-by: Shuotian Cheng --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 40e2e383408e..ce9f0a64f4bc 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-4~20170427032904.25_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-4~20170427032904.25_amd64.deb?sv=2015-04-05&sr=b&sig=NqmcwFHarhYwoV6WTou8wGbEMCoXZUdPXuegPUDpwU0%3D&se=2154-03-20T05%3A16%3A44Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-5-20170505222214.31_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-5-20170505222214.31_amd64.deb?sv=2015-04-05&sr=b&sig=jxKRlFJ%2BjDmq6Xi2p1SXc35IVdhsfRoR0umcOnM5Cj8%3D&se=2031-01-12T22%3A43%3A54Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-4~20170427032904.25_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-5-20170505222214.31_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-4~20170427032904.25_amd64.deb?sv=2015-04-05&sr=b&sig=8RErjP5TGdXqENcTbVrgQbvVAexMt4b%2BjU2BXFb4%2B0M%3D&se=2154-03-20T05%3A16%3A07Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-5-20170505222214.31_amd64.deb?sv=2015-04-05&sr=b&sig=HZN4itbQuJXfZCPZx1A%2BSxN3hBxZ05%2FmCE8Lp1zTgXM%3D&se=2031-01-12T22%3A44%3A20Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 3f87fb350b2f..cee7939c730c 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-4-20170428181434.34_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-4-20170428181434.34_amd64.deb?sv=2015-04-05&sr=b&sig=Izxx7%2ByNMXB11E3rdBuEQNOohGMoDKMCZIsVqfdCjSI%3D&se=2031-01-08T20%3A49%3A30Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.2.2-5-20170505212020.37_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-5-20170505212020.37_amd64.deb?sv=2015-04-05&sr=b&sig=wTWOEP8zJE1Jba3M5n8we4x%2Fcpq39%2B00ORByVHhBOuQ%3D&se=2031-01-12T22%3A42%3A51Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-4-20170428181434.34_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-4-20170428181434.34_amd64.deb?sv=2015-04-05&sr=b&sig=18MkouZ0zMum2CzLz7ut8nXmjn36nqCNg2go9ISCwKU%3D&se=2031-01-08T20%3A52%3A39Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-5-20170505212020.37_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-5-20170505212020.37_amd64.deb?sv=2015-04-05&sr=b&sig=QovFF5suqpKxHqZ01r0BiooKw7ik5Kpk6GU0pxf8xmg%3D&se=2031-01-12T22%3A43%3A24Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 8f348399f591a2e94db08dbb8a459d428e68218f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 8 May 2017 15:43:31 -0700 Subject: [PATCH 0501/1833] [Dockers]: Manage all Docker containers with Supervisord (#573) - Consolidate config.sh and start.sh scripts into one script (start.sh) - Solve issue #435 - All dockers now run supervisord as their ENTRYPOINT - All stdout/stderr output from processes managed by supervisord is now sent to syslog instead of their own files - Supervisord log messages are now also sent to syslog - Removed unused smartmontools package from docker-platform-monitor --- .gitignore | 9 +- dockers/docker-base/Dockerfile.j2 | 49 ++++++----- dockers/docker-base/{ => etc}/rsyslog.conf | 0 .../docker-base/etc/rsyslog.d/supervisor.conf | 8 ++ dockers/docker-basic_router/Dockerfile | 15 ++-- dockers/docker-basic_router/start.sh | 6 ++ dockers/docker-basic_router/supervisord.conf | 20 +++++ dockers/docker-database/Dockerfile.j2 | 5 +- dockers/docker-database/supervisord.conf | 12 +++ dockers/docker-dhcp-relay/Dockerfile | 17 ++-- dockers/docker-dhcp-relay/config.sh | 4 - dockers/docker-dhcp-relay/isc-dhcp-relay.sh | 19 +++++ dockers/docker-dhcp-relay/start.sh | 9 +- dockers/docker-dhcp-relay/supervisord.conf | 27 ++++++ dockers/docker-fpm-gobgp/Dockerfile.j2 | 12 ++- dockers/docker-fpm-gobgp/config.sh | 17 ---- dockers/docker-fpm-gobgp/start.sh | 26 +++++- dockers/docker-fpm-gobgp/supervisord.conf | 30 ++++++- dockers/docker-fpm-quagga/Dockerfile.j2 | 8 +- dockers/docker-fpm-quagga/config.sh | 17 ---- dockers/docker-fpm-quagga/start.sh | 26 +++++- dockers/docker-fpm-quagga/supervisord.conf | 27 ++++++ dockers/docker-lldp-sv2/Dockerfile.j2 | 11 +-- dockers/docker-lldp-sv2/config.sh | 8 -- dockers/docker-lldp-sv2/start.sh | 14 +++ dockers/docker-lldp-sv2/supervisord.conf | 30 ++++++- dockers/docker-orchagent/Dockerfile.j2 | 14 +-- dockers/docker-orchagent/config.sh | 6 -- dockers/docker-orchagent/orchagent.sh | 80 +++++++++++++++++ dockers/docker-orchagent/start.sh | 85 ++----------------- dockers/docker-orchagent/supervisord.conf | 27 ++++++ dockers/docker-platform-monitor/Dockerfile | 13 ++- dockers/docker-platform-monitor/config.sh | 12 --- dockers/docker-platform-monitor/lm-sensors.sh | 12 +++ dockers/docker-platform-monitor/start.sh | 15 ++++ .../docker-platform-monitor/supervisord.conf | 28 ++++++ dockers/docker-ptf/Dockerfile.j2 | 4 +- dockers/docker-saiserver-brcm/Dockerfile | 6 +- dockers/docker-saiserver-brcm/start.sh | 13 ++- .../docker-saiserver-brcm/supervisord.conf | 27 ++++++ dockers/docker-saiserver-cavm/Dockerfile | 19 +++-- dockers/docker-saiserver-cavm/start.sh | 12 +-- .../docker-saiserver-cavm/supervisord.conf | 27 ++++++ dockers/docker-saiserver-mlnx/Dockerfile | 32 +++---- dockers/docker-saiserver-mlnx/start.sh | 13 ++- .../docker-saiserver-mlnx/supervisord.conf | 27 ++++++ dockers/docker-snmp-sv2/Dockerfile.j2 | 13 ++- dockers/docker-snmp-sv2/config.sh | 16 ---- dockers/docker-snmp-sv2/start.sh | 18 ++++ dockers/docker-snmp-sv2/supervisord.conf | 30 +++++-- dockers/docker-teamd/Dockerfile.j2 | 17 ++-- dockers/docker-teamd/config.sh | 12 --- dockers/docker-teamd/start.sh | 55 ++++-------- dockers/docker-teamd/supervisord.conf | 27 ++++++ dockers/docker-teamd/teamd.sh | 42 +++++++++ .../docker-syncd-brcm-rpc/99-syncd.conf | 2 + .../docker-syncd-brcm-rpc/Dockerfile.j2 | 9 +- .../docker-syncd-brcm-rpc/supervisord.conf | 2 - .../broadcom/docker-syncd-brcm/Dockerfile.j2 | 8 +- platform/broadcom/docker-syncd-brcm/start.sh | 15 +--- .../docker-syncd-brcm/supervisord.conf | 27 ++++++ platform/broadcom/docker-syncd-brcm/syncd.sh | 12 +++ .../docker-syncd-cavm-rpc/99-syncd.conf | 2 + .../docker-syncd-cavm-rpc/Dockerfile.j2 | 10 +-- .../docker-syncd-cavm-rpc/supervisord.conf | 2 - .../cavium/docker-syncd-cavm/Dockerfile.j2 | 6 +- platform/cavium/docker-syncd-cavm/start.sh | 22 +---- .../cavium/docker-syncd-cavm/supervisord.conf | 27 ++++++ platform/cavium/docker-syncd-cavm/syncd.sh | 22 +++++ .../docker-syncd-centec-rpc/99-syncd.conf | 2 + .../docker-syncd-centec-rpc/Dockerfile.j2 | 11 +-- .../docker-syncd-centec-rpc/supervisord.conf | 2 - .../centec/docker-syncd-centec/Dockerfile.j2 | 7 +- platform/centec/docker-syncd-centec/start.sh | 15 +--- .../docker-syncd-centec/supervisord.conf | 27 ++++++ platform/centec/docker-syncd-centec/syncd.sh | 12 +++ .../docker-syncd-mlnx-rpc/99-syncd.conf | 2 + .../docker-syncd-mlnx-rpc/Dockerfile.j2 | 11 +-- .../docker-syncd-mlnx-rpc/supervisord.conf | 2 - .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 8 +- platform/mellanox/docker-syncd-mlnx/start.sh | 21 +---- .../docker-syncd-mlnx/supervisord.conf | 27 ++++++ platform/mellanox/docker-syncd-mlnx/syncd.sh | 19 +++++ 83 files changed, 985 insertions(+), 475 deletions(-) rename dockers/docker-base/{ => etc}/rsyslog.conf (100%) create mode 100644 dockers/docker-base/etc/rsyslog.d/supervisor.conf create mode 100755 dockers/docker-basic_router/start.sh create mode 100644 dockers/docker-basic_router/supervisord.conf create mode 100644 dockers/docker-database/supervisord.conf delete mode 100755 dockers/docker-dhcp-relay/config.sh create mode 100755 dockers/docker-dhcp-relay/isc-dhcp-relay.sh create mode 100644 dockers/docker-dhcp-relay/supervisord.conf delete mode 100755 dockers/docker-fpm-gobgp/config.sh delete mode 100755 dockers/docker-fpm-quagga/config.sh create mode 100644 dockers/docker-fpm-quagga/supervisord.conf delete mode 100755 dockers/docker-lldp-sv2/config.sh create mode 100755 dockers/docker-lldp-sv2/start.sh delete mode 100755 dockers/docker-orchagent/config.sh create mode 100755 dockers/docker-orchagent/orchagent.sh create mode 100644 dockers/docker-orchagent/supervisord.conf delete mode 100755 dockers/docker-platform-monitor/config.sh create mode 100755 dockers/docker-platform-monitor/lm-sensors.sh create mode 100755 dockers/docker-platform-monitor/start.sh create mode 100644 dockers/docker-platform-monitor/supervisord.conf create mode 100644 dockers/docker-saiserver-brcm/supervisord.conf create mode 100644 dockers/docker-saiserver-cavm/supervisord.conf create mode 100644 dockers/docker-saiserver-mlnx/supervisord.conf delete mode 100755 dockers/docker-snmp-sv2/config.sh create mode 100755 dockers/docker-snmp-sv2/start.sh delete mode 100755 dockers/docker-teamd/config.sh create mode 100644 dockers/docker-teamd/supervisord.conf create mode 100755 dockers/docker-teamd/teamd.sh create mode 100644 platform/broadcom/docker-syncd-brcm-rpc/99-syncd.conf delete mode 100644 platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf create mode 100644 platform/broadcom/docker-syncd-brcm/supervisord.conf create mode 100755 platform/broadcom/docker-syncd-brcm/syncd.sh create mode 100644 platform/cavium/docker-syncd-cavm-rpc/99-syncd.conf delete mode 100644 platform/cavium/docker-syncd-cavm-rpc/supervisord.conf create mode 100644 platform/cavium/docker-syncd-cavm/supervisord.conf create mode 100755 platform/cavium/docker-syncd-cavm/syncd.sh create mode 100644 platform/centec/docker-syncd-centec-rpc/99-syncd.conf delete mode 100644 platform/centec/docker-syncd-centec-rpc/supervisord.conf create mode 100644 platform/centec/docker-syncd-centec/supervisord.conf create mode 100755 platform/centec/docker-syncd-centec/syncd.sh create mode 100644 platform/mellanox/docker-syncd-mlnx-rpc/99-syncd.conf delete mode 100644 platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf create mode 100644 platform/mellanox/docker-syncd-mlnx/supervisord.conf create mode 100755 platform/mellanox/docker-syncd-mlnx/syncd.sh diff --git a/.gitignore b/.gitignore index 00f97edcec97..481363b1e00a 100644 --- a/.gitignore +++ b/.gitignore @@ -26,15 +26,16 @@ src/thrift/* src/sonic-device-data/src/device/ # Autogenerated Dockerfiles +dockers/docker-base/Dockerfile +dockers/docker-config-engine/Dockerfile dockers/docker-database/Dockerfile -dockers/docker-fpm/Dockerfile +dockers/docker-fpm-frr/Dockerfile +dockers/docker-fpm-gobgp/Dockerfile +dockers/docker-fpm-quagga/Dockerfile dockers/docker-lldp-sv2/Dockerfile dockers/docker-orchagent/Dockerfile dockers/docker-snmp-sv2/Dockerfile -dockers/docker-team/Dockerfile dockers/docker-teamd/Dockerfile -dockers/docker-config-engine/Dockerfile -dockers/docker-base/Dockerfile platform/*/docker-syncd-*/Dockerfile platform/*/docker-syncd-*-rpc/Dockerfile diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index 5bdbf8b3d5ae..b014c20a6401 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -4,36 +4,38 @@ FROM debian:jessie RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true ## Clean doc directories that are empty or only contain empty directories RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done -RUN rm -rf \ - /usr/share/man/* \ - /usr/share/groff/* \ - /usr/share/info/* \ - /usr/share/lintian/* \ - /usr/share/linda/* \ - /var/cache/man/* \ - /usr/share/locale/* +RUN rm -rf \ + /usr/share/man/* \ + /usr/share/groff/* \ + /usr/share/info/* \ + /usr/share/lintian/* \ + /usr/share/linda/* \ + /var/cache/man/* \ + /usr/share/locale/* ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -## Set the apt source -COPY sources.list /etc/apt/sources.list -COPY dpkg_01_drop /etc/dpkg/dpkg.cfg.d/01_drop +## Configure data sources for apt/dpkg +COPY ["sources.list", "/etc/apt/sources.list"] +COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] RUN apt-get clean && apt-get update -## Pre-install the fundamental packages -RUN apt-get -y install \ - rsyslog \ - vim-tiny \ - perl \ +## Pre-install fundamental packages +RUN apt-get -y install \ + rsyslog \ + supervisor \ + vim-tiny \ + perl \ python -COPY rsyslog.conf /etc/rsyslog.conf +COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] +COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] -RUN apt-get -y purge \ - exim4 \ - exim4-base \ - exim4-config \ +RUN apt-get -y purge \ + exim4 \ + exim4-base \ + exim4-config \ exim4-daemon-light {% if docker_base_dbgs %} @@ -46,6 +48,7 @@ RUN apt-get -y install \ ## Clean up apt ## Remove /var/lib/apt/lists/*, could be obsoleted for derived images -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; \ - rm -rf /var/lib/apt/lists/*; \ +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; \ + rm -rf /var/lib/apt/lists/*; \ rm -rf /tmp/*; + diff --git a/dockers/docker-base/rsyslog.conf b/dockers/docker-base/etc/rsyslog.conf similarity index 100% rename from dockers/docker-base/rsyslog.conf rename to dockers/docker-base/etc/rsyslog.conf diff --git a/dockers/docker-base/etc/rsyslog.d/supervisor.conf b/dockers/docker-base/etc/rsyslog.d/supervisor.conf new file mode 100644 index 000000000000..e6fece313efc --- /dev/null +++ b/dockers/docker-base/etc/rsyslog.d/supervisor.conf @@ -0,0 +1,8 @@ +$ModLoad imfile + +$InputFileName /var/log/supervisor/supervisord.log +$InputFileTag supervisord +$InputFileStateFile state-supervisor +$InputFileSeverity info +$InputFileFacility local0 +$InputRunFileMonitor diff --git a/dockers/docker-basic_router/Dockerfile b/dockers/docker-basic_router/Dockerfile index 7176fac14b3b..fa8fbd496172 100644 --- a/dockers/docker-basic_router/Dockerfile +++ b/dockers/docker-basic_router/Dockerfile @@ -5,18 +5,19 @@ MAINTAINER Xudong Wu ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -## Set the apt source +## Update apt's cache of available packages RUN apt-get clean && apt-get update COPY deps /deps -RUN dpkg -i /deps/libopennsl_*.deb; \ - dpkg -i /deps/libsaibcm_*.deb; \ +RUN dpkg -i /deps/libopennsl_*.deb; \ + dpkg -i /deps/libsaibcm_*.deb; \ apt-get -y install -f - RUN mv /deps/basic_router /usr/sbin/basic_router -ENTRYPOINT rm -f /var/run/rsyslogd.pid \ - && service rsyslog start \ - && /bin/bash +COPY ["start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-basic_router/start.sh b/dockers/docker-basic_router/start.sh new file mode 100755 index 000000000000..925076231ccf --- /dev/null +++ b/dockers/docker-basic_router/start.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + diff --git a/dockers/docker-basic_router/supervisord.conf b/dockers/docker-basic_router/supervisord.conf new file mode 100644 index 000000000000..2ae8ec428b3e --- /dev/null +++ b/dockers/docker-basic_router/supervisord.conf @@ -0,0 +1,20 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 17a416dae69d..1049f5bf1bfe 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -32,4 +32,7 @@ RUN sed -ri 's/^(save .*$)/# \1/g; s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ ' /etc/redis/redis.conf -ENTRYPOINT ["/usr/bin/redis-server", "/etc/redis/redis.conf"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-database/supervisord.conf b/dockers/docker-database/supervisord.conf new file mode 100644 index 000000000000..12a6c0a8fb1b --- /dev/null +++ b/dockers/docker-database/supervisord.conf @@ -0,0 +1,12 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:redis-server] +command=/usr/bin/redis-server /etc/redis/redis.conf +priority=1 +autostart=true +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile index 315ea605f3ee..c3f9f298983e 100644 --- a/dockers/docker-dhcp-relay/Dockerfile +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -1,22 +1,21 @@ FROM docker-config-engine -## Make apt-get non-interactive +# Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -## Update APT package lists +# Update apt's cache of available packages RUN apt-get update -## Install isc-dhcp-relay Debian package +# Install isc-dhcp-relay Debian package RUN apt-get -y install isc-dhcp-relay -## Clean up +# Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +COPY ["start.sh", "isc-dhcp-relay.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["isc-dhcp-relay.j2", "/usr/share/sonic/templates/"] -COPY ["config.sh", "/usr/bin/"] -COPY ["start.sh", "/usr/bin/"] -ENTRYPOINT /usr/bin/config.sh \ - && /usr/bin/start.sh \ - && /bin/bash +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-dhcp-relay/config.sh b/dockers/docker-dhcp-relay/config.sh deleted file mode 100755 index 99df251572d5..000000000000 --- a/dockers/docker-dhcp-relay/config.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay - diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.sh b/dockers/docker-dhcp-relay/isc-dhcp-relay.sh new file mode 100755 index 000000000000..07efa351578f --- /dev/null +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# Based off /etc/init.d/isc-dhcp-relay +# + +# Read init script configuration (interfaces the daemon should listen on +# and the DHCP server we should forward requests to.) +[ -f /etc/default/isc-dhcp-relay ] && . /etc/default/isc-dhcp-relay + +# Build command line for interfaces (will be passed to dhrelay below.) +IFCMD="" +if test "$INTERFACES" != ""; then + for I in $INTERFACES; do + IFCMD=${IFCMD}"-i "${I}" " + done +fi + +exec /usr/sbin/dhcrelay -d -q ${OPTIONS} ${IFCMD} ${SERVERS} + diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index f5bdf49396d3..6daff96d0129 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -1,7 +1,10 @@ -#!/bin/bash +#!/usr/bin/env bash + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay rm -f /var/run/rsyslogd.pid -service rsyslog start + +supervisorctl start rsyslogd VLAN_IFACE_NAME=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_vlan_interfaces[0]['attachto']"` @@ -11,5 +14,5 @@ until ip link show $VLAN_IFACE_NAME > /dev/null 2>&1; do done # Start the DHCP relay -service isc-dhcp-relay start +supervisorctl start isc-dhcp-relay diff --git a/dockers/docker-dhcp-relay/supervisord.conf b/dockers/docker-dhcp-relay/supervisord.conf new file mode 100644 index 000000000000..8e23c5c260ce --- /dev/null +++ b/dockers/docker-dhcp-relay/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:isc-dhcp-relay] +command=/usr/bin/isc-dhcp-relay.sh +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-fpm-gobgp/Dockerfile.j2 b/dockers/docker-fpm-gobgp/Dockerfile.j2 index 19b6caad9d99..64877ee9286d 100644 --- a/dockers/docker-fpm-gobgp/Dockerfile.j2 +++ b/dockers/docker-fpm-gobgp/Dockerfile.j2 @@ -3,7 +3,7 @@ FROM docker-fpm-quagga ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y supervisor +RUN apt-get update COPY \ {% for deb in docker_fpm_gobgp_debs.split(' ') -%} @@ -20,12 +20,10 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +COPY ["start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["*.j2", "/usr/share/sonic/templates/"] -COPY ["start.sh", "config.sh", "/usr/bin/"] COPY ["daemons", "/etc/quagga/"] -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -ENTRYPOINT /usr/bin/config.sh \ - && /usr/bin/start.sh \ - && /usr/bin/supervisord \ - && /bin/bash +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-fpm-gobgp/config.sh b/dockers/docker-fpm-gobgp/config.sh deleted file mode 100755 index 07aa8c33eea1..000000000000 --- a/dockers/docker-fpm-gobgp/config.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -mkdir -p /etc/quagga -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/gobgpd.conf.j2 >/etc/gobgp/gobgpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/quagga/zebra.conf - -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate -chown root:root /usr/sbin/bgp-isolate -chmod 0755 /usr/sbin/bgp-isolate - -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate -chown root:root /usr/sbin/bgp-unisolate -chmod 0755 /usr/sbin/bgp-unisolate - -mkdir -p /var/sonic -echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status - diff --git a/dockers/docker-fpm-gobgp/start.sh b/dockers/docker-fpm-gobgp/start.sh index 0aa3f68091a1..25b26179bb58 100755 --- a/dockers/docker-fpm-gobgp/start.sh +++ b/dockers/docker-fpm-gobgp/start.sh @@ -1,6 +1,26 @@ -#!/bin/bash +#!/usr/bin/env bash + +mkdir -p /etc/quagga +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/gobgpd.conf.j2 > /etc/gobgp/gobgpd.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate +chown root:root /usr/sbin/bgp-isolate +chmod 0755 /usr/sbin/bgp-isolate + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate +chown root:root /usr/sbin/bgp-unisolate +chmod 0755 /usr/sbin/bgp-unisolate + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status rm -f /var/run/rsyslogd.pid -service rsyslog start + +supervisorctl start rsyslogd + +# Quagga has its own monitor process, 'watchquagga' service quagga start -fpmsyncd & + +supervisorctl start fpmsyncd + diff --git a/dockers/docker-fpm-gobgp/supervisord.conf b/dockers/docker-fpm-gobgp/supervisord.conf index 793fc5434f80..18670a084703 100644 --- a/dockers/docker-fpm-gobgp/supervisord.conf +++ b/dockers/docker-fpm-gobgp/supervisord.conf @@ -1,6 +1,34 @@ [supervisord] +logfile_maxbytes=1MB +logfile_backups=2 nodaemon=true +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + [program:gobgpd] command=/usr/sbin/gobgpd -p -f /etc/gobgp/gobgpd.conf -r -priority=1 +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:fpmsyncd] +command=fpmsyncd +priority=5 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index 211275a2eb16..2a7268a0019e 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -22,10 +22,10 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +COPY ["start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["*.j2", "/usr/share/sonic/templates/"] -COPY ["start.sh", "config.sh", "/usr/bin/"] COPY ["daemons", "/etc/quagga/"] -ENTRYPOINT /usr/bin/config.sh \ - && /usr/bin/start.sh \ - && /bin/bash +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-fpm-quagga/config.sh b/dockers/docker-fpm-quagga/config.sh deleted file mode 100755 index b7fbb90344e9..000000000000 --- a/dockers/docker-fpm-quagga/config.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -mkdir -p /etc/quagga -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/quagga/bgpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/quagga/zebra.conf - -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate -chown root:root /usr/sbin/bgp-isolate -chmod 0755 /usr/sbin/bgp-isolate - -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate -chown root:root /usr/sbin/bgp-unisolate -chmod 0755 /usr/sbin/bgp-unisolate - -mkdir -p /var/sonic -echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status - diff --git a/dockers/docker-fpm-quagga/start.sh b/dockers/docker-fpm-quagga/start.sh index 0aa3f68091a1..a02117dee5ef 100755 --- a/dockers/docker-fpm-quagga/start.sh +++ b/dockers/docker-fpm-quagga/start.sh @@ -1,6 +1,26 @@ -#!/bin/bash +#!/usr/bin/env bash + +mkdir -p /etc/quagga +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate +chown root:root /usr/sbin/bgp-isolate +chmod 0755 /usr/sbin/bgp-isolate + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate +chown root:root /usr/sbin/bgp-unisolate +chmod 0755 /usr/sbin/bgp-unisolate + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status rm -f /var/run/rsyslogd.pid -service rsyslog start + +supervisorctl start rsyslogd + +# Quagga has its own monitor process, 'watchquagga' service quagga start -fpmsyncd & + +supervisorctl start fpmsyncd + diff --git a/dockers/docker-fpm-quagga/supervisord.conf b/dockers/docker-fpm-quagga/supervisord.conf new file mode 100644 index 000000000000..2e9d4925b985 --- /dev/null +++ b/dockers/docker-fpm-quagga/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:fpmsyncd] +command=fpmsyncd +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 1910e0d79fe3..84002f37e7ee 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -11,7 +11,7 @@ COPY python-wheels /python-wheels ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 +RUN apt-get update && apt-get install -y python-pip libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20 # Pre-install the fundamental packages # Install Python SwSS SDK @@ -28,10 +28,11 @@ RUN pip install /python-wheels/swsssdk-2.0.1-py2-none-any.whl && \ apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ rm -rf /debs /python-wheels ~/.cache -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY reconfigure.sh /opt/reconfigure.sh -COPY ["config.sh", "/usr/bin/"] +COPY ["start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["reconfigure.sh", "/opt/"] COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"] COPY ["lldpd", "/etc/default/"] -ENTRYPOINT /usr/bin/config.sh && /usr/bin/supervisord +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-lldp-sv2/config.sh b/dockers/docker-lldp-sv2/config.sh deleted file mode 100755 index 1263cb7a5154..000000000000 --- a/dockers/docker-lldp-sv2/config.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/lldpd.conf.j2 >/etc/lldpd.conf - -mkdir -p /var/sonic -echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status - -rm -f /var/run/rsyslogd.pid diff --git a/dockers/docker-lldp-sv2/start.sh b/dockers/docker-lldp-sv2/start.sh new file mode 100755 index 000000000000..ea3b7f45175c --- /dev/null +++ b/dockers/docker-lldp-sv2/start.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/lldpd.conf.j2 > /etc/lldpd.conf + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd +supervisorctl start lldpd +supervisorctl start lldpd-conf-reload +supervisorctl start lldp-syncd + diff --git a/dockers/docker-lldp-sv2/supervisord.conf b/dockers/docker-lldp-sv2/supervisord.conf index 844348b471b6..62b4daebd107 100644 --- a/dockers/docker-lldp-sv2/supervisord.conf +++ b/dockers/docker-lldp-sv2/supervisord.conf @@ -1,6 +1,23 @@ [supervisord] +logfile_maxbytes=1MB +logfile_backups=2 nodaemon=true +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + [program:lldpd] # https://github.com/vincentbernat/lldpd/commit/9856f2792c301116cc4a3fcfba91b9672ee5db1f # - `-d` means to stay in foreground, log to syslog @@ -9,15 +26,22 @@ nodaemon=true # - `-dddd` means to stay in foreground, log all to console command=/usr/sbin/lldpd -d -I Ethernet*,eth* priority=100 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog [program:lldpd-conf-reload] command=/opt/reconfigure.sh priority=150 +autostart=false +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog [program:lldp-syncd] command=/usr/bin/env python2 -m lldp_syncd priority=200 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n -priority=1 diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 55f3b504f820..c708f30e439b 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -22,14 +22,14 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY start.sh /usr/bin/start.sh -COPY config.sh /usr/bin/config.sh -COPY ipinip.json.j2 /usr/share/sonic/templates/ipinip.json.j2 -COPY mirror.json.j2 /usr/share/sonic/templates/mirror.json.j2 - ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] +COPY ["start.sh", "orchagent.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"] +COPY ["mirror.json.j2", "/usr/share/sonic/templates/"] + +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-orchagent/config.sh b/dockers/docker-orchagent/config.sh deleted file mode 100755 index 813dad9533c5..000000000000 --- a/dockers/docker-orchagent/config.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -e - -mkdir -p /etc/swss/config.d/ - -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh new file mode 100755 index 000000000000..8afd8fab314b --- /dev/null +++ b/dockers/docker-orchagent/orchagent.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +# Exit immediately upon error +set -e + +function start_app { + orchagent $ORCHAGENT_ARGS & + portsyncd $PORTSYNCD_ARGS & + intfsyncd & + neighsyncd & + for file in $SWSSCONFIG_ARGS + do + swssconfig /etc/swss/config.d/$file + sleep 1 + done +} + +function config_acl { + if [ -f "/etc/sonic/acl.json" ]; then + mkdir -p /etc/swss/config.d/acl + rm -rf /etc/swss/config.d/acl/* + translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json + for filename in /etc/swss/config.d/acl/*.json; do + [ -e "$filename" ] || break + swssconfig $filename + done + fi +} + +function clean_up { + pkill -9 orchagent + pkill -9 portsyncd + pkill -9 intfsyncd + pkill -9 neighsyncd + exit +} + +trap clean_up SIGTERM SIGKILL + +HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` + +MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` + +ORCHAGENT_ARGS="" + +PORTSYNCD_ARGS="-p /usr/share/sonic/hwsku/port_config.ini" + +SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " + +if [ "$HWSKU" == "Force10-S6000" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" + SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +elif [ "$HWSKU" == "Force10-S6100" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "Force10-Z9100" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "Arista-7050-QX32" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" + SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "AS7512" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "INGRASYS-S9100-C32" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "ACS-MSN2700" ]; then + SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " +fi + +while true; do + # Check if syncd starts + result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p` + if [ "$result" != "0" ]; then + start_app + config_acl + read + fi + sleep 1 +done + diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 7a653c442ef8..b86a9aa1dc57 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -1,84 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash -. config.sh +mkdir -p /etc/swss/config.d/ -export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v platform` - -function start_app { - orchagent $ORCHAGENT_ARGS & - portsyncd $PORTSYNCD_ARGS & - intfsyncd & - neighsyncd & - for file in $SWSSCONFIG_ARGS - do - swssconfig /etc/swss/config.d/$file - sleep 1 - done -} - -function config_acl { - if [ -f "/etc/sonic/acl.json" ]; then - mkdir -p /etc/swss/config.d/acl - rm -rf /etc/swss/config.d/acl/* - translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json - for filename in /etc/swss/config.d/acl/*.json; do - [ -e "$filename" ] || break - swssconfig $filename - done - fi -} - -function clean_up { - pkill -9 orchagent - pkill -9 portsyncd - pkill -9 intfsyncd - pkill -9 neighsyncd - service rsyslog stop - exit -} - -trap clean_up SIGTERM SIGKILL - -HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json -MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` - -ORCHAGENT_ARGS="" - -PORTSYNCD_ARGS="-p /usr/share/sonic/hwsku/port_config.ini" +export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v platform` -SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " +rm -f /var/run/rsyslogd.pid -if [ "$HWSKU" == "Force10-S6000" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [ "$HWSKU" == "Force10-S6100" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "Force10-Z9100" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "Arista-7050-QX32" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "AS7512" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "INGRASYS-S9100-C32" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "ACS-MSN2700" ]; then - SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " -fi +supervisorctl start rsyslogd -rm -f /var/run/rsyslogd.pid -service rsyslog start +supervisorctl start orchagent -while true; do - # Check if syncd starts - result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p` - if [ "$result" != "0" ]; then - start_app - config_acl - read - fi - sleep 1 -done diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf new file mode 100644 index 000000000000..ef3a30f64358 --- /dev/null +++ b/dockers/docker-orchagent/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:orchagent] +command=/usr/bin/orchagent.sh +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-platform-monitor/Dockerfile b/dockers/docker-platform-monitor/Dockerfile index ea73830f8e6c..22eb4144cec5 100755 --- a/dockers/docker-platform-monitor/Dockerfile +++ b/dockers/docker-platform-monitor/Dockerfile @@ -5,17 +5,14 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -RUN apt-get install -y smartmontools sensord +RUN apt-get install -y sensord ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -COPY ["config.sh", "/usr/bin/"] +COPY ["start.sh", "lm-sensors.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] -ENTRYPOINT /usr/bin/config.sh \ - && service rsyslog start \ - && service lm-sensors start \ - && service smartmontools start \ - && service sensord start \ - && /bin/bash diff --git a/dockers/docker-platform-monitor/config.sh b/dockers/docker-platform-monitor/config.sh deleted file mode 100755 index a88bdf594f95..000000000000 --- a/dockers/docker-platform-monitor/config.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -mkdir -p /etc/sensors.d -if [ -e /usr/share/sonic/platform/sensors.conf ] -then - /bin/cp -rf /usr/share/sonic/platform/sensors.conf /etc/sensors.d/ -fi - -mkdir -p /var/sonic -echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status - -rm -f /var/run/rsyslogd.pid diff --git a/dockers/docker-platform-monitor/lm-sensors.sh b/dockers/docker-platform-monitor/lm-sensors.sh new file mode 100755 index 000000000000..1eafc81eeb63 --- /dev/null +++ b/dockers/docker-platform-monitor/lm-sensors.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# +# Based off /etc/init.d/lm-sensors +# + +/usr/bin/sensors -s > /dev/null 2>&1 +/usr/bin/sensors > /dev/null 2>&1 + +# Currently, there is no way to run sensord in the foreground, so we +# can't use supervisord. Instead, we just start the service for now. +service sensord start + diff --git a/dockers/docker-platform-monitor/start.sh b/dockers/docker-platform-monitor/start.sh new file mode 100755 index 000000000000..0e8a6dd32760 --- /dev/null +++ b/dockers/docker-platform-monitor/start.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +mkdir -p /etc/sensors.d +if [ -e /usr/share/sonic/platform/sensors.conf ]; then + /bin/cp -rf /usr/share/sonic/platform/sensors.conf /etc/sensors.d/ +fi + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd +supervisorctl start lm-sensors + diff --git a/dockers/docker-platform-monitor/supervisord.conf b/dockers/docker-platform-monitor/supervisord.conf new file mode 100644 index 000000000000..b069c48141ac --- /dev/null +++ b/dockers/docker-platform-monitor/supervisord.conf @@ -0,0 +1,28 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:lm-sensors] +command=/usr/bin/lm-sensors.sh +priority=3 +autostart=false +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 08dd7ede16fb..a8459bb39781 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -82,9 +82,7 @@ RUN mkdir /var/run/sshd \ && sed -i '$aUseDNS no' /etc/ssh/sshd_config \ && mkdir /root/deps -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY sshd.conf /etc/supervisor/conf.d/sshd.conf -COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf +COPY ["supervisord.conf", "sshd.conf", "ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] EXPOSE 22 diff --git a/dockers/docker-saiserver-brcm/Dockerfile b/dockers/docker-saiserver-brcm/Dockerfile index 3482c2068bc5..3a839a7a6df0 100755 --- a/dockers/docker-saiserver-brcm/Dockerfile +++ b/dockers/docker-saiserver-brcm/Dockerfile @@ -17,10 +17,12 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return COPY ["deps/saiserver", "start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + COPY ["profile.ini", "portmap.ini", "/etc/sai/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; rm -rf /deps -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-saiserver-brcm/start.sh b/dockers/docker-saiserver-brcm/start.sh index 1d65e4a069e7..f023775f0674 100755 --- a/dockers/docker-saiserver-brcm/start.sh +++ b/dockers/docker-saiserver-brcm/start.sh @@ -1,8 +1,4 @@ -#!/bin/bash - -function clean_up { - service rsyslog stop -} +#!/usr/bin/env bash start_bcm() { @@ -11,11 +7,12 @@ start_bcm() [ -e /dev/linux-kernel-bde ] || mknod /dev/linux-kernel-bde c 127 0 } -trap clean_up SIGTERM SIGKILL rm -f /var/run/rsyslogd.pid -service rsyslog start + +supervisorctl start rsyslogd start_bcm -/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini +supervisorctl start saiserver + diff --git a/dockers/docker-saiserver-brcm/supervisord.conf b/dockers/docker-saiserver-brcm/supervisord.conf new file mode 100644 index 000000000000..aa6899737e8d --- /dev/null +++ b/dockers/docker-saiserver-brcm/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:saiserver] +command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-saiserver-cavm/Dockerfile b/dockers/docker-saiserver-cavm/Dockerfile index 2ee6b8ff38cd..9203690ad02a 100644 --- a/dockers/docker-saiserver-cavm/Dockerfile +++ b/dockers/docker-saiserver-cavm/Dockerfile @@ -1,4 +1,3 @@ - FROM docker-base RUN apt-get update \ @@ -9,22 +8,24 @@ RUN apt-get update \ COPY deps /root/deps RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /root/deps/xp-tools.deb \ - && dpkg_apt /root/deps/libsai.deb \ - && dpkg_apt /root/deps/sai.deb \ - && dpkg_apt /root/deps/libthrift-0.9.3_*.deb \ + dpkg_apt /root/deps/xp-tools.deb \ + && dpkg_apt /root/deps/libsai.deb \ + && dpkg_apt /root/deps/sai.deb \ + && dpkg_apt /root/deps/libthrift-0.9.3_*.deb \ && dpkg_apt /root/deps/libnl-3-200_*.deb \ - && dpkg_apt /root/deps/libnl-genl-3-200_*.deb \ - && dpkg_apt /root/deps/libnl-route-3-200_*.deb + && dpkg_apt /root/deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /root/deps/libnl-route-3-200_*.deb COPY ["deps/saiserver", "start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + COPY ["portmap.ini", "profile.ini", "/etc/sai/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf deps -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-saiserver-cavm/start.sh b/dockers/docker-saiserver-cavm/start.sh index 5c3185613184..16457d13e03a 100755 --- a/dockers/docker-saiserver-cavm/start.sh +++ b/dockers/docker-saiserver-cavm/start.sh @@ -1,12 +1,8 @@ -#!/bin/bash +#!/usr/bin/env bash -function clean_up { - service rsyslog stop -} +rm -f /var/run/rsyslogd.pid -trap clean_up SIGTERM SIGKILL +supervisorctl start rsyslogd -rm -f /var/run/rsyslogd.pid -service rsyslog start +supervisorctl start saiserver -/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini diff --git a/dockers/docker-saiserver-cavm/supervisord.conf b/dockers/docker-saiserver-cavm/supervisord.conf new file mode 100644 index 000000000000..aa6899737e8d --- /dev/null +++ b/dockers/docker-saiserver-cavm/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:saiserver] +command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-saiserver-mlnx/Dockerfile b/dockers/docker-saiserver-mlnx/Dockerfile index 5f51f5598b18..39d0fa176987 100755 --- a/dockers/docker-saiserver-mlnx/Dockerfile +++ b/dockers/docker-saiserver-mlnx/Dockerfile @@ -8,23 +8,25 @@ RUN apt-get update COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.3_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"] RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/applibs_*.deb \ - && dpkg_apt /deps/applibs-dev_*.deb \ - && dpkg_apt /deps/sx-complib_*.deb \ - && dpkg_apt /deps/sxd-libs_*.deb \ - && dpkg_apt /deps/sx-scew_*.deb \ - && dpkg_apt /deps/sx-examples_*.deb \ - && dpkg_apt /deps/sx-gen-utils_*.deb \ - && dpkg_apt /deps/python-sdk-api_*.deb \ - && dpkg_apt /deps/iproute2_*.deb \ - && dpkg_apt /deps/mlnx-sai_*.deb \ - && dpkg_apt /deps/libthrift-0.9.3_*.deb \ - && dpkg_apt /deps/libnl-3-200_*.deb \ - && dpkg_apt /deps/libnl-genl-3-200_*.deb \ + dpkg_apt /deps/applibs_*.deb \ + && dpkg_apt /deps/applibs-dev_*.deb \ + && dpkg_apt /deps/sx-complib_*.deb \ + && dpkg_apt /deps/sxd-libs_*.deb \ + && dpkg_apt /deps/sx-scew_*.deb \ + && dpkg_apt /deps/sx-examples_*.deb \ + && dpkg_apt /deps/sx-gen-utils_*.deb \ + && dpkg_apt /deps/python-sdk-api_*.deb \ + && dpkg_apt /deps/iproute2_*.deb \ + && dpkg_apt /deps/mlnx-sai_*.deb \ + && dpkg_apt /deps/libthrift-0.9.3_*.deb \ + && dpkg_apt /deps/libnl-3-200_*.deb \ + && dpkg_apt /deps/libnl-genl-3-200_*.deb \ && dpkg_apt /deps/libnl-route-3-200_*.deb COPY ["deps/saiserver", "start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + COPY ["profile.ini", "portmap.ini", "/etc/sai/"] COPY ["sai_2700.xml", "/usr/share/"] @@ -33,5 +35,5 @@ COPY ["sai_2700.xml", "/usr/share/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-saiserver-mlnx/start.sh b/dockers/docker-saiserver-mlnx/start.sh index e3356be12025..57ee5036ded3 100755 --- a/dockers/docker-saiserver-mlnx/start.sh +++ b/dockers/docker-saiserver-mlnx/start.sh @@ -1,19 +1,16 @@ -#!/bin/bash - -function clean_up { - service rsyslog stop -} +#!/usr/bin/env bash start_mlnx() { [ -e /dev/sxdevs/sxcdev ] || ( mkdir -p /dev/sxdevs && mknod /dev/sxdevs/sxcdev c 231 193 ) } -trap clean_up SIGTERM SIGKILL rm -f /var/run/rsyslogd.pid -service rsyslog start + +supervisorctl start rsyslogd start_mlnx -/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini +supervisorctl start saiserver + diff --git a/dockers/docker-saiserver-mlnx/supervisord.conf b/dockers/docker-saiserver-mlnx/supervisord.conf new file mode 100644 index 000000000000..aa6899737e8d --- /dev/null +++ b/dockers/docker-saiserver-mlnx/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:saiserver] +command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index fed2d1b85d58..73f5c257a5c4 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -16,15 +16,13 @@ ENV PYTHONOPTIMIZE 1 ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -# install supervisor # install libsnmp30 dependencies # install libpython3.6-dev dependencies # install pip dependencies # TODO: remove libpython3.6-dev, its and pip's dependencies if we can get pip3 directly # install subagent # clean up -RUN apt-get update && apt-get install -y supervisor \ - libperl5.20 libpci3 libwrap0 \ +RUN apt-get update && apt-get install -y libperl5.20 libpci3 libwrap0 \ libexpat1-dev \ curl gcc && \ dpkg -i \ @@ -41,11 +39,12 @@ RUN apt-get update && apt-get install -y supervisor \ find / | grep -E "__pycache__" | xargs rm -rf && \ rm -rf ~/.cache -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY ["start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["*.j2", "/usr/share/sonic/templates/"] -COPY ["config.sh", "/usr/bin/"] -## Although exposing ports is not need for host net mode, keep it for possible bridge mode +## Although exposing ports is not needed for host net mode, keep it for possible bridge mode EXPOSE 161/udp 162/udp -ENTRYPOINT /usr/bin/config.sh && /usr/bin/supervisord +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-snmp-sv2/config.sh b/dockers/docker-snmp-sv2/config.sh deleted file mode 100755 index 62e8278ae41b..000000000000 --- a/dockers/docker-snmp-sv2/config.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -mkdir -p /etc/ssw - -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sysDescription.j2 >/etc/ssw/sysDescription - -mkdir -p /etc/snmp - -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 >/etc/snmp/snmpd.conf - -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/alias_map.j2 >/etc/snmp/alias_map.json - -mkdir -p /var/sonic -echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status - -rm -f /var/run/rsyslogd.pid diff --git a/dockers/docker-snmp-sv2/start.sh b/dockers/docker-snmp-sv2/start.sh new file mode 100755 index 000000000000..7e178351b159 --- /dev/null +++ b/dockers/docker-snmp-sv2/start.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +mkdir -p /etc/ssw +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sysDescription.j2 > /etc/ssw/sysDescription + +mkdir -p /etc/snmp +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 > /etc/snmp/snmpd.conf +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/alias_map.j2 > /etc/snmp/alias_map.json + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd +supervisorctl start snmpd +supervisorctl start snmp-subagent + diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index cf5990ec31e8..c4e883b3f8f0 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -1,14 +1,34 @@ [supervisord] +logfile_maxbytes=1MB +logfile_backups=2 nodaemon=true +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + [program:snmpd] command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ip -p /run/snmpd.pid -priority=100 +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog [program:snmp-subagent] command=/usr/bin/env python3.6 -m sonic_ax_impl -priority=200 +priority=4 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n -priority=1 diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index b3f35dd3c2e5..73de6bd47a78 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -1,6 +1,11 @@ FROM docker-config-engine -RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +RUN apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 ## Install redis-tools dependencies ## TODO: implicitly install dependencies @@ -17,14 +22,12 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY ["start.sh", "config.sh", "/usr/bin/"] +COPY ["start.sh", "teamd.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["teamd.j2", "/usr/share/sonic/templates/"] -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/bin/bash", "-c"] -CMD ["/usr/bin/config.sh && /usr/bin/start.sh"] +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-teamd/config.sh b/dockers/docker-teamd/config.sh deleted file mode 100755 index 9351966f233f..000000000000 --- a/dockers/docker-teamd/config.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -mkdir -p /etc/teamd -rm -f /etc/teamd/* - -for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannels.keys() | join(' ')"`; do - sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /usr/share/sonic/templates/teamd.j2 >/etc/teamd/$pc.conf -done - -mkdir -p /var/sonic -echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status - diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index 5397475defb7..77a3ff43be85 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -1,45 +1,20 @@ -#!/bin/bash +#!/usr/bin/env bash TEAMD_CONF_PATH=/etc/teamd -# Before teamd could automatically add newly created host interfaces into the -# LAG, this workaround will be needed. It will remove the obsolete files and -# net devices that are failed to be removed in the previous run. -function start_app { - # Remove *.pid and *.sock files if there are any - rm -f /var/run/teamd/* - if [ -d $TEAMD_CONF_PATH ]; then - for f in $TEAMD_CONF_PATH/*; do - # Remove netdevs if there are any - intf=`echo $f | awk -F'[/.]' '{print $4}'` - ip link del $intf - teamd -f $f -d - done - fi - teamsyncd & -} - -function clean_up { - pkill -9 teamd - pkill -9 teamsyncd - service rsyslog stop - exit -} - -trap clean_up SIGTERM SIGKILL +rm -rf $TEAMD_CONF_PATH +mkdir -p $TEAMD_CONF_PATH -rm -f /var/run/rsyslogd.pid -service rsyslog start - -# Before teamd could automatically add newly created host interfaces into the -# LAG, this workaround will wait until the host interfaces are created and then -# the processes will be started. -while true; do - # Check if front-panel ports are configured - result=`echo -en "SELECT 0\nHGETALL PORT_TABLE:ConfigDone" | redis-cli | sed -n 3p` - if [ "$result" == "0" ]; then - start_app - read - fi - sleep 1 +for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannels.keys() | join(' ')"`; do + sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf done + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +supervisorctl start teamd + diff --git a/dockers/docker-teamd/supervisord.conf b/dockers/docker-teamd/supervisord.conf new file mode 100644 index 000000000000..3d471bd3a222 --- /dev/null +++ b/dockers/docker-teamd/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:teamd] +command=/usr/bin/teamd.sh +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-teamd/teamd.sh b/dockers/docker-teamd/teamd.sh new file mode 100755 index 000000000000..71bc24512ebc --- /dev/null +++ b/dockers/docker-teamd/teamd.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +TEAMD_CONF_PATH=/etc/teamd + +# Before teamd could automatically add newly created host interfaces into the +# LAG, this workaround will be needed. It will remove the obsolete files and +# net devices that are failed to be removed in the previous run. +function start_app { + # Remove *.pid and *.sock files if there are any + rm -f /var/run/teamd/* + if [ -d $TEAMD_CONF_PATH ]; then + for f in $TEAMD_CONF_PATH/*; do + # Remove netdevs if there are any + intf=`echo $f | awk -F'[/.]' '{print $4}'` + ip link del $intf + teamd -f $f -d + done + fi + teamsyncd & +} + +function clean_up { + pkill -9 teamd + pkill -9 teamsyncd + exit +} + +trap clean_up SIGTERM SIGKILL + +# Before teamd could automatically add newly created host interfaces into the +# LAG, this workaround will wait until the host interfaces are created and then +# the processes will be started. +while true; do + # Check if front-panel ports are configured + result=`echo -en "SELECT 0\nHGETALL PORT_TABLE:ConfigDone" | redis-cli | sed -n 3p` + if [ "$result" == "0" ]; then + start_app + read + fi + sleep 1 +done + diff --git a/platform/broadcom/docker-syncd-brcm-rpc/99-syncd.conf b/platform/broadcom/docker-syncd-brcm-rpc/99-syncd.conf new file mode 100644 index 000000000000..f3b57e3b1964 --- /dev/null +++ b/platform/broadcom/docker-syncd-brcm-rpc/99-syncd.conf @@ -0,0 +1,2 @@ +sysctl -w net.core.rmem_max=509430500 + diff --git a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 index cc7c756f801c..4799d7a5ab31 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 @@ -27,7 +27,6 @@ RUN apt-get update \ python-dev \ wget \ cmake \ - supervisor \ && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && tar xvfz 1.0.0.tar.gz \ && cd nanomsg-1.0.0 \ @@ -47,10 +46,8 @@ RUN apt-get update \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ && rm -rf /root/deps -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] +COPY ["99-syncd.conf", "/etc/sysctl.d/"] -RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh +ENTRYPOINT ["/usr/bin/supervisord"] -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] diff --git a/platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf b/platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf deleted file mode 100644 index daf9de259d77..000000000000 --- a/platform/broadcom/docker-syncd-brcm-rpc/supervisord.conf +++ /dev/null @@ -1,2 +0,0 @@ -[supervisord] -nodaemon=false diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index ffe7b6c57397..af6c96c585d0 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -19,12 +19,14 @@ debs/{{ deb }}{{' '}} ## TODO: add kmod into Depends RUN apt-get install -f kmod -COPY ["debs/dsserve", "debs/bcmcmd", "start.sh", "/usr/bin/"] +COPY ["debs/dsserve", "debs/bcmcmd", "start.sh", "syncd.sh", "/usr/bin/"] RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index 6a08b7151432..96e2a9128081 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -1,15 +1,8 @@ -#!/bin/bash +#!/usr/bin/env bash -function clean_up { - service syncd stop - service rsyslog stop - exit -} +rm -f /var/run/rsyslogd.pid -trap clean_up SIGTERM SIGKILL +supervisorctl start rsyslogd -rm -f /var/run/rsyslogd.pid -service rsyslog start -service syncd start +supervisorctl start syncd -read diff --git a/platform/broadcom/docker-syncd-brcm/supervisord.conf b/platform/broadcom/docker-syncd-brcm/supervisord.conf new file mode 100644 index 000000000000..71ebffee3bf4 --- /dev/null +++ b/platform/broadcom/docker-syncd-brcm/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd.sh +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/platform/broadcom/docker-syncd-brcm/syncd.sh b/platform/broadcom/docker-syncd-brcm/syncd.sh new file mode 100755 index 000000000000..993cf100f2f0 --- /dev/null +++ b/platform/broadcom/docker-syncd-brcm/syncd.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +function clean_up { + service syncd stop + exit +} + +trap clean_up SIGTERM SIGKILL + +service syncd start + +read diff --git a/platform/cavium/docker-syncd-cavm-rpc/99-syncd.conf b/platform/cavium/docker-syncd-cavm-rpc/99-syncd.conf new file mode 100644 index 000000000000..f3b57e3b1964 --- /dev/null +++ b/platform/cavium/docker-syncd-cavm-rpc/99-syncd.conf @@ -0,0 +1,2 @@ +sysctl -w net.core.rmem_max=509430500 + diff --git a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 index 2688e37833e1..0de427c22a27 100644 --- a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 @@ -27,7 +27,6 @@ RUN apt-get update \ python-dev \ wget \ cmake \ - supervisor \ && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && tar xvfz 1.0.0.tar.gz \ && cd nanomsg-1.0.0 \ @@ -47,10 +46,7 @@ RUN apt-get update \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ && rm -rf /root/deps -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] +COPY ["99-syncd.conf", "/etc/sysctl.d/"] -RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh - -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/cavium/docker-syncd-cavm-rpc/supervisord.conf b/platform/cavium/docker-syncd-cavm-rpc/supervisord.conf deleted file mode 100644 index daf9de259d77..000000000000 --- a/platform/cavium/docker-syncd-cavm-rpc/supervisord.conf +++ /dev/null @@ -1,2 +0,0 @@ -[supervisord] -nodaemon=false diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index 45b71e85129c..dd37db2e04d2 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -18,7 +18,8 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY ["start.sh", "/usr/bin/"] +COPY ["start.sh", "syncd.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["profile.ini", "/etc/ssw/AS7512/"] @@ -26,5 +27,4 @@ COPY ["profile.ini", "/etc/ssw/AS7512/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/cavium/docker-syncd-cavm/start.sh b/platform/cavium/docker-syncd-cavm/start.sh index b6c77ff235b5..96e2a9128081 100755 --- a/platform/cavium/docker-syncd-cavm/start.sh +++ b/platform/cavium/docker-syncd-cavm/start.sh @@ -1,24 +1,8 @@ -#!/bin/bash - -export XP_ROOT=/usr/bin/ +#!/usr/bin/env bash rm -f /var/run/rsyslogd.pid -service rsyslog start - -while true; do - - # Check if redis-server starts - - result=$(redis-cli ping) - - if [ "$result" == "PONG" ]; then - - redis-cli FLUSHALL - syncd -p /etc/ssw/AS7512/profile.ini -N - break - fi +supervisorctl start rsyslogd - sleep 1 +supervisorctl start syncd -done diff --git a/platform/cavium/docker-syncd-cavm/supervisord.conf b/platform/cavium/docker-syncd-cavm/supervisord.conf new file mode 100644 index 000000000000..71ebffee3bf4 --- /dev/null +++ b/platform/cavium/docker-syncd-cavm/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd.sh +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/platform/cavium/docker-syncd-cavm/syncd.sh b/platform/cavium/docker-syncd-cavm/syncd.sh new file mode 100755 index 000000000000..24767dfc6e0a --- /dev/null +++ b/platform/cavium/docker-syncd-cavm/syncd.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +export XP_ROOT=/usr/bin/ + +while true; do + + # Check if redis-server starts + + result=$(redis-cli ping) + + if [ "$result" == "PONG" ]; then + + redis-cli FLUSHALL + syncd -p /etc/ssw/AS7512/profile.ini -N + break + + fi + + sleep 1 + +done + diff --git a/platform/centec/docker-syncd-centec-rpc/99-syncd.conf b/platform/centec/docker-syncd-centec-rpc/99-syncd.conf new file mode 100644 index 000000000000..f3b57e3b1964 --- /dev/null +++ b/platform/centec/docker-syncd-centec-rpc/99-syncd.conf @@ -0,0 +1,2 @@ +sysctl -w net.core.rmem_max=509430500 + diff --git a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 index 2199e85d85d1..13a2c92cecee 100644 --- a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 @@ -27,7 +27,6 @@ RUN apt-get update \ python-dev \ wget \ cmake \ - supervisor \ && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && tar xvfz 1.0.0.tar.gz \ && cd nanomsg-1.0.0 \ @@ -47,10 +46,8 @@ RUN apt-get update \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ && rm -rf /root/deps -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] +COPY ["99-syncd.conf", "/etc/sysctl.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] -RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh - -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] diff --git a/platform/centec/docker-syncd-centec-rpc/supervisord.conf b/platform/centec/docker-syncd-centec-rpc/supervisord.conf deleted file mode 100644 index daf9de259d77..000000000000 --- a/platform/centec/docker-syncd-centec-rpc/supervisord.conf +++ /dev/null @@ -1,2 +0,0 @@ -[supervisord] -nodaemon=false diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index 617143215a4d..9e0fe52b174e 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -19,11 +19,12 @@ debs/{{ deb }}{{' '}} ## TODO: add kmod into Depends RUN apt-get install -f kmod -COPY ["start.sh", "/usr/bin/"] +COPY ["start.sh", "syncd.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/platform/centec/docker-syncd-centec/start.sh b/platform/centec/docker-syncd-centec/start.sh index 6a08b7151432..96e2a9128081 100755 --- a/platform/centec/docker-syncd-centec/start.sh +++ b/platform/centec/docker-syncd-centec/start.sh @@ -1,15 +1,8 @@ -#!/bin/bash +#!/usr/bin/env bash -function clean_up { - service syncd stop - service rsyslog stop - exit -} +rm -f /var/run/rsyslogd.pid -trap clean_up SIGTERM SIGKILL +supervisorctl start rsyslogd -rm -f /var/run/rsyslogd.pid -service rsyslog start -service syncd start +supervisorctl start syncd -read diff --git a/platform/centec/docker-syncd-centec/supervisord.conf b/platform/centec/docker-syncd-centec/supervisord.conf new file mode 100644 index 000000000000..71ebffee3bf4 --- /dev/null +++ b/platform/centec/docker-syncd-centec/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd.sh +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/platform/centec/docker-syncd-centec/syncd.sh b/platform/centec/docker-syncd-centec/syncd.sh new file mode 100755 index 000000000000..993cf100f2f0 --- /dev/null +++ b/platform/centec/docker-syncd-centec/syncd.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +function clean_up { + service syncd stop + exit +} + +trap clean_up SIGTERM SIGKILL + +service syncd start + +read diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/99-syncd.conf b/platform/mellanox/docker-syncd-mlnx-rpc/99-syncd.conf new file mode 100644 index 000000000000..f3b57e3b1964 --- /dev/null +++ b/platform/mellanox/docker-syncd-mlnx-rpc/99-syncd.conf @@ -0,0 +1,2 @@ +sysctl -w net.core.rmem_max=509430500 + diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 3a4b4784babd..51fb26c00b11 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -27,7 +27,6 @@ RUN apt-get update \ python-dev \ wget \ cmake \ - supervisor \ && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && tar xvfz 1.0.0.tar.gz \ && cd nanomsg-1.0.0 \ @@ -47,10 +46,8 @@ RUN apt-get update \ && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ && rm -rf /root/deps -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY ptf_nn_agent.conf /etc/supervisor/conf.d/ptf_nn_agent.conf +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] +COPY ["99-syncd.conf", "/etc/sysctl.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] -RUN sed -i "/service rsyslog start/a sysctl -w net.core.rmem_max=509430500 ; \/usr\/bin\/supervisord" /usr/bin/start.sh - -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf b/platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf deleted file mode 100644 index daf9de259d77..000000000000 --- a/platform/mellanox/docker-syncd-mlnx-rpc/supervisord.conf +++ /dev/null @@ -1,2 +0,0 @@ -[supervisord] -nodaemon=false diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index cd686802f907..03257ad33e2f 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -18,13 +18,13 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY ["start.sh", "/usr/bin/"] -COPY ["mlnx-fw-upgrade.sh", "/usr/bin/"] +COPY ["start.sh", "syncd.sh", "mlnx-fw-upgrade.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["/debs/fw-SPC.mfa", "/etc/mlnx/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/bin/bash"] -CMD ["/usr/bin/start.sh"] +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/platform/mellanox/docker-syncd-mlnx/start.sh b/platform/mellanox/docker-syncd-mlnx/start.sh index 3c07069ba26e..96e2a9128081 100755 --- a/platform/mellanox/docker-syncd-mlnx/start.sh +++ b/platform/mellanox/docker-syncd-mlnx/start.sh @@ -1,21 +1,8 @@ -#!/bin/bash +#!/usr/bin/env bash -function clean_up { - service syncd stop - service rsyslog stop - exit -} +rm -f /var/run/rsyslogd.pid -trap clean_up SIGTERM SIGKILL +supervisorctl start rsyslogd -# fw-upgrade will exit if firmware was actually upgraded or if some error -# occures -. mlnx-fw-upgrade.sh +supervisorctl start syncd -# FIXME: the script cannot trap SIGTERM signal and it exits without clean_up -# Remove rsyslogd.pid file manually so that to start the rsyslog instantly -[ -e /var/run/rsyslogd.pid ] && rm /var/run/rsyslogd.pid -service rsyslog start -service syncd start - -read diff --git a/platform/mellanox/docker-syncd-mlnx/supervisord.conf b/platform/mellanox/docker-syncd-mlnx/supervisord.conf new file mode 100644 index 000000000000..71ebffee3bf4 --- /dev/null +++ b/platform/mellanox/docker-syncd-mlnx/supervisord.conf @@ -0,0 +1,27 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false ; One-shot +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd.sh +priority=3 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/platform/mellanox/docker-syncd-mlnx/syncd.sh b/platform/mellanox/docker-syncd-mlnx/syncd.sh new file mode 100755 index 000000000000..ad0e0e47be87 --- /dev/null +++ b/platform/mellanox/docker-syncd-mlnx/syncd.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +function clean_up { + service syncd stop + exit +} + +trap clean_up SIGTERM SIGKILL + +# fw-upgrade will exit if firmware was actually upgraded or if some error +# occures +. mlnx-fw-upgrade.sh + +# FIXME: the script cannot trap SIGTERM signal and it exits without clean_up +# Remove rsyslogd.pid file manually so that to start the rsyslog instantly +service syncd start + +read + From 37fc56908211d058326187b83477cf08555131b7 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 8 May 2017 21:33:59 -0700 Subject: [PATCH 0502/1833] [snmpagent]: update sonic-snmpagent submodule (#578) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index d39b66b354af..74e57b8381a9 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit d39b66b354af4db07313af82341fdc20762e89fc +Subproject commit 74e57b8381a92c64eaa0455dcd7b222af337a0f9 From d5c13c0a83141d7e108fce802e2bc57f5ef823c5 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 9 May 2017 17:37:08 -0700 Subject: [PATCH 0503/1833] [dockers]: Disable autorestart on all supervisor processes inside containers (#580) --- dockers/docker-basic_router/supervisord.conf | 3 ++- dockers/docker-database/supervisord.conf | 1 + dockers/docker-dhcp-relay/supervisord.conf | 4 +++- dockers/docker-fpm-gobgp/supervisord.conf | 5 ++++- dockers/docker-fpm-quagga/supervisord.conf | 4 +++- dockers/docker-lldp-sv2/supervisord.conf | 7 +++++-- dockers/docker-orchagent/supervisord.conf | 4 +++- dockers/docker-platform-monitor/supervisord.conf | 5 +++-- dockers/docker-saiserver-brcm/supervisord.conf | 4 +++- dockers/docker-saiserver-cavm/supervisord.conf | 4 +++- dockers/docker-saiserver-mlnx/supervisord.conf | 4 +++- dockers/docker-snmp-sv2/supervisord.conf | 5 ++++- dockers/docker-teamd/supervisord.conf | 4 +++- platform/broadcom/docker-syncd-brcm/supervisord.conf | 4 +++- platform/cavium/docker-syncd-cavm/supervisord.conf | 4 +++- platform/centec/docker-syncd-centec/supervisord.conf | 4 +++- platform/mellanox/docker-syncd-mlnx/supervisord.conf | 4 +++- 17 files changed, 52 insertions(+), 18 deletions(-) diff --git a/dockers/docker-basic_router/supervisord.conf b/dockers/docker-basic_router/supervisord.conf index 2ae8ec428b3e..76f9a1968786 100644 --- a/dockers/docker-basic_router/supervisord.conf +++ b/dockers/docker-basic_router/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-database/supervisord.conf b/dockers/docker-database/supervisord.conf index 12a6c0a8fb1b..2c78d9c39311 100644 --- a/dockers/docker-database/supervisord.conf +++ b/dockers/docker-database/supervisord.conf @@ -7,6 +7,7 @@ nodaemon=true command=/usr/bin/redis-server /etc/redis/redis.conf priority=1 autostart=true +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-dhcp-relay/supervisord.conf b/dockers/docker-dhcp-relay/supervisord.conf index 8e23c5c260ce..512762f2a5b4 100644 --- a/dockers/docker-dhcp-relay/supervisord.conf +++ b/dockers/docker-dhcp-relay/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/bin/isc-dhcp-relay.sh priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-fpm-gobgp/supervisord.conf b/dockers/docker-fpm-gobgp/supervisord.conf index 18670a084703..34fca6756821 100644 --- a/dockers/docker-fpm-gobgp/supervisord.conf +++ b/dockers/docker-fpm-gobgp/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/sbin/gobgpd -p -f /etc/gobgp/gobgpd.conf -r priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -29,6 +31,7 @@ stderr_logfile=syslog command=fpmsyncd priority=5 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-fpm-quagga/supervisord.conf b/dockers/docker-fpm-quagga/supervisord.conf index 2e9d4925b985..db069bd93787 100644 --- a/dockers/docker-fpm-quagga/supervisord.conf +++ b/dockers/docker-fpm-quagga/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=fpmsyncd priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-lldp-sv2/supervisord.conf b/dockers/docker-lldp-sv2/supervisord.conf index 62b4daebd107..dcac7a8645f5 100644 --- a/dockers/docker-lldp-sv2/supervisord.conf +++ b/dockers/docker-lldp-sv2/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -27,6 +28,7 @@ stderr_logfile=syslog command=/usr/sbin/lldpd -d -I Ethernet*,eth* priority=100 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -34,7 +36,7 @@ stderr_logfile=syslog command=/opt/reconfigure.sh priority=150 autostart=false -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -42,6 +44,7 @@ stderr_logfile=syslog command=/usr/bin/env python2 -m lldp_syncd priority=200 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index ef3a30f64358..943233d2d421 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/bin/orchagent.sh priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-platform-monitor/supervisord.conf b/dockers/docker-platform-monitor/supervisord.conf index b069c48141ac..d4f21cf609fa 100644 --- a/dockers/docker-platform-monitor/supervisord.conf +++ b/dockers/docker-platform-monitor/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,7 +23,7 @@ stderr_logfile=syslog command=/usr/bin/lm-sensors.sh priority=3 autostart=false -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-saiserver-brcm/supervisord.conf b/dockers/docker-saiserver-brcm/supervisord.conf index aa6899737e8d..e09ac3cbb449 100644 --- a/dockers/docker-saiserver-brcm/supervisord.conf +++ b/dockers/docker-saiserver-brcm/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-saiserver-cavm/supervisord.conf b/dockers/docker-saiserver-cavm/supervisord.conf index aa6899737e8d..e09ac3cbb449 100644 --- a/dockers/docker-saiserver-cavm/supervisord.conf +++ b/dockers/docker-saiserver-cavm/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-saiserver-mlnx/supervisord.conf b/dockers/docker-saiserver-mlnx/supervisord.conf index aa6899737e8d..e09ac3cbb449 100644 --- a/dockers/docker-saiserver-mlnx/supervisord.conf +++ b/dockers/docker-saiserver-mlnx/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index c4e883b3f8f0..624b61f96225 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ip -p /run/snmpd.pid priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -29,6 +31,7 @@ stderr_logfile=syslog command=/usr/bin/env python3.6 -m sonic_ax_impl priority=4 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-teamd/supervisord.conf b/dockers/docker-teamd/supervisord.conf index 3d471bd3a222..2db52ebd073f 100644 --- a/dockers/docker-teamd/supervisord.conf +++ b/dockers/docker-teamd/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/bin/teamd.sh priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/platform/broadcom/docker-syncd-brcm/supervisord.conf b/platform/broadcom/docker-syncd-brcm/supervisord.conf index 71ebffee3bf4..80d04a225ffd 100644 --- a/platform/broadcom/docker-syncd-brcm/supervisord.conf +++ b/platform/broadcom/docker-syncd-brcm/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/bin/syncd.sh priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/platform/cavium/docker-syncd-cavm/supervisord.conf b/platform/cavium/docker-syncd-cavm/supervisord.conf index 71ebffee3bf4..80d04a225ffd 100644 --- a/platform/cavium/docker-syncd-cavm/supervisord.conf +++ b/platform/cavium/docker-syncd-cavm/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/bin/syncd.sh priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/platform/centec/docker-syncd-centec/supervisord.conf b/platform/centec/docker-syncd-centec/supervisord.conf index 71ebffee3bf4..80d04a225ffd 100644 --- a/platform/centec/docker-syncd-centec/supervisord.conf +++ b/platform/centec/docker-syncd-centec/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/bin/syncd.sh priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog diff --git a/platform/mellanox/docker-syncd-mlnx/supervisord.conf b/platform/mellanox/docker-syncd-mlnx/supervisord.conf index 71ebffee3bf4..80d04a225ffd 100644 --- a/platform/mellanox/docker-syncd-mlnx/supervisord.conf +++ b/platform/mellanox/docker-syncd-mlnx/supervisord.conf @@ -7,7 +7,7 @@ nodaemon=true command=/usr/bin/start.sh priority=1 autostart=true -autorestart=false ; One-shot +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -15,6 +15,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog @@ -22,6 +23,7 @@ stderr_logfile=syslog command=/usr/bin/syncd.sh priority=3 autostart=false +autorestart=false stdout_logfile=syslog stderr_logfile=syslog From 8993614d6bf85babbf8de83d33a6a6716a8dc7b7 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 10 May 2017 11:21:56 -0700 Subject: [PATCH 0504/1833] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 9b9ed723e1f7..0c2d30cf6bae 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,9 @@ P4: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buil Following is the instruction on how to build an [(ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also how to build docker images running inside the NOS. Note that SONiC image are build per ASIC platform. Switches using the same ASIC platform share a common image. For a list of supported switches and ASIC, please refer to this [document](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all). +# Hardware +Any server can be a build image server. We are using a server with 1T hard disk. The OS is Ubuntu 16.04. + # Prerequisites ## SAI Version From 6393afdb0bf30a298a771578ad922c662696fc13 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 10 May 2017 12:39:00 -0700 Subject: [PATCH 0505/1833] [sonic-utilities]: Update submodule (#581) --- files/image_config/sudoers/sudoers | 6 ++++-- src/sonic-utilities | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 57248ee8c1c4..1b1979a2e9bb 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -17,8 +17,10 @@ Defaults env_keep += "VTYSH_PAGER" # Cmnd alias specification # Note: bcmcmd is dangerous for users in read only netgroups because it may operate ASIC -Cmnd_Alias READ_ONLY_CMDS = /usr/bin/portstat,\ - /usr/bin/vtysh -c "show.*" +Cmnd_Alias READ_ONLY_CMDS = /usr/bin/decode-syseeprom, \ + /usr/bin/vtysh -c show *, \ + /bin/cat /var/log/syslog, \ + /usr/bin/tail -f /var/log/syslog # User privilege specification root ALL=(ALL:ALL) ALL diff --git a/src/sonic-utilities b/src/sonic-utilities index 452df11df5a4..3378ef8387f6 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 452df11df5a47e1d646e5ce846757112b526694f +Subproject commit 3378ef8387f643f3ef81cbc15a6b4bda95570e21 From 68545416dc7a54ea66794e31d682652860f16ecf Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 10 May 2017 12:49:52 -0700 Subject: [PATCH 0506/1833] [Broadcom]: Update Broadcom SDK to 3.2.2.2-6 and SAI to 2.1.5.1-6 (#583) Signed-off-by: Shuotian Cheng --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index ce9f0a64f4bc..1aa232c97607 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-5-20170505222214.31_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-5-20170505222214.31_amd64.deb?sv=2015-04-05&sr=b&sig=jxKRlFJ%2BjDmq6Xi2p1SXc35IVdhsfRoR0umcOnM5Cj8%3D&se=2031-01-12T22%3A43%3A54Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-6-20170510001051.32_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-6-20170510001051.32_amd64.deb?sv=2015-04-05&sr=b&sig=PS9GQvhA2n%2BLXtu93KYKybvmmLyeIX%2BcrRZspIBvm5o%3D&se=2031-01-17T07%3A02%3A06Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-5-20170505222214.31_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-6-20170510001051.32_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-5-20170505222214.31_amd64.deb?sv=2015-04-05&sr=b&sig=HZN4itbQuJXfZCPZx1A%2BSxN3hBxZ05%2FmCE8Lp1zTgXM%3D&se=2031-01-12T22%3A44%3A20Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-6-20170510001051.32_amd64.deb?sv=2015-04-05&sr=b&sig=d2%2BYxTvzjR92hDXx5Wx7gWDQU52wpLzw4ECxNiAwExM%3D&se=2031-01-17T07%3A01%3A37Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index cee7939c730c..a41ad6662d46 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-5-20170505212020.37_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-5-20170505212020.37_amd64.deb?sv=2015-04-05&sr=b&sig=wTWOEP8zJE1Jba3M5n8we4x%2Fcpq39%2B00ORByVHhBOuQ%3D&se=2031-01-12T22%3A42%3A51Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.2.2-6-20170509231001.38_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-6-20170509231001.38_amd64.deb?sv=2015-04-05&sr=b&sig=xawExeGCWMMToo%2Fsk%2BNFRHIXK1eJiqOir4lZ5FUvIdo%3D&se=2031-01-17T07%3A00%3A10Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-5-20170505212020.37_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-5-20170505212020.37_amd64.deb?sv=2015-04-05&sr=b&sig=QovFF5suqpKxHqZ01r0BiooKw7ik5Kpk6GU0pxf8xmg%3D&se=2031-01-12T22%3A43%3A24Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-6-20170509231001.38_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-6-20170509231001.38_amd64.deb?sv=2015-04-05&sr=b&sig=PPo0AKc%2FwnaAwNsA2O6e5erAZ4vso6KRXxgrNN%2FlJ3A%3D&se=2031-01-17T07%3A00%3A56Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 3af7c3a13274aa40348caaf341abb0c6b74ac233 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 10 May 2017 17:39:51 -0700 Subject: [PATCH 0507/1833] [debian]: Disable receiving default routes for ipv6 on mgmt interface (#588) * Disable net.ipv6.conf.eth0.accept_ra_defrtr. It will remain IPv6 working on mgmt interface, but it will disable receiving default routes --- build_debian.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index 7d763a46f2e5..009cf3bf4b88 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -237,6 +237,8 @@ set /files/etc/sysctl.conf/net.ipv6.conf.eth0.forwarding 0 set /files/etc/sysctl.conf/net.ipv6.conf.default.accept_dad 0 set /files/etc/sysctl.conf/net.ipv6.conf.all.accept_dad 0 + +set /files/etc/sysctl.conf/net.ipv6.conf.eth0.accept_ra_defrtr 0 " -r $FILESYSTEM_ROOT ## docker-py is needed by Ansible docker module From 0b8c06b9e26a3085e3851e8b7b04b0ef790cdcff Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 10 May 2017 22:48:04 -0700 Subject: [PATCH 0508/1833] [image]: re-patch the support for Broadcom 54616 phy for intel igb driver. (#574) Previous patch is not correct. --- src/igb/Makefile | 2 +- ...1-add-PHY-support-for-Broadcom-54616.patch | 61 +++++++++++++++++++ ...or-BCM54616-phy-for-intel-igb-driver.patch | 37 ----------- 3 files changed, 62 insertions(+), 38 deletions(-) create mode 100644 src/igb/patch/0001-add-PHY-support-for-Broadcom-54616.patch delete mode 100644 src/igb/patch/0001-add-support-for-BCM54616-phy-for-intel-igb-driver.patch diff --git a/src/igb/Makefile b/src/igb/Makefile index ab8c68cef32d..afa7a676748b 100644 --- a/src/igb/Makefile +++ b/src/igb/Makefile @@ -11,7 +11,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Patch pushd ./igb-$(IGB_DRIVER_VERSION) - patch -p1 < ../patch/0001-add-support-for-BCM54616-phy-for-intel-igb-driver.patch + patch -p1 < ../patch/0001-add-PHY-support-for-Broadcom-54616.patch # Build the package pushd src diff --git a/src/igb/patch/0001-add-PHY-support-for-Broadcom-54616.patch b/src/igb/patch/0001-add-PHY-support-for-Broadcom-54616.patch new file mode 100644 index 000000000000..fc468f337356 --- /dev/null +++ b/src/igb/patch/0001-add-PHY-support-for-Broadcom-54616.patch @@ -0,0 +1,61 @@ +From 10ed7b7e0fd06c312f497e4647c4140b1cc8eef8 Mon Sep 17 00:00:00 2001 +From: Guohan Lu +Date: Mon, 8 May 2017 05:53:38 +0000 +Subject: [PATCH] add PHY support for Broadcom 54616 + +--- + src/e1000_82575.c | 5 +++++ + src/e1000_defines.h | 1 + + src/e1000_hw.h | 1 + + 3 files changed, 7 insertions(+) + +diff --git a/src/e1000_82575.c b/src/e1000_82575.c +index b4b973e..afaa7e5 100644 +--- a/src/e1000_82575.c ++++ b/src/e1000_82575.c +@@ -302,6 +302,9 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82580; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; + break; ++ case BCM54616_E_PHY_ID: ++ phy->type = e1000_phy_bcm54616; ++ break; + default: + ret_val = -E1000_ERR_PHY; + goto out; +@@ -1602,6 +1605,8 @@ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) + case e1000_phy_82580: + ret_val = e1000_copper_link_setup_82577(hw); + break; ++ case e1000_phy_bcm54616: ++ break; + default: + ret_val = -E1000_ERR_PHY; + break; +diff --git a/src/e1000_defines.h b/src/e1000_defines.h +index 6de3988..773c464 100644 +--- a/src/e1000_defines.h ++++ b/src/e1000_defines.h +@@ -1185,6 +1185,7 @@ + #define I210_I_PHY_ID 0x01410C00 + #define IGP04E1000_E_PHY_ID 0x02A80391 + #define M88_VENDOR 0x0141 ++#define BCM54616_E_PHY_ID 0x03625D10 + + /* M88E1000 Specific Registers */ + #define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Reg */ +diff --git a/src/e1000_hw.h b/src/e1000_hw.h +index 3bcecf1..cca5d77 100644 +--- a/src/e1000_hw.h ++++ b/src/e1000_hw.h +@@ -133,6 +133,7 @@ enum e1000_phy_type { + e1000_phy_82580, + e1000_phy_vf, + e1000_phy_i210, ++ e1000_phy_bcm54616, + }; + + enum e1000_bus_type { +-- +2.7.4 + diff --git a/src/igb/patch/0001-add-support-for-BCM54616-phy-for-intel-igb-driver.patch b/src/igb/patch/0001-add-support-for-BCM54616-phy-for-intel-igb-driver.patch deleted file mode 100644 index 3059c5f6f951..000000000000 --- a/src/igb/patch/0001-add-support-for-BCM54616-phy-for-intel-igb-driver.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 548db654a498a017ce121292f12820176544e6ed Mon Sep 17 00:00:00 2001 -From: Guohan Lu -Date: Tue, 27 Dec 2016 23:21:22 +0000 -Subject: [PATCH] add support for BCM54616 phy for intel igb driver - ---- - src/e1000_82575.c | 1 + - src/e1000_defines.h | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/src/e1000_82575.c b/src/e1000_82575.c -index b4b973e..248c670 100644 ---- a/src/e1000_82575.c -+++ b/src/e1000_82575.c -@@ -223,6 +223,7 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) - case M88E1112_E_PHY_ID: - case M88E1340M_E_PHY_ID: - case M88E1111_I_PHY_ID: -+ case BCM54616_E_PHY_ID: - phy->type = e1000_phy_m88; - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.get_info = e1000_get_phy_info_m88; -diff --git a/src/e1000_defines.h b/src/e1000_defines.h -index 6de3988..d5da148 100644 ---- a/src/e1000_defines.h -+++ b/src/e1000_defines.h -@@ -1185,6 +1185,7 @@ - #define I210_I_PHY_ID 0x01410C00 - #define IGP04E1000_E_PHY_ID 0x02A80391 - #define M88_VENDOR 0x0141 -+#define BCM54616_E_PHY_ID 0x03625D10 - - /* M88E1000 Specific Registers */ - #define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Reg */ --- -1.9.1 - From 1c767356c52dd890910b41aebce21108468ff5ae Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 11 May 2017 10:28:38 -0700 Subject: [PATCH 0509/1833] swss submodule update (#590) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 49c556ce7cdd..eed4a2d28b2b 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 49c556ce7cdd9a00952cf093191c8c7871b7913e +Subproject commit eed4a2d28b2b0d1eb1655eb74c875929ac6dbf9b From 6e45307a491f687980252496cddf7ec40fb1f9a2 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 11 May 2017 11:18:10 -0700 Subject: [PATCH 0510/1833] [docker-orchagent]: Properly manage with supervisord (#589) --- dockers/docker-orchagent/Dockerfile.j2 | 2 +- dockers/docker-orchagent/orchagent.sh | 56 +---------------------- dockers/docker-orchagent/start.sh | 19 ++++++++ dockers/docker-orchagent/supervisord.conf | 32 +++++++++++++ dockers/docker-orchagent/swssconfig.sh | 33 +++++++++++++ 5 files changed, 86 insertions(+), 56 deletions(-) create mode 100755 dockers/docker-orchagent/swssconfig.sh diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index c708f30e439b..ae67807d6eb9 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -26,7 +26,7 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -COPY ["start.sh", "orchagent.sh", "/usr/bin/"] +COPY ["start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"] COPY ["mirror.json.j2", "/usr/share/sonic/templates/"] diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 8afd8fab314b..cdf9ea16627a 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -1,80 +1,26 @@ #!/usr/bin/env bash -# Exit immediately upon error -set -e - -function start_app { - orchagent $ORCHAGENT_ARGS & - portsyncd $PORTSYNCD_ARGS & - intfsyncd & - neighsyncd & - for file in $SWSSCONFIG_ARGS - do - swssconfig /etc/swss/config.d/$file - sleep 1 - done -} - -function config_acl { - if [ -f "/etc/sonic/acl.json" ]; then - mkdir -p /etc/swss/config.d/acl - rm -rf /etc/swss/config.d/acl/* - translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json - for filename in /etc/swss/config.d/acl/*.json; do - [ -e "$filename" ] || break - swssconfig $filename - done - fi -} - -function clean_up { - pkill -9 orchagent - pkill -9 portsyncd - pkill -9 intfsyncd - pkill -9 neighsyncd - exit -} - -trap clean_up SIGTERM SIGKILL - HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` ORCHAGENT_ARGS="" -PORTSYNCD_ARGS="-p /usr/share/sonic/hwsku/port_config.ini" - -SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " - if [ "$HWSKU" == "Force10-S6000" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "Force10-S6100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Force10-Z9100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Arista-7050-QX32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" - SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "AS7512" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "INGRASYS-S9100-C32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "ACS-MSN2700" ]; then - SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " fi -while true; do - # Check if syncd starts - result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p` - if [ "$result" != "0" ]; then - start_app - config_acl - read - fi - sleep 1 -done +exec /usr/bin/orchagent ${ORCHAGENT_ARGS} diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index b86a9aa1dc57..823e6ce4c5e4 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -11,5 +11,24 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd +# Wait for syncd to start +while true; do + RESULT=$(echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p) + + if [ "$RESULT" != "0" ]; then + break + fi + + sleep 1 +done + supervisorctl start orchagent +supervisorctl start portsyncd + +supervisorctl start intfsyncd + +supervisorctl start neighsyncd + +supervisorctl start swssconfig + diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 943233d2d421..02c07188c61d 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -27,3 +27,35 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog +[program:portsyncd] +command=/usr/bin/portsyncd -p /usr/share/sonic/hwsku/port_config.ini +priority=4 +autostart=false +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 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:swssconfig] +command=/usr/bin/swssconfig.sh +priority=7 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh new file mode 100755 index 000000000000..f0f1e100f3d4 --- /dev/null +++ b/dockers/docker-orchagent/swssconfig.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +function config_acl { + if [ -f "/etc/sonic/acl.json" ]; then + mkdir -p /etc/swss/config.d/acl + rm -rf /etc/swss/config.d/acl/* + translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json + for filename in /etc/swss/config.d/acl/*.json; do + [ -e "$filename" ] || break + swssconfig $filename + done + fi +} + +HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` + +SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " + +if [ "$HWSKU" == "Force10-S6000" ]; then + SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +elif [ "$HWSKU" == "Arista-7050-QX32" ]; then + SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +elif [ "$HWSKU" == "ACS-MSN2700" ]; then + SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " +fi + +for file in $SWSSCONFIG_ARGS; do + swssconfig /etc/swss/config.d/$file + sleep 1 +done + +config_acl + From 7663da9510b645e745dd47c45d5062bfd0a40ea8 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 11 May 2017 12:37:14 -0700 Subject: [PATCH 0511/1833] Disable updategraph after first time (#592) --- files/image_config/updategraph/updategraph | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 0d3b248bc436..a46a5f73a0cf 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -68,6 +68,10 @@ while true; do sleep 5 done +# Mark as disabled after graph is successfully downloaded +sed -i "/enabled=/d" /etc/sonic/updategraph.conf +echo "enabled=false" >> /etc/sonic/updategraph.conf + if [ -n "$ACL_URL" ]; then if [ -f /etc/sonic/acl.json ]; then echo "Renaming acl.json to acl.json.old" From b26ec863e84f758fa82e0548ef1cfa78e8aa886a Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 11 May 2017 18:46:11 -0700 Subject: [PATCH 0512/1833] [docker-base]: Add less, strace, and configuration for vim (#591) * Add less in docker-base. Add strace in docker_base_dbg. * Make link vim to vim.tiny and have vim config file --- build_debian.sh | 1 + dockers/docker-base/Dockerfile.j2 | 6 +++++- dockers/docker-base/root/.vimrc | 2 ++ rules/docker-base.mk | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 dockers/docker-base/root/.vimrc diff --git a/build_debian.sh b/build_debian.sh index 009cf3bf4b88..d713ca0e52a1 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -199,6 +199,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in logrotate \ curl \ kexec-tools \ + less \ unzip ## Disable kexec supported reboot which was installed by default diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index b014c20a6401..d02d3c545027 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -27,10 +27,12 @@ RUN apt-get -y install \ supervisor \ vim-tiny \ perl \ - python + python \ + less COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] +COPY ["root/.vimrc", "/root/.vimrc"] RUN apt-get -y purge \ exim4 \ @@ -44,6 +46,8 @@ RUN apt-get -y install \ {% for dbg_pkg in docker_base_dbgs.split(' ') -%} {{ dbg_pkg }}{{' '}} {%- endfor %} +{% else %} +RUN ln /usr/bin/vim.tiny /usr/bin/vim {% endif %} ## Clean up apt diff --git a/dockers/docker-base/root/.vimrc b/dockers/docker-base/root/.vimrc new file mode 100644 index 000000000000..5c1ba8a04f47 --- /dev/null +++ b/dockers/docker-base/root/.vimrc @@ -0,0 +1,2 @@ +" enable vim features +set nocompatible diff --git a/rules/docker-base.mk b/rules/docker-base.mk index f041f7d05cdd..1580c357cddf 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -8,7 +8,8 @@ GDB = gdb VIM = vim OPENSSH = openssh-client SSHPASS = sshpass -$(DOCKER_BASE)_DBG_PACKAGES += $(GDB) $(VIM) $(OPENSSH) $(SSHPASS) +STRACE = strace +$(DOCKER_BASE)_DBG_PACKAGES += $(GDB) $(VIM) $(OPENSSH) $(SSHPASS) $(STRACE) endif SONIC_DOCKER_IMAGES += $(DOCKER_BASE) From a5088ae9ec96cc0fac31764cab5130473992e5c7 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 11 May 2017 18:57:00 -0700 Subject: [PATCH 0513/1833] [debian]: Add kernel configuration to reboot on kernel soft lockup (#594) --- build_debian.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index d713ca0e52a1..5b58358e017c 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -217,6 +217,9 @@ sudo mkdir -p $FILESYSTEM_ROOT/var/core sudo augtool --autosave " set /files/etc/sysctl.conf/kernel.core_pattern '|/usr/bin/coredump-compress %e %p' +set /files/etc/sysctl.conf/kernel.softlockup_panic 1 +set /files/etc/sysctl.conf/kernel.panic 10 + set /files/etc/sysctl.conf/net.ipv4.conf.default.forwarding 1 set /files/etc/sysctl.conf/net.ipv4.conf.all.forwarding 1 set /files/etc/sysctl.conf/net.ipv4.conf.eth0.forwarding 0 From f4343ac60009d90ecfb4da052a3c2e7ab7ada58a Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 12 May 2017 10:13:51 +0300 Subject: [PATCH 0514/1833] [mellanox]: Update SAI revision. (#593) New revision contains fixes to LAG and WRED configuration. Signed-off-by: marian-pritsak --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 163e298553f8..8ad62aae2f52 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = 1a4307f0ac40b28cd8ed8f48569458212d90366e +MLNX_SAI_REVISION = dd6b7cf8fcdc87a40cb694799daf8c081e859a14 export MLNX_SAI_VERSION MLNX_SAI_REVISION From 34449c162e2ecaa58b4eed6de3bdbdb033fcf718 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 12 May 2017 17:22:37 +0300 Subject: [PATCH 0515/1833] [mellanox][hw-management]: Update to 1.0.0100. (#599) New revision contains support for sys_eeprom in MSN2410 and MSN2100. Changes in mlnx2100 script for loading drivers. Signed-off-by: marian-pritsak --- platform/mellanox/hw-management.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 83c7632376f0..762bb6e53fe3 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,6 +1,6 @@ # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = V1.0.0070 +MLNX_HW_MANAGEMENT_VERSION = V1.0.0100 export MLNX_HW_MANAGEMENT_VERSION From 2cfa289d3e70376b67d8911219f4292d3a6836f1 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 12 May 2017 10:56:50 -0700 Subject: [PATCH 0516/1833] Image version safely treats slash in branch name (#596) --- build_debian.sh | 3 --- functions.sh | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 5b58358e017c..d2eaa43b3c46 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -116,11 +116,8 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-3.16.0-4-amd64_*.de ## Update initramfs for booting with squashfs+aufs cat files/initramfs-tools/modules | sudo tee -a $FILESYSTEM_ROOT/etc/initramfs-tools/modules > /dev/null -IMAGE_VERSION=$(. functions.sh && sonic_get_version) - ## Hook into initramfs: change fs type from vfat to ext4 on arista switches sudo mkdir -p $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/ -sed -i -e "s/%%IMAGE_VERSION%%/$IMAGE_VERSION/g" files/initramfs-tools/arista-convertfs sudo cp files/initramfs-tools/arista-convertfs $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs sudo cp files/initramfs-tools/mke2fs $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs diff --git a/functions.sh b/functions.sh index 8ca3d5422340..c73aeb45d649 100644 --- a/functions.sh +++ b/functions.sh @@ -59,9 +59,10 @@ sonic_get_version() { fi BUILD_NUMBER=${BUILD_NUMBER:-0} ## Check if we are on tagged commit + ## Note: escape the version string by sed: / -> _ if [ "$describe" == "$latest_tag" ]; then - echo "${latest_tag}${dirty}" + echo "${latest_tag}${dirty}" | sed 's/\//_/g' else - echo "${branch_name}.${BUILD_NUMBER}${dirty:--$(git rev-parse --short HEAD)}" + echo "${branch_name}.${BUILD_NUMBER}${dirty:--$(git rev-parse --short HEAD)}" | sed 's/\//_/g' fi } From 973ee89b27cefae334c44bf93620e4030de70b3d Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 12 May 2017 12:08:09 -0700 Subject: [PATCH 0517/1833] [Broadcom]: Update Broadcom SDK to 3.2.2.2-7 (#595) --- platform/broadcom/sdk.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index a41ad6662d46..070613d64dc0 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-6-20170509231001.38_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-6-20170509231001.38_amd64.deb?sv=2015-04-05&sr=b&sig=xawExeGCWMMToo%2Fsk%2BNFRHIXK1eJiqOir4lZ5FUvIdo%3D&se=2031-01-17T07%3A00%3A10Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.2.2-7-20170512003351.39_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-7-20170512003351.39_amd64.deb?sv=2015-04-05&sr=b&sig=YHETYSIxpB6LyTh2vhQ1TrGXommA2NiUdolk5QBJ0PE%3D&se=2031-01-19T01%3A40%3A27Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-6-20170509231001.38_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-6-20170509231001.38_amd64.deb?sv=2015-04-05&sr=b&sig=PPo0AKc%2FwnaAwNsA2O6e5erAZ4vso6KRXxgrNN%2FlJ3A%3D&se=2031-01-17T07%3A00%3A56Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-7-20170512003351.39_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-7-20170512003351.39_amd64.deb?sv=2015-04-05&sr=b&sig=33kv%2F2UogAuvHu3gPQ1rB7TVp9I%2Bjq%2FbmObzEZgfKD4%3D&se=2031-01-19T01%3A39%3A56Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From d296ceadd51dd9342ad205d990ea7b833d8d38d8 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 15 May 2017 11:45:41 -0700 Subject: [PATCH 0518/1833] [swss] submodule update (#604) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index eed4a2d28b2b..75e559a5063d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit eed4a2d28b2b0d1eb1655eb74c875929ac6dbf9b +Subproject commit 75e559a5063d9513b1fafd96d62c020e3c0a5eee From 910e66679887b3f5d557ea007ef759a64c6b6044 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 15 May 2017 14:32:39 -0700 Subject: [PATCH 0519/1833] Add /usr/bin/generate_dump to sudoers file; Update sonic-utilities submodule (#603) --- files/image_config/sudoers/sudoers | 1 + src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 1b1979a2e9bb..df2f59803176 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -18,6 +18,7 @@ Defaults env_keep += "VTYSH_PAGER" # Cmnd alias specification # Note: bcmcmd is dangerous for users in read only netgroups because it may operate ASIC Cmnd_Alias READ_ONLY_CMDS = /usr/bin/decode-syseeprom, \ + /usr/bin/generate_dump, \ /usr/bin/vtysh -c show *, \ /bin/cat /var/log/syslog, \ /usr/bin/tail -f /var/log/syslog diff --git a/src/sonic-utilities b/src/sonic-utilities index 3378ef8387f6..f31087a030e6 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 3378ef8387f643f3ef81cbc15a6b4bda95570e21 +Subproject commit f31087a030e685c6e1bcbdfa49d7a322c7f3d66a From 8af03fd0f9c563fecdfcf5bcab6bfa470e3d840c Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 15 May 2017 17:06:19 -0700 Subject: [PATCH 0520/1833] [orchagent]: Add ARP update script to maintain VLAN neighbors (#401) - Extend ARP reachable time to 30min - Add arping to docker-swss - Add arp_update script to routinely probe neighbors Signed-off-by: Shuotian Cheng --- build_debian.sh | 2 ++ dockers/docker-orchagent/Dockerfile.j2 | 4 ++-- dockers/docker-orchagent/arp_update | 17 +++++++++++++++++ dockers/docker-orchagent/start.sh | 5 +++++ dockers/docker-orchagent/supervisord.conf | 7 +++++++ 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100755 dockers/docker-orchagent/arp_update diff --git a/build_debian.sh b/build_debian.sh index d2eaa43b3c46..014deec23dbf 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -232,6 +232,8 @@ set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_filter 0 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_notify 1 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_ignore 2 +set /files/etc/sysctl.conf/net.ipv4.neigh.default.base_reachable_time_ms 1800000 + set /files/etc/sysctl.conf/net.ipv6.conf.default.forwarding 1 set /files/etc/sysctl.conf/net.ipv6.conf.all.forwarding 1 set /files/etc/sysctl.conf/net.ipv6.conf.eth0.forwarding 0 diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index ae67807d6eb9..e4e155163076 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -RUN apt-get install -f -y ifupdown libdbus-1-3 libdaemon0 libjansson4 +RUN apt-get install -f -y ifupdown arping libdbus-1-3 libdaemon0 libjansson4 ## Install redis-tools dependencies ## TODO: implicitly install dependencies @@ -26,7 +26,7 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -COPY ["start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] +COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"] COPY ["mirror.json.j2", "/usr/share/sonic/templates/"] diff --git a/dockers/docker-orchagent/arp_update b/dockers/docker-orchagent/arp_update new file mode 100755 index 000000000000..8291818e50fb --- /dev/null +++ b/dockers/docker-orchagent/arp_update @@ -0,0 +1,17 @@ +#!/bin/bash +# +# usage: +# arp_update: Send gratuitous ARP requests to VLAN member neighbors to refresh +# the neighbors state. + +VLAN=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_vlans.keys() | join(" ")'` +for vlan in $VLAN; do + # generate a list of arping commands: + # arping -q -w 0 -c 1 -i ; + # arping -q -w 0 -c 1 -i ; + # ... + arpingcmd="sed -e 's/ / -i /' -e 's/^/arping -q -w 0 -c 1 /' -e 's/$/;/'" + ipcmd="ip -4 neigh show | grep $vlan | cut -d ' ' -f 1,3 | $arpingcmd" + + eval `eval $ipcmd` +done diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 823e6ce4c5e4..40ef66441c02 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -32,3 +32,8 @@ supervisorctl start neighsyncd supervisorctl start swssconfig +# Start arp_update when VLAN exists +VLAN=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_vlans.keys() | join(" ")'` +if [ "$VLAN" != "" ]; then + supervisorctl start arp_update +fi diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 02c07188c61d..770fda701029 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -59,3 +59,10 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog +[program:arp_update] +command=bash -c "/usr/bin/arp_update && sleep 300" +priority=8 +autostart=false +autorestart=true +stdout_logfile=syslog +stderr_logfile=syslog From cb969fc843b7a2aab5516c0090d241122e2053e5 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 16 May 2017 08:07:47 -0700 Subject: [PATCH 0521/1833] [platform] Add Arista DCS-7050QX-32S and missing plugins (#597) * Update sonic-platform-modules-arista submodule * Add sensors.conf for Arista DCS-7050QX-32S * Add plugin/eeprom.py for Arista DCS-7050QX-32S * Add plugin/sfputil.py for Arista DCS-7050QX-32S * Add port_config.ini for Arista DCS-7050QX-32S * Add plugin/sfputil.py for Arista DCS-7060CX-32S * Add plugin/eeprom.py for Arista DCS-7060CX-32S * Update plugin/eeprom.py for Arista DCS-7050QX-32 --- .../x86_64-arista_7050_qx32/plugins/eeprom.py | 219 +----------------- .../Arista-7050-QX32S/port_config.ini | 33 +++ .../Arista-7050-QX32S/sai.profile | 1 + .../plugins/eeprom.py | 13 ++ .../plugins/sfputil.py | 30 +++ .../x86_64-arista_7050_qx32s/sensors.conf | 49 ++++ .../plugins/eeprom.py | 13 ++ .../plugins/sfputil.py | 28 +++ dockers/docker-orchagent/orchagent.sh | 2 + .../broadcom/sonic-platform-modules-arista | 2 +- 10 files changed, 176 insertions(+), 214 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/port_config.ini create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/sai.profile create mode 100644 device/arista/x86_64-arista_7050_qx32s/plugins/eeprom.py create mode 100644 device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py create mode 100644 device/arista/x86_64-arista_7050_qx32s/sensors.conf create mode 100644 device/arista/x86_64-arista_7060_cx32s/plugins/eeprom.py create mode 100644 device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py b/device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py index f8a3515d924f..9da54dbf1b90 100644 --- a/device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py +++ b/device/arista/x86_64-arista_7050_qx32/plugins/eeprom.py @@ -1,220 +1,13 @@ #!/usr/bin/env python -############################################################################# -# Arista 7050-QX32 -# -# 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 -############################################################################# +""" +Arista 7050QX-32 eeprom plugin +Uses the arista driver library to obtain the TlvInfoDecoder +""" try: - import exceptions - import binascii - import time - import optparse - import warnings - import os - import sys - import subprocess - import re - import struct - import zlib - import StringIO - from sonic_eeprom import eeprom_base - from sonic_eeprom import eeprom_tlvinfo + import arista.utils.sonic_eeprom as arista_eeprom except ImportError, e: raise ImportError (str(e) + "- required module not found") -def showMac( m ): - return ":".join([m[0:2], m[2:4], m[4:6], m[6:8], m[8:10], m[10:12]]) - -typeMap = { - "END" : ( "00", None, None, None, False ), - "SKU" : ( "03", None, None, None, False ), - "MAC" : ( "05", None, showMac, None, False ), - "SerialNumber" : ( "0E", None, None, None, False ), - } - -idToNameMap = {} -for k, v in typeMap.iteritems(): - idToNameMap[ v[0] ] = k - -class board(eeprom_tlvinfo.TlvInfoDecoder): - _TLV_INFO_MAX_LEN = 256 - _TLV_HDR_ENABLED = 0 - - pFdl = None - - def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/sys/bus/i2c/drivers/eeprom/1-0052/eeprom" - super(board, self).__init__(self.eeprom_path, 0, '', True) - - def _decode_eeprom(self, e): - # For format 0002 and more recent fdls use the new Prefdl class - data = e[0:4] - if data in ("0002", "0003"): - fp = StringIO.StringIO(e[4:]) - self.pFdl = PreFdl( fp, data, data ) - - def decode_eeprom(self, e): - self._decode_eeprom(e) - return self.pFdl.show() - - def is_checksum_valid(self, e): - self._decode_eeprom(e) - return (True, self.pFdl.get_crc()) - - def serial_number_str(self, e): - self._decode_eeprom(e) - return self.pFdl.get_field('SerialNumber') - - def mgmtaddrstr(self,e): - self._decode_eeprom(e) - return self.pFdl.get_field('MAC') - -def crc32( data ): - return struct.unpack("I",struct.pack("i",zlib.crc32( data )))[0] - -def validSerial( x ): - x = x.replace( " ", "" ) - x = x.replace( "-", "" ) - # All serial numbers are upper case - x = x.upper() - if re.compile( "[A-Z]{3}\d{4}[A-Z0-9]{4}$" ).match( x ): - return x - return None - -class PreFdlField( ): - def __init__( self, name, valid, show, optionName, data=None, append=False ): - self.name = name - if valid: - self.valid = valid - else: - self.valid = lambda x: x - self.show = show - self.optionName = optionName - self.data = [] - self.append = append - if data: - self.dataIs( data ) - - def dataIs( self, data ): - vd = self.valid( data ) - if not vd: - raise InvalidPrefdlData( "Invalid %s: %s" % ( self.name, data ) ) - if self.append: - self.data.append( vd ) - else: - self.data = [ vd ] - -class TlvField( PreFdlField ): - def __init__( self, name ): - args = typeMap.get( name ) - valid = None - show = None - optionName = None - append = False - if args: - self.id, valid, show, optionName, append = args - PreFdlField.__init__( self, name, valid, show, optionName, append=append ) - - -class PreFdl(): - def __init__( self, fp=None, preFdlStr=None, version="0002" ): - # populate the required fields - self.requiredFields = [] - self.mac = None - self.serial = None - - if version == "0002": - preFdlStr, offset = self.initPreFdl2( fp, preFdlStr ) - elif version == "0003": - preFdlStr, offset = self.initPreFdl3( fp, preFdlStr ) - else: - raise NotImplementedError( - "Only Prefdl data format version 0002 or 0003 are supported" ) - - # populate the tlv fileds - self.tlvFields = {} - for k in typeMap.keys(): - self.tlvFields[ k ] = TlvField( k ) - - # create the map option to field - self.optionMap = {} - for f in self.requiredFields + self.tlvFields.values(): - # Do not add the option from TLV if already added by required fields - if f.optionName and f.optionName not in self.optionMap: - self.optionMap[ f.optionName ] = f - - # save the current tlv fields - if fp: - while True: - tlv = fp.read( 6 ) - ( id, lengthStr ) = ( tlv[0:2], tlv[2:6] ) - length = int( lengthStr, base=16 ) - bytes = fp.read( length ) - what = None if id not in idToNameMap.keys() else idToNameMap[ id ] - if what and what != "END": - self.tlvFields[ what ].dataIs( bytes ) - preFdlStr += tlv + bytes - offset += 6 + length - if what == "END": - # End of the tlv list - break - self.crc = fp.read( 8 ) - # Check the CRC - computed = crc32( preFdlStr ) - if int( self.crc, 16 ) != computed: - raise Exception( "Invalid CRC -- saw %s expected %8X" % - ( self.crc, computed ) ) - - # Initialize and parse fixed section for prefdl version 2. Return the offset - # to where the TLV section starts. - def initPreFdl2( self, fp, preFdlStr ): - # if we start with an existing file - if fp: - # if no preFdlStr is specified, read the fixed section, 30 bytes. - # Otherwise, only the 4 byte data version section was written and - # read the remaining 26 bytes from the fixed section. - if not preFdlStr: - preFdlStr = fp.read( 30 ).strip() - elif preFdlStr == "0002": - preFdlStr += fp.read( 26 ).strip() - else: - raise ValueError( "preFdlStr arg has invalid data format" ) - if len( preFdlStr ) < 12: - fatal( "prefdl is too short exiting" ) - data = None if not preFdlStr else preFdlStr[ 16:16 + 11 ] - self.requiredFields.append( - PreFdlField( "SerialNumber", validSerial, None, None, data ) ) - return preFdlStr, 30 - - # Initialize and parse fixed section for prefdl version 3. Return the offset - # to where the TLV section starts. - def initPreFdl3( self, fp, preFdlStr ): - # if we start with an existing file - currPtr = 0 - if fp and not preFdlStr: - preFdlStr = fp.read( 4 ).strip() - if len( preFdlStr ) < 4: - fatal( "prefdl is too short exiting" ) - return preFdlStr, 4 - - def show( self ): - for f in self.requiredFields + self.tlvFields.values(): - for d in f.data: - dStr = d if f.show is None else f.show( d ) - print "%s: %s" % ( f.name, dStr ) - - def get_field( self, name ): - for f in self.requiredFields + self.tlvFields.values(): - for d in f.data: - if f.name == name: - dStr = d if f.show is None else f.show( d ) - return dStr - - def get_crc( self ): - return self.crc - +board = arista_eeprom.getTlvInfoDecoder() diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/port_config.ini new file mode 100644 index 000000000000..b56d958499d4 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 9,10,11,12 Ethernet5/1 +Ethernet4 13,14,15,16 Ethernet6/1 +Ethernet8 17,18,19,20 Ethernet7/1 +Ethernet12 21,22,23,24 Ethernet8/1 +Ethernet16 29,30,31,32 Ethernet9/1 +Ethernet20 25,26,27,28 Ethernet10/1 +Ethernet24 33,34,35,36 Ethernet11/1 +Ethernet28 37,38,39,40 Ethernet12/1 +Ethernet32 45,46,47,48 Ethernet13/1 +Ethernet36 41,42,43,44 Ethernet14/1 +Ethernet40 49,50,51,52 Ethernet15/1 +Ethernet44 53,54,55,56 Ethernet16/1 +Ethernet48 69,70,71,72 Ethernet17/1 +Ethernet52 65,66,67,68 Ethernet18/1 +Ethernet56 73,74,75,76 Ethernet19/1 +Ethernet60 77,78,79,80 Ethernet20/1 +Ethernet64 93,94,95,96 Ethernet21/1 +Ethernet68 89,90,91,92 Ethernet22/1 +Ethernet72 97,98,99,100 Ethernet23/1 +Ethernet76 101,102,103,104 Ethernet24/1 +Ethernet80 109,110,111,112 Ethernet25/1 +Ethernet84 105,106,107,108 Ethernet26/1 +Ethernet88 121,122,123,124 Ethernet27/1 +Ethernet92 125,126,127,128 Ethernet28/1 +Ethernet96 61,62,63,64 Ethernet29 +Ethernet100 57,58,59,60 Ethernet30 +Ethernet104 81,82,83,84 Ethernet31 +Ethernet108 85,86,87,88 Ethernet32 +Ethernet112 117,118,119,120 Ethernet33 +Ethernet116 113,114,115,116 Ethernet34 +Ethernet120 1,2,3,4 Ethernet35 +Ethernet124 5,6,7,8 Ethernet36 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/sai.profile b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/sai.profile new file mode 100644 index 000000000000..e06f3ba3a4b1 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/td2-a7050-qx32s-32x40G.config.bcm diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/eeprom.py b/device/arista/x86_64-arista_7050_qx32s/plugins/eeprom.py new file mode 100644 index 000000000000..d1c6212219d4 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/eeprom.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +""" +Arista 7050QX-32S eeprom plugin +Uses the arista driver library to obtain the TlvInfoDecoder +""" + +try: + import arista.utils.sonic_eeprom as arista_eeprom +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +board = arista_eeprom.getTlvInfoDecoder() diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py b/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py new file mode 100644 index 000000000000..18472c44c55b --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + eeprom_offset = 10 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + # also has sfp[1-4] ports handled by a mux to choose against qsfp5 + # i2c-40 to i2c-43 + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) diff --git a/device/arista/x86_64-arista_7050_qx32s/sensors.conf b/device/arista/x86_64-arista_7050_qx32s/sensors.conf new file mode 100644 index 000000000000..fc5f5c8c3e8e --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/sensors.conf @@ -0,0 +1,49 @@ +# libsensors configuration file for DCS-7050QX-32S +# ------------------------------------------------ +# + +bus "i2c-2" "SCD SMBus master 0 bus 0" +bus "i2c-3" "SCD SMBus master 0 bus 1" +bus "i2c-5" "SCD SMBus master 0 bus 3" +bus "i2c-6" "SCD SMBus master 0 bus 4" +bus "i2c-7" "SCD SMBus master 0 bus 5" + +chip "k10temp-pci-00c3" + label temp1 "Cpu temp sensor" + +chip "max6658-i2c-2-4c" + label temp1 "Board temp sensor" + set temp1_max 55 + set temp1_crit 70 + + label temp2 "Front panel temp sensor" + set temp2_max 65 + set temp2_crit 75 + +chip "max6658-i2c-3-4c" + label temp1 "Cpu board temp sensor" + set temp1_max 75 + set temp1_crit 80 + + label temp2 "Back panel temp sensor" + set temp2_max 75 + set temp2_crit 80 + +chip "pmbus-i2c-3-4e" + label temp1 "Power controller 1 sensor 1" + label temp2 "Power controller 1 sensor 2" + +chip "pmbus-i2c-7-4e" + label temp1 "Power controller 2 sensor 1" + label temp2 "Power controller 2 sensor 2" + +chip "pmbus-i2c-6-58" + label temp1 "Power supply 1 hotspot sensor" + label temp2 "Power supply 1 inlet temp sensor" + label temp3 "Power supply 1 sensor" + +chip "pmbus-i2c-5-58" + label temp1 "Power supply 2 hotspot sensor" + label temp2 "Power supply 2 inlet temp sensor" + label temp3 "Power supply 2 sensor" + diff --git a/device/arista/x86_64-arista_7060_cx32s/plugins/eeprom.py b/device/arista/x86_64-arista_7060_cx32s/plugins/eeprom.py new file mode 100644 index 000000000000..0cfe5109a300 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/plugins/eeprom.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +""" +Arista 7060CX-32S eeprom plugin +Uses the arista driver library to obtain the TlvInfoDecoder +""" + +try: + import arista.utils.sonic_eeprom as arista_eeprom +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +board = arista_eeprom.getTlvInfoDecoder() diff --git a/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py b/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py new file mode 100644 index 000000000000..0f7f0d2cac85 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 33 + ports_in_block = 34 + + eeprom_offset = 18 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, 32 + 1) + _sfp_ports = range(33, 34 + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index cdf9ea16627a..15eb2c7e17ac 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -14,6 +14,8 @@ elif [ "$HWSKU" == "Force10-Z9100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Arista-7050-QX32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "Arista-7050-QX32S" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "AS7512" ]; then diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index a1ca8013e952..43ed7b2330f2 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a1ca8013e952d1cc0d555c24fe6eb2bf016ab694 +Subproject commit 43ed7b2330f2c7928f8098ca6c78bd9533b918c5 From d70e9734966e542e0a0ed0f29eb5d128931f7b8f Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 16 May 2017 16:46:30 -0700 Subject: [PATCH 0522/1833] snmpd ignores unavailable disks (#607) --- dockers/docker-snmp-sv2/snmpd.conf.j2 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index fe3c5cadbb47..c5d299af05ef 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -57,7 +57,7 @@ sysServices 72 # # Process Monitoring # -# todo: should we enable snmp based monitoring of sswsyncd and other processes? +# TODO: should we enable snmp based monitoring of sswsyncd and other processes? # At least one 'sendmail' process, but no more than 10 #proc sendmail 10 1 @@ -72,7 +72,12 @@ sysServices 72 # 10MBs required on root disk, 5% free on /var, 10% free on all other disks disk / 10000 disk /var 5% -includeAllDisks 10% + +# Note: includeAllDisks will conflict with ignoredisk +# TODO: /root/* are introduced by aufs union mount, happening in initramfs stage. Clean them in the mount list. +ignoredisk /root/host +ignoredisk /root/dev +ignoredisk /root/dev/pts # Walk the UCD-SNMP-MIB::dskTable to see the resulting output # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file @@ -110,7 +115,7 @@ load 12 10 5 # Event MIB - automatically generate alerts # # Remember to activate the 'createUser' lines above -#iquerySecName internalUser +#iquerySecName internalUser #rouser internalUser # generate traps on UCD error conditions #defaultMonitors yes From 72b8284e579c0f20434440045b26760a57b4b72e Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 17 May 2017 13:02:17 -0700 Subject: [PATCH 0523/1833] Update sonic-utilities submodule; Add commands to sudoers as necessary (#608) --- files/image_config/sudoers/sudoers | 7 +++++++ src/sonic-utilities | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index df2f59803176..de62c7dd446b 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -18,7 +18,14 @@ Defaults env_keep += "VTYSH_PAGER" # Cmnd alias specification # Note: bcmcmd is dangerous for users in read only netgroups because it may operate ASIC Cmnd_Alias READ_ONLY_CMDS = /usr/bin/decode-syseeprom, \ + /usr/bin/docker images *, \ + /usr/bin/docker exec -it snmp cat /etc/snmp/snmpd.conf, \ + /usr/bin/docker exec -it bgp cat /etc/quagga/bgpd.conf, \ /usr/bin/generate_dump, \ + /usr/bin/lldpctl, \ + /usr/bin/lldpshow, \ + /usr/bin/sensors, \ + /usr/bin/sfputil, \ /usr/bin/vtysh -c show *, \ /bin/cat /var/log/syslog, \ /usr/bin/tail -f /var/log/syslog diff --git a/src/sonic-utilities b/src/sonic-utilities index f31087a030e6..70fd4fab6a47 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit f31087a030e685c6e1bcbdfa49d7a322c7f3d66a +Subproject commit 70fd4fab6a4745052f3b19b04de0588031b29b22 From 72412962926b8ad5c0cf6bb5e600bd0eb6722b80 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 17 May 2017 13:26:51 -0700 Subject: [PATCH 0524/1833] [Broadcom]: Update Broadcom SDK to 3.2.2.2-8 (#605) --- platform/broadcom/sdk.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 070613d64dc0..143d4e5e27c7 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-7-20170512003351.39_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-7-20170512003351.39_amd64.deb?sv=2015-04-05&sr=b&sig=YHETYSIxpB6LyTh2vhQ1TrGXommA2NiUdolk5QBJ0PE%3D&se=2031-01-19T01%3A40%3A27Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.2.2-8-20170515203732.42_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-8-20170515203732.42_amd64.deb?sv=2015-04-05&sr=b&sig=70Ae7gJ9tCEwOiOX4N%2BxJ65uc9W55KmatvW7Yyx2mr8%3D&se=2031-01-23T00%3A01%3A52Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-7-20170512003351.39_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-7-20170512003351.39_amd64.deb?sv=2015-04-05&sr=b&sig=33kv%2F2UogAuvHu3gPQ1rB7TVp9I%2Bjq%2FbmObzEZgfKD4%3D&se=2031-01-19T01%3A39%3A56Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-8-20170515203732.42_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-8-20170515203732.42_amd64.deb?sv=2015-04-05&sr=b&sig=K4emi7bcH6UGBukvJJFHo8lgCbK6omuBM16DK4yhRbo%3D&se=2031-01-23T00%3A02%3A19Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From 71e3ee8bf2a3965be7b104adc97dc40249dad0e2 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Thu, 18 May 2017 10:58:21 +0300 Subject: [PATCH 0525/1833] Fancontrol for AS7512 (#575) Signed-off-by: Nadiya.Stetskovych --- device/accton/x86_64-accton_as7512_32x-r0/fancontrol | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 device/accton/x86_64-accton_as7512_32x-r0/fancontrol diff --git a/device/accton/x86_64-accton_as7512_32x-r0/fancontrol b/device/accton/x86_64-accton_as7512_32x-r0/fancontrol new file mode 100644 index 000000000000..899d2db79228 --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/fancontrol @@ -0,0 +1,7 @@ +INTERVAL=10 +FCTEMPS=/sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/3-0048/hwmon/hwmon[[:print:]]*/temp1_input /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/3-0049/hwmon/hwmon[[:print:]]*/temp1_input /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/3-004a/hwmon/hwmon[[:print:]]*/temp1_input +FCFANS=/sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan1_front_speed_rpm /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan2_front_speed_rpm /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan3_front_speed_rpm /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan4_front_speed_rpm /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan5_front_speed_rpm /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan6_front_speed_rpm +MINTEMP=/sys/bus/i2c/devices/2-0066/fan_pwm=20 +MAXTEMP=/sys/bus/i2c/devices/2-0066/fan_pwm=60 +MINSTART=/sys/bus/i2c/devices/2-0066/fan_pwm=150 +MINSTOP=/sys/bus/i2c/devices/2-0066/fan_pwm=7 From a7fbd775c6aee4466668279267d20822723e2970 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Thu, 18 May 2017 10:59:54 +0300 Subject: [PATCH 0526/1833] [platform] Add as7512 sfp/eeprom utils (#531) * Cavm platfrom modules insmod on start Signed-off-by: Nadiya.Stetskovych * Add as77512 platform utils Signed-off-by: Nadiya.Stetskovych * Move platform related init to platform modules Signed-off-by: Nadiya.Stetskovych --- .../plugins/eeprom.py | 33 +++++++++++++++++++ .../plugins/sfputil.py | 25 ++++++++++++++ .../cavium/cavm_platform_modules/Makefile | 5 +++ .../as7512-platform-init.service | 13 ++++++++ 4 files changed, 76 insertions(+) create mode 100644 device/accton/x86_64-accton_as7512_32x-r0/plugins/eeprom.py create mode 100644 device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py create mode 100644 platform/cavium/cavm_platform_modules/as7512-platform-init.service diff --git a/device/accton/x86_64-accton_as7512_32x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7512_32x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..26990541231f --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/plugins/eeprom.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +############################################################################# +# Cavium +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..378a18c6b8bd --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py @@ -0,0 +1,25 @@ +#! /usr/bin/python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + + port_to_eeprom_mapping = {} + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' + for x in range(self.port_start, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + 18) + sfputilbase.__init__(self, port_num) diff --git a/platform/cavium/cavm_platform_modules/Makefile b/platform/cavium/cavm_platform_modules/Makefile index 515c1571abde..13ab41926e38 100644 --- a/platform/cavium/cavm_platform_modules/Makefile +++ b/platform/cavium/cavm_platform_modules/Makefile @@ -5,6 +5,7 @@ SHELL = /bin/bash MAIN_TARGET = cavm_platform_modules.deb DEB_BUILD_DIR = cavm-platform-modules-deb SCRIPT_SRC = $(DEB_BUILD_DIR)/ +SYSTEMD_DIR = /etc/systemd/system $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # get sources @@ -18,9 +19,13 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : popd mkdir -p $(DEB_BUILD_DIR)/lib/modules/$(KVERSION) mkdir -p $(DEB_BUILD_DIR)/usr/bin + mkdir -p $(DEB_BUILD_DIR)$(SYSTEMD_DIR)/multi-user.target.wants/ cp SONiC/AS7512-32X/module/*.ko $(DEB_BUILD_DIR)/lib/modules/$(KVERSION) cp SONiC/AS7512-32X/accton_as7512_util.py $(DEB_BUILD_DIR)/usr/bin + chmod +x $(DEB_BUILD_DIR)/usr/bin/accton_as7512_util.py + cp as7512-platform-init.service $(DEB_BUILD_DIR)$(SYSTEMD_DIR) + ln -s $(SYSTEMD_DIR)/as7512-platform-init.service $(DEB_BUILD_DIR)$(SYSTEMD_DIR)/multi-user.target.wants/as7512-platform-init.service cp -r DEBIAN $(DEB_BUILD_DIR) dpkg-deb -b $(DEB_BUILD_DIR) $(MAIN_TARGET) diff --git a/platform/cavium/cavm_platform_modules/as7512-platform-init.service b/platform/cavium/cavm_platform_modules/as7512-platform-init.service new file mode 100644 index 000000000000..69f03c0b2e45 --- /dev/null +++ b/platform/cavium/cavm_platform_modules/as7512-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Accton AS7512-32X Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/bin/accton_as7512_util.py install +ExecStop=/usr/bin/accton_as7512_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target From 8ebf0b0832316748e88340357ecad51f280335d5 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 18 May 2017 10:57:19 -0700 Subject: [PATCH 0527/1833] Add monit for disk>85% into pmon docker (#582) * Add monit for disk>85% into pmon docker * Revert "Add monit for disk>85% into pmon docker" This reverts commit 9cbbf591c08bce4b52a0f68cbbddae102d7fc614. * Install monit in base image --- build_debian.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index 014deec23dbf..eed63e6eb070 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -182,6 +182,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in python \ python-setuptools \ rsyslog \ + monit \ python-apt \ traceroute \ iputils-ping \ @@ -209,6 +210,27 @@ sudo cp -f files/sshd/sshd.service $FILESYSTEM_ROOT/lib/systemd/system/ssh.servi ## Config sshd sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTEM_ROOT +## Config monit +sudo sed -i ' + s/^# set logfile syslog/set logfile syslog/; + s/^\s*set logfile \/var/# set logfile \/var/; + s/^# set httpd port/set httpd port/; + s/^# use address localhost/ use address localhost/; + s/^# allow localhost/ allow localhost/; + s/^# allow admin:monit/ allow admin:monit/; + s/^# allow @monit/ allow @monit/; + s/^# allow @users readonly/ allow @users readonly/ + ' $FILESYSTEM_ROOT/etc/monit/monitrc + +sudo tee -a $FILESYSTEM_ROOT/etc/monit/monitrc > /dev/null <<'EOF' +check filesystem root-aufs with path / + if space usage > 90% for 5 times within 10 cycles then alert +check system $HOST + if memory usage > 90% for 5 times within 10 cycles then alert + if cpu usage (user) > 90% for 5 times within 10 cycles then alert + if cpu usage (system) > 90% for 5 times within 10 cycles then alert +EOF + ## Config sysctl sudo mkdir -p $FILESYSTEM_ROOT/var/core sudo augtool --autosave " From fb4cd63ac580ec9cfef701d5d81ea53e5e9fb985 Mon Sep 17 00:00:00 2001 From: wadelnn Date: Fri, 19 May 2017 02:05:49 +0800 Subject: [PATCH 0528/1833] [Ingrasys] Add Ingrasys S8900 series platform (#569) * Add Ingrasys S8900 series platform * Add Ingrasys S8900-54XC platform driver * Add Ingrasys S8900-64XC platform driver * Reorganized Ingrasys debian package * Move fancontrol config to device-specific file directory * QSFP transceivers init on S9100-32X * Update Thermal Policy in sensors.conf * Add new Ingrasys S8900 series platform for docker-orchagent/orchagent.sh Signed-off-by: Wade He --- .gitmodules | 7 +- .../INGRASYS-S8900-54XC/port_config.ini | 55 +++ .../INGRASYS-S8900-54XC/sai.profile | 1 + .../x86_64-ingrasys_s8900_54xc-r0/fancontrol | 12 + .../installer.conf | 3 + .../minigraph.xml | 121 ++++++ .../plugins/eeprom.py | 23 ++ .../plugins/sfputil.py | 82 ++++ .../sensors.conf | 39 ++ .../INGRASYS-S8900-64XC/port_config.ini | 65 ++++ .../INGRASYS-S8900-64XC/sai.profile | 1 + .../x86_64-ingrasys_s8900_64xc-r0/fancontrol | 11 + .../installer.conf | 3 + .../minigraph.xml | 359 ++++++++++++++++++ .../plugins/eeprom.py | 23 ++ .../plugins/sfputil.py | 107 ++++++ .../sensors.conf | 56 +++ .../INGRASYS-S9100-C32/port_config.ini | 64 ++-- .../x86_64-ingrasys_s9100-r0/fancontrol | 12 + .../x86_64-ingrasys_s9100-r0/sensors.conf | 4 + dockers/docker-orchagent/orchagent.sh | 4 + platform/broadcom/one-image.mk | 2 + .../platform-modules-ingrasys-s9100.mk | 11 - .../broadcom/platform-modules-ingrasys.mk | 24 ++ platform/broadcom/rules.mk | 2 +- .../broadcom/sonic-platform-modules-ingrasys | 1 + .../sonic-platform-modules-ingrasys-s9100 | 1 - 27 files changed, 1044 insertions(+), 49 deletions(-) create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/sai.profile create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/installer.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/eeprom.py create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/sensors.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/sai.profile create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/installer.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/eeprom.py create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/sensors.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol delete mode 100755 platform/broadcom/platform-modules-ingrasys-s9100.mk create mode 100644 platform/broadcom/platform-modules-ingrasys.mk create mode 160000 platform/broadcom/sonic-platform-modules-ingrasys delete mode 160000 platform/broadcom/sonic-platform-modules-ingrasys-s9100 diff --git a/.gitmodules b/.gitmodules index 131b4634b514..c35e478ae43f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -53,11 +53,10 @@ [submodule "platform/broadcom/sonic-platform-modules-dell"] path = platform/broadcom/sonic-platform-modules-dell url = https://github.com/Azure/sonic-platform-modules-dell -[submodule "platform/broadcom/sonic-platform-modules-ingrasys-s9100"] - path = platform/broadcom/sonic-platform-modules-ingrasys-s9100 - url = https://github.com/Ingrasys-sonic/sonic-platform-ingrasys-s9100 +[submodule "platform/broadcom/sonic-platform-modules-ingrasys"] + path = platform/broadcom/sonic-platform-modules-ingrasys + url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys [submodule "src/SAI"] path = src/SAI url = https://github.com/opencomputeproject/SAI branch = v0.9.4 - diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini new file mode 100644 index 000000000000..24a2b8e29222 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini @@ -0,0 +1,55 @@ +# name lanes alias +Ethernet0 1 +Ethernet1 2 +Ethernet2 3 +Ethernet3 4 +Ethernet4 5 +Ethernet5 6 +Ethernet6 7 +Ethernet7 8 +Ethernet8 9 +Ethernet9 10 +Ethernet10 11 +Ethernet11 12 +Ethernet12 21 +Ethernet13 22 +Ethernet14 23 +Ethernet15 24 +Ethernet16 33 +Ethernet17 34 +Ethernet18 35 +Ethernet19 36 +Ethernet20 37 +Ethernet21 38 +Ethernet22 39 +Ethernet23 40 +Ethernet24 41 +Ethernet25 42 +Ethernet26 43 +Ethernet27 44 +Ethernet28 49 +Ethernet29 50 +Ethernet30 51 +Ethernet31 52 +Ethernet32 53 +Ethernet33 54 +Ethernet34 55 +Ethernet35 56 +Ethernet36 65 +Ethernet37 66 +Ethernet38 67 +Ethernet39 68 +Ethernet40 69 +Ethernet41 70 +Ethernet42 71 +Ethernet43 72 +Ethernet44 81 +Ethernet45 82 +Ethernet46 83 +Ethernet47 84 +Ethernet48 85,86,87,88 +Ethernet52 97,98,99,100 +Ethernet56 101,102,103,104 +Ethernet60 105,106,107,108 +Ethernet64 109,110,111,112 +Ethernet68 117,118,119,120 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/sai.profile b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/sai.profile new file mode 100644 index 000000000000..6f07b4605cbf --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-s8900-48x25G+6x100G.config.bcm diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol new file mode 100644 index 000000000000..05a71e8d999c --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon2=w83795adg +FCTEMPS=hwmon2/device/pwm2=hwmon2/device/temp2_input hwmon2/device/pwm1=hwmon2/device/temp2_input +#FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input+hwmon2/device/fan7_input+hwmon2/device/fan6_input+hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input+hwmon2/device/fan3_input+hwmon2/device/fan2_input+hwmon2/device/fan1_input +FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input +MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 +MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 +MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 +MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 + diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml new file mode 100644 index 000000000000..470b07922b9d --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml @@ -0,0 +1,121 @@ + + + + + + OCPSCH0104001MS + 10.10.1.30 + OCPSCH01040HHLF + 10.10.1.29 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.30 + OCPSCH01040HHLF + 10.10.2.29 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040HHLF + + +
10.10.1.30
+ + +
+ +
10.10.2.30
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.10/32 + + 100.0.0.10/32 + + + + + + + + OCPSCH01040HHLF + + + + + + Ethernet48 + 10.10.1.29/30 + + + + Ethernet52 + 10.10.2.29/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet48 + OCPSCH01040HHLF + Ethernet48 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet0 + OCPSCH01040HHLF + Ethernet52 + + + + + OCPSCH01040HHLF + INGRASYS-S8900-54XC + + + + OCPSCH01040HHLF + INGRASYS-S8900-54XC +
diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/eeprom.py new file mode 100644 index 000000000000..2013aeddddb4 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/eeprom.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +############################################################################# +# Dell Z9100 +# +# 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-17/17-0054/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py new file mode 100644 index 000000000000..96fa0fca86ce --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 53 + ports_in_block = 54 + + port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: 18, + 1: 19, + 2: 20, + 3: 21, + 4: 22, + 5: 23, + 6: 24, + 7: 25, + 8: 26, + 9: 27, + 10: 28, + 11: 29, + 12: 30, + 13: 31, + 14: 32, + 15: 33, + 16: 34, + 17: 35, + 18: 36, + 19: 37, + 20: 38, + 21: 39, + 22: 40, + 23: 41, + 24: 42, + 25: 43, + 26: 44, + 27: 45, + 28: 46, + 29: 47, + 30: 48, + 31: 49, + 32: 50, + 33: 51, + 34: 52, + 35: 53, + 36: 54, + 37: 55, + 38: 56, + 39: 57, + 40: 58, + 41: 59, + 42: 60, + 43: 61, + 44: 62, + 45: 63, + 46: 64, + 47: 65, + 48: 66, + 49: 67, + 50: 68, + 51: 69, + 52: 70, + 53: 71 + } + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(self.port_start, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + sfputilbase.__init__(self, port_num) diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/sensors.conf new file mode 100644 index 000000000000..88a474a06742 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/sensors.conf @@ -0,0 +1,39 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + label temp1 "DIMM Temp" + set temp1_max 50 + set temp1_crit 85 + +chip "w83795adg-*" + label in0 "1.0V" + label in1 "1.0V_ROV" + label in2 "1.25V" + label in3 "1.8V" + ignore in4 + ignore in5 + ignore in6 + ignore in7 + label in12 "+3.3V" + ignore in14 + ignore in15 + ignore in16 + label fan1 "FANTRAY 1-A" + label fan2 "FANTRAY 1-B" + label fan3 "FANTRAY 2-A" + label fan4 "FANTRAY 2-B" + label fan5 "FANTRAY 3-A" + label fan6 "FANTRAY 3-B" + label fan7 "FANTRAY 4-A" + label fan8 "FANTRAY 4-B" + label temp1 "Front MAC Temp" + set temp1_max 70 + set temp1_crit 80 + label temp2 "Rear MAC Temp" + set temp1_max 70 + set temp1_crit 80 + ignore temp3 + ignore temp4 + ignore intrusion0 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini new file mode 100644 index 000000000000..3e5c7be570e1 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias +Ethernet0 17 +Ethernet1 18 +Ethernet2 19 +Ethernet3 20 +Ethernet4 24 +Ethernet5 23 +Ethernet6 22 +Ethernet7 21 +Ethernet8 28 +Ethernet9 27 +Ethernet10 26 +Ethernet11 25 +Ethernet12 32 +Ethernet13 31 +Ethernet14 30 +Ethernet15 29 +Ethernet16 1 +Ethernet17 2 +Ethernet18 3 +Ethernet19 4 +Ethernet20 8 +Ethernet21 7 +Ethernet22 6 +Ethernet23 5 +Ethernet24 12 +Ethernet25 11 +Ethernet26 10 +Ethernet27 9 +Ethernet28 13 +Ethernet29 14 +Ethernet30 15 +Ethernet31 16 +Ethernet32 33 +Ethernet33 34 +Ethernet34 35 +Ethernet35 36 +Ethernet36 38 +Ethernet37 39 +Ethernet38 40 +Ethernet39 37 +Ethernet40 41 +Ethernet41 42 +Ethernet42 43 +Ethernet43 44 +Ethernet44 48 +Ethernet45 45 +Ethernet46 46 +Ethernet47 47 +Ethernet48 49,50,51,52 +Ethernet52 53,54,55,56 +Ethernet56 57,58,59,60 +Ethernet60 61,62,63,64 +Ethernet64 65,66,67,68 +Ethernet68 69,70,71,72 +Ethernet72 73,74,75,76 +Ethernet76 77,78,79,80 +Ethernet80 81,82,83,84 +Ethernet84 85,86,87,88 +Ethernet88 89,90,91,92 +Ethernet92 93,94,95,96 +Ethernet96 97,98,99,100 +Ethernet100 101,102,103,104 +Ethernet104 105,106,107,108 +Ethernet108 109,110,111,112 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/sai.profile b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/sai.profile new file mode 100644 index 000000000000..f617b8f3c473 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-s8900-48x25G+16x100G.config.bcm diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol new file mode 100644 index 000000000000..938440304540 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol @@ -0,0 +1,11 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm1=hwmon1/device/temp2_input hwmon1/device/pwm2=hwmon1/device/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan10_input hwmon1/device/pwm2=hwmon1/device/fan9_input hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +MINTEMP=hwmon1/device/pwm1=20 hwmon1/device/pwm2=20 +MAXTEMP=hwmon1/device/pwm1=60 hwmon1/device/pwm2=60 +MINSTART=hwmon1/device/pwm1=150 hwmon1/device/pwm2=150 +MINSTOP=hwmon1/device/pwm1=0 hwmon1/device/pwm2=0 + diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml new file mode 100644 index 000000000000..fe96dc87acf6 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml @@ -0,0 +1,359 @@ + + + + + + BGPSession + OCPSCH0104001MS + 10.10.1.2 + OCPSCH01040AALF + 10.10.1.1 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.6 + OCPSCH01040BBLF + 10.10.1.5 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.10 + OCPSCH01040CCLF + 10.10.1.9 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.14 + OCPSCH01040DDLF + 10.10.1.13 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.18 + OCPSCH01040EELF + 10.10.1.17 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.22 + OCPSCH01040FFLF + 10.10.1.21 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.30 + OCPSCH01040HHLF + 10.10.1.29 + 1 + 10 + 3 + + + + + 64542 + OCPSCH0104001MS + + + BGPPeer +
10.10.1.2
+ + +
+ + BGPPeer +
10.10.1.6
+ + +
+ + BGPPeer +
10.10.1.10
+ + +
+ + BGPPeer +
10.10.1.14
+ + +
+ + BGPPeer +
10.10.1.18
+ + +
+ + BGPPeer +
10.10.1.22
+ + +
+ + BGPPeer +
10.10.1.26
+ + +
+ + BGPPeer +
10.10.1.30
+ + +
+
+ +
+ + 64536 + OCPSCH01040AALF + + + + 64536 + OCPSCH01040BBLF + + + + 64536 + OCPSCH01040CCLF + + + + 64536 + OCPSCH01040DDLF + + + + 64536 + OCPSCH01040EELF + + + + 64536 + OCPSCH01040FFLF + + + + 64536 + OCPSCH01040GGLF + + + + 64536 + OCPSCH01040HHLF + + +
+
+ + + + + + LoopbackInterface + HostIP + Loopback0 + + 100.0.0.1/32 + + 100.0.0.1/32 + + + + + + + + OCPSCH0104001MS + + + + VlanInterface + Vlan851 + Ethernet0;Ethernet1;Ethernet2;Ethernet3;Ethernet96;Ethernet100;Ethernet104;Ethernet108 + False + 0.0.0.0/0 + + 851 + 10.20.1.0/24 + + + + + IPInterface + + Vlan851 + 10.20.1.1/24 + + + IPInterface + + Ethernet48 + 10.10.1.2/30 + + + IPInterface + + Ethernet52 + 10.10.1.6/30 + + + IPInterface + + Ethernet56 + 10.10.1.10/30 + + + IPInterface + + Ethernet60 + 10.10.1.14/30 + + + IPInterface + + Ethernet64 + 10.10.1.18/30 + + + IPInterface + + Ethernet68 + 10.10.1.22/30 + + + IPInterface + + Ethernet72 + 10.10.1.26/30 + + + IPInterface + + Ethernet76 + 10.10.1.30/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet48 + OCPSCH01040AALF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet52 + OCPSCH01040BBLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet56 + OCPSCH01040CCLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet60 + OCPSCH01040DDLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet64 + OCPSCH01040EELF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet68 + OCPSCH01040FFLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet72 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet76 + OCPSCH01040HHLF + Ethernet48 + + + + + OCPSCH0104001MS + INGRASYS-S8900-64XC + + + + + + + + OCPSCH0104001MS + INGRASYS-S8900-64XC +
diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/eeprom.py new file mode 100644 index 000000000000..c23edf5e772e --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/eeprom.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S8900-64XC +# +# 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-7/7-0054/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py new file mode 100644 index 000000000000..d6573d20d72f --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python + +import subprocess + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +i2c_set = 'i2cset' +cpld_addr = '0x33' +mux_reg = '0x4A' + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 63 + ports_in_block = 64 + + port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: [2,1], + 1: [2,2], + 2: [2,3], + 3: [2,4], + 4: [2,5], + 5: [2,6], + 6: [2,7], + 7: [2,8], + 8: [2,9], + 9: [2,10], + 10: [2,11], + 11: [2,12], + 12: [2,13], + 13: [2,14], + 14: [2,15], + 15: [2,16], + 16: [2,17], + 17: [2,18], + 18: [2,19], + 19: [2,20], + 20: [2,21], + 21: [2,22], + 22: [2,23], + 23: [2,24], + 24: [3,1], + 25: [3,2], + 26: [3,3], + 27: [3,4], + 28: [3,5], + 29: [3,6], + 30: [3,7], + 31: [3,8], + 32: [3,9], + 33: [3,10], + 34: [3,11], + 35: [3,12], + 36: [3,13], + 37: [3,14], + 38: [3,15], + 39: [3,16], + 40: [3,17], + 41: [3,18], + 42: [3,19], + 43: [3,20], + 44: [3,21], + 45: [3,22], + 46: [3,23], + 47: [3,24], + 48: [4,1], + 49: [4,2], + 50: [4,3], + 51: [4,4], + 52: [4,5], + 53: [4,6], + 54: [4,7], + 55: [4,8], + 56: [4,9], + 57: [4,10], + 58: [4,11], + 59: [4,12], + 60: [4,13], + 61: [4,14], + 62: [4,15], + 63: [4,16] + } + + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + i2c_bus = self.port_to_i2c_mapping[port_num][0] + sfp_idx = self.port_to_i2c_mapping[port_num][1] + proc = subprocess.Popen([i2c_set, '-y', str(i2c_bus), cpld_addr, mux_reg, str(sfp_idx)], + stdout=subprocess.PIPE, + shell=False, + stderr=subprocess.STDOUT) + stdout = proc.communicate()[0] + proc.wait() + + eeprom_path = '/sys/class/i2c-adapter/i2c-{0[0]}/{0[0]}-0050/eeprom' + for x in range(self.port_start, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + sfputilbase.__init__(self, port_num) diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/sensors.conf new file mode 100644 index 000000000000..d4b5a7bd0c8a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/sensors.conf @@ -0,0 +1,56 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + label temp1 "DIMM Temp" + set temp1_max 50 + set temp1_crit 85 + +chip "w83795adg-*" + label in0 "1.0V" + label in1 "1.0V_ROV" + label in2 "1.25V" + label in3 "1.8V" + ignore in4 + ignore in5 + ignore in6 + ignore in7 + label in12 "+3.3V" + ignore in14 + ignore in15 + ignore in16 + label fan1 "FANTRAY 1-A" + label fan2 "FANTRAY 1-B" + label fan3 "FANTRAY 2-A" + label fan4 "FANTRAY 2-B" + label fan5 "FANTRAY 3-A" + label fan6 "FANTRAY 3-B" + label fan7 "FANTRAY 4-A" + label fan8 "FANTRAY 4-B" + label fan9 "FANTRAY 5-A" + label fan10 "FANTRAY 5-B" + label temp1 "Front MAC Temp" + set temp1_max 60 + set temp1_crit 65 + label temp2 "Rear MAC Temp" + set temp2_max 60 + set temp2_crit 65 + label temp3 "Near Port 15" + set temp3_max 50 + set temp3_crit 70 + label temp4 "Near Port 56" + set temp4_max 50 + set temp4_crit 70 + ignore intrusion0 + +bus "i2c-5" "i2c-1-switch (chan_id 3)" +chip "tmp75-i2c-*-48" + label temp1 "FAN Temp1" + set temp1_max 50 + set temp1_crit 70 +chip "tmp75-i2c-*-49" + label temp1 "FAN Temp2" + set temp1_max 50 + set temp1_crit 70 + diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini index d2b36ebf5e2a..d70c717fe4e2 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini @@ -1,33 +1,33 @@ # name lanes alias -Ethernet0 5,6,7,8 Ethernet0 -Ethernet4 1,2,3,4 Ethernet4 -Ethernet8 13,14,15,16 Ethernet8 -Ethernet12 9,10,11,12 Ethernet12 -Ethernet16 21,22,23,24 Ethernet16 -Ethernet20 17,18,19,20 Ethernet20 -Ethernet24 29,30,31,32 Ethernet24 -Ethernet28 25,26,27,28 Ethernet28 -Ethernet32 37,38,39,40 Ethernet32 -Ethernet36 33,34,35,36 Ethernet36 -Ethernet40 45,46,47,48 Ethernet40 -Ethernet44 41,42,43,44 Ethernet44 -Ethernet48 53,54,55,56 Ethernet48 -Ethernet52 49,50,51,52 Ethernet52 -Ethernet56 61,62,63,64 Ethernet56 -Ethernet60 57,58,59,60 Ethernet60 -Ethernet64 69,70,71,72 Ethernet64 -Ethernet68 65,66,67,68 Ethernet68 -Ethernet72 77,78,79,80 Ethernet72 -Ethernet76 73,74,75,76 Ethernet76 -Ethernet80 85,86,87,88 Ethernet80 -Ethernet84 81,82,83,84 Ethernet84 -Ethernet88 93,94,95,96 Ethernet88 -Ethernet92 89,90,91,92 Ethernet92 -Ethernet96 101,102,103,104 Ethernet96 -Ethernet100 97,98,99,100 Ethernet100 -Ethernet104 109,110,111,112 Ethernet104 -Ethernet108 105,106,107,108 Ethernet108 -Ethernet112 117,118,119,120 Ethernet112 -Ethernet116 113,114,115,116 Ethernet116 -Ethernet120 125,126,127,128 Ethernet120 -Ethernet124 121,122,123,124 Ethernet124 +Ethernet0 5,6,7,8 +Ethernet4 1,2,3,4 +Ethernet8 13,14,15,16 +Ethernet12 9,10,11,12 +Ethernet16 21,22,23,24 +Ethernet20 17,18,19,20 +Ethernet24 29,30,31,32 +Ethernet28 25,26,27,28 +Ethernet32 37,38,39,40 +Ethernet36 33,34,35,36 +Ethernet40 45,46,47,48 +Ethernet44 41,42,43,44 +Ethernet48 53,54,55,56 +Ethernet52 49,50,51,52 +Ethernet56 61,62,63,64 +Ethernet60 57,58,59,60 +Ethernet64 69,70,71,72 +Ethernet68 65,66,67,68 +Ethernet72 77,78,79,80 +Ethernet76 73,74,75,76 +Ethernet80 85,86,87,88 +Ethernet84 81,82,83,84 +Ethernet88 93,94,95,96 +Ethernet92 89,90,91,92 +Ethernet96 101,102,103,104 +Ethernet100 97,98,99,100 +Ethernet104 109,110,111,112 +Ethernet108 105,106,107,108 +Ethernet112 117,118,119,120 +Ethernet116 113,114,115,116 +Ethernet120 125,126,127,128 +Ethernet124 121,122,123,124 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol new file mode 100644 index 000000000000..05a71e8d999c --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon2=w83795adg +FCTEMPS=hwmon2/device/pwm2=hwmon2/device/temp2_input hwmon2/device/pwm1=hwmon2/device/temp2_input +#FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input+hwmon2/device/fan7_input+hwmon2/device/fan6_input+hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input+hwmon2/device/fan3_input+hwmon2/device/fan2_input+hwmon2/device/fan1_input +FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input +MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 +MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 +MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 +MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 + diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf index 44eedb4b11b0..c55f5c764e65 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf @@ -29,7 +29,11 @@ chip "w83795adg-*" label fan7 "FANTRAY 4-A" label fan8 "FANTRAY 4-B" label temp1 "Front MAC Temp" + set temp1_max 70 + set temp1_crit 80 label temp2 "Rear MAC Temp" + set temp2_max 70 + set temp2_crit 80 ignore temp3 ignore temp4 ignore intrusion0 diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 15eb2c7e17ac..a9330826d5e6 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -22,6 +22,10 @@ elif [ "$HWSKU" == "AS7512" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "INGRASYS-S9100-C32" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "INGRASYS-S8900-54XC" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "INGRASYS-S8900-64XC" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" fi exec /usr/bin/orchagent ${ORCHAGENT_ARGS} diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index e7e20a9eb7f3..3af81b325d77 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -7,6 +7,8 @@ $(SONIC_ONE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) $(SONIC_ONE_IMAGE)_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(DELL_Z9100_PLATFORM_MODULE) \ $(DELL_S6100_PLATFORM_MODULE) \ + $(INGRASYS_S8900_54XC_PLATFORM_MODULE) \ + $(INGRASYS_S8900_64XC_PLATFORM_MODULE) \ $(INGRASYS_S9100_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-ingrasys-s9100.mk b/platform/broadcom/platform-modules-ingrasys-s9100.mk deleted file mode 100755 index 7c7df7b1cf61..000000000000 --- a/platform/broadcom/platform-modules-ingrasys-s9100.mk +++ /dev/null @@ -1,11 +0,0 @@ -# Ingrasys S9100 Platform modules - -INGRASYS_S9100_PLATFORM_MODULE_VERSION = 1.0.0 - -export INGRASYS_S9100_PLATFORM_MODULE_VERSION - -INGRASYS_S9100_PLATFORM_MODULE = sonic-platform-ingrasys-s9100_$(INGRASYS_S9100_PLATFORM_MODULE_VERSION)_amd64.deb -$(INGRASYS_S9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys-s9100 -$(INGRASYS_S9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -$(INGRASYS_S9100_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9100-r0 -SONIC_DPKG_DEBS += $(INGRASYS_S9100_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-ingrasys.mk b/platform/broadcom/platform-modules-ingrasys.mk new file mode 100644 index 000000000000..95009102dd76 --- /dev/null +++ b/platform/broadcom/platform-modules-ingrasys.mk @@ -0,0 +1,24 @@ +# Ingrasys S9100, S8900-64XC and S8900-54XC Platform modules + +INGRASYS_S9100_PLATFORM_MODULE_VERSION = 1.1.0 +INGRASYS_S8900_64XC_PLATFORM_MODULE_VERSION = 1.1.0 +INGRASYS_S8900_54XC_PLATFORM_MODULE_VERSION = 1.1.0 + +export INGRASYS_S9100_PLATFORM_MODULE_VERSION +export INGRASYS_S8900_64XC_PLATFORM_MODULE_VERSION +export INGRASYS_S8900_54XC_PLATFORM_MODULE_VERSION + +INGRASYS_S9100_PLATFORM_MODULE = sonic-platform-ingrasys-s9100_$(INGRASYS_S9100_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys +$(INGRASYS_S9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(INGRASYS_S9100_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9100-r0 +SONIC_DPKG_DEBS += $(INGRASYS_S9100_PLATFORM_MODULE) + +INGRASYS_S8900_64XC_PLATFORM_MODULE = sonic-platform-ingrasys-s8900-64xc_$(INGRASYS_S8900_64XC_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S8900_64XC_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s8900_64xc-r0 + +INGRASYS_S8900_54XC_PLATFORM_MODULE = sonic-platform-ingrasys-s8900-54xc_$(INGRASYS_S8900_54XC_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S8900_54XC_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s8900_54xc-r0 + +$(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8900_64XC_PLATFORM_MODULE))) +$(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8900_54XC_PLATFORM_MODULE))) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index d2eb4482e96d..7f55ccd034d3 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -3,7 +3,7 @@ include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-s6000.mk include $(PLATFORM_PATH)/platform-modules-dell.mk include $(PLATFORM_PATH)/platform-modules-arista.mk -include $(PLATFORM_PATH)/platform-modules-ingrasys-s9100.mk +include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys new file mode 160000 index 000000000000..46f1b3303fec --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -0,0 +1 @@ +Subproject commit 46f1b3303fecf728b66b88941fa162e91520cc32 diff --git a/platform/broadcom/sonic-platform-modules-ingrasys-s9100 b/platform/broadcom/sonic-platform-modules-ingrasys-s9100 deleted file mode 160000 index 83d62823d26a..000000000000 --- a/platform/broadcom/sonic-platform-modules-ingrasys-s9100 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 83d62823d26a6b572bbe11272d00775f8123c199 From 14fe4bf6f8405b996807637e0640ba29ed254b61 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 18 May 2017 14:45:04 -0700 Subject: [PATCH 0529/1833] Update sonic-snmpagent (#610) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 74e57b8381a9..e8e1e70e6c30 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 74e57b8381a92c64eaa0455dcd7b222af337a0f9 +Subproject commit e8e1e70e6c30eee72cade87273d3ceed59bd0c8d From aab87757d38ad2e7f2c86761f84f8f5c610ed4bd Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 18 May 2017 14:45:16 -0700 Subject: [PATCH 0530/1833] Remove sysctl setting which is not used anymore (#611) --- platform/broadcom/docker-syncd-brcm-rpc/99-syncd.conf | 2 -- platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 | 1 - platform/cavium/docker-syncd-cavm-rpc/99-syncd.conf | 2 -- platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 | 1 - platform/centec/docker-syncd-centec-rpc/99-syncd.conf | 2 -- platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 | 1 - platform/mellanox/docker-syncd-mlnx-rpc/99-syncd.conf | 2 -- platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 | 1 - 8 files changed, 12 deletions(-) delete mode 100644 platform/broadcom/docker-syncd-brcm-rpc/99-syncd.conf delete mode 100644 platform/cavium/docker-syncd-cavm-rpc/99-syncd.conf delete mode 100644 platform/centec/docker-syncd-centec-rpc/99-syncd.conf delete mode 100644 platform/mellanox/docker-syncd-mlnx-rpc/99-syncd.conf diff --git a/platform/broadcom/docker-syncd-brcm-rpc/99-syncd.conf b/platform/broadcom/docker-syncd-brcm-rpc/99-syncd.conf deleted file mode 100644 index f3b57e3b1964..000000000000 --- a/platform/broadcom/docker-syncd-brcm-rpc/99-syncd.conf +++ /dev/null @@ -1,2 +0,0 @@ -sysctl -w net.core.rmem_max=509430500 - diff --git a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 index 4799d7a5ab31..ebe3dda1c14d 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 @@ -47,7 +47,6 @@ RUN apt-get update \ && rm -rf /root/deps COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -COPY ["99-syncd.conf", "/etc/sysctl.d/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/cavium/docker-syncd-cavm-rpc/99-syncd.conf b/platform/cavium/docker-syncd-cavm-rpc/99-syncd.conf deleted file mode 100644 index f3b57e3b1964..000000000000 --- a/platform/cavium/docker-syncd-cavm-rpc/99-syncd.conf +++ /dev/null @@ -1,2 +0,0 @@ -sysctl -w net.core.rmem_max=509430500 - diff --git a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 index 0de427c22a27..0c70dcd8e845 100644 --- a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 @@ -47,6 +47,5 @@ RUN apt-get update \ && rm -rf /root/deps COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -COPY ["99-syncd.conf", "/etc/sysctl.d/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/centec/docker-syncd-centec-rpc/99-syncd.conf b/platform/centec/docker-syncd-centec-rpc/99-syncd.conf deleted file mode 100644 index f3b57e3b1964..000000000000 --- a/platform/centec/docker-syncd-centec-rpc/99-syncd.conf +++ /dev/null @@ -1,2 +0,0 @@ -sysctl -w net.core.rmem_max=509430500 - diff --git a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 index 13a2c92cecee..ac402d1f6eae 100644 --- a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 @@ -47,7 +47,6 @@ RUN apt-get update \ && rm -rf /root/deps COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -COPY ["99-syncd.conf", "/etc/sysctl.d/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/99-syncd.conf b/platform/mellanox/docker-syncd-mlnx-rpc/99-syncd.conf deleted file mode 100644 index f3b57e3b1964..000000000000 --- a/platform/mellanox/docker-syncd-mlnx-rpc/99-syncd.conf +++ /dev/null @@ -1,2 +0,0 @@ -sysctl -w net.core.rmem_max=509430500 - diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 51fb26c00b11..66eab2013ba6 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -47,7 +47,6 @@ RUN apt-get update \ && rm -rf /root/deps COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -COPY ["99-syncd.conf", "/etc/sysctl.d/"] ENTRYPOINT ["/usr/bin/supervisord"] From 6c24574e9f4fbf5b87d67660616894af7ef1c8aa Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 18 May 2017 16:54:48 -0700 Subject: [PATCH 0531/1833] [mgmt]: add sonic-mgmt docker for running test in sonic-mgmt repo (#606) * [mgmt]: add sonic-mgmt docker for running test in sonic-mgmt repo --- Makefile | 19 +++++++++- sonic-mgmt/Dockerfile | 70 ++++++++++++++++++++++++++++++++++++ sonic-mgmt/sonic-jenkins.pub | 1 + 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 sonic-mgmt/Dockerfile create mode 100644 sonic-mgmt/sonic-jenkins.pub diff --git a/Makefile b/Makefile index 3e2480891b34..116c751f228c 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,21 @@ DOCKER_BUILD = docker build --no-cache \ sonic-slave && \ docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG) -.PHONY: sonic-slave-build sonic-slave-bash + +MGMT_TAG = $(shell shasum sonic-mgmt/Dockerfile | awk '{print substr($$1,0,11);}') +MGMT_IMAGE = sonic-mgmt-$(USER) + +DOCKER_MGMT_BUILD = docker build --no-cache \ + --build-arg user=$(USER) \ + --build-arg uid=$(shell id -u) \ + --build-arg guid=$(shell id -g) \ + --build-arg hostname=$(shell echo $$HOSTNAME) \ + -t $(MGMT_IMAGE) \ + sonic-mgmt && \ + docker tag $(MGMT_IMAGE):latest $(MGMT_IMAGE):$(MGMT_TAG) + + +.PHONY: sonic-slave-build sonic-slave-bash sonic-mgmt-build .DEFAULT_GOAL := all @@ -51,3 +65,6 @@ sonic-slave-bash : { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash + +sonic-mgmt-build : + @$(DOCKER_MGMT_BUILD) diff --git a/sonic-mgmt/Dockerfile b/sonic-mgmt/Dockerfile new file mode 100644 index 000000000000..5a64e1ec35b1 --- /dev/null +++ b/sonic-mgmt/Dockerfile @@ -0,0 +1,70 @@ +FROM ubuntu:16.04 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update +RUN apt-get install -y \ + openssh-server \ + gcc \ + vim \ + make \ + git \ + sudo \ + python \ + python-dev \ + python-cffi \ + libffi-dev \ + libssl-dev \ + sshpass \ + libxml2 \ + libxslt1-dev \ + python-setuptools + +# For JNLP launcher +RUN apt-get install -y default-jre + +# For syslog test +RUN apt-get install -y rsyslog psmisc + +RUN easy_install pip + +RUN pip install ipaddr \ + lxml \ + netaddr \ + natsort \ + six \ + pexpect \ + pyasn1==0.1.9 \ + pysnmp==4.2.5 + +RUN git clone https://github.com/ansible/ansible +RUN cd ansible && git checkout v2.0.0.2-1 -b v2.0.0.2-1 && git submodule update --init --recursive && make && make install + +RUN mkdir /var/run/sshd +EXPOSE 22 + +# Add user +ARG user +ARG uid +ARG guid +ARG hostname + +ENV BUILD_HOSTNAME $hostname +ENV USER $user + +RUN groupadd -f -r -g $guid g$user + +RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash + +COPY sonic-jenkins.pub /var/$user/.ssh/authorized_keys2 + +RUN echo "Host *\n\tStrictHostKeyChecking no\n" > /var/$user/.ssh/config +RUN chown $user /var/$user/.ssh -R +RUN chmod go= /var/$user/.ssh -R + +# Add user to sudoers +RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers + +USER $user + +RUN cd /var/$user && git clone https://github.com/Azure/sonic-mgmt diff --git a/sonic-mgmt/sonic-jenkins.pub b/sonic-mgmt/sonic-jenkins.pub new file mode 100644 index 000000000000..8cbd97ce8c57 --- /dev/null +++ b/sonic-mgmt/sonic-jenkins.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEJhhzQtlgNkBWxWXNm/qxZC26pFC16uOdGMx7BfMP9KxpKB46sFO5nkZXh8CiyjHitks2BYjbrK2IYubiyQhHaKh+4mnCnO58GLRRAiCUzeaC1jSrmqseBN8ZN7UV7gZUWQOxHErUHVhTbujUR0eZLymwPV0bNO9/bAWR5a+l5l/kf3VMREHF5Z6KyIuA9fT9XUJz8wLEUZCC8Id9RGwmKHS4FYuwtvcYm1MKb+ULXlri5o25G/X3I1pBpU/xUPBDUu+g3cIavrl7wVVGbIXYcYoH5qrTycMY0Y3rLBxu9SECUCqIxhnKQsiv+iXZSibnUXT4r6HcLMej5e+o1Jx3 lgh@jenkins-master-phx From e87fe90d91e22dc9471cea46c2667a9546dab930 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 18 May 2017 18:15:36 -0700 Subject: [PATCH 0532/1833] [Broadcom]: Update bcmcmd and dsserve binaries (#613) --- platform/broadcom/rules.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 7f55ccd034d3..fff132c1c508 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -13,10 +13,10 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk BCMCMD = bcmcmd -$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmcmd?sv=2015-04-05&sr=b&sig=X3bFApmsNFmcnWM9mSGRxBugPcg%2FgJCHh5hhSuV1M2c%3D&se=2030-08-23T14%3A41%3A56Z&sp=r" +$(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" DSSERVE = dsserve -$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv=2015-04-05&sr=b&sig=aMlnRA%2FXZNmHPgmOj%2FNMJMYLWyvva1QrN4HcsVXvqKA%3D&se=2030-08-23T14%3A42%3A32Z&sp=r" +$(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" SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) From 3e5adf018041e7398f06d4cf0dd681ea6a746c0f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 18 May 2017 20:07:31 -0700 Subject: [PATCH 0533/1833] [sonic-utilities]: Bump version to 1.1 (#612) --- rules/sonic-utilities.mk | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 7377ed50cbca..9349813f5c4e 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -1,5 +1,5 @@ # sonic utilities package -SONIC_UTILS = python-sonic-utilities_1.0-1_all.deb +SONIC_UTILS = python-sonic-utilities_1.1-1_all.deb $(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS) diff --git a/src/sonic-utilities b/src/sonic-utilities index 70fd4fab6a47..6224416c670d 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 70fd4fab6a4745052f3b19b04de0588031b29b22 +Subproject commit 6224416c670da7f564aa17a71dd739e5ec4b165c From 8b9bc6a5a4a8592ca6425c0835f9bf6da062bff1 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 19 May 2017 11:27:46 -0700 Subject: [PATCH 0534/1833] [swss]: Update swss/common submodules (#614) --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 75e559a5063d..722649bda951 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 75e559a5063d9513b1fafd96d62c020e3c0a5eee +Subproject commit 722649bda95148e1d812603155c2efd3df058795 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index bf2dde2b30cb..447c9a254be7 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit bf2dde2b30cb33e35c6b55305fa00b99c3b4bac1 +Subproject commit 447c9a254be7254b7f62987a1d2d5341f27b2ba0 From 86befe0cfd9f484b45920d659e74c086bf89efa3 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 19 May 2017 13:49:43 -0700 Subject: [PATCH 0535/1833] [docker]: remove docker images after docke push (#615) --- push_docker.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/push_docker.sh b/push_docker.sh index 156502ddfb7e..1e2bc467794e 100755 --- a/push_docker.sh +++ b/push_docker.sh @@ -39,3 +39,4 @@ echo "Image sha256: $image_sha" echo "Pushing $build_remote_image_name" docker push $build_remote_image_name docker rmi $build_remote_image_name || true +docker rmi $docker_image_name || true From faf33d80d33787cb830ee47f23cf905b45a9dbbd Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 19 May 2017 23:23:59 -0700 Subject: [PATCH 0536/1833] [Broadcom]: Update Broadcom SAI to 2.1.5.1-7 (#616) * 20170519 (0843e2a858c2e730b25e7106c83a472e43cd527d) Fixed unknown neighbor processing and neighbor update scenarios. --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 1aa232c97607..611f80d94583 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-6-20170510001051.32_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-6-20170510001051.32_amd64.deb?sv=2015-04-05&sr=b&sig=PS9GQvhA2n%2BLXtu93KYKybvmmLyeIX%2BcrRZspIBvm5o%3D&se=2031-01-17T07%3A02%3A06Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-7-20170519212441.39_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-7-20170519212441.39_amd64.deb?sv=2015-04-05&sr=b&sig=CVc9ldYoy6xdUY0mKg4Rqz4uNDgkTUrPOw1ULrxa8N4%3D&se=2031-01-26T21%3A38%3A42Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-6-20170510001051.32_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-7-20170519212441.39_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-6-20170510001051.32_amd64.deb?sv=2015-04-05&sr=b&sig=d2%2BYxTvzjR92hDXx5Wx7gWDQU52wpLzw4ECxNiAwExM%3D&se=2031-01-17T07%3A01%3A37Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-7-20170519212441.39_amd64.deb?sv=2015-04-05&sr=b&sig=xzCr9xLGF3IaNK8aQGVeU4jY7YkqNEdYAuq5IP2uQM4%3D&se=2031-01-26T21%3A38%3A16Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From 70b282aa8828d0dbc12f4632edfbe8e5270fa527 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 20 May 2017 10:37:59 -0700 Subject: [PATCH 0537/1833] [docker]: install jinja2 2.7.2 to be compatible with the tests (#618) --- sonic-mgmt/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonic-mgmt/Dockerfile b/sonic-mgmt/Dockerfile index 5a64e1ec35b1..f657b18a1dc0 100644 --- a/sonic-mgmt/Dockerfile +++ b/sonic-mgmt/Dockerfile @@ -35,7 +35,8 @@ RUN pip install ipaddr \ six \ pexpect \ pyasn1==0.1.9 \ - pysnmp==4.2.5 + pysnmp==4.2.5 \ + jinja2==2.7.2 RUN git clone https://github.com/ansible/ansible RUN cd ansible && git checkout v2.0.0.2-1 -b v2.0.0.2-1 && git submodule update --init --recursive && make && make install From ef980151ae26cdc8c9a5a67d64314fc40c5080fe Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 22 May 2017 01:08:16 -0700 Subject: [PATCH 0538/1833] [build]: support submodule patching for SONIC_DPKG_DEBS (#619) --- slave.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/slave.mk b/slave.mk index d7afd6d9e5dc..9d9fc126f765 100644 --- a/slave.mk +++ b/slave.mk @@ -171,10 +171,14 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a $(HEADER) # Build project and take package rm -f $($*_SRC_PATH)/debian/*.debhelper.log + # apply series of patches if exist + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi pushd $($*_SRC_PATH) $(LOG) [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) dpkg-buildpackage -rfakeroot -b -us -uc $(LOG) popd $(LOG) + # clean up + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi mv $(addprefix $($*_SRC_PATH)/../, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) $(DEBS_PATH) $(LOG) $(FOOTER) From 714e45f0bb8ccf3674d4a821d0517d70a219f81a Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 23 May 2017 10:29:54 -0700 Subject: [PATCH 0539/1833] Cron jobs log to /var/log/cron.log once again (#620) - Now that logrotate is a cron job that runs every minute, it was polluting syslog - Also shrink max size of less-important logs to 50MB and rotate them daily by default --- files/image_config/logrotate.d/rsyslog | 4 ++-- files/image_config/rsyslog/rsyslog.d/99-default.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/image_config/logrotate.d/rsyslog b/files/image_config/logrotate.d/rsyslog index 0d03e906c9b8..d24bc32abe17 100644 --- a/files/image_config/logrotate.d/rsyslog +++ b/files/image_config/logrotate.d/rsyslog @@ -31,8 +31,8 @@ /var/log/messages { rotate 4 - weekly - maxsize 100M + daily + maxsize 50M missingok notifempty compress diff --git a/files/image_config/rsyslog/rsyslog.d/99-default.conf b/files/image_config/rsyslog/rsyslog.d/99-default.conf index 9b129199b385..cfb1e1d3b881 100644 --- a/files/image_config/rsyslog/rsyslog.d/99-default.conf +++ b/files/image_config/rsyslog/rsyslog.d/99-default.conf @@ -3,9 +3,9 @@ # auth,authpriv.* /var/log/auth.log *.*;auth,authpriv.none -/var/log/syslog -# Do not redirect cron, daemon, kernel or lpr logs to +cron.* /var/log/cron.log +# Do not redirect daemon, kernel or lpr logs to # their own files. Let them log to /var/log/syslog -#cron.* /var/log/cron.log #daemon.* -/var/log/daemon.log #kern.* -/var/log/kern.log #kern.* -/var/persist/log/kern.log From 9669fa8e08dafb051377c32ae0f32dc888329b53 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Tue, 23 May 2017 15:09:01 -0400 Subject: [PATCH 0540/1833] [utilities]: Update submodule (#623) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 6224416c670d..b158a565ba5f 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 6224416c670da7f564aa17a71dd739e5ec4b165c +Subproject commit b158a565ba5ff85665c225d12908a3b588552db5 From 867670665fe571d2d052033df61c174d413609d8 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 24 May 2017 01:34:37 -0700 Subject: [PATCH 0541/1833] [docker-ptf]: Add less, ipython, and python ssh libraries (#625) --- dockers/docker-ptf/Dockerfile.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index a8459bb39781..5b099176164b 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -41,6 +41,7 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / cmake \ libqt5core5a \ libqt5network5 \ + less \ iputils-ping @@ -70,6 +71,9 @@ RUN rm -rf /debs \ && pip install dpkt \ && pip install ipaddress \ && pip install pysubnettree \ + && pip install 'ipython<6.0' \ + && pip install paramiko \ + && pip install parallel-ssh \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py From 5cc45a991d6eb288c26e04cba4dd553fc4997d1e Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 24 May 2017 19:02:46 +0300 Subject: [PATCH 0542/1833] [swss]: Update swss submodule (#627) [portsorch]: Add set port MTU function (#218) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 722649bda951..1210c45724f1 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 722649bda95148e1d812603155c2efd3df058795 +Subproject commit 1210c45724f184152525f3ff5bc983ad4c3c9939 From a2eda30a0304b868b084637d2f4a0e2452a07ed0 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 24 May 2017 11:53:38 -0700 Subject: [PATCH 0543/1833] [docker-syncd-*]: Properly manage syncd with supervisord (#617) - This PR allows supervisord to log syncd exit events to syslog - Syncd dockers now are built from docker-config-engine instead of docker-base - Supervisord in all syncd dockers now call syncd_start.s which is installed by sonic-sairedis repo --- .../broadcom/docker-syncd-brcm/Dockerfile.j2 | 4 ++-- .../docker-syncd-brcm/supervisord.conf | 2 +- platform/broadcom/docker-syncd-brcm/syncd.sh | 12 ---------- .../cavium/docker-syncd-cavm/Dockerfile.j2 | 4 ++-- .../cavium/docker-syncd-cavm/supervisord.conf | 2 +- platform/cavium/docker-syncd-cavm/syncd.sh | 22 ------------------- .../centec/docker-syncd-centec/Dockerfile.j2 | 4 ++-- .../docker-syncd-centec/supervisord.conf | 2 +- platform/centec/docker-syncd-centec/syncd.sh | 12 ---------- .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 4 ++-- platform/mellanox/docker-syncd-mlnx/start.sh | 5 ++++- .../docker-syncd-mlnx/supervisord.conf | 2 +- platform/mellanox/docker-syncd-mlnx/syncd.sh | 19 ---------------- src/sonic-sairedis | 2 +- 14 files changed, 17 insertions(+), 79 deletions(-) delete mode 100755 platform/broadcom/docker-syncd-brcm/syncd.sh delete mode 100755 platform/cavium/docker-syncd-cavm/syncd.sh delete mode 100755 platform/centec/docker-syncd-centec/syncd.sh delete mode 100755 platform/mellanox/docker-syncd-mlnx/syncd.sh diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index af6c96c585d0..2b5fc8c87d0b 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-base +FROM docker-config-engine ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -19,7 +19,7 @@ debs/{{ deb }}{{' '}} ## TODO: add kmod into Depends RUN apt-get install -f kmod -COPY ["debs/dsserve", "debs/bcmcmd", "start.sh", "syncd.sh", "/usr/bin/"] +COPY ["debs/dsserve", "debs/bcmcmd", "start.sh", "/usr/bin/"] RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] diff --git a/platform/broadcom/docker-syncd-brcm/supervisord.conf b/platform/broadcom/docker-syncd-brcm/supervisord.conf index 80d04a225ffd..1e015fef931f 100644 --- a/platform/broadcom/docker-syncd-brcm/supervisord.conf +++ b/platform/broadcom/docker-syncd-brcm/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:syncd] -command=/usr/bin/syncd.sh +command=/usr/bin/syncd_start.sh priority=3 autostart=false autorestart=false diff --git a/platform/broadcom/docker-syncd-brcm/syncd.sh b/platform/broadcom/docker-syncd-brcm/syncd.sh deleted file mode 100755 index 993cf100f2f0..000000000000 --- a/platform/broadcom/docker-syncd-brcm/syncd.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -function clean_up { - service syncd stop - exit -} - -trap clean_up SIGTERM SIGKILL - -service syncd start - -read diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index dd37db2e04d2..a35abf576f6d 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-base +FROM docker-config-engine ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -18,7 +18,7 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY ["start.sh", "syncd.sh", "/usr/bin/"] +COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["profile.ini", "/etc/ssw/AS7512/"] diff --git a/platform/cavium/docker-syncd-cavm/supervisord.conf b/platform/cavium/docker-syncd-cavm/supervisord.conf index 80d04a225ffd..1e015fef931f 100644 --- a/platform/cavium/docker-syncd-cavm/supervisord.conf +++ b/platform/cavium/docker-syncd-cavm/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:syncd] -command=/usr/bin/syncd.sh +command=/usr/bin/syncd_start.sh priority=3 autostart=false autorestart=false diff --git a/platform/cavium/docker-syncd-cavm/syncd.sh b/platform/cavium/docker-syncd-cavm/syncd.sh deleted file mode 100755 index 24767dfc6e0a..000000000000 --- a/platform/cavium/docker-syncd-cavm/syncd.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -export XP_ROOT=/usr/bin/ - -while true; do - - # Check if redis-server starts - - result=$(redis-cli ping) - - if [ "$result" == "PONG" ]; then - - redis-cli FLUSHALL - syncd -p /etc/ssw/AS7512/profile.ini -N - break - - fi - - sleep 1 - -done - diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index 9e0fe52b174e..302afbc0cd4e 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-base +FROM docker-config-engine ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -19,7 +19,7 @@ debs/{{ deb }}{{' '}} ## TODO: add kmod into Depends RUN apt-get install -f kmod -COPY ["start.sh", "syncd.sh", "/usr/bin/"] +COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] ## Clean up diff --git a/platform/centec/docker-syncd-centec/supervisord.conf b/platform/centec/docker-syncd-centec/supervisord.conf index 80d04a225ffd..1e015fef931f 100644 --- a/platform/centec/docker-syncd-centec/supervisord.conf +++ b/platform/centec/docker-syncd-centec/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:syncd] -command=/usr/bin/syncd.sh +command=/usr/bin/syncd_start.sh priority=3 autostart=false autorestart=false diff --git a/platform/centec/docker-syncd-centec/syncd.sh b/platform/centec/docker-syncd-centec/syncd.sh deleted file mode 100755 index 993cf100f2f0..000000000000 --- a/platform/centec/docker-syncd-centec/syncd.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -function clean_up { - service syncd stop - exit -} - -trap clean_up SIGTERM SIGKILL - -service syncd start - -read diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 03257ad33e2f..0736df044162 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-base +FROM docker-config-engine ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -18,7 +18,7 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY ["start.sh", "syncd.sh", "mlnx-fw-upgrade.sh", "/usr/bin/"] +COPY ["start.sh", "mlnx-fw-upgrade.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["/debs/fw-SPC.mfa", "/etc/mlnx/"] diff --git a/platform/mellanox/docker-syncd-mlnx/start.sh b/platform/mellanox/docker-syncd-mlnx/start.sh index 96e2a9128081..0ad00c6fc252 100755 --- a/platform/mellanox/docker-syncd-mlnx/start.sh +++ b/platform/mellanox/docker-syncd-mlnx/start.sh @@ -4,5 +4,8 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd -supervisorctl start syncd +# mlnx-fw-upgrade.sh will exit if firmware was actually upgraded +# or if some error occurs +. mlnx-fw-upgrade.sh +supervisorctl start syncd diff --git a/platform/mellanox/docker-syncd-mlnx/supervisord.conf b/platform/mellanox/docker-syncd-mlnx/supervisord.conf index 80d04a225ffd..1e015fef931f 100644 --- a/platform/mellanox/docker-syncd-mlnx/supervisord.conf +++ b/platform/mellanox/docker-syncd-mlnx/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:syncd] -command=/usr/bin/syncd.sh +command=/usr/bin/syncd_start.sh priority=3 autostart=false autorestart=false diff --git a/platform/mellanox/docker-syncd-mlnx/syncd.sh b/platform/mellanox/docker-syncd-mlnx/syncd.sh deleted file mode 100755 index ad0e0e47be87..000000000000 --- a/platform/mellanox/docker-syncd-mlnx/syncd.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -function clean_up { - service syncd stop - exit -} - -trap clean_up SIGTERM SIGKILL - -# fw-upgrade will exit if firmware was actually upgraded or if some error -# occures -. mlnx-fw-upgrade.sh - -# FIXME: the script cannot trap SIGTERM signal and it exits without clean_up -# Remove rsyslogd.pid file manually so that to start the rsyslog instantly -service syncd start - -read - diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 9fe1e696c6a9..31131d7d76fa 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 9fe1e696c6a9b5e99406ff2548c6f52db4e0b604 +Subproject commit 31131d7d76fa68619b90d88528270a0740daa438 From 519802ec091b12708dd0f0656246dde11549855d Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 24 May 2017 11:57:33 -0700 Subject: [PATCH 0544/1833] [docker-swss]: Restore FDB and ARP entries after fast reboot (#621) * Restore FDB and ARP entries right after fast reboot to minimize traffic corruption * Fix typo --- dockers/docker-orchagent/swssconfig.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index f0f1e100f3d4..86ea010c2631 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -12,6 +12,30 @@ function config_acl { fi } +function fast_reboot { + case "$(cat /proc/cmdline)" in + *fast-reboot*) + if [[ -f /fdb.json ]]; + then + swssconfig /fdb.json + rm -f /fdb.json + fi + + if [[ -f /arp.json ]]; + then + swssconfig /arp.json + rm -f /arp.json + fi + ;; + *) + ;; + esac +} + + +# Restore FDB and ARP table ASAP +fast_reboot + HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " From 13c18ed045b28d2b05d9d920769006f4865bea65 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Wed, 24 May 2017 14:59:01 -0400 Subject: [PATCH 0545/1833] [device]: Add support for SKU Force10-S6000-Q32 (#624) --- device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q32 | 1 + dockers/docker-orchagent/orchagent.sh | 2 ++ dockers/docker-orchagent/swssconfig.sh | 2 ++ 3 files changed, 5 insertions(+) create mode 120000 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q32 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q32 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q32 new file mode 120000 index 000000000000..175db8c15394 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q32 @@ -0,0 +1 @@ +Force10-S6000 \ No newline at end of file diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index a9330826d5e6..ff7a4ccf7c17 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -8,6 +8,8 @@ ORCHAGENT_ARGS="" if [ "$HWSKU" == "Force10-S6000" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "Force10-S6000-Q32" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Force10-S6100" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "Force10-Z9100" ]; then diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 86ea010c2631..ab6c39403b59 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -42,6 +42,8 @@ SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " if [ "$HWSKU" == "Force10-S6000" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +elif [ "$HWSKU" == "Force10-S6000-Q32" ]; then + SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "ACS-MSN2700" ]; then From 0104dbbf9f8b9dfb34deaf4daf6f4c2b46c91fc6 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 24 May 2017 12:49:19 -0700 Subject: [PATCH 0546/1833] [image]: add --numeric_owner to perserve the original owner of the for docker filesystem (#626) --- installer/x86_64/install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 451edbe3f379..18669893bcb5 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -417,7 +417,8 @@ fi unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt/$image_dir if [ -f $demo_mnt/$image_dir/$FILESYSTEM_DOCKERFS ]; then - cd $demo_mnt/$image_dir && mkdir -p $DOCKERFS_DIR && tar xf $FILESYSTEM_DOCKERFS -C $DOCKERFS_DIR && rm -f $FILESYSTEM_DOCKERFS; cd $OLDPWD + TAR_EXTRA_OPTION="--numeric-owner" + cd $demo_mnt/$image_dir && mkdir -p $DOCKERFS_DIR && tar x $TAR_EXTRA_OPTION -f $FILESYSTEM_DOCKERFS -C $DOCKERFS_DIR && rm -f $FILESYSTEM_DOCKERFS; cd $OLDPWD fi # Create loop device for /var/log to limit its size to $VAR_LOG_SIZE MB From 528effcacef3230bedf66d798b06d51d6fba8401 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 24 May 2017 13:49:43 -0700 Subject: [PATCH 0547/1833] Update submodule (#629) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index e8e1e70e6c30..46ab9d94535d 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit e8e1e70e6c30eee72cade87273d3ceed59bd0c8d +Subproject commit 46ab9d94535df16df8f7e2d252977d54e40caa30 From 31fbee21d0a1772c7e18ef9aed3a03810c8f24cd Mon Sep 17 00:00:00 2001 From: wadelnn Date: Thu, 25 May 2017 05:56:39 +0800 Subject: [PATCH 0548/1833] Update sonic-linux-kernel submodule (#609) Signed-off-by: Wade He chihen.he@gmail.com --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 73e99e9126c2..0d56999ccfcc 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 73e99e9126c2233a36609275a9e9bd0bb0f3d0f5 +Subproject commit 0d56999ccfccdc054178388f65c9442aa350caec From 0137f7ab5c3b886920e8bba45ff9aa4bd7542f57 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 25 May 2017 14:43:03 +0300 Subject: [PATCH 0549/1833] [Mellanox]: Update SAI revision (#632) New revision contains fixes for applying attributes on LAGs/LAG members Signed-off-by: marian-pritsak --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 8ad62aae2f52..67bc173ae8a6 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = dd6b7cf8fcdc87a40cb694799daf8c081e859a14 +MLNX_SAI_REVISION = 579c19acf3b9bed181ac713fcf92302f4ebae422 export MLNX_SAI_VERSION MLNX_SAI_REVISION From 338e4e8839779dfcb4ffb9e7b6c377763ccae52e Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 25 May 2017 13:18:32 -0700 Subject: [PATCH 0550/1833] Syncd docker builds now depend on docker-config-engine (#634) --- platform/broadcom/docker-syncd-brcm.mk | 2 +- platform/cavium/docker-syncd-cavm.mk | 2 +- platform/centec/docker-syncd-centec.mk | 2 +- platform/mellanox/docker-syncd-mlnx.mk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index 8e48de8fe20f..cd44d651266f 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -4,7 +4,7 @@ DOCKER_SYNCD_BRCM = docker-syncd-brcm.gz $(DOCKER_SYNCD_BRCM)_PATH = $(PLATFORM_PATH)/docker-syncd-brcm $(DOCKER_SYNCD_BRCM)_DEPENDS += $(SYNCD) $(DOCKER_SYNCD_BRCM)_FILES += $(DSSERVE) $(BCMCMD) -$(DOCKER_SYNCD_BRCM)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_SYNCD_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM) diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index ef4d578e0a3e..a61716c7bdb4 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -3,7 +3,7 @@ DOCKER_SYNCD_CAVM = docker-syncd-cavm.gz $(DOCKER_SYNCD_CAVM)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm $(DOCKER_SYNCD_CAVM)_DEPENDS += $(SYNCD) $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS) -$(DOCKER_SYNCD_CAVM)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_SYNCD_CAVM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) diff --git a/platform/centec/docker-syncd-centec.mk b/platform/centec/docker-syncd-centec.mk index 9309ae885382..694005fb48cf 100644 --- a/platform/centec/docker-syncd-centec.mk +++ b/platform/centec/docker-syncd-centec.mk @@ -3,7 +3,7 @@ DOCKER_SYNCD_CENTEC = docker-syncd-centec.gz $(DOCKER_SYNCD_CENTEC)_PATH = $(PLATFORM_PATH)/docker-syncd-centec $(DOCKER_SYNCD_CENTEC)_DEPENDS += $(SYNCD) -$(DOCKER_SYNCD_CENTEC)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_SYNCD_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC) diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 106257617a75..5ea1d7aa556a 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -4,7 +4,7 @@ DOCKER_SYNCD_MLNX = docker-syncd-mlnx.gz $(DOCKER_SYNCD_MLNX)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx $(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(MFT) $(PYTHON_SDK_API) $(DOCKER_SYNCD_MLNX)_FILES += $(MLNX_FW) -$(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) From edab38e321f01d1777eccac05662f3f9fcbd61fc Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 26 May 2017 13:31:33 -0700 Subject: [PATCH 0551/1833] Install ipython from packages (#637) --- dockers/docker-ptf/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 5b099176164b..d1d8e2466fa3 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -42,6 +42,7 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / libqt5core5a \ libqt5network5 \ less \ + ipython \ iputils-ping @@ -71,7 +72,6 @@ RUN rm -rf /debs \ && pip install dpkt \ && pip install ipaddress \ && pip install pysubnettree \ - && pip install 'ipython<6.0' \ && pip install paramiko \ && pip install parallel-ssh \ && mkdir -p /opt \ From f3312b8e0b75aebe13ad14bacc8fc56c246f5d55 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 26 May 2017 17:18:11 -0700 Subject: [PATCH 0552/1833] [docker-ptf-*]: Use buildimage infrastructure to build docker-ptf-* (#638) * Add files to build docker-ptf-{platform} --- dockers/docker-ptf-saithrift/Dockerfile | 15 --------------- dockers/docker-ptf-saithrift/Dockerfile.j2 | 17 +++++++++++++++++ platform/broadcom/docker-ptf-brcm.mk | 7 +++++++ platform/broadcom/rules.mk | 2 ++ platform/cavium/docker-ptf-cavm.mk | 7 +++++++ platform/cavium/rules.mk | 2 ++ platform/centec/docker-ptf-centec.mk | 7 +++++++ platform/centec/rules.mk | 2 ++ platform/mellanox/docker-ptf-mlnx.mk | 7 +++++++ platform/mellanox/rules.mk | 2 ++ 10 files changed, 53 insertions(+), 15 deletions(-) delete mode 100644 dockers/docker-ptf-saithrift/Dockerfile create mode 100644 dockers/docker-ptf-saithrift/Dockerfile.j2 create mode 100644 platform/broadcom/docker-ptf-brcm.mk create mode 100644 platform/cavium/docker-ptf-cavm.mk create mode 100644 platform/centec/docker-ptf-centec.mk create mode 100644 platform/mellanox/docker-ptf-mlnx.mk diff --git a/dockers/docker-ptf-saithrift/Dockerfile b/dockers/docker-ptf-saithrift/Dockerfile deleted file mode 100644 index 0aa494757711..000000000000 --- a/dockers/docker-ptf-saithrift/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM docker-ptf - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -COPY ["deps/saithrift-0.9.tar.gz", "/deps/"] -COPY ["*.ini", "/etc/ptf/"] -COPY ["deps/SAI/test/saithrift/tests/*", "/usr/share/ptf-tests/"] - -RUN tar xzf /deps/saithrift-0.9.tar.gz -C /usr/share/; \ - cd usr/share/saithrift-0.9; \ - python setup.py install; \ - rm -rf /deps diff --git a/dockers/docker-ptf-saithrift/Dockerfile.j2 b/dockers/docker-ptf-saithrift/Dockerfile.j2 new file mode 100644 index 000000000000..3076de4878b6 --- /dev/null +++ b/dockers/docker-ptf-saithrift/Dockerfile.j2 @@ -0,0 +1,17 @@ +FROM docker-ptf + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +COPY \ +{% for deb in docker_ptf_saithrift_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_ptf_saithrift_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +COPY ["*.ini", "/etc/ptf/"] diff --git a/platform/broadcom/docker-ptf-brcm.mk b/platform/broadcom/docker-ptf-brcm.mk new file mode 100644 index 000000000000..7b78aa9ec316 --- /dev/null +++ b/platform/broadcom/docker-ptf-brcm.mk @@ -0,0 +1,7 @@ +# docker image for docker-ptf-brcm + +DOCKER_PTF_BRCM = docker-ptf-brcm.gz +$(DOCKER_PTF_BRCM)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift +$(DOCKER_PTF_BRCM)_DEPENDS += $(PYTHON_SAITHRIFT_BRCM) +$(DOCKER_PTF_BRCM)_LOAD_DOCKERS += $(DOCKER_PTF) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF_BRCM) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index fff132c1c508..18ba86d1c0ce 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -11,6 +11,7 @@ include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/one-aboot.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.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" @@ -22,6 +23,7 @@ SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ $(DOCKER_FPM) \ + $(DOCKER_PTF_BRCM) \ $(DOCKER_SYNCD_BRCM_RPC) # Inject brcm sai into sairedis diff --git a/platform/cavium/docker-ptf-cavm.mk b/platform/cavium/docker-ptf-cavm.mk new file mode 100644 index 000000000000..4665345586a8 --- /dev/null +++ b/platform/cavium/docker-ptf-cavm.mk @@ -0,0 +1,7 @@ +# docker image for docker-ptf-cavm + +DOCKER_PTF_CAVM = docker-ptf-cavm.gz +$(DOCKER_PTF_CAVM)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift +$(DOCKER_PTF_CAVM)_DEPENDS += $(PYTHON_SAITHRIFT_CAVM) +$(DOCKER_PTF_CAVM)_LOAD_DOCKERS += $(DOCKER_PTF) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF_CAVM) diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 6eeffbc7f9b2..67a69168e035 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -7,9 +7,11 @@ include $(PLATFORM_PATH)/cavm-xpnet.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk +include $(PLATFORM_PATH)/docker-ptf-cavm.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM) \ + $(DOCKER_PTF_CAVM) \ $(DOCKER_SYNCD_CAVM_RPC) # Inject cavium sai into sairedis diff --git a/platform/centec/docker-ptf-centec.mk b/platform/centec/docker-ptf-centec.mk new file mode 100644 index 000000000000..ff84ed0becb7 --- /dev/null +++ b/platform/centec/docker-ptf-centec.mk @@ -0,0 +1,7 @@ +# docker image for docker-ptf-centec + +DOCKER_PTF_CENTEC = docker-ptf-centec.gz +$(DOCKER_PTF_CENTEC)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift +$(DOCKER_PTF_CENTEC)_DEPENDS += $(PYTHON_SAITHRIFT_CENTEC) +$(DOCKER_PTF_CENTEC)_LOAD_DOCKERS += $(DOCKER_PTF) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF_CENTEC) diff --git a/platform/centec/rules.mk b/platform/centec/rules.mk index 0dcf050fe417..8b676f87ece4 100644 --- a/platform/centec/rules.mk +++ b/platform/centec/rules.mk @@ -6,8 +6,10 @@ include $(PLATFORM_PATH)/docker-syncd-centec-rpc.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk +include $(PLATFORM_PATH)/docker-ptf-centec.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ + $(DOCKER_PTF_CENTEC) \ $(DOCKER_SYNCD_CENTEC_RPC) # Inject centec sai into sairedis diff --git a/platform/mellanox/docker-ptf-mlnx.mk b/platform/mellanox/docker-ptf-mlnx.mk new file mode 100644 index 000000000000..7f23dc715e32 --- /dev/null +++ b/platform/mellanox/docker-ptf-mlnx.mk @@ -0,0 +1,7 @@ +# docker image for docker-ptf-mlnx + +DOCKER_PTF_MLNX = docker-ptf-mlnx.gz +$(DOCKER_PTF_MLNX)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift +$(DOCKER_PTF_MLNX)_DEPENDS += $(PYTHON_SAITHRIFT_MLNX) +$(DOCKER_PTF_MLNX)_LOAD_DOCKERS += $(DOCKER_PTF) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF_MLNX) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index a56d9b0d5748..6b88748c73a2 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -9,9 +9,11 @@ include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk +include $(PLATFORM_PATH)/docker-ptf-mlnx.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM) \ + $(DOCKER_PTF_MLNX) \ $(DOCKER_SYNCD_MLNX_RPC) # Inject mlnx sai into sairedis From e6bb4b20a196f22a7e266f3e2de61df442ff09f4 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 26 May 2017 17:56:29 -0700 Subject: [PATCH 0553/1833] [swss]: Update submodules and mount /var/log to swss docker (#636) - [swss]: Update sairedis/swss/common submodules - [orchagent]: Mount /var/log folder and use the folder to save recording files - [orchagent]: Use -d to specify the folder path --- dockers/docker-orchagent/orchagent.sh | 4 +++- platform/broadcom/docker-orchagent-brcm.mk | 3 ++- platform/cavium/docker-orchagent-cavm.mk | 3 ++- platform/centec/docker-orchagent-centec.mk | 3 ++- platform/mellanox/docker-orchagent-mlnx.mk | 3 ++- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 8 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index ff7a4ccf7c17..01959dd66ac4 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -4,7 +4,9 @@ HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` -ORCHAGENT_ARGS="" +# Create a folder for SsWW record files +mkdir -p /var/log/swss +ORCHAGENT_ARGS="-d /var/log/swss " if [ "$HWSKU" == "Force10-S6000" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index 777f052042ba..70e087e73f4f 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -11,7 +11,8 @@ $(DOCKER_ORCHAGENT_BRCM)_CONTAINER_NAME = swss $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf +$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /var/log:/var/log:rw $(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index 1d58e41edf89..702c661a7616 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -11,7 +11,8 @@ $(DOCKER_ORCHAGENT_CAVM)_CONTAINER_NAME = swss $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf +$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /var/log:/var/log:rw $(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk index 529778466bf3..3aff56c0b3b2 100644 --- a/platform/centec/docker-orchagent-centec.mk +++ b/platform/centec/docker-orchagent-centec.mk @@ -11,7 +11,8 @@ $(DOCKER_ORCHAGENT_CENTEC)_CONTAINER_NAME = swss $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /host/machine.conf:/host/machine.conf +$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /var/log:/var/log:rw $(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index d56a1edf0db6..0e4005e436b4 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -11,7 +11,8 @@ $(DOCKER_ORCHAGENT_MLNX)_CONTAINER_NAME = swss $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --net=host --privileged -t $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf +$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /var/log:/var/log:rw $(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 31131d7d76fa..7acacf385e30 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 31131d7d76fa68619b90d88528270a0740daa438 +Subproject commit 7acacf385e30e8525b0816f76963a6a36cb0b27d diff --git a/src/sonic-swss b/src/sonic-swss index 1210c45724f1..03428467606e 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 1210c45724f184152525f3ff5bc983ad4c3c9939 +Subproject commit 03428467606eab9d577bde29316ba98357e7a032 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 447c9a254be7..8bb0c9b8b71b 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 447c9a254be7254b7f62987a1d2d5341f27b2ba0 +Subproject commit 8bb0c9b8b71bffc2f323e6f25504d38ef3a9d9d8 From 122c03caee73e165161e5eb3b33b42cc423fe521 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 26 May 2017 18:32:52 -0700 Subject: [PATCH 0554/1833] [docker-ptf]: Overwrite ubuntu scapy with version from p4lang (#639) * Install scapy from p4lang * Overwrite standard scapy version --- dockers/docker-ptf/Dockerfile.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index d1d8e2466fa3..963282b27cb5 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -43,8 +43,11 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / libqt5network5 \ less \ ipython \ + git \ iputils-ping +## Reinstall scapy by version from p4lang +RUN git clone https://github.com/p4lang/scapy-vxlan.git && cd scapy-vxlan && python setup.py install RUN dpkg -i \ {% for deb in docker_ptf_debs.split(' ') -%} From bd52f411fff6675397f0b3ed7ed71374d9324069 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Sat, 27 May 2017 01:14:58 -0700 Subject: [PATCH 0555/1833] [interfaces]: Use default table instead of main table for forced_mgmt_routes (#635) If routes are inserted in main table, they wont' be overwritten by the routes learned via BGP. Then the routes will be missing from the ASIC. Thus a default table is used so that control plane and data plane routes are isolated and could be configured independently. --- files/image_config/interfaces/interfaces.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index c2728e5e032d..d23b677ff290 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -29,13 +29,13 @@ iface eth0 inet static up ip route add default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default up ip rule add from {{ minigraph_mgmt_interface['addr'] }}/32 table default {% for prefix in forced_mgmt_routes %} - up ip route add {{ prefix }} via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 + up ip rule add to {{ prefix }} table default {% endfor %} # management port down rules down ip route delete default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default down ip rule delete from {{ minigraph_mgmt_interface['addr'] }}/32 table default {% for prefix in forced_mgmt_routes %} - down ip route delete {{ prefix }} via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 + down ip rule delete to {{ prefix }} table default {% endfor %} {# TODO: COPP policy type rules #} {% else %} From 1b2b7b8e3505c5e8bf0568d20eee8b1c294c45b4 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 27 May 2017 16:05:21 -0700 Subject: [PATCH 0556/1833] [docker-swss]: mount /var/log/swss into the docker (#640) Fix the bug introduced by commit e6bb4b20a196f22a7e266f3e2de61df442ff09f4 The previous commit mount /var/log into the docker which override the original /var/log directory structure, causing swss docker failed to start due to following errors. Error: The directory named as part of the path /var/log/supervisor/supervisord.log does not exist. --- platform/broadcom/docker-orchagent-brcm.mk | 2 +- platform/cavium/docker-orchagent-cavm.mk | 2 +- platform/centec/docker-orchagent-centec.mk | 2 +- platform/mellanox/docker-orchagent-mlnx.mk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index 70e087e73f4f..196a4d589a24 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -13,6 +13,6 @@ $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/inte $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /var/log:/var/log:rw +$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index 702c661a7616..57ebb2fd1534 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -13,6 +13,6 @@ $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/inte $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /var/log:/var/log:rw +$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk index 3aff56c0b3b2..695e481546b1 100644 --- a/platform/centec/docker-orchagent-centec.mk +++ b/platform/centec/docker-orchagent-centec.mk @@ -13,6 +13,6 @@ $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces:/etc/network/in $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /var/log:/var/log:rw +$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index 0e4005e436b4..20aa38335361 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -13,6 +13,6 @@ $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces:/etc/network/inte $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /var/log:/var/log:rw +$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel From 17f063314355a11e3e298fb6af63ad8a6364be9a Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 28 May 2017 00:36:34 -0700 Subject: [PATCH 0557/1833] [image]: change mtu to jumbo size 9216 by default (#641) --- files/image_config/interfaces/interfaces.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index d23b677ff290..7e07c4365171 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -49,6 +49,7 @@ iface eth0 inet dhcp auto {{ interface['attachto'] }} allow-hotplug {{ interface['attachto'] }} iface {{ interface['attachto'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static + mtu 9216 address {{ interface['addr'] }} netmask {{ interface['mask'] }} # @@ -61,7 +62,7 @@ iface {{ interface['attachto'] }} {{ 'inet' if interface['addr'] | ipv4 else 'in auto {{ member }} allow-hotplug {{ member }} iface {{ member }} inet manual - pre-up ifconfig {{ member }} up + pre-up ifconfig {{ member }} up mtu 9216 post-up brctl addif {{ vlan }} {{ member }} || true post-down ifconfig {{ member }} down # @@ -103,6 +104,7 @@ iface {{ vlan_interface['attachto'] }} {{ 'inet' if vlan_interface['addr'] | ipv auto {{ pc_interface['attachto'] }} allow-hotplug {{ pc_interface['attachto'] }} iface {{ pc_interface['attachto'] }} {{ 'inet' if pc_interface['addr'] | ipv4 else 'inet6' }} static + mtu 9216 address {{ pc_interface['addr'] }} netmask {{ pc_interface['mask'] }} # From 2e582d22d1da9947a9292b534209ea59cf933330 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 30 May 2017 12:56:42 -0700 Subject: [PATCH 0558/1833] update SAI and sonic-utilities submodules (#644) * Update SAI and sonic-utilites submodules --- src/SAI | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SAI b/src/SAI index 499ad7272264..a6b5b3115f39 160000 --- a/src/SAI +++ b/src/SAI @@ -1 +1 @@ -Subproject commit 499ad727226405b425473d6ed170c3bee1112cca +Subproject commit a6b5b3115f39f599d39629ab9bfaeea17333d0bc diff --git a/src/sonic-utilities b/src/sonic-utilities index b158a565ba5f..de5c31874bb8 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit b158a565ba5ff85665c225d12908a3b588552db5 +Subproject commit de5c31874bb89c62d50efec6d8541e85fe678548 From 7dfbca649793482ce6ecd6f884e85e8d69fc258e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 30 May 2017 13:21:44 -0700 Subject: [PATCH 0559/1833] Fix SAI submodule id (#647) --- src/SAI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SAI b/src/SAI index a6b5b3115f39..940c7b6afb1d 160000 --- a/src/SAI +++ b/src/SAI @@ -1 +1 @@ -Subproject commit a6b5b3115f39f599d39629ab9bfaeea17333d0bc +Subproject commit 940c7b6afb1db4e8504b7cdb24ccd669748dbde8 From 520fff5b2d85dc9ee209e861083db5e3ab6db7aa Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 31 May 2017 02:17:03 +0300 Subject: [PATCH 0560/1833] Add ENABLE_SYNCD_RPC option (#642) Under rules/config now there's additional configuration option ENABLE_SYNCD_RPC that allows building SONIC installer with docker-syncd-*-rpc for evaluation purposes. Signed-off-by: marian-pritsak --- Makefile | 1 + platform/broadcom/docker-syncd-brcm-rpc.mk | 9 +++++++++ platform/broadcom/docker-syncd-brcm.mk | 2 ++ platform/cavium/docker-syncd-cavm-rpc.mk | 8 ++++++++ platform/cavium/docker-syncd-cavm.mk | 2 ++ platform/centec/docker-syncd-centec-rpc.mk | 9 +++++++++ platform/centec/docker-syncd-centec.mk | 2 ++ platform/mellanox/docker-syncd-mlnx-rpc.mk | 8 ++++++++ platform/mellanox/docker-syncd-mlnx.mk | 2 ++ rules/config | 4 ++++ slave.mk | 4 ++++ 11 files changed, 51 insertions(+) diff --git a/Makefile b/Makefile index 116c751f228c..97f054c035b6 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,7 @@ DOCKER_MGMT_BUILD = docker build --no-cache \ PLATFORM=$(PLATFORM) \ BUILD_NUMBER=$(BUILD_NUMBER) \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ + SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ $@ diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk index 8efd25eb9b49..fa7c0fb797c7 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -6,3 +6,12 @@ $(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(DOCKER_SYNCD_BRCM_RPC)_FILES += $(DSSERVE) $(BCMCMD) $(DOCKER_SYNCD_BRCM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BRCM) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) +endif + +$(DOCKER_SYNCD_BRCM_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index cd44d651266f..aeee6479a84f 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -6,7 +6,9 @@ $(DOCKER_SYNCD_BRCM)_DEPENDS += $(SYNCD) $(DOCKER_SYNCD_BRCM)_FILES += $(DSSERVE) $(BCMCMD) $(DOCKER_SYNCD_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM) +ifneq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM) +endif $(DOCKER_SYNCD_BRCM)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_BRCM)_RUN_OPT += --net=host --privileged -t diff --git a/platform/cavium/docker-syncd-cavm-rpc.mk b/platform/cavium/docker-syncd-cavm-rpc.mk index ac725a1bbdeb..e0136f5324b6 100644 --- a/platform/cavium/docker-syncd-cavm-rpc.mk +++ b/platform/cavium/docker-syncd-cavm-rpc.mk @@ -5,3 +5,11 @@ $(DOCKER_SYNCD_CAVM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm-rpc $(DOCKER_SYNCD_CAVM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS) $(DOCKER_SYNCD_CAVM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_CAVM) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC) +endif + +$(DOCKER_SYNCD_CAVM_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index a61716c7bdb4..8a3b0857dadf 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -5,7 +5,9 @@ $(DOCKER_SYNCD_CAVM)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm $(DOCKER_SYNCD_CAVM)_DEPENDS += $(SYNCD) $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS) $(DOCKER_SYNCD_CAVM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) +ifneq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) +endif $(DOCKER_SYNCD_CAVM)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_CAVM)_RUN_OPT += --net=host --privileged -t diff --git a/platform/centec/docker-syncd-centec-rpc.mk b/platform/centec/docker-syncd-centec-rpc.mk index 68b940f8d2b6..1798a034980d 100644 --- a/platform/centec/docker-syncd-centec-rpc.mk +++ b/platform/centec/docker-syncd-centec-rpc.mk @@ -5,3 +5,12 @@ $(DOCKER_SYNCD_CENTEC_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-centec-rpc $(DOCKER_SYNCD_CENTEC_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(DOCKER_SYNCD_CENTEC_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_CENTEC) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) +endif + +$(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/centec/docker-syncd-centec.mk b/platform/centec/docker-syncd-centec.mk index 694005fb48cf..c4335ab356ac 100644 --- a/platform/centec/docker-syncd-centec.mk +++ b/platform/centec/docker-syncd-centec.mk @@ -5,7 +5,9 @@ $(DOCKER_SYNCD_CENTEC)_PATH = $(PLATFORM_PATH)/docker-syncd-centec $(DOCKER_SYNCD_CENTEC)_DEPENDS += $(SYNCD) $(DOCKER_SYNCD_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC) +ifneq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC) +endif $(DOCKER_SYNCD_CENTEC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_CENTEC)_RUN_OPT += --net=host --privileged -t diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index 8c5411454086..e8e55e71e8e5 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -6,3 +6,11 @@ $(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(DOCKER_SYNCD_MLNX_RPC)_FILES += $(MLNX_FW) $(DOCKER_SYNCD_MLNX_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MLNX) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) +endif + +$(DOCKER_SYNCD_MLNX_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 5ea1d7aa556a..2675399b705e 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -6,7 +6,9 @@ $(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(MFT) $(PYTHON_SDK_API) $(DOCKER_SYNCD_MLNX)_FILES += $(MLNX_FW) $(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) +ifneq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) +endif $(DOCKER_SYNCD_MLNX)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_MLNX)_RUN_OPT += --net=host --privileged -t diff --git a/rules/config b/rules/config index e360c7a434c7..4d0fc7801c9a 100644 --- a/rules/config +++ b/rules/config @@ -46,3 +46,7 @@ DEFAULT_PASSWORD = YourPaSsWoRd # Quagga will be the default routing-stack for all the SONiC platforms. Other supported # routing-stacks: frr, gobgp. SONIC_ROUTING_STACK = quagga + +# ENABLE_SYNCD_RPC - build docker-syncd with rpc packages for testing purposes. +# Uncomment to enable: +# ENABLE_SYNCD_RPC = y diff --git a/slave.mk b/slave.mk index 9d9fc126f765..d17aea5722cc 100644 --- a/slave.mk +++ b/slave.mk @@ -67,6 +67,10 @@ ifeq ($(PASSWORD),) override PASSWORD := $(DEFAULT_PASSWORD) endif +ifeq ($(SONIC_ENABLE_SYNCD_RPC),y) +ENABLE_SYNCD_RPC = y +endif + MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) ############################################################################### From b8c11bccf205fd5691368845d3c29a3d4ead0ddf Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 30 May 2017 18:29:18 -0700 Subject: [PATCH 0561/1833] [DHCP Relay]: Listen on all front panel, VLAN and PortChannel interfaces with IPv4 addresses (#645) * DHCP relay now listens on all front panel, VLAN and PortChannel interfaces with IPv4 addresses * Add sample isc-dhcp-relay output file --- dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 24 ++++++++++++++++++- .../tests/sample_output/isc-dhcp-relay | 7 ++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/sonic-config-engine/tests/sample_output/isc-dhcp-relay diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 index aa5e21ac279a..05e633b7602f 100644 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -1,6 +1,28 @@ SERVERS="{{ dhcp_servers | join(' ') }}" -INTERFACES="{{ minigraph_vlan_interfaces[0]['attachto'] }}" +INTERFACES=" +{%- set add_preceding_space = { 'flag': False } %} +{%- for interface in minigraph_interfaces %} +{%- if interface['addr'] | ipv4 %} +{%- if add_preceding_space.flag %} {% endif %} +{{ interface['attachto'] }} +{%- set _dummy = add_preceding_space.update({'flag': True}) %} +{%- endif %} +{%- endfor %} +{%- for vlan_interface in minigraph_vlan_interfaces %} +{%- if vlan_interface['addr'] | ipv4 %} +{%- if add_preceding_space.flag %} {% endif %} +{{ vlan_interface['attachto'] }} +{%- set _dummy = add_preceding_space.update({'flag': True}) %} +{%- endif %} +{%- endfor %} +{%- for pc_interface in minigraph_portchannel_interfaces %} +{%- if pc_interface['addr'] | ipv4 %} +{%- if add_preceding_space.flag %} {% endif %} +{{ pc_interface['attachto'] }} +{%- set _dummy = add_preceding_space.update({'flag': True}) %} +{%- endif %} +{%- endfor %}" # '-a' option provides option 82 circuit id information OPTIONS="-a" diff --git a/src/sonic-config-engine/tests/sample_output/isc-dhcp-relay b/src/sonic-config-engine/tests/sample_output/isc-dhcp-relay new file mode 100644 index 000000000000..4a851af34eb9 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/isc-dhcp-relay @@ -0,0 +1,7 @@ +SERVERS="192.0.0.1 192.0.0.2 192.0.0.3 192.0.0.4 192.0.0.5 192.0.0.6 192.0.0.7 192.0.0.8 192.0.0.9 192.0.0.10 192.0.0.11 192.0.0.12 192.0.0.13 192.0.0.14 192.0.0.15 192.0.0.16 192.0.0.17 192.0.0.18 192.0.0.19 192.0.0.20 192.0.0.21 192.0.0.22 192.0.0.23 192.0.0.24 192.0.0.25 192.0.0.26 192.0.0.27 192.0.0.28 192.0.0.29 192.0.0.30 192.0.0.31 192.0.0.32 192.0.0.33 192.0.0.34 192.0.0.35 192.0.0.36 192.0.0.37 192.0.0.38 192.0.0.39 192.0.0.40 192.0.0.41 192.0.0.42 192.0.0.43 192.0.0.44 192.0.0.45 192.0.0.46 192.0.0.47 192.0.0.48" + +INTERFACES="Vlan1000 PortChannel01 PortChannel02 PortChannel03 PortChannel04" + +# '-a' option provides option 82 circuit id information +OPTIONS="-a" + From 8c11cdfb5d40218ca0e9cd0c63aeb4384eaa1e98 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 30 May 2017 19:29:25 -0700 Subject: [PATCH 0562/1833] [swss]: Update swss/sairedis/common submodules (#646) --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 7acacf385e30..d3a30baea06d 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 7acacf385e30e8525b0816f76963a6a36cb0b27d +Subproject commit d3a30baea06ddc26dfaba03c7002a3ca7f261194 diff --git a/src/sonic-swss b/src/sonic-swss index 03428467606e..83e46ba67e6c 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 03428467606eab9d577bde29316ba98357e7a032 +Subproject commit 83e46ba67e6c77a9c58069acaa090a4cd95e5eb0 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 8bb0c9b8b71b..2f81979f0afc 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 8bb0c9b8b71bffc2f323e6f25504d38ef3a9d9d8 +Subproject commit 2f81979f0afc2de9245ba37e68bed6be71f67108 From c3ef1025472a79df98bdf258cae0fea67c23a7ae Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 30 May 2017 19:29:52 -0700 Subject: [PATCH 0563/1833] [ptf]: Update PTF submodule to include DHCP packet creation changes (#648) --- src/ptf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ptf b/src/ptf index 9e762c9cdb63..f9b910d9fa5d 160000 --- a/src/ptf +++ b/src/ptf @@ -1 +1 @@ -Subproject commit 9e762c9cdb63d7ab9be017a41f638e776f4f0575 +Subproject commit f9b910d9fa5d393a90a1b99c77e7e1b5641a22c9 From 01a716cce24a034a0284355fb1b3a2b042f139cb Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 31 May 2017 10:48:00 -0700 Subject: [PATCH 0564/1833] [src/ptf update]: Submodule update (#652) * Update ptf submodule with ptf_nn_agent fixes --- src/ptf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ptf b/src/ptf index f9b910d9fa5d..aac6efd0a78b 160000 --- a/src/ptf +++ b/src/ptf @@ -1 +1 @@ -Subproject commit f9b910d9fa5d393a90a1b99c77e7e1b5641a22c9 +Subproject commit aac6efd0a78bf51f63727e7a13dc79f91f13686e From 26f98559b09e71df5c8315d264f977e521a8f9ff Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 31 May 2017 10:49:31 -0700 Subject: [PATCH 0565/1833] [docker-ptf]: add hping3 into docker-ptf (#651) --- dockers/docker-ptf/Dockerfile.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 963282b27cb5..c546ad2fab9c 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -44,7 +44,8 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / less \ ipython \ git \ - iputils-ping + iputils-ping \ + hping3 ## Reinstall scapy by version from p4lang RUN git clone https://github.com/p4lang/scapy-vxlan.git && cd scapy-vxlan && python setup.py install From 8adc490fe642e0ea246e82fcd85b263c499dbff5 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 31 May 2017 10:57:31 -0700 Subject: [PATCH 0566/1833] [swss]: Exiting orchagent with unsupported HWSKU (#650) Echo error message to stderr and exit orchagent.sh starting script --- dockers/docker-orchagent/orchagent.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 01959dd66ac4..e1d289ff92a3 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -30,6 +30,9 @@ elif [ "$HWSKU" == "INGRASYS-S8900-54XC" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "INGRASYS-S8900-64XC" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +else + echo "Unsupported HWSKU:$HWSKU. Exiting..." > /dev/stderr + exit 1 fi exec /usr/bin/orchagent ${ORCHAGENT_ARGS} From a5c0dff2096a03f489bca698486dae506c2e9fda Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 31 May 2017 10:57:42 -0700 Subject: [PATCH 0567/1833] [Broadcom]: Update SAI package to 2.1.5.1-8 (#649) Add config_checker/permitted_list Please check etc/bcm/ folder to check the README.msft file! --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 611f80d94583..40ecb64e53b7 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-7-20170519212441.39_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-7-20170519212441.39_amd64.deb?sv=2015-04-05&sr=b&sig=CVc9ldYoy6xdUY0mKg4Rqz4uNDgkTUrPOw1ULrxa8N4%3D&se=2031-01-26T21%3A38%3A42Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-8-20170531021119.40_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-8-20170531021119.40_amd64.deb?sv=2015-04-05&sr=b&sig=rFP9dZ9aXpe3CN5jBVNo6rkgK94%2BJFzMiXd1I2954lU%3D&se=2031-02-07T02%3A13%3A20Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-7-20170519212441.39_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-8-20170531021119.40_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-7-20170519212441.39_amd64.deb?sv=2015-04-05&sr=b&sig=xzCr9xLGF3IaNK8aQGVeU4jY7YkqNEdYAuq5IP2uQM4%3D&se=2031-01-26T21%3A38%3A16Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-8-20170531021119.40_amd64.deb?sv=2015-04-05&sr=b&sig=m5AGCyfLkcYvv8xmY6gPZFiXmygYLQUGfFrEiMO8Jtk%3D&se=2031-02-07T02%3A13%3A55Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From b0c99338a1321381b431fd7dcb633f2036f6f32f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 31 May 2017 19:27:47 -0700 Subject: [PATCH 0568/1833] [Aboot]: Add '--numeric-owner' when untarring docker filesystem to preserve original owners (#653) --- files/Aboot/boot0.j2 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index eca3db743131..7c2d202012fc 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -67,8 +67,12 @@ extract_image() { if [ -n "$sonic_upgrade" ] || [ "$rootfs_type" != "vfat" ]; then mkdir -p "$image_path/{{ DOCKERFS_DIR }}" + if [ -n "$sonic_upgrade" ]; then + TAR_EXTRA_OPTION="--numeric-owner" + fi + ## extract docker archive - tar xf "$image_path/{{ FILESYSTEM_DOCKERFS }}" -C "$image_path/{{ DOCKERFS_DIR }}" + tar xf "$image_path/{{ FILESYSTEM_DOCKERFS }}" -C "$image_path/{{ DOCKERFS_DIR }}" $TAR_EXTRA_OPTION ## clean up docker archive rm -f "$image_path/{{ FILESYSTEM_DOCKERFS }}" From 94c550a3a86512c8778bda0c930ba4bcb63757fb Mon Sep 17 00:00:00 2001 From: Nadiya Date: Thu, 1 Jun 2017 20:54:15 +0300 Subject: [PATCH 0569/1833] [cavium]: Update cavium libsai (#655) Signed-off-by: Nadiya.Stetskovych --- platform/cavium/cavm-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/cavium/cavm-sai.mk b/platform/cavium/cavm-sai.mk index 1b88b1ae1978..82e67035b07b 100644 --- a/platform/cavium/cavm-sai.mk +++ b/platform/cavium/cavm-sai.mk @@ -1,6 +1,6 @@ # Cavium SAI -CAVM_SAI_GITHUB = https://github.com/XPliant/OpenXPS/raw/1b28b78400656114c3b1ce46381e0e8ab3ecd6da/SAI/cavm-sai/ +CAVM_SAI_GITHUB = https://github.com/XPliant/OpenXPS/raw/509de965cf8cc7fcea677b9b4b793612bce40510/SAI/cavm-sai/ CAVM_LIBSAI = libsai.deb CAVM_SAI = sai.deb From a4f5ae799a3e28e2ed3530ed8ac957e1df234c9e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 1 Jun 2017 11:09:21 -0700 Subject: [PATCH 0570/1833] [src/swss]: update submodule (#657) * Update swss --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 83e46ba67e6c..682d7cb3ba5b 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 83e46ba67e6c77a9c58069acaa090a4cd95e5eb0 +Subproject commit 682d7cb3ba5b77520621bc5b3bb0ee84aa501404 From 86f660298a3700d7a09484aa2ee9ed1b39276f31 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 1 Jun 2017 16:18:53 -0700 Subject: [PATCH 0571/1833] [swss]: Update swss/sairedis/common submodules (#654) --- src/sonic-sairedis | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index d3a30baea06d..f02e667d03f7 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit d3a30baea06ddc26dfaba03c7002a3ca7f261194 +Subproject commit f02e667d03f7840132c9dd210254cff2b2e0ad1d diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 2f81979f0afc..9673a7efe9b9 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 2f81979f0afc2de9245ba37e68bed6be71f67108 +Subproject commit 9673a7efe9b99698e45ce7d48efd1ddd5b292033 From 984e6c4bc9c9b357625183477e5c2bd79eb98ca7 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 1 Jun 2017 17:51:12 -0700 Subject: [PATCH 0572/1833] [Broadcom]: Update SAI package (#659) Add Ingrasys config.bcm files --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 40ecb64e53b7..f08721d6140e 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-8-20170531021119.40_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-8-20170531021119.40_amd64.deb?sv=2015-04-05&sr=b&sig=rFP9dZ9aXpe3CN5jBVNo6rkgK94%2BJFzMiXd1I2954lU%3D&se=2031-02-07T02%3A13%3A20Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-9-20170531184746.41_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-9-20170531184746.41_amd64.deb?sv=2015-04-05&sr=b&sig=VD4QFYR4J5nJPdS6ZHyfKbdroTILV%2Fz6s%2F251NWpyaE%3D&se=2031-02-08T18%3A26%3A35Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-8-20170531021119.40_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-9-20170531184746.41_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-8-20170531021119.40_amd64.deb?sv=2015-04-05&sr=b&sig=m5AGCyfLkcYvv8xmY6gPZFiXmygYLQUGfFrEiMO8Jtk%3D&se=2031-02-07T02%3A13%3A55Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-9-20170531184746.41_amd64.deb?sv=2015-04-05&sr=b&sig=baUDbmm7PzF7Y7Y8Lz%2B759Xl1vhOkcnPBcqd6ZWWwSA%3D&se=2031-02-08T18%3A26%3A58Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From e0d22acc9e94f657f71825d9efd2ae01f270c2e2 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 1 Jun 2017 18:38:33 -0700 Subject: [PATCH 0573/1833] [DHCP Relay]: Wait for all interfaces to come up before starting DHCP relay (#660) --- dockers/docker-dhcp-relay/start.sh | 33 ++++++++++++++++++--- files/build_templates/dhcp_relay.service.j2 | 2 +- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index 6daff96d0129..a847428ffba6 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -1,16 +1,41 @@ #!/usr/bin/env bash +function wait_until_iface_exists +{ + IFACE=$1 + + echo "Waiting for interface ${IFACE}..." + + # Wait for the interface to come up (i.e., 'ip link show' returns 0) + until ip link show $IFACE > /dev/null 2>&1; do + sleep 1 + done + + echo "Interface ${IFACE} is created" +} + +# Create isc-dhcp-relay config file sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd -VLAN_IFACE_NAME=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_vlan_interfaces[0]['attachto']"` +# Wait for all interfaces to come up before starting the DHCP relay + +FRONT_PANEL_IFACES=$(sonic-cfggen -m /etc/sonic/minigraph.xml --var-json "minigraph_interfaces" | grep "\"attachto\":" | sed 's/^\s*"attachto":\s"\(.*\)".*$/\1/') +for IFACE in $FRONT_PANEL_IFACES; do + wait_until_iface_exists $IFACE +done + +VLAN_IFACES=$(sonic-cfggen -m /etc/sonic/minigraph.xml --var-json "minigraph_vlan_interfaces" | grep "\"attachto\":" | sed 's/^\s*"attachto":\s"\(.*\)".*$/\1/') +for IFACE in $VLAN_IFACES; do + wait_until_iface_exists $IFACE +done -# Wait for the VLAN to come up (i.e., 'ip link show' returns 0) -until ip link show $VLAN_IFACE_NAME > /dev/null 2>&1; do - sleep 1 +PORTCHANNEL_IFACES=$(sonic-cfggen -m /etc/sonic/minigraph.xml --var-json "minigraph_portchannel_interfaces" | grep "\"attachto\":" | sed 's/^\s*"attachto":\s"\(.*\)".*$/\1/') +for IFACE in $PORTCHANNEL_IFACES; do + wait_until_iface_exists $IFACE done # Start the DHCP relay diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index c0e993eec065..c1499c8f8797 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=DHCP relay container Requires=docker.service -After=interfaces-config.service +After=swss.service [Service] User={{ sonicadmin_user }} From 7d33387e7c96bc2e21011f2def25f3968462cbc7 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 2 Jun 2017 01:31:53 -0700 Subject: [PATCH 0574/1833] [platform] Complete support for Arista-7050QX-32S (#661) * Bump sonic-platform-modules-arista submodule * Use sonic_sfputil plugin from the arista library * Fix undefined variable varlog_size * Prevent minigraph.xml to be removed from the flash * Update DCS-7050QX-32 sensors config --- .../plugins/sfputil.py | 22 +-------- .../x86_64-arista_7050_qx32/sensors.conf | 47 ++++++++++--------- .../plugins/sfputil.py | 25 +--------- .../plugins/sfputil.py | 23 +-------- files/Aboot/boot0.j2 | 11 +++-- files/initramfs-tools/arista-convertfs.j2 | 2 +- .../broadcom/sonic-platform-modules-arista | 2 +- 7 files changed, 41 insertions(+), 91 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py b/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py index 5d2d28b8f328..b85e0f53653e 100644 --- a/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py +++ b/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py @@ -1,27 +1,9 @@ #!/usr/bin/env python try: - from sonic_sfp.sfputilbase import sfputilbase + import arista.utils.sonic_sfputil as arista_sfputil except ImportError, e: raise ImportError (str(e) + "- required module not found") -class sfputil(sfputilbase): - """Platform specific sfputil class""" - - port_start = 0 - port_end = 31 - ports_in_block = 32 - - eeprom_offset = 10 - - port_to_eeprom_mapping = {} - - _qsfp_ports = range(0, ports_in_block + 1) - - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' - for x in range(0, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) - sfputilbase.__init__(self, port_num) +sfputil = arista_sfputil.getSfpUtil() diff --git a/device/arista/x86_64-arista_7050_qx32/sensors.conf b/device/arista/x86_64-arista_7050_qx32/sensors.conf index 7745054a05ca..dde0d35df8cb 100644 --- a/device/arista/x86_64-arista_7050_qx32/sensors.conf +++ b/device/arista/x86_64-arista_7050_qx32/sensors.conf @@ -1,7 +1,7 @@ -# libsensors configuration file -# ---------------------------------------------- -# - +# libsensors configuration file for DCS-7050QX-32 +# ------------------------------------------------ +# + bus "i2c-2" "SCD SMBus master 0 bus 0" bus "i2c-3" "SCD SMBus master 0 bus 1" bus "i2c-5" "SCD SMBus master 0 bus 3" @@ -13,31 +13,33 @@ chip "k10temp-pci-00c3" chip "lm73-i2c-3-48" label temp1 "Rear Temp Sensor" - set temp1_max 65 + set temp1_max 65 #set temp1_max_alarm 75 # read-only -chip "lm86-i2c-2-4c" +chip "max6658-i2c-2-4c" label temp1 "Board Temp Sensor" - set temp1_max 65 + set temp1_max 65 set temp1_crit 75 label temp2 "Front-panel Temp Sensor" set temp2_max 65 set temp2_crit 75 - -chip "pmbus-i2c-3-4e" - label temp1 "Power Controller Sensor 1" - set temp1_max 60 - set temp1_crit 70 - - label temp2 "Power Controller Sensor 2" - set temp2_max 60 - set temp2_crit 70 - ignore curr1 - -chip "pmbus-i2c-5-58" +# disabled because of some eeprom corruption risks +#chip "pmbus-i2c-3-4e" +# label temp1 "Power Controller Sensor 1" +# set temp1_max 60 +# set temp1_crit 70 + +# label temp2 "Power Controller Sensor 2" +# set temp2_max 60 +# set temp2_crit 70 + +# ignore curr1 + +chip "dps460-i2c-5-58" label temp1 "Power Supply 1 Sensor 1" + # maximum and critical thresholds are not supported for this psu set temp1_max 60 set temp1_crit 70 @@ -56,16 +58,17 @@ chip "pmbus-i2c-5-58" set curr1_crit 5.30 set curr2_max 36 set curr2_crit 37 - -chip "pmbus-i2c-6-58" + +chip "dps460-i2c-6-58" label temp1 "Power Supply 2 Sensor 1" + # maximum and critical thresholds are not supported for this psu set temp1_max 60 set temp1_crit 70 label temp2 "Power Supply 2 Sensor 2" set temp2_max 60 set temp2_crit 70 - + ignore temp3 set in1_max 250 diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py b/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py index 18472c44c55b..b85e0f53653e 100644 --- a/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py @@ -1,30 +1,9 @@ #!/usr/bin/env python try: - from sonic_sfp.sfputilbase import sfputilbase + import arista.utils.sonic_sfputil as arista_sfputil except ImportError, e: raise ImportError (str(e) + "- required module not found") -class sfputil(sfputilbase): - """Platform specific sfputil class""" - - port_start = 0 - port_end = 31 - ports_in_block = 32 - - eeprom_offset = 10 - - port_to_eeprom_mapping = {} - - _qsfp_ports = range(0, ports_in_block + 1) - - # also has sfp[1-4] ports handled by a mux to choose against qsfp5 - # i2c-40 to i2c-43 - - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' - for x in range(0, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) - sfputilbase.__init__(self, port_num) +sfputil = arista_sfputil.getSfpUtil() diff --git a/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py b/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py index 0f7f0d2cac85..b85e0f53653e 100644 --- a/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py +++ b/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py @@ -1,28 +1,9 @@ #!/usr/bin/env python try: - from sonic_sfp.sfputilbase import sfputilbase + import arista.utils.sonic_sfputil as arista_sfputil except ImportError, e: raise ImportError (str(e) + "- required module not found") -class sfputil(sfputilbase): - """Platform specific sfputil class""" - - port_start = 0 - port_end = 33 - ports_in_block = 34 - - eeprom_offset = 18 - - port_to_eeprom_mapping = {} - - _qsfp_ports = range(0, 32 + 1) - _sfp_ports = range(33, 34 + 1) - - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' - for x in range(0, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) - sfputilbase.__init__(self, port_num) +sfputil = arista_sfputil.getSfpUtil() diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 7c2d202012fc..48c5c5010213 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -44,7 +44,10 @@ parse_environment_config() { clean_flash() { ## Remove all the other unnecssary files except swi file, boot-config for f in $(ls -A $target_path); do - if [ $f != "${swipath##*/}" ] && [ $f != "boot-config" ]; then + if [ $f != "${swipath##*/}" ] && + [ $f != "boot-config" ] && + [ $f != "minigraph.xml" ] + then rm -rf "$target_path/$f" fi done @@ -104,6 +107,10 @@ EOF platform_specific() { local platform="$(grep -Eo 'platform=[^ ]+' /etc/cmdline | cut -f2 -d=)" local sid="$(grep -Eo 'sid=[^ ]+' /etc/cmdline | cut -f2 -d=)" + + # set varlog size to 100MB + echo "varlog_size=100" >>/tmp/append + # This is temporary as the platform= and sid= parameters don't provide enough # information to identify the SKU # An initramfs hook or a later processing done by the initscripts will be @@ -111,8 +118,6 @@ platform_specific() { if [ "$platform" = "raven" ]; then aboot_machine=arista_7050_qx32 echo "modprobe.blacklist=radeon" >>/tmp/append - # set varlog size to 100MB - echo "varlog_size=100" >>/tmp/append fi if [ "$platform" = "crow" ]; then aboot_machine=arista_7050_qx32s diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 7f873e7771f3..a15233615f98 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -84,7 +84,7 @@ run_cmd() { create_varlog_file() { local err_msg="Error: create var-log ext4 file" - local cmd="[ -n $varlog_size ] && mkdir -p $root_mnt/disk-img && dd if=/dev/zero of=$root_mnt/disk-img/var-log.ext4 count=$((2048*$varlog_size)) && mke2fs -t ext4 -q -F $root_mnt/disk-img/var-log.ext4" + local cmd="[ -n "$varlog_size" ] && mkdir -p $root_mnt/disk-img && dd if=/dev/zero of=$root_mnt/disk-img/var-log.ext4 count=$((2048*$varlog_size)) && mke2fs -t ext4 -q -F $root_mnt/disk-img/var-log.ext4" run_cmd "$cmd" "$err_msg" } diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 43ed7b2330f2..393e5e1f19fd 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 43ed7b2330f2c7928f8098ca6c78bd9533b918c5 +Subproject commit 393e5e1f19fd33853bb375d70a10fa7cf4613e4a From cd0159ec62154e6ad4218f08b0e5863be89419e2 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Fri, 2 Jun 2017 19:59:50 +0300 Subject: [PATCH 0575/1833] [platform] Control only 2 thermals (4A & 4B) (#663) Signed-off-by: Nadiya.Stetskovych --- device/accton/x86_64-accton_as7512_32x-r0/fancontrol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/accton/x86_64-accton_as7512_32x-r0/fancontrol b/device/accton/x86_64-accton_as7512_32x-r0/fancontrol index 899d2db79228..c80163771e86 100644 --- a/device/accton/x86_64-accton_as7512_32x-r0/fancontrol +++ b/device/accton/x86_64-accton_as7512_32x-r0/fancontrol @@ -1,5 +1,5 @@ INTERVAL=10 -FCTEMPS=/sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/3-0048/hwmon/hwmon[[:print:]]*/temp1_input /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/3-0049/hwmon/hwmon[[:print:]]*/temp1_input /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/3-004a/hwmon/hwmon[[:print:]]*/temp1_input +FCTEMPS=/sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/3-004b/hwmon/hwmon[[:print:]]*/temp1_input /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/3-004a/hwmon/hwmon[[:print:]]*/temp1_input FCFANS=/sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan1_front_speed_rpm /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan2_front_speed_rpm /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan3_front_speed_rpm /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan4_front_speed_rpm /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan5_front_speed_rpm /sys/bus/i2c/devices/2-0066/fan_pwm=/sys/bus/i2c/devices/2-0066/fan6_front_speed_rpm MINTEMP=/sys/bus/i2c/devices/2-0066/fan_pwm=20 MAXTEMP=/sys/bus/i2c/devices/2-0066/fan_pwm=60 From 5f8e495cb0ba20e89809e7ef511cea3ce3dfa388 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 2 Jun 2017 23:33:37 -0700 Subject: [PATCH 0576/1833] [Broadcom]: Update SAI package (#665) Increase the maximum logical ports supported to prevent TH initialization crash --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index f08721d6140e..a75952e2f72c 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-9-20170531184746.41_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-9-20170531184746.41_amd64.deb?sv=2015-04-05&sr=b&sig=VD4QFYR4J5nJPdS6ZHyfKbdroTILV%2Fz6s%2F251NWpyaE%3D&se=2031-02-08T18%3A26%3A35Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-10-20170602191744.42_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-10-20170602191744.42_amd64.deb?sv=2015-04-05&sr=b&sig=aSmyd3pgiI2LkssoqGY6PDDhFKvWS2RxFB%2Bcpe%2FRiCg%3D&se=2031-02-09T19%3A29%3A48Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-9-20170531184746.41_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-10-20170602191744.42_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-9-20170531184746.41_amd64.deb?sv=2015-04-05&sr=b&sig=baUDbmm7PzF7Y7Y8Lz%2B759Xl1vhOkcnPBcqd6ZWWwSA%3D&se=2031-02-08T18%3A26%3A58Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-10-20170602191744.42_amd64.deb?sv=2015-04-05&sr=b&sig=NSJ96np%2FHmXJdMN3Dnzp8UHBlo4OUiG00ETejp7wARI%3D&se=2031-02-09T19%3A30%3A14Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From 8944ee64f5ae3d20799e49f7dd02fec5312ebb99 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sat, 3 Jun 2017 12:44:34 -0700 Subject: [PATCH 0577/1833] [Facebook]: Add Facebook Wedge 100 support (#666) - Add a sample minigraph and Facebook-W100-C32 HWSKU - update orchagent.sh script --- .../Facebook-W100-C32/port_config.ini | 33 ++++ .../Facebook-W100-C32/sai.profile | 1 + .../x86_64-facebook_wedge100-r0/minigraph.xml | 151 ++++++++++++++++++ dockers/docker-orchagent/orchagent.sh | 2 + 4 files changed, 187 insertions(+) create mode 100644 device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/port_config.ini create mode 100644 device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/sai.profile create mode 100644 device/facebook/x86_64-facebook_wedge100-r0/minigraph.xml diff --git a/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/port_config.ini b/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/port_config.ini new file mode 100644 index 000000000000..973e47589aaa --- /dev/null +++ b/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 117,118,119,120 +Ethernet4 113,114,115,116 +Ethernet8 125,126,127,128 +Ethernet12 121,122,123,124 +Ethernet16 5,6,7,8 +Ethernet20 1,2,3,4 +Ethernet24 13,14,15,16 +Ethernet28 9,10,11,12 +Ethernet32 21,22,23,24 +Ethernet36 17,18,19,20 +Ethernet40 29,30,31,32 +Ethernet44 25,26,27,28 +Ethernet48 37,38,39,40 +Ethernet52 33,34,35,36 +Ethernet56 45,46,47,48 +Ethernet60 41,42,43,44 +Ethernet64 53,54,55,56 +Ethernet68 49,50,51,52 +Ethernet72 61,62,63,64 +Ethernet76 57,58,59,60 +Ethernet80 69,70,71,72 +Ethernet84 65,66,67,68 +Ethernet88 77,78,79,80 +Ethernet92 73,74,75,76 +Ethernet96 85,86,87,88 +Ethernet100 81,82,83,84 +Ethernet104 93,94,95,96 +Ethernet108 89,90,91,92 +Ethernet112 101,102,103,104 +Ethernet116 97,98,99,100 +Ethernet120 109,110,111,112 +Ethernet124 105,106,107,108 diff --git a/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/sai.profile b/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/sai.profile new file mode 100644 index 000000000000..5c93f84deb0b --- /dev/null +++ b/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-wedge100-32x100G.config.bcm diff --git a/device/facebook/x86_64-facebook_wedge100-r0/minigraph.xml b/device/facebook/x86_64-facebook_wedge100-r0/minigraph.xml new file mode 100644 index 000000000000..2e9c121e0b36 --- /dev/null +++ b/device/facebook/x86_64-facebook_wedge100-r0/minigraph.xml @@ -0,0 +1,151 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + SONiC-Facebook-Wedge100 + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + SONiC-Facebook-Wedge100 + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + SONiC-Facebook-Wedge100 + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + SONiC-Facebook-Wedge100 + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + SONiC-Facebook-Wedge100 + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + SONiC-Facebook-Wedge100 + Ethernet4 + + + + + SONiC-Facebook-Wedge100 + Facebook-W100-C32 + + + + + + + SONiC-Facebook-Wedge100 + + + 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-Facebook-Wedge100 + Facebook-W100-C32 +
diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index e1d289ff92a3..5c2cd06748cb 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -30,6 +30,8 @@ elif [ "$HWSKU" == "INGRASYS-S8900-54XC" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$HWSKU" == "INGRASYS-S8900-64XC" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$HWSKU" == "Facebook-W100-C32" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" else echo "Unsupported HWSKU:$HWSKU. Exiting..." > /dev/stderr exit 1 From c3aa513dae62ccc9b101170777a48a84ab371d31 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sat, 3 Jun 2017 13:49:33 -0700 Subject: [PATCH 0578/1833] [swss]: Update orchagent.sh script to use asic_type to add arguments (#667) - Right now Broadcom and Cavium platforms need to set MAC address when starting orchagent daemon. --- dockers/docker-orchagent/orchagent.sh | 30 ++++----------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 5c2cd06748cb..9cbb22988ac6 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` +ASIC=`sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type` MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` @@ -8,33 +8,11 @@ MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` mkdir -p /var/log/swss ORCHAGENT_ARGS="-d /var/log/swss " -if [ "$HWSKU" == "Force10-S6000" ]; then +# Add platform specific arguments if necessary +if [ "$ASIC" == "broadcom" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "Force10-S6000-Q32" ]; then +elif [ "$ASIC" == "cavium" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "Force10-S6100" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "Force10-Z9100" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "Arista-7050-QX32" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "Arista-7050-QX32S" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "AS7512" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "INGRASYS-S9100-C32" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "INGRASYS-S8900-54XC" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "INGRASYS-S8900-64XC" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$HWSKU" == "Facebook-W100-C32" ]; then - ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -else - echo "Unsupported HWSKU:$HWSKU. Exiting..." > /dev/stderr - exit 1 fi exec /usr/bin/orchagent ${ORCHAGENT_ARGS} From d8c55840d0c07e6d3ab43b61c0bf0d70d81d8401 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sun, 4 Jun 2017 01:35:47 -0700 Subject: [PATCH 0579/1833] [swss]: Update swss/common and add --batch_size 8192 option to orchagent (#668) --- dockers/docker-orchagent/orchagent.sh | 3 +++ src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 9cbb22988ac6..01b980b99c1a 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -8,6 +8,9 @@ MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` mkdir -p /var/log/swss ORCHAGENT_ARGS="-d /var/log/swss " +# Set orchagent pop batch size to 8192 +ORCHAGENT_ARGS+="-b 8192 " + # Add platform specific arguments if necessary if [ "$ASIC" == "broadcom" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" diff --git a/src/sonic-swss b/src/sonic-swss index 682d7cb3ba5b..b893b4f70b79 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 682d7cb3ba5b77520621bc5b3bb0ee84aa501404 +Subproject commit b893b4f70b79f5a87674e3a67a64accff0dd9437 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 9673a7efe9b9..ececc0a99ce1 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 9673a7efe9b99698e45ce7d48efd1ddd5b292033 +Subproject commit ececc0a99ce1c188007b5b59de1bb11a06dd006d From aabe9677f2ed707b475618c1f7cda8be10a6f84e Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Tue, 6 Jun 2017 01:38:47 -0400 Subject: [PATCH 0580/1833] [sonic-utilities]: update submodule (#672) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index de5c31874bb8..c1b48a6a28f9 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit de5c31874bb89c62d50efec6d8541e85fe678548 +Subproject commit c1b48a6a28f9897ebfebf9989b5cb4a472cf1967 From b55ab4614bd8442cf5ea3387094862771aba5945 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 5 Jun 2017 22:41:20 -0700 Subject: [PATCH 0581/1833] [Broadcom]: Update SAI package to support Arista-7050-QX32S (#671) --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index a75952e2f72c..74baaa712f10 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-10-20170602191744.42_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-10-20170602191744.42_amd64.deb?sv=2015-04-05&sr=b&sig=aSmyd3pgiI2LkssoqGY6PDDhFKvWS2RxFB%2Bcpe%2FRiCg%3D&se=2031-02-09T19%3A29%3A48Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-11-20170605231900.43_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-11-20170605231900.43_amd64.deb?sv=2015-04-05&sr=b&sig=NNBDS1OSXn2w4dNSbqBbJnqXTrqH7YAkKIa%2Fi9yaOJs%3D&se=2031-02-12T23%3A22%3A01Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-10-20170602191744.42_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-11-20170605231900.43_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-10-20170602191744.42_amd64.deb?sv=2015-04-05&sr=b&sig=NSJ96np%2FHmXJdMN3Dnzp8UHBlo4OUiG00ETejp7wARI%3D&se=2031-02-09T19%3A30%3A14Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-11-20170605231900.43_amd64.deb?sv=2015-04-05&sr=b&sig=jxozueiuQdOuJdEfC9%2BWSfFXSL68FQVwL%2FM5Obfj3gs%3D&se=2031-02-12T23%3A21%3A35Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From fedfb82ebf3c44d1393232195aececee2294ed5c Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 5 Jun 2017 22:41:39 -0700 Subject: [PATCH 0582/1833] [Arista]: Update port_config.ini file for Arista-7050-QX32S (#674) --- .../Arista-7050-QX32S/port_config.ini | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/port_config.ini index b56d958499d4..5f29d189f352 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/port_config.ini @@ -1,33 +1,33 @@ # name lanes alias -Ethernet0 9,10,11,12 Ethernet5/1 -Ethernet4 13,14,15,16 Ethernet6/1 -Ethernet8 17,18,19,20 Ethernet7/1 -Ethernet12 21,22,23,24 Ethernet8/1 -Ethernet16 29,30,31,32 Ethernet9/1 -Ethernet20 25,26,27,28 Ethernet10/1 -Ethernet24 33,34,35,36 Ethernet11/1 -Ethernet28 37,38,39,40 Ethernet12/1 -Ethernet32 45,46,47,48 Ethernet13/1 -Ethernet36 41,42,43,44 Ethernet14/1 -Ethernet40 49,50,51,52 Ethernet15/1 -Ethernet44 53,54,55,56 Ethernet16/1 -Ethernet48 69,70,71,72 Ethernet17/1 -Ethernet52 65,66,67,68 Ethernet18/1 -Ethernet56 73,74,75,76 Ethernet19/1 -Ethernet60 77,78,79,80 Ethernet20/1 -Ethernet64 93,94,95,96 Ethernet21/1 -Ethernet68 89,90,91,92 Ethernet22/1 -Ethernet72 97,98,99,100 Ethernet23/1 -Ethernet76 101,102,103,104 Ethernet24/1 -Ethernet80 109,110,111,112 Ethernet25/1 -Ethernet84 105,106,107,108 Ethernet26/1 -Ethernet88 121,122,123,124 Ethernet27/1 -Ethernet92 125,126,127,128 Ethernet28/1 -Ethernet96 61,62,63,64 Ethernet29 -Ethernet100 57,58,59,60 Ethernet30 -Ethernet104 81,82,83,84 Ethernet31 -Ethernet108 85,86,87,88 Ethernet32 -Ethernet112 117,118,119,120 Ethernet33 -Ethernet116 113,114,115,116 Ethernet34 -Ethernet120 1,2,3,4 Ethernet35 -Ethernet124 5,6,7,8 Ethernet36 +Ethernet0 9,10,11,12 Ethernet1/1 +Ethernet4 13,14,15,16 Ethernet2/1 +Ethernet8 17,18,19,20 Ethernet3/1 +Ethernet12 21,22,23,24 Ethernet4/1 +Ethernet16 29,30,31,32 Ethernet5/1 +Ethernet20 25,26,27,28 Ethernet6/1 +Ethernet24 33,34,35,36 Ethernet7/1 +Ethernet28 37,38,39,40 Ethernet8/1 +Ethernet32 45,46,47,48 Ethernet9/1 +Ethernet36 41,42,43,44 Ethernet10/1 +Ethernet40 49,50,51,52 Ethernet11/1 +Ethernet44 53,54,55,56 Ethernet12/1 +Ethernet48 69,70,71,72 Ethernet13/1 +Ethernet52 65,66,67,68 Ethernet14/1 +Ethernet56 73,74,75,76 Ethernet15/1 +Ethernet60 77,78,79,80 Ethernet16/1 +Ethernet64 93,94,95,96 Ethernet17/1 +Ethernet68 89,90,91,92 Ethernet18/1 +Ethernet72 97,98,99,100 Ethernet19/1 +Ethernet76 101,102,103,104 Ethernet20/1 +Ethernet80 109,110,111,112 Ethernet21/1 +Ethernet84 105,106,107,108 Ethernet22/1 +Ethernet88 121,122,123,124 Ethernet23/1 +Ethernet92 125,126,127,128 Ethernet24/1 +Ethernet96 61,62,63,64 Ethernet25 +Ethernet100 57,58,59,60 Ethernet26 +Ethernet104 81,82,83,84 Ethernet27 +Ethernet108 85,86,87,88 Ethernet28 +Ethernet112 117,118,119,120 Ethernet29 +Ethernet116 113,114,115,116 Ethernet30 +Ethernet120 1,2,3,4 Ethernet31 +Ethernet124 5,6,7,8 Ethernet32 From b968cf73a199f485dccacfd5353ec55dfd36c0c0 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 6 Jun 2017 10:41:06 -0700 Subject: [PATCH 0583/1833] [aboot]: use pipe to extract docker archive to save disk space (#677) --- files/Aboot/boot0.j2 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 48c5c5010213..f278f1070fb1 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -57,11 +57,8 @@ extract_image() { mkdir -p "$image_path" - ## Unzip the image - unzip -oq "$swipath" -x boot0 -d "$image_path" - - ## Remove installer swi as it has lots of redundunt contents - rm -f $swipath + ## Unzip the image except boot0 and dockerfs archive + unzip -oq "$swipath" -x boot0 {{ FILESYSTEM_DOCKERFS }} -d "$image_path" ## detect rootfs type rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3` @@ -75,17 +72,19 @@ extract_image() { fi ## extract docker archive - tar xf "$image_path/{{ FILESYSTEM_DOCKERFS }}" -C "$image_path/{{ DOCKERFS_DIR }}" $TAR_EXTRA_OPTION - - ## clean up docker archive - rm -f "$image_path/{{ FILESYSTEM_DOCKERFS }}" + unzip -oqp "$swipath" {{ FILESYSTEM_DOCKERFS }} | tar xzf - -C "$image_path/{{ DOCKERFS_DIR }}" $TAR_EXTRA_OPTION else + ## save dockerfs archive in the image directory + unzip -oq "$swipath" {{ FILESYSTEM_DOCKERFS }} -d "$image_path" echo "$target_path is $rootfs_type, extract {{ FILESYSTEM_DOCKERFS }} in later stage" fi ## use new reduced-size boot swi echo "SWI=flash:image-%%IMAGE_VERSION%%/{{ ABOOT_BOOT_IMAGE }}" > "$target_path/boot-config" + ## Remove installer swi as it has lots of redundunt contents + rm -f "$swipath" + ## sync disk operations sync } From 820e7aafd031db7458a92f6cbdabb0ae06a4b891 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 7 Jun 2017 02:13:38 +0300 Subject: [PATCH 0584/1833] [docker-teamd]: Explicitly set LAG hwaddr (#664) * [docker-teamd]: Explicitly set LAG hwaddr Team device is initially created without any members and has a random HW address, which is later changed to port's address. This configuration sets team device's address explicitly to base MAC to avoid reassignment. Signed-off-by: marian-pritsak * Update teamd config tests with hwaddr Signed-off-by: marian-pritsak * Align HW addr byte for Centec and Mellanox Signed-off-by: marian-pritsak * Change HW addr to unicast in config tests Signed-off-by: marian-pritsak --- dockers/docker-teamd/start.sh | 12 +++++++++++- dockers/docker-teamd/teamd.j2 | 1 + .../tests/sample_output/PortChannel01.conf | 1 + .../tests/sample_output/PortChannel02.conf | 1 + .../tests/sample_output/PortChannel03.conf | 1 + .../tests/sample_output/PortChannel04.conf | 1 + src/sonic-config-engine/tests/test_j2files.py | 2 +- 7 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index 77a3ff43be85..0f6a8c9f9ceb 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -5,8 +5,18 @@ TEAMD_CONF_PATH=/etc/teamd rm -rf $TEAMD_CONF_PATH mkdir -p $TEAMD_CONF_PATH +SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) +MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') + +# Align last byte +if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then + last_byte=$(python -c "print '$MAC_ADDRESS'[-2:]") + aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix + MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC +fi + for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannels.keys() | join(' ')"`; do - sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf + sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf done mkdir -p /var/sonic diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 index e2ef239c8266..08a3415f5188 100644 --- a/dockers/docker-teamd/teamd.j2 +++ b/dockers/docker-teamd/teamd.j2 @@ -1,5 +1,6 @@ { "device": "{{ pc }}", + "hwaddr": "{{ hwaddr }}", "runner": { "name": "lacp", "active": true, diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel01.conf b/src/sonic-config-engine/tests/sample_output/PortChannel01.conf index 95369ce06a2e..d69c0d6697b2 100644 --- a/src/sonic-config-engine/tests/sample_output/PortChannel01.conf +++ b/src/sonic-config-engine/tests/sample_output/PortChannel01.conf @@ -1,5 +1,6 @@ { "device": "PortChannel01", + "hwaddr": "e4:1d:2d:a5:f3:ad", "runner": { "name": "lacp", "active": true, diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel02.conf b/src/sonic-config-engine/tests/sample_output/PortChannel02.conf index 960ca2d0db65..e9b2ff4f1ad9 100644 --- a/src/sonic-config-engine/tests/sample_output/PortChannel02.conf +++ b/src/sonic-config-engine/tests/sample_output/PortChannel02.conf @@ -1,5 +1,6 @@ { "device": "PortChannel02", + "hwaddr": "e4:1d:2d:a5:f3:ad", "runner": { "name": "lacp", "active": true, diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel03.conf b/src/sonic-config-engine/tests/sample_output/PortChannel03.conf index d26ad7795e54..a73617abade0 100644 --- a/src/sonic-config-engine/tests/sample_output/PortChannel03.conf +++ b/src/sonic-config-engine/tests/sample_output/PortChannel03.conf @@ -1,5 +1,6 @@ { "device": "PortChannel03", + "hwaddr": "e4:1d:2d:a5:f3:ad", "runner": { "name": "lacp", "active": true, diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel04.conf b/src/sonic-config-engine/tests/sample_output/PortChannel04.conf index 76c97b3f7c03..073b8057d461 100644 --- a/src/sonic-config-engine/tests/sample_output/PortChannel04.conf +++ b/src/sonic-config-engine/tests/sample_output/PortChannel04.conf @@ -1,5 +1,6 @@ { "device": "PortChannel04", + "hwaddr": "e4:1d:2d:a5:f3:ad", "runner": { "name": "lacp", "active": true, diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 6ea49efc75f2..2a8c7a35688f 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -37,7 +37,7 @@ def test_teamd(self): def test_render_teamd(self, pc): teamd_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-teamd', 'teamd.j2') sample_output_file = os.path.join(self.test_dir, 'sample_output',pc + '.conf') - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -a \'{\"pc\":\"' + pc + '\"}\' -t ' + teamd_file + ' > ' + self.output_file + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -a \'{\"pc\":\"' + pc + '\",\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + teamd_file + ' > ' + self.output_file self.run_script(argument) assert filecmp.cmp(sample_output_file, self.output_file) From e74196cd75ed1c8bb2556c2ee0199d03bad98dc2 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 6 Jun 2017 17:12:26 -0700 Subject: [PATCH 0585/1833] [baseos] Avoid disconnecting mgmt when re-cfg interfaces (#553) * [baseos] Avoid disconnecting mgmt when recfg interfaces * Kill dhclient after interfaces-config --- files/image_config/interfaces/interfaces-config.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 3e2f852c1263..f966e82e8030 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,5 +1,12 @@ #!/bin/bash +ifdown -a -X eth0 sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces -service networking restart -ifdown lo && ifup lo +ifup -a -X eth0 + +NEW_MGMT_IP=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_mgmt_interface["addr"]'` +NEW_MGMT_MASK=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_mgmt_interface["mask"]'` + +ifconfig eth0 $NEW_MGMT_IP netmask $NEW_MGMT_MASK +[ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid + From ec273c88920e66dc2daa1bfb2703774b3861255a Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 6 Jun 2017 22:58:58 -0700 Subject: [PATCH 0586/1833] Disable snmpd native ipCidrRouteTable implementation (#675) The SNMP subagent implements ipCidrRouteTable. If there is no nexthops for default route, ie. switch isolated, the SNMP subagent will response 'no instance'. Then snmpd will response kernel routes, which include non-front panel interfaces. To remove snmpd native implementation, we only expose SNMP subagent's implementation. --- dockers/docker-snmp-sv2/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index 624b61f96225..6c3685b32cdb 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:snmpd] -command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ip -p /run/snmpd.pid +command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip -p /run/snmpd.pid priority=3 autostart=false autorestart=false From 67acc0171b6022631ca53bfc2ece2fb8b0ec6b02 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 7 Jun 2017 00:41:25 -0700 Subject: [PATCH 0587/1833] [platform]: update platform modules for dell s6100 and z9100 (#679) --- platform/broadcom/sonic-platform-modules-dell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index af6556c488e7..6cff8248fa8c 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit af6556c488e7fbe0f0c074fb6cc32d27bf40cc83 +Subproject commit 6cff8248fa8c772a077bf3dcb5c86a376357f261 From 50aba596a919fae7b0deb058d3ee093c9bfcade6 Mon Sep 17 00:00:00 2001 From: wadelnn Date: Thu, 8 Jun 2017 01:29:19 +0800 Subject: [PATCH 0588/1833] [platform]: Update submodule platform/broadcom/sonic-platform-modules-ingrasys (#670) * Update submodule platform/broadcom/sonic-platform-modules-ingrasys * Fixed FAN Status Setup Error. * Add Drivers deinitialization feature. * Allow for updating drivers on a running system. * Let fans returned to full speed when driver uninstalled. * Change S8900-64XC fancontrol config * Delete S9100 syncd.conf Signed-off-by: Wade He * Update submodule * Fixed build error in fsroot on different kernel versions between host and rootfs. * Fixed Read HW Revision in CPLD. * rmmod check to avoid error. Signed-off-by: Wade He --- .../x86_64-ingrasys_s8900_64xc-r0/fancontrol | 16 ++++++++-------- .../ingrasys/x86_64-ingrasys_s9100-r0/syncd.conf | 1 - .../broadcom/sonic-platform-modules-ingrasys | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/syncd.conf diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol index 938440304540..d5d5fa82b2d2 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol @@ -1,11 +1,11 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 -DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f -DEVNAME=hwmon1=w83795adg -FCTEMPS=hwmon1/device/pwm1=hwmon1/device/temp2_input hwmon1/device/pwm2=hwmon1/device/temp2_input -FCFANS=hwmon1/device/pwm2=hwmon1/device/fan10_input hwmon1/device/pwm2=hwmon1/device/fan9_input hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input -MINTEMP=hwmon1/device/pwm1=20 hwmon1/device/pwm2=20 -MAXTEMP=hwmon1/device/pwm1=60 hwmon1/device/pwm2=60 -MINSTART=hwmon1/device/pwm1=150 hwmon1/device/pwm2=150 -MINSTOP=hwmon1/device/pwm1=0 hwmon1/device/pwm2=0 +DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon2=w83795adg +FCTEMPS=hwmon2/device/pwm1=hwmon2/device/temp2_input hwmon2/device/pwm2=hwmon2/device/temp2_input +FCFANS=hwmon2/device/pwm2=hwmon2/device/fan10_input hwmon2/device/pwm2=hwmon2/device/fan9_input hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input +MINTEMP=hwmon2/device/pwm1=20 hwmon2/device/pwm2=20 +MAXTEMP=hwmon2/device/pwm1=60 hwmon2/device/pwm2=60 +MINSTART=hwmon2/device/pwm1=150 hwmon2/device/pwm2=150 +MINSTOP=hwmon2/device/pwm1=0 hwmon2/device/pwm2=0 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/syncd.conf b/device/ingrasys/x86_64-ingrasys_s9100-r0/syncd.conf deleted file mode 100644 index bd5ba3938842..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/syncd.conf +++ /dev/null @@ -1 +0,0 @@ -export OPENNSL_CONFIG_POST_INIT_FILE=/etc/bcm/th-ingrasys-s9100-32x100G.soc diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index 46f1b3303fec..8d0229c94865 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit 46f1b3303fecf728b66b88941fa162e91520cc32 +Subproject commit 8d0229c94865228eff63c0d79396d0b924d7c6b1 From ea4dfa48c9d9a34e38bcf97bc0ad8e1c4415cedc Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 7 Jun 2017 10:37:49 -0700 Subject: [PATCH 0589/1833] Revert "[baseos] Avoid disconnecting mgmt when re-cfg interfaces" (#681) This reverts commit e74196cd75ed1c8bb2556c2ee0199d03bad98dc2. --- files/image_config/interfaces/interfaces-config.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index f966e82e8030..3e2f852c1263 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,12 +1,5 @@ #!/bin/bash -ifdown -a -X eth0 sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces -ifup -a -X eth0 - -NEW_MGMT_IP=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_mgmt_interface["addr"]'` -NEW_MGMT_MASK=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_mgmt_interface["mask"]'` - -ifconfig eth0 $NEW_MGMT_IP netmask $NEW_MGMT_MASK -[ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid - +service networking restart +ifdown lo && ifup lo From a7de6ebe2433d6ab1239a0654be6f6c3d77e8e5b Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 8 Jun 2017 00:26:42 -0700 Subject: [PATCH 0590/1833] [dockerbase]: make sure /var/cache/apt/archives directory exists (#684) --- dockers/docker-base/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index d02d3c545027..3b372c61674f 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -19,7 +19,7 @@ ENV DEBIAN_FRONTEND=noninteractive ## Configure data sources for apt/dpkg COPY ["sources.list", "/etc/apt/sources.list"] COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] -RUN apt-get clean && apt-get update +RUN mkdir -p /var/cache/apt/archives && apt-get clean && apt-get update ## Pre-install fundamental packages RUN apt-get -y install \ From cefd024c26c888f2f36bed34af60c6909a5cee5c Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 8 Jun 2017 01:50:04 -0700 Subject: [PATCH 0591/1833] Kill dhclient when reconfig interfaces (#683) --- files/image_config/interfaces/interfaces-config.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 3e2f852c1263..d2b42051cc8d 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,5 +1,6 @@ #!/bin/bash sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces +[ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid service networking restart ifdown lo && ifup lo From 3903b45d419c7ad7f8f69e5561d4048962a15700 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 8 Jun 2017 11:53:51 +0300 Subject: [PATCH 0592/1833] [teamd.sh]: Remove LAG interfaces on exit (#643) Use -k option for teamd to properly remove LAG interfaces when docker is exiting. Signed-off-by: marian-pritsak --- dockers/docker-teamd/teamd.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/dockers/docker-teamd/teamd.sh b/dockers/docker-teamd/teamd.sh index 71bc24512ebc..2c7c716b00b7 100755 --- a/dockers/docker-teamd/teamd.sh +++ b/dockers/docker-teamd/teamd.sh @@ -2,17 +2,10 @@ TEAMD_CONF_PATH=/etc/teamd -# Before teamd could automatically add newly created host interfaces into the -# LAG, this workaround will be needed. It will remove the obsolete files and -# net devices that are failed to be removed in the previous run. function start_app { - # Remove *.pid and *.sock files if there are any rm -f /var/run/teamd/* - if [ -d $TEAMD_CONF_PATH ]; then + if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then for f in $TEAMD_CONF_PATH/*; do - # Remove netdevs if there are any - intf=`echo $f | awk -F'[/.]' '{print $4}'` - ip link del $intf teamd -f $f -d done fi @@ -20,7 +13,11 @@ function start_app { } function clean_up { - pkill -9 teamd + if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then + for f in $TEAMD_CONF_PATH/*; do + teamd -f $f -k + done + fi pkill -9 teamsyncd exit } From bc5bca66cc89ac135d0af640ae008f6c5e6ac108 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 8 Jun 2017 02:47:53 -0700 Subject: [PATCH 0593/1833] [dockerbase]: remove apt-get clean (#685) --- dockers/docker-base/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index 3b372c61674f..b8b1e23a1c2d 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -19,7 +19,7 @@ ENV DEBIAN_FRONTEND=noninteractive ## Configure data sources for apt/dpkg COPY ["sources.list", "/etc/apt/sources.list"] COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] -RUN mkdir -p /var/cache/apt/archives && apt-get clean && apt-get update +RUN apt-get update ## Pre-install fundamental packages RUN apt-get -y install \ From 30db4ec1911914858fe853b191b73c71b89043fe Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 9 Jun 2017 04:24:28 +0300 Subject: [PATCH 0594/1833] [slave.mk]: Move initialization of ENABLE_SYNCD_RPC up (#680) ENABLE_SYNCD_RPC should be initialized before all recipes are included in order for them to be able to use this variable Signed-off-by: marian-pritsak --- slave.mk | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/slave.mk b/slave.mk index d17aea5722cc..40f3d617c081 100644 --- a/slave.mk +++ b/slave.mk @@ -51,6 +51,9 @@ distclean : .platform clean ## Include other rules ############################################################################### +ifeq ($(SONIC_ENABLE_SYNCD_RPC),y) +ENABLE_SYNCD_RPC = y +endif include $(RULES_PATH)/config include $(RULES_PATH)/functions @@ -67,10 +70,6 @@ ifeq ($(PASSWORD),) override PASSWORD := $(DEFAULT_PASSWORD) endif -ifeq ($(SONIC_ENABLE_SYNCD_RPC),y) -ENABLE_SYNCD_RPC = y -endif - MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) ############################################################################### From 942e2062afb7927898ae2679e91203c33a5df273 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 9 Jun 2017 08:40:14 -0700 Subject: [PATCH 0595/1833] Update submodule sonic-snmpagent (#687) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 46ab9d94535d..2a575b403909 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 46ab9d94535df16df8f7e2d252977d54e40caa30 +Subproject commit 2a575b403909052b14e40a45fb71d2b9c2ad9af8 From 390591de90a96e1ee38fdfd95ac1871c9ed17790 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Sat, 10 Jun 2017 17:05:48 -0700 Subject: [PATCH 0596/1833] [docker-bgp]: Use address-family ipv6 for ipv6 vlan addresses (#692) * Fix SAI submodule id * Fix bgpd template. Use v6 address family for vlan ipv6 addr --- dockers/docker-fpm-frr/bgpd.conf.j2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index ed9afe0c3388..9b8195943444 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -36,7 +36,13 @@ router bgp {{ minigraph_bgp_asn }} {% endblock bgp_init %} {% block vlan_advertisement %} {% for vlan_interface in minigraph_vlan_interfaces %} +{% if vlan_interface['addr'] | ipv4 %} network {{ vlan_interface['subnet'] }} +{% elif vlan_interface['addr'] | ipv6 %} + address-family ipv6 + network {{ vlan_interface['subnet'] }} + exit-address-family +{% endif %} {% endfor %} {% endblock vlan_advertisement %} {% block bgp_sessions %} From d094ceecc26088e7bf804729e8ee803379fae6b4 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 10 Jun 2017 22:05:11 -0700 Subject: [PATCH 0597/1833] [docker-platform-monitor]: Add LED control daemon and plugin for x86_64-arista_7050_qx32 platform (#691) * Add files for building ledd package; add ledd to docker-platform-monitor; Control platform monitor docker using supervisord * Add sonic-platform-daemons submodule * Rename ledd.mk -> sonic-ledd.mk * Add led_control.py plugin for x86_64-arista_7050_qx32 platform * Rename Dockerfile -> Dockerfile.j2 * Fix build * Remove blank line --- .gitignore | 1 + .gitmodules | 3 + .../plugins/led_control.py | 80 +++++++++++++++++++ dockers/docker-platform-monitor/Dockerfile | 18 ----- dockers/docker-platform-monitor/Dockerfile.j2 | 61 ++++++++++++++ dockers/docker-platform-monitor/start.sh | 3 +- .../docker-platform-monitor/supervisord.conf | 7 ++ rules/docker-platform-monitor.mk | 5 +- rules/sonic-ledd.mk | 5 ++ src/sonic-platform-daemons | 1 + 10 files changed, 163 insertions(+), 21 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32/plugins/led_control.py delete mode 100755 dockers/docker-platform-monitor/Dockerfile create mode 100755 dockers/docker-platform-monitor/Dockerfile.j2 create mode 100644 rules/sonic-ledd.mk create mode 160000 src/sonic-platform-daemons diff --git a/.gitignore b/.gitignore index 481363b1e00a..2222458d1026 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ dockers/docker-fpm-gobgp/Dockerfile dockers/docker-fpm-quagga/Dockerfile dockers/docker-lldp-sv2/Dockerfile dockers/docker-orchagent/Dockerfile +dockers/docker-platform-monitor/Dockerfile dockers/docker-snmp-sv2/Dockerfile dockers/docker-teamd/Dockerfile platform/*/docker-syncd-*/Dockerfile diff --git a/.gitmodules b/.gitmodules index c35e478ae43f..99938c4abaca 100644 --- a/.gitmodules +++ b/.gitmodules @@ -60,3 +60,6 @@ path = src/SAI url = https://github.com/opencomputeproject/SAI branch = v0.9.4 +[submodule "src/sonic-platform-daemons"] + path = src/sonic-platform-daemons + url = https://github.com/Azure/sonic-platform-daemons diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py new file mode 100644 index 000000000000..e246a2e61581 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python +# +# led_control.py +# +# Platform-specific LED control functionality for SONiC +# + +try: + from sonic_led.led_control_base import LedControlBase +except ImportError, e: + raise ImportError (str(e) + " - required module not found") + + +class LedControl(LedControlBase): + """Platform specific LED control class""" + + SONIC_PORT_NAME_PREFIX = "Ethernet" + + LED_SYSFS_PATH_BREAKOUT_CAPABLE = "/sys/class/leds/qsfp{0}_{1}/brightness" + LED_SYSFS_PATH_NO_BREAKOUT = "/sys/class/leds/qsfp{0}/brightness" + + QSFP_BREAKOUT_START_IDX = 1 + QSFP_BREAKOUT_END_IDX = 24 + QSFP_NO_BREAKOUT_START_IDX = 25 + QSFP_NO_BREAKOUT_END_IDX = 32 + + LED_COLOR_OFF = 0 + LED_COLOR_GREEN = 1 + LED_COLOR_YELLOW = 2 + + # Helper method to map SONiC port name to Arista QSFP index + def _port_name_to_qsfp_index(self, port_name): + # Strip "Ethernet" off port name + if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): + return -1 + + sonic_port_num = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) + + # SONiC port nums are 0-based and increment by 4 + # Arista QSFP indices are 1-based and increment by 1 + return ((sonic_port_num/4) + 1) + + # Concrete implementation of port_link_state_change() method + def port_link_state_change(self, port, state): + qsfp_index = self._port_name_to_qsfp_index(port) + + # Ignore invalid QSFP indices + if qsfp_index <= 0: + return + + # QSFP indices 1-24 are breakout-capable and have four LEDs, + # whereas indices 25-32 are not breakout-capable, and only have one + if qsfp_index <= self.QSFP_BREAKOUT_END_IDX: + led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, 1) + else: + led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) + + led_file = open(led_sysfs_path, "w") + + if state == "up": + led_file.write("%d" % self.LED_COLOR_GREEN) + else: + led_file.write("%d" % self.LED_COLOR_OFF) + + led_file.close() + + # Constructor + def __init__(self): + # Initialize: Turn all front panel QSFP LEDs off + for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): + for lane in range(1, 5): + led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, lane) + with open(led_sysfs_path, 'w') as led_file: + led_file.write("%d" % self.LED_COLOR_OFF) + + for qsfp_index in range(self.QSFP_NO_BREAKOUT_START_IDX, self.QSFP_NO_BREAKOUT_END_IDX + 1): + led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) + with open(led_sysfs_path, 'w') as led_file: + led_file.write("%d" % self.LED_COLOR_OFF) + diff --git a/dockers/docker-platform-monitor/Dockerfile b/dockers/docker-platform-monitor/Dockerfile deleted file mode 100755 index 22eb4144cec5..000000000000 --- a/dockers/docker-platform-monitor/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM docker-config-engine - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -RUN apt-get install -y sensord - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs - -COPY ["start.sh", "lm-sensors.sh", "/usr/bin/"] -COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] - -ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 new file mode 100755 index 000000000000..9b407bdef6bc --- /dev/null +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -0,0 +1,61 @@ +FROM docker-config-engine + +# Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Update apt's package index files +RUN apt-get update + +RUN apt-get install -y python-pip sensord + +{% if docker_platform_monitor_debs.strip() %} +# Copy built Debian packages +COPY \ +{% for deb in docker_platform_monitor_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ +{%- endif %} + +{% if docker_platform_monitor_debs.strip() %} +# Install built Debian packages +RUN dpkg -i \ +{% for deb in docker_platform_monitor_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} +{%- endif %} + +{% if docker_platform_monitor_whls.strip() %} +# Copy built Python wheels +COPY \ +{% for whl in docker_platform_monitor_whls.split(' ') -%} +python-wheels/{{ whl }}{{' '}} +{%- endfor -%} +python-wheels/ +{%- endif %} + +{% if docker_platform_monitor_whls.strip() %} +# Install built Python wheels +RUN pip install \ +{% for whl in docker_platform_monitor_whls.split(' ') -%} +python-wheels/{{ whl }}{{' '}} +{%- endfor %} +{%- endif %} + +COPY python-wheels /python-wheels + +# Install Python SwSS SDK (dependency of sonic-ledd) +RUN pip install /python-wheels/swsssdk-2.0.1-py2-none-any.whl + +# Clean up +RUN apt-get remove -y python-pip +RUN apt-get clean -y +RUN apt-get autoclean -y +RUN apt-get autoremove -y +RUN rm -rf /debs /python-wheels ~/.cache + +COPY ["start.sh", "lm-sensors.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-platform-monitor/start.sh b/dockers/docker-platform-monitor/start.sh index 0e8a6dd32760..b550cc037a5d 100755 --- a/dockers/docker-platform-monitor/start.sh +++ b/dockers/docker-platform-monitor/start.sh @@ -2,7 +2,7 @@ mkdir -p /etc/sensors.d if [ -e /usr/share/sonic/platform/sensors.conf ]; then - /bin/cp -rf /usr/share/sonic/platform/sensors.conf /etc/sensors.d/ + /bin/cp -rf /usr/share/sonic/platform/sensors.conf /etc/sensors.d/ fi mkdir -p /var/sonic @@ -12,4 +12,5 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd supervisorctl start lm-sensors +supervisorctl start ledd diff --git a/dockers/docker-platform-monitor/supervisord.conf b/dockers/docker-platform-monitor/supervisord.conf index d4f21cf609fa..051829eae65f 100644 --- a/dockers/docker-platform-monitor/supervisord.conf +++ b/dockers/docker-platform-monitor/supervisord.conf @@ -27,3 +27,10 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog +[program:ledd] +command=/usr/bin/ledd +priority=6 +autostart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 09bec7125c08..39f8cdd3f297 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -1,10 +1,11 @@ -# docker platform monitor image +# Docker image for SONiC platform monitoring tools DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor +$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(SONIC_LEDD) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) -SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) +SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) $(DOCKER_PLATFORM_MONITOR)_CONTAINER_NAME = pmon diff --git a/rules/sonic-ledd.mk b/rules/sonic-ledd.mk new file mode 100644 index 000000000000..aa95b46cf478 --- /dev/null +++ b/rules/sonic-ledd.mk @@ -0,0 +1,5 @@ +# sonic-ledd (SONiC Front-panel LED control daemon) Debian package + +SONIC_LEDD = python-sonic-ledd_1.0-1_all.deb +$(SONIC_LEDD)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-ledd +SONIC_PYTHON_STDEB_DEBS += $(SONIC_LEDD) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons new file mode 160000 index 000000000000..bd7c31075765 --- /dev/null +++ b/src/sonic-platform-daemons @@ -0,0 +1 @@ +Subproject commit bd7c310757658396ccfaaf653ede4a931b3d4154 From c7908e1d428ff8b3be4ae1a150822463f224ce6d Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Sun, 11 Jun 2017 11:46:17 -0700 Subject: [PATCH 0598/1833] [slave]: remove apt-get clean (#693) --- sonic-slave/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 76b01ea2f608..ee37f57ee0b5 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -11,7 +11,7 @@ RUN echo "deb http://debian-archive.trafficmanager.net/debian/ jessie main contr ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get clean && apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y \ apt-utils \ default-jre-headless \ openssh-server \ From 5e6620e19ec7644428c8acd3761af2d85fc6689c Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 12 Jun 2017 11:05:22 -0700 Subject: [PATCH 0599/1833] [bgp] Save bgp admin state (#690) * [bgp] Save admin state and set default state to shutdown * Set default behavior to no shutdown * Add build option SHUTDOWN_BGP_ON_START * Script change for default admin state to be on * Address CR comments to bgp_neighbor script * Fix script bug --- Makefile | 1 + .../base_image_files/bgp_neighbor | 55 +++++++++++++++++++ dockers/docker-fpm-quagga/bgpd.conf.j2 | 3 + dockers/docker-fpm-quagga/start.sh | 6 +- .../build_templates/sonic_debian_extension.j2 | 5 +- rules/config | 4 ++ rules/docker-fpm-quagga.mk | 1 + slave.mk | 1 + 8 files changed, 74 insertions(+), 2 deletions(-) create mode 100755 dockers/docker-fpm-quagga/base_image_files/bgp_neighbor diff --git a/Makefile b/Makefile index 97f054c035b6..b2938221b240 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,7 @@ DOCKER_MGMT_BUILD = docker build --no-cache \ PLATFORM=$(PLATFORM) \ BUILD_NUMBER=$(BUILD_NUMBER) \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ + SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ diff --git a/dockers/docker-fpm-quagga/base_image_files/bgp_neighbor b/dockers/docker-fpm-quagga/base_image_files/bgp_neighbor new file mode 100755 index 000000000000..d6bd67a0a02d --- /dev/null +++ b/dockers/docker-fpm-quagga/base_image_files/bgp_neighbor @@ -0,0 +1,55 @@ +#!/bin/bash -e + +usage(){ + echo "Usage: $0 " + exit 255 +} + +[[ $# -ne 2 ]] && usage + +COMMAND=$1 +NEIGHBOR_IP=$2 + +if [ "$COMMAND" == "shutdown" ]; then + CMD_PREFIX="" +elif [ "$COMMAND" == "startup" ]; then + CMD_PREFIX="no" +else + usage +fi + +ASN=`vtysh -c "show ip bgp summary" | sed -n "s/.*AS number \([0-9]\+\).*/\1/p"` +if [ -z "$ASN" ]; then + exit 255 +fi + +[ -f /etc/sonic/bgp_admin.yml ] || echo "bgp_admin_state:" > /etc/sonic/bgp_admin.yml + +# Operate on all ipv4 neighbors when "neighbor_ip" = 0.0.0.0 +if [ "$NEIGHBOR_IP" == "0.0.0.0" ] ; then + for NEIGHBOR in `vtysh -c "show run" | grep nei | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | sort | uniq`; do + vtysh -c "configure terminal" -c "router bgp $ASN" -c "$CMD_PREFIX neighbor $NEIGHBOR shutdown" + + # Save admin state in config file + sed -i "/^\s*$NEIGHBOR:/d" /etc/sonic/bgp_admin.yml + if [ "$COMMAND" == "startup" ]; then + echo " $NEIGHBOR: on" >> /etc/sonic/bgp_admin.yml + else + echo " $NEIGHBOR: off" >> /etc/sonic/bgp_admin.yml + fi + done + +else + # Examine bgp neighbor exists first + vtysh -c "show ip bgp neighbor $NEIGHBOR_IP" | grep -q "BGP neighbor is" + + vtysh -c "configure terminal" -c "router bgp $ASN" -c "$CMD_PREFIX neighbor $NEIGHBOR_IP shutdown" + + # Save admin state in config file + sed -i "/^\s*$NEIGHBOR_IP:/d" /etc/sonic/bgp_admin.yml + if [ "$COMMAND" == "startup" ]; then + echo " $NEIGHBOR_IP: on" >> /etc/sonic/bgp_admin.yml + else + echo " $NEIGHBOR_IP: off" >> /etc/sonic/bgp_admin.yml + fi +fi diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index fff27678c95b..0c848939df9d 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -50,6 +50,9 @@ router bgp {{ minigraph_bgp_asn }} {% if bgp_session['asn'] != 0 %} neighbor {{ bgp_session['addr'] }} remote-as {{ bgp_session['asn'] }} neighbor {{ bgp_session['addr'] }} description {{ bgp_session['name'] }} +{% if bgp_admin_state and bgp_admin_state.has_key(bgp_session['addr']) and bgp_admin_state[bgp_session['addr']]==False or bgp_admin_state and not bgp_admin_state.has_key(bgp_session['addr']) and bgp_admin_state.has_key('all') and bgp_admin_state['all']==False %} + neighbor {{ bgp_session['addr'] }} shutdown +{% endif %} {% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} neighbor {{ bgp_session['addr'] }} allowas-in 1 {% endif %} diff --git a/dockers/docker-fpm-quagga/start.sh b/dockers/docker-fpm-quagga/start.sh index a02117dee5ef..bc3fbf4e907a 100755 --- a/dockers/docker-fpm-quagga/start.sh +++ b/dockers/docker-fpm-quagga/start.sh @@ -1,7 +1,11 @@ #!/usr/bin/env bash mkdir -p /etc/quagga -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf +if [ -f /etc/sonic/bgp_admin.yml ]; then + sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/bgp_admin.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf +else + sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf +fi sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 94f8292fb955..00398654b12c 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -131,7 +131,10 @@ sudo bash -c "echo dhcp_as_static=true >> $FILESYSTEM_ROOT/etc/sonic/updategraph {% else %} sudo bash -c "echo enabled=false > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" {% endif %} - +{% if shutdown_bgp_on_start == "y" %} +sudo bash -c "echo bgp_admin_state: > $FILESYSTEM_ROOT/etc/sonic/bgp_admin.yml" +sudo bash -c "echo ' all: off' >> $FILESYSTEM_ROOT/etc/sonic/bgp_admin.yml" +{% endif %} # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ diff --git a/rules/config b/rules/config index 4d0fc7801c9a..e813cd7ef1cb 100644 --- a/rules/config +++ b/rules/config @@ -38,6 +38,10 @@ DEFAULT_PASSWORD = YourPaSsWoRd # If not set (default behavior) the default minigraph built into the image will be used. # ENABLE_DHCP_GRAPH_SERVICE = y +# SHUTDOWN_BGP_ON_START - if set to y all bgp sessions will be in admin down state when +# bgp service starts. +# SHUTDOWN_BGP_ON_START = y + # SONIC_CONFIG_DEBUG - install debug packages # Uncomment next line to enable: # SONIC_CONFIG_DEBUG = y diff --git a/rules/docker-fpm-quagga.mk b/rules/docker-fpm-quagga.mk index a9c0511ba173..1e95c96e001b 100644 --- a/rules/docker-fpm-quagga.mk +++ b/rules/docker-fpm-quagga.mk @@ -11,3 +11,4 @@ $(DOCKER_FPM_QUAGGA)_RUN_OPT += --net=host --privileged -t $(DOCKER_FPM_QUAGGA)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_FPM_QUAGGA)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh +$(DOCKER_FPM_QUAGGA)_BASE_IMAGE_FILES += bgp_neighbor:/usr/bin/bgp_neighbor diff --git a/slave.mk b/slave.mk index 40f3d617c081..c8ffbd8086f0 100644 --- a/slave.mk +++ b/slave.mk @@ -339,6 +339,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export sonicadmin_user="$(USERNAME)" export sonic_asic_platform="$(CONFIGURED_PLATFORM)" export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" + export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)" export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))" export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))" export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" From f1ea4aa34f0735f5ade358b78b43bd0bcef2ce7f Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 12 Jun 2017 16:00:46 -0700 Subject: [PATCH 0600/1833] Update submodule sonic-snmpagent (#694) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 2a575b403909..7c2c18c69118 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 2a575b403909052b14e40a45fb71d2b9c2ad9af8 +Subproject commit 7c2c18c69118ecdc794e7f56f44ccae8f16bb54e From d9cf39885536044ec08864c0da6f793457ceb6ca Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 12 Jun 2017 21:13:11 -0700 Subject: [PATCH 0601/1833] [pmon]: add swsssdk dependency for pmon docker (#700) --- rules/docker-platform-monitor.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 39f8cdd3f297..dea73d2c90ba 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -3,6 +3,7 @@ DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(SONIC_LEDD) +$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) From 023a5b9714c8d2c41ab4469beae3569c0e43933a Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 12 Jun 2017 21:22:46 -0700 Subject: [PATCH 0602/1833] [sonic-cfggen]: translate_acl tool adds TCP mask (#697) In orchagent, the TCP_FLAGS expects both value and mask as the input. Right now, translate_acl tool only support one TCP flag and generate the ACL with both value and mask equal to the flag. This rule will match packets that have this specific flag set regardless of the other flags. --- .../sample_output/rules_for_dataacl.json | 9 +++ .../tests/t0-sample-acl.json | 62 +++++++++++++------ src/sonic-config-engine/translate_acl | 2 +- 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json b/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json index 9fd0199c4cf2..48fa240c9dc6 100644 --- a/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json +++ b/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json @@ -25,5 +25,14 @@ "priority":9998 }, "OP":"SET" + }, + { + "ACL_RULE_TABLE:dataacl:Rule_4":{ + "IP_PROTOCOL":6, + "PACKET_ACTION":"FORWARD", + "TCP_FLAGS":"0x10/0x10", + "priority":9996 + }, + "OP":"SET" } ] \ No newline at end of file diff --git a/src/sonic-config-engine/tests/t0-sample-acl.json b/src/sonic-config-engine/tests/t0-sample-acl.json index e04971e5f2ec..4157a1701b60 100644 --- a/src/sonic-config-engine/tests/t0-sample-acl.json +++ b/src/sonic-config-engine/tests/t0-sample-acl.json @@ -10,55 +10,77 @@ "config": { "forwarding-action": "ACCEPT" } - }, + }, "config": { "sequence-id": 1 - }, + }, "ip": { "config": { - "protocol": "IP_UDP", + "protocol": "IP_UDP", "source-ip-address": "10.0.0.0/8" } } - }, + }, "2": { "actions": { "config": { "forwarding-action": "ACCEPT" } - }, + }, "config": { "sequence-id": 2 - }, + }, "ip": { "config": { - "protocol": "IP_UDP", + "protocol": "IP_UDP", "source-ip-address": "100.64.0.0/10" } } - }, + }, "3": { "actions": { "config": { "forwarding-action": "ACCEPT" } - }, + }, "config": { "sequence-id": 3 - }, + }, "ip": { "config": { - "protocol": "IP_UDP", + "protocol": "IP_UDP", "source-ip-address": "25.0.0.0/8" } } + }, + "4": { + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "config": { + "sequence-id": 4 + }, + "ip": { + "config": { + "protocol": "IP_TCP" + } + }, + "transport": { + "config": { + "tcp-flags": [ + "TCP_ACK" + ] + } + } } } - }, + }, "config": { "name": "dataacl" } - }, + }, "everflow": { "acl-entries": { "acl-entry": { @@ -67,26 +89,26 @@ "config": { "forwarding-action": "ACCEPT" } - }, + }, "config": { "sequence-id": 1 - }, + }, "ip": { "config": { - "destination-ip-address": "127.0.0.1/32", - "protocol": "IP_TCP", + "destination-ip-address": "127.0.0.1/32", + "protocol": "IP_TCP", "source-ip-address": "127.0.0.1/32" } - }, + }, "transport": { "config": { - "destination-port": "0", + "destination-port": "0", "source-port": "0" } } } } - }, + }, "config": { "name": "everflow" } diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl index 6ee89cfd4612..584db7b64488 100755 --- a/src/sonic-config-engine/translate_acl +++ b/src/sonic-config-engine/translate_acl @@ -97,7 +97,7 @@ def generate_rule_json(table_name, rule, max_priority, mirror): if flag == "TCP_CWR": tcp_flags = tcp_flags | 0x80 if tcp_flags != 0x00: - rule_props["TCP_FLAGS"] = '0x{:02x}'.format(tcp_flags) + rule_props["TCP_FLAGS"] = '0x{:02x}/0x{:02x}'.format(tcp_flags, tcp_flags) return rule_data def generate_table_json(aclset, aclname, ports, mirror, max_priority, output_path='.'): From 94f491ecb8d4b4411adc37deb52beeb69f962dd2 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 12 Jun 2017 21:23:27 -0700 Subject: [PATCH 0603/1833] [submodule]: Update submodule sonic-snmpagent (#698) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 7c2c18c69118..f66288d50821 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 7c2c18c69118ecdc794e7f56f44ccae8f16bb54e +Subproject commit f66288d50821d7b70ee7dc3321bdc626b3eb34cf From b616a33ff3574690d57f76468be5270ae6b75925 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 13 Jun 2017 11:37:43 -0700 Subject: [PATCH 0604/1833] [sonic-cfg]: Use vlanid to generate sonic vlan name (#695) * Use Vlan{{vlanid}} schema name of sonic vlans --- src/sonic-config-engine/minigraph.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 49e8b104a46e..7dc060900886 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -212,7 +212,8 @@ def parse_dpg(dpg, hname): for i, member in enumerate(vmbr_list): vmbr_list[i] = port_alias_map[member] vlan_attributes = {'name': vintfname, 'members': vmbr_list, 'vlanid': vlanid} - vlans[vintfname] = vlan_attributes + sonic_vlan_name = "Vlan%s" % vlanid + vlans[sonic_vlan_name] = vlan_attributes aclintfs = child.find(str(QName(ns, "AclInterfaces"))) acls = {} From e46cf29f0be930e6cf6bbbcfb1f197740e54b90c Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 13 Jun 2017 19:16:43 -0700 Subject: [PATCH 0605/1833] [sonic-mgmt]: fix paramiko to version 2.1.2 (#704) --- sonic-mgmt/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonic-mgmt/Dockerfile b/sonic-mgmt/Dockerfile index f657b18a1dc0..f462b99cdf45 100644 --- a/sonic-mgmt/Dockerfile +++ b/sonic-mgmt/Dockerfile @@ -36,7 +36,8 @@ RUN pip install ipaddr \ pexpect \ pyasn1==0.1.9 \ pysnmp==4.2.5 \ - jinja2==2.7.2 + jinja2==2.7.2 \ + paramiko==2.1.2 RUN git clone https://github.com/ansible/ansible RUN cd ansible && git checkout v2.0.0.2-1 -b v2.0.0.2-1 && git submodule update --init --recursive && make && make install From 8843c6f1925eadbffa4a45265435cd86ccb634b8 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 14 Jun 2017 07:05:34 -0700 Subject: [PATCH 0606/1833] [logrotate]: Add /var/log/swss/*.rec to logrotate target (#703) SwSS record files in /var/log/swss/ folder get larger and larger and were not rotated. Add them here to rotate these files. --- files/image_config/logrotate.d/rsyslog | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/logrotate.d/rsyslog b/files/image_config/logrotate.d/rsyslog index d24bc32abe17..a212ddfce15c 100644 --- a/files/image_config/logrotate.d/rsyslog +++ b/files/image_config/logrotate.d/rsyslog @@ -1,6 +1,7 @@ /var/log/syslog /var/log/quagga/*.log /var/log/teamd.log +/var/log/swss/*.rec { rotate 7 daily From 88b98c7b899bfc79312ac85c35808835c765203b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 14 Jun 2017 15:18:02 -0700 Subject: [PATCH 0607/1833] [image]: Update login message (#706) --- files/image_config/environment/motd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/image_config/environment/motd b/files/image_config/environment/motd index aa96d66ba7c5..8562e330fe2c 100644 --- a/files/image_config/environment/motd +++ b/files/image_config/environment/motd @@ -10,3 +10,5 @@ You are on Unauthorized access and/or use are prohibited. All access and/or use are subject to monitoring. +Help: http://azure.github.io/SONiC/ + From 90412883593666c60ff6c3fbc5872ecc7d9968e9 Mon Sep 17 00:00:00 2001 From: Haiyang Zheng Date: Thu, 15 Jun 2017 10:31:13 -0700 Subject: [PATCH 0608/1833] [build_debian]: Add dbus package to update timezone (#702) Signed-off-by: Hiayang Zheng haiyang.z@alibaba.inc --- build_debian.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_debian.sh b/build_debian.sh index eed63e6eb070..71f849151a94 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -176,6 +176,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in sudo \ vim \ tcpdump \ + dbus \ ntp \ ntpstat \ openssh-server \ From c1c8a122bea2aac5eefc8d19ada0beed059daed5 Mon Sep 17 00:00:00 2001 From: Polly Hsu Date: Fri, 16 Jun 2017 01:33:42 +0800 Subject: [PATCH 0609/1833] [Accton]: Add a new supported device and platform, AS7712-32X (#662) * platform/broadcom: Add a new supported device and platform, AS7712-32X * Switch Vendor: Edge-core * Switch SKU: AS7712-32X * ASIC Vendor: Broadcom * Swich ASIC: Tomahawk * Port Configuration: 32x100G * SONiC Image: SONiC-ONIE-Broadcom Signed-off-by: polly_hsu@accton.com --- .../Accton-AS7712-32X/port_config.ini | 33 + .../Accton-AS7712-32X/sai.profile | 2 + .../installer.conf | 3 + .../x86_64-accton_as7712_32x-r0/minigraph.xml | 1074 ++++++++++++++++ platform/broadcom/one-image.mk | 3 +- platform/broadcom/platform-modules-accton.mk | 14 + platform/broadcom/rules.mk | 1 + .../sonic-platform-modules-accton/.gitignore | 33 + .../sonic-platform-modules-accton/LICENSE | 16 + .../sonic-platform-modules-accton/README.md | 1 + .../as7712-32x/cfg/as7712_32x-modules.conf | 13 + .../as7712-32x/modules/Makefile | 2 + .../modules/accton_as7712_32x_fan.c | 452 +++++++ .../modules/accton_as7712_32x_psu.c | 293 +++++ .../modules/accton_as7712_32x_sfp.c | 1083 +++++++++++++++++ .../as7712-32x/modules/accton_i2c_cpld.c | 259 ++++ .../modules/leds-accton_as7712_32x.c | 443 +++++++ .../as7712-32x/modules/ym2651y.c | 589 +++++++++ .../scripts/as7712_32x_platform_init.sh | 3 + .../debian/changelog | 5 + .../debian/compat | 1 + .../debian/control | 11 + .../debian/platform-modules-as7712-32x.init | 44 + .../platform-modules-as7712-32x.install | 2 + .../debian/rules | 36 + 25 files changed, 4415 insertions(+), 1 deletion(-) create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/port_config.ini create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/installer.conf create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml create mode 100644 platform/broadcom/platform-modules-accton.mk create mode 100644 platform/broadcom/sonic-platform-modules-accton/.gitignore create mode 100644 platform/broadcom/sonic-platform-modules-accton/LICENSE create mode 100644 platform/broadcom/sonic-platform-modules-accton/README.md create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/cfg/as7712_32x-modules.conf create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/scripts/as7712_32x_platform_init.sh create mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/changelog create mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/compat create mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/control create mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.init create mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.install create mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/rules diff --git a/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/port_config.ini b/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/port_config.ini new file mode 100644 index 000000000000..1fa6d21d9609 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 49,50,51,52 hundredGigE1 +Ethernet4 53,54,55,56 hundredGigE2 +Ethernet8 57,58,59,60 hundredGigE3 +Ethernet12 61,62,63,64 hundredGigE4 +Ethernet16 65,66,67,68 hundredGigE5 +Ethernet20 69,70,71,72 hundredGigE6 +Ethernet24 73,74,75,76 hundredGigE7 +Ethernet28 77,78,79,80 hundredGigE8 +Ethernet32 33,34,35,36 hundredGigE9 +Ethernet36 37,38,39,40 hundredGigE10 +Ethernet40 41,42,43,44 hundredGigE11 +Ethernet44 45,46,47,48 hundredGigE12 +Ethernet48 81,82,83,84 hundredGigE13 +Ethernet52 85,86,87,88 hundredGigE14 +Ethernet56 89,90,91,92 hundredGigE15 +Ethernet60 93,94,95,96 hundredGigE16 +Ethernet64 97,98,99,100 hundredGigE17 +Ethernet68 101,102,103,104 hundredGigE18 +Ethernet72 105,106,107,108 hundredGigE19 +Ethernet76 109,110,111,112 hundredGigE20 +Ethernet80 17,18,19,20 hundredGigE21 +Ethernet84 21,22,23,24 hundredGigE22 +Ethernet88 25,26,27,28 hundredGigE23 +Ethernet92 29,30,31,32 hundredGigE24 +Ethernet96 113,114,115,116 hundredGigE25 +Ethernet100 117,118,119,120 hundredGigE26 +Ethernet104 121,122,123,124 hundredGigE27 +Ethernet108 125,126,127,128 hundredGigE28 +Ethernet112 1,2,3,4 hundredGigE29 +Ethernet116 5,6,7,8 hundredGigE30 +Ethernet120 9,10,11,12 hundredGigE31 +Ethernet124 13,14,15,16 hundredGigE32 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile b/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile new file mode 100644 index 000000000000..5ed350f24d7f --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7712-32x100G.config.bcm + diff --git a/device/accton/x86_64-accton_as7712_32x-r0/installer.conf b/device/accton/x86_64-accton_as7712_32x-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml new file mode 100644 index 000000000000..025985c83675 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml @@ -0,0 +1,1074 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Accton-AS7712-32X + + + + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + switch1 + Accton-AS7712-32X +
diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 3af81b325d77..600e1159b400 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -9,6 +9,7 @@ $(SONIC_ONE_IMAGE)_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(DELL_S6100_PLATFORM_MODULE) \ $(INGRASYS_S8900_54XC_PLATFORM_MODULE) \ $(INGRASYS_S8900_64XC_PLATFORM_MODULE) \ - $(INGRASYS_S9100_PLATFORM_MODULE) + $(INGRASYS_S9100_PLATFORM_MODULE) \ + $(ACCTON_AS7712_32X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk new file mode 100644 index 000000000000..00128a20f8d2 --- /dev/null +++ b/platform/broadcom/platform-modules-accton.mk @@ -0,0 +1,14 @@ +# Accton Platform modules + +ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION = 1.0 + +export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION + +ACCTON_AS7712_32X_PLATFORM_MODULE = platform-modules-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS7712_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton +$(ACCTON_AS7712_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(ACCTON_AS7712_32X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7712_32x-r0 +SONIC_DPKG_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) + +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE))) + diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 18ba86d1c0ce..3f0d523d4204 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -4,6 +4,7 @@ include $(PLATFORM_PATH)/platform-modules-s6000.mk include $(PLATFORM_PATH)/platform-modules-dell.mk include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk +include $(PLATFORM_PATH)/platform-modules-accton.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk diff --git a/platform/broadcom/sonic-platform-modules-accton/.gitignore b/platform/broadcom/sonic-platform-modules-accton/.gitignore new file mode 100644 index 000000000000..f805e810e5c6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/.gitignore @@ -0,0 +1,33 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# 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 diff --git a/platform/broadcom/sonic-platform-modules-accton/LICENSE b/platform/broadcom/sonic-platform-modules-accton/LICENSE new file mode 100644 index 000000000000..bc693f7a4c40 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2017 Accton Technology Corporation + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 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-accton/README.md b/platform/broadcom/sonic-platform-modules-accton/README.md new file mode 100644 index 000000000000..743db0cb238f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/README.md @@ -0,0 +1 @@ +platform drivers for AS7712_32X for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/cfg/as7712_32x-modules.conf b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/cfg/as7712_32x-modules.conf new file mode 100644 index 000000000000..cf2c5fa775bd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/cfg/as7712_32x-modules.conf @@ -0,0 +1,13 @@ +# /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_dev +i2c_mux_pca954x +accton_i2c_cpld +accton_as7712_32x_fan +accton_as7712_32x_sfp +leds-accton_as7712_32x +accton_as7712_32x_psu + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile new file mode 100644 index 000000000000..83319ec62e58 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile @@ -0,0 +1,2 @@ +obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \ + accton_as7712_32x_psu.o accton_i2c_cpld.o ym2651y.o \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c new file mode 100644 index 000000000000..52db1e9dc028 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c @@ -0,0 +1,452 @@ +/* + * A hwmon driver for the Accton as7712 32x fan + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as7712_32x_fan" + +static struct as7712_32x_fan_data *as7712_32x_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x0F, /* fan 1-6 present status */ + 0x11, /* fan PWM(for all fan) */ + 0x12, /* front fan 1 speed(rpm) */ + 0x13, /* front fan 2 speed(rpm) */ + 0x14, /* front fan 3 speed(rpm) */ + 0x15, /* front fan 4 speed(rpm) */ + 0x16, /* front fan 5 speed(rpm) */ + 0x17, /* front fan 6 speed(rpm) */ + 0x22, /* rear fan 1 speed(rpm) */ + 0x23, /* rear fan 2 speed(rpm) */ + 0x24, /* rear fan 3 speed(rpm) */ + 0x25, /* rear fan 4 speed(rpm) */ + 0x26, /* rear fan 5 speed(rpm) */ + 0x27, /* rear fan 6 speed(rpm) */ +}; + +/* Each client has this additional data */ +struct as7712_32x_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ +}; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID, + FAN6_ID +}; + +enum sysfs_fan_attributes { + FAN_PRESENT_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN6_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN6_REAR_SPEED_RPM, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN6_PRESENT, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, + FAN6_FAULT +}; + +/* Define attributes + */ +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index) &sensor_dev_attr_fan##index##_fault.dev_attr.attr + +#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO, fan_show_value, NULL, FAN##index##_DIRECTION) +#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN##index##_DUTY_CYCLE_PERCENTAGE) +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan##index##_duty_cycle_percentage.dev_attr.attr + +#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) +#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr + +/* 6 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(6); +/* 6 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(6); +/* 6 fan present attributes in this platform */ +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(5); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(6); +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(); + +static struct attribute *as7712_32x_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_FAULT_ATTR(1), + DECLARE_FAN_FAULT_ATTR(2), + DECLARE_FAN_FAULT_ATTR(3), + DECLARE_FAN_FAULT_ATTR(4), + DECLARE_FAN_FAULT_ATTR(5), + DECLARE_FAN_FAULT_ATTR(6), + DECLARE_FAN_SPEED_RPM_ATTR(1), + DECLARE_FAN_SPEED_RPM_ATTR(2), + DECLARE_FAN_SPEED_RPM_ATTR(3), + DECLARE_FAN_SPEED_RPM_ATTR(4), + DECLARE_FAN_SPEED_RPM_ATTR(5), + DECLARE_FAN_SPEED_RPM_ATTR(6), + DECLARE_FAN_PRESENT_ATTR(1), + DECLARE_FAN_PRESENT_ATTR(2), + DECLARE_FAN_PRESENT_ATTR(3), + DECLARE_FAN_PRESENT_ATTR(4), + DECLARE_FAN_PRESENT_ATTR(5), + DECLARE_FAN_PRESENT_ATTR(6), + DECLARE_FAN_DUTY_CYCLE_ATTR(), + NULL +}; + +#define FAN_DUTY_CYCLE_REG_MASK 0xF +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100 + +static int as7712_32x_fan_read_value(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int as7712_32x_fan_write_value(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + reg_val &= FAN_DUTY_CYCLE_REG_MASK; + return ((u32)(reg_val+1) * 625 + 75)/ 100; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + return ((u32)duty_cycle * 100 / 625) - 1; +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 0 : 1; +} + +static u8 is_fan_fault(struct as7712_32x_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = FAN1_FRONT_SPEED_RPM + id; + int rear_fan_index = FAN1_REAR_SPEED_RPM + id; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + ret = 0; + } + + return ret; +} + +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > FAN_MAX_DUTY_CYCLE) + return -EINVAL; + + as7712_32x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ + as7712_32x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + return count; +} + +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev); + ssize_t ret = 0; + + if (data->valid) { + switch (attr->index) { + case FAN_DUTY_CYCLE_PERCENTAGE: + { + u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + ret = sprintf(buf, "%d\n", + reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], + attr->index - FAN1_PRESENT)); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group as7712_32x_fan_group = { + .attrs = as7712_32x_fan_attributes, +}; + +static struct as7712_32x_fan_data *as7712_32x_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7712_32x_fan_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + dev_dbg(&client->dev, "Starting as7712_32x_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + int status = as7712_32x_fan_read_value(client, fan_reg[i]); + + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int as7712_32x_fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7712_32x_fan_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7712_32x_fan_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7712_32x_fan_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: fan '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7712_32x_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7712_32x_fan_remove(struct i2c_client *client) +{ + struct as7712_32x_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7712_32x_fan_group); + + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; + +static const struct i2c_device_id as7712_32x_fan_id[] = { + { "as7712_32x_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7712_32x_fan_id); + +static struct i2c_driver as7712_32x_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = as7712_32x_fan_probe, + .remove = as7712_32x_fan_remove, + .id_table = as7712_32x_fan_id, + .address_list = normal_i2c, +}; + +static int __init as7712_32x_fan_init(void) +{ + extern int platform_accton_as7712_32x(void); + if (!platform_accton_as7712_32x()) { + return -ENODEV; + } + + return i2c_add_driver(&as7712_32x_fan_driver); +} + +static void __exit as7712_32x_fan_exit(void) +{ + i2c_del_driver(&as7712_32x_fan_driver); +} + +module_init(as7712_32x_fan_init); +module_exit(as7712_32x_fan_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7712_32x_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c new file mode 100644 index 000000000000..8c9230ab2d24 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c @@ -0,0 +1,293 @@ +/* + * An hwmon driver for accton as7712_32x Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static int as7712_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, 0x53, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7712_32x_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[9]; /* Model name, read from eeprom */ +}; + +static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *dev); + +enum as7712_32x_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); + +static struct attribute *as7712_32x_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7712_32x_psu_data *data = as7712_32x_psu_update_device(dev); + u8 status = 0; + + if (attr->index == PSU_PRESENT) { + status = !(data->status >> (1-data->index) & 0x1); + } + else { /* PSU_POWER_GOOD */ + status = (data->status >> (3-data->index) & 0x1); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7712_32x_psu_data *data = as7712_32x_psu_update_device(dev); + + return sprintf(buf, "%s\n", data->model_name); +} + +static const struct attribute_group as7712_32x_psu_group = { + .attrs = as7712_32x_psu_attributes, +}; + +static int as7712_32x_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7712_32x_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7712_32x_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7712_32x_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7712_32x_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7712_32x_psu_remove(struct i2c_client *client) +{ + struct as7712_32x_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7712_32x_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as7712_32x_psu1, + as7712_32x_psu2 +}; + +static const struct i2c_device_id as7712_32x_psu_id[] = { + { "as7712_32x_psu1", as7712_32x_psu1 }, + { "as7712_32x_psu2", as7712_32x_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7712_32x_psu_id); + +static struct i2c_driver as7712_32x_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7712_32x_psu", + }, + .probe = as7712_32x_psu_probe, + .remove = as7712_32x_psu_remove, + .id_table = as7712_32x_psu_id, + .address_list = normal_i2c, +}; + +static int as7712_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7712_32x_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; + int power_good = 0; + + dev_dbg(&client->dev, "Starting as7712_32x update\n"); + + /* Read psu status */ + status = accton_i2c_cpld_read(0x60, 0x2); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + } + else { + data->status = status; + } + + /* Read model name */ + memset(data->model_name, 0, sizeof(data->model_name)); + power_good = (data->status >> (3-data->index) & 0x1); + + if (power_good) { + status = as7712_32x_psu_read_block(client, 0x20, data->model_name, + ARRAY_SIZE(data->model_name)-1); + + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); + } + else { + data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init as7712_32x_psu_init(void) +{ + extern int platform_accton_as7712_32x(void); + if (!platform_accton_as7712_32x()) { + return -ENODEV; + } + + return i2c_add_driver(&as7712_32x_psu_driver); +} + +static void __exit as7712_32x_psu_exit(void) +{ + i2c_del_driver(&as7712_32x_psu_driver); +} + +module_init(as7712_32x_psu_init); +module_exit(as7712_32x_psu_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7712_32x_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c new file mode 100644 index 000000000000..4366d2a6ea1d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c @@ -0,0 +1,1083 @@ +/* + * SFP driver for accton as7712_32x sfp + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "as7712_32x_sfp" + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define NUM_OF_SFP_PORT 32 +#define EEPROM_NAME "sfp_eeprom" +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define BIT_INDEX(i) (1ULL << (i)) +#define USE_I2C_BLOCK_READ 1 +#define I2C_RW_RETRY_COUNT 3 +#define I2C_RW_RETRY_INTERVAL 100 /* ms */ + +#define SFP_EEPROM_A0_I2C_ADDR (0xA0 >> 1) +#define SFP_EEPROM_A2_I2C_ADDR (0xA2 >> 1) + +#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 +#define SFF8024_DEVICE_ID_SFP 0x3 +#define SFF8024_DEVICE_ID_QSFP 0xC +#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD +#define SFF8024_DEVICE_ID_QSFP28 0x11 + +#define SFF8472_DIAG_MON_TYPE_ADDR 92 +#define SFF8472_DIAG_MON_TYPE_DDM_MASK 0x40 +#define SFF8472_10G_ETH_COMPLIANCE_ADDR 0x3 +#define SFF8472_10G_BASE_MASK 0xF0 + +#define SFF8436_RX_LOS_ADDR 3 +#define SFF8436_TX_FAULT_ADDR 4 +#define SFF8436_TX_DISABLE_ADDR 86 + +static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { SFP_EEPROM_A0_I2C_ADDR, SFP_EEPROM_A2_I2C_ADDR, I2C_CLIENT_END }; + +#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) + +enum port_numbers { +sfp1, sfp2, sfp3, sfp4, sfp5, sfp6, sfp7, sfp8, +sfp9, sfp10, sfp11, sfp12, sfp13, sfp14, sfp15, sfp16, +sfp17, sfp18, sfp19, sfp20, sfp21, sfp22, sfp23, sfp24, +sfp25, sfp26, sfp27, sfp28, sfp29, sfp30, sfp31, sfp32 +}; + +static const struct i2c_device_id sfp_device_id[] = { +{ "sfp1", sfp1 }, { "sfp2", sfp2 }, { "sfp3", sfp3 }, { "sfp4", sfp4 }, +{ "sfp5", sfp5 }, { "sfp6", sfp6 }, { "sfp7", sfp7 }, { "sfp8", sfp8 }, +{ "sfp9", sfp9 }, { "sfp10", sfp10 }, { "sfp11", sfp11 }, { "sfp12", sfp12 }, +{ "sfp13", sfp13 }, { "sfp14", sfp14 }, { "sfp15", sfp15 }, { "sfp16", sfp16 }, +{ "sfp17", sfp17 }, { "sfp18", sfp18 }, { "sfp19", sfp19 }, { "sfp20", sfp20 }, +{ "sfp21", sfp21 }, { "sfp22", sfp22 }, { "sfp23", sfp23 }, { "sfp24", sfp24 }, +{ "sfp25", sfp25 }, { "sfp26", sfp26 }, { "sfp27", sfp27 }, { "sfp28", sfp28 }, +{ "sfp29", sfp29 }, { "sfp30", sfp30 }, { "sfp31", sfp31 }, { "sfp32", sfp32 }, +{} +}; +MODULE_DEVICE_TABLE(i2c, sfp_device_id); + +/* + * list of valid port types + * note OOM_PORT_TYPE_NOT_PRESENT to indicate no + * module is present in this port + */ +typedef enum oom_driver_port_type_e { + OOM_DRIVER_PORT_TYPE_INVALID, + OOM_DRIVER_PORT_TYPE_NOT_PRESENT, + OOM_DRIVER_PORT_TYPE_SFP, + OOM_DRIVER_PORT_TYPE_SFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP, + OOM_DRIVER_PORT_TYPE_QSFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP28 +} oom_driver_port_type_t; + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_SFP_DDM, + DRIVER_TYPE_QSFP +}; + +/* Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct sfp_msa_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[2]; /* index 0 => device id + 1 => 10G Ethernet Compliance Codes + to distinguish SFP or SFP+ + 2 => DIAGNOSTIC MONITORING TYPE */ + struct eeprom_data eeprom; +}; + +struct sfp_ddm_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + struct eeprom_data eeprom; +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + oom_driver_port_type_t port_type; + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + + struct sfp_msa_data *msa; + struct sfp_ddm_data *ddm; + struct qsfp_data *qsfp; + + struct i2c_client *client; +}; + +enum sfp_sysfs_attributes { + PRESENT, + PRESENT_ALL, + PORT_NUMBER, + PORT_TYPE, + DDM_IMPLEMENTED, + TX_FAULT, + TX_FAULT1, + TX_FAULT2, + TX_FAULT3, + TX_FAULT4, + TX_DISABLE, + TX_DISABLE1, + TX_DISABLE2, + TX_DISABLE3, + TX_DISABLE4, + TX_DISABLE_ALL, + RX_LOS, + RX_LOS1, + RX_LOS2, + RX_LOS3, + RX_LOS4, + RX_LOS_ALL +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port)); +} + +static struct sfp_port_data *sfp_update_present(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {0x30, 0x31, 0x32, 0x33}; + + DEBUG_PRINT("Starting sfp present status update"); + mutex_lock(&data->update_lock); + + /* Read present status of port 1~32 */ + data->present = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = accton_i2c_cpld_read(0x60, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld(0x60) reg(0x%x) err %d", regs[i], status); + goto exit; + } + + DEBUG_PRINT("Present status = 0x%lx", data->present); + data->present |= (u64)status << (i*8); + } + + DEBUG_PRINT("Present status = 0x%lx", data->present); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static struct sfp_port_data *sfp_update_tx_rx_status(struct device *dev) +{ + return NULL; +} + +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + return 0; +} + +static int sfp_is_port_present(struct i2c_client *client, int port) +{ + struct sfp_port_data *data = sfp_update_present(client); + return (data->present & BIT_INDEX(data->port)) ? 0 : 1; +} + +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (PRESENT_ALL == attr->index) { + + } + + /* PRESENT */ + return sprintf(buf, "%d\n", sfp_is_port_present(client, data->port)); +} + +static struct sfp_port_data *sfp_update_port_type(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 buf = 0; + int status; + + mutex_lock(&data->update_lock); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + { + status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + if (buf != SFF8024_DEVICE_ID_SFP) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + status = sfp_eeprom_read(data->client, SFF8472_10G_ETH_COMPLIANCE_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("sfp port type (0x3) data = (0x%x)", buf); + data->port_type = buf & SFF8472_10G_BASE_MASK ? OOM_DRIVER_PORT_TYPE_SFP_PLUS : OOM_DRIVER_PORT_TYPE_SFP; + break; + } + case DRIVER_TYPE_QSFP: + { + status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("qsfp port type (0x0) buf = (0x%x)", buf); + switch (buf) { + case SFF8024_DEVICE_ID_QSFP: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP; + break; + case SFF8024_DEVICE_ID_QSFP_PLUS: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + case SFF8024_DEVICE_ID_QSFP28: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + default: + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + break; + } + default: + break; + } + + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_type(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (!sfp_is_port_present(client, data->port)) { + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_type(dev); + return sprintf(buf, "%d\n", data->port_type); +} + +static struct sfp_port_data *qsfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i, status = -1; + u8 buf = 0; + u8 reg[] = {SFF8436_TX_FAULT_ADDR, SFF8436_TX_DISABLE_ADDR, SFF8436_RX_LOS_ADDR}; + + if (time_before(jiffies, data->qsfp->last_updated + HZ + HZ / 2) && data->qsfp->valid) { + return data; + } + + dev_dbg(dev, "Starting sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->qsfp->valid = 0; + memset(data->qsfp->status, 0, sizeof(data->qsfp->status)); + + /* Notify device to update tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(data->client, reg[i], &buf, sizeof(buf)); + if (status < 0) { + goto exit; + } + } + msleep(200); + + /* Read actual tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(data->client, reg[i], &buf, sizeof(buf)); + if (status < 0) { + goto exit; + } + + DEBUG_PRINT("qsfp reg(0x%x) status = (0x%x)", reg[i], data->qsfp->status[i]); + data->qsfp->status[i] = (buf & 0xF); + } + + data->qsfp->valid = 1; + data->qsfp->last_updated = jiffies; + mutex_unlock(&data->update_lock); + return data; + +exit: + mutex_unlock(&data->update_lock); + return NULL; +} + +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (!sfp_is_port_present(client, data->port)) { + return -ENODEV; + } + + data = qsfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + + switch (attr->index) { + case TX_FAULT1: + case TX_FAULT2: + case TX_FAULT3: + case TX_FAULT4: + val = (data->qsfp->status[2] & BIT_INDEX(attr->index - TX_FAULT1)) ? 1 : 0; + break; + case TX_DISABLE1: + case TX_DISABLE2: + case TX_DISABLE3: + case TX_DISABLE4: + val = (data->qsfp->status[1] & BIT_INDEX(attr->index - TX_DISABLE1)) ? 1 : 0; + break; + case TX_DISABLE_ALL: + val = ((data->qsfp->status[1] & 0xF) == 0xF) ? 1 : 0; + break; + + case RX_LOS1: + case RX_LOS2: + case RX_LOS3: + case RX_LOS4: + val = (data->qsfp->status[0] & BIT_INDEX(attr->index - RX_LOS1)) ? 1 : 0; + break; + default: + break; + } + + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + long disable; + int result; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data; + + result = kstrtol(buf, 10, &disable); + if (result) { + return result; + } + + data = qsfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + + mutex_lock(&data->update_lock); + + DEBUG_PRINT ("%s-%d: disable:%u %d==%d %u\r\n", __FUNCTION__, __LINE__, + disable, attr->index, TX_DISABLE_ALL, data->qsfp->status[1]); + + if (attr->index == TX_DISABLE_ALL) + { + data->qsfp->status[1] = disable? 0xF:0; + } + else + { + if (disable) { + data->qsfp->status[1] |= (1 << (attr->index - TX_DISABLE1)); + } + else { + data->qsfp->status[1] &= ~(1 << (attr->index - TX_DISABLE1)); + } + } + DEBUG_PRINT("index = (%d), status = (0x%x)", attr->index, data->qsfp->status[1]); + result = sfp_eeprom_write(client, SFF8436_TX_DISABLE_ADDR, &data->qsfp->status[1], sizeof(data->qsfp->status[1])); + mutex_unlock(&data->update_lock); + return count; +} + +static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + char ddm; + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (!sfp_is_port_present(client, data->port)) { + return -ENODEV; + } + + status = sfp_eeprom_read(data->client, SFF8472_DIAG_MON_TYPE_ADDR, &ddm, sizeof(ddm)); + if (status < 0) { + return -EIO; + } + + return sprintf(buf, "%d\n", (ddm & SFF8472_DIAG_MON_TYPE_DDM_MASK) ? 1 : 0); +} + +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0, index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data; + + data = sfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + + switch (attr->index) { + case TX_FAULT: + index = 0; + break; + case TX_DISABLE: + index = 1; + break; + case RX_LOS: + index = 2; + break; + default: + break; + } + + val = (data->ddm->status[index] & BIT_INDEX(data->port)) ? 1 : 0; + return sprintf(buf, "%d\n", val); +} + +/* SFP/QSFP common attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_present, NULL, PRESENT); +static SENSOR_DEVICE_ATTR(sfp_port_type, S_IRUGO, show_port_type, NULL, PORT_TYPE); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_present, NULL, PRESENT); + +/* QSFP attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_rx_los1, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS1); +static SENSOR_DEVICE_ATTR(sfp_rx_los2, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS2); +static SENSOR_DEVICE_ATTR(sfp_rx_los3, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS3); +static SENSOR_DEVICE_ATTR(sfp_rx_los4, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS4); +static SENSOR_DEVICE_ATTR(sfp_tx_disable1, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE1); +static SENSOR_DEVICE_ATTR(sfp_tx_disable2, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE2); +static SENSOR_DEVICE_ATTR(sfp_tx_disable3, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE3); +static SENSOR_DEVICE_ATTR(sfp_tx_disable4, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE4); +static SENSOR_DEVICE_ATTR(sfp_tx_disable_all, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE_ALL); +static SENSOR_DEVICE_ATTR(sfp_tx_fault1, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT1); +static SENSOR_DEVICE_ATTR(sfp_tx_fault2, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT2); +static SENSOR_DEVICE_ATTR(sfp_tx_fault3, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT3); +static SENSOR_DEVICE_ATTR(sfp_tx_fault4, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT4); +static struct attribute *qsfp_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_port_type.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los1.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los2.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los3.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable_all.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault4.dev_attr.attr, + NULL +}; + +/* SFP msa attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_ddm_implemented, S_IRUGO, sfp_show_ddm_implemented, NULL, DDM_IMPLEMENTED); +static struct attribute *sfp_msa_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_port_type.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_ddm_implemented.dev_attr.attr, + NULL +}; + +/* SFP ddm attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS); +static SENSOR_DEVICE_ATTR(sfp_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, TX_DISABLE); +static SENSOR_DEVICE_ATTR(sfp_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, TX_FAULT); +static struct attribute *sfp_ddm_attributes[] = { + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + NULL +}; + +static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return data_len; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_write_byte_data(client, command, *data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return 1; +#endif + + +} + + +static ssize_t sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; +} + + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + DEBUG_PRINT("%s(%d) offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return sfp_port_write(data, buf, off, count); +} + +static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + //result = data_len; + +abort: + return result; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_read_byte_data(client, command); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, result); + goto abort; + } + + *data = (u8)result; + result = 1; + +abort: + return result; +#endif +} + +static ssize_t sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; + +} + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return sfp_port_read(data, buf, off, count); +} + +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; + eeprom->size = EEPROM_SIZE; + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + return 0; +} + +static const struct attribute_group sfp_msa_group = { + .attrs = sfp_msa_attributes, +}; + +static int sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} + +static int sfp_msa_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_msa_data **data) +{ + int status; + struct sfp_msa_data *msa; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + msa = kzalloc(sizeof(struct sfp_msa_data), GFP_KERNEL); + if (!msa) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_msa_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &msa->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = msa; + dev_info(&client->dev, "sfp msa '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); +exit_free: + kfree(msa); +exit: + + return status; +} + +static const struct attribute_group sfp_ddm_group = { + .attrs = sfp_ddm_attributes, +}; + +static int sfp_ddm_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_ddm_data **data) +{ + int status; + struct sfp_ddm_data *ddm; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + ddm = kzalloc(sizeof(struct sfp_ddm_data), GFP_KERNEL); + if (!ddm) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_ddm_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &ddm->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = ddm; + dev_info(&client->dev, "sfp ddm '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); +exit_free: + kfree(ddm); +exit: + + return status; +} + +static const struct attribute_group qsfp_group = { + .attrs = qsfp_attributes, +}; + +static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); + if (status) { + goto exit_remove; + } + + /* Bring QSFPs out of reset + as6712_32x_i2c_cpld_write(0x62, 0x4, 0xFF); + as6712_32x_i2c_cpld_write(0x62, 0x5, 0xFF); + as6712_32x_i2c_cpld_write(0x64, 0x4, 0xFF); + as6712_32x_i2c_cpld_write(0x64, 0x5, 0xFF);*/ + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &qsfp_group); +exit_free: + kfree(qsfp); +exit: + + return status; +} + +static int sfp_device_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct sfp_port_data *data = NULL; + + data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + data->client = client; + + if (client->addr != SFP_EEPROM_A0_I2C_ADDR) { + return -ENODEV; + } + + data->driver_type = DRIVER_TYPE_QSFP; + return qsfp_probe(client, dev_id, &data->qsfp); +} + +static int sfp_msa_remove(struct i2c_client *client, struct sfp_msa_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); + kfree(data); + return 0; +} + +static int sfp_ddm_remove(struct i2c_client *client, struct sfp_ddm_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); + kfree(data); + return 0; +} + +static int qfp_remove(struct i2c_client *client, struct qsfp_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + return 0; +} + +static int sfp_device_remove(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + return sfp_msa_remove(client, data->msa); + case DRIVER_TYPE_SFP_DDM: + return sfp_ddm_remove(client, data->ddm); + case DRIVER_TYPE_QSFP: + return qfp_remove(client, data->qsfp); + } + + return 0; +} + +static struct i2c_driver sfp_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = sfp_device_probe, + .remove = sfp_device_remove, + .id_table = sfp_device_id, + .address_list = normal_i2c, +}; + +static int __init sfp_init(void) +{ + extern int platform_accton_as7712_32x(void); + if (!platform_accton_as7712_32x()) { + return -ENODEV; + } + + return i2c_add_driver(&sfp_driver); +} + +static void __exit sfp_exit(void) +{ + i2c_del_driver(&sfp_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as7712_32x_sfp driver"); +MODULE_LICENSE("GPL"); + +module_init(sfp_init); +module_exit(sfp_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c new file mode 100644 index 000000000000..b25bf1c2aff4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c @@ -0,0 +1,259 @@ +/* + * A hwmon driver for the accton_i2c_cpld + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CPLD_VERSION_REG 0x1 + +enum as5712_54x_cpld_sysfs_attributes { + CPLD_READ_VERSION, + CPLD_BYTE_ACCESS, + CPLD_DUMP_ALL, +}; + +static ssize_t read_cpld_version(struct device *dev, struct device_attribute *da, + char *buf); +int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); + + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for accton_i2c_cpld + */ +static const unsigned short normal_i2c[] = { 0x31, 0x35, 0x60, 0x61, 0x62, I2C_CLIENT_END }; + +static SENSOR_DEVICE_ATTR(cpld_get_version, S_IRUGO, read_cpld_version, NULL, CPLD_READ_VERSION); + +static struct attribute *as5712_54x_cpld_attributes[] = { + &sensor_dev_attr_cpld_get_version.dev_attr.attr, + NULL +}; + +static const struct attribute_group as5712_54x_cpld_group = { + .attrs = as5712_54x_cpld_attributes, +}; + +static ssize_t read_cpld_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + unsigned short cpld_reg = CPLD_VERSION_REG; + u8 reg; + + if(attr->index == CPLD_READ_VERSION) { + reg = accton_i2c_cpld_read(client->addr, cpld_reg); + return sprintf(buf, "%02x\n",reg); + } + return -1 ; +} + + +static void accton_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void accton_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int accton_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as5712_54x_cpld_group); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + accton_i2c_cpld_add_client(client); + + return 0; +exit: + return status; +} + +static int accton_i2c_cpld_remove(struct i2c_client *client) +{ + sysfs_remove_group(&client->dev.kobj, &as5712_54x_cpld_group); + + accton_i2c_cpld_remove_client(client); + return 0; +} + +static const struct i2c_device_id accton_i2c_cpld_id[] = { + { "accton_i2c_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, accton_i2c_cpld_id); + +static struct i2c_driver accton_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "accton_i2c_cpld", + }, + .probe = accton_i2c_cpld_probe, + .remove = accton_i2c_cpld_remove, + .id_table = accton_i2c_cpld_id, + .address_list = normal_i2c, +}; + +int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_read); + +int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_write); + +static int __init accton_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&accton_i2c_cpld_driver); +} + +static void __exit accton_i2c_cpld_exit(void) +{ + i2c_del_driver(&accton_i2c_cpld_driver); +} + +static struct dmi_system_id as7712_dmi_table[] = { + { + .ident = "Accton AS7712", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS7712"), + }, + } +}; + +int platform_accton_as7712_32x(void) +{ + return dmi_check_system(as7712_dmi_table); +} +EXPORT_SYMBOL(platform_accton_as7712_32x); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_i2c_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(accton_i2c_cpld_init); +module_exit(accton_i2c_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c new file mode 100644 index 000000000000..8b14437bca35 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c @@ -0,0 +1,443 @@ +/* + * A LED driver for the accton_as7712_32x_led + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern int accton_i2c_cpld_read (unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "accton_as7712_32x_led" + +struct accton_as7712_32x_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[1]; /* only 1 register*/ +}; + +static struct accton_as7712_32x_led_data *ledctl = NULL; + +/* LED related data + */ + +#define LED_CNTRLER_I2C_ADDRESS (0x60) + +#define LED_TYPE_DIAG_REG_MASK (0x3) +#define LED_MODE_DIAG_GREEN_VALUE (0x02) +#define LED_MODE_DIAG_RED_VALUE (0x01) +#define LED_MODE_DIAG_AMBER_VALUE (0x00) /*It's yellow actually. Green+Red=Yellow*/ +#define LED_MODE_DIAG_OFF_VALUE (0x03) + + +#define LED_TYPE_LOC_REG_MASK (0x80) +#define LED_MODE_LOC_ON_VALUE (0) +#define LED_MODE_LOC_OFF_VALUE (0x80) + +enum led_type { + LED_TYPE_DIAG, + LED_TYPE_LOC, + LED_TYPE_FAN, + LED_TYPE_PSU1, + LED_TYPE_PSU2 +}; + +struct led_reg { + u32 types; + u8 reg_addr; +}; + +static const struct led_reg led_reg_map[] = { + {(1<update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting accton_as7712_32x_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = accton_as7712_32x_led_read_value(led_reg_map[i].reg_addr); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg_map[i].reg_addr, status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as7712_32x_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + enum led_type type) +{ + int reg_val; + u8 reg ; + mutex_lock(&ledctl->update_lock); + + if( !accton_getLedReg(type, ®)) + { + dev_dbg(&ledctl->pdev->dev, "Not match item for %d.\n", type); + } + + reg_val = accton_as7712_32x_led_read_value(reg); + + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + accton_as7712_32x_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + + +static void accton_as7712_32x_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as7712_32x_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG); +} + +static enum led_brightness accton_as7712_32x_led_diag_get(struct led_classdev *cdev) +{ + accton_as7712_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void accton_as7712_32x_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as7712_32x_led_set(led_cdev, led_light_mode, LED_TYPE_LOC); +} + +static enum led_brightness accton_as7712_32x_led_loc_get(struct led_classdev *cdev) +{ + accton_as7712_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static void accton_as7712_32x_led_auto_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ +} + +static enum led_brightness accton_as7712_32x_led_auto_get(struct led_classdev *cdev) +{ + return LED_MODE_AUTO; +} + +static struct led_classdev accton_as7712_32x_leds[] = { + [LED_TYPE_DIAG] = { + .name = "accton_as7712_32x_led::diag", + .default_trigger = "unused", + .brightness_set = accton_as7712_32x_led_diag_set, + .brightness_get = accton_as7712_32x_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_RED, + }, + [LED_TYPE_LOC] = { + .name = "accton_as7712_32x_led::loc", + .default_trigger = "unused", + .brightness_set = accton_as7712_32x_led_loc_set, + .brightness_get = accton_as7712_32x_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_BLUE, + }, + [LED_TYPE_FAN] = { + .name = "accton_as7712_32x_led::fan", + .default_trigger = "unused", + .brightness_set = accton_as7712_32x_led_auto_set, + .brightness_get = accton_as7712_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU1] = { + .name = "accton_as7712_32x_led::psu1", + .default_trigger = "unused", + .brightness_set = accton_as7712_32x_led_auto_set, + .brightness_get = accton_as7712_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "accton_as7712_32x_led::psu2", + .default_trigger = "unused", + .brightness_set = accton_as7712_32x_led_auto_set, + .brightness_get = accton_as7712_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +}; + +static int accton_as7712_32x_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { + led_classdev_suspend(&accton_as7712_32x_leds[i]); + } + + return 0; +} + +static int accton_as7712_32x_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { + led_classdev_resume(&accton_as7712_32x_leds[i]); + } + + return 0; +} + +static int accton_as7712_32x_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { + ret = led_classdev_register(&pdev->dev, &accton_as7712_32x_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(accton_as7712_32x_leds)){ + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&accton_as7712_32x_leds[i]); + } + } + + return ret; +} + +static int accton_as7712_32x_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { + led_classdev_unregister(&accton_as7712_32x_leds[i]); + } + + return 0; +} + +static struct platform_driver accton_as7712_32x_led_driver = { + .probe = accton_as7712_32x_led_probe, + .remove = accton_as7712_32x_led_remove, + .suspend = accton_as7712_32x_led_suspend, + .resume = accton_as7712_32x_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as7712_32x_led_init(void) +{ + int ret; + + extern int platform_accton_as7712_32x(void); + if (!platform_accton_as7712_32x()) { + return -ENODEV; + } + + ret = platform_driver_register(&accton_as7712_32x_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct accton_as7712_32x_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as7712_32x_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&accton_as7712_32x_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as7712_32x_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&accton_as7712_32x_led_driver); + kfree(ledctl); +} + +module_init(accton_as7712_32x_led_init); +module_exit(accton_as7712_32x_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as7712_32x_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c new file mode 100644 index 000000000000..2745b095b7e2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c @@ -0,0 +1,589 @@ +/* + * An hwmon driver for the 3Y Power YM-2651Y Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x58, 0x5b, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct ym2651y_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 capability; /* Register value */ + u16 status_word; /* Register value */ + u8 fan_fault; /* Register value */ + u8 over_temp; /* Register value */ + u16 v_out; /* Register value */ + u16 i_out; /* Register value */ + u16 p_out; /* Register value */ + u16 temp; /* Register value */ + u16 fan_speed; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u8 fan_dir[4]; /* Register value */ + u8 pmbus_revision; /* Register value */ + u8 mfr_id[10]; /* Register value */ + u8 mfr_model[10]; /* Register value */ + u8 mfr_revsion[3]; /* Register value */ + u16 mfr_vin_min; /* Register value */ + u16 mfr_vin_max; /* Register value */ + u16 mfr_iin_max; /* Register value */ + u16 mfr_iout_max; /* Register value */ + u16 mfr_pin_max; /* Register value */ + u16 mfr_pout_max; /* Register value */ + u16 mfr_vout_min; /* Register value */ + u16 mfr_vout_max; /* Register value */ +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf); +static struct ym2651y_data *ym2651y_update_device(struct device *dev); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value); + +enum ym2651y_sysfs_attributes { + PSU_POWER_ON = 0, + PSU_TEMP_FAULT, + PSU_POWER_GOOD, + PSU_FAN1_FAULT, + PSU_FAN_DIRECTION, + PSU_OVER_TEMP, + PSU_V_OUT, + PSU_I_OUT, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_SPEED, + PSU_FAN1_DUTY_CYCLE, + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_REVISION, + PSU_MFR_VIN_MIN, + PSU_MFR_VIN_MAX, + PSU_MFR_VOUT_MIN, + PSU_MFR_VOUT_MAX, + PSU_MFR_IIN_MAX, + PSU_MFR_IOUT_MAX, + PSU_MFR_PIN_MAX, + PSU_MFR_POUT_MAX +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_power_on, S_IRUGO, show_word, NULL, PSU_POWER_ON); +static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_word, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, show_over_temp, NULL, PSU_OVER_TEMP); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_linear, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_ascii, NULL, PSU_FAN_DIRECTION); +static SENSOR_DEVICE_ATTR(psu_pmbus_revision, S_IRUGO, show_byte, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, show_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IRUGO, show_ascii, NULL, PSU_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_min, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_max, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_min, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_max, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iin_max, S_IRUGO, show_linear, NULL, PSU_MFR_IIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX); + +static struct attribute *ym2651y_attributes[] = { + &sensor_dev_attr_psu_power_on.dev_attr.attr, + &sensor_dev_attr_psu_temp_fault.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_over_temp.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr, + NULL +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + return (attr->index == PSU_PMBUS_REVISION) ? sprintf(buf, "%d\n", data->pmbus_revision) : + sprintf(buf, "0\n"); +} + +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u16 status = 0; + + switch (attr->index) { + case PSU_POWER_ON: /* psu_power_on, low byte bit 6 of status_word, 0=>ON, 1=>OFF */ + status = (data->status_word & 0x40) ? 0 : 1; + break; + case PSU_TEMP_FAULT: /* psu_temp_fault, low byte bit 2 of status_word, 0=>Normal, 1=>temp fault */ + status = (data->status_word & 0x4) >> 2; + break; + case PSU_POWER_GOOD: /* psu_power_good, high byte bit 3 of status_word, 0=>OK, 1=>FAIL */ + status = (data->status_word & 0x800) ? 0 : 1; + break; + } + + return sprintf(buf, "%d\n", status); +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + ym2651y_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_OUT: + value = data->v_out; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp; + break; + case PSU_FAN1_SPEED: + value = data->fan_speed; + multiplier = 1; + break; + case PSU_FAN1_DUTY_CYCLE: + value = data->fan_duty_cycle[0]; + multiplier = 1; + break; + case PSU_MFR_VIN_MIN: + value = data->mfr_vin_min; + break; + case PSU_MFR_VIN_MAX: + value = data->mfr_vin_max; + break; + case PSU_MFR_VOUT_MIN: + value = data->mfr_vout_min; + break; + case PSU_MFR_VOUT_MAX: + value = data->mfr_vout_max; + break; + case PSU_MFR_PIN_MAX: + value = data->mfr_pin_max; + break; + case PSU_MFR_POUT_MAX: + value = data->mfr_pout_max; + break; + case PSU_MFR_IOUT_MAX: + value = data->mfr_iout_max; + break; + case PSU_MFR_IIN_MAX: + value = data->mfr_iin_max; + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct ym2651y_data *data = ym2651y_update_device(dev); + + return sprintf(buf, "%d\n", data->over_temp >> 7); +} + +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u8 *ptr = NULL; + + switch (attr->index) { + case PSU_FAN_DIRECTION: /* psu_fan_dir */ + ptr = data->fan_dir; + break; + case PSU_MFR_ID: /* psu_mfr_id */ + ptr = data->mfr_id; + break; + case PSU_MFR_MODEL: /* psu_mfr_model */ + ptr = data->mfr_model; + break; + case PSU_MFR_REVISION: /* psu_mfr_revision */ + ptr = data->mfr_revsion; + break; + default: + return 0; + } + + return sprintf(buf, "%s\n", ptr); +} + +static const struct attribute_group ym2651y_group = { + .attrs = ym2651y_attributes, +}; + +static int ym2651y_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct ym2651y_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct ym2651y_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &ym2651y_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int ym2651y_remove(struct i2c_client *client) +{ + struct ym2651y_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id ym2651y_id[] = { + { "ym2651", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, ym2651y_id); + +static struct i2c_driver ym2651y_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "ym2651", + }, + .probe = ym2651y_probe, + .remove = ym2651y_remove, + .id_table = ym2651y_id, + .address_list = normal_i2c, +}; + +static int ym2651y_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int ym2651y_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +static int ym2651y_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; + +abort: + return result; +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct ym2651y_data *ym2651y_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int i, status; + u8 command; + u8 fan_dir[5] = {0}; + struct reg_data_byte regs_byte[] = { {0x19, &data->capability}, + {0x7d, &data->over_temp}, + {0x81, &data->fan_fault}, + {0x98, &data->pmbus_revision}}; + struct reg_data_word regs_word[] = { {0x79, &data->status_word}, + {0x8b, &data->v_out}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x8d, &data->temp}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x3c, &(data->fan_duty_cycle[1])}, + {0x90, &data->fan_speed}, + {0xa0, &data->mfr_vin_min}, + {0xa1, &data->mfr_vin_max}, + {0xa2, &data->mfr_iin_max}, + {0xa3, &data->mfr_pin_max}, + {0xa4, &data->mfr_vout_min}, + {0xa5, &data->mfr_vout_max}, + {0xa6, &data->mfr_iout_max}, + {0xa7, &data->mfr_pout_max}}; + + dev_dbg(&client->dev, "Starting ym2651 update\n"); + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = ym2651y_read_byte(client, regs_byte[i].reg); + + if (status < 0) + { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + } + else { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = ym2651y_read_word(client, regs_word[i].reg); + + if (status < 0) + { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + } + else { + *(regs_word[i].value) = status; + } + } + + /* Read fan_direction */ + command = 0xC3; + status = ym2651y_read_block(client, command, fan_dir, ARRAY_SIZE(fan_dir)-1); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + } + + strncpy(data->fan_dir, fan_dir+1, ARRAY_SIZE(data->fan_dir)-1); + data->fan_dir[ARRAY_SIZE(data->fan_dir)-1] = '\0'; + + /* Read mfr_id */ + command = 0x99; + status = ym2651y_read_block(client, command, data->mfr_id, + ARRAY_SIZE(data->mfr_id)-1); + data->mfr_id[ARRAY_SIZE(data->mfr_id)-1] = '\0'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + /* Read mfr_model */ + command = 0x9a; + status = ym2651y_read_block(client, command, data->mfr_model, + ARRAY_SIZE(data->mfr_model)-1); + data->mfr_model[ARRAY_SIZE(data->mfr_model)-1] = '\0'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + /* Read mfr_revsion */ + command = 0x9b; + status = ym2651y_read_block(client, command, data->mfr_revsion, + ARRAY_SIZE(data->mfr_revsion)-1); + data->mfr_revsion[ARRAY_SIZE(data->mfr_revsion)-1] = '\0'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(ym2651y_driver); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("3Y Power YM-2651Y driver"); +MODULE_LICENSE("GPL"); + + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/scripts/as7712_32x_platform_init.sh b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/scripts/as7712_32x_platform_init.sh new file mode 100644 index 000000000000..448f2ec341a4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/scripts/as7712_32x_platform_init.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "TO-DO: as7712-32x driver setting" diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/changelog b/platform/broadcom/sonic-platform-modules-accton/debian/changelog new file mode 100644 index 000000000000..6a687800eeac --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/changelog @@ -0,0 +1,5 @@ +sonic-accton-platform-modules (1.0) unstable; urgency=low + + * Initial release + + -- Polly Hsu Tue, 9 May 2017 17:54:11 -0800 \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/compat b/platform/broadcom/sonic-platform-modules-accton/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/control b/platform/broadcom/sonic-platform-modules-accton/debian/control new file mode 100644 index 000000000000..755c58612bb0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/control @@ -0,0 +1,11 @@ +Source: sonic-accton-platform-modules +Section: main +Priority: extra +Maintainer: polly_hsu +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-as7712-32x +Architecture: amd64 +Depends: linux-image-3.16.0-4-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.init b/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.init new file mode 100644 index 000000000000..c54b2a3e310d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.init @@ -0,0 +1,44 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup AS7712-32X board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + modprobe i2c_dev + modprobe i2c_mux_pca954x + modprobe accton_i2c_cpld + modprobe accton_as7712_32x_fan + modprobe accton_as7712_32x_sfp + modprobe leds-accton_as7712_32x + modprobe accton_as7712_32x_psu + + echo "done." + ;; + +stop) + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-as7712-32x.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.install b/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.install new file mode 100644 index 000000000000..39abf57e2f65 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.install @@ -0,0 +1,2 @@ +as7712-32x/scripts/as7712_32x_platform_init.sh usr/local/bin +as7712-32x/cfg/as7712_32x-modules.conf etc/modules-load.d diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules new file mode 100644 index 000000000000..a1026ca62832 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules @@ -0,0 +1,36 @@ +#!/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:= as7712-32x + +%: + 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); \ + mkdir -p debian/platform-modules-$${mod}/etc/bcm; \ + 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) + From 7472cd303e622fe3dba3202d97f9909eb8436081 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 16 Jun 2017 00:05:41 -0700 Subject: [PATCH 0610/1833] [image]: load platform specific settings in sonic-to-sonic upgrade (#710) --- .../dell/x86_64-dell_s6000_s1220-r0/installer.conf | 4 ++++ installer/x86_64/install.sh | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf b/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf index eb135bee0ff1..a8fef6185912 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf +++ b/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf @@ -1,5 +1,7 @@ ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="processor.max_cstate=1 intel_idle.max_cstate=0" +if [ "$install_env" = "onie" ]; then + echo "Replace ONIE reboot with Dell reset commands" # set I2C GPIO mux @@ -21,3 +23,5 @@ i2cset -y 0 0x31 1 0xfd EOF chmod a+x /sbin/reboot + +fi diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 18669893bcb5..f7d1dbb29a6f 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -36,7 +36,14 @@ if [ $(id -u) -ne 0 ] fi # get running machine from conf file -[ -r /etc/machine.conf ] && . /etc/machine.conf +if [ -r /etc/machine.conf ]; then + . /etc/machine.conf +elif [ -r /host/machine.conf ]; then + . /host/machine.conf +else + echo "cannot find machine.conf" + exit 1 +fi echo "onie_platform: $onie_platform" @@ -57,9 +64,10 @@ if [ -d "/etc/sonic" ]; then else echo "Installing SONiC in ONIE" install_env="onie" - [ -r platforms/$onie_platform ] && source platforms/$onie_platform fi +[ -r platforms/$onie_platform ] && . platforms/$onie_platform + # Install demo on same block device as ONIE onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') blk_dev=$(echo $onie_dev | sed -e 's/[1-9][0-9]*$//' | sed -e 's/\([0-9]\)\(p\)/\1/') From 7267da3ff866dd1d13e90b2631a2b32034c9dba7 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Fri, 16 Jun 2017 10:35:36 +0300 Subject: [PATCH 0611/1833] [submodule]: Update sairedis submodule (#712) Include fix for saithrift port split parsing --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index f02e667d03f7..1eeb716837bb 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit f02e667d03f7840132c9dd210254cff2b2e0ad1d +Subproject commit 1eeb716837bb4e6cd4d179e3654ee67e74cf5736 From 6867458058cf94fe6a8aa2685160db535061449e Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Fri, 16 Jun 2017 07:25:40 -0700 Subject: [PATCH 0612/1833] [docker-ptf]: Install exabgp in docker ptf (#709) --- dockers/docker-ptf/Dockerfile.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index c546ad2fab9c..59360ee4fa2e 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -45,7 +45,8 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / ipython \ git \ iputils-ping \ - hping3 + hping3 \ + curl ## Reinstall scapy by version from p4lang RUN git clone https://github.com/p4lang/scapy-vxlan.git && cd scapy-vxlan && python setup.py install @@ -78,6 +79,8 @@ RUN rm -rf /debs \ && pip install pysubnettree \ && pip install paramiko \ && pip install parallel-ssh \ + && pip install flask \ + && pip install exabgp==3.4.17\ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py From 897cc2bbb55a6d90ff5ef5aa4ca2d97e8ab10019 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 18 Jun 2017 14:38:31 -0700 Subject: [PATCH 0613/1833] [platform]: fix file mode for acction platform to create clean build (#714) --- platform/broadcom/sonic-platform-modules-accton/debian/rules | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 platform/broadcom/sonic-platform-modules-accton/debian/rules diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules old mode 100644 new mode 100755 From 2f231f36538886b43d0963fc6e793ef920a8a2b4 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 18 Jun 2017 15:52:49 -0700 Subject: [PATCH 0614/1833] [image]: expand dockerfs.tar.gz directly on to disk without intermediate file (#715) --- installer/x86_64/install.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index f7d1dbb29a6f..ca8c4d3e47e7 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -422,12 +422,11 @@ else fi # Decompress the file for the file system directly to the partition -unzip $ONIE_INSTALLER_PAYLOAD -d $demo_mnt/$image_dir +unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir -if [ -f $demo_mnt/$image_dir/$FILESYSTEM_DOCKERFS ]; then - TAR_EXTRA_OPTION="--numeric-owner" - cd $demo_mnt/$image_dir && mkdir -p $DOCKERFS_DIR && tar x $TAR_EXTRA_OPTION -f $FILESYSTEM_DOCKERFS -C $DOCKERFS_DIR && rm -f $FILESYSTEM_DOCKERFS; cd $OLDPWD -fi +TAR_EXTRA_OPTION="--numeric-owner" +mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR +unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR # Create loop device for /var/log to limit its size to $VAR_LOG_SIZE MB if [ -f $demo_mnt/disk-img/var-log.ext4 ]; then From 4a780f4a6ac30e91d6b7a8dc71f87a4902a23367 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 18 Jun 2017 16:54:13 -0700 Subject: [PATCH 0615/1833] [submodule]: update swss/sairedis/swss-common submodule (#716) fix bug for logrotate sairedis log --- files/image_config/logrotate.d/rsyslog | 15 ++++++++++++++- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/files/image_config/logrotate.d/rsyslog b/files/image_config/logrotate.d/rsyslog index a212ddfce15c..4693288f18cc 100644 --- a/files/image_config/logrotate.d/rsyslog +++ b/files/image_config/logrotate.d/rsyslog @@ -1,7 +1,6 @@ /var/log/syslog /var/log/quagga/*.log /var/log/teamd.log -/var/log/swss/*.rec { rotate 7 daily @@ -18,6 +17,20 @@ kill -HUP $(cat /var/run/rsyslogd.pid) endscript } +/var/log/swss/*.rec +{ + rotate 7 + daily + maxsize 20M + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + pgrep -x orchagent | xargs /bin/kill -HUP 2>/dev/null || true + endscript +} /var/log/mail.info /var/log/mail.warn /var/log/mail.err diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 1eeb716837bb..b865912105f2 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 1eeb716837bb4e6cd4d179e3654ee67e74cf5736 +Subproject commit b865912105f2f80ee2516899e6367f863d5f6235 diff --git a/src/sonic-swss b/src/sonic-swss index b893b4f70b79..002adc7bdea0 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit b893b4f70b79f5a87674e3a67a64accff0dd9437 +Subproject commit 002adc7bdea0894eb11835374463eb9c2f208790 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index ececc0a99ce1..345576ea38cc 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit ececc0a99ce1c188007b5b59de1bb11a06dd006d +Subproject commit 345576ea38cc511b265825b445c48dbfbf444792 From 35cec022e6f51e7a8ceb218578b6e48baf0b0544 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 19 Jun 2017 11:17:30 -0700 Subject: [PATCH 0616/1833] [submodule]: update sonic-swss (#719) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 002adc7bdea0..316b33371dcb 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 002adc7bdea0894eb11835374463eb9c2f208790 +Subproject commit 316b33371dcbccd3d81fa6987170be3e7a3a1536 From 493edb45848564c9489a3f4fad4a46446bd59862 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 19 Jun 2017 22:16:05 -0700 Subject: [PATCH 0617/1833] [image]: add debian security update in the apt source list (#724) --- .../sources.list.d/debian_archive_trafficmanager_net_debian.list | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list b/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list index 503897133ca3..d5ecf56d4069 100644 --- a/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list +++ b/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list @@ -1 +1,2 @@ deb 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 From fe56389a0f8d9350744038f560e66a70a159bb07 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 19 Jun 2017 22:16:21 -0700 Subject: [PATCH 0618/1833] [submodule]: update sonic-platform-daemons (#722) --- src/sonic-platform-daemons | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index bd7c31075765..dac4bf5a242f 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit bd7c310757658396ccfaaf653ede4a931b3d4154 +Subproject commit dac4bf5a242fe3c10d750378b7aaf6d41ac573ee From 894976e15569d6cc109b0c523e4b3409dc0735be Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 19 Jun 2017 22:16:50 -0700 Subject: [PATCH 0619/1833] [platform]: turn on/off four leds for breakout-able front panel ports (#723) turn on/off four leds for breakout-able front panel ports on arista 7050 qx32 platform --- .../plugins/led_control.py | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py index e246a2e61581..9b8fd2f79186 100644 --- a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py @@ -48,21 +48,23 @@ def port_link_state_change(self, port, state): if qsfp_index <= 0: return - # QSFP indices 1-24 are breakout-capable and have four LEDs, + # QSFP indices 1-24 are breakout-capable and have four LEDs, and each LED indicate one lane. # whereas indices 25-32 are not breakout-capable, and only have one if qsfp_index <= self.QSFP_BREAKOUT_END_IDX: - led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, 1) + # assuming 40G, then we need to control four lanes + led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, i) for i in range(1, 5) ] else: - led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) + led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) ] - led_file = open(led_sysfs_path, "w") + for led_sysfs_path in led_sysfs_paths: + led_file = open(led_sysfs_path, "w") - if state == "up": - led_file.write("%d" % self.LED_COLOR_GREEN) - else: - led_file.write("%d" % self.LED_COLOR_OFF) + if state == "up": + led_file.write("%d" % self.LED_COLOR_GREEN) + else: + led_file.write("%d" % self.LED_COLOR_OFF) - led_file.close() + led_file.close() # Constructor def __init__(self): From cc218b34510b11bc73bbb87dbab68fcfee2caa7d Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Tue, 20 Jun 2017 12:22:30 -0700 Subject: [PATCH 0620/1833] [sonic-quagga]:update submodule (#718) Signed-off-by: Sihui Han --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index 5da3e26ecddf..df6b70902b4c 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 5da3e26ecddfec6f5983f34b27056b64f67e09d3 +Subproject commit df6b70902b4c29447ac52277cf6d5b7f6abca71e From c2c232a1619845108985292ee854bb9e6a954ed5 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 20 Jun 2017 16:37:07 -0700 Subject: [PATCH 0621/1833] Add Broadcom LED microprocessor initialization for Dell S6000 (#726) * Add Broadcom LED microprocessor initialization for Dell S6000 * Increase bcmcmd timeout to 60 seconds --- .../led_proc_init.soc | 43 +++++++++++++++++++ platform/broadcom/docker-syncd-brcm/start.sh | 7 +++ 2 files changed, 50 insertions(+) create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/led_proc_init.soc diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/led_proc_init.soc b/device/dell/x86_64-dell_s6000_s1220-r0/led_proc_init.soc new file mode 100644 index 000000000000..ddda7bdb639a --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/led_proc_init.soc @@ -0,0 +1,43 @@ +# LED microprocessor initialization for Dell s6000 + +led 0 stop +led 0 prog 02 31 60 F7 02 01 28 60 F6 D6 F7 70 28 67 44 06 F6 06 F6 80 D2 35 74 06 86 F8 3A 40 67 80 67 44 06 F6 67 80 67 80 67 3C D2 32 70 1C D2 34 70 1C 67 44 06 F6 67 80 67 80 67 80 67 3C 06 F7 F2 01 60 F7 77 11 32 08 97 71 4C 77 80 57 67 61 32 00 32 01 B7 97 71 5C 95 75 74 85 77 7C 02 0A 50 77 56 06 F6 D2 17 75 6C 12 88 FE F6 57 06 F6 E2 17 12 D4 F8 57 16 F8 CA 05 74 80 77 7C 22 0E 87 57 22 0F 87 57 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0x31 REMAP_PORT_2=0 REMAP_PORT_1=0 REMAP_PORT_0=0 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=0x32 REMAP_PORT_6=0 REMAP_PORT_5=0 REMAP_PORT_4=0 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=0 REMAP_PORT_8=0 REMAP_PORT_11=0x34 REMAP_PORT_10=0 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=0x33 REMAP_PORT_14=0 REMAP_PORT_13=0 REMAP_PORT_12=0 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=0x16 REMAP_PORT_18=0x15 REMAP_PORT_17=0x18 REMAP_PORT_16=0x17 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=0x11 REMAP_PORT_22=0x12 REMAP_PORT_21=0x13 REMAP_PORT_20=0x14 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=9 REMAP_PORT_26=0xa REMAP_PORT_25=0xb REMAP_PORT_24=0xc +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=0xe REMAP_PORT_30=0xd REMAP_PORT_29=0x10 REMAP_PORT_28=0xf +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=0x2e REMAP_PORT_34=0x2d REMAP_PORT_33=0x30 REMAP_PORT_32=0x2f +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=0x29 REMAP_PORT_38=0x2a REMAP_PORT_37=0x2b REMAP_PORT_36=0x2c +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=6 REMAP_PORT_42=5 REMAP_PORT_41=8 REMAP_PORT_40=7 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=1 REMAP_PORT_46=2 REMAP_PORT_45=3 REMAP_PORT_44=4 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=0x26 REMAP_PORT_50=0x25 REMAP_PORT_49=0x28 REMAP_PORT_48=0x27 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=0x21 REMAP_PORT_54=0x22 REMAP_PORT_53=0x23 REMAP_PORT_52=0x24 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=0x19 REMAP_PORT_58=0x1a REMAP_PORT_57=0x1b REMAP_PORT_56=0x1c +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0x1e REMAP_PORT_62=0x1d REMAP_PORT_61=0x20 REMAP_PORT_60=0x1f +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 02 31 60 F7 02 01 28 60 F6 D6 F7 70 28 67 44 06 F6 06 F6 80 D2 35 74 06 86 F8 3A 40 67 80 67 44 06 F6 67 80 67 80 67 3C D2 32 70 1C D2 34 70 1C 67 44 06 F6 67 80 67 80 67 80 67 3C 06 F7 F2 01 60 F7 77 11 32 08 97 71 4C 77 80 57 67 61 32 00 32 01 B7 97 71 5C 95 75 74 85 77 7C 02 0A 50 77 56 06 F6 D2 17 75 6C 12 88 FE F6 57 06 F6 E2 17 12 D4 F8 57 16 F8 CA 05 74 80 77 7C 22 0E 87 57 22 0F 87 57 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0x1e REMAP_PORT_2=0x1d REMAP_PORT_1=0x20 REMAP_PORT_0=0x1f +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=0x19 REMAP_PORT_6=0x1a REMAP_PORT_5=0x1b REMAP_PORT_4=0x1c +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=0x23 REMAP_PORT_8=0x24 REMAP_PORT_11=0x21 REMAP_PORT_10=0x22 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=0x26 REMAP_PORT_14=0x25 REMAP_PORT_13=0x28 REMAP_PORT_12=0x27 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=0x16 REMAP_PORT_18=0x15 REMAP_PORT_17=0x18 REMAP_PORT_16=0x17 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=0x11 REMAP_PORT_22=0x12 REMAP_PORT_21=0x13 REMAP_PORT_20=0x14 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=0x34 REMAP_PORT_26=0 REMAP_PORT_25=0 REMAP_PORT_24=0 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=0x33 REMAP_PORT_30=0 REMAP_PORT_29=0 REMAP_PORT_28=0 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=0x2e REMAP_PORT_34=0x2d REMAP_PORT_33=0x30 REMAP_PORT_32=0x2f +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=0x29 REMAP_PORT_38=0x2a REMAP_PORT_37=0x2b REMAP_PORT_36=0x2c +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=0x31 REMAP_PORT_42=0 REMAP_PORT_41=0 REMAP_PORT_40=0 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=0x32 REMAP_PORT_46=0 REMAP_PORT_45=0 REMAP_PORT_44=0 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=9 REMAP_PORT_50=0xa REMAP_PORT_49=0xb REMAP_PORT_48=0xc +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=0xe REMAP_PORT_54=0xd REMAP_PORT_53=0x10 REMAP_PORT_52=0xf +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=6 REMAP_PORT_58=5 REMAP_PORT_57=8 REMAP_PORT_56=7 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=1 REMAP_PORT_62=2 REMAP_PORT_61=3 REMAP_PORT_60=4 +led 1 auto on +led 1 start diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index 96e2a9128081..6f9b69ff8d40 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -1,8 +1,15 @@ #!/usr/bin/env bash +PLATFORM_DIR=/usr/share/sonic/platform + rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd supervisorctl start syncd +# If this platform has an initialization file for the Broadcom LED microprocessor, load it +if [ -r ${PLATFORM_DIR}/led_proc_init.soc ]; then + /usr/bin/bcmcmd -t 60 "rcload ${PLATFORM_DIR}/led_proc_init.soc" +fi + From 6feef14f2e5e2a06a3f0aa1153feed80b41fa357 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 20 Jun 2017 20:39:42 -0700 Subject: [PATCH 0622/1833] [platform]: Update sonic-platform-modules-arista (#727) --- platform/broadcom/sonic-platform-modules-arista | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 393e5e1f19fd..75e84737680f 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 393e5e1f19fd33853bb375d70a10fa7cf4613e4a +Subproject commit 75e84737680f5451eb9c947d01968b972d989bb3 From c4133e166b09e9787228a2edbf7e31955f25fd37 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 20 Jun 2017 20:50:51 -0700 Subject: [PATCH 0623/1833] [Broadcom]: Update SAI package to support Accton-AS7712-C32 (#720) --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 74baaa712f10..130520298120 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-11-20170605231900.43_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-11-20170605231900.43_amd64.deb?sv=2015-04-05&sr=b&sig=NNBDS1OSXn2w4dNSbqBbJnqXTrqH7YAkKIa%2Fi9yaOJs%3D&se=2031-02-12T23%3A22%3A01Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-12-20170607194342.44_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-12-20170607194342.44_amd64.deb?sv=2015-04-05&sr=b&sig=gJJVxVT2o%2Bm14%2BwCBYFmBfcrDCzBA4b4iSmDKxnS13o%3D&se=2031-02-26T17%3A39%3A50Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-11-20170605231900.43_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-12-20170607194342.44_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-11-20170605231900.43_amd64.deb?sv=2015-04-05&sr=b&sig=jxozueiuQdOuJdEfC9%2BWSfFXSL68FQVwL%2FM5Obfj3gs%3D&se=2031-02-12T23%3A21%3A35Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-12-20170607194342.44_amd64.deb?sv=2015-04-05&sr=b&sig=AfYK3Qz%2FTV61E89u0kASm7wF3LEiqaZb%2Fde2jvbw9yk%3D&se=2031-02-26T17%3A40%3A14Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From 66859385b676d9b1c504ac0d492ba2b033e8bf33 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Wed, 21 Jun 2017 11:52:16 +0800 Subject: [PATCH 0624/1833] =?UTF-8?q?Remove=20exsiting=20sonic-platform-mo?= =?UTF-8?q?dules-accton=20and=20apply=20submodule=20add=E2=80=A6=20(#717)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove exsiting sonic-platform-modules-accton and apply submodule adding on this folder. * Remove redundant commnet * Remove folder platform/broadcom/sonic-platform-modules-accton. * Add this dir for submodule. --- .gitmodules | 3 + .../plugins/eeprom.py | 24 + .../plugins/sfputil.py | 60 + platform/broadcom/platform-modules-accton.mk | 5 +- .../broadcom/sonic-platform-modules-accton | 1 + .../sonic-platform-modules-accton/.gitignore | 33 - .../sonic-platform-modules-accton/LICENSE | 16 - .../sonic-platform-modules-accton/README.md | 1 - .../as7712-32x/cfg/as7712_32x-modules.conf | 13 - .../as7712-32x/modules/Makefile | 2 - .../modules/accton_as7712_32x_fan.c | 452 ------- .../modules/accton_as7712_32x_psu.c | 293 ----- .../modules/accton_as7712_32x_sfp.c | 1083 ----------------- .../as7712-32x/modules/accton_i2c_cpld.c | 259 ---- .../modules/leds-accton_as7712_32x.c | 443 ------- .../as7712-32x/modules/ym2651y.c | 589 --------- .../scripts/as7712_32x_platform_init.sh | 3 - .../debian/changelog | 5 - .../debian/compat | 1 - .../debian/control | 11 - .../debian/platform-modules-as7712-32x.init | 44 - .../platform-modules-as7712-32x.install | 2 - .../debian/rules | 36 - 23 files changed, 89 insertions(+), 3290 deletions(-) create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/plugins/eeprom.py create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py create mode 160000 platform/broadcom/sonic-platform-modules-accton delete mode 100644 platform/broadcom/sonic-platform-modules-accton/.gitignore delete mode 100644 platform/broadcom/sonic-platform-modules-accton/LICENSE delete mode 100644 platform/broadcom/sonic-platform-modules-accton/README.md delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/cfg/as7712_32x-modules.conf delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c delete mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/scripts/as7712_32x_platform_init.sh delete mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/changelog delete mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/compat delete mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/control delete mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.init delete mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.install delete mode 100755 platform/broadcom/sonic-platform-modules-accton/debian/rules diff --git a/.gitmodules b/.gitmodules index 99938c4abaca..454019f9ebdd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -63,3 +63,6 @@ [submodule "src/sonic-platform-daemons"] path = src/sonic-platform-daemons url = https://github.com/Azure/sonic-platform-daemons +[submodule "platform/broadcom/sonic-platform-modules-accton"] + path = platform/broadcom/sonic-platform-modules-accton + url = https://github.com/edge-core/sonic-platform-modules-accton.git diff --git a/device/accton/x86_64-accton_as7712_32x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7712_32x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..7681caafeef4 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + #Two i2c buses might get flipped order, check them both. + if not os.path.exists(self.eeprom_path): + self.eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..6dc35d72bb21 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 9 : 18, + 10 : 19, + 11 : 20, + 12 : 21, + 1 : 22, + 2 : 23, + 3 : 24, + 4 : 25, + 6 : 26, + 5 : 27, + 8 : 28, + 7 : 29, + 13 : 30, + 14 : 31, + 15 : 32, + 16 : 33, + 17 : 34, + 18 : 35, + 19 : 36, + 20 : 37, + 25 : 38, + 26 : 39, + 27 : 40, + 28 : 41, + 29 : 42, + 30 : 43, + 31 : 44, + 32 : 45, + 21 : 46, + 22 : 47, + 23 : 48, + 24 : 49, + } + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' + for x in range(self.port_start, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x+1]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + sfputilbase.__init__(self, port_num) diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index 00128a20f8d2..e5357c5e9f14 100644 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -4,11 +4,8 @@ ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION = 1.0 export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION -ACCTON_AS7712_32X_PLATFORM_MODULE = platform-modules-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb +ACCTON_AS7712_32X_PLATFORM_MODULE = sonic-platform-accton-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7712_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton $(ACCTON_AS7712_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(ACCTON_AS7712_32X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7712_32x-r0 SONIC_DPKG_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) - -$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE))) - diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton new file mode 160000 index 000000000000..99607d63220d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton @@ -0,0 +1 @@ +Subproject commit 99607d63220de336a61d81f6b4d1e64062761abe diff --git a/platform/broadcom/sonic-platform-modules-accton/.gitignore b/platform/broadcom/sonic-platform-modules-accton/.gitignore deleted file mode 100644 index f805e810e5c6..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -# Object files -*.o -*.ko -*.obj -*.elf - -# 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 diff --git a/platform/broadcom/sonic-platform-modules-accton/LICENSE b/platform/broadcom/sonic-platform-modules-accton/LICENSE deleted file mode 100644 index bc693f7a4c40..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -Copyright (C) 2016 Microsoft, Inc -Copyright (C) 2017 Accton Technology Corporation - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 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-accton/README.md b/platform/broadcom/sonic-platform-modules-accton/README.md deleted file mode 100644 index 743db0cb238f..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/README.md +++ /dev/null @@ -1 +0,0 @@ -platform drivers for AS7712_32X for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/cfg/as7712_32x-modules.conf b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/cfg/as7712_32x-modules.conf deleted file mode 100644 index cf2c5fa775bd..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/cfg/as7712_32x-modules.conf +++ /dev/null @@ -1,13 +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_dev -i2c_mux_pca954x -accton_i2c_cpld -accton_as7712_32x_fan -accton_as7712_32x_sfp -leds-accton_as7712_32x -accton_as7712_32x_psu - diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile deleted file mode 100644 index 83319ec62e58..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \ - accton_as7712_32x_psu.o accton_i2c_cpld.o ym2651y.o \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c deleted file mode 100644 index 52db1e9dc028..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * A hwmon driver for the Accton as7712 32x fan - * - * Copyright (C) 2014 Accton Technology Corporation. - * Brandon Chuang - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DRVNAME "as7712_32x_fan" - -static struct as7712_32x_fan_data *as7712_32x_fan_update_device(struct device *dev); -static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); -static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, - const char *buf, size_t count); -extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); -extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); - -/* fan related data, the index should match sysfs_fan_attributes - */ -static const u8 fan_reg[] = { - 0x0F, /* fan 1-6 present status */ - 0x11, /* fan PWM(for all fan) */ - 0x12, /* front fan 1 speed(rpm) */ - 0x13, /* front fan 2 speed(rpm) */ - 0x14, /* front fan 3 speed(rpm) */ - 0x15, /* front fan 4 speed(rpm) */ - 0x16, /* front fan 5 speed(rpm) */ - 0x17, /* front fan 6 speed(rpm) */ - 0x22, /* rear fan 1 speed(rpm) */ - 0x23, /* rear fan 2 speed(rpm) */ - 0x24, /* rear fan 3 speed(rpm) */ - 0x25, /* rear fan 4 speed(rpm) */ - 0x26, /* rear fan 5 speed(rpm) */ - 0x27, /* rear fan 6 speed(rpm) */ -}; - -/* Each client has this additional data */ -struct as7712_32x_fan_data { - struct device *hwmon_dev; - struct mutex update_lock; - char valid; /* != 0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ -}; - -enum fan_id { - FAN1_ID, - FAN2_ID, - FAN3_ID, - FAN4_ID, - FAN5_ID, - FAN6_ID -}; - -enum sysfs_fan_attributes { - FAN_PRESENT_REG, - FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ - FAN1_FRONT_SPEED_RPM, - FAN2_FRONT_SPEED_RPM, - FAN3_FRONT_SPEED_RPM, - FAN4_FRONT_SPEED_RPM, - FAN5_FRONT_SPEED_RPM, - FAN6_FRONT_SPEED_RPM, - FAN1_REAR_SPEED_RPM, - FAN2_REAR_SPEED_RPM, - FAN3_REAR_SPEED_RPM, - FAN4_REAR_SPEED_RPM, - FAN5_REAR_SPEED_RPM, - FAN6_REAR_SPEED_RPM, - FAN1_PRESENT, - FAN2_PRESENT, - FAN3_PRESENT, - FAN4_PRESENT, - FAN5_PRESENT, - FAN6_PRESENT, - FAN1_FAULT, - FAN2_FAULT, - FAN3_FAULT, - FAN4_FAULT, - FAN5_FAULT, - FAN6_FAULT -}; - -/* Define attributes - */ -#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index) \ - static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) -#define DECLARE_FAN_FAULT_ATTR(index) &sensor_dev_attr_fan##index##_fault.dev_attr.attr - -#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ - static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO, fan_show_value, NULL, FAN##index##_DIRECTION) -#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr - -#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ - static SENSOR_DEVICE_ATTR(fan##index##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN##index##_DUTY_CYCLE_PERCENTAGE) -#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan##index##_duty_cycle_percentage.dev_attr.attr - -#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ - static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) -#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr - -#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index) \ - static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ - static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) -#define DECLARE_FAN_SPEED_RPM_ATTR(index) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ - &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr - -/* 6 fan fault attributes in this platform */ -DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1); -DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2); -DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3); -DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4); -DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5); -DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(6); -/* 6 fan speed(rpm) attributes in this platform */ -DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1); -DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2); -DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3); -DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4); -DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5); -DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(6); -/* 6 fan present attributes in this platform */ -DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); -DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); -DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); -DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); -DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(5); -DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(6); -/* 1 fan duty cycle attribute in this platform */ -DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(); - -static struct attribute *as7712_32x_fan_attributes[] = { - /* fan related attributes */ - DECLARE_FAN_FAULT_ATTR(1), - DECLARE_FAN_FAULT_ATTR(2), - DECLARE_FAN_FAULT_ATTR(3), - DECLARE_FAN_FAULT_ATTR(4), - DECLARE_FAN_FAULT_ATTR(5), - DECLARE_FAN_FAULT_ATTR(6), - DECLARE_FAN_SPEED_RPM_ATTR(1), - DECLARE_FAN_SPEED_RPM_ATTR(2), - DECLARE_FAN_SPEED_RPM_ATTR(3), - DECLARE_FAN_SPEED_RPM_ATTR(4), - DECLARE_FAN_SPEED_RPM_ATTR(5), - DECLARE_FAN_SPEED_RPM_ATTR(6), - DECLARE_FAN_PRESENT_ATTR(1), - DECLARE_FAN_PRESENT_ATTR(2), - DECLARE_FAN_PRESENT_ATTR(3), - DECLARE_FAN_PRESENT_ATTR(4), - DECLARE_FAN_PRESENT_ATTR(5), - DECLARE_FAN_PRESENT_ATTR(6), - DECLARE_FAN_DUTY_CYCLE_ATTR(), - NULL -}; - -#define FAN_DUTY_CYCLE_REG_MASK 0xF -#define FAN_MAX_DUTY_CYCLE 100 -#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100 - -static int as7712_32x_fan_read_value(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg); -} - -static int as7712_32x_fan_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} - -/* fan utility functions - */ -static u32 reg_val_to_duty_cycle(u8 reg_val) -{ - reg_val &= FAN_DUTY_CYCLE_REG_MASK; - return ((u32)(reg_val+1) * 625 + 75)/ 100; -} - -static u8 duty_cycle_to_reg_val(u8 duty_cycle) -{ - return ((u32)duty_cycle * 100 / 625) - 1; -} - -static u32 reg_val_to_speed_rpm(u8 reg_val) -{ - return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; -} - -static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) -{ - u8 mask = (1 << id); - - reg_val &= mask; - - return reg_val ? 0 : 1; -} - -static u8 is_fan_fault(struct as7712_32x_fan_data *data, enum fan_id id) -{ - u8 ret = 1; - int front_fan_index = FAN1_FRONT_SPEED_RPM + id; - int rear_fan_index = FAN1_REAR_SPEED_RPM + id; - - /* Check if the speed of front or rear fan is ZERO, - */ - if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && - reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { - ret = 0; - } - - return ret; -} - -static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - int error, value; - struct i2c_client *client = to_i2c_client(dev); - - error = kstrtoint(buf, 10, &value); - if (error) - return error; - - if (value < 0 || value > FAN_MAX_DUTY_CYCLE) - return -EINVAL; - - as7712_32x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ - as7712_32x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); - return count; -} - -static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev); - ssize_t ret = 0; - - if (data->valid) { - switch (attr->index) { - case FAN_DUTY_CYCLE_PERCENTAGE: - { - u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); - ret = sprintf(buf, "%u\n", duty_cycle); - break; - } - case FAN1_FRONT_SPEED_RPM: - case FAN2_FRONT_SPEED_RPM: - case FAN3_FRONT_SPEED_RPM: - case FAN4_FRONT_SPEED_RPM: - case FAN5_FRONT_SPEED_RPM: - case FAN6_FRONT_SPEED_RPM: - case FAN1_REAR_SPEED_RPM: - case FAN2_REAR_SPEED_RPM: - case FAN3_REAR_SPEED_RPM: - case FAN4_REAR_SPEED_RPM: - case FAN5_REAR_SPEED_RPM: - case FAN6_REAR_SPEED_RPM: - ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); - break; - case FAN1_PRESENT: - case FAN2_PRESENT: - case FAN3_PRESENT: - case FAN4_PRESENT: - case FAN5_PRESENT: - case FAN6_PRESENT: - ret = sprintf(buf, "%d\n", - reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], - attr->index - FAN1_PRESENT)); - break; - case FAN1_FAULT: - case FAN2_FAULT: - case FAN3_FAULT: - case FAN4_FAULT: - case FAN5_FAULT: - case FAN6_FAULT: - ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); - break; - default: - break; - } - } - - return ret; -} - -static const struct attribute_group as7712_32x_fan_group = { - .attrs = as7712_32x_fan_attributes, -}; - -static struct as7712_32x_fan_data *as7712_32x_fan_update_device(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct as7712_32x_fan_data *data = i2c_get_clientdata(client); - - mutex_lock(&data->update_lock); - - if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || - !data->valid) { - int i; - - dev_dbg(&client->dev, "Starting as7712_32x_fan update\n"); - data->valid = 0; - - /* Update fan data - */ - for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { - int status = as7712_32x_fan_read_value(client, fan_reg[i]); - - if (status < 0) { - data->valid = 0; - mutex_unlock(&data->update_lock); - dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); - return data; - } - else { - data->reg_val[i] = status; - } - } - - data->last_updated = jiffies; - data->valid = 1; - } - - mutex_unlock(&data->update_lock); - - return data; -} - -static int as7712_32x_fan_probe(struct i2c_client *client, - const struct i2c_device_id *dev_id) -{ - struct as7712_32x_fan_data *data; - int status; - - if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { - status = -EIO; - goto exit; - } - - data = kzalloc(sizeof(struct as7712_32x_fan_data), GFP_KERNEL); - if (!data) { - status = -ENOMEM; - goto exit; - } - - i2c_set_clientdata(client, data); - data->valid = 0; - mutex_init(&data->update_lock); - - dev_info(&client->dev, "chip found\n"); - - /* Register sysfs hooks */ - status = sysfs_create_group(&client->dev.kobj, &as7712_32x_fan_group); - if (status) { - goto exit_free; - } - - data->hwmon_dev = hwmon_device_register(&client->dev); - if (IS_ERR(data->hwmon_dev)) { - status = PTR_ERR(data->hwmon_dev); - goto exit_remove; - } - - dev_info(&client->dev, "%s: fan '%s'\n", - dev_name(data->hwmon_dev), client->name); - - return 0; - -exit_remove: - sysfs_remove_group(&client->dev.kobj, &as7712_32x_fan_group); -exit_free: - kfree(data); -exit: - - return status; -} - -static int as7712_32x_fan_remove(struct i2c_client *client) -{ - struct as7712_32x_fan_data *data = i2c_get_clientdata(client); - hwmon_device_unregister(data->hwmon_dev); - sysfs_remove_group(&client->dev.kobj, &as7712_32x_fan_group); - - return 0; -} - -/* Addresses to scan */ -static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; - -static const struct i2c_device_id as7712_32x_fan_id[] = { - { "as7712_32x_fan", 0 }, - {} -}; -MODULE_DEVICE_TABLE(i2c, as7712_32x_fan_id); - -static struct i2c_driver as7712_32x_fan_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = DRVNAME, - }, - .probe = as7712_32x_fan_probe, - .remove = as7712_32x_fan_remove, - .id_table = as7712_32x_fan_id, - .address_list = normal_i2c, -}; - -static int __init as7712_32x_fan_init(void) -{ - extern int platform_accton_as7712_32x(void); - if (!platform_accton_as7712_32x()) { - return -ENODEV; - } - - return i2c_add_driver(&as7712_32x_fan_driver); -} - -static void __exit as7712_32x_fan_exit(void) -{ - i2c_del_driver(&as7712_32x_fan_driver); -} - -module_init(as7712_32x_fan_init); -module_exit(as7712_32x_fan_exit); - -MODULE_AUTHOR("Brandon Chuang "); -MODULE_DESCRIPTION("as7712_32x_fan driver"); -MODULE_LICENSE("GPL"); - diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c deleted file mode 100644 index 8c9230ab2d24..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c +++ /dev/null @@ -1,293 +0,0 @@ -/* - * An hwmon driver for accton as7712_32x Power Module - * - * Copyright (C) 2014 Accton Technology Corporation. - * Brandon Chuang - * - * Based on ad7414.c - * Copyright 2006 Stefan Roese , DENX Software Engineering - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); -static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); -static int as7712_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); -extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); - -/* Addresses scanned - */ -static const unsigned short normal_i2c[] = { 0x50, 0x53, I2C_CLIENT_END }; - -/* Each client has this additional data - */ -struct as7712_32x_psu_data { - struct device *hwmon_dev; - struct mutex update_lock; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - u8 index; /* PSU index */ - u8 status; /* Status(present/power_good) register read from CPLD */ - char model_name[9]; /* Model name, read from eeprom */ -}; - -static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *dev); - -enum as7712_32x_psu_sysfs_attributes { - PSU_PRESENT, - PSU_MODEL_NAME, - PSU_POWER_GOOD -}; - -/* sysfs attributes for hwmon - */ -static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); -static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); -static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); - -static struct attribute *as7712_32x_psu_attributes[] = { - &sensor_dev_attr_psu_present.dev_attr.attr, - &sensor_dev_attr_psu_model_name.dev_attr.attr, - &sensor_dev_attr_psu_power_good.dev_attr.attr, - NULL -}; - -static ssize_t show_status(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct as7712_32x_psu_data *data = as7712_32x_psu_update_device(dev); - u8 status = 0; - - if (attr->index == PSU_PRESENT) { - status = !(data->status >> (1-data->index) & 0x1); - } - else { /* PSU_POWER_GOOD */ - status = (data->status >> (3-data->index) & 0x1); - } - - return sprintf(buf, "%d\n", status); -} - -static ssize_t show_model_name(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct as7712_32x_psu_data *data = as7712_32x_psu_update_device(dev); - - return sprintf(buf, "%s\n", data->model_name); -} - -static const struct attribute_group as7712_32x_psu_group = { - .attrs = as7712_32x_psu_attributes, -}; - -static int as7712_32x_psu_probe(struct i2c_client *client, - const struct i2c_device_id *dev_id) -{ - struct as7712_32x_psu_data *data; - int status; - - if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { - status = -EIO; - goto exit; - } - - data = kzalloc(sizeof(struct as7712_32x_psu_data), GFP_KERNEL); - if (!data) { - status = -ENOMEM; - goto exit; - } - - i2c_set_clientdata(client, data); - data->valid = 0; - data->index = dev_id->driver_data; - mutex_init(&data->update_lock); - - dev_info(&client->dev, "chip found\n"); - - /* Register sysfs hooks */ - status = sysfs_create_group(&client->dev.kobj, &as7712_32x_psu_group); - if (status) { - goto exit_free; - } - - data->hwmon_dev = hwmon_device_register(&client->dev); - if (IS_ERR(data->hwmon_dev)) { - status = PTR_ERR(data->hwmon_dev); - goto exit_remove; - } - - dev_info(&client->dev, "%s: psu '%s'\n", - dev_name(data->hwmon_dev), client->name); - - return 0; - -exit_remove: - sysfs_remove_group(&client->dev.kobj, &as7712_32x_psu_group); -exit_free: - kfree(data); -exit: - - return status; -} - -static int as7712_32x_psu_remove(struct i2c_client *client) -{ - struct as7712_32x_psu_data *data = i2c_get_clientdata(client); - - hwmon_device_unregister(data->hwmon_dev); - sysfs_remove_group(&client->dev.kobj, &as7712_32x_psu_group); - kfree(data); - - return 0; -} - -enum psu_index -{ - as7712_32x_psu1, - as7712_32x_psu2 -}; - -static const struct i2c_device_id as7712_32x_psu_id[] = { - { "as7712_32x_psu1", as7712_32x_psu1 }, - { "as7712_32x_psu2", as7712_32x_psu2 }, - {} -}; -MODULE_DEVICE_TABLE(i2c, as7712_32x_psu_id); - -static struct i2c_driver as7712_32x_psu_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = "as7712_32x_psu", - }, - .probe = as7712_32x_psu_probe, - .remove = as7712_32x_psu_remove, - .id_table = as7712_32x_psu_id, - .address_list = normal_i2c, -}; - -static int as7712_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data, - int data_len) -{ - int result = 0; - int retry_count = 5; - - while (retry_count) { - retry_count--; - - result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); - - if (unlikely(result < 0)) { - msleep(10); - continue; - } - - if (unlikely(result != data_len)) { - result = -EIO; - msleep(10); - continue; - } - - result = 0; - break; - } - - return result; -} - -static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct as7712_32x_psu_data *data = i2c_get_clientdata(client); - - mutex_lock(&data->update_lock); - - if (time_after(jiffies, data->last_updated + HZ + HZ / 2) - || !data->valid) { - int status; - int power_good = 0; - - dev_dbg(&client->dev, "Starting as7712_32x update\n"); - - /* Read psu status */ - status = accton_i2c_cpld_read(0x60, 0x2); - - if (status < 0) { - dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); - } - else { - data->status = status; - } - - /* Read model name */ - memset(data->model_name, 0, sizeof(data->model_name)); - power_good = (data->status >> (3-data->index) & 0x1); - - if (power_good) { - status = as7712_32x_psu_read_block(client, 0x20, data->model_name, - ARRAY_SIZE(data->model_name)-1); - - if (status < 0) { - data->model_name[0] = '\0'; - dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); - } - else { - data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; - } - } - - data->last_updated = jiffies; - data->valid = 1; - } - - mutex_unlock(&data->update_lock); - - return data; -} - -static int __init as7712_32x_psu_init(void) -{ - extern int platform_accton_as7712_32x(void); - if (!platform_accton_as7712_32x()) { - return -ENODEV; - } - - return i2c_add_driver(&as7712_32x_psu_driver); -} - -static void __exit as7712_32x_psu_exit(void) -{ - i2c_del_driver(&as7712_32x_psu_driver); -} - -module_init(as7712_32x_psu_init); -module_exit(as7712_32x_psu_exit); - -MODULE_AUTHOR("Brandon Chuang "); -MODULE_DESCRIPTION("as7712_32x_psu driver"); -MODULE_LICENSE("GPL"); - diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c deleted file mode 100644 index 4366d2a6ea1d..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c +++ /dev/null @@ -1,1083 +0,0 @@ -/* - * SFP driver for accton as7712_32x sfp - * - * Copyright (C) Brandon Chuang - * - * Based on ad7414.c - * Copyright 2006 Stefan Roese , DENX Software Engineering - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME "as7712_32x_sfp" - -#define DEBUG_MODE 0 - -#if (DEBUG_MODE == 1) - #define DEBUG_PRINT(fmt, args...) \ - printk (KERN_INFO "%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) -#else - #define DEBUG_PRINT(fmt, args...) -#endif - -#define NUM_OF_SFP_PORT 32 -#define EEPROM_NAME "sfp_eeprom" -#define EEPROM_SIZE 256 /* 256 byte eeprom */ -#define BIT_INDEX(i) (1ULL << (i)) -#define USE_I2C_BLOCK_READ 1 -#define I2C_RW_RETRY_COUNT 3 -#define I2C_RW_RETRY_INTERVAL 100 /* ms */ - -#define SFP_EEPROM_A0_I2C_ADDR (0xA0 >> 1) -#define SFP_EEPROM_A2_I2C_ADDR (0xA2 >> 1) - -#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 -#define SFF8024_DEVICE_ID_SFP 0x3 -#define SFF8024_DEVICE_ID_QSFP 0xC -#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD -#define SFF8024_DEVICE_ID_QSFP28 0x11 - -#define SFF8472_DIAG_MON_TYPE_ADDR 92 -#define SFF8472_DIAG_MON_TYPE_DDM_MASK 0x40 -#define SFF8472_10G_ETH_COMPLIANCE_ADDR 0x3 -#define SFF8472_10G_BASE_MASK 0xF0 - -#define SFF8436_RX_LOS_ADDR 3 -#define SFF8436_TX_FAULT_ADDR 4 -#define SFF8436_TX_DISABLE_ADDR 86 - -static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); -static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); -extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); -extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); - -/* Addresses scanned - */ -static const unsigned short normal_i2c[] = { SFP_EEPROM_A0_I2C_ADDR, SFP_EEPROM_A2_I2C_ADDR, I2C_CLIENT_END }; - -#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) - -enum port_numbers { -sfp1, sfp2, sfp3, sfp4, sfp5, sfp6, sfp7, sfp8, -sfp9, sfp10, sfp11, sfp12, sfp13, sfp14, sfp15, sfp16, -sfp17, sfp18, sfp19, sfp20, sfp21, sfp22, sfp23, sfp24, -sfp25, sfp26, sfp27, sfp28, sfp29, sfp30, sfp31, sfp32 -}; - -static const struct i2c_device_id sfp_device_id[] = { -{ "sfp1", sfp1 }, { "sfp2", sfp2 }, { "sfp3", sfp3 }, { "sfp4", sfp4 }, -{ "sfp5", sfp5 }, { "sfp6", sfp6 }, { "sfp7", sfp7 }, { "sfp8", sfp8 }, -{ "sfp9", sfp9 }, { "sfp10", sfp10 }, { "sfp11", sfp11 }, { "sfp12", sfp12 }, -{ "sfp13", sfp13 }, { "sfp14", sfp14 }, { "sfp15", sfp15 }, { "sfp16", sfp16 }, -{ "sfp17", sfp17 }, { "sfp18", sfp18 }, { "sfp19", sfp19 }, { "sfp20", sfp20 }, -{ "sfp21", sfp21 }, { "sfp22", sfp22 }, { "sfp23", sfp23 }, { "sfp24", sfp24 }, -{ "sfp25", sfp25 }, { "sfp26", sfp26 }, { "sfp27", sfp27 }, { "sfp28", sfp28 }, -{ "sfp29", sfp29 }, { "sfp30", sfp30 }, { "sfp31", sfp31 }, { "sfp32", sfp32 }, -{} -}; -MODULE_DEVICE_TABLE(i2c, sfp_device_id); - -/* - * list of valid port types - * note OOM_PORT_TYPE_NOT_PRESENT to indicate no - * module is present in this port - */ -typedef enum oom_driver_port_type_e { - OOM_DRIVER_PORT_TYPE_INVALID, - OOM_DRIVER_PORT_TYPE_NOT_PRESENT, - OOM_DRIVER_PORT_TYPE_SFP, - OOM_DRIVER_PORT_TYPE_SFP_PLUS, - OOM_DRIVER_PORT_TYPE_QSFP, - OOM_DRIVER_PORT_TYPE_QSFP_PLUS, - OOM_DRIVER_PORT_TYPE_QSFP28 -} oom_driver_port_type_t; - -enum driver_type_e { - DRIVER_TYPE_SFP_MSA, - DRIVER_TYPE_SFP_DDM, - DRIVER_TYPE_QSFP -}; - -/* Each client has this additional data - */ -struct eeprom_data { - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - struct bin_attribute bin; /* eeprom data */ -}; - -struct sfp_msa_data { - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - u64 status[2]; /* index 0 => device id - 1 => 10G Ethernet Compliance Codes - to distinguish SFP or SFP+ - 2 => DIAGNOSTIC MONITORING TYPE */ - struct eeprom_data eeprom; -}; - -struct sfp_ddm_data { - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - u64 status[3]; /* bit0:port0, bit1:port1 and so on */ - /* index 0 => tx_fail - 1 => tx_disable - 2 => rx_loss */ - struct eeprom_data eeprom; -}; - -struct qsfp_data { - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - u8 status[3]; /* bit0:port0, bit1:port1 and so on */ - /* index 0 => tx_fail - 1 => tx_disable - 2 => rx_loss */ - - u8 device_id; - struct eeprom_data eeprom; -}; - -struct sfp_port_data { - struct mutex update_lock; - enum driver_type_e driver_type; - int port; /* CPLD port index */ - oom_driver_port_type_t port_type; - u64 present; /* present status, bit0:port0, bit1:port1 and so on */ - - struct sfp_msa_data *msa; - struct sfp_ddm_data *ddm; - struct qsfp_data *qsfp; - - struct i2c_client *client; -}; - -enum sfp_sysfs_attributes { - PRESENT, - PRESENT_ALL, - PORT_NUMBER, - PORT_TYPE, - DDM_IMPLEMENTED, - TX_FAULT, - TX_FAULT1, - TX_FAULT2, - TX_FAULT3, - TX_FAULT4, - TX_DISABLE, - TX_DISABLE1, - TX_DISABLE2, - TX_DISABLE3, - TX_DISABLE4, - TX_DISABLE_ALL, - RX_LOS, - RX_LOS1, - RX_LOS2, - RX_LOS3, - RX_LOS4, - RX_LOS_ALL -}; - -static ssize_t show_port_number(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct i2c_client *client = to_i2c_client(dev); - struct sfp_port_data *data = i2c_get_clientdata(client); - return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port)); -} - -static struct sfp_port_data *sfp_update_present(struct i2c_client *client) -{ - struct sfp_port_data *data = i2c_get_clientdata(client); - int i = 0; - int status = -1; - u8 regs[] = {0x30, 0x31, 0x32, 0x33}; - - DEBUG_PRINT("Starting sfp present status update"); - mutex_lock(&data->update_lock); - - /* Read present status of port 1~32 */ - data->present = 0; - - for (i = 0; i < ARRAY_SIZE(regs); i++) { - status = accton_i2c_cpld_read(0x60, regs[i]); - - if (status < 0) { - DEBUG_PRINT("cpld(0x60) reg(0x%x) err %d", regs[i], status); - goto exit; - } - - DEBUG_PRINT("Present status = 0x%lx", data->present); - data->present |= (u64)status << (i*8); - } - - DEBUG_PRINT("Present status = 0x%lx", data->present); -exit: - mutex_unlock(&data->update_lock); - return data; -} - -static struct sfp_port_data *sfp_update_tx_rx_status(struct device *dev) -{ - return NULL; -} - -static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - return 0; -} - -static int sfp_is_port_present(struct i2c_client *client, int port) -{ - struct sfp_port_data *data = sfp_update_present(client); - return (data->present & BIT_INDEX(data->port)) ? 0 : 1; -} - -static ssize_t show_present(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct sfp_port_data *data = i2c_get_clientdata(client); - - if (PRESENT_ALL == attr->index) { - - } - - /* PRESENT */ - return sprintf(buf, "%d\n", sfp_is_port_present(client, data->port)); -} - -static struct sfp_port_data *sfp_update_port_type(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct sfp_port_data *data = i2c_get_clientdata(client); - u8 buf = 0; - int status; - - mutex_lock(&data->update_lock); - - switch (data->driver_type) { - case DRIVER_TYPE_SFP_MSA: - { - status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); - if (status < 0) { - data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; - break; - } - - if (buf != SFF8024_DEVICE_ID_SFP) { - data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; - break; - } - - status = sfp_eeprom_read(data->client, SFF8472_10G_ETH_COMPLIANCE_ADDR, &buf, sizeof(buf)); - if (status < 0) { - data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; - break; - } - - DEBUG_PRINT("sfp port type (0x3) data = (0x%x)", buf); - data->port_type = buf & SFF8472_10G_BASE_MASK ? OOM_DRIVER_PORT_TYPE_SFP_PLUS : OOM_DRIVER_PORT_TYPE_SFP; - break; - } - case DRIVER_TYPE_QSFP: - { - status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); - if (status < 0) { - data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; - break; - } - - DEBUG_PRINT("qsfp port type (0x0) buf = (0x%x)", buf); - switch (buf) { - case SFF8024_DEVICE_ID_QSFP: - data->port_type = OOM_DRIVER_PORT_TYPE_QSFP; - break; - case SFF8024_DEVICE_ID_QSFP_PLUS: - data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; - break; - case SFF8024_DEVICE_ID_QSFP28: - data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; - break; - default: - data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; - break; - } - - break; - } - default: - break; - } - - mutex_unlock(&data->update_lock); - return data; -} - -static ssize_t show_port_type(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct i2c_client *client = to_i2c_client(dev); - struct sfp_port_data *data = i2c_get_clientdata(client); - - if (!sfp_is_port_present(client, data->port)) { - return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); - } - - sfp_update_port_type(dev); - return sprintf(buf, "%d\n", data->port_type); -} - -static struct sfp_port_data *qsfp_update_tx_rx_status(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct sfp_port_data *data = i2c_get_clientdata(client); - int i, status = -1; - u8 buf = 0; - u8 reg[] = {SFF8436_TX_FAULT_ADDR, SFF8436_TX_DISABLE_ADDR, SFF8436_RX_LOS_ADDR}; - - if (time_before(jiffies, data->qsfp->last_updated + HZ + HZ / 2) && data->qsfp->valid) { - return data; - } - - dev_dbg(dev, "Starting sfp tx rx status update"); - mutex_lock(&data->update_lock); - data->qsfp->valid = 0; - memset(data->qsfp->status, 0, sizeof(data->qsfp->status)); - - /* Notify device to update tx fault/ tx disable/ rx los status */ - for (i = 0; i < ARRAY_SIZE(reg); i++) { - status = sfp_eeprom_read(data->client, reg[i], &buf, sizeof(buf)); - if (status < 0) { - goto exit; - } - } - msleep(200); - - /* Read actual tx fault/ tx disable/ rx los status */ - for (i = 0; i < ARRAY_SIZE(reg); i++) { - status = sfp_eeprom_read(data->client, reg[i], &buf, sizeof(buf)); - if (status < 0) { - goto exit; - } - - DEBUG_PRINT("qsfp reg(0x%x) status = (0x%x)", reg[i], data->qsfp->status[i]); - data->qsfp->status[i] = (buf & 0xF); - } - - data->qsfp->valid = 1; - data->qsfp->last_updated = jiffies; - mutex_unlock(&data->update_lock); - return data; - -exit: - mutex_unlock(&data->update_lock); - return NULL; -} - -static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, - char *buf) -{ - u8 val = 0; - struct i2c_client *client = to_i2c_client(dev); - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct sfp_port_data *data = i2c_get_clientdata(client); - - if (!sfp_is_port_present(client, data->port)) { - return -ENODEV; - } - - data = qsfp_update_tx_rx_status(dev); - if (!data) { - return -EIO; - } - - switch (attr->index) { - case TX_FAULT1: - case TX_FAULT2: - case TX_FAULT3: - case TX_FAULT4: - val = (data->qsfp->status[2] & BIT_INDEX(attr->index - TX_FAULT1)) ? 1 : 0; - break; - case TX_DISABLE1: - case TX_DISABLE2: - case TX_DISABLE3: - case TX_DISABLE4: - val = (data->qsfp->status[1] & BIT_INDEX(attr->index - TX_DISABLE1)) ? 1 : 0; - break; - case TX_DISABLE_ALL: - val = ((data->qsfp->status[1] & 0xF) == 0xF) ? 1 : 0; - break; - - case RX_LOS1: - case RX_LOS2: - case RX_LOS3: - case RX_LOS4: - val = (data->qsfp->status[0] & BIT_INDEX(attr->index - RX_LOS1)) ? 1 : 0; - break; - default: - break; - } - - return sprintf(buf, "%d\n", val); -} - -static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - long disable; - int result; - struct i2c_client *client = to_i2c_client(dev); - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct sfp_port_data *data; - - result = kstrtol(buf, 10, &disable); - if (result) { - return result; - } - - data = qsfp_update_tx_rx_status(dev); - if (!data) { - return -EIO; - } - - mutex_lock(&data->update_lock); - - DEBUG_PRINT ("%s-%d: disable:%u %d==%d %u\r\n", __FUNCTION__, __LINE__, - disable, attr->index, TX_DISABLE_ALL, data->qsfp->status[1]); - - if (attr->index == TX_DISABLE_ALL) - { - data->qsfp->status[1] = disable? 0xF:0; - } - else - { - if (disable) { - data->qsfp->status[1] |= (1 << (attr->index - TX_DISABLE1)); - } - else { - data->qsfp->status[1] &= ~(1 << (attr->index - TX_DISABLE1)); - } - } - DEBUG_PRINT("index = (%d), status = (0x%x)", attr->index, data->qsfp->status[1]); - result = sfp_eeprom_write(client, SFF8436_TX_DISABLE_ADDR, &data->qsfp->status[1], sizeof(data->qsfp->status[1])); - mutex_unlock(&data->update_lock); - return count; -} - -static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, - char *buf) -{ - int status; - char ddm; - struct i2c_client *client = to_i2c_client(dev); - struct sfp_port_data *data = i2c_get_clientdata(client); - - if (!sfp_is_port_present(client, data->port)) { - return -ENODEV; - } - - status = sfp_eeprom_read(data->client, SFF8472_DIAG_MON_TYPE_ADDR, &ddm, sizeof(ddm)); - if (status < 0) { - return -EIO; - } - - return sprintf(buf, "%d\n", (ddm & SFF8472_DIAG_MON_TYPE_DDM_MASK) ? 1 : 0); -} - -static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, - char *buf) -{ - u8 val = 0, index = 0; - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct sfp_port_data *data; - - data = sfp_update_tx_rx_status(dev); - if (!data) { - return -EIO; - } - - switch (attr->index) { - case TX_FAULT: - index = 0; - break; - case TX_DISABLE: - index = 1; - break; - case RX_LOS: - index = 2; - break; - default: - break; - } - - val = (data->ddm->status[index] & BIT_INDEX(data->port)) ? 1 : 0; - return sprintf(buf, "%d\n", val); -} - -/* SFP/QSFP common attributes for sysfs */ -static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, PORT_NUMBER); -static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_present, NULL, PRESENT); -static SENSOR_DEVICE_ATTR(sfp_port_type, S_IRUGO, show_port_type, NULL, PORT_TYPE); -static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_present, NULL, PRESENT); - -/* QSFP attributes for sysfs */ -static SENSOR_DEVICE_ATTR(sfp_rx_los1, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS1); -static SENSOR_DEVICE_ATTR(sfp_rx_los2, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS2); -static SENSOR_DEVICE_ATTR(sfp_rx_los3, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS3); -static SENSOR_DEVICE_ATTR(sfp_rx_los4, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS4); -static SENSOR_DEVICE_ATTR(sfp_tx_disable1, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE1); -static SENSOR_DEVICE_ATTR(sfp_tx_disable2, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE2); -static SENSOR_DEVICE_ATTR(sfp_tx_disable3, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE3); -static SENSOR_DEVICE_ATTR(sfp_tx_disable4, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE4); -static SENSOR_DEVICE_ATTR(sfp_tx_disable_all, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE_ALL); -static SENSOR_DEVICE_ATTR(sfp_tx_fault1, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT1); -static SENSOR_DEVICE_ATTR(sfp_tx_fault2, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT2); -static SENSOR_DEVICE_ATTR(sfp_tx_fault3, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT3); -static SENSOR_DEVICE_ATTR(sfp_tx_fault4, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT4); -static struct attribute *qsfp_attributes[] = { - &sensor_dev_attr_sfp_port_number.dev_attr.attr, - &sensor_dev_attr_sfp_port_type.dev_attr.attr, - &sensor_dev_attr_sfp_is_present.dev_attr.attr, - &sensor_dev_attr_sfp_rx_los1.dev_attr.attr, - &sensor_dev_attr_sfp_rx_los2.dev_attr.attr, - &sensor_dev_attr_sfp_rx_los3.dev_attr.attr, - &sensor_dev_attr_sfp_rx_los4.dev_attr.attr, - &sensor_dev_attr_sfp_tx_disable1.dev_attr.attr, - &sensor_dev_attr_sfp_tx_disable2.dev_attr.attr, - &sensor_dev_attr_sfp_tx_disable3.dev_attr.attr, - &sensor_dev_attr_sfp_tx_disable4.dev_attr.attr, - &sensor_dev_attr_sfp_tx_disable_all.dev_attr.attr, - &sensor_dev_attr_sfp_tx_fault1.dev_attr.attr, - &sensor_dev_attr_sfp_tx_fault2.dev_attr.attr, - &sensor_dev_attr_sfp_tx_fault3.dev_attr.attr, - &sensor_dev_attr_sfp_tx_fault4.dev_attr.attr, - NULL -}; - -/* SFP msa attributes for sysfs */ -static SENSOR_DEVICE_ATTR(sfp_ddm_implemented, S_IRUGO, sfp_show_ddm_implemented, NULL, DDM_IMPLEMENTED); -static struct attribute *sfp_msa_attributes[] = { - &sensor_dev_attr_sfp_port_number.dev_attr.attr, - &sensor_dev_attr_sfp_port_type.dev_attr.attr, - &sensor_dev_attr_sfp_is_present.dev_attr.attr, - &sensor_dev_attr_sfp_ddm_implemented.dev_attr.attr, - NULL -}; - -/* SFP ddm attributes for sysfs */ -static SENSOR_DEVICE_ATTR(sfp_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS); -static SENSOR_DEVICE_ATTR(sfp_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, TX_DISABLE); -static SENSOR_DEVICE_ATTR(sfp_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, TX_FAULT); -static struct attribute *sfp_ddm_attributes[] = { - &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, - &sensor_dev_attr_sfp_rx_los.dev_attr.attr, - &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, - NULL -}; - -static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, - int data_len) -{ -#if USE_I2C_BLOCK_READ - int result, retry = I2C_RW_RETRY_COUNT; - - if (data_len > I2C_SMBUS_BLOCK_MAX) { - data_len = I2C_SMBUS_BLOCK_MAX; - } - - while (retry) { - result = i2c_smbus_write_i2c_block_data(client, command, data_len, data); - if (result < 0) { - msleep(I2C_RW_RETRY_INTERVAL); - retry--; - continue; - } - - break; - } - - if (unlikely(result < 0)) { - return result; - } - - return data_len; -#else - int result, retry = I2C_RW_RETRY_COUNT; - - while (retry) { - result = i2c_smbus_write_byte_data(client, command, *data); - if (result < 0) { - msleep(I2C_RW_RETRY_INTERVAL); - retry--; - continue; - } - - break; - } - - if (unlikely(result < 0)) { - return result; - } - - return 1; -#endif - - -} - - -static ssize_t sfp_port_write(struct sfp_port_data *data, - const char *buf, loff_t off, size_t count) -{ - ssize_t retval = 0; - - if (unlikely(!count)) { - return count; - } - - /* - * Write data to chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&data->update_lock); - - while (count) { - ssize_t status; - - status = sfp_eeprom_write(data->client, off, buf, count); - if (status <= 0) { - if (retval == 0) { - retval = status; - } - break; - } - buf += status; - off += status; - count -= status; - retval += status; - } - - mutex_unlock(&data->update_lock); - return retval; -} - - -static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct sfp_port_data *data; - DEBUG_PRINT("%s(%d) offset = (%d), count = (%d)", off, count); - data = dev_get_drvdata(container_of(kobj, struct device, kobj)); - return sfp_port_write(data, buf, off, count); -} - -static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, - int data_len) -{ -#if USE_I2C_BLOCK_READ - int result, retry = I2C_RW_RETRY_COUNT; - - if (data_len > I2C_SMBUS_BLOCK_MAX) { - data_len = I2C_SMBUS_BLOCK_MAX; - } - - while (retry) { - result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); - if (result < 0) { - msleep(I2C_RW_RETRY_INTERVAL); - retry--; - continue; - } - - break; - } - - if (unlikely(result < 0)) - goto abort; - if (unlikely(result != data_len)) { - result = -EIO; - goto abort; - } - - //result = data_len; - -abort: - return result; -#else - int result, retry = I2C_RW_RETRY_COUNT; - - while (retry) { - result = i2c_smbus_read_byte_data(client, command); - if (result < 0) { - msleep(I2C_RW_RETRY_INTERVAL); - retry--; - continue; - } - - break; - } - - if (unlikely(result < 0)) { - dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, result); - goto abort; - } - - *data = (u8)result; - result = 1; - -abort: - return result; -#endif -} - -static ssize_t sfp_port_read(struct sfp_port_data *data, - char *buf, loff_t off, size_t count) -{ - ssize_t retval = 0; - - if (unlikely(!count)) { - DEBUG_PRINT("Count = 0, return"); - return count; - } - - /* - * Read data from chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&data->update_lock); - - while (count) { - ssize_t status; - - status = sfp_eeprom_read(data->client, off, buf, count); - if (status <= 0) { - if (retval == 0) { - retval = status; - } - break; - } - - buf += status; - off += status; - count -= status; - retval += status; - } - - mutex_unlock(&data->update_lock); - return retval; - -} - -static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct sfp_port_data *data; - DEBUG_PRINT("offset = (%d), count = (%d)", off, count); - data = dev_get_drvdata(container_of(kobj, struct device, kobj)); - return sfp_port_read(data, buf, off, count); -} - -static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) -{ - int err; - - sysfs_bin_attr_init(eeprom); - eeprom->attr.name = EEPROM_NAME; - eeprom->attr.mode = S_IWUSR | S_IRUGO; - eeprom->read = sfp_bin_read; - eeprom->write = sfp_bin_write; - eeprom->size = EEPROM_SIZE; - - /* Create eeprom file */ - err = sysfs_create_bin_file(kobj, eeprom); - if (err) { - return err; - } - - return 0; -} - -static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) -{ - sysfs_remove_bin_file(kobj, eeprom); - return 0; -} - -static const struct attribute_group sfp_msa_group = { - .attrs = sfp_msa_attributes, -}; - -static int sfp_i2c_check_functionality(struct i2c_client *client) -{ -#if USE_I2C_BLOCK_READ - return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); -#else - return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); -#endif -} - -static int sfp_msa_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, - struct sfp_msa_data **data) -{ - int status; - struct sfp_msa_data *msa; - - if (!sfp_i2c_check_functionality(client)) { - status = -EIO; - goto exit; - } - - msa = kzalloc(sizeof(struct sfp_msa_data), GFP_KERNEL); - if (!msa) { - status = -ENOMEM; - goto exit; - } - - /* Register sysfs hooks */ - status = sysfs_create_group(&client->dev.kobj, &sfp_msa_group); - if (status) { - goto exit_free; - } - - /* init eeprom */ - status = sfp_sysfs_eeprom_init(&client->dev.kobj, &msa->eeprom.bin); - if (status) { - goto exit_remove; - } - - *data = msa; - dev_info(&client->dev, "sfp msa '%s'\n", client->name); - - return 0; - -exit_remove: - sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); -exit_free: - kfree(msa); -exit: - - return status; -} - -static const struct attribute_group sfp_ddm_group = { - .attrs = sfp_ddm_attributes, -}; - -static int sfp_ddm_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, - struct sfp_ddm_data **data) -{ - int status; - struct sfp_ddm_data *ddm; - - if (!sfp_i2c_check_functionality(client)) { - status = -EIO; - goto exit; - } - - ddm = kzalloc(sizeof(struct sfp_ddm_data), GFP_KERNEL); - if (!ddm) { - status = -ENOMEM; - goto exit; - } - - /* Register sysfs hooks */ - status = sysfs_create_group(&client->dev.kobj, &sfp_ddm_group); - if (status) { - goto exit_free; - } - - /* init eeprom */ - status = sfp_sysfs_eeprom_init(&client->dev.kobj, &ddm->eeprom.bin); - if (status) { - goto exit_remove; - } - - *data = ddm; - dev_info(&client->dev, "sfp ddm '%s'\n", client->name); - - return 0; - -exit_remove: - sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); -exit_free: - kfree(ddm); -exit: - - return status; -} - -static const struct attribute_group qsfp_group = { - .attrs = qsfp_attributes, -}; - -static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, - struct qsfp_data **data) -{ - int status; - struct qsfp_data *qsfp; - - if (!sfp_i2c_check_functionality(client)) { - status = -EIO; - goto exit; - } - - qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); - if (!qsfp) { - status = -ENOMEM; - goto exit; - } - - /* Register sysfs hooks */ - status = sysfs_create_group(&client->dev.kobj, &qsfp_group); - if (status) { - goto exit_free; - } - - /* init eeprom */ - status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); - if (status) { - goto exit_remove; - } - - /* Bring QSFPs out of reset - as6712_32x_i2c_cpld_write(0x62, 0x4, 0xFF); - as6712_32x_i2c_cpld_write(0x62, 0x5, 0xFF); - as6712_32x_i2c_cpld_write(0x64, 0x4, 0xFF); - as6712_32x_i2c_cpld_write(0x64, 0x5, 0xFF);*/ - - *data = qsfp; - dev_info(&client->dev, "qsfp '%s'\n", client->name); - - return 0; - -exit_remove: - sysfs_remove_group(&client->dev.kobj, &qsfp_group); -exit_free: - kfree(qsfp); -exit: - - return status; -} - -static int sfp_device_probe(struct i2c_client *client, - const struct i2c_device_id *dev_id) -{ - struct sfp_port_data *data = NULL; - - data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); - if (!data) { - return -ENOMEM; - } - - i2c_set_clientdata(client, data); - mutex_init(&data->update_lock); - data->port = dev_id->driver_data; - data->client = client; - - if (client->addr != SFP_EEPROM_A0_I2C_ADDR) { - return -ENODEV; - } - - data->driver_type = DRIVER_TYPE_QSFP; - return qsfp_probe(client, dev_id, &data->qsfp); -} - -static int sfp_msa_remove(struct i2c_client *client, struct sfp_msa_data *data) -{ - sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); - sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); - kfree(data); - return 0; -} - -static int sfp_ddm_remove(struct i2c_client *client, struct sfp_ddm_data *data) -{ - sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); - sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); - kfree(data); - return 0; -} - -static int qfp_remove(struct i2c_client *client, struct qsfp_data *data) -{ - sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); - sysfs_remove_group(&client->dev.kobj, &qsfp_group); - kfree(data); - return 0; -} - -static int sfp_device_remove(struct i2c_client *client) -{ - struct sfp_port_data *data = i2c_get_clientdata(client); - - switch (data->driver_type) { - case DRIVER_TYPE_SFP_MSA: - return sfp_msa_remove(client, data->msa); - case DRIVER_TYPE_SFP_DDM: - return sfp_ddm_remove(client, data->ddm); - case DRIVER_TYPE_QSFP: - return qfp_remove(client, data->qsfp); - } - - return 0; -} - -static struct i2c_driver sfp_driver = { - .driver = { - .name = DRIVER_NAME, - }, - .probe = sfp_device_probe, - .remove = sfp_device_remove, - .id_table = sfp_device_id, - .address_list = normal_i2c, -}; - -static int __init sfp_init(void) -{ - extern int platform_accton_as7712_32x(void); - if (!platform_accton_as7712_32x()) { - return -ENODEV; - } - - return i2c_add_driver(&sfp_driver); -} - -static void __exit sfp_exit(void) -{ - i2c_del_driver(&sfp_driver); -} - -MODULE_AUTHOR("Brandon Chuang "); -MODULE_DESCRIPTION("accton as7712_32x_sfp driver"); -MODULE_LICENSE("GPL"); - -module_init(sfp_init); -module_exit(sfp_exit); - diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c deleted file mode 100644 index b25bf1c2aff4..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * A hwmon driver for the accton_i2c_cpld - * - * Copyright (C) 2014 Accton Technology Corporation. - * Brandon Chuang - * - * Based on ad7414.c - * Copyright 2006 Stefan Roese , DENX Software Engineering - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define CPLD_VERSION_REG 0x1 - -enum as5712_54x_cpld_sysfs_attributes { - CPLD_READ_VERSION, - CPLD_BYTE_ACCESS, - CPLD_DUMP_ALL, -}; - -static ssize_t read_cpld_version(struct device *dev, struct device_attribute *da, - char *buf); -int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); - - -static LIST_HEAD(cpld_client_list); -static struct mutex list_lock; - -struct cpld_client_node { - struct i2c_client *client; - struct list_head list; -}; - -/* Addresses scanned for accton_i2c_cpld - */ -static const unsigned short normal_i2c[] = { 0x31, 0x35, 0x60, 0x61, 0x62, I2C_CLIENT_END }; - -static SENSOR_DEVICE_ATTR(cpld_get_version, S_IRUGO, read_cpld_version, NULL, CPLD_READ_VERSION); - -static struct attribute *as5712_54x_cpld_attributes[] = { - &sensor_dev_attr_cpld_get_version.dev_attr.attr, - NULL -}; - -static const struct attribute_group as5712_54x_cpld_group = { - .attrs = as5712_54x_cpld_attributes, -}; - -static ssize_t read_cpld_version(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - unsigned short cpld_reg = CPLD_VERSION_REG; - u8 reg; - - if(attr->index == CPLD_READ_VERSION) { - reg = accton_i2c_cpld_read(client->addr, cpld_reg); - return sprintf(buf, "%02x\n",reg); - } - return -1 ; -} - - -static void accton_i2c_cpld_add_client(struct i2c_client *client) -{ - struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); - - if (!node) { - dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); - return; - } - - node->client = client; - - mutex_lock(&list_lock); - list_add(&node->list, &cpld_client_list); - mutex_unlock(&list_lock); -} - -static void accton_i2c_cpld_remove_client(struct i2c_client *client) -{ - struct list_head *list_node = NULL; - struct cpld_client_node *cpld_node = NULL; - int found = 0; - - mutex_lock(&list_lock); - - list_for_each(list_node, &cpld_client_list) - { - cpld_node = list_entry(list_node, struct cpld_client_node, list); - - if (cpld_node->client == client) { - found = 1; - break; - } - } - - if (found) { - list_del(list_node); - kfree(cpld_node); - } - - mutex_unlock(&list_lock); -} - -static int accton_i2c_cpld_probe(struct i2c_client *client, - const struct i2c_device_id *dev_id) -{ - int status; - - if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { - dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); - status = -EIO; - goto exit; - } - - /* Register sysfs hooks */ - status = sysfs_create_group(&client->dev.kobj, &as5712_54x_cpld_group); - if (status) { - goto exit; - } - - dev_info(&client->dev, "chip found\n"); - accton_i2c_cpld_add_client(client); - - return 0; -exit: - return status; -} - -static int accton_i2c_cpld_remove(struct i2c_client *client) -{ - sysfs_remove_group(&client->dev.kobj, &as5712_54x_cpld_group); - - accton_i2c_cpld_remove_client(client); - return 0; -} - -static const struct i2c_device_id accton_i2c_cpld_id[] = { - { "accton_i2c_cpld", 0 }, - {} -}; -MODULE_DEVICE_TABLE(i2c, accton_i2c_cpld_id); - -static struct i2c_driver accton_i2c_cpld_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = "accton_i2c_cpld", - }, - .probe = accton_i2c_cpld_probe, - .remove = accton_i2c_cpld_remove, - .id_table = accton_i2c_cpld_id, - .address_list = normal_i2c, -}; - -int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg) -{ - struct list_head *list_node = NULL; - struct cpld_client_node *cpld_node = NULL; - int ret = -EPERM; - - mutex_lock(&list_lock); - - list_for_each(list_node, &cpld_client_list) - { - cpld_node = list_entry(list_node, struct cpld_client_node, list); - - if (cpld_node->client->addr == cpld_addr) { - ret = i2c_smbus_read_byte_data(cpld_node->client, reg); - break; - } - } - - mutex_unlock(&list_lock); - - return ret; -} -EXPORT_SYMBOL(accton_i2c_cpld_read); - -int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) -{ - struct list_head *list_node = NULL; - struct cpld_client_node *cpld_node = NULL; - int ret = -EIO; - - mutex_lock(&list_lock); - - list_for_each(list_node, &cpld_client_list) - { - cpld_node = list_entry(list_node, struct cpld_client_node, list); - - if (cpld_node->client->addr == cpld_addr) { - ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); - break; - } - } - - mutex_unlock(&list_lock); - - return ret; -} -EXPORT_SYMBOL(accton_i2c_cpld_write); - -static int __init accton_i2c_cpld_init(void) -{ - mutex_init(&list_lock); - return i2c_add_driver(&accton_i2c_cpld_driver); -} - -static void __exit accton_i2c_cpld_exit(void) -{ - i2c_del_driver(&accton_i2c_cpld_driver); -} - -static struct dmi_system_id as7712_dmi_table[] = { - { - .ident = "Accton AS7712", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Accton"), - DMI_MATCH(DMI_PRODUCT_NAME, "AS7712"), - }, - } -}; - -int platform_accton_as7712_32x(void) -{ - return dmi_check_system(as7712_dmi_table); -} -EXPORT_SYMBOL(platform_accton_as7712_32x); - -MODULE_AUTHOR("Brandon Chuang "); -MODULE_DESCRIPTION("accton_i2c_cpld driver"); -MODULE_LICENSE("GPL"); - -module_init(accton_i2c_cpld_init); -module_exit(accton_i2c_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c deleted file mode 100644 index 8b14437bca35..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c +++ /dev/null @@ -1,443 +0,0 @@ -/* - * A LED driver for the accton_as7712_32x_led - * - * Copyright (C) 2014 Accton Technology Corporation. - * Brandon Chuang - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/*#define DEBUG*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -extern int accton_i2c_cpld_read (unsigned short cpld_addr, u8 reg); -extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); - -extern void led_classdev_unregister(struct led_classdev *led_cdev); -extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); -extern void led_classdev_resume(struct led_classdev *led_cdev); -extern void led_classdev_suspend(struct led_classdev *led_cdev); - -#define DRVNAME "accton_as7712_32x_led" - -struct accton_as7712_32x_led_data { - struct platform_device *pdev; - struct mutex update_lock; - char valid; /* != 0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - u8 reg_val[1]; /* only 1 register*/ -}; - -static struct accton_as7712_32x_led_data *ledctl = NULL; - -/* LED related data - */ - -#define LED_CNTRLER_I2C_ADDRESS (0x60) - -#define LED_TYPE_DIAG_REG_MASK (0x3) -#define LED_MODE_DIAG_GREEN_VALUE (0x02) -#define LED_MODE_DIAG_RED_VALUE (0x01) -#define LED_MODE_DIAG_AMBER_VALUE (0x00) /*It's yellow actually. Green+Red=Yellow*/ -#define LED_MODE_DIAG_OFF_VALUE (0x03) - - -#define LED_TYPE_LOC_REG_MASK (0x80) -#define LED_MODE_LOC_ON_VALUE (0) -#define LED_MODE_LOC_OFF_VALUE (0x80) - -enum led_type { - LED_TYPE_DIAG, - LED_TYPE_LOC, - LED_TYPE_FAN, - LED_TYPE_PSU1, - LED_TYPE_PSU2 -}; - -struct led_reg { - u32 types; - u8 reg_addr; -}; - -static const struct led_reg led_reg_map[] = { - {(1<update_lock); - - if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) - || !ledctl->valid) { - int i; - - dev_dbg(&ledctl->pdev->dev, "Starting accton_as7712_32x_led update\n"); - - /* Update LED data - */ - for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { - int status = accton_as7712_32x_led_read_value(led_reg_map[i].reg_addr); - - if (status < 0) { - ledctl->valid = 0; - dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg_map[i].reg_addr, status); - goto exit; - } - else - { - ledctl->reg_val[i] = status; - } - } - - ledctl->last_updated = jiffies; - ledctl->valid = 1; - } - -exit: - mutex_unlock(&ledctl->update_lock); -} - -static void accton_as7712_32x_led_set(struct led_classdev *led_cdev, - enum led_brightness led_light_mode, - enum led_type type) -{ - int reg_val; - u8 reg ; - mutex_lock(&ledctl->update_lock); - - if( !accton_getLedReg(type, ®)) - { - dev_dbg(&ledctl->pdev->dev, "Not match item for %d.\n", type); - } - - reg_val = accton_as7712_32x_led_read_value(reg); - - if (reg_val < 0) { - dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); - goto exit; - } - reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); - accton_as7712_32x_led_write_value(reg, reg_val); - - /* to prevent the slow-update issue */ - ledctl->valid = 0; - -exit: - mutex_unlock(&ledctl->update_lock); -} - - -static void accton_as7712_32x_led_diag_set(struct led_classdev *led_cdev, - enum led_brightness led_light_mode) -{ - accton_as7712_32x_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG); -} - -static enum led_brightness accton_as7712_32x_led_diag_get(struct led_classdev *cdev) -{ - accton_as7712_32x_led_update(); - return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); -} - -static void accton_as7712_32x_led_loc_set(struct led_classdev *led_cdev, - enum led_brightness led_light_mode) -{ - accton_as7712_32x_led_set(led_cdev, led_light_mode, LED_TYPE_LOC); -} - -static enum led_brightness accton_as7712_32x_led_loc_get(struct led_classdev *cdev) -{ - accton_as7712_32x_led_update(); - return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); -} - -static void accton_as7712_32x_led_auto_set(struct led_classdev *led_cdev, - enum led_brightness led_light_mode) -{ -} - -static enum led_brightness accton_as7712_32x_led_auto_get(struct led_classdev *cdev) -{ - return LED_MODE_AUTO; -} - -static struct led_classdev accton_as7712_32x_leds[] = { - [LED_TYPE_DIAG] = { - .name = "accton_as7712_32x_led::diag", - .default_trigger = "unused", - .brightness_set = accton_as7712_32x_led_diag_set, - .brightness_get = accton_as7712_32x_led_diag_get, - .flags = LED_CORE_SUSPENDRESUME, - .max_brightness = LED_MODE_RED, - }, - [LED_TYPE_LOC] = { - .name = "accton_as7712_32x_led::loc", - .default_trigger = "unused", - .brightness_set = accton_as7712_32x_led_loc_set, - .brightness_get = accton_as7712_32x_led_loc_get, - .flags = LED_CORE_SUSPENDRESUME, - .max_brightness = LED_MODE_BLUE, - }, - [LED_TYPE_FAN] = { - .name = "accton_as7712_32x_led::fan", - .default_trigger = "unused", - .brightness_set = accton_as7712_32x_led_auto_set, - .brightness_get = accton_as7712_32x_led_auto_get, - .flags = LED_CORE_SUSPENDRESUME, - .max_brightness = LED_MODE_AUTO, - }, - [LED_TYPE_PSU1] = { - .name = "accton_as7712_32x_led::psu1", - .default_trigger = "unused", - .brightness_set = accton_as7712_32x_led_auto_set, - .brightness_get = accton_as7712_32x_led_auto_get, - .flags = LED_CORE_SUSPENDRESUME, - .max_brightness = LED_MODE_AUTO, - }, - [LED_TYPE_PSU2] = { - .name = "accton_as7712_32x_led::psu2", - .default_trigger = "unused", - .brightness_set = accton_as7712_32x_led_auto_set, - .brightness_get = accton_as7712_32x_led_auto_get, - .flags = LED_CORE_SUSPENDRESUME, - .max_brightness = LED_MODE_AUTO, - }, -}; - -static int accton_as7712_32x_led_suspend(struct platform_device *dev, - pm_message_t state) -{ - int i = 0; - - for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { - led_classdev_suspend(&accton_as7712_32x_leds[i]); - } - - return 0; -} - -static int accton_as7712_32x_led_resume(struct platform_device *dev) -{ - int i = 0; - - for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { - led_classdev_resume(&accton_as7712_32x_leds[i]); - } - - return 0; -} - -static int accton_as7712_32x_led_probe(struct platform_device *pdev) -{ - int ret, i; - - for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { - ret = led_classdev_register(&pdev->dev, &accton_as7712_32x_leds[i]); - - if (ret < 0) - break; - } - - /* Check if all LEDs were successfully registered */ - if (i != ARRAY_SIZE(accton_as7712_32x_leds)){ - int j; - - /* only unregister the LEDs that were successfully registered */ - for (j = 0; j < i; j++) { - led_classdev_unregister(&accton_as7712_32x_leds[i]); - } - } - - return ret; -} - -static int accton_as7712_32x_led_remove(struct platform_device *pdev) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { - led_classdev_unregister(&accton_as7712_32x_leds[i]); - } - - return 0; -} - -static struct platform_driver accton_as7712_32x_led_driver = { - .probe = accton_as7712_32x_led_probe, - .remove = accton_as7712_32x_led_remove, - .suspend = accton_as7712_32x_led_suspend, - .resume = accton_as7712_32x_led_resume, - .driver = { - .name = DRVNAME, - .owner = THIS_MODULE, - }, -}; - -static int __init accton_as7712_32x_led_init(void) -{ - int ret; - - extern int platform_accton_as7712_32x(void); - if (!platform_accton_as7712_32x()) { - return -ENODEV; - } - - ret = platform_driver_register(&accton_as7712_32x_led_driver); - if (ret < 0) { - goto exit; - } - - ledctl = kzalloc(sizeof(struct accton_as7712_32x_led_data), GFP_KERNEL); - if (!ledctl) { - ret = -ENOMEM; - platform_driver_unregister(&accton_as7712_32x_led_driver); - goto exit; - } - - mutex_init(&ledctl->update_lock); - - ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); - if (IS_ERR(ledctl->pdev)) { - ret = PTR_ERR(ledctl->pdev); - platform_driver_unregister(&accton_as7712_32x_led_driver); - kfree(ledctl); - goto exit; - } - -exit: - return ret; -} - -static void __exit accton_as7712_32x_led_exit(void) -{ - platform_device_unregister(ledctl->pdev); - platform_driver_unregister(&accton_as7712_32x_led_driver); - kfree(ledctl); -} - -module_init(accton_as7712_32x_led_init); -module_exit(accton_as7712_32x_led_exit); - -MODULE_AUTHOR("Brandon Chuang "); -MODULE_DESCRIPTION("accton_as7712_32x_led driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c deleted file mode 100644 index 2745b095b7e2..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c +++ /dev/null @@ -1,589 +0,0 @@ -/* - * An hwmon driver for the 3Y Power YM-2651Y Power Module - * - * Copyright (C) 2014 Accton Technology Corporation. - * Brandon Chuang - * - * Based on ad7414.c - * Copyright 2006 Stefan Roese , DENX Software Engineering - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MAX_FAN_DUTY_CYCLE 100 - -/* Addresses scanned - */ -static const unsigned short normal_i2c[] = { 0x58, 0x5b, I2C_CLIENT_END }; - -/* Each client has this additional data - */ -struct ym2651y_data { - struct device *hwmon_dev; - struct mutex update_lock; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - u8 capability; /* Register value */ - u16 status_word; /* Register value */ - u8 fan_fault; /* Register value */ - u8 over_temp; /* Register value */ - u16 v_out; /* Register value */ - u16 i_out; /* Register value */ - u16 p_out; /* Register value */ - u16 temp; /* Register value */ - u16 fan_speed; /* Register value */ - u16 fan_duty_cycle[2]; /* Register value */ - u8 fan_dir[4]; /* Register value */ - u8 pmbus_revision; /* Register value */ - u8 mfr_id[10]; /* Register value */ - u8 mfr_model[10]; /* Register value */ - u8 mfr_revsion[3]; /* Register value */ - u16 mfr_vin_min; /* Register value */ - u16 mfr_vin_max; /* Register value */ - u16 mfr_iin_max; /* Register value */ - u16 mfr_iout_max; /* Register value */ - u16 mfr_pin_max; /* Register value */ - u16 mfr_pout_max; /* Register value */ - u16 mfr_vout_min; /* Register value */ - u16 mfr_vout_max; /* Register value */ -}; - -static ssize_t show_byte(struct device *dev, struct device_attribute *da, - char *buf); -static ssize_t show_word(struct device *dev, struct device_attribute *da, - char *buf); -static ssize_t show_linear(struct device *dev, struct device_attribute *da, - char *buf); -static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, - char *buf); -static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, - char *buf); -static ssize_t show_ascii(struct device *dev, struct device_attribute *da, - char *buf); -static struct ym2651y_data *ym2651y_update_device(struct device *dev); -static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, - const char *buf, size_t count); -static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value); - -enum ym2651y_sysfs_attributes { - PSU_POWER_ON = 0, - PSU_TEMP_FAULT, - PSU_POWER_GOOD, - PSU_FAN1_FAULT, - PSU_FAN_DIRECTION, - PSU_OVER_TEMP, - PSU_V_OUT, - PSU_I_OUT, - PSU_P_OUT, - PSU_TEMP1_INPUT, - PSU_FAN1_SPEED, - PSU_FAN1_DUTY_CYCLE, - PSU_PMBUS_REVISION, - PSU_MFR_ID, - PSU_MFR_MODEL, - PSU_MFR_REVISION, - PSU_MFR_VIN_MIN, - PSU_MFR_VIN_MAX, - PSU_MFR_VOUT_MIN, - PSU_MFR_VOUT_MAX, - PSU_MFR_IIN_MAX, - PSU_MFR_IOUT_MAX, - PSU_MFR_PIN_MAX, - PSU_MFR_POUT_MAX -}; - -/* sysfs attributes for hwmon - */ -static SENSOR_DEVICE_ATTR(psu_power_on, S_IRUGO, show_word, NULL, PSU_POWER_ON); -static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); -static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_word, NULL, PSU_POWER_GOOD); -static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); -static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, show_over_temp, NULL, PSU_OVER_TEMP); -static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_linear, NULL, PSU_V_OUT); -static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); -static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); -static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); -static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); -static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); -static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_ascii, NULL, PSU_FAN_DIRECTION); -static SENSOR_DEVICE_ATTR(psu_pmbus_revision, S_IRUGO, show_byte, NULL, PSU_PMBUS_REVISION); -static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID); -static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, show_ascii, NULL, PSU_MFR_MODEL); -static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IRUGO, show_ascii, NULL, PSU_MFR_REVISION); -static SENSOR_DEVICE_ATTR(psu_mfr_vin_min, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MIN); -static SENSOR_DEVICE_ATTR(psu_mfr_vin_max, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MAX); -static SENSOR_DEVICE_ATTR(psu_mfr_vout_min, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MIN); -static SENSOR_DEVICE_ATTR(psu_mfr_vout_max, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MAX); -static SENSOR_DEVICE_ATTR(psu_mfr_iin_max, S_IRUGO, show_linear, NULL, PSU_MFR_IIN_MAX); -static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MFR_IOUT_MAX); -static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX); -static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX); - -static struct attribute *ym2651y_attributes[] = { - &sensor_dev_attr_psu_power_on.dev_attr.attr, - &sensor_dev_attr_psu_temp_fault.dev_attr.attr, - &sensor_dev_attr_psu_power_good.dev_attr.attr, - &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, - &sensor_dev_attr_psu_over_temp.dev_attr.attr, - &sensor_dev_attr_psu_v_out.dev_attr.attr, - &sensor_dev_attr_psu_i_out.dev_attr.attr, - &sensor_dev_attr_psu_p_out.dev_attr.attr, - &sensor_dev_attr_psu_temp1_input.dev_attr.attr, - &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, - &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, - &sensor_dev_attr_psu_fan_dir.dev_attr.attr, - &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, - &sensor_dev_attr_psu_mfr_id.dev_attr.attr, - &sensor_dev_attr_psu_mfr_model.dev_attr.attr, - &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, - &sensor_dev_attr_psu_mfr_vin_min.dev_attr.attr, - &sensor_dev_attr_psu_mfr_vin_max.dev_attr.attr, - &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, - &sensor_dev_attr_psu_mfr_iin_max.dev_attr.attr, - &sensor_dev_attr_psu_mfr_pin_max.dev_attr.attr, - &sensor_dev_attr_psu_mfr_vout_min.dev_attr.attr, - &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, - &sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr, - NULL -}; - -static ssize_t show_byte(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); - - return (attr->index == PSU_PMBUS_REVISION) ? sprintf(buf, "%d\n", data->pmbus_revision) : - sprintf(buf, "0\n"); -} - -static ssize_t show_word(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); - u16 status = 0; - - switch (attr->index) { - case PSU_POWER_ON: /* psu_power_on, low byte bit 6 of status_word, 0=>ON, 1=>OFF */ - status = (data->status_word & 0x40) ? 0 : 1; - break; - case PSU_TEMP_FAULT: /* psu_temp_fault, low byte bit 2 of status_word, 0=>Normal, 1=>temp fault */ - status = (data->status_word & 0x4) >> 2; - break; - case PSU_POWER_GOOD: /* psu_power_good, high byte bit 3 of status_word, 0=>OK, 1=>FAIL */ - status = (data->status_word & 0x800) ? 0 : 1; - break; - } - - return sprintf(buf, "%d\n", status); -} - -static int two_complement_to_int(u16 data, u8 valid_bit, int mask) -{ - u16 valid_data = data & mask; - bool is_negative = valid_data >> (valid_bit - 1); - - return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; -} - -static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct ym2651y_data *data = i2c_get_clientdata(client); - int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; - long speed; - int error; - - error = kstrtol(buf, 10, &speed); - if (error) - return error; - - if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) - return -EINVAL; - - mutex_lock(&data->update_lock); - data->fan_duty_cycle[nr] = speed; - ym2651y_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); - mutex_unlock(&data->update_lock); - - return count; -} - -static ssize_t show_linear(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); - - u16 value = 0; - int exponent, mantissa; - int multiplier = 1000; - - switch (attr->index) { - case PSU_V_OUT: - value = data->v_out; - break; - case PSU_I_OUT: - value = data->i_out; - break; - case PSU_P_OUT: - value = data->p_out; - break; - case PSU_TEMP1_INPUT: - value = data->temp; - break; - case PSU_FAN1_SPEED: - value = data->fan_speed; - multiplier = 1; - break; - case PSU_FAN1_DUTY_CYCLE: - value = data->fan_duty_cycle[0]; - multiplier = 1; - break; - case PSU_MFR_VIN_MIN: - value = data->mfr_vin_min; - break; - case PSU_MFR_VIN_MAX: - value = data->mfr_vin_max; - break; - case PSU_MFR_VOUT_MIN: - value = data->mfr_vout_min; - break; - case PSU_MFR_VOUT_MAX: - value = data->mfr_vout_max; - break; - case PSU_MFR_PIN_MAX: - value = data->mfr_pin_max; - break; - case PSU_MFR_POUT_MAX: - value = data->mfr_pout_max; - break; - case PSU_MFR_IOUT_MAX: - value = data->mfr_iout_max; - break; - case PSU_MFR_IIN_MAX: - value = data->mfr_iin_max; - break; - } - - exponent = two_complement_to_int(value >> 11, 5, 0x1f); - mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); - - return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : - sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); -} - -static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); - - u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; - - return sprintf(buf, "%d\n", data->fan_fault >> shift); -} - -static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct ym2651y_data *data = ym2651y_update_device(dev); - - return sprintf(buf, "%d\n", data->over_temp >> 7); -} - -static ssize_t show_ascii(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); - u8 *ptr = NULL; - - switch (attr->index) { - case PSU_FAN_DIRECTION: /* psu_fan_dir */ - ptr = data->fan_dir; - break; - case PSU_MFR_ID: /* psu_mfr_id */ - ptr = data->mfr_id; - break; - case PSU_MFR_MODEL: /* psu_mfr_model */ - ptr = data->mfr_model; - break; - case PSU_MFR_REVISION: /* psu_mfr_revision */ - ptr = data->mfr_revsion; - break; - default: - return 0; - } - - return sprintf(buf, "%s\n", ptr); -} - -static const struct attribute_group ym2651y_group = { - .attrs = ym2651y_attributes, -}; - -static int ym2651y_probe(struct i2c_client *client, - const struct i2c_device_id *dev_id) -{ - struct ym2651y_data *data; - int status; - - if (!i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_I2C_BLOCK)) { - status = -EIO; - goto exit; - } - - data = kzalloc(sizeof(struct ym2651y_data), GFP_KERNEL); - if (!data) { - status = -ENOMEM; - goto exit; - } - - i2c_set_clientdata(client, data); - mutex_init(&data->update_lock); - - dev_info(&client->dev, "chip found\n"); - - /* Register sysfs hooks */ - status = sysfs_create_group(&client->dev.kobj, &ym2651y_group); - if (status) { - goto exit_free; - } - - data->hwmon_dev = hwmon_device_register(&client->dev); - if (IS_ERR(data->hwmon_dev)) { - status = PTR_ERR(data->hwmon_dev); - goto exit_remove; - } - - dev_info(&client->dev, "%s: psu '%s'\n", - dev_name(data->hwmon_dev), client->name); - - return 0; - -exit_remove: - sysfs_remove_group(&client->dev.kobj, &ym2651y_group); -exit_free: - kfree(data); -exit: - - return status; -} - -static int ym2651y_remove(struct i2c_client *client) -{ - struct ym2651y_data *data = i2c_get_clientdata(client); - - hwmon_device_unregister(data->hwmon_dev); - sysfs_remove_group(&client->dev.kobj, &ym2651y_group); - kfree(data); - - return 0; -} - -static const struct i2c_device_id ym2651y_id[] = { - { "ym2651", 0 }, - {} -}; -MODULE_DEVICE_TABLE(i2c, ym2651y_id); - -static struct i2c_driver ym2651y_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = "ym2651", - }, - .probe = ym2651y_probe, - .remove = ym2651y_remove, - .id_table = ym2651y_id, - .address_list = normal_i2c, -}; - -static int ym2651y_read_byte(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg); -} - -static int ym2651y_read_word(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_word_data(client, reg); -} - -static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value) -{ - return i2c_smbus_write_word_data(client, reg, value); -} - -static int ym2651y_read_block(struct i2c_client *client, u8 command, u8 *data, - int data_len) -{ - int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); - - if (unlikely(result < 0)) - goto abort; - if (unlikely(result != data_len)) { - result = -EIO; - goto abort; - } - - result = 0; - -abort: - return result; -} - -struct reg_data_byte { - u8 reg; - u8 *value; -}; - -struct reg_data_word { - u8 reg; - u16 *value; -}; - -static struct ym2651y_data *ym2651y_update_device(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct ym2651y_data *data = i2c_get_clientdata(client); - - mutex_lock(&data->update_lock); - - if (time_after(jiffies, data->last_updated + HZ + HZ / 2) - || !data->valid) { - int i, status; - u8 command; - u8 fan_dir[5] = {0}; - struct reg_data_byte regs_byte[] = { {0x19, &data->capability}, - {0x7d, &data->over_temp}, - {0x81, &data->fan_fault}, - {0x98, &data->pmbus_revision}}; - struct reg_data_word regs_word[] = { {0x79, &data->status_word}, - {0x8b, &data->v_out}, - {0x8c, &data->i_out}, - {0x96, &data->p_out}, - {0x8d, &data->temp}, - {0x3b, &(data->fan_duty_cycle[0])}, - {0x3c, &(data->fan_duty_cycle[1])}, - {0x90, &data->fan_speed}, - {0xa0, &data->mfr_vin_min}, - {0xa1, &data->mfr_vin_max}, - {0xa2, &data->mfr_iin_max}, - {0xa3, &data->mfr_pin_max}, - {0xa4, &data->mfr_vout_min}, - {0xa5, &data->mfr_vout_max}, - {0xa6, &data->mfr_iout_max}, - {0xa7, &data->mfr_pout_max}}; - - dev_dbg(&client->dev, "Starting ym2651 update\n"); - - /* Read byte data */ - for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { - status = ym2651y_read_byte(client, regs_byte[i].reg); - - if (status < 0) - { - dev_dbg(&client->dev, "reg %d, err %d\n", - regs_byte[i].reg, status); - } - else { - *(regs_byte[i].value) = status; - } - } - - /* Read word data */ - for (i = 0; i < ARRAY_SIZE(regs_word); i++) { - status = ym2651y_read_word(client, regs_word[i].reg); - - if (status < 0) - { - dev_dbg(&client->dev, "reg %d, err %d\n", - regs_word[i].reg, status); - } - else { - *(regs_word[i].value) = status; - } - } - - /* Read fan_direction */ - command = 0xC3; - status = ym2651y_read_block(client, command, fan_dir, ARRAY_SIZE(fan_dir)-1); - - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - } - - strncpy(data->fan_dir, fan_dir+1, ARRAY_SIZE(data->fan_dir)-1); - data->fan_dir[ARRAY_SIZE(data->fan_dir)-1] = '\0'; - - /* Read mfr_id */ - command = 0x99; - status = ym2651y_read_block(client, command, data->mfr_id, - ARRAY_SIZE(data->mfr_id)-1); - data->mfr_id[ARRAY_SIZE(data->mfr_id)-1] = '\0'; - - if (status < 0) - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - - /* Read mfr_model */ - command = 0x9a; - status = ym2651y_read_block(client, command, data->mfr_model, - ARRAY_SIZE(data->mfr_model)-1); - data->mfr_model[ARRAY_SIZE(data->mfr_model)-1] = '\0'; - - if (status < 0) - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - - /* Read mfr_revsion */ - command = 0x9b; - status = ym2651y_read_block(client, command, data->mfr_revsion, - ARRAY_SIZE(data->mfr_revsion)-1); - data->mfr_revsion[ARRAY_SIZE(data->mfr_revsion)-1] = '\0'; - - if (status < 0) - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - - data->last_updated = jiffies; - data->valid = 1; - } - - mutex_unlock(&data->update_lock); - - return data; -} - -module_i2c_driver(ym2651y_driver); - -MODULE_AUTHOR("Brandon Chuang "); -MODULE_DESCRIPTION("3Y Power YM-2651Y driver"); -MODULE_LICENSE("GPL"); - - diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/scripts/as7712_32x_platform_init.sh b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/scripts/as7712_32x_platform_init.sh deleted file mode 100644 index 448f2ec341a4..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/scripts/as7712_32x_platform_init.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -echo "TO-DO: as7712-32x driver setting" diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/changelog b/platform/broadcom/sonic-platform-modules-accton/debian/changelog deleted file mode 100644 index 6a687800eeac..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -sonic-accton-platform-modules (1.0) unstable; urgency=low - - * Initial release - - -- Polly Hsu Tue, 9 May 2017 17:54:11 -0800 \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/compat b/platform/broadcom/sonic-platform-modules-accton/debian/compat deleted file mode 100644 index ec635144f600..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/control b/platform/broadcom/sonic-platform-modules-accton/debian/control deleted file mode 100644 index 755c58612bb0..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/debian/control +++ /dev/null @@ -1,11 +0,0 @@ -Source: sonic-accton-platform-modules -Section: main -Priority: extra -Maintainer: polly_hsu -Build-Depends: debhelper (>= 8.0.0), bzip2 -Standards-Version: 3.9.3 - -Package: platform-modules-as7712-32x -Architecture: amd64 -Depends: linux-image-3.16.0-4-amd64 -Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.init b/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.init deleted file mode 100644 index c54b2a3e310d..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.init +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -### BEGIN INIT INFO -# Provides: setup-board -# Required-Start: -# Required-Stop: -# Should-Start: -# Should-Stop: -# Default-Start: S -# Default-Stop: 0 6 -# Short-Description: Setup AS7712-32X board. -### END INIT INFO - -case "$1" in -start) - echo -n "Setting up board... " - - modprobe i2c_dev - modprobe i2c_mux_pca954x - modprobe accton_i2c_cpld - modprobe accton_as7712_32x_fan - modprobe accton_as7712_32x_sfp - modprobe leds-accton_as7712_32x - modprobe accton_as7712_32x_psu - - echo "done." - ;; - -stop) - echo "done." - - ;; - -force-reload|restart) - echo "Not supported" - ;; - -*) - echo "Usage: /etc/init.d/platform-modules-as7712-32x.init {start|stop}" - exit 1 - ;; -esac - -exit 0 diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.install b/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.install deleted file mode 100644 index 39abf57e2f65..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/debian/platform-modules-as7712-32x.install +++ /dev/null @@ -1,2 +0,0 @@ -as7712-32x/scripts/as7712_32x_platform_init.sh usr/local/bin -as7712-32x/cfg/as7712_32x-modules.conf etc/modules-load.d diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules deleted file mode 100755 index a1026ca62832..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/debian/rules +++ /dev/null @@ -1,36 +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:= as7712-32x - -%: - 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); \ - mkdir -p debian/platform-modules-$${mod}/etc/bcm; \ - 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) - From dd104e1b5216f5332ffcb7c40c160be7695e3ce4 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 20 Jun 2017 22:45:36 -0700 Subject: [PATCH 0625/1833] [submodule]: update sonic-platform-daemons submodule (#731) --- src/sonic-platform-daemons | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index dac4bf5a242f..d68c286ba7c9 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit dac4bf5a242fe3c10d750378b7aaf6d41ac573ee +Subproject commit d68c286ba7c984c98ebfafc2bb5fe24905659e5f From 95906a64903ed8b02f9a021287dce443125bd2e4 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 21 Jun 2017 11:02:25 -0700 Subject: [PATCH 0626/1833] [installer] Copy old config files rather than only minigraph (#730) --- .../base_image_files/bgp_neighbor | 55 ------------------- files/image_config/platform/rc.local | 7 ++- rules/docker-fpm-quagga.mk | 1 - src/sonic-utilities | 2 +- 4 files changed, 6 insertions(+), 59 deletions(-) delete mode 100755 dockers/docker-fpm-quagga/base_image_files/bgp_neighbor diff --git a/dockers/docker-fpm-quagga/base_image_files/bgp_neighbor b/dockers/docker-fpm-quagga/base_image_files/bgp_neighbor deleted file mode 100755 index d6bd67a0a02d..000000000000 --- a/dockers/docker-fpm-quagga/base_image_files/bgp_neighbor +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -e - -usage(){ - echo "Usage: $0 " - exit 255 -} - -[[ $# -ne 2 ]] && usage - -COMMAND=$1 -NEIGHBOR_IP=$2 - -if [ "$COMMAND" == "shutdown" ]; then - CMD_PREFIX="" -elif [ "$COMMAND" == "startup" ]; then - CMD_PREFIX="no" -else - usage -fi - -ASN=`vtysh -c "show ip bgp summary" | sed -n "s/.*AS number \([0-9]\+\).*/\1/p"` -if [ -z "$ASN" ]; then - exit 255 -fi - -[ -f /etc/sonic/bgp_admin.yml ] || echo "bgp_admin_state:" > /etc/sonic/bgp_admin.yml - -# Operate on all ipv4 neighbors when "neighbor_ip" = 0.0.0.0 -if [ "$NEIGHBOR_IP" == "0.0.0.0" ] ; then - for NEIGHBOR in `vtysh -c "show run" | grep nei | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | sort | uniq`; do - vtysh -c "configure terminal" -c "router bgp $ASN" -c "$CMD_PREFIX neighbor $NEIGHBOR shutdown" - - # Save admin state in config file - sed -i "/^\s*$NEIGHBOR:/d" /etc/sonic/bgp_admin.yml - if [ "$COMMAND" == "startup" ]; then - echo " $NEIGHBOR: on" >> /etc/sonic/bgp_admin.yml - else - echo " $NEIGHBOR: off" >> /etc/sonic/bgp_admin.yml - fi - done - -else - # Examine bgp neighbor exists first - vtysh -c "show ip bgp neighbor $NEIGHBOR_IP" | grep -q "BGP neighbor is" - - vtysh -c "configure terminal" -c "router bgp $ASN" -c "$CMD_PREFIX neighbor $NEIGHBOR_IP shutdown" - - # Save admin state in config file - sed -i "/^\s*$NEIGHBOR_IP:/d" /etc/sonic/bgp_admin.yml - if [ "$COMMAND" == "startup" ]; then - echo " $NEIGHBOR_IP: on" >> /etc/sonic/bgp_admin.yml - else - echo " $NEIGHBOR_IP: off" >> /etc/sonic/bgp_admin.yml - fi -fi diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 26f59bf94aad..dad2510ce756 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -29,8 +29,11 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then exit 0 fi - # Try to take minigraph saved during installation - if [ -f /host/minigraph.xml ]; then + # Try to take old configuration saved during installation + if [ -d /host/old_config ]; then + rm -f /host/old_config/sonic_version.yml + mv -f /host/old_config/* /etc/sonic/ + elif [ -f /host/minigraph.xml ]; then mv /host/minigraph.xml /etc/sonic/ else cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ diff --git a/rules/docker-fpm-quagga.mk b/rules/docker-fpm-quagga.mk index 1e95c96e001b..a9c0511ba173 100644 --- a/rules/docker-fpm-quagga.mk +++ b/rules/docker-fpm-quagga.mk @@ -11,4 +11,3 @@ $(DOCKER_FPM_QUAGGA)_RUN_OPT += --net=host --privileged -t $(DOCKER_FPM_QUAGGA)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_FPM_QUAGGA)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh -$(DOCKER_FPM_QUAGGA)_BASE_IMAGE_FILES += bgp_neighbor:/usr/bin/bgp_neighbor diff --git a/src/sonic-utilities b/src/sonic-utilities index c1b48a6a28f9..0ad528043019 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit c1b48a6a28f9897ebfebf9989b5cb4a472cf1967 +Subproject commit 0ad52804301903664dfe8f84ef1666101c950cd2 From 3268946de53a56ef68dfb07eacca5b8e5543e6bb Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Wed, 21 Jun 2017 18:52:50 -0700 Subject: [PATCH 0627/1833] [BGPD]: add bgp dynamic neighbor configuration (#708) * add bgp dynamic neighbor configuration * [bgpd]: update as comments * update as comment * update to deployment_id_asn_map * minor change --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 17 + dockers/docker-fpm-quagga/start.sh | 4 +- .../build_templates/sonic_debian_extension.j2 | 3 + .../asn/deployment_id_asn_map.yml | 2 + src/sonic-config-engine/minigraph.py | 26 +- .../tests/t0-sample-bgp-speaker.xml | 346 ++++++++++++++++++ src/sonic-config-engine/tests/test_cfggen.py | 11 + 7 files changed, 403 insertions(+), 6 deletions(-) create mode 100644 files/image_config/asn/deployment_id_asn_map.yml create mode 100644 src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index 0c848939df9d..e898ce72ae1f 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -19,6 +19,10 @@ log facility local4 ! ! bgp multiple-instance ! +route-map FROM_BGP_SPEAKER_V4 permit 10 +! +route-map TO_BGP_SPEAKER_V4 deny 10 +! router bgp {{ minigraph_bgp_asn }} bgp log-neighbor-changes bgp bestpath as-path multipath-relax @@ -65,6 +69,19 @@ router bgp {{ minigraph_bgp_asn }} {% endif %} {% endfor %} {% endblock bgp_sessions %} +{% block bgp_peers_with_range %} +{% for bgp_peer in minigraph_bgp_peers_with_range %} + neighbor {{ bgp_peer['name'] }} peer-group + neighbor {{ bgp_peer['name'] }} passive + neighbor {{ bgp_peer['name'] }} remote-as {{deployment_id_asn_map[deployment_id] }} + neighbor {{ bgp_peer['name'] }} ebgp-multihop 255 + neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound + neighbor {{ bgp_peer['name'] }} update-source Loopback0 + neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in + neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out + bgp listen range {{ bgp_peer['ip_range'] }} peer-group {{ bgp_peer['name'] }} +{% endfor %} +{% endblock bgp_peers_with_range %} ! {% if minigraph_bgp_asn is not none %} maximum-paths 64 diff --git a/dockers/docker-fpm-quagga/start.sh b/dockers/docker-fpm-quagga/start.sh index bc3fbf4e907a..c7df6f20999d 100755 --- a/dockers/docker-fpm-quagga/start.sh +++ b/dockers/docker-fpm-quagga/start.sh @@ -2,9 +2,9 @@ mkdir -p /etc/quagga if [ -f /etc/sonic/bgp_admin.yml ]; then - sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/bgp_admin.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf + sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/bgp_admin.yml -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf else - sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf + sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf fi sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 00398654b12c..647a73b5ce1c 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -138,6 +138,9 @@ sudo bash -c "echo ' all: off' >> $FILESYSTEM_ROOT/etc/sonic/bgp_admin.yml" # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ +# Copy ASN configuration files +sudo cp $IMAGE_CONFIGS/asn/deployment_id_asn_map.yml $FILESYSTEM_ROOT/etc/sonic/ + # Copy sudoers configuration file sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ diff --git a/files/image_config/asn/deployment_id_asn_map.yml b/files/image_config/asn/deployment_id_asn_map.yml new file mode 100644 index 000000000000..36168f828954 --- /dev/null +++ b/files/image_config/asn/deployment_id_asn_map.yml @@ -0,0 +1,2 @@ +deployment_id_asn_map: + "1" : 65432 diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 7dc060900886..d552eb906364 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -244,6 +244,7 @@ def parse_dpg(dpg, hname): def parse_cpg(cpg, hname): bgp_sessions = [] myasn = None + bgp_peers_with_range = [] for child in cpg: tag = child.tag if tag == str(QName(ns, "PeeringSessions")): @@ -270,12 +271,22 @@ def parse_cpg(cpg, hname): hostname = router.find(str(QName(ns1, "Hostname"))).text if hostname == hname: myasn = int(asn) + peers = router.find(str(QName(ns1, "Peers"))) + for bgpPeer in peers.findall(str(QName(ns, "BGPPeer"))): + addr = bgpPeer.find(str(QName(ns, "Address"))).text + if bgpPeer.find(str(QName(ns1, "PeersRange"))) is not None: + name = bgpPeer.find(str(QName(ns1, "Name"))).text + ip_range = bgpPeer.find(str(QName(ns1, "PeersRange"))).text + bgp_peers_with_range.append({ + 'name': name, + 'ip_range': ip_range + }) else: for bgp_session in bgp_sessions: if hostname == bgp_session['name']: bgp_session['asn'] = int(asn) - return bgp_sessions, myasn + return bgp_sessions, myasn, bgp_peers_with_range def parse_meta(meta, hname): @@ -284,6 +295,7 @@ def parse_meta(meta, hname): ntp_servers = [] mgmt_routes = [] erspan_dst = [] + deployment_id = None device_metas = meta.find(str(QName(ns, "Devices"))) for device in device_metas.findall(str(QName(ns1, "DeviceMetadata"))): if device.find(str(QName(ns1, "Name"))).text == hname: @@ -302,7 +314,9 @@ def parse_meta(meta, hname): mgmt_routes = value_group elif name == "ErspanDestinationIpv4": erspan_dst = value_group - return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst + elif name == "DeploymentId": + deployment_id = value + return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id def get_console_info(devices, dev, port): @@ -396,6 +410,8 @@ def parse_xml(filename, platform=None, port_config_file=None): ntp_servers = [] mgmt_routes = [] erspan_dst = [] + bgp_peers_with_range = None + deployment_id = None hwsku_qn = QName(ns, "HwSku") hostname_qn = QName(ns, "Hostname") @@ -411,13 +427,13 @@ def parse_xml(filename, platform=None, port_config_file=None): if child.tag == str(QName(ns, "DpgDec")): (intfs, lo_intfs, mgmt_intf, vlans, pcs, acls) = parse_dpg(child, hostname) elif child.tag == str(QName(ns, "CpgDec")): - (bgp_sessions, bgp_asn) = parse_cpg(child, hostname) + (bgp_sessions, bgp_asn, bgp_peers_with_range) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port) = parse_png(child, hostname) elif child.tag == str(QName(ns, "UngDec")): (u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname) elif child.tag == str(QName(ns, "MetadataDeclaration")): - (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst) = parse_meta(child, hostname) + (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) Tree = lambda: defaultdict(Tree) @@ -428,6 +444,7 @@ def parse_xml(filename, platform=None, port_config_file=None): # TODO: alternatively (preferred), implement class containers for multiple-attribute entries, enabling sort by attr results['minigraph_bgp'] = sorted(bgp_sessions, key=lambda x: x['addr']) results['minigraph_bgp_asn'] = bgp_asn + results['minigraph_bgp_peers_with_range'] = bgp_peers_with_range # TODO: sort does not work properly on all interfaces of varying lengths. Need to sort by integer group(s). phyport_intfs = [] @@ -466,6 +483,7 @@ def parse_xml(filename, platform=None, port_config_file=None): results['ntp_servers'] = ntp_servers results['forced_mgmt_routes'] = mgmt_routes results['erspan_dst'] = erspan_dst + results['deployment_id'] = deployment_id return results diff --git a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml new file mode 100644 index 000000000000..b5e373ddd868 --- /dev/null +++ b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml @@ -0,0 +1,346 @@ + + + + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 180 + 60 + + + switch-t0 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 180 + 60 + + + switch-t0 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 180 + 60 + + + + + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+ +
10.1.0.32
+ BGPSLBPassive + 10.10.10.10/26 +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/112 + + + + PortChannel02 + fortyGigE0/116 + + + + PortChannel03 + fortyGigE0/120 + + + + PortChannel04 + fortyGigE0/124 + + + + + + Vlan1000 + fortyGigE0/4;fortyGigE0/8;fortyGigE0/12;fortyGigE0/16;fortyGigE0/20;fortyGigE0/24;fortyGigE0/28;fortyGigE0/32;fortyGigE0/36;fortyGigE0/40;fortyGigE0/44;fortyGigE0/48;fortyGigE0/52;fortyGigE0/56;fortyGigE0/60;fortyGigE0/64;fortyGigE0/68;fortyGigE0/72;fortyGigE0/76;fortyGigE0/80;fortyGigE0/84;fortyGigE0/88;fortyGigE0/92;fortyGigE0/96 + False + 0.0.0.0/0 + + 1000 + 1000 + 192.168.0.0/27 + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + PortChannel02 + 10.0.0.58/31 + + + + PortChannel02 + FC00::75/126 + + + + PortChannel03 + 10.0.0.60/31 + + + + PortChannel03 + FC00::79/126 + + + + PortChannel04 + 10.0.0.62/31 + + + + PortChannel04 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/27 + + + + + + + PortChannel01;PortChannel02;PortChannel03;PortChannel04 + + DataAcl + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1/1 + switch-t0 + fortyGigE0/112 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1/1 + switch-t0 + fortyGigE0/116 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1/1 + switch-t0 + fortyGigE0/120 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1/1 + switch-t0 + fortyGigE0/124 + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + + + + switch-t0 + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + DeploymentId + 1 + + + + + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index a4ad6cb806fc..9a305fd72aac 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -11,6 +11,7 @@ def setUp(self): self.sample_graph_t0 = os.path.join(self.test_dir, 't0-sample-graph.xml') self.sample_graph_simple = os.path.join(self.test_dir, 'simple-sample-graph.xml') self.sample_graph_pc_test = os.path.join(self.test_dir, 'pc-test-graph.xml') + self.sample_graph_bgp_speaker = os.path.join(self.test_dir, 't0-sample-bgp-speaker.xml') self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') def run_script(self, argument): @@ -97,3 +98,13 @@ def test_minigraph_neighbors(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v minigraph_neighbors' output = self.run_script(argument) self.assertEqual(output.strip(), "{'Ethernet116': {'name': 'ARISTA02T1', 'port': 'Ethernet1/1'}, 'Ethernet124': {'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}, 'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}, 'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}}") + + def test_minigraph_peers_with_range(self): + argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v minigraph_bgp_peers_with_range' + output = self.run_script(argument) + self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': '10.10.10.10/26'}]") + + def test_minigraph_deployment_id(self): + argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v deployment_id' + output = self.run_script(argument) + self.assertEqual(output.strip(), "1") From 629362cad7b080fe738a4aafab6852a58e50160d Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 21 Jun 2017 18:53:28 -0700 Subject: [PATCH 0628/1833] [docker-syncd-brcm]: Sleep to allow syncd to create socket before calling bcmcmd (#733) * [docker-syncd-brcm]: Sleep to allow syncd to create socket before calling bcmcmd * Instead of fixed sleep interval, continually check for presence of socket --- platform/broadcom/docker-syncd-brcm/start.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index 6f9b69ff8d40..742cf8223132 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -10,6 +10,14 @@ supervisorctl start syncd # If this platform has an initialization file for the Broadcom LED microprocessor, load it if [ -r ${PLATFORM_DIR}/led_proc_init.soc ]; then + # Wait until syncd has created the socket for bcmcmd to connect to + while true; do + if [ -e /var/run/sswsyncd/sswsyncd.socket ]; then + break + fi + sleep 1 + done + /usr/bin/bcmcmd -t 60 "rcload ${PLATFORM_DIR}/led_proc_init.soc" fi From a8e3d9745f31ea795e1b88e690364608e5462dd8 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 21 Jun 2017 23:49:15 -0700 Subject: [PATCH 0629/1833] [sonic-cfggen]: Support multiple input yaml files with -y option (#729) --- src/sonic-config-engine/sonic-cfggen | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 822f02d7fcc2..c0ce51d4bf80 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -49,7 +49,7 @@ def main(): parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") parser.add_argument("-m", "--minigraph", help="minigraph xml file") parser.add_argument("-p", "--port-config", help="port config file, used with -m") - parser.add_argument("-y", "--yaml", help="yaml file that contains addtional variables") + parser.add_argument("-y", "--yaml", help="yaml file that contains addtional variables", action='append', default=[]) parser.add_argument("-a", "--additional-data", help="addition data, in json string") group = parser.add_mutually_exclusive_group() group.add_argument("-t", "--template", help="render the data with the template file") @@ -79,8 +79,8 @@ def main(): else: data.update(parse_xml(minigraph)) - if args.yaml != None: - with open(args.yaml, 'r') as stream: + for yaml_file in args.yaml: + with open(yaml_file, 'r') as stream: additional_data = yaml.load(stream) data.update(additional_data) From 5c852704fea4e51f3bcc95999a23f9eb3d0b21cf Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 22 Jun 2017 14:34:15 -0700 Subject: [PATCH 0630/1833] [sonic-cfggen]: Fix minigraph.py when port_alias_map absent (#738) --- src/sonic-config-engine/minigraph.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index d552eb906364..8d3e82ea1233 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -127,10 +127,7 @@ def parse_dpg(dpg, hname): intfs = [] for ipintf in ipintfs.findall(str(QName(ns, "IPInterface"))): intfalias = ipintf.find(str(QName(ns, "AttachTo"))).text - if port_alias_map.has_key(intfalias): - intfname = port_alias_map[intfalias] - else: - intfname = intfalias + intfname = port_alias_map.get(intfalias, intfalias) ipprefix = ipintf.find(str(QName(ns, "Prefix"))).text ipn = ipaddress.IPNetwork(ipprefix) ipaddr = ipn.ip @@ -198,7 +195,7 @@ def parse_dpg(dpg, hname): pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text pcmbr_list = pcintfmbr.split(';') for i, member in enumerate(pcmbr_list): - pcmbr_list[i] = port_alias_map[member] + pcmbr_list[i] = port_alias_map.get(member, member) pcs[pcintfname] = {'name': pcintfname, 'members': pcmbr_list} vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) @@ -210,7 +207,7 @@ def parse_dpg(dpg, hname): vintfmbr = vintf.find(str(QName(ns, "AttachTo"))).text vmbr_list = vintfmbr.split(';') for i, member in enumerate(vmbr_list): - vmbr_list[i] = port_alias_map[member] + vmbr_list[i] = port_alias_map.get(member, member) vlan_attributes = {'name': vintfname, 'members': vmbr_list, 'vlanid': vlanid} sonic_vlan_name = "Vlan%s" % vlanid vlans[sonic_vlan_name] = vlan_attributes From 4bdcac8e4f12d92f3c70f45ee8e0ed6f4599ad93 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 22 Jun 2017 19:50:24 -0700 Subject: [PATCH 0631/1833] [bgp]: move allowas-in into ipv6 section to enable allowas-in for ipv6 (#741) --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index e898ce72ae1f..5f53d9698b2e 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -57,11 +57,16 @@ router bgp {{ minigraph_bgp_asn }} {% if bgp_admin_state and bgp_admin_state.has_key(bgp_session['addr']) and bgp_admin_state[bgp_session['addr']]==False or bgp_admin_state and not bgp_admin_state.has_key(bgp_session['addr']) and bgp_admin_state.has_key('all') and bgp_admin_state['all']==False %} neighbor {{ bgp_session['addr'] }} shutdown {% endif %} +{% if bgp_session['addr'] | ipv4 %} {% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} neighbor {{ bgp_session['addr'] }} allowas-in 1 {% endif %} +{% endif %} {% if bgp_session['addr'] | ipv6 %} address-family ipv6 +{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} + neighbor {{ bgp_session['addr'] }} allowas-in 1 +{% endif %} neighbor {{ bgp_session['addr'] }} activate maximum-paths 64 exit-address-family From d1b12dc0ca13728c279e0db4a2ba0cb92fbdfde0 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 22 Jun 2017 21:26:33 -0700 Subject: [PATCH 0632/1833] [swss]: Sleep 5 min regardless of arp_update return code (#743) - arp_update return code is not guaranteed to be true/false. When there is no VLAN, arp_update will return true. When there are VLANs, arp_update will return false because the command arping returns 1 due to the option '-w 0'. - This script should be run every 5 minutes regardless of the return code. --- dockers/docker-orchagent/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 770fda701029..a04238472c4c 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -60,7 +60,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:arp_update] -command=bash -c "/usr/bin/arp_update && sleep 300" +command=bash -c "/usr/bin/arp_update; sleep 300" priority=8 autostart=false autorestart=true From 350718ee77a4c7522ea0ddd649f67d19c2940c43 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 23 Jun 2017 07:27:50 +0300 Subject: [PATCH 0633/1833] [Mellanox]: Update SAI version (#740) - Initialize ECMP default hashing with IPv6 packets --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 67bc173ae8a6..8d3712cb1378 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = 579c19acf3b9bed181ac713fcf92302f4ebae422 +MLNX_SAI_REVISION = b57b458ff060adb2b1df629e330431a391a3b83e export MLNX_SAI_VERSION MLNX_SAI_REVISION From 00c494f0235b0f73ce31a645d64cce792973a564 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 23 Jun 2017 01:08:25 -0700 Subject: [PATCH 0634/1833] [sonic-cfggen]: Add default IP deny rule in translate_acl (#734) - Add IPv4 implicit rule: deny ip any any This implicit rule has lowest priority and ensures that the device denies all unmatched IP traffic. --- .../tests/sample_output/rules_for_dataacl.json | 16 ++++++++++++---- .../tests/sample_output/rules_for_everflow.json | 2 +- src/sonic-config-engine/translate_acl | 15 +++++++++++++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json b/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json index 48fa240c9dc6..709468f9d945 100644 --- a/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json +++ b/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json @@ -1,6 +1,6 @@ [ { - "ACL_RULE_TABLE:dataacl:Rule_1":{ + "ACL_RULE_TABLE:DATAACL:RULE_1":{ "IP_PROTOCOL":17, "PACKET_ACTION":"FORWARD", "SRC_IP":"10.0.0.0/8", @@ -9,7 +9,7 @@ "OP":"SET" }, { - "ACL_RULE_TABLE:dataacl:Rule_3":{ + "ACL_RULE_TABLE:DATAACL:RULE_3":{ "IP_PROTOCOL":17, "PACKET_ACTION":"FORWARD", "SRC_IP":"25.0.0.0/8", @@ -18,7 +18,7 @@ "OP":"SET" }, { - "ACL_RULE_TABLE:dataacl:Rule_2":{ + "ACL_RULE_TABLE:DATAACL:RULE_2":{ "IP_PROTOCOL":17, "PACKET_ACTION":"FORWARD", "SRC_IP":"100.64.0.0/10", @@ -27,12 +27,20 @@ "OP":"SET" }, { - "ACL_RULE_TABLE:dataacl:Rule_4":{ + "ACL_RULE_TABLE:DATAACL:RULE_4":{ "IP_PROTOCOL":6, "PACKET_ACTION":"FORWARD", "TCP_FLAGS":"0x10/0x10", "priority":9996 }, "OP":"SET" + }, + { + "ACL_RULE_TABLE:DATAACL:DEFAULT_RULE":{ + "ETHER_TYPE":"0x0800", + "PACKET_ACTION":"DROP", + "priority":1 + }, + "OP":"SET" } ] \ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/rules_for_everflow.json b/src/sonic-config-engine/tests/sample_output/rules_for_everflow.json index c31965e31e27..2f39a0dcc4a3 100644 --- a/src/sonic-config-engine/tests/sample_output/rules_for_everflow.json +++ b/src/sonic-config-engine/tests/sample_output/rules_for_everflow.json @@ -1,6 +1,6 @@ [ { - "ACL_RULE_TABLE:everflow:Rule_1":{ + "ACL_RULE_TABLE:EVERFLOW:RULE_1":{ "DST_IP":"127.0.0.1/32", "IP_PROTOCOL":6, "L4_DST_PORT":0, diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl index 584db7b64488..696a433730a9 100755 --- a/src/sonic-config-engine/translate_acl +++ b/src/sonic-config-engine/translate_acl @@ -13,11 +13,21 @@ def dump_json(filename, data): with open(filename, 'w') as outfile: json.dump(data, outfile, indent=4, sort_keys=True, separators=(',', ':')) +def default_deny_rule(table_name): + rule_props = {} + rule_data = {} + rule_data["ACL_RULE_TABLE:"+table_name.upper()+":DEFAULT_RULE"] = rule_props + rule_data["OP"] = "SET" + rule_props["priority"] = 1 + rule_props["ETHER_TYPE"] = "0x0800" + rule_props["PACKET_ACTION"] = "DROP" + return rule_data + def generate_rule_json(table_name, rule, max_priority, mirror): rule_idx = rule.config.sequence_id rule_props = {} rule_data = {} - rule_data["ACL_RULE_TABLE:"+table_name+":Rule_"+str(rule_idx)] = rule_props + rule_data["ACL_RULE_TABLE:"+table_name.upper()+":RULE_"+str(rule_idx)] = rule_props rule_data["OP"] = "SET" rule_props["priority"] = max_priority - rule_idx @@ -120,7 +130,8 @@ def generate_table_json(aclset, aclname, ports, mirror, max_priority, output_pat rule_props = generate_rule_json(table_name, aclentry, max_priority, mirror) if rule_props: rule_data.append(rule_props) - + if not mirror: + rule_data.append(default_deny_rule(table_name)) dump_json(os.path.join(output_path, "rules_for_"+table_name+".json"), rule_data) def translate_acl_fixed_port(filename, output_path, port, max_priority): From 22819d9983cdad5d331422c6dd12e151fe2b14ad Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 23 Jun 2017 15:23:00 -0700 Subject: [PATCH 0635/1833] [docker-platform-monitor]: Add fancontrol (#735) --- dockers/docker-platform-monitor/Dockerfile.j2 | 3 ++- dockers/docker-platform-monitor/start.sh | 22 ++++++++++++++----- .../docker-platform-monitor/supervisord.conf | 10 ++++++++- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 9b407bdef6bc..423181a3c589 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -6,7 +6,8 @@ ENV DEBIAN_FRONTEND=noninteractive # Update apt's package index files RUN apt-get update -RUN apt-get install -y python-pip sensord +# Install required packages +RUN apt-get install -y python-pip sensord fancontrol {% if docker_platform_monitor_debs.strip() %} # Copy built Debian packages diff --git a/dockers/docker-platform-monitor/start.sh b/dockers/docker-platform-monitor/start.sh index b550cc037a5d..cfcf17e4a192 100755 --- a/dockers/docker-platform-monitor/start.sh +++ b/dockers/docker-platform-monitor/start.sh @@ -1,16 +1,26 @@ #!/usr/bin/env bash -mkdir -p /etc/sensors.d -if [ -e /usr/share/sonic/platform/sensors.conf ]; then - /bin/cp -rf /usr/share/sonic/platform/sensors.conf /etc/sensors.d/ -fi - mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd -supervisorctl start lm-sensors + +# If this platform has an lm-sensors config file, copy it to it's proper place +# and start lm-sensors +if [ -e /usr/share/sonic/platform/sensors.conf ]; then + mkdir -p /etc/sensors.d + /bin/cp -f /usr/share/sonic/platform/sensors.conf /etc/sensors.d/ + supervisorctl start lm-sensors +fi + +# If this platform has a fancontrol config file, copy it to it's proper place +# and start fancontrol +if [ -e /usr/share/sonic/platform/fancontrol ]; then + /bin/cp -f /usr/share/sonic/platform/fancontrol /etc/ + supervisorctl start fancontrol +fi + supervisorctl start ledd diff --git a/dockers/docker-platform-monitor/supervisord.conf b/dockers/docker-platform-monitor/supervisord.conf index 051829eae65f..2753dceb652d 100644 --- a/dockers/docker-platform-monitor/supervisord.conf +++ b/dockers/docker-platform-monitor/supervisord.conf @@ -27,9 +27,17 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog +[program:fancontrol] +command=/usr/sbin/fancontrol +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + [program:ledd] command=/usr/bin/ledd -priority=6 +priority=5 autostart=false stdout_logfile=syslog stderr_logfile=syslog From 0cdad949e5d382a142f52629caf4420bb7d1c7d5 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 23 Jun 2017 22:53:15 -0700 Subject: [PATCH 0636/1833] Fix typo in README (#750) * Fix typo in README * Fix comment * Fix README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c2d30cf6bae..c3d58ae1b538 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ To build SONiC installer image and docker images, run the following commands: **NOTE**: We recommend reserving 50G free space to build one platform. -The SONIiC installer contains all docker images needed. SONiC use one image for all switches devices of a same ASIC vendor. The supported ASIC vendors are: +The SONiC installer contains all docker images needed. SONiC uses one image for all devices of a same ASIC vendor. The supported ASIC vendors are: - PLATFORM=broadcom - PLATFORM=marvell (*pending*) From 017eea8a874cee17b1eb08d9b46e7235b96cfcc1 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 24 Jun 2017 12:05:04 -0700 Subject: [PATCH 0637/1833] [DHCP Relay]: Add support for custom Option 82 circuit_id of the form ':' (#747) * Add docker-dhcp-relay/Dockerfile to .gitignore * Add isc-dhcp-relay .deb package to image build process, along with my Option 82 patch * Install custom isc-dhcp-relay in dhcp_relay docker * Install isc-dhcp-relay build dependencies in sonic-slave Docker container * Copy the built .deb package to the destination directory * Add dependencies for isc-dhcp-relay * Change Option 82 string to ':' * Install dependencies of .deb files implicitly in Dockerfile * Remove unused line * Remove unnecessary space --- .gitignore | 1 + .../{Dockerfile => Dockerfile.j2} | 13 +- dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 4 +- rules/docker-dhcp-relay.mk | 3 +- rules/isc-dhcp.mk | 13 + sonic-slave/Dockerfile | 3 + src/isc-dhcp/Makefile | 30 ++ ...d-remote_id-and-bridge-iface-support.patch | 289 ++++++++++++++++++ 8 files changed, 351 insertions(+), 5 deletions(-) rename dockers/docker-dhcp-relay/{Dockerfile => Dockerfile.j2} (51%) create mode 100644 rules/isc-dhcp.mk create mode 100644 src/isc-dhcp/Makefile create mode 100644 src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch diff --git a/.gitignore b/.gitignore index 2222458d1026..dd8befe10436 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ src/sonic-device-data/src/device/ dockers/docker-base/Dockerfile dockers/docker-config-engine/Dockerfile dockers/docker-database/Dockerfile +dockers/docker-dhcp-relay/Dockerfile dockers/docker-fpm-frr/Dockerfile dockers/docker-fpm-gobgp/Dockerfile dockers/docker-fpm-quagga/Dockerfile diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile.j2 similarity index 51% rename from dockers/docker-dhcp-relay/Dockerfile rename to dockers/docker-dhcp-relay/Dockerfile.j2 index c3f9f298983e..1a7b7854d554 100644 --- a/dockers/docker-dhcp-relay/Dockerfile +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -6,8 +6,17 @@ ENV DEBIAN_FRONTEND=noninteractive # Update apt's cache of available packages RUN apt-get update -# Install isc-dhcp-relay Debian package -RUN apt-get -y install isc-dhcp-relay +{% if docker_dhcp_relay_debs.strip() -%} +# Copy built Debian packages +{%- for deb in docker_dhcp_relay_debs.split(' ') %} +COPY debs/{{ deb }} debs/ +{%- endfor %} + +# Install built Debian packages and implicitly install their dependencies +{%- for deb in docker_dhcp_relay_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt debs/{{ deb }} +{%- endfor %} +{%- endif %} # Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 index 05e633b7602f..0b8366d5844e 100644 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -24,6 +24,6 @@ INTERFACES=" {%- endif %} {%- endfor %}" -# '-a' option provides option 82 circuit id information -OPTIONS="-a" +# '-a' option provides option 82 circuit_id and remote_id information +OPTIONS="-a \"%h:%p\" \"\"" diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 7a7a1afeb4db..44d3904d7394 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -2,8 +2,9 @@ DOCKER_DHCP_RELAY = docker-dhcp-relay.gz $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay +$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) -SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) +SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk new file mode 100644 index 000000000000..bfceb7676622 --- /dev/null +++ b/rules/isc-dhcp.mk @@ -0,0 +1,13 @@ +# isc-dhcp packages + +ISC_DHCP_VERSION = 4.3.1-6 + +export ISC_DHCP_VERSION + +ISC_DHCP_COMMON = isc-dhcp-common_$(ISC_DHCP_VERSION)_amd64.deb +$(ISC_DHCP_COMMON)_SRC_PATH = $(SRC_PATH)/isc-dhcp +SONIC_MAKE_DEBS += $(ISC_DHCP_COMMON) + +ISC_DHCP_RELAY = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(ISC_DHCP_COMMON),$(ISC_DHCP_RELAY))) + diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index ee37f57ee0b5..5757eb1d8693 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -216,6 +216,9 @@ RUN apt-get update && apt-get install -y \ # For sonic config engine testing pyangbind +# Install dependencies for building isc-dhcp-relay +RUN apt-get -y build-dep isc-dhcp + RUN cd /usr/src/gtest && cmake . && make -C /usr/src/gtest RUN mkdir /var/run/sshd diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile new file mode 100644 index 000000000000..b043c0bb266c --- /dev/null +++ b/src/isc-dhcp/Makefile @@ -0,0 +1,30 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = isc-dhcp-common_$(ISC_DHCP_VERSION)_amd64.deb +DERIVED_TARGETS = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./isc-dhcp + + # Clone isc-dhcp repo + git clone git://anonscm.debian.org/pkg-dhcp/isc-dhcp.git + pushd ./isc-dhcp + git checkout -f debian/4.3.1-6 + popd + + # Apply patch + patch -p1 < isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch + + # Build source and Debian packages + pushd ./isc-dhcp + dpkg-buildpackage -rfakeroot -b -us -uc + popd + + # Move the newly-built .deb packages to the destination directory + mv $* $(DERIVED_TARGETS) $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) + diff --git a/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch b/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch new file mode 100644 index 000000000000..8d28751da63c --- /dev/null +++ b/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch @@ -0,0 +1,289 @@ +This patch adds the following functionality to dhcrelay in isc-dhcp v4.3.1-6: +* Add customizable Circuit ID and Remote ID fields +* Support for obtaining name of physical interface of interfaces that are part of a bridge interface + +diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c +--- a/isc-dhcp/relay/dhcrelay.c 2014-08-06 22:35:02.000000000 +0000 ++++ b/isc-dhcp/relay/dhcrelay.c 2017-06-08 21:39:53.856192546 +0000 +@@ -73,6 +73,8 @@ + did not match any known circuit ID. */ + int missing_circuit_id = 0; /* Circuit ID option in matching RAI option + was missing. */ ++const char *agent_circuit_id_fmt = NULL; /* Circuit ID custom format string. */ ++const char *agent_remote_id_fmt = NULL; /* Remote ID custom format string. */ + int max_hop_count = 10; /* Maximum hop count */ + + #ifdef DHCPv6 +@@ -140,9 +142,19 @@ + static const char url[] = + "For info, please visit https://www.isc.org/software/dhcp/"; + ++#define DHCRELAY_OPTION82_USAGE \ ++"circuit_id/remote_id interpreted sequences are:\n" \ ++"\n" \ ++" %%%% A single %%\n" \ ++" %%h Hostname of device\n" \ ++" %%p Name of interface that generated the request\n" \ ++" %%P Hardware address of interface that generated the request\n" \ ++" %%C Client hardware address\n" \ ++" %%I DHCP relay agent IP Address\n" \ ++ + #ifdef DHCPv6 + #define DHCRELAY_USAGE \ +-"Usage: dhcrelay [-4] [-d] [-q] [-a] [-D]\n"\ ++"Usage: dhcrelay [-4] [-d] [-q] [-a ] [-D]\n"\ + " [-A ] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ +@@ -154,14 +166,15 @@ + " -l lower0 [ ... -l lowerN]\n" \ + " -u upper0 [ ... -u upperN]\n" \ + " lower (client link): [address%%]interface[#index]\n" \ +-" upper (server link): [address%%]interface" ++" upper (server link): [address%%]interface\n\n" DHCRELAY_OPTION82_USAGE + #else + #define DHCRELAY_USAGE \ +-"Usage: dhcrelay [-d] [-q] [-a] [-D] [-A ] [-c ] [-p ]\n" \ +-" [-pf ] [--no-pid]\n" \ ++"Usage: dhcrelay [-d] [-q] [-a ] [-D]\n" \ ++" [-A ] [-c ] [-p ]\n" \ ++" [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ +-" server0 [ ... serverN]\n\n" ++" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE + #endif + + static void usage() { +@@ -287,6 +300,15 @@ + local_family_set = 1; + local_family = AF_INET; + #endif ++ if (++i == argc) ++ usage(); ++ ++ if (argv[i] != NULL && argv[i][0] != '-') ++ agent_circuit_id_fmt = argv[i++]; ++ ++ if (argv[i] != NULL && argv[i][0] != '-') ++ agent_remote_id_fmt = argv[i]; ++ + add_agent_options = 1; + } else if (!strcmp(argv[i], "-A")) { + #ifdef DHCPv6 +@@ -937,6 +959,166 @@ + return (-1); + } + ++static int ++_bridgefdbquery(const char *hwAddr, char *interface, int *vlanid) { ++ ++#define xstr(s) str(s) ++#define str(s) #s ++#define FDB_STRING_LEN 100 ++#define FDB_BUFFER_LEN (FDB_STRING_LEN + 1) ++ ++/* ++ * Format for sscanf() to read the 1st, 3th, and 5th ++ * space-delimited fields ++ * ++ * bridge fdb show output ++ * 6c:64:1a:00:06:13 dev swp35 vlan 0 master bridge permanent ++ */ ++#define FDB_LINE_FORMAT "%" xstr(FDB_STRING_LEN) "s %*s " \ ++ "%" xstr(FDB_STRING_LEN) "s %*s %d %*s" ++ ++ char cmdstr[FDB_BUFFER_LEN]; ++ char buf[FDB_BUFFER_LEN]; ++ char macAddr[FDB_BUFFER_LEN]; ++ ++ if ((interface == NULL) || (vlanid == NULL)) { ++ return 0; ++ } ++ sprintf(cmdstr, "bridge fdb show | grep -m 1 %s", hwAddr); ++ FILE *cmd = popen(cmdstr, "r"); ++ ++ if (cmd != NULL) { ++ while (fgets(buf, sizeof(buf), cmd)) { ++ sscanf(buf, FDB_LINE_FORMAT, macAddr, interface, vlanid); ++ log_debug ("bridgefdbquery: macAddr:%s interface: %s vlanid %d", ++ macAddr, ++ interface, *vlanid); ++ } ++ pclose(cmd); ++ return 0; ++ } ++ ++ return -1; ++} ++ ++/* ++ * Format the message that will be used by circuit_id and remote_id ++ */ ++static int ++format_relay_agent_rfc3046_msg(struct interface_info *ip, struct dhcp_packet *packet, ++ const char *format, char *msg, size_t msgn) { ++ size_t len = 0; ++ char hostname[HOST_NAME_MAX + 1] = { 0 }; ++ char ifname[IFNAMSIZ + 1] = { 0 }; ++ char *buf = msg; ++ ++ for ( ; format && *format && len < msgn; ++format) { ++ size_t strn = 0; ++ const char *str = NULL; ++ ++ if (*format == '%') { ++ switch (*++format) { ++ case '\0': ++ --format; ++ break; ++ ++ case '%': /* A literal '%' */ ++ str = "%"; ++ break; ++ ++ case 'h': /* Hostname */ ++ gethostname(hostname, HOST_NAME_MAX); ++ str = hostname; ++ break; ++ ++ case 'p': /* Name of interface that we received the request from */ ++ /* ++ * Query FDB to identify the exact physical interface only when source MAC address ++ * is present and '20: DHCP relay agent IP address' (giaddr) is not present ++ */ ++ if (packet->htype && !packet->giaddr.s_addr) { ++ int ret = 0, vlanid = 0; ++ ++ ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr), ++ ip->name, ++ &vlanid); ++ ++ if (ret < 0) { ++ log_debug("MAC Address: %s (interface:%s vlan:%d) not found in bridge fdb show", ++ print_hw_addr (packet->htype, packet->hlen, packet->chaddr), ++ ip->name, ++ vlanid); ++ strncpy(ifname, ip->name, IFNAMSIZ); ++ } ++ else if (strlen(ip->name) > 0) { ++ char cmdstr[256] = { 0 }; ++ char cmdout[256] = { 0 }; ++ ++ log_debug("Adding option 82 interface name for MAC Address: %s as %s", ++ print_hw_addr (packet->htype, packet->hlen, packet->chaddr), ++ ip->name); ++ ++ // Translate SONiC interface name to vendor alias ++ sprintf(cmdstr, "sonic-cfggen -m /etc/sonic/minigraph.xml -v \"minigraph_ports['%s'].alias\"", ip->name); ++ ++ FILE *cmd = popen(cmdstr, "r"); ++ ++ if (cmd != NULL) { ++ while (fgets(cmdout, sizeof(cmdout), cmd)) { ++ // Strip any trailing newline ++ if (cmdout[strlen(cmdout) - 1] == '\n') ++ cmdout[strlen(cmdout) - 1] = '\0'; ++ ++ log_debug ("Retrieved alias %s for interface %s", buf, ip->name); ++ } ++ ++ pclose(cmd); ++ } ++ ++ strncpy(ifname, cmdout, IFNAMSIZ); ++ } ++ ++ str = ifname; ++ } ++ break; ++ ++ case 'P': /* Physical address of interface that we received the request from */ ++ str = print_hw_addr(ip->hw_address.hbuf[0], ip->hw_address.hlen - 1, &ip->hw_address.hbuf[1]); ++ break; ++ ++ case 'C': /* 24: Client hardware address */ ++ str = print_hw_addr(packet->htype, packet->hlen, packet->chaddr); ++ break; ++ ++ case 'I': /* 20: DHCP relay agent IP address */ ++ str = inet_ntoa(packet->giaddr); ++ break; ++ ++ default: ++ log_error("Option %%%c is unrecognized and will not be formatted!", *format); ++ continue; ++ } ++ ++ if (str) ++ strn = strlen(str); ++ } else { ++ str = format; ++ strn += 1; ++ } ++ ++ // Do we have room? ++ if ((strn+len) > msgn) { ++ return 0; ++ } ++ ++ memcpy(buf+len, str, strn); ++ len += strn; ++ } ++ ++ return len; ++} ++ ++ + /* + * Examine a packet to see if it's a candidate to have a Relay + * Agent Information option tacked onto its tail. If it is, tack +@@ -948,6 +1130,8 @@ + int is_dhcp = 0, mms; + unsigned optlen; + u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL; ++ char circuit_id_buf[255] = { '\0', }; ++ char remote_id_buf[255] = { '\0', }; + + /* If we're not adding agent options to packets, we can skip + this. */ +@@ -1077,6 +1261,38 @@ + op = sp; + #endif + ++ /* option82: custom string for circuit_id */ ++ if (agent_circuit_id_fmt) { ++ size_t len = 0; ++ ++ len = format_relay_agent_rfc3046_msg(ip, packet, agent_circuit_id_fmt, ++ circuit_id_buf, sizeof(circuit_id_buf)); ++ ++ if (len > 0) { ++ ip->circuit_id = (uint8_t *)circuit_id_buf; ++ ip->circuit_id_len = len; ++ ++ log_debug("sending on %s option82:circuit_id='%s'(%d)", ++ ip->name, (char *)ip->circuit_id, ip->circuit_id_len); ++ } ++ } ++ ++ /* option82: custom string for remote_id */ ++ if (agent_remote_id_fmt) { ++ size_t len = 0; ++ ++ len = format_relay_agent_rfc3046_msg(ip, packet, agent_remote_id_fmt, ++ remote_id_buf, sizeof(remote_id_buf)); ++ ++ if (len > 0) { ++ ip->remote_id = (uint8_t *)remote_id_buf; ++ ip->remote_id_len = len; ++ ++ log_debug("sending on %s option82:remote_id='%s'(%d)", ++ ip->name, (char *)ip->remote_id, ip->remote_id_len); ++ } ++ } ++ + /* Sanity check. Had better not ever happen. */ + if ((ip->circuit_id_len > 255) ||(ip->circuit_id_len < 1)) + log_fatal("Circuit ID length %d out of range [1-255] on " + From fbb2e410e9b87a2f8b04ca911052825b695aee05 Mon Sep 17 00:00:00 2001 From: Polly Hsu Date: Sun, 25 Jun 2017 05:07:15 +0800 Subject: [PATCH 0638/1833] [Accton]: Add a new supported device and platform AS7716-32X (#732) Switch Vendor: Edge-core Switch SKU: AS7716-32X ASIC Vendor: Broadcom Swich ASIC: Tomahawk Port Configuration: 32x100G SONiC Image: SONiC-ONIE-Broadcom Signed-off-by: polly_hsu@accton.com --- .../Accton-AS7716-32X/port_config.ini | 33 + .../Accton-AS7716-32X/sai.profile | 2 + .../installer.conf | 3 + .../x86_64-accton_as7716_32x-r0/minigraph.xml | 1074 +++++++++++++++++ 4 files changed, 1112 insertions(+) create mode 100644 device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/port_config.ini create mode 100644 device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile create mode 100644 device/accton/x86_64-accton_as7716_32x-r0/installer.conf create mode 100644 device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml diff --git a/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/port_config.ini b/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/port_config.ini new file mode 100644 index 000000000000..1fa6d21d9609 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 49,50,51,52 hundredGigE1 +Ethernet4 53,54,55,56 hundredGigE2 +Ethernet8 57,58,59,60 hundredGigE3 +Ethernet12 61,62,63,64 hundredGigE4 +Ethernet16 65,66,67,68 hundredGigE5 +Ethernet20 69,70,71,72 hundredGigE6 +Ethernet24 73,74,75,76 hundredGigE7 +Ethernet28 77,78,79,80 hundredGigE8 +Ethernet32 33,34,35,36 hundredGigE9 +Ethernet36 37,38,39,40 hundredGigE10 +Ethernet40 41,42,43,44 hundredGigE11 +Ethernet44 45,46,47,48 hundredGigE12 +Ethernet48 81,82,83,84 hundredGigE13 +Ethernet52 85,86,87,88 hundredGigE14 +Ethernet56 89,90,91,92 hundredGigE15 +Ethernet60 93,94,95,96 hundredGigE16 +Ethernet64 97,98,99,100 hundredGigE17 +Ethernet68 101,102,103,104 hundredGigE18 +Ethernet72 105,106,107,108 hundredGigE19 +Ethernet76 109,110,111,112 hundredGigE20 +Ethernet80 17,18,19,20 hundredGigE21 +Ethernet84 21,22,23,24 hundredGigE22 +Ethernet88 25,26,27,28 hundredGigE23 +Ethernet92 29,30,31,32 hundredGigE24 +Ethernet96 113,114,115,116 hundredGigE25 +Ethernet100 117,118,119,120 hundredGigE26 +Ethernet104 121,122,123,124 hundredGigE27 +Ethernet108 125,126,127,128 hundredGigE28 +Ethernet112 1,2,3,4 hundredGigE29 +Ethernet116 5,6,7,8 hundredGigE30 +Ethernet120 9,10,11,12 hundredGigE31 +Ethernet124 13,14,15,16 hundredGigE32 diff --git a/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile b/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile new file mode 100644 index 000000000000..fb1105b47f7a --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7716-32x100G.config.bcm + diff --git a/device/accton/x86_64-accton_as7716_32x-r0/installer.conf b/device/accton/x86_64-accton_as7716_32x-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml new file mode 100644 index 000000000000..e197d4cd7178 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml @@ -0,0 +1,1074 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Accton-AS7716-32X + + + + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + switch1 + Accton-AS7716-32X +
From b92fc2a5c9c678cdbaa43f487ef394188322688f Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 26 Jun 2017 17:32:20 +0300 Subject: [PATCH 0639/1833] [.gitignore]: Update src, config engine (#754) Signed-off-by: marian-pritsak --- .gitignore | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index dd8befe10436..2ab113a44eff 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,13 @@ src/snmpd/* src/thrift/* !src/thrift/Makefile src/sonic-device-data/src/device/ +src/sonic-device-data/src/debian/ +src/igb/* +!src/igb/Makefile +src/mpdecimal/* +!src/mpdecimal/Makefile +src/python3/* +!src/python3/Makefile # Autogenerated Dockerfiles dockers/docker-base/Dockerfile @@ -43,3 +50,8 @@ platform/*/docker-syncd-*-rpc/Dockerfile # Installer-related files and directories installer/x86_64/platforms/ + +# Config engine +src/sonic-config-engine/**/*.pyc +src/sonic-config-engine/build +src/sonic-config-engine/sonic_config_engine.egg-info From fd730d803710414db218a658eefd3bef1ff4d380 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Mon, 26 Jun 2017 18:58:53 +0300 Subject: [PATCH 0640/1833] [submodule]: update sonic-swss (#755) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 316b33371dcb..179daacb2162 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 316b33371dcbccd3d81fa6987170be3e7a3a1536 +Subproject commit 179daacb2162bd769587070ae8ad4f9ded97d549 From 2d97c6a0a7dc6a67788b4b5ac5b88f2a24826c3e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 26 Jun 2017 21:28:16 -0700 Subject: [PATCH 0641/1833] [sonic-swss-common]: Submodule update (#759) --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 345576ea38cc..4f917f2cc345 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 345576ea38cc511b265825b445c48dbfbf444792 +Subproject commit 4f917f2cc345c54d1bf9d9f01d96e4c01071ac9a From 5310e7a9d7f5be14e0e1304856e52567772fe7d8 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 26 Jun 2017 21:28:51 -0700 Subject: [PATCH 0642/1833] [mgmt slave] Install correct version of python-cffi (#760) --- sonic-mgmt/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sonic-mgmt/Dockerfile b/sonic-mgmt/Dockerfile index f462b99cdf45..69c29eb4c716 100644 --- a/sonic-mgmt/Dockerfile +++ b/sonic-mgmt/Dockerfile @@ -26,6 +26,9 @@ RUN apt-get install -y default-jre # For syslog test RUN apt-get install -y rsyslog psmisc +# Remove cffi 1.5.2, will install 1.10.0 by pip later +RUN apt-get remove -y python-cffi python-cffi-backend + RUN easy_install pip RUN pip install ipaddr \ @@ -37,6 +40,7 @@ RUN pip install ipaddr \ pyasn1==0.1.9 \ pysnmp==4.2.5 \ jinja2==2.7.2 \ + cffi==1.10.0 \ paramiko==2.1.2 RUN git clone https://github.com/ansible/ansible From 3798262c1a7d4bc983876ea45f2096a27f58ecf8 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 27 Jun 2017 17:59:36 -0700 Subject: [PATCH 0643/1833] [DHCP Relay]: Fix Option 82 string - Remove quotes; add MAC address of receiving port as remote_id (#763) --- dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 index 0b8366d5844e..3b76073fa8c6 100644 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -25,5 +25,5 @@ INTERFACES=" {%- endfor %}" # '-a' option provides option 82 circuit_id and remote_id information -OPTIONS="-a \"%h:%p\" \"\"" +OPTIONS="-a %h:%p %P" From 15f245c1c92e91d6bc04dfc1cf8fee5f73d274ef Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 27 Jun 2017 20:34:34 -0700 Subject: [PATCH 0644/1833] [platform]: add front panel index in port_config.ini for s6100 (#752) * add front panel index in port_config.ini --- .../Force10-S6100/port_config.ini | 130 +++++++++--------- src/sonic-utilities | 2 +- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini index dcdd6548c198..8b09a1e71f74 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini @@ -1,65 +1,65 @@ -# name lanes alias -Ethernet0 101,102 fortyGigE1/1/1 -Ethernet1 103,104 fortyGigE1/1/2 -Ethernet2 97,98 fortyGigE1/1/3 -Ethernet3 99,100 fortyGigE1/1/4 -Ethernet4 69,70 fortyGigE1/1/5 -Ethernet5 71,72 fortyGigE1/1/6 -Ethernet6 65,66 fortyGigE1/1/7 -Ethernet7 67,68 fortyGigE1/1/8 -Ethernet8 53,54 fortyGigE1/1/9 -Ethernet9 55,56 fortyGigE1/1/10 -Ethernet10 49,50 fortyGigE1/1/11 -Ethernet11 51,52 fortyGigE1/1/12 -Ethernet12 21,22 fortyGigE1/1/13 -Ethernet13 23,24 fortyGigE1/1/14 -Ethernet14 17,18 fortyGigE1/1/15 -Ethernet15 19,20 fortyGigE1/1/16 -Ethernet16 25,26 fortyGigE1/2/1 -Ethernet17 27,28 fortyGigE1/2/2 -Ethernet18 29,30 fortyGigE1/2/3 -Ethernet19 31,32 fortyGigE1/2/4 -Ethernet20 57,58 fortyGigE1/2/5 -Ethernet21 59,60 fortyGigE1/2/6 -Ethernet22 61,62 fortyGigE1/2/7 -Ethernet23 63,64 fortyGigE1/2/8 -Ethernet24 73,74 fortyGigE1/2/9 -Ethernet25 75,76 fortyGigE1/2/10 -Ethernet26 77,78 fortyGigE1/2/11 -Ethernet27 79,80 fortyGigE1/2/12 -Ethernet28 105,106 fortyGigE1/2/13 -Ethernet29 107,108 fortyGigE1/2/14 -Ethernet30 109,110 fortyGigE1/2/15 -Ethernet31 111,112 fortyGigE1/2/16 -Ethernet32 13,14 fortyGigE1/3/1 -Ethernet33 15,16 fortyGigE1/3/2 -Ethernet34 9,10 fortyGigE1/3/3 -Ethernet35 11,12 fortyGigE1/3/4 -Ethernet36 125,126 fortyGigE1/3/5 -Ethernet37 127,128 fortyGigE1/3/6 -Ethernet38 121,122 fortyGigE1/3/7 -Ethernet39 123,124 fortyGigE1/3/8 -Ethernet40 93,94 fortyGigE1/3/9 -Ethernet41 95,96 fortyGigE1/3/10 -Ethernet42 89,90 fortyGigE1/3/11 -Ethernet43 91,92 fortyGigE1/3/12 -Ethernet44 45,46 fortyGigE1/3/13 -Ethernet45 47,48 fortyGigE1/3/14 -Ethernet46 41,42 fortyGigE1/3/15 -Ethernet47 43,44 fortyGigE1/3/16 -Ethernet48 113,114 fortyGigE1/4/1 -Ethernet49 115,116 fortyGigE1/4/2 -Ethernet50 117,118 fortyGigE1/4/3 -Ethernet51 119,120 fortyGigE1/4/4 -Ethernet52 1,2 fortyGigE1/4/5 -Ethernet53 3,4 fortyGigE1/4/6 -Ethernet54 5,6 fortyGigE1/4/7 -Ethernet55 7,8 fortyGigE1/4/8 -Ethernet56 33,34 fortyGigE1/4/9 -Ethernet57 35,36 fortyGigE1/4/10 -Ethernet58 37,38 fortyGigE1/4/11 -Ethernet59 39,40 fortyGigE1/4/12 -Ethernet60 81,82 fortyGigE1/4/13 -Ethernet61 83,84 fortyGigE1/4/14 -Ethernet62 85,86 fortyGigE1/4/15 -Ethernet63 87,88 fortyGigE1/4/16 +# name lanes alias index +Ethernet0 101,102 fortyGigE1/1/1 0 +Ethernet1 103,104 fortyGigE1/1/2 1 +Ethernet2 97,98 fortyGigE1/1/3 2 +Ethernet3 99,100 fortyGigE1/1/4 3 +Ethernet4 69,70 fortyGigE1/1/5 4 +Ethernet5 71,72 fortyGigE1/1/6 5 +Ethernet6 65,66 fortyGigE1/1/7 6 +Ethernet7 67,68 fortyGigE1/1/8 7 +Ethernet8 53,54 fortyGigE1/1/9 8 +Ethernet9 55,56 fortyGigE1/1/10 9 +Ethernet10 49,50 fortyGigE1/1/11 10 +Ethernet11 51,52 fortyGigE1/1/12 11 +Ethernet12 21,22 fortyGigE1/1/13 12 +Ethernet13 23,24 fortyGigE1/1/14 13 +Ethernet14 17,18 fortyGigE1/1/15 14 +Ethernet15 19,20 fortyGigE1/1/16 15 +Ethernet16 25,26 fortyGigE1/2/1 16 +Ethernet17 27,28 fortyGigE1/2/2 17 +Ethernet18 29,30 fortyGigE1/2/3 18 +Ethernet19 31,32 fortyGigE1/2/4 19 +Ethernet20 57,58 fortyGigE1/2/5 20 +Ethernet21 59,60 fortyGigE1/2/6 21 +Ethernet22 61,62 fortyGigE1/2/7 22 +Ethernet23 63,64 fortyGigE1/2/8 23 +Ethernet24 73,74 fortyGigE1/2/9 24 +Ethernet25 75,76 fortyGigE1/2/10 25 +Ethernet26 77,78 fortyGigE1/2/11 26 +Ethernet27 79,80 fortyGigE1/2/12 27 +Ethernet28 105,106 fortyGigE1/2/13 28 +Ethernet29 107,108 fortyGigE1/2/14 29 +Ethernet30 109,110 fortyGigE1/2/15 30 +Ethernet31 111,112 fortyGigE1/2/16 31 +Ethernet32 13,14 fortyGigE1/3/1 32 +Ethernet33 15,16 fortyGigE1/3/2 33 +Ethernet34 9,10 fortyGigE1/3/3 34 +Ethernet35 11,12 fortyGigE1/3/4 35 +Ethernet36 125,126 fortyGigE1/3/5 36 +Ethernet37 127,128 fortyGigE1/3/6 37 +Ethernet38 121,122 fortyGigE1/3/7 38 +Ethernet39 123,124 fortyGigE1/3/8 39 +Ethernet40 93,94 fortyGigE1/3/9 40 +Ethernet41 95,96 fortyGigE1/3/10 41 +Ethernet42 89,90 fortyGigE1/3/11 42 +Ethernet43 91,92 fortyGigE1/3/12 43 +Ethernet44 45,46 fortyGigE1/3/13 44 +Ethernet45 47,48 fortyGigE1/3/14 45 +Ethernet46 41,42 fortyGigE1/3/15 46 +Ethernet47 43,44 fortyGigE1/3/16 47 +Ethernet48 113,114 fortyGigE1/4/1 48 +Ethernet49 115,116 fortyGigE1/4/2 49 +Ethernet50 117,118 fortyGigE1/4/3 50 +Ethernet51 119,120 fortyGigE1/4/4 51 +Ethernet52 1,2 fortyGigE1/4/5 52 +Ethernet53 3,4 fortyGigE1/4/6 53 +Ethernet54 5,6 fortyGigE1/4/7 54 +Ethernet55 7,8 fortyGigE1/4/8 55 +Ethernet56 33,34 fortyGigE1/4/9 56 +Ethernet57 35,36 fortyGigE1/4/10 57 +Ethernet58 37,38 fortyGigE1/4/11 58 +Ethernet59 39,40 fortyGigE1/4/12 59 +Ethernet60 81,82 fortyGigE1/4/13 60 +Ethernet61 83,84 fortyGigE1/4/14 61 +Ethernet62 85,86 fortyGigE1/4/15 62 +Ethernet63 87,88 fortyGigE1/4/16 63 diff --git a/src/sonic-utilities b/src/sonic-utilities index 0ad528043019..5d8f98eeae60 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 0ad52804301903664dfe8f84ef1666101c950cd2 +Subproject commit 5d8f98eeae60f1b5c6c5d6ad7cb4c31019558efd From e68d9a2a5968ff170ecf4b1dc3217563a307ec64 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 29 Jun 2017 01:38:05 -0700 Subject: [PATCH 0645/1833] [igb]: change download url to azure storage url (#770) --- src/igb/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/igb/Makefile b/src/igb/Makefile index afa7a676748b..e814ce0a7db7 100644 --- a/src/igb/Makefile +++ b/src/igb/Makefile @@ -6,7 +6,7 @@ MAIN_TARGET = igb.ko $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./igb-$(IGB_DRIVER_VERSION) - wget -O igb-$(IGB_DRIVER_VERSION).tar.gz "https://downloadmirror.intel.com/13663/eng/igb-$(IGB_DRIVER_VERSION).tar.gz" + wget -O igb-$(IGB_DRIVER_VERSION).tar.gz "https://sonicstorage.blob.core.windows.net/packages/igb-5.3.5.4.tar.gz?sv=2015-04-05&sr=b&sig=Y7pO2Y%2FLTdQe1XucyRhMZdbHV5duAdvRYOqgJ5D7l4c%3D&se=2031-03-08T08%3A31%3A39Z&sp=r" tar xzf igb-$(IGB_DRIVER_VERSION).tar.gz # Patch From 3ac724ecb030786462308c2d53ba66d65a8ea184 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 29 Jun 2017 01:40:22 -0700 Subject: [PATCH 0646/1833] [baseimage]: Increase net.core.rmem_max to 2097152 (#767) * Increase net.core.rmem_max to 2097152 --- build_debian.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index 71f849151a94..1e18ec45afbc 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -265,6 +265,8 @@ set /files/etc/sysctl.conf/net.ipv6.conf.default.accept_dad 0 set /files/etc/sysctl.conf/net.ipv6.conf.all.accept_dad 0 set /files/etc/sysctl.conf/net.ipv6.conf.eth0.accept_ra_defrtr 0 + +set /files/etc/sysctl.conf/net.core.rmem_max 2097152 " -r $FILESYSTEM_ROOT ## docker-py is needed by Ansible docker module From 3f570a4cbf050389d5106373b7746e4443b54913 Mon Sep 17 00:00:00 2001 From: wadelnn Date: Thu, 29 Jun 2017 16:41:12 +0800 Subject: [PATCH 0647/1833] Update Ingrasys platform submodule (#764) * Remove specific fancontrol service. Signed-off-by: Wade He --- platform/broadcom/sonic-platform-modules-ingrasys | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index 8d0229c94865..50471fdaaa48 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit 8d0229c94865228eff63c0d79396d0b924d7c6b1 +Subproject commit 50471fdaaa4849c19a97d8623971450f09903d5d From 39bd495ea93351a5e71444c86f3f4d1cfff07deb Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 29 Jun 2017 10:50:53 -0700 Subject: [PATCH 0648/1833] [Broadcom]: Update SAI package to support Celestica Seastone DX010 and Accton AS7716 (#768) --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 130520298120..fc2503fa41b4 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-12-20170607194342.44_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-12-20170607194342.44_amd64.deb?sv=2015-04-05&sr=b&sig=gJJVxVT2o%2Bm14%2BwCBYFmBfcrDCzBA4b4iSmDKxnS13o%3D&se=2031-02-26T17%3A39%3A50Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-14-20170627090913.47_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-14-20170627090913.47_amd64.deb?sv=2015-04-05&sr=b&sig=MqrcsnIaaFfekaAqcjgbi0mDl94BJ9eRsslLJrp23q8%3D&se=2031-03-06T22%3A29%3A19Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-12-20170607194342.44_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-14-20170627090913.47_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-12-20170607194342.44_amd64.deb?sv=2015-04-05&sr=b&sig=AfYK3Qz%2FTV61E89u0kASm7wF3LEiqaZb%2Fde2jvbw9yk%3D&se=2031-02-26T17%3A40%3A14Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-14-20170627090913.47_amd64.deb?sv=2015-04-05&sr=b&sig=GyAwaEdgSFGXbbFq%2FN2RgSKQ5%2Fc73NgxKMMKq3RVZw0%3D&se=2031-03-06T22%3A29%3A48Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From bce5446dc4098af2b5d45a7b721509a42e47a89d Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 29 Jun 2017 16:37:37 -0700 Subject: [PATCH 0649/1833] [LLDP]: Port description (TLV 4) now contains ':' (#772) --- dockers/docker-lldp-sv2/lldpd.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index 1943c04ed73f..e3d37d091150 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,3 +1,3 @@ {% for member in minigraph_ports.keys() %} -configure ports {{member}} lldp portidsubtype local {{minigraph_ports[member]['alias']}} +configure ports {{ member }} lldp portidsubtype local {{ minigraph_ports[member]['alias'] }} description {{ minigraph_neighbors[member]['name'] }}:{{ minigraph_neighbors[member]['port'] }} {% endfor %} From e31e1f77779e960874d193e310f2a38d84d422b3 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 29 Jun 2017 22:21:12 -0700 Subject: [PATCH 0650/1833] [sonic-slave]: install docker-ce 17.03.02 stable version (#774) --- sonic-slave/Dockerfile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 5757eb1d8693..20a7fbad89eb 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -228,8 +228,21 @@ EXPOSE 22 RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /usr/share/depot_tools ENV PATH /usr/share/depot_tools:$PATH -# Install docker engine 1.13.0 inside docker and enable experimental feature -RUN curl -sSL https://get.docker.com/ | sh && apt-get install -y --force-yes -q docker-engine=1.13.0-0~debian-jessie +# Install docker engine 17.03.2~ce-0 inside docker and enable experimental feature +RUN apt-get update +RUN apt-get install -y \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg2 \ + software-properties-common +RUN curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - +RUN add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/debian \ + $(lsb_release -cs) \ + stable" +RUN apt-get update +RUN apt-get install -y docker-ce=17.03.2~ce-0~debian-jessie RUN echo "DOCKER_OPTS=\"--experimental\"" >> /etc/default/docker # Add user From e904b3bf46bd34c86b46889f9f9c644c8ba6cc48 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 30 Jun 2017 10:28:39 -0700 Subject: [PATCH 0651/1833] [device]: add minigraph and LED support for Arista 7050 QX32S (#773) --- .../port_config.ini | 0 .../sai.profile | 0 .../x86_64-arista_7050_qx32s/minigraph.xml | 1079 +++++++++++++++++ .../plugins/led_control.py | 84 ++ 4 files changed, 1163 insertions(+) rename device/arista/x86_64-arista_7050_qx32s/{Arista-7050-QX32S => Arista-7050-QX-32S}/port_config.ini (100%) rename device/arista/x86_64-arista_7050_qx32s/{Arista-7050-QX32S => Arista-7050-QX-32S}/sai.profile (100%) create mode 100644 device/arista/x86_64-arista_7050_qx32s/minigraph.xml create mode 100644 device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/port_config.ini rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/sai.profile b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/sai.profile similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX32S/sai.profile rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/sai.profile diff --git a/device/arista/x86_64-arista_7050_qx32s/minigraph.xml b/device/arista/x86_64-arista_7050_qx32s/minigraph.xml new file mode 100644 index 000000000000..efd30582947a --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/minigraph.xml @@ -0,0 +1,1079 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + Ethernet1/1 + 10.0.0.0/31 + + + + Ethernet2/1 + 10.0.0.2/31 + + + + Ethernet3/1 + 10.0.0.4/31 + + + + Ethernet4/1 + 10.0.0.6/31 + + + + Ethernet5/1 + 10.0.0.8/31 + + + + Ethernet6/1 + 10.0.0.10/31 + + + + Ethernet7/1 + 10.0.0.12/31 + + + + Ethernet8/1 + 10.0.0.14/31 + + + + Ethernet9/1 + 10.0.0.16/31 + + + + Ethernet10/1 + 10.0.0.18/31 + + + + Ethernet11/1 + 10.0.0.20/31 + + + + Ethernet12/1 + 10.0.0.22/31 + + + + Ethernet13/1 + 10.0.0.24/31 + + + + Ethernet14/1 + 10.0.0.26/31 + + + + Ethernet15/1 + 10.0.0.28/31 + + + + Ethernet16/1 + 10.0.0.30/31 + + + + Ethernet17/1 + 10.0.0.32/31 + + + + Ethernet18/1 + 10.0.0.34/31 + + + + Ethernet19/1 + 10.0.0.36/31 + + + + Ethernet20/1 + 10.0.0.38/31 + + + + Ethernet21/1 + 10.0.0.40/31 + + + + Ethernet22/1 + 10.0.0.42/31 + + + + Ethernet23/1 + 10.0.0.44/31 + + + + Ethernet24/1 + 10.0.0.46/31 + + + + Ethernet25 + 10.0.0.48/31 + + + + Ethernet26 + 10.0.0.50/31 + + + + Ethernet27 + 10.0.0.52/31 + + + + Ethernet28 + 10.0.0.54/31 + + + + Ethernet29 + 10.0.0.56/31 + + + + Ethernet30 + 10.0.0.58/31 + + + + Ethernet31 + 10.0.0.60/31 + + + + Ethernet32 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet1/1 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet2/1 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet3/1 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4/1 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet5/1 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet6/1 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet7/1 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8/1 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet9/1 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet10/1 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet11/1 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12/1 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet13/1 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet14/1 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet15/1 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16/1 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet17/1 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet18/1 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet19/1 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20/1 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet21/1 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet22/1 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet23/1 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24/1 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet25 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet26 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet27 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet29 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet30 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet31 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet32 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Arista-7050-QX-32S + + + + + + + switch1 + + + 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 + + + + + + + switch1 + Arista-7050-QX-32S +
diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py new file mode 100644 index 000000000000..582eaacbf918 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# +# led_control.py +# +# Platform-specific LED control functionality for SONiC +# + +try: + from sonic_led.led_control_base import LedControlBase +except ImportError, e: + raise ImportError (str(e) + " - required module not found") + + +class LedControl(LedControlBase): + """Platform specific LED control class""" + + SONIC_PORT_NAME_PREFIX = "Ethernet" + + LED_SYSFS_PATH_BREAKOUT_CAPABLE = "/sys/class/leds/qsfp{0}_{1}/brightness" + LED_SYSFS_PATH_NO_BREAKOUT = "/sys/class/leds/qsfp{0}/brightness" + + QSFP_BREAKOUT_START_IDX = 1 + QSFP_BREAKOUT_END_IDX = 24 + QSFP_NO_BREAKOUT_START_IDX = 25 + QSFP_NO_BREAKOUT_END_IDX = 32 + + LED_QSFP_OFFSET = 4 + + LED_COLOR_OFF = 0 + LED_COLOR_GREEN = 1 + LED_COLOR_YELLOW = 2 + + # Helper method to map SONiC port name to Arista QSFP index + def _port_name_to_qsfp_index(self, port_name): + # Strip "Ethernet" off port name + if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): + return -1 + + sonic_port_num = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) + + # SONiC port nums are 0-based and increment by 4 + # Arista QSFP indices are 1-based and increment by 1 + return ((sonic_port_num/4) + 1) + + # Concrete implementation of port_link_state_change() method + def port_link_state_change(self, port, state): + qsfp_index = self._port_name_to_qsfp_index(port) + + # Ignore invalid QSFP indices + if qsfp_index <= 0: + return + + # QSFP indices 1-24 are breakout-capable and have four LEDs, and each LED indicate one lane. + # whereas indices 25-32 are not breakout-capable, and only have one + if qsfp_index <= self.QSFP_BREAKOUT_END_IDX: + # assuming 40G, then we need to control four lanes + led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index + self.LED_QSFP_OFFSET, i) for i in range(1, 5) ] + else: + led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index + self.LED_QSFP_OFFSET) ] + + for led_sysfs_path in led_sysfs_paths: + led_file = open(led_sysfs_path, "w") + + if state == "up": + led_file.write("%d" % self.LED_COLOR_GREEN) + else: + led_file.write("%d" % self.LED_COLOR_OFF) + + led_file.close() + + # Constructor + def __init__(self): + # Initialize: Turn all front panel QSFP LEDs off + for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): + for lane in range(1, 5): + led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index + self.LED_QSFP_OFFSET, lane) + with open(led_sysfs_path, 'w') as led_file: + led_file.write("%d" % self.LED_COLOR_OFF) + + for qsfp_index in range(self.QSFP_NO_BREAKOUT_START_IDX, self.QSFP_NO_BREAKOUT_END_IDX + 1): + led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index + self.LED_QSFP_OFFSET) + with open(led_sysfs_path, 'w') as led_file: + led_file.write("%d" % self.LED_COLOR_OFF) + From d715a74466348f0bfdf9329628260cc393855fab Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 4 Jul 2017 00:43:34 -0700 Subject: [PATCH 0652/1833] [sonic-mgmt]: install adal package via pip (#782) --- sonic-mgmt/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonic-mgmt/Dockerfile b/sonic-mgmt/Dockerfile index 69c29eb4c716..b30db8251f28 100644 --- a/sonic-mgmt/Dockerfile +++ b/sonic-mgmt/Dockerfile @@ -41,7 +41,8 @@ RUN pip install ipaddr \ pysnmp==4.2.5 \ jinja2==2.7.2 \ cffi==1.10.0 \ - paramiko==2.1.2 + paramiko==2.1.2 \ + adal RUN git clone https://github.com/ansible/ansible RUN cd ansible && git checkout v2.0.0.2-1 -b v2.0.0.2-1 && git submodule update --init --recursive && make && make install From a78d3b1a9fe5591f7f35fadd141790b0c9fc6979 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 5 Jul 2017 13:50:21 -0700 Subject: [PATCH 0653/1833] [base]: allow-hotplug is enough in /etc/network/ifaces. auto is not required (#781) --- files/image_config/interfaces/interfaces.j2 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 7e07c4365171..425badf7f21f 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -46,7 +46,6 @@ iface eth0 inet dhcp {% block front_panel_interfaces %} # The switch front panel interfaces {% for interface in minigraph_interfaces %} -auto {{ interface['attachto'] }} allow-hotplug {{ interface['attachto'] }} iface {{ interface['attachto'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static mtu 9216 @@ -59,7 +58,6 @@ iface {{ interface['attachto'] }} {{ 'inet' if interface['addr'] | ipv4 else 'in {% endif %} {% for vlan in minigraph_vlans.keys()|sort %} {% for member in minigraph_vlans[vlan]['members'] %} -auto {{ member }} allow-hotplug {{ member }} iface {{ member }} inet manual pre-up ifconfig {{ member }} up mtu 9216 @@ -74,7 +72,6 @@ iface {{ member }} inet manual {% endif %} {% for pc in minigraph_portchannels.keys()|sort %} {% for member in minigraph_portchannels[pc]['members'] %} -auto {{ member }} allow-hotplug {{ member }} iface {{ member }} inet manual pre-up teamdctl {{ pc }} port add {{ member }} || true @@ -101,7 +98,6 @@ iface {{ vlan_interface['attachto'] }} {{ 'inet' if vlan_interface['addr'] | ipv {% block pc_interfaces %} # Portchannel interfaces {% for pc_interface in minigraph_portchannel_interfaces %} -auto {{ pc_interface['attachto'] }} allow-hotplug {{ pc_interface['attachto'] }} iface {{ pc_interface['attachto'] }} {{ 'inet' if pc_interface['addr'] | ipv4 else 'inet6' }} static mtu 9216 From 7792f09437245806c6d36ad7fda1cd0172ecd9ee Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 6 Jul 2017 02:27:05 -0700 Subject: [PATCH 0654/1833] [docker-ptf]: Install python modules from pypi (#788) --- dockers/docker-ptf/Dockerfile.j2 | 34 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 59360ee4fa2e..3304ff643bb8 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -20,11 +20,7 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / && apt-get install -y \ openssh-server \ vim \ - python \ - python-scapy \ net-tools \ - python-setuptools \ - supervisor \ traceroute \ lsof \ tcpdump \ @@ -32,34 +28,43 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / pkg-config \ binutils \ net-tools \ - python-pip \ build-essential \ libssl-dev \ libffi-dev \ - python-dev \ wget \ cmake \ libqt5core5a \ libqt5network5 \ less \ - ipython \ git \ iputils-ping \ hping3 \ - curl - -## Reinstall scapy by version from p4lang -RUN git clone https://github.com/p4lang/scapy-vxlan.git && cd scapy-vxlan && python setup.py install + curl \ + python \ + python-dev \ + python-scapy RUN dpkg -i \ {% for deb in docker_ptf_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} +# Install all python modules from pypi. python-scapy is exception, ptf debian package requires python-scapy RUN rm -rf /debs \ && apt-get -y autoclean \ && apt-get -y autoremove \ && rm -rf /var/lib/apt/lists/* \ + && wget --https-only https://bootstrap.pypa.io/get-pip.py \ + && python get-pip.py \ + && rm -f get-pip.py \ + && pip install setuptools \ + && pip install supervisor \ + && pip install ipython==5.4.1 \ + && git clone https://github.com/p4lang/scapy-vxlan.git \ + && cd scapy-vxlan \ + && python setup.py install \ + && cd .. \ + && rm -fr scapy-vxlan \ && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && tar xvfz 1.0.0.tar.gz \ && cd nanomsg-1.0.0 \ @@ -71,14 +76,12 @@ RUN rm -rf /debs \ && cd ../.. \ && rm -fr nanomsg-1.0.0 \ && rm -f 1.0.0.tar.gz \ - && pip install cffi==1.7.0 \ - && pip install --upgrade cffi==1.7.0 \ + && pip install cffi \ && pip install nnpy \ && pip install dpkt \ && pip install ipaddress \ && pip install pysubnettree \ && pip install paramiko \ - && pip install parallel-ssh \ && pip install flask \ && pip install exabgp==3.4.17\ && mkdir -p /opt \ @@ -90,8 +93,7 @@ RUN mkdir /var/run/sshd \ && echo 'root:root' | chpasswd \ && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config \ && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config \ - && sed -i '$aUseDNS no' /etc/ssh/sshd_config \ - && mkdir /root/deps + && sed -i '$aUseDNS no' /etc/ssh/sshd_config COPY ["supervisord.conf", "sshd.conf", "ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] From 12ce4ca4ea1b8e8591836b64aa796f1b17c09886 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 6 Jul 2017 02:27:25 -0700 Subject: [PATCH 0655/1833] [Arista]: Update Arista-7050-QX-32S port_config.ini (#789) --- .../Arista-7050-QX-32S/port_config.ini | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini index 5f29d189f352..b56d958499d4 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini @@ -1,33 +1,33 @@ # name lanes alias -Ethernet0 9,10,11,12 Ethernet1/1 -Ethernet4 13,14,15,16 Ethernet2/1 -Ethernet8 17,18,19,20 Ethernet3/1 -Ethernet12 21,22,23,24 Ethernet4/1 -Ethernet16 29,30,31,32 Ethernet5/1 -Ethernet20 25,26,27,28 Ethernet6/1 -Ethernet24 33,34,35,36 Ethernet7/1 -Ethernet28 37,38,39,40 Ethernet8/1 -Ethernet32 45,46,47,48 Ethernet9/1 -Ethernet36 41,42,43,44 Ethernet10/1 -Ethernet40 49,50,51,52 Ethernet11/1 -Ethernet44 53,54,55,56 Ethernet12/1 -Ethernet48 69,70,71,72 Ethernet13/1 -Ethernet52 65,66,67,68 Ethernet14/1 -Ethernet56 73,74,75,76 Ethernet15/1 -Ethernet60 77,78,79,80 Ethernet16/1 -Ethernet64 93,94,95,96 Ethernet17/1 -Ethernet68 89,90,91,92 Ethernet18/1 -Ethernet72 97,98,99,100 Ethernet19/1 -Ethernet76 101,102,103,104 Ethernet20/1 -Ethernet80 109,110,111,112 Ethernet21/1 -Ethernet84 105,106,107,108 Ethernet22/1 -Ethernet88 121,122,123,124 Ethernet23/1 -Ethernet92 125,126,127,128 Ethernet24/1 -Ethernet96 61,62,63,64 Ethernet25 -Ethernet100 57,58,59,60 Ethernet26 -Ethernet104 81,82,83,84 Ethernet27 -Ethernet108 85,86,87,88 Ethernet28 -Ethernet112 117,118,119,120 Ethernet29 -Ethernet116 113,114,115,116 Ethernet30 -Ethernet120 1,2,3,4 Ethernet31 -Ethernet124 5,6,7,8 Ethernet32 +Ethernet0 9,10,11,12 Ethernet5/1 +Ethernet4 13,14,15,16 Ethernet6/1 +Ethernet8 17,18,19,20 Ethernet7/1 +Ethernet12 21,22,23,24 Ethernet8/1 +Ethernet16 29,30,31,32 Ethernet9/1 +Ethernet20 25,26,27,28 Ethernet10/1 +Ethernet24 33,34,35,36 Ethernet11/1 +Ethernet28 37,38,39,40 Ethernet12/1 +Ethernet32 45,46,47,48 Ethernet13/1 +Ethernet36 41,42,43,44 Ethernet14/1 +Ethernet40 49,50,51,52 Ethernet15/1 +Ethernet44 53,54,55,56 Ethernet16/1 +Ethernet48 69,70,71,72 Ethernet17/1 +Ethernet52 65,66,67,68 Ethernet18/1 +Ethernet56 73,74,75,76 Ethernet19/1 +Ethernet60 77,78,79,80 Ethernet20/1 +Ethernet64 93,94,95,96 Ethernet21/1 +Ethernet68 89,90,91,92 Ethernet22/1 +Ethernet72 97,98,99,100 Ethernet23/1 +Ethernet76 101,102,103,104 Ethernet24/1 +Ethernet80 109,110,111,112 Ethernet25/1 +Ethernet84 105,106,107,108 Ethernet26/1 +Ethernet88 121,122,123,124 Ethernet27/1 +Ethernet92 125,126,127,128 Ethernet28/1 +Ethernet96 61,62,63,64 Ethernet29 +Ethernet100 57,58,59,60 Ethernet30 +Ethernet104 81,82,83,84 Ethernet31 +Ethernet108 85,86,87,88 Ethernet32 +Ethernet112 117,118,119,120 Ethernet33 +Ethernet116 113,114,115,116 Ethernet34 +Ethernet120 1,2,3,4 Ethernet35 +Ethernet124 5,6,7,8 Ethernet36 From b195b0737d53b6739f8f4073b67218344d1151dc Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Thu, 6 Jul 2017 17:30:56 +0800 Subject: [PATCH 0656/1833] [platform]: Update LED support for Ingrasys S9100 C32 (#783) * Adding file 'led_proc_init.soc' Signed-off-by: Sam Yang --- .../led_proc_init.soc | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/led_proc_init.soc diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/led_proc_init.soc b/device/ingrasys/x86_64-ingrasys_s9100-r0/led_proc_init.soc new file mode 100644 index 000000000000..f3afa2c61899 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/led_proc_init.soc @@ -0,0 +1,43 @@ +# LED microprocessor initialization for Ingrasys S9100 C32 + +led 0 stop +led 0 prog 02 04 D2 01 74 0A 12 40 77 0C 12 00 02 04 D2 01 74 14 EA 03 29 61 F1 67 35 74 1F 67 54 67 7C 02 04 D2 01 74 2C 91 DA 00 74 0C 77 31 81 DA 40 74 0C 86 F0 77 CF 06 FD D2 00 70 51 D2 01 74 43 67 A6 77 51 D2 03 74 4B 67 AD 77 51 D2 02 74 51 67 B4 D2 00 57 02 A0 F1 04 D2 01 70 5E 77 68 01 C2 FC 77 69 01 C2 FE 77 69 01 28 32 00 32 01 B7 97 75 77 02 01 60 FE 57 02 00 60 FE 57 02 A0 F1 04 D2 01 70 96 77 A6 06 FE D2 01 70 8E 77 AD 06 F0 C2 08 74 A6 77 AD 06 FE D2 01 70 9E 77 B4 06 F0 C2 08 74 A6 77 B4 22 0E 87 22 0E 87 57 22 0F 87 22 0E 87 57 22 0E 87 22 0F 87 22 0E 87 22 0F 87 22 0E 87 22 0F 87 22 0E 87 22 0F 87 FA 03 57 02 04 D2 01 70 D9 02 80 77 DB 02 20 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=0x1f REMAP_PORT_1=0x1e REMAP_PORT_2=0x1d REMAP_PORT_3=0x1c +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=0x1b REMAP_PORT_5=0x1a REMAP_PORT_6=0x19 REMAP_PORT_7=0x18 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=0x17 REMAP_PORT_9=0x16 REMAP_PORT_10=0x15 REMAP_PORT_11=0x14 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=0x13 REMAP_PORT_13=0x12 REMAP_PORT_14=0x11 REMAP_PORT_15=0x10 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=0xf REMAP_PORT_17=0xe REMAP_PORT_18=0xd REMAP_PORT_19=0xc +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=0xb REMAP_PORT_21=0xa REMAP_PORT_22=0x9 REMAP_PORT_23=0x8 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=0x7 REMAP_PORT_25=0x6 REMAP_PORT_26=0x5 REMAP_PORT_27=0x4 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=0x3 REMAP_PORT_29=0x2 REMAP_PORT_30=0x1 REMAP_PORT_31=0x0 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=0x3f REMAP_PORT_33=0x3e REMAP_PORT_34=0x3d REMAP_PORT_35=0x3c +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=0x3b REMAP_PORT_37=0x3a REMAP_PORT_38=0x39 REMAP_PORT_39=0x38 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=0x37 REMAP_PORT_41=0x36 REMAP_PORT_42=0x35 REMAP_PORT_43=0x34 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=0x33 REMAP_PORT_45=0x32 REMAP_PORT_46=0x31 REMAP_PORT_47=0x30 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=0x2f REMAP_PORT_49=0x2e REMAP_PORT_50=0x2d REMAP_PORT_51=0x2c +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=0x2b REMAP_PORT_53=0x2a REMAP_PORT_54=0x29 REMAP_PORT_55=0x28 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=0x27 REMAP_PORT_57=0x26 REMAP_PORT_58=0x25 REMAP_PORT_59=0x24 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=0x23 REMAP_PORT_61=0x22 REMAP_PORT_62=0x21 REMAP_PORT_63=0x20 +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 02 04 D2 01 74 0A 12 40 77 0C 12 00 02 04 D2 01 74 14 EA 03 29 61 F1 67 35 74 1F 67 54 67 7E 02 04 D2 01 74 2C 91 DA 00 74 0C 77 31 81 DA 40 74 0C 86 F0 77 D1 06 FD D2 00 70 51 D2 01 74 43 67 A8 77 51 D2 03 74 4B 67 AF 77 51 D2 02 74 51 67 B6 D2 00 57 02 A0 F1 04 D2 01 70 5E 77 68 01 C2 FC 77 69 01 C2 FE 77 69 01 F2 03 28 32 00 32 01 B7 97 75 79 02 01 60 FE 57 02 00 60 FE 57 02 A0 F1 04 D2 01 70 98 77 A8 06 FE D2 01 70 90 77 AF 06 F0 C2 08 74 A8 77 AF 06 FE D2 01 70 A0 77 B6 06 F0 C2 08 74 A8 77 B6 22 0E 87 22 0E 87 57 22 0F 87 22 0E 87 57 22 0E 87 22 0F 87 22 0E 87 22 0F 87 22 0E 87 22 0F 87 22 0E 87 22 0F 87 FA 03 57 02 04 D2 01 70 DB 02 80 77 DD 02 20 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=0x0 REMAP_PORT_1=0x1 REMAP_PORT_2=0x2 REMAP_PORT_3=0x3 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=0x4 REMAP_PORT_5=0x5 REMAP_PORT_6=0x6 REMAP_PORT_7=0x7 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=0x8 REMAP_PORT_9=0x9 REMAP_PORT_10=0xa REMAP_PORT_11=0xb +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=0xc REMAP_PORT_13=0xd REMAP_PORT_14=0xe REMAP_PORT_15=0xf +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=0x10 REMAP_PORT_17=0x11 REMAP_PORT_18=0x12 REMAP_PORT_19=0x13 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=0x14 REMAP_PORT_21=0x15 REMAP_PORT_22=0x16 REMAP_PORT_23=0x17 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=0x18 REMAP_PORT_25=0x19 REMAP_PORT_26=0x1a REMAP_PORT_27=0x1b +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=0x1c REMAP_PORT_29=0x1d REMAP_PORT_30=0x1e REMAP_PORT_31=0x1f +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=0x20 REMAP_PORT_33=0x21 REMAP_PORT_34=0x22 REMAP_PORT_35=0x23 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=0x24 REMAP_PORT_37=0x25 REMAP_PORT_38=0x26 REMAP_PORT_39=0x27 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=0x28 REMAP_PORT_41=0x29 REMAP_PORT_42=0x2a REMAP_PORT_43=0x2b +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=0x2c REMAP_PORT_45=0x2d REMAP_PORT_46=0x2e REMAP_PORT_47=0x2f +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=0x30 REMAP_PORT_49=0x31 REMAP_PORT_50=0x32 REMAP_PORT_51=0x33 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=0x34 REMAP_PORT_53=0x35 REMAP_PORT_54=0x36 REMAP_PORT_55=0x37 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=0x38 REMAP_PORT_57=0x39 REMAP_PORT_58=0x3a REMAP_PORT_59=0x3b +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=0x3c REMAP_PORT_61=0x3d REMAP_PORT_62=0x3e REMAP_PORT_63=0x3f +led 1 auto on +led 1 start From a697e8efcfd734f45a2a824b3a6907ab0e17c7b1 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 6 Jul 2017 10:32:27 -0700 Subject: [PATCH 0657/1833] [docker-base]: Build supervisor package from source in order to update to v3.3.2 (#777) - Resolves issue #762 --- .gitignore | 2 + dockers/docker-base/Dockerfile.j2 | 54 +++++++++++++------ .../etc/supervisor/supervisord.conf | 28 ++++++++++ rules/docker-base.mk | 1 + rules/supervisor.mk | 5 ++ sonic-slave/Dockerfile | 26 +++++---- src/supervisor/Makefile | 22 ++++++++ 7 files changed, 112 insertions(+), 26 deletions(-) create mode 100644 dockers/docker-base/etc/supervisor/supervisord.conf create mode 100644 rules/supervisor.mk create mode 100644 src/supervisor/Makefile diff --git a/.gitignore b/.gitignore index 2ab113a44eff..bf9967b04aca 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,8 @@ src/mpdecimal/* !src/mpdecimal/Makefile src/python3/* !src/python3/Makefile +src/supervisor/* +!src/supervisor/Makefile # Autogenerated Dockerfiles dockers/docker-base/Dockerfile diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index b8b1e23a1c2d..18761f3caacd 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -1,8 +1,9 @@ FROM debian:jessie -## Clean documentation in FROM image +# Clean documentation in FROM image RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true -## Clean doc directories that are empty or only contain empty directories + +# Clean doc directories that are empty or only contain empty directories RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done RUN rm -rf \ /usr/share/man/* \ @@ -13,18 +14,17 @@ RUN rm -rf \ /var/cache/man/* \ /usr/share/locale/* -## Make apt-get non-interactive +# Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -## Configure data sources for apt/dpkg +# Configure data sources for apt/dpkg COPY ["sources.list", "/etc/apt/sources.list"] COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] RUN apt-get update -## Pre-install fundamental packages +# Pre-install fundamental packages RUN apt-get -y install \ rsyslog \ - supervisor \ vim-tiny \ perl \ python \ @@ -34,25 +34,45 @@ COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] COPY ["root/.vimrc", "/root/.vimrc"] +# Install dependencies of supervisor +RUN apt-get -y install python-pkg-resources python-meld3 + +RUN mkdir -p /etc/supervisor +RUN mkdir -p /var/log/supervisor + +COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"] + RUN apt-get -y purge \ exim4 \ exim4-base \ exim4-config \ exim4-daemon-light -{% if docker_base_dbgs %} -## Install common debug-packages -RUN apt-get -y install \ -{% for dbg_pkg in docker_base_dbgs.split(' ') -%} - {{ dbg_pkg }}{{' '}} +{% if docker_base_debs.strip() -%} +# Copy built Debian packages +{%- for deb in docker_base_debs.split(' ') %} +COPY debs/{{ deb }} debs/ +{%- endfor %} + +# Install built Debian packages and implicitly install their dependencies +{%- for deb in docker_base_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt debs/{{ deb }} +{%- endfor %} +{%- endif %} + +{% if docker_base_dbgs.strip() -%} +# Install common debug-packages +{%- for dbg_pkg in docker_base_dbgs.split(' ') %} +RUN apt-get -y install {{ dbg_pkg }} {%- endfor %} {% else %} RUN ln /usr/bin/vim.tiny /usr/bin/vim -{% endif %} +{%- endif %} + +# Clean up apt +# Remove /var/lib/apt/lists/*, could be obsoleted for derived images +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /var/lib/apt/lists/* -## Clean up apt -## Remove /var/lib/apt/lists/*, could be obsoleted for derived images -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; \ - rm -rf /var/lib/apt/lists/*; \ - rm -rf /tmp/*; +RUN rm -rf /tmp/* diff --git a/dockers/docker-base/etc/supervisor/supervisord.conf b/dockers/docker-base/etc/supervisor/supervisord.conf new file mode 100644 index 000000000000..afead15524bf --- /dev/null +++ b/dockers/docker-base/etc/supervisor/supervisord.conf @@ -0,0 +1,28 @@ +; supervisor config file + +[unix_http_server] +file=/var/run/supervisor.sock ; (the path to the socket file) +chmod=0700 ; sockef file mode (default 0700) + +[supervisord] +logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) +pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) + +; the below section must remain in the config file for RPC +; (supervisorctl/web interface) to work, additional interfaces may be +; added by defining them in separate rpcinterface: sections +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket + +; The [include] section can just contain the "files" setting. This +; setting can list multiple files (separated by whitespace or +; newlines). It can also contain wildcards. The filenames are +; interpreted as relative to this file. Included files *cannot* +; include files themselves. + +[include] +files = /etc/supervisor/conf.d/*.conf diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 1580c357cddf..100b858fffa2 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -2,6 +2,7 @@ DOCKER_BASE = docker-base.gz $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base +$(DOCKER_BASE)_DEPENDS += $(SUPERVISOR) ifeq ($(SONIC_CONFIG_DEBUG),y) GDB = gdb diff --git a/rules/supervisor.mk b/rules/supervisor.mk new file mode 100644 index 000000000000..cedacd96373e --- /dev/null +++ b/rules/supervisor.mk @@ -0,0 +1,5 @@ +# supervisor package + +SUPERVISOR = python-supervisor_3.3.2-1_all.deb +$(SUPERVISOR)_SRC_PATH = $(SRC_PATH)/supervisor +SONIC_MAKE_DEBS += $(SUPERVISOR) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 20a7fbad89eb..6f1aea5e071e 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -200,23 +200,31 @@ RUN apt-get update && apt-get install -y \ procmail \ # For gtest libgtest-dev \ - cmake \ + cmake + # For linux build - && apt-get -y build-dep linux \ +RUN apt-get -y build-dep linux + # For gobgp build - && apt-get -yt jessie-backports install \ +RUN apt-get -yt jessie-backports install \ golang-go \ - golang-github-golang-mock-dev \ + golang-github-golang-mock-dev + # For p4 build - && pip install \ +RUN pip install \ ctypesgen \ - crc16 \ + crc16 + # For templating - j2cli \ +RUN pip install j2cli + # For sonic config engine testing - pyangbind +RUN pip install pyangbind + +# For supervisor build +RUN pip install meld3 mock -# Install dependencies for building isc-dhcp-relay +# Install dependencies for isc-dhcp-relay build RUN apt-get -y build-dep isc-dhcp RUN cd /usr/src/gtest && cmake . && make -C /usr/src/gtest diff --git a/src/supervisor/Makefile b/src/supervisor/Makefile new file mode 100644 index 000000000000..e9f1c65210a8 --- /dev/null +++ b/src/supervisor/Makefile @@ -0,0 +1,22 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = python-supervisor_3.3.2-1_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./supervisor + + # Clone isc-dhcp repo + git clone git://github.com/Supervisor/supervisor.git + pushd ./supervisor + git checkout -f 3.3.2 + + # Build Python and Debian package + python setup.py --command-packages=stdeb.command bdist_deb + popd + + # Move the newly-built .deb packages to the destination directory + mv ./supervisor/deb_dist/$* $(DEST)/ + From 90f21d403cc9fdb08d599aad4e29cdc4e96f6461 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 6 Jul 2017 15:28:23 -0700 Subject: [PATCH 0658/1833] [cfg engine] Add support to read device description xml (#775) [cfg engine] Add support to read device description xml --- src/sonic-config-engine/minigraph.py | 86 ++++++++++++++------ src/sonic-config-engine/sonic-cfggen | 8 +- src/sonic-config-engine/tests/device.xml | 17 ++++ src/sonic-config-engine/tests/test_cfggen.py | 11 +++ 4 files changed, 96 insertions(+), 26 deletions(-) create mode 100644 src/sonic-config-engine/tests/device.xml diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 8d3e82ea1233..0344ad0f04e6 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -42,11 +42,33 @@ class minigraph_encoder(json.JSONEncoder): def default(self, obj): - if isinstance(obj, - (ipaddress.IPv4Network, ipaddress.IPv6Network, ipaddress.IPv4Address, ipaddress.IPv6Address)): + if isinstance(obj, ( + ipaddress.IPv4Network, ipaddress.IPv6Network, + ipaddress.IPv4Address, ipaddress.IPv6Address + )): return str(obj) return json.JSONEncoder.default(self, obj) +def parse_device(device): + lo_prefix = None + mgmt_prefix = None + d_type = None # don't shadow type() + hwsku = None + name = None + if str(QName(ns3, "type")) in device.attrib: + d_type = device.attrib[str(QName(ns3, "type"))] + + for node in device: + if node.tag == str(QName(ns, "Address")): + lo_prefix = node.find(str(QName(ns2, "IPPrefix"))).text + elif node.tag == str(QName(ns, "ManagementAddress")): + mgmt_prefix = node.find(str(QName(ns2, "IPPrefix"))).text + elif node.tag == str(QName(ns, "Hostname")): + name = node.text + elif node.tag == str(QName(ns, "HwSku")): + hwsku = node.text + return (lo_prefix, mgmt_prefix, name, hwsku, d_type) + def parse_png(png, hname): neighbors = {} devices = {} @@ -77,24 +99,9 @@ def parse_png(png, hname): if child.tag == str(QName(ns, "Devices")): for device in child.findall(str(QName(ns, "Device"))): - lo_addr = None - # don't shadow type() - d_type = None - mgmt_addr = None - hwsku = None - if str(QName(ns3, "type")) in device.attrib: - d_type = device.attrib[str(QName(ns3, "type"))] - - for node in device: - if node.tag == str(QName(ns, "Address")): - lo_addr = node.find(str(QName(ns2, "IPPrefix"))).text.split('/')[0] - elif node.tag == str(QName(ns, "ManagementAddress")): - mgmt_addr = node.find(str(QName(ns2, "IPPrefix"))).text.split('/')[0] - elif node.tag == str(QName(ns, "Hostname")): - name = node.text - elif node.tag == str(QName(ns, "HwSku")): - hwsku = node.text - + (lo_prefix, mgmt_prefix, name, hwsku, d_type) = parse_device(device) + lo_addr = None if not lo_prefix else lo_prefix.split('/')[0] + mgmt_addr = None if not mgmt_prefix else mgmt_prefix.split('/')[0] devices[name] = {'lo_addr': lo_addr, 'type': d_type, 'mgmt_addr': mgmt_addr, 'hwsku': hwsku} if child.tag == str(QName(ns, "DeviceInterfaceLinks")): @@ -270,7 +277,7 @@ def parse_cpg(cpg, hname): myasn = int(asn) peers = router.find(str(QName(ns1, "Peers"))) for bgpPeer in peers.findall(str(QName(ns, "BGPPeer"))): - addr = bgpPeer.find(str(QName(ns, "Address"))).text + addr = bgpPeer.find(str(QName(ns, "Address"))).text if bgpPeer.find(str(QName(ns1, "PeersRange"))) is not None: name = bgpPeer.find(str(QName(ns1, "Name"))).text ip_range = bgpPeer.find(str(QName(ns1, "PeersRange"))).text @@ -382,7 +389,6 @@ def parse_port_config(hwsku, platform=None, port_config_file=None): port_alias_map[alias] = name return ports - def parse_xml(filename, platform=None, port_config_file=None): root = ET.parse(filename).getroot() mini_graph_path = filename @@ -432,9 +438,7 @@ def parse_xml(filename, platform=None, port_config_file=None): elif child.tag == str(QName(ns, "MetadataDeclaration")): (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) - Tree = lambda: defaultdict(Tree) - - results = Tree() + results = {} results['minigraph_hwsku'] = hwsku # sorting by lambdas are not easily done without custom filters. # TODO: add jinja2 filter to accept a lambda to sort a list of dictionaries by attribute. @@ -484,6 +488,38 @@ def parse_xml(filename, platform=None, port_config_file=None): return results +def parse_device_desc_xml(filename): + root = ET.parse(filename).getroot() + (lo_prefix, mgmt_prefix, hostname, hwsku, d_type) = parse_device(root) + + results = {} + results['minigraph_hwsku'] = hwsku + results['minigraph_hostname'] = hostname + results['inventory_hostname'] = hostname + + lo_intfs = [] + ipn = ipaddress.IPNetwork(lo_prefix) + ipaddr = ipn.ip + prefix_len = ipn.prefixlen + ipmask = ipn.netmask + lo_intf = {'name': None, 'addr': ipaddr, 'prefixlen': prefix_len} + if isinstance(ipn, ipaddress.IPv4Network): + lo_intf['mask'] = ipmask + else: + lo_intf['mask'] = str(prefix_len) + lo_intfs.append(lo_intf) + results['minigraph_lo_interfaces'] = lo_intfs + + mgmt_intf = None + mgmt_ipn = ipaddress.IPNetwork(mgmt_prefix) + ipaddr = mgmt_ipn.ip + prefix_len = str(mgmt_ipn.prefixlen) + ipmask = mgmt_ipn.netmask + gwaddr = ipaddress.IPAddress(int(mgmt_ipn.network) + 1) + mgmt_intf = {'addr': ipaddr, 'prefixlen': prefix_len, 'mask': ipmask, 'gwaddr': gwaddr} + results['minigraph_mgmt_interface'] = mgmt_intf + return results + port_alias_map = {} def print_parse_xml(filename): diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index c0ce51d4bf80..8f5b78ac66c1 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -9,6 +9,7 @@ import netaddr import json from minigraph import minigraph_encoder from minigraph import parse_xml +from minigraph import parse_device_desc_xml from sonic_platform import get_machine_info from sonic_platform import get_platform_info @@ -47,7 +48,9 @@ def unique_name(l): def main(): parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") - parser.add_argument("-m", "--minigraph", help="minigraph xml file") + group = parser.add_mutually_exclusive_group() + group.add_argument("-m", "--minigraph", help="minigraph xml file") + group.add_argument("-M", "--device-description", help="device description xml file") parser.add_argument("-p", "--port-config", help="port config file, used with -m") parser.add_argument("-y", "--yaml", help="yaml file that contains addtional variables", action='append', default=[]) parser.add_argument("-a", "--additional-data", help="addition data, in json string") @@ -79,6 +82,9 @@ def main(): else: data.update(parse_xml(minigraph)) + if args.device_description != None: + data.update(parse_device_desc_xml(args.device_description)) + for yaml_file in args.yaml: with open(yaml_file, 'r') as stream: additional_data = yaml.load(stream) diff --git a/src/sonic-config-engine/tests/device.xml b/src/sonic-config-engine/tests/device.xml new file mode 100644 index 000000000000..2995c4dde133 --- /dev/null +++ b/src/sonic-config-engine/tests/device.xml @@ -0,0 +1,17 @@ + + ToRRouter +
+ 10.10.0.12/32 +
+ + ::/0 + + + 10.0.1.5/28 + + + ::/0 + + switch1 + ACS-MSN2700 +
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 9a305fd72aac..eae4cb74fa42 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -12,6 +12,7 @@ def setUp(self): self.sample_graph_simple = os.path.join(self.test_dir, 'simple-sample-graph.xml') self.sample_graph_pc_test = os.path.join(self.test_dir, 'pc-test-graph.xml') self.sample_graph_bgp_speaker = os.path.join(self.test_dir, 't0-sample-bgp-speaker.xml') + self.sample_device_desc = os.path.join(self.test_dir, 'device.xml') self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') def run_script(self, argument): @@ -29,6 +30,16 @@ def test_dummy_run(self): output = self.run_script(argument) self.assertEqual(output, '') + def test_device_desc(self): + argument = '-v minigraph_hwsku -M "' + self.sample_device_desc + '"' + output = self.run_script(argument) + self.assertEqual(output.strip(), 'ACS-MSN2700') + + def test_device_desc_mgmt_ip(self): + argument = '-v "minigraph_mgmt_interface[\'addr\']" -M "' + self.sample_device_desc + '"' + output = self.run_script(argument) + self.assertEqual(output.strip(), '10.0.1.5') + def test_minigraph_sku(self): argument = '-v minigraph_hwsku -m "' + self.sample_graph + '"' output = self.run_script(argument) From a74b3a1eb7ce4760e9b4375551690f645b5e941d Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 6 Jul 2017 16:33:24 -0700 Subject: [PATCH 0659/1833] [teamd]: Fix Jinja2 template for calculating min_ports (#791) In Jinja2, '|' cannot be treated directly as piping operator. The operator precedence of '|' is higher than '*'. The filter only applies to the value just before it. Group the expression to make sure that the filter is applied to the outcome of the expression. Update the unit test to add such case. --- dockers/docker-teamd/teamd.j2 | 4 +-- .../pc_sample_output/PortChannel01.conf | 20 ++++++++++++ .../{ => t0_sample_output}/PortChannel01.conf | 0 .../{ => t0_sample_output}/PortChannel02.conf | 0 .../{ => t0_sample_output}/PortChannel03.conf | 0 .../{ => t0_sample_output}/PortChannel04.conf | 0 src/sonic-config-engine/tests/test_j2files.py | 31 +++++++++++++------ 7 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 src/sonic-config-engine/tests/sample_output/pc_sample_output/PortChannel01.conf rename src/sonic-config-engine/tests/sample_output/{ => t0_sample_output}/PortChannel01.conf (100%) rename src/sonic-config-engine/tests/sample_output/{ => t0_sample_output}/PortChannel02.conf (100%) rename src/sonic-config-engine/tests/sample_output/{ => t0_sample_output}/PortChannel03.conf (100%) rename src/sonic-config-engine/tests/sample_output/{ => t0_sample_output}/PortChannel04.conf (100%) diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 index 08a3415f5188..d6693719f1ad 100644 --- a/dockers/docker-teamd/teamd.j2 +++ b/dockers/docker-teamd/teamd.j2 @@ -5,7 +5,7 @@ "name": "lacp", "active": true, {# Use 75% links upperbound as min-links #} - "min_ports": {{ minigraph_portchannels[pc]['members'] | length * 0.75 | round(0, 'ceil') | int}}, + "min_ports": {{ (minigraph_portchannels[pc]['members'] | length * 0.75) | round(0, 'ceil') | int }}, "tx_hash": ["eth", "ipv4", "ipv6"] }, "link_watch": { @@ -13,7 +13,7 @@ }, "ports": { {% for member in minigraph_portchannels[pc]['members'] %} - "{{member}}": {}{% if not loop.last %},{% endif %} + "{{ member }}": {}{% if not loop.last %},{% endif %} {% endfor %} } diff --git a/src/sonic-config-engine/tests/sample_output/pc_sample_output/PortChannel01.conf b/src/sonic-config-engine/tests/sample_output/pc_sample_output/PortChannel01.conf new file mode 100644 index 000000000000..618e9baad6a7 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/pc_sample_output/PortChannel01.conf @@ -0,0 +1,20 @@ +{ + "device": "PortChannel01", + "hwaddr": "e4:1d:2d:a5:f3:ad", + "runner": { + "name": "lacp", + "active": true, + "min_ports": 3, + "tx_hash": ["eth", "ipv4", "ipv6"] + }, + "link_watch": { + "name": "ethtool" + }, + "ports": { + "Ethernet112": {}, + "Ethernet116": {}, + "Ethernet120": {}, + "Ethernet124": {} + } +} + diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel01.conf b/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel01.conf similarity index 100% rename from src/sonic-config-engine/tests/sample_output/PortChannel01.conf rename to src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel01.conf diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel02.conf b/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel02.conf similarity index 100% rename from src/sonic-config-engine/tests/sample_output/PortChannel02.conf rename to src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel02.conf diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel03.conf b/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel03.conf similarity index 100% rename from src/sonic-config-engine/tests/sample_output/PortChannel03.conf rename to src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel03.conf diff --git a/src/sonic-config-engine/tests/sample_output/PortChannel04.conf b/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel04.conf similarity index 100% rename from src/sonic-config-engine/tests/sample_output/PortChannel04.conf rename to src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel04.conf diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 2a8c7a35688f..238d8c815514 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -10,6 +10,7 @@ def setUp(self): self.test_dir = os.path.dirname(os.path.realpath(__file__)) self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') self.t0_minigraph = os.path.join(self.test_dir, 't0-sample-graph.xml') + self.pc_minigraph = os.path.join(self.test_dir, 'pc-test-graph.xml') self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') self.output_file = os.path.join(self.test_dir, 'output') @@ -30,21 +31,33 @@ def test_alias_map(self): self.assertEqual(data["Ethernet4"], "fortyGigE0/4") def test_teamd(self): - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"' - output = self.run_script(argument) # Mock the output via config.sh in docker-teamd - pc_list = output.split() - def test_render_teamd(self, pc): + def test_render_teamd(self, pc, minigraph, sample_output): teamd_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-teamd', 'teamd.j2') - sample_output_file = os.path.join(self.test_dir, 'sample_output',pc + '.conf') - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -a \'{\"pc\":\"' + pc + '\",\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + teamd_file + ' > ' + self.output_file + argument = '-m ' + minigraph + ' -p ' + self.t0_port_config + ' -a \'{\"pc\":\"' + pc + '\",\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + teamd_file + ' > ' + self.output_file self.run_script(argument) - assert filecmp.cmp(sample_output_file, self.output_file) + self.assertTrue(filecmp.cmp(sample_output, self.output_file)) + + # Test T0 minigraph + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"' + output = self.run_script(argument) # Mock the output via config.sh in docker-teamd + pc_list = output.split() for i in range(1, 5): pc_name = 'PortChannel0' + str(i) - assert pc_name in pc_list - test_render_teamd(self, pc_name) + self.assertTrue(pc_name in pc_list) + sample_output = os.path.join(self.test_dir, 'sample_output', 't0_sample_output', pc_name + '.conf') + test_render_teamd(self, pc_name, self.t0_minigraph, sample_output) + + # Test port channel test minigraph + argument = '-m ' + self.pc_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"' + output = self.run_script(argument) # Mock the output via config.sh in docker-teamd + pc_list = output.split() + + pc_name = 'PortChannel01' + self.assertTrue(pc_name in pc_list) + sample_output = os.path.join(self.test_dir, 'sample_output', 'pc_sample_output', pc_name + '.conf') + test_render_teamd(self, pc_name, self.pc_minigraph, sample_output) def test_ipinip(self): ipinip_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ipinip.json.j2') From 96fe12026545979fa7cfb0d3271b9aa59a4c5d90 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 7 Jul 2017 14:26:53 +0300 Subject: [PATCH 0660/1833] [mlnx]: Add support of Mellanox SN2740 platform. (#786) - Update SAI (added support of SN2740 profile). - Update SDK to version 4.2.3130. - Update FW to version 13.1224.0140. - Update HW MGMT to version 1.0.0160. --- .../ACS-MSN2740/port_config.ini | 33 + .../ACS-MSN2740/sai.profile | 1 + .../x86_64-mlnx_msn2740-r0/hw-management | 1 + .../x86_64-mlnx_msn2740-r0/installer.conf | 1 + .../x86_64-mlnx_msn2740-r0/minigraph.xml | 1079 +++++++++++++++++ .../x86_64-mlnx_msn2740-r0/plugins/eeprom.py | 33 + .../x86_64-mlnx_msn2740-r0/plugins/sfputil.py | 28 + dockers/docker-orchagent/ipinip.json.j2 | 2 +- dockers/docker-orchagent/mirror.json.j2 | 2 +- dockers/docker-orchagent/swssconfig.sh | 2 + .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 2 +- .../docker-syncd-mlnx/mlnx-fw-upgrade.sh | 2 +- platform/mellanox/fw.mk | 2 +- platform/mellanox/hw-management.mk | 2 +- platform/mellanox/mlnx-sai.mk | 2 +- platform/mellanox/sdk.mk | 4 +- 16 files changed, 1187 insertions(+), 9 deletions(-) create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/port_config.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile create mode 120000 device/mellanox/x86_64-mlnx_msn2740-r0/hw-management create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/port_config.ini b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/port_config.ini new file mode 100644 index 000000000000..816bb0e94a70 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 0,1,2,3 +Ethernet4 4,5,6,7 +Ethernet8 8,9,10,11 +Ethernet12 12,13,14,15 +Ethernet16 16,17,18,19 +Ethernet20 20,21,22,23 +Ethernet24 24,25,26,27 +Ethernet28 28,29,30,31 +Ethernet32 32,33,34,35 +Ethernet36 36,37,38,39 +Ethernet40 40,41,42,43 +Ethernet44 44,45,46,47 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 64,65,66,67 +Ethernet68 68,69,70,71 +Ethernet72 72,73,74,75 +Ethernet76 76,77,78,79 +Ethernet80 80,81,82,83 +Ethernet84 84,85,86,87 +Ethernet88 88,89,90,91 +Ethernet92 92,93,94,95 +Ethernet96 96,97,98,99 +Ethernet100 100,101,102,103 +Ethernet104 104,105,106,107 +Ethernet108 108,109,110,111 +Ethernet112 112,113,114,115 +Ethernet116 116,117,118,119 +Ethernet120 120,121,122,123 +Ethernet124 124,125,126,127 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile new file mode 100644 index 000000000000..79c24358c359 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sai_2740.xml diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/hw-management b/device/mellanox/x86_64-mlnx_msn2740-r0/hw-management new file mode 120000 index 000000000000..b231cbeea1bf --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/hw-management @@ -0,0 +1 @@ +/etc/mlnx/msn2740 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf b/device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf new file mode 100644 index 000000000000..c9c9493a5404 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml new file mode 100644 index 000000000000..81deffca3ae3 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml @@ -0,0 +1,1079 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch2 + 10.0.0.32 + 1 + 180 + 60 + + + switch2 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch2 + 10.0.0.34 + 1 + 180 + 60 + + + switch2 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch2 + 10.0.0.36 + 1 + 180 + 60 + + + switch2 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch2 + 10.0.0.38 + 1 + 180 + 60 + + + switch2 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch2 + 10.0.0.40 + 1 + 180 + 60 + + + switch2 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch2 + 10.0.0.42 + 1 + 180 + 60 + + + switch2 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch2 + 10.0.0.44 + 1 + 180 + 60 + + + switch2 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch2 + 10.0.0.46 + 1 + 180 + 60 + + + switch2 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch2 + 10.0.0.48 + 1 + 180 + 60 + + + switch2 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch2 + 10.0.0.50 + 1 + 180 + 60 + + + switch2 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch2 + 10.0.0.52 + 1 + 180 + 60 + + + switch2 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch2 + 10.0.0.54 + 1 + 180 + 60 + + + switch2 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch2 + 10.0.0.56 + 1 + 180 + 60 + + + switch2 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch2 + 10.0.0.58 + 1 + 180 + 60 + + + switch2 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch2 + 10.0.0.60 + 1 + 180 + 60 + + + switch2 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch2 + 10.0.0.62 + 1 + 180 + 60 + + + switch2 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch2 + + +
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 + + + + + + + + switch2 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch2 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + switch2 + ACS-MSN2740 + + ` + + + + + switch2 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + switch2 + ACS-MSN2740 +
diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py new file mode 100644 index 000000000000..d792d1770367 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/bsp/eeprom/sys_eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py new file mode 100644 index 000000000000..04e9a4eff85e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py @@ -0,0 +1,28 @@ +#! /usr/bin/python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + eeprom_offset = 1 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/bsp/qsfp/qsfp{0}' + for x in range(0, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) + sfputilbase.__init__(self, port_num) + diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index 19e98a41295c..6ffafd297496 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -4,7 +4,7 @@ "tunnel_type":"IPINIP", "src_ip":"{{ minigraph_lo_interfaces[0]['addr'] }}", "dst_ip":"{{ minigraph_lo_interfaces[0]['addr'] }}", -{% if minigraph_hwsku in [ 'ACS-MSN2700', 'ACS-MSN2410', 'ACS-MSN2100' ] %} +{% if onie_switch_asic == "mlnx" %} "dscp_mode":"uniform", "ecn_mode":"standard", {% else %} diff --git a/dockers/docker-orchagent/mirror.json.j2 b/dockers/docker-orchagent/mirror.json.j2 index 7a3a9250d7dc..4aa710cfcb71 100644 --- a/dockers/docker-orchagent/mirror.json.j2 +++ b/dockers/docker-orchagent/mirror.json.j2 @@ -4,7 +4,7 @@ "MIRROR_SESSION_TABLE:everflow": { "src_ip": "{{ minigraph_lo_interfaces[0]['addr'] }}", "dst_ip": "{{ erspan_dst[0] }}", -{% if minigraph_hwsku in [ 'ACS-MSN2700', 'ACS-MSN2410', 'ACS-MSN2100' ] %} +{% if onie_switch_asic == "mlnx" %} "gre_type": "0x6558", "queue": "1", {% else %} diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index ab6c39403b59..301a0ff4f351 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -48,6 +48,8 @@ elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "ACS-MSN2700" ]; then SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " +elif [ "$HWSKU" == "ACS-MSN2740" ]; then + SWSSCONFIG_ARGS+="msn2740.32ports.buffers.json msn2740.32ports.qos.json " fi for file in $SWSSCONFIG_ARGS; do diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 0736df044162..9d42c48b49e3 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -20,7 +20,7 @@ debs/{{ deb }}{{' '}} COPY ["start.sh", "mlnx-fw-upgrade.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["/debs/fw-SPC.mfa", "/etc/mlnx/"] +COPY ["/debs/fw-SPC-*-EVB.mfa", "/etc/mlnx/fw-SPC.mfa"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh b/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh index eee5d5a45ef8..0efb3ce9ecdd 100755 --- a/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh +++ b/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh @@ -1,7 +1,7 @@ #!/bin/bash query_retry_count_max="10" -required_fw_version="13.1220.0130" +required_fw_version="13.1224.0140" fw_file=/etc/mlnx/fw-SPC.mfa run_or_fail() { diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 6f03c0fca221..8260b9d566d4 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,5 +1,5 @@ # mellanox firmware -MLNX_FW = fw-SPC.mfa +MLNX_FW = fw-SPC-rel-13_1224_0140-EVB.mfa $(MLNX_FW)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW) SONIC_ONLINE_FILES += $(MLNX_FW) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 762bb6e53fe3..dcbce4564ee8 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,6 +1,6 @@ # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = V1.0.0100 +MLNX_HW_MANAGEMENT_VERSION = V1.0.0160 export MLNX_HW_MANAGEMENT_VERSION diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 8d3712cb1378..332d496e76d0 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = b57b458ff060adb2b1df629e330431a391a3b83e +MLNX_SAI_REVISION = ba3ccd6de8e5b82fa2cdfc30f9b8b1f1882bfede export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 71b3d218418b..bb576aaabee5 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/35e5e8739bec80c19053b7bb9cf6d083b8144fb5/sdk -MLNX_SDK_VERSION = 4.2.3102 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/ba3ccd6de8e5b82fa2cdfc30f9b8b1f1882bfede/sdk +MLNX_SDK_VERSION = 4.2.3130 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) From 51cab5d4ed1e3be9fd6565a42a5ebd5754c03c2c Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 7 Jul 2017 15:32:50 +0300 Subject: [PATCH 0661/1833] [config]: Add SONIC_CONFIG_MAKE_JOBS (#784) * [config]: Add SONIC_CONFIG_MAKE_JOBS This config option allows user to specify -j value that will be passed to each package build. Signed-off-by: marian-pritsak --- rules/config | 5 +++++ slave.mk | 3 ++- src/hiredis/Makefile | 2 +- src/initramfs-tools/Makefile | 2 +- src/isc-dhcp/Makefile | 2 +- src/libnl3/Makefile | 2 +- src/libteam/Makefile | 2 +- src/mpdecimal/Makefile | 2 +- src/python3/Makefile | 2 +- src/redis/Makefile | 2 +- src/snmpd/Makefile | 2 +- src/thrift/Makefile | 2 +- 12 files changed, 17 insertions(+), 11 deletions(-) diff --git a/rules/config b/rules/config index e813cd7ef1cb..66f936c1fa03 100644 --- a/rules/config +++ b/rules/config @@ -16,6 +16,11 @@ # container. SONIC_CONFIG_BUILD_JOBS = 1 +# SONIC_CONFIG_BUILD_JOBS - set number of jobs for number of jobs per package. +# Corresponding -j argument will be passed to make/dpkg commands that build separate packages +# container. +SONIC_CONFIG_MAKE_JOBS = $(shell nproc) + # SONIC_CONFIG_LOG_TO_FILES - print output from execution of rule for each # target into separate log file under target/log/. # Useful when executing parallel build diff --git a/slave.mk b/slave.mk index c8ffbd8086f0..40e28d6d67ab 100644 --- a/slave.mk +++ b/slave.mk @@ -71,6 +71,7 @@ override PASSWORD := $(DEFAULT_PASSWORD) endif MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) +export SONIC_CONFIG_MAKE_JOBS ############################################################################### ## Dumping key config attributes associated to current building exercise @@ -178,7 +179,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi pushd $($*_SRC_PATH) $(LOG) [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) - dpkg-buildpackage -rfakeroot -b -us -uc $(LOG) + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) popd $(LOG) # clean up if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi diff --git a/src/hiredis/Makefile b/src/hiredis/Makefile index f8d9db431483..d302b327d312 100644 --- a/src/hiredis/Makefile +++ b/src/hiredis/Makefile @@ -14,7 +14,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-source -x hiredis_$(HIREDIS_VERSION_FULL).dsc pushd hiredis-$(HIREDIS_VERSION) - fakeroot debian/rules binary + fakeroot debian/rules -j$(SONIC_CONFIG_MAKE_JOBS) binary popd mv $* $(DERIVED_TARGETS) $(DEST)/ diff --git a/src/initramfs-tools/Makefile b/src/initramfs-tools/Makefile index c7522aa3f66a..95d5c24d1185 100644 --- a/src/initramfs-tools/Makefile +++ b/src/initramfs-tools/Makefile @@ -15,7 +15,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Build the package rm -f debian/*.debhelper.log - dpkg-buildpackage -rfakeroot -b -us -uc + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd mv $* $(DEST)/ diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index b043c0bb266c..44e77cdd9b43 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -20,7 +20,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Build source and Debian packages pushd ./isc-dhcp - dpkg-buildpackage -rfakeroot -b -us -uc + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd # Move the newly-built .deb packages to the destination directory diff --git a/src/libnl3/Makefile b/src/libnl3/Makefile index 97beb746454c..efd234424dff 100644 --- a/src/libnl3/Makefile +++ b/src/libnl3/Makefile @@ -27,7 +27,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : quilt push quilt push quilt push - dpkg-buildpackage -rfakeroot -b -us -uc + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd mv $(DERIVED_TARGETS) $* $(DEST)/ diff --git a/src/libteam/Makefile b/src/libteam/Makefile index c2b8a09cff6f..283a6b56fbec 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -28,7 +28,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : mv tmp/debian libteam/ rm -rf tmp pushd ./libteam - dpkg-buildpackage -rfakeroot -b -us -uc + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd mv $(DERIVED_TARGETS) $* $(DEST)/ diff --git a/src/mpdecimal/Makefile b/src/mpdecimal/Makefile index c7f94203f472..5603c44b445f 100644 --- a/src/mpdecimal/Makefile +++ b/src/mpdecimal/Makefile @@ -14,7 +14,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-source -x mpdecimal_$(MPDECIMAL_VERSION_FULL).dsc pushd mpdecimal-$(MPDECIMAL_VERSION) - dpkg-buildpackage -us -uc -b + dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) popd mv $* $(DERIVED_TARGETS) $(DEST)/ diff --git a/src/python3/Makefile b/src/python3/Makefile index 80f977ff579d..d7718cbeccf6 100644 --- a/src/python3/Makefile +++ b/src/python3/Makefile @@ -32,7 +32,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : fi done - dpkg-buildpackage -rfakeroot -us -uc -b + dpkg-buildpackage -rfakeroot -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) popd cp $(DERIVED_TARGETS) $* $(DEST)/ diff --git a/src/redis/Makefile b/src/redis/Makefile index ddc952ff75ad..8cd4458b4339 100644 --- a/src/redis/Makefile +++ b/src/redis/Makefile @@ -16,7 +16,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-source -x redis_$(REDIS_VERSION_FULL).dsc pushd redis-$(REDIS_VERSION) - DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -us -uc -b + DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) popd mv $(DERIVED_TARGETS) $* $(DEST)/ diff --git a/src/snmpd/Makefile b/src/snmpd/Makefile index ace9fa6d4b87..457cd2ef05da 100644 --- a/src/snmpd/Makefile +++ b/src/snmpd/Makefile @@ -23,7 +23,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-source -x net-snmp_$(SNMPD_VERSION_FULL).dsc pushd net-snmp-$(SNMPD_VERSION) - fakeroot debian/rules binary + fakeroot debian/rules -j$(SONIC_CONFIG_MAKE_JOBS) binary popd mv $(DERIVED_TARGETS) $* $(DEST)/ diff --git a/src/thrift/Makefile b/src/thrift/Makefile index 2a4f67b9175b..786a10641e60 100644 --- a/src/thrift/Makefile +++ b/src/thrift/Makefile @@ -20,7 +20,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-source -x thrift_$(THRIFT_VERSION_FULL).dsc pushd thrift-$(THRIFT_VERSION) patch -p1 < ../patch/THRIFT-3577-assertion-failed.patch - DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -d -rfakeroot -b -us -uc + DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -d -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd mv $(DERIVED_TARGETS) $* $(DEST)/ From ca8fa7a32e753cf50aae32fa6b6e2c719c92d067 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Fri, 7 Jul 2017 20:24:06 +0300 Subject: [PATCH 0662/1833] Update cavium libsai (#793) Signed-off-by: Nadiya.Stetskovych --- platform/cavium/cavm-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/cavium/cavm-sai.mk b/platform/cavium/cavm-sai.mk index 82e67035b07b..c52c4960b9d6 100644 --- a/platform/cavium/cavm-sai.mk +++ b/platform/cavium/cavm-sai.mk @@ -1,6 +1,6 @@ # Cavium SAI -CAVM_SAI_GITHUB = https://github.com/XPliant/OpenXPS/raw/509de965cf8cc7fcea677b9b4b793612bce40510/SAI/cavm-sai/ +CAVM_SAI_GITHUB = https://github.com/XPliant/OpenXPS/raw/eedd0b8bb7e7a09602a24418a462a5c10792a145/SAI/cavm-sai/ CAVM_LIBSAI = libsai.deb CAVM_SAI = sai.deb From 18627bcf3695004064c00894d2e558bdc4daff46 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Fri, 7 Jul 2017 20:24:20 +0300 Subject: [PATCH 0663/1833] Update cavium xpnet driver (#792) Signed-off-by: Nadiya.Stetskovych --- platform/cavium/cavm-xpnet.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/cavium/cavm-xpnet.mk b/platform/cavium/cavm-xpnet.mk index 0ae3c147039f..613fa9433564 100644 --- a/platform/cavium/cavm-xpnet.mk +++ b/platform/cavium/cavm-xpnet.mk @@ -1,4 +1,4 @@ -CAVM_SAI_URL = https://github.com/XPliant/OpenXPS/raw/18cd5fb556b6262943c0af70375e2631ac3fe08d/SAI +CAVM_SAI_URL = https://github.com/XPliant/OpenXPS/raw/092461a1cf57a11132fbf8e74fa79bab3ab00f2a/SAI CAVM_XPNET_DEB = xp80-Pcie-Endpoint.deb $(CAVM_XPNET_DEB)_URL = $(CAVM_SAI_URL)/netdev/$(CAVM_XPNET_DEB) From 1248cc80e7c438413fe585c88abe02491643efa1 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Fri, 7 Jul 2017 21:40:35 +0300 Subject: [PATCH 0664/1833] Fix ACL json translation (#794) * Fix ACL json translation * Fix json translation tests --- src/sonic-config-engine/tests/sample_output/table_dataacl.json | 2 +- src/sonic-config-engine/tests/sample_output/table_everflow.json | 2 +- src/sonic-config-engine/translate_acl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-config-engine/tests/sample_output/table_dataacl.json b/src/sonic-config-engine/tests/sample_output/table_dataacl.json index ed10f3195636..a099680821d4 100644 --- a/src/sonic-config-engine/tests/sample_output/table_dataacl.json +++ b/src/sonic-config-engine/tests/sample_output/table_dataacl.json @@ -1,6 +1,6 @@ [ { - "ACL_TABLE:dataacl":{ + "ACL_TABLE:DATAACL":{ "policy_desc":"dataacl", "ports":"Ethernet112,Ethernet116,Ethernet120,Ethernet124", "type":"L3" diff --git a/src/sonic-config-engine/tests/sample_output/table_everflow.json b/src/sonic-config-engine/tests/sample_output/table_everflow.json index 4f3411ed8874..9686f8e3890d 100644 --- a/src/sonic-config-engine/tests/sample_output/table_everflow.json +++ b/src/sonic-config-engine/tests/sample_output/table_everflow.json @@ -1,6 +1,6 @@ [ { - "ACL_TABLE:everflow":{ + "ACL_TABLE:EVERFLOW":{ "policy_desc":"everflow", "ports":"Ethernet24,Ethernet40,Ethernet20,Ethernet44,Ethernet48,Ethernet28,Ethernet96,Ethernet92,Ethernet76,Ethernet116,Ethernet72,Ethernet112,Ethernet52,Ethernet108,Ethernet56,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet120,Ethernet8,Ethernet4,Ethernet0,Ethernet124,Ethernet68,Ethernet84,Ethernet100,Ethernet80,Ethernet60,Ethernet104,Ethernet64,Ethernet88", "type":"mirror" diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl index 696a433730a9..5525eff96774 100755 --- a/src/sonic-config-engine/translate_acl +++ b/src/sonic-config-engine/translate_acl @@ -120,7 +120,7 @@ def generate_table_json(aclset, aclname, ports, mirror, max_priority, output_pat table_props["ports"] = ports table_data = [{}] - table_data[0]["ACL_TABLE:"+table_name] = table_props + table_data[0]["ACL_TABLE:"+table_name.upper()] = table_props table_data[0]["OP"] = "SET" dump_json(os.path.join(output_path, "table_"+table_name+".json"), table_data) From 552b57d61e8b3edce8310ba19178ab2307a1d88a Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 7 Jul 2017 14:26:51 -0700 Subject: [PATCH 0665/1833] Update submodule sonic-snmpagent (#795) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index f66288d50821..649b0588cc66 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit f66288d50821d7b70ee7dc3321bdc626b3eb34cf +Subproject commit 649b0588cc662df5c56716c5f1f4e552437df266 From a5184d23d9e524b8a962d17274d20271773eba79 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 11 Jul 2017 11:15:48 -0700 Subject: [PATCH 0666/1833] [Broadcom]: Update OpenNSL to 3.2.2.2-10 (#796) Implement ACL redirect SET API RCU soft lockup issue fix for Dell S6100 --- platform/broadcom/sdk.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 143d4e5e27c7..5280fa2c9c1b 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,7 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-8-20170515203732.42_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-8-20170515203732.42_amd64.deb?sv=2015-04-05&sr=b&sig=70Ae7gJ9tCEwOiOX4N%2BxJ65uc9W55KmatvW7Yyx2mr8%3D&se=2031-01-23T00%3A01%3A52Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.2.2-10-20170707181826.44_amd64.deb +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-10-20170707181826.44_amd64.deb?sv=2015-04-05&sr=b&sig=hc4PbMQvfOu7p7E0MR1kn0OA6vu%2BPIdYOLeDU9hPJMY%3D&se=2031-03-19T21%3A20%3A15Z&sp=r" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-8-20170515203732.42_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-8-20170515203732.42_amd64.deb?sv=2015-04-05&sr=b&sig=K4emi7bcH6UGBukvJJFHo8lgCbK6omuBM16DK4yhRbo%3D&se=2031-01-23T00%3A02%3A19Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-10-20170707181826.44_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-10-20170707181826.44_amd64.deb?sv=2015-04-05&sr=b&sig=xtGLlxX5SspadCxaObMGGVMQliPGrTkuN0T6A4wLETA%3D&se=2031-03-19T21%3A21%3A43Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From ecd0b29533c03ff5f8ae6af1076deda1b344e43b Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 11 Jul 2017 13:01:45 -0700 Subject: [PATCH 0667/1833] [Broadcom]: Update SAI to 2.1.5.1-15 (#799) Add Arista-7050-Q16S64 config.bcm file --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index fc2503fa41b4..d8fe452dc85c 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-14-20170627090913.47_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-14-20170627090913.47_amd64.deb?sv=2015-04-05&sr=b&sig=MqrcsnIaaFfekaAqcjgbi0mDl94BJ9eRsslLJrp23q8%3D&se=2031-03-06T22%3A29%3A19Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-15-20170711181855.48_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-15-20170711181855.48_amd64.deb?sv=2015-04-05&sr=b&sig=shAVuRyM%2ByENjVs9QSEDt%2FALvITRS5GoTvC69MJ4G8M%3D&se=2031-03-20T18%3A21%3A43Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-14-20170627090913.47_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-15-20170711181855.48_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-14-20170627090913.47_amd64.deb?sv=2015-04-05&sr=b&sig=GyAwaEdgSFGXbbFq%2FN2RgSKQ5%2Fc73NgxKMMKq3RVZw0%3D&se=2031-03-06T22%3A29%3A48Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-15-20170711181855.48_amd64.deb?sv=2015-04-05&sr=b&sig=oksLplSCyP58%2BYap4JWi%2FgNz2%2BeJtVDbLui1IUDZSbw%3D&se=2031-03-20T18%3A21%3A16Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From c95d4e9cebf9e9cb71f5455ee31e7bffd5dbef12 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 11 Jul 2017 16:53:30 -0700 Subject: [PATCH 0668/1833] Update submodule sonic-snmpagent (#797) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 649b0588cc66..186a4f65fbdd 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 649b0588cc662df5c56716c5f1f4e552437df266 +Subproject commit 186a4f65fbdde9d277d0aeef562e1fc196266fdb From 1b5255d58308732e9b764427987d5b3e4936fff9 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 12 Jul 2017 01:27:53 -0700 Subject: [PATCH 0669/1833] add support for Arista-7050-Q16S64 (#798) --- .../Arista-7050-Q16S64/port_config.ini | 57 +++++++++++++++++++ .../Arista-7050-Q16S64/sai.profile | 2 + .../plugins/led_control.py | 15 +++-- 3 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini new file mode 100644 index 000000000000..28edbeccf224 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias +Ethernet0 125,126,127,128 Ethernet1/1 +Ethernet4 121,122,123,124 Ethernet2/1 +Ethernet8 13,14,15,16 Ethernet3/1 +Ethernet12 9,10,11,12 Ethernet4/1 +Ethernet16 17,18,19,20 Ethernet5/1 +Ethernet20 21,22,23,24 Ethernet6/1 +Ethernet24 25,26,27,28 Ethernet7/1 +Ethernet28 29,30,31,32 Ethernet8/1 +Ethernet32 37,38,39,40 Ethernet9/1 +Ethernet36 33,34,35,36 Ethernet10/1 +Ethernet40 45,46,47,48 Ethernet11/1 +Ethernet44 41,42,43,44 Ethernet12/1 +Ethernet48 53,54,55,56 Ethernet13/1 +Ethernet52 49,50,51,52 Ethernet14/1 +Ethernet56 69,70,71,72 Ethernet15/1 +Ethernet60 65,66,67,68 Ethernet16/1 +Ethernet64 77 Ethernet17/1 +Ethernet65 78 Ethernet17/2 +Ethernet66 79 Ethernet17/3 +Ethernet67 80 Ethernet17/4 +Ethernet68 73 Ethernet18/1 +Ethernet69 74 Ethernet18/2 +Ethernet70 75 Ethernet18/3 +Ethernet71 76 Ethernet18/4 +Ethernet72 93 Ethernet19/1 +Ethernet73 94 Ethernet19/2 +Ethernet74 95 Ethernet19/3 +Ethernet75 96 Ethernet19/4 +Ethernet76 89 Ethernet20/1 +Ethernet77 90 Ethernet20/2 +Ethernet78 91 Ethernet20/3 +Ethernet79 92 Ethernet20/4 +Ethernet80 101 Ethernet21/1 +Ethernet81 102 Ethernet21/2 +Ethernet82 103 Ethernet21/3 +Ethernet83 104 Ethernet21/4 +Ethernet84 97 Ethernet22/1 +Ethernet85 98 Ethernet22/2 +Ethernet86 99 Ethernet22/3 +Ethernet87 100 Ethernet22/4 +Ethernet88 109 Ethernet23/1 +Ethernet89 110 Ethernet23/2 +Ethernet90 111 Ethernet23/3 +Ethernet91 112 Ethernet23/4 +Ethernet92 105 Ethernet24/1 +Ethernet93 106 Ethernet24/2 +Ethernet94 107 Ethernet24/3 +Ethernet95 108 Ethernet24/4 +Ethernet96 61,62,63,64 Ethernet25 +Ethernet100 57,58,59,60 Ethernet26 +Ethernet104 81,82,83,84 Ethernet27 +Ethernet108 85,86,87,88 Ethernet28 +Ethernet112 117,118,119,120 Ethernet29 +Ethernet116 113,114,115,116 Ethernet30 +Ethernet120 5,6,7,8 Ethernet31 +Ethernet124 1,2,3,4 Ethernet32 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile new file mode 100644 index 000000000000..0175b59a5da3 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm +SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py index 9b8fd2f79186..b7eac3796723 100644 --- a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py @@ -7,12 +7,14 @@ try: from sonic_led.led_control_base import LedControlBase + import swsssdk except ImportError, e: raise ImportError (str(e) + " - required module not found") class LedControl(LedControlBase): """Platform specific LED control class""" + PORT_TABLE_PREFIX = "PORT_TABLE:" SONIC_PORT_NAME_PREFIX = "Ethernet" @@ -36,23 +38,28 @@ def _port_name_to_qsfp_index(self, port_name): sonic_port_num = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) + swss = swsssdk.SonicV2Connector() + swss.connect(swss.APPL_DB) + + lanes = swss.get(swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes') + # SONiC port nums are 0-based and increment by 4 # Arista QSFP indices are 1-based and increment by 1 - return ((sonic_port_num/4) + 1) + return (((sonic_port_num/4) + 1), sonic_port_num%4, len(lanes.split(','))) # Concrete implementation of port_link_state_change() method def port_link_state_change(self, port, state): - qsfp_index = self._port_name_to_qsfp_index(port) + qsfp_index, lane_index, lanes = self._port_name_to_qsfp_index(port) # Ignore invalid QSFP indices - if qsfp_index <= 0: + if qsfp_index <= 0 or lanes <= 0 or lanes > 4: return # QSFP indices 1-24 are breakout-capable and have four LEDs, and each LED indicate one lane. # whereas indices 25-32 are not breakout-capable, and only have one if qsfp_index <= self.QSFP_BREAKOUT_END_IDX: # assuming 40G, then we need to control four lanes - led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, i) for i in range(1, 5) ] + led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, i) for i in range(lane_index + 1, lane_index + 1 + lanes) ] else: led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) ] From 9925aab2e6675dd3aa2a1d30585882f2c9ea198b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 12 Jul 2017 01:28:36 -0700 Subject: [PATCH 0670/1833] Ignore return value of umount (#801) * Ignore return value of umount * Refine the umount process, more diagnostic info output --- build_debian.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 1e18ec45afbc..ff86cb22de45 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -316,8 +316,13 @@ sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'rm -rf /usr/share/doc/* /usr/share/ ## Umount all echo '[INFO] Umount all' +## Display all process details access /proc +sudo LANG=C chroot $FILESYSTEM_ROOT fuser -vm /proc +## Kill the processes sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /proc || true -sudo LANG=C chroot $FILESYSTEM_ROOT umount /proc +## Wait fuser fully kill the processes +sleep 15 +sudo umount $FILESYSTEM_ROOT/proc || true ## Prepare empty directory to trigger mount move in initramfs-tools/mount_loop_root, implemented by patching sudo mkdir $FILESYSTEM_ROOT/host @@ -325,7 +330,8 @@ sudo mkdir $FILESYSTEM_ROOT/host ## Compress most file system into squashfs file sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS ## Output the file system total size for diag purpose -sudo du -hs $FILESYSTEM_ROOT +## Note: -x to skip directories on different file systems, such as /proc +sudo du -hsx $FILESYSTEM_ROOT sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker -e $PLATFORM_DIR ## Compress docker files From 2090cd341ff48f202205d4c12d5c753195e74995 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 12 Jul 2017 18:15:35 -0700 Subject: [PATCH 0671/1833] [Broadcom]: Update SAI to 2.1.5.1-16 (#803) Add Inventec-D7032Q28B-C32 config.bcm file --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index d8fe452dc85c..ec7a34253075 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-15-20170711181855.48_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-15-20170711181855.48_amd64.deb?sv=2015-04-05&sr=b&sig=shAVuRyM%2ByENjVs9QSEDt%2FALvITRS5GoTvC69MJ4G8M%3D&se=2031-03-20T18%3A21%3A43Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-16-20170712202323.49_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-16-20170712202323.49_amd64.deb?sv=2015-04-05&sr=b&sig=jsPXiAoSyKqZ1SmiyeEj73W8tRlri8ysExnWvc%2BWSi4%3D&se=2031-03-21T22%3A49%3A32Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-15-20170711181855.48_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-16-20170712202323.49_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-15-20170711181855.48_amd64.deb?sv=2015-04-05&sr=b&sig=oksLplSCyP58%2BYap4JWi%2FgNz2%2BeJtVDbLui1IUDZSbw%3D&se=2031-03-20T18%3A21%3A16Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-16-20170712202323.49_amd64.deb?sv=2015-04-05&sr=b&sig=azYZkCi%2FFGS4eELKhIozOok3qimfH%2FjdXlz%2BS2MRBco%3D&se=2031-03-21T22%3A49%3A57Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From f49cac086f8421bf5d76a4798c4906700a322a50 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 12 Jul 2017 20:54:37 -0700 Subject: [PATCH 0672/1833] Remove extra trailing newlines at EOF (#804) Files now end with a single newline --- device/accton/x86_64-accton_as7512_32x-r0/plugins/eeprom.py | 1 - .../x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile | 1 - .../x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile | 1 - device/arista/x86_64-arista_7050_qx32/plugins/led_control.py | 1 - device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py | 1 - device/arista/x86_64-arista_7050_qx32s/sensors.conf | 1 - device/arista/x86_64-arista_7060_cx32s/sensors.conf | 1 - device/dell/x86_64-dell_z9100_c2538-r0/plugins/eeprom.py | 1 - device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol | 1 - device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/eeprom.py | 1 - device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol | 1 - device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/eeprom.py | 1 - device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/sensors.conf | 1 - device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol | 1 - device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py | 1 - device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py | 1 - device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py | 1 - device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py | 1 - dockers/docker-base/Dockerfile.j2 | 1 - dockers/docker-base/LICENSE | 1 - dockers/docker-base/etc/rsyslog.conf | 1 - dockers/docker-basic_router/Dockerfile | 1 - dockers/docker-basic_router/start.sh | 1 - dockers/docker-basic_router/supervisord.conf | 1 - dockers/docker-database/Dockerfile.j2 | 1 - dockers/docker-database/base_image_files/redis-cli | 1 - dockers/docker-database/supervisord.conf | 1 - dockers/docker-dhcp-relay/Dockerfile.j2 | 1 - dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 1 - dockers/docker-dhcp-relay/isc-dhcp-relay.sh | 1 - dockers/docker-dhcp-relay/start.sh | 1 - dockers/docker-dhcp-relay/supervisord.conf | 1 - dockers/docker-fpm-frr/config.sh | 1 - dockers/docker-fpm-gobgp/Dockerfile.j2 | 1 - dockers/docker-fpm-gobgp/start.sh | 1 - dockers/docker-fpm-gobgp/supervisord.conf | 1 - dockers/docker-fpm-quagga/Dockerfile.j2 | 1 - dockers/docker-fpm-quagga/start.sh | 1 - dockers/docker-fpm-quagga/supervisord.conf | 1 - dockers/docker-lldp-sv2/Dockerfile.j2 | 1 - dockers/docker-lldp-sv2/start.sh | 1 - dockers/docker-lldp-sv2/supervisord.conf | 1 - dockers/docker-orchagent/Dockerfile.j2 | 1 - dockers/docker-orchagent/orchagent.sh | 1 - dockers/docker-orchagent/swssconfig.sh | 1 - dockers/docker-platform-monitor/Dockerfile.j2 | 1 - dockers/docker-platform-monitor/lm-sensors.sh | 1 - dockers/docker-platform-monitor/start.sh | 1 - dockers/docker-platform-monitor/supervisord.conf | 1 - dockers/docker-saiserver-brcm/Dockerfile | 1 - dockers/docker-saiserver-brcm/start.sh | 1 - dockers/docker-saiserver-brcm/supervisord.conf | 1 - dockers/docker-saiserver-cavm/Dockerfile | 1 - dockers/docker-saiserver-cavm/start.sh | 1 - dockers/docker-saiserver-cavm/supervisord.conf | 1 - dockers/docker-saiserver-mlnx/Dockerfile | 1 - dockers/docker-saiserver-mlnx/start.sh | 1 - dockers/docker-saiserver-mlnx/supervisord.conf | 1 - dockers/docker-snmp-sv2/Dockerfile.j2 | 1 - dockers/docker-snmp-sv2/start.sh | 1 - dockers/docker-snmp-sv2/supervisord.conf | 1 - dockers/docker-teamd/Dockerfile.j2 | 1 - dockers/docker-teamd/base_image_files/teamdctl | 1 - dockers/docker-teamd/start.sh | 1 - dockers/docker-teamd/supervisord.conf | 1 - dockers/docker-teamd/teamd.sh | 1 - files/build_templates/docker_image_ctl.j2 | 1 - files/build_templates/sonic_debian_extension.j2 | 1 - files/dhcp/dhclient.conf | 1 - files/dhcp/sethostname | 1 - files/image_config/bash/bash.bashrc | 2 -- files/image_config/cron.d/logrotate | 1 - files/image_config/interfaces/init_interfaces | 1 - files/image_config/interfaces/interfaces-config.service | 1 - files/image_config/logrotate.d/rsyslog | 1 - files/image_config/ntp/ntp-config.service | 1 - files/image_config/rsyslog/rsyslog-config.service | 1 - files/image_config/rsyslog/rsyslog.conf.j2 | 1 - files/image_config/rsyslog/rsyslog.d/00-sonic.conf | 1 - files/image_config/rsyslog/rsyslog.d/99-default.conf | 1 - files/image_config/snmp/snmp.yml | 1 - files/image_config/sudoers/sudoers | 1 - files/image_config/systemd/journald.conf | 1 - files/image_config/updategraph/updategraph | 1 - platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 | 1 - platform/broadcom/docker-syncd-brcm.mk | 1 - platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 1 - platform/broadcom/docker-syncd-brcm/base_image_files/bcmcmd | 1 - platform/broadcom/docker-syncd-brcm/start.sh | 1 - platform/broadcom/docker-syncd-brcm/supervisord.conf | 1 - platform/cavium/cavm-platform-modules.mk | 1 - platform/cavium/cavm_platform_modules/Makefile | 1 - platform/cavium/docker-syncd-cavm/profile.ini | 1 - platform/cavium/docker-syncd-cavm/start.sh | 1 - platform/cavium/docker-syncd-cavm/supervisord.conf | 1 - platform/cavium/rules.mk | 1 - platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 | 1 - platform/centec/docker-syncd-centec/Dockerfile.j2 | 1 - platform/centec/docker-syncd-centec/start.sh | 1 - platform/centec/docker-syncd-centec/supervisord.conf | 1 - platform/generic/aboot-image.mk | 1 - platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 | 1 - platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 1 - platform/mellanox/docker-syncd-mlnx/supervisord.conf | 1 - platform/p4/docker-sonic-p4/rsyslog.conf | 1 - rules/docker-fpm-frr.mk | 1 - rules/isc-dhcp.mk | 1 - rules/python3.mk | 1 - src/isc-dhcp/Makefile | 1 - src/sonic-config-engine/openconfig_acl.py | 2 -- src/sonic-config-engine/sonic-cfggen | 1 - src/sonic-config-engine/sonic_platform.py | 1 - src/sonic-device-data/src/debian/rules | 1 - src/supervisor/Makefile | 1 - 114 files changed, 116 deletions(-) diff --git a/device/accton/x86_64-accton_as7512_32x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7512_32x-r0/plugins/eeprom.py index 26990541231f..6e2c0c8bb96f 100644 --- a/device/accton/x86_64-accton_as7512_32x-r0/plugins/eeprom.py +++ b/device/accton/x86_64-accton_as7512_32x-r0/plugins/eeprom.py @@ -30,4 +30,3 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) - diff --git a/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile b/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile index 5ed350f24d7f..dc74eef4d54b 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile +++ b/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile @@ -1,2 +1 @@ SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7712-32x100G.config.bcm - diff --git a/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile b/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile index fb1105b47f7a..de1e16b49544 100644 --- a/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile +++ b/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile @@ -1,2 +1 @@ SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7716-32x100G.config.bcm - diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py index b7eac3796723..1c69d8109f57 100644 --- a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py @@ -86,4 +86,3 @@ def __init__(self): led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) with open(led_sysfs_path, 'w') as led_file: led_file.write("%d" % self.LED_COLOR_OFF) - diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py index 582eaacbf918..839092ee1d4b 100644 --- a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py @@ -81,4 +81,3 @@ def __init__(self): led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index + self.LED_QSFP_OFFSET) with open(led_sysfs_path, 'w') as led_file: led_file.write("%d" % self.LED_COLOR_OFF) - diff --git a/device/arista/x86_64-arista_7050_qx32s/sensors.conf b/device/arista/x86_64-arista_7050_qx32s/sensors.conf index fc5f5c8c3e8e..cf4977f1cc12 100644 --- a/device/arista/x86_64-arista_7050_qx32s/sensors.conf +++ b/device/arista/x86_64-arista_7050_qx32s/sensors.conf @@ -46,4 +46,3 @@ chip "pmbus-i2c-5-58" label temp1 "Power supply 2 hotspot sensor" label temp2 "Power supply 2 inlet temp sensor" label temp3 "Power supply 2 sensor" - diff --git a/device/arista/x86_64-arista_7060_cx32s/sensors.conf b/device/arista/x86_64-arista_7060_cx32s/sensors.conf index 3b4dd2385322..20ebbeb5bbc7 100644 --- a/device/arista/x86_64-arista_7060_cx32s/sensors.conf +++ b/device/arista/x86_64-arista_7060_cx32s/sensors.conf @@ -44,4 +44,3 @@ chip "pmbus-i2c-5-58" label temp1 "Power supply 2 hotspot sensor" label temp2 "Power supply 2 inlet temp sensor" label temp3 "Power supply 2 sensor" - diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/eeprom.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/eeprom.py index 0e6b1bcfafcb..8d1d13f4b7cc 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/eeprom.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/eeprom.py @@ -20,4 +20,3 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0050/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) - diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol index 05a71e8d999c..827b0539546f 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol @@ -9,4 +9,3 @@ MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 - diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/eeprom.py index 2013aeddddb4..414ff38221bf 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/eeprom.py +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/eeprom.py @@ -20,4 +20,3 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/sys/class/i2c-adapter/i2c-17/17-0054/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) - diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol index d5d5fa82b2d2..cb07a7a07f4a 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol @@ -8,4 +8,3 @@ MINTEMP=hwmon2/device/pwm1=20 hwmon2/device/pwm2=20 MAXTEMP=hwmon2/device/pwm1=60 hwmon2/device/pwm2=60 MINSTART=hwmon2/device/pwm1=150 hwmon2/device/pwm2=150 MINSTOP=hwmon2/device/pwm1=0 hwmon2/device/pwm2=0 - diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/eeprom.py index c23edf5e772e..1b8de3f16bca 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/eeprom.py +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/eeprom.py @@ -20,4 +20,3 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/sys/class/i2c-adapter/i2c-7/7-0054/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) - diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/sensors.conf index d4b5a7bd0c8a..374bd3a64f04 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/sensors.conf +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/sensors.conf @@ -53,4 +53,3 @@ chip "tmp75-i2c-*-49" label temp1 "FAN Temp2" set temp1_max 50 set temp1_crit 70 - diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol index 05a71e8d999c..827b0539546f 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol @@ -9,4 +9,3 @@ MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 - diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py index d792d1770367..3650d9c8b70b 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py @@ -30,4 +30,3 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/bsp/eeprom/sys_eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) - diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py index d792d1770367..3650d9c8b70b 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py @@ -30,4 +30,3 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/bsp/eeprom/sys_eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) - diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py index d792d1770367..3650d9c8b70b 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py @@ -30,4 +30,3 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/bsp/eeprom/sys_eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) - diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py index d792d1770367..3650d9c8b70b 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py @@ -30,4 +30,3 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/bsp/eeprom/sys_eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) - diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index 18761f3caacd..ff52cf88e7d3 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -75,4 +75,3 @@ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /var/lib/apt/lists/* RUN rm -rf /tmp/* - diff --git a/dockers/docker-base/LICENSE b/dockers/docker-base/LICENSE index 1d7131f729e9..03d8f31e513c 100644 --- a/dockers/docker-base/LICENSE +++ b/dockers/docker-base/LICENSE @@ -11,4 +11,3 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - diff --git a/dockers/docker-base/etc/rsyslog.conf b/dockers/docker-base/etc/rsyslog.conf index 1132ad55ec3c..8cd8928e2b14 100644 --- a/dockers/docker-base/etc/rsyslog.conf +++ b/dockers/docker-base/etc/rsyslog.conf @@ -65,4 +65,3 @@ $IncludeConfig /etc/rsyslog.d/*.conf ############### #### RULES #### ############### - diff --git a/dockers/docker-basic_router/Dockerfile b/dockers/docker-basic_router/Dockerfile index fa8fbd496172..7d7c724920c2 100644 --- a/dockers/docker-basic_router/Dockerfile +++ b/dockers/docker-basic_router/Dockerfile @@ -20,4 +20,3 @@ COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-basic_router/start.sh b/dockers/docker-basic_router/start.sh index 925076231ccf..a4d378ef77d9 100755 --- a/dockers/docker-basic_router/start.sh +++ b/dockers/docker-basic_router/start.sh @@ -3,4 +3,3 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd - diff --git a/dockers/docker-basic_router/supervisord.conf b/dockers/docker-basic_router/supervisord.conf index 76f9a1968786..bfa84fdcdfb5 100644 --- a/dockers/docker-basic_router/supervisord.conf +++ b/dockers/docker-basic_router/supervisord.conf @@ -18,4 +18,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 1049f5bf1bfe..8397a3acfd22 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -35,4 +35,3 @@ RUN sed -ri 's/^(save .*$)/# \1/g; COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-database/base_image_files/redis-cli b/dockers/docker-database/base_image_files/redis-cli index 646992f65abd..103dd9e02536 100755 --- a/dockers/docker-database/base_image_files/redis-cli +++ b/dockers/docker-database/base_image_files/redis-cli @@ -1,4 +1,3 @@ #!/bin/bash docker exec -it database redis-cli "$@" - diff --git a/dockers/docker-database/supervisord.conf b/dockers/docker-database/supervisord.conf index 2c78d9c39311..8f90e1ed6285 100644 --- a/dockers/docker-database/supervisord.conf +++ b/dockers/docker-database/supervisord.conf @@ -10,4 +10,3 @@ autostart=true autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 1a7b7854d554..a7e1a1cffb9d 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -27,4 +27,3 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["isc-dhcp-relay.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 index 3b76073fa8c6..1c50b685ebda 100644 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -26,4 +26,3 @@ INTERFACES=" # '-a' option provides option 82 circuit_id and remote_id information OPTIONS="-a %h:%p %P" - diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.sh b/dockers/docker-dhcp-relay/isc-dhcp-relay.sh index 07efa351578f..2224b8a0fe00 100755 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.sh +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.sh @@ -16,4 +16,3 @@ if test "$INTERFACES" != ""; then fi exec /usr/sbin/dhcrelay -d -q ${OPTIONS} ${IFCMD} ${SERVERS} - diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index a847428ffba6..5c2e9de09703 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -40,4 +40,3 @@ done # Start the DHCP relay supervisorctl start isc-dhcp-relay - diff --git a/dockers/docker-dhcp-relay/supervisord.conf b/dockers/docker-dhcp-relay/supervisord.conf index 512762f2a5b4..ed1f75d1aed6 100644 --- a/dockers/docker-dhcp-relay/supervisord.conf +++ b/dockers/docker-dhcp-relay/supervisord.conf @@ -26,4 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-fpm-frr/config.sh b/dockers/docker-fpm-frr/config.sh index a57cba3cb46a..d795bcefa701 100755 --- a/dockers/docker-fpm-frr/config.sh +++ b/dockers/docker-fpm-frr/config.sh @@ -14,4 +14,3 @@ chmod 0755 /usr/sbin/bgp-unisolate mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status - diff --git a/dockers/docker-fpm-gobgp/Dockerfile.j2 b/dockers/docker-fpm-gobgp/Dockerfile.j2 index 64877ee9286d..1e333d9026c0 100644 --- a/dockers/docker-fpm-gobgp/Dockerfile.j2 +++ b/dockers/docker-fpm-gobgp/Dockerfile.j2 @@ -26,4 +26,3 @@ COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["daemons", "/etc/quagga/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-fpm-gobgp/start.sh b/dockers/docker-fpm-gobgp/start.sh index 25b26179bb58..636fceea0cbd 100755 --- a/dockers/docker-fpm-gobgp/start.sh +++ b/dockers/docker-fpm-gobgp/start.sh @@ -23,4 +23,3 @@ supervisorctl start rsyslogd service quagga start supervisorctl start fpmsyncd - diff --git a/dockers/docker-fpm-gobgp/supervisord.conf b/dockers/docker-fpm-gobgp/supervisord.conf index 34fca6756821..4e635f4093d4 100644 --- a/dockers/docker-fpm-gobgp/supervisord.conf +++ b/dockers/docker-fpm-gobgp/supervisord.conf @@ -34,4 +34,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index 2a7268a0019e..ffced8161a5b 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -28,4 +28,3 @@ COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["daemons", "/etc/quagga/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-fpm-quagga/start.sh b/dockers/docker-fpm-quagga/start.sh index c7df6f20999d..a72a96425f66 100755 --- a/dockers/docker-fpm-quagga/start.sh +++ b/dockers/docker-fpm-quagga/start.sh @@ -27,4 +27,3 @@ supervisorctl start rsyslogd service quagga start supervisorctl start fpmsyncd - diff --git a/dockers/docker-fpm-quagga/supervisord.conf b/dockers/docker-fpm-quagga/supervisord.conf index db069bd93787..f2c9bdce7e6d 100644 --- a/dockers/docker-fpm-quagga/supervisord.conf +++ b/dockers/docker-fpm-quagga/supervisord.conf @@ -26,4 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 84002f37e7ee..158d5b52ffe7 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -35,4 +35,3 @@ COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"] COPY ["lldpd", "/etc/default/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-lldp-sv2/start.sh b/dockers/docker-lldp-sv2/start.sh index ea3b7f45175c..63c8d32c34e6 100755 --- a/dockers/docker-lldp-sv2/start.sh +++ b/dockers/docker-lldp-sv2/start.sh @@ -11,4 +11,3 @@ supervisorctl start rsyslogd supervisorctl start lldpd supervisorctl start lldpd-conf-reload supervisorctl start lldp-syncd - diff --git a/dockers/docker-lldp-sv2/supervisord.conf b/dockers/docker-lldp-sv2/supervisord.conf index dcac7a8645f5..505b72d18227 100644 --- a/dockers/docker-lldp-sv2/supervisord.conf +++ b/dockers/docker-lldp-sv2/supervisord.conf @@ -47,4 +47,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index e4e155163076..73fb087401ab 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -32,4 +32,3 @@ COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"] COPY ["mirror.json.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 01b980b99c1a..8dc1b859ee25 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -19,4 +19,3 @@ elif [ "$ASIC" == "cavium" ]; then fi exec /usr/bin/orchagent ${ORCHAGENT_ARGS} - diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 301a0ff4f351..768417779e2d 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -58,4 +58,3 @@ for file in $SWSSCONFIG_ARGS; do done config_acl - diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 423181a3c589..b6406b3e3a6a 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -59,4 +59,3 @@ COPY ["start.sh", "lm-sensors.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-platform-monitor/lm-sensors.sh b/dockers/docker-platform-monitor/lm-sensors.sh index 1eafc81eeb63..61e90c09a8e3 100755 --- a/dockers/docker-platform-monitor/lm-sensors.sh +++ b/dockers/docker-platform-monitor/lm-sensors.sh @@ -9,4 +9,3 @@ # Currently, there is no way to run sensord in the foreground, so we # can't use supervisord. Instead, we just start the service for now. service sensord start - diff --git a/dockers/docker-platform-monitor/start.sh b/dockers/docker-platform-monitor/start.sh index cfcf17e4a192..fb87083f5cc6 100755 --- a/dockers/docker-platform-monitor/start.sh +++ b/dockers/docker-platform-monitor/start.sh @@ -23,4 +23,3 @@ if [ -e /usr/share/sonic/platform/fancontrol ]; then fi supervisorctl start ledd - diff --git a/dockers/docker-platform-monitor/supervisord.conf b/dockers/docker-platform-monitor/supervisord.conf index 2753dceb652d..6fb73450afec 100644 --- a/dockers/docker-platform-monitor/supervisord.conf +++ b/dockers/docker-platform-monitor/supervisord.conf @@ -41,4 +41,3 @@ priority=5 autostart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-saiserver-brcm/Dockerfile b/dockers/docker-saiserver-brcm/Dockerfile index 3a839a7a6df0..a3088e7ffabd 100755 --- a/dockers/docker-saiserver-brcm/Dockerfile +++ b/dockers/docker-saiserver-brcm/Dockerfile @@ -25,4 +25,3 @@ COPY ["profile.ini", "portmap.ini", "/etc/sai/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; rm -rf /deps ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-saiserver-brcm/start.sh b/dockers/docker-saiserver-brcm/start.sh index f023775f0674..494c0e9126c2 100755 --- a/dockers/docker-saiserver-brcm/start.sh +++ b/dockers/docker-saiserver-brcm/start.sh @@ -15,4 +15,3 @@ supervisorctl start rsyslogd start_bcm supervisorctl start saiserver - diff --git a/dockers/docker-saiserver-brcm/supervisord.conf b/dockers/docker-saiserver-brcm/supervisord.conf index e09ac3cbb449..cb67a0fc9a47 100644 --- a/dockers/docker-saiserver-brcm/supervisord.conf +++ b/dockers/docker-saiserver-brcm/supervisord.conf @@ -26,4 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-saiserver-cavm/Dockerfile b/dockers/docker-saiserver-cavm/Dockerfile index 9203690ad02a..2f667c8038ed 100644 --- a/dockers/docker-saiserver-cavm/Dockerfile +++ b/dockers/docker-saiserver-cavm/Dockerfile @@ -28,4 +28,3 @@ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf deps ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-saiserver-cavm/start.sh b/dockers/docker-saiserver-cavm/start.sh index 16457d13e03a..09cc0ddb5416 100755 --- a/dockers/docker-saiserver-cavm/start.sh +++ b/dockers/docker-saiserver-cavm/start.sh @@ -5,4 +5,3 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd supervisorctl start saiserver - diff --git a/dockers/docker-saiserver-cavm/supervisord.conf b/dockers/docker-saiserver-cavm/supervisord.conf index e09ac3cbb449..cb67a0fc9a47 100644 --- a/dockers/docker-saiserver-cavm/supervisord.conf +++ b/dockers/docker-saiserver-cavm/supervisord.conf @@ -26,4 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-saiserver-mlnx/Dockerfile b/dockers/docker-saiserver-mlnx/Dockerfile index 39d0fa176987..f908c05742e3 100755 --- a/dockers/docker-saiserver-mlnx/Dockerfile +++ b/dockers/docker-saiserver-mlnx/Dockerfile @@ -36,4 +36,3 @@ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-saiserver-mlnx/start.sh b/dockers/docker-saiserver-mlnx/start.sh index 57ee5036ded3..58a0c316add3 100755 --- a/dockers/docker-saiserver-mlnx/start.sh +++ b/dockers/docker-saiserver-mlnx/start.sh @@ -13,4 +13,3 @@ supervisorctl start rsyslogd start_mlnx supervisorctl start saiserver - diff --git a/dockers/docker-saiserver-mlnx/supervisord.conf b/dockers/docker-saiserver-mlnx/supervisord.conf index e09ac3cbb449..cb67a0fc9a47 100644 --- a/dockers/docker-saiserver-mlnx/supervisord.conf +++ b/dockers/docker-saiserver-mlnx/supervisord.conf @@ -26,4 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 73f5c257a5c4..2ab867031874 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -47,4 +47,3 @@ COPY ["*.j2", "/usr/share/sonic/templates/"] EXPOSE 161/udp 162/udp ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-snmp-sv2/start.sh b/dockers/docker-snmp-sv2/start.sh index 7e178351b159..ffbe8f196722 100755 --- a/dockers/docker-snmp-sv2/start.sh +++ b/dockers/docker-snmp-sv2/start.sh @@ -15,4 +15,3 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd supervisorctl start snmpd supervisorctl start snmp-subagent - diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index 6c3685b32cdb..60313c57f813 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -34,4 +34,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 73de6bd47a78..f604433a6c3f 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -30,4 +30,3 @@ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/dockers/docker-teamd/base_image_files/teamdctl b/dockers/docker-teamd/base_image_files/teamdctl index c7f59d321454..9dd188d18cba 100755 --- a/dockers/docker-teamd/base_image_files/teamdctl +++ b/dockers/docker-teamd/base_image_files/teamdctl @@ -1,4 +1,3 @@ #!/bin/bash docker exec -i teamd teamdctl "$@" - diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index 0f6a8c9f9ceb..fe4bfe1c584f 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -27,4 +27,3 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd supervisorctl start teamd - diff --git a/dockers/docker-teamd/supervisord.conf b/dockers/docker-teamd/supervisord.conf index 2db52ebd073f..48ef0ca9f29e 100644 --- a/dockers/docker-teamd/supervisord.conf +++ b/dockers/docker-teamd/supervisord.conf @@ -26,4 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/dockers/docker-teamd/teamd.sh b/dockers/docker-teamd/teamd.sh index 2c7c716b00b7..37b617150a04 100755 --- a/dockers/docker-teamd/teamd.sh +++ b/dockers/docker-teamd/teamd.sh @@ -36,4 +36,3 @@ while true; do fi sleep 1 done - diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 9a1f79c4ed5a..3ae3acaed33b 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -38,4 +38,3 @@ case "$1" in exit 1 ;; esac - diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 647a73b5ce1c..77c5457327cc 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -221,4 +221,3 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get autor sudo cp {{src}} $FILESYSTEM_ROOT/{{dst}} {% endif -%} {% endfor -%} - diff --git a/files/dhcp/dhclient.conf b/files/dhcp/dhclient.conf index 363a67b50f9e..6a542e069fab 100644 --- a/files/dhcp/dhclient.conf +++ b/files/dhcp/dhclient.conf @@ -22,4 +22,3 @@ request subnet-mask, broadcast-address, time-offset, routers, dhcp6.name-servers, dhcp6.domain-search, interface-mtu, rfc3442-classless-static-routes, ntp-servers, snmp-community, minigraph-url, acl-url; - diff --git a/files/dhcp/sethostname b/files/dhcp/sethostname index 57f96ce63612..8cef73239455 100644 --- a/files/dhcp/sethostname +++ b/files/dhcp/sethostname @@ -10,4 +10,3 @@ case $reason in fi ;; esac - diff --git a/files/image_config/bash/bash.bashrc b/files/image_config/bash/bash.bashrc index b531c88a0601..f59cc1bf6470 100644 --- a/files/image_config/bash/bash.bashrc +++ b/files/image_config/bash/bash.bashrc @@ -53,5 +53,3 @@ if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-no fi } fi - - diff --git a/files/image_config/cron.d/logrotate b/files/image_config/cron.d/logrotate index 877e0cb6d5d7..9e1335cbd43e 100644 --- a/files/image_config/cron.d/logrotate +++ b/files/image_config/cron.d/logrotate @@ -1,3 +1,2 @@ # Attempt to rotate system logs once per minute * * * * * root /usr/sbin/logrotate /etc/logrotate.d/rsyslog - diff --git a/files/image_config/interfaces/init_interfaces b/files/image_config/interfaces/init_interfaces index b13a36df47f8..e0bbad746a4a 100644 --- a/files/image_config/interfaces/init_interfaces +++ b/files/image_config/interfaces/init_interfaces @@ -8,4 +8,3 @@ iface lo inet loopback # The management network interface auto eth0 iface eth0 inet dhcp - diff --git a/files/image_config/interfaces/interfaces-config.service b/files/image_config/interfaces/interfaces-config.service index 92a82aeee0b8..0cc7f2981505 100644 --- a/files/image_config/interfaces/interfaces-config.service +++ b/files/image_config/interfaces/interfaces-config.service @@ -8,4 +8,3 @@ ExecStart=/usr/bin/interfaces-config.sh [Install] WantedBy=multi-user.target - diff --git a/files/image_config/logrotate.d/rsyslog b/files/image_config/logrotate.d/rsyslog index 4693288f18cc..5101b0e41fd2 100644 --- a/files/image_config/logrotate.d/rsyslog +++ b/files/image_config/logrotate.d/rsyslog @@ -60,4 +60,3 @@ kill -HUP $(cat /var/run/rsyslogd.pid) endscript } - diff --git a/files/image_config/ntp/ntp-config.service b/files/image_config/ntp/ntp-config.service index 5cfcc72f328d..948e7f4953c8 100644 --- a/files/image_config/ntp/ntp-config.service +++ b/files/image_config/ntp/ntp-config.service @@ -8,4 +8,3 @@ ExecStart=/usr/bin/ntp-config.sh [Install] WantedBy=multi-user.target - diff --git a/files/image_config/rsyslog/rsyslog-config.service b/files/image_config/rsyslog/rsyslog-config.service index 37f7bc04c650..ad72e9c2ea9a 100644 --- a/files/image_config/rsyslog/rsyslog-config.service +++ b/files/image_config/rsyslog/rsyslog-config.service @@ -8,4 +8,3 @@ ExecStart=/usr/bin/rsyslog-config.sh [Install] WantedBy=multi-user.target - diff --git a/files/image_config/rsyslog/rsyslog.conf.j2 b/files/image_config/rsyslog/rsyslog.conf.j2 index 008f9f10e6f0..54e2eec3f999 100644 --- a/files/image_config/rsyslog/rsyslog.conf.j2 +++ b/files/image_config/rsyslog/rsyslog.conf.j2 @@ -68,4 +68,3 @@ $IncludeConfig /etc/rsyslog.d/*.conf ############### #### RULES #### ############### - diff --git a/files/image_config/rsyslog/rsyslog.d/00-sonic.conf b/files/image_config/rsyslog/rsyslog.d/00-sonic.conf index 20d18e5d226d..bc0bbbaf1e61 100644 --- a/files/image_config/rsyslog/rsyslog.d/00-sonic.conf +++ b/files/image_config/rsyslog/rsyslog.d/00-sonic.conf @@ -19,4 +19,3 @@ if $programname contains "teamd_" then { /var/log/teamd.log stop } - diff --git a/files/image_config/rsyslog/rsyslog.d/99-default.conf b/files/image_config/rsyslog/rsyslog.d/99-default.conf index cfb1e1d3b881..51049e7473a8 100644 --- a/files/image_config/rsyslog/rsyslog.d/99-default.conf +++ b/files/image_config/rsyslog/rsyslog.d/99-default.conf @@ -68,4 +68,3 @@ daemon.*;mail.*;\ news.err;\ *.=debug;*.=info;\ *.=notice;*.=warn |/dev/xconsole - diff --git a/files/image_config/snmp/snmp.yml b/files/image_config/snmp/snmp.yml index 86f76c3a5cc3..117619975fbb 100644 --- a/files/image_config/snmp/snmp.yml +++ b/files/image_config/snmp/snmp.yml @@ -1,3 +1,2 @@ snmp_rocommunity: public snmp_location: public - diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index de62c7dd446b..cfff38b5027d 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -40,4 +40,3 @@ root ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d - diff --git a/files/image_config/systemd/journald.conf b/files/image_config/systemd/journald.conf index c32fbae57051..0f3d1b5ec25b 100644 --- a/files/image_config/systemd/journald.conf +++ b/files/image_config/systemd/journald.conf @@ -33,4 +33,3 @@ RuntimeMaxUse=50M #MaxLevelKMsg=notice #MaxLevelConsole=info #MaxLevelWall=emerg - diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index a46a5f73a0cf..7240d913c76d 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -86,4 +86,3 @@ if [ -n "$ACL_URL" ]; then else echo "Skip ACL config download." fi - diff --git a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 index ebe3dda1c14d..c8f0590023ed 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 @@ -49,4 +49,3 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index aeee6479a84f..6ef1587adecd 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -17,4 +17,3 @@ $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd - diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 2b5fc8c87d0b..76af952cef18 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -29,4 +29,3 @@ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/platform/broadcom/docker-syncd-brcm/base_image_files/bcmcmd b/platform/broadcom/docker-syncd-brcm/base_image_files/bcmcmd index ee87a93cdf6e..7903db6ed6a3 100755 --- a/platform/broadcom/docker-syncd-brcm/base_image_files/bcmcmd +++ b/platform/broadcom/docker-syncd-brcm/base_image_files/bcmcmd @@ -1,4 +1,3 @@ #!/bin/bash docker exec -i syncd bcmcmd "$@" - diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index 742cf8223132..930609a1958d 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -20,4 +20,3 @@ if [ -r ${PLATFORM_DIR}/led_proc_init.soc ]; then /usr/bin/bcmcmd -t 60 "rcload ${PLATFORM_DIR}/led_proc_init.soc" fi - diff --git a/platform/broadcom/docker-syncd-brcm/supervisord.conf b/platform/broadcom/docker-syncd-brcm/supervisord.conf index 1e015fef931f..1af5d70a1d0c 100644 --- a/platform/broadcom/docker-syncd-brcm/supervisord.conf +++ b/platform/broadcom/docker-syncd-brcm/supervisord.conf @@ -26,4 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/platform/cavium/cavm-platform-modules.mk b/platform/cavium/cavm-platform-modules.mk index 8ed10a6b9289..4ac72a4c4aab 100644 --- a/platform/cavium/cavm-platform-modules.mk +++ b/platform/cavium/cavm-platform-modules.mk @@ -1,4 +1,3 @@ CAVM_PLATFORM_DEB = cavm_platform_modules.deb $(CAVM_PLATFORM_DEB)_SRC_PATH = $(PLATFORM_PATH)/cavm_platform_modules SONIC_MAKE_DEBS += $(CAVM_PLATFORM_DEB) - diff --git a/platform/cavium/cavm_platform_modules/Makefile b/platform/cavium/cavm_platform_modules/Makefile index 13ab41926e38..aeb274aa5a42 100644 --- a/platform/cavium/cavm_platform_modules/Makefile +++ b/platform/cavium/cavm_platform_modules/Makefile @@ -31,4 +31,3 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : mv $(MAIN_TARGET) $(DEST)/ rm -rf $(DEB_BUILD_DIR) - diff --git a/platform/cavium/docker-syncd-cavm/profile.ini b/platform/cavium/docker-syncd-cavm/profile.ini index 1e5fc5f0fc0a..017996f7d7cc 100644 --- a/platform/cavium/docker-syncd-cavm/profile.ini +++ b/platform/cavium/docker-syncd-cavm/profile.ini @@ -1,3 +1,2 @@ mode=1 hwId=as7512 - diff --git a/platform/cavium/docker-syncd-cavm/start.sh b/platform/cavium/docker-syncd-cavm/start.sh index 96e2a9128081..623316050475 100755 --- a/platform/cavium/docker-syncd-cavm/start.sh +++ b/platform/cavium/docker-syncd-cavm/start.sh @@ -5,4 +5,3 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd supervisorctl start syncd - diff --git a/platform/cavium/docker-syncd-cavm/supervisord.conf b/platform/cavium/docker-syncd-cavm/supervisord.conf index 1e015fef931f..1af5d70a1d0c 100644 --- a/platform/cavium/docker-syncd-cavm/supervisord.conf +++ b/platform/cavium/docker-syncd-cavm/supervisord.conf @@ -26,4 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 67a69168e035..37a9bd7c994b 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -19,4 +19,3 @@ $(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) $(LIBSAITHRIFT_DEV_CAVM) # Runtime dependency on cavium sai is set only for syncd $(SYNCD)_RDEPENDS += $(CAVM_SAI) - diff --git a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 index ac402d1f6eae..db58e7731be8 100644 --- a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 @@ -49,4 +49,3 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index 302afbc0cd4e..d9b12bb426e4 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -27,4 +27,3 @@ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/platform/centec/docker-syncd-centec/start.sh b/platform/centec/docker-syncd-centec/start.sh index 96e2a9128081..623316050475 100755 --- a/platform/centec/docker-syncd-centec/start.sh +++ b/platform/centec/docker-syncd-centec/start.sh @@ -5,4 +5,3 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd supervisorctl start syncd - diff --git a/platform/centec/docker-syncd-centec/supervisord.conf b/platform/centec/docker-syncd-centec/supervisord.conf index 1e015fef931f..1af5d70a1d0c 100644 --- a/platform/centec/docker-syncd-centec/supervisord.conf +++ b/platform/centec/docker-syncd-centec/supervisord.conf @@ -26,4 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/platform/generic/aboot-image.mk b/platform/generic/aboot-image.mk index 64b841f856ea..7f5b4639e4e9 100644 --- a/platform/generic/aboot-image.mk +++ b/platform/generic/aboot-image.mk @@ -6,4 +6,3 @@ $(SONIC_GENERIC_ABOOT_IMAGE)_IMAGE_TYPE = aboot $(SONIC_GENERIC_ABOOT_IMAGE)_DEPENDS = $(SONIC_GENERIC_ABOOT_IMAGE)_DOCKERS = SONIC_INSTALLERS += $(SONIC_GENERIC_ABOOT_IMAGE) - diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 66eab2013ba6..0a2010dcbbc1 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -49,4 +49,3 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 9d42c48b49e3..79661e0ef7fa 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -27,4 +27,3 @@ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs ENTRYPOINT ["/usr/bin/supervisord"] - diff --git a/platform/mellanox/docker-syncd-mlnx/supervisord.conf b/platform/mellanox/docker-syncd-mlnx/supervisord.conf index 1e015fef931f..1af5d70a1d0c 100644 --- a/platform/mellanox/docker-syncd-mlnx/supervisord.conf +++ b/platform/mellanox/docker-syncd-mlnx/supervisord.conf @@ -26,4 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - diff --git a/platform/p4/docker-sonic-p4/rsyslog.conf b/platform/p4/docker-sonic-p4/rsyslog.conf index e8f42bdabe50..3480e18f9998 100644 --- a/platform/p4/docker-sonic-p4/rsyslog.conf +++ b/platform/p4/docker-sonic-p4/rsyslog.conf @@ -65,4 +65,3 @@ $IncludeConfig /etc/rsyslog.d/*.conf ############### #### RULES #### ############### - diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index d246d093dced..eedbc13c4e6c 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -11,4 +11,3 @@ $(DOCKER_FPM_FRR)_RUN_OPT += --net=host --privileged -t $(DOCKER_FPM_FRR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh - diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index bfceb7676622..82f5c3844c6f 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -10,4 +10,3 @@ SONIC_MAKE_DEBS += $(ISC_DHCP_COMMON) ISC_DHCP_RELAY = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb $(eval $(call add_derived_package,$(ISC_DHCP_COMMON),$(ISC_DHCP_RELAY))) - diff --git a/rules/python3.mk b/rules/python3.mk index 8fa02a26a462..2473c9aeb498 100644 --- a/rules/python3.mk +++ b/rules/python3.mk @@ -33,4 +33,3 @@ LIBPY3_DEV = lib$(PYTHON_PNAME)-dev_$(PYTHON_VER)_amd64.deb $(eval $(call add_derived_package,$(LIBPY3_MIN),$(LIBPY3_DEV))) $(LIBPY3_DEV)_DEPENDS += $(LIBPY3) $($(LIBPY3)_DEPENDS) $(LIBPY3_DEV)_RDEPENDS += $(LIBPY3) $($(LIBPY3)_RDEPENDS) - diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index 44e77cdd9b43..9cacd6cfe5e7 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -27,4 +27,3 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : mv $* $(DERIVED_TARGETS) $(DEST)/ $(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) - diff --git a/src/sonic-config-engine/openconfig_acl.py b/src/sonic-config-engine/openconfig_acl.py index 92ff414ed23e..cb29183652e7 100644 --- a/src/sonic-config-engine/openconfig_acl.py +++ b/src/sonic-config-engine/openconfig_acl.py @@ -7540,5 +7540,3 @@ def _unset_acl(self): _pyangbind_elements = {'acl': acl, } - - diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 8f5b78ac66c1..864513f577e0 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -114,4 +114,3 @@ def main(): if __name__ == "__main__": main() - diff --git a/src/sonic-config-engine/sonic_platform.py b/src/sonic-config-engine/sonic_platform.py index fdc192d09d0a..1eca1487a76a 100644 --- a/src/sonic-config-engine/sonic_platform.py +++ b/src/sonic-config-engine/sonic_platform.py @@ -29,4 +29,3 @@ def get_platform_info(machine_info): elif machine_info.has_key('aboot_platform'): return machine_info['aboot_platform'] return None - diff --git a/src/sonic-device-data/src/debian/rules b/src/sonic-device-data/src/debian/rules index e91562ccbb5a..a5e2f5acfc1f 100755 --- a/src/sonic-device-data/src/debian/rules +++ b/src/sonic-device-data/src/debian/rules @@ -4,4 +4,3 @@ build: %: dh $@ - diff --git a/src/supervisor/Makefile b/src/supervisor/Makefile index e9f1c65210a8..5f06325960b1 100644 --- a/src/supervisor/Makefile +++ b/src/supervisor/Makefile @@ -19,4 +19,3 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Move the newly-built .deb packages to the destination directory mv ./supervisor/deb_dist/$* $(DEST)/ - From 117650885811c3aac16d3549ff44d4fa3cb8d73c Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Thu, 13 Jul 2017 15:03:10 -0700 Subject: [PATCH 0673/1833] [bgpd]: support multiple peer range in single peer group (#807) --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 4 +++- src/sonic-config-engine/minigraph.py | 3 ++- src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml | 2 +- src/sonic-config-engine/tests/test_cfggen.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index 5f53d9698b2e..ceb866edd02d 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -84,7 +84,9 @@ router bgp {{ minigraph_bgp_asn }} neighbor {{ bgp_peer['name'] }} update-source Loopback0 neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out - bgp listen range {{ bgp_peer['ip_range'] }} peer-group {{ bgp_peer['name'] }} +{% for ip_range in bgp_peer['ip_range'] %} + bgp listen range {{ip_range}} peer-group {{ bgp_peer['name'] }} +{% endfor %} {% endfor %} {% endblock bgp_peers_with_range %} ! diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 0344ad0f04e6..1fd16f376fab 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -281,9 +281,10 @@ def parse_cpg(cpg, hname): if bgpPeer.find(str(QName(ns1, "PeersRange"))) is not None: name = bgpPeer.find(str(QName(ns1, "Name"))).text ip_range = bgpPeer.find(str(QName(ns1, "PeersRange"))).text + ip_range_group = ip_range.split(';') if ip_range and ip_range != "" else [] bgp_peers_with_range.append({ 'name': name, - 'ip_range': ip_range + 'ip_range': ip_range_group }) else: for bgp_session in bgp_sessions: diff --git a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml index b5e373ddd868..8a21c041c80e 100644 --- a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml +++ b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml @@ -111,7 +111,7 @@
10.1.0.32
BGPSLBPassive - 10.10.10.10/26 + 10.10.10.10/26;100.100.100.100/26
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index eae4cb74fa42..6835c60e27fd 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -113,7 +113,7 @@ def test_minigraph_neighbors(self): def test_minigraph_peers_with_range(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v minigraph_bgp_peers_with_range' output = self.run_script(argument) - self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': '10.10.10.10/26'}]") + self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]") def test_minigraph_deployment_id(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v deployment_id' From 6f0722322c9bbdd43db634c268d8de7d48e6cf61 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 14 Jul 2017 23:53:44 -0700 Subject: [PATCH 0674/1833] [sonic-slave]: Update golang version to 1.8.3 (#810) * Update golang version to latest 1.8.3 --- sonic-slave/Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 6f1aea5e071e..38fe431a044d 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -206,9 +206,11 @@ RUN apt-get update && apt-get install -y \ RUN apt-get -y build-dep linux # For gobgp build -RUN apt-get -yt jessie-backports install \ - golang-go \ - golang-github-golang-mock-dev +RUN export VERSION=1.8.3 \ + && wget https://storage.googleapis.com/golang/go$VERSION.linux-amd64.tar.gz \ + && tar -C /usr/local -xzf go$VERSION.linux-amd64.tar.gz \ + && echo 'export GOROOT=/usr/local/go' >> /etc/bash.bashrc \ + && echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/bash.bashrc # For p4 build RUN pip install \ From 481bd6b46badce4ba729f978bc2fd72a2282f179 Mon Sep 17 00:00:00 2001 From: JipanYanga Date: Mon, 17 Jul 2017 23:19:16 -0700 Subject: [PATCH 0675/1833] Update sonic-linux-kernel submodule (#812) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 0d56999ccfcc..a97c5e416f8d 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 0d56999ccfccdc054178388f65c9442aa350caec +Subproject commit a97c5e416f8d4c8d6ddd69a7bb6b983527b3c627 From 8ffe0b0d35a2cbafff28f1f2a87cc715e86f76da Mon Sep 17 00:00:00 2001 From: Balaselvi Date: Tue, 18 Jul 2017 11:21:24 -0700 Subject: [PATCH 0676/1833] Inventec platform support (#811) --- .../INVENTEC-D7032Q28B-C32/port_config.ini | 33 + .../INVENTEC-D7032Q28B-C32/sai.profile | 2 + .../installer.conf | 4 + .../minigraph.xml | 146 +++ .../plugins/eeprom.py | 22 + .../plugins/sfputil.py | 60 + platform/broadcom/one-image.mk | 3 +- .../broadcom/platform-modules-inventec.mk | 12 + platform/broadcom/rules.mk | 1 + .../sonic-platform-modules-inventec/LICENSE | 674 +++++++++++ .../d7032q28b/conf/d7032q28b-modules.conf | 10 + .../d7032q28b/modules/Makefile | 3 + .../d7032q28b/modules/inv_cpld.c | 456 ++++++++ .../d7032q28b/modules/inv_platform.c | 197 ++++ .../d7032q28b/modules/inv_psoc.c | 1024 +++++++++++++++++ .../d7032q28b/utils/onie-syseeprom | Bin 0 -> 921685 bytes .../debian/changelog | 5 + .../debian/compat | 1 + .../debian/control | 12 + .../debian/platform-modules-d7032q28b.init | 69 ++ .../debian/platform-modules-d7032q28b.install | 1 + .../debian/rules | 46 + 22 files changed, 2780 insertions(+), 1 deletion(-) create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/port_config.ini create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/sai.profile create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/installer.conf create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/plugins/eeprom.py create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py create mode 100755 platform/broadcom/platform-modules-inventec.mk create mode 100644 platform/broadcom/sonic-platform-modules-inventec/LICENSE create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/conf/d7032q28b-modules.conf create mode 100755 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_platform.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_psoc.c create mode 100755 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/onie-syseeprom create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/changelog create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/compat create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/control create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install create mode 100755 platform/broadcom/sonic-platform-modules-inventec/debian/rules diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/port_config.ini b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/port_config.ini new file mode 100644 index 000000000000..9b41dd7f6015 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 1,2,3,4 Ethernet0 +Ethernet4 5,6,7,8 Ethernet4 +Ethernet8 9,10,11,12 Ethernet8 +Ethernet12 13,14,15,16 Ethernet12 +Ethernet16 17,18,19,20 Ethernet16 +Ethernet20 21,22,23,24 Ethernet20 +Ethernet24 25,26,27,28 Ethernet24 +Ethernet28 29,30,31,32 Ethernet28 +Ethernet32 33,34,35,36 Ethernet32 +Ethernet36 37,38,39,40 Ethernet36 +Ethernet40 41,42,43,44 Ethernet40 +Ethernet44 45,46,47,48 Ethernet44 +Ethernet48 49,50,51,52 Ethernet48 +Ethernet52 53,54,55,56 Ethernet52 +Ethernet56 57,58,59,60 Ethernet56 +Ethernet60 61,62,63,64 Ethernet60 +Ethernet64 65,66,67,68 Ethernet64 +Ethernet68 69,70,71,72 Ethernet68 +Ethernet72 73,74,75,76 Ethernet72 +Ethernet76 77,78,79,80 Ethernet76 +Ethernet80 81,82,83,84 Ethernet80 +Ethernet84 85,86,87,88 Ethernet84 +Ethernet88 89,90,91,92 Ethernet88 +Ethernet92 93,94,95,96 Ethernet92 +Ethernet96 97,98,99,100 Ethernet96 +Ethernet100 101,102,103,104 Ethernet100 +Ethernet104 105,106,107,108 Ethernet104 +Ethernet108 109,110,111,112 Ethernet108 +Ethernet112 113,114,115,116 Ethernet112 +Ethernet116 117,118,119,120 Ethernet116 +Ethernet120 121,122,123,124 Ethernet120 +Ethernet124 125,126,127,128 Ethernet124 diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/sai.profile b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/sai.profile new file mode 100644 index 000000000000..5312a779bbc3 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-d7032q28b-32x100g.config.bcm +SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/installer.conf b/device/inventec/x86_64-inventec_d7032q28b-r0/installer.conf new file mode 100644 index 000000000000..6b489db6e16f --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 +VAR_LOG_SIZE=1024 diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml b/device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml new file mode 100644 index 000000000000..a582bfa49a21 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml @@ -0,0 +1,146 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + SONiC-Inventec-d7032-100 + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + SONiC-Inventec-d7032-100 + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + SONiC-Inventec-d7032-100 + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + SONiC-Inventec-d7032-100 + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + SONiC-Inventec-d7032-100 + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + SONiC-Inventec-d7032-100 + Ethernet4 + + + + + SONiC-Inventec-d7032-100 + INVENTEC-D7032Q28B-C32 + + + + + + + SONiC-Inventec-d7032-100 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + SONiC-Inventec-d7032-100 + INVENTEC-D7032Q28B-C32 +
diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/eeprom.py b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/eeprom.py new file mode 100644 index 000000000000..ad70e584bb2a --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Inventec d7032q28b +# +# 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 = "/tmp/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py new file mode 100644 index 000000000000..020faab9db58 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: 22, + 1: 23, + 2: 24, + 3: 25, + 4: 26, + 5: 27, + 6: 28, + 7: 29, + 8: 30, + 9: 31, + 10: 32, + 11: 33, + 12: 34, + 13: 35, + 14: 36, + 15: 37, + 16: 6, + 17: 7, + 18: 8, + 19: 9, + 20: 10, + 21: 11, + 22: 12, + 23: 13, + 24: 14, + 25: 15, + 26: 16, + 27: 17, + 28: 18, + 29: 19, + 30: 20, + 31: 21 + } + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(self.port_start, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + sfputilbase.__init__(self, port_num) diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 600e1159b400..0a48a32bd600 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -10,6 +10,7 @@ $(SONIC_ONE_IMAGE)_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(INGRASYS_S8900_54XC_PLATFORM_MODULE) \ $(INGRASYS_S8900_64XC_PLATFORM_MODULE) \ $(INGRASYS_S9100_PLATFORM_MODULE) \ - $(ACCTON_AS7712_32X_PLATFORM_MODULE) + $(ACCTON_AS7712_32X_PLATFORM_MODULE) \ + $(INVENTEC_D7032Q28B_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-inventec.mk b/platform/broadcom/platform-modules-inventec.mk new file mode 100755 index 000000000000..0d00fe1f7368 --- /dev/null +++ b/platform/broadcom/platform-modules-inventec.mk @@ -0,0 +1,12 @@ +# Inventec d7032q28b Platform modules + +INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION = 1.0.0 + +export INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION + +INVENTEC_D7032Q28B_PLATFORM_MODULE = platform-modules-d7032q28b_$(INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION)_amd64.deb +$(INVENTEC_D7032Q28B_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-inventec +$(INVENTEC_D7032Q28B_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(INVENTEC_D7032Q28B_PLATFORM_MODULE)_PLATFORM = x86_64-inventec_d7032q28b-r0 +SONIC_DPKG_DEBS += $(INVENTEC_D7032Q28B_PLATFORM_MODULE) +$(eval $(call add_extra_package,$(INVENTEC_D7032Q28B_PLATFORM_MODULE))) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 3f0d523d4204..3823dcc4b83e 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -5,6 +5,7 @@ include $(PLATFORM_PATH)/platform-modules-dell.mk include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk +include $(PLATFORM_PATH)/platform-modules-inventec.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk diff --git a/platform/broadcom/sonic-platform-modules-inventec/LICENSE b/platform/broadcom/sonic-platform-modules-inventec/LICENSE new file mode 100644 index 000000000000..9cecc1d4669e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/conf/d7032q28b-modules.conf b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/conf/d7032q28b-modules.conf new file mode 100644 index 000000000000..29d4d50a4f9a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/conf/d7032q28b-modules.conf @@ -0,0 +1,10 @@ +# /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. + +lpc_ich +i2c-i801 +i2c-mux +i2c-mux-pca954x +i2c-dev diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile new file mode 100755 index 000000000000..cdabd612a66d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile @@ -0,0 +1,3 @@ +obj-m += inv_cpld.o inv_psoc.o +obj-m += inv_platform.o + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_cpld.c b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_cpld.c new file mode 100644 index 000000000000..028e24b9eb86 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_cpld.c @@ -0,0 +1,456 @@ +/* + * 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 "I2CHostCommunication.h" + +#define USE_SMBUS 1 + +/* definition */ +#define CPLD_INFO_OFFSET 0x00 +#define CPLD_RESET_OFFSET 0x08 +#define CPLD_PSU_OFFSET 0x09 +#define CPLD_LED_OFFSET 0x0E +#define CPLD_LED_STATU_OFFSET 0x0D +#define CPLD_CTL_OFFSET 0x0C + + + +/* Each client has this additional data */ +struct cpld_data { + struct device *hwmon_dev; + struct mutex update_lock; +}; + +/*-----------------------------------------------------------------------*/ + +static ssize_t cpld_i2c_read(struct i2c_client *client, u8 *buf, u8 offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg[0].buf = msgbuf; + msg[0].len = 1; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + status = i2c_transfer(client->adapter, msg, 2); + + if(status == 2) + status = count; + + return status; +#endif +} + +static ssize_t cpld_i2c_write(struct i2c_client *client, char *buf, unsigned offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + return status; +#endif +} + +/*-----------------------------------------------------------------------*/ + +/* sysfs attributes for hwmon */ + +static ssize_t show_info(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[4]; + + memset(b, 0, 4); + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, b, CPLD_INFO_OFFSET, 4); + mutex_unlock(&data->update_lock); + + if(status != 4) return sprintf(buf, "read cpld info fail\n"); + + status = sprintf (buf, "The CPLD release date is %02d/%02d/%d.\n", b[2] & 0xf, (b[3] & 0x1f), 2014+(b[2] >> 4)); /* mm/dd/yyyy*/ + status = sprintf (buf, "%sThe PCB version is %X%X\n", buf, b[0]>>4, b[0]&0xf); + status = sprintf (buf, "%sThe CPLD version is %d.%d\n", buf, b[1]>>4, b[1]&0xf); + + return strlen(buf); +} + +static ssize_t show_reset(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[1]; + + mutex_lock(&data->update_lock); + + status = cpld_i2c_read(client, b, CPLD_RESET_OFFSET, 1); + + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld reset fail\n"); + + + status = sprintf (buf, "The CPLD 1 cpld_reset = %d\n", b[0]); + + return strlen(buf); +} + +static ssize_t set_reset(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + + u8 temp = simple_strtol(buf, NULL, 10); + + mutex_lock(&data->update_lock); + cpld_i2c_write(client, &temp, CPLD_RESET_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_ctl(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[1]; + + mutex_lock(&data->update_lock); + + status = cpld_i2c_read(client, b, CPLD_CTL_OFFSET, 1); + + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld ctl fail\n"); + + + status = sprintf (buf, "0x%X\n", b[0]); + + return strlen(buf); +} + +static ssize_t set_ctl(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + + u8 temp = simple_strtol(buf, NULL, 10); + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_CTL_OFFSET, 1); + if(temp) byte |= (1<<0); + else byte &= ~(1<<0); + cpld_i2c_write(client, &byte, CPLD_CTL_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + +static char* led_str[] = { + "OFF", //000 + "0.5 Hz", //001 + "1 Hz", //010 + "2 Hz", //011 + "NA", //100 + "NA", //101 + "NA", //110 + "ON", //111 +}; + +static ssize_t show_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 0)?3:0; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_LED_OFFSET, 1); + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld offset 0x%x\n", CPLD_LED_OFFSET); + + byte = (byte >> shift) & 0x7; + + /* + 0: off + 1: 0.5hz + 2: 1 hz + 3: 2 hz + 4~6: not define + 7: on + */ + + status = sprintf (buf, "%d: %s\n", byte, led_str[byte]); + + return strlen(buf); +} + +static ssize_t set_led(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + + u8 temp = simple_strtol(buf, NULL, 16); + u8 byte; + int shift = (attr->index == 0)?3:0; + + temp &= 0x7; + //validate temp value: 0,1,2,3,7, TBD + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_LED_OFFSET, 1); + byte &= ~(0x7<update_lock); + + return count; +} + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu0 | psu1 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 1)?0:3; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_PSU_OFFSET, 1); + mutex_unlock(&data->update_lock); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + + +static SENSOR_DEVICE_ATTR(info, S_IRUGO, show_info, 0, 0); +static SENSOR_DEVICE_ATTR(reset, S_IWUSR|S_IRUGO, show_reset, set_reset, 0); +static SENSOR_DEVICE_ATTR(ctl, S_IWUSR|S_IRUGO, show_ctl, set_ctl, 0); + +static SENSOR_DEVICE_ATTR(grn_led, S_IWUSR|S_IRUGO, show_led, set_led, 0); +static SENSOR_DEVICE_ATTR(red_led, S_IWUSR|S_IRUGO, show_led, set_led, 1); + +static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu, 0, 0); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu, 0, 1); + +static struct attribute *cpld_attributes[] = { + //info + &sensor_dev_attr_info.dev_attr.attr, + &sensor_dev_attr_reset.dev_attr.attr, + &sensor_dev_attr_ctl.dev_attr.attr, + + &sensor_dev_attr_grn_led.dev_attr.attr, + &sensor_dev_attr_red_led.dev_attr.attr, + + &sensor_dev_attr_psu0.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + + NULL +}; + +static const struct attribute_group cpld_group = { + .attrs = cpld_attributes, +}; + +/*-----------------------------------------------------------------------*/ + +/* device probe and removal */ + +static int +cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct cpld_data *data; + int status; + + printk("+%s\n", __func__); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + return -EIO; + + data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cpld_group); + if (status) + goto exit_free; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &cpld_group); +exit_free: + i2c_set_clientdata(client, NULL); + kfree(data); + return status; +} + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cpld_group); + i2c_set_clientdata(client, NULL); + kfree(data); + return 0; +} + +static const struct i2c_device_id cpld_ids[] = { + { "inv_cpld", 0, }, + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, cpld_ids); + +static struct i2c_driver cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "inv_cpld", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_ids, +}; + +/*-----------------------------------------------------------------------*/ + +/* module glue */ + +static int __init inv_cpld_init(void) +{ + return i2c_add_driver(&cpld_driver); +} + +static void __exit inv_cpld_exit(void) +{ + i2c_del_driver(&cpld_driver); +} + +MODULE_AUTHOR("eddie.lan "); +MODULE_DESCRIPTION("inv cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_cpld_init); +module_exit(inv_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_platform.c b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_platform.c new file mode 100644 index 000000000000..71dda75b252f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_platform.c @@ -0,0 +1,197 @@ +#include +//#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//#include +#define IO_EXPAND_BASE 64 +#define IO_EXPAND_NGPIO 16 + +struct inv_i2c_board_info { + int ch; + int size; + struct i2c_board_info *board_info; +}; + +#define bus_id(id) (id) +static struct pca954x_platform_mode mux_modes_0[] = { + {.adap_id = bus_id(2),}, {.adap_id = bus_id(3),}, + {.adap_id = bus_id(4),}, {.adap_id = bus_id(5),}, +}; +static struct pca954x_platform_mode mux_modes_0_0[] = { + {.adap_id = bus_id(6),}, {.adap_id = bus_id(7),}, + {.adap_id = bus_id(8),}, {.adap_id = bus_id(9),}, + {.adap_id = bus_id(10),}, {.adap_id = bus_id(11),}, + {.adap_id = bus_id(12),}, {.adap_id = bus_id(13),}, +}; + +static struct pca954x_platform_mode mux_modes_0_1[] = { + {.adap_id = bus_id(14),}, {.adap_id = bus_id(15),}, + {.adap_id = bus_id(16),}, {.adap_id = bus_id(17),}, + {.adap_id = bus_id(18),}, {.adap_id = bus_id(19),}, + {.adap_id = bus_id(20),}, {.adap_id = bus_id(21),}, +}; + +static struct pca954x_platform_mode mux_modes_0_2[] = { + {.adap_id = bus_id(22),}, {.adap_id = bus_id(23),}, + {.adap_id = bus_id(24),}, {.adap_id = bus_id(25),}, + {.adap_id = bus_id(26),}, {.adap_id = bus_id(27),}, + {.adap_id = bus_id(28),}, {.adap_id = bus_id(29),}, +}; + +static struct pca954x_platform_mode mux_modes_0_3[] = { + {.adap_id = bus_id(30),}, {.adap_id = bus_id(31),}, + {.adap_id = bus_id(32),}, {.adap_id = bus_id(33),}, + {.adap_id = bus_id(34),}, {.adap_id = bus_id(35),}, + {.adap_id = bus_id(36),}, {.adap_id = bus_id(37),}, +}; + +static struct pca954x_platform_data mux_data_0 = { + .modes = mux_modes_0, + .num_modes = 4, +}; +static struct pca954x_platform_data mux_data_0_0 = { + .modes = mux_modes_0_0, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_1 = { + .modes = mux_modes_0_1, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_2 = { + .modes = mux_modes_0_2, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_3 = { + .modes = mux_modes_0_3, + .num_modes = 8, +}; + +static struct i2c_board_info i2c_device_info0[] __initdata = { + {"inv_psoc", 0, 0x66, 0, 0, 0},//psoc + {"inv_cpld", 0, 0x55, 0, 0, 0},//cpld + {"pca9545", 0, 0x70, &mux_data_0, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info1[] __initdata = { + {"pca9545", 0, 0x70, &mux_data_0, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info2[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_0, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info3[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_1, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info4[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_2, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info5[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_3, 0, 0}, +}; + + +static struct inv_i2c_board_info i2cdev_list[] = { + {0, ARRAY_SIZE(i2c_device_info0), i2c_device_info0 }, //smbus 0 + {1, ARRAY_SIZE(i2c_device_info1), i2c_device_info1 }, //smbus 1 or gpio11+12 + + {bus_id(2), ARRAY_SIZE(i2c_device_info2), i2c_device_info2 }, //mux 0 + {bus_id(3), ARRAY_SIZE(i2c_device_info3), i2c_device_info3 }, //mux 1 + {bus_id(4), ARRAY_SIZE(i2c_device_info4), i2c_device_info4 }, //mux 2 + {bus_id(5), ARRAY_SIZE(i2c_device_info5), i2c_device_info5 }, //mux 3 +}; + +///////////////////////////////////////////////////////////////////////////////////////// +static struct i2c_gpio_platform_data i2c_gpio_platdata0 = { + .scl_pin = 8, + .sda_pin = 9, + + .udelay = 5, //5:100kHz + .sda_is_open_drain = 0, + .scl_is_open_drain = 0, + .scl_is_output_only = 0 +}; + +static struct i2c_gpio_platform_data i2c_gpio_platdata1 = { + .scl_pin = 12, + .sda_pin = 11, + + .udelay = 5, //5:100kHz + .sda_is_open_drain = 0, + .scl_is_open_drain = 0, + .scl_is_output_only = 0 +}; + +static struct platform_device device_i2c_gpio0 = { + .name = "i2c-gpio", + .id = 0, // adapter number + .dev.platform_data = &i2c_gpio_platdata0, +}; + +static struct platform_device device_i2c_gpio1 = { + .name = "i2c-gpio", + .id = 1, // adapter number + .dev.platform_data = &i2c_gpio_platdata1, +}; + +static int __init plat_redwood_x86_init(void) +{ + struct i2c_adapter *adap = NULL; + struct i2c_client *e = NULL; + int ret = 0; + int i,j; + + printk("el6661 plat_redwood_x86_init \n"); + +#if 0 //disable for ICOS + //use i2c-gpio + //register i2c gpio + //config gpio8,9 to gpio function + outl( inl(0x500) | (1<<8 | 1<<9), 0x500); + + ret = platform_device_register(&device_i2c_gpio0); + if (ret) { + printk(KERN_ERR "i2c-gpio: device_i2c_gpio0 register fail %d\n", ret); + } + + outl( inl(0x500) | (1<<11 | 1<<12), 0x500); + ret = platform_device_register(&device_i2c_gpio1); + if (ret) { + printk(KERN_ERR "i2c-gpio: device_i2c_gpio1 register fail %d\n", ret); + } +#endif + + for(i=0; i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//#include "I2CHostCommunication.h" + +#define USE_SMBUS 1 + +//#define offsetof(st, m) ((size_t)(&((st *)0)->m)) +#define FAN_NUM 5 +#define PSU_NUM 2 + +struct __attribute__ ((__packed__)) psoc_psu_layout { + u16 psu1_iin; + u16 psu2_iin; + u16 psu1_iout; + u16 psu2_iout; + + u16 psu1_pin; + u16 psu2_pin; + u16 psu1_pout; + u16 psu2_pout; + + u16 psu1_vin; + u16 psu2_vin; + u16 psu1_vout; + u16 psu2_vout; +}; + +struct __attribute__ ((__packed__)) psoc_layout { + u8 ctl; //offset: 0 + u16 switch_temp; //offset: 1 + u8 reserve1; //offset: 3 + + u8 fw_upgrade; //offset: 4 + + //i2c bridge + u8 i2c_st; //offset: 5 + u8 i2c_ctl; //offset: 6 + u8 i2c_addr; //offset: 7 + u8 i2c_data[0x20]; //offset: 8 + + //gpo + u8 led_grn; //offset: 28 + u8 led_red; //offset: 29 + + //pwm duty + u8 pwm[FAN_NUM]; //offset: 2a + u8 pwm_psu[PSU_NUM]; //offset: 2f + + //fan rpm + u16 fan[FAN_NUM*2]; //offset: 31 + //u16 fan_psu[PSU_NUM]; + + //gpi + u8 gpi_fan; //offset: 45 + + //psu state + u8 psu_state; //offset: 46 + + //temperature + u16 temp[5]; //offset: 47 + u16 temp_psu[PSU_NUM]; //offset: 51 + + //version + u8 version[2]; //offset: 55 + + u8 reserve2[3]; //offset: 57 + struct psoc_psu_layout psu_info; //offset: 5a +}; + + +/* definition */ +#define PSOC_OFF(m) offsetof(struct psoc_layout, m) +#define PSOC_PSU_OFF(m) offsetof(struct psoc_psu_layout, m) + +#define SWITCH_TMP_OFFSET PSOC_OFF(switch_temp) //0x01 +#define PWM_OFFSET PSOC_OFF(pwm) +#define PWM_PSU_OFFSET PSOC_OFF(pwm_psu) +#define THERMAL_OFFSET PSOC_OFF(temp) +#define RPM_OFFSET PSOC_OFF(fan) +//#define RPM_PSU_OFFSET PSOC_OFF(fan_psu) +#define DIAG_FLAG_OFFSET PSOC_OFF(ctl) +#define FAN_LED_OFFSET PSOC_OFF(led_grn) +#define FAN_GPI_OFFSET PSOC_OFF(gpi_fan) +#define PSOC_PSU_OFFSET PSOC_OFF(psu_state) +#define VERSION_OFFSET PSOC_OFF(version) +#define PSU_INFO_OFFSET PSOC_OFF(psu_info) + + +/* Each client has this additional data */ +struct psoc_data { + struct device *hwmon_dev; + struct mutex update_lock; + u32 diag; +}; + +/*-----------------------------------------------------------------------*/ + +static ssize_t psoc_i2c_read(struct i2c_client *client, u8 *buf, u8 offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg[0].buf = msgbuf; + msg[0].len = 1; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + status = i2c_transfer(client->adapter, msg, 2); + + if(status == 2) + status = count; + + return status; +#endif +} + +static ssize_t psoc_i2c_write(struct i2c_client *client, char *buf, unsigned offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + return status; +#endif +} + +static u32 psoc_read32(struct i2c_client *client, u8 offset) +{ + u32 value = 0; + u8 buf[4]; + + if( psoc_i2c_read(client, buf, offset, 4) == 4) + value = (buf[0]<<24 | buf[1]<<16 | buf[2]<<8 | buf[3]); + + return value; +} + +static u16 psoc_read16(struct i2c_client *client, u8 offset) +{ + u16 value = 0; + u8 buf[2]; + + if(psoc_i2c_read(client, buf, offset, 2) == 2) + value = (buf[0]<<8 | buf[1]<<0); + + return value; +} + +static u8 psoc_read8(struct i2c_client *client, u8 offset) +{ + u8 value = 0; + u8 buf = 0; + + if(psoc_i2c_read(client, &buf, offset, 1) == 1) + value = buf; + + return value; +} + +static int psoc_write_value(struct i2c_client *client, unsigned offset, u16 value) +{ + //TBD + return 0; +} + + +//PSOC i2c bridge regsters +#define PSOC_I2C_STATUS PSOC_OFF(i2c_st) +#define PSOC_I2C_CNTRL PSOC_OFF(i2c_ctl) +#define PSOC_I2C_ADDR PSOC_OFF(i2c_addr) +#define PSOC_I2C_DATA PSOC_OFF(i2c_data) + +//status bit definition +#define PSOC_I2C_START (1 << 0) +#define PSOC_PMB_SEL (1 << 7) + +//addr bits definition +#define PSOC_I2C_READ (1 << 0) + +//PMBUS registers definition +#define PMBUS_READ_VIN (0x88) +#define PMBUS_READ_IIN (0x89) +#define PMBUS_READ_VOUT (0x8B) +#define PMBUS_READ_IOUT (0x8C) +#define PMBUS_READ_POUT (0x96) +#define PMBUS_READ_PIN (0x97) + +#define PMBUS_MFR_ID (0x99) +#define PMBUS_MFR_MODEL (0x9A) +#define PMBUS_MFR_REVISION (0x9B) +#define PMBUS_MFR_DATE (0x9D) +#define PMBUS_MFR_SERIAL (0x9E) + +static int psoc_i2c_bridge_read(struct i2c_client *client, + unsigned char bus, + unsigned char chip, + char *addr, int alen, + unsigned char *data, int len ) +{ + unsigned char txdata[28], rxdata[28]; + int index, timeout; + + txdata[PSOC_I2C_STATUS] = 0; /* the status */ + txdata[PSOC_I2C_CNTRL] = ((alen & 3) << 5) | (len & 0x1f); /* the sizes */ + txdata[PSOC_I2C_ADDR] = (chip << 1) | PSOC_I2C_READ; /* read address */ + for(index = 0; index < alen; index++) + txdata[PSOC_I2C_DATA + index] = addr[index]; /* the chip address */ + for(; index < alen+len; index++) + txdata[PSOC_I2C_DATA + index] = 0; /* clear the chip data */ + + psoc_i2c_write(client, &txdata[PSOC_I2C_CNTRL], PSOC_I2C_CNTRL, 2 + alen + len); + + //delay a while ??? + //--------------------------------------------------------------------- + //start write + txdata[PSOC_I2C_STATUS] = PSOC_I2C_START; /* the start bit*/ + if(bus) + txdata[PSOC_I2C_STATUS] |= PSOC_PMB_SEL;/* bus id */ + psoc_i2c_write(client, &txdata[PSOC_I2C_STATUS], PSOC_I2C_STATUS, 1); + + //delay a while + timeout = 40; //40*20==>800 ms + do { + psoc_i2c_read(client, &rxdata[PSOC_I2C_STATUS], PSOC_I2C_STATUS, 1); + + //check rxdata[5] error bit(1) and complete bit(0) ,TBD + if((rxdata[PSOC_I2C_STATUS] & 0x2) == 0x2) { + //printk("i2c bridge fail!!!\n"); + timeout = 0; + break; + } + if((rxdata[PSOC_I2C_STATUS] & PSOC_I2C_START) == 0) { + /* comand complete */ + psoc_i2c_read(client, &rxdata[PSOC_I2C_DATA+alen], PSOC_I2C_DATA+alen, len); + break; + } + + //delay + msleep(20); + } while(timeout--); + + if(timeout <= 0) { + return -1; + } + + //--------------------------------------------------------------------- + + for(index=0; index < len; index++) { + data[index] = rxdata[PSOC_I2C_DATA + alen + index]; + } + + return 0; +} + + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu1 | psu0 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu_st(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 0)?3:0; + + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client, &byte, PSOC_PSU_OFFSET, 1); + mutex_unlock(&data->update_lock); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + +/*-----------------------------------------------------------------------*/ + +/* sysfs attributes for hwmon */ + +static ssize_t show_thermal(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index * 2 + THERMAL_OFFSET; + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, offset); + status = __swab16(status); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + (s8)(status>>8) * 1000 ); +} + + +static ssize_t show_pwm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + status); +} + +static ssize_t set_pwm(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index; + + u8 pwm = simple_strtol(buf, NULL, 10); + if(pwm > 255) pwm = 255; + + if(data->diag) { + mutex_lock(&data->update_lock); + psoc_i2c_write(client, &pwm, offset, 1); + mutex_unlock(&data->update_lock); + } + + return count; +} + + +static ssize_t show_rpm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, offset); + status = __swab16(status); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + status); +} +static ssize_t show_fan_type(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 index = attr->index; + int type = -1; + + mutex_lock(&data->update_lock); + status = psoc_read8(client, FAN_GPI_OFFSET); + mutex_unlock(&data->update_lock); + + if( (status & 1<update_lock); + status = psoc_i2c_read(client, (u8*)&temp, SWITCH_TMP_OFFSET, 2); + status = __swab16(status); + mutex_unlock(&data->update_lock); + + status = sprintf (buf, "%d\n", (s8)(temp>>8) * 1000 ); + + return strlen(buf); +} + +static ssize_t set_switch_tmp(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + + long temp = simple_strtol(buf, NULL, 10); + u16 temp2 = ( (temp/1000) <<8 ) & 0xFF00 ; + + //printk("set_switch_tmp temp=%d, temp2=0x%x (%x,%x)\n", temp, temp2, ( ( (temp/1000) <<8 ) & 0xFF00 ), (( (temp%1000) / 10 ) & 0xFF)); + + mutex_lock(&data->update_lock); + psoc_i2c_write(client, (u8*)&temp2, SWITCH_TMP_OFFSET, 2); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_diag(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 diag_flag = 0; + + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client, (u8*)&diag_flag, DIAG_FLAG_OFFSET, 1); + mutex_unlock(&data->update_lock); + + data->diag = (diag_flag & 0x80)?1:0; + status = sprintf (buf, "%d\n", data->diag); + + return strlen(buf); +} + +static ssize_t set_diag(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 value = 0; + u8 diag = simple_strtol(buf, NULL, 10); + + diag = diag?1:0; + data->diag = diag; + + mutex_lock(&data->update_lock); + psoc_i2c_read(client, (u8*)&value, DIAG_FLAG_OFFSET, 1); + if(diag) value |= (1<<7); + else value &= ~(1<<7); + psoc_i2c_write(client, (u8*)&value, DIAG_FLAG_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, VERSION_OFFSET); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "ver: %x.%x\n", (status & 0xFF00)>>8, (status & 0xFF) ); +} + + +static ssize_t show_fan_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 bit = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, FAN_LED_OFFSET); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + (status & (1<index; + u8 led_state = 0; + + u8 v = simple_strtol(buf, NULL, 10); + + if(data->diag) { + mutex_lock(&data->update_lock); + led_state = psoc_read8(client, FAN_LED_OFFSET); + if(v) led_state |= (1<update_lock); + } + + return count; +} + +static ssize_t show_value8(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "0x%02X\n", status ); +} + +static long pmbus_reg2data_linear(int data, int linear16) +{ + s16 exponent; + s32 mantissa; + long val; + + if (linear16) { /* LINEAR16 */ + exponent = -9; + mantissa = (u16) data; + } else { /* LINEAR11 */ + exponent = ((s16)data) >> 11; + exponent = ((s16)( data & 0xF800) ) >> 11; + mantissa = ((s32)((data & 0x7ff) << 5)) >> 5; + } + + //printk("data=%d, m=%d, e=%d\n", data, exponent, mantissa); + val = mantissa; + + /* scale result to micro-units for power sensors */ + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val; +} + +static ssize_t show_psu(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 reg = attr->index & 0xFF; + u8 len = ((attr->index & 0xFF00) >> 8); + u8 chip = (attr->index >> 16)? 0x59:0x58; + u8 bus = 1; + unsigned char value[2] = {0,0};; + + if (len == 2) + { + mutex_lock(&data->update_lock); + psoc_i2c_bridge_read(client, bus, chip, ®, 1, value, 2); + mutex_unlock(&data->update_lock); + + status = value[1]<<8 | value[0]; + //status1 = value[1]<<8 | value[0]; + + return sprintf(buf, "%ld\n", pmbus_reg2data_linear(status, (reg==PMBUS_READ_VOUT)?1:0) ); + } + else + { //len is not defined. + u8 tmpbuf[32]; + mutex_lock(&data->update_lock); + //length of block read + psoc_i2c_bridge_read(client, bus, chip, ®, 1, &len, 1); + //data included length + psoc_i2c_bridge_read(client, bus, chip, ®, 1, tmpbuf, len+1); + mutex_unlock(&data->update_lock); + + memcpy(buf, tmpbuf+1, len); + buf[len]='\n'; + + return len+1; + } +} + +static ssize_t show_psu_psoc(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index + PSU_INFO_OFFSET; + + mutex_lock(&data->update_lock); + status = psoc_read16(client, offset); + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%ld \n", pmbus_reg2data_linear(status, strstr(attr->dev_attr.attr.name, "vout")? 1:0 )); +} + + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_thermal, 0, 0); +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_thermal, 0, 1); +static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_thermal, 0, 2); +static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_thermal, 0, 3); +static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_thermal, 0, 4); +static SENSOR_DEVICE_ATTR(thermal_psu1, S_IRUGO, show_thermal, 0, 5); +static SENSOR_DEVICE_ATTR(thermal_psu2, S_IRUGO, show_thermal, 0, 6); + +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+0); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+1); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+2); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+3); +#if (FAN_NUM >= 5) +static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+4); +#endif +static SENSOR_DEVICE_ATTR(pwm_psu1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_PSU_OFFSET+0); +static SENSOR_DEVICE_ATTR(pwm_psu2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_PSU_OFFSET+1); + +static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu_st, 0, 0); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu_st, 0, 1); + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_rpm, 0, 0*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_rpm, 0, 1*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_rpm, 0, 2*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_rpm, 0, 3*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_rpm, 0, 4*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_rpm, 0, 5*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_rpm, 0, 6*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_rpm, 0, 7*2 + RPM_OFFSET); +#if (FAN_NUM >= 5) +static SENSOR_DEVICE_ATTR(fan9_input, S_IRUGO, show_rpm, 0, 8*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan10_input, S_IRUGO, show_rpm, 0, 9*2 + RPM_OFFSET); +#endif +static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9*2 + RPM_OFFSET); + +static SENSOR_DEVICE_ATTR(switch_tmp, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); + +static SENSOR_DEVICE_ATTR(diag, S_IWUSR|S_IRUGO, show_diag, set_diag, 0); +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, 0, 0); + +static SENSOR_DEVICE_ATTR(fan_led_grn1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 0); +static SENSOR_DEVICE_ATTR(fan_led_grn2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 1); +static SENSOR_DEVICE_ATTR(fan_led_grn3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 2); +static SENSOR_DEVICE_ATTR(fan_led_grn4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 3); +static SENSOR_DEVICE_ATTR(fan_led_red1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 4); +static SENSOR_DEVICE_ATTR(fan_led_red2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 5); +static SENSOR_DEVICE_ATTR(fan_led_red3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 6); +static SENSOR_DEVICE_ATTR(fan_led_red4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 7); + +static SENSOR_DEVICE_ATTR(fan_gpi, S_IRUGO, show_value8, 0, FAN_GPI_OFFSET); +static SENSOR_DEVICE_ATTR(fan1_type, S_IRUGO, show_fan_type, 0, 0); +static SENSOR_DEVICE_ATTR(fan2_type, S_IRUGO, show_fan_type, 0, 1); +static SENSOR_DEVICE_ATTR(fan3_type, S_IRUGO, show_fan_type, 0, 2); +static SENSOR_DEVICE_ATTR(fan4_type, S_IRUGO, show_fan_type, 0, 3); + +static SENSOR_DEVICE_ATTR(psu1_vin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_VIN); +static SENSOR_DEVICE_ATTR(psu1_vout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_VOUT); +static SENSOR_DEVICE_ATTR(psu1_iin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_IIN); +static SENSOR_DEVICE_ATTR(psu1_iout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_IOUT); +static SENSOR_DEVICE_ATTR(psu1_pin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_PIN); +static SENSOR_DEVICE_ATTR(psu1_pout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_POUT); + +static SENSOR_DEVICE_ATTR(psu1_vendor, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_ID); +static SENSOR_DEVICE_ATTR(psu1_model, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu1_version, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu1_date, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_DATE); +static SENSOR_DEVICE_ATTR(psu1_sn, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_SERIAL); + +static SENSOR_DEVICE_ATTR(psu2_vin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_VIN); +static SENSOR_DEVICE_ATTR(psu2_vout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_VOUT); +static SENSOR_DEVICE_ATTR(psu2_iin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_IIN); +static SENSOR_DEVICE_ATTR(psu2_iout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_IOUT); +static SENSOR_DEVICE_ATTR(psu2_pin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_PIN); +static SENSOR_DEVICE_ATTR(psu2_pout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_POUT); + +static SENSOR_DEVICE_ATTR(psu2_vendor, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_ID); +static SENSOR_DEVICE_ATTR(psu2_model, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu2_version, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu2_date, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_DATE); +static SENSOR_DEVICE_ATTR(psu2_sn, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_SERIAL); + +static SENSOR_DEVICE_ATTR(psoc_psu1_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pout)); + + +static SENSOR_DEVICE_ATTR(psoc_psu2_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); + +static struct attribute *psoc_attributes[] = { + //thermal + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp4_input.dev_attr.attr, + &sensor_dev_attr_temp5_input.dev_attr.attr, + + &sensor_dev_attr_thermal_psu1.dev_attr.attr, + &sensor_dev_attr_thermal_psu2.dev_attr.attr, + + + //pwm + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, +#if (FAN_NUM >= 5) + //&sensor_dev_attr_pwm5.dev_attr.attr, +#endif + &sensor_dev_attr_pwm_psu1.dev_attr.attr, + &sensor_dev_attr_pwm_psu2.dev_attr.attr, + + //rpm + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan6_input.dev_attr.attr, + &sensor_dev_attr_fan7_input.dev_attr.attr, + &sensor_dev_attr_fan8_input.dev_attr.attr, +#if (FAN_NUM >= 5) + //&sensor_dev_attr_fan9_input.dev_attr.attr, + //&sensor_dev_attr_fan10_input.dev_attr.attr, +#endif + + &sensor_dev_attr_rpm_psu1.dev_attr.attr, + &sensor_dev_attr_rpm_psu2.dev_attr.attr, + + //switch temperature + &sensor_dev_attr_switch_tmp.dev_attr.attr, + + //diag flag + &sensor_dev_attr_diag.dev_attr.attr, + + //version + &sensor_dev_attr_version.dev_attr.attr, + + //fan led + &sensor_dev_attr_fan_led_grn1.dev_attr.attr, + &sensor_dev_attr_fan_led_grn2.dev_attr.attr, + &sensor_dev_attr_fan_led_grn3.dev_attr.attr, + &sensor_dev_attr_fan_led_grn4.dev_attr.attr, + &sensor_dev_attr_fan_led_red1.dev_attr.attr, + &sensor_dev_attr_fan_led_red2.dev_attr.attr, + &sensor_dev_attr_fan_led_red3.dev_attr.attr, + &sensor_dev_attr_fan_led_red4.dev_attr.attr, + + //fan GPI + &sensor_dev_attr_fan_gpi.dev_attr.attr, + + //fan type + &sensor_dev_attr_fan1_type.dev_attr.attr, + &sensor_dev_attr_fan2_type.dev_attr.attr, + &sensor_dev_attr_fan3_type.dev_attr.attr, + &sensor_dev_attr_fan4_type.dev_attr.attr, + + //psu + &sensor_dev_attr_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psu2_pout.dev_attr.attr, + + &sensor_dev_attr_psu1_vendor.dev_attr.attr, + &sensor_dev_attr_psu1_model.dev_attr.attr, + &sensor_dev_attr_psu1_version.dev_attr.attr, + &sensor_dev_attr_psu1_date.dev_attr.attr, + &sensor_dev_attr_psu1_sn.dev_attr.attr, + &sensor_dev_attr_psu2_vendor.dev_attr.attr, + &sensor_dev_attr_psu2_model.dev_attr.attr, + &sensor_dev_attr_psu2_version.dev_attr.attr, + &sensor_dev_attr_psu2_date.dev_attr.attr, + &sensor_dev_attr_psu2_sn.dev_attr.attr, + + &sensor_dev_attr_psu0.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + + //psu_psoc, new added on psoc 1.9 + &sensor_dev_attr_psoc_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pout.dev_attr.attr, + + NULL +}; + +static const struct attribute_group psoc_group = { + .attrs = psoc_attributes, +}; + +/*-----------------------------------------------------------------------*/ + +/* device probe and removal */ + +static int +psoc_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct psoc_data *data; + int status; + + printk("+%s\n", __func__); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + return -EIO; + + data = kzalloc(sizeof(struct psoc_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->diag = 0; + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &psoc_group); + if (status) + goto exit_free; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &psoc_group); +exit_free: + i2c_set_clientdata(client, NULL); + kfree(data); + return status; +} + +static int psoc_remove(struct i2c_client *client) +{ + struct psoc_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &psoc_group); + i2c_set_clientdata(client, NULL); + kfree(data); + return 0; +} + +static const struct i2c_device_id psoc_ids[] = { + { "inv_psoc", 0, }, + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, psoc_ids); + +static struct i2c_driver psoc_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "inv_psoc", + }, + .probe = psoc_probe, + .remove = psoc_remove, + .id_table = psoc_ids, +}; + +/*-----------------------------------------------------------------------*/ + +/* module glue */ + +static int __init inv_psoc_init(void) +{ + return i2c_add_driver(&psoc_driver); +} + +static void __exit inv_psoc_exit(void) +{ + i2c_del_driver(&psoc_driver); +} + +MODULE_AUTHOR("eddie.lan "); +MODULE_DESCRIPTION("inv psoc driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_psoc_init); +module_exit(inv_psoc_exit); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/onie-syseeprom b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/onie-syseeprom new file mode 100755 index 0000000000000000000000000000000000000000..b8e3ba26a5d24bc70f970c24364a61cbfa0abf10 GIT binary patch literal 921685 zcmdqKd3==B_4q%N1%}NhDrl@*)F6o>5Je>lnt_QtBNN2}E)^6DQmpt9Wd=|L24@EH z_;fT@skBvV7q{A0TT4KcWD+0&RAg~MQCSpu9)=}~hJeES-se6ulR%g6=llKh$4m3v z_1tsMIrrRi&s}D2W#F0|w>#IB{+Hvr%H<~fx05SWiu2dy^3-)#arsl>8szH4-?Lq3 zsIvLl94FU_R;bVI3!QqIugg`W(xr_~{QugsPX24pPEqNZ@3u2l)U|Yk^Uc)DBP##b z2mtl1IOgk9F_$azm9p}$GyhBYKebmxp8UJn`M3(w-y3!YCkmeb+kcsQKc?P)Yj0#4 z|I9ZXRX7R^i4VVSjA}NAzk)*{{|n5X{4WfXe9zh$i+0bb`p4m0&gmAaoSZjz&yq{Y za*cn^p=WQ2$iK(D>T~mP=_4oVDt+Yf>5n_*_2bgV?{U&Aj!UoE>ZA`kF5R`kNgr^0 z`ln8M$#Lo9cRJ}s$EAl~chU=wORq>e>3U?3M>q4&e5S8Uk0pZn)_F(jQ+i~jXNBrs z_D`z!xfGc!aa;bRdjIIS_({jbyB-(MIWB(q>0{x2b6kA)aq%6;#XmVFKF0XQI1<^B zTR-$|ziU+47Jc5HMS|wqWdRbjCs*iN<>9i8WeGig#xuEYm&+Peo9imKLKo=94x_1_ z6qmJYajq+t2%T#BiVJ(YT3oInt|FH!)LAbdTU-*%{Wf_-pSM!L-a2kY>OJkzw+L25 zTeaxx1iYi`D)@{sJ{U#gB6zy7%ldL(t}D`(W312~jgY%chG*TDO@5cL-+CMj;?q)k z{GnoxvD-Rre{MSekduEO`DLy3r@rrZl_jh{f}Gb_smK3W>_W1aiAeisAxXMEVY43F zGUrE`Ox^ed_+`}BC#=`YKMAh!PxxV}$i9|O7X-Om$9c!D82N_l)N5VKl7dvtDc8E{ z*Yn33SqAQAkL}5>u7H`pn@?rg#z#6u6TwS$t!{m5-VL76NrP_>p5Tk??|Z|Ca;E1E zz9Q7!Yv$GHspjh8spO9a_Ya-oO*MKWhjT-nea6Pp!^v(%Xx_>J%N$eL8ZcuzNWdT;XH z=pEx7Jqmd*)arip&EEpXX8quXK>UtWd_*dIXtuWC&rl%{e~>1>@f)py(oX`$=K-T? zwH_aOmLA#GqL;1=#HSQ%{>aXj0Ob96n;ZI6t%kG#%DdkSlv~rs>#5a`6r|n`#IH$J z-HPWtM$~n%4*Lw@$TnW#@5WWy;|Mb(JeFc!{5&housN#hAQ6b zf*CEz!swP@zCYER%%|M#bfqczTis|$<^~Mp_|DC@ddGUld2jRHK5oSr)k(jRsxNkr zaCvX^8y`CTH4f0_$<|-?cXHMDqlbQDm2NayeOo%Y0>-}jz9b=4))~aBVta#k=xiU;4m-X>0om_gPEoH_fIpmqtTv^l4mCSGQ<=42<)m}5!Wy`;u zF0V?y*4HWdnk!KHJ>vPM3^;w>VVN+dpQ#%k>Bd3?RV&<`vr4zZFXNj)JXGU18uiG! z6he|(TUEY8d-zurg~nau53H{Ur@G9zN^fp{33MWMXMMt&iMn|;{{_sk?^Wo=*8yYe zH-A&Y<4pxh8{wEAvIJir{z&)SYpT2FB=-s>yH`}d7uj_LaD9WG>T6SaYHhM6e5hZQ z(E^Mrt+F{_G%GlIYK>mHR{ll~rL^c|+Vws%*i%tGxNFjmZqbePq0{L^nnKowiS*P| zyb(!g`@fWgKkPkL63*RstR$R7{Qn>c@4ftgCkekxm;b+&gc;lZUnHSy-2X`u&i?HG zACl1g)Bh?7s8H`42-93MM~^h-p;XO_&DT4H((KB z>yKN6_D2Kd+oq4vBUYZz^eAolgU`6`htLp7ALKKpw=o*W0rZ--jC$-TrOg6Ae<|cO z3TEufD9BYxL5@=j@`eAZAY~Tt8{c_H`;8xzrmQO6Im*#RObog)X0`S3?(Fzz5>1(t zl=0E3G^J6w()xyc|GXojxQxogbd9M1rS;BdVmf5Bl|Md)DPspy#`^(gceK^6mSj(v zG@krPS~#1v=wnJh?G6}U1&oyS$S33&4SI7z6pwC>S&iBmphtG+=@B~*a? zT^ZNcdxeW9>t-i!B#~P+Au-hSB`S=ZnBCjkNXC zDk~EPvamZZ`AT$4s29!ZM&)X2?s$=-%GIJywjHNVw6nvYNp}7n8yy?*#QGUGj&Qwk zf}|Qv2VMxdSLjBweFZ=!_0!IdN^zI>rZC{u(z@-6^Q$ay9bQz%X(57w))`7 zYkw9S4b5v~S4FHqq^-}4&Z**6i8qwtwSfj|tXof`H<4y{ayg`U_G3t4U?on<^j8;~ zF+9i>+@i-v7Z>R9U~!Qcc7@i(COw;AMUK#bp9bn(%cr=kv8T91UScnUnQlI`rwH4$ z)tWzFsIbatSSlS&p3+WFJ(4KUhZMZ!cLh(?Y75HOhW6^_&7St;kX@nGe&+x`TXVSv zyS3;XsG^&KPHbcFd}e#q^gMF01gDKf{$O5a`)5_jnTm3m}_#~OGWqEwy??bpqJDrQd9FBzz~>oc}#u^b410V?bl z1JtozRyZyBRZF4YsF*^-YC08M<{y>eFyw;G&^-QR@oV5vH}@|i#3pWy11^(xSBIX& zKhI4Q`T(mwA#{ZdDr{$|u3D%p`_ekU8}R$8;WlLLNB;`{R~_L$*a7}Uz&{3>^;TIx^1;t?xu66Np3m0m9bRld~am0TYKzOFm-sa z>SU)ECsDvjdBWqu{QokxSBvIm6W2LH5ldz(PNA5+LwcNHNBmz9Yx|U@>nLNbV`6WY zZ5ij@(Pq95ImW~iqk<<#+T6j@SvG0WUa(6oRjg~j%XOLg#gs{IGcPUTTQBP`>!jJF zUs@pXM&cNNR_Y_8>9c$e+MRwCaX7BGV-eQa)NLGG|!2anXTi`?@N^JEan_dpn&x~G^isSMpGIs+8^{- z%4nL?X9y0R@QmR~UrO@49h50Bnu1;F86Asl2@TcVN9G-ss@nXsz;h{72y1@`?{o(T zHs?R}eqR@fDLa=xb#Of_U>fZ1Y8GWdwq4uw1-60yYh5sHPX0Z%Q8PY7bdrq?)(J+_ zysuI$M1y58pzE9qVZc&Gjw^Wr6g_j^Az9i62d9ai0Ke@ms4EZ)ZS}=(bK4OBnU|jX z0o;~uTRms7Dqcz@>9lcF^wq%+&-pyLs%)>{*l-&weVt{)$kG1h zM9shom)_jqQlI9c9u+R@4K)0>8GXL=skf%M#^@K-@L|z&0?VrzIpbC=r6J`g`F32r zWTm#H>xYNmas5y*EdZhEa|ZVg&KZ2Z7W)IK3Zdjbpkoup zUHsJ)X}WPFS)QHGC{dMDmZ&ney-`M69b2J&J+jJe*&pV*0_Et%VRTEY9pyHx(#_?K zb60lkNJgFppL2g-DWk`yhtkd8Rz+#bEY|gV|@v%hP=LU*L5^ z2Cr9SH2izKY9MK6V8I}8EI1coTM9v-$1#!>hBir8y_Bcp+bAAN&96(S)yXl zx=^R^gC2LVs|-cQ-qn^|+htNigGXEP^}M6sp=9TNp)Fa11=uw|eD%@LhvB*IywG|m z)3viWxnynSHX0f%&&Ah5k~Np)#fw(ZQ295Zom%ZpIl`HP>l?NgH0&tsvX)rB`kU9V z-P2`l`Fici#0s$eulS~M>?Al=xU?lh!7l-RtLGh3`0XN?!7o^($M5T;JDAUSSCYF$ z5}l;NBx7iorp`y3hP(6HVI=5Cj?h8-99(ZSRu9i_*j-qCQ;y891=Tm@%GXnU zQy$2LAv20@uEF4f{P8Ujuy-mkf?M^!YHf(`Y-meua08Vvn=1c9mAa5yUs4CidjVNLQbKnUI;Lq~ zd~!E$~ZhkzB-QJWLF=Dv~ADLd5yv?DtXjD4sGp^TJxGeZV##5y` zJ~lVUTmIQxJeIqxp$xKRPgah=#$WnNKDy>xFLbDz28xc(OxyeR&o`D^rUyRqIYHrNDqt854;fURlf{uFa(v7Xw zbD+%vq?xr_E#tq=%hV&7FMU?l(8j8n7ivpJb|bkAwF48Y|M4=u%|K1vg2LNUS)|ou@ppC(cUO)xYOVYt@<&N#S)hm zt?;{o$IL0<=RybQ#y*gqrOM8^N%dUOf^=lq33-Sqf~Ztz4DF z(h+!QCrY5ya@6OrF4pZ(aak6D^&n8=IHEp)buw|{q@TB^h!V%lnuR2kB_c;l=Z=aT z?W4tCMR+4eF=#F)Lwoco745A>rEig=m^RBWtVN2&(RAf>wy(r`&=x$w3a6Th+@Yga zSzyVbk)!>!#{$%d9KBGBi}{zS>QYsyYcy&Lrczl{wXgU@?^`l@s#$e<)i~0YR3Y;+ z=dJO_ecf|(rAM^|nu#)uYeB3CFAvC{KPWfy!W9wuabCIv{n z?zZ&!%p70!RCjfum3yvGwGyiCms;1vg9CDuyiW2Np)OY5A!mWY#Q$`$5R8fc4CQao zVpoAWlfTe4EAz}VTC}HR7#~@Eo^rFnhIxPD8#j&_Ge(R37IGLZ2W_LJq3!I_#(3V3 zjc-aDMKfROiX3J+dMU^ojgcK&BfGuf!};3$(EyK+TpvE%MVqe^*6LOp-zeQ#H@QK% zk8;*wCgNz>T%TQvTl>&37^}J%0)o)5X;%>X)vxfLMA}Z4T?~jHD<+-gW|gZlx+Yj& z*};DCM%oIr1-OgY18hhYzZ-63mlHk02)iOw;m4F3uGI$erDAB4->h_b>sZ>;2y#Hw zqr6vMv$BAMBKu-Q-x+VzFA63EU%dmqS2_4D5`!|m9ta=mA6%6DFk}DVu5G}<9BJz^ z{oy1sdye*tzK}y)U!_gjBlNSBqM`m}3W0@^j(>^~tb zGXLw5qbF*yDKr|0PZZJEUxkQtN?wTm6JhZz!w2iKZkR?pCKJB5Ip$MBU0b>ewc65R?uhmsTwEbvB;cGNeX?ztrEjcSq|3LhDcfbfxx^6gu z_XZaQ_YCe5vzs8zPnI{*H(QkZeAqS#PT3tC-gp^bmu z527wY3mK@f2I=}+68F~0U%P-gyK2Ihwuf*1A|b?Yq9mUO-bQ1H#+HOkj|K>d#Qt1zDSlW)D^p$@R)az29$vTHsB~Dbg^%yc&JuKxb-y32Y-euLZd|~b?@fj@{MdrPIMg7IJ z2YbY}=mB=gPqiiAC6_wm*zEO_=Ws42aQx;SV7~K?E^A#TbGP>`v6hv=U|mjCF}SqY zUUJe#4SU|Zuxm~bn?Z~Ii45s4=K=oya9`K5!Nk=BQa=cdV=WE~;#;kEzflT4y7OP) zoUbgwqT?+=?a@yt+F`x5bo7+z{{NYDud8X8hm9oqor}6Nm_5%qkV-Y@pE?VN2LEm~ ztmb_2tuaPia)!a_Z#(?;^A3wSuRZ3ccY1tQw>s%I1I>>jp|6hqI;OK)>`cn44#!R= z)DFy98fcFel4`dBAfxY~$M5GskE?*~(4$QT#q)C+6yH-$h_du+hbTo-*~gy_>oxCa zFWwZH`#Gx;*;5p2o!dY8^LBb@wPTp}4v0{!KqzoGbVVpc82*uq&PQs7AYDoTmAon8 zv&5XnW7Mcb!)gmFu_6)18B6oYP^~3*sO4#g_S*S7T=?5rm^-|S?Sn=lU!&@0 z0^m(qjawB!sgDc1%Lt|UTRW;vH@jiMze0x684Q&I>rYLr`R9EnP#C6cAt_b-M|4Os3I8TPKm^AnkP=@$t(1^ z1gP7ab6v^5S!>sH^nrVCWHqDCY@k4tT9GYE8K!U3lY(ZiI3rxmUZBI&W)Xh;bB{X< zChgJ1k}4*b(Oj2L?`Y=FPfMm&{jg+#wC5m79a}0YWhIXSrh@RZgv$~>lzJ|$Fn#+}D>Dm>ySw|0yCGV@IL~KHD}X2k8C?Z!M12(~XHPcK z;j1Gp8yHSMo`WmWf=1N zE?cO3w$MMELSM|L(B?H1s>&AHH7nCx+$mHig{q}cJEX>Jp~+66UrV7u$3l80TWA=C z=)bH}%(>mIiBIIZnum2~U~#a9ku2nF9wv5-3+ZhiFH*klj+5v#a!keJ#n^iLH^`z0 zt2v8x&W?;syK#jfd5!>!e8WhW^(=)M$mc54=U532$+ECrejR>%YV`%Vj{YSUDhQ?^ zB$)jtq%NZ!a~K{xW{%&`ux#PPJ|-}U?a$x{P?bH8uO{L5s;HjAXft+J=M`JmGlg>q zsWSE@%fAQu9E+e9I}8AYq^SF}{ucjww)eaLd+(payq2xGmw=-vkbI^FRM22)x+z>T z3PA{_Lpcv$2)Wa`LsbXAnO8V!U_A-;^>9$++U)UbW~OEA9i-=h@kpoj%mZmfX!m!@ zS-%Aydf}hdN-x|=9nlMV2feUn1$yC`bpI3|>~EM!oN;3Pc9k$ByT7jV+wnqS4tGfZ zBFHGx*AhSrHZ|<v%B!dj3JZ29X;CCBOJt}ZqG|nXkF0wT`nkPP^k2H4pjA;luo$603A?RIR?5j|9lCm{ zdpun$XJ+U+9lBccS3(pue|c|ITOCzKlN|7P*E_n(cn9q{Zx5RpvWub{?8O_b>vicl zN)R1u_PA_gJ%_+zYw)KU`F^%c^a&gfkPa5;=99$o{!zK%T< zX=d|%ZksFgoi$)JLoqU>?F}pxEove_X0IQNzAjnW4JWpAv%7*d&gz^B*R+brkmoj~ zQoVKaqR07av9%ODH)pqidkfeTdu-9u{k-UH|oTb9A@&SHO;HSJER-YfbC zz~T2OU?J7r>c=jM93)AXI%ri<%FO>AZOTA;8HjR3jPobGMs%#`O?@CMz9Q?ho1A^* zF_ctN>O!DI&L*o^8`PKBR1wG`5XB{NC8=;DHkMYV8yh%Z*|5Dx@6w=`eQmE0d(O-+rJ@e;0cYfQr#)>+{zZ~z z0#Y=PYBKxae8mM-ZL~-y4lfWyopy zk;9#XT~XqFQv5l;tMH_V#=GB33&pg+y6OhjHrA~7>QgPL9zj0ZlZ|DG=teEJN%B+H zYt<}THcNlz&!ORSfNNKg#g_K`&3r}9>@@`1)d~LJJ)SavJM->UraBQ5EK4USd&??G zr;f^`!bSGq)2T)10nZAKFC`e66C;DVgc<>s;{u`EH!`aK*)eO=&2?go)C&Z=g6xi& z&pCPU)nye+)yG)Bqz~{irsbfP*~6?A`Ck*f5#lV7aJ=U#D!ACz>7b2R+g-h=gfKXOzf;NBmI2Ro%k#PhDw54QS^rhxV;M}H4mfB9vu>)Lprghi*NH|LlC zy)PF+z~8O^pnmXxuD!ZKFKyO2J8XRAH^LQpR55nz zvamCJ7Jqfw3gD2!LNXe_u!D3kYEDc;6A6TY0U*nnj#T05@rW?}>wES2i zVCEGEPp`jOq;VdmPYvyHR5VbUqOIgF@%P8J_>DyaXs^mxTB1JB74q>LFBQqBIjr*$ z7SNju*(I)Uf+IP|n@%0`&%UmrRa3w)|1t^$C#Jh5{W5#ax`#eD=j#+w<)x?b(FIpC zT3oo7P;4{l16Un>ke|D5GPfdAovJD)o}jRPQuF+Q#B&n5{zw0H1ZQuWaX?j*s}9& zom8ur0``3jKk?tzt!GEwKX0FWm~hHg=m!V3=9vbzg?C~`yGeKGz^(Sexm`LezGc2mk6S$#Rm{H??NvL@ubk$SgM7@de&c<$d<_^Y#2RF# z33fr}2{BXa17@!k55Z)k^;(zr%{WpBI(Tma#>alGauZupn`NFD;0<5lsx)kwxI6)7 zXJ)Z8irI4y7#qcRuld-aM1RUuQOJ^J#?REOQvC#t=;r9+0nRxv)RyI}4~F!(zpu;M zHbt`YZ7`@TTT_-&*9uZ^oJ%e7kh_egT!0?@{G2A5EW&|rT~#A9cpIvGMeqW=(P-RY z@c^6$c}A{v;=7{bx9SUqG(U+*#!|t~=H=FfQiaKKfaS#UCL48+OLrJlw>wPWP()=EebqZNkhUGK1D=qLj=Vz>kMN!vy zjSaYe>CHy_@g9t4IgcSg($=`g%#|}!<=Uga1q8NV@Wx16t`_?%G2NVnGTCRXK`+xu z_i2fP>m!LA9PZ}W6;8!abEeRrC{(sa?1m>BM4{`lUm`m)nf;hFu!kt;GbiM6oxmIU zK?~l_-xET2sj9&ypux(0){R+c3mcNJ$-KiVYJjo|Ac0FyD zt&t{anN~C72aMDfjux8)%;dA_7QB%?xmF7lqWP{Is+mzgG*!HFGlVT$<1b%DC+y1< z4ib5y!IpDZPR_3y>@%{Fry6W68~J5}okIlgpTR+qPx zw}s`;CAvA=WgS|p;-~5+%V~3Vfn_-fop9e@I1DH&J?tc9=w{9ylzgjw(CX&&LCN2@ z$B`Azmvy)YGjC6|$cC|eJbg9i!sx{#32_9v#)!)mgn$vdnNKXGJ<73Ar08ajk#5nV z4>QE|$gJ@!^h%7%MQlGYi3iNtOff0zgV}PrJB3sjmDSc$EUnEEH z$L~ApGuq@Bx$%D4#)BNcwREF0?2~IZ=BV+N#`l$_N4=$Q+w7I5{f@&1n6nCf#=bzj zXG<*QHFJVF+Ul~_D=Vw-zdpv)oU29aDeN`x&(qe)f!=4PsD3P*Dj(Lv>1!-tXuZG~ z@R?2lQx%9Me9l#h3hl`zxyuz>2C!lAyfcQy2M(?*|5h8?#L|y-X{8kH`*1MVtG!!^ z@jF}2PWsC4S)?rxKN&r_uyPT*NoG}89WBWnrt9UN>8~7%P!^l19{Vn;W#n7Xw<}19 z4AK9}d==C%?yi3fBQtgpY9-k{)x)b|XA?tT%SELWC z1jbS>v>n7MCwi0=g!vouhCFR8I@Z13TqwMT2Q{Xf^~!3_Bd~T~EIc-2N+4v7ahGE8 z_ySfAT68QCwb)WRUyr{ThGL@gXU(iaTB6rr+3M!7sUzY&=jz6|Fe-dKTyEri;n^%3 z@X3y{v}it1bn^JICtXA^=8Fi|4b6oh}w83zxW{Gu@s#{sDM`n6xu(QIp z0`UaZXQXv?nw!l%*R^I|i%Nc2s>F3qz%0>?sv3I}IEy|qD;J4@hYYgkmb@5c9VN%* zx*qN`=xY2M_6;+G-{tAKp=#@A&4S^~Tcw>ZC{z`n!!FY(cdytu?XirEX?OT&d)BuiF~CN(t*W5!Qg|KrsSW7C|>NJnRv~)aoiSWYWt* zpn?|d@0U(7g+kR_rbzZ6I!;9&AgcIh_8LfnT7l4v5n2S2&*^4WK}x-X|`|?U)rDL;TlCjTOeMA7OJAqH+nquoYlsGr0YAZAi;X3}UeH2hMgdxa)|@_Rj9wO!nZ2GR!|OQtjr_+IE(OahO4=gb z^#k5vS+g69i(Uk~aO*;geNKaPdnay}=KLgo8T>B032?`9hcO)npK6p+MJ~gMgSy=E zVXnHnpF#lv(V~|z-zixiHr0APm`-1*MbA?6AeBuuR|evh3Efl^XxW-&V(YR3>TCs! zBE7l71ESL9YHMB_0i}`rc()Yc9|gO*tLcRdyA7O+RjD&c)oMq2^!QXyYvWceI+gY! zySs!ByJb>x%{VoAZbm=JHhr&%-6ed;J-vq0h{c}O*hfK`P#n4avF-v3Fs!-xChO3-SV7e3;SNpxe#4wP>5Yjr(~ z5sT979oVsQq3MejJPy(Apv(fd=~b=@8=Dy%Ub82@1Ubmr;=b@H0!NRe+}eDD z(zJ{TWvosXX4~cXP=7W3a-N3+fLiSUCgRXeIb5UFbphHr+5QBjKVP*(nalnMVC=Ar zplPmrncW|gX8lNiwT>NDr$LL|$Suttfp)6HmDS3I1}AL+3+vlYxRh;2}iU~6*) z%W9xThRt-_vJtJD`70J6{^pq1P*V(aMqp_p7pNF{*kq#$t~K&-CXkEAAvb@4ltq(7 zwzWmJcV<*gmjw4(7PSu%iVV5u`HW@^64zqjt~BE$75hCgv{QjhTK4rEY{{y{uSJAV zT_R5RBangkOg8;f)-~emSC?Lcnr?4>PW<$4VIk z342*9C`uFQ(P|$=U9iAfMxQaGa%WY@{RWpc^&+TjR#ii3-S8G@vGLNkW^aKEar>wI z;XK)K#3VPA`Vb!3zcim9aIozxU=j0i;PE2S+;-;vchBW+iU75PC#jKzDb1T+EkT(E0> z0t~D}%it{+eym*ew^+G(@ z^pa^^Oak3J^IVcAGP%dL7_othGQ-FZn9qw{l084ERgaKb=ILrpa*l-K(+Y*Tjmy={ z{5d1Z6CTtbbS5h(zZB{i%^Y20kbB>fk#3!TpNu6epfl3#kYSR6R& zR5T*)>vxv8>{|T?zf~q!>B05Mof-@uPOa`2ieD1HsJiwq`E09+C=dDZ-1(p`=%Tyo}UGzKx=5i4k zYjZe{v|(z>>Q8bNN8~c|1GApcOHNpMr;0Y%g|iY`6iLPYq%c)=I!`fNy=)+U7L9zd zhxEwv@@Zjildt6h&$|BfPH^W2{Ul=mrhxVF?*wkD+12l!dtKI+dy$h!A~W^Ki7jEJ#Zs=onpyupB=fv*m{phaa5 zk$e3LJ5v#pn{`6N_c7`q5Y!4joxb?bv>bMhdm74t;^v5fq9MHoMe*`9Xwd}%F|xdZ z4$^2byTTKJg}kp<`2HE{q(I=Dqohi04G3(6PB?CK18O z2)-7bB2sCn*AkqeyIu`lE3u>=L09QA5&APVf<09+>pAkBlE0FY&d4z1PHP@>p=b}z z^)M+fA4yQoxtlRjEdR#dCr4?XV;75)YB(KsvX~8O!W^1%*b}nN9&g^**ToS{JnLsD zo-2L1%%NcHGE{uppQY926%QV!#cm+UuE?efJX<50=DXjVUBpbIMZXtQ%y@nfXjU>J z%;yCy8O~7{A^NV#?Vr%(Hy>Ih<%5@GxhN+>jnAzs_k)A7qTU5M{0zQRHQ_^8dA&L1 zgCe_(M1Tr-yN0IHLuB#nJhA!hy+2T=S!sgth?X5A?&VH~i+31~*zXbJ7*2=$J4rE@ z-wZU)4_+EDr%|F=J@4u0cMr& z!TP>3mLM#<0ou^bRqk(->2u?9EH&x27PCpBMxCrO9{?THUFZwHanu$kN0oUGR)_-3 zRz+IWWIdH>;zRDuq?^bJ9G2j_0d43u-Tij5XIZO1vd3**mu^Nc-#V=)ORW&=yhHZI zG94!D7Zm4gb=D7+Abg`Kr5V1u8x>$KS2KgDlJxk^Zm)SNVvrYqICb>s(SsY$S>HR% zzo3Qx*IX@90$CfgSs1DWF7fDA| z8GEYAYO&oy4`a1`NY-2NA-y=0!sa)`by>fcQ%mz!O4x4PtFl{hjc2kS?vOpPMP+}~ zA^VaJ*^@<+#)mBJknQV`UGbgD{&k1!?>HWmX}h18Tk#Bnr?SyArpwCggKNYj%Wl0{e_(A?PST~0S$R@GgQ2#ZGi|7$W^u(HEY$nJvd$vTF9 z`!SEt^=1x)@vnZo7&1N17MBCJMw^2k1)QC2<=lFjB3^TbC)PUWA%A3U0YkS9d*)d6 zil57G&Q*GBr|cnaNuKF9eOrr^EgS0VmD9EpK1J7&gswZ?yxzlOK%b`N*?Nw7D!IP6uNPcTP$ zVjJh&gWH+4z-ivdm+lZNu+4T0boG$#rRN$U#mV53c0HsKTDK=g@x)4yc~JMT(9w z{5cxM9Z0b=uIzP#I{TuOO>m&{{BW6L$j_h3u6s%-pv8`GmtL)VPE*l+L|HHPBx3gJ zDt||K;zQlBHAemqoWBfS7u#s``i4-bKOPjDfc%RLIZ45l<%Q>RPagt6WZq8Sh?WxdX#O#2IEUbFL%&rix*s4Z+9 zvM}$Y&)F-`V!OL@{4rJxNXokESM$dj-V32q#-H<0fNl&c2pEI7G4ZXbidM#2D~(X0 zzqzuA@-DBz#RpU2NRij;N+$iZLQb5zNgn1Q$kvI zZH>6h1Mb6qW6S^&3cNkBl_h7lEGg1f!;YAUy0Ot{Fjmum9?x5KmUOPc%1f{7r@x3?l#a3_l`qSVQXL;DL(Ug5f$=fciD`|aIP}mWsM*q;Yf4Ll@77I zm#YCjW3lv{O$Al6VOtKh1#vzWAKdt+B9k!Tojeg+&|OFe(Mi$@Hk|-Bdsd6$&~q0G zRCB0DTP;I;VS$==Sm@|ADXA}^32D=9{8DtMb!F&=@7 zGM8q_UY;4R#HBZd{1sGfQRT+SqF@ zmpXymzdF2FEc9a!TmZ*X0j+YeP$Q7LSXyMy8=?qnwCIcU!}O+wG4?IZo8COteKRg4 zbc6NOU7oZ!L{uw?kq+F5>K%gPbc(Z2<w-gAON zY@!;xl{cg5rg<;;=VIy{s~xnpu$4_9r6Zc`?JOy4jE!jtzDgM4NU)Oj&`$euhNIGD&N-3ebXi)D zMIL0UeqqAC9BAn4vMshDOIJrTq*X#%LD<9D`w%6~6v)uuOpBtR?c2~7G6HXf-|ZtX zJ^Iv9fQ5}Vw-{5A2WTtCdwL?G_E^yKIjVyN5p~ccS69v)CmFm947?qpJZXz!eZ#j3<`MBQ8Hua57c7Mkl{4-1R>Rp zTgc9KW2gg+ZuE0PH1#7VL{pud5KZlejCHfbX*L2l5KabrAbuZ@_xyFK1dZ{YPFseVZTJ6Hxa~vVW#4notd_jm!j;bH zC1;sLJ1+bEZ^U&kGWaO1)m0W=>$0N~nsL_%m;IoG?vvc95;}<&+w4h%tbQeGh{(um zH%jbD4*!o!m5aHm8y!0FwY{FP>HzE|pcM+;vdy_Aq>wpCha6<~5>m@OEqbL)PKjD1GI_=q;W}4cXoFMmDB3)1g>gzp@dW?O$n)1=SfJBU!rp_2~|ocBB3iK6qZn#ghCSPLx`~$a5$mHVx<;4kyM1otHnC2 zQ0Gys`{`GBrf0MkJ3t6~xQp1sUgLlky^+CJ){3!=QTz=fozNv(^cPNuVcw{!c4d$+ zRiSR^lfMyCgZx&CWu?+b#L*`MoDfoZh7&?6Jx&Oz>4QTpT>=lH1V1DIE- zraFQ7FcsfpplB4yc(Nfq60plw~&S_~V&{&jQ=`=VJbxgNZqtK+c(A=2)>gIHA+Ycqg*j|gz;|@Qo{Hr z2`ORxO}1Q3w%q(|xregl?w61fbMf#xkZ+Ta67$g#Qjo8ekb+!62<~01#V%7Jk-)x$ zR7WRv)QeSFy;z>ri@mdY@r5jPt7WLE+49R41siGkM1=(QdO`~Jwss=1N77Va+`xUSHHKnmTRVTF{tH>mSB6dc6gnZXjLW~-<$h0%|x>8KSw z8@ehR8Ym&9YA%qFQZ+>qQmW<@2`N?6oe&JomjqS(d$zQk;$KTh72hQxRs1svsdAgL z<ylGju@9k4K|F4->E;SYN7E;rpkC_e4laQM3W=Kd; z`5p-==1q{0;>Il!Qrx(n5X{phL6P_>2`Lf}l#n9v1rkyuF3OfWC0nk0wp>oOT${5W zbJoQ6{g}oG?zHrF%>kR~C_W@Lp*?$3hwKY>i>?ksRSeq8c%gpTcy1EduRWbgjnQRu zR9@lks~ptg^mksWkV}!98G!tpfga~5m(Ecx@g;T*W3JWppK|YnJEq*(Z`m|}axUhM zDR3ycD!frxUVs*PO7h2DI9Rk}9V@wc53GItjStH%X?a9^ z@Q-l46iQ`dVG$pH!_GXv`#U*c5kXdP&nU>I%4A!Im9Ug%jfrvmQNUPhjis3EzdNb; zG?f5|uSn1kF6l=8y`aLmw2^$|e$x%!*3MkT-Oday)}C=0wnKtL4N7z{GlWgY?O9~+ zW9c14#@hdD$j8l+SJSCkDSM$(Nm*z^^2xLu;xUzTYBg2yo+sA1uvP-*MN_$+7cic2 zkq(tTf-gTzA$e({XhT0_3E_9MiXotgU|pF9UBr_o4oGg7K++#^VtD5``V2NceD9o+8y^J0V8XHSVtVrv${M%RvYVH*CunrkX?E zqK;Lcn{IoRLOK6M5(CCX*6q01SBX7TfiuXvd?KwS-v+U*WKcIuu{UZaRk)mYlYZSB z;^4Lu7{`)Xxbgi!hx$Acl6j|l9KX@BTsW+@hz8Pcj$Z^yZNG6uj?l+5l5;?t6O-^H zZA#*Rc5nBqCTZ`lKA_F*ew7|+E(nzG57~CBHIFo99$u88RslCb(gJfsyX(IfP4F@GZlv6kINY`Gy z{2(W%@2}vX>fhP%`#CMJ+cCs158VX2v5}|KrO?lko>Y&kBs9*skHzzG8HTK2k0-fE zH!kf*UA^?E)d`bD3FWmgM{N!G%^N*}U-AX!k%QwXmOd45>+JSvX1Nl9A)7m7PifCi zE&zY--x}{_c%z=InJHK5OE^NIv$w0u6}}2iM~n@~p$K`IY7lREsC{KF`~=K@7O#f> zk!^Woj}M+8H|GXfFH%4bjBw*_Ec>;QZ8_vl44$Z)JaHLk6Z65NcIQa?5zeeTD!A3|ux_G2@sQ{$y3b{Twazs4PCx>$|e)neq_g>w- zn}_~#tgqXY(!h10MGwei#$7-?eX=&R$?aNp1)yagovAR!0qASvzAMq*>cXHp+h@J^ zBwo#jipS&Mk4=*aGFUuOT*0!Y;ri}myil>zB|N%#irn1TFH=M2TwrV2Uh7!^$mMqq z5S55fm(<{7RNj0}nS5?-C0kU_Lh8-r*9`V@5J+w*gg!Q-#p}UNGD89sEN}=0iz_U1 z8+$BGS<%9K4y%|HE+kC|C~x~IPBgaDVMNYIB&;0@1#-FjoD-J4ZaR84^4b>#AIqe#SRxes*gVL?`e6{F9 zQXsaM%|8!&o&{jy(xS6et;#}X6As+nQ>ge8FeeJp<;Q!h^;;d(1rQrfJO^vMTe?cC z7Kt)emu;zX|G*owzT%O|UfKOJ?q;c9T=)xRVpEDohW6Xp2nPm7*03p zp2oZb+`o3mMRy?P2*bCtsLJ>u^aKx>`I~*86#;^QV4;_0c2G);WEmP4`~Ydlp+JYs z%zmbhMo3WI5&H`3>Bpf)8x3XbMe-GK)v)MiJtX<>9GfpH!l~cS8Y}tFb<7VI4{|bZ zx2~4V8DuIwf}Y^AY%W(F?5Q%z!t4^=bUWf#YR@K(qaJO}8{r9_z>k@EW#i{? z*Gg@enl^NPi0(5sTS7Cv{MrCR%$o8o@WjSW1V^j+#k}+uU^5(KOTNNo_Iy+xdGyL1 z3%2a^^8G>HWapQ^dCG-0d+~U{8TCF>=Kd%M<@qNZ z5?$`G_8(A*R^X#r@y}sw$au>HAL&=qF>M+%ce=;*w zFozfE&5Up$HVZ*G0U>|+sF-eC#mV58>b2+&;)8G3qT;q6+)s;cX}n*kw|xykXPma9N$dTkg#2!xyj>z_gtjdgD(dlJZUJcI7*=GpC(N-JtVX%TDEl0SfF17r|Agy+qyP~xTVtxuV-VaN5%ZxWv2g@Md`%%jv zDHPfR%z)9IV-rbfTYl_L4mL7%7hp@seCe@zF&F}7_hKcAO@4#Bp$HEOQkCSm?x29d z(XHzql?f?e<`v7l${8DA1Sdt_<*ux>X+N&4L6HklgrYlX1y_F0VkWx{AE13r?iexQ z)}nFA5%>l6t<=ikuYLze5y`%SWS$vDHq`H!sFy7|f+WxSE3=Z*wu0OaQyyudfSsaa zOQCDZ?jyL>DEi(`+`C+awQR5byrgH>8y(&saST&s13!zMZFbIFw-27n1Qncxl+d-U z8A0*hZl4V{S-o~|Av0j`e4b>LCz_&DumeOJMSr3K5O@Lsc{JBXr|9P0=$8(~$00GQ z_y`rCxSXAm;>(=k9*T23mYz5*1V^ai?>Nwd_ejylD5|EO_WrRc$Zr*$LNy5$Sl!bh zkLBEj-(~%TN&)juxdR;R_g+jT`&%5}g zOeaC)=QM?VBklhRnpZIe(#T$EBuyiE8b>wqLWV}NhbOx_tG?sRAQfn3Z}6|#3QJ(2 zs_?uDfR*S0sqiEfq~%}mwOeQ|%a_@O)~Uq*wTrUdsDR0fD5{I22ndkj0?fQqx(Las zoF&VP83dlpAfSc~bxx*^@SvL@5TK5uAF%HVt)~#mDl!Yliul(kmLaSL7np0raIRTHgn1H%1 zq4@oxN(P^2oq)%Zy+6Afq*D0{GWl~d`60=l=7=d4KVm13>}JJIHuM!OE>Z#BI3B7H zs$l0(1)x88^;h7)>wE%L<{Ts_#hjt2s`BlYJQt|? z;5o+$c&reCmA9_)P7&&wVUucSa#=@0%5Kk&Ss)`tkczTwsuoY)yCL*&WV zH|3A6UBh!ldB5dSq^q;F(IQ0_*!(Ue&qPeTh&Hg6n(>+Da#zXv@e1*JH0b8QVrddb z<1Ol}Y(Q))?394@ng{3pP>JwIJwPDvrzsubmNnJMMBvu|;-I5||_^t2dsxxEtu?rv zrBZp&8T~lkA{{gxo4d%6F-uT zzYKl{Ju=69xQ7&e&Ipk=Hn$s?yzlKdLoMo=e{*)5EaEEUk--Wfnr_M4?e^OY8uY>7 zE?VqG86;{aq7xgT+?wze7qQ2~^HO{51Jc(c{JKPtF{TEZeIB72uwRnKp7RL;fLbL& z6}KuC;paDS^RM#Ao`5ZW>GZls0XGNm>@rslpX8bP7|+zt8~jipew|yZv$O@@0*oKq z9Pq9ZGS!G3qdq-Cbg*o`CL;6#$NM~XuF4vNHBd>1L)(xpSy3nlmuT2$Sz6!wMZ zxQ8s46QrRtbn%UdNtM#i5jSD{x*R=%NOiARoTK;|Fg(s%{Y8|s&iXRl%TwoBVkL5YEqkfT46^^QD;Ml^;*)wra z>0*BZF}2$1?s(;TeUUGI<9dF}qsxqQ{5WNJMlxKX)uBae%j8$+`Bjpv(#IFfqT;cy|2J^hS#mJ#Y|FOW@wKzro$M1O8x2vx zJw;}hu{bRGZOHQ&=lr^5@M>Pa2yz!^tM#nRS(GbLlXCg0;MLp`WnsA`XqzYV!zQ8i zYDzx!Yryfki**8lq`czB@2?O9Uh;F%NWyaaE{qSBTwH;qJzQh=A;n~JqVsxkbn`(q z&w&ZL-CD_M2c_jjDp}k=$N-Xn%6#$oOmtv2^O0jR?L%T98Sf~iXn#eMw0w{>5q-N0 zL*+O!WrsvJ#d%v!@BF7CU7aE;D3Z00cwbLma@36v(pym_a+rR6UFS`_J#*Gc%cm z5<2_2hFBzkn=6&wh5c6ID0)0~KITSyKp3Ci=4G;1&a277-I3@P{mL_n@y+4q#m~2@ zvo1Tc2t|Rlf@_sH7GD(l<6_S%PX0yaFZEM0z{6+A&UGJkCSLrA{8**YIBy5QTY_Kc zW$XC`%R)Y?Sm@*S-@8LU-Qvv?=T?-mv_Ef831Ukp)3@TT?Dh9yTvuzq_;w$gp6PwO z$H>uQvO%Ht@xm%Pi74A(vxu1av-umz|2co%khM|_%LmkIxQ4c{HEUS#(p;o1Pm6w} z0{L2Wj|z0+@G77pZJnL>&YXGZ+vJh5#2bzx=eMO_kvC|*QhOoI`Q4=%>4VUouk|V~ zPMGiA3|4ij^ynQNaDRNN*QFn9x3O@2rUCsMjI>L*? z>{B`qy8VhYer1Tp2F2)tEays)8CuZ-|^}1Q|0oml-$Hr7&qrvk%nREvTnXw01Q<{I`M2gO5xl3x#TqGmy(Fl zEgLq~q^oH>y&085J+nyzgBtB$cMSJ#7J7kYm`gX{B9kNgEkUfX&^g1T% zFGPW`zdXt>4;^mOOOrUn2k~fdXO>2IjadYW=};v4u;jYC%QSci0wo16Gv7KYPVwT!dls!1s(8^ zM&Fc1Yo#t8<(|Aghwpe-RlIv=*rnMxuWS%1Os$6&a}-%bUm>Un zc$%<7oUH|lFBt?CUeasNoC_4naFUlCUik@~%MH>Md3m`xw95V%Y02tOj@n3LU}4Qu zB_|d`{O06BiaRVSv0qZ+<>*@+C}}?Bc@2KQsX0&KB!;uX=^+VZiRN(YZSfPOxs{h( zO@-hn3OnF0NDh~Ip(FnlT)|h1UX+0=Pmuo$+>TO^T&>{Q^4>>>^BvCnNIXL3y^+@| z}H!&V2^Gp{bAQaXXKxG%BW4C|akrc+aHec43X8xl?oRt=3v=v6pYHt*x!r0#yjt1TToFh_`|$aF#`hSRkU1-}{+4dkNy_ z+t25(?~j*e&p9(^&df8; zX8zsXNF-h_)c9WArrlVnr5Fz=9Xcjs< z*~{{Q)chsR2BasI*3; z8fh-)vHUw-(1qk`sU|XNlUgf`M0B`F>cVPwU(Crbr}3`yDDO#4%l8h?l;%gS(m2fi zO8`RU0}dTr--k$X+LRtL>7Ml0xnbd_w+YwbAto`h&#Q^OG%j`ZdEU%VlpOj-<_`G{O;XB~9E&A+#Scu(dfD2eKIg6}Y_|)zdm>^9=XYjWuI?ha_{Zx-_ z5mSjG2@OncMy=aB4mxk7jluYqyjXEBlYhR!Gyn zxs2$sRh=iP)26Fwre~9z4^EfgQbr1@W6H;<`Bmk|l!$~SCf=^sK?8BX70^$Kg5e`f3+{`t@OJQ|2MldPdKqkpAf9gwjb^oP;@su_$1n^^}<%qG&S# zzSFNjmQB=D^P|P+zl@Uc$SwjAqaRXt>;%mD*BiCiB<|Nv5YH ze&<&#e5os= z@&fIt(rBt?enIh%3yPniSo4{V_9gUgTEzCG{Q`DI(#^> zw=%gQtR&F$D~zNCcO&u6dqRC%;3rrkDvZVAza%wB4Ab4*>5bN2l60;Q9jqVgCC0i< zB7`Z#I-h$Q%QQ%g#5W=4q4?3^MoW#ps={dcMLOgm6&FoXhJEjSu4EguC_x0)pdYf| z&yyN+R8H~OY~Dvxm~_a_J$l`eo^hzX@u~b^y@qr2P_r?(L#L03q{g#T{|!0F?Cr?4 zhn1*VpZY2$qL2E{{$U>9MJj6I#rlykaPcy(2=$TJ9K9YcV=R3y8yOu)p`SvrEro-x z5%*n;#47PXHMQSndxcV z=5eO}V&rUNkxCvRa!p7Zat>tiFA{v#XxYwPqis$HD{khv`IfJMk=)O1um}7#lt^Ec z-b;lDx%bbY;LvKel@MTgBF{h?`K(<#H!=FLDbeppP~}0G>Qd1QmrEDZ|K?WrPSA&* zGbQwL1&_f+Gcme?l>8#d1sqYKZZD(FD=M(eN}Fv{Fp(fUlUEzQEMWtxsiLK_FleVp zMO3TAbCSmJXmyMe?Zhpxm(Wu`uZWGDpC|coyh5(< zCgaIqYEBOhn)$}!YsC;|PdDT9Wd%**E`0@mSRjZZ(ep#DvGcUrk(b22#uo-)`v2nR z>PKEp(_?Z?i~oRv3wbT}94afCne@HXNdQ`a!$P)JE4)w`B10%m$M{a&!TLGglIU|` zyJ_y2#OS}(-u^^pCH@NnIX9&LPtLEI)1T$MpGwoljL8YVCTen-?s#9mgMkj1tq`M& z^NYs;7w5y)2v8A<1ABm+X%U?C<1wW96K|ZzZ}mJw7nKN$3#cHewF6>zQ-UY%fql+q z;GS%6u#Uv~gyN%5^F*(ZoEQ`A^FQIG*sG$BLhR{MNd=)|vHx=QQ#5a@R8jb2mWt+c z>*(JQ;RIs!p;Koc{NpRjqwIZ!P@gN=QgoE+QdKnjbo46DKB43dY zaNIy%b6%r4%cA^p!(SS<4iyC95p=Xc*$Rx7)j*EmDdkgp#W|C;5GJ^6(GvhJl9~#) zxUHu#HMu7ee92gRFLjybMjV|bXT$Du@lfH!9+o-cR`4)+s%6ecn&h)Eo^0^q=Lv)^ zu00xi!%Q_G0j}muCFtGEBMJb#S3B~9*h=F`$yV*~6>(x3i_ei>$pDG8j!58PB(OPR ztf<7TwoU+dpBY>ov>%`*lr|cBS53IRnJSKCC7VTCY{EBvEIukorae88dGC>=3W(wA6XEc6p=;< zVevG2cQmwYXq33{P24tIJPz_>bHzAW=Pwq*2ii=cHTs=MGv58N@9BivjtZG%{%Lg1 zXx(76N?MBDlx>BC+_f;M-tSLv- zsfu>)%~VUpcJ(XPAQmR;pk6ueOUrmH-qC6)mL==-9l%xdTIt4`w*MFUBR$LZCv*jn zBI0ty25}iE?GaJ@!xf&mRNC96MzK3xn?%K#u_VX%D}FW@z-i2xt8}b{q(iivP}J|+k!nPg3~{g zs4ekw=HM%!&ujvT*?rT- z>rN{-iJE2VWl1d9&B)m1E$^as?NN6yOMFj5e|G||3O^S=m5WojNXW&B9cTiA%G;bT zJg3g?&c+Rq%F*;hIqq$n^Wx<+_|KeuXPYw>9&W9(`>TVr-RI725oFgv$bPdSPsHnX zj1jSp{(WBckNr~pjO1T~T$ ztPYk;U7UThoBcsqM?@|7ZRU&KDkzd;gW8bmMb$T2{zzBtJ{mD6nD)5)0SexXC>{`!N>6zc=XzARf;1X8& zT{tNuW6w_R=xk&CV)bf5*jaJN`QfHgSVsKGEFXN9jCcJ1`Ka({FkeA4hbw@48FD_Bh zXE+tlJ^atKj;tJssw$Fesq>rFRFwde`{kWf+jjNSDpcIG*2wzp2rcz*5m$1XfOEuV zr|Bvw+h%qs=r7p{eR}I6I>&?sE zUavMSJ&AT=38j2RdX4k|zjY0LjDUPhnT)hMIIO-s;tl8ePB7%vtUjByf4D<)o?E59 zPx5|g^gkNbE#FX07Y^$LhP90Dzz4Gfd*@=+aCFT7a$tH;YZwo@!8WJfR3BwL_Y=~R z*`6B@yi(5>?uH%8;waPAC?U1m=@1q~u|_|u7uMGzcC$=Q&N~|()l?e2$X!@J!{bmWrk8l5vo*bs1b0NQLd%a` zsi$t!h|O1-hYl#|Pv);fF#s?e-A>In5RKq=5bnS!bCUFawVbh%x!>gVYsYCV@ zLgaR8Nj#ZrwS)d+VD>~yyFxvsvFkHF`MEZI6Ce7I7x5g`0u-TNETk6kC|SghJlBh= zK1)8TEb)`GX$uJM_Iyz$S+MRq3!XokS50#EwNEBZbm}F8pgr_RPZg-YPV)C}(^Gm) zmWkudQnXU0)MydD>rQL?rG?WfJTg12U;gy8+BNs9Ph@9zaXSsM?31!SI@Fz>oW+WS zDDR@oOmJOnK3lV|k(bGMW{w(LJ?l2L7txwrx!%(c`?FWHy9F4b)sHdOaq(nCfoKq` z$kWVH)o;zne#O@{L%fHpt1KtWf58Zj(4obrrCXUl0hhE`rd19G=RppjKzWJoNQ-Ll zA5Zk1mk7kvL>Ex&RnPRA=pD8BiT;P;k2ykqsGvx~2ny!<&3sYj5s}Zb>-UqD(-@gv zz|DKRxpt~yZrXBUv(0-W?q z(#adV=8NfY@cEhWPxe5|K^k3a_!D?V}1XJif0U?UNgV)G3Q=NEhqEa>)N!%;1>{s z7CwTk^o!a;6K~t3m1hgrllQfWc~Wx++R-HwMf(S5G5hz&tNZW3P@ z1A}U4jo4oihv5AFqB!iW#;6opHdyKq@lEOyHW#K;4ioeU@|Z-dub37uc8rm(0Fd)Y z39a_OE8mIQor>NI?i#80Ao!a=q(`r1z*FTxqrC!Ov3zZGN04RKh}2&^C#MI7K9 z9<~-W%{i6ictS|=trFx;Mshi)Gc~uQ-ts#ep$_;@#mKX`=AqNXBd1S^_3@I}o$IYV z+V!w*G7i)iUMIZ&sUrEJ+HICT$~v%CCvY7XbNpsQJnaKn*>0LAYD&NBH5KYC(dpUQ zu%4Ec>Q35cPt4Bq3nymru@iIYKs7PiQEs$+k8-R(XX&dE#IwJ4{DMf=AOpB39h{@_`$?Vw8yOE@Z9JS&0ki@YZ0Y*@`FnfVCtjHX;F$$tB z?~!R@Z8ja_-p+$rJIn<+1mMZLK@D43Xjo6r5OybiZuB2Hw~9l|ScR<$TfpP);?Fqn zxG{Ck2?~)(vG~4o`6(Ka(c>i+E80+xHIrnu?AulwKEh%vMJk2!VA?KoJ|N9aL-5GF z9fIEaNFcEMpI^vh`RTOCNg~02iG*R_BhauFJ~~^l&^g;*g_K)|nf6k3V6$2Y8HtNqb|ZVbq@M6iGC_4V~W(Ihi3sdCQwUf%~~>CQZx zUu;VM4-x(8dQ&0ef4PqyU>@$7UYs=jNfKcruGj zuegZ$-|{N|iP}1htQMypfUGOm1}`m_bD$!|FS`ly+B6jrZi%Who(5<>H5Zq*iEV5K z#bO4xYe$NW8%EGGiLF6J>?tQg@(H&S87tA>4+YEIksnflJzaU$N7{WJE-{i*fQ4x< z)?X_#MFd*73fwbEf^UwRTo%y-Hx_=P9**U+V_64d8Pr%z%BVHPB?6baYW}a}e}A^` ziMixKZ+RO1|4^~ycp}la8q)BY2dg}?E5zEDwWnN7nj9rvN9?@X%4v(V?22L+TquHt ztGaH3{=2H{%Uqhaa^SmdAWNOZ2eKNheM<9=R=(bRIIjBer1Yl&(~5LxiHr&FEz8}{ zKIGSGr7;D0PVSP)U{DOUN&aWRO^mO}&;L02s5r5f$|B4u8{W1^U`J2W3<1fV9%v-8 zS(}X4TUUmQyC>Su^sY87{mj05i4<$MGVgGmjJOOj1 znuEG>HfRYGmp-H=pTGP40JfuzbWp-27f?MtQ~H+kPe4D8`yBy8GER50>oDi%ynF<1FDa+{09_q7ZoV{=RJn1t& zk(br{u~)#<^}f=pUdb4~Yu7|Vp;lbRbOdND*#VVPg8mNLcR?RNq>&tWiyZ}m!HiLSJZK}@~a|b-Vuiwp4jn1ty z5v2+AQ}ZZ5O-dis(!-4N3>1L)u>EH7EbZw`bo#A6d6*;pdNj-r^BUwiy`Nu~7?Ip7 zHqxEzLQ`0QS~p@ue!5R)SX!+UKZ$75S3h0qDU=r#z2}&9wlQQQsxTK~7VD%NIn;%$ z1tD+t3{cVZV_z0x9^5!d0i`EXq46qvPr3DcXw`fDLy4VU z_0~d2OMEBB>c0w&8C8Y@j&{JA&{NV7gm&s?ShmaJG@JN2RYROK$+kbLaK$3!Y!|5| z6jt`KRntOGTN`)6btEA-55gVm1Rb2yFd@5jm0&6+vYxg$l_NnXIv!jbnK*MF(T^Cz zqzMy3%l}}QVB16p`$RwgS7#TbJ&wv{Q`)4>MKsclZX^Nui_NAjgVa74to@N*V4j$rhR#-S#^@c6cT8>iABIID<$xX z=_RF{?yS<)-;fb|*OAtY#z{!%!B>nQy-Srmy%b^KkFvI98N%C0h$ac=0$b#~TXz-A*USD0scx;&m5C7UEqmk$@;STU6ePfK>@ES=3Fb{5(qn5hI1hnWtd z&gHXe&DgU>vhmigonf?WQ<%A57R4siS2=e6&KqcxgFZl;=P7Lr9MwaPSO?O-5wgYs z3ds+kyRy(_-KJ0GX&zr9_V`LU9D;3`#+`SmrK(ZdzT9tCU5-fHsgN4&40-q?FgH?# zfa85$^QJbtSTHU~n`zmv-=-HyvQj>+2QcEGtFyZ+S#)osWuV}=Uc~B9$DF(&@>pPh zx}2$I40*MxD%&WrKP%J@n%(8UiEHNM*Pb}HYQnyg+Em7N?Wh?-5j*i`AfM}lX; z9m!IR-$QT>tds4jt$WlX1#{U{Z-P=!y1jpA#zvtE;mx??}6bPH}bdMRmxcljP zVV^ODi7KKcA&E(`>uR-tgVvypU1@U_XJQ4O7va8>+i|?SF-Wy zX5j|P%~^d?Me9fG36+uH1dMwBHdOL3&RvK{hsziTP5JQ){`|ol!C9N(P77#7B%I3x)fx%uI=F3QtLqM z2U*`_;#QFYWM`yl_cQI8I2!21@8#Z_S;+% zj>`JHj5}XZFWn6IwgD5F5$72evyk|owiAmrT?VE`s8GGu)4WTzUs{gQA`nX)!Nu?4 zLN>F;Y0G2V?ffMw_0C`Oo5xNq+d|0|pxkezzsa{WowS_vQbIq|L{cS=s;pomzuC4S!ticA1v&Yju0X18t!V5r&S0Gs#>TA%^REBd{`nv zsqvRC8WIWT)8auinEM8Zi*h64G_qvo7j3c4N2Ay0Yz(kU=i z2sb?_?*zA+#@IE`vca+)Xz|ymmgw$Jke9LOI(Y?m4)Nq>YHXQt_i7xF#@+3utBsa% zl+}~Pp?$>WRq3MoR7r})Jmhc2UdrAK@;8^TX|=s9_~M*Ba-7u%*w2gV16bKhP9b$} zL$E7)M!j7WvhbdyIq=FecThd5Y~mxXYfGXh*k3D^DM^+59sK}RrUN-9Y|Zy`npI=q zKrAHmn31+rERo_og0cB3fT4Z2A`-u2$3K1t6{IbcFLZV28l{5Kit^Cmr`zr9d)DU( z2i9f&l%GF9I8p`sb}L{>NT=+5K*)MfMBRi0XeVy@q#xT|K8f|uK!5g>Brfg;?+Cs! zb3bpU<*2fJdrI+HJuY?Q-#t$Ivqj8VgFiij8FtsN)iq)Rxg?S@R>imL2YRd$JXWhp z%;1Z$uJngAC-PxnPe|Fr6<6Y**YtU+TRETT<7ejGr6+NmcY#l|v!JLiM+y`aJz7vC z2T8O|MCVs(0jF*$#Ta~<3pr71?<(RcbsV|`>BQ->$6hcaz3N~Qeb@M^`2U;>m>Jv< zrz=uXX!I3}O;+t80%J{EA^$?qe_jyJwJ945FO|E*0upVib5<2k$(~C&{A=6)L;LXe zX~ne<5Ahe+hke6x_Tj^R`RpoQz194ERxvXA*wR^v@slLfTQ zcoMKFhEF`T7&sO0SMv-~h` z&yuhm?e16hEU~%}IRQz-A;B@P5=CLOyv0*l?!nbY;%$8`Hkp=97+*BK&)TD$9hHh3 zs3cTaPXsAnZ( zt79xzUIC96!%&b5oQ%qTwU=|KRCkmvZ6=PQ+lv_B+OLvaD*F|YxAGL2nbwOYCIr*_ zff;;$-uE$N&7THVCbnZ+hyMm%P$ng1$RluTVl_*_`=UzuG``em{fkgl*RW8arQesu zf92dhf{^FZzw{gGnofwF;xzSk)-tyDxR$Yhhl4M>ma)asWfiBFqqWL1CO9OPv3KDO zj40wwixI)HW#D1&%i11RE}oV!TauK;T=W@jB1`YpLaSbXD3Ila_M&+dioK{B0H^O) zql(k2;AQVVtmdJLa%1|l2o38MdL==4*o$I)6yXwbg}n%~cR2W*ap!oMEe=GC5E7y+ z!sLgOZw8*%w`s9z7w|_L91=^WcU}5@>VYK5t<=cQ!EuZ`vXxS?qx42zaOXinchWBi z_;bz+u>`nlEiFxITaU2l0r~fox^FLl2BXUajym(Yi|~Kc)$*?Vj+9^fwi#EY-`pom zPVu|eFBEgB;S0Z^ebl7oRM%uVl$^vhc>a&Lf?a3@CD__)mZFuK*ZQJ z@s{Y7dzZbl&G2MUp6x^V1`FA)LCx$1YKo%V3*x zz&jkO4$Eiacw}Pi|Pcoj6@;ml33Ud_bi4 zgF(IQL2OXA=gd%&SGtRQart;MBo_h|5XNtxh4^h+FJ(?ta@rcPyCvVaeGs2F1FTNEU+#9nDeK@hWBc2lBhP#5SN-R+;*>wiV*0Rw^3< z>~+x{=~yThBf(vScCa$y?UJ30$RW~Ov_e4GCDxikY;|2NdVPk2@8SF^swM2zqF_0P7^{ z0Ox_AjFbG3nGlemd!p%F;Um%HYjUpEuxG+nw|Qs_-o9FtJ9F4ZbYWv*oY5PLf63oS zYV^4g>$X~@gF*-;2S>45S&_hc(}D{JyIguVKV*8l)zT64=A|;{$me7UAwE{Y_=20F z3$k5?j_6(+i(aOKIMvf~#5FIe7seq+&6dBfUH8k9p_{F;GHV$I3YM7?uH z3Esw?@5$#i`3Za1hdCO}4cg!pHEF^!ld|v5X1KGx!?V*mS5UQU#>o<@f}|5Y#oXTe3p7hxkNsM1ACpX zoeb7{71ry$eOdX|DMgHy$xU9$JIC}kcCMgKkb*4UXZ3`c5S6@KSbqlJ9HlVLpYEr= z9hd&)^gEdvk$2eZ54nu~P_ha3M+gUXi53!)$!R8cQX$Lvk-qZoS+QEQDsjmkU#q1& zV%9~R6Hn#s;q1gJIZ5*+XscFy-1SNiG7X=ro(udq*&6pCvY$ z8f~cAq((1(oduO<@bK)3X5cXHQTPH@i|83Twcy+X(6ejkj_VGKLN~ z?D$m4mw}X|)i{pnL-mLDXw0n`eHEp5D_>o~gkdk)N5F(y<@c(dG%`1hBXL$GK3Xsv zvf*%f=z~TJ_wE)W`3QAbvC+H7r_MiL*;Mv9rwwDR1=gu(@EpEiMxKOhb=VBPG>6ca z0jEjiz|ine@YI0;COOq z%U&2XxNV9YItOT}2DBWy)F_lgSq9E*shzhsr!SKiv>d9blJo8tfnskt6p^C09BLNG zp+ey_hj8UkYX3KKsNkoX&q4`K(X3Hp%VwP{2A-_Qqv_0l0Q-4LKyhWZpJx6enGN6{ z%ZWZMurV-&&UtCA*MzBYh&NWtOJX#4CW++wKaiL10%?rJe-gy@9szX11EA;P^?u(h zR_Z`bTtXjJ59Uuay@#1$1!-tH8plTB)(gZXqeXV*OX!=JBqY!*xXD=fE4^qny~#!+ zrhmj!p;O3>(qLwnD?W|Sj)VhtM6VWckNzq9R#trahkRBM)?3utUZ-m2#V7T`mjuT& zim0y8rSy$FJH|h4>QE-7x1xVE8v`n2wf{xPg|mY6oz@M=DvF!Q`VC!yA;DU!(a1W) zX1OA3i}j4AYR(VdDq;t1^1Zop?fwKrg__@$9M;V{2Jn}5n&18qn{eM}Ld~DZb8Ao( zcyDv2@D(_W^1)=e^}%JubYMAjiXs-QDdQ!(iOW6{BZo%Uvas&mUW8>MvlgPP;mgfG zoUS*e8)?ZMC;p?vf*C;K(N1^@B419rVqrHHkmF#!pB zC(h{PgECw(DvH+#%KjzOzN?V3yJX$1xfQf9a(jGwkeS(ygvObLDLcSx`eG%|q8a=i#l`WvumL zYHk&ZDX!24vgOWb-XZj>zVDt;^G+dPq2?p%hwxkul%}RQ0qkIysw{0(Fs?bQaNjC0@^ZnHR}Vfu)2N z*l@G*#D4r-(8-Skrl0`rAlX>vJm44q=v&bXQ@6a#QSwEzhs%+$mGO_x<+v{Z5(Z3c z3Nw315dI}sKP2zWhA{_A$Rn|Cj6L8^sUqnvTE~H_V?BUt@!Olo*07p!1L)7>HKo?vt+aK`Ru_z4z=QyrghGsCXa?>IX&q7 zJOS=Sprm;u5kbS7vJR6dIJ3K!crJcInG@F1xubXi@S6wO5bN zzT@XM*Lz#Z*9NZFdd%sT2+P|5Z@4& zx=*N@d&(e8XR*urFSkJ8ObQLdN*A^n4 zT&M?j-}L8sBJ`m57(sSrL{cYg$%6ZX_~v`5)dV$JZ>Fab39`(ChOzus0JfrDBJ?-P znsnIXs|!d}>K42!1uszGJpQs;{plkT=Gc}M9-?2$hMU|T`3y?j{8~@X!Q$HJ0O4E* zuS#D|R88Bl^xZAHfHGH(&C}~mhX^csy0?5L{1RqqUs`*xgB>+;4Bw#+VUpN9(9HZ2(Y_MQ)FNK4TI0!e zIesKDJ=*^$rZT=oYesUEv?)Pv!7go26OmGz%W1sY>W)7L6GntqK1Da2%i2$}lVanp z>!6IyyY*(QZ*VOxXxGR@qrKvmo+rXu1cT&s>M6&C&TE>ZCs_%=xbr9U9Oy2QA8~fe zUV=PZ{5O05q#=pwijm8EVx_Xhw@KB&ei?20+kA`p!Jnes;``I*NZ&LfC0_7bqlo_O zOY6EDVyac^W1I7^Azz*~(k7n(0XN#YUY3^pRc*@KzRmHuMR;lh|8}nG zFE5WTmzO*7RE;E~Gq&WlY|@r!dDp0zzDs?smSi5n%u&9TM7V$Umvd-%(`TUJ;Vn7< zN(N3`o^lzLkDmplK06?%^m*o!C?;}~V_VqoR3C6#W+Qj*{Q`mf z0R<_1Q27)oH+j)in%BkwV>zzmudaKsKk^^Oe)ttEdDC!0&SJa`(F*k6uKuP0riEPT~d1Pm_T z5c37QE~#g<{)2BJr%Vf{&i}mf;Sn?}vP##L$SOE*_~LvsB3aX%rx#LH9*H~6ZkTFT z#md>3Z$^sw2p3b*Y_XDcBWp@a?r(=FHyS33~V!{t-$`wZz8FwIOnA*_0&FBI7A~%;4?4eixohYH7f&_yO zm08KgEpo_0(DcuFfCj$qHo&OutEQ{BW4IQEu6sgt$Y^8-0VRIS3~rF z$7571SZ?BQsm@QGqoggZ6ymIAPrT;A9lR3j2j3y2#iiFG61fUiPtz0~<01&>u9L!iGFMFp zIBeDskYa(T&jzGGyZ}xe8ggBwv3MaS1pbgu%{cV6~4Sh}h+%0k+_LGO@M>wB&aS}_pOJ7*OD)g! zhDoWB58T@Kkw8vwn7okKa2>dH4p+)3t@LuGvD`=g^rg^YRr64v_sG zXXok%|lkm$5S0!D>Id;cW^-iJ7= zkmxOSyPaD`x0M_FJbU1C{DMOd@ndzNKq@q{2L7G<=mOSV>0?!#9Q0#u1=SA!MQYbg zCzux?Pv@!pLy{cW!nNYrx491!H9uv~z0S>kEzgXk#JvmTC#kzR+~p^6)rq-D%&)KG z;&L{@)`hBd7nj4*w8rI2WPH7F**;IOnX!zf_kz+1->SD558DUg0*j#)?x@nF(}-*j9bZ0+ zy&838@m*M*RM31izkX|wmQiZ~^Y|vImU)XMg1m#!D;#765bM!QHp&jpx=JOIQa(`} zp&zpWHQE?|_bB6-B4%7Hs#bPn3m91)qhjB<8$IkCx`l>2>P$g2ey6y-Xv8T6S%D&-P>1-$eZaeL_V0TK*jgGDM$~ctiLPm_uZ4aR1DkWb5oG zf)S@8HaJp@nhym?b~6lUMpN*$B~N&`e*iRc<#hX$*`l~tM>65En@wY>8ns9xUEz;bKMj* z770vLQEvpXSTcnjPR(33W5=C26`=BefxnKw$id%OD0U%%z(r~fIQ9nkm;PJyo@3!( zDVxszSMZ;6y=vT@hS&qpdsAX#fAyb_yJ60MGj7RFot1A)t^O0j%~Y#-a_9N7|KU9U z3-a>md2VxYQmx0F+-tP#p|(4}KkFq==K>ECds&AI*eN6I-Jf8U5^&E%Q1~||5 zl_owoQ6lkKu?6%ybfxUzBcNl8XeyH?8ZBLX7t6kmAx!_4JE02_S#k4cZNce~S0n+; zqNllH>rI2)ma+AwPjm#S)yrDPqTmt#;+#Bp822YpdUEU7lcIyUIhmWmtz%D)_2Fhv z>)1gN@4kqan74VH4@-0f`pq}Qo++b}Q#eq_BB`6aF7dupP7{k*WPqZ&97J9n3GSQq zOgL~P63mb-BO|RFi)uh=T(f9K*-^AX6f?bOtZKJX1QMzshHb#Q)hmEnM zsyWIIr-R1gPT_uHeiM^g;wa#|vq+EyO+UC!V6FB!t#bD{&7=&_Vii4FwgQ~xW< zH@gzD9|q2{Q!Oot$MXDx6=1Y{mFE&iM#vk1Not~V^o`A|=BV+0WAPro<@TCWmDQN) zT$WTtWlhu+ss z$pVH*NCAp4-QzH-pWX~4K10Mv@8mN%{XiHm5&xXYfOujgBsnJC1n6TsW zRY~8&+yd3gv}~bi3#Dcgb%{@pvm^wcjVA|tTUiJjVpEIyY{q!R|a{E&d zEnYyFrmATXN@EWq(9YT<-sN{=*9*-|bdpfuk3s~kV(6!kK_T(J#13!tX6Pm~bEE_) z0IQC=YDxtzmFgEyUPqnZeN^WDf}^TRx%|4MwwCeprR_(;-o3PwZT{k3WI6LI#jlP> ze|K>Zw_Ti;JfwNJABRq_Q1vno=i$R)Dsy=&udivSST7RGX4jgZlK;edv>~JfG?nUc zc`>6{;qkkXj3auSi}{8dNffQrOlOId=ef-n65A2xvfM@`rYnHM@y2(8?svy^&_ni5 zd+iZtX0kDMPfn=mQVn6(QXz$ES2~t+^&G%{Xah* z(XRgg)ZgT0ONAKBjhWV6O8~gp5pw4>I52b2**63IetiK44B*2t#5FmTgQW+aiWw#vSN8Y>``n%V;<;aR& z7RC>r>t!7B?iBNdG7h~!2|F13AqdN%5AEvqB5pAb{ga!7?=k*jfF0_4uuAq#*4r1@ zJQ1_6+GdW4u|iq0GpFY0^w8ISS%oKii>f4sX5x0Oq4m5LonRMh6D5aFD*In#)OYgd z5KMnpI_6q)HsRTGtvTzsWXf7)#O`a>RCNwPPI|iYd0n_f{fxmLKgK`%wBzz%Me6H~ z`fdd7F*<{FO!n7G^U54KJa6gQBG!D@((?`JkTOR$ah2mQ_K;hj1t1;1Z}B7lLP27s z55n5T0if*TpK!y+`X+{dhdSQq=!U$_>-mpYD8ps_F(>vg(yaYlY}M%r{BhThZ>amF zM9qb&e`444@ytlRSV|wUt{r+t?$*fN-Jdo@ZP!kIy*~6#r+f7y)@Sa#%}FEPQ`nX> zLB7UR<`K;qM9&ND*f!rRFhTx8Tnie@zOQ<7h4e>KK~fm^U_5;wMQJbyv5CBLZh z)Z1qTxD$an`G(~iA(fTN1gdGLN#+!_&h4Q$Qyq7L!m~~w4@0(wzPX{wb1aTspU1Hh z)h!ptw)de++G6+$m&fARbd6)hXO*(VY9!4Fc}w|@i!`5Q!+r>pd=_bbE?-bca~D^( z@2m6UE9%i+pMZfxHu%C!yBSIwoesh;h=lc=dxACOr$cxEIg$VZrU zueu9ym&dQ0KGOK56)^I_e0oi|ZuMhr)qb!R`3!piR7d5MF6C%xD^`kKOzcnNx$s(@ zvD2#R$}Nd?ubXOG4b15cQ^gsiECS#YJDlWj1%P`cdcc+bIhTlCBY-K3SG0wZ4ZO24 zGEOY}l<_L_0R7eWMJi>ssdg4^1#*}&T#~E&c!aTBufT}C>Q}w^ks{xcrV3;07tG+R zY(F4OsusPm1LLb~`;iP8v91sCiZ@La_!y*95hASD2d2rY%gXZisy(=wALq8POQM}( z{i~YFsTbG;e5*KfM_np9Lp-K^rF;5Y@Nlfgy!Ns(8_(Qa^WZvf^t|{^ETA)|kiNy1 z1TB(nXC}HD$zSbpCinb5jvXwkBwl7*shlXn2gj9X_U8Eu?O?C9XO_jEhfd#0->HFy zGm|z{TeN#CZO$|^PwI6uuB6Q+X{KEIa)oDz4>* zrnFdFUH-W;&Ig@Ex}E6f%#=>b!MLr7O++cDMgCT}rP6X`^K<0n9gTK*{2*S27xMDZ zvGUrn^|g3h@V@QqdvBE|*Z#5ZvmT}+0p{c#GG>cFn7c1z5!2W9Vi9xS%&~~eD8UI1 ziB&A(B6WK&x3Gw>aFg(z&0jC;D=~biTq%+`m@E00s2Q%B5|a4I8focPX$g|}zPgjx zO2(!5XNPYK&*Wc+ZFeKuNT+HZq+0d}q3;wFCsc7R zbY^Tp(XzMIo6`#3>?R67+i>*`DbBt5RzcAZdKc|4D0*KN)ffehzEn{B<#*IKyH@9W z+fq>MeODE~SWtXVLGksfIM=0d1x3H_UG%MjBF|3M=)8hP%Lf z=Wled;yJ<2S!ZHhW+4hfLP#c8;}cXiGf_|`S7zQ6`hM(sJ`TNw&h{a%28UX#3mt4P zjeaqdI3RJy>kbj9-Rq=G`d4qYpCx^%@sx=CBY98gZY4x-B=oSB^v3MU@ypv0l7zDX ziu@xBpQMAK#CBqY2TJ`^{qSjGah1R(WAS0>z17ik_jb8Z#L{Tl$+euldb--4jZeSB zIpZr5hIFXsZb#~MXeCchE+OIH=yUP=2lhBW*g}y!QW2*Tq)pm(?_uY{-4d774UzSe zjhtlb(AsW&MbwjfC7?EoF;7bLh$S0@>#9i)8#AyFL)+^r>syD3q0S7BhsA6+65?V} zroLmLR4={2EDh%mHFt{DwjQshHGw9_ma4eJoIIiCC;d}e>dgk zv&%@yLFM)Kr9ARS>^aq;#BRC=ETd<*DWZsc=&eBHQOrzTHjNX=RH#*NsIQ9RZhkMS z_LHdXIC4Q|m;(f+h0TGburKmU& zgu`#k5ES$~^%Yg!D;jaHDjS3UmN|&14cc|p^S(_K8tin$h=UQL8t-@+`ulmsA%U|> z=b>&|KnvimKH$$cmb-%aWXflm@ zN9}aJoTsv({jT$5MOcnmjD81>$%^APC!hCflo>B)&-uYs-q^^*+eI!fr$6`P7plwG zvhV4IAU$$lmQF=)9+$cz*P%VCL+vtx;LZiNlZ~u0;@vLoD{p~=q*0o=-=#AonZ#a# zg9|ag_eWj$Kh-Hn*fstQJnWM^~%l73$`7-vKtIi}ACb&H*l{xK{^pJ!BHk14cI z^~XLHJK-1tqhrG_c+b_h#ryQU3M4(CUezf;VpAmUXrJ?CM7prGR?%jb0yQ9d}Vs~yE$xd?MI9;J2Jo4@T3LW zqJ?YAGEe2#H~KmNB1OY7og_#xyqfG3!14;+*M%2;s;|az`g+NK($`wHWp?HIxt@M* z&-|ZH_p@F6yGfnrk?u^AY#9gWl0Y)nsJoT9Ky@nzz!4jqxgs(Zz>n+P*bAVS=&yhW z=;{IGr~31#i-)k(AUxKn;}20c1-Kx1Y5Pw72_c;%soc+mVBcVQa&%Cl=JgjvI_*a| zJ4RB+d@SndG1VCp6yV#er}g9 zdH6<8NG(!MA5;8wBP=#ibAx)>HB1bV7qwxcAD5>6lj&kEX+A7(bF8}U`}>cPPC9&# z@Z+Bzf}r@$;~Nx2mZ^deKifyEf_@ZC3)@B0!W~6|D%9OgX~NgWU+=N5uJuP~UYdtzyeJeMO%Rc6La0K*`RU z88Qq}y5nj+MZ_L>sIAJ=80<6_ep#q+@xUMcocq+^vc}*uM&eW< z$ce+J8;fLf(7{zi{YZY1gY~CyAWF+8G@N*wi{GeftNU;;cq6H=QUl7utM>E{uS#<+ z*o(%KLC&_{fZ@0!66}oDf#Yu8!W74S1fQ98T3Yl5KiubyE!iHtFPMD~N0QIPqGHqLG<3iOkW0g>GA@{2 zLrlEbh107MVBd0=G=pU(WTtKfP9M!WH7#sG!D(|eL2wLDJB`J&1qlN$hEpY&-bVr> zc|G<<`gI6DK%stCze5fKBS4WlUXe)r_ShHAKqqOg8H$-)WBW zZMn0`GwY4C!8;LaQyTt})yI!rA7X$HNl5FE!#@Mbt%Kt{q2;M(!wh3X*y?JuUc$%D ziP+>?ZTKL5F%m4HUGpUV{%Z1}Tjy7-*!mWgjrz_J_k?;hXp=dN z94kH18ze*5=B$UaR-BvEcc%Rj1q^S6X{}*V&*Uxn7p?gNASjLnlpECLXtz)mtWADI z1xPVsv#>S29lTAoCgS>e)KZ@s!RabA(zEQ0TK%z7=g=eiW1Ng4ZKUp#kC@HxaPvvn zdJ_>R#u0Y^p7>hn;;_v`} zo8qjVBzp;VIrm5p^cOO}k$KN{)oRc6v&5O;_7k8)mnul;bWh-yJI-y+cg+)v(*?tG1$9#JVy>VnS5PfYEu|o9Uky!OaW$3ohUZ2S z-zh1pdGC~ypkVgbOj$hSIKH)(IJuBD#$?TWetL=Cm;uyZbyG?jUq6u?rId%Z^NfRqR!RIIp-|Tu`!+;U zKdOk+mq_Y~im42cO~Kb0KOEBiaw+F5M^aO!$o}k!W!Hs_1($b07v-XFbapuSQuOAq z9V!jmw{$gf0-q*^)-ge2~Y>b7*tv8J^UA!l%Z0rpIV)=*0 z?WlIL%c$J=99I$1^yCYnu56L)E|Ma7%2z@HnOMJYM@T3QsL@zVWEms$t_dgBz&*(g z^a_W@v)V)nuT0eZu2W`1hej{@K9iw*AM?0UsUZar{zfk+j)nnTwH&Z!hP_u4SmwQ= z!k_8SItwS(1HpCPM*GA@wW}a;q(A3z+F$Jo+gCa(9Pmd%(P|s*%iu@O!0R}-viXQb z_hM@!_KzxB0WU8a$#p!6uxSe9k?LYNj#T)=*47m>wn-a{=ECQ~_PufWp*Q7W`T%Xi zm>@@1a0nF5|M|Nmo^bO~5mStohiEZue{+gza7Fp{Fc5Kx7-oWUF-kl0c>&dhxj;V` z9VYB8A$fJQq84kH;PlEU*q*mWr=Pmghm_UJgD+xMsGE;@(&``!>3@U(J;9t6)pXuu zoC>8$BshbIbkxUpRkRe0>BmSrz4~aq=;?QdzsNVZCS?6&u+yIZ+Cmj7n$Swv839bLt#o)EEXPF5o5lv2)n zMJ~KyTR3=R&Pl@adzrKd#3UQ{kmOx-9k~VCS&Y*vxH|R<`6$DOwkZUN1a?P;v6F3E z&ycI7qV3!HsQd_Sup&m1Kv?jkXUHW|iZ|#!T^3j!z0z0pe2_CNsqEigF%|sQK^jOhn-cF76Q#DzNm;D*!cNdNc1B9sie*nj+i#>o zdJ+`DDVhe4ZY%U3nu(e}0Y{e7pXrU#w1kAu5Hr4Z6+cL^k$mX8V1c-b?^3rv;TBw+ z$&JX0Cz|#`tw;F2#iK+`wR&HWNbZefv%C%xU9RqC$=kekN$z_dRo_*$q}Wxprc2EN zWJfuNq`T)#0HI-jQj={YR|+g`-_0%V{ln^h$lD22BuMa(CJKy&^LYw=7Kx24LkZa_ z$|#=uqZ)>*#FyRLOb^k;ZXZ4N|lVNuV8V%#t-2coHR z*`nm;4&RYSsysp&6*)*(D=wfE)yzK-Dfdw-7|EA97a}RkwKCMOIf`YmX-(Q zM7<)94Ezn1B%|dZUig_@+rGzWBK=PUEpln>l}D+kmqM)_hj@Qh9jPddmf?UkoNDri zQ?+xKAr^zaEQeb7obc`TGE|Y+K38)#S}=iNmNP4g!W^3#PCX{g$vx4z1B(DlI2C`G zM~PiV*lJzE6+id!6YV2MMA2NtyDDte&JAg^RbUljWIdrSi46?N#Dl6PCDc*tmyyZj zaLjL_=1#l;IdEQt_s_++bGYPnRp)wDM_CWdq@KVh&1HA;D#a0?Q@MRi2d!k`I2EgJkka0Nra+ zh%cbxh|TIeLS}R*&BYm3dZm(mTV#kZ-yXpMj`2nNiC&(l`E|RDRf_<>`wksZBET=W z%3;?6RYeW;Cca=K?~{5m)NiU=i(6$r5Px6I<*K%fu2z-aA(a{3SJd4+X;^v?u{zRs zNlFOyFXv*>f~D*+;7D-0W)d$EX|fBr(erM_*FUdT=GfAQi()4UwZwX$>;a26F+O|v zsd2W&InZcDl;=^o7N@(B+)rs@CxrO{9tlqwVae32h3b-Q-H6R+wl3sdGc{gv8kZm^ z)(=59d&xvu53E5R?HO{km2$yk_KDW0ZVb8Y_ws0Sw5Vruq-uB#4Me;(E5$TYd8dT4h?DVZ;uq2hpXMfNnW?oVQeMVK#}~MbtUGkUH~(O5}2k;IDGC zLdd>jXD&A6th^tZOy1i9q?is<8Vkr_N^cjjWDBTLVnPW!9AT(TjOu@_8IYaysR>ge zsc$t!Qj<%G-+d#z_*50<^;2r4g&Zlkg%Ne37V6~e^2n&EoZtI>$_RKXGm_upD%{K= zusy}Jtj>}fQ#SiVIc3|gmg+{Hhw-e7t}mC?x27XWl+VU^T<7OI@TqJ_Ho3eczMnXM zQoP_o6YITcokMD+ho~nx4zS)!i~@LRCUzc>pd&T|U}`PpqAuMK_MvwSD)`16L4Pvny~E z03p*hA4|3XN4Z4577LMc*Htpnae9uwZ1}f%u|B_YH_+FRgv)Ta7t6Ng0YR&_%rmYX z0laP!JN|AZM~S({uhKF^MAAd7YVtUnu!_h62bB@Xd8`u_*i1|<@PK-#q zmBb~@VE9MzkY<=BTx0lK@Ql3b{EdAbqLc8TzT(mdt>9IanzT%w+fKbw&VR}k%j&It zvQ&PXT`Kt=nl{r+Zy+Q}R8uSG-38)_>(xiKZNLP3U7t&*@Nu&K6tYXs!v=VrlaQW~z7u~#Z6 zwnJ~;#|DlXRjMdXZx|L%k1fPF55pz5YZw-EHGLvX)C_*3k~}>?M!APaecf*)ua&#R zTt9R~gbd=fDp^nTy2+n@9eW4SSe$9M%Sej3DohV6Bcr~}d(Uv|zV}PHc(+Kbf+EZZ2y-Fg%-jfAQbslzK zEgZKTryL3HV84+Ze`#OoN8X{6V;CiYebyL%Izr>i%09$$)PSs~Ek|W(L4N0}zH^s>(|MuiViE3&q;5FO(?ORJZn3;!?1HS z!gQE`)o`M_U+mdPs&Puh`&wwZ2&19L*who}f+-J`hl8u4r)TAGNt4EgZ$xeWff+40>#%Y2Py!DbKF^BAcD+y>%ttP2TZ-@1Q_uz4xkeID<$%R^1noO%p2K z()R71gE+Xm+p1%GrEd>6!WL{_mt5UeVbu+GYdQzJ1tZD+q7H8FWpB=&&xjrFLxiR& zrhQo{>(6B$-Na`|<`#mS7r#QFIOq3aYk!t24t&Rja%F#y=V3f3U**>vHT?ZwiAeMb zbpZj3mtX^IRd_0lMINb<*xqf9S}emf68mVxzTi*15lM|NW7}Tx08a`TatOXsa&*;u zC5iWnEQdw37S?ga+EOx4;1BlkI)?TYFoK>W(JlA1XHG=_g0HkZK$#fIFeshaz$t=# z?VC$iyR4WJ|5146;3Gc^@c z%u!9ee~D--T9nZ-1{04X%7h_A(?!aW=m@n@jHm+y8F>++X)MwV9OwbDMbgLSPh<(W zH&Fg5V&iSz4cs{=@6yKLZX-EgAYl9c92Gp=s)Ad%-F>?V&h^4i#`Y1Tf%PQTd=}N&F&Ha0i~D0_CII0%vj)agY%G?R)V5y&uR7V= zJM$Kd>}BDATIXiK_jBU*&D3Hb#F2NtkMUv}$yaz4PPc~}`IlbDy@nsm)FYw+`M>@~ zVf4hVknz{^E3gt>fgaf3z4<9OIv7e;p1hN87LH{zJLvid4S?c^8VN+g&yqK*#O7;l zjHISx^yA2mt>Izouo=$#Zp5Bc))?3m#wUFH6no&Fn^|`ojMfDJ7^2eBJ}xzHh?cnM z1e3Cy0`A{;X0#Pyau%5@F#HKdLR4^soblnrMsH)_FS3@2_$}4)Ce_MBDOW6+E(;sF z4hc0;^XZQ;as5w&f`>dLV;9C{l#UX1i>1`e6t z_mv6CI&AjcZzfUgE~2|A)Bj{xl8EHcR;J1KGXxP<>Ds5cDstTTCKLW-?mm;TkQ?;2Dtzc zyaf+H&zX7O-FG*;S&ZQG|Now!k8IxeotZN;XU?2CbLPxByu6VA z_gm7I$j&=l#PY1-9eM+AzC2`$M=pOnJxzr6R$JKr1E?*R8w1C)r-p0Zu?I2#Np8c~ z`#B^qX!L9ISZQMD7JQB)i0d#B2vy}Lx@w{X2l6%u7!Ls}Fm@LMTx zaRd@~<*d4g{D*|IBw?vE>Jx6cYdLL%)O{=oT1;iRlk*2puo5Ztrh=+Vm4r%&IwhTs z9-^e${tQL1bng__YkIC)bgHyyFP-*sI9c-sAd*UpZwqQvD;|rqLP?8{w$chEU_UD5 z#r_fjyXr@dCPW15vjGw;y`3gRkn(hxCVY?YB1={!l_gz~>K}+yuVl$1sXo44N*Y;vBL1w9H+@K? zujztr*Xci&!2buVO*BohuWeNNx4x2%J5oY@);K z$TDnAZ5=xhwy%7h)pOXIIRy7P&G>-ZsJ^dx$LP;$l_2p^ubSh63vapS2g8|o~$~0Jm*{&KeZU@zd z@1qh=px)di3UA5rj-9iiUVo3AcVe#p7671$Fjz56HFiU=*5|NM`%(J~|$r*5r@%2%3ul~A3? z1ajJxp}MM+&pRk=)PCrtx1xOBtX|*dRa++B{|?PX9}qxt-yzZwtD1=W#{y0()7tIb z&{|{uUyuZLHnJJ|Umo;kC zEop9&r+7)T)Y9tthHKWeK#9(p{Tj8`$(v?P!{yPT-%xUzcf<+1Z=y*xM}R3y8CZKB zeN~E3>5rua-ALV93;GsMowT6F{G%u&TEn1gF#z3jZ_8I|`r4O_!sdZ zc=}n`1mLG%?YRHJ7w2Bsf5MwUj%>Nz!QRWC1n2DJ^xx59B`id1fu)&sB>lpf-jpyJW43rxxYQC5m@F8WK=9P ze3dMzKjGCnXu-M6EzQ`W-_Zx5!GV&my$G)BpDVfEE-6D~rxID?)xovB ztRE#+GA+%2*>Zqd-g`sds)SnN#rBU|woEJ87_Y)7v~kb*c7CCs`g@faVv7sY6*LhSn!*!) z$0P{UnP<_zVCnTz)ZQyRC?&_!MjGq;p@_wL7Fjx0c@dedz`Tb%@$zpTod{>rp7;bM z7;k-xzS@HExfBnUetf-b3byD?!QoQ%$%39(A<T=;}-AH<38+)ti_DDeiiRE*xZdFILHHL&C50{JY4Hg$vac`p)4djU5Dwz5i( z2%el)J-s{-E{AQE`@f5nkBLV29}9yruEj+Rz0&kV3yaLS?7i-a)~)o(Ky~4oPg?h znf3}zUf*nMIhCWt$NB-n@8#^xJ@+dS!Wi3pMl#RWgU^F=vhc_LQ=0*ozSLZaO)Q9mKfU?bBSHvI4Og`nxry_sdmHa8zpO79oSo7CS z;m=t8iM#j}gBho4{#>FzQ9CMCf8AaDndT1F44xySS%@HAz9jE^@aGGZJQDZ}94Zt( z><-=4h#LE{yucgE6svxpYi+ChhMl=J{~V7bT<+h-xfTYJ9#M091J`32d1D^Sk;oyz z8>Us3>@{j?co8$coJz(sADTiEdr0J<5&slv+L#}Z7t!BpHD`5hrP!HYC<|f9mmJYf zs|?%@(0?iX?~_AaW8Qe-Dy-pxAb)#N^~E7~QK%yA8m`Gecf_A-oQ&`;>OJ3$-0i2@ zH`2Yq^K!VgnPt?T$RUXMmH9DNt3$-wUV#TP=QwLpfj2N=h$%W3^xq18F7O$~UxKQT z`^r#F+P?&8ovNvNq*BzG@>76KnfWTr#pd6fSL|%a@)ej5vX_mnXGl#2;sk*-bdn;X zmApNj&HrHOd2p=VFxZPUO7R&`40JAm+>vkIq-v-juWBcux7vFe^Ovf2PNALeM%rn9 zLRR_{Ja>Z3o!UQY#)ta$ZDXEoM1J;&$;&4wwPO9DYTQc0a>%`qZ2kPQAUFd=zf?kFufCFLMA}!do{+`cr{HLcTFi z7B06R{cMqZ7-GyTv_2H|mk-6pynO3JSx@;e)|i)VeQ;;Vhf9okJ7swU#`w(gmuG>z z3getx22V3L@mYv<=MUwH_6%urRcgJpqC2(s6TcW+y(KIJvgzk~&ImLNf%+vI_kWo+^~Po1_|PGgg0lEJ_47-Rm?JYC>iOpMy+SXa%(YH^)ICu9{U zGQZ^AvbG`i0%2HsOaK1B*FZy{seVfj|JDqSLxhE`ovh7Y7YY*98q=F4rRU7U^^3s^ zmsh?o)aZ{Rl8Va6C&>8!{3)mc1E@aW}1Hmzj^0LPH0Y>50# z!iFS#25iU^xCQ%;z}TD%14D*pR2XAcnU|AT5gah_a*>pq z?S07?G^|_{3blvIle&^p35vs46D~Mqp{aZkyNv=g?=DCY(&R!5=O~b?anI{aF<}SgiUOPrfup&LLc@pZgIO63 zW8Up#mZQ*HrBE$<1upr?;|O64{&RS=*>ue|RV(bgGVqZH$HJ(aDuWm1c?(V1M&7$c zu*&&|^hP$#_+6FDQ1#yQmCyx=&>M)IzN;W+}A<{;l0HCLc747z?t1LRo9%bS`H!oRRiFkcpq5j_2! z%VckGcUc8%e^G^)afIJkNlI;9g%}fwa*Q(7+8uKrKCxY6fGF(UMTh!XR*0(T(a z6RJYwnMT#CBE2*jd$DJ|bG!@r@$4(;ap7+cLYd0Lj^F47Du%reE?z@=V<0f zG*0eu6n=^wh28TyPpJP;-SgHAkF2t}xP!QOyrOGw;3qleI4*1JNp@9Vdy*}bNfvxX zI_vu6QaUS#?9x%xrI)x0g03G32JoHAMM-_lt^gwNw`RDFiq+U~ctayk^BnsoL7lyU z-NwBS(rm9>Cn79O#{mDeQnmrxAO#tN9Kl+Vl*an<7OMR0ZgQZU9Vn-|8o?dS3bnHA z7tuX`>0=a5g9`@+JiwDUpvXM^5FmTRFZ=1)JXK8`UDM*b_M%Y#Q-zd*t~F%zh^?N8 z73Om+>KKspQ`h-Icgk1~)tpXmb|23ym#HMT9N#n+oGQ&g>=4naW5AgL5lyM=b&Q(N zs1pt6KjZ*XjyUBE4|3gewah07um3P_;PltVfrWGqCU$uIZ(<(!X=Q-jQ((Yb}!$F0* zcp1GyNpm5p@S@63FGZeZx{Jap?M0Q&CUGiiq45tl)sgVDyT>& zoW~-sTkvq0gp(r)6_JEFACb_H1m&mNFT&2H{Kz><r1Q*GriMf0A1RvXm}!PbQW z!rxE|8CBQnbqsTxu{mm-b{O>oN-oA)sUbb+D(0c2VV2yrA25{Xs!temb${_h-aJZ+ zHCUcFOPSXK+#O!y@2B+Ri&66$uWg%j&-z6=u;D{G@WW*?rf;ZLRxq|@_<8rH?@|mz z>eue6xl1(z)DMUCz}oku&0#`fsqh zt4)Subst`2Ua$jVZAXL*mOlPNI*l1k9#U3#4bp~LMj~r4-y`~!7v%d$)(CHjXhH+b zOot})I+>_iZ;wA6=B(4cum`1<6o4z-M27w~cp+oz31LHJ9iI!5CRf0wCakDYiD}{2 z@3X8pYX;9DcLj`af?#N}*l>=un3&Us(>wS!f#4Hdvm>h*JV9(YmHq3z!WQ@{>dM&? zq)b7&O{EtgdBI5~Ihi6lM+owHK~lk%j9vA-^^CofF)W z@H`0-g_%E6d}^fllalKJa%tW612QZ^j^2{%3aX~+gYb&jkt~cXpUtr{syEV#Ws!ty zg!BAB;HT)@+DPMkk;bXM?X0u=7EMrnd!K|z-+n>yC9lY4NYu&^zRmjYayO-;zDQHN zpi+ce7`N;R?_Mu+OiLV0KJ#HH6caq7=0Q5>OqflA-p_S($dzHEW)JWpr+i0pq2Ibw z*7G9xMD3l!Pz}i`-&YsP>n*&7TVI#3;&@{`#2uQEuGfv1+N1+3@c$7K2y*PRQkA$| z0C4Q{qI$c4H=Hy0rePk*G3cxvaApx5)ZLNxboXHh2iP|H>kbhoI3;UmV3pHMAOv?Q zrfg}|`E6(0dKCnh!gplD!uOelE3yW%$KNV1l$wt8+3v32o{5m(Ygkj+f{{lfaj7^V zf#$*u3$g~bZM5OUTz-(~JeGdJzh|j2|6ZnkIaVAEC_J0X$I&+Awmm3}zAnF{{G|eF zL%?X2yVqZMLcZYz;eU(eEGs(k5o?5_ussP)FfjG5Sc4whjHHc> z(SVNvOtWEXdyXOKS37r+!)#Po;J7{|yEsqb3fX$pZUg{ZA#J`VItd&lE=73+t6Jr9 z2gc=`@AqPhC@}n6vc<0izW;N%$oRu{MKa-W>sXvh{%g5C2vz3MKy12n`xJP$*t-Q@ zCAyyPI60Tn4hyW<1ZBK`DMoH&B1hF`vDzL%tKFW$1=B zXQ-BNT8$!@!nDqtyG2^8+x7BWEJqJWeVOI-_zkjG(TvfcYjmEiZsq2tTr^~=bXa?5 z&EXjl|HE?L* zFTF`YkqI|ml{!&?FyYQuZ~44cB8*S-1k2hzLW|#M!VPM>#%h1eeDjpA$jWn0xK^cx z+omVnit+`+*&^0)zMEtFvjtg8L6$m0Pyvjr`6u(Sd_h)T+Y)=;Eo0mz&hXXdc%^%) zQD~2j`#|3Dw(!4J{y2JQ`>FmOxvHdw6j^kPb(*^rWt%(rob1h1G?{fu5&9Hg#YW*t zQN@LZ9*Siy%~-D-pD6Qz|B+%P`;2)L)x+yECRrB1Z8Qhl{Ia2q*b|0s{Y=%! z20#4Fhl&egnyoLIvcrejm+cU-B}b&un!kb@)SXO+W_UDO(hOtXHGuQC=Nj|pNFrVV z(4Be$19{?zLDz$X8^#WN}a>lxGYC#ouLuVDF`A))7 zG6xh@L*VTN=4kTi`el2p_e(`m|5wimfUR;7=F$R1>48}knNHDh^0&b3nV{%+DOyKS zcVH&DW)_(LVaLfj;5e_e?pxq|$f!9%=2b1Zzcy;#QP12hDC0pJIgcK;vm&rhLK2mp zRvTfy1@s-4n}rthJw(0k8zL0ylb!AM@RENCvt8yd-OCkqE#0(@mO{J8CCv7H^=9&> z6jA-z-KfigURbtL@p5-W^znZu}rR0Ho6!#>@aXG%;0?yK$$zq3JRVA~w0xwON~1dHj9=UNuiv1TR?i|H@t zNKusgYFHy9q!wz@S_-XKTwugP@=U+0vn$D8?DbiH~U%j2A@$|L@Sn_L%?PyUOI z=VDt@!aiMPlo9<_?IAM%Z3h%V0+|vHM0TkWiSXBGnWJ8r1~cFBW++~ncvR!FDSYup zHFSt^zB~P;x2OVm4d`XmejxdCl6Q>SN2m>AXK+?6sf_8Z?d)-(p%)jyPir-sk zlP#;Vi}hU-LE2P0Jgt)8 zITg^AlDp=X4j@Hn!FTAD?!Z1Zcg%I~Npb~pdCL+#x$Y8-Mz+EKCLNrK-GLjHDB|`i z@er%_x4U79E0yt+zaEyjN_MJ)+D=yRV&&->14S_(+26tsR~Npspf{ZTb9cQ+*;{)J zd%FxN`^rWgP&V!2rQ(1iTnpt}V^-4)wMCG0?kpJ$g`{C;3o9?A#|lZusn^4KRb34C zQ|rF#20pu+GRsGMD_#(LQEtxXWJzC}&ShbjJ`;rkTT=DhWZ$Ykx1jA<)gN~NUt21Y z!Z0}-#=%z}%su=p*3N^~b*hrL@vqe+(+-f@ZByI2D1T$x+&)TpiNAn;@%9C)a=<@C zzx35fMfxpAzZLTqbREM>z+a|Qc9tp-Zj}cQ=SGKK2ay|rkW5?r~g6Mdn(gp zRbYd9zC{;Ut3fFbIziX#`b~BbLDz&I3t&0ZqMbjOq^ew?-|p7=7V5WZ{r0eaGe@eN zzvaze`g^qgTCn&znc#@WYVxd6Z;$dOJ8^5Yp+Du{un7p_{fH4)x}4e#;8X8jC4i9L zy>1Z<$L?MYNsR1X#YSqr-2Fl%g?Kjjj&}RMD)8kiA;sngZrQ&!RwJ^NhWD3lX)MWE-X%e)2IM$PLOez!Qn z?#LCs-t~qyVd6m9uY5XvxWU!dj6p#K?ph~7UqKH>cX9M_!M7{Om~z}siBPOho?KJGsM z#3Kf@rGUw(K1#`Xq5cek>s}JvfdSS0VZ~B@g++}QybS*L8Jku1->yF+GvbR>SXeF_ zT27d28>)uDk8e_iZJFU__4cND#CZF@LU8!tj#hPRp{c~aweYnpn*|25-bXVdjB0 z@L}eNCv@qca;3!(4s8kUC;?5;9{dT!Jel>PzSALRG9HSdcf7HUVO9+ zxOzN=M{4&5OiQ6Va=S$$KUF34Dteq0P%C^sPfDeDq|Dp6rTzlB*j=j}@3OsCYjz}x zi#?w?enOfHS3x=8hl?~K6yT`I-T)&5>v4>kFHc0~izjp$ydaE;(#&7WKDqZUi_p3B zA+}efGxp*cKYagcjcA8JS)f`ynls9%K>1T8I>y-S_ahqw;w~2IvI*pT-ojsx<6tka z!IUYd+Zi`c)zKmQL}}YJbl#X$;fGOnHsVEHw;l{^4}Sso8Mem4`Wf&5&d|&z@>ug< zjJ#fBRSo}{jVH7FX_7<_3BG_GMVHx=T1fvH>A}*Y&Xgu^T_U1ucq}3eDaz!Sjac#J z(Naw4D`Y~y)61UFMcXLx#*;||*ng7{EM0nrhORD?eg3Ra$_DdLX>(+M;12d5Y_8|z z&EkV7uLFD7>6172bMcwC*K0iUk@D|^K}Lfy|Ho=NxPBp^g=xqHh;n)@t3J+nL`eBF z?jJ>D)!!cxA?1g8^b+#N6Z{`2it9Jpn8C-^({#_>tY$=}Ctu7?N?ym^rcLp8tW^|* zPSdElRMAJ72(ZUInWY@1`TBT7gJjJpOu*hXYQ?FPzjU%{h@K&5NITRF8OoCfy^~U8 z2M7G@8sTC_Z5{PTRFg6*EPa2_^%HW4oW`C&Ri*S)wPeR43we39+K2jgqo}$`TIb)L zTYU$=S)L~HP?r^;k-thlqLP`9kluq2N=V{wfn=QNm$JMKkvIMp$zR+YF*dvvTVKoM zuX#y?zDu@pDzMI+$_Ew__M=#?N9VTr*mTjwl_9swv|jQ|WH#1LgD#-Ho(d8~xk=Wg zyWyV^rVxJLiV~;2seZPQw;25D%*x-2Ir(QT-4F43(wO%JPr&wz&)W`q?lk zc&M|W3YMeJ`D9dWG|^6Is~K}3PkNmQ z_o6lCR0vkTJN#Q~ak*Z625(#*AmI3S$R%*TN10x~zbJp4-Q!y~I$5Q9hcq0y)nd_%E(Xgh>;YR=th zl}61IQmwxciRffR_NuLN8zQ&dSdulkrml+pnCt5CitXb)uer%Jl7bX`nI=6LTW*Jz&PzqV&+7tabrlWP=NEtSd#*qvD_m3+Qh zDwVHK)hZR`>UGZDgjA{>OHFg`&hVmfR8N^ajZ{xr7wO24bMAJXYt#-=-+ElDWp7Ua zpJ|OaXj`6b)QHGTjJj+&1b6W~vJ?v-#kwHobYsyauIw6)WW@q%&YsdL%th600;a@z zK6MOU{#&Mm8Ua%-*1fwfc;Tg_~pr&X-mO$2lnyl z2p;A+QpM?0qzVL*;ZlWUTyn7mXfKVFW&3aqsGkkUCx8$G1khpz(A+JI)=|^Nl7V!| z@Jq?CK?b-qOKR%C&lYblU>}sW^pX-`x)W6l?Q-<)uUfEI6IOrL!7zt}|xKg6%pP*wg^t306kM?vM7BfhZYN`Zqh zjyo`NaCi~elC_kHJCgf6!0WHFl`%Iz$q%|7(lB4-kJY9@Vq=-FvcAI>A|kIxVO}2t zGm`r+k~=CticN#KR3?C|yQ*(GD54&GNGA+?+J~Ry(}_6r(nmdsk{v`ipwq!%4jJikH8SbP3O1cjjao_hnEYczTbT%c%JU zxkHPie<6GhXPaCv4%hu|a{b$S`ojH}CfC!E&reuS9J&-+zGs8y7620eNB|Kq*?&)8 zEc&gsAL(_$zx!-s{@)}icoye$48}BUXEBr=!(rpJ{IznZnumEDdN^0^$bYw^(L%XJ zi|bHwq3D{sdk%$-nmeWKK@R+xuQf{q9(~G~{kWIFsg|EzBCPbG9qy(v>PB{Dz@5jZ zJtyMPhdBf)6`wG>TB?jcBQ8T{&WY!MCas26wyXJ^=*{+s;GJ#zUhl9OWpwr=CI^3 zg|Uwtw)T-o-R`mXb< zYYf#tAb+(vLBK`iIb9BTUvaPLSKyMeQ6705?C&kQT7eD&wp&AbA1Tk+4N8@i0Cp^Yu!Pug{)o4!n=h<*nNZ6 zLNy;@UMO2Xi*XKi2nejTMKk$Nn z(LV-UV^uEEKL%W0U0$gl1FkXpP1KJ-E8}gJH~6AxAcbcOXAZhnjfI25Tt8H_w>xvz zNwiEUA_K0Ebe&2O8F01gH&H|a?MJ-%OAnna6Iayb89+B`r}fp++kZ*r+Bk2K;{ZKW z4CPl@)eLlFwYdoP3nlg|e{mL-dqR`%f+ktb$GmSoN>cFj?@QZQ$0jmd!2x;l#@_5w z-kMx}c@sXvEX|}cOLTY=YcxxAc>jA5(V>AyIgL@{PJuPN%YQspQ^0zBI{Ni~>#@o8 zCoA1-h04Q~Y~F2tR#PM#64_L3mpLYpi%cErUf}aP5DH%S0kdGqEY_r@^Y{rL`-tfK z6hH0(c+Lt~8;;R@I9U2m#74!A&&M<@O5b{|cw1TL!Qb1OmHN(+uHY?_Rk-dpoP74V zS>Pycjn^=5C@UAWTDH2Ov4VZmCR*q%L`B=g?gIOASt{N!9rH7OZzVaDJ(XIsE>!Jc z&1!ql))z$m84|fC=o(5(q|N!l{m&LQz(v3uky81qT=rQ!U)q@CFI|gHTx$nTGirat z?oAY3Jf6oRygU5#pM(kZd9Vnu`qq&#|9cF3;1zC#aR!dY5cuBEP4xA;Q!#*2fiSqP z<;Cm49!*eRc`tbZk)4wAx^39 zk7}Q@ob&yryt!Y`;VY61^?b4H*MGs9tCh#apFzIYKg32}B|H#G*dRMl4+$d3b*U6Q{*0Uo;i|+>m)eC-mL0;X^PxO&Qm_e!Y$(aOm1;tf4D^0 z1e_(^MNzpX6Oce-de8ZYaE>8HD6`==_v6cB4Zu|_qd=I=T zh7ef~9riB%Pl|)C$Bx5ZCwNM!!o=vnC&mI&7K^Hl`)_*Z2F z#`-vnIcARF#lIXM-Eo+!2<+^PH>lZ0n!ohx>m2wBL#r0P-d9V9vP53{lu%9STgP%H zwspy`VUYM5{|$z2C?xs*65p3RslP6eua^uylFxsX&-MEAt$eP?96GonbK>A5{iOj_ zr$)UjUmErEq{bN3>)jwc<#J%XAS_9Bf9bozqpvxOM0f%`A3b;{=jq~tK6=-(2R;@ZTgirm`> zm0_2bUvL1M&DqFeIc@S~U~hu0Z(!BMob2Mr<|}vT4)kQ}eYsag;FR!8Kqixp&6rD=zADNJpS?W`ZP6Sl<>i`1ftaG){Gebs zW-ff7s9emA%9c!k)rbL-Tg=JEN=L>EZJ2|C2Z(HqCYU!cSqL5dE4M5qpGa!>jq706bC=1pSs#+*NHptzI+9vc(g?fM z!;Yl(U&NI9t0U5k+n zDml`Tt=QGreY`t1=}kvc?V~ZR{g)%@`Nvd!*E#BY(2=}CC!ga;e!`L5s*)qk2|AL_ zXMtcuUO772&ykMg@jCe_M{=bj`Nt#^s(P?JEa{H4v2bH&+5kt|VVq?-({^7QMbHqA zV4P`xb)+5okJz+&M_LJK^km;r(Vk3qB=-_EdZ=`hBiZjrKH}dhxz3S1(UCk{C;!fo zJlc`GVUa3*k0W{KHPJ3r$!)w)=?#wLY)9#bbaI6wd9kDPAJFzw`UFSvN=Ncao!rBb ze1{|XgSS=bkB^L^CFn?Q*U7Iql1Dm{$E;VSpK>HuI+CAK$&p!^;YezKS4u{b204;? zx5Omvy*i4ikV-1OT@Iiv2Ju%%a;r|h!jZhhk^G@f{_2Qm>8Xz7ruS55-g6|+aU_q~ zD9Lw6Djx1g+ZLDRcBJ*(6kBenBW;UHi(p|he)?=iuy}I}7Ir$4UXM-sizBJ>KQX21 z97)f|CjHTowCzJFRl4QyC}J*kBrn7x7s-u|c zlA_xY*&pVF*Pkvjr{wFe6RDbfu`n7sxa0|Bj57SZZF$3+F8Ga<~F+%VaK5#<+P4AiGgz+6@uHT zhw~5o`e?6j3zfcS0iSw>^eZ++)jIVGI-(O)TO7q+CE*Hs=UeNk-%KuFqc`^z+6UMM znrq`UuzSdA_u8;R?FC3dcE}$^PaY0igr2UKlcA8S1uKkQt`a`V@ibQ>Laxb6<(jdsPw7_TFp!07&8$ILM__nG(TO2K&HOc5_@NeKGW8g(N!D{iCql|vye{|fY?P5k?42jjit1xaE%&n(J!q!IOfhxNW-DjgpQ968w{7Ym-A<`t#vZ8(3T|(f zhOUY>^g+s#?-(g#HCTr>Cp1#JXYLl6)SkIpWuPMRJn??=jQbu^^C#MqsSw(XmUOGK zwzbLnc679F?+K*YW1YR+Unm>U4_Fv_&%7CWbIb>7mWkB7t6?7lTm=@l*I9iq&zGzk z|1&m7V_VYAyMX09UrB^N#w#KI#!19niiLN7qC*{uV)hcjgzwR_!IjC@Ykao`0F9~qq5}q+t@4G^JM%l zHI#=PP?FPMUDx=NYFc`jBY~9)f4NEUH$ck9<1bs|j~lk%c>P7np0S6@lH>0;99i3x zlMH{Up^SGxNshlcUE@!xX~{PCqPk9nKZLu4>#r!lJK+y~tk7RhH}FS2GxqS49Dmn{ zqTQN#$?%sNO1=Y1a{Q%rjX$ZTCC7Y;{-(kos7{E#2c>L0{n0kTUv4+>2kFh&LuJYF zcQiGo!e44A8<-=XNl!qNqy1?JwF7YSTwDdGb0xK2%SZWgDPr{OQ!XG?Q@Ykyw_+#mv zv4_f%(dSV zvGtg-hsu)U?`UdFg}>BLHi+3nO8GCXwM+a-H7$M2yMUDne{A&<;*Yy8o$-fkFZk=* z4g9h7ow0|?lH+fqoGqtVe^Wz|`%^ZQF6ghWOZ-VSEq%?Az)FQbR1FF7H$ck9(;s_F z!Jp9${GsQWv4_f%M9$8x&%V!WBYIGU()7ug})Z5W`nU1)Vylz z>vrMa#DmXwd`yl+2{^njCZ4{&XyhFF1@xh7xU(?OSd=xW@D=W%s_X7i{g<(*udyhb z6ieThSbvC~*x(=f!{l1SbJSiT9-(N>pSTa zl_n63bkZe0DOW}hf9!=G;UwXH_8*RVgzg<9vym)I| zlw}x;`u8ntZj7c23DJ;*^m>G~-%Ft@lom$pMHH2tZ@0;)7_&z|P6V2nb@+6%<=s>VSiL^ zXMYm!-Ba`j?rHVsw`zBks6Wv>cUgIo_D5xv{$$ag5#;VXKCtwJ{ZYA{{Yku+PSGD$ zH>*F*YM+*-NILhK<-e$WZlCYl z^0dk>{Yk5S#DeV1Kcke0c{rUhWcx6P?ZZIXq^19yO@wpTmcy=1-+%gs`!#>*VW*$W z#?ci%?P6sw@+zag%T>-tPK&j@h}hBZa_y5lbx@=-N&0b_GD#}KTK+TtW-OZb_>S21 zj=w(Vr#))w77)tuCCa!vR=7JFI#yO~^(^k#r~h*YiQTmV1Nr*O^m@a8H`zSH>ML{W zJstH`)7=4FW;I|r@5nUcs%Qorizmo1BANjk;shBEk7gi3n#y3#z&HWB`vn<tnJzr<>-w$xJ<5GlU>)tiLTyNG$8DoVls-8lmmoEpq**ttcL#^BOFQ8LTF5;{ znK=rif);*m&OW&)<-C}pD}2MQF#HS2f_I(33J-oMdN8Z;#1hybo;CZ|w;zMYd|8Z# zHLj3bM1_s+8@>wvt_WZGC4~Fj>J9Al7-QCnmzY3f_<8!t_ZdTp!IHir?G)~Lr_1}1 zT)^Sd(^fo7c?vh-Y|&G)o?`36`9VSKr@kKLD=LO|$WY*u!Wq0TzOf(A-p8Gl6@+o& z5)a;8R4Y{jKmS``gK8qZpxN$StA{np<)mRNb(=puHQMHnb(?W`(HM5oW}yf1;}MkjOSd~Pvf^NlT#-|!1bF8#PJdp48!$BYn^-T9=SR& z6U`2GfAU2@q$P&ABMD%f$#em`r-H5MO*-i4>O!iST2{vIyJch5?*#QbO*+~rl{MpY z>MSnh&yk$cs&~tzr|*^(sNbTPj04)9QS3E}V(#OXNu71%{&t;$k#ZjlFW-(Sj6Y!U z=YBFA5g)3AUpj>+Phf4l)=RG9R#$v8tGNa|V|e^+cp!gG`N-&o{oH+Lb;o}0`&4&f z$a~n1O58`?a}jTq5?*+WJmB&@MjNISc+T~Sl`n;T-72oS=zjf|Crg)^qRc~)GIds& zwukioI+49tGX2>&%F@1LqMe)07uC6&+OM$$@KKdkKY3b?In%*13hYNa; zYBeoR<|!5aQ^VVa>8Xa7?|_#W|H{5k@ZWd8@Gq5P?{^n9q{4qP{p2_)8-xGpe9`nT z4{`WUti4p|kMdWc)nxR~z9@w~;1cXnHNL{}mZ=HoKQ+855qJ+f;3dYtvJVve_t`J} zOXXrOxF7ba$@Hu1EPK@`|M{FRn*QY>4*v*pLjQ5v*KdG-_Sq@y2}e<_MgKgdqW{$J zwy{UB=-&Y^G5(c(q2Rywe&Js#$KLQRYDh)@s2~#ZpK($)mj3yo>0ch=@Gl}W_>Z?l zR0FVI{2#qd3VXyQNOl(ei>T*3SxrFyso_nDz4c1{^cPK|7br2|8d&wZ$SU(0aMsBj-pzN{&`A;|J3ldq2aOU-vKW% z{*`^B;GbZw`?3B?<=8vkMGdLwKbgLLoRp2Ff4*q?mxnm~C)UP)1N@^`PGJwZ1Pz}> z|2(C_e``R|C}$H{^cPK|A|iz zz5)JeM+$q&QB-TuKToOfpBmmaHt`nyJK!b8zp}3s{O9Z!{-tv4E$^a+RP>+hJY$@c zjlutPzG(WFhdBHvKJEAh_-7ubu*Y0N9Txqob5M2bNZ-s!!2eUjn-YQdumfHa{EL02 z;6Ho6@Gq5Puen#BSVq>rMEkE~=P&D|Yz+QC=ZmI)d5FV5Ln8b??sVoG;GcCUg+1pe zs9kkVzdXd@ zpBXIpkGBL>0}vViuH=8@uoU*7OIYJA`sXPX{!_!75`h`m{YhE(`Zb{;oQ%EsV-I$t#X%R?Og5s3u<@s_CjkAL>z zDeO^~u*bIOU!ALV&Hq!wn-YQdumfHa{I^>8&)hHkOXb+B?nNt;3jfK@57$ZA82o?E z7ft{25Ql#xXu*HHCF}mp>($S4tPoMUuWSzW54h( zm1FNJuFg~8KiPTbI4K*0e~DG8>0ch=@XroX@E>mpyZ`t{51Yasb_rEj^v_c&{HKCf zHC@9JzlSy~^GZ=?M)g&&=0<%#Ic<)G|MdOA|F^N1^%Sn1*(=Uy*7m0vZ!e4ghe0RP zF#JE@B!Zjxch<=HYds%PQRws6#k1u6b(Z9V%GCMmgJ)UiujQ9{0((3Jd}criS!>0? z_|o090z62h-&cpN#3hFEGKt403Ejv6Wf?VP9YSE2ncv4d4#&zP&nzzN-d%8U>Wyv z-Tc}CFt_fpaRt(!U*DD+g+$URBb2B zlX9^&#GAgaGO*r5r8wLwlR!5oi|bxqIF4T7-nG$_u9Do|z^iTC{#X7{@x&Nd78c+)$=14X(Qr=A08kP5ydp?v6T#i=;Ms#rFb z#Hy!N)5SMd0ik_}?6>UvQ2!!#`U-FQ9&br_#%ac)p2fHvH0hI!?XFGk^nLF1Jsde5 zlO}%Yi+lGlYG0L9Fh_~$TLt0}@YI7YdPhtgoM-r_S~w~*7L6(^E;efM#iNim#GOfq zr?!E*f50nphsJgk_s*>9g|`#jFjlp33hNB#QUNWkTjL4%ld!Z*Vb~y)bm-8I_^ondT$- zC#1jb5x7({YJMU3^f#oNpX`;-WkhgYWz^hie?1Yvx<3L3s@$M`>q(TK&<%|KRg7QZ z4!r#{iVPrr$e}qLn&H6=tNNK81aKB&6jBg!s|+1!xOZ*vaKua|h>8$sp7bVf;C(;~ zoeilBY_ANgYdh5D7o^G{Kuw!Gp(C>;oPv0&^rmkQrz68Fq7c-nm~wmQn-IlOQKDF? zh{6-H}J5#*4;hAkn8=f14E@1^3WyK@YtB8IrM9@0@Q-Ppb z?@iw(K5Tp^8jE@qk4~#Pm#|0!EW3Yktd31UIQ^{tJ*rOfmh7ndv@)>uf>733=0sYh zS|RwoD3mp-GBh&HJW-FgH}kH+#ilrIx7m*Q_pcl;m&gkZ$TJ%l3*en;_6Ht~t$|RP z1Gc|Xci?LRlYTPZSTsodyZ;1v6kc1yLFV&h!`uP?#@ZEhTW`i6H1!@#aE4<%bkpNs zmR`JyPkF{K>dKF8s996BseI1J!D&^KNArBAH}Ccy2(KK9X+v!tv4eab zB4(xgM!VDB_Y}TYu3b$A!rsDmPsw)N-iAp&X67XrAdGhh-XR)>(58yO(;9S!*f*vPLhY?1sxV@9F7sA(vGnj+m>sf~XL!oGkuZyLFV#7q> zXslkZkrIKVSbB8*wATsY>m%Xoz2WPo z2n`>OjgVSLBu>eglQq|6`oM7j<&h9%Fis|ZKCfxs!kykimH=jyJyD9h>8)M~B1YWO z?J!ku0Dk0Q=A;vVm`U!Ds6((T#f0%ds_}Gw=&Dl)j$+T6j_|7@C<`ma1HYa%1dvrE z#_GTv_mr%Fb%LS(Lp1BeBkas#W6@b<#iNYc_hm?&yfaGwYTm#=Rn#pZs*>f^rjTv{ z<|M8(#X;eAhF`9LsX3=OXo*oPc7wt^%i8)awE1Q^Shg7Fjw%ddc2tHgWjZz+_xwiX zzGZN+m*%p-Y%=rJRMPXocPaeSVp0+2`LSZ2b7*^-??U09dVPWY1jHLI^C|+Gv=q+il3SSVaI4aG| zp@sIeG|QbYHM~e4{saH>W?nVeOnqdS%uj7vH=kyxK+XlBk*5N-Fswu(<>!}WJ6-C@2|q570}Ucx;imga z3w*xv0qhNugQd#+9w1?_nx@Rmn>s0d;aw|kiFOKG=GW{!0dZVe#4IKPM1-5yp zw>b9o9kl@|c=lY{KL-TFc?$p*VlZ2;8aPMk5TW0$- z-Ibj@J6kN-ex9hNP@E66ZeNpdj%Cnog zct^jKx3tZZjEx)kw}pQn(5+<}uJ1*+e|wodP;Cm7#=~|E*2aVHB3h)8@uALDFM|-O z$Swl)dj7$#3TFKzzV8odK(Sc9KNh+M{1PA40N%SsCF?rtrT2fAB6o0^?YGkNoav#8;sWP;VZ+Q~DJ1K^?4_~`qVE#73M^sICLM^he$qmJX>P9Gj~@5E40fG4@&@TvQNnc$U1;3p z`fm>3(sI%yB8BT@#u`&(*Npqvky`d~y96_S?BnizS)K~_c>-%Z#2hz5t-O17H9$9M zzN5G}3Qs)KY>5x zpi0YPW8iPfBJEPr*aoEe2D*dUgu@f~IleMd33%6Bb*6O}HS0{M@D;{l^{_haxXyR3 z@zN@Hs5d-6op$xb$F=N>XyZV!wk~P*9p@pcMd4bH@e&r6y9vj;In%wi-B=_xmBykq zj=t$r#s&Xo$9mQpp_?1y}2kQ~A%m+nAf&N#? zy<2v=GNk4YbfSg0yWg-;t#0uOML1Ahg{`e>o9|B+V#r-UCw*ry!#lO_LCKvU!Kl4W zb~hT7Q8R#-gt>lX5HM&i{7iZ6M?tgNxaSE)8hbFl{|Z5G=1r1^>jGRHAR2b< zN>AV|-;u*QDj2Cz6$`S8sQ@YK&8ltg(9lut(2+=lbUd4k8jdv6 z!Yi+b?nGphToQ0QeVsdfEie8pz<(d9fJuEQ`F)2V&6Ns`rZ2dxLnbsY3r_YqS97$MF<~pEb>-UWIa;0>YpnM>$VZn|A4sToU(#16U46lI{BGam)6FN zQhGW`q)>c1NG_{BjbB#AUuo(nz~X&&w)}9_yt>C1YCV(J^YZk^R#{&{7nP}eh--CL z-k3bs?%g7p19(jOW>J6(Rt#mankxmcOcE-ym2ROT*ORn>|g zey=gBerH2|)p0u;vZ@B|Y)JQIEHDT!YSc)yq)7p9-oD0w5%3P$+vpBJ;@&}y^_w0R z%(z1ep%L!8z)*K$nj|=BU*oyHlgRI1!G)Bj41oK32m7iIS$xRa*^uKq#2xG_Fu5_q zryTG-cMHd8X};ql^cw8z4UR!QWOxJTiRbys8hudgDTMJ;zt*4qb9cyWh-V zf7xR}b_aUcne2OJr&n!{mv86pksBq|)q&OZrpq^>V(GGin?$^tbn5)S$PuoJ=S`S^WJ59=kb5g zE+JTbt}onwoV3te_^x|bLpzAC>d*W(YJV3gI|sy2-gTHN-%R-iZ=jwM!lvagwaPb(D9jZn%TjL^|vZUQ^%=P8#A3PAT#RQ3d4R zJBK|6f9gb)5MX*=8$pLRaBYD%aN`hfU}}*!P+bgq%0N#UaS3IKP6<2(IHS*fWm0#a z`=kjG;3`_8`5et(n7WE?wcmI3{s7jE%h!$DPsG%UmsmHO$yU(=hrK}=8#Ej3-oge( zTJAzs9q!+9wo&_>+8;Bwob;mu^b+@RgA9J`=qh8jXx=a7-Cs+{}ux%!=`VnE;VYhDfGCB)0+PyfSj0 z=jP|4vHV;%o}X(c@N?s2ex^?2r}{Q`Xwe*@y3kVjW7JmCUE^=+J8V{Wxt_6eNfkYG6%|lIQ{8W&fr;)Qr!w*$ z%-A*OHlV>ippUEnkRIcr8yW4CcY5T==Kl1}`fsVpUvwVE{Dl1gl%I9-^DawwOTGN8<+Y_re%5nStL+u}S)&cY)V_X|?O4d( zs+@W(9k3jM+xo?C;tzZ&J?YXPI8J{KP$zu4@v)x8FDZ}#iT5lX!+$`$eV6G#wFDiN z)f$IS^=0h6tuyZLq`ph6`c#CynDg|`_kWB7HVBElroVZ#(p?=RgqGs27V?p{Pdky> z;usmD)BUW2I#&6#*cvNk+qob9+Yf4c7916AkJ*B}6f>T-eMD#f?GozU!eZn;*n3BU z*_iU3>7nmIrH7@`0wd0gISf*4SK{uDrJx7L{jP(G{~TJpKlJcjwdXcsjM(i-P7j^^ z(Z|q(G?x2muN|J69{LETI^j_vu_6+L`c?a6nv zCpkT+`=H6`!Mgu>3%5d2@rUe#N)H!F3*z|$_SixXah@?#(1YVX=Ru{1hq=kLKlJcj zwI|2Xo-XKt!`#^TaWV3PbszOAZpo#hhaLx&9?q5)#M47hO%HK*S5weKPgyTm2M_js zb3w2DqlfRRJ?&u2rq3?uVQ-i8AdTgItQT0R=)rYR>ETpqK|DQxap4bfcWG15gX6yI zLFEs(Iqr&gwO)Kz?FqBG?gu@zcS#S{ech43N<|M@2bCUzr)`@=(lm5LrR4=Ozv(t>z;NPO2g1wABeia&f;?Rf?5-G0zRYnSw3-Df@$SgGhCV=$)bqcbIH6O_V!Ta0}Vj(hhmHe!mWK7)4!$dJ8 znfRLgtidd#MeIFWFsW$S$ETJz*yFq@)*_tO$Z>IEYmvWmkY`(qMC>!W9senlUWo08 z)Rr**lL{F1t-F)ZZsbilP>Zn}5uft*eIJPyHMKYQq^Gun9F0sdw}~QCoEK|ku1<{1 zCPC&(aTi~&qfku-+QEREXI_9cl7oH?|B2E$XFMx+sLvUvK&Dx9gZ=N9;8sq0mn|-Q z;M>zpLf$#aI_pbe7XtQeds)q|-iER*jGbl0$U1-{V$6F&ouFCK0d6^%HI1}tGLIL_ zLF`}R;|rthbAgjn5I3h#en9*Ml@ZCrVxHO(Nry*lvRH(eq|w z+`Qq?|A3Cm6y-(P8W$hHRb)Mxp$EFAEUP9pE)M?IY5q{L9-rREd~vj3-YH&{W9AQA z&4V;P^Q124_$0PtNI8Evj6a~`w1P9U#PjDs*L0OtQ_}fEg?fB?S@Wlb)2P_-K{a%c z#^)oc%Q-%Y?Fv$k4~OFibbL-!Cvu7S+kvj>B~HtP5|WM&73%TnX^qbaIbVyJKd5pK z()f(A&hjGsE%7;j%JD%-e?Z4)o;o2*G(HEqrX#JIl8z4*>ha07#^+Hv?}`~8j$RJZ z_&i~qtwqKs@wt1-@!|0JfR4{c>clG1_#Eh(#J_Ww^M?xc_~cmQ^Oc-G#f%R}r3Yzz zdeAz6N96-_+X>FWQ;v_c@WAbOjCo_gLE`o2K-cu1Iy>uvzfqwcpKNP z`;BHITgORKmvej)pG&74ADQ6?a(tdpCwz(K&w;LKq*YT={zip*e0o^pqoUr%%pc*o z2WNa%Fdi}ELu+OJ#GMnT93NRB59IjtP$z(i#^*rS^cWnYOa4ZMdVE~g_^7D2G2a48`{zip*e6pmvj9|e6E>td_==>AjjuK+Ld^G4s=Z~sk5;z<_{I>@yW2pM@7Aj86VL(9h~tQ zW1Tfd=1<~t#+2hD8o~oPKJ(NGULyW>pldqPswwIGp+Y@A>DKtDsJAiWg9`N^jn5O- z*5bVg6-DOa7mhYZ=g852z z8h=kYWTpCh`flFE$K6CZtGjmjo~Z`^1}^_>;@;)APF%kHriridZ{6~eO-;+n3pcG^ zUedB+d11@j%b#ysx%{cNHOqHzuUo#`SHJu-->T)GwZF1__xjcL1@3#5_F6}x)aO@; z&*KC}Nxkp1>g@7B^ZlTQ_6_1+UvJ25cnVi~Lj(RvE9E>+s&bsiNhVdh6xi=3+fBWF z{mQjl%h#F}g{zF(m7>y(KXn6smb9ezz~#F^$n7BHRuFP)VuaLzkd@0mxZOThEB|)I zGuq}D{z=lTxbw0e{gR!REjKwY+kZruzSYak_U7fcuU{2KL>*dV8Xn!X!)0XG5f|AK zt}?G3sK7#n#6i0Dy1U+TU^NbgKe~Y5IH%*c=Kh-_5;b z87}L5t3>qkSIT{k2>%v*_WhRloCZWHjN&utDONIkW^@mqZ#vbuG5G8zz*!bRGdVsp zYc68jGFXAQEbGqZcxoNKA7h2&>nb^rht*}89y z%{er)Gks>-_~iWPOm+Us8Xt?#-ro|R%|ML7C(^IX_qf}xUCj5a?qT#)OS!Bt8bhDm z1h^6TRA~#6(`S~APtJQ3ecl|Sua^1V>s#V;4iIDTneK9inuB*SM;_wc#hsfLZgXEy=<#sb&{edgHs=i`>Lx$}C|O@J3#0K33vu8mL57Zg5Q zn2oXc?C~w}xdVtX_)L0=kc>Wib`PHyIn~fH^w~{-`{4X3=6g>YpPUCMdG5G8zz`xnr;pFRkFB_le?-f2rP$m|iS>F<$V}Tfh z&!k%VWccjeJ$ydnRP)B*vzq{~u>f{4-+SBmMBlFP*(N&H82*|0E%7N1SYz;s{3QG{ zE;3;k{IgH@@OiDJ%f2TM=A{0qaZP;- zj*#(B-75a6H~34Z{NW^=zt+?V`KNRt-7Wvl|Ia^lGRNH!|I{1ADKk#0Wo+b@O ziHShy##L%DSWzYragiUq5GVNO5yNdv9{DwJ0Jr_kI=7OLSSrwfYCulg8}@nD)^xa; zZ?^c@Z~Ny$)xHMWxQ!S9+l$-g+kT62#P4r#@tweA+l$PJECrh1k+%Vd{o4xoKE$ku ze3$&0e5a4w3(UbW--(a64UhiY^GvV(JzyyQSS|q|R*x$OX^YF~p?`B`d3`HzK5DU3Hq`JO4)AvK((|tz};=*^1H+Zx=I7OiHZ$*yzFqw4x2ybv8{>h27C+nxx z9~|Sa{h&f(>22_=-RjM4#`FA@S2xoC?~C($+D;p{=aG%Tg~3bnJZm?T+r9QvPp&Dx z{{!`vfz?3Gw-WqK1@5(No?N0FUL*sQ<@+_QD3EOL08{6prpnyaUVmGhTHaJgnk){8)*b1wH+_%MQAJPOUH41yYDPA zE^d2F(NSm&0YgEZYC8lNc+(RA$W~{oYJUQ?Xu6dKG0_$RAuIzW@aU{dS7)A}$f`p6 zFs7CCd<$-tmHssglDdyb`UcVqtn!&w`Z`DYE2I}$=>#{G?wAr)MwKVvu%g%)g1y8h zS&L!`jXUmQqegs~L$H~?>lN7!7P9qvLzh|&WWcAidjfmC1eIH?D3$h0+cdtQ?rT_v zTU1J#gMOhqckTw^B05T@^7{^0*fg}PNFh(?8Mr_fiZqGpqAAZCygEnIZKcE>25Rtd zg4wv&egw6vi9tA+tzhj;Pw1|}t-b}`(70CSL11HL@F&o|Od)`}*KQN&xnB_fAzx}} za|f&P+&Xz}n>V+`!%Cjlb`SAOrtI*BZe*O#s0>~%LzdwQ5a03RHor9<&b;r;@e&)m4)GF)8vnjAwo-V^KzZs^ECa2IdDNp0XT7r%72)`TxL1 z<<|SMm*LGa86WpujZdss-{Z+?+g|=KVOW3NqTuF~@{E>!0I7n_n}oz=8&QBqF96e? z9jK{?-%o-(^27wyoM-v7EiXj@10T;!3x96Q!%=={559$lPm%h9&6m+h>oPiN4R`n$ zN1THZwhONf>4oL&e+A#Gvkc#>sL$19|ByacCVwk*xW4Gn=wadz26)$X@B?0EKdK2V z&f-VK1nPc3dgGLG=VKgB655K>Y7)?)S4R(xW=KVZQJIr94he@6O5_`n6*5ub9Vh4;Fp|2X?1CB`Sk4WFK-8j9ZM z)PG!4zau<2B)V37V$b8Z;Da1_9zXXNCc+0>2psXbhH35iq{{ot=3A5)A8ZnFzQ1+| zpNa(i$2Ik{rqot^V$Y|y;Da1XH>O59bDk)+z&PS_ACO{uN;#GY?$!3Q~(ZcL9f(OV?J^PP?3^n8DbY3=x+y@-#^*CsJO z?4*wPj22EH3Gi`E-P@GfhEL3S&lY@;W9h~ok=N<{kpLgw+)nsB%(QlVaK92C+Ya2s z_;8SO#OEB8lJNd=P5rs>;E?Fr@QFG9*n$so4 zixcC+homDuJxw)q9iLrOzk~UPj;;-#nDc-w_#ns9jlClGB7Gu!IJt1b=NhK9K7iT;EUC+i>jj>tA@|)$b73`^z=;ouD{xb&|Cd9`jb@^C5WlI%Q7)gEg_xGgf@$fOu6SbZMTGN&D zKjo31K-VF566>p*u@N?Qp`N9`kJ7X*F3}5yhez)5fdatElbbZJdtjmSbBp0ic`26)zt>QH_FZ4*p|7fm3 z@c*Z{lr2Qe9jw6H(1w92LqQ-=GM2Rg9wk3TOxX_n??nWDH}H1}{u>atlv-CVFRKQ< zn zw!Z#2CTBGlM6p6RCVNHk2%LD=kJo~J8GG^5UtF)x5cOgFo&Ag&F<915)QO^3XJqo{ z`V5CUu`blTY`4^TotwT(eLYr6ecKB{%Y925F5}I!X1A{rNI!x_XVhY)sTRdG7cVOx zOye5XdGV3+GiVkRU8?thin{X6Id$l%(Z+*4O02a64;D`QAyRnCGJT%4KF_*>>QmM{ z*gYx#mfjB)cs@M3N$aKKgTrpo<)i%_4bd0>I6{?1f{O<()PhBP#SQI|E2CH?MZd{j ziCw+0F>x@_D$+RvnQ;*JD}1;ldd9%nyVARTSQDn zR;WnSAzG1ttH_Cr#6=V|S4G~%NL)nZBt-gVG*DUJjHTj-eI{7KZbj%Wu+`yyl}iS5 z!A0b96LSfgfYbZWL)A9Gb`T?5mfY*WdRemUt0FD1?7@2-C5N(bTtwlkRb(zBaS@R( zs>rd7#6?8@UPS_tC@keF@-9Z=A|%Jk$VUkX;vbQ}f_0{1)hL$y6|94Jt%7=wKA~9h zSFlzp)(eUye+BDridCmr@>j4*6{}IPYf@(w~JLlK&cOUt`#yLv77mUy+n zT`TV19l53d6^|ypOD0*>VyQLSpjmaicL!DR=WCUoXD|KlmeOa=v4Eo6Gxc%sMKl>T z!V`^ysXh+&knhY^;Q5jYIqNvMQbiIK;|_U2=)`f5^2j`TpM;hCSVrO^ddZza-gG2b3MX61`-dS7yLlrrclDLQ(y{aNDDE&!Aj-@0nLh@b}X+h}*6?vB#rHf^x z)4142v1-()BY#Eyo8>E))3~@mv0hNA!ky-(5K2?;Y) z|Ln)sF-0xXf=5NAqEd^s;OC~Oh;YW#pKzjGBkzzuV<}r5k3jxJUXfAFGKxQurv$yU zQAY76@{o+GlTrMMOc(Uh7sO8ke_HNB-cQIde_AFYTqDE$X&I}}ujC-pl8YMMg-YJl zf=Tz%iJ&I7oC^vsw+&-kz5@yp4Y@6YKnXBne#72YIM}xOhSh78mvZVFh8He94jFMS zB68}~`y)8}z}Y7_{lE$P4~4ylD3_t+Ebp@z*9zalrRc5Nw{ZLGbNV;roUCvqSu1Pt z?qaZ>RIE?P`lR*~6KfV&P+&I{*ew+Jt&C_#M7xNXjtFhO7cVJANBPbRe^BpUaQ6!C z%~CvCwQ-1G)uQ8P*!yMJ|0S!FXU!@)pD28jn!Q>3rb)A%aw=E&9$D|zzGq^oNoApU z&;Ga;Z`npw7a$cB+yw=92?gtAL>nU7M8pe-&=z=)Xbb#DE?%ZpzKbw?Ka-MXY~qz~ zU*ga3Cq#B%AoUj_^%R+1w7xeX!d~BlVgEtacbq87kD|PysGDPo;`oC4jei3d{~NV$ zm};_9&F9`F>)l#Rpo~hcmMs5AO!`snM<&(+PWZy!oltnEtiO!dkBI%U{)j;LLMNk& z&mkn#kG2<*?}79lAB*YwB`S>7H)?I>mtR9 zkQJ$om{^=bTFO5Q5vu%`S^mqlFPp@7swo`ZD*el9mzh|r6>B|N>ucAWSPK+uJ6YRn zx0_gh1`GWfT^Ze(o$)C|sPY%E`~|fOOya*(IW1*QOKY(nWK{A>#ac(!y4rOn)2djBQ}f4YgQrGxS-gSZm2z zTf5f8dRnozlC`yVtBExiEa(#*86QD}J~Bq0K)_hv^uNTCU#fk{lzfcJc?ok~Qj4WL zL!a{%>jSbrsKr{R!5XMoTgci{yT!yh#5q~m8y%_AAR8U2QV~LH71uE3|8N=qzuNzq zlD~oEj9pCr;#w@G8ihWoSnrede(n1v)-1*PjI7UUKQpoJl=?)U%~KH(9YD$uGW2BqDn`<|l zSoCv;e$i*;C>ase??Oa4>-S&k_utz8nzGv|Z-w#oEUCVhi}AV=s}*Y%S*vOhZLk(7 z)+Vwx)owDexIYE@MW1a?$%v?a4Y__Q}y`@+2k_`+D#A68%9(-$rnfZbUm2c{#Gj+OmP zU;XyX;$h3m)9ND`_1iPBlHAWab>V#COisTsnZcElnHt})Rocv@6ZW$DhP6-W zt5y73d_L@8;nd`oUt>+F5NpbB{knV7v{S}lRavg9j`4h$$HisSd=8a^i2?hBwzYEB zn;%-{%Ra!x$Q*kxa#s4XRjzlNay^tKbJZ$F;66gmf08*@*mKs`Z-P7U zu2O={WqfA|Xkw}^*L3#gX@R6^e$+j8$~jurSz4AqL(3}4)UqZF)w0jlvI{e`?D3ge z_KidN>cuHPQb(7Ze|ryK&-y=UazYQPTYV*tGUWRm3b*78C9GM? z^=K`tI9JP>JXXt^I#J8I|1Mwk{OL%oWlzf0vP;Hl+0!O!*#Shq#pu#!pf&vNf5*VR z=d%o|h+jWzc{ctFS#7SxmH45419$_2+%oUlHOdgBN)QPwl%BrPx6w+NO5a41+;6@}0OhTeS2@(aSAyFV&m1=ucut6|d z6+NetQOGG;6>hcAtHQPLQ^909A(Vmok}uPuy0Dt86J6|-kEU6xTZ1$i%(xYv{vZN{ zAa-Xc>xb+i1)_(Xt7VO9MHgvC7imNnsnfE(t>`1o=p&8jBX!gonc#nSF1mWDtt7oa zUUEVt$JRfr`9cX>#zqf$0X^gi^pG0#km)ezO-J{50o~&XbdMTz55xtgm;T2L=mn@8 zcFHM4n?>fVCa988jjTBo-<8XFgaU;K3HARs)e4khUmEm4E{#@$9+-~R7m+zLVRl8# zZbBU{#V_D8`3YR6*5D#_jrI<2tI{Aa9!UZ>B1vEpk_1YSBrpw00;(#%{n}MQ2ANYb zp@aZ|gufXT1_6|DDMSdn`KnJ@RBo>@@2#XU)gg>y9MsVEN2hd0_yF9_aevo|0Zc7S z6JT@<4ISe&+{)iaLtTcl_S04Va}Sy-m(-^oUN;~d5aCq_m*CwtFdn_>#>Odq(4Oc| zC9N`R1W-;cBhZ0GXOz8opiNiP_}mG7Mf+tH?Up)E_yqc{guZV<%R1_}LTE_`|KVDb zxNh;Fqoeb`i@pw(0@OBRN;(EfrRdqzQz!@|?G6Jd$@!Uxnu`h3Ci6_dV$Qrh%u>a*en)iR+f+uHcy+ zqn(?6hZEu12Y8+W{mz4aml}Ac7y~a^!E;!Q zc5eOiU?Mzw0?(76AEvjHv58Lg&ol#1Oz!YJLRjI+$=+9Z9?hEEIXs>9Re0`Dcy55c zc-T&U)xc9|xkg-@#C1zrSMZGd(ypBwo(B@)*#mf<2>r65-!KDDd|p~T-!bC^o(L;E z5&kN8UKFFTbN_VKSK%2^czy_dmqXuI3_OLFYs9rlT(@-Z3Z9SM86VFxjrmeX44%@A zFEuMl2bzPRT^6*v*g!MgKoc(iKoenwCcHt%01!o3A&RgW(az34AHBl{rOW)zSzm?cHihRp=(`m9 zE->&ETCNe-CUM=;qbqnGxZSRu+x^~_2+uU&IRN_M4Sq5`H01NWr-5frfhWQWPlUe; zp57RZo$q&NeHETt6`pIMZv*t5Z{R7kTqCYc;<}}0SMYr1w$9?YKM|hYfaeL&?@Z`- zp@AnhovZP)m%tNYg(t#a1<&?Lc8#6!bkzY3n+V>EW|pU(O!JU1&mS3}>0(6`pWQ)szH zT${voOW&^GdHXG$#dA+0JUzhkIOume^vf~u)C@c|fhWQWPlUe;o(pcaYwV1tv%U(? zO$yId(6=7?{@1`$Xt_pQo5XdC))hQYjM2{2KVeT8MSHS;SwVOdjv(|m<5)DDY&C%f zn2xez|etNe&GdBij} zJ$WKN>i;u}_ILkM)O;PZ`2_8?4ehlXHE9nQ9b%I~AW*mz5UhiGpP<-n$bL7f)gBsu zNN8yEPvTGiDE~@xUdUU|3(P>_N^?HQSL9=~-%=E9QN@&eDN40y5lt=X&+^@hb}Tgp z-`Jw(6diRcb@uq9i)!q(6tYo_s2$~CWR(5|I=ZZqkd;{Ka>#E2-NA?!G1hBmq*pvW zz6N<%@@M_&zu<2Gh-;zU$0%_ta-~yNn`%!81PU8ar?qH@kI|l6QPwWx+2+`u^bhmD z7biam1Pb5lY<}@nbJxn$U!jU)wV;7>ZLIgF6Dn@HvwiIdI+kK;Uo+ZvY}vkgOIR@1 z)2mj}+oGm8Ty&&3H2w%iH=}>kAH=@|?ePJ$`v~p31-a7cY`2m}h3piUn^*N>pX z7L>IUdG2>?U*Z22FFy!$CBJxCxoTyq-@7i=de^Ns*7kKm#SII#uN^_hQuOw*p>4;O z?W?zh1#>;UY9+lb*uIC0!+y5$;o?x?5&L-0`5nT_n~bQH24gqe2$#dyAHBj!{$V|=xtYsZr9t0Qm0*wnsk6&?E;(4q}=KHHQ2N`9QoJ!%cK+lUfBMXor3 z6JEV|Is<<%Bm#wtP^mRgb|aMd6os`Q)4l4MZh79)f71W9TVCJ>3g33jNBUomimQsd z7Dj(S(e71oF4=^)bJ93SG>ZTUxA#?l6=KkKb#Y8y-Xa1s2k z(FMK?6&}*(xAX_|F9c|-q5TH5|7NuR4&(&yE!qB%2ox>^2CGq*4bX8j%HDx8u-#b9 z>5TfbKhb~Hzrrmqa07)a9P?4_A6FH3EsXYeE!w$M3qEcr#HqV2eJp}5b=BM7g0=&; zw)~?lV`+nE`-@gHwT&fxxCs8}X#azz_NTv{zaBNmfz*DUR=o-BkK?7`^{v_;5`jXT zb?wFB(}g&qdi*AojZ=UN_c*mb{fGU_-SPrAP`KPNAJzVGRdLtCXn)tDolCXguHi)*rXf;#YSki}!;Gd87KM-wyF27_5XN_WQ8`lal z;7E2CoLbF@OrMvT+?s>tO=A=Dh=Za`TqX>~r8pOt$zySuIuVyx zFR*Q}Ep4M4+BSNDZKD_1HhO_=qZimVdVy_=dV&4P?CEnp^0SvH*EnMGZKHG4HhPI|qmR}$`e<#VkJdK&Xl*NH_U(P|^c+FDKA-)Jwfo;2uzB)FY9<&L;`b+NnYIl9a}X0F3fr&3r4dse#s zXs61;80F>rw(!68j<);Xo~2dXH3Vk683(xoO$*Zb7}*@LVW9Y>C(7;(iNV-dV_rIj zu4(x^GFSJ8%= zIO^<+0mOK|BV9Jrt=h!lVAkU&A}ircDL^Wy_O|AS4zQSloRtOH@1bO)*m_x~9alRR zqsA|Jx^a5GXH~%^eO9KQ11v%V35?K-=fCp&-2fcxig?FmU;#7}-e;LuR2+(?915>I z+(d~Zet6ZZj zYNit$ifN?F9*U_$F?Cqqd;#|67x4Q8exJZ^4Ss9zI~~8%4K;YvOr2i(yhVZRb-rvk zK%a8dZ*5#WA5}s+AKLv3;Rsp?N6;Hb!ZWo57k@z25~sur*OuXg=Ip||aL~$dZ7FH* zL@o{=fh%8NEUEpVrsb0Q927UF(m@fG$t1M_6gT$|*H(cVsDRUgcj7r=(Ovhf4cfY{ zYG0-JZsxQCInfL;0ecX6g0KX#cqKzkEDvx_ev2VG91_&2&oi_OAwqlqUm0pgXxbC3 z^n=BD2zMYHs6qIF0CW>|uNU>TgN~y!?8@uFSB`yT=R7Jo#j=Z8`gsLEvG zf4>F)WE1|R75;GjQ}}~Y_=8gTgHrf|Quu@F1pXQT$0O{NakI`adXz zKPZJiD1|>Lg+HiH;2*Sgp(y@TyoJcEKu!XG?3o4r2nqb(W~hnf5r6E$1^x&L{Qu3+ zE`$XBe`2T|A&Gxj;*YSz|2GEyqP|_gzsj2!|AVN8#h()Rj|TofBmQ>~|6g11Pcz|9 zTHz1ZMTI{og+C~TKPZJiD1|?$PT-$n>q1fdsrU{ew*ol{{IO>k_#-6nU%^ll%On2S zg$(==68Qg%pgHrf|Quu>X_=8gTgX#qSDYh;Y#h;3ACvq#0 zlfWN)#(_UV0{>+UHL*P6k6q}%A0dJNJcf25B=G+OL+uDj{AWx25tjJhZQw8J+Xej7 zev%mfc2vXS-wFJ^z<)gPpG5qpS@7>+!k@IlAFh-Ne^3g4Pzrxg3V%=ve^8ykKWOVh zQT(a+HX^qIISKr+XCC+?B=BF#P!r1|{@8^N{1FoPKh4lCgarPNGSrTc#DA8=A7P3A zGy{K8-!9-^m6sU*HdMpn4+{K80skW6kJqd$|5OY9Jx%zNR`|p9QsECu;SWmT4@%(= zO5qQx6Zogtx=<82uu9S4E#lPyMTY% zr3vr{xO)M=#XlAB{{-+~Mfh(a{G}H7`A|%sDdAqf*+KEAC!V0l!6~r6n^*h zA6plS_J1n=DUn-&oCN+j^8)xIB=CoG67Xkv#2=?<0Dpu8{(om^7eWI6hZt%{Na7!q z_#-UwFE#KN_3Z-wRhJ~j{|i*Z;?D~FM*#mTiT};Se~JbFz9#%hEBxU)s_+M;@CT*v z2c_@_rSJ#U3H(!RT_}n_72izcRv;&VKhE?3{s;;D7c$hu@`!&eLv(Nz_&>?eE`$XB zzhkH!A&LJ?i9f;;|0xFkqP|_gKW%to{P&<57XMe^p9lQM5&xTr|F10gYbN|jEBxVV zs_+M;@CT*v2c_@_rSJ#U3H*b$E)>O|ifTe}n}7^$az!JmUXfhUgG0 z@c$b_yATri|CXV4ge3kmB>o6X{C{QOFY4O`{Hrc@!yn81eZ_FgMR*u%GI)@NI7B1d zr@1v7UnkUUhQi`h#YKNu3Z~&Bf2(+a2aaCOfPtfm$F1atmgBRHDFwq;OikmFAvw$S zWpTC03L_7UaxnQM$%BIIHb5v7W1G{S!`wc`EQlxvQ=>RiL$?9Ufw9mx;{YuH+RR6& zwr&o9*1~9@_EzDCXJHs8(avH>i9n;yC<*Xj3>9Z`#6J?ltf3a?2%YBOmstm63;Xfqj_#Za`(I;SFA4EhDAUx4}rs9%8k z1*l&@=oc{QH^VYB$zJQr=27ig7sfQ1VPE?~YaKNm9unT^q-sdjkOEWz?-QheT)_JR zDF7Mp){z3PIIn|LGpS}$t)yD*{(In5aa;g%7Jn%@gOW2y{g%{kN&St~-$>E-!~0)S zID9GKttYjL)GAV&a3OjDFAiA(JofV7LBcbZ=;IAv5%|=L?iuZ$NM6O~1QO5UFY}zq z>}Hbs9jV`udXm(Wr09#}ttExSssi4Hq*jw!O=>ePQXd>j<*X0Sq@q6XU2@ik^9CfI z#b4$bWbQ#y50QF^)Za<{ofLiJyf2c%;a&mnB2sHets(U(E>a&H;^nLl&(EYj@TGIs zhx14zp2c70S;5>ZNd2DF?@9fG)IUhk`O^D8QaJo9;9X4WeNyj}`V1GT4-PqV)@L6a zM4-+-dWf*^Rq;In!n63xJSv%6C8>u=JxuDKr2a{Y&c5E4NZ~NJfOiS04@iALY6~v1 zd>s1bT>gGp{(hr;zDGiM7Jr#X6?3a1^$4j)NIgaBDN=MM_s%EPK&pY%T2gCCZN){F zzZG$g{k2V&-)5B0bp!~{;xF@<#oT6*dX&_oq@E`AG%0RQ@Gc;Q!vX`|rKHx8T1RRd zF0y{ zsqMJP@^L7lbNQD27!a@GIwFK;@t1jom|KX{W27D<^$e+JNYTH``wA%>78&p^C-otz z4@pIEk>%r1NQd(6{z(w8;yN;fXYrSL%wcYGNd1x2A4&a-)W1m4ztH8(17=C zQX5HaB-Mh8EFXu0I+kzs&xCjt?MM)w#b4$zm$}U)^=DFlCiN_-XGzgv+WR`GcSyZM zs)S3O6sqqo+tG@skcbIMGA*8 z2fQmueM0IJQoC`HdD-HIdXrQe#PtC6!Amm();FLrGJyNHVI+avk zTts=in9EC(<>6RDRo;C}b05?ElGHCr-9YLFQe#MsA$2LKOG%wa>O4}XkUE7_A6!Iv zeGp|XubV8dn^E4qOmi>O+)3(AQrDBZo>T#;0#ZLB^&?W}k~){vU{Zrg^~Ob%*Beph z@=|4asYZFfVVd7C%`Zs(g4A`St|N5?sVhibLh2Gy-zD{3QYVu-nN%-aM0vdsWiBs8 zmWMYuh3BuC=GRPf2dO(q{fyMlNR1{nn$&Po!%3Y(>KsxhkvfS~Ph3QKJrQLtFIkp{ z&&I3r?qQmHnC5m;x0AY-)U~AYN#&CoMrs(TY*N{zP9$|AsUEn9@_Hc3T%Jdk=P}B= zn`!Q5n%hX-M(U@eeoD$m%17#AQWulTB9%pI5UD|=(s2>xr6bBz-T+@{V08Z-C8sgX zG*XjDO(Hd()Ob=}QeILQk-CV~*`&@UHIURmQr&S8<#k7tQC_$xCEPbOJ_T5c^-oGp zWtyp^ib)ldDk4=xY80taq<%>1hosITbrz`sqy~^m!$p+Gk;GJ9GRsRgmsid-kk4XJBLT~6w9QWuiCkkpx^&LnjLsS`+b!$p+W4N<1@JS@*+F0YJf%9!R>Qn!-2 zn$*>#Mv@vy>H<<1kQzd22&w+0`jbkNrv!Tts;uL`BP+KVUWhHQs-HOY5G%WA#>FI79STUpTpa zIzPvULv50@%E#fs9NI(w)=iiBg3Xt~4sqUzr*}`n?}ew!-%GRc8$2*no5clzU~I!2XH-^Ijd_?EBP zk+&u?GJAzqdFyG=e`!4y?2_{3kEpGAeF^&XhC^;if9;rQg7weXuXMhDDxnl#G5tR& z?^ab_r4?rAJpHAdbmyc_V9 zPmlF0sPGTw7fiJW2Y_#C8LdRD_u~l9W7S(6+h`~>)xY;C^>{$sct#KTKhk5~;HVyv z7OX{D+E4%f=n>q2dYGp_756B|YywYy0;-X0ST8KQ*v_ z1s4M%+dsK$?Vo(i6m@QYXxgdv|AzILCr&b#Up#hi|3mTHKbh^H965vy4vE^o&oP75 zvHhumz5QViVf&|at^HGunWE0^&&?omjBbj1|9``J%)@>bT@Uy6?}*?2DQy3g$RTV# zN!0$mj~T3v?N1Ht?Vl>!KecP^pL)y`b#8xd)agw7f5Upr8xYmQz5QF`w|^?zKQ(gb zgv9ON>zKjn*#6YO-v0Pl4)6bNU2Fet$4pV@_J^jOYX5Iok9qy0dbqcLbNu$lLA|9L zyG0HipSb;d9y3@S+n*ZP+doaVe_GetKkb+)>fHX&v{UW>4eK$lUsMnG_OFZI{%LIg zw8)|361RVkV+N~Z`%?pZ`{T=Ly#Kp*t^K>fFUPoO7y{vWfIgfhqWrv~=+$F~F7{^?z7|6`}9bNfS69rw8Nzi(KNd3~dL zxVL{&{PxEhQR&9?$e})o+yB^gXUF!Z2KM&Hw=>!PJ-XKZ$8Mls-~N8I+uLEfbsdqoamrj@AukKOC6WBXGBd;4RAWBd2+TKgZng$n2P zho(C2aohhJ)?*&tj&wcZw0~>d_Q%2Fr5k%k4&hBZQTrdebS>k|8H22c~~9O^@!8{&2ihm58J;_% z{(ZaF{>RQx;oSbvRL4DT`+viF%%eZPT8E6&{&jKNAJ)CnjeR4BXh}<8|2cMMHOKas zwmhr-4{us*f30inf9wpE&g~CPb=>2&|2M41Jb#gDCXy@{uTBRZN=V--E{@w9t9yxzRS`I z!ujb1q0x8|UsuP^30Kx>m3=53YQ*OykzjMHFT2r~UGKw3hv7uwTiSqzN0ziY`+^VTM>nmaQOp}U(zJ>+%pfDV)3J+5AYMqPaXKA@+Vjji=2d2 zQ7sE6RgBBfvRN_guS11!=Ax+4C0MN1vaZhov;X_ZO{hzw(~-uTnCp3-5*uU!uKaO zYgxBvXj#{0YH)`Wo;0!_Z6e6Jk1PWBpHX{wQM1~l}w$F>Z}lgThN)f&5p;Dxd_S} zUsr;w+yq5-kC?Lq9;b<}%nmF8uFl^Bkf}9}Bpylq$KkBIYw;0TAbZpIwJe-obo*rh z_6z(U#{Us0-T|fY$t(oL*JUf~NZ{+;b853SKhBTu0FLKB=9Hjch7qW{F;hts|Y%c%+Ra~HJX=O$>yk5Z`A zsWJF{A@Kt)3O^jucI~MWzwb%>ejE?KWRxTDOE%$$Ps%F%u;teszazkpQ#0asBr*{L z0r10lU*j;Fbiog&brHW)65{7BXv5D<(25_WP^nX5@Y^f#LuXR>;gGd!Pm%bYC-J*9 z9)2l0ekmsW@CjLkAGWN!<98VN@zsX-9gbw8D*`|C_;Gj}bHOiF;x{-Ue(r)c{M-bs z_)!X#8XSY)K8fEU13w&+cI{w^-?f zD1jf&+Zu<}3>W-xS{D1?$qDgu7qsE$CTPWvQmE9)G5GD5_MheOV;Jz3)SU5Vc% z@$l=Wj9)vJE zoXK_R8sLZXq{hKp!UaE^21Wefcb@=1cR?F|Zh}_)D1}N5h{5lm#IMc34(QD}IzhrTWLBzr0DN>D9m(+zDpd0XG21@eixaqW^sXc#>W5!)ZvwuU|s^+y!m;xd~eFqZBHIf7|oph{O-;2kQBY zH`;5VBKzNWBz{;ea$jHQtK-+#gde^kqVU7pwkv)d|G0Aj_+k9x3JjkgI1g!@#}z+K z;&)s^{M-d?__+yM@uL(fbzBU7M)ha*6uXR4@3u7NFw%+2P7STW279-oG5NlhEe3`y&F*5!@5XiYn5Xkyd zK_Ksgf~&pQEXK8J?4uJbQ$Q4SOV4 zmuGlRUh3=-*ba@nYZxvL=cN{hWDLXMyp+%gY+oi{>J!fE78-#K+Z~Jaa9U^tHjGEZ z-9sa=VLcj7SK1r(L28+UBYxpLOJHT4Q4p1Oh|6vDMi1`@o1+W8LjCTW2ume1Yx2{MwUSeS%5l&^a z1DuEzKCod2cu=nS!w%3*xW3X3@EhTLOgq3HELKAfc7RE+T0}O(&cQYy<+yW6 zmrw)^xDW79-%eO6=Ehno(r|<6&*K<-g{qP%>uKY@hJ7Q7|7Yk30{_I84uQYb(orSsa;pE^?H#hF zSK%3D#ox_NVc?&sCo%AMPonVOsXsOh{N0jBt=`b(4gBNUMI`=*t@wWp`$!c3_t6mq z{)sIm0)MNeBn=N8qyO9OC9N)eNEt>*wP~Kw^~}NVCggPx7%A}O&`)9iw6E~b`k^siFy(P zfA=H`|MT=D2L5hIq*jLqsk_p^KdxOy;{T-;|F2=6iQ@l1+=v4I#FiR?ztvKchKZPg zzujIVYx)DdrUw3Qb`}HwBt40Nzk3pe|GSv;h*8eK-z|yM>TzA(z(1~CN8*3bivQQJ z??mzc2W~`xe_~6|TqjFU1#OL|-g_xmoe~vK~G}f@18{Af1jSj zz~3#2)M|__Z{Q!-4kYnEV8#Dy*n^_@{~kB4z(28NNaAm^45iXmDe<@4gJew~qURJ} zFO2^0X2&t`pQtA>@OMw5k3V`61An(9Qmezo*%{J)0%D2jgt?sb8G zVoMV7$IDAPX3Vh8Mdr{ZXRK$S|J&_JvZg=KYii){W(P9xPtubZ_`4_3#~;3P5>Eqv zw;Qxf4#K7M@iNgPvdJ+SFw{(bZ$2L5hIq*fo%SJN{7 z#I<`#{P$b&{~GqMDE?QAH(0#?CbonTe~Tq79V=HR{O$HIS<~b7ni}Jen;px*znRNh z1joSNJ&D5qKY9`af43x3tNV0$qyNXXn@RllS@HiG_OmGdBQe&B{-4;AHrHxNn*)=Y zW&F3>(_~FwsD?_Lf=dBoph$(xPkNz?dax97>4?xpv< z1%Ed?oPmFxp2Wc4J&D4sKFIwQ!ajJpARv6bAW%%HAW+U6L7>Unu)$*iIv}h1Jbn=a z1J4r1pwe&17;N}h!x&WmZ5acD&nCt|#Sdi+3_rUWgOaz&7#M&KGX_fUmoeS7ie7{Z z+Na<*^07Ev(274zL}_3OWSAZr!B%ve?W%}t>Rv>0uKvgML$r1 zlMoANXfF;71)Y5FgtB|J2Op78L&3SI(7oq^(^s4O1Zb_|RbC%_Usg0toBJ=$!YdZ@ z`ryYhT~BT9J`u}Z7uthaysG)Svj3vhu|;7t+VBeW3e$P8hCLV(SehOU0JABfr?=UM zA%z9h(QrLa5%~yvFzmR9$HLxdVBG?IO!-^v$B@GE(`YyjFQF9Qr)~CRNMM0vG+bl< zF7gri8}?;z@%la*j-HizdfmRP?9GtC3(jb`-rXY8>wIN@1|Jjf(QqyMiIuPH(coi( zI2x`~XIS~lJ`Fx5Fr(oblw#)lVDMJgnU91{0t$=mF9(AZzb zG&2x`TWp<3vq_}k`KE})E#?t&y>N{Tz(uZy`f^sI#b8jsMMU8USy4f*a=@*01vb%X zzU)=`o<=E{I|Un20`SHO$3`F1e+jVmQvccZeYZMyAMqZmP&WzG#lC;gF2OpxIBv(QP3el;Ovr_iJ{6k@^Fr_)Dax zx5W)0pbnlWrHm50CvTT=c%}qI96d0~WgLdiu!u`R+zc6q=gOlZj$RqnG7e9czl%8f zXFMk3@N9Wr#L-jZpP-CKulc-jjOyh-K__E-pjFR1h`zxca4-qq^ znK86lM>-C$QKUs24LVeNpb;_hdC@Ld(VcfjF8|R*{wPJFd+-dAIl9O+DI#{_(Ozzp z{Jjoj&p)I6Vav@sitQF7^sQ$?jWozb#v!{J@{f?O8yp3HD+-9@=={Uv>jp8wZy^6T zoqvdY-C!g5Pm#X|g^2vWBwsfu2!0j$tH}3-b1>aXgU1yH$n(L(${)8jXq7ip=0B=J zMt!7wH^^haRq}M**DBAa{C#$L%UYr+yC>zYft=`%wzV!HvAqovKM)d0wzU|+Uq=4% z2H(6^Ao%mh--}{!UbN+1R&eK#`+?x%ez3i335nY%@uHsI@-86wKJp(j_~yB);AfFv zD*4z?!!CIL<(&K)TPO9-JN0{vrcVN#7*#);dJ?xT8X>F~+<^f~c5Pqv)#u~sRFI?j z!oR|I$MWzkqbb+`J)*;x(-ui$k(Tmw9+xvb-A9 z(^{TxjJB1B=+2jir*}b4AC!mhhKcg<-7r~RW=wgy@zquyqB~z6<`V@uy;0u2a2~!3 zHf3K3_Y%;o-H&@2{+s6Z(~XU`@(|tm@-V+C$mxah_RI42tMW!Tl&2flY~>-k^W|Z_ zRglvY<+Z_Y@CYi{2H(LWtYPCmd;96eBwKli?tFQe{}tr)KzZ$RZo=bmO8e}akFvCz zQJNi3-FRXv57C`350CnSoOIDwa@yEcA{~2q>&y9Kcd)&*@7q@KX zA-ePB;jOM9hd#T!=XmQyeu@&E`=`E`V=E8Qoi7h_(SjTg@4cKh+*gqI(uHm zi!hi-Puo`n#hKh&g5vz`13_8O%UC7iIHBDpC{AM!3yPE1<6!`kQ`T%jaiV&epy*$F zjiA0gFGH*R_PmU5&&#mvhy3=u47o!l<^&Eg*M0==9%2q1*RK>-^KZ|~uu@fzf9ow?RgpT@r&zM3H-i2FGD>kR_QOf@$ro7CkZ^i zJugGYQ-6t%k7r!JN8tJGc^UEXi|e-t{JuReBR+m{{SJZOx94TV$1kqmAn^P4yo~tx z#r69Ge&3##5g)&}etW?0+w(Hw;}_TO4)}e0UPgTU;`+@2zyD92m$4ReH#&mRe~Ip2 zJZgYWUq?8nv)Hedk-mBaT|!_l6<%N4ASV3bC@=isPJpjW+hX{2oht}r{S!eT@1F?* zng0re-5;)cgl6@p5&lxu$%g-l@{g(>;gRKA{GqBxz|+R6Fa4Q()gw|MJsrvk|0Z>Q zM)io)Mb`5(sz-ElO0WE#sz; zs58#^?~Se8SNF|;P;dRf;zk~1F7jB7?tx<=1RG!5mM29=*)IzAt%5z6Y#tRIW&d8V z3j})z**q&c$}Sgd*RqS^mwge~PKaOLFIUjlr>R5h-FSs-pA570hW|QiW6qsxVUDC)5n2MPoVp=nD!f&8e%M#gr z0_FzPYCUSjtjbm=7ghzUW$tG8Zec>VuKIr@7y9s%O;VZ>ng`7@vW94l?5bz%s)AfjT=>XzCAAfAWpwOl|mYl8^tQK1_}O@wV|^=L-PH zmk3z&V|oDq`L^e;o?ZYzzC^%CkHedU`{!bAY@#jM^z8Ue{AWl0(uLRrkd&XjV$85c zt!i~D$0i_uoCSw!Rj2BiTrQ4^c6zu- zufqNCrWVQ!2BBp+J!YifJG$VfPz$FHIXrNr;NNw@4MNcA(IW+atqcB*TbvyqfKqUr zE_k;<#PM-7rn(}7_g$wSOUN3h)1--=KIIW`X{ndyJU-k;TF|8{*;Y5Jq;EVoD1 zd5(`N^hgVB^pW6`nz7jev@;mO+Hqs*x^<0P0X-eqy$S)~m9j^ixXptW>T09?+?p!T$mN`5` ziwrP_2WycubGWw_X@d)>Opixl5pgxZ;-HK{eqpji(BK z{rL|0$046)k=NS@%;~E9Xl9~OhAq@)-V6_JaNmY@QErX6=_i2|RSZH;S%l1Z8S*F; zg7;Yj`Ml(a_6y`E`8UMygG(`cY!J@OLiT#8)&&;9=<{UuMd(>@=?P%#$P4M*+9Cdo z@mS6$AcMD_05*@zl`)s|9$jx-0_ok?8ycT)55!uz6%V_EYQ6Lpfgo4{tvKyg$A}p1J+? z`3pqgSs1|1l4oS{3Ji0&tHp#!pU*%D?v4R$FR741az3NxH{ingGJwq`#gYsC%<~=a z;S7p*lgd$MzG?mg3Am>Qu(@PNG=I~42zp+ zhj7o40}tQ;UYu8uV~juYc^v4D`4dENT4&%mt@3Fl0{zK1&!-@S?R|lMTIEa%sriyV zp8^*L&IXRxDsMHFADvHuj{|)J{k6)Gj(p6wAc8ZK11I49f+8&6Jl_HvM^Xm{XqCxE z`QRJ#E%0&VcVHm)=W+X+(9b-d0v|`J2L@@C3my5GZ$Sj7*auG3D*s9m>-`}0iJgBT z5k4glI7zF#LnPAszbgq@Dcjiy|===@x_y|nkRNVh@a-`5olpZ63f% z%~%I{`*<^Fz--I=iNpKMoT6mD(v0UKj>G%R9KOEH7H=;jIX*Iu{!V<~( zVEGmK)jllKZGu|ZJT`YTHfBI;Ov$k$ZRYzjR3c_@+RP;~I87*{&73cTfuVZ;@#S#& zRIF8s+#U!+LQMRgjIB&*MI+Cv;O;=KUm)2j@kO}8J2uy|1%bc(`?KN zIlsrdk{B-7m#a_N^r%@gzHcF(?|;Vn?^_lL@ji@n&sbtj;}g=0b#VPX9OF1HNtYf&hA6B7*YJG|WYm5o*MAYk<=$M& zdtMf%t`~#v zV87z}u)cl_i5UA8`TBY?__p;-ln=iC{sg|`dM1YWYA+Yb#rqK2hVM&=$`J1-=J^>S zxnbX^pLKo)Za)r(cD|S`V{!)m@$vY0KY|D*aF+bd??+&tU@zbNegysi2fk2%>(Ss_ z=HJxc{QiXZBZzRhS>8XAA3J}8(1|);oZngBf51HnTs$B2^w#xg@K28NA!B;K0dH`0 zzQOe5N8e|_KP8qQeSZP})L6a%01Z2y2%Hw>7i*K>^M&AyIdQo!xUCgWsnw)|@8Q{6 zf~mq?%aeTBV3(}NJC3qmm2FtF6_3k0{I5B^_4F^W<@`r@?BlC6C0wC^R0-^Cv~!ig z<|gHOEG%oLJY+M>{lkZk6eCS5mVGKRuvm#NRopqde)=Y@{KDBEOy8oFe@r|3T5#GH zW|Xg@v7P6!v@OgmUrdX8lL+LNFF>_0PSo(2m)k^~r~L0c;pG=1kX-%<4|ka?0;%O8 zNOOqDO{&0h)7@A?n!Sl-j+?z7Wnz5;F>Q-c@ViXV0OD#9gVK3EOj`qp5h4aEEEh2# zh9U+T(;{H>Ut#a}3JGY|SEPYfmx~w>hhXRv9st7L-vAwV@Dv1&1fu@{j{?@|_ZZDt zoj>yzQvcvD)_b1iFZBB#f1%au{Dm%y@hc(W?P$|y0hq%7;7vgwyCs6)`jH@z;Tl08 z#|?r&mYYDR>P7Ptqq8Z02zbo(N0>ea1|A6Gcn(V#(|JpnW3pL3%@(E)ftk+{*Bs^; zYYuZvHHSHZn!_A1&0({Jzs46@g^z7uIybbmKcADHm62D(QCQLO;WXZ(=l!Z~k| zI@+Xy2gc$sj>ghaIk>+|_+4L2U8Ug~mN;$WD%{1Zx!!?VX6m(kgog)8bpFJHs-k!z zZ5neb!%Isf(~?u8j9G^Pr(_xaM+x@O85@WkQt%a~Z2VBYtg?4dI?^0Sx-aeMLd@hd zxl}w@oUASL&?R-PlA>Di`x|n;r0N%HEWH|K`Z-vkO2f6jIMhT`bpndzcLor=krn=s z!Pl!jV6%Pj8 z@hE2j!G=_Y$5a%c-k&Y^3o|j}VPxutM`{cnOwuVlHVc!d^Zmk)`~nYM-KEezAs+lh zqv?KO&>fGTvw&bjH-$&BXq(vn!A#6}7@4}^(JclKCg~I&tA$O{8ISqk0S{f>1<*br z9(*L4@L2?e4Ue=KJeZ_Ycq|k)S!X<+0uOlT>OKwa z6XF5A&3G{Aj>qLJAlT4d;W0|IO)MVF#EgfLsT&^MWAI>-PT^6DiG|zv@d$XpLs$1v zXrB;|bSoYVy5n&n3kWu(D?ENE+9nncW@5&}$kYvw^cXytq*Hi2iAk3m9#!B04_)0^ z&^{p^{N%OieqqoZk26_7u%U;-<1EoOv3M{OGag2!Zg}*F!GlRUg~#tO6LrI5DtN#{ zS9hA2uTIB=7nP9n&Di-EKdElQgF$yZPGAAShMo$K0itbU@n9xqJd8};@aP$X2a|LP zkC~XFyWvp`9`MlBodoR@_K#jxJQ#GxqZq=~kP#egsx-ZbCfzSn*)c9gi(|wM75uqwv@&bcw}-nV9h~GIhhFPYfPR z(kVQygi3CB{E+HaPu11E2-PT?WGf9vu-M}I%yp{si~)J=#7#!~Zm%Ah+QOT^IJ0JEf6^59oxo#yMz#EgfL zsT&?z3?59<2|UX2&2^`_SUG$Nmfxez_qJ>Ei`uir z>7=Ih4KP~4Xaz&8FCe@J;XS7C7YKi03hzaDuPM9_;eDp?euVd%!fgn*>0xLOPp_%z zZ4I9CU|U0S`2%eYspXHgHKdpS0}GYq&tq+}{MELG-0~%6osIRa;DPkgE3k5)Ra}ow z6Fh+RroDo|dea|qTLlkby(t^xP4EELo6Zp|tT)vQ0_#n;K_+rEdjACvWH3K0JhcM+ z-~lW=%@VR$c;ac_!2?)$S|SK6JiRGou<&$^kio*!ArO&2ne!XO{BZJgg^)c?t2kN6 z_QMxg1#!Gqag)fezgBUjkU2rChzJ6Qe%CNR)A#^8Eb|+rRSXg$C*l-UL7b#j6p8#! z#wlBZ7_3!nMQ;cmI0fIe6*8x46+CA*DAPj8$9qGtzw5D z&cKSB$Zts5{lNogY8Bku6+Cd3R`EKBNGW)x{)7C=@`DGmwTfm@_Bp^$$bVO>;OX7L z1Lu~V96WHIR#7YX-;?Wuk^Vv@*t5LvhyCvlTc%agM>p(UANH?js6vFA!u}?PxW6du zZ4UdJ8M;k`J`4LlW9Vlhv_0(K&QO5}eIE9I&JZ;Sdt1Z)R)&U((7v#LA4A^}p^mV> zgCXh@_8toR4>82^&9Sgg|0VC5uzwBXzCg9Y-gROBI)*+Ip^ahxMuxb)ANGC{_J6|A zG7vA4~4y3!~U%d9YU*xy*tAG9SrRfpxb3x-yUP+QpF z#?WFBIvDmJWN1D@+5+zpZGr#D#R$KKFymjuFIA7Ow}!o|!v0m{%@jF&5cYpCY+3o; zVef}w|A(L^hrJ(#{U3q4HSFCK_HP39v#@td*uMqT*swPe_D4XC3VU~k{X0SZDD2%6 z_U{38e%QM|?B5S6E9^ZG_8$OsD)c%Gy$)Zzto&?*&rrCQpG3uK5PMuPqI=hG&!~@N zAecOC*@<<*^+)A+Ng-o!LVwZbr&ZKx6@LbZ81_6IqF+HpV5VAz|J87}IP<7jT!g*q z(zhgq1>~ES;~&2;SK+ccNt?y<-LWu#8Z25n@jD6Ys3q9rT!!V`GVB>Ep_fb6m_TQrQTo znOw2DY}oLz$>n)Dt6R>t*ju#ut&w@%j~M3_!qDy+UXYPoK0upaFd(I3dHK#ovh!7- zn%Lb@oqII@^t$rL)p$e2GW9x~Zm$E@h^=+VajgTY0QECjm%9A==Ao>|6{dQeqv~-w z>yeFmXllLOQD3^f2)?fGOZiI|CBbr)Pg~;dqp&5`2|hHwF&CAXb{Qz3xf|&2-UBU4 z#*YQIdyDh54cG%$a$_OlXnWlKA(@2}!D!h)Zao<*80o!>?o4QvkC9-~X=K)sxe%!~ zQGOGf6TFh|BPPNawC9G8WIL8EWfS5HBNey73WvCh@IMLIZYUv)IRB$;Hzd}IlGr)6 zAt$ef;JPKqiYCo4s@Sq9zegj4jjp0qh_lYM*O&P` z2gHft|3=TwsZ(GN89vTaer`+u=q=z2)_I0s?eVaGT%DFuvATSxuR4!6i|QYqMZmrw zds)G-_4oGE(f>>2_hQ3fF8q;>MtlXP{ub&07InU0a~&E0KDQ+kkFthnijvz{%T25X zcF~n02E}U*nUE!Kk5r6^X`N>KnJvRwznnQhq; zT@>wtCWk0slZ8_N2(P6Cn2Yl3H)oFN(U{+389UOt#_W1u{bqF5#{4zgaZoz8mYDkN z&Awqv%Pv(|W(^}Q{8VqYzT7yLYZWcI?!w(7xG;>b_j)3h^> z)aI|v3m(kXDpnvSZ^l8)N0YRQPZMU4Cd$ z>Gujebq<2%ALnWF^HQK*UEZ+uS_PjpKT0d})$dA2RVyz?9dpoo7N=i#12D@)0lA(r z!xl}O)$)Yz6dKS4(1o$0IXwj&Eu7X*mZZ|@dt z?jGz&DgQ{%Q>%ENO7L4Uy{H!R%?81o@@8z}6Y0AA>O9X4i<~lj4fm#=X=?dLEziKr zTlNpTqyR;$c)%p=Dc{htMwo*6bqALOH`o%aw9Bzx7n_8V%Rh>of&4^!jSMXt8Cnsn z_tbA6Fk>?-l2;$;jX?;{sXWvSPf_jpg?SLrp0Cfte`GiA6XNNKYypMzND2AKI)q-C zm^wP?)l-1Xn|CLTPI~L_xNLvs=|hUq3=mC>8Zd%KJX+N@#OICAdkg83@{01V$-6p_ zbLFIKLWi%y?UdD!IwYxKDrSsjxGif$jwCn*>M&mw3 zd_!y5B5nRcDMx|65J*XqVa(mM`K#ox6>2R1V|8jZ)JVEch?u5uOxHWutQ{S)B+D~8 ziRCx6!h->b`KnX*+J&qVo?D}RQ{pG^6KC2vRqn)xeo zRwLU(mwD>i_gojMTNGNBvs#KX0$PaO%we zhqZG7kE*&B|Ab^XpY@uAjV;&O12-R}idrxzSK_SYV13KgsX)t$k6>{Gq+^-wxcby`?! z=!%xqqF1g8r*AITLW%7y!Q@&k`54XV=K1FME}n>C4Ks@##1Xv!|C0j$+}buNMz+|e zA@SY0PuBW+I?|-4$FB3QmIr`82b+xtPJzmn|5DJXrDUqp%@{Zam6z$}taa7}ze4jD zw1t`xb^H^lmNW>2jfoX{^YF5*4-NM?sLRJyda`w`$QYTMUHqHDbs-~K?o-$*D(7J{ zsm=unSQ-SDFhcKK7aV2k%YvgTaQ?!8Lj!_uVA4_|??UF#ay``+?G`er-ICYU!p5i8 z&W#LA^YDuK2!8w8cDX1pKz_k>nRM1zM~=R~%v~(PS@F9EE%moZJ7yR~ADGUG`hVFe>(Jeyf`75CC+f=dmu0 z`Sj+d1*A^WO^{y!WQyu)bd%ZSB;C|~dSWniIf|DMbfQKT>t=1KZVWGt7A1xi7wG12 zXqxq2QKFVFM9#1_4BaFs`!h2l8T*h=6U)?B--l4cuHS&=fS^;I8 zsyB91uFguQ&Nmox21{ft?NNt0#9B(6Y9PasvzBNzzalzPEVjoKN8fcD&dNszB#Bg| zlv>F6WUI~mrCpY&`X;{1y#-BR-oIE)^Yue%Jku*jug1IRbDCGL@o>-njPHJ}OT?ON z#2s6V)q6giUP~&3nB_2nt%-K0ly4c(#4NnS~71kq{ z6bMu4#!4-z(u`(n-RVMPtHQ<}>m>=M!$sc-8{2f_!w_W1`4zqLRUI0iciEw~B^O*z zg^T--zHChB>g%u4(=)qGF-H4B>2U>NgJ&~*R;Q;9F~vPvON+X(!x3AbpCM4J7AW+2 z`trS;3t3YzDPWwVrzdYzoGaSF_`Lbhzf4AF=>oc9%adIGE60v84x|&Z*noBh$isT~ zodQ854q$Oq_wM{s#9(T(qkn5ju|J_nH*Td0Ep<0(Rjtq`jS zes^0_LSWY{Dc7q%i}uhKofzNWEjk&a$dBvh9B7qt_qTaPSNWi{GeC*HG3UT9h`)R5 zoC7Am^*0t5dS;(D=fIwh2wpi7?Yy^Ee(N0wYyYzo}2qdd(Uoy?JZ)b$+%P3%reW9@{J+-bwCfGle z1peP+UnU6$DQE>HK}bdQ+`d3U6Qyil2?2`7{$4JwR6-Vgu*HA4zD@GUdumQ=`+>nJ z(ITO?dq~}pi+f)}f?a!kF0>{WYRHA2%Y`6gx5WHh=-0W>0}`U`d+d7&IlY{T`fN{^ z1W3L>|$iU|27q(Hkcm#<$g?#x`MS1zRGLUKQnQ}zIubV6U` zLZ9YBALK$C2syZ4i&|~3$|Wq3P>F!HP(rG2f0mHy%}#`O`*I1X3P$EaHM!7vxlm;;bUGpH2N6YHCrPY_ z)v?`GVpmnF*n^;6>CE<5vW96EUT(8LC2W1KH$Z8eW`2sy*GmiON5Rr0Awafy6B zFZmQ~PfJL3{g1i0-{eAR38~RbJJRGAB%o(uKNg^tUG3J6)@Q3?Xw2Kybp9Qo*cujX5! zrOsX|K~EW(o|Vut7Jc?#B&48!OhO9MhjSq#7n1k=oK$(=&*{faxws$a;>P9TBDv7; zT&P+?vYN5`O9=k;*nJ2wnsFJ;UJ|RuP;+9*5Vs2@wpQ})V*nkj@0O6vANF<$DWcvi zAte;vl#r^unNYU&rMdKHomdZz+J929Qq%8LNZ@!#LTaq;cj8E$B_Z*%wx_F*2(BBQ zR7Aw}xzJcb+3C31b21fYX>|xGdGoo<4C54 zhRsWsylLskcheU(i`In=n7BK$T$3+c-4e5d1^cP_o<9eStpQ`oz(D01f5A%u<5o49 zxNCV;KA38qJvd;j52i=Z&dY(ymuc#aK*1)tU1{R_OVdMFa-W)<5BqjIdugZgE4vz` z)@A!Ev%KhrskVSwb5j*|zXwl-6ix57gi#JuhIQ1Zj_Ae{KqN-D-F%Nn*8ma(q8KjI~TL@%?N( zUPgdyk4QGdTR@&>@23NtR><8sZ1($v&!K}6NSH#kz}`q|mzESg#2=rE0d^1a(*>f1_vb6Y;DMEl9dUn(|w4as|4T|p( z1tAuK3i+b{nBH^9A27XN_2;L$X?C}O;r*^e8BJ!-{E|$JdTo*QPep_|FU+kySC7MLFmKYuYO(hAMJsT+MXC*^*34)w0R_{LhtDB-H zHI%)1GYHyk?L)4aJs&3B=>3rTJ5K&?tX>!GZ1fyO*uRXvwApfY$n^e%2-budsW)u& z8=}&M9%$q=K5ThAHm5HsWJg&nzf@pfE9HCsfIOMUv-&tUizVg!lz>!{18E8%fulFh z5ge`59(Wzl?kK~RPhfP-9gZjmG_~SDRJkc$N_eJ9U ztnC_Up7Y`?bbAwu4;rT}8Vz1gpziqo!CFei&g?W;OQO3A9t$9>6A31~L8@Tc-{Vq# zA@DK$$Upltrbb6T=;nCO5_C>a!&VrgG0=k2HQ`~%KaJ%=H&zFXk7QxC$$ABJ1H;_^ zp{Q`~jmurq4U&A=p?0f@2W8@N0Ix=Qj>z zmwFW~|N;p~nSF$<;S2KjWwjN`C%@KvsT| zL97jR{^pUTQoptcxfwBUD^s#l3kDxRb_!g{UIK(8K946DHg1`xCtj3}c%lK0@Kvk6JX*uFg4*~Yg!)98MIM#TbL;7;aqhm;QkM~j zp{LHeZoKM|maI`R!FduJPERd}7`K&SA}jN24euKtS{Fz@Gcr#eIF1$h6I}}YiJgP} z@o$jNKLOT&8GIl}k5lj{ynVf|UdiWyln>CTMR@p?tZh2zk1}r*+t-Upx+!f0IA%W@Bo9&iF+!L8{+@suU@Ss85tr4g zS@LdtaKG4(<9CWY7Ud^?XD3hW=Td{;ylf!i%5QY3epyTY6V;`9O|*O1IAqED#F8Uu z%s}b5FkrMGdkg(?4t(-PQN`Nw*Y0k=E~`kbjebalA!A%Im8!g;!;_zv&RtTFTpLB> za7I>3zKE}KuxeL)Uq8S0$V(!aLj`XO{)GVS{YtRZItIZ zY!i|%fS7?X$C3-&HU*3cQLBYTlzqG!AR@=l(-svDtsxqA|9ZhVzVPmQC%qCQJTzB>a~ihuW%xbIFHdq`-ZKarK)ceE#YH zD$8#}=7{1D!Q$92i7l1b(pWO{UsLLY$g1Del0zA->NQj9qP#pjD=tKKA~%pIs$M<2 zKfI;LHC^&%rbN+`nnzdo0@W>$5(Y-ITfDko%oYZWehirl8)&JXPzT~oF@$|JA0lQd zz!|zxu&%&Put;#`L*p^QQN;M#mS^DG6>iB-b~pc+Tz=hjaBaG{wnf5*jXzy2D1y*0 z3z)G7!sadWP=xV^qDiqS&+d*Ht>7i0UQ8| zW^JdiQz$-!$hQ?wrz8v1=?g+KsRNR6yaFP%*|qA495mBPK$=Bs&^VBQkAZrqO_kLe zDin7Jn>5U0(t`e!a-f@~R;`(1l8EU4Hu?di|Kt~H^12Z6zv`PDlXTDy6pNg}5}Z8e zl1ErXbc5HIA8Zp@FSz;1aSAuOsd}MMR4dbmBP;DUSO+ohD_h+W=zK@md`6~%JX-%s zZ&p=p@Ekh4+@_P z88|bzyzXAO(P4yKKu6SPJ}-Q13~jVQP!sEJ3->^m$<5L3;+sUe#EYt-#?ed(Rff$9wE`Tgns8DO^Hr_piz3PWvSsa= z`2X&p)XaqyWX?RRm=)2r1a!~Phx0DNpgz?eKYWPFfWgpxE^ z5Tzykh#d!AauGxpUBC`OpMiXr9kOEhQn=B+1mO~Jw7{U8nimh-fEht&V}nyx zsYoSPb97{;xcahAFKbsPiZxfm7fE^Yecv$VsEdwD!D7l0m9ux|MCI9gj>0CQO|Aq0FrXuH^+PfpWcYENY9MW8UbYRTt71p^a@<3+(Ui&jfk^r=#WR=}NK zf=nSF1gPr=3sLOj<}inV?&mX0Kw0vkm5pR@YjR}U z)U0enZF8V6wf>R>T@I=lSO?W7u^6!@)6n5VSFZFqN0rwa23U7ucNGzlI+dpE&ZMGk zs`Zqao(ZBN#!hXK!*armjLNhN3qS#*fZ4t~w0y>(%sxSN zBddD0Wcwhr@)?$5Sv$BLaG)Ri8PKmsVaX1|2*n?f_F-5q!=M|%dG=(Kk}SsR)spvd z9&l&HA)Pu`m1B9uqC;@6Ok3$de6W2rgWUnMYqC(~VKySb5u7q&aw15(Jj0$RCVVs_^a=5tWt7G7z590|gE+9`97whW} z;xqtlG>ej&pd-w1e-QB9g*O@JIo+TSgq?n9sviuTOnWlr6$XrAwb`%cxhtu_kFn61 z>3+*g@N{RMI~&=zzz+_d#QjhBv7Ii2D71zqdx}%WRV8wU3t1&yJSRsD*;UeC*-L@W z=FU?C>K*%K4hctEC7lN8fQJ6$5;Uk)(#tQfO8TKH9*jrK@^XjIug=H)>UgeU7~CPl zbKRC@fkmC0zsR-xZPoM73=?@?AWs(kW29N(Fce3bsbyg)bG_M zlNcIMseMU{;z(IWKllJyzAYH-5sr8{68b#ty~v{PmK_fIe&%%IM-dP9-Lm6=^l!)b+x)od`(heBS-GRNaETlqB*r^x z6EW+{GUJr5R@Qag1gn>(R?=h>zk4=L;_a=(n*8fy>!{CYnbAw1xL2wZgLbaEQhe3_ z_x06?S=kdSalBh|h)IS)j1ZSKcz__Is63lN{JxA8RzgK%w_4@PB6GBq$?rYmk*KM1 z>j%_4#Fyvl-_+l&-_79Gf9ALAZ(-~9+x5SRHCo^oa%~@oRgzc1e`mISH-lUMN)_D! z{<J!`Qbr%rjz;v7I zuW5R>^^|>?*t_A0@A?-@9`V$g*C6$UT^}dM=cxpF@Oxv$o=wb=^EzpP6)-wpI-kXc z&_+Yoy!@_{)P>F7IaDtF`!?;k>jI#2yr1@Lnq(9ona(mVOsNxpPtZ0^PbbUcR4Dx( zZT7t7Z1(&RQv$7YxI(&KD=uNOMo!5Eav&*MDU0rJV?n$BeJPh%HBB5tq`_q zUJFlr!>@3rJl9-&yus!KZaxZyr-F|X7azrfkIeJ!L?(EF9yhsoamu-Pxu@BCBaH}N zGWQ+<0rpSfvcw@?P>{8bA)dUEe$u~9Y)3UxI%uV&)KS-)c zzPGx;l85gY2FhAbRa54CH6P&;`nGNyWaF~_GPegZirW2?5mxN^d|#ZCZ^URCHnt*C zU()BS5&-fxZ55oMX63sw2}?<0Z+UcdVlVD(_t0fZ#(pK+qWAvoAU5Dkqq83FC`XC^ zixcl;pNM^8w^jRhG*FDe_rgzNwS6Q|J`8B&ces|E1D)u`kIKt*<7Qk{4dM1cIiQ8p zle~&qCp7#+R0g4^5ai$H=L|v{Wdh}ctV!n;$`;SurOL_>D4!tIJfWfc`J5^=?9yNwwyNABb8|(A)}1`nD$i(62ay=8YW2VPdm$(ws}L9mRILpdyO)TMTEnxz zWTjMHe&Z!=u6qAS8aGxuPKRqzf(5h<3VW?=!D7uT@2lWV4RITvN_}B-5^w{=)mDtN z+UVE78avlMg*@5$uC?~W1F`b>%#%2HyberY2f8^tWD;aBS+?to^=e=A+NFXbTA9Qi z8X=Fh<7`!3Y`Ki5EYtqP0!9`!ACQxbRhz910F-$pes}pWRyF65EQQ4}gylUx#aa7? zo}S8!8{zT^{(50-j&Z0?>c(eQ)w$B8nfHU_nSDGhLcFyAo|3aNf>oc6L2rVV5;scu zE|%}9T51g6+2zyjFaH*%8-rvww?Y;m3A-Rvxi4J3HjJwR*OiNxB0vtuVpgV5rw9f= z1-<$`+y&p$3pV2~YQ6ne*FU{UIWb6`#aePR-4d6FVrjl&RC*v3A&nIxS;LAzj5qYk zX1$Wrfm@hl!v)RO(t8e}vMb_|g5(;cs8sS-NCKZP z2R~sP_?`<@`B?lMM7ZQGaMREvEMf^wE}#Al`}wAjtO?2b#g$5ps{B^1XV{rreAaI( z3&q>RhkIzZ(8PmTvBuUhrV310!JD(CcU_U1jF!@b< z3Y9e$Ai2O%zUv*c9>aR%gKA zoZbs%CBtlTp6Lx@XaJ&0J#o+zEtwsngRs!;XV+Ob4Ny|y45g?V8?*lDRc+SgDusHc zQqRv{(wkS(2U(546}f!6VR3>>uU>ik7Ck-m?9AWtp+&z{?se_(Mh=IUwPUYcth+E= zboy%L=*8C-%Yiuh*ic5OF~lEh-ZVLGlq3>Tl=X*FJy?J227^mP%po#E&f-JX9(gM& zkFj@2;=}I_mtuRiRkbev>_lVTjq7WNX$YF4^2&Gh8{5QFSVy~|Tc28CxQ#C6-cJk} zFV~Ao+1`a;)C$V8@YJ&e%1gXOCFTH_QdcjQgZ9FaZ>68wA-&(>=^X7d-eOQW5s|pZ z2b>3@KdM64*wXekhn3ikX^ZyoGn+w{pIdLp_!wK*i-rbw^dS(bo43(04s6F!3;QoVWsO@)8Mey!XpQy_ znX?saUTY~0@} z&PLp*A}*E++N|HJ3T9Km;pODMX)0c zw6q}plhQ*l$=t50=$!~T`fBhTyE%;C5q#fX95PDERr`8+3@7bY7N^$gT8JKhM`?Gj zFfe{&7w##>YZ2p6$aq&p|D9;vJWupKYD0r>TbF7wmTSrTpskR}ZXGRv`KNUAb}-)> z{bOrwX+iXNtt0sRX#5gjQ{V#&xr*dNZ4J**lC!h6Xl7|`Yctyta^HVySBN8ce(et{ zgQ;EotOyR;z*e4QWoDJK(pl-~1X|b4(RA!8IylW|pGBsu-NgbvL zoflC70Ph4X8CGT08M{tuyrt4m^}BlW2sBhmHIMMAU!${bv~UZS#F;0uY&cbVD}BoK zg^2c!K`#`*XK!4op9{^Rm!@__%+B;CwO0BR7=#inmH87d7X;>#DXzOiw^p0mtXiQq z*>h9Fb|*WgwK$CoW9Uw%Vo2(U=h-D*sZaSw-O-bD^GjVJ?L1=pJwW3KoOC#qn-zJ+_z83_l9A z954Q)g_gDCQcxc@&ry@J&^x{uFj;f()e1f`Ke#mA_g@4&ql{DghRw6thz_NL#i8_g zAFyl`Ut--X6pCOeF+lcyf}*(x>xEPN#>(i7z>wIhvBj69yZ>uG)%epRN*aaGWIeVc zV2odA1YhNXnbX4QC)M`Fo;_jXGn`9{I0r4h()i7N+G2g5{Tuee7h+9O=iJ&=QgP`5 z|Jl)(gUE5Jr%T_}jqwXYoHC7=)8W!qjuQy;rMe*|xZ)`_7^N&?e5hReUsqfaT%a2R zBGn&8JBQ59A*0YQeC&9ANUr1=qS(Ua-JE!XLXnB@jxz6lYpATa zs|%t(NbES|=Zt;r+-c}}(;NnZ4t2;)7bi_*6_hf{82XkZOZ7J^@i8R~hjVH<+Qr{G zth69@E39=%DSvS9OMHa?>()cTu4@8wN0f$f{u2u07s9HgT9J7o8ZH#kC~D#A-ys3O z6ocCVRkh$rwW1{-2Wr)llOpe}CZ96O+)Gp>(zcfd+rPF$Tx4S!-c>iIib>NZp>cf8|MN)Op5w9CQJ z#AY^aS1~Z2aP>4MmTP5*MOcc0)=ob{3387G`6KBu#X9%b2>Imr5YI}Vj9X1yBQ=;zs>cES!r*kL$M5%(PNAH&hCN#BD-^W|?5cj#8J zxG3Tdn{cTaY0Avat{+0?9mUGCGDp`AQe3L2&5qNNs6vTPhdOG(w+KKHXo@P-$B~yJC!6>ZPD|0FHamfw%&m9Y*U>ojpNQ1-<;hIo zpcvNS=nk$;kaZdU&@A+1VYZt^ggF^bz)80RlWs_M@;%D>!FwbslL*QU5zGbTLRtPX z3?53%A`<~>TJC0|CU@nbCA-RyCuWmJmS)%m-8_3FkE5XdI3$29DN^YNy9+cdklHq6 z^{*akA6-^p3)s;oNo92wijoOlW}%qNlpvFnL!eSMskT)CcvLm4mR%hh{^VE<_y12C z?sl|>9XM!M;mL)=K@xBb7BI!CZ{U4CD1*5@HN2l9=((v}( zM``#lBsrfTNfDrnGne|D1@7V0SBN?#upNu~{@~_08uc~0h(99r{Q%JaEn>Y#>mPg| z2Jxd%-}jHz@Ux%)2Ms?!rX!B%VTg6$I2QF?gOy4Uc{C&q#;kNyBJlnvux`a2;)t*w z8%ck3NAHNE^8j`J+tInmq@c)|n(v&zBi$+`|9+3z(TK@r( z{z<0)1CpL|0Xt&D*Z(IC4?bGMhat)Ngp!=8+WB;ZrG!NVWzmexY*$3vw$_PyS|CaL(SZrE18N`HiD5qmW9mFL8BrivgKE zkYXLux!^88eI*KYhxCE%%}V(@sIEhLBL(v6S7)shTqwKJerbDo_{Z+l+Fo9z|88%t zyriet%FouX(ywZVU(##I-XZ;ij`cSmUjJ0q1TK71o?Es$mOrx{eo61)m|6l#Sr_=9 zYR8YHKY|gnL;K>8o>%{6dH7`?MoWFzo(=`tWrwE+JEq^C*MC*s-wwZ&mnBZNeU-kT z9ezp2E4gF(`vC01C+Vjho-V%FdFiRV{;B$hxA$Mlrw)hzsgCgPJRJTj+s9AJ|2mI; zRQ*dCu)OvU=8d09--~B=Uix4>T|4yujrQ@E`cF8#`~@A;XY$#h{0UT;SO1v9>pvMk z|Gf08`Rq`BR>$&Q!lv9~SOl@5Sf z>UwN2k?NgV>S-xrYzP&utq2z2K?!!x$wzE?w7Zw@xTOwKWwP)p00 zJa7i4pKVqTOdirLES;m~_&jkZiP}AxQ=R!h?t2i2daiZ*+&aV^B66o^$h`()Q-g=v ztg|>mL@hDg8@E_bEfFX5B3ys>w#ANj9sMRXclth+;=Cr!E2jcyKC+J6Dsd?^Gs<5$Scm(-iVW@p z)y-P+4alld!FNg#?v{HCuw(f=jq|}nq}Q&{ob8@%AUT~X2BOfMmn0`fTMl<;?aPsZ z?TprZ{x7t8yoKwd-26txpV5=BI)E9R&*h2A5ZqR^Ic#t|dxf1Mv$hUrGO{kll=TrkCTNhn^tUEjs5f zLs~=U)_}jDEc%QXt;rMH8NzuMjNwj@+C2Meqj%G1;;;@9xFbY@7))`@$Tuz5Vl=|y zod*+ky?NH2XB@Z`P+Uyu0U|kaWZwV?ocUCE+X&ur=s2{#9UXE-o}LcQ2Lpl>jvRr8 zOocOEjT-dI&dp*0^s7I|&e9rc3+d~;gvDKa-4Yw%RxtR5gG5X2ixNs&)803A*D~7{ za(A2QecyIEme;K;fFBDhOwIwOoa(fsx)lNF26TX~Z&n`yw8k$exLBMzzWTHFs}7&8!`AIE=JxJ@KLHiPTGdmg;Q$pWPYyN44z zQl@<<6ujcE)2lr(%+YS37BKfar>FRt-l)85`yS2!-74Rgq&G6CW@2Ck}Lr@{j?;FbPrKX8`cS z9c?X>65Um{VgMi7$3s2VkeS{x$%`_*GcRwPSpI6bN$?B)S^9m{#iTZ zisBF>nCZc1srnquXZ?H*{Djl`04`+BoGkp}7hNH-e1Jc(cYv1sZyNQRT~pi_JSyG2 zmRBT-!f8&Y`kQM-iQo>JTHLxteoaL)x?1)sOC!dFviAOSpy$1V6=YyfVBMs|&_2qc zF3yh;2&LJbgf*)mqwm+__zVm2JjM_qHB4tFLFI4TM9lCWp&Fm)gp# zh17*awA6(RM}rTc;=0?4=VmcpEF?zJl6nNF$6xQTjrT%64vZb))wO49v@E<|t<=*sZ+=3)IXmOPW=%%1XR?*B{TBoj$^Xbpz9TPL_I2~{ zGiT>U3MJ7~IItj2yn6IPtx{ZJEAb-MDz7Y`rd9sFTx!-TpD3?Wzke;CuYR8^U#NbU zl{fLLr<3Jd`DKWtYvMsns0`;yUm4N-b|1j6q?B4`N@&h1X*`dI>x9Ow8O+~V`ck*s zi4@vEUt6RQrz)D0<#P$jzv$0UcKk-`61vsa;E7B9pF)ulyD7ZWPcCMBx5?<@7g0j7 zGg0E8&+_4Q89r$&fB2k%bq4Y~`w@6(Rq6ZQaqnSO03To8ee@f$tTZ;-} zr)K>%5;fHd-YzX|$H$_XBL3d$l7q1heX+d)X6)Di7jko05to&u)*6=-Nmavq)XNd7 z&p8+GiBeU!Sb(a!#V+D7hIK~LOD6_rS!9?@Y<&ELY zyrjd1cYJ%23~w#kz)oMIC6eJpkb*px?}8KgmU$F^*ee%fkLE_fS(`#~x!S?TUL+z| z#-L38rU`wra-E|{_S&3S*+~{CRe;a=i-yz5h{vsoDz!GG1ztrq9a{WNTju?CX{`LW zvse8)YS+Z8isedaR=Bu$d=pOhU1trNDU9PY8=jEEU*VV<0QA`10Zec~EDarevU)Ehl( zSIY8mAMabN%@g4amma0gtR4YQXyY`^?7IRl(rHE?6|vpnr=9AhRQ4N=gBlsN0t#XeuU={ zCfehFQI-Z$!F>5zCNf6u9P?P~R!|q!EZ{>oIYr}lZZn2;%7iG?F@hojYNK49kYHJQ z?={j^Wpn*tX=nL1#B8*DLe*L-Dv7H?$&$JJGNpKyh@4diSFCbQV#xecst)tWIhG1t zz3o(#D@a_KZakn$D<_TSWKo<7UjE@I=}?i>Djjmx2_~l_n`jnSCAXPFk||DxVGagV z0Rcl_zP-qL{0olnDPzSKdiuF?$p-+T<)3gjAZCtaUln6K&{vwl+sk(eIFz{4E*<5O zu*3_`SU1u)eaMf>i=*5UGeoA90WJ=#V`w9;`51h*B0EbMzth(Ug$VO#d<&+80r%QO~l2SSEw0 zMpKQ7^uoQ93F?qE|1wEV6A%%Wi4aYMK@~xTP_w5mr%K!(?1UVulz|)ptpui z@7c>LxJssGnVjrj@4qT+_FhadY@YusegbCClgQ{F8!&r(rlR}(lOO+;VYAP<=yPLr zv)_049izR_d;L-oE8+6JRcpl`C1Dk^WIS!g$-E>p0c^PXN!Yv|g930Rnu`TC7AQDw z19z*y;VdgntQYf!_K2Cx~@}K;$B3C_Mzh(c5eNA-V9&jQrFXJ>WYe`5uJ_q(5QbY{ z02`_;=SFh%-{7;iw0|pjeD-T9M(9iGhfwy~ONg3M7r^z>IWw;mPWuU!QN|s(ep#h*B8~-YkW;Hyno|Mt3pbY8BL83mmn~@u3$}l zF{##iZWUi5m;BIO45utfgXH6C09dGMty*=8LNxjs z0HCnE=`fgFx>-|05$NZI88}_;*9*s$DZi$=`B3&0W8p%6V&$0#^o3B@lDlD$#NIBv z(gxGWi!QttH%PC3{f@KEPQ3aP+oYUHv+)KmfSAKtSZEiKXNr;d2i48MMzFLN?$OU4 zq8BXHB~-9^c34hXB;C60a^4Bx8xA~X09pvvaM)tPQi=O>$ za`e@szc~L3C*)sJ#kYU)86M9xv1~%RYejw!%4|&BG^n{&2IWeu9E(fc#xjCV!WT$Y+R?PgHo8j8@_E7DmuQc#!Xj~d8*3%I#BCoWhDJuC)ZQX&;D@X<;&P57dqvU@IW_-RUd<8XzkIY4HpWaN|4fzt3YGtaaQZ>X7&d+_KdQSwV+H;* zDkr09qBKHkKz@qK-&Ifl!^!^(CqF}dIZ%sx-#=Ae^I^GTi;>ro?<>+gS5MD%@-B3K z_UeV=q3q|ssq&hMc|soy;+cA(cxLjtNS)*j8LDK+s2A{c<6)K0Ol(y^HOU2=Gku(D zzey04xND{-in`(~kVq)iQq_`RJ}iEgKoqSIkJkmAjKoHWEQ)-8xQUt;6scf~1Uatw zijc6Gn5N1!MZeeTorYn$RyS*XM&d0JjTKlG=vrbMKDsH%omi@j7{JqXq z$HJ!oBze+fD&l4dp`zx*tNc*Cr@7WAKRPxIGqF%Y;9#_Fj$v4T>eCCSf+F76;h_c$ zi`;SjsnvR;vP5Xf(*YoC-o*M;?EB1|)?ERvr@}ssGHH4nFe6hJI>soUI%Q_vEwD6u z|M*5-qDi2*-h`8m+oG)ez&AAb<%0>3rxk)u2R2xPuc9b z=8r5!_hYo#vo5i2i;7zzrD+^tS;8>mW|3zVObsB_gS=lnd zzOcob^lQ3ZbBL4~XUV=0yJ6AOLWys9DDh1q>j*HMV?p5Kn(R1evx_ooo5Bd|keA3bMH3f8*{ulDNHM6LCuSLp* zjrSbEeB6w?<)CT0Xf?vP!megrF6sU~?+;6N-!3S25N5wDlWZRhD()qUs@}{Lqn3hX;MOs`&Li=dRdQeG1=foA8-Hu^dox1{C z%4Ethe_p?<{fBz}4neopMDmDwFiQxX^8va!S2PScLlr_n_KBX9)D_2$o~9@2WjY|^ zHDnx($mCdnSyv}f@&;SLywk_cqErcgrIg&1_%XCrnfd72DXu`s*@U}ZMr)AhHgN(Rv);%mpT&T>ffv!ONrDH*NMiyXiSmuW|LjStrGEl1v9oKwrTPGoq6&& zaaU(XY>Y1oJ-n$Ga&YCf+quDaIJn{FY`z3H!;8ZO%Lz|^O5sMYzREZK4}l>=z|B{g zUx!$x7XuUb>0y7Cfa^bgtBArhZg0trlmG?fR_QL(5MeAo@2oheBR#|~}*4c4PSc5WN>`T@lRM0ii z@3V=j7yd>x@5JB&-dV)_d-f&V!Es5&^i67wsrHKwe_t8-#`=sw=}a>6ZH)CYcYqr! zt$*@Uy;AA^(QZc1Wxr(w#{E~;D^Bur{8X*yZHh-%@CB>duK;u{mFBN3Dw?#03)5Gvi|_9`<40PFDj4#ZGY3@35C|#W2aMkm;WnbZv?6KPOh~mj{HO6caFwVJSVOn#>$x&E~ynX8#~ZS9wSmtxxZwsd_jhJ*X&-- zRr`s97t2lWKqD1}+ZF@{intR@A2nsMS?yRZU}f`}V-d z$+yM~?}m?9mzT`hcWZR=&9Uxt_TPBx`@iLHkKfDRp181+Ho z7(p}xajP-TpC!d=?vi4LcMw0&qN3M1`zHD$0q4ogIr}Hy8od#{oX#kU_d9p0{STM$ zHyhrr6yup~9?M<6yU6H$Xsf{U4Sy3mG^6Jp34E$?8K?{xF9g@9pZm^sD zIfpVrbNbApn%&Hd?vXChO9U-UREZvQNvrkG`ADvcigugRBgS`}#8&SFLZD~^L^7wx zb$lq5L*z}4e-s`7eYMfECmD=pFkq|z0n0z@PQU4{bQ(E1XIl$(CJqtBMTZ}3k&bSb zzdhdLZ*&|Tb4*n@RnkDgyXnhzB=+^5ajR+p-Ra3H-#}07_9u$~GdAlGdz%QhIy&7+yYDzUZGWF?>Xut21@F2QFKS7w)@*qnuAPC%U#Q);nXKwvmO8-$ zcyUW4(_~Kcm_i%pIZ^gqD&|UJitO8@s*d&))4TseN8Z)Xw{G^V>_G1ylcc2t@ea*9 z@4~xupOP-+p>s8vxyMZ5(~pfJhft0x9s#2!*^S?PEf3B%ADr#h0CDN0W=IMGPkvn zNr&C8Z$3DjLEDHidLNX(Jr2mnf3 zxZ_Rx^K3it1C*dfQgir09&l_gFZ^)FA8mO^(q#oFZ?c@2M2{a)`FSeFK1oH4BBIFV z#&g$ilqo3Z4TpNH9C5_FIF;=g{IJxM97d$hdam_=EW5cuxJc&mnFT5**AiI2byAvx zk1&b|Bz4_(Y9F+vvWU50hLa`QJ6F(}=+E$<)e?&q4Pg8o`k_=MMU>Ljn8jx6Ni==p5fa|GOasHbcu7`%~_`W&)Q zXDc5EPMp~0qM072=pbxl)N>|Gd~(s-Zfg`bXvvEHb8?2vpcs>5o4Ax?;U(#!U4kJ> z=*vGwWy9x!*TJ8@TA5OC_tTPXG^3lr`JpuT+wk@UM@-KNahlos^}A%k!B6Rxvi^>w zr_@$$X8UZOs?wY_SKM3ohOjKRs25c>67T5m_mm=AWDaAnGRLcHh^uca)$aQfQ6Y0= z@sbHGmv}BQ2U^lHYJ6#_^_#B`h%&+{&XEIXqlui#EO8Pr%-7|*ZZrCwGCATN`$?my z8P@i3sux=F4uF$8f2Kx8IJz{Z+0_)v>K`b~ z=H+E{H1;)$UYTwbL@=>SpHc%L1cin4FpLA@CO9^(-S=Y%(hNT0r|Vm#3+9!jSKj#Y z*3-fC#C@FQu|f`Pf}3@`WJ3Glg1x-YG7od}%Bd2)ky_)J53oJsws-F{a0eG)&!jnC zs}bVB6Ee?XP-sV8*`geG7jHBu zH+t=1%Y{(-N1bbBpGVzZ5IZh&mZLv~jlJ>!ci5cC7_8M&E%1k!#@rBd$LOUWLrKfQ%g1qDNB~H|Odf4gi%kH@w4OSPO;;}|^ z%^hWRJU*>ee-d=z_?KwHs~UW5m6zai`K@yD3XkwyRo~dj?eb6jQPnGheWPC|nFJ~o?W?CRp;ODH z7T(lc)QLWQrdVGNML3tZ*rKcoR*`7o%56s-h~{$yxvSJE9tQ_y04c+oZV?>F{h=5w z8fgpZmFX;WWAGIEd9p6gM+@u^0zhhUcG8>U1Z#C-v2pvl@X)Lo-3KmnWaLMZHOY?KRAfV4go$dV9t63jtVW`-r3Lf zJFL44LzOR$H10m9%zh2(;Z_n6_)$dnaHL(3{fiImgUXf{oC~$tUx+=;z5h%+(B#2U z7VDJ6s#L};kdOp>su3=wR9uVLWSd?~S}LC1c_!$P@phr?V&G!?Sx7Cd42l~pcZvh_FV~Z`HnjEF3zV?AN)@PW26C! zYDsao)YI(20aR(`Ojllqur-IPzl@GxN5`j64C%b~8WMApxPUVqhMy2K{#`y4PRu02 z5+3&=@rZ$R=C+<~atC8++uPzV`mBV@^u$H9w_d>^*Mg?I%kmEr+0RZU6X(k~GMoe) zC&O_FZSn8QnT(c56B!F8NlFG@VeHi;8uHpb z>#ElCkO`tzZlZ~m>D;ToUd{W>{&H2ln7R|onK*Fmn-1UKU0x{FxZkysG?y2p~eaPu{>oMHC2K*p*jhJB;iv|s<`zy^uv>E?BS-VI&(cNW6L5L>lOAkp(f%ilO*Quw@~N@7gg&0TRRWuJ*rJIMV!eC7m z=GQ6QJX{sz8J-FNoJOO_`e2pJWQ6Z&4$hY!77g=+9|P61=HESxH`UNuamRh>bxeF* zsX8EHem~P)>0{S|;LXv~oeQw6Q*AW?pZW70JeF1_jJ-qgRm8lbLWyg3fjmKTc1h+> zoB>-<7d9vQWQoITn{pqVTIQgt9#mp{)?6@qwrV-JAYk595-7Y2LYh1`P&l>N;d7bs z7+_SbSTB1EHMnvo*WN3{h0F^?fsI>=aX;b7#gahvUhS6&X;F?&O(P&Z)qeS)gofPm zh?X8kNUbogtsqZ83*Pbwe?(RVj9K#o26<9vlP7G(7GzsX$=X@wUZsCL<&~y`EGT%c z*>8?7slK{Id!U8>IPW_$=89IJcV75W!_O>E3GfEvJdM)>8n5L{)B=7JOh(Ju4;jHKX=JG%osiLiDo0GL{jH5h)oFb+7Af?dg&>23p9(NNmEJ|c3@97?>zU7hG z_eePQbDj|t9-LC=l0wYQ{VzJ;4qogN;YF$vmrHcF9W4>#`_}v1#V1QzfhTCpE(sd9 zvKw?=DZO{uXha#~C~PDzg{DVjnaZU@xPbBJF1@#9@kJ#8b7qO%nU7%gt;O1d_qpIo zlGNMY#)vZQ!P_MjN)w99Jg4TzBfvQ5XfQHj)XPZ6c&l$jh24wlT)2WmW|!Q}Q&T?z z@Zb<2Nnb%opwOLnAyp@-AlHwPr9#I8xDv07i_c8Ggw=zJIz_={UQt#!t++539ouEh zC^0T$Ccg&+w8a_(5=GZGL&q8sE5;+49@Xzg14_74cVAX==zi16%*%@luPQM^C54w3 zSMN7Qm!KEU;=bS73cs;N?s~+DPw`;z5&L)42EF*J*95f7mS_GcUC0v^aS;{jyqB!G zt4Gk$pP~EO1Nb9wTchSe!a`Bb#pfu&_!(cyccw&k#nQX;f7R<;ixX+8oFd~mo4N`;WOPRp6!1E$K5Q6FvhS)r-&u?&kLG8it zC1Td<$+tR&oW8qDnS$@*5eM5$RSm_M+;~-8RR6ThwXzc4uN#A`*H=?aY$(V$Syf+p zhAh0Ug9AqRlui&arj#lTLDp02o~8on>W00-4STG%FxQ~3<^z+HeY`9=oX%Bk=4w!9 zYpYpAh{x@w?tIxN3Id$T)R`2IIGOU&qwutD92eqJuk(KG&VW43;7ow@m$~qmlb|~R z+WUbqi)w+*1;ho{{Zg+A*>@;&evbIKtIscbtQS#mezI>P!+hbq;RtmLv>V zQ>~L*bA1mFDZBlXfE=COVni13u)!vg-%eGC+YXJ((4&+&SkaPq@u_wZgx<~Z#no3A zhqbU}KgYmHQ=&Qw5CVZHRGy4qX_M#S@r0(d3kMrnN`>8}lvw}9|Hjpn;I1K7|N9w= ztU8IQi8>?IJMQ?dxGlrN|8SJcPprqbiFO>9k#mr;h5l8cN3^LI)#!sg9M%ZYMNV*z zU%*6kC<_>F#Vc#2q`eGG){U)~u3O14avy!K68LtX!Xr*SLVXWKgGIJT?>e$VM! z*uNNC6B=)YqiP4JLC$S2@t~$Q>}6j>UcxB0F8eEJN3if5G9-pSqVP)a^Ka$FH`_YX z&D&e$#hs4l;kCd4HZ3iEE4E~(F+j-dOw>I80>WQQ$qoP3HTZBRdOS`{C;LhwI_}rx z{5gVf*;r;<|CQ{e=B+B64*!lBHNV5^uuD}_qUNMkwB(#3y!<8E-RZ|Xs!kCOQ=g}) zX?0uBz|vqVm$ofd#VjD&+sRlFtxnXeUnv#H!M+nzf$mbCgMEeS>kvXo9V!KrxizUX z&(v&`rkzWWzlAZu?ibu-u14z}89~wO!P?=&AgEoF&G@HmMmd(VgPoNXYV1FY7&Z?m zhh>4yB7BQAl4~H?*sD1?2m4rH(Nebot-wA~eaX#jsrAM>Ej1Lha||;vv|N1aoT19~ z#?hY=HEUO75#dwC{cdIZX~cO^MD5Ke=V*4E>}#l0D7up0M9oSzsmV48nzg2OlM#QG zm`=7_JMN%8EZ#ZRsUIr+_s3z*E?@;-A1&eWCLy9im7t=d!X{oiuCu;UC&vxiS)rDU|LxP=3^(D{M@OY42M&3Ms4F6T! zLJJ+T9+&MCGI4f0QS(<-mpZKa8FjkEW3PyS(JxE85$hAcT{yxjQd;eqQn~ zo#gR($w)8N{jC< zi}vIgX>^ewo`Ld@_g`mwf~Xk7OGq!7h1G00ipLiGY|CU(&M&Iu@Ctre%(p{ezY;i@ zPp^`=GMT7g0kpI*k4u_Xp3-pa-(9O*Ctt!_5P-r ze8#5O@tM;V-c9S9S{hJ$JvPrR>$@Q%AW8E{)Fdj~OXGnYMJ`2e{cSIZ4Tm(6M9NU_i>&Piq5C#6# z0&B2dEo3hbbO8ieq;I0m zLQbvC7k(#xM1k1oMa>%8UroSaEzl&pFK1)P!SRUJ=V=fAK`Kno`o_67?A}t2??o1b zjo?D-1__+uf)6bdJ(v7wpj-&8m}=%ARN6Xq=l&pT=TfEN z)dkepa4wYOqPh#JwwJH)zV@$kG?FRIa`yzmL(gROir* zE^TIYAtP!Jq&NPhOy?fIx?;&TiEzg_^MOm3V_i)mkB4NtydqJvm;+6&W^vr#MdY{m zT#^6H-{kWnJ~>;nf0<-EFHvKt{Gv#_uhO?lc7*Qh>TA8^?zruUx#({cR;%AXGug__ zo|e0p(xWeSb{d_rmz$Q=_=nRs%ffp*s?2U{41P5F;{LJexA(vK#-GTh&}z?MHV6vz z`u;NqU2y#c1N(`uIvZH^H{W<`Y-Yb3Zk4NYh864evHmwqyzSOIXmD7mb@oHhi>%33 zTE#RjD&<-ebVyan><7lnYc=yr%zlT(*EA8&O36+dbj|Bfwc#- z)0`tXn!Ox|pl#sdLiYIn!LefO6A*LePw{OYjLsqoQ!Z9+y7i`}=dde)Lo|O1D!8-dH1- zByXsfk(vqC`?I-gy~P6;@tN{o*b0t);JUcFlY~QOpR5n*`Nk5tVd5&^9bI&z=L$Y( z_7p#>2d4rK>>QNtoPZoWyg%qd^eA&u);{jQA7$;Gg?$(DvRG->A`jK(7!e9(WU_~d z7Ddk@6F-r|nUR98L+*x+__;!ritsqxcP?;Qw_L=EbO3DVZ&-NhC7#SD&SsmmHI{2( zL_Q>T4uHg5y7McxQ-q0ydyT3M2ZJ&KLZ}D_Pdhz|3~8rEzVc{M#E5-A4WpANJyRWj zvbPZ94CemaV17>q^NG%~g`({DxyjG*b8(*OoMd{8VA6W#7UjK>`~zY@H@%l~TY^%_ z_bNl+AX&uV7lXOXOFF`obC%nhIzwRnGW^h`I$0l+XMsx(*gAabOcp0KumdR0!R(M| z>Z`LMEIV56RsYzj#SSe@y50D@Ur>zoKP5g^(2KG>$gYI(o)VSTD^Bh6QEL^~K^|JEA^I@TN+)$7K zQXamQu8J>4p|_s3A^sb6*urunl6n|g1NH?=YwK^$dlFbT3)?3=x+Frvy8kgX=V{5e zRLd(l^nYOMlAArTHT;Y1i6_Gl2D$Ff)*+)3NDRx82=ew`{lVy6#$SwOq79xJZI+ z74e4khFHryMg>K=oBZFObDo(@LhNOCU$5W)|9bs-y~sSzIp;Z-@A;nZ`JV6jUa|_v zG5g-!BNGg@LU0RdxHn!K)e#R05gqqh?jlF>pwbEyR7|g>oKj{E;F^uLe>B~W4@Bl6 z*L=Hk?|z=!x+d%toRoBnV%|P~s^Mfqk07EBt-B1=SGiT&)HNr)5+G$pEW~=2wp+N` z5l&_!VQ=6p(sHlijxbZ=-$toC{V@L9*F|kTUc<`V-BnSN6w z{)%9ZhZ7_GQz#$c!dHoRo@Nq@ImO@kVbgFEJ?C&#H>ta+dZ?2|4%H3b`FHWVpjBWk zH$Jm6x2I6PX=Awaz3M(&rJcR158x3_Qk|<7K{}_1;bi_-(zoa72fSbWQzE_2s;Zu( z#5=Vq?5eL@nHc5YM3ccfw&fF_j$~%t1F3=(^I@cAR)ruiGPOPNYOLnEl}-wJh{8c> z1pq!i_pqqP_IO>)GdETUDzqxh`10ss(MOkT=RRfTD0LLh=9ZmioECjD_G9gZ@KP3! zj9y;uYv=Z$l1brSiLVVt>5#i;I4mFHMxj(5i&RB;TMu^SzVcm*RYSlkCv^wk3uErC zhGQ%7Z{jsqh9WY=FrwiUt+=D;R=C;vHb9D~eY3xevYfz<`w7JYH$o@>f~4ln8nGWz zE!oL?e%zCNPEoc)w&;_X-1pZn0O8hJQo0347^#7*sP&8cB+gZ0s}ki~10to8S1a*{ zeG;!!;^sb|E1t&sXZs||er^2+eG;cBu@uTs+@&c>JXMLG=xKej5-;eJSgpiaN<5*b zr2LPq|GPekXOqZ=S++KG68y+CO0R2UTV216Ke^Ytk6=HtHMqap@cKX;)>Kmjnm?u1 z{AQXf`OY;ix|C{m>-H&gOs0peUADPO1u~xb@upWf>)bMLIw{55cb5O!6gymklg;dv>}Ip6X>`lX!Op6gaHN|`Tdp|D z5zXM0l;~LHQm`50j>Eb#=hkd+oy$51YlO>F;*7c6 z=p4d29<#RTw283~a;{nFkn@B$3TXjmJ2e{;@8XPYKrCA^%nkc)4f7H88rar`^MP(W zG5H5*C$<5)QOWrgqq>qj&`k@i6DdX96878f_;|~opfn1%7XNha2~7D3M}i->oiII7 zIgRz+jdWi{T%&Ltq4!VG7{Mbw&n z{os(Ny)t8R)4AHHKE=FpRo?j@fg;ox9}{kva|=H)heE~RY6PCzLPPgKF-BFT+oxu1 zHv<58V=I7x8N9JU?ltg8_w&ZXhCDl@FHkqh9>X;}fQJ)8XX|juonL?-uGzBq6r5Lv zqnR1yQ5@K!+}Tq1iBfR|rZh7?X349{&4iOX4-VPph0TzB$#K{2JOvUd0nECUCqp71 z=1*?j;UhuDCs{u><0)nQm<*wgFE%kc?%9TM*MUQ4}B-tEeR)97Ls!LI#&aR1D=lmZ((sLsY6o zRPJWhHCM55qWb9B0agZpNugM*(ip>7ew6wIz zSs|AqmKHr;+A`bHqS=-f&9<~?c6X*)A0>Am^r|D7*(3e1M&tdqhdxO$59A{HVJb|s z(d;xsNh%E`84D#DD@rofP!fSw`#({Vpd|a_=jePL1fKnLZrQD(BX>YY;81+&J;Jm{ zy03(eEQXHk7age=9jO-`xm1nS>;Wk15%8p=S^$QaH0I8yGS-r2tT!>K<<>^Tq*03o zigFvRL6Wi4m1~;hF8l=iE1lsM7Hpa$7{;&33~)LK@Q(Pq77V}$*aJ)(OJVWlfW=9f z(}XE=%T9|z0yGFXR-3$&dYGEk4c0(4KV$v-m2COnpziYi>UH_f=HIfD5#%fM=cqo@ zz4+4c+wFdzDgBN*>9jmV-E`1&PD+_LIDP{q&xd*tAdQQcZdC?eg^V^Z^GkJOIf6c> zChdF(qUxx64DYIyT||aumLdO0wtr5`HKK3Fz$UTNxW<>wZSoK+=L}i~Nryb;Ra>I` zlRQ5q_{?!}7GPqXuWb`i>qCY74>^Q`L2NCo<_7O}JlvG@bT)MbUC=O~wyvSJEZ%5_ z`&{q00kw6$C94Nf+)a6k+W>A%U4%tA3dn9?IWd`X0%mqrqUmc zqJsrYA8Nl1GZmZBhuW_u!=UsV(vcYVq;;zn-bWC-3cpgF;vU^h%->VM|B_ns-t!f0 zAWz?MQ2&Sd#Y$0kNId)h|CC?Muzm%`a_A3oeAe>W$MB0|{s6zI?-bBP44@FD5`IxO z@XNbJF8(0DXo@{&iv1ye(XH9%EdNF|7*!Ay==p3UCBOezzVJ;oSM$ovi#32M_(BO!z<`;# zuTT%G@m^L~Z&L2UZuY|$qD8Ac@-)L3x;4Lb(#UTN9lwEJ=HA}{KIZ8IXaRrd_u&tJ zPGf(BKRjfRI$#RFz)LTt5K|Sf7bPfuMs+@H-&kv@fGHI4{*y+IWeO833JhUmyfE^f z747C%bPp%26|EDXVF=}cPX~rdyB|K$iy_>QCr=;C5LWif5bkAsYn%FE2=B)v#b)#& z5qFcp^o{a=C^(IKCOYogkiUfIsCTk|SE0H-r1)?6s;@qZJzxF_{Gd5u{;%XmayX8lLAXJBcWHRNHs{_fp=tFA zN;NGV3|lyn5;}?gA(E3}g~As8{vh_AVhe|AP~HyqZF?4>BXC4cO71K;fI>vJILi)c z`33x8xs#OBO}K?KCBVo7{xx@T9^N!%0`K6ow9R6^l=)CyDe^D18+P(S1O~F1lj*!&hiS+{|vZ)rUVs`!UZSzG{x_AIl$ZW-;{ehuZ}T@rOI&vogpsmR49k zOoz6J#}!6fz#kHxqLnXI=9XO+ewLRz(=vy@Ak%E|mN`7r7Xe++YU+gS_pJ>*0vHK| z0(R!om+-k}N9f|qD@Ojl#dI&;IKD054@V_AP`8Moi+Cqk?oa}UEtn-_OCR#zhTw_6 zRb56D^$Am#_`);c3m@mLht*1-34DRunf>vFJ7gIYQvaQn;UaR!j$xO7yXY(ST`>8E z{}{(RXgcIcugWrpKhBSXZ3ez@aM+Jg*V@{C_`;_6^vLVp{_jRwhFVlPid_$v(owG=+7XDt9CX2dv>a=`&?YvF)qalogIxj>T3wz}sf z-jidiIb6m?z4wU`49*svhqKp~Mr&SkmW={5_YPoiPP#=@gX*-b(Rq9;agslWB*)y} zWv`(83(m5)R0xK~d&XJCeTUOhMFkSxd7mJlNaBV3V$3gf);F=`8nDwMJ=uB&LwJ^ptE^zY52)doyjpYt{>3rre^V?k8})i7$eQojgl zJ--IdW^6T(CiJe}XSSX6{{f$f?1b5!{}zv!j$aD=o^qDmrWKv|0u=LKQi;+q<*C0h-C|4_1=|1U&uQyTJx-v`UeWDY7rT#Uv!yKzoF{ske6+# zt+!yQB?98@Qw5^9q9y2;X+=WUE@Fv)93k5)n?cG|6}CTd-%d(P#ZYY6#?Fm-I)xSV zC$+EAnOM!CC8#46#<+A`&-h;RUoxccSNZ<<&*YbDT;#@krjQ|rFT!=E#_Upa-S8me z!WT9T|CJmKUP9sS8F$0s0nu@28GJ?kGW|{5WY&mkV#G{bL858JnL~>y;?KWaK#4y_ z5e-$5oJ7@gCOz9UQQME~uolDZ^iSbo z1R>0L(_MNN-h#9!_>k&Kc6g9#t-^7tqKRj@y4J7$K~~zW0CBF9x~pf6%_)y$hIt*y zov@8d3^v;)TG*7Mnb9mD*Rzp5T<>lh>0`x8Hd*urZZ1Wq2ko}nmUuwOUKC3;`9n1BSUZXT@Xn~8hxj+6cnJlj5JSsB&Ea7dT@kq9IgBGQm?y@yR} z@T3DUuNGfg+UTq}iL&M(J4zp6j|Pbz5c90pcFIo2>|j$}OKei(;?GFnx#UDDM0L+r zhNj{G8SRC*^S#-ySZG%@#u%UodGhd`&We)-+H5`Trz%#eBv%bE4~EcZXO=1ongv6w z<}K`-sVon_m^u48cYTvI4n!O;IjxC`m%CxuG|d-(EG(nmATxgvZ&+Ps?#NE`Nx7uR zm#SCPyr9hh_>ttB(D}DOo+|afbEc8!WnCcnD`(l&kZ}?C<;Fg*D%r(A=4&#!FV7F8 zwgm&)pi*(m`35+ZYMh9b5)a6unL#o7=cHdz4Td^q7DD;oiC^k^2qy3z5X;<9(JP(~ z2EW|XjLDs{0F`Eph|N6>=kd{~Np)XQmN$Du(OHrW)!9S&FQoIanm3)KY~@UzOZBxf zIY7J+Ohc~YIH&f=Bb_HM|xH6F0m&xVbAtJSlu8r~vSr z%X6gx9vfjSb3MTOos;^#pzQ51_I_`>-s7Dk0P&Pr1uX6>Is?Mso? zgi6^L$HAw`v-u5C|+{M)o~c;B=O&g<~!^S-w2v&TwQzbgY2+ECM)A;zKJ zH1X($2dB4d7M)a#P8yNLR35-baSG#}HhlZHj#3m^dCfD6|56n}OqZ0SnZaeoMb4^E zw#+(?^X+KKg(48KtxJKg5dpb5Q z#}p$;k*43cr`&l@M8g-kH66}f=4whz57{QRvOMCIQ2FB1W8vRYWmx+_fa=aF z7bCPyfu7N&CDEE^5^vb+&xe2{-e)4o-wjCIV2?41dkd-|yjskCpnOvBWq#8YQ>epe zORNNjQK#SECU$i`6wS_tln2B9x+?Ix{8NMuX4Z8ou(RH%S)Yf&jK;{i+*tTb7ZJ=$Wn5}fL7CZE%l3%b4;$JwL6*N35`(dam#ZbLfW|6lR zhU(XP7V?^1C)kI_*aKRDwNgusrlkzt)U&*}PTiIQQ*}S%4i>;%n5t0~Mjzz6N@a z9LxS!g}x{-T?gS+PFE9xicU+aU?nA50My4aUN5s5MKUN^j(f}7pp{zlgmc$VNyM`Z zY6fn`f|LV)L&@2~3=XVk%iWflA?(dZc9t|`&aU^4>UtG^qa1pX?^B-R)#8Nd!Ulwy zuQq(wWxe>WhnQT$cS&JAQ$N4SJIz{}JsliFtvbh_kYoTz#V*YJn%|IKwiRP}PZov5Q z9G9k1d)rKXUkQxi^H_r2+aQpHu8e;!2K`l`25HV*0q0eZZIzt?U>~qv{&IHaIw*8C z5iJMCU#Cp`*_g)j@wHnaZabtfB?`0R30iR|_42xlI)*IGDu?r<>upCZx=lVRq zQTV`cG)W3e-WLMuIB3P{nSim>#B)f`PXy09d6tfi_hj?$`8k^G3ZKY@@X_R+QXbtC zk>+d}6w8*L+n@+faui+L@_9FG5fOv<iCuOtd4mzGovU5G552$ng(KbT_fo4l z^!R_v)B2ryWzunVuUF~bu48IKeuSs|W-d37hU1K7uGD58zdeTWa5)E)s0Z&#IPYh~ zub!viF--p4Kc8Q9(l(@r^@sBF-dt;*ovioXHb;$m_~-ODz=Fce8D4R#lvRbhtZlPS z?Kv*Ld=*rf`JanS2gbO3jTSJ)U+3p&@=y=T9RlT0^w zA~M5W`i6H0C3jz(dMU*QpMEYtEUPMdi!e!uW&9WTU(u@&%P5-qSMy{}K>x}Z%zVXy z17)Mpj^v13U1wOrH?9Jovi4-dWiCgc7bR>g%X5cf3_a2C{8=c{JsTJg5@4&OWm)Z{ z6^6GV^Hn5`?<7{n@;e9wWhJeHEajZ){vv9wI7%xlFs zfbwzxa3ZEZ>PD~A2OL2i^spLPm-yc(OjIP+B`4gpChepv%Mr{1&v)&bQm!@ zlRuCmxcFpQL0o<1pL`g(zR-<6M~?%To!I{MIbpmidlWnccG4?LwfdY*9;1McAj3_U zw7fHCYsdCyK%2>Ek=nq2*j1xIrvG8-^li)#k6JU&lIm@2-o?*R1$)_=eEn#W2m*&$ zGw@X#;Vd}pi^mK<@78?iEW3@SS{yfQu|zN`mv+fp;SD*YI2R|kvV`EqhL46~5Ax>= zo|Ksz9B->djkIsJ>Nhzk?4L?c?RmVqH)YFHG$(!7RAP4r!=U&|F$7}+U zv-QZ`(Gxkq*OAN#F{CGGCgb<~>EL`e?n!evyTBaIB$z?o$l**hbI7)anog9-oaHYt z84ckhI-50&>&(v+*U!d5h}~3YRg^T;yqwtO-$!9{F55l89EF_JH!-LQX1n;%#4Il& z$DWtIC|ni+)P-}%$MG1qcEN5GkRJb=S}A6i?sKO44Mrn2qtBV@;X+2AGu1znQS86K z-fu;{CwtVL0#9~uWh2eqmM*#K*a?j)tMJWUZUqXh;-2VuD6*fEC7CmiJx6`4Qmcpd zzNm|o82(Pr(5jII!E|ki@pn+Q6-%tO6BXL-omEdK58t`uJiFg( zs;R&m?WESK{rt6669JG{3cxGRecZZvT+>yeG_NmfZE3Saxh#L(Qws zvJyTsrjVUu<B z#(27$8%M?LwVLSO;@R4dyPJEKl^VZJ@}9%Q0E8}w^247 zL?YP<;K4&sK&xBxPizIDK=LCNy3DYnHP1WC|CLH%)5FX&)9j?b&3gmdqgi)=L6hh> zwiLY8c~8V@o{E3c-fWcjkm+E==sd>#yfb=#=N7TWaJsYUUnNYzU!n5cB#Iv5pheAfU;g%y5Vpc zK{=5+IIA9ch?4}yD2O-M0Nt8xi${1*Sw51~QH>m8v>7gWJ(j($w2bL%sM+l-)1K_C z!U~0}8y(`4-2+=5*}2D0*Df_ zca+eS3Jq^0o)`m;)^s_`_wt}Z6j(|ep&6Wqx>aaYW4tP=$dlxiy6H9=p%arD5#5_l znImcH;Ob%EdI71Wt|B36OCyy%jT3%O?-fABigt+fR);x_;nAEFA>I%zY=Ss(QwB@s z+$A51^8ap@1KVEsRhd6Ttfwd;uJ5vA+k@RbKwd})D=6P~R>u>1*FZQge5qlN9vyeM z-ur~JYFqXjwXAXYb!Yi^>0*HjEx9qd^D}GJ>qkPgY&;mqGN_?uuMC53zKF<=1QCMF zIIE^&X>sw8j%e29Htapw;KV=K;Bl_(=zQ5=qW|~wA~x;-afB}nXNO0_TkD2we`aUI z`$WWxl={11`$fit`iZlWJDs(-bD~{fV~&cQ%hxvPP;i_QjN!%=Ius1tiaH*j9c(&` zLPCyJ1gwl%-y1?1ma--U)dtpo7Hz6SkH>D@TZvriIL8; zl`;KMbf>Y>zzhjgiDhS(a`tgnoW=`uU(A-*6~RXH6v=<_P~ahLeg+2xD8H!b`|8pQme}w9jGG^_ zj;{9zNc0A4_XvyqZn8G)HXM7zJ5r}Dj9uV0PF73cI1deof6A`LBavr15pg)F4#t`N zR`F6^MT%k1{b>M6djP}}iKO<-@L+$k4iPmk8Y7$ZaGHziz_t~T`Qr_Gzt|xAoAi5B zW9O&OndQ26$!`0(N{K0>wx3&q^T?0@#%fT2um-OiVUZ%)f4WGW%t{IxZciRL38u2b zS@DtCDkJ&5ayqoqm8Oaof5h8vfak0lK2j8=jj&KaPWBLWxO68f8pj=A$Oe9KWXRzt zpnEnd&>c5bu%pZ~d$?u%RHPRLTydo^gw>^uR95KF(*gM_Zf&F4vAE`Y+t^YYU92;O z-GtZ!aIV5R(!J$73_8rJxGA}-t?4kGYA1m}nFCCR)vs6${PG)%MYV@TlL}H8?B=^v zLHbq$jG2R6ZedNJICmZx6ZH;7n%`=pE@*!Y#Q~Hb!mmPUIOZin_1-XNxe!sL0nBUS z(R*T@mbY2x@EX=FLQLM@YhG9!LuoqZJq@z~D2a;}Hk`)xSoU%@pu=$vG`}Ld^EDvn ztngVuzLfXP5KNQ-;$lzF)`eK{wOa8{K4axa5%0W+cSWhchk5PU@xBrChBa=MKU2d^qAT}rw$++XCI~`&V(1Dq!$zp`UlhHd>7z}D4<;xRSt~M<+*RV=LbdrE?}@~@ zq^%u8-ntMaB1R}={AH?4SJUC6iAsIV^5W~TKasEbU3;?mg4Bqm=wGHiZTy<=_4TaVk^5|jJuAou2c?xQvrp*=M#OoVEV=X0@N3>kBNe+WIZ zypFvE9O-8;mCx_)8Tu;<0waFRz2jgGE7E}H>bE=Bcu9eA^9lxm{pu9H;6G_RHo}Jm zjF&*{e~m+ssJ?-GRdT0=?jwS(l{#K&ZlgqY`bY?#+lVILP7B*dLcn&Nsqi$)qh9HM z2~08Dv_FR@0uJ~y1Kd$lL=rKirZCUfY4oyz6)V=n8gf=$$pW#b1&0i zvNN;~J4s!L7WYcLJ1hWfj-@lvaqo-NpjaBK*=`s__$W>lMGWGTiSL+mkn8O=djUs) zl%s>Cq3eC5bny*HT0{%3Va583=}G~~&t%ulx%g`&2B1vLBT-;nJc-28@hmINO|5fx zJA*9s_r9MeRio*x`g5@9(B8y_^u8G9zX!11UXL^P%z;c`u!}Qu}men%Dee_db5IZCx zP6uP)a$t1u6;6=P^$u`$chdjN@MIx`@9PF{mx*L@ph0`%3Lq8D{uL;LKI)e!zu^5N7)tKOi*dL8nFM|R}KYChee&xHZ`gY>lgLAt?vHn=Y+oTEP< z`IFDlMVd~>Ycx7X%cRM)rJKja7Nnf_ffMoft~ghVTNdDKx=ZP`xu# z@ME=X^kbh~)YupNEf)M7RhO89k{cXswVb4O(D{IoPl*3PpY?LqJ(yB-OdrJj()WIj z>89_{UY%vtNv&`*kEv>njE@R30AxapbGu5xCKK3E19~gk@LJDX&`~}lysA2fjBTV2<2WV;IEXisf*8tU?*M5iE=d+)MqUOB08-* z%Z(p>4r>{r=DcDSiaU?45Iyf(+IHM=hs;c2OAyO`5lfrvLf*MLNUj!#t1v6uIzMOS zUW)+!0q`G)$$n0y$u|2z68{2!lK?;kNW?n4wIuxL8` zy*-VbmDdZ-2JN(|>U=vZ{zyBw6}3a0_uvRz!&htP_H+1n>JeR6*s~6^F9_(k(}M-6 z!w^ZK2xLVXR}u&rcT5|ljo^Iib$UM@-x^yMpK4A|F1`lrO-jKVfiY8KXQj}Rmkf;M z!o1*+z-nv3o1^x;;jN3^@NeCxv6Y>zMU;A!A#82uv6ThvL+4rtyn+|^9V6f8DA zIk~W$`{Ay7ma(ksPT)fep+0=l{c9y37U=riq})x0y1@-UB6tY5U#~-r2;j!TypGYm zL3uxiyDRlIaCJlR`g;e&BZ7;oRp~Dflxv>UadL6FBE|!@J-ql&kzhN}=XUzJHPW!IgQxDRUoFd;4GVjzS;wUK zGlRPeqXCH|_+wP8W1RRHdo4)OkGq$T)vo?sun$VRdIIYqK$1#pOYa8K>r_P()%H=V z-VkVBOF}tUa<(iBzdYKBpYCfDEXjof~Oz7KJ;7Pks$G%}w&Ll zxWGf_6kWDonqld}FyC~v=JCY$@i(nCSZ(xHj3^|)yg4R<%yg+;;1`%HIvfJz^;eJ| z8hz^%b3d;ZA98z-zBM~AcjDOE*bDIIq&@+8VE^wC=g(mPM)&7A4NG~dz1FZHuc>#M zfZSD74G})bb8k-M4=7w4Z#lgcuD?zjMGDtwYz7L~J9G_M?l-b8(1l7aK6@!#qh&71 z({lo4zj{A&L-8{CRQZq&=0W&@CJ?kW&`kYY8x?g2D$bRitAc&4NP|^Qhx9eIJtB){ zxW6yz8pTOHO*KYaJK}9FQq}% z5~Jr`I~+QG>bUl{3LUO4+;ku%MI;nU_Mgi*uHbQ_8+Z*n4w%k5cxNbW{lC8%euW$_{Ur zPIf{tF^f$)+2%vsZ@1GRO}6cyDxGY(#jvXZHHcZ~7nXqcM|861nD4+f@Y^gYe zFxDw>1IEC|Uk&*!!u{`wSunV7728a|3)+SERwPItR6dj2}q^=~-;=|AM^Y zFFEM_ae2jCqS1MIh0K*?e5-S^la>yXI_8EFXZs#6x_`ieZnNTwH4t}WBX0+8#TA#U7Vx7Wt}yrh<=p!tuE^W*6yz1(sQOdn73HSF z9!6m#y)g0$>)*gI3Vq}ij=5Y3hL@3H(3y2LG%%x2&DDQSzZ4ElpmA*u>zFSID#U2 zvf>V7N$o$VBw!?wlsWXu5wc})B;Q&a>W9IpxKCTc9}-naHlkTUR3Qhbbn<^F zsyLNub&c4csG^NASy9EA{<~&6i)8~Z2HU+z=SV@zlFnlU80~yn5MW%++6>mWckK00 z&$^ZXuN!^4gJ}^=4emgq2kY!IF!?xWdRg%u9w6? z>K3+{K70B+nz1w6N0KtVkkN-(8&3xE`98)<|KFBReA`UE**c1?zrU_zkoW(WPkfww zV#5<NDULA=59AcT5j6fRIfb!_Hr7h3MA8{vAg8G6PfqcPU~wKRr`XE&*^iv!2P8{Q z(Ry0ZIqknEr>N>Br#NipJ&;rU4oYj~64qK=*5SdskyHGdcMWZB!K6EoPyDCJ=vO}R zf&oX5e4>x>IP!@b`M9rq;;%`w+qawwt!>gK)5kF4x*z^2@(GN_&!Yw-pZFXP|J(A3 z=jkXAsWRJTU^H&!6UMKUA;2FmpZK1Eo1}HfCmyaSp#C3|Ps}yn9V4GGVCu8wUG%SP zk|v|iCV46u1^LALl26q3vz2$R{BO%A9_=lk_&@&>`Na1)(OJwxKKFl7KC%11DWBl9 z-6NkcaPGs)eD?=`R6g-{{mLi)>HkIYiLH`Pn9=o-PpthH3CV3mJXn6D!Cl zl206zzpn;`7B$Yk%!w;09~et3b%%snId@6HH4b}yoo z`LPVrbi`;)M%f_UrfVK(LaIgwpR&a=DXEsO!4nnZ-k9P^6}` z!dd3(Ls~00K?03d*a6vpN@c&`NTFnk98~8p)g+t$EH__78lJZoA{(lR5Oo>uOQ; zp48lVhCP>0ys31_r@VdRw~yQ8?Kp5#nFjt9fjhZjxNIv@H`4D+xMs`E&-Lk7>Lzlc znR|5wVw?1=IeIh`uFI^{5abFbn5?AKNyonw!^Pu0o3htjU204xV;Ip_KB{XXCncvT zkD8rs3{Qpe8aT>H0~1*-sNy1ott7oYK>#WI&6*j7TOumteEbi|NL9)v80eh2M$R#o z)_J))?;S#fF|YV){bj{Ynk&FFy*-+Zr)gd?MP#(;((x||A52iTw$jYZqjDWVYwt!g zg9!v98~-MX=7s#ZTTd?GQfDgyfHIOp`8Wt!yC277vtW%Ng9~-mOQaivjX{Yi*&9v@ zdpRQLq>WD;!PA|`NDNvwczbkmT&NK-EC%9cC*13Qi_HgL%;R73Z=g8xO)jObiGM~{ zKDgY-i&*U-UGD^MlmCR-uD}p?-s42q8h}E8M8i1^0uEw)TW7o8ck*rmAoUDwTkW<{#MMjVvzdJJiv~ z-^CixD72|Ze~C!PCVp8IRrT2>=Ij;tPE*X7T=S*xnYS2$&l|E;Oj+ zaV3L}Ra{s*&T;}s3hBppN4y9 zB6geaGXuZOCm1$=Hn);0+6P`4)Ieo_7d)EMogU#~8%W8`IUQr5okT*rm^THB+T9+6 zp&K}vlz0XQhy+FyewCbmhRP7>jfd!>M1mdGY+kgjec($x z3g3M>VX*y`{3LLmmwX#~c$Ug&&n*jdS!c2B;F2X3=R-875~a@SYX_mKem=%<7<6EG zkgJA~QdZgc?Oe!44(yL)7kAZp*sMG^e*1y_&g%No%vm>6@3_b7vR?{!qQk@tZK-*D z@u%DpEJs9g%W{9ul?`B;Q6GL&BzD~1`kHs^oJ%0Kxmb2mGUBYhZ~;*uwiM`IS?+K7 zL>E!z9%Ki9-PJ{#Sf1Z-R!jPOmGOk4c8Nvu@nM z`kLL0V<#`M>;#SD0y7T(Jf?`ZD+f5MV-;uP`AQCpJoG(!jlh8BGOW`WW89&cWBO*Xy3)vGwa@XV+)4e6xo5DArOxW5L!H%g21UbL7BJT{T)$-mjXd{`GNyCxU74mq{O096g`>2i^a7H_!Xa6X|>oU_` z?vc4>tf$t8KQef|v%co-0$vy6gMx4Y^#!0SOr^I$l!-8X^Gob5yV0FEtD@Ffv75Ea zB-T~Th{2MU?`L|$(d-SO4~SdC8kLxECPM`h(d;!!ttQo|P28_lpS-;c3M#Mc>$iap zU`|VCnrK*P-pw6l+<{9x1yA&S)`qT;JGe^$qTL+nmjked9A0eh& zq@A!7l;C}?N~&^#;Soj_8_+RL7xQVE`SfOz3FQ4&E_+b>fw#%DoBpI}SKMZ1u;#K1 zZV%KNYf*V zdM#7R=|=oU5i-nuawB@RpQg_mH%9_g?byHM8zVjfTpJ2L5-O4W1<6}W8Hdyj)vfe@ z0!ja8f~;AeFd=fqZ*=s<_xY14NRLr1dfqL8S<8LB6$Tix6pa@j??u-=oquH$I8_o7h*jn&MrnCYZPQEV+Ob^9-w>k?2#I~bu~2Xx0u&Kh-r zqS^usbvz}bHD~oU*^J`6Dm&`0$eJ~K0B#rKXmOO*He_$8ACNDec+Nk8^1?#c{!z8k z<{M++OnjQ`q*em*mgHt_I11mm!C;9-(~#a819D?x9{8j1ao|Ti2AWbN($R^d4%d^$ zv%x#{-t$yP(M=oz8$5U>O*LQhCnh39J<)jt(}dB7J4?vmkUtk=W&ipUjuXlx;`Ap(Mcj8Hne3+S97N3aO2HwP$e3k=N z^593_)UpI>{I`yjAI}lF`#uG~*FJTm27UD=!YDm{bx|9f%gXqSZ?4|7c4h^K^!q8d z?kKF;`oX;Bj@;GTKf&xr9{fpNXx+@0ZU_aj`^MPqpRlQAxyN8dpbP}$HA{1h3A?LFznn@K zZJMOZn;B+s=!My}V~CH;x?#h5GUUsi_VA9{x15eotjyiHn~#I7&n_Jg(acRFDySJO z+ry@KjN~d5BRL)XKKE;+g6;KXAPVejeaHZt7{X@u4A5a9bJPCPLOJ~t7LF1YZ$28( z6Lo+PWQDH6j(*|X%FwztCe8Iun#}X~mvZ|*2OW^lsI`rn@|z1&K1M(+%L>^nKks^z zhwu&6d@^5+zlN{#`2j!pn1B?S1(!M7JYJzNXhdP}9t68ETnxs@#Hai%6bkq(oobPJ zB##V=e^7Hx#c(GjcdoI_q*vxXdV>yvxhW$)f?{lORwY-`sfO(Q(g6g&mOs){wD#cw zF%Un1w1B25UqAkx+?`+0)){f`emwcnh{XS)Y~US2<=2&-e<|Z&8ehv@X$snnYu)9) zjslw39#ej9lFdoqEksLhhD*v7u@dsv(9`dr8>84Jj2X?C++D+q`>efgOurp>iT9ZL zteWs%P{+5-Dem|`tK(_WU?I+@f0;)XwC(t0{7Y=I!*Ma(ZbP{f*Fms1U?2Zd=W%vl zQ9mOAfcH%_03IMfWhxASomCIr4^-XeEp3|d=dXe>Ho?#*3klnKjQ~QMG%@jWCeFt6 zY_;w9a;t9kF9S7yJFms zj}9`_#z{>ub2;Iao%$NN*Gj%2<{fmGGp?J|QA)8?cUkv6%s zsyjZoy|xNG11i5X1>NRuEra;z+|7ecEMv);RJoJ-js$91ds$QmUJei&A&O0XUnEZv z`rz9cFMW!6XTG8c-U8Tw?rr(21~*vW(VC-JngwkQ%&lI36jZmE38l%6fZ)`8gwkN4 z#66U7y|bPqCpmCEym`1EP-`o`K?RZasL#e7VS(PXh0(P`G!*|Jd3Xfe#pbHSTk9rL zOcQwBYy)m5Ewf9gSmd!0cMZWuTRm6LTB^k+nwfl}G$&Uub_qg-88SMdb?ByzW z(`JEQ07<>9)}53Xj$Tkkp!RZAw7JWG_`V)u$6=}~w{e!?`|nb0w*3PG;Mcuem1q_p z07YmykNUJMBiU=iiQDVP?`I$S7%*JN4kO}mt@+(+Trr#Vikk>c8nR9dmgjym^U-ctR57J?eH)r0(gGOvMUm)bZrfaypC`wiIO%cG@A$yn z8;>3BP97PNc+yuqyux~Rn}Mgs@1)0(-s&r8q00%1PBDLL)u~73o(@e~WV+>~ucMgX zZFtt+I65$QCvC`rL*Ujwe|MpuOe%!cKT|87+N+H9ac&0pB}|dF6{Av~Cz>OB`d3Wf zlatH>V?o&|1;4#gi`N037x4Rrm#cb^`=esy{w?%d%Rz9_w)A~4e9$n-Sh|Wa{2^29 z{I`b+!(V|L5Buc?G#tx~;H`6H^56(3C53LCa*`Wis0PPBaBDu7_Hx{BcmJRaW}HcN22 z2Nvaak`F+g)L^EZEhmN#JzwJ6!tjm@XfFe~j~hjk?yuyjFn@V@Y{bTRAV7@b!+ejC zxtSAP@3Ey+=X$?r|cOeyR$-p;*4eUBTc7?9^>KYwcHQ)g+&gmQ;cY`8_jNguy}N&>7%o8Z$VX4nr@r; z(K)!x;d?~G>&{U(`SiPlAu^xNQ+r9%X<8av;h2a=Y|(X0(|gB}DR60H?<27-z+=5j zk8+FUELx;#Q+x!&uGFy8Lx4fUye{mM)>~en-S7g_`z!kjsJQ+zRdq&x+3U!Ta`m8v zJv~$U(N2M(uMD|~(S^+5(+*8H-5NeSe!j7tE)4u%D(%1x26T=Qe7eqtC{w+jyLna^ zqhqjI2S~R)ty$GR%A@94WF(rIRFS)CbufIEy(C_UuO$E5+Wr1d(Ia#ZaKxQ*vYXtA zKz_5x(1mVt_ugCt$M&&oLmL)X54zcgm2P%+tD8+U=}_|AI{Y0R>;|6AZl=B!Fvc?T@`X)DXkGkb%exWWYV2|Nl>)TkO`Q5%DdyhaLoNMbJjBz04 zD0$C9edv`|$H2n#8a=Z@(k}pBe;m zCU57Um1-7#ByWF^M=88cpEv5Ul}r#CjWE&iZM8P+EQO-UU&BYk?;NP}_7X)K@EmyB z&0bzk*hgUVted??uz6#zko4~_qfeQ{gSIH&*wV=jlr~ozvF!Yc3!};3QPb|+d{cVF z?1_UI<_;sLan{Z3&W!qYYJ1Df?!-Gfd9y*g&blexnbPJ|TgwzuQK;3|tGH~^Qc^Im zXy)3HZgOHMzLb%->Wus4N9OLG9$MF23VPnqAR41GiNWnt#U_Px%i--v9{$K#@jTlI zjc~)^|B6SZ&98@^f|TbFCZ4BOKTEn$(@Fo0c^W{@ES~%oWUJoJ2c*|*P&W53xiC@i zy3T=7?v5jg-4kxQv-_OHe!R0l1#-^sApu^A*#Y^eT%E0lyMRq6h;I{pV-o6K0bol< zh7xB*@I@1y_cAe;NTTT2%(ODN%9okZTpiq7=k{o3LWO@39U1=;cZIJ&(`J^V@>`A* z)^ePrI_cv95XA9asQlWQp#LKxE$e16+v~rm)qB>RnzZ^>VJi+KcvroqRb{34H!PI`&D)8^kQp$PGNZ>$O@rX=qeGa!DJETSO>S_y7V<46Q!oSQSX zWAu{P-(DMBVbxmJ*E`^^A5u6UA_p=2ialTA`#TUeaKb)}`L*N#M3V82prMo*z2=0G z1Iy!|^bV~lA3UVI`Mu*mQBt1ncIr3OY;)40j`c8WrLlSVa{6%k#4|q%ojX0`Eb}$U zZ0Y^#hVJu?=O6@D@6?iz`?sHp<7|gc5R(2xP8nrI%zKagmb;FacReTkui?63nz`%Y zx11V6?bE94&jkI{c}uFD)TyjmE?g_hylphOXue_>Hz_-*^M+K}y;r*{KAd~TbX^hG zY26-joE7`Yut;``P%0+B~N`mwGNtXbdsIdCO>JNmNZmoEN>&2K5>S1bSZ+id=D zXSp_MTV_R}%+7I?d5kjoaSU>nUsNc!yil%H_q-?BovYL)vC^v;jtMrZlr zLb>Kbxty5R-xQS_=q#U6DA!ad*Q#cB`lY~lnzLd8Wf!#iit(a(@eUe_V@D?k zP8JG#1^Mgwx@lL5lm0A)Bbm}t&A%@!9&QMULXza&hmq-+vx#mhX=sx)gVMhdu>29YRef*hy%I(F;v5AglI?=sXjBa z46kWeEid}=_^mzk$IuOj0uk?}Dcu#XbU-$a#9AuA+J`k zFc)CAbr`}S)9B?pfpmRlR!h*(&Ho1d%MW%GMi#*&1_PdN&lLVZ#?#XuLr?zRqG2C; z^0TD@J#m)b$Tzl3ADWV-On#j~S1u`(>qA$rD=G(FIk`}-4_%pDR1UhbpY>wf?L$|N zFDeIJd9qMWtH!Q8Ls#Be($hcaisY}hzGR`Cp(~FUm4mL_Q7E^pP|nbm?-!MWu3T9t z*IX!P=t`of9CYRELb;|wIYU<(^5tYseJQhVX^Z$K{}A+{HS-HCso-YLYs8fd?5M8; zza2*(O7qcTHu_#?NdI`svIrNj3Y~#sNGvN|U;wk1qtEdxP8n-g!qf8mGqJ>+GTNh7 z+Q=QvfQo?I=K86^i6-BKN8FREJss(3_9~RbmJUQsrag4d6<@ewOKs`j=2kUJLuSwT zHbbg%GY^a2ux_1}yJ5}xP@@--?4{e5j&GRvp`U^)iRq%(F4-CPgT;2evT_NW-fL*l zc^?I&#hLo}?~?)-VsA4?QzEFg+{nqTKt z`@1*?_m}C*uVlpR7iTc6NM=&Cmc3uf3xX%WlN-$<_T}TgKZ=VgzQ3F*EQ0jeTV9Tv zkU(eW<+WT+O)JMzk8w!w$2ANOpHChP$4?@hV4NGfiMfvd1Zv)ESNrRE$jj$4H**-d zwJet@<+^j~n9ipI{zqxwrJT|pThLlK-y^ft$zHpa_t?we_j>vD<7ltLqMJE6xBWS` zt<3rVd19qRlZlf$W1@=;ScjL{5hHB-L__8R$t}kdl)j8GtcjhmdH1U_kVN$m3;EJa z-Mh$9uiMc}@hPJc4v@LmbB&6X3Cb+e(PU4O>spNr+jmc|Wlyy%k;2bznkw%&Ff?zf=V- z^vg2t$Y_{2kTLJEZKhUP;^BD{CokBg9e6+K6HJkl+VkA19(XT?(#2)jvGZqS&y=`_ zUYW1pe-}^BjyesEnH8O*;X4|_dx)OF-ggT8FtC-PMrKK=M9V+pHG&di&ECX|Zpkmy z4+i0S_bA#sr`3b}2x@_tA`kD>S zGDp?ho+Z1H@lHpp<=n*P^-CFWZu<`nu$csP)Jg3!P%zW%!h9rgn#3AZo|&o$_tHx> zPnm%WPvCCc^v3l@T+NFv*q~Br^%5afS?BSE{oUTXv~y#;Wuz{*_Czy_4`O#9K$*&O zpOc5WqK4{T94Yho%gfqp$IzY_0L`}RjU?d2h{R6|7#U&lJZ7-l8$3Nz=a2NSGo<+U zlG)7)Lw4qM2lT6GKL&HhxAnr^CK?IF#&OsFy#JwUK+LwTR%z5TyhS%yZ2JcgHZ+Vg zlIf2B3Ql{QhbMU|U#UejYNE_JQfqm7$q0-w?`;`@n7!?M};wOzR_U+}q??)`#&g4y(yk z2sxyd2T_8&~;+lcpVcdxnz`iZPVB+4wMU*D1v zAE@hoKt^Wi95?&jkTBaj{vwl7>$(G#FyC#y$XwcZ1J5EOUb1gfD;4FaXuj*QS#H>2 zAH!@#JMH7hB3%N*ceb~ghUf7~hSpLCo4_m`=EX_TXnUKjucY);y>IHP57FLc8~ONr z+w#Zf-)nlN#@SJ(*ShT+)uP+HL117Y1o2XaONN?Kh8esv_-H0hr_AWw=8ZuHgUt8; z#oH>nq)gSdpn3Pj&Vp0h_6}*6N?g~AH&k?O;(pls3|Gc|R1c=X>0dt*8397QCFL>i zPV{7u0rXM3y{ZanNk!jJt9^tbJ^JF~+tT~dFg^mw$X?~5M%$eex^fh{yA7}Jp7ef; z^*iQghM)SZhL@Re>NXYJpO~;lE(V=}-iG;JsYyg&J?{l~-hOx9p*3%rJa=+vZ+G{S zllSHCDPcff@;VOeXnq}#-ASxGZ$sx3K(LM113Tt>c!2NdX8f(k&ZlE)%@`mXDTtC6tW|?O7EoUEF~q&8TQ`Gs~M)j>LOOWN(~R@gNW7dO$(%N^a(7RkZPd zaBo&c2M^VH*v3Px9(M5H>R~4jGxd<;VU8a5@-SBq2YFcNdZTc2b7i9v%6M3+2h)i$ zndLg3=u-B3ja%zNx)M~JWct@S9Er@{uy~qfY(Px-v%e#YuCmK0y-b zb)a@^KuSSp#a2?&+iw|$-mrineG)2))2~^wx*VzB+Nd{^P{NlZ-|RA9DXs%xO^_ZGx=S}?;L&``JKz}QhpakGv98a z13WhJsKN5Ml*d-{*s4r*h8xgU0}7sLxK-Kt&a+w!68v_)HxeB1(EutUO4(^UVg42m z^h=<7LDAskD1>RXPy<|RxXqAqwne-F`!*eeT!y~Mzv{Mv3Uc$?b9C0$6}>U#A5{_f z8I^u#vI`|T^u;!7!m6F+^9?gLmZQhJxFJ$`CUz#Rni-yB9-Ig8EU-g{uN!iu(F3oj zUV{teC{>m!MgVm|_GJbchLgMol{b`IKs4-+lvkyDVJ5JyVhns&hStXIbr0;5bo=R? z>pVaO`%syMaq50fB9r3>Yv0|aJ(4bsv5AY2-J2?8fiW^xGNEEdb`oYnb@{SvmMVG6 za9863t#R()kXXP`mS;wz7?Q#Ujs5PO3nk zev5fTfeW7XKAy+7jo-d6;(V>tIKkJ`@WK4ObNC?rEgg*fex%e(%NM<j4WGyQa8{k`tg4n!fQV+bEf`xx$#PaL3OlQaE`dk*+Lo`A*BEwE=h&P9 zzwt+35U}Gmso& zZ5|p#4!MoUKHBX!gUDfchX#{FZX-4$Qhno_!Q?Q+LuKTU+ekQd>n(W^fi;#Qfj%^Z z9C91W;|G(Jbo&vBS;-V>T#r!(>NmT5EcD6XH_F9i;in?kBedYm72s7;Or80>RuJ9 zfC-xV<=YK&c+fpV_f6IYY=v0?pr%pYj)9pb}5IF-|Tu{9u$N|?I!S%y~$r;q*g6cmFa=`UQaQ$!@IfGkVP+byLwZmWxYMvI;_PV z7N4Y4aJ>;+KRkle;Vtg)_-RT7*Bin0!^e?2qQxB%A4%#=aNQ-vJ+5UYQPT+#o4u{1 z+dTk*emu`lfIlw!ZDr1iMPMcv6+2@>Mdz?Qzt#}OrxSFM9l}uDrSGbqXm-M&hU{3P zzq}fc#%eJ9dTmLh!8^2|HCFQ^A}dZR9nOlO1|JV~4l(lh4QxEls*x?9;JjSv;`{t< z-Sjje!U5`5fC#4tUI2xt$1VnMoDd`(|;db7W(TQlmlIKD*RStG_3|o-uuz) zB&-DwE!?lm=r0;E~YK4_xcnPfya1|%D=V^(P*=6uxo(08^ilpNBp^ScnN<>!T;1j+BUn_bw%CyA(i~O-5A-c z8#f-*?67zFa%nF6-ZB0WKnq#PPdKy9oIB~Kz&L-97#k)Fq6(btT=9+T%_;LY={qw} z(H`%&&Z^IYUBIjhq+xSIxPLWpb5?ylOgcy9WY>VYmMLtAOQ90AHfw;g#LnQUbqXIX zg-o1kvr3c&w7W{lVoO{KofvAfN|gnj=o&~Cd*V_E#U9{FTLYB^q39ye(iAqurBI4z zZPp-VK`FWhlf|yM6jGu1YJ4?VS&)jZGP2kfmqIK4#b%W$3qe(D-bUhbbA7(KVc8w#TKz;un!TT*=Ukt`Q`& zKQ0{}Kb>T$veZH}x{f264RR?|gKZO{u~b_o{~M1JZ)G^LfZ_6fWCCAcHUMV#hgZ{> zbc5U%@sLMuVZ#3mtIi6Vt@KY(z2F3U>~M<{eOaWp3B$oS!i=L2i?rS5^ur>pu{r&) zNdIDUN~x_6i<1ymAZo;!!~%%jFVZrjTdGQL`Zp0e zB;Y@K?jxdD_;V#87j$n|x?bWz*PGqpHMHe!d0B$zmyD|AS0T=l{9mUuZOUH#8X3Sq zU6PXrqum^ekKF70?EE*w5{B>RDAqZG*XPaaZeF?3`1bzOb)#YRiyJZ*HK6KZ>}|%s zBz^#92bQNhxA7GtpB;vL_Vmg4zNZlef&+|;B%|h|#4}tvyfTt>H#1^BEtrcfIy?qf z|H!~m33W3K+_C>uozB#EkY?+NWh-9cGlT`D99z#1(IL0yz4$QG_<>v*PUoZTb+4AG z3=+;V>gMOg4^IyzC!aE0gLL+Gj|iJVjn^25caPXdcmpT>m*((!%ymmGUB3t><5FY` znff+lC96mcP^2_? zQPx>8ST$rLCtJ63g?q`{B$nR2w*b#NrqcBqI`U)3J|A7h%xq*)OtrP0xGa0-X}O_D zknhNy{fz+f^>nnM zBYq(wZ*z&*m3wGDKt=Jar|MiSVIr8i|L8tF#q@OKy0M$;GbOoO=M_(f*4~Nlndx9EI^t}? z_GYf0p*{?W*L0ksN&B}JGgc?{paB4Ch=+9}aVFKFM%yzBs&Vx@)aYH?;p+&Zj~5TK z`ii>2)%%sUGCt(2NPPg$kC2D`$t?8CuslJcJ3*GF=eXX7MiCoR^4wDu=HeysX&S*f zZJqbJj@je4`^#b1gZt55H`r!QRR)n_%HTqv^ujSqX`0DtEnY$4Ng) zo~~B5yl}MJkR=XUqD)^cD^R9OKN33WYS2)oN#=E{S%qgEcn?B=fff-guI1sS_-T2! z7O&;bd(mDOO=+5R#^ku`CLiYrU`i!^o18q{G$5+bc~td(SM`Igub4Ma)h9QXA=+ka zk!y?Y9Ehc2|0hB@CfERmEM z=4|s?ZiYE|q=q?h@_5qX7jxlsbT4?#zvSe4Q-Ow2VLmu67{+Mx7UE6H5}V6b%d*PTs`}7u-!$oLhjdHi8yC`-f%2ke$4#D0@j!_BtIovXg&Q zls%^?dyvka*~#gm?3$u%6M!*0c|lS3TV*|MkI`DlPM%hjeWWORj?Jzt%KopS>t(k%EKXy9T8HqvuhM%G@G`_89vPHk`{SvN=LVh{m2;RqUH7SxI7hj0g zns_9Nq|M%J)<9)?Yc#`I#hZXKy@(=re(xZ%aZ($Zo#bKSUdoF=y|XHTGpMBt8@#up z&blp;{dLpAp=g@1>yk2H0i<)oI|r!x>QkD@~?weM3Ud5AwR zBu_q$ZZ@qAZFN##<|#Y9Yy3-~#=Nam1?PbSfl0qv*^MgKDsL`7EtnBoJ+N5KPA7FS zmBg}_LPlP~W*SB9*gS4bIk?wlXKW)b^^nCk=GVV5z@1AIb=3+edL>T~pH6~FTl#Pb zV;OQub$kSwl1fF7?3tXmB2QL3IGLtqtKPs7AFVenAbfn%AwH5W|JDr^6$c zDV}Qj1wP~iK1vZ-v^a^DfA0sgziHjo4>Y(DU?mda1s~YCr1*rN+xh7kUbJT8;?cpq&iwWPX5QpSSo4OhEz?{) zRTBG3Mg(G)v9Jj1+F6+jP5D=!fj6{s;VF0dngfpAgAjxvlB& zki{q0R$r93jJhR+7(2SI`WmXfxKOp?5|eQOpCxcifD@

UCM}yocoz1wzq-Y3g~I ze**1J-CwsPTpE8WnwhzDN^;WAYwuXyxzXSkft}$EE-CEq>8+79q41@lHEp3wLouhW z4bf}->&e3-1Z+AhK-TY#n$H7>vUBA9l69Wpv_A^L?t3MSlbeXl7)?KV56wu^JCLethQ3w1!@(7y9>F!E>K%q`Y3&{ zA6li-ZzTd6Oi&2;h);-*p!MNiq8712KqbHTIdktm1k`?i|9yFB_TD=)XJ*bhbLPyM zGiM6s8?0Cz|HcsTZkWrUnSIDy7Ha96e6#C0)t5CLlai$OD@wmt(^o(CsQH(x*VOtd z*KHBmt?af~xII?gNn9y`Jdy*>0O!=pPE?X;D0F^7cN#Fgr{1o_g~{}b!46Z=H||~1 z2l}T+0}~fhnUPmm;XbjS>{3+5h!pq5SoTcZb1tj;QXIuq_UvA86BmnL3%+#E!)cY6 zcP};VQTW1t2kG~q5a@fe>wmT1azrtg?_l`zZi2}cnWKz3BrQ^_p-|=1@#BpVcE)Zj z`r2gs15pT7V{;}9l{-;l&I8*)iJVrd-bFMx4A2v5W)PJs!V+@a(7KlDI;(ZPs20A4 zl*5-Ze=7y!O>pLp9(IV?4$aoF_U!(6=KtVu2P(LS;30pn+kFHekA1(IMrsnJo?;ZR~A zOZZbcxq2?zV}E_TgvXeZlCnOCxE(7`jV%kuo#on2C#7@}zo%`D)o=LJs$Jii8A{XS zpOwCs;(JQ9C5QT8Qr{~JCoXZcdxF^6WO1~}0gLEnlDO~$IJY8m4Pjphe66;*yUrFw z^!9Tk7>>-8=(g9O!-f(AcJ>^?QK^aatX!Uc%TuoQ^er^gN9Ks#?xI2W^?27y%ZG#- z@ZgmRZsD)MCti#~l&HO2`X(pb)5lB6)acg*e^zER)aLCK^LC1PTO!Lx&OGq8A!AVx z{>r$hyVAbS%uBhaa!KPK$=!UEe>`sY(_`F#%hBL?Ho37gvm#gMo*>y?EN#QG9A5Ln z7wQ4LHJ4{q?n(AqOtp9Ap5z>=`L@}AYRQBEm2xXPGt2x>qb}*pY|LeB=Slu`W^VPr zZO9x(k;<9JT5E&CL@;V?uIoPmv<+HcS3V)s^IBd%@rPI>^;l)p9)?08-a<-SJr5F$ zK;x@#zW)nKfDhq#;r5vQyNx`0gY~oeasXxmU_8A+sk40QhZ)|(QO0lN88r&au0!%VHry;2q3mB{c z?pM}xU=9{V<*{`0GU{ZS$r-6`PqoDbMagOPgsi!?v1#MlN~zc078jS-tmI;>Pvs|S zXQuJvUcE4kxlB_UYCDoQIa%Shxj0?Jhw~?$f==vcPC?6@Xjn&0^+p;eP$ISM*8Blv zO0`L`kkzt|7sjv*Q@;uk$EIq3gK^?WN=s9G$n0HN=~6AH=*ti0<~HTv#6WyH1v&0N zXQSYx+FS~Ul1Iv6zVzW}3gQ>Pge3LW7S~zn*?c~9y##HAG7%!K+II+}{g=c^?W>`H z@Tiq4>4W?9=7!R1#`(Z9{C1vzxDHV>8GsvjZQ`;i)jCi12Qrr;NO;dvZuLC1-F%MqODjFaY^~A zka^tD*cs!%*FZkY)I)gHp<O=PF+cnXI(j50_H9u-#{nk+>nK{~Evk#*kt*PXOq!tZ4==T)Xk=|$*+8y{$8%`lG3bT#ti38YikOns{k;=&K>X*m8$ZE z5kM3V9*T!_!`BOjvR4Ua+k8y@=VRnbd)UWJ=BsqUd!@SJRnwn&UWj#z}}y)g@-a%P=B6i*8CAvSwOC6Sb2{)fYyBV zq%%rRk%seSq5gFxzx9cWr1j??y!E%tD{lQ#iWd*W zAD-a1-*0*KMs52eOa?j+t)wl^Vi`}Ek6ON@P1h*_q=-%;<1t%?qw~of{vhQBdVG*4 zSF#9|DVL{)VUq{z%)?3h<7mMe;l*JJ)Sq6AUL|oPIgP*YY%2G)LoKEw%$oO(x<{B= zsgjM!4y*Odf%dxg9i{e@_PW%o;r1P6b~XlibMJj@)zotDeeJC1h`INEcJ?aXt=5ML zcAOn0NgbPa0E+W>n$K#z;81;?sISzu+0*wr&D-vk=$mkub2haLb2*3E*;$%B)^x$i zntmFuR_oanseL^y*`H|Uayxqw4=q`Tzlk9rbSDq7j@QbZL5B;ruYDEN}~%qT0Q*Q*fDw|6tosZ$&+fYj5oQgvdpg84n8%c z)*ojw>jBH^x5bTmc#M$Tle^ZyeZEVk=tptcnoF$!p7H5dUfp|OZT$5)k!%=Y4yssU& zX89FmS#Mgc86m)$+m5Oau>c!&i8X({Z1=C#&wMFfRh7u9N|uBmz~gjjPiJ51V_hb= zk$>JCKJIxTwUM=)Fc~cp`nABLNi*rLD z>bDD!0`0p{)Zenjj6nC{ZXdvAJ}mN9Q(h*o)D3cWGUT0M76}}D97@&hNAJp+C#F_; zvohTvh}=Qy(_rKtj>ndMudiR0@b@=*xj30eTqg*IoiN5b^0H=-619IrMlHodbYu zWpwJAPhL>)WTX-DdMbDHDqi04^n^82iQFvd{KUFlpM?Lu&W`bbp;ELwW@8xEgToZm6 zG-0aWgyfZZSSLWwJgg!`a|E#R8SfTcx2m)Y^0$;14B>Q1uIdtSA^4GX{M8Mt<9$st zKQXhq7Bsp`=M>LyYdMlsJj49~qJd$_trK-_5wENF*BCH4jq`G{!t_E$e==iqHdJHm z*QrdDwkv>t;CydZiVGe_Iq()KMCCr*t_9J#iT%zZv=7q_5T(vrMbs%PnE!h%1Gcff z6U_h1n`x)4285#tbrcZk`hZAN@-+`G0$D_)TLGER_!M*RrxNM%TnkE4+JX{CNd=`Y z;>2w+rKDx<$2Tj9%7FhrSrA91EQ9E15llAis_nkLLNVRqID$+(kL>-fw zd6sGndmMu9FLgHQ$Pi1(u*H&9H88O;1dPR2rE;_{5I?UkQaJ*#T=E&Yw;{r+n*|Vy zYi;y9} zBVYihZm$Y>W(M4!n*r5)()QJ0YRo6-)c9u-lpo&)g(3wj4L%B`plY*$F#Oq##lr9( zU4=T5F9hKQnTTfIS|G+$6g~%w`odAdIjpB+dAtQ(yK1N6DAzTS(q04gtR3bP>zgKr zmBA|1<9&ssRNGW?F_}(Ob_rPi7AcTp`ATmPsk<|xD6=lblTEl=s0?rB8QlGM2{$Yl zcJ`Uu8%f?&o3w;Fj?;qK?Yv?7l0l$$*G_j`_<(}DpmTs!ciz8!>fcHkZ^n*%mx8{3 z+vLdgU2a?V8p)XJpiBUPES(-H?A)(N2^cMaH>el94uSWv$Fv9f&y)f_!Gi+-B4!&p za;^bUDex!-{5b%fF);}P!E~;e$lGhNx_!Dfzg_Uq(;WH``sHTz%spNlnjWw-Q33Baj?Efn(puf3Kgtbl$#${y})|YasvQ!re zLUD4r`!JNrB4D!{OeMh_@=r**23a%5H`PBZOMp{REWB=%*uq|U4JwjUj#!y*F~qcE zF&+v#_L<0Afq!~DyRw;fjc8xZ4A16@s6N3$2*GaX_tZPFENPC60K~`Ax4RiaYgV}u*3uV z1vQupjVg3L^NMOUnrLOl@nS}u?qgT*DlQ&P_yMbW=Du^AnldGOgT2mx7ofgnknJBy zs;}N+wIoF<_*TLMcDBUz2eq@YnI$8S3S@Y?1999#D{AIh72cCx?=7W1Jfhg@hGkVs zR&QhzOdzQZ?kv%?gN?;&J_joW`~R|gCiw{*mD|>o{VfUnDxZT5O=8&n{a*)BhY2sR zL-kkbs1cNbHSs!nX}XcPy0K|PFar@&g}^M*qX3I1-XK`iPYt#0R;HeciWK6b=%eYD zZ(5{TQlBWqk6ZJvp#i}%JpEI&1c>B5bv4%Zw5kkZa%6%2L!cD(+qB_vMylzsyt8M> zF~!%4R%WI$v#lUYfOXcqVF32tdq?E71ooxEU4PG$KW0B3+p{H}y`ab2#aK5iB)t_L zH3PC>Gh1dKbqi_Q9Gkn(7}QMk`?1Frz%=oKB@6^71ztspu2gXL6KrJ!m~31IyTGe3 zqmLphGmRE_yNIK)dt9O{acHXTCAx`r^LzO8U{c7_??t=jzD^**h(P9=t|nK426r;r=@~8B&d(Z`1)@8B8JEfB1{tnU80xId;@oKLGv_=*vYtdkzLU6@MpoOq$A`Q% z&+D~=%5-Qh|2cw7B1Ec*-u^#hy5-oNe-ANq>~+82tfL6$PMuO-R*f!10l z-A;^V1{8j1DfhlxtnHj7Gs++NX66-MqJ4Mu7M_`MXnH?L}`-<6cJqu36-AOE`%kmOp*7GUv#grl~S8 z-DfWJEq^#9%-B}Ae4~Wq@J2}iGxKvlBO^$dSRfO>go#cjF?aSIId&#q17K2Z&2(3G zk0hs+83;y1HTK6=Zup4GAwjnDoRvFh6AT|`rBuPd)tY@7Xry{Ss`ZDDF9y9~aJDnz(XQ-~~NEqyCMi|Lw<2zSHt1-PRMK?v~^;blNF9+=4oF z3mRmLal6=*tqwv5I!IyI{=e{%n)`Nz7-Bm!bwXYxp6ngi>c|sI-BH13O#MWh4vCIr zEE1@ee^)D8q34}?cfBB=?M|c#BE;$oqwc@)J69-=f&t1x0gBEdH zh7rJ{2e4};v0R>L48Il2W~E_z(rup{XLBE#gz?5Xhdm7LRLa(n*j$TDT~5>E*?})M zpj0>3KHg|QF|%z#_O!3Z0 zdYES=r}sHBV$X+pOwSYt;A#n|0VB$-j=`KU3^mq1+h~n@wqfqR$&)AdvF1Mm_Beoc zUPH$lrT#upqy4Tme;VI0YzG0?%qEa+mRzYjXmt4}0h8LaOUspHKr zcI+PlD#h2*(C-O%;Zt-Y)h11((;aa~*Lie73K95M5NiKUh#R->5bXu(;(HFkuhMUt zk2oOsKne`X3*@d7#b2=LtQth*Y4)I$|5z8X2h9@~_J&kvtg-g(#3T|g>5JpGuRuJ0$7-Kl_km?Pjh z?+55sd4ED@@ltZjOj*yNi&Ax~#Wl><&&W_YXL%oR^7*D7n9m^&W#6u!tKYQWBIYl@ zC0(oKJ9n4N8RsniGnM(Pzl#dsRM?uLOTdVAcwevHNJ#Bm0jOUr+WiowO1Ua4=6rtE zGqP>TNr?Y|is#>@!``6>FZY)RLhSgtL$JQ$zOaf+zV94|1Y(4!p9qt8Lt%;4V5_}p z)SN_l8dZ3Rpx5}7Qc1{@0nfV*0p5{tT%h1_oC{tjpkY=L03qzcCY+3P_u{AhEjoGg zr2w%d)G?g)J^N!;mDBbwG1XX9;9?w|QWV6wAPl_KhMHp$}|D}o@2 zEU}EkRrpmid;_a2DOb=h6rclzo@M?|;}`cW8NGQQa5JRnt&Vl)&dm zqfA@AY-%I|`{(p7UvpYgbH%@cM-Xf^ha+syLNwC^Rv2O<&~sEHHfaS-Bi-0zWU$wv zOiCh@oCTh{M(CND0B5b^@jjL4T`^phV)pc*E#_M{*<{iUFJ)1`TblVIkwV{+aCy7Te3V?NApD7^EW zkE?DZruXtwJw3}f{j*QRr_U+V&&(sc(tDDWwg2NIdPPw9aw)u&!og;ZyEsUCRFX21 zROy$xF-Xct()UP;==lwAsK7qn&owE?^(-vxMafmP+VH^D+7tb}Lxa3>q|6&kUIZdy zS0uE1?PDVC(JAE3%G`iy+@y-|aYv8W#ROx-_tG4yOJ zy0Jx5{0YiS6+u-8%M*cGgq5jV1DfYoJWBJ{!CWZ0R)!z91qEBT*w1DzH%6SmLUn;S z1)O`(?J)PYD~l~}f8AVUl$tq@trMA;BGnt}Yj;}nMY-{}yl}o25#;rK{=oL>Hr=fjvr2BJUiZS;x_*^swMvG- zIArntk1h?2e!6`t~9CW)46&;1T_&2wUUW>eJuoq+T`^%Gb3#(;X) z8>f7C_T_%p|Ma*5m4-#;ivJe7_A{8LqK*PHSOE!w==$oX>$9gF60LonNUTVyls|CN zSHe+ZsT|sfDsvt$IScKpycFR=D2RnNhXi@oejh_aOl>;bV0V@(@w^mIWwli91vB2c z)EijS)KVF+M1iI96=aNIE8m)Oa7$$$nFI?gm46Ybq^6b}%+Ih?N(9-^WW3pukd83?Bt_5isPVVIZ~RSMS$M|6rem@Kn^7o+ ze9w1Tf;DXs^XEUH%R%hC&TV4nmD+?jpv?OwXb5<%$Z}irOrhoWMo{QQFdi3@u&X82 zwoG7I>92~&6RYRZJQTK!Ci#tvw$ymXi1HWA-E;DD_why>6NzA@|MM`|H?Gd!4;cyv zt^urcTF6_x`4+fCUFPq?{pfT(X>t(_EIMg2jSt>`o-3HnGf((>#ti9YlIodhC0pJb zQDU;RQzkGMpUhQsW#O(R1^e%{LX{JG_1&8e$iQdi^jK3_*t?o9MOfS#06kS83@L(O ztqplK6o^?5Q1pb}MYrY5&N~fTSg9>M6oF_mw=?I*6P*(daNm8XU|7L@@{u?XX6!MU z2sg4U*S!BHk{@J~HXUS;1>9><+-P?BvqEau+>BOH*lq7Ma{32al9x-*#}_u+h)K97 zVn2>$_Em^dR9cRNN};m~3xTDO7e>GrX6?F1@(nM_mt)E)QM<-V_X6H^Z&7)I7X)j$ z@rN2AV9x0r?{ju;ZE^ZWW*AZVPZbt!lc|!iu}XKc0uU*A%dHTGc@@Z-;ItAxULtJp z@w!WJ@91$K;{qe&Onkih6Trf^sIs0=LgEyoshP(P7yUqr;^Sq>g0@K&598w{bW|TN zPZ&HnSCxKIo4SHTn)=9bNgNX8QRJ-pc&R(%E}3p}*g954 zW3U)1I@MIs34;9N49jI=&L3{Vol#qpz@1TAQjsihXWUu@vdEpWZG$v7K=W;6M155$ z?_;~z=X3$tO$%^mlosI5C}=#WJEMSczcN{MOa&jmR73j60{WG2roRR0g_?k&;`F^?BHrzb}x(`{1E`lCQ+RzDY9} zz0}IQOkwYFvKc{h6Ppai;ary!-yO&$GaPJ^iSnRFPr=DnI^>@~z36;Vzk?H~R%Qlp z^R@w_8G{xnF>_&okpK>uzYIxe)MTcI<7rjz2I=}?%YYAiNbf^BZgt8&EQl*ipRCMx zrPCqlbPX+*weklWeSCaTlHPcbq`=4Sg&^r}Sxr7nQmRc4rxSaRFM0kC6N@E}{7P>Q zsj0SG=>^05b!d!q5lZBI>=yCjIxp@M9*}2WxOl5HubwtF@D8^9G;>yN>q%Gv!hgcn z6ULev0jO+oP)MVFNWM%oC+t5NV5gq4lyqopWF%6#vsB?Z~<-h)qL|MI#xCb6!qE7P3D>_r21s+d?qAo z{#+51!M>sJ$0tMU%mlT0cm4ZdSVdcC1}zdEA?4Pjy8B!6C8ev77ll*~`+M7vjJan63Sz zO`Ku!F@o*BX!rCboKk!&9I$8FPmcfCo7w0P*GfDCbiR{_1b5vh8dUNp^1NuIuOY3s z(x*aUPRMlKMz{+>i2K2oeda=;839?&BA*}hMDES$^Z}`9HJ+ZOVU!}exENpp)R>*Bg(xE5TXy@*f=YM`9-?_;Tn9lw4 zzuz1=CEcDF#+Ivp>bhRHPY^KOkk2~|A!kBd=x{iXHWcom{9DDEks4w)CJwfL_Pup{ zxOwkM>?G<`|D@4JV6jkYM-7qbXUyqMC^Vmx z-Oud9yHb=T_96)GhR~j?`hp(No7V|MM~PgknXCmX`C@Vi18@?85-__!C}4JL{uJ{4 zwrim+3%k@uYb^qdyU@E!XUQP-M(=1b^&V23O*SdsP zikl@Myf2XOnbe#4<6JA2<$5MG{Nz@AHq5#l%%E8Z2#`|2k%{tR`V-XYeP>5uf4mEL zHD?2}V@rHC=f}v@u_Z>P&WIU#dcvUD}NqR5tpjYhNaeyIaX>XKT$z4$&AO0lj- z1L<_(Q@(WCirga9-tBqGl>C`@C`>3a;DJ_=2Si8$ti0d;)x1m)V;%y}$Cj5;WkYZr zN{o}$S549COBS{7w4v1m_VluLU*WlP7YO*znqCXI$AiU6=6n`4z_U`dJQTrXmHTTz z<|9kwZ6=8`v`Ag=BI4jJ+KNzL-E&ou;sulo*1YQgn6q%4gd?iLsolYpTB+E>TxQ2&5AzUH zOK%VJ735MMa_N4thxt~%1Rmzn!(tEfMVfkmhq>qwy*$iYHEvPhVJ?dw?e+f;5A%Jv zK){48o6*Gct8YXbV)EVh{SyGu>RplW2J!#@+ZxDNviAQSEan`mi&6Fn-0?$Z+ z>{xvi5r#mS%~n&7x8z<{cm7_+>i{ieWQ;B9y#D9>5ZIvhS>wDel+cx{HG>+ol)HjP^ zct`aD>a7D|BBH()G+BK~#gH@}iE75H9*((_jD^kd?(6lTYg2xC=Pz7`k%vh?Shy|) zOWx;O^GiKHTUl|o2FdpBO4`+?NXJ6}^%PUgb~=YqyPF@SaVJYz$>DB$^ni8S`{+?? zE5V7ZDF3v^7qGJc#b?-WDfxo(J=1Z`;oPL#A<4CNUO79#} zity4!ivq*mwSrolck+jlK2z%MhDC#h2kZaUMQD7P!S6kOPjR(ff03$AEv!ndKOdqnmQ7b__-FiMDr5FgAvMADRnXDI@(|TLFS#=#|EaWrf1DoSM7SS zkMwXleY*)nm^ibZfZvCVAY9d3?(Gk)kucSQ$EdyCk3?zw*R&W0m9!ic^7G_ERYs*f z8dy=n877zKgAV@ZPU%8Ff(|CH?JDE%ce)nFI?Jj|;5x2-@(AY6it6+rQue676N-KA zLm(&QIiRy3>D+>(hP#WB`W7U;Rt)gid{S46`=`&3+fPem&WJO%21RN>Bz5D-Q_TGf zac4rMZWVV@d(1h1a6|2rv%g7@&5Aa$BCOV!2ljrqo5Q(?;lv=x6U&Yl|CPZ6-o&-C z>`95?X}gyan_T_=i0viUVw1BX?vxT#(aBKQIlq$pl$l;0tLDB*ZZRt(#MoCbS`U`! z>s;TI9goT3rsujtiK9Hdy>5u$1cOln-$y+WO5V(+;+!^3z7y*lHyDm!Z|tG+)cTrB zZC5K#OLpysz%z}{UiMsfj2pC5J8(i8=AI%Qu?ZHNF9=$OYHza>Q6(exc|)xQuM0+l zZUy&t(NZe&-Xg7VJm&Ayh)l`{6CFzXh_G^KXMMXgiqnWNp*-0e+uagW5!4o|wcBpH zjPF+Fe@WruTH!fD@LpFn5br)B^b*?S>oI3`UCeG9Op-JEBD-y<6tLfv0?rKF{#K6U z15S8W>lk}~T}xXXuY?maA%h8`cbgZ*eIzj3f{cldL?Q55Sl1z{3K=P>K zjLsatXQub`+-lj+u%{G_51CSCq7C`<&mJPkhUao{fk4NZ+~%A)r*P&xBiwA zG>jLQ3p%W{hBWA0=kn6fMEK>%+9iaJi#+fH{?gVXUc9;4x_8icr@m$NEIxI(79^T7 z_q9-X%@p2kC12dCe~{fw9I$sW3@u3Ne`f(gp4kzOF*&= zkzA1n1fEn$@X0X-uGG9*+G8q|HW6Q#s-pW~NTNlTCHvCLiHTAP>E)G1Qg2jRnJ-{( z5|gsrKaSIYkT~AtaqwOq>>X<>1x@xg4NuN($sxCNbQu2)O|EsV%xPGt9qm`deoWR- zTUfbAtk!7Nz-4vZb6X~0vxakUCXstNk*!Mws`PRu@MF%z%Genbhgzv?Db#h)lnvq3$v&B z5r*)|ul|pCrVi2HxcS9NH74h-?3~DFh&OGCho6kw136Df$b}A8Z?Q1Y>zAeW zjhX#59Le=c@R&n&);U{7a0DP*Bc1Pft<>;|JLgZ_WMX*2(X>cgcVYqqP1r>G8hL;g zu@a>$kwbqc#k|Uobv+HLt-hgf!|264DAc*6sN_#Rq2zfopi}Eh3G!bxu##xc zi7~_hJi|-}@upX89o=%@oV_ixTLp%d5#`O@%2{DE_T~15On(8CjUGz-dPQ4~N)OoH ztQ}W_=s3!nw@TaMJIGcPq+J-c=CvP~NTf*$URYwKHWnqSIhzUYs{91!9kZ8V4le}T zsd6|zuk;W1&J{7RNZc_e@Pu=nAv*Zlm?xX!uaDG~6JC3c6*z(Ls)XozvyVUTyZ6-v z$nf3;u6w7x%K-8I$*Mx8Q*B9Shd=Z6k2(FFA6{jzl-V;S7lsh}BtKzUnFcxnQ>1^} zEq*R$mZet2wN7>XR0#Ah_v-H$ZD+7`JHY%Y170NLIJ}SL)X`sD@Lq8qw z9+Mq-YU|VR`b9CTExNheezN1$zR~PI=76K9y*HNHIR?K_b#8rndw->; zCpYCRGI|6evOyGWmB?JlW-ZWzj8YHLmE}mu(xZgO8<)mX94pKGlQ()&t^m7^hK>!X zcJ3b<)uBVk$~=gi7Ym6~K{T~^cGP-d$T*WAviOprGACNI;j*_*kLHeT(rZs_O^A^iz6 zT))ilTZFqS%IaAemfM-_Fb?YOc5vI!^sKO;Q?_W-ckIko60CGJx^8ouJhLu3Zvev1 zDXZdy@CK{p7j#r{X4P-t#4uSLxy{W=pVc4J>&>gmtcCx}Q)m7CQ|NAI<|A_O5OUfi zZ=_AW+TFwSJ6l9FAlB5$0hT^6ze|o0?JAvVqx99P*DQ7>BpDqe4WzdFX_VS@yM6d9 zR$4NZMZsF*tUFys{<3IT)VdY@n5c;uGs^VZCKRbaZzwzv>az#|)kVxud zuzCm`U?C#tVPY1ZSa2AgL7Wwmexq4PU*dL`98@Du)M=Bf9J8Cqchxr>jpkiOvOZl z{JYPwb)M?}8b>*Kb2KF}fVP-W*va$bjK>DObn1Gzoi42Kqhu#X%IQM;xx`5#A19=4 z+RXZWaMzdf^1LB+Q+GEKsJ}RWp#CM_MNdWkJTFVGo13T1eJeC@%G{n1w-9Y)b!yFf zkp+!>;E2<2_#lr1t&GECr1pb3pYJ-xAK$5WI2ZVC86OkgjJS*n*W>trSYX>_9ubsdn$|J&{%4#l9eScsENU?C0!_9eY_PY$%KDaqaGo zeI?Zo+fV*#&)!sfjeX`vEKKBi?;-Z&Rdb$7t*eP=XO!7T`b#^jbyC$p_^8kBbrTc) zQp-gWGM(*-S2O7Lvuqb8blOxvcI+>y-jjN*(u_%Nouc-LTt%GP&#^7B_n`tWxRqa{ zT8Ut)!uc@X#NufiYfg93H}G3xahX2VBGXEd7jo_ACMI}9k_>G3=HosxH+gt>e;^~9 zfRJpRoQ3cimmS!bnVFf|-8xgI0ffAoni_p!U-o3De>G;MPQPhdqPt|$knh1Y`DV%a zuEN!7R0Ea-tJSZ|TTbCqEnnBY5v~$jR+$_a;f8QIsrE7~>o2W!8NCF7Al!9mc|?{G zp~UBzRF;82U#W>Y%a-w(t`6oSc5oT-?y&F5T;Eo~Gs03Bkae}B=;ek_gDJOMvT*#* z3}|GuFjtVvy1O%O-Mw4|Ix(9lI6gb+l#*C@9sI1q*~;9ZJsKMvnT}_#s~RFPbdi6b z4>i_8Xq6e(ywy~vr+Jo#q#*?T)%GkG@qiSTALn=F{N?5HYAI1>)$$35m3+Pki&mCvWZM42|I zmFhmtT2L)I+h&X{1g963_-NjlF^Ca-5`!(`%=n0d7XTU2BZIhhOY+#RlC!AU=UG1q|Dd30-%!GvOwQI}= zXQh;~(hjwju9TeK0#)K@!v)=*>{|Ncv7xD~Dr$fKeu*HWWm+y2W)p47OzB2c=O+My z7(h+_%`xhMPBTgl@91tJ^I~C!`pi?akJh=tTG)i*5Bo2TrA|k1PUfw_-jD~#oYeI> zkYM;f|2=xfa)ESnqnTp9o||Iy0CkzWi_LcAkIpfh;I2BYc2ly=pHRBisvaNABkcyy z1~d7&&%2BE}ZsyD>#_IP-M_FF93Fg?nD?aqiZaG@P5OLoQfY^$$+jA#$5 zqV}|p>aDfoxdXATyFR^X)*voCoRc_=$3(OtwJuy=>)r4h)GTQR+jr6fg$q^~&2AYz zZLIA?1D+qT>&k9$8?&b^@Q#J%KK}#!kghdul5qNjhoZF1cHe@LWjx>B&N%jP!hmR+ zwkhd)^(4xu@hO`hIA4WQ{&cCqXqzUlG8%K9r}KjcZL^{zdxLmdi6}Iq%vO!k(9U~A z4*c2cSgb^4v9fav)>C`Em3b6t#nMKU&h(q?$2V5L$EL^l?7$~xe@^TPgHXsj8NC;F z$7-KQ{+sp3vbf#2B3``*2|c?~M`HH0eYy4CKm_kP@{cF~F7mTX^cDaYu~(@`U0K18 z`#(QbvFAOH?8xgB-c`~{qa_pbnvALMuOj}aC>28N&bo4uYiOkv_OyZC511rnK_s@l z)R>T!UJp-tKjx3Y3^P*5lZeallBi*~`a|h@;-%;2 zrJsus_svfmS;nycn^$hF1$XgojBD|x<-(BEbQwRYb!4O(vy=JPh*_EWHd1|wC>X)!`eV#}qFAMEr_A9aKEyBd*>|E`V^UZ`z zRC|C8KX*ptFCN3!RYMyWK7Q6Jmf*b)hvx^O$?Z{l3x-e>cjZSG`KZx4h z(w}HGL*c2Y6_aa+t<00KP(${|zGa|n5jPFSoqoD!#-QMsUUuMmX;(ZO;|})r#I{JP zXN;9*dnL4L4By{xwC-<@R(FdS*d&dSW&Q|&#;Ttd&b2$_Hp3&Kh0uXZr-Svm$eX$Q zw~8q^eKpW%l(kSUJ@>5|hQ!!5yb(Lqh-BtFI!n*nlMhHo!F|hw+US68>lTrx$-nWT zSw8HXe!I6DSTeqoOO+Z~V?S;nY6te8#Wcv9LXK4TC~Kj_Twgtk-eBWz<|kC$u}U{T zpWco|p~d^PG^_fFSgL1GgWYW{zz7kH5jp?J81bG%=!xy|K1OVQLY!;{(^5dH<#DV| zkbxq4n!M#E#7Z)GH|T&5Oq|CtyB3-_Cy~m4yNJHBHV*LvvP6gwa7Pf}^`RC1#N(_K znL_kdnK0`_Ly`G1!cX=7q6za`blzG!lGqb3Vuz9G(mN7~B81F-Lol?1B}`&Kw^+}r zpY~1^T%_7ddW-5J!JL=d`I*)i(^afB&AQU-W<4)vp{&Q)t#S@&vQxNv zb)Dp}cT{({!>(m`GcdTtYx2_ZcG(VzSQEFuzbvI1R@nP0b@}qmUnkA_QaI#2jbC9l zLcEhbyThH{xrng1-JPEZyn1nG@6^eTbqG>R$gT4J*TN$iltTV{oU2EfVDkDo@|^up z!$7EM7ZA1L9vO{6)QXC6*|HJU8^Lrq`E-QSmS;m=%#VPWyr1qO(Pfr!<*sHZ0`tl%CgrYGM!yW& zYNZ~Ru~Kk0=eyKl%yQr56c{Ao2A#8+Jy!`53ed3{)LEIme2v>XIT8f?+So_2?5vNF ztDW-OP}?(exKoGbTbnr2b10t2m(!20$s0TSndQX4%g8)qN9yMLSF5S z(cnYc=SkEH`4q{XgNDZ?pRZ_;v?so+Q|D3{!)E%3zR>M;(DXdpyaH$B*{0H~p#hZV zn)LP&PkCo+H-!SVs$==2G*^>irY!5MD-(*QG&Stil2i9O_cM9A=V<-DJ=*q|72Q$t zNh}V(VL7EDq?eJxyM+XfFL$b8P)Oj7qDgM*i-ih|ce)rw?EUp}-Hb$FTH=!DN|Q$r z>-|yWtY(np6BzR>+`TGU#;D=4GbHV{X9f1nK2U1*F&Ga-?EB^x*}d$H&R1e!tDp)r z@te4Qx>T)Lsrpr1=c(X;j9#o}(T4=ROR2aW+eSiZ1zi*jSX}TAtL{X;g zKP}31l4N@6^ zM>AUt@-~w@z@wl>@c8UWfxH$}3US2`F32U=?%Jv=;yHtjq^Mp8tO{8dyVca?{kRuU z?+O`N#lT6YZqb6|l@+YE zFLMIpJk_Q<6ju5oVKl?nw(bJEeYyYHXl33v2xMz&S9ovtSM!`2C%5zL1NQ1^fX^<% z9^MrPDg}#oJ*^b z{=8kH<@JUm{XzpI-O7yNXpr|1$1eh`Ydel&2o`-f8@%F-z})B6h)R^ZQ}D}DX(P?S zoSdKUtk%BhgdlH3JKIJxzT7p;pNG*Ktkxq{KYRlHutE$f1JX|=jXs8RomOz; z^w;j0c_Id`2guNMD6ek7&5^tm;yS9&GRirFV`Z`Sp~{_5_jM! z#bPt&kRxXIDJMm5NvGd=yt0L z{14it556fn?o6#?i=F%xk>;BrL;7YmB%(NzRp_Dk>t%bwYMnYTPL>+{=jw2yvog%< zg^q2vRxP4Cc(}!@D&6Uq$mTZA1-!)BT*W{>O|;=)TA5fLc|g3_FlyaZ^-IdF_Py&u zk&btUFr!RdBaUz~t*jC!xHztKF)k;SO`E<{KQU1z_aO3rsXDkFOIviK@CY6nn;x&v zye^HcjM?$3!A#L{ek;~iQW5eBe>j%*?vNwp;Iw3-r-S3t-FWTBsQm#7BpGELq=d%d zR*-7^dBul8m^w`k?azuLJWh0)mylObsU8SEKdHOn{fZ#ta)z6=`^3e9BgM{(*Hu*# zUiM%Z$|2^Hk@DjGRoiJy)VZt5FXhH5rn2bF5It;M%*-cWfv$Pz&Pq61&3nZ~8*y`WMp z`7f>Xz{SIl=tQo{nZ~8*=%O8(0lJ@YV97C*RF9^*ft5Dd4fQ;7B)=-l>9eip;taJz(}FmGUVj)e;7{>6 z)j{hI%imtmdst?ENKc&m)kA;v_B$s~%UxAhLFOsea~(2*oV2p-+_!)l>VQxCu`H=f zeY>hM9P8i7TpvlzDhDs^A{$oK2?Q&;F^1to>iWY&5nI^Vkb+U+Gl65T@kOU z!(Ibm4BYGkm<^uVXE%guW_qzbPmRx(9YWRE-PiHfkUjaQ4dJJ)d(&0Fpe}nI-m^RB zOktDy=$>_d_+O{$Op zJGDD!d_z1)1NkP`Vv%=4xF%NnUS~-S%}BD>fFZMbbFBJdMRateg}>4--6_B+7_C!D0P38JfXRoKs9M? zbUb^j3OJ#+Th<_s&9m6S-vumW`^I?nRy-)J^bi?}vN6iBlUUP+SZ%kJbpXr!JQ#D~ zf|rp^5o_(F(w^-22Y4teZQe^{>B$4|oE^U@JMn?$eY{>GuM;=zUe`}mkmMjRI(Wox z)O)#$8PMzzZg}2MOZvD}8h$)(3B)UA7nnM%dEWvC@8wqd9^QGvC*cmB7R6al)y1;+ zRAneNVv|M|m4MAOIVMw7UEIE`s>Xd|mQa!>W%C%_zlZ!n+ZdZav9*sqYW`t=W$(f( zi|u(c*0H0MJ)qlS;r52=P8_kuI%RFb0uA^Cgp*t3u#Qw3x1Yjoe%8QPHSSN~ADET0 zKz$91h;> zW=TEMq@Jn1u#QWOm&qBVZL9{Y^cxIDcid4jm-AJsqfW9*6Q&8yX2oS~G@=_-SjKeF z;|gk05q={5^Jf^H(QZQ=<@X`e@|H8Z%48T}8&L}$2ZX|cXB2H<4lmlkl#vs0>dGmY zoyJY`CB4e7Dk}RoEqkDU?{(M#sJj7X=^Vvh6&TP4J=V*BJnzuLp3LISTAM(E z;yEl1$Bdes&+!pJ1~ZU;W?1NOs*jz_kFc2dG`~t{0i`EZjTD+!3K=TgS!eodl1?E& zg%F@p2ryCz06n5rS0%oY+ZU1Z7dd<5WbBPgWz^>EjpE{@*2ZU5zDkRvHGczpvc16j z#76t&Mz$}*&$5q#t2+A=uUna)NzcW(=;eBQPvZ1Ol)NEPKB2e-^;xY+s@pD}McG-{ zjeb0|uBFCy*^R)NT+aL?pJc~GqW&*%frhmyuxbe(R{EOcBzpWNr#7TtmC{2LN4}|L z>v7C31Q+U;qqAkD|JI8nZz2Zr%(YeCphj;G@HCL9;4-nOJe7KFe`?)udEA|PbAM{X zaC&U-w9?;K&_7!$xIw<9Yn9qJa?0XHPFW0-w=AlbeM6<)Pfoqnf!vaK^|OkwMn%{= zjrOyRc4q=BZZlvsetLi}=5(P?E3z!cc8(u~SPaH&#w01$tz1aRQ!D*Emez^GfyxVv-bj$f|3vcHQcEfec zBfkWaJ(MQFx+t|*%KT<@OdZDw;jEnF_7vr_K&h>yvuY+Y`mtL|bG$OlW&Zp7tRsYz zD|`||Y;T)b84R9^)-iGdW%c*?;~T>!uF<0>vUIsYmo8D3F42wNWbIuuHM0)#kNm_~ z2T6H~e!{7hy$Tut56f{Ed%d?8OLuO5&f#e~T1p;I!@TiSHf7Q1{VXZwTq6^04^P$n ziV`D}EuE{uB`s|u7j;@f$HA3pFg5`OnKaVMoQIu+x54t})fX93FIKk5`%}LFa;7XA zF11JvQbMMet|dxOKGjK6BuOgwK1Z!8z*#7{zZk6MBN3a?;oUAWvaiK&AVJH{wjFRG1YGr>j6^@qmcKC06dUB`-|vPpw}F_~EHUA9vYP#2nuS{1INe+%x0z2+k8 zN_Yzx(W}rEoXiLC{j<4>Z_;^Rk9zm}C=NHjun0J<$-&M!j%yXfRRiMl1l$TTJ znDmT}wH~ax+c@qcQ#`Y~PV6Xm(h%B!I;c9@O&Vl`Rif^DyC8El*b7{5A4T0pQC-BG`fYq{jU#*q?3!fS~*KJ1<5D9hNw;P?) zBdJmIzhf=YlEX%{a4K2bBV*6c~vsC{#k>htVg{%0{((XZ94< zPAq-nwcQ)~)^tX*x++a>5)9QeGkB?ZzkoN#3n+`4B(p|p)S~ZL3*}_ItU|-yGe|%! z1Uz9-8&LAw($`yEkc7KO%aJM4!rmYGtl+#MJY~mk_J+yt#LeER{5EFKsq`L0EV?Ig zJYEUrlde!huk^l-al-8+{vZvOWkE(P>w@0f+xzeI{!A(augq*pc6lR6S>(Q0!n}DJ zW1j+-iF#ef=Jp6q?v>T!4s~8*Q_lujR_Ek?h*BbC%XI+CI?;QFW}(xTX+{coFY#gZ zGfawWgcNICo*pP4z(K*Y@7vcC*|RMNkyLDbJ)Q*J5gl!?=x7zWb4l0F;{Frbi%Low z3pjszI8jXHCt>|QNSOi5`?A!_6{Aeo!)9+mvL9Rp?n6zK`b7QL%2c7Gcz& z;qc-~ucEj?I+uJ;xKoB;vHm$FD2n1KEgeiFrH_@~TOwslfeLp_kj(`Qv<~!X}SYbd}UH)ms9+0ph+=pQd-e5jY!)Pk17s(Ot}QY_6(Q}C@44)y*lvyZO3J`FcN<+!M~jS*I7wQ{aZ ziGJ|D|1$a6SbTyldedijs>yC;>JW+EN$fYvY2^c$DiT2L%~YaM{fEt9ZG1pzJvg;i3zSBne0KNNP6yx@0N9&@zQXAG>@jhU z)by74Mi}Zc7G){U0Ea`R!B+rZg&QxjY8@=x&p;GwU1k^f@&;n%Wd%I@>VvL+Sy~IU z3inx6M0ir^V?@tB!ME`Hr&93FfwXZPZIsyzoy*%U8l3K>=R57Lyuoj1AiOyd1mAk! zXHztvxx&qweA0jlD^nq4A5WG7eSUIe5-~SEK3`&*;Jo98N6Y+c&DXdK_J>`E8+~+i zkAD3?n$H0%rxb^zF6Yq3OHT}C&)q2#;Jjfd8vdr_=qV=#o06xH!^%92QmvbkmHK)g zuW@I1&v#D@i8&#Czksdoie-OX;hyvclak!8_>jNL)LI{M4t@O+_5Fpe9V@vYY>M#p}$taI~enCZXyJ~X;nwFv;un!1DSS4ti~$69pZ&;x=Z_e1V+r}=Dmeu+xi zhqf|bhGB#C&KjP3ydUug6{npaE_L|=PNgT-pN+$3;w#hK8-2=+<}Q15hub)rNnf6_UhyIRz2c?ejjy8 zI3kodCQ`dGIovoga{O;yS$b3Qb?1o8Q%Od`x`w7lW7RuiwGYoeq~5uPXj#wT$kyoe zrwPg5vrndIP8>2N+W!ZK)wIX$Zv;Dk4@ym|YJs$bAE26U-^y>oTB{VbI6d-Pk@e)%3v(H@=R6ILp^S34yiOm8lKkp1b4 zF3RsuZ~RVvfBFQGl-bd>1fAAGE*&Ns)(?GHz^r$+Z}$_<;3E)>T687R?V z^Nzlzc?EroU|(1)G0yq?$6r4+Miyu@T2r|d)D=0mKB;1ZW@1mMbV3BUm``dt7> zPU$M|IrNY6#6|6w>N#`6x!nMEBX0+sdkPgK|CoBXr|W*7OOOfdQt66?p)hJR{^`xq4R`qYI zn#pce|5^9gtm?a}mg@UGRV(z@?2n1U~Mp7N;Xw&zO7Xr5# z@E4ZHoEz(6cH2^|pZoYqhHiN?j}?Ai`gWC6 z)>>L`KTDR)`7B%WkL~$Ku_^g5midpJnV~+kbbDu}%zw7h&yvrVXUm#7H=elw29IUO zNf@T%skoe+oP(5)23hDIgnd3|>h5SHTxn%)CncggUiGYsCHh;#8D~{ksh`IL%*1em zePKCLv_@_dMVuwh6gNiN1nr&JRP41_(sxJC4Ob>k%oqNAZN9MV;x%oS;+ie_JV7Ar zSELnkyL;wA>Oq3x9<42HEfo#%ROmh8MfEb+hM|vIqRt)Cf3ivCT{U74$=6r;ox=Jm ztk!k0Fdo+vrV_j7@a8uw6IEFBl22eLm1#s0z8$r{%qt+d$XfFxUmEcuxv+#&qt(hq zuRZQhSc-X<%e&hDS*2_p&i+Jpv2cN2m$S{Cg69hCx42(bNQoopEhU|@+2s>vAea73;O}Z=dTdL zX3sCNS}!fJJBc>{cC6M%vXRZi8=qMv8|PHDE^M_PlPzn`MkAXg^@p2N`}@y$%Vcl< zu!^8cc;z@+8uw-@67K8NcX_fqGv?^5RZks*NzabEC!QS}9`zM#{+DStd&fOh>sPR@ zroL2GAW-Ec;WPtvEFFiG4Ve9tlbS!g)JpdtGVHCX?b}9;V*@kZ*BVv@LL z6nBS7?5E}rr(5akcmPP;?zr!2GI5k*mHZ~wNdF93@m>=a5tigAKX|}J{o7IJq;Gdp zo$dzLzQ6tFCgZvq{@ImvHr z;){k$IC)n|ihDWBI8G+Xb3^LwaH{M0<`2)e=FdA;`t)K?)yqQ<74*~<;1wT2={FGp zacJl4k_f3#^60K}l+L40N*pt)AvtyK;~|EoWU*Q!aNoH-qfSh|M(UZP8WOMByP6+v z9(5wy@?9?({d3fbTCV0GQ(Y^b7G| zZlI>TlM&I(q|G5G70iV4n>Kw7KBg*ZxzkbIVlpzx$lPAie{iZzs(`#DQE6wJid8G~ z7v4ZE~-g6*U)5|dD2Ch&qL1d1mC#7%TMZGn09|VSj5O17~mfP@*Xo7za-e%G&~rh zGCN-WW8M}|lVTD9`a3YPUJBeSU)Gg#Q6>*&-W6m7IPsa)O8;RhTKFPp;=Zv}EL(~) zRmL+i5yk9&82ibCxR)u&XKXTX<)nTF&E1tULlC}SKeS0chMrbu9~H9`ofZCM_idqa z^Q`a{8+3TknX68s`E4ReM4O+3XFx+|Y;IdOAVl^UA!E%ujBK<`Cejh@t1C%)KXxZg zl2OBW9W~racYQGw8g;pq{ujTTgOn5+AtkyFG5o!utS^I0cz3J@Kf2p5@wEI7Pj0tb zPp?b&B(`!^`|`w7R_plvbtCuA+%)|WpFgeE4#u898F|ReU0k4~vxFGP4-$~bXNhme zow5U?jGl|Cn~O5Ka1LD2-}=X?Rwm73gEPN{{`uwOcAZ8U^=_e_<_~{hWsVdRwl61_ zs)6j1aPx=P5fA2n*rZUA8v;R|4M&R%)wGLA^Tn|@EtfErz%#joGVekXOr}yP=$*xT zWcOJKR>1WRX6lpBd-*Bvkt-lcfet~QVU4JrVTsMM zf4G&|D7s@xsSZy(CfT{-9q`WYgf+M$ZA3e|-tFzxI_cyg|E%Ev$Tb4FWHrqUMeY}g zZ)JYWkE11pZNJYOzqhwDSs8e-+N>}f`$huJ)V!grye41I=PoU-M~*QQmq8jwT!zHa z6q1=HVzqAJDBd(I@3Xl5@=G#TwXZ6t5m773qVLs6s+&uw{zKy=6pVDuOd8Bt0*lcl z4T;SCSF@C{wF2&J7F6VyK)BB)xI=e;PvWFhTO~>C$F1r|ce7{8Y;Vo~95wRtWUY=e zD|-)#40r*}5gaMOET;9@3Yx%41XCVB7gKu~#wq*<1bn0YOyXp^MC3i;IHiPXuFPw0 z@_LaM=CgsC!{d`N5U&06v6=c;9SDWC|DhIcQ=$p6?8-WA2`)pOb6=GXyXT!FgI0%m z?2I-^CJZFoz9@#fRRSUoU%==sdjFBM(tM=JgK=#EqoVa_oQ&J5q?%~}NbN-`zI7a; z>IJV*#kyTlW>UBmWu((8yGyR- z3kTH+7Z7h|%>QM40hAX+nNwqt{e$-xGDJaPPZUsM_

3ldnE1ZCNQfUc~ zTHHoyjt{SEb*{_%a4Io#fZuVo8KfY7eW&2Sp9Iohpn9PYn1G)7!TGg|ifiFuzO>u) zP^$F1SAZJ7r;^VIhFH_qSgMPyR~>S;uJfUG0RoiXHbi9zNjWhI4F~C4g-;y(l5{zT z&tir=;Hd1VhT8SSZaz|Q)@;5h-e7z|s3H#^D7O(ebA!A~*1~@N<2{I7JrtlQ9^E4dmIX}Y^<+5RV0=@U;WJ@NdV}YSNf~UKZyPd8`a|`5i)Ypkr!Xq&b&cR|EFL4 zYAAG8%V{Uexm#0*95a<(=uw9|hX#yW%TvDRE3Os{$Dr^zy0(V1OwVH}9eVU$<|#8t z`8Cd1(A=gCw$hiP{#vctvvDJ%Co?W2o|>PWtZr`8&L%4Jc-w8Ywh1C+j;cF-)CxQ| zj%Dm=t&!ELfVD@hb2c`&DKf0|qo9wq_EO4VwU8zGy+-GjFGOihe2buHQG2Bzi%4pM zx(0hoqn@l15LgVmN*nEc1OT$qk*h$1g=t#Q#3|kIxRx?vgWQbwFTu=qHQFB<dtb zJ1NY$KmnMaXJ_~G=Pg65u=h)n4fmaj2VNerzZ!KQ>yqzyEBz~69{edy4C=&>pUTqy z7B-3s=GTJR<~s7{1l7Ys1XF6l=T;^6w6Ks!w~f?ryU!q?l3(+jBez6el1xG zRV`6eyhqR-k=sUDVD+(+ccZ+>MEV+Uu)RySs3OuPY*25V zMI-`BAjm`#z~ZY~t2JtURZ%8_RwXzyB&Tx+v6X7QVrkWi^>Oi55Jez7B;YgnL{UVn zGNIO&zUom1nu?n`~CQX%sFR2)?Rz<_1=4nB;g(O=+y5o5Ao$rH2%S6 zTwFb)B`d^t>EPzl#T(Z(jQMXK)4lg2aldP2*{dYH(HvvGMp`iBrDuw8P~A*fEvPv{ zd61dVVdlEOeFF)vwHg>?DR0qv40UP^uLT-3_JyiRGi7nw*3h}Mq&rLM(WpR|dH3hU zp^PsfrEh3nzN7qw+Jys2OHQ(hI#v(4I0g3+W16X{=o?8i*2a`5&gIDVG2Tem^IoLN zjC`%ddmfcZu93gS#`4R79NK)la*(@Oz zt5Gt0x!R;vF`f7Wbjut_*=WhyXhaD%c2Xr-v33c9ZoxWAu))(zVaS<-E>Xo&zXUju zFSfC&^p&#dd*bCtYpGZ5er(lfJUvl1beOpe{1tRIpf8i7TI-UFxp24a9rhcfw6fo( z`#FbI*)Fv&ASSF?8F{vnW6roWluTdLwzmm)TQyEdG4UH{HNHr=cA+y(_Cl~I`&s9! zS=Q0iITNx7K5A?}f>{svK;uK=*mj2qQYbcqk?dO0A< zs>^TWvLA=1xo5j+4xqS-s+|j=s|m)= z8Sg{5YmUy3!p{ljR_DKZ%l0;}J7^VM$2zLL7P2N7gEXV&eXMB6QJiQBlWrqgBrEZtFx~+&D ze&YR-c(G+0nSn3S<1O?^hJgD))O`-FLI|4vy>;fVaSIywq5|K6l*VJ}eM&k=xtfLE zi$toe9_MS*q7#;pFk^JWL(o66I^iMs4LZ{a7lfTerD*zLgXmKfkF2n|^}PdhnkLJl zN{=J{GE;wQcxJ7vS9iGvSJwT8ay3fd3&i;-r)2WR8N;C#LyV%!ZOc^1Jh;+E!mQh< ztCOe`V2#^I{Y8WIS;kc?JcfvhzOeqHS*Bn7MZak3>GjU8Gbop6ci@*6(R;4UUe@Wg z9kr)J(F-|+N8^q0eO=q0Z3pcb`Uyk3t3HRIZH4BT{5gW2l!4ZSa4wbwCyp)w{B-hy zIL(qmvdwEU88g(G%cG$^IUCuXDdtlYMW3HV<|j!HY5nQW?8%#y7GW=HtXF*du}*#2 zZm^kUMZBo}j2E^Ayg-z7>K7i&_}4_crlqPn{Y(eFyo2aJSOGCqHZ6#~FCglTbWcqB#HQUW=SSaCc#I|Z#X0Q&bo#ebcBs=(@v+T0Z6dg%8< za?#N&I9VQ<1}+pcUgaz%C6OwO$*c4^gvs;tMGhwORvfNngVYPKW3r>&d|2*i>1DG_ zU^|D%0$}sKEu!bm6zGgUfBRk|Yjl{UVcpul@vMVYWGKq&Q)ES;abJUL$-Y%=G z`AVj0OT`2ttJ65|xkB|D0n_SGs?~VseJ!V2qtGRv=D3CIYGLG3Hp({2mAIVy;R;a* z-Sw5Jo5>&A5gn|s#`esd$tBuMQLIqt+zLH3EU8Y@I8US^_$u(urVA6BIF{_FY-dj5 zUKKk5i%IT+(;>vDk1O6e-L#8NjHSLIpizxL7miNou!v41FCx9nxMU71pnciWv@ZTZ z7aXr}!#1Zv#kZ^fdw=5mlo=|Kz3KeS*OX0+$VRA~FT1@k&PiqladLIhgc*|JJ3BPY4a zRi7fOOBPC)SchN$i5(#pW3p&Nn1X1r(U5CllaN|L?AZ1cOJJANBBO(qM?<*x7-61I zxY|&NYVUoInMx&R(>^*S%2|0Cir{}^)7!TMrWhXkjS~lgR~E6Z@E{Z7Rh`4Ew+3sL zGjgzIy$IH9McL<0vQ|R(@Z!3`2#R0ufO%HCh*Pg*Os=*k>WhTi=u-_No)ZHRp@1ar zm7|PeCZEK;Qq#G6WgJDsy;3;C_ph`-eBk+e`B$X2^{@ETUg3=4oC@_?c_*W(re+PJ zkXXwP@dUiW{VKVhLY)*7A~-2#@IjBiY!iJwUAWgmHQI+7(|yER*{Rd;Kfh$O#&qXo zNoU$CEK<4R!c`X=Xi=+p5(g`g0%#(3*8N7{ma=}hH&H@ERa}|(h>^-paxeHZFZ!>` zJS5_U3r?Ukp_F3B~r{>8#IP<#? z;#hEY`;Mhj)cu_7viSo}95$$wAc4G*>{qg%OJ0hWt-tA?{O2SO<2}hT!<_j$%5i-q zPr-D87MzBGYD3AM_F>rXPC_7-4~aHGZa`~IsukqXn(+x*dQ*K&ea*E9<$LQ!1sj38MPQ2Ft;#(npi%l{Rg5_dY<1 ztW@`KfwwQVk>Rd3odYJj;G3>Uoj&NY2I5zBC7Uo&Tw}mwYiPuGWnp*bVu!ak5-Pb) z)N7fD#Q$Ol8a?5YAB7p(lfte;%9pBMeoVxDU#_oZ?u3B8oUz4xe!nJ$T}TQ^00d z4cwQ6yvo6niyVI$v&Vo-${rzsLHLOU#gUdrY#U^d3FmbggD;o4T^2|qUs!@|N z@k^RbsS}y{QoK-1m1#1AR!(H0?>Mp%Ez^1^sn83R%tRVe;Q}tfK&G1rY+2EE`Wqzv zUF{24zQc)W`@(u!uvTS72YG1A>p?QX(fDU(y~z6*IEezm-l z{3jYz)!+vNCr;vqN_9%s)}-bM@&Qx&Np69~{|Cb5lqDT%MbcDAB?2DlRD1*{y(M4t zP=3%WfJHO|k{e&@<}f61Coi2_g`l2lcG!`07}nk5lSrCc5|tfE&rI8{^3hPN?D)?z zhBE>ZFzI+;R7kI~W+k`m8jTc>?65%tNZUx!n;}&~9nvRWRzs}|cnAgigvW29uoe48 zF@beYznsWgw(mX~XPZE{Vv>d{+V_oCBVE@%hVYj@m>+y2AV+#fG-)Im%{Nnax_aT9 z#EtM-)dLcQIkTE1lO^@5(ii5atyS(v?bOzL*^e8jtqfG^S?!ha=4r08-jw@`R6ngu zk3@B^EfC%P_cAYey8E-DyBnoF`2i@lWNsAVs`O=~lNTa=TB?!32Wp;HW!byVw1cpl zD7qFXDqZd&UeskZ?SjDH=+)Aj=toF*?{a=a2S@pt z5`E;%Hwii2&16W($%L=Oog48QL_tj%S5EpgybI~cRQGx#0*#L{;!NLuuAS1<*q-9O z?}CCRlvtInp`%Z_M9WsO9~GX+tVqtMs7lj+4NHn*RU=@;c~2QBe%)H!Z<#$us5{$9 z&Y@+yRLk9!7pJ-yU$uAm8-j{uUN^jVxk{nshdTcSlrrXSvMtu%cd(@9=|W2l7E2{p z@7p7DKlek+%y*5tU9(QQ(5mzvdtKLJBU~yFdSsA>V)&f$kYvGz6o%`0B&D&7O>8L^ z)$H6Z-bqkS_H_XQMPL8KzRu>&bnzVCm2YiChs1r~eZ54mRIAbuPBxyWk?firyLAY? z<;Ww6mS|dyx8z;=mx*`ImaaAGXXoBV!-%G70MeT(XAkCydUT)As5vP6wzWB9l6Lb;SNOQ=wR9Gz}XuHT{cx4$R)7+XUzSO1Npt~wBJ#N3GFYW zA>S5rl6Q-xmGxbYqSem)Rk@hm3I$mGhqa>d96w`fFXWyjGI)>GDao4REJ%WsMvlm@ zEHD2DPd=rw#9>OCnF8z>+>)d({q9#zavDYai1aHOiC$Ksk$G$GqN*G~5vv&)Ih5Se zFpBrB_=mE6y}^^;7g~#NHX;usKc$NVqe++|{PFJ-DQMEbx;TkH%aa*R`J%4SNkzki zE>&fZwhEw$Pq5pJ`^uKF`9$v9!&eseE10^mjvB`G*@d7NDvx>SYNZxwW)#TG{z;bt z^?$A52_hHt)&2}T`+PVufz>Sa8^PC~9z;l=fzkrQ0hvMzJqp=L0N-!j~m zF5GL&@yarwG80Kj{&zFtK(^iMx+DyfX*N}AIVeAO>_hP>XUF~^KFiS9hoABtWAF0T zhINCyG4uooMzrN>hnacGyXjSkobyt3vekR0#zCMV>dDQyV#8Z5=K0i**(e-rw2+_p zP4h#*UK0|aGCiz|NjMGSOD?YsJ+PJJB&H_3&?oE~9{Tw}7Fw^~z)sd{g$eTyep#7G z4jp}|NfsLzs967hkOs4KbPB!gl#aSXMmLz7puoDYJ_v z8_@BdAVJiqJE%FyN*P$T=lg~Abi}h7x_I4bpT#dQOQO?iOS(URM?V3UcOEC0c0BNO z#G`>{62}!oN}|ueO8kJ8cjLAWUq{fAxYKDFxAW@qG+EHzK{}{F_#_`E9u%5dIg_t5 zRxDa2tV#Z0u)TUZS}VGK>8oMR{+UD=vz%S_Ep^!3rIu8Bz9=}(CN0j*l?;0zVLGgD zEhfN`wS!Q-7EQwt!&5Bq8EAB7-f*uiBc&?@Q!`q2XKm&TF*y#es%i5Q+Ejj#6@Ewd z&uR4n5q`}+D_m9-PCCzRbu5;?Y1PqIg-QEtF`DYm$O_b=9K{SLCAbw$jUqH=qGaZ> zRxBFc+i(-%vDRZJjf^)2@u$ytVOuf5HK%?8aW7o)T{W^sQNNQe-ml(~S;ae2BAPSw z(()iSgBN?=zW(D@`=h^1e|ydPpjP?rOX1anz>3C7tw>5r=CYHR$$KM%A~GOk0ZcY##ihF8;?40e>L?;@FYXdU^HkqZ&aNnKe`M8#)ctxMZ9iho3>)Yt=WyX8 zYL;zmA*`~1y_{$8$2)^6Qnq(cHn!G#RCTgCz8Az7iofcrd^k823oogm{$4Z@JV^B_Bt(OMV6rgnIrK$(2cGAeR|#R{l)x0dUrz?P}l z@G|m5C`J50iQ`$^HsohqeP2h*W*G}&y_49RubD?4vJ0;}PZF&5cCgU7B1Xhkg=|Pp zi`K!dp+vY$RT~$@b!A+0c=d73krm3l)JtO{t>d#Q{i{gB{zin$8MUXfO7xnw!KdPV zHz$HiOlAyTvHf5PvdZwheZpN!@3%Z44#jHMt1N4(cB)>kj%=%PU#hYpk!^DnSCwtOc$GUM2C79Y(q3zucz2`qJ=$5j+?ImwyY08%@XG7_c|oC8{ZXD zYs=io*)}G{)=9pF8_J5I94S5>#vx_L1Z9!p=OJcU9~STbR~!uADGrY838EBWr&49i&%Md!E|6cgvSLshd;ehzIY~fX zH(Alf$3hac@VzQ>=(&BW%2mrUbIbjf_2?ruy_AXdC)Y_?qhUf6HjJ`6+0NcC)*-{! zg_MDdlpC2G5?>QCIZpH`wkFIpv$yHUdJUX}D3eTrP&J*YiQ;PW-@dIYk2GzmN(=HW zv+_v0W}mfAM=Hs8+=7(P1{SgjP}vYe1b}5N-|Dxq(n*~E6&$52Rl^vcrd~Lk45Oyn zcVYb3OX3u*I)S3VRFRph>Yl|C}Klo&M++qNGa<9b-)*(0&wQiT28#srp-ww5pOqv z_=ob0({{!yo%$~zqR#lG%8V`O0KT0lJoB&QnCLZhGwXyd-L%Ah(UWKBA5Hm3d2ZEj zCiCRmgF?7Pcb0E#$+%1ZXgw4PZ6&2`I*Dpgh21Z`$w&(!yWRU`#m%8vV$ITLFJ5N% zk$4L*dUDoRmnFg6d#4BiWW}G?Q=We)mMeCK-XJO&)ggm@YGUW`oXY zy0AiNdnTeL$$MA8*O9#iZ$_;G4S8j{bK%!4L z;jVrgE#!$OET7{$5l`GMKza6K8orN|9t1#@?DD>t{VfP(^SHvhT_);>GN!>hWlYC( zNY>s$yvRO1KMrIfKD!DuS+QyHOUfkBSOuNDa^ zG?l3Tx)6sC>43kaeV?VcW!L}imTmmOuZX(W_hS~wkhQ@0 zog`^D+9XA?b`VV%)(J^!wMhfej_gL8Y$PG#btUJ*_n)eN=#h8Vnx%TU@S${hV9u@) zhWFMX{_Hr3`ZYj)?sA>IOk?&#@=LTc)5ga6{;#$CYL~&XTwc2BS@oXexAZV6)X;Dm zvJ;<0V*jA^gsoDMt&(VBiFtpP$@rn@EZ-SAoqE}K(lJV(*dQpafOm<%jnjTK&SEl* zxuGc17!Bnaw>b^}5H@G>jGg+a@*rD;4XK8A3Y#-lIF(IE_x;V$$XX6<*gsnKrs(Hf zY8^WP^|zH(M#2FQR*Ty$hv?s-nI=F>^1= zcVsojdWiyguGBMps^#@S3HnxGH*jYf|ETPO1YddScVVFTcD}FpmAkpAMTF&Xl};S^kvx zHi`Fc*x-YI)ShMsYprTsP;fXI6vG429Cg|A8~N$|mcB#GFGsz-K;R17#AA3N3vEyC z%=LXuhtj)Qv8B?KO;PYiEhlY4avR~6zcbv@=$mCPJM$gqj^+OJPBmvo!ZsUr^JZb+ zn1a|~A-QFYd-R4_ z|Ng7lxlPWm`#cx>EstbAM131POAE@?V5abC?vM?&??D}v?zco|*idQ@!ssGU*4-Q_ zs7zOrK{uY{k<>gHf6KAq$h|Y4^B9&#WTSwd%u#y|(lJt3hKX|kRgzm`WBm~PbxkZo zcV3h>K#zDsG8gUZ&nWaQZ&LcX_95RA@ei1w8`+)G)E(@WdDqtp{$hP>ILU7<_7ixt zX-CdZs!CtmR$cb#^%d3b=alSE@0678AqVY#1QiH@$ZzV&7rAz^y3DJ^AC`%htTHDq ztc*sMbKJtf{-le4mbv#T=-l6~&=@(*E!-q#T4nqjPBM`lIVmLsPLE+9PML1Ca&<3> z^Izj+^*3p%ER)84o1ZZYrgz=`P?hS-F{Zf5ALmYdZz_i;jFv|V6Ua_kY>A-u6lzwNeLV4eMQu+XwUQiv z(4i#9r$=&3#R_Orz?*nHhlx{UAULgL?lara?yJi_s%@!qH&m5mbXQJ9i-J1_DU~GA zLr}OWbKaGL!g)IKxFP@|V$)Jw4+GlG$F5trmD3}@Xk76}Fzeft{xVo~(sPA5q;z>n z{5(<1SnUSnl%82yj&;u=j&g?32DVK>q7`LdILVvHMgS;b`y9=zU>IJ?8WR$SYc%K| z?TwPcJYd`0Jxvb0I5TH5ec5~o1C<|u8`%)sMVgm(WecBd8sNYHnKShR$?mF+P(pT& zn)w#xc0hk4gU&w92@sL^qXJTd{ecy-Kk!#VLsn$D4=C*7ul<;r5dw}5o@I=yUyFVd zS(k5+>khalG2#Qwbdo&eA6_HQ;;Tdye2B9+b}&cn_}*eCu?H=yE&f?%;|1TedEbH@ z)r(!_4*{batNTjKQ7Q&Q#_P%6rC~s7&aE=%sc?f-sd2me(^957hm$xJ)DV7cr2;yf z&Vw1e_29$FI02|ICpkzcn0Zw^BsS+@S|oaSHON9hanR;XmWelhyA024pfb{<+Win$ zjZ6lXj!cGZjNF5k{GqZ_aRZqi(qRM=QfYU*;NQ4oP%Wf#yGF?!&hXxe3pFutd630p z52hh`K725ZbnF|`zw4u%PG9*Ozt1PFR?oqiIFf)ZC(l4ddd!Tir2Dc@ry?7Yv?o)s zR+4h{nG128EmEdw)YdIkhV;`m(Sjv zWIw>ST-{a{wB|HwksSCg0ZiyywkCQmJ-}=-rJ*L}>g#+#;T@BG8Emoe_E-4SUfYSf zbeoWhQI}XyoRG}3a9rPLGpk{w9`9s~wyN~SvPk~9xhj$wo$h@!`cjosp~_d{3>k1p zU)q#;;uowIImQuLs~aMHdn{+;=?+|L`5RA-b#~S_GG2|yv^4p?p(!Ghj&#*JfjK$J ztG^aZZOROi$~$EiqNI4QF_6k8;=pD+A9WSHILRxR zOMmc3BPxU^(1#hXxpO4R$-&@WKV|yVlqDIJq~LRGvm?tl+6UpT6#YSHw}anx{EGRN`*Oc!MS z_j%#vtq>R|J-);nq@ys2{;!DO-HMRBrCEr5I;q!$ z>q@G>hqf0sA0FVcdsG1{_ste4EJz~uJ~>@!X-3y&PTkc>rJCHzu^++7S_OaB4fCgm z`0ZQQnFkWo$u7W<>+-()%(@{knA1y*>4nW{xgBxWqzGxtOnhq1H^9z32X}Z5K-LM7 z+nD#|99{f*#?_m<`%J(VM`{`4>PU>HcHX-Ec{!R5hvmY1z0{)SYl4JN#%i{IeIyW)TRaW&|i=uvJ^r%FjHXlxt*+ATX+Z8i7EJC?H$rIp(_ zHfXt>py>t=RXCpaHX|P^o5%_PN9Y9hy~u5*?vufDdSKn z=%A*2cap2`?|`fq=u6f2X|o_lXnyi%zk@Jne=h0_w8!Um(7|k8iXL-WP|ZnfMx=W$ z{>^+C8~X4*B;_rJ&O&S?2c&ZiNSOn&m6CmN-`nLHq-NkMT70LN_)K~uYVv0hwKc4 zPW^*mr$a1ye|(kRC9hv01MoV>IfOt_w&LP30DZa zm|O1Ap>Jj$<)$9*nY;LroeJ+fWq@s&)Gj_0>y-y`>)qXnmf}q10Rfnj|mmt`EM_p?x zee&`(p`Au$%_=<4u0m)2*lRWjaO9bC5p!dN{{%5Xw;2d9uH#M)u5< zPIfJQjDTP>xwO@vox^M+%H6kASUape%$>zXQW_dbA2drqc6SR*Sk>gL_QzK8hEZ&? zxSWo&ke-Cf*Ub`Y`64{uvOB!H_bxFA!}$K^P9xv1DF}FD z^5-lo^YwPVnqT#{+$d9yJ6NDv^XaOf&_%Y;p?;ycjMNkw6%-n33w_(RT>^qm@_kHG zQ|M4W<#6_1w(J^HR%2_w4kY21e`FE16Rn+1<4%Hy8=HIxX49ld{tJEJrU##r(p%o1 zx$hl3>_Ic%Hw)|_Ix_g!i(lWj)<-k_TJP}dySemt>=oU49^C~UY60j{BHys`y~c-u zLG*#YGeN~dz^U)MC2FJKIV-){Q0Gh6>=ultNXoG5B~n|_o(4KwEYAFWI}RX|-=@rb z>H`JP^%NF>y~c+nBYs;}4bJkv;mFUf>}&Eu7~(;&TRvrr&h&wNw>xIa7r{WeJ3;)0 z6YT8@-mH8589VY0t1T&iVIiwU`OY`GKp=YSxC$~V_eO8YH~b`{awA&2yV+aEpH8#h zo)&&&(m(JgIQ5S!f67V9-bvP5Y+^X$ZJf^b`pk7v&3H49E4)+wti$og(K~+}93{Ze zEx)p=b>0TeAPwUTj1Zf;mXS)~Y_&mjPu7TZo4H`K7_c~c1({>W?cn}6@%nM$Wbz&UV&2IkUr7$oxP=6p zQj0F6QfB>=ycPbPSRndCN{8o(p@C8$-eHHjr~_QBq#FFpaINE_l0ueo5VH@ z&hHhS%M41Ll$oD{o#AfbeX@kCCsW%B_F^u}>=TTmo7Aq+35}+2)+;y(c1hPHA-xe@ z`cYvt@4D7@0NUywkb3w7{PNUW2NGd`*CVR<*psP%G{s=n;kE2V*M8i)N?gg~#{Ju#gUm2!e- z-N}T{FJZR1%lR1zVP68F#d;3Y1Iso^Y&+9XC^6Zyh{?V_v7*vlLu&-MH?h_Qj|8{{ z@XSS&BET)bVQumy9N?}hF~=uzpFm_e7y86?lyY=euekcodpOCxK@n4`7)mLI%3WN^ zifXc%@Gw~Cr&$YqNZbGvO3)LVJm2q%^LCEZF2{FA3Qhb)f=H-IS!mW~L zg3{3HsxJG? zNfh#<%Kf_9-N>qw!Lp5!Pngy2xTJDFN=61ze1v4Lap`hg5VK{dGp5n$0% z5GDv&WUZ9kyO3r$$#JF`?!;sgO;eVkDQZ`=J8rF?bm9F4XwXVd$q)TkOG?;EnhI+r zi{v?Xs~B3z;2^+57TA83Wv|(-VopMsu?Bs}Vf!ev@f6uH*61C;+fKWDRJ2k*5B9h6 zkeh9=)BbkP>F+w*-&aB+frf%=qI%qlO;$CLC(gX3s;`rrA`#KTt5g{QU?+JQMT`a_ zWLz+gTw}%3!yuz>rU*$4f6Ur3Ag=Bf&Z8-)GgqY%POjQK(Z z-o%)*8Ng@jcsFI137RCv3I?y0LFkSH#o&{d!|9)*_ECf_X2n)==wlkp*s0wVRW8L)p3U)KEeqdXaCnxcM@G`R4@0Yo< zc@k^DZ;x!liO=|kwP43~C}Xp6DDOnts9PjDFSC9yzzH>2^+#l|Ox{E&!4TV{(q*;m zL?tV1xllokoWE|>OR|cD3S{azdOdamb1vm6OqG^3mMd{yxngot<_gBA6tK)mE|zqI zUzwSfzU)PSp1kj1rb+0Ud{bzqC*{p_B^N*D%yebhOES|?h?A()nbw@VeNSSV%XkK1 z>n;tzNh}8I*@gFcS%5HEe|rH_c%t<@bJ(#^Xy$~Cc6Q_m_0vrI`Jrj=C)0kl-x<>` z{DV9Nf7)veAmYV9D8RH zk%7kM0@nZibTU#ccXm426VT+&yiQ(a0<4>TF!-JB|H1Hdw!g_l69;t$i_DF;4G#?G z-vGxWAy<|+1|kbRx4anbaL2sUFhIC{$VqdQJm;!IRPA)<{LKg>*^B=6K*@dAZSJka zaXahn4q;HHw@Ktlvl}RUVPNOo{MdFgG26}W=FpAVs6S15G(ThdR`#3wP9LipJ+wX~ z=~+3gAkPT=T0vD_QW+~-LQ5f(HS?Rg@G3gdw2(a$?#eG#X;-6I&Iy_ zY5grJCyI{0Mq_2R_0I<6x85fB&w2=QbjPQrbpCA?-z1m#kH0lX4Nbp&0WajbU5>)` z4hCl9oUWBN>F!n~BXdvW{RUxY2=$>LZw`b9lQsW1*iOQX`3DJ`}TbgU3 zE^$sb;9>UTnfI9-lo=OvHoent@dupX7dy3b5IKQ&x@onJwuuil@TbF56f%7-)Ty&> z3G2$;+4%{vU;3#==u2}aiQf7tx_AX)Mp-+c|KK%-s75q;9ShlAma891l zw>0Wj_2rQFioV0D_!W(v=#*6S9p{u(^}Wz3Iiv3cr{tc#(y&u#1>mZhjaBZ(wsC`=h82=T-5fiMr5`&z zn)<_R`J6sF$sbDJxF6-BCCg4r4>&e6>0Wsiml77Bs*=l!xtO!I?i@5%_fylC_vf2H zvFVTHjmV1e-=*^J7=M56nNjz{^0O=5w(_%NsFm((4E4*!EHIhc%Q!JL?3=joGjxcu zYr&}8vLpw;m#4bV;l{KxkD#Dr&%HxUtu1~i$1nK?Z%3w%E#LAi2Q8k?LuIP4@8ZLx z6G@d!%K7l>ujKbC`tb zq@$>CGx4GS^STgEkIl~G$2rMTj=gNzRev7F&&pK2(3@?d%8eGqhZo8v>jEbqWs+6l zZ>ucf+{RBUm+t6-4Zw_7maS|`UPdYT=OoCUWt80&qCISLLdCI>DIF&FtX)oqF6E=? zOV*wzv{e4f@(a#iZte*Y>JXc$E%Ws0GWMJzvQC4g@cwHun%!9nPV$!V45mna#rWlS z6uZ;nuK$)yk58UzYpKuDi%$(r1#(OS_ifRW(pCr}xvwFrF9pqV^ZRWd^arSv&KhQn zj3QMkM!;^2JsKbS(>H*Lt#m)4RD9?W=4r8cdfzpyrUsJMQ@GEM6 z@p%|O*vJpmZvls8g8_>sf#SoR9a?hDxPIF3MOQkvByqah)E|ZHFZvP zDZ5&d+dv965%p04F!Rn|{U+?9#qHYg%qaY}soRtRmSjl%jJnHgZT88*Nz2<#AB3hT zEtvj^%~X|qDi@fre)R6ZnFxUF`l(x_lo9KJ>M>6Gy`NKY2_Bd78^Zb+SG2l4?^b*5 zvrLlDUYZB)0+Ax+sos5^#H30_x4qPfpT`fkxw0#Q2mQX>?cG;ywS=>{{rD2yy4GNI zH?UD|uc}pq#}~=m7B~%8LGMoT>=Fvw9!OZ>DZWSv&q<7+Kzxx*4cv1e57p^wzbS7j z|3>6mQ_?4g{*BcopA%6La;sdr4c3vC9->=k>7TAi{o^h*tk0=j8egR33$le8U8O%( zH_MB(Uut&M`bVYZs}EZ2KnqrEF9TA~bomZKclZTIt|B#oY8AUS@2(2~#vfk;))YV| zar6MWvW8n@eh1uPvYLL15Qk4zb@C)BckTqp>Zc5G>Y~eN))3VRC@OJfZL$qd=fk97 z2iUq($WF1<)3Ew*SC;`pwySgHDdB8M zuPkk{{%3>C@y1h1RuP||Ttt^s+0sep#}!vl)kMnBiV}m>A0!}VDZ}p)*%I#RO{m;- zB`lfdDtJ{d0Fl1H1Q-lwNcp{d0#z>E^b!r)P8LQl^$ufecTfPyrh- z)rE8AK$#X9)Od0|S!4d}C7&xlPy>f4$nE1`l7-uxL^@~YFY=>&mYSB_jGzbVHF zxy~A;T&kd=ix8-Ab@gRRucBqMtT;KBDV2%IFD9GB`bu z=1D-5ek;1_knKn-+%>TqB(agx<>jO4Bz9@Lp=(ulmJ;%iD|O8BO2>Qy{nEOCS3Y&S zA?4X%lZ_nOC|Q)+cH@Y2j{_=7nsvltKpDEh-8ol-mRk+~&wR{fSO$mQoqPxgYAmu0 z_p|oHreA-u&K;TDa?6>OH815(mXKuT_A3-r`K_S7M0=q{T)z!Yp%^phs)(pwQeL)_ zO(U!V5eX^`=5k%8yb;)t%>U>6-}Ln96b#=da*pEuZ7`VSL{ZV zhl~xnH(c)&9iGyh(d&rMJBh!xib1}`nf@n!RA@mYE+TPgWgqk0U+7Nfgm-h@-39*838te=uLyx9g%RRqBlf zil*c}EIKg>qczE>(8ZOFQLbtj$4@75D=9M3nqj33a*%vuyIFkEY$`ycFJj+RrFuu2 zl5^w*|3-?7V6J`OG7K%(uqWk6rsyl`22r&nKe&+3w6UAYe}%wFev7Ua7WpfaW9YNk zm-h`+vGQJ8M&9cmZnT!C9C<%OT1Vasq;9f~|DELHKh_o4$U}vxQ*o3Q0IJx*7NS`1 z_#%O(XL)*<5%(3&$i|cos$$o*yX#Pq_vP_s9B2w2XEB^20v|&!%1FZ#ckRjHiK~&P zK#$B9_!V1N*+$?Cnsm!mfF>jB6|nZQ{^6WnX65vfFYDKTl`HE<=F~kgR5z7eCCD?f z{z0mR*hJz^o~^70mx5o}%J{3wnpM8EHv&SD%|;UnWcImKkdc;G%6i7rMy_Pos**uV z+a;s;kR{XT)SpY@K_K;GL$xs_iLlg$j#7!k=?PSgM2tYHc}2?Hb`$;E1t?X^l54?}Gi?x68G`hM6T1;TU@3VJ zr}l7{HU6usyT)A>e?QXruR{D|6c3(vanrI2gXeCfABCU0yJ=an&iv=Z#<)p7Ep7f6 zO}S~IG0k2&YY%-E47+RStl86NnQM1xqt`{BX7f~@8bkjwt>vjb-L%ZLyQZ?{tfRHW zWO?t*AJa3wy{#cF3x@JVZd!;dRvfUEjfJV+y&(IB8xFvHaL+2_URg?1)|}c8H6?aP zP;f(GsxX4l(Qus>>}H6It2-&pvF`lOY*sHFx(aG>rXNC~cw=!@O{Q|`hh6Mma;JU} zwgvIPKBj_fBd;p?IM@|Yrh{?Pr%;)+IBByg-D74Q46ZV=l-ZfONT3&v$Gq(?gt*Jp zm4_SC@hYCHYGz4+)8a$c!Y0qrp_v5Yp(Fv z{#*Jt4o~;!DF<*YeZR0O!U4cNzHnDY%eGG1L|6OJ6^ir(0ZTRA;cdOw##=edUf($h zZ$HT{avHwixc1PZt)GG@3X!3qKWJ}SA*x57$~&LBsE(pA_HTS@7a8h&)sqNieEG1^ zW1RVFF>x~-pu{&umTu$-F{wdDG2>wRBdgtHp}r6aiAu$9w>7>Yvg;};i`BPlGwl|b z(o5g(N-O$FG=QZW3-xQOwEli%>HE9*Uz>TebYr(&o0q=deb-eD$sROI27x#ZXnW~~ zuJKjeSlf`?L%SBMjQzk;CQ){h%mp4(Vs7?a!f`z-@zNHp>$h&vTzZv5fAr7H8T?UA zHz~g|Pwt0B16J>mMy>sCbc#ogvUn|dF0xec`32>@1z-N>7+k3!7ykc*NI{vPGNqQb zkFvLMczj=!%??l|zcR0#q9}7;1W(?@yb08itIz>*)ko_~NF2!*1h**2#Eynyom z&|3zpp5l}oH93LTlI^!i-n&g;xPK!lJHkfEtP`FGSmZIy3uQ4(r1SDh*(RMoeb%WG4l6sNUwbe!?b9jtX- zB}>1$>?MwAowRUtdceS_-|&Mp9F4DZ`oE$FA4JuzJ+)6|WQ&}DkazY0nH8m6u2JQT z#3UqigzeAyj4C@bm%qIYeNFvgBuiO|>LgAAH@e1+c5AShxv2s_nNfJ*$uelK7X`5m z1U+&IcYM(deihVqVjD=Y%;Dz?#DEWqQP8UJT)K^ z);Fg~iNL`$S)OtYh4)%~k-&KH*}TlNRXXjEoWvFsQMI-{;YT~OM~6207r8@gpqbpE z4MY=eKeTCg)1-GhMqX9TJW+zGuiSzvHBV4nnYx}RnPM1C=PM&AIXJdtMgPV?R<;~M z;7~wtmm(g^yN)gu5y^S0YMi(|wnKzvJ0`syM#`Gw!bn*zPk|Dy(H5gTaH>rYqBe=) zNd0j2_fbl-IDJ)~g6cm}4x+k8`C=3}xWlj>iN+fShZ|T0DzXhcEl+_fjt9P(2E>vR z7>1F8OE2LjdgZ{-RblWQhph5;O%%s+?8ma4>PO{N7c+#@p4bwhP{b$q z%dkC)a$9>`Kl)zG`{XGYPi1avP-`JFGtnS08f{{U_=l^~V@mtKLh5@V%Q)40=7xvy z?I#<{-CnhsX!=w_rfLMVoMw?w8DCmhp1SrMbNt%7U@)Ej!^g~ z^1%422CH&-9ou-#KnKAT*Hbx+=MQnxWT)y)c?yPxAxw14wt6S6+J@}7q>o^1(HhQZ z`Oe{4kevA0Suk=&`j4EEKG1%oJ;NjIYDe1gU`NbDF6+%>9#wD;by@C$Vi;GQ7MEq) zKJqYI*qf95f(I@H;UVm@EEO4TT$XF_;kI{K{tu>IJD26dKww;!(jM64=|6B;o;Z!3 zumv#moy5MIgdOWd8dImdWR=sfp0(g}W;~XSv1_Vpnim(-6Fk03U53ItkO?w8Tzqr* zley(=k!{A@5U=6FkMfz><%g>0KuYJ@rLcEtNzK!RSZaaCQd=gQ34oxlwLp+HN{!N< zHBA|Zw5&GqDfC^gI(miMY^+pcpVt3^=8YS|=C0m?1#O2|vFW=fv+mdPzUUam;|XKs z4b_=HB$AnQv(R4F7kjy~ZQmDrp0e#6U+nS^d{~roCjZIsyvKNH;(FpCw4P@Z82qoj zcp-tof4~~sDf8LTuqyAO84D8O?4sIxn}T*_ZrSRZUL;DPwQDnD)^2MXy1uRL5Udb+ zZB5(y8rH|uMe<7SJ-B`lbFbgiJ(6{_Q#o~;36FfaHxKFZK5*f!{ux<;eUA|j@0RXT z_d83N7#40pTq?OnZig_Cc_DtE zc&0So3e}$g5`9zu*1dT!{sXS%R#!_(_rA%xbs8Q)2$%&etKF%;b>sJ2;Ez%7doA$X zwO0d_-cOjRu+}$9gj8TPmB~|};X~LtvGRKX(;7_Pix5w7YS8^bO5X%!~PCumFQ#k>2R?*-BU z;Rb#8%zxxtQNG=Ao=yOg=IM~P6<<|c?sm`mR&Y+JvDxPB_cpnFGtlPh6w}sWF>5Vk zjQc`FFk6UKolU7{qq^+%YG=gjl~cE$dFGkBIQ757A|IPR`e%5Hy9OtZe(Ka8&il&r zseSY+ladv_&qb}y_yh8X0Dd#4=FJ2YXn#^HG{;1$rAz!NOFuez>5fD2ct{?fKqI;8 z_dcRoIRYa(2DiSbIm{TO5;h7A;+PS249AQpXQbkCJ~+Oa**w_Bsip04BQY<@Vs1G$ zo1a!$Gpe*ab@l*qb`tjYFn&)H=S*e1DOy$55<8C%M~kbysJy8#A*0}h`rflIQj-Qn zIm~)hG`=Ge`+H^0*`<^z65Tp=aC9yXa2%JF=^p!3MK+eV^d??^z$-x1`KJW6HqPO^@lPxb6My5Q-F-O0Zk7#Ur#Tp>p<&lhm7%h=c)H*kcU8lUM8dm9IOQ{$*DA4v1j+!v@Ejc>4BC#&lg(hk_bn^P$2yTW z(bV3TJtlz;!nl$#`PQc(K+l`*poz1ou%w_12=6g*yYRLAKCYG)n;ONWx>&?&svs4; zkYj%1;2nBjaFlAfchP7~S0JJGgN8(WB4FucNIP|W;U@C9w z2Dq?&S)B6Eo66gcG7G(}hzG()x-4z@$a{vuni_ThIzw0ny_O?`R_4f{{7CTuYXcb+ ze^kV1C`0UFzz#CR?$w9QKuU&~P+qvl6H#!oQm;gw0;yL@*-$<~Vh-2~*M0BD;ks+& z$=1!u5WALYp#W6kS3KLOu>rhGN^|iD9iJ1;4;>dXu*}9$(or_Q;t*Q!^{_=77?_`C z(GRUfZS#mG4VA1aYjWyOKpF(0+|iW4j%cP5LlKkQ7~&?Qpp!hY|9PVWdtB1QZhPx3 zHU5f#vf`+D0!l?!&BUqbs_LnqNtN7E;jU)mf(*x*zV>x`&nB=KBmFWNX)8W*Mk>G6 z6L11Ov!y|*mHUGn(Mt_<5&2{e^&eUC+{m&woM~|y^(uiUn<8lf5a%oq$J$fF#Ji?h zi$V(VR(6bzfFsJG4~f0>2X4=w^8@WgO0ZO=i)!~JabkUnk8Vq<_wDMR+o$$ptCGST z6T1klNex;Y!~l~fC_ld=HjE(T`SNgc&ITqkq+ka@a7 zI?|xOQqR^`L+fNVC43UP12dxCIw?Tu4%W#52We9cRLWT=*~|**(YUYVm-bgrf8~pL zJ*C3k9QIq?cE1>G$}LT@jrH1@+>7!^qnxQXJ&so0neR#%ZRYI}3Y5&B_P4K$FYLQ| z2Gf?NrEq!4O6#{8$yqSdj-YK%%to@HOQFupy+`7(>PiDPy~ubz+pQHL2VE^jzn0GYQ&4qQi5;uPD9A3@g7F8Uzdusm8} zW;x4a6E95n;*nUI=_-pRzOg$CmE~IQ?o+$To5YlCNlvDPNGz!lF~CK8oGIi)Vx`P7 zJ{O^o%%-MoXk_{YR~LDd`q6key^%B&Uvv}YSTD!&kW$G^KDtP1y~w_kW?x*nlV(5M zkvoP$GX^I-hJOTQ7K@?X5w5-4C=*|lG2kuU1AL2P>aYCBwc$}IzQZv!W{pp;D8o+T zQjx^Q)jjPxaYxGJ0R@h%rQVGq;hT~hz<|BEGs924y|-L<%6OZR_gOn-H1)irU-Z=n z$f>})MbkdT&IYjyw;Re3qS}fCY34Q4vw=UED0sv>E3cRyB$>SRTx!G@$xEtV!$Sx2 zlGo6XXFF<0?hoL)7t_$=Ae!qYI!*2KicvvK5{P2y);$9(U3jfvNyL_5N%o}wg{8Jw zSVPH6(V8u?PvN$EUV$K2#ZSUBCIZh%oc=Pso3yB?+w9eVBW`9jz*IAfVW!%R=PXlg z?ZH#Pkny({cz+Z9$gjNwh8M0qjpuCb$?}w2dkN9WtOPVmt0S`fcWby@=cM^UPPxvP z>iv{sIeXnjNm|ru#=Z)16NY|Pjxf3{M;PhYUnBA&t-SP-P?<<$r803<2aPs6xsCpb z=PXK6@)Sh9w9$*19mpJzw6Q+#$)l(U`snDRkf1&m=%epA@;+ZLg?*QRw^1M4yBxgL z`oVA1xSX}Ux%xryp^tyjM_K9eXrK~G^BVY|*SKjGR3`ct* zJMpuAiNp$yv96AI-utqs-S;x}HG+o$Nz6eO`+J$Qu{-6=rhbguaq9^{Eol~O^4Lo; zZUXPM5PoLH(ruFL#7~0MbRaMBGQTWRUfybM+O)sWu*sAv)3VO=+jwJ2FczF)wbbx+ zs$38Eq<-JS`Q_aj3|hfDfiqMTCGu3e*q}qd?9Mff0Xht{^PX39uo5Ov+B;FOV)oI> zGZvaAdJQi!KELZvw*J2B4$JrTJ=MlPgnZ>HvrWfq-GSoMjP0viiDVy9%Ud8&+VkE2 zV;i^0=7?Z!u6jwDi2XOvsGo6A-`d-}&v8wey+wsnb~Ch&4hl&K5%GgvV#Q+mT|?zu zpuF1QMV-WPke(byawLC~s~1RL=+|nqTGQ1#{a-N1d4fvZBU~!M zkIZ4ikxPvclaTHt8zDGv%yW!vwKH9aLH5cN%U^%5OiyaTyv3(%aF=<7{57y5A9Tx% zL-nlYn9_Yr2nng-)b|D*3qZcjb;oL{{|SuMs9x-GK8GnTPo2@X&^Qey9udgOp5>&( z6{@$u>81H_-o9^>3AozpOPyR~wygD2e(f+%F3%a}@2TPadbOZeF~k51yyNU5JM_Zb zMfSzt!;9=9BHG>`vC(bFO=v83C8B-eSplfJ5v?lKvy&ur?|S4p2+hnHrcmLxXr|FO zSLF}Gb9tXPvN?f3oW)G5N->omxqTxiJMDa1yEeTfui7P6&W4@Y#7faG$c+@;E2Wv} zxrvpHyw6FjT*Zt0#LByPr>T>3P3cf#a}z5?zw02eaK5 z;z!<0bxtMYUY4bxds`-s$gKr!c~zJX;gwPv6zO24^k&KBLfEn}@A>82XYV4aDA0fC zfV`gUl)UbKNpL0-WtS0)<10u3Ktkk<2k!Bih!yOZX?zw;F1JMEv)z22>AQ(B%%y>g4 z9+y?!#5o~ZN#1d=?!}UsC46x9V9N*39bti#MVciMTA zCp^JGX}$`7$-LA%J8x5{Xlx`qZ&JeRONEZ-Z3Tij54k@l&mpe9Jy!F_G@}cnx!uCx zTIOK)d50+m2_3{|na8+U*!vQfio&d!f*e#bP6+ZR3=C!~X`wdJGugO6ASapCsaVyZ zU+}98qJY;2H{0SPEUtczAV!uu$&=UesX-1@6}vjUmhqBbBo*Xqr zgfp6HP)`O57bmPEZDc0@2&|e=kV#mTCK3JevC`e*9U#z%cCOlj#)?Sv5%G{&RHm?5 zPm3Q&O5P@dc>PkruFMMd;vFi?eJXMiuhX1QNlv^;o&wvbm?y7_3Ua+&%S;)PlU(qU zd47H`Uw?EGH_?N2a+E1NH+APx03+^|tfLvxvY(=6-ozips?xbmQYLq8I8T1pWZy}z z%x`85$y`}3C+6p&u#&7=m4m1|26c$2OW}y#yvB9_UJsYvs@r6JMKBLTXYvsUyc@NWTrOd#S1MLdE2LkXu zTHJ0rM+;&66hJ6#wlZhprjAjto#a)Z-Ft+ZA=&T5PYJW44&?uE$i#p!zz5+0;k7k1 zWSBcAnuMAAC+mIDvm^JzYkct6xP|cj6LeHQgwHLZ;oWFBzNi4?u%=(;O;$2EiGMS| z?3(^ao&w{(m?y7ZE6A1@KR?6U3+(z*>bH3-kzKwAv&OQSWwDX|4&RA`^LF=MyU4dr zK*ZVG$03WzXxUBD-_Fxq~)nV@-%m)f;bVM;72E2xkX-g+DOe4C0uB3gz3de9+RPc z1;ZDv{rpca;5qQlrdqBI?0xi(tnC~#IQn?58GH#-1=~%`mZE_v>?CLK>}^z^SsjoR z#Ez?S7Wa;Lzk%$+rqfWtTff}Fh-aM={$9`QuhqK_*N}~U@-gml`GjH^_j2A5HfCUgt&=ciLaKs7HGu`JUOYRp*);9lMZr8Y&NnoB zPhdPK&F=LU!4LN{dyYfjp20Z|YoE+-!Mh7CsOzE!ZRA2}XOt-xFwaD>4HS*$V--Fp zc>?R-Yol2o<)$hXXN3E!gmEX5_=z^<(g7i zIi;nJrc}TL{r*nO>CZ_nl8!DA_$*8G3+|a$uv!WZq@acdpJ0`D7#d`FGoUqsShMwy zMrJaPqoAW>i;ANh;M4iO2m-rPY=n^5mehe-r3I&cN^1_A&~*Nfp>jWr*uT*`7*!yo z1%$Y02O7WvR^3P{W!j0>7Vd~u|77;8By1P&EuhS$CvP^de0euYR{e3gBoTEM6Fj0& zKnW|+Wz;13uGlu?fNsA z8Sj638I8faRX*88of+hR8ZMuH&8I*`8N-{dQ>!*&!K%S1SCdZIlxa@|X{LNCwzWq4pC-zu8~G$taDsVzDK{rHH1Yl--dnZO ziH~b1V{*?tIe_mz$WFY6JXu@R?(*tQYsU4>M4?=sAYHWmuXc?guFU%%M=EBpwB*rA zek9E2RV)QlgDH^|NStE*cF?t9}mdq9R`IsFx=o-=x%?o*8i8V5H zr_~hBAvv&5bnEAKM{1ON!r5KU;qLCqqicFU#HRiJ^@kUu$XlqS zu{HA}yfj(5k`VL0YNF>XfzP%X^uAGIr+o{o&D#ag^CKv+`!Wl~dITg#>D|*e+6CO26IA(#x|ZnMD1SLs^+Nf?QL2S?kA5Ac z%pBg!Klv?6>THf4WYtNPVriJa``L~z1O|ET$8%~#j9+(9A@lUZpv_&eKwDvBqcfBH z-=!(eh1Qcdqa3vU?A=ebrMezgP{(#Tkf$yBRS!mDO99|SVL5CY3I{endvxjYN zqnJHx^HXUt6_<*(ew8~+58I5U?C??(IE|HaP)ojwF8#Jk@{?N*q=Kr>HLnxaB#)=; zS(#A$mLoT8?JB^;j^Gxz*lzu~Vr5gN7$7U$_c=>e(Cw}YPHe3R`qXn}U&tP&dB;?N zR?n5aQqPsWq~)<_Q(<4pk%+p#=v(AT4rS=1*>^ZP&OcpO@6XE~Li>5>)3uM})cRZK z(^et%Y^{aaPc89FXOy2&l|DNnn`fiy=i!+ z|4FDdLa*gQ)>E8mZ&IphL_e(~rb1iYNyj*e6DZ!lv94y1Z|iD$v|j3t*b_!m0I48W zoMd;xC$LQV*Xymi#4}Yxj&bTIW6m1DXB;`Yz?_o`RHBo46|^ky*NyH`?476&b-b77 zVcror&vo9uInP+aInO;knG%bybnp2i-BpVz&{kg38hIu1W(6UFF@X4| z;-8hq+je#8f5W)AF5~^FJ6?F(khpXy`n}dF|dKXSe{k9IWYZ@_3 zx^d<=yW>fkdL0C(MifPxMhucgA8)i%}W%-;V*!n-4i zIq0}&mAgS!4ksN~u!=TUyUpbbfpbdBq2!NOqzmgtx^L++EHC+dWTdeovT|hEs;Dz& zWhLsF+$SYeI?|aRjc}OG=Y}RH?VD_z{N7MS(lc7QWsSB^L}0h_x^3)iyAf0>fh#SK zig@MU%K7~1>u4}$=yM2!CmXc5^Q>GsyI_``Z0ujVzEpPEF)sHDPfmOE^Uc$}-3qr! zS#HTzrt^)m?ar8&LbF*avuV~%{U+K@u4Xp3DWJ=>TFWbfw<^ff>~@utv1Jjm=AN?| z1q0nHkJi_`ipt#`&j|Ltudw6Ny+K#AMVC)cAd3Siz6i!fTz0r1tJNo~X;cSc>kPsc z8ic(laIoOG&&^5viMHK|h2HJ_mG@EiIY=!6LLxci7y7HaF>;lYydJD@+d-F>H>Eu9 zE^`w7fm3iuDWOpB=aez)Eb6ZEM)M@}(nl6U9lH;cz4@giUbZ>5S2R@?S?NwZI$G8m zb%rw_a=VvxNy3VSOEqM6i2nCa@3XJN`wPHhms~t@CaRCelie%1hH3?v1;rMZ-m^LN z|1bEQ^vf*qEwRKGXJ18v8;RQ7-Mt$AK)78<<51XRKT1ykxf~?dpA<00wvw?iJ;S*QEp z;V!aFynj53S;~6QZ|}+PxDd=NWI6T-o`Gm z9`X^M;?3g4mJxfHH%j&?Q(U{5!f$qBym1qpK2^9(xP4+@d6ynPAetUMOqB+a?ak4e zX0b5F4{{o~{jN>87TnND%DI1fK;v+JxL1}|MqcwykA7Z)8sbkRTu zC=BTUU(#ZZ4iFa|;3*(%rvrR*gVh002MSVMV2SAW^q!7B5#NRma1Us1>-*w4KNZad zd1U2(7W`y6vzA4w>M{()8_H|s6`ZZubM$u|P#OK8P3Gwk|GCa1sU!4U+3!HhFKpsvDwPnlcEn~^P%FUocxWtMTcP-;?P zReDrm`mE;o_FYvD|I3J#7Yr+W$Ctyq#&;lwuLa@Ce<3VL%$tJ{pnXNSott<;Z% z?A~gGn4x#%MTPsO!HbpuqN;FfN9sme9$uK9r0b_%(peA_9~s=NGPqeg!^m5s`6c?% zvIyN`#feWp{(Qz;k+MfHY>2psc}5tIDNJ?qdh;sa@9`T8k-MidT$Qk1$V%VJ zSX60CJ_*4ppYz(NVCjE=aH5v=mVV(c0AA4Yl6|(!+ezHTYhgZAY+3!*JbMJUXhrzcmV9@J0 zb3I4Lyq)3Y>zLg4Ar6ChhE?BQZb5g#pybxQcpK_R4}L6`b=0Z)f$PAk9~%Hl)DJFw zHuPHr9Tjy*M<;ZocKpoL``+{u2WuVB4|;|ro(K)1Y-|@{fdD;0W&+fEy%)j2t09;1UfdI^hMc^o^iVs+%vw5Hm@4p2pw}#Y4Q&Gt&TSmDB65E{2iLP( z4oAUr)dJb!@;XoSms{B{wvUQ`L6oI`2B@*bAj^=KA>QEYcS_J?9L)*K+H&tbe|4G|GczKFatO`=c; zHju)JrcxCUN4+vX5cT>(NdQG4kOVk$CR#_m&NwgT-kH&PT^${HDUcRu02K>}yi^|J zj$CZZOSkQHGwp)_EOpTFI}g2i{7~3jU!Ca+cr!qbJs)-fuH!PMPF2?{Zjg%#z_v@)~zJFou$iZ#ynT&Idla@r~RG zV|{ro*FGC-GHRTg{I)g*f7U)qjpG|u?+#p@R^!Z^B8rh-2R+(f%e3gn^efffe%>MD zv_DPPpd0mWPq-$}X@=uu%1tK;^+a#Ll~Unklv|?3@l~z~`W0WZl{mpmb@Np<^ar{1 zr$|qXL}CIE)vXUnC%Ee53@yqy9cXCI2u{E44tAusr|(S>6#QbjG?aS9t_@rS5#5!F ziq#{gW3+5sm)G$&pRLvXRx!Gq{72{2*Ya?3ZN_N=|T5GvASxykt1}1VfpXdZxB%EnpvDBv3>;1|n}i6-AM+Sxv0*nd{x~ znBYCo9qqKgw9y}X*qObrV2;1^C^z_MvAt41HRN9(8+5fEt0lTzU-1Q9a0Q5!YmSt~ zYy137aA3w(Z|#wq$!uHd5+V9eMt}8hgF>KXfnJ8HelH* zO1TIqP0!L|b6yD!g2PhJ%eYU>P~#33*nF9ESb%gPIfH*XAR{?l783h5h;$K-VhC{K zNc|+8-2QRqkY+G-{I{pg-S^9&PM5!#vVQ$ZQtvxIC z$94{eK9swywt2?+j8pbaUT>>OR2N;Zb_rha-AAO=!a!F~0;=NJ%bXwQM^+mlGr2uD z@_j{bw->upRdtoejn6swB9z896itK&wMy+v-!NSaJ`BX+RKx?VEB(~({JT|+_My%> z8B%NuRMnXey6enwQ2u@#Am{u|jQHNS(ZiJ@G+JqCkstHx3xDBUm@6SG_%684*3WF$ zFHxe-nvxDkZxDve7I_%a(}U##i|GQ=Q%kk@P*$;=PTV&{Sw;#^BU%cP&E-m z2h|xPk)1kK$dOQSp(B7?1yBrUY60(km_XZS_muwBEG$Vr49>O4ef%qsIAT2-IgY85 zB(h#`6nra>p2Yk(1L4WOm^n-TtcFRkDbDEEz{-l6uY9aCKEvj4h2c|0Xd6zIc~&%( zUGE5-U!yH<)t5Tc|M`rMb?v2tx-qy|p|Jcw__$_lnR7;}O4<*n^1~;z*~Em56pQMA zc|QNB_^h9bAFp#Qi*9~k2cs^`P9HRtj_9u0smwR}#4YV#NI~b?+bC?`-_}lCieGug zaQaQx%h$6`ZdD73ES4)}cEj#v#&WbErz^sVG?rT=Qbv3hbtd3^O`{>#SW z;4*u{O!z4hQLTH%)fvs6u|DJNjN}vkjA-0<>waT&y>Radx-or*Xu_2z=+w^ggXh4)m6bW&==H{EoB8#BbH0f=zERuyD}veWr#n` z?+_Ny#;z$VkGE%Z9KUC5ow2rks3m^$g$C-@jpu%u`n2S$(T;TlYGx0WA@*m8lN;3dN;-@$Jr2fD(qVjAe5J=%k{O@E zZU_8+2R_vx{l=4OkTzD;5YvcVu!#Qs)8S64I1RU_519%&4f%BRnyP6q?3q1GhJU`o zu;c$4zhixkdkDl+b7uM;!*?WXk?{NXgx@RC9-+x^KBOzUCZ3ToHZC!Z@_o)Y6khLF zRE~65XWj*o`x@WsJ;{G%u_AK0BKkH~fp4Ykx^;fzm>wGo{eJ;jc-r38&04BX-@NB9 zJ(#|quhV?Y$kXA^ilVLNf;dpr7QO=gu;4@=l3#?myZP14UoRq47ilRr@gBeNf&yq_ z#CTGnU+()xNh_P)v~PrPnVJcbY29+BY%bVyVYFW?bqQ1FS=9A}xIdRN4DGP~Cv>W) zbi*%_K$fj5NQ7I`uZi%w^b_Z!i4jv8LL(9DM$CA54!_11x)FYve2(20$xkADkRPcg z5iaD%e#%cjksTr{KATU&@$tM0KMcuhA}lj6?{^9#doT)e4YqWQ#>gLgx1irdCl{-e~ zaL9d%VBt>d&l~~hMs0gD`D}Ot7iHRM&dVX|^fog}76y;#yt};hwmXumpExdh4p|z$ zSv4O1D=YF>YR}=e-rH-7-^ObD3P3#;68x%7?kXMxbAnH+nhVcGPB+#D9*{$ITmICI zr1qed@nY0Y&85Pssh?4nT{bI)r2 zckI>mSdc|nZSJjJH8QiinyW`fqEjLYD0@&N+u2=Ryn9YFviqryIUO?X2 za|PErX5}3sj1>jyl)STujKFYqcUAmVAnEWkn7=aq2Ju(IUon40{Pp9nkiS0s<@48* zKR17Q2u2y1sC%m7zb_BLAk*6k>Gwa8hxC6c53yfW!nV)&TE_UUh($`~_M2U}H@?o) z^Zli7i-87o!Wn>?qN%KWs87_HBo4juOG&C-5^f-QN8gf z_suj-AMY~~zS3=S_3T0xXgge&P}g;_o-6o)oc8O^V?IOIeYB5OvA4YsDy>(|Q2*EB zuGL8fR`e9hd$vLK4KT|NAzy7oxjsNQ@`|msA1XShbuA(aR63ycrheI#%670&TbQJI zUu^Kt^w?6V$$IKS-c6aRGit27kEy`ySu6=6qC1cI4H=?dUq{L^`M`Gx_jSm)xezmL zqEM3^m#WzL4%ej=TNP9+Ux|)Hs_gik993ih=rfM^O1W054bUIZj2*JyGX(VB4)BT% z{uPEh`jMT!(%pKxfv)V^eC8~>f$5BI4m0QwJMLAgZ!?kd2_K-ov&YKk>I}g8rTZJU z8=OKZsg{chHd;R-Dfty`E0HxB;;Dl?!~M;R6xt5zmkg(+TP7$}GjR)5KlO>%k$R>s z76YRjnb5%lhmnao$h%6mnfrYiICfud-P92@>+5+I@X9-=>wd^_b^zfYgU$z{{(xTlOBRCtYe zc+U|}c%3`C-lKWr1|`{WDAr-i>oi>f_4U*Z?jVKd&u#9YYqWkf40dFO1!B?)faU^J zf(-mRJD)Q8BM-b>De_dmlxX2KuhvoQnD;S|?f%OB(&)kht!fOPXStH~_bgsbWdSEiO9uolF=)v*SN!@UJjsJJjYwWSdlew;Vb-Ib* zPTd^s)>e8%6+cW5&#ZB1kv-CCY{??^GiQSJGKyU3z>AUqSQNoz#C$X!_P!v=k@aYI z>N(vU@Aj9b^u`mg^QsT{#$lb$*(_rqh)iIm9_#r_Nrbv(cNeRo%gRik%{nqbh8tZZ zx#o;~>uy=@6xG^^YIdSsQYgo;V1}M8ouBLl^>?JdUrIGz69AcK2@I2Qq43Q9iztEg zYyM8vFD)`qrj7xiT}oAJi~xoss9jZ(sbCHjWWGnfNKcRxTncW}RO^U+|43(7RSKOw zy@(R%s47%JY|7-9%b`2&x9DHmTjfMseUaJ^bE!Fius@a)TAj0+?q-v97)-R1YF@Oi z#R%XPDZ+uF@B_lg&D+a+>sn`^EcEdyW*DSBBOk)evWY3s28_27?PGnuwm?*rYR(@5 zj1y>KvD6oPb&>j+Il=0}QG!sa99-M{)TY(d4fasFFckDL!DL3mtwnDG^D0w>q)!f` zlJD5#$PGdmwx@HUw%`-$rN3I_FVdnpMYq`x^RK=n^f6B7^)MSXJVwC)!vo~=*f=1a zZ*~FB9rz>Tf)V*;_!lyKK4|BVRLB|h41QpIhA_-+)(>Q=s zSh@`)m4Kf1_9}%1PbrfQYhj;s3vGW=EZ1y0RhG_fGe@Lg)*;=N+E0+ z(s<0$n~l$_4%ztJo55#rK^B+ilGmvhk;h~#SzJn-RfS9YAmqQs<@J0nNKC_L2GlyG z#>SjYu=!k<2G+osFepGRh&!&$KTmy_T5I!3ng2JchK0K;!dFD!j(xsTB8Z@#it?>H z-~S(?zNl?ahL3c@dw+#Z@Gb^m{|wKuf57u58_&$pnxyC)h1+yk?>)D$^&Tg?maR(5 zBReGtF833lj9LymSl!ryJX>e}t$2}O+W6dO-caN-N0#WN>ulK~j#Q^T(ImOt$2+eZ zpCaS;5#jF1Th&Wj53FpsqVO!~0>sy0rcCfckw zexBox4r>p2UDVp-Jgm*h!_Y0x*Y8cYu8ZYGC10Y-l{TYBqmXl*ukvW%La&+Q zGYC_BA!uO7NlnP-7p^>E6WY*8Rj%OBwrD3^EpjNNn4bh4Q4 z3j9nDxAh=Ffn`nx9G7^6MRNnR;S~Sy|9S!r3Ec9aYhZ|Ek?7xK+=8U zTLJef#Y2JnF(u&8o043)(WebZRd@`%zO6lZJD5c9mutcPK(;6RO%HGER!}@ON7#WN z7j%s5jNDtuGu{#0Hhz)gjrCDG3{acb#YU_`aXi0r+w}cjV>35POO$AoO$8w6khgM^ z7U@s3=1>E{Z#O!AZDB8Ye=N@vKH)TGvay)_!0JTX!>2g@Elp|4oMHh5(AyJ)gR_23*A+;V9#TvNZ)QtWoexk zoQipderSXB%abSD(umQGwNSe(U|cOJ^pF&rbkiyPJ$fxvlzNr#7J;ohddG|jeI zt3R_@?h~G@oRA^tHtY9fdSr8{NI+l^IZ2HSu831<7SIDW1hmK+Y2IWv$Y4Vs9q}0q zxxR$ILI9FX@R2>g89e;*CZMK8EWQC^?8R_^>*^zFvw|G%2RzsKV46OohI$;#;CMkD|zRzfwt^*w2t=DPy${8pQOa4Y+tWs!yZPb!l&Rn-=P~O&YSmu$ zJpie!Emk^;U>KqdE^o80lh0@zdJL4OXH(5sVlWg=>u(Y0C;H;VEPEN2kUSU!{>I{Xey#wy<5q0EWPz5 z{1qBKL^)`~84&2QzNg;Lytm^w&Aib+D*;K`N&O-X@0-o83|l7uSV)+g1k$+7?2Msl znnI+INiRa5NC5Wg|HF6x%hmt3)!F)H)TA&lcXZgFpr|psa~*pAG*{)rC()RhPYdO9 zyDM_tO_=N~IH4r!#q#4~)${AvBt8%%Tf$&PhI zC?%XqO)o|FZS`fT4^FF3pSXcF`3Zkz^VIKo!ZS{G_r>&+!820>GW1D5!j;_v8cgw# zL$SP}nRE5hbv|@XT$SA>Dub+iYj3KJ!z@E?4*rcG((e34bfmS}9UL0^1apA=;P-S? zGFa^7$R5oY3&ha^8TU=FmqUB}m&kIyKc^kPI5SmFDVlywYqK+0ii}q@u0p&fQko( z98ns4K9|ABAPQs<<|s9e(iS=$BEvzVyFF3OyH4=Y&2es(D%@+7KJkWpGY3P>@j{U! zgd%~-yhT!xqDZ!4LXE6OiXzP^z>5EcAg9z|DfJ^>%j0N#GW+57uk%y8p+D*k4hy~I z>`yjl`-5Y zW8f?%GxO*-`lf#}t9oF4pDF$w+o{g`wRFwQFIiVJN*uQ}T)GmQf%apyb=3wc1#1^H z=M~aF(dzHy$Qo^X;*R99-=1jKKS-vWC1&v#Z4Kt>oEq!SQ%c<27xx*5C)a9U#O0s$ z^3P`ZXP0gq)j9B*yVq7g9eYP}I5;WhxNWjm3pnH-JzxH#*-=&lmf`f?gj=uf*82s>*82s>-a zC?8lYLvKM<`TtTazRJ~sTB+oJJqo|}r=9d`v+is`A)dkK|4G#ys-3JoxDm_`6r@kq zCal-1$>nCed);qKXCs^(gfxAu?I?*25K3NMi^0#xcwrw4MTjb2;TwGq-^zs({ zf^}L%4EJ1UOe7Kjt{k)7SJgOo7(67M}T%A*9DA3Dgj1^fm4)@^{-T zAH@CLHZa^Wf43$P!5?9YP~sE*KIHFns#zn&w(#c`J`9AJv z8S`PeaY2(Bh#JrefkFA{`fw$GW3zJ*DN)wxf3Pnxjsl{%OiPefLbt!>cS1g$Nb+}( zm+>HHn*iu5Ug`mo!tp^8-y`ub?}A?51B7!Jtc101%=>FaN@k)XaS~O%)!jr!?~64B2PtCS1l}l zLYNP#x+J(A#p+7;P;&Zv9%b^YaT)E86vx`eIdAQ_b0`n)$stRfF0gueXmK zF4b(4t+sM{tNi4VE_KE_PHlB#P_fuJ6mdvdTtp`iYqRr;Cu{e|8zyUWpli`Sv;+^! z2Kay;y90Bs;#?UD<0lk465|dX_=(GErG=LK-J;;9+*RFG*^;rH-~ep!1UUfrV?Urp zTbL_#vD=FgslU+0Du#E5zcj%;+pX8f@&@QeRWUjS{m5>A=_D-AN^vhgCXP02+))6? zVZZa8RFUGZ!Yk213JP9aQ&Fl#MJ0=by`Ac(pPocS+aTRa-ax@j`UWkcu6~kq ziO_GSa~P~psv7o}?(tXdxjt4k03FI2qPX}=xvnqnRG7>w2FKs8Gd}el*?mJSufqNw zYuLWpVt;=C=zj}jtq;zCg1+Z>w)!gHpNc>E85JlL_6G0tJ5Rw|vvUwv)}Ck7R`hfS zYh_$|<&H-_8y)L;Zk_W>U-(2@;6iXwUQ=;(@S5`VsouofSRBw`&`GCf=-_V1$(5V9 zwguh7@6-Ishdr@#gWOgXz8APBf1FPD=W{?`>!p#ZP4Lf;4%~Kv99qV_IzjBwhU>zy;EeoBwg{)VK@2sA72|gA>sJH6u znu^C=+=?asW0?_g{$+Cvt|VAJed}qACm{pM%G2rk2Ki&&Y6o7}ee%5(XeG7zH+8Bo z&4P|eh3_hDUpRr^EjF^K{V0vUF9C~ecFgPC;m)Cy6Sf(>D9Es zicqe=p-(Si6eLxL?`Fjl+nR$Iki|Cp3_uA(* zrVhw+9k>lUf|B;vTuLD%32{HEm^r#0LmfEKNNn236|zCd`nTWHJKlpII5bmwv1*@U7JR%IpC zDI6v8Q!H6&R`H{btU@kHhW?UW_!OWNIFkJY1zC31kX2jT2k@Am8z-z6dSZkfyN6}_ z8>cp3^v@D_?BO?19zsAym!&;rxnqGFnCWr0zqJe9fJ7O1i#>L2WPM<;B-CmvH`P|| z3+}EP)@9mtp3n?JBaZMitGi7)mJTAM%Q+jq5kbvoUSrK{qSZtf8l)2sAm4Rpl5)QA z0cYyj_5r1f>WNzUqGNHpUL`MaY$(>39^i`fbPO=@Ih56dzvt&}qa3h-om+|V=R&pKK-rznN>=1jfm&sr| z6%B6Xd%u%0ZMMgRYm68Zhos|bTz_UiiH1J;+_NV#^Gy#Q&t-m0yBkxgub^uTyV(Ny zc}C^WmZuS3k#Kf^2Ma#y6e246*<*)?bGidvBa3o9QLfJI%g8f*sMKkc2e6<&o@+du z7vvxJVR{05k%Usa+N)~_UyI89Y`9IBia0M&Pi~$rR8Kv5DpgPUJYBAy`tT(2QNnWy zc^amk`tju9Ny+B1Q3!&g^VL>en?{=KH@;ZUP9|29uSMmEYqB=YP5LI%H)qm4c6vVP z5X~36GU=sudLijsGHC^NnyNdK=Il^!CQbD4w596Iq{%rbX`Sj@Yo~Rp@2_^6>SyNL zUw%t{#y`{-d{p))3f@|YLn}dLUQ%DAl}ssPbH@H_CmWHSz+@VGr)~E5YXa;&r;U$i z2I(sc4km$}ialuG!5{+lwDEg7B*3z!u@%b}$W1-fpbiDV#Go|6Zq;~RUk91*Mu%{?yhHK(10Fcgxh*I|!UnFu70 zBtk5O#?b(#pz#-Zw6Da(O8c&oy68t*L@39n?3cxziI`4h!AsbwVAhJ0*|#_%EaAvj zTYOj?$J(~04B7e&5Sij0>EXiLiwE#LMxOZ{FW?dpf=jsBA(2wAQh1mmMI@_6vWn$N zm#2H=X@cqs?PF)8oFU#6XNZ1jXNcX_mGnV23uRQKHb5*Y9lRha#6^N81I0DUzb&Ra z+qR&w%g1#Y%aCbqJ}UwgZB$W|TrDfn+;0|Ld7aqour?IzJBc0LT_x(Y#`DIayz3mv zofK+-zbyOn`}desjXNS==YPI+bsQpd}4KU@7hum|%U`5stGQSl#~tE3vk~wXyo+aM@{B<7=Qr z|0sy8q;r8g&9hLv-71)wAeV7#(GMjL!tAut5ijASe7*scG~=ldxFzlKhNGJRNIoD% z5Y%~nR47+;u9w;#LTZhHj1DVVeTC5qsw4n}y*{QZ;=R41WfxzG>G{9V%*rC3R#oti zwHnWFUwC7ipDkl_1Lf5{wZ6G06;TY4{WMNGh1QAPa>5F{#s0KV-418hcXzhF?NZ-V z>hr8ngmWLYW#k{vn5Az(A8EDnnh^8^t_if##sb*yJIO=nKxUYlGWKzBdM*p9YwQV~ zZ~o*(ft}!g3{%N0^qUjy8Gg1R1KIh1`-}oz{g8hi<;cR?;c`MU2$WEPcudi(nqbg| zkcbdQiJDk#TNEv5QCR^59L!@oC|FH%P6orX!0@C06uCAZX5ROsb)oJeYaCq=Oc!PP z(V-8tmFWXMFsdWy1M$kA-HkCrl1ssiKKFz|@x?Os z{vXP`pID+OXj#r+=wvdbS02sM$dWfuN+da(4PC*44|2r>U3*@bc6+il;m4(w8KhFnV3ne2W(_d5@8LT#PNx>Xl@d;weqsN-Dk7p7tD zqM)$ScBD&x1nE=ozro{IAYLXWEL%M2*MM&s>K=dT0nd@R;tUTETQ@M!gEv-is0VJ# zlXF@@ngZG#UDYg~yG8*aV+h~Dua<+qmv2th zavpOk7fo+&V5I4Pu4i;T`)j$@7c0X+m6`V>q%cHkpomLMto%<>&3ci)PGP7sybI^P z#s;sMw*aCEiam-tYE*Liy4B_J$qlQQ0(r-3k=|tx4)bhw3v{HQ@=&mAs&_->A>75o z@jNr1W#`ag3U(Zh(l2AJrmQOFe)dx#3A0dKKviYbCqAu3%IzKXD0rMi8dNl*gy(yt zX?`cjuNW^+QS@p44L1XGPjaZqIs-3yQjHZzncXn;ivBG9S|oOEdP3kRGQqQr z#>NZYtBJG*s$x@)LmtxxD>32)DL!|Npb0HiX5klK`z(nX?k;_ZW_gTK8KxzP)PJV;eK0u$lnjuqr%$pAj(KyP?cgp)k0NMd_*2qsKnbldI7x{` ziW^kVz!<_sLPnJrC}Hecf0g~XLS&vf zd~EZT_m#SqdAxKzMKo7-KjT?CjD&F8FoP&>qvFd7__u9OzmW-TwGf*}H~Swex(GC^#Z)rbGj&CpPhf?L7Z}RXt<%re zOHmYl;g3x^3*F`?R<}{277f&ixj#$;ZQ88f)}%kCl_JdnzdtqscSw38=)DKEIVO{z zT91qbGH}ET{Kl22pfc1crV)%Y9lB5XPy3A_chM&brFNhr+uE`JW0%)_a6f9CWukgf zKD2hc5#>2+aJcl@J>nrgJwBA1^WJ}P_aD0Hctz!d58`S_X#rFJN)4wAugK0T($M_vim16oN*) zO}^N;9KYs0)TQ8`3u$Gpc9jIK-p zX*m49V_nJ_hSU;iq87g~3=3GlQT^%p7s%tbehwp_OZaG886k0ws0rBELbni@f6U zxK&p#P|wjKvW$g~=4z4OsR!_IEe{wihpQJ+rQrB3`Q<;|tR5+?nEfB(2hI!)&1mO0 zn1GFN6AESed6<7fnDDP$==zjZ?iIS$B4UQFo4Kr2!A%XxH{lJetBg#=1=Uuzg!h*b zSx%cTQTAA0TwnITNIEjiRcN<*jCTY?8s-?lDEL=ib))*`lLPs2`PEzhI^L}MBcMTS zmDgCc@@N)(QhE`VlJ8ExfJ3=y92~f|l8|-LPWxvo`tlnCmyyS*ObT=H8lq0szN~0x z6jHN4HYhhKhigD(G!4?xw&Z*U0`7Y74i=L`cx8XmI@zct2t#=rzl*dbV?%y(ND)P> zrx8Z=iDO?z!K=O0>_cg8xVnw6?J{3F{LffKstdigh`_!Zo1@aWs)oMyD$b;U6o_w*f&Z;Uc`T@92Pb+l!Osfjc&g^wa z4%yJlFZ2+%GlyAqur+VGJ7__4A5~o%*i&_l7JXj6?l7Hx#JfNCuTEx^-}pPe4&l{# zvAJqOZMtBcJ)x3>%rS?2ejXDlnVC?W8C_2k-W?98cUP{z^zU^n)b13_6c9FJlMjDf zE&Opibi`hui=v~XNAbt&YzI!^k28B)-ru!Px#t=QQFZW zMHH(uuCb@wZ|Ru=QKu<(7+&-bQ|u{<{tu?uet&w3^@VcO6!WVGrdTBp5O}_-aG|U$ zy3y;3Oiv>5K#!_H!NE|3(;+df3O+rTmdznY)lYRJKh~emN9J_({r*KtmvK84s!@2} z5H?<0-dZ(CdnQiMYoBwiJ-q9*$fb;`eV#428T5HX8j#6d2b+imA`Y4YbOF-$RCwt&3aw1;qsJc8bmQLSDr;DY+K1FP0J(wfNONmSp z>=Md6h}K+1s~Cx^fHA1KU1g8yz&SF){(X6~=XdfvR_dzDgD*)7PN82~Xs)_6!{0pG zGYQ4t61C#SBBO_cu4jfKzt_Gj?5_jcg9R$KHx3^f#rE15kHX0&_26ug@IlkCk16(AHZsHzKi;os4| zGVZx21s@8^QneP@C_rD7`g zi?(1Y`NH5JlH?WgoN&EZm}YB)jv#sutS1BXGg0PiScw7J$_H z;o;v0(BFx%>23l@yz;f^GZ5~=)erJnjuI@>V&%4k>!kv_eUT;;uBXy(JocrzoFVi- z;o3!N`mu;q;UJ`bOltb^2VV`$6u2e*IK3A|j$d$*L(n1ip(^r1c0Ys?Ix1n6Uzd*C zkc%|)UNschT}#b2yVRYl1%Br!2~V_es(iAMr}R1*-L+JzVENjf{3FSH?%;E~+|Sy} zfm_>VE*`F)hCJyAFDy|)D>vdH& zJJqwTSBZMNjKVA)XE9V6WLnNgmtbs>-G|q_p^qnK+}{-jC$Y(|?BZ|?>-Ab6nvJ{! zk+K(@d+Zf*XJ6-u-MG9qHuphZyvDkFHw%+@-6wCFFYdw0ePk?>BT;9U4~V92JhIE(@w$8Cp&Ol0$Y2^!GRK=jne%!fX$zx`7VuCWZ*9yCUSq6N z^>~a8NA`Ofj}M@_qb_f0i?Mp?Bygs^v|Z^`Dt83WqMh=%w{-Kpn`LKla7l9vH`wNZ^Y;(LzZv=whWI>2LWUM?M@uMD|~ zIL6vbP0R0Q*8~8TO7I-I98TpJ+Z#^|II^D|bLmdhMcR`7m(xiP5OR8A^|@Y6Z(9Cz zvF|4WQI9k3K`VvI%A@(3JV$nt=5@wL#`5ZEG}E%z*(9|!#qz}7%~48l?k3)bcg3So zZz}_Z5bXL zlY1=HtHB$q=~`RaG`lO!VyJe|pT(sQdxtxjL^i!^OI$ysDQyYjxl^CGS-*F)z|!Yz zVTl>0%^yNZu&YG}@o+kZUl;IY(5$_*y0Q`1Xv+EKDys2c;_5}+`b1X_KSr;7{v{fd z-*BDk4ewOz#;{%&OY;$NxwGk3d&1)Re?hyZYYEk#M!|}9e?!IEyx#Os(e7GkuY8w` zZh#|LdHUd1$lzXewhwP@Wur~GyE;+sY9U)6EfP-7Gq+LbPLK6F)3ZV-2ptPF+Jr~L z^Zto@h)J)Ad4#s)&&5K)+L90Sdv^)I{m#{(teYZ|P5W(9_LRmwY=t|M@Oq}QBH?x4 zO2W0;OKY=a9JX>irHbY$t0>r8+Jqhy+U*VP-YB%YAx*o-pxwrAq1|1?8$KQTGCC0Qh}f8%V`5Si z0gRF(^t^7?x6$)<2<=@>5Kyq5AEVbc{)K`ew6#2mI(YKbEEa;Ep zuQHomS)a9gUccXgN2+d&D+66%4kL7oJS4=r(> zBNf~HQmFhASH2`nEO7CIe8a!=37#$Ve}=3Q4psxx)twBOwh(CaPEweWZIb<6Gg7wC zYDUV9Ls_C-FFg0y0M8p8rsO)LqBWI`ff4EXn0yyrpVm{+V)CNn@@m7ERt;Kh?|AdF zcygvR)=^)DLaKdz?Tc)fUSIPRat*>AA5%a711Cz5VSNB=VmZn97AEV+O{ z49N>fRqZC?aURnVX(7_dyy>y(p7b;mRykCNXXo5CA!+4z;F|0MJ=(LM>X7}aoxQO` z_V5nb3FaGLztkc7<__6TA=p@TLx=3V4%wI6*$;QfF6fZ`2chZA{K~}VQQoQIQXnvo zwt3BgS3owpAyH1TP!#mmFfKL-eTAI(Pm8<^d1L!`d2QrC@M@&Um$^uU9m_HbSihC$ zgzFFK!eV4j%^4-J3Z4^^T1;2dTLU4bz(tF?vOwU)dd`S(ld`YZIUUcaiAGiLtp0eic#Wl+F zcDJSioCt|tCO!)G5!8qFH0}1uN%V&J8=9`qy90yDNbyhAc+a7kmGj^7Ne8WoC@Sa~ zdLu1zry|sZwR-`_^y%u1X1lf?sx~`bHNg1=6#sf2)mig?CeY#xg%==|-5(jQh0-cH z(kkrX-t?=*t7q;Rj*vkz9DrP*>Ox-t1s(H4Bj1IxhO^1e}@xL%*wszvwmP3Un>0=39{ zJo=q`k$!(d)nw%#;= z5sON2pvqh>uvmGnp!0{9*?Y!vnTQ#DOMqWXcA^+y)Fgk#ys*c+T=sw~Wk+O{roUTD z=JK;7S`cZ6lw%JWwq)#i;SPhxRmbcuO4no7y6+^)^LRz7m> z!1Vs89giDRO)A(+1*(jy08?$b->r@VipG6;I13Prf%pO9HshBoOyrO~!(63ebwCTA z^L5P4WOA0tQ7q9!4q|Mq%@h4LzB@y8=Mn4I4Um{@;avmmeHeLiWK|?5ZY93PPZ1;J zdx`JRs2f9GBG4NC5Cj3BnITW{R^BRyx9qU1U*!#TNEJU?F6 z2>MsiDEW=zVxRH8k;>4QD1Cjz#Fmih;cZGr)}21%25v}W=5JcKS_>~ysSlGnja0hw z-ok_yJ`eopvDu`~Cbi34&Y2yku;ci<86R|8OFy;wThy1M)Ae<2+*3IBV^Hmo><#o` z{_j))4+Ta_)go&x=q{r)dtKN?rs8qzgYy=8d(%hyIgEH9;UApVNv@};+^a3vf?%WP z7JTMHoD)}w%IYt9)ZW%79#}ZMn{HgJEy$;B6y|;t+d{MY6|%)BgIh8IjKjJD-45z+ zte2#waP<$#2i5DzgpCx+ot*ukx0HY4QDbfLw|ru+$LegnpqSDC{W>GByA9GC0O>j{ z{0r6FdPX?T2I+={e4vHLsPsoj7oZYLaUdD;YjfLv!}b3%vC6JwMZ{m zErg?M(aox~>*wi2;ojWLtrB5n3D-vCYX$g6pC*3!E^&KMbxXCmEW6H)Nx391P3uE0 zls-kvq$OrFo*$TG+mzyCHb47%H%ZmCIxfk+1RKzew?SE z5%XT$9pUVX?(OnbGbjk#?tWiM>rl~#z^L~8_I~vFu6~@8=?4cr(vJhukAkyQKlV?% zm_8lJp&zOfbUfxQB?RD@-aQmQ=-56)eLp1~5{D);n}(n#lJnyW!Z0jAjL{RzHa(korIWVx;f$<-Fm=%(jZ-^`=+FMEJ{<)wG? zJe?5am(J#an$OxZP}S^NAp}4|_jCd}z~Gt5Zm`B|{b&WpBZ&-_FEQJ~|F9(8n3E*L zuLDUyc|gX6uzzYl#alEQ16d-v-c2w z{EQ4bTpi|}S^t>4nFUW!3Gf}jJ^_t^%=gexFy0clDBC|20f=5f0zo8n0-;vEGp#$T z#Q_nESrX-BzH-a-^|Ulk>Ow3a=80=0&wkU*bmQWSUT%3adiCbVcVq|qA%}YZvTY!i zt3tU6*Itt3KOR3xKZ=i*={m_9%&dTK<)WL-c;yY0e&UDIwM~c;&&SYgwegh=!A zBEv|^1&ZYyTWun7l$3Zj?l%f9nr)g!``5 zqG6kttf7psnS4Oj?5z+}xBxkTT8rMtL-IEM@tbcH$AJnIDmRa&1pyHdtaoRNxxoov z>1u7^QrT>nxJU@lt9MGxvAoT=Q;NtoLw9Z`D1bKaC#qESePr{MzI3epUx5y@To6?I z6=Xa#nX2?85-3(z`FG?Wp6g2gu0=*mVr&F9!6T z1p_D|u39iukzhnJN%mvcg}`$1eUSf{z#?4zeY%7aLKHDT@AxT>+Fc*0QX8ezNPz@m zV(-4`8&=k_Z}pke)ViLmgR#Qzq`<*~bb%LCfg9`seJRk+k0_@$Jl1Loi*)2pK2HJp z{I8@WZ%x1a)~<{5yB~C{>>SmaSE0lTW!k%16`5_fx0wNUYR`^Td$V0w1*_E}F1|>f z&0;~rcK(%}@<0Ach6oEcZ^%z>Q;mxFpC$!7;jG+F7#&?Za>;2m|1EJFzDgj}S@}dNdCVK^5 zZgDm z6&*n;^8A~W=x85h-@lUfKTsD*p~5NA4dNCr+6sy#j@$&N^$gGc*c1#i(JidHn#M=R z23>@yleLo|+or47tro+`L?Oa(^)uLepfsGMNRnBK83ZR^)-^7?%nZCBa4Y}Nir*=B zo%Av&E0lx{mFrfXVH`ro!+BKqz!a45q(uaOesgd!vlfBaOPb#-cz|a8mkjyj#6Z!- z`7i1J8Bb`ZWKW*D0J;u6+T9TxQs*2@vE_uM1p`GjkVvTXIZWe4~3| zpDv+CdpLq}To7Da=j_)c#VM)22yRmJuA6y?hrKRABIn@QZ(Pd;aT=}SUfn#Zo1=M@ z8%&SNXO7mB>RovEInARAF$KERvx9LO{fG0zCs!V4Q1tJ+*NfFU0qStTWWDIW0%=z^ z?5r0=0)AvYI-d?sp{oEs?$pC4>g?;c}>223yyNKz?ai3hi1HLz>@Y6kV%+29YcYYmZ9ZsL)4$>CjE_@%V) z;i%(`?A9}$3JSb>8FY+(uBO>v`_^C;gL1^bW4?C35K3s-;io)S+EGVip- zBiu%9k+yhdH>QmeX&Au!e1sjZHTZm`Ot2lN&0N2M1*uWX8dLBiDPg*%s@hw83Hzp) zv`D`v&y%Q46WV^vKfI2EGRr_1*I?1jRk^c;BC!Y-DfxGl>h-zT97PDB=GV>Wj z;bHy{k3Rl&aZzVui?IJwKe)nw&^p!|0gbeb8q<%#?s`&k-qxGsJYQ?5Rnp zGrNg(q`&eVEqYY;?ke_XGa{0_h)#ne$)n3bpd&>fu^E;EWP)ii<0!Y~ng4Q7Huyjm z!zvQ53Em{}6z~M`7%jnfJjPf@@;6eG;rjGlmV43LKnZ6;76=8+iUU`F+zQoP zCZ)tsM34R8>+;RXM_H|EiFlU0O};dTtfy>p68X!fu&Y~sCRAxJITK{bdGiKQHud@& zg&>w+%8vx;{4MQ-9ur5{=cPsCz4AELPN{P+=ESFbxh+)e#T$5(&`533H6phe%1Cc@PVc*zNl zx29~7Z~EV=3cIeLQ=%vxx{*~Dn@p!wuks7J+4<*^Pt~cf=<8G}va!)4iwz|JRM%m! ztW@;3fEmo@kP@ z3Vq^zpBiU?|9w8KdG06|CYzq6jKI&D*nH9U5gwyD6vB`ZUfSoH@}`;KNWmlcK{b_ z(_;!qT2!v=tc`pWcrOd6Z#p76Da$~1e@+n7vu-vASZB>W-X^j3Cv7?@`=NF^=nGty z@<^ zJq{z>%n-Y;ELFsLT5L>@GHuBtgjo7g4slCNs zg;!7VprXzR5W^|e0zUIH=XBdo;=M61KPEPUKeXsV-7Y zc2h$SUYF`3!wwENhl%Z))pUYd+m9X76Ly4}z=;uR!Xm#Q;$%AgJ-gHAF)2HAU|5F^ z{H|lhO&v1c%F>5toIbH_=?x4e?bQX7azVyyTBeT`yKxSv{FSMx)oHkCOB8OnuIvk> zz)87n*7NIxKhHc%>1sg2ANydwMJeyXiC8K^{i$O-9l+#_Ksl1iU5?N-_ml1bhV14+Mx$<#mQYK|fdxsj9UP~!~h!cot;RnwC zhWM#j?lZX|Tzw;gpd;94>4lvNdZnNczjgdLctyg>6i}xwP1XoOw?x^3;?kApcdlH` ze@^E=7R(4gadY=+JA$ z#{r2Vki%uuT-}C}vshEUE(WvhJUkBkIOfP9_&e7AbC0)8GW!i|p#kn#&KvkH4`Lv* zeUf3nWbflG-&_}aO3IbDuIlY5axSe%!$8PKTOa|Iqj3+>p`x`sPNFU;jIt;qic8kI zzG^h_K%O3UZ0^5ju);s7>?2IkhjHScLSWJeEm!*?c1FRJh9zf`Qr@h~E z+B-Vwj{a`pHdF-%r^EkIk-WDQl2Ef#@vE~BuWsl(neBBc%W;4qZbuy_a0B&m7;C&Y z{d|4m(YlH3v^Fg50%o#I@LX|~t@+mV?jP!f-(w{z)`sv@2?CO>CFgKEHZ#3Y^ZRDh z(9FmwtxYwuoR1G)X1W~6gGm3ke_KU(|E`&$f@<6F(_@k15J2FBw@8)@FN&h^q9-M! zfVY@B@h4CH`ShNqmc1_BLkmQV0FHuDcNB^S*lqb+#bKW(aYmmg`Dj)1^@$WPwr7UJ zJe#h0QP<6;G=@<3$RcP9hDUZyf~ADtY?EllUhrE$r{p`Ee_o1tekcCP*mdryw}csU zjDWptc#Y06C_oR9uPg92gE(49}Sb=9&*9?^b;F6Ab zc3by;#mXb7Rq+PW*mW=MRMFXBS7^s={ai}3@T!ZJSEGkW<5|WnlL>ds>~bjdZ~KPJ zV%0IEN{P?>I=0qJ|0X z@R-pS0c_0cLI>?#i|Pl?QJ_UTLF*+%1q96j@%o7We3OL$nJ$+O>; zd!JdMzgAW~vP9Qd=3m%YrrjQ{WsaE+qbam8^kTkomY&fSWy~=G7bHIu^ub^J&X4s{ zd~S(3Bk`nKa|vu^k5~|7>`)F)T&isSDa2f3raWQqxiR68I5_H>XshiP#9T4f2)c-} zE*I7dgVt4$?Z=CYLKT+==csTKcJUU9i^{f4A2z1AC@=|~6wK9MToxKy6dWfpAi@Di zudebFZN6MxLw=5(|CsZU;1FI3H73O$%egdoQC;O{+P^jVD-UW+<*)q}{4wYgK?nmm|w7z+R2g6lU~a+4UjA&rM95dj+;(-yA@MuMvFL zsM(VJBChn^Yen;N3< zESe}{1@<{(u0EHBD;dURK94w@5DDZLl5Kx&SSR|IzB6yB2)uTzKuCt z;h9SeA{yK!3(LJ+DJ345`_vtP9cA^f^Pm`#zsts6K1p ztDq^N+w{s)T4W}WEsuw0pBn1Zyp712>GX*zonWQ=lCl#Nc#G$tTm-KK$uTz*Yp`l4 zE_I~PUJ=$v_&XCQ?sky}|ISLdQ*4uK(2kCFE@ZV#I3++_lX$TW!mZ8H7EgE9gic+C z2e5Rxa;Nd-v~8is+Aa@nf=N?65)W>Zb}O;-YzcIctN=DkP0nV=<#PRH_;>+|_Gwov zmwh9%d{t2$0>bayGS35d`@$#Bnbvo?GBGFbYRNO~yz9x!BhQuo?k355z|OmzJoogo zIM|5Ybr9)E!ox=>$Nd?$714*Q#!K;QRPo?8MQbV1uQSe^(6P$`qay2rSJM9+;-uy) z(AnR^bQRvU#iP(Me$HRQnG}bdG`|lWyF9Q?T?c9N3F^xwenL0Waa$FwQRU8QMFIt^ zPY_U>f@i4sonl-O8hUxaMSk!QwdT_Bb3(7`zbs2lA3S}X*-N8}3!a@6g^=A|MzH@r zYqD-$DYmtbc2zv{;|?sceG*6kYdO;{Hsc%#;b^`7uQCU*LtGP>NFrhY(T+a1ytO9? zs|ec{Ac}%meClK^MnyPL)&h5WldN;R_FTF`>p{D+z&XpN_z@4cLS-w5A}Fr%@{jd$ zCF0@vJR$NJpRbYy&+0dWk#x`>c{p!-M=k~5n7$LsW1Jj&GukRRoI zPs#AdX1bRP^jF3KrHo{*OYo{iUm%ymi+pjS!!!>5KC}1ou2OP6C9NN%i#*$cX_(~H{ z84*bPboEyr(iU`MBSkosTz8%GNFCfLe2{{5#@AvvK?Th?AQLUF&szDO1EVgSU-+E| z)pF8Ik|#XNkr&*?b>&6O+5ywv_JwDagqDiPKwW0LUj3NO6x};e07Rfx<&%EoNZm7JlRHuk6;%Z zLQC8O-|~}fzRERt77P2bYxXR=m3fOgpe#9>7TV{FFLulMUh}TE)S1ja){=LbQxg3+ zK;2(h)Wiw{^^+>cY6q4{-HG6f-$7{Uv#A<1`?KPHrkW6b#bV)Cc8m@>*da#8*(yfI zPiy4VTz3D~1NY19za#E9>y{>8qW__pX8`J#1=P`Jd1vBiRk`?T2hNDZJoCA6yn?1{(R~Zw@0HX`k$xo+gMltK4lh9?$nkgBLFWt+JU-Pa@iuJtTyfRr1 z%IpceCryQM%0p<8YspE9o3X5u8Tc;Ydx7s#0d#G&)vwjAOa7fg!c>+O>evr%&Aipf zo7niPyodN8xh(T$G1TOrc(dotf6dRVV@ukZ+1EmY{}X1`Z)uvDO^17YD>Iu+#y>K% zzd3AXc8@TfG&7U945u-(Sh^S{A8BSbjt|nzOjN6A8rzxK7&}jxS(ViL-(Y56QAa0c zc9@wX%&a86p8wzQvmvUP|1m$?NN2u{pG|8!D%&EPpZ$SC-^R~=O*-e)AN@0aHhorF zj`?T&>>emO%g?@HB#NJ1WAn4Ba^_e&J3C3E-^RqO3y&n~>;tStZP4omoU{v~RK z|B`>1ADzy>jMviqOM*LP=a=GNW<~lSo5&*ngl}C3Ao0V@19>iYv=Ma+?N<3b$zx9d{>QVpb?t z5^YnQL~z)d8(l$-!i{DNH|kHeRIj*4Rr*D-8DVFVqd3s_(l3hT6!6lZwiU{TMs(D3 zKP!YhbcxrvLUw<;@md)_#*S5{mja$Q}1HqeoX z7Lo}$!B$*b#Reo1m0Mg?N;rOgW*OjvBP|4@VgqADMOUJmsy<)%ql1$hT3ze0jpY`z zLSlHZDsos|ZX;TuI>okCVo}?cwHyZ58K0-FhfjNOaJ2nb zh9|tQikA_w6Bw(*Tp?q_bxy_USH+?)C?FK*RE)&ri;cw8>q^p)@`i^Wf3?^duxPhj zvgy6KLNzTWJ27t#?;PBkW!4p{ch3s^bn`VEnhC2Psp#|TNnsdb(h;JAZh0I9(%TiM?%#oU@)nXu-$)^;~FixN5B&u zPkuRP+DM7jjvBb~GfnIU(~r`h;l`L((NPzi^V~oOeG_mgIdh}XS1sp{ebR(INt6IN z0T-Hp;AMJPVcG5NwnFG6jdTgeszv2~0W&7aVtVl&$Xd!XQ>v4|rsOH&4%HePt=H}l zQi!DqQ#aCaz1R$?C_D*kaD~JHyKB4Gko~2ECG*^Q2l}D(d2I4(>X%3v5*1URaoI@a zHg+H&wlmV5A?N-ZjF`>1XwTDN^BNl!*t|x}qKq}*WdWSmRBypvtiG*dm(vF#*b&1heK&LKmpP9GMP@3lyh z%9?B1P;IOEzw{vT&Z;?omQ7JB>KGzg9HrY=(rvo(?lZzUGJHbr6{@RzYwA_R?_%aH zDscurBa9qVPTEsr&UO8PPcoBk#V)2-Wpi*IJC)QE7&9>yCGuCGyBd6Cu#DPNBds&I zm_bclhgjG@TR|4qiow2|Yh6T@%fF(ZHu#80+=Ae`s<%xP3#ZamL*Yv|6?&3)W$ZmX zp=(ea^rEihqx>UZU1WcC6JMp)$!1_X^DB9=!m~1%f?=S!)QE~@J@7-JW7~|XdeN`N zAJ-`b6Eb1j)GSDT4Z}ycvGp5S{w?8jJ!9&OH8*>?1;%#dG+tAD+r-MsSRn|RZsxu!bq)1?nr!^{Urzm*9R~cQzQ}82S<+DGPhg~-Bwbn6hK&k4`{S!c-c}Imh zBi++WXySL$^Hg8E-n71icn&CrY@LZP%-U8ZQ0sikgIYD+Dt*M6l)KCR4p2J&B>!ub-d(mt z_rKKr+5h=~*7rptVwp+ZvGhhOJzP`oPNacbkYr(|>1>Qv9EcI5Bz-JJ6Ej0@k2+7q z@-Ho|!;KJml$}43FUhINta38(L{HgQm-o-;Dev2-93+biW?<*Uob%B}e;;A}`DiC^ zE}eaNZ1lfxGjT<0t%&bVELdIhZx_z0b6!fmI-vE{ep?SFcU#WQ<^KCjP!GPDK`8;e zctj1PoE=rYM5H>U*x*;_eYDq{ zp6Z-~gscmbfIjs#uw-K9ve}=pWCGm6Za4paAr?A-Ku82X2B%o6M-{8|b4_xUu%7TN z309tc>X>PN93CQ;ML8JP)K3WR4qjKv4SPaBqRiXgH(}EervbQBndER*Y8051WsGvj zO{O*bv_QNSNf{X1RF#Yqb0iJ5{-(Fr9E2pT+EuVzpkolR=9HwAuJ~|G$bP< z2^!oUt5^d`)dmWCEHHUzJ%2!7j%A@1@C4?)%k>^6vvg!H7*{DLym>O_c>0bSEkfK#p)ABedCc2@c@>aMiU*Y0JghhK%7 zJ-cp2Kh;PNAOz~k0(JU5dJl{PN;a<4b}uNG3+KX@cy2Afy+$IU{8>dYtf@1DjdT$@ z(?3?x7Q-w)?>Q+p?s!-b$ZI8gU)1@jfwaGvM~EaJ7eYkQRw3jI8``*ns3=Xo$yf8@ z#kp66MWzYXmobcq4~`O5ypb>HU-C8f-80QxrwmpwMk^)DYlDltEPC%2{_OtYAza)~ zHQUot$ekoY`i4lM;4(N@Uk|eEgR?X^t~^EE9&%~y$cR)+lnO>vhuMyDqvZ!1b7x_k z15J%OZT9JOIj@S1xQ&>6a12GHreYv1>bjMFpHGE5gW;FPNkTdNIa&H9$DGFxoW_sS zHK6B*Ve586HqeljzKb_#&W7>wUZzR0tcRXmYN*Ki*?@W*jnG!`sRD#6&!XuT&iW3EpTN!K2AHr3utCR6$h_ zLKp}~kbb#P0LpF`+Q4(0cMlWdH_*JcW#?J+st1F!PypVNiG zB_5&<^Dn36FiS@m?pMNa(*a@=Kg{hRkNLXcQro6L+>PMCJM0giqRKUC*D%{#S=vi> zQSh!ZtR!CMoFELtS?BDkB^)Aq6{l4-1>3Cg1heU_enU^p>D*dAwFa2H0_4%ch(%m0 zwb;{>%urGGJKLFD5&rL0eA2BwPh3L1a9V50XQnvNzO!;_lsWn#pU_Q%Zl-aQJp8VO z!$Sjzc2m+lwD^}2G0M&_B{9^>64g4FS}PYLsLmbUYu$3cf`?$xPYn-ih(_T8eVkXa4Hx4;J z)ch2Gyd#F8p*01lWwQlyspoxs0+uDv(Pca~w0D|;=f!0+4DgIqcK*yFukKYC!LTVK zgp6RFfrx3k+4)f2Fce<~q9R&SAa*gegvcoJF7aULs2ntS zw|U=oihaU=_AKb5e;q7n@2!aehJU#Z`g8`8UEWz$bfAa6`+GX#yt8t>R4aFYKKmlV zveNhuqWRVGI7=CxFyb5tCqKvwCtu48b7YA+0Y=&RhHXvmYOWo)N%ThiW0rkX9bub4 zg_+MD4p-KIn=+*&`H@*zU7D5xZjhaW)#kj|yo7ZCIz9AnyzIWulubsFv_c$ypj5w$ zM!ZXp-`~A*rh5GgUXPv9lH7=qj$tKP+&OM?%Ad5y9m-5v&TTl)uAIwP{G;gGN{Pt* zI@5`>uR>ZyGlpZwrJ2;nr?h((tw4A5(EoSdm0a`^o6G|kMa{{R`~cG~MTjM&7wY<2 z_Z!2L`1#0w%6h^kGsN7y`u*75EC;gn`!A?-x~%kDToZpbCy&6^ez4@|vg9$02(m(; zKe+gu|M(-rjqgG0ooY7k&$CkZa)GXN#a}3Le1s+1gpd0dVAP6QgZ&PL%lj67`f{!? zUKH37t;J2R`quMlt8j z`U7S0OBh}Qmj4r(+pF`eC#K}ZcgRxdpB${L^iCEsXX}pVqKM(b_0?se#K$pbvuVdv zIGM$c10H}bM-ZN~fnnTi{K$gwX0g=tKQ|gi zfu(KC!I%81f9A%3#A3pFxwZ{1GlsYt3C4iJo*Xvk-~lKo>uu!Zo<;-+ovh3cB8+YW`NhlWn@Ris!aPV=z@ig z-_r8|nHd(v^Z~k7acG-Zz-{!OpsIm$&T=P=Gq)`_F06O7v>7IdT;koTak0_cJn(kj zqdj8=8|Qo8qmf|SK(F)j!^)PHhII(?^76b7Yfb-&C&485jN!dYr_~~W zbk^i_7XD#|zDJ4_bfwH&b&Z3X*VhC;O^dYa=oA#}I-9^G@6Dr? zK@)lqzQj-t(S8vOEa_ziiv{|v$~~z+TCGeUfm&+IY7DO1zhlko0N23!?~yA6>5+^p z0?d$i7KlL40H{}aw;3AJT7sDH3SG>beMY$c))Qq_SJNFo(JunJL4WFRE!0!u8>K@6 zxm;|B7Pm)vDv+#;-*5@2!spXIV?v5=j4yqK-ZXkJ$dr|OU7wMO>XQUl3V5s9vQqR5 z@mu8qIwT`Wl+Ydt=2-AYMzopg5<4F=Tg`2`H+`JxG%7!1VymT7Np3l{%Yh9tU>IvW@O@IWKsTRF zzGfi??T6btu21CCj#?8oN0a-BlYg24*1^26GrrtPW$!r9k3Zc?MS`+??nYn_8r&6d zH;TO`xa-edrInV(pR4K>$OrI-eLsGEo%3|G;-fm}^=NBHze$-P_fvpCACUn=Cs@m^ zPn45LL}`afP-{{Sx5;plthu*O*c+?baWgsdw$xR<7C!|KS$bD{Z#nJGW+SIht{_a1 zv#s|$4JHkfMSZxfwlH*ta)>o(uAH}h@f->aSjv6KKZX8^O}UzQ?pyp5SbSzB`h#^< zs2crrRiLXb>aJiNh5UDQ#f*gfH@F(PB~Xd`GDB_}F;Rw|c!n7}&ry>&(tt?8SrRf~ z!UNdJPmZxt^*rY4`1qy#EhJ-n@{@tYn%DP`Rx`qP1MA)Te;JE~^hiqlD!vhIA1@|7 z3-GjEVVccGldGVzMe4Mtt*AXeSANKL*);VKv^X&qfZ}mp zF&NYFdUDKrvxhU%^go#v#)|^2j~KcD(_DVe9Xw2$`|9FlHZk4TX0#z ziz*W*`gZo&PkE-6p5vjFx}3fNrss(FBfhGS{qdBhWoS)TH1fypYX|(PwzW!lvstTI z_wJYn`SEs+Lt3GofRp!hI_>>vOcvT?{wN&D6D#$QAy{Wub7QY~=IP)cf|1aB;fo2NWZEcPNN4IY zQ{-7*^fucwzh+&41s|)5m=S{7AP*FF^IIxx2Pd#+UPe&&%5alb1-3wH&z;g3&D;(J z58@ltwZxn$>%9k7qF7BHEQq;N)}z~Ou~L7d^7-zNk3(wHty>n&j71cDa@08aof8JB!`l>Uq<2@4bECd)@^g`6x9Cg-oq}hK>`~*G||88&7iT_p8 zgp>WSPt&zDt;Vv=(xY7lLYNSGRm4+u^v4508g@xbxw zbAnfq@ue=a++&ZrJ7lR%yoz&BB+CbW{BytMhgnb=!?JzoGzg zAFzMjV*hpzL{20E-?8QM{t8)JuqiR;8QFtv<3$)2IHfYH;XD8z8+~}?0!EcQ&L{>8 zHXt&9h=!e)BF;K#v10DBz&@Zeaa_mbaOVQaQjo)MW*4esFJ*g;R{>u0d}+T#$I{Y- zY>UOv-*%BX;cb*z)%<_x+kJ?WpqYMHxT2UI^;#xu%M4bIb z`un0VfRE0UgXc_L6?xy7qe# zq|TD{d`Mw1u8AuIQKy1aNl%x~1t&qm?LPue!Fsb&vQ!P$ zoRIGj%rodF3n(Mgpd*z6K-~)n8wi1wuNU3IXXk^w0*01cxe3%Xgn6=_m@fg5OeT<8 z_v4A}&M(mfXa1(203qMfNm|EPbFkuwqSWyJ{Zhy-f}K$-LbQb*Bt?GJ_q41^jX3dQ-YU4}R{!2&r1AX*BDq-w=j znw5d_XQx*kd>fy}(aa70*8|tpxle2Z*5(*$N$B+6Tgm;Jb0Aw z5(_Wz5@q4VoT|2?Y)G|8bY;gM^WzXD^#`E$;=aLr|8_=6+slNT0^`ZBpv0tvYu?$T zPk3Zg!1CvtvfG%$9iG3QIjsMg*%l!5{!x^nLCa`5GPUo>=cs`6CfYoPh*b z;}4*sp>ofeMj=ggOx}q4s=#*dhc^rlH63ERhtZwayoB8jnUL8B=mj7wZCtNsRz&89 z1rtBNl^jLa`92$t{TTaQdhLE@7E%u`v2gkVuG9Midx<2C_fhQsjjlFbF1QZm_!I29 z!@2cl_G8yI1w(oYPEf%m6sXlJg%93!RR_qwAky^QYJ()#BSS3W(K1UK0~{i&H4t- zO~3jEEh312yWL(d0nJq~itY7pgIl!2_uusnLeW_1{spLdbQZmm=OO=N^hfU5Z~f5N z%ckGs&L7Dipw9=JLx`gQ_%EW=ynq23aGK-WYIAn`{<8*UQp@#VY7K01wH2*$uFbE7Snmbgiu2Io}wnP)fz4? zI{{J-?A#x5ykre4ax_{bg|3d}eQYNiv-`D@`VlK;*LC6qKk1H7Bf|!9*?ANBrA%7K zbw%J-@m2muUbOWMR?Fnly1b8~a2bIF{F_vjxvmKT&Z+PZ%MNt6@hCYO!ZO3;$21Ic z#Q8MwNYE8`aj;eMxeJZ)r2?(!yQx0_#;}PsdxQyFMcgCo%`v3Ob_ER&PNW#2l#*O^ z+}u(WN;dXWd<(yS!oDNLF`vlo1gTB&YVXCqT^bUEoU@DfJP**<6$E=JoI5!@*ip+ZvbVt!&;%}ddDBf z&O`k}0CIR={^I`v7hh>Hv*SFm_1a*%t<+AQDyhoNl2>cKCwA4c$!8&DyBA{Ecsk0< z8=27qd9%;5-J5!*dgWgXkiwuw?{o*pqr~5RB?=6__jw>Z703k+8CRj?0sp7*d_C7b z@iK$llsSEx`=7z?(}Q2~7Gs^A5VBJHdNHhHV9<|4zl&xthhHmM^i$g#(D7Vl5-{5o-EobK;SkGZt@c(W-&pyA;T80@#6dx-q_BQ`n2KZd@f7q9; z?y&Q8;y1qB2m0XW=jXjGfOj;p&v69aSWTUSyC$tlJu4Gr6e@m%%ZF|5){gu*~I~{P%Di*KmE*L>~Vdcdj{DVUG zqDo9HPoIo|)9`Mc6*5C$+86B7ev&EJPOrk z0JT)vdO;8_3xV&S%UX2fK3TSnU+vIS#p1)h*3v^PS$N82oXcIo<*jw@$gr~)ZF{uU z?;lR?I*)jvZo#`SJ~OEScYvD1T(~pKV^s$gnrU+2|I$e!rhf6mI~N$mwUv5-YMn*` zQfj5usm{VzA2O_66pqHdS4@`dV;`Z2aK1BbrjFkkGR0H}uVhxcG^?8Vn|YLL5 z_UegSz25!VM_hpf_Et}Xlnr?+{9dcQ^*#HPF48>V5 zuO=YQzQO=%`CMsMQ4O!{Z4YZgM0hX-MyXuOdko?wHb}FNt|K1q+t$L@&3twwa`cf} zHEMk^(%*uXw+iYH^oxJJ{=lI4jaX^Mze(|2jb%2|EVjtB@f+IcSYha-JM^2t2au%a z@*#nsRO!4VxR)TosO`oTnPaz&+#eN9W{}t za+EN_9d%aW_V~aEz+WD7uN=W^+5r2Y`{~@B1iZ8uP(bnCC9346PMV+^!&OSoXew7Ffg)!8QcTxApC>ijZLDm|r z+JUkPX@oy999X68|!Fn4043k@P)p{93Ihqg76{8eFr|_kjXY_XR+MUcvf!kU*dt(Y?t4&R++-`^*=H=|g7MkxbC7;ov4RP4)-!Vv&7S9b$AC zp@(AmpkwgO)O>)BeWNmSn3dFJ&gFneC>TIR>2rvQ9(4|o?y69GdF!r1&V6}B9Y+a& z@(#xGHbtvGvKC-j0)JBp<(k};*i-Aw=!!YO+%^l@<4X*v#CN&iy;#MEu;a!vxu*k@ z^;J4j{=ejd+}d$o=&c-ziYgm6=f6>KP0wL5XAy25$@VZn^-HMc5C1Y+wmG)g?j!_fq6vYIuSCX66;Of0vaS z39bmv^2E#(NHE8X_v+B>7W89Ngt{e8^Y7xdKI>~Tt8y-q4%s=l1&e}eR*Dc92to>K zVuj zOP3LJ(U@{UC=hK}>27o2$1KSm)R7VvO&y5~v1KH8Nr0v>O<2rb7bLA{<+dNU-|xL8 z^?ZC{?`;9M)w+#kE-A!ihZhQYbgCXjh436iomL~ph0ypV_Q+NiEo~-VfrVi5a`r=I}f}kCV!fX?_so*>;>XkBC^|)3#YV*^WPSYBiqIFR-N2U<{RzG_+JpxkMcRgU}UU#V*qxq-5|$fJ8)tzWpfT zB*7q~4Mfs+1f59y7aoiYzEqYA_y5NjYECE53T2ZGB(RWcYMqF7V|l4tW{jYj4&SHWfZSI zM2ftZsS@foPrX2rWaF&x>?kdYH{!TDjKX=L`FI^jt~*=ciZu9ZwFC7cYIdrP{VsK- zt@6g?>fT4)_Ie?rX49X|EsjW_(&b#$ky<0Qkg{;+e6v$p=?Qx5E^Ogp)Lq!f59Btx z7!k$m-VII%M{})YK&689t)d{18I2j$YSq9&fkb^VUj%0T<&4@ zU}3z-`zN=sGX0M}KT}(I5+0inmB1-VQLN4j0>SJx2T$w~IgNUMT;2stKTUMVsF0=e zu9@Op{gtTGkV0o4}6_zkrB5U#_tU^#Gcej-Kk54m-THln40W5SO-P~gKUlq z{ZKP#NUON!cZmjWJ5w5SOU9YEn2|4KC9bD<*}9-w%gg+FT}0(;)(cVRA6^GHz=5e2 zGJ5|~nW-I6dG9HO@NiT4LhAM~2}22`q4n5Y zgQ}~06Tvie$9au&X+bu8i&2AV`5r+t@qrx0O1LB9WV&SqmAm6#$$h%Y%of%v;3Jee zdwb8CecO9Jc(ikm_L1!OTyxVC17q-2?FGY!(LWI&^jvKD$l%<^wLRf9BKnTy#(=1M zXT6~=5l$Kg*&~jRVS_P|(RAlOoDJ~}!ha9b&P)(eFw<|NyZ47)!U8Sh*J zU-f$i4qwtMl8#SGZp1Uf)WDSUJl+kv#iPw+SqpYR_g&L$G}%H1*8-Rr0V8?01&7KVLZ7_?*HO1Ii0xfryppLHv zBCI;RFZk`rq! z5^VCKZnNMP#7K%dcLoT8fr5dvm1?0kd`BJdI8?)fm}`G2&zq<6)poOHF%%5>Cs0Z9 z4|kz>QZ4pNBHO6&*i zxVM)5z4bNx$QFj^A5R)g60(Ilun}fDd zR$R+_0sUOWWO;vl9fO`AzWbD5$p)Sp5_qfS0nH&p(P-~w$>8lE3YF}W2X#yhGS`Ge}odXLxPKMUKg7%rM>NGlMxox;a>(nBSVk!;y~>(Xi6P#_bS zrlT>CI3sPYWocc4Wm;AxTbFfeGV2NB(G*VZfft`%gwu2Fz^=~1=YBCfl-FR2(6msWcBg7Workya zm6&rql91$Fp3odmll5Fq{4yJgtMzhWqv^Y8B9N5gPj;j)_MSsjiYC+ud5Z5*>zb|i zS&r$=Jcf6izb<(F&-tbcnPj%L26afIvYsf%2DU~j0JQH?5Idso04-ga?D{c z0W0)nCwV19gB>X{OEZ8^d-7=>((jNjmtt-0uUILWcy;_)=Nzj4ftwz9%FdwMYkQ=N z*!cLhIPI{^n2al!w!s{vPetAU7@iK?8Ef^`O{OALE%9Nr>LrP&+WLijQ6b*;p5}}m z3^zWQ`;I0)coJpVahtw2ifsDdQ8&;ZH`jn1Y(l@&nA|%@aA%J`{L`Oe)3Weq=GobM zxM8)`oX=0iUNU0Q!0bfKU0A8g-w0ty5o5jP-&d~ts!cb4FILfJ=e0pp0!fqgSHfy= zmYo0wEZ6sJ=j^*^w6lH)&?-nAS%0TYN(xLg?s`6oeBte)?xAg$nw$!(Vpgkp-pE+` zW|%M}rDqJk(wjYFs5E0(Xr7&YYA}XdqkYHlqyJ$H-}zsR;aRtL3`4VH5Ot9eeTwg@ zH-&i&LJy%poIjhow4H5%r_Dn^xd`#tMLi4;A~OMp`ysGm%J z`3{ZW&fth99(C}pm1~Jw;9`eiHaYMwZi zjcjQ$sNHpCFTO94(9BHFp4Z8k`MjZMI)j3Sv02}DY_n?nyik+G6ls^iM;=g{Wl#;ZD(P# zgD>OdMrRuC5aUb2^WWgDezlGX-NsPFX$j-p30Tm64cD5ksEeb)+F1S-dm|DHMCdK< z`)n7ns%3uPb7{XyYxX>#XiHmop(G4QbJDh*<~(Ca+3## zC!XSnt_=n)+dA#xLHV3rS`QS(C)QQHdGq*M_x@tK6(I!u(f%WcXTOJhpoB~qbG{Zv zEm|}@@t)4{iuqHll4$;b?oAX&or05Qzhc%`(hRQD&O|)UTpFmAz5>v=Y2k#nv16I( zaQ&Tz5^~xyGj64i;){USEI-w{MQY7MMT}~nD)O=nCK;Yv5dYZl-p3j=X)oxvsd+-k zf0buJ{R?I)a9ni0K`S&xn{4+dV8JSz?jS2y13L>L=vBLBeUp4N1S=&xNj{J}@YVPr z{&FT+eHdS4<>gNncL;FdUXGmeJbhU&tP;ZAqwazZB!Fjr&Ea-|iB#uw83(7G;C6^F zGLP&X_t$WV9w+A96Ktl83yy)1Bhln%!>v@CrZg8v)hi_hc3u83VpM&G_U0F|Ua*!A zo1W;B!m9&nth?I=?oG8Awl6VAt}~yN=^+jqT%xo!@8WQdEskt>cDRo)Re(M}TOfMjerNKy6FdJvV!Zurq;JG(QM)R=ZHOOBQg4`Rj#&94AY^FMkzq43x;)%k_z?BR zc9*?V&!*73UnQFj_kv)N1MbL|I}5LKM4eLq#_b9tHrY-Kz4aB-^F(AGMw1d*><{DG z$cHCPH3%pKl3M-*zESzaOk=`JzaL?&M3X}_@KVur5C+8P_9YG%L1kjU}C5<(SqA|d}1HW+iR zJQU7`&myOD7J%lk3M%#Hs|YG(O`?0k!ctcQj~-9ua-YDlh~A1;E&j5@@uYtLUMIwwC>LwEbMqg>BlXlL-3wUh5Z*zd0QoQVn%{PIhh_tJ9Y^YMX zX@<$EQdm(O3C2fI)vWOrD<-rXJfCy4l?+jjyp(uZ0mcu(+tuY468+%{fQTx6hgm1~ zbWNR-a;G+{hR5vrW2likPbHfxHGx)oJOWW)+TUP5t!R}EOWk5r2wk-2pTOH@J>Mzj zFq#j0HuP(gneNP}JY`}>L3+w__9-vIAd>7tO3xgV*gDAMF{;^=L*}5~6OStq{LH<*s0j6Igx6~?{)lTo>k4=9hVm%Q!WHE>zp_MO-!C)Lg zq*MPPbm78>k=-LV_~W?IhSY9iZE1SA6iL;kwO}#>Cd{!mtL&BpDarNkkp1XhKxeml zrP(bfmff1zdFqHJ1bKxGGCRU;11 zKz;YYSJ8Km|4rh3T) z-Uba;Z)5Lh?&6QP_Zd{UFulz@4%JxqlIiKQ0pMj#(O!67yu%I8+itkuLUF%&odXY! zepHKuU{L7VZPzfLF*nPK8Wz=`3B~T=7q3bF1l#76qKgHQ8kJe$2JR592j_!epL`Kr zj_z#~kim}WkEa$iL+2xcKnKBZM`Mp{L=o6YU5d1r!%I8E?bwk$o?+dnqgg&`sUc-3 z<&V#v-)8Uh|BZU-mkmoBA7o<0toRyijkc(qHsZW*eNh`Ro;ol%9}&36pR`wy6kpW4 zy#)f0;W{C?W6r$|G=jmM{LloLBX)vg%t#M@Ph1lQRkGYq6{sACJ@WeZpF@1IJ zUzhM>EpN52Z>fyQ@{VkcZ@(uvz13GNV8{bCLmgi;>z_A*{9L2f@ld{UM25s40+UG^ zc)~Q$5Gz{eVA0Y4`=!-CN40ty70753AvZ!ixi~Uxj#TbvqO2m#jv08XleGIwp1ZY z_52nlFPvO$HVG^JXV{#mYsi1pHJd?p6Y^y`cTMu&h4%-!OqvL#^!j};*V-)6m9 zutq)o?#B&CqNcmGPR%!*HvcV1nn*_cyE(RHb_~-}v$?G?yIdjEB(G)QrqQGW*SsCe z8($zA>Z@O`wzPKPokjK^9~q@J?a<=I<1kepyUi2~;}#3X2^4mhpoIkvtA-yBPSkk|^g z#{Qk=C4P%Q4W6gZF}FTg`Sqd$K@mD!CAA|G7d9ZvWc^a-w4w6oI9mJ_Zb5C8vC&tr zw~{Wk!pU0q(j5zWjSeDj$dS-&24TmhPAQtc_- z-fOvZd;JF6q#DlLf(oH4R^jpDtb3EU6!mkDPCT1DP>|SQ0tKyJ#U|oyyj!;Aw38T^ z>>_gSAXorX-0_E)OK;t)myUcH*&UIBT21}5#9oO?6OzIk)`e@UDB<(GhU6E67g5YW z^3mR3JJIK)UK+7n+NC#4wh$WGB)TIY^PatiA-I*9hw^;tv>_B3Sh(_f06ehpZhkOe zIgtQY#BPZItBa{O^5rZ*(GTq)Xj0huILGg2E@KKgZ~ThbOEBt#%Z%)2>+ah0yH=`z z&T^~;@Up1HIdi}5U~wIW?Y}BNPjhkeYVd%uLlF~*KDXJKi;NqiqFYQPE{_Ig_&4i; zXJ>s?6^QPmF~#z*0}4sd(gOzQ@77(>k%TL6&EtK-j`y}#KW{N)Qn_G2DEZK>ZTT+9NPGQzCa4%o}H#YUXt zvTNW7U$8Lt(v-s%m15OW@x%QslWkwsB=KzJ*iNh~D{{jp@0f1e&T z02>+?Wk6{SF1xhZ9`NM~tHXgN`F20AG9mkcM5B~^3J>MpxKue~1q1r>E|TPT^5Ul} zKDQ68n7$>Jel5O-Fk=YCk5Rd|FAi@@rECL<=NV87Grr7wg%U*AxdI0atcP1xx2-1( zJ7&z!ufd0?4MJruS`shX z$@h4&A@Khw>+S-rPsJq9A3VZ9!?F3+TX~6&s2f4*l~|&9&WPkOsPB_A%Jg|;%gC4g zVpw)KRZ+lL=6VuIKnXHay9lu9zsJ^E=Uz)I5rQ$@T6PLcQ_HB180~r9fDa9}g1A=d zNuCN>P>+|Q(1*YOHhDa4CqL@;$ESj033DY{n5oXUom+~%?Ki_4(K&D++TLG{a>yw% zp{KX`_<46Xg7+c+_vSpY88N=U6QK!)ttGI&#on*X>r-0zj*yd9yapa&1+J#J#Yj=a z%l|W{8asJoOP)V~_nV5p%You?3RZ7}#5BJlQvaLQuI{FHxay4)r+ujRbc8?TC5^** zlMUE8n9T?rb)KGL;;zkq+vt~#M08j8(5eYgaeK$2wQBqQDkKx3hu8=G8I|LCSwA`77hcyNfCPIKhd<0@wqJ3GB7gvww zT@EAdNRKyOse^Z%j#Ior@}Q-NB%hbt1DE$Vm;d=;-4bv{!p?2q6c zUy!j7rV78R9nLyEdl*joF_*rh%ld{TkA1@V2j2*HKTpWLm~(d5H9Q8gecTUw=p}jQ z^{*%Y4i<@xE&dHMq0SUQm00M7wp;+5+ub@Om?p-E43P;bD zIUGHm$;Kq1HWbR`wdcj)wFFw%F@Iq8J5~!na{6p+qGFlHTUgnQHZy(@3|#o)u=9~Z zf6sqgl5RHIr7D&ON_%=4mm&+XipO>7th$@OxTG}lBMsX+%GAEJxj);(jS09cclqQe z=UI2Yq6Vk0&GJBYd#Z37FB+!Rd8}{~*ZPhcDxhZd@bHuD5S*twp=B)Ej$?c5E$~3V zwWWG^{BZny238MBykquX^OZ%W+b`PFpF(_N>?v4B&SQt`Tk*qU&Xb4hOLT(QXG>l3 zUHTWrJ}mfl`aHgAPv2^19#=hkx*2362TDv+KgXr!`csYeav+^#-1IYE>`zj^PY!7) z+EUs6g8nAnG5MU4Smsrauu>Au#PEX*HgM~%UZ_GJ zCvXyI&ohit^{gP$q;;n_7dnw1&o2-*%%Jn60cj4*l!O>`lw?@`5&8=A#Hh)F;BqMA!X3Qm!C586|TQM@9RkB`9@RyC2V!C(7)A>i1xMe$9rr=&YmXd z75U=m(y>$rJnAP2XRxEpzogh1V5X|pMHbbbXJT~IK6BlVx$hTl8liz7X1-d>)Ft8t z)pHYWcC_gYZZYEx;_xI7@QLd+>P=?UYl<9{{*@BsG-`@Wj&%9wS+&mni|GS-CUox_QxTJ{BK0t4R?gfv0=|%fK=vW@$#y{BN_p#|4a5a4~71m9tW3SzfejSnmYx_up8>()lPn76#+t0j1I*3QLx z@HMB+9K^iGM;oc=5!&$ZO7Dz1qskJeW?zL@N|2+RolXt(jp+b=9*KR@wkGj<#QMWZ zZ6*13Y-e4^#-KlZbsJ?ww_~#|*X}$*J9edZ>>4?L+VO8&75F?_6$Cl7DlRUYX;u8X zte$tQiU-RUncqK`Eiu23nS3KwMUYC#&IFMZkdr9NT9IL}+%bPYOPi=9L9h&^(!%I` z!tY?M6qS^CM#V@#NFIEC|NQ^4znT_zOuzp{fA2+t2KfKy{{DXfTEUfbU%)-}LbUh` z5d8>Vuul(r_!0O66LeopkL}Jb@;dI2_{SW2;%6X)uY^BO9M$pdEWgJS>_1+PW7Kt) zVzfMIswX`2f|wv@)1~Cu?P*_+MsB&(*)%P%&t4IN*f!1OPsicfmspNiqixg?aJ}{! zT#F^LXnprQJ8!SO8SzKK9qtH}(Q{sq(Hb5f<^NN)gR}mbZ87l|x1Zu0Gp_nEC&HnH z5)jj&pZ);sGa=v$-`6GGgD)&RTr8YBbcY_fhwr&sB}n+HHqDt~yHzn{Flb3gC|0o- zTew;0L@A82$DN2UNRBzul@yNY~IBmZ^mQVOHw@4?h!2_ z=76ku3Te6HPl~UQOn_-d&{Nf#7~EF)Bfd}m86F1hk?SVgUeQ$AD>Ccksfq$6n&ttl;93J8b=AJmoRNdiqBEmMJNWxSXXiv-hx+ElttW1A95nMSt zt+YgxHJ$DKthD%DuE?nUO8KcHXvQ5?dR+CYbw^aqINNnlDltcfd^swRsWGrGR)E03sMvF`&qw57EQ(_l zA9z3cfsV#>m$AHZIbDYZ(~e*D)T|p=ey6dO7Mq@`U&zToocIpp3thI`P(weWRWHP> zv2T$E16GfGEDNPE!j;M#Dh%rYGf2>oV$MyJbhjZ5&VBF3?Dwjky7_K9?-jf1g;{53 z%h;+VM;92=Pp~mJ?FIK&XcGyR)?->)hyP7Wt5)lZ512!}4uOZ7{|9gWq36wC>&>mp z*u+hf%KjcSIYO&zMNh#)Jq0sV@LLK-wsidNkn~&~>H+1Hp6FBzlNEtxJC#Pg#8&S|%S&Q4>-dXIOXa9y8aHlc1KM7}V<^(glC|03cHj&xHZ$L8H zx~IS%J^0*NjmA|1d5#&l?S5lA??SSFqpx?A0K60v3kcui&Y^ZGS`|Re`&3ickdN=LJZUStpk)rr{xWs9Ro~y59H8xGR z>IUruUP8tIz2m;7OBq0cbPbApYq$05S4Fth~Ly zztX#h{ef~LMMbnl{O)P0RR;xIKc~23NI)MXx5hiPzr1bY@6#aMQ1Dqy4tnYG!9yK$r*G1Oc&)QG`AJ^l9V5x}PUz`Y z{OHCrc>fygf;#T%nZN8;1E&8{n00;JS<9NRr+0g={3|!8_zRhfSRF|9-$P~KJ%3pc z3-8cQH`R*W&{tMZ<*NBi{&@QzHiwM>Ukqsy6LghZFua6{sOpaJI$vYI17Rhz0-wI| z7ttJ|P{j;BCA&t>Ig)h``b=S3Ze3Rd+1rA=PPHT$1^G@eiU5}~kSFB*o(8i;i8qZ_ zq2ssBi=m(1VYv|%MtMDclmZNaWfZa3`#*sMbPwGL`GFpKSI~-i*=*!lx_-9vwVXf8 z0LlIL?Zjrm9$omuAuPX>-JvV^^@f}C5gcCNQ=UBhEMCgHbggNv$E)Sit6a_#J-m_D zcP{@_zy|{-_s$j$OR|E_&_~;CmO4!0|A2nsRoss1F9_^bY}LwLC9kS=&K^dOxkXuv z;ZOyzL6@%Xhp7y@A$ z&m*0JMlG_d9gVo4B(6sAPR<#sGtAD9g{h(I$sY}J_WaYU%GHXe2vx0+~&Nei$FY;C+ z{}FS(XgegdZi(Q7sK^7_yn7=L7#WZk1emSyve^|j8`4QSpMDbj^LUaLGMsGYr604M6&Z+%_gSf!>y ziRoywmLiFG-(y;8N@P1=dMvUsAlpM4Uh+8!tnD0Z`g<^0%7)_I^(H)Fgc)A(EQlXK zYCX5!{y!*k$-E_!r4J2UlZp}p+6qgiYCF0GA#}C_GwDEbZVAlwTQvA3eF(;$+$dV< zpjzAa!C#`zGtqr7poaRUJ=(w|*qqR5o+SN9E)L06Wf(9hP{tnbPk%emUB7CwhK>uT zYk=S-v`gf|+q^n*3wW|dxq!9V{X{5y-P%R;DcLB`=umtJ?6fFKXT5N%h;W3|X<8!m zMn(H>vjNC_8u-E>nr0qa=`tz>Q2X1VP+R+Zpyq5g8SSulIUF`^Y~R2ix$)HHz3IJ# z+7acsG3+^of%QFaW_{;ONbHN*eT-aT4rhx?dV&Hp9`OY;JZx^B7M9=mj#QTm>lr2J z5NJ!I(_aifDGvp5i*2G?r@sJX5U}0|9K`<``ln!Soz1VPjf&njIC!}Q<+!ZiJux9m zC$ltC1VVO!N7`=T*XWRqlmWS#Rr?Wrx$VyrB|-Oo*4vaCs+w9fXLUA|PZ(Pf??=7m z(ae;h^OM!(p*Z1s--$Xe_}2lMW=|N~;@yKWSMYsSc{XuHjvEbM;m@Wxps!Q1*$;6- zG^{Wlh@|I>xn~$#j(IKQd~zaBdspAYYzaU&!5%`R?k`l-T%qN%8LiYxuw)feN-3< z?Tb83S&fx`fOiO1QA|VlA{zS>>`TJVoqB?+QGY0kX>Q~%}h;#)Di_RXkpsU z)k}07+O=1@&qja@<*?yN6FVdBa&ZTER<=bNu|N2$0D`_6X2MFnOLuC? zVTCDv$JrxaURsnm0)Ur;LxB04ObO$^$c+C{9);a|)l?V*tuWqJ$-@j^vOo=zMKk7B z??u9H9AllfJJV|{0VzyvwE>+5Pn`p2MJ;tUorA!dAytJzZmg?Td+f;eV1rJVC zy1hB*H~e!&nDioRhRL>T0D7f6bA;y*iCn11XsootJLrZ32<$#L#6O|+n)br~`U=|x zpQDb}n0xi-H>CP`z?XOu#XMY!&2v@ymC1=r{EPB=wyU!iA z-db)VJzO)qsNkA0IL$wACs&%Oh;O{AhgrAMQJSlNKy?2T*op3;cMQWv-S8O5vQ0-(gG8k~0P!6VKaQVBuzpiD6g7QI8>#fT!A4pH z2jVUJ4FV5VoY#I&&noj9rB5*wff$@(8&dOtw#j1zZBqP)4L2Ctgbc$o3YJsj5lio?{SJ6J#Uf(QgzG1MyO2ir$u#mC1t|&JhD^{z8Kly z(mT-|_Ac>qXIRTCYcm(*T~q56%{p_UTfpk7mrabY>&T8{1G);EUSwBojgKK5s3Kjw zhvinD{DPk)%+#_v=d<`sjINfcX-G`P0e1Mg(&yQETfC|CM@By#3rL|kF*EAm#7yVRDnT(spl=0uWwhrwScK)WmRYSbXYcL-cs@8)1S?<(wqkqggLv!)C*Q1&TF%OiFT3FX`&3I?R~Hxw0JF)3rfBpwDXf z-LF{Ln%!!uhY!!<+Im>KR!_Amcp)>;sR zbZ!8ITL3~}OEmIRGQ%WS+I-*$Yr#WQY+9x|TTDmT(`)EOFe~z23x<9IUG@I>E6qwh z9n<-v%O-Dd#U^B)TLbRy7^K5D-zMo692EYERI~H8TTg88o`vXP8Ik^#9)U#p3UXh# zBt{evVoM^QV%JhkUfQhKW+Z7D%oRx=*>grm%m8_K56SY};!xr`8KPGF6NS;ur11+5 zsDWO|yo|<(S(K}6sa>@~15M083|G$gkZ74*-p+iN-DYyJJ$lUh6R-(S-9Q)BR3Isk zma3l4(%UhcDerhAd#}8JVX8J=c{zl#iW;lC0A6#xqB<`8CE_nrK-Sc3!B7?ahytTf z=owGI<=9O$)eSm^Y?Q!+PT)TgV9z{k} zU1NiMJ7v7gtn^_RgAn+(d;17Eewyu*fE6tCdZQS~tT47j#MGv1-bTF4J~Gf|3uD-B4T!eBmrwa;6a&Uq zzQ5jfjn?3VYZf_+{-yCbd6;(?#tGXF5$ZkSFwzBwiFbTUo5N1;RkHt@8)fc!o|_c{ zT6R8UQ^Feyt`M1;PHd@p>&XS#AM~njS7=MdeX3a{_UJmO*-)yr737mvx1c}YH32l+ z7pg02lMckck4ZD96r**B*Y(gVdwRWUk znu^%uqSTp$^(*6Y6%Rb|WGo1`RwsU_md{08+~vWiO0Gw4==heALsk7_cCBge1hwZb z&{wNA-JTCxWZ&mC4907#Hdrv?usZA6&)L+bo2u&ItLc`XEN_}A1l7+OU~yJ@2TkhxR{D9avfy3#TduKItrvXJE*ZZ5eeYUgQ<*Rx z--2bFS=9eaS6$fV2)p_o`Mz)mXv@k=JBU1GUnY$R8i zlaVn9K}ZO7t8+8jdZX@0LwE)Iy38sCB#UM)L@>J-uxH1I5f=D3wkvEb-vyY{mA3kr zSk;obFcVfpI&ZxeX z`_#myyuF}{#u@P{GjJzueyTpPQcLMVt&^5G(i`A2q9^7(plojDi4ltsk+r5_-UD^c z<2q+_oS?296KywgQ#BfHPiw>0Kk#Q8mjcs}WTTcM_JmZ`L;VY8+RU=1n3=ZH$Fo!- zDZXg%9;R*??tyBA<-_Kh|Dri*ssXJ6@AVhp66zk*0eT$m_vQFcVk%6J_5DF6-ktZ+ zv_@E;M58$7_DG95(H2=2iYReHj7dWZ*C==^{x@q?D>>$#PA>A3D9qt(?;83Y69qz< z;|760>41_+pM0W*9x3I!NEYa7R3V`q{P#^z>Uj;x9~VK=w!|?78(YdG?4pkM&_+pX zS5?x8(Z>~f_XST{c;dNScNTtxH7#4%bv%i>^NPHLsWGpz!^+Yj1OxFBI5WJdWA5!m z;M_ajWGeAI;n8}d+Bz?2*UWh)Ej+ZV+T(@Z*LWVTUnOD@vKpk%<&6>*OFvlX4G7*7 zie#UBykS3k%X{8C{OX7%I4(5d8{Hcldtjf7Ygj*TSxCk(g*(Q zviikP;v;E{P*&J^AA}vVl{ z0c>7hEf3tZY(1bk_4^zi_uWf1wT=9+BKain8*qZXN*qr|-&IFNwAOLF3Krc;uDXY&DTuk>c$Ocddiy<3&0em`i%n&Zu&$^vrCsxO ztP?4VsIA1C{#=ziLz_mU40=V^?mQNE&_CN5^IJVPALN<;q^aB$w0RX}HW@r-6`5A`^gExXqP%u&hKZOEC97F)Ui+exJ zjuKQ{&;z00sbW_~6$|GN0w_l99jPbYn1Jh|*l`MHP~czBJ@UAVvJ4;wED0nCI(&fd z-{?aEYtTE8772#D2DwB}LD8jws%Dq`Du@Ep%$H3V!~;(uMm1;cqQvV>FY@^RVej4J zqpHsR{|p2PitgB=f?AC=wv1v8UTUH!84bDzCrazRRcnp4+G<6e0jvtaOn~Vyfws1K zdU~PN_Shb6t+f;oX@cCX67a%J0dF{)0YR)J0U^KlXRW{Y(rKGbc)6z%o0FUCY}2$D`ITx4HgEq zN+_yYa|R^4?ye95<#}@!B*q@$V12Gogn_2gZmDon$5LLM z%6r>omxc|rTFJUp1LY3j(p`f5drxAjN}T+u&tP5TTZOrjWfjL+go>>dDi&xgXIh-_ zb%Mq|R@q3eIpHTNwSVJ;pQ)T-e&-r!Y}0wie1`Fy7#dBjvtsl&vDCVutrOoQ(!hyb z`kN>ly3`4^H*GwqDcdL2CwKTstUj35enb@)?wydVY$X;CQ!BMZWMX0Z)RjQE#Q#W+ivEb zY7Qlo>2LzqSjWPz$h-?~^h5WzZu&CPjV0NH!I5r`%`@;OZrM(K#84d2OMRux2}jDE zaI^yEjf~9hO~Za>_;V_(Oe_cA#VRWnymfE* zA#=yy!md?2EFUEfg784w7rb>BVal&4tRG=h4PDpWURle3Mt#10MgCw9FakQiXGGNh z%n0~DMQxFBe`+6qpy!M}AVCjA73LFX-cioHg9`FCiAi-fMP){|H+J>QxBy;Lyz=Z! zp2U=<&S^&5LM`CXVPZPc2vE>ow7N12c@o-^;FP-b*H zTTcCAsh7r{khj-l`lqCZWnz>x@1Q!ejZoH@Y(%QYou~x3N)InfwFh=I1y)wiPYhNi zl&e|tk^>cQzF4~Qy!MW@#Gk`+H^1TedO^H$N(X#-uuY2v4jes`+0H&?sBB!Y)t_Z> zEPdWFr}=l$P9;s0^@x*PO=6A~zWF8TCMRv?hZF1m_e(ORXZxNNG|OLQeqexNGYb0L$9qHuQ{F4ajUK@<+!cGH4Y=bjt&ODP z3(u_iaLm^*3k+YMm?X zNyoG9ZH;7Zz$CSMe5=2XGpMra!q#>`=Scdp{viD2(JOQF+#J(~^IF&6Uh?;en9Q;_{X?o_r*^5GWYTug`KPLH_Lh&ieGZn% zl6j92QJW>d`-%=pB<_l&FYX^pop(0TR8#&pA4NR&vpS=hVO*BeS{1EXgs#|!7v|wr^3p@bFPtDvzB%h&dq_QysBdPUrlyWBe?zZesluOh|eEfYl z@x0mHOnwkPeZ<3OX~8Ur9+Spk3SwIvvNiAInEXO4VlSxx#@z=@uI4L}an(HcuJn$vCCX)6zkQ$eb`Ho)?DV62f+e~Hr^TI?) zToRf1fT>YpCh5vdk|*S<;6I|xSC%J!9nJJF&HZ~2=3fDI$$~h9jQ{>z$`#TT* zi6_O|*=Nw1X1H(W15+Q$?2;nxS8MKNp!|!i`Lk)w={;NX^B%3y1`@bz%fOwp|@qmMB5 zZr%CXw7CC>nva}m@*^0jd1L$###5=f!o zt?3Ua#jr`CrXrcC>7+Xd>_Im6;sdf3)%2qMYH9|7t!aI8eR(2dsyW#ZbK=DFKH6{Zt5l0<6pW+^8yRc>=TRl z2G6m!T;hEI@tL}ZcpVIod75SZ{v-Zii)kjBw_atfOk7xKj+)|3I?}L(t&ia3*&7q~Y2Et8F?;xwDl=1ai%cl@k0htKhTP7?90t%o+D zt=t>OlXoa`v=At%gM|s6210B$QMG&S(NOOO)zu%A&Lmy(>aE~=kao;eI~H~(nyf5U zR%Sd1AL{*%s0IDeO`o?$VB5^anwzwVcD`n%|!X6aJu|M3hR0a zP2s$NI8G0%^v;|RVhXDz@VrixrxIN(W1q`xqapz zMRn3w%gl&lv3JO-P9+A)d>3dvqx$V;sV=;^%x!*Z$ed zxrr6o(ci|+_X*`)GrLxWp((N?<9cZkjS{sCrC97oZxtwVy)8Mck}FE&3hgFu~91}|MiS>uEE@c<}xvM+3+49epakCp|Q$9J3GnFvqt0MXK zkIJ`yl-e&vw>GMrRb^C3;(N-#Ra#;Pb)Vg?oNWWH82}69TcSKhWm{|>U-O%T z;~VbcX7}AT2=1(_ycIA0WpUSC+^b~n?IpS4zTRf&n>gGwY+MnKt9_%go1UV5Z>xQ3 zKTsjQR%F}xswX%5)8Enx)fcjmx@Z4i5ms@8zTJg_Q#i1-=IH=%0DnGRQI4{ zHfrl|mQTb})v(&0M1(6KB7RT|5q(~0R9_nUyl?6A)SsY_VVyjCPUnnRDdGik_1TWh zc;1{GMTD5KK54p9Y`+wfr>NeyBEb4`TrIBgP$i|2^`uc!)SrhNJ7^vbulY6ITd_Zv zkFq2P4U&sr7x%7h6?a~QWA_-thuv>pM&nH;YF!%)XqTc~k$0sW|NhPk`t(l3-SnjV zZ4ZA`1HeK!e=Bu;-}e1$i6ApsEK|B9LRfRFsYp!T?Ry2H2?=1veITDCzO1V^H?%n0 zJqh{5Bvhdz-fSbDPL{PSJAhuW?(PbWi4^=5Gb+PN%t1-t6MP@YiGMIUiy_YW$;G{m zAKmv6&9ocg=9yE}x+)W5W&iT9$}(hAf$0_%l>3b#`Sy6>{vp#>noOX1U!S0P3Lj!V z&^=uCBXLj*RVLR;2B-h#>WAYw;YHr$gIK=%xFIN0eEwQgyxBd)@`OE)?z*W`?9VK8 zm7K~lZsUjoMmRg5Qdj98?B3T&zFmP>;ahE1ck#hnm0~@5lvJ{;TGcZKO$Y0`a^@2y zpyO+)^r-F%&aZ4aKzW(7j-cKDMTsk*?EhkkZg)jtsVECU6wuare0UkfW7WwI z=R$tU%H(+x^_g%;U1c`3G{s$;{pRDL7pqCX`Lp(7nhv+Ob(R-p0Lb&=sudP2^Hx0i``(u zH;3*WkgE#jW4-I(Y5X|4YL%PrkK_I&anG%38`Rpgu@~DvRu3@8OVI}+S96V~Jz1cm zfiJ)x;9R>f7sWL!jT!f~!VU-^CD@z@y|`qU!EdgzeuhykHe?(w(FAoX&Ea5bXDl;} z&g`@t+P1Mb2TD6#xSAPy^maFWd*9Aj`sTjdqsI0V*M<%w0FJJC(V5g@1{I1-EORW9 zjzJy`KOb$%g`6ovRUF&b>}B;b*b-T36s5X8^{(+|c3q`gk8#$CQT+2N@kX#OK+<}< z;k6Pqp>{V6F#JOWG24zWH?HV6sJYxu2um;)YHmg*PWwnLQP%indAdn8y@sTNi1r7w=j<@CMo{L*Rzt=iHS|s>ycn8SEv1JM8 zl5<9PXA~!@kx+32Q^l3E(&BP^N)0%L7%OwHQ(6}s;Qf~eHqB3cL3qR_77m=;J_TqL9hjA{skb5wik8)|?}qEsL@Vv3T)gKntno?~L+rDSr+;?ni%_gHAT+q9x2 z_mt*?p{)#wSZW#0gl!+9z2S?dZDnr92X5+Ov{S0gVH&2f`Y^Z4tQ>z*v|}x)aN!Qzf|(CK zi{TvCCK;J3bz(KExbilo`!ewewXv87!pkDhguF3oN6qqk`q5Ztk}gh;g_p+$wfTO! zbm8sYgVouVEip5S1z6&b>dtDL-dbV?I#XPOC-99?u;^Y{Bp)uKaR3 zww>p-B+SNASCeqjMhe=f4DMNA()tNWWDDJ1G&|65mI|M@RA6gA<~%7Xlv51`(gaf# z@Avyq;>iLf7+E(cGXE!R&y9_~jGIO%QEe$`W z(}^BRQPG1QPeKnmKURFF? zLXQB+98JBX`}d-$S1yks(^>UJn>vpdqQd3;k~8fINTRWaS*gs(6r`!H6Y6hX5=(^D z$PPD?3Q0Jhe`#jeyQC>$c;Hg>&N8Q^oi{u_Q)&9_*bVsj1x1xR#kVhTst2Db!iaUT zqj*WG?mQv`6G0b@)^G*rkCZyyAEDV58oR=1j0r}syaMAgoa1lXvgIVqEwuU7OL!sM zcSP~{5XF3oQ6@wuslo;V83Dj5=kD7HYT;}}WS(*%iNjhbcqU@_Ourqg z6WhF331_^AKZcr@WrpD30Mg?qV+seCAFofnQlDDSwU6`#gX>#M&{qKLqB!XAna&QS zM$FJ5ZQZ0f;*o-es4k<|X<8NJS`*vEq`ec5)Q8^VWG=9K z?udHcY5A6BpHx?U>Mi7PH1#qt>?!oyu7ZtVsLP2fi6rfJcYSIhh7RjWPD=_GFWp*Ez!qq>@$bhncWLYLc&FucGb93a7lDw~0uf}q*0VQP zmR*{;|0Ae{;O)L79n<5c>^NFwJ|R_&2Y0mXBT6nw_s1#w+F0nr?A1iz+Z$AJfm@{P z&>oymOTi>_md()>A2UMCG!P9fiiQx$((W^*a)F^7(BVU!=+RX4vodw0&?~5loK`5b zB6}#6HHtcDO=&uJaE`3Gm3YpSr~Q_dnfRQ9?9NW(j0h^wV5&`dW8mM z?#;{G--odeS&WiTsazbiH+vcBO>L(Al`N1KwnDlFJIOfacsIx5P8@%V{t|>lg9IFp z%Eb4S=O*iIZ65Mop)K?+`Gv4bf*+wdKMRu)sI!J1U3Y97^uwb?E^ zvd`;SMR>8T&P58%FIr5kwq-w%Dp;JPoGiJ)Abz1JR_&&bv~ms)bz`bnpvhqm)yfUB z{7MDWtQP@*u({%<+)mkv@y`CP(Ze*?zcYRS_8;+Lfgv}d=TZ?2ClF2RqgZHj_Tk&$ z2eo30F`CF0oj!_#rg#9N!F`=cujo4~RTY1nwNr>d>2Z{QwGi%r-aDPOO?$i+QbKQ{!YS+5F@*C*?%XTL1<*x z0dO<8afzMc9O2rRARcx99j zLPfS^pJ5wEg6jik%C)8?bc>ln%zb3YM8Tvp<=EaEc)=M2*J5I8=c z%AfIpbf8y-G5)@nE&A4tIFB7UYj;W_ywC{Jz;igm~wW!f1=Cp6yD> zRc1QdMcK=5{`CHlg9y_JH?2p(jU;2DD%}(~x!hR&O;&@DO6Z&R#q484u zq2n!ISC9yAI$wT=9k=Pt?b%9bLbB=gEU{&AIGRcFC8Yfo%lLEu^6gZiV+{t0xZ{S} zusYm-WPDI`MK*Uif9g~1^=R*zXld?reY-LLEq77Br$^z)P|8vCB-1(&cae-W2v1^q0%8 zbTda|7efb+iHYuC#T0(#YiOs=oVQEvu8d`5okYRSoXj`mX)nhhWn&qJOX>Pp=HOgR zQr1cR0Qwic61ga8E*h-w_+F3WZ=1UQ@E6#N*r4idASbu!Rq59C;k7~1=;2w;_HCev z8&rcRW-(P^+-#eTNspgU(ouQRxr%?377#J~ghwezv|H^S-hREmU%kUQysnbPm;PY6 zZF_%sYN!qo&qI#!&%tkjccyy+A=xUf=0-u9=;+qFCuKg5M2@L*LsVzn!btikqihY_8`r_ z3GN9?;v=anD%uCbn{n2?guQ95K%y$W$f7RXn(7r4kA4AinTE!& z8~^?5_l>XhgKz7>mznVwHISv~V#K|aDW(P~FQc56Z)-l#P2j8QQ!nCecd3;-&dlE6 zfL&0!!UB&u9E(uAPvo4E_@%K>j?bTEj(XDQ84*n6n5Hji&qQ$2Fn|J@IzJoln`+BF zt91g}DOj8vt6HO}(=chP{GnS3{G~02Bb2ovTp1*#iC143O3cv7wi4O+8~LS#)=*vb z6}`I?lSkk~vSdVZWg@3b*QkOw4vGiy07GX}r6(@_fwh&!Ql*vIhuJEQrjLrIu~wE= zx*=R$Z>Ab!F5n7>ynd|p`u7o5W9?e~?oRx_1Ds8~Yj&?ttrNma4Pfl!5M8ctuCfN$gjR^Lj%qxk@V(uz|2fPlgnu6YmVoaz_VxPMX8M-1J0i&URlSU!8%<9WX!l+C)r3!9OE95YN?hhSga z`XJwQiDG!Q)_bw$&CXBeJ2O{C`mI1A7>L^qjeIO&PVzsfuhC!MOSSnK^slT>52?)l z6<2SzPd2YVXAyN%VVMf#|w#L?1-UATVA}X(0^**3^pU( z#q$xJ-B7gk=Ec24>JK$Dl@re2=B*LuCyUt!R6)558Fxx|tI`#bUWpk9Mh{Zu1iNjc zHcDHEMd9TvHKbOmB=s`2N(?YRs&G&}$e~CR_lkn?@t|aRq$A@O>H%(%qowH#Vy)HR z%bs&xsKl!a#y|LOr}-YT_@V!(4d`7?~nIIo$$kWC~KqY(U)m;R-Hs6 zEZzL3ILVRpr_-Y2A%2sb-?C4#-_L48OIqgFiCb8A1H*OG z5msH`W1Qw6!rt1dW7p0;n6-Z_eQT{I;0mqAzV(VZTdqZ9l_um0CwT#>qUlk$Ms;Rj zak6rTQuEKwm!cqX8=C6Rw^@7zUUzhx=MK)V6!vtOWZeuYnNjrK)H8v)M##z&V7OX*e33X zJ3{2bXhf6eyWtP0KYq-+*y;*Joq0nlGxhCQI4X2hN}AS->Ha@x^1j*F)n^R5(L0?f zHPkbjt{rWf@(_HKE`5C1Xs7wc5Cg|FC3z)}Bb<3$qZ?`5bt zj&^WeZ&r{Zwm+h6yL*8r(T6$tIO(aCGt~VZTx(|{x^269Y4<);`Xg@0bJ;xz&yV8h zWa_eG#iY;hH`27Zs=i?*QBo3@tfwzg2V|2$Bvwj#fc4~k|HlB&}8E4zDSv^kZrTbE*KFWWP@{{QShLERED@m_gs|pR0r-lB zF;Vz&GyTtYLoe9eG?Md~K)ERmKxkwu3h$E9*SV}c8UhB=KIe;Mu8%<`cx#&0r5ZGK zzT!-sNNGd2GUS}*GY%JZ_BxZ!RSg1W$wY<_bBHtfB);OzyXAI-mEtEy9#1s6bBXXU zYfuRptqil={lI-B7VZL-RhQ}-Uxt5{x^O3-LY<3}mD7mD{TYkKAHvqN|IYQREb-@7 z>a+yFk?@k#?LegvSZ*Y>5cxaM&DaCak?^ZA+< zWvv{DC;!SstdPM1#o$8S?_BLJ(C4()p2AhRDdzeY#+vLhicL6($71b7}gSEvi8*J=fGkNCNIK%AC2_6q>zkwMEMO+>|Zz<>2uZ z;?n7KyPLTt#JstnRXo5yH)W&6YTkA-8{l5M@sC?23Ad0FxNzMlG})uxqMG7wBFCb25=3ZiD(b;WiJ2tlXG~|h!mdxsA%17(@~%%x9sg?P^3G38c~<5UHi#&91;&{4+*kajnVQE3Hf0Zvh1P0` zYkLJ5VPXiTh6irgNZvltytQq5;jXUkrac2kE>6B97SO+u>8bCu^6N~C(o+#8wLRk0 zP=sR%dr`GU>C?wz*IMHujj`%-=>s8GCHyw+H$YcLfFT#VajK3%?k&mr)q) zU{{ry5}@67ff#-Jv~Y~uEsk-!k7Mkg`0U7YlZJ0BmN6E3^By3mR|wgu4L=5(h?cF+ zVQa2QZfT{a@z0xYidAi-$=pZnVM>nJ1t+(h$q|8 zDq|c~Hx+;orV~kN=FJjf5kAUocnxb(+V&%nESI;uNlnP(3b$b~H#()CF{QYvXH0iH zE%R;gHEzQy6Kp;cY@#_W0;ZArx=%=*w81wXF!lJ`NO|)CQ;xrspj!`|>I{NzKX599 z(%i~M%0!U)w0Ou;4NqZqrXUb?aw(i^9L%rQgYz7ITOO*Mp@f)8-G=R~NW(kk)$$?C zmcI>Z+B*=EBVaPM17{B=D3*E12%0e1k}YuG6s1Q*y_^*7aOt}!rpua0iYR8-$+AmyEmDgr2rv=;uu69us=_excncO&RxN z6Z)YPs2(}LX+n3K&{y{hecpubGNFIlFZ8!2w9AD4+kT;wO=zbHy>GwJ+e~PO3B7*5 zP%TW5IC9)Lz->UPTR~c4EW=J+Tb(m=s!Vqt%(xneJ zWxvVVX>u5kLH@c29}X-gxD7qZvLdz3>jDFz^6fhDR;m9L@JEUFPbT<+Jq8$r_b|DP zNWSAFFNI`M_ae?i3nGoXzm@1`K0i)Y!go|_hGj==y`;-vZCc*&dqB#prUr7}PfLa5 z!7RiiJ+M{wHT6YcRLFMIdVg;mA34oG!TS{ox0lf`_WpeRyz5l2=`{VqP}8sn$AJJu zVeYZA-1-?Z*UHkaE4`piS0{!db=nk-G4cJ*^6JyVKizzWZF!`1F1=>g5HcU+=_ z^~t}ZR?HpO}j8#wggIIV)OdNu@v#8@P z;{->qDBip#_abAAY1~vaGIPb8kKNE~hM7{f6qLM!r6nQKb6@uD0}U(KWpi5Q5Rh^A zG-XR=@M6~Kx74PbYJ`cCypIUc)Kc32S^h8ES$7%a=^G2ZtS@{pE%&N0ZjbrTXxbf} z9`M7a%~w;A+^`9cn|YOb8Zz?FYR5I8P(1bm=4Qg z_s)-*No#rYj%0mk_>-C4s?XlF@QfD9z05kgmzK+By!=C(2R*-2PKoyn-%UNQ@8#F? zkk3j}=w$0`IM%7=k73v6>~d(2?k7ymB?TTshi>&==4tkg+eennQN`!oeK7WZ9Dr>& zOl~inW(@@mI4(Ep=048McYE8&eH8gatmSkH#-(l9Kbi!tQAQ)=b-fM(+ z(5vU&`y4MtC4SE@@eaSl%~YuIzTT!Rr8$%|PVzAI0NL8L@>=3>!JfBLzxbz%rJpd1 zs95^3%7Ku|nf5*d5?#Hrm3r3KeC$j*0mWXLb)1YM&uU;q!Z|0ofn`B3(bc8a7_(y? z1DlO<&c>|L`K*jW{F%$aP>fxdZ9sk@+>9K|-;f0Y@Yb?Bs`sA6uWdO0wT+X~bB6H2aI`%~i)3>n& z41`dPbM5lfX+BtTY^eN;U?6IZ z=FTsAH{m2*GtG1;tPLE*%|Fx$s+7KY6C?#2=6j>q#CK<{wVBwV^eRJXWM;^7KT*6v zWMsxg)1EaCu(k4YBPAfZccPhr;Jha)XArY?=vLEc8^LKQB{=9(G#7-B)HG_~>pC4F~R1 zku^mX$v0LGEqpor3G}*xVsp#k$BfnYyq8HL5Z+c09p(n$fk_0EbC69(wu%yS zQ@I$3wy_lQ+h+0)7(e&ZC=k|jwHRW#QY*^{@a9(&M~IBH*dq4n@odAzT)ZIXN2x4J zdPe(0|7=yen|2Hjx1ZO@BNv5EJB`^==7E-fBDgc-*!XIC4?(cFt?M9m###3|%^*z~ zgCpsvhs?Sr^3-tE<|&hzm5n7%^Viw5l@7Ut&%93ZU)$~L9scWT`#Rl!-DqFO`mb60 zdV~ME-M)_SUpwvVK>t-Mw$PxJ9V?sW_rvTKF`F@C4`m{ktAv_m5$ES^h!7(-;D!oj zYB7YVcEk2;@-1e~)$m`Sk-3=*doj;`x0hDX)yDGwlQO$8kieBMT3UX~BQm?3x&-6F z?pw$r9^ZkUx?VS!Z97l`?|Fhit+^d*jfpYV?mfavS5uEVyOlg8^JE=xn#ah5#0j{j zJ9rqnGh#+5fc98wrOqmLe1Neng|ndhl?t{`YGD;~o?ETe-3*@VxOfa3SF~YWUHA<* zyunB}8#MkqzBqq=MCQAQ^EJVs<@8Js$^K3tyT=+yUU#rvV2lW7wUY4uj0PmRdWl$E zgq2+Vx<>gvLc)eREyD>5$}-c~D{@cmS2#CK^IhaQ2~-;x32zNz<6da|Yjr8k9!ZKC zS!QR|*O%@mO1&Zpmix6-n&u}oKb>3UBp>C$ZtTyw>Pq`h$Hp^fVm}6D$|2Cb!!hvB zGOAa2N9OK9sbv%Q>dm=yQD_N-p7u4EW_HQ0-5j&tOEh z5Qi?!9);c0`z~9~@&`rZR%r&^#(@~LSJ@9myNr7t8ZF>OCc72!Q&ijLf4~Z8x7-yg zCrFLNVvMzhaMn%Wp9sXplGsWy#iiOl%Rah+GCSb7K!{Tnf8y}I)CrF+@s^=O$zt6+ zm>He}vl#z6k8jH!of*)(>8;^xY&6Wrc6gMNY-5GM(~(X~m+B_Tkg719%EzeZK(W67)5%xV?D74JO_8P@4Ic)CqpP#)*3*vD zXb0CVF&?qmp5ivVAY)E>YAx8m-o}M=hRsRVCLm@rXC5Y-YG`pbRLWwm$fCjX>w)Qw zf%bYU#TVH=z5BMnohWEaOiit1L%j`J>D|b>m{lYjRgXhBvtNg5t4mZK;a%&U*`(CJ zMwUHV>Uiah5G$FykCfU7DbJu#jSeKFvpb8P(!b-44)iD#W(DwE6Zv>w(?+i(7dJw+ z97AN*QL*$?BZp%RYm891H2siiO1LW;ewpzBdM(wZvvU1j!VrlS%CMKya+L&UYK6zV zV5CrZNAB}RYJFDvnD&1jYGacx$AXBvXNyb;>V`@Hr^YiVlk#ef{92e5CNy#aO9 zj@n(_-fnilfpmBanEfNqirdYK!F!stnxd*n@vcY&STEbE6hj#nMu{rYpc44w56ba1 zD7iOaiLTL~%`Q}CzV#c)JlLxv0ZUXv7eOIFCc_N2<=$0NIm31~E$;85lqhpwshfGm z2;Dhh>XrTaHB=69EKX^x4zriRzI5GYZ-JJ3+?d7!J?hjg@;0&Tiad+rUt+te{cTmj zE)=x>vkNDX1?V15w1#-!wiQ*%meg!W6Mr)1ri|<-Q(GU48=*#SS zIx}%i%vSrD9fif$^~yL^*8lCn;ZOWzRGWo>k)1SJaBcZcAEa8;EVP7 z_j(H3h^@JQ*V~D~Tc*$p0qxB^8@yQc&q}MU0Rtni(BveqPC1{;#L!yR2TqH;UVC5T z4*-z%5DmH|NkBnh=(^=fRF_&doGNDjZLHp$%9b;>>V9 zBkc5HW%2XX1&`fk8Q>9qz59)dj@neG1@Jm=5psN16+Gq}yJ9dB+3>eJ*P_%n+0?Dx z1*Ei8d@A4cMiFb&(15(>F=1IMzAdcX*#vMHXOxusa$26by1RA?r+6B7J>X3Ksy6S^ zr3|~a5}C| zS>WaJs)vk9mH;JUiZ4@Vd8DXzns%G!%B~3qBQZA_u`6JXD*#k&_WKXvv$SRb0$A{; zTA_1Xa0hsg;7-J+>0l0ojvc|u6bK&w?x}KSR!6x7D|4AV^2VHtbRdEmX?tQ5w;2xY z_PUhD_M~?e-KpDqy1lpcHE(NKsFfbW{W*Tw*iV#rm*?q!d45PNxt+Fr=d_@gqj~+R zN<-o+`GB7nS}(q+&IeqWPcc9#jt>HEnR9-rCD+0F-Z%I@=L`9=2dnJ&(Tprp%+Kf4 zpcJp>10KtlU8}O^62P?NO+q@`lt0N25gv)}Vo>iJ;=(2e;KxilD&M`%nPe2X2Cd%wkq+ziF_@dI82 zHT2eqRZ=UMTMoj4V%IbOKfW5wz}e5EcKu(#SD*9$Hom$F)YPZrtIzpAiLb6^jg`Ib z6h`EM@YNUQ14bi9?cg>kP9~tRAN0S1ua`7awP5!oY4dsdQ0w23a|t2|n2@HCeR58G zUb+6p=GwYXj{f>kF{b$Cj@!T7Jl?trL7m<3{eAJ)gZOOhioUr}cx$y;n=J>#Tc715 zbsmt_A^1}r2(?hyeeu>Ko)s(Q@zx=-{O{qd)xPNs(9`0rA#Z@UHYb6~2?sQk$6Ko) zgSS??Ym}}CZ>_}t(|Btq`5?VIo_nk<=6bjfP8Q~RD$0Y!T<`o6nCo+SoxUI5`n>(| z)+ZahHQpU?yD-aeO-ThtADmwZ+PTYeky;ub1k(B!rvHS~UXofrJ=fyfsr-bTTjDU3 zfnQI2e=l>1_Z_;tFkb#89QN1fXQ!o&g7Y|R?cV2c*pKd^w->jnN(GGc0dUx-&1Ol1 zS@b|SY@N8kzP>*W`%H@UmYC2wG2Q`i*sEs2vH1o^`*B8Q;_i^fRq}D_1R6U5?Jb=I zW&DtjQqNpSQH;l~=G||H84sp02WZE)DG#%4QSaniI2}jX;=ZDU5-rxcp_#^cKim4TLNJAU}4ZIgw9_4y8=4f9+EXW zYVu$bvJ;$#Xg4Z3{|fuZ2gGM@w06={v?Xt%CvU+zWYj!^&ps9Wg~4a9LQ+_*_W<~8 zEm=vkKR)}{1ZXXzJ!;ShWG%0x_tQA%p;lRI2RqI40Ec23?+MW!=0mi<9?4wX1ETGa zhXAOj7>IU+>I;Kv_(8gD-8sjC&pw&Ytc$J_K6_o_y=cwa#Aobo{0?-rU_Yn_KKt*i zzipIX7%Mfa4Os4316&2@`HRn~Uu2NP($cX;H5hE+*)xew70QLL4)EE(QDz6iXAk4b z_<5&AQy)9cBk15fKD*Q6v%B*6>`fM*z1QNiUnGH+kBg(?F&K5 zJCm#Oshf|W2jDqvkS87DyR#mK;rTbgY=^Hs8Z%?&VF8%k=K=tBjJ=W$wv&wCM>qAV z+qMVz^+J6p0%<=}*$59}!wn)9K-#jM8<4j689(wu)q0;?dgnggV_Eq-?a5&OPzS3*zP?2btaD@2uobcB8t<< zP5#nvR`XAInDu4qIdrFB+dBl?20Pwfm)g}6wp~|wr@?HO3A4>h0N8Fst_iT+z7JrV zZ9HqNjD$bh7qE>C$B5bku#IcaI_mq$c6w+Y_kue zHbFKz99J~l8XdHXN;jWHjt2Vib3ORbk4EYqKtEOs`q35(uccbr z-c^{>axbxGvjIsr0R8yNS#{y1{sy7iZMN1bpc7NVo$Og2!6REY_06sO;y&7Gc^-AR zE&FW@s9q^6DD4hsOc{!9N71_oYNJz`{lF zmBf|B8+HeH!_~wThk~gASzzEm1G67CVzV>{x8lbbV{^0yO|cacilad~6!3;xyDYfM z;tgNI&ZLRMz!2B$^DG4wFF!z@{NC#zir|2+nO zIL4GJIpdYlSagQ}LHyx|jKO03VI2U(3JzFv9?D66Ul?z{?`Lb!&5{0J7hX{pUMaT+ z%{zTGq8O4{K?ovN73SZBC>xmJ4_tOzGZBM9be(7$N4&rwf;QTE1ih8Hpxb?9WTtKw z7{o;Z2C-3jC8HXJbX!&K>;gU9hPEay6>qs1;gT7-2fv-vBGzw-O={%Bonm3{SnfWHI0jpy|{i$xj8f{w8g(#XOAOxsE z+&@~>;ASdcRNwu_jlnb8CcZDu4Dh;o#?Wl=j60g%uWH)cFTgV{G8|k$B3=U$aW_cB zz3g%okciuP^FC%R#ds;;5GTSrQU`@Yysol+NeB0)uGo_zx z+6XktZ2%m->r5y4E1eo>+I5E0GLjh(Z*tDGL-~|(|6wP2fAZ&`q_%dc)G%h~w@?JK z*F3I%l;V+xI!HQMsDqyLPcx!h40YI+9R(W5+sZyJ(72BQr3S(~mbu(QlM3tIztSA7 zi4&DWm)iY5I}mxGAj2H{n{3ZC@(_2IL%8W>DZtTD1)Lf4ux(NCt3WlI3-ZR z8F=<2(YTZSQ$#ZeEr}1v;pV266F%m|jQN%*gIhR9li19enONnW!EqV#?r0ZKS!0t^ zGn~c6TE@8<&dUh!mi-ejBrm4nV^9BRf||9=H(YRqf;0Ko5HFVbp(ZEq0(SN^P#7T= z!K}i~=O( z*lB)I>tPN@1-xTWnf^i1{866fXEoC3uEBW4X=*JqdTeW1(|pFtxXzOJ4g}#R0w+~l z5yBkunQQU24Lh^{3Bt#7X_`Oo_UwG%>#@{hCS3TxW31g)5Wq%qFu3Zof(TBF)C2l7 z=rz-+bRC%`iLKgN_V7+K2GEjOXYr8)CL$0a`p8Kh1$lu$WNdqlIMzX39PMEfUzlBj zpqgDvIyfa9;F-lMpaDajPE%G{hPT@_QhjK9v}u*WR$r$%(%#jOuTK;06XWOG_jT4T zcKOG$PxxxP=7Uj;BSOTgUHDx{CCq}))WiV26{Z6;SpmHb?*@&1noKP{d(tf^*lBr( zm9g;E(aaSbWw!9(M$<&Wk1bb?mul`41v+?7K|(>WcVeB`4}$%yFl;{bbOsq2`-fJ( z&672`3wk=9hfjf?PE;xsjbujk@S&%TJns)ZWl3oldgJf(my}fmxz|yPRlt8D=-dagH?l4!HLM+52i=v ziQ$SOMTEeAg>4$*34;28o&C)cKYPQkd`_c(>sV^D@WkI`Rs$mVfE0!vB2#i;aR>LrpCv*b&jf8aKe{4SqZgJpV4ZeI+v&FA+wh>7&4k>oNVDBKy?DeD3)l`@Db&_3hWm`*Q_H~qrMg6 zDM#a(+xsDX5s=T2s1Rdu_EN>@2NOJpf!|+5dC$@~F>82Njy=Z0_QA$l=O;|da@7GO zlojs&kkI8!h`AR65T!IJ3!?npY0yXO1HKf4D9f1lW@`bT2jLCY;@pl; z^S%5>K4R&&^Mua=v4#!d6~fcbASV7_FxI#)zn5BJ(6q}9n%4G%)3RIhFOKu3N#^=u z9N4F4s9!*dR?+1_`|vJTYp!*eTG>ecK5y?(Z`{IrWR78-Qz5AxO9gOYyO0oHJ-D+N zK&Rg4=*Q~;(C>x! zVLkw6MF(!Px!>Db>;tv?M?XRB+)>WV8c=oyVE02oIST+gJg`mRi`UE_iqOfYx4rMG z5FhRLQ=4%C;naF3&AW$;jgas`4=eK?>o(C8EuDXTp@mcYkY8^RYKXsS6RmmKX}N%R zF>m~P2L!4P^MR_jDx+)sj9h-T+vCjaTZB)wYw}x^U#i->f!{nnwOXl9_ER6tua8fa zK~4bGrxk9#Kdz_j1*XESxu5B6bMQ9Rw!Z*k8)({(VNKEg;z#q|0sC!Z?t?{(64M6k zgI=r32ke6~J&J$>g2cY060fx-_KEWAeJ@|?J`mQI``Y@Q7}T#WAF}{#dqgeyJuz+l z_QAAHCqO=73QN(mwO!^9|6ml^DcL)XVU9uPYYbDH*<*R&n*rWkNM=FOf;5SRxzoZ& zm}iD%5hmHM;n!QzqvZ$4Z|`1BxMr#i#4(a3%bBrEaJq!V=TA>#pxg@FG3~o5tKunnOs?NRfsdfJrI4$aqWAE0WckF4Gn&H5AOoj@jRv+dXiJNXS_+kgVVEokXM%}dm21i*)@fHF2pTOU8d-|1_Ba$I-n@#pt038ww#uhOlnG1~NSO*`Gs!^ca`8tek%f57~ZT|FiSRr-XA| zF1DCh^ZW6W3;R3kPTf3AXvj8l=)QSz=<~!}y<{C*9C#ite`9q42}y)pWcs>OmnnV^ zszQrAzo}9O@;louKcf5xA82ZmIKuqsuvJhkEf*Ba8r|b}j6Wlf4xCA?d~~3IkUwU4 zS|H@9IL`J4@*3EG_QOLSg9AML&we48&j9k#5+`{gGy&~6%l{5&F223rcKp(AcFn~t z?TCcRd$8pn03Z0b>GYtF4=ia6@PXo^jA0FPs7RWac4+r0lP6&o{+cuji>m2)1vUP;B##$|Dl?^#>j z?^7bQbecglAK^Hz z)>r`K!)G%tCNN7GW4c-RJINVB;GsxyL+hwpWd~@4M*8Pwt_kJ|_$21cJCP;O0^k2^ zr14|xe|8Ez$jd1dSFTj}XT^Mi4mRAZxsCzD5vc}^x1E7+q;c-3{CM*5Q8audp`;nm zmt$65k^5PLdu;p|c;jex*5*=Hut{Sq~5ms_NrxFddMX0MhKX8Z6q_o zARO_xAs@7VBo_g;2G><@pkA`$wdM}D`$OQhtb;v1LYkTO*7 z%=Xf1n!| zI+LHKH|sM$X@YN}bBoZ8(T*)XXc3EJwC&?w(J+@de>%ERYZAAOZU732onK^RE3y=L zU8}h+gJ2^EqBZ|?rale6H{#5D-bp^f6Kh_47iI<+#3Ng=qXIx9yCMPNaY^1Y?Y(YC z0r7Zyp1<>)QNsWS`51eqSBaq}E^1dm20pb`nLLpkSHPO%T zbQ&S9r%)A%J_{AK*D>>d$y)Kq9;71!Pxq1K0zRY0|e9tAKjEij3Uz^w*gjBS>8Y z;IZW_gM5T!$0@#$C`a%xD?(sraYeD*v?a%0KP9^m{aYao#^|->7U69|(FF_^16-N^{uN z#r|pO2JJT*|Fl7t$V94=_>b7ROh(#ot#y)jhVbDOxyxVU=E5+8>-Q|JVzWf(vLxzBl=?hLH&F}ldw=~v41RmS!k z{_ksv5$yoL#%1xIle|aph}1IOBVD-0e4~6)S-nH|Y*WK{aL=~s8D(=j z+{zu>9Q$^f|1Q)P56MPlT7*utZmF^$6C=PO!e)zrCCtk-5B91450^WYl~ZkRfEVK#IM2`~;AqH^dMO{v;ic#6=(pjYN-TF6xe- z?d@dt53p!aI6_?EV%G^O<0Kyv_Rz;uP0=$_>Ogp^+X=ID(oCK%o#gvJ{7*~@{`aPZ zn#^wD5cZ-F^S*a4K|T(V>G4KQKjq9gC0?98yl2%80x#` z{WTlCcHZ`f9-d_Rje7WSJL?khzw~=J`Olh}8|Djc*m$=OH#{5e2)cN7E##eJJZXLs z-0)a2?rbx)YjXc&xFNIt9l{LCkS$>qjc>w# zV6V;d^Q3vadH13jz|=|NlLG_ah))kM;vl!i0}GsaLje`|N4TiRS0(Zu;j5{o4$7EX zZh|f41JCzOxQf?^nG5T~n++!LHzWaFFHqnt9uEM~i_EhSy>G&C0YuM9_C=Pg>GQ^5 z7RfZO!l*1)6GH&K%lIwIC_oo>K4&u;NU+>;Rj}p$scsGzn*P+TUix=wdagknA+W0T&ddj}>f?HxWHG609yD;OS|*YLoa#m&PE~OLIMp=)56NG1 zN~R0+Mcgw+7vn=EkE_yd;(oX)<_-M90I7esfU9zAR?APdj<<$);5clo^;7-N8Prv{ zs;w4RB>+l=#HOnmP*5^z6vJQiXu|ZAUwW&_0CAXUvQEsg5zzLew zdUUd^Kns+{1Hw=?3WfqVln1_)yR$0*GI&GS;nq6aH~(0a8<3OKt6aGd6cGu3EKTo= zD09AfaIY*E1NdQmr?u5Mq{Wp)V>ZW%CWrzE+v8m7`l{fUApuF63 zdHEZ}Y+79FidT5*C{jigL-aQK9}npv|1?BT^7|W z@hzMgSWEzCekuFpM_r!|XRgKS$)(TEv=8W=roHg7+=6AUYCQl(&}jYtB}VYCKo-qZ z7hnV%Apxs}Vw@oB#s3N?SiTQVP|gm$2pewXPj@l<2^pg*RgGR#EQs|ao#s-aL#JQTdt%{kvX*#Q+Eoj59nGrC1)>j6j*X# z_Q-M4oa{6wi_^d+S_)WZq0Y&vdQQvTS~M4cHYb6Yv~ur zpwzq@USQ}()c$rXW_~>5VyY-c?F9vRT{PTZS3FVKNanRvq_Z|~0_#i*!LpQ7<~5=8 z!Pi>HwsaBENPO*=r8bWUuZ^Em0Ent!S*Z;`v@H91s-U)(8Hq1T^(Uc2YYf=Y*Plae z_l%2$wSe|9g!Lho)hkQ|n#V8>3h2TSnQLn!%yk76=>?2O>Xv&fKOY1wG6eT#YCr`u z3y$V;tpNqSH0HxRrqs(r|A*P>%o?*zz|b|8D@+KEqzQ0Bab>#IHUi@na<9 znm)U^;=#Kc^#v;dR`4YfT7o@xONP%;SLz_`bj0dvT$v;~tsSH|?j90n$R_Bk-=pDs57HQ+{a92iG7`>P@Agfct&{jP3r zEE5Ym7T(z~OJwdX2!4QdBIeVAIR-kO5(hvbsa|I(=_V>Qi>St~X@y7~I%$1XOyM*=nQdP_72Bc&d zefwSP;$Qj}>nsB!L^9$-b!ufJ*#;H#UZO0U&R_>kx?7d*NYdE=gRn6H#yi=bH-i8J z_c8&-W8pgl)zm~4!vwO^18b61gasJVS0I}C#W zu^T1w4BTtPFOF0{pSZ+so*kCor@A84o#6f-d13^=sC_D9_7An8seY4ru8pJg8*{TU zC!wr)?+L8rV+_~H#3VKN1%q$2bu(}|Q#a%6EkxafoEJA`UBa zjo(jDuyu>Q?eLe>B_9$ss;+u91BIfka8v83ESqWpBI=5Ry5m{z4Pw|r3|7k&V%!bh zr$QJe(a<9A5asQ+V4IC?@KYwXar9SD?E0D=PSa1-SW$)+m=z}=|DHg#AJqw{wuoa9 z`vBEA{|>7eu$nJ2k)p7+{dWm{!~yfRfbPWXPdAz(3s_%s1k2=VMh0(2uf$ZX?Q6#U1ry_v^w z=;Ys3{3i8Scj_R%u3ze{1aBy`T_Jk8i5_^o!+D{Jez1-HDA5I@+v;`mRIufoi+C1{ z?hJ`(ws5_efv?^QqV<820Ma@G{F>VX(%Qlo?;-xcalY;HbnIHw3zjk?zP|`%10|y8 z-cMT=|B%}MA(fjc%~018Zzok-y~OLtGlxOj8WI`DmN%>qXlKxmCcvN{M-YHz>t@!_ zmgoj*X~K>B(3A2B4cyHH81IVx^8p6#W&(_N#Sh=;2prb>>tL(==JAwhz}vEidfHqE zOnHbbd%N<*-!B-R$*e;1=67V4+Th*9OlPa7O+OoM+$l~X+y)q=s!7-?cZzoqVD}}@ zWh2vRF>Yd+AL4gu&6EfD_#6_Cu$(Gicj|kCIGDRGe%iWIxAL@pshO|$#r0ZK-c1+eJ%Dsr^I9kT9s_krd@e$wKl$-D_mt%9f2TeI4G%f;zpl^dbMp1ESkvzA zz9sHFaehfj=LBpoC(Kt~8;>BbemmTL%VeHw^C~7X&YY5dZSh}dU0y~UH0|8<|7LxU zT+`>U&+cE_0^!`$rtE?m)%DoQ#L6{&Hli!(&;>PF2arm&=^hT@%8|DNCcZ`GTl+1e zVgvfkk3TAyRqoOJ{NK^Hqykf5dHUkf&8_45eF(~|kpwL2jEsYE`|&o59J>jE{?XJ9 zpC8K7eNQSOa^kD8^yDeTy4g(+ISH$KN%Y)X%i?DnGe^^TZRtu1ICOi&`7@_}o+UVU zuzmg$&u+R&Nn`fMP2E}+X{s#^&4z7D-Nz6jRDEj`S)uS#?_hochI$q|cA6Bhyj-^Wt9b@NSP!>PSr{ldp5FPt(cm903 z)7%HS%?-7B+(inXihiqNsoJup3ra&n?Un1=@!pXA%LbyQ=BIn_To8(vW611|ADsS6 zD~X$Tj=yc^g2n{rWAhY^GatInpYZ;_E>R}H2Na;G=x%IgEYCjpGe)2; zxY+2{yd2*E4Ti4#I(y5CSdgc)3=!FZ=(YkBQhQ;C0vY+6724f=VlW1gGgE6*#-4utB4*GK4g0T&P?NkF)tX4EMkoe>;O zdLJzwas7whn+Wg#L{qPb)d&r2u49>p*UwAt`zgI|x0kx9{>^(tkMJj87lVI+fs!nT9rE40~o&r50 zu3ny}Y$mrOMmYbS*ad)8{-@IO!J#}Hx}gtDNU4Nz2vc}@mTrVugx_hARtE%g>*Ei- z*P|g)U4j=cF#z1C_>Ts6u{L5FIt`6`CCXE7b$up2(j}^<&{ByMtpH5!>|NZ7{noRvS{*0w|L^E!T)z@aJd)uSm;!0mwR@g3ydZ?i2~_+68`lqkou0d;m=*R0;e>ql>Y3bKNa-nWBi%1 zh5l@#KYQuV!Gb)gvXuVp!E0rZ{_HPsNY!QZr=mdmGEgA7O7U-dfmB~sAno5>2=f$; z;Zg!vtxlH~4;F*i3g!x?N9T`vw1%n2YSvL%vYsE7)G8?lhsWo2MdiPSzo^LmL4tE7d8}!v_1G)%05rfQW>^M~H2CtO^vHQ0-5$X9K5S!2H-$baj z$Pt8EMG3xxU^0lMo0S#+WV2j&1baA>T=+Q!4#n0#S>2c}J^vHT#yEURvyNaKm1cb~ zQZ-G9j^VmyX44&e(iKq9IhKhTp%eb$&|gRDODuAV`o; z+mIvpDL{!NezNHNWN8OKS%{y~I-j4)=(v+m7$ZnUsdl0D?z@8Qx)@{+#zEFRKh;F} zDXmTXL_?^wgde%Ib$;s6sr)paAV}b+Cy^ugX*MO2_{pmCleHcEWF>y;(fRx|KO@Rd zZz9zee)_H;`xu9-bWW!;N>Rv~=clSDKlNx6KhY2>t>J#?p|$m{d#CbK1bhBOe#!z& zf}b)ek;G55HHQAwr5*g#h4`s^=kwDbIuat})BQ+Asdgdx^j$&rT%RapTab!E);vE2 zqWsjoP5eYdsO%E{Cr*X5#!uZkm7m@u2omJezmX&Oshko?{Dd$r;-{|d;HR#{Pu)77 zpAI07ROcrN1Bg=XLj3eyL3T?FGB;9D$eQOTPn4g!wTYi-2$fyK3vdvoHGb+a8|N< z;HPfw;3tTtIgOY{oy|`}$u1_=yIDxJg`d7F$XT3 z1o~qDQL0^Nz5A{pyDbKp52+|*E%4J>gP*#ziJxc)mEFV7;`Byq{ABG^ewsxPB=FO( zkt6u2m=a0+ge>Bx9_`>KZ0+VWVjt4k{IncAuS)m$+**Qpe9kLtaAZvl2 z>J5Ifwuzr;2$em;!_h-){AB4=e(FyUB=D1r9Klbylt|(y%q!xjw07_lOiyzfVJGQq zeqzw^bgC^vsxAEVT|xGD>}GVxK0_)BSquDBWAKxuP5eYds7wnV$NsxDeoF0Be%eJ4 zB=A!Mas)rsP$G$+u!0aj^=t<}!8AUn5q8|p<|n!rNT=HM7(kS27h3PWE6DDPLADI3 zC}b`0Q=j}58m1QG{qd{r{|Gs3qO5VkgW&u zbWT5mR1~rn_{n4NlesPYR7pcPAQdOFiU{OrF8rzTg5ggG5#_KW8unCI5zn9aU8Zg| z_-Oz{eGTb_vqG+3h-iwlPcZ5I3OQ@fTpYqm>x)|!FJb;Zp|{N@E$tcnP+eBprtAR1 zL!06wq}9D}{W}V6iZ9gkon1JdY{dOQBgK=s`x8DXp6nM$ogYs&P{ofKgUzqi^yiH) z;VI(Do&hC9JXs+Ur=(dD{vn=hRs*4uqQ+)zr$2iOq#0+Cm_fm1GyX|`DiA7GSx=bU zULaMTLssQZaQ7~XAcJMDz%RHK9B}*cK??-8{;Jgz{|#(#_LL5d?Wh`rP?CdhZ7Wozz2Ly@zk$hY#P> z6dxw3)#Rhk+954ILN0p0(!B=LK*E{CUd-R~qg9v+mO`!f3t8m|n9K!q6hGDh+}5lu z_-cTF#^Ykg@{uEmC}pwullN7i>YGZ^=8R=NezU02U1X4JO++_9ltLl zg|px3dcO-hx!;{JfA~P7-*68KMQ)Nuv3R;!7&eJq4E^Tmft!__e@p6(sIE5jl9p5< z1}ywTycH9DvDANiY0@lx$DxZv`aX&rLEjmah@&r-a$2{O;<(yKUnqecO5XxF-gWwZ zfKQk zp`Q|clj5pCUw!7BPMSH`CUz)Am&QE*)krl_bU`QgOYs0YC(SYX)hQZ{cRz2wV&E}) z`rz(X8`7jDM`*sz!<(QdOb4Ar&)=YnM0$RJ96`@_C=o|bY~_faNpVeWoUbq{btrXL z$Nca;0cI0*ljU(o_j^mM-(|x8zcIbl`3ewX^nDHPXSJb+F<*a$H$h*R8as);@1cuC z`hJ8QLEjH45l7$VCnV!O2p9@mNA;YNpU}Iq%WLS9ZKKYm6;IGi@p7f$XDrEg!rt*?TQBGoc|JG$RjVxIIf!js+x`T~R)eXXdZHrNdM*1=RM z=!?*YPNMH+=rEDKBakELJA@K(^ld&arj7Ka5p>*+R$Ba%SX_W##09jpAL{6S*TWm3 z^Hm?C-&WUOfDohaKvY*7x*GJo1aE@A#D(A95Yb%h(=c?ANZ)&rBj`Jk5^?l}E05%J zQk+T~=}Qu*Bk6lr%uoL};iqqjz8&4~$33F-z0v5mRr&&i7=80lU2W)M(Dx?13Hs71 z(mC{DF*?_5Bm&!c|{zj;ga?dX1+{PmNJ zep{t4K#0-zK}-_0!7AzN?_|6Q`jQsdIrM!BT_n=?W#kC@E~P{qeL-%bZ&Dmb8|h0s zfR3c^f5$xRCxnN+CHi)BzgNWibsPP*N?(8wqpuH2jM`u^=sOQ@g1)qi>m2(223;i5 z_XFez`o2SnIQljpSJ6iL(hj~O>AM=*ygq+>0?d~6tB&sXmRP@ZZy@#CDt!S$jJ~g7 zlc_eO8ua}Y-UNNg_R~4^eGgqE()T0e2>Q~6yYckJa!m6#DbAsd^d*a1N78p6tSvfy zuLYPb)3>Ahy)V}9yGXT(z5pRc-z_lu;cgIvzH9I%=u1}9&Y^E5x=5t&H^>q6Jxz(Y z`3rrK=$jOG&_?=_#k?cwTMO&APTzch*)n}Qy5EJde)l5PCi((|7=1s3`x+O(81&tb zH$h+Wwsa1CzeX2{^t~K#3;On^L>zswT_XA>#R0UDzU1-hNc#2#+&X<9MXF``c67h5 z010}(x<9`S@);l)^qtd9ZNP7ReMULQU|r;?I9{B*;hp z{7J$;L;n1qlCLQ7ewZx{vj)D+%qBdqt<;}4Zo(7({CSVTmp|{JEse7z{Oh~ryz1s_eOuO6Z`<;h>WVE5Uk0``xJtL2bZy^q zvc7CfL(_#XE8%Ll|8t1R4LIMt| z&}QJHKtCCOy9*u0Z1T!mqK>1lk=-K<<% zbpfDm+vZQ6jJn-_rlV;&y7+bt;n&zGo_;(U3O__1*r-28QimZ=_}6bhf+hLapMD|9 zzrH05|9aaI8Fua760R@b@?`uCEX&~Yz;NQc=xd^0o4+S{Z6JL}Dkj~&0_;ZN*S&G8 zQA{8RxD)>K_F!CEyesA&xe9PZ#onT+9niEZ*7T03=fwd!6dV3D^Z@_&mInC0iTsBD z+lr#X|DB1V;X1eyiV6R{z9s(qpjmVnhyR<9BUYvBC=s_RVUZ&IpYP?qF#c28hyU>y zq0Xp(igTMJ;=i3upN@G(#u-hAo5z1j9R7W%B>d9?|MT!B@Za-W;(r+$O2q#fY^2@E(&t z=kb4P9R97SBK*l2g8$($5cp5~miX_3W)ty$6LNI^r$ik7Tl5-VnEx&9qr-TN(BOZh zVsuE5KkaP#bj+hM&S<&?{dUK-UR-8d`tWKBK~hej?Vv-h{J!2Ue^orf0y>*e>_HL@W0_6q2)bM{+4JEESE=GWh@arn2QsPJd%{NKaCzwKM%zYm&C#Q#mm(fOYearlQ7nDC!; zn!i>2+uDc!@fe}O|422D|8_QgI_5DMXEfac|J&m5??WZwZ`Ao8Z-W23eoOo>Lqm!9 zUxOT-|0xlNe>f=!|L1!ZFD!q$wGaQh(48Uw0Y~%rZ)el4SkpU@x`6!e7KeW;iVAR7MFMl%JFXzkub~b$) zlGKp@M$;|ufA={2>;4@0>vaA{69WI%Z;Ah9Xebf?YmlS!KPBSukGV?tKi?~NVf^=K zAO7iRrNRGzqj~;sXVb1&(>tP`m*(Yvk2w6(J;=hJrt?3PL4kkEx5R%RG@FS3n~6m9^oY8a({GS$we;+Cdf0xex zcoX5+|L1$PF3kTu+lT*M*lrvA4>+3V|8_R*iZ#8% z@R+oK|DJL9x1y-HLp3fq(P2#Q!ohl*IqY(fOYe zarnn}jPQTHSLnj{m)eK_UFgl=f56c^{@c}b^!ylgK+T5pV9*iv@$>9IQVjowKL@{G z5NXeFbo+a2{+i$Z;(zb2nMrk8^Vf`yFVy6(5kJ|1A2q;_CikZw==d*bbr)~I^<&RM zv&r=XhTj1h`!sL_cT(n7!WDj_j_2Vw8V=CUS+KeA& zIUs(61qS@5%+mUrkn@&0`k9Vme5hUxzf*Rg`U5&2*NVSr#6apC{vsPi--^ni-{3zD*&y1e`Z+}nV)hm;I{M(Qt2o<12 z(s_RfR+8vR9<3&OIHaTW{8cDLK5UAgz%N6HTl;U8_H^9E1vtNa{tt1KXGUq-6@W)i z)9W6#r2zZ8hv=3VL~f*_5QX={#UK0qh}M2T;2nwwi2Z({F^1Uh2Q0wp_IUsPcmMkV z_Y(vOXNoy;1pjy_k;FeKAO!d)$s^Y`{^_`jRGQ_V;wz&36GSRXtqbx`Cqr}&=hbzE z=EgXPn&+REelMT}{y|U}{a(Ou^w1jrbnfp3^d|@s_(w*L;GbMdB=HXveBz%Zk7C>S zr{gYmYLbJ2lFre#jek1sqPb@ICmkcv`R7)o+QdJd z4ADZ0wGxpx?~3@V3-M1&zX#9){~)NGeh=V%gdw%YKb`w~0Iw1R3G!!KG&Cwei6s89 z>im=B(QO<5blk<4&GJt1i3{p{!Zk~Tyy5GMA z{=uPDy5IjSqLEtTpU%DC{}4ftz(3uh(O@P$8jN(Z*zWQ1;Tak)V>w^5#$q+3>7?lpuyCR_KLi$fj_xZQLKR6dn_xZmM3wdk&({YoexiiwQ z5(EkSvkf^y{sbtIB!A#wC;mx_XlNV%beteE`(7eu5x@e>ie<{f81s{L_3yM%(zO;}p4O z`KK7(a(%W3k!lnFbTUNeVgXh9dHf6V&sl?ilJ4tofq!tWo9^o$jviX$pN`ukG{-;v z34#Rvk&&b8Ka@z~A7qjINs1_G8~=3NMzUG{nE>9_`Dcj;ziNa2)5#F6hqTrqI)hY{ zqnp=%O!Wr;B;C*70{`ILINi^G7WzbM{L^tpisty|5J8Z@Kiwz@jP77EQ6hxeWh1hNA5WOn`sxByhY7G8Kx{tpF{=vC)x{v>T z?1x+9pN=zxr)~Vxafb9}`KKJVDV?f0FLkZ=Qet zf4*P8Xkr`UyQaq%YKkvlId!gKh@f))glY2ZYKf^qbDnpb>xWGJ-0Zp%(MV>ev|7Ty zF%gHfx)c`$jJn!V=-Ph@*Oxm@h|}8C)EMG<9Cxv`le2E$xuPsD!!gM*5%FVt?_}CY z#_L&KnEsa5<7GE1ZRp9eO4&oDp4-hPmK9{?b5CB2_%AhVW`$cRbN(q-cy19A3$JME zf)#!tDyXF>CcZ8@&Ug)5XI*gW=SS||%~;*%^iI8$Hg;!O8~G#~d#ECv_TyRm*g9UM z|3`(IikiPdX)8)IzvaIf-_QJyTUhC_E_{-Ots5x6Xs7>KR=tRAi?6u5QLnTY{Duz7 zS=LrxtyJ_4W-@nYZ1@K$RPXiJ|A*Nly6^u3d+*qfccwgY%O}@_=V8W(_%>d~_)bjl z6joQw@S+3WMQ^o2@u%GkkO(XfnkJz6IaV4PDFb)v7iO8CRwQ|!%xmS+vm@ow#*}=& zBckvltn~9+P^qt4l}b>F8XHkvMlXKL4UBI@Pc{s?i;`6(^S$|5pN;oF@;8(CBbR=b zlArZOK0lMskLL5uG7#tQ?U74QjLbKmp`P;jR^+^xZ~i==f5u9WSO~YJUyNi~HL`i5 z!UO1Mtba%f<3Q}WF6aj#f8}!4UWIQ&hhjK1q|z#joV8UUf?-VNElSo=x%4$;^%D6et2A@N*Xy4+!BYd5i>J z>ERS5XO}xmj4A6YqKDstt2Fe{5Pa%6GrKgv>dKjwYOtJA$=@6O`IjuMk3^XNSM=a{ zz1eb>Q|`K)1p@)ZjLry}#({^j15@vH+~c^{ai92ofb0N9$MgHSe@gJJi*XWI*FWTD z#v1_!<`XeIKrPonwRlRsVs6lss{kzTh9s@NeC@l?0s{_D}iJ6JVir3M0oB7`{ zW&VAfNm?_eFUu)g_&q%r0zq11xeGaqPGRcuN$H{&%tW4_76-HkO_j{?dsj6=f17%ug`uq`-o^u#E#g55qU;pc0f8@B!F-hj%2zhblPF8q)5GrY19hy6x z@rm{c+9FGymS@YKo}b2@cBezj%fxdiuc-_3n$r6IeE05#tWtk(nV0dCrAJb-cFWTz z_2xTEzvvJ8EobI(861x)w(NjIJ(B7k#WcLcAym5uuOtu-h$(13NOMD5m z0*qEl-fN+7`+NVyywBhJE#^-H`bydK3Sh7ZT}f-a0)J}A%$6%=OmL??gZi7mG=#=F z?UZ)<0#ea+Xhy9c#)3|J`Y>P#&zba;o*RNM3c-{eSl8cIeLKG7;)6-ykJzUv{NIqD zDftL|T^hi!3oC&wv}-{HOWo)E05DS8n3}Z_j0wKX+Ju}?e~7|zz7N>U#4O1=$v2^f zU7jA0d4PZ##HI%s$Nx_IV1?p$Lu0@gU=9nos<(%wPPAwEotK__50IGzO7SUI_FIU5 zd;}Y2v*1BYD>~hv7pij`w+;}yxou9QMpZ|Njzh5OVFy5c`Z)N)3{qW@Z zS^rj26?=wk-aQViYhXGam5P~gAD_dfU&J&87^J!0+lD%rqFbd`N+Iw^4&Cj(hSBm< zi-EBc2o?Ho5%b>_VH>_N-d26Xa?Y)aFlqcoIVT`_8&NhtXS3uhgosjx=`;cU@TM&l zB=A+tzsd=`4bAgaN<|MqGk0R3L&1H^O7rON#-Y06!=1%*@{At99G5x2cW8rKP1P=)797&t%j0Q2CsV{6Mbs@>U={cj#8h zJDTV@y%f_6pQKkdmWKNe-7a~rp=^UEnmFNoy9Yf9W{|wy1Sja@Vg?X0p9Jn$YF~+B zNF%y^seP56PN#HvN+s%skb2(?fQU(V=cP1%<>b~xv7U>^Oh@zpI*B(GA zK|S0IB`w`Ve>N7~W1lwkpya(8Wl35MAeLAF!bhZ{OOOVk9q-S+rkfB-L#wkyd*-hl z&`aDuR`_R5ZH7J9QMj3kI1102Hup@IyqwsFe{!pTxZTO|y{^)+o`973aZnzDP0(IY zJ`Bq5bp4I-rS@W!AkI=9( zi4uu~@$9JF5fyl8v`!J#nMHMko{TjoJ0K1yEDeM=HpJqA^N<^xsNsiW<;Ap;R##xQ z~;DA(#^UBY7V~``ITzf=8;mN6&Haj}-p7 zP}VT-8O{5>uCbJ*&-p59b9X(%e!{O)MF>qy`w*r*^Y?=){o6RUcmG}HA2D8C{U^PD z<~spoKO%X*0+-OV@P#SCb*P$|I^k{jF329f4cw(*uFfW9^Ha%t3*NIUu^FjORro2f znShQdz&()yik$>eg%8S=Rp*JS)%pCi%s;OFJ1dEbBp~0+)?wWApGP2H z*&S9%uwb3>{*OptATJ0}bI*C?2+zj{$K)o}k@Ut4&^J`K_nQb*L=&lxx_YTSZRn4a zNPiq|=#PVw^+$`$|Akplm6BB|PtP;-$1`mD31$w-nA_Z9C;jnosymly7JIz<*bgdB zTeZiCwe8wtIVnI`ldLJ94ZunVg$KfHIEiC(lk#XYl*cK$@<`@jMe7Y%h3-gVYJwv6 z+|U`fLEFhb5vMg~fN?Tf*BbjZX^lghv_?$RsMa`0;pNR~jp^;z8gt{dM(iM=I@2HM zbV6mE7QPOwqsv#)8?QI?##PA8J|S3|ibG#U9cYZX(y}eYwfbtZz&?IDZ~j_T z80n_brgiAT3S$^$g~C{b`KJs6Y9;T}NJ1qd#7DKo!9rVf8rtIEByCZlx>$537}{bk zX^TwAygnI62AI$oQ3=c6aM$A?%9Qhz#oZxphb=mJ;hhx;V&TtYdoGxS4(3~PnF8@2>6v22Ek0}Dls5V}YcV|#1F znA~qdt<2|NR{uG=4z*D~ybSb->W71&UD4Z!vxFbLrW1YG;Gq4(Wq7jFj}jDfA4dV)ahe2eH?N zCKe7g^+Wm~>1@#@0$dMny~a*@*>U8PZs@_2Xg>IS#gJv4$tq=j*9lWpLBz`$6SPE9 z=!EUT(B{&cY!IXlX2vwe57D}zF&;ot*BF~L#0*0#94fTIe(lf(1()dBAoj^g+Tis< z8}!nIZ%rE{G$e=(&=gyY(3K|y!-=(H7Zm{xr-iQvaX??v2R+D)>4SOM5zyeCYQ%Ao z-CX8};`Bkq+!)md6`1*=EFRMbsU^rpd`r{^DL?e<;{p!%8_)<9{&n>qX`W#V3T)q# ztPe(8HYSh4bt;D@p^b15EG6h2{yBJv(Ow?A6H;h@8m|$4!r~R#gA9u7blSb?8ljj6 zB%IC~!U-$&0VcFq*}Pf7mTy|BxyoQ;c}6HQusV2Fq+u3 zBMzSy@}uQ2nJ%LH@flk0fgeJksEsCGzA)v~Cbu+0vkWXp7KB58ll#Ql9|DQIOtSha z7~kstXa*l5KI{ICI~o5P?u&I`6q7d2=F~=~NvoIihO|<&@q=MFmR8qz15(~Trp?I+ z-8bkQq~7Svsi^El4VafEL(R33jtbl6oj6E8pYfZd)r+YG21$*bnqnWSR=uj0WftkV z+Ts%W2=Kh)pwKWs!@83T?T6MoY(EEthafvD&sEHOd?$MvjEhvMFTU1#sDo+lDl!%g zW!x;SE*4$-pF~3o?78ZZSJmyAMS7;@iS<}YUB~qZnHO+h8U8D>^?ecgnST`Qh#rO@bTjtME&&({|{wj zXoEyogQ8uj$W9pA;Pbo6Y^kg3lDf*EuC5ASg6uf?j7~E|r%)nv`jPQ2q0`LsJ56t? z)8COqi=&@S$LBN1j?vF1`okZ+Kk`u|^q1b$pW^?St);F8h^}U$9WW<`c6sZfM+QU(qTkHlm=KCM9x7hq&P)YI6jy2yW{43QA3jR6`z!=XV~%c#h=zIW+cK-K{$~T zn66yyvS-TbQRE{LJ_VZrv3VxDnoKilRXsB!5iT(D2UGrpX#RxoCjvIgLVj*EKQ}zp z$cI7=%U(2pXm}6SC2D^t< zm`qfkNIY<)hVfChAOs$Y2S@3s<+p=aMf&=;j0&rVUsbnd7KtoP(1~1%A`!kE-+|I9 zflS|e%pJUy>u;;@27C|(9?pa2ZFcf1Iq2L%y_rV)7mPH+gP$6@d1^fkk?~EE_i@DO zDtxe$bgZXrihsB$tne>jlMlUhV?)H@ciL0PK+iwMk0ERdy-azY=lWvF0eW8%%cSNb zj?vP674FNK{t^yF*DI%HBiEF-92p>RI(l|jL-&h1d7YXGJ1F`-;VF{$Dhlll3MQeEYCd9Z{{oXf+;Kk@!-a)J z^1g%_rM*m_6}@fk-9dPPg^rivrXF7{ymy;r?jerlzYgH9hzeYDqD+v&quwV546%|y$pXRyQnm#G~ciGfXisE-}1xI(sJxn%fbs=@BOAaMx zW081uAJ)2NS1SHlHlSq+nkTf-x=x_;`qFVVlg;yc zonSfj?i1R}R94}~AWuJ{kyA(r7pxun^9>CcZSTt%e{B#7W!EzQsPyOp07=hKOGj(y z_`dpxPA-Rt25|BZG6;sC;7XdPYk?Y59uLAB&IN-bbVPfZXacAOZ~A+Wmi@yw7dX@u zvm>VtH%-mSi|Nn&%y|Eh0jOpLCX!heI};nZ~MYl3gkd@kCNgBDbXF{!6WNK=Kc z(50z=3d%r+xGs*$171W;hEBr1&$JIR#pj628mdA@9)yMOZmed^|KNeCdZ3Ks{(Cn8 zhu^Rf(3KWRzJ_`N{`|$R>ZGyQahk1#!>BZ^ZIbsnD-={~WbXhI*2*n_wxy*o^!|*v zW$;TeD#0mY@$=KFrYu1ijb680`Y`WjX8uhGpZ6fY_4=CKWr@A{{r*I)>FjC zNxq8#1{jlwrF}s2gf*?4kQwo-Cev6ZVG#Yy&S3m;Y$fo7N^4>KwoImt#fQf;8J~@R z4!q;3e;k9-45fwi;Ce4PKI&5Po&*gb`RFD5=enpJiXoVa8`CNnI`;=iLRuBnK!3n0 zqz^GOLOr=rZLn$t%MJSWt)ZV2j!qgG}-ZQ||dmT<_qmeo$jqbAz8Hhz- z(x~$6Z3vgNFzHQWp>X!S0s#QAff>qB=*w>BBA%g81$UwqnFqtq)JB2t9Rr@alf3tW zIh|UcJdJ>_kbId2@X!7}4tOz8F@QH|Fk%3&(9|hFDS&)c3}oPN3Jn8be-D`ejs`)% zkKPEM4S_Dk%=}LC6*L-yh*8LIG$8lU&6~#5k-V4U#jr!vT1zWv_IMYZp;hJFhUI@B z2R$OBJajG+o{2o8Ty`K#dK)$yUf@6|#5O{S?<>48E|48s0t*h<3ITeH1(l*SX#8g0 z1`(p97xVlsMxXFhG`e;+^;v=5vm>Da_tQkxH7d14=;YAKfbX@rtHznuH2|OMC!+j@ z;y1^cLhj5uKb9~Nd}zlMKf@Q$bc@m7>3 zv8C@Ecv<*K08(pxyd3=GcF-;)Ng9hyN$3Va;HN$M1jd?chzyt;zQX#pX%dk4B~tNN z_+m-3SV-5gu%h5xr22WW$KUE z%NP9*B+jsx2cv(<_ws2h3_?*R9pibtLBoRjMe`gRQQEnawwljj8u^bQ(qwpY2F_}GvR7nteA z^#rJP2R7Lj=+_fw%Vc=NJBhH;a3(^6WN4<_6%9EPVGZLuil+goWjouBS&AB#dP1LQ!g;`1a9x8Z%SI1hkYvM!fF&`T2|ICcof4~z;{SnRBzzjGGL=!Od310&Om1vXU z8j}yA$}*&B>L~0>@35#xBu`^^$@?-I)%tw6V*oti?o`H8VQUi(0S`XF-5Ur$2+Bp* zKiqR$LH-&%SI-Dq2I3+)VL4h4jnot-8Y_sy`OVsyv}lb--uj71ZJ19S8Mw3#!equ0 zy_Q;^BKht`g&9m6K9KlCI4y9Xqu;9S>kIKNS;HgnJyIUN2Y;~yW4)uW>qf^!1o;c^ z#2}_E859)=^MM~6EZ}P^P-#o222ag~Slq5QYp?hkmwKy90whN-h2(9pa%p45$hr1?; z#-*ZXgT|K-jq_wJLs~t`!cu=~Q>&!m-CdJ3>zQpJZ@`VE?Oqf1H+1JSmd1}2{$=PF zbe9_@tGaoRZei8q_$#Z|5uJ(tVlSyp0oUYO_F)_rg;65^O)iql)VsBq~Uv%A5SG5=gGx+9^#OHIVQ^d z!%6(iordjJc*Vxs)H0i4y8P1uRTcSI`5fd!p9*df5O|ihBXQA#fRvf>gwm zeGaXke;Fxf+DkU@08OWxQH?zCOuLK_tusw171c7atSNriCY!FGMJr!S7J4P;l>0=~ zjxF%a)c2@KliM51_QJ2XQz$`SE*fB3pP&TQWCu3iSznY7V6>S3(!x%9ZBZqF{o{0J4{y9uZw0=PgukK2GfH-&c z>xgR*7GT;2^MjbQ<+Z{RZgU?|co<=K{EHC9)l}~x{STLBM@Ix>eYB)CM2as9S`P#V zVALj4^$YO)x?afF7TM&|FH^Bya(Qd51MxM*eKlE8Qb*ey{>c%=zn~nF7yB`T7zRGS zcApSZhvdHJ7F~BNS$H1WHf#mbpg2ByFI1+Laq9ujd%=02`#Z5VoC0d5hyyYF=~axo z1B_2v!T5tKCGQUiO*lh=jVq$RbsLkkdK=F#iS9ng%Jg7ah;N2DCclJY>ho5S6)Eqx z4!+arzuOEWMD-Y5j^$zU4RZ(b_@R7$Qu3Ap6-=8Hz^1w^yVl9?U8V565+w`2f;)UR zGgpL$pi!rWY%QOZT__-nY*(gD8N_lnxnEV^`w!?8as9V8 z>9>xY{k(k6vqVP+-#p%bO;x^@50UeNuxLQ+f3G?t=AYdN`_w7d7^dAoYWtTcMb-`Q zyyTOB0u0EJ6MSM#;sAUj!Fx=5aAlI2gXb^jrFs0IGphl+k#Y>o6SZ72U{2waiZIY( zJXeJZt7;+L?gdLex@|U}E#`zcANQf#K=f^L8qPgX$?vYma z=lR87&c?YtfPD-@58>4AEu(hP zq=1O$uR;Xyok0H_LjPxnYC%&05_%{q7{$}3i+E1vf5N7H4@OY65xd|+U~UJm!0Xsy z{r0)5AutRS!#+WbFOVvEKch74!*b3^cXjwLc#F!jM1E9{&%|CR<9W?(Vp0}cevPp<_-H?kc5?y&KG@&ck5Fe{gFE{a> zxzf@gD?OUZhPjL9-hj+vvJHy%$6WCqEy>xCMebr&cSMN%Fw+50=zWqmX>{ z=m^1#sE5t0_H;@0#Z40opUIExx|ZeS4sxH&*)1)Opdilm6cc}{o^Sz@w zbO2ssPM!(q(}y1r6LKZU?(mN@g8`~<*7XV;YRqv5Fhj+BBnxEId;~MZO~t>UE${-S z95IzX0f#zq<#>UUrz5KbOas*PXTzora{oCx4`0#TD`Dj2HFK8I9FEf4!MBX}+e7(U znmukl_O0%hI3FeN0HDH{lhyHaay#;kIr%okOxz%R!}K{>RNXb0_XaV6K3YjhW zR^WvQo}*~fAdpmH2ud9Ql^UlvKTq{lIQ_qfxO-GzYUp!(zY_{wr1ysq{Uqq!Cs1jn z(MUJ3uBN6&%4v6}zAl(0Kj)0(n?YkMd~^lzKT{uFZkD(WmWL$qgVmLqGPwe^*4+Vu z&rAD5#J52UKuV=pHXkr^{{sBQ z?&TxGg#sC@=;Ey`)U%ST>Um`lm#bvn&#pk$YNEJP6Lm>uGL(qQ%nUI@c7_iD9A?IN zFt+e%vcy1u!v1s_&-XYX%^^I;k?;(?evpLnq*ZXm7L4J&9~Mzt`am|t26Bv4n&0(= z87V=W+A)3y-=mAuj}yh|#e$BsMoC@@TWAueU&Js)9x@$Mr>KKmbfC-Ed>+J-&-YQ3 zlg$4~aZWR9t#7U$U`m&@+?j|Gn2jdkg(t)*+Dv!|Ct#k*+LD=3re8w|D8(Yo>jk{X zsr?JoVP^Lg&YU?m$xGX4ZFD+KFTu^`P4v}uWNY3_IH)=d4(pe)x2>bw#vsL4{0x+2 z{(D!1`hD;<6mx{A=dDEks<}jA<|pfDz^VABXBfIh%;Q2Kwg?A74GI9c;@`FK>wMxq z{vH4_g-MDTas+W;uzqMmQWf(Tq5ncL0Oq@g@RsP8(DKvCpz;UQ*Ot-fvjfm}55mky z7(o*Xlp%t+h#&@pztW$9?RSq8>rm)_o~@5;5V?F)$d4E1zb93K`8MPcFV58dG*TJ} z1~dplx`n~qe!v(^cBQP%i%r;ruJg1zsGsZJ0vs@-D&x+_akPBB(umj12tkdx$8mkRK1Y%G|z(Z)^eyBL=*;M!E;UA(? z8A4Ik*x;zqGcxCVbDs{L%ujAG0W@qxpvC_A4wye@k+@3)-j5L)^bvHy>K)7zl!+fm z$@v4Z{%;5J?mjUPD+clc;AmR!6ZIFwA{HJmA|BUnoypx^KFK3ij7PAX2+^+nN=zu8 zSH!d>Q)o)*j(LxiQIkfRMMH@YcrREnov`er>K>%io zXC&r-zN2NnK_QxlD0sixwJHY6Qq1YppJ z^}BWjxOH6>YU`8lAWgmvUF#?UhOE7skL;kNC=4>zczvHKj-yYo=tdMr&W9NC5p4p+ zu6&l~`_#!pZYfD(kwbDlSyY^G)%iyW`y%5&G-RLmMZr5SmEqy!e;|jPZqs{du;9RD zLK^^fo)A{R)L~G~iUj{?lWn+Dp&FrA+od&6bm1op$bjdR)@;km`RClhcoq~MHF=zf z^MGYgT0O6-Hl81(9#3e(pkPQRYg4-SZw1e-(sbz`ww@jOw z(d}PYlwDV6Z>v?sAl*3UcF4&;cOuy39-*pC&A{=T0FHx;qVBz9tpLKrMHZXT)R&k% zy1y?`o)sQnE?DUDK5GU5S=uV`rmmoe5s<@5593mS-E_f1PMM^>VWsIYa9|;{%wP~K z59hDEmY!fqlPqFTD3#AYks=^t1KJ|r3D~IY7LlBQWG3bq=_lOp!JEQ;MR>5?p`dRX694t+tjB`B z8AuT>P z3ZoL%jpayg_5F!5AjY=({*2U|kl9-gU2ep|cQ7C_Bt=4Bs-&GbQwPBp5;fxZ@1aP* zPhj&s6xy{5+OdDW8SBAT)AgYMy{^A*_7k%T9(v@#t+_VSy464dL!#>UR9KJWbbN3S zQ^Uz4Gn`sxsDU>Eig$A%Th|q%5t4K776Nh@;dm*60mY$ts0B69eUgM@abcs$lx~t1 zUt=L!{q=R?fb=M>n90-|h$mVh+Z-M*3=x1P4w3*MAuz&Ef=&f6sJu&5hWxI=Bj5Z5 zg9y)-5isT@Yc^oU!BfDi^?c%O!t=rPgWrbkg$Y9Dx7z?=_--_W@82UUo!Gj=#_$@W zM*R-h7W}!CtV4*z_T0g>@%#AKsOQj+-onrkU5a#e1^Q!k|E3#>uB;6ezk`l}d-rAG zspwFjN5*9}>QIa1Q)r%Q*5ywFGJPCWAO3RX%CABjeR^%zKQSbjSwvX@S6=qE>_{H3 z7yg%ZU}|txZK$GHFAshrxG;V}8;rk*#_tzsQa>OxVV*siJKlfK^%mJb+M@8w@A@m@ z#<~a($w!M5@Hq_ygAR(*AuwVxaYrVSG)s_+l~k}k zl7o?4q2~^D1V^7G-a~8>QCg^ih^i78=K@T{{AK9QVL&T+<`7k9{nK9vL;5%P(NRnC zUI~O~eICJ=p!KKtOaH<6G036yK#dv5$=N+8)uCMsQz7r;#k=cv2*no>6ZTR)E;-Zn zBdzBT@CAkp#Xq(lK`6cbPa+QVixk;Er}UTwLP^Pirh%Kh*7Sm5WxTC` z_j1EeGveUN0Va6N%qBVOY<|vXa|TlcMU|k9Tz7_zAYO)JY+eSE08v_e5`SU&Fq1K> zu9i+kH;M?_Na%XRHUzDop+Uk=IB*td43?5Wg4=_FbasW;QgGY{r)j0qIVt?0C>02x zl;eY*U~Z-fE(t62!T&DN5j92R4Y--uz`%BB*ACiu8Hja{(;U5_$-(*gWCrRHY1a(` z9HEu*#VC#eU)((%+UTdEt7-iU{}OLxe=nh7;6Ia` zvw7|SVW6)90!qWUHRvSdMs@{RgUop0rQxt>Qhcwn0gKfi^FF`)GiZUSiCd*$N`qMe z(T8Gal+lHm;oi0QAVGj^F#$w~A%LQ}vCrQa5p#b1Odtpof6}ezA{!Rb;CkHG7>V;w zI5q1-=!i~fdQXXo(5K-~#30rqcnHrZ%i1pv+mCLbOS^Jvq{Xx&(0aaw0*cnBk%}Xl za3b3ink4(L8Fi<$CQq24ZdSCO|D>;^^dp2G(UwrxavJpWsnVL6wgMa$^Z7-$`iFZd z?Vky?{qldHre=K~f5FoTBlNBS_&L^xks&Q!iZoh(3@?giU4w_%aaY@hS;yjK&O9K; zBWn{qHrOq(Ud~X53$LHaWv-D*tyiFoQyX|c9&jz5mT^n~=blc(68J}$6?qvFD-5U= zo{1^&15ANwm;&A78;Xc_U>`;^0!DWs4V_{*eRNt;xE6VNd=-aOnu;Flaj>F3$NK7P z=)ZLCFA~cDzJ>I`X+Mi%I2M=2nbv0yvJit^K*v@Hzy99OAmV{oBh~s}_{L!Slg z{>&d^WDVQ#C8n?C)749T747@jm+!2H7j--SEZ9|po9gQRjevBQ1kDVt=LLOTm&&_C z)pz1gJ}<|GN6ar$hE$uwrj+?> z^=3r<$q?gvF$*q1Jx1j(VQK~5@e>|&0u;DAz%DAkmyQ_1f3I#`gbjS@k^Z^T>e|wy zm%ygF$kgqtZW|F)arTsy4u*^K=;FMx*0rE;Ya|tS_Khq&8liI>rALQAhe1qR_W*E3C9fdo^Z1RAdtKa9-v0?+-H@-gO#_O#G9cLR+`80aIn^HF?@Okg+;0DO4> zdN$MErvBB(EM_-?WyaX>Vp2zxV4XL)delUENxmb~TQ(fGvDK%EacIP6rm;h)lXOk;oCg1L@EU zx7Ja!=nm?N8yee71hqEGf`C2WHa^zk?uSE22Jl~Fkua(D=VX^DNv<>F_)fr2bo?pJv2;>WSW&|K{i?x#?5&Ut@eQ&sMj!=8MP% z_h>S>X_GSw$?xFVz-z~XvON_b6KnSfJizY=&#cFi-Sq|R&~OY0=Bsz|u@~XsSK{nV zA_iprOSBVk){HfUYR}X{c_%HT7B<^K&}d@#QjZV9nH@VvaMyCc%Qs z0<{0f#gcUgHi_|Tlc6ch!#o`sdY>c?ADuDPkSBMN)&%ZA>==d(z`!`e?To-}^0o4# z8`2$U|IPl?z8lUj+*qSm#BM3(l0}>q%!ecx5l>ZF{V_fD{>MY;H^DHIjt_`a+6Be2 z{&PkD3+%R2(n4IRARv(XiWKBPfwTxAOVLk?-6lSX+{`8b{4RU?hGK%$szZ7uK{~iO zNOJ|G1;v1~s>#|5`OF(}Eh$)uMAh0%!VN!`9XNZ6y$+?Up!gXZF6SLol$Q1kGuM{l zY?w%m-Gb|NP_eU%e zF#a#xOi*N3*tWrqw^87gX}?@aKwWK3c?J4h&*LwHVX?=-?SphRA8st*8)1&cdpcsu zOYsj^{e~cB%h@pNArzhiS<~kz5(TPdlzCH={i*PH88u8cWBoem5gSm-1aZpvUI+h| z>jwA_0#%Rbo8OQMdkcxX*9C;@GwH)+Xdv|YlCOygi-f5X6v>o#A72;y%=qOGp;?6w zyaNx$uN{VmlV5A6H{79-Sv5*F1-;^8K(v-ld4n*&v5~=P+-PEGG?5!kuxMgJG%+Qb zm=;aUj3&rIA{r!27yQh08{8s_`^#} zaz|k;=SP1nwhna-xU>@sF{T2hKOF_eR0C_TBb*8uGuVPQ3O5rO4AUL>6LWdQPku|n z^3w$Tr=l=c?CX))gxsLjMn&;oXgUB(Y)t4YVjETc>zID2S-<-I022uVuc$}!74`wr z448J4qTPze$1=jQanHtf~iwu2*vJ>5d#h4X;d1L_0Reiz7xMHm7eh?fK zeBl5YO<=1(Df_tq2K2Kb+z<^3z@o6=g2-c`+W|{>7Py7vUQ<}4`^OG-7wjJ*<~3m? z)$bF1!;?@2j|cE5C`NFouqW}n70jRKK~*bxz!d)IDkqLg!EaX3<}X5B7`lrQ ztiOD1ZXQ+{Ba$Zc?DgkhyW5-)rs}@z0?~-@dlys0+ztGeXazqics`)vf>>K|;0jjFy9dG!%EM$fLD0;x z&|j{>3K`{RnU>JwgR%p8(rV1N?Fx7n+>{1tn~=3#-21--FSuNtnek^MN z<2G>Y2hC-9-U?R%6@c1KTkmp|xeH~OIFT<3Y;)xq8{B+9v*KH>HP0Jx4WLXJdtlid zz^&W^(GjkS4rM3;Al&pGaDPN$7_jy0^N;bvu+4{8La$!Y}D| zk&>(MDp}bGa}8Qi|Mo#+Bu-tR^{k$3KigvMW6vwCo(~c=sz(;FJxA2iu5!0>L~6|c zRBaeJ?|bU8Tvty+y~AgGQ+Ssq`GEP2B}Rl8;?ncDcmsx;>{+ldlMqWFsjKjpVwbfS z14!Yp2E!*>r{vUSBuZi8msE`s{(H+5|A-&_JO!+TfL_EBaFV&qfvuOk zrwSNUx^2a!{qv8Y-*@c7?W;yEn&&6OpJF~1ywyfn!NoISQoZ$kBj8jUE}C~O{420V z9dHDlX+p$>C!z=%lf3UiRdaY6aA)gVNQG_~PN$L%gon^~X|>lr8;v?V^%2*ndA!u2 z9-fWDnUeQLG&6TS(z%lNa-@;M^;?hWjSY6M$=8+ z74zYsLl8sZ-NK&>^B>x5c7DXSTO-=ln|lYfaI?E*bkJ$hDfaugc8EXDhbz9mE51H7 zVN>{lHr5Y6MWiQauBdLdXg4upS>a@mn6JlPGrmvKwh zV9{fgRxQzA$8$bl8HDl@z2qERrPx4lUiW|T|h!K}@b-WOQ z(wq5Z(9Txs4E7Y7R&c_n^eE=xQJ67^E{yjIKY$Ny;R9$2B~83Q{jLi2L!XHAEQ_a= zkTe1S#Oaav7sL>^0K_0(6*^L{*93s8Vl`r=ccR@k0v@wyj-#XA2i|aXzJVG zkGA1I9V5B`{=cTr@%X3y2>*nMHsSw#{(?mK-|^R6^wr6Dy;zL1RE8h*Jdt0AGmuSE zzzN_lAg}YeuN>nGZ=_1vY+44pVQYk=`+aF$rW<`F=MJbCP~)CVWm>nWsu3{&-z~yrw^1)gQmsA1~<-zy4UFKMM87Q~JZLKW6EVhv)&-SC@Z|$?H5M zO>r!WLR}HzQ3sV2KUtz4XSg&S*3Ge4Q*&#B2;H8dr{E|rK#K3q4wQydYd2b8%W-uN zLh~W=2Q9T5Q(WC?pB+po;J2PrkC^x8==l(C8s8_<80ULjJbN;^&Z`5Fo` z3(!aZJHl)sY%%@?>54V^n$i7>k^>MfTs@jrKCv zK7ddQ&(qx=gy$p`zR?>o!SHTNm6kLDU?McOHiB=1ST`nv`sFb_iFMoRt(gBAo#IE! za2VMKhtASDbRHmc!(hQCaBkuwwTb4}Lj>sU;dU>x1G}DP8id~U?o8C#>U$i2Bhu#-#5Zl!r(Bv@|5Hww*`PAClOVg^YZLP%%@xpLOv>rr6 zMNvUT-8CZAD#SCt*E8>VXLmzD+xqM0`^RTtGVeK_nP;AvdFGjCt~UNojdZN~5dl-9 zN?II^8^Occk00?eI}7WdtO4Hej8t{sVvXN9eN@x??&fpOWoq)I)RIMt2NeE2r1*=< zv5LQn6gR66NO76^Nc3KqsmUM|aI9L0w_W<>W1Y=I?pY*L1Kt>jx|T&pYrZ9?4&#t% z>c5P&-rLaY4gQ9)a-##3O^KjZ72j<0oJ2IYBLl5h#;R^t^Wc6fP{j{W@;n!gfp_3N zk&clcRL`ShwNQ3d=k-ZWN27@H&h_o`PP$BblP;&f?-S|ScU>!9&gKUsetTmINeR{1 z3?zb_boKTOC2zE643mKN43P<_?+rW{)t)g)IoRda#16ma2X0V7%@W1gJS(m}!)b*R zQ#udOrIrVKFL)rS`2jV7WLucPHP1?HZLeK_sQhVdN zo+w+|8=ujRcD1Y%giJ)CQVm$E1(wp@=nnTw8yDMT(MvTESXvz+ooR=fmc5l}}! zo0UpdPe4AN9hT<;6}5S{<;r(nyHUy@?=r=2fM+%}@5kBR7z1t!JuX1Pmfdeyv4rUk zA8;b<%lz3^2>y<`sIg9B{RwZ2zsTcca-~rU*q~!^%JH_)Yp9*g zS4V8=Z#-~~8d6sM712!PD+6wOzlM((GUj|sSQMOwuoi1rk;`ZpSpqlUrTJ@fN(|bp zF1Ogen809Kt+adLJc^>ic>>phy^fE+GzG5vJ`dx8Ec_j5(!umq=JiUFi= zvbujFyM3kmr;`q1dMoKUn>MBT`m5WU0&Yh-SAlXEcOU$;f0VyoE_|krf={%;{1LAt z{eEmfwge%Iep(!IA`YQK3KfT*MH~_>tu=DVHPBGLY3K<5OWeWi^f8?IhH`F5szVkP zoQ0BnRA4IK988hVaeO)+QMsx!R5FUqqD2Lcl4^qI8i5p??xyyVmcZ>)H0r|v!XO*v z9T}wGz^}1s$6?~wm+&@Wz*6ghD~KQtX&QkF9Q7B(I2u`V@2AnqJ99O!XYLNcr|0+(6 zLr|r&QTPu6wS`}FKo*92(2WjUgtJ9S>sExwzy(s#*7~`K+_tx@N7?eI)3M$T=ofH= z#9tfq?xJSx__D?!>rm;<7b56&o#rZhi8i-A(Xr})V7xk)zxbc&Sapo`^)ohVSzo53 zaSV{ogWOBQy;~|#IWn3O0RXbaF$9Kb0xwl5j#kj34ZIrSSlYl*mLJm3o2u2_A!7rn zWVxHO5KSBer#Ed>H)uv&-I$d>ZLZB*-Pjdo~l3q2I5C6hZs(m(m)z5L$91@{jH0ONVoc0Y(oCU)|P9UdmPNa>{ zbA0aYiEwegn$ou?vP4b*P2taQS-boVUqv`>I!e;X>26N@R<7;84PZ$DU_j)L+k&eB zuKDr~Y1X8Yjf?dH$5UB6ca$C*8OXt-McV5+KBTicxLSdZ9Vw4~G_2g7Xix-#SpNu| zg{|6y%Kv&?H1Kaz8~i6*y_~i+)K$oKS2vwq3gozcF_Dnk+vXHTt?d6dG71foI%FU=9nJR=j`X84N4Etz11CvFVf1GOT!=4`H1R3Q zr;4TDq1gNXP!bwdV3PD_Uv)pII#8Ybyj7YJx`j+f#>?)AS5YiDZn#?fK<$1RH1u*# zPku7a9d12`b2WjL00~{Gfc`A(TiyI5N8=uq*r%kY-Z~lgDtl1_bMR#8!81@$u!N@! zgpK#4%rJD3UpQLKXH4K@N|5QhLyb?HBwQE=^pcs)=ZIL2)i3jRDq_*6V$+doBuBb$ zQ%B%K#3J?C6?juV556sR{gQlgW1-`3`^71bw25;78^pQ-4~eUJf@&1^$oI>;Q7KEv zuat`gVdc6}xmco7uB*jG8sn6!8W+2ulb!*Ls{*zJ@^tX&D)=IC{nE)gy#<^q?sy`r zP%f2~Ek3f>nABeloGI>}#D2RaaBP^z9a{pdo`l4>eM?|J+MpoFZ?*(>g?Ze%CGeuw z7fFMNveqYT*^M1H>2RK*>9j*sPcTuxxd#NLxr+qH(+C8l!;^-J{5C9bFU^M0PLk>$ zxC4jP&iV&#;hW*i%40PS-i?wzqWT%J4{1+!{|K;It$Qj{u0MjNW35zWOW+hinM>o6 z#P1PRy)k@R75%LxorLUv;l0@(Nh7o_aZztFAfeDiL?%grKOuR_UhtJ8hOu67VATk@ z=!miFGl1%!7;zdd*vi`8|jh>UO5B zb|j?<@vW15d-lg2UY`PWhw(i2xM%&hqo{MSb-X!x^A(I6R7IT1)ZLu$ARd{`KmUj< zcxsLH%uloX@pXF(9tLg)Fe-y+5;1rs2fauM=$y$xD~**-5!ac#Bkqe~45DKlNSN zWi=KXza!9%@zL7s67j9SP+dGno=&w1p5#-UjWFi9VQe92BRP%&jJ;w0Y1oI zRdksRgy0RCdvO1`fLvgKq|?qsvXNCy)iDt%`diz2t@1uJLd}jPPe-HZU+YE0n53c` z>T)nuH(a$WY71Gty!jLY?QY;~9`2Uw9d4tCgEcKFjvOLAXV}H_sC`AIJMy+T-~)1W zL$_}cI2yO&&h(wq`9_GmF5{8>>Rkg?w_ykRhh|6%PxQoWS!H!RQ3oSFq>rczTn+zM zrJ{-X1)6ppV#4NR}9BolE=0>J6$eGV7y)5ql z_g2i}6{eYGjoVVq%48+B=cQE$am#I>z#&;F0BTf(H2=%Un(S3PpY2myC!UD{jm_v2 zr-=aCoP2QEnTCJct!s(E#7sF2&++xipW}~Qb|b0yH*wt{^Mx(ZyT!9U`E{|jL_cR) zPg~Ygmi4G*J!n~fwX8o{*6%IrHMW~9EJvdpaX!$X7@fOm z#0bw(TN*50*Hk!3$<@11NsH!;|0q|i1<#}OxAb25`8lKqlm3gM(zTnVZuAB-t*=OJ z2v`b>N-EzP2b!;p*b-@^-oMXMd~ncB)wiYhAih$31mx^a*#1UK8E+kD^*hv%uM{(C zkK(&g4J(h2>F>#=WnUAoi^a5JxmOys(>Hh%&6z5%eG{}uyEDY33RA+mGc*+kIfdp85L@yIC5$1e3XZI<(tLgpDj2`~VBwNUbHs515 zed3bi@9#9c*w2L$K%H>x?r7*b%9GEe(mTCzZ;Q9gqPk!1>##n@?e&)+c(OgbO>+0$ zqF6qUp1R|C>zAx#q@Ao5z|AD0n3ThLNt^&>PbbwTy4)CX(d@$^NO|{NpmBH;> z9_!|azpH7F1+Vsv@AJR)0ittPbkinpNyAssybDNjnR0fPa|{8OZ?3UkZs<@2OYMG@ z{xQ=TLVz>+il+$Bw8=A9NH9$2b3FCl>7##8sGkcTP$kl(3mGt4!ZYV;zR=A7UeeOE zqx0D?{e>***eg1*_7Hzj{d(2vJg65WdA?5v6&6!B-n z%?20k$xcaYXFlVF0%(Fu35?vK(fN1P|Cs!au!_uKW(}Z`bF7WdBu^FyC&9g*RI$8A zi`Jv@WD?+BVvhMYb+|^aQrdH8q*}%7NkzJA2><8UdBeBITw@0HD}l>Nyzl^JVyYH( zkl8n#@I?OuTx?jp9DpL~umP4Nn~R5MkbzxfY+pPJ}iQ-HQ6LeW(X z_y?FRbWSd5fu*szHG?gz@N>n@Ew%^KwK$Kkv;H2ARmXUzSch%=P9|#l^SAFP{^?z3 ztuy)-?cm=0-Q3{Eu{bXW;jZd>ma3)Ss&#_Sw`u>k#)2XYWH%UE_1vBjOKz4RB6z6< zVRbpFGrj|pa^xoPLt= z439ev;bU$G+jI{>&FQNk)8~c6W9;$GqOVN1xX}Y5L)%x>!nqJtGRlU0LRUW&Qgl6= zIZh@o77ueb|FuK1Z+=oNP3pHZWfDW782eLt22_8${G$*AD4!@k zDWB+Fb@}$HqW;I_Q$<7RO~X;GMi4%10bR@#Tn$&n8mdSXf=W;Y`hb-N?{WTTX;?Dm z$I7_ofBe{k-G14%(#cu`Oo{!*(p>r~jQMXCrmy-ExkW^2)#g>*G+YyFc${TGb>tbEHm{DbC+{jFM~p4N3*oSDmT$t*f_!g7;b02?GAFHcZjK z`)0~xbsSse(2{gYy^hYkw<=$&y}FvZLz*mw%%VbtAkDwc7b0K#v0^Vm1PWKj9*52m zwj6}=U{`AQYcPV*sSRI8dy;hs?$gT-g8`)=82oze8P^xN%obDA$508jro zE>QX{IWr(P7Fy+Z7H;Cq_-0WaBkjp~vKXGvd*0r8#V=DxA}5*gPx*%MktvVlfPw-JW?3A0DL!*W_iV zU`KjJ@;9o*d)zt})NC0j#Xynl+3Q~|cNi)>)9?#Fs zQ4=VW9N35P1rQA%I&iQSvj>N}Ir^_D{m_c7r3-$J%4i*@3$*^+&8rm6(_=De)+aQ* z&ZclQxtwNv#l@k8ohu?UeM|?UMv$keWY8A3<0%2?*ZG2l4}zoKo@e1B)z2DJ7DK{I z%)i<1{to-fG6%?+h`M(>f5BOP3%=QcPgnUzS=-d$pYB2ljta;*Q>Bk#ztAuz2Z59Z z^FFwUEVWYiXfOjaRHS-}X!z5(+)(&M^K@28SvMCsvkj$L2=bC1{NfwfLLSO#S`f^j zb1El9*f3>npt@e#E&Hji@EoluO)XpfO7u$g*K`|o42vFgsUyI|+7l(`&V%Epl)t{t zinnMW`mY|hW9{652ru~TQ> zEOUgW0ISmeqiKLdlr;3bMwVMuW7Pam(g<7&U048K*9~fp#);xWb>e6o&6ipQ7P(*7 zpWR+(G<+zBB}`A|vg5E5y(8tp5@~CyT}nGW6aQGxaQ_bO5VY~fE6ck#SpMGalXLw# z5#3%b$zpkok}RCf^Xbtt*;Z%Ex$Dg=+2D_)0qvHPIeDNdJE1t_f>SBhpY{)gp*tSA z(sVV;kR~dUXBR-u~QIYWl+@2!vrzMTEDY-W=zvQg$vxm{{%JSJ5F}HPlqGR z&belEUh-@*ZSQH}O{VxvlCQYV>BxVwnKFkb3EIR9?O5)JNgj^$NC~UohFE3f6k_2#EK1S#wji%`xs!x2LLd+C;I-9Qqrrp1bGE&7B2u}m3OJ1RnYG$g^{Wl88_itdd zFExINct$gC_;`}<1ZgZeB0bYC;wTG;;N<2^HaZQXe$|;Km{v0hEdy|jYz*Pjc zSgo*)%Md-$sr8vAw>xrka`Sw~rvqTT7g-Z)nOIcT7N`xmLn}+&V8HnoCy(w)LE_{Z zt;Q|9<|Z#2N4TbB7`0JqDWK_%RNqmV%`19JceFDlis_G5VhKIsj| zsuhw6th5!{s5^&5Q2McA(Mo#`Nx|u-5SN{;Y&^;^n>LnQ`)(JPQheFP10u3Ng7mhR zj6AAq!@H3KI!aQTGR(jkc++2m+c#{U6w+GMxPX_w)gdH=+4jq-!Su8zk%u6#G@8$) zS5pmY1fa3duY0;U%Sf8>u-$nkU4jC!j7Q%7Hz<|wIJJsn_hU|YCIvpFI)uMp8Dn@( zc3Dp+%bN+@^UR~TywgUtUD^>F)`8_5nwtj4bw8dD4rI`Q$4Upzln(rXhg*v1z#sS* zPQ>e#V7F}GX=Fb5QkdOxge5#MK7Tzx1*WL7Xx*V;!l+`>C9_$YwyUXGpf>pb} z97j*Lm4!a|T4-|!>${C~REK(kD-`R-SyY70@1=i+5WGd`Yw1j7^N?cW3mj`_n)k3B zww}`7!*1$28oT3>G_&MSQrpfbXux6MaR)M?l{@LxS||7ajCa2Dk;~`qKuTN@7HM{huCivMbjf7v(){{3GakYN`Ft5}Q_jwhS?H%i5dk zy3oEl+tW-?K;e-Fr;i?*hcXQ9hCAs@$MxkxxV33QjK+V$fhE(?=p)=@sxF6=%bRBs zDL8(r{lL5Y#nJ>|`D(~ki*XvqU4avckJROEQt!~XBep^*$93LlP-(7a5pSDy%FdpD zKxwx;^dfCpUGVxEh_Ed!hF&3_AdS|Bk2v8+Db6P0J-VUCcJjCfo@~K#T)$iDjR#UQ zlfHE{{8SQ=u6beesneV{7ib&RxW#&HR%}t zYSl#5a-2*I6jO#HZ}lfI=@O2X-n387P%`V==s!vMfs&xHS_DH^)2@J5$l$A0GTbkO zDa&1k6oYNWJo!ivRo&FZS=rMJX&tYz_k;pmTWG2~bkMDGE8wbmx)`8vj()0XpZ`$~ zG(dZG{Ue2EABn``aFkTD6Ha!U6+v=ya->*?97r>%-rp&8le8&jQ^M)x+} zq>6Q)xJZiEusO7UBS|T_%-LKUL*rt1P*Xc3WSQetHDQ21#;W#{NfwH@a!v25?GT;| zV#n=er#@gk)f3Y2(T>)u@=N>Y3OUDhqEvA;SFt4iIqhFn9i*6TJ;1-Qm)&2{W2d$YzYk$Yp%ANPgct%~kbO|(}=z$w(Z?b02 zX!av%$I=MeshQlZFmGO6K*U!y;2F*u0nOISV>D{C$lb`k+}zKJwI!l+hk&L?2yH=H z5+jnU$qQGbDMTVvBuQs!loKgP(9#}TI1(;Voo)pwgj9DETkVF9C5mNNb5wh#uS!uf zM#jJL5wS{;fV*(5v9wlSI&8ctY6J|m83@I{FZ87!Bt+B;jR$5m;qZ7en?C2}T(TTG zg6uE!c@D-(1Gok~vr2}0Wk@|HW>$0h+5PBDuBNH&-kStNg_kRWLI}E2vG_oG|5fkP zck!d#Ij{!MNE=pvp&1bs3SHa~Y%s@PO z_<#8=uTl2&uYY6ywSWX{_nY!!x1>v5F`bz>LnFVGEb}%5aHeKYI?~X>13TUGBatz@;5TMeL?Q|P3p+x5^PKW zvnv$VySXJ(Hu}k)AHjTis#6$V7g;$Y=f>7gMhts}YwiiQ^kw1PL&=d%PX{U(N^E)x z^F^Q=psw@ohoHd4yIJ$;m`(HOTa|E@tIf=&F_}#zF`YkE`pG$_bIOq9@p2L3%s4K{ z5?q>woFg7h(L(@rHV>JBg%;+i1uXs9>(8mO5CZc}-J$Fz7i8JMZs!f&_kh?lPZ)Fb zML@`pI%rReQxWZ|Ad^Rk6ey#u1?epeGHm{&^J4_AK`&Rx`+iH=Q-tc8>!1(%uTpa& zYYdLULwduX*f#H2dsRP%0a{l#%j;J~PT>I-DVUnQGOLu`SFokyq+z7kXqob{1rH9Z zi9Esc4>EIBbKgY&PldY(D@ijs2PZ>nb6u3PkjU}v{^Cz0&*04Ked&z8T2p3T!j_^ci=aCL1^IxkeEq?f4G!G%HU?UA(PH-|15QEfMtFq9?1RA z@^;zpg&>77PTv$~M8KJ})p6Y{LS#nmZXVIWl@%i_|Jo}R*mm$8ccAn1*@fw>MyvZm z{BFk6>(&w=I~e7%47s+CIXZH4z}+160xn~A^9Uo8#9R>pchc5cYUA&nFJ~rw%A>2i z{87oE{umfbi7DZNTq$8%TxQd}xWMo6&nzq-5#@^5>q5|TX+iHV6h}=_w)l-sHP@iH zCQXTZZ=+)@9m0G9P&-ltG$MWxDNScmWGy!VFEyP_ONRx1EM!XhbouT6m0!RdL-nc5 zck0r8N6Cz-n!P#a9!rN%f_ILyy}wYM3+_xQnrzr;5?#@3THV#dN_e!^Gn&miCsR-U z<7?1;`l6@t?Q9x;zF5u4hH|CFEessETm_$|JSGlP){Hp0pNLU-o4$pkUUJDn9p3a6 ziv|6yd&{0m#M8fe2g43`U=x{}54R}Aq$R(AWe<8=W|;j-uAMD1TSM|?$50Tv2qAbY zoJ*j*zraH3Cwzl*gILYUZsii3r(3~GmB+*)WhtCx0^BqIJp_NSw{YIZs27T}Y^p11 z;TqXSc_ikW9A00hXfpG+-U;Lu_eWx-bM5gA29ZrUpt!zT(d|RN>DrzV&ZN>|-s1zZ zW6$PuNlS-$u3$V>53_Mk5bq!l|C@@x)59w;(RcFQd0KEhluY z;}ClzynCFaC4zEJ93#7p#}vWiJi&vAbF^A1s2^vTiR*kmgdRIXqNGy;R%&ch9Oh4X z>tJ{1ADwEy=1@WFXa2nhRC5f%2X@j?L+C5?@eY(LT(!K+c`b);0O zI?+=iStGT+!bUi)iKTtxu}W>7m$?E`q??PF8a5}|6L0prPJI3%8R}9%1Ho4+>_?8q zGU=_p;g1p|l{Fs(2oUVKK>JR7{r4eKaoya_d{YoOo#!D=o;#BU)(-CcvsM12fi-{O z93pKao3^pd`$;ed&+h}m5g04g10d?CGNa0V-85iu=!#&X}K-69_%>OE(@-zr=Ly3mPDU-YaCy~?@}O95(O$lVmVa8u8E&?~xpeXj>CU_I#dUh6?S zSr59SXFcdv3tq1Wb*|R@!(I=nh16F0`dn{1O!^!qb6h_O(A0+an8?dK4;$WK|k+M z@mI@!A%UFs%S71v%}yF)V;fAz^ZK|p+Oh|Q-a-GZ;!W2|bgYF*E{zaD%(03^99hNN zCA!{S{`*BhV6a8L;(?DX_&9{`$TT>Ep~4$6wVP{x7dTe^0kGhG9o%`ab{^3>8g_Hc zQSM9PJ{WZmKm_97$`MY-+Wu}%u?ht67hCn>V*Lvp?Q#G^4{WImciwYH;JtE0mSFCC z1Gy^+hm*Hc9jhZCuuQk&WDhP|M2hG-@E#Ji_@!fQ`G||hiR$`YWB|8ZO&_o{?b9iq z3gsPk6=8!N;TUG$F^_rGAPsFKr^4!ShI%bzf;3=t2n2l4Ij=H{9+I#A}b>dd~ zYgwQATD7?p8Euc^MJ(%S%i$-S%H5s`!}u%1MSRHmKBDOQ6cS+fSZeq7Mjm+F;=NiP zi4hLWt3Ox5NO_9sX3@$z6&K^-AF!Atxk|H6v=k}6U$inAlJ8i@BfpS$UrP99)_r`< zDdftx>5Tsf$yq+*JU95y+|NymidZY4VGsRb&Zm4_+J_8zfwNv3$@B)_-`y&Z#yq1w8fCl zwcYap1R`5SNFFqvXE?GdQVsvLoXI8DN8^aq9=#7seuzWfA)TiM>wlL#ZP_$@6XE`& zB@HMZ5Mi)hqO0lw!{L#nD?tM~8T(Vf6dmc6Xp+0h`YcHoNgp+^|GDiJzMI76ruSEc z@vBv5m7ZGd(rZT~`;-umGMF!`GK_ia0K?s$aeLXHRAlsd#lhrOV;+T~+NLi%(B&4R$p@ zDJc1$Em_M9;VRP~OE7m>#2^8gco_cfmq`@#*%xJ1W?(NqYFtCz%>;uukDv2pHwOxO z=;@1obmEz8o8QP^dHmGFb?zT?f3Gc1`C3$wee2dp$(tYGx^oEdfq}T=uOcm^`Z_>4 z0&$N-Xl$cREWyM3v|tkcJT`n@Eq{$`Ye@ccCiUwXyx(#E#Jcl|Ufwx?&kFf0Sl{|m zIj=T6dOD0#23X(mUi@hkSJ0Z|#|F%XZ{s{%U+i zId?J}82s;UlM3F+``7M9dO4;v4Xop%EX?{@G$K9BA{VV3cjT;H<3g|DYt`QyL$SK;$L zdp$|?Q?e(35>}Z?tFueQ6<@K5;O|%^li5tv+_+Hq$SLkjpBKjg&pck913)^!8W;~Q zmZQ7bFZ_GunlUWXcXeF-q_LipRlAhex6eci%aqp+@v?F6p#NMjmM8MwqbbsENIsF| z9jmHXA_``a8IpzRzo1tZr<9nRqHf*E*2GKllb`J@m6dCm;ZXH@y*Zs)$r zw{L4t`J|EU#wpV_!Oz|FzLR!Du~lX4#$VnyT}ow9q4H!+PhE?g8m#Mu3{-YqUlK%k zGozI+QMUeQy#R!`qaq?_Dp3 z&|{as1E+LKp@$kDWK;A~iyrtx4>c6nuhyykDn0E)_JRbdGM53_rbLy*;{g2`5WH0V22t>B9g!5Tw5T*rzgt*ebdGAT` zen&RKy7&rdA2h!z%8}XhvFrx~sCzS;nf|TH6-?cx_flyMeYC$k^5}d^$~>1ZO>c@K z2mAXd@2lUZycdRGbh1CW7eG zYr7wI@*dAV|E(%kx@zB!RZIGcw?pDpgvA@g_|&T}(61z3Mp(Rq^uNC24G)X=++p+m zoK5kX-jw5!KI5ryOJ4RDQ-l6C*^%x`F33RoVOSn$iRB+n6CrQ-6y>|qGY_d%_j^V% zkzw`tzEQb?EYup`g}>xhuI! zv0^#Dl>BL)>+=2T} z=P@uvhrp(1RK53xS7MOwnplg|eZoFIkY5*d{m`=+7f|88}@$3`8zdgGB_%jXh zWAYI-@j}BB>pun@2pB`S_=s#fvU8@b_tn#zkK2g^x%Y@oU7Tf4gqXld4zEeUw)tN< zCx*Ydra|^wjvt ziWT^c2;$fJPmNy|`Geon$3ap2g7}?g;djmv@ca5{3%}3A4#!WWukm}IOHfp~dg@y> zR;h1|pKg&iruNX!ET-8>i(Cg{;Fo|UenI@Mkxbj8e@4LJ=y$2cFZWRVRQejfjPHwI zR1m*>yM7Zb{O&%M9uro-yEZHQ1|I>xCnO5>`;ge-^i%0;{O%t1J?ZC33DWN~UB9g$ z2APh>GVu%2?*a?Il>{7)ey3{uh8~Kaq-FQ#=1+BGpZGoLmmb6~|8q^hYVwDE@3R^venI+mGX@dhJ_3Gk zN)+(hE_OJ6Dt(RL(jn{X(8 zDt(RL$nT5a&>()THhw7Jjk!jYJXtCw4gfRQejf#^b*y{Z=OT z(66;i)9)S-gMPyWKm3C9JI%sx6#<8%-`8yxexHfm3qMI;8K0IZ+lOSV4Sc3{PO@GB25%nMR&r#jnsD|5rE&vVR4Dr4w;^8P9GLwo% zD(t)qmD|LzibR)?t!CVwTxW9Do8^Xgu5V(bg!+>A6G{=Hamml$HcUx!0r5syII8n> z_K!7n`s9fzQHI9)Zuk&^d(Q(0c@_73bk z)r!X=rSCNVaD~`T?|x`-k-*7T&TGGsjlkaLMb=`;7pd{U`h(rFCY&N6U+I8abq6l3A+uFn%;|Q^9MI>L?RJh;4a#vf4zy7takzYQkpFlz?-#eqbo;+xu{32i303Ykp z8*c?;mv52?lH*(rb&}L-l5#g~B%>2-c{G?050Rxua(+V)IKTLNkZsd(375` zceg)9rDr`CDNTo6QaU|V=5Z=LDRbZH9TT43LI3{81-}f99}N?wGChs6OC_uZu%5Br-(yx9axko!A2}9BQb7&mcd0uF?>8a5dPzH}ja3 z&Bj<1mfbla`$6pWqU4t+!cC?m--X3`6HI57O55TW{<|Lo-K62GCG=x<4@DX9RL?S} zFX0rvWT45n=P?m1p0A= zH=FyI)iO6Ia7h4bg?qh!AlEJ3XTaxp`!jmv1afVzV}COWE|}K~;%<-Lh$TNuaT(b6 zsLW~Wm5=X9Nzwl%UTnbiMc0y+Z^%ggCOKog_p-)v4Bt-rF}rr#qZde4{QQ3r0NF-t z{g_#Gz;l?S#uho-m7fe-^Lo~Gww)`KQR_O!aHus+t?PWw(x~@bvVBw5NSls-MOoKX zQ~wRgcPJ29$azts#mPd>X8HP&TB&(d;_8)}y%QNo^h(YBtknEABrM{*VAvKl!Iojh zM*J{#gaNnUmtIy|U0$%lET}9pt81#3)D%>hp3-8oc15kHxWdfH$jY9RX%-cD3e3gj zRfS8(44hkAu%vjhL`Wzu2BgAVm{7WCVM6&LK8oc}tvR)@s;GEc^3-Jo<=*0H=ZqOM zX3;>?H0PIjO3lhDv!G^)x1zYxQ)?FK>?KQ`S7BA9N5aMkL_(>VkWgA&UM&uOHo9Ix zLPf|SLT$maVsl|hS$VNpSx`}|@*;AMc;~w3nVu>W+zZN0iDISe2CTfQpr{Wpw|EO! zi4?9kV7UO6)p|5SZax*kyp=`8HMO3qDhpN!P^+ja80o?k16y2EP^&Np!R+GNVhcKi z&K7=4h`NM8i;{L`RaHw(Z?##V&|AF1lw4FM%WKL!#R?Baaw&1Gr>M&7u~MrgHOZ=1 zy@WfdC7n+WQLQ{w1|(Kss&wrLt`ez6<#mq2rHra9E-&^J7mbmNo7gyyRW=t*ff-@zUT{h_s@T0{&X?()bKj zX$JLSNOCF(BdeyW$XnvMlxp86-sn5LT!-Ix82Dlx9&>P(`eJMk`_*dKLmIw!_!1qy?l9pw zI{eAQguBCXJG^77BSi)Jhx}`H)xQb%ujcc8<7f85=e?u9UwQWZi{-ZQ`AWl`uBc}i z8+AQcqpo3W)$TKO_)hH}q1^%P9;w}5YWFDZ9<?gEo|#*|%vD)ZWu%oB7cQ;!R+upBk&H-& z4ltd?!c-<3uvJ%)nd7N}#ZJbdps_S(QeJo#4K(n~t@6O++{KkkJf(0-JT({9LV@tC z0^#)*OV*)P)y0)0YcbfO$z~7K?740?LzZN1Ru|OP78e0J#u!^vyliaQ_`-xlJNdMN zN*PO3Lay;?3_HTWgd2+p6RfSX__=}WNz(A-ZD{M8uGIZH> zVv*0nS8%j4*MC(3AiX(H$9zJUL}o6!$=$H*w;*-vuj(>iku8Q+5Q+L+V_W z$Hr4fDKD;!i#JbCHpeAV7)4PP%}#GRBAZH1H@mpZ%(3a|V=v}smX=PgsF++^8*dHh zVQ>nMih@G3fYG@xTr?h1UWo!>Bvufe^TW{z#U~WTLMsFToi15VHmetoEL$Xnn|zL0 z!mtgk^G6n*rP|s2)a===*)x%(kdPUWRimW?OS>xYdaCGSWk|N=mIPmDbq;D$!Yhz8 zBuIFZP4}wGgrc$~WgaUd5ycj-=&6OtX57fyc$Ke?FS#l)&#bL3E-WjdAqe|eQd3OD z)F5ycR7#@}KySRHW>sgfpmsVnE2L|PBw1Tqwxp7;D#34s%D&c&t0)i&ujr68Z1~b* z#3gc;zEfOTI*$lchCx$j)M(B4Td=LcjDXiz93Ja5|S3*D>>e3Ww5L#}BPL z)j1?z$eNfqIsE@Q^xO(>xl{sO$ZjI^p&2tKhySWOz32JXDI==Sk9>^%Ceb#JctQQ(!` zH@v>>7o**42Rym*{;Q8lSoh)o41cPnDE5)zpPFkfb6)=FKi^JWzv`;(Z=Bq@=dFs1 z9^U?0d*jOu^KL6YuI-+sMOS>W_?wTPE&j=zOCyH9Uf#d3Fxm0t=R;zepD`<^{5ZDE zy(cyQm72?!{QjjqkyB@GkGk-i#v$95K0NU5FYkGHV)<#+$9JZD@x;CFmG2nu zy>wT`)*-LHd2#Yff4MjD^-+_Jw=b%{=(T4~DCl_V;m;mA{mjh|&im!9k8O3_{p7ma z*Y%5wxgk35f!7Cb84(zC|Me@Y#vbD?UGSIT1sjqRO4hcdzPYUb()zKJ2!m-+6qW;+X#@WW=Pxs#1zx>L(BTm`ySTZ>%@Zyf*6l`r2|?B4#>f`SJ!U%cqy$sXg0JKs%we0%EMyJo$1>yG4# z%`e^c)n~81d|99@?d#VoC(O8E$zMCx<-bvz5S9M^@W^xX+ynpo?8+f;O}#ui>(8nE z&Wep4w0^ZY_}P&Um(G8%vC15w96`n+;hogR}9*E^q${#54h#5`;3A2-+t6p>9;ucZ@V+*`qED$e)R3e z{$-2iFFyF(lH&Ty&nrLa!~RPvmz}cx+ufsIZo1@(H)5Zk_12QAU5|e8#lH17rLBMD z#8+-wlkdOt)mN{+<)z#2?=3|L_GDp7((BjnPAPxKA1Q zw*#{x&&$6eDs|Jo{9SW*ExBjkO_k$TtS_5!|Zzntki?!Ous| z9Q633C-ggG?5OCu>!&>SbljjPANc7d4~>qx?7>U_*!|kZaa%hc_TB#aIm7RJd*Pam zMZX^PY2nAex$`pbz*{Q%{i*+e-&}Cs(VdM;j;c9sz7c)htfy`rdd0eT?;Cypm6J|c zJNVZ(ZTsnv^{>4D$i6pMp1y16pzYgUUOoNY?f>X{@U7CyhBr=o;e_?qE*$mffp?a# zsaihskzpTP5_3cKWsdH@Pw8KB>7a;Xx^FMOx$M5hT`zYpEy&nfenQ>516x1YHsrP3 zhN#&aAB;>Y7`5b&2T#cF$edZ`+PS=P+N{f7y6??PUVXh}(5{sIQ+Ax6bKetxdiwUq z-@az+12Y5N4=0}b>61_XWaDFhPrT*9oIl+8(1_^sIv%^F|7$PA&wo4jsU@$UIp&Iz z2iMIi*xc`w(nUWTU3K>P>jypbyPF1YI%QY%CC&T#CH&v~z+#H_{2-&IhCu~MI8Uj1 z^2RT=#@OEe<81$Iv@c$3T3~9C+_R#(7=gQ2O6O__E5Cs%c(RFToi}6d?6ka`%;|G; z^0G5h)AOcZoSR{mcqeP4VU4vKn+grWU`=(t>iO15z@Cqj{>ZEiOz@GnFxg#tca1 zo@_2HuBk-hBobLwIrBI*=knH|5w5B*^74vHi)!*Lkm9`RQV~Q%@J~)Q#jYwb&(13< zC!nZC>RYF&1<@ijf;G&^itSAFgkzxLtt_rXqNK6ViqNr|(l{*vQY2b)aamJ}b(70jG0G)uhY<Mw$SWUZ1YR$!>eY2%9gm8pKMAsrzzoHICU0Z`5 z*_dn^BWvZ~CBm%n>9B#FU^^nos*Gk6qXj$P{w4#ojQBw z+|-#FM%J7h*8&4ovuMU^jj`U^nz6OSDjuuKiqf*qC@(U~y+-*0!)270p~W<6m^mLB z^AMke@`B1G)dhu1?b35swr6WQ zw!wm*{sY-Rbb3D&Uf-3@((fq0TZf<5E8ed)9c}wW9lmr`I9=Vn+)>)SLC620Y#R@| z9?sPHcr>23>HO??-$j@I3lFcy|CAp8ZMxg-)zH6)frFxk933;j7&vI~kfR;3kx|k8 zkBS*E;3WPyw4=Lwu>MkE5^jSVM@96DiHvf@4mkF>p~s(a;xL^|?8&5cjCL5tN%~7= zA=z;4f|bOAj2UrY$bo~_@4(6N3CDhW^nrsTx}*C`oWX;5*3=2ae z(&!fv9jSi(A|fJ<*kg_j{v@XL>-QbMff63w?`TKwc!R|wvbXP%-9y5HqrzPOJC2Bc zQeA_p%MmonlZ{I2qc*vRJbVnnjsVNX`PmeNrU{7dfaYYr&a}@>E!C+)B7Ss#J))tqSj3uPjaJ!}>hl`w+ zmy?^0aw^Y~c08UH#&TJ|tg5aBFT^vCw^mTe%ai5S!eySkYEefQh)g8EJlC8&1(2r} zs!PhNmRkYe^KbS0DJo`un`Q4;r@IZqY@VU~*Zjn?Q#M=Su`gS8>srfh`Np!VcUboR zjh4Np(SqCkiskOus_hpnd-oR0Zqxp22BsSFYty!Je2+i9@n7>~ih}z88~;{ajvpNV zHUA#|`!zj(DEgmMSV*TWDP+Hfr)qg&UM1T`s#QxIXZuzx4)e7tOWLFKF=@kjC9;}h z`5*4DU4Q#^JKU|?(e8tq4g;)qVZ3U&Q(m;}HM+cqw7(Cn@DA^PxBc1pr@Ue1e>nWB zJFIX+_lw^6@7C?=yYT;^+na{OiQ2a7r(TE0cBLrTtS>CP?HCPb^S7@p z|NVyLzefAFXnxhI?P_h?@#?j^H-D>O0jH`^4L#NI3DeZndlW0dV#=*sack1 z&&Mqi#2Zst52!XPYm(0xS#-vCcG^H=>R1Vo53LxQW?0EjX7XQc7M9{IYMsKW zni_Al$Iv!YbaoOgE-z-^Q{_@zvi->@sVOdwV@b_k;H|D=jAZvqZ-2?$up^bQNW#pX z6&%@`5+`xv+4fUFNeXK6sy#I_gcU3^n6_3HP-y(^!o?+;D=GK5c;>BzV4+bL6e_Ht zRHG|wzziz8z1N~V$Z^hb1E->gxJ%hcCUQeX zEregTaJ+f8S!Rwl&s`++Pc%}6{H(@J9%$%&fU-zft5%z7l~IB*W(87AJjt-Ur@m44EP=EP5IUKj06Pa2P)-I@t+r`ul~M8;<7mr91v zl~URuS@^6fH1aCSit=a#?EP9&X@}{0vz=CAMjnkc&km}n0j4@nwR>X8g2N!2n(o4V5?PsS-dnrLrCzm{N*i`Pw77!H!Bmt9#) zDy9EbRW6CgL*&)7`4D9gc6B^eIR0#va8-%2@;veKlf>hwbgC7hs9;>|A=vQ zPq7j%^w!Xah%dPY(+i73)9)2dQKuHvqG)3)r@~L++AC6cj0z?U9{5$SNXFS`pKWSQ zzoo+zy{6i4S!)tzlT|ouNfDA*ozm(G&+KssFR0e!mv|vTVL)N=Bqi0M!lHx$OZ=W_ zcKSUYVNt^p=@ZTxnP?Qn#jR11=BQB+Si7fM-8$YB z24Eh_MB?)D7JJLsz)+cIu_843aY$9Nwbf#K7K3D~M6jL2$B+ImG8CrT|GnJeEz>4$LSq;0kvr#O%T6q5zAzYMtJzRA9 zP%uczd!tQDkPLI zT){Ht90b)ajEfs*jqf!3@rw{C5)co*H{-B`kWn%<>zS=2#+xfwl3(xsVaJK@gUDd_ zfBcI6t>ik3QNTGwy3^GeIz^~k&_qI(#xIABomAwB0m zOA#f<1<+f~Q_I-%FJeX?E$ZLMgr;Q)VP;&2$fE_IaLGrv`5u+dWOI~k*vL~#ogO+? zAAy9lj~|YD-z%~IfN+OT|A(a6>9o%ykxYVrNUD9`^!@|F9Wjd^l6KN@Pe<@QLW?8x zU!dMHEj9JoTfb*g{{i8Sl*12AH*0`m3dq@^JPtrA@vSeFtHmCT9_jJ>Gkpd#VJU|y zr%*qrv7lIK_pA(h(wEtjHS+Wk3q8vJ!)l&z4bH!<GcS0 zw`zNswiC6TrR{2MuhI4mI-S-!E1i<%mi>mgZ@AZx-t7mw^@%%EZT_>*-&rnGaLnS$vJUQY%i@N<4lXau;^NB=F8s{my4Maa z5X|Dv;tnpU&f+HTj#sgH$))3U?49Jp9bqZGehYj3EQM0aN(Mg)FuI`Rm#6KVV%Y)s!zouTkg?O(iziLRo82~McemiyG`3Ww7oyW zioajGJDl3B?HHHkPSJM0w(GT>rQ@|~clD*9-1~92;%>oR zkNaudm*Y;wor*j4ny&5*7@pAR-hknKv+fO;i>~YHeg|_o&rn9J>gxU-CbhAvdp%|z z@S}hq1^g&r|9}|<>>n_rfc*pJJYctA<^lf!W;O7mfc+z83h;w~9|Zg$V11ZD!1^$Q zfc0Tc0roGLDZoC5Sql6hU|TRI@cYG(#(vVM27W)L8u1U~Abj^9pg-Xq zgm)00Pq<0ALHO>ws29Rp32!C5mGDHu_qP)F_uxf%3*ps-R})@MxIuUu;jM(%6P{0a zBH@XIClcOvJN|^{6P`l2N%(%jkuvP34E2Pk5N;A~5WX86*ATvj@HK>|5N=5R;J5}H zTM4fwyqfT8!VSXLfI~gu`GjW?ZW3-1ZW7+H3OY3r_7mdyh~G?{n@Hzo@^2yipHik< z$oFU9`*YIy1u(Y(`zzA_H88931HJ=z^G5uDZv#FS*!=$?9C!oRtXoMF`2E1A{E{?* z-wphaU&ekNIE;a5*+Dv(HLnp5)A1_lVD`U4KA2cc>vnL#v;jL0vjw<$m=AzkhUt&_ zIk2NJYk{4Cc@?-4%mLt5V@|;Q0a!QY31HorH-Rh1d=1=?F)Rz)r$E1MC8f zAGkV94CXdq<1p)hbz*h^SBmKZ?gq>l%%Hs)>MDly*zcN6AEnEQa8hItX# zA7efN?rO{k%+G)wfq4knbj)^Oi!h%7w+b^9a~H4^Fq?tR#q0sjgE<-V6JSrq{2AEE zn7;#i3FafT|3-bnWmtkTt^}xnrT7gZ(v;mui*$rGZ#=x`yYhu;_ zn}X>8E+1n&OZ*P}Fl)8~k6H5~HfGHW*qAlXV`J7lhmC3dJNaSifj#gH^$6^#m>Yo| zjJXlm!I&F?9gMjV*uj_^fgOxl3GBzfUW)k`_@4rMEap03`(dsFwjbs?VEbXN1GXRL zI$--@YJh(i*lf(Zz~2CD45kj)F5v1gUBK00x`3<0bOBd~=>oPCvjbQsW(V+B1N$wo zm6%U}t;Bo+Y$fIsU@I}709%Rq1lS*AUIca;=0)H=z<&m85oQmtMVLLn7Gd@PTZGvI zY!PM;u(_Dcz)rwy2L3YOKLYj=%p1U7f_VejOE7N$dkN+ZU@yVE0qiWyW5Aw`c?|e` z;CBO?h3Nn`3)2B?7N!H(EKCQmS(pxBQ!s0QH8E>|&jP*!*c40~uql`}U{f${z@}i@ zfK9=)0h@?v1vVBVJhJ6pzVE~S8}|L!4`4rp{V?_;*z2$#!+sq5N$mC5ZP**g7kC+G zT7ZvTgAIJ_gV?~wuEhpE_EBu$W1qkVKK3bW;A1yp)6QFH`z<>$Z((*}-odH)8I^JdgPpGx)MEy3fH(#keu$m>V(oVxGr*j2XO?I2bpk9CIV)Ud;2Dk1>PG zt+I?6GnP#VMeNZWTQ}*vyz?fERj1brY6?ro5>{BiOkXsIY!1>p>R2EeZ=7zPp-)zo z7F4rY^9+NN|3z%wEU4(c)6SyUq?R=G;nem~+K$zBwYCjy*K4~~+i}|d^kyra-uC`p z{t{^vFLtCcrJv=Vs{EsjWaZ!An5Nt@#sw-o%1Dhe72I@X zM;U3#jxo}e9cyGL+cah#a3!eGLg|TAS8*b%pGcuLi zh?qT0;^iCpf;T9aNV!eJSfa~cDmLY)Q{|5}Rw%olafPPGmCBAWR_gGplx-TvcLEn$9mNJJ#5yY}0sE)BQC~_Z^zn;c z##_oxG2T{oz45Lpr)j*W>=a{hyIjXNveJ7; z4Rc4~5+nK8d4)yzo(?;IJ6{`*whOKNtIzKn4?ABQkKWm-vyf~y9E?wx84XE85iQp|+y9TXyP{XSxK_I- zYB;aP_YCcSPOtbjKDIqa=WDzF+xDrte4{n~%X{JbOYLvtbw{so+rPJcjiy6y{~yYI zs>W-Gw*S-%FJCYB;qtZl&;QvLfB4^~!z^8It(x!ukGAWyJz2L`yFP7vZTENC>iPxu z#d&FSva>VNaybVOJQ`zNM=KY_ou#gIGtWv$;8qDGYDhdCu5VM3TZ4OUNDcyN!6YR9 zS#mQ4$8`$Wytl+#<*l7!R#$Pm+TybEG7o1=CJRVte3dKPGmC30&*H8!mgAO(<~6W) z{E>x{!}pJGrQcUE1}Z$fl{LkMRZA+_z-Hgkt4VQ$aD{{wuIY4E!hH6!hZkMp-Wz`% z?}!BmqmPwt-vt;mhNC1R1THUE~~4RZ!QBLTUhNKTUALRi;c4jtIes&=GiseAEJ&dvnN5+2DaQwV)_#x6(F&= zoTRG8I84$;W^qNXoXy~*0tc*?P8W|EY?AA7%g!wh{*e8lKl}V%{a%aT{J(O3kD4yw zqD0w&EoZK|(@#!oun`)17cMo~G+kS2-Srphua0kwR3|m$+=gl0qQjy%*Yk`{tTPfY z3o-VswujQA<)B4}9S1DCUc1-y^0&i#+pRiYo3^X9ZFGgFyI=e7)^>-sd#BgiZT3nh zR=X$l^6w3IICqCG=h$ThHDf&$)rR_@(a8bhL&;;zWD+-zLv^{%uo<0mP7Y`7U8y-4 zIR*#kQs<^KL*^qrWBS~gJs)}2Z9K|-@$A%0S6bfujMNLo&4K;w)a;9`lyT3=cFlCn z?r~;iXSnC2rb|pN)}P^WXUHd~^yZV-f_dVYo0E|zaq^~vhT)!*mg-KQlbPz8E#C^^ z%v3j@+y#`8b|Gi`EEn_nvb7tol zxtUoqjm^D8{z~3*+o-_~4R3YAvZC6mF{MUzDThq+)a6Vtm-FQg^n{`n+-YA{n4t88 zrJMvTsaiNbaZ$pwA}$vgQEqT971hu~`M zU^L@0%1h3hke6LtUJ!3Jnt?qRu+FWNt8n!hv~uoHSNEdE)y7K^<%W8bvk&RHc{ALp zGjsCB*%w0Tw#SVQYWtL?9p?~(%o0wk^#@h8T!vN5omGZw=IlAy89{x@5|j_iV9#Zo zD^n*TIgi_G2$AtgVyPSiqFnFA30;jVXE9ZI*%DM-t&tEl z3urLV_RfU36}|n~Ay!apRB#tR{oIu^Ct+OTc@xeXJ2x$7!dN5OH9MCkkm^pD<}Iw9 zU?j`mglV>~L9B!c?u@aA#3U^hmqX9N*deLs&X^Pq<0+X01b_REpO!P8_~br5Bs?6u z@rS7BjO2pa!m_fyAykktceX2S4$R3lQ_3LeTg@XB?OxgF2*wzCL-1$UhivhyF7Vjb z_y;5O`cm{AdkDc5K|v*iRH`DB|8yaA?~t^d!z2}qcqovnmzi&+|iboDN5sJU}5XLF|O=+(n18cP#~2DB2&oYr`u4}b}`=3SSmY6c_cN9EMN`TwzZF90@``~Syx2uVniByBPpGVZq|xrf|h zNN!`UW|&)ZaZ8dUNs=TRzF7=A9mlq7>!L~ zg!*r~_{jVEuK#rPU&_Unzj6H+sQ=Cmk^8@-{ynb>?|%|M{|N-PsQ>&FufO~G!b!!w z`t4W$AtR0)zeo|Uf3Zs5&q;<{du0D&yqwFXAEo}`Kffqe?4;0-Nt&vE_|I2d|5)`e zchiy6ck>_a#-Da%e>Z==FQ(bWM7`YM_Lq3FGTFx7l>=W~_**xjUmHApe&Oqu&}Yv6I)S|z z<2O@0Vw58~{Ie|>^WU0(q$wUT%Og6DQU8ML%friO(=S-aNd38ZJ6ivOrL?QO2;&#@ z_pZ#2sO@h%ep~<0XooBC+fj}v`R({DUt=D~aMd_s=-+nyc6>LY?NLnVx1$_U^4sxk zw8L}%ZT};tf8_ofVaGjUYenks-&zs+AD){H_}d+`pue};e=|VX+6+x0uy*IZ0|$L~ z4p<`vKOgpk_!m{$6d6?T;MPP%ECX?dE49YMV&DeLf8Df^ms#Kxk-ZI6^RzMzG^$b}DaWOvC@ zB}$!oYVndKN|i2i`l-PS0~HztF74EFK&oCF*p>SaJ-T*n6Uz+@T4S&38EWa)qkD%~ z?tfTecfNu5>fFv+V>@^AdUxpEo0k=HTcaJfDR`SvXt*|B&o=Gbb8{lpFSbM14m~?D zE$iQ{Lz~`xdUfd5p*yz*+QoHlPfO>Ho!hmsn-~Q*MUJd~VCT9c&ud}5|KpwRSq7Kk zGc2q;e7IwEvqHH46M7AFz_u;FViO-a-Fhvdw?W#=usJh&zmes=;4)wjdmU}sW$1Y_ z?6rL55rbl|#x79oBB(U1%$B7r{LTDE-u2D=@4U1>a&OI$pSv7 zR33ej8mM5Zyf-~`{eG0?cc1K|PuLArFy&)USBHdSOjkqw{^^DeFGrtfXb?^DnDyi~ z?=iNM4e|Tyr=#7`Yp8(=rusX!Q^BG0=u<8j?DsCe?ezH4pHt|?G1N$$-K7l^>rMq=jF~AbvN*Gt;(0G+>Jk1-Q$(5mF3)U z%C&X8>A3O2(~kMa!_FNxUQs0xY9dX`^^25|hPN_1XBF1ZKb^vcano?qapOc9-t~)= zp)c`~dQf(}{US~7Xwy2{@Zrm2=W|!)Z+GkAlt>d(+41&^G|8h)>uAH5q-P|heC4*! z+45NWx#hO;t=$?|R*ZHV$E^qJXN~Lc(uQ;G{%J>Qx8Wj{TiNfOMq%T-y1FdEG+nz* z+cj=oS+})YOx9F^mTesOfp2L-KO=jbK9+e6RK{+Vw|lVl>G> zfFH#s=TQBT{2QO1of;nq{XxgTC@;JhDuv$LAK>r8W~T-c_!~CE?J_qfJ&>Kx->_n| z%>0Z%AdkngZCZI*-qgH07Hi^tUpZXkqqo`132a-t?HcH&^JlxT^XMgE-JQd_3z}*zE?H%#&i2u=Y5(^2j!(+cGC3RbN+7l#RI+NYog`sp)9(ib7+jTlf3?4e(g=? zE9Hs`UUy&3Z=cHDboZ-!V<~U^gX%7(;Y%wkD61%IDC;O2EC1|z>g!&>yDJsj``}x$+|A<@$iG-R`ZIAxpgs-s5GUrA z@HHoeHSQPc-1Ker*)i=r*z{c!?OMp-U&J@dW40cv{x$)(3_DpLe}!XK`ZojoTJ+Gb zzm_oJz1;G-9=45a`&20yu<&u+AcuYp9AqClfKjf@<*}xJv~g`3wu`xGk>h>sq1K~K z|5)ROCcuf*_W!~fca7}M-!^Q)`Z>n9Zknuj*Mxp|%9UFlt^U^kXyaOcYuv=iKRo@T zjT@SHtAAtt9An(j^h5vrT67#~!kc5QAC|t*aSu=HS9dvexJYeB-M*n=3Ln=$v15I{ z+n@;mf%r5hR3lKPhc6I#Bw}^6?hse@eEesS**r$ScB)W7JtVJco8q*Wvs(1SdUk+ z0k2^rUdJ1F6PxfBHsftZ1V~q7fRS37VoAn&Tq0z{O~ZOVA3JqBY`?fJ7uA87UZwRHR`Th9eyr$V3*h zaW!&~i#+6G1V&;MMq>;HU?2uzFyb%-f7Sf2VP0c#Eym$GjK}qufEzFoH)0ZQ!ercx zDYykwaVw_bHcZFun1MSm6L(@3?!s)`jXAgnb8#=`;XcgA{aAnp@E{(-Li`Pj@GutR z5iG%@cnptYDW1SGJc;Fa3M=q5R^l0~!n0V7=dcFPV=exU7w{rp!pm5PSFj$hVgp{o zM!b$U@Fq6lEo{cy*n)Sk74Kpj-otjhj~(~`AL1kI#K+i$Pw*)|!)|!q4~x2k|c)!mk*Q6Wjm)==MKx{13Ed|8Ik~XovRb zfR4BfozNLwa5=i78@i(hdg2Q7LT|*P5BlOt^utx?j{z8nK^TlU48dPD|7)1nSX_&7 zxDMlS;`9H1^z+ZQ_wG~|IYt%@GF-T0jB~7My8b5(;i_}(@hizG_V+m2JW6uPj)+Tv zl7FJY>QIu)g^0KeDfuS~pMMdy;fdzN8u-7v28!^Lx+DK98Z6@e3+r>_a9-C*LyE0E z+J7at{r0~jhcEe#@4uHz{;vQ0Qz*IB_usmbzw19Y{)x|j(6{SH({9&*wR~kQX*aHk zaV?|`Z`XbP;q!g{>-gGR(QaH5q@@Asp)rDRO^_DXuOaQ$?V2DhjSy)(yNywg-FEHkpI3Ny7XAIx5AU}6xW=xj?fTj^*6p8n zdRVtzd;5pCZvXIBPk*;v)7$m8Ypi>W>mZZDx@}oqW7p}f@s|&Ag`{1_yQYO}A?+I5 zH9^-x{wLbqn(P~V`xTcSc1>aJscrz$ z>gpPQdskOTru*7$xm;uI{<_)sZ`auOaM$?PLt*XqUES8Df4+81xAJbN1=skGA3Z3v z<;ie8Nq_&gzHgDjp??sr3DV-mi`37iWz&q*&(4E|^>g!U$}mB=CP<4-%f^e; z&yCld{z14VNQ_hnLyCBiDqt`-ioD;nVb& z`G>Xker}=>+Wo`YaN*PSe@6WKw15Be@2_dTd0Bg;?(nh^zH!3a{li+n@M-$X{KH!N zDBpC$+x^2@zwqh$k3)7GbdCSB=06VDxg^F7q;~%~#q|#_^B?c6JyL&vnSUO(FS=%+ zYawg<+Q<6Z3%f?Ky7}v2^YeFGf8!eK@2`{VA88o>aCQvu1OGnNo9-U)pFgb3j>Wb= zy2g%`k;-gbD|d|zXY;wj6_9OU`>x%`b&VaXZCHO@tjy-^8mp6k+BU5JINdj_zxDI? zw|V-{L2g+o4mH-@S?w0~nX-9Uy@xW<*)@zyo2tdT1qU0GvanXMaJAO3Y= z^{{)@*3UI=eTSdZY~1kS{GWfDmThDIcs4C7x8-n+ttTsU&1JOsyKTMsyKS2OZfo~n z1K6^LZ%_aAxz*Xft?hho>$DbJV`a8Z!^;{)D6@4MKAfF9!poXQD6{iO_;Af5lwA~| z%<5dfkn%{&V`Y(+$;u-wmz76aHY<;`d{!Q58Ld3ha$0$$Wwr81%WHKnY%uiQjKABK%inFwuP1;^|i9_I$K$Iy{#;~?p79Fe=7@L1}h6+4!5rT%VEc}c!cj)2@%Q?Ba|gY zC`*n|mJ*@Nz9)vyH#I_8T7)wDt`a`(@Caq;5z6eEEPUL|2xVCj%CaMrT^*q;Cqh|n zgtEK{W%&`xMnotZ8KG=cgtE~Q%Em+}v-5WNda-kKc$uA}!^`a48eV4S+VC zc|E+WQ-re45z4wmD6{L9@afrkJ-p1WNy5vzM<}!F$ME5LMku=?LRqf}WxXSm#YQOW z6QQhcgt99ml=X{Hc2$HjyEhTOY$uKf-u>+G_40r1co2Ra;{RSbmi@*x7rGYmKizKI zz%}+=)%d@MT6?5!e_4=WT;nfy*Yk;?6S zAF15V`H{-)ydPd}bqwF0w!BszX?d+Y((+oli8TF4%WK0%T3#!Uw7gaxX?d+Y((+n) zq~*1`L|R@ekF>m29%*^4+~yI!yjE@^l}B1$8#dDNT6v`9wem>IYvqxa*X9|%yml?s z6Lvgzja{$#yX~Cc$Mq!by3hLO_{!`vXXhQ)WYc2Tg08V{n~rPjTFT#@AJ%QxU;h4f z-RAGM^SA%rfSsrP-FCg;@3y+c!>;vQW7CXOZgutFf3dpyyREL_-FBVo8mqg%+vel% zw(AzVwsMX24==Oj2`{r{3NMR|P-gY>FQ?VV-)-C1-)-~vcc;*8ovrrbVHu5sgqm)r2+Wp0|`<^E~gXVNwPY5U9FwEboNY5U7<*m}ry z6D9p+;dKfBT-kKP%eqA^F&{?ELP@9(zp{oOXczuVS_zuVS@zuTs7*R8Ix>HE8F`u=X4zQ5b1@9(zh`@3y@ z)`g8{=^8t3TtlhsI+R<(6-{$B4oLjja7yZ+=@%+an+t#Dunp9e>Uaqmv zyX_0ENu$NqgKI9Q#kj`WZ8=?Ib;@%cqyfudN#!*1wKyIMWTTvF={3gS7q7_Hozrre%cdAZuAR` z;~HzXI=jZY{dIN2hYu4zoYlj>elK(r{4YrVee1&7>-g&F-v$@^%I*5uHU4K3s<}ck z+Sgvo*KW^@yXIQgLZ0tyujy;||IEq1E@OPdg#UcV_3~e*4|IiO4PSeduf4Ue-L?9c zsk$p9{q-$udj93Oz&CDT>!z?}^=}jZa{ITB9dBGy-?fl--Rhc#u7zymYq#q|*EDf0 zWK&;zGhe%1W4gw!D_!H?FZ}z9fBX2iNh>!Z>EDl9`^ww++Wp5#JC?epy=x)u{*h}s zx)#!otFG}Mb2__1((Vhn#*Uk=>FQcY|1qe$ue^t^-HuJJxx%%O{^OM$pIl?tY_93! zT1fx7&wrlk=NslKUweOF`v70Nf8QVEE4TB%Yy8K9A+C`0pL_hr&qUuab`Eom-N$u} z9UEQaKYygULehUc9p)>y^OS4+$KecDNM`!l?cCy;Y}Z2i&)fd8HH2&Y z=Z}%Dko2GX{O4-_HN5{gH`X_<|Cl$qGx_U}4vLfAqTUKYcCtN6&Ho>#je#-3zvIS>G%F6UUzu`;4~_{8`u4e{`SuckWC0 z??s&0H@xk5;{4^Uhd=9>^H<)>I&m!ebB{%ZT^paccj~R@6Z_kV{q4l@&D#h5oA0p~ zc71;0_~vc9!hSY%;`nyr_;%v>cH;Q~H`5`&)glilKl1%I8K-%-37- z4Snmsk+1#FdOqj>*LwCXN~pCc|CU5)ltl%ch03UkDAa+igJ!VjitJe-yXSAu^w|AW zJO0=)#h#I|=U(ht7Q3#od)M~!RQoxGJ^NwLbJ#N)_T0twxDk_a3#Q?A%*0)ogL^R_ z4`3l4#u7Y^Wmt}3 zsVIZ;sEEoq7w4fG&PNn#AqEZ63@y+CaRp*=CHi9!h9D6sNJBcZk&6)+jj^~6 z6EOw1Vg~NSY}|u+xE~MVZ&-{+u@p~Y1)jlbJdbsF9b51|cHs-`!;d(GlZ&u#;0#p4 zIXDkB5RD5_4~@|RtM%=kYRL z!&`V4AK(*wfv>S2Kj9FH7UOe{(@-8~p$e)a8g`hd@h*1YW9-I1un*tkXZ(s{C$nu(24|oW z&P8=xfI4V^rnnfb(E(l11F^UYgOP|-WFQA4F&5Wj5^lkC+=)534-evDJccK+63^iU zyn>B*3tRC%cH%Sa#n;%6pKu68i?dyD8p`7=R6#Y=#D%DjCTM|6(H@tf3%a2vdZRC{ z!a&3!0m(>32Cl{kjK)|@z+_CrOw7T2EW{El!%D2dOW1%-*oqz4g+2HR`|&gE4@(qB zX_QALR7DNcMtwBFMYsfQ(GgwH9lg*O{V^B`NWm~ zFdoGdcnZ(pIs6?j<5j$lxA7i6#HZMcefS=~z)q4Sa4O2-OjO2ssEK-Lgl4!Hm!cgm z!{z9K-nbG25Qjtz#c*UHAER+CuE$N7is_h%*_ey@co2)Q1WU0T&)_-y9qaHK-o!iD zjt{X5yRjEv;amKGUtoU>q!>!z6r76FP!^}-44jFxa5m1txi}Bia6Y1N0cs-#_0b4T zaS>YLQnW<}bi(E6jw=w0E72c=Fa(K6K^oGLg&gEzB*x%cjK>X_gqtxHw_yhE#BAJy zdAJ`B;%``tN3j%7Vg;VTYCMk@@G{opHN1hhum$g8J3hcpe1hHh0$<{5e2edK0Kec6 zPAbK^MhTR{X()#?P!VUN3eH1yL?Id%qAnVsF`A(TE7~m01NRjmf&$L!&6v^XR!u<$4htx z8}K?d;caZid)R@GunV7I5B`C#@D29kNBoR`!TyL%Q5451D2=ixk26sT=b$R8p$0BM zZN#8H8lfpJLQ7nVw&;LPxE$Sa1!8d}`eP7=AQ34@LprjMgM5s_H5iBMF%dUm3U0-8 z+<{rR8*_0V7T_T)!XtPLPhdHo#wt9AwRjQh@G3UqO>D+H*oODJ#^VM|!p)e9+b{!nVm9u#Lv zHJ--{cp2;Q8s5NL*n)Sl9UovPKEZB$fiLkjzQy-AfM0M3C!NOUA0aBn-tcWFQ;47=h6ki|a4} zH)1kw!8F{CnYasca4+WL0W8GBSc1o~3{PPtp2Zsc9WUV(Y{2W-gtxI3?_mc%!Y+J< zJ@^N{!Z+BDAMrE(1^dHQMNu55pft*&JkCTVoP(;Uh8nm4wGo5*XoRM?2rY3b+M)wG z;c|4x6^O-^=#N1df<&Ys4e7{24)QSy*I*p3$3)zODYzBWaR+AMZp_7fSb&GH2#??~ zJb~qS8msUe*5XC1!>ibcH?bM-U>n}Yhxizu;&bf9Kd}$r;RpPLgZLFixG``tO5#+M z!Re@gvrrl5B8c-*6SYtW_0SMa&>R<|722RZE<+b|Lr?TZUtEQOh(iLBk&5BS#MQ{d zNQ}X?7>^q;2{&UZZo>@RiP^XZ^Kd^N#NV(Ok76mF#0orv)p#B+;AO1GYj^{1VGG{H zc6@-H_yoK01-``B_!i&e0Di$CoK%j_KT4n!PD44Ifr>aARd61vBMQ;D5OvW2jnND( za0yzY9Xg^jx}pbqp%40D00tu-Nf?S@$Uru7F#@A87S~|{Zp38Vf@!!NGjSK@;9ktf z16YWMu>_A}8J@yQJc~8>J6^&o*nrou32$R7-op-jgkAUyd+-l@g>SGQKjLTn3--tA zilR79L1~mld7Oz#I0scx4K;89Y9j{q(Fjd(5nAF>v_%JW!sY0WD-eq-(I0~_1c^vN z8q$%49OPpZuE985kBPVmQ*bM$;||Qi-I$B}umBHX5gx%~cmm7uG*;m`ti_91hgY!? zZ(=jv!8W{)5AiWR#pl?Ie_|iL!w>ig2k|S4l;`u0k~kG*a5^gBEL6t12;zLyL@m@o zJv2lUG{?ngg*Ir9%g_bg&=bAU7gu2*;*fx3q+&QSaW(QV5@T>J#^VM|!p)e9+b{!n zVm9u#LvHJ--{h}6ti;ls*Dl#ePOQ$D3!seD$sT50z#ty$wm z=$~dyNV!{S_ZO{cq_lgB*7OR?-s*N~_YbXkMY&%2s&a$!HRVR-H_C67-zity zy)v40%JoXS*JjP@%1z20$|Au~??6#yG3Ck1;>wcBQoF%FfC-niIh>nj^58z~zrFH&|;c2r)b?4<0h?5&Jd_EGj# zUa9P-yh_<$IY2p3IY>EJ8K)egj8`To6O~EIWMztSs4`WVrW~dmu1r^EC^MB=%53G; z${b~`GEbSW9HAVk9Hkts9HYEOIaYbCa-8xy<#go?B{oTGn5sSXDTZy&r()Wo~^8`JV#kYd9Jdm@;qfwSxtGqvW9YqGG3XWOjIT* zla(pTp~_TcnsS(OxH4Utq0CffDYKPVD|3{&$~##P)=0dsGOv{NjX`0vvP{^7Ufjst;%W2+mzFlw<~8T?@-QE-l?3Wyh}M- zdAD+o@*d?}<-N*z%KMb_mG>(bC?8NhsC-DdQ296IBIU!%#mYyNOO%f)A5%WAT&jFR zxlH+_a=G#;WlQC5WnOJ>y7|fx z%Fv7X=rzB-*Z+!!UiMPms(DElg}RQ6L|rR=X9pd6?iq#Ue_Q$C?wrhHPlT=|r8 zh4N|TO64=kRmx|TtCi0w*C?M?UabdUa+JBsJY~LegmS#{dgTP=4a$ki8_ly@m-EALj$QQo7RtGrh^PkEnmzVd$M z0_6kB2bB*g7b^dzT%>$hxmfv#a*6U$XpR4!LOrCgzWTDemBjB=Io zS>S&qPDc*lVv%A(3*%Hqme%FrKXxA6{XJY`X3G3Ck1 z;>r@rlFCz*rIe>CODj)PmQj{fc2jm&_E7dz_EN?w`zZS=uT);8?5`Z49H@*_4pGJ{ z6O@U{BxSNPMVYEhQw~!OSN^Iz=~t~sWl?1@<;lw8$`ZnLNCb(Qs$^_2~j4V8_Qjg?K5O_j}*&6O7^TPQD9wp3oCY^A(Z*;?5~*;d(3 z*LP%JRxHloga` zDl00_QdUx)t*op(M_EOAuCl7~JY`T>O<7%ezOsfgN?B8RfihZIOIcfap|XxLMp;)` zPg!5tK-o~)NZDA~MA=l?Oxav{k+OyIVr5I^CCXOHOO>saZIo@5?Ue169h4oFmnl0b zJ1e^=FIRR|c2jm&_E7dzUZL!z?5&Jd_Elb~?5Dg+*s<@L%5${Umul{YFUDQ{9vR^F_fqP#^pRe7s&n({W~bmi^J8Ol49GnIELXDRPe z&Q{*7oTI!)IafJPd7pBD@*(9y<-^Lw%14w-l#eMNS1wgPptUO0qMOjsOo-(McrmU_!Us*#L zrL3vEKpCy9rL3*IP+3PAqpYi}r>w7RplqmYq-?BgqHL;crfjafNO`fcrScMGD`jhC z8)aK%J7s%iM`ah~<;t$gZp!Y;9?G7|UdrCeSY;n&U*(m`e#)zq{gnfh1C@i6gOzd0 zAk;+lZ(aJH( zYm{S^*DA*;uTzd!Uay>>yg@lpd82ZY@+ReE<;}_|%3G9EmA5LVDQ{CwSKh9ip}a#m zQ+cOymhvv;Y~|g`Im&yKbCvfh=PB<~&R5>AT%deF`JnP4LRkl;M zS9VZ#R9>d+r0lHhqP$$$RoPA1UD-p~Q+b85m$J7qR@q0{S9ztfpYkeYf8_w>K;GnW4;7W+}6kS1WUrxyn3czH)?eq;iyU zv~rB{8s%8!waRhI>y+b_*DEI|Z%|HD-l&|Uyh%A(d9!kg@)qS(<*mwT%G;FFmA5Nr zDDP0tRNkqarMycyTY0x~j`AMmT;;vWdCL2g^Og527bqW4zVWVie0)>6N%@v?v+`}_ z7Uet2t;%zdhw@A1 zKb2o8zgF&3exv+W`JHmV@_XeE${&>nls_qdR{o+qsQj1mkn&e$=;p5eDMA*5{c5HC zie4%3>m&B74gq`QxjZVMA}XOWs-P-@ut%2c$LBQ>4f~OH9n^*WINN^2+ZavJ94*ii zt0CYA{#l#!w8JR7>va@jK>5_ z#3W3{6imf5OvenOCl9L&W$%*O&eh=o{$#aM#JuoTO%94oLAtFRhtuof@iC9K1G zY`{jmflb(qE!c`}*p40e5IeC8pJF%mU@yMJSJ;Pdu^&I+0Di_n972GPWf2rZag;Jpd8Ah0xF^sDx(UjB8cj!ftrX$ZPYMh@~Y0;4bnV=)fnF#!`X36n7eQ!x$GF#|I( z3$rl?b1@I|u>cQZAr@gVmf$fg#WF0%3arE`ti~Fw#S3@|>#!ahun})y6ERy5|D%xq+%G-k%?^Bdmr*J0;4bnV=)fnF#!`X36n7eQ!x$GF#|I(3$rl? zb1@I|u>cQZAr@gVmf$fg#WF0%3arE`ti~Fw#S3@|>#!ahun})y6EeHh~~9uqJTlQ0=mFcs4<9WyW!voITTFcaA|_!nreG?jVLE1DCT3wa=3p-7VLle%K`g`~EXEQ%hNW1B z;sv?N$sDYY@Ms3tVUD$hN z8lo|pqB-mxGcC~ytRy5|D%xq+%G-k%?^N zAP*xj3S%%9<1ii*FcFh58B;J7(=Z(~FcY&d8*?xh^DrL^@E{gq5f)Y>B!*Z;^ zO02?atif8mfS0fi>#+eF@dh?wGqzwWwqZMV;6v=hE_{mJ*n_?J5?^5-zQun0fCKm$ z2XP1i-aAtS#bEE$DTz|Bck7fvIoLaPDxf0lT|1Rg1@_LJAgaUOy;Bp>sEs>WLw&;?y#@9OCZdtXm1?43RRVDIf22zz(W5ZL>Bl3?%f zNyRXvBNN%kK^{h66vkjI#$h}rU?L`AGNxcEreQi}U?yf^Hs)Y1=3zb-;6W_JA}q!d zJcgxMhUHj+l~{$gE$0x zA5#(7JDG~3Bub$)%Ag#|qXH_T5-Ot#sv?N$sDYY@hP{`m4(h_*&D0Q$Vee;ZjuxxUvsE!(_344E3ZPbCiL#jR+qA{AHIqY3h zEzt_C(H8B|5uMNl_Fk#(=m~qbR4n?!-Y?Z317Yu&8iE8QAqA-zhIC{i8#&0s2#mrQ zjKw&N#{^8oBuvH>OvN-z#|+Fw6YgMM#44)~YZ`h{@VAv4tGkJ^sj``}xzeU#&81!h z($f+W18utZ?i|;zQQgKd4K8ZxhGhS0)Fm|3{O`OBCSM-v9`cjdz4IF{hbT44Kybgt zQx5rFE=l(t3`PbD1+9(WY(lo9)-tA|X#?~w=>+K)m>&0zfZz$e{qy5Nr zyFA|c+pQUEYH4BYX8_i?`9x($Fe=?mKzY3NcgL@i$Eb&!zki?iSK)Z)Z?}f6nXLJ{`E>5xqh99@ z?Sc&&H*L}|nAV_qX0T)XcI{$vlk)%|L^?^#ctqx~N%9gN88;Il;R5bct=(pkD8G4I9?G z^0J2YgE7Ih%)I2B%=o;ttjzfIv@xL;>e;SdR`7`V*9rC>o>w>6B`arWa%OI@O?rBA zuz8(e`^#e*G;Po%czISra%O7$h|FN$&~g^`k1b&fDt1xekGCDiD916A!fNi7AMf@r zr^)Wq_V4$jcO0CoEUm1pj8-;Py3b4dux?lGvXlCERqj-}{q1<`f5y>Q%U{-a$RTgN zwf@;lw_L6Q_7%)NyO!42RY)aNu?`yRrytV-B@O+|Uau$&y=ULH zA+Od7{ruk6M+KaTiZ}~4pR-XJ=fLK9E~?@@1W^suaXxAw3N>M;>1fnKZCr>th=H9O z>%p#*8^ErU?bllE`q-|G?Yh{miR~)au7z9RVzk61XoXAB8g0-P?a&?_&=HrR6FS4z ztX-vcMK{DaH9@k?6Zoov`h)K8!lW{Yq;1*29 zt(b<}FdesJ2JXO2+=*GZ3$t-I=HMR8#l4t^`!FB(V*wt(gLnuF@i#2O!&r<*umq3d zF+7f?cmm7tB$neTtiaP)iD$41&tf&6!x}t~wfH+;z>9bZFJm2E!Fs%k4R{S3@jBkX zo7jZ6uo-V-3*Nz2yo+sk58LrRcHjeih>x%nA7d9j!Ke5PyYV^p;0x@-{S}Thy(ZuKjRl1#J_L|zarF}RHSIJlZ%%qc}l5MOP^MzY`N3RpHbn= zif2_iyYe|z&aHZ0uv+!=Yedz&Ai7rV3+u$xtyjN6!$yspG;P-Wq81moyrk8ot=qJ1 z*Sj2tz3%r#@L9e3UM>nGeW@y1CvO}=@`EmLoucH8vZXWTLK&RKWOzI)C+bMKvZ z-~9U*Jn-N{3;(w0;l+mS2czWeCtDar`+?wat{{4j)UwV1nE9+m~ z@Y=@L-*|J=TbtkB^3K+Gx4pOh{T&~C_|eXfcYX5dXS+Y&^TpnOeEH9>zTWrEx8Lpm z{)ZnA{PgoL2mf{G*OLN814U0NQT*g$MT?xoQLSvbvSrJjj7nwCDqHrvvZt3V>(*4n zwC{s7*Y#23b^dy3BQ=Y?ruK{)okRbt|9Mwec_sA!-ClF{TOH0Cl*d1s%$ZM|adGH> zZ>-McPgkSysi4<1pZ1CUU#7{-cY6+QH~O@VUQ@b$=@&!)?^$q5-Bo)QoLX_&^c(9W zRXbJnDV2RmsdpdXpKUkaYyY1TwfwG4gWFznimG`^$=5Eqb?J_`OHTHhlI7Z#tTvH< zH2)I&{$Ap|vHWwB*Ocg4B0u!M7OR9?S%>$R!gmBWY@|Fqe&IV>URGRIeqMHdW@26- zIx{W3R$xR*b`BSEDRmPA(a|+C5_0q6^O9@Dw2F&M%*xNq3tn)2l{Re9xLM=ojhZ%Y7KqMG8la?2sz*S>z^3aTADwUL+mzs|C7B;Q*Qd+>z|-{ zo?X)GKee=%yOj<8=?(X839r1cZ3|G$0t*EBf#`v1Ml zU)cI{FpoTeqX+!w;tT*pt;t|?_K_XcmJQL`MdeL_4A)v{@L}s<^7+! z{CAi0>R;(XFB6p8l-28a<)f8#W4!Jg>U#O#zWi^g-r?K-B!2Y7gXYC~5TQt*=qZ7d zOS(owR^}_}8E2efUrbATMQ2)+51i(8Rpu4(^eOtbN6x>n z`CKqP@^Fc_MlLUGI&QgK|0}ippUm*4)}+=eJ@Z^-l_0{=KS) zo1aU!{N7QHV_)d_8#*!_KK#0#hjaYl)_}iVzII~LpVHyt_*(dIRcYI{fQ zzbc<>>do)1Mqd7+?&r?+y6W#~c2;X1dAcuG@X9xx>E+K_&W{>+-OU<$`R@5%W}V~Z9Ic;PHNEb|8t>CeUiWKN zygWO~%fgn&Ew{_UhWk&I|8HOZ8?|2-w*G$a@)tI~D|g%9b^qRU+uh~w9q;!J*G|jd zRi8umIoPi5-@E+(?*2bopEH-P{%*Nly7GTFKiB8>f9mqzq~prV%4ynOA1P01;vHA| zE5B5>({lf}FaKiI*KK!~C;i3W|He=C*5kgiUWR}FTRO!npMJZS*>`w(tnYvG@6vex z=J!8$y^zlevg?KLYlhzWiHXU%xq%+p$vL5CAA*@#c|kfd((<@B9q67F%*{_s4W^`V z=Q=AVn3R^oP3x?j(FJ|7bFxBH=xh&ClZ{VG%CTy+$r+j-x;dVnmYWyM%gPF-XJrlzbQqPK7);5^$%uE8 zXd9p8)hQ`CH!&wIn=0946I0W8W<*s=&JDDS&$Q*C9$AU}NFbPzoMCnEY0H;L6 z1F^}Y^1L;4xR#;y$uyHg)ya-$5z>=W@`9n&U`re5%wsJ>`PQAAoIE_xD>*(XCMz?2 zv^Smbnb~sX2HNIi4W~-kY1vGbZI_eARu8g@^3$1cK2m}?@tMrCms@Q~OgFTO<40tr zC9!Hlt1vS@Bl++aXIt7JtdtxY+cBv~XC*tIK=49n%C1#}ulXB8V zFt5<=nU@!zn94L*>UO<52Xpgs@)Ps&bCP{a@2a7>xjij;R3dd}?YaWnUz7Rl_&ygM zG)ypsA9&e3;xn_7emh2@zc4pFD=+k+NXg<(O6b$?eg53%AXIOwX>xpqO*1JzFWy(( z*fe$pJ{H-b&rT0-Kk$amwY?+s0m=<@W4Y7#QCnJWXhpDb^HP(8naO$FV;LUk8J{@Z zwqR(3XYxZm_Rge0kAz_yf@~Dqe0j;W8 zAH!sh#e8%^%XGNUk>`xVu9Gy{)&L6;=iL-NP&Ua!Tx@=sx+bJM_`aNglz;B8dk(M+ZkTP)@Ral37kR zBKvXZ4Af&}CfhK{&dIDgHh}FtTyt=o&I#=S-j!Z2cQUb$WL8dmj_qjqnTIQ)3&PHs z@!4z(?w{DS(y|is((OV*XLso4)(xz-*1ld>}6)9hADs44isrQ7Ks*G?+Aqcak+ z(m4QlCqi$yzIHF!JB`_iR`W{X7?6Q{(MK#jkL% zOryCcAL`HE!61oQ1=m+$Lvin&F<6J*CxiVjzOJ3b3dRVu@s3?KA@*pivF)XHNC;h4 z95LIpC41hP?d6yownm#LxafXtZO(9wx!^W155WM~Ht9j$CT zyZ-K|6X}o?I)-R`Rj=T}k&DEknbak8Qf0%qYeaXrN@Cy2rabZRafzBycdh}vdZ*-# zWRr3&YzG|zgq&oKp~-yEb6Zg7(A9HpHhX!pSJT5s1Dj_ym$_;7 zOiNN|rw{h(7&APLYYd*73|(jkv+eY4#{)KhQfNJR=TvWE5&q4tba|+BlybUqv2vAi zv+^_LugZ#Nd*eqdTe|LQUU?67rzl4$Co1PCmnqjMw<$kY{-`Wo*_-ZJ$|lO5nqOyi z_frm4UZla))Adz2Nbdc$9!taQHD-BjJZmCaS2r0#2! zGn7k|FDd(J_+9FrtnQ!Gead;>d={yElQO9Cibn#|UA`m5$wGHkiR z=fCfFE`MR`DSUdzS}r$y{cLZ2M`azE!9vR2aOIBCKM>Y`U)c2Bbk-J9?)v{v$$*w4 zHOE_zJ#+t>9Iy5Km(4G1`F=D1u>OVBtFZO-o9P{6J-XrRYq%lGU|6^7AD(XbKRe5X z&A+he@6`G#tpD#Vcgy95-=yif>AU{n>4ta1x$eR;pyhJIuPvnh^TW#B@Zr;S<@Ljw zw5$~SKF3p5_GCk--JOC%x%4jYIk+PVkE3Jyc<*z%^g1usj`MQ7a=vo<^%_py$1$t_ zucKs7^y)vojQ5;heWiPTaQqowdHC~#Yftye!=E1vYI=Y4`N5_7In&x>JWuGJ?K|EK zvbO&n83{RgStAo||BF+5X#3d>)cjogMUS|+%i8tm-Z!qt<-xIILpN5BEbq{*XY5sR zoxAt!6B~Je&Rx59xU5arqYl!&U5{=(yLO1}aI~R1_UYO+u1B9(=ESe1*bVZ!adB4B z8dSASyLKDzk;}-#|Ay>IwtYOU_HIXFrnTHc>`$piid#C?q#N zJrLVJ&?mNC;IeM90iF=0vwi1YfvDViQMt6Ir3CWE*pDKpGC!$_vzt7jP2M2Djfk{S zIr-__xjLdxLl(#zC(iCR+q0jinF_|xdV83HY=u8TGFUNJRw?>aU+djRj|Pa z2#fZ=phw z*XF;of&a9v8FpCkJ|6|Y6zCm0?a;tSP9L7Io;+agjpUBAg)Q&J+$qmv*V0j!=|%tE zDHig9t2LnhAU>s5J=$t9gB0K9=dkV_o7@cTmm!1K{K+-ojHDVgh){zDe?biz7Sy0& zgc|TWpLTpcVjUdr{4=&eqk{Q2viV=je{KeJ)v8r1Sm(jzVh?`N-jF@FyNQ3avrpBZsTOpLXOZbpFRYa@e8ch|9y{xoY7EWXGY7{g5H68`MEjuLO&g@XP1a}y&LMu)p=%iUV1$q3QJ1P&aKCj zE~BhtL_L1CoIk4GsOC-Mnl`S-VEhzzI2Y_{xZ-A(T)6WC^yu8=^c1d$(~@dY82T+N z@6=`2p(=Ah8K0ZM6>B<=?C=xE=;}PWl@N@IO37^z)w5xpsD%2}SxeO~xw^V< zL<%U5u3xK8uzFgkhr7nkN=e~ow4qvrp2rAg=cU?LggQa1kF6?x%+C`8R?P_2;o9i8 z)k$~NX;3FhwaE#q&2d%Yn#k4Q+g)?2VLwI=MpNP6R_JP9g|7aSYGh|MZ7X&r>X4nC zmJ~Q*yV}>PBUWm#HrFO>Y_E=?O{bbAhOa6c%y#$Ry}44^XvsNsL*v(BRb9yGL z1$Q=D+Ji>k6JzlitpYs86Q9E)*V*xTsh0#!IVCzOH<*%>#S>a~+>6SsRmv+QgFMwS z+Gb$AE{V!5>Gx;}~NSsd0vlREquqU*_{WkIWW4E@tX4{ziKa$;KL zcz3Pr%+V`0u1)*)fgZg&U)H&Mpl8=Mu^oH#>K5qQxvjl+R)_tV&^aJxXl8yOI-Sp9 zdgyM6eMw;oq2K1^-a!3;_dv0KaRb>rUzQQmil@v&H%v4}y$b>@E)HLaAt0xSI;)FodUi3bPuKX0FZ6PM0Nz8VxhHN*EYR-H{xaxW3Y^IS|!$*mYK#~ z9aeR2=nPe`^=IGYtw29hA-G7Y%Bji_TB`nrmuS( zzujAD(5(=a(hZTJd8RavDrqJ(&!Z-p5~WB3Nf|<+3>8r!k`S4dLQ!NW4IsveOEi;GXyKXf2sc#Q{6G5!eVJRf}a5@P5nGw=E8;*;5K~2!yg;fNd ztA#^(_<1`7#T!5j3s)Eya9WEv28Od|_z_~JfDDd2{2)DcybU|*=jHT#Y zp?ff#I~rD{ypcT%oij2IssNl69X$OB3Z2Pkydt29 zn2w@|_MkyBLh?}s@wTA3Bmj;cNKp_MOi-9|c0^9K@QH$%gvFpTV6-?AwTF2C z{A_swGQ9JFrL)3+J_sxj49#swn_%FOS&0q7khKN1reJzp7S zW8isdBuqPi7d-6LFHG&279_zz*ibKgl%S^`V7Cw_E#dhKdKNPDCIZZi=x8x$08~T5 zQUFm1S;>WUC@fsUf*e7udXYfhU43CrgINY^8BsH-MW{^7Jc22ASRK)>yf{8{g6)K7 zL=QE7%Qqh>4)B?V)dVCF#yU|QqCtbwiHRhWBfpm>iMd<@{~3{zdZv!1OO`CQu|PJ2 zqn^HnzPX;hx$ZLB2HH@Pp_T3u3w=P;T?|`hKo31?{F`w{lN`oJSd_v<4fFTfIhdw! zfpNt&lmf9DWi#{lH@BLtc;5+Vi9I)>_r#v9Hj zN1T`=;qZi@2WRXFxxkYb(C~zj^9C`$0Q8+$y4zjC4{X!i5!9;PR zscX>OLc`HBIcd!2ojZQgnxO0N>^tOmZqO4QnuvyYh7l(4VVZ(B>V~qQ5kQ<~EK49DU@4m|tN`xIB6^?&EKIE}^-W<0fqp_(J7LBk z%NoBB9y(bM8wW%efehii8sa3-M-No-nI6vz8zIcC5@KrvG>||3_LDRWT}fPck*$sP zScd$~U_NKiFi=G+9IOmXW%)U;TRVrO4jtne48|8W)WZUN1K{16MI^3abpZ_YekQaP ziTF@Uhz5;_>Rb#l$ct5YOd{@?aAsWK{3{+4pP9~#b)9fL=KY`IAcC$D5pxjnpYr{; z(p8E2RuSzVNw=Ix-#MaQac+1!y*x*6Z?gvuXW}vAk@WAokDh-d9`pV(L3ck9uOeb* z`u}!(ji~PiqWvSw6DI0YL&RYLgNqPMM)CK`WPeqXq+wVvB6008I_3!RWv&z8r5|LM z!|EH&s$gdmgO!-c(b64%D`IG%;FMtZ2_{ACr9^mEA5AaKcU>;3P<}2-G$+)}@&mn=jV4r0Ligii?Y5DjBIKG|2Hk*bacVH(@^( zEEf-0&-!6F*c%uK4V&^{cL6pMeo<+tWc-cDHSjt$zPLnlC!tNjo~ap9^L%MbbFH zL7v#eAZS3?1OfRn?gx{yAFRgjfY1*vdKrMwuL=H<0pT+P?!mKfFM|T{I8r}@m-HPF z`Wc##wh3YesU8q|84L=<<0=^pUVw=;G8mfR-*ywgfdYOZe!IE5gn2rKyAe)zpq0>r zsNY7;xkNXj-ui973C@Jz#tXiZWzr{}KSEnkN!ax59N`EvH*60@prZ~1B7p}b{A;{n zb;7IzZ03Val3{SP!vU_;Jl!3Kmi;8=Gy36(#M1WH+=Eo{iV^k!A+n>aZkY`wVpMyy z#(?DodZl>q`2iCROZUUfUvQ@j)(omGGZA8x4k{yb$kHK!ued;08MNOk1FK^an#f^? zj=8%8dqpUZr+cVlV6e9*^9{aX^Y6$<70|ypCUh~;JnS%l8_m-%&;@iy2rLlYk+7rH z77}*s(2*auuN49tdf5IT4a_j&bw6V3f`l6n!|Y_75=|m(0a_y9cU&YaBXTc?j#?@* ztH9imL1p9m0QwNK`Ou1UkX1|>b3}D>L~l)l;fEN2?ty%JnK+OsmYveq}ZCi;EM{8EelNC4HDY3~pAz(V59MT|L^m8>B_ zY$PB_X6|Lc4xASO-k8qEw<)+tu(H7=Y6#iQ532@=Ne6q85{mK* zg=G!4$B1a6&2?F(KE!rVQ5i7H{90RxllB$V@B^1u!raRp+l0eKMQIR zZTezI1cn3EY0NewzWNYN8IC?2_A55{Ph;{Ez1BXweONinRBY+$2#=tN(Fp?-p11)z zwkAd8{=UxxE2rQDQ)?w}>I}kZ*uP~B9us6xdITWS2!6qFf zqX;lUPz+cB_%FZ>#z2q(r9hsrVD!TTcJvM0UBDkjFiATo7-E1yK_+2-B<(Oyl9hW9 zX$iQSHxCR4XA7@`2-KO;W3ZV0tvGP5>_;cWh4oI83{KTiM1pqkR)NuObr5y zi50%+GD^nfD6bXp8u|WVKCm!@-{=WG^B(D1l+Lto?TFvZEkcxzc9swhy3lELw6lQx z526dvcZR^6vxk?5XrMIa=IZdWN2U#@J2K6Lpu?;)!bSCUfq*VV7nQ?&w_F>32MxPt zrZek-=ndxy^B%poj4qTPrF)_qxKNu=d59*umOwxU8klW1hu?^&;SkWJ2La(T4?Qr; zNA*K6e5VdChgna=PiFbd`k?kQ`-KTZILvkouP3T+2n1%GP#P*1T^10Szfpf8TtpY) zkL306{%4jy8Xlsxp<15l0ho91-sz;$$M;O~mO$e1M1#6Y)_ZK2F4Ei1;EA zmk}|Oeg$!Vhln2%@e?9`Ma1ukxQmE?5OE(7Gl+PS6V69bBA!LW%h|7t%fry=4@cKm&@d+aCA=0ae`$^6?-b^A^Bw{@xwkBdX zA`T_u7$Qz3;$uWyM8p+D+(VQj=!%z9OTa%6u{9C1GVzFbJ`rmX`MijD8xa=}u@Ql1 zO~iEsT-FUQ&z^{*h**&ihyN*-C-}6WRF(zxks@)={C=bIhD;_M zkxO>;iV@+)9lc|N-J|uxS`r|@#u_s9;e-tQBEf@~5PY410}w7U&SC!$j!^(D%nT>e z&~KDD7nWPW_-4#(a1W0yl|8`mj3bao^icWm3>n)cfjrpZQn0RRZY0cY9HJ>V908sn zVVfqdYw@apZI8Ax{DaUug|4|+I#7T^{E~98fg>p?uZZ55fe%kA&4GLQIkdSnIXG}H zLsLNal9I}Bb`XDPBtt_tI2KNh$p+XT!aUde!{!idjY+D>%PT0T$jd4yt12m~s3@t* zs+eLca-#hs@kh^qipT3EMU#hG$iRjhalz`=%@I4Z#AM|dlt-<}5TzkHe_18qguE*7 z1DJ!VGe)WZqCE;Kh@H?JtR+L`|0nGL8*Gpde_ekCRDC(T_!0Thi3d!kl+l|s=u-s$ zvO^IE&`Sb;M4a<4%Nd@3aI}C(4ks%$T0csmCz(VYhGYNRMCOdukAsxdVY~uM#^_fm z8aDc|6aLKlj8VUmdeTh{Q!xuL)czyDQmgbS1m987jZXVdVrf{=$qib5d@wyQTmfc@%n z*!f1lD2SsNqv#g>hcUgHjJN@q}qJMuJ;^j!ul!%cGwS((F7*9Y5Y0zKDj3rNF z$PdzU3bL4Dfa?5*^-z!s{`T*`B42JJO>VZs@2DCcQu%Hh1q8;>(% z@e;Ijcrid!+Fm^2bvGOK^2Sp1IL8tH0MYq-%A6!T@*wxT#Q*j$hkVy$(2U(v!e z>ejKyL{!MNz%Q{gAdX)dq3;TXxE(J%-^2q1wzJNtjE4m5!f3)T))DtiIC{>B(nh9J z0fySf4gpD8svpluN|sKCmYQ!JBB1H4z`Eh3^bQ_|wJY2NRDeC(L`MoG|Z6Ot}~Y zF#CBBK-&B%Z>xj0ztl%&rwt{MSj2p;x^=1sbfzDFPXD3VMp=S-YwU|<(H?2eeXl6} zssg++??PvM=zdhg(ZE{qyx>8p&?bc($}F)qb7m)xO=d8KWrOryhq#)u;KTKGaWVoE zZdtta4GJ)M#9O!LNx6vwJe)C4bVjAkq8ZPe8r*k?FQqG1uMmk{ z=6dJw<#{P`sjbJy%{_d0xp$dMg$`d*=sE}1x1wdj+0*Od`70DJu@z6MD}1SWb+Yiy zm^mL3hebH2bYI&7JqrhBnm{9D@_Ik`WTGJAKjSawz% zo@!jW&4gcTvUZdMY1NFcbYp|WY3wggC>vYd44HeS<@osYoNK8;f`*@rUp#iu^h>Gb zbUAITrYm*pC|xmirED#m@Y8w;V*LM?*#7@{GAvCB6WzTy-)fp|JohN^jj_0)^aty= zaUWyC*w0^%-=VxKt2x`o|A}2r(QpPvTAPMEJK6lc6P z<+^vzV-x9J9?AWctEFO&+jUsl%(&mVskcca_Ur2mnyPWp#B@cLYl<(e{Sq=HPaN0v zxGeS6?cQ4!Mrc%<^!B%@o38Pt1b#m8beiOe!prN@v?d8G@9eeQr#G!=;tkH0Gn0>% z9ueEZ|GCI*LT~7uOS^KPRz6i?7$xam5z=$F&8gtCS>>f{YNL=IYn(eEeuYQWctG9b znAG0mrtSCEkLN!W?|XBtVdhOoX=+`J9{r@SI*m6Z_pF^y&UedaE)B=y82b9DPOKhU zGRLm1S*enD=hHKf)~-DUp<5GlHmCXaWv$<^>zR;x*Lv*^1&3YV1?(J8`z7~tjC+xk zCvo;d%Zdnx&9`h{v>OC|Ec<9)XJaL#{!;Hq`Sy^5SA@f@gsS#ET73P`OSOmLJe$v! z1%3QrBfZwC=gH!O{@uN?+j^syf0}qxH(Bf0b_Gq{wKYFi(C^zD^hotA+O$GjuvK6V zeTBx3*^YWX>xy6W1d)>OexTIFD{g2#r=OBc@r!RPYkGO7(spAWb<)q8xmp}An>Kic zeSgAr<@2=ZWho_MKjV(E9(;H*@W$hrL4lesXCw);nTXOxz8Z{9=e z)!!9m%gWXZ9i7#jH|K4_<4}{APple>3tN$~^Uw7U2XGFslzYxiG!L$QziuFD=d}Gj zQ?xlgSubs}UV8cL#5t|L7Qtud^qSl4Yc_Cx-c>{Oiz;jOxww0kfc|xnW#x(+rbRxV zVYK0)shDVM){X;VudY7jE7N`(ar)KubDq8|!kcFBKFBT82$k?T^Q@)tZWL8|((GM( zocWDr%x6g_#clbq_+CuLwr#a7jb6@ECYG{sax=6ua;;~cn;32`DQlV9rmZUx5BeD@8ybGxZ_2m$-ZdQuvOc{0d?{tZ z1=lk>ZY#Y^NbWe+_C)1%rdyF#>x1gJD+^O}7%s^VzV4hQJ-J~O=hVZum#yqSA*K@~GJB9AIKW?ikUJ|F2LuhAlO=A+}AiAnQhT|cJ#4@lXIrb|?)i@w|762-N@ zI5GFOO8cQTygey8|`_qKP$d7rRYRX-ky5D2WA#Craqc`wzW55ji>Pa1s$r*IaGT z^qKXvUpwveRO{{L;}rMsQ+TwjmOtZ3(pM;M&KFANE8V_>&-%_WZP$4Vn>J~z*G=lo zOAqpRdha@i&3x}ts(Y98k`-6KE!p|%$ku&_8uJgUJ+50NZ*MPABGUY}_A{M#zf`#` zYma%t#Q4l>w^{lpt`2|PLRY+g{C+sg!7m!msrE} zzwlcTrD50FE0y&Zmz#UlO8W_i8u6sEpD}iAka-ZPQ4qKe|TXV0}5Es247s%>ntfg~WFzlRHU0TuO9duV4k?uOh>p^W^Jq$5{A4lG; zKmAdGfA;ix-plgF5)$QyxpLedEauZ^nIr4+kFx%U1OIT~9}WNqSfU=e&9YQH-0W)X zW@VAMe$J^bW0~9fB@uL9-HW~pcXLVgIM%YP&>)@*kt}`l3IFuemZrRT=efhd& zs_N@~$^sZm_p8J_K60>(Ykd2yLmL=zdn@*C+{)}dcUu(hc)i)u zbm;Q-s5NbebhK;h&iC?I%(=PR`q8X8WhGu(XYV{+?pij^Qcxgfi@05}5+x+Mh%}=^ zPD-xvK;u)kjO;`s39|?lE$R8sf2Jh*(4N`(Hj`(I-RhC;q*N({8?pmULTkF8m%{`yuIhxsDq1N|hF6k>m-nuk!af zE_{5Wao%%>`uZjF%IAH0dv((Da=qOZWm`*69crmKpA-L3dNN;@tJ$STLiO)_f_1p> z@Q!=$^Urvb=jQyW9Ahm?m_D ztG8sVu6$QwWqL&8rw2LEL!DZ@cFEiDw8fWM7CkcBH#4h@cS3$yY=imFERmhls(-96 zxj~_ZtWL@vuOg6s*659=+qU%3882o=2CF~5KUqBBnP<|Y(;+`20J%dOPGL_0OPlft5R+}S9d_x4uL z<}#O$UvzP$qJ*ww>x`>A%N5VAIRBihajC^2(sSqho@Y7Ak#?&pV@|a&u1H%wDW-ZQ zPRwhJxsny?Xi`mL-2a(iWs|TYwSYg$(nz{T|LwDNtcMsu?*qEZ*0g&oU*q+Zm@Jbw zD>c^7YZAK~U30;fPFEen1NMdMmecI=XKIT3Rs^0lU(}?bIdNY70sG~0CfALp-kYi# zqIykxvP9~g_0PGyO81vO%8uD9ofgEC#`SGNVxQ?J!A`H+c}|m7w(nP#<)0XN+pw}A zd!JO{0p$hu%DyC}rSbeNIhyZwu1+mlRj!eBQ6uD8(CRBZ)tB((+N&w8FJb z`tmhBhZ&WsA1}GsZ2VkONdE4+)%5<#*>~?%*RwU{y_nLG-#@n;By6R(zIwam=QmCPlUwa3=kjRhX3Cb&Eof{Uc+ePnQ?c$wtf}h0Cf54Z z*+z|ynHKt?D+<@Fc5L13-_UXDY{3Cu>+%P+TVK)For$%JiBoNEzPoGgEB-Cn-ztu7 zw-q?`En&f4w&RvER}Xg$yr1u4(rV;xwa~;+Sh6RWBfj=q!;F|k87W=H7ACAy$9-s1 zzW;K{)bVd=6D9lfeS~xreq1*~xl)^nG( z8SYvd74`g0jKDS3cMm?#T)8J}S(?^a3(l#IuAIxu2F|*d1Y0|Em9Mn)Y~paOeY0Kb z7~A_=&XhjgSv#)D|I9Yjv*Mq9rs3`s<;PtWX0e6R-k&CC`IPQj=FZ)q&7Qu;z}hX% z=2k0jMyN1P!{TYGHOHOj&bis(c;5WFsi98D*;`*e-gzaoFH4B)t@OjP#5Fr^Z8$|a z)fM~VcG+X=(@iXMOOoktU!E+V;bbX!`rE>Ag(HXVX&-BBG?2egv}3`Iqd)a-e@T*^ zyj7%MQ6l#7`woePfq@Dx`aTNdTjnQmum0@W`X%cl|A$~TON#L;ubKAc78guEEj{tY z?4H2upPDjvg^L|ss~6o8VLUxtzMSi6ebURoN)4{Yy6Y=nitbZ6m*?M>g5X zIh8%NQPmRi9K7Mj%t#E!IN^B*!nd}+_u#HtVHsoifv0Yzq}oh=T2>*8?(M^IjD+*| zeqQ|Mb0+51rn8^xIj)EAF`~ESq{hvUy`OK|98Ep8b@J}0n=H8t=V(p)8T0J!rdOh3 zF-}{3&rN^-aK~;nks@=6PA+#pHDw!@7lLr z*7gc-S;FMES=OBTDeJ9fq*qx<&GwWmNwA5X)fLUnxAOMSrE_e1_Pkg*?Y5V4e#-jC zMlBa)@9c{&7J3`{^5~S44^Dnm3b+?gZMN=7Ta>BhxEQk&4kts)A2BjIw#GaTc3ms* zplyoXs}r4T%+(EZU%Qv&FZ0f4EVC_lh*EtTFq=HHmwW3Z+N(y#>J%fm7GeOx~0;UE<-={Q|G#S9;uN!E0Uvocl8uW zN*T``SCg1D-s&HXyH0KWF#GeR%g@hqWw&g7xa4uS@MNFj_d?749vpsFZ6`UeZ)MkG zvkzHr1A;!{!HH{V(;YcXJ_qw3D5%R-?OLcO_UP7zm9r||7o2@QKT*xVtKrec8n*Z6 zTdL2PMDx#A9>*V4cVTbdw@5So{F$k4PnQ;RRlK`Z-N;Lk&$=D+_|9Apu@@h`wYDtY zX{ViEXmI=P=9ro(2{XCGq780$IEJ>Kkod=({D%YoaNr*f{KJ8NIPeb#{{PMa7SdtP zjb6pt0aN?$xqb{wXcrM$oS$a-jH@nn#)0R>(>hr*1?vaat`I4Bt8y{Rvvbn%`iLir z!gF~xl_gJB67_A@-O#+*cFXZrdC}XiC%>;DamU)bYt-kYX9z^g%$UgHJ$=H{%p2k% zUsHU_YEGKo%?^K4?YgwN{HegQf@=}$)*l;xns@Q5qb`9Tayj^UC==rq3~ImJZg6^1 z&F1*+$7_j?+{aiau1?rg9!cM}zx%MgvvPuLmX}3)GMr*yY;0xMe!onhA-A^nT}l(n zhMki?wnVI7elK^y`=$%NleSB$8NR93C(2DDQd2cH3t$6le za#d%O>+-ys`&&K*7+V%rTzx)|g;m30lTZPRx_?`~hD80GOION-ruyCtkyyVo1;E;VM}&j(67g z{+srU^vI9420u$KJ^az46B4*N!t-(XRLRP7{TWL=^b;GWoOV3LW!a@>&5cV|+I?A>I^VOHvwC}-&w^W#!5*@^?P|}f zdF85YVV98pB({#HOzHemo#{5;*lezJQFnPsQryn#%+Ko;*vtP^%rHa6eDguYx{c2r zjvO<+7`yl2+Y*)|uQx2eb5HKH{HChdGs&N#!ySCjzv4Bt4>|B8ZTmLorQgSEHQeG& z>I+i#K4Y7d$=R|oWY_C0-$FH0C{+KO@tbNNkwW*sV@pzR?=W@aH&;#2cz1496IXHl zB5vLp&ZJ{1t0%fC3hg&1X=|~yOm(TZIWlMWvz%V@U32wcLgw?hBQ0cl;3WNyK*`Sj1Ogs}3BRkTfZNGn!?wM? zj@%Za$_>0vwpvV^6gD9&PEj@H{h_Fc=^rguoPFHBE|t9g#em+0^ra^bG`Zze8E@Nq zs%*x@k`MfzPa}DajP|Z3*Si@ieP1Y!6a$ zswbTJD*JJIDBp9{%Z6^99Jay2HPgSGu?|#UXS@G+>4Ze;`kPJ$BE3%)0}cxt1!mki zII!i#ww}yGMs+{Si()n(d08I4bzOQ~tL*6yr6LLUjEqE8s+*{N1^iXU{l%%Z8xsxR zfAQ4FcgfA0+fu~Uy|GW!N?-bM7?nGYrQm|G|J9JG{hOjDsEj+@U}?W7(BjLRauey6 z-OIDn%(lL+y7ppLR`mK^+(NolS3h}AepT6cULyHUy9+I6il1S`7pHsC6a$I0wyo4M zwuI-3@t%Q-E;R2sZ3nvdpEnemnst>rJ-UDA)wXK_AI|Q3s;Ss@j$FkObgDi4QE~j5 z@)MmQOW$x5T)6d)WNxOp(n46Vao+^$p}#WA@sZ{r}0gaT*F@L zRr=4BFM4W<2)+|{+aGz-=G&BMmpRs1iZ@J{k{>+B%l5Gj>2rSB{j~MQcboQ2i`|+X z&tvhe;N$ZfHyR?p`&f9TcdRUPI=JCNM19+y$U>D=?))`jn?iLebjrpJJa+UyxiZ0Y zh|1TEZ|ETOX}Hp-`B6pIDYKtJjN+0lbg%^q~*I^ zz?|(|zH)9#-}_8WiYvH8_uqSZIIySJH`<%7vv7`h%?{tG{90#|XK%2n*Du^wEyhr< zo?nx>;KTQn@7q<5Z3@c0dTgy(N5YZ9B(v-F4bK%gk5HFMEN^_+KV zaYbo`b5}=9)$Csx&3V{pU4qGl6oJhfUa_fYCQ?Jbh~-RAJLjcRlOd54!_aL@ezZBd zF2MHICLJTm)Jmmgy^kO5NQgXHcbY3~#@$BwPaK<1{b2N_ol>jH+SdKxEh+N7;R{XQ z2T}XyzPA*&+#l_d*~w=+^+<9r$%q_X!El31Ghy}u8Q_vaY{TK7M%IXK&i8XN_Nx8 zy*qG(_Tro1giDR{&Y$c0#3J`|#mnT0DRR<}Cy8fk=6{T9Jj?M)CtNkVN-;20&&coD z6iS8Zo$cS=t#*2L;Yd-Fqrh5`04vSf%GDct7qQnTvO78+R|;AqC&`SeWl4wZ^YKNelHi1 zS#vN@XT!F@CmgvqqDZbeA9-#C)V5qOzq|3EsFyEy2>bIdOe?ZE zH#oRh+wy)txu9_GHipZ#xQbw_*1|b=7hl!?Bo?_{uI|g3+19*lhhC{~ZM_th$G+kl z>G_bEGg;+W#$xa zr6XNI9s!$w&c66?N&6$moF}&HC!ae!Z{UINje$F+rYCsi(;mcZov`TQiB3+5><_!v zzpjjIDAO;c%WGXbzP;r@Irll~zG<%*j?tecE%QseRhPKt!9v~+M}al9Gj7K%erl0D z-EObkHkTd3%jH_8B)P3S7`a$du>}?==QJhvO;5Yd|KRJ>28kK3 ztn*f7ADt;0@Oq7d_JhLmtp`ggKdm=@Yt7%bw`h!S)?dFL>HlV*``CYBc$I*}89yl(AqhLJ)i;t|UH2}z zOlmhXY3KBBJJ{klz~YF|3=D<&l0o3g@js#cRLmm`<$Ys1*%b`7;_CVp&=OqyPj zdW1{yX3lAufdZR&IjNN33ml)nH9CAIr=Ndi9-6j-l^MlAyJo?tmI>k#wX{PW^9x6iBIxQkV%lY57ELVB;& z-t}wb((b%YKhKs-cI4YkS!&Z|v-7RZ8`<;Ms@_bK-&s;k??0h;&5U6yD{R@cZ~G(< z5&jdFUUyD%blYuCHBnpq*{mURxAccp+n+uGYof0wv;LI%9w?|(abeq}AAy@FiPJvp zJ287rn9+puEZQ4Y9$oY@&(8K{vn$HXyg9c&LxVlk)MA6_w(QR~LI=36?&40AiT&2> zY{gicTvJ2smFvG%DfjxY(XEoLMPE9SeOuQgQBTa<7rRf#c7L3aS9W89Qve^&BC71- zuy8h-goDtNGxeubR;qD|wNll%nz)X9d|B2t&~3y2q&TE{cEF>K;6o8@;TJA__b5>% zTXJ&5_yynWFjP3w+~BSfUAai>SxUmd+eY=>AMVPZUQ2n*-#S%0$~{c`%G961g%aW? zS!F6>2Aa(q=ch<4u=3JNYg(9Z?5`XpIUpP(BDAyV^J~YQz02~K9=lU@a$$z_3)?S3 zGmmAy7jMf}->)8aG%0^qRpmpik}La?yCV%N6^!E(cPu;i{h)id$h5piMsbG~a!oSd zXckO=trA$OFWWJ2C-YQThWQlrYb)(DsYRFV8)`ccsYU}m9xmxh&mnl-K9wxA7 zlxCgfos)Ftv()z67y0t1*eojI3|&^0d}Ey6W*)N1`8y{Ep1yCY`*G^r6RiWQUYd03 zJ=ebaR6kSwR9xQ#sav=6I1Fb=i}NvNPvFt9>lm<*$Xxl}%j4w_(baouPyX58c6%pSRm3;-@{@hdCljnH+>a)o; z>ZEV#1D7rC%_zvS;k()Y$d$Baf9&qs=}k-dIv(~$>c=g;^XVX8U5cvbn|}4z!SbhS z6*p&;JLGS_I#qBsrE=O*PWkiVr((t5KP%oU_%1_pwZZn;8pgA3#!g%@_wkd8SN#t~ zB$qwPS(KjgO}ETE|JKd+joaydnOiLC=h{Bpa;2?V@qm*vRPv1PgFx4m=4npj=jZkY(OOq^qYNj=Hkw~GH{mZq=^W*D| z7YFP=am6;RDSy+zafCO68=wmS*{9im$fI{rDgi^ zH=fd1ep$m%)3UkUW>e_2DbqQ7X;0i@4h8v5-Sco9xuRdmzk?&}=ZQTPY9iGI?izBN zyCU`MW=%VP{42|h?*guzmv0_Fs=xRc<>WRQT~eG7hmglq^NuSX>o2cfI@7;7;(5M1Y>nG*9D0OEKF-bS?nhtTy^>+fw8+Gu+) zU;;7Dj&SIbIy3Py!w;PQpcmtH#Wa9^(6cGJ6!+4 z-W1_(>0b<>EIALfQ+O`LlDH_R$O0y|Fr?rB^R55oV~T z9I&55g+EtRc1QA2o%nzGf|4w3*dZU9=$$wP2*|+!yk15^@5!Ne)Knp;LC}Vv13?#p z9t89r8}cz^2*C(~F$5C`$XkXf1TzT8C(sfI$e+?u2$m3#Umj}+HV|wfApc4B5Rm^G z^xELa>u>Al3>ne+Mpp>v-8FXz9uUwweO?f}A;9Z#*n58H9Xo#r$R`Eza}xw%HH2UY z$S+eUgfIx<5Y|A5fPj1ht%HC&iX|fC91wY1^KcEoeXYSKF2jP5!$a^w2QT-6V`^}K zxEkE5A(Gf7>x#GqZ=<{5aTO6W;Z4MS7ZH;Pd}cZ`79`-A1Rm4RrEe{>Rlfrv!#y_)!N5!YVTuceduG*KK3z4U44wE&wY&YuaMpi>E9v!2c-A*F@j$8 zF=W9TYynF@LzV(DE5z&&kAs*KVlIfsL(Bs)c!(|FgLneO6CoDpXEY4}olAX;ouyDl z8PK{0^lw02ZbI3&f&N`6_kJIP?-7()-Nz`Xf%-h{V_4KdU7ka@2)~8<89PP#8CBEz z8GPdX42v0XF9G+n;eIaM&xdgL(+|!&|Uoq=g_^5u|idF{zgH zmBh~?%VN&r5ARKik<>{J(6f6<=SfdUbkYPCIhG|X0W9E-4}GHzdE*1ODd5c@V939) zo|QG`rV)LxWDV|X(8|VGPsYm7SdaNhA|yk<__+*=05`?p{*LB^T)(@xW6s}^OLW|c z%HW4yu#ZK6(^2?X1T7@YB_z~4Gz|G;hLem4Mjx=Of-#J|6R*d`qe-=hk_yw42#tio?}h%X5c z9}pShw*gi){M$f7V+->XYO3dGZKM`_yG_n z(rj#y;GYEmPyMUIypec;*ZPV9Rg zn159GHUqPM*f0Yxpor_hV8WU2@M`>$g5G@wS4zy>NNpoW+?dnzaQH3|_OYN}Tk)Ix zGBXc;q=bfjZV8hc<~K)z90@F>AczZj6(@8B^8AWb850W9uoUDIck~nx-O&>WcgU!n zIJsfvVU733zA*)T2OSuSG#3WNzT$=b0v=%M3NZ(+CBJ;b0rzu`Bo)5N5@pP&%T z1+GViId~3ohOaHSgLc8mkSwiX*qZCxThrkC7nrM7_+l9T#jW4J_yc(c()tHUn= z5K>jBx2NusLvZ9p!lEgzt4jr;Q1v8>M$N;Ak2V( z?gg`d4Rs(ZcOgtB(%InmLg$L#}a}o zgir`uAtb}tuR0AjH-skm9Ra}zetTU7eGH)vLMsGxFI)a=;DGzR0Pi8vP3u9YKq!Jx z0Ri2sKmRqn16U}8S|U9&9j!dU-ON5b?jqu-qxik-F+6r6;&LLc%E#fP(?mKEN1em( zgF3V@x&?*!{Uq!T-kVuxNn(lMW0^XB9LG+UaeN4l{A0{oMrX_=a8NWlJ`P9t9Lwp9 zIS5gY%7-GfW>$n?VM%99NB&ZDsC>y}L#kjB#e_;rWYwoiCa`H!Wn0sJEfpSTcz-2lFG1)WjC1VW79 z8vw4lk`8Ovp=$;FOa-_Fz|q~kd3K=u@vBLG^-=tF6bU$iz|Mk$802^Bfcm?KQ%%A2ZQ++ zqx^;_KY9Nk0jz(~9)=s>M>*0N0|b5&l9xn^K9!b$`ZpHIOEmius_HT>s;nN?6@x;e z&rRMj2-RnHz9BcTz!1Y6gdyVKa|l8$l*i{pXDmVhtly0Aev|d43hH8=hT-)Ao+RL5 zE~zj)Acp!^mh8_&)I&7EM@bamm7*Og;8zlo&*All%0#mpQ>(}ndk}Rb=fKOsCSZI( z2;|9h=BC8G>H^yk(7@={aM|C1Y7pns0(MAp452ZlQ$b-(< zgXF{#^`rSqPvtP=M*aQ)@GpAO89Rvb6OcT|qHz|@YCzQ@ui&E6 z3^1{V?q3Wnrs*>8Fx@eq74(4@oq_hqkUj|EqH-9cK@1m?XH!Twf^?)em>2r(25<|2 zqdhp(AJJs8K9vK5N8VTo7^udMAMu z#Dk$AKA=Z)0i!3)zmTzEB!m zs2=0N@0Vl{opA^Opnu7_(81c=-td13(apI22fR$ca3CVF0zzYDr9RaZMxCHS5<^n5!ikLT4x-0LE|s!Tv_&P8vsouVc^|{3xBc5I^SwToT|52IX%A|1mva zNJV=uh@UF}Up17_Lr~8|5PQ($P|sLaV>GXsQf0CB1D*xo4R0rcqib*;pD+%afAs){ zWY#nu=1YVynU5Sb(GdL~Z%D=N*z~ATER*@DQS3ZwfF;7i5&?6y(L_Fkg!YHgh3L3J znDJM1dbT4vF6&08lLvHu0>+=~a{;3xv3_(qbf8oHS9HQLI;D}L(@}^1Iq_F?lrTEp zn?|P-19Ue16&?CE#2?jB=$IltbAo;Yc|AkO4PoEF91)B37P4<-F{=bL?x1~R$W3;G z30;>70*#4uE$aIspl4Cj&o~Lcarq@5X9_Tq(^^O`2RTL01@LiC*ex`&2|hc6*+S?a zML=PNy%Ro=zg1{N!gz=!8}P7OBvX=D6WJ2jqsLM1uyBDHX~a#LN=85Q0S}Esb;yU> zoPcyWmQVNBe4AKtbQ=`ua#Nf!I@o-O%H06@jev9eksiVF8}YE~p>hpT!Fti-$j4Al zJ#O+c6dOXhXj~ORJ`%Lw7$Q6$a4j0mV`MF+T0`=!2YRw5^Kazx1Yn8qWWiV%ZJZ)j3BMe0NU+SBO*@%uk{2$3j zq|f}ulStbR(;1i|L$u&RaufsbD1aY>a`65%<6*ZR;tQn^6T8LSlof;k*&{{`+Eo>h zzw0QS;X;hBWMt2dJ|BT`K;c94(O8C+8&qKu__@@AHXyqIpWi@lk5113=28j|>lo{s zC8HLEnM|1cLpiM{VV)uCP1s|Y9ge!TWE6Wr52{oI`KnIQ8Mlb}m#{~{jvQ`JBOBtu z?{*LxL~x;Y_5mIHd^)2N&4-vhI_5kMd|NeYV@$azq3olr?oc6cp?11~^V9M|(0>R3 zj7Sr@e!$=L^>XJ1NZG{A2}Z}>Ws(8CsFsL(I#Oaq)>NPg$T1l@hm$#-L*jbb|ki&J>K! zfl=t7_A0^v)&f4{A^9_;7NE!!1%RtUPBy|mO-Ada-^Pt0>Mt{D5M})6b|IQwaJk6< zdOg?Z3~5AV#B+5jUz|E#&K}pfixzFfUZU4*+ik zIJ5spuODW&qD2I(Mn_Q-#DZrg&{GEkG2$kjAuu?vW9xL##>BjCfZKO&fERR&&X|ZQ zL+qoVetie?blB~`kq;BV65;Uy8l%a_e3%bS|B4PLMyGxhI`g4E<0k-rpgj(#J@|Z# zuZL;mA23Xz=7ZZE*!n^p@C7SjJ_Gb&;~Lr@%^E&9t}!)@;rju;D&U)qf*&ygAN6Af z;O_-|=(fQN!HWRC6W|aHUT*N~K7nt}3O7Ug0$X1X?Mo5s5+_RO=<;XGZ4Dhi#c z&Q*ktjJgNwwZYPHeQFBu2!JaM&O@WgKeK%D*-?uDyYF8u{82lLpd5?)z(+#=C!=-6 zZ{v)){vy90wH$43@|#fw99MWEP>u*NTlFEGk&N1DNNr*v$1%-J%nntD^b=#GD?*kP zkS_R$&Im#IF};uNGr{^Nnso_vCz-r>*m@Y@z=h;674kVjKHWh%1iMlvkz$s>8qG%j zh8szkMX1e<#?gG3$96uZGmtNB%s%1O9b-M@3|JyOsa2zoqfnsZ3K)N0$Ivi355}NV z3Un6y6`fbrs6Hpgpu-CD6+h7VbG!CqbehJXV+wTM0mh%{*kE)jMxle`0bMNXEKIST z<#80*RAUka-(SY{^-M_b0eRp9xnxa9HO2cJY;$67kzxrW4sF0;vpq%*vs2N$jC$tJ z^^?c=?hCaXO%E!ziFGXP!(@Hzy+>=kVP0GnU1 z{R3nq9vET&9EF0SJyiQQ{SXLPB0P&~es4FT zQwnre1IC~EHy5LGZVWoCFmG!A6`eOgL4+q|6gqCGJ|K@;zz6i{0M^sEToP+3*qbBf zYQ)Rqz)RRvht)E08-!GkI}{*;OK=PVyNJK6w=nAxUvCvbeGQ-d4gUlION8giDD_4B z>jOH%e?_MT9X*&2JO7G*Nf@1lqtHQmybtWJCg5K(;@=hKxW@L5v9$_? z_xEv)7zC}GD?}qquGOYaow+DDM;E)Uk*FBhh zMAk<8^UN9=a63^sZrr+$H6fOgK*sbUD-fU6^*8eL{S%TW>Wk6kz!d2G01T+kAN1Kd zjLx;j(dnRh`Tk$g@yF;`y!xGvB2*z1CX=c2pVo@Qky$#Sz z0_-9lMZ%sQu$EK{`J!6r3`zKn>2i~6;RZ$ltRY~j4{DT1vE(Mlzzx2- z7<|rv#$g7~z1TLSKZxfkn9f0)qlf^r3sAf61AbjQoiPp71LHr))#!FH@Q@;p*#En1 z;Q9yYPc$!opmzVoxVZvYB0Q%%f0uVe=RVN6`d4%!Fghh;(3u1iYRX^HQNZYAfBd~Z zNIvLb;L<)2&-F3+SPAl>!)*le0YjWLiAEyHLi+IaGs-s~;F18Bf#0}X4LvtO?VJe< zB2`E?2L7|Yh4G2$PNpnStk5h0AP@i@Zo|RfhTLZG8y5^cZq$#dG?=fU?sHh-X2due zTE`LNsEUQ$IO;IM7wV|q?|>fd3!Nbazwvr|4z6QRds)Syy^ub#y&?dY1o-m7e395V zS_Zk*0j3V=UXUI_jHBQ7lT4`PEM$0m_RIXX7~9`KFFdFpg)BC{Yau_0PG_VIj)S3fD8@fb4`J&=6DsiU?Wp4b=O5~inbTo@ z`$lK95$#Mu>&@ZMzhMx;^R^beM)0g1>I~x&RnSAg)K{e(S)>q#q| zDD(%W*ie1wfS(EYYXVU_1WUE2_gWB~0 z=HtwHe>2al1}qVt*BsrW+WU$y|Ahd?pZ70hF*+q<(AfZVO#Z4q9dl8APK_VEJ{3Sm z^snl33Zv6B2A%QHAUa_D*?x7$=+uuv#~SEV{uLb>MrRVw=N&a~0{%M|Ej{8fF-FghV)&_VNZ;9t?M^bEb{`di%E~xRJ`%4?6V>bq!BA|2Qujus6LhZ62gH9jN zNdr26?)S?W9p^FV=)pYa|5tR@VRY`z7@a=}Ku7Pd=%`_IibkP>>=(azFdvY+@$-go zk1k|i#Q@xi(#?3w0ymibg4t`>x^aZPi_QhY!7$a|mo4~XGt5q^1$umi{S0SRfE}FU z0>d8Jl^+1!%G%9XO~%U^Zm%-!N=hWmyT5F3;Twu*zMc>NBw;?2L-~j77_^q!I%M19 z2TKtC3izkW+0FQf+Vv|w*AV`YJ)8jeJzU-RIXuXMF2uKE0O#ZGW8lU`OD8YI3;?)AbSJ?=p$gJrm=0c$g)|@F ztpJZA+5>yJ_$Qv`~mqpZufyK0}hmp z*?ow=p@=?TH-iU$GcQCp0pOAV7oxxoMi=r9Ki>%JmS}d$J|v-FbiyJ;A0v!bDyV<% zLw=5l-Ha(jy@sD}CC3i(02?W&9({n{1NgArI(Q*Elh6WpQa2+KK{399y-nE18-68& z@lg-(Edc*I!Y3|7e+9rf1iBeVnLvoK_5(Z<;3}w|#D(Aq0KYxCn}M3oyik7}19&;W zHz45uWAA;yayXj&<$22rU7U1A$m zq?HnM$r2PrtsuLKA~d>Pf*@Ac*2->cx2P4gO`4?pyr26%_nDdJfSrTJubY9V0zWO}4`Wf~jqAYx+_T|+ zV#r<11586{6K`53<}cwMBzJiV@tFm@2KaemMy|HEE+J5gTIrnxwrTJY5$ zxYMzoO8U?Ud@1lzA$!H^>pb3=Nc-ln#l^cpv;nHG)J#ptQ#o#?`2S?5{Q|{3vOWbW zR4Jl9>Ha#UH|aRkZ^)lS^70U#4&0x%)3LvU@EqU?z>$rihwx(H0pRzBP-S;2fUgD~ zwo9IJU9l)%>)_rC_p?NQBlDH_hlj`QGzW;Grb{~@7Kq}pnfMNN>ILCDfOi9rtoMW` z9gp<8$fpDE0v@TCB%cF(lM7EV@DAWqZ2BSj3g8=E_-lc;y6`swUkjXud-@@s7U0dm zeHz3k;qAaz13%Niw*sg5pKRa*z!T873K)3GFQDIno%ZwyybRwnfNunTe=OxwMEj)% zH`BR^-c+g&gI$y+k{&c59P7}Xyxv0gXRmrtiX|$S+ND}m*ji9+1z!+-l9wdjk^2Z` z9VY0RWi(2C&nY*cg2X}tiL6g0S*XA1J8jzTs2{RtRlw_kb9>JAY>uu5 z+^#jiy$SAIe~^Bc_-4|SwqyQF_T`Y>=!Adk@Nm1hjM}Hjc?#NZJI(Mf{U@>;DJP&m z2LCtUyR!d$zD2E@!tzR68nVB+kZ*?kz9cUXjqBUczD`~lOFuRZQfZ^MfWvJaFA43` zPa!dM|NN8th-YmSo?`H!1HWOJP$L^`xD)H)_`YmOgtAc&$YSkJUhU1UQ9d( zGS7@CJUM9pjt0-r`n+ic<}0?Gu?Ssf#>3wc;X-Q&{+o|j|dxs!R8Md3-pfNVufJZCb`{ZV*| z!BZX+&nV_u7lo%0Jg0+aX#2czIpxoWx$gP16+HXK#Iu-r?uo*ak!@LDK;wsw&uPr_ zK@^@U@T>*T(B-~o8KrAW6rOe9xico7b3V4QYcXriL{(KdMXES)VQ4Jij{d%5x-i*SNjsfkun0T&ap6M0t>8b!v zJ$Q!JpQD)PUst&Ew1DT5n0U6{LHYAy6rKU_oEQ_&L(KF2RqpZ0J;ky{#Kdy}^Bh>| z&Qk}T&9DeV=g%1C8F95cPbYYu1<%m+tMhispUdaF^Q7gVe;5^gd&pym^?+xxeJHV3&o}u%({Wi*<%3rzj2{B0-m48#B&YvY;xgA zf$hqfgmF^}=J||y>|)>@V|Lmr$iB%#@)f{WKflMW)F3_yuLU05ANw&PCJYI0B>B{x zHqE_Z?>t70YM#FZxP^J)Mw!p5!vYuP=Zk3nujl5_{0y%*K&7m$kgq&wr=1;||H8V0 z%m?XpFV8w-K1dd3Xg)4|GW=s+xJK3`Y(aAUVct&Kbc(ZI#=g$bx2*Q zF`m!mRlwgi%tJ=%MF}WsfmdR_FG1${qn~HpJUB|&%8NP3Osoe)MwH8*l1;j^75srC zcG~};iDaHn-OG8YrZ{hd`vmRyMDP94T=<-8Ar7RkJ$k3TAL*GhU)q&cV!>g2;$;!v ztwj*6g}{DX<9(8_is`h3c8F0Ogsz)BY{K z>xarE4fsaj1Hvp^E3bPm0)KgMr@ehY#Xm^j zk;WzQyibu%pLq|Y+((#3y<(M514TRd5{h@)2T}fGX%OqJ-|`actmFjJgYD!#ZKvH$ z?uAqza2^fE%4ppZS0zb(@ca!s^T%RmegHS;q)vDjON{UFmgNO5a0#tQE*VzmTjpKP z)+-Ct#Z%Frn!eM1dypP@3y}nxKIWAtT7^>kUe8FR{H}w)u`_nspNXAuuLrc;zAtFZ z{GOcX^%0Dk9a$5^AaMG@zxqO~gZK~_*Mq(5*}o~j2kRNu0Vcp<@Ih;;bfizkFlIF~ zciQLTyMA)2IfgG!FsUR zp*kE;M7yHSYxJv#U>$pWB2ETVr0~5k(ep~^M=1T^DV>A;97HTn13oK&XJbqmA8JQ9 z|9PJWukW$Gi+vAzN4RIdI-i<1s2WU4^rn%I!4)KrOpZ%I>iGK3#Jo!RP8-LOLl3gd zN&~(c_=l1o%RIP0sE+P4l6%<@lwReJTqSzRXi8~mhRUG=eA)AMs`J+}%n5;!ykknh`0b zPOPuKvp|AAJ8|K%f&lH#Bt1?8J{CCTg;kLpxDYtmnJnO?z^4%o?Z8T3!kKh}2S16U z817AQKbG1XZU>M%9Dnc6V4y{xaRB!(_@NAdZnl}f0siZ+-D!`9cjBj2d3`W~!f%0l zE8MRWciNSHCY@TwZW4-XC)@)IciOi}x$VWS()#=ocRf>4B72rzg!Epw)Bc{qgWZU{ zzkzO<_z>rHuv10Vh=_hu3H*({UhLrB?M*K319;Ru9;(G4{aFLP)fhXRNAbYErp2DK z*F$&c%N%?ml=p#jLaqyP-x7dWEry-1iNhusGP`J&a66bE)`9oJP&xa~M*Fu|#tYEP zQ27JT2YwXs$V2j3z)OK2#1>yU5MBtp{1(xp2>CML9lzOWKRHT3e31Mi;MI`-CH;_x zzBT|adSWoo8j=UTSqtMc3;)}I2Um-}IP~oTC>Rc;A=zi(Iyb2~?3?WI0Q}8>zZ(eQ zaz(#L_PK<&42@5`O6e@jU0!0bE@x&@{j1z_ps(Q3=O6~@8|;LfdzzG7if*NgEkbR0 z$kljB&7gc)gK$*KB@E#w2uwKHh z4eD=ARriY2@8kU!_2&n-gRJR`K#_}vu5{y0`}d*#rCYlycD+8%b06ri1g*L;p|cSM zWCLA-$)}6!T&%j<=t1_N4dFMvEBjWUzt|YUcSXU8^=vELTj5UkA?b(mZ2)+0hwKj$ z2f|Z|VLv|DXumj~+(scCCGI!Z?IKNiKE%)Z(Lf5)sdDwIpkzaxi&aXoF z@6Fm}9}`hO)4^K?+<)RO`v}5ej+S_)QF};RPRKNIOHA>tgIwxKyX+ex{AU4Q1-vF3 z=@Y$M=7ANe^PU^(htOfbK&S^28fR~Yztz9oW%~>}y#sjDDZA{E5qJi|NkYT2^3+{+ z9==DkbKL(E8;D!jltCi-9LTSQJk<>)kNs)VU%bY!lavn?klzIPT_mr@C)mpiLXZnB zmrn!anorwhpT92&s)x%TcyG}z`_YJa6W#{A{@h*mY5QwwrC*zYubsQg(XS)<9mEg( zvZI~yNi$Ht?-?wg4%`ABZ^-8W?|pr+J{AM-27clpPW}qusej*PKXQN*uLa)RyUV`T z;BO@P^d8%r>XdH*?$7D54~uu=?ZC%Q=&?ITJMpc+yU*^ipD^SHfG?fVV~;WHV#@i* z&kK9(ON@AC0N*yh$G)5Dhdjmj%mrS#u*WVUo+8rkLelR7^jANkrgJ^id;R9ycrfIVB(qxx;AP3V=N(qqyI!>0o2w~_s+ zgWTAGAMA@szqx(k`oxFgK`I?gsaVDStliq>S_jdA+a87}D{gA$I1zrR^a(t5p zd;oYp@ChW$`Ef1cG$j!>iThP)Fxb^_hnk3cL2@Rx&{F4d3hjI&>opM_D*{Lc57~uc z_-lf{*_00MkKtZJG(B{Ejdu#)9U!~alzc7ZyKd}J{V+%WjrOHevJsA?lx$549M;AWqzEq z<9iv4)rF9rC+RpHH`x@QT*!Ap{tK#KTyC(%(vQSVx!x3X>;r&6g+3%lCj2uZU3K7D zdTWpBw{ySD=tqV7k)GSs1PJD$AOl$tbIPdRbW;46_ShMF?T_)i68fXwOd5B9+L%^S z`-mxh=@-G?EbFnG$R0cL<1D!#6GInd2ws?q&gq?neys4X0-pKsV0<0%yWpL`TY>*u!lVzfL)(F` ze5A)-5VC)`o*q{rtBS0SMo|1xW}>}#)EOS>RR-|vRj~h}=kDViIal56p{0oI!NUes z0V$kC;9L5XGoQ17Hvq2(elxx+edBW=$Z_oTO@)HM985~YtU&0y%I|jg+h*`lI9q{t z10PF#I5$lngbx5ucpB{}0bnoD=(JV5a3%m$8$>@i^ zmy|+ZT<|L3r3OxRrw({I@Eh@6*%72$&%cG|-1vwtmB%{BuZ4WSPs#74Jn#kq@5es3 zY7VdTEW-b!SqQ(m#~w}XINP7StP_-ak9Hpx7DOGdc`)JYGHuEhFbhG}A^hIw(T~7) zmHu#ll6wouejK01cu<>Ch>^cG`18NeW8X>npzTxSy|O=$Il}e5hq0OB{&5*Z2PnNS z_SnBp#t%1p>zI$k#%C98#(wq%BjFMn&xXvgvY!;cvf0q*w@~l!J)&GOKZo@?nxaq* zLm?Vo`Kr#vHNxK}_P}vZ*sxc0bdDxA1#bevU8mxKZ$UTH$vn2$Ll$R zkw{hlA-56!O?#UH7^b0N3EQhRz?Z^5y0M`r7vD0_j_rR#Ec@EO zzMl4@UyZ+R`|PX0^A$-D`(F3QKfyd_N8woqp0({gG3@iW2vTXIMj}ma@$sR(x-%x8 zH0GJ^!b54L>KzOsQw0uV@h#`*1})T>vEd zis7#;;88i{z~5?w$?Xb};i2$~fm?{tEd=nrk-w7ARJ&6J_e!{Pe;myjiBUP$0WSys z8v>w5?(1I#$xR-*rI-3^gBQApCkO4?%=e_fv)B9kG9i^V>d<%H^S>56$H&C;H5k%H zl}F*Bc6k_hQYl?~jnCuEbFK>yl~XM$>Ne!}LntR-kG@|=)<(MHy!q(J${ep)6_u}r zrIt1B{aEtD=KSb)37_({0X%Ur@x07DC*iM~UT+3ZXH5CAfO!se;i3F!z&!3o=*x1- zkNA7!z9G(!f@I`JmP>w+-tH)e{(+O4J?d}M2jNL`p??NW`kW5D6nHTSLNDuRe7}U= z$FtZ+?Mg1(o8Vqg?rd){UXt;i=VEFarX8^$VcYW@}4}^hD=d{)W2zj zTsGv|X&f1~eU|lcynN=T?i~`ID5kKsgKzBzJ$4-NO{4jQ3u!*#JZevi=>0SKG@rol zpYgOrnMo+5S@9+Db;FkVmV58?@H|EC<;c&EdhGNODxNOuZ$a-9@x}t<k~TC?KlC zXb6xzv=!sk{ZHU4+T3Hm6-qbyL6P$w;c+0XU)=|mXx%C<*R9~|_*;)-J(|jO0C?)> zGCnz*%wh?a{xNQYTNeJO%|m+y_hDogxtydO?e=PEFWx*uC)I`#UV)zSm zN&h{pFKkcs#b-z?mrDxdYaw3)dCI;>eQX3?4V)E}-0)DmTYy&r|A6ub*QsKk!{eB^ zU_Ns1gnQ&!$CZ5B_l$5 zm|lVM_y*&FP2yoGWHW zUAmXj4v}5TK>Ie|j-|bw45_qH{sDKpR0WVJnO&{h>7Q||4@9UMu`u# z%RP|z8RgSn`y;i?lO2Vp5Ipb2#50k3o{YlN0G`KU;_)!geNlKegJ)4pJa6ow{Mq8d zL-l6emFRy!FQKNPCkNj;fd{X~yY~o1{fj(5%KHJZH_!7ROb=>g$n=OlQN2&O3ickn zCy{@yA3XlX{(}ocwVvKUMuQdVOVdN~DTKejefoo1pMo3Vr0-?G>k*%?slE+m$AezW z>pGB85v2IFfG-pMxo7b`!Y&~-p1Tl1wWDB)GlCSq?eMp8dynIu0K$Ehm@hH#4B%Gan;C(LM$vk3$A4#h!LM%DdaS7Sc8Pv%)sZp-O?X>uP0?qAmX#XgGYhw@!%lpL~4ZD?#G=@<)1BFT~h~A}9})t#3Zs1K6^U3FCBPoE>?;AL`5E zc+5RH`rFu4I6efai#YNU=Q?Fzn?YFy{(A8L(u*HlpP(0^_J&^bbA_6qfHTQAK)wm~ zf!=SY|*ZoGO8og}4rB;N-4Oi!;pbC{M#|0{Bw-Wh7nxc%Hg{KI?glSzNP@o~xi z3moH9&ERs_HDSYn*w}ZLK*hl)fdw+~48i{Wa z@r~-WyC~jaKHgUx)?;Z`TjRW+x*G=02;yr8U;ci*5%1;Pd;IPlB7SLA(EkH^?ayM2 z-#>L5+Am*1F~;xSA>!8vzKtcZ$Im}R{I*m4F735% zj;4Q+{aEZbuG!1Lg6wI|LW~zL?{(axk_EgNcq#A!d{_2Mub+k9YsTwDxryh>s8IDE z>fkSXKHis3{^X%>Rsr|V>vgo-)V{0(o&fw)8lOO4Bj*`0sTt?l9-6q}u@x2s!|(T0 z=9Blw`>J6ND|+pxg=f$_dN^OOPtVips`c1c_Xk%86%g5{3WT%mie7s~$eu(UN09yW zYy;omaYT6iWF7djujzH%yFvNY2|NfqvR{}6d^_+|^uu@^4DHZj>_bt#HyQt5r`!*R zERDlxM`t>|rUSRYhw8%kV%pe__9qX2r}BdNc;3HV2)P-M+a~$AjOGcP=S+fhRj8xi znal4nj_irzK2d6GBj4_;&QGiX|F)`LHIGDb!Bd9+ZNR&MzZU8bh4U3}Hm<`xNf=M@ zd$O?J>3I{`>bBhJy@&LD@I-#7y~?;A?aRVm`;XDekHZmr+u@;wwQQ)4v97At*)kCC zMc~_X)gF6&XdH_6ir?eseQvn!^HC!4P`R#w{L1%#Q1`YnD(fG>YZmp|zoK|?|H4t< zrlNzfoq7xfv^5-`6a(TLfWM75_u2)*MIWT6DL3HHuY2u$>VI%M5YA7-ZqxV_m&>^% zQ#Q0wI?IUfmR`G<>>|ex>j;tkA8#3Vi)mqt^t1u;nRoO?+)p}&V%`$#BVGQWy@Z6e>Ft6#`~G((0B2mDfg zWh_GdsPA>;KjFE+Yk(hs@A@IU1o%?m`)ClKgjWHtcfsp`uXMpz0dE3+p24#Y_%`4_ zHSkX0-G+P`WVQp(UeRkGLGrx+O6}REpA@g8UqQd&j^ShIA)Fq(hxJ^GU#PBrgNn=Q zKFHH>#~STh*c2DmT7+nCTzsS(xol^e$|*{7K%08!i7R@4^ntpX^<@$?}i( zF6^@W!@LW(S$>~)VYlUv_b%+U{9fn)K0ad-F@PTSjIt%AeA<1(ZlG&y1cJ8 z1?}C9G4Y(jJa!bG67WomiKp*zickEb?(v~^IU^>XmzZZv6rSzi@y5hc%{=$6a*t0I z+P6<3G4y=VNz8Lk6rM%kc`hcNU5`=zyc&h44LnO@;`u%EG`jGR{ajT8eSE0bKFx<8 z+P+Ux_kOFl0OHjGuy`~>k_C}Y$On+uGw@yYi!g4N{YcopMUx3IYiBt2vXkB?-HiGV ze?JYi->`vobp9veybF3ijyD2LO`Pv+t0_=r8%n^JiZtCv0QwX30&so7IMu&Ja9@l5 z$j`-{Zb2iw0eB^HWIw{?A$$$+YT$ki;*;<;k>580r+&d^k$;-p-cLbx4bo{RZUilO>Ck{VQ7>hmUU_uV3 zfoOY!>fZ7Ei4X17Z~xO9!#VCNA(b}DUgKUb3aPz}iRUQhseZn~6Ri zRMD~Wg6;a~D&lBYXhM`ctNEDpTIdqO*+Br;zjGY(E1r)~`N$0q)z@OkH~sMkwZB@| zSIh$zEcfNhhPm(J#7h?BYavhZeW3_HBIG0H4be4)hy26})w5Ckv~}>ewy)QIi}c7y zC(rZZ?G_VwRn*bro=iuj9Epd{as9sq{STB`vFPOzkF56uurQ=oRxu$-d%;nivEEaV zh#L{*JH`MZp?qEkDgoak8)MIhI>=X}tRJNgip~c|Kk=)0NDU(L?#s2KnaGc8Bf@jjZo{zb8z$HyN4WXt?qcF+Out1G4ADm$DT4gt&b|0U&?n zoV0Q7+w++69x+b9A?nbM47@apyi@*`fv+aGTfMK1>nY~>Bge&b6LuhEc*ZBH_ku!F zNQ5T^?b)93v6Rz?kV+eM0{)tIlj1||awkdP``*{pRxnSR3lI6txefLQ>H0nKKzp$c zi?N{EAw%vZa9;|)cal5rgSj;{-$3!$ig>*K_U;(kw|YpWjq1;LPfrHg)4O8gnaVuR z7YybhJDhYo>Ko$w3d$>Ff0W%8v;DHRKgDc+pfF^Aa^bK0PrDuWBXjzJry|6t=|{X@ zfcwzxU@gb{3j8(8lkFeE3Bv7Y#6>@pzqx1!Uk&udkiW|zl{TuleK0@q)PbiyCY~wG z(;9_`+T}}P;_)$0+|T+3rI+H9R*UC__a9Q~ke?{e z4=sG5?c*270SsD2Lz5WM#J@M&wjn5NIk@E!4g*p%<-vIfW z5wGk}JB;}p>F?*&#TQ~7F-`X$av^?nrtX0mt43w@xB^$a}aNA%gJN8$Mb^V?yb35ht86K0Wf*Hn)?!Bcun zpS`c7C-S{Y{F17MkVnLan?X)T724H>$Hr1$@*$Nr>Vk3Z`ne7~1u^k>nP*`X9v|AZ zgCQ}rp1%f$v{Cb1cql*CRYO0JAIBm;d}FXr3}q~Nf;JUfW|-bZe%o9XufcyJSg%P> zkY_c2kg@{x=lDJ~56HTL{>llcYog=ZEaYAZLpIfI$elQ9vwe0!O3{HV@sCO2McnN~= z-G%v;U-a1@NO*(x%i#0`y+6ZY-LV12K&BuNM-P+eC_QE1uLu7R!XG_74-by||1don z2%{6>1+x0o{aW1KOx62PWc=y*wQg|8KKSlN`9QwYX)oC}V1nO!8w|e~TI8G3N9y0? zz+e7}efA_u7s6Rga~Nn{=w~|qm%zOm?pF}N@d%A4XXtG@)c({$t`%}^B**$&VCrwC zr_N|_upM3)C3B^Bh9X`CSFXuE$`JRWt(@e7eit0rJ_%crhAHM5{@HN0^06$KH_$0gy zc#VNmzHA1*8aT|atdoSF_hy2rov8ov4z6S1NCr7$p3U{T!R1ezWJ_GK#R^8w=R#d@$vI8Qg2& zK1JLmeArhcpJvZ6%s-R1D`GEm=JBH-4ukKi!agiuMBQ2G(Cu4#StSNKlpl=hV8XZT)6REEXzn5A^I z_n6_m#DFFx&UVVE@leYBs4vs|?B9j>(LTugy~6yS#gS}$FcI=pKE?3g1^=|INI!&E z0N(_Bfd=tOcrEbYd42ZEi1H-75%|XQojh5}s=@U%~65w`|WS zoSa6~&(c11UQ5Cuycl?37RE4w(FcWJ0X!S{4I#U3w67e#)Ta)w_X*Rmt9rvFO5v;n zUwN5xJV5!FgLd!W>m~hr-8cXJbu>=;ZKeBos}?*vATjiM>T}FC-y6uZ6!Ba%VdTeTv+-41L0T$#JyTQ8gzgj#mg~ zX_Q8x3TA*J=^=!7NuPZ=87^)o&l(jUagN%%jb}Ys|0%9HkT0+3Q~U2&UeD8e+Ev4* zHn7)*TG;}=2e%6T{8u6zaPYb?7JiAZj`)CYiN_DbY|uE&d&4kQ<5jdNA}J7UgTKIn zJ~huu>&&++zRkc_0{>OWp1@dy>`5@gp$9I1gGLvYNkAu_aewA+zI<7`6Bl!@_jdGa_Eq2xE+&qajF+B@Ye-@6sCpK z9*aE%p@^{kqjs|%HJ9AU{zZL1&iy1cYCE{hd3EBUcDWG}++OaLXFBtY#9xyq2Rvnu zU_J$5Y@+zEUK{H_7?F8?hdLQKKckvOo`*|9yLC@Y@wklRG1?^_l%8VnTpANkfO)=k z$rsAgtVdBl;5LWSgL;pC{3TiuD80pSCx%*bM|z{YA61s$RPR8~1E<4F1N>LQKbCcc zzld7@Gu1sMDr2bLuY=qs$kBKG(DzQ@UBJ&KaF)79h4gJZ@UbiU?6;|(qwE#zo7_u; z%YHE@g3js+`c#)UK#cg(SE0Xkx3irkJO}t%7rYpFvkP7Ue63C{t(^qxMoPgC4TKZ=2O0O#@j0_Zlnf--HycB%^QMfXbi za(#dfM6QQY<)5wEC|GP|>?dJ>G-!5B#iI>;_24UzIM7E4{%;1p5%_arUzU5&pIqiG z2)(Cw3bl`P_3Ftmx#pbV6z;4Vvx`zICH;>hzgPCD^?V7N^&hzP8wnS75bM{Y;wRR5 zG1IKKsRCnjiTTv5%Jy5Fv{uCH^X0CCTQuz+dZ=efFvT2!Fhu zrq366A044;Gw0`4$alPia6}Iz{g}m;dsLura*y03>}Ot&<`;;uZ98KAFl#l&Yp?X# z@5p%RPP!+1Io%5#c@9dq=cLIle4S($j`{QmRm_ zw`WA`H_ylNX`JY-r%lv^^(5&j*z-SPUU7uZ2csN#d?w{upWva1P9x%opz5elJuU&? z>W)5p2kAHGEA#RE$)I_`Qg4QPzc0+U27ELAjCw43GH9QRTR#GJW|CnTNR=sm1K?Zw zNuT``b>fV2H{!?Vvv#>hkSE}%UKT!$_T%$DdsGsB==K%s(39!>D;BQl0PG{u%u@TY z2=W`hmUhKc&j*I7{2G9lZbv^B-xUw~OFUmkbIx+UcS0gAEk+t3wWTr&wib78gJZ%_N{;q z!pN=aYM#3Ua%&++b%Ny3Pr^_^jWp5#ErNUMcYXE+!mix{KDf|(fr(8$KJLO9i z{I#aQ9|4>%$j>@jUtQwEG}_`}RNMG)apZtN4NyrhS|~na`qla#@2k3Bcfa{eMkm~x z_Ts(+?wR}d+YJ;x`>zZ6r*x$}3;PN8dF0M|rRU3e)?dw1Pn8L4lmv-UJ{7{>Hu$@e z0C_0BWx#_6^sDg?^mt}S%ay-cxLc|H_89F6pBeby2s{D!aiVwfo+F;;d|rFCN@sz7&j$vfp|Blz;cS3!V06t5QGO~C(5 z7{ZZwp>;j|nc+i48##5RjKuiI5Xz8CW6kUZNvB)O)HS-6 z7^3u0`qG|<{e{1K2;}rR_F>Vvy3e(pq<9xXe&b>N_Q@eT8E$`!eh)3H`{RWZG__#+m(q1=&&-GI}+aW*pn11_s3ZLbnQmWlVS4CEruzWcl zKhz}|`H58!^}T@n9*6u%!Vg@^ss=2P9dW-$4OQNK@BQgCS{aVfO8l~6%YAoxy)DCO zOf%u#3GYpKpGP)$57RfaJq<$}$QK#%2!bB6?~4#_{>lAzH35k4VqRb6=}A3Y&>L-Ph-h%e;^nS;Es%5})fNu=;+tY{cFVY}$n7h5fy_8?N zcc`iEQ2475PV1C@I~(7vl4QTWr*<9iZNRD6^h5HUz`KASszH2GUTp{73w%7`oZn|A z2XMb2b)m>T>G#l|g0S6R>^T#|p$k}m+%w=_4fn|*|7Rx$u2KFe+(NjohC5}ue#l=L z@Fw7w5{Pobsw=HFbA2a0sD*ns+!rbLQV-p=J((_;mdzxIr;B4;%n2yzp?aBx4q@~7J@%2I zdd7AS2E@}DGJNW|D(iU}Zw_?gD%HK6`FE8wOoPWv% z-UhrBcs<33+XKWWWZ#Rh$Q%HG0*5u9m{=Y8Q%1Eaf0JHB`JK_P-UD>LYNsdgZQv^W z47hKEd*u2d#VZ$h2k^*pC%gpstA;$4V-@h%fM1R86yMzB8J@YU4Jw=lxQ{-wU!Akf zL%p7-?tNYZyc+lkL$~9>%`VVLItNUlK zNg8I27@ja9e#8iW++u5=q#O4c^{ai77wt3p2I3-~9LQ%w{uBb_X~1VO@KWG6`tXDG zklO)6583YUqUvYvhG9Hkq#N0=p+UwxDNf+@g)|qPi_nlBWBm`|FnDARLqhT0j(Fvt z+i!bGPvjxo_Y(SN#ZH{^BMo@=w0`@x&^Q|HpL3oC6K62Um@TDpErk5a8PE@@7r1xr zfH>UvPeB#pe+9Xp-*4|GAe=8eKI8T=JkLSr%6}b7Byuj4NSVhZzIEWszo6gV5~}av z{$6IG3gmz<>1Ei{i~8-qNc`OQ6?jmA9R0UY|FaPOmtNd&UlNLs zQSRaNO~ySEsNF8nk@G)Uh(jazR?m|DG`HtdM#b~h>eOdKz855(rTQNi;Ri)p>18MU zb-^DEi}b_g54?JIzx}la@yX?n4qVYC{dS{)rvcvt9A-82kbD;Knlh&yBD@fIHSm2y z(u%(Hi1E2rye*3N1@)Mg#&0IjkRgie2 zD~|Tj6^|i52N19P`}*xW4~Zo|M|j_K&rcqhv;Mz^`oDH?ewG2R0sh|qf_^SSR9nDj zz0z;bjx9fNd4@}VPKcVH5v@z4;Z+?P(vK`m$aKHfZ?6yFM_3Qt+qb4Gyj$G!jVm1G zTP^r1KX>L^2JlAU<-qIkU5#gC9wHcd`zSf8epx%@H$r|50cAZlX#JAz2g;-im_$J_T_bZ*(ANCKH2CX;zoISuYCRchyqLNy zFrYNf<8p<24ctc(FUOPbbEXLppT2Dp7B^Hs)6s*=yz>WjZw$Q9L-Ec5p1&3IGz6e; zO1B6SUJSelI1P*SLwJSAAF4ro=HP!V@KVUXO*qFF6H-Wv8UU*IqfQ1gB@s)U$a2C9 z6Q|?v1l~{72LIjge?0j|?vx`QRBoGrr+(3ImlMvsbaf||l_DxO#mm=*@F7<~a@6xg zC!6pz;46XW6D|+oS-?AhU#LNR5?%U1wJ|=9)r+UCn4e=TM!^nOZ?j=8YFMO1LwcxA#^?+j>N%go9_)6f} z_^$N#T4=U_XBXQD1Hyun(sW zJnIYYDJ@g?%+$qWIjJr|Pj_KENlt(Ld z4(&qwMSMvcG2Z>{fIUX|+|TjIIldt6CU@yqNr!>*vjltz4-VK%J@~=-iScvfe#*0D zy$#MJUkCZ}rUAQjScH7!d~Z&8zL(_JL4M_91NL-pguGgR;*Air(v3++j19*pQaNmg z{KnM-_W7hQZt+peg}CrWy(njVVo|8P$$!S5&>pQBurI@Rs?U+@F|Zk6dlL+9A0 z6OkVk@Spn3fIV$^MEH@@%un%hB`*PHL8KA#`7HzXWXeD6vCs=07}zcLdDq0PhY{NV zU1^815VXWw=OKORgul{13=AIs0`CPrX#9(Yr{l$eLGwpxz_$VCb{V|%5PueM|Jnij zbVk&lTzs^kUH$asff)LMPeUqg)Yz8>-1|S^c_t>FOPS}oC_K4n|7svHbpPiN=6TPB zhx9D{9poqS;Uh{a_A}8sY=Dlt`>}R{dWvP~g!R)=0w^acH<~A={CN}g$XBG#8>8R2 z#LIg-NlkV~t|`G(q{Ckw!r6v6R8u(6PZbVYd!xN>fm{$V&LcVM4Fy$u-447OI8`70 zPsZODBJCN;5xi+E(GA;qT-a;dKjsCk$(l9zfsOF}%9jx}&!3HKu6 zk*5%!ZNNK#_lVsZR4@7V-&;)sJ28>2F?ZP9N!*`Gc^7)~>cF7;EHZ#s13!(z=KLr~ z4qVNp!}hBX?knMbE7e!H^S(D_kMi_-xaS@+DXQPL2=cwJ57_vib?8jbTdEuz05rD_ zZr|4cUk#k{LO=AqP2?wQ5T6S%%gg7mG1W>y@&SnZP7pB zqB2Vd9(V`g5)bTNWdDKZEfIHlzc;N)VD-zjWx%>vz7H;g4>rN#Hjtmlxn9)>iuF|U zr)wyF9}U=dk#cc7+~yZ${-@hVFU4?apww0b(whPBC2StB+o}Bsrz<>f7VbYxPVV-2 z?{`lZYcRDBh3{kjA*9Ak0F2Z5S|l7zF6cV!zcL);A0JbidQZ00C2LEWY1}nl*&ET z-mZ$mx6Xwx3lyEgH=6RB^$03M`=;uLdA5W`JL8dZSrdmC#V_eY*dxS)yy=JZIvsd7 z@bJB8=*RKBWVpX2zb+nzr0C{^nh|&@4s071*jH{y@<`&ze;NGy|2d%E$HDQ@>nQNA z_Qjpc{?At3Ezj9u|CF9p@ZSvoZ&0MP{{q!7hj#?8yx$r2#_jNC_{;y-fc;sdzli>4 zAqP5FBCP_Yd`Lk<-wl7=nfKEqkh zdA|~EEWRkRV&fG0ixKra3*ptl|HiKd)VvJmFWW!t5y4PH#_Q0oheAIvLqm0@4gQ+G z9#Hcfh$j|&p@moCZ-LZqHP5mga@!zRC;1}xnql8rosY-ku=jM%Gw8XLx1}KBC;%8# z7@jit$@m!dVf%pjKFV-=5iXyp)DB)i?FBGnhYRf-b7|@*QYxMe2&d*7>AxfR$a|Xk zy(8dM@m%a0&rbO7hX46e4(|JzrTi0?LnH#JOo2C!6;#)PXOxd%!-4#z#nZWV;hyAC>mKK8_CdxwJcY?ea&M zQE_phn3KNjKsepI_O35f-f5qpyn6=hRlX?kiR>RBKHaXNVtmjEhrxXto*J(|~6K5BKZC_vMpa&k^_iob_GJqrRkSDXLBZO;u9$ z#dn@lrD#yNi{L+X&*1S&18_g^!%481-}BD)aSiaX!22XTsTb&%$o@jE7qoHYZFTlK zvI0v_lI+?J@O1rWKK3Z%{uutS`AZ(1m@FE=rn52ghCe$P^v6vn>dx$g@Y?$IA8r zExDX~<@5P$$LLiJA0%f2h|C7!uh}!$lh?Y#hXEt7kym+Ni?d#e%jaK- zU&VRXd#szi$}wqG+=Fp=5#jCfd*4Sq|3tNTcZ7FkqSZcfC9;NS`{Pc4K6<@-yjGjg zCf@8Bw#j4NFCG)SMz2{@?e@TC89#i_E z>xZc)O;PkGuxju6A1xPt)SqZM^FPCf(x0XOCH*mDZR$^R6#XfE{73yU^X|X-JET9- z4(N77+XE`c$oQDQwY|_X=I_iK#%m}3?7H6hyUF>pu8*odOp^BKau#_%3Aeh=Xux!0L| znmsK2`?g&LOsqfohsz%=@8T2_6xIJ7YPS(>p@@8L!X8I2{_EbO&d%oZlzj8^&T((e z3(ntB!;?Tv`RqT$R?d-e{BL|8s$6tBLUCF9e`h*E@%!=1|F3hP`$cCx-1O=HUHUjw zJ*TZx^lTD)FqFKK-uvH>Ei#*cy?gtwxazo>cEq$hTJAqGL8O02i)8-+s$H2bpCk{j zH(e^fqxsYF+Q0U9?GXO7{1PL)`XT&jdF@|^_s9_bw0w&ZUfU4z^A^d51?O*#laR`5tql8yHgg+gg_OHX6H-x{Y zU#Rpq{h&SrbEa}ulHQ$!FOTX(?^;sWO>mS|nnK@qlZkEr$%zP#b z&Q_mA`tuU?+bWaKaFDLw#N61ECr&&$Fm~GP1y@!r2xN`R9+!2@@eBCZaW@{9H7+x2 z+%Jw&xMhvI=DI7YX3fTD)qM3?uD@M*Rn?qv<0nixrfSw@);Ruk*_8{%&0a9KqU@Nt zW!AX)b1G(ytE{N9#?8HQF8)@{sjjkS&a9X_`;wWL&Yv@9{+w%OUV5cQs>&7~vBq6?$t5%AR9`ZuvT7z0 zQvsxkxyMz_zUCSg&6%_2&!2Uj#bN93mtQj98b^YZB*X_qS0O$4qmrjMh{8x+Wz~Gp zUUJnHSIoJx%C$`XCm@{}7>@tCA739AWbb_U8NLPhSNM-^e>HLxzC`+O7XQsu(ecoJ z*T~28Py2oe)8TIt|C_{rcZ6r!mzf~HQ{{6KK1noQesA;y`P)Vzj68Ee4rch{fkpc7 z_5^`oKezaA;$PuE=BTg`PLclWy+IbPmwN4M7!mf2Z>IlqfJORmx=+>9ru&q?;j|$; z;xYY~!7b8%^9#y<^9#!V>IlE|)%5=>!~cvH<$p$t@~{4eNzD9PEdF)*)rkKZ@n17c zyC{x8n2NvMfxi_0kkre{?piM=vil7F8~&rqUn9T8mq`CJ#QzNOZ_1m$pEmrLivQ9W z{kIwZ%f)}W_)q^-$5efq;p51lBmQ*_q)|A#(vZZTIC|rFD6NrC7k&`tm4a!0Q1$1V zA5{JWaEpA*^8XhcDNfpdhxqRh|JjkA@!j@HM{Evoz;?m{Uv`&RzzfOg}@)&0XO#hjN z|Lm`v{xhB4L-t$4bOr+dEK^R0f3y~qPm-laf9`|tI_~Tse_oOJpP>Z>H-0it$o51K zYakoz|VyD~VNOv!+rEX`P zxYyF{rxW*C8$H2Dh`)QSVQA;v@OVqNW09V`Xz6wPS=wGZ@nlQeVJAKscC|1P;_qHqHElN|9lh2*mbPb3eBUVe zewMahPWco|+a)JH#tPY+2nVmVzoqR+1dQ|^fP;yuemU_}OV@iRexRl6vlBna()HAd zN1h;6E~KwM>pRC@1#%(n_Mq3L_2g;-@f?ExZt~-RlYE>nh;Nql7XQWZGJF!=^;D3N z#Zp0Vn#h&sGL|2X`)^b~rIUSG)$#;poH0M^T$bWc*ivQ1)xJ7oKc)m06EW!OpI^`z{eyo9?BlwvH zK1=W`4E##L>kORU2^eQ3TB%Zhb$ZtTchiTLgr`gLpU)B^ZLc#A?86Z<4wv-4D|nOO zS%Uvf@S-D~ZO;Mx7zJ|73-~h4|4kQ}Av>{z~Aahrtn3S?)sqYgspGJVD{zg0B#~ zXr#jT7yM~0?{Uh%D)_uOg^M~{Z)*ABPWeua$2;+VYJ8Xz->q?<6Hi2A$?5Vs@t+Fb zB?xFr+f4y=D}3~{Am68x5%#-T!;HyVvvz+(T8g#o+n(Ycuf5%EmQc%BL8cVFEZq5 z{K@%zfXZjBKM!kse`o%`pz(d3_*)tuupi0lGokakp4(|wf>v}9@3wAM*d6@e2L&%f9NhRH~lFS`L2ueIesVe zU(1>coa}b+bJZ>f1YaO{K=1^?YlNq@RPiXSwyb3$?-zOe+ zc~Y%_^yA9~e-yY|x|&&jB<{ae?U!Hl>NUm>#D(+H-;e~n6@}*m;FQlrcTD6Ei%{P5 z{6qMI9#vBUunY8jCwQq(;na_(XXG%&)3jXi{Ged#0FB?N@Y^JwhXN-(f5TEdi6VcB z$m{bY7fZMWz}@m;8uKJuD~wBv6DFEa2Km_OW4 zlVn+MGCsIJ`K9pa^D>%$r|`5&xo3()Ts-B^;Qnd=xLZCP3!KWaTjELfi=Lq1{sV&i zyN&UOyuiRgZ%p?1zYo39(wqe(nArq zY8X$o>ZL!d@p|BH=~^lLO-CyJ$Ay1Q6#18cQ#>=@QSsbYBqHM!2>VN8S*^|O^FyzTD`QKLgCe_zE zRB+3{Glf4hTk&5jJiiqAwSRKv|3r~*EL8HkUwXF4H;cRu_hP}D47^f!UNLxX68U-~ z-1`NuF?d>p=Tn2{4Z(LCc!%JrXE@{kncycG_;%owpRE#Zw&aiQ_v&%0PH#Wt-O4cm z0>l%L{MS7D30`WH%Mrlcczz-Bl_Kw#_?!xy^knL#&UEDqez}29i^6}2$k&U!=D%9- zCc*hG6NG&;a7tIb5&tEE*BJOR!B-pjgMv31__K^3WCg!+>hn6m^>`LP`DqoNX5sM( z{uXe`pXV!rjA*_6faO!IRb50`p1#dNYvIYOE;K`ESQw9Ihz$XZPpWxD5TLpr@V&KJs zmkO@qQv%#AALeTLkEU=;0urCA1P>bcf+#$?96O{OwI2Qo@>GuNZVNKAF2|+Jk8!k7 z?#o5~uZDc1;C%+Z8n|1!nngZvy9#%hWZVYer2m$jXVm)EDR{TUN9)zrDEvCTnR2d2 z^L!`aE^Bb6m+oSud{|@PBhjTJeS1*yS!Z(4@*+{{HcNOCwSMp zisu61KSJ=}dkVis;y+&S$_|C!EB)u`z$t&MPgMTs{$3?;w{%@6Jl2O8~A5}Z!mba3;u@1fAbUflB)@!tWp2&Ejm0-*dmjidx|7%zt z{YgV_moT1c>GSpZqFDEeygpAI(sPm5=c%>)OCsNF@VAS+K0mAFHv@Nz=NG_9Z!`TW zAMTX+>|`F;!@sEdqT@4qv^!5KaN=nmqj>lZe$?yvY)D0=G?k?$~g{?78@b;(MR-z9iJ_NnOp zyaxs3!Rl^~f%_Scw@MFC;m#L(9snL^rCLEbe=x}ZfRqzG_zgO_) zfa1~fHctuutRerB;BO1A^=+fzrH3dU-LLpW@XSLM{x^yLzXbOmrtnP?|J{OrY4FEm z!jS4q!fi@khdV~_BL&y`d?;}4pBwpnBIB?pPpJB(_4zcB?-u)@@gm`$VDMig@~sB{ zWg>r(AzvkUwGscD1;5Y0>xJL?z!}dbk?%f2<--ce&t}2@V1)a+;2#+L?V88H|0;O> zk%~V-^#2Rsr2pNLZ`v+>FY--CDf#~lQxO`52{h{e_7xBRVANwxY;5<`gSF+>vbN>V_a{<^8%4S+K`{i@*}O^OZ`HRjh|}4 zUpMeug=ezCbFbi+82F=t-(=v=3tn@oivIxSkLY<-@CQU*>-pP)zii-t5&SO(zD@96 z1MdM&iaEi|g2^Y;SKh+{%Q=;VG7WrERpJwpiBY2g8KPGt5 z#fs-Mu}jYbr*Ib<`Sym$XU1Za-Yj_LJQe?a#4f!i_-2vUcA#DGUIX7Oc*-)xqvf{)r}8Z{($z2WnIfXu_g~;o2*+=j*4g3(`#FH)ghUFN3GDUu_A%B|SwFZ8s;13yi ziQq3Acm?pdh<$6iU-3KOZsUuWSpFa@|0`#^|7sNZ4ZukcgCD4J>=FC(X%zW?F+cX1 z3@hODmrFi;BY3N<&uaXKC_H1aeqHV_0H^#6N`9`E zbiEaY=R@In|69eQ?aya|e`Vlb3qGt{$>S$KyYa;>p2M-UK;`(m@0|R49{5iNzOTq{ z6+zX{4@yOEjSqYd4};+OW!Y$Ao!btTXMc$r}q=V^|@y)zn$>|Eq(r3<8cSM z=T9&yXC3yYVTtD&IiM zk6JGtX$1tY5&M}Lh39nP={i*L1cc{&!CMXd8o_G>*X6iO@SuS|A$ZeaieKyb8-iOR ze~5(pSHW8kQSut!DR_XJgL(An%J3xfRp}r9j?MH7yhFKFE#M- zz}@)I6nX1-C(j(ggBebIf#8)QkM0>i%LT8=RPq6_KaUIEbgaU4`_(FV*D(sm+e`TQ zM9Uwia6QiYPViRYS*ygYBp7hYhi2iyFqWSq1#c8QN$}GJuMr&8il6C%2L;a(yi#z# z!Cxo1CAik}rvz`6d zK;=(B?j3*_Kgohyf0qz!`FMv}$t^AX!r%KwgzKK}GIqxy$G zmyFYPGTX3|OTgon|9XE>gOQ(iOSq5C$zx`npAQP&X5ddp;eQ!8*_lo`hca5?*%?J% zr_1`CN>_=ZO115V?kj#r%h>Z3%yOysp)JuynSL6QF?c@pQ0Zm-W0{Cfj00Z#efF?uS?>;B}m zQTS_x=N&n>qV430DDn@8{LiYL@p)YElMTE@@M(f;{x_rWzc2FBZ*cN|D)`j~zD@8t z!8QM`DEu~X%Aep4rEhvX6@Qq*>oZlpX?zrLH+?t&IF)@Fu~%f@cZd zEV#C}69jJ+e2d8EYx$cL{|ADfD|mg4!haC_0*&9S@J9qM15W9EO42n_@Ed`wm$p=MV=YNxdzZQjOqr@k0tBTAe5CdBU#Rrz{68GH zTmEaFbq3F|!sE$u@=O_mr_JD*HiUe;AwNsPJzm1q{lgog@M!rOk=OI0w?&a(0i5bl z$1AE_bbnH}3#HO7Xgz7-_+TFRGiQJAcY^y3{P%(f1uqqSdriU(ZcyQV8mAoI6?seK zeIoyN!J7VaJ%R@f z{4v2hjPiX}aK9n{d%-OOZxuY#z~2_U)!^?CyxG7%5xmR5w+P;C;NLPn(mGr2_0shs z;Rt1)DD_KZwnsSqwu$V%3)tj5K*|T!lU~G0l}LM{1<|E2|hyjCjh7N z>W-Vt$V}m%C3sQ1!e1PwJj@3kXN|F%W&T{ZJ2i}B9AxP2og%;1kiSpxRs(-f@Fu}^ zx}F72@$@H6=7`X~G7X#;8ZTbYL(A)UYDNT z!e4WqijU6EeKF7`J75W3t;DUL0(VQ-ks|Lu-^mjcynBYiv0Tp2`GR){uFH3R6#g4U zK3Dj4`Q8^r{$b#h-cq^8Tc78BR(QHDRPoW{ray^%_X?FizY#s$B=UI|DESc*|L+Aq zQE(lfq@&&Q=K$aopZfb1|M5~Ujs#BmTzawM*LG<<8l{5Y-~zdWDh?ihQl$)|Cp^f1;A7 z`w{3_FY%~ANj6!~(I*Y?mmPSvj_!LbdPpM!zBmCKR9soXn$s^X*1 zr({QwpCJ5+Eh5dI6J$d?O$_gKY0UF^~V;prBhQNpua@TTV#zt-C)qVTt{Job%C zxkz?e>jbYf@OK5TH_GuN!D|eBv*1kz&p!q4Fyy}x-0E`b$@hY{8uGgYUup3FNAPAt z-gm6h!!AR9ByhL#-5)rW@0+Kq{MYqv3lxU%&kX!fk?$2;*SpLp{3naNU+$x>mU5gF zMgDA&?-F_4u3a2O{xZ!k_gm}!=lm%0i$uO&PxmI! zGgolyBE@r;7}o0rZF@~SnDmp{S^vt z6?}`}9fEHa+!nm`3MD^V`cWyzseEg?THyj)M*w##FP+b&*D86P&!-4av*5a(o-KHX z;O|R(N_Dsk70+XWUnO`^wZbnG{1(Am1<#O(J|cMcbxMAu;4cVn-Jo#YKE5M(rQmhK z|1T}SNXhH{t9^nu|4QM{i2N9Aq#?a6y;0%wCEQ~L@489hGX>8UJb1IhPa3X>CIP2% zFE{Gfbiqpve75k^ELA)@T{j5cE%+)?p!Fm|;4=?zgud8&&+7h)Z~7iB;nj>!2k3=U5TxWo^s_|q%{O_U?XimQw8?u` z2T1R~7q>=w|9!0&DZb+-?{U3W@lD?cdpq!XP2S6TKl%9YkNx?Z@OcsV4v2T$-@Qn& z$NvO=pxEsfmnd>5@p&Bq-s*+CBI}_of>yp^Bhzb+-8an^x6Cqs>& z8yx;!vv`XQ4n9x*6H}I_b@}bvfbWKWjeoUKK3^f9^2d#SBm4Ux@tH5Bl(X|I9wpwg z()9mfKKIweXOFe^+)Dh9#1nJI=OwoPRp2{_Kfrx7x4z6nM|Ru{buSaf|DUAa5x9)Y z+;5jF=RJtO6Zl?;-&=XU*p15p!Uy#IXIp!2VtWp8d>%4BMdC|IKQYhb|r2jDSvw@2qPCVVn=RDH)9c=xQ_b1BF^@5|nb0x!fHaNJQ^pk_u&TnsT z7k&bKFUW1yJ8%0e>D}M&bL-t}z(vmE&zs)zvBCUKlh5=P#{Xwr_ZK*vdez7F>`lCX z%;b3@@ebfJF6C!aid2X%2aYX+O@2NIT;FN zOX63MzK`?H(SL&Y^xsXNKTi4^ln?Ufj89?S_2=`%C*Nvv_$TFXkKh=WS&oa-tM5Dd zhfNNzlh4z{=RRrAy^Z)^fQx)4UpCzFd6o1NjA!3R`ZtKToZG9&mDKayU_eBlTedO1 zI-2zR0~h|&*O=U%-NG&;NI%YeQ48sp0^b4iWy(9py^8d$hnbuoBmIYn2Yo3;j@-pA z6oHE#`tx^;^i%&a`m>EZxB|F5x0UtnP7gm1T;=20&#w^gyUzG*O+Mdo^e>q_ojv~{ zaFNe!?^2~)NVz>tJTYwJRol`Sy+SopZJxv=Wf!!0bJ~W`}^;=5Z}Is`1{O0MC&r}R?@_OrGQI2XC6r@d^Il~16=fB z{BnEl<;2$!pS#P(oG<-Me!`Y;7dBNtF^*RVHB|d$m*^M45^lilZereBj z{`oz`gR6~?d+v{cOZz80`|ud?@lV+kOgM3=3|L3#)&jA-ZKlO)3|KxQ?f4{ZI z*_q7`p`Lqw!nO|QIj`%;e|O;0&Q#vy^Wr?au#kA`ZPv~^NPh_VjK9xX{vz>J#An#A zR?7J};(f!${~6MsO1$Omlr!lw#HZewQcCBClz@w$)BmjTv0mf7_oVM1H9r5^!X9u9 zaFN@@3ypHS)A4`B`gJSYb06`EBDd@AZ@-yKZh5mJ%=DW6yQ#>~X+l91}cW>DJ9t zfbW3)^ou{!D2Mf=A3xPRpM&|_GnF3xv-dvvj{}$X&m3fO{wCY=dE!%9Ti5*wGeY{K9RCrc{{i)_-|?Y;wGa6W0oQfe)1UK5 zKY6F=+X-*A8?GaLpGW@<;4Sz&6l?~$2f;6ZOTT8mVeLGYSAI);?(-={9wPon;3A*d z3k-jX_~wThpVkYODDopds0Fytr(QSu?MS~H@fPaaJBaT^ywB6agMo`27SK=FiuC_O zeBA5rNs7b2_3U1Oc;L|;u21|Q>ccI{2k(QTe!6w`JESj9 zq?F#t=Rx8#4;$|IKMq{v-+#N=lWRGze@*&{qT%n~QrQJB5ubX_+Vf+BgV%xY0tvP9 zJDVB2LH^V9_jcsXH zT&l=?_G=aKsog1O;-?Z1zRmf|_GE##l4tzaMWj#NYwbUCbGv%A;9@^VjQ=&f>1N{n z+gp1+`A)m=%{SryGxDF=Vu=!dm3)3jyyc7b+?^@t=ZR0#Za97TCvfp+{+H*ooc{0d zev^OeZ7Y?tqklK?8T!3gruFAQ;5tvgV$YqKXL!5AKW1{H83+yqF7suU_4AH@FZuUf zZhX4P|5(zeK4*4*mUx=#kkAd_L)Ce_?jX;S#H}F<|j{ka?{8Jyc@m+V2UHy&Yf3nHh#S1Txes0p{(Z|@a{}P`W zZ*2cADbAO_ncRNOhwlYk#y8c|=$9T!`hMC0H{X{MpS#fX>cqf)jw3!j-|+1?FNzL- z7e3(U9Q_~fi%vC{!)JiYxXj82{IrnIm+*BzMH>J64sfvpzTQ3xT>PKsnICZNf0p!p z>+u0UEzPet;|H+12BSPx8D5)g;IOmv;Jjh7###_cVL5Gx=;F-v4RSA6Ne@ zuN6``oR1IqdD$Kte3JNVuhIX8`gSjHk@LOYI`t6ol$U>gihL5+njUT>|5u2&{KfR# z*_q9jS{|&$%Y*FzT-rJHN253EfgF|Ku%F{zexnDt*pr7Q%|1ANSV2DJvr^iUAznD% z;Y;uVKRMdT58$iFd5(EP=VuNA7yo>ce>eA3y(!_5Eu94E=QfJ-}5$KV5g>}n7^MEdD3q!ho9 z&wY$|`QL`i-!+t<=ZMcRABZ%L{=7`QmHxl;yXIjaWLy#_SiinT`gb{;`>h`!zAy1U z>Y*E#E{D&z{vJpAqlu?JV*2wq+j)}1Z#MepiLVE)^Md|{v!5fR@BgmRe~A1qB0l}w zlp-6*=hMJN&!?&9^GScZ<1=maAKlC@e1~`+;~lrIJwkkf>)rdv=MREIZ(9z6VDWPT z^HKin0(y0>_>d^n>H>VR&GJ?KH}qlGyZ!K zUjba6JH09nJ{^w9WClH@|$oOBfxiRVou6fZnY<*ck`Wor`UPDLlvkwJy z32=GtxaYr3IQ}0`DgBZ9e-PY6e0tiR>+)A$B3@=4dye#X5% z3FH4FFTOy0_Q8}QPH$fWF72P-yu(-h*%A{__)MI;M897`dG1Wy{T*(nCwl*fgglO!AwKu1lyY|Y zQgMT&{Zq^fxpnhu;5xqEJeBmO>LKMbKs~&J`1r2If0)nx2Kme|E^zVJ{iH8HX5*OQ zxIadG`t8Q&0Bvm${08`5@H4v)Fg>K0gXhTK-xqj;d}hzb2mCxhK5xV0#Gds3-SjO* zd{4!94Ic93*#TVon_@lfwxmCt_}qo~fS=2VpQ3!W4gzogbcFPiKQ;Pi*k8F_`1k+7 z^vC4^J_Wp$JmbIa0xsh|A@EkEZ2WJ9Rf1T}olK3p=i;Exs zK-}L?oFo5f`U6fruMscPK0Evk;H~US{FnSWSM9I2UdZc%1fP2_rR4ABO-bM~j;UG0 z7g3*=lYaI&>(`q3cEf7Yw|a5Y2S`7Dlksu;M;X%l`N`9P%l_j@KeKgeD`Ov=0bK0H z6Q13;f_%zczg(W=Cg9EV^Bbi1^L5_?-h%#qbqhD*_TZnBesXK;FU?-?2jXSVe~{OS zs6DyS`n!zdF0Ty{yp{R7)7YIXeyR2AKGLU1@9W_aj=z`pJ_fkdhxqaDsiYt0dqIyU|1|MQFD^R`xU^^L9_!ai z%I93-GriW%?Y1>WSCfzL|J*?OS;kpQ`P}~nE^_Ge7OD#+if_$ z>d!y$LE71JQA)qxPJR22(xd*L?-#;$u>S0Hl+jPKKF7_?y@?qgEn3j;-3aC`d^lS7e7~$(HBTRH)?#|%XxGs@fit7@iR+%`v~z}X=hx%nGgOiB&ai98Z${`0_fZAB>gz+ z9-q=t2!ekQ??2Gme?IY+V{9Dzk23svwzHM^1johM&!pg3cjj2HvIqIB1TOvZ^FOBm z7ysOkUy8t+#Wfq09(6>XeqI1v?8c1Oo=*^;-F~IEBC$fuR-)Xuy(M||!^n|Hsbd|o3yO@C|$(r??xb|zAa+(>*s;36MCzmxzje#^91 zzqf*XCK->QJV1XwNIv~uJwO(COR#Nl63-iwJUD}V{JiUhz-8U(|C7yMlU@*f9JtKW z4PJfV6!}a)l2X+eIrTS*iD^)zsiL#k%ab^7@-`Lt|ra=wx`{fqb% z_c2?DzYU2C;WOdwKfVLF=t<&t#^>pIcEkRHLvJT9H$UfW@>x#$x%*R!xO#x&i2MHe z0C0J(zy20UKg)F|P5vJt{RG?Z;?PSR{|kGS^1h4hh8u~`?3YpiU-jop9;%k@DTCTKTJMfrhJ|tKK(6QHz$bygLq%o+Ia%ov(=jB>CqA*p338~58t zKk=-so9^!b-s^BLFZx~JVy{v^EGTE^H_nhg!Sh)h-r)a8|C;B&{h9RBtY@Z~5B@_u z=v%J*mvFrHfI`Z?m4CkAJ-}sL{Q8yz@K*Lc{_8N{GAsyeELGe-8gQBz(?xPCcHYdZGfxX{$unz z=u?7VPvVo?+IY#|$(EmkiTm}0?ShLxQ?+^YT_X>cl75coC|ilICjBJqOm-ul1+M#~ zth;dfQz4)Jv#dS0Qh%-@o_NXh{4iGXArQe+&`wVekPyPaY7kCzKp1a@ku@H#-{XAF;aA{}j4~+jR3gX?w{d$0d z$!EHIrMBmLt@9@FCI%Ufi80J~?Q7e#d$DVdB1?Tu8i+`z8tUzYMs@^WK}y zo;!WJ3b^VOY zb<(%&VSIkf@!j?$)6Z#+;}GTfF5vRq$(vK!9Je36pVA{Q;l(>C(vP2K{C6V%6G(rp z=jW^=ecvuNUp~uDj}V{n>c`F@UVh!?-2yJa7b^b+!Sh~S<;Q@FUo^|}S#DgeS9QtCT;%Ng+ac*&t0|>>ka8{)pJ_3BH32_Qe$FO7 zd5z&$7#w_3aOmyKcT8?2;&%d<=T6^c^q(XDuai&T$5Kk^>c<`??)zQ81}=7Q(wldG zCH*+htM1R|&O5caJa+;v@}Ffse1!Dx1TO8Iect>HH;)c>^gNgPUeX^%+&@p(>+oS4 z-)BgFEO4EVKQsJL;wJ-F{pUGNOi%skC!f@lDgC|~<+g!%nfqwQ4dQS zd5kIMG4NG??jWD(Ri;-b%rpFl#QXnfw?A?UaG6Kb+?Ti2 zAqYlD@7H^uLp<@K>B-TQ+sA;*IQr**ZvfuR4&Mq~o;&%t+4);2&j-kVDq;9K;=d+7 z!}!Zq{~(wn-ZEq3CGXXepZ^d~e97=X8XRo@L6h_3U8Xtqe-JDHE_QN=>nzy>2arB^ zhe>7|@_9e;)F)DkI6Jf2;U$w#<{fs!sg4ipMx5U`2wddmpDP?CeLv5oeu&TgFzGk( zmw>C^yPw&^A<|z)KC{=G9NhTcsPxDyKH2C;-AelDubO0@BA>f~OFPT=7@zBie~Y+( zPUn~8(>h{&zC?jONBX%}jgPe!<4F2(FAp#e9hZ6GpL5&^xagICZhAN1B8S#rHtJOe z`6QMZ{tve2FyO81OZ?XL}&2Z5`-^6Jehz$Fgiau&rymymvndH5gE4qO3z zzxV_B`3u0MzkZ(ccH+U+DWyD`4$Aj{OMio9l;jr1=t-f+dNjrNqO4_q|LXW~U-j*L z?i;{Go_@afZ6WpQHj6tZNWV95Y3B^rg)ND9JN#m^d+Yez!-1>*{Ma;bPtqR?T;^Si z=O3Qp_hT^0F8im!zBYfm+0Lhd%Q*V)-}oEx@%EHHF~jH1!v~?C@XmL) z0GEE1y}ZP`iO;c}d~A>)pTvR2e_!%H47kX7#)~^vJKT%EP9PtDz7LUpl5y6auhMsKTF5ZnyBmG{Pf-9!4BZI&rKdXQcH0dVP;@BchP+|NJ! zf_z$;H(SexJPTapyuT;UInqzvVJ&=#^z*Vp5C7*58}|<4+X9#N`15fm;HnQN8=r6N zWH-Erc;7`!6!;7Iw3E*i_gQWwei-Tf_oy5RyqO-J2weJgu-C64^68U<0QmVT6M1J7 zpT5uRhO^t}0hfOH@!Cg8KXIke|8<@<^jhMHzo!&9kNBkESQq+Pw@@+i;C|Bg?QZh9 zhx9YVeLwBjj(?}|{~z*s0l19I{KYmdn-PD7^sO%&y_*+r$=SF}bsPSnZR~~}iO+g< zybFm>GJn--b3UKu|eqwgm#pw?cKbH6wF4Hd9D$1*CSSF6#O?}$BI*0-SGazi z2fS4|H~x36&|_Ytcn;`vUjDMuF9^oD&+G2`Ci%~PdAUMoy~VElgnayc!&%b%`wlM< zFZ0|D({I6lfQx=kdHL<_)|vc$`@bu2(I5YuavN~rbFs(g2-5rSu~|$0GoMRohu&x1 z3f2*yTzt49udu&ol8=9G{UgBTxe3}mC;zJyhu!wZ>kGg|{$C z`*s6y|NS0cA%FjT(0z{n!IU<{y!F?whiL(>>$tbSznkFDpBcVi&egT#9IzG`?eqP z4Dr-wY`)({{2bt7f0i@uWAlTnflHjy$9l+>`jjB}oYEr?;LXRoiQhs$b3W-GCjZok zt*6f~whNB~7df;r-}QacKkM+@t(`w$gZ@Ii|GJb?E@t~*2QK?Hu6c_*Ihh9{(Y>Qa(R+x9DlDa=q2D{SFiQ-P+u7f} zi2LugSO{Fk@meo0u>`ot!QVeUQt7dNd3o1U$iGhxXya#dCKB_cpYYOz zUR**xiTjL?iwmw79Qv7}e(uA5-Aj6ZT)qcf+V9un{m9X?PVAH9^9RMZ4Ep%qMbj3% z!xhbw`Pk2V?**ja2Dr$rOu4!Czf*DOx%Xa_cHpX497m`Bhmikxw>|N2>T@q~zfOA% z@zlA8YfGMBdve5EZcHgsB|ZvVo;%Lx(#!;Bk$&Mcl+N_~QFXIg-3d%XJOJ%k?PGR?f1 z8<%}a@7EVCB0k6W!0bW;cNp@wd#+=`#isT9vmu> zbAtJQXHVWryw%&sTtIy41>^r&c6uM;6Yn+654nDI5}*8r^=pvyy}+ekeq3`T>1X#f zJ};9#Lwx)q;{$clpN-_>=T9zixVOJ{o$$fYowp{&SRcKeEcWY z&RyA_kCIQB`5C8gSCKxoM@pagP3q50j*s_Vh}(e6x*yCtQt9_$JHIXTGQO;be4O}W zz-9N#&l^8U{{A_^-z$H-|B&{7fAX0led6+zB8xV+3$GEMVx9!cy8dimmgnvk3^89p zICwj79rxXAyuLyC>_NQ6tE)c{xQy2n^MqTIzKitZf3W$oyBl}nlYFnHTi1>u-ba7F zg$+sr7d>yKe>+5c6ga1dYr6ivoP7Lx$m@yw^XpFF(*BvZnVxS+Zub!P_2)an2jl4P z^FB=e6JNCcy8OvAe=Wa|K7f46-u})C;H~U?{MX6kQ}*^BbHx4ky;q6*=V;C)?!SlRD&l?LU#X96 z;lsa3JmL8*cLEoE82A3(*}bGM?``sblze{b`0zbu&c6MgxL>FA67g2A9`aS-BLCTM zn1z3y{I{x@{3rQ7fy;>R3|!io^76EMk$!yM5~bXV^oxm4v(En$#Fqfqe3uvZ9ZUKI z_i=6{eLwN38rLK0!|A}KJuAI+|4iU&Z&?TE-jjBL((jD-o>_nAlmAtUV_%Z*&v`fT zFA@)uX7^@@e+{_k=M47;cOd=);t8JjKbZKV#LKs*6q%-?{|>mc(?7rPC*abrKCfT@ zCZF+_jn6^kzY82xX-{it`gQ~5(@MO2mC^4+`h5k*e4pU^yZVT?1DCqZ8Si}A`^jhG zc#9(*-`;LG33w~-jsL2Verk#7t=kv-ByqoP;SS;nFJEyFaep6S8o0#cE??vH?N`8? zwdXJ7H?GJN6Dv3e2(_v5Vq$+;xnvYb>n!Q^2d9M=npu%^hL!{cft7g67v5# zaJ3trzD<*VAL|X=KEl)Fvx@mQPT%0qisL;Po}Kv@`S|Z`-fYz5pW^xGJ=mV@h$nb1 z=>+0?5})8Y>+ID+;=x5JrF8zuV&Z*w8h#%6EGItc#iu7Ze0!6><3C7zwr{C&IC)27 zGy+`oaGd#SC+G7?@4r9cQl&@o#q&#V6nf0ZDax7dbMR&I@$0uAAl~|-wR0=#!wm7h z?X8_oAD$r|@I7@7e+9UVyZ`?7d1Ka|1ns%40zt4naOv-f+~;zB!hwoozr!2%PQ~H3 zdw$gM!XM9_SZL$2n09QP;E+Qr_aolJ@j8d}b6;Dc$X!nVfver{_V2DB?(au`9Jti+ z&Ux**jr?2gGk@U2eD1x(rzQ+{^X>=4XT0~QJnnGMPyQ`%X{Y~Q?&nB9{%MoLm3;22 z#1sED{C?tZ5D%`f^~Ig%+HZsL_w$Vlfy;QMyuTN-QgNL7@W$(S;5sf|z4V8O`|l^o z1DEy7uL~-Z{$wvNaRKo;<^g`eeqBdC{(JIoA-!K${1xD0S6}nm|2@*rvd)ug70eL# z>m{B9-pV$_f4vA?#>;=-#b3#1n)c@s#v}h09C};!@=iN#G`?D;;5Bd+nz9Vdaevd!^dy};Ek;yH*rcyTRp|9sqO z#3yKf=Chq=2@buQ`N9(Aa4QG+GRMdJ`%~8t_uqSVJMjeT+*0Ve{Cpd@$j$$I1P_tk zkM|#Q_*rHTFEuv7OXTC9H+&7a=8C9t?w>`vu3i&$3>~t+T%+efbHaFR`6}11@p*5d8`#=N++-$^0sN zc5)x!I$yZYcs==a5cl`HmjYLPeyi!B%Wt0~INCW)zlG*7D3Xu=zVWk2-|F@2F@dMubZb2l0MkW{Pv3}&&P>R-)!Tx1s%H=i2M5~e+Mq| z@$;qsBK<7i6ZHU4Q4+0lIC%DD(5>6k6f$zs>#eaR2eEh%rb2ahQN|W1}v`e=U_v5U) zfJ-}r&)Rcm`H%;Q`+nEsjz9lC@25!rl;i($N)hLWza}{Jt&jfU?xf%GY?JdGlhU0vA2;D zeC-IOw7Y`fuZm;6qrOd$&ufm)cg?QuK*inp9Fv2;5Bo0QqW=ljKc7fG3rX+KyC5@^ z%d8Ivv(-fiA_(wX(ON;;DZ)5UB!oGw>`FjR`+ zT(z2Bms^x66|1#!rBueP>+oeX%nsnj!AdR{W^(SJn%=c*PYzccfAq4o ztByH33>Wouw=WLrG-0MRj5g#zYm6$nLM~m+h1FWFY^_Va2_O7XRDIxZDLYcgRnY`~ z&kYCbi>0w*tSQxCFps{}pBt2l89a1#SSUd-9c?{}<;zIXzP2aZ<6k?HJq=&G67jE{ zi4OT{cXr}WCB_(ab+n=Nxx!#r&DBCmu{ts!4X>ch=hJshRkb^|4 zwMxDmR14|qP_|TC)YIPH7Gz4X>jSS19KyVQDm187!2>f_0VBNI5Ky3=iZgL6}c=7x^WuPS!OAnw2$z*3w8+wr|CqjX%K)R9;Uy~-|3jUs<&~`+$J&8n6 z94QnOPDXH7M^cft7-ElUPsgBkk6RZ8NBFl7#E3BPb&+TrqtQ&Z_4LF?KG~jZ>j+Gy z;b0kJ9l}%zv-x%T+M;B8TTcQaAB$w}l%lJ%J0_wY=vIS-x{}@6s+fcz#6~%Eby@df zBIq<(#YBL|XzyYo=(GA8wAyf(DZt`ZF%LI^!Z2G3*A+?w=|Y&Tl`7RRJ+c9_e7Ic5)pFTI zFex%*O^8AfW0lQ3`zs1t}D?%C4 z*f0aWQM?6_U7;%YiOTwRw*i-e3rR}$-&TifDGBxVLEut-4#(lQA8J6g?kxiM%k zU&sYTcoD&HdV~CuHLbWVtd`Zoz*b5F0HOu}ciAvR?dV+G$!CZ5gmStzgh5VpH#86{ zrHwKgSIj{HHqTqKnH)t0tLRd-Szw){g$~yECKj{+3 zhb$EKqF1Bo3jW7j57GlA(_zXFP6RY{oi3(SB`hdWw~~w7g5j#&qQAqjd~FD(gKkhF zDC1_;v96wEGAIwhVk)!<-xEP*Lpnq!Hee~jyx}w3;(kmL%Sy8e)!hb_5}T06Y#7{7 zU%#47J}7iokS`6wo>j#|aZiFb<~}A(XuW=n%6rJz^Z-Zs-%xL#z?vfrZ1OC2BHX5!*xK4)$06QyL5xvmee4p3p_(2=j8dwE5|H3_ zb3D~oR+}phv^oe`SRvdlt_D0)L@Q`*#20f8hP*yhU5iyP^0=_OO+7RF3}2~E)zc9- zCOsxTrAsDy;_h4$j*#4E*OHCb+S*k~^jdp2{3}P;-UHKIe_DG_cU)&X5?yuDj$}u@ zksWPtKTgo;2Xrl+z)KTPz+co5^RkPtyOIEKwW?6mk65x<8!h^~c>jq(Ql6+x>p|tBw zeaT;ZT-DiziyHOmB~^9fXLrMI%8XR1dCY(eJiB^JX-Lr4He;wWKyM9eL%Qw?Tg;89 zy>Q)QijZ8~5x{k6%M6Va*PAaFAYMa%*;aF(bj=*f!7O2sT~~ygAYY`<>0r2$!~Dm+ z;DGxEM_@rhM0N?pB*Ws6LN53U4Xn2z(bdq1Hq5q2`t?4=+X;WY;VTR&f&@4Z!_HM? zgLT1zuNRmUV7uCkqCSa|-4Z89Yf7>kp&Gv0r0s?|Eb6^tPlhFyOLTQEb{HhFp%&Ik zqF8dp46EMSmVjZfr%GhwIJUKQ*Qab-TTjF4)Sl=J=<;rfa9bqxLeWT~rUWNlyqnlSwZr-#1kw>#mstWLGptAq z)J7@;;lRdN*pCQAw0mP%9fI$+UR7Zc5;<`L)6vxlc}L2SP}ec~nrt(Z#-U!^Eej?G zpfe#6N;Ei~vSjMiuzp2kZ4J-sT%3##Y3E|N1~Dex;&#*@pAZ+pb-5(LTcovZvi{e< z!aI(nr*d`A7xj)m5#J?iq)ag%WR}GFw0D9JagI>L2_90s$4M+A5T$U!^pd5lff1%J zVV@6zf%v+SY}0N!y>3f%$9X*Wm5odqYMH z-$ln`GK?v0vaP!zNRjXL*#UPFes6u;;1Rdu>Tn*3$4IEIL+x#lX`EI9!T5LNB;w6T zno8I#Z|{;YI?}Radza)h>TOP%XKKV9$wY&>>PRB-6}!2kLwwxW%{?(&)6vxtpQg!< zE;KVTcH(GTVzVottry!t*~@AGMaV}Z9sy1qnlDijw8vVzxYN9EPOjwQo`$Z$VTrY_ z(-T@}hxp6&u0T%GQ{&v()!?TjJG^(`iX2zr?&3uopZj1^jqA;#G8D!WI)T+63B_lBr!g+B7azPDQU${CO=^5mN z6*?x#5Al9PPpL-VH7f-F7f;GSVh|x7(&oB{C{b^Fvu?H}yV%WYUQ)1cLWi9Wc>GNphYVfw z;l-jN8rrNwiB4I5nqFBf+XqdrbjdbV(<|NBAZdQ33$vp66%9$7a_d26EsqplRYpsl zwPs{+jb-)SRIA0?d6RC#Cuu%KFv60gXv(eq%{qq^+MBhYLs!IRZR=FGwds|Fn>cD1 zp$NK(Nc~ofE>kY+W`^uhm>t!0FyXAM7Pcqp_B)ZzcUzrs#4r^k6&u9R>JZ{jm|xot zH7naxAU)lZfoLKrEc@6I%GEH=0n=IGwFOV*s+gx68M#~ruiaQw}TO&`;@ zq_1~P6Z~lG`ZR%;EML9`%$i(T+q=5AZzbB$VQW;~2NIfg-6X}qLNlT2G85$H@-+W*+KyEf-JxJ0m zTbPkC#RDx_j_spC?9|B?w1?CN3UvgYSOW#V%k^aohmjx04$np~ES8Y|8%^g6vR{l{ zuOc?3tB7F3io~pVaH$}ujOLV=@8?G34jj#vhuOQMyCuFKMR^1!gWAvM>H zbq#xe3+u^sIxr1^AToXQat6yoxeeN>CYA{q?u2rKDasG#vA)s&8^9Ky7;&p;tv#1``z zxk?FkN%jwr&Ib-_n=4|gQ(|3wP8SeeRKsFPv`_%a&lGaSb+sY+mM_Zx@bZT8gEjex zy*v3uiZ_u1O^2_G?+8hX2=e(wwsEUN(N}YK^QAF1e=JI;M;Y-kONpCj zg>+jts`KCi79hp(D}- z`C7Cq@Dqg~sMMhF7VuklQ5YlfCA(@%?O^j7m7Wesfi)9C7ji=Agp}|hPE8M^6o-?n zR$7lnG`$IVSva``%opWS^y`!Bo?&k^V&tuT4;i0WKqvzZ25s7K1fckSw~T9C`^aO zWcc5VtLz|v$mPLABe2}SUdrkL*BsL^lYBbqk=X;g7D zH0p21+6oR@Jw5E)ElGs4Q-Lff(o1x(d$RIrXRNXinVn|VU zi()Og1i(IMv!&F|1XtgPjCu{G*yI$RsBc)*BU@T96j)Sr#l}Y&nc;HLIU7y8ooquI zA7!MlHezwGjWtq%p@TyzC7;43QbyMY($D794#<5{`6pu~IV$u*h(qMD#WQcxXOsi$ zl8U+tvTsI}Oms-Xv&sFY#%O`=Nr*&V*~y`D(6rLnc=iKRoP%a^zr)d38mplF4QHh1c|fXcDx$ z{!Dkna#=A~N_|FMSPKWUxrN!hI34(em`}q*cnU6i$7)&}GSCtU`zjx$fDc&-2oCns z-KF^i6Mq9_6@CL~zij4&85H40@u;BY`87Jc(jM8Yg}3i$qgKiGPrBkUrZy#vZ%Wo0n~6>7U4zRU9hb6 z=4J-8P|j8hxDFhORkD*&%k>RqE6Xqt62D?%iuM4pl2|D#$jZZ^0tp0R*fG>kQs~k^ z$kOI;7z(^W_g&!MTO%=Fr0Upx;gHITsV&@OP(oI4_a41mE1sl&+kMVS%b+$GQOPY8 z(qX=gcrRBJS6u93R6{L5oxt4^BXN+_S>R&^@*a#e=vcxC9c7u5UAJ{ zTcchby3342Y~-|t4P|jsQKA}@DUXDMxis7}Omx(^VK4nOHjg1is6mHzL{k{-h4eW# zs*MTlm@*-^hPV-`P_b26?h`KxYmXJ0V-3#K3W3(}LRlafD?ySC_^`2gap8axPH2cd zIqdk26v86PLZNqJJVoYX*%I`kl#z-7Fj|L$36Laq+w}w17CVW-N#GKvdaIU-;#QRG zSBDu_tnYnwEx|a|5=g+7;#*c z>7w=rMKPL-!cq{gzrZRk(?%yBRuIIGuoh>8;sR82!d@8Qn@l;`Q;h2p*Y4(cEj*njRhb$gZwIEsF$Om2gcC8ivD;Xt?%RIS;4TtNRLP)f{5og^KIE zTYJzR6b#kdK0KmlTHKLN^>@WH5H%^vHi0M(jf1nxfZ*C|hAff|_&Ok(SCoq6cy)V6 zn`+CFqye4w+9sro2>$78#bYCz5JoFGly@}Ez<_Lc8&_}DUKQ;#|TIlar~CikpL_yAo|iLP%WJ>BVaz74lZUDn2%{ z{bKVFu{xS720|1Do1)l{FQs**ki=wBPZ3L21Wm)93b$Tly+Kn1bOx_7COWGP5K`8g z;Ul_^tRw813dfn4!Tbhie^B)1dwq@D)^5O}{UfYu&h=Remr885*b6AKtmrUU&`zvB zQr;T1PY#e~5X8zZ7DS=$4A(5%05b;YYF)9_Yr!2_&Y)Wex{YFX%snbSiYNloguTO2 zM%~m3q{nofYiG!fU_KU|n3m_ag-Ntm+yZgW{mCok#af9yTGd@tkVKw~Ha}XMr5`dH z;;G0lp7O#C-oT7iWPF4Xw)-@32?@31JEUe=FMKxTWA@upj576x;07bSgJpp=#7>i* z^wyMMx+c@c*%YnBphGJM4+_EQ8q%UMrD}ddtSDEMQO<4I;T=Stb`%6A&#m6ru7!^2 z`mMvjG82RZk@HBs5ME4FHqLj}U$BSqab-uX7)KBP%QLv)0V62$7Hr`b+6hw;4R?_7 zQBooJg*gPR#sPDsb!Iv`mZj>hyE9Tvf$)QdSwkpkvsrmD`7(0m@QO4!jpdoLXvYj6 zAX#vo$E#Nxmd6e(5Os$MjLIl~khN1MJH8`T4{_+xYAe`5L#j9`n88^=^cC%pf;drE zU2Zhjh>0s*)`gz20(1u3P;ROfOGWiVqDgspuC{E&65J*S3bi;`Et?sBwK%fMOQeS2 z3vmciQy`8pZIGyQKXnQeYy&+E*B-UZ#o8D;T^wwM1Sg9|2j#e!`XibtQ=WGCuYo<9 zpa*_L5+kVPt%;vy`id`Dwsk~sutIbdYcQ0O5`-{8YUy$}SR%pt#DRsbU_h#J0MPj$ zGW1eHfLm>R)fu#cEt`wtwTnJ7@NwP3jnTBX1fmpdU{GywmkK-Wm>mzSTN_(`A#h#Y z@mM^i+2A$eV%FdU>cG_%4K=0eyn>5{Aqc)pX8Q=JG(`Ton-JDZa#>1%8waGM0KaL` ztU+RT;Uvn=ryK^CZb7Z0%|~bE#Ceri)WTUFSrr6XEo@`EU1s4P^|#R|G}KFJ8{jU} zKb4`ubQF&nfuX7nWQBzpi7sJjb3hIe;aj#Kqua1@IUB%GRmKpzdC&*wgq*`N2Dlfp z%cGo0JX=TGToGcFv8lcC6;?JNJT&l3Ei_506b)ypv#Ym>wA=gF! zhh+Z&Luoz2Jm18>6w_ob6HH5?QqnzeT}&|HAb7h|4uDG{4%&Y@J^ zREKapg)e>Jbi)0jYa0A(=on;%vsgUjI5mQH%qkrJ@|WN!$d{oJZ2~h?;nW8qD%V3_ z#?qJZ&HddW6<#C5b%DH56;LL>XMB(IQC(*>h!o3Ji+nnwYP;P^y^TP`Ub&q~-FuE+JsU zdC4#k2zJDn=ptS!;@yja>a1tb;`6a$Q5igh z;9^z7Qk5AvG(pxe_?zNwYJ{sI(Fa&sQ%3@YA$GXZF4+2OtA{10WkJ!?%0V=q?j&s) zNAy^lh{s{yPnJvF4$zbi8t+b-qp)#gIIf4Amp#8Np$heZxQhepT@8+T1umpN@FWo?&%M!fFdu(PVZ~O^bWIw@rVXFJ(y$J z53*`6XMzTBpeF;nfc%F)V)c?-v1S(MNOBHBu=J#i6a?qYH3LCYXF7N8O$O+udGNGn z+I%?%htv?BjzT$2c7Z`#np|fb76Aq^$)MAeAO!%3){NRHlkON#U;P$5=`tq_IQp zOQUq1XKJd*U+h7&qS<4hGdiW6n-?=Bv>uT&VdmZ5^%5;KHnG+3bM8lMcpRi!;5uL0DxDge~a0irEa*ZCED=OU`p0qgM}iQ0E+W#K1mEyWp{!9f{V`SY|7# z($!L4+~p0sNK^Nj;Ce?Bh5H<8RibrSY&#yKfgjq-k{nt0O9dDhy=om}S$%!X;YP1> z{w|{+SQG4QbA66Y^vLJ27ctOwBU6`gPr`3(R7bhF5xlVx{wQpv)Y8Cs(T#!DFuk0y zoj7@zyadwu8P*^1@uGR?8y2&|=87UYB8NdysV>|6QkPLKsldUvkpYcx{W!2xjoMKR zc!usBUAPS*bE{003}gldSFPgPa-S#`7fCRgDrUf5F2yR;My=J;!&F_|Br{Sxw=y>S zBlE~@B8)g1p{}WHEn{j%<;j=^kUC1&W6mtN#U`R{l>>|KCx_<2Ik!b39Yk>(agar{ z2Z0}YCKI{{oxq-;M8y^x;@LXoWeQ7-7bRgUxzk5b+5smRk1C|kun+c38i`FD0yh(! z?*-O$?PPg}1LL&BUXn>M#L^M5SKFC+w0xF`(>A5)q#VH;z~+H8Jhrngsx0BC%JY(Y8G+3mkotl5Fn3J&Bu)hO0h)7Ouab2 zSd8%`Tk;sf+rAd}o^1mOBrN%gGGxnj)sE_rKrx7|by!Cn($-;A$1(C5qv;-sI|k}l zE>SBL`BoKaj7ue=v1^aQgtqNgq|0O*aBZ|jCGK`Cy-EL4HuIq^u?UW*>(q82;)pw_ z^;9Pws>f^ad>schnXv%G$q44f-p{JX6C=N@e!NZ}6B{wKMR(Z>$wYCGGg2dpNFsP7 zf(y-Pi~m)XthO2r9V~37saJyt5LOYiqCiaAI)9)0(HLV5^)1DTJrg-80va3{lVO+R zG`K&u%mGyOiBwx+L0LC(0RoYFDsa%E3^ygH;8JygVyHay7cA>;BOVgpjgcoix!a2p zG1IY66x781sGHWfi{p)+1h4h@+pQ~{|JqUrL`4M2NLrYfY)q(8z%dJ?MF*-#)1qD~ zfSRHJL(&5<(PQ#1RuPS+2_Zi*VB&PU>R?C@r!>^My40zV=!isd6?BcUmCYkM&IsLL z)F1+@euX4trBg3WB49b+qMYF_={l=Pc6A~^+SJ6jr5HU$Ozn9ZGMH{dLhLF2Y2P#| zWs^XoE|`qEUS#C$0`E8vHMM0H2BSr~JlcjD9S+!kmARNTR7#QJsZl zST#Uz6`4WZ&@PSrwd?uf5b}uee6uCY>V{K9Z#76^Mz8U8s5Z^$G|LL-_B*+>A>k(b z_?9<^D2iGH&}bNRcZIs8)5_Uin}f0S-W{tA2Q|i()Pji0Y?#tv=cOQTY&9nw7o#`f zDrr>96|aLaecQx)sh=!^T%qt56!Se3Vy#u2(aOoNK5trhsLc`6yON@)P+ zjWmvy^&8V1=TGZz#?aPUx)wTEkT?E?Rgu2ZwapKWp+y*yc8=_6{f&CIBY||e zC_m~LF?U8~4?=t-tpD(sRb=2u=Qvj6Gk_u=*@mrG`lx|(X(Qaj0gjdv47$!G#w)al z@uQeFa$aL&?+^60xgyTG=@mME*QFz(1t7k0sNNUk2HA3p*{xx2JYt1>Hk#-P{+X(% zB-I6jRjI$&5Ph+rMUp`E0y@Cv?bIzZ9<3YQa+VmH%9(&B%f^ouwcuG=JYyQD7H=Jj zccsm`Z0iOhWb58dUVphJNTP(H?Y_!Ru`FJ7!A6nv0A2$p@g!GW%)VvT#YP1~E3{}! z+ybuR&@CjsEY#)t?>vTBSx9UqV3SKWWz^r$XGA`xhEPz@D4(bCi*=&j=1t`-)*3_M zdlN1-=j?{q9`U@RcaGWSN~5K52l*vP@EN)+d=#+J|3LaP?th5zqPo_4_Q$zt4MpLQ zBQ|zngE!`LTK9nQj)k76j~GkCyd#Hhc@gs@-Js<4{pR|9c#Mn~2s_GDKW(nI+ad;B zhG&9FjW`0iK-uaLV<43=JfzD|EjCseT|cdM6CMp7A|?RJF5a@aZ>+DiU`f<6UKqe< zY9u2GaNS?2@6PdH5M&U~nAY1R@ffmgmW_8}wH&##W46AF_gP+#P;Q= z99oFdC}$IcEyr#aY8%j1?60D$kqwn@>ui)Ea4&nIf{V=cDFiX7fsh$hP-Qp0bT3D0@Gl7ju*Vf2C#(U;1 zs*~5(GoE)&WVACN^%Iz=*vqjbJA!4z>*fR5D1))PYedgK0MHItuz~@Lme$DZnADnu z9;hU)A3WA$&N32_kyRZDVg@P}+P;?_+zk|bKk!!;V0+HkOLsCjf3 z>*)$mnA9}BX5!GaRJ1SVAH@6`G1d(l7?n4vXd{D*5FS;Ecm#u74YqZcQ(m!Nf6+a? zl%nNmM7ts4qHVs)TB9xx485zBk(^6SPH@Ch*6VBBJ7k?5ayk+bB9&JRH=;6Gw`pav zKt9k_tA=1<1KnDUcw!Zprf;m*Zjd{8xUbHbr@d<8f z*F5j0K8$nuUAK|a$)Z)r3}=RL_Vk$Hk(~nYo$qFJ?@K^*0(4dEj2EQT0uOR z3#t#$+bHDZYR~i)JgHx{W#k-GY1n((F$o2O_7-cpmX_@O>cBfr#b>bR=C$nAA?d@M~?nxt%EEV<|>7LG(^`Wc2)VJ>Asc?$xVB(E7-bN;m9{kQOG#0|vJv zt|NpgDaza!li6}?WefFuBw7~BM`EUH&cZxGy+0nYHXOh3A~REZ#tag%;ZI<&k2W0dimGqXpy;Yq*I@7q1=-9p`=bj9 zKFhm9V-MyCtbm8uTNH-_b9_bJ3R%Cyb%EQLk;&Yc@2fAgGB#o=P01wbCvgatF|;8H z4b7HduY0hNmU4C6gKR{sKw1ysLTE5wuyP=`Dk$(!edPKC++G`nY@ifcNk8+|Ql_UT z5+o1yNg`hV=#H~8h|64Qmb|G|92x^Jt zIn-shFFK$*qL?T)SM0s!=!jbl<&~R~=+KGd zs`{N7!5kMMyFZL3QB|}SAlWM+pjL2-+|d%P5Hka$t^q?D9dNhtL2rY0N`2${$)2cr z@?cpN!fFX`$ z_S6Li8kma9WEHCEOa@!BQH{K0PUL`_T4gPb)tFgJTcX^Avk|eQ?Ln9m9|`xd#0#C! zRaMQ5*6cGCQTKAG6R_`kgc)~mn^=sWz3WW}tiGo-SU*XE?$l2qik8cErOSG#6;WkH z37ibKg=LLXAbK|=9*3s5-6qCFb$ecLFP_6z1v@9tbN+>hN~1;>Y1cx?7n<&ju2>FDu(-))iAZxQKnI_tak~syJTA4}B{A*%O9M7Gpi(gnB7m@f z9SPC_DU_CZ>cS1@NQuFzzegzETr3MhUq5gwq}-%X$4sq3c}N{n-IFN{NRWgD73&UG zba70yC0a3#T$fdh%e+TXwS*d(QK11dZ2w8)^(YOemW7cz9kJ7|HNc|UZqFQTVFp5` zwKlar2O4r;Xtp)i0y9pt<8rmb*Wlrr!;7Dm*wn$*#j|eYnaOmSQB%`qX&4k*Ya~M{ z=)u<5WP+*S;X(%8RHnKcxAvIh`}EDEQE~{bRaDRc1<_>$4T)F8#M)yomd0)%U(UgV zhrEEn9ps31Be)H3LxwQeynKwyKvf3S%~5syEFlx`3WnJQYc%dU@D@Tri)=eo^l1!T zFmJ&8c4nk?45O_kn-%VTf%QnpWuZZILHMBK+Q&+6Y zntHdmZW1Ru1CEKlOs5S*sKn9<+iH|{;Rql!4aWgch>HWTD)kCH0*tk0{cthA4s#}B zE-fgfYHtuSsA{lg2U(+9GV45MrHsC|18Fj`jNdY~h78}f42F8Zy38SYZM z0&6X6vMdHo&VAZ)KvE6NG2yhNuOJ0rQtGV739uaK85*=qN|;^QqpBXn?e7Mfhh`1n zktDIJavDPO&#rOi*NVk=Ckx%dTsq(`HHHB&ZRRr4+!VRmV6cz2XJR`o_Hqzbd7(XV z-_^NhQ8BTMfu>=iB8yn4BRAW5S65x&dc^e%U$JUiojaQx<&Q*bb?aVz7c+1g;A(PB z9Ao|4nRw&BmNJ|^lFzKSlZ*AC7Z*Jq<3^D}d@96KPh1~l6B=!!QI)lZDk;Mw?;x=; z)4!jLFG3JY7-M#c)v6ybMo*m9iSfZ5;tXjCa7gzs#Kx4omk8JBQ;g!T`&HI43l+6R z+EESE;naBn)=>s8R^w|?`6k90&5s>~z`g3nVgQ2hh*2Dvw*YIIyd6ekNcCZ42z3(` z^pOCg0vd{fugyXP(qI;BqRJmihz>MIEFwD`TDeGl5otKQ9x1)b9!5jXRv?=+hPb4LdRhff0(-oCa+YGW-S2S!Ln$n8NkzsAD6!`xIwo!DY{=du%J7dx& zk(hgLhuUpqPkGE0&$7Y~I#G}?svi)&ijG9_ZoT5pX#?nV`GHuG9%JbNm^FR7LH$KH zuK2{>^eNqoZ)mZRW_8WshpkjoF)MJ7EJ(IQV@blhF5Hq-k^ORW1z>_?hotUHHD;B| zLutH!OW*WSFED8E7tjEC=b|k&P8S=zw{^1nWDBKqM3>k|pX+}G+A5LbDMURy>2fcs u(JoGheUy3)H-mgBgI02+xa^{0dGm(8w4T8|G?07A)G!wVYPuV<_WuF-sV6u9 literal 0 HcmV?d00001 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/changelog b/platform/broadcom/sonic-platform-modules-inventec/debian/changelog new file mode 100644 index 000000000000..3598fc1d40d1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/changelog @@ -0,0 +1,5 @@ +sonic-inventec-platform-modules (1.0.0) unstable; urgency=low + + * Add support for Inventec d7032 + + -- developer Wed, 05 Oct 2016 16:30:45 +0800 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/compat b/platform/broadcom/sonic-platform-modules-inventec/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/control b/platform/broadcom/sonic-platform-modules-inventec/debian/control new file mode 100644 index 000000000000..328de48c097b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/control @@ -0,0 +1,12 @@ +Source: sonic-inventec-platform-modules +Section: main +Priority: extra +Maintainer: Inventec +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-d7032q28b +Architecture: amd64 +Depends: linux-image-3.16.0-4-amd64 +Description: kernel modules for platform devices such as fan, led + diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init new file mode 100644 index 000000000000..9b9683a4eb2a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init @@ -0,0 +1,69 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup Inventec d7032q28b board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + depmod -a + modprobe inv_platform + modprobe inv_psoc + modprobe inv_cpld + + /usr/local/bin/onie-syseeprom -S /tmp/eeprom + # Attach 32 instances of EEPROM driver QSFP ports on IO module 1 + #eeprom can dump data using below command + for ((i=22;i<=29;i++)); + do + echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-4/i2c-$i/new_device + done + + for ((i=30;i<=37;i++)); + do + echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-5/i2c-$i/new_device + done + + for ((i=6;i<=13;i++)); + do + echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-2/i2c-$i/new_device + done + + for ((i=14;i<=21;i++)); + do + echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-3/i2c-$i/new_device + done + + echo "done." + ;; + +stop) + + rmmod inv_cpld + rmmod inv_psoc + rmmod inv_platform + + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-d7032q28b.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install new file mode 100644 index 000000000000..996d5e36b781 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install @@ -0,0 +1 @@ +d7032q28b/conf/d7032q28b-modules.conf etc/modules-load.d diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/rules b/platform/broadcom/sonic-platform-modules-inventec/debian/rules new file mode 100755 index 000000000000..166a3426b2ba --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/rules @@ -0,0 +1,46 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= d7032q28b + +%: + 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); \ + dh_installdirs -pplatform-modules-$${mod} usr/local/bin; \ + cp -r $(MOD_SRC_DIR)/$${mod}/utils/onie-syseeprom debian/platform-modules-$${mod}/usr/local/bin/; \ + done) + +override_dh_usrlocal: + +override_dh_pysupport: + +override_dh_clean: + dh_clean + (for mod in $(MODULE_DIRS); do \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ + done) + From c075033bb600398ec875dbbc0c69863bd7729571 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 19 Jul 2017 01:14:03 -0700 Subject: [PATCH 0677/1833] [submodule] update sonic-swss submodule (#817) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 179daacb2162..456cb1e62033 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 179daacb2162bd769587070ae8ad4f9ded97d549 +Subproject commit 456cb1e620335ac88efddafc256a3a21b518fa7a From 3fd2014e93ab75dec4396eebbaead23d208046fe Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 19 Jul 2017 08:10:45 -0700 Subject: [PATCH 0678/1833] [sonic-mgmt]: move sonic-mgmt docker build into sonic-slave (#819) need to install sonic-device-data into sonic-mgmt docker --- .gitignore | 1 + Makefile | 19 +------------------ .../docker-sonic-mgmt/Dockerfile.j2 | 15 ++++++++++++++- .../docker-sonic-mgmt}/sonic-jenkins.pub | 0 rules/docker-sonic-mgmt.mk | 5 +++++ slave.mk | 7 +++++-- 6 files changed, 26 insertions(+), 21 deletions(-) rename sonic-mgmt/Dockerfile => dockers/docker-sonic-mgmt/Dockerfile.j2 (86%) rename {sonic-mgmt => dockers/docker-sonic-mgmt}/sonic-jenkins.pub (100%) create mode 100644 rules/docker-sonic-mgmt.mk diff --git a/.gitignore b/.gitignore index bf9967b04aca..16d7b53f60af 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ dockers/docker-orchagent/Dockerfile dockers/docker-platform-monitor/Dockerfile dockers/docker-snmp-sv2/Dockerfile dockers/docker-teamd/Dockerfile +dockers/docker-sonic-mgmt/Dockerfile platform/*/docker-syncd-*/Dockerfile platform/*/docker-syncd-*-rpc/Dockerfile diff --git a/Makefile b/Makefile index b2938221b240..5cf5f53ac3ce 100644 --- a/Makefile +++ b/Makefile @@ -25,21 +25,7 @@ DOCKER_BUILD = docker build --no-cache \ sonic-slave && \ docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG) - -MGMT_TAG = $(shell shasum sonic-mgmt/Dockerfile | awk '{print substr($$1,0,11);}') -MGMT_IMAGE = sonic-mgmt-$(USER) - -DOCKER_MGMT_BUILD = docker build --no-cache \ - --build-arg user=$(USER) \ - --build-arg uid=$(shell id -u) \ - --build-arg guid=$(shell id -g) \ - --build-arg hostname=$(shell echo $$HOSTNAME) \ - -t $(MGMT_IMAGE) \ - sonic-mgmt && \ - docker tag $(MGMT_IMAGE):latest $(MGMT_IMAGE):$(MGMT_TAG) - - -.PHONY: sonic-slave-build sonic-slave-bash sonic-mgmt-build +.PHONY: sonic-slave-build sonic-slave-bash .DEFAULT_GOAL := all @@ -67,6 +53,3 @@ sonic-slave-bash : { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash - -sonic-mgmt-build : - @$(DOCKER_MGMT_BUILD) diff --git a/sonic-mgmt/Dockerfile b/dockers/docker-sonic-mgmt/Dockerfile.j2 similarity index 86% rename from sonic-mgmt/Dockerfile rename to dockers/docker-sonic-mgmt/Dockerfile.j2 index b30db8251f28..6cfe28603894 100644 --- a/sonic-mgmt/Dockerfile +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -20,7 +20,7 @@ RUN apt-get install -y \ libxslt1-dev \ python-setuptools -# For JNLP launcher +# For JNLP launcher RUN apt-get install -y default-jre # For syslog test @@ -44,6 +44,19 @@ RUN pip install ipaddr \ paramiko==2.1.2 \ adal + +## Copy and install sonic-mgmt docker dependencies +COPY \ +{% for deb in docker_sonic_mgmt_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_sonic_mgmt_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + RUN git clone https://github.com/ansible/ansible RUN cd ansible && git checkout v2.0.0.2-1 -b v2.0.0.2-1 && git submodule update --init --recursive && make && make install diff --git a/sonic-mgmt/sonic-jenkins.pub b/dockers/docker-sonic-mgmt/sonic-jenkins.pub similarity index 100% rename from sonic-mgmt/sonic-jenkins.pub rename to dockers/docker-sonic-mgmt/sonic-jenkins.pub diff --git a/rules/docker-sonic-mgmt.mk b/rules/docker-sonic-mgmt.mk new file mode 100644 index 000000000000..2f4908e43d73 --- /dev/null +++ b/rules/docker-sonic-mgmt.mk @@ -0,0 +1,5 @@ +# docker image for sonic-mgmt +DOCKER_SONIC_MGMT = docker-sonic-mgmt.gz +$(DOCKER_SONIC_MGMT)_PATH = $(DOCKERS_PATH)/docker-sonic-mgmt +$(DOCKER_SONIC_MGMT)_DEPENDS += $(SONIC_DEVICE_DATA) +SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_MGMT) diff --git a/slave.mk b/slave.mk index 40e28d6d67ab..0d953d52c924 100644 --- a/slave.mk +++ b/slave.mk @@ -6,6 +6,9 @@ .ONESHELL: SHELL = /bin/bash .SHELLFLAGS += -e +USER = $(shell id -un) +UID = $(shell id -u) +GUID = $(shell id -g) .SECONDEXPANSION: @@ -297,7 +300,7 @@ docker-start : # targets for building simple docker images that do not depend on any debian packages $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $(HEADER) - docker build --squash --no-cache -t $* $($*.gz_PATH) $(LOG) + docker build --squash --no-cache --build-arg user=$(USER) --build-arg uid=$(UID) --build-arg guid=$(GUID) -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ $(FOOTER) @@ -313,7 +316,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile - docker build --squash --no-cache -t $* $($*.gz_PATH) $(LOG) + docker build --squash --no-cache --build-arg user=$(USER) --build-arg uid=$(UID) --build-arg guid=$(GUID) -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ $(FOOTER) From 12e5e22572ab143848422963f6bee255db186806 Mon Sep 17 00:00:00 2001 From: celestica-abhisit Date: Thu, 20 Jul 2017 00:29:46 +0700 Subject: [PATCH 0679/1833] [platform/Seastone] Add a new supported platform, Celestica Seastone-DX010 (#816) * [platform/Seastone] Add a new supported platform, Celestica Seastone-DX010. Switch Vendor: Celestica Switch SKU : Seastone-DX010 ASIC Vendor: Broadcom Swich ASIC: Tomahawk Port Configuration: 32x100G, 64x50G and 96x10G+16x50G. SONiC Image: SONiC-ONIE-Broadcom Signed-off-by: asang@celestica.com * Help to convert tab to white space for Inventec-D7032Q28B platform. --- .gitmodules | 3 +++ platform/broadcom/one-image.mk | 3 ++- platform/broadcom/platform-modules-cel.mk | 11 +++++++++++ platform/broadcom/rules.mk | 1 + platform/broadcom/sonic-platform-modules-cel | 1 + 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 platform/broadcom/platform-modules-cel.mk create mode 160000 platform/broadcom/sonic-platform-modules-cel diff --git a/.gitmodules b/.gitmodules index 454019f9ebdd..5bf6fb5b4a61 100644 --- a/.gitmodules +++ b/.gitmodules @@ -66,3 +66,6 @@ [submodule "platform/broadcom/sonic-platform-modules-accton"] path = platform/broadcom/sonic-platform-modules-accton url = https://github.com/edge-core/sonic-platform-modules-accton.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/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 0a48a32bd600..912c3ea3961d 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -11,6 +11,7 @@ $(SONIC_ONE_IMAGE)_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(INGRASYS_S8900_64XC_PLATFORM_MODULE) \ $(INGRASYS_S9100_PLATFORM_MODULE) \ $(ACCTON_AS7712_32X_PLATFORM_MODULE) \ - $(INVENTEC_D7032Q28B_PLATFORM_MODULE) + $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ + $(CEL_DX010_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 new file mode 100644 index 000000000000..37dce948d3d5 --- /dev/null +++ b/platform/broadcom/platform-modules-cel.mk @@ -0,0 +1,11 @@ +# Celestica DX010 Platform modules + +CEL_DX010_PLATFORM_MODULE_VERSION = 0.5 + +export CEL_DX010_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 +$(CEL_DX010_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(CEL_DX010_PLATFORM_MODULE)_PLATFORM = x86_64-cel_seastone-r0 +SONIC_DPKG_DEBS += $(CEL_DX010_PLATFORM_MODULE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 3823dcc4b83e..253593b30f2a 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -6,6 +6,7 @@ include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk include $(PLATFORM_PATH)/platform-modules-inventec.mk +include $(PLATFORM_PATH)/platform-modules-cel.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel new file mode 160000 index 000000000000..983b298ef65f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel @@ -0,0 +1 @@ +Subproject commit 983b298ef65f994728e250ab5744914b6f27b454 From ccb71cd4d6060fb29b51d2e0da0698f6e3f16c09 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Wed, 19 Jul 2017 17:13:18 -0700 Subject: [PATCH 0680/1833] ASIC part support for Celestica DX010 platform(Three port breakout configurations) (#818) * ASIC part support for Celestica DX010 platform. It includes: *Three different configurations: 32x100G, 64x50G, 96x10G+16x50G.(Script to be includd in the platform directory). *Data port LED Also from vendor: *fancontrol configuration *eeprom.py/sfpulti.py plugins *sensor configuration * Typo fix * Add the port configuration change script * move the script to sonic-utilities repo --- .../Seastone-DX010-10-50/minigraph.xml | 1479 +++++++++++++++++ .../Seastone-DX010-10-50/port_config.ini | 113 ++ .../Seastone-DX010-10-50/sai.profile | 1 + .../Seastone-DX010-50/minigraph.xml | 1239 ++++++++++++++ .../Seastone-DX010-50/port_config.ini | 65 + .../Seastone-DX010-50/sai.profile | 1 + .../Seastone-DX010/minigraph.xml | 1079 ++++++++++++ .../Seastone-DX010/port_config.ini | 33 + .../Seastone-DX010/sai.profile | 1 + .../x86_64-cel_seastone-r0/fancontrol | 12 + .../x86_64-cel_seastone-r0/installer.conf | 3 + .../x86_64-cel_seastone-r0/led-code/ledcode0 | 13 + .../x86_64-cel_seastone-r0/led-code/ledcode1 | 13 + .../x86_64-cel_seastone-r0/led-code/ledcode2 | 8 + .../x86_64-cel_seastone-r0/led_proc_init.soc | 11 + .../x86_64-cel_seastone-r0/minigraph.xml | 1079 ++++++++++++ .../x86_64-cel_seastone-r0/plugins/eeprom.py | 23 + .../x86_64-cel_seastone-r0/plugins/sfputil.py | 25 + .../x86_64-cel_seastone-r0/sensors.conf | 12 + 19 files changed, 5210 insertions(+) create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/minigraph.xml create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile create mode 100644 device/celestica/x86_64-cel_seastone-r0/fancontrol create mode 100644 device/celestica/x86_64-cel_seastone-r0/installer.conf create mode 100755 device/celestica/x86_64-cel_seastone-r0/led-code/ledcode0 create mode 100755 device/celestica/x86_64-cel_seastone-r0/led-code/ledcode1 create mode 100755 device/celestica/x86_64-cel_seastone-r0/led-code/ledcode2 create mode 100755 device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc create mode 100644 device/celestica/x86_64-cel_seastone-r0/minigraph.xml create mode 100644 device/celestica/x86_64-cel_seastone-r0/plugins/eeprom.py create mode 100644 device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py create mode 100644 device/celestica/x86_64-cel_seastone-r0/sensors.conf diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/minigraph.xml new file mode 100644 index 000000000000..7b918a5414c4 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/minigraph.xml @@ -0,0 +1,1479 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +

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 + + + + + + + + switch1 + + + + + + tenGigE1/1 + 10.0.0.0/31 + + + + tenGigE1/2 + 10.0.0.2/31 + + + + tenGigE1/3 + 10.0.0.4/31 + + + + tenGigE1/4 + 10.0.0.6/31 + + + + tenGigE1/5 + 10.0.0.8/31 + + + + tenGigE1/6 + 10.0.0.10/31 + + + + tenGigE1/7 + 10.0.0.12/31 + + + + tenGigE1/8 + 10.0.0.14/31 + + + + tenGigE1/9 + 10.0.0.16/31 + + + + tenGigE1/10 + 10.0.0.18/31 + + + + tenGigE1/11 + 10.0.0.20/31 + + + + tenGigE1/12 + 10.0.0.22/31 + + + + tenGigE1/13 + 10.0.0.24/31 + + + + tenGigE1/14 + 10.0.0.26/31 + + + + tenGigE1/15 + 10.0.0.28/31 + + + + tenGigE1/16 + 10.0.0.30/31 + + + + tenGigE1/17 + 10.0.0.32/31 + + + + tenGigE1/18 + 10.0.0.34/31 + + + + tenGigE1/19 + 10.0.0.36/31 + + + + tenGigE1/20 + 10.0.0.38/31 + + + + tenGigE1/21 + 10.0.0.40/31 + + + + tenGigE1/22 + 10.0.0.42/31 + + + + tenGigE1/23 + 10.0.0.44/31 + + + + tenGigE1/24 + 10.0.0.46/31 + + + + tenGigE1/25 + 10.0.0.48/31 + + + + tenGigE1/26 + 10.0.0.50/31 + + + + tenGigE1/27 + 10.0.0.52/31 + + + + tenGigE1/28 + 10.0.0.54/31 + + + + tenGigE1/29 + 10.0.0.56/31 + + + + tenGigE1/30 + 10.0.0.58/31 + + + + tenGigE1/31 + 10.0.0.60/31 + + + + tenGigE1/32 + 10.0.0.62/31 + + + + tenGigE1/33 + 10.0.0.64/31 + + + + tenGigE1/34 + 10.0.0.66/31 + + + + tenGigE1/35 + 10.0.0.68/31 + + + + tenGigE1/36 + 10.0.0.70/31 + + + + tenGigE1/37 + 10.0.0.72/31 + + + + tenGigE1/38 + 10.0.0.74/31 + + + + tenGigE1/39 + 10.0.0.76/31 + + + + tenGigE1/40 + 10.0.0.78/31 + + + + tenGigE1/41 + 10.0.0.80/31 + + + + tenGigE1/42 + 10.0.0.82/31 + + + + tenGigE1/43 + 10.0.0.84/31 + + + + tenGigE1/44 + 10.0.0.86/31 + + + + tenGigE1/45 + 10.0.0.88/31 + + + + tenGigE1/46 + 10.0.0.90/31 + + + + tenGigE1/47 + 10.0.0.92/31 + + + + tenGigE1/48 + 10.0.0.94/31 + + + + tenGigE1/49 + 10.0.0.96/31 + + + + tenGigE1/50 + 10.0.0.98/31 + + + + tenGigE1/51 + 10.0.0.100/31 + + + + tenGigE1/52 + 10.0.0.102/31 + + + + tenGigE1/53 + 10.0.0.104/31 + + + + tenGigE1/54 + 10.0.0.106/31 + + + + tenGigE1/55 + 10.0.0.108/31 + + + + tenGigE1/56 + 10.0.0.110/31 + + + + tenGigE1/57 + 10.0.0.112/31 + + + + tenGigE1/58 + 10.0.0.114/31 + + + + tenGigE1/59 + 10.0.0.116/31 + + + + tenGigE1/60 + 10.0.0.118/31 + + + + tenGigE1/61 + 10.0.0.120/31 + + + + tenGigE1/62 + 10.0.0.122/31 + + + + tenGigE1/63 + 10.0.0.124/31 + + + + tenGigE1/64 + 10.0.0.126/31 + + + + tenGigE1/65 + 10.0.0.128/31 + + + + tenGigE1/66 + 10.0.0.130/31 + + + + tenGigE1/67 + 10.0.0.132/31 + + + + tenGigE1/68 + 10.0.0.134/31 + + + + tenGigE1/69 + 10.0.0.136/31 + + + + tenGigE1/70 + 10.0.0.138/31 + + + + tenGigE1/71 + 10.0.0.140/31 + + + + tenGigE1/72 + 10.0.0.142/31 + + + + tenGigE1/73 + 10.0.0.144/31 + + + + tenGigE1/74 + 10.0.0.146/31 + + + + tenGigE1/75 + 10.0.0.148/31 + + + + tenGigE1/76 + 10.0.0.150/31 + + + + tenGigE1/77 + 10.0.0.152/31 + + + + tenGigE1/78 + 10.0.0.154/31 + + + + tenGigE1/79 + 10.0.0.156/31 + + + + tenGigE1/80 + 10.0.0.158/31 + + + + tenGigE1/81 + 10.0.0.160/31 + + + + tenGigE1/82 + 10.0.0.162/31 + + + + tenGigE1/83 + 10.0.0.164/31 + + + + tenGigE1/84 + 10.0.0.166/31 + + + + tenGigE1/85 + 10.0.0.168/31 + + + + tenGigE1/86 + 10.0.0.170/31 + + + + tenGigE1/87 + 10.0.0.172/31 + + + + tenGigE1/88 + 10.0.0.174/31 + + + + tenGigE1/89 + 10.0.0.176/31 + + + + tenGigE1/90 + 10.0.0.178/31 + + + + tenGigE1/91 + 10.0.0.180/31 + + + + tenGigE1/92 + 10.0.0.182/31 + + + + tenGigE1/93 + 10.0.0.184/31 + + + + tenGigE1/94 + 10.0.0.186/31 + + + + tenGigE1/95 + 10.0.0.188/31 + + + + tenGigE1/96 + 10.0.0.190/31 + + + + fiftyGigE1/1 + 10.0.1.0/31 + + + + fiftyGigE1/2 + 10.0.1.2/31 + + + + fiftyGigE1/3 + 10.0.1.4/31 + + + + fiftyGigE1/4 + 10.0.1.6/31 + + + + fiftyGigE1/5 + 10.0.1.8/31 + + + + fiftyGigE1/6 + 10.0.1.10/31 + + + + fiftyGigE1/7 + 10.0.1.12/31 + + + + fiftyGigE1/8 + 10.0.1.14/31 + + + + fiftyGigE1/9 + 10.0.1.16/31 + + + + fiftyGigE1/10 + 10.0.1.18/31 + + + + fiftyGigE1/11 + 10.0.1.20/31 + + + + fiftyGigE1/12 + 10.0.1.22/31 + + + + fiftyGigE1/13 + 10.0.1.24/31 + + + + fiftyGigE1/14 + 10.0.1.26/31 + + + + fiftyGigE1/15 + 10.0.1.28/31 + + + + fiftyGigE1/16 + 10.0.1.30/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + tenGigE1/1 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/2 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/3 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/4 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/5 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/6 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/7 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/8 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/9 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/10 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/11 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/12 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/13 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/14 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/15 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/16 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/17 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/18 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/19 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/20 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/21 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/22 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/23 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/24 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/25 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/26 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/27 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/28 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/29 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/30 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/31 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + tenGigE1/32 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Seastone-DX010-10-50 + + + + + + + switch1 + + + 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 + + + + + + + switch1 + Seastone-DX010-10-50 + diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini new file mode 100644 index 000000000000..8ffb58f2aef0 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini @@ -0,0 +1,113 @@ +# name lanes alias +Ethernet0 65 tenGigE1/1 +Ethernet1 66 tenGigE1/2 +Ethernet2 67 tenGigE1/3 +Ethernet3 68 tenGigE1/4 +Ethernet4 69 tenGigE1/5 +Ethernet5 70 tenGigE1/6 +Ethernet6 71 tenGigE1/7 +Ethernet7 72 tenGigE1/8 +Ethernet8 73 tenGigE1/9 +Ethernet9 74 tenGigE1/10 +Ethernet10 75 tenGigE1/11 +Ethernet11 76 tenGigE1/12 +Ethernet12 77 tenGigE1/13 +Ethernet13 78 tenGigE1/14 +Ethernet14 79 tenGigE1/15 +Ethernet15 80 tenGigE1/16 +Ethernet16 33 tenGigE1/17 +Ethernet17 34 tenGigE1/18 +Ethernet18 35 tenGigE1/19 +Ethernet19 36 tenGigE1/20 +Ethernet20 37 tenGigE1/21 +Ethernet21 38 tenGigE1/22 +Ethernet22 39 tenGigE1/23 +Ethernet23 40 tenGigE1/24 +Ethernet24 41 tenGigE1/25 +Ethernet25 42 tenGigE1/26 +Ethernet26 43 tenGigE1/27 +Ethernet27 44 tenGigE1/28 +Ethernet28 45 tenGigE1/29 +Ethernet29 46 tenGigE1/30 +Ethernet30 47 tenGigE1/31 +Ethernet31 48 tenGigE1/32 +Ethernet32 49 tenGigE1/33 +Ethernet33 50 tenGigE1/34 +Ethernet34 51 tenGigE1/35 +Ethernet35 52 tenGigE1/36 +Ethernet36 53 tenGigE1/37 +Ethernet37 54 tenGigE1/38 +Ethernet38 55 tenGigE1/39 +Ethernet39 56 tenGigE1/40 +Ethernet40 57 tenGigE1/41 +Ethernet41 58 tenGigE1/42 +Ethernet42 59 tenGigE1/43 +Ethernet43 60 tenGigE1/44 +Ethernet44 61 tenGigE1/45 +Ethernet45 62 tenGigE1/46 +Ethernet46 63 tenGigE1/47 +Ethernet47 64 tenGigE1/48 +Ethernet48 81 tenGigE1/49 +Ethernet49 82 tenGigE1/50 +Ethernet50 83 tenGigE1/51 +Ethernet51 84 tenGigE1/52 +Ethernet52 85 tenGigE1/53 +Ethernet53 86 tenGigE1/54 +Ethernet54 87 tenGigE1/55 +Ethernet55 88 tenGigE1/56 +Ethernet56 89 tenGigE1/57 +Ethernet57 90 tenGigE1/58 +Ethernet58 91 tenGigE1/59 +Ethernet59 92 tenGigE1/60 +Ethernet60 93 tenGigE1/61 +Ethernet61 94 tenGigE1/62 +Ethernet62 95 tenGigE1/63 +Ethernet63 96 tenGigE1/64 +Ethernet64 97 tenGigE1/65 +Ethernet65 98 tenGigE1/66 +Ethernet66 99 tenGigE1/67 +Ethernet67 100 tenGigE1/68 +Ethernet68 101 tenGigE1/69 +Ethernet69 102 tenGigE1/70 +Ethernet70 103 tenGigE1/71 +Ethernet71 104 tenGigE1/72 +Ethernet72 105 tenGigE1/73 +Ethernet73 106 tenGigE1/74 +Ethernet74 107 tenGigE1/75 +Ethernet75 108 tenGigE1/76 +Ethernet76 109 tenGigE1/77 +Ethernet77 110 tenGigE1/78 +Ethernet78 111 tenGigE1/79 +Ethernet79 112 tenGigE1/80 +Ethernet80 1 tenGigE1/81 +Ethernet81 2 tenGigE1/82 +Ethernet82 3 tenGigE1/83 +Ethernet83 4 tenGigE1/84 +Ethernet84 5 tenGigE1/85 +Ethernet85 6 tenGigE1/86 +Ethernet86 7 tenGigE1/87 +Ethernet87 8 tenGigE1/88 +Ethernet88 9 tenGigE1/89 +Ethernet89 10 tenGigE1/90 +Ethernet90 11 tenGigE1/91 +Ethernet91 12 tenGigE1/92 +Ethernet92 13 tenGigE1/93 +Ethernet93 14 tenGigE1/94 +Ethernet94 15 tenGigE1/95 +Ethernet95 16 tenGigE1/96 +Ethernet96 17,18 fiftyGigE1/1 +Ethernet98 19,20 fiftyGigE1/2 +Ethernet100 21,22 fiftyGigE1/3 +Ethernet102 23,24 fiftyGigE1/4 +Ethernet104 25,26 fiftyGigE1/5 +Ethernet106 27,28 fiftyGigE1/6 +Ethernet108 29,30 fiftyGigE1/7 +Ethernet110 31,32 fiftyGigE1/8 +Ethernet112 113,114 fiftyGigE1/9 +Ethernet114 115,116 fiftyGigE1/10 +Ethernet116 117,118 fiftyGigE1/11 +Ethernet118 119,120 fiftyGigE1/12 +Ethernet120 121,122 fiftyGigE1/13 +Ethernet122 123,124 fiftyGigE1/14 +Ethernet124 125,126 fiftyGigE1/15 +Ethernet126 127,128 fiftyGigE1/16 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile new file mode 100644 index 000000000000..b8652e10e4d9 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-seastone-dx010-96x10G-16x50G.config.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml new file mode 100644 index 000000000000..47dc749df6f5 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml @@ -0,0 +1,1239 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + fiftyGigE1/1 + 10.0.0.0/31 + + + + fiftyGigE1/2 + 10.0.0.2/31 + + + + fiftyGigE1/3 + 10.0.0.4/31 + + + + fiftyGigE1/4 + 10.0.0.6/31 + + + + fiftyGigE1/5 + 10.0.0.8/31 + + + + fiftyGigE1/6 + 10.0.0.10/31 + + + + fiftyGigE1/7 + 10.0.0.12/31 + + + + fiftyGigE1/8 + 10.0.0.14/31 + + + + fiftyGigE1/9 + 10.0.0.16/31 + + + + fiftyGigE1/10 + 10.0.0.18/31 + + + + fiftyGigE1/11 + 10.0.0.20/31 + + + + fiftyGigE1/12 + 10.0.0.22/31 + + + + fiftyGigE1/13 + 10.0.0.24/31 + + + + fiftyGigE1/14 + 10.0.0.26/31 + + + + fiftyGigE1/15 + 10.0.0.28/31 + + + + fiftyGigE1/16 + 10.0.0.30/31 + + + + fiftyGigE1/17 + 10.0.0.32/31 + + + + fiftyGigE1/18 + 10.0.0.34/31 + + + + fiftyGigE1/19 + 10.0.0.36/31 + + + + fiftyGigE1/20 + 10.0.0.38/31 + + + + fiftyGigE1/21 + 10.0.0.40/31 + + + + fiftyGigE1/22 + 10.0.0.42/31 + + + + fiftyGigE1/23 + 10.0.0.44/31 + + + + fiftyGigE1/24 + 10.0.0.46/31 + + + + fiftyGigE1/25 + 10.0.0.48/31 + + + + fiftyGigE1/26 + 10.0.0.50/31 + + + + fiftyGigE1/27 + 10.0.0.52/31 + + + + fiftyGigE1/28 + 10.0.0.54/31 + + + + fiftyGigE1/29 + 10.0.0.56/31 + + + + fiftyGigE1/30 + 10.0.0.58/31 + + + + fiftyGigE1/31 + 10.0.0.60/31 + + + + fiftyGigE1/32 + 10.0.0.62/31 + + + + fiftyGigE1/33 + 10.0.0.64/31 + + + + fiftyGigE1/34 + 10.0.0.66/31 + + + + fiftyGigE1/35 + 10.0.0.68/31 + + + + fiftyGigE1/36 + 10.0.0.70/31 + + + + fiftyGigE1/37 + 10.0.0.72/31 + + + + fiftyGigE1/38 + 10.0.0.74/31 + + + + fiftyGigE1/39 + 10.0.0.76/31 + + + + fiftyGigE1/40 + 10.0.0.78/31 + + + + fiftyGigE1/41 + 10.0.0.80/31 + + + + fiftyGigE1/42 + 10.0.0.82/31 + + + + fiftyGigE1/43 + 10.0.0.84/31 + + + + fiftyGigE1/44 + 10.0.0.86/31 + + + + fiftyGigE1/45 + 10.0.0.88/31 + + + + fiftyGigE1/46 + 10.0.0.90/31 + + + + fiftyGigE1/47 + 10.0.0.92/31 + + + + fiftyGigE1/48 + 10.0.0.94/31 + + + + fiftyGigE1/49 + 10.0.0.96/31 + + + + fiftyGigE1/50 + 10.0.0.98/31 + + + + fiftyGigE1/51 + 10.0.0.100/31 + + + + fiftyGigE1/52 + 10.0.0.102/31 + + + + fiftyGigE1/53 + 10.0.0.104/31 + + + + fiftyGigE1/54 + 10.0.0.106/31 + + + + fiftyGigE1/55 + 10.0.0.108/31 + + + + fiftyGigE1/56 + 10.0.0.110/31 + + + + fiftyGigE1/57 + 10.0.0.112/31 + + + + fiftyGigE1/58 + 10.0.0.114/31 + + + + fiftyGigE1/59 + 10.0.0.116/31 + + + + fiftyGigE1/60 + 10.0.0.118/31 + + + + fiftyGigE1/61 + 10.0.0.120/31 + + + + fiftyGigE1/62 + 10.0.0.122/31 + + + + fiftyGigE1/63 + 10.0.0.124/31 + + + + fiftyGigE1/64 + 10.0.0.126/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + fiftyGigE1/1 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/2 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/3 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/4 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/5 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/6 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/7 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/8 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/9 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/10 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/11 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/12 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/13 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/14 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/15 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/16 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/17 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/18 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/19 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/20 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/21 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/22 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/23 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/24 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/25 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/26 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/27 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/28 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/29 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/30 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/31 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + fiftyGigE1/32 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Seastone-DX010-50 + + + + + + + switch1 + + + 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 + + + + + + + switch1 + Seastone-DX010-50 +
diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini new file mode 100644 index 000000000000..10ed3a14827e --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias +Ethernet0 65,66 fiftyGigE1/1 +Ethernet2 67,68 fiftyGigE1/2 +Ethernet4 69,70 fiftyGigE1/3 +Ethernet6 71,72 fiftyGigE1/4 +Ethernet8 73,74 fiftyGigE1/5 +Ethernet10 75,76 fiftyGigE1/6 +Ethernet12 77,78 fiftyGigE1/7 +Ethernet14 79,80 fiftyGigE1/8 +Ethernet16 33,34 fiftyGigE1/9 +Ethernet18 35,36 fiftyGigE1/10 +Ethernet20 37,38 fiftyGigE1/11 +Ethernet22 39,40 fiftyGigE1/12 +Ethernet24 41,42 fiftyGigE1/13 +Ethernet26 43,44 fiftyGigE1/14 +Ethernet28 45,46 fiftyGigE1/15 +Ethernet30 47,48 fiftyGigE1/16 +Ethernet32 49,50 fiftyGigE1/17 +Ethernet34 51,52 fiftyGigE1/18 +Ethernet36 53,54 fiftyGigE1/19 +Ethernet38 55,56 fiftyGigE1/20 +Ethernet40 57,58 fiftyGigE1/21 +Ethernet42 59,60 fiftyGigE1/22 +Ethernet44 61,62 fiftyGigE1/23 +Ethernet46 63,64 fiftyGigE1/24 +Ethernet48 81,82 fiftyGigE1/25 +Ethernet50 83,84 fiftyGigE1/26 +Ethernet52 85,86 fiftyGigE1/27 +Ethernet54 87,88 fiftyGigE1/28 +Ethernet56 89,90 fiftyGigE1/29 +Ethernet58 91,92 fiftyGigE1/30 +Ethernet60 93,94 fiftyGigE1/31 +Ethernet62 95,96 fiftyGigE1/32 +Ethernet64 97,98 fiftyGigE1/33 +Ethernet66 99,100 fiftyGigE1/34 +Ethernet68 101,102 fiftyGigE1/35 +Ethernet70 103,104 fiftyGigE1/36 +Ethernet72 105,106 fiftyGigE1/37 +Ethernet74 107,108 fiftyGigE1/38 +Ethernet76 109,110 fiftyGigE1/39 +Ethernet78 111,112 fiftyGigE1/40 +Ethernet80 1,2 fiftyGigE1/41 +Ethernet82 3,4 fiftyGigE1/42 +Ethernet84 5,6 fiftyGigE1/43 +Ethernet86 7,8 fiftyGigE1/44 +Ethernet88 9,10 fiftyGigE1/45 +Ethernet90 11,12 fiftyGigE1/46 +Ethernet92 13,14 fiftyGigE1/47 +Ethernet94 15,16 fiftyGigE1/48 +Ethernet96 17,18 fiftyGigE1/49 +Ethernet98 19,20 fiftyGigE1/50 +Ethernet100 21,22 fiftyGigE1/51 +Ethernet102 23,24 fiftyGigE1/52 +Ethernet104 25,26 fiftyGigE1/53 +Ethernet106 27,28 fiftyGigE1/54 +Ethernet108 29,30 fiftyGigE1/55 +Ethernet110 31,32 fiftyGigE1/56 +Ethernet112 113,114 fiftyGigE1/57 +Ethernet114 115,116 fiftyGigE1/58 +Ethernet116 117,118 fiftyGigE1/59 +Ethernet118 119,120 fiftyGigE1/60 +Ethernet120 121,122 fiftyGigE1/61 +Ethernet122 123,124 fiftyGigE1/62 +Ethernet124 125,126 fiftyGigE1/63 +Ethernet126 127,128 fiftyGigE1/64 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile new file mode 100644 index 000000000000..ced857611967 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-seastone-dx010-64x50G.config.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml new file mode 100644 index 000000000000..921839b0d72d --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml @@ -0,0 +1,1079 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + hundredGigE1/1 + 10.0.0.0/31 + + + + hundredGigE1/2 + 10.0.0.2/31 + + + + hundredGigE1/3 + 10.0.0.4/31 + + + + hundredGigE1/4 + 10.0.0.6/31 + + + + hundredGigE1/5 + 10.0.0.8/31 + + + + hundredGigE1/6 + 10.0.0.10/31 + + + + hundredGigE1/7 + 10.0.0.12/31 + + + + hundredGigE1/8 + 10.0.0.14/31 + + + + hundredGigE1/9 + 10.0.0.16/31 + + + + hundredGigE1/10 + 10.0.0.18/31 + + + + hundredGigE1/11 + 10.0.0.20/31 + + + + hundredGigE1/12 + 10.0.0.22/31 + + + + hundredGigE1/13 + 10.0.0.24/31 + + + + hundredGigE1/14 + 10.0.0.26/31 + + + + hundredGigE1/15 + 10.0.0.28/31 + + + + hundredGigE1/16 + 10.0.0.30/31 + + + + hundredGigE1/17 + 10.0.0.32/31 + + + + hundredGigE1/18 + 10.0.0.34/31 + + + + hundredGigE1/19 + 10.0.0.36/31 + + + + hundredGigE1/20 + 10.0.0.38/31 + + + + hundredGigE1/21 + 10.0.0.40/31 + + + + hundredGigE1/22 + 10.0.0.42/31 + + + + hundredGigE1/23 + 10.0.0.44/31 + + + + hundredGigE1/24 + 10.0.0.46/31 + + + + hundredGigE1/25 + 10.0.0.48/31 + + + + hundredGigE1/26 + 10.0.0.50/31 + + + + hundredGigE1/27 + 10.0.0.52/31 + + + + hundredGigE1/28 + 10.0.0.54/31 + + + + hundredGigE1/29 + 10.0.0.56/31 + + + + hundredGigE1/30 + 10.0.0.58/31 + + + + hundredGigE1/31 + 10.0.0.60/31 + + + + hundredGigE1/32 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + hundredGigE1/1 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/2 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/3 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/4 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/5 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/6 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/7 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/8 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/9 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/10 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/11 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/12 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/13 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/14 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/15 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/16 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/17 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/18 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/19 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/20 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/21 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/22 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/23 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/24 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/25 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/26 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/27 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/28 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/29 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/30 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/31 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/32 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Seastone-DX010 + + + + + + + switch1 + + + 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 + + + + + + + switch1 + Seastone-DX010 +
diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini new file mode 100644 index 000000000000..5336dbdb5509 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 65,66,67,68 hundredGigE1/1 +Ethernet4 69,70,71,72 hundredGigE1/2 +Ethernet8 73,74,75,76 hundredGigE1/3 +Ethernet12 77,78,79,80 hundredGigE1/4 +Ethernet16 33,34,35,36 hundredGigE1/5 +Ethernet20 37,38,39,40 hundredGigE1/6 +Ethernet24 41,42,43,44 hundredGigE1/7 +Ethernet28 45,46,47,48 hundredGigE1/8 +Ethernet32 49,50,51,52 hundredGigE1/9 +Ethernet36 53,54,55,56 hundredGigE1/10 +Ethernet40 57,58,59,60 hundredGigE1/11 +Ethernet44 61,62,63,64 hundredGigE1/12 +Ethernet48 81,82,83,84 hundredGigE1/13 +Ethernet52 85,86,87,88 hundredGigE1/14 +Ethernet56 89,90,91,92 hundredGigE1/15 +Ethernet60 93,94,95,96 hundredGigE1/16 +Ethernet64 97,98,99,100 hundredGigE1/17 +Ethernet68 101,102,103,104 hundredGigE1/18 +Ethernet72 105,106,107,108 hundredGigE1/19 +Ethernet76 109,110,111,112 hundredGigE1/20 +Ethernet80 1,2,3,4 hundredGigE1/21 +Ethernet84 5,6,7,8 hundredGigE1/22 +Ethernet88 9,10,11,12 hundredGigE1/23 +Ethernet92 13,14,15,16 hundredGigE1/24 +Ethernet96 17,18,19,20 hundredGigE1/25 +Ethernet100 21,22,23,24 hundredGigE1/26 +Ethernet104 25,26,27,28 hundredGigE1/27 +Ethernet108 29,30,31,32 hundredGigE1/28 +Ethernet112 113,114,115,116 hundredGigE1/29 +Ethernet116 117,118,119,120 hundredGigE1/30 +Ethernet120 121,122,123,124 hundredGigE1/31 +Ethernet124 125,126,127,128 hundredGigE1/32 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile new file mode 100644 index 000000000000..8db218c89a52 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-seastone-dx010-32x100G.config.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/fancontrol b/device/celestica/x86_64-cel_seastone-r0/fancontrol new file mode 100644 index 000000000000..ba3010c7c9cc --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon6=devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e hwmon7=devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d +DEVNAME=hwmon6=emc2305 hwmon7=emc2305 +FCTEMPS=hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input +FCFANS= hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm5 hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm4 hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm3 hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm2 hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm1 hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm5 hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm4 hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm3 hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm2 hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm1 +MINTEMP=hwmon6/device/pwm1=25 hwmon6/device/pwm2=25 hwmon6/device/pwm3=25 hwmon6/device/pwm4=25 hwmon6/device/pwm5=25 hwmon7/device/pwm1=25 hwmon7/device/pwm2=25 hwmon7/device/pwm3=25 hwmon7/device/pwm4=25 hwmon7/device/pwm5=25 +MAXTEMP=hwmon6/device/pwm1=40 hwmon6/device/pwm2=40 hwmon6/device/pwm3=40 hwmon6/device/pwm4=40 hwmon6/device/pwm5=40 hwmon7/device/pwm1=40 hwmon7/device/pwm2=40 hwmon7/device/pwm3=40 hwmon7/device/pwm4=40 hwmon7/device/pwm5=40 +MINSTART=hwmon6/device/pwm1=75 hwmon6/device/pwm2=75 hwmon6/device/pwm3=75 hwmon6/device/pwm4=75 hwmon6/device/pwm5=75 hwmon7/device/pwm1=75 hwmon7/device/pwm2=75 hwmon7/device/pwm3=75 hwmon7/device/pwm4=75 hwmon7/device/pwm5=75 +MINSTOP=hwmon6/device/pwm1=50 hwmon6/device/pwm2=50 hwmon6/device/pwm3=50 hwmon6/device/pwm4=50 hwmon6/device/pwm5=50 hwmon7/device/pwm1=50 hwmon7/device/pwm2=50 hwmon7/device/pwm3=50 hwmon7/device/pwm4=50 hwmon7/device/pwm5=50 +MINPWM=hwmon6/device/pwm1=50 hwmon6/device/pwm2=50 hwmon6/device/pwm3=50 hwmon6/device/pwm4=50 hwmon6/device/pwm5=50 hwmon7/device/pwm1=50 hwmon7/device/pwm2=50 hwmon7/device/pwm3=50 hwmon7/device/pwm4=50 hwmon7/device/pwm5=50 +MAXPWM=hwmon6/device/pwm1=255 hwmon6/device/pwm2=255 hwmon6/device/pwm3=255 hwmon6/device/pwm4=255 hwmon6/device/pwm5=255 hwmon7/device/pwm1=255 hwmon7/device/pwm2=255 hwmon7/device/pwm3=255 hwmon7/device/pwm4=255 hwmon7/device/pwm5=255 diff --git a/device/celestica/x86_64-cel_seastone-r0/installer.conf b/device/celestica/x86_64-cel_seastone-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode0 b/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode0 new file mode 100755 index 000000000000..df26e4abd679 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode0 @@ -0,0 +1,13 @@ +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 diff --git a/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode1 b/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode1 new file mode 100755 index 000000000000..df26e4abd679 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode1 @@ -0,0 +1,13 @@ +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 diff --git a/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode2 b/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode2 new file mode 100755 index 000000000000..9e30d9d28fb6 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/led-code/ledcode2 @@ -0,0 +1,8 @@ +02 01 28 67 16 02 01 28 67 16 12 E0 85 05 D2 05 +71 14 52 00 3A 04 67 3C 75 54 77 1C 67 43 75 22 +77 2F 28 67 4A 75 57 16 E0 DA 04 74 54 77 57 28 +67 4A 75 57 16 E0 DA 04 74 54 77 57 12 A0 F8 15 +1A 00 57 12 A0 F8 15 1A 01 57 28 32 00 32 01 B7 +97 77 53 57 67 5D 57 67 6B 57 67 64 57 32 0F 87 +32 0F 87 57 32 0E 87 32 0F 87 57 32 0E 87 32 0E +87 57 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_proc_init.soc b/device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc new file mode 100755 index 000000000000..fb898fcadfc1 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc @@ -0,0 +1,11 @@ + +# Download LED code into LED processor and enable (if applicable). + +led 0 load /usr/share/sonic/platform/led-code/ledcode0; +led 0 auto on; led 0 start; +led 1 load /usr/share/sonic/platform/led-code/ledcode1; +led 1 auto on; led 1 start; +led 2 load /usr/share/sonic/platform/led-code/ledcode2; +led 2 auto on; led 2 start + + diff --git a/device/celestica/x86_64-cel_seastone-r0/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/minigraph.xml new file mode 100644 index 000000000000..921839b0d72d --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/minigraph.xml @@ -0,0 +1,1079 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + hundredGigE1/1 + 10.0.0.0/31 + + + + hundredGigE1/2 + 10.0.0.2/31 + + + + hundredGigE1/3 + 10.0.0.4/31 + + + + hundredGigE1/4 + 10.0.0.6/31 + + + + hundredGigE1/5 + 10.0.0.8/31 + + + + hundredGigE1/6 + 10.0.0.10/31 + + + + hundredGigE1/7 + 10.0.0.12/31 + + + + hundredGigE1/8 + 10.0.0.14/31 + + + + hundredGigE1/9 + 10.0.0.16/31 + + + + hundredGigE1/10 + 10.0.0.18/31 + + + + hundredGigE1/11 + 10.0.0.20/31 + + + + hundredGigE1/12 + 10.0.0.22/31 + + + + hundredGigE1/13 + 10.0.0.24/31 + + + + hundredGigE1/14 + 10.0.0.26/31 + + + + hundredGigE1/15 + 10.0.0.28/31 + + + + hundredGigE1/16 + 10.0.0.30/31 + + + + hundredGigE1/17 + 10.0.0.32/31 + + + + hundredGigE1/18 + 10.0.0.34/31 + + + + hundredGigE1/19 + 10.0.0.36/31 + + + + hundredGigE1/20 + 10.0.0.38/31 + + + + hundredGigE1/21 + 10.0.0.40/31 + + + + hundredGigE1/22 + 10.0.0.42/31 + + + + hundredGigE1/23 + 10.0.0.44/31 + + + + hundredGigE1/24 + 10.0.0.46/31 + + + + hundredGigE1/25 + 10.0.0.48/31 + + + + hundredGigE1/26 + 10.0.0.50/31 + + + + hundredGigE1/27 + 10.0.0.52/31 + + + + hundredGigE1/28 + 10.0.0.54/31 + + + + hundredGigE1/29 + 10.0.0.56/31 + + + + hundredGigE1/30 + 10.0.0.58/31 + + + + hundredGigE1/31 + 10.0.0.60/31 + + + + hundredGigE1/32 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + hundredGigE1/1 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/2 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/3 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/4 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/5 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/6 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/7 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/8 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/9 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/10 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/11 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/12 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/13 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/14 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/15 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/16 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/17 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/18 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/19 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/20 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/21 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/22 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/23 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/24 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/25 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/26 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/27 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/28 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/29 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/30 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/31 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/32 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Seastone-DX010 + + + + + + + switch1 + + + 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 + + + + + + + switch1 + Seastone-DX010 +
diff --git a/device/celestica/x86_64-cel_seastone-r0/plugins/eeprom.py b/device/celestica/x86_64-cel_seastone-r0/plugins/eeprom.py new file mode 100644 index 000000000000..29f01a07fc73 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-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-12/12-0050/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py b/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py new file mode 100644 index 000000000000..f3943e734b58 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + port_to_eeprom_mapping = {} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # 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_eeprom_mapping[x] = eeprom_path.format( x + 26 ) + sfputilbase.__init__(self, port_num) diff --git a/device/celestica/x86_64-cel_seastone-r0/sensors.conf b/device/celestica/x86_64-cel_seastone-r0/sensors.conf new file mode 100644 index 000000000000..eaaeeacfc44c --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/sensors.conf @@ -0,0 +1,12 @@ +# libsensors configuration file +chip "dps460-*" + ignore fan2 + ignore fan3 + +chip "dx010_lm75b-*" + set temp1_max 43 + set temp1_max_hyst 28 + +chip "lm75b-*" + set temp1_max 43 + set temp1_max_hyst 28 From 2201bf3496d4a848585d4dad25f19282d5b6e64e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 19 Jul 2017 23:21:03 -0700 Subject: [PATCH 0681/1833] [docker-ptf]: Install yaml module for python (#821) * Install yaml python module in docker-ptf container --- dockers/docker-ptf/Dockerfile.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 3304ff643bb8..899bba45c47f 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -84,6 +84,7 @@ RUN rm -rf /debs \ && pip install paramiko \ && pip install flask \ && pip install exabgp==3.4.17\ + && pip install pyaml \ && mkdir -p /opt \ && cd /opt \ && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py From 0805f2f42ee90b7d2d88d1a40198d889565b8ed1 Mon Sep 17 00:00:00 2001 From: celestica-abhisit Date: Fri, 21 Jul 2017 22:02:20 +0700 Subject: [PATCH 0682/1833] [platform/Seastone]: Update sonic-platform-modules-cel git-submodule. (#825) --- platform/broadcom/sonic-platform-modules-cel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel index 983b298ef65f..514e76c2296f 160000 --- a/platform/broadcom/sonic-platform-modules-cel +++ b/platform/broadcom/sonic-platform-modules-cel @@ -1 +1 @@ -Subproject commit 983b298ef65f994728e250ab5744914b6f27b454 +Subproject commit 514e76c2296fa3c7736f6cabbe429f1070b3bcac From b1f5f83bf8f51343fc462369d0e8d24d822e5b1b Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Fri, 21 Jul 2017 22:47:06 +0700 Subject: [PATCH 0683/1833] Update label of temperature sensors. (#823) --- .../x86_64-cel_seastone-r0/sensors.conf | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/sensors.conf b/device/celestica/x86_64-cel_seastone-r0/sensors.conf index eaaeeacfc44c..f7e89e58cd2e 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sensors.conf +++ b/device/celestica/x86_64-cel_seastone-r0/sensors.conf @@ -3,10 +3,27 @@ chip "dps460-*" ignore fan2 ignore fan3 -chip "dx010_lm75b-*" +chip "dx010_lm75b-i2c-5-48" + label temp1 "CPU Board Temp" set temp1_max 43 set temp1_max_hyst 28 -chip "lm75b-*" +chip "dx010_lm75b-i2c-15-4e" + label temp1 "CPU Board Temp" + set temp1_max 43 + set temp1_max_hyst 28 + +chip "dx010_lm75b-i2c-6-49" + label temp1 "Main Board Temp" + set temp1_max 43 + set temp1_max_hyst 28 + +chip "dx010_lm75b-i2c-7-4a" + label temp1 "Main Board Temp" + set temp1_max 43 + set temp1_max_hyst 28 + +chip "dx010_lm75b-i2c-14-48" + label temp1 "Main Board Temp" set temp1_max 43 set temp1_max_hyst 28 From cd601650bfab12edee4887826d5cd611ed6f207c Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 21 Jul 2017 19:05:21 +0300 Subject: [PATCH 0684/1833] [slave.mk]: Use host timestamp for online targets. (#826) By default, wget tries to use timestamp received from the server. This behavior messes up make dependencies which are also based on last modification time. In order to avoid this, we use the current time as a timestamp to keep dependencies in correct order. Signed-off-by: marian-pritsak --- slave.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slave.mk b/slave.mk index 0d953d52c924..4bd158da7187 100644 --- a/slave.mk +++ b/slave.mk @@ -130,7 +130,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_COPY_FILES)) : $(DEBS_PATH)/% : .platform $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS)) : $(DEBS_PATH)/% : .platform $(HEADER) $(foreach deb,$* $($*_DERIVED_DEBS), \ - { wget -O $(DEBS_PATH)/$(deb) $($(deb)_URL) $(LOG) || exit 1 ; } ; ) + { wget --no-use-server-timestamps -O $(DEBS_PATH)/$(deb) $($(deb)_URL) $(LOG) || exit 1 ; } ; ) $(FOOTER) # Download regular files from online location @@ -141,7 +141,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS)) : $(DEBS_PATH)/% : .platform # SONIC_ONLINE_FILES += $(SOME_NEW_FILE) $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_FILES)) : $(DEBS_PATH)/% : .platform $(HEADER) - wget -O $@ $($*_URL) $(LOG) + wget --no-use-server-timestamps -O $@ $($*_URL) $(LOG) $(FOOTER) ############################################################################### From bc4ee143405378cedcdc8f6d7c9a1308f53e7f5e Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 24 Jul 2017 10:52:51 +0300 Subject: [PATCH 0685/1833] [Makefile]: Automatically deduce pseudo-TTY option (#830) Signed-off-by: marian-pritsak --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5cf5f53ac3ce..33f2df19e520 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ SLAVE_IMAGE = sonic-slave-$(USER) DOCKER_RUN := docker run --rm=true --privileged \ -v $(PWD):/sonic \ - -i$(SONIC_SLAVE_TTY) + -i$(if $(TERM),t,) DOCKER_BUILD = docker build --no-cache \ --build-arg user=$(USER) \ From 7cf84791820fcce666ae3f5ebe76360911a72b35 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 24 Jul 2017 12:29:36 +0300 Subject: [PATCH 0686/1833] [Makefile]: Set build directory as docker workdir (#832) Signed-off-by: marian-pritsak --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 33f2df19e520..8742e329f07c 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ SLAVE_IMAGE = sonic-slave-$(USER) DOCKER_RUN := docker run --rm=true --privileged \ -v $(PWD):/sonic \ + -w /sonic \ -i$(if $(TERM),t,) DOCKER_BUILD = docker build --no-cache \ @@ -34,7 +35,6 @@ DOCKER_BUILD = docker build --no-cache \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) make \ - -C sonic \ -f slave.mk \ PLATFORM=$(PLATFORM) \ BUILD_NUMBER=$(BUILD_NUMBER) \ From 7ba0230088243e4929e593fad50dafe112e89c6a Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Mon, 24 Jul 2017 12:48:19 +0300 Subject: [PATCH 0687/1833] [submodule] update sonic-swss submodule (#833) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 456cb1e62033..27c49a0bf3a7 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 456cb1e620335ac88efddafc256a3a21b518fa7a +Subproject commit 27c49a0bf3a71556b553aa30fe2a7c1cdb996142 From 40f1e53fd0d7044e7b725eb16faca078191b5a38 Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Mon, 24 Jul 2017 23:42:28 +0700 Subject: [PATCH 0688/1833] [device/celestica] Label more chip sensors in DX010 model. (#834) --- .../x86_64-cel_seastone-r0/sensors.conf | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/sensors.conf b/device/celestica/x86_64-cel_seastone-r0/sensors.conf index f7e89e58cd2e..93a0fd6db762 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sensors.conf +++ b/device/celestica/x86_64-cel_seastone-r0/sensors.conf @@ -1,29 +1,44 @@ -# libsensors configuration file -chip "dps460-*" +# libsensors configuration file for Celestica DX010. +# The i2c bus portion is omit because adapter name +# changes every time when system boot up. + +chip "dps460-i2c-*-5a" + label temp1 "Power Supply 1 temp sensor 1" + label temp2 "Power Supply 1 temp sensor 2" + label temp3 "Power Supply 1 temp sensor 3" ignore fan2 ignore fan3 -chip "dx010_lm75b-i2c-5-48" - label temp1 "CPU Board Temp" +chip "dps460-i2c-*-5b" + label temp1 "Power Supply 2 temp sensor 1" + label temp2 "Power Supply 2 temp sensor 2" + label temp3 "Power Supply 2 temp sensor 3" + ignore fan2 + ignore fan3 + +# These sensors located on Main Switch Board. +chip "dx010_lm75b-i2c-*-48" + label temp1 "Front-panel temp sensor 1" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-15-4e" - label temp1 "CPU Board Temp" +chip "dx010_lm75b-i2c-*-49" + label temp1 "Front-panel temp sensor 2" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-6-49" - label temp1 "Main Board Temp" +chip "dx010_lm75b-i2c-*-4a" + label temp1 "ASIC temp sensor" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-7-4a" - label temp1 "Main Board Temp" +# These sensors located on CPU Board. +chip "dx010_lm75b-i2c-*-48" + label temp1 "Rear-panel temp sensor 1" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-14-48" - label temp1 "Main Board Temp" +chip "dx010_lm75b-i2c-*-4e" + label temp1 "Rear-panel temp sensor 2" set temp1_max 43 - set temp1_max_hyst 28 + set temp1_max_hyst 28 \ No newline at end of file From d898011b2ec9eb5fb16ff13d40b73f1b4c31d4e4 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 24 Jul 2017 13:36:40 -0700 Subject: [PATCH 0689/1833] [docker-ptf]: Update entrypoint entry for docker-ptf (#836) * Updated entrypoint for docker-ptf container * Add main supervisord.conf file under /etc/supervisor. Run supervisord with option -c --- dockers/docker-ptf/Dockerfile.j2 | 7 +++-- .../docker-ptf/{ => conf.d}/ptf_nn_agent.conf | 0 dockers/docker-ptf/{ => conf.d}/sshd.conf | 0 dockers/docker-ptf/conf.d/supervisord.conf | 2 ++ dockers/docker-ptf/supervisord.conf | 28 ++++++++++++++++++- 5 files changed, 34 insertions(+), 3 deletions(-) rename dockers/docker-ptf/{ => conf.d}/ptf_nn_agent.conf (100%) rename dockers/docker-ptf/{ => conf.d}/sshd.conf (100%) create mode 100644 dockers/docker-ptf/conf.d/supervisord.conf diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 899bba45c47f..1d1231d9418e 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -96,8 +96,11 @@ RUN mkdir /var/run/sshd \ && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config \ && sed -i '$aUseDNS no' /etc/ssh/sshd_config -COPY ["supervisord.conf", "sshd.conf", "ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] +COPY ["supervisord.conf", "/etc/supervisor/"] +COPY ["conf.d/supervisord.conf", "conf.d/sshd.conf", "conf.d/ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] + +RUN mkdir -p /var/log/supervisor EXPOSE 22 -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] diff --git a/dockers/docker-ptf/ptf_nn_agent.conf b/dockers/docker-ptf/conf.d/ptf_nn_agent.conf similarity index 100% rename from dockers/docker-ptf/ptf_nn_agent.conf rename to dockers/docker-ptf/conf.d/ptf_nn_agent.conf diff --git a/dockers/docker-ptf/sshd.conf b/dockers/docker-ptf/conf.d/sshd.conf similarity index 100% rename from dockers/docker-ptf/sshd.conf rename to dockers/docker-ptf/conf.d/sshd.conf diff --git a/dockers/docker-ptf/conf.d/supervisord.conf b/dockers/docker-ptf/conf.d/supervisord.conf new file mode 100644 index 000000000000..54296b8b254e --- /dev/null +++ b/dockers/docker-ptf/conf.d/supervisord.conf @@ -0,0 +1,2 @@ +[supervisord] +nodaemon=true diff --git a/dockers/docker-ptf/supervisord.conf b/dockers/docker-ptf/supervisord.conf index 54296b8b254e..9c236612d25c 100644 --- a/dockers/docker-ptf/supervisord.conf +++ b/dockers/docker-ptf/supervisord.conf @@ -1,2 +1,28 @@ +; supervisor config file + +[unix_http_server] +file=/var/run/supervisor.sock ; (the path to the socket file) +chmod=0700 ; sockef file mode (default 0700) + [supervisord] -nodaemon=true +logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) +pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) + +; the below section must remain in the config file for RPC +; (supervisorctl/web interface) to work, additional interfaces may be +; added by defining them in separate rpcinterface: sections +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket + +; The [include] section can just contain the "files" setting. This +; setting can list multiple files (separated by whitespace or +; newlines). It can also contain wildcards. The filenames are +; interpreted as relative to this file. Included files *cannot* +; include files themselves. + +[include] +files = /etc/supervisor/conf.d/*.conf From f136334c7250df6b4ce2d9acf3a7124b92c5dfa7 Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Tue, 25 Jul 2017 08:56:48 +0800 Subject: [PATCH 0690/1833] [platform]: Update LED for Ingrasys platforms (#831) * Update LED for S9100-32X * Add LED for S8900-54XC and S8900-64XC Signed-off-by: Sam Yang --- .../led_proc_init.soc | 43 ++++++++++++ .../led_proc_init.soc | 43 ++++++++++++ .../led_proc_init.soc | 70 +++++++++---------- 3 files changed, 121 insertions(+), 35 deletions(-) create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/led_proc_init.soc create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/led_proc_init.soc diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/led_proc_init.soc b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/led_proc_init.soc new file mode 100644 index 000000000000..8eef1389abc8 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/led_proc_init.soc @@ -0,0 +1,43 @@ +# LED microprocessor initialization for Ingrasys S8900-54XC + +led 0 stop +led 0 prog 12 00 61 F1 12 10 61 F2 12 01 61 F3 12 01 61 F4 67 28 12 10 61 F1 12 05 61 F2 12 04 61 F3 12 04 61 F4 67 28 86 F0 77 86 96 F2 2E F1 67 3D 67 51 16 F3 FE F1 61 F1 12 00 DE F2 74 28 57 2E F1 32 00 32 01 B7 97 75 4C 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 6A 77 5A 06 FE D2 01 70 62 77 78 06 F0 C2 08 74 6A 77 78 16 F4 91 22 0E 87 22 0E 87 DA 00 74 6C 57 16 F4 91 22 0E 87 22 0F 87 DA 00 74 7A 57 02 48 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=36 REMAP_PORT_2=37 REMAP_PORT_1=38 REMAP_PORT_0=39 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=40 REMAP_PORT_6=41 REMAP_PORT_5=42 REMAP_PORT_4=43 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=12 REMAP_PORT_10=13 REMAP_PORT_9=14 REMAP_PORT_8=15 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=44 REMAP_PORT_14=45 REMAP_PORT_13=46 REMAP_PORT_12=47 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=48 REMAP_PORT_18=49 REMAP_PORT_17=50 REMAP_PORT_16=51 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=8 REMAP_PORT_22=9 REMAP_PORT_21=10 REMAP_PORT_20=11 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=4 REMAP_PORT_26=5 REMAP_PORT_25=6 REMAP_PORT_24=7 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=0 REMAP_PORT_30=1 REMAP_PORT_29=2 REMAP_PORT_28=3 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=52 REMAP_PORT_34=53 REMAP_PORT_33=54 REMAP_PORT_32=55 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=56 REMAP_PORT_38=57 REMAP_PORT_37=58 REMAP_PORT_36=59 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=32 REMAP_PORT_42=33 REMAP_PORT_41=34 REMAP_PORT_40=35 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=59 REMAP_PORT_46=60 REMAP_PORT_45=61 REMAP_PORT_44=62 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=28 REMAP_PORT_50=29 REMAP_PORT_49=30 REMAP_PORT_48=31 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=24 REMAP_PORT_54=25 REMAP_PORT_53=26 REMAP_PORT_52=27 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=20 REMAP_PORT_58=21 REMAP_PORT_57=22 REMAP_PORT_56=23 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=16 REMAP_PORT_62=17 REMAP_PORT_61=18 REMAP_PORT_60=19 +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 12 00 61 F1 12 20 61 F2 12 01 61 F3 12 01 61 F4 67 28 12 20 61 F1 12 01 61 F2 12 04 61 F3 12 04 61 F4 67 28 86 F0 77 86 96 F2 2E F1 67 3D 67 51 16 F3 FE F1 61 F1 12 00 DE F2 74 28 57 2E F1 32 00 32 01 B7 97 75 4C 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 6A 77 5A 06 FE D2 01 70 62 77 78 06 F0 C2 08 74 6A 77 78 16 F4 91 22 0E 87 22 0E 87 DA 00 74 6C 57 16 F4 91 22 0E 87 22 0F 87 DA 00 74 7A 57 02 48 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 REMAP_PORT_2=1 REMAP_PORT_1=2 REMAP_PORT_0=3 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 REMAP_PORT_6=5 REMAP_PORT_5=6 REMAP_PORT_4=7 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=8 REMAP_PORT_10=9 REMAP_PORT_9=10 REMAP_PORT_8=11 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=36 REMAP_PORT_14=37 REMAP_PORT_13=38 REMAP_PORT_12=39 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=12 REMAP_PORT_18=13 REMAP_PORT_17=14 REMAP_PORT_16=15 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=16 REMAP_PORT_22=17 REMAP_PORT_21=18 REMAP_PORT_20=19 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=40 REMAP_PORT_26=41 REMAP_PORT_25=42 REMAP_PORT_24=43 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=44 REMAP_PORT_30=45 REMAP_PORT_29=46 REMAP_PORT_28=47 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=20 REMAP_PORT_34=21 REMAP_PORT_33=22 REMAP_PORT_32=23 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=24 REMAP_PORT_38=25 REMAP_PORT_37=26 REMAP_PORT_36=27 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=48 REMAP_PORT_42=49 REMAP_PORT_41=50 REMAP_PORT_40=51 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=52 REMAP_PORT_46=53 REMAP_PORT_45=54 REMAP_PORT_44=55 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=28 REMAP_PORT_50=29 REMAP_PORT_49=30 REMAP_PORT_48=31 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=32 REMAP_PORT_54=33 REMAP_PORT_53=34 REMAP_PORT_52=35 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=56 REMAP_PORT_58=57 REMAP_PORT_57=58 REMAP_PORT_56=59 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=60 REMAP_PORT_62=61 REMAP_PORT_61=62 REMAP_PORT_60=63 +led 1 auto on +led 1 start diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/led_proc_init.soc b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/led_proc_init.soc new file mode 100644 index 000000000000..6a1f4f2c1ea6 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/led_proc_init.soc @@ -0,0 +1,43 @@ +# LED microprocessor initialization for Ingrasys S8900-64XC + +led 0 stop +led 0 prog 12 00 61 F1 12 20 61 F2 12 01 61 F3 12 01 61 F4 67 28 12 20 61 F1 12 04 61 F2 12 04 61 F3 12 01 61 F4 67 28 86 F0 77 86 96 F2 2E F1 67 3D 67 51 16 F3 FE F1 61 F1 12 00 DE F2 74 28 57 2E F1 32 00 32 01 B7 97 75 4C 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 6A 77 5A 06 FE D2 01 70 62 77 78 06 F0 C2 08 74 6A 77 78 16 F4 91 22 0E 87 22 0E 87 DA 00 74 6C 57 16 F4 91 22 0E 87 22 0F 87 DA 00 74 7A 57 02 48 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=28 REMAP_PORT_2=29 REMAP_PORT_1=30 REMAP_PORT_0=31 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=24 REMAP_PORT_6=25 REMAP_PORT_5=26 REMAP_PORT_4=27 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=20 REMAP_PORT_10=21 REMAP_PORT_9=22 REMAP_PORT_8=19 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=16 REMAP_PORT_14=17 REMAP_PORT_13=18 REMAP_PORT_12=23 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=12 REMAP_PORT_18=13 REMAP_PORT_17=14 REMAP_PORT_16=15 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=8 REMAP_PORT_22=9 REMAP_PORT_21=10 REMAP_PORT_20=11 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=4 REMAP_PORT_26=5 REMAP_PORT_25=6 REMAP_PORT_24=7 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=0 REMAP_PORT_30=1 REMAP_PORT_29=2 REMAP_PORT_28=3 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=60 REMAP_PORT_34=61 REMAP_PORT_33=62 REMAP_PORT_32=63 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=56 REMAP_PORT_38=57 REMAP_PORT_37=58 REMAP_PORT_36=59 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=52 REMAP_PORT_42=53 REMAP_PORT_41=54 REMAP_PORT_40=55 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=48 REMAP_PORT_46=49 REMAP_PORT_45=50 REMAP_PORT_44=51 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=44 REMAP_PORT_50=45 REMAP_PORT_49=46 REMAP_PORT_48=47 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=40 REMAP_PORT_54=41 REMAP_PORT_53=42 REMAP_PORT_52=43 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=36 REMAP_PORT_58=37 REMAP_PORT_57=38 REMAP_PORT_56=39 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=32 REMAP_PORT_62=33 REMAP_PORT_61=34 REMAP_PORT_60=35 +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 12 00 61 F1 12 10 61 F2 12 01 61 F3 12 01 61 F4 67 28 12 10 61 F1 12 0C 61 F2 12 04 61 F3 12 01 61 F4 67 28 86 F0 77 86 96 F2 2E F1 67 3D 67 51 16 F3 FE F1 61 F1 12 00 DE F2 74 28 57 2E F1 32 00 32 01 B7 97 75 4C 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 6A 77 5A 06 FE D2 01 70 62 77 78 06 F0 C2 08 74 6A 77 78 16 F4 91 22 0E 87 22 0E 87 DA 00 74 6C 57 16 F4 91 22 0E 87 22 0F 87 DA 00 74 7A 57 02 38 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 REMAP_PORT_2=1 REMAP_PORT_1=2 REMAP_PORT_0=3 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 REMAP_PORT_6=5 REMAP_PORT_5=6 REMAP_PORT_4=7 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=8 REMAP_PORT_10=9 REMAP_PORT_9=10 REMAP_PORT_8=11 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=12 REMAP_PORT_14=13 REMAP_PORT_13=14 REMAP_PORT_12=15 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=16 REMAP_PORT_18=17 REMAP_PORT_17=18 REMAP_PORT_16=19 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=20 REMAP_PORT_22=21 REMAP_PORT_21=22 REMAP_PORT_20=23 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=24 REMAP_PORT_26=25 REMAP_PORT_25=26 REMAP_PORT_24=27 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=28 REMAP_PORT_30=29 REMAP_PORT_29=30 REMAP_PORT_28=31 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=32 REMAP_PORT_34=33 REMAP_PORT_33=34 REMAP_PORT_32=35 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=36 REMAP_PORT_38=37 REMAP_PORT_37=38 REMAP_PORT_36=39 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=40 REMAP_PORT_42=41 REMAP_PORT_41=42 REMAP_PORT_40=43 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=44 REMAP_PORT_46=45 REMAP_PORT_45=46 REMAP_PORT_44=47 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=48 REMAP_PORT_50=49 REMAP_PORT_49=50 REMAP_PORT_48=51 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=52 REMAP_PORT_54=53 REMAP_PORT_53=54 REMAP_PORT_52=55 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=56 REMAP_PORT_58=57 REMAP_PORT_57=58 REMAP_PORT_56=59 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=60 REMAP_PORT_62=61 REMAP_PORT_61=62 REMAP_PORT_60=63 +led 1 auto on +led 1 start diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/led_proc_init.soc b/device/ingrasys/x86_64-ingrasys_s9100-r0/led_proc_init.soc index f3afa2c61899..492d3b897851 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/led_proc_init.soc +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/led_proc_init.soc @@ -1,43 +1,43 @@ -# LED microprocessor initialization for Ingrasys S9100 C32 +# LED microprocessor initialization for Ingrasys S9100-32X led 0 stop -led 0 prog 02 04 D2 01 74 0A 12 40 77 0C 12 00 02 04 D2 01 74 14 EA 03 29 61 F1 67 35 74 1F 67 54 67 7C 02 04 D2 01 74 2C 91 DA 00 74 0C 77 31 81 DA 40 74 0C 86 F0 77 CF 06 FD D2 00 70 51 D2 01 74 43 67 A6 77 51 D2 03 74 4B 67 AD 77 51 D2 02 74 51 67 B4 D2 00 57 02 A0 F1 04 D2 01 70 5E 77 68 01 C2 FC 77 69 01 C2 FE 77 69 01 28 32 00 32 01 B7 97 75 77 02 01 60 FE 57 02 00 60 FE 57 02 A0 F1 04 D2 01 70 96 77 A6 06 FE D2 01 70 8E 77 AD 06 F0 C2 08 74 A6 77 AD 06 FE D2 01 70 9E 77 B4 06 F0 C2 08 74 A6 77 B4 22 0E 87 22 0E 87 57 22 0F 87 22 0E 87 57 22 0E 87 22 0F 87 22 0E 87 22 0F 87 22 0E 87 22 0F 87 22 0E 87 22 0F 87 FA 03 57 02 04 D2 01 70 D9 02 80 77 DB 02 20 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=0x1f REMAP_PORT_1=0x1e REMAP_PORT_2=0x1d REMAP_PORT_3=0x1c -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=0x1b REMAP_PORT_5=0x1a REMAP_PORT_6=0x19 REMAP_PORT_7=0x18 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=0x17 REMAP_PORT_9=0x16 REMAP_PORT_10=0x15 REMAP_PORT_11=0x14 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=0x13 REMAP_PORT_13=0x12 REMAP_PORT_14=0x11 REMAP_PORT_15=0x10 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=0xf REMAP_PORT_17=0xe REMAP_PORT_18=0xd REMAP_PORT_19=0xc -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=0xb REMAP_PORT_21=0xa REMAP_PORT_22=0x9 REMAP_PORT_23=0x8 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=0x7 REMAP_PORT_25=0x6 REMAP_PORT_26=0x5 REMAP_PORT_27=0x4 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=0x3 REMAP_PORT_29=0x2 REMAP_PORT_30=0x1 REMAP_PORT_31=0x0 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=0x3f REMAP_PORT_33=0x3e REMAP_PORT_34=0x3d REMAP_PORT_35=0x3c -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=0x3b REMAP_PORT_37=0x3a REMAP_PORT_38=0x39 REMAP_PORT_39=0x38 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=0x37 REMAP_PORT_41=0x36 REMAP_PORT_42=0x35 REMAP_PORT_43=0x34 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=0x33 REMAP_PORT_45=0x32 REMAP_PORT_46=0x31 REMAP_PORT_47=0x30 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=0x2f REMAP_PORT_49=0x2e REMAP_PORT_50=0x2d REMAP_PORT_51=0x2c -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=0x2b REMAP_PORT_53=0x2a REMAP_PORT_54=0x29 REMAP_PORT_55=0x28 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=0x27 REMAP_PORT_57=0x26 REMAP_PORT_58=0x25 REMAP_PORT_59=0x24 -modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=0x23 REMAP_PORT_61=0x22 REMAP_PORT_62=0x21 REMAP_PORT_63=0x20 +led 0 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0E 87 22 0F 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=28 REMAP_PORT_2=29 REMAP_PORT_1=30 REMAP_PORT_0=31 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=24 REMAP_PORT_6=25 REMAP_PORT_5=26 REMAP_PORT_4=27 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=20 REMAP_PORT_10=21 REMAP_PORT_9=22 REMAP_PORT_8=23 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=16 REMAP_PORT_14=17 REMAP_PORT_13=18 REMAP_PORT_12=19 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=12 REMAP_PORT_18=13 REMAP_PORT_17=14 REMAP_PORT_16=15 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=8 REMAP_PORT_22=9 REMAP_PORT_21=10 REMAP_PORT_20=11 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=4 REMAP_PORT_26=5 REMAP_PORT_25=6 REMAP_PORT_24=7 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=0 REMAP_PORT_30=1 REMAP_PORT_29=2 REMAP_PORT_28=3 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=60 REMAP_PORT_34=61 REMAP_PORT_33=62 REMAP_PORT_32=63 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=56 REMAP_PORT_38=57 REMAP_PORT_37=58 REMAP_PORT_36=59 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=52 REMAP_PORT_42=53 REMAP_PORT_41=54 REMAP_PORT_40=55 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=48 REMAP_PORT_46=49 REMAP_PORT_45=50 REMAP_PORT_44=51 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=44 REMAP_PORT_50=45 REMAP_PORT_49=46 REMAP_PORT_48=47 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=40 REMAP_PORT_54=41 REMAP_PORT_53=42 REMAP_PORT_52=43 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=36 REMAP_PORT_58=37 REMAP_PORT_57=38 REMAP_PORT_56=39 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=32 REMAP_PORT_62=33 REMAP_PORT_61=34 REMAP_PORT_60=35 led 0 auto on led 0 start led 1 stop -led 1 prog 02 04 D2 01 74 0A 12 40 77 0C 12 00 02 04 D2 01 74 14 EA 03 29 61 F1 67 35 74 1F 67 54 67 7E 02 04 D2 01 74 2C 91 DA 00 74 0C 77 31 81 DA 40 74 0C 86 F0 77 D1 06 FD D2 00 70 51 D2 01 74 43 67 A8 77 51 D2 03 74 4B 67 AF 77 51 D2 02 74 51 67 B6 D2 00 57 02 A0 F1 04 D2 01 70 5E 77 68 01 C2 FC 77 69 01 C2 FE 77 69 01 F2 03 28 32 00 32 01 B7 97 75 79 02 01 60 FE 57 02 00 60 FE 57 02 A0 F1 04 D2 01 70 98 77 A8 06 FE D2 01 70 90 77 AF 06 F0 C2 08 74 A8 77 AF 06 FE D2 01 70 A0 77 B6 06 F0 C2 08 74 A8 77 B6 22 0E 87 22 0E 87 57 22 0F 87 22 0E 87 57 22 0E 87 22 0F 87 22 0E 87 22 0F 87 22 0E 87 22 0F 87 22 0E 87 22 0F 87 FA 03 57 02 04 D2 01 70 DB 02 80 77 DD 02 20 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=0x0 REMAP_PORT_1=0x1 REMAP_PORT_2=0x2 REMAP_PORT_3=0x3 -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=0x4 REMAP_PORT_5=0x5 REMAP_PORT_6=0x6 REMAP_PORT_7=0x7 -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=0x8 REMAP_PORT_9=0x9 REMAP_PORT_10=0xa REMAP_PORT_11=0xb -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=0xc REMAP_PORT_13=0xd REMAP_PORT_14=0xe REMAP_PORT_15=0xf -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=0x10 REMAP_PORT_17=0x11 REMAP_PORT_18=0x12 REMAP_PORT_19=0x13 -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=0x14 REMAP_PORT_21=0x15 REMAP_PORT_22=0x16 REMAP_PORT_23=0x17 -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=0x18 REMAP_PORT_25=0x19 REMAP_PORT_26=0x1a REMAP_PORT_27=0x1b -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=0x1c REMAP_PORT_29=0x1d REMAP_PORT_30=0x1e REMAP_PORT_31=0x1f -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=0x20 REMAP_PORT_33=0x21 REMAP_PORT_34=0x22 REMAP_PORT_35=0x23 -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=0x24 REMAP_PORT_37=0x25 REMAP_PORT_38=0x26 REMAP_PORT_39=0x27 -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=0x28 REMAP_PORT_41=0x29 REMAP_PORT_42=0x2a REMAP_PORT_43=0x2b -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=0x2c REMAP_PORT_45=0x2d REMAP_PORT_46=0x2e REMAP_PORT_47=0x2f -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=0x30 REMAP_PORT_49=0x31 REMAP_PORT_50=0x32 REMAP_PORT_51=0x33 -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=0x34 REMAP_PORT_53=0x35 REMAP_PORT_54=0x36 REMAP_PORT_55=0x37 -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=0x38 REMAP_PORT_57=0x39 REMAP_PORT_58=0x3a REMAP_PORT_59=0x3b -modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=0x3c REMAP_PORT_61=0x3d REMAP_PORT_62=0x3e REMAP_PORT_63=0x3f +led 1 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0E 87 22 0F 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 REMAP_PORT_2=1 REMAP_PORT_1=2 REMAP_PORT_0=3 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 REMAP_PORT_6=5 REMAP_PORT_5=6 REMAP_PORT_4=7 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=8 REMAP_PORT_10=9 REMAP_PORT_9=10 REMAP_PORT_8=11 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=12 REMAP_PORT_14=13 REMAP_PORT_13=14 REMAP_PORT_12=15 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=16 REMAP_PORT_18=17 REMAP_PORT_17=18 REMAP_PORT_16=19 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=20 REMAP_PORT_22=21 REMAP_PORT_21=22 REMAP_PORT_20=23 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=24 REMAP_PORT_26=25 REMAP_PORT_25=26 REMAP_PORT_24=27 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=28 REMAP_PORT_30=29 REMAP_PORT_29=30 REMAP_PORT_28=31 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=32 REMAP_PORT_34=33 REMAP_PORT_33=34 REMAP_PORT_32=35 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=36 REMAP_PORT_38=37 REMAP_PORT_37=38 REMAP_PORT_36=39 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=40 REMAP_PORT_42=41 REMAP_PORT_41=42 REMAP_PORT_40=43 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=44 REMAP_PORT_46=45 REMAP_PORT_45=46 REMAP_PORT_44=47 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=48 REMAP_PORT_50=49 REMAP_PORT_49=50 REMAP_PORT_48=51 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=52 REMAP_PORT_54=53 REMAP_PORT_53=54 REMAP_PORT_52=55 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=56 REMAP_PORT_58=57 REMAP_PORT_57=58 REMAP_PORT_56=59 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=60 REMAP_PORT_62=61 REMAP_PORT_61=62 REMAP_PORT_60=63 led 1 auto on led 1 start From 7d95fd7e8c30eb6c94706c4ff3a2df330dd0ee90 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 25 Jul 2017 09:49:39 +0300 Subject: [PATCH 0691/1833] [rules/functions][slave.mk]: Refine build output (#838) Print current build configuration before run Update screen with currently running targets (only available if TERM is available) Change format of printed targets Signed-off-by: marian-pritsak --- rules/config | 10 ------ rules/functions | 23 +++---------- slave.mk | 24 ++++++++----- update_screen.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+), 36 deletions(-) create mode 100755 update_screen.sh diff --git a/rules/config b/rules/config index 66f936c1fa03..5403c981f170 100644 --- a/rules/config +++ b/rules/config @@ -2,10 +2,6 @@ ## Configuration parameters for SONiC build system ############################################################################### -# SONIC_CONFIG_VERBOSE - enable echoing for rules commands. -# Uncomment next line to enable: -# SONIC_CONFIG_VERBOSE = y - # SONIC_CONFIG_PRINT_DEPENDENCIES - show dependencies for each invoked target. # Before executing rule for each target its dependencies are printed to console. # Uncomment next line to enable: @@ -21,12 +17,6 @@ SONIC_CONFIG_BUILD_JOBS = 1 # container. SONIC_CONFIG_MAKE_JOBS = $(shell nproc) -# SONIC_CONFIG_LOG_TO_FILES - print output from execution of rule for each -# target into separate log file under target/log/. -# Useful when executing parallel build -# Uncomment next line to enable: -SONIC_CONFIG_LOG_TO_FILES = y - # SONIC_CONFIG_ENABLE_COLORS - enable colored output in build system. # Comment next line to disable: # SONIC_CONFIG_ENABLE_COLORS = y diff --git a/rules/functions b/rules/functions index 4379d85c9ed8..93e2a346274e 100644 --- a/rules/functions +++ b/rules/functions @@ -41,43 +41,30 @@ log_green = echo -e "$(GREEN)$(1)$(GRAY)" ## Logging ############################################################################### -ifeq ($(SONIC_CONFIG_LOG_TO_FILES),y) FLUSH_LOG = rm -f $@.log -LOG = &>> $(PROJECT_ROOT)/$@.log || { [ $$? -eq 0 ] || cat $(PROJECT_ROOT)/$@.log ; false ; } -endif +LOG = &>> $(PROJECT_ROOT)/$@.log || { [ $$? -eq 0 ] || pushd $(PROJECT_ROOT) > /dev/null ; ./update_screen.sh -e $@ ; popd > /dev/null ; false ; } ############################################################################### ## Header and footer for each target ############################################################################### -# Print name of target being built -PRINT_TARGET = $(call log_purple,Executing rules for $@) - -# Print name of target that finished build -PRINT_END_TARGET = $(call log_green,Finished $@) - # Dump targets taht current depends on ifeq ($(SONIC_CONFIG_PRINT_DEPENDENCIES),y) -PRINT_DEPENDENCIES = $(call log_blue,Dependencies for $@ are $^) -endif - -# Enable verbose mode -ifneq ($(SONIC_CONFIG_VERBOSE),y) -ENABLE_VERBOSE = @ +PRINT_DEPENDENCIES = echo Dependencies for $@ are $^ $(LOG) endif # header for each rule define HEADER -$(ENABLE_VERBOSE) -$(PRINT_TARGET) +@ $(PRINT_DEPENDENCIES) $(FLUSH_LOG) +./update_screen.sh -a $@ endef # footer for each rule define FOOTER -$(PRINT_END_TARGET) +./update_screen.sh -d $@ endef ############################################################################### diff --git a/slave.mk b/slave.mk index 4bd158da7187..abd7458bd98c 100644 --- a/slave.mk +++ b/slave.mk @@ -80,13 +80,21 @@ export SONIC_CONFIG_MAKE_JOBS ## Dumping key config attributes associated to current building exercise ############################################################################### -ifndef $(CONFIGURED_PLATFORM) -$(info CONFIGURED_PLATFORM is $(CONFIGURED_PLATFORM)) -endif - -ifndef $(SONIC_ROUTING_STACK) -$(info ROUTING_STACK is $(SONIC_ROUTING_STACK)) -endif +$(info SONiC Build System) +$(info ) +$(info Build Configuration) +$(info "CONFIGURED_PLATFORM" : "$(if $(PLATFORM),$(PLATFORM),$(CONFIGURED_PLATFORM))") +$(info "SONIC_CONFIG_PRINT_DEPENDENCIES" : "$(SONIC_CONFIG_PRINT_DEPENDENCIES)") +$(info "SONIC_CONFIG_BUILD_JOBS" : "$(SONIC_CONFIG_BUILD_JOBS)") +$(info "SONIC_CONFIG_MAKE_JOBS" : "$(SONIC_CONFIG_MAKE_JOBS)") +$(info "DEFAULT_USERNAME" : "$(DEFAULT_USERNAME)") +$(info "DEFAULT_PASSWORD" : "$(DEFAULT_PASSWORD)") +$(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)") +$(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)") +$(info "SONIC_CONFIG_DEBUG" : "$(SONIC_CONFIG_DEBUG)") +$(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)") +$(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)") +$(info ) ############################################################################### ## Generic rules section @@ -241,7 +249,7 @@ SONIC_INSTALL_TARGETS = $(addsuffix -install,$(addprefix $(DEBS_PATH)/, \ $(SONIC_EXTRA_DEBS))) $(SONIC_INSTALL_TARGETS) : $(DEBS_PATH)/%-install : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(DEBS_PATH)/$$* $(HEADER) - [ -f $(DEBS_PATH)/$* ] || { echo $(DEBS_PATH)/$* does not exist $(LOG) && exit 1; } + [ -f $(DEBS_PATH)/$* ] || { echo $(DEBS_PATH)/$* does not exist $(LOG) && false $(LOG) } # put a lock here because dpkg does not allow installing packages in parallel while true; do if mkdir $(DEBS_PATH)/dpkg_lock &> /dev/null; then diff --git a/update_screen.sh b/update_screen.sh new file mode 100755 index 000000000000..de54774cc6c6 --- /dev/null +++ b/update_screen.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +lockfile .screen + +target_list_file=/tmp/target_list +touch ${target_list_file} + +function scroll_up { +# Check if TERM is available +[[ "${TERM}" == "dumb" ]] && return + +for i in $(cat ${target_list_file}); do + tput cuu1 + tput el +done +} + +function print_targets { +# Check if TERM is available +[[ "${TERM}" == "dumb" ]] && return + +count=1 +for i in $(cat ${target_list_file}); do + printf "[ %02d ] [ %s ]\n" "${count}" "$i" + ((count++)) +done +} + +function remove_target { +# Check if TERM is available +[[ "${TERM}" == "dumb" ]] && echo "[ finished ] [ $1 ] " && return + +old_list=$(cat ${target_list_file}) +rm ${target_list_file} +for target in ${old_list}; do + if [[ "${target}" != "$1" ]]; then + echo ${target} >> ${target_list_file} + fi +done +touch ${target_list_file} +} + +function add_target { +# Check if TERM is available +[[ "${TERM}" == "dumb" ]] && echo "[ building ] [ $1 ] " && return + +echo $1 >> ${target_list_file} +} + +function print_targets_delay { +sleep 2 && print_targets && rm -f .screen & +exit 0 +} + +while getopts ":a:d:e:" opt; do + case $opt in + a) + scroll_up + add_target ${OPTARG} + print_targets + ;; + d) + scroll_up + remove_target ${OPTARG} + print_targets + ;; + e) + scroll_up + remove_target ${OPTARG} + echo "[ FAIL LOG START ] [ ${OPTARG} ]" + cat ${OPTARG}.log + echo "[ FAIL LOG END ] [ ${OPTARG} ]" + print_targets_delay + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + rm -f .screen + exit 1 + ;; + :) + echo "Option -$OPTARG requires an argument." >&2 + rm -f .screen + exit 1 + ;; + esac +done + +rm -f .screen From c1fd0b1ae578670d4621ee99fd1ba85fcf4c162b Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Tue, 25 Jul 2017 10:05:27 +0300 Subject: [PATCH 0692/1833] [orchagent]: Export platform information before orchagent run. (#835) Export platform information in environment to be able to write vendor specific code. --- dockers/docker-orchagent/orchagent.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 8dc1b859ee25..328ce8fc053d 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +# Export platform information. Required to be able to write +# vendor specific code. +export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v onie_switch_asic` + ASIC=`sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type` MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` From 4d5420b8652298d7005fdd9bf23ac74bfba6fe01 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 25 Jul 2017 07:09:23 -0700 Subject: [PATCH 0693/1833] [minigraph]: Ignore eth0 IPv6 addresses (#841) - IPv6 is not supported on management interface - Add unit test --- src/sonic-config-engine/minigraph.py | 3 + .../tests/sample_output/interfaces | 259 ++++++++++++++++++ .../tests/t0-sample-graph.xml | 8 + src/sonic-config-engine/tests/test_j2files.py | 5 +- 4 files changed, 273 insertions(+), 2 deletions(-) create mode 100644 src/sonic-config-engine/tests/sample_output/interfaces diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 1fd16f376fab..65738a0508f5 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -188,6 +188,9 @@ def parse_dpg(dpg, hname): for mgmtintf in mgmtintfs.findall(str(QName(ns1, "ManagementIPInterface"))): ipprefix = mgmtintf.find(str(QName(ns1, "PrefixStr"))).text mgmtipn = ipaddress.IPNetwork(ipprefix) + # Ignore IPv6 management address + if mgmtipn.version == 6: + continue ipaddr = mgmtipn.ip prefix_len = str(mgmtipn.prefixlen) ipmask = mgmtipn.netmask diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces new file mode 100644 index 000000000000..5c57bf8fac85 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -0,0 +1,259 @@ +# +# =============== Managed by SONiC Config Engine DO NOT EDIT! =============== +# generated from /usr/share/sonic/templates/interfaces.j2 using sonic-cfggen +# file: /etc/network/interfaces +# +# The loopback network interface +auto lo +iface lo inet loopback +# Use command 'ip addr list dev lo' to check all addresses +iface lo inet static + address 10.1.0.32 + netmask 255.255.255.255 +# +iface lo inet6 static + address fc00:1::32 + netmask 128 +# +# The management network interface +auto eth0 +iface eth0 inet static + address 10.0.0.100 + netmask 255.255.255.0 + ########## management network policy routing rules + # management port up rules + up ip route add default via 10.0.0.1 dev eth0 table default + up ip rule add from 10.0.0.100/32 table default + # management port down rules + down ip route delete default via 10.0.0.1 dev eth0 table default + down ip rule delete from 10.0.0.100/32 table default +# +# The switch front panel interfaces +# "|| true" is added to suppress the error when interface is already a member of VLAN +allow-hotplug fortyGigE0/4 +iface fortyGigE0/4 inet manual + pre-up ifconfig fortyGigE0/4 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/4 || true + post-down ifconfig fortyGigE0/4 down +# +allow-hotplug fortyGigE0/8 +iface fortyGigE0/8 inet manual + pre-up ifconfig fortyGigE0/8 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/8 || true + post-down ifconfig fortyGigE0/8 down +# +allow-hotplug fortyGigE0/12 +iface fortyGigE0/12 inet manual + pre-up ifconfig fortyGigE0/12 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/12 || true + post-down ifconfig fortyGigE0/12 down +# +allow-hotplug fortyGigE0/16 +iface fortyGigE0/16 inet manual + pre-up ifconfig fortyGigE0/16 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/16 || true + post-down ifconfig fortyGigE0/16 down +# +allow-hotplug fortyGigE0/20 +iface fortyGigE0/20 inet manual + pre-up ifconfig fortyGigE0/20 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/20 || true + post-down ifconfig fortyGigE0/20 down +# +allow-hotplug fortyGigE0/24 +iface fortyGigE0/24 inet manual + pre-up ifconfig fortyGigE0/24 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/24 || true + post-down ifconfig fortyGigE0/24 down +# +allow-hotplug fortyGigE0/28 +iface fortyGigE0/28 inet manual + pre-up ifconfig fortyGigE0/28 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/28 || true + post-down ifconfig fortyGigE0/28 down +# +allow-hotplug fortyGigE0/32 +iface fortyGigE0/32 inet manual + pre-up ifconfig fortyGigE0/32 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/32 || true + post-down ifconfig fortyGigE0/32 down +# +allow-hotplug fortyGigE0/36 +iface fortyGigE0/36 inet manual + pre-up ifconfig fortyGigE0/36 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/36 || true + post-down ifconfig fortyGigE0/36 down +# +allow-hotplug fortyGigE0/40 +iface fortyGigE0/40 inet manual + pre-up ifconfig fortyGigE0/40 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/40 || true + post-down ifconfig fortyGigE0/40 down +# +allow-hotplug fortyGigE0/44 +iface fortyGigE0/44 inet manual + pre-up ifconfig fortyGigE0/44 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/44 || true + post-down ifconfig fortyGigE0/44 down +# +allow-hotplug fortyGigE0/48 +iface fortyGigE0/48 inet manual + pre-up ifconfig fortyGigE0/48 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/48 || true + post-down ifconfig fortyGigE0/48 down +# +allow-hotplug fortyGigE0/52 +iface fortyGigE0/52 inet manual + pre-up ifconfig fortyGigE0/52 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/52 || true + post-down ifconfig fortyGigE0/52 down +# +allow-hotplug fortyGigE0/56 +iface fortyGigE0/56 inet manual + pre-up ifconfig fortyGigE0/56 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/56 || true + post-down ifconfig fortyGigE0/56 down +# +allow-hotplug fortyGigE0/60 +iface fortyGigE0/60 inet manual + pre-up ifconfig fortyGigE0/60 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/60 || true + post-down ifconfig fortyGigE0/60 down +# +allow-hotplug fortyGigE0/64 +iface fortyGigE0/64 inet manual + pre-up ifconfig fortyGigE0/64 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/64 || true + post-down ifconfig fortyGigE0/64 down +# +allow-hotplug fortyGigE0/68 +iface fortyGigE0/68 inet manual + pre-up ifconfig fortyGigE0/68 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/68 || true + post-down ifconfig fortyGigE0/68 down +# +allow-hotplug fortyGigE0/72 +iface fortyGigE0/72 inet manual + pre-up ifconfig fortyGigE0/72 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/72 || true + post-down ifconfig fortyGigE0/72 down +# +allow-hotplug fortyGigE0/76 +iface fortyGigE0/76 inet manual + pre-up ifconfig fortyGigE0/76 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/76 || true + post-down ifconfig fortyGigE0/76 down +# +allow-hotplug fortyGigE0/80 +iface fortyGigE0/80 inet manual + pre-up ifconfig fortyGigE0/80 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/80 || true + post-down ifconfig fortyGigE0/80 down +# +allow-hotplug fortyGigE0/84 +iface fortyGigE0/84 inet manual + pre-up ifconfig fortyGigE0/84 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/84 || true + post-down ifconfig fortyGigE0/84 down +# +allow-hotplug fortyGigE0/88 +iface fortyGigE0/88 inet manual + pre-up ifconfig fortyGigE0/88 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/88 || true + post-down ifconfig fortyGigE0/88 down +# +allow-hotplug fortyGigE0/92 +iface fortyGigE0/92 inet manual + pre-up ifconfig fortyGigE0/92 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/92 || true + post-down ifconfig fortyGigE0/92 down +# +allow-hotplug fortyGigE0/96 +iface fortyGigE0/96 inet manual + pre-up ifconfig fortyGigE0/96 up mtu 9216 + post-up brctl addif Vlan1000 fortyGigE0/96 || true + post-down ifconfig fortyGigE0/96 down +# +# "|| true" is added to suppress the error when interface is already a member of LAG +# "ip link show | grep -q master" is added to ensure interface is enslaved +allow-hotplug fortyGigE0/112 +iface fortyGigE0/112 inet manual + pre-up teamdctl PortChannel01 port add fortyGigE0/112 || true + post-up ip link show fortyGigE0/112 | grep -q master && ifconfig fortyGigE0/112 up + post-down ifconfig fortyGigE0/112 down +# +allow-hotplug fortyGigE0/116 +iface fortyGigE0/116 inet manual + pre-up teamdctl PortChannel02 port add fortyGigE0/116 || true + post-up ip link show fortyGigE0/116 | grep -q master && ifconfig fortyGigE0/116 up + post-down ifconfig fortyGigE0/116 down +# +allow-hotplug fortyGigE0/120 +iface fortyGigE0/120 inet manual + pre-up teamdctl PortChannel03 port add fortyGigE0/120 || true + post-up ip link show fortyGigE0/120 | grep -q master && ifconfig fortyGigE0/120 up + post-down ifconfig fortyGigE0/120 down +# +allow-hotplug fortyGigE0/124 +iface fortyGigE0/124 inet manual + pre-up teamdctl PortChannel04 port add fortyGigE0/124 || true + post-up ip link show fortyGigE0/124 | grep -q master && ifconfig fortyGigE0/124 up + post-down ifconfig fortyGigE0/124 down +# +# Vlan interfaces +auto Vlan1000 +iface Vlan1000 inet static + bridge_ports none + address 192.168.0.1 + netmask 255.255.255.224 +# +# Portchannel interfaces +allow-hotplug PortChannel01 +iface PortChannel01 inet static + mtu 9216 + address 10.0.0.56 + netmask 255.255.255.254 +# +allow-hotplug PortChannel01 +iface PortChannel01 inet6 static + mtu 9216 + address fc00::71 + netmask 126 +# +allow-hotplug PortChannel02 +iface PortChannel02 inet static + mtu 9216 + address 10.0.0.58 + netmask 255.255.255.254 +# +allow-hotplug PortChannel02 +iface PortChannel02 inet6 static + mtu 9216 + address fc00::75 + netmask 126 +# +allow-hotplug PortChannel03 +iface PortChannel03 inet static + mtu 9216 + address 10.0.0.60 + netmask 255.255.255.254 +# +allow-hotplug PortChannel03 +iface PortChannel03 inet6 static + mtu 9216 + address fc00::79 + netmask 126 +# +allow-hotplug PortChannel04 +iface PortChannel04 inet static + mtu 9216 + address 10.0.0.62 + netmask 255.255.255.254 +# +allow-hotplug PortChannel04 +iface PortChannel04 inet6 static + mtu 9216 + address fc00::7d + netmask 126 +# + diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index e359b4fa629f..62a41105f937 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -163,6 +163,14 @@ 10.0.0.100/24 + + HostIP + eth0 + + 2603:10e2:0:2902::8/64 + + 2603:10e2:0:2902::8/64 + diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 238d8c815514..0f9264eb1d3b 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -20,8 +20,9 @@ def run_script(self, argument): def test_interfaces(self): interfaces_template = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'interfaces', 'interfaces.j2') - argument = '-m "' + self.t0_minigraph + '" -p "' + self.t0_port_config + '" -t "' + interfaces_template + '"' - output = self.run_script(argument) + argument = '-m ' + self.t0_minigraph + ' -t ' + interfaces_template + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'interfaces'), self.output_file)) def test_alias_map(self): alias_map_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-snmp-sv2', 'alias_map.j2') From 987aec3565555618ab6a5216ac56577eb23aa03c Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Wed, 26 Jul 2017 16:19:24 +0700 Subject: [PATCH 0694/1833] [platform] Update for celestica DX010 platform. (#844) --- platform/broadcom/platform-modules-cel.mk | 2 +- platform/broadcom/sonic-platform-modules-cel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 37dce948d3d5..09e8b374e861 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -1,6 +1,6 @@ # Celestica DX010 Platform modules -CEL_DX010_PLATFORM_MODULE_VERSION = 0.5 +CEL_DX010_PLATFORM_MODULE_VERSION = 0.6 export CEL_DX010_PLATFORM_MODULE_VERSION diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel index 514e76c2296f..be37af0179d9 160000 --- a/platform/broadcom/sonic-platform-modules-cel +++ b/platform/broadcom/sonic-platform-modules-cel @@ -1 +1 @@ -Subproject commit 514e76c2296fa3c7736f6cabbe429f1070b3bcac +Subproject commit be37af0179d97f1855fdec1f81c566ea69f5bb87 From 1c165067af72e4e972ad683af1e9112e1f790483 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 27 Jul 2017 07:52:12 +0300 Subject: [PATCH 0695/1833] [Makefile]: Remove lockfile before build (#847) In case previous build was forcefully stopped, we need to remove screen lock so that build won't be stuck. Signed-off-by: marian-pritsak --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 8742e329f07c..ee3c292732c6 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,9 @@ SHELL = /bin/bash USER := $(shell id -un) PWD := $(shell pwd) +# Remove lock file in case previous run was forcefully stopped +$(shell rm -f .screen) + MAKEFLAGS += -B SLAVE_TAG = $(shell shasum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') From 829a205b85f8226d522437a655881bcc97f54a2e Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 27 Jul 2017 19:52:22 -0700 Subject: [PATCH 0696/1833] [config services] Not to block syslog service on minigraph update (#850) --- files/image_config/rsyslog/rsyslog-config.service | 1 - files/image_config/rsyslog/rsyslog-config.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/rsyslog/rsyslog-config.service b/files/image_config/rsyslog/rsyslog-config.service index ad72e9c2ea9a..be3c209e7560 100644 --- a/files/image_config/rsyslog/rsyslog-config.service +++ b/files/image_config/rsyslog/rsyslog-config.service @@ -1,6 +1,5 @@ [Unit] Description=Update rsyslog configuration -Before=rsyslog.service [Service] Type=oneshot diff --git a/files/image_config/rsyslog/rsyslog-config.sh b/files/image_config/rsyslog/rsyslog-config.sh index 044888029686..06a4934a4be5 100755 --- a/files/image_config/rsyslog/rsyslog-config.sh +++ b/files/image_config/rsyslog/rsyslog-config.sh @@ -1,3 +1,4 @@ #!/bin/bash sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf +systemctl restart rsyslog From 382d52843f08f79f6680bdaeefcc47382b6f7e77 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 28 Jul 2017 20:57:51 +0300 Subject: [PATCH 0697/1833] [mellanox]: Move FW upgrade script to base image. (#849) - Download files to target/files directory (instead of target/debs) - Clean python-weels log files --- .../build_templates/sonic_debian_extension.j2 | 6 ++++ files/build_templates/swss.service.j2 | 4 ++- .../broadcom/docker-syncd-brcm/Dockerfile.j2 | 2 +- platform/mellanox/docker-syncd-mlnx-rpc.mk | 1 - platform/mellanox/docker-syncd-mlnx.mk | 3 +- .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 3 +- platform/mellanox/fw.mk | 2 ++ .../mlnx-fw-upgrade.sh | 3 -- platform/mellanox/one-image.mk | 1 + slave.mk | 28 +++++++++++++------ 10 files changed, 35 insertions(+), 18 deletions(-) rename platform/mellanox/{docker-syncd-mlnx => }/mlnx-fw-upgrade.sh (94%) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 77c5457327cc..a84b7070a560 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -221,3 +221,9 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get autor sudo cp {{src}} $FILESYSTEM_ROOT/{{dst}} {% endif -%} {% endfor -%} + +{% if sonic_asic_platform == "mellanox" %} +sudo mkdir -p $FILESYSTEM_ROOT/etc/mlnx/ +sudo cp target/files/$MLNX_FW $FILESYSTEM_ROOT/etc/mlnx/fw-SPC.mfa +sudo cp platform/mellanox/mlnx-fw-upgrade.sh $FILESYSTEM_ROOT/usr/bin/ +{% endif %} diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 1fc9127f260e..ed6b852f18f9 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -18,8 +18,10 @@ ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB {% if sonic_asic_platform == 'mellanox' %} -ExecStartPre=/etc/init.d/sxdkernel start +TimeoutStartSec=3min ExecStartPre=/usr/bin/mst start +ExecStartPre=/usr/bin/mlnx-fw-upgrade.sh +ExecStartPre=/etc/init.d/sxdkernel start ExecStartPre=/sbin/modprobe i2c-dev ExecStartPre=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -v platform)/hw-management start" {% elif sonic_asic_platform == 'cavium' %} diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 76af952cef18..96ae65ee8897 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -19,7 +19,7 @@ debs/{{ deb }}{{' '}} ## TODO: add kmod into Depends RUN apt-get install -f kmod -COPY ["debs/dsserve", "debs/bcmcmd", "start.sh", "/usr/bin/"] +COPY ["files/dsserve", "files/bcmcmd", "start.sh", "/usr/bin/"] RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index e8e55e71e8e5..f27242ce17dc 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -3,7 +3,6 @@ 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) -$(DOCKER_SYNCD_MLNX_RPC)_FILES += $(MLNX_FW) $(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 2675399b705e..2da5961fc046 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -2,8 +2,7 @@ DOCKER_SYNCD_MLNX = docker-syncd-mlnx.gz $(DOCKER_SYNCD_MLNX)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx -$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(MFT) $(PYTHON_SDK_API) -$(DOCKER_SYNCD_MLNX)_FILES += $(MLNX_FW) +$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) ifneq ($(ENABLE_SYNCD_RPC),y) diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 79661e0ef7fa..966ef35ac9c8 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -18,9 +18,8 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY ["start.sh", "mlnx-fw-upgrade.sh", "/usr/bin/"] +COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["/debs/fw-SPC-*-EVB.mfa", "/etc/mlnx/fw-SPC.mfa"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 8260b9d566d4..8e916d817602 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -3,3 +3,5 @@ MLNX_FW = fw-SPC-rel-13_1224_0140-EVB.mfa $(MLNX_FW)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW) SONIC_ONLINE_FILES += $(MLNX_FW) + +export MLNX_FW diff --git a/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh b/platform/mellanox/mlnx-fw-upgrade.sh similarity index 94% rename from platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh rename to platform/mellanox/mlnx-fw-upgrade.sh index 0efb3ce9ecdd..b27d7095e2e2 100755 --- a/platform/mellanox/docker-syncd-mlnx/mlnx-fw-upgrade.sh +++ b/platform/mellanox/mlnx-fw-upgrade.sh @@ -47,7 +47,4 @@ if [[ ${required_fw_version} == ${fw_version} ]]; then else echo "Mellanox firmware required version is ${required_fw_version}. Installing compatible version..." run_or_fail "mlxfwmanager -i ${fw_file} -u -f -y" - - # exit from here so that syncd service will restart - exit 0 fi diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk index 1aa8da3928da..9293e6a727e9 100644 --- a/platform/mellanox/one-image.mk +++ b/platform/mellanox/one-image.mk @@ -5,4 +5,5 @@ $(SONIC_ONE_IMAGE)_MACHINE = mellanox $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_DEPENDS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +$(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/slave.mk b/slave.mk index abd7458bd98c..745dc2baa143 100644 --- a/slave.mk +++ b/slave.mk @@ -24,6 +24,7 @@ RULES_PATH = rules TARGET_PATH = target DOCKERS_PATH = dockers DEBS_PATH = $(TARGET_PATH)/debs +FILES_PATH = $(TARGET_PATH)/files PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels PROJECT_ROOT = $(shell pwd) @@ -44,6 +45,7 @@ endif configure : @mkdir -p target/debs + @mkdir -p target/files @mkdir -p target/python-wheels @echo $(PLATFORM) > .platform @@ -121,9 +123,9 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) : $(DEBS_PATH)/% : .platform # SOME_NEW_FILE = some_new_file # $(SOME_NEW_FILE)_PATH = path/to/some_new_file # SONIC_COPY_FILES += $(SOME_NEW_FILE) -$(addprefix $(DEBS_PATH)/, $(SONIC_COPY_FILES)) : $(DEBS_PATH)/% : .platform +$(addprefix $(FILES_PATH)/, $(SONIC_COPY_FILES)) : $(FILES_PATH)/% : .platform $(HEADER) - cp $($*_PATH)/$* $(DEBS_PATH)/ $(LOG) || exit 1 + cp $($*_PATH)/$* $(FILES_PATH)/ $(LOG) || exit 1 $(FOOTER) ############################################################################### @@ -147,7 +149,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS)) : $(DEBS_PATH)/% : .platform # SOME_NEW_FILE = some_new_file # $(SOME_NEW_FILE)_URL = https://url/to/this/file # SONIC_ONLINE_FILES += $(SOME_NEW_FILE) -$(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_FILES)) : $(DEBS_PATH)/% : .platform +$(addprefix $(FILES_PATH)/, $(SONIC_ONLINE_FILES)) : $(FILES_PATH)/% : .platform $(HEADER) wget --no-use-server-timestamps -O $@ $($*_URL) $(LOG) $(FOOTER) @@ -313,11 +315,13 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g $(FOOTER) # Targets for building docker images -$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS) $$($$*.gz_FILES)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $$($$*.gz_PATH)/Dockerfile.j2 +$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS)) $$(addprefix $(FILES_PATH)/,$$($$*.gz_FILES)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $$($$*.gz_PATH)/Dockerfile.j2 $(HEADER) mkdir -p $($*.gz_PATH)/debs $(LOG) + mkdir -p $($*.gz_PATH)/files $(LOG) mkdir -p $($*.gz_PATH)/python-wheels $(LOG) sudo mount --bind $(DEBS_PATH) $($*.gz_PATH)/debs $(LOG) + sudo mount --bind $(FILES_PATH) $($*.gz_PATH)/files $(LOG) sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG) # Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')) @@ -341,7 +345,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) $(HEADER) ## Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" @@ -411,11 +415,19 @@ SONIC_CLEAN_DEBS = $(addsuffix -clean,$(addprefix $(DEBS_PATH)/, \ $(SONIC_PYTHON_STDEB_DEBS) \ $(SONIC_DERIVED_DEBS) \ $(SONIC_EXTRA_DEBS))) + +SONIC_CLEAN_FILES = $(addsuffix -clean,$(addprefix $(FILES_PATH)/, \ + $(SONIC_ONLINE_FILES) \ + $(SONIC_COPY_FILES))) + $(SONIC_CLEAN_DEBS) : $(DEBS_PATH)/%-clean : .platform $$(addsuffix -clean,$$(addprefix $(DEBS_PATH)/,$$($$*_MAIN_DEB))) @# remove derived or extra targets if main one is removed, because we treat them @# as part of one package @rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) +$(SONIC_CLEAN_FILES) : $(FILES_PATH)/%-clean : .platform + @rm -f $(FILES_PATH)/$* + SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \ $(SONIC_DOCKER_IMAGES) \ $(SONIC_SIMPLE_DOCKER_IMAGES) \ @@ -429,9 +441,9 @@ $(SONIC_CLEAN_WHEELS) : $(PYTHON_WHEELS_PATH)/%-clean : .platform @rm -f $(PYTHON_WHEELS_PATH)/$* clean-logs : .platform - @rm -f $(TARGET_PATH)/*.log $(DEBS_PATH)/*.log + @rm -f $(TARGET_PATH)/*.log $(DEBS_PATH)/*.log $(FILES_PATH)/*.log $(PYTHON_WHEELS_PATH)/*.log -clean : .platform clean-logs $$(SONIC_CLEAN_DEBS) $$(SONIC_CLEAN_TARGETS) $$(SONIC_CLEAN_WHEELS) +clean : .platform clean-logs $$(SONIC_CLEAN_DEBS) $$(SONIC_CLEAN_FILES) $$(SONIC_CLEAN_TARGETS) $$(SONIC_CLEAN_WHEELS) ############################################################################### ## all @@ -443,6 +455,6 @@ all : .platform $$(addprefix $(TARGET_PATH)/,$$(SONIC_ALL)) ## Standard targets ############################################################################### -.PHONY : $(SONIC_CLEAN_DEBS) $(SONIC_CLEAN_TARGETS) $(SONIC_CLEAN_WHEELS) clean distclean configure +.PHONY : $(SONIC_CLEAN_DEBS) $(SONIC_CLEAN_FILES) $(SONIC_CLEAN_TARGETS) $(SONIC_CLEAN_WHEELS) clean distclean configure .INTERMEDIATE : $(SONIC_INSTALL_TARGETS) $(SONIC_INSTALL_WHEELS) $(DOCKER_LOAD_TARGETS) docker-start .platform From 175b952508e18e751be80a9fb46a9478c24ca1ff Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Sun, 30 Jul 2017 01:34:27 +0300 Subject: [PATCH 0698/1833] [slave.mk]: Add list target (#856) Add new target to list all available packages, files, docker images and installers. Signed-off-by: marian-pritsak --- README.buildsystem.md | 5 +++++ slave.mk | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/README.buildsystem.md b/README.buildsystem.md index 666ddf026540..d68e190e1f10 100644 --- a/README.buildsystem.md +++ b/README.buildsystem.md @@ -201,4 +201,9 @@ sonic-slave environment is built only once, but if sonic-slave/Dockerfile was up $ make sonic-slave-build ``` +One can print out all available targets by executing the following command: +``` +$ make list +``` + All target groups are used by one or another recipe, so use those recipes as a reference when adding new ones. diff --git a/slave.mk b/slave.mk index 745dc2baa143..cc4a59a6d881 100644 --- a/slave.mk +++ b/slave.mk @@ -52,6 +52,9 @@ configure : distclean : .platform clean @rm -f .platform +list : + @$(foreach target,$(SONIC_TARGET_LIST),echo $(target);) + ############################################################################### ## Include other rules ############################################################################### @@ -118,6 +121,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) : $(DEBS_PATH)/% : .platform { cp $($(deb)_PATH)/$(deb) $(DEBS_PATH)/ $(LOG) || exit 1 ; } ; ) $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) + # Copy regular files from local directory # Add new package for copy: # SOME_NEW_FILE = some_new_file @@ -128,6 +133,8 @@ $(addprefix $(FILES_PATH)/, $(SONIC_COPY_FILES)) : $(FILES_PATH)/% : .platform cp $($*_PATH)/$* $(FILES_PATH)/ $(LOG) || exit 1 $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(FILES_PATH)/, $(SONIC_COPY_FILES)) + ############################################################################### ## Online targets ############################################################################### @@ -143,6 +150,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS)) : $(DEBS_PATH)/% : .platform { wget --no-use-server-timestamps -O $(DEBS_PATH)/$(deb) $($(deb)_URL) $(LOG) || exit 1 ; } ; ) $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS)) + # Download regular files from online location # Files are stored in deb packages directory for convenience # Add new file for download: @@ -154,6 +163,8 @@ $(addprefix $(FILES_PATH)/, $(SONIC_ONLINE_FILES)) : $(FILES_PATH)/% : .platform wget --no-use-server-timestamps -O $@ $($*_URL) $(LOG) $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(FILES_PATH)/, $(SONIC_ONLINE_FILES)) + ############################################################################### ## Debian package related targets ############################################################################### @@ -178,6 +189,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(a if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) + # Build project with dpkg-buildpackage # Add new package for build: # SOME_NEW_DEB = some_new_deb.deb @@ -199,6 +212,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a mv $(addprefix $($*_SRC_PATH)/../, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) $(DEBS_PATH) $(LOG) $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) + # Build project with python setup.py --command-packages=stdeb.command # Add new package for build: # SOME_NEW_DEB = some_new_deb.deb @@ -214,6 +229,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platf mv $(addprefix $($*_SRC_PATH)/deb_dist/, $* $($*_DERIVED_DEBS)) $(DEBS_PATH) $(LOG) $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) + # Rules for derived debian packages (dev, dbg, etc.) # All noise takes place in main deb recipe, so we are just telling that # we depend on it and move our deb to other targets @@ -227,6 +244,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DERIVED_DEBS)) : $(DEBS_PATH)/% : .platform $ [ -f $@ ] && touch $@ $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_DERIVED_DEBS)) + # Rules for extra debian packages # All noise takes place in main deb recipe, so we are just telling that # we need to build the main deb and move our deb to other targets @@ -240,6 +259,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_EXTRA_DEBS)) : $(DEBS_PATH)/% : .platform $$( [ -f $@ ] && touch $@ $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_EXTRA_DEBS)) + # Targets for installing debian packages prior to build one that depends on them SONIC_INSTALL_TARGETS = $(addsuffix -install,$(addprefix $(DEBS_PATH)/, \ $(SONIC_ONLINE_DEBS) \ @@ -285,6 +306,8 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA mv $($*_SRC_PATH)/dist/$* $(PYTHON_WHEELS_PATH) $(LOG) $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) + # Targets for installing python wheels. # Autogenerated SONIC_INSTALL_WHEELS = $(addsuffix -install, $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS))) @@ -314,6 +337,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g docker save $* | gzip -c > $@ $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) + # Targets for building docker images $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS)) $$(addprefix $(FILES_PATH)/,$$($$*.gz_FILES)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $$($$*.gz_PATH)/Dockerfile.j2 $(HEADER) @@ -332,6 +357,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl docker save $* | gzip -c > $@ $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) + DOCKER_LOAD_TARGETS = $(addsuffix -load,$(addprefix $(TARGET_PATH)/, \ $(SONIC_SIMPLE_DOCKER_IMAGES) \ $(SONIC_DOCKER_IMAGES))) @@ -401,6 +428,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform chmod a+x $@ $(FOOTER) +SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) + ############################################################################### ## Clean targets ############################################################################### From 11f08026f1f2da7df37c14c6c8dda7b966e520f8 Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Tue, 1 Aug 2017 20:05:13 +0530 Subject: [PATCH 0699/1833] [platform]: Add EEPROM script for SYS EEPROM on S6100 (#852) --- .../plugins/eeprom.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py new file mode 100644 index 000000000000..6af56578c682 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +############################################################################# +# Dell S6100 +# +# 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-2/2-0050/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + From 9861d0f8f4a6b4954baece49e4d9bddc34eae964 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 1 Aug 2017 17:35:54 +0300 Subject: [PATCH 0700/1833] [device]: Remove illegal character from MSN2700 minigraph (#860) Signed-off-by: marian-pritsak --- device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml index ecbabba18da2..50f49f63878a 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml @@ -1042,7 +1042,7 @@ switch2 ACS-MSN2700 - ` + From b6efe438b54df6e649ea1899e7412d241a00cfc4 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 1 Aug 2017 19:02:00 -0700 Subject: [PATCH 0701/1833] Introduce ConfigDB (#808) * [cfggen] Support reading from and writing to configdb * [bgp] Move bgp_admin_state to configdb, support dynamic admin state change * [sonic-utilities] Adapt configDB for admin status, support config save and config load --- dockers/docker-database/Dockerfile.j2 | 3 +- dockers/docker-database/configdb-load.sh | 17 ++++ dockers/docker-database/supervisord.conf | 9 +++ dockers/docker-fpm-quagga/Dockerfile.j2 | 1 + dockers/docker-fpm-quagga/bgpcfgd | 42 ++++++++++ dockers/docker-fpm-quagga/start.sh | 9 +-- dockers/docker-fpm-quagga/supervisord.conf | 9 +++ .../build_templates/sonic_debian_extension.j2 | 3 +- rules/docker-config-engine.mk | 1 + rules/docker-database.mk | 3 +- rules/docker-platform-monitor.mk | 1 - rules/sonic-config.mk | 1 + src/sonic-config-engine/sonic-cfggen | 81 ++++++++++++++++++- src/sonic-py-swsssdk | 2 +- src/sonic-utilities | 2 +- 15 files changed, 170 insertions(+), 14 deletions(-) create mode 100755 dockers/docker-database/configdb-load.sh create mode 100755 dockers/docker-fpm-quagga/bgpcfgd diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 8397a3acfd22..19fd412b0387 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-base +FROM docker-config-engine ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -33,5 +33,6 @@ RUN sed -ri 's/^(save .*$)/# \1/g; ' /etc/redis/redis.conf COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["configdb-load.sh", "/usr/bin/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-database/configdb-load.sh b/dockers/docker-database/configdb-load.sh new file mode 100755 index 000000000000..2175e37d5a75 --- /dev/null +++ b/dockers/docker-database/configdb-load.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# Wait until redis starts +while true; do + if [ `redis-cli ping` == "PONG" ]; then + break + fi + sleep 1 +done + +# If there is a config db dump file, load it +if [ -r /etc/sonic/config_db.json ]; then + sonic-cfggen -j /etc/sonic/config_db.json --write-to-db +fi + +echo -en "SELECT 4\nSET CONFIG_DB_INITIALIZED true" | redis-cli + diff --git a/dockers/docker-database/supervisord.conf b/dockers/docker-database/supervisord.conf index 8f90e1ed6285..42b0eddac0a7 100644 --- a/dockers/docker-database/supervisord.conf +++ b/dockers/docker-database/supervisord.conf @@ -10,3 +10,12 @@ autostart=true autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:configdb-load.sh] +command=/usr/bin/configdb-load.sh +priority=2 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index ffced8161a5b..1f71c7130b8d 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -23,6 +23,7 @@ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs COPY ["start.sh", "/usr/bin/"] +COPY ["bgpcfgd", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["daemons", "/etc/quagga/"] diff --git a/dockers/docker-fpm-quagga/bgpcfgd b/dockers/docker-fpm-quagga/bgpcfgd new file mode 100755 index 000000000000..2bcecb13f905 --- /dev/null +++ b/dockers/docker-fpm-quagga/bgpcfgd @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +import sys +import redis +import subprocess +import syslog +from swsssdk import ConfigDBConnector + +# Returns BGP ASN as a string +def _get_bgp_asn_from_minigraph(): + # Get BGP ASN from minigraph + proc = subprocess.Popen( + ['sonic-cfggen', '-m', '/etc/sonic/minigraph.xml', '-v', 'minigraph_bgp_asn'], + stdout=subprocess.PIPE, + shell=False, + stderr=subprocess.STDOUT) + stdout = proc.communicate()[0] + proc.wait() + return stdout.rstrip('\n') + +def bgp_config(asn, ip, config): + syslog.syslog(syslog.LOG_INFO, '[bgp cfgd] value for {} changed to {}'.format(ip, config)) + # Currently dynamic config is supported only for bgp admin status + if config.has_key('admin_status'): + command_mod = 'no ' if config['admin_status'] == 'up' else '' + command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c '{}neighbor {} shutdown'".format(asn, command_mod, ip) + + p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + stdout = p.communicate()[0] + p.wait() + if p.returncode != 0: + syslog.syslog(syslog.LOG_ERR, '[bgp cfgd] command execution returned {}. Command: "{}", stdout: "{}"'.format(p.returncode, command, stdout)) + +def main(): + sub = ConfigDBConnector() + bgp_asn = _get_bgp_asn_from_minigraph() + handler = lambda table, key, data: bgp_config(bgp_asn, key, data) + sub.subscribe('BGP_NEIGHBOR', handler) + sub.connect() + sub.listen() + +main() diff --git a/dockers/docker-fpm-quagga/start.sh b/dockers/docker-fpm-quagga/start.sh index a72a96425f66..892c1f6ea974 100755 --- a/dockers/docker-fpm-quagga/start.sh +++ b/dockers/docker-fpm-quagga/start.sh @@ -1,11 +1,8 @@ #!/usr/bin/env bash mkdir -p /etc/quagga -if [ -f /etc/sonic/bgp_admin.yml ]; then - sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/bgp_admin.yml -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf -else - sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf -fi +sonic-cfggen -m -d -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf + sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate @@ -21,6 +18,8 @@ echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status rm -f /var/run/rsyslogd.pid +supervisorctl start bgpcfgd + supervisorctl start rsyslogd # Quagga has its own monitor process, 'watchquagga' diff --git a/dockers/docker-fpm-quagga/supervisord.conf b/dockers/docker-fpm-quagga/supervisord.conf index f2c9bdce7e6d..7b6de2163642 100644 --- a/dockers/docker-fpm-quagga/supervisord.conf +++ b/dockers/docker-fpm-quagga/supervisord.conf @@ -26,3 +26,12 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:bgpcfgd] +command=/usr/bin/bgpcfgd +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index a84b7070a560..3c0804f7abfa 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -132,8 +132,7 @@ sudo bash -c "echo dhcp_as_static=true >> $FILESYSTEM_ROOT/etc/sonic/updategraph sudo bash -c "echo enabled=false > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" {% endif %} {% if shutdown_bgp_on_start == "y" %} -sudo bash -c "echo bgp_admin_state: > $FILESYSTEM_ROOT/etc/sonic/bgp_admin.yml" -sudo bash -c "echo ' all: off' >> $FILESYSTEM_ROOT/etc/sonic/bgp_admin.yml" +sudo bash -c "echo '{ \"bgp_admin_state\": { \"all\": false } }' >> $FILESYSTEM_ROOT/etc/sonic/config_db.json" {% endif %} # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ diff --git a/rules/docker-config-engine.mk b/rules/docker-config-engine.mk index ca0a6a739778..f540bb66f350 100644 --- a/rules/docker-config-engine.mk +++ b/rules/docker-config-engine.mk @@ -2,6 +2,7 @@ DOCKER_CONFIG_ENGINE = docker-config-engine.gz $(DOCKER_CONFIG_ENGINE)_PATH = $(DOCKERS_PATH)/docker-config-engine +$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE) $(DOCKER_CONFIG_ENGINE)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE) diff --git a/rules/docker-database.mk b/rules/docker-database.mk index 991f41ce411b..147b6538a098 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -3,11 +3,12 @@ DOCKER_DATABASE = docker-database.gz $(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/docker-database $(DOCKER_DATABASE)_DEPENDS += $(REDIS_SERVER) $(REDIS_TOOLS) -$(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DATABASE) $(DOCKER_DATABASE)_CONTAINER_NAME = database $(DOCKER_DATABASE)_RUN_OPT += --net=host --privileged -t +$(DOCKER_DATABASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_DATABASE)_BASE_IMAGE_FILES += redis-cli:/usr/bin/redis-cli diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index dea73d2c90ba..39f8cdd3f297 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -3,7 +3,6 @@ DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(SONIC_LEDD) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) diff --git a/rules/sonic-config.mk b/rules/sonic-config.mk index 3dc295c44a69..854b577b3362 100644 --- a/rules/sonic-config.mk +++ b/rules/sonic-config.mk @@ -2,5 +2,6 @@ SONIC_CONFIG_ENGINE = sonic_config_engine-1.0-py2-none-any.whl $(SONIC_CONFIG_ENGINE)_SRC_PATH = $(SRC_PATH)/sonic-config-engine +$(SONIC_CONFIG_ENGINE)_DEPENDS += $(SWSSSDK_PY2) $(SONIC_CONFIG_ENGINE)_PYTHON_VERSION = 2 SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 864513f577e0..d93b4a6a41dc 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -1,4 +1,19 @@ #!/usr/bin/env python +"""sonic-cfggen + +A tool to read SONiC config data from one or more of the following sources: +minigraph file, config DB, json file(s), yaml files(s), command line input, +and write the data into DB, print as json, or render a jinja2 config template. + +Examples: + Render template with minigraph: + sonic-cfggen -m -t /usr/share/template/bgpd.conf.j2 + Dump config DB content into json file: + sonic-cfggen -d --print-data > db_dump.json + Load content of json file into config DB: + sonic-cfggen -j db_dump.json --write-to-db +See usage string for detail description for arguments. +""" import sys import os.path @@ -12,6 +27,7 @@ from minigraph import parse_xml from minigraph import parse_device_desc_xml from sonic_platform import get_machine_info from sonic_platform import get_platform_info +from swsssdk import ConfigDBConnector def is_ipv4(value): if not value: @@ -46,18 +62,64 @@ def unique_name(l): new_list.append(item) return new_list + +class FormatConverter: + """Convert config DB based schema to legacy minigraph based schema for backward capability. +We will move to DB schema and remove this class when the config templates are modified. + +TODO(taoyl): Current version of config db only supports BGP admin states. + All other configuration are still loaded from minigraph. Plan to remove + minigraph and move everything into config db in a later commit. + """ + @staticmethod + def db_to_output(db_data): + data_bgp_admin = {} + for table_name, content in db_data.iteritems(): + if table_name == 'BGP_NEIGHBOR': + for key, value in content.iteritems(): + if value.has_key('admin_status'): + data_bgp_admin[key] = (value['admin_status'] == 'up') + elif table_name == 'DEVICE_METADATA': + if content['localhost'].has_key('bgp_default_status'): + data_bgp_admin['all'] = (content['localhost']['bgp_default_status'] == 'up') + + output_data = {'bgp_admin_state': data_bgp_admin} if data_bgp_admin else {} + return output_data + + @staticmethod + def output_to_db(output_data): + db_data = {} + for key, value in output_data.iteritems(): + if key == 'bgp_admin_state': + for neighbor, state in value.iteritems(): + if neighbor == 'all': + if not db_data.has_key('DEVICE_METADATA'): + db_data['DEVICE_METADATA'] = {'localhost': {}} + db_data['DEVICE_METADATA']['localhost']['bgp_default_status'] = 'up' if state else 'down' + else: + if not db_data.has_key('BGP_NEIGHBOR'): + db_data['BGP_NEIGHBOR'] = {} + if not db_data['BGP_NEIGHBOR'].has_key(neighbor): + db_data['BGP_NEIGHBOR'][neighbor] = {} + db_data['BGP_NEIGHBOR'][neighbor]['admin_status'] = 'up' if state else 'down' + return db_data + + def main(): parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") group = parser.add_mutually_exclusive_group() - group.add_argument("-m", "--minigraph", help="minigraph xml file") + group.add_argument("-m", "--minigraph", help="minigraph xml file", nargs='?', const='/etc/sonic/minigraph.xml') group.add_argument("-M", "--device-description", help="device description xml file") parser.add_argument("-p", "--port-config", help="port config file, used with -m") - parser.add_argument("-y", "--yaml", help="yaml file that contains addtional variables", action='append', default=[]) + parser.add_argument("-y", "--yaml", help="yaml file that contains additional variables", action='append', default=[]) + parser.add_argument("-j", "--json", help="json file that contains additional variables", action='append', default=[]) parser.add_argument("-a", "--additional-data", help="addition data, in json string") + parser.add_argument("-d", "--from-db", help="read config from configdb", action='store_true') group = parser.add_mutually_exclusive_group() group.add_argument("-t", "--template", help="render the data with the template file") group.add_argument("-v", "--var", help="print the value of a variable, support jinja2 expression") group.add_argument("--var-json", help="print the value of a variable, in json format") + group.add_argument("--write-to-db", help="write config into configdb", action='store_true') group.add_argument("--print-data", help="print all data", action='store_true') args = parser.parse_args() @@ -90,8 +152,17 @@ def main(): additional_data = yaml.load(stream) data.update(additional_data) + for json_file in args.json: + with open(json_file, 'r') as stream: + data.update(json.load(stream)) + if args.additional_data != None: data.update(json.loads(args.additional_data)) + + if args.from_db: + configdb = ConfigDBConnector() + configdb.connect() + data.update(FormatConverter.db_to_output(configdb.get_config())) if args.template != None: template_file = os.path.abspath(args.template) @@ -109,8 +180,14 @@ def main(): if args.var_json != None: print json.dumps(data[args.var_json], indent=4, cls=minigraph_encoder) + if args.write_to_db: + configdb = ConfigDBConnector() + configdb.connect(False) + configdb.set_config(FormatConverter.output_to_db(data)) + if args.print_data: print json.dumps(data, indent=4, cls=minigraph_encoder) + if __name__ == "__main__": main() diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 4cf7a59a5ffa..9b54b80f1783 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 4cf7a59a5ffa74784f8067484b0dbee51433c184 +Subproject commit 9b54b80f1783808c5ae2a30e189f24a7404a8c95 diff --git a/src/sonic-utilities b/src/sonic-utilities index 5d8f98eeae60..6c7e22362fbc 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 5d8f98eeae60f1b5c6c5d6ad7cb4c31019558efd +Subproject commit 6c7e22362fbc05ba455e7e336e2a88430de0de18 From 618b25f18c8282b51a414b4892af80f52f0787ef Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 1 Aug 2017 20:51:10 +0000 Subject: [PATCH 0702/1833] Squash merge v1.0.3 branch onto master --- dockers/docker-orchagent/start.sh | 11 ----------- dockers/docker-orchagent/swssconfig.sh | 23 ++++++++++++----------- files/build_templates/swss.service.j2 | 1 + platform/broadcom/docker-ptf-brcm.mk | 2 +- platform/broadcom/libsaithrift-dev.mk | 2 +- platform/broadcom/python-saithrift.mk | 2 +- platform/broadcom/rules.mk | 6 ++---- platform/broadcom/sai.mk | 10 ++++++---- platform/broadcom/sdk.mk | 10 ++++++---- platform/mellanox/docker-ptf-mlnx.mk | 2 +- platform/mellanox/fw.mk | 2 +- platform/mellanox/libsaithrift-dev.mk | 2 +- platform/mellanox/mlnx-fw-upgrade.sh | 2 +- platform/mellanox/mlnx-sai.mk | 4 ++-- platform/mellanox/python-saithrift.mk | 2 +- platform/mellanox/rules.mk | 6 ++---- platform/mellanox/sdk.mk | 10 ++-------- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 20 files changed, 44 insertions(+), 59 deletions(-) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 40ef66441c02..446b52852f0a 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -11,17 +11,6 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd -# Wait for syncd to start -while true; do - RESULT=$(echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p) - - if [ "$RESULT" != "0" ]; then - break - fi - - sleep 1 -done - supervisorctl start orchagent supervisorctl start portsyncd diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 768417779e2d..329d1439d897 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -40,17 +40,18 @@ HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " -if [ "$HWSKU" == "Force10-S6000" ]; then - SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [ "$HWSKU" == "Force10-S6000-Q32" ]; then - SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [ "$HWSKU" == "Arista-7050-QX32" ]; then - SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [ "$HWSKU" == "ACS-MSN2700" ]; then - SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " -elif [ "$HWSKU" == "ACS-MSN2740" ]; then - SWSSCONFIG_ARGS+="msn2740.32ports.buffers.json msn2740.32ports.qos.json " -fi +# FIXME: Temporarily disable QOS/buffer configurations for further debugging +# if [ "$HWSKU" == "Force10-S6000" ]; then +# SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +# elif [ "$HWSKU" == "Force10-S6000-Q32" ]; then +# SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +# elif [ "$HWSKU" == "Arista-7050-QX32" ]; then +# SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +# elif [ "$HWSKU" == "ACS-MSN2700" ]; then +# SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " +# elif [ "$HWSKU" == "ACS-MSN2740" ]; then +# SWSSCONFIG_ARGS+="msn2740.32ports.buffers.json msn2740.32ports.qos.json " +# fi for file in $SWSSCONFIG_ARGS; do swssconfig /etc/swss/config.d/$file diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index ed6b852f18f9..f383a886eb35 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -18,6 +18,7 @@ ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB {% if sonic_asic_platform == 'mellanox' %} +Environment=FAST_BOOT=1 TimeoutStartSec=3min ExecStartPre=/usr/bin/mst start ExecStartPre=/usr/bin/mlnx-fw-upgrade.sh diff --git a/platform/broadcom/docker-ptf-brcm.mk b/platform/broadcom/docker-ptf-brcm.mk index 7b78aa9ec316..c57ce43dc905 100644 --- a/platform/broadcom/docker-ptf-brcm.mk +++ b/platform/broadcom/docker-ptf-brcm.mk @@ -4,4 +4,4 @@ DOCKER_PTF_BRCM = docker-ptf-brcm.gz $(DOCKER_PTF_BRCM)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift $(DOCKER_PTF_BRCM)_DEPENDS += $(PYTHON_SAITHRIFT_BRCM) $(DOCKER_PTF_BRCM)_LOAD_DOCKERS += $(DOCKER_PTF) -SONIC_DOCKER_IMAGES += $(DOCKER_PTF_BRCM) +#SONIC_DOCKER_IMAGES += $(DOCKER_PTF_BRCM) diff --git a/platform/broadcom/libsaithrift-dev.mk b/platform/broadcom/libsaithrift-dev.mk index c809539b47fe..6e422db6e799 100644 --- a/platform/broadcom/libsaithrift-dev.mk +++ b/platform/broadcom/libsaithrift-dev.mk @@ -4,4 +4,4 @@ LIBSAITHRIFT_DEV_BRCM = libsaithrift-dev_0.9.4_amd64.deb $(LIBSAITHRIFT_DEV_BRCM)_SRC_PATH = $(SRC_PATH)/SAI $(LIBSAITHRIFT_DEV_BRCM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(BRCM_SAI) $(BRCM_SAI_DEV) $(LIBSAITHRIFT_DEV_BRCM)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) -SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_BRCM) +#SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_BRCM) diff --git a/platform/broadcom/python-saithrift.mk b/platform/broadcom/python-saithrift.mk index f9da4143c7d9..18bf77c3d009 100644 --- a/platform/broadcom/python-saithrift.mk +++ b/platform/broadcom/python-saithrift.mk @@ -3,4 +3,4 @@ PYTHON_SAITHRIFT_BRCM = python-saithrift_0.9.4_amd64.deb $(PYTHON_SAITHRIFT_BRCM)_SRC_PATH = $(SRC_PATH)/SAI $(PYTHON_SAITHRIFT_BRCM)_DEPENDS += $(BRCM_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_BRCM) +#SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_BRCM) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 253593b30f2a..4ee7fa91304d 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -25,12 +25,10 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/d SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ - $(DOCKER_FPM) \ - $(DOCKER_PTF_BRCM) \ - $(DOCKER_SYNCD_BRCM_RPC) + $(DOCKER_FPM) # Inject brcm sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) $(LIBSAITHRIFT_DEV_BRCM) +$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) #$(LIBSAITHRIFT_DEV_BRCM) # Runtime dependency on brcm sai is set only for syncd $(SYNCD)_RDEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index ec7a34253075..b829e8207890 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,11 @@ -BRCM_SAI = libsaibcm_2.1.5.1-16-20170712202323.49_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-16-20170712202323.49_amd64.deb?sv=2015-04-05&sr=b&sig=jsPXiAoSyKqZ1SmiyeEj73W8tRlri8ysExnWvc%2BWSi4%3D&se=2031-03-21T22%3A49%3A32Z&sp=r" +BRCM_SAI = libsaibcm_3.0.2.2_amd64.deb +# TODO: upload new SAI build to blob +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.2.2_amd64.deb" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-16-20170712202323.49_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.2.2_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-16-20170712202323.49_amd64.deb?sv=2015-04-05&sr=b&sig=azYZkCi%2FFGS4eELKhIozOok3qimfH%2FjdXlz%2BS2MRBco%3D&se=2031-03-21T22%3A49%3A57Z&sp=r" +# TODO: upload new SAI build to blob +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.2.2_amd64.deb" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 5280fa2c9c1b..d952f436099d 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,7 +1,9 @@ -BRCM_OPENNSL = libopennsl_3.2.2.2-10-20170707181826.44_amd64.deb -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.2.2-10-20170707181826.44_amd64.deb?sv=2015-04-05&sr=b&sig=hc4PbMQvfOu7p7E0MR1kn0OA6vu%2BPIdYOLeDU9hPJMY%3D&se=2031-03-19T21%3A20%3A15Z&sp=r" +BRCM_OPENNSL = libopennsl_3.2.3.1_amd64.deb +# TODO: upload new SDK build to blob +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.3.1+0~20170605184634.7~1.gbp4a0717_amd64.deb" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.2.2-10-20170707181826.44_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.2.2-10-20170707181826.44_amd64.deb?sv=2015-04-05&sr=b&sig=xtGLlxX5SspadCxaObMGGVMQliPGrTkuN0T6A4wLETA%3D&se=2031-03-19T21%3A21%3A43Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.1_amd64.deb +# TODO: upload new SDK build to blob +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.1+0~20170605184634.7~1.gbp4a0717_amd64.deb" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) diff --git a/platform/mellanox/docker-ptf-mlnx.mk b/platform/mellanox/docker-ptf-mlnx.mk index 7f23dc715e32..9f994f62de64 100644 --- a/platform/mellanox/docker-ptf-mlnx.mk +++ b/platform/mellanox/docker-ptf-mlnx.mk @@ -4,4 +4,4 @@ DOCKER_PTF_MLNX = docker-ptf-mlnx.gz $(DOCKER_PTF_MLNX)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift $(DOCKER_PTF_MLNX)_DEPENDS += $(PYTHON_SAITHRIFT_MLNX) $(DOCKER_PTF_MLNX)_LOAD_DOCKERS += $(DOCKER_PTF) -SONIC_DOCKER_IMAGES += $(DOCKER_PTF_MLNX) +#SONIC_DOCKER_IMAGES += $(DOCKER_PTF_MLNX) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 8e916d817602..84b44053fa19 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW = fw-SPC-rel-13_1224_0140-EVB.mfa +MLNX_FW = fw-SPC-rel-13_1400_0126-EVB.mfa $(MLNX_FW)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW) SONIC_ONLINE_FILES += $(MLNX_FW) diff --git a/platform/mellanox/libsaithrift-dev.mk b/platform/mellanox/libsaithrift-dev.mk index 0fc6d3f4eb84..39222be39cab 100644 --- a/platform/mellanox/libsaithrift-dev.mk +++ b/platform/mellanox/libsaithrift-dev.mk @@ -4,4 +4,4 @@ LIBSAITHRIFT_DEV_MLNX = libsaithrift-dev_0.9.4_amd64.deb $(LIBSAITHRIFT_DEV_MLNX)_SRC_PATH = $(SRC_PATH)/SAI $(LIBSAITHRIFT_DEV_MLNX)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(MLNX_SAI) $(MLNX_SAI_DEV) $(LIBSAITHRIFT_DEV_MLNX)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI) -SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MLNX) +#SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MLNX) diff --git a/platform/mellanox/mlnx-fw-upgrade.sh b/platform/mellanox/mlnx-fw-upgrade.sh index b27d7095e2e2..d732eff8cee0 100755 --- a/platform/mellanox/mlnx-fw-upgrade.sh +++ b/platform/mellanox/mlnx-fw-upgrade.sh @@ -1,7 +1,7 @@ #!/bin/bash query_retry_count_max="10" -required_fw_version="13.1224.0140" +required_fw_version="13.1400.0126" fw_file=/etc/mlnx/fw-SPC.mfa run_or_fail() { diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 332d496e76d0..66f6c3e257ce 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = 161120 -MLNX_SAI_REVISION = ba3ccd6de8e5b82fa2cdfc30f9b8b1f1882bfede +MLNX_SAI_VERSION = SAIRel1.8.2-master +MLNX_SAI_REVISION = 852ef62c021dad6a1fec932a9c89df0e7f19460e export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/python-saithrift.mk b/platform/mellanox/python-saithrift.mk index cbe5af29b3e2..59685121e02c 100644 --- a/platform/mellanox/python-saithrift.mk +++ b/platform/mellanox/python-saithrift.mk @@ -3,4 +3,4 @@ PYTHON_SAITHRIFT_MLNX = python-saithrift_0.9.4_amd64.deb $(PYTHON_SAITHRIFT_MLNX)_SRC_PATH = $(SRC_PATH)/SAI $(PYTHON_SAITHRIFT_MLNX)_DEPENDS += $(MLNX_SAI_DEV) $(MLNX_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MLNX) +#SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MLNX) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 6b88748c73a2..d67401df245d 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -12,12 +12,10 @@ include $(PLATFORM_PATH)/python-saithrift.mk include $(PLATFORM_PATH)/docker-ptf-mlnx.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ - $(DOCKER_FPM) \ - $(DOCKER_PTF_MLNX) \ - $(DOCKER_SYNCD_MLNX_RPC) + $(DOCKER_FPM) # Inject mlnx sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) $(LIBSAITHRIFT_DEV_MLNX) +$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) #$(LIBSAITHRIFT_DEV_MLNX) # Runtime dependency on mlnx sai is set only for syncd $(SYNCD)_RDEPENDS += $(MLNX_SAI) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index bb576aaabee5..56e3145945f8 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/ba3ccd6de8e5b82fa2cdfc30f9b8b1f1882bfede/sdk -MLNX_SDK_VERSION = 4.2.3130 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/sonicv1.0.2/sdk +MLNX_SDK_VERSION = 4.2.5008 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) @@ -20,8 +20,6 @@ $(eval $(call add_derived_package,$(IPROUTE2),$(IPROUTE2_DEV))) SX_COMPLIB = sx-complib_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV))) -SX_COMPLIB_DEV_STATIC = sx-complib-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV_STATIC))) SX_EXAMPLES = sx-examples_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(SX_EXAMPLES)_DEPENDS += $(APPLIBS) $(SX_SCEW) $(SXD_LIBS) SX_EXAMPLES_DEV = sx-examples-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb @@ -33,13 +31,9 @@ $(eval $(call add_derived_package,$(SX_GEN_UTILS),$(SX_GEN_UTILS_DEV))) SX_SCEW = sx-scew_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb SX_SCEW_DEV = sx-scew-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DEV))) -SX_SCEW_DEV_STATIC = sx-scew-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DEV_STATIC))) SXD_LIBS = sxd-libs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb SXD_LIBS_DEV = sxd-libs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV))) -SXD_LIBS_DEV_STATIC = sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV_STATIC))) #packages that are required for runtime only PYTHON_SDK_API = python-sdk-api_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(PYTHON_SDK_API)_DEPENDS += $(APPLIBS) $(SXD_LIBS) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index b865912105f2..f0a32153728f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit b865912105f2f80ee2516899e6367f863d5f6235 +Subproject commit f0a32153728f7e2de6d4624a1d352ae85c8a4406 diff --git a/src/sonic-swss b/src/sonic-swss index 27c49a0bf3a7..72cd3f6c4c17 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 27c49a0bf3a71556b553aa30fe2a7c1cdb996142 +Subproject commit 72cd3f6c4c174d7341f95dbd3b5ecc4f5debf362 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 4f917f2cc345..2716292fdd78 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 4f917f2cc345c54d1bf9d9f01d96e4c01071ac9a +Subproject commit 2716292fdd78dcbc8587a2c8d192d10465ec7225 From e1f2a2dd75b5a83f83d2d72c9f4fa8b02cbca95a Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 2 Aug 2017 20:28:00 -0700 Subject: [PATCH 0703/1833] [lldp] No need to config on port with no minigraph_neighbor, such as port in vlan (#864) --- dockers/docker-lldp-sv2/lldpd.conf.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index e3d37d091150..4cfe48065e11 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,3 +1,5 @@ {% for member in minigraph_ports.keys() %} +{% if member in minigraph_neighbors %} configure ports {{ member }} lldp portidsubtype local {{ minigraph_ports[member]['alias'] }} description {{ minigraph_neighbors[member]['name'] }}:{{ minigraph_neighbors[member]['port'] }} +{% endif %} {% endfor %} From d0c8e2d12708e6ee90103e32cac73a445e29e80f Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 4 Aug 2017 15:05:15 +0300 Subject: [PATCH 0704/1833] [mellanox]: Query required FW version from FW file. (#866) This simplifies FW upgrade procedure and allows to specify required version only in one place (fw recipe). --- platform/mellanox/mlnx-fw-upgrade.sh | 35 +++++++++++++--------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/platform/mellanox/mlnx-fw-upgrade.sh b/platform/mellanox/mlnx-fw-upgrade.sh index b27d7095e2e2..d84265e02d97 100755 --- a/platform/mellanox/mlnx-fw-upgrade.sh +++ b/platform/mellanox/mlnx-fw-upgrade.sh @@ -1,7 +1,6 @@ #!/bin/bash query_retry_count_max="10" -required_fw_version="13.1224.0140" fw_file=/etc/mlnx/fw-SPC.mfa run_or_fail() { @@ -14,37 +13,35 @@ run_or_fail() { # wait until devices will be available query_retry_count="0" -mlxfwmanager --query > /dev/null +query_cmd="mlxfwmanager --query -i ${fw_file}" +${query_cmd} > /dev/null while [[ (${query_retry_count} -lt ${query_retry_count_max}) && ($? -ne "0") ]]; do sleep 1 query_retry_count=$[${query_retry_count}+1] - mlxfwmanager --query > /dev/null + ${query_cmd} > /dev/null done -run_or_fail "mlxfwmanager --query" > /tmp/mlnxfwmanager-query.txt +run_or_fail "${query_cmd}" > /tmp/mlnxfwmanager-query.txt -# get current firmware version -found_fw=false -for word in `cat /tmp/mlnxfwmanager-query.txt` -do - if [[ ${found_fw} == true ]]; then - fw_version=${word} - break - fi - if [[ ${word} == FW ]]; then - found_fw=true - fi -done +# get current firmware version and required version +fw_info=$(grep FW /tmp/mlnxfwmanager-query.txt) +fw_current=$(echo $fw_info | cut -f2 -d' ') +fw_required=$(echo $fw_info | cut -f3 -d' ') -if [[ -z ${fw_version} ]]; then +if [[ -z ${fw_current} ]]; then echo "Could not retreive current FW version." exit 1 fi -if [[ ${required_fw_version} == ${fw_version} ]]; then +if [[ -z ${fw_required} ]]; then + echo "Could not retreive required FW version." + exit 1 +fi + +if [[ ${fw_current} == ${fw_required} ]]; then echo "Mellanox firmware is up to date." else - echo "Mellanox firmware required version is ${required_fw_version}. Installing compatible version..." + echo "Mellanox firmware required version is ${fw_required}. Installing compatible version..." run_or_fail "mlxfwmanager -i ${fw_file} -u -f -y" fi From 97e4360d9bb9417ca82c28b291d274e44c28eecd Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Sat, 5 Aug 2017 20:56:32 -0700 Subject: [PATCH 0705/1833] [platform] Add support for Arista DCS-7260CX3-64 (#863) * Update sonic-platform-modules-arista submodule * Update boot0 to handle DCS-7260CX3-64 * Add sys eeprom plugin for DCS-7260CX3-64 * Add sfputil plugin for DCS-7260CX3-64 * Add sensors config for DCS-7260CX3-64 * Add Arista-7260CX3-64 HwSku port_config * Handle slow flash partition re-read * Add minigraph.xml for DCS-7260CX3-64 64x100G --- .../Arista-7260CX3-64/port_config.ini | 67 ++ .../Arista-7260CX3-64/sai.profile | 1 + .../x86_64-arista_7260cx3_64/minigraph.xml | 848 ++++++++++++++++++ .../plugins/eeprom.py | 13 + .../plugins/sfputil.py | 8 + .../x86_64-arista_7260cx3_64/sensors.conf | 53 ++ files/Aboot/boot0.j2 | 16 +- files/initramfs-tools/arista-convertfs.j2 | 2 +- .../broadcom/sonic-platform-modules-arista | 2 +- 9 files changed, 1006 insertions(+), 4 deletions(-) create mode 100644 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/port_config.ini create mode 100644 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/sai.profile create mode 100644 device/arista/x86_64-arista_7260cx3_64/minigraph.xml create mode 100644 device/arista/x86_64-arista_7260cx3_64/plugins/eeprom.py create mode 100644 device/arista/x86_64-arista_7260cx3_64/plugins/sfputil.py create mode 100644 device/arista/x86_64-arista_7260cx3_64/sensors.conf diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/port_config.ini new file mode 100644 index 000000000000..c0213576d087 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/port_config.ini @@ -0,0 +1,67 @@ +# name lanes alias port +Ethernet0 77,78,79,80 Ethernet1/1 1 +Ethernet4 65,66,67,68 Ethernet2/1 2 +Ethernet8 85,86,87,88 Ethernet3/1 3 +Ethernet12 89,90,91,92 Ethernet4/1 4 +Ethernet16 109,110,111,112 Ethernet5/1 5 +Ethernet20 97,98,99,100 Ethernet6/1 6 +Ethernet24 117,118,119,120 Ethernet7/1 7 +Ethernet28 5,6,7,8 Ethernet8/1 8 +Ethernet32 17,18,19,20 Ethernet9/1 9 +Ethernet36 13,14,15,16 Ethernet10/1 10 +Ethernet40 29,30,31,32 Ethernet11/1 11 +Ethernet44 37,38,39,40 Ethernet12/1 12 +Ethernet48 49,50,51,52 Ethernet13/1 13 +Ethernet52 45,46,47,48 Ethernet14/1 14 +Ethernet56 61,62,63,64 Ethernet15/1 15 +Ethernet60 121,122,123,124 Ethernet16/1 16 +Ethernet64 193,194,195,196 Ethernet17/1 17 +Ethernet68 133,134,135,136 Ethernet18/1 18 +Ethernet72 205,206,207,208 Ethernet19/1 19 +Ethernet76 213,214,215,216 Ethernet20/1 20 +Ethernet80 225,226,227,228 Ethernet21/1 21 +Ethernet84 221,222,223,224 Ethernet22/1 22 +Ethernet88 237,238,239,240 Ethernet23/1 23 +Ethernet92 245,246,247,248 Ethernet24/1 24 +Ethernet96 141,142,143,144 Ethernet25/1 25 +Ethernet100 249,250,251,252 Ethernet26/1 26 +Ethernet104 149,150,151,152 Ethernet27/1 27 +Ethernet108 153,154,155,156 Ethernet28/1 28 +Ethernet112 173,174,175,176 Ethernet29/1 29 +Ethernet116 161,162,163,164 Ethernet30/1 30 +Ethernet120 181,182,183,184 Ethernet31/1 31 +Ethernet124 185,186,187,188 Ethernet32/1 32 +Ethernet128 69,70,71,72 Ethernet33/1 33 +Ethernet132 73,74,75,76 Ethernet34/1 34 +Ethernet136 93,94,95,96 Ethernet35/1 35 +Ethernet140 81,82,83,84 Ethernet36/1 36 +Ethernet144 101,102,103,104 Ethernet37/1 37 +Ethernet148 105,106,107,108 Ethernet38/1 38 +Ethernet152 1,2,3,4 Ethernet39/1 39 +Ethernet156 113,114,115,116 Ethernet40/1 40 +Ethernet160 9,10,11,12 Ethernet41/1 41 +Ethernet164 21,22,23,24 Ethernet42/1 42 +Ethernet168 33,34,35,36 Ethernet43/1 43 +Ethernet172 25,26,27,28 Ethernet44/1 44 +Ethernet176 41,42,43,44 Ethernet45/1 45 +Ethernet180 53,54,55,56 Ethernet46/1 46 +Ethernet184 125,126,127,128 Ethernet47/1 47 +Ethernet188 57,58,59,60 Ethernet48/1 48 +Ethernet192 129,130,131,132 Ethernet49/1 49 +Ethernet196 197,198,199,200 Ethernet50/1 50 +Ethernet200 209,210,211,212 Ethernet51/1 51 +Ethernet204 201,202,203,204 Ethernet52/1 52 +Ethernet208 217,218,219,220 Ethernet53/1 53 +Ethernet212 229,230,231,232 Ethernet54/1 54 +Ethernet216 241,242,243,244 Ethernet55/1 55 +Ethernet220 233,234,235,236 Ethernet56/1 56 +Ethernet224 253,254,255,256 Ethernet57/1 57 +Ethernet228 137,138,139,140 Ethernet58/1 58 +Ethernet232 157,158,159,160 Ethernet59/1 59 +Ethernet236 145,146,147,148 Ethernet60/1 60 +Ethernet240 165,166,167,168 Ethernet61/1 61 +Ethernet244 169,170,171,172 Ethernet62/1 62 +Ethernet248 189,190,191,192 Ethernet63/1 63 +Ethernet252 177,178,179,180 Ethernet64/1 64 +Ethernet256 257 Ethernet65 65 +Ethernet260 259 Ethernet66 66 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/sai.profile b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/sai.profile new file mode 100644 index 000000000000..d6fbf6e9c6b1 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th2-a7260cx3-64-64x100G.config.bcm diff --git a/device/arista/x86_64-arista_7260cx3_64/minigraph.xml b/device/arista/x86_64-arista_7260cx3_64/minigraph.xml new file mode 100644 index 000000000000..957b60822ba8 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/minigraph.xml @@ -0,0 +1,848 @@ + + + + + + + + + + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + Ethernet1/1 + 10.0.0.0/31 + + + + Ethernet2/1 + 10.0.0.2/31 + + + + Ethernet3/1 + 10.0.0.4/31 + + + + Ethernet4/1 + 10.0.0.6/31 + + + + Ethernet5/1 + 10.0.0.8/31 + + + + Ethernet6/1 + 10.0.0.10/31 + + + + Ethernet7/1 + 10.0.0.12/31 + + + + Ethernet8/1 + 10.0.0.14/31 + + + + Ethernet9/1 + 10.0.0.16/31 + + + + Ethernet10/1 + 10.0.0.18/31 + + + + Ethernet11/1 + 10.0.0.20/31 + + + + Ethernet12/1 + 10.0.0.22/31 + + + + Ethernet13/1 + 10.0.0.24/31 + + + + Ethernet14/1 + 10.0.0.26/31 + + + + Ethernet15/1 + 10.0.0.28/31 + + + + Ethernet16/1 + 10.0.0.30/31 + + + + Ethernet17/1 + 10.0.0.32/31 + + + + Ethernet18/1 + 10.0.0.34/31 + + + + Ethernet19/1 + 10.0.0.36/31 + + + + Ethernet20/1 + 10.0.0.38/31 + + + + Ethernet21/1 + 10.0.0.40/31 + + + + Ethernet22/1 + 10.0.0.42/31 + + + + Ethernet23/1 + 10.0.0.44/31 + + + + Ethernet24/1 + 10.0.0.46/31 + + + + Ethernet25/1 + 10.0.0.48/31 + + + + Ethernet26/1 + 10.0.0.50/31 + + + + Ethernet27/1 + 10.0.0.52/31 + + + + Ethernet28/1 + 10.0.0.54/31 + + + + Ethernet29/1 + 10.0.0.56/31 + + + + Ethernet30/1 + 10.0.0.58/31 + + + + Ethernet31/1 + 10.0.0.60/31 + + + + Ethernet32/1 + 10.0.0.62/31 + + + + Ethernet33/1 + 10.0.0.64/31 + + + + Ethernet34/1 + 10.0.0.66/31 + + + + Ethernet35/1 + 10.0.0.68/31 + + + + Ethernet36/1 + 10.0.0.70/31 + + + + Ethernet37/1 + 10.0.0.72/31 + + + + Ethernet38/1 + 10.0.0.74/31 + + + + Ethernet39/1 + 10.0.0.76/31 + + + + Ethernet40/1 + 10.0.0.78/31 + + + + Ethernet41/1 + 10.0.0.80/31 + + + + Ethernet42/1 + 10.0.0.82/31 + + + + Ethernet43/1 + 10.0.0.84/31 + + + + Ethernet44/1 + 10.0.0.86/31 + + + + Ethernet45/1 + 10.0.0.88/31 + + + + Ethernet46/1 + 10.0.0.90/31 + + + + Ethernet47/1 + 10.0.0.92/31 + + + + Ethernet48/1 + 10.0.0.94/31 + + + + Ethernet49/1 + 10.0.0.96/31 + + + + Ethernet50/1 + 10.0.0.98/31 + + + + Ethernet51/1 + 10.0.0.100/31 + + + + Ethernet52/1 + 10.0.0.102/31 + + + + Ethernet53/1 + 10.0.0.104/31 + + + + Ethernet54/1 + 10.0.0.106/31 + + + + Ethernet55/1 + 10.0.0.108/31 + + + + Ethernet56/1 + 10.0.0.110/31 + + + + Ethernet57/1 + 10.0.0.112/31 + + + + Ethernet58/1 + 10.0.0.114/31 + + + + Ethernet59/1 + 10.0.0.116/31 + + + + Ethernet60/1 + 10.0.0.118/31 + + + + Ethernet61/1 + 10.0.0.120/31 + + + + Ethernet62/1 + 10.0.0.122/31 + + + + Ethernet63/1 + 10.0.0.124/31 + + + + Ethernet64/1 + 10.0.0.126/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic-target + Ethernet1/1 + sonic + Ethernet1/1 + + + DeviceInterfaceLink + sonic-target + Ethernet2/1 + sonic + Ethernet2/1 + + + DeviceInterfaceLink + sonic-target + Ethernet3/1 + sonic + Ethernet3/1 + + + DeviceInterfaceLink + sonic-target + Ethernet4/1 + sonic + Ethernet4/1 + + + DeviceInterfaceLink + sonic-target + Ethernet5/1 + sonic + Ethernet5/1 + + + DeviceInterfaceLink + sonic-target + Ethernet6/1 + sonic + Ethernet6/1 + + + DeviceInterfaceLink + sonic-target + Ethernet7/1 + sonic + Ethernet7/1 + + + DeviceInterfaceLink + sonic-target + Ethernet8/1 + sonic + Ethernet8/1 + + + DeviceInterfaceLink + sonic-target + Ethernet9/1 + sonic + Ethernet9/1 + + + DeviceInterfaceLink + sonic-target + Ethernet10/1 + sonic + Ethernet10/1 + + + DeviceInterfaceLink + sonic-target + Ethernet11/1 + sonic + Ethernet11/1 + + + DeviceInterfaceLink + sonic-target + Ethernet12/1 + sonic + Ethernet12/1 + + + DeviceInterfaceLink + sonic-target + Ethernet13/1 + sonic + Ethernet13/1 + + + DeviceInterfaceLink + sonic-target + Ethernet14/1 + sonic + Ethernet14/1 + + + DeviceInterfaceLink + sonic-target + Ethernet15/1 + sonic + Ethernet15/1 + + + DeviceInterfaceLink + sonic-target + Ethernet16/1 + sonic + Ethernet16/1 + + + DeviceInterfaceLink + sonic-target + Ethernet17/1 + sonic + Ethernet17/1 + + + DeviceInterfaceLink + sonic-target + Ethernet18/1 + sonic + Ethernet18/1 + + + DeviceInterfaceLink + sonic-target + Ethernet19/1 + sonic + Ethernet19/1 + + + DeviceInterfaceLink + sonic-target + Ethernet20/1 + sonic + Ethernet20/1 + + + DeviceInterfaceLink + sonic-target + Ethernet21/1 + sonic + Ethernet21/1 + + + DeviceInterfaceLink + sonic-target + Ethernet22/1 + sonic + Ethernet22/1 + + + DeviceInterfaceLink + sonic-target + Ethernet23/1 + sonic + Ethernet23/1 + + + DeviceInterfaceLink + sonic-target + Ethernet24/1 + sonic + Ethernet24/1 + + + DeviceInterfaceLink + sonic-target + Ethernet25/1 + sonic + Ethernet25/1 + + + DeviceInterfaceLink + sonic-target + Ethernet26/1 + sonic + Ethernet26/1 + + + DeviceInterfaceLink + sonic-target + Ethernet27/1 + sonic + Ethernet27/1 + + + DeviceInterfaceLink + sonic-target + Ethernet28/1 + sonic + Ethernet28/1 + + + DeviceInterfaceLink + sonic-target + Ethernet29/1 + sonic + Ethernet29/1 + + + DeviceInterfaceLink + sonic-target + Ethernet30/1 + sonic + Ethernet30/1 + + + DeviceInterfaceLink + sonic-target + Ethernet31/1 + sonic + Ethernet31/1 + + + DeviceInterfaceLink + sonic-target + Ethernet32/1 + sonic + Ethernet32/1 + + + DeviceInterfaceLink + sonic-target + Ethernet33/1 + sonic + Ethernet33/1 + + + DeviceInterfaceLink + sonic-target + Ethernet34/1 + sonic + Ethernet34/1 + + + DeviceInterfaceLink + sonic-target + Ethernet35/1 + sonic + Ethernet35/1 + + + DeviceInterfaceLink + sonic-target + Ethernet36/1 + sonic + Ethernet36/1 + + + DeviceInterfaceLink + sonic-target + Ethernet37/1 + sonic + Ethernet37/1 + + + DeviceInterfaceLink + sonic-target + Ethernet38/1 + sonic + Ethernet38/1 + + + DeviceInterfaceLink + sonic-target + Ethernet39/1 + sonic + Ethernet39/1 + + + DeviceInterfaceLink + sonic-target + Ethernet40/1 + sonic + Ethernet40/1 + + + DeviceInterfaceLink + sonic-target + Ethernet41/1 + sonic + Ethernet41/1 + + + DeviceInterfaceLink + sonic-target + Ethernet42/1 + sonic + Ethernet42/1 + + + DeviceInterfaceLink + sonic-target + Ethernet43/1 + sonic + Ethernet43/1 + + + DeviceInterfaceLink + sonic-target + Ethernet44/1 + sonic + Ethernet44/1 + + + DeviceInterfaceLink + sonic-target + Ethernet45/1 + sonic + Ethernet45/1 + + + DeviceInterfaceLink + sonic-target + Ethernet46/1 + sonic + Ethernet46/1 + + + DeviceInterfaceLink + sonic-target + Ethernet47/1 + sonic + Ethernet47/1 + + + DeviceInterfaceLink + sonic-target + Ethernet48/1 + sonic + Ethernet48/1 + + + DeviceInterfaceLink + sonic-target + Ethernet49/1 + sonic + Ethernet49/1 + + + DeviceInterfaceLink + sonic-target + Ethernet50/1 + sonic + Ethernet50/1 + + + DeviceInterfaceLink + sonic-target + Ethernet51/1 + sonic + Ethernet51/1 + + + DeviceInterfaceLink + sonic-target + Ethernet52/1 + sonic + Ethernet52/1 + + + DeviceInterfaceLink + sonic-target + Ethernet53/1 + sonic + Ethernet53/1 + + + DeviceInterfaceLink + sonic-target + Ethernet54/1 + sonic + Ethernet54/1 + + + DeviceInterfaceLink + sonic-target + Ethernet55/1 + sonic + Ethernet55/1 + + + DeviceInterfaceLink + sonic-target + Ethernet56/1 + sonic + Ethernet56/1 + + + DeviceInterfaceLink + sonic-target + Ethernet57/1 + sonic + Ethernet57/1 + + + DeviceInterfaceLink + sonic-target + Ethernet58/1 + sonic + Ethernet58/1 + + + DeviceInterfaceLink + sonic-target + Ethernet59/1 + sonic + Ethernet59/1 + + + DeviceInterfaceLink + sonic-target + Ethernet60/1 + sonic + Ethernet60/1 + + + DeviceInterfaceLink + sonic-target + Ethernet61/1 + sonic + Ethernet61/1 + + + DeviceInterfaceLink + sonic-target + Ethernet62/1 + sonic + Ethernet62/1 + + + DeviceInterfaceLink + sonic-target + Ethernet63/1 + sonic + Ethernet63/1 + + + DeviceInterfaceLink + sonic-target + Ethernet64/1 + sonic + Ethernet64/1 + + + + + sonic + Arista-7260CX3-64 + + + + + + + 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 + Arista-7260CX3-64 + diff --git a/device/arista/x86_64-arista_7260cx3_64/plugins/eeprom.py b/device/arista/x86_64-arista_7260cx3_64/plugins/eeprom.py new file mode 100644 index 000000000000..c4485e895948 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/plugins/eeprom.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +""" +Arista 7260CX3-64 eeprom plugin +Uses the arista driver library to obtain the TlvInfoDecoder +""" + +try: + import arista.utils.sonic_eeprom as arista_eeprom +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +board = arista_eeprom.getTlvInfoDecoder() diff --git a/device/arista/x86_64-arista_7260cx3_64/plugins/sfputil.py b/device/arista/x86_64-arista_7260cx3_64/plugins/sfputil.py new file mode 100644 index 000000000000..ce60de2b384d --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/plugins/sfputil.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +try: + import arista.utils.sonic_sfputil as arista_sfputil +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +sfputil = arista_sfputil.getSfpUtil() diff --git a/device/arista/x86_64-arista_7260cx3_64/sensors.conf b/device/arista/x86_64-arista_7260cx3_64/sensors.conf new file mode 100644 index 000000000000..e0ad4b434972 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/sensors.conf @@ -0,0 +1,53 @@ +# libsensors configuration file for DCS-7260CX3-64 +# ------------------------------------------------# + +bus "i2c-1" "SCD 0000:06:00.0 SMBus master 0 bus 0" +bus "i2c-3" "SCD 0000:06:00.0 SMBus master 0 bus 2" +bus "i2c-4" "SCD 0000:06:00.0 SMBus master 0 bus 3" +bus "i2c-73" "SCD 0000:ff:0b.3 SMBus master 0 bus 0" +bus "i2c-88" "SCD 0000:ff:0b.3 SMBus master 3 bus 3" + +chip "max6658-i2c-1-4c" + label temp1 "Temp sensor near TH2" + + set temp1_max 65 + set temp1_crit 75 + + ignore temp2 + +chip "pmbus-i2c-3-58" + label temp1 "PSU1 primary hotspot temp" + label temp2 "PSU1 inlet temp" + label temp3 "PSU1 exhaust temp" + + # setting maximum and critical thresholds is not supported for this psu + # fault and warning limits defined internally by hardware + + ignore fan2 + ignore fan3 + +chip "pmbus-i2c-4-58" + label temp1 "PSU2 primary hotspot temp" + label temp2 "PSU2 inlet temp" + label temp3 "PSU2 exhaust temp" + + # setting maximum and critical thresholds is not supported for this psu + # fault and warning limits defined internally by hardware + + ignore fan2 + ignore fan3 + +chip "max6658-i2c-73-4c" + label temp1 "Rear air temp1" + label temp2 "Rear air temp2" + + set temp1_max 65 + set temp1_crit 75 + set temp2_max 65 + set temp2_crit 75 + +chip "lm73-i2c-88-48" + label temp1 "Front air temp" + + set temp1_max 65 + set temp1_crit 75 diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index f278f1070fb1..b88c0ec35b39 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -65,6 +65,9 @@ extract_image() { ## vfat does not support symbol link if [ -n "$sonic_upgrade" ] || [ "$rootfs_type" != "vfat" ]; then + ## on ext4, other doesn't have access to the flash by default + chmod o+rx "$target_path" + mkdir -p "$image_path/{{ DOCKERFS_DIR }}" if [ -n "$sonic_upgrade" ]; then @@ -108,7 +111,7 @@ platform_specific() { local sid="$(grep -Eo 'sid=[^ ]+' /etc/cmdline | cut -f2 -d=)" # set varlog size to 100MB - echo "varlog_size=100" >>/tmp/append + local varlog_size=100 # This is temporary as the platform= and sid= parameters don't provide enough # information to identify the SKU @@ -122,10 +125,19 @@ platform_specific() { aboot_machine=arista_7050_qx32s echo "modprobe.blacklist=radeon" >>/tmp/append fi - if [ "$sid" = "Upperlake" ]; then + if [ "$sid" = "Upperlake" ] || [ "$sid" = "UpperlakeES" ]; then aboot_machine=arista_7060_cx32s echo "amd_iommu=off" >> /tmp/append fi + if [ "$sid" = "Gardena" ] || [ "$sid" = "GardenaSsd" ]; then + aboot_machine=arista_7260cx3_64 + fi + if [ "$platform" = "rook" ]; then + varlog_size=200 + readprefdl -f /tmp/.system-prefdl -d > /mnt/flash/.system-prefdl + fi + + echo "varlog_size=$varlog_size" >>/tmp/append } # check the hash file in the image, and determine to install or just skip diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index a15233615f98..81c6d9d1943f 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -178,7 +178,7 @@ umount "$root_mnt" # Create a new partition table (content in flash_dev will be deleted) err_msg="Error: repartitioning $flash_dev failed" -cmd="echo ';' | sfdisk $flash_dev" +cmd="echo ';' | sfdisk $flash_dev || (sleep 3; blockdev --rereadpt $flash_dev && fdisk -l $flash_dev | grep -q ${root_dev}.*Linux)" run_cmd "$cmd" "$err_msg" sleep 5 diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 75e84737680f..a90b9fc5b085 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 75e84737680f5451eb9c947d01968b972d989bb3 +Subproject commit a90b9fc5b085cdb99d10d338a23daa66c7f351b2 From afbf1ee2fb0e6c2ef3a64a87592ac63ae36842c4 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 8 Aug 2017 10:21:54 +0300 Subject: [PATCH 0706/1833] [sonic-slave]: Split user commands from generic. (#868) In case when more than one user builds SONiC on same machine, we can keep generic part that installs all packages to slave image apart from creating user and calling user-related commands. Then generic base image will be built only once, allowing other users to build only smaller specific to them layers. Signed-off-by: marian-pritsak --- Makefile | 19 +++++++++++++++++-- sonic-slave/Dockerfile | 28 ---------------------------- sonic-slave/Dockerfile.user | 29 +++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 30 deletions(-) create mode 100644 sonic-slave/Dockerfile.user diff --git a/Makefile b/Makefile index ee3c292732c6..d779c30718dc 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,9 @@ $(shell rm -f .screen) MAKEFLAGS += -B -SLAVE_TAG = $(shell shasum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') +SLAVE_BASE_TAG = $(shell shasum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') +SLAVE_TAG = $(shell shasum sonic-slave/Dockerfile.user | awk '{print substr($$1,0,11);}') +SLAVE_BASE_IMAGE = sonic-slave-base SLAVE_IMAGE = sonic-slave-$(USER) DOCKER_RUN := docker run --rm=true --privileged \ @@ -20,12 +22,18 @@ DOCKER_RUN := docker run --rm=true --privileged \ -w /sonic \ -i$(if $(TERM),t,) +DOCKER_BASE_BUILD = docker build --no-cache \ + -t $(SLAVE_BASE_IMAGE) \ + sonic-slave && \ + docker tag $(SLAVE_BASE_IMAGE):latest $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) + DOCKER_BUILD = docker build --no-cache \ --build-arg user=$(USER) \ --build-arg uid=$(shell id -u) \ --build-arg guid=$(shell id -g) \ --build-arg hostname=$(shell echo $$HOSTNAME) \ -t $(SLAVE_IMAGE) \ + -f sonic-slave/Dockerfile.user \ sonic-slave && \ docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG) @@ -34,6 +42,9 @@ DOCKER_BUILD = docker build --no-cache \ .DEFAULT_GOAL := all %:: + @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ + { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ + $(DOCKER_BASE_BUILD) ; } @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } @@ -49,9 +60,13 @@ DOCKER_BUILD = docker build --no-cache \ $@ sonic-slave-build : - @$(DOCKER_BUILD) + $(DOCKER_BASE_BUILD) + $(DOCKER_BUILD) sonic-slave-bash : + @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ + { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ + $(DOCKER_BASE_BUILD) ; } @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 38fe431a044d..826a7129a7e0 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -254,31 +254,3 @@ RUN add-apt-repository \ RUN apt-get update RUN apt-get install -y docker-ce=17.03.2~ce-0~debian-jessie RUN echo "DOCKER_OPTS=\"--experimental\"" >> /etc/default/docker - -# Add user -ARG user -ARG uid -ARG guid -ARG hostname - -ENV BUILD_HOSTNAME $hostname -ENV USER $user - -RUN groupadd -f -r -g $guid g$user - -RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash - -RUN gpasswd -a $user docker - -# Config git for stg -RUN su $user -c "git config --global user.name $user" -RUN su $user -c "git config --global user.email $user@contoso.com" - -COPY sonic-jenkins-id_rsa.pub /var/$user/.ssh/authorized_keys2 -RUN chown $user /var/$user/.ssh -R -RUN chmod go= /var/$user/.ssh -R - -# Add user to sudoers -RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers - -USER $user diff --git a/sonic-slave/Dockerfile.user b/sonic-slave/Dockerfile.user new file mode 100644 index 000000000000..ff01f88a769c --- /dev/null +++ b/sonic-slave/Dockerfile.user @@ -0,0 +1,29 @@ +FROM sonic-slave-base + +# Add user +ARG user +ARG uid +ARG guid +ARG hostname + +ENV BUILD_HOSTNAME $hostname +ENV USER $user + +RUN groupadd -f -r -g $guid g$user + +RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash + +RUN gpasswd -a $user docker + +# Config git for stg +RUN su $user -c "git config --global user.name $user" +RUN su $user -c "git config --global user.email $user@contoso.com" + +COPY sonic-jenkins-id_rsa.pub /var/$user/.ssh/authorized_keys2 +RUN chown $user /var/$user/.ssh -R +RUN chmod go= /var/$user/.ssh -R + +# Add user to sudoers +RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers + +USER $user From a2fe0212be487d173830a07d6999d74589136993 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 8 Aug 2017 16:23:58 -0700 Subject: [PATCH 0707/1833] [ConfigDB] Move all BGP configuration into DB (#861) - BGP data read from minigraph.py now match DB schema - BGP templates are updated - bgpcfgd can now deal with runtime neighbor create/delete --- dockers/docker-fpm-frr/bgpd.conf.j2 | 16 ++-- dockers/docker-fpm-frr/isolate.j2 | 10 +-- dockers/docker-fpm-frr/unisolate.j2 | 10 +-- dockers/docker-fpm-gobgp/gobgpd.conf.j2 | 8 +- dockers/docker-fpm-gobgp/isolate.j2 | 20 ----- dockers/docker-fpm-gobgp/unisolate.j2 | 19 ----- dockers/docker-fpm-quagga/bgpcfgd | 77 ++++++++++++------- dockers/docker-fpm-quagga/bgpd.conf.j2 | 30 ++++---- dockers/docker-fpm-quagga/isolate.j2 | 10 +-- dockers/docker-fpm-quagga/start.sh | 6 +- dockers/docker-fpm-quagga/unisolate.j2 | 10 +-- .../build_templates/sonic_debian_extension.j2 | 2 +- files/image_config/platform/rc.local | 12 +++ files/image_config/updategraph/updategraph | 7 ++ src/sonic-config-engine/minigraph.py | 31 ++++---- src/sonic-config-engine/sonic-cfggen | 58 ++++++-------- src/sonic-config-engine/tests/test_cfggen.py | 2 +- src/sonic-utilities | 2 +- 18 files changed, 160 insertions(+), 170 deletions(-) diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index 9b8195943444..d04f6ac623e0 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -18,7 +18,7 @@ log facility local4 ! ! bgp multiple-instance ! -router bgp {{ minigraph_bgp_asn }} +router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp log-neighbor-changes bgp bestpath as-path multipath-relax {# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} @@ -46,16 +46,16 @@ router bgp {{ minigraph_bgp_asn }} {% endfor %} {% endblock vlan_advertisement %} {% block bgp_sessions %} -{% for bgp_session in minigraph_bgp %} +{% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} {% if bgp_session['asn'] != 0 %} - neighbor {{ bgp_session['addr'] }} remote-as {{ bgp_session['asn'] }} - neighbor {{ bgp_session['addr'] }} description {{ bgp_session['name'] }} + neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} + neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} {% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} - neighbor {{ bgp_session['addr'] }} allowas-in 1 + neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} -{% if bgp_session['addr'] | ipv6 %} +{% if neighbor_addr | ipv6 %} address-family ipv6 - neighbor {{ bgp_session['addr'] }} activate + neighbor {{ neighbor_addr }} activate maximum-paths 64 exit-address-family {% endif %} @@ -66,5 +66,5 @@ router bgp {{ minigraph_bgp_asn }} maximum-paths 64 ! route-map ISOLATE permit 10 -set as-path prepend {{ minigraph_bgp_asn }} +set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! diff --git a/dockers/docker-fpm-frr/isolate.j2 b/dockers/docker-fpm-frr/isolate.j2 index 35ef5bbc0209..7b7fecf9fa9e 100755 --- a/dockers/docker-fpm-frr/isolate.j2 +++ b/dockers/docker-fpm-frr/isolate.j2 @@ -8,13 +8,13 @@ exit $? ## vtysh script start from next line, which line number MUST eqaul in 'sed' command above configure terminal - router bgp {{ minigraph_bgp_asn }} -{% for bgp_session in minigraph_bgp %} - neighbor {{ bgp_session['addr'] }} route-map ISOLATE out + router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} +{% for neighbor_addr in BGP_NEIGHBOR %} + neighbor {{ neighbor_addr }} route-map ISOLATE out {% endfor %} exit exit -{% for bgp_session in minigraph_bgp %} -clear ip bgp {{ bgp_session['addr'] }} soft out +{% for neighbor_addr in BGP_NEIGHBOR %} +clear ip bgp {{ neighbor_addr }} soft out {% endfor %} diff --git a/dockers/docker-fpm-frr/unisolate.j2 b/dockers/docker-fpm-frr/unisolate.j2 index c113a74fab45..f2129556747b 100755 --- a/dockers/docker-fpm-frr/unisolate.j2 +++ b/dockers/docker-fpm-frr/unisolate.j2 @@ -8,13 +8,13 @@ exit $? ## vtysh script start from next line, which line number MUST eqaul in 'sed' command above configure terminal - router bgp {{ minigraph_bgp_asn }} -{% for bgp_session in minigraph_bgp %} - no neighbor {{ bgp_session['addr'] }} route-map ISOLATE out + router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} +{% for neighbor_ip in BGP_NEIGHBOR %} + no neighbor {{ neighbor_ip }} route-map ISOLATE out {% endfor %} exit exit -{% for bgp_session in minigraph_bgp %} -clear ip bgp {{ bgp_session['addr'] }} soft out +{% for neighbor_ip in BGP_NEIGHBOR %} +clear ip bgp {{ neighbor_ip }} soft out {% endfor %} diff --git a/dockers/docker-fpm-gobgp/gobgpd.conf.j2 b/dockers/docker-fpm-gobgp/gobgpd.conf.j2 index adbc063cfc6c..c6ec7a4fd166 100644 --- a/dockers/docker-fpm-gobgp/gobgpd.conf.j2 +++ b/dockers/docker-fpm-gobgp/gobgpd.conf.j2 @@ -1,17 +1,17 @@ [global.config] - as = {{ minigraph_bgp_asn }} + as = {{ DEVICE_METADATA['localhost']['bgp_asn'] }} router-id = "{{ minigraph_lo_interfaces[0]['addr'] }}" -{% for bgp_session in minigraph_bgp %} +{% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} {% if bgp_session['asn'] != 0 %} [[neighbors]] [neighbors.config] peer-as = {{ bgp_session['asn'] }} - neighbor-address = "{{ bgp_session['addr'] }}" + neighbor-address = "{{ neighbor_addr }}" [neighbors.graceful-restart.config] enabled = true [[neighbors.afi-safis]] [neighbors.afi-safis.config] -{% if bgp_session['addr'] | ipv6 %} +{% if neighbor_addr | ipv6 %} afi-safi-name = "ipv6-unicast" {% else %} afi-safi-name = "ipv4-unicast" diff --git a/dockers/docker-fpm-gobgp/isolate.j2 b/dockers/docker-fpm-gobgp/isolate.j2 index e587623e984f..4502ff895777 100755 --- a/dockers/docker-fpm-gobgp/isolate.j2 +++ b/dockers/docker-fpm-gobgp/isolate.j2 @@ -2,23 +2,3 @@ echo Not implemented yet exit - -## vtysh only accepts script in stdin, so cannot be directly used in shebang -## Cut the tail of this script and feed vtysh stdin -sed -n -e '9,$p' < "$0" | vtysh "$@" -## Exit with vtysh return code -exit $? - -## vtysh script start from next line, which line number MUST eqaul in 'sed' command above - -configure terminal - router bgp {{ minigraph_bgp_asn }} -{% for bgp_session in minigraph_bgp %} - neighbor {{ bgp_session['addr'] }} route-map ISOLATE out -{% endfor %} - exit -exit - -{% for bgp_session in minigraph_bgp %} -clear ip bgp {{ bgp_session['addr'] }} soft out -{% endfor %} diff --git a/dockers/docker-fpm-gobgp/unisolate.j2 b/dockers/docker-fpm-gobgp/unisolate.j2 index d1310114d908..69172744bae7 100755 --- a/dockers/docker-fpm-gobgp/unisolate.j2 +++ b/dockers/docker-fpm-gobgp/unisolate.j2 @@ -3,22 +3,3 @@ echo Not implemented yet exit -## vtysh only accepts script in stdin, so cannot be directly used in shebang -## Cut the tail of this script and feed vtysh stdin -sed -n -e '9,$p' < "$0" | vtysh "$@" -## Exit with vtysh return code -exit $? - -## vtysh script start from next line, which line number MUST eqaul in 'sed' command above - -configure terminal - router bgp {{ minigraph_bgp_asn }} -{% for bgp_session in minigraph_bgp %} - no neighbor {{ bgp_session['addr'] }} route-map ISOLATE out -{% endfor %} - exit -exit - -{% for bgp_session in minigraph_bgp %} -clear ip bgp {{ bgp_session['addr'] }} soft out -{% endfor %} diff --git a/dockers/docker-fpm-quagga/bgpcfgd b/dockers/docker-fpm-quagga/bgpcfgd index 2bcecb13f905..012a766c20b9 100755 --- a/dockers/docker-fpm-quagga/bgpcfgd +++ b/dockers/docker-fpm-quagga/bgpcfgd @@ -6,37 +6,60 @@ import subprocess import syslog from swsssdk import ConfigDBConnector -# Returns BGP ASN as a string -def _get_bgp_asn_from_minigraph(): - # Get BGP ASN from minigraph - proc = subprocess.Popen( - ['sonic-cfggen', '-m', '/etc/sonic/minigraph.xml', '-v', 'minigraph_bgp_asn'], - stdout=subprocess.PIPE, - shell=False, - stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - return stdout.rstrip('\n') - -def bgp_config(asn, ip, config): - syslog.syslog(syslog.LOG_INFO, '[bgp cfgd] value for {} changed to {}'.format(ip, config)) - # Currently dynamic config is supported only for bgp admin status - if config.has_key('admin_status'): - command_mod = 'no ' if config['admin_status'] == 'up' else '' - command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c '{}neighbor {} shutdown'".format(asn, command_mod, ip) - +class BGPConfigDaemon: + + def __init__(self): + self.config_db = ConfigDBConnector() + self.config_db.connect() + self.bgp_asn = self.config_db.get_entry('DEVICE_METADATA', 'localhost')['bgp_asn'] + self.bgp_neighbor = self.config_db.get_table('BGP_NEIGHBOR') + + def __run_command(self, command): +# print command p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) stdout = p.communicate()[0] p.wait() if p.returncode != 0: syslog.syslog(syslog.LOG_ERR, '[bgp cfgd] command execution returned {}. Command: "{}", stdout: "{}"'.format(p.returncode, command, stdout)) + def metadata_handler(self, key, data): + if key == 'localhost' and data.has_key('bgp_asn'): + if data['bgp_asn'] != self.bgp_asn: + syslog.syslog(syslog.LOG_INFO, '[bgp cfgd] ASN changed to {} from {}, restart BGP...'.format(data['bgp_asn'], self.bgp_asn)) + self.__run_command("supervisorctl restart start.sh") + self.__run_command("service quagga restart") + self.bgp_asn = data['bgp_asn'] + + def bgp_handler(self, key, data): + syslog.syslog(syslog.LOG_INFO, '[bgp cfgd] value for {} changed to {}'.format(key, data)) + if not data: + # Neighbor is deleted + command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c 'no neighbor {}'".format(self.bgp_asn, key) + self.__run_command(command) + self.bgp_neighbor.pop(key) + else: + command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c 'neighbor {} remote-as {}'".format(self.bgp_asn, key, data['asn']) + self.__run_command(command) + if data.has_key('name'): + command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c 'neighbor {} description {}'".format(self.bgp_asn, key, data['name']) + self.__run_command(command) + if data.has_key('admin_status'): + command_mod = 'no ' if data['admin_status'] == 'up' else '' + command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c '{}neighbor {} shutdown'".format(self.bgp_asn, command_mod, key) + self.__run_command(command) + self.bgp_neighbor[key] = data + + def start(self): + self.config_db.subscribe('BGP_NEIGHBOR', + lambda table, key, data: self.bgp_handler(key, data)) + self.config_db.subscribe('DEVICE_METADATA', + lambda table, key, data: self.metadata_handler(key, data)) + self.config_db.listen() + + def main(): - sub = ConfigDBConnector() - bgp_asn = _get_bgp_asn_from_minigraph() - handler = lambda table, key, data: bgp_config(bgp_asn, key, data) - sub.subscribe('BGP_NEIGHBOR', handler) - sub.connect() - sub.listen() - -main() + daemon = BGPConfigDaemon() + daemon.start() + +if __name__ == "__main__": + main() diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index ceb866edd02d..a5c317aa2e80 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -14,7 +14,7 @@ log facility local4 ! enable password {# {{ en_passwd }} TODO: param needed #} {% endblock system_init %} ! -{% if minigraph_bgp_asn is not none %} +{% if DEVICE_METADATA['localhost'].has_key('bgp_asn') %} {% block bgp_init %} ! ! bgp multiple-instance @@ -23,7 +23,7 @@ route-map FROM_BGP_SPEAKER_V4 permit 10 ! route-map TO_BGP_SPEAKER_V4 deny 10 ! -router bgp {{ minigraph_bgp_asn }} +router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp log-neighbor-changes bgp bestpath as-path multipath-relax {# Advertise graceful restart capability for ToR #} @@ -50,24 +50,24 @@ router bgp {{ minigraph_bgp_asn }} {% endfor %} {% endblock vlan_advertisement %} {% block bgp_sessions %} -{% for bgp_session in minigraph_bgp %} +{% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} {% if bgp_session['asn'] != 0 %} - neighbor {{ bgp_session['addr'] }} remote-as {{ bgp_session['asn'] }} - neighbor {{ bgp_session['addr'] }} description {{ bgp_session['name'] }} -{% if bgp_admin_state and bgp_admin_state.has_key(bgp_session['addr']) and bgp_admin_state[bgp_session['addr']]==False or bgp_admin_state and not bgp_admin_state.has_key(bgp_session['addr']) and bgp_admin_state.has_key('all') and bgp_admin_state['all']==False %} - neighbor {{ bgp_session['addr'] }} shutdown + neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} + neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} +{% if bgp_session.has_key('admin_status') and bgp_session['admin_status'] == 'down' or not bgp_session.has_key('admin_status') and DEVICE_METADATA['localhost'].has_key('default_bgp_status') and DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %} + neighbor {{ neighbor_addr }} shutdown {% endif %} -{% if bgp_session['addr'] | ipv4 %} +{% if neighbor_addr | ipv4 %} {% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} - neighbor {{ bgp_session['addr'] }} allowas-in 1 + neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} {% endif %} -{% if bgp_session['addr'] | ipv6 %} +{% if neighbor_addr | ipv6 %} address-family ipv6 {% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} - neighbor {{ bgp_session['addr'] }} allowas-in 1 + neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} - neighbor {{ bgp_session['addr'] }} activate + neighbor {{ neighbor_addr }} activate maximum-paths 64 exit-address-family {% endif %} @@ -75,7 +75,7 @@ router bgp {{ minigraph_bgp_asn }} {% endfor %} {% endblock bgp_sessions %} {% block bgp_peers_with_range %} -{% for bgp_peer in minigraph_bgp_peers_with_range %} +{% for bgp_peer in BGP_PEER_RANGE.values() %} neighbor {{ bgp_peer['name'] }} peer-group neighbor {{ bgp_peer['name'] }} passive neighbor {{ bgp_peer['name'] }} remote-as {{deployment_id_asn_map[deployment_id] }} @@ -90,10 +90,10 @@ router bgp {{ minigraph_bgp_asn }} {% endfor %} {% endblock bgp_peers_with_range %} ! -{% if minigraph_bgp_asn is not none %} +{% if DEVICE_METADATA['localhost'].has_key('bgp_asn') %} maximum-paths 64 ! route-map ISOLATE permit 10 -set as-path prepend {{ minigraph_bgp_asn }} +set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endif %} ! diff --git a/dockers/docker-fpm-quagga/isolate.j2 b/dockers/docker-fpm-quagga/isolate.j2 index 35ef5bbc0209..7b7fecf9fa9e 100755 --- a/dockers/docker-fpm-quagga/isolate.j2 +++ b/dockers/docker-fpm-quagga/isolate.j2 @@ -8,13 +8,13 @@ exit $? ## vtysh script start from next line, which line number MUST eqaul in 'sed' command above configure terminal - router bgp {{ minigraph_bgp_asn }} -{% for bgp_session in minigraph_bgp %} - neighbor {{ bgp_session['addr'] }} route-map ISOLATE out + router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} +{% for neighbor_addr in BGP_NEIGHBOR %} + neighbor {{ neighbor_addr }} route-map ISOLATE out {% endfor %} exit exit -{% for bgp_session in minigraph_bgp %} -clear ip bgp {{ bgp_session['addr'] }} soft out +{% for neighbor_addr in BGP_NEIGHBOR %} +clear ip bgp {{ neighbor_addr }} soft out {% endfor %} diff --git a/dockers/docker-fpm-quagga/start.sh b/dockers/docker-fpm-quagga/start.sh index 892c1f6ea974..ca876efe184e 100755 --- a/dockers/docker-fpm-quagga/start.sh +++ b/dockers/docker-fpm-quagga/start.sh @@ -3,13 +3,13 @@ mkdir -p /etc/quagga sonic-cfggen -m -d -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf +sonic-cfggen -m -d -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate +sonic-cfggen -m -d -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate chown root:root /usr/sbin/bgp-isolate chmod 0755 /usr/sbin/bgp-isolate -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate +sonic-cfggen -m -d -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate chown root:root /usr/sbin/bgp-unisolate chmod 0755 /usr/sbin/bgp-unisolate diff --git a/dockers/docker-fpm-quagga/unisolate.j2 b/dockers/docker-fpm-quagga/unisolate.j2 index c113a74fab45..f2129556747b 100755 --- a/dockers/docker-fpm-quagga/unisolate.j2 +++ b/dockers/docker-fpm-quagga/unisolate.j2 @@ -8,13 +8,13 @@ exit $? ## vtysh script start from next line, which line number MUST eqaul in 'sed' command above configure terminal - router bgp {{ minigraph_bgp_asn }} -{% for bgp_session in minigraph_bgp %} - no neighbor {{ bgp_session['addr'] }} route-map ISOLATE out + router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} +{% for neighbor_ip in BGP_NEIGHBOR %} + no neighbor {{ neighbor_ip }} route-map ISOLATE out {% endfor %} exit exit -{% for bgp_session in minigraph_bgp %} -clear ip bgp {{ bgp_session['addr'] }} soft out +{% for neighbor_ip in BGP_NEIGHBOR %} +clear ip bgp {{ neighbor_ip }} soft out {% endfor %} diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 3c0804f7abfa..fc84191e3cf1 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -132,7 +132,7 @@ sudo bash -c "echo dhcp_as_static=true >> $FILESYSTEM_ROOT/etc/sonic/updategraph sudo bash -c "echo enabled=false > $FILESYSTEM_ROOT/etc/sonic/updategraph.conf" {% endif %} {% if shutdown_bgp_on_start == "y" %} -sudo bash -c "echo '{ \"bgp_admin_state\": { \"all\": false } }' >> $FILESYSTEM_ROOT/etc/sonic/config_db.json" +sudo bash -c "echo '{ \"DEVICE_METADATA\": { \"localhost\": { \"default_bgp_status\": \"down\" } } }' >> $FILESYSTEM_ROOT/etc/sonic/init_cfg.json" {% endif %} # Copy SNMP configuration files sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index dad2510ce756..49b2ed6e1b69 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -35,8 +35,20 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then mv -f /host/old_config/* /etc/sonic/ elif [ -f /host/minigraph.xml ]; then mv /host/minigraph.xml /etc/sonic/ + # Combine information in minigraph and init_cfg.json to form initiate config DB dump file. + # TODO: After moving all information from minigraph to DB, sample config DB dump should be provide + if [ -f /etc/sonic/init_cfg.json ]; then + sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + else + sonic-cfggen -m --print-data > /etc/sonic/config_db.json + fi else cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ + if [ -f /etc/sonic/init_cfg.json ]; then + sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + else + sonic-cfggen -m --print-data > /etc/sonic/config_db.json + fi fi if [ -d /host/image-$sonic_version/platform/$platform ]; then diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 7240d913c76d..4e9846fba024 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -68,6 +68,13 @@ while true; do sleep 5 done +echo "Regenerating config DB from minigraph..." +if [ -f /etc/sonic/init_cfg.json ]; then + sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json +else + sonic-cfggen -m --print-data > /etc/sonic/config_db.json +fi + # Mark as disabled after graph is successfully downloaded sed -i "/enabled=/d" /etc/sonic/updategraph.conf echo "enabled=false" >> /etc/sonic/updategraph.conf diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 65738a0508f5..6dbf0d570d47 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -249,9 +249,9 @@ def parse_dpg(dpg, hname): def parse_cpg(cpg, hname): - bgp_sessions = [] + bgp_sessions = {} myasn = None - bgp_peers_with_range = [] + bgp_peers_with_range = {} for child in cpg: tag = child.tag if tag == str(QName(ns, "PeeringSessions")): @@ -261,17 +261,15 @@ def parse_cpg(cpg, hname): end_router = session.find(str(QName(ns, "EndRouter"))).text end_peer = session.find(str(QName(ns, "EndPeer"))).text if end_router == hname: - bgp_sessions.append({ + bgp_sessions[start_peer] = { 'name': start_router, - 'addr': start_peer, - 'peer_addr': end_peer - }) + 'local_addr': end_peer + } else: - bgp_sessions.append({ + bgp_sessions[end_peer] = { 'name': end_router, - 'addr': end_peer, - 'peer_addr': start_peer - }) + 'local_addr': start_peer + } elif child.tag == str(QName(ns, "Routers")): for router in child.findall(str(QName(ns1, "BGPRouterDeclaration"))): asn = router.find(str(QName(ns1, "ASN"))).text @@ -285,12 +283,13 @@ def parse_cpg(cpg, hname): name = bgpPeer.find(str(QName(ns1, "Name"))).text ip_range = bgpPeer.find(str(QName(ns1, "PeersRange"))).text ip_range_group = ip_range.split(';') if ip_range and ip_range != "" else [] - bgp_peers_with_range.append({ + bgp_peers_with_range[name] = { 'name': name, 'ip_range': ip_range_group - }) + } else: - for bgp_session in bgp_sessions: + for peer in bgp_sessions: + bgp_session = bgp_sessions[peer] if hostname == bgp_session['name']: bgp_session['asn'] = int(asn) @@ -447,9 +446,9 @@ def parse_xml(filename, platform=None, port_config_file=None): # sorting by lambdas are not easily done without custom filters. # TODO: add jinja2 filter to accept a lambda to sort a list of dictionaries by attribute. # TODO: alternatively (preferred), implement class containers for multiple-attribute entries, enabling sort by attr - results['minigraph_bgp'] = sorted(bgp_sessions, key=lambda x: x['addr']) - results['minigraph_bgp_asn'] = bgp_asn - results['minigraph_bgp_peers_with_range'] = bgp_peers_with_range + results['BGP_NEIGHBOR'] = bgp_sessions + results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn }} + results['BGP_PEER_RANGE'] = bgp_peers_with_range # TODO: sort does not work properly on all interfaces of varying lengths. Need to sort by integer group(s). phyport_intfs = [] diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index d93b4a6a41dc..070b3100ea5a 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -73,37 +73,25 @@ TODO(taoyl): Current version of config db only supports BGP admin states. """ @staticmethod def db_to_output(db_data): - data_bgp_admin = {} - for table_name, content in db_data.iteritems(): - if table_name == 'BGP_NEIGHBOR': - for key, value in content.iteritems(): - if value.has_key('admin_status'): - data_bgp_admin[key] = (value['admin_status'] == 'up') - elif table_name == 'DEVICE_METADATA': - if content['localhost'].has_key('bgp_default_status'): - data_bgp_admin['all'] = (content['localhost']['bgp_default_status'] == 'up') - - output_data = {'bgp_admin_state': data_bgp_admin} if data_bgp_admin else {} - return output_data + return db_data @staticmethod def output_to_db(output_data): db_data = {} - for key, value in output_data.iteritems(): - if key == 'bgp_admin_state': - for neighbor, state in value.iteritems(): - if neighbor == 'all': - if not db_data.has_key('DEVICE_METADATA'): - db_data['DEVICE_METADATA'] = {'localhost': {}} - db_data['DEVICE_METADATA']['localhost']['bgp_default_status'] = 'up' if state else 'down' - else: - if not db_data.has_key('BGP_NEIGHBOR'): - db_data['BGP_NEIGHBOR'] = {} - if not db_data['BGP_NEIGHBOR'].has_key(neighbor): - db_data['BGP_NEIGHBOR'][neighbor] = {} - db_data['BGP_NEIGHBOR'][neighbor]['admin_status'] = 'up' if state else 'down' + for table_name in output_data: + if table_name == 'BGP_NEIGHBOR' or table_name == 'BGP_PEER_RANGE' or table_name == 'DEVICE_METADATA': + db_data[table_name] = output_data[table_name] return db_data +def deep_update(dst, src): + for key, value in src.iteritems(): + if isinstance(value, dict): + node = dst.setdefault(key, {}) + deep_update(node, value) + else: + dst[key] = value + return dst + def main(): parser=argparse.ArgumentParser(description="Render configuration file from minigraph data and jinja2 template.") @@ -126,7 +114,7 @@ def main(): data = {} machine_info = get_machine_info() if machine_info != None: - data.update(machine_info) + deep_update(data, machine_info) platform_info = get_platform_info(machine_info) if platform_info != None: data['platform'] = platform_info @@ -135,34 +123,34 @@ def main(): minigraph = args.minigraph if data.has_key('platform'): if args.port_config != None: - data.update(parse_xml(minigraph, data['platform'], args.port_config)) + deep_update(data, parse_xml(minigraph, data['platform'], args.port_config)) else: - data.update(parse_xml(minigraph, data['platform'])) + deep_update(data, parse_xml(minigraph, data['platform'])) else: if args.port_config != None: - data.update(parse_xml(minigraph, port_config_file=args.port_config)) + deep_update(data, parse_xml(minigraph, port_config_file=args.port_config)) else: - data.update(parse_xml(minigraph)) + deep_update(data, parse_xml(minigraph)) if args.device_description != None: - data.update(parse_device_desc_xml(args.device_description)) + deep_update(data, parse_device_desc_xml(args.device_description)) for yaml_file in args.yaml: with open(yaml_file, 'r') as stream: additional_data = yaml.load(stream) - data.update(additional_data) + deep_update(data, additional_data) for json_file in args.json: with open(json_file, 'r') as stream: - data.update(json.load(stream)) + deep_update(data, json.load(stream)) if args.additional_data != None: - data.update(json.loads(args.additional_data)) + deep_update(data, json.loads(args.additional_data)) if args.from_db: configdb = ConfigDBConnector() configdb.connect() - data.update(FormatConverter.db_to_output(configdb.get_config())) + deep_update(data, FormatConverter.db_to_output(configdb.get_config())) if args.template != None: template_file = os.path.abspath(args.template) diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 6835c60e27fd..d3ff3e8b9f4e 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -111,7 +111,7 @@ def test_minigraph_neighbors(self): self.assertEqual(output.strip(), "{'Ethernet116': {'name': 'ARISTA02T1', 'port': 'Ethernet1/1'}, 'Ethernet124': {'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}, 'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}, 'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}}") def test_minigraph_peers_with_range(self): - argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v minigraph_bgp_peers_with_range' + argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v BGP_PEER_RANGE.values\(\)' output = self.run_script(argument) self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]") diff --git a/src/sonic-utilities b/src/sonic-utilities index 6c7e22362fbc..e4f7161b055a 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 6c7e22362fbc05ba455e7e336e2a88430de0de18 +Subproject commit e4f7161b055a345813424004f17b116a055d590a From 96636e2124c55700f7542d3f3581ab4b28242770 Mon Sep 17 00:00:00 2001 From: Polly Hsu Date: Wed, 9 Aug 2017 12:19:50 +0800 Subject: [PATCH 0708/1833] [device/accton]: Update Accton-AS7712-32X (#776) * [device/accton]: Update Accton-AS7712-32X * Add Broadcom LED microprocessor / pre-emphasis initialization Signed-off-by: polly_hsu@accton.com * Update start.sh * Update start.sh * [device/accton]: Update Accton-AS7712-32X * Add Broadcom LED microprocessor (Remove pre-emphasis initialization) Signed-off-by: polly_hsu@accton.com --- .../led_proc_init.soc | 41 +++++++++++++++++++ platform/broadcom/docker-syncd-brcm/start.sh | 9 ++-- 2 files changed, 47 insertions(+), 3 deletions(-) create mode 100755 device/accton/x86_64-accton_as7712_32x-r0/led_proc_init.soc diff --git a/device/accton/x86_64-accton_as7712_32x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7712_32x-r0/led_proc_init.soc new file mode 100755 index 000000000000..719cb777719f --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/led_proc_init.soc @@ -0,0 +1,41 @@ +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=31 REMAP_PORT_1=30 REMAP_PORT_2=29 REMAP_PORT_3=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=27 REMAP_PORT_5=26 REMAP_PORT_6=25 REMAP_PORT_7=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=23 REMAP_PORT_9=22 REMAP_PORT_10=21 REMAP_PORT_11=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=19 REMAP_PORT_13=18 REMAP_PORT_14=17 REMAP_PORT_15=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=63 REMAP_PORT_17=62 REMAP_PORT_18=61 REMAP_PORT_19=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=59 REMAP_PORT_21=58 REMAP_PORT_22=57 REMAP_PORT_23=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=55 REMAP_PORT_25=54 REMAP_PORT_26=53 REMAP_PORT_27=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=51 REMAP_PORT_29=50 REMAP_PORT_30=49 REMAP_PORT_31=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=47 REMAP_PORT_33=46 REMAP_PORT_34=45 REMAP_PORT_35=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=43 REMAP_PORT_37=42 REMAP_PORT_38=41 REMAP_PORT_39=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=39 REMAP_PORT_41=38 REMAP_PORT_42=37 REMAP_PORT_43=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=35 REMAP_PORT_45=34 REMAP_PORT_46=33 REMAP_PORT_47=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 REMAP_PORT_49=14 REMAP_PORT_50=13 REMAP_PORT_51=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=35 REMAP_PORT_1=34 REMAP_PORT_2=33 REMAP_PORT_3=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=39 REMAP_PORT_5=38 REMAP_PORT_6=37 REMAP_PORT_7=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=43 REMAP_PORT_9=42 REMAP_PORT_10=41 REMAP_PORT_11=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=47 REMAP_PORT_13=46 REMAP_PORT_14=45 REMAP_PORT_15=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=3 REMAP_PORT_17=2 REMAP_PORT_18=1 REMAP_PORT_19=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=7 REMAP_PORT_21=6 REMAP_PORT_22=5 REMAP_PORT_23=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=11 REMAP_PORT_25=10 REMAP_PORT_26=9 REMAP_PORT_27=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=15 REMAP_PORT_29=14 REMAP_PORT_30=13 REMAP_PORT_31=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 REMAP_PORT_33=18 REMAP_PORT_34=17 REMAP_PORT_35=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 REMAP_PORT_37=22 REMAP_PORT_38=21 REMAP_PORT_39=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 REMAP_PORT_41=26 REMAP_PORT_42=25 REMAP_PORT_43=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 REMAP_PORT_45=30 REMAP_PORT_46=29 REMAP_PORT_47=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 REMAP_PORT_49=50 REMAP_PORT_50=49 REMAP_PORT_51=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 REMAP_PORT_53=54 REMAP_PORT_54=53 REMAP_PORT_55=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 REMAP_PORT_57=58 REMAP_PORT_58=57 REMAP_PORT_59=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=62 REMAP_PORT_62=61 REMAP_PORT_63=60 + +led 0 prog 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 E0 02 FB 42 40 06 F9 D2 00 74 1E 02 F9 42 03 67 AC 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 84 67 98 57 80 18 71 EB 67 98 67 84 57 67 84 67 84 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 start + +led 1 prog 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 E0 02 FB 42 40 06 F9 D2 00 74 1E 02 F9 42 03 67 AC 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 84 67 98 57 80 18 71 EB 67 98 67 84 57 67 84 67 84 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 1 start + +led auto on \ No newline at end of file diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index 930609a1958d..e06a29b2b2a8 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -8,15 +8,18 @@ supervisorctl start rsyslogd supervisorctl start syncd -# If this platform has an initialization file for the Broadcom LED microprocessor, load it -if [ -r ${PLATFORM_DIR}/led_proc_init.soc ]; then - # Wait until syncd has created the socket for bcmcmd to connect to +# Function: wait until syncd has created the socket for bcmcmd to connect to +wait_syncd() { while true; do if [ -e /var/run/sswsyncd/sswsyncd.socket ]; then break fi sleep 1 done +} +# If this platform has an initialization file for the Broadcom LED microprocessor, load it +if [ -r ${PLATFORM_DIR}/led_proc_init.soc ]; then + wait_syncd /usr/bin/bcmcmd -t 60 "rcload ${PLATFORM_DIR}/led_proc_init.soc" fi From 847a9480698f0098315b86c3216c65e039e91a02 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 8 Aug 2017 21:40:31 -0700 Subject: [PATCH 0709/1833] Update sonic-utilities pointer to support reload minigraph (#871) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index e4f7161b055a..c7f6ff677b54 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit e4f7161b055a345813424004f17b116a055d590a +Subproject commit c7f6ff677b54eb401e7b2fd3a3d9c4072325bb78 From 9d5adb993ae34d9ce64de3320b0a4654af94af26 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 10 Aug 2017 16:24:57 -0700 Subject: [PATCH 0710/1833] [System logs]: Improvements to prevent filling /var/log partition (#865) - Force log rotation at size thresholds only (no longer also rotating logs daily), allowing for more consistent archived log size - Eliminate remaining duplicate log messages - Cron facility now only logs to cron.log (was also logging to syslog) - Debug, mail, news and user log facilities only log to syslog; no longer creating separate log files for these facilities - Cron job that calls logrotate every minute now uses the main /etc/logrotate.conf file so as to check/rotate all logs every minute, not just the logs specified in the rsyslog file. Also redirecting output of this command to /dev/null to prevent "(CRON) info (No MTA installed, discarding output)" messages in cron.log due to lack of a mail service - Delete archive files based on remaining /var/log partition space. Note that this solution currently requires a minimum /var/log partition size of 32MB to function correctly - Update sonic-sairedis and sonic-swss submodules to incorporate recording file name changes - Add .screen file to .gitignore (unrelated) --- .gitignore | 1 + .../build_templates/sonic_debian_extension.j2 | 2 +- files/image_config/cron.d/logrotate | 2 +- files/image_config/logrotate.d/rsyslog | 62 ------------ files/image_config/logrotate/logrotate.conf | 32 +++++++ files/image_config/logrotate/logrotate.d/apt | 15 +++ files/image_config/logrotate/logrotate.d/dpkg | 18 ++++ .../image_config/logrotate/logrotate.d/monit | 12 +++ .../logrotate/logrotate.d/rsyslog | 96 +++++++++++++++++++ .../rsyslog/rsyslog.d/99-default.conf | 51 +--------- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 12 files changed, 182 insertions(+), 113 deletions(-) delete mode 100644 files/image_config/logrotate.d/rsyslog create mode 100644 files/image_config/logrotate/logrotate.conf create mode 100644 files/image_config/logrotate/logrotate.d/apt create mode 100644 files/image_config/logrotate/logrotate.d/dpkg create mode 100644 files/image_config/logrotate/logrotate.d/monit create mode 100644 files/image_config/logrotate/logrotate.d/rsyslog diff --git a/.gitignore b/.gitignore index 16d7b53f60af..9ca9d2ff1a98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Build system related .platform +.screen # Build artifacts fsroot/ diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index fc84191e3cf1..0b1d19b6e1b9 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -106,7 +106,7 @@ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.conf.j2 $FILESYSTEM_ROOT/usr/share/sonic/ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/* $FILESYSTEM_ROOT/etc/rsyslog.d/ # Copy logrotate.d configuration files -sudo cp -f $IMAGE_CONFIGS/logrotate.d/rsyslog $FILESYSTEM_ROOT/etc/logrotate.d/ +sudo cp -f $IMAGE_CONFIGS/logrotate/logrotate.d/* $FILESYSTEM_ROOT/etc/logrotate.d/ # Copy systemd-journald configuration files sudo cp -f $IMAGE_CONFIGS/systemd/journald.conf $FILESYSTEM_ROOT/etc/systemd/ diff --git a/files/image_config/cron.d/logrotate b/files/image_config/cron.d/logrotate index 9e1335cbd43e..d0c2e0829ba9 100644 --- a/files/image_config/cron.d/logrotate +++ b/files/image_config/cron.d/logrotate @@ -1,2 +1,2 @@ # Attempt to rotate system logs once per minute -* * * * * root /usr/sbin/logrotate /etc/logrotate.d/rsyslog +* * * * * root /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&1 diff --git a/files/image_config/logrotate.d/rsyslog b/files/image_config/logrotate.d/rsyslog deleted file mode 100644 index 5101b0e41fd2..000000000000 --- a/files/image_config/logrotate.d/rsyslog +++ /dev/null @@ -1,62 +0,0 @@ -/var/log/syslog -/var/log/quagga/*.log -/var/log/teamd.log -{ - rotate 7 - daily - maxsize 100M - missingok - notifempty - compress - delaycompress - postrotate - # Calling kill directly instead of 'service rsyslog rotate >/dev/null' due - # to bug in init-system-helpers. Bug has apparently been fixed in v1.47. - # However, Debian Jessie is still using v1.22. - # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672218 - kill -HUP $(cat /var/run/rsyslogd.pid) - endscript -} -/var/log/swss/*.rec -{ - rotate 7 - daily - maxsize 20M - missingok - notifempty - compress - delaycompress - sharedscripts - postrotate - pgrep -x orchagent | xargs /bin/kill -HUP 2>/dev/null || true - endscript -} -/var/log/mail.info -/var/log/mail.warn -/var/log/mail.err -/var/log/mail.log -/var/log/daemon.log -/var/log/kern.log -/var/log/auth.log -/var/log/user.log -/var/log/lpr.log -/var/log/cron.log -/var/log/debug -/var/log/messages -{ - rotate 4 - daily - maxsize 50M - missingok - notifempty - compress - delaycompress - sharedscripts - postrotate - # Calling kill directly instead of 'service rsyslog rotate >/dev/null' due - # to bug in init-system-helpers. Bug has apparently been fixed in v1.47. - # However, Debian Jessie is still using v1.22. - # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672218 - kill -HUP $(cat /var/run/rsyslogd.pid) - endscript -} diff --git a/files/image_config/logrotate/logrotate.conf b/files/image_config/logrotate/logrotate.conf new file mode 100644 index 000000000000..6f107e209837 --- /dev/null +++ b/files/image_config/logrotate/logrotate.conf @@ -0,0 +1,32 @@ +# see "man logrotate" for details +# Rotate log files daily by default +daily + +# Keep 4 days worth of backlogs by default +rotate 4 + +# create new (empty) log files after rotating old ones +create + +# uncomment this if you want your log files compressed +#compress + +# packages drop log rotation information into this directory +include /etc/logrotate.d + +# no packages own wtmp, or btmp -- we'll rotate them here +/var/log/wtmp { + missingok + size 100k + create 0664 root utmp + rotate 1 +} + +/var/log/btmp { + missingok + size 100k + create 0660 root utmp + rotate 1 +} + +# system-specific logs may be configured here diff --git a/files/image_config/logrotate/logrotate.d/apt b/files/image_config/logrotate/logrotate.d/apt new file mode 100644 index 000000000000..7584dcacc881 --- /dev/null +++ b/files/image_config/logrotate/logrotate.d/apt @@ -0,0 +1,15 @@ +/var/log/apt/term.log { + size 100k + rotate 1 + compress + missingok + notifempty +} + +/var/log/apt/history.log { + size 100k + rotate 1 + compress + missingok + notifempty +} diff --git a/files/image_config/logrotate/logrotate.d/dpkg b/files/image_config/logrotate/logrotate.d/dpkg new file mode 100644 index 000000000000..5e24c7ed74e1 --- /dev/null +++ b/files/image_config/logrotate/logrotate.d/dpkg @@ -0,0 +1,18 @@ +/var/log/dpkg.log { + size 100k + rotate 1 + compress + delaycompress + missingok + notifempty + create 644 root root +} +/var/log/alternatives.log { + size 100k + rotate 1 + compress + delaycompress + missingok + notifempty + create 644 root root +} diff --git a/files/image_config/logrotate/logrotate.d/monit b/files/image_config/logrotate/logrotate.d/monit new file mode 100644 index 000000000000..7846dfadb77c --- /dev/null +++ b/files/image_config/logrotate/logrotate.d/monit @@ -0,0 +1,12 @@ +/var/log/monit.log { + size 100k + rotate 1 + missingok + create 640 root adm + notifempty + compress + delaycompress + postrotate + invoke-rc.d monit reload > /dev/null + endscript +} diff --git a/files/image_config/logrotate/logrotate.d/rsyslog b/files/image_config/logrotate/logrotate.d/rsyslog new file mode 100644 index 000000000000..ba550dcd242b --- /dev/null +++ b/files/image_config/logrotate/logrotate.d/rsyslog @@ -0,0 +1,96 @@ +# These logs should no longer get created. However, in case they do get created, +# we should keep them to a small size and rotate them also. +/var/log/mail.info +/var/log/mail.warn +/var/log/mail.err +/var/log/mail.log +/var/log/daemon.log +/var/log/kern.log +/var/log/user.log +/var/log/lpr.log +/var/log/debug +/var/log/messages +{ + size 10k + rotate 1 + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + # calling kill directly instead of 'service rsyslog rotate >/dev/null' due + # to bug in init-system-helpers. bug has apparently been fixed in v1.47. + # however, debian jessie is still using v1.22. + # see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672218 + kill -hup $(cat /var/run/rsyslogd.pid) + endscript +} + +/var/log/auth.log +/var/log/cron.log +/var/log/syslog +/var/log/teamd.log +/var/log/quagga/bgpd.log +/var/log/quagga/zebra.log +/var/log/swss/sairedis.rec +/var/log/swss/swss.rec +{ + size 1M + rotate 5000 + missingok + notifempty + compress + delaycompress + nosharedscripts + prerotate + # Adjust NUM_LOGS_TO_ROTATE to reflect number of log files that trigger this block specified above + NUM_LOGS_TO_ROTATE=8 + + # Adjust LOG_FILE_ROTATE_SIZE_KB to reflect the "size" parameter specified above, in kB + LOG_FILE_ROTATE_SIZE_KB=1024 + + # Reserve space for btmp, wtmp, dpkg.log, monit.log, etc., as well as logs that + # should be disabled, just in case they get created and rotated + RESERVED_SPACE_KB=4096 + + VAR_LOG_SIZE_KB=$(df -k /var/log | sed -n 2p | awk '{ print $2 }') + + # Limit usable space to 95% of the partition minus the reserved space for other logs + USABLE_SPACE_KB=$(( (VAR_LOG_SIZE_KB * 95 / 100) - RESERVED_SPACE_KB)) + + # Set our threshold so as to maintain enough space to write all logs from empty to full + # Most likely, some logs will have non-zero size when this is called, so this errs on the side + # of caution, giving us a bit of a cushion if a log grows quickly and passes its rotation size + THRESHOLD_KB=$((USABLE_SPACE_KB - (NUM_LOGS_TO_ROTATE * LOG_FILE_ROTATE_SIZE_KB * 2))) + + while true; do + USED_KB=$(du -s /var/log | awk '{ print $1; }') + + if [ $USED_KB -lt $THRESHOLD_KB ]; then + break + else + OLDEST_ARCHIVE_FILE=$(find /var/log -type f -printf '%T+ %p\n' | grep -E '.+\.[0-9]+(\.gz)?$' | sort | head -n 1 | awk '{ print $2; }') + + if [ -z "$OLDEST_ARCHIVE_FILE" ]; then + logger -p syslog.err -t "logrotate" "No archive file to delete -- potential for filling up /var/log partition!" + break + fi + + logger -p syslog.info -t "logrotate" "Deleting archive file $OLDEST_ARCHIVE_FILE to free up space" + rm -rf "$OLDEST_ARCHIVE_FILE" + fi + done + endscript + postrotate + if [ $(echo $1 | grep -c "/var/log/swss/") -gt 0 ]; then + pgrep -x orchagent | xargs /bin/kill -HUP 2>/dev/null || true + else + # Calling kill directly instead of 'service rsyslog rotate >/dev/null' due + # to bug in init-system-helpers. Bug has apparently been fixed in v1.47. + # However, Debian Jessie is still using v1.22. + # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672218 + kill -HUP $(cat /var/run/rsyslogd.pid) + fi + endscript +} diff --git a/files/image_config/rsyslog/rsyslog.d/99-default.conf b/files/image_config/rsyslog/rsyslog.d/99-default.conf index 51049e7473a8..06a40ca64852 100644 --- a/files/image_config/rsyslog/rsyslog.d/99-default.conf +++ b/files/image_config/rsyslog/rsyslog.d/99-default.conf @@ -1,61 +1,18 @@ # # First some standard log files. Log by facility. # + +# Log all facilities to /var/log/syslog except cron, auth +# and authpriv. They are noisy - log them to their own files +*.*;cron,auth,authpriv.none -/var/log/syslog auth,authpriv.* /var/log/auth.log -*.*;auth,authpriv.none -/var/log/syslog cron.* /var/log/cron.log -# Do not redirect daemon, kernel or lpr logs to -# their own files. Let them log to /var/log/syslog -#daemon.* -/var/log/daemon.log -#kern.* -/var/log/kern.log -#kern.* -/var/persist/log/kern.log -#lpr.* -/var/log/lpr.log -mail.* -/var/log/mail.log -user.* -/var/log/user.log - -# -# Logging for the mail system. Split it up so that -# it is easy to write scripts to parse these files. -# -mail.info -/var/log/mail.info -mail.warn -/var/log/mail.warn -mail.err /var/log/mail.err - -# -# Logging for INN news system. -# -news.crit /var/log/news/news.crit -news.err /var/log/news/news.err -news.notice -/var/log/news/news.notice -# -# Some "catch-all" log files. -# -*.=debug;\ - auth,authpriv.none;\ - news.none;mail.none -/var/log/debug -# -# Removed as duplicates: -#*.=info;*.=notice;*.=warn;\ -# auth,authpriv.none;\ -# cron,daemon.none;\ -# mail,news.none -/var/log/messages -# -*.=crit;*.=alert;*.=emerg -/var/persist/log/alarms # # Emergencies are sent to everybody logged in. # *.emerg :omusrmsg:* -# -# I like to have messages displayed on the console, but only on a virtual -# console I usually leave idle. -# -#daemon,mail.*;\ -# news.=crit;news.=err;news.=notice;\ -# *.=debug;*.=info;\ -# *.=notice;*.=warn /dev/tty8 - # The named pipe /dev/xconsole is for the `xconsole' utility. To use it, # you must invoke `xconsole' with the `-file' option: # diff --git a/src/sonic-sairedis b/src/sonic-sairedis index b865912105f2..7e70b4d63020 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit b865912105f2f80ee2516899e6367f863d5f6235 +Subproject commit 7e70b4d63020fc9ea1aa009c264e4effab7bcda0 diff --git a/src/sonic-swss b/src/sonic-swss index 27c49a0bf3a7..ab31a9af7ef2 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 27c49a0bf3a71556b553aa30fe2a7c1cdb996142 +Subproject commit ab31a9af7ef2c5ea9fe5f0f89f0a61b3ec0f83bf From 5cf37cbcb39ea1eda5b034f98f20b9247ce9f9c6 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 10 Aug 2017 16:48:45 -0700 Subject: [PATCH 0711/1833] [Broadcom]: Update Broadcom SAI/SDK version (#883) --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index b829e8207890..54655563d638 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,11 +1,11 @@ -BRCM_SAI = libsaibcm_3.0.2.2_amd64.deb +BRCM_SAI = libsaibcm_3.0.2.3_amd64.deb # TODO: upload new SAI build to blob -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.2.2_amd64.deb" +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.2.3_amd64.deb" -BRCM_SAI_DEV = libsaibcm-dev_3.0.2.2_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.2.3_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) # TODO: upload new SAI build to blob -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.2.2_amd64.deb" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.2.3_amd64.deb" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index d952f436099d..5824590c8d52 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,9 +1,9 @@ -BRCM_OPENNSL = libopennsl_3.2.3.1_amd64.deb +BRCM_OPENNSL = libopennsl_3.2.3.3_amd64.deb # TODO: upload new SDK build to blob -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.3.1+0~20170605184634.7~1.gbp4a0717_amd64.deb" +$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.3.3_amd64.deb" -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.1_amd64.deb +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.3_amd64.deb # TODO: upload new SDK build to blob -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.1+0~20170605184634.7~1.gbp4a0717_amd64.deb" +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3_amd64.deb" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) From c82868e631566a652fd61142cc09838b45e522c6 Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Thu, 10 Aug 2017 19:03:05 -0700 Subject: [PATCH 0712/1833] [quagga]: Update sonic-quagga submodule - [bgpd]: Enable forwarding state flag in graceful restart capability - [debian]: Add autoreconf_clean --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index df6b70902b4c..b066bef0e8dc 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit df6b70902b4c29447ac52277cf6d5b7f6abca71e +Subproject commit b066bef0e8dcf23b8e1751652397c09e61ee4bdd From e383a27f5f1d5550de377f50c69fde66ba0e2459 Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Thu, 10 Aug 2017 19:10:36 -0700 Subject: [PATCH 0713/1833] [mellanox]: Disable fsat boot mode for SX kernel --- files/build_templates/swss.service.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index f383a886eb35..ed6b852f18f9 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -18,7 +18,6 @@ ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB {% if sonic_asic_platform == 'mellanox' %} -Environment=FAST_BOOT=1 TimeoutStartSec=3min ExecStartPre=/usr/bin/mst start ExecStartPre=/usr/bin/mlnx-fw-upgrade.sh From fa1ac0e05a7fc9263ffd57f32f178399336761ef Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Thu, 10 Aug 2017 19:14:20 -0700 Subject: [PATCH 0714/1833] [swss-common]: Update sonic-swss-common submodule - [netlink]: Increase netlink buffer size - [netlink]: Check return vode from nl_recvmsgs_default - [select]: EINTR error hanlding - [makefile]: Use full file names --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 2716292fdd78..5779685e1652 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 2716292fdd78dcbc8587a2c8d192d10465ec7225 +Subproject commit 5779685e165201f69dae5e75b8549550dd5f165c From df3436b80b2931a0baed6656ad96495e7999cdf6 Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Thu, 10 Aug 2017 19:24:43 -0700 Subject: [PATCH 0715/1833] [utilities]: Update sonic-utilities submodule - [sfputil]: Refactor and add support for presence, low-power mode and reset --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index c7f6ff677b54..ac7ea4f3b9dc 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit c7f6ff677b54eb401e7b2fd3a3d9c4072325bb78 +Subproject commit ac7ea4f3b9dcc5cef15cc7ec0e796cde8a7f8ab8 From 338a83bacc646148e0fec0cca400bfd34a818669 Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Thu, 10 Aug 2017 19:32:39 -0700 Subject: [PATCH 0716/1833] [mellanox]: Update Mellanox SAI version --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 66f6c3e257ce..c1c69b1192c3 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.8.2-master -MLNX_SAI_REVISION = 852ef62c021dad6a1fec932a9c89df0e7f19460e +MLNX_SAI_REVISION = 9a5155c0df10d733863c8c3d0e5385cecac3324a export MLNX_SAI_VERSION MLNX_SAI_REVISION From 178fc032ae45a17170a2c4fb22d0569dc139b63c Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 11 Aug 2017 11:36:32 -0700 Subject: [PATCH 0717/1833] [sfputil]: Add support for SFP presence, low-power mode and reset (#877) - Update sfputil plugins for Dell FORCE10-S6000, Arista 7050-QX-32, 7050-QX-32-S --- .../plugins/sfputil.py | 11 +- .../plugins/sfputil.py | 11 +- .../plugins/sfputil.py | 182 ++++++++++++++++-- files/image_config/sudoers/sudoers | 2 +- .../broadcom/sonic-platform-modules-arista | 2 +- src/sonic-utilities | 2 +- 6 files changed, 182 insertions(+), 28 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py b/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py index b85e0f53653e..9a6d770d460b 100644 --- a/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py +++ b/device/arista/x86_64-arista_7050_qx32/plugins/sfputil.py @@ -1,9 +1,12 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: import arista.utils.sonic_sfputil as arista_sfputil -except ImportError, e: - raise ImportError (str(e) + "- required module not found") +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) -sfputil = arista_sfputil.getSfpUtil() +SfpUtil = arista_sfputil.getSfpUtil() diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py b/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py index b85e0f53653e..9a6d770d460b 100644 --- a/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/sfputil.py @@ -1,9 +1,12 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: import arista.utils.sonic_sfputil as arista_sfputil -except ImportError, e: - raise ImportError (str(e) + "- required module not found") +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) -sfputil = arista_sfputil.getSfpUtil() +SfpUtil = arista_sfputil.getSfpUtil() diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py index 8b1ec277d79f..1f2b9e9f61ef 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py @@ -1,27 +1,175 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + 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""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 31 - ports_in_block = 32 + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 - eeprom_offset = 20 + EEPROM_OFFSET = 20 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} - _qsfp_ports = range(0, ports_in_block + 1) + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' for x in range(0, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) - sfputilbase.__init__(self, port_num) + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/dell-s6000-cpld.0/qsfp_modprs") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/dell-s6000-cpld.0/qsfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/dell-s6000-cpld.0/qsfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/dell-s6000-cpld.0/qsfp_reset" + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # 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(QSFP_RESET_REGISTER_DEVICE_FILE, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index cfff38b5027d..715a1979f1ab 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -25,7 +25,7 @@ Cmnd_Alias READ_ONLY_CMDS = /usr/bin/decode-syseeprom, \ /usr/bin/lldpctl, \ /usr/bin/lldpshow, \ /usr/bin/sensors, \ - /usr/bin/sfputil, \ + /usr/bin/sfputil show *, \ /usr/bin/vtysh -c show *, \ /bin/cat /var/log/syslog, \ /usr/bin/tail -f /var/log/syslog diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index a90b9fc5b085..51bbe2cd86af 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a90b9fc5b085cdb99d10d338a23daa66c7f351b2 +Subproject commit 51bbe2cd86af7df20b27e0cd1f02c2ad08ab2f03 diff --git a/src/sonic-utilities b/src/sonic-utilities index c7f6ff677b54..ac7ea4f3b9dc 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit c7f6ff677b54eb401e7b2fd3a3d9c4072325bb78 +Subproject commit ac7ea4f3b9dcc5cef15cc7ec0e796cde8a7f8ab8 From 49feeaa4568731f475fcb46d224c2544b6942bcc Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 14 Aug 2017 10:25:50 -0700 Subject: [PATCH 0718/1833] [LEDs]: Initialize status and fan LEDs to green on Arista 7050-QX-32/7050-QX-32-S (#886) --- .../plugins/led_control.py | 20 ++++++++++++++++++ .../plugins/led_control.py | 21 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py index 1c69d8109f57..1f6034e2e2eb 100644 --- a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py @@ -75,6 +75,26 @@ def port_link_state_change(self, port, state): # Constructor def __init__(self): + # Initialize all front-panel status LEDs to green + with open("/sys/class/leds/status/brightness", "w") as f: + f.write("1") + with open("/sys/class/leds/fan_status/brightness", "w") as f: + f.write("1") + with open("/sys/class/leds/psu1/brightness", "w") as f: + f.write("1") + with open("/sys/class/leds/psu2/brightness", "w") as f: + f.write("1") + + # Initialize all fan LEDs to green + with open("/sys/devices/platform/sb800-fans/hwmon/hwmon1/fan1_led", "w") as f: + f.write("3") + with open("/sys/devices/platform/sb800-fans/hwmon/hwmon1/fan2_led", "w") as f: + f.write("3") + with open("/sys/devices/platform/sb800-fans/hwmon/hwmon1/fan3_led", "w") as f: + f.write("3") + with open("/sys/devices/platform/sb800-fans/hwmon/hwmon1/fan4_led", "w") as f: + f.write("3") + # Initialize: Turn all front panel QSFP LEDs off for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): for lane in range(1, 5): diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py index 839092ee1d4b..f2cb73194e14 100644 --- a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py @@ -70,6 +70,27 @@ def port_link_state_change(self, port, state): # Constructor def __init__(self): + # Initialize all front-panel status LEDs to green + with open("/sys/class/leds/status/brightness", "w") as f: + f.write("1") + with open("/sys/class/leds/fan_status/brightness", "w") as f: + f.write("1") + with open("/sys/class/leds/psu1/brightness", "w") as f: + f.write("1") + with open("/sys/class/leds/psu2/brightness", "w") as f: + f.write("1") + + # Initialize all fan LEDs to green + with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon2/fan1_led", "w") as f: + f.write("1") + with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon2/fan2_led", "w") as f: + f.write("1") + with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon2/fan3_led", "w") as f: + f.write("1") + with open("/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060/hwmon/hwmon2/fan4_led", "w") as f: + f.write("1") + + # Initialize: Turn all front panel QSFP LEDs off for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): for lane in range(1, 5): From 232acbf2176eb489ff0b80e2ebfb7a0966a3162b Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Mon, 14 Aug 2017 21:41:44 +0300 Subject: [PATCH 0719/1833] [submodule] update sonic-swss submodule (#885) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index ab31a9af7ef2..f9b55d30276d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit ab31a9af7ef2c5ea9fe5f0f89f0a61b3ec0f83bf +Subproject commit f9b55d30276d1a6ab94e7321d9b2a3bf076fd683 From c299fe472d35077fe932d592c9e5c2b3fdebd3b3 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 14 Aug 2017 15:56:40 -0700 Subject: [PATCH 0720/1833] Update sonic-utilities (#887) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index ac7ea4f3b9dc..18bb5ed74cb4 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ac7ea4f3b9dcc5cef15cc7ec0e796cde8a7f8ab8 +Subproject commit 18bb5ed74cb40c5205cdc0a553ce79c02a541272 From f938f3ecafcb9fde755508da721424b31269e76c Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 15 Aug 2017 10:38:22 -0700 Subject: [PATCH 0721/1833] [docker-platform-monitor]: Prevent supervisor from logging unexpected exits from processes known to exit in < 1 second (#889) --- dockers/docker-platform-monitor/supervisord.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-platform-monitor/supervisord.conf b/dockers/docker-platform-monitor/supervisord.conf index 6fb73450afec..0a05e61efff1 100644 --- a/dockers/docker-platform-monitor/supervisord.conf +++ b/dockers/docker-platform-monitor/supervisord.conf @@ -10,6 +10,7 @@ autostart=true autorestart=false stdout_logfile=syslog stderr_logfile=syslog +startsecs=0 [program:rsyslogd] command=/usr/sbin/rsyslogd -n @@ -26,6 +27,7 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +startsecs=0 [program:fancontrol] command=/usr/sbin/fancontrol @@ -41,3 +43,4 @@ priority=5 autostart=false stdout_logfile=syslog stderr_logfile=syslog +startsecs=0 From 3a8f5be19a1b4978c415e37a4817e61ecd549b87 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 15 Aug 2017 10:38:49 -0700 Subject: [PATCH 0722/1833] [docker-database]: Start rsyslogd to allow supervisor to log to syslog (#890) --- dockers/docker-database/supervisord.conf | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dockers/docker-database/supervisord.conf b/dockers/docker-database/supervisord.conf index 42b0eddac0a7..9ad7ff32bcf9 100644 --- a/dockers/docker-database/supervisord.conf +++ b/dockers/docker-database/supervisord.conf @@ -3,9 +3,17 @@ logfile_maxbytes=1MB logfile_backups=2 nodaemon=true +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + [program:redis-server] command=/usr/bin/redis-server /etc/redis/redis.conf -priority=1 +priority=2 autostart=true autorestart=false stdout_logfile=syslog @@ -13,9 +21,8 @@ stderr_logfile=syslog [program:configdb-load.sh] command=/usr/bin/configdb-load.sh -priority=2 +priority=3 autostart=true autorestart=false stdout_logfile=syslog stderr_logfile=syslog - From 674e2f9467fa71d6af751c41a8ce0f3f89a1f08a Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Tue, 15 Aug 2017 11:54:18 -0700 Subject: [PATCH 0723/1833] Revert "[mellanox]: Update Mellanox SAI version" This reverts commit 338a83bacc646148e0fec0cca400bfd34a818669. We first test the previous version of the SAI and make sure it passes all the tests and then update the SAI version to a later one. --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index c1c69b1192c3..fbf4f94b590e 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.8.2-master -MLNX_SAI_REVISION = 9a5155c0df10d733863c8c3d0e5385cecac3324a +MLNX_SAI_REVISION = 6b094746adc7ef2321701b4868806bc54a95bbd1 export MLNX_SAI_VERSION MLNX_SAI_REVISION From 693ad9c4eea816cc060bf74320abfd6242ff4812 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 15 Aug 2017 12:10:43 -0700 Subject: [PATCH 0724/1833] [quagga]: Update sonic-quagga submodule (#892) - [bgpd]: Enable forwarding state flag in graceful restart capability - [debian]: Add autoreconf_clean --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index df6b70902b4c..b066bef0e8dc 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit df6b70902b4c29447ac52277cf6d5b7f6abca71e +Subproject commit b066bef0e8dcf23b8e1751652397c09e61ee4bdd From 6603e0ad5d261133e45bfe84bfe80582b3332ab5 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 15 Aug 2017 16:10:08 -0700 Subject: [PATCH 0725/1833] [Submodule update]: sonic-utilities (#888) * Track branch v1.0.3 for sonic-utilities * Spaces to tabs --- .gitmodules | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitmodules b/.gitmodules index 5bf6fb5b4a61..431a525ebab1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -44,6 +44,7 @@ [submodule "src/sonic-utilities"] path = src/sonic-utilities url = https://github.com/Azure/sonic-utilities + branch = v1.0.3 [submodule "platform/broadcom/sonic-platform-modules-s6000"] path = platform/broadcom/sonic-platform-modules-s6000 url = https://github.com/Azure/sonic-platform-modules-s6000 From 1be1c466fe0b5aacb3c6db7295203dec2bdf3972 Mon Sep 17 00:00:00 2001 From: cytsai0409 Date: Wed, 16 Aug 2017 22:38:10 +0800 Subject: [PATCH 0726/1833] Add s8810 32q platform support (#867) * Add S8810-32Q platform support * Update sonic-platform-modules-ingrasys submodule * Add sys eeprom plugin for S8810-32Q * Add sfputil plugin for S8810-32Q * Add sensors config for S8810-32Q * Add S8810-32Q HwSku port_config * Add fancontrol config for S8810-32Q Signed-off-by: Jason Tsai * Add S8810-32Q platform support * Add sys eeprom plugin for S8810-32Q * Add sfputil plugin for S8810-32Q * Add sensors config for S8810-32Q * Add S8810-32Q HwSku port_config * Add fancontrol config for S8810-32Q Signed-off-by: Jason Tsai * Add S8810-32Q platform support * Add S8810-32Q platform support in Makefile Signed-off-by: Jason Tsai * Fix build error on S8810 platform driver package Signed-off-by: Jason Tsai --- .../INGRASYS-S8810-32Q/port_config.ini | 33 +++++ .../INGRASYS-S8810-32Q/sai.profile | 1 + .../x86_64-ingrasys_s8810_32q-r0/fancontrol | 12 ++ .../installer.conf | 3 + .../led_proc_init.soc | 45 +++++++ .../minigraph.xml | 121 ++++++++++++++++++ .../plugins/eeprom.py | 24 ++++ .../plugins/sfputil.py | 61 +++++++++ .../x86_64-ingrasys_s8810_32q-r0/sensors.conf | 47 +++++++ platform/broadcom/one-image.mk | 1 + .../broadcom/platform-modules-ingrasys.mk | 8 +- .../broadcom/sonic-platform-modules-ingrasys | 2 +- 12 files changed, 356 insertions(+), 2 deletions(-) create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/sai.profile create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/installer.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/led_proc_init.soc create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/eeprom.py create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini new file mode 100644 index 000000000000..fb9235101108 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 37,38,39,40 +Ethernet4 33,34,35,36 +Ethernet8 45,46,47,48 +Ethernet12 41,42,43,44 +Ethernet16 53,54,55,56 +Ethernet20 49,50,51,52 +Ethernet24 61,62,63,64 +Ethernet28 57,58,59,60 +Ethernet32 69,70,71,72 +Ethernet36 65,66,67,68 +Ethernet40 77,78,79,80 +Ethernet44 73,74,75,76 +Ethernet48 85,86,87,88 +Ethernet52 81,82,83,84 +Ethernet56 93,94,95,96 +Ethernet60 89,90,91,92 +Ethernet64 101,102,103,104 +Ethernet68 97,98,99,100 +Ethernet72 109,110,111,112 +Ethernet76 105,106,107,108 +Ethernet80 117,118,119,120 +Ethernet84 113,114,115,116 +Ethernet88 125,126,127,128 +Ethernet92 121,122,123,124 +Ethernet96 5,6,7,8 +Ethernet100 1,2,3,4 +Ethernet104 13,14,15,16 +Ethernet108 9,10,11,12 +Ethernet112 21,22,23,24 +Ethernet116 17,18,19,20 +Ethernet120 29,30,31,32 +Ethernet124 25,26,27,28 diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/sai.profile b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/sai.profile new file mode 100644 index 000000000000..3fdcc3f1a506 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/td2-s8810-32x40G.config.bcm diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol new file mode 100644 index 000000000000..05a71e8d999c --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon2=w83795adg +FCTEMPS=hwmon2/device/pwm2=hwmon2/device/temp2_input hwmon2/device/pwm1=hwmon2/device/temp2_input +#FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input+hwmon2/device/fan7_input+hwmon2/device/fan6_input+hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input+hwmon2/device/fan3_input+hwmon2/device/fan2_input+hwmon2/device/fan1_input +FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input +MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 +MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 +MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 +MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 + diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/led_proc_init.soc b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/led_proc_init.soc new file mode 100644 index 000000000000..8c1a18f6236b --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/led_proc_init.soc @@ -0,0 +1,45 @@ +#processor initialization for Ingrasys S8810-32Q + +led 0 stop +led 0 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0E 87 22 0F 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 REMAP_PORT_2=49 REMAP_PORT_1=50 REMAP_PORT_0=51 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 REMAP_PORT_6=53 REMAP_PORT_5=54 REMAP_PORT_4=55 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 REMAP_PORT_10=57 REMAP_PORT_9=58 REMAP_PORT_8=59 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 REMAP_PORT_14=61 REMAP_PORT_13=62 REMAP_PORT_12=63 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 REMAP_PORT_18=45 REMAP_PORT_17=46 REMAP_PORT_16=47 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 REMAP_PORT_22=41 REMAP_PORT_21=42 REMAP_PORT_20=43 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 REMAP_PORT_26=37 REMAP_PORT_25=38 REMAP_PORT_24=39 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 REMAP_PORT_30=33 REMAP_PORT_29=34 REMAP_PORT_28=35 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 REMAP_PORT_34=17 REMAP_PORT_33=18 REMAP_PORT_32=19 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 REMAP_PORT_38=21 REMAP_PORT_37=22 REMAP_PORT_36=23 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 REMAP_PORT_42=25 REMAP_PORT_41=26 REMAP_PORT_40=27 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 REMAP_PORT_46=29 REMAP_PORT_45=30 REMAP_PORT_44=31 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 REMAP_PORT_50=13 REMAP_PORT_49=14 REMAP_PORT_48=15 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 REMAP_PORT_54=9 REMAP_PORT_53=10 REMAP_PORT_52=11 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 REMAP_PORT_58=5 REMAP_PORT_57=6 REMAP_PORT_56=7 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 REMAP_PORT_62=1 REMAP_PORT_61=2 REMAP_PORT_60=3 + +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0E 87 22 0F 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 REMAP_PORT_2=49 REMAP_PORT_1=50 REMAP_PORT_0=51 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 REMAP_PORT_6=53 REMAP_PORT_5=54 REMAP_PORT_4=55 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 REMAP_PORT_10=57 REMAP_PORT_9=58 REMAP_PORT_8=59 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 REMAP_PORT_14=61 REMAP_PORT_13=62 REMAP_PORT_12=63 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 REMAP_PORT_18=45 REMAP_PORT_17=46 REMAP_PORT_16=47 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 REMAP_PORT_22=41 REMAP_PORT_21=42 REMAP_PORT_20=43 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 REMAP_PORT_26=37 REMAP_PORT_25=38 REMAP_PORT_24=39 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 REMAP_PORT_30=33 REMAP_PORT_29=34 REMAP_PORT_28=35 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 REMAP_PORT_34=17 REMAP_PORT_33=18 REMAP_PORT_32=19 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 REMAP_PORT_38=21 REMAP_PORT_37=22 REMAP_PORT_36=23 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 REMAP_PORT_42=25 REMAP_PORT_41=26 REMAP_PORT_40=27 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 REMAP_PORT_46=29 REMAP_PORT_45=30 REMAP_PORT_44=31 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 REMAP_PORT_50=13 REMAP_PORT_49=14 REMAP_PORT_48=15 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 REMAP_PORT_54=9 REMAP_PORT_53=10 REMAP_PORT_52=11 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 REMAP_PORT_58=5 REMAP_PORT_57=6 REMAP_PORT_56=7 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 REMAP_PORT_62=1 REMAP_PORT_61=2 REMAP_PORT_60=3 + +led 1 auto on +led 1 start diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml new file mode 100644 index 000000000000..ab90ada24274 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml @@ -0,0 +1,121 @@ + + + + + + OCPSCH0104001MS + 10.10.1.30 + OCPSCH01040HHLF + 10.10.1.29 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.30 + OCPSCH01040HHLF + 10.10.2.29 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040HHLF + + +
10.10.1.30
+ + +
+ +
10.10.2.30
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.10/32 + + 100.0.0.10/32 + + + + + + + + OCPSCH01040HHLF + + + + + + Ethernet48 + 10.10.1.29/30 + + + + Ethernet52 + 10.10.2.29/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet48 + OCPSCH01040HHLF + Ethernet48 + + + 40000 + DeviceInterfaceLink + OCPSCH8810MS + Ethernet0 + OCPSCH01040HHLF + Ethernet52 + + + + + OCPSCH8810HHLF + INGRASYS-S8810-32Q + + + + OCPSCH01040HHLF + INGRASYS-S8810-32Q +
diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/eeprom.py new file mode 100644 index 000000000000..4f919ccd7273 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S8810-32Q +# +# 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): + i2c_bus = "12" + i2c_addr = "0056" + self.eeprom_path = "/sys/class/i2c-adapter/i2c-" + i2c_bus + "/" + i2c_bus + "-" + i2c_addr + "/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py new file mode 100644 index 000000000000..7bc71c27eeb6 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +try: + from sonic_sfp.sfputilbase import sfputilbase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class sfputil(sfputilbase): + """Platform specific sfputil class""" + + port_start = 0 + port_end = 31 + ports_in_block = 32 + + port_to_eeprom_mapping = {} + #FIXME + port_to_i2c_mapping = { + 0: 18, + 1: 19, + 2: 20, + 3: 21, + 4: 22, + 5: 23, + 6: 24, + 7: 25, + 8: 26, + 9: 27, + 10: 28, + 11: 29, + 12: 30, + 13: 31, + 14: 32, + 15: 33, + 16: 34, + 17: 35, + 18: 36, + 19: 37, + 20: 38, + 21: 39, + 22: 40, + 23: 41, + 24: 42, + 25: 43, + 26: 44, + 27: 45, + 28: 46, + 29: 47, + 30: 48, + 31: 49 + } + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self, port_num): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(self.port_start, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + sfputilbase.__init__(self, port_num) diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf new file mode 100644 index 000000000000..7ab599698225 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf @@ -0,0 +1,47 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + label temp1 "DIMM Temp" + set temp1_max 50 + set temp1_crit 85 + +chip "w83795adg-*" + label in0 "ROV" + set in0_min 1 * 0.97 + set in0_max 1 * 1.033 + ignore in1 + ignore in2 + label in3 "1.0V" + set in3_min 1 * 0.97 + set in3_max 1 * 1.03 + label in4 "1.8V" + set in4_min 1.8 * 0.95 + set in4_max 1.8 * 1.05 + ignore in5 + label in6 "5.0V" + compute in6 (4)*@, @/(4) + set in6_min 5 * 0.95 + set in6_max 5 * 1.05 + ignore in7 + label in12 "3.3V" + compute in6 (2)*@, @/(2) + set in12_min 3.3 * 0.97 + set in12_max 3.3 * 1.03 + ignore in14 + ignore in15 + ignore in16 + label fan1 "FANTRAY 1-A" + label fan2 "FANTRAY 1-B" + label fan3 "FANTRAY 2-A" + label fan4 "FANTRAY 2-B" + label fan5 "FANTRAY 3-A" + label fan6 "FANTRAY 3-B" + label fan7 "FANTRAY 4-A" + label fan8 "FANTRAY 4-B" + label temp1 "MAC Temp" + label temp2 "SFP+ Port 1 Temp" + label temp3 "SFP+ Port 8 Temp" + ignore temp4 + ignore intrusion0 diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 912c3ea3961d..2340177fd18b 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -10,6 +10,7 @@ $(SONIC_ONE_IMAGE)_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(INGRASYS_S8900_54XC_PLATFORM_MODULE) \ $(INGRASYS_S8900_64XC_PLATFORM_MODULE) \ $(INGRASYS_S9100_PLATFORM_MODULE) \ + $(INGRASYS_S8810_32Q_PLATFORM_MODULE) \ $(ACCTON_AS7712_32X_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-ingrasys.mk b/platform/broadcom/platform-modules-ingrasys.mk index 95009102dd76..e5ef4021eff7 100644 --- a/platform/broadcom/platform-modules-ingrasys.mk +++ b/platform/broadcom/platform-modules-ingrasys.mk @@ -1,12 +1,14 @@ -# Ingrasys S9100, S8900-64XC and S8900-54XC Platform modules +# Ingrasys S9100, S8900-64XC, S8900-54XC and S8810-32Q Platform modules INGRASYS_S9100_PLATFORM_MODULE_VERSION = 1.1.0 INGRASYS_S8900_64XC_PLATFORM_MODULE_VERSION = 1.1.0 INGRASYS_S8900_54XC_PLATFORM_MODULE_VERSION = 1.1.0 +INGRASYS_S8810_32Q_PLATFORM_MODULE_VERSION = 1.1.0 export INGRASYS_S9100_PLATFORM_MODULE_VERSION export INGRASYS_S8900_64XC_PLATFORM_MODULE_VERSION export INGRASYS_S8900_54XC_PLATFORM_MODULE_VERSION +export INGRASYS_S8810_32Q_PLATFORM_MODULE_VERSION INGRASYS_S9100_PLATFORM_MODULE = sonic-platform-ingrasys-s9100_$(INGRASYS_S9100_PLATFORM_MODULE_VERSION)_amd64.deb $(INGRASYS_S9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys @@ -20,5 +22,9 @@ $(INGRASYS_S8900_64XC_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s8900_64xc-r0 INGRASYS_S8900_54XC_PLATFORM_MODULE = sonic-platform-ingrasys-s8900-54xc_$(INGRASYS_S8900_54XC_PLATFORM_MODULE_VERSION)_amd64.deb $(INGRASYS_S8900_54XC_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s8900_54xc-r0 +INGRASYS_S8810_32Q_PLATFORM_MODULE = sonic-platform-ingrasys-s8810-32q_$(INGRASYS_S8810_32Q_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S8810_32Q_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s8810_32q-r0 + $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8900_64XC_PLATFORM_MODULE))) $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8900_54XC_PLATFORM_MODULE))) +$(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8810_32Q_PLATFORM_MODULE))) diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index 50471fdaaa48..1a67af3caa00 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit 50471fdaaa4849c19a97d8623971450f09903d5d +Subproject commit 1a67af3caa00352e5e7db880e1eeda0bdf1fde6b From f0cc414dff1fc5a269ed15abf5dcf1ae363467b0 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 16 Aug 2017 13:47:20 -0700 Subject: [PATCH 0727/1833] [SAI]: Remove the SAI submodule from buildimage repo (#893) SAI is a submodule of sonic-sairedis repository. Remove the dependency from this repository. --- .gitmodules | 4 ---- src/SAI | 1 - 2 files changed, 5 deletions(-) delete mode 160000 src/SAI diff --git a/.gitmodules b/.gitmodules index 431a525ebab1..4bddfb4a60da 100644 --- a/.gitmodules +++ b/.gitmodules @@ -57,10 +57,6 @@ [submodule "platform/broadcom/sonic-platform-modules-ingrasys"] path = platform/broadcom/sonic-platform-modules-ingrasys url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys -[submodule "src/SAI"] - path = src/SAI - url = https://github.com/opencomputeproject/SAI - branch = v0.9.4 [submodule "src/sonic-platform-daemons"] path = src/sonic-platform-daemons url = https://github.com/Azure/sonic-platform-daemons diff --git a/src/SAI b/src/SAI deleted file mode 160000 index 940c7b6afb1d..000000000000 --- a/src/SAI +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 940c7b6afb1db4e8504b7cdb24ccd669748dbde8 From c52e876697f2fa96a8ed3a7556bf5d367b47df23 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Wed, 16 Aug 2017 21:12:32 -0700 Subject: [PATCH 0728/1833] Fix the network command for ipv6 vlan interfaces (#894) --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index a5c317aa2e80..eb1da1f1a3ea 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -46,7 +46,13 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endif %} {% block vlan_advertisement %} {% for vlan_interface in minigraph_vlan_interfaces %} +{% if vlan_interface['addr'] | ipv4 %} network {{ vlan_interface['subnet'] }} +{% elif vlan_interface['addr'] | ipv6 %} + address-family ipv6 + network {{ vlan_interface['subnet'] }} + exit-address-family +{% endif %} {% endfor %} {% endblock vlan_advertisement %} {% block bgp_sessions %} From 78ce6b951f9a519bccea4331b11fe938f4ddfdb2 Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Wed, 16 Aug 2017 21:13:01 -0700 Subject: [PATCH 0729/1833] Fixing a couple of issues to enable FRR to run with latest SONiC code. (#895) * Adjusting FRR's jinja template to meet latest sonic-cfgen requirements. Basically, i'm just extending #448 changes into FRR. * Eliminate FRR's integrated-config file to prevent daemons from bypassing their own config files. FRR daemons now default to an integrated-config file for config-parsing purposes. But we are still interested in having each daemon looking in their specific config file (bgpd.conf, zebra.conf, etc). So here i'm just deleting this integrating-config file to prevent FRR from running from a bogus config-file. RB= G=lnos-reviewers R=ntrianta,rjonnadu,rmolina,sfardeen,zxu A= --- dockers/docker-fpm-frr/config.sh | 5 +++++ dockers/docker-fpm-frr/zebra.conf.j2 | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dockers/docker-fpm-frr/config.sh b/dockers/docker-fpm-frr/config.sh index d795bcefa701..0636a6dc413c 100755 --- a/dockers/docker-fpm-frr/config.sh +++ b/dockers/docker-fpm-frr/config.sh @@ -12,5 +12,10 @@ sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate chown root:root /usr/sbin/bgp-unisolate chmod 0755 /usr/sbin/bgp-unisolate +# If there's an integrated-config file, go ahead and remote it +if [ -f /etc/frr/frr.conf ]; then + rm -rf /etc/frr/frr.conf +fi + mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status diff --git a/dockers/docker-fpm-frr/zebra.conf.j2 b/dockers/docker-fpm-frr/zebra.conf.j2 index dc2061f8a02a..1ce06eecd2d9 100644 --- a/dockers/docker-fpm-frr/zebra.conf.j2 +++ b/dockers/docker-fpm-frr/zebra.conf.j2 @@ -15,12 +15,12 @@ enable password zebra {% block interfaces %} ! Enable link-detect (default disabled) {% for interface in minigraph_interfaces %} -interface {{ interface['alias'] }} +interface {{ interface['attachto'] }} link-detect ! {% endfor %} -{% for interface in minigraph_portchannel_interfaces %} -interface {{ interface['name'] }} +{% for interface in minigraph_portchannels.keys() %} +interface {{ interface }} link-detect ! {% endfor %} From 7fca49e7dfcbafa8043f4f28982c5b78883cece0 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 18 Aug 2017 10:41:06 -0700 Subject: [PATCH 0730/1833] [sonic-utilities]: Update submodule to remove pager from CLI utils (#897) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 18bb5ed74cb4..d1ded16b06b4 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 18bb5ed74cb40c5205cdc0a553ce79c02a541272 +Subproject commit d1ded16b06b493e2420d1013aee97afbdc8160d9 From 9c5988fa7ce330dae15122e5e973a76c774e82d7 Mon Sep 17 00:00:00 2001 From: "Vitaly.Vovnoboy" Date: Sat, 19 Aug 2017 11:57:36 +0300 Subject: [PATCH 0731/1833] Add Marvell platform (#765) * Adding Marvell platform. --- platform/marvell/docker-orchagent-mrvl.mk | 17 +++++++ platform/marvell/docker-syncd-mrvl-rpc.mk | 15 ++++++ .../docker-syncd-mrvl-rpc/99-syncd.conf | 2 + .../docker-syncd-mrvl-rpc/Dockerfile.j2 | 51 +++++++++++++++++++ .../docker-syncd-mrvl-rpc/ptf_nn_agent.conf | 10 ++++ platform/marvell/docker-syncd-mrvl.mk | 15 ++++++ .../marvell/docker-syncd-mrvl/Dockerfile.j2 | 29 +++++++++++ platform/marvell/docker-syncd-mrvl/start.sh | 8 +++ .../docker-syncd-mrvl/supervisord.conf | 29 +++++++++++ platform/marvell/docker-syncd-mrvl/syncd.sh | 12 +++++ platform/marvell/libsaithrift-dev.mk | 7 +++ platform/marvell/one-image.mk | 7 +++ platform/marvell/platform.conf | 0 platform/marvell/python-saithrift.mk | 6 +++ platform/marvell/rules.mk | 18 +++++++ platform/marvell/sai.mk | 9 ++++ platform/marvell/sai/Makefile | 9 ++++ platform/marvell/sdk.mk | 8 +++ platform/marvell/sdk/Makefile | 9 ++++ 19 files changed, 261 insertions(+) create mode 100644 platform/marvell/docker-orchagent-mrvl.mk create mode 100644 platform/marvell/docker-syncd-mrvl-rpc.mk create mode 100644 platform/marvell/docker-syncd-mrvl-rpc/99-syncd.conf create mode 100644 platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 create mode 100644 platform/marvell/docker-syncd-mrvl-rpc/ptf_nn_agent.conf create mode 100644 platform/marvell/docker-syncd-mrvl.mk create mode 100755 platform/marvell/docker-syncd-mrvl/Dockerfile.j2 create mode 100755 platform/marvell/docker-syncd-mrvl/start.sh create mode 100644 platform/marvell/docker-syncd-mrvl/supervisord.conf create mode 100755 platform/marvell/docker-syncd-mrvl/syncd.sh create mode 100644 platform/marvell/libsaithrift-dev.mk create mode 100644 platform/marvell/one-image.mk create mode 100644 platform/marvell/platform.conf create mode 100644 platform/marvell/python-saithrift.mk create mode 100644 platform/marvell/rules.mk create mode 100644 platform/marvell/sai.mk create mode 100644 platform/marvell/sai/Makefile create mode 100644 platform/marvell/sdk.mk create mode 100644 platform/marvell/sdk/Makefile diff --git a/platform/marvell/docker-orchagent-mrvl.mk b/platform/marvell/docker-orchagent-mrvl.mk new file mode 100644 index 000000000000..9461cafe2e89 --- /dev/null +++ b/platform/marvell/docker-orchagent-mrvl.mk @@ -0,0 +1,17 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_MRVL = docker-orchagent-mrvl.gz +$(DOCKER_ORCHAGENT_MRVL)_PATH = $(DOCKERS_PATH)/docker-orchagent +$(DOCKER_ORCHAGENT_MRVL)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MRVL) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MRVL) + +$(DOCKER_ORCHAGENT_MRVL)_CONTAINER_NAME = swss +$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro +$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro +$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /host/machine.conf:/host/machine.conf +$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_ORCHAGENT_MRVL)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel diff --git a/platform/marvell/docker-syncd-mrvl-rpc.mk b/platform/marvell/docker-syncd-mrvl-rpc.mk new file mode 100644 index 000000000000..d4002a3d645f --- /dev/null +++ b/platform/marvell/docker-syncd-mrvl-rpc.mk @@ -0,0 +1,15 @@ +# docker image for mrvl syncd with rpc + +DOCKER_SYNCD_MRVL_RPC = docker-syncd-mrvl-rpc.gz +$(DOCKER_SYNCD_MRVL_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-mrvl-rpc +$(DOCKER_SYNCD_MRVL_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) +$(DOCKER_SYNCD_MRVL_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MRVL) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) +endif + +$(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell/docker-syncd-mrvl-rpc/99-syncd.conf b/platform/marvell/docker-syncd-mrvl-rpc/99-syncd.conf new file mode 100644 index 000000000000..f3b57e3b1964 --- /dev/null +++ b/platform/marvell/docker-syncd-mrvl-rpc/99-syncd.conf @@ -0,0 +1,2 @@ +sysctl -w net.core.rmem_max=509430500 + diff --git a/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 new file mode 100644 index 000000000000..14a4698702f5 --- /dev/null +++ b/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 @@ -0,0 +1,51 @@ +FROM docker-syncd-mrvl + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +COPY \ +{% for deb in docker_syncd_mrvl_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -P syncd + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +{% for deb in docker_syncd_mrvl_rpc_debs.split(' ') -%} +dpkg_apt debs/{{ deb }}{{'; '}} +{%- endfor %} + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + python-pip \ + build-essential \ + libssl-dev \ + libffi-dev \ + python-dev \ + wget \ + cmake \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ + && pip install cffi==1.7.0 \ + && pip install --upgrade cffi==1.7.0 \ + && pip install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /root/deps + +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/marvell/docker-syncd-mrvl-rpc/ptf_nn_agent.conf b/platform/marvell/docker-syncd-mrvl-rpc/ptf_nn_agent.conf new file mode 100644 index 000000000000..fa1ed0eb1622 --- /dev/null +++ b/platform/marvell/docker-syncd-mrvl-rpc/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/platform/marvell/docker-syncd-mrvl.mk b/platform/marvell/docker-syncd-mrvl.mk new file mode 100644 index 000000000000..4ee42e9cb904 --- /dev/null +++ b/platform/marvell/docker-syncd-mrvl.mk @@ -0,0 +1,15 @@ +# docker image for mrvl syncd + +DOCKER_SYNCD_MRVL = docker-syncd-mrvl.gz +$(DOCKER_SYNCD_MRVL)_PATH = $(PLATFORM_PATH)/docker-syncd-mrvl +$(DOCKER_SYNCD_MRVL)_DEPENDS += $(SYNCD) $(MRVL_FPA) $(REDIS_TOOLS) +$(DOCKER_SYNCD_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL) +ifneq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL) +endif + +$(DOCKER_SYNCD_MRVL)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MRVL)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_MRVL)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_MRVL)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 new file mode 100755 index 000000000000..7676b3f2ffa1 --- /dev/null +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -0,0 +1,29 @@ +FROM docker-config-engine + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +COPY \ +{% for deb in docker_syncd_mrvl_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev libjemalloc1 nfs-common + +RUN dpkg -i \ +{% for deb in docker_syncd_mrvl_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +COPY ["start.sh", "syncd.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/platform/marvell/docker-syncd-mrvl/start.sh b/platform/marvell/docker-syncd-mrvl/start.sh new file mode 100755 index 000000000000..96e2a9128081 --- /dev/null +++ b/platform/marvell/docker-syncd-mrvl/start.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +supervisorctl start syncd + diff --git a/platform/marvell/docker-syncd-mrvl/supervisord.conf b/platform/marvell/docker-syncd-mrvl/supervisord.conf new file mode 100644 index 000000000000..1e015fef931f --- /dev/null +++ b/platform/marvell/docker-syncd-mrvl/supervisord.conf @@ -0,0 +1,29 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd_start.sh +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/platform/marvell/docker-syncd-mrvl/syncd.sh b/platform/marvell/docker-syncd-mrvl/syncd.sh new file mode 100755 index 000000000000..993cf100f2f0 --- /dev/null +++ b/platform/marvell/docker-syncd-mrvl/syncd.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +function clean_up { + service syncd stop + exit +} + +trap clean_up SIGTERM SIGKILL + +service syncd start + +read diff --git a/platform/marvell/libsaithrift-dev.mk b/platform/marvell/libsaithrift-dev.mk new file mode 100644 index 000000000000..443406e9c2fb --- /dev/null +++ b/platform/marvell/libsaithrift-dev.mk @@ -0,0 +1,7 @@ +# libsaithrift-dev package + +LIBSAITHRIFT_DEV_MRVL = libsaithrift-dev_0.9.4_amd64.deb +$(LIBSAITHRIFT_DEV_MRVL)_SRC_PATH = $(SRC_PATH)/SAI +$(LIBSAITHRIFT_DEV_MRVL)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(MRVL_FPA) $(MRVL_SAI) +$(LIBSAITHRIFT_DEV_MRVL)_RDEPENDS += $(LIBTHRIFT) $(MRVL_SAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MRVL) diff --git a/platform/marvell/one-image.mk b/platform/marvell/one-image.mk new file mode 100644 index 000000000000..ad8cd522f998 --- /dev/null +++ b/platform/marvell/one-image.mk @@ -0,0 +1,7 @@ +# sonic marvell one image installer + +SONIC_ONE_IMAGE = sonic-marvell.bin +$(SONIC_ONE_IMAGE)_MACHINE = marvell +$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/marvell/platform.conf b/platform/marvell/platform.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/marvell/python-saithrift.mk b/platform/marvell/python-saithrift.mk new file mode 100644 index 000000000000..f7a63b19edb8 --- /dev/null +++ b/platform/marvell/python-saithrift.mk @@ -0,0 +1,6 @@ +# python-saithrift package + +PYTHON_SAITHRIFT_MRVL = python-saithrift_0.9.4_amd64.deb +$(PYTHON_SAITHRIFT_MRVL)_SRC_PATH = $(SRC_PATH)/SAI +$(PYTHON_SAITHRIFT_MRVL)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) +SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MRVL) diff --git a/platform/marvell/rules.mk b/platform/marvell/rules.mk new file mode 100644 index 000000000000..c5df6bab194e --- /dev/null +++ b/platform/marvell/rules.mk @@ -0,0 +1,18 @@ +include $(PLATFORM_PATH)/sdk.mk +include $(PLATFORM_PATH)/sai.mk +include $(PLATFORM_PATH)/docker-syncd-mrvl.mk +include $(PLATFORM_PATH)/docker-syncd-mrvl-rpc.mk +include $(PLATFORM_PATH)/docker-orchagent-mrvl.mk +include $(PLATFORM_PATH)/libsaithrift-dev.mk +include $(PLATFORM_PATH)/python-saithrift.mk +include $(PLATFORM_PATH)/one-image.mk + +SONIC_ALL += $(SONIC_ONE_IMAGE) \ + $(DOCKER_FPM) \ + $(DOCKER_SYNCD_MRVL_RPC) + +# Inject mrvl sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) $(LIBSAITHRIFT_DEV_MRVL) + +# Runtime dependency on mrvl sai is set only for syncd +$(SYNCD)_RDEPENDS += $(MRVL_SAI) diff --git a/platform/marvell/sai.mk b/platform/marvell/sai.mk new file mode 100644 index 000000000000..a620e2f68761 --- /dev/null +++ b/platform/marvell/sai.mk @@ -0,0 +1,9 @@ +# Marvell SAI + +export MRVL_SAI_VERSION = 1.0.1 +export MRVL_SAI_TAG = SONiC.201705 +export MRVL_SAI = mrvllibsai_$(MRVL_SAI_VERSION).deb + +$(MRVL_SAI)_SRC_PATH = $(PLATFORM_PATH)/sai +$(MRVL_SAI)_DEPENDS += $(MRVL_FPA) +SONIC_MAKE_DEBS += $(MRVL_SAI) diff --git a/platform/marvell/sai/Makefile b/platform/marvell/sai/Makefile new file mode 100644 index 000000000000..1fad592a79ee --- /dev/null +++ b/platform/marvell/sai/Makefile @@ -0,0 +1,9 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MRVL_SAI_URL = https://github.com/Marvell-switching/SAI-plugin/raw/$(MRVL_SAI_TAG)/sai_deb/$(MRVL_SAI) + +$(addprefix $(DEST)/, $(MRVL_SAI)): $(DEST)/% : + # get deb package + wget -O $(DEST)/$(MRVL_SAI) $(MRVL_SAI_URL) diff --git a/platform/marvell/sdk.mk b/platform/marvell/sdk.mk new file mode 100644 index 000000000000..d5e31b995141 --- /dev/null +++ b/platform/marvell/sdk.mk @@ -0,0 +1,8 @@ +# Marvell FPA + +export MRVL_FPA_VERSION = 1.0.1 +export MRVL_FPA_TAG = SONiC.201705 +export MRVL_FPA = mrvllibfpa_$(MRVL_FPA_VERSION).deb + +$(MRVL_FPA)_SRC_PATH = $(PLATFORM_PATH)/sdk +SONIC_MAKE_DEBS += $(MRVL_FPA) diff --git a/platform/marvell/sdk/Makefile b/platform/marvell/sdk/Makefile new file mode 100644 index 000000000000..6822c7d7d274 --- /dev/null +++ b/platform/marvell/sdk/Makefile @@ -0,0 +1,9 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MRVL_FPA_URL = https://github.com/Marvell-switching/SAI-plugin/raw/$(MRVL_FPA_TAG)/sdk_deb/$(MRVL_FPA) + +$(addprefix $(DEST)/, $(MRVL_FPA)): $(DEST)/% : + # get deb package + wget -O $(DEST)/$(MRVL_FPA) $(MRVL_FPA_URL) From a92f5a9ffed21801b7f6989e0ff52b6d6e4e39bb Mon Sep 17 00:00:00 2001 From: byu343 Date: Sat, 19 Aug 2017 21:32:10 -0700 Subject: [PATCH 0732/1833] Add arista-net initramfs hook (#899) --- build_debian.sh | 4 +++ files/initramfs-tools/arista-net | 61 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 files/initramfs-tools/arista-net diff --git a/build_debian.sh b/build_debian.sh index ff86cb22de45..22cbef494f87 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -123,6 +123,10 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista- sudo cp files/initramfs-tools/mke2fs $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs +# Hook into initramfs: rename the management interfaces on arista switches +sudo cp files/initramfs-tools/arista-net $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net +sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net + ## Hook into initramfs: after partition mount and loop file mount ## 1. Prepare layered file system ## 2. Bind-mount docker working directory (docker aufs cannot work over aufs rootfs) diff --git a/files/initramfs-tools/arista-net b/files/initramfs-tools/arista-net new file mode 100644 index 000000000000..1fbe4838adf5 --- /dev/null +++ b/files/initramfs-tools/arista-net @@ -0,0 +1,61 @@ +#!/bin/sh + +case $1 in + prereqs) + exit 0 + ;; +esac + +set -e + +# Extract kernel parameters +set -- $(cat /proc/cmdline) +items="" +for x in "$@"; do + case "$x" in + Aboot=*) + aboot_flag="${x#Aboot=}" + ;; + net_*) + item="${x#net_}" + items="$items $item" + ;; + platform=*) + platform_flag="${x#platform=}" + ;; + esac +done + +arista_net_rename() { + local device_path="$1" + local new_name="$2" + local from_name="$3" + for path in $(ls -d /sys/class/net/$from_name* 2>/dev/null); do + local devid="$(realpath "$path/device")" + if echo "$devid" | grep -q "$device_path"; then + local cur_name="${path##*/}" + ip link set "$cur_name" name "$new_name" + return + fi + done +} + +# Iterate over all the net_maX items found in the cmdline two times. +# First time renaming the interfaces to maX. +# The second time renaming them to their final name ethX. +if [ -n "$aboot_flag" -a "$platform_flag" == 'rook' ]; then + for item in $items; do + key="${item%=*}" + value="${item#*=}" + arista_net_rename "$value" "$key" eth + done + for item in $items; do + key="${item%=*}" + value="${item#*=}" + index="${key#ma}" + index="$(( $index - 1 ))" + newKey="eth$index" + arista_net_rename "$value" "$newKey" ma + done +fi + From ed665884733fd72146c4d1ab35cc221d3c085e26 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 21 Aug 2017 13:55:59 -0700 Subject: [PATCH 0733/1833] [docker-fpm-quagga]: Manage Quagga processes (zebra, bgpd) using supervisor instead of watchquagga (#900) --- dockers/docker-fpm-quagga/Dockerfile.j2 | 4 +-- dockers/docker-fpm-quagga/daemons | 31 ---------------------- dockers/docker-fpm-quagga/start.sh | 5 ++-- dockers/docker-fpm-quagga/supervisord.conf | 27 ++++++++++++++----- 4 files changed, 25 insertions(+), 42 deletions(-) delete mode 100644 dockers/docker-fpm-quagga/daemons diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index 1f71c7130b8d..c10cf0fd71d9 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -22,10 +22,8 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -COPY ["start.sh", "/usr/bin/"] -COPY ["bgpcfgd", "/usr/bin/"] +COPY ["bgpcfgd", "start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["*.j2", "/usr/share/sonic/templates/"] -COPY ["daemons", "/etc/quagga/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-fpm-quagga/daemons b/dockers/docker-fpm-quagga/daemons deleted file mode 100644 index cb7c2322c9fb..000000000000 --- a/dockers/docker-fpm-quagga/daemons +++ /dev/null @@ -1,31 +0,0 @@ -# This file tells the quagga package which daemons to start. -# -# Entries are in the format: =(yes|no|priority) -# 0, "no" = disabled -# 1, "yes" = highest priority -# 2 .. 10 = lower priorities -# Read /usr/share/doc/quagga/README.Debian for details. -# -# Sample configurations for these daemons can be found in -# /usr/share/doc/quagga/examples/. -# -# ATTENTION: -# -# When activation a daemon at the first time, a config file, even if it is -# empty, has to be present *and* be owned by the user and group "quagga", else -# the daemon will not be started by /etc/init.d/quagga. The permissions should -# be u=rw,g=r,o=. -# When using "vtysh" such a config file is also needed. It should be owned by -# group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. -# -# The watchquagga daemon is always started. Per default in monitoring-only but -# that can be changed via /etc/quagga/debian.conf. -# -zebra=yes -bgpd=yes -ospfd=no -ospf6d=no -ripd=no -ripngd=no -isisd=no -babeld=no diff --git a/dockers/docker-fpm-quagga/start.sh b/dockers/docker-fpm-quagga/start.sh index ca876efe184e..1e7a49809d55 100755 --- a/dockers/docker-fpm-quagga/start.sh +++ b/dockers/docker-fpm-quagga/start.sh @@ -22,7 +22,8 @@ supervisorctl start bgpcfgd supervisorctl start rsyslogd -# Quagga has its own monitor process, 'watchquagga' -service quagga start +# Start Quagga processes +supervisorctl start zebra +supervisorctl start bgpd supervisorctl start fpmsyncd diff --git a/dockers/docker-fpm-quagga/supervisord.conf b/dockers/docker-fpm-quagga/supervisord.conf index 7b6de2163642..5a310a790f18 100644 --- a/dockers/docker-fpm-quagga/supervisord.conf +++ b/dockers/docker-fpm-quagga/supervisord.conf @@ -11,27 +11,42 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n +[program:bgpcfgd] +command=/usr/bin/bgpcfgd priority=2 autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog -[program:fpmsyncd] -command=fpmsyncd +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n priority=3 autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog -[program:bgpcfgd] -command=/usr/bin/bgpcfgd +[program:zebra] +command=/usr/lib/quagga/zebra -A 127.0.0.1 priority=4 autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +[program:bgpd] +command=/usr/lib/quagga/bgpd -A 127.0.0.1 +priority=5 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:fpmsyncd] +command=fpmsyncd +priority=6 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog From 7c75030ceadacf7183477a838f95c00fea801aec Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Tue, 22 Aug 2017 18:08:07 +0300 Subject: [PATCH 0734/1833] [mlnx-fw-upgrade]: Define required FW version in build time. (#902) - Do not query required FW from file. --- files/build_templates/sonic_debian_extension.j2 | 5 +++-- platform/mellanox/fw.mk | 10 ++++++---- .../{mlnx-fw-upgrade.sh => mlnx-fw-upgrade.j2} | 4 ++-- platform/mellanox/one-image.mk | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) rename platform/mellanox/{mlnx-fw-upgrade.sh => mlnx-fw-upgrade.j2} (91%) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 0b1d19b6e1b9..04f5181ff610 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -223,6 +223,7 @@ sudo cp {{src}} $FILESYSTEM_ROOT/{{dst}} {% if sonic_asic_platform == "mellanox" %} sudo mkdir -p $FILESYSTEM_ROOT/etc/mlnx/ -sudo cp target/files/$MLNX_FW $FILESYSTEM_ROOT/etc/mlnx/fw-SPC.mfa -sudo cp platform/mellanox/mlnx-fw-upgrade.sh $FILESYSTEM_ROOT/usr/bin/ +sudo cp target/files/$MLNX_FW_FILE $FILESYSTEM_ROOT/etc/mlnx/fw-SPC.mfa +j2 platform/mellanox/mlnx-fw-upgrade.j2 | sudo tee $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh +sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh {% endif %} diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 8e916d817602..a50230a025d9 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,7 +1,9 @@ # mellanox firmware -MLNX_FW = fw-SPC-rel-13_1224_0140-EVB.mfa -$(MLNX_FW)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW) -SONIC_ONLINE_FILES += $(MLNX_FW) +MLNX_FW_VERSION = 13.1224.0140 +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) -export MLNX_FW +export MLNX_FW_VERSION +export MLNX_FW_FILE diff --git a/platform/mellanox/mlnx-fw-upgrade.sh b/platform/mellanox/mlnx-fw-upgrade.j2 similarity index 91% rename from platform/mellanox/mlnx-fw-upgrade.sh rename to platform/mellanox/mlnx-fw-upgrade.j2 index d84265e02d97..ec002497ebd8 100755 --- a/platform/mellanox/mlnx-fw-upgrade.sh +++ b/platform/mellanox/mlnx-fw-upgrade.j2 @@ -1,5 +1,6 @@ #!/bin/bash +fw_required="{{ MLNX_FW_VERSION }}" query_retry_count_max="10" fw_file=/etc/mlnx/fw-SPC.mfa @@ -13,7 +14,7 @@ run_or_fail() { # wait until devices will be available query_retry_count="0" -query_cmd="mlxfwmanager --query -i ${fw_file}" +query_cmd="mlxfwmanager --query" ${query_cmd} > /dev/null while [[ (${query_retry_count} -lt ${query_retry_count_max}) && ($? -ne "0") ]]; do @@ -27,7 +28,6 @@ run_or_fail "${query_cmd}" > /tmp/mlnxfwmanager-query.txt # get current firmware version and required version fw_info=$(grep FW /tmp/mlnxfwmanager-query.txt) fw_current=$(echo $fw_info | cut -f2 -d' ') -fw_required=$(echo $fw_info | cut -f3 -d' ') if [[ -z ${fw_current} ]]; then echo "Could not retreive current FW version." diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk index 9293e6a727e9..db8826951ca8 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)_DEPENDS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) -$(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW) +$(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW_FILE) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) From d2120449d51362da6a4ded1676ff2db18e5e95b5 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 22 Aug 2017 13:54:10 -0700 Subject: [PATCH 0735/1833] [sonic-sairedis] update sairedis submodule (#211, #212) (#904) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 7e70b4d63020..3f4afbbd9d7e 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 7e70b4d63020fc9ea1aa009c264e4effab7bcda0 +Subproject commit 3f4afbbd9d7ed2f077922e0cb0d59df743e34a9a From af8a20d011d957e5fd6151ed77f943824709786a Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 22 Aug 2017 18:04:02 -0700 Subject: [PATCH 0736/1833] [submodule]: update sonic linux kernel (#906) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index a97c5e416f8d..e124218e943b 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit a97c5e416f8d4c8d6ddd69a7bb6b983527b3c627 +Subproject commit e124218e943becfc358f83b0b0df52680f751fd2 From 34377f25610471e0a49646428774e7241ba316f6 Mon Sep 17 00:00:00 2001 From: nikos-li <31227248+nikos-li@users.noreply.github.com> Date: Wed, 23 Aug 2017 02:50:39 -0700 Subject: [PATCH 0737/1833] IPv4 prefixes shouldn't be sent by default over IPv6 session with FRR. (#905) RB= G=lnos-reviewers R=ntrianta,rjonnadu,rmolina,sfardeen,zxu A= --- dockers/docker-fpm-frr/bgpd.conf.j2 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index d04f6ac623e0..c66d5bfb232f 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -21,6 +21,7 @@ log facility local4 router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp log-neighbor-changes bgp bestpath as-path multipath-relax + no bgp default ipv4-unicast {# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} bgp router-id {{ minigraph_lo_interfaces[0]['addr'] }} {# advertise loopback #} @@ -53,6 +54,12 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} +{% if neighbor_addr | ipv4 %} + address-family ipv4 + neighbor {{ neighbor_addr }} activate + maximum-paths 64 + exit-address-family +{% endif %} {% if neighbor_addr | ipv6 %} address-family ipv6 neighbor {{ neighbor_addr }} activate From 1e404315814d5677e3d6ecb9ecfc6485171bba05 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 23 Aug 2017 04:03:49 -0700 Subject: [PATCH 0738/1833] [broadcom]: update broadcom sai package to 2.1.5.1-17 (#908) --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index ec7a34253075..eaf188485fed 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_2.1.5.1-16-20170712202323.49_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-16-20170712202323.49_amd64.deb?sv=2015-04-05&sr=b&sig=jsPXiAoSyKqZ1SmiyeEj73W8tRlri8ysExnWvc%2BWSi4%3D&se=2031-03-21T22%3A49%3A32Z&sp=r" +BRCM_SAI = libsaibcm_2.1.5.1-17_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_2.1.5.1-17_amd64.deb?sv=2015-04-05&sr=b&sig=6sJ4dd%2FF1hqStNQk5Z6d%2BYQGRZxLDihXRl60EeN7agc%3D&se=2031-05-02T09%3A37%3A54Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-16-20170712202323.49_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_2.1.5.1-17_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-16-20170712202323.49_amd64.deb?sv=2015-04-05&sr=b&sig=azYZkCi%2FFGS4eELKhIozOok3qimfH%2FjdXlz%2BS2MRBco%3D&se=2031-03-21T22%3A49%3A57Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_2.1.5.1-17_amd64.deb?sv=2015-04-05&sr=b&sig=syV0rie0L2Dn4lhmndCTyCTgXQv8DPoWD3IxtlSdeNo%3D&se=2031-05-02T09%3A37%3A18Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) From 22bc1420b9a3f07c8f7aa2e349bc8b6331e2815d Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Thu, 24 Aug 2017 00:38:14 +0530 Subject: [PATCH 0739/1833] [device]: Updated dell s6100 submodule to 5ab014 (#909) --- platform/broadcom/sonic-platform-modules-dell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 6cff8248fa8c..5ab014c0d4f9 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 6cff8248fa8c772a077bf3dcb5c86a376357f261 +Subproject commit 5ab014c0d4f9ad71d7791e7d4da0645d2b2d493b From 9a458d843448c61dfba264fcfd45b37d26ab4623 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 23 Aug 2017 12:08:27 -0700 Subject: [PATCH 0740/1833] [kernel]: update kernel submodule (#910) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index e124218e943b..b386d52bd68b 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit e124218e943becfc358f83b0b0df52680f751fd2 +Subproject commit b386d52bd68bdc5facbd837e265f49a8350e14a1 From 12ba083b668058b57dfbe922a955b64ee4cf36a2 Mon Sep 17 00:00:00 2001 From: jeankuo Date: Thu, 24 Aug 2017 03:08:43 +0800 Subject: [PATCH 0741/1833] [Accton]: Add a new supported device AS5712-54X (#898) * [Accton]: Add a new supported device AS5712-54X Switch Vendor: Edge-core Switch SKU: AS5712-54X ASIC Vendor: Broadcom Swich ASIC: TRIDENT2 Port Configuration: 48x10G+6x40G SONiC Image: SONiC-ONIE-Broadcom * [Accton]: Add a new supported device AS5712-54X (Update 1) Switch Vendor: Edge-core Switch SKU: AS5712-54X ASIC Vendor: Broadcom Swich ASIC: TRIDENT2 Port Configuration: 48x10G+6x40G SONiC Image: SONiC-ONIE-Broadcom * [Accton]: Add a new supported device AS5712-54X (Update 2) Switch Vendor: Edge-core Switch SKU: AS5712-54X ASIC Vendor: Broadcom Swich ASIC: TRIDENT2 Port Configuration: 48x10G+6x40G SONiC Image: SONiC-ONIE-Broadcom * [Accton]: Add a new supported device AS5712-54X (Update 3) Switch Vendor: Edge-core Switch SKU: AS5712-54X ASIC Vendor: Broadcom Swich ASIC: TRIDENT2 Port Configuration: 48x10G+6x40G SONiC Image: SONiC-ONIE-Broadcom --- .../Accton-AS5712-54X/port_config.ini | 74 ++++++++ .../Accton-AS5712-54X/sai.profile | 2 + .../installer.conf | 3 + .../led_proc_init.soc | 163 ++++++++++++++++ .../x86_64-accton_as5712_54x-r0/minigraph.xml | 151 +++++++++++++++ .../plugins/eeprom.py | 24 +++ .../plugins/sfputil.py | 175 ++++++++++++++++++ 7 files changed, 592 insertions(+) create mode 100644 device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/port_config.ini create mode 100644 device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile create mode 100644 device/accton/x86_64-accton_as5712_54x-r0/installer.conf create mode 100644 device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc create mode 100644 device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as5712_54x-r0/plugins/eeprom.py create mode 100644 device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py diff --git a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/port_config.ini b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/port_config.ini new file mode 100644 index 000000000000..61325e1ec43c --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/port_config.ini @@ -0,0 +1,74 @@ +# name lanes alias +Ethernet0 13 tenGigE0 +Ethernet1 14 tenGigE1 +Ethernet2 15 tenGigE2 +Ethernet3 16 tenGigE3 +Ethernet4 21 tenGigE4 +Ethernet5 22 tenGigE5 +Ethernet6 23 tenGigE6 +Ethernet7 24 tenGigE7 +Ethernet8 25 tenGigE8 +Ethernet9 26 tenGigE9 +Ethernet10 27 tenGigE10 +Ethernet11 28 tenGigE11 +Ethernet12 29 tenGigE12 +Ethernet13 30 tenGigE13 +Ethernet14 31 tenGigE14 +Ethernet15 32 tenGigE15 +Ethernet16 45 tenGigE16 +Ethernet17 46 tenGigE17 +Ethernet18 47 tenGigE18 +Ethernet19 48 tenGigE19 +Ethernet20 49 tenGigE20 +Ethernet21 50 tenGigE21 +Ethernet22 51 tenGigE22 +Ethernet23 52 tenGigE23 +Ethernet24 53 tenGigE24 +Ethernet25 54 tenGigE25 +Ethernet26 55 tenGigE26 +Ethernet27 56 tenGigE27 +Ethernet28 57 tenGigE28 +Ethernet29 58 tenGigE29 +Ethernet30 59 tenGigE30 +Ethernet31 60 tenGigE31 +Ethernet32 61 tenGigE32 +Ethernet33 62 tenGigE33 +Ethernet34 63 tenGigE34 +Ethernet35 64 tenGigE35 +Ethernet36 65 tenGigE36 +Ethernet37 66 tenGigE37 +Ethernet38 67 tenGigE38 +Ethernet39 68 tenGigE39 +Ethernet40 69 tenGigE40 +Ethernet41 70 tenGigE41 +Ethernet42 71 tenGigE42 +Ethernet43 72 tenGigE43 +Ethernet44 73 tenGigE44 +Ethernet45 74 tenGigE45 +Ethernet46 75 tenGigE46 +Ethernet47 76 tenGigE47 +Ethernet48 97 tenGigE48 +Ethernet49 98 tenGigE49 +Ethernet50 99 tenGigE50 +Ethernet51 100 tenGigE51 +Ethernet52 101 tenGigE52 +Ethernet53 102 tenGigE53 +Ethernet54 103 tenGigE54 +Ethernet55 104 tenGigE55 +Ethernet56 81 tenGigE56 +Ethernet57 82 tenGigE57 +Ethernet58 83 tenGigE58 +Ethernet59 84 tenGigE59 +Ethernet60 105 tenGigE60 +Ethernet61 106 tenGigE61 +Ethernet62 107 tenGigE62 +Ethernet63 108 tenGigE63 +Ethernet64 109 tenGigE64 +Ethernet65 110 tenGigE65 +Ethernet66 111 tenGigE66 +Ethernet67 112 tenGigE67 +Ethernet68 77 tenGigE68 +Ethernet69 78 tenGigE69 +Ethernet70 79 tenGigE70 +Ethernet71 80 tenGigE71 + diff --git a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile new file mode 100644 index 000000000000..7fafa54db963 --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/td2-as5712-72x10G.config.bcm + diff --git a/device/accton/x86_64-accton_as5712_54x-r0/installer.conf b/device/accton/x86_64-accton_as5712_54x-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc new file mode 100644 index 000000000000..e27679db9ab0 --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc @@ -0,0 +1,163 @@ +# LED setting for active +# ----------------------------------------------------------------------------- +# for as5712_54x (48xg+6qxg) +# +# on green - if link up +# off - if link down +# blink - if active +# ----------------------------------------------------------------------------- +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=1 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=2 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=5 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=6 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=9 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=10 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=13 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=14 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=17 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=18 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=21 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=22 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=25 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=26 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=29 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=30 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=33 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=34 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=35 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=37 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=38 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=39 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=41 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=42 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=43 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=45 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=46 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=49 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=50 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=51 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=53 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=54 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=55 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=57 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=58 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=59 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=61 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=62 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=1 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=2 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=5 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=6 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=9 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=10 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=13 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=14 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=17 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=18 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=21 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=22 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=25 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=26 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=29 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=30 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=33 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=34 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=35 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=37 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=38 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=39 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=41 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=42 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=43 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=45 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=46 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=49 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=50 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=51 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=53 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=54 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=55 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=57 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=58 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=59 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=61 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=62 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 + +led 0 stop +led 0 prog \ + 06 FE 80 D2 19 71 08 E0 60 FE E9 D2 0F 75 10 81 \ + 61 FD 02 3F 60 FF 28 32 0F 87 67 4A 96 FF 06 FF \ + D2 2B 74 16 02 1F 60 FF 28 32 0F 87 67 4A 96 FF \ + 06 FF D2 13 74 28 02 0F 60 FF 28 32 0F 87 67 4A \ + 96 FF 06 FF D2 0B 74 3A 3A 48 32 07 32 08 C7 32 \ + 04 C7 97 71 57 77 69 32 00 32 01 B7 97 71 63 32 \ + 0E 77 6B 26 FD 97 27 77 6B 32 0F 87 57 00 00 00 +led 0 start + +led 1 stop +led 1 prog \ + 06 FE 80 D2 19 71 08 E0 60 FE E9 D2 0F 75 10 81 \ + 61 FD 02 20 67 89 02 24 67 89 02 10 67 89 02 28 \ + 67 89 02 2C 67 89 02 0C 67 89 02 2C 67 79 02 28 \ + 67 79 02 24 67 79 02 20 67 79 02 10 67 79 02 0C \ + 67 79 02 0B 60 FF 28 32 0F 87 67 56 96 FF 06 FF \ + D2 FF 74 46 3A 36 32 07 32 08 C7 32 04 C7 97 71 \ + 63 77 75 32 00 32 01 B7 97 71 6F 32 0E 77 77 26 \ + FD 97 27 77 77 32 0F 87 57 12 A0 F8 15 1A 01 75 \ + 85 28 67 56 57 32 0F 87 57 12 A0 F8 15 1A 01 71 \ + A1 28 67 56 80 28 67 56 80 28 67 56 80 28 67 56 \ + 57 32 0F 87 32 0F 87 32 0F 87 32 0F 87 57 00 00 +led 1 start + diff --git a/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml new file mode 100644 index 000000000000..8d89f28b0d86 --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml @@ -0,0 +1,151 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + switch1 + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + switch1 + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + switch1 + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + switch1 + + + + + + Ethernet48 + 10.10.1.25/30 + + + + Ethernet52 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + switch1 + Ethernet48 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + switch1 + Ethernet52 + + + + + switch1 + Accton-AS5712-54X + + + + + + + switch1 + + + 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 + + + + + + + switch1 + Accton-AS5712-54X +
diff --git a/device/accton/x86_64-accton_as5712_54x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as5712_54x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..7681caafeef4 --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + #Two i2c buses might get flipped order, check them both. + if not os.path.exists(self.eeprom_path): + self.eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..070b1da934cb --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py @@ -0,0 +1,175 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + + EEPROM_OFFSET = 20 + + _port_to_eeprom_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(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/accton/qsfp_modprs") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/accton/qsfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/accton/qsfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/accton/qsfp_reset" + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # 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(QSFP_RESET_REGISTER_DEVICE_FILE, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True From 48b0beb7ff786c45597ea2ce8790400775bf6d2a Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Thu, 24 Aug 2017 05:41:14 +0300 Subject: [PATCH 0742/1833] Port speed (#879) * Add port speed configuration * Add DeviceInfos support in minigraph parser * Add cfggen test 'test_minigraph_ethernet_interfaces' * Fixed PR comments * Update sonic-swss submodule reference --- dockers/docker-orchagent/Dockerfile.j2 | 1 + dockers/docker-orchagent/ports.json.j2 | 11 ++++ dockers/docker-orchagent/start.sh | 1 + dockers/docker-orchagent/swssconfig.sh | 2 +- src/sonic-config-engine/minigraph.py | 17 +++++ .../tests/simple-sample-graph.xml | 62 +++++++++++++++++++ src/sonic-config-engine/tests/test_cfggen.py | 5 ++ src/sonic-swss | 2 +- 8 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 dockers/docker-orchagent/ports.json.j2 diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 73fb087401ab..587d8f4db2ee 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -30,5 +30,6 @@ COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"] COPY ["mirror.json.j2", "/usr/share/sonic/templates/"] +COPY ["ports.json.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-orchagent/ports.json.j2 b/dockers/docker-orchagent/ports.json.j2 new file mode 100644 index 000000000000..f59ee993eead --- /dev/null +++ b/dockers/docker-orchagent/ports.json.j2 @@ -0,0 +1,11 @@ +[ +{% for interface in ethernet_interfaces %} + { + "PORT_TABLE:{{ interface['name'] }}": { + "speed": "{{ interface['speed'] }}" + }, + "OP": "SET" + }{% if not loop.last %},{% endif %} + +{% endfor %} +] diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 40ef66441c02..5f961a8bd294 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -4,6 +4,7 @@ mkdir -p /etc/swss/config.d/ sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json +sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v platform` diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 768417779e2d..2530aca06bb3 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -38,7 +38,7 @@ fast_reboot HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` -SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " +SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json " if [ "$HWSKU" == "Force10-S6000" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 6dbf0d570d47..1877e552858e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -325,6 +325,19 @@ def parse_meta(meta, hname): deployment_id = value return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id +def parse_deviceinfo(meta, hwsku): + ethernet_interfaces = [] + + for device_info in meta.findall(str(QName(ns, "DeviceInfo"))): + dev_sku = device_info.find(str(QName(ns, "HwSku"))).text + if dev_sku == hwsku: + interfaces = device_info.find(str(QName(ns, "EthernetInterfaces"))) + for interface in interfaces.findall(str(QName(ns1, "EthernetInterface"))): + name = interface.find(str(QName(ns, "InterfaceName"))).text + speed = interface.find(str(QName(ns, "Speed"))).text + ethernet_interfaces.append({ 'name':name, 'speed':speed }) + + return ethernet_interfaces def get_console_info(devices, dev, port): for k, v in devices.items(): @@ -411,6 +424,7 @@ def parse_xml(filename, platform=None, port_config_file=None): neighbors = None devices = None hostname = None + ethernet_interfaces = [] syslog_servers = [] dhcp_servers = [] ntp_servers = [] @@ -440,6 +454,8 @@ def parse_xml(filename, platform=None, port_config_file=None): (u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname) elif child.tag == str(QName(ns, "MetadataDeclaration")): (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) + elif child.tag == str(QName(ns, "DeviceInfos")): + ethernet_interfaces = parse_deviceinfo(child, hwsku) results = {} results['minigraph_hwsku'] = hwsku @@ -488,6 +504,7 @@ def parse_xml(filename, platform=None, port_config_file=None): results['forced_mgmt_routes'] = mgmt_routes results['erspan_dst'] = erspan_dst results['deployment_id'] = deployment_id + results['ethernet_interfaces'] = ethernet_interfaces return results diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 20bfb07f00d0..7daae24f49a6 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -200,6 +200,68 @@
+ + + true + + + DeviceInterface + + true + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 1000000 + + + true + 0 + Force10-S6000 + + switch-t0 Force10-S6000 diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index d3ff3e8b9f4e..153b0bb14f36 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -119,3 +119,8 @@ def test_minigraph_deployment_id(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v deployment_id' output = self.run_script(argument) self.assertEqual(output.strip(), "1") + + def test_minigraph_ethernet_interfaces(self): + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v ethernet_interfaces' + output = self.run_script(argument) + self.assertEqual(output.strip(), "[{'speed': '10000', 'name': 'fortyGigE0/0'}, {'speed': '25000', 'name': 'fortyGigE0/4'}, {'speed': '40000', 'name': 'fortyGigE0/8'}, {'speed': '1000000', 'name': 'fortyGigE0/12'}]") diff --git a/src/sonic-swss b/src/sonic-swss index f9b55d30276d..eaccf67cabd2 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit f9b55d30276d1a6ab94e7321d9b2a3bf076fd683 +Subproject commit eaccf67cabd22df0ff7d0117fe55f4261bc961d9 From d918b1349173a708cc491bfd080ccb532184ffd4 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Thu, 24 Aug 2017 00:10:50 -0700 Subject: [PATCH 0743/1833] Update sfputil support for Arista platforms (#912) * Bump sonic-platform-modules-arista submodule * Fix sfputil plugin for arista_7060_cx32s * Fix sfputil plugin for arista_7260cx3_64 * Add front panel port number for arista platforms --- .../Arista-7050-Q16S64/port_config.ini | 114 +++++++++--------- .../Arista-7050-QX32/port_config.ini | 66 +++++----- .../Arista-7050-QX-32S/port_config.ini | 66 +++++----- .../Arista-7060-CX32S/port_config.ini | 66 +++++----- .../plugins/sfputil.py | 11 +- .../plugins/sfputil.py | 14 ++- .../broadcom/sonic-platform-modules-arista | 2 +- 7 files changed, 173 insertions(+), 166 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini index 28edbeccf224..dea477b26152 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini @@ -1,57 +1,57 @@ -# name lanes alias -Ethernet0 125,126,127,128 Ethernet1/1 -Ethernet4 121,122,123,124 Ethernet2/1 -Ethernet8 13,14,15,16 Ethernet3/1 -Ethernet12 9,10,11,12 Ethernet4/1 -Ethernet16 17,18,19,20 Ethernet5/1 -Ethernet20 21,22,23,24 Ethernet6/1 -Ethernet24 25,26,27,28 Ethernet7/1 -Ethernet28 29,30,31,32 Ethernet8/1 -Ethernet32 37,38,39,40 Ethernet9/1 -Ethernet36 33,34,35,36 Ethernet10/1 -Ethernet40 45,46,47,48 Ethernet11/1 -Ethernet44 41,42,43,44 Ethernet12/1 -Ethernet48 53,54,55,56 Ethernet13/1 -Ethernet52 49,50,51,52 Ethernet14/1 -Ethernet56 69,70,71,72 Ethernet15/1 -Ethernet60 65,66,67,68 Ethernet16/1 -Ethernet64 77 Ethernet17/1 -Ethernet65 78 Ethernet17/2 -Ethernet66 79 Ethernet17/3 -Ethernet67 80 Ethernet17/4 -Ethernet68 73 Ethernet18/1 -Ethernet69 74 Ethernet18/2 -Ethernet70 75 Ethernet18/3 -Ethernet71 76 Ethernet18/4 -Ethernet72 93 Ethernet19/1 -Ethernet73 94 Ethernet19/2 -Ethernet74 95 Ethernet19/3 -Ethernet75 96 Ethernet19/4 -Ethernet76 89 Ethernet20/1 -Ethernet77 90 Ethernet20/2 -Ethernet78 91 Ethernet20/3 -Ethernet79 92 Ethernet20/4 -Ethernet80 101 Ethernet21/1 -Ethernet81 102 Ethernet21/2 -Ethernet82 103 Ethernet21/3 -Ethernet83 104 Ethernet21/4 -Ethernet84 97 Ethernet22/1 -Ethernet85 98 Ethernet22/2 -Ethernet86 99 Ethernet22/3 -Ethernet87 100 Ethernet22/4 -Ethernet88 109 Ethernet23/1 -Ethernet89 110 Ethernet23/2 -Ethernet90 111 Ethernet23/3 -Ethernet91 112 Ethernet23/4 -Ethernet92 105 Ethernet24/1 -Ethernet93 106 Ethernet24/2 -Ethernet94 107 Ethernet24/3 -Ethernet95 108 Ethernet24/4 -Ethernet96 61,62,63,64 Ethernet25 -Ethernet100 57,58,59,60 Ethernet26 -Ethernet104 81,82,83,84 Ethernet27 -Ethernet108 85,86,87,88 Ethernet28 -Ethernet112 117,118,119,120 Ethernet29 -Ethernet116 113,114,115,116 Ethernet30 -Ethernet120 5,6,7,8 Ethernet31 -Ethernet124 1,2,3,4 Ethernet32 +# name lanes alias port +Ethernet0 125,126,127,128 Ethernet1/1 1 +Ethernet4 121,122,123,124 Ethernet2/1 2 +Ethernet8 13,14,15,16 Ethernet3/1 3 +Ethernet12 9,10,11,12 Ethernet4/1 4 +Ethernet16 17,18,19,20 Ethernet5/1 5 +Ethernet20 21,22,23,24 Ethernet6/1 6 +Ethernet24 25,26,27,28 Ethernet7/1 7 +Ethernet28 29,30,31,32 Ethernet8/1 8 +Ethernet32 37,38,39,40 Ethernet9/1 9 +Ethernet36 33,34,35,36 Ethernet10/1 10 +Ethernet40 45,46,47,48 Ethernet11/1 11 +Ethernet44 41,42,43,44 Ethernet12/1 12 +Ethernet48 53,54,55,56 Ethernet13/1 13 +Ethernet52 49,50,51,52 Ethernet14/1 14 +Ethernet56 69,70,71,72 Ethernet15/1 15 +Ethernet60 65,66,67,68 Ethernet16/1 16 +Ethernet64 77 Ethernet17/1 17 +Ethernet65 78 Ethernet17/2 17 +Ethernet66 79 Ethernet17/3 17 +Ethernet67 80 Ethernet17/4 17 +Ethernet68 73 Ethernet18/1 18 +Ethernet69 74 Ethernet18/2 18 +Ethernet70 75 Ethernet18/3 18 +Ethernet71 76 Ethernet18/4 18 +Ethernet72 93 Ethernet19/1 19 +Ethernet73 94 Ethernet19/2 19 +Ethernet74 95 Ethernet19/3 19 +Ethernet75 96 Ethernet19/4 19 +Ethernet76 89 Ethernet20/1 20 +Ethernet77 90 Ethernet20/2 20 +Ethernet78 91 Ethernet20/3 20 +Ethernet79 92 Ethernet20/4 20 +Ethernet80 101 Ethernet21/1 21 +Ethernet81 102 Ethernet21/2 21 +Ethernet82 103 Ethernet21/3 21 +Ethernet83 104 Ethernet21/4 21 +Ethernet84 97 Ethernet22/1 22 +Ethernet85 98 Ethernet22/2 22 +Ethernet86 99 Ethernet22/3 22 +Ethernet87 100 Ethernet22/4 22 +Ethernet88 109 Ethernet23/1 23 +Ethernet89 110 Ethernet23/2 23 +Ethernet90 111 Ethernet23/3 23 +Ethernet91 112 Ethernet23/4 23 +Ethernet92 105 Ethernet24/1 24 +Ethernet93 106 Ethernet24/2 24 +Ethernet94 107 Ethernet24/3 24 +Ethernet95 108 Ethernet24/4 24 +Ethernet96 61,62,63,64 Ethernet25 25 +Ethernet100 57,58,59,60 Ethernet26 26 +Ethernet104 81,82,83,84 Ethernet27 27 +Ethernet108 85,86,87,88 Ethernet28 28 +Ethernet112 117,118,119,120 Ethernet29 29 +Ethernet116 113,114,115,116 Ethernet30 30 +Ethernet120 5,6,7,8 Ethernet31 31 +Ethernet124 1,2,3,4 Ethernet32 32 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini index b9ab8854a2ec..32fa6885fa93 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias -Ethernet0 125,126,127,128 Ethernet1/1 -Ethernet4 121,122,123,124 Ethernet2/1 -Ethernet8 13,14,15,16 Ethernet3/1 -Ethernet12 9,10,11,12 Ethernet4/1 -Ethernet16 17,18,19,20 Ethernet5/1 -Ethernet20 21,22,23,24 Ethernet6/1 -Ethernet24 25,26,27,28 Ethernet7/1 -Ethernet28 29,30,31,32 Ethernet8/1 -Ethernet32 37,38,39,40 Ethernet9/1 -Ethernet36 33,34,35,36 Ethernet10/1 -Ethernet40 45,46,47,48 Ethernet11/1 -Ethernet44 41,42,43,44 Ethernet12/1 -Ethernet48 53,54,55,56 Ethernet13/1 -Ethernet52 49,50,51,52 Ethernet14/1 -Ethernet56 69,70,71,72 Ethernet15/1 -Ethernet60 65,66,67,68 Ethernet16/1 -Ethernet64 77,78,79,80 Ethernet17/1 -Ethernet68 73,74,75,76 Ethernet18/1 -Ethernet72 93,94,95,96 Ethernet19/1 -Ethernet76 89,90,91,92 Ethernet20/1 -Ethernet80 101,102,103,104 Ethernet21/1 -Ethernet84 97,98,99,100 Ethernet22/1 -Ethernet88 109,110,111,112 Ethernet23/1 -Ethernet92 105,106,107,108 Ethernet24/1 -Ethernet96 61,62,63,64 Ethernet25 -Ethernet100 57,58,59,60 Ethernet26 -Ethernet104 81,82,83,84 Ethernet27 -Ethernet108 85,86,87,88 Ethernet28 -Ethernet112 117,118,119,120 Ethernet29 -Ethernet116 113,114,115,116 Ethernet30 -Ethernet120 5,6,7,8 Ethernet31 -Ethernet124 1,2,3,4 Ethernet32 +# name lanes alias port +Ethernet0 125,126,127,128 Ethernet1/1 1 +Ethernet4 121,122,123,124 Ethernet2/1 2 +Ethernet8 13,14,15,16 Ethernet3/1 3 +Ethernet12 9,10,11,12 Ethernet4/1 4 +Ethernet16 17,18,19,20 Ethernet5/1 5 +Ethernet20 21,22,23,24 Ethernet6/1 6 +Ethernet24 25,26,27,28 Ethernet7/1 7 +Ethernet28 29,30,31,32 Ethernet8/1 8 +Ethernet32 37,38,39,40 Ethernet9/1 9 +Ethernet36 33,34,35,36 Ethernet10/1 10 +Ethernet40 45,46,47,48 Ethernet11/1 11 +Ethernet44 41,42,43,44 Ethernet12/1 12 +Ethernet48 53,54,55,56 Ethernet13/1 13 +Ethernet52 49,50,51,52 Ethernet14/1 14 +Ethernet56 69,70,71,72 Ethernet15/1 15 +Ethernet60 65,66,67,68 Ethernet16/1 16 +Ethernet64 77,78,79,80 Ethernet17/1 17 +Ethernet68 73,74,75,76 Ethernet18/1 18 +Ethernet72 93,94,95,96 Ethernet19/1 19 +Ethernet76 89,90,91,92 Ethernet20/1 20 +Ethernet80 101,102,103,104 Ethernet21/1 21 +Ethernet84 97,98,99,100 Ethernet22/1 22 +Ethernet88 109,110,111,112 Ethernet23/1 23 +Ethernet92 105,106,107,108 Ethernet24/1 24 +Ethernet96 61,62,63,64 Ethernet25 25 +Ethernet100 57,58,59,60 Ethernet26 26 +Ethernet104 81,82,83,84 Ethernet27 27 +Ethernet108 85,86,87,88 Ethernet28 28 +Ethernet112 117,118,119,120 Ethernet29 29 +Ethernet116 113,114,115,116 Ethernet30 30 +Ethernet120 5,6,7,8 Ethernet31 31 +Ethernet124 1,2,3,4 Ethernet32 32 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini index b56d958499d4..cb36404ac44f 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias -Ethernet0 9,10,11,12 Ethernet5/1 -Ethernet4 13,14,15,16 Ethernet6/1 -Ethernet8 17,18,19,20 Ethernet7/1 -Ethernet12 21,22,23,24 Ethernet8/1 -Ethernet16 29,30,31,32 Ethernet9/1 -Ethernet20 25,26,27,28 Ethernet10/1 -Ethernet24 33,34,35,36 Ethernet11/1 -Ethernet28 37,38,39,40 Ethernet12/1 -Ethernet32 45,46,47,48 Ethernet13/1 -Ethernet36 41,42,43,44 Ethernet14/1 -Ethernet40 49,50,51,52 Ethernet15/1 -Ethernet44 53,54,55,56 Ethernet16/1 -Ethernet48 69,70,71,72 Ethernet17/1 -Ethernet52 65,66,67,68 Ethernet18/1 -Ethernet56 73,74,75,76 Ethernet19/1 -Ethernet60 77,78,79,80 Ethernet20/1 -Ethernet64 93,94,95,96 Ethernet21/1 -Ethernet68 89,90,91,92 Ethernet22/1 -Ethernet72 97,98,99,100 Ethernet23/1 -Ethernet76 101,102,103,104 Ethernet24/1 -Ethernet80 109,110,111,112 Ethernet25/1 -Ethernet84 105,106,107,108 Ethernet26/1 -Ethernet88 121,122,123,124 Ethernet27/1 -Ethernet92 125,126,127,128 Ethernet28/1 -Ethernet96 61,62,63,64 Ethernet29 -Ethernet100 57,58,59,60 Ethernet30 -Ethernet104 81,82,83,84 Ethernet31 -Ethernet108 85,86,87,88 Ethernet32 -Ethernet112 117,118,119,120 Ethernet33 -Ethernet116 113,114,115,116 Ethernet34 -Ethernet120 1,2,3,4 Ethernet35 -Ethernet124 5,6,7,8 Ethernet36 +# name lanes alias port +Ethernet0 9,10,11,12 Ethernet5/1 5 +Ethernet4 13,14,15,16 Ethernet6/1 6 +Ethernet8 17,18,19,20 Ethernet7/1 7 +Ethernet12 21,22,23,24 Ethernet8/1 8 +Ethernet16 29,30,31,32 Ethernet9/1 9 +Ethernet20 25,26,27,28 Ethernet10/1 10 +Ethernet24 33,34,35,36 Ethernet11/1 11 +Ethernet28 37,38,39,40 Ethernet12/1 12 +Ethernet32 45,46,47,48 Ethernet13/1 13 +Ethernet36 41,42,43,44 Ethernet14/1 14 +Ethernet40 49,50,51,52 Ethernet15/1 15 +Ethernet44 53,54,55,56 Ethernet16/1 16 +Ethernet48 69,70,71,72 Ethernet17/1 17 +Ethernet52 65,66,67,68 Ethernet18/1 18 +Ethernet56 73,74,75,76 Ethernet19/1 19 +Ethernet60 77,78,79,80 Ethernet20/1 20 +Ethernet64 93,94,95,96 Ethernet21/1 21 +Ethernet68 89,90,91,92 Ethernet22/1 22 +Ethernet72 97,98,99,100 Ethernet23/1 23 +Ethernet76 101,102,103,104 Ethernet24/1 24 +Ethernet80 109,110,111,112 Ethernet25/1 25 +Ethernet84 105,106,107,108 Ethernet26/1 26 +Ethernet88 121,122,123,124 Ethernet27/1 27 +Ethernet92 125,126,127,128 Ethernet28/1 28 +Ethernet96 61,62,63,64 Ethernet29 29 +Ethernet100 57,58,59,60 Ethernet30 30 +Ethernet104 81,82,83,84 Ethernet31 31 +Ethernet108 85,86,87,88 Ethernet32 32 +Ethernet112 117,118,119,120 Ethernet33 33 +Ethernet116 113,114,115,116 Ethernet34 34 +Ethernet120 1,2,3,4 Ethernet35 35 +Ethernet124 5,6,7,8 Ethernet36 36 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini index 414fb94efbc1..c1dbcfabd9e3 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias -Ethernet0 33,34,35,36 Ethernet1/1 -Ethernet4 37,38,39,40 Ethernet2/1 -Ethernet8 41,42,43,44 Ethernet3/1 -Ethernet12 45,46,47,48 Ethernet4/1 -Ethernet16 49,50,51,52 Ethernet5/1 -Ethernet20 53,54,55,56 Ethernet6/1 -Ethernet24 57,58,59,60 Ethernet7/1 -Ethernet28 61,62,63,64 Ethernet8/1 -Ethernet32 65,66,67,68 Ethernet9/1 -Ethernet36 69,70,71,72 Ethernet10/1 -Ethernet40 73,74,75,76 Ethernet11/1 -Ethernet44 77,78,79,80 Ethernet12/1 -Ethernet48 81,82,83,84 Ethernet13/1 -Ethernet52 85,86,87,88 Ethernet14/1 -Ethernet56 89,90,91,92 Ethernet15/1 -Ethernet60 93,94,95,96 Ethernet16/1 -Ethernet64 97,98,99,100 Ethernet17/1 -Ethernet68 101,102,103,104 Ethernet18/1 -Ethernet72 105,106,107,108 Ethernet19/1 -Ethernet76 109,110,111,112 Ethernet20/1 -Ethernet80 113,114,115,116 Ethernet21/1 -Ethernet84 117,118,119,120 Ethernet22/1 -Ethernet88 121,122,123,124 Ethernet23/1 -Ethernet92 125,126,127,128 Ethernet24/1 -Ethernet96 1,2,3,4 Ethernet25/1 -Ethernet100 5,6,7,8 Ethernet26/1 -Ethernet104 9,10,11,12 Ethernet27/1 -Ethernet108 13,14,15,16 Ethernet28/1 -Ethernet112 17,18,19,20 Ethernet29/1 -Ethernet116 21,22,23,24 Ethernet30/1 -Ethernet120 25,26,27,28 Ethernet31/1 -Ethernet124 29,30,31,32 Ethernet32/1 +# name lanes alias port +Ethernet0 33,34,35,36 Ethernet1/1 1 +Ethernet4 37,38,39,40 Ethernet2/1 2 +Ethernet8 41,42,43,44 Ethernet3/1 3 +Ethernet12 45,46,47,48 Ethernet4/1 4 +Ethernet16 49,50,51,52 Ethernet5/1 5 +Ethernet20 53,54,55,56 Ethernet6/1 6 +Ethernet24 57,58,59,60 Ethernet7/1 7 +Ethernet28 61,62,63,64 Ethernet8/1 8 +Ethernet32 65,66,67,68 Ethernet9/1 9 +Ethernet36 69,70,71,72 Ethernet10/1 10 +Ethernet40 73,74,75,76 Ethernet11/1 11 +Ethernet44 77,78,79,80 Ethernet12/1 12 +Ethernet48 81,82,83,84 Ethernet13/1 13 +Ethernet52 85,86,87,88 Ethernet14/1 14 +Ethernet56 89,90,91,92 Ethernet15/1 15 +Ethernet60 93,94,95,96 Ethernet16/1 16 +Ethernet64 97,98,99,100 Ethernet17/1 17 +Ethernet68 101,102,103,104 Ethernet18/1 18 +Ethernet72 105,106,107,108 Ethernet19/1 19 +Ethernet76 109,110,111,112 Ethernet20/1 20 +Ethernet80 113,114,115,116 Ethernet21/1 21 +Ethernet84 117,118,119,120 Ethernet22/1 22 +Ethernet88 121,122,123,124 Ethernet23/1 23 +Ethernet92 125,126,127,128 Ethernet24/1 24 +Ethernet96 1,2,3,4 Ethernet25/1 25 +Ethernet100 5,6,7,8 Ethernet26/1 26 +Ethernet104 9,10,11,12 Ethernet27/1 27 +Ethernet108 13,14,15,16 Ethernet28/1 28 +Ethernet112 17,18,19,20 Ethernet29/1 29 +Ethernet116 21,22,23,24 Ethernet30/1 30 +Ethernet120 25,26,27,28 Ethernet31/1 31 +Ethernet124 29,30,31,32 Ethernet32/1 32 diff --git a/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py b/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py index b85e0f53653e..9a6d770d460b 100644 --- a/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py +++ b/device/arista/x86_64-arista_7060_cx32s/plugins/sfputil.py @@ -1,9 +1,12 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: import arista.utils.sonic_sfputil as arista_sfputil -except ImportError, e: - raise ImportError (str(e) + "- required module not found") +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) -sfputil = arista_sfputil.getSfpUtil() +SfpUtil = arista_sfputil.getSfpUtil() diff --git a/device/arista/x86_64-arista_7260cx3_64/plugins/sfputil.py b/device/arista/x86_64-arista_7260cx3_64/plugins/sfputil.py index ce60de2b384d..9a6d770d460b 100644 --- a/device/arista/x86_64-arista_7260cx3_64/plugins/sfputil.py +++ b/device/arista/x86_64-arista_7260cx3_64/plugins/sfputil.py @@ -1,8 +1,12 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - import arista.utils.sonic_sfputil as arista_sfputil -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + import arista.utils.sonic_sfputil as arista_sfputil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) -sfputil = arista_sfputil.getSfpUtil() + +SfpUtil = arista_sfputil.getSfpUtil() diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 51bbe2cd86af..7c505290bb26 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 51bbe2cd86af7df20b27e0cd1f02c2ad08ab2f03 +Subproject commit 7c505290bb26babdef604a377e71b3df702897a8 From 3638dcad281d1caf6d6f26ce94816916bd19ac14 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 24 Aug 2017 18:38:47 -0700 Subject: [PATCH 0744/1833] [translate-acl] Specify pyangbind version to not introduce new dependency (#915) --- dockers/docker-config-engine/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-config-engine/Dockerfile.j2 b/dockers/docker-config-engine/Dockerfile.j2 index 68555d44779b..b4d924bddfc3 100644 --- a/dockers/docker-config-engine/Dockerfile.j2 +++ b/dockers/docker-config-engine/Dockerfile.j2 @@ -10,7 +10,7 @@ RUN apt-get install -y python-lxml python-yaml python-bitarray python-pip python RUN pip install --upgrade pip -RUN pip install netaddr ipaddr jinja2 pyangbind +RUN pip install netaddr ipaddr jinja2 pyangbind==0.5.10 {% if docker_config_engine_debs.strip() %} COPY \ From a73065a2cb95b17292303d41c488382749f280d5 Mon Sep 17 00:00:00 2001 From: Nadiya Date: Fri, 25 Aug 2017 09:46:14 +0300 Subject: [PATCH 0745/1833] [cavm]Update sai revision and packet driver (#914) Signed-off-by: Nadiya Stetskovych --- platform/cavium/cavm-sai.mk | 2 +- platform/cavium/cavm-xpnet.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/cavium/cavm-sai.mk b/platform/cavium/cavm-sai.mk index c52c4960b9d6..0008135729c5 100644 --- a/platform/cavium/cavm-sai.mk +++ b/platform/cavium/cavm-sai.mk @@ -1,6 +1,6 @@ # Cavium SAI -CAVM_SAI_GITHUB = https://github.com/XPliant/OpenXPS/raw/eedd0b8bb7e7a09602a24418a462a5c10792a145/SAI/cavm-sai/ +CAVM_SAI_GITHUB = https://github.com/XPliant/OpenXPS/raw/13a7eaf10f523e7887964ca235f19095fcc88537/SAI/cavm-sai/ CAVM_LIBSAI = libsai.deb CAVM_SAI = sai.deb diff --git a/platform/cavium/cavm-xpnet.mk b/platform/cavium/cavm-xpnet.mk index 613fa9433564..ed86558a36ae 100644 --- a/platform/cavium/cavm-xpnet.mk +++ b/platform/cavium/cavm-xpnet.mk @@ -1,4 +1,4 @@ -CAVM_SAI_URL = https://github.com/XPliant/OpenXPS/raw/092461a1cf57a11132fbf8e74fa79bab3ab00f2a/SAI +CAVM_SAI_URL = https://github.com/XPliant/OpenXPS/raw/c26aea6a7098936ab3692e148238d73fa8962585/SAI CAVM_XPNET_DEB = xp80-Pcie-Endpoint.deb $(CAVM_XPNET_DEB)_URL = $(CAVM_SAI_URL)/netdev/$(CAVM_XPNET_DEB) From 9aa906a0a03ff40f13a7402a8fe510593761ebbe Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 25 Aug 2017 10:55:11 -0700 Subject: [PATCH 0746/1833] [devices]: modify sfputil plugins for mellanox devices for new platform API (#916) get presence, get/set lpmode, reset are not implemented --- .../x86_64-mlnx_msn2100-r0/plugins/sfputil.py | 70 ++++++++++++++----- .../x86_64-mlnx_msn2410-r0/plugins/sfputil.py | 70 ++++++++++++++----- .../x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 70 ++++++++++++++----- .../x86_64-mlnx_msn2740-r0/plugins/sfputil.py | 70 ++++++++++++++----- 4 files changed, 208 insertions(+), 72 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py index c6628e66e419..ce0adde71a15 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py @@ -1,28 +1,62 @@ -#! /usr/bin/python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + 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""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 15 - ports_in_block = 16 + PORT_START = 0 + PORT_END = 15 + PORTS_IN_BLOCK = 16 - eeprom_offset = 1 + EEPROM_OFFSET = 1 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} - _qsfp_ports = range(0, ports_in_block + 1) + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/bsp/qsfp/qsfp{0}" - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/bsp/qsfp/qsfp{0}' for x in range(0, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) - sfputilbase.__init__(self, port_num) - + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + + raise NotImplementedError + + def get_low_power_mode(self, port_num): + + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + + raise NotImplementedError + + def reset(self, port_num): + + raise NotImplementedError diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py index 9d4474ac1ec9..db71cb423503 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py @@ -1,28 +1,62 @@ -#! /usr/bin/python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + 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""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 55 - ports_in_block = 56 + PORT_START = 0 + PORT_END = 55 + PORTS_IN_BLOCK = 56 - eeprom_offset = 1 + EEPROM_OFFSET = 1 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} - _qsfp_ports = range(0, ports_in_block + 1) + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/bsp/qsfp/qsfp{0}" - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/bsp/qsfp/qsfp{0}' for x in range(0, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) - sfputilbase.__init__(self, port_num) - + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + + raise NotImplementedError + + def get_low_power_mode(self, port_num): + + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + + raise NotImplementedError + + def reset(self, port_num): + + raise NotImplementedError 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 04e9a4eff85e..b746af219917 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -1,28 +1,62 @@ -#! /usr/bin/python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + 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""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 31 - ports_in_block = 32 + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 - eeprom_offset = 1 + EEPROM_OFFSET = 1 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} - _qsfp_ports = range(0, ports_in_block + 1) + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/bsp/qsfp/qsfp{0}" - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/bsp/qsfp/qsfp{0}' for x in range(0, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) - sfputilbase.__init__(self, port_num) - + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + + raise NotImplementedError + + def get_low_power_mode(self, port_num): + + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + + raise NotImplementedError + + def reset(self, port_num): + + raise NotImplementedError diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py index 04e9a4eff85e..b746af219917 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py @@ -1,28 +1,62 @@ -#! /usr/bin/python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + 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""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 31 - ports_in_block = 32 + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 - eeprom_offset = 1 + EEPROM_OFFSET = 1 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} - _qsfp_ports = range(0, ports_in_block + 1) + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/bsp/qsfp/qsfp{0}" - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/bsp/qsfp/qsfp{0}' for x in range(0, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) - sfputilbase.__init__(self, port_num) - + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + + raise NotImplementedError + + def get_low_power_mode(self, port_num): + + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + + raise NotImplementedError + + def reset(self, port_num): + + raise NotImplementedError From 02c125f5ce4f4d70f6c9a885edd0cbd750899033 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 25 Aug 2017 17:31:19 -0700 Subject: [PATCH 0747/1833] [Arista-7260CX3] Rename hwSKU Arista-7260CX3-64 to Arista-7260CX3-C64, introducing new hwSKU Arista-7260CX3-D108C8 (#920) * [Device] Rename SKU Arista-7260CX3-64 to Arista-7260CX3-C64 Renaming to add the speed indication: C64 means 64 100G ports. renamed: Arista-7260CX3-64/port_config.ini -> Arista-7260CX3-C64/port_config.ini renamed: Arista-7260CX3-64/sai.profile -> Arista-7260CX3-C64/sai.profile * [Arista-7260cx3] Fix 64x100G port_config.ini Reorder the port lanes to match the front panel port numbering. * [Arista-7260CX3] add hwSKU Arista-7260CX3-D108C8 This hwSKU has 108x50G ports and 8x100G ports (2 x 100G ports are unused) --- .../Arista-7260CX3-64/port_config.ini | 67 ---------- .../Arista-7260CX3-C64/port_config.ini | 67 ++++++++++ .../sai.profile | 0 .../Arista-7260CX3-D108C8/port_config.ini | 121 ++++++++++++++++++ .../Arista-7260CX3-D108C8/sai.profile | 1 + .../x86_64-arista_7260cx3_64/minigraph.xml | 4 +- 6 files changed, 191 insertions(+), 69 deletions(-) delete mode 100644 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/port_config.ini create mode 100644 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini rename device/arista/x86_64-arista_7260cx3_64/{Arista-7260CX3-64 => Arista-7260CX3-C64}/sai.profile (100%) create mode 100644 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini create mode 100644 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/sai.profile diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/port_config.ini deleted file mode 100644 index c0213576d087..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/port_config.ini +++ /dev/null @@ -1,67 +0,0 @@ -# name lanes alias port -Ethernet0 77,78,79,80 Ethernet1/1 1 -Ethernet4 65,66,67,68 Ethernet2/1 2 -Ethernet8 85,86,87,88 Ethernet3/1 3 -Ethernet12 89,90,91,92 Ethernet4/1 4 -Ethernet16 109,110,111,112 Ethernet5/1 5 -Ethernet20 97,98,99,100 Ethernet6/1 6 -Ethernet24 117,118,119,120 Ethernet7/1 7 -Ethernet28 5,6,7,8 Ethernet8/1 8 -Ethernet32 17,18,19,20 Ethernet9/1 9 -Ethernet36 13,14,15,16 Ethernet10/1 10 -Ethernet40 29,30,31,32 Ethernet11/1 11 -Ethernet44 37,38,39,40 Ethernet12/1 12 -Ethernet48 49,50,51,52 Ethernet13/1 13 -Ethernet52 45,46,47,48 Ethernet14/1 14 -Ethernet56 61,62,63,64 Ethernet15/1 15 -Ethernet60 121,122,123,124 Ethernet16/1 16 -Ethernet64 193,194,195,196 Ethernet17/1 17 -Ethernet68 133,134,135,136 Ethernet18/1 18 -Ethernet72 205,206,207,208 Ethernet19/1 19 -Ethernet76 213,214,215,216 Ethernet20/1 20 -Ethernet80 225,226,227,228 Ethernet21/1 21 -Ethernet84 221,222,223,224 Ethernet22/1 22 -Ethernet88 237,238,239,240 Ethernet23/1 23 -Ethernet92 245,246,247,248 Ethernet24/1 24 -Ethernet96 141,142,143,144 Ethernet25/1 25 -Ethernet100 249,250,251,252 Ethernet26/1 26 -Ethernet104 149,150,151,152 Ethernet27/1 27 -Ethernet108 153,154,155,156 Ethernet28/1 28 -Ethernet112 173,174,175,176 Ethernet29/1 29 -Ethernet116 161,162,163,164 Ethernet30/1 30 -Ethernet120 181,182,183,184 Ethernet31/1 31 -Ethernet124 185,186,187,188 Ethernet32/1 32 -Ethernet128 69,70,71,72 Ethernet33/1 33 -Ethernet132 73,74,75,76 Ethernet34/1 34 -Ethernet136 93,94,95,96 Ethernet35/1 35 -Ethernet140 81,82,83,84 Ethernet36/1 36 -Ethernet144 101,102,103,104 Ethernet37/1 37 -Ethernet148 105,106,107,108 Ethernet38/1 38 -Ethernet152 1,2,3,4 Ethernet39/1 39 -Ethernet156 113,114,115,116 Ethernet40/1 40 -Ethernet160 9,10,11,12 Ethernet41/1 41 -Ethernet164 21,22,23,24 Ethernet42/1 42 -Ethernet168 33,34,35,36 Ethernet43/1 43 -Ethernet172 25,26,27,28 Ethernet44/1 44 -Ethernet176 41,42,43,44 Ethernet45/1 45 -Ethernet180 53,54,55,56 Ethernet46/1 46 -Ethernet184 125,126,127,128 Ethernet47/1 47 -Ethernet188 57,58,59,60 Ethernet48/1 48 -Ethernet192 129,130,131,132 Ethernet49/1 49 -Ethernet196 197,198,199,200 Ethernet50/1 50 -Ethernet200 209,210,211,212 Ethernet51/1 51 -Ethernet204 201,202,203,204 Ethernet52/1 52 -Ethernet208 217,218,219,220 Ethernet53/1 53 -Ethernet212 229,230,231,232 Ethernet54/1 54 -Ethernet216 241,242,243,244 Ethernet55/1 55 -Ethernet220 233,234,235,236 Ethernet56/1 56 -Ethernet224 253,254,255,256 Ethernet57/1 57 -Ethernet228 137,138,139,140 Ethernet58/1 58 -Ethernet232 157,158,159,160 Ethernet59/1 59 -Ethernet236 145,146,147,148 Ethernet60/1 60 -Ethernet240 165,166,167,168 Ethernet61/1 61 -Ethernet244 169,170,171,172 Ethernet62/1 62 -Ethernet248 189,190,191,192 Ethernet63/1 63 -Ethernet252 177,178,179,180 Ethernet64/1 64 -Ethernet256 257 Ethernet65 65 -Ethernet260 259 Ethernet66 66 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini new file mode 100644 index 000000000000..4f073e46dce3 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini @@ -0,0 +1,67 @@ +# name lanes alias port +Ethernet0 77,78,79,80 Ethernet1/1 1 +Ethernet4 65,66,67,68 Ethernet2/1 2 +Ethernet8 85,86,87,88 Ethernet3/1 3 +Ethernet12 89,90,91,92 Ethernet4/1 4 +Ethernet16 109,110,111,112 Ethernet5/1 5 +Ethernet20 97,98,99,100 Ethernet6/1 6 +Ethernet24 5,6,7,8 Ethernet7/1 7 +Ethernet28 13,14,15,16 Ethernet8/1 8 +Ethernet32 25,26,27,28 Ethernet9/1 9 +Ethernet36 21,22,23,24 Ethernet10/1 10 +Ethernet40 37,38,39,40 Ethernet11/1 11 +Ethernet44 45,46,47,48 Ethernet12/1 12 +Ethernet48 57,58,59,60 Ethernet13/1 13 +Ethernet52 53,54,55,56 Ethernet14/1 14 +Ethernet56 117,118,119,120 Ethernet15/1 15 +Ethernet60 121,122,123,124 Ethernet16/1 16 +Ethernet64 141,142,143,144 Ethernet17/1 17 +Ethernet68 133,134,135,136 Ethernet18/1 18 +Ethernet72 197,198,199,200 Ethernet19/1 19 +Ethernet76 205,206,207,208 Ethernet20/1 20 +Ethernet80 217,218,219,220 Ethernet21/1 21 +Ethernet84 213,214,215,216 Ethernet22/1 22 +Ethernet88 229,230,231,232 Ethernet23/1 23 +Ethernet92 237,238,239,240 Ethernet24/1 24 +Ethernet96 249,250,251,252 Ethernet25/1 25 +Ethernet100 245,246,247,248 Ethernet26/1 26 +Ethernet104 149,150,151,152 Ethernet27/1 27 +Ethernet108 153,154,155,156 Ethernet28/1 28 +Ethernet112 173,174,175,176 Ethernet29/1 29 +Ethernet116 161,162,163,164 Ethernet30/1 30 +Ethernet120 181,182,183,184 Ethernet31/1 31 +Ethernet124 185,186,187,188 Ethernet32/1 32 +Ethernet128 69,70,71,72 Ethernet33/1 33 +Ethernet132 73,74,75,76 Ethernet34/1 34 +Ethernet136 93,94,95,96 Ethernet35/1 35 +Ethernet140 81,82,83,84 Ethernet36/1 36 +Ethernet144 101,102,103,104 Ethernet37/1 37 +Ethernet148 105,106,107,108 Ethernet38/1 38 +Ethernet152 9,10,11,12 Ethernet39/1 39 +Ethernet156 1,2,3,4 Ethernet40/1 40 +Ethernet160 17,18,19,20 Ethernet41/1 41 +Ethernet164 29,30,31,32 Ethernet42/1 42 +Ethernet168 41,42,43,44 Ethernet43/1 43 +Ethernet172 33,34,35,36 Ethernet44/1 44 +Ethernet176 49,50,51,52 Ethernet45/1 45 +Ethernet180 61,62,63,64 Ethernet46/1 46 +Ethernet184 125,126,127,128 Ethernet47/1 47 +Ethernet188 113,114,115,116 Ethernet48/1 48 +Ethernet192 129,130,131,132 Ethernet49/1 49 +Ethernet196 137,138,139,140 Ethernet50/1 50 +Ethernet200 201,202,203,204 Ethernet51/1 51 +Ethernet204 193,194,195,196 Ethernet52/1 52 +Ethernet208 209,210,211,212 Ethernet53/1 53 +Ethernet212 221,222,223,224 Ethernet54/1 54 +Ethernet216 233,234,235,236 Ethernet55/1 55 +Ethernet220 225,226,227,228 Ethernet56/1 56 +Ethernet224 241,242,243,244 Ethernet57/1 57 +Ethernet228 253,254,255,256 Ethernet58/1 58 +Ethernet232 157,158,159,160 Ethernet59/1 59 +Ethernet236 145,146,147,148 Ethernet60/1 60 +Ethernet240 165,166,167,168 Ethernet61/1 61 +Ethernet244 169,170,171,172 Ethernet62/1 62 +Ethernet248 189,190,191,192 Ethernet63/1 63 +Ethernet252 177,178,179,180 Ethernet64/1 64 +Ethernet256 257 Ethernet65 65 +Ethernet260 259 Ethernet66 66 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/sai.profile b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/sai.profile similarity index 100% rename from device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-64/sai.profile rename to device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/sai.profile diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini new file mode 100644 index 000000000000..b06d1c7575d4 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini @@ -0,0 +1,121 @@ +# name lanes alias port +Ethernet0 77,78 Ethernet1/1 1 +Ethernet2 79,80 Ethernet1/3 2 +Ethernet4 65,66 Ethernet2/1 3 +Ethernet6 67,68 Ethernet2/3 4 +Ethernet8 85,86 Ethernet3/1 5 +Ethernet10 87,88 Ethernet3/3 6 +Ethernet12 89,90 Ethernet4/1 7 +Ethernet14 91,92 Ethernet4/3 8 +Ethernet16 109,110 Ethernet5/1 9 +Ethernet18 111,112 Ethernet5/3 10 +Ethernet20 97,98 Ethernet6/1 11 +Ethernet22 99,100 Ethernet6/3 12 +Ethernet24 5,6 Ethernet7/1 13 +Ethernet26 7,8 Ethernet7/3 14 +Ethernet28 13,14 Ethernet8/1 15 +Ethernet30 15,16 Ethernet8/3 16 +Ethernet32 25,26 Ethernet9/1 17 +Ethernet34 27,28 Ethernet9/3 18 +Ethernet36 21,22 Ethernet10/1 19 +Ethernet38 23,24 Ethernet10/3 20 +Ethernet40 37,38 Ethernet11/1 21 +Ethernet42 39,40 Ethernet11/3 22 +Ethernet44 45,46 Ethernet12/1 23 +Ethernet46 47,48 Ethernet12/3 24 +Ethernet48 57,58 Ethernet13/1 25 +Ethernet50 59,60 Ethernet13/3 26 +Ethernet52 53,54 Ethernet14/1 27 +Ethernet54 55,56 Ethernet14/3 28 +Ethernet56 117,118 Ethernet15/1 29 +Ethernet58 119,120 Ethernet15/3 30 +Ethernet60 121,122 Ethernet16/1 31 +Ethernet62 123,124 Ethernet16/3 32 +Ethernet64 141,142 Ethernet17/1 33 +Ethernet66 143,144 Ethernet17/3 34 +Ethernet68 133,134,135,136 Ethernet18/1 35 +Ethernet72 197,198 Ethernet19/1 36 +Ethernet74 199,200 Ethernet19/3 37 +Ethernet76 205,206,207,208 Ethernet20/1 38 +Ethernet80 217,218 Ethernet21/1 39 +Ethernet82 219,220 Ethernet21/3 40 +Ethernet84 213,214 Ethernet22/1 41 +Ethernet86 215,216 Ethernet22/3 42 +Ethernet88 229,230 Ethernet23/1 43 +Ethernet90 231,232 Ethernet23/3 44 +Ethernet92 237,238 Ethernet24/1 45 +Ethernet94 239,240 Ethernet24/3 46 +Ethernet96 249,250 Ethernet25/1 47 +Ethernet98 251,252 Ethernet25/3 48 +Ethernet100 245,246 Ethernet26/1 49 +Ethernet102 247,248 Ethernet26/3 50 +Ethernet104 149,150 Ethernet27/1 51 +Ethernet106 151,152 Ethernet27/3 52 +Ethernet108 153,154 Ethernet28/1 53 +Ethernet110 155,156 Ethernet28/3 54 +Ethernet112 173,174 Ethernet29/1 55 +Ethernet114 175,176 Ethernet29/3 56 +Ethernet116 161,162 Ethernet30/1 57 +Ethernet118 163,164 Ethernet30/3 58 +Ethernet120 181,182 Ethernet31/1 59 +Ethernet122 183,184 Ethernet31/3 60 +Ethernet124 185,186 Ethernet32/1 61 +Ethernet126 187,188 Ethernet32/3 62 +Ethernet128 69,70 Ethernet33/1 63 +Ethernet130 71,72 Ethernet33/3 64 +Ethernet132 73,74 Ethernet34/1 65 +Ethernet134 75,76 Ethernet34/3 66 +Ethernet136 93,94 Ethernet35/1 67 +Ethernet138 95,96 Ethernet35/3 68 +Ethernet140 81,82 Ethernet36/1 69 +Ethernet142 83,84 Ethernet36/3 70 +Ethernet144 101,102 Ethernet37/1 71 +Ethernet146 103,104 Ethernet37/3 72 +Ethernet148 105,106 Ethernet38/1 73 +Ethernet150 107,108 Ethernet38/3 74 +Ethernet152 9,10 Ethernet39/1 75 +Ethernet154 11,12 Ethernet39/3 76 +Ethernet156 1,2 Ethernet40/1 77 +Ethernet158 3,4 Ethernet40/3 78 +Ethernet160 17,18 Ethernet41/1 79 +Ethernet162 19,20 Ethernet41/3 80 +Ethernet164 29,30 Ethernet42/1 81 +Ethernet166 31,32 Ethernet42/1 82 +Ethernet168 41,42 Ethernet43/1 83 +Ethernet170 43,44 Ethernet43/3 84 +Ethernet172 33,34 Ethernet44/1 85 +Ethernet174 35,36 Ethernet44/3 86 +Ethernet176 49,50,51,52 Ethernet45/1 87 +Ethernet180 61,62,63,64 Ethernet46/1 88 +Ethernet184 125,126,127,128 Ethernet47/1 89 +Ethernet188 113,114,115,116 Ethernet48/1 90 +Ethernet192 129,130,131,132 Ethernet49/1 91 +Ethernet196 137,138,139,140 Ethernet50/1 92 +Ethernet200 201,202,203,204 Ethernet51/1 93 +Ethernet204 193,194,195,196 Ethernet52/1 94 +Ethernet208 209,210 Ethernet53/1 95 +Ethernet210 211,212 Ethernet53/3 96 +Ethernet212 221,222 Ethernet54/1 97 +Ethernet214 223,224 Ethernet54/3 98 +Ethernet216 233,234 Ethernet55/1 99 +Ethernet218 235,236 Ethernet55/3 100 +Ethernet220 225,226 Ethernet56/1 101 +Ethernet222 227,228 Ethernet56/3 102 +Ethernet224 241,242 Ethernet57/1 103 +Ethernet226 243,244 Ethernet57/3 104 +Ethernet228 253,254 Ethernet58/1 105 +Ethernet230 255,256 Ethernet58/3 106 +Ethernet232 157,158 Ethernet59/1 107 +Ethernet234 159,160 Ethernet59/3 108 +Ethernet236 145,146 Ethernet60/1 109 +Ethernet238 147,148 Ethernet60/3 110 +Ethernet240 165,166 Ethernet61/1 111 +Ethernet242 167,168 Ethernet61/3 112 +Ethernet244 169,170 Ethernet62/1 113 +Ethernet246 171,172 Ethernet62/3 114 +Ethernet248 189,190 Ethernet63/1 115 +Ethernet250 191,192 Ethernet63/3 116 +Ethernet252 177,178 Ethernet64/1 117 +Ethernet254 179,180 Ethernet64/3 118 +Ethernet256 257 Ethernet257 119 +Ethernet260 259 Ethernet259 120 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/sai.profile b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/sai.profile new file mode 100644 index 000000000000..030527daf9c0 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th2-a7260cx3-64-108x50G+10x100G.config.bcm diff --git a/device/arista/x86_64-arista_7260cx3_64/minigraph.xml b/device/arista/x86_64-arista_7260cx3_64/minigraph.xml index 957b60822ba8..2c632dacc471 100644 --- a/device/arista/x86_64-arista_7260cx3_64/minigraph.xml +++ b/device/arista/x86_64-arista_7260cx3_64/minigraph.xml @@ -809,7 +809,7 @@ sonic - Arista-7260CX3-64 + Arista-7260CX3-C64 @@ -844,5 +844,5 @@
sonic - Arista-7260CX3-64 + Arista-7260CX3-C64 From 0a9d60ebb266c0d2d06c50d30930b65da7cdeab1 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Sat, 26 Aug 2017 14:29:44 -0700 Subject: [PATCH 0748/1833] [sonic-slave] Force pyangbind version to 0.5.10 (#918) --- sonic-slave/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 826a7129a7e0..f194bf604caa 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -221,7 +221,7 @@ RUN pip install \ RUN pip install j2cli # For sonic config engine testing -RUN pip install pyangbind +RUN pip install pyangbind==0.5.10 # For supervisor build RUN pip install meld3 mock From 2d3b064437c8795b6b3f85131577ee32a38eb125 Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Mon, 28 Aug 2017 08:43:38 +0530 Subject: [PATCH 0749/1833] [image]: build sonic-broadcom.raw image for sonic conversion from ftos (#901) 1. "make target/sonic-broadcom.raw" will create the compressed dd'able image. 2. This will also update the grub config files (device/dell/*/nos_to_sonic_grub.cfg) with the image versions. --- build_image.sh | 56 ++++++++++++-- .../nos_to_sonic_grub.cfg | 44 +++++++++++ .../nos_to_sonic_grub.cfg | 44 +++++++++++ files/image_config/platform/rc.local | 21 ++++++ installer/sharch_body.sh | 1 + installer/x86_64/install.sh | 74 +++++++++++++------ onie-image.conf | 6 ++ onie-mk-demo.sh | 5 ++ platform/broadcom/raw-image.mk | 9 +++ platform/broadcom/rules.mk | 1 + 10 files changed, 232 insertions(+), 29 deletions(-) create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg create mode 100644 platform/broadcom/raw-image.mk diff --git a/build_image.sh b/build_image.sh index a275c383c45d..2d229c2d194b 100755 --- a/build_image.sh +++ b/build_image.sh @@ -14,11 +14,8 @@ IMAGE_VERSION=$(. functions.sh && sonic_get_version) -if [ "$IMAGE_TYPE" = "onie" ]; then - echo "Build ONIE installer" - mkdir -p `dirname $OUTPUT_ONIE_IMAGE` - sudo rm -f $OUTPUT_ONIE_IMAGE - +generate_onie_installer_image() +{ # Copy platform-specific ONIE installer config files where onie-mk-demo.sh expects them rm -rf ./installer/x86_64/platforms/ mkdir -p ./installer/x86_64/platforms/ @@ -27,6 +24,11 @@ if [ "$IMAGE_TYPE" = "onie" ]; then if [ -f ./device/$VENDOR/$PLATFORM/installer.conf ]; then cp ./device/$VENDOR/$PLATFORM/installer.conf ./installer/x86_64/platforms/$PLATFORM fi + + if [ "$IMAGE_TYPE" = "raw" ] && [ -f ./device/$VENDOR/$PLATFORM/nos_to_sonic_grub.cfg ]; then + sed -i -e "s/%%IMAGE_VERSION%%/$IMAGE_VERSION/g" ./device/$VENDOR/$PLATFORM/nos_to_sonic_grub.cfg + echo "IMAGE_VERSION is $IMAGE_VERSION" + fi done done @@ -35,6 +37,50 @@ if [ "$IMAGE_TYPE" = "onie" ]; then ./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \ installer platform/$TARGET_MACHINE/platform.conf $OUTPUT_ONIE_IMAGE OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \ $ONIE_INSTALLER_PAYLOAD +} + +if [ "$IMAGE_TYPE" = "onie" ]; then + echo "Build ONIE installer" + mkdir -p `dirname $OUTPUT_ONIE_IMAGE` + sudo rm -f $OUTPUT_ONIE_IMAGE + + generate_onie_installer_image + +## Build a raw partition dump image using the ONIE installer that can be +## used to dd' in-lieu of using the onie-nos-installer. Used while migrating +## into SONiC from other NOS. +elif [ "$IMAGE_TYPE" = "raw" ]; then + + echo "Build RAW image" + mkdir -p `dirname $OUTPUT_RAW_IMAGE` + sudo rm -f $OUTPUT_RAW_IMAGE + + generate_onie_installer_image + + echo "Creating SONiC raw partition : $OUTPUT_RAW_IMAGE of size $RAW_IMAGE_DISK_SIZE MB" + fallocate -l "$RAW_IMAGE_DISK_SIZE"M $OUTPUT_RAW_IMAGE + + ## Generate a compressed 8GB partition dump that can be used to 'dd' in-lieu of using the onie-nos-installer + ## Run the installer + ## The 'build' install mode of the installer is used to generate this dump. + sudo chmod a+x $OUTPUT_ONIE_IMAGE + sudo ./$OUTPUT_ONIE_IMAGE + + [ -r $OUTPUT_RAW_IMAGE ] || { + echo "Error : $OUTPUT_RAW_IMAGE not generated!" + exit 1 + } + + gzip $OUTPUT_RAW_IMAGE + + [ -r $OUTPUT_RAW_IMAGE.gz ] || { + echo "Error : gzip $OUTPUT_RAW_IMAGE failed!" + exit 1 + } + + mv $OUTPUT_RAW_IMAGE.gz $OUTPUT_RAW_IMAGE + echo "The compressed raw image is in $OUTPUT_RAW_IMAGE" + ## Use 'aboot' as target machine category which includes Aboot as bootloader elif [ "$IMAGE_TYPE" = "aboot" ]; then echo "Build Aboot installer" diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg b/device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg new file mode 100644 index 000000000000..058b1a9ea118 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg @@ -0,0 +1,44 @@ +# +# Grub config to launch SONiC +# with ONIE boot option + +insmod serial +# Initialize USB-Serial com2 port +serial --unit=1 --speed=9600 +#Serial port config;Defaults: COM1,9600 +serial --unit=0 --speed=9600 +terminal_output serial_com0 +terminal_input serial_com0 +#terminfo added to prevent text wrap issue. +terminfo -g 80x100 serial_com0 +terminfo -g 80x100 serial_com1 + +echo -n "Press Esc to stop autoboot ... " +if sleep --verbose --interruptible 5 ; then + insmod gzio + insmod part_msdos + insmod ext2 + set root='(hd0,gpt8)' + linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor + initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 + boot +else + menuentry 'SONiC' { + insmod gzio + insmod part_msdos + insmod ext2 + set root='(hd0,gpt8)' + linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor + initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 + boot + } + + menuentry 'ONIE' { + insmod force10 + onieboot + } + + menuentry 'DELL-DIAG' { + delldiagboot + } +fi diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg b/device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg new file mode 100644 index 000000000000..058b1a9ea118 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg @@ -0,0 +1,44 @@ +# +# Grub config to launch SONiC +# with ONIE boot option + +insmod serial +# Initialize USB-Serial com2 port +serial --unit=1 --speed=9600 +#Serial port config;Defaults: COM1,9600 +serial --unit=0 --speed=9600 +terminal_output serial_com0 +terminal_input serial_com0 +#terminfo added to prevent text wrap issue. +terminfo -g 80x100 serial_com0 +terminfo -g 80x100 serial_com1 + +echo -n "Press Esc to stop autoboot ... " +if sleep --verbose --interruptible 5 ; then + insmod gzio + insmod part_msdos + insmod ext2 + set root='(hd0,gpt8)' + linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor + initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 + boot +else + menuentry 'SONiC' { + insmod gzio + insmod part_msdos + insmod ext2 + set root='(hd0,gpt8)' + linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor + initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 + boot + } + + menuentry 'ONIE' { + insmod force10 + onieboot + } + + menuentry 'DELL-DIAG' { + delldiagboot + } +fi diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 49b2ed6e1b69..8b8db4a261c3 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -11,6 +11,27 @@ # # By default this script does nothing. +# If the machine.conf is absent, it indicates that the unit booted +# into SONiC from another NOS. Extract the machine.conf from ONIE. +if [ ! -e /host/machine.conf ]; then + onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') + mkdir -p /mnt/onie-boot + mount $onie_dev /mnt/onie-boot + onie_grub_cfg=/mnt/onie-boot/onie/grub/grub-machine.cfg + + if [ ! -e $onie_grub_cfg ]; then + echo "$onie_grub_cfg not found" >> /etc/migration.log + else + . ./$onie_grub_cfg + grep = $onie_grub_cfg | sed -e 's/onie_//' -e 's/=.*$//' | while read var ; do + eval val='$'onie_$var + echo "onie_${var}=${val}" >> /host/machine.conf + done + fi + + umount /mnt/onie-boot +fi + . /host/machine.conf echo "install platform dependent packages at the first boot time" diff --git a/installer/sharch_body.sh b/installer/sharch_body.sh index 8260d0fd00e6..d22fe26b6998 100644 --- a/installer/sharch_body.sh +++ b/installer/sharch_body.sh @@ -27,6 +27,7 @@ echo " OK." # Untar and launch install script in a tmpfs cur_wd=$(pwd) +export cur_wd archive_path=$(realpath "$0") tmp_dir=$(mktemp -d) if [ "$(id -u)" = "0" ] ; then diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index ca8c4d3e47e7..ad1cc3691fbf 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -24,8 +24,25 @@ _trap_push true set -e cd $(dirname $0) +if [ -d "/etc/sonic" ]; then + echo "Installing SONiC in SONiC" + install_env="sonic" +elif grep -Fxqs "DISTRIB_ID=onie" /etc/lsb-release > /dev/null +then + echo "Installing SONiC in ONIE" + install_env="onie" +else + echo "Installing SONiC in BUILD" + install_env="build" +fi + +if [ -r ./machine.conf ]; then . ./machine.conf +fi + +if [ -r ./onie-image.conf ]; then . ./onie-image.conf +fi echo "ONIE Installer: platform: $platform" @@ -40,7 +57,7 @@ if [ -r /etc/machine.conf ]; then . /etc/machine.conf elif [ -r /host/machine.conf ]; then . /host/machine.conf -else +elif [ "$install_env" != "build" ]; then echo "cannot find machine.conf" exit 1 fi @@ -58,26 +75,20 @@ ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" # Default var/log device size in MB VAR_LOG_SIZE=4096 -if [ -d "/etc/sonic" ]; then - echo "Installing SONiC in SONiC" - install_env="sonic" -else - echo "Installing SONiC in ONIE" - install_env="onie" -fi - [ -r platforms/$onie_platform ] && . platforms/$onie_platform # Install demo on same block device as ONIE -onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') -blk_dev=$(echo $onie_dev | sed -e 's/[1-9][0-9]*$//' | sed -e 's/\([0-9]\)\(p\)/\1/') -# Note: ONIE has no mount setting for / with device node, so below will be empty string -cur_part=$(cat /proc/mounts | awk "{ if(\$2==\"/\") print \$1 }" | grep $blk_dev || true) - -[ -b "$blk_dev" ] || { - echo "Error: Unable to determine block device of ONIE install" - exit 1 -} +if [ "$install_env" != "build" ]; then + onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') + blk_dev=$(echo $onie_dev | sed -e 's/[1-9][0-9]*$//' | sed -e 's/\([0-9]\)\(p\)/\1/') + # Note: ONIE has no mount setting for / with device node, so below will be empty string + cur_part=$(cat /proc/mounts | awk "{ if(\$2==\"/\") print \$1 }" | grep $blk_dev || true) + + [ -b "$blk_dev" ] || { + echo "Error: Unable to determine block device of ONIE install" + exit 1 + } +fi # If running in ONIE if [ "$install_env" = "onie" ]; then @@ -108,7 +119,7 @@ else firmware="bios" fi -if [ "$install_env" != "sonic" ]; then +if [ "$install_env" = "onie" ]; then # determine ONIE partition type onie_partition_type=$(${onie_bin} onie-sysinfo -t) # demo partition size in MB @@ -310,6 +321,7 @@ demo_install_grub() cat $grub_install_log && rm -f $grub_install_log exit 1 } + rm -f $grub_install_log # restore immutable flag on the core.img file as discussed @@ -374,7 +386,7 @@ demo_install_uefi_grub() image_dir="image-$image_version" -if [ "$install_env" != "sonic" ]; then +if [ "$install_env" = "onie" ]; then eval $create_demo_partition $blk_dev demo_dev=$(echo $blk_dev | sed -e 's/\(mmcblk[0-9]\)/\1p/')$demo_part @@ -391,7 +403,8 @@ if [ "$install_env" != "sonic" ]; then echo "Error: Unable to mount $demo_dev on $demo_mnt" exit 1 } -else + +elif [ "$install_env" = "sonic" ]; then demo_mnt="/host" running_sonic_revision=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") # Prevent installing existing SONiC if it is running @@ -406,6 +419,15 @@ else rm -rf $f fi done +else + demo_mnt="build_raw_image_mnt" + demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%" + + mkfs.ext4 $demo_dev + + echo "Mounting $demo_dev on $demo_mnt..." + mkdir $demo_mnt + mount -t auto -o loop $demo_dev $demo_mnt fi echo "Installing SONiC to $demo_mnt/$image_dir" @@ -446,7 +468,7 @@ if [ "$VAR_LOG_SIZE" != "0" ]; then mkfs.ext4 -q $demo_mnt/disk-img/var-log.ext4 -F fi -if [ "$install_env" != "sonic" ]; then +if [ "$install_env" = "onie" ]; then # Store machine description in target file system cp /etc/machine.conf $demo_mnt @@ -547,7 +569,7 @@ menuentry '$demo_grub_entry' { } EOF -if [ "$install_env" != "sonic" ]; then +if [ "$install_env" = "onie" ]; then # Add menu entries for ONIE -- use the grub fragment provided by the # ONIE distribution. $onie_root_dir/grub.d/50_onie_grub >> $grub_cfg @@ -559,7 +581,11 @@ $onie_menuentry EOF fi -cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg +if [ "$install_env" = "build" ]; then + umount $demo_mnt +else + cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg +fi cd / diff --git a/onie-image.conf b/onie-image.conf index f12e23f7414b..b6564feb1a41 100644 --- a/onie-image.conf +++ b/onie-image.conf @@ -27,6 +27,12 @@ DOCKERFS_DIR=docker ## Output file name for onie installer OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin +### Output file name for raw image +OUTPUT_RAW_IMAGE=target/sonic-$TARGET_MACHINE.raw + +### Raw image size in MB +RAW_IMAGE_DISK_SIZE=8192 + ## Output file name for aboot installer OUTPUT_ABOOT_IMAGE=target/sonic-aboot-$TARGET_MACHINE.swi diff --git a/onie-mk-demo.sh b/onie-mk-demo.sh index 91d6d1b3ceb2..b8418d79a678 100755 --- a/onie-mk-demo.sh +++ b/onie-mk-demo.sh @@ -83,11 +83,16 @@ cp onie-image.conf $tmp_installdir # sed. Special chars are: \ / & EXTRA_CMDLINE_LINUX=`echo $EXTRA_CMDLINE_LINUX | sed -e 's/[\/&]/\\\&/g'` +output_raw_image=$(cat onie-image.conf | grep OUTPUT_RAW_IMAGE | cut -f2 -d"=") +[ -z "$TARGET_MACHINE" ] && output_raw_image=$(echo $output_raw_image | sed -e 's/$TARGET_MACHINE/$machine/g') +output_raw_image=$(eval echo $output_raw_image) + # Tailor the demo installer for OS mode or DIAG mode sed -i -e "s/%%DEMO_TYPE%%/$demo_type/g" \ -e "s/%%IMAGE_VERSION%%/$image_version/g" \ -e "s/%%ONIE_IMAGE_PART_SIZE%%/$onie_image_part_size/" \ -e "s/%%EXTRA_CMDLINE_LINUX%%/$EXTRA_CMDLINE_LINUX/" \ + -e "s@%%OUTPUT_RAW_IMAGE%%@$output_raw_image@" \ $tmp_installdir/install.sh || clean_up 1 echo -n "." cp -r $* $tmp_installdir || clean_up 1 diff --git a/platform/broadcom/raw-image.mk b/platform/broadcom/raw-image.mk new file mode 100644 index 000000000000..ae93683c543d --- /dev/null +++ b/platform/broadcom/raw-image.mk @@ -0,0 +1,9 @@ +# sonic broadcom raw image installer + +SONIC_RAW_IMAGE = sonic-broadcom.raw +$(SONIC_RAW_IMAGE)_MACHINE = broadcom +$(SONIC_RAW_IMAGE)_IMAGE_TYPE = raw +$(SONIC_RAW_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) +$(SONIC_RAW_IMAGE)_INSTALLS += $($(SONIC_ONE_IMAGE)_INSTALLS) +$(SONIC_RAW_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_RAW_IMAGE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 253593b30f2a..30b517f8d385 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -11,6 +11,7 @@ include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk include $(PLATFORM_PATH)/one-image.mk +include $(PLATFORM_PATH)/raw-image.mk include $(PLATFORM_PATH)/one-aboot.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk From 3e7c3e6ea398e5d5e3820ea143b040688ba458d3 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 29 Aug 2017 00:53:19 -0700 Subject: [PATCH 0750/1833] [devices]: Bump sonic-platform-modules-arista submodule (#924) --- platform/broadcom/sonic-platform-modules-arista | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 7c505290bb26..4ad9358d16b8 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 7c505290bb26babdef604a377e71b3df702897a8 +Subproject commit 4ad9358d16b8cd0b57d5922353f38055f83042e4 From 44502b217b226da6b33591e1b199a47d35c95df5 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 29 Aug 2017 10:47:25 -0700 Subject: [PATCH 0751/1833] Migrate DEVICE_METADATA to db (#919) --- dockers/docker-fpm-frr/bgpd.conf.j2 | 4 ++-- dockers/docker-fpm-frr/zebra.conf.j2 | 2 +- dockers/docker-fpm-gobgp/zebra.conf.j2 | 2 +- dockers/docker-fpm-quagga/bgpd.conf.j2 | 8 +++---- dockers/docker-fpm-quagga/zebra.conf.j2 | 2 +- src/sonic-config-engine/minigraph.py | 23 ++++++++++---------- src/sonic-config-engine/sonic-cfggen | 13 +++++++++++ src/sonic-config-engine/tests/test_cfggen.py | 8 +++---- 8 files changed, 37 insertions(+), 25 deletions(-) diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index c66d5bfb232f..1624b5d3578d 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -7,7 +7,7 @@ {% endblock banner %} ! {% block system_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra log syslog informational log facility local4 @@ -51,7 +51,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% if bgp_session['asn'] != 0 %} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} {% if neighbor_addr | ipv4 %} diff --git a/dockers/docker-fpm-frr/zebra.conf.j2 b/dockers/docker-fpm-frr/zebra.conf.j2 index 1ce06eecd2d9..9214eab22c88 100644 --- a/dockers/docker-fpm-frr/zebra.conf.j2 +++ b/dockers/docker-fpm-frr/zebra.conf.j2 @@ -7,7 +7,7 @@ {% endblock banner %} ! {% block sys_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra enable password zebra {% endblock sys_init %} diff --git a/dockers/docker-fpm-gobgp/zebra.conf.j2 b/dockers/docker-fpm-gobgp/zebra.conf.j2 index 1ce06eecd2d9..9214eab22c88 100644 --- a/dockers/docker-fpm-gobgp/zebra.conf.j2 +++ b/dockers/docker-fpm-gobgp/zebra.conf.j2 @@ -7,7 +7,7 @@ {% endblock banner %} ! {% block sys_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra enable password zebra {% endblock sys_init %} diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index eb1da1f1a3ea..daca10b102bd 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -7,7 +7,7 @@ {% endblock banner %} ! {% block system_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra log syslog informational log facility local4 @@ -27,7 +27,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp log-neighbor-changes bgp bestpath as-path multipath-relax {# Advertise graceful restart capability for ToR #} -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} bgp graceful-restart {% endif %} {# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} @@ -64,13 +64,13 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} neighbor {{ neighbor_addr }} shutdown {% endif %} {% if neighbor_addr | ipv4 %} -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} {% endif %} {% if neighbor_addr | ipv6 %} address-family ipv6 -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['locahost']['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} neighbor {{ neighbor_addr }} activate diff --git a/dockers/docker-fpm-quagga/zebra.conf.j2 b/dockers/docker-fpm-quagga/zebra.conf.j2 index 1ce06eecd2d9..9214eab22c88 100644 --- a/dockers/docker-fpm-quagga/zebra.conf.j2 +++ b/dockers/docker-fpm-quagga/zebra.conf.j2 @@ -7,7 +7,7 @@ {% endblock banner %} ! {% block sys_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra enable password zebra {% endblock sys_init %} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 1877e552858e..06a4a3cb3f2e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -458,14 +458,15 @@ def parse_xml(filename, platform=None, port_config_file=None): ethernet_interfaces = parse_deviceinfo(child, hwsku) results = {} - results['minigraph_hwsku'] = hwsku - # sorting by lambdas are not easily done without custom filters. - # TODO: add jinja2 filter to accept a lambda to sort a list of dictionaries by attribute. - # TODO: alternatively (preferred), implement class containers for multiple-attribute entries, enabling sort by attr results['BGP_NEIGHBOR'] = bgp_sessions - results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn }} + results['DEVICE_METADATA'] = {'localhost': { + 'bgp_asn': bgp_asn, + 'deployment_id': deployment_id, + 'hostname': hostname, + 'hwsku': hwsku, + 'type': devices[hostname]['type'] + }} results['BGP_PEER_RANGE'] = bgp_peers_with_range - # TODO: sort does not work properly on all interfaces of varying lengths. Need to sort by integer group(s). phyport_intfs = [] vlan_intfs = [] @@ -496,14 +497,11 @@ def parse_xml(filename, platform=None, port_config_file=None): if devices != None: results['minigraph_console'] = get_console_info(devices, console_dev, console_port) results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port) - results['minigraph_hostname'] = hostname - results['inventory_hostname'] = hostname results['syslog_servers'] = syslog_servers results['dhcp_servers'] = dhcp_servers results['ntp_servers'] = ntp_servers results['forced_mgmt_routes'] = mgmt_routes results['erspan_dst'] = erspan_dst - results['deployment_id'] = deployment_id results['ethernet_interfaces'] = ethernet_interfaces return results @@ -513,9 +511,10 @@ def parse_device_desc_xml(filename): (lo_prefix, mgmt_prefix, hostname, hwsku, d_type) = parse_device(root) results = {} - results['minigraph_hwsku'] = hwsku - results['minigraph_hostname'] = hostname - results['inventory_hostname'] = hostname + results['DEVICE_METADATA'] = {'localhost': { + 'hostname': hostname, + 'hwsku': hwsku, + }} lo_intfs = [] ipn = ipaddress.IPNetwork(lo_prefix) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 070b3100ea5a..029f6cfc17b0 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -22,6 +22,7 @@ import yaml import jinja2 import netaddr import json +from functools import partial from minigraph import minigraph_encoder from minigraph import parse_xml from minigraph import parse_device_desc_xml @@ -53,6 +54,16 @@ def is_ipv6(value): return False return addr.version == 6 +def prefix_attr(attr, value): + if not value: + return None + else: + try: + prefix = netaddr.IPNetwork(str(value)) + except: + return None + return str(getattr(prefix, attr)) + def unique_name(l): name_list = [] new_list = [] @@ -158,6 +169,8 @@ def main(): env.filters['ipv4'] = is_ipv4 env.filters['ipv6'] = is_ipv6 env.filters['unique_name'] = unique_name + for attr in ['ip', 'network', 'prefixlen', 'netmask']: + env.filters[attr] = partial(prefix_attr, attr) template = env.get_template(template_file) print template.render(data) diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 153b0bb14f36..6a563088d338 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -31,7 +31,7 @@ def test_dummy_run(self): self.assertEqual(output, '') def test_device_desc(self): - argument = '-v minigraph_hwsku -M "' + self.sample_device_desc + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -M "' + self.sample_device_desc + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'ACS-MSN2700') @@ -41,7 +41,7 @@ def test_device_desc_mgmt_ip(self): self.assertEqual(output.strip(), '10.0.1.5') def test_minigraph_sku(self): - argument = '-v minigraph_hwsku -m "' + self.sample_graph + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -m "' + self.sample_graph + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'Force10-Z9100') @@ -51,7 +51,7 @@ def test_print_data(self): self.assertTrue(len(output.strip()) > 0) def test_jinja_expression(self): - argument = '-m "' + self.sample_graph + '" -v "minigraph_devices[minigraph_hostname][\'type\']"' + argument = '-m "' + self.sample_graph + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"' output = self.run_script(argument) self.assertEqual(output.strip(), 'LeafRouter') @@ -116,7 +116,7 @@ def test_minigraph_peers_with_range(self): self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]") def test_minigraph_deployment_id(self): - argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v deployment_id' + argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"' output = self.run_script(argument) self.assertEqual(output.strip(), "1") From e4502527d00a6d101f73f7c3a07eae9d7f548336 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 29 Aug 2017 17:03:31 -0700 Subject: [PATCH 0752/1833] Revert "Migrate DEVICE_METADATA to db (#919)" (#928) This reverts commit 44502b217b226da6b33591e1b199a47d35c95df5. --- dockers/docker-fpm-frr/bgpd.conf.j2 | 4 ++-- dockers/docker-fpm-frr/zebra.conf.j2 | 2 +- dockers/docker-fpm-gobgp/zebra.conf.j2 | 2 +- dockers/docker-fpm-quagga/bgpd.conf.j2 | 8 +++---- dockers/docker-fpm-quagga/zebra.conf.j2 | 2 +- src/sonic-config-engine/minigraph.py | 23 ++++++++++---------- src/sonic-config-engine/sonic-cfggen | 13 ----------- src/sonic-config-engine/tests/test_cfggen.py | 8 +++---- 8 files changed, 25 insertions(+), 37 deletions(-) diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index 1624b5d3578d..c66d5bfb232f 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -7,7 +7,7 @@ {% endblock banner %} ! {% block system_init %} -hostname {{ DEVICE_METADATA['localhost']['hostname'] }} +hostname {{ inventory_hostname }} password zebra log syslog informational log facility local4 @@ -51,7 +51,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% if bgp_session['asn'] != 0 %} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} -{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} +{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} {% if neighbor_addr | ipv4 %} diff --git a/dockers/docker-fpm-frr/zebra.conf.j2 b/dockers/docker-fpm-frr/zebra.conf.j2 index 9214eab22c88..1ce06eecd2d9 100644 --- a/dockers/docker-fpm-frr/zebra.conf.j2 +++ b/dockers/docker-fpm-frr/zebra.conf.j2 @@ -7,7 +7,7 @@ {% endblock banner %} ! {% block sys_init %} -hostname {{ DEVICE_METADATA['localhost']['hostname'] }} +hostname {{ inventory_hostname }} password zebra enable password zebra {% endblock sys_init %} diff --git a/dockers/docker-fpm-gobgp/zebra.conf.j2 b/dockers/docker-fpm-gobgp/zebra.conf.j2 index 9214eab22c88..1ce06eecd2d9 100644 --- a/dockers/docker-fpm-gobgp/zebra.conf.j2 +++ b/dockers/docker-fpm-gobgp/zebra.conf.j2 @@ -7,7 +7,7 @@ {% endblock banner %} ! {% block sys_init %} -hostname {{ DEVICE_METADATA['localhost']['hostname'] }} +hostname {{ inventory_hostname }} password zebra enable password zebra {% endblock sys_init %} diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index daca10b102bd..eb1da1f1a3ea 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -7,7 +7,7 @@ {% endblock banner %} ! {% block system_init %} -hostname {{ DEVICE_METADATA['localhost']['hostname'] }} +hostname {{ inventory_hostname }} password zebra log syslog informational log facility local4 @@ -27,7 +27,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp log-neighbor-changes bgp bestpath as-path multipath-relax {# Advertise graceful restart capability for ToR #} -{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} +{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} bgp graceful-restart {% endif %} {# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} @@ -64,13 +64,13 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} neighbor {{ neighbor_addr }} shutdown {% endif %} {% if neighbor_addr | ipv4 %} -{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} +{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} {% endif %} {% if neighbor_addr | ipv6 %} address-family ipv6 -{% if DEVICE_METADATA['locahost']['type'] == 'ToRRouter' %} +{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} neighbor {{ neighbor_addr }} activate diff --git a/dockers/docker-fpm-quagga/zebra.conf.j2 b/dockers/docker-fpm-quagga/zebra.conf.j2 index 9214eab22c88..1ce06eecd2d9 100644 --- a/dockers/docker-fpm-quagga/zebra.conf.j2 +++ b/dockers/docker-fpm-quagga/zebra.conf.j2 @@ -7,7 +7,7 @@ {% endblock banner %} ! {% block sys_init %} -hostname {{ DEVICE_METADATA['localhost']['hostname'] }} +hostname {{ inventory_hostname }} password zebra enable password zebra {% endblock sys_init %} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 06a4a3cb3f2e..1877e552858e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -458,15 +458,14 @@ def parse_xml(filename, platform=None, port_config_file=None): ethernet_interfaces = parse_deviceinfo(child, hwsku) results = {} + results['minigraph_hwsku'] = hwsku + # sorting by lambdas are not easily done without custom filters. + # TODO: add jinja2 filter to accept a lambda to sort a list of dictionaries by attribute. + # TODO: alternatively (preferred), implement class containers for multiple-attribute entries, enabling sort by attr results['BGP_NEIGHBOR'] = bgp_sessions - results['DEVICE_METADATA'] = {'localhost': { - 'bgp_asn': bgp_asn, - 'deployment_id': deployment_id, - 'hostname': hostname, - 'hwsku': hwsku, - 'type': devices[hostname]['type'] - }} + results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn }} results['BGP_PEER_RANGE'] = bgp_peers_with_range + # TODO: sort does not work properly on all interfaces of varying lengths. Need to sort by integer group(s). phyport_intfs = [] vlan_intfs = [] @@ -497,11 +496,14 @@ def parse_xml(filename, platform=None, port_config_file=None): if devices != None: results['minigraph_console'] = get_console_info(devices, console_dev, console_port) results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port) + results['minigraph_hostname'] = hostname + results['inventory_hostname'] = hostname results['syslog_servers'] = syslog_servers results['dhcp_servers'] = dhcp_servers results['ntp_servers'] = ntp_servers results['forced_mgmt_routes'] = mgmt_routes results['erspan_dst'] = erspan_dst + results['deployment_id'] = deployment_id results['ethernet_interfaces'] = ethernet_interfaces return results @@ -511,10 +513,9 @@ def parse_device_desc_xml(filename): (lo_prefix, mgmt_prefix, hostname, hwsku, d_type) = parse_device(root) results = {} - results['DEVICE_METADATA'] = {'localhost': { - 'hostname': hostname, - 'hwsku': hwsku, - }} + results['minigraph_hwsku'] = hwsku + results['minigraph_hostname'] = hostname + results['inventory_hostname'] = hostname lo_intfs = [] ipn = ipaddress.IPNetwork(lo_prefix) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 029f6cfc17b0..070b3100ea5a 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -22,7 +22,6 @@ import yaml import jinja2 import netaddr import json -from functools import partial from minigraph import minigraph_encoder from minigraph import parse_xml from minigraph import parse_device_desc_xml @@ -54,16 +53,6 @@ def is_ipv6(value): return False return addr.version == 6 -def prefix_attr(attr, value): - if not value: - return None - else: - try: - prefix = netaddr.IPNetwork(str(value)) - except: - return None - return str(getattr(prefix, attr)) - def unique_name(l): name_list = [] new_list = [] @@ -169,8 +158,6 @@ def main(): env.filters['ipv4'] = is_ipv4 env.filters['ipv6'] = is_ipv6 env.filters['unique_name'] = unique_name - for attr in ['ip', 'network', 'prefixlen', 'netmask']: - env.filters[attr] = partial(prefix_attr, attr) template = env.get_template(template_file) print template.render(data) diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 6a563088d338..153b0bb14f36 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -31,7 +31,7 @@ def test_dummy_run(self): self.assertEqual(output, '') def test_device_desc(self): - argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -M "' + self.sample_device_desc + '"' + argument = '-v minigraph_hwsku -M "' + self.sample_device_desc + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'ACS-MSN2700') @@ -41,7 +41,7 @@ def test_device_desc_mgmt_ip(self): self.assertEqual(output.strip(), '10.0.1.5') def test_minigraph_sku(self): - argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -m "' + self.sample_graph + '"' + argument = '-v minigraph_hwsku -m "' + self.sample_graph + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'Force10-Z9100') @@ -51,7 +51,7 @@ def test_print_data(self): self.assertTrue(len(output.strip()) > 0) def test_jinja_expression(self): - argument = '-m "' + self.sample_graph + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"' + argument = '-m "' + self.sample_graph + '" -v "minigraph_devices[minigraph_hostname][\'type\']"' output = self.run_script(argument) self.assertEqual(output.strip(), 'LeafRouter') @@ -116,7 +116,7 @@ def test_minigraph_peers_with_range(self): self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]") def test_minigraph_deployment_id(self): - argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"' + argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v deployment_id' output = self.run_script(argument) self.assertEqual(output.strip(), "1") From 9c87eff5fa0d54df4d0e0d9ad4ac2410d3a87aa8 Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Wed, 30 Aug 2017 08:40:21 +0530 Subject: [PATCH 0753/1833] [devices]: Update Dell s6100/z9100 platform modules (#925) [devices]: Update Dell s6100/z9100 platform modules --- platform/broadcom/sonic-platform-modules-dell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 5ab014c0d4f9..1abd4e6c41f6 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 5ab014c0d4f9ad71d7791e7d4da0645d2b2d493b +Subproject commit 1abd4e6c41f633272667a5833a63ab6f8da15199 From 1a4f039f55dd575694bdb0f4509fef5b2c31bb3c Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 30 Aug 2017 09:41:47 -0700 Subject: [PATCH 0754/1833] [quagga] enable core dump for bgpd and zebra (#927) * [core dump] pass unix time to coredump-compress script Currently we only have program name (e.g. bgpd) and PID in the core file name. PID could collide especially after docker restart or recreate. Passing the unix time to coredump-compress so it could also add time to the core file name. * [utilities] include the change to coredump_compress script * [quagga] enable core dump for bgpd and zebra bgpd and zebra downgrade their privilege shortly after started. For that sysctrl kernel.suid_dumpable needs to be set to 2, so that they can dump core. Note that fs.suid_dumpable SHOULD NOT be set to 1. Which will bypass all system security. --- build_debian.sh | 3 ++- src/sonic-utilities | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 22cbef494f87..d7e7c3307536 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -239,10 +239,11 @@ EOF ## Config sysctl sudo mkdir -p $FILESYSTEM_ROOT/var/core sudo augtool --autosave " -set /files/etc/sysctl.conf/kernel.core_pattern '|/usr/bin/coredump-compress %e %p' +set /files/etc/sysctl.conf/kernel.core_pattern '|/usr/bin/coredump-compress %e %t %p' set /files/etc/sysctl.conf/kernel.softlockup_panic 1 set /files/etc/sysctl.conf/kernel.panic 10 +set /files/etc/sysctl.conf/fs.suid_dumpable 2 set /files/etc/sysctl.conf/net.ipv4.conf.default.forwarding 1 set /files/etc/sysctl.conf/net.ipv4.conf.all.forwarding 1 diff --git a/src/sonic-utilities b/src/sonic-utilities index d1ded16b06b4..b82ea42a3546 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit d1ded16b06b493e2420d1013aee97afbdc8160d9 +Subproject commit b82ea42a35468cbb653cf59296d1cca716d400a4 From 127a73aac35d21d8c8d13d28bffb71df1a49ca1c Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Wed, 30 Aug 2017 13:06:02 -0700 Subject: [PATCH 0755/1833] [quagga]: Disable ipv4 over ipv6 and enable ipv6 over ipv4 peer group (#922) * [bgpd]:disable ipv4 over ipv6 and enable ipv6 over ipv4 peer group * update as comments --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index eb1da1f1a3ea..02cf40fa8b47 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -26,6 +26,7 @@ route-map TO_BGP_SPEAKER_V4 deny 10 router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp log-neighbor-changes bgp bestpath as-path multipath-relax + no bgp default ipv4-unicast {# Advertise graceful restart capability for ToR #} {% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} bgp graceful-restart @@ -64,9 +65,13 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} neighbor {{ neighbor_addr }} shutdown {% endif %} {% if neighbor_addr | ipv4 %} + address-family ipv4 {% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} - neighbor {{ neighbor_addr }} allowas-in 1 + neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} + neighbor {{ neighbor_addr }} activate + maximum-paths 64 + exit-address-family {% endif %} {% if neighbor_addr | ipv6 %} address-family ipv6 @@ -93,6 +98,14 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% for ip_range in bgp_peer['ip_range'] %} bgp listen range {{ip_range}} peer-group {{ bgp_peer['name'] }} {% endfor %} + address-family ipv4 + neighbor {{ bgp_peer['name'] }} activate + maximum-paths 64 + exit-address-family + address-family ipv6 + neighbor {{ bgp_peer['name'] }} activate + maximum-paths 64 + exit-address-family {% endfor %} {% endblock bgp_peers_with_range %} ! From 7f1991cf2f57be39594af91a31c971e2840670bc Mon Sep 17 00:00:00 2001 From: wadelnn Date: Fri, 1 Sep 2017 07:57:58 +0800 Subject: [PATCH 0756/1833] Update sfputil support for Ingrasys S9100 (#929) * Update sonic-platform-modules-ingrasys submodule. * Fixed sfputil plugin for read QSFP EEPROM. * Add sfputil plugin for get presence. * Add sfputil plugin for get/set low power mode. * Add sfputil plugin for reset QSFP. Signed-off-by: Wade He chihen.he@gmail.com --- .../plugins/sfputil.py | 250 +++++++++++++++++- .../broadcom/sonic-platform-modules-ingrasys | 2 +- 2 files changed, 237 insertions(+), 15 deletions(-) diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py index f45502ab9ab4..f4ffc29bebc6 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py @@ -1,19 +1,26 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + 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""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 31 - ports_in_block = 32 + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 - port_to_eeprom_mapping = {} + BASE_DIR_PATH = "/sys/class/gpio/gpio{0}/direction" + BASE_VAL_PATH = "/sys/class/gpio/gpio{0}/value" + + _port_to_eeprom_mapping = {} port_to_i2c_mapping = { 0: 11, 1: 10, @@ -49,12 +56,227 @@ class sfputil(sfputilbase): 31: 40 } - _qsfp_ports = range(0, ports_in_block + 1) + abs_to_gpio_mapping = { + 0: 241, + 1: 240, + 2: 243, + 3: 242, + 4: 245, + 5: 244, + 6: 247, + 7: 246, + 8: 249, + 9: 248, + 10: 251, + 11: 250, + 12: 253, + 13: 252, + 14: 255, + 15: 254, + 16: 225, + 17: 224, + 18: 227, + 19: 226, + 20: 229, + 21: 228, + 22: 231, + 23: 230, + 24: 233, + 25: 232, + 26: 235, + 27: 234, + 28: 237, + 29: 236, + 30: 239, + 31: 238 + } + + lpmode_to_gpio_mapping = { + 0: 177, + 1: 176, + 2: 179, + 3: 178, + 4: 181, + 5: 180, + 6: 183, + 7: 182, + 8: 185, + 9: 184, + 10: 187, + 11: 186, + 12: 189, + 13: 188, + 14: 191, + 15: 190, + 16: 161, + 17: 160, + 18: 163, + 19: 162, + 20: 165, + 21: 164, + 22: 167, + 23: 166, + 24: 169, + 25: 168, + 26: 171, + 27: 170, + 28: 173, + 29: 172, + 30: 175, + 31: 174 + } + + reset_to_gpio_mapping = { + 0: 145, + 1: 144, + 2: 147, + 3: 146, + 4: 149, + 5: 148, + 6: 151, + 7: 150, + 8: 153, + 9: 152, + 10: 155, + 11: 154, + 12: 157, + 13: 156, + 14: 159, + 15: 158, + 16: 129, + 17: 128, + 18: 131, + 19: 130, + 20: 133, + 21: 132, + 22: 135, + 23: 134, + 24: 137, + 25: 136, + 26: 139, + 27: 138, + 28: 141, + 29: 140, + 30: 143, + 31: 142 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) - def __init__(self, port_num): + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + abs_device_file = self.BASE_VAL_PATH.format( + self.abs_to_gpio_mapping[port_num]) + val_file = open(abs_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1" if lpmode is True else "0") + val_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1") + val_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("0") + val_file.close() + + return True diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index 1a67af3caa00..00ea01132665 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit 1a67af3caa00352e5e7db880e1eeda0bdf1fde6b +Subproject commit 00ea0113266590a5b17b923f017b52cab373234e From 1b944dba39f3d6e95d3303e4cce6e4725ef64a81 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 1 Sep 2017 15:28:33 -0700 Subject: [PATCH 0757/1833] Fix confusing comment (#931) --- rules/config | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rules/config b/rules/config index 5403c981f170..2d6e6a82b6a8 100644 --- a/rules/config +++ b/rules/config @@ -12,9 +12,8 @@ # container. SONIC_CONFIG_BUILD_JOBS = 1 -# SONIC_CONFIG_BUILD_JOBS - set number of jobs for number of jobs per package. +# SONIC_CONFIG_MAKE_JOBS - set number of parallel make jobs per package. # Corresponding -j argument will be passed to make/dpkg commands that build separate packages -# container. SONIC_CONFIG_MAKE_JOBS = $(shell nproc) # SONIC_CONFIG_ENABLE_COLORS - enable colored output in build system. From bb1a7b2e22fe7d7db3d5a4552fb24a0503242686 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 1 Sep 2017 15:28:46 -0700 Subject: [PATCH 0758/1833] Replace CRLF line endings with LF (#932) --- .../led_proc_init.soc | 325 ++++---- .../x86_64-cel_seastone-r0/led_proc_init.soc | 19 +- .../minigraph.xml | 242 +++--- .../minigraph.xml | 718 +++++++++--------- 4 files changed, 650 insertions(+), 654 deletions(-) diff --git a/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc index e27679db9ab0..85030e1db349 100644 --- a/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc +++ b/device/accton/x86_64-accton_as5712_54x-r0/led_proc_init.soc @@ -1,163 +1,162 @@ -# LED setting for active -# ----------------------------------------------------------------------------- -# for as5712_54x (48xg+6qxg) -# -# on green - if link up -# off - if link down -# blink - if active -# ----------------------------------------------------------------------------- -m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 -m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=1 -m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=2 -m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 -m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 -m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=5 -m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=6 -m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 -m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 -m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=9 -m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=10 -m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 -m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 -m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=13 -m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=14 -m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 -m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 -m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=17 -m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=18 -m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 -m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 -m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=21 -m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=22 -m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 -m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 -m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=25 -m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=26 -m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 -m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 -m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=29 -m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=30 -m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 -m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 -m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=33 -m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=34 -m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=35 -m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 -m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=37 -m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=38 -m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=39 -m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 -m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=41 -m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=42 -m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=43 -m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 -m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=45 -m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=46 -m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 -m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 -m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=49 -m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=50 -m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=51 -m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 -m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=53 -m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=54 -m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=55 -m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 -m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=57 -m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=58 -m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=59 -m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 -m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=61 -m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=62 -m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 -m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 -m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=1 -m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=2 -m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 -m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 -m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=5 -m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=6 -m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 -m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 -m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=9 -m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=10 -m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 -m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 -m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=13 -m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=14 -m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 -m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 -m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=17 -m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=18 -m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 -m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 -m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=21 -m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=22 -m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 -m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 -m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=25 -m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=26 -m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 -m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 -m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=29 -m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=30 -m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 -m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 -m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=33 -m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=34 -m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=35 -m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 -m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=37 -m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=38 -m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=39 -m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 -m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=41 -m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=42 -m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=43 -m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 -m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=45 -m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=46 -m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 -m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 -m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=49 -m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=50 -m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=51 -m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 -m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=53 -m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=54 -m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=55 -m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 -m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=57 -m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=58 -m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=59 -m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 -m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=61 -m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=62 -m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 - -led 0 stop -led 0 prog \ - 06 FE 80 D2 19 71 08 E0 60 FE E9 D2 0F 75 10 81 \ - 61 FD 02 3F 60 FF 28 32 0F 87 67 4A 96 FF 06 FF \ - D2 2B 74 16 02 1F 60 FF 28 32 0F 87 67 4A 96 FF \ - 06 FF D2 13 74 28 02 0F 60 FF 28 32 0F 87 67 4A \ - 96 FF 06 FF D2 0B 74 3A 3A 48 32 07 32 08 C7 32 \ - 04 C7 97 71 57 77 69 32 00 32 01 B7 97 71 63 32 \ - 0E 77 6B 26 FD 97 27 77 6B 32 0F 87 57 00 00 00 -led 0 start - -led 1 stop -led 1 prog \ - 06 FE 80 D2 19 71 08 E0 60 FE E9 D2 0F 75 10 81 \ - 61 FD 02 20 67 89 02 24 67 89 02 10 67 89 02 28 \ - 67 89 02 2C 67 89 02 0C 67 89 02 2C 67 79 02 28 \ - 67 79 02 24 67 79 02 20 67 79 02 10 67 79 02 0C \ - 67 79 02 0B 60 FF 28 32 0F 87 67 56 96 FF 06 FF \ - D2 FF 74 46 3A 36 32 07 32 08 C7 32 04 C7 97 71 \ - 63 77 75 32 00 32 01 B7 97 71 6F 32 0E 77 77 26 \ - FD 97 27 77 77 32 0F 87 57 12 A0 F8 15 1A 01 75 \ - 85 28 67 56 57 32 0F 87 57 12 A0 F8 15 1A 01 71 \ - A1 28 67 56 80 28 67 56 80 28 67 56 80 28 67 56 \ - 57 32 0F 87 32 0F 87 32 0F 87 32 0F 87 57 00 00 -led 1 start - +# LED setting for active +# ----------------------------------------------------------------------------- +# for as5712_54x (48xg+6qxg) +# +# on green - if link up +# off - if link down +# blink - if active +# ----------------------------------------------------------------------------- +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=1 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=2 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=5 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=6 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=9 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=10 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=13 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=14 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=17 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=18 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=21 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=22 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=25 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=26 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=29 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=30 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=33 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=34 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=35 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=37 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=38 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=39 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=41 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=42 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=43 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=45 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=46 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=49 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=50 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=51 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=53 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=54 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=55 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=57 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=58 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=59 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=61 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=62 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=1 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=2 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=5 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=6 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=9 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=10 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=13 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=14 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=17 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=18 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=21 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=22 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=25 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=26 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=29 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=30 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=33 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=34 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=35 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=37 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=38 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=39 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=41 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=42 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=43 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=45 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=46 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=47 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=49 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=50 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=51 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=53 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=54 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=55 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=57 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=58 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=59 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=61 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=62 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 + +led 0 stop +led 0 prog \ + 06 FE 80 D2 19 71 08 E0 60 FE E9 D2 0F 75 10 81 \ + 61 FD 02 3F 60 FF 28 32 0F 87 67 4A 96 FF 06 FF \ + D2 2B 74 16 02 1F 60 FF 28 32 0F 87 67 4A 96 FF \ + 06 FF D2 13 74 28 02 0F 60 FF 28 32 0F 87 67 4A \ + 96 FF 06 FF D2 0B 74 3A 3A 48 32 07 32 08 C7 32 \ + 04 C7 97 71 57 77 69 32 00 32 01 B7 97 71 63 32 \ + 0E 77 6B 26 FD 97 27 77 6B 32 0F 87 57 00 00 00 +led 0 start + +led 1 stop +led 1 prog \ + 06 FE 80 D2 19 71 08 E0 60 FE E9 D2 0F 75 10 81 \ + 61 FD 02 20 67 89 02 24 67 89 02 10 67 89 02 28 \ + 67 89 02 2C 67 89 02 0C 67 89 02 2C 67 79 02 28 \ + 67 79 02 24 67 79 02 20 67 79 02 10 67 79 02 0C \ + 67 79 02 0B 60 FF 28 32 0F 87 67 56 96 FF 06 FF \ + D2 FF 74 46 3A 36 32 07 32 08 C7 32 04 C7 97 71 \ + 63 77 75 32 00 32 01 B7 97 71 6F 32 0E 77 77 26 \ + FD 97 27 77 77 32 0F 87 57 12 A0 F8 15 1A 01 75 \ + 85 28 67 56 57 32 0F 87 57 12 A0 F8 15 1A 01 71 \ + A1 28 67 56 80 28 67 56 80 28 67 56 80 28 67 56 \ + 57 32 0F 87 32 0F 87 32 0F 87 32 0F 87 57 00 00 +led 1 start diff --git a/device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc b/device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc index fb898fcadfc1..450533c0dc68 100755 --- a/device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc +++ b/device/celestica/x86_64-cel_seastone-r0/led_proc_init.soc @@ -1,11 +1,8 @@ - -# Download LED code into LED processor and enable (if applicable). - -led 0 load /usr/share/sonic/platform/led-code/ledcode0; -led 0 auto on; led 0 start; -led 1 load /usr/share/sonic/platform/led-code/ledcode1; -led 1 auto on; led 1 start; -led 2 load /usr/share/sonic/platform/led-code/ledcode2; -led 2 auto on; led 2 start - - +# Download LED code into LED processor and enable (if applicable). + +led 0 load /usr/share/sonic/platform/led-code/ledcode0; +led 0 auto on; led 0 start; +led 1 load /usr/share/sonic/platform/led-code/ledcode1; +led 1 auto on; led 1 start; +led 2 load /usr/share/sonic/platform/led-code/ledcode2; +led 2 auto on; led 2 start diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml index 470b07922b9d..98c87eb8af0e 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml @@ -1,121 +1,121 @@ - - - - - - OCPSCH0104001MS - 10.10.1.30 - OCPSCH01040HHLF - 10.10.1.29 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.30 - OCPSCH01040HHLF - 10.10.2.29 - 1 - 10 - 3 - - - - - 64536 - OCPSCH01040HHLF - - -
10.10.1.30
- - -
- -
10.10.2.30
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.10/32 - - 100.0.0.10/32 - - - - - - - - OCPSCH01040HHLF - - - - - - Ethernet48 - 10.10.1.29/30 - - - - Ethernet52 - 10.10.2.29/30 - - - - - - - - - - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet48 - OCPSCH01040HHLF - Ethernet48 - - - 40000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet0 - OCPSCH01040HHLF - Ethernet52 - - - - - OCPSCH01040HHLF - INGRASYS-S8900-54XC - - - - OCPSCH01040HHLF - INGRASYS-S8900-54XC -
+ + + + + + OCPSCH0104001MS + 10.10.1.30 + OCPSCH01040HHLF + 10.10.1.29 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.30 + OCPSCH01040HHLF + 10.10.2.29 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040HHLF + + +
10.10.1.30
+ + +
+ +
10.10.2.30
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.10/32 + + 100.0.0.10/32 + + + + + + + + OCPSCH01040HHLF + + + + + + Ethernet48 + 10.10.1.29/30 + + + + Ethernet52 + 10.10.2.29/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet48 + OCPSCH01040HHLF + Ethernet48 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet0 + OCPSCH01040HHLF + Ethernet52 + + + + + OCPSCH01040HHLF + INGRASYS-S8900-54XC + + + + OCPSCH01040HHLF + INGRASYS-S8900-54XC +
diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml index fe96dc87acf6..8a7d765cefc1 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml @@ -1,359 +1,359 @@ - - - - - - BGPSession - OCPSCH0104001MS - 10.10.1.2 - OCPSCH01040AALF - 10.10.1.1 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.6 - OCPSCH01040BBLF - 10.10.1.5 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.10 - OCPSCH01040CCLF - 10.10.1.9 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.14 - OCPSCH01040DDLF - 10.10.1.13 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.18 - OCPSCH01040EELF - 10.10.1.17 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.22 - OCPSCH01040FFLF - 10.10.1.21 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.26 - OCPSCH01040GGLF - 10.10.1.25 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.30 - OCPSCH01040HHLF - 10.10.1.29 - 1 - 10 - 3 - - - - - 64542 - OCPSCH0104001MS - - - BGPPeer -
10.10.1.2
- - -
- - BGPPeer -
10.10.1.6
- - -
- - BGPPeer -
10.10.1.10
- - -
- - BGPPeer -
10.10.1.14
- - -
- - BGPPeer -
10.10.1.18
- - -
- - BGPPeer -
10.10.1.22
- - -
- - BGPPeer -
10.10.1.26
- - -
- - BGPPeer -
10.10.1.30
- - -
-
- -
- - 64536 - OCPSCH01040AALF - - - - 64536 - OCPSCH01040BBLF - - - - 64536 - OCPSCH01040CCLF - - - - 64536 - OCPSCH01040DDLF - - - - 64536 - OCPSCH01040EELF - - - - 64536 - OCPSCH01040FFLF - - - - 64536 - OCPSCH01040GGLF - - - - 64536 - OCPSCH01040HHLF - - -
-
- - - - - - LoopbackInterface - HostIP - Loopback0 - - 100.0.0.1/32 - - 100.0.0.1/32 - - - - - - - - OCPSCH0104001MS - - - - VlanInterface - Vlan851 - Ethernet0;Ethernet1;Ethernet2;Ethernet3;Ethernet96;Ethernet100;Ethernet104;Ethernet108 - False - 0.0.0.0/0 - - 851 - 10.20.1.0/24 - - - - - IPInterface - - Vlan851 - 10.20.1.1/24 - - - IPInterface - - Ethernet48 - 10.10.1.2/30 - - - IPInterface - - Ethernet52 - 10.10.1.6/30 - - - IPInterface - - Ethernet56 - 10.10.1.10/30 - - - IPInterface - - Ethernet60 - 10.10.1.14/30 - - - IPInterface - - Ethernet64 - 10.10.1.18/30 - - - IPInterface - - Ethernet68 - 10.10.1.22/30 - - - IPInterface - - Ethernet72 - 10.10.1.26/30 - - - IPInterface - - Ethernet76 - 10.10.1.30/30 - - - - - - - - - - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet48 - OCPSCH01040AALF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet52 - OCPSCH01040BBLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet56 - OCPSCH01040CCLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet60 - OCPSCH01040DDLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet64 - OCPSCH01040EELF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet68 - OCPSCH01040FFLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet72 - OCPSCH01040GGLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet76 - OCPSCH01040HHLF - Ethernet48 - - - - - OCPSCH0104001MS - INGRASYS-S8900-64XC - - - - - - - - OCPSCH0104001MS - INGRASYS-S8900-64XC -
+ + + + + + BGPSession + OCPSCH0104001MS + 10.10.1.2 + OCPSCH01040AALF + 10.10.1.1 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.6 + OCPSCH01040BBLF + 10.10.1.5 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.10 + OCPSCH01040CCLF + 10.10.1.9 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.14 + OCPSCH01040DDLF + 10.10.1.13 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.18 + OCPSCH01040EELF + 10.10.1.17 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.22 + OCPSCH01040FFLF + 10.10.1.21 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + BGPSession + OCPSCH0104001MS + 10.10.1.30 + OCPSCH01040HHLF + 10.10.1.29 + 1 + 10 + 3 + + + + + 64542 + OCPSCH0104001MS + + + BGPPeer +
10.10.1.2
+ + +
+ + BGPPeer +
10.10.1.6
+ + +
+ + BGPPeer +
10.10.1.10
+ + +
+ + BGPPeer +
10.10.1.14
+ + +
+ + BGPPeer +
10.10.1.18
+ + +
+ + BGPPeer +
10.10.1.22
+ + +
+ + BGPPeer +
10.10.1.26
+ + +
+ + BGPPeer +
10.10.1.30
+ + +
+
+ +
+ + 64536 + OCPSCH01040AALF + + + + 64536 + OCPSCH01040BBLF + + + + 64536 + OCPSCH01040CCLF + + + + 64536 + OCPSCH01040DDLF + + + + 64536 + OCPSCH01040EELF + + + + 64536 + OCPSCH01040FFLF + + + + 64536 + OCPSCH01040GGLF + + + + 64536 + OCPSCH01040HHLF + + +
+
+ + + + + + LoopbackInterface + HostIP + Loopback0 + + 100.0.0.1/32 + + 100.0.0.1/32 + + + + + + + + OCPSCH0104001MS + + + + VlanInterface + Vlan851 + Ethernet0;Ethernet1;Ethernet2;Ethernet3;Ethernet96;Ethernet100;Ethernet104;Ethernet108 + False + 0.0.0.0/0 + + 851 + 10.20.1.0/24 + + + + + IPInterface + + Vlan851 + 10.20.1.1/24 + + + IPInterface + + Ethernet48 + 10.10.1.2/30 + + + IPInterface + + Ethernet52 + 10.10.1.6/30 + + + IPInterface + + Ethernet56 + 10.10.1.10/30 + + + IPInterface + + Ethernet60 + 10.10.1.14/30 + + + IPInterface + + Ethernet64 + 10.10.1.18/30 + + + IPInterface + + Ethernet68 + 10.10.1.22/30 + + + IPInterface + + Ethernet72 + 10.10.1.26/30 + + + IPInterface + + Ethernet76 + 10.10.1.30/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet48 + OCPSCH01040AALF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet52 + OCPSCH01040BBLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet56 + OCPSCH01040CCLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet60 + OCPSCH01040DDLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet64 + OCPSCH01040EELF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet68 + OCPSCH01040FFLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet72 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet76 + OCPSCH01040HHLF + Ethernet48 + + + + + OCPSCH0104001MS + INGRASYS-S8900-64XC + + + + + + + + OCPSCH0104001MS + INGRASYS-S8900-64XC +
From 48f1a638cb669a4cd2f3f87f6d34ac527c740e84 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 5 Sep 2017 20:55:07 -0700 Subject: [PATCH 0759/1833] [sairedis]: revert deadlock fix in sonic-sairedis submodule (#934) The deadlock fix in sonic-sairedis introduce other race conditions which is more prevelant. --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 3f4afbbd9d7e..7e70b4d63020 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 3f4afbbd9d7ed2f077922e0cb0d59df743e34a9a +Subproject commit 7e70b4d63020fc9ea1aa009c264e4effab7bcda0 From 116ba4b180d6c8589123a73d5056628949a6a748 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 6 Sep 2017 20:07:32 -0700 Subject: [PATCH 0760/1833] [baseimage]: allocate varlog disk in the initramfs stage (#936) moving to initramfs unifies disk allocate on different platforms. use fallocate instead of dd to speed up the disk allocation. By default, mkfs.ext4 has -E discard option which discards the blocks at the mkfs time, also speed up the initialization time. --- build_debian.sh | 2 ++ files/initramfs-tools/arista-convertfs.j2 | 31 ++----------------- files/initramfs-tools/union-mount.j2 | 6 ++++ files/initramfs-tools/varlog | 36 +++++++++++++++++++++++ installer/x86_64/install.sh | 20 +------------ 5 files changed, 47 insertions(+), 48 deletions(-) create mode 100644 files/initramfs-tools/varlog diff --git a/build_debian.sh b/build_debian.sh index d7e7c3307536..21c370753592 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -132,6 +132,8 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista- ## 2. Bind-mount docker working directory (docker aufs cannot work over aufs rootfs) sudo cp files/initramfs-tools/union-mount $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/union-mount sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/union-mount +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 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 sudo chroot $FILESYSTEM_ROOT update-initramfs -u diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 81c6d9d1943f..75ce011e839a 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -82,28 +82,6 @@ run_cmd() { fi } -create_varlog_file() { - local err_msg="Error: create var-log ext4 file" - local cmd="[ -n "$varlog_size" ] && mkdir -p $root_mnt/disk-img && dd if=/dev/zero of=$root_mnt/disk-img/var-log.ext4 count=$((2048*$varlog_size)) && mke2fs -t ext4 -q -F $root_mnt/disk-img/var-log.ext4" - run_cmd "$cmd" "$err_msg" -} - -mount_and_create_varlog_file() { - [ -z "$varlog_size" ] && exit 0 - mkdir -p "$root_mnt" - mount -t ext4 "$root_dev" "$root_mnt" - # exit when the var_log.ext4 exists and the size matches - if [ -e "$root_mnt/disk-img/var-log.ext4" ]; then - cur_varlog_size=$(ls -l $root_mnt/disk-img/var-log.ext4 | awk '{print $5}') - if [ $cur_varlog_size == $((1024*1024*$varlog_size)) ]; then - exit 0 - fi - fi - create_varlog_file - umount "$root_mnt" - exit 0 -} - # Extract kernel parameters set -- $(cat /proc/cmdline) for x in "$@"; do @@ -114,9 +92,6 @@ for x in "$@"; do Aboot=*) aboot_flag="${x#Aboot=}" ;; - varlog_size=*) - varlog_size="${x#varlog_size=}" - ;; loop=*) x1="${x#loop=}" image_dir="${x1%/*}" @@ -135,8 +110,8 @@ if ! wait_for_root_dev; then exit 1 fi -# mount, create varlog file and exit when the root is ext4 -blkid | grep "$root_dev.*vfat" -q || mount_and_create_varlog_file +# exit when the root is ext4 +blkid | grep "$root_dev.*vfat" -q || exit 0 # Get flash dev name if [ -z "$block_flash" ]; then @@ -201,5 +176,3 @@ run_cmd "$cmd" "$err_msg" err_msg="Error: copying files form $tmp_mnt to $root_mnt failed" cmd="cp -a $tmp_mnt/. $root_mnt/" run_cmd "$cmd" "$err_msg" - -create_varlog_file diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index acc21e2885bc..db40d4f08601 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -1,6 +1,12 @@ #!/bin/sh -e + +PREREQS="varlog" + +prereqs() { echo "$PREREQS"; } + case $1 in prereqs) + prereqs exit 0 ;; esac diff --git a/files/initramfs-tools/varlog b/files/initramfs-tools/varlog new file mode 100644 index 000000000000..d1340eaa9d8b --- /dev/null +++ b/files/initramfs-tools/varlog @@ -0,0 +1,36 @@ +#!/bin/sh -e + +PREREQS="" + +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 + varlog_size=*) + varlog_size="${x#varlog_size=}" + esac +done + +[ -z "$varlog_size" ] && exit 0 + +# exit when the var_log.ext4 exists and the size matches +if [ -e "${rootmnt}/host/disk-img/var-log.ext4" ]; then + cur_varlog_size=$(ls -l ${rootmnt}/host/disk-img/var-log.ext4 | awk '{print $5}') + if [ $cur_varlog_size == $((1024*1024*$varlog_size)) ]; then + exit 0 + else + rm -rf ${rootmnt}/host/disk-img + fi +fi + +# create varlog disk +mkdir -p ${rootmnt}/host/disk-img && ${rootmnt}/usr/bin/fallocate -l "$varlog_size"M ${rootmnt}/host/disk-img/var-log.ext4 && mkfs.ext4 -q -F ${rootmnt}/host/disk-img/var-log.ext4 diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index ad1cc3691fbf..46942d6d58c3 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -450,24 +450,6 @@ TAR_EXTRA_OPTION="--numeric-owner" mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR -# Create loop device for /var/log to limit its size to $VAR_LOG_SIZE MB -if [ -f $demo_mnt/disk-img/var-log.ext4 ]; then - current_log_size_mb=$(ls -l --block-size=M $demo_mnt/disk-img/var-log.ext4 | cut -f5 -d" ") - if [ "$current_log_size_mb" = "$VAR_LOG_SIZE"M ]; then - echo "Log file system already exists. Size: ${VAR_LOG_SIZE}MB" - VAR_LOG_SIZE=0 - else - rm -rf $demo_mnt/disk-img - fi -fi - -if [ "$VAR_LOG_SIZE" != "0" ]; then - echo "Creating new log file system. Size: ${VAR_LOG_SIZE}MB" - mkdir -p $demo_mnt/disk-img - dd if=/dev/zero of=$demo_mnt/disk-img/var-log.ext4 count=$((2048*$VAR_LOG_SIZE)) - mkfs.ext4 -q $demo_mnt/disk-img/var-log.ext4 -F -fi - if [ "$install_env" = "onie" ]; then # Store machine description in target file system cp /etc/machine.conf $demo_mnt @@ -563,7 +545,7 @@ menuentry '$demo_grub_entry' { insmod ext2 linux /$image_dir/boot/vmlinuz-3.16.0-4-amd64 root=$demo_dev rw $GRUB_CMDLINE_LINUX \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ - apparmor=1 security=apparmor $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX + apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' initrd /$image_dir/boot/initrd.img-3.16.0-4-amd64 } From 38cd1d5368f626243d3455c102b07db9289dfd46 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 6 Sep 2017 20:08:25 -0700 Subject: [PATCH 0761/1833] [Broadcom]: Remove BRCM_OPENNSL library and upgrade BRCM_SAI to 3.0.3.2 (#938) This library will be archived in to BRCM_SAI library --- platform/broadcom/rules.mk | 4 ++-- platform/broadcom/sai.mk | 9 ++++----- platform/broadcom/sdk.mk | 6 +----- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 529919d63e0d..21af44775dd3 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -29,7 +29,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ $(DOCKER_FPM) # Inject brcm sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV) #$(LIBSAITHRIFT_DEV_BRCM) +$(LIBSAIREDIS)_DEPENDS += $(BRCM_SAI) $(BRCM_SAI_DEV) #$(LIBSAITHRIFT_DEV_BRCM) # Runtime dependency on brcm sai is set only for syncd -$(SYNCD)_RDEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) +$(SYNCD)_RDEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 54655563d638..60a1d1f15eb7 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,12 +1,11 @@ -BRCM_SAI = libsaibcm_3.0.2.3_amd64.deb +BRCM_SAI = libsaibcm_3.0.3.2_amd64.deb # TODO: upload new SAI build to blob -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.2.3_amd64.deb" +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2_amd64.deb" -BRCM_SAI_DEV = libsaibcm-dev_3.0.2.3_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) # TODO: upload new SAI build to blob -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.2.3_amd64.deb" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2_amd64.deb" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) -$(BRCM_SAI)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 5824590c8d52..76a7671599f2 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,9 +1,5 @@ -BRCM_OPENNSL = libopennsl_3.2.3.3_amd64.deb -# TODO: upload new SDK build to blob -$(BRCM_OPENNSL)_URL = "https://sonicstorage.blob.core.windows.net/packages/libopennsl_3.2.3.3_amd64.deb" - BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.3_amd64.deb # TODO: upload new SDK build to blob $(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3_amd64.deb" -SONIC_ONLINE_DEBS += $(BRCM_OPENNSL) $(BRCM_OPENNSL_KERNEL) +SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) From e418675ba5ca0c489a7f834fc462253b47a03180 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 7 Sep 2017 23:01:20 +0300 Subject: [PATCH 0762/1833] [rsyslog]: Use SONiC template in containers (#940) --- files/image_config/rsyslog/rsyslog.conf.j2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/files/image_config/rsyslog/rsyslog.conf.j2 b/files/image_config/rsyslog/rsyslog.conf.j2 index 54e2eec3f999..07d81de9348e 100644 --- a/files/image_config/rsyslog/rsyslog.conf.j2 +++ b/files/image_config/rsyslog/rsyslog.conf.j2 @@ -30,11 +30,6 @@ $UDPServerRun 514 ########################### #### GLOBAL DIRECTIVES #### ########################### -#Set remote syslog server -{% for server in syslog_servers %} -*.* @{{ server }}:514 -{% endfor %} - # # Use traditional timestamp format. # To enable high precision timestamps, comment out the following line. @@ -45,6 +40,11 @@ $UDPServerRun 514 $template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" $ActionFileDefaultTemplate SONiCFileFormat +#Set remote syslog server +{% for server in syslog_servers %} +*.* @{{ server }}:514;SONiCFileFormat +{% endfor %} + # # Set the default permissions for all log files. # From 211689ad292c53934ae9d2664c906af75865bc0f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 7 Sep 2017 14:02:17 -0700 Subject: [PATCH 0763/1833] [slave.mk]: Apply series of patches to SONIC_PYTHON_STDEB_DEBS targets if they exist (#941) --- slave.mk | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/slave.mk b/slave.mk index cc4a59a6d881..c44fe12642ac 100644 --- a/slave.mk +++ b/slave.mk @@ -179,13 +179,13 @@ SONIC_TARGET_LIST += $(addprefix $(FILES_PATH)/, $(SONIC_ONLINE_FILES)) # SONIC_MAKE_DEBS += $(SOME_NEW_DEB) $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(HEADER) - # remove target to force rebuild + # Remove target to force rebuild rm -f $(addprefix $(DEBS_PATH)/, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) - # apply series of patches if exist + # Apply series of patches if exist if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi - # build project and take package + # Build project and take package make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG) - # clean up + # Clean up if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi $(FOOTER) @@ -199,16 +199,18 @@ SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) # SONIC_DPKG_DEBS += $(SOME_NEW_DEB) $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(HEADER) - # Build project and take package + # Remove old build logs if they exist rm -f $($*_SRC_PATH)/debian/*.debhelper.log - # apply series of patches if exist + # Apply series of patches if exist if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi + # Build project pushd $($*_SRC_PATH) $(LOG) [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) popd $(LOG) - # clean up + # Clean up if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi + # Take built package(s) mv $(addprefix $($*_SRC_PATH)/../, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) $(DEBS_PATH) $(LOG) $(FOOTER) @@ -222,10 +224,15 @@ SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) # SONIC_PYTHON_STDEB_DEBS += $(SOME_NEW_DEB) $(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) $(HEADER) - # Build project and take package + # Apply series of patches if exist + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi + # Build project pushd $($*_SRC_PATH) $(LOG) python setup.py --command-packages=stdeb.command bdist_deb $(LOG) popd $(LOG) + # Clean up + if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi + # Take built package(s) mv $(addprefix $($*_SRC_PATH)/deb_dist/, $* $($*_DERIVED_DEBS)) $(DEBS_PATH) $(LOG) $(FOOTER) @@ -374,7 +381,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA # targets for building installers with base image $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) $(HEADER) - ## Pass initramfs and linux kernel explicitly. They are used for all platforms + # Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" export linux_kernel="$(DEBS_PATH)/$(LINUX_KERNEL)" export kversion="$(KVERSION)" From 5098d98976b4173fd3ce492d8a0c1179ccf787aa Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 8 Sep 2017 08:26:30 -0700 Subject: [PATCH 0764/1833] [dell]: remove nos_to_sonic_grub.cfg (#943) no longer needed in the build image --- build_image.sh | 4 -- .../nos_to_sonic_grub.cfg | 44 ------------------- .../nos_to_sonic_grub.cfg | 44 ------------------- 3 files changed, 92 deletions(-) delete mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg delete mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg diff --git a/build_image.sh b/build_image.sh index 2d229c2d194b..ee7fb8a75823 100755 --- a/build_image.sh +++ b/build_image.sh @@ -25,10 +25,6 @@ generate_onie_installer_image() cp ./device/$VENDOR/$PLATFORM/installer.conf ./installer/x86_64/platforms/$PLATFORM fi - if [ "$IMAGE_TYPE" = "raw" ] && [ -f ./device/$VENDOR/$PLATFORM/nos_to_sonic_grub.cfg ]; then - sed -i -e "s/%%IMAGE_VERSION%%/$IMAGE_VERSION/g" ./device/$VENDOR/$PLATFORM/nos_to_sonic_grub.cfg - echo "IMAGE_VERSION is $IMAGE_VERSION" - fi done done diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg b/device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg deleted file mode 100644 index 058b1a9ea118..000000000000 --- a/device/dell/x86_64-dell_s6100_c2538-r0/nos_to_sonic_grub.cfg +++ /dev/null @@ -1,44 +0,0 @@ -# -# Grub config to launch SONiC -# with ONIE boot option - -insmod serial -# Initialize USB-Serial com2 port -serial --unit=1 --speed=9600 -#Serial port config;Defaults: COM1,9600 -serial --unit=0 --speed=9600 -terminal_output serial_com0 -terminal_input serial_com0 -#terminfo added to prevent text wrap issue. -terminfo -g 80x100 serial_com0 -terminfo -g 80x100 serial_com1 - -echo -n "Press Esc to stop autoboot ... " -if sleep --verbose --interruptible 5 ; then - insmod gzio - insmod part_msdos - insmod ext2 - set root='(hd0,gpt8)' - linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor - initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 - boot -else - menuentry 'SONiC' { - insmod gzio - insmod part_msdos - insmod ext2 - set root='(hd0,gpt8)' - linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor - initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 - boot - } - - menuentry 'ONIE' { - insmod force10 - onieboot - } - - menuentry 'DELL-DIAG' { - delldiagboot - } -fi diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg b/device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg deleted file mode 100644 index 058b1a9ea118..000000000000 --- a/device/dell/x86_64-dell_z9100_c2538-r0/nos_to_sonic_grub.cfg +++ /dev/null @@ -1,44 +0,0 @@ -# -# Grub config to launch SONiC -# with ONIE boot option - -insmod serial -# Initialize USB-Serial com2 port -serial --unit=1 --speed=9600 -#Serial port config;Defaults: COM1,9600 -serial --unit=0 --speed=9600 -terminal_output serial_com0 -terminal_input serial_com0 -#terminfo added to prevent text wrap issue. -terminfo -g 80x100 serial_com0 -terminfo -g 80x100 serial_com1 - -echo -n "Press Esc to stop autoboot ... " -if sleep --verbose --interruptible 5 ; then - insmod gzio - insmod part_msdos - insmod ext2 - set root='(hd0,gpt8)' - linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor - initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 - boot -else - menuentry 'SONiC' { - insmod gzio - insmod part_msdos - insmod ext2 - set root='(hd0,gpt8)' - linux /image-%%IMAGE_VERSION%%/boot/vmlinuz-3.16.0-4-amd64 root=/dev/sda8 rw console=tty0 console=ttyS1,9600n8 loop=image-%%IMAGE_VERSION%%/fs.squashfs loopfstype=squashfs apparmor=1 security=apparmor - initrd /image-%%IMAGE_VERSION%%/boot/initrd.img-3.16.0-4-amd64 - boot - } - - menuentry 'ONIE' { - insmod force10 - onieboot - } - - menuentry 'DELL-DIAG' { - delldiagboot - } -fi From 8f1ac5d5ecbc1d95cd617575edc6efcb14f86e25 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Sat, 9 Sep 2017 04:25:25 +0300 Subject: [PATCH 0765/1833] [rsyslog]: Use timegenerated instead of timestamp (#944) * [rsyslog]: Use timegenerated instead of timestamp This is useful when rsyslog is used to put markers generated on other machines. This way all messages will have a timestamp from a single system. * [rsyslog] Use subseconds from local machine --- files/image_config/rsyslog/rsyslog.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/rsyslog/rsyslog.conf.j2 b/files/image_config/rsyslog/rsyslog.conf.j2 index 07d81de9348e..264ddd8dd7bf 100644 --- a/files/image_config/rsyslog/rsyslog.conf.j2 +++ b/files/image_config/rsyslog/rsyslog.conf.j2 @@ -37,7 +37,7 @@ $UDPServerRun 514 #$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat # Define a custom template -$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" +$template SONiCFileFormat,"%timegenerated%.%timegenerated:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" $ActionFileDefaultTemplate SONiCFileFormat #Set remote syslog server From 2cd2f95384fc8662f89b5ed408ce843b37c0212a Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 8 Sep 2017 21:27:15 -0700 Subject: [PATCH 0766/1833] [github]: add templates for submitting issues and PR (#947) --- .github/ISSUE_TEMPLATE.md | 60 ++++++++++++++++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 26 ++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000000..05f39760b195 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,60 @@ + + +**Description** + + + +**Steps to reproduce the issue:** +1. +2. +3. + +**Describe the results you received:** + + +**Describe the results you expected:** + + +**Additional information you deem important (e.g. issue happens only occasionally):** + + **Output of `show version`:** + + ``` + (paste your output here) + ``` + + **Attach debug file `sudo generate_dump`:** + + ``` + (paste your output here) + ``` diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000000..2ac7d9e47730 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,26 @@ + + +**- What I did** + +**- How I did it** + +**- How to verify it** + +**- Description for the changelog** + + + +**- A picture of a cute animal (not mandatory but encouraged)** From d3997f4a356d0669bccbd96cd12c191fecfe0212 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 9 Sep 2017 15:22:52 -0700 Subject: [PATCH 0767/1833] [sonic-slave]: SLAVE_TAG should be for both Dockerfile and Dockerfile.user (#950) Should rebuild both Dockerfile and Dockerfile.user when any of the two files change. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d779c30718dc..7240237c2744 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ $(shell rm -f .screen) MAKEFLAGS += -B SLAVE_BASE_TAG = $(shell shasum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') -SLAVE_TAG = $(shell shasum sonic-slave/Dockerfile.user | awk '{print substr($$1,0,11);}') +SLAVE_TAG = $(shell cat sonic-slave/Dockerfile.user sonic-slave/Dockerfile | shasum | awk '{print substr($$1,0,11);}') SLAVE_BASE_IMAGE = sonic-slave-base SLAVE_IMAGE = sonic-slave-$(USER) From bc730829225226eb6c9526a263321750a9ac30af Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Mon, 11 Sep 2017 15:29:42 -0700 Subject: [PATCH 0768/1833] [devices]: Add led plugin for Arista 7060CX-32S and 7260CX3-64 (#945) * Bump sonic-platform-modules-arista submodule * Allow image specific mount option for containers * Add led plugin for DCS-7060CX-32S * Add led plugin for DCS-7260CX3-64 --- .../arista/x86_64-arista_7060_cx32s/plugins/led_control.py | 6 ++++++ .../arista/x86_64-arista_7260cx3_64/plugins/led_control.py | 6 ++++++ platform/broadcom/sonic-platform-modules-arista | 2 +- rules/docker-platform-monitor.mk | 3 +++ slave.mk | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 device/arista/x86_64-arista_7060_cx32s/plugins/led_control.py create mode 100644 device/arista/x86_64-arista_7260cx3_64/plugins/led_control.py diff --git a/device/arista/x86_64-arista_7060_cx32s/plugins/led_control.py b/device/arista/x86_64-arista_7060_cx32s/plugins/led_control.py new file mode 100644 index 000000000000..8d387e513c6c --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/plugins/led_control.py @@ -0,0 +1,6 @@ +try: + import arista.utils.sonic_leds as arista_leds +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +LedControl = arista_leds.getLedControl() diff --git a/device/arista/x86_64-arista_7260cx3_64/plugins/led_control.py b/device/arista/x86_64-arista_7260cx3_64/plugins/led_control.py new file mode 100644 index 000000000000..8d387e513c6c --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/plugins/led_control.py @@ -0,0 +1,6 @@ +try: + import arista.utils.sonic_leds as arista_leds +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +LedControl = arista_leds.getLedControl() diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 4ad9358d16b8..d1417bff1778 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 4ad9358d16b8cd0b57d5922353f38055f83042e4 +Subproject commit d1417bff17780255d4cc371b315f620087673eb8 diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 39f8cdd3f297..76e7dac4ab63 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -12,4 +12,7 @@ $(DOCKER_PLATFORM_MONITOR)_CONTAINER_NAME = pmon $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += --net=host --privileged -t $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +# Mount Arista python library on Aboot images to be used by plugins +$(DOCKER_PLATFORM_MONITOR)_aboot_RUN_OPT += -v /usr/lib/python2.7/dist-packages/arista:/usr/lib/python2.7/dist-packages/arista:ro + $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += sensors:/usr/bin/sensors diff --git a/slave.mk b/slave.mk index c44fe12642ac..caed4279dcc3 100644 --- a/slave.mk +++ b/slave.mk @@ -400,6 +400,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export docker_image="$(docker)" export docker_image_name="$(basename $(docker))" export docker_container_name="$($(docker)_CONTAINER_NAME)" + $(eval $(docker)_RUN_OPT += $($(docker)_$($*_IMAGE_TYPE)_RUN_OPT)) export docker_image_run_opt="$($(docker)_RUN_OPT)" j2 files/build_templates/docker_image_ctl.j2 > $($(docker)_CONTAINER_NAME).sh if [ -f files/build_templates/$($(docker)_CONTAINER_NAME).service.j2 ]; then From c9cc7aea41f9d6864ee606f3eae9209f70193d61 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 12 Sep 2017 14:13:27 -0700 Subject: [PATCH 0769/1833] [configdb] Migrate minigraph configurations to DB (#942) Modify minigraph parser output format so it fit DB schema Modify configuration templates to fit new schema Systemd services dependencies are modified so database starts before any configuration consumer --- dockers/docker-dhcp-relay/Dockerfile.j2 | 1 + dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 20 +- dockers/docker-dhcp-relay/start.sh | 34 +-- dockers/docker-dhcp-relay/wait_for_intf.sh.j2 | 28 ++ dockers/docker-fpm-frr/bgpd.conf.j2 | 28 +- dockers/docker-fpm-frr/config.sh | 8 +- dockers/docker-fpm-frr/zebra.conf.j2 | 40 +-- dockers/docker-fpm-gobgp/gobgpd.conf.j2 | 2 +- dockers/docker-fpm-gobgp/start.sh | 8 +- dockers/docker-fpm-gobgp/zebra.conf.j2 | 40 +-- dockers/docker-fpm-quagga/bgpd.conf.j2 | 40 +-- dockers/docker-fpm-quagga/zebra.conf.j2 | 40 +-- dockers/docker-lldp-sv2/lldpd.conf.j2 | 6 +- dockers/docker-lldp-sv2/start.sh | 2 +- dockers/docker-orchagent/arp_update | 2 +- dockers/docker-orchagent/ipinip.json.j2 | 4 +- dockers/docker-orchagent/mirror.json.j2 | 13 +- dockers/docker-orchagent/orchagent.sh | 2 +- dockers/docker-orchagent/ports.json.j2 | 10 +- dockers/docker-orchagent/start.sh | 10 +- dockers/docker-orchagent/swssconfig.sh | 2 +- dockers/docker-snmp-sv2/alias_map.j2 | 4 +- dockers/docker-snmp-sv2/snmpd.conf.j2 | 16 +- dockers/docker-snmp-sv2/start.sh | 6 +- dockers/docker-snmp-sv2/sysDescription.j2 | 2 +- dockers/docker-teamd/start.sh | 4 +- dockers/docker-teamd/teamd.j2 | 4 +- files/build_templates/docker_image_ctl.j2 | 14 +- files/build_templates/swss.service.j2 | 1 + .../interfaces/interfaces-config.service | 3 +- .../interfaces/interfaces-config.sh | 2 +- files/image_config/interfaces/interfaces.j2 | 88 +++--- files/image_config/ntp/ntp-config.service | 2 + files/image_config/ntp/ntp-config.sh | 2 +- files/image_config/ntp/ntp.conf.j2 | 6 +- .../rsyslog/rsyslog-config.service | 2 + files/image_config/rsyslog/rsyslog-config.sh | 2 +- files/image_config/rsyslog/rsyslog.conf.j2 | 2 +- .../updategraph/updategraph.service | 4 +- src/sonic-config-engine/minigraph.py | 255 ++++++------------ src/sonic-config-engine/sonic-cfggen | 50 +++- .../tests/sample_output/interfaces | 10 + .../tests/sample_output/mirror.json | 2 +- src/sonic-config-engine/tests/test_cfggen.py | 48 ++-- src/sonic-config-engine/tests/test_j2files.py | 4 +- src/sonic-config-engine/translate_acl | 17 +- src/sonic-py-swsssdk | 2 +- 47 files changed, 461 insertions(+), 431 deletions(-) create mode 100755 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index a7e1a1cffb9d..3c6614c4921f 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -25,5 +25,6 @@ RUN rm -rf /debs COPY ["start.sh", "isc-dhcp-relay.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["isc-dhcp-relay.j2", "/usr/share/sonic/templates/"] +COPY ["wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 index 1c50b685ebda..cdedfcf9692b 100644 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -1,25 +1,25 @@ -SERVERS="{{ dhcp_servers | join(' ') }}" +SERVERS="{{ DHCP_SERVER | join(' ') }}" INTERFACES=" {%- set add_preceding_space = { 'flag': False } %} -{%- for interface in minigraph_interfaces %} -{%- if interface['addr'] | ipv4 %} +{%- for (name, prefix) in INTERFACE %} +{%- if prefix | ipv4 %} {%- if add_preceding_space.flag %} {% endif %} -{{ interface['attachto'] }} +{{ name }} {%- set _dummy = add_preceding_space.update({'flag': True}) %} {%- endif %} {%- endfor %} -{%- for vlan_interface in minigraph_vlan_interfaces %} -{%- if vlan_interface['addr'] | ipv4 %} +{%- for (name, prefix) in VLAN_INTERFACE %} +{%- if prefix | ipv4 %} {%- if add_preceding_space.flag %} {% endif %} -{{ vlan_interface['attachto'] }} +{{ name }} {%- set _dummy = add_preceding_space.update({'flag': True}) %} {%- endif %} {%- endfor %} -{%- for pc_interface in minigraph_portchannel_interfaces %} -{%- if pc_interface['addr'] | ipv4 %} +{%- for (name, prefix) in PORTCHANNEL_INTERFACE %} +{%- if prefix | ipv4 %} {%- if add_preceding_space.flag %} {% endif %} -{{ pc_interface['attachto'] }} +{{ name }} {%- set _dummy = add_preceding_space.update({'flag': True}) %} {%- endif %} {%- endfor %}" diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index 5c2e9de09703..37c3f488a5c7 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -1,42 +1,16 @@ #!/usr/bin/env bash -function wait_until_iface_exists -{ - IFACE=$1 - - echo "Waiting for interface ${IFACE}..." - - # Wait for the interface to come up (i.e., 'ip link show' returns 0) - until ip link show $IFACE > /dev/null 2>&1; do - sleep 1 - done - - echo "Interface ${IFACE} is created" -} - # Create isc-dhcp-relay config file -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay +sonic-cfggen -d -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd # Wait for all interfaces to come up before starting the DHCP relay - -FRONT_PANEL_IFACES=$(sonic-cfggen -m /etc/sonic/minigraph.xml --var-json "minigraph_interfaces" | grep "\"attachto\":" | sed 's/^\s*"attachto":\s"\(.*\)".*$/\1/') -for IFACE in $FRONT_PANEL_IFACES; do - wait_until_iface_exists $IFACE -done - -VLAN_IFACES=$(sonic-cfggen -m /etc/sonic/minigraph.xml --var-json "minigraph_vlan_interfaces" | grep "\"attachto\":" | sed 's/^\s*"attachto":\s"\(.*\)".*$/\1/') -for IFACE in $VLAN_IFACES; do - wait_until_iface_exists $IFACE -done - -PORTCHANNEL_IFACES=$(sonic-cfggen -m /etc/sonic/minigraph.xml --var-json "minigraph_portchannel_interfaces" | grep "\"attachto\":" | sed 's/^\s*"attachto":\s"\(.*\)".*$/\1/') -for IFACE in $PORTCHANNEL_IFACES; do - wait_until_iface_exists $IFACE -done +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 +/usr/bin/wait_for_intf.sh # Start the DHCP relay supervisorctl start isc-dhcp-relay diff --git a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 new file mode 100755 index 000000000000..b859a43b07b1 --- /dev/null +++ b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +function wait_until_iface_exists +{ + IFACE=$1 + + echo "Waiting for interface ${IFACE}..." + + # Wait for the interface to come up (i.e., 'ip link show' returns 0) + until ip link show $IFACE > /dev/null 2>&1; do + sleep 1 + done + + echo "Interface ${IFACE} is created" +} + + +# Wait for all interfaces to come up before starting the DHCP relay +{% for (name, prefix) in INTERFACE %} +wait_until_iface_exists {{ name }} +{% endfor %} +{% for (name, prefix) in VLAN_INTERFACE %} +wait_until_iface_exists {{ name }} +{% endfor %} +{% for (name, prefix) in PORTCHANNEL_INTERFACE %} +wait_until_iface_exists {{ name }} +{% endfor %} + diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index c66d5bfb232f..0f1e255b5cd1 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -1,13 +1,13 @@ ! {% block banner %} ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/bgpd.conf.j2 using minigraph_facts.py +! generated by templates/quagga/bgpd.conf.j2 with config DB data ! file: bgpd.conf ! {% endblock banner %} ! {% block system_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra log syslog informational log facility local4 @@ -23,25 +23,25 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp bestpath as-path multipath-relax no bgp default ipv4-unicast {# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} - bgp router-id {{ minigraph_lo_interfaces[0]['addr'] }} + bgp router-id {{ LOOPBACK_INTERFACE.keys()[0][1] }} {# advertise loopback #} -{% for lo in minigraph_lo_interfaces %} -{% if lo['addr'] | ipv4 %} - network {{ lo['addr'] }}/32 -{% elif lo['addr'] | ipv6 %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv4 %} + network {{ prefix | ip }}/32 +{% elif prefix | ipv6 %} address-family ipv6 - network {{ lo['addr'] }}/128 + network {{ prefix | ip }}/128 exit-address-family {% endif %} {% endfor %} {% endblock bgp_init %} {% block vlan_advertisement %} -{% for vlan_interface in minigraph_vlan_interfaces %} -{% if vlan_interface['addr'] | ipv4 %} - network {{ vlan_interface['subnet'] }} -{% elif vlan_interface['addr'] | ipv6 %} +{% for (name, prefix) in VLAN_INTERFACE %} +{% if prefix | ipv4 %} + network {{ prefix }} +{% elif prefix | ipv6 %} address-family ipv6 - network {{ vlan_interface['subnet'] }} + network {{ prefix }} exit-address-family {% endif %} {% endfor %} @@ -51,7 +51,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% if bgp_session['asn'] != 0 %} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} {% if neighbor_addr | ipv4 %} diff --git a/dockers/docker-fpm-frr/config.sh b/dockers/docker-fpm-frr/config.sh index 0636a6dc413c..ef7a13a214f4 100755 --- a/dockers/docker-fpm-frr/config.sh +++ b/dockers/docker-fpm-frr/config.sh @@ -1,14 +1,14 @@ #!/bin/bash mkdir -p /etc/frr -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/frr/bgpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/frr/zebra.conf +sonic-cfggen -d -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/frr/bgpd.conf +sonic-cfggen -d -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/frr/zebra.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate +sonic-cfggen -d -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate chown root:root /usr/sbin/bgp-isolate chmod 0755 /usr/sbin/bgp-isolate -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate +sonic-cfggen -d -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisolate chown root:root /usr/sbin/bgp-unisolate chmod 0755 /usr/sbin/bgp-unisolate diff --git a/dockers/docker-fpm-frr/zebra.conf.j2 b/dockers/docker-fpm-frr/zebra.conf.j2 index 1ce06eecd2d9..8b967f98671c 100644 --- a/dockers/docker-fpm-frr/zebra.conf.j2 +++ b/dockers/docker-fpm-frr/zebra.conf.j2 @@ -1,26 +1,26 @@ ! {% block banner %} ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/zebra.conf.j2 using minigraph_facts.py +! generated by templates/quagga/zebra.conf.j2 using config DB data ! file: zebra.conf ! {% endblock banner %} ! {% block sys_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra enable password zebra {% endblock sys_init %} ! {% block interfaces %} ! Enable link-detect (default disabled) -{% for interface in minigraph_interfaces %} -interface {{ interface['attachto'] }} +{% for (name, prefix) in INTERFACE %} +interface {{ name }} link-detect ! {% endfor %} -{% for interface in minigraph_portchannels.keys() %} -interface {{ interface }} +{% for pc in PORTCHANNEL %} +interface {{ pc }} link-detect ! {% endfor %} @@ -28,26 +28,34 @@ link-detect ! {% block default_route %} ! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 {{ minigraph_mgmt_interface['gwaddr'] }} 200 +{% for (name, prefix) in MGMT_INTERFACE %} +{% if prefix | ipv4 %} +ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 +{% endif %} +{% endfor %} {% endblock default_route %} ! {% block source_loopback %} -! Set ip source to loopback for bgp learned routes -route-map RM_SET_SRC permit 10 - set src {{ minigraph_lo_interfaces[0]['addr'] }} -! +{% set lo_ipv4_addrs = [] %} {% set lo_ipv6_addrs = [] %} -{% if minigraph_lo_interfaces is defined %} -{% for interface in minigraph_lo_interfaces %} -{% if interface['addr'] is defined and interface['addr']|ipv6 %} -{% if lo_ipv6_addrs.append(interface['addr']) %} +{% if LOOPBACK_INTERFACE %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv6 %} +{% if lo_ipv6_addrs.append(prefix) %} +{% endif %} +{% else %} +{% if lo_ipv4_addrs.append(prefix) %} {% endif %} {% endif %} {% endfor %} {% endif %} +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src {{ lo_ipv4_addrs[0] | ip }} +! {% if lo_ipv6_addrs|length > 0 %} route-map RM_SET_SRC6 permit 10 - set src {{ lo_ipv6_addrs[0] }} + set src {{ lo_ipv6_addrs[0] | ip }} ! {% endif %} ip protocol bgp route-map RM_SET_SRC diff --git a/dockers/docker-fpm-gobgp/gobgpd.conf.j2 b/dockers/docker-fpm-gobgp/gobgpd.conf.j2 index c6ec7a4fd166..c51c10563b59 100644 --- a/dockers/docker-fpm-gobgp/gobgpd.conf.j2 +++ b/dockers/docker-fpm-gobgp/gobgpd.conf.j2 @@ -1,6 +1,6 @@ [global.config] as = {{ DEVICE_METADATA['localhost']['bgp_asn'] }} - router-id = "{{ minigraph_lo_interfaces[0]['addr'] }}" + router-id = "{{ LOOPBACK_INTERFACE.keys()[0][1] }}" {% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} {% if bgp_session['asn'] != 0 %} [[neighbors]] diff --git a/dockers/docker-fpm-gobgp/start.sh b/dockers/docker-fpm-gobgp/start.sh index 636fceea0cbd..83afbda4f736 100755 --- a/dockers/docker-fpm-gobgp/start.sh +++ b/dockers/docker-fpm-gobgp/start.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash mkdir -p /etc/quagga -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/gobgpd.conf.j2 > /etc/gobgp/gobgpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf +sonic-cfggen -d -t /usr/share/sonic/templates/gobgpd.conf.j2 > /etc/gobgp/gobgpd.conf +sonic-cfggen -d -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate +sonic-cfggen -d -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate chown root:root /usr/sbin/bgp-isolate chmod 0755 /usr/sbin/bgp-isolate -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate +sonic-cfggen -d -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate chown root:root /usr/sbin/bgp-unisolate chmod 0755 /usr/sbin/bgp-unisolate diff --git a/dockers/docker-fpm-gobgp/zebra.conf.j2 b/dockers/docker-fpm-gobgp/zebra.conf.j2 index 1ce06eecd2d9..8b967f98671c 100644 --- a/dockers/docker-fpm-gobgp/zebra.conf.j2 +++ b/dockers/docker-fpm-gobgp/zebra.conf.j2 @@ -1,26 +1,26 @@ ! {% block banner %} ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/zebra.conf.j2 using minigraph_facts.py +! generated by templates/quagga/zebra.conf.j2 using config DB data ! file: zebra.conf ! {% endblock banner %} ! {% block sys_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra enable password zebra {% endblock sys_init %} ! {% block interfaces %} ! Enable link-detect (default disabled) -{% for interface in minigraph_interfaces %} -interface {{ interface['attachto'] }} +{% for (name, prefix) in INTERFACE %} +interface {{ name }} link-detect ! {% endfor %} -{% for interface in minigraph_portchannels.keys() %} -interface {{ interface }} +{% for pc in PORTCHANNEL %} +interface {{ pc }} link-detect ! {% endfor %} @@ -28,26 +28,34 @@ link-detect ! {% block default_route %} ! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 {{ minigraph_mgmt_interface['gwaddr'] }} 200 +{% for (name, prefix) in MGMT_INTERFACE %} +{% if prefix | ipv4 %} +ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 +{% endif %} +{% endfor %} {% endblock default_route %} ! {% block source_loopback %} -! Set ip source to loopback for bgp learned routes -route-map RM_SET_SRC permit 10 - set src {{ minigraph_lo_interfaces[0]['addr'] }} -! +{% set lo_ipv4_addrs = [] %} {% set lo_ipv6_addrs = [] %} -{% if minigraph_lo_interfaces is defined %} -{% for interface in minigraph_lo_interfaces %} -{% if interface['addr'] is defined and interface['addr']|ipv6 %} -{% if lo_ipv6_addrs.append(interface['addr']) %} +{% if LOOPBACK_INTERFACE %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv6 %} +{% if lo_ipv6_addrs.append(prefix) %} +{% endif %} +{% else %} +{% if lo_ipv4_addrs.append(prefix) %} {% endif %} {% endif %} {% endfor %} {% endif %} +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src {{ lo_ipv4_addrs[0] | ip }} +! {% if lo_ipv6_addrs|length > 0 %} route-map RM_SET_SRC6 permit 10 - set src {{ lo_ipv6_addrs[0] }} + set src {{ lo_ipv6_addrs[0] | ip }} ! {% endif %} ip protocol bgp route-map RM_SET_SRC diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index 02cf40fa8b47..295cb2563aff 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -1,13 +1,13 @@ ! {% block banner %} ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/bgpd.conf.j2 using minigraph_facts.py +! generated by templates/quagga/bgpd.conf.j2 with config DB data ! file: bgpd.conf ! {% endblock banner %} ! {% block system_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra log syslog informational log facility local4 @@ -28,30 +28,34 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp bestpath as-path multipath-relax no bgp default ipv4-unicast {# Advertise graceful restart capability for ToR #} -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} bgp graceful-restart {% endif %} -{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} - bgp router-id {{ minigraph_lo_interfaces[0]['addr'] }} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{# TODO: use v4 lo for backward compatibility, will revisit the case with multiple lo interfaces #} +{% if prefix | ipv4 %} + bgp router-id {{ prefix | ip }} +{% endif %} +{% endfor %} {# advertise loopback #} -{% for lo in minigraph_lo_interfaces %} -{% if lo['addr'] | ipv4 %} - network {{ lo['addr'] }}/32 -{% elif lo['addr'] | ipv6 %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv4 %} + network {{ prefix | ip }}/32 +{% elif prefix | ipv6 %} address-family ipv6 - network {{ lo['addr'] }}/128 + network {{ prefix | ip }}/128 exit-address-family {% endif %} {% endfor %} {% endblock bgp_init %} {% endif %} {% block vlan_advertisement %} -{% for vlan_interface in minigraph_vlan_interfaces %} -{% if vlan_interface['addr'] | ipv4 %} - network {{ vlan_interface['subnet'] }} -{% elif vlan_interface['addr'] | ipv6 %} +{% for (name, prefix) in VLAN_INTERFACE %} +{% if prefix | ipv4 %} + network {{ prefix }} +{% elif prefix | ipv6 %} address-family ipv6 - network {{ vlan_interface['subnet'] }} + network {{ prefix }} exit-address-family {% endif %} {% endfor %} @@ -66,7 +70,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endif %} {% if neighbor_addr | ipv4 %} address-family ipv4 -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} neighbor {{ neighbor_addr }} activate @@ -75,7 +79,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endif %} {% if neighbor_addr | ipv6 %} address-family ipv6 -{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} neighbor {{ neighbor_addr }} activate @@ -86,6 +90,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endfor %} {% endblock bgp_sessions %} {% block bgp_peers_with_range %} +{% if BGP_PEER_RANGE %} {% for bgp_peer in BGP_PEER_RANGE.values() %} neighbor {{ bgp_peer['name'] }} peer-group neighbor {{ bgp_peer['name'] }} passive @@ -107,6 +112,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} maximum-paths 64 exit-address-family {% endfor %} +{% endif %} {% endblock bgp_peers_with_range %} ! {% if DEVICE_METADATA['localhost'].has_key('bgp_asn') %} diff --git a/dockers/docker-fpm-quagga/zebra.conf.j2 b/dockers/docker-fpm-quagga/zebra.conf.j2 index 1ce06eecd2d9..8b967f98671c 100644 --- a/dockers/docker-fpm-quagga/zebra.conf.j2 +++ b/dockers/docker-fpm-quagga/zebra.conf.j2 @@ -1,26 +1,26 @@ ! {% block banner %} ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/zebra.conf.j2 using minigraph_facts.py +! generated by templates/quagga/zebra.conf.j2 using config DB data ! file: zebra.conf ! {% endblock banner %} ! {% block sys_init %} -hostname {{ inventory_hostname }} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra enable password zebra {% endblock sys_init %} ! {% block interfaces %} ! Enable link-detect (default disabled) -{% for interface in minigraph_interfaces %} -interface {{ interface['attachto'] }} +{% for (name, prefix) in INTERFACE %} +interface {{ name }} link-detect ! {% endfor %} -{% for interface in minigraph_portchannels.keys() %} -interface {{ interface }} +{% for pc in PORTCHANNEL %} +interface {{ pc }} link-detect ! {% endfor %} @@ -28,26 +28,34 @@ link-detect ! {% block default_route %} ! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 {{ minigraph_mgmt_interface['gwaddr'] }} 200 +{% for (name, prefix) in MGMT_INTERFACE %} +{% if prefix | ipv4 %} +ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 +{% endif %} +{% endfor %} {% endblock default_route %} ! {% block source_loopback %} -! Set ip source to loopback for bgp learned routes -route-map RM_SET_SRC permit 10 - set src {{ minigraph_lo_interfaces[0]['addr'] }} -! +{% set lo_ipv4_addrs = [] %} {% set lo_ipv6_addrs = [] %} -{% if minigraph_lo_interfaces is defined %} -{% for interface in minigraph_lo_interfaces %} -{% if interface['addr'] is defined and interface['addr']|ipv6 %} -{% if lo_ipv6_addrs.append(interface['addr']) %} +{% if LOOPBACK_INTERFACE %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv6 %} +{% if lo_ipv6_addrs.append(prefix) %} +{% endif %} +{% else %} +{% if lo_ipv4_addrs.append(prefix) %} {% endif %} {% endif %} {% endfor %} {% endif %} +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src {{ lo_ipv4_addrs[0] | ip }} +! {% if lo_ipv6_addrs|length > 0 %} route-map RM_SET_SRC6 permit 10 - set src {{ lo_ipv6_addrs[0] }} + set src {{ lo_ipv6_addrs[0] | ip }} ! {% endif %} ip protocol bgp route-map RM_SET_SRC diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index 4cfe48065e11..ffbf7e6993e9 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,5 +1,3 @@ -{% for member in minigraph_ports.keys() %} -{% if member in minigraph_neighbors %} -configure ports {{ member }} lldp portidsubtype local {{ minigraph_ports[member]['alias'] }} description {{ minigraph_neighbors[member]['name'] }}:{{ minigraph_neighbors[member]['port'] }} -{% endif %} +{% for neighbor in DEVICE_NEIGHBOR %} +configure ports {{ DEVICE_NEIGHBOR[neighbor]['local_port'] }} lldp portidsubtype local {{ PORT[DEVICE_NEIGHBOR[neighbor]['local_port']]['alias'] }} description {{ neighbor }}:{{ DEVICE_NEIGHBOR[neighbor]['port'] }} {% endfor %} diff --git a/dockers/docker-lldp-sv2/start.sh b/dockers/docker-lldp-sv2/start.sh index 63c8d32c34e6..3a765c6f5482 100755 --- a/dockers/docker-lldp-sv2/start.sh +++ b/dockers/docker-lldp-sv2/start.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/lldpd.conf.j2 > /etc/lldpd.conf +sonic-cfggen -d -t /usr/share/sonic/templates/lldpd.conf.j2 > /etc/lldpd.conf mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status diff --git a/dockers/docker-orchagent/arp_update b/dockers/docker-orchagent/arp_update index 8291818e50fb..cfd87c1dc51f 100755 --- a/dockers/docker-orchagent/arp_update +++ b/dockers/docker-orchagent/arp_update @@ -4,7 +4,7 @@ # arp_update: Send gratuitous ARP requests to VLAN member neighbors to refresh # the neighbors state. -VLAN=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_vlans.keys() | join(" ")'` +VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` for vlan in $VLAN; do # generate a list of arping commands: # arping -q -w 0 -c 1 -i ; diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index 6ffafd297496..2f411b088e6d 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -2,8 +2,8 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "src_ip":"{{ minigraph_lo_interfaces[0]['addr'] }}", - "dst_ip":"{{ minigraph_lo_interfaces[0]['addr'] }}", + "src_ip":"{{ LOOPBACK_INTERFACE.keys()[0][1] | ip }}", + "dst_ip":"{{ LOOPBACK_INTERFACE.keys()[0][1] | ip }}", {% if onie_switch_asic == "mlnx" %} "dscp_mode":"uniform", "ecn_mode":"standard", diff --git a/dockers/docker-orchagent/mirror.json.j2 b/dockers/docker-orchagent/mirror.json.j2 index 4aa710cfcb71..3a3fc6eed079 100644 --- a/dockers/docker-orchagent/mirror.json.j2 +++ b/dockers/docker-orchagent/mirror.json.j2 @@ -1,9 +1,10 @@ [ -{% if erspan_dst %} +{% if MIRROR_SESSION %} +{% for session in MIRROR_SESSION %} { - "MIRROR_SESSION_TABLE:everflow": { - "src_ip": "{{ minigraph_lo_interfaces[0]['addr'] }}", - "dst_ip": "{{ erspan_dst[0] }}", + "MIRROR_SESSION_TABLE:{{session}}": { + "src_ip": "{{ MIRROR_SESSION[session]['src_ip'] }}", + "dst_ip": "{{ MIRROR_SESSION[session]['dst_ip'] }}", {% if onie_switch_asic == "mlnx" %} "gre_type": "0x6558", "queue": "1", @@ -15,7 +16,9 @@ "ttl": "255" }, "OP": "SET" - } + }{% if not loop.last %},{% endif %} + +{% endfor %} {% endif %} ] diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 328ce8fc053d..7103afcb81e9 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -2,7 +2,7 @@ # Export platform information. Required to be able to write # vendor specific code. -export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v onie_switch_asic` +export platform=`sonic-cfggen -v onie_switch_asic` ASIC=`sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type` diff --git a/dockers/docker-orchagent/ports.json.j2 b/dockers/docker-orchagent/ports.json.j2 index f59ee993eead..48be831025f8 100644 --- a/dockers/docker-orchagent/ports.json.j2 +++ b/dockers/docker-orchagent/ports.json.j2 @@ -1,11 +1,15 @@ [ -{% for interface in ethernet_interfaces %} +{% if PORT %} +{% for port in PORT %} +{% if PORT[port].has_key('speed') %} { - "PORT_TABLE:{{ interface['name'] }}": { - "speed": "{{ interface['speed'] }}" + "PORT_TABLE:{{ port }}": { + "speed": "{{ PORT[port]['speed'] }}" }, "OP": "SET" }{% if not loop.last %},{% endif %} +{% endif %} {% endfor %} +{% endif %} ] diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 5f961a8bd294..1eba99192b21 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -2,11 +2,11 @@ mkdir -p /etc/swss/config.d/ -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json +sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json +sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json +sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json -export platform=`sonic-cfggen -m /etc/sonic/minigraph.xml -v platform` +export platform=`sonic-cfggen -v platform` rm -f /var/run/rsyslogd.pid @@ -34,7 +34,7 @@ supervisorctl start neighsyncd supervisorctl start swssconfig # Start arp_update when VLAN exists -VLAN=`sonic-cfggen -m /etc/sonic/minigraph.xml -v 'minigraph_vlans.keys() | join(" ")'` +VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then supervisorctl start arp_update fi diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 2530aca06bb3..c4043bd86de7 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -36,7 +36,7 @@ function fast_reboot { # Restore FDB and ARP table ASAP fast_reboot -HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` +HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v DEVICE_METADATA["localhost"]["hwsku"]` SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json " diff --git a/dockers/docker-snmp-sv2/alias_map.j2 b/dockers/docker-snmp-sv2/alias_map.j2 index 0f91fa26eabe..bd68353a91e3 100644 --- a/dockers/docker-snmp-sv2/alias_map.j2 +++ b/dockers/docker-snmp-sv2/alias_map.j2 @@ -1,5 +1,5 @@ { -{% for member in minigraph_ports.keys() %} - "{{member}}": "{{minigraph_ports[member]['alias']}}"{% if not loop.last %},{% endif %} +{% for member in PORT %} + "{{member}}": "{{PORT[member]['alias']}}"{% if not loop.last %},{% endif %} {% endfor %} } diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index c5d299af05ef..246924cfd387 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -13,18 +13,22 @@ # AGENT BEHAVIOUR # -{% if minigraph_mgmt_interface.addr | ipv4 %} +{% if MGMT_INTERFACE %} # Listen for connections on localhost, loopback ip and mgmt (eth0) ip agentAddress udp:127.0.0.1:161 -agentAddress udp:{{ minigraph_mgmt_interface.addr }}:161 -{% for minigraph_lo_interface in minigraph_lo_interfaces %} +{% for (name, prefix) in MGMT_INTERFACE %} +{% if prefix | ipv4 %} +agentAddress udp:{{ prefix | ip }}:161 +{% endif %} +{% endfor %} # TODO: only support ipv4 lo addresses, add ipv6 support later -{% if minigraph_lo_interface.addr | ipv4 %} -agentAddress udp:{{ minigraph_lo_interface.addr }}:161 +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv4 %} +agentAddress udp:{{ prefix | ip }}:161 {% endif %} {% endfor %} {% else %} -# Listen on all addresses as mgmt ip not specified in minigraph +# Listen on all addresses as mgmt ip not specified agentAddress udp:161 {% endif %} diff --git a/dockers/docker-snmp-sv2/start.sh b/dockers/docker-snmp-sv2/start.sh index ffbe8f196722..201239b1e7db 100755 --- a/dockers/docker-snmp-sv2/start.sh +++ b/dockers/docker-snmp-sv2/start.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash mkdir -p /etc/ssw -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sysDescription.j2 > /etc/ssw/sysDescription +sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sysDescription.j2 > /etc/ssw/sysDescription mkdir -p /etc/snmp -sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 > /etc/snmp/snmpd.conf -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/alias_map.j2 > /etc/snmp/alias_map.json +sonic-cfggen -d -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 > /etc/snmp/snmpd.conf +sonic-cfggen -d -t /usr/share/sonic/templates/alias_map.j2 > /etc/snmp/alias_map.json mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status diff --git a/dockers/docker-snmp-sv2/sysDescription.j2 b/dockers/docker-snmp-sv2/sysDescription.j2 index 648ed161046e..207a8bf7de9a 100644 --- a/dockers/docker-snmp-sv2/sysDescription.j2 +++ b/dockers/docker-snmp-sv2/sysDescription.j2 @@ -1 +1 @@ -SONiC Software Version: SONiC.{{ build_version }} - HwSku: {{ minigraph_hwsku }} - Distribution: Debian {{ debian_version }} - Kernel: {{ kernel_version }} +SONiC Software Version: SONiC.{{ build_version }} - HwSku: {{ DEVICE_METADATA['localhost']['hwsku'] }} - Distribution: Debian {{ debian_version }} - Kernel: {{ kernel_version }} diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index fe4bfe1c584f..6b0a3d785894 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -15,8 +15,8 @@ if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC fi -for pc in `sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_portchannels.keys() | join(' ')"`; do - sonic-cfggen -m /etc/sonic/minigraph.xml -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf +for pc in `sonic-cfggen -d -v "PORTCHANNEL.keys() | join(' ') if PORTCHANNEL"`; do + sonic-cfggen -d -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf done mkdir -p /var/sonic diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 index d6693719f1ad..d9ea1b790f89 100644 --- a/dockers/docker-teamd/teamd.j2 +++ b/dockers/docker-teamd/teamd.j2 @@ -5,14 +5,14 @@ "name": "lacp", "active": true, {# Use 75% links upperbound as min-links #} - "min_ports": {{ (minigraph_portchannels[pc]['members'] | length * 0.75) | round(0, 'ceil') | int }}, + "min_ports": {{ (PORTCHANNEL[pc]['members'] | length * 0.75) | round(0, 'ceil') | int }}, "tx_hash": ["eth", "ipv4", "ipv6"] }, "link_watch": { "name": "ethtool" }, "ports": { -{% for member in minigraph_portchannels[pc]['members'] %} +{% for member in PORTCHANNEL[pc]['members'] %} "{{ member }}": {}{% if not loop.last %},{% endif %} {% endfor %} diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 3ae3acaed33b..042db764df97 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -2,7 +2,9 @@ # Obtain our platform and HWSKU as we will mount directories with these names in each docker PLATFORM=`sonic-cfggen -v platform` -HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` +{%- if docker_container_name != "database" %} +HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'` +{%- endif %} start() { docker inspect --type container {{docker_container_name}} &>/dev/null @@ -16,9 +18,19 @@ start() { {%- endif %} -v /var/run/redis:/var/run/redis:rw \ -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ +{%- if docker_container_name != "database" %} -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ +{%- endif %} --name={{docker_container_name}} {{docker_image_name}}:latest fi +{%- if docker_container_name == "database" %} + while true; do + if [[ "$(docker exec -i database redis-cli ping)" =~ PONG.* ]]; then + break + fi + sleep 1 + done +{%- endif %} } attach() { diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index ed6b852f18f9..af922530d8a2 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -5,6 +5,7 @@ Requires=database.service Requires=opennsl-modules-3.16.0-4-amd64.service {% endif %} After=database.service +After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} After=opennsl-modules-3.16.0-4-amd64.service {% endif %} diff --git a/files/image_config/interfaces/interfaces-config.service b/files/image_config/interfaces/interfaces-config.service index 0cc7f2981505..86706da22518 100644 --- a/files/image_config/interfaces/interfaces-config.service +++ b/files/image_config/interfaces/interfaces-config.service @@ -1,6 +1,7 @@ [Unit] Description=Update interfaces configuration -Before=database.service +Requires=database.service +After=database.service [Service] Type=oneshot diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index d2b42051cc8d..400b89a594c7 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,6 +1,6 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces +sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces [ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid service networking restart ifdown lo && ifup lo diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 425badf7f21f..f96c0740c572 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -10,34 +10,36 @@ auto lo iface lo inet loopback # Use command 'ip addr list dev lo' to check all addresses -{% for minigraph_lo_interface in minigraph_lo_interfaces %} -iface lo {{ 'inet' if minigraph_lo_interface['addr'] | ipv4 else 'inet6' }} static - address {{ minigraph_lo_interface['addr'] }} - netmask {{ minigraph_lo_interface['mask'] }} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +iface lo {{ 'inet' if prefix | ipv4 else 'inet6' }} static + address {{ prefix | ip }} + netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # {% endfor %} {% endblock loopback %} {% block mgmt_interface %} # The management network interface auto eth0 -{% if minigraph_mgmt_interface['addr'] %} -iface eth0 inet static - address {{ minigraph_mgmt_interface['addr'] }} - netmask {{ minigraph_mgmt_interface['mask'] }} +{% if MGMT_INTERFACE %} +{% for (name, prefix) in MGMT_INTERFACE %} +iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static + address {{ prefix | ip }} + netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} ########## management network policy routing rules # management port up rules - up ip route add default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default - up ip rule add from {{ minigraph_mgmt_interface['addr'] }}/32 table default -{% for prefix in forced_mgmt_routes %} - up ip rule add to {{ prefix }} table default + up ip route add default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default + up ip rule add from {{ prefix | ip }}/32 table default +{% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} + up ip rule add to {{ route }} table default {% endfor %} # management port down rules - down ip route delete default via {{ minigraph_mgmt_interface['gwaddr'] }} dev eth0 table default - down ip rule delete from {{ minigraph_mgmt_interface['addr'] }}/32 table default -{% for prefix in forced_mgmt_routes %} - down ip rule delete to {{ prefix }} table default + down ip route delete default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default + down ip rule delete from {{ prefix | ip }}/32 table default +{% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} + down ip rule delete to {{ route }} table default {% endfor %} {# TODO: COPP policy type rules #} +{% endfor %} {% else %} iface eth0 inet dhcp {% endif %} @@ -45,19 +47,18 @@ iface eth0 inet dhcp {% endblock mgmt_interface %} {% block front_panel_interfaces %} # The switch front panel interfaces -{% for interface in minigraph_interfaces %} -allow-hotplug {{ interface['attachto'] }} -iface {{ interface['attachto'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static +{% for (name, prefix) in INTERFACE %} +allow-hotplug {{ name }} +iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static mtu 9216 - address {{ interface['addr'] }} - netmask {{ interface['mask'] }} + address {{ prefix | ip }} + netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # {% endfor %} -{% if minigraph_vlans.keys() | length %} +{% if VLAN %} # "|| true" is added to suppress the error when interface is already a member of VLAN -{% endif %} -{% for vlan in minigraph_vlans.keys()|sort %} -{% for member in minigraph_vlans[vlan]['members'] %} +{% for vlan in VLAN.keys()|sort %} +{% for member in VLAN[vlan]['members'] %} allow-hotplug {{ member }} iface {{ member }} inet manual pre-up ifconfig {{ member }} up mtu 9216 @@ -66,12 +67,12 @@ iface {{ member }} inet manual # {% endfor %} {% endfor %} -{% if minigraph_portchannels.keys() | length %} +{% endif %} +{% if PORTCHANNEL %} # "|| true" is added to suppress the error when interface is already a member of LAG # "ip link show | grep -q master" is added to ensure interface is enslaved -{% endif %} -{% for pc in minigraph_portchannels.keys()|sort %} -{% for member in minigraph_portchannels[pc]['members'] %} +{% for pc in PORTCHANNEL.keys()|sort %} +{% for member in PORTCHANNEL[pc]['members'] %} allow-hotplug {{ member }} iface {{ member }} inet manual pre-up teamdctl {{ pc }} port add {{ member }} || true @@ -80,30 +81,31 @@ iface {{ member }} inet manual # {% endfor %} {% endfor %} +{% endif %} {% endblock front_panel_interfaces %} -{% if minigraph_vlans.keys() | length %} {% block vlan_interfaces %} +{% if VLAN_INTERFACE %} # Vlan interfaces -{% for vlan_interface in minigraph_vlan_interfaces %} -auto {{ vlan_interface['attachto'] }} -iface {{ vlan_interface['attachto'] }} {{ 'inet' if vlan_interface['addr'] | ipv4 else 'inet6' }} static +{% for (name, prefix) in VLAN_INTERFACE.keys() | sort %} +auto {{ name }} +iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static bridge_ports none - address {{ vlan_interface['addr'] }} - netmask {{ vlan_interface['mask'] }} + address {{ prefix | ip }} + netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} {% endfor %} # -{% endblock vlan_interfaces %} {% endif %} -{% if minigraph_portchannels.keys() | length %} +{% endblock vlan_interfaces %} {% block pc_interfaces %} +{% if PORTCHANNEL_INTERFACE %} # Portchannel interfaces -{% for pc_interface in minigraph_portchannel_interfaces %} -allow-hotplug {{ pc_interface['attachto'] }} -iface {{ pc_interface['attachto'] }} {{ 'inet' if pc_interface['addr'] | ipv4 else 'inet6' }} static +{% for (name, prefix) in PORTCHANNEL_INTERFACE.keys() | sort %} +allow-hotplug {{ name }} +iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static mtu 9216 - address {{ pc_interface['addr'] }} - netmask {{ pc_interface['mask'] }} + address {{ prefix | ip }} + netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # {% endfor %} -{% endblock pc_interfaces %} {% endif %} +{% endblock pc_interfaces %} diff --git a/files/image_config/ntp/ntp-config.service b/files/image_config/ntp/ntp-config.service index 948e7f4953c8..05e6211b9782 100644 --- a/files/image_config/ntp/ntp-config.service +++ b/files/image_config/ntp/ntp-config.service @@ -1,6 +1,8 @@ [Unit] Description=Update NTP configuration Before=ntp.service +Requires=database.service +After=database.service [Service] Type=oneshot diff --git a/files/image_config/ntp/ntp-config.sh b/files/image_config/ntp/ntp-config.sh index 2465058ba021..7c79a16c0ef3 100755 --- a/files/image_config/ntp/ntp-config.sh +++ b/files/image_config/ntp/ntp-config.sh @@ -1,3 +1,3 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf +sonic-cfggen -d -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf diff --git a/files/image_config/ntp/ntp.conf.j2 b/files/image_config/ntp/ntp.conf.j2 index 3ae0c1804e52..ae72820339be 100644 --- a/files/image_config/ntp/ntp.conf.j2 +++ b/files/image_config/ntp/ntp.conf.j2 @@ -23,13 +23,15 @@ filegen clockstats file clockstats type day enable # pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will # pick a different set every time it starts up. Please consider joining the # pool: -{% for ntp_server in ntp_servers %} +{% for ntp_server in NTP_SERVER %} server {{ ntp_server }} iburst {% endfor %} #only listen on localhost and eth0 ips (default is to listen on all ip addresses) interface ignore wildcard -interface listen {{ minigraph_mgmt_interface.addr }} +{% for (mgmt_intf, mgmt_prefix) in MGMT_INTERFACE %} +interface listen {{ mgmt_prefix | ip }} +{% endfor %} interface listen 127.0.0.1 # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for diff --git a/files/image_config/rsyslog/rsyslog-config.service b/files/image_config/rsyslog/rsyslog-config.service index be3c209e7560..e013b992030d 100644 --- a/files/image_config/rsyslog/rsyslog-config.service +++ b/files/image_config/rsyslog/rsyslog-config.service @@ -1,5 +1,7 @@ [Unit] Description=Update rsyslog configuration +Requires=database.service +After=database.service [Service] Type=oneshot diff --git a/files/image_config/rsyslog/rsyslog-config.sh b/files/image_config/rsyslog/rsyslog-config.sh index 06a4934a4be5..c8ba7b99453c 100755 --- a/files/image_config/rsyslog/rsyslog-config.sh +++ b/files/image_config/rsyslog/rsyslog-config.sh @@ -1,4 +1,4 @@ #!/bin/bash -sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf +sonic-cfggen -d -t /usr/share/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf systemctl restart rsyslog diff --git a/files/image_config/rsyslog/rsyslog.conf.j2 b/files/image_config/rsyslog/rsyslog.conf.j2 index 264ddd8dd7bf..063f119f6bdd 100644 --- a/files/image_config/rsyslog/rsyslog.conf.j2 +++ b/files/image_config/rsyslog/rsyslog.conf.j2 @@ -41,7 +41,7 @@ $template SONiCFileFormat,"%timegenerated%.%timegenerated:::date-subseconds% %HO $ActionFileDefaultTemplate SONiCFileFormat #Set remote syslog server -{% for server in syslog_servers %} +{% for server in SYSLOG_SERVER %} *.* @{{ server }}:514;SONiCFileFormat {% endfor %} diff --git a/files/image_config/updategraph/updategraph.service b/files/image_config/updategraph/updategraph.service index ba0b5dcb85e2..c66e9be75702 100644 --- a/files/image_config/updategraph/updategraph.service +++ b/files/image_config/updategraph/updategraph.service @@ -1,8 +1,6 @@ [Unit] Description=download minigraph from graph service -Before=ntp-config.service -Before=rsyslog-config.service -Before=interfaces-config.service +Before=database.service [Service] Type=oneshot diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 1877e552858e..565a1a43d060 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -91,18 +91,20 @@ def parse_png(png, hname): if enddevice == hname: if port_alias_map.has_key(endport): endport = port_alias_map[endport] - neighbors[endport] = {'name': startdevice, 'port': startport} + neighbors[startdevice] = {'local_port': endport, 'port': startport} else: if port_alias_map.has_key(startport): startport = port_alias_map[startport] - neighbors[startport] = {'name': enddevice, 'port': endport} + neighbors[enddevice] = {'local_port': startport, 'port': endport} if child.tag == str(QName(ns, "Devices")): for device in child.findall(str(QName(ns, "Device"))): (lo_prefix, mgmt_prefix, name, hwsku, d_type) = parse_device(device) - lo_addr = None if not lo_prefix else lo_prefix.split('/')[0] - mgmt_addr = None if not mgmt_prefix else mgmt_prefix.split('/')[0] - devices[name] = {'lo_addr': lo_addr, 'type': d_type, 'mgmt_addr': mgmt_addr, 'hwsku': hwsku} + device_data = {'lo_addr': lo_prefix, 'type': d_type, 'mgmt_addr': mgmt_prefix, 'hwsku': hwsku } + if neighbors.has_key(name): + neighbors[name].update(device_data) + else: + devices[name] = device_data if child.tag == str(QName(ns, "DeviceInterfaceLinks")): for if_link in child.findall(str(QName(ns, 'DeviceLinkBase'))): @@ -131,71 +133,28 @@ def parse_dpg(dpg, hname): continue ipintfs = child.find(str(QName(ns, "IPInterfaces"))) - intfs = [] + intfs = {} for ipintf in ipintfs.findall(str(QName(ns, "IPInterface"))): intfalias = ipintf.find(str(QName(ns, "AttachTo"))).text intfname = port_alias_map.get(intfalias, intfalias) ipprefix = ipintf.find(str(QName(ns, "Prefix"))).text - ipn = ipaddress.IPNetwork(ipprefix) - ipaddr = ipn.ip - prefix_len = ipn.prefixlen - addr_bits = ipn.max_prefixlen - subnet = ipaddress.IPNetwork(str(ipn.network) + '/' + str(prefix_len)) - ipmask = ipn.netmask - - intf = {'addr': ipaddr, 'subnet': subnet} - if isinstance(ipn, ipaddress.IPv4Network): - intf['mask'] = ipmask - else: - intf['mask'] = str(prefix_len) - intf.update({'attachto': intfname, 'prefixlen': int(prefix_len)}) - - # TODO: remove peer_addr after dependency removed - ipaddr_val = int(ipn.ip) - peer_addr_val = None - if int(prefix_len) == addr_bits - 2: - if ipaddr_val & 0x3 == 1: - peer_addr_val = ipaddr_val + 1 - else: - peer_addr_val = ipaddr_val - 1 - elif int(prefix_len) == addr_bits - 1: - if ipaddr_val & 0x1 == 0: - peer_addr_val = ipaddr_val + 1 - else: - peer_addr_val = ipaddr_val - 1 - if peer_addr_val is not None: - intf['peer_addr'] = ipaddress.IPAddress(peer_addr_val) - intfs.append(intf) + intfs[(intfname, ipprefix)] = {} lointfs = child.find(str(QName(ns, "LoopbackIPInterfaces"))) - lo_intfs = [] + lo_intfs = {} for lointf in lointfs.findall(str(QName(ns1, "LoopbackIPInterface"))): intfname = lointf.find(str(QName(ns, "AttachTo"))).text ipprefix = lointf.find(str(QName(ns1, "PrefixStr"))).text - ipn = ipaddress.IPNetwork(ipprefix) - ipaddr = ipn.ip - prefix_len = ipn.prefixlen - ipmask = ipn.netmask - lo_intf = {'name': intfname, 'addr': ipaddr, 'prefixlen': prefix_len} - if isinstance(ipn, ipaddress.IPv4Network): - lo_intf['mask'] = ipmask - else: - lo_intf['mask'] = str(prefix_len) - lo_intfs.append(lo_intf) - + lo_intfs[(intfname, ipprefix)] = {} + mgmtintfs = child.find(str(QName(ns, "ManagementIPInterfaces"))) - mgmt_intf = None + mgmt_intf = {} for mgmtintf in mgmtintfs.findall(str(QName(ns1, "ManagementIPInterface"))): + intfname = mgmtintf.find(str(QName(ns, "AttachTo"))).text ipprefix = mgmtintf.find(str(QName(ns1, "PrefixStr"))).text mgmtipn = ipaddress.IPNetwork(ipprefix) - # Ignore IPv6 management address - if mgmtipn.version == 6: - continue - ipaddr = mgmtipn.ip - prefix_len = str(mgmtipn.prefixlen) - ipmask = mgmtipn.netmask gwaddr = ipaddress.IPAddress(int(mgmtipn.network) + 1) - mgmt_intf = {'addr': ipaddr, 'prefixlen': prefix_len, 'mask': ipmask, 'gwaddr': gwaddr} + mgmt_intf[(intfname, ipprefix)] = {'gwaddr': gwaddr} pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) pc_intfs = [] @@ -206,7 +165,7 @@ def parse_dpg(dpg, hname): pcmbr_list = pcintfmbr.split(';') for i, member in enumerate(pcmbr_list): pcmbr_list[i] = port_alias_map.get(member, member) - pcs[pcintfname] = {'name': pcintfname, 'members': pcmbr_list} + pcs[pcintfname] = {'members': pcmbr_list} vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) vlan_intfs = [] @@ -218,7 +177,7 @@ def parse_dpg(dpg, hname): vmbr_list = vintfmbr.split(';') for i, member in enumerate(vmbr_list): vmbr_list[i] = port_alias_map.get(member, member) - vlan_attributes = {'name': vintfname, 'members': vmbr_list, 'vlanid': vlanid} + vlan_attributes = {'members': vmbr_list, 'vlanid': vlanid} sonic_vlan_name = "Vlan%s" % vlanid vlans[sonic_vlan_name] = vlan_attributes @@ -243,7 +202,7 @@ def parse_dpg(dpg, hname): acl_intfs = port_alias_map.values() break; if acl_intfs: - acls[aclname] = { 'AttachTo': acl_intfs, 'IsMirror': is_mirror } + acls[aclname] = { 'policy_desc': aclname, 'ports': acl_intfs, 'type': 'mirror' if is_mirror else 'L3'} return intfs, lo_intfs, mgmt_intf, vlans, pcs, acls return None, None, None, None, None, None @@ -326,51 +285,17 @@ def parse_meta(meta, hname): return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id def parse_deviceinfo(meta, hwsku): - ethernet_interfaces = [] - + ethernet_interfaces = {} for device_info in meta.findall(str(QName(ns, "DeviceInfo"))): dev_sku = device_info.find(str(QName(ns, "HwSku"))).text if dev_sku == hwsku: interfaces = device_info.find(str(QName(ns, "EthernetInterfaces"))) for interface in interfaces.findall(str(QName(ns1, "EthernetInterface"))): - name = interface.find(str(QName(ns, "InterfaceName"))).text + alias = interface.find(str(QName(ns, "InterfaceName"))).text speed = interface.find(str(QName(ns, "Speed"))).text - ethernet_interfaces.append({ 'name':name, 'speed':speed }) - + ethernet_interfaces[port_alias_map.get(alias, alias)] = speed return ethernet_interfaces -def get_console_info(devices, dev, port): - for k, v in devices.items(): - if k == dev: - break - else: - return {} - - ret_val = v - ret_val.update({ - 'ts_port': port, - 'ts_dev': dev - }) - - return ret_val - - -def get_mgmt_info(devices, dev, port): - for k, v in devices.items(): - if k == dev: - break - else: - return {} - - ret_val = v - ret_val.update({ - 'mgmt_port': port, - 'mgmt_dev': dev - }) - - return ret_val - - def parse_port_config(hwsku, platform=None, port_config_file=None): port_config_candidates = [] if port_config_file != None: @@ -401,7 +326,7 @@ def parse_port_config(hwsku, platform=None, port_config_file=None): alias = name else: alias = tokens[2].strip() - ports[name] = {'name': name, 'alias': alias} + ports[name] = {'alias': alias} port_alias_map[alias] = name return ports @@ -424,7 +349,7 @@ def parse_xml(filename, platform=None, port_config_file=None): neighbors = None devices = None hostname = None - ethernet_interfaces = [] + port_speeds = {} syslog_servers = [] dhcp_servers = [] ntp_servers = [] @@ -455,93 +380,91 @@ def parse_xml(filename, platform=None, port_config_file=None): elif child.tag == str(QName(ns, "MetadataDeclaration")): (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) elif child.tag == str(QName(ns, "DeviceInfos")): - ethernet_interfaces = parse_deviceinfo(child, hwsku) + port_speeds = parse_deviceinfo(child, hwsku) results = {} - results['minigraph_hwsku'] = hwsku - # sorting by lambdas are not easily done without custom filters. - # TODO: add jinja2 filter to accept a lambda to sort a list of dictionaries by attribute. - # TODO: alternatively (preferred), implement class containers for multiple-attribute entries, enabling sort by attr + results['DEVICE_METADATA'] = {'localhost': { + 'bgp_asn': bgp_asn, + 'deployment_id': deployment_id, + 'hostname': hostname, + 'hwsku': hwsku, + 'type': devices[hostname]['type'] + }} results['BGP_NEIGHBOR'] = bgp_sessions - results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn }} results['BGP_PEER_RANGE'] = bgp_peers_with_range - # TODO: sort does not work properly on all interfaces of varying lengths. Need to sort by integer group(s). - - phyport_intfs = [] - vlan_intfs = [] - pc_intfs = [] + if mgmt_routes: + # TODO: differentiate v4 and v6 + mgmt_intf.itervalues().next()['forced_mgmt_routes'] = mgmt_routes + results['MGMT_INTERFACE'] = mgmt_intf + results['LOOPBACK_INTERFACE'] = lo_intfs + + phyport_intfs = {} + vlan_intfs = {} + pc_intfs = {} for intf in intfs: - intfname = intf['attachto'] - if intfname[0:4] == 'Vlan': - vlan_intfs.append(intf) - elif intfname[0:11] == 'PortChannel': - pc_intfs.append(intf) + if intf[0][0:4] == 'Vlan': + vlan_intfs[intf] = {} + elif intf[0][0:11] == 'PortChannel': + pc_intfs[intf] = {} else: - phyport_intfs.append(intf) - - results['minigraph_interfaces'] = sorted(phyport_intfs, key=lambda x: x['attachto']) - results['minigraph_vlan_interfaces'] = sorted(vlan_intfs, key=lambda x: x['attachto']) - results['minigraph_portchannel_interfaces'] = sorted(pc_intfs, key=lambda x: x['attachto']) - results['minigraph_ports'] = ports - results['minigraph_vlans'] = vlans - results['minigraph_portchannels'] = pcs - results['minigraph_mgmt_interface'] = mgmt_intf - results['minigraph_lo_interfaces'] = lo_intfs - results['minigraph_acls'] = acls - results['minigraph_neighbors'] = neighbors - results['minigraph_devices'] = devices - results['minigraph_underlay_neighbors'] = u_neighbors - results['minigraph_underlay_devices'] = u_devices - results['minigraph_as_xml'] = mini_graph_path - if devices != None: - results['minigraph_console'] = get_console_info(devices, console_dev, console_port) - results['minigraph_mgmt'] = get_mgmt_info(devices, mgmt_dev, mgmt_port) - results['minigraph_hostname'] = hostname - results['inventory_hostname'] = hostname - results['syslog_servers'] = syslog_servers - results['dhcp_servers'] = dhcp_servers - results['ntp_servers'] = ntp_servers - results['forced_mgmt_routes'] = mgmt_routes - results['erspan_dst'] = erspan_dst - results['deployment_id'] = deployment_id - results['ethernet_interfaces'] = ethernet_interfaces + phyport_intfs[intf] = {} + + results['INTERFACE'] = phyport_intfs + results['VLAN_INTERFACE'] = vlan_intfs + results['PORTCHANNEL_INTERFACE'] = pc_intfs + + for port_name in port_speeds: + ports.setdefault(port_name, {})['speed'] = port_speeds[port_name] + results['PORT'] = ports + results['PORTCHANNEL'] = pcs + results['VLAN'] = vlans + + results['DEVICE_NEIGHBOR'] = neighbors + results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers) + results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers) + results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers) + + results['ACL_TABLE'] = acls + mirror_sessions = {} + if erspan_dst: + lo_addr = '0.0.0.0' + for lo in lo_intfs: + lo_network = ipaddress.IPNetwork(lo[1]) + if lo_network.version == 4: + lo_addr = str(lo_network.ip) + break + count = 0 + for dst in erspan_dst: + mirror_sessions['everflow{}'.format(count)] = {"dst_ip": dst, "src_ip": lo_addr} + count += 1 + results['MIRROR_SESSION'] = mirror_sessions return results + def parse_device_desc_xml(filename): root = ET.parse(filename).getroot() (lo_prefix, mgmt_prefix, hostname, hwsku, d_type) = parse_device(root) results = {} - results['minigraph_hwsku'] = hwsku - results['minigraph_hostname'] = hostname - results['inventory_hostname'] = hostname - - lo_intfs = [] - ipn = ipaddress.IPNetwork(lo_prefix) - ipaddr = ipn.ip - prefix_len = ipn.prefixlen - ipmask = ipn.netmask - lo_intf = {'name': None, 'addr': ipaddr, 'prefixlen': prefix_len} - if isinstance(ipn, ipaddress.IPv4Network): - lo_intf['mask'] = ipmask - else: - lo_intf['mask'] = str(prefix_len) - lo_intfs.append(lo_intf) - results['minigraph_lo_interfaces'] = lo_intfs + results['DEVICE_METADATA'] = {'localhost': { + 'hostname': hostname, + 'hwsku': hwsku, + }} + + results['LOOPBACK_INTERFACE'] = {('lo', lo_prefix): {}} + + mgmt_intf = {} + mgmtipn = ipaddress.IPNetwork(mgmt_prefix) + gwaddr = ipaddress.IPAddress(int(mgmtipn.network) + 1) + results['MGMT_INTERFACE'] = {('eth0', mgmt_prefix): {'gwaddr': gwaddr}} - mgmt_intf = None - mgmt_ipn = ipaddress.IPNetwork(mgmt_prefix) - ipaddr = mgmt_ipn.ip - prefix_len = str(mgmt_ipn.prefixlen) - ipmask = mgmt_ipn.netmask - gwaddr = ipaddress.IPAddress(int(mgmt_ipn.network) + 1) - mgmt_intf = {'addr': ipaddr, 'prefixlen': prefix_len, 'mask': ipmask, 'gwaddr': gwaddr} - results['minigraph_mgmt_interface'] = mgmt_intf return results + port_alias_map = {} + def print_parse_xml(filename): results = parse_xml(filename) print(json.dumps(results, indent=3, cls=minigraph_encoder)) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 070b3100ea5a..5303557c4fb4 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -22,6 +22,7 @@ import yaml import jinja2 import netaddr import json +from functools import partial from minigraph import minigraph_encoder from minigraph import parse_xml from minigraph import parse_device_desc_xml @@ -32,11 +33,11 @@ from swsssdk import ConfigDBConnector def is_ipv4(value): if not value: return False - if isinstance(value, netaddr.IPAddress): + if isinstance(value, netaddr.IPNetwork): addr = value else: try: - addr = netaddr.IPAddress(str(value)) + addr = netaddr.IPNetwork(str(value)) except: return False return addr.version == 4 @@ -44,15 +45,25 @@ def is_ipv4(value): def is_ipv6(value): if not value: return False - if isinstance(value, netaddr.IPAddress): + if isinstance(value, netaddr.IPNetwork): addr = value else: try: - addr = netaddr.IPAddress(str(value)) + addr = netaddr.IPNetwork(str(value)) except: return False return addr.version == 6 +def prefix_attr(attr, value): + if not value: + return None + else: + try: + prefix = netaddr.IPNetwork(str(value)) + except: + return None + return str(getattr(prefix, attr)) + def unique_name(l): name_list = [] new_list = [] @@ -79,10 +90,31 @@ TODO(taoyl): Current version of config db only supports BGP admin states. def output_to_db(output_data): db_data = {} for table_name in output_data: - if table_name == 'BGP_NEIGHBOR' or table_name == 'BGP_PEER_RANGE' or table_name == 'DEVICE_METADATA': + if table_name[0].isupper(): db_data[table_name] = output_data[table_name] return db_data + @staticmethod + def to_serialized(data): + for table in data: + if type(data[table]) is dict: + for key in data[table].keys(): + new_key = ConfigDBConnector.serialize_key(key) + if new_key != key: + data[table][new_key] = data[table].pop(key) + return data + + @staticmethod + def to_deserialized(data): + for table in data: + if type(data[table]) is dict: + for key in data[table].keys(): + new_key = ConfigDBConnector.deserialize_key(key) + if new_key != key: + data[table][new_key] = data[table].pop(key) + return data + + def deep_update(dst, src): for key, value in src.iteritems(): if isinstance(value, dict): @@ -138,11 +170,11 @@ def main(): for yaml_file in args.yaml: with open(yaml_file, 'r') as stream: additional_data = yaml.load(stream) - deep_update(data, additional_data) + deep_update(data, FormatConverter.to_deserialized(additional_data)) for json_file in args.json: with open(json_file, 'r') as stream: - deep_update(data, json.load(stream)) + deep_update(data, FormatConverter.to_deserialized(json.load(stream))) if args.additional_data != None: deep_update(data, json.loads(args.additional_data)) @@ -158,6 +190,8 @@ def main(): env.filters['ipv4'] = is_ipv4 env.filters['ipv6'] = is_ipv6 env.filters['unique_name'] = unique_name + for attr in ['ip', 'network', 'prefixlen', 'netmask']: + env.filters[attr] = partial(prefix_attr, attr) template = env.get_template(template_file) print template.render(data) @@ -174,7 +208,7 @@ def main(): configdb.set_config(FormatConverter.output_to_db(data)) if args.print_data: - print json.dumps(data, indent=4, cls=minigraph_encoder) + print json.dumps(FormatConverter.to_serialized(data), indent=4, cls=minigraph_encoder) if __name__ == "__main__": diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index 5c57bf8fac85..aed23f8a5c26 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -27,6 +27,16 @@ iface eth0 inet static # management port down rules down ip route delete default via 10.0.0.1 dev eth0 table default down ip rule delete from 10.0.0.100/32 table default +iface eth0 inet6 static + address 2603:10e2:0:2902::8 + netmask 64 + ########## management network policy routing rules + # management port up rules + up ip route add default via 2603:10e2:0:2902::1 dev eth0 table default + up ip rule add from 2603:10e2:0:2902::8/32 table default + # management port down rules + down ip route delete default via 2603:10e2:0:2902::1 dev eth0 table default + down ip rule delete from 2603:10e2:0:2902::8/32 table default # # The switch front panel interfaces # "|| true" is added to suppress the error when interface is already a member of VLAN diff --git a/src/sonic-config-engine/tests/sample_output/mirror.json b/src/sonic-config-engine/tests/sample_output/mirror.json index 54065700a282..225235067e23 100644 --- a/src/sonic-config-engine/tests/sample_output/mirror.json +++ b/src/sonic-config-engine/tests/sample_output/mirror.json @@ -1,6 +1,6 @@ [ { - "MIRROR_SESSION_TABLE:everflow": { + "MIRROR_SESSION_TABLE:everflow0": { "src_ip": "10.1.0.32", "dst_ip": "2.2.2.2", "gre_type": "0x88be", diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 153b0bb14f36..cf0eb4d8cc5c 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -31,17 +31,17 @@ def test_dummy_run(self): self.assertEqual(output, '') def test_device_desc(self): - argument = '-v minigraph_hwsku -M "' + self.sample_device_desc + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -M "' + self.sample_device_desc + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'ACS-MSN2700') def test_device_desc_mgmt_ip(self): - argument = '-v "minigraph_mgmt_interface[\'addr\']" -M "' + self.sample_device_desc + '"' + argument = '-v "MGMT_INTERFACE.keys()[0]" -M "' + self.sample_device_desc + '"' output = self.run_script(argument) - self.assertEqual(output.strip(), '10.0.1.5') + self.assertEqual(output.strip(), "('eth0', '10.0.1.5/28')") def test_minigraph_sku(self): - argument = '-v minigraph_hwsku -m "' + self.sample_graph + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -m "' + self.sample_graph + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'Force10-Z9100') @@ -51,7 +51,7 @@ def test_print_data(self): self.assertTrue(len(output.strip()) > 0) def test_jinja_expression(self): - argument = '-m "' + self.sample_graph + '" -v "minigraph_devices[minigraph_hostname][\'type\']"' + argument = '-m "' + self.sample_graph + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"' output = self.run_script(argument) self.assertEqual(output.strip(), 'LeafRouter') @@ -71,44 +71,44 @@ def test_render_template(self): self.assertEqual(output.strip(), 'value1\nvalue2') def test_minigraph_acl(self): - argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v minigraph_acls' + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'dataacl': {'IsMirror': False, 'AttachTo': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + self.assertEqual(output.strip(), "{'dataacl': {'type': 'L3', 'policy_desc': 'dataacl', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") def test_minigraph_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v \'INTERFACE.keys()\'' output = self.run_script(argument) - self.assertEqual(output.strip(), "[{'subnet': IPv4Network('10.0.0.58/31'), 'peer_addr': IPv4Address('10.0.0.59'), 'addr': IPv4Address('10.0.0.58'), 'mask': IPv4Address('255.255.255.254'), 'attachto': 'Ethernet0', 'prefixlen': 31}, {'subnet': IPv6Network('fc00::74/126'), 'peer_addr': IPv6Address('fc00::76'), 'addr': IPv6Address('fc00::75'), 'mask': '126', 'attachto': 'Ethernet0', 'prefixlen': 126}]") + self.assertEqual(output.strip(), "[('Ethernet0', '10.0.0.58/31'), ('Ethernet0', 'FC00::75/126')]") def test_minigraph_vlans(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_vlans' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'Vlan1000': {'name': 'Vlan1000', 'members': ['Ethernet8'], 'vlanid': '1000'}}") + self.assertEqual(output.strip(), "{'Vlan1000': {'members': ['Ethernet8'], 'vlanid': '1000'}}") def test_minigraph_vlan_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_vlan_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "VLAN_INTERFACE.keys()"' output = self.run_script(argument) - self.assertEqual(output.strip(), "[{'prefixlen': 27, 'subnet': IPv4Network('192.168.0.0/27'), 'mask': IPv4Address('255.255.255.224'), 'addr': IPv4Address('192.168.0.1'), 'attachto': 'Vlan1000'}]") + self.assertEqual(output.strip(), "[('Vlan1000', '192.168.0.1/27')]") def test_minigraph_portchannels(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannels' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'name': 'PortChannel01', 'members': ['Ethernet4']}}") + self.assertEqual(output.strip(), "{'PortChannel01': {'members': ['Ethernet4']}}") def test_minigraph_portchannels_more_member(self): - argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v minigraph_portchannels' + argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'name': 'PortChannel01', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + self.assertEqual(output.strip(), "{'PortChannel01': {'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") def test_minigraph_portchannel_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v minigraph_portchannel_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORTCHANNEL_INTERFACE.keys()"' output = self.run_script(argument) - self.assertEqual(output.strip(), "[{'subnet': IPv4Network('10.0.0.56/31'), 'peer_addr': IPv4Address('10.0.0.57'), 'addr': IPv4Address('10.0.0.56'), 'mask': IPv4Address('255.255.255.254'), 'attachto': 'PortChannel01', 'prefixlen': 31}, {'subnet': IPv6Network('fc00::70/126'), 'peer_addr': IPv6Address('fc00::72'), 'addr': IPv6Address('fc00::71'), 'mask': '126', 'attachto': 'PortChannel01', 'prefixlen': 126}]") + self.assertEqual(output.strip(), "[('PortChannel01', 'FC00::71/126'), ('PortChannel01', '10.0.0.56/31')]") def test_minigraph_neighbors(self): - argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v minigraph_neighbors' + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "DEVICE_NEIGHBOR[\'ARISTA01T1\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'Ethernet116': {'name': 'ARISTA02T1', 'port': 'Ethernet1/1'}, 'Ethernet124': {'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}, 'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}, 'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}}") + self.assertEqual(output.strip(), "{'mgmt_addr': None, 'hwsku': 'Arista', 'lo_addr': None, 'local_port': 'Ethernet112', 'type': 'LeafRouter', 'port': 'Ethernet1/1'}") def test_minigraph_peers_with_range(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v BGP_PEER_RANGE.values\(\)' @@ -116,11 +116,11 @@ def test_minigraph_peers_with_range(self): self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]") def test_minigraph_deployment_id(self): - argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v deployment_id' + argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"' output = self.run_script(argument) self.assertEqual(output.strip(), "1") def test_minigraph_ethernet_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v ethernet_interfaces' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet8\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "[{'speed': '10000', 'name': 'fortyGigE0/0'}, {'speed': '25000', 'name': 'fortyGigE0/4'}, {'speed': '40000', 'name': 'fortyGigE0/8'}, {'speed': '1000000', 'name': 'fortyGigE0/12'}]") + self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/8', 'speed': '40000'}") diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 0f9264eb1d3b..9b71fc72b932 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -40,7 +40,7 @@ def test_render_teamd(self, pc, minigraph, sample_output): self.assertTrue(filecmp.cmp(sample_output, self.output_file)) # Test T0 minigraph - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"' + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "PORTCHANNEL.keys() | join(\' \') if PORTCHANNEL"' output = self.run_script(argument) # Mock the output via config.sh in docker-teamd pc_list = output.split() @@ -51,7 +51,7 @@ def test_render_teamd(self, pc, minigraph, sample_output): test_render_teamd(self, pc_name, self.t0_minigraph, sample_output) # Test port channel test minigraph - argument = '-m ' + self.pc_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"' + argument = '-m ' + self.pc_minigraph + ' -p ' + self.t0_port_config + ' -v "PORTCHANNEL.keys() | join(\' \') if PORTCHANNEL"' output = self.run_script(argument) # Mock the output via config.sh in docker-teamd pc_list = output.split() diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl index 5525eff96774..b8138cf36b18 100755 --- a/src/sonic-config-engine/translate_acl +++ b/src/sonic-config-engine/translate_acl @@ -110,13 +110,14 @@ def generate_rule_json(table_name, rule, max_priority, mirror): rule_props["TCP_FLAGS"] = '0x{:02x}/0x{:02x}'.format(tcp_flags, tcp_flags) return rule_data -def generate_table_json(aclset, aclname, ports, mirror, max_priority, output_path='.'): +def generate_table_json(aclset, aclname, ports, t_type, max_priority, output_path='.'): table_name = aclname.replace(" ", "_").replace("-", "_") #table_name = generate_random_table_name() + mirror = (t_type == 'mirror') table_props = {} table_props["policy_desc"] = table_name - table_props["type"] = "mirror" if mirror else "L3" + table_props["type"] = t_type table_props["ports"] = ports table_data = [{}] @@ -138,7 +139,7 @@ def translate_acl_fixed_port(filename, output_path, port, max_priority): yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") for aclsetname in yang_acl.acl.acl_sets.acl_set: aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] - generate_table_json(aclset, aclsetname, port, max_priority, output_path) + generate_table_json(aclset, aclsetname, port, 'l3', max_priority, output_path) return def translate_acl(filename, output_path, mini_acl, max_priority): @@ -146,10 +147,10 @@ def translate_acl(filename, output_path, mini_acl, max_priority): for aclsetname in yang_acl.acl.acl_sets.acl_set: tablename = aclsetname.replace(" ", "_").replace("-", "_") if mini_acl.has_key(tablename): - is_mirror = mini_acl[tablename]['IsMirror'] - ports = ','.join(mini_acl[tablename]['AttachTo']) + t_type = mini_acl[tablename]['type'] + ports = ','.join(mini_acl[tablename]['ports']) aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] - generate_table_json(aclset, aclsetname, ports, is_mirror, max_priority, output_path) + generate_table_json(aclset, aclsetname, ports, t_type, max_priority, output_path) return def main(): @@ -166,8 +167,8 @@ def main(): translate_acl_fixed_port(args.input, args.output_path, args.port, args.max_priority) elif args.minigraph: mini_data = parse_xml(args.minigraph, port_config_file=args.port_config) - if mini_data['minigraph_acls']: - translate_acl(args.input, args.output_path, mini_data['minigraph_acls'], args.max_priority) + if mini_data['ACL_TABLE']: + translate_acl(args.input, args.output_path, mini_data['ACL_TABLE'], args.max_priority) if __name__ == "__main__": main() diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 9b54b80f1783..7f8e7c5ad974 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 9b54b80f1783808c5ae2a30e189f24a7404a8c95 +Subproject commit 7f8e7c5ad9747af1d8ce5317eb1ece65ed4c0c7a From 686e227dcccabdf9c3ed8bffec2e0c2a026ccbf4 Mon Sep 17 00:00:00 2001 From: nikos-li <31227248+nikos-li@users.noreply.github.com> Date: Tue, 12 Sep 2017 15:48:38 -0700 Subject: [PATCH 0770/1833] [frr]: RR client support in minigraph for FRR (#923) --- dockers/docker-fpm-frr/bgpd.conf.j2 | 6 ++++++ src/sonic-config-engine/minigraph.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index 0f1e255b5cd1..f17464e3f893 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -57,12 +57,18 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% if neighbor_addr | ipv4 %} address-family ipv4 neighbor {{ neighbor_addr }} activate +{% if bgp_session['rrclient'] != 0 %} + neighbor {{ neighbor_addr }} route-reflector-client +{% endif %} maximum-paths 64 exit-address-family {% endif %} {% if neighbor_addr | ipv6 %} address-family ipv6 neighbor {{ neighbor_addr }} activate +{% if bgp_session['rrclient'] != 0 %} + neighbor {{ neighbor_addr }} route-reflector-client +{% endif %} maximum-paths 64 exit-address-family {% endif %} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 565a1a43d060..7cf4d2f829cc 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -233,6 +233,10 @@ def parse_cpg(cpg, hname): for router in child.findall(str(QName(ns1, "BGPRouterDeclaration"))): asn = router.find(str(QName(ns1, "ASN"))).text hostname = router.find(str(QName(ns1, "Hostname"))).text + if router.find(str(QName(ns1, "RRClient"))): + rrclient = '1' + else: + rrclient = '0' if hostname == hname: myasn = int(asn) peers = router.find(str(QName(ns1, "Peers"))) @@ -251,6 +255,7 @@ def parse_cpg(cpg, hname): bgp_session = bgp_sessions[peer] if hostname == bgp_session['name']: bgp_session['asn'] = int(asn) + bgp_session['rrclient'] = int(rrclient) return bgp_sessions, myasn, bgp_peers_with_range From e4cae4e8897b7f613365d9242df17f30a742dc78 Mon Sep 17 00:00:00 2001 From: cytsai0409 Date: Thu, 14 Sep 2017 10:18:26 +0800 Subject: [PATCH 0771/1833] [Ingrasys] update port_config.ini and sfputil for ingrasys platforms (#952) * [Ingrasys] update port_config.ini and sfputil for ingrasys platforms - What I did Update port_config.ini on S8810-32Q/S8900-54XC/S8900-64XC/S9100-C32 platforms - How I did it Update alias field and add port field in port_config.ini - How to verify it Check with the "sfputil show eeprom" command. If no error occurs, it is passed. - Description for the changelog Update port_config.ini on S8810-32Q/S8900-54XC/S8900-64XC/S9100-C32 platforms * [Ingrasys] remove debug message in sfputil.py on S8810-32Q - What I did remove debug message in sfputil.py on S8810-32Q - How I did it remove print in get_low_power_mode() and set_low_power_mode() - How to verify it There should be no debug message when executing "sfputil show lpmode" and "sfputil lpmode on Ethernet0"command. - Description for the changelog remove debug message in sfputil.py on S8810-32Q - A picture of a cute animal (not mandatory but encouraged) --- .../INGRASYS-S8810-32Q/port_config.ini | 66 ++--- .../plugins/sfputil.py | 200 +++++++++++----- .../INGRASYS-S8900-54XC/port_config.ini | 110 ++++----- .../plugins/sfputil.py | 225 ++++++++++++++++-- .../INGRASYS-S8900-64XC/port_config.ini | 130 +++++----- .../INGRASYS-S9100-C32/port_config.ini | 66 ++--- 6 files changed, 540 insertions(+), 257 deletions(-) diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini index fb9235101108..a313c9cda21f 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias -Ethernet0 37,38,39,40 -Ethernet4 33,34,35,36 -Ethernet8 45,46,47,48 -Ethernet12 41,42,43,44 -Ethernet16 53,54,55,56 -Ethernet20 49,50,51,52 -Ethernet24 61,62,63,64 -Ethernet28 57,58,59,60 -Ethernet32 69,70,71,72 -Ethernet36 65,66,67,68 -Ethernet40 77,78,79,80 -Ethernet44 73,74,75,76 -Ethernet48 85,86,87,88 -Ethernet52 81,82,83,84 -Ethernet56 93,94,95,96 -Ethernet60 89,90,91,92 -Ethernet64 101,102,103,104 -Ethernet68 97,98,99,100 -Ethernet72 109,110,111,112 -Ethernet76 105,106,107,108 -Ethernet80 117,118,119,120 -Ethernet84 113,114,115,116 -Ethernet88 125,126,127,128 -Ethernet92 121,122,123,124 -Ethernet96 5,6,7,8 -Ethernet100 1,2,3,4 -Ethernet104 13,14,15,16 -Ethernet108 9,10,11,12 -Ethernet112 21,22,23,24 -Ethernet116 17,18,19,20 -Ethernet120 29,30,31,32 -Ethernet124 25,26,27,28 +# name lanes alias port +Ethernet0 37,38,39,40 Ethernet1/1 0 +Ethernet4 33,34,35,36 Ethernet2/1 1 +Ethernet8 45,46,47,48 Ethernet3/1 2 +Ethernet12 41,42,43,44 Ethernet4/1 3 +Ethernet16 53,54,55,56 Ethernet5/1 4 +Ethernet20 49,50,51,52 Ethernet6/1 5 +Ethernet24 61,62,63,64 Ethernet7/1 6 +Ethernet28 57,58,59,60 Ethernet8/1 7 +Ethernet32 69,70,71,72 Ethernet9/1 8 +Ethernet36 65,66,67,68 Ethernet10/1 9 +Ethernet40 77,78,79,80 Ethernet11/1 10 +Ethernet44 73,74,75,76 Ethernet12/1 11 +Ethernet48 85,86,87,88 Ethernet13/1 12 +Ethernet52 81,82,83,84 Ethernet14/1 13 +Ethernet56 93,94,95,96 Ethernet15/1 14 +Ethernet60 89,90,91,92 Ethernet16/1 15 +Ethernet64 101,102,103,104 Ethernet17/1 16 +Ethernet68 97,98,99,100 Ethernet18/1 17 +Ethernet72 109,110,111,112 Ethernet19/1 18 +Ethernet76 105,106,107,108 Ethernet20/1 19 +Ethernet80 117,118,119,120 Ethernet21/1 20 +Ethernet84 113,114,115,116 Ethernet22/1 21 +Ethernet88 125,126,127,128 Ethernet23/1 22 +Ethernet92 121,122,123,124 Ethernet24/1 23 +Ethernet96 5,6,7,8 Ethernet25/1 24 +Ethernet100 1,2,3,4 Ethernet26/1 25 +Ethernet104 13,14,15,16 Ethernet27/1 26 +Ethernet108 9,10,11,12 Ethernet28/1 27 +Ethernet112 21,22,23,24 Ethernet29/1 28 +Ethernet116 17,18,19,20 Ethernet30/1 29 +Ethernet120 29,30,31,32 Ethernet31/1 30 +Ethernet124 25,26,27,28 Ethernet32/1 31 diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py index 7bc71c27eeb6..bef254484ac4 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py @@ -1,61 +1,147 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") - - -class sfputil(sfputilbase): - """Platform specific sfputil class""" - - port_start = 0 - port_end = 31 - ports_in_block = 32 - - port_to_eeprom_mapping = {} - #FIXME - port_to_i2c_mapping = { - 0: 18, - 1: 19, - 2: 20, - 3: 21, - 4: 22, - 5: 23, - 6: 24, - 7: 25, - 8: 26, - 9: 27, - 10: 28, - 11: 29, - 12: 30, - 13: 31, - 14: 32, - 15: 33, - 16: 34, - 17: 35, - 18: 36, - 19: 37, - 20: 38, - 21: 39, - 22: 40, - 23: 41, - 24: 42, - 25: 43, - 26: 44, - 27: 45, - 28: 46, - 29: 47, - 30: 48, - 31: 49 - } - - _qsfp_ports = range(0, ports_in_block + 1) - - def __init__(self, port_num): + 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 = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + + EEPROM_OFFSET = 18 + + ABS_GPIO_BASE = 224 + #INT_GPIO_BASE = 192 + LP_GPIO_BASE = 160 + RST_GPIO_BASE = 128 + + BASE_DIR_PATH = "/sys/class/gpio/gpio{0}/direction" + BASE_VAL_PATH = "/sys/class/gpio/gpio{0}/value" + + _port_to_eeprom_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(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + for x in range(self.port_start, self.port_end + 1): - port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) - self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + abs_device_file = self.BASE_VAL_PATH.format( + port_num + self.ABS_GPIO_BASE) + val_file = open(abs_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + port_num + self.LP_GPIO_BASE) + val_file = open(lpmode_val_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + port_num + self.LP_GPIO_BASE) + val_file = open(lpmode_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1" if lpmode is True else "0") + val_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + port_num + self.RST_GPIO_BASE) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1") + val_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + port_num + self.RST_GPIO_BASE) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("0") + val_file.close() + + return True diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini index 24a2b8e29222..c1243db622f6 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini @@ -1,55 +1,55 @@ -# name lanes alias -Ethernet0 1 -Ethernet1 2 -Ethernet2 3 -Ethernet3 4 -Ethernet4 5 -Ethernet5 6 -Ethernet6 7 -Ethernet7 8 -Ethernet8 9 -Ethernet9 10 -Ethernet10 11 -Ethernet11 12 -Ethernet12 21 -Ethernet13 22 -Ethernet14 23 -Ethernet15 24 -Ethernet16 33 -Ethernet17 34 -Ethernet18 35 -Ethernet19 36 -Ethernet20 37 -Ethernet21 38 -Ethernet22 39 -Ethernet23 40 -Ethernet24 41 -Ethernet25 42 -Ethernet26 43 -Ethernet27 44 -Ethernet28 49 -Ethernet29 50 -Ethernet30 51 -Ethernet31 52 -Ethernet32 53 -Ethernet33 54 -Ethernet34 55 -Ethernet35 56 -Ethernet36 65 -Ethernet37 66 -Ethernet38 67 -Ethernet39 68 -Ethernet40 69 -Ethernet41 70 -Ethernet42 71 -Ethernet43 72 -Ethernet44 81 -Ethernet45 82 -Ethernet46 83 -Ethernet47 84 -Ethernet48 85,86,87,88 -Ethernet52 97,98,99,100 -Ethernet56 101,102,103,104 -Ethernet60 105,106,107,108 -Ethernet64 109,110,111,112 -Ethernet68 117,118,119,120 +# name lanes alias port +Ethernet0 1 Ethernet1 0 +Ethernet1 2 Ethernet2 1 +Ethernet2 3 Ethernet3 2 +Ethernet3 4 Ethernet4 3 +Ethernet4 5 Ethernet5 4 +Ethernet5 6 Ethernet6 5 +Ethernet6 7 Ethernet7 6 +Ethernet7 8 Ethernet8 7 +Ethernet8 9 Ethernet9 8 +Ethernet9 10 Ethernet10 9 +Ethernet10 11 Ethernet11 10 +Ethernet11 12 Ethernet12 11 +Ethernet12 21 Ethernet13 12 +Ethernet13 22 Ethernet14 13 +Ethernet14 23 Ethernet15 14 +Ethernet15 24 Ethernet16 15 +Ethernet16 33 Ethernet17 16 +Ethernet17 34 Ethernet18 17 +Ethernet18 35 Ethernet19 18 +Ethernet19 36 Ethernet20 19 +Ethernet20 37 Ethernet21 20 +Ethernet21 38 Ethernet22 21 +Ethernet22 39 Ethernet23 22 +Ethernet23 40 Ethernet24 23 +Ethernet24 41 Ethernet25 24 +Ethernet25 42 Ethernet26 25 +Ethernet26 43 Ethernet27 26 +Ethernet27 44 Ethernet28 27 +Ethernet28 49 Ethernet29 28 +Ethernet29 50 Ethernet30 29 +Ethernet30 51 Ethernet31 30 +Ethernet31 52 Ethernet32 31 +Ethernet32 53 Ethernet33 32 +Ethernet33 54 Ethernet34 33 +Ethernet34 55 Ethernet35 34 +Ethernet35 56 Ethernet36 35 +Ethernet36 65 Ethernet37 36 +Ethernet37 66 Ethernet38 37 +Ethernet38 67 Ethernet39 38 +Ethernet39 68 Ethernet40 39 +Ethernet40 69 Ethernet41 40 +Ethernet41 70 Ethernet42 41 +Ethernet42 71 Ethernet43 42 +Ethernet43 72 Ethernet44 43 +Ethernet44 81 Ethernet45 44 +Ethernet45 82 Ethernet46 45 +Ethernet46 83 Ethernet47 46 +Ethernet47 84 Ethernet48 47 +Ethernet48 85,86,87,88 Ethernet49/1 48 +Ethernet52 97,98,99,100 Ethernet50/1 49 +Ethernet56 101,102,103,104 Ethernet51/1 50 +Ethernet60 105,106,107,108 Ethernet52/1 51 +Ethernet64 109,110,111,112 Ethernet53/1 52 +Ethernet68 117,118,119,120 Ethernet54/1 53 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py index 96fa0fca86ce..0bb52e88616a 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py @@ -1,19 +1,27 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + 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""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 53 - ports_in_block = 54 + PORT_START = 0 + PORT_END = 53 + QSFP_PORT_START = 48 + PORTS_IN_BLOCK = 54 + + BASE_DIR_PATH = "/sys/class/gpio/gpio{0}/direction" + BASE_VAL_PATH = "/sys/class/gpio/gpio{0}/value" - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} port_to_i2c_mapping = { 0: 18, 1: 19, @@ -71,12 +79,201 @@ class sfputil(sfputilbase): 53: 71 } - _qsfp_ports = range(0, ports_in_block + 1) + abs_to_gpio_mapping = { + 0: 192, + 1: 193, + 2: 194, + 3: 195, + 4: 196, + 5: 197, + 6: 198, + 7: 199, + 8: 200, + 9: 201, + 10: 202, + 11: 203, + 12: 204, + 13: 205, + 14: 206, + 15: 207, + 16: 176, + 17: 177, + 18: 178, + 19: 179, + 20: 180, + 21: 181, + 22: 182, + 23: 183, + 24: 184, + 25: 185, + 26: 186, + 27: 187, + 28: 188, + 29: 189, + 30: 190, + 31: 191, + 32: 160, + 33: 161, + 34: 162, + 35: 163, + 36: 164, + 37: 165, + 38: 166, + 39: 167, + 40: 168, + 41: 169, + 42: 170, + 43: 171, + 44: 172, + 45: 173, + 46: 174, + 47: 175, + 48: 240, + 49: 241, + 50: 242, + 51: 243, + 52: 244, + 53: 245 + } + + lpmode_to_gpio_mapping = { + 48: 224, + 49: 225, + 50: 226, + 51: 227, + 52: 228, + 53: 229 + } + + reset_to_gpio_mapping = { + 48: 208, + 49: 209, + 50: 210, + 51: 211, + 52: 212, + 53: 213 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START - def __init__(self, port_num): + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + for x in range(self.port_start, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + abs_device_file = self.BASE_VAL_PATH.format( + self.abs_to_gpio_mapping[port_num]) + val_file = open(abs_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1" if lpmode is True else "0") + val_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + print "Error: unable to reset non-QSFP module: port %s" % str(port_num) + return False + + try: + print "port %s" % str(port_num) + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1") + val_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("0") + val_file.close() + + return True diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini index 3e5c7be570e1..20c2138dfeb3 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini @@ -1,65 +1,65 @@ -# name lanes alias -Ethernet0 17 -Ethernet1 18 -Ethernet2 19 -Ethernet3 20 -Ethernet4 24 -Ethernet5 23 -Ethernet6 22 -Ethernet7 21 -Ethernet8 28 -Ethernet9 27 -Ethernet10 26 -Ethernet11 25 -Ethernet12 32 -Ethernet13 31 -Ethernet14 30 -Ethernet15 29 -Ethernet16 1 -Ethernet17 2 -Ethernet18 3 -Ethernet19 4 -Ethernet20 8 -Ethernet21 7 -Ethernet22 6 -Ethernet23 5 -Ethernet24 12 -Ethernet25 11 -Ethernet26 10 -Ethernet27 9 -Ethernet28 13 -Ethernet29 14 -Ethernet30 15 -Ethernet31 16 -Ethernet32 33 -Ethernet33 34 -Ethernet34 35 -Ethernet35 36 -Ethernet36 38 -Ethernet37 39 -Ethernet38 40 -Ethernet39 37 -Ethernet40 41 -Ethernet41 42 -Ethernet42 43 -Ethernet43 44 -Ethernet44 48 -Ethernet45 45 -Ethernet46 46 -Ethernet47 47 -Ethernet48 49,50,51,52 -Ethernet52 53,54,55,56 -Ethernet56 57,58,59,60 -Ethernet60 61,62,63,64 -Ethernet64 65,66,67,68 -Ethernet68 69,70,71,72 -Ethernet72 73,74,75,76 -Ethernet76 77,78,79,80 -Ethernet80 81,82,83,84 -Ethernet84 85,86,87,88 -Ethernet88 89,90,91,92 -Ethernet92 93,94,95,96 -Ethernet96 97,98,99,100 -Ethernet100 101,102,103,104 -Ethernet104 105,106,107,108 -Ethernet108 109,110,111,112 +# name lanes alias port +Ethernet0 17 Ethernet1 0 +Ethernet1 18 Ethernet2 1 +Ethernet2 19 Ethernet3 2 +Ethernet3 20 Ethernet4 3 +Ethernet4 24 Ethernet5 4 +Ethernet5 23 Ethernet6 5 +Ethernet6 22 Ethernet7 6 +Ethernet7 21 Ethernet8 7 +Ethernet8 28 Ethernet9 8 +Ethernet9 27 Ethernet10 9 +Ethernet10 26 Ethernet11 10 +Ethernet11 25 Ethernet12 11 +Ethernet12 32 Ethernet13 12 +Ethernet13 31 Ethernet14 13 +Ethernet14 30 Ethernet15 14 +Ethernet15 29 Ethernet16 15 +Ethernet16 1 Ethernet17 16 +Ethernet17 2 Ethernet18 17 +Ethernet18 3 Ethernet19 18 +Ethernet19 4 Ethernet20 19 +Ethernet20 8 Ethernet21 20 +Ethernet21 7 Ethernet22 21 +Ethernet22 6 Ethernet23 22 +Ethernet23 5 Ethernet24 23 +Ethernet24 12 Ethernet25 24 +Ethernet25 11 Ethernet26 25 +Ethernet26 10 Ethernet27 26 +Ethernet27 9 Ethernet28 27 +Ethernet28 13 Ethernet29 28 +Ethernet29 14 Ethernet30 29 +Ethernet30 15 Ethernet31 30 +Ethernet31 16 Ethernet32 31 +Ethernet32 33 Ethernet33 32 +Ethernet33 34 Ethernet34 33 +Ethernet34 35 Ethernet35 34 +Ethernet35 36 Ethernet36 35 +Ethernet36 38 Ethernet37 36 +Ethernet37 39 Ethernet38 37 +Ethernet38 40 Ethernet39 38 +Ethernet39 37 Ethernet40 39 +Ethernet40 41 Ethernet41 40 +Ethernet41 42 Ethernet42 41 +Ethernet42 43 Ethernet43 42 +Ethernet43 44 Ethernet44 43 +Ethernet44 48 Ethernet45 44 +Ethernet45 45 Ethernet46 45 +Ethernet46 46 Ethernet47 46 +Ethernet47 47 Ethernet48 47 +Ethernet48 49,50,51,52 Ethernet49/1 48 +Ethernet52 53,54,55,56 Ethernet50/1 49 +Ethernet56 57,58,59,60 Ethernet51/1 50 +Ethernet60 61,62,63,64 Ethernet52/1 51 +Ethernet64 65,66,67,68 Ethernet53/1 52 +Ethernet68 69,70,71,72 Ethernet54/1 53 +Ethernet72 73,74,75,76 Ethernet55/1 54 +Ethernet76 77,78,79,80 Ethernet56/1 55 +Ethernet80 81,82,83,84 Ethernet57/1 56 +Ethernet84 85,86,87,88 Ethernet58/1 57 +Ethernet88 89,90,91,92 Ethernet59/1 58 +Ethernet92 93,94,95,96 Ethernet60/1 59 +Ethernet96 97,98,99,100 Ethernet61/1 60 +Ethernet100 101,102,103,104 Ethernet62/1 61 +Ethernet104 105,106,107,108 Ethernet63/1 62 +Ethernet108 109,110,111,112 Ethernet64/1 63 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini index d70c717fe4e2..6c62497b8927 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias -Ethernet0 5,6,7,8 -Ethernet4 1,2,3,4 -Ethernet8 13,14,15,16 -Ethernet12 9,10,11,12 -Ethernet16 21,22,23,24 -Ethernet20 17,18,19,20 -Ethernet24 29,30,31,32 -Ethernet28 25,26,27,28 -Ethernet32 37,38,39,40 -Ethernet36 33,34,35,36 -Ethernet40 45,46,47,48 -Ethernet44 41,42,43,44 -Ethernet48 53,54,55,56 -Ethernet52 49,50,51,52 -Ethernet56 61,62,63,64 -Ethernet60 57,58,59,60 -Ethernet64 69,70,71,72 -Ethernet68 65,66,67,68 -Ethernet72 77,78,79,80 -Ethernet76 73,74,75,76 -Ethernet80 85,86,87,88 -Ethernet84 81,82,83,84 -Ethernet88 93,94,95,96 -Ethernet92 89,90,91,92 -Ethernet96 101,102,103,104 -Ethernet100 97,98,99,100 -Ethernet104 109,110,111,112 -Ethernet108 105,106,107,108 -Ethernet112 117,118,119,120 -Ethernet116 113,114,115,116 -Ethernet120 125,126,127,128 -Ethernet124 121,122,123,124 +# name lanes alias port +Ethernet0 5,6,7,8 Ethernet1/1 0 +Ethernet4 1,2,3,4 Ethernet2/1 1 +Ethernet8 13,14,15,16 Ethernet3/1 2 +Ethernet12 9,10,11,12 Ethernet4/1 3 +Ethernet16 21,22,23,24 Ethernet5/1 4 +Ethernet20 17,18,19,20 Ethernet6/1 5 +Ethernet24 29,30,31,32 Ethernet7/1 6 +Ethernet28 25,26,27,28 Ethernet8/1 7 +Ethernet32 37,38,39,40 Ethernet9/1 8 +Ethernet36 33,34,35,36 Ethernet10/1 9 +Ethernet40 45,46,47,48 Ethernet11/1 10 +Ethernet44 41,42,43,44 Ethernet12/1 11 +Ethernet48 53,54,55,56 Ethernet13/1 12 +Ethernet52 49,50,51,52 Ethernet14/1 13 +Ethernet56 61,62,63,64 Ethernet15/1 14 +Ethernet60 57,58,59,60 Ethernet16/1 15 +Ethernet64 69,70,71,72 Ethernet17/1 16 +Ethernet68 65,66,67,68 Ethernet18/1 17 +Ethernet72 77,78,79,80 Ethernet19/1 18 +Ethernet76 73,74,75,76 Ethernet20/1 19 +Ethernet80 85,86,87,88 Ethernet21/1 20 +Ethernet84 81,82,83,84 Ethernet22/1 21 +Ethernet88 93,94,95,96 Ethernet23/1 22 +Ethernet92 89,90,91,92 Ethernet24/1 23 +Ethernet96 101,102,103,104 Ethernet25/1 24 +Ethernet100 97,98,99,100 Ethernet26/1 25 +Ethernet104 109,110,111,112 Ethernet27/1 26 +Ethernet108 105,106,107,108 Ethernet28/1 27 +Ethernet112 117,118,119,120 Ethernet29/1 28 +Ethernet116 113,114,115,116 Ethernet30/1 29 +Ethernet120 125,126,127,128 Ethernet31/1 30 +Ethernet124 121,122,123,124 Ethernet32/1 31 From 72412797ff911dee502df40f2a26e635012cad76 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 14 Sep 2017 04:11:08 +0000 Subject: [PATCH 0772/1833] [mellanox]: Update Mellanox SAI version ansd SDK version --- platform/mellanox/mlnx-sai.mk | 4 ++-- platform/mellanox/sdk.mk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index fbf4f94b590e..d9ee588a0dfe 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.8.2-master -MLNX_SAI_REVISION = 6b094746adc7ef2321701b4868806bc54a95bbd1 +MLNX_SAI_VERSION = sonic1.9.1fixes-master +MLNX_SAI_REVISION = 4ebc01e95b754c56da7f8b5fb45b82fbe661d05a export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 56e3145945f8..7c517627c23d 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/sonicv1.0.2/sdk -MLNX_SDK_VERSION = 4.2.5008 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/4ebc01e95b754c56da7f8b5fb45b82fbe661d05a/sdk +MLNX_SDK_VERSION = 4.2.5010 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) From 2e3975d6ed76fe674bcb3fa88f493d913acacccd Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 13 Sep 2017 21:23:06 -0700 Subject: [PATCH 0773/1833] [config] Fix an issue that bgp asn data type is not consistent (#953) * Fix an issue that bgp asn data type is not consistent from minigraph parser and DB * Fix test typo --- dockers/docker-fpm-frr/bgpd.conf.j2 | 6 +++--- dockers/docker-fpm-gobgp/gobgpd.conf.j2 | 2 +- dockers/docker-fpm-quagga/bgpd.conf.j2 | 2 +- src/sonic-config-engine/minigraph.py | 6 +++--- src/sonic-config-engine/tests/test_cfggen.py | 5 +++++ 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index f17464e3f893..5452a976368a 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -48,7 +48,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endblock vlan_advertisement %} {% block bgp_sessions %} {% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} -{% if bgp_session['asn'] != 0 %} +{% if bgp_session['asn'] | int != 0 %} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} {% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} @@ -57,7 +57,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% if neighbor_addr | ipv4 %} address-family ipv4 neighbor {{ neighbor_addr }} activate -{% if bgp_session['rrclient'] != 0 %} +{% if bgp_session['rrclient'] | int != 0 %} neighbor {{ neighbor_addr }} route-reflector-client {% endif %} maximum-paths 64 @@ -66,7 +66,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% if neighbor_addr | ipv6 %} address-family ipv6 neighbor {{ neighbor_addr }} activate -{% if bgp_session['rrclient'] != 0 %} +{% if bgp_session['rrclient'] | int != 0 %} neighbor {{ neighbor_addr }} route-reflector-client {% endif %} maximum-paths 64 diff --git a/dockers/docker-fpm-gobgp/gobgpd.conf.j2 b/dockers/docker-fpm-gobgp/gobgpd.conf.j2 index c51c10563b59..a4fb80bf11ca 100644 --- a/dockers/docker-fpm-gobgp/gobgpd.conf.j2 +++ b/dockers/docker-fpm-gobgp/gobgpd.conf.j2 @@ -2,7 +2,7 @@ as = {{ DEVICE_METADATA['localhost']['bgp_asn'] }} router-id = "{{ LOOPBACK_INTERFACE.keys()[0][1] }}" {% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} -{% if bgp_session['asn'] != 0 %} +{% if bgp_session['asn'] | int != 0 %} [[neighbors]] [neighbors.config] peer-as = {{ bgp_session['asn'] }} diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index 295cb2563aff..61d8f8ef3159 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -62,7 +62,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endblock vlan_advertisement %} {% block bgp_sessions %} {% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} -{% if bgp_session['asn'] != 0 %} +{% if bgp_session['asn'] | int != 0 %} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} {% if bgp_session.has_key('admin_status') and bgp_session['admin_status'] == 'down' or not bgp_session.has_key('admin_status') and DEVICE_METADATA['localhost'].has_key('default_bgp_status') and DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 7cf4d2f829cc..b5e97b485b44 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -238,7 +238,7 @@ def parse_cpg(cpg, hname): else: rrclient = '0' if hostname == hname: - myasn = int(asn) + myasn = asn peers = router.find(str(QName(ns1, "Peers"))) for bgpPeer in peers.findall(str(QName(ns, "BGPPeer"))): addr = bgpPeer.find(str(QName(ns, "Address"))).text @@ -254,8 +254,8 @@ def parse_cpg(cpg, hname): for peer in bgp_sessions: bgp_session = bgp_sessions[peer] if hostname == bgp_session['name']: - bgp_session['asn'] = int(asn) - bgp_session['rrclient'] = int(rrclient) + bgp_session['asn'] = asn + bgp_session['rrclient'] = rrclient return bgp_sessions, myasn, bgp_peers_with_range diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index cf0eb4d8cc5c..4303f5a2492d 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -110,6 +110,11 @@ def test_minigraph_neighbors(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'mgmt_addr': None, 'hwsku': 'Arista', 'lo_addr': None, 'local_port': 'Ethernet112', 'type': 'LeafRouter', 'port': 'Ethernet1/1'}") + 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) + self.assertEqual(output.strip(), "{'rrclient': '0', 'local_addr': '10.0.0.58', 'asn': '64600', 'name': 'ARISTA02T1'}") + def test_minigraph_peers_with_range(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v BGP_PEER_RANGE.values\(\)' output = self.run_script(argument) From 56ae5edc7f6ee26926bad236378f55a45b72d083 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 14 Sep 2017 08:43:02 -0700 Subject: [PATCH 0774/1833] [service template] Starting new docker when HWSKU change is detected (#946) Existing dockers has paths mounted according to the HWSKU. When HWSKU changes, these dockers need to be destroyed and recreated with the correct paths mounted. --- files/build_templates/docker_image_ctl.j2 | 72 ++++++++++++++++------- 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 042db764df97..a7aee83c70e6 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -1,36 +1,68 @@ #!/bin/bash -# Obtain our platform and HWSKU as we will mount directories with these names in each docker -PLATFORM=`sonic-cfggen -v platform` +function getMountPoint() +{ + echo $1 | python -c "import sys, json, os; mnts = [x for x in json.load(sys.stdin)[0]['Mounts'] if x['Destination'] == '/usr/share/sonic/hwsku']; print '' if len(mnts) == 0 else os.path.basename(mnts[0]['Source'])" 2>/dev/null +} + +function postStartAction() +{ {%- if docker_container_name != "database" %} + : +{%- else %} + while true; do + if [[ "$(docker exec -i database redis-cli ping)" =~ PONG.* ]]; then + break + fi + sleep 1 + done +{%- endif %} +} + +# Obtain our platform as we will mount directories with these names in each docker +PLATFORM=`sonic-cfggen -v platform` + +{%- if docker_container_name == "database" %} +# Don't mount HWSKU in {{docker_container_name}} container. +HWSKU="" +{%- else %} +# Obtain our HWSKU as we will mount directories with these names in each docker HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'` {%- endif %} start() { - docker inspect --type container {{docker_container_name}} &>/dev/null + DOCKERCHECK=`docker inspect --type container {{docker_container_name}} 2>/dev/null` if [ "$?" -eq "0" ]; then - docker start {{docker_container_name}} - else + DOCKERMOUNT=`getMountPoint "$DOCKERCHECK"` + if [ "$DOCKERMOUNT" == "$HWSKU" ]; then + echo "Starting existing {{docker_container_name}} container with HWSKU $HWSKU" + docker start {{docker_container_name}} + postStartAction + exit 0 + fi + + # docker created with a different HWSKU, remove and recreate + echo "Removing obsolete {{docker_container_name}} container with HWSKU $DOCKERMOUNT" + docker rm {{docker_container_name}} + fi - docker run -d {{docker_image_run_opt}} \ +{%- if docker_container_name == "database" %} + echo "Starting new {{docker_container_name}} container" +{%- else %} + echo "Starting new {{docker_container_name}} container with HWSKU $HWSKU" +{%- endif %} + docker run -d {{docker_image_run_opt}} \ {%- if '--log-driver=json-file' in docker_image_run_opt or '--log-driver' not in docker_image_run_opt %} - --log-opt max-size=2M --log-opt max-file=5 \ + --log-opt max-size=2M --log-opt max-file=5 \ {%- endif %} - -v /var/run/redis:/var/run/redis:rw \ - -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ + -v /var/run/redis:/var/run/redis:rw \ + -v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \ {%- if docker_container_name != "database" %} - -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ -{%- endif %} - --name={{docker_container_name}} {{docker_image_name}}:latest - fi -{%- if docker_container_name == "database" %} - while true; do - if [[ "$(docker exec -i database redis-cli ping)" =~ PONG.* ]]; then - break - fi - sleep 1 - done + -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ {%- endif %} + --name={{docker_container_name}} {{docker_image_name}}:latest + + postStartAction } attach() { From 3cbc080f7b3f4b65662795de4bdf832676bc8d7f Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 15 Sep 2017 11:15:04 -0700 Subject: [PATCH 0775/1833] [sairedis]: update sairedis submodule head (#956) This submodule update includes the deadlock fixes. --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 7e70b4d63020..4d7deba9354c 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 7e70b4d63020fc9ea1aa009c264e4effab7bcda0 +Subproject commit 4d7deba9354c922d18d75325dcd4255f4096560f From 48fd6fb4ec7f8111573131a3c57e7670ad29238e Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Thu, 14 Sep 2017 15:26:26 -0700 Subject: [PATCH 0776/1833] [swss]: Move swss/common/sairedis submodule to 201709 tag --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index eaccf67cabd2..7f5eca5e858f 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit eaccf67cabd22df0ff7d0117fe55f4261bc961d9 +Subproject commit 7f5eca5e858f6a82966eed4564ded4c3646424bf diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 4f917f2cc345..96018b55e29a 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 4f917f2cc345c54d1bf9d9f01d96e4c01071ac9a +Subproject commit 96018b55e29a31ff22c50db30843d98eff847c35 From 034b47df6c9becc615bfbef5ec28bc55044d8cbe Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 15 Sep 2017 11:39:29 -0700 Subject: [PATCH 0777/1833] [Broadcom]: Update OpenNSL/SAI version (#959) --- platform/broadcom/sai.mk | 6 ++---- platform/broadcom/sdk.mk | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 60a1d1f15eb7..7118da438b22 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,11 +1,9 @@ BRCM_SAI = libsaibcm_3.0.3.2_amd64.deb -# TODO: upload new SAI build to blob -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2_amd64.deb" +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2_amd64.deb?sv=2015-04-05&sr=b&sig=d50c3WTnlQGVgybK4RyNFWqvXPHPpAotNSongSABpWg%3D&se=2031-05-25T18%3A52%3A35Z&sp=r" BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -# TODO: upload new SAI build to blob -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2_amd64.deb" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2_amd64.deb?sv=2015-04-05&sr=b&sig=psB%2BzhbludRstCuuGncrMOg5oETOY13U26yEXyR2yWc%3D&se=2031-05-25T18%3A50%3A38Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 76a7671599f2..701994c81073 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,5 +1,4 @@ BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.3_amd64.deb -# TODO: upload new SDK build to blob -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3_amd64.deb" +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3_amd64.deb?sv=2015-04-05&sr=b&sig=Qjb29DKq2%2FAvRJAju%2FU91Gu5orJC0R5LTJ%2BwYm%2BYFiA%3D&se=2031-05-25T18%3A36%3A33Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) From 9d321fade60e6f55f1c17d693032530c81434ed4 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 15 Sep 2017 23:17:32 -0700 Subject: [PATCH 0778/1833] [syncd]: Comment out unused docker-ptf-brcm.mk --- platform/broadcom/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 21af44775dd3..b52118570251 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -15,7 +15,7 @@ include $(PLATFORM_PATH)/raw-image.mk include $(PLATFORM_PATH)/one-aboot.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk -include $(PLATFORM_PATH)/docker-ptf-brcm.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" From 6935e00909d521a6ecb2cdf7ec04a31131f86a53 Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Mon, 18 Sep 2017 00:11:30 +0530 Subject: [PATCH 0779/1833] [build/onie installer] Install grub for SONiC post migration from another NOS (#949) * Install grub for SONiC post migration from another NOS * Install grub from bundled debian package instead of using ONIE's. Address review comments --- build_debian.sh | 9 ++- files/image_config/platform/rc.local | 106 ++++++++++++++++++++++++++- installer/x86_64/install.sh | 11 ++- 3 files changed, 121 insertions(+), 5 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 21c370753592..9bdda3451009 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -63,6 +63,7 @@ if [[ -d $FILESYSTEM_ROOT ]]; then fi mkdir -p $FILESYSTEM_ROOT mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR +mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime ## Build a basic Debian system by debootstrap @@ -205,7 +206,13 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in curl \ kexec-tools \ less \ - unzip + unzip \ + gdisk + +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ + grub-pc-bin + +sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 8b8db4a261c3..d3ecba7d8518 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -29,6 +29,7 @@ if [ ! -e /host/machine.conf ]; then done fi + migration="TRUE" umount /mnt/onie-boot fi @@ -36,6 +37,26 @@ fi echo "install platform dependent packages at the first boot time" +firsttime_exit() +{ + rm /host/image-$sonic_version/platform/firsttime + exit 0 +} + +# Given a string of tuples of the form field=value, extract the value for a field +# In : $string, $field +# Out: $value +value_extract() +{ +set -- $string +for x in "$@"; do + case "$x" in + $field=*) + value="${x#$field=}" + esac +done +} + sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") if [ -f /host/image-$sonic_version/platform/firsttime ]; then @@ -46,8 +67,7 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then platform=$onie_platform else echo "Unknown sonic platform" - rm /host/image-$sonic_version/platform/firsttime - exit 0 + firsttime_exit fi # Try to take old configuration saved during installation @@ -76,6 +96,88 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then dpkg -i /host/image-$sonic_version/platform/$platform/*.deb fi + # If the unit booted into SONiC from another NOS's grub, + # we now install a grub for SONiC. + if [ -n "$onie_platform" ] && [ -n "$migration" ]; then + + grub_bin=$(ls /host/image-$sonic_version/platform/x86_64-grub/grub-pc-bin*.deb 2> /dev/null) + if [ -z "$grub_bin" ]; then + echo "Unable to locate grub package !" >> /etc/migration.log + firsttime_exit + fi + + dpkg -i $grub_bin > /dev/null 2>&1 + if [ $? != 0 ]; then + echo "Unable to install grub package !" >> /etc/migration.log + firsttime_exit + fi + + # Determine the block device to install grub + sonic_dev=$(blkid | grep SONiC-OS | head -n 1 | awk '{print $1}' | sed -e 's/[0-9]:.*$//') + if [ -z "$sonic_dev" ]; then + echo "Unable to determine sonic partition !" >> /etc/migration.log + firsttime_exit + fi + + grub-install --boot-directory=/host --recheck $sonic_dev 2>/dev/null + if [ $? != 0 ]; then + echo "grub install failed !" >> /etc/migration.log + firsttime_exit + fi + + # The SONiC "raw" build mode has already generated a proto grub.cfg + # as part of the migration. Platform specific constants need to be + # retrieved from installer.conf (if present) and assigned. + . /usr/share/sonic/device/$platform/installer.conf + + if [ ! -z "$CONSOLE_PORT" ]; then + field="\-\-port" + string=$(grep $field /host/grub.cfg) + value_extract $string $field + console_port=$value + if [ ! -z "$console_port" ] && [ "$console_port" != "$CONSOLE_PORT" ]; then + sed -i -e "s/\-\-port=$console_port/\-\-port=$CONSOLE_PORT/g" /host/grub.cfg + fi + echo "grub.cfg console port=$console_port & installer.conf CONSOLE_PORT=$CONSOLE_PORT" >> /etc/migration.log + fi + + if [ ! -z "$CONSOLE_DEV" ]; then + field="console" + string=$(grep $field /host/grub.cfg) + value_extract $string $field + console_dev_name=$(echo $value | sed -e "s/^.*=//" -e "s/,.*//") + console_dev="${console_dev_name#ttyS}" + if [ "$console_dev" != "$CONSOLE_DEV" ]; then + sed -i -e "s/console=ttyS$console_dev/console=ttyS$CONSOLE_DEV/g" /host/grub.cfg + fi + echo "grub.cfg console dev=$console_dev & installer.conf CONSOLE_DEV=$CONSOLE_DEV" >> /etc/migration.log + fi + + if [ ! -z "$VAR_LOG_SIZE" ]; then + field="var_log_size" + string=$(grep $field /host/grub.cfg) + value_extract $string $field + var_log_size=$value + if [ ! -z "$var_log_size" ] && [ "$var_log_size" != "$VAR_LOG_SIZE" ]; then + sed -i -e "s/var_log_size=$var_log_size/var_log_size=$VAR_LOG_SIZE/g" /host/grub.cfg + fi + echo "grub.cfg var_log_size=$var_log_size & installer.conf VAR_LOG_SIZE=$VAR_LOG_SIZE" >> /etc/migration.log + fi + + # Set the root based on the label + sonic_root=$(blkid | grep SONiC-OS | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') + sonic_root=$(echo "$sonic_root" | sed 's/\//\\\//g') + sed -i -e "s/%%SONIC_ROOT%%/$sonic_root/g" /host/grub.cfg + + # Add the Diag and ONIE entries + mount $onie_dev /mnt/onie-boot + . /mnt/onie-boot/onie/grub.d/50_onie_grub >> /host/grub.cfg + umount /mnt/onie-boot + + # Initialize the SONiC's grub config + mv /host/grub.cfg /host/grub/grub.cfg + fi + rm /host/image-$sonic_version/platform/firsttime fi diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 46942d6d58c3..358da41071b5 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -423,7 +423,7 @@ else demo_mnt="build_raw_image_mnt" demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%" - mkfs.ext4 $demo_dev + mkfs.ext4 -L $demo_volume_label $demo_dev echo "Mounting $demo_dev on $demo_mnt..." mkdir $demo_mnt @@ -535,6 +535,12 @@ if [ "$install_env" = "sonic" ]; then onie_menuentry=$(cat /host/grub/grub.cfg | sed "/menuentry ONIE/,/}/!d") fi +if [ "$install_env" = "build" ]; then + grub_cfg_root=%%SONIC_ROOT%% +else + grub_cfg_root=$demo_dev +fi + cat <> $grub_cfg menuentry '$demo_grub_entry' { search --no-floppy --label --set=root $demo_volume_label @@ -543,7 +549,7 @@ menuentry '$demo_grub_entry' { if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 - linux /$image_dir/boot/vmlinuz-3.16.0-4-amd64 root=$demo_dev rw $GRUB_CMDLINE_LINUX \ + linux /$image_dir/boot/vmlinuz-3.16.0-4-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' @@ -564,6 +570,7 @@ EOF fi if [ "$install_env" = "build" ]; then + cp $grub_cfg $demo_mnt/grub.cfg umount $demo_mnt else cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg From aa55b832a4c09da21d6c46a628581282e2a0cec6 Mon Sep 17 00:00:00 2001 From: wadelnn Date: Mon, 18 Sep 2017 06:38:51 +0800 Subject: [PATCH 0780/1833] [Ingrasys] Update Ingrasys submodule for S8900-54XC (#954) - What I did Update Ingrasys submodule for S8900-54XC QSFP reset function. - How I did it Add reset init scripts in S8900-54XC init function. - How to verify it Used the command "sfputil reset Ethernet48" to verify reset function. If no error occurs, it is passed. - Description for the changelog Update Ingrasys submodule for S8900-54XC QSFP reset function - A picture of a cute animal (not mandatory but encouraged) --- platform/broadcom/sonic-platform-modules-ingrasys | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index 00ea01132665..2725c0f1d1db 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit 00ea0113266590a5b17b923f017b52cab373234e +Subproject commit 2725c0f1d1db4a3301c00fac8d7e3bc028a37bce From aa549f208c78959aa09c3b3346d27fbfc1d11ed4 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 18 Sep 2017 13:04:29 -0700 Subject: [PATCH 0781/1833] [bgp]: Fix the deployment_id with DEVICE_METADATA (#962) --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index 61d8f8ef3159..0ef144016246 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -94,7 +94,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% for bgp_peer in BGP_PEER_RANGE.values() %} neighbor {{ bgp_peer['name'] }} peer-group neighbor {{ bgp_peer['name'] }} passive - neighbor {{ bgp_peer['name'] }} remote-as {{deployment_id_asn_map[deployment_id] }} + neighbor {{ bgp_peer['name'] }} remote-as {{ deployment_id_asn_map[DEVICE_METADATA['localhost']['deployment_id']] }} neighbor {{ bgp_peer['name'] }} ebgp-multihop 255 neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound neighbor {{ bgp_peer['name'] }} update-source Loopback0 From a376c86b5c1d24bb1ffacc063a66418aba4dd596 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 18 Sep 2017 17:23:19 -0700 Subject: [PATCH 0782/1833] [swss]: Fix the command to get HWSKU with sonic-cfggen (#964) --- dockers/docker-orchagent/swssconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index ff2953f94730..f075ca4f22ac 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -35,7 +35,7 @@ function fast_reboot { # Restore FDB and ARP table ASAP fast_reboot -HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v DEVICE_METADATA["localhost"]["hwsku"]` +HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v "DEVICE_METADATA['localhost']['hwsku']"` SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json " From 5ba6f53eedb2f804567cdd696f95f880860875fd Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 18 Sep 2017 18:46:51 -0700 Subject: [PATCH 0783/1833] Update sonic-utilities to be compatible with #942 (#965) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index a7be3b7ed905..b48573fce38a 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit a7be3b7ed905c753f785629ab85007008214ba62 +Subproject commit b48573fce38ad476fd9dccb11f57099085cc87d5 From 9139c7fe64108722770529d22e3d18102dad2bab Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 19 Sep 2017 12:27:18 -0700 Subject: [PATCH 0784/1833] Always start with Forwarding State flag set for bgpd (#963) --- dockers/docker-fpm-quagga/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-fpm-quagga/supervisord.conf b/dockers/docker-fpm-quagga/supervisord.conf index 5a310a790f18..92d806ff281c 100644 --- a/dockers/docker-fpm-quagga/supervisord.conf +++ b/dockers/docker-fpm-quagga/supervisord.conf @@ -36,7 +36,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:bgpd] -command=/usr/lib/quagga/bgpd -A 127.0.0.1 +command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F priority=5 autostart=false autorestart=false From 458093fee5a53105e937612b38a15f38966a89dc Mon Sep 17 00:00:00 2001 From: ravijo2 Date: Tue, 19 Sep 2017 16:23:31 -0700 Subject: [PATCH 0785/1833] Framework to plugin Organization specific scripts during ONIE Image build (#951) * Framework to plugin Organization specific scripts * Framework to plugin Organization specific scripts * Framework to plugin Organization specific scripts * add getopt option to organization script --- build_debian.sh | 8 +++ .../organization_extensions.sh | 52 +++++++++++++++++++ rules/config | 3 ++ slave.mk | 2 + 4 files changed, 65 insertions(+) create mode 100755 files/build_templates/organization_extensions.sh diff --git a/build_debian.sh b/build_debian.sh index 9bdda3451009..a21cdada0243 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -322,6 +322,14 @@ if [ -f sonic_debian_extension.sh ]; then ./sonic_debian_extension.sh $FILESYSTEM_ROOT $PLATFORM_DIR fi +## Organization specific extensions such as Configuration & Scripts for features like AAA, ZTP... +if [ "${enable_organization_extensions}" = "y" ]; then + if [ -f files/build_templates/organization_extensions.sh ]; then + sudo chmod 755 files/build_templates/organization_extensions.sh + ./files/build_templates/organization_extensions.sh -f $FILESYSTEM_ROOT -h $HOSTNAME + fi +fi + ## Clean up apt sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoremove sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoclean diff --git a/files/build_templates/organization_extensions.sh b/files/build_templates/organization_extensions.sh new file mode 100755 index 000000000000..db05a4e3f59d --- /dev/null +++ b/files/build_templates/organization_extensions.sh @@ -0,0 +1,52 @@ +#!/bin/bash +######################################################################### +## This script is to automate Orignaization specific extensions # +## such as Configuration & Scripts for features like AAA, ZTP, etc. # +## to include in ONIE installer image # +## # +## USAGE: # +## ./organization_extensions.sh -f -n # +## ./organization_extensions.sh \ # +## --fsroot \ # +## --hostname # +## PARAMETERS: # +## -f FILESYSTEM_ROOT # +## The location of the root file system # +## -h HOSTNAME # +## The hostname of the target system # +######################################################################### + +## Initialize the arguments to default values. +## The values get updated to user provided value, if supplied +FILESYSTEM_ROOT=./fsroot +HOSTNAME=sonic + +# read the options +TEMP=`getopt -o f:h: --long fsroot:,hostname: -- "$@"` +eval set -- "$TEMP" + +# extract options and their arguments into variables. +while true ; do + case "$1" in + -f|--fsroot) + case "$2" in + "") shift 2 ;; + *) FILESYSTEM_ROOT=$2 ; shift 2 ;; + esac ;; + -h|--hostname) + case "$2" in + "") shift 2 ;; + *) HOSTNAME=$2 ; shift 2 ;; + esac ;; + --) shift ; break ;; + *) echo "Internal error!" ; exit 1 ;; + esac +done + +echo "Executing SONIC Organization Extensions" + +## Place your Organization specific code / scipts here ... + + +echo "SONIC Organization Extensions - Done" + diff --git a/rules/config b/rules/config index 2d6e6a82b6a8..ad13ad047e04 100644 --- a/rules/config +++ b/rules/config @@ -48,3 +48,6 @@ SONIC_ROUTING_STACK = quagga # ENABLE_SYNCD_RPC - build docker-syncd with rpc packages for testing purposes. # Uncomment to enable: # ENABLE_SYNCD_RPC = y + +# Enable Origanization Extensions - Specific to the deployment scenarios of the Organization +ENABLE_ORGANIZATION_EXTENSIONS = y diff --git a/slave.mk b/slave.mk index caed4279dcc3..4e76661588fb 100644 --- a/slave.mk +++ b/slave.mk @@ -99,6 +99,7 @@ $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)") $(info "SONIC_CONFIG_DEBUG" : "$(SONIC_CONFIG_DEBUG)") $(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)") $(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)") +$(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)") $(info ) ############################################################################### @@ -388,6 +389,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export image_type="$($*_IMAGE_TYPE)" export sonicadmin_user="$(USERNAME)" export sonic_asic_platform="$(CONFIGURED_PLATFORM)" + export enable_organization_extensions="$(ENABLE_ORGANIZATION_EXTENSIONS)" export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)" export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))" From 72f5d6bcb76dbec35e22c496af776a8b8da35a1a Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Tue, 19 Sep 2017 19:29:00 -0700 Subject: [PATCH 0786/1833] [interfaces]: Change MTU value to 9100 (#967) * Updated MTU to the widely used value with other devices --- files/image_config/interfaces/interfaces.j2 | 6 +- .../tests/sample_output/interfaces | 64 +++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index f96c0740c572..fe1fac2cc77e 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -50,7 +50,7 @@ iface eth0 inet dhcp {% for (name, prefix) in INTERFACE %} allow-hotplug {{ name }} iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static - mtu 9216 + mtu 9100 address {{ prefix | ip }} netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # @@ -61,7 +61,7 @@ iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static {% for member in VLAN[vlan]['members'] %} allow-hotplug {{ member }} iface {{ member }} inet manual - pre-up ifconfig {{ member }} up mtu 9216 + pre-up ifconfig {{ member }} up mtu 9100 post-up brctl addif {{ vlan }} {{ member }} || true post-down ifconfig {{ member }} down # @@ -102,7 +102,7 @@ iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static {% for (name, prefix) in PORTCHANNEL_INTERFACE.keys() | sort %} allow-hotplug {{ name }} iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static - mtu 9216 + mtu 9100 address {{ prefix | ip }} netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index aed23f8a5c26..9f262a7f6b05 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -42,145 +42,145 @@ iface eth0 inet6 static # "|| true" is added to suppress the error when interface is already a member of VLAN allow-hotplug fortyGigE0/4 iface fortyGigE0/4 inet manual - pre-up ifconfig fortyGigE0/4 up mtu 9216 + pre-up ifconfig fortyGigE0/4 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/4 || true post-down ifconfig fortyGigE0/4 down # allow-hotplug fortyGigE0/8 iface fortyGigE0/8 inet manual - pre-up ifconfig fortyGigE0/8 up mtu 9216 + pre-up ifconfig fortyGigE0/8 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/8 || true post-down ifconfig fortyGigE0/8 down # allow-hotplug fortyGigE0/12 iface fortyGigE0/12 inet manual - pre-up ifconfig fortyGigE0/12 up mtu 9216 + pre-up ifconfig fortyGigE0/12 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/12 || true post-down ifconfig fortyGigE0/12 down # allow-hotplug fortyGigE0/16 iface fortyGigE0/16 inet manual - pre-up ifconfig fortyGigE0/16 up mtu 9216 + pre-up ifconfig fortyGigE0/16 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/16 || true post-down ifconfig fortyGigE0/16 down # allow-hotplug fortyGigE0/20 iface fortyGigE0/20 inet manual - pre-up ifconfig fortyGigE0/20 up mtu 9216 + pre-up ifconfig fortyGigE0/20 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/20 || true post-down ifconfig fortyGigE0/20 down # allow-hotplug fortyGigE0/24 iface fortyGigE0/24 inet manual - pre-up ifconfig fortyGigE0/24 up mtu 9216 + pre-up ifconfig fortyGigE0/24 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/24 || true post-down ifconfig fortyGigE0/24 down # allow-hotplug fortyGigE0/28 iface fortyGigE0/28 inet manual - pre-up ifconfig fortyGigE0/28 up mtu 9216 + pre-up ifconfig fortyGigE0/28 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/28 || true post-down ifconfig fortyGigE0/28 down # allow-hotplug fortyGigE0/32 iface fortyGigE0/32 inet manual - pre-up ifconfig fortyGigE0/32 up mtu 9216 + pre-up ifconfig fortyGigE0/32 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/32 || true post-down ifconfig fortyGigE0/32 down # allow-hotplug fortyGigE0/36 iface fortyGigE0/36 inet manual - pre-up ifconfig fortyGigE0/36 up mtu 9216 + pre-up ifconfig fortyGigE0/36 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/36 || true post-down ifconfig fortyGigE0/36 down # allow-hotplug fortyGigE0/40 iface fortyGigE0/40 inet manual - pre-up ifconfig fortyGigE0/40 up mtu 9216 + pre-up ifconfig fortyGigE0/40 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/40 || true post-down ifconfig fortyGigE0/40 down # allow-hotplug fortyGigE0/44 iface fortyGigE0/44 inet manual - pre-up ifconfig fortyGigE0/44 up mtu 9216 + pre-up ifconfig fortyGigE0/44 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/44 || true post-down ifconfig fortyGigE0/44 down # allow-hotplug fortyGigE0/48 iface fortyGigE0/48 inet manual - pre-up ifconfig fortyGigE0/48 up mtu 9216 + pre-up ifconfig fortyGigE0/48 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/48 || true post-down ifconfig fortyGigE0/48 down # allow-hotplug fortyGigE0/52 iface fortyGigE0/52 inet manual - pre-up ifconfig fortyGigE0/52 up mtu 9216 + pre-up ifconfig fortyGigE0/52 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/52 || true post-down ifconfig fortyGigE0/52 down # allow-hotplug fortyGigE0/56 iface fortyGigE0/56 inet manual - pre-up ifconfig fortyGigE0/56 up mtu 9216 + pre-up ifconfig fortyGigE0/56 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/56 || true post-down ifconfig fortyGigE0/56 down # allow-hotplug fortyGigE0/60 iface fortyGigE0/60 inet manual - pre-up ifconfig fortyGigE0/60 up mtu 9216 + pre-up ifconfig fortyGigE0/60 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/60 || true post-down ifconfig fortyGigE0/60 down # allow-hotplug fortyGigE0/64 iface fortyGigE0/64 inet manual - pre-up ifconfig fortyGigE0/64 up mtu 9216 + pre-up ifconfig fortyGigE0/64 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/64 || true post-down ifconfig fortyGigE0/64 down # allow-hotplug fortyGigE0/68 iface fortyGigE0/68 inet manual - pre-up ifconfig fortyGigE0/68 up mtu 9216 + pre-up ifconfig fortyGigE0/68 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/68 || true post-down ifconfig fortyGigE0/68 down # allow-hotplug fortyGigE0/72 iface fortyGigE0/72 inet manual - pre-up ifconfig fortyGigE0/72 up mtu 9216 + pre-up ifconfig fortyGigE0/72 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/72 || true post-down ifconfig fortyGigE0/72 down # allow-hotplug fortyGigE0/76 iface fortyGigE0/76 inet manual - pre-up ifconfig fortyGigE0/76 up mtu 9216 + pre-up ifconfig fortyGigE0/76 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/76 || true post-down ifconfig fortyGigE0/76 down # allow-hotplug fortyGigE0/80 iface fortyGigE0/80 inet manual - pre-up ifconfig fortyGigE0/80 up mtu 9216 + pre-up ifconfig fortyGigE0/80 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/80 || true post-down ifconfig fortyGigE0/80 down # allow-hotplug fortyGigE0/84 iface fortyGigE0/84 inet manual - pre-up ifconfig fortyGigE0/84 up mtu 9216 + pre-up ifconfig fortyGigE0/84 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/84 || true post-down ifconfig fortyGigE0/84 down # allow-hotplug fortyGigE0/88 iface fortyGigE0/88 inet manual - pre-up ifconfig fortyGigE0/88 up mtu 9216 + pre-up ifconfig fortyGigE0/88 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/88 || true post-down ifconfig fortyGigE0/88 down # allow-hotplug fortyGigE0/92 iface fortyGigE0/92 inet manual - pre-up ifconfig fortyGigE0/92 up mtu 9216 + pre-up ifconfig fortyGigE0/92 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/92 || true post-down ifconfig fortyGigE0/92 down # allow-hotplug fortyGigE0/96 iface fortyGigE0/96 inet manual - pre-up ifconfig fortyGigE0/96 up mtu 9216 + pre-up ifconfig fortyGigE0/96 up mtu 9100 post-up brctl addif Vlan1000 fortyGigE0/96 || true post-down ifconfig fortyGigE0/96 down # @@ -220,49 +220,49 @@ iface Vlan1000 inet static # Portchannel interfaces allow-hotplug PortChannel01 iface PortChannel01 inet static - mtu 9216 + mtu 9100 address 10.0.0.56 netmask 255.255.255.254 # allow-hotplug PortChannel01 iface PortChannel01 inet6 static - mtu 9216 + mtu 9100 address fc00::71 netmask 126 # allow-hotplug PortChannel02 iface PortChannel02 inet static - mtu 9216 + mtu 9100 address 10.0.0.58 netmask 255.255.255.254 # allow-hotplug PortChannel02 iface PortChannel02 inet6 static - mtu 9216 + mtu 9100 address fc00::75 netmask 126 # allow-hotplug PortChannel03 iface PortChannel03 inet static - mtu 9216 + mtu 9100 address 10.0.0.60 netmask 255.255.255.254 # allow-hotplug PortChannel03 iface PortChannel03 inet6 static - mtu 9216 + mtu 9100 address fc00::79 netmask 126 # allow-hotplug PortChannel04 iface PortChannel04 inet static - mtu 9216 + mtu 9100 address 10.0.0.62 netmask 255.255.255.254 # allow-hotplug PortChannel04 iface PortChannel04 inet6 static - mtu 9216 + mtu 9100 address fc00::7d netmask 126 # From 0c6fba69935907d92ba6b45dd19fa84df9c9c1a5 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 20 Sep 2017 12:39:36 -0700 Subject: [PATCH 0787/1833] [utilities]: Update sonic-utilities (#968) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index b48573fce38a..0338eee64574 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit b48573fce38ad476fd9dccb11f57099085cc87d5 +Subproject commit 0338eee645741937603c5686bb86b22cb5ab5322 From d117f093430de0915b3b59dffe2835ab470aeaf5 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 20 Sep 2017 15:18:11 -0700 Subject: [PATCH 0788/1833] [Broadcom]: Update OpenNSL modules (#970) - Increase the rx_buffer_size to 9238, the same MTU szie as in the hardware --- platform/broadcom/sdk.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 701994c81073..04d540c64582 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,4 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.3_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3_amd64.deb?sv=2015-04-05&sr=b&sig=Qjb29DKq2%2FAvRJAju%2FU91Gu5orJC0R5LTJ%2BwYm%2BYFiA%3D&se=2031-05-25T18%3A36%3A33Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.3-1_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3-1_amd64.deb?sv=2015-04-05&sr=b&sig=Uepf4z2wOadX%2F6OR%2BCoQzjv2tkwEZ2AspBiuo5sb25s%3D&se=2031-05-30T19%3A37%3A19Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) From 763205ff7d767c77ccb3945b7cd64f176482e648 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Thu, 21 Sep 2017 09:55:50 +0300 Subject: [PATCH 0789/1833] [config]: Fix management interface configuration (#966) * [config]: Fix management interface configuration * [config]: Fix management interface configuration * Fix comments --- files/image_config/interfaces/interfaces.j2 | 8 ++++---- .../tests/sample_output/interfaces | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index fe1fac2cc77e..6521eb7a67e1 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -27,14 +27,14 @@ iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} ########## management network policy routing rules # management port up rules - up ip route add default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default - up ip rule add from {{ prefix | ip }}/32 table default + up ip {{ '-4' if prefix | ipv4 else '-6' }} route add default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default + up ip {{ '-4' if prefix | ipv4 else '-6' }} rule add from {{ prefix | ip }}/{{ '32' if prefix | ipv4 else '128' }} table default {% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} up ip rule add to {{ route }} table default {% endfor %} # management port down rules - down ip route delete default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default - down ip rule delete from {{ prefix | ip }}/32 table default + down ip {{ '-4' if prefix | ipv4 else '-6' }} route delete default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default + down ip {{ '-4' if prefix | ipv4 else '-6' }} rule delete from {{ prefix | ip }}/{{ '32' if prefix | ipv4 else '128' }} table default {% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} down ip rule delete to {{ route }} table default {% endfor %} diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index 9f262a7f6b05..ec3b6f740bc4 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -22,21 +22,21 @@ iface eth0 inet static netmask 255.255.255.0 ########## management network policy routing rules # management port up rules - up ip route add default via 10.0.0.1 dev eth0 table default - up ip rule add from 10.0.0.100/32 table default + up ip -4 route add default via 10.0.0.1 dev eth0 table default + up ip -4 rule add from 10.0.0.100/32 table default # management port down rules - down ip route delete default via 10.0.0.1 dev eth0 table default - down ip rule delete from 10.0.0.100/32 table default + down ip -4 route delete default via 10.0.0.1 dev eth0 table default + down ip -4 rule delete from 10.0.0.100/32 table default iface eth0 inet6 static address 2603:10e2:0:2902::8 netmask 64 ########## management network policy routing rules # management port up rules - up ip route add default via 2603:10e2:0:2902::1 dev eth0 table default - up ip rule add from 2603:10e2:0:2902::8/32 table default + up ip -6 route add default via 2603:10e2:0:2902::1 dev eth0 table default + up ip -6 rule add from 2603:10e2:0:2902::8/128 table default # management port down rules - down ip route delete default via 2603:10e2:0:2902::1 dev eth0 table default - down ip rule delete from 2603:10e2:0:2902::8/32 table default + down ip -6 route delete default via 2603:10e2:0:2902::1 dev eth0 table default + down ip -6 rule delete from 2603:10e2:0:2902::8/128 table default # # The switch front panel interfaces # "|| true" is added to suppress the error when interface is already a member of VLAN From e0513d213bb6fa014262d24be265af93bba495e9 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 21 Sep 2017 09:17:29 -0700 Subject: [PATCH 0790/1833] lacp runner will send lacp update right after it received SIGINT (#969) --- ...r-will-send-lacp-update-right-after-.patch | 98 +++++++++++++++++++ src/libteam/Makefile | 1 + 2 files changed, 99 insertions(+) create mode 100644 src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch diff --git a/src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch b/src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch new file mode 100644 index 000000000000..1cae8bad21aa --- /dev/null +++ b/src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch @@ -0,0 +1,98 @@ +From 417e9dfdccbbee2cf86e46e994e8ece3433b46a4 Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Wed, 20 Sep 2017 00:34:07 +0000 +Subject: [PATCH] [teamd] lacp runner will send lacp update right after it + received SIGINT signal + +--- + teamd/teamd.c | 1 + + teamd/teamd.h | 3 +++ + teamd/teamd_events.c | 13 +++++++++++++ + teamd/teamd_runner_lacp.c | 10 ++++++++++ + 4 files changed, 27 insertions(+) + +diff --git a/teamd/teamd.c b/teamd/teamd.c +index aac2511..c987333 100644 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -386,6 +386,7 @@ static int teamd_run_loop_run(struct teamd_context *ctx) + case 'q': + if (quit_in_progress) + return -EBUSY; ++ teamd_refresh_ports(ctx); + err = teamd_flush_ports(ctx); + if (err) + return err; +diff --git a/teamd/teamd.h b/teamd/teamd.h +index 5dbfb9b..ef0fb1c 100644 +--- a/teamd/teamd.h ++++ b/teamd/teamd.h +@@ -189,11 +189,14 @@ struct teamd_event_watch_ops { + struct teamd_port *tdport, void *priv); + int (*port_ifname_changed)(struct teamd_context *ctx, + struct teamd_port *tdport, void *priv); ++ void (*refresh)(struct teamd_context *ctx, ++ struct teamd_port *tdport, void *priv); + int (*option_changed)(struct teamd_context *ctx, + struct team_option *option, void *priv); + char *option_changed_match_name; + }; + ++void teamd_refresh_ports(struct teamd_context *ctx); + int teamd_event_port_added(struct teamd_context *ctx, + struct teamd_port *tdport); + void teamd_event_port_removed(struct teamd_context *ctx, +diff --git a/teamd/teamd_events.c b/teamd/teamd_events.c +index 1a95974..5c2ef56 100644 +--- a/teamd/teamd_events.c ++++ b/teamd/teamd_events.c +@@ -34,6 +34,19 @@ struct event_watch_item { + void *priv; + }; + ++void teamd_refresh_ports(struct teamd_context *ctx) ++{ ++ struct teamd_port *tdport; ++ struct event_watch_item *watch; ++ ++ teamd_for_each_tdport(tdport, ctx) { ++ list_for_each_node_entry(watch, &ctx->event_watch_list, list) { ++ if (!watch->ops->refresh) continue; ++ watch->ops->refresh(ctx, tdport, watch->priv); ++ } ++ } ++} ++ + int teamd_event_port_added(struct teamd_context *ctx, + struct teamd_port *tdport) + { +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 9c77fae..e38c291 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -1383,12 +1383,22 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx, + return lacp_port_link_update(lacp_port); + } + ++static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_port *tdport, void *priv) ++{ ++ struct lacp *lacp = priv; ++ ++ struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); ++ if (lacp_port_selected(lacp_port)) ++ (void) lacpdu_send(lacp_port); ++} ++ + static const struct teamd_event_watch_ops lacp_event_watch_ops = { + .hwaddr_changed = lacp_event_watch_hwaddr_changed, + .port_added = lacp_event_watch_port_added, + .port_removed = lacp_event_watch_port_removed, + .port_changed = lacp_event_watch_port_changed, + .admin_state_changed = lacp_event_watch_admin_state_changed, ++ .refresh = lacp_event_watch_refresh, + }; + + static int lacp_carrier_init(struct teamd_context *ctx, struct lacp *lacp) +-- +2.7.4 + diff --git a/src/libteam/Makefile b/src/libteam/Makefile index 283a6b56fbec..c84250749477 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -17,6 +17,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # 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 popd # Obtain debian packaging From 0d978b5b21bb6a2876aa34e0b7334536c71a63f4 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 21 Sep 2017 12:31:02 -0700 Subject: [PATCH 0791/1833] [sairedis]: update sairedis submodule (#974) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 3cbff4026f2b..79bd891ca533 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 3cbff4026f2bb1afda1c5965db60d30666980675 +Subproject commit 79bd891ca5337222701cd51ee5b266d2e485c492 From 69ff2241699ad37e31f7c2953d748ab7397f9d80 Mon Sep 17 00:00:00 2001 From: Polly Hsu Date: Fri, 22 Sep 2017 03:37:22 +0800 Subject: [PATCH 0792/1833] [device/accton]: Add a new supported device, AS7312-54X (#955) * [device/accton]: Add a new supported device and platform, AS7312-54X Switch Vendor: Edge-core Switch SKU: AS7312-54X ASIC Vendor: Broadcom Swich ASIC: Tomahawk Port Configuration: 48x25G + 6x100G SONiC Image: SONiC-ONIE-Broadcom Signed-off-by: polly_hsu@accton.com * Update port_config.ini * Update sai.profile * Update installer.conf * Update led_proc_init.soc * Update minigraph.xml --- .../Accton-AS7312-54X/port_config.ini | 55 + .../Accton-AS7312-54X/sai.profile | 1 + .../installer.conf | 3 + .../led_proc_init.soc | 79 ++ .../x86_64-accton_as7312_54x-r0/minigraph.xml | 1184 +++++++++++++++++ 5 files changed, 1322 insertions(+) create mode 100644 device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/port_config.ini create mode 100644 device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile create mode 100644 device/accton/x86_64-accton_as7312_54x-r0/installer.conf create mode 100755 device/accton/x86_64-accton_as7312_54x-r0/led_proc_init.soc create mode 100644 device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml diff --git a/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/port_config.ini b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/port_config.ini new file mode 100644 index 000000000000..8eeb6a993cb5 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/port_config.ini @@ -0,0 +1,55 @@ +# name lanes alias +Ethernet0 41 twentyfiveGigE1 +Ethernet1 42 twentyfiveGigE2 +Ethernet2 43 twentyfiveGigE3 +Ethernet3 44 twentyfiveGigE4 +Ethernet4 49 twentyfiveGigE5 +Ethernet5 50 twentyfiveGigE6 +Ethernet6 51 twentyfiveGigE7 +Ethernet7 52 twentyfiveGigE8 +Ethernet8 53 twentyfiveGigE9 +Ethernet9 54 twentyfiveGigE10 +Ethernet10 55 twentyfiveGigE11 +Ethernet11 56 twentyfiveGigE12 +Ethernet12 65 twentyfiveGigE13 +Ethernet13 66 twentyfiveGigE14 +Ethernet14 67 twentyfiveGigE15 +Ethernet15 68 twentyfiveGigE16 +Ethernet16 33 twentyfiveGigE17 +Ethernet17 34 twentyfiveGigE18 +Ethernet18 35 twentyfiveGigE19 +Ethernet19 36 twentyfiveGigE20 +Ethernet20 37 twentyfiveGigE21 +Ethernet21 38 twentyfiveGigE22 +Ethernet22 39 twentyfiveGigE23 +Ethernet23 40 twentyfiveGigE24 +Ethernet24 69 twentyfiveGigE25 +Ethernet25 70 twentyfiveGigE26 +Ethernet26 71 twentyfiveGigE27 +Ethernet27 72 twentyfiveGigE28 +Ethernet28 81 twentyfiveGigE29 +Ethernet29 82 twentyfiveGigE30 +Ethernet30 83 twentyfiveGigE31 +Ethernet31 84 twentyfiveGigE32 +Ethernet32 85 twentyfiveGigE33 +Ethernet33 86 twentyfiveGigE34 +Ethernet34 87 twentyfiveGigE35 +Ethernet35 88 twentyfiveGigE36 +Ethernet36 97 twentyfiveGigE37 +Ethernet37 98 twentyfiveGigE38 +Ethernet38 99 twentyfiveGigE39 +Ethernet39 100 twentyfiveGigE40 +Ethernet40 101 twentyfiveGigE41 +Ethernet41 102 twentyfiveGigE42 +Ethernet42 103 twentyfiveGigE43 +Ethernet43 104 twentyfiveGigE44 +Ethernet44 105 twentyfiveGigE45 +Ethernet45 106 twentyfiveGigE46 +Ethernet46 107 twentyfiveGigE47 +Ethernet47 108 twentyfiveGigE48 +Ethernet48 5,6,7,8 hundredGigE49 +Ethernet52 1,2,3,4 hundredGigE50 +Ethernet56 109,110,111,112 hundredGigE51 +Ethernet60 21,22,23,24 hundredGigE52 +Ethernet64 9,10,11,12 hundredGigE53 +Ethernet68 117,118,119,120 hundredGigE54 diff --git a/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile new file mode 100644 index 000000000000..f239b822834b --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7312-48x25G+6x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7312_54x-r0/installer.conf b/device/accton/x86_64-accton_as7312_54x-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7312_54x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7312_54x-r0/led_proc_init.soc new file mode 100755 index 000000000000..3074649497e0 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/led_proc_init.soc @@ -0,0 +1,79 @@ +# accton_as7312_54x 48x25G+6x100G SDK port LED macro init SOC +s CMIC_LEDUP0_DATA_RAM 0 +s CMIC_LEDUP1_DATA_RAM 0 + +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=63 REMAP_PORT_1=63 REMAP_PORT_2=63 REMAP_PORT_3=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=63 REMAP_PORT_5=63 REMAP_PORT_6=63 REMAP_PORT_7=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=27 REMAP_PORT_9=26 REMAP_PORT_10=25 REMAP_PORT_11=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=63 REMAP_PORT_17=63 REMAP_PORT_18=63 REMAP_PORT_19=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=31 REMAP_PORT_21=30 REMAP_PORT_22=29 REMAP_PORT_23=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=15 REMAP_PORT_25=14 REMAP_PORT_26=13 REMAP_PORT_27=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=19 REMAP_PORT_29=18 REMAP_PORT_30=17 REMAP_PORT_31=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 REMAP_PORT_33=63 REMAP_PORT_34=63 REMAP_PORT_35=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=63 REMAP_PORT_37=63 REMAP_PORT_38=63 REMAP_PORT_39=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=35 REMAP_PORT_41=34 REMAP_PORT_42=33 REMAP_PORT_43=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 REMAP_PORT_45=63 REMAP_PORT_46=63 REMAP_PORT_47=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=23 REMAP_PORT_49=22 REMAP_PORT_50=21 REMAP_PORT_51=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=19 REMAP_PORT_1=18 REMAP_PORT_2=17 REMAP_PORT_3=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=23 REMAP_PORT_5=22 REMAP_PORT_6=21 REMAP_PORT_7=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=3 REMAP_PORT_9=2 REMAP_PORT_10=1 REMAP_PORT_11=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=7 REMAP_PORT_17=6 REMAP_PORT_18=5 REMAP_PORT_19=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 REMAP_PORT_21=10 REMAP_PORT_22=9 REMAP_PORT_23=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=63 REMAP_PORT_25=63 REMAP_PORT_26=63 REMAP_PORT_27=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=63 REMAP_PORT_29=63 REMAP_PORT_30=63 REMAP_PORT_31=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=15 REMAP_PORT_33=14 REMAP_PORT_34=13 REMAP_PORT_35=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=27 REMAP_PORT_37=26 REMAP_PORT_38=25 REMAP_PORT_39=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=63 REMAP_PORT_41=63 REMAP_PORT_42=63 REMAP_PORT_43=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 REMAP_PORT_45=63 REMAP_PORT_46=63 REMAP_PORT_47=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=31 REMAP_PORT_49=30 REMAP_PORT_50=29 REMAP_PORT_51=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=35 REMAP_PORT_53=34 REMAP_PORT_54=33 REMAP_PORT_55=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=63 REMAP_PORT_57=63 REMAP_PORT_58=63 REMAP_PORT_59=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=63 REMAP_PORT_62=63 REMAP_PORT_63=63 + +led 0 stop +led 0 prog \ + 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 7E \ + 02 FB 42 24 06 F9 D2 00 74 1E 02 F9 42 03 67 AC \ + 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 \ + 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC \ + 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 \ + 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 \ + 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 \ + F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 \ + 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF \ + 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 \ + 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC \ + 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 \ + 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 \ + 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 98 67 \ + 84 57 80 18 71 EB 67 84 67 98 57 67 84 67 84 57 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 start +led auto on + +led 1 stop +led 1 prog \ + 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 7E \ + 02 FB 42 24 06 F9 D2 00 74 1E 02 F9 42 03 67 AC \ + 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 \ + 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC \ + 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 \ + 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 \ + 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 \ + F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 \ + 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF \ + 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 \ + 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC \ + 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 \ + 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 \ + 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 98 67 \ + 84 57 80 18 71 EB 67 84 67 98 57 67 84 67 84 57 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 1 start +led auto on diff --git a/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml new file mode 100644 index 000000000000..8547ceacbc58 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml @@ -0,0 +1,1184 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet1 + 10.0.0.2/31 + + + + Ethernet2 + 10.0.0.4/31 + + + + Ethernet3 + 10.0.0.6/31 + + + + Ethernet4 + 10.0.0.8/31 + + + + Ethernet5 + 10.0.0.10/31 + + + + Ethernet6 + 10.0.0.12/31 + + + + Ethernet7 + 10.0.0.14/31 + + + + Ethernet8 + 10.0.0.16/31 + + + + Ethernet9 + 10.0.0.18/31 + + + + Ethernet10 + 10.0.0.20/31 + + + + Ethernet11 + 10.0.0.22/31 + + + + Ethernet12 + 10.0.0.24/31 + + + + Ethernet13 + 10.0.0.26/31 + + + + Ethernet14 + 10.0.0.28/31 + + + + Ethernet15 + 10.0.0.30/31 + + + + Ethernet16 + 10.0.0.32/31 + + + + Ethernet17 + 10.0.0.34/31 + + + + Ethernet18 + 10.0.0.36/31 + + + + Ethernet19 + 10.0.0.38/31 + + + + Ethernet20 + 10.0.0.40/31 + + + + Ethernet21 + 10.0.0.42/31 + + + + Ethernet22 + 10.0.0.44/31 + + + + Ethernet23 + 10.0.0.46/31 + + + + Ethernet24 + 10.0.0.48/31 + + + + Ethernet25 + 10.0.0.50/31 + + + + Ethernet26 + 10.0.0.52/31 + + + + Ethernet27 + 10.0.0.54/31 + + + + Ethernet28 + 10.0.0.56/31 + + + + Ethernet29 + 10.0.0.58/31 + + + + Ethernet30 + 10.0.0.60/31 + + + + Ethernet31 + 10.0.0.62/31 + + + + Ethernet32 + 10.0.0.64/31 + + + + Ethernet33 + 10.0.0.66/31 + + + + Ethernet34 + 10.0.0.68/31 + + + + Ethernet35 + 10.0.0.70/31 + + + + Ethernet36 + 10.0.0.72/31 + + + + Ethernet37 + 10.0.0.74/31 + + + + Ethernet38 + 10.0.0.76/31 + + + + Ethernet39 + 10.0.0.78/31 + + + + Ethernet40 + 10.0.0.80/31 + + + + Ethernet41 + 10.0.0.82/31 + + + + Ethernet42 + 10.0.0.84/31 + + + + Ethernet43 + 10.0.0.86/31 + + + + Ethernet44 + 10.0.0.88/31 + + + + Ethernet45 + 10.0.0.90/31 + + + + Ethernet46 + 10.0.0.92/31 + + + + Ethernet47 + 10.0.0.94/31 + + + + Ethernet48 + 10.0.0.96/31 + + + + Ethernet52 + 10.0.0.98/31 + + + + Ethernet56 + 10.0.0.100/31 + + + + Ethernet60 + 10.0.0.102/31 + + + + Ethernet64 + 10.0.0.104/31 + + + + Ethernet68 + 10.0.0.106/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet1 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet2 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet3 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet5 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet6 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet7 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet9 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet10 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet11 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet13 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet14 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet15 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet17 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet18 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet19 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet21 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet22 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet23 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet25 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet26 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet27 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet29 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet30 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet31 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Accton-AS7312-54X + + + + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + switch1 + Accton-AS7312-54X +
From 7a9894a99cc5992f96b7f046032de5bdb8072806 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 21 Sep 2017 13:19:44 -0700 Subject: [PATCH 0793/1833] [Broadcom]: Update libsai version to 3.0.3.2-2 (#973) Update Ingrasys/Accton config.bcm files --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 7118da438b22..ca1c76a32ff8 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2_amd64.deb?sv=2015-04-05&sr=b&sig=d50c3WTnlQGVgybK4RyNFWqvXPHPpAotNSongSABpWg%3D&se=2031-05-25T18%3A52%3A35Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-2_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-2_amd64.deb?sv=2015-04-05&sr=b&sig=A9GjUgI9%2B7kRQHsCFqH07iRQLhdkwSH5tvSXepb3b%2BA%3D&se=2031-05-30T22%3A47%3A47Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-2_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2_amd64.deb?sv=2015-04-05&sr=b&sig=psB%2BzhbludRstCuuGncrMOg5oETOY13U26yEXyR2yWc%3D&se=2031-05-25T18%3A50%3A38Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-2_amd64.deb?sv=2015-04-05&sr=b&sig=lDIwnDNHIA0WKc5ggTA4x3pVmBIM%2Bdib0hR7H1qyTe0%3D&se=2031-05-30T22%3A48%3A07Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 0f6c8c14e8ed38bcceb6bc31c990dc0a177e0ceb Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 21 Sep 2017 14:56:16 -0700 Subject: [PATCH 0794/1833] [teamd]: Remove deprecated blocking logic before starting teamd (#976) With the fixes in /etc/network/interfaces file, host interfaces could be added into the corresponding LAGs automatically. Thus, the logic of checking if port initialization is ready is no longer needed. Signed-off-by: Shu0T1an ChenG --- dockers/docker-teamd/teamd.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/dockers/docker-teamd/teamd.sh b/dockers/docker-teamd/teamd.sh index 37b617150a04..2b6d9fb53970 100755 --- a/dockers/docker-teamd/teamd.sh +++ b/dockers/docker-teamd/teamd.sh @@ -24,15 +24,5 @@ function clean_up { trap clean_up SIGTERM SIGKILL -# Before teamd could automatically add newly created host interfaces into the -# LAG, this workaround will wait until the host interfaces are created and then -# the processes will be started. -while true; do - # Check if front-panel ports are configured - result=`echo -en "SELECT 0\nHGETALL PORT_TABLE:ConfigDone" | redis-cli | sed -n 3p` - if [ "$result" == "0" ]; then - start_app - read - fi - sleep 1 -done +start_app +read From bec99f257a0af3fe60e441704cf5b43377249ec6 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 21 Sep 2017 17:31:39 -0700 Subject: [PATCH 0795/1833] Disable snmpd module disk_hw, so no syslog messages about unavailable disks (#977) * Revert "snmpd ignores unavailable disks (#607)" This reverts commit d70e9734966e542e0a0ed0f29eb5d128931f7b8f. * Disable snmpd module disk_hw, so no syslog messages about unavailable disks Signed-off-by: Qi Luo * Strip white spaces Signed-off-by: Qi Luo --- dockers/docker-snmp-sv2/snmpd.conf.j2 | 11 +++-------- dockers/docker-snmp-sv2/supervisord.conf | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index 246924cfd387..b46871dfd6f8 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -28,7 +28,7 @@ agentAddress udp:{{ prefix | ip }}:161 {% endif %} {% endfor %} {% else %} -# Listen on all addresses as mgmt ip not specified +# Listen on all addresses as mgmt ip not specified agentAddress udp:161 {% endif %} @@ -61,7 +61,7 @@ sysServices 72 # # Process Monitoring # -# TODO: should we enable snmp based monitoring of sswsyncd and other processes? +# todo: should we enable snmp based monitoring of sswsyncd and other processes? # At least one 'sendmail' process, but no more than 10 #proc sendmail 10 1 @@ -76,12 +76,7 @@ sysServices 72 # 10MBs required on root disk, 5% free on /var, 10% free on all other disks disk / 10000 disk /var 5% - -# Note: includeAllDisks will conflict with ignoredisk -# TODO: /root/* are introduced by aufs union mount, happening in initramfs stage. Clean them in the mount list. -ignoredisk /root/host -ignoredisk /root/dev -ignoredisk /root/dev/pts +includeAllDisks 10% # Walk the UCD-SNMP-MIB::dskTable to see the resulting output # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index 60313c57f813..d80579506100 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:snmpd] -command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip -p /run/snmpd.pid +command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip,disk_hw -p /run/snmpd.pid priority=3 autostart=false autorestart=false From 1ac10dfc6f42836730d986e3966a05e98b26bc9e Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 22 Sep 2017 00:52:15 -0700 Subject: [PATCH 0796/1833] [snmp]: Update sonic-snmpagent submodule (#978) Introducing the fix for SAI 1.0 FDB entry fix --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 186a4f65fbdd..45e4e7826bf3 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 186a4f65fbdde9d277d0aeef562e1fc196266fdb +Subproject commit 45e4e7826bf34850d8cc12861259c5f388e1102e From b5eb0c2ce2f0fd080c2d4f9bc05f0206a26e59f5 Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Fri, 22 Sep 2017 00:57:23 -0700 Subject: [PATCH 0797/1833] [Makefile] Allowing interactive session with the slave docker-container (#903) * Fixing a couple of issues to enable FRR to run with latest SONiC code. * Adjusting FRR's jinja template to meet latest sonic-cfgen requirements. Basically, i'm just extending #448 changes into FRR. * Eliminate FRR's integrated-config file to prevent daemons from bypassing their own config files. FRR daemons now default to an integrated-config file for config-parsing purposes. But we are still interested in having each daemon looking in their specific config file (bgpd.conf, zebra.conf, etc). So here i'm just deleting this integrating-config file to prevent FRR from running from a bogus config-file. * Allows interactive session with the slave docker-container after conclusion of the building process. Proposed changes provide a more direct access to the building pipeline, by allowing users to launch consecutive compilation tasks from the same slave container. --- Makefile | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 7240237c2744..d672edc6836a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,18 @@ ############################################################################### ## Wrapper for starting make inside sonic-slave container +# +# Supported parameters: +# +# * PLATFORM: Specific platform we wish to build images for. +# * BUILD_NUMBER: Desired version-number to pass to the building-system. +# * ENABLE_DHCP_GRAPH_SERVICE: Enables get-graph service to fetch minigraph files +# through http. +# * SHUTDOWN_BGP_ON_START: Sets admin-down state for all bgp peerings after restart. +# * SONIC_ENABLE_SYNCD_RPC: Enables rpc-based syncd builds. +# * USERNAME: Desired username -- default at rules/config +# * PASSWORD: Desired password -- default at rules/config +# * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes. +# ############################################################################### SHELL = /bin/bash @@ -37,6 +50,16 @@ DOCKER_BUILD = docker build --no-cache \ sonic-slave && \ docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG) +SONIC_BUILD_INSTRUCTION := make \ + -f slave.mk \ + PLATFORM=$(PLATFORM) \ + BUILD_NUMBER=$(BUILD_NUMBER) \ + ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ + SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ + SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ + PASSWORD=$(PASSWORD) \ + USERNAME=$(USERNAME) + .PHONY: sonic-slave-build sonic-slave-bash .DEFAULT_GOAL := all @@ -48,16 +71,11 @@ DOCKER_BUILD = docker build --no-cache \ @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } - @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) make \ - -f slave.mk \ - PLATFORM=$(PLATFORM) \ - BUILD_NUMBER=$(BUILD_NUMBER) \ - ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ - SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ - SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ - PASSWORD=$(PASSWORD) \ - USERNAME=$(USERNAME) \ - $@ +ifeq "$(KEEP_SLAVE_ON)" "yes" + @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" +else + @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) $(SONIC_BUILD_INSTRUCTION) $@ +endif sonic-slave-build : $(DOCKER_BASE_BUILD) From f570616b0dca24d0c38550e5c946e7e9bf00b342 Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Sat, 23 Sep 2017 03:58:10 +0800 Subject: [PATCH 0798/1833] [Ingrasys]: Change hwmon kernel modules installation order (#980) change hwmon kernel modules installation order on S8810-32Q/S8900-54XC/S8900-64XC/S9100-32X change hwmon kernel modules installation order in i2c_utils.sh and update related fancontrol file Check the hwmon kernel module insertion order in /sys/class/hwmon/hwmonX. w83795 should be in /sys/class/hwmon/hwmon1, and jc42 should be the last one. change hwmon kernel modules installation order on S8810-32Q/S8900-54XC/S8900-64XC/S9100-32X --- .../x86_64-ingrasys_s8810_32q-r0/fancontrol | 17 ++++++++--------- .../x86_64-ingrasys_s8900_54xc-r0/fancontrol | 17 ++++++++--------- .../x86_64-ingrasys_s8900_64xc-r0/fancontrol | 16 ++++++++-------- .../x86_64-ingrasys_s9100-r0/fancontrol | 17 ++++++++--------- .../broadcom/sonic-platform-modules-ingrasys | 2 +- 5 files changed, 33 insertions(+), 36 deletions(-) diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol index 05a71e8d999c..8c378371a9a2 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/fancontrol @@ -1,12 +1,11 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 -DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f -DEVNAME=hwmon2=w83795adg -FCTEMPS=hwmon2/device/pwm2=hwmon2/device/temp2_input hwmon2/device/pwm1=hwmon2/device/temp2_input -#FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input+hwmon2/device/fan7_input+hwmon2/device/fan6_input+hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input+hwmon2/device/fan3_input+hwmon2/device/fan2_input+hwmon2/device/fan1_input -FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input -MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 -MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 -MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 -MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm2=hwmon1/device/temp2_input hwmon1/device/pwm1=hwmon1/device/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +MINTEMP=hwmon1/device/pwm2=20 hwmon1/device/pwm1=20 +MAXTEMP=hwmon1/device/pwm2=60 hwmon1/device/pwm1=60 +MINSTART=hwmon1/device/pwm2=75 hwmon1/device/pwm1=75 +MINSTOP=hwmon1/device/pwm2=22 hwmon1/device/pwm1=22 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol index 827b0539546f..e1f88f6b79c5 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/fancontrol @@ -1,11 +1,10 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 -DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f -DEVNAME=hwmon2=w83795adg -FCTEMPS=hwmon2/device/pwm2=hwmon2/device/temp2_input hwmon2/device/pwm1=hwmon2/device/temp2_input -#FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input+hwmon2/device/fan7_input+hwmon2/device/fan6_input+hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input+hwmon2/device/fan3_input+hwmon2/device/fan2_input+hwmon2/device/fan1_input -FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input -MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 -MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 -MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 -MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm2=hwmon1/device/temp2_input hwmon1/device/pwm1=hwmon1/device/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +MINTEMP=hwmon1/device/pwm2=20 hwmon1/device/pwm1=20 +MAXTEMP=hwmon1/device/pwm2=60 hwmon1/device/pwm1=60 +MINSTART=hwmon1/device/pwm2=75 hwmon1/device/pwm1=75 +MINSTOP=hwmon1/device/pwm2=22 hwmon1/device/pwm1=22 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol index cb07a7a07f4a..4819fe113172 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/fancontrol @@ -1,10 +1,10 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 -DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f -DEVNAME=hwmon2=w83795adg -FCTEMPS=hwmon2/device/pwm1=hwmon2/device/temp2_input hwmon2/device/pwm2=hwmon2/device/temp2_input -FCFANS=hwmon2/device/pwm2=hwmon2/device/fan10_input hwmon2/device/pwm2=hwmon2/device/fan9_input hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input -MINTEMP=hwmon2/device/pwm1=20 hwmon2/device/pwm2=20 -MAXTEMP=hwmon2/device/pwm1=60 hwmon2/device/pwm2=60 -MINSTART=hwmon2/device/pwm1=150 hwmon2/device/pwm2=150 -MINSTOP=hwmon2/device/pwm1=0 hwmon2/device/pwm2=0 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm1=hwmon1/device/temp2_input hwmon1/device/pwm2=hwmon1/device/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan10_input hwmon1/device/pwm2=hwmon1/device/fan9_input hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +MINTEMP=hwmon1/device/pwm1=20 hwmon1/device/pwm2=20 +MAXTEMP=hwmon1/device/pwm1=60 hwmon1/device/pwm2=60 +MINSTART=hwmon1/device/pwm1=150 hwmon1/device/pwm2=150 +MINSTOP=hwmon1/device/pwm1=0 hwmon1/device/pwm2=0 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol index 827b0539546f..e1f88f6b79c5 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/fancontrol @@ -1,11 +1,10 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=10 -DEVPATH=hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f -DEVNAME=hwmon2=w83795adg -FCTEMPS=hwmon2/device/pwm2=hwmon2/device/temp2_input hwmon2/device/pwm1=hwmon2/device/temp2_input -#FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input+hwmon2/device/fan7_input+hwmon2/device/fan6_input+hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input+hwmon2/device/fan3_input+hwmon2/device/fan2_input+hwmon2/device/fan1_input -FCFANS=hwmon2/device/pwm2=hwmon2/device/fan8_input hwmon2/device/pwm2=hwmon2/device/fan7_input hwmon2/device/pwm2=hwmon2/device/fan6_input hwmon2/device/pwm2=hwmon2/device/fan5_input hwmon2/device/pwm1=hwmon2/device/fan4_input hwmon2/device/pwm1=hwmon2/device/fan3_input hwmon2/device/pwm1=hwmon2/device/fan2_input hwmon2/device/pwm1=hwmon2/device/fan1_input -MINTEMP=hwmon2/device/pwm2=20 hwmon2/device/pwm1=20 -MAXTEMP=hwmon2/device/pwm2=60 hwmon2/device/pwm1=60 -MINSTART=hwmon2/device/pwm2=75 hwmon2/device/pwm1=75 -MINSTOP=hwmon2/device/pwm2=22 hwmon2/device/pwm1=22 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm2=hwmon1/device/temp2_input hwmon1/device/pwm1=hwmon1/device/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +MINTEMP=hwmon1/device/pwm2=20 hwmon1/device/pwm1=20 +MAXTEMP=hwmon1/device/pwm2=60 hwmon1/device/pwm1=60 +MINSTART=hwmon1/device/pwm2=75 hwmon1/device/pwm1=75 +MINSTOP=hwmon1/device/pwm2=22 hwmon1/device/pwm1=22 diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index 2725c0f1d1db..458829af29cc 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit 2725c0f1d1db4a3301c00fac8d7e3bc028a37bce +Subproject commit 458829af29ccbaf71ddc70db292e6a468e0e564c From 948f3ad3ecf4575d3e6d41c772a97e5a545f252f Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Mon, 25 Sep 2017 23:22:02 +0300 Subject: [PATCH 0799/1833] [mellanox]: Update Mellanox SAI version (#979) Signed-off-by: Volodymyr Samotiy --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index d9ee588a0dfe..bba10132160d 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = sonic1.9.1fixes-master -MLNX_SAI_REVISION = 4ebc01e95b754c56da7f8b5fb45b82fbe661d05a +MLNX_SAI_REVISION = dc0e84b3762f847369524a917e271ceb2878b4d3 export MLNX_SAI_VERSION MLNX_SAI_REVISION From 8143cb34f23abba3396bc9c8499f697a9a8a05bf Mon Sep 17 00:00:00 2001 From: wadelnn Date: Tue, 26 Sep 2017 08:54:17 +0800 Subject: [PATCH 0800/1833] [Ingrasys]: Add Ingrasys S8900-64XC sfputil function and update submodule (#984) * Add S8900-64XC SFP QSFP CPLD kernel module. * Fixed QSFP function call in i2c_utils.sh. * Add QSFP monitor service for SFP and QSFP SI. Signed-off-by: Wade He --- .../plugins/sfputil.py | 283 +++++++++++++----- .../broadcom/sonic-platform-modules-ingrasys | 2 +- 2 files changed, 217 insertions(+), 68 deletions(-) diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py index d6573d20d72f..0b1ae8d3bc8e 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py @@ -1,24 +1,30 @@ -#!/usr/bin/env python - -import subprocess +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + import time + import subprocess + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + i2c_set = 'i2cset' +i2c_get = 'i2cget' cpld_addr = '0x33' mux_reg = '0x4A' -class sfputil(sfputilbase): - """Platform specific sfputil class""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 63 - ports_in_block = 64 + PORT_START = 0 + PORT_END = 63 + QSFP_PORT_START = 48 + PORTS_IN_BLOCK = 64 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} port_to_i2c_mapping = { 0: [2,1], 1: [2,2], @@ -44,64 +50,207 @@ class sfputil(sfputilbase): 21: [2,22], 22: [2,23], 23: [2,24], - 24: [3,1], - 25: [3,2], - 26: [3,3], - 27: [3,4], - 28: [3,5], - 29: [3,6], - 30: [3,7], - 31: [3,8], - 32: [3,9], - 33: [3,10], - 34: [3,11], - 35: [3,12], - 36: [3,13], - 37: [3,14], - 38: [3,15], - 39: [3,16], - 40: [3,17], - 41: [3,18], - 42: [3,19], - 43: [3,20], - 44: [3,21], - 45: [3,22], - 46: [3,23], - 47: [3,24], - 48: [4,1], - 49: [4,2], - 50: [4,3], - 51: [4,4], - 52: [4,5], - 53: [4,6], - 54: [4,7], - 55: [4,8], - 56: [4,9], - 57: [4,10], - 58: [4,11], - 59: [4,12], - 60: [4,13], - 61: [4,14], - 62: [4,15], - 63: [4,16] + 24: [3,25], + 25: [3,26], + 26: [3,27], + 27: [3,28], + 28: [3,29], + 29: [3,30], + 30: [3,31], + 31: [3,32], + 32: [3,33], + 33: [3,34], + 34: [3,35], + 35: [3,36], + 36: [3,37], + 37: [3,38], + 38: [3,39], + 39: [3,40], + 40: [3,41], + 41: [3,42], + 42: [3,43], + 43: [3,44], + 44: [3,45], + 45: [3,46], + 46: [3,47], + 47: [3,48], + 48: [4,49], + 49: [4,50], + 50: [4,51], + 51: [4,52], + 52: [4,53], + 53: [4,54], + 54: [4,55], + 55: [4,56], + 56: [4,57], + 57: [4,58], + 58: [4,59], + 59: [4,60], + 60: [4,61], + 61: [4,62], + 62: [4,63], + 63: [4,64] } + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END - _qsfp_ports = range(0, ports_in_block + 1) + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - i2c_bus = self.port_to_i2c_mapping[port_num][0] - sfp_idx = self.port_to_i2c_mapping[port_num][1] - proc = subprocess.Popen([i2c_set, '-y', str(i2c_bus), cpld_addr, mux_reg, str(sfp_idx)], - stdout=subprocess.PIPE, - shell=False, - stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping - eeprom_path = '/sys/class/i2c-adapter/i2c-{0[0]}/{0[0]}-0050/eeprom' - for x in range(self.port_start, self.port_end + 1): - port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + def __init__(self): + + sfp_eeprom_path = '/sys/bus/i2c/devices/{0[0]}-0050/sfp{0[1]}' + qsfp_eeprom_path = '/sys/bus/i2c/devices/{0[0]}-0050/qsfp{0[1]}' + for x in range(self.port_start, self.qsfp_port_start): + port_eeprom_path = sfp_eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + for x in range(self.qsfp_port_start, self.port_end + 1): + port_eeprom_path = qsfp_eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_modprs") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # content is a string, either "0" or "1" + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << (port_num - self.qsfp_port_start) ) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << (port_num - self.qsfp_port_start) ) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_reset" + + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << (port_num - self.qsfp_port_start)) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # 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(QSFP_RESET_REGISTER_DEVICE_FILE, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index 458829af29cc..e66b8839da21 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit 458829af29ccbaf71ddc70db292e6a468e0e564c +Subproject commit e66b8839da2180fd586aae040701faf180d59477 From a4ceff728414726f91f6267d154d78c80b592e48 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 25 Sep 2017 17:54:46 -0700 Subject: [PATCH 0801/1833] [Broadcom]: Update SAI version to 3.0.3.2-4 (#983) - Update Seastone config.bcm files - bugfix: Fix set attribute for ipv6 neighbor --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index ca1c76a32ff8..1bee2d9aa5de 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-2_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-2_amd64.deb?sv=2015-04-05&sr=b&sig=A9GjUgI9%2B7kRQHsCFqH07iRQLhdkwSH5tvSXepb3b%2BA%3D&se=2031-05-30T22%3A47%3A47Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-4_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-4_amd64.deb?sv=2015-04-05&sr=b&sig=8LE5JB9YlYHVWFf0QF5vFF7fCUbpo14OXokBi%2BKb9GI%3D&se=2031-06-04T20%3A15%3A13Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-2_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-4_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-2_amd64.deb?sv=2015-04-05&sr=b&sig=lDIwnDNHIA0WKc5ggTA4x3pVmBIM%2Bdib0hR7H1qyTe0%3D&se=2031-05-30T22%3A48%3A07Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-4_amd64.deb?sv=2015-04-05&sr=b&sig=UGqSnxGtIxFBdO%2FDcFbZdPFgBPN695JQ6hLP5mBOt7g%3D&se=2031-06-04T20%3A15%3A26Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From cce2a365280150019a2a313567bdd21e9f98f666 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 25 Sep 2017 20:01:42 -0700 Subject: [PATCH 0802/1833] [snmp]: Update sonic-snmpagent submodule (#986) [rfc4363]: Add key check logic for SAI bridge port objects (#38) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 45e4e7826bf3..8dfcbd2be6ba 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 45e4e7826bf34850d8cc12861259c5f388e1102e +Subproject commit 8dfcbd2be6ba5e2e08c68f748a5f22739fe0f560 From 0db870475468f768493485d89ce7e033b90f3bd8 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 26 Sep 2017 21:22:00 +0300 Subject: [PATCH 0803/1833] [Mellanox]: Remove FW upgrade procedure in docker (#989) FW upgrade is done outside the container. This piece of code was left accidentally during the merge. --- platform/mellanox/docker-syncd-mlnx/start.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/platform/mellanox/docker-syncd-mlnx/start.sh b/platform/mellanox/docker-syncd-mlnx/start.sh index 0ad00c6fc252..623316050475 100755 --- a/platform/mellanox/docker-syncd-mlnx/start.sh +++ b/platform/mellanox/docker-syncd-mlnx/start.sh @@ -4,8 +4,4 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd -# mlnx-fw-upgrade.sh will exit if firmware was actually upgraded -# or if some error occurs -. mlnx-fw-upgrade.sh - supervisorctl start syncd From 9b249ceb59c745306d4e4365d87e1b608ba2040b Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 27 Sep 2017 10:04:34 +0300 Subject: [PATCH 0804/1833] Add time stamp suffix to the dirty images version string (#958) * Add timestamp suffix to the dirty images version string This will allow to build different debug images without having to update BUILD_NUMBER variable before the build * Changed timestamp format to YYYYMMDD.HHMMSS --- functions.sh | 2 +- slave.mk | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/functions.sh b/functions.sh index c73aeb45d649..01f645ca72c7 100644 --- a/functions.sh +++ b/functions.sh @@ -55,7 +55,7 @@ sonic_get_version() { local latest_tag=$(git describe --tags --abbrev=0) local branch_name=$(git rev-parse --abbrev-ref HEAD) if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then - local dirty="-dirty" + local dirty="-dirty-$DIRTY_SUFFIX" fi BUILD_NUMBER=${BUILD_NUMBER:-0} ## Check if we are on tagged commit diff --git a/slave.mk b/slave.mk index 4e76661588fb..c26e4932f05a 100644 --- a/slave.mk +++ b/slave.mk @@ -423,6 +423,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform chmod +x sonic_debian_extension.sh, ) + DIRTY_SUFFIX="$(shell date +%Y%m%d\.%H%M%S)" + export DIRTY_SUFFIX ./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG) TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) ./build_image.sh $(LOG) From 59c03083d39f496c6e55dfb33edb2d3533d5f7df Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Fri, 29 Sep 2017 03:04:27 +0800 Subject: [PATCH 0805/1833] [Mellanox]: Update outdated MSN2410 minigraph (#995) update the minigraph to the latest. the previous one causes MSN2410 failing to start up properly. --- .../x86_64-mlnx_msn2410-r0/minigraph.xml | 676 +++++++++++++++++- 1 file changed, 675 insertions(+), 1 deletion(-) diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml index ed21b8d6eeb9..ea765fab814d 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml @@ -2,11 +2,461 @@ + + ARISTA01T0 + 10.0.0.33 + switch2 + 10.0.0.32 + 1 + 180 + 60 + + + switch2 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch2 + 10.0.0.34 + 1 + 180 + 60 + + + switch2 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch2 + 10.0.0.36 + 1 + 180 + 60 + + + switch2 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch2 + 10.0.0.38 + 1 + 180 + 60 + + + switch2 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch2 + 10.0.0.40 + 1 + 180 + 60 + + + switch2 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch2 + 10.0.0.42 + 1 + 180 + 60 + + + switch2 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch2 + 10.0.0.44 + 1 + 180 + 60 + + + switch2 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch2 + 10.0.0.46 + 1 + 180 + 60 + + + switch2 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch2 + 10.0.0.48 + 1 + 180 + 60 + + + switch2 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch2 + 10.0.0.50 + 1 + 180 + 60 + + + switch2 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch2 + 10.0.0.52 + 1 + 180 + 60 + + + switch2 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch2 + 10.0.0.54 + 1 + 180 + 60 + + + switch2 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch2 + 10.0.0.56 + 1 + 180 + 60 + + + switch2 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch2 + 10.0.0.58 + 1 + 180 + 60 + + + switch2 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch2 + 10.0.0.60 + 1 + 180 + 60 + + + switch2 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch2 + 10.0.0.62 + 1 + 180 + 60 + + + switch2 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + 65100 switch2 + + +
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
+ + +
+
@@ -482,13 +932,237 @@ + + DeviceInterfaceLink + switch2 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet124 + ARISTA16T0 + Ethernet1 + switch2 ACS-MSN2410 - ` + From 6483919852ade151b6c02c8c932b5cbce2260fb8 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 28 Sep 2017 20:29:31 -0700 Subject: [PATCH 0806/1833] [Broadcom]: Update SAI version to 3.0.3.2-5 (#997) - Add additional DropCancel and CopyToCpuCancel action rules for every redirect --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 1bee2d9aa5de..ea804a69c0eb 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-4_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-4_amd64.deb?sv=2015-04-05&sr=b&sig=8LE5JB9YlYHVWFf0QF5vFF7fCUbpo14OXokBi%2BKb9GI%3D&se=2031-06-04T20%3A15%3A13Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-5_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-5_amd64.deb?sv=2015-04-05&sr=b&sig=MQE6FrxHs%2BIUPjRaSpWagcSjY6bbHLCUYasusxILkEs%3D&se=2031-06-07T21%3A50%3A36Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-4_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-5_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-4_amd64.deb?sv=2015-04-05&sr=b&sig=UGqSnxGtIxFBdO%2FDcFbZdPFgBPN695JQ6hLP5mBOt7g%3D&se=2031-06-04T20%3A15%3A26Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-5_amd64.deb?sv=2015-04-05&sr=b&sig=o8bjWlxxYAM%2F95aSshRFJE57JwKVjRaH4jDU2lDEoMg%3D&se=2031-06-07T21%3A50%3A19Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From f7a38e1f65fdd44980ab552bbfb1f443dc15f5ae Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 28 Sep 2017 21:01:41 -0700 Subject: [PATCH 0807/1833] [snmp]: Update py-swsssdk/snmpagent submodules (#996) sonic-py-swsssdk - Commond utility functions for bridge/port mapping snmp - Update the code to use common library API for bridge/port mapping --- src/sonic-py-swsssdk | 2 +- src/sonic-snmpagent | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 7f8e7c5ad974..96b4928e790b 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 7f8e7c5ad9747af1d8ce5317eb1ece65ed4c0c7a +Subproject commit 96b4928e790bbce7c959f0b5cbb0510e5954afb1 diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 8dfcbd2be6ba..6996123be4f0 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 8dfcbd2be6ba5e2e08c68f748a5f22739fe0f560 +Subproject commit 6996123be4f0a1d44aab7e23ac6ff15e7bb82b1b From 9efcc9c3338e7609d5ac374c7cc33cacdf4d6b7a Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Sat, 30 Sep 2017 00:44:55 +0300 Subject: [PATCH 0808/1833] [swss]: Update swss/common submodules (#988) * Update swss submodule reference * Update swss-common submodule reference This pull request introduces changes including 1. Use unified buffer configurations fro all Mellanox 27xx platforms 2. Refactor TableConsumable and optimize popping empty logics 3. Add SwitchOrch to deal with switch attributes changes 4. Refactor doAclTableTask and doAclRuleTask 5. Add PFC watchdog tables and runRedisScript function in common library Signed-off-by: Andriy Moroz --- dockers/docker-orchagent/swssconfig.sh | 7 +++---- src/sonic-config-engine/minigraph.py | 1 + src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index f075ca4f22ac..7b22fe7d190d 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -45,10 +45,9 @@ elif [ "$HWSKU" == "Force10-S6000-Q32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [ "$HWSKU" == "ACS-MSN2700" ]; then - SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " -elif [ "$HWSKU" == "ACS-MSN2740" ]; then - SWSSCONFIG_ARGS+="msn2740.32ports.buffers.json msn2740.32ports.qos.json " +elif [[ "$HWSKU" == "ACS-MSN27"* ]]; then + sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json + SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json msn2700.32ports.qos.json " fi for file in $SWSSCONFIG_ARGS; do diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index b5e97b485b44..95a45b8530de 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -101,6 +101,7 @@ def parse_png(png, hname): for device in child.findall(str(QName(ns, "Device"))): (lo_prefix, mgmt_prefix, name, hwsku, d_type) = parse_device(device) device_data = {'lo_addr': lo_prefix, 'type': d_type, 'mgmt_addr': mgmt_prefix, 'hwsku': hwsku } + name = name.replace('"', '') if neighbors.has_key(name): neighbors[name].update(device_data) else: diff --git a/src/sonic-swss b/src/sonic-swss index 4c56d23b9ff4..770a8f33c1bf 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc +Subproject commit 770a8f33c1bff299be683bfc7f8e07a2d65f9ef3 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index d4adb725ae6d..53bb53179d91 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit d4adb725ae6d7cbfcff939b1e3b6a4a544bd4de3 +Subproject commit 53bb53179d916a45eafa75e1e958f1432d2a716e From bbf1d6624bcec3ba9de96cbee835430230e446d6 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 30 Sep 2017 10:55:03 -0700 Subject: [PATCH 0809/1833] [docker-platform-monitor]: Remove stale fancontrol.pid file (if exists) before starting fancontrol (#1002) --- dockers/docker-platform-monitor/start.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-platform-monitor/start.sh b/dockers/docker-platform-monitor/start.sh index fb87083f5cc6..b4023c16367a 100755 --- a/dockers/docker-platform-monitor/start.sh +++ b/dockers/docker-platform-monitor/start.sh @@ -18,6 +18,9 @@ fi # If this platform has a fancontrol config file, copy it to it's proper place # and start fancontrol if [ -e /usr/share/sonic/platform/fancontrol ]; then + # Remove stale pid file if it exists + rm -f /var/run/fancontrol.pid + /bin/cp -f /usr/share/sonic/platform/fancontrol /etc/ supervisorctl start fancontrol fi From 002aabe8ba5e59e6ab2a9fc7f0db48371150ec74 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 30 Sep 2017 11:02:18 -0700 Subject: [PATCH 0810/1833] Change all port_config.ini column headers from 'port' to 'index' (#1001) --- .../x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini | 2 +- .../x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini | 2 +- .../x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini | 2 +- .../x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini | 2 +- .../x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini | 2 +- .../Arista-7260CX3-D108C8/port_config.ini | 2 +- .../INGRASYS-S8810-32Q/port_config.ini | 2 +- .../INGRASYS-S8900-54XC/port_config.ini | 2 +- .../INGRASYS-S8900-64XC/port_config.ini | 2 +- .../x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini index dea477b26152..1cc6c91b1308 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 125,126,127,128 Ethernet1/1 1 Ethernet4 121,122,123,124 Ethernet2/1 2 Ethernet8 13,14,15,16 Ethernet3/1 3 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini index 32fa6885fa93..b57f14497e39 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 125,126,127,128 Ethernet1/1 1 Ethernet4 121,122,123,124 Ethernet2/1 2 Ethernet8 13,14,15,16 Ethernet3/1 3 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini index cb36404ac44f..fda62e998c1a 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 9,10,11,12 Ethernet5/1 5 Ethernet4 13,14,15,16 Ethernet6/1 6 Ethernet8 17,18,19,20 Ethernet7/1 7 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini index c1dbcfabd9e3..bfe4a721141d 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 33,34,35,36 Ethernet1/1 1 Ethernet4 37,38,39,40 Ethernet2/1 2 Ethernet8 41,42,43,44 Ethernet3/1 3 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini index 4f073e46dce3..1119dfd231c6 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 77,78,79,80 Ethernet1/1 1 Ethernet4 65,66,67,68 Ethernet2/1 2 Ethernet8 85,86,87,88 Ethernet3/1 3 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini index b06d1c7575d4..35a2175cf21d 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 77,78 Ethernet1/1 1 Ethernet2 79,80 Ethernet1/3 2 Ethernet4 65,66 Ethernet2/1 3 diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini index a313c9cda21f..bf87e1402ab1 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 37,38,39,40 Ethernet1/1 0 Ethernet4 33,34,35,36 Ethernet2/1 1 Ethernet8 45,46,47,48 Ethernet3/1 2 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini index c1243db622f6..3350b68172cb 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 1 Ethernet1 0 Ethernet1 2 Ethernet2 1 Ethernet2 3 Ethernet3 2 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini index 20c2138dfeb3..b950538edba7 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 17 Ethernet1 0 Ethernet1 18 Ethernet2 1 Ethernet2 19 Ethernet3 2 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini index 6c62497b8927..ab0202011576 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/port_config.ini @@ -1,4 +1,4 @@ -# name lanes alias port +# name lanes alias index Ethernet0 5,6,7,8 Ethernet1/1 0 Ethernet4 1,2,3,4 Ethernet2/1 1 Ethernet8 13,14,15,16 Ethernet3/1 2 From 486dfef732481269fd72f20e51b6404e30dd2b44 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sat, 30 Sep 2017 11:03:32 -0700 Subject: [PATCH 0811/1833] [swss]: Update the ipinip.j2 template to specify the IPv4 loopback address (#998) Use ipv4_loopback_addresses variable to store all IPv4 loopback addresses. The source IP for encapsulation is chosen from one of the addresses. The destination IPs for decapsulation is the list of the addresses. Signed-off-by: Shu0T1an ChenG --- dockers/docker-orchagent/ipinip.json.j2 | 12 +++++++++--- .../tests/sample_output/ipinip.json | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index 2f411b088e6d..2554755c701d 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -1,9 +1,16 @@ +{# only IPv4 decapsulation is supported #} +{% set ipv4_loopback_addresses = [] %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} + {%- if prefix | ipv4 %} + {%- set ipv4_loopback_addresses = ipv4_loopback_addresses.append(prefix) %} + {%- endif %} +{% endfor %} [ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "src_ip":"{{ LOOPBACK_INTERFACE.keys()[0][1] | ip }}", - "dst_ip":"{{ LOOPBACK_INTERFACE.keys()[0][1] | ip }}", + "src_ip":"{{ ipv4_loopback_addresses | first | ip }}", + "dst_ip":"{% for prefix in ipv4_loopback_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", {% if onie_switch_asic == "mlnx" %} "dscp_mode":"uniform", "ecn_mode":"standard", @@ -16,4 +23,3 @@ "OP": "SET" } ] - diff --git a/src/sonic-config-engine/tests/sample_output/ipinip.json b/src/sonic-config-engine/tests/sample_output/ipinip.json index 00862a379281..5a7ac1b6063b 100644 --- a/src/sonic-config-engine/tests/sample_output/ipinip.json +++ b/src/sonic-config-engine/tests/sample_output/ipinip.json @@ -11,4 +11,3 @@ "OP": "SET" } ] - From b81f2f2fa39647d981f5fb02b5c3bd5584081e37 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 2 Oct 2017 13:56:16 -0700 Subject: [PATCH 0812/1833] [snmpagent]: Update sonic-snmpagent submodule (#1004) * [mibs]: Fix bug module has no attribute 'get_index_from_str' Signed-off-by: Shu0T1an ChenG --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 6996123be4f0..bc4becf97ea6 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 6996123be4f0a1d44aab7e23ac6ff15e7bb82b1b +Subproject commit bc4becf97ea69c15315414e8c7cba44067af2461 From 7c326e3f1edb0804220f0eee19e49ab51bb3fd65 Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Tue, 3 Oct 2017 09:26:07 -0700 Subject: [PATCH 0813/1833] [utilities]: Update sonic-utilities submodule (#1006) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 0338eee64574..b27d4f9e976f 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 0338eee645741937603c5686bb86b22cb5ab5322 +Subproject commit b27d4f9e976f944f50d81e2354ba826194971774 From 72e947621c413b6069b719f6bbad05c8abbdf1df Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 3 Oct 2017 16:23:19 -0700 Subject: [PATCH 0814/1833] [config-engine]: Fix bug multiple ports connecting to same neighbor (#1005) The current DEVICE_NEIGHBOR format doesn't support multiple different ports connecting with same neighbor. Thus the lldpd.conf file is not generated correctly, causing missing information for LAG members. This fix reverts the data structure in the previous version of minigraph parser - using local port as the key and remote port/device as the value of the map. Sample format is: DEVICE_NEIGHBOR['Ethernet124'] = { 'name': 'ARISTA04T1', 'port': 'Ethernet1/1' } The corresponding unit test in test_cfggen is updated. Add one more unit test for lldpd.conf.j2 verification. Signed-off-by: Shu0T1an ChenG --- dockers/docker-lldp-sv2/lldpd.conf.j2 | 4 ++-- src/sonic-config-engine/minigraph.py | 10 +++------- src/sonic-config-engine/tests/sample_output/lldpd.conf | 5 +++++ src/sonic-config-engine/tests/test_cfggen.py | 4 ++-- src/sonic-config-engine/tests/test_j2files.py | 8 +++++++- 5 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 src/sonic-config-engine/tests/sample_output/lldpd.conf diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index ffbf7e6993e9..eb7202df7c67 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,3 +1,3 @@ -{% for neighbor in DEVICE_NEIGHBOR %} -configure ports {{ DEVICE_NEIGHBOR[neighbor]['local_port'] }} lldp portidsubtype local {{ PORT[DEVICE_NEIGHBOR[neighbor]['local_port']]['alias'] }} description {{ neighbor }}:{{ DEVICE_NEIGHBOR[neighbor]['port'] }} +{% for local_port in DEVICE_NEIGHBOR %} +configure ports {{ local_port }} lldp portidsubtype local {{ PORT[local_port]['alias'] }} description {{ DEVICE_NEIGHBOR[local_port]['name'] }}:{{ DEVICE_NEIGHBOR[local_port]['port'] }} {% endfor %} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 95a45b8530de..997008af5cee 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -91,21 +91,17 @@ def parse_png(png, hname): if enddevice == hname: if port_alias_map.has_key(endport): endport = port_alias_map[endport] - neighbors[startdevice] = {'local_port': endport, 'port': startport} + neighbors[endport] = {'name': startdevice, 'port': startport} else: if port_alias_map.has_key(startport): startport = port_alias_map[startport] - neighbors[enddevice] = {'local_port': startport, 'port': endport} + neighbors[startport] = {'name': enddevice, 'port': endport} if child.tag == str(QName(ns, "Devices")): for device in child.findall(str(QName(ns, "Device"))): (lo_prefix, mgmt_prefix, name, hwsku, d_type) = parse_device(device) device_data = {'lo_addr': lo_prefix, 'type': d_type, 'mgmt_addr': mgmt_prefix, 'hwsku': hwsku } - name = name.replace('"', '') - if neighbors.has_key(name): - neighbors[name].update(device_data) - else: - devices[name] = device_data + devices[name] = device_data if child.tag == str(QName(ns, "DeviceInterfaceLinks")): for if_link in child.findall(str(QName(ns, 'DeviceLinkBase'))): diff --git a/src/sonic-config-engine/tests/sample_output/lldpd.conf b/src/sonic-config-engine/tests/sample_output/lldpd.conf new file mode 100644 index 000000000000..0328385cf307 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/lldpd.conf @@ -0,0 +1,5 @@ +configure ports Ethernet116 lldp portidsubtype local fortyGigE0/116 description ARISTA02T1:Ethernet1/1 +configure ports Ethernet124 lldp portidsubtype local fortyGigE0/124 description ARISTA04T1:Ethernet1/1 +configure ports Ethernet112 lldp portidsubtype local fortyGigE0/112 description ARISTA01T1:Ethernet1/1 +configure ports Ethernet120 lldp portidsubtype local fortyGigE0/120 description ARISTA03T1:Ethernet1/1 + diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 4303f5a2492d..d78b19d88ba7 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -106,9 +106,9 @@ def test_minigraph_portchannel_interfaces(self): self.assertEqual(output.strip(), "[('PortChannel01', 'FC00::71/126'), ('PortChannel01', '10.0.0.56/31')]") def test_minigraph_neighbors(self): - argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "DEVICE_NEIGHBOR[\'ARISTA01T1\']"' + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "DEVICE_NEIGHBOR[\'Ethernet124\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'mgmt_addr': None, 'hwsku': 'Arista', 'lo_addr': None, 'local_port': 'Ethernet112', 'type': 'LeafRouter', 'port': 'Ethernet1/1'}") + self.assertEqual(output.strip(), "{'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}") def test_minigraph_bgp(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "BGP_NEIGHBOR[\'10.0.0.59\']"' diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 9b71fc72b932..4bdc1b41f5b4 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -26,10 +26,16 @@ def test_interfaces(self): def test_alias_map(self): alias_map_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-snmp-sv2', 'alias_map.j2') - argument = '-m "' + self.t0_minigraph + '" -p "' + self.t0_port_config + '" -t "' + alias_map_template + '"' + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + alias_map_template output = self.run_script(argument) data = json.loads(output) self.assertEqual(data["Ethernet4"], "fortyGigE0/4") + + def test_lldp(self): + lldpd_conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-lldp-sv2', 'lldpd.conf.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + lldpd_conf_template + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'lldpd.conf'), self.output_file)) def test_teamd(self): From 646e8364713cecdb50e95c237b7473d2f7a81544 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 3 Oct 2017 23:07:05 -0700 Subject: [PATCH 0815/1833] [swss]: Update swss-common/sairedis/swss submodules (#1008) Signed-off-by: Qi Luo --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 79bd891ca533..e4d24276cb6f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 79bd891ca5337222701cd51ee5b266d2e485c492 +Subproject commit e4d24276cb6fc7122f756c637f30ddea27487c70 diff --git a/src/sonic-swss b/src/sonic-swss index 770a8f33c1bf..bcdea1323e70 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 770a8f33c1bff299be683bfc7f8e07a2d65f9ef3 +Subproject commit bcdea1323e70c73fa0a85c6df55eaed886bded81 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 53bb53179d91..f6ff19bee131 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 53bb53179d916a45eafa75e1e958f1432d2a716e +Subproject commit f6ff19bee131048f2274a21ea1064a8493a7fd8b From 554114cfaa4b55a85e3a74b169bfcf1a394accdd Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 4 Oct 2017 01:02:30 -0700 Subject: [PATCH 0816/1833] Make swssconfig status FATAL when it fails (#1009) * Make supervisor controlled one-shot program autorestart 0 time, so the status will become FATAL instead of EXITED if failure happens Signed-off-by: Qi Luo * Make swssconfig.sh strictly exit on any failure Signed-off-by: Qi Luo * Tune startretries, tested in supervisor 3.3.2-1 Signed-off-by: Qi Luo --- dockers/docker-orchagent/supervisord.conf | 3 ++- dockers/docker-orchagent/swssconfig.sh | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index a04238472c4c..09850b13d4a1 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -55,7 +55,8 @@ stderr_logfile=syslog command=/usr/bin/swssconfig.sh priority=7 autostart=false -autorestart=false +autorestart=unexpected +startretries=0 stdout_logfile=syslog stderr_logfile=syslog diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 7b22fe7d190d..55a22c5353c8 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + function config_acl { if [ -f "/etc/sonic/acl.json" ]; then mkdir -p /etc/swss/config.d/acl From 1cd9818fe9a801a2f03f0ff80d2cffa1b3e25171 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 4 Oct 2017 19:50:39 -0700 Subject: [PATCH 0817/1833] [build]: sonic-utilities package depends on swsssdk; build as wheel and add build dependency (#1011) * [build]: sonic-utilities package now depends on swsssdk; add build dependency * Now building sonic-utilities Python package in wheel format * Update sonic-utilities submodule * Change output wheel name to match proper format --- files/build_templates/sonic_debian_extension.j2 | 8 +++++--- rules/sonic-utilities.mk | 8 +++++--- slave.mk | 3 ++- src/sonic-utilities | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 04f5181ff610..a08872c4ea42 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -77,9 +77,11 @@ sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME sudo LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME -# Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Install SONiC Utilities Python package +SONIC_UTILITIES_WHEEL_NAME=$(basename {{sonic_utilities_wheel_path}}) +sudo cp {{sonic_utilities_wheel_path}} $FILESYSTEM_ROOT/$SONIC_UTILITIES_WHEEL_NAME +sudo LANG=C chroot $FILESYSTEM_ROOT pip install $SONIC_UTILITIES_WHEEL_NAME +sudo rm -rf $FILESYSTEM_ROOT/$SONIC_UTILITIES_WHEEL_NAME # SONiC utilities installs bash-completion as a dependency. However, it is disabled by default # in bash.bashrc, so we copy a version of the file with it enabled here. diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 9349813f5c4e..1634ab88f46a 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -1,5 +1,7 @@ # sonic utilities package -SONIC_UTILS = python-sonic-utilities_1.1-1_all.deb -$(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities -SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS) +SONIC_UTILITIES = sonic_utilities-1.1-py2-none-any.whl +$(SONIC_UTILITIES)_SRC_PATH = $(SRC_PATH)/sonic-utilities +$(SONIC_UTILITIES)_PYTHON_VERSION = 2 +$(SONIC_UTILITIES)_DEPENDS += $(SWSSSDK_PY2) +SONIC_PYTHON_WHEELS += $(SONIC_UTILITIES) diff --git a/slave.mk b/slave.mk index c26e4932f05a..16fea944853e 100644 --- a/slave.mk +++ b/slave.mk @@ -380,7 +380,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_DEVICE_DATA)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES)) $(HEADER) # Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" @@ -397,6 +397,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" export config_engine_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))" export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))" + export sonic_utilities_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES))" $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" diff --git a/src/sonic-utilities b/src/sonic-utilities index b27d4f9e976f..2c63a413cd48 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit b27d4f9e976f944f50d81e2354ba826194971774 +Subproject commit 2c63a413cd48f4d73e149bb594dd5ead5dd6e2db From 1d16a37d48fcee31f81897a6dff8c83e8bed8851 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 4 Oct 2017 23:35:43 -0700 Subject: [PATCH 0818/1833] [DHCP Relay]: Support Multiple VLANs (Separate DHCP Relay Agents, One Per VLAN) (#999) * [DHCP Relay]: Support new minigraph tag; support multiple VLANs * Don't start dhcrelay in quiet mode so as to get startup output in syslog * Update sonic-cfggen tests to support new '' tag * tag is only present for VLANs which require a DHCP relay agent -- only parse if present * Don't attempt to configure a DHCP relay agent for VLANs without specified DHCP servers * Modify to work with Taoyu's minigraph/DB changes (#942) * Reduce number of DHCP servers in sonic-cfggen unit tests from 4 to 2 * Remove isc-dhcp-relay sample output file from sonic-cfggen test, as we no longer generate that file * Update Option 82 isc-dhcp-relay patch to load all interface name-alias maps into memory once at start instead of calling sonic-cfggen on each packet we relay * Remove executable permission from Jinja2 template * Set max hop count to 1 so that DHCP relay will only relay packets with a hop count of zero * Replace tabs with spaces * Modify overlooked sonic-cfggen call, use Config DB instead of minigraph * Also ensure > 1 VLAN requires a DHCP relay agent before outputting to template * Generate port name-alias map file using sonic-cfggen and parse that in lieu of parsing port_config.ini directly * No longer drop packets with hop count > 0; Instead, drop packets which already contain agent info --- dockers/docker-dhcp-relay/Dockerfile.j2 | 8 +- .../docker-dhcp-relay.supervisord.conf.j2 | 67 +++++ dockers/docker-dhcp-relay/docker_init.sh | 18 ++ dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 28 -- dockers/docker-dhcp-relay/isc-dhcp-relay.sh | 18 -- dockers/docker-dhcp-relay/start.sh | 13 +- dockers/docker-dhcp-relay/supervisord.conf | 28 -- dockers/docker-dhcp-relay/wait_for_intf.sh.j2 | 1 - ...d-remote_id-and-bridge-iface-support.patch | 247 ++++++++++++++---- src/sonic-config-engine/minigraph.py | 8 + .../tests/pc-test-graph.xml | 1 + .../tests/sample_output/isc-dhcp-relay | 7 - .../tests/simple-sample-graph.xml | 1 + .../tests/t0-sample-bgp-speaker.xml | 1 + .../tests/t0-sample-graph-everflow.xml | 1 + .../tests/t0-sample-graph.xml | 1 + src/sonic-config-engine/tests/test_cfggen.py | 2 +- 17 files changed, 307 insertions(+), 143 deletions(-) create mode 100644 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 create mode 100755 dockers/docker-dhcp-relay/docker_init.sh delete mode 100644 dockers/docker-dhcp-relay/isc-dhcp-relay.j2 delete mode 100755 dockers/docker-dhcp-relay/isc-dhcp-relay.sh delete mode 100644 dockers/docker-dhcp-relay/supervisord.conf mode change 100755 => 100644 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 delete mode 100644 src/sonic-config-engine/tests/sample_output/isc-dhcp-relay diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 3c6614c4921f..2c2bdcaecbf7 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -22,9 +22,7 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -COPY ["start.sh", "isc-dhcp-relay.sh", "/usr/bin/"] -COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["isc-dhcp-relay.j2", "/usr/share/sonic/templates/"] -COPY ["wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] +COPY ["docker_init.sh", "start.sh", "/usr/bin/"] +COPY ["docker-dhcp-relay.supervisord.conf.j2", "wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 new file mode 100644 index 000000000000..747f65a3aaf6 --- /dev/null +++ b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 @@ -0,0 +1,67 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +{# If our configuration has VLANs... #} +{% if VLAN %} +{# Count how many VLANs require a DHCP relay agent... #} +{% set num_relays = { 'count': 0 } %} +{% for vlan_name in VLAN %} +{% if VLAN[vlan_name]['dhcp_servers'] %} +{% set _dummy = num_relays.update({'count': num_relays.count + 1}) %} +{% endif %} +{% endfor %} +{# If one or more of the VLANs require a DHCP relay agent... #} +{% if num_relays.count > 0 %} +[group:isc-dhcp-relay] +programs= +{%- set add_preceding_comma = { 'flag': False } -%} +{%- for vlan_name in VLAN -%} +{%- if VLAN[vlan_name]['dhcp_servers'] -%} +{%- if add_preceding_comma.flag %},{% endif -%} +{%- set _dummy = add_preceding_comma.update({'flag': True}) -%} +isc-dhcp-relay-{{ vlan_name }} +{%- endif %} +{% endfor %} + + +{# Create a program entry for each DHCP relay agent instance #} +{% for vlan_name in VLAN -%} +{%- if VLAN[vlan_name]['dhcp_servers'] -%} +[program:isc-dhcp-relay-{{ vlan_name }}] +command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -i {{ vlan_name }} +{%- for (name, prefix) in INTERFACE -%} +{%- if prefix | ipv4 %} -i {{ name }}{% endif -%} +{%- endfor -%} +{%- for (name, prefix) in PORTCHANNEL_INTERFACE -%} +{%- if prefix | ipv4 %} -i {{ name }}{% endif -%} +{%- endfor -%} +{%- for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %} {{ dhcp_server }}{% endfor %} + +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +{% endif %} +{% endfor %} +{% endif %} +{% endif %} diff --git a/dockers/docker-dhcp-relay/docker_init.sh b/dockers/docker-dhcp-relay/docker_init.sh new file mode 100755 index 000000000000..f6d402e6f780 --- /dev/null +++ b/dockers/docker-dhcp-relay/docker_init.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# Generate supervisord config file +mkdir -p /etc/supervisor/conf.d/ +sonic-cfggen -d -t /usr/share/sonic/templates/docker-dhcp-relay.supervisord.conf.j2 > /etc/supervisor/conf.d/docker-dhcp-relay.supervisord.conf + +# Generate the script that waits for all 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 + +# Generate port name-alias map for isc-dhcp-relay to parse. Each line contains one +# name-alias pair of the form " " +sonic-cfggen -d --var-json "PORT" | python -c "import sys, json, os; [sys.stdout.write('%s %s\n' % (k, v['alias'] if 'alias' in v else k)) for (k, v) in json.load(sys.stdin).iteritems()]" > /tmp/port-name-alias-map.txt + +# The docker container should start this script as PID 1, so now that supervisord is +# properly configured, we exec supervisord so that it runs as PID 1 for the +# duration of the container's lifetime +exec /usr/bin/supervisord diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 deleted file mode 100644 index cdedfcf9692b..000000000000 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 +++ /dev/null @@ -1,28 +0,0 @@ -SERVERS="{{ DHCP_SERVER | join(' ') }}" - -INTERFACES=" -{%- set add_preceding_space = { 'flag': False } %} -{%- for (name, prefix) in INTERFACE %} -{%- if prefix | ipv4 %} -{%- if add_preceding_space.flag %} {% endif %} -{{ name }} -{%- set _dummy = add_preceding_space.update({'flag': True}) %} -{%- endif %} -{%- endfor %} -{%- for (name, prefix) in VLAN_INTERFACE %} -{%- if prefix | ipv4 %} -{%- if add_preceding_space.flag %} {% endif %} -{{ name }} -{%- set _dummy = add_preceding_space.update({'flag': True}) %} -{%- endif %} -{%- endfor %} -{%- for (name, prefix) in PORTCHANNEL_INTERFACE %} -{%- if prefix | ipv4 %} -{%- if add_preceding_space.flag %} {% endif %} -{{ name }} -{%- set _dummy = add_preceding_space.update({'flag': True}) %} -{%- endif %} -{%- endfor %}" - -# '-a' option provides option 82 circuit_id and remote_id information -OPTIONS="-a %h:%p %P" diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.sh b/dockers/docker-dhcp-relay/isc-dhcp-relay.sh deleted file mode 100755 index 2224b8a0fe00..000000000000 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -# -# Based off /etc/init.d/isc-dhcp-relay -# - -# Read init script configuration (interfaces the daemon should listen on -# and the DHCP server we should forward requests to.) -[ -f /etc/default/isc-dhcp-relay ] && . /etc/default/isc-dhcp-relay - -# Build command line for interfaces (will be passed to dhrelay below.) -IFCMD="" -if test "$INTERFACES" != ""; then - for I in $INTERFACES; do - IFCMD=${IFCMD}"-i "${I}" " - done -fi - -exec /usr/sbin/dhcrelay -d -q ${OPTIONS} ${IFCMD} ${SERVERS} diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index 37c3f488a5c7..b53d7e4e238a 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -1,16 +1,13 @@ #!/usr/bin/env bash -# Create isc-dhcp-relay config file -sonic-cfggen -d -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay - +# Remove stale rsyslog PID file if it exists rm -f /var/run/rsyslogd.pid +# Start rsyslog supervisorctl start rsyslogd -# Wait for all interfaces to come up before starting the DHCP relay -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 all interfaces to come up before starting the DHCP relay agent(s) /usr/bin/wait_for_intf.sh -# Start the DHCP relay -supervisorctl start isc-dhcp-relay +# Start the DHCP relay agent(s) +supervisorctl start isc-dhcp-relay:* diff --git a/dockers/docker-dhcp-relay/supervisord.conf b/dockers/docker-dhcp-relay/supervisord.conf deleted file mode 100644 index ed1f75d1aed6..000000000000 --- a/dockers/docker-dhcp-relay/supervisord.conf +++ /dev/null @@ -1,28 +0,0 @@ -[supervisord] -logfile_maxbytes=1MB -logfile_backups=2 -nodaemon=true - -[program:start.sh] -command=/usr/bin/start.sh -priority=1 -autostart=true -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n -priority=2 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - -[program:isc-dhcp-relay] -command=/usr/bin/isc-dhcp-relay.sh -priority=3 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog diff --git a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 old mode 100755 new mode 100644 index b859a43b07b1..1524b3221312 --- a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 +++ b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 @@ -25,4 +25,3 @@ wait_until_iface_exists {{ name }} {% for (name, prefix) in PORTCHANNEL_INTERFACE %} wait_until_iface_exists {{ name }} {% endfor %} - diff --git a/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch b/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch index 8d28751da63c..4dee30238acd 100644 --- a/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch +++ b/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch @@ -1,10 +1,10 @@ This patch adds the following functionality to dhcrelay in isc-dhcp v4.3.1-6: * Add customizable Circuit ID and Remote ID fields -* Support for obtaining name of physical interface of interfaces that are part of a bridge interface +* Support for obtaining name of physical interfaces that are part of a bridge interface diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c ---- a/isc-dhcp/relay/dhcrelay.c 2014-08-06 22:35:02.000000000 +0000 -+++ b/isc-dhcp/relay/dhcrelay.c 2017-06-08 21:39:53.856192546 +0000 +--- a/isc-dhcp/relay/dhcrelay.c 2017-10-03 01:46:19.811524700 +0000 ++++ b/isc-dhcp/relay/dhcrelay.c 2017-10-03 01:45:50.699524700 +0000 @@ -73,6 +73,8 @@ did not match any known circuit ID. */ int missing_circuit_id = 0; /* Circuit ID option in matching RAI option @@ -14,7 +14,33 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c int max_hop_count = 10; /* Maximum hop count */ #ifdef DHCPv6 -@@ -140,9 +142,19 @@ +@@ -120,6 +122,14 @@ + char *dhcrelay_sub_id = NULL; + #endif + ++struct interface_name_alias_tuple { ++ char if_name[IFNAMSIZ + 1]; ++ char if_alias[IFNAMSIZ + 1]; ++}; ++ ++static struct interface_name_alias_tuple *g_interface_name_alias_map = NULL; ++static size_t g_interface_name_alias_map_size = 0; ++ + static void do_relay4(struct interface_info *, struct dhcp_packet *, + unsigned int, unsigned int, struct iaddr, + struct hardware *); +@@ -132,6 +142,10 @@ + struct interface_info **, + struct dhcp_packet *, unsigned); + ++static int load_interface_alias_map(const char *port_alias_map_file_path); ++static int get_interface_alias_by_name(const char *if_name, char *if_alias_out); ++static void free_interface_alias_map(void); ++ + static const char copyright[] = + "Copyright 2004-2014 Internet Systems Consortium."; + static const char arr[] = "All rights reserved."; +@@ -140,28 +154,42 @@ static const char url[] = "For info, please visit https://www.isc.org/software/dhcp/"; @@ -23,7 +49,7 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c +"\n" \ +" %%%% A single %%\n" \ +" %%h Hostname of device\n" \ -+" %%p Name of interface that generated the request\n" \ ++" %%p Alias of interface that generated the request\n" \ +" %%P Hardware address of interface that generated the request\n" \ +" %%C Client hardware address\n" \ +" %%I DHCP relay agent IP Address\n" \ @@ -35,7 +61,13 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c " [-A ] [-c ] [-p ]\n" \ " [-pf ] [--no-pid]\n"\ " [-m append|replace|forward|discard]\n" \ -@@ -154,14 +166,15 @@ ++" [--name-alias-map-file ]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ + " server0 [ ... serverN]\n\n" \ + " dhcrelay -6 [-d] [-q] [-I] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n" \ ++" [--name-alias-map-file ]\n" \ + " [-s ]\n" \ " -l lower0 [ ... -l lowerN]\n" \ " -u upper0 [ ... -u upperN]\n" \ " lower (client link): [address%%]interface[#index]\n" \ @@ -49,13 +81,14 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c +" [-A ] [-c ] [-p ]\n" \ +" [-pf ] [--no-pid]\n"\ " [-m append|replace|forward|discard]\n" \ ++" [--name-alias-map-file ]\n" \ " [-i interface0 [ ... -i interfaceN]\n" \ -" server0 [ ... serverN]\n\n" +" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE #endif static void usage() { -@@ -287,6 +300,15 @@ +@@ -287,6 +315,15 @@ local_family_set = 1; local_family = AF_INET; #endif @@ -71,7 +104,59 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c add_agent_options = 1; } else if (!strcmp(argv[i], "-A")) { #ifdef DHCPv6 -@@ -937,6 +959,166 @@ +@@ -383,6 +420,13 @@ + no_dhcrelay_pid = ISC_TRUE; + } else if (!strcmp(argv[i], "--no-pid")) { + no_pid_file = ISC_TRUE; ++ } else if (!strcmp(argv[i], "--name-alias-map-file")) { ++ if (++i == argc) ++ usage(); ++ if (load_interface_alias_map(argv[i]) != 0) ++ log_fatal("Failed to load interface name-alias map."); ++ path_dhcrelay_pid = argv[i]; ++ no_dhcrelay_pid = ISC_TRUE; + } else if (!strcmp(argv[i], "--version")) { + log_info("isc-dhcrelay-%s", PACKAGE_VERSION); + exit(0); +@@ -602,6 +646,8 @@ + dispatch(); + + /* In fact dispatch() never returns. */ ++ free_interface_alias_map(); ++ + return (0); + } + +@@ -690,10 +736,9 @@ + &to, htop) < 0) { + ++server_packet_errors; + } else { +- log_debug("Forwarded BOOTREPLY for %s to %s", +- print_hw_addr(packet->htype, packet->hlen, +- packet->chaddr), +- inet_ntoa(to.sin_addr)); ++ //log_debug("Forwarded BOOTREPLY for %s to %s", ++ // print_hw_addr(packet->htype, packet->hlen, packet->chaddr), ++ // inet_ntoa(to.sin_addr)); + + ++server_packets_relayed; + } +@@ -732,10 +777,10 @@ + &sp->to, NULL) < 0) { + ++client_packet_errors; + } else { +- log_debug("Forwarded BOOTREQUEST for %s to %s", +- print_hw_addr(packet->htype, packet->hlen, +- packet->chaddr), +- inet_ntoa(sp->to.sin_addr)); ++ //log_debug("Forwarded BOOTREQUEST for %s to %s", ++ // print_hw_addr(packet->htype, packet->hlen, packet->chaddr), ++ // inet_ntoa(sp->to.sin_addr)); ++ + ++client_packets_relayed; + } + } +@@ -937,6 +982,152 @@ return (-1); } @@ -106,9 +191,8 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c + if (cmd != NULL) { + while (fgets(buf, sizeof(buf), cmd)) { + sscanf(buf, FDB_LINE_FORMAT, macAddr, interface, vlanid); -+ log_debug ("bridgefdbquery: macAddr:%s interface: %s vlanid %d", -+ macAddr, -+ interface, *vlanid); ++ //log_debug("bridgefdbquery: macAddr:%s interface: %s vlanid %d", ++ // macAddr, interface, *vlanid); + } + pclose(cmd); + return 0; @@ -149,7 +233,7 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c + + case 'p': /* Name of interface that we received the request from */ + /* -+ * Query FDB to identify the exact physical interface only when source MAC address ++ * Query FDB to identify the exact physical interface only when source MAC address + * is present and '20: DHCP relay agent IP address' (giaddr) is not present + */ + if (packet->htype && !packet->giaddr.s_addr) { @@ -160,42 +244,29 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c + &vlanid); + + if (ret < 0) { -+ log_debug("MAC Address: %s (interface:%s vlan:%d) not found in bridge fdb show", -+ print_hw_addr (packet->htype, packet->hlen, packet->chaddr), -+ ip->name, -+ vlanid); ++ //log_debug("MAC Address: %s (interface:%s vlan:%d) not found in bridge fdb show", ++ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), ++ // ip->name, ++ // vlanid); ++ + strncpy(ifname, ip->name, IFNAMSIZ); + } + else if (strlen(ip->name) > 0) { -+ char cmdstr[256] = { 0 }; -+ char cmdout[256] = { 0 }; -+ -+ log_debug("Adding option 82 interface name for MAC Address: %s as %s", -+ print_hw_addr (packet->htype, packet->hlen, packet->chaddr), -+ ip->name); -+ -+ // Translate SONiC interface name to vendor alias -+ sprintf(cmdstr, "sonic-cfggen -m /etc/sonic/minigraph.xml -v \"minigraph_ports['%s'].alias\"", ip->name); -+ -+ FILE *cmd = popen(cmdstr, "r"); -+ -+ if (cmd != NULL) { -+ while (fgets(cmdout, sizeof(cmdout), cmd)) { -+ // Strip any trailing newline -+ if (cmdout[strlen(cmdout) - 1] == '\n') -+ cmdout[strlen(cmdout) - 1] = '\0'; -+ -+ log_debug ("Retrieved alias %s for interface %s", buf, ip->name); ++ // Translate SONiC interface name to vendor alias ++ if (get_interface_alias_by_name(ip->name, ifname) < 0) { ++ log_error("Failed to retrieve alias for interface name '%s'. Defaulting to interface name.", ip->name); ++ strncpy(ifname, ip->name, IFNAMSIZ); + } + -+ pclose(cmd); ++ //log_debug("Mapped interface name '%s' to alias '%s'", ip->name, ifname); ++ ++ //log_debug("Adding option 82 interface alias for MAC Address %s as '%s'", ++ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), ++ // ifname); + } + -+ strncpy(ifname, cmdout, IFNAMSIZ); ++ str = ifname; + } -+ -+ str = ifname; -+ } + break; + + case 'P': /* Physical address of interface that we received the request from */ @@ -238,7 +309,7 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c /* * Examine a packet to see if it's a candidate to have a Relay * Agent Information option tacked onto its tail. If it is, tack -@@ -948,6 +1130,8 @@ +@@ -948,6 +1139,8 @@ int is_dhcp = 0, mms; unsigned optlen; u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL; @@ -247,7 +318,7 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c /* If we're not adding agent options to packets, we can skip this. */ -@@ -1077,6 +1261,38 @@ +@@ -1077,6 +1270,38 @@ op = sp; #endif @@ -262,8 +333,8 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c + ip->circuit_id = (uint8_t *)circuit_id_buf; + ip->circuit_id_len = len; + -+ log_debug("sending on %s option82:circuit_id='%s'(%d)", -+ ip->name, (char *)ip->circuit_id, ip->circuit_id_len); ++ //log_debug("Sending on %s option82:circuit_id='%s' (%d)", ++ // ip->name, (char *)ip->circuit_id, ip->circuit_id_len); + } + } + @@ -278,12 +349,94 @@ diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c + ip->remote_id = (uint8_t *)remote_id_buf; + ip->remote_id_len = len; + -+ log_debug("sending on %s option82:remote_id='%s'(%d)", -+ ip->name, (char *)ip->remote_id, ip->remote_id_len); ++ //log_debug("Sending on %s option82:remote_id='%s' (%d)", ++ // ip->name, (char *)ip->remote_id, ip->remote_id_len); + } + } + /* Sanity check. Had better not ever happen. */ if ((ip->circuit_id_len > 255) ||(ip->circuit_id_len < 1)) log_fatal("Circuit ID length %d out of range [1-255] on " - +@@ -1102,7 +1327,7 @@ + * If not, forward without adding the option. + */ + if (max - sp >= optlen + 3) { +- log_debug("Adding %d-byte relay agent option", optlen + 3); ++ //log_debug("Adding %d-byte relay agent option", optlen + 3); + + /* Okay, cons up *our* Relay Agent Information option. */ + *sp++ = DHO_DHCP_AGENT_OPTIONS; +@@ -1726,3 +1951,73 @@ + + exit(0); + } ++ ++#define MAX_PORT_CONFIG_LINE_LEN 1024 ++ ++// Allocates and loads global map g_interface_name_alias_map ++// Also sets global g_interface_name_alias_map_size ++static int ++load_interface_alias_map(const char *port_alias_map_file_path) { ++ int i = 0; ++ FILE *fp = NULL; ++ char line[MAX_PORT_CONFIG_LINE_LEN] = { 0 }; ++ ++ fp = fopen(port_alias_map_file_path,"r"); ++ if (fp == NULL) { ++ log_error("Unable to open %s", port_alias_map_file_path); ++ return -1; ++ } ++ ++ g_interface_name_alias_map_size = 0; ++ ++ // Count the number of interfaces listed in the file ++ while (fgets(line, sizeof(line), fp)) { ++ g_interface_name_alias_map_size++; ++ } ++ ++ // Allocate our map accordingly ++ g_interface_name_alias_map = ((struct interface_name_alias_tuple *) ++ dmalloc((sizeof(struct interface_name_alias_tuple) * g_interface_name_alias_map_size), ++ MDL)); ++ ++ // Reset file position indicator to beginning of file ++ fseek(fp, 0, SEEK_SET); ++ ++ // Every line should contain exactly one name-alias pair ++ while (fgets(line, sizeof(line), fp)) { ++ // Each line should read as "" ++ sscanf(line, "%s %s", g_interface_name_alias_map[i].if_name, g_interface_name_alias_map[i].if_alias); ++ i++; ++ } ++ ++ fclose(fp); ++ ++ log_info("Loaded %d interface name-alias mappings", i); ++ ++ return 0; ++} ++ ++// Locates alias for port named if_name, copies alias into if_alias_out, up to a ++// max of IFNAMSIZ bytes. ++// Returns 0 on success, -1 on failure ++static int ++get_interface_alias_by_name(const char *if_name, char *if_alias_out) { ++ int i = 0; ++ ++ for (i = 0; i < g_interface_name_alias_map_size; i++) { ++ if (strncmp(if_name, g_interface_name_alias_map[i].if_name, IFNAMSIZ) == 0) { ++ strncpy(if_alias_out, g_interface_name_alias_map[i].if_alias, IFNAMSIZ); ++ return 0; ++ } ++ } ++ ++ return -1; ++} ++ ++// Frees global map g_interface_name_alias_map ++// Sets g_interface_name_alias_map_size to 0 ++static void ++free_interface_alias_map(void) { ++ free(g_interface_name_alias_map); ++ g_interface_name_alias_map_size = 0; ++} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 997008af5cee..e6533ce7beeb 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -175,6 +175,14 @@ def parse_dpg(dpg, hname): for i, member in enumerate(vmbr_list): vmbr_list[i] = port_alias_map.get(member, member) vlan_attributes = {'members': vmbr_list, 'vlanid': vlanid} + + # If this VLAN requires a DHCP relay agent, it will contain a element + # containing a list of DHCP server IPs + if vintf.find(str(QName(ns, "DhcpRelays"))) is not None: + vintfdhcpservers = vintf.find(str(QName(ns, "DhcpRelays"))).text + vdhcpserver_list = vintfdhcpservers.split(';') + vlan_attributes['dhcp_servers'] = vdhcpserver_list + sonic_vlan_name = "Vlan%s" % vlanid vlans[sonic_vlan_name] = vlan_attributes diff --git a/src/sonic-config-engine/tests/pc-test-graph.xml b/src/sonic-config-engine/tests/pc-test-graph.xml index 7d7ec74a8631..2cb281b879cb 100644 --- a/src/sonic-config-engine/tests/pc-test-graph.xml +++ b/src/sonic-config-engine/tests/pc-test-graph.xml @@ -108,6 +108,7 @@ False 0.0.0.0/0 + 192.0.0.1;192.0.0.2 1000 1000 192.168.0.0/27 diff --git a/src/sonic-config-engine/tests/sample_output/isc-dhcp-relay b/src/sonic-config-engine/tests/sample_output/isc-dhcp-relay deleted file mode 100644 index 4a851af34eb9..000000000000 --- a/src/sonic-config-engine/tests/sample_output/isc-dhcp-relay +++ /dev/null @@ -1,7 +0,0 @@ -SERVERS="192.0.0.1 192.0.0.2 192.0.0.3 192.0.0.4 192.0.0.5 192.0.0.6 192.0.0.7 192.0.0.8 192.0.0.9 192.0.0.10 192.0.0.11 192.0.0.12 192.0.0.13 192.0.0.14 192.0.0.15 192.0.0.16 192.0.0.17 192.0.0.18 192.0.0.19 192.0.0.20 192.0.0.21 192.0.0.22 192.0.0.23 192.0.0.24 192.0.0.25 192.0.0.26 192.0.0.27 192.0.0.28 192.0.0.29 192.0.0.30 192.0.0.31 192.0.0.32 192.0.0.33 192.0.0.34 192.0.0.35 192.0.0.36 192.0.0.37 192.0.0.38 192.0.0.39 192.0.0.40 192.0.0.41 192.0.0.42 192.0.0.43 192.0.0.44 192.0.0.45 192.0.0.46 192.0.0.47 192.0.0.48" - -INTERFACES="Vlan1000 PortChannel01 PortChannel02 PortChannel03 PortChannel04" - -# '-a' option provides option 82 circuit id information -OPTIONS="-a" - diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 7daae24f49a6..89f53af83e41 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -130,6 +130,7 @@ Vlan1000 fortyGigE0/8 + 192.0.0.1;192.0.0.2 1000 1000 192.168.0.0/27 diff --git a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml index 8a21c041c80e..18a8baccdae2 100644 --- a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml +++ b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml @@ -203,6 +203,7 @@ False 0.0.0.0/0 + 192.0.0.1;192.0.0.2 1000 1000 192.168.0.0/27 diff --git a/src/sonic-config-engine/tests/t0-sample-graph-everflow.xml b/src/sonic-config-engine/tests/t0-sample-graph-everflow.xml index 355f01122f0d..6a078b48cf99 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph-everflow.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph-everflow.xml @@ -198,6 +198,7 @@ False 0.0.0.0/0 + 192.0.0.1;192.0.0.2 1000 1000 192.168.0.0/27 diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index 62a41105f937..fe0b1a1e2500 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -206,6 +206,7 @@ False 0.0.0.0/0 + 192.0.0.1;192.0.0.2 1000 1000 192.168.0.0/27 diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index d78b19d88ba7..23256079856b 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -83,7 +83,7 @@ def test_minigraph_interfaces(self): def test_minigraph_vlans(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'Vlan1000': {'members': ['Ethernet8'], 'vlanid': '1000'}}") + self.assertEqual(output.strip(), "{'Vlan1000': {'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'members': ['Ethernet8'], 'vlanid': '1000'}}") def test_minigraph_vlan_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "VLAN_INTERFACE.keys()"' From 60339dc27d2a5f33544e5b369d5ad87e51fe8c25 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 5 Oct 2017 11:30:31 -0700 Subject: [PATCH 0819/1833] [sonic-utilities]: Update submodule to fix broken 'show' command (#1013) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 2c63a413cd48..ddadc2b2c358 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 2c63a413cd48f4d73e149bb594dd5ead5dd6e2db +Subproject commit ddadc2b2c3586130117f0ceea19e5aed428d4157 From bea7476aa8a43934de348512b610b57bb37d8f52 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 5 Oct 2017 21:01:08 -0700 Subject: [PATCH 0820/1833] Update sonic-utilities pointer (#1017) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index ddadc2b2c358..3a40ff94dc24 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ddadc2b2c3586130117f0ceea19e5aed428d4157 +Subproject commit 3a40ff94dc240a751d77547eb91083a5f7a6f7a3 From b07886ec3c64dfc2559585206f5f69c78ff29f97 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 5 Oct 2017 21:43:25 -0700 Subject: [PATCH 0821/1833] [build_debian]: Install grub-common in the base image (#1014) --- build_debian.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index a21cdada0243..3c6673a53ec4 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -207,7 +207,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in kexec-tools \ less \ unzip \ - gdisk + gdisk \ + grub2-common sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ grub-pc-bin From 7fa502a45e3d0ba873f89494c8973a49919a7b74 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 5 Oct 2017 21:45:34 -0700 Subject: [PATCH 0822/1833] [cfggen] Fix a bug in --var-json option with multi-keys (#1015) --- src/sonic-config-engine/sonic-cfggen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 5303557c4fb4..9f1323dab2eb 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -200,7 +200,7 @@ def main(): print template.render(data) if args.var_json != None: - print json.dumps(data[args.var_json], indent=4, cls=minigraph_encoder) + print json.dumps(FormatConverter.to_serialized(data[args.var_json]), indent=4, cls=minigraph_encoder) if args.write_to_db: configdb = ConfigDBConnector() From 8a305ce9c9e9a79b1b3038075fead50ad369b49c Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 6 Oct 2017 12:46:47 -0700 Subject: [PATCH 0823/1833] [sonic-utilities]: Build as Debian package once again (revert change to wheel) (#1018) --- files/build_templates/sonic_debian_extension.j2 | 8 +++----- rules/sonic-utilities.mk | 8 +++----- slave.mk | 3 +-- src/sonic-utilities | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index a08872c4ea42..04f5181ff610 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -77,11 +77,9 @@ sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME sudo LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME -# Install SONiC Utilities Python package -SONIC_UTILITIES_WHEEL_NAME=$(basename {{sonic_utilities_wheel_path}}) -sudo cp {{sonic_utilities_wheel_path}} $FILESYSTEM_ROOT/$SONIC_UTILITIES_WHEEL_NAME -sudo LANG=C chroot $FILESYSTEM_ROOT pip install $SONIC_UTILITIES_WHEEL_NAME -sudo rm -rf $FILESYSTEM_ROOT/$SONIC_UTILITIES_WHEEL_NAME +# Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f # SONiC utilities installs bash-completion as a dependency. However, it is disabled by default # in bash.bashrc, so we copy a version of the file with it enabled here. diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 1634ab88f46a..9349813f5c4e 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -1,7 +1,5 @@ # sonic utilities package -SONIC_UTILITIES = sonic_utilities-1.1-py2-none-any.whl -$(SONIC_UTILITIES)_SRC_PATH = $(SRC_PATH)/sonic-utilities -$(SONIC_UTILITIES)_PYTHON_VERSION = 2 -$(SONIC_UTILITIES)_DEPENDS += $(SWSSSDK_PY2) -SONIC_PYTHON_WHEELS += $(SONIC_UTILITIES) +SONIC_UTILS = python-sonic-utilities_1.1-1_all.deb +$(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities +SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS) diff --git a/slave.mk b/slave.mk index 16fea944853e..c26e4932f05a 100644 --- a/slave.mk +++ b/slave.mk @@ -380,7 +380,7 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_DEVICE_DATA)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) $(HEADER) # Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" @@ -397,7 +397,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" export config_engine_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))" export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))" - export sonic_utilities_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES))" $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" diff --git a/src/sonic-utilities b/src/sonic-utilities index 3a40ff94dc24..77c9f811d23d 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 3a40ff94dc240a751d77547eb91083a5f7a6f7a3 +Subproject commit 77c9f811d23dd83abc4bc429b329a5e50a2abba6 From 758c5e9a2e31c42645f00ecebdf960750e57e464 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 6 Oct 2017 23:37:35 -0700 Subject: [PATCH 0824/1833] [submodule]: update sonic-utilities (#1020) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 77c9f811d23d..6103ce8f21a0 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 77c9f811d23dd83abc4bc429b329a5e50a2abba6 +Subproject commit 6103ce8f21a0d4b5177ac5449f68f77ac179c7db From dc0f3ceb5c742c4e588388fe4f506b2728343d7e Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 8 Oct 2017 02:10:14 -0700 Subject: [PATCH 0825/1833] add version tag for the docker images (#1021) docker images are also tagged with the same image version. --- files/build_templates/sonic_debian_extension.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 04f5181ff610..8270af923078 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -193,7 +193,10 @@ sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/ {% if installer_images.strip() -%} {% for image in installer_images.strip().split(' ') -%} +{% set imagefilename = image.split('/')|last -%} +{% set imagename = imagefilename.split('.')|first -%} sudo LANG=C chroot $FILESYSTEM_ROOT docker load < {{image}} +sudo LANG=C chroot $FILESYSTEM_ROOT docker tag {{imagename}}:latest {{imagename}}:$(sonic_get_version) {% endfor %} sudo chroot $FILESYSTEM_ROOT service docker stop {% for script in installer_start_scripts.split(' ') -%} From 04814cb135b18018eaffbfa4cbeee175cc97cd3d Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 9 Oct 2017 22:50:08 -0700 Subject: [PATCH 0826/1833] [dockers]: Remove deprecated sswsyncd dockers (#1026) --- dockers/docker-mlnx-sswsyncd-rpc/Dockerfile | 38 --------------------- dockers/docker-mlnx-sswsyncd/Dockerfile | 33 ------------------ dockers/docker-sswsyncd/Dockerfile | 27 --------------- 3 files changed, 98 deletions(-) delete mode 100644 dockers/docker-mlnx-sswsyncd-rpc/Dockerfile delete mode 100755 dockers/docker-mlnx-sswsyncd/Dockerfile delete mode 100755 dockers/docker-sswsyncd/Dockerfile diff --git a/dockers/docker-mlnx-sswsyncd-rpc/Dockerfile b/dockers/docker-mlnx-sswsyncd-rpc/Dockerfile deleted file mode 100644 index 4d1b3e49bcda..000000000000 --- a/dockers/docker-mlnx-sswsyncd-rpc/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -FROM docker-base - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -## Pre-install the fundamental packages -RUN apt-get update \ - && apt-get -y install \ - net-tools - -COPY deps /deps -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/python-tabulate_*.deb \ - && dpkg_apt /deps/applibs_*.deb \ - && dpkg_apt /deps/applibs-dev_*.deb \ - && dpkg_apt /deps/sx-complib_*.deb \ - && dpkg_apt /deps/sxd-libs_*.deb \ - && dpkg_apt /deps/sx-scew_*.deb \ - && dpkg_apt /deps/sx-examples_*.deb \ - && dpkg_apt /deps/sx-gen-utils_*.deb \ - && dpkg_apt /deps/python-sdk-api_*.deb \ - && dpkg_apt /deps/sx-libnl_*.deb \ - && dpkg_apt /deps/iproute2_*.deb \ - && dpkg_apt /deps/libsswsdk_*.deb \ - && dpkg_apt /deps/libthrift-0.9.3_*.deb \ - && dpkg_apt /deps/libthrift-dev_*.deb - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ - dpkg_apt /deps/mlnx-sai_*.deb \ - && dpkg_apt /deps/sswsyncd-saithrift_*.deb - -## Clean up -RUN apt-get clean -y ; apt-get autoclean -y ; apt-get autoremove -y ; rm -rf /deps - -ENTRYPOINT service rsyslog start \ - && mkdir -p /dev/sxdevs && ( [ -e /dev/sxdevs/sxcdev ] || mknod /dev/sxdevs/sxcdev c 231 193 ) \ - && service sswsyncd start \ - && /bin/bash diff --git a/dockers/docker-mlnx-sswsyncd/Dockerfile b/dockers/docker-mlnx-sswsyncd/Dockerfile deleted file mode 100755 index 631ff2e18030..000000000000 --- a/dockers/docker-mlnx-sswsyncd/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM docker-base - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -## Pre-install the fundamental packages -RUN apt-get update \ - && apt-get -y install \ - net-tools - -COPY deps /deps -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-tabulate_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/applibs_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/applibs-dev_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-complib_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sxd-libs_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-scew_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-examples_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-gen-utils_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-sdk-api_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-libnl_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/iproute2_*.deb - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/mlnx-sai_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsswsdk_*.deb -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sswsyncd_*.deb - -ENTRYPOINT service rsyslog start \ - && mkdir -p /dev/sxdevs && ( [ -e /dev/sxdevs/sxcdev ] || mknod /dev/sxdevs/sxcdev c 231 193 ) \ - && sleep 5 && service sswsyncd start \ - && /bin/bash diff --git a/dockers/docker-sswsyncd/Dockerfile b/dockers/docker-sswsyncd/Dockerfile deleted file mode 100755 index 0f555d8b51bf..000000000000 --- a/dockers/docker-sswsyncd/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM docker-base - -COPY \ - deps/python-tabulate_*.deb \ - deps/libopennsl_*.deb \ - deps/libsaibcm_*.deb \ - deps/libsswsdk_*.deb \ - deps/sswsyncd_*.deb \ - /deps/ - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -## Install packages -## Clean up -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ - dpkg_apt /deps/python-tabulate_*.deb && \ - dpkg_apt /deps/libopennsl_*.deb && \ - dpkg_apt /deps/libsaibcm_*.deb && \ - dpkg_apt /deps/libsswsdk_*.deb && \ - dpkg_apt /deps/sswsyncd_*.deb && \ - apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ - rm -rf /deps - -ENTRYPOINT service rsyslog start \ - && service sswsyncd start \ - && /bin/bash From ecd99c73d1b9174296ec987265fb315eea047fdb Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 10 Oct 2017 22:49:06 +0300 Subject: [PATCH 0827/1833] [swss]: Flush flex counter DB in swss_serivce.j2 (#1029) --- files/build_templates/swss.service.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index af922530d8a2..74fafb003767 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -17,6 +17,7 @@ ExecStartPre=/bin/bash -c "while true; do if [ \"$(/usr/bin/docker exec database ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB +ExecStartPre=/usr/bin/docker exec database redis-cli -n 5 FLUSHDB {% if sonic_asic_platform == 'mellanox' %} TimeoutStartSec=3min From f681fd17eb234533e858b8dc16d2740b78622a05 Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Tue, 10 Oct 2017 12:58:56 -0700 Subject: [PATCH 0828/1833] [Seastone]: Adjusting Seastone's sfputil plugin to cope with new SfpUtil API. (#1022) There are multiple platforms that need to be transitioned to the new SfpUtilBase interface - I'm only taking care of Celestica-Seastone in this patch. --- .../x86_64-cel_seastone-r0/plugins/sfputil.py | 59 +++++++++++++++---- 1 file changed, 46 insertions(+), 13 deletions(-) mode change 100644 => 100755 device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py diff --git a/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py b/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py old mode 100644 new mode 100755 index f3943e734b58..7ff632e152b9 --- a/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py +++ b/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py @@ -1,25 +1,58 @@ #!/usr/bin/env python +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + 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""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 31 - ports_in_block = 32 + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} + qsfp_ports = range(0, PORTS_IN_BLOCK + 1) - _qsfp_ports = range(0, ports_in_block + 1) + @property + def port_start(self): + return self.PORT_START - def __init__(self, port_num): + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + 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): + + for x in range(self.PORT_START, self.PORT_END + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format( x + 26 ) - sfputilbase.__init__(self, port_num) + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + raise NotImplementedError + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + raise NotImplementedError + + def reset(self, port_num): + raise NotImplementedError + From fc7246f418fba64b1370ea5c7a4289bb82c4621b Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 11 Oct 2017 05:45:17 +0300 Subject: [PATCH 0829/1833] [swss]: Update QoS config file name for Mellanox platform (#1028) Signed-off-by: Andriy Moroz --- dockers/docker-orchagent/swssconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 55a22c5353c8..f780ae8afb20 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -49,7 +49,7 @@ elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [[ "$HWSKU" == "ACS-MSN27"* ]]; then sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json - SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json msn2700.32ports.qos.json " + SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json msn27xx.32ports.qos.json " fi for file in $SWSSCONFIG_ARGS; do From 6c15acc49b5d0fc654e13bfd1ac004349752a339 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 11 Oct 2017 15:11:26 -0700 Subject: [PATCH 0830/1833] [swss]: Export ASIC as the env variable (#1030) - the env variable 'platform' is not universal across different platforms this line will be removed once the related code in sonic-swss is refactored Signed-off-by: Shu0T1an ChenG --- dockers/docker-orchagent/orchagent.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 7103afcb81e9..57f28e4e78dc 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -4,7 +4,7 @@ # vendor specific code. export platform=`sonic-cfggen -v onie_switch_asic` -ASIC=`sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type` +export ASIC=`sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type` MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` From 51ebdf43ace288e4e5b38f5b5b8f60cbebd48a14 Mon Sep 17 00:00:00 2001 From: nikos-li <31227248+nikos-li@users.noreply.github.com> Date: Wed, 11 Oct 2017 15:31:38 -0700 Subject: [PATCH 0831/1833] [frr]: Support for nhopself, keepalive and holdtime timers, prefer global ebgp nexthop (#1024) * RR client support in minigraph for FRR * Fix python warning from previous rrclient commit and move config handling to a more relevant place for this cmd * Add config support for nhopself, keepalive and holdtime timers. * Add route-map to prefer global nexthops for ebgp learned prefixes. --- dockers/docker-fpm-frr/bgpd.conf.j2 | 13 ++++++++++ src/sonic-config-engine/minigraph.py | 27 +++++++++++++++----- src/sonic-config-engine/tests/test_cfggen.py | 2 +- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index 5452a976368a..07e2dd0c571e 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -51,6 +51,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% if bgp_session['asn'] | int != 0 %} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} + neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }} {% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} @@ -59,6 +60,9 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} neighbor {{ neighbor_addr }} activate {% if bgp_session['rrclient'] | int != 0 %} neighbor {{ neighbor_addr }} route-reflector-client +{% endif %} +{% if bgp_session['nhopself'] | int != 0 %} + neighbor {{ neighbor_addr }} next-hop-self {% endif %} maximum-paths 64 exit-address-family @@ -68,6 +72,12 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} neighbor {{ neighbor_addr }} activate {% if bgp_session['rrclient'] | int != 0 %} neighbor {{ neighbor_addr }} route-reflector-client +{% endif %} +{% if bgp_session['nhopself'] | int != 0 %} + neighbor {{ neighbor_addr }} next-hop-self +{% endif %} +{% if bgp_session['asn'] != DEVICE_METADATA['localhost']['bgp_asn'] %} + neighbor {{ neighbor_addr }} route-map set-next-hop-global-v6 in {% endif %} maximum-paths 64 exit-address-family @@ -81,3 +91,6 @@ maximum-paths 64 route-map ISOLATE permit 10 set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! +route-map set-next-hop-global-v6 permit 10 +set ipv6 next-hop prefer-global +! diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index e6533ce7beeb..c38abb051257 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -224,24 +224,38 @@ def parse_cpg(cpg, hname): start_peer = session.find(str(QName(ns, "StartPeer"))).text end_router = session.find(str(QName(ns, "EndRouter"))).text end_peer = session.find(str(QName(ns, "EndPeer"))).text + rrclient = 1 if session.find(str(QName(ns, "RRClient"))) is not None else 0 + if session.find(str(QName(ns, "HoldTime"))) is not None: + holdtime = session.find(str(QName(ns, "HoldTime"))).text + else: + holdtime = 180 + if session.find(str(QName(ns, "KeepAliveTime"))) is not None: + keepalive = session.find(str(QName(ns, "KeepAliveTime"))).text + else: + keepalive = 60 + nhopself = 1 if session.find(str(QName(ns, "NextHopSelf"))) is not None else 0 if end_router == hname: bgp_sessions[start_peer] = { 'name': start_router, - 'local_addr': end_peer + 'local_addr': end_peer, + 'rrclient': rrclient, + 'holdtime': holdtime, + 'keepalive': keepalive, + 'nhopself': nhopself } else: bgp_sessions[end_peer] = { 'name': end_router, - 'local_addr': start_peer + 'local_addr': start_peer, + 'rrclient': rrclient, + 'holdtime': holdtime, + 'keepalive': keepalive, + 'nhopself': nhopself } elif child.tag == str(QName(ns, "Routers")): for router in child.findall(str(QName(ns1, "BGPRouterDeclaration"))): asn = router.find(str(QName(ns1, "ASN"))).text hostname = router.find(str(QName(ns1, "Hostname"))).text - if router.find(str(QName(ns1, "RRClient"))): - rrclient = '1' - else: - rrclient = '0' if hostname == hname: myasn = asn peers = router.find(str(QName(ns1, "Peers"))) @@ -260,7 +274,6 @@ def parse_cpg(cpg, hname): bgp_session = bgp_sessions[peer] if hostname == bgp_session['name']: bgp_session['asn'] = asn - bgp_session['rrclient'] = rrclient return bgp_sessions, myasn, bgp_peers_with_range diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 23256079856b..91d14a043042 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -113,7 +113,7 @@ def test_minigraph_neighbors(self): 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) - self.assertEqual(output.strip(), "{'rrclient': '0', 'local_addr': '10.0.0.58', 'asn': '64600', 'name': 'ARISTA02T1'}") + self.assertEqual(output.strip(), "{'rrclient': 0, 'name': 'ARISTA02T1', 'local_addr': '10.0.0.58', 'nhopself': 0, 'holdtime': '180', 'asn': '64600', 'keepalive': '60'}") def test_minigraph_peers_with_range(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v BGP_PEER_RANGE.values\(\)' From 27cac94da7c052af3f0b10c99a563f0bf7fa88ad Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 11 Oct 2017 17:46:26 -0700 Subject: [PATCH 0832/1833] [Makefile]: Fix unmatched variable name ENABLE_SYNCD_RPC (#1032) Signed-off-by: Shu0T1an ChenG --- Makefile | 2 +- slave.mk | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d672edc6836a..b5bd895b37ad 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ SONIC_BUILD_INSTRUCTION := make \ BUILD_NUMBER=$(BUILD_NUMBER) \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ - SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ + ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) diff --git a/slave.mk b/slave.mk index c26e4932f05a..bbcdf4bc3599 100644 --- a/slave.mk +++ b/slave.mk @@ -59,10 +59,6 @@ list : ## Include other rules ############################################################################### -ifeq ($(SONIC_ENABLE_SYNCD_RPC),y) -ENABLE_SYNCD_RPC = y -endif - include $(RULES_PATH)/config include $(RULES_PATH)/functions include $(RULES_PATH)/*.mk From dbced4fb7728484ec6e70560067dedf505926042 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 12 Oct 2017 00:28:16 -0700 Subject: [PATCH 0833/1833] [snmp]: Add swss dependency for snmp service (#1034) - snmp service needs swss to be ready to get the port counter map Signed-off-by: Shu0T1an ChenG --- files/build_templates/snmp.service.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index 493d6bd8fcfd..08c41a52a5f7 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=SNMP container -Requires=database.service -After=database.service +Requires=database.service swss.service +After=database.service swss.service [Service] User={{ sonicadmin_user }} From 6eab72011be4ed8ef915ae26c7c44533b208ab56 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Thu, 12 Oct 2017 18:20:46 -0700 Subject: [PATCH 0834/1833] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c3d58ae1b538..0ac233452718 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Any server can be a build image server. We are using a server with 1T hard disk. # Prerequisites ## SAI Version -SONiC V2 is using [SAI 0.9.4](https://github.com/opencomputeproject/SAI/tree/v0.9.4). +Please refer to [SONiC roadmap](https://github.com/Azure/SONiC/wiki/Sonic-Roadmap-Planning) on the SAI version for each SONiC release. ## Clone or fetch the code repository with all git submodules To clone the code repository recursively, assuming git version 1.9 or newer: From 9e44d14197032a8cfb070742afa2ca356f798077 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 12 Oct 2017 20:58:16 -0700 Subject: [PATCH 0835/1833] [Dell]: Add Force10-S6100-T1 symlink to Force10-S6100 (#1038) --- device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100-T1 | 1 + 1 file changed, 1 insertion(+) create mode 120000 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100-T1 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100-T1 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100-T1 new file mode 120000 index 000000000000..36b1b840b83e --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100-T1 @@ -0,0 +1 @@ +Force10-S6100 \ No newline at end of file From 1a748ee0bb3643a79fb3af744488e5516da1e825 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 12 Oct 2017 20:59:14 -0700 Subject: [PATCH 0836/1833] Revert "Update QoS config name for Mellanox platform" (#1039) --- dockers/docker-orchagent/swssconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index f780ae8afb20..55a22c5353c8 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -49,7 +49,7 @@ elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [[ "$HWSKU" == "ACS-MSN27"* ]]; then sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json - SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json msn27xx.32ports.qos.json " + SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json msn2700.32ports.qos.json " fi for file in $SWSSCONFIG_ARGS; do From 118c2dd39dea81e7ee4d43645fa6a1621d0db53e Mon Sep 17 00:00:00 2001 From: Hnydyn Nazar Date: Sat, 14 Oct 2017 03:08:35 +0300 Subject: [PATCH 0837/1833] [ntp]: Fix NTP sync while using DHCP (#1035) --- files/image_config/ntp/ntp.conf.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/image_config/ntp/ntp.conf.j2 b/files/image_config/ntp/ntp.conf.j2 index ae72820339be..d7df6bcd2e04 100644 --- a/files/image_config/ntp/ntp.conf.j2 +++ b/files/image_config/ntp/ntp.conf.j2 @@ -29,9 +29,13 @@ server {{ ntp_server }} iburst #only listen on localhost and eth0 ips (default is to listen on all ip addresses) interface ignore wildcard +{% if MGMT_INTERFACE %} {% for (mgmt_intf, mgmt_prefix) in MGMT_INTERFACE %} interface listen {{ mgmt_prefix | ip }} {% endfor %} +{% else %} +interface listen eth0 +{% endif %} interface listen 127.0.0.1 # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for From b89555ed2f773ebd6a902a96e774df5abf7f1b08 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 13 Oct 2017 20:18:29 -0700 Subject: [PATCH 0838/1833] [Dell]: Update sonic-platform-modules-dell submodule (#1041) Including the following commits: Add support for Dell S6100 and Z9100 module deinit (#18) Disable S6100 low power mode by default (#19) Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sonic-platform-modules-dell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 1abd4e6c41f6..0b9a92290080 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 1abd4e6c41f633272667a5833a63ab6f8da15199 +Subproject commit 0b9a92290080910b675b454fbd65171a93504df6 From f7cdca42ce0253745e0a35817781bf0f6872a3dc Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sun, 15 Oct 2017 22:18:54 -0700 Subject: [PATCH 0839/1833] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ac233452718..5edaf3ae7f89 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ To build SONiC installer image and docker images, run the following commands: The SONiC installer contains all docker images needed. SONiC uses one image for all devices of a same ASIC vendor. The supported ASIC vendors are: - PLATFORM=broadcom -- PLATFORM=marvell (*pending*) +- PLATFORM=marvell - PLATFORM=mellanox - PLATFORM=cavium - PLATFORM=centec From 463c5e46ba127efdb4a88632a6f2be1d329c2ac7 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 16 Oct 2017 14:38:59 -0700 Subject: [PATCH 0840/1833] [Dell]: Update sonic-platform-modules-dell submodule (#1043) Including the following commit: depmod to ensure that modules get loaded after ONIE install / image upgrade Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sonic-platform-modules-dell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 0b9a92290080..8c330a508f78 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 0b9a92290080910b675b454fbd65171a93504df6 +Subproject commit 8c330a508f7860082ed4f6259fe8df4c5b4c9c92 From 37dc7bd4786c793796530e53da304b5e68b7ed16 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 16 Oct 2017 17:36:21 -0700 Subject: [PATCH 0841/1833] [interfaces]: Set hwaddr of VLAN interfaces to system MAC upon creation (#1042) --- .../interfaces/interfaces-config.sh | 17 +++++++++++++++-- files/image_config/interfaces/interfaces.j2 | 1 + .../tests/sample_output/interfaces | 1 + src/sonic-config-engine/tests/test_j2files.py | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 400b89a594c7..bd5111a01f73 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,6 +1,19 @@ #!/bin/bash -sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 >/etc/network/interfaces +SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) +SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') + +# Align last byte of MAC if necessary +if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then + last_byte=$(python -c "print '$SYSTEM_MAC_ADDRESS'[-2:]") + aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix + SYSTEM_MAC_ADDRESS=$(python -c "print '$SYSTEM_MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC +fi + +sonic-cfggen -d -a '{"hwaddr":"'$SYSTEM_MAC_ADDRESS'"}' -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces + [ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid -service networking restart + +systemctl restart networking + ifdown lo && ifup lo diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 6521eb7a67e1..2fdd04804ca4 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -90,6 +90,7 @@ iface {{ member }} inet manual auto {{ name }} iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static bridge_ports none + hwaddress ether {{ hwaddr }} address {{ prefix | ip }} netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} {% endfor %} diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index ec3b6f740bc4..89a23471a7ee 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -214,6 +214,7 @@ iface fortyGigE0/124 inet manual auto Vlan1000 iface Vlan1000 inet static bridge_ports none + hwaddress ether e4:1d:2d:a5:f3:ad address 192.168.0.1 netmask 255.255.255.224 # diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 4bdc1b41f5b4..7e948f8b6a2a 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -20,7 +20,7 @@ def run_script(self, argument): def test_interfaces(self): interfaces_template = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'interfaces', 'interfaces.j2') - argument = '-m ' + self.t0_minigraph + ' -t ' + interfaces_template + ' > ' + self.output_file + argument = '-m ' + self.t0_minigraph + ' -a \'{\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + interfaces_template + ' > ' + self.output_file self.run_script(argument) self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'interfaces'), self.output_file)) From 60a4d75b0786505e136be2af65732261643d160f Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 16 Oct 2017 19:46:44 -0700 Subject: [PATCH 0842/1833] [Broadcom]: Update Broadcom SAI package to 3.0.3.2-6 (#1044) msft patch: Trap all ARP packets including unicast/broadcast Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index ea804a69c0eb..459c02f824ce 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-5_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-5_amd64.deb?sv=2015-04-05&sr=b&sig=MQE6FrxHs%2BIUPjRaSpWagcSjY6bbHLCUYasusxILkEs%3D&se=2031-06-07T21%3A50%3A36Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-6_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-6_amd64.deb?sv=2015-04-05&sr=b&sig=78jpXMULiubmup2PBYzM5MCrt7KIHA913FlDOsdgmGY%3D&se=2031-06-25T21%3A52%3A36Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-5_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-6_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-5_amd64.deb?sv=2015-04-05&sr=b&sig=o8bjWlxxYAM%2F95aSshRFJE57JwKVjRaH4jDU2lDEoMg%3D&se=2031-06-07T21%3A50%3A19Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-6_amd64.deb?sv=2015-04-05&sr=b&sig=Vg%2BjJpwyJ3smRBaNVkbWH4xkNGOn%2BOxI0w3VcDgAxV0%3D&se=2031-06-25T21%3A52%3A54Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From b14c03a14d0da3b789aab6511c1ae29e56fe961a Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 17 Oct 2017 09:28:27 -0700 Subject: [PATCH 0843/1833] [utilities]: Update sonic-utilities submodule (#1045) [portstat]: Combine ADMIN and OPER fields Signed-off-by: Shu0T1an ChenG --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 6103ce8f21a0..99131067dc9b 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 6103ce8f21a0d4b5177ac5449f68f77ac179c7db +Subproject commit 99131067dc9bafe231ec064bb5b27ccc7fefe237 From e5c68d3bfe4784132438b2799987b7670546fdda Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 17 Oct 2017 09:28:35 -0700 Subject: [PATCH 0844/1833] [snmp]: Update sonic-snmpagent submodule (#1046) Signed-off-by: Qi Luo --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index bc4becf97ea6..d9d85a1383d7 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit bc4becf97ea69c15315414e8c7cba44067af2461 +Subproject commit d9d85a1383d752220054a714487899c06b697863 From ee168b0c09e5f99e7155457478a0d8da8fe6c886 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 17 Oct 2017 14:49:20 -0700 Subject: [PATCH 0845/1833] [py-swsssdk]: Update sonic-py-swsssdk submodule (#1048) Including this commit: [port_util]: Return empty dictionary instead of a NoneType in get_bridge_port_map Signed-off-by: Shu0T1an ChenG --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 96b4928e790b..a21b7a929ab6 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 96b4928e790bbce7c959f0b5cbb0510e5954afb1 +Subproject commit a21b7a929ab63f027e4a0d2f919145d8054b8011 From 03e532aa816cdbc6700985cec2dc599cb68db774 Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Tue, 17 Oct 2017 16:33:16 -0700 Subject: [PATCH 0846/1833] [utilities]: Update sonic-utilities submodule [portstat]: Fix typo Signed-off-by: Shu0T1an ChenG --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 99131067dc9b..8e20a3dc90fd 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 99131067dc9bafe231ec064bb5b27ccc7fefe237 +Subproject commit 8e20a3dc90fdfe86d3a74675c24de91b97e9d3c7 From 7a0a2ea5d0924d6d587a69687e3945fd941cd64e Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 17 Oct 2017 18:28:27 -0700 Subject: [PATCH 0847/1833] [bgpd.conf] Advertise /64 prefix for ipv6 lo addresses (#1050) --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index 0ef144016246..3d01d9d52714 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -43,7 +43,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} network {{ prefix | ip }}/32 {% elif prefix | ipv6 %} address-family ipv6 - network {{ prefix | ip }}/128 + network {{ prefix | ip }}/64 exit-address-family {% endif %} {% endfor %} From 834890f192d89874eab02293fc316f91546e393f Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 18 Oct 2017 01:14:15 -0700 Subject: [PATCH 0848/1833] [Broadcom]: Update Broadcom SAI package to 3.0.3.2-7 (#1049) Update Accton config.bcm files Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 459c02f824ce..bf20f0dc706f 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-6_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-6_amd64.deb?sv=2015-04-05&sr=b&sig=78jpXMULiubmup2PBYzM5MCrt7KIHA913FlDOsdgmGY%3D&se=2031-06-25T21%3A52%3A36Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-7_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-7_amd64.deb?sv=2015-04-05&sr=b&sig=RUUm3WJuGYmtIatkKtR5iAuI%2FG2KM9hMXewAEnR2AKY%3D&se=2031-06-26T21%3A45%3A55Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-6_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-7_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-6_amd64.deb?sv=2015-04-05&sr=b&sig=Vg%2BjJpwyJ3smRBaNVkbWH4xkNGOn%2BOxI0w3VcDgAxV0%3D&se=2031-06-25T21%3A52%3A54Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-7_amd64.deb?sv=2015-04-05&sr=b&sig=hTQZeaqa7oiR9YTIuUGG1DGYNg8bwlWKB2J2r46Mq%2BE%3D&se=2031-06-26T21%3A46%3A16Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From d302d713a69d73b0becaab3489e7efd2872c07a8 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Wed, 18 Oct 2017 19:43:46 -0700 Subject: [PATCH 0849/1833] [Arista]: Extra space in filename resulted in initialization failure (#1053) * Extra space removed --- .../x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile index 29a42f07a734..c04ad3498582 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x100G.config.bcm From 2a564791875aeceb101db378c54c5fe9dadeab97 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 19 Oct 2017 00:38:25 -0700 Subject: [PATCH 0850/1833] [sonic-cfggen]: Add DEVICE_NEIGHBOR_METADATA field and move msn27xx template (#1025) This field contains all neighbor devices information using the device hostname as the key and having lo_addr, mgmt_addr, hwsku, type as the attributes. Move the file msn27xx.32ports.buffers.json.j2 from sonic-swss repository to this repository so that we could add unit test for this file. Unit test is added for platform ACS-MSN2700. Signed-off-by: Shu0T1an ChenG --- dockers/docker-orchagent/Dockerfile.j2 | 1 + .../msn27xx.32ports.buffers.json.j2 | 294 +++ src/sonic-config-engine/minigraph.py | 1 + .../tests/sample-port-config-mlnx.ini | 33 + .../tests/sample_output/msn27.32ports.json | 349 +++ .../tests/t1-sample-graph-mlnx.xml | 2240 +++++++++++++++++ src/sonic-config-engine/tests/test_j2files.py | 11 + 7 files changed, 2929 insertions(+) create mode 100644 dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 create mode 100644 src/sonic-config-engine/tests/sample-port-config-mlnx.ini create mode 100644 src/sonic-config-engine/tests/sample_output/msn27.32ports.json create mode 100644 src/sonic-config-engine/tests/t1-sample-graph-mlnx.xml diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 587d8f4db2ee..b2d20383e38e 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -31,5 +31,6 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"] COPY ["mirror.json.j2", "/usr/share/sonic/templates/"] COPY ["ports.json.j2", "/usr/share/sonic/templates/"] +COPY ["msn27xx.32ports.buffers.json.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 new file mode 100644 index 000000000000..075385079a0d --- /dev/null +++ b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 @@ -0,0 +1,294 @@ +[ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') %} + { + "BUFFER_POOL_TABLE:ingress_lossless_pool": { + "size": "3024486", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:ingress_lossy_pool": { + "size": "6422528", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:egress_lossless_pool": { + "size": "7291456", + "type": "egress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:egress_lossy_pool": { + "size": "8254464", + "type": "egress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "size":"0", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "size":"1518", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "size":"4096", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:pg_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:q_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:q_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "size":"0", + "dynamic_th":"1" + }, + "OP": "SET" + }, + { + "BUFFER_PORT_INGRESS_PROFILE_LIST:{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PORT_EGRESS_PROFILE_LIST:{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]" + }, + "OP": "SET" + }, + +{# The following template part is for variable PG profile configuration #} +{% set pg_range = '3-4' %} +{# Lists of supported speed and cable length #} +{% set supported_speed = [10000, 25000, 40000, 50000, 100000] %} +{% set supported_cable = [5, 40, 300] %} + +{# The key in this lictionary consist of two parts: (port speed)_(cable length) #} +{%- set portconfig2profile = { + '10000_5' : 'pg_lossless_10G_5m_profile', + '25000_5' : 'pg_lossless_25G_5m_profile', + '40000_5' : 'pg_lossless_40G_5m_profile', + '50000_5' : 'pg_lossless_50G_5m_profile', + '100000_5' : 'pg_lossless_100G_5m_profile', + + '10000_40' : 'pg_lossless_10G_40m_profile', + '25000_40' : 'pg_lossless_25G_40m_profile', + '40000_40' : 'pg_lossless_40G_40m_profile', + '50000_40' : 'pg_lossless_50G_40m_profile', + '100000_40' : 'pg_lossless_100G_40m_profile', + + '10000_300' : 'pg_lossless_10G_300m_profile', + '25000_300' : 'pg_lossless_25G_300m_profile', + '40000_300' : 'pg_lossless_40G_300m_profile', + '50000_300' : 'pg_lossless_50G_300m_profile', + '100000_300': 'pg_lossless_100G_300m_profile' + } +-%} + +{# PG profiles. All profiles reffered in portconfig2profile dictionary should be declared here #} +{# Only those which were actually used will be created in SAI #} +{%- set pg_profiles = { + 'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, + 'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, + 'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, + 'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, + 'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 1 }, + + 'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 1 }, + 'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 1 }, + 'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 1 }, + 'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 1 }, + 'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 1 }, + + 'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 1 }, + 'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 1 }, + 'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 1 }, + 'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 1 }, + 'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 1 }, + } +-%} + +{# 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' : '5', + 'LeafRouter_ToRRouter' : '40', + 'SpineRouter_LeafRouter' : '300' + } +%} + +{% set switch_role = DEVICE_METADATA['localhost']['type'] %} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {% endif %} + {% endif %} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ supported_cable | last }} + {%- endif -%} +{% endmacro %} + +{%- macro find_closest_greater_config(speed, cable) -%} +{%- set new_speed = [] -%} +{%- for std_speed in supported_speed -%} + {%- if std_speed | int >= speed | int -%} + {%- if new_speed.append(std_speed) -%}{%- endif -%} + {% endif -%} +{%- endfor -%} +{%- set new_cable = [] -%} +{%- for std_cable in supported_cable -%} + {% if std_cable | int >= cable | int -%} + {%- if new_cable.append(std_cable) -%}{%- endif -%} + {% endif %} +{%- endfor -%} +{{ new_speed.0 }}_{{ new_cable.0 }} +{%- endmacro -%} + +{% set ingress_lossless_pg_pool_size = [] %} +{% set used_pg_profiles = [] %} +{% for port in PORT %} + {%- if PORT[port].speed -%} + {%- set speed = PORT[port]['speed'] -%} + {% else %} + {%- set speed = supported_speed|last -%} + {%- endif -%} + {%- set cable = cable_length(port) -%} + {%- set port_config = speed|string + '_' + cable -%} + {%- if not port_config in portconfig2profile -%} + {% set port_config = find_closest_greater_config(speed, cable) -%} + {%- endif -%} + {% set profile = portconfig2profile[port_config] -%} + {% if ingress_lossless_pg_pool_size.append(pg_profiles[profile]['size']) %}{% endif %} + {# add to list profiles which were actually used #} + {%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif -%} + { + "BUFFER_PG_TABLE:{{ port }}:{{ pg_range }}": { + "profile" : "[BUFFER_PROFILE_TABLE:{{ profile }}]" + }, + "OP": "SET" + }, +{% endfor -%} + +{# PG profiles declaration #} + +{% for profile_name in used_pg_profiles %} + {%- set profile_config = pg_profiles[profile_name] %} + { + "BUFFER_PROFILE_TABLE:{{ profile_name }}": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pg_pool]", + "xon":"{{ profile_config['xon'] }}", + "xoff":"{{ profile_config['xoff'] }}", + "size":"{{ profile_config['size'] }}", + "dynamic_th":"{{ profile_config['dynamic_th'] }}" + }, + "OP": "SET" + }, +{% endfor -%} + + {# Pool declaration #} + { + "BUFFER_POOL_TABLE:ingress_lossless_pg_pool": { + "size": "{{ ingress_lossless_pg_pool_size | sum }}", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:{{ port_names }}:0-1": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { + "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]" + }, + "OP": "SET" + }, + { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + }, + "OP": "SET" + }, + { + "PORT_QOS_MAP_TABLE:{{ port_names }}": { + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]" + }, + "OP": "SET" + } +] diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index c38abb051257..69299ce3c50a 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -443,6 +443,7 @@ def parse_xml(filename, platform=None, port_config_file=None): results['VLAN'] = vlans results['DEVICE_NEIGHBOR'] = neighbors + results['DEVICE_NEIGHBOR_METADATA'] = { key:devices[key] for key in devices if key != hostname } results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers) results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers) results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers) diff --git a/src/sonic-config-engine/tests/sample-port-config-mlnx.ini b/src/sonic-config-engine/tests/sample-port-config-mlnx.ini new file mode 100644 index 000000000000..816bb0e94a70 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-port-config-mlnx.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 0,1,2,3 +Ethernet4 4,5,6,7 +Ethernet8 8,9,10,11 +Ethernet12 12,13,14,15 +Ethernet16 16,17,18,19 +Ethernet20 20,21,22,23 +Ethernet24 24,25,26,27 +Ethernet28 28,29,30,31 +Ethernet32 32,33,34,35 +Ethernet36 36,37,38,39 +Ethernet40 40,41,42,43 +Ethernet44 44,45,46,47 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 64,65,66,67 +Ethernet68 68,69,70,71 +Ethernet72 72,73,74,75 +Ethernet76 76,77,78,79 +Ethernet80 80,81,82,83 +Ethernet84 84,85,86,87 +Ethernet88 88,89,90,91 +Ethernet92 92,93,94,95 +Ethernet96 96,97,98,99 +Ethernet100 100,101,102,103 +Ethernet104 104,105,106,107 +Ethernet108 108,109,110,111 +Ethernet112 112,113,114,115 +Ethernet116 116,117,118,119 +Ethernet120 120,121,122,123 +Ethernet124 124,125,126,127 diff --git a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json new file mode 100644 index 000000000000..876706b5de13 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json @@ -0,0 +1,349 @@ +[ + { + "BUFFER_POOL_TABLE:ingress_lossless_pool": { + "size": "3024486", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:ingress_lossy_pool": { + "size": "6422528", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:egress_lossless_pool": { + "size": "7291456", + "type": "egress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:egress_lossy_pool": { + "size": "8254464", + "type": "egress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "size":"0", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "size":"1518", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "size":"4096", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:pg_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:q_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:q_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "size":"0", + "dynamic_th":"1" + }, + "OP": "SET" + }, + { + "BUFFER_PORT_INGRESS_PROFILE_LIST:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PORT_EGRESS_PROFILE_LIST:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]" + }, + "OP": "SET" + }, + + + + { + "BUFFER_PG_TABLE:Ethernet8:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet0:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet4:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet108:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet100:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet104:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet68:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet96:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet124:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet92:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet120:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet52:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet56:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet76:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet72:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet64:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet32:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet16:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet36:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet12:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet88:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet116:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet80:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet112:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet84:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet48:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet44:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet40:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet28:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet60:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet20:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet24:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + + { + "BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pg_pool]", + "xon":"18432", + "xoff":"75776", + "size":"94208", + "dynamic_th":"1" + }, + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:ingress_lossless_pg_pool": { + "size": "3014656", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:0-1": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_QUEUE_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_QUEUE_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:0-1": { + "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]" + }, + "OP": "SET" + }, + { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + }, + "OP": "SET" + }, + { + "PORT_QOS_MAP_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]" + }, + "OP": "SET" + } +] diff --git a/src/sonic-config-engine/tests/t1-sample-graph-mlnx.xml b/src/sonic-config-engine/tests/t1-sample-graph-mlnx.xml new file mode 100644 index 000000000000..04fc88c34370 --- /dev/null +++ b/src/sonic-config-engine/tests/t1-sample-graph-mlnx.xml @@ -0,0 +1,2240 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + arc-switch1026 + 10.0.0.32 + 1 + 10 + 3 + + + ARISTA01T0 + FC00::42 + arc-switch1026 + FC00::41 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 10 + 3 + + + arc-switch1026 + FC00::1 + ARISTA01T2 + FC00::2 + 1 + 10 + 3 + + + ARISTA02T0 + 10.0.0.35 + arc-switch1026 + 10.0.0.34 + 1 + 10 + 3 + + + ARISTA02T0 + FC00::46 + arc-switch1026 + FC00::45 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 10 + 3 + + + arc-switch1026 + FC00::5 + ARISTA02T2 + FC00::6 + 1 + 10 + 3 + + + ARISTA03T0 + 10.0.0.37 + arc-switch1026 + 10.0.0.36 + 1 + 10 + 3 + + + ARISTA03T0 + FC00::4A + arc-switch1026 + FC00::49 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 10 + 3 + + + arc-switch1026 + FC00::9 + ARISTA03T2 + FC00::A + 1 + 10 + 3 + + + ARISTA04T0 + 10.0.0.39 + arc-switch1026 + 10.0.0.38 + 1 + 10 + 3 + + + ARISTA04T0 + FC00::4E + arc-switch1026 + FC00::4D + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 10 + 3 + + + arc-switch1026 + FC00::D + ARISTA04T2 + FC00::E + 1 + 10 + 3 + + + ARISTA05T0 + 10.0.0.41 + arc-switch1026 + 10.0.0.40 + 1 + 10 + 3 + + + ARISTA05T0 + FC00::52 + arc-switch1026 + FC00::51 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 10 + 3 + + + arc-switch1026 + FC00::11 + ARISTA05T2 + FC00::12 + 1 + 10 + 3 + + + ARISTA06T0 + 10.0.0.43 + arc-switch1026 + 10.0.0.42 + 1 + 10 + 3 + + + ARISTA06T0 + FC00::56 + arc-switch1026 + FC00::55 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 10 + 3 + + + arc-switch1026 + FC00::15 + ARISTA06T2 + FC00::16 + 1 + 10 + 3 + + + ARISTA07T0 + 10.0.0.45 + arc-switch1026 + 10.0.0.44 + 1 + 10 + 3 + + + ARISTA07T0 + FC00::5A + arc-switch1026 + FC00::59 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 10 + 3 + + + arc-switch1026 + FC00::19 + ARISTA07T2 + FC00::1A + 1 + 10 + 3 + + + ARISTA08T0 + 10.0.0.47 + arc-switch1026 + 10.0.0.46 + 1 + 10 + 3 + + + ARISTA08T0 + FC00::5E + arc-switch1026 + FC00::5D + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 10 + 3 + + + arc-switch1026 + FC00::1D + ARISTA08T2 + FC00::1E + 1 + 10 + 3 + + + ARISTA09T0 + 10.0.0.49 + arc-switch1026 + 10.0.0.48 + 1 + 10 + 3 + + + ARISTA09T0 + FC00::62 + arc-switch1026 + FC00::61 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 10 + 3 + + + arc-switch1026 + FC00::21 + ARISTA09T2 + FC00::22 + 1 + 10 + 3 + + + ARISTA10T0 + 10.0.0.51 + arc-switch1026 + 10.0.0.50 + 1 + 10 + 3 + + + ARISTA10T0 + FC00::66 + arc-switch1026 + FC00::65 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 10 + 3 + + + arc-switch1026 + FC00::25 + ARISTA10T2 + FC00::26 + 1 + 10 + 3 + + + ARISTA11T0 + 10.0.0.53 + arc-switch1026 + 10.0.0.52 + 1 + 10 + 3 + + + ARISTA11T0 + FC00::6A + arc-switch1026 + FC00::69 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 10 + 3 + + + arc-switch1026 + FC00::29 + ARISTA11T2 + FC00::2A + 1 + 10 + 3 + + + ARISTA12T0 + 10.0.0.55 + arc-switch1026 + 10.0.0.54 + 1 + 10 + 3 + + + ARISTA12T0 + FC00::6E + arc-switch1026 + FC00::6D + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 10 + 3 + + + arc-switch1026 + FC00::2D + ARISTA12T2 + FC00::2E + 1 + 10 + 3 + + + ARISTA13T0 + 10.0.0.57 + arc-switch1026 + 10.0.0.56 + 1 + 10 + 3 + + + ARISTA13T0 + FC00::72 + arc-switch1026 + FC00::71 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 10 + 3 + + + arc-switch1026 + FC00::31 + ARISTA13T2 + FC00::32 + 1 + 10 + 3 + + + ARISTA14T0 + 10.0.0.59 + arc-switch1026 + 10.0.0.58 + 1 + 10 + 3 + + + ARISTA14T0 + FC00::76 + arc-switch1026 + FC00::75 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 10 + 3 + + + arc-switch1026 + FC00::35 + ARISTA14T2 + FC00::36 + 1 + 10 + 3 + + + ARISTA15T0 + 10.0.0.61 + arc-switch1026 + 10.0.0.60 + 1 + 10 + 3 + + + ARISTA15T0 + FC00::7A + arc-switch1026 + FC00::79 + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 10 + 3 + + + arc-switch1026 + FC00::39 + ARISTA15T2 + FC00::3A + 1 + 10 + 3 + + + ARISTA16T0 + 10.0.0.63 + arc-switch1026 + 10.0.0.62 + 1 + 10 + 3 + + + ARISTA16T0 + FC00::7E + arc-switch1026 + FC00::7D + 1 + 10 + 3 + + + arc-switch1026 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 10 + 3 + + + arc-switch1026 + FC00::3D + ARISTA16T2 + FC00::3E + 1 + 10 + 3 + + + + + 65100 + arc-switch1026 + + +
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 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.224.23.80/24 + + 10.224.23.80/24 + + + V6HostIP + eth0 + + FC00:2::32/64 + + FC00:2::32/64 + + + + + + arc-switch1026 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet0 + FC00::1/126 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet4 + FC00::5/126 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet8 + FC00::9/126 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet12 + FC00::D/126 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet16 + FC00::11/126 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet20 + FC00::15/126 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet24 + FC00::19/126 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet28 + FC00::1D/126 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet32 + FC00::21/126 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet36 + FC00::25/126 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet40 + FC00::29/126 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet44 + FC00::2D/126 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet48 + FC00::31/126 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet52 + FC00::35/126 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet56 + FC00::39/126 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet60 + FC00::3D/126 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet64 + FC00::41/126 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet68 + FC00::45/126 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet72 + FC00::49/126 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet76 + FC00::4D/126 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet80 + FC00::51/126 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet84 + FC00::55/126 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet88 + FC00::59/126 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet92 + FC00::5D/126 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet96 + FC00::61/126 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet100 + FC00::65/126 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet104 + FC00::69/126 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet108 + FC00::6D/126 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet112 + FC00::71/126 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet116 + FC00::75/126 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet120 + FC00::79/126 + + + + Ethernet124 + 10.0.0.62/31 + + + + Ethernet124 + FC00::7D/126 + + + + + + + + + + + + DeviceInterfaceLink + arc-switch1026 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + arc-switch1026 + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + arc-switch1026 + ACS-MSN2700 + + 10.224.23.80 + + + + "ARISTA01T0" + Arista-VM + + 10.224.23.196 + + + + "ARISTA01T2" + Arista-VM + + 10.224.23.180 + + + + "ARISTA02T0" + Arista-VM + + 10.224.23.197 + + + + "ARISTA02T2" + Arista-VM + + 10.224.23.181 + + + + "ARISTA03T0" + Arista-VM + + 10.224.23.198 + + + + "ARISTA03T2" + Arista-VM + + 10.224.23.182 + + + + "ARISTA04T0" + Arista-VM + + 10.224.23.199 + + + + "ARISTA04T2" + Arista-VM + + 10.224.23.183 + + + + "ARISTA05T0" + Arista-VM + + 10.224.23.200 + + + + "ARISTA05T2" + Arista-VM + + 10.224.23.184 + + + + "ARISTA06T0" + Arista-VM + + 10.224.23.201 + + + + "ARISTA06T2" + Arista-VM + + 10.224.23.185 + + + + "ARISTA07T0" + Arista-VM + + 10.224.23.202 + + + + "ARISTA07T2" + Arista-VM + + 10.224.23.186 + + + + "ARISTA08T0" + Arista-VM + + 10.224.23.203 + + + + "ARISTA08T2" + Arista-VM + + 10.224.23.187 + + + + "ARISTA09T0" + Arista-VM + + 10.224.23.152 + + + + "ARISTA09T2" + Arista-VM + + 10.224.23.188 + + + + "ARISTA10T0" + Arista-VM + + 10.224.23.153 + + + + "ARISTA10T2" + Arista-VM + + 10.224.23.189 + + + + "ARISTA11T0" + Arista-VM + + 10.224.23.154 + + + + "ARISTA11T2" + Arista-VM + + 10.224.23.190 + + + + "ARISTA12T0" + Arista-VM + + 10.224.23.155 + + + + "ARISTA12T2" + Arista-VM + + 10.224.23.191 + + + + "ARISTA13T0" + Arista-VM + + 10.224.23.156 + + + + "ARISTA13T2" + Arista-VM + + 10.224.23.192 + + + + "ARISTA14T0" + Arista-VM + + 10.224.23.157 + + + + "ARISTA14T2" + Arista-VM + + 10.224.23.193 + + + + "ARISTA15T0" + Arista-VM + + 10.224.23.158 + + + + "ARISTA15T2" + Arista-VM + + 10.224.23.194 + + + + "ARISTA16T0" + Arista-VM + + 10.224.23.159 + + + + "ARISTA16T2" + Arista-VM + + 10.224.23.195 + + + + + + + true + + + DeviceInterface + + true + true + 1 + Ethernet0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet4 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + true + 1 + Ethernet124 + + false + 0 + 0 + 40000 + + + true + 0 + ACS-MSN2700 + + + + + + + arc-switch1026 + + + DhcpResources + + 10.0.0.1 + + + NTPResources + + 10.0.0.1;10.0.0.2 + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + RadiusResources + + + + + SnmpResources + + 10.0.0.9 + + + SyslogResources + + 10.0.0.5;10.0.0.6 + + + TacacsGroup + + testlab + + + TacacsServer + + 10.0.0.9;10.0.0.8 + + + ForcedMgmtRoutes + + 10.0.0.100/31;10.250.0.8;10.255.0.0/28 + + + ErspanDestinationIpv4 + + 10.0.0.7 + + + + + + + arc-switch1026 + ACS-MSN2700 +
diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 7e948f8b6a2a..3d4139d0eb20 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -12,6 +12,8 @@ def setUp(self): self.t0_minigraph = os.path.join(self.test_dir, 't0-sample-graph.xml') self.pc_minigraph = os.path.join(self.test_dir, 'pc-test-graph.xml') self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') + self.t1_mlnx_minigraph = os.path.join(self.test_dir, 't1-sample-graph-mlnx.xml') + self.mlnx_port_config = os.path.join(self.test_dir, 'sample-port-config-mlnx.ini') self.output_file = os.path.join(self.test_dir, 'output') def run_script(self, argument): @@ -84,6 +86,15 @@ def test_everflow(self): assert filecmp.cmp(sample_output_file, self.output_file) + def test_msn27xx_32ports_buffers(self): + buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'msn27xx.32ports.buffers.json.j2') + argument = '-m ' + self.t1_mlnx_minigraph + ' -p ' + self.mlnx_port_config + ' -t ' + buffer_file + ' > ' + self.output_file + self.run_script(argument) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', 'msn27.32ports.json') + + self.assertTrue(filecmp.cmp(sample_output_file, self.output_file)) + def tearDown(self): try: From 1ee8ed92168b4ce0e95805df89ae169002befd87 Mon Sep 17 00:00:00 2001 From: Balaselvi Date: Thu, 19 Oct 2017 13:06:03 -0700 Subject: [PATCH 0851/1833] [Inventec]: Add Inventec D7054 platform support and update D7032 platform support (#1052) --- .../plugins/eeprom.py | 2 +- .../plugins/sfputil.py | 141 ++- .../INVENTEC-D7054Q28B-S48-Q6/port_config.ini | 56 + .../INVENTEC-D7054Q28B-S48-Q6/sai.profile | 2 + .../installer.conf | 4 + .../minigraph.xml | 146 +++ .../plugins/eeprom.py | 22 + .../plugins/sfputil.py | 209 ++++ platform/broadcom/one-image.mk | 1 + .../broadcom/platform-modules-inventec.mk | 11 +- .../d7032q28b/conf/d7032q28b-modules.conf | 10 - .../d7032q28b/modules/Makefile | 4 + .../d7032q28b/modules/inv_eeprom.c | 181 +++ .../d7032q28b/modules/inv_platform.c | 395 +++---- .../d7032q28b/modules/inv_swps.c | 618 ++++++++++ .../d7032q28b/modules/inv_swps.h | 131 +++ .../d7032q28b/modules/io_expander.c | 887 ++++++++++++++ .../d7032q28b/modules/io_expander.h | 136 +++ .../d7032q28b/modules/transceiver.c | 898 ++++++++++++++ .../d7032q28b/modules/transceiver.h | 167 +++ .../d7032q28b/utils/inventec_d7032_util.py | 217 ++++ .../d7032q28b/utils/onie-syseeprom | Bin 921685 -> 0 bytes .../d7054q28b/modules/Makefile | 6 + .../d7054q28b/modules/inv_cpld.c | 415 +++++++ .../d7054q28b/modules/inv_eeprom.c | 181 +++ .../d7054q28b/modules/inv_platform.c | 219 ++++ .../d7054q28b/modules/inv_psoc.c | 1046 +++++++++++++++++ .../d7054q28b/modules/inv_swps.c | 730 ++++++++++++ .../d7054q28b/modules/inv_swps.h | 170 +++ .../d7054q28b/modules/io_expander.c | 944 +++++++++++++++ .../d7054q28b/modules/io_expander.h | 143 +++ .../d7054q28b/modules/transceiver.c | 906 ++++++++++++++ .../d7054q28b/modules/transceiver.h | 168 +++ .../d7054q28b/utils/inventec_d7054_util.py | 234 ++++ .../debian/changelog | 5 + .../debian/control | 5 + .../debian/platform-modules-d7032q28b.init | 37 +- .../debian/platform-modules-d7032q28b.install | 2 +- .../debian/platform-modules-d7032q28b.upstart | 5 + .../debian/platform-modules-d7054q28b.init | 40 + .../debian/platform-modules-d7054q28b.install | 1 + .../debian/platform-modules-d7054q28b.upstart | 5 + .../debian/rules | 5 +- 43 files changed, 9242 insertions(+), 263 deletions(-) create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/installer.conf create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/plugins/eeprom.py create mode 100755 device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py delete mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/conf/d7032q28b-modules.conf create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_eeprom.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_swps.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_swps.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/io_expander.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/io_expander.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/transceiver.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/transceiver.h create mode 100755 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/inventec_d7032_util.py delete mode 100755 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/onie-syseeprom create mode 100755 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_eeprom.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_platform.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_psoc.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_swps.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_swps.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/io_expander.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/io_expander.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/transceiver.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/transceiver.h create mode 100755 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/utils/inventec_d7054_util.py create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.upstart create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.upstart diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/eeprom.py b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/eeprom.py index ad70e584bb2a..de5c24ba0e6d 100644 --- a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/eeprom.py +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/eeprom.py @@ -18,5 +18,5 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/tmp/eeprom" + self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0053/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py index 020faab9db58..645c76b9f0db 100644 --- a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py @@ -1,19 +1,23 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + 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""" +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" - port_start = 0 - port_end = 31 - ports_in_block = 32 + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} port_to_i2c_mapping = { 0: 22, 1: 23, @@ -49,12 +53,117 @@ class sfputil(sfputilbase): 31: 21 } - _qsfp_ports = range(0, ports_in_block + 1) + @property + def port_start(self): + return self.PORT_START - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' - for x in range(self.port_start, self.port_end + 1): + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/present") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = 1 + else: + reg_value = 0 + + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/class/swps/port"+str(port_num)+"/reset" + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 0 + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 2 second to allow it to settle + time.sleep(2) + + # Flip the value back write back to the register to take port out of reset + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 1 + reg_file.write(hex(reg_value)) + reg_file.close() + + return True diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini new file mode 100644 index 000000000000..a8eaeb1f0665 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini @@ -0,0 +1,56 @@ +# 48x25G + 6x100G +# name lanes alias +Ethernet0 2 Ethernet0 +Ethernet4 1 Ethernet4 +Ethernet8 4 Ethernet8 +Ethernet12 3 Ethernet12 +Ethernet16 6 Ethernet16 +Ethernet20 5 Ethernet20 +Ethernet24 8 Ethernet24 +Ethernet28 7 Ethernet28 +Ethernet32 10 Ethernet32 +Ethernet36 9 Ethernet36 +Ethernet40 12 Ethernet40 +Ethernet44 11 Ethernet44 +Ethernet48 22 Ethernet48 +Ethernet52 21 Ethernet52 +Ethernet56 24 Ethernet56 +Ethernet60 23 Ethernet60 +Ethernet64 34 Ethernet64 +Ethernet68 33 Ethernet68 +Ethernet72 36 Ethernet72 +Ethernet76 35 Ethernet76 +Ethernet80 38 Ethernet80 +Ethernet84 37 Ethernet84 +Ethernet88 40 Ethernet88 +Ethernet92 39 Ethernet92 +Ethernet96 42 Ethernet96 +Ethernet100 41 Ethernet100 +Ethernet104 44 Ethernet104 +Ethernet108 43 Ethernet108 +Ethernet112 50 Ethernet112 +Ethernet116 49 Ethernet116 +Ethernet120 52 Ethernet120 +Ethernet124 51 Ethernet124 +Ethernet128 54 Ethernet128 +Ethernet132 53 Ethernet132 +Ethernet136 56 Ethernet136 +Ethernet140 55 Ethernet140 +Ethernet144 66 Ethernet144 +Ethernet148 65 Ethernet148 +Ethernet152 68 Ethernet152 +Ethernet156 67 Ethernet156 +Ethernet160 70 Ethernet160 +Ethernet164 69 Ethernet164 +Ethernet168 72 Ethernet168 +Ethernet172 71 Ethernet172 +Ethernet176 82 Ethernet176 +Ethernet180 81 Ethernet180 +Ethernet184 84 Ethernet184 +Ethernet188 83 Ethernet188 +Ethernet192 85,86,87,88 Ethernet192 +Ethernet196 97,98,99,100 Ethernet196 +Ethernet200 105,106,107,108 Ethernet200 +Ethernet204 101,102,103,104 Ethernet204 +Ethernet208 117,118,119,120 Ethernet208 +Ethernet212 109,110,111,112 Ethernet212 diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile new file mode 100644 index 000000000000..6f60cbd6118c --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-d7054q28b-48x10g-6x100g.config.bcm +SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/installer.conf b/device/inventec/x86_64-inventec_d7054q28b-r0/installer.conf new file mode 100644 index 000000000000..1db64ba02c38 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 +VAR_LOG_SIZE=1024 diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml b/device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml new file mode 100644 index 000000000000..0e579ccbde14 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml @@ -0,0 +1,146 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + SONiC-Inventec-d7054 + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + SONiC-Inventec-d7054 + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + SONiC-Inventec-d7054 + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + SONiC-Inventec-d7054 + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + SONiC-Inventec-d7054 + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + SONiC-Inventec-d7054 + Ethernet4 + + + + + SONiC-Inventec-d7054 + INVENTEC-D7054Q28B-S48-Q6 + + + + + + + SONiC-Inventec-d7054 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + SONiC-Inventec-d7054 + INVENTEC-D7054Q28B-S48-Q6 +
diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/eeprom.py b/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/eeprom.py new file mode 100644 index 000000000000..de5c24ba0e6d --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Inventec d7032q28b +# +# 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-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py new file mode 100755 index 000000000000..d236146e495e --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py @@ -0,0 +1,209 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 53 + PORTS_IN_BLOCK = 54 + QSFP_PORT_START = 48 + QSFP_PORT_END = 53 + + _port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: 11, + 1: 10, + 2: 13, + 3: 12, + 4: 15, + 5: 14, + 6: 17, + 7: 16, + 8: 19, + 9: 18, + 10: 21, + 11: 20, + 12: 23, + 13: 22, + 14: 25, + 15: 24, + 16: 27, + 17: 26, + 18: 29, + 19: 28, + 20: 31, + 21: 30, + 22: 33, + 23: 32, + 24: 35, + 25: 34, + 26: 37, + 27: 36, + 28: 39, + 29: 38, + 30: 41, + 31: 40, + 32: 43, + 33: 42, + 34: 45, + 35: 44, + 36: 47, + 37: 46, + 38: 49, + 39: 48, + 40: 51, + 41: 50, + 42: 53, + 43: 52, + 44: 55, + 45: 54, + 46: 57, + 47: 56, + 48: 59, + 49: 58, + 50: 61, + 51: 60, + 52: 63, + 53: 62 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/bus/i2c/devices/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/present") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + print "\nError:SFP's don't support this property" + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = 1 + else: + reg_value = 0 + + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/class/swps/port"+str(port_num)+"/reset" + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + print "\nError:SFP's don't support this property" + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 0 + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 2 second to allow it to settle + time.sleep(2) + + # Flip the value back write back to the register to take port out of reset + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 1 + reg_file.write(hex(reg_value)) + reg_file.close() + + return True diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 2340177fd18b..60305c292b6b 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -13,6 +13,7 @@ $(SONIC_ONE_IMAGE)_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(INGRASYS_S8810_32Q_PLATFORM_MODULE) \ $(ACCTON_AS7712_32X_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ + $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-inventec.mk b/platform/broadcom/platform-modules-inventec.mk index 0d00fe1f7368..f4a2e65e5147 100755 --- a/platform/broadcom/platform-modules-inventec.mk +++ b/platform/broadcom/platform-modules-inventec.mk @@ -1,12 +1,17 @@ -# Inventec d7032q28b Platform modules +# Inventec d7032q28b and d7054q28b Platform modules -INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION = 1.0.0 +INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION = 1.1.0 +INVENTEC_D7054Q28B_PLATFORM_MODULE_VERSION = 1.1.0 export INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION +export INVENTEC_D7054Q28B_PLATFORM_MODULE_VERSION INVENTEC_D7032Q28B_PLATFORM_MODULE = platform-modules-d7032q28b_$(INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION)_amd64.deb $(INVENTEC_D7032Q28B_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-inventec $(INVENTEC_D7032Q28B_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(INVENTEC_D7032Q28B_PLATFORM_MODULE)_PLATFORM = x86_64-inventec_d7032q28b-r0 SONIC_DPKG_DEBS += $(INVENTEC_D7032Q28B_PLATFORM_MODULE) -$(eval $(call add_extra_package,$(INVENTEC_D7032Q28B_PLATFORM_MODULE))) + +INVENTEC_D7054Q28B_PLATFORM_MODULE = platform-modules-d7054q28b_$(INVENTEC_D7054Q28B_PLATFORM_MODULE_VERSION)_amd64.deb +$(INVENTEC_D7054Q28B_PLATFORM_MODULE)_PLATFORM = x86_64-inventec_d7054q28b-r0 +$(eval $(call add_extra_package,$(INVENTEC_D7032Q28B_PLATFORM_MODULE),$(INVENTEC_D7054Q28B_PLATFORM_MODULE))) diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/conf/d7032q28b-modules.conf b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/conf/d7032q28b-modules.conf deleted file mode 100644 index 29d4d50a4f9a..000000000000 --- a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/conf/d7032q28b-modules.conf +++ /dev/null @@ -1,10 +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. - -lpc_ich -i2c-i801 -i2c-mux -i2c-mux-pca954x -i2c-dev diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile index cdabd612a66d..c43c47745229 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile @@ -1,3 +1,7 @@ obj-m += inv_cpld.o inv_psoc.o obj-m += inv_platform.o +obj-m += inv_eeprom.o +obj-m += swps.o +swps-objs := inv_swps.o io_expander.o transceiver.o + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_eeprom.c b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_eeprom.c new file mode 100644 index 000000000000..b2dde612b610 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_eeprom.c @@ -0,0 +1,181 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void inv_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, ((u8)addr >> 8) & 0xFF, (u8)addr & 0xFF); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } + +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t inv_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + inv_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static struct bin_attribute inv_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = inv_eeprom_read, +}; + +static int inv_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &inv_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int inv_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &inv_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id inv_eeprom_id[] = { + { "inv_eeprom", 0 }, + { } +}; + +static struct i2c_driver inv_eeprom_driver = { + .driver = { + .name = "inv_eeprom", + }, + .probe = inv_eeprom_probe, + .remove = inv_eeprom_remove, + .id_table = inv_eeprom_id, +}; + +module_i2c_driver(inv_eeprom_driver); + +MODULE_AUTHOR("Inventec"); +MODULE_DESCRIPTION("Inventec D7032 Mother Board EEPROM driver"); +MODULE_LICENSE("GPL"); + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_platform.c b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_platform.c index 71dda75b252f..52f6a5691d3e 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_platform.c +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_platform.c @@ -1,197 +1,198 @@ -#include -//#include -#include -#include -#include -#include -#include - -#include -#include -#include - -//#include -#define IO_EXPAND_BASE 64 -#define IO_EXPAND_NGPIO 16 - -struct inv_i2c_board_info { - int ch; - int size; - struct i2c_board_info *board_info; -}; - -#define bus_id(id) (id) -static struct pca954x_platform_mode mux_modes_0[] = { - {.adap_id = bus_id(2),}, {.adap_id = bus_id(3),}, - {.adap_id = bus_id(4),}, {.adap_id = bus_id(5),}, -}; -static struct pca954x_platform_mode mux_modes_0_0[] = { - {.adap_id = bus_id(6),}, {.adap_id = bus_id(7),}, - {.adap_id = bus_id(8),}, {.adap_id = bus_id(9),}, - {.adap_id = bus_id(10),}, {.adap_id = bus_id(11),}, - {.adap_id = bus_id(12),}, {.adap_id = bus_id(13),}, -}; - -static struct pca954x_platform_mode mux_modes_0_1[] = { - {.adap_id = bus_id(14),}, {.adap_id = bus_id(15),}, - {.adap_id = bus_id(16),}, {.adap_id = bus_id(17),}, - {.adap_id = bus_id(18),}, {.adap_id = bus_id(19),}, - {.adap_id = bus_id(20),}, {.adap_id = bus_id(21),}, -}; - -static struct pca954x_platform_mode mux_modes_0_2[] = { - {.adap_id = bus_id(22),}, {.adap_id = bus_id(23),}, - {.adap_id = bus_id(24),}, {.adap_id = bus_id(25),}, - {.adap_id = bus_id(26),}, {.adap_id = bus_id(27),}, - {.adap_id = bus_id(28),}, {.adap_id = bus_id(29),}, -}; - -static struct pca954x_platform_mode mux_modes_0_3[] = { - {.adap_id = bus_id(30),}, {.adap_id = bus_id(31),}, - {.adap_id = bus_id(32),}, {.adap_id = bus_id(33),}, - {.adap_id = bus_id(34),}, {.adap_id = bus_id(35),}, - {.adap_id = bus_id(36),}, {.adap_id = bus_id(37),}, -}; - -static struct pca954x_platform_data mux_data_0 = { - .modes = mux_modes_0, - .num_modes = 4, -}; -static struct pca954x_platform_data mux_data_0_0 = { - .modes = mux_modes_0_0, - .num_modes = 8, -}; -static struct pca954x_platform_data mux_data_0_1 = { - .modes = mux_modes_0_1, - .num_modes = 8, -}; -static struct pca954x_platform_data mux_data_0_2 = { - .modes = mux_modes_0_2, - .num_modes = 8, -}; -static struct pca954x_platform_data mux_data_0_3 = { - .modes = mux_modes_0_3, - .num_modes = 8, -}; - -static struct i2c_board_info i2c_device_info0[] __initdata = { - {"inv_psoc", 0, 0x66, 0, 0, 0},//psoc - {"inv_cpld", 0, 0x55, 0, 0, 0},//cpld - {"pca9545", 0, 0x70, &mux_data_0, 0, 0}, -}; - -static struct i2c_board_info i2c_device_info1[] __initdata = { - {"pca9545", 0, 0x70, &mux_data_0, 0, 0}, -}; - -static struct i2c_board_info i2c_device_info2[] __initdata = { - {"pca9548", 0, 0x72, &mux_data_0_0, 0, 0}, -}; - -static struct i2c_board_info i2c_device_info3[] __initdata = { - {"pca9548", 0, 0x72, &mux_data_0_1, 0, 0}, -}; - -static struct i2c_board_info i2c_device_info4[] __initdata = { - {"pca9548", 0, 0x72, &mux_data_0_2, 0, 0}, -}; - -static struct i2c_board_info i2c_device_info5[] __initdata = { - {"pca9548", 0, 0x72, &mux_data_0_3, 0, 0}, -}; - - -static struct inv_i2c_board_info i2cdev_list[] = { - {0, ARRAY_SIZE(i2c_device_info0), i2c_device_info0 }, //smbus 0 - {1, ARRAY_SIZE(i2c_device_info1), i2c_device_info1 }, //smbus 1 or gpio11+12 - - {bus_id(2), ARRAY_SIZE(i2c_device_info2), i2c_device_info2 }, //mux 0 - {bus_id(3), ARRAY_SIZE(i2c_device_info3), i2c_device_info3 }, //mux 1 - {bus_id(4), ARRAY_SIZE(i2c_device_info4), i2c_device_info4 }, //mux 2 - {bus_id(5), ARRAY_SIZE(i2c_device_info5), i2c_device_info5 }, //mux 3 -}; - -///////////////////////////////////////////////////////////////////////////////////////// -static struct i2c_gpio_platform_data i2c_gpio_platdata0 = { - .scl_pin = 8, - .sda_pin = 9, - - .udelay = 5, //5:100kHz - .sda_is_open_drain = 0, - .scl_is_open_drain = 0, - .scl_is_output_only = 0 -}; - -static struct i2c_gpio_platform_data i2c_gpio_platdata1 = { - .scl_pin = 12, - .sda_pin = 11, - - .udelay = 5, //5:100kHz - .sda_is_open_drain = 0, - .scl_is_open_drain = 0, - .scl_is_output_only = 0 -}; - -static struct platform_device device_i2c_gpio0 = { - .name = "i2c-gpio", - .id = 0, // adapter number - .dev.platform_data = &i2c_gpio_platdata0, -}; - -static struct platform_device device_i2c_gpio1 = { - .name = "i2c-gpio", - .id = 1, // adapter number - .dev.platform_data = &i2c_gpio_platdata1, -}; - -static int __init plat_redwood_x86_init(void) -{ - struct i2c_adapter *adap = NULL; - struct i2c_client *e = NULL; - int ret = 0; - int i,j; - - printk("el6661 plat_redwood_x86_init \n"); - -#if 0 //disable for ICOS - //use i2c-gpio - //register i2c gpio - //config gpio8,9 to gpio function - outl( inl(0x500) | (1<<8 | 1<<9), 0x500); - - ret = platform_device_register(&device_i2c_gpio0); - if (ret) { - printk(KERN_ERR "i2c-gpio: device_i2c_gpio0 register fail %d\n", ret); - } - - outl( inl(0x500) | (1<<11 | 1<<12), 0x500); - ret = platform_device_register(&device_i2c_gpio1); - if (ret) { - printk(KERN_ERR "i2c-gpio: device_i2c_gpio1 register fail %d\n", ret); - } -#endif - - for(i=0; i +//#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//#include +#define IO_EXPAND_BASE 64 +#define IO_EXPAND_NGPIO 16 + +struct inv_i2c_board_info { + int ch; + int size; + struct i2c_board_info *board_info; +}; + +#define bus_id(id) (id) +static struct pca954x_platform_mode mux_modes_0[] = { + {.adap_id = bus_id(2),}, {.adap_id = bus_id(3),}, + {.adap_id = bus_id(4),}, {.adap_id = bus_id(5),}, +}; +static struct pca954x_platform_mode mux_modes_0_0[] = { + {.adap_id = bus_id(6),}, {.adap_id = bus_id(7),}, + {.adap_id = bus_id(8),}, {.adap_id = bus_id(9),}, + {.adap_id = bus_id(10),}, {.adap_id = bus_id(11),}, + {.adap_id = bus_id(12),}, {.adap_id = bus_id(13),}, +}; + +static struct pca954x_platform_mode mux_modes_0_1[] = { + {.adap_id = bus_id(14),}, {.adap_id = bus_id(15),}, + {.adap_id = bus_id(16),}, {.adap_id = bus_id(17),}, + {.adap_id = bus_id(18),}, {.adap_id = bus_id(19),}, + {.adap_id = bus_id(20),}, {.adap_id = bus_id(21),}, +}; + +static struct pca954x_platform_mode mux_modes_0_2[] = { + {.adap_id = bus_id(22),}, {.adap_id = bus_id(23),}, + {.adap_id = bus_id(24),}, {.adap_id = bus_id(25),}, + {.adap_id = bus_id(26),}, {.adap_id = bus_id(27),}, + {.adap_id = bus_id(28),}, {.adap_id = bus_id(29),}, +}; + +static struct pca954x_platform_mode mux_modes_0_3[] = { + {.adap_id = bus_id(30),}, {.adap_id = bus_id(31),}, + {.adap_id = bus_id(32),}, {.adap_id = bus_id(33),}, + {.adap_id = bus_id(34),}, {.adap_id = bus_id(35),}, + {.adap_id = bus_id(36),}, {.adap_id = bus_id(37),}, +}; + +static struct pca954x_platform_data mux_data_0 = { + .modes = mux_modes_0, + .num_modes = 4, +}; +static struct pca954x_platform_data mux_data_0_0 = { + .modes = mux_modes_0_0, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_1 = { + .modes = mux_modes_0_1, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_2 = { + .modes = mux_modes_0_2, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_3 = { + .modes = mux_modes_0_3, + .num_modes = 8, +}; + +static struct i2c_board_info i2c_device_info0[] __initdata = { + {"inv_psoc", 0, 0x66, 0, 0, 0},//psoc + {"inv_cpld", 0, 0x55, 0, 0, 0},//cpld + {"pca9545", 0, 0x70, &mux_data_0, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info1[] __initdata = { + {"pca9545", 0, 0x70, &mux_data_0, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info2[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_0, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info3[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_1, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info4[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_2, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info5[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_3, 0, 0}, +}; + + +static struct inv_i2c_board_info i2cdev_list[] = { + {0, ARRAY_SIZE(i2c_device_info0), i2c_device_info0 }, //smbus 0 + {1, ARRAY_SIZE(i2c_device_info1), i2c_device_info1 }, //smbus 1 or gpio11+12 + + {bus_id(2), ARRAY_SIZE(i2c_device_info2), i2c_device_info2 }, //mux 0 + {bus_id(3), ARRAY_SIZE(i2c_device_info3), i2c_device_info3 }, //mux 1 + {bus_id(4), ARRAY_SIZE(i2c_device_info4), i2c_device_info4 }, //mux 2 + {bus_id(5), ARRAY_SIZE(i2c_device_info5), i2c_device_info5 }, //mux 3 +}; + +///////////////////////////////////////////////////////////////////////////////////////// +static struct i2c_gpio_platform_data i2c_gpio_platdata0 = { + .scl_pin = 8, + .sda_pin = 9, + + .udelay = 5, //5:100kHz + .sda_is_open_drain = 0, + .scl_is_open_drain = 0, + .scl_is_output_only = 0 +}; + +static struct i2c_gpio_platform_data i2c_gpio_platdata1 = { + .scl_pin = 12, + .sda_pin = 11, + + .udelay = 5, //5:100kHz + .sda_is_open_drain = 0, + .scl_is_open_drain = 0, + .scl_is_output_only = 0 +}; + +static struct platform_device device_i2c_gpio0 = { + .name = "i2c-gpio", + .id = 0, // adapter number + .dev.platform_data = &i2c_gpio_platdata0, +}; + +static struct platform_device device_i2c_gpio1 = { + .name = "i2c-gpio", + .id = 1, // adapter number + .dev.platform_data = &i2c_gpio_platdata1, +}; + +static int __init plat_redwood_x86_init(void) +{ + struct i2c_adapter *adap = NULL; + struct i2c_client *e = NULL; + int ret = 0; + int i,j; + + printk("el6661 plat_redwood_x86_init \n"); + +#if 0 //disable for ICOS + //use i2c-gpio + //register i2c gpio + //config gpio8,9 to gpio function + outl( inl(0x500) | (1<<8 | 1<<9), 0x500); + + ret = platform_device_register(&device_i2c_gpio0); + if (ret) { + printk(KERN_ERR "i2c-gpio: device_i2c_gpio0 register fail %d\n", ret); + } + + outl( inl(0x500) | (1<<11 | 1<<12), 0x500); + ret = platform_device_register(&device_i2c_gpio1); + if (ret) { + printk(KERN_ERR "i2c-gpio: device_i2c_gpio1 register fail %d\n", ret); + } +#endif + + for(i=0; i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "inv_swps.h" + +static int port_major; +static int ioexp_total; +static int port_total; +static struct class *swp_class_p = NULL; +static struct inv_platform_s *platform_p = NULL; +static struct inv_ioexp_layout_s *ioexp_layout = NULL; +static struct inv_port_layout_s *port_layout = NULL; + +static int +__swp_match(struct device *dev, +#ifdef SWPS_KERN_VER_AF_3_10 + + const void *data){ +#else + void *data){ +#endif + + char *name = (char *)data; + if (strcmp(dev_name(dev), name) == 0) + return 1; + return 0; +} + + +struct device * +get_swpdev_by_name(char *name){ + struct device *dev = class_find_device(swp_class_p, + NULL, + name, + (const void *)__swp_match); + return dev; +} + + +static int +sscanf_2_int(const char *buf) { + + int result = -EBFONT; + char *hex_tag = "0x"; + + if (strcspn(buf, hex_tag) == 0) { + if (sscanf(buf,"%x",&result)) { + return result; + } + } else { + if (sscanf(buf,"%d",&result)) { + return result; + } + if(sscanf(buf,"-%d",&result)) { + return -result; + } + if (sscanf(buf,"%x",&result)) { + return result; + } + } + return -EBFONT; +} + + +static int +sscanf_2_binary(const char *buf) { + + int result = sscanf_2_int(buf); + + if (result < 0){ + return -EBFONT; + } + switch (result) { + case 0: + case 1: + return result; + default: + break; + } + return -EBFONT; +} + +/* ========== Show functions: For I/O Expander attribute ========== + */ +static ssize_t +_show_ioexp_binary_attr(struct transvr_obj_s *tobj_p, + int (*get_func)(struct ioexp_obj_s *ioexp_p, int voffset), + char *buf_p) { + size_t len; + struct ioexp_obj_s *ioexp_p = tobj_p->ioexp_obj_p; + + if (!ioexp_p) { + SWPS_ERR(" %s: data corruption! :%s\n", __func__, tobj_p->swp_name); + return -ENODATA; + } + mutex_lock(&ioexp_p->lock); + len = snprintf(buf_p, 8, "%d\n", get_func(ioexp_p, tobj_p->ioexp_virt_offset)); + mutex_unlock(&ioexp_p->lock); + return len; +} + + +static ssize_t +show_attr_present(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_present, + buf_p); +} + +static ssize_t +show_attr_reset(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_reset, + buf_p); +} + +static ssize_t +show_attr_lpmod(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_lpmod, + buf_p); +} + + +static ssize_t +show_attr_modsel(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_modsel, + buf_p); +} + +/* ========== Store functions: For I/O Expander (R/W) attribute ========== + */ +static ssize_t +_store_ioexp_binary_attr(struct transvr_obj_s *tobj_p, + int (*set_func)(struct ioexp_obj_s *ioexp_p, + int virt_offset, int input_val), + const char *buf_p, + size_t count) { + + int input, err; + struct ioexp_obj_s *ioexp_p = tobj_p->ioexp_obj_p; + + if (!ioexp_p) { + SWPS_ERR("%s: data corruption! :%s\n", + __func__, tobj_p->swp_name); + return -ENODATA; + } + input = sscanf_2_binary(buf_p); + if (input < 0) { + return -EBFONT; + } + mutex_lock(&ioexp_p->lock); + err = set_func(ioexp_p, tobj_p->ioexp_virt_offset, input); + mutex_unlock(&ioexp_p->lock); + if (err < 0){ + return err; + } + return count; +} + +static ssize_t +store_attr_reset(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_reset, + buf_p, + count); +} + + +static ssize_t +store_attr_lpmod(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_lpmod, + buf_p, + count); +} + + +static ssize_t +store_attr_modsel(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_modsel, + buf_p, + count); +} + +/* ========== IO Expander attribute: from expander ========== + */ +static DEVICE_ATTR(present, S_IRUGO, show_attr_present, NULL); +static DEVICE_ATTR(reset, S_IRUGO|S_IWUSR, show_attr_reset, store_attr_reset); +static DEVICE_ATTR(lpmod, S_IRUGO|S_IWUSR, show_attr_lpmod, store_attr_lpmod); +static DEVICE_ATTR(modsel, S_IRUGO|S_IWUSR, show_attr_modsel, store_attr_modsel); + +/* ========== Functions for module handling ========== + */ +static void +clean_port_obj(void){ + + dev_t dev_num; + char dev_name[32]; + struct device *device_p; + struct transvr_obj_s *transvr_obj_p; + int minor_curr, port_id; + + for (minor_curr=0; minor_curri2c_client_p); + kfree(transvr_obj_p); + } + dev_num = MKDEV(port_major, minor_curr); + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); + } + SWPS_DEBUG("%s: done.\n", __func__); +} + + +static int +get_platform_type(void){ + + char log_msg[64] = "ERROR"; + + platform_p = kzalloc(sizeof(struct inv_platform_s), GFP_KERNEL); + if (!platform_p){ + snprintf(log_msg, sizeof(log_msg), "kzalloc fail"); + goto err_get_platform_type_1; + } + platform_p->id = PLATFORM_SETTINGS; + memset(platform_p->name, 0, sizeof(platform_p->name)); + snprintf(platform_p->name, (sizeof(platform_p->name) - 1), + "%s", platform_map.name); + snprintf(log_msg, sizeof(log_msg), + "User setup platform: %d (%s)", + platform_p->id, platform_p->name); + SWPS_DEBUG("%s: %s, :%d\n", __func__, log_msg, PLATFORM_SETTINGS); + return 0; + +err_get_platform_type_1: + SWPS_ERR("%s: %s :%d\n", __func__, log_msg, PLATFORM_SETTINGS); + return -1; +} + + +static int +get_layout_info(void){ + + ioexp_layout = redwood_ioexp_layout; + port_layout = redwood_port_layout; + ioexp_total = ARRAY_SIZE(redwood_ioexp_layout); + port_total = ARRAY_SIZE(redwood_port_layout); + + SWPS_INFO("Start to initial platform: %d (%s)\n", + platform_p->id, platform_p->name); + return 0; +} + +/* ========== Functions for register something ========== + */ + +static int +register_ioexp_attr_qsfp_1(struct device *device_p){ + /* Support machine type: + * - QSFP : Magnolia, Redwood, Hudson32i + * - QSFP+ : Magnolia, Redwood, Hudson32i + * - QSFP28: Redwood + */ + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_present) < 0) { + err_attr = "dev_attr_present"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_reset) < 0) { + err_attr = "dev_attr_reset"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_lpmod) < 0) { + err_attr = "dev_attr_lpmod"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_modsel) < 0) { + err_attr = "dev_attr_modsel"; + goto err_ioexp_qsfp1_attr; + } + return 0; + +err_ioexp_qsfp1_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + +static int +register_ioexp_attr(struct device *device_p, + struct transvr_obj_s *transvr_obj){ + + char *err_msg = "ERR"; + + switch (transvr_obj->ioexp_obj_p->ioexp_type){ + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + if (register_ioexp_attr_qsfp_1(device_p) < 0){ + err_msg = "register_ioexp_attr_qsfp_1 fail"; + goto err_reg_ioexp_attr; + } + break; + + default: + err_msg = "Unknow type"; + goto err_reg_ioexp_attr; + } + return 0; + +err_reg_ioexp_attr: + SWPS_ERR("%s: %s :%d \n", + __func__, err_msg, transvr_obj->ioexp_obj_p->ioexp_type); + return -1; +} + + +static int +register_port_device(char *dev_name, + dev_t dev_num, + struct transvr_obj_s *transvr_obj){ + + struct device *device_p = NULL; + device_p = device_create(swp_class_p, /* struct class *cls */ + NULL, /* struct device *parent */ + dev_num, /* dev_t devt */ + transvr_obj, /* void *private_data */ + dev_name); /* const char *fmt */ + if (IS_ERR(device_p)){ + goto err_regswp_create_dev; + } + if (register_ioexp_attr(device_p, transvr_obj) < 0){ + goto err_regswp_reg_attr; + } + return 0; + +err_regswp_reg_attr: + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); +err_regswp_create_dev: + SWPS_ERR("%s fail! :%s\n", __func__, dev_name); + return -1; +} + + +static int +register_swp_module(void){ + + dev_t port_devt = 0; + int dev_total = port_total + 1; /* char_dev for module control */ + + if (alloc_chrdev_region(&port_devt, 0, dev_total, SWP_CLS_NAME) < 0){ + SWPS_WARN("Allocate PORT MAJOR failure! \n"); + goto err_register_swp_module_3; + } + port_major = MAJOR(port_devt); + + /* Create class object */ + swp_class_p = class_create(THIS_MODULE, SWP_CLS_NAME); + if (IS_ERR(swp_class_p)) { + SWPS_ERR("Create class failure! \n"); + goto err_register_swp_module_3; + } + return 0; + +err_register_swp_module_3: + unregister_chrdev_region(MKDEV(port_major, 0), port_total); + return -1; +} + + +/* ========== Module initial relate ========== + */ +static int +create_ioexp_objs(void) { + + int i, run_mod; + + /* Clean IOEXP object */ + clean_ioexp_objs(); + /* Get running mode */ + run_mod = IOEXP_MODE_DIRECT; + /* Create IOEXP object */ + for(i=0; i devlen_max) { + snprintf(err_msg, sizeof(err_msg), + "SWP_DEV_PORT too long!"); + goto err_initport_create_tranobj; + } + memset(dev_name, 0, sizeof(dev_name)); + snprintf(dev_name, devlen_max, "%s%d", SWP_DEV_PORT, port_id); + /* Create transceiver object */ + ioexp_obj_p = get_ioexp_obj(ioexp_id); + if (!ioexp_obj_p){ + snprintf(err_msg, sizeof(err_msg), + "IOEXP object:%d not exist", ioexp_id); + goto err_initport_create_tranobj; + } + transvr_obj_p = create_transvr_obj(dev_name, chan_id, ioexp_obj_p, + ioexp_virt_offset, transvr_type, + chipset_type, run_mod); + if (!transvr_obj_p){ + snprintf(err_msg, sizeof(err_msg), + "Create transceiver object fail :%s", dev_name); + goto err_initport_create_tranobj; + } + /* Setup Lane_ID mapping */ + i = ARRAY_SIZE(port_layout[minor_curr].lane_id); + j = ARRAY_SIZE(transvr_obj_p->lane_id); + if (i != j) { + snprintf(err_msg, sizeof(err_msg), + "Lane_id size inconsistent %d/%d", i, j); + goto err_initport_reg_device; + } + memcpy(transvr_obj_p->lane_id, port_layout[minor_curr].lane_id, i*sizeof(int)); + /* Create and register device object */ + if (register_port_device(dev_name, MKDEV(port_major, minor_curr), transvr_obj_p) < 0){ + snprintf(err_msg, sizeof(err_msg), + "register_port_device fail"); + goto err_initport_reg_device; + } + /* Setup device_ptr of transvr_obj */ + dev_p = get_swpdev_by_name(dev_name); + if (!dev_p){ + snprintf(err_msg, sizeof(err_msg), + "get_swpdev_by_name fail"); + goto err_initport_reg_device; + } + transvr_obj_p->transvr_dev_p = dev_p; + /* Success */ + ok_count++; + } + SWPS_INFO("%s: initialed %d port-dev",__func__, ok_count); + return 0; + +err_initport_reg_device: + kfree(transvr_obj_p); +err_initport_create_tranobj: + clean_port_obj(); + SWPS_ERR("%s: %s", __func__, err_msg); + SWPS_ERR("Dump: :%d :%d :%d :%d :%d :%d\n", + port_id, chan_id, ioexp_id, ioexp_virt_offset, transvr_type, run_mod); + return -1; +} + +static int __init +swp_module_init(void){ + + if (get_platform_type() < 0){ + goto err_init_out; + } + if (get_layout_info() < 0){ + goto err_init_out; + } + if (register_swp_module() < 0){ + goto err_init_out; + } + if (create_ioexp_objs() < 0){ + goto err_init_ioexp; + } + if (create_port_objs() < 0){ + goto err_init_portobj; + } + if (init_ioexp_objs() < 0){ + goto err_init_portobj; + } + SWPS_INFO("Inventec switch-port module V.%s initial success.\n", SWP_VERSION); + return 0; + + +err_init_portobj: + clean_ioexp_objs(); +err_init_ioexp: + class_unregister(swp_class_p); + class_destroy(swp_class_p); + unregister_chrdev_region(MKDEV(port_major, 0), port_total); +err_init_out: + SWPS_ERR("Inventec switch-port module V.%s initial failure.\n", SWP_VERSION); + return -1; +} + + +static void __exit +swp_module_exit(void){ + clean_port_obj(); + clean_ioexp_objs(); + class_unregister(swp_class_p); + class_destroy(swp_class_p); + unregister_chrdev_region(MKDEV(port_major, 0), port_total); + SWPS_INFO("Remove Inventec switch-port module success.\n"); +} + + +/* Module information */ +MODULE_AUTHOR(SWP_AUTHOR); +MODULE_DESCRIPTION(SWP_DESC); +MODULE_VERSION(SWP_VERSION); +MODULE_LICENSE(SWP_LICENSE); + +module_init(swp_module_init); +module_exit(swp_module_exit); + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_swps.h b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_swps.h new file mode 100644 index 000000000000..b186c2202381 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_swps.h @@ -0,0 +1,131 @@ +#ifndef INV_SWPS_H +#define INV_SWPS_H + +#include "transceiver.h" +#include "io_expander.h" + +/* Module settings */ +#define SWP_CLS_NAME "swps" +#define SWP_DEV_PORT "port" +#define SWP_AUTOCONFIG_ENABLE (1) + +/* Module information */ +#define SWP_AUTHOR "Neil " +#define SWP_DESC "Inventec port and transceiver driver" +#define SWP_VERSION "4.2.3" +#define SWP_LICENSE "GPL" + +/* Module status define */ +#define SWP_STATE_NORMAL (0) +#define SWP_STATE_I2C_DIE (-91) + +/* [Note]: + * Functions and mechanism for auto-detect platform type is ready, + * But HW and BIOS not ready! We need to wait them. + * So, please do not use PLATFORM_TYPE_AUTO until they are ready. + * (2016.06.13) + */ +#define PLATFORM_TYPE_REDWOOD (121) +/* Current running platfrom */ +#define PLATFORM_SETTINGS PLATFORM_TYPE_REDWOOD + +/* Define platform flag and kernel version */ +#if (PLATFORM_SETTINGS == PLATFORM_TYPE_REDWOOD) + #define SWPS_KERN_VER_BF_3_8 (1) +#endif + +struct inv_platform_s { + int id; + char name[64]; +}; + +struct inv_ioexp_layout_s { + int ioexp_id; + int ioexp_type; + struct ioexp_addr_s addr[4]; +}; + +struct inv_port_layout_s { + int port_id; + int chan_id; + int ioexp_id; + int ioexp_offset; + int transvr_type; + int chipset_type; + int lane_id[8]; +}; + +/* ========================================== + * Inventec Platform Settings + * ========================================== + */ +struct inv_platform_s platform_map = {PLATFORM_TYPE_REDWOOD, "D7032Q28B" }; + +/* ========================================== + * Redwood Layout configuration + * ========================================== + */ +struct inv_ioexp_layout_s redwood_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_REDWOOD_P01P08, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {1, IOEXP_TYPE_REDWOOD_P09P16, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {2, IOEXP_TYPE_REDWOOD_P01P08, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {3, IOEXP_TYPE_REDWOOD_P09P16, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, +}; + +struct inv_port_layout_s redwood_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 22, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} }, + { 1, 23, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} }, + { 2, 24, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} }, + { 3, 25, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} }, + { 4, 26, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} }, + { 5, 27, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} }, + { 6, 28, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} }, + { 7, 29, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} }, + { 8, 30, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} }, + { 9, 31, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} }, + {10, 32, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} }, + {11, 33, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} }, + {12, 34, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} }, + {13, 35, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, + {14, 36, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} }, + {15, 37, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} }, + {16, 6, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, + {17, 7, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, + {18, 8, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} }, + {19, 9, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} }, + {20, 10, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, + {21, 11, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {22, 12, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} }, + {23, 13, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} }, + {24, 14, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {25, 15, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {26, 16, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {27, 17, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, + {28, 18, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113,114,115,116} }, + {29, 19, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + {30, 20, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121,122,123,124} }, + {31, 21, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125,126,127,128} }, +}; + +#endif /* INV_SWPS_H */ + + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/io_expander.c b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/io_expander.c new file mode 100644 index 000000000000..7c9f8a66aec7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/io_expander.c @@ -0,0 +1,887 @@ +#include +#include +#include +#include "io_expander.h" + +static struct ioexp_obj_s *ioexp_head_p = NULL; +static struct ioexp_obj_s *ioexp_tail_p = NULL; + +struct ioexp_map_s ioexp_map_redwood_p01p08_p17p24 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 0, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 0, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_redwood_p09p16_p25p32 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 1, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 1, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 1, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 1, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + +/* ========== Private functions ========== + */ +int check_channel_tier_1(void); + +struct i2c_client * +_get_i2c_client(struct ioexp_obj_s *self, + int chip_id){ + + struct ioexp_i2c_s *i2c_curr_p = self->i2c_head_p; + + if (!(i2c_curr_p)){ + SWPS_ERR("%s: i2c_curr_p is NULL\n", __func__); + return NULL; + } + while (i2c_curr_p){ + if ((i2c_curr_p->chip_id) == chip_id){ + return i2c_curr_p->i2c_client_p; + } + i2c_curr_p = i2c_curr_p->next; + } + SWPS_ERR("%s: not exist! :%d\n", __func__, chip_id); + return NULL; +} + + +static int +_common_ioexp_update_one(struct ioexp_obj_s *self, + struct ioexp_addr_s *ioexp_addr, + int chip_id, + int data_width, + int show_err, + char *caller_name) { + int buf = 0; + int err = 0; + int data_id = 0; + int r_offset = 0; + + for(data_id=0; data_idread_offset[data_id]; + buf = i2c_smbus_read_byte_data(_get_i2c_client(self, chip_id), r_offset); + /* Check error */ + if (buf < 0) { + err = 1; + if (show_err) { + SWPS_INFO("IOEXP-%d read fail! :%d \n", self->ioexp_id, buf); + SWPS_INFO("Dump: :%d :0x%02x :%d, :%s\n", + ioexp_addr->chan_id, ioexp_addr->chip_addr, + ioexp_addr->read_offset[data_id], caller_name); + } + continue; + } + /* Update IOEXP object */ + self->chip_data[chip_id].data[data_id] = (uint8_t)buf; + } + if (err) { + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +static int +common_ioexp_update_all(struct ioexp_obj_s *self, + int show_err, + char *caller_name){ + + int err = 0; + int chip_id = 0; + int chip_amount = self->ioexp_map_p->chip_amount; + + for (chip_id=0; chip_idioexp_map_p->map_addr[chip_id]), + chip_id, + self->ioexp_map_p->data_width, + show_err, + caller_name) < 0) { + err = 1; + } + } + if (err) { + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + +static int +_common_get_bit(struct ioexp_obj_s *self, + struct ioexp_bitmap_s *bitmap_obj_p, + char *func_mane){ + uint8_t buf; + int err_code; + + /* Get address */ + err_code = self->fsm_4_direct(self); + if (err_code < 0){ + return err_code; + } + + if (!bitmap_obj_p){ + SWPS_ERR("Layout config incorrect! :%d :%s\n", + self->ioexp_id, func_mane); + return ERR_IOEXP_BADCONF; + } + /* Get data form cache */ + buf = self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset]; + return (int)(buf >> bitmap_obj_p->bit_shift & 0x01); +} + + +static int +_common_set_bit(struct ioexp_obj_s *self, + struct ioexp_bitmap_s *bitmap_obj_p, + int input_val, + char *func_mane){ + int err_code, target_offset; + uint8_t origin_byte; + uint8_t modify_byte; + + /* Get address */ + err_code = self->fsm_4_direct(self); + if (err_code < 0){ + return err_code; + } + if (!bitmap_obj_p){ + SWPS_ERR("Layout config incorrect! :%d :%s\n", + self->ioexp_id, func_mane); + return ERR_IOEXP_BADCONF; + } + /* Prepare write date */ + origin_byte = self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset]; + switch (input_val) { + case 0: + modify_byte = origin_byte; + SWP_BIT_CLEAR(modify_byte, bitmap_obj_p->bit_shift); + break; + case 1: + modify_byte = origin_byte; + SWP_BIT_SET(modify_byte, bitmap_obj_p->bit_shift); + break; + default: + SWPS_ERR("Input value incorrect! :%d :%d :%s\n", + input_val, self->ioexp_id, func_mane); + return ERR_IOEXP_BADINPUT; + } + /* Setup i2c client */ + target_offset = self->ioexp_map_p->map_addr[bitmap_obj_p->chip_id].write_offset[bitmap_obj_p->ioexp_voffset]; + /* Write byte to chip via I2C */ + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, bitmap_obj_p->chip_id), + target_offset, + modify_byte); + /* Update or bollback object */ + if (err_code < 0){ + self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset] = origin_byte; + SWPS_ERR("I2C write fail! :%d :%d :%s :%d\n", + input_val, self->ioexp_id, func_mane, err_code); + return err_code; + } + self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset] = modify_byte; + return 0; +} + + +/* ========== Object public functions ========== + */ +int +common_get_present(struct ioexp_obj_s *self, + int virt_offset){ + + int UNPLUG = 1; + int retval = ERR_IOEXP_UNEXCPT; + + retval = _common_get_bit(self, + &(self->ioexp_map_p->map_present[virt_offset]), + "common_get_present"); + if (retval < 0) { + /* [Note] + * => Transceiver object does not need to handle IOEXP layer issues. + */ + return UNPLUG; + } + return retval; +} + + +int +common_get_reset(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_reset[virt_offset]), + "common_get_reset"); +} + + +int +common_get_lpmod(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_lpmod[virt_offset]), + "common_get_lpmod"); +} + + +int +common_get_modsel(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_modsel[virt_offset]), + "common_get_modsel"); +} + +int +common_set_reset(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_reset[virt_offset]), + input_val, + "common_set_reset"); +} + + +int +common_set_lpmod(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_lpmod[virt_offset]), + input_val, + "common_set_lpmod"); +} + + +int +common_set_modsel(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_modsel[virt_offset]), + input_val, + "common_set_modsel"); +} + +int +ioexp_get_not_support(struct ioexp_obj_s *self, + int virt_offset){ + return ERR_IOEXP_NOTSUPPORT; +} + + +int +ioexp_set_not_support(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + return ERR_IOEXP_NOTSUPPORT; +} + +/* ========== Initial functions for IO Expander ========== + */ +int +common_ioexp_init(struct ioexp_obj_s *self) { + + int chip_id, offset, err_code; + struct ioexp_addr_s *addr_p; + + if (self->mode == IOEXP_MODE_DIRECT) { ///important + goto update_common_ioexp_init; + } + /* Setup default value to each physical IO Expander */ + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + /* Get address mapping */ + addr_p = &(self->ioexp_map_p->map_addr[chip_id]); + if (!addr_p){ + SWPS_ERR("%s: IOEXP config incorrect! :%d \n", + __func__, chip_id); + return -1; + } + /* Setup default value */ + for (offset=0; offset<(self->ioexp_map_p->data_width); offset++){ + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, chip_id), + addr_p->write_offset[offset], + addr_p->data_default[offset]); + if (err_code < 0){ + SWPS_ERR("%s: set default fail! :%d \n", + __func__, err_code); + return ERR_IOEXP_UNEXCPT; + } + } + } + +update_common_ioexp_init: + /* Check and update info to object */ + err_code = self->update_all(self, 1, "common_ioexp_init"); + if (err_code < 0) { + SWPS_ERR("%s: update_all() fail! :%d \n", + __func__, err_code); + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +/* ========== Object functions for Final State Machine ========== + */ +int +_is_channel_ready(struct ioexp_obj_s *self){ + + int buf = 0; + int chip_id = 0; /* Use first chip which be registered */ + int data_id = 0; /* Use first byte which be registered */ + struct ioexp_addr_s *ioexp_addr = NULL; + + ioexp_addr = &(self->ioexp_map_p->map_addr[chip_id]); + if (!ioexp_addr){ + SWPS_ERR("%s: config incorrect!\n", __func__); + return ERR_IOEXP_UNEXCPT; + } + buf = i2c_smbus_read_byte_data(_get_i2c_client(self, chip_id), + ioexp_addr->read_offset[data_id]); + if (buf >= 0){ + return 1; + } + return 0; +} + +int +_ioexp_init_handler(struct ioexp_obj_s *self){ + + int return_val; + + switch (self->mode) { + case IOEXP_MODE_DIRECT: + return_val = self->init(self); + if (return_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + } else { + self->state = STATE_IOEXP_NORMAL; + } + return return_val; + default: + break; + } + SWPS_ERR("%s: exception occur :%d\n", __func__, self->mode); + return ERR_IOEXP_UNEXCPT; +} + + +int +common_ioexp_fsm_4_direct(struct ioexp_obj_s *self){ + + int result_val; + int show_err = 1; + char *func_mane = "common_ioexp_fsm_4_direct"; + + switch (self->state){ + case STATE_IOEXP_INIT: + result_val = _ioexp_init_handler(self); + /* Exception case: terminate initial procedure */ + if(result_val < 0){ + /* Initial fail */ + return result_val; + } + if(self->state == STATE_IOEXP_INIT){ + /* Keep in INIT state, and return error */ + return ERR_IOEXP_UNINIT; + } + /* Case: Initial done */ + return 0; + + case STATE_IOEXP_NORMAL: + result_val = self->update_all(self, show_err, func_mane); + if (result_val < 0){ + SWPS_INFO("%s: NORMAL -> ABNORMAL :%d\n", + __func__, result_val); + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + self->state = STATE_IOEXP_NORMAL; + return 0; + + case STATE_IOEXP_ABNORMAL: + result_val = self->update_all(self, show_err, func_mane); + if (result_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + SWPS_DEBUG("%s: ABNORMAL -> NORMAL :%d\n", + __func__, result_val); + self->state = STATE_IOEXP_NORMAL; + return 0; + + default: + break; + } + SWPS_ERR("%s: Exception occurs :%d\n", + __func__, self->state); + return ERR_IOEXP_UNEXCPT; +} + +/* ========== Functions for Factory pattern ========== + */ +static struct ioexp_map_s * +get_ioexp_map(int ioexp_type){ + switch (ioexp_type){ + case IOEXP_TYPE_REDWOOD_P01P08: + return &ioexp_map_redwood_p01p08_p17p24; + case IOEXP_TYPE_REDWOOD_P09P16: + return &ioexp_map_redwood_p09p16_p25p32; + default: + return NULL; + } +} + + +int +setup_ioexp_ssize_attr(struct ioexp_obj_s *self, + struct ioexp_map_s *ioexp_map_p, + int ioexp_id, + int ioexp_type, + int run_mode){ + switch (run_mode){ + case IOEXP_MODE_DIRECT: /* Direct access device mode */ + self->mode = run_mode; + break; + default: + SWPS_ERR("%s: non-defined run_mode:%d\n", + __func__, run_mode); + self->mode = ERR_IOEXP_UNEXCPT; + return ERR_IOEXP_UNEXCPT; + } + self->ioexp_id = ioexp_id; + self->ioexp_type = ioexp_type; + self->ioexp_map_p = ioexp_map_p; + self->state = STATE_IOEXP_INIT; + mutex_init(&self->lock); + return 0; +} + + +static int +setup_addr_mapping(struct ioexp_obj_s *self, + struct ioexp_addr_s *addr_map_p){ + if (!addr_map_p){ + SWPS_ERR("%s: map is null\n", __func__); + return -1; + } + self->ioexp_map_p->map_addr = addr_map_p; + return 0; +} + + +static int +setup_ioexp_public_cb(struct ioexp_obj_s *self, + int ioexp_type){ + switch (ioexp_type){ + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + self->get_present = common_get_present; + self->get_reset = common_get_reset; + self->get_lpmod = common_get_lpmod; + self->get_modsel = common_get_modsel; + self->set_reset = common_set_reset; + self->set_lpmod = common_set_lpmod; + self->set_modsel = common_set_modsel; + return 0; + default: + SWPS_ERR("%s: type:%d incorrect!\n", __func__, ioexp_type); + break; + } + return ERR_IOEXP_UNEXCPT; +} + + +static int +setup_ioexp_private_cb(struct ioexp_obj_s *self, + int ioexp_type){ + + switch (ioexp_type){ + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + + self->init = common_ioexp_init; + self->update_all = common_ioexp_update_all; + self->fsm_4_direct = common_ioexp_fsm_4_direct; + return 0; + + default: + SWPS_ERR("%s: type:%d incorrect!\n", __func__, ioexp_type); + break; + } + return ERR_IOEXP_UNEXCPT; +} + + +static int +setup_i2c_client_one(struct ioexp_obj_s *self, + int chip_id){ + + char *err_msg = "ERROR"; + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + struct ioexp_i2c_s *i2c_obj_p = NULL; + struct ioexp_i2c_s *i2c_curr_p = NULL; + + int chan_id = self->ioexp_map_p->map_addr[chip_id].chan_id; + adap = i2c_get_adapter(chan_id); + if(!adap){ + err_msg = "Can not get adap!"; + goto err_ioexp_setup_i2c_1; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + err_msg = "Can not kzalloc client!"; + goto err_ioexp_setup_i2c_1; + } + i2c_obj_p = kzalloc(sizeof(*i2c_obj_p), GFP_KERNEL); + if (!i2c_obj_p){ + err_msg = "Can not kzalloc i2c_obj_p!"; + goto err_ioexp_setup_i2c_2; + } + client->adapter = adap; + client->addr = self->ioexp_map_p->map_addr[chip_id].chip_addr; + i2c_obj_p->i2c_client_p = client; + i2c_obj_p->chip_id = chip_id; + i2c_obj_p->next = NULL; + if (!self->i2c_head_p){ + self->i2c_head_p = i2c_obj_p; + } else { + i2c_curr_p = self->i2c_head_p; + while (i2c_curr_p->next){ + i2c_curr_p = i2c_curr_p->next; + } + i2c_curr_p->next = i2c_obj_p; + } + return 0; + +err_ioexp_setup_i2c_2: + kfree(client); +err_ioexp_setup_i2c_1: + SWPS_ERR("%s: %s :%d\n", __func__, err_msg, chan_id); + return -1; +} + + +static int +setup_i2c_client(struct ioexp_obj_s* self){ + + int result; + int chip_id = 0; + + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + result = setup_i2c_client_one(self, chip_id); + if (result < 0){ + SWPS_ERR("%s fail! :%d\n", __func__, chip_id); + return -1; + } + } + return 0; +} + +static int +setup_ioexp_config(struct ioexp_obj_s *self) { + + int chip_id, offset, err_code; + struct ioexp_addr_s *addr_p; + + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + addr_p = &(self->ioexp_map_p->map_addr[chip_id]); + if (!addr_p){ + SWPS_ERR("IOEXP config incorrect! :%d \n",chip_id); + return -1; + } + for (offset=0; offset<(self->ioexp_map_p->data_width); offset++){ + + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, chip_id), + addr_p->conf_offset[offset], + addr_p->conf_default[offset]); + + if (err_code < 0){ + SWPS_INFO("%s: set conf fail! :%d \n", __func__, err_code); + return -2; + } + } + } + return 0; +} + +struct ioexp_obj_s * +_create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode){ + + struct ioexp_map_s* ioexp_map_p; + struct ioexp_obj_s* result_p; + struct ioexp_i2c_s *i2c_curr_p; + struct ioexp_i2c_s *i2c_next_p; + + /* Get layout */ + ioexp_map_p = get_ioexp_map(ioexp_type); + if (!ioexp_map_p){ + SWPS_ERR("%s: Invalid ioexp_type\n", __func__); + goto err_create_ioexp_fail; + } + /* Prepare IOEXP object */ + result_p = kzalloc(sizeof(*result_p), GFP_KERNEL); + if (!result_p){ + SWPS_ERR("%s: kzalloc failure!\n", __func__); + goto err_create_ioexp_fail; + } + /* Prepare static size attributes */ + if (setup_ioexp_ssize_attr(result_p, + ioexp_map_p, + ioexp_id, + ioexp_type, + run_mode) < 0){ + goto err_create_ioexp_setup_attr_fail; + } + /* Prepare address mapping */ + if (setup_addr_mapping(result_p, addr_map_p) < 0){ + goto err_create_ioexp_setup_attr_fail; + } + if (setup_i2c_client(result_p) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + /* Prepare call back functions of object */ + if (setup_ioexp_public_cb(result_p, ioexp_type) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + if (setup_ioexp_private_cb(result_p, ioexp_type) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + return result_p; + +err_create_ioexp_setup_i2c_fail: + i2c_curr_p = result_p->i2c_head_p; + i2c_next_p = result_p->i2c_head_p; + while (i2c_curr_p){ + i2c_next_p = i2c_curr_p->next; + kfree(i2c_curr_p->i2c_client_p); + kfree(i2c_curr_p); + i2c_curr_p = i2c_next_p; + } +err_create_ioexp_setup_attr_fail: + kfree(result_p); +err_create_ioexp_fail: + SWPS_ERR("%s: fail! :%d :%d \n", + __func__, ioexp_id, ioexp_type); + return NULL; +} + + +int +create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode){ + + struct ioexp_obj_s *ioexp_p = NULL; + + ioexp_p = _create_ioexp_obj(ioexp_id, ioexp_type, + addr_map_p, run_mode); + if (!ioexp_p){ + return -1; + } + if (ioexp_head_p == NULL){ + ioexp_head_p = ioexp_p; + ioexp_tail_p = ioexp_p; + return 0; + } + ioexp_tail_p->next = ioexp_p; + ioexp_tail_p = ioexp_p; + return 0; +} + +static int +_init_ioexp_obj(struct ioexp_obj_s* self) { + + char *err_msg = "ERR"; + char *func_name = "_init_ioexp_obj"; + + /* Setup IOEXP configure byte */ + if (setup_ioexp_config(self) < 0){ + err_msg = "setup_ioexp_config fail"; + goto err_init_ioexp_obj; + } + /* Setup default data */ + if (_ioexp_init_handler(self) < 0){ + err_msg = "_ioexp_init_handler fail"; + goto err_init_ioexp_obj; + } + /* Update all */ + if (self->state == STATE_IOEXP_NORMAL){ + if (self->update_all(self, 1, func_name) < 0){ + err_msg = "update_all() fail"; + goto err_init_ioexp_obj; + } + } + return 0; + +err_init_ioexp_obj: + SWPS_DEBUG("%s: %s\n", __func__, err_msg); + return -1; +} + +int +init_ioexp_objs(void){ + /* Return value: + * 0: Success + * -1: Detect topology error + * -2: SWPS internal error + */ + + struct ioexp_obj_s *curr_p = ioexp_head_p; + + if (!curr_p) { + SWPS_ERR("%s: ioexp_head_p is NULL\n", __func__); + return -2; + } + while (curr_p) { + if (_init_ioexp_obj(curr_p) < 0) { + SWPS_DEBUG("%s: _init_ioexp_obj() fail\n", __func__); + return -1; + } + curr_p = curr_p->next; + } + SWPS_DEBUG("%s: done.\n", __func__); + return 0; +} + +void +clean_ioexp_objs(void){ + + struct ioexp_i2c_s *i2c_curr_p = NULL; + struct ioexp_i2c_s *i2c_next_p = NULL; + struct ioexp_obj_s *ioexp_next_p = NULL; + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + if (ioexp_head_p == NULL){ + ioexp_tail_p = NULL; + return; + } + while(ioexp_curr_p){ + ioexp_next_p = ioexp_curr_p->next; + i2c_curr_p = ioexp_curr_p->i2c_head_p; + while (i2c_curr_p) { + i2c_next_p = i2c_curr_p->next; + kfree(i2c_curr_p->i2c_client_p); + kfree(i2c_curr_p); + i2c_curr_p = i2c_next_p; + } + kfree(ioexp_curr_p); + ioexp_curr_p = ioexp_next_p; + } + ioexp_tail_p = NULL; + SWPS_DEBUG("%s: done.\n", __func__); +} + +struct ioexp_obj_s * +get_ioexp_obj(int ioexp_id){ + + struct ioexp_obj_s *result_p = NULL; + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + if (ioexp_curr_p->ioexp_id == ioexp_id){ + result_p = ioexp_curr_p; + break; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return result_p; +} +int +check_channel_tier_1(void) { + + if ( (!_is_channel_ready(ioexp_head_p)) && + (!_is_channel_ready(ioexp_tail_p)) ){ + return -1; + } + return 0; +} + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/io_expander.h b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/io_expander.h new file mode 100644 index 000000000000..8c51b4f6d94f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/io_expander.h @@ -0,0 +1,136 @@ +#ifndef IO_EXPANDER_H +#define IO_EXPANDER_H + +#include + +/* IOEXP type define (QSFP series) */ +#define IOEXP_TYPE_REDWOOD_P01P08 (10202) +#define IOEXP_TYPE_REDWOOD_P09P16 (10203) + +/* IOEXP mode define */ +#define IOEXP_MODE_DIRECT (19001) + +/* IOEXP state define */ +#define STATE_IOEXP_NORMAL (0) +#define STATE_IOEXP_INIT (-1) +#define STATE_IOEXP_ABNORMAL (-2) + +/* IOEXP error code define */ +#define ERR_IOEXP_NOTSUPPORT (-100) +#define ERR_IOEXP_UNINIT (-101) +#define ERR_IOEXP_BADCONF (-102) +#define ERR_IOEXP_BADINPUT (-105) +#define ERR_IOEXP_UNEXCPT (-199) + + +#define SWPS_INFO(fmt, args...) printk( KERN_INFO "[SWPS] " fmt, ##args) +#define SWPS_WARN(fmt, args...) printk( KERN_WARNING "[SWPS] " fmt, ##args) +#define SWPS_ERR(fmt, args...) printk( KERN_ERR "[SWPS] " fmt, ##args) + +#ifdef DEBUG_SWPS +# define SWPS_DEBUG(fmt, args...) printk( KERN_DEBUG "[SWPS] " fmt, ##args) +#else +# define SWPS_DEBUG(fmt, args...) +#endif + + +struct ioexp_addr_s { + int chan_id; + int chip_addr; + int read_offset[8]; + int write_offset[8]; + int conf_offset[8]; + uint8_t data_default[8]; + uint8_t conf_default[8]; +}; + +struct ioexp_i2c_s { + int chip_id; + struct i2c_client *i2c_client_p; + struct ioexp_i2c_s *next; +}; + + +struct ioexp_bitmap_s { + int chip_id; /* IOEXP chip id */ + int ioexp_voffset; /* IOEXP virtual offset */ + int bit_shift; +}; + +struct ioexp_map_s { + int chip_amount; /* Number of chips that IOEXP object content */ + int data_width; /* Number of (Read/Write/Config) bytes */ + struct ioexp_addr_s *map_addr; /* Chip address info */ + struct ioexp_bitmap_s map_present[8]; /* IOEXP for SFP / QSFP */ + struct ioexp_bitmap_s map_reset[8]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_lpmod[8]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_modsel[8]; /* IOEXP for QSFP */ +}; + +struct ioexp_data_s { + uint8_t data[8]; +}; + +struct ioexp_obj_s { + + /* ============================ + * Object public property + * ============================ + */ + int ioexp_id; + int ioexp_type; + + /* ============================ + * Object private property + * ============================ + */ + struct ioexp_data_s chip_data[16]; /* Max: 8-ioexp in one virt-ioexp(ioexp_obj) */ + struct ioexp_map_s *ioexp_map_p; + struct ioexp_obj_s *next; + struct ioexp_i2c_s *i2c_head_p; + struct mutex lock; + int mode; + int state; + + /* =========================================== + * Object public functions + * =========================================== + */ + int (*get_present)(struct ioexp_obj_s *self, int virt_offset); + int (*get_reset)(struct ioexp_obj_s *self, int virt_offset); + int (*get_lpmod)(struct ioexp_obj_s *self, int virt_offset); + int (*get_modsel)(struct ioexp_obj_s *self, int virt_offset); + int (*set_reset)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_lpmod)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_modsel)(struct ioexp_obj_s *self, int virt_offset, int input_val); + + /* =========================================== + * Object private functions + * =========================================== + */ + int (*init)(struct ioexp_obj_s *self); + int (*update_all)(struct ioexp_obj_s *self, int show_err, char *caller_name); + int (*fsm_4_direct)(struct ioexp_obj_s* self); +}; + + +struct ioexp_obj_s* get_ioexp_obj(int ioexp_id); +int create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode); +int init_ioexp_objs(void); +void clean_ioexp_objs(void); + +int check_channel_tier_1(void); + +/* Macro for bit control */ +#define SWP_BIT_SET(byte_val,bit_shift) ((byte_val) |= (1<<(bit_shift))) +#define SWP_BIT_CLEAR(byte_val,bit_shift) ((byte_val) &= ~(1<<(bit_shift))) + + +#endif /* IO_EXPANDER_H */ + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/transceiver.c b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/transceiver.c new file mode 100644 index 000000000000..36ccc45a9216 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/transceiver.c @@ -0,0 +1,898 @@ +#include +#include +#include +#include +#include "io_expander.h" +#include "transceiver.h" + + +/* ========== Register EEPROM address mapping ========== + */ +struct eeprom_map_s eeprom_map_qsfp = { + .addr_rx_los =0x50, .page_rx_los =-1, .offset_rx_los =3, .length_rx_los =1, + .addr_tx_disable =0x50, .page_tx_disable =-1, .offset_tx_disable =86, .length_tx_disable =1, + .addr_tx_fault =0x50, .page_tx_fault =-1, .offset_tx_fault =4, .length_tx_fault =1, +}; + +struct eeprom_map_s eeprom_map_qsfp28 = { + .addr_rx_los =0x50, .page_rx_los =-1, .offset_rx_los =3, .length_rx_los =1, + .addr_tx_disable =0x50, .page_tx_disable =-1, .offset_tx_disable =86, .length_tx_disable =1, + .addr_tx_fault =0x50, .page_tx_fault =-1, .offset_tx_fault =4, .length_tx_fault =1, +}; + + +/* ========== Utility Functions ========== + */ +void +alarm_msg_2_user(struct transvr_obj_s *self, + char *emsg) { + + SWPS_ERR("%s on %s.\n", emsg, self->swp_name); +} + + +/* ========== Private functions ========== + */ +static int +_reload_transvr_obj(struct transvr_obj_s *self,int new_type); + +static int +reload_transvr_obj(struct transvr_obj_s *self,int new_type); + +static int +_transvr_init_handler(struct transvr_obj_s *self); + +static void +_transvr_clean_retry(struct transvr_obj_s *self) { + self->retry = 0; +} + + +static int +_transvr_handle_retry(struct transvr_obj_s *self, int retry) { + /* Return: 0: keep retry + * -1: stop retry + */ + if (self->retry == 0) { + self->retry = retry; + } + self->retry -= 1; + if (self->retry <= 0) { + _transvr_clean_retry(self); + return -1; + } + return 0; +} + +static int +_common_setup_page(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + int show_e) { + /* return: + * 0 : OK + * -1 : EEPROM settings incorrect + * -2 : I2C R/W failure + * -3 : Undefined case + */ + int retval = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Check */ + if ((addr < 0) || (offset < 0) || (len < 0)) { + emsg = "EEPROM settings incorrect"; + retval = -1; + goto err_common_setup_page; + } + /* Case1: continue access */ + if ((self->i2c_client_p->addr == addr) && + (self->curr_page == page)) { + return 0; + } + self->i2c_client_p->addr = addr; + /* Case2: select lower page */ + if (page == -1) { + self->curr_page = page; + return 0; + } + /* Case3: select upper page */ + if (page >= 0) { + goto upper_common_setup_page; + } + /* Unexpected case */ + show_e = 1; + emsg = "Unexpected case"; + retval = -3; + goto err_common_setup_page; + +upper_common_setup_page: + if (i2c_smbus_write_byte_data(self->i2c_client_p, + VAL_TRANSVR_PAGE_SELECT_OFFSET, + page) < 0) { + emsg = "I2C R/W failure"; + retval = -2; + goto err_common_setup_page; + } + self->curr_page = page; + mdelay(VAL_TRANSVR_PAGE_SELECT_DELAY); + return 0; + +err_common_setup_page: + if (show_e) { + SWPS_INFO("%s: %s", __func__, emsg); + SWPS_INFO("%s: :0x%02x :%d :%d :%d\n", + __func__, addr, page, offset, len); + } + return retval; +} + +/* ========== Object functions for Final State Machine ========== + */ +int +is_plugged(struct transvr_obj_s *self){ + + int limit = 63; + int present = DEBUG_TRANSVR_INT_VAL; + char emsg[64] = DEBUG_TRANSVR_STR_VAL; + struct ioexp_obj_s *ioexp_p = self->ioexp_obj_p; + + if (!ioexp_p) { + snprintf(emsg, limit, "ioexp_p is null!"); + goto err_is_plugged_1; + } + present = ioexp_p->get_present(ioexp_p, self->ioexp_virt_offset); + switch (present){ + case 0: + return 1; + case 1: + return 0; + case ERR_IOEXP_UNINIT: + snprintf(emsg, limit, "ioexp_p not ready!"); + goto err_is_plugged_1; + default: + if (ioexp_p->state == STATE_IOEXP_INIT){ + snprintf(emsg, limit, "ioexp_p not ready!"); + goto err_is_plugged_1; + } + break; + } + SWPS_INFO("%s: Exception case! :%d :%d\n", + __func__, present, ioexp_p->state); + return 0; + +err_is_plugged_1: + SWPS_DEBUG("%s: %s\n", __func__, emsg); + return 0; +} + + +static int +detect_transvr_type(struct transvr_obj_s* self){ + + int type = TRANSVR_TYPE_ERROR; + + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + type = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + + /* Case: 1. Wait transceiver I2C module. + * 2. Transceiver I2C module failure. + * Note: 1. SFF allow maximum transceiver initial time is 2 second. So, there + * are exist some case that we need to wait transceiver. + * For these case, we keeps status on "TRANSVR_TYPE_UNPLUGGED", than + * state machine will keep trace with it. + * 2. There exist some I2C failure case we need to handle. Such as user + * insert the failure transceiver, or any reason cause it abnormal. + */ + if (type < 0){ + switch (type) { + case -EIO: + SWPS_DEBUG("%s: %s smbus return:-5 (I/O error)\n", + __func__, self->swp_name); + return TRANSVR_TYPE_UNPLUGGED; + case -ENXIO: + SWPS_DEBUG("%s: %s smbus return:-6 (No such device or address)\n", + __func__, self->swp_name); + return TRANSVR_TYPE_UNPLUGGED; + default: + break; + } + SWPS_INFO("%s: %s unexpected smbus return:%d \n", + __func__, self->swp_name, type); + return TRANSVR_TYPE_ERROR; + } + /* Identify valid transceiver type */ + switch (type){ + case TRANSVR_TYPE_SFP: + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + break; + case TRANSVR_TYPE_UNKNOW_1: + case TRANSVR_TYPE_UNKNOW_2: + type = TRANSVR_TYPE_UNKNOW_2; + break; + default: + SWPS_DEBUG("%s: unknow type:0x%02x \n", __func__, type); + type = TRANSVR_TYPE_ERROR; + break; + } + return type; +} + + +static int +detect_transvr_state(struct transvr_obj_s *self, + int result[2]){ + /* [return] [result-0] [result-1] + * 0 STATE_TRANSVR_CONNECTED TRANSVR_TYPE_FAKE + * 0 STATE_TRANSVR_DISCONNECTED TRANSVR_TYPE_UNPLUGGED + * 0 STATE_TRANSVR_ISOLATED TRANSVR_TYPE_ERROR + * 0 STATE_TRANSVR_INIT / + * 0 STATE_TRANSVR_SWAPPED + * 0 STATE_TRANSVR_CONNECTED + * ERR_TRNASVR_BE_ISOLATED STATE_TRANSVR_ISOLATED TRANSVR_TYPE_ERROR + * ERR_TRANSVR_I2C_CRASH STATE_TRANSVR_UNEXCEPTED TRANSVR_TYPE_ERROR + * ERR_TRANSVR_UNEXCPT STATE_TRANSVR_UNEXCEPTED TRANSVR_TYPE_UNKNOW_1/2 + */ + result[0] = STATE_TRANSVR_UNEXCEPTED; /* For return state */ + result[1] = TRANSVR_TYPE_ERROR; /* For return type */ + + /* Case1: Fake type */ + if (self->type == TRANSVR_TYPE_FAKE){ + result[0] = STATE_TRANSVR_CONNECTED; + result[1] = TRANSVR_TYPE_FAKE; + return 0; + } + /* Case2: Transceiver unplugged */ + if (!is_plugged(self)){ + result[0] = STATE_TRANSVR_DISCONNECTED; + result[1] = TRANSVR_TYPE_UNPLUGGED; + return 0; + } + /* Case3: Transceiver be isolated */ + if (self->state == STATE_TRANSVR_ISOLATED){ + result[0] = STATE_TRANSVR_ISOLATED; + result[1] = TRANSVR_TYPE_ERROR; + return ERR_TRNASVR_BE_ISOLATED; + } + /* Case4: Transceiver plugged */ + result[1] = detect_transvr_type(self); + /* Case4.1: I2C topology crash + * Note : There are some I2C issues cause by transceiver/cables. + * We need to check topology status when user insert it. + * But in this step, we can't not ensure this is the issues + * port. So, it return the ERR_TRANSVR_I2C_CRASH, then upper + * layer will diagnostic I2C topology. + */ + if (check_channel_tier_1() < 0) { + SWPS_INFO("%s: %s detect I2C crash :%d\n", + __func__, self->swp_name, self->state); + result[0] = STATE_TRANSVR_UNEXCEPTED; + result[1] = TRANSVR_TYPE_ERROR; + return ERR_TRANSVR_I2C_CRASH; + } + /* Case4.2: System initial not ready, + * Note : Sometime i2c channel or transceiver EEPROM will delay that will + * cause system in inconsistent state between EEPROM and IOEXP. + * In this case, SWP transceiver object keep state at LINK_DOWN + * to wait system ready. + * By the way, State Machine will handle these case. + */ + if (result[1] == TRANSVR_TYPE_UNPLUGGED){ + result[0] = STATE_TRANSVR_DISCONNECTED; + return 0; + } + /* Case4.3: Error transceiver type */ + if (result[1] == TRANSVR_TYPE_ERROR){ + result[0] = STATE_TRANSVR_ISOLATED; + SWPS_INFO("%s: %s detect error type\n", __func__, self->swp_name); + alarm_msg_2_user(self, "detected transceiver/cables not meet SFF standard!"); + return ERR_TRNASVR_BE_ISOLATED; + } + /* Case3.3: Unknow transceiver type */ + if ((result[1] == TRANSVR_TYPE_UNKNOW_1) || + (result[1] == TRANSVR_TYPE_UNKNOW_2) ){ + result[0] = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_UNEXCPT; + } + /* Case3.4: During initial process */ + if (self->state == STATE_TRANSVR_INIT){ + result[0] = STATE_TRANSVR_INIT; + return 0; + } + /* Case3.5: Transceiver be swapped */ + if (self->type != result[1]){ + result[0] = STATE_TRANSVR_SWAPPED; + return 0; + } + /* Case3.6: Link up state */ + result[0] = STATE_TRANSVR_CONNECTED; + return 0; +} +int +common_fsm_4_direct_mode(struct transvr_obj_s* self, + char *caller_name){ + + int err; + int detect_result[2]; + int current_state = STATE_TRANSVR_UNEXCEPTED; + int current_type = TRANSVR_TYPE_ERROR; + + if (self->state == STATE_TRANSVR_NEW) { + if (_transvr_init_handler(self) < 0){ + return ERR_TRANSVR_INIT_FAIL; + } + } + err = detect_transvr_state(self, detect_result); + if (err < 0) { + return err; + } + /* In Direct mode, driver only detect transceiver when user call driver interface + * which on sysfs. So it only need consider the state of Transceiver. + */ + current_state = detect_result[0]; + current_type = detect_result[1]; + + switch (current_state){ + + case STATE_TRANSVR_DISCONNECTED: /* Transceiver is not plugged */ + self->state = current_state; + self->type = current_type; + return ERR_TRANSVR_UNPLUGGED; + + case STATE_TRANSVR_INIT: /* Transceiver is plugged, system not ready */ + return ERR_TRANSVR_UNINIT; + + case STATE_TRANSVR_ISOLATED: /* Transceiver is plugged, but has some issues */ + return ERR_TRNASVR_BE_ISOLATED; + + case STATE_TRANSVR_CONNECTED: /* Transceiver is plugged, system is ready */ + self->state = current_state; + self->type = current_type; + return 0; + + case STATE_TRANSVR_SWAPPED: /* Transceiver is plugged, system detect user changed */ + self->type = current_type; + if (reload_transvr_obj(self, current_type) < 0){ + self->state = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_UNEXCPT; + } + self->state = current_state; + return 0; + + case STATE_TRANSVR_UNEXCEPTED: /* Transceiver type or state is unexpected case */ + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = TRANSVR_TYPE_ERROR; + return ERR_TRANSVR_UNEXCPT; + + default: + SWPS_INFO("%s: state:%d not in define.\n", __func__, current_state); + break; + } + return ERR_TRANSVR_UNEXCPT; +} + +int +fake_fsm_4_direct_mode(struct transvr_obj_s* self, + char *caller_name){ + self->state = STATE_TRANSVR_CONNECTED; + self->type = TRANSVR_TYPE_FAKE; + return 0; +} + +/* ========== Object Initial handler ========== + */ +static int +_is_transvr_valid(struct transvr_obj_s *self, + int type, + int state) { + /* [Return] + * 0 : OK, inserted + * EVENT_TRANSVR_INIT_DOWN : OK, removed + * EVENT_TRANSVR_INIT_FAIL : Outside error, type doesn't supported + * EVENT_TRANSVR_EXCEP_INIT : Internal error, state undefined + */ + switch (type) { + case TRANSVR_TYPE_SFP: + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + case TRANSVR_TYPE_UNPLUGGED: + case TRANSVR_TYPE_FAKE: + break; + default: + SWPS_INFO("detect undefined type:0x%02x on %s\n", + type, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; + } + switch (state) { + case STATE_TRANSVR_DISCONNECTED: + return EVENT_TRANSVR_INIT_DOWN; + case STATE_TRANSVR_INIT: + case STATE_TRANSVR_CONNECTED: + case STATE_TRANSVR_SWAPPED: + break; + default: + SWPS_INFO("detect undefined state:%d on %s\n", + state, self->swp_name); + return EVENT_TRANSVR_EXCEP_INIT; + } + return 0; +} + + +static int +_is_transvr_hw_ready(struct transvr_obj_s *self, + int type){ + /* [Return] + * EVENT_TRANSVR_TASK_DONE : Ready + * EVENT_TRANSVR_TASK_WAIT : Not ready + * EVENT_TRANSVR_INIT_FAIL : Error + */ + int addr = DEBUG_TRANSVR_INT_VAL; + int page = DEBUG_TRANSVR_INT_VAL; + int offs = DEBUG_TRANSVR_INT_VAL; + int bit = DEBUG_TRANSVR_INT_VAL; + int ready = DEBUG_TRANSVR_INT_VAL; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t ab_val = DEBUG_TRANSVR_HEX_VAL; + + switch (type) { + case TRANSVR_TYPE_SFP: + addr = VAL_TRANSVR_8472_READY_ADDR; + page = VAL_TRANSVR_8472_READY_PAGE; + offs = VAL_TRANSVR_8472_READY_OFFSET; + bit = VAL_TRANSVR_8472_READY_BIT; + ready = VAL_TRANSVR_8472_READY_VALUE; + ab_val = VAL_TRANSVR_8472_READY_ABNORMAL; + break; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + addr = VAL_TRANSVR_8436_READY_ADDR; + page = VAL_TRANSVR_8436_READY_PAGE; + offs = VAL_TRANSVR_8436_READY_OFFSET; + bit = VAL_TRANSVR_8436_READY_BIT; + ready = VAL_TRANSVR_8436_READY_VALUE; + ab_val = VAL_TRANSVR_8436_READY_ABNORMAL; + break; + + case TRANSVR_TYPE_UNPLUGGED: + case TRANSVR_TYPE_FAKE: + return EVENT_TRANSVR_TASK_DONE; + + default: + emsg = "unexpected case"; + goto err_is_transvr_hw_ready; + } + /* Select target page */ + err = _common_setup_page(self, addr, page, offs, 1, 0); + if (err < 0) { + emsg = "setup page fail"; + goto err_is_transvr_hw_ready; + } + /* Check feature supported + * [Note] + * Some of transceiver/cables doesn't support "Status Indicators" + * (ex:DAC, RJ45 copper SFP ...etc). In these case, we bypass the + * step of checking Status Indicators, then state machine will take + * the following handle procedure. + */ + err = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + if (err < 0) { + emsg = "doesn't support Status Indicators"; + goto bypass_is_transvr_hw_ready; + } + /* Filter abnormal case */ + if (err == ab_val) { + emsg = "detect using unusual definition."; + goto bypass_is_transvr_hw_ready; + } + /* Get Status Indicators */ + err = i2c_smbus_read_byte_data(self->i2c_client_p, offs); + if (err < 0) { + emsg = "detect current value fail"; + goto err_is_transvr_hw_ready; + } + if ((err & (1<:%d\n", __func__, emsg, type); + return EVENT_TRANSVR_TASK_DONE; + +err_is_transvr_hw_ready: + SWPS_DEBUG("%s: %s :%d\n", __func__, emsg, type); + return EVENT_TRANSVR_INIT_FAIL; +} + +static int +_transvr_init_handler(struct transvr_obj_s *self){ + + int detect[2]; + int d_state = STATE_TRANSVR_UNEXCEPTED; + int d_type = TRANSVR_TYPE_ERROR; + int result = ERR_TRANSVR_UNINIT; + int retry = 6; /* (6+1) x 0.3 = 2.1s > spec:2.0s */ + int elimit = 63; + char emsg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Clean and check callback */ + self->state = STATE_TRANSVR_INIT; + if (self->init == NULL) { + snprintf(emsg, elimit, "init() is null"); + goto initer_err_case_unexcept_0; + } + /* Detect transceiver information */ + result = detect_transvr_state(self, detect); + if (result < 0) { + snprintf(emsg, elimit, "detect_transvr_state() fail"); + switch (result) { + case ERR_TRANSVR_I2C_CRASH: + goto initer_err_case_i2c_ceash; + case ERR_TRNASVR_BE_ISOLATED: + goto initer_err_case_be_isolated; + + case ERR_TRANSVR_UNEXCPT: + default: + break; + } + goto initer_err_case_retry_1; + } + d_state = detect[0]; + d_type = detect[1]; + + /* Verify transceiver type and state */ + switch (_is_transvr_valid(self, d_type, d_state)) { + case 0: + break; + case EVENT_TRANSVR_INIT_DOWN: + goto initer_ok_case_down;; + case EVENT_TRANSVR_INIT_FAIL: + snprintf(emsg, elimit, "transceiver type doesn't support"); + goto initer_err_case_alarm_to_user; + case EVENT_TRANSVR_EXCEP_INIT: + default: + goto initer_err_case_unexcept_0; + } + + /* Handle reload case */ + if (self->type != d_type){ + /* This is the protect mechanism. Normally, This case will not happen. + * When State machine detect swap event during initial, It will trigger + * reload function to ensure type correct. */ + if (_reload_transvr_obj(self, d_type) < 0){ + snprintf(emsg, elimit, "reload object fail"); + goto initer_err_case_unexcept_0; + } + } + + /* Check transceiver HW initial ready */ + switch (_is_transvr_hw_ready(self, d_type)) { + case EVENT_TRANSVR_TASK_DONE: + break; + case EVENT_TRANSVR_TASK_WAIT: + goto initer_err_case_retry_1; + case EVENT_TRANSVR_INIT_FAIL: + default: + goto initer_err_case_unexcept_0; + } + + /* Try to update all and check */ + if (self->update_all(self, 1) < 0){ + /* For some transceiver, EEPROME has lag issues during initial stage. + * In this case, we set status back to STATE_TRANSVR_NEW, than it will + * be checked in next polling cycle. */ + goto initer_err_case_retry_1; + } + + /* Execute init() call back */ + result = self->init(self); + switch (result) { + case EVENT_TRANSVR_TASK_DONE: + break; + case EVENT_TRANSVR_TASK_WAIT: + goto initer_ok_case_wait; + + default: + snprintf(emsg, elimit, "undefined init() return:%d\n", result); + goto initer_err_case_unexcept_0; + } + goto initer_ok_case_up; + + +initer_ok_case_wait: + return EVENT_TRANSVR_TASK_WAIT; + +initer_ok_case_up: + self->state = STATE_TRANSVR_CONNECTED; + self->temp = 0; + return EVENT_TRANSVR_INIT_UP; + +initer_ok_case_down: + self->temp = 0; + self->state = STATE_TRANSVR_DISCONNECTED; + return EVENT_TRANSVR_INIT_DOWN; + +initer_err_case_i2c_ceash: + SWPS_DEBUG("%s: %s :%s :I2C crash\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + return EVENT_TRANSVR_I2C_CRASH; + +initer_err_case_be_isolated: + SWPS_DEBUG("%s: %s :%s :isolated\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_ISOLATED; + return EVENT_TRANSVR_EXCEP_ISOLATED; + +initer_err_case_retry_1: + SWPS_DEBUG("%s: %s :%s :retry\n", + __func__, emsg, self->swp_name); + if (_transvr_handle_retry(self, retry) == 0) { + self->state = STATE_TRANSVR_NEW; + return EVENT_TRANSVR_INIT_REINIT; + } + goto initer_err_case_alarm_to_user; + +initer_err_case_unexcept_0: + self->state = STATE_TRANSVR_UNEXCEPTED; + return EVENT_TRANSVR_INIT_FAIL; + +initer_err_case_alarm_to_user: + SWPS_DEBUG("%s: %s :%s :alarm_to_user\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + alarm_msg_2_user(self, "detected transceiver/cables not meet SFF standard"); + return EVENT_TRANSVR_INIT_FAIL; +} + +static int +setup_transvr_private_cb(struct transvr_obj_s *self, + int transvr_type){ + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + self->fsm_4_direct = common_fsm_4_direct_mode; + return 0; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + self->fsm_4_direct = common_fsm_4_direct_mode; + return 0; + + case TRANSVR_TYPE_QSFP_28: + self->fsm_4_direct = common_fsm_4_direct_mode; + return 0; + + case TRANSVR_TYPE_FAKE: + self->fsm_4_direct = fake_fsm_4_direct_mode; + return 0; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return ERR_TRANSVR_UNEXCPT; +} + + +static struct eeprom_map_s * +get_eeprom_map(int transvr_type){ + + switch (transvr_type){ + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + return &eeprom_map_qsfp; + case TRANSVR_TYPE_QSFP_28: + return &eeprom_map_qsfp28; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return NULL; +} + + +static int +setup_transvr_ssize_attr(char *swp_name, + struct transvr_obj_s *self, + struct eeprom_map_s *map_p, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int chan_id, + int run_mode){ + switch (run_mode){ + case TRANSVR_MODE_DIRECT: /* Direct access device mode */ + self->mode = run_mode; + break; + default: + SWPS_ERR("%s: non-defined run_mode:%d\n", + __func__, run_mode); + self->mode = DEBUG_TRANSVR_INT_VAL; + return -1; + } + self->eeprom_map_p = map_p; + self->ioexp_obj_p = ioexp_obj_p; + self->ioexp_virt_offset = ioexp_virt_offset; + self->chan_id = chan_id; + self->layout = transvr_type; + self->type = transvr_type; + self->chipset_type = chipset_type; + self->state = STATE_TRANSVR_NEW; + self->info = STATE_TRANSVR_NEW; + self->auto_tx_disable = VAL_TRANSVR_FUNCTION_DISABLE; + strncpy(self->swp_name, swp_name, 32); + mutex_init(&self->lock); + return 0; +} + + + +static int +setup_i2c_client(struct transvr_obj_s *self){ + + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + adap = i2c_get_adapter(self->chan_id); + if(!adap){ + snprintf(err_msg, sizeof(err_msg), + "can not get adap:%d", self->chan_id); + goto err_setup_i2c_client; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + snprintf(err_msg, sizeof(err_msg), + "can not kzalloc client:%d", self->chan_id); + goto err_setup_i2c_client; + } + client->adapter = adap; + self->i2c_client_p = client; + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + return 0; + +err_setup_i2c_client: + SWPS_ERR("%s: %s\n", __func__, err_msg); + return ERR_TRANSVR_UNEXCPT; +} + + +struct transvr_obj_s * +create_transvr_obj(char *swp_name, + int chan_id, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int run_mode){ + + struct transvr_obj_s *result_p; + struct eeprom_map_s *map_p; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Allocate transceiver object */ + map_p = get_eeprom_map(transvr_type); + if (!map_p){ + snprintf(err_msg, sizeof(err_msg), + "Invalid transvr_type:%d", transvr_type); + goto err_create_transvr_fail; + } + result_p = kzalloc(sizeof(*result_p), GFP_KERNEL); + if (!result_p){ + snprintf(err_msg, sizeof(err_msg), "kzalloc fail"); + goto err_create_transvr_fail; + } + /* Prepare static size attributes */ + if (setup_transvr_ssize_attr(swp_name, + result_p, + map_p, + ioexp_obj_p, + ioexp_virt_offset, + transvr_type, + chipset_type, + chan_id, + run_mode) < 0){ + goto err_create_transvr_sattr_fail; + } + + /* Prepare call back functions of object */ + if (setup_transvr_private_cb(result_p, transvr_type) < 0){ + goto err_create_transvr_sattr_fail; + } + /* Prepare i2c client object */ + if (setup_i2c_client(result_p) < 0){ + goto err_create_transvr_sattr_fail; + } + return result_p; +err_create_transvr_sattr_fail: + kfree(result_p); +err_create_transvr_fail: + SWPS_ERR("%s: %s :%d :%d :%d\n", + __func__, err_msg, chan_id, ioexp_virt_offset, transvr_type); + return NULL; +} + + +static int +_reload_transvr_obj(struct transvr_obj_s *self, + int new_type){ + + struct eeprom_map_s *new_map_p; + struct eeprom_map_s *old_map_p = self->eeprom_map_p; + struct i2c_client *old_i2c_p = self->i2c_client_p; + int old_type = self->type; + + /* Change state to STATE_TRANSVR_INIT */ + self->state = STATE_TRANSVR_INIT; + self->type = new_type; + /* Replace EEPROME map */ + new_map_p = get_eeprom_map(new_type); + if (!new_map_p){ + goto err_private_reload_func_1; + } + self->eeprom_map_p = new_map_p; + /* Reload i2c client */ + if (setup_i2c_client(self) < 0){ + goto err_private_reload_func_2; + } + if (setup_transvr_private_cb(self, new_type) < 0){ + goto err_private_reload_func_3; + } + kfree(old_i2c_p); + return 0; + +err_private_reload_func_3: + SWPS_INFO("%s: init() fail!\n", __func__); + kfree(old_i2c_p); + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = TRANSVR_TYPE_ERROR; + return -2; + +err_private_reload_func_2: + self->eeprom_map_p = old_map_p; + self->i2c_client_p = old_i2c_p; +err_private_reload_func_1: + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = old_type; + SWPS_INFO("%s fail! :0x%02x\n", __func__, new_type); + return -1; +} + + +static int +reload_transvr_obj(struct transvr_obj_s *self, + int new_type){ + + int result_val = ERR_TRANSVR_UNEXCPT; + + /* Reload phase */ + result_val = _reload_transvr_obj(self, new_type); + if (result_val < 0){ + SWPS_INFO("%s: reload phase fail! :%d\n", + __func__, result_val); + return EVENT_TRANSVR_RELOAD_FAIL; + } + /* Initial phase */ + result_val = _transvr_init_handler(self); + if (result_val < 0){ + SWPS_INFO("%s: initial phase fail! :%d\n", + __func__, result_val); + } + return result_val; +} + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/transceiver.h b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/transceiver.h new file mode 100644 index 000000000000..487fcdd76773 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/transceiver.h @@ -0,0 +1,167 @@ +#ifndef TRANSCEIVER_H +#define TRANSCEIVER_H + +#include + +/* Transceiver type define */ +#define TRANSVR_TYPE_UNKNOW_1 (0x00) +#define TRANSVR_TYPE_UNKNOW_2 (0xff) +#define TRANSVR_TYPE_SFP (0x03) /* Define for SFP, SFP+, SFP28 */ +#define TRANSVR_TYPE_QSFP (0x0c) +#define TRANSVR_TYPE_QSFP_PLUS (0x0d) +#define TRANSVR_TYPE_QSFP_28 (0x11) +#define TRANSVR_TYPE_UNPLUGGED (0xfa) /* Define for ERROR handle */ +#define TRANSVR_TYPE_FAKE (0xfc) /* Define for ERROR handle */ +#define TRANSVR_TYPE_INCONSISTENT (0xfd) /* Define for ERROR handle */ +#define TRANSVR_TYPE_ERROR (0xfe) /* Define for ERROR handle */ + +/* Transceiver mode define */ +#define TRANSVR_MODE_DIRECT (21000) + +/* Transceiver state define + * [Note] + * 1. State is used to represent the state of "Transceiver" and "Object". + * 2. State for different target has different means. The description as following: + */ +#define STATE_TRANSVR_CONNECTED (0) /* [Transvr]:Be plugged in. [Obj]:Link up, and work normally. */ +#define STATE_TRANSVR_NEW (-100) /* [Transvr]:(Not used) [Obj]:Create */ +#define STATE_TRANSVR_INIT (-101) /* [Transvr]:Be plugged in. [Obj]:Link up, and in initial process. */ +#define STATE_TRANSVR_ISOLATED (-102) /* [Transvr]:Be plugged in. [Obj]:Isolate, and not provide service. */ +#define STATE_TRANSVR_SWAPPED (-200) /* [Transvr]:Be plugged in. [Obj]:(Not used) */ +#define STATE_TRANSVR_DISCONNECTED (-300) /* [Transvr]:Un-plugged. [Obj]:Link down, and not provide service. */ +#define STATE_TRANSVR_UNEXCEPTED (-901) /* [Transvr]:Any [Obj]:Any, and not in expect case. */ + +/* Event for task handling */ +#define EVENT_TRANSVR_TASK_WAIT (2101) +#define EVENT_TRANSVR_TASK_DONE (0) +#define EVENT_TRANSVR_TASK_FAIL (-2101) +/* Event for initial handling */ +#define EVENT_TRANSVR_INIT_UP (2201) +#define EVENT_TRANSVR_INIT_DOWN (1) +#define EVENT_TRANSVR_INIT_REINIT (-2201) +#define EVENT_TRANSVR_INIT_FAIL (-2202) +/* Event for others */ +#define EVENT_TRANSVR_RELOAD_FAIL (-2301) +#define EVENT_TRANSVR_EXCEP_INIT (-2401) +#define EVENT_TRANSVR_EXCEP_UP (-2402) +#define EVENT_TRANSVR_EXCEP_DOWN (-2403) +#define EVENT_TRANSVR_EXCEP_SWAP (-2404) +#define EVENT_TRANSVR_EXCEP_EXCEP (-2405) +#define EVENT_TRANSVR_EXCEP_ISOLATED (-2406) +#define EVENT_TRANSVR_I2C_CRASH (-2501) + +/* Transceiver error code define */ +#define ERR_TRANSVR_UNINIT (-201) +#define ERR_TRANSVR_UNPLUGGED (-202) +#define ERR_TRANSVR_ABNORMAL (-203) +#define ERR_TRANSVR_NOSTATE (-204) +#define ERR_TRANSVR_NOTSUPPORT (-205) +#define ERR_TRANSVR_BADINPUT (-206) +#define ERR_TRANSVR_UPDATE_FAIL (-207) +#define ERR_TRANSVR_RELOAD_FAIL (-208) +#define ERR_TRANSVR_INIT_FAIL (-209) +#define ERR_TRANSVR_UNDEFINED (-210) +#define ERR_TRANSVR_TASK_FAIL (-211) +#define ERR_TRANSVR_TASK_BUSY (-212) +#define ERR_TRANSVR_FUNC_DISABLE (-214) +#define ERR_TRANSVR_I2C_CRASH (-297) +#define ERR_TRNASVR_BE_ISOLATED (-298) +#define ERR_TRANSVR_UNEXCPT (-299) + +/* For debug */ +#define DEBUG_TRANSVR_INT_VAL (-99) +#define DEBUG_TRANSVR_HEX_VAL (0xfe) +#define DEBUG_TRANSVR_STR_VAL "ERROR" + +/* For system internal */ +#define VAL_TRANSVR_COMID_ARREESS (0x50) +#define VAL_TRANSVR_COMID_OFFSET (0x00) +#define VAL_TRANSVR_8472_READY_ADDR (0x51) +#define VAL_TRANSVR_8472_READY_PAGE (-1) +#define VAL_TRANSVR_8472_READY_OFFSET (110) +#define VAL_TRANSVR_8472_READY_BIT (0) +#define VAL_TRANSVR_8472_READY_VALUE (0) +#define VAL_TRANSVR_8472_READY_ABNORMAL (0xff) +#define VAL_TRANSVR_8436_READY_ADDR (0x50) +#define VAL_TRANSVR_8436_READY_PAGE (-1) +#define VAL_TRANSVR_8436_READY_OFFSET (2) +#define VAL_TRANSVR_8436_READY_BIT (0) +#define VAL_TRANSVR_8436_READY_VALUE (0) +#define VAL_TRANSVR_8436_READY_ABNORMAL (0xff) +#define VAL_TRANSVR_8436_PWD_ADDR (0x50) +#define VAL_TRANSVR_8436_PWD_PAGE (-1) +#define VAL_TRANSVR_8436_PWD_OFFSET (123) +#define VAL_TRANSVR_PAGE_FREE (-99) +#define VAL_TRANSVR_PAGE_SELECT_OFFSET (127) +#define VAL_TRANSVR_PAGE_SELECT_DELAY (5) +#define VAL_TRANSVR_TASK_RETRY_FOREVER (-999) +#define VAL_TRANSVR_FUNCTION_DISABLE (-1) +#define STR_TRANSVR_QSFP "QSFP" +#define STR_TRANSVR_QSFP_PLUS "QSFP+" +#define STR_TRANSVR_QSFP28 "QSFP28" + +/* BCM chip type define */ +#define BCM_CHIP_TYPE_TOMAHAWK (31002) /* Redwood, Cypress */ + +/* Info from transceiver EEPROM */ +struct eeprom_map_s { + int addr_rx_los; int page_rx_los; int offset_rx_los; int length_rx_los; + int addr_tx_disable; int page_tx_disable; int offset_tx_disable; int length_tx_disable; + int addr_tx_fault; int page_tx_fault; int offset_tx_fault; int length_tx_fault; +}; + +/* Class of transceiver object */ +struct transvr_obj_s { + /* ========== Object private property ========== + */ + struct device *transvr_dev_p; + struct eeprom_map_s *eeprom_map_p; + struct i2c_client *i2c_client_p; + struct ioexp_obj_s *ioexp_obj_p; + struct mutex lock; + char swp_name[32]; + int auto_tx_disable; + int chan_id; + int chipset_type; + int curr_page; + int info; + int ioexp_virt_offset; + int lane_id[8]; + int layout; + int mode; + int retry; + int state; + int temp; + int type; + + /* ========== Object private functions ========== + */ + int (*init)(struct transvr_obj_s *self); + int (*update_all)(struct transvr_obj_s *self, int show_err); + int (*fsm_4_direct)(struct transvr_obj_s* self, char *caller_name); +}; + + +/* For AVL Mapping */ +struct transvr_avl_s { + char vendor_name[32]; + char vendor_pn[32]; + int (*init)(struct transvr_obj_s *self); +}; + +struct transvr_obj_s * +create_transvr_obj(char *swp_name, + int chan_id, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int run_mode); + +void alarm_msg_2_user(struct transvr_obj_s *self, char *emsg); + +#endif /* TRANSCEIVER_H */ + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/inventec_d7032_util.py b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/inventec_d7032_util.py new file mode 100755 index 000000000000..f6f5e46c5536 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/inventec_d7032_util.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Inventec, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +DEBUG = False +args = [] +FORCE = 0 +i2c_prefix = '/sys/bus/i2c/devices/' + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + install() + elif arg == 'clean': + uninstall() + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print "[D7032]"+txt + return + +def exec_cmd(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + show_log (cmd +"with result:" + str(status)) + show_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +instantiate =[ +#'echo pca9545 0x70> /sys/bus/i2c/devices/i2c-0/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-1/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-2/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-3/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-4/new_device', +#'echo inv_psoc 0x66> /sys/bus/i2c/devices/i2c-5/new_device', +#'echo inv_cpld 0x55> /sys/bus/i2c/devices/i2c-5/new_device', +'echo inv_eeprom 0x53> /sys/bus/i2c/devices/i2c-0/new_device'] + +drivers =[ +'lpc_ich', +'i2c-i801', +'i2c-mux', +'i2c-mux-pca954x', +'i2c-dev', +'inv_eeprom', +'inv_platform', +'inv_psoc', +'inv_cpld', +'swps'] + + + +def system_install(): + global FORCE + + #remove default drivers to avoid modprobe order conflicts + status, output = exec_cmd("rmmod i2c_ismt ", 1) + status, output = exec_cmd("rmmod i2c-i801 ", 1) + #install drivers + for i in range(0,len(drivers)): + status, output = exec_cmd("modprobe "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + + #instantiate devices + for i in range(0,len(instantiate)): + time.sleep(1) + status, output = exec_cmd(instantiate[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(22,30): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-4/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(30,38): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-5/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(6,14): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-2/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(14,22): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-3/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + + +def system_ready(): + if not device_found(): + return False + return True + +def install(): + if not device_found(): + print "No device, installing...." + status = system_install() + if status: + if FORCE == 0: + return status + else: + print " D7032 devices detected...." + return + +def uninstall(): + global FORCE + #uninstall drivers + for i in range(len(drivers)-1,-1,-1): + status, output = exec_cmd("rmmod "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_found(): + ret1, log = exec_cmd("ls "+i2c_prefix+"*0072", 0) + ret2, log = exec_cmd("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/onie-syseeprom b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/onie-syseeprom deleted file mode 100755 index b8e3ba26a5d24bc70f970c24364a61cbfa0abf10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 921685 zcmdqKd3==B_4q%N1%}NhDrl@*)F6o>5Je>lnt_QtBNN2}E)^6DQmpt9Wd=|L24@EH z_;fT@skBvV7q{A0TT4KcWD+0&RAg~MQCSpu9)=}~hJeES-se6ulR%g6=llKh$4m3v z_1tsMIrrRi&s}D2W#F0|w>#IB{+Hvr%H<~fx05SWiu2dy^3-)#arsl>8szH4-?Lq3 zsIvLl94FU_R;bVI3!QqIugg`W(xr_~{QugsPX24pPEqNZ@3u2l)U|Yk^Uc)DBP##b z2mtl1IOgk9F_$azm9p}$GyhBYKebmxp8UJn`M3(w-y3!YCkmeb+kcsQKc?P)Yj0#4 z|I9ZXRX7R^i4VVSjA}NAzk)*{{|n5X{4WfXe9zh$i+0bb`p4m0&gmAaoSZjz&yq{Y za*cn^p=WQ2$iK(D>T~mP=_4oVDt+Yf>5n_*_2bgV?{U&Aj!UoE>ZA`kF5R`kNgr^0 z`ln8M$#Lo9cRJ}s$EAl~chU=wORq>e>3U?3M>q4&e5S8Uk0pZn)_F(jQ+i~jXNBrs z_D`z!xfGc!aa;bRdjIIS_({jbyB-(MIWB(q>0{x2b6kA)aq%6;#XmVFKF0XQI1<^B zTR-$|ziU+47Jc5HMS|wqWdRbjCs*iN<>9i8WeGig#xuEYm&+Peo9imKLKo=94x_1_ z6qmJYajq+t2%T#BiVJ(YT3oInt|FH!)LAbdTU-*%{Wf_-pSM!L-a2kY>OJkzw+L25 zTeaxx1iYi`D)@{sJ{U#gB6zy7%ldL(t}D`(W312~jgY%chG*TDO@5cL-+CMj;?q)k z{GnoxvD-Rre{MSekduEO`DLy3r@rrZl_jh{f}Gb_smK3W>_W1aiAeisAxXMEVY43F zGUrE`Ox^ed_+`}BC#=`YKMAh!PxxV}$i9|O7X-Om$9c!D82N_l)N5VKl7dvtDc8E{ z*Yn33SqAQAkL}5>u7H`pn@?rg#z#6u6TwS$t!{m5-VL76NrP_>p5Tk??|Z|Ca;E1E zz9Q7!Yv$GHspjh8spO9a_Ya-oO*MKWhjT-nea6Pp!^v(%Xx_>J%N$eL8ZcuzNWdT;XH z=pEx7Jqmd*)arip&EEpXX8quXK>UtWd_*dIXtuWC&rl%{e~>1>@f)py(oX`$=K-T? zwH_aOmLA#GqL;1=#HSQ%{>aXj0Ob96n;ZI6t%kG#%DdkSlv~rs>#5a`6r|n`#IH$J z-HPWtM$~n%4*Lw@$TnW#@5WWy;|Mb(JeFc!{5&housN#hAQ6b zf*CEz!swP@zCYER%%|M#bfqczTis|$<^~Mp_|DC@ddGUld2jRHK5oSr)k(jRsxNkr zaCvX^8y`CTH4f0_$<|-?cXHMDqlbQDm2NayeOo%Y0>-}jz9b=4))~aBVta#k=xiU;4m-X>0om_gPEoH_fIpmqtTv^l4mCSGQ<=42<)m}5!Wy`;u zF0V?y*4HWdnk!KHJ>vPM3^;w>VVN+dpQ#%k>Bd3?RV&<`vr4zZFXNj)JXGU18uiG! z6he|(TUEY8d-zurg~nau53H{Ur@G9zN^fp{33MWMXMMt&iMn|;{{_sk?^Wo=*8yYe zH-A&Y<4pxh8{wEAvIJir{z&)SYpT2FB=-s>yH`}d7uj_LaD9WG>T6SaYHhM6e5hZQ z(E^Mrt+F{_G%GlIYK>mHR{ll~rL^c|+Vws%*i%tGxNFjmZqbePq0{L^nnKowiS*P| zyb(!g`@fWgKkPkL63*RstR$R7{Qn>c@4ftgCkekxm;b+&gc;lZUnHSy-2X`u&i?HG zACl1g)Bh?7s8H`42-93MM~^h-p;XO_&DT4H((KB z>yKN6_D2Kd+oq4vBUYZz^eAolgU`6`htLp7ALKKpw=o*W0rZ--jC$-TrOg6Ae<|cO z3TEufD9BYxL5@=j@`eAZAY~Tt8{c_H`;8xzrmQO6Im*#RObog)X0`S3?(Fzz5>1(t zl=0E3G^J6w()xyc|GXojxQxogbd9M1rS;BdVmf5Bl|Md)DPspy#`^(gceK^6mSj(v zG@krPS~#1v=wnJh?G6}U1&oyS$S33&4SI7z6pwC>S&iBmphtG+=@B~*a? zT^ZNcdxeW9>t-i!B#~P+Au-hSB`S=ZnBCjkNXC zDk~EPvamZZ`AT$4s29!ZM&)X2?s$=-%GIJywjHNVw6nvYNp}7n8yy?*#QGUGj&Qwk zf}|Qv2VMxdSLjBweFZ=!_0!IdN^zI>rZC{u(z@-6^Q$ay9bQz%X(57w))`7 zYkw9S4b5v~S4FHqq^-}4&Z**6i8qwtwSfj|tXof`H<4y{ayg`U_G3t4U?on<^j8;~ zF+9i>+@i-v7Z>R9U~!Qcc7@i(COw;AMUK#bp9bn(%cr=kv8T91UScnUnQlI`rwH4$ z)tWzFsIbatSSlS&p3+WFJ(4KUhZMZ!cLh(?Y75HOhW6^_&7St;kX@nGe&+x`TXVSv zyS3;XsG^&KPHbcFd}e#q^gMF01gDKf{$O5a`)5_jnTm3m}_#~OGWqEwy??bpqJDrQd9FBzz~>oc}#u^b410V?bl z1JtozRyZyBRZF4YsF*^-YC08M<{y>eFyw;G&^-QR@oV5vH}@|i#3pWy11^(xSBIX& zKhI4Q`T(mwA#{ZdDr{$|u3D%p`_ekU8}R$8;WlLLNB;`{R~_L$*a7}Uz&{3>^;TIx^1;t?xu66Np3m0m9bRld~am0TYKzOFm-sa z>SU)ECsDvjdBWqu{QokxSBvIm6W2LH5ldz(PNA5+LwcNHNBmz9Yx|U@>nLNbV`6WY zZ5ij@(Pq95ImW~iqk<<#+T6j@SvG0WUa(6oRjg~j%XOLg#gs{IGcPUTTQBP`>!jJF zUs@pXM&cNNR_Y_8>9c$e+MRwCaX7BGV-eQa)NLGG|!2anXTi`?@N^JEan_dpn&x~G^isSMpGIs+8^{- z%4nL?X9y0R@QmR~UrO@49h50Bnu1;F86Asl2@TcVN9G-ss@nXsz;h{72y1@`?{o(T zHs?R}eqR@fDLa=xb#Of_U>fZ1Y8GWdwq4uw1-60yYh5sHPX0Z%Q8PY7bdrq?)(J+_ zysuI$M1y58pzE9qVZc&Gjw^Wr6g_j^Az9i62d9ai0Ke@ms4EZ)ZS}=(bK4OBnU|jX z0o;~uTRms7Dqcz@>9lcF^wq%+&-pyLs%)>{*l-&weVt{)$kG1h zM9shom)_jqQlI9c9u+R@4K)0>8GXL=skf%M#^@K-@L|z&0?VrzIpbC=r6J`g`F32r zWTm#H>xYNmas5y*EdZhEa|ZVg&KZ2Z7W)IK3Zdjbpkoup zUHsJ)X}WPFS)QHGC{dMDmZ&ney-`M69b2J&J+jJe*&pV*0_Et%VRTEY9pyHx(#_?K zb60lkNJgFppL2g-DWk`yhtkd8Rz+#bEY|gV|@v%hP=LU*L5^ z2Cr9SH2izKY9MK6V8I}8EI1coTM9v-$1#!>hBir8y_Bcp+bAAN&96(S)yXl zx=^R^gC2LVs|-cQ-qn^|+htNigGXEP^}M6sp=9TNp)Fa11=uw|eD%@LhvB*IywG|m z)3viWxnynSHX0f%&&Ah5k~Np)#fw(ZQ295Zom%ZpIl`HP>l?NgH0&tsvX)rB`kU9V z-P2`l`Fici#0s$eulS~M>?Al=xU?lh!7l-RtLGh3`0XN?!7o^($M5T;JDAUSSCYF$ z5}l;NBx7iorp`y3hP(6HVI=5Cj?h8-99(ZSRu9i_*j-qCQ;y891=Tm@%GXnU zQy$2LAv20@uEF4f{P8Ujuy-mkf?M^!YHf(`Y-meua08Vvn=1c9mAa5yUs4CidjVNLQbKnUI;Lq~ zd~!E$~ZhkzB-QJWLF=Dv~ADLd5yv?DtXjD4sGp^TJxGeZV##5y` zJ~lVUTmIQxJeIqxp$xKRPgah=#$WnNKDy>xFLbDz28xc(OxyeR&o`D^rUyRqIYHrNDqt854;fURlf{uFa(v7Xw zbD+%vq?xr_E#tq=%hV&7FMU?l(8j8n7ivpJb|bkAwF48Y|M4=u%|K1vg2LNUS)|ou@ppC(cUO)xYOVYt@<&N#S)hm zt?;{o$IL0<=RybQ#y*gqrOM8^N%dUOf^=lq33-Sqf~Ztz4DF z(h+!QCrY5ya@6OrF4pZ(aak6D^&n8=IHEp)buw|{q@TB^h!V%lnuR2kB_c;l=Z=aT z?W4tCMR+4eF=#F)Lwoco745A>rEig=m^RBWtVN2&(RAf>wy(r`&=x$w3a6Th+@Yga zSzyVbk)!>!#{$%d9KBGBi}{zS>QYsyYcy&Lrczl{wXgU@?^`l@s#$e<)i~0YR3Y;+ z=dJO_ecf|(rAM^|nu#)uYeB3CFAvC{KPWfy!W9wuabCIv{n z?zZ&!%p70!RCjfum3yvGwGyiCms;1vg9CDuyiW2Np)OY5A!mWY#Q$`$5R8fc4CQao zVpoAWlfTe4EAz}VTC}HR7#~@Eo^rFnhIxPD8#j&_Ge(R37IGLZ2W_LJq3!I_#(3V3 zjc-aDMKfROiX3J+dMU^ojgcK&BfGuf!};3$(EyK+TpvE%MVqe^*6LOp-zeQ#H@QK% zk8;*wCgNz>T%TQvTl>&37^}J%0)o)5X;%>X)vxfLMA}Z4T?~jHD<+-gW|gZlx+Yj& z*};DCM%oIr1-OgY18hhYzZ-63mlHk02)iOw;m4F3uGI$erDAB4->h_b>sZ>;2y#Hw zqr6vMv$BAMBKu-Q-x+VzFA63EU%dmqS2_4D5`!|m9ta=mA6%6DFk}DVu5G}<9BJz^ z{oy1sdye*tzK}y)U!_gjBlNSBqM`m}3W0@^j(>^~tb zGXLw5qbF*yDKr|0PZZJEUxkQtN?wTm6JhZz!w2iKZkR?pCKJB5Ip$MBU0b>ewc65R?uhmsTwEbvB;cGNeX?ztrEjcSq|3LhDcfbfxx^6gu z_XZaQ_YCe5vzs8zPnI{*H(QkZeAqS#PT3tC-gp^bmu z527wY3mK@f2I=}+68F~0U%P-gyK2Ihwuf*1A|b?Yq9mUO-bQ1H#+HOkj|K>d#Qt1zDSlW)D^p$@R)az29$vTHsB~Dbg^%yc&JuKxb-y32Y-euLZd|~b?@fj@{MdrPIMg7IJ z2YbY}=mB=gPqiiAC6_wm*zEO_=Ws42aQx;SV7~K?E^A#TbGP>`v6hv=U|mjCF}SqY zUUJe#4SU|Zuxm~bn?Z~Ii45s4=K=oya9`K5!Nk=BQa=cdV=WE~;#;kEzflT4y7OP) zoUbgwqT?+=?a@yt+F`x5bo7+z{{NYDud8X8hm9oqor}6Nm_5%qkV-Y@pE?VN2LEm~ ztmb_2tuaPia)!a_Z#(?;^A3wSuRZ3ccY1tQw>s%I1I>>jp|6hqI;OK)>`cn44#!R= z)DFy98fcFel4`dBAfxY~$M5GskE?*~(4$QT#q)C+6yH-$h_du+hbTo-*~gy_>oxCa zFWwZH`#Gx;*;5p2o!dY8^LBb@wPTp}4v0{!KqzoGbVVpc82*uq&PQs7AYDoTmAon8 zv&5XnW7Mcb!)gmFu_6)18B6oYP^~3*sO4#g_S*S7T=?5rm^-|S?Sn=lU!&@0 z0^m(qjawB!sgDc1%Lt|UTRW;vH@jiMze0x684Q&I>rYLr`R9EnP#C6cAt_b-M|4Os3I8TPKm^AnkP=@$t(1^ z1gP7ab6v^5S!>sH^nrVCWHqDCY@k4tT9GYE8K!U3lY(ZiI3rxmUZBI&W)Xh;bB{X< zChgJ1k}4*b(Oj2L?`Y=FPfMm&{jg+#wC5m79a}0YWhIXSrh@RZgv$~>lzJ|$Fn#+}D>Dm>ySw|0yCGV@IL~KHD}X2k8C?Z!M12(~XHPcK z;j1Gp8yHSMo`WmWf=1N zE?cO3w$MMELSM|L(B?H1s>&AHH7nCx+$mHig{q}cJEX>Jp~+66UrV7u$3l80TWA=C z=)bH}%(>mIiBIIZnum2~U~#a9ku2nF9wv5-3+ZhiFH*klj+5v#a!keJ#n^iLH^`z0 zt2v8x&W?;syK#jfd5!>!e8WhW^(=)M$mc54=U532$+ECrejR>%YV`%Vj{YSUDhQ?^ zB$)jtq%NZ!a~K{xW{%&`ux#PPJ|-}U?a$x{P?bH8uO{L5s;HjAXft+J=M`JmGlg>q zsWSE@%fAQu9E+e9I}8AYq^SF}{ucjww)eaLd+(payq2xGmw=-vkbI^FRM22)x+z>T z3PA{_Lpcv$2)Wa`LsbXAnO8V!U_A-;^>9$++U)UbW~OEA9i-=h@kpoj%mZmfX!m!@ zS-%Aydf}hdN-x|=9nlMV2feUn1$yC`bpI3|>~EM!oN;3Pc9k$ByT7jV+wnqS4tGfZ zBFHGx*AhSrHZ|<v%B!dj3JZ29X;CCBOJt}ZqG|nXkF0wT`nkPP^k2H4pjA;luo$603A?RIR?5j|9lCm{ zdpun$XJ+U+9lBccS3(pue|c|ITOCzKlN|7P*E_n(cn9q{Zx5RpvWub{?8O_b>vicl zN)R1u_PA_gJ%_+zYw)KU`F^%c^a&gfkPa5;=99$o{!zK%T< zX=d|%ZksFgoi$)JLoqU>?F}pxEove_X0IQNzAjnW4JWpAv%7*d&gz^B*R+brkmoj~ zQoVKaqR07av9%ODH)pqidkfeTdu-9u{k-UH|oTb9A@&SHO;HSJER-YfbC zz~T2OU?J7r>c=jM93)AXI%ri<%FO>AZOTA;8HjR3jPobGMs%#`O?@CMz9Q?ho1A^* zF_ctN>O!DI&L*o^8`PKBR1wG`5XB{NC8=;DHkMYV8yh%Z*|5Dx@6w=`eQmE0d(O-+rJ@e;0cYfQr#)>+{zZ~z z0#Y=PYBKxae8mM-ZL~-y4lfWyopy zk;9#XT~XqFQv5l;tMH_V#=GB33&pg+y6OhjHrA~7>QgPL9zj0ZlZ|DG=teEJN%B+H zYt<}THcNlz&!ORSfNNKg#g_K`&3r}9>@@`1)d~LJJ)SavJM->UraBQ5EK4USd&??G zr;f^`!bSGq)2T)10nZAKFC`e66C;DVgc<>s;{u`EH!`aK*)eO=&2?go)C&Z=g6xi& z&pCPU)nye+)yG)Bqz~{irsbfP*~6?A`Ck*f5#lV7aJ=U#D!ACz>7b2R+g-h=gfKXOzf;NBmI2Ro%k#PhDw54QS^rhxV;M}H4mfB9vu>)Lprghi*NH|LlC zy)PF+z~8O^pnmXxuD!ZKFKyO2J8XRAH^LQpR55nz zvamCJ7Jqfw3gD2!LNXe_u!D3kYEDc;6A6TY0U*nnj#T05@rW?}>wES2i zVCEGEPp`jOq;VdmPYvyHR5VbUqOIgF@%P8J_>DyaXs^mxTB1JB74q>LFBQqBIjr*$ z7SNju*(I)Uf+IP|n@%0`&%UmrRa3w)|1t^$C#Jh5{W5#ax`#eD=j#+w<)x?b(FIpC zT3oo7P;4{l16Un>ke|D5GPfdAovJD)o}jRPQuF+Q#B&n5{zw0H1ZQuWaX?j*s}9& zom8ur0``3jKk?tzt!GEwKX0FWm~hHg=m!V3=9vbzg?C~`yGeKGz^(Sexm`LezGc2mk6S$#Rm{H??NvL@ubk$SgM7@de&c<$d<_^Y#2RF# z33fr}2{BXa17@!k55Z)k^;(zr%{WpBI(Tma#>alGauZupn`NFD;0<5lsx)kwxI6)7 zXJ)Z8irI4y7#qcRuld-aM1RUuQOJ^J#?REOQvC#t=;r9+0nRxv)RyI}4~F!(zpu;M zHbt`YZ7`@TTT_-&*9uZ^oJ%e7kh_egT!0?@{G2A5EW&|rT~#A9cpIvGMeqW=(P-RY z@c^6$c}A{v;=7{bx9SUqG(U+*#!|t~=H=FfQiaKKfaS#UCL48+OLrJlw>wPWP()=EebqZNkhUGK1D=qLj=Vz>kMN!vy zjSaYe>CHy_@g9t4IgcSg($=`g%#|}!<=Uga1q8NV@Wx16t`_?%G2NVnGTCRXK`+xu z_i2fP>m!LA9PZ}W6;8!abEeRrC{(sa?1m>BM4{`lUm`m)nf;hFu!kt;GbiM6oxmIU zK?~l_-xET2sj9&ypux(0){R+c3mcNJ$-KiVYJjo|Ac0FyD zt&t{anN~C72aMDfjux8)%;dA_7QB%?xmF7lqWP{Is+mzgG*!HFGlVT$<1b%DC+y1< z4ib5y!IpDZPR_3y>@%{Fry6W68~J5}okIlgpTR+qPx zw}s`;CAvA=WgS|p;-~5+%V~3Vfn_-fop9e@I1DH&J?tc9=w{9ylzgjw(CX&&LCN2@ z$B`Azmvy)YGjC6|$cC|eJbg9i!sx{#32_9v#)!)mgn$vdnNKXGJ<73Ar08ajk#5nV z4>QE|$gJ@!^h%7%MQlGYi3iNtOff0zgV}PrJB3sjmDSc$EUnEEH z$L~ApGuq@Bx$%D4#)BNcwREF0?2~IZ=BV+N#`l$_N4=$Q+w7I5{f@&1n6nCf#=bzj zXG<*QHFJVF+Ul~_D=Vw-zdpv)oU29aDeN`x&(qe)f!=4PsD3P*Dj(Lv>1!-tXuZG~ z@R?2lQx%9Me9l#h3hl`zxyuz>2C!lAyfcQy2M(?*|5h8?#L|y-X{8kH`*1MVtG!!^ z@jF}2PWsC4S)?rxKN&r_uyPT*NoG}89WBWnrt9UN>8~7%P!^l19{Vn;W#n7Xw<}19 z4AK9}d==C%?yi3fBQtgpY9-k{)x)b|XA?tT%SELWC z1jbS>v>n7MCwi0=g!vouhCFR8I@Z13TqwMT2Q{Xf^~!3_Bd~T~EIc-2N+4v7ahGE8 z_ySfAT68QCwb)WRUyr{ThGL@gXU(iaTB6rr+3M!7sUzY&=jz6|Fe-dKTyEri;n^%3 z@X3y{v}it1bn^JICtXA^=8Fi|4b6oh}w83zxW{Gu@s#{sDM`n6xu(QIp z0`UaZXQXv?nw!l%*R^I|i%Nc2s>F3qz%0>?sv3I}IEy|qD;J4@hYYgkmb@5c9VN%* zx*qN`=xY2M_6;+G-{tAKp=#@A&4S^~Tcw>ZC{z`n!!FY(cdytu?XirEX?OT&d)BuiF~CN(t*W5!Qg|KrsSW7C|>NJnRv~)aoiSWYWt* zpn?|d@0U(7g+kR_rbzZ6I!;9&AgcIh_8LfnT7l4v5n2S2&*^4WK}x-X|`|?U)rDL;TlCjTOeMA7OJAqH+nquoYlsGr0YAZAi;X3}UeH2hMgdxa)|@_Rj9wO!nZ2GR!|OQtjr_+IE(OahO4=gb z^#k5vS+g69i(Uk~aO*;geNKaPdnay}=KLgo8T>B032?`9hcO)npK6p+MJ~gMgSy=E zVXnHnpF#lv(V~|z-zixiHr0APm`-1*MbA?6AeBuuR|evh3Efl^XxW-&V(YR3>TCs! zBE7l71ESL9YHMB_0i}`rc()Yc9|gO*tLcRdyA7O+RjD&c)oMq2^!QXyYvWceI+gY! zySs!ByJb>x%{VoAZbm=JHhr&%-6ed;J-vq0h{c}O*hfK`P#n4avF-v3Fs!-xChO3-SV7e3;SNpxe#4wP>5Yjr(~ z5sT979oVsQq3MejJPy(Apv(fd=~b=@8=Dy%Ub82@1Ubmr;=b@H0!NRe+}eDD z(zJ{TWvosXX4~cXP=7W3a-N3+fLiSUCgRXeIb5UFbphHr+5QBjKVP*(nalnMVC=Ar zplPmrncW|gX8lNiwT>NDr$LL|$Suttfp)6HmDS3I1}AL+3+vlYxRh;2}iU~6*) z%W9xThRt-_vJtJD`70J6{^pq1P*V(aMqp_p7pNF{*kq#$t~K&-CXkEAAvb@4ltq(7 zwzWmJcV<*gmjw4(7PSu%iVV5u`HW@^64zqjt~BE$75hCgv{QjhTK4rEY{{y{uSJAV zT_R5RBangkOg8;f)-~emSC?Lcnr?4>PW<$4VIk z342*9C`uFQ(P|$=U9iAfMxQaGa%WY@{RWpc^&+TjR#ii3-S8G@vGLNkW^aKEar>wI z;XK)K#3VPA`Vb!3zcim9aIozxU=j0i;PE2S+;-;vchBW+iU75PC#jKzDb1T+EkT(E0> z0t~D}%it{+eym*ew^+G(@ z^pa^^Oak3J^IVcAGP%dL7_othGQ-FZn9qw{l084ERgaKb=ILrpa*l-K(+Y*Tjmy={ z{5d1Z6CTtbbS5h(zZB{i%^Y20kbB>fk#3!TpNu6epfl3#kYSR6R& zR5T*)>vxv8>{|T?zf~q!>B05Mof-@uPOa`2ieD1HsJiwq`E09+C=dDZ-1(p`=%Tyo}UGzKx=5i4k zYjZe{v|(z>>Q8bNN8~c|1GApcOHNpMr;0Y%g|iY`6iLPYq%c)=I!`fNy=)+U7L9zd zhxEwv@@Zjildt6h&$|BfPH^W2{Ul=mrhxVF?*wkD+12l!dtKI+dy$h!A~W^Ki7jEJ#Zs=onpyupB=fv*m{phaa5 zk$e3LJ5v#pn{`6N_c7`q5Y!4joxb?bv>bMhdm74t;^v5fq9MHoMe*`9Xwd}%F|xdZ z4$^2byTTKJg}kp<`2HE{q(I=Dqohi04G3(6PB?CK18O z2)-7bB2sCn*AkqeyIu`lE3u>=L09QA5&APVf<09+>pAkBlE0FY&d4z1PHP@>p=b}z z^)M+fA4yQoxtlRjEdR#dCr4?XV;75)YB(KsvX~8O!W^1%*b}nN9&g^**ToS{JnLsD zo-2L1%%NcHGE{uppQY926%QV!#cm+UuE?efJX<50=DXjVUBpbIMZXtQ%y@nfXjU>J z%;yCy8O~7{A^NV#?Vr%(Hy>Ih<%5@GxhN+>jnAzs_k)A7qTU5M{0zQRHQ_^8dA&L1 zgCe_(M1Tr-yN0IHLuB#nJhA!hy+2T=S!sgth?X5A?&VH~i+31~*zXbJ7*2=$J4rE@ z-wZU)4_+EDr%|F=J@4u0cMr& z!TP>3mLM#<0ou^bRqk(->2u?9EH&x27PCpBMxCrO9{?THUFZwHanu$kN0oUGR)_-3 zRz+IWWIdH>;zRDuq?^bJ9G2j_0d43u-Tij5XIZO1vd3**mu^Nc-#V=)ORW&=yhHZI zG94!D7Zm4gb=D7+Abg`Kr5V1u8x>$KS2KgDlJxk^Zm)SNVvrYqICb>s(SsY$S>HR% zzo3Qx*IX@90$CfgSs1DWF7fDA| z8GEYAYO&oy4`a1`NY-2NA-y=0!sa)`by>fcQ%mz!O4x4PtFl{hjc2kS?vOpPMP+}~ zA^VaJ*^@<+#)mBJknQV`UGbgD{&k1!?>HWmX}h18Tk#Bnr?SyArpwCggKNYj%Wl0{e_(A?PST~0S$R@GgQ2#ZGi|7$W^u(HEY$nJvd$vTF9 z`!SEt^=1x)@vnZo7&1N17MBCJMw^2k1)QC2<=lFjB3^TbC)PUWA%A3U0YkS9d*)d6 zil57G&Q*GBr|cnaNuKF9eOrr^EgS0VmD9EpK1J7&gswZ?yxzlOK%b`N*?Nw7D!IP6uNPcTP$ zVjJh&gWH+4z-ivdm+lZNu+4T0boG$#rRN$U#mV53c0HsKTDK=g@x)4yc~JMT(9w z{5cxM9Z0b=uIzP#I{TuOO>m&{{BW6L$j_h3u6s%-pv8`GmtL)VPE*l+L|HHPBx3gJ zDt||K;zQlBHAemqoWBfS7u#s``i4-bKOPjDfc%RLIZ45l<%Q>RPagt6WZq8Sh?WxdX#O#2IEUbFL%&rix*s4Z+9 zvM}$Y&)F-`V!OL@{4rJxNXokESM$dj-V32q#-H<0fNl&c2pEI7G4ZXbidM#2D~(X0 zzqzuA@-DBz#RpU2NRij;N+$iZLQb5zNgn1Q$kvI zZH>6h1Mb6qW6S^&3cNkBl_h7lEGg1f!;YAUy0Ot{Fjmum9?x5KmUOPc%1f{7r@x3?l#a3_l`qSVQXL;DL(Ug5f$=fciD`|aIP}mWsM*q;Yf4Ll@77I zm#YCjW3lv{O$Al6VOtKh1#vzWAKdt+B9k!Tojeg+&|OFe(Mi$@Hk|-Bdsd6$&~q0G zRCB0DTP;I;VS$==Sm@|ADXA}^32D=9{8DtMb!F&=@7 zGM8q_UY;4R#HBZd{1sGfQRT+SqF@ zmpXymzdF2FEc9a!TmZ*X0j+YeP$Q7LSXyMy8=?qnwCIcU!}O+wG4?IZo8COteKRg4 zbc6NOU7oZ!L{uw?kq+F5>K%gPbc(Z2<w-gAON zY@!;xl{cg5rg<;;=VIy{s~xnpu$4_9r6Zc`?JOy4jE!jtzDgM4NU)Oj&`$euhNIGD&N-3ebXi)D zMIL0UeqqAC9BAn4vMshDOIJrTq*X#%LD<9D`w%6~6v)uuOpBtR?c2~7G6HXf-|ZtX zJ^Iv9fQ5}Vw-{5A2WTtCdwL?G_E^yKIjVyN5p~ccS69v)CmFm947?qpJZXz!eZ#j3<`MBQ8Hua57c7Mkl{4-1R>Rp zTgc9KW2gg+ZuE0PH1#7VL{pud5KZlejCHfbX*L2l5KabrAbuZ@_xyFK1dZ{YPFseVZTJ6Hxa~vVW#4notd_jm!j;bH zC1;sLJ1+bEZ^U&kGWaO1)m0W=>$0N~nsL_%m;IoG?vvc95;}<&+w4h%tbQeGh{(um zH%jbD4*!o!m5aHm8y!0FwY{FP>HzE|pcM+;vdy_Aq>wpCha6<~5>m@OEqbL)PKjD1GI_=q;W}4cXoFMmDB3)1g>gzp@dW?O$n)1=SfJBU!rp_2~|ocBB3iK6qZn#ghCSPLx`~$a5$mHVx<;4kyM1otHnC2 zQ0Gys`{`GBrf0MkJ3t6~xQp1sUgLlky^+CJ){3!=QTz=fozNv(^cPNuVcw{!c4d$+ zRiSR^lfMyCgZx&CWu?+b#L*`MoDfoZh7&?6Jx&Oz>4QTpT>=lH1V1DIE- zraFQ7FcsfpplB4yc(Nfq60plw~&S_~V&{&jQ=`=VJbxgNZqtK+c(A=2)>gIHA+Ycqg*j|gz;|@Qo{Hr z2`ORxO}1Q3w%q(|xregl?w61fbMf#xkZ+Ta67$g#Qjo8ekb+!62<~01#V%7Jk-)x$ zR7WRv)QeSFy;z>ri@mdY@r5jPt7WLE+49R41siGkM1=(QdO`~Jwss=1N77Va+`xUSHHKnmTRVTF{tH>mSB6dc6gnZXjLW~-<$h0%|x>8KSw z8@ehR8Ym&9YA%qFQZ+>qQmW<@2`N?6oe&JomjqS(d$zQk;$KTh72hQxRs1svsdAgL z<ylGju@9k4K|F4->E;SYN7E;rpkC_e4laQM3W=Kd; z`5p-==1q{0;>Il!Qrx(n5X{phL6P_>2`Lf}l#n9v1rkyuF3OfWC0nk0wp>oOT${5W zbJoQ6{g}oG?zHrF%>kR~C_W@Lp*?$3hwKY>i>?ksRSeq8c%gpTcy1EduRWbgjnQRu zR9@lks~ptg^mksWkV}!98G!tpfga~5m(Ecx@g;T*W3JWppK|YnJEq*(Z`m|}axUhM zDR3ycD!frxUVs*PO7h2DI9Rk}9V@wc53GItjStH%X?a9^ z@Q-l46iQ`dVG$pH!_GXv`#U*c5kXdP&nU>I%4A!Im9Ug%jfrvmQNUPhjis3EzdNb; zG?f5|uSn1kF6l=8y`aLmw2^$|e$x%!*3MkT-Oday)}C=0wnKtL4N7z{GlWgY?O9~+ zW9c14#@hdD$j8l+SJSCkDSM$(Nm*z^^2xLu;xUzTYBg2yo+sA1uvP-*MN_$+7cic2 zkq(tTf-gTzA$e({XhT0_3E_9MiXotgU|pF9UBr_o4oGg7K++#^VtD5``V2NceD9o+8y^J0V8XHSVtVrv${M%RvYVH*CunrkX?E zqK;Lcn{IoRLOK6M5(CCX*6q01SBX7TfiuXvd?KwS-v+U*WKcIuu{UZaRk)mYlYZSB z;^4Lu7{`)Xxbgi!hx$Acl6j|l9KX@BTsW+@hz8Pcj$Z^yZNG6uj?l+5l5;?t6O-^H zZA#*Rc5nBqCTZ`lKA_F*ew7|+E(nzG57~CBHIFo99$u88RslCb(gJfsyX(IfP4F@GZlv6kINY`Gy z{2(W%@2}vX>fhP%`#CMJ+cCs158VX2v5}|KrO?lko>Y&kBs9*skHzzG8HTK2k0-fE zH!kf*UA^?E)d`bD3FWmgM{N!G%^N*}U-AX!k%QwXmOd45>+JSvX1Nl9A)7m7PifCi zE&zY--x}{_c%z=InJHK5OE^NIv$w0u6}}2iM~n@~p$K`IY7lREsC{KF`~=K@7O#f> zk!^Woj}M+8H|GXfFH%4bjBw*_Ec>;QZ8_vl44$Z)JaHLk6Z65NcIQa?5zeeTD!A3|ux_G2@sQ{$y3b{Twazs4PCx>$|e)neq_g>w- zn}_~#tgqXY(!h10MGwei#$7-?eX=&R$?aNp1)yagovAR!0qASvzAMq*>cXHp+h@J^ zBwo#jipS&Mk4=*aGFUuOT*0!Y;ri}myil>zB|N%#irn1TFH=M2TwrV2Uh7!^$mMqq z5S55fm(<{7RNj0}nS5?-C0kU_Lh8-r*9`V@5J+w*gg!Q-#p}UNGD89sEN}=0iz_U1 z8+$BGS<%9K4y%|HE+kC|C~x~IPBgaDVMNYIB&;0@1#-FjoD-J4ZaR84^4b>#AIqe#SRxes*gVL?`e6{F9 zQXsaM%|8!&o&{jy(xS6et;#}X6As+nQ>ge8FeeJp<;Q!h^;;d(1rQrfJO^vMTe?cC z7Kt)emu;zX|G*owzT%O|UfKOJ?q;c9T=)xRVpEDohW6Xp2nPm7*03p zp2oZb+`o3mMRy?P2*bCtsLJ>u^aKx>`I~*86#;^QV4;_0c2G);WEmP4`~Ydlp+JYs z%zmbhMo3WI5&H`3>Bpf)8x3XbMe-GK)v)MiJtX<>9GfpH!l~cS8Y}tFb<7VI4{|bZ zx2~4V8DuIwf}Y^AY%W(F?5Q%z!t4^=bUWf#YR@K(qaJO}8{r9_z>k@EW#i{? z*Gg@enl^NPi0(5sTS7Cv{MrCR%$o8o@WjSW1V^j+#k}+uU^5(KOTNNo_Iy+xdGyL1 z3%2a^^8G>HWapQ^dCG-0d+~U{8TCF>=Kd%M<@qNZ z5?$`G_8(A*R^X#r@y}sw$au>HAL&=qF>M+%ce=;*w zFozfE&5Up$HVZ*G0U>|+sF-eC#mV58>b2+&;)8G3qT;q6+)s;cX}n*kw|xykXPma9N$dTkg#2!xyj>z_gtjdgD(dlJZUJcI7*=GpC(N-JtVX%TDEl0SfF17r|Agy+qyP~xTVtxuV-VaN5%ZxWv2g@Md`%%jv zDHPfR%z)9IV-rbfTYl_L4mL7%7hp@seCe@zF&F}7_hKcAO@4#Bp$HEOQkCSm?x29d z(XHzql?f?e<`v7l${8DA1Sdt_<*ux>X+N&4L6HklgrYlX1y_F0VkWx{AE13r?iexQ z)}nFA5%>l6t<=ikuYLze5y`%SWS$vDHq`H!sFy7|f+WxSE3=Z*wu0OaQyyudfSsaa zOQCDZ?jyL>DEi(`+`C+awQR5byrgH>8y(&saST&s13!zMZFbIFw-27n1Qncxl+d-U z8A0*hZl4V{S-o~|Av0j`e4b>LCz_&DumeOJMSr3K5O@Lsc{JBXr|9P0=$8(~$00GQ z_y`rCxSXAm;>(=k9*T23mYz5*1V^ai?>Nwd_ejylD5|EO_WrRc$Zr*$LNy5$Sl!bh zkLBEj-(~%TN&)juxdR;R_g+jT`&%5}g zOeaC)=QM?VBklhRnpZIe(#T$EBuyiE8b>wqLWV}NhbOx_tG?sRAQfn3Z}6|#3QJ(2 zs_?uDfR*S0sqiEfq~%}mwOeQ|%a_@O)~Uq*wTrUdsDR0fD5{I22ndkj0?fQqx(Las zoF&VP83dlpAfSc~bxx*^@SvL@5TK5uAF%HVt)~#mDl!Yliul(kmLaSL7np0raIRTHgn1H%1 zq4@oxN(P^2oq)%Zy+6Afq*D0{GWl~d`60=l=7=d4KVm13>}JJIHuM!OE>Z#BI3B7H zs$l0(1)x88^;h7)>wE%L<{Ts_#hjt2s`BlYJQt|? z;5o+$c&reCmA9_)P7&&wVUucSa#=@0%5Kk&Ss)`tkczTwsuoY)yCL*&WV zH|3A6UBh!ldB5dSq^q;F(IQ0_*!(Ue&qPeTh&Hg6n(>+Da#zXv@e1*JH0b8QVrddb z<1Ol}Y(Q))?394@ng{3pP>JwIJwPDvrzsubmNnJMMBvu|;-I5||_^t2dsxxEtu?rv zrBZp&8T~lkA{{gxo4d%6F-uT zzYKl{Ju=69xQ7&e&Ipk=Hn$s?yzlKdLoMo=e{*)5EaEEUk--Wfnr_M4?e^OY8uY>7 zE?VqG86;{aq7xgT+?wze7qQ2~^HO{51Jc(c{JKPtF{TEZeIB72uwRnKp7RL;fLbL& z6}KuC;paDS^RM#Ao`5ZW>GZls0XGNm>@rslpX8bP7|+zt8~jipew|yZv$O@@0*oKq z9Pq9ZGS!G3qdq-Cbg*o`CL;6#$NM~XuF4vNHBd>1L)(xpSy3nlmuT2$Sz6!wMZ zxQ8s46QrRtbn%UdNtM#i5jSD{x*R=%NOiARoTK;|Fg(s%{Y8|s&iXRl%TwoBVkL5YEqkfT46^^QD;Ml^;*)wra z>0*BZF}2$1?s(;TeUUGI<9dF}qsxqQ{5WNJMlxKX)uBae%j8$+`Bjpv(#IFfqT;cy|2J^hS#mJ#Y|FOW@wKzro$M1O8x2vx zJw;}hu{bRGZOHQ&=lr^5@M>Pa2yz!^tM#nRS(GbLlXCg0;MLp`WnsA`XqzYV!zQ8i zYDzx!Yryfki**8lq`czB@2?O9Uh;F%NWyaaE{qSBTwH;qJzQh=A;n~JqVsxkbn`(q z&w&ZL-CD_M2c_jjDp}k=$N-Xn%6#$oOmtv2^O0jR?L%T98Sf~iXn#eMw0w{>5q-N0 zL*+O!WrsvJ#d%v!@BF7CU7aE;D3Z00cwbLma@36v(pym_a+rR6UFS`_J#*Gc%cm z5<2_2hFBzkn=6&wh5c6ID0)0~KITSyKp3Ci=4G;1&a277-I3@P{mL_n@y+4q#m~2@ zvo1Tc2t|Rlf@_sH7GD(l<6_S%PX0yaFZEM0z{6+A&UGJkCSLrA{8**YIBy5QTY_Kc zW$XC`%R)Y?Sm@*S-@8LU-Qvv?=T?-mv_Ef831Ukp)3@TT?Dh9yTvuzq_;w$gp6PwO z$H>uQvO%Ht@xm%Pi74A(vxu1av-umz|2co%khM|_%LmkIxQ4c{HEUS#(p;o1Pm6w} z0{L2Wj|z0+@G77pZJnL>&YXGZ+vJh5#2bzx=eMO_kvC|*QhOoI`Q4=%>4VUouk|V~ zPMGiA3|4ij^ynQNaDRNN*QFn9x3O@2rUCsMjI>L*? z>{B`qy8VhYer1Tp2F2)tEays)8CuZ-|^}1Q|0oml-$Hr7&qrvk%nREvTnXw01Q<{I`M2gO5xl3x#TqGmy(Fl zEgLq~q^oH>y&085J+nyzgBtB$cMSJ#7J7kYm`gX{B9kNgEkUfX&^g1T% zFGPW`zdXt>4;^mOOOrUn2k~fdXO>2IjadYW=};v4u;jYC%QSci0wo16Gv7KYPVwT!dls!1s(8^ zM&Fc1Yo#t8<(|Aghwpe-RlIv=*rnMxuWS%1Os$6&a}-%bUm>Un zc$%<7oUH|lFBt?CUeasNoC_4naFUlCUik@~%MH>Md3m`xw95V%Y02tOj@n3LU}4Qu zB_|d`{O06BiaRVSv0qZ+<>*@+C}}?Bc@2KQsX0&KB!;uX=^+VZiRN(YZSfPOxs{h( zO@-hn3OnF0NDh~Ip(FnlT)|h1UX+0=Pmuo$+>TO^T&>{Q^4>>>^BvCnNIXL3y^+@| z}H!&V2^Gp{bAQaXXKxG%BW4C|akrc+aHec43X8xl?oRt=3v=v6pYHt*x!r0#yjt1TToFh_`|$aF#`hSRkU1-}{+4dkNy_ z+t25(?~j*e&p9(^&df8; zX8zsXNF-h_)c9WArrlVnr5Fz=9Xcjs< z*~{{Q)chsR2BasI*3; z8fh-)vHUw-(1qk`sU|XNlUgf`M0B`F>cVPwU(Crbr}3`yDDO#4%l8h?l;%gS(m2fi zO8`RU0}dTr--k$X+LRtL>7Ml0xnbd_w+YwbAto`h&#Q^OG%j`ZdEU%VlpOj-<_`G{O;XB~9E&A+#Scu(dfD2eKIg6}Y_|)zdm>^9=XYjWuI?ha_{Zx-_ z5mSjG2@OncMy=aB4mxk7jluYqyjXEBlYhR!Gyn zxs2$sRh=iP)26Fwre~9z4^EfgQbr1@W6H;<`Bmk|l!$~SCf=^sK?8BX70^$Kg5e`f3+{`t@OJQ|2MldPdKqkpAf9gwjb^oP;@su_$1n^^}<%qG&S# zzSFNjmQB=D^P|P+zl@Uc$SwjAqaRXt>;%mD*BiCiB<|Nv5YH ze&<&#e5os= z@&fIt(rBt?enIh%3yPniSo4{V_9gUgTEzCG{Q`DI(#^> zw=%gQtR&F$D~zNCcO&u6dqRC%;3rrkDvZVAza%wB4Ab4*>5bN2l60;Q9jqVgCC0i< zB7`Z#I-h$Q%QQ%g#5W=4q4?3^MoW#ps={dcMLOgm6&FoXhJEjSu4EguC_x0)pdYf| z&yyN+R8H~OY~Dvxm~_a_J$l`eo^hzX@u~b^y@qr2P_r?(L#L03q{g#T{|!0F?Cr?4 zhn1*VpZY2$qL2E{{$U>9MJj6I#rlykaPcy(2=$TJ9K9YcV=R3y8yOu)p`SvrEro-x z5%*n;#47PXHMQSndxcV z=5eO}V&rUNkxCvRa!p7Zat>tiFA{v#XxYwPqis$HD{khv`IfJMk=)O1um}7#lt^Ec z-b;lDx%bbY;LvKel@MTgBF{h?`K(<#H!=FLDbeppP~}0G>Qd1QmrEDZ|K?WrPSA&* zGbQwL1&_f+Gcme?l>8#d1sqYKZZD(FD=M(eN}Fv{Fp(fUlUEzQEMWtxsiLK_FleVp zMO3TAbCSmJXmyMe?Zhpxm(Wu`uZWGDpC|coyh5(< zCgaIqYEBOhn)$}!YsC;|PdDT9Wd%**E`0@mSRjZZ(ep#DvGcUrk(b22#uo-)`v2nR z>PKEp(_?Z?i~oRv3wbT}94afCne@HXNdQ`a!$P)JE4)w`B10%m$M{a&!TLGglIU|` zyJ_y2#OS}(-u^^pCH@NnIX9&LPtLEI)1T$MpGwoljL8YVCTen-?s#9mgMkj1tq`M& z^NYs;7w5y)2v8A<1ABm+X%U?C<1wW96K|ZzZ}mJw7nKN$3#cHewF6>zQ-UY%fql+q z;GS%6u#Uv~gyN%5^F*(ZoEQ`A^FQIG*sG$BLhR{MNd=)|vHx=QQ#5a@R8jb2mWt+c z>*(JQ;RIs!p;Koc{NpRjqwIZ!P@gN=QgoE+QdKnjbo46DKB43dY zaNIy%b6%r4%cA^p!(SS<4iyC95p=Xc*$Rx7)j*EmDdkgp#W|C;5GJ^6(GvhJl9~#) zxUHu#HMu7ee92gRFLjybMjV|bXT$Du@lfH!9+o-cR`4)+s%6ecn&h)Eo^0^q=Lv)^ zu00xi!%Q_G0j}muCFtGEBMJb#S3B~9*h=F`$yV*~6>(x3i_ei>$pDG8j!58PB(OPR ztf<7TwoU+dpBY>ov>%`*lr|cBS53IRnJSKCC7VTCY{EBvEIukorae88dGC>=3W(wA6XEc6p=;< zVevG2cQmwYXq33{P24tIJPz_>bHzAW=Pwq*2ii=cHTs=MGv58N@9BivjtZG%{%Lg1 zXx(76N?MBDlx>BC+_f;M-tSLv- zsfu>)%~VUpcJ(XPAQmR;pk6ueOUrmH-qC6)mL==-9l%xdTIt4`w*MFUBR$LZCv*jn zBI0ty25}iE?GaJ@!xf&mRNC96MzK3xn?%K#u_VX%D}FW@z-i2xt8}b{q(iivP}J|+k!nPg3~{g zs4ekw=HM%!&ujvT*?rT- z>rN{-iJE2VWl1d9&B)m1E$^as?NN6yOMFj5e|G||3O^S=m5WojNXW&B9cTiA%G;bT zJg3g?&c+Rq%F*;hIqq$n^Wx<+_|KeuXPYw>9&W9(`>TVr-RI725oFgv$bPdSPsHnX zj1jSp{(WBckNr~pjO1T~T$ ztPYk;U7UThoBcsqM?@|7ZRU&KDkzd;gW8bmMb$T2{zzBtJ{mD6nD)5)0SexXC>{`!N>6zc=XzARf;1X8& zT{tNuW6w_R=xk&CV)bf5*jaJN`QfHgSVsKGEFXN9jCcJ1`Ka({FkeA4hbw@48FD_Bh zXE+tlJ^atKj;tJssw$Fesq>rFRFwde`{kWf+jjNSDpcIG*2wzp2rcz*5m$1XfOEuV zr|Bvw+h%qs=r7p{eR}I6I>&?sE zUavMSJ&AT=38j2RdX4k|zjY0LjDUPhnT)hMIIO-s;tl8ePB7%vtUjByf4D<)o?E59 zPx5|g^gkNbE#FX07Y^$LhP90Dzz4Gfd*@=+aCFT7a$tH;YZwo@!8WJfR3BwL_Y=~R z*`6B@yi(5>?uH%8;waPAC?U1m=@1q~u|_|u7uMGzcC$=Q&N~|()l?e2$X!@J!{bmWrk8l5vo*bs1b0NQLd%a` zsi$t!h|O1-hYl#|Pv);fF#s?e-A>In5RKq=5bnS!bCUFawVbh%x!>gVYsYCV@ zLgaR8Nj#ZrwS)d+VD>~yyFxvsvFkHF`MEZI6Ce7I7x5g`0u-TNETk6kC|SghJlBh= zK1)8TEb)`GX$uJM_Iyz$S+MRq3!XokS50#EwNEBZbm}F8pgr_RPZg-YPV)C}(^Gm) zmWkudQnXU0)MydD>rQL?rG?WfJTg12U;gy8+BNs9Ph@9zaXSsM?31!SI@Fz>oW+WS zDDR@oOmJOnK3lV|k(bGMW{w(LJ?l2L7txwrx!%(c`?FWHy9F4b)sHdOaq(nCfoKq` z$kWVH)o;zne#O@{L%fHpt1KtWf58Zj(4obrrCXUl0hhE`rd19G=RppjKzWJoNQ-Ll zA5Zk1mk7kvL>Ex&RnPRA=pD8BiT;P;k2ykqsGvx~2ny!<&3sYj5s}Zb>-UqD(-@gv zz|DKRxpt~yZrXBUv(0-W?q z(#adV=8NfY@cEhWPxe5|K^k3a_!D?V}1XJif0U?UNgV)G3Q=NEhqEa>)N!%;1>{s z7CwTk^o!a;6K~t3m1hgrllQfWc~Wx++R-HwMf(S5G5hz&tNZW3P@ z1A}U4jo4oihv5AFqB!iW#;6opHdyKq@lEOyHW#K;4ioeU@|Z-dub37uc8rm(0Fd)Y z39a_OE8mIQor>NI?i#80Ao!a=q(`r1z*FTxqrC!Ov3zZGN04RKh}2&^C#MI7K9 z9<~-W%{i6ictS|=trFx;Mshi)Gc~uQ-ts#ep$_;@#mKX`=AqNXBd1S^_3@I}o$IYV z+V!w*G7i)iUMIZ&sUrEJ+HICT$~v%CCvY7XbNpsQJnaKn*>0LAYD&NBH5KYC(dpUQ zu%4Ec>Q35cPt4Bq3nymru@iIYKs7PiQEs$+k8-R(XX&dE#IwJ4{DMf=AOpB39h{@_`$?Vw8yOE@Z9JS&0ki@YZ0Y*@`FnfVCtjHX;F$$tB z?~!R@Z8ja_-p+$rJIn<+1mMZLK@D43Xjo6r5OybiZuB2Hw~9l|ScR<$TfpP);?Fqn zxG{Ck2?~)(vG~4o`6(Ka(c>i+E80+xHIrnu?AulwKEh%vMJk2!VA?KoJ|N9aL-5GF z9fIEaNFcEMpI^vh`RTOCNg~02iG*R_BhauFJ~~^l&^g;*g_K)|nf6k3V6$2Y8HtNqb|ZVbq@M6iGC_4V~W(Ihi3sdCQwUf%~~>CQZx zUu;VM4-x(8dQ&0ef4PqyU>@$7UYs=jNfKcruGj zuegZ$-|{N|iP}1htQMypfUGOm1}`m_bD$!|FS`ly+B6jrZi%Who(5<>H5Zq*iEV5K z#bO4xYe$NW8%EGGiLF6J>?tQg@(H&S87tA>4+YEIksnflJzaU$N7{WJE-{i*fQ4x< z)?X_#MFd*73fwbEf^UwRTo%y-Hx_=P9**U+V_64d8Pr%z%BVHPB?6baYW}a}e}A^` ziMixKZ+RO1|4^~ycp}la8q)BY2dg}?E5zEDwWnN7nj9rvN9?@X%4v(V?22L+TquHt ztGaH3{=2H{%Uqhaa^SmdAWNOZ2eKNheM<9=R=(bRIIjBer1Yl&(~5LxiHr&FEz8}{ zKIGSGr7;D0PVSP)U{DOUN&aWRO^mO}&;L02s5r5f$|B4u8{W1^U`J2W3<1fV9%v-8 zS(}X4TUUmQyC>Su^sY87{mj05i4<$MGVgGmjJOOj1 znuEG>HfRYGmp-H=pTGP40JfuzbWp-27f?MtQ~H+kPe4D8`yBy8GER50>oDi%ynF<1FDa+{09_q7ZoV{=RJn1t& zk(br{u~)#<^}f=pUdb4~Yu7|Vp;lbRbOdND*#VVPg8mNLcR?RNq>&tWiyZ}m!HiLSJZK}@~a|b-Vuiwp4jn1ty z5v2+AQ}ZZ5O-dis(!-4N3>1L)u>EH7EbZw`bo#A6d6*;pdNj-r^BUwiy`Nu~7?Ip7 zHqxEzLQ`0QS~p@ue!5R)SX!+UKZ$75S3h0qDU=r#z2}&9wlQQQsxTK~7VD%NIn;%$ z1tD+t3{cVZV_z0x9^5!d0i`EXq46qvPr3DcXw`fDLy4VU z_0~d2OMEBB>c0w&8C8Y@j&{JA&{NV7gm&s?ShmaJG@JN2RYROK$+kbLaK$3!Y!|5| z6jt`KRntOGTN`)6btEA-55gVm1Rb2yFd@5jm0&6+vYxg$l_NnXIv!jbnK*MF(T^Cz zqzMy3%l}}QVB16p`$RwgS7#TbJ&wv{Q`)4>MKsclZX^Nui_NAjgVa74to@N*V4j$rhR#-S#^@c6cT8>iABIID<$xX z=_RF{?yS<)-;fb|*OAtY#z{!%!B>nQy-Srmy%b^KkFvI98N%C0h$ac=0$b#~TXz-A*USD0scx;&m5C7UEqmk$@;STU6ePfK>@ES=3Fb{5(qn5hI1hnWtd z&gHXe&DgU>vhmigonf?WQ<%A57R4siS2=e6&KqcxgFZl;=P7Lr9MwaPSO?O-5wgYs z3ds+kyRy(_-KJ0GX&zr9_V`LU9D;3`#+`SmrK(ZdzT9tCU5-fHsgN4&40-q?FgH?# zfa85$^QJbtSTHU~n`zmv-=-HyvQj>+2QcEGtFyZ+S#)osWuV}=Uc~B9$DF(&@>pPh zx}2$I40*MxD%&WrKP%J@n%(8UiEHNM*Pb}HYQnyg+Em7N?Wh?-5j*i`AfM}lX; z9m!IR-$QT>tds4jt$WlX1#{U{Z-P=!y1jpA#zvtE;mx??}6bPH}bdMRmxcljP zVV^ODi7KKcA&E(`>uR-tgVvypU1@U_XJQ4O7va8>+i|?SF-Wy zX5j|P%~^d?Me9fG36+uH1dMwBHdOL3&RvK{hsziTP5JQ){`|ol!C9N(P77#7B%I3x)fx%uI=F3QtLqM z2U*`_;#QFYWM`yl_cQI8I2!21@8#Z_S;+% zj>`JHj5}XZFWn6IwgD5F5$72evyk|owiAmrT?VE`s8GGu)4WTzUs{gQA`nX)!Nu?4 zLN>F;Y0G2V?ffMw_0C`Oo5xNq+d|0|pxkezzsa{WowS_vQbIq|L{cS=s;pomzuC4S!ticA1v&Yju0X18t!V5r&S0Gs#>TA%^REBd{`nv zsqvRC8WIWT)8auinEM8Zi*h64G_qvo7j3c4N2Ay0Yz(kU=i z2sb?_?*zA+#@IE`vca+)Xz|ymmgw$Jke9LOI(Y?m4)Nq>YHXQt_i7xF#@+3utBsa% zl+}~Pp?$>WRq3MoR7r})Jmhc2UdrAK@;8^TX|=s9_~M*Ba-7u%*w2gV16bKhP9b$} zL$E7)M!j7WvhbdyIq=FecThd5Y~mxXYfGXh*k3D^DM^+59sK}RrUN-9Y|Zy`npI=q zKrAHmn31+rERo_og0cB3fT4Z2A`-u2$3K1t6{IbcFLZV28l{5Kit^Cmr`zr9d)DU( z2i9f&l%GF9I8p`sb}L{>NT=+5K*)MfMBRi0XeVy@q#xT|K8f|uK!5g>Brfg;?+Cs! zb3bpU<*2fJdrI+HJuY?Q-#t$Ivqj8VgFiij8FtsN)iq)Rxg?S@R>imL2YRd$JXWhp z%;1Z$uJngAC-PxnPe|Fr6<6Y**YtU+TRETT<7ejGr6+NmcY#l|v!JLiM+y`aJz7vC z2T8O|MCVs(0jF*$#Ta~<3pr71?<(RcbsV|`>BQ->$6hcaz3N~Qeb@M^`2U;>m>Jv< zrz=uXX!I3}O;+t80%J{EA^$?qe_jyJwJ945FO|E*0upVib5<2k$(~C&{A=6)L;LXe zX~ne<5Ahe+hke6x_Tj^R`RpoQz194ERxvXA*wR^v@slLfTQ zcoMKFhEF`T7&sO0SMv-~h` z&yuhm?e16hEU~%}IRQz-A;B@P5=CLOyv0*l?!nbY;%$8`Hkp=97+*BK&)TD$9hHh3 zs3cTaPXsAnZ( zt79xzUIC96!%&b5oQ%qTwU=|KRCkmvZ6=PQ+lv_B+OLvaD*F|YxAGL2nbwOYCIr*_ zff;;$-uE$N&7THVCbnZ+hyMm%P$ng1$RluTVl_*_`=UzuG``em{fkgl*RW8arQesu zf92dhf{^FZzw{gGnofwF;xzSk)-tyDxR$Yhhl4M>ma)asWfiBFqqWL1CO9OPv3KDO zj40wwixI)HW#D1&%i11RE}oV!TauK;T=W@jB1`YpLaSbXD3Ila_M&+dioK{B0H^O) zql(k2;AQVVtmdJLa%1|l2o38MdL==4*o$I)6yXwbg}n%~cR2W*ap!oMEe=GC5E7y+ z!sLgOZw8*%w`s9z7w|_L91=^WcU}5@>VYK5t<=cQ!EuZ`vXxS?qx42zaOXinchWBi z_;bz+u>`nlEiFxITaU2l0r~fox^FLl2BXUajym(Yi|~Kc)$*?Vj+9^fwi#EY-`pom zPVu|eFBEgB;S0Z^ebl7oRM%uVl$^vhc>a&Lf?a3@CD__)mZFuK*ZQJ z@s{Y7dzZbl&G2MUp6x^V1`FA)LCx$1YKo%V3*x zz&jkO4$Eiacw}Pi|Pcoj6@;ml33Ud_bi4 zgF(IQL2OXA=gd%&SGtRQart;MBo_h|5XNtxh4^h+FJ(?ta@rcPyCvVaeGs2F1FTNEU+#9nDeK@hWBc2lBhP#5SN-R+;*>wiV*0Rw^3< z>~+x{=~yThBf(vScCa$y?UJ30$RW~Ov_e4GCDxikY;|2NdVPk2@8SF^swM2zqF_0P7^{ z0Ox_AjFbG3nGlemd!p%F;Um%HYjUpEuxG+nw|Qs_-o9FtJ9F4ZbYWv*oY5PLf63oS zYV^4g>$X~@gF*-;2S>45S&_hc(}D{JyIguVKV*8l)zT64=A|;{$me7UAwE{Y_=20F z3$k5?j_6(+i(aOKIMvf~#5FIe7seq+&6dBfUH8k9p_{F;GHV$I3YM7?uH z3Esw?@5$#i`3Za1hdCO}4cg!pHEF^!ld|v5X1KGx!?V*mS5UQU#>o<@f}|5Y#oXTe3p7hxkNsM1ACpX zoeb7{71ry$eOdX|DMgHy$xU9$JIC}kcCMgKkb*4UXZ3`c5S6@KSbqlJ9HlVLpYEr= z9hd&)^gEdvk$2eZ54nu~P_ha3M+gUXi53!)$!R8cQX$Lvk-qZoS+QEQDsjmkU#q1& zV%9~R6Hn#s;q1gJIZ5*+XscFy-1SNiG7X=ro(udq*&6pCvY$ z8f~cAq((1(oduO<@bK)3X5cXHQTPH@i|83Twcy+X(6ejkj_VGKLN~ z?D$m4mw}X|)i{pnL-mLDXw0n`eHEp5D_>o~gkdk)N5F(y<@c(dG%`1hBXL$GK3Xsv zvf*%f=z~TJ_wE)W`3QAbvC+H7r_MiL*;Mv9rwwDR1=gu(@EpEiMxKOhb=VBPG>6ca z0jEjiz|ine@YI0;COOq z%U&2XxNV9YItOT}2DBWy)F_lgSq9E*shzhsr!SKiv>d9blJo8tfnskt6p^C09BLNG zp+ey_hj8UkYX3KKsNkoX&q4`K(X3Hp%VwP{2A-_Qqv_0l0Q-4LKyhWZpJx6enGN6{ z%ZWZMurV-&&UtCA*MzBYh&NWtOJX#4CW++wKaiL10%?rJe-gy@9szX11EA;P^?u(h zR_Z`bTtXjJ59Uuay@#1$1!-tH8plTB)(gZXqeXV*OX!=JBqY!*xXD=fE4^qny~#!+ zrhmj!p;O3>(qLwnD?W|Sj)VhtM6VWckNzq9R#trahkRBM)?3utUZ-m2#V7T`mjuT& zim0y8rSy$FJH|h4>QE-7x1xVE8v`n2wf{xPg|mY6oz@M=DvF!Q`VC!yA;DU!(a1W) zX1OA3i}j4AYR(VdDq;t1^1Zop?fwKrg__@$9M;V{2Jn}5n&18qn{eM}Ld~DZb8Ao( zcyDv2@D(_W^1)=e^}%JubYMAjiXs-QDdQ!(iOW6{BZo%Uvas&mUW8>MvlgPP;mgfG zoUS*e8)?ZMC;p?vf*C;K(N1^@B419rVqrHHkmF#!pB zC(h{PgECw(DvH+#%KjzOzN?V3yJX$1xfQf9a(jGwkeS(ygvObLDLcSx`eG%|q8a=i#l`WvumL zYHk&ZDX!24vgOWb-XZj>zVDt;^G+dPq2?p%hwxkul%}RQ0qkIysw{0(Fs?bQaNjC0@^ZnHR}Vfu)2N z*l@G*#D4r-(8-Skrl0`rAlX>vJm44q=v&bXQ@6a#QSwEzhs%+$mGO_x<+v{Z5(Z3c z3Nw315dI}sKP2zWhA{_A$Rn|Cj6L8^sUqnvTE~H_V?BUt@!Olo*07p!1L)7>HKo?vt+aK`Ru_z4z=QyrghGsCXa?>IX&q7 zJOS=Sprm;u5kbS7vJR6dIJ3K!crJcInG@F1xubXi@S6wO5bN zzT@XM*Lz#Z*9NZFdd%sT2+P|5Z@4& zx=*N@d&(e8XR*urFSkJ8ObQLdN*A^n4 zT&M?j-}L8sBJ`m57(sSrL{cYg$%6ZX_~v`5)dV$JZ>Fab39`(ChOzus0JfrDBJ?-P znsnIXs|!d}>K42!1uszGJpQs;{plkT=Gc}M9-?2$hMU|T`3y?j{8~@X!Q$HJ0O4E* zuS#D|R88Bl^xZAHfHGH(&C}~mhX^csy0?5L{1RqqUs`*xgB>+;4Bw#+VUpN9(9HZ2(Y_MQ)FNK4TI0!e zIesKDJ=*^$rZT=oYesUEv?)Pv!7go26OmGz%W1sY>W)7L6GntqK1Da2%i2$}lVanp z>!6IyyY*(QZ*VOxXxGR@qrKvmo+rXu1cT&s>M6&C&TE>ZCs_%=xbr9U9Oy2QA8~fe zUV=PZ{5O05q#=pwijm8EVx_Xhw@KB&ei?20+kA`p!Jnes;``I*NZ&LfC0_7bqlo_O zOY6EDVyac^W1I7^Azz*~(k7n(0XN#YUY3^pRc*@KzRmHuMR;lh|8}nG zFE5WTmzO*7RE;E~Gq&WlY|@r!dDp0zzDs?smSi5n%u&9TM7V$Umvd-%(`TUJ;Vn7< zN(N3`o^lzLkDmplK06?%^m*o!C?;}~V_VqoR3C6#W+Qj*{Q`mf z0R<_1Q27)oH+j)in%BkwV>zzmudaKsKk^^Oe)ttEdDC!0&SJa`(F*k6uKuP0riEPT~d1Pm_T z5c37QE~#g<{)2BJr%Vf{&i}mf;Sn?}vP##L$SOE*_~LvsB3aX%rx#LH9*H~6ZkTFT z#md>3Z$^sw2p3b*Y_XDcBWp@a?r(=FHyS33~V!{t-$`wZz8FwIOnA*_0&FBI7A~%;4?4eixohYH7f&_yO zm08KgEpo_0(DcuFfCj$qHo&OutEQ{BW4IQEu6sgt$Y^8-0VRIS3~rF z$7571SZ?BQsm@QGqoggZ6ymIAPrT;A9lR3j2j3y2#iiFG61fUiPtz0~<01&>u9L!iGFMFp zIBeDskYa(T&jzGGyZ}xe8ggBwv3MaS1pbgu%{cV6~4Sh}h+%0k+_LGO@M>wB&aS}_pOJ7*OD)g! zhDoWB58T@Kkw8vwn7okKa2>dH4p+)3t@LuGvD`=g^rg^YRr64v_sG zXXok%|lkm$5S0!D>Id;cW^-iJ7= zkmxOSyPaD`x0M_FJbU1C{DMOd@ndzNKq@q{2L7G<=mOSV>0?!#9Q0#u1=SA!MQYbg zCzux?Pv@!pLy{cW!nNYrx491!H9uv~z0S>kEzgXk#JvmTC#kzR+~p^6)rq-D%&)KG z;&L{@)`hBd7nj4*w8rI2WPH7F**;IOnX!zf_kz+1->SD558DUg0*j#)?x@nF(}-*j9bZ0+ zy&838@m*M*RM31izkX|wmQiZ~^Y|vImU)XMg1m#!D;#765bM!QHp&jpx=JOIQa(`} zp&zpWHQE?|_bB6-B4%7Hs#bPn3m91)qhjB<8$IkCx`l>2>P$g2ey6y-Xv8T6S%D&-P>1-$eZaeL_V0TK*jgGDM$~ctiLPm_uZ4aR1DkWb5oG zf)S@8HaJp@nhym?b~6lUMpN*$B~N&`e*iRc<#hX$*`l~tM>65En@wY>8ns9xUEz;bKMj* z770vLQEvpXSTcnjPR(33W5=C26`=BefxnKw$id%OD0U%%z(r~fIQ9nkm;PJyo@3!( zDVxszSMZ;6y=vT@hS&qpdsAX#fAyb_yJ60MGj7RFot1A)t^O0j%~Y#-a_9N7|KU9U z3-a>md2VxYQmx0F+-tP#p|(4}KkFq==K>ECds&AI*eN6I-Jf8U5^&E%Q1~||5 zl_owoQ6lkKu?6%ybfxUzBcNl8XeyH?8ZBLX7t6kmAx!_4JE02_S#k4cZNce~S0n+; zqNllH>rI2)ma+AwPjm#S)yrDPqTmt#;+#Bp822YpdUEU7lcIyUIhmWmtz%D)_2Fhv z>)1gN@4kqan74VH4@-0f`pq}Qo++b}Q#eq_BB`6aF7dupP7{k*WPqZ&97J9n3GSQq zOgL~P63mb-BO|RFi)uh=T(f9K*-^AX6f?bOtZKJX1QMzshHb#Q)hmEnM zsyWIIr-R1gPT_uHeiM^g;wa#|vq+EyO+UC!V6FB!t#bD{&7=&_Vii4FwgQ~xW< zH@gzD9|q2{Q!Oot$MXDx6=1Y{mFE&iM#vk1Not~V^o`A|=BV+0WAPro<@TCWmDQN) zT$WTtWlhu+ss z$pVH*NCAp4-QzH-pWX~4K10Mv@8mN%{XiHm5&xXYfOujgBsnJC1n6TsW zRY~8&+yd3gv}~bi3#Dcgb%{@pvm^wcjVA|tTUiJjVpEIyY{q!R|a{E&d zEnYyFrmATXN@EWq(9YT<-sN{=*9*-|bdpfuk3s~kV(6!kK_T(J#13!tX6Pm~bEE_) z0IQC=YDxtzmFgEyUPqnZeN^WDf}^TRx%|4MwwCeprR_(;-o3PwZT{k3WI6LI#jlP> ze|K>Zw_Ti;JfwNJABRq_Q1vno=i$R)Dsy=&udivSST7RGX4jgZlK;edv>~JfG?nUc zc`>6{;qkkXj3auSi}{8dNffQrOlOId=ef-n65A2xvfM@`rYnHM@y2(8?svy^&_ni5 zd+iZtX0kDMPfn=mQVn6(QXz$ES2~t+^&G%{Xah* z(XRgg)ZgT0ONAKBjhWV6O8~gp5pw4>I52b2**63IetiK44B*2t#5FmTgQW+aiWw#vSN8Y>``n%V;<;aR& z7RC>r>t!7B?iBNdG7h~!2|F13AqdN%5AEvqB5pAb{ga!7?=k*jfF0_4uuAq#*4r1@ zJQ1_6+GdW4u|iq0GpFY0^w8ISS%oKii>f4sX5x0Oq4m5LonRMh6D5aFD*In#)OYgd z5KMnpI_6q)HsRTGtvTzsWXf7)#O`a>RCNwPPI|iYd0n_f{fxmLKgK`%wBzz%Me6H~ z`fdd7F*<{FO!n7G^U54KJa6gQBG!D@((?`JkTOR$ah2mQ_K;hj1t1;1Z}B7lLP27s z55n5T0if*TpK!y+`X+{dhdSQq=!U$_>-mpYD8ps_F(>vg(yaYlY}M%r{BhThZ>amF zM9qb&e`444@ytlRSV|wUt{r+t?$*fN-Jdo@ZP!kIy*~6#r+f7y)@Sa#%}FEPQ`nX> zLB7UR<`K;qM9&ND*f!rRFhTx8Tnie@zOQ<7h4e>KK~fm^U_5;wMQJbyv5CBLZh z)Z1qTxD$an`G(~iA(fTN1gdGLN#+!_&h4Q$Qyq7L!m~~w4@0(wzPX{wb1aTspU1Hh z)h!ptw)de++G6+$m&fARbd6)hXO*(VY9!4Fc}w|@i!`5Q!+r>pd=_bbE?-bca~D^( z@2m6UE9%i+pMZfxHu%C!yBSIwoesh;h=lc=dxACOr$cxEIg$VZrU zueu9ym&dQ0KGOK56)^I_e0oi|ZuMhr)qb!R`3!piR7d5MF6C%xD^`kKOzcnNx$s(@ zvD2#R$}Nd?ubXOG4b15cQ^gsiECS#YJDlWj1%P`cdcc+bIhTlCBY-K3SG0wZ4ZO24 zGEOY}l<_L_0R7eWMJi>ssdg4^1#*}&T#~E&c!aTBufT}C>Q}w^ks{xcrV3;07tG+R zY(F4OsusPm1LLb~`;iP8v91sCiZ@La_!y*95hASD2d2rY%gXZisy(=wALq8POQM}( z{i~YFsTbG;e5*KfM_np9Lp-K^rF;5Y@Nlfgy!Ns(8_(Qa^WZvf^t|{^ETA)|kiNy1 z1TB(nXC}HD$zSbpCinb5jvXwkBwl7*shlXn2gj9X_U8Eu?O?C9XO_jEhfd#0->HFy zGm|z{TeN#CZO$|^PwI6uuB6Q+X{KEIa)oDz4>* zrnFdFUH-W;&Ig@Ex}E6f%#=>b!MLr7O++cDMgCT}rP6X`^K<0n9gTK*{2*S27xMDZ zvGUrn^|g3h@V@QqdvBE|*Z#5ZvmT}+0p{c#GG>cFn7c1z5!2W9Vi9xS%&~~eD8UI1 ziB&A(B6WK&x3Gw>aFg(z&0jC;D=~biTq%+`m@E00s2Q%B5|a4I8focPX$g|}zPgjx zO2(!5XNPYK&*Wc+ZFeKuNT+HZq+0d}q3;wFCsc7R zbY^Tp(XzMIo6`#3>?R67+i>*`DbBt5RzcAZdKc|4D0*KN)ffehzEn{B<#*IKyH@9W z+fq>MeODE~SWtXVLGksfIM=0d1x3H_UG%MjBF|3M=)8hP%Lf z=Wled;yJ<2S!ZHhW+4hfLP#c8;}cXiGf_|`S7zQ6`hM(sJ`TNw&h{a%28UX#3mt4P zjeaqdI3RJy>kbj9-Rq=G`d4qYpCx^%@sx=CBY98gZY4x-B=oSB^v3MU@ypv0l7zDX ziu@xBpQMAK#CBqY2TJ`^{qSjGah1R(WAS0>z17ik_jb8Z#L{Tl$+euldb--4jZeSB zIpZr5hIFXsZb#~MXeCchE+OIH=yUP=2lhBW*g}y!QW2*Tq)pm(?_uY{-4d774UzSe zjhtlb(AsW&MbwjfC7?EoF;7bLh$S0@>#9i)8#AyFL)+^r>syD3q0S7BhsA6+65?V} zroLmLR4={2EDh%mHFt{DwjQshHGw9_ma4eJoIIiCC;d}e>dgk zv&%@yLFM)Kr9ARS>^aq;#BRC=ETd<*DWZsc=&eBHQOrzTHjNX=RH#*NsIQ9RZhkMS z_LHdXIC4Q|m;(f+h0TGburKmU& zgu`#k5ES$~^%Yg!D;jaHDjS3UmN|&14cc|p^S(_K8tin$h=UQL8t-@+`ulmsA%U|> z=b>&|KnvimKH$$cmb-%aWXflm@ zN9}aJoTsv({jT$5MOcnmjD81>$%^APC!hCflo>B)&-uYs-q^^*+eI!fr$6`P7plwG zvhV4IAU$$lmQF=)9+$cz*P%VCL+vtx;LZiNlZ~u0;@vLoD{p~=q*0o=-=#AonZ#a# zg9|ag_eWj$Kh-Hn*fstQJnWM^~%l73$`7-vKtIi}ACb&H*l{xK{^pJ!BHk14cI z^~XLHJK-1tqhrG_c+b_h#ryQU3M4(CUezf;VpAmUXrJ?CM7prGR?%jb0yQ9d}Vs~yE$xd?MI9;J2Jo4@T3LW zqJ?YAGEe2#H~KmNB1OY7og_#xyqfG3!14;+*M%2;s;|az`g+NK($`wHWp?HIxt@M* z&-|ZH_p@F6yGfnrk?u^AY#9gWl0Y)nsJoT9Ky@nzz!4jqxgs(Zz>n+P*bAVS=&yhW z=;{IGr~31#i-)k(AUxKn;}20c1-Kx1Y5Pw72_c;%soc+mVBcVQa&%Cl=JgjvI_*a| zJ4RB+d@SndG1VCp6yV#er}g9 zdH6<8NG(!MA5;8wBP=#ibAx)>HB1bV7qwxcAD5>6lj&kEX+A7(bF8}U`}>cPPC9&# z@Z+Bzf}r@$;~Nx2mZ^deKifyEf_@ZC3)@B0!W~6|D%9OgX~NgWU+=N5uJuP~UYdtzyeJeMO%Rc6La0K*`RU z88Qq}y5nj+MZ_L>sIAJ=80<6_ep#q+@xUMcocq+^vc}*uM&eW< z$ce+J8;fLf(7{zi{YZY1gY~CyAWF+8G@N*wi{GeftNU;;cq6H=QUl7utM>E{uS#<+ z*o(%KLC&_{fZ@0!66}oDf#Yu8!W74S1fQ98T3Yl5KiubyE!iHtFPMD~N0QIPqGHqLG<3iOkW0g>GA@{2 zLrlEbh107MVBd0=G=pU(WTtKfP9M!WH7#sG!D(|eL2wLDJB`J&1qlN$hEpY&-bVr> zc|G<<`gI6DK%stCze5fKBS4WlUXe)r_ShHAKqqOg8H$-)WBW zZMn0`GwY4C!8;LaQyTt})yI!rA7X$HNl5FE!#@Mbt%Kt{q2;M(!wh3X*y?JuUc$%D ziP+>?ZTKL5F%m4HUGpUV{%Z1}Tjy7-*!mWgjrz_J_k?;hXp=dN z94kH18ze*5=B$UaR-BvEcc%Rj1q^S6X{}*V&*Uxn7p?gNASjLnlpECLXtz)mtWADI z1xPVsv#>S29lTAoCgS>e)KZ@s!RabA(zEQ0TK%z7=g=eiW1Ng4ZKUp#kC@HxaPvvn zdJ_>R#u0Y^p7>hn;;_v`} zo8qjVBzp;VIrm5p^cOO}k$KN{)oRc6v&5O;_7k8)mnul;bWh-yJI-y+cg+)v(*?tG1$9#JVy>VnS5PfYEu|o9Uky!OaW$3ohUZ2S z-zh1pdGC~ypkVgbOj$hSIKH)(IJuBD#$?TWetL=Cm;uyZbyG?jUq6u?rId%Z^NfRqR!RIIp-|Tu`!+;U zKdOk+mq_Y~im42cO~Kb0KOEBiaw+F5M^aO!$o}k!W!Hs_1($b07v-XFbapuSQuOAq z9V!jmw{$gf0-q*^)-ge2~Y>b7*tv8J^UA!l%Z0rpIV)=*0 z?WlIL%c$J=99I$1^yCYnu56L)E|Ma7%2z@HnOMJYM@T3QsL@zVWEms$t_dgBz&*(g z^a_W@v)V)nuT0eZu2W`1hej{@K9iw*AM?0UsUZar{zfk+j)nnTwH&Z!hP_u4SmwQ= z!k_8SItwS(1HpCPM*GA@wW}a;q(A3z+F$Jo+gCa(9Pmd%(P|s*%iu@O!0R}-viXQb z_hM@!_KzxB0WU8a$#p!6uxSe9k?LYNj#T)=*47m>wn-a{=ECQ~_PufWp*Q7W`T%Xi zm>@@1a0nF5|M|Nmo^bO~5mStohiEZue{+gza7Fp{Fc5Kx7-oWUF-kl0c>&dhxj;V` z9VYB8A$fJQq84kH;PlEU*q*mWr=Pmghm_UJgD+xMsGE;@(&``!>3@U(J;9t6)pXuu zoC>8$BshbIbkxUpRkRe0>BmSrz4~aq=;?QdzsNVZCS?6&u+yIZ+Cmj7n$Swv839bLt#o)EEXPF5o5lv2)n zMJ~KyTR3=R&Pl@adzrKd#3UQ{kmOx-9k~VCS&Y*vxH|R<`6$DOwkZUN1a?P;v6F3E z&ycI7qV3!HsQd_Sup&m1Kv?jkXUHW|iZ|#!T^3j!z0z0pe2_CNsqEigF%|sQK^jOhn-cF76Q#DzNm;D*!cNdNc1B9sie*nj+i#>o zdJ+`DDVhe4ZY%U3nu(e}0Y{e7pXrU#w1kAu5Hr4Z6+cL^k$mX8V1c-b?^3rv;TBw+ z$&JX0Cz|#`tw;F2#iK+`wR&HWNbZefv%C%xU9RqC$=kekN$z_dRo_*$q}Wxprc2EN zWJfuNq`T)#0HI-jQj={YR|+g`-_0%V{ln^h$lD22BuMa(CJKy&^LYw=7Kx24LkZa_ z$|#=uqZ)>*#FyRLOb^k;ZXZ4N|lVNuV8V%#t-2coHR z*`nm;4&RYSsysp&6*)*(D=wfE)yzK-Dfdw-7|EA97a}RkwKCMOIf`YmX-(Q zM7<)94Ezn1B%|dZUig_@+rGzWBK=PUEpln>l}D+kmqM)_hj@Qh9jPddmf?UkoNDri zQ?+xKAr^zaEQeb7obc`TGE|Y+K38)#S}=iNmNP4g!W^3#PCX{g$vx4z1B(DlI2C`G zM~PiV*lJzE6+id!6YV2MMA2NtyDDte&JAg^RbUljWIdrSi46?N#Dl6PCDc*tmyyZj zaLjL_=1#l;IdEQt_s_++bGYPnRp)wDM_CWdq@KVh&1HA;D#a0?Q@MRi2d!k`I2EgJkka0Nra+ zh%cbxh|TIeLS}R*&BYm3dZm(mTV#kZ-yXpMj`2nNiC&(l`E|RDRf_<>`wksZBET=W z%3;?6RYeW;Cca=K?~{5m)NiU=i(6$r5Px6I<*K%fu2z-aA(a{3SJd4+X;^v?u{zRs zNlFOyFXv*>f~D*+;7D-0W)d$EX|fBr(erM_*FUdT=GfAQi()4UwZwX$>;a26F+O|v zsd2W&InZcDl;=^o7N@(B+)rs@CxrO{9tlqwVae32h3b-Q-H6R+wl3sdGc{gv8kZm^ z)(=59d&xvu53E5R?HO{km2$yk_KDW0ZVb8Y_ws0Sw5Vruq-uB#4Me;(E5$TYd8dT4h?DVZ;uq2hpXMfNnW?oVQeMVK#}~MbtUGkUH~(O5}2k;IDGC zLdd>jXD&A6th^tZOy1i9q?is<8Vkr_N^cjjWDBTLVnPW!9AT(TjOu@_8IYaysR>ge zsc$t!Qj<%G-+d#z_*50<^;2r4g&Zlkg%Ne37V6~e^2n&EoZtI>$_RKXGm_upD%{K= zusy}Jtj>}fQ#SiVIc3|gmg+{Hhw-e7t}mC?x27XWl+VU^T<7OI@TqJ_Ho3eczMnXM zQoP_o6YITcokMD+ho~nx4zS)!i~@LRCUzc>pd&T|U}`PpqAuMK_MvwSD)`16L4Pvny~E z03p*hA4|3XN4Z4577LMc*Htpnae9uwZ1}f%u|B_YH_+FRgv)Ta7t6Ng0YR&_%rmYX z0laP!JN|AZM~S({uhKF^MAAd7YVtUnu!_h62bB@Xd8`u_*i1|<@PK-#q zmBb~@VE9MzkY<=BTx0lK@Ql3b{EdAbqLc8TzT(mdt>9IanzT%w+fKbw&VR}k%j&It zvQ&PXT`Kt=nl{r+Zy+Q}R8uSG-38)_>(xiKZNLP3U7t&*@Nu&K6tYXs!v=VrlaQW~z7u~#Z6 zwnJ~;#|DlXRjMdXZx|L%k1fPF55pz5YZw-EHGLvX)C_*3k~}>?M!APaecf*)ua&#R zTt9R~gbd=fDp^nTy2+n@9eW4SSe$9M%Sej3DohV6Bcr~}d(Uv|zV}PHc(+Kbf+EZZ2y-Fg%-jfAQbslzK zEgZKTryL3HV84+Ze`#OoN8X{6V;CiYebyL%Izr>i%09$$)PSs~Ek|W(L4N0}zH^s>(|MuiViE3&q;5FO(?ORJZn3;!?1HS z!gQE`)o`M_U+mdPs&Puh`&wwZ2&19L*who}f+-J`hl8u4r)TAGNt4EgZ$xeWff+40>#%Y2Py!DbKF^BAcD+y>%ttP2TZ-@1Q_uz4xkeID<$%R^1noO%p2K z()R71gE+Xm+p1%GrEd>6!WL{_mt5UeVbu+GYdQzJ1tZD+q7H8FWpB=&&xjrFLxiR& zrhQo{>(6B$-Na`|<`#mS7r#QFIOq3aYk!t24t&Rja%F#y=V3f3U**>vHT?ZwiAeMb zbpZj3mtX^IRd_0lMINb<*xqf9S}emf68mVxzTi*15lM|NW7}Tx08a`TatOXsa&*;u zC5iWnEQdw37S?ga+EOx4;1BlkI)?TYFoK>W(JlA1XHG=_g0HkZK$#fIFeshaz$t=# z?VC$iyR4WJ|5146;3Gc^@c z%u!9ee~D--T9nZ-1{04X%7h_A(?!aW=m@n@jHm+y8F>++X)MwV9OwbDMbgLSPh<(W zH&Fg5V&iSz4cs{=@6yKLZX-EgAYl9c92Gp=s)Ad%-F>?V&h^4i#`Y1Tf%PQTd=}N&F&Ha0i~D0_CII0%vj)agY%G?R)V5y&uR7V= zJM$Kd>}BDATIXiK_jBU*&D3Hb#F2NtkMUv}$yaz4PPc~}`IlbDy@nsm)FYw+`M>@~ zVf4hVknz{^E3gt>fgaf3z4<9OIv7e;p1hN87LH{zJLvid4S?c^8VN+g&yqK*#O7;l zjHISx^yA2mt>Izouo=$#Zp5Bc))?3m#wUFH6no&Fn^|`ojMfDJ7^2eBJ}xzHh?cnM z1e3Cy0`A{;X0#Pyau%5@F#HKdLR4^soblnrMsH)_FS3@2_$}4)Ce_MBDOW6+E(;sF z4hc0;^XZQ;as5w&f`>dLV;9C{l#UX1i>1`e6t z_mv6CI&AjcZzfUgE~2|A)Bj{xl8EHcR;J1KGXxP<>Ds5cDstTTCKLW-?mm;TkQ?;2Dtzc zyaf+H&zX7O-FG*;S&ZQG|Now!k8IxeotZN;XU?2CbLPxByu6VA z_gm7I$j&=l#PY1-9eM+AzC2`$M=pOnJxzr6R$JKr1E?*R8w1C)r-p0Zu?I2#Np8c~ z`#B^qX!L9ISZQMD7JQB)i0d#B2vy}Lx@w{X2l6%u7!Ls}Fm@LMTx zaRd@~<*d4g{D*|IBw?vE>Jx6cYdLL%)O{=oT1;iRlk*2puo5Ztrh=+Vm4r%&IwhTs z9-^e${tQL1bng__YkIC)bgHyyFP-*sI9c-sAd*UpZwqQvD;|rqLP?8{w$chEU_UD5 z#r_fjyXr@dCPW15vjGw;y`3gRkn(hxCVY?YB1={!l_gz~>K}+yuVl$1sXo44N*Y;vBL1w9H+@K? zujztr*Xci&!2buVO*BohuWeNNx4x2%J5oY@);K z$TDnAZ5=xhwy%7h)pOXIIRy7P&G>-ZsJ^dx$LP;$l_2p^ubSh63vapS2g8|o~$~0Jm*{&KeZU@zd z@1qh=px)di3UA5rj-9iiUVo3AcVe#p7671$Fjz56HFiU=*5|NM`%(J~|$r*5r@%2%3ul~A3? z1ajJxp}MM+&pRk=)PCrtx1xOBtX|*dRa++B{|?PX9}qxt-yzZwtD1=W#{y0()7tIb z&{|{uUyuZLHnJJ|Umo;kC zEop9&r+7)T)Y9tthHKWeK#9(p{Tj8`$(v?P!{yPT-%xUzcf<+1Z=y*xM}R3y8CZKB zeN~E3>5rua-ALV93;GsMowT6F{G%u&TEn1gF#z3jZ_8I|`r4O_!sdZ zc=}n`1mLG%?YRHJ7w2Bsf5MwUj%>Nz!QRWC1n2DJ^xx59B`id1fu)&sB>lpf-jpyJW43rxxYQC5m@F8WK=9P ze3dMzKjGCnXu-M6EzQ`W-_Zx5!GV&my$G)BpDVfEE-6D~rxID?)xovB ztRE#+GA+%2*>Zqd-g`sds)SnN#rBU|woEJ87_Y)7v~kb*c7CCs`g@faVv7sY6*LhSn!*!) z$0P{UnP<_zVCnTz)ZQyRC?&_!MjGq;p@_wL7Fjx0c@dedz`Tb%@$zpTod{>rp7;bM z7;k-xzS@HExfBnUetf-b3byD?!QoQ%$%39(A<T=;}-AH<38+)ti_DDeiiRE*xZdFILHHL&C50{JY4Hg$vac`p)4djU5Dwz5i( z2%el)J-s{-E{AQE`@f5nkBLV29}9yruEj+Rz0&kV3yaLS?7i-a)~)o(Ky~4oPg?h znf3}zUf*nMIhCWt$NB-n@8#^xJ@+dS!Wi3pMl#RWgU^F=vhc_LQ=0*ozSLZaO)Q9mKfU?bBSHvI4Og`nxry_sdmHa8zpO79oSo7CS z;m=t8iM#j}gBho4{#>FzQ9CMCf8AaDndT1F44xySS%@HAz9jE^@aGGZJQDZ}94Zt( z><-=4h#LE{yucgE6svxpYi+ChhMl=J{~V7bT<+h-xfTYJ9#M091J`32d1D^Sk;oyz z8>Us3>@{j?co8$coJz(sADTiEdr0J<5&slv+L#}Z7t!BpHD`5hrP!HYC<|f9mmJYf zs|?%@(0?iX?~_AaW8Qe-Dy-pxAb)#N^~E7~QK%yA8m`Gecf_A-oQ&`;>OJ3$-0i2@ zH`2Yq^K!VgnPt?T$RUXMmH9DNt3$-wUV#TP=QwLpfj2N=h$%W3^xq18F7O$~UxKQT z`^r#F+P?&8ovNvNq*BzG@>76KnfWTr#pd6fSL|%a@)ej5vX_mnXGl#2;sk*-bdn;X zmApNj&HrHOd2p=VFxZPUO7R&`40JAm+>vkIq-v-juWBcux7vFe^Ovf2PNALeM%rn9 zLRR_{Ja>Z3o!UQY#)ta$ZDXEoM1J;&$;&4wwPO9DYTQc0a>%`qZ2kPQAUFd=zf?kFufCFLMA}!do{+`cr{HLcTFi z7B06R{cMqZ7-GyTv_2H|mk-6pynO3JSx@;e)|i)VeQ;;Vhf9okJ7swU#`w(gmuG>z z3getx22V3L@mYv<=MUwH_6%urRcgJpqC2(s6TcW+y(KIJvgzk~&ImLNf%+vI_kWo+^~Po1_|PGgg0lEJ_47-Rm?JYC>iOpMy+SXa%(YH^)ICu9{U zGQZ^AvbG`i0%2HsOaK1B*FZy{seVfj|JDqSLxhE`ovh7Y7YY*98q=F4rRU7U^^3s^ zmsh?o)aZ{Rl8Va6C&>8!{3)mc1E@aW}1Hmzj^0LPH0Y>50# z!iFS#25iU^xCQ%;z}TD%14D*pR2XAcnU|AT5gah_a*>pq z?S07?G^|_{3blvIle&^p35vs46D~Mqp{aZkyNv=g?=DCY(&R!5=O~b?anI{aF<}SgiUOPrfup&LLc@pZgIO63 zW8Up#mZQ*HrBE$<1upr?;|O64{&RS=*>ue|RV(bgGVqZH$HJ(aDuWm1c?(V1M&7$c zu*&&|^hP$#_+6FDQ1#yQmCyx=&>M)IzN;W+}A<{;l0HCLc747z?t1LRo9%bS`H!oRRiFkcpq5j_2! z%VckGcUc8%e^G^)afIJkNlI;9g%}fwa*Q(7+8uKrKCxY6fGF(UMTh!XR*0(T(a z6RJYwnMT#CBE2*jd$DJ|bG!@r@$4(;ap7+cLYd0Lj^F47Du%reE?z@=V<0f zG*0eu6n=^wh28TyPpJP;-SgHAkF2t}xP!QOyrOGw;3qleI4*1JNp@9Vdy*}bNfvxX zI_vu6QaUS#?9x%xrI)x0g03G32JoHAMM-_lt^gwNw`RDFiq+U~ctayk^BnsoL7lyU z-NwBS(rm9>Cn79O#{mDeQnmrxAO#tN9Kl+Vl*an<7OMR0ZgQZU9Vn-|8o?dS3bnHA z7tuX`>0=a5g9`@+JiwDUpvXM^5FmTRFZ=1)JXK8`UDM*b_M%Y#Q-zd*t~F%zh^?N8 z73Om+>KKspQ`h-Icgk1~)tpXmb|23ym#HMT9N#n+oGQ&g>=4naW5AgL5lyM=b&Q(N zs1pt6KjZ*XjyUBE4|3gewah07um3P_;PltVfrWGqCU$uIZ(<(!X=Q-jQ((Yb}!$F0* zcp1GyNpm5p@S@63FGZeZx{Jap?M0Q&CUGiiq45tl)sgVDyT>& zoW~-sTkvq0gp(r)6_JEFACb_H1m&mNFT&2H{Kz><r1Q*GriMf0A1RvXm}!PbQW z!rxE|8CBQnbqsTxu{mm-b{O>oN-oA)sUbb+D(0c2VV2yrA25{Xs!temb${_h-aJZ+ zHCUcFOPSXK+#O!y@2B+Ri&66$uWg%j&-z6=u;D{G@WW*?rf;ZLRxq|@_<8rH?@|mz z>eue6xl1(z)DMUCz}oku&0#`fsqh zt4)Subst`2Ua$jVZAXL*mOlPNI*l1k9#U3#4bp~LMj~r4-y`~!7v%d$)(CHjXhH+b zOot})I+>_iZ;wA6=B(4cum`1<6o4z-M27w~cp+oz31LHJ9iI!5CRf0wCakDYiD}{2 z@3X8pYX;9DcLj`af?#N}*l>=un3&Us(>wS!f#4Hdvm>h*JV9(YmHq3z!WQ@{>dM&? zq)b7&O{EtgdBI5~Ihi6lM+owHK~lk%j9vA-^^CofF)W z@H`0-g_%E6d}^fllalKJa%tW612QZ^j^2{%3aX~+gYb&jkt~cXpUtr{syEV#Ws!ty zg!BAB;HT)@+DPMkk;bXM?X0u=7EMrnd!K|z-+n>yC9lY4NYu&^zRmjYayO-;zDQHN zpi+ce7`N;R?_Mu+OiLV0KJ#HH6caq7=0Q5>OqflA-p_S($dzHEW)JWpr+i0pq2Ibw z*7G9xMD3l!Pz}i`-&YsP>n*&7TVI#3;&@{`#2uQEuGfv1+N1+3@c$7K2y*PRQkA$| z0C4Q{qI$c4H=Hy0rePk*G3cxvaApx5)ZLNxboXHh2iP|H>kbhoI3;UmV3pHMAOv?Q zrfg}|`E6(0dKCnh!gplD!uOelE3yW%$KNV1l$wt8+3v32o{5m(Ygkj+f{{lfaj7^V zf#$*u3$g~bZM5OUTz-(~JeGdJzh|j2|6ZnkIaVAEC_J0X$I&+Awmm3}zAnF{{G|eF zL%?X2yVqZMLcZYz;eU(eEGs(k5o?5_ussP)FfjG5Sc4whjHHc> z(SVNvOtWEXdyXOKS37r+!)#Po;J7{|yEsqb3fX$pZUg{ZA#J`VItd&lE=73+t6Jr9 z2gc=`@AqPhC@}n6vc<0izW;N%$oRu{MKa-W>sXvh{%g5C2vz3MKy12n`xJP$*t-Q@ zCAyyPI60Tn4hyW<1ZBK`DMoH&B1hF`vDzL%tKFW$1=B zXQ-BNT8$!@!nDqtyG2^8+x7BWEJqJWeVOI-_zkjG(TvfcYjmEiZsq2tTr^~=bXa?5 z&EXjl|HE?L* zFTF`YkqI|ml{!&?FyYQuZ~44cB8*S-1k2hzLW|#M!VPM>#%h1eeDjpA$jWn0xK^cx z+omVnit+`+*&^0)zMEtFvjtg8L6$m0Pyvjr`6u(Sd_h)T+Y)=;Eo0mz&hXXdc%^%) zQD~2j`#|3Dw(!4J{y2JQ`>FmOxvHdw6j^kPb(*^rWt%(rob1h1G?{fu5&9Hg#YW*t zQN@LZ9*Siy%~-D-pD6Qz|B+%P`;2)L)x+yECRrB1Z8Qhl{Ia2q*b|0s{Y=%! z20#4Fhl&egnyoLIvcrejm+cU-B}b&un!kb@)SXO+W_UDO(hOtXHGuQC=Nj|pNFrVV z(4Be$19{?zLDz$X8^#WN}a>lxGYC#ouLuVDF`A))7 zG6xh@L*VTN=4kTi`el2p_e(`m|5wimfUR;7=F$R1>48}knNHDh^0&b3nV{%+DOyKS zcVH&DW)_(LVaLfj;5e_e?pxq|$f!9%=2b1Zzcy;#QP12hDC0pJIgcK;vm&rhLK2mp zRvTfy1@s-4n}rthJw(0k8zL0ylb!AM@RENCvt8yd-OCkqE#0(@mO{J8CCv7H^=9&> z6jA-z-KfigURbtL@p5-W^znZu}rR0Ho6!#>@aXG%;0?yK$$zq3JRVA~w0xwON~1dHj9=UNuiv1TR?i|H@t zNKusgYFHy9q!wz@S_-XKTwugP@=U+0vn$D8?DbiH~U%j2A@$|L@Sn_L%?PyUOI z=VDt@!aiMPlo9<_?IAM%Z3h%V0+|vHM0TkWiSXBGnWJ8r1~cFBW++~ncvR!FDSYup zHFSt^zB~P;x2OVm4d`XmejxdCl6Q>SN2m>AXK+?6sf_8Z?d)-(p%)jyPir-sk zlP#;Vi}hU-LE2P0Jgt)8 zITg^AlDp=X4j@Hn!FTAD?!Z1Zcg%I~Npb~pdCL+#x$Y8-Mz+EKCLNrK-GLjHDB|`i z@er%_x4U79E0yt+zaEyjN_MJ)+D=yRV&&->14S_(+26tsR~Npspf{ZTb9cQ+*;{)J zd%FxN`^rWgP&V!2rQ(1iTnpt}V^-4)wMCG0?kpJ$g`{C;3o9?A#|lZusn^4KRb34C zQ|rF#20pu+GRsGMD_#(LQEtxXWJzC}&ShbjJ`;rkTT=DhWZ$Ykx1jA<)gN~NUt21Y z!Z0}-#=%z}%su=p*3N^~b*hrL@vqe+(+-f@ZByI2D1T$x+&)TpiNAn;@%9C)a=<@C zzx35fMfxpAzZLTqbREM>z+a|Qc9tp-Zj}cQ=SGKK2ay|rkW5?r~g6Mdn(gp zRbYd9zC{;Ut3fFbIziX#`b~BbLDz&I3t&0ZqMbjOq^ew?-|p7=7V5WZ{r0eaGe@eN zzvaze`g^qgTCn&znc#@WYVxd6Z;$dOJ8^5Yp+Du{un7p_{fH4)x}4e#;8X8jC4i9L zy>1Z<$L?MYNsR1X#YSqr-2Fl%g?Kjjj&}RMD)8kiA;sngZrQ&!RwJ^NhWD3lX)MWE-X%e)2IM$PLOez!Qn z?#LCs-t~qyVd6m9uY5XvxWU!dj6p#K?ph~7UqKH>cX9M_!M7{Om~z}siBPOho?KJGsM z#3Kf@rGUw(K1#`Xq5cek>s}JvfdSS0VZ~B@g++}QybS*L8Jku1->yF+GvbR>SXeF_ zT27d28>)uDk8e_iZJFU__4cND#CZF@LU8!tj#hPRp{c~aweYnpn*|25-bXVdjB0 z@L}eNCv@qca;3!(4s8kUC;?5;9{dT!Jel>PzSALRG9HSdcf7HUVO9+ zxOzN=M{4&5OiQ6Va=S$$KUF34Dteq0P%C^sPfDeDq|Dp6rTzlB*j=j}@3OsCYjz}x zi#?w?enOfHS3x=8hl?~K6yT`I-T)&5>v4>kFHc0~izjp$ydaE;(#&7WKDqZUi_p3B zA+}efGxp*cKYagcjcA8JS)f`ynls9%K>1T8I>y-S_ahqw;w~2IvI*pT-ojsx<6tka z!IUYd+Zi`c)zKmQL}}YJbl#X$;fGOnHsVEHw;l{^4}Sso8Mem4`Wf&5&d|&z@>ug< zjJ#fBRSo}{jVH7FX_7<_3BG_GMVHx=T1fvH>A}*Y&Xgu^T_U1ucq}3eDaz!Sjac#J z(Naw4D`Y~y)61UFMcXLx#*;||*ng7{EM0nrhORD?eg3Ra$_DdLX>(+M;12d5Y_8|z z&EkV7uLFD7>6172bMcwC*K0iUk@D|^K}Lfy|Ho=NxPBp^g=xqHh;n)@t3J+nL`eBF z?jJ>D)!!cxA?1g8^b+#N6Z{`2it9Jpn8C-^({#_>tY$=}Ctu7?N?ym^rcLp8tW^|* zPSdElRMAJ72(ZUInWY@1`TBT7gJjJpOu*hXYQ?FPzjU%{h@K&5NITRF8OoCfy^~U8 z2M7G@8sTC_Z5{PTRFg6*EPa2_^%HW4oW`C&Ri*S)wPeR43we39+K2jgqo}$`TIb)L zTYU$=S)L~HP?r^;k-thlqLP`9kluq2N=V{wfn=QNm$JMKkvIMp$zR+YF*dvvTVKoM zuX#y?zDu@pDzMI+$_Ew__M=#?N9VTr*mTjwl_9swv|jQ|WH#1LgD#-Ho(d8~xk=Wg zyWyV^rVxJLiV~;2seZPQw;25D%*x-2Ir(QT-4F43(wO%JPr&wz&)W`q?lk zc&M|W3YMeJ`D9dWG|^6Is~K}3PkNmQ z_o6lCR0vkTJN#Q~ak*Z625(#*AmI3S$R%*TN10x~zbJp4-Q!y~I$5Q9hcq0y)nd_%E(Xgh>;YR=th zl}61IQmwxciRffR_NuLN8zQ&dSdulkrml+pnCt5CitXb)uer%Jl7bX`nI=6LTW*Jz&PzqV&+7tabrlWP=NEtSd#*qvD_m3+Qh zDwVHK)hZR`>UGZDgjA{>OHFg`&hVmfR8N^ajZ{xr7wO24bMAJXYt#-=-+ElDWp7Ua zpJ|OaXj`6b)QHGTjJj+&1b6W~vJ?v-#kwHobYsyauIw6)WW@q%&YsdL%th600;a@z zK6MOU{#&Mm8Ua%-*1fwfc;Tg_~pr&X-mO$2lnyl z2p;A+QpM?0qzVL*;ZlWUTyn7mXfKVFW&3aqsGkkUCx8$G1khpz(A+JI)=|^Nl7V!| z@Jq?CK?b-qOKR%C&lYblU>}sW^pX-`x)W6l?Q-<)uUfEI6IOrL!7zt}|xKg6%pP*wg^t306kM?vM7BfhZYN`Zqh zjyo`NaCi~elC_kHJCgf6!0WHFl`%Iz$q%|7(lB4-kJY9@Vq=-FvcAI>A|kIxVO}2t zGm`r+k~=CticN#KR3?C|yQ*(GD54&GNGA+?+J~Ry(}_6r(nmdsk{v`ipwq!%4jJikH8SbP3O1cjjao_hnEYczTbT%c%JU zxkHPie<6GhXPaCv4%hu|a{b$S`ojH}CfC!E&reuS9J&-+zGs8y7620eNB|Kq*?&)8 zEc&gsAL(_$zx!-s{@)}icoye$48}BUXEBr=!(rpJ{IznZnumEDdN^0^$bYw^(L%XJ zi|bHwq3D{sdk%$-nmeWKK@R+xuQf{q9(~G~{kWIFsg|EzBCPbG9qy(v>PB{Dz@5jZ zJtyMPhdBf)6`wG>TB?jcBQ8T{&WY!MCas26wyXJ^=*{+s;GJ#zUhl9OWpwr=CI^3 zg|Uwtw)T-o-R`mXb< zYYf#tAb+(vLBK`iIb9BTUvaPLSKyMeQ6705?C&kQT7eD&wp&AbA1Tk+4N8@i0Cp^Yu!Pug{)o4!n=h<*nNZ6 zLNy;@UMO2Xi*XKi2nejTMKk$Nn z(LV-UV^uEEKL%W0U0$gl1FkXpP1KJ-E8}gJH~6AxAcbcOXAZhnjfI25Tt8H_w>xvz zNwiEUA_K0Ebe&2O8F01gH&H|a?MJ-%OAnna6Iayb89+B`r}fp++kZ*r+Bk2K;{ZKW z4CPl@)eLlFwYdoP3nlg|e{mL-dqR`%f+ktb$GmSoN>cFj?@QZQ$0jmd!2x;l#@_5w z-kMx}c@sXvEX|}cOLTY=YcxxAc>jA5(V>AyIgL@{PJuPN%YQspQ^0zBI{Ni~>#@o8 zCoA1-h04Q~Y~F2tR#PM#64_L3mpLYpi%cErUf}aP5DH%S0kdGqEY_r@^Y{rL`-tfK z6hH0(c+Lt~8;;R@I9U2m#74!A&&M<@O5b{|cw1TL!Qb1OmHN(+uHY?_Rk-dpoP74V zS>Pycjn^=5C@UAWTDH2Ov4VZmCR*q%L`B=g?gIOASt{N!9rH7OZzVaDJ(XIsE>!Jc z&1!ql))z$m84|fC=o(5(q|N!l{m&LQz(v3uky81qT=rQ!U)q@CFI|gHTx$nTGirat z?oAY3Jf6oRygU5#pM(kZd9Vnu`qq&#|9cF3;1zC#aR!dY5cuBEP4xA;Q!#*2fiSqP z<;Cm49!*eRc`tbZk)4wAx^39 zk7}Q@ob&yryt!Y`;VY61^?b4H*MGs9tCh#apFzIYKg32}B|H#G*dRMl4+$d3b*U6Q{*0Uo;i|+>m)eC-mL0;X^PxO&Qm_e!Y$(aOm1;tf4D^0 z1e_(^MNzpX6Oce-de8ZYaE>8HD6`==_v6cB4Zu|_qd=I=T zh7ef~9riB%Pl|)C$Bx5ZCwNM!!o=vnC&mI&7K^Hl`)_*Z2F z#`-vnIcARF#lIXM-Eo+!2<+^PH>lZ0n!ohx>m2wBL#r0P-d9V9vP53{lu%9STgP%H zwspy`VUYM5{|$z2C?xs*65p3RslP6eua^uylFxsX&-MEAt$eP?96GonbK>A5{iOj_ zr$)UjUmErEq{bN3>)jwc<#J%XAS_9Bf9bozqpvxOM0f%`A3b;{=jq~tK6=-(2R;@ZTgirm`> zm0_2bUvL1M&DqFeIc@S~U~hu0Z(!BMob2Mr<|}vT4)kQ}eYsag;FR!8Kqixp&6rD=zADNJpS?W`ZP6Sl<>i`1ftaG){Gebs zW-ff7s9emA%9c!k)rbL-Tg=JEN=L>EZJ2|C2Z(HqCYU!cSqL5dE4M5qpGa!>jq706bC=1pSs#+*NHptzI+9vc(g?fM z!;Yl(U&NI9t0U5k+n zDml`Tt=QGreY`t1=}kvc?V~ZR{g)%@`Nvd!*E#BY(2=}CC!ga;e!`L5s*)qk2|AL_ zXMtcuUO772&ykMg@jCe_M{=bj`Nt#^s(P?JEa{H4v2bH&+5kt|VVq?-({^7QMbHqA zV4P`xb)+5okJz+&M_LJK^km;r(Vk3qB=-_EdZ=`hBiZjrKH}dhxz3S1(UCk{C;!fo zJlc`GVUa3*k0W{KHPJ3r$!)w)=?#wLY)9#bbaI6wd9kDPAJFzw`UFSvN=Ncao!rBb ze1{|XgSS=bkB^L^CFn?Q*U7Iql1Dm{$E;VSpK>HuI+CAK$&p!^;YezKS4u{b204;? zx5Omvy*i4ikV-1OT@Iiv2Ju%%a;r|h!jZhhk^G@f{_2Qm>8Xz7ruS55-g6|+aU_q~ zD9Lw6Djx1g+ZLDRcBJ*(6kBenBW;UHi(p|he)?=iuy}I}7Ir$4UXM-sizBJ>KQX21 z97)f|CjHTowCzJFRl4QyC}J*kBrn7x7s-u|c zlA_xY*&pVF*Pkvjr{wFe6RDbfu`n7sxa0|Bj57SZZF$3+F8Ga<~F+%VaK5#<+P4AiGgz+6@uHT zhw~5o`e?6j3zfcS0iSw>^eZ++)jIVGI-(O)TO7q+CE*Hs=UeNk-%KuFqc`^z+6UMM znrq`UuzSdA_u8;R?FC3dcE}$^PaY0igr2UKlcA8S1uKkQt`a`V@ibQ>Laxb6<(jdsPw7_TFp!07&8$ILM__nG(TO2K&HOc5_@NeKGW8g(N!D{iCql|vye{|fY?P5k?42jjit1xaE%&n(J!q!IOfhxNW-DjgpQ968w{7Ym-A<`t#vZ8(3T|(f zhOUY>^g+s#?-(g#HCTr>Cp1#JXYLl6)SkIpWuPMRJn??=jQbu^^C#MqsSw(XmUOGK zwzbLnc679F?+K*YW1YR+Unm>U4_Fv_&%7CWbIb>7mWkB7t6?7lTm=@l*I9iq&zGzk z|1&m7V_VYAyMX09UrB^N#w#KI#!19niiLN7qC*{uV)hcjgzwR_!IjC@Ykao`0F9~qq5}q+t@4G^JM%l zHI#=PP?FPMUDx=NYFc`jBY~9)f4NEUH$ck9<1bs|j~lk%c>P7np0S6@lH>0;99i3x zlMH{Up^SGxNshlcUE@!xX~{PCqPk9nKZLu4>#r!lJK+y~tk7RhH}FS2GxqS49Dmn{ zqTQN#$?%sNO1=Y1a{Q%rjX$ZTCC7Y;{-(kos7{E#2c>L0{n0kTUv4+>2kFh&LuJYF zcQiGo!e44A8<-=XNl!qNqy1?JwF7YSTwDdGb0xK2%SZWgDPr{OQ!XG?Q@Ykyw_+#mv zv4_f%(dSV zvGtg-hsu)U?`UdFg}>BLHi+3nO8GCXwM+a-H7$M2yMUDne{A&<;*Yy8o$-fkFZk=* z4g9h7ow0|?lH+fqoGqtVe^Wz|`%^ZQF6ghWOZ-VSEq%?Az)FQbR1FF7H$ck9(;s_F z!Jp9${GsQWv4_f%M9$8x&%V!WBYIGU()7ug})Z5W`nU1)Vylz z>vrMa#DmXwd`yl+2{^njCZ4{&XyhFF1@xh7xU(?OSd=xW@D=W%s_X7i{g<(*udyhb z6ieThSbvC~*x(=f!{l1SbJSiT9-(N>pSTa zl_n63bkZe0DOW}hf9!=G;UwXH_8*RVgzg<9vym)I| zlw}x;`u8ntZj7c23DJ;*^m>G~-%Ft@lom$pMHH2tZ@0;)7_&z|P6V2nb@+6%<=s>VSiL^ zXMYm!-Ba`j?rHVsw`zBks6Wv>cUgIo_D5xv{$$ag5#;VXKCtwJ{ZYA{{Yku+PSGD$ zH>*F*YM+*-NILhK<-e$WZlCYl z^0dk>{Yk5S#DeV1Kcke0c{rUhWcx6P?ZZIXq^19yO@wpTmcy=1-+%gs`!#>*VW*$W z#?ci%?P6sw@+zag%T>-tPK&j@h}hBZa_y5lbx@=-N&0b_GD#}KTK+TtW-OZb_>S21 zj=w(Vr#))w77)tuCCa!vR=7JFI#yO~^(^k#r~h*YiQTmV1Nr*O^m@a8H`zSH>ML{W zJstH`)7=4FW;I|r@5nUcs%Qorizmo1BANjk;shBEk7gi3n#y3#z&HWB`vn<tnJzr<>-w$xJ<5GlU>)tiLTyNG$8DoVls-8lmmoEpq**ttcL#^BOFQ8LTF5;{ znK=rif);*m&OW&)<-C}pD}2MQF#HS2f_I(33J-oMdN8Z;#1hybo;CZ|w;zMYd|8Z# zHLj3bM1_s+8@>wvt_WZGC4~Fj>J9Al7-QCnmzY3f_<8!t_ZdTp!IHir?G)~Lr_1}1 zT)^Sd(^fo7c?vh-Y|&G)o?`36`9VSKr@kKLD=LO|$WY*u!Wq0TzOf(A-p8Gl6@+o& z5)a;8R4Y{jKmS``gK8qZpxN$StA{np<)mRNb(=puHQMHnb(?W`(HM5oW}yf1;}MkjOSd~Pvf^NlT#-|!1bF8#PJdp48!$BYn^-T9=SR& z6U`2GfAU2@q$P&ABMD%f$#em`r-H5MO*-i4>O!iST2{vIyJch5?*#QbO*+~rl{MpY z>MSnh&yk$cs&~tzr|*^(sNbTPj04)9QS3E}V(#OXNu71%{&t;$k#ZjlFW-(Sj6Y!U z=YBFA5g)3AUpj>+Phf4l)=RG9R#$v8tGNa|V|e^+cp!gG`N-&o{oH+Lb;o}0`&4&f z$a~n1O58`?a}jTq5?*+WJmB&@MjNISc+T~Sl`n;T-72oS=zjf|Crg)^qRc~)GIds& zwukioI+49tGX2>&%F@1LqMe)07uC6&+OM$$@KKdkKY3b?In%*13hYNa; zYBeoR<|!5aQ^VVa>8Xa7?|_#W|H{5k@ZWd8@Gq5P?{^n9q{4qP{p2_)8-xGpe9`nT z4{`WUti4p|kMdWc)nxR~z9@w~;1cXnHNL{}mZ=HoKQ+855qJ+f;3dYtvJVve_t`J} zOXXrOxF7ba$@Hu1EPK@`|M{FRn*QY>4*v*pLjQ5v*KdG-_Sq@y2}e<_MgKgdqW{$J zwy{UB=-&Y^G5(c(q2Rywe&Js#$KLQRYDh)@s2~#ZpK($)mj3yo>0ch=@Gl}W_>Z?l zR0FVI{2#qd3VXyQNOl(ei>T*3SxrFyso_nDz4c1{^cPK|7br2|8d&wZ$SU(0aMsBj-pzN{&`A;|J3ldq2aOU-vKW% z{*`^B;GbZw`?3B?<=8vkMGdLwKbgLLoRp2Ff4*q?mxnm~C)UP)1N@^`PGJwZ1Pz}> z|2(C_e``R|C}$H{^cPK|A|iz zz5)JeM+$q&QB-TuKToOfpBmmaHt`nyJK!b8zp}3s{O9Z!{-tv4E$^a+RP>+hJY$@c zjlutPzG(WFhdBHvKJEAh_-7ubu*Y0N9Txqob5M2bNZ-s!!2eUjn-YQdumfHa{EL02 z;6Ho6@Gq5Puen#BSVq>rMEkE~=P&D|Yz+QC=ZmI)d5FV5Ln8b??sVoG;GcCUg+1pe zs9kkVzdXd@ zpBXIpkGBL>0}vViuH=8@uoU*7OIYJA`sXPX{!_!75`h`m{YhE(`Zb{;oQ%EsV-I$t#X%R?Og5s3u<@s_CjkAL>z zDeO^~u*bIOU!ALV&Hq!wn-YQdumfHa{I^>8&)hHkOXb+B?nNt;3jfK@57$ZA82o?E z7ft{25Ql#xXu*HHCF}mp>($S4tPoMUuWSzW54h( zm1FNJuFg~8KiPTbI4K*0e~DG8>0ch=@XroX@E>mpyZ`t{51Yasb_rEj^v_c&{HKCf zHC@9JzlSy~^GZ=?M)g&&=0<%#Ic<)G|MdOA|F^N1^%Sn1*(=Uy*7m0vZ!e4ghe0RP zF#JE@B!Zjxch<=HYds%PQRws6#k1u6b(Z9V%GCMmgJ)UiujQ9{0((3Jd}criS!>0? z_|o090z62h-&cpN#3hFEGKt403Ejv6Wf?VP9YSE2ncv4d4#&zP&nzzN-d%8U>Wyv z-Tc}CFt_fpaRt(!U*DD+g+$URBb2B zlX9^&#GAgaGO*r5r8wLwlR!5oi|bxqIF4T7-nG$_u9Do|z^iTC{#X7{@x&Nd78c+)$=14X(Qr=A08kP5ydp?v6T#i=;Ms#rFb z#Hy!N)5SMd0ik_}?6>UvQ2!!#`U-FQ9&br_#%ac)p2fHvH0hI!?XFGk^nLF1Jsde5 zlO}%Yi+lGlYG0L9Fh_~$TLt0}@YI7YdPhtgoM-r_S~w~*7L6(^E;efM#iNim#GOfq zr?!E*f50nphsJgk_s*>9g|`#jFjlp33hNB#QUNWkTjL4%ld!Z*Vb~y)bm-8I_^ondT$- zC#1jb5x7({YJMU3^f#oNpX`;-WkhgYWz^hie?1Yvx<3L3s@$M`>q(TK&<%|KRg7QZ z4!r#{iVPrr$e}qLn&H6=tNNK81aKB&6jBg!s|+1!xOZ*vaKua|h>8$sp7bVf;C(;~ zoeilBY_ANgYdh5D7o^G{Kuw!Gp(C>;oPv0&^rmkQrz68Fq7c-nm~wmQn-IlOQKDF? zh{6-H}J5#*4;hAkn8=f14E@1^3WyK@YtB8IrM9@0@Q-Ppb z?@iw(K5Tp^8jE@qk4~#Pm#|0!EW3Yktd31UIQ^{tJ*rOfmh7ndv@)>uf>733=0sYh zS|RwoD3mp-GBh&HJW-FgH}kH+#ilrIx7m*Q_pcl;m&gkZ$TJ%l3*en;_6Ht~t$|RP z1Gc|Xci?LRlYTPZSTsodyZ;1v6kc1yLFV&h!`uP?#@ZEhTW`i6H1!@#aE4<%bkpNs zmR`JyPkF{K>dKF8s996BseI1J!D&^KNArBAH}Ccy2(KK9X+v!tv4eab zB4(xgM!VDB_Y}TYu3b$A!rsDmPsw)N-iAp&X67XrAdGhh-XR)>(58yO(;9S!*f*vPLhY?1sxV@9F7sA(vGnj+m>sf~XL!oGkuZyLFV#7q> zXslkZkrIKVSbB8*wATsY>m%Xoz2WPo z2n`>OjgVSLBu>eglQq|6`oM7j<&h9%Fis|ZKCfxs!kykimH=jyJyD9h>8)M~B1YWO z?J!ku0Dk0Q=A;vVm`U!Ds6((T#f0%ds_}Gw=&Dl)j$+T6j_|7@C<`ma1HYa%1dvrE z#_GTv_mr%Fb%LS(Lp1BeBkas#W6@b<#iNYc_hm?&yfaGwYTm#=Rn#pZs*>f^rjTv{ z<|M8(#X;eAhF`9LsX3=OXo*oPc7wt^%i8)awE1Q^Shg7Fjw%ddc2tHgWjZz+_xwiX zzGZN+m*%p-Y%=rJRMPXocPaeSVp0+2`LSZ2b7*^-??U09dVPWY1jHLI^C|+Gv=q+il3SSVaI4aG| zp@sIeG|QbYHM~e4{saH>W?nVeOnqdS%uj7vH=kyxK+XlBk*5N-Fswu(<>!}WJ6-C@2|q570}Ucx;imga z3w*xv0qhNugQd#+9w1?_nx@Rmn>s0d;aw|kiFOKG=GW{!0dZVe#4IKPM1-5yp zw>b9o9kl@|c=lY{KL-TFc?$p*VlZ2;8aPMk5TW0$- z-Ibj@J6kN-ex9hNP@E66ZeNpdj%Cnog zct^jKx3tZZjEx)kw}pQn(5+<}uJ1*+e|wodP;Cm7#=~|E*2aVHB3h)8@uALDFM|-O z$Swl)dj7$#3TFKzzV8odK(Sc9KNh+M{1PA40N%SsCF?rtrT2fAB6o0^?YGkNoav#8;sWP;VZ+Q~DJ1K^?4_~`qVE#73M^sICLM^he$qmJX>P9Gj~@5E40fG4@&@TvQNnc$U1;3p z`fm>3(sI%yB8BT@#u`&(*Npqvky`d~y96_S?BnizS)K~_c>-%Z#2hz5t-O17H9$9M zzN5G}3Qs)KY>5x zpi0YPW8iPfBJEPr*aoEe2D*dUgu@f~IleMd33%6Bb*6O}HS0{M@D;{l^{_haxXyR3 z@zN@Hs5d-6op$xb$F=N>XyZV!wk~P*9p@pcMd4bH@e&r6y9vj;In%wi-B=_xmBykq zj=t$r#s&Xo$9mQpp_?1y}2kQ~A%m+nAf&N#? zy<2v=GNk4YbfSg0yWg-;t#0uOML1Ahg{`e>o9|B+V#r-UCw*ry!#lO_LCKvU!Kl4W zb~hT7Q8R#-gt>lX5HM&i{7iZ6M?tgNxaSE)8hbFl{|Z5G=1r1^>jGRHAR2b< zN>AV|-;u*QDj2Cz6$`S8sQ@YK&8ltg(9lut(2+=lbUd4k8jdv6 z!Yi+b?nGphToQ0QeVsdfEie8pz<(d9fJuEQ`F)2V&6Ns`rZ2dxLnbsY3r_YqS97$MF<~pEb>-UWIa;0>YpnM>$VZn|A4sToU(#16U46lI{BGam)6FN zQhGW`q)>c1NG_{BjbB#AUuo(nz~X&&w)}9_yt>C1YCV(J^YZk^R#{&{7nP}eh--CL z-k3bs?%g7p19(jOW>J6(Rt#mankxmcOcE-ym2ROT*ORn>|g zey=gBerH2|)p0u;vZ@B|Y)JQIEHDT!YSc)yq)7p9-oD0w5%3P$+vpBJ;@&}y^_w0R z%(z1ep%L!8z)*K$nj|=BU*oyHlgRI1!G)Bj41oK32m7iIS$xRa*^uKq#2xG_Fu5_q zryTG-cMHd8X};ql^cw8z4UR!QWOxJTiRbys8hudgDTMJ;zt*4qb9cyWh-V zf7xR}b_aUcne2OJr&n!{mv86pksBq|)q&OZrpq^>V(GGin?$^tbn5)S$PuoJ=S`S^WJ59=kb5g zE+JTbt}onwoV3te_^x|bLpzAC>d*W(YJV3gI|sy2-gTHN-%R-iZ=jwM!lvagwaPb(D9jZn%TjL^|vZUQ^%=P8#A3PAT#RQ3d4R zJBK|6f9gb)5MX*=8$pLRaBYD%aN`hfU}}*!P+bgq%0N#UaS3IKP6<2(IHS*fWm0#a z`=kjG;3`_8`5et(n7WE?wcmI3{s7jE%h!$DPsG%UmsmHO$yU(=hrK}=8#Ej3-oge( zTJAzs9q!+9wo&_>+8;Bwob;mu^b+@RgA9J`=qh8jXx=a7-Cs+{}ux%!=`VnE;VYhDfGCB)0+PyfSj0 z=jP|4vHV;%o}X(c@N?s2ex^?2r}{Q`Xwe*@y3kVjW7JmCUE^=+J8V{Wxt_6eNfkYG6%|lIQ{8W&fr;)Qr!w*$ z%-A*OHlV>ippUEnkRIcr8yW4CcY5T==Kl1}`fsVpUvwVE{Dl1gl%I9-^DawwOTGN8<+Y_re%5nStL+u}S)&cY)V_X|?O4d( zs+@W(9k3jM+xo?C;tzZ&J?YXPI8J{KP$zu4@v)x8FDZ}#iT5lX!+$`$eV6G#wFDiN z)f$IS^=0h6tuyZLq`ph6`c#CynDg|`_kWB7HVBElroVZ#(p?=RgqGs27V?p{Pdky> z;usmD)BUW2I#&6#*cvNk+qob9+Yf4c7916AkJ*B}6f>T-eMD#f?GozU!eZn;*n3BU z*_iU3>7nmIrH7@`0wd0gISf*4SK{uDrJx7L{jP(G{~TJpKlJcjwdXcsjM(i-P7j^^ z(Z|q(G?x2muN|J69{LETI^j_vu_6+L`c?a6nv zCpkT+`=H6`!Mgu>3%5d2@rUe#N)H!F3*z|$_SixXah@?#(1YVX=Ru{1hq=kLKlJcj zwI|2Xo-XKt!`#^TaWV3PbszOAZpo#hhaLx&9?q5)#M47hO%HK*S5weKPgyTm2M_js zb3w2DqlfRRJ?&u2rq3?uVQ-i8AdTgItQT0R=)rYR>ETpqK|DQxap4bfcWG15gX6yI zLFEs(Iqr&gwO)Kz?FqBG?gu@zcS#S{ech43N<|M@2bCUzr)`@=(lm5LrR4=Ozv(t>z;NPO2g1wABeia&f;?Rf?5-G0zRYnSw3-Df@$SgGhCV=$)bqcbIH6O_V!Ta0}Vj(hhmHe!mWK7)4!$dJ8 znfRLgtidd#MeIFWFsW$S$ETJz*yFq@)*_tO$Z>IEYmvWmkY`(qMC>!W9senlUWo08 z)Rr**lL{F1t-F)ZZsbilP>Zn}5uft*eIJPyHMKYQq^Gun9F0sdw}~QCoEK|ku1<{1 zCPC&(aTi~&qfku-+QEREXI_9cl7oH?|B2E$XFMx+sLvUvK&Dx9gZ=N9;8sq0mn|-Q z;M>zpLf$#aI_pbe7XtQeds)q|-iER*jGbl0$U1-{V$6F&ouFCK0d6^%HI1}tGLIL_ zLF`}R;|rthbAgjn5I3h#en9*Ml@ZCrVxHO(Nry*lvRH(eq|w z+`Qq?|A3Cm6y-(P8W$hHRb)Mxp$EFAEUP9pE)M?IY5q{L9-rREd~vj3-YH&{W9AQA z&4V;P^Q124_$0PtNI8Evj6a~`w1P9U#PjDs*L0OtQ_}fEg?fB?S@Wlb)2P_-K{a%c z#^)oc%Q-%Y?Fv$k4~OFibbL-!Cvu7S+kvj>B~HtP5|WM&73%TnX^qbaIbVyJKd5pK z()f(A&hjGsE%7;j%JD%-e?Z4)o;o2*G(HEqrX#JIl8z4*>ha07#^+Hv?}`~8j$RJZ z_&i~qtwqKs@wt1-@!|0JfR4{c>clG1_#Eh(#J_Ww^M?xc_~cmQ^Oc-G#f%R}r3Yzz zdeAz6N96-_+X>FWQ;v_c@WAbOjCo_gLE`o2K-cu1Iy>uvzfqwcpKNP z`;BHITgORKmvej)pG&74ADQ6?a(tdpCwz(K&w;LKq*YT={zip*e0o^pqoUr%%pc*o z2WNa%Fdi}ELu+OJ#GMnT93NRB59IjtP$z(i#^*rS^cWnYOa4ZMdVE~g_^7D2G2a48`{zip*e6pmvj9|e6E>td_==>AjjuK+Ld^G4s=Z~sk5;z<_{I>@yW2pM@7Aj86VL(9h~tQ zW1Tfd=1<~t#+2hD8o~oPKJ(NGULyW>pldqPswwIGp+Y@A>DKtDsJAiWg9`N^jn5O- z*5bVg6-DOa7mhYZ=g852z z8h=kYWTpCh`flFE$K6CZtGjmjo~Z`^1}^_>;@;)APF%kHriridZ{6~eO-;+n3pcG^ zUedB+d11@j%b#ysx%{cNHOqHzuUo#`SHJu-->T)GwZF1__xjcL1@3#5_F6}x)aO@; z&*KC}Nxkp1>g@7B^ZlTQ_6_1+UvJ25cnVi~Lj(RvE9E>+s&bsiNhVdh6xi=3+fBWF z{mQjl%h#F}g{zF(m7>y(KXn6smb9ezz~#F^$n7BHRuFP)VuaLzkd@0mxZOThEB|)I zGuq}D{z=lTxbw0e{gR!REjKwY+kZruzSYak_U7fcuU{2KL>*dV8Xn!X!)0XG5f|AK zt}?G3sK7#n#6i0Dy1U+TU^NbgKe~Y5IH%*c=Kh-_5;b z87}L5t3>qkSIT{k2>%v*_WhRloCZWHjN&utDONIkW^@mqZ#vbuG5G8zz*!bRGdVsp zYc68jGFXAQEbGqZcxoNKA7h2&>nb^rht*}89y z%{er)Gks>-_~iWPOm+Us8Xt?#-ro|R%|ML7C(^IX_qf}xUCj5a?qT#)OS!Bt8bhDm z1h^6TRA~#6(`S~APtJQ3ecl|Sua^1V>s#V;4iIDTneK9inuB*SM;_wc#hsfLZgXEy=<#sb&{edgHs=i`>Lx$}C|O@J3#0K33vu8mL57Zg5Q zn2oXc?C~w}xdVtX_)L0=kc>Wib`PHyIn~fH^w~{-`{4X3=6g>YpPUCMdG5G8zz`xnr;pFRkFB_le?-f2rP$m|iS>F<$V}Tfh z&!k%VWccjeJ$ydnRP)B*vzq{~u>f{4-+SBmMBlFP*(N&H82*|0E%7N1SYz;s{3QG{ zE;3;k{IgH@@OiDJ%f2TM=A{0qaZP;- zj*#(B-75a6H~34Z{NW^=zt+?V`KNRt-7Wvl|Ia^lGRNH!|I{1ADKk#0Wo+b@O ziHShy##L%DSWzYragiUq5GVNO5yNdv9{DwJ0Jr_kI=7OLSSrwfYCulg8}@nD)^xa; zZ?^c@Z~Ny$)xHMWxQ!S9+l$-g+kT62#P4r#@tweA+l$PJECrh1k+%Vd{o4xoKE$ku ze3$&0e5a4w3(UbW--(a64UhiY^GvV(JzyyQSS|q|R*x$OX^YF~p?`B`d3`HzK5DU3Hq`JO4)AvK((|tz};=*^1H+Zx=I7OiHZ$*yzFqw4x2ybv8{>h27C+nxx z9~|Sa{h&f(>22_=-RjM4#`FA@S2xoC?~C($+D;p{=aG%Tg~3bnJZm?T+r9QvPp&Dx z{{!`vfz?3Gw-WqK1@5(No?N0FUL*sQ<@+_QD3EOL08{6prpnyaUVmGhTHaJgnk){8)*b1wH+_%MQAJPOUH41yYDPA zE^d2F(NSm&0YgEZYC8lNc+(RA$W~{oYJUQ?Xu6dKG0_$RAuIzW@aU{dS7)A}$f`p6 zFs7CCd<$-tmHssglDdyb`UcVqtn!&w`Z`DYE2I}$=>#{G?wAr)MwKVvu%g%)g1y8h zS&L!`jXUmQqegs~L$H~?>lN7!7P9qvLzh|&WWcAidjfmC1eIH?D3$h0+cdtQ?rT_v zTU1J#gMOhqckTw^B05T@^7{^0*fg}PNFh(?8Mr_fiZqGpqAAZCygEnIZKcE>25Rtd zg4wv&egw6vi9tA+tzhj;Pw1|}t-b}`(70CSL11HL@F&o|Od)`}*KQN&xnB_fAzx}} za|f&P+&Xz}n>V+`!%Cjlb`SAOrtI*BZe*O#s0>~%LzdwQ5a03RHor9<&b;r;@e&)m4)GF)8vnjAwo-V^KzZs^ECa2IdDNp0XT7r%72)`TxL1 z<<|SMm*LGa86WpujZdss-{Z+?+g|=KVOW3NqTuF~@{E>!0I7n_n}oz=8&QBqF96e? z9jK{?-%o-(^27wyoM-v7EiXj@10T;!3x96Q!%=={559$lPm%h9&6m+h>oPiN4R`n$ zN1THZwhONf>4oL&e+A#Gvkc#>sL$19|ByacCVwk*xW4Gn=wadz26)$X@B?0EKdK2V z&f-VK1nPc3dgGLG=VKgB655K>Y7)?)S4R(xW=KVZQJIr94he@6O5_`n6*5ub9Vh4;Fp|2X?1CB`Sk4WFK-8j9ZM z)PG!4zau<2B)V37V$b8Z;Da1_9zXXNCc+0>2psXbhH35iq{{ot=3A5)A8ZnFzQ1+| zpNa(i$2Ik{rqot^V$Y|y;Da1XH>O59bDk)+z&PS_ACO{uN;#GY?$!3Q~(ZcL9f(OV?J^PP?3^n8DbY3=x+y@-#^*CsJO z?4*wPj22EH3Gi`E-P@GfhEL3S&lY@;W9h~ok=N<{kpLgw+)nsB%(QlVaK92C+Ya2s z_;8SO#OEB8lJNd=P5rs>;E?Fr@QFG9*n$so4 zixcC+homDuJxw)q9iLrOzk~UPj;;-#nDc-w_#ns9jlClGB7Gu!IJt1b=NhK9K7iT;EUC+i>jj>tA@|)$b73`^z=;ouD{xb&|Cd9`jb@^C5WlI%Q7)gEg_xGgf@$fOu6SbZMTGN&D zKjo31K-VF566>p*u@N?Qp`N9`kJ7X*F3}5yhez)5fdatElbbZJdtjmSbBp0ic`26)zt>QH_FZ4*p|7fm3 z@c*Z{lr2Qe9jw6H(1w92LqQ-=GM2Rg9wk3TOxX_n??nWDH}H1}{u>atlv-CVFRKQ< zn zw!Z#2CTBGlM6p6RCVNHk2%LD=kJo~J8GG^5UtF)x5cOgFo&Ag&F<915)QO^3XJqo{ z`V5CUu`blTY`4^TotwT(eLYr6ecKB{%Y925F5}I!X1A{rNI!x_XVhY)sTRdG7cVOx zOye5XdGV3+GiVkRU8?thin{X6Id$l%(Z+*4O02a64;D`QAyRnCGJT%4KF_*>>QmM{ z*gYx#mfjB)cs@M3N$aKKgTrpo<)i%_4bd0>I6{?1f{O<()PhBP#SQI|E2CH?MZd{j ziCw+0F>x@_D$+RvnQ;*JD}1;ldd9%nyVARTSQDn zR;WnSAzG1ttH_Cr#6=V|S4G~%NL)nZBt-gVG*DUJjHTj-eI{7KZbj%Wu+`yyl}iS5 z!A0b96LSfgfYbZWL)A9Gb`T?5mfY*WdRemUt0FD1?7@2-C5N(bTtwlkRb(zBaS@R( zs>rd7#6?8@UPS_tC@keF@-9Z=A|%Jk$VUkX;vbQ}f_0{1)hL$y6|94Jt%7=wKA~9h zSFlzp)(eUye+BDridCmr@>j4*6{}IPYf@(w~JLlK&cOUt`#yLv77mUy+n zT`TV19l53d6^|ypOD0*>VyQLSpjmaicL!DR=WCUoXD|KlmeOa=v4Eo6Gxc%sMKl>T z!V`^ysXh+&knhY^;Q5jYIqNvMQbiIK;|_U2=)`f5^2j`TpM;hCSVrO^ddZza-gG2b3MX61`-dS7yLlrrclDLQ(y{aNDDE&!Aj-@0nLh@b}X+h}*6?vB#rHf^x z)4142v1-()BY#Eyo8>E))3~@mv0hNA!ky-(5K2?;Y) z|Ln)sF-0xXf=5NAqEd^s;OC~Oh;YW#pKzjGBkzzuV<}r5k3jxJUXfAFGKxQurv$yU zQAY76@{o+GlTrMMOc(Uh7sO8ke_HNB-cQIde_AFYTqDE$X&I}}ujC-pl8YMMg-YJl zf=Tz%iJ&I7oC^vsw+&-kz5@yp4Y@6YKnXBne#72YIM}xOhSh78mvZVFh8He94jFMS zB68}~`y)8}z}Y7_{lE$P4~4ylD3_t+Ebp@z*9zalrRc5Nw{ZLGbNV;roUCvqSu1Pt z?qaZ>RIE?P`lR*~6KfV&P+&I{*ew+Jt&C_#M7xNXjtFhO7cVJANBPbRe^BpUaQ6!C z%~CvCwQ-1G)uQ8P*!yMJ|0S!FXU!@)pD28jn!Q>3rb)A%aw=E&9$D|zzGq^oNoApU z&;Ga;Z`npw7a$cB+yw=92?gtAL>nU7M8pe-&=z=)Xbb#DE?%ZpzKbw?Ka-MXY~qz~ zU*ga3Cq#B%AoUj_^%R+1w7xeX!d~BlVgEtacbq87kD|PysGDPo;`oC4jei3d{~NV$ zm};_9&F9`F>)l#Rpo~hcmMs5AO!`snM<&(+PWZy!oltnEtiO!dkBI%U{)j;LLMNk& z&mkn#kG2<*?}79lAB*YwB`S>7H)?I>mtR9 zkQJ$om{^=bTFO5Q5vu%`S^mqlFPp@7swo`ZD*el9mzh|r6>B|N>ucAWSPK+uJ6YRn zx0_gh1`GWfT^Ze(o$)C|sPY%E`~|fOOya*(IW1*QOKY(nWK{A>#ac(!y4rOn)2djBQ}f4YgQrGxS-gSZm2z zTf5f8dRnozlC`yVtBExiEa(#*86QD}J~Bq0K)_hv^uNTCU#fk{lzfcJc?ok~Qj4WL zL!a{%>jSbrsKr{R!5XMoTgci{yT!yh#5q~m8y%_AAR8U2QV~LH71uE3|8N=qzuNzq zlD~oEj9pCr;#w@G8ihWoSnrede(n1v)-1*PjI7UUKQpoJl=?)U%~KH(9YD$uGW2BqDn`<|l zSoCv;e$i*;C>ase??Oa4>-S&k_utz8nzGv|Z-w#oEUCVhi}AV=s}*Y%S*vOhZLk(7 z)+Vwx)owDexIYE@MW1a?$%v?a4Y__Q}y`@+2k_`+D#A68%9(-$rnfZbUm2c{#Gj+OmP zU;XyX;$h3m)9ND`_1iPBlHAWab>V#COisTsnZcElnHt})Rocv@6ZW$DhP6-W zt5y73d_L@8;nd`oUt>+F5NpbB{knV7v{S}lRavg9j`4h$$HisSd=8a^i2?hBwzYEB zn;%-{%Ra!x$Q*kxa#s4XRjzlNay^tKbJZ$F;66gmf08*@*mKs`Z-P7U zu2O={WqfA|Xkw}^*L3#gX@R6^e$+j8$~jurSz4AqL(3}4)UqZF)w0jlvI{e`?D3ge z_KidN>cuHPQb(7Ze|ryK&-y=UazYQPTYV*tGUWRm3b*78C9GM? z^=K`tI9JP>JXXt^I#J8I|1Mwk{OL%oWlzf0vP;Hl+0!O!*#Shq#pu#!pf&vNf5*VR z=d%o|h+jWzc{ctFS#7SxmH45419$_2+%oUlHOdgBN)QPwl%BrPx6w+NO5a41+;6@}0OhTeS2@(aSAyFV&m1=ucut6|d z6+NetQOGG;6>hcAtHQPLQ^909A(Vmok}uPuy0Dt86J6|-kEU6xTZ1$i%(xYv{vZN{ zAa-Xc>xb+i1)_(Xt7VO9MHgvC7imNnsnfE(t>`1o=p&8jBX!gonc#nSF1mWDtt7oa zUUEVt$JRfr`9cX>#zqf$0X^gi^pG0#km)ezO-J{50o~&XbdMTz55xtgm;T2L=mn@8 zcFHM4n?>fVCa988jjTBo-<8XFgaU;K3HARs)e4khUmEm4E{#@$9+-~R7m+zLVRl8# zZbBU{#V_D8`3YR6*5D#_jrI<2tI{Aa9!UZ>B1vEpk_1YSBrpw00;(#%{n}MQ2ANYb zp@aZ|gufXT1_6|DDMSdn`KnJ@RBo>@@2#XU)gg>y9MsVEN2hd0_yF9_aevo|0Zc7S z6JT@<4ISe&+{)iaLtTcl_S04Va}Sy-m(-^oUN;~d5aCq_m*CwtFdn_>#>Odq(4Oc| zC9N`R1W-;cBhZ0GXOz8opiNiP_}mG7Mf+tH?Up)E_yqc{guZV<%R1_}LTE_`|KVDb zxNh;Fqoeb`i@pw(0@OBRN;(EfrRdqzQz!@|?G6Jd$@!Uxnu`h3Ci6_dV$Qrh%u>a*en)iR+f+uHcy+ zqn(?6hZEu12Y8+W{mz4aml}Ac7y~a^!E;!Q zc5eOiU?Mzw0?(76AEvjHv58Lg&ol#1Oz!YJLRjI+$=+9Z9?hEEIXs>9Re0`Dcy55c zc-T&U)xc9|xkg-@#C1zrSMZGd(ypBwo(B@)*#mf<2>r65-!KDDd|p~T-!bC^o(L;E z5&kN8UKFFTbN_VKSK%2^czy_dmqXuI3_OLFYs9rlT(@-Z3Z9SM86VFxjrmeX44%@A zFEuMl2bzPRT^6*v*g!MgKoc(iKoenwCcHt%01!o3A&RgW(az34AHBl{rOW)zSzm?cHihRp=(`m9 zE->&ETCNe-CUM=;qbqnGxZSRu+x^~_2+uU&IRN_M4Sq5`H01NWr-5frfhWQWPlUe; zp57RZo$q&NeHETt6`pIMZv*t5Z{R7kTqCYc;<}}0SMYr1w$9?YKM|hYfaeL&?@Z`- zp@AnhovZP)m%tNYg(t#a1<&?Lc8#6!bkzY3n+V>EW|pU(O!JU1&mS3}>0(6`pWQ)szH zT${voOW&^GdHXG$#dA+0JUzhkIOume^vf~u)C@c|fhWQWPlUe;o(pcaYwV1tv%U(? zO$yId(6=7?{@1`$Xt_pQo5XdC))hQYjM2{2KVeT8MSHS;SwVOdjv(|m<5)DDY&C%f zn2xez|etNe&GdBij} zJ$WKN>i;u}_ILkM)O;PZ`2_8?4ehlXHE9nQ9b%I~AW*mz5UhiGpP<-n$bL7f)gBsu zNN8yEPvTGiDE~@xUdUU|3(P>_N^?HQSL9=~-%=E9QN@&eDN40y5lt=X&+^@hb}Tgp z-`Jw(6diRcb@uq9i)!q(6tYo_s2$~CWR(5|I=ZZqkd;{Ka>#E2-NA?!G1hBmq*pvW zz6N<%@@M_&zu<2Gh-;zU$0%_ta-~yNn`%!81PU8ar?qH@kI|l6QPwWx+2+`u^bhmD z7biam1Pb5lY<}@nbJxn$U!jU)wV;7>ZLIgF6Dn@HvwiIdI+kK;Uo+ZvY}vkgOIR@1 z)2mj}+oGm8Ty&&3H2w%iH=}>kAH=@|?ePJ$`v~p31-a7cY`2m}h3piUn^*N>pX z7L>IUdG2>?U*Z22FFy!$CBJxCxoTyq-@7i=de^Ns*7kKm#SII#uN^_hQuOw*p>4;O z?W?zh1#>;UY9+lb*uIC0!+y5$;o?x?5&L-0`5nT_n~bQH24gqe2$#dyAHBj!{$V|=xtYsZr9t0Qm0*wnsk6&?E;(4q}=KHHQ2N`9QoJ!%cK+lUfBMXor3 z6JEV|Is<<%Bm#wtP^mRgb|aMd6os`Q)4l4MZh79)f71W9TVCJ>3g33jNBUomimQsd z7Dj(S(e71oF4=^)bJ93SG>ZTUxA#?l6=KkKb#Y8y-Xa1s2k z(FMK?6&}*(xAX_|F9c|-q5TH5|7NuR4&(&yE!qB%2ox>^2CGq*4bX8j%HDx8u-#b9 z>5TfbKhb~Hzrrmqa07)a9P?4_A6FH3EsXYeE!w$M3qEcr#HqV2eJp}5b=BM7g0=&; zw)~?lV`+nE`-@gHwT&fxxCs8}X#azz_NTv{zaBNmfz*DUR=o-BkK?7`^{v_;5`jXT zb?wFB(}g&qdi*AojZ=UN_c*mb{fGU_-SPrAP`KPNAJzVGRdLtCXn)tDolCXguHi)*rXf;#YSki}!;Gd87KM-wyF27_5XN_WQ8`lal z;7E2CoLbF@OrMvT+?s>tO=A=Dh=Za`TqX>~r8pOt$zySuIuVyx zFR*Q}Ep4M4+BSNDZKD_1HhO_=qZimVdVy_=dV&4P?CEnp^0SvH*EnMGZKHG4HhPI|qmR}$`e<#VkJdK&Xl*NH_U(P|^c+FDKA-)Jwfo;2uzB)FY9<&L;`b+NnYIl9a}X0F3fr&3r4dse#s zXs61;80F>rw(!68j<);Xo~2dXH3Vk683(xoO$*Zb7}*@LVW9Y>C(7;(iNV-dV_rIj zu4(x^GFSJ8%= zIO^<+0mOK|BV9Jrt=h!lVAkU&A}ircDL^Wy_O|AS4zQSloRtOH@1bO)*m_x~9alRR zqsA|Jx^a5GXH~%^eO9KQ11v%V35?K-=fCp&-2fcxig?FmU;#7}-e;LuR2+(?915>I z+(d~Zet6ZZj zYNit$ifN?F9*U_$F?Cqqd;#|67x4Q8exJZ^4Ss9zI~~8%4K;YvOr2i(yhVZRb-rvk zK%a8dZ*5#WA5}s+AKLv3;Rsp?N6;Hb!ZWo57k@z25~sur*OuXg=Ip||aL~$dZ7FH* zL@o{=fh%8NEUEpVrsb0Q927UF(m@fG$t1M_6gT$|*H(cVsDRUgcj7r=(Ovhf4cfY{ zYG0-JZsxQCInfL;0ecX6g0KX#cqKzkEDvx_ev2VG91_&2&oi_OAwqlqUm0pgXxbC3 z^n=BD2zMYHs6qIF0CW>|uNU>TgN~y!?8@uFSB`yT=R7Jo#j=Z8`gsLEvG zf4>F)WE1|R75;GjQ}}~Y_=8gTgHrf|Quu@F1pXQT$0O{NakI`adXz zKPZJiD1|>Lg+HiH;2*Sgp(y@TyoJcEKu!XG?3o4r2nqb(W~hnf5r6E$1^x&L{Qu3+ zE`$XBe`2T|A&Gxj;*YSz|2GEyqP|_gzsj2!|AVN8#h()Rj|TofBmQ>~|6g11Pcz|9 zTHz1ZMTI{og+C~TKPZJiD1|?$PT-$n>q1fdsrU{ew*ol{{IO>k_#-6nU%^ll%On2S zg$(==68Qg%pgHrf|Quu>X_=8gTgX#qSDYh;Y#h;3ACvq#0 zlfWN)#(_UV0{>+UHL*P6k6q}%A0dJNJcf25B=G+OL+uDj{AWx25tjJhZQw8J+Xej7 zev%mfc2vXS-wFJ^z<)gPpG5qpS@7>+!k@IlAFh-Ne^3g4Pzrxg3V%=ve^8ykKWOVh zQT(a+HX^qIISKr+XCC+?B=BF#P!r1|{@8^N{1FoPKh4lCgarPNGSrTc#DA8=A7P3A zGy{K8-!9-^m6sU*HdMpn4+{K80skW6kJqd$|5OY9Jx%zNR`|p9QsECu;SWmT4@%(= zO5qQx6Zogtx=<82uu9S4E#lPyMTY% zr3vr{xO)M=#XlAB{{-+~Mfh(a{G}H7`A|%sDdAqf*+KEAC!V0l!6~r6n^*h zA6plS_J1n=DUn-&oCN+j^8)xIB=CoG67Xkv#2=?<0Dpu8{(om^7eWI6hZt%{Na7!q z_#-UwFE#KN_3Z-wRhJ~j{|i*Z;?D~FM*#mTiT};Se~JbFz9#%hEBxU)s_+M;@CT*v z2c_@_rSJ#U3H(!RT_}n_72izcRv;&VKhE?3{s;;D7c$hu@`!&eLv(Nz_&>?eE`$XB zzhkH!A&LJ?i9f;;|0xFkqP|_gKW%to{P&<57XMe^p9lQM5&xTr|F10gYbN|jEBxVV zs_+M;@CT*v2c_@_rSJ#U3H*b$E)>O|ifTe}n}7^$az!JmUXfhUgG0 z@c$b_yATri|CXV4ge3kmB>o6X{C{QOFY4O`{Hrc@!yn81eZ_FgMR*u%GI)@NI7B1d zr@1v7UnkUUhQi`h#YKNu3Z~&Bf2(+a2aaCOfPtfm$F1atmgBRHDFwq;OikmFAvw$S zWpTC03L_7UaxnQM$%BIIHb5v7W1G{S!`wc`EQlxvQ=>RiL$?9Ufw9mx;{YuH+RR6& zwr&o9*1~9@_EzDCXJHs8(avH>i9n;yC<*Xj3>9Z`#6J?ltf3a?2%YBOmstm63;Xfqj_#Za`(I;SFA4EhDAUx4}rs9%8k z1*l&@=oc{QH^VYB$zJQr=27ig7sfQ1VPE?~YaKNm9unT^q-sdjkOEWz?-QheT)_JR zDF7Mp){z3PIIn|LGpS}$t)yD*{(In5aa;g%7Jn%@gOW2y{g%{kN&St~-$>E-!~0)S zID9GKttYjL)GAV&a3OjDFAiA(JofV7LBcbZ=;IAv5%|=L?iuZ$NM6O~1QO5UFY}zq z>}Hbs9jV`udXm(Wr09#}ttExSssi4Hq*jw!O=>ePQXd>j<*X0Sq@q6XU2@ik^9CfI z#b4$bWbQ#y50QF^)Za<{ofLiJyf2c%;a&mnB2sHets(U(E>a&H;^nLl&(EYj@TGIs zhx14zp2c70S;5>ZNd2DF?@9fG)IUhk`O^D8QaJo9;9X4WeNyj}`V1GT4-PqV)@L6a zM4-+-dWf*^Rq;In!n63xJSv%6C8>u=JxuDKr2a{Y&c5E4NZ~NJfOiS04@iALY6~v1 zd>s1bT>gGp{(hr;zDGiM7Jr#X6?3a1^$4j)NIgaBDN=MM_s%EPK&pY%T2gCCZN){F zzZG$g{k2V&-)5B0bp!~{;xF@<#oT6*dX&_oq@E`AG%0RQ@Gc;Q!vX`|rKHx8T1RRd zF0y{ zsqMJP@^L7lbNQD27!a@GIwFK;@t1jom|KX{W27D<^$e+JNYTH``wA%>78&p^C-otz z4@pIEk>%r1NQd(6{z(w8;yN;fXYrSL%wcYGNd1x2A4&a-)W1m4ztH8(17=C zQX5HaB-Mh8EFXu0I+kzs&xCjt?MM)w#b4$zm$}U)^=DFlCiN_-XGzgv+WR`GcSyZM zs)S3O6sqqo+tG@skcbIMGA*8 z2fQmueM0IJQoC`HdD-HIdXrQe#PtC6!Amm();FLrGJyNHVI+avk zTts=in9EC(<>6RDRo;C}b05?ElGHCr-9YLFQe#MsA$2LKOG%wa>O4}XkUE7_A6!Iv zeGp|XubV8dn^E4qOmi>O+)3(AQrDBZo>T#;0#ZLB^&?W}k~){vU{Zrg^~Ob%*Beph z@=|4asYZFfVVd7C%`Zs(g4A`St|N5?sVhibLh2Gy-zD{3QYVu-nN%-aM0vdsWiBs8 zmWMYuh3BuC=GRPf2dO(q{fyMlNR1{nn$&Po!%3Y(>KsxhkvfS~Ph3QKJrQLtFIkp{ z&&I3r?qQmHnC5m;x0AY-)U~AYN#&CoMrs(TY*N{zP9$|AsUEn9@_Hc3T%Jdk=P}B= zn`!Q5n%hX-M(U@eeoD$m%17#AQWulTB9%pI5UD|=(s2>xr6bBz-T+@{V08Z-C8sgX zG*XjDO(Hd()Ob=}QeILQk-CV~*`&@UHIURmQr&S8<#k7tQC_$xCEPbOJ_T5c^-oGp zWtyp^ib)ldDk4=xY80taq<%>1hosITbrz`sqy~^m!$p+Gk;GJ9GRsRgmsid-kk4XJBLT~6w9QWuiCkkpx^&LnjLsS`+b!$p+W4N<1@JS@*+F0YJf%9!R>Qn!-2 zn$*>#Mv@vy>H<<1kQzd22&w+0`jbkNrv!Tts;uL`BP+KVUWhHQs-HOY5G%WA#>FI79STUpTpa zIzPvULv50@%E#fs9NI(w)=iiBg3Xt~4sqUzr*}`n?}ew!-%GRc8$2*no5clzU~I!2XH-^Ijd_?EBP zk+&u?GJAzqdFyG=e`!4y?2_{3kEpGAeF^&XhC^;if9;rQg7weXuXMhDDxnl#G5tR& z?^ab_r4?rAJpHAdbmyc_V9 zPmlF0sPGTw7fiJW2Y_#C8LdRD_u~l9W7S(6+h`~>)xY;C^>{$sct#KTKhk5~;HVyv z7OX{D+E4%f=n>q2dYGp_756B|YywYy0;-X0ST8KQ*v_ z1s4M%+dsK$?Vo(i6m@QYXxgdv|AzILCr&b#Up#hi|3mTHKbh^H965vy4vE^o&oP75 zvHhumz5QViVf&|at^HGunWE0^&&?omjBbj1|9``J%)@>bT@Uy6?}*?2DQy3g$RTV# zN!0$mj~T3v?N1Ht?Vl>!KecP^pL)y`b#8xd)agw7f5Upr8xYmQz5QF`w|^?zKQ(gb zgv9ON>zKjn*#6YO-v0Pl4)6bNU2Fet$4pV@_J^jOYX5Iok9qy0dbqcLbNu$lLA|9L zyG0HipSb;d9y3@S+n*ZP+doaVe_GetKkb+)>fHX&v{UW>4eK$lUsMnG_OFZI{%LIg zw8)|361RVkV+N~Z`%?pZ`{T=Ly#Kp*t^K>fFUPoO7y{vWfIgfhqWrv~=+$F~F7{^?z7|6`}9bNfS69rw8Nzi(KNd3~dL zxVL{&{PxEhQR&9?$e})o+yB^gXUF!Z2KM&Hw=>!PJ-XKZ$8Mls-~N8I+uLEfbsdqoamrj@AukKOC6WBXGBd;4RAWBd2+TKgZng$n2P zho(C2aohhJ)?*&tj&wcZw0~>d_Q%2Fr5k%k4&hBZQTrdebS>k|8H22c~~9O^@!8{&2ihm58J;_% z{(ZaF{>RQx;oSbvRL4DT`+viF%%eZPT8E6&{&jKNAJ)CnjeR4BXh}<8|2cMMHOKas zwmhr-4{us*f30inf9wpE&g~CPb=>2&|2M41Jb#gDCXy@{uTBRZN=V--E{@w9t9yxzRS`I z!ujb1q0x8|UsuP^30Kx>m3=53YQ*OykzjMHFT2r~UGKw3hv7uwTiSqzN0ziY`+^VTM>nmaQOp}U(zJ>+%pfDV)3J+5AYMqPaXKA@+Vjji=2d2 zQ7sE6RgBBfvRN_guS11!=Ax+4C0MN1vaZhov;X_ZO{hzw(~-uTnCp3-5*uU!uKaO zYgxBvXj#{0YH)`Wo;0!_Z6e6Jk1PWBpHX{wQM1~l}w$F>Z}lgThN)f&5p;Dxd_S} zUsr;w+yq5-kC?Lq9;b<}%nmF8uFl^Bkf}9}Bpylq$KkBIYw;0TAbZpIwJe-obo*rh z_6z(U#{Us0-T|fY$t(oL*JUf~NZ{+;b853SKhBTu0FLKB=9Hjch7qW{F;hts|Y%c%+Ra~HJX=O$>yk5Z`A zsWJF{A@Kt)3O^jucI~MWzwb%>ejE?KWRxTDOE%$$Ps%F%u;teszazkpQ#0asBr*{L z0r10lU*j;Fbiog&brHW)65{7BXv5D<(25_WP^nX5@Y^f#LuXR>;gGd!Pm%bYC-J*9 z9)2l0ekmsW@CjLkAGWN!<98VN@zsX-9gbw8D*`|C_;Gj}bHOiF;x{-Ue(r)c{M-bs z_)!X#8XSY)K8fEU13w&+cI{w^-?f zD1jf&+Zu<}3>W-xS{D1?$qDgu7qsE$CTPWvQmE9)G5GD5_MheOV;Jz3)SU5Vc% z@$l=Wj9)vJE zoXK_R8sLZXq{hKp!UaE^21Wefcb@=1cR?F|Zh}_)D1}N5h{5lm#IMc34(QD}IzhrTWLBzr0DN>D9m(+zDpd0XG21@eixaqW^sXc#>W5!)ZvwuU|s^+y!m;xd~eFqZBHIf7|oph{O-;2kQBY zH`;5VBKzNWBz{;ea$jHQtK-+#gde^kqVU7pwkv)d|G0Aj_+k9x3JjkgI1g!@#}z+K z;&)s^{M-d?__+yM@uL(fbzBU7M)ha*6uXR4@3u7NFw%+2P7STW279-oG5NlhEe3`y&F*5!@5XiYn5Xkyd zK_Ksgf~&pQEXK8J?4uJbQ$Q4SOV4 zmuGlRUh3=-*ba@nYZxvL=cN{hWDLXMyp+%gY+oi{>J!fE78-#K+Z~Jaa9U^tHjGEZ z-9sa=VLcj7SK1r(L28+UBYxpLOJHT4Q4p1Oh|6vDMi1`@o1+W8LjCTW2ume1Yx2{MwUSeS%5l&^a z1DuEzKCod2cu=nS!w%3*xW3X3@EhTLOgq3HELKAfc7RE+T0}O(&cQYy<+yW6 zmrw)^xDW79-%eO6=Ehno(r|<6&*K<-g{qP%>uKY@hJ7Q7|7Yk30{_I84uQYb(orSsa;pE^?H#hF zSK%3D#ox_NVc?&sCo%AMPonVOsXsOh{N0jBt=`b(4gBNUMI`=*t@wWp`$!c3_t6mq z{)sIm0)MNeBn=N8qyO9OC9N)eNEt>*wP~Kw^~}NVCggPx7%A}O&`)9iw6E~b`k^siFy(P zfA=H`|MT=D2L5hIq*jLqsk_p^KdxOy;{T-;|F2=6iQ@l1+=v4I#FiR?ztvKchKZPg zzujIVYx)DdrUw3Qb`}HwBt40Nzk3pe|GSv;h*8eK-z|yM>TzA(z(1~CN8*3bivQQJ z??mzc2W~`xe_~6|TqjFU1#OL|-g_xmoe~vK~G}f@18{Af1jSj zz~3#2)M|__Z{Q!-4kYnEV8#Dy*n^_@{~kB4z(28NNaAm^45iXmDe<@4gJew~qURJ} zFO2^0X2&t`pQtA>@OMw5k3V`61An(9Qmezo*%{J)0%D2jgt?sb8G zVoMV7$IDAPX3Vh8Mdr{ZXRK$S|J&_JvZg=KYii){W(P9xPtubZ_`4_3#~;3P5>Eqv zw;Qxf4#K7M@iNgPvdJ+SFw{(bZ$2L5hIq*fo%SJN{7 z#I<`#{P$b&{~GqMDE?QAH(0#?CbonTe~Tq79V=HR{O$HIS<~b7ni}Jen;px*znRNh z1joSNJ&D5qKY9`af43x3tNV0$qyNXXn@RllS@HiG_OmGdBQe&B{-4;AHrHxNn*)=Y zW&F3>(_~FwsD?_Lf=dBoph$(xPkNz?dax97>4?xpv< z1%Ed?oPmFxp2Wc4J&D4sKFIwQ!ajJpARv6bAW%%HAW+U6L7>Unu)$*iIv}h1Jbn=a z1J4r1pwe&17;N}h!x&WmZ5acD&nCt|#Sdi+3_rUWgOaz&7#M&KGX_fUmoeS7ie7{Z z+Na<*^07Ev(274zL}_3OWSAZr!B%ve?W%}t>Rv>0uKvgML$r1 zlMoANXfF;71)Y5FgtB|J2Op78L&3SI(7oq^(^s4O1Zb_|RbC%_Usg0toBJ=$!YdZ@ z`ryYhT~BT9J`u}Z7uthaysG)Svj3vhu|;7t+VBeW3e$P8hCLV(SehOU0JABfr?=UM zA%z9h(QrLa5%~yvFzmR9$HLxdVBG?IO!-^v$B@GE(`YyjFQF9Qr)~CRNMM0vG+bl< zF7gri8}?;z@%la*j-HizdfmRP?9GtC3(jb`-rXY8>wIN@1|Jjf(QqyMiIuPH(coi( zI2x`~XIS~lJ`Fx5Fr(oblw#)lVDMJgnU91{0t$=mF9(AZzb zG&2x`TWp<3vq_}k`KE})E#?t&y>N{Tz(uZy`f^sI#b8jsMMU8USy4f*a=@*01vb%X zzU)=`o<=E{I|Un20`SHO$3`F1e+jVmQvccZeYZMyAMqZmP&WzG#lC;gF2OpxIBv(QP3el;Ovr_iJ{6k@^Fr_)Dax zx5W)0pbnlWrHm50CvTT=c%}qI96d0~WgLdiu!u`R+zc6q=gOlZj$RqnG7e9czl%8f zXFMk3@N9Wr#L-jZpP-CKulc-jjOyh-K__E-pjFR1h`zxca4-qq^ znK86lM>-C$QKUs24LVeNpb;_hdC@Ld(VcfjF8|R*{wPJFd+-dAIl9O+DI#{_(Ozzp z{Jjoj&p)I6Vav@sitQF7^sQ$?jWozb#v!{J@{f?O8yp3HD+-9@=={Uv>jp8wZy^6T zoqvdY-C!g5Pm#X|g^2vWBwsfu2!0j$tH}3-b1>aXgU1yH$n(L(${)8jXq7ip=0B=J zMt!7wH^^haRq}M**DBAa{C#$L%UYr+yC>zYft=`%wzV!HvAqovKM)d0wzU|+Uq=4% z2H(6^Ao%mh--}{!UbN+1R&eK#`+?x%ez3i335nY%@uHsI@-86wKJp(j_~yB);AfFv zD*4z?!!CIL<(&K)TPO9-JN0{vrcVN#7*#);dJ?xT8X>F~+<^f~c5Pqv)#u~sRFI?j z!oR|I$MWzkqbb+`J)*;x(-ui$k(Tmw9+xvb-A9 z(^{TxjJB1B=+2jir*}b4AC!mhhKcg<-7r~RW=wgy@zquyqB~z6<`V@uy;0u2a2~!3 zHf3K3_Y%;o-H&@2{+s6Z(~XU`@(|tm@-V+C$mxah_RI42tMW!Tl&2flY~>-k^W|Z_ zRglvY<+Z_Y@CYi{2H(LWtYPCmd;96eBwKli?tFQe{}tr)KzZ$RZo=bmO8e}akFvCz zQJNi3-FRXv57C`350CnSoOIDwa@yEcA{~2q>&y9Kcd)&*@7q@KX zA-ePB;jOM9hd#T!=XmQyeu@&E`=`E`V=E8Qoi7h_(SjTg@4cKh+*gqI(uHm zi!hi-Puo`n#hKh&g5vz`13_8O%UC7iIHBDpC{AM!3yPE1<6!`kQ`T%jaiV&epy*$F zjiA0gFGH*R_PmU5&&#mvhy3=u47o!l<^&Eg*M0==9%2q1*RK>-^KZ|~uu@fzf9ow?RgpT@r&zM3H-i2FGD>kR_QOf@$ro7CkZ^i zJugGYQ-6t%k7r!JN8tJGc^UEXi|e-t{JuReBR+m{{SJZOx94TV$1kqmAn^P4yo~tx z#r69Ge&3##5g)&}etW?0+w(Hw;}_TO4)}e0UPgTU;`+@2zyD92m$4ReH#&mRe~Ip2 zJZgYWUq?8nv)Hedk-mBaT|!_l6<%N4ASV3bC@=isPJpjW+hX{2oht}r{S!eT@1F?* zng0re-5;)cgl6@p5&lxu$%g-l@{g(>;gRKA{GqBxz|+R6Fa4Q()gw|MJsrvk|0Z>Q zM)io)Mb`5(sz-ElO0WE#sz; zs58#^?~Se8SNF|;P;dRf;zk~1F7jB7?tx<=1RG!5mM29=*)IzAt%5z6Y#tRIW&d8V z3j})z**q&c$}Sgd*RqS^mwge~PKaOLFIUjlr>R5h-FSs-pA570hW|QiW6qsxVUDC)5n2MPoVp=nD!f&8e%M#gr z0_FzPYCUSjtjbm=7ghzUW$tG8Zec>VuKIr@7y9s%O;VZ>ng`7@vW94l?5bz%s)AfjT=>XzCAAfAWpwOl|mYl8^tQK1_}O@wV|^=L-PH zmk3z&V|oDq`L^e;o?ZYzzC^%CkHedU`{!bAY@#jM^z8Ue{AWl0(uLRrkd&XjV$85c zt!i~D$0i_uoCSw!Rj2BiTrQ4^c6zu- zufqNCrWVQ!2BBp+J!YifJG$VfPz$FHIXrNr;NNw@4MNcA(IW+atqcB*TbvyqfKqUr zE_k;<#PM-7rn(}7_g$wSOUN3h)1--=KIIW`X{ndyJU-k;TF|8{*;Y5Jq;EVoD1 zd5(`N^hgVB^pW6`nz7jev@;mO+Hqs*x^<0P0X-eqy$S)~m9j^ixXptW>T09?+?p!T$mN`5` ziwrP_2WycubGWw_X@d)>Opixl5pgxZ;-HK{eqpji(BK z{rL|0$046)k=NS@%;~E9Xl9~OhAq@)-V6_JaNmY@QErX6=_i2|RSZH;S%l1Z8S*F; zg7;Yj`Ml(a_6y`E`8UMygG(`cY!J@OLiT#8)&&;9=<{UuMd(>@=?P%#$P4M*+9Cdo z@mS6$AcMD_05*@zl`)s|9$jx-0_ok?8ycT)55!uz6%V_EYQ6Lpfgo4{tvKyg$A}p1J+? z`3pqgSs1|1l4oS{3Ji0&tHp#!pU*%D?v4R$FR741az3NxH{ingGJwq`#gYsC%<~=a z;S7p*lgd$MzG?mg3Am>Qu(@PNG=I~42zp+ zhj7o40}tQ;UYu8uV~juYc^v4D`4dENT4&%mt@3Fl0{zK1&!-@S?R|lMTIEa%sriyV zp8^*L&IXRxDsMHFADvHuj{|)J{k6)Gj(p6wAc8ZK11I49f+8&6Jl_HvM^Xm{XqCxE z`QRJ#E%0&VcVHm)=W+X+(9b-d0v|`J2L@@C3my5GZ$Sj7*auG3D*s9m>-`}0iJgBT z5k4glI7zF#LnPAszbgq@Dcjiy|===@x_y|nkRNVh@a-`5olpZ63f% z%~%I{`*<^Fz--I=iNpKMoT6mD(v0UKj>G%R9KOEH7H=;jIX*Iu{!V<~( zVEGmK)jllKZGu|ZJT`YTHfBI;Ov$k$ZRYzjR3c_@+RP;~I87*{&73cTfuVZ;@#S#& zRIF8s+#U!+LQMRgjIB&*MI+Cv;O;=KUm)2j@kO}8J2uy|1%bc(`?KN zIlsrdk{B-7m#a_N^r%@gzHcF(?|;Vn?^_lL@ji@n&sbtj;}g=0b#VPX9OF1HNtYf&hA6B7*YJG|WYm5o*MAYk<=$M& zdtMf%t`~#v zV87z}u)cl_i5UA8`TBY?__p;-ln=iC{sg|`dM1YWYA+Yb#rqK2hVM&=$`J1-=J^>S zxnbX^pLKo)Za)r(cD|S`V{!)m@$vY0KY|D*aF+bd??+&tU@zbNegysi2fk2%>(Ss_ z=HJxc{QiXZBZzRhS>8XAA3J}8(1|);oZngBf51HnTs$B2^w#xg@K28NA!B;K0dH`0 zzQOe5N8e|_KP8qQeSZP})L6a%01Z2y2%Hw>7i*K>^M&AyIdQo!xUCgWsnw)|@8Q{6 zf~mq?%aeTBV3(}NJC3qmm2FtF6_3k0{I5B^_4F^W<@`r@?BlC6C0wC^R0-^Cv~!ig z<|gHOEG%oLJY+M>{lkZk6eCS5mVGKRuvm#NRopqde)=Y@{KDBEOy8oFe@r|3T5#GH zW|Xg@v7P6!v@OgmUrdX8lL+LNFF>_0PSo(2m)k^~r~L0c;pG=1kX-%<4|ka?0;%O8 zNOOqDO{&0h)7@A?n!Sl-j+?z7Wnz5;F>Q-c@ViXV0OD#9gVK3EOj`qp5h4aEEEh2# zh9U+T(;{H>Ut#a}3JGY|SEPYfmx~w>hhXRv9st7L-vAwV@Dv1&1fu@{j{?@|_ZZDt zoj>yzQvcvD)_b1iFZBB#f1%au{Dm%y@hc(W?P$|y0hq%7;7vgwyCs6)`jH@z;Tl08 z#|?r&mYYDR>P7Ptqq8Z02zbo(N0>ea1|A6Gcn(V#(|JpnW3pL3%@(E)ftk+{*Bs^; zYYuZvHHSHZn!_A1&0({Jzs46@g^z7uIybbmKcADHm62D(QCQLO;WXZ(=l!Z~k| zI@+Xy2gc$sj>ghaIk>+|_+4L2U8Ug~mN;$WD%{1Zx!!?VX6m(kgog)8bpFJHs-k!z zZ5neb!%Isf(~?u8j9G^Pr(_xaM+x@O85@WkQt%a~Z2VBYtg?4dI?^0Sx-aeMLd@hd zxl}w@oUASL&?R-PlA>Di`x|n;r0N%HEWH|K`Z-vkO2f6jIMhT`bpndzcLor=krn=s z!Pl!jV6%Pj8 z@hE2j!G=_Y$5a%c-k&Y^3o|j}VPxutM`{cnOwuVlHVc!d^Zmk)`~nYM-KEezAs+lh zqv?KO&>fGTvw&bjH-$&BXq(vn!A#6}7@4}^(JclKCg~I&tA$O{8ISqk0S{f>1<*br z9(*L4@L2?e4Ue=KJeZ_Ycq|k)S!X<+0uOlT>OKwa z6XF5A&3G{Aj>qLJAlT4d;W0|IO)MVF#EgfLsT&^MWAI>-PT^6DiG|zv@d$XpLs$1v zXrB;|bSoYVy5n&n3kWu(D?ENE+9nncW@5&}$kYvw^cXytq*Hi2iAk3m9#!B04_)0^ z&^{p^{N%OieqqoZk26_7u%U;-<1EoOv3M{OGag2!Zg}*F!GlRUg~#tO6LrI5DtN#{ zS9hA2uTIB=7nP9n&Di-EKdElQgF$yZPGAAShMo$K0itbU@n9xqJd8};@aP$X2a|LP zkC~XFyWvp`9`MlBodoR@_K#jxJQ#GxqZq=~kP#egsx-ZbCfzSn*)c9gi(|wM75uqwv@&bcw}-nV9h~GIhhFPYfPR z(kVQygi3CB{E+HaPu11E2-PT?WGf9vu-M}I%yp{si~)J=#7#!~Zm%Ah+QOT^IJ0JEf6^59oxo#yMz#EgfL zsT&?z3?59<2|UX2&2^`_SUG$Nmfxez_qJ>Ei`uir z>7=Ih4KP~4Xaz&8FCe@J;XS7C7YKi03hzaDuPM9_;eDp?euVd%!fgn*>0xLOPp_%z zZ4I9CU|U0S`2%eYspXHgHKdpS0}GYq&tq+}{MELG-0~%6osIRa;DPkgE3k5)Ra}ow z6Fh+RroDo|dea|qTLlkby(t^xP4EELo6Zp|tT)vQ0_#n;K_+rEdjACvWH3K0JhcM+ z-~lW=%@VR$c;ac_!2?)$S|SK6JiRGou<&$^kio*!ArO&2ne!XO{BZJgg^)c?t2kN6 z_QMxg1#!Gqag)fezgBUjkU2rChzJ6Qe%CNR)A#^8Eb|+rRSXg$C*l-UL7b#j6p8#! z#wlBZ7_3!nMQ;cmI0fIe6*8x46+CA*DAPj8$9qGtzw5D z&cKSB$Zts5{lNogY8Bku6+Cd3R`EKBNGW)x{)7C=@`DGmwTfm@_Bp^$$bVO>;OX7L z1Lu~V96WHIR#7YX-;?Wuk^Vv@*t5LvhyCvlTc%agM>p(UANH?js6vFA!u}?PxW6du zZ4UdJ8M;k`J`4LlW9Vlhv_0(K&QO5}eIE9I&JZ;Sdt1Z)R)&U((7v#LA4A^}p^mV> zgCXh@_8toR4>82^&9Sgg|0VC5uzwBXzCg9Y-gROBI)*+Ip^ahxMuxb)ANGC{_J6|A zG7vA4~4y3!~U%d9YU*xy*tAG9SrRfpxb3x-yUP+QpF z#?WFBIvDmJWN1D@+5+zpZGr#D#R$KKFymjuFIA7Ow}!o|!v0m{%@jF&5cYpCY+3o; zVef}w|A(L^hrJ(#{U3q4HSFCK_HP39v#@td*uMqT*swPe_D4XC3VU~k{X0SZDD2%6 z_U{38e%QM|?B5S6E9^ZG_8$OsD)c%Gy$)Zzto&?*&rrCQpG3uK5PMuPqI=hG&!~@N zAecOC*@<<*^+)A+Ng-o!LVwZbr&ZKx6@LbZ81_6IqF+HpV5VAz|J87}IP<7jT!g*q z(zhgq1>~ES;~&2;SK+ccNt?y<-LWu#8Z25n@jD6Ys3q9rT!!V`GVB>Ep_fb6m_TQrQTo znOw2DY}oLz$>n)Dt6R>t*ju#ut&w@%j~M3_!qDy+UXYPoK0upaFd(I3dHK#ovh!7- zn%Lb@oqII@^t$rL)p$e2GW9x~Zm$E@h^=+VajgTY0QECjm%9A==Ao>|6{dQeqv~-w z>yeFmXllLOQD3^f2)?fGOZiI|CBbr)Pg~;dqp&5`2|hHwF&CAXb{Qz3xf|&2-UBU4 z#*YQIdyDh54cG%$a$_OlXnWlKA(@2}!D!h)Zao<*80o!>?o4QvkC9-~X=K)sxe%!~ zQGOGf6TFh|BPPNawC9G8WIL8EWfS5HBNey73WvCh@IMLIZYUv)IRB$;Hzd}IlGr)6 zAt$ef;JPKqiYCo4s@Sq9zegj4jjp0qh_lYM*O&P` z2gHft|3=TwsZ(GN89vTaer`+u=q=z2)_I0s?eVaGT%DFuvATSxuR4!6i|QYqMZmrw zds)G-_4oGE(f>>2_hQ3fF8q;>MtlXP{ub&07InU0a~&E0KDQ+kkFthnijvz{%T25X zcF~n02E}U*nUE!Kk5r6^X`N>KnJvRwznnQhq; zT@>wtCWk0slZ8_N2(P6Cn2Yl3H)oFN(U{+389UOt#_W1u{bqF5#{4zgaZoz8mYDkN z&Awqv%Pv(|W(^}Q{8VqYzT7yLYZWcI?!w(7xG;>b_j)3h^> z)aI|v3m(kXDpnvSZ^l8)N0YRQPZMU4Cd$ z>Gujebq<2%ALnWF^HQK*UEZ+uS_PjpKT0d})$dA2RVyz?9dpoo7N=i#12D@)0lA(r z!xl}O)$)Yz6dKS4(1o$0IXwj&Eu7X*mZZ|@dt z?jGz&DgQ{%Q>%ENO7L4Uy{H!R%?81o@@8z}6Y0AA>O9X4i<~lj4fm#=X=?dLEziKr zTlNpTqyR;$c)%p=Dc{htMwo*6bqALOH`o%aw9Bzx7n_8V%Rh>of&4^!jSMXt8Cnsn z_tbA6Fk>?-l2;$;jX?;{sXWvSPf_jpg?SLrp0Cfte`GiA6XNNKYypMzND2AKI)q-C zm^wP?)l-1Xn|CLTPI~L_xNLvs=|hUq3=mC>8Zd%KJX+N@#OICAdkg83@{01V$-6p_ zbLFIKLWi%y?UdD!IwYxKDrSsjxGif$jwCn*>M&mw3 zd_!y5B5nRcDMx|65J*XqVa(mM`K#ox6>2R1V|8jZ)JVEch?u5uOxHWutQ{S)B+D~8 ziRCx6!h->b`KnX*+J&qVo?D}RQ{pG^6KC2vRqn)xeo zRwLU(mwD>i_gojMTNGNBvs#KX0$PaO%we zhqZG7kE*&B|Ab^XpY@uAjV;&O12-R}idrxzSK_SYV13KgsX)t$k6>{Gq+^-wxcby`?! z=!%xqqF1g8r*AITLW%7y!Q@&k`54XV=K1FME}n>C4Ks@##1Xv!|C0j$+}buNMz+|e zA@SY0PuBW+I?|-4$FB3QmIr`82b+xtPJzmn|5DJXrDUqp%@{Zam6z$}taa7}ze4jD zw1t`xb^H^lmNW>2jfoX{^YF5*4-NM?sLRJyda`w`$QYTMUHqHDbs-~K?o-$*D(7J{ zsm=unSQ-SDFhcKK7aV2k%YvgTaQ?!8Lj!_uVA4_|??UF#ay``+?G`er-ICYU!p5i8 z&W#LA^YDuK2!8w8cDX1pKz_k>nRM1zM~=R~%v~(PS@F9EE%moZJ7yR~ADGUG`hVFe>(Jeyf`75CC+f=dmu0 z`Sj+d1*A^WO^{y!WQyu)bd%ZSB;C|~dSWniIf|DMbfQKT>t=1KZVWGt7A1xi7wG12 zXqxq2QKFVFM9#1_4BaFs`!h2l8T*h=6U)?B--l4cuHS&=fS^;I8 zsyB91uFguQ&Nmox21{ft?NNt0#9B(6Y9PasvzBNzzalzPEVjoKN8fcD&dNszB#Bg| zlv>F6WUI~mrCpY&`X;{1y#-BR-oIE)^Yue%Jku*jug1IRbDCGL@o>-njPHJ}OT?ON z#2s6V)q6giUP~&3nB_2nt%-K0ly4c(#4NnS~71kq{ z6bMu4#!4-z(u`(n-RVMPtHQ<}>m>=M!$sc-8{2f_!w_W1`4zqLRUI0iciEw~B^O*z zg^T--zHChB>g%u4(=)qGF-H4B>2U>NgJ&~*R;Q;9F~vPvON+X(!x3AbpCM4J7AW+2 z`trS;3t3YzDPWwVrzdYzoGaSF_`Lbhzf4AF=>oc9%adIGE60v84x|&Z*noBh$isT~ zodQ854q$Oq_wM{s#9(T(qkn5ju|J_nH*Td0Ep<0(Rjtq`jS zes^0_LSWY{Dc7q%i}uhKofzNWEjk&a$dBvh9B7qt_qTaPSNWi{GeC*HG3UT9h`)R5 zoC7Am^*0t5dS;(D=fIwh2wpi7?Yy^Ee(N0wYyYzo}2qdd(Uoy?JZ)b$+%P3%reW9@{J+-bwCfGle z1peP+UnU6$DQE>HK}bdQ+`d3U6Qyil2?2`7{$4JwR6-Vgu*HA4zD@GUdumQ=`+>nJ z(ITO?dq~}pi+f)}f?a!kF0>{WYRHA2%Y`6gx5WHh=-0W>0}`U`d+d7&IlY{T`fN{^ z1W3L>|$iU|27q(Hkcm#<$g?#x`MS1zRGLUKQnQ}zIubV6U` zLZ9YBALK$C2syZ4i&|~3$|Wq3P>F!HP(rG2f0mHy%}#`O`*I1X3P$EaHM!7vxlm;;bUGpH2N6YHCrPY_ z)v?`GVpmnF*n^;6>CE<5vW96EUT(8LC2W1KH$Z8eW`2sy*GmiON5Rr0Awafy6B zFZmQ~PfJL3{g1i0-{eAR38~RbJJRGAB%o(uKNg^tUG3J6)@Q3?Xw2Kybp9Qo*cujX5! zrOsX|K~EW(o|Vut7Jc?#B&48!OhO9MhjSq#7n1k=oK$(=&*{faxws$a;>P9TBDv7; zT&P+?vYN5`O9=k;*nJ2wnsFJ;UJ|RuP;+9*5Vs2@wpQ})V*nkj@0O6vANF<$DWcvi zAte;vl#r^unNYU&rMdKHomdZz+J929Qq%8LNZ@!#LTaq;cj8E$B_Z*%wx_F*2(BBQ zR7Aw}xzJcb+3C31b21fYX>|xGdGoo<4C54 zhRsWsylLskcheU(i`In=n7BK$T$3+c-4e5d1^cP_o<9eStpQ`oz(D01f5A%u<5o49 zxNCV;KA38qJvd;j52i=Z&dY(ymuc#aK*1)tU1{R_OVdMFa-W)<5BqjIdugZgE4vz` z)@A!Ev%KhrskVSwb5j*|zXwl-6ix57gi#JuhIQ1Zj_Ae{KqN-D-F%Nn*8ma(q8KjI~TL@%?N( zUPgdyk4QGdTR@&>@23NtR><8sZ1($v&!K}6NSH#kz}`q|mzESg#2=rE0d^1a(*>f1_vb6Y;DMEl9dUn(|w4as|4T|p( z1tAuK3i+b{nBH^9A27XN_2;L$X?C}O;r*^e8BJ!-{E|$JdTo*QPep_|FU+kySC7MLFmKYuYO(hAMJsT+MXC*^*34)w0R_{LhtDB-H zHI%)1GYHyk?L)4aJs&3B=>3rTJ5K&?tX>!GZ1fyO*uRXvwApfY$n^e%2-budsW)u& z8=}&M9%$q=K5ThAHm5HsWJg&nzf@pfE9HCsfIOMUv-&tUizVg!lz>!{18E8%fulFh z5ge`59(Wzl?kK~RPhfP-9gZjmG_~SDRJkc$N_eJ9U ztnC_Up7Y`?bbAwu4;rT}8Vz1gpziqo!CFei&g?W;OQO3A9t$9>6A31~L8@Tc-{Vq# zA@DK$$Upltrbb6T=;nCO5_C>a!&VrgG0=k2HQ`~%KaJ%=H&zFXk7QxC$$ABJ1H;_^ zp{Q`~jmurq4U&A=p?0f@2W8@N0Ix=Qj>z zmwFW~|N;p~nSF$<;S2KjWwjN`C%@KvsT| zL97jR{^pUTQoptcxfwBUD^s#l3kDxRb_!g{UIK(8K946DHg1`xCtj3}c%lK0@Kvk6JX*uFg4*~Yg!)98MIM#TbL;7;aqhm;QkM~j zp{LHeZoKM|maI`R!FduJPERd}7`K&SA}jN24euKtS{Fz@Gcr#eIF1$h6I}}YiJgP} z@o$jNKLOT&8GIl}k5lj{ynVf|UdiWyln>CTMR@p?tZh2zk1}r*+t-Upx+!f0IA%W@Bo9&iF+!L8{+@suU@Ss85tr4g zS@LdtaKG4(<9CWY7Ud^?XD3hW=Td{;ylf!i%5QY3epyTY6V;`9O|*O1IAqED#F8Uu z%s}b5FkrMGdkg(?4t(-PQN`Nw*Y0k=E~`kbjebalA!A%Im8!g;!;_zv&RtTFTpLB> za7I>3zKE}KuxeL)Uq8S0$V(!aLj`XO{)GVS{YtRZItIZ zY!i|%fS7?X$C3-&HU*3cQLBYTlzqG!AR@=l(-svDtsxqA|9ZhVzVPmQC%qCQJTzB>a~ihuW%xbIFHdq`-ZKarK)ceE#YH zD$8#}=7{1D!Q$92i7l1b(pWO{UsLLY$g1Del0zA->NQj9qP#pjD=tKKA~%pIs$M<2 zKfI;LHC^&%rbN+`nnzdo0@W>$5(Y-ITfDko%oYZWehirl8)&JXPzT~oF@$|JA0lQd zz!|zxu&%&Put;#`L*p^QQN;M#mS^DG6>iB-b~pc+Tz=hjaBaG{wnf5*jXzy2D1y*0 z3z)G7!sadWP=xV^qDiqS&+d*Ht>7i0UQ8| zW^JdiQz$-!$hQ?wrz8v1=?g+KsRNR6yaFP%*|qA495mBPK$=Bs&^VBQkAZrqO_kLe zDin7Jn>5U0(t`e!a-f@~R;`(1l8EU4Hu?di|Kt~H^12Z6zv`PDlXTDy6pNg}5}Z8e zl1ErXbc5HIA8Zp@FSz;1aSAuOsd}MMR4dbmBP;DUSO+ohD_h+W=zK@md`6~%JX-%s zZ&p=p@Ekh4+@_P z88|bzyzXAO(P4yKKu6SPJ}-Q13~jVQP!sEJ3->^m$<5L3;+sUe#EYt-#?ed(Rff$9wE`Tgns8DO^Hr_piz3PWvSsa= z`2X&p)XaqyWX?RRm=)2r1a!~Phx0DNpgz?eKYWPFfWgpxE^ z5Tzykh#d!AauGxpUBC`OpMiXr9kOEhQn=B+1mO~Jw7{U8nimh-fEht&V}nyx zsYoSPb97{;xcahAFKbsPiZxfm7fE^Yecv$VsEdwD!D7l0m9ux|MCI9gj>0CQO|Aq0FrXuH^+PfpWcYENY9MW8UbYRTt71p^a@<3+(Ui&jfk^r=#WR=}NK zf=nSF1gPr=3sLOj<}inV?&mX0Kw0vkm5pR@YjR}U z)U0enZF8V6wf>R>T@I=lSO?W7u^6!@)6n5VSFZFqN0rwa23U7ucNGzlI+dpE&ZMGk zs`Zqao(ZBN#!hXK!*armjLNhN3qS#*fZ4t~w0y>(%sxSN zBddD0Wcwhr@)?$5Sv$BLaG)Ri8PKmsVaX1|2*n?f_F-5q!=M|%dG=(Kk}SsR)spvd z9&l&HA)Pu`m1B9uqC;@6Ok3$de6W2rgWUnMYqC(~VKySb5u7q&aw15(Jj0$RCVVs_^a=5tWt7G7z590|gE+9`97whW} z;xqtlG>ej&pd-w1e-QB9g*O@JIo+TSgq?n9sviuTOnWlr6$XrAwb`%cxhtu_kFn61 z>3+*g@N{RMI~&=zzz+_d#QjhBv7Ii2D71zqdx}%WRV8wU3t1&yJSRsD*;UeC*-L@W z=FU?C>K*%K4hctEC7lN8fQJ6$5;Uk)(#tQfO8TKH9*jrK@^XjIug=H)>UgeU7~CPl zbKRC@fkmC0zsR-xZPoM73=?@?AWs(kW29N(Fce3bsbyg)bG_M zlNcIMseMU{;z(IWKllJyzAYH-5sr8{68b#ty~v{PmK_fIe&%%IM-dP9-Lm6=^l!)b+x)od`(heBS-GRNaETlqB*r^x z6EW+{GUJr5R@Qag1gn>(R?=h>zk4=L;_a=(n*8fy>!{CYnbAw1xL2wZgLbaEQhe3_ z_x06?S=kdSalBh|h)IS)j1ZSKcz__Is63lN{JxA8RzgK%w_4@PB6GBq$?rYmk*KM1 z>j%_4#Fyvl-_+l&-_79Gf9ALAZ(-~9+x5SRHCo^oa%~@oRgzc1e`mISH-lUMN)_D! z{<J!`Qbr%rjz;v7I zuW5R>^^|>?*t_A0@A?-@9`V$g*C6$UT^}dM=cxpF@Oxv$o=wb=^EzpP6)-wpI-kXc z&_+Yoy!@_{)P>F7IaDtF`!?;k>jI#2yr1@Lnq(9ona(mVOsNxpPtZ0^PbbUcR4Dx( zZT7t7Z1(&RQv$7YxI(&KD=uNOMo!5Eav&*MDU0rJV?n$BeJPh%HBB5tq`_q zUJFlr!>@3rJl9-&yus!KZaxZyr-F|X7azrfkIeJ!L?(EF9yhsoamu-Pxu@BCBaH}N zGWQ+<0rpSfvcw@?P>{8bA)dUEe$u~9Y)3UxI%uV&)KS-)c zzPGx;l85gY2FhAbRa54CH6P&;`nGNyWaF~_GPegZirW2?5mxN^d|#ZCZ^URCHnt*C zU()BS5&-fxZ55oMX63sw2}?<0Z+UcdVlVD(_t0fZ#(pK+qWAvoAU5Dkqq83FC`XC^ zixcl;pNM^8w^jRhG*FDe_rgzNwS6Q|J`8B&ces|E1D)u`kIKt*<7Qk{4dM1cIiQ8p zle~&qCp7#+R0g4^5ai$H=L|v{Wdh}ctV!n;$`;SurOL_>D4!tIJfWfc`J5^=?9yNwwyNABb8|(A)}1`nD$i(62ay=8YW2VPdm$(ws}L9mRILpdyO)TMTEnxz zWTjMHe&Z!=u6qAS8aGxuPKRqzf(5h<3VW?=!D7uT@2lWV4RITvN_}B-5^w{=)mDtN z+UVE78avlMg*@5$uC?~W1F`b>%#%2HyberY2f8^tWD;aBS+?to^=e=A+NFXbTA9Qi z8X=Fh<7`!3Y`Ki5EYtqP0!9`!ACQxbRhz910F-$pes}pWRyF65EQQ4}gylUx#aa7? zo}S8!8{zT^{(50-j&Z0?>c(eQ)w$B8nfHU_nSDGhLcFyAo|3aNf>oc6L2rVV5;scu zE|%}9T51g6+2zyjFaH*%8-rvww?Y;m3A-Rvxi4J3HjJwR*OiNxB0vtuVpgV5rw9f= z1-<$`+y&p$3pV2~YQ6ne*FU{UIWb6`#aePR-4d6FVrjl&RC*v3A&nIxS;LAzj5qYk zX1$Wrfm@hl!v)RO(t8e}vMb_|g5(;cs8sS-NCKZP z2R~sP_?`<@`B?lMM7ZQGaMREvEMf^wE}#Al`}wAjtO?2b#g$5ps{B^1XV{rreAaI( z3&q>RhkIzZ(8PmTvBuUhrV310!JD(CcU_U1jF!@b< z3Y9e$Ai2O%zUv*c9>aR%gKA zoZbs%CBtlTp6Lx@XaJ&0J#o+zEtwsngRs!;XV+Ob4Ny|y45g?V8?*lDRc+SgDusHc zQqRv{(wkS(2U(546}f!6VR3>>uU>ik7Ck-m?9AWtp+&z{?se_(Mh=IUwPUYcth+E= zboy%L=*8C-%Yiuh*ic5OF~lEh-ZVLGlq3>Tl=X*FJy?J227^mP%po#E&f-JX9(gM& zkFj@2;=}I_mtuRiRkbev>_lVTjq7WNX$YF4^2&Gh8{5QFSVy~|Tc28CxQ#C6-cJk} zFV~Ao+1`a;)C$V8@YJ&e%1gXOCFTH_QdcjQgZ9FaZ>68wA-&(>=^X7d-eOQW5s|pZ z2b>3@KdM64*wXekhn3ikX^ZyoGn+w{pIdLp_!wK*i-rbw^dS(bo43(04s6F!3;QoVWsO@)8Mey!XpQy_ znX?saUTY~0@} z&PLp*A}*E++N|HJ3T9Km;pODMX)0c zw6q}plhQ*l$=t50=$!~T`fBhTyE%;C5q#fX95PDERr`8+3@7bY7N^$gT8JKhM`?Gj zFfe{&7w##>YZ2p6$aq&p|D9;vJWupKYD0r>TbF7wmTSrTpskR}ZXGRv`KNUAb}-)> z{bOrwX+iXNtt0sRX#5gjQ{V#&xr*dNZ4J**lC!h6Xl7|`Yctyta^HVySBN8ce(et{ zgQ;EotOyR;z*e4QWoDJK(pl-~1X|b4(RA!8IylW|pGBsu-NgbvL zoflC70Ph4X8CGT08M{tuyrt4m^}BlW2sBhmHIMMAU!${bv~UZS#F;0uY&cbVD}BoK zg^2c!K`#`*XK!4op9{^Rm!@__%+B;CwO0BR7=#inmH87d7X;>#DXzOiw^p0mtXiQq z*>h9Fb|*WgwK$CoW9Uw%Vo2(U=h-D*sZaSw-O-bD^GjVJ?L1=pJwW3KoOC#qn-zJ+_z83_l9A z954Q)g_gDCQcxc@&ry@J&^x{uFj;f()e1f`Ke#mA_g@4&ql{DghRw6thz_NL#i8_g zAFyl`Ut--X6pCOeF+lcyf}*(x>xEPN#>(i7z>wIhvBj69yZ>uG)%epRN*aaGWIeVc zV2odA1YhNXnbX4QC)M`Fo;_jXGn`9{I0r4h()i7N+G2g5{Tuee7h+9O=iJ&=QgP`5 z|Jl)(gUE5Jr%T_}jqwXYoHC7=)8W!qjuQy;rMe*|xZ)`_7^N&?e5hReUsqfaT%a2R zBGn&8JBQ59A*0YQeC&9ANUr1=qS(Ua-JE!XLXnB@jxz6lYpATa zs|%t(NbES|=Zt;r+-c}}(;NnZ4t2;)7bi_*6_hf{82XkZOZ7J^@i8R~hjVH<+Qr{G zth69@E39=%DSvS9OMHa?>()cTu4@8wN0f$f{u2u07s9HgT9J7o8ZH#kC~D#A-ys3O z6ocCVRkh$rwW1{-2Wr)llOpe}CZ96O+)Gp>(zcfd+rPF$Tx4S!-c>iIib>NZp>cf8|MN)Op5w9CQJ z#AY^aS1~Z2aP>4MmTP5*MOcc0)=ob{3387G`6KBu#X9%b2>Imr5YI}Vj9X1yBQ=;zs>cES!r*kL$M5%(PNAH&hCN#BD-^W|?5cj#8J zxG3Tdn{cTaY0Avat{+0?9mUGCGDp`AQe3L2&5qNNs6vTPhdOG(w+KKHXo@P-$B~yJC!6>ZPD|0FHamfw%&m9Y*U>ojpNQ1-<;hIo zpcvNS=nk$;kaZdU&@A+1VYZt^ggF^bz)80RlWs_M@;%D>!FwbslL*QU5zGbTLRtPX z3?53%A`<~>TJC0|CU@nbCA-RyCuWmJmS)%m-8_3FkE5XdI3$29DN^YNy9+cdklHq6 z^{*akA6-^p3)s;oNo92wijoOlW}%qNlpvFnL!eSMskT)CcvLm4mR%hh{^VE<_y12C z?sl|>9XM!M;mL)=K@xBb7BI!CZ{U4CD1*5@HN2l9=((v}( zM``#lBsrfTNfDrnGne|D1@7V0SBN?#upNu~{@~_08uc~0h(99r{Q%JaEn>Y#>mPg| z2Jxd%-}jHz@Ux%)2Ms?!rX!B%VTg6$I2QF?gOy4Uc{C&q#;kNyBJlnvux`a2;)t*w z8%ck3NAHNE^8j`J+tInmq@c)|n(v&zBi$+`|9+3z(TK@r( z{z<0)1CpL|0Xt&D*Z(IC4?bGMhat)Ngp!=8+WB;ZrG!NVWzmexY*$3vw$_PyS|CaL(SZrE18N`HiD5qmW9mFL8BrivgKE zkYXLux!^88eI*KYhxCE%%}V(@sIEhLBL(v6S7)shTqwKJerbDo_{Z+l+Fo9z|88%t zyriet%FouX(ywZVU(##I-XZ;ij`cSmUjJ0q1TK71o?Es$mOrx{eo61)m|6l#Sr_=9 zYR8YHKY|gnL;K>8o>%{6dH7`?MoWFzo(=`tWrwE+JEq^C*MC*s-wwZ&mnBZNeU-kT z9ezp2E4gF(`vC01C+Vjho-V%FdFiRV{;B$hxA$Mlrw)hzsgCgPJRJTj+s9AJ|2mI; zRQ*dCu)OvU=8d09--~B=Uix4>T|4yujrQ@E`cF8#`~@A;XY$#h{0UT;SO1v9>pvMk z|Gf08`Rq`BR>$&Q!lv9~SOl@5Sf z>UwN2k?NgV>S-xrYzP&utq2z2K?!!x$wzE?w7Zw@xTOwKWwP)p00 zJa7i4pKVqTOdirLES;m~_&jkZiP}AxQ=R!h?t2i2daiZ*+&aV^B66o^$h`()Q-g=v ztg|>mL@hDg8@E_bEfFX5B3ys>w#ANj9sMRXclth+;=Cr!E2jcyKC+J6Dsd?^Gs<5$Scm(-iVW@p z)y-P+4alld!FNg#?v{HCuw(f=jq|}nq}Q&{ob8@%AUT~X2BOfMmn0`fTMl<;?aPsZ z?TprZ{x7t8yoKwd-26txpV5=BI)E9R&*h2A5ZqR^Ic#t|dxf1Mv$hUrGO{kll=TrkCTNhn^tUEjs5f zLs~=U)_}jDEc%QXt;rMH8NzuMjNwj@+C2Meqj%G1;;;@9xFbY@7))`@$Tuz5Vl=|y zod*+ky?NH2XB@Z`P+Uyu0U|kaWZwV?ocUCE+X&ur=s2{#9UXE-o}LcQ2Lpl>jvRr8 zOocOEjT-dI&dp*0^s7I|&e9rc3+d~;gvDKa-4Yw%RxtR5gG5X2ixNs&)803A*D~7{ za(A2QecyIEme;K;fFBDhOwIwOoa(fsx)lNF26TX~Z&n`yw8k$exLBMzzWTHFs}7&8!`AIE=JxJ@KLHiPTGdmg;Q$pWPYyN44z zQl@<<6ujcE)2lr(%+YS37BKfar>FRt-l)85`yS2!-74Rgq&G6CW@2Ck}Lr@{j?;FbPrKX8`cS z9c?X>65Um{VgMi7$3s2VkeS{x$%`_*GcRwPSpI6bN$?B)S^9m{#iTZ zisBF>nCZc1srnquXZ?H*{Djl`04`+BoGkp}7hNH-e1Jc(cYv1sZyNQRT~pi_JSyG2 zmRBT-!f8&Y`kQM-iQo>JTHLxteoaL)x?1)sOC!dFviAOSpy$1V6=YyfVBMs|&_2qc zF3yh;2&LJbgf*)mqwm+__zVm2JjM_qHB4tFLFI4TM9lCWp&Fm)gp# zh17*awA6(RM}rTc;=0?4=VmcpEF?zJl6nNF$6xQTjrT%64vZb))wO49v@E<|t<=*sZ+=3)IXmOPW=%%1XR?*B{TBoj$^Xbpz9TPL_I2~{ zGiT>U3MJ7~IItj2yn6IPtx{ZJEAb-MDz7Y`rd9sFTx!-TpD3?Wzke;CuYR8^U#NbU zl{fLLr<3Jd`DKWtYvMsns0`;yUm4N-b|1j6q?B4`N@&h1X*`dI>x9Ow8O+~V`ck*s zi4@vEUt6RQrz)D0<#P$jzv$0UcKk-`61vsa;E7B9pF)ulyD7ZWPcCMBx5?<@7g0j7 zGg0E8&+_4Q89r$&fB2k%bq4Y~`w@6(Rq6ZQaqnSO03To8ee@f$tTZ;-} zr)K>%5;fHd-YzX|$H$_XBL3d$l7q1heX+d)X6)Di7jko05to&u)*6=-Nmavq)XNd7 z&p8+GiBeU!Sb(a!#V+D7hIK~LOD6_rS!9?@Y<&ELY zyrjd1cYJ%23~w#kz)oMIC6eJpkb*px?}8KgmU$F^*ee%fkLE_fS(`#~x!S?TUL+z| z#-L38rU`wra-E|{_S&3S*+~{CRe;a=i-yz5h{vsoDz!GG1ztrq9a{WNTju?CX{`LW zvse8)YS+Z8isedaR=Bu$d=pOhU1trNDU9PY8=jEEU*VV<0QA`10Zec~EDarevU)Ehl( zSIY8mAMabN%@g4amma0gtR4YQXyY`^?7IRl(rHE?6|vpnr=9AhRQ4N=gBlsN0t#XeuU={ zCfehFQI-Z$!F>5zCNf6u9P?P~R!|q!EZ{>oIYr}lZZn2;%7iG?F@hojYNK49kYHJQ z?={j^Wpn*tX=nL1#B8*DLe*L-Dv7H?$&$JJGNpKyh@4diSFCbQV#xecst)tWIhG1t zz3o(#D@a_KZakn$D<_TSWKo<7UjE@I=}?i>Djjmx2_~l_n`jnSCAXPFk||DxVGagV z0Rcl_zP-qL{0olnDPzSKdiuF?$p-+T<)3gjAZCtaUln6K&{vwl+sk(eIFz{4E*<5O zu*3_`SU1u)eaMf>i=*5UGeoA90WJ=#V`w9;`51h*B0EbMzth(Ug$VO#d<&+80r%QO~l2SSEw0 zMpKQ7^uoQ93F?qE|1wEV6A%%Wi4aYMK@~xTP_w5mr%K!(?1UVulz|)ptpui z@7c>LxJssGnVjrj@4qT+_FhadY@YusegbCClgQ{F8!&r(rlR}(lOO+;VYAP<=yPLr zv)_049izR_d;L-oE8+6JRcpl`C1Dk^WIS!g$-E>p0c^PXN!Yv|g930Rnu`TC7AQDw z19z*y;VdgntQYf!_K2Cx~@}K;$B3C_Mzh(c5eNA-V9&jQrFXJ>WYe`5uJ_q(5QbY{ z02`_;=SFh%-{7;iw0|pjeD-T9M(9iGhfwy~ONg3M7r^z>IWw;mPWuU!QN|s(ep#h*B8~-YkW;Hyno|Mt3pbY8BL83mmn~@u3$}l zF{##iZWUi5m;BIO45utfgXH6C09dGMty*=8LNxjs z0HCnE=`fgFx>-|05$NZI88}_;*9*s$DZi$=`B3&0W8p%6V&$0#^o3B@lDlD$#NIBv z(gxGWi!QttH%PC3{f@KEPQ3aP+oYUHv+)KmfSAKtSZEiKXNr;d2i48MMzFLN?$OU4 zq8BXHB~-9^c34hXB;C60a^4Bx8xA~X09pvvaM)tPQi=O>$ za`e@szc~L3C*)sJ#kYU)86M9xv1~%RYejw!%4|&BG^n{&2IWeu9E(fc#xjCV!WT$Y+R?PgHo8j8@_E7DmuQc#!Xj~d8*3%I#BCoWhDJuC)ZQX&;D@X<;&P57dqvU@IW_-RUd<8XzkIY4HpWaN|4fzt3YGtaaQZ>X7&d+_KdQSwV+H;* zDkr09qBKHkKz@qK-&Ifl!^!^(CqF}dIZ%sx-#=Ae^I^GTi;>ro?<>+gS5MD%@-B3K z_UeV=q3q|ssq&hMc|soy;+cA(cxLjtNS)*j8LDK+s2A{c<6)K0Ol(y^HOU2=Gku(D zzey04xND{-in`(~kVq)iQq_`RJ}iEgKoqSIkJkmAjKoHWEQ)-8xQUt;6scf~1Uatw zijc6Gn5N1!MZeeTorYn$RyS*XM&d0JjTKlG=vrbMKDsH%omi@j7{JqXq z$HJ!oBze+fD&l4dp`zx*tNc*Cr@7WAKRPxIGqF%Y;9#_Fj$v4T>eCCSf+F76;h_c$ zi`;SjsnvR;vP5Xf(*YoC-o*M;?EB1|)?ERvr@}ssGHH4nFe6hJI>soUI%Q_vEwD6u z|M*5-qDi2*-h`8m+oG)ez&AAb<%0>3rxk)u2R2xPuc9b z=8r5!_hYo#vo5i2i;7zzrD+^tS;8>mW|3zVObsB_gS=lnd zzOcob^lQ3ZbBL4~XUV=0yJ6AOLWys9DDh1q>j*HMV?p5Kn(R1evx_ooo5Bd|keA3bMH3f8*{ulDNHM6LCuSLp* zjrSbEeB6w?<)CT0Xf?vP!megrF6sU~?+;6N-!3S25N5wDlWZRhD()qUs@}{Lqn3hX;MOs`&Li=dRdQeG1=foA8-Hu^dox1{C z%4Ethe_p?<{fBz}4neopMDmDwFiQxX^8va!S2PScLlr_n_KBX9)D_2$o~9@2WjY|^ zHDnx($mCdnSyv}f@&;SLywk_cqErcgrIg&1_%XCrnfd72DXu`s*@U}ZMr)AhHgN(Rv);%mpT&T>ffv!ONrDH*NMiyXiSmuW|LjStrGEl1v9oKwrTPGoq6&& zaaU(XY>Y1oJ-n$Ga&YCf+quDaIJn{FY`z3H!;8ZO%Lz|^O5sMYzREZK4}l>=z|B{g zUx!$x7XuUb>0y7Cfa^bgtBArhZg0trlmG?fR_QL(5MeAo@2oheBR#|~}*4c4PSc5WN>`T@lRM0ii z@3V=j7yd>x@5JB&-dV)_d-f&V!Es5&^i67wsrHKwe_t8-#`=sw=}a>6ZH)CYcYqr! zt$*@Uy;AA^(QZc1Wxr(w#{E~;D^Bur{8X*yZHh-%@CB>duK;u{mFBN3Dw?#03)5Gvi|_9`<40PFDj4#ZGY3@35C|#W2aMkm;WnbZv?6KPOh~mj{HO6caFwVJSVOn#>$x&E~ynX8#~ZS9wSmtxxZwsd_jhJ*X&-- zRr`s97t2lWKqD1}+ZF@{intR@A2nsMS?yRZU}f`}V-d z$+yM~?}m?9mzT`hcWZR=&9Uxt_TPBx`@iLHkKfDRp181+Ho z7(p}xajP-TpC!d=?vi4LcMw0&qN3M1`zHD$0q4ogIr}Hy8od#{oX#kU_d9p0{STM$ zHyhrr6yup~9?M<6yU6H$Xsf{U4Sy3mG^6Jp34E$?8K?{xF9g@9pZm^sD zIfpVrbNbApn%&Hd?vXChO9U-UREZvQNvrkG`ADvcigugRBgS`}#8&SFLZD~^L^7wx zb$lq5L*z}4e-s`7eYMfECmD=pFkq|z0n0z@PQU4{bQ(E1XIl$(CJqtBMTZ}3k&bSb zzdhdLZ*&|Tb4*n@RnkDgyXnhzB=+^5ajR+p-Ra3H-#}07_9u$~GdAlGdz%QhIy&7+yYDzUZGWF?>Xut21@F2QFKS7w)@*qnuAPC%U#Q);nXKwvmO8-$ zcyUW4(_~Kcm_i%pIZ^gqD&|UJitO8@s*d&))4TseN8Z)Xw{G^V>_G1ylcc2t@ea*9 z@4~xupOP-+p>s8vxyMZ5(~pfJhft0x9s#2!*^S?PEf3B%ADr#h0CDN0W=IMGPkvn zNr&C8Z$3DjLEDHidLNX(Jr2mnf3 zxZ_Rx^K3it1C*dfQgir09&l_gFZ^)FA8mO^(q#oFZ?c@2M2{a)`FSeFK1oH4BBIFV z#&g$ilqo3Z4TpNH9C5_FIF;=g{IJxM97d$hdam_=EW5cuxJc&mnFT5**AiI2byAvx zk1&b|Bz4_(Y9F+vvWU50hLa`QJ6F(}=+E$<)e?&q4Pg8o`k_=MMU>Ljn8jx6Ni==p5fa|GOasHbcu7`%~_`W&)Q zXDc5EPMp~0qM072=pbxl)N>|Gd~(s-Zfg`bXvvEHb8?2vpcs>5o4Ax?;U(#!U4kJ> z=*vGwWy9x!*TJ8@TA5OC_tTPXG^3lr`JpuT+wk@UM@-KNahlos^}A%k!B6Rxvi^>w zr_@$$X8UZOs?wY_SKM3ohOjKRs25c>67T5m_mm=AWDaAnGRLcHh^uca)$aQfQ6Y0= z@sbHGmv}BQ2U^lHYJ6#_^_#B`h%&+{&XEIXqlui#EO8Pr%-7|*ZZrCwGCATN`$?my z8P@i3sux=F4uF$8f2Kx8IJz{Z+0_)v>K`b~ z=H+E{H1;)$UYTwbL@=>SpHc%L1cin4FpLA@CO9^(-S=Y%(hNT0r|Vm#3+9!jSKj#Y z*3-fC#C@FQu|f`Pf}3@`WJ3Glg1x-YG7od}%Bd2)ky_)J53oJsws-F{a0eG)&!jnC zs}bVB6Ee?XP-sV8*`geG7jHBu zH+t=1%Y{(-N1bbBpGVzZ5IZh&mZLv~jlJ>!ci5cC7_8M&E%1k!#@rBd$LOUWLrKfQ%g1qDNB~H|Odf4gi%kH@w4OSPO;;}|^ z%^hWRJU*>ee-d=z_?KwHs~UW5m6zai`K@yD3XkwyRo~dj?eb6jQPnGheWPC|nFJ~o?W?CRp;ODH z7T(lc)QLWQrdVGNML3tZ*rKcoR*`7o%56s-h~{$yxvSJE9tQ_y04c+oZV?>F{h=5w z8fgpZmFX;WWAGIEd9p6gM+@u^0zhhUcG8>U1Z#C-v2pvl@X)Lo-3KmnWaLMZHOY?KRAfV4go$dV9t63jtVW`-r3Lf zJFL44LzOR$H10m9%zh2(;Z_n6_)$dnaHL(3{fiImgUXf{oC~$tUx+=;z5h%+(B#2U z7VDJ6s#L};kdOp>su3=wR9uVLWSd?~S}LC1c_!$P@phr?V&G!?Sx7Cd42l~pcZvh_FV~Z`HnjEF3zV?AN)@PW26C! zYDsao)YI(20aR(`Ojllqur-IPzl@GxN5`j64C%b~8WMApxPUVqhMy2K{#`y4PRu02 z5+3&=@rZ$R=C+<~atC8++uPzV`mBV@^u$H9w_d>^*Mg?I%kmEr+0RZU6X(k~GMoe) zC&O_FZSn8QnT(c56B!F8NlFG@VeHi;8uHpb z>#ElCkO`tzZlZ~m>D;ToUd{W>{&H2ln7R|onK*Fmn-1UKU0x{FxZkysG?y2p~eaPu{>oMHC2K*p*jhJB;iv|s<`zy^uv>E?BS-VI&(cNW6L5L>lOAkp(f%ilO*Quw@~N@7gg&0TRRWuJ*rJIMV!eC7m z=GQ6QJX{sz8J-FNoJOO_`e2pJWQ6Z&4$hY!77g=+9|P61=HESxH`UNuamRh>bxeF* zsX8EHem~P)>0{S|;LXv~oeQw6Q*AW?pZW70JeF1_jJ-qgRm8lbLWyg3fjmKTc1h+> zoB>-<7d9vQWQoITn{pqVTIQgt9#mp{)?6@qwrV-JAYk595-7Y2LYh1`P&l>N;d7bs z7+_SbSTB1EHMnvo*WN3{h0F^?fsI>=aX;b7#gahvUhS6&X;F?&O(P&Z)qeS)gofPm zh?X8kNUbogtsqZ83*Pbwe?(RVj9K#o26<9vlP7G(7GzsX$=X@wUZsCL<&~y`EGT%c z*>8?7slK{Id!U8>IPW_$=89IJcV75W!_O>E3GfEvJdM)>8n5L{)B=7JOh(Ju4;jHKX=JG%osiLiDo0GL{jH5h)oFb+7Af?dg&>23p9(NNmEJ|c3@97?>zU7hG z_eePQbDj|t9-LC=l0wYQ{VzJ;4qogN;YF$vmrHcF9W4>#`_}v1#V1QzfhTCpE(sd9 zvKw?=DZO{uXha#~C~PDzg{DVjnaZU@xPbBJF1@#9@kJ#8b7qO%nU7%gt;O1d_qpIo zlGNMY#)vZQ!P_MjN)w99Jg4TzBfvQ5XfQHj)XPZ6c&l$jh24wlT)2WmW|!Q}Q&T?z z@Zb<2Nnb%opwOLnAyp@-AlHwPr9#I8xDv07i_c8Ggw=zJIz_={UQt#!t++539ouEh zC^0T$Ccg&+w8a_(5=GZGL&q8sE5;+49@Xzg14_74cVAX==zi16%*%@luPQM^C54w3 zSMN7Qm!KEU;=bS73cs;N?s~+DPw`;z5&L)42EF*J*95f7mS_GcUC0v^aS;{jyqB!G zt4Gk$pP~EO1Nb9wTchSe!a`Bb#pfu&_!(cyccw&k#nQX;f7R<;ixX+8oFd~mo4N`;WOPRp6!1E$K5Q6FvhS)r-&u?&kLG8it zC1Td<$+tR&oW8qDnS$@*5eM5$RSm_M+;~-8RR6ThwXzc4uN#A`*H=?aY$(V$Syf+p zhAh0Ug9AqRlui&arj#lTLDp02o~8on>W00-4STG%FxQ~3<^z+HeY`9=oX%Bk=4w!9 zYpYpAh{x@w?tIxN3Id$T)R`2IIGOU&qwutD92eqJuk(KG&VW43;7ow@m$~qmlb|~R z+WUbqi)w+*1;ho{{Zg+A*>@;&evbIKtIscbtQS#mezI>P!+hbq;RtmLv>V zQ>~L*bA1mFDZBlXfE=COVni13u)!vg-%eGC+YXJ((4&+&SkaPq@u_wZgx<~Z#no3A zhqbU}KgYmHQ=&Qw5CVZHRGy4qX_M#S@r0(d3kMrnN`>8}lvw}9|Hjpn;I1K7|N9w= ztU8IQi8>?IJMQ?dxGlrN|8SJcPprqbiFO>9k#mr;h5l8cN3^LI)#!sg9M%ZYMNV*z zU%*6kC<_>F#Vc#2q`eGG){U)~u3O14avy!K68LtX!Xr*SLVXWKgGIJT?>e$VM! z*uNNC6B=)YqiP4JLC$S2@t~$Q>}6j>UcxB0F8eEJN3if5G9-pSqVP)a^Ka$FH`_YX z&D&e$#hs4l;kCd4HZ3iEE4E~(F+j-dOw>I80>WQQ$qoP3HTZBRdOS`{C;LhwI_}rx z{5gVf*;r;<|CQ{e=B+B64*!lBHNV5^uuD}_qUNMkwB(#3y!<8E-RZ|Xs!kCOQ=g}) zX?0uBz|vqVm$ofd#VjD&+sRlFtxnXeUnv#H!M+nzf$mbCgMEeS>kvXo9V!KrxizUX z&(v&`rkzWWzlAZu?ibu-u14z}89~wO!P?=&AgEoF&G@HmMmd(VgPoNXYV1FY7&Z?m zhh>4yB7BQAl4~H?*sD1?2m4rH(Nebot-wA~eaX#jsrAM>Ej1Lha||;vv|N1aoT19~ z#?hY=HEUO75#dwC{cdIZX~cO^MD5Ke=V*4E>}#l0D7up0M9oSzsmV48nzg2OlM#QG zm`=7_JMN%8EZ#ZRsUIr+_s3z*E?@;-A1&eWCLy9im7t=d!X{oiuCu;UC&vxiS)rDU|LxP=3^(D{M@OY42M&3Ms4F6T! zLJJ+T9+&MCGI4f0QS(<-mpZKa8FjkEW3PyS(JxE85$hAcT{yxjQd;eqQn~ zo#gR($w)8N{jC< zi}vIgX>^ewo`Ld@_g`mwf~Xk7OGq!7h1G00ipLiGY|CU(&M&Iu@Ctre%(p{ezY;i@ zPp^`=GMT7g0kpI*k4u_Xp3-pa-(9O*Ctt!_5P-r ze8#5O@tM;V-c9S9S{hJ$JvPrR>$@Q%AW8E{)Fdj~OXGnYMJ`2e{cSIZ4Tm(6M9NU_i>&Piq5C#6# z0&B2dEo3hbbO8ieq;I0m zLQbvC7k(#xM1k1oMa>%8UroSaEzl&pFK1)P!SRUJ=V=fAK`Kno`o_67?A}t2??o1b zjo?D-1__+uf)6bdJ(v7wpj-&8m}=%ARN6Xq=l&pT=TfEN z)dkepa4wYOqPh#JwwJH)zV@$kG?FRIa`yzmL(gROir* zE^TIYAtP!Jq&NPhOy?fIx?;&TiEzg_^MOm3V_i)mkB4NtydqJvm;+6&W^vr#MdY{m zT#^6H-{kWnJ~>;nf0<-EFHvKt{Gv#_uhO?lc7*Qh>TA8^?zruUx#({cR;%AXGug__ zo|e0p(xWeSb{d_rmz$Q=_=nRs%ffp*s?2U{41P5F;{LJexA(vK#-GTh&}z?MHV6vz z`u;NqU2y#c1N(`uIvZH^H{W<`Y-Yb3Zk4NYh864evHmwqyzSOIXmD7mb@oHhi>%33 zTE#RjD&<-ebVyan><7lnYc=yr%zlT(*EA8&O36+dbj|Bfwc#- z)0`tXn!Ox|pl#sdLiYIn!LefO6A*LePw{OYjLsqoQ!Z9+y7i`}=dde)Lo|O1D!8-dH1- zByXsfk(vqC`?I-gy~P6;@tN{o*b0t);JUcFlY~QOpR5n*`Nk5tVd5&^9bI&z=L$Y( z_7p#>2d4rK>>QNtoPZoWyg%qd^eA&u);{jQA7$;Gg?$(DvRG->A`jK(7!e9(WU_~d z7Ddk@6F-r|nUR98L+*x+__;!ritsqxcP?;Qw_L=EbO3DVZ&-NhC7#SD&SsmmHI{2( zL_Q>T4uHg5y7McxQ-q0ydyT3M2ZJ&KLZ}D_Pdhz|3~8rEzVc{M#E5-A4WpANJyRWj zvbPZ94CemaV17>q^NG%~g`({DxyjG*b8(*OoMd{8VA6W#7UjK>`~zY@H@%l~TY^%_ z_bNl+AX&uV7lXOXOFF`obC%nhIzwRnGW^h`I$0l+XMsx(*gAabOcp0KumdR0!R(M| z>Z`LMEIV56RsYzj#SSe@y50D@Ur>zoKP5g^(2KG>$gYI(o)VSTD^Bh6QEL^~K^|JEA^I@TN+)$7K zQXamQu8J>4p|_s3A^sb6*urunl6n|g1NH?=YwK^$dlFbT3)?3=x+Frvy8kgX=V{5e zRLd(l^nYOMlAArTHT;Y1i6_Gl2D$Ff)*+)3NDRx82=ew`{lVy6#$SwOq79xJZI+ z74e4khFHryMg>K=oBZFObDo(@LhNOCU$5W)|9bs-y~sSzIp;Z-@A;nZ`JV6jUa|_v zG5g-!BNGg@LU0RdxHn!K)e#R05gqqh?jlF>pwbEyR7|g>oKj{E;F^uLe>B~W4@Bl6 z*L=Hk?|z=!x+d%toRoBnV%|P~s^Mfqk07EBt-B1=SGiT&)HNr)5+G$pEW~=2wp+N` z5l&_!VQ=6p(sHlijxbZ=-$toC{V@L9*F|kTUc<`V-BnSN6w z{)%9ZhZ7_GQz#$c!dHoRo@Nq@ImO@kVbgFEJ?C&#H>ta+dZ?2|4%H3b`FHWVpjBWk zH$Jm6x2I6PX=Awaz3M(&rJcR158x3_Qk|<7K{}_1;bi_-(zoa72fSbWQzE_2s;Zu( z#5=Vq?5eL@nHc5YM3ccfw&fF_j$~%t1F3=(^I@cAR)ruiGPOPNYOLnEl}-wJh{8c> z1pq!i_pqqP_IO>)GdETUDzqxh`10ss(MOkT=RRfTD0LLh=9ZmioECjD_G9gZ@KP3! zj9y;uYv=Z$l1brSiLVVt>5#i;I4mFHMxj(5i&RB;TMu^SzVcm*RYSlkCv^wk3uErC zhGQ%7Z{jsqh9WY=FrwiUt+=D;R=C;vHb9D~eY3xevYfz<`w7JYH$o@>f~4ln8nGWz zE!oL?e%zCNPEoc)w&;_X-1pZn0O8hJQo0347^#7*sP&8cB+gZ0s}ki~10to8S1a*{ zeG;!!;^sb|E1t&sXZs||er^2+eG;cBu@uTs+@&c>JXMLG=xKej5-;eJSgpiaN<5*b zr2LPq|GPekXOqZ=S++KG68y+CO0R2UTV216Ke^Ytk6=HtHMqap@cKX;)>Kmjnm?u1 z{AQXf`OY;ix|C{m>-H&gOs0peUADPO1u~xb@upWf>)bMLIw{55cb5O!6gymklg;dv>}Ip6X>`lX!Op6gaHN|`Tdp|D z5zXM0l;~LHQm`50j>Eb#=hkd+oy$51YlO>F;*7c6 z=p4d29<#RTw283~a;{nFkn@B$3TXjmJ2e{;@8XPYKrCA^%nkc)4f7H88rar`^MP(W zG5H5*C$<5)QOWrgqq>qj&`k@i6DdX96878f_;|~opfn1%7XNha2~7D3M}i->oiII7 zIgRz+jdWi{T%&Ltq4!VG7{Mbw&n z{os(Ny)t8R)4AHHKE=FpRo?j@fg;ox9}{kva|=H)heE~RY6PCzLPPgKF-BFT+oxu1 zHv<58V=I7x8N9JU?ltg8_w&ZXhCDl@FHkqh9>X;}fQJ)8XX|juonL?-uGzBq6r5Lv zqnR1yQ5@K!+}Tq1iBfR|rZh7?X349{&4iOX4-VPph0TzB$#K{2JOvUd0nECUCqp71 z=1*?j;UhuDCs{u><0)nQm<*wgFE%kc?%9TM*MUQ4}B-tEeR)97Ls!LI#&aR1D=lmZ((sLsY6o zRPJWhHCM55qWb9B0agZpNugM*(ip>7ew6wIz zSs|AqmKHr;+A`bHqS=-f&9<~?c6X*)A0>Am^r|D7*(3e1M&tdqhdxO$59A{HVJb|s z(d;xsNh%E`84D#DD@rofP!fSw`#({Vpd|a_=jePL1fKnLZrQD(BX>YY;81+&J;Jm{ zy03(eEQXHk7age=9jO-`xm1nS>;Wk15%8p=S^$QaH0I8yGS-r2tT!>K<<>^Tq*03o zigFvRL6Wi4m1~;hF8l=iE1lsM7Hpa$7{;&33~)LK@Q(Pq77V}$*aJ)(OJVWlfW=9f z(}XE=%T9|z0yGFXR-3$&dYGEk4c0(4KV$v-m2COnpziYi>UH_f=HIfD5#%fM=cqo@ zz4+4c+wFdzDgBN*>9jmV-E`1&PD+_LIDP{q&xd*tAdQQcZdC?eg^V^Z^GkJOIf6c> zChdF(qUxx64DYIyT||aumLdO0wtr5`HKK3Fz$UTNxW<>wZSoK+=L}i~Nryb;Ra>I` zlRQ5q_{?!}7GPqXuWb`i>qCY74>^Q`L2NCo<_7O}JlvG@bT)MbUC=O~wyvSJEZ%5_ z`&{q00kw6$C94Nf+)a6k+W>A%U4%tA3dn9?IWd`X0%mqrqUmc zqJsrYA8Nl1GZmZBhuW_u!=UsV(vcYVq;;zn-bWC-3cpgF;vU^h%->VM|B_ns-t!f0 zAWz?MQ2&Sd#Y$0kNId)h|CC?Muzm%`a_A3oeAe>W$MB0|{s6zI?-bBP44@FD5`IxO z@XNbJF8(0DXo@{&iv1ye(XH9%EdNF|7*!Ay==p3UCBOezzVJ;oSM$ovi#32M_(BO!z<`;# zuTT%G@m^L~Z&L2UZuY|$qD8Ac@-)L3x;4Lb(#UTN9lwEJ=HA}{KIZ8IXaRrd_u&tJ zPGf(BKRjfRI$#RFz)LTt5K|Sf7bPfuMs+@H-&kv@fGHI4{*y+IWeO833JhUmyfE^f z747C%bPp%26|EDXVF=}cPX~rdyB|K$iy_>QCr=;C5LWif5bkAsYn%FE2=B)v#b)#& z5qFcp^o{a=C^(IKCOYogkiUfIsCTk|SE0H-r1)?6s;@qZJzxF_{Gd5u{;%XmayX8lLAXJBcWHRNHs{_fp=tFA zN;NGV3|lyn5;}?gA(E3}g~As8{vh_AVhe|AP~HyqZF?4>BXC4cO71K;fI>vJILi)c z`33x8xs#OBO}K?KCBVo7{xx@T9^N!%0`K6ow9R6^l=)CyDe^D18+P(S1O~F1lj*!&hiS+{|vZ)rUVs`!UZSzG{x_AIl$ZW-;{ehuZ}T@rOI&vogpsmR49k zOoz6J#}!6fz#kHxqLnXI=9XO+ewLRz(=vy@Ak%E|mN`7r7Xe++YU+gS_pJ>*0vHK| z0(R!om+-k}N9f|qD@Ojl#dI&;IKD054@V_AP`8Moi+Cqk?oa}UEtn-_OCR#zhTw_6 zRb56D^$Am#_`);c3m@mLht*1-34DRunf>vFJ7gIYQvaQn;UaR!j$xO7yXY(ST`>8E z{}{(RXgcIcugWrpKhBSXZ3ez@aM+Jg*V@{C_`;_6^vLVp{_jRwhFVlPid_$v(owG=+7XDt9CX2dv>a=`&?YvF)qalogIxj>T3wz}sf z-jidiIb6m?z4wU`49*svhqKp~Mr&SkmW={5_YPoiPP#=@gX*-b(Rq9;agslWB*)y} zWv`(83(m5)R0xK~d&XJCeTUOhMFkSxd7mJlNaBV3V$3gf);F=`8nDwMJ=uB&LwJ^ptE^zY52)doyjpYt{>3rre^V?k8})i7$eQojgl zJ--IdW^6T(CiJe}XSSX6{{f$f?1b5!{}zv!j$aD=o^qDmrWKv|0u=LKQi;+q<*C0h-C|4_1=|1U&uQyTJx-v`UeWDY7rT#Uv!yKzoF{ske6+# zt+!yQB?98@Qw5^9q9y2;X+=WUE@Fv)93k5)n?cG|6}CTd-%d(P#ZYY6#?Fm-I)xSV zC$+EAnOM!CC8#46#<+A`&-h;RUoxccSNZ<<&*YbDT;#@krjQ|rFT!=E#_Upa-S8me z!WT9T|CJmKUP9sS8F$0s0nu@28GJ?kGW|{5WY&mkV#G{bL858JnL~>y;?KWaK#4y_ z5e-$5oJ7@gCOz9UQQME~uolDZ^iSbo z1R>0L(_MNN-h#9!_>k&Kc6g9#t-^7tqKRj@y4J7$K~~zW0CBF9x~pf6%_)y$hIt*y zov@8d3^v;)TG*7Mnb9mD*Rzp5T<>lh>0`x8Hd*urZZ1Wq2ko}nmUuwOUKC3;`9n1BSUZXT@Xn~8hxj+6cnJlj5JSsB&Ea7dT@kq9IgBGQm?y@yR} z@T3DUuNGfg+UTq}iL&M(J4zp6j|Pbz5c90pcFIo2>|j$}OKei(;?GFnx#UDDM0L+r zhNj{G8SRC*^S#-ySZG%@#u%UodGhd`&We)-+H5`Trz%#eBv%bE4~EcZXO=1ongv6w z<}K`-sVon_m^u48cYTvI4n!O;IjxC`m%CxuG|d-(EG(nmATxgvZ&+Ps?#NE`Nx7uR zm#SCPyr9hh_>ttB(D}DOo+|afbEc8!WnCcnD`(l&kZ}?C<;Fg*D%r(A=4&#!FV7F8 zwgm&)pi*(m`35+ZYMh9b5)a6unL#o7=cHdz4Td^q7DD;oiC^k^2qy3z5X;<9(JP(~ z2EW|XjLDs{0F`Eph|N6>=kd{~Np)XQmN$Du(OHrW)!9S&FQoIanm3)KY~@UzOZBxf zIY7J+Ohc~YIH&f=Bb_HM|xH6F0m&xVbAtJSlu8r~vSr z%X6gx9vfjSb3MTOos;^#pzQ51_I_`>-s7Dk0P&Pr1uX6>Is?Mso? zgi6^L$HAw`v-u5C|+{M)o~c;B=O&g<~!^S-w2v&TwQzbgY2+ECM)A;zKJ zH1X($2dB4d7M)a#P8yNLR35-baSG#}HhlZHj#3m^dCfD6|56n}OqZ0SnZaeoMb4^E zw#+(?^X+KKg(48KtxJKg5dpb5Q z#}p$;k*43cr`&l@M8g-kH66}f=4whz57{QRvOMCIQ2FB1W8vRYWmx+_fa=aF z7bCPyfu7N&CDEE^5^vb+&xe2{-e)4o-wjCIV2?41dkd-|yjskCpnOvBWq#8YQ>epe zORNNjQK#SECU$i`6wS_tln2B9x+?Ix{8NMuX4Z8ou(RH%S)Yf&jK;{i+*tTb7ZJ=$Wn5}fL7CZE%l3%b4;$JwL6*N35`(dam#ZbLfW|6lR zhU(XP7V?^1C)kI_*aKRDwNgusrlkzt)U&*}PTiIQQ*}S%4i>;%n5t0~Mjzz6N@a z9LxS!g}x{-T?gS+PFE9xicU+aU?nA50My4aUN5s5MKUN^j(f}7pp{zlgmc$VNyM`Z zY6fn`f|LV)L&@2~3=XVk%iWflA?(dZc9t|`&aU^4>UtG^qa1pX?^B-R)#8Nd!Ulwy zuQq(wWxe>WhnQT$cS&JAQ$N4SJIz{}JsliFtvbh_kYoTz#V*YJn%|IKwiRP}PZov5Q z9G9k1d)rKXUkQxi^H_r2+aQpHu8e;!2K`l`25HV*0q0eZZIzt?U>~qv{&IHaIw*8C z5iJMCU#Cp`*_g)j@wHnaZabtfB?`0R30iR|_42xlI)*IGDu?r<>upCZx=lVRq zQTV`cG)W3e-WLMuIB3P{nSim>#B)f`PXy09d6tfi_hj?$`8k^G3ZKY@@X_R+QXbtC zk>+d}6w8*L+n@+faui+L@_9FG5fOv<iCuOtd4mzGovU5G552$ng(KbT_fo4l z^!R_v)B2ryWzunVuUF~bu48IKeuSs|W-d37hU1K7uGD58zdeTWa5)E)s0Z&#IPYh~ zub!viF--p4Kc8Q9(l(@r^@sBF-dt;*ovioXHb;$m_~-ODz=Fce8D4R#lvRbhtZlPS z?Kv*Ld=*rf`JanS2gbO3jTSJ)U+3p&@=y=T9RlT0^w zA~M5W`i6H0C3jz(dMU*QpMEYtEUPMdi!e!uW&9WTU(u@&%P5-qSMy{}K>x}Z%zVXy z17)Mpj^v13U1wOrH?9Jovi4-dWiCgc7bR>g%X5cf3_a2C{8=c{JsTJg5@4&OWm)Z{ z6^6GV^Hn5`?<7{n@;e9wWhJeHEajZ){vv9wI7%xlFs zfbwzxa3ZEZ>PD~A2OL2i^spLPm-yc(OjIP+B`4gpChepv%Mr{1&v)&bQm!@ zlRuCmxcFpQL0o<1pL`g(zR-<6M~?%To!I{MIbpmidlWnccG4?LwfdY*9;1McAj3_U zw7fHCYsdCyK%2>Ek=nq2*j1xIrvG8-^li)#k6JU&lIm@2-o?*R1$)_=eEn#W2m*&$ zGw@X#;Vd}pi^mK<@78?iEW3@SS{yfQu|zN`mv+fp;SD*YI2R|kvV`EqhL46~5Ax>= zo|Ksz9B->djkIsJ>Nhzk?4L?c?RmVqH)YFHG$(!7RAP4r!=U&|F$7}+U zv-QZ`(Gxkq*OAN#F{CGGCgb<~>EL`e?n!evyTBaIB$z?o$l**hbI7)anog9-oaHYt z84ckhI-50&>&(v+*U!d5h}~3YRg^T;yqwtO-$!9{F55l89EF_JH!-LQX1n;%#4Il& z$DWtIC|ni+)P-}%$MG1qcEN5GkRJb=S}A6i?sKO44Mrn2qtBV@;X+2AGu1znQS86K z-fu;{CwtVL0#9~uWh2eqmM*#K*a?j)tMJWUZUqXh;-2VuD6*fEC7CmiJx6`4Qmcpd zzNm|o82(Pr(5jII!E|ki@pn+Q6-%tO6BXL-omEdK58t`uJiFg( zs;R&m?WESK{rt6669JG{3cxGRecZZvT+>yeG_NmfZE3Saxh#L(Qws zvJyTsrjVUu<B z#(27$8%M?LwVLSO;@R4dyPJEKl^VZJ@}9%Q0E8}w^247 zL?YP<;K4&sK&xBxPizIDK=LCNy3DYnHP1WC|CLH%)5FX&)9j?b&3gmdqgi)=L6hh> zwiLY8c~8V@o{E3c-fWcjkm+E==sd>#yfb=#=N7TWaJsYUUnNYzU!n5cB#Iv5pheAfU;g%y5Vpc zK{=5+IIA9ch?4}yD2O-M0Nt8xi${1*Sw51~QH>m8v>7gWJ(j($w2bL%sM+l-)1K_C z!U~0}8y(`4-2+=5*}2D0*Df_ zca+eS3Jq^0o)`m;)^s_`_wt}Z6j(|ep&6Wqx>aaYW4tP=$dlxiy6H9=p%arD5#5_l znImcH;Ob%EdI71Wt|B36OCyy%jT3%O?-fABigt+fR);x_;nAEFA>I%zY=Ss(QwB@s z+$A51^8ap@1KVEsRhd6Ttfwd;uJ5vA+k@RbKwd})D=6P~R>u>1*FZQge5qlN9vyeM z-ur~JYFqXjwXAXYb!Yi^>0*HjEx9qd^D}GJ>qkPgY&;mqGN_?uuMC53zKF<=1QCMF zIIE^&X>sw8j%e29Htapw;KV=K;Bl_(=zQ5=qW|~wA~x;-afB}nXNO0_TkD2we`aUI z`$WWxl={11`$fit`iZlWJDs(-bD~{fV~&cQ%hxvPP;i_QjN!%=Ius1tiaH*j9c(&` zLPCyJ1gwl%-y1?1ma--U)dtpo7Hz6SkH>D@TZvriIL8; zl`;KMbf>Y>zzhjgiDhS(a`tgnoW=`uU(A-*6~RXH6v=<_P~ahLeg+2xD8H!b`|8pQme}w9jGG^_ zj;{9zNc0A4_XvyqZn8G)HXM7zJ5r}Dj9uV0PF73cI1deof6A`LBavr15pg)F4#t`N zR`F6^MT%k1{b>M6djP}}iKO<-@L+$k4iPmk8Y7$ZaGHziz_t~T`Qr_Gzt|xAoAi5B zW9O&OndQ26$!`0(N{K0>wx3&q^T?0@#%fT2um-OiVUZ%)f4WGW%t{IxZciRL38u2b zS@DtCDkJ&5ayqoqm8Oaof5h8vfak0lK2j8=jj&KaPWBLWxO68f8pj=A$Oe9KWXRzt zpnEnd&>c5bu%pZ~d$?u%RHPRLTydo^gw>^uR95KF(*gM_Zf&F4vAE`Y+t^YYU92;O z-GtZ!aIV5R(!J$73_8rJxGA}-t?4kGYA1m}nFCCR)vs6${PG)%MYV@TlL}H8?B=^v zLHbq$jG2R6ZedNJICmZx6ZH;7n%`=pE@*!Y#Q~Hb!mmPUIOZin_1-XNxe!sL0nBUS z(R*T@mbY2x@EX=FLQLM@YhG9!LuoqZJq@z~D2a;}Hk`)xSoU%@pu=$vG`}Ld^EDvn ztngVuzLfXP5KNQ-;$lzF)`eK{wOa8{K4axa5%0W+cSWhchk5PU@xBrChBa=MKU2d^qAT}rw$++XCI~`&V(1Dq!$zp`UlhHd>7z}D4<;xRSt~M<+*RV=LbdrE?}@~@ zq^%u8-ntMaB1R}={AH?4SJUC6iAsIV^5W~TKasEbU3;?mg4Bqm=wGHiZTy<=_4TaVk^5|jJuAou2c?xQvrp*=M#OoVEV=X0@N3>kBNe+WIZ zypFvE9O-8;mCx_)8Tu;<0waFRz2jgGE7E}H>bE=Bcu9eA^9lxm{pu9H;6G_RHo}Jm zjF&*{e~m+ssJ?-GRdT0=?jwS(l{#K&ZlgqY`bY?#+lVILP7B*dLcn&Nsqi$)qh9HM z2~08Dv_FR@0uJ~y1Kd$lL=rKirZCUfY4oyz6)V=n8gf=$$pW#b1&0i zvNN;~J4s!L7WYcLJ1hWfj-@lvaqo-NpjaBK*=`s__$W>lMGWGTiSL+mkn8O=djUs) zl%s>Cq3eC5bny*HT0{%3Va583=}G~~&t%ulx%g`&2B1vLBT-;nJc-28@hmINO|5fx zJA*9s_r9MeRio*x`g5@9(B8y_^u8G9zX!11UXL^P%z;c`u!}Qu}men%Dee_db5IZCx zP6uP)a$t1u6;6=P^$u`$chdjN@MIx`@9PF{mx*L@ph0`%3Lq8D{uL;LKI)e!zu^5N7)tKOi*dL8nFM|R}KYChee&xHZ`gY>lgLAt?vHn=Y+oTEP< z`IFDlMVd~>Ycx7X%cRM)rJKja7Nnf_ffMoft~ghVTNdDKx=ZP`xu# z@ME=X^kbh~)YupNEf)M7RhO89k{cXswVb4O(D{IoPl*3PpY?LqJ(yB-OdrJj()WIj z>89_{UY%vtNv&`*kEv>njE@R30AxapbGu5xCKK3E19~gk@LJDX&`~}lysA2fjBTV2<2WV;IEXisf*8tU?*M5iE=d+)MqUOB08-* z%Z(p>4r>{r=DcDSiaU?45Iyf(+IHM=hs;c2OAyO`5lfrvLf*MLNUj!#t1v6uIzMOS zUW)+!0q`G)$$n0y$u|2z68{2!lK?;kNW?n4wIuxL8` zy*-VbmDdZ-2JN(|>U=vZ{zyBw6}3a0_uvRz!&htP_H+1n>JeR6*s~6^F9_(k(}M-6 z!w^ZK2xLVXR}u&rcT5|ljo^Iib$UM@-x^yMpK4A|F1`lrO-jKVfiY8KXQj}Rmkf;M z!o1*+z-nv3o1^x;;jN3^@NeCxv6Y>zMU;A!A#82uv6ThvL+4rtyn+|^9V6f8DA zIk~W$`{Ay7ma(ksPT)fep+0=l{c9y37U=riq})x0y1@-UB6tY5U#~-r2;j!TypGYm zL3uxiyDRlIaCJlR`g;e&BZ7;oRp~Dflxv>UadL6FBE|!@J-ql&kzhN}=XUzJHPW!IgQxDRUoFd;4GVjzS;wUK zGlRPeqXCH|_+wP8W1RRHdo4)OkGq$T)vo?sun$VRdIIYqK$1#pOYa8K>r_P()%H=V z-VkVBOF}tUa<(iBzdYKBpYCfDEXjof~Oz7KJ;7Pks$G%}w&Ll zxWGf_6kWDonqld}FyC~v=JCY$@i(nCSZ(xHj3^|)yg4R<%yg+;;1`%HIvfJz^;eJ| z8hz^%b3d;ZA98z-zBM~AcjDOE*bDIIq&@+8VE^wC=g(mPM)&7A4NG~dz1FZHuc>#M zfZSD74G})bb8k-M4=7w4Z#lgcuD?zjMGDtwYz7L~J9G_M?l-b8(1l7aK6@!#qh&71 z({lo4zj{A&L-8{CRQZq&=0W&@CJ?kW&`kYY8x?g2D$bRitAc&4NP|^Qhx9eIJtB){ zxW6yz8pTOHO*KYaJK}9FQq}% z5~Jr`I~+QG>bUl{3LUO4+;ku%MI;nU_Mgi*uHbQ_8+Z*n4w%k5cxNbW{lC8%euW$_{Ur zPIf{tF^f$)+2%vsZ@1GRO}6cyDxGY(#jvXZHHcZ~7nXqcM|861nD4+f@Y^gYe zFxDw>1IEC|Uk&*!!u{`wSunV7728a|3)+SERwPItR6dj2}q^=~-;=|AM^Y zFFEM_ae2jCqS1MIh0K*?e5-S^la>yXI_8EFXZs#6x_`ieZnNTwH4t}WBX0+8#TA#U7Vx7Wt}yrh<=p!tuE^W*6yz1(sQOdn73HSF z9!6m#y)g0$>)*gI3Vq}ij=5Y3hL@3H(3y2LG%%x2&DDQSzZ4ElpmA*u>zFSID#U2 zvf>V7N$o$VBw!?wlsWXu5wc})B;Q&a>W9IpxKCTc9}-naHlkTUR3Qhbbn<^F zsyLNub&c4csG^NASy9EA{<~&6i)8~Z2HU+z=SV@zlFnlU80~yn5MW%++6>mWckK00 z&$^ZXuN!^4gJ}^=4emgq2kY!IF!?xWdRg%u9w6? z>K3+{K70B+nz1w6N0KtVkkN-(8&3xE`98)<|KFBReA`UE**c1?zrU_zkoW(WPkfww zV#5<NDULA=59AcT5j6fRIfb!_Hr7h3MA8{vAg8G6PfqcPU~wKRr`XE&*^iv!2P8{Q z(Ry0ZIqknEr>N>Br#NipJ&;rU4oYj~64qK=*5SdskyHGdcMWZB!K6EoPyDCJ=vO}R zf&oX5e4>x>IP!@b`M9rq;;%`w+qawwt!>gK)5kF4x*z^2@(GN_&!Yw-pZFXP|J(A3 z=jkXAsWRJTU^H&!6UMKUA;2FmpZK1Eo1}HfCmyaSp#C3|Ps}yn9V4GGVCu8wUG%SP zk|v|iCV46u1^LALl26q3vz2$R{BO%A9_=lk_&@&>`Na1)(OJwxKKFl7KC%11DWBl9 z-6NkcaPGs)eD?=`R6g-{{mLi)>HkIYiLH`Pn9=o-PpthH3CV3mJXn6D!Cl zl206zzpn;`7B$Yk%!w;09~et3b%%snId@6HH4b}yoo z`LPVrbi`;)M%f_UrfVK(LaIgwpR&a=DXEsO!4nnZ-k9P^6}` z!dd3(Ls~00K?03d*a6vpN@c&`NTFnk98~8p)g+t$EH__78lJZoA{(lR5Oo>uOQ; zp48lVhCP>0ys31_r@VdRw~yQ8?Kp5#nFjt9fjhZjxNIv@H`4D+xMs`E&-Lk7>Lzlc znR|5wVw?1=IeIh`uFI^{5abFbn5?AKNyonw!^Pu0o3htjU204xV;Ip_KB{XXCncvT zkD8rs3{Qpe8aT>H0~1*-sNy1ott7oYK>#WI&6*j7TOumteEbi|NL9)v80eh2M$R#o z)_J))?;S#fF|YV){bj{Ynk&FFy*-+Zr)gd?MP#(;((x||A52iTw$jYZqjDWVYwt!g zg9!v98~-MX=7s#ZTTd?GQfDgyfHIOp`8Wt!yC277vtW%Ng9~-mOQaivjX{Yi*&9v@ zdpRQLq>WD;!PA|`NDNvwczbkmT&NK-EC%9cC*13Qi_HgL%;R73Z=g8xO)jObiGM~{ zKDgY-i&*U-UGD^MlmCR-uD}p?-s42q8h}E8M8i1^0uEw)TW7o8ck*rmAoUDwTkW<{#MMjVvzdJJiv~ z-^CixD72|Ze~C!PCVp8IRrT2>=Ij;tPE*X7T=S*xnYS2$&l|E;Oj+ zaV3L}Ra{s*&T;}s3hBppN4y9 zB6geaGXuZOCm1$=Hn);0+6P`4)Ieo_7d)EMogU#~8%W8`IUQr5okT*rm^THB+T9+6 zp&K}vlz0XQhy+FyewCbmhRP7>jfd!>M1mdGY+kgjec($x z3g3M>VX*y`{3LLmmwX#~c$Ug&&n*jdS!c2B;F2X3=R-875~a@SYX_mKem=%<7<6EG zkgJA~QdZgc?Oe!44(yL)7kAZp*sMG^e*1y_&g%No%vm>6@3_b7vR?{!qQk@tZK-*D z@u%DpEJs9g%W{9ul?`B;Q6GL&BzD~1`kHs^oJ%0Kxmb2mGUBYhZ~;*uwiM`IS?+K7 zL>E!z9%Ki9-PJ{#Sf1Z-R!jPOmGOk4c8Nvu@nM z`kLL0V<#`M>;#SD0y7T(Jf?`ZD+f5MV-;uP`AQCpJoG(!jlh8BGOW`WW89&cWBO*Xy3)vGwa@XV+)4e6xo5DArOxW5L!H%g21UbL7BJT{T)$-mjXd{`GNyCxU74mq{O096g`>2i^a7H_!Xa6X|>oU_` z?vc4>tf$t8KQef|v%co-0$vy6gMx4Y^#!0SOr^I$l!-8X^Gob5yV0FEtD@Ffv75Ea zB-T~Th{2MU?`L|$(d-SO4~SdC8kLxECPM`h(d;!!ttQo|P28_lpS-;c3M#Mc>$iap zU`|VCnrK*P-pw6l+<{9x1yA&S)`qT;JGe^$qTL+nmjked9A0eh& zq@A!7l;C}?N~&^#;Soj_8_+RL7xQVE`SfOz3FQ4&E_+b>fw#%DoBpI}SKMZ1u;#K1 zZV%KNYf*V zdM#7R=|=oU5i-nuawB@RpQg_mH%9_g?byHM8zVjfTpJ2L5-O4W1<6}W8Hdyj)vfe@ z0!ja8f~;AeFd=fqZ*=s<_xY14NRLr1dfqL8S<8LB6$Tix6pa@j??u-=oquH$I8_o7h*jn&MrnCYZPQEV+Ob^9-w>k?2#I~bu~2Xx0u&Kh-r zqS^usbvz}bHD~oU*^J`6Dm&`0$eJ~K0B#rKXmOO*He_$8ACNDec+Nk8^1?#c{!z8k z<{M++OnjQ`q*em*mgHt_I11mm!C;9-(~#a819D?x9{8j1ao|Ti2AWbN($R^d4%d^$ zv%x#{-t$yP(M=oz8$5U>O*LQhCnh39J<)jt(}dB7J4?vmkUtk=W&ipUjuXlx;`Ap(Mcj8Hne3+S97N3aO2HwP$e3k=N z^593_)UpI>{I`yjAI}lF`#uG~*FJTm27UD=!YDm{bx|9f%gXqSZ?4|7c4h^K^!q8d z?kKF;`oX;Bj@;GTKf&xr9{fpNXx+@0ZU_aj`^MPqpRlQAxyN8dpbP}$HA{1h3A?LFznn@K zZJMOZn;B+s=!My}V~CH;x?#h5GUUsi_VA9{x15eotjyiHn~#I7&n_Jg(acRFDySJO z+ry@KjN~d5BRL)XKKE;+g6;KXAPVejeaHZt7{X@u4A5a9bJPCPLOJ~t7LF1YZ$28( z6Lo+PWQDH6j(*|X%FwztCe8Iun#}X~mvZ|*2OW^lsI`rn@|z1&K1M(+%L>^nKks^z zhwu&6d@^5+zlN{#`2j!pn1B?S1(!M7JYJzNXhdP}9t68ETnxs@#Hai%6bkq(oobPJ zB##V=e^7Hx#c(GjcdoI_q*vxXdV>yvxhW$)f?{lORwY-`sfO(Q(g6g&mOs){wD#cw zF%Un1w1B25UqAkx+?`+0)){f`emwcnh{XS)Y~US2<=2&-e<|Z&8ehv@X$snnYu)9) zjslw39#ej9lFdoqEksLhhD*v7u@dsv(9`dr8>84Jj2X?C++D+q`>efgOurp>iT9ZL zteWs%P{+5-Dem|`tK(_WU?I+@f0;)XwC(t0{7Y=I!*Ma(ZbP{f*Fms1U?2Zd=W%vl zQ9mOAfcH%_03IMfWhxASomCIr4^-XeEp3|d=dXe>Ho?#*3klnKjQ~QMG%@jWCeFt6 zY_;w9a;t9kF9S7yJFms zj}9`_#z{>ub2;Iao%$NN*Gj%2<{fmGGp?J|QA)8?cUkv6%s zsyjZoy|xNG11i5X1>NRuEra;z+|7ecEMv);RJoJ-js$91ds$QmUJei&A&O0XUnEZv z`rz9cFMW!6XTG8c-U8Tw?rr(21~*vW(VC-JngwkQ%&lI36jZmE38l%6fZ)`8gwkN4 z#66U7y|bPqCpmCEym`1EP-`o`K?RZasL#e7VS(PXh0(P`G!*|Jd3Xfe#pbHSTk9rL zOcQwBYy)m5Ewf9gSmd!0cMZWuTRm6LTB^k+nwfl}G$&Uub_qg-88SMdb?ByzW z(`JEQ07<>9)}53Xj$Tkkp!RZAw7JWG_`V)u$6=}~w{e!?`|nb0w*3PG;Mcuem1q_p z07YmykNUJMBiU=iiQDVP?`I$S7%*JN4kO}mt@+(+Trr#Vikk>c8nR9dmgjym^U-ctR57J?eH)r0(gGOvMUm)bZrfaypC`wiIO%cG@A$yn z8;>3BP97PNc+yuqyux~Rn}Mgs@1)0(-s&r8q00%1PBDLL)u~73o(@e~WV+>~ucMgX zZFtt+I65$QCvC`rL*Ujwe|MpuOe%!cKT|87+N+H9ac&0pB}|dF6{Av~Cz>OB`d3Wf zlatH>V?o&|1;4#gi`N037x4Rrm#cb^`=esy{w?%d%Rz9_w)A~4e9$n-Sh|Wa{2^29 z{I`b+!(V|L5Buc?G#tx~;H`6H^56(3C53LCa*`Wis0PPBaBDu7_Hx{BcmJRaW}HcN22 z2Nvaak`F+g)L^EZEhmN#JzwJ6!tjm@XfFe~j~hjk?yuyjFn@V@Y{bTRAV7@b!+ejC zxtSAP@3Ey+=X$?r|cOeyR$-p;*4eUBTc7?9^>KYwcHQ)g+&gmQ;cY`8_jNguy}N&>7%o8Z$VX4nr@r; z(K)!x;d?~G>&{U(`SiPlAu^xNQ+r9%X<8av;h2a=Y|(X0(|gB}DR60H?<27-z+=5j zk8+FUELx;#Q+x!&uGFy8Lx4fUye{mM)>~en-S7g_`z!kjsJQ+zRdq&x+3U!Ta`m8v zJv~$U(N2M(uMD|~(S^+5(+*8H-5NeSe!j7tE)4u%D(%1x26T=Qe7eqtC{w+jyLna^ zqhqjI2S~R)ty$GR%A@94WF(rIRFS)CbufIEy(C_UuO$E5+Wr1d(Ia#ZaKxQ*vYXtA zKz_5x(1mVt_ugCt$M&&oLmL)X54zcgm2P%+tD8+U=}_|AI{Y0R>;|6AZl=B!Fvc?T@`X)DXkGkb%exWWYV2|Nl>)TkO`Q5%DdyhaLoNMbJjBz04 zD0$C9edv`|$H2n#8a=Z@(k}pBe;m zCU57Um1-7#ByWF^M=88cpEv5Ul}r#CjWE&iZM8P+EQO-UU&BYk?;NP}_7X)K@EmyB z&0bzk*hgUVted??uz6#zko4~_qfeQ{gSIH&*wV=jlr~ozvF!Yc3!};3QPb|+d{cVF z?1_UI<_;sLan{Z3&W!qYYJ1Df?!-Gfd9y*g&blexnbPJ|TgwzuQK;3|tGH~^Qc^Im zXy)3HZgOHMzLb%->Wus4N9OLG9$MF23VPnqAR41GiNWnt#U_Px%i--v9{$K#@jTlI zjc~)^|B6SZ&98@^f|TbFCZ4BOKTEn$(@Fo0c^W{@ES~%oWUJoJ2c*|*P&W53xiC@i zy3T=7?v5jg-4kxQv-_OHe!R0l1#-^sApu^A*#Y^eT%E0lyMRq6h;I{pV-o6K0bol< zh7xB*@I@1y_cAe;NTTT2%(ODN%9okZTpiq7=k{o3LWO@39U1=;cZIJ&(`J^V@>`A* z)^ePrI_cv95XA9asQlWQp#LKxE$e16+v~rm)qB>RnzZ^>VJi+KcvroqRb{34H!PI`&D)8^kQp$PGNZ>$O@rX=qeGa!DJETSO>S_y7V<46Q!oSQSX zWAu{P-(DMBVbxmJ*E`^^A5u6UA_p=2ialTA`#TUeaKb)}`L*N#M3V82prMo*z2=0G z1Iy!|^bV~lA3UVI`Mu*mQBt1ncIr3OY;)40j`c8WrLlSVa{6%k#4|q%ojX0`Eb}$U zZ0Y^#hVJu?=O6@D@6?iz`?sHp<7|gc5R(2xP8nrI%zKagmb;FacReTkui?63nz`%Y zx11V6?bE94&jkI{c}uFD)TyjmE?g_hylphOXue_>Hz_-*^M+K}y;r*{KAd~TbX^hG zY26-joE7`Yut;``P%0+B~N`mwGNtXbdsIdCO>JNmNZmoEN>&2K5>S1bSZ+id=D zXSp_MTV_R}%+7I?d5kjoaSU>nUsNc!yil%H_q-?BovYL)vC^v;jtMrZlr zLb>Kbxty5R-xQS_=q#U6DA!ad*Q#cB`lY~lnzLd8Wf!#iit(a(@eUe_V@D?k zP8JG#1^Mgwx@lL5lm0A)Bbm}t&A%@!9&QMULXza&hmq-+vx#mhX=sx)gVMhdu>29YRef*hy%I(F;v5AglI?=sXjBa z46kWeEid}=_^mzk$IuOj0uk?}Dcu#XbU-$a#9AuA+J`k zFc)CAbr`}S)9B?pfpmRlR!h*(&Ho1d%MW%GMi#*&1_PdN&lLVZ#?#XuLr?zRqG2C; z^0TD@J#m)b$Tzl3ADWV-On#j~S1u`(>qA$rD=G(FIk`}-4_%pDR1UhbpY>wf?L$|N zFDeIJd9qMWtH!Q8Ls#Be($hcaisY}hzGR`Cp(~FUm4mL_Q7E^pP|nbm?-!MWu3T9t z*IX!P=t`of9CYRELb;|wIYU<(^5tYseJQhVX^Z$K{}A+{HS-HCso-YLYs8fd?5M8; zza2*(O7qcTHu_#?NdI`svIrNj3Y~#sNGvN|U;wk1qtEdxP8n-g!qf8mGqJ>+GTNh7 z+Q=QvfQo?I=K86^i6-BKN8FREJss(3_9~RbmJUQsrag4d6<@ewOKs`j=2kUJLuSwT zHbbg%GY^a2ux_1}yJ5}xP@@--?4{e5j&GRvp`U^)iRq%(F4-CPgT;2evT_NW-fL*l zc^?I&#hLo}?~?)-VsA4?QzEFg+{nqTKt z`@1*?_m}C*uVlpR7iTc6NM=&Cmc3uf3xX%WlN-$<_T}TgKZ=VgzQ3F*EQ0jeTV9Tv zkU(eW<+WT+O)JMzk8w!w$2ANOpHChP$4?@hV4NGfiMfvd1Zv)ESNrRE$jj$4H**-d zwJet@<+^j~n9ipI{zqxwrJT|pThLlK-y^ft$zHpa_t?we_j>vD<7ltLqMJE6xBWS` zt<3rVd19qRlZlf$W1@=;ScjL{5hHB-L__8R$t}kdl)j8GtcjhmdH1U_kVN$m3;EJa z-Mh$9uiMc}@hPJc4v@LmbB&6X3Cb+e(PU4O>spNr+jmc|Wlyy%k;2bznkw%&Ff?zf=V- z^vg2t$Y_{2kTLJEZKhUP;^BD{CokBg9e6+K6HJkl+VkA19(XT?(#2)jvGZqS&y=`_ zUYW1pe-}^BjyesEnH8O*;X4|_dx)OF-ggT8FtC-PMrKK=M9V+pHG&di&ECX|Zpkmy z4+i0S_bA#sr`3b}2x@_tA`kD>S zGDp?ho+Z1H@lHpp<=n*P^-CFWZu<`nu$csP)Jg3!P%zW%!h9rgn#3AZo|&o$_tHx> zPnm%WPvCCc^v3l@T+NFv*q~Br^%5afS?BSE{oUTXv~y#;Wuz{*_Czy_4`O#9K$*&O zpOc5WqK4{T94Yho%gfqp$IzY_0L`}RjU?d2h{R6|7#U&lJZ7-l8$3Nz=a2NSGo<+U zlG)7)Lw4qM2lT6GKL&HhxAnr^CK?IF#&OsFy#JwUK+LwTR%z5TyhS%yZ2JcgHZ+Vg zlIf2B3Ql{QhbMU|U#UejYNE_JQfqm7$q0-w?`;`@n7!?M};wOzR_U+}q??)`#&g4y(yk z2sxyd2T_8&~;+lcpVcdxnz`iZPVB+4wMU*D1v zAE@hoKt^Wi95?&jkTBaj{vwl7>$(G#FyC#y$XwcZ1J5EOUb1gfD;4FaXuj*QS#H>2 zAH!@#JMH7hB3%N*ceb~ghUf7~hSpLCo4_m`=EX_TXnUKjucY);y>IHP57FLc8~ONr z+w#Zf-)nlN#@SJ(*ShT+)uP+HL117Y1o2XaONN?Kh8esv_-H0hr_AWw=8ZuHgUt8; z#oH>nq)gSdpn3Pj&Vp0h_6}*6N?g~AH&k?O;(pls3|Gc|R1c=X>0dt*8397QCFL>i zPV{7u0rXM3y{ZanNk!jJt9^tbJ^JF~+tT~dFg^mw$X?~5M%$eex^fh{yA7}Jp7ef; z^*iQghM)SZhL@Re>NXYJpO~;lE(V=}-iG;JsYyg&J?{l~-hOx9p*3%rJa=+vZ+G{S zllSHCDPcff@;VOeXnq}#-ASxGZ$sx3K(LM113Tt>c!2NdX8f(k&ZlE)%@`mXDTtC6tW|?O7EoUEF~q&8TQ`Gs~M)j>LOOWN(~R@gNW7dO$(%N^a(7RkZPd zaBo&c2M^VH*v3Px9(M5H>R~4jGxd<;VU8a5@-SBq2YFcNdZTc2b7i9v%6M3+2h)i$ zndLg3=u-B3ja%zNx)M~JWct@S9Er@{uy~qfY(Px-v%e#YuCmK0y-b zb)a@^KuSSp#a2?&+iw|$-mrineG)2))2~^wx*VzB+Nd{^P{NlZ-|RA9DXs%xO^_ZGx=S}?;L&``JKz}QhpakGv98a z13WhJsKN5Ml*d-{*s4r*h8xgU0}7sLxK-Kt&a+w!68v_)HxeB1(EutUO4(^UVg42m z^h=<7LDAskD1>RXPy<|RxXqAqwne-F`!*eeT!y~Mzv{Mv3Uc$?b9C0$6}>U#A5{_f z8I^u#vI`|T^u;!7!m6F+^9?gLmZQhJxFJ$`CUz#Rni-yB9-Ig8EU-g{uN!iu(F3oj zUV{teC{>m!MgVm|_GJbchLgMol{b`IKs4-+lvkyDVJ5JyVhns&hStXIbr0;5bo=R? z>pVaO`%syMaq50fB9r3>Yv0|aJ(4bsv5AY2-J2?8fiW^xGNEEdb`oYnb@{SvmMVG6 za9863t#R()kXXP`mS;wz7?Q#Ujs5PO3nk zev5fTfeW7XKAy+7jo-d6;(V>tIKkJ`@WK4ObNC?rEgg*fex%e(%NM<j4WGyQa8{k`tg4n!fQV+bEf`xx$#PaL3OlQaE`dk*+Lo`A*BEwE=h&P9 zzwt+35U}Gmso& zZ5|p#4!MoUKHBX!gUDfchX#{FZX-4$Qhno_!Q?Q+LuKTU+ekQd>n(W^fi;#Qfj%^Z z9C91W;|G(Jbo&vBS;-V>T#r!(>NmT5EcD6XH_F9i;in?kBedYm72s7;Or80>RuJ9 zfC-xV<=YK&c+fpV_f6IYY=v0?pr%pYj)9pb}5IF-|Tu{9u$N|?I!S%y~$r;q*g6cmFa=`UQaQ$!@IfGkVP+byLwZmWxYMvI;_PV z7N4Y4aJ>;+KRkle;Vtg)_-RT7*Bin0!^e?2qQxB%A4%#=aNQ-vJ+5UYQPT+#o4u{1 z+dTk*emu`lfIlw!ZDr1iMPMcv6+2@>Mdz?Qzt#}OrxSFM9l}uDrSGbqXm-M&hU{3P zzq}fc#%eJ9dTmLh!8^2|HCFQ^A}dZR9nOlO1|JV~4l(lh4QxEls*x?9;JjSv;`{t< z-Sjje!U5`5fC#4tUI2xt$1VnMoDd`(|;db7W(TQlmlIKD*RStG_3|o-uuz) zB&-DwE!?lm=r0;E~YK4_xcnPfya1|%D=V^(P*=6uxo(08^ilpNBp^ScnN<>!T;1j+BUn_bw%CyA(i~O-5A-c z8#f-*?67zFa%nF6-ZB0WKnq#PPdKy9oIB~Kz&L-97#k)Fq6(btT=9+T%_;LY={qw} z(H`%&&Z^IYUBIjhq+xSIxPLWpb5?ylOgcy9WY>VYmMLtAOQ90AHfw;g#LnQUbqXIX zg-o1kvr3c&w7W{lVoO{KofvAfN|gnj=o&~Cd*V_E#U9{FTLYB^q39ye(iAqurBI4z zZPp-VK`FWhlf|yM6jGu1YJ4?VS&)jZGP2kfmqIK4#b%W$3qe(D-bUhbbA7(KVc8w#TKz;un!TT*=Ukt`Q`& zKQ0{}Kb>T$veZH}x{f264RR?|gKZO{u~b_o{~M1JZ)G^LfZ_6fWCCAcHUMV#hgZ{> zbc5U%@sLMuVZ#3mtIi6Vt@KY(z2F3U>~M<{eOaWp3B$oS!i=L2i?rS5^ur>pu{r&) zNdIDUN~x_6i<1ymAZo;!!~%%jFVZrjTdGQL`Zp0e zB;Y@K?jxdD_;V#87j$n|x?bWz*PGqpHMHe!d0B$zmyD|AS0T=l{9mUuZOUH#8X3Sq zU6PXrqum^ekKF70?EE*w5{B>RDAqZG*XPaaZeF?3`1bzOb)#YRiyJZ*HK6KZ>}|%s zBz^#92bQNhxA7GtpB;vL_Vmg4zNZlef&+|;B%|h|#4}tvyfTt>H#1^BEtrcfIy?qf z|H!~m33W3K+_C>uozB#EkY?+NWh-9cGlT`D99z#1(IL0yz4$QG_<>v*PUoZTb+4AG z3=+;V>gMOg4^IyzC!aE0gLL+Gj|iJVjn^25caPXdcmpT>m*((!%ymmGUB3t><5FY` znff+lC96mcP^2_? zQPx>8ST$rLCtJ63g?q`{B$nR2w*b#NrqcBqI`U)3J|A7h%xq*)OtrP0xGa0-X}O_D zknhNy{fz+f^>nnM zBYq(wZ*z&*m3wGDKt=Jar|MiSVIr8i|L8tF#q@OKy0M$;GbOoO=M_(f*4~Nlndx9EI^t}? z_GYf0p*{?W*L0ksN&B}JGgc?{paB4Ch=+9}aVFKFM%yzBs&Vx@)aYH?;p+&Zj~5TK z`ii>2)%%sUGCt(2NPPg$kC2D`$t?8CuslJcJ3*GF=eXX7MiCoR^4wDu=HeysX&S*f zZJqbJj@je4`^#b1gZt55H`r!QRR)n_%HTqv^ujSqX`0DtEnY$4Ng) zo~~B5yl}MJkR=XUqD)^cD^R9OKN33WYS2)oN#=E{S%qgEcn?B=fff-guI1sS_-T2! z7O&;bd(mDOO=+5R#^ku`CLiYrU`i!^o18q{G$5+bc~td(SM`Igub4Ma)h9QXA=+ka zk!y?Y9Ehc2|0hB@CfERmEM z=4|s?ZiYE|q=q?h@_5qX7jxlsbT4?#zvSe4Q-Ow2VLmu67{+Mx7UE6H5}V6b%d*PTs`}7u-!$oLhjdHi8yC`-f%2ke$4#D0@j!_BtIovXg&Q zls%^?dyvka*~#gm?3$u%6M!*0c|lS3TV*|MkI`DlPM%hjeWWORj?Jzt%KopS>t(k%EKXy9T8HqvuhM%G@G`_89vPHk`{SvN=LVh{m2;RqUH7SxI7hj0g zns_9Nq|M%J)<9)?Yc#`I#hZXKy@(=re(xZ%aZ($Zo#bKSUdoF=y|XHTGpMBt8@#up z&blp;{dLpAp=g@1>yk2H0i<)oI|r!x>QkD@~?weM3Ud5AwR zBu_q$ZZ@qAZFN##<|#Y9Yy3-~#=Nam1?PbSfl0qv*^MgKDsL`7EtnBoJ+N5KPA7FS zmBg}_LPlP~W*SB9*gS4bIk?wlXKW)b^^nCk=GVV5z@1AIb=3+edL>T~pH6~FTl#Pb zV;OQub$kSwl1fF7?3tXmB2QL3IGLtqtKPs7AFVenAbfn%AwH5W|JDr^6$c zDV}Qj1wP~iK1vZ-v^a^DfA0sgziHjo4>Y(DU?mda1s~YCr1*rN+xh7kUbJT8;?cpq&iwWPX5QpSSo4OhEz?{) zRTBG3Mg(G)v9Jj1+F6+jP5D=!fj6{s;VF0dngfpAgAjxvlB& zki{q0R$r93jJhR+7(2SI`WmXfxKOp?5|eQOpCxcifD@

3ldnE1ZCNQfUc~ zTHHoyjt{SEb*{_%a4Io#fZuVo8KfY7eW&2Sp9Iohpn9PYn1G)7!TGg|ifiFuzO>u) zP^$F1SAZJ7r;^VIhFH_qSgMPyR~>S;uJfUG0RoiXHbi9zNjWhI4F~C4g-;y(l5{zT z&tir=;Hd1VhT8SSZaz|Q)@;5h-e7z|s3H#^D7O(ebA!A~*1~@N<2{I7JrtlQ9^E4dmIX}Y^<+5RV0=@U;WJ@NdV}YSNf~UKZyPd8`a|`5i)Ypkr!Xq&b&cR|EFL4 zYAAG8%V{Uexm#0*95a<(=uw9|hX#yW%TvDRE3Os{$Dr^zy0(V1OwVH}9eVU$<|#8t z`8Cd1(A=gCw$hiP{#vctvvDJ%Co?W2o|>PWtZr`8&L%4Jc-w8Ywh1C+j;cF-)CxQ| zj%Dm=t&!ELfVD@hb2c`&DKf0|qo9wq_EO4VwU8zGy+-GjFGOihe2buHQG2Bzi%4pM zx(0hoqn@l15LgVmN*nEc1OT$qk*h$1g=t#Q#3|kIxRx?vgWQbwFTu=qHQFB<dtb zJ1NY$KmnMaXJ_~G=Pg65u=h)n4fmaj2VNerzZ!KQ>yqzyEBz~69{edy4C=&>pUTqy z7B-3s=GTJR<~s7{1l7Ys1XF6l=T;^6w6Ks!w~f?ryU!q?l3(+jBez6el1xG zRV`6eyhqR-k=sUDVD+(+ccZ+>MEV+Uu)RySs3OuPY*25V zMI-`BAjm`#z~ZY~t2JtURZ%8_RwXzyB&Tx+v6X7QVrkWi^>Oi55Jez7B;YgnL{UVn zGNIO&zUom1nu?n`~CQX%sFR2)?Rz<_1=4nB;g(O=+y5o5Ao$rH2%S6 zTwFb)B`d^t>EPzl#T(Z(jQMXK)4lg2aldP2*{dYH(HvvGMp`iBrDuw8P~A*fEvPv{ zd61dVVdlEOeFF)vwHg>?DR0qv40UP^uLT-3_JyiRGi7nw*3h}Mq&rLM(WpR|dH3hU zp^PsfrEh3nzN7qw+Jys2OHQ(hI#v(4I0g3+W16X{=o?8i*2a`5&gIDVG2Tem^IoLN zjC`%ddmfcZu93gS#`4R79NK)la*(@Oz zt5Gt0x!R;vF`f7Wbjut_*=WhyXhaD%c2Xr-v33c9ZoxWAu))(zVaS<-E>Xo&zXUju zFSfC&^p&#dd*bCtYpGZ5er(lfJUvl1beOpe{1tRIpf8i7TI-UFxp24a9rhcfw6fo( z`#FbI*)Fv&ASSF?8F{vnW6roWluTdLwzmm)TQyEdG4UH{HNHr=cA+y(_Cl~I`&s9! zS=Q0iITNx7K5A?}f>{svK;uK=*mj2qQYbcqk?dO0A< zs>^TWvLA=1xo5j+4xqS-s+|j=s|m)= z8Sg{5YmUy3!p{ljR_DKZ%l0;}J7^VM$2zLL7P2N7gEXV&eXMB6QJiQBlWrqgBrEZtFx~+&D ze&YR-c(G+0nSn3S<1O?^hJgD))O`-FLI|4vy>;fVaSIywq5|K6l*VJ}eM&k=xtfLE zi$toe9_MS*q7#;pFk^JWL(o66I^iMs4LZ{a7lfTerD*zLgXmKfkF2n|^}PdhnkLJl zN{=J{GE;wQcxJ7vS9iGvSJwT8ay3fd3&i;-r)2WR8N;C#LyV%!ZOc^1Jh;+E!mQh< ztCOe`V2#^I{Y8WIS;kc?JcfvhzOeqHS*Bn7MZak3>GjU8Gbop6ci@*6(R;4UUe@Wg z9kr)J(F-|+N8^q0eO=q0Z3pcb`Uyk3t3HRIZH4BT{5gW2l!4ZSa4wbwCyp)w{B-hy zIL(qmvdwEU88g(G%cG$^IUCuXDdtlYMW3HV<|j!HY5nQW?8%#y7GW=HtXF*du}*#2 zZm^kUMZBo}j2E^Ayg-z7>K7i&_}4_crlqPn{Y(eFyo2aJSOGCqHZ6#~FCglTbWcqB#HQUW=SSaCc#I|Z#X0Q&bo#ebcBs=(@v+T0Z6dg%8< za?#N&I9VQ<1}+pcUgaz%C6OwO$*c4^gvs;tMGhwORvfNngVYPKW3r>&d|2*i>1DG_ zU^|D%0$}sKEu!bm6zGgUfBRk|Yjl{UVcpul@vMVYWGKq&Q)ES;abJUL$-Y%=G z`AVj0OT`2ttJ65|xkB|D0n_SGs?~VseJ!V2qtGRv=D3CIYGLG3Hp({2mAIVy;R;a* z-Sw5Jo5>&A5gn|s#`esd$tBuMQLIqt+zLH3EU8Y@I8US^_$u(urVA6BIF{_FY-dj5 zUKKk5i%IT+(;>vDk1O6e-L#8NjHSLIpizxL7miNou!v41FCx9nxMU71pnciWv@ZTZ z7aXr}!#1Zv#kZ^fdw=5mlo=|Kz3KeS*OX0+$VRA~FT1@k&PiqladLIhgc*|JJ3BPY4a zRi7fOOBPC)SchN$i5(#pW3p&Nn1X1r(U5CllaN|L?AZ1cOJJANBBO(qM?<*x7-61I zxY|&NYVUoInMx&R(>^*S%2|0Cir{}^)7!TMrWhXkjS~lgR~E6Z@E{Z7Rh`4Ew+3sL zGjgzIy$IH9McL<0vQ|R(@Z!3`2#R0ufO%HCh*Pg*Os=*k>WhTi=u-_No)ZHRp@1ar zm7|PeCZEK;Qq#G6WgJDsy;3;C_ph`-eBk+e`B$X2^{@ETUg3=4oC@_?c_*W(re+PJ zkXXwP@dUiW{VKVhLY)*7A~-2#@IjBiY!iJwUAWgmHQI+7(|yER*{Rd;Kfh$O#&qXo zNoU$CEK<4R!c`X=Xi=+p5(g`g0%#(3*8N7{ma=}hH&H@ERa}|(h>^-paxeHZFZ!>` zJS5_U3r?Ukp_F3B~r{>8#IP<#? z;#hEY`;Mhj)cu_7viSo}95$$wAc4G*>{qg%OJ0hWt-tA?{O2SO<2}hT!<_j$%5i-q zPr-D87MzBGYD3AM_F>rXPC_7-4~aHGZa`~IsukqXn(+x*dQ*K&ea*E9<$LQ!1sj38MPQ2Ft;#(npi%l{Rg5_dY<1 ztW@`KfwwQVk>Rd3odYJj;G3>Uoj&NY2I5zBC7Uo&Tw}mwYiPuGWnp*bVu!ak5-Pb) z)N7fD#Q$Ol8a?5YAB7p(lfte;%9pBMeoVxDU#_oZ?u3B8oUz4xe!nJ$T}TQ^00d z4cwQ6yvo6niyVI$v&Vo-${rzsLHLOU#gUdrY#U^d3FmbggD;o4T^2|qUs!@|N z@k^RbsS}y{QoK-1m1#1AR!(H0?>Mp%Ez^1^sn83R%tRVe;Q}tfK&G1rY+2EE`Wqzv zUF{24zQc)W`@(u!uvTS72YG1A>p?QX(fDU(y~z6*IEezm-l z{3jYz)!+vNCr;vqN_9%s)}-bM@&Qx&Np69~{|Cb5lqDT%MbcDAB?2DlRD1*{y(M4t zP=3%WfJHO|k{e&@<}f61Coi2_g`l2lcG!`07}nk5lSrCc5|tfE&rI8{^3hPN?D)?z zhBE>ZFzI+;R7kI~W+k`m8jTc>?65%tNZUx!n;}&~9nvRWRzs}|cnAgigvW29uoe48 zF@beYznsWgw(mX~XPZE{Vv>d{+V_oCBVE@%hVYj@m>+y2AV+#fG-)Im%{Nnax_aT9 z#EtM-)dLcQIkTE1lO^@5(ii5atyS(v?bOzL*^e8jtqfG^S?!ha=4r08-jw@`R6ngu zk3@B^EfC%P_cAYey8E-DyBnoF`2i@lWNsAVs`O=~lNTa=TB?!32Wp;HW!byVw1cpl zD7qFXDqZd&UeskZ?SjDH=+)Aj=toF*?{a=a2S@pt z5`E;%Hwii2&16W($%L=Oog48QL_tj%S5EpgybI~cRQGx#0*#L{;!NLuuAS1<*q-9O z?}CCRlvtInp`%Z_M9WsO9~GX+tVqtMs7lj+4NHn*RU=@;c~2QBe%)H!Z<#$us5{$9 z&Y@+yRLk9!7pJ-yU$uAm8-j{uUN^jVxk{nshdTcSlrrXSvMtu%cd(@9=|W2l7E2{p z@7p7DKlek+%y*5tU9(QQ(5mzvdtKLJBU~yFdSsA>V)&f$kYvGz6o%`0B&D&7O>8L^ z)$H6Z-bqkS_H_XQMPL8KzRu>&bnzVCm2YiChs1r~eZ54mRIAbuPBxyWk?firyLAY? z<;Ww6mS|dyx8z;=mx*`ImaaAGXXoBV!-%G70MeT(XAkCydUT)As5vP6wzWB9l6Lb;SNOQ=wR9Gz}XuHT{cx4$R)7+XUzSO1Npt~wBJ#N3GFYW zA>S5rl6Q-xmGxbYqSem)Rk@hm3I$mGhqa>d96w`fFXWyjGI)>GDao4REJ%WsMvlm@ zEHD2DPd=rw#9>OCnF8z>+>)d({q9#zavDYai1aHOiC$Ksk$G$GqN*G~5vv&)Ih5Se zFpBrB_=mE6y}^^;7g~#NHX;usKc$NVqe++|{PFJ-DQMEbx;TkH%aa*R`J%4SNkzki zE>&fZwhEw$Pq5pJ`^uKF`9$v9!&eseE10^mjvB`G*@d7NDvx>SYNZxwW)#TG{z;bt z^?$A52_hHt)&2}T`+PVufz>Sa8^PC~9z;l=fzkrQ0hvMzJqp=L0N-!j~m zF5GL&@yarwG80Kj{&zFtK(^iMx+DyfX*N}AIVeAO>_hP>XUF~^KFiS9hoABtWAF0T zhINCyG4uooMzrN>hnacGyXjSkobyt3vekR0#zCMV>dDQyV#8Z5=K0i**(e-rw2+_p zP4h#*UK0|aGCiz|NjMGSOD?YsJ+PJJB&H_3&?oE~9{Tw}7Fw^~z)sd{g$eTyep#7G z4jp}|NfsLzs967hkOs4KbPB!gl#aSXMmLz7puoDYJ_v z8_@BdAVJiqJE%FyN*P$T=lg~Abi}h7x_I4bpT#dQOQO?iOS(URM?V3UcOEC0c0BNO z#G`>{62}!oN}|ueO8kJ8cjLAWUq{fAxYKDFxAW@qG+EHzK{}{F_#_`E9u%5dIg_t5 zRxDa2tV#Z0u)TUZS}VGK>8oMR{+UD=vz%S_Ep^!3rIu8Bz9=}(CN0j*l?;0zVLGgD zEhfN`wS!Q-7EQwt!&5Bq8EAB7-f*uiBc&?@Q!`q2XKm&TF*y#es%i5Q+Ejj#6@Ewd z&uR4n5q`}+D_m9-PCCzRbu5;?Y1PqIg-QEtF`DYm$O_b=9K{SLCAbw$jUqH=qGaZ> zRxBFc+i(-%vDRZJjf^)2@u$ytVOuf5HK%?8aW7o)T{W^sQNNQe-ml(~S;ae2BAPSw z(()iSgBN?=zW(D@`=h^1e|ydPpjP?rOX1anz>3C7tw>5r=CYHR$$KM%A~GOk0ZcY##ihF8;?40e>L?;@FYXdU^HkqZ&aNnKe`M8#)ctxMZ9iho3>)Yt=WyX8 zYL;zmA*`~1y_{$8$2)^6Qnq(cHn!G#RCTgCz8Az7iofcrd^k823oogm{$4Z@JV^B_Bt(OMV6rgnIrK$(2cGAeR|#R{l)x0dUrz?P}l z@G|m5C`J50iQ`$^HsohqeP2h*W*G}&y_49RubD?4vJ0;}PZF&5cCgU7B1Xhkg=|Pp zi`K!dp+vY$RT~$@b!A+0c=d73krm3l)JtO{t>d#Q{i{gB{zin$8MUXfO7xnw!KdPV zHz$HiOlAyTvHf5PvdZwheZpN!@3%Z44#jHMt1N4(cB)>kj%=%PU#hYpk!^DnSCwtOc$GUM2C79Y(q3zucz2`qJ=$5j+?ImwyY08%@XG7_c|oC8{ZXD zYs=io*)}G{)=9pF8_J5I94S5>#vx_L1Z9!p=OJcU9~STbR~!uADGrY838EBWr&49i&%Md!E|6cgvSLshd;ehzIY~fX zH(Alf$3hac@VzQ>=(&BW%2mrUbIbjf_2?ruy_AXdC)Y_?qhUf6HjJ`6+0NcC)*-{! zg_MDdlpC2G5?>QCIZpH`wkFIpv$yHUdJUX}D3eTrP&J*YiQ;PW-@dIYk2GzmN(=HW zv+_v0W}mfAM=Hs8+=7(P1{SgjP}vYe1b}5N-|Dxq(n*~E6&$52Rl^vcrd~Lk45Oyn zcVYb3OX3u*I)S3VRFRph>Yl|C}Klo&M++qNGa<9b-)*(0&wQiT28#srp-ww5pOqv z_=ob0({{!yo%$~zqR#lG%8V`O0KT0lJoB&QnCLZhGwXyd-L%Ah(UWKBA5Hm3d2ZEj zCiCRmgF?7Pcb0E#$+%1ZXgw4PZ6&2`I*Dpgh21Z`$w&(!yWRU`#m%8vV$ITLFJ5N% zk$4L*dUDoRmnFg6d#4BiWW}G?Q=We)mMeCK-XJO&)ggm@YGUW`oXY zy0AiNdnTeL$$MA8*O9#iZ$_;G4S8j{bK%!4L z;jVrgE#!$OET7{$5l`GMKza6K8orN|9t1#@?DD>t{VfP(^SHvhT_);>GN!>hWlYC( zNY>s$yvRO1KMrIfKD!DuS+QyHOUfkBSOuNDa^ zG?l3Tx)6sC>43kaeV?VcW!L}imTmmOuZX(W_hS~wkhQ@0 zog`^D+9XA?b`VV%)(J^!wMhfej_gL8Y$PG#btUJ*_n)eN=#h8Vnx%TU@S${hV9u@) zhWFMX{_Hr3`ZYj)?sA>IOk?&#@=LTc)5ga6{;#$CYL~&XTwc2BS@oXexAZV6)X;Dm zvJ;<0V*jA^gsoDMt&(VBiFtpP$@rn@EZ-SAoqE}K(lJV(*dQpafOm<%jnjTK&SEl* zxuGc17!Bnaw>b^}5H@G>jGg+a@*rD;4XK8A3Y#-lIF(IE_x;V$$XX6<*gsnKrs(Hf zY8^WP^|zH(M#2FQR*Ty$hv?s-nI=F>^1= zcVsojdWiyguGBMps^#@S3HnxGH*jYf|ETPO1YddScVVFTcD}FpmAkpAMTF&Xl};S^kvx zHi`Fc*x-YI)ShMsYprTsP;fXI6vG429Cg|A8~N$|mcB#GFGsz-K;R17#AA3N3vEyC z%=LXuhtj)Qv8B?KO;PYiEhlY4avR~6zcbv@=$mCPJM$gqj^+OJPBmvo!ZsUr^JZb+ zn1a|~A-QFYd-R4_ z|Ng7lxlPWm`#cx>EstbAM131POAE@?V5abC?vM?&??D}v?zco|*idQ@!ssGU*4-Q_ zs7zOrK{uY{k<>gHf6KAq$h|Y4^B9&#WTSwd%u#y|(lJt3hKX|kRgzm`WBm~PbxkZo zcV3h>K#zDsG8gUZ&nWaQZ&LcX_95RA@ei1w8`+)G)E(@WdDqtp{$hP>ILU7<_7ixt zX-CdZs!CtmR$cb#^%d3b=alSE@0678AqVY#1QiH@$ZzV&7rAz^y3DJ^AC`%htTHDq ztc*sMbKJtf{-le4mbv#T=-l6~&=@(*E!-q#T4nqjPBM`lIVmLsPLE+9PML1Ca&<3> z^Izj+^*3p%ER)84o1ZZYrgz=`P?hS-F{Zf5ALmYdZz_i;jFv|V6Ua_kY>A-u6lzwNeLV4eMQu+XwUQiv z(4i#9r$=&3#R_Orz?*nHhlx{UAULgL?lara?yJi_s%@!qH&m5mbXQJ9i-J1_DU~GA zLr}OWbKaGL!g)IKxFP@|V$)Jw4+GlG$F5trmD3}@Xk76}Fzeft{xVo~(sPA5q;z>n z{5(<1SnUSnl%82yj&;u=j&g?32DVK>q7`LdILVvHMgS;b`y9=zU>IJ?8WR$SYc%K| z?TwPcJYd`0Jxvb0I5TH5ec5~o1C<|u8`%)sMVgm(WecBd8sNYHnKShR$?mF+P(pT& zn)w#xc0hk4gU&w92@sL^qXJTd{ecy-Kk!#VLsn$D4=C*7ul<;r5dw}5o@I=yUyFVd zS(k5+>khalG2#Qwbdo&eA6_HQ;;Tdye2B9+b}&cn_}*eCu?H=yE&f?%;|1TedEbH@ z)r(!_4*{batNTjKQ7Q&Q#_P%6rC~s7&aE=%sc?f-sd2me(^957hm$xJ)DV7cr2;yf z&Vw1e_29$FI02|ICpkzcn0Zw^BsS+@S|oaSHON9hanR;XmWelhyA024pfb{<+Win$ zjZ6lXj!cGZjNF5k{GqZ_aRZqi(qRM=QfYU*;NQ4oP%Wf#yGF?!&hXxe3pFutd630p z52hh`K725ZbnF|`zw4u%PG9*Ozt1PFR?oqiIFf)ZC(l4ddd!Tir2Dc@ry?7Yv?o)s zR+4h{nG128EmEdw)YdIkhV;`m(Sjv zWIw>ST-{a{wB|HwksSCg0ZiyywkCQmJ-}=-rJ*L}>g#+#;T@BG8Emoe_E-4SUfYSf zbeoWhQI}XyoRG}3a9rPLGpk{w9`9s~wyN~SvPk~9xhj$wo$h@!`cjosp~_d{3>k1p zU)q#;;uowIImQuLs~aMHdn{+;=?+|L`5RA-b#~S_GG2|yv^4p?p(!Ghj&#*JfjK$J ztG^aZZOROi$~$EiqNI4QF_6k8;=pD+A9WSHILRxR zOMmc3BPxU^(1#hXxpO4R$-&@WKV|yVlqDIJq~LRGvm?tl+6UpT6#YSHw}anx{EGRN`*Oc!MS z_j%#vtq>R|J-);nq@ys2{;!DO-HMRBrCEr5I;q!$ z>q@G>hqf0sA0FVcdsG1{_ste4EJz~uJ~>@!X-3y&PTkc>rJCHzu^++7S_OaB4fCgm z`0ZQQnFkWo$u7W<>+-()%(@{knA1y*>4nW{xgBxWqzGxtOnhq1H^9z32X}Z5K-LM7 z+nD#|99{f*#?_m<`%J(VM`{`4>PU>HcHX-Ec{!R5hvmY1z0{)SYl4JN#%i{IeIyW)TRaW&|i=uvJ^r%FjHXlxt*+ATX+Z8i7EJC?H$rIp(_ zHfXt>py>t=RXCpaHX|P^o5%_PN9Y9hy~u5*?vufDdSKn z=%A*2cap2`?|`fq=u6f2X|o_lXnyi%zk@Jne=h0_w8!Um(7|k8iXL-WP|ZnfMx=W$ z{>^+C8~X4*B;_rJ&O&S?2c&ZiNSOn&m6CmN-`nLHq-NkMT70LN_)K~uYVv0hwKc4 zPW^*mr$a1ye|(kRC9hv01MoV>IfOt_w&LP30DZa zm|O1Ap>Jj$<)$9*nY;LroeJ+fWq@s&)Gj_0>y-y`>)qXnmf}q10Rfnj|mmt`EM_p?x zee&`(p`Au$%_=<4u0m)2*lRWjaO9bC5p!dN{{%5Xw;2d9uH#M)u5< zPIfJQjDTP>xwO@vox^M+%H6kASUape%$>zXQW_dbA2drqc6SR*Sk>gL_QzK8hEZ&? zxSWo&ke-Cf*Ub`Y`64{uvOB!H_bxFA!}$K^P9xv1DF}FD z^5-lo^YwPVnqT#{+$d9yJ6NDv^XaOf&_%Y;p?;ycjMNkw6%-n33w_(RT>^qm@_kHG zQ|M4W<#6_1w(J^HR%2_w4kY21e`FE16Rn+1<4%Hy8=HIxX49ld{tJEJrU##r(p%o1 zx$hl3>_Ic%Hw)|_Ix_g!i(lWj)<-k_TJP}dySemt>=oU49^C~UY60j{BHys`y~c-u zLG*#YGeN~dz^U)MC2FJKIV-){Q0Gh6>=ultNXoG5B~n|_o(4KwEYAFWI}RX|-=@rb z>H`JP^%NF>y~c+nBYs;}4bJkv;mFUf>}&Eu7~(;&TRvrr&h&wNw>xIa7r{WeJ3;)0 z6YT8@-mH8589VY0t1T&iVIiwU`OY`GKp=YSxC$~V_eO8YH~b`{awA&2yV+aEpH8#h zo)&&&(m(JgIQ5S!f67V9-bvP5Y+^X$ZJf^b`pk7v&3H49E4)+wti$og(K~+}93{Ze zEx)p=b>0TeAPwUTj1Zf;mXS)~Y_&mjPu7TZo4H`K7_c~c1({>W?cn}6@%nM$Wbz&UV&2IkUr7$oxP=6p zQj0F6QfB>=ycPbPSRndCN{8o(p@C8$-eHHjr~_QBq#FFpaINE_l0ueo5VH@ z&hHhS%M41Ll$oD{o#AfbeX@kCCsW%B_F^u}>=TTmo7Aq+35}+2)+;y(c1hPHA-xe@ z`cYvt@4D7@0NUywkb3w7{PNUW2NGd`*CVR<*psP%G{s=n;kE2V*M8i)N?gg~#{Ju#gUm2!e- z-N}T{FJZR1%lR1zVP68F#d;3Y1Iso^Y&+9XC^6Zyh{?V_v7*vlLu&-MH?h_Qj|8{{ z@XSS&BET)bVQumy9N?}hF~=uzpFm_e7y86?lyY=euekcodpOCxK@n4`7)mLI%3WN^ zifXc%@Gw~Cr&$YqNZbGvO3)LVJm2q%^LCEZF2{FA3Qhb)f=H-IS!mW~L zg3{3HsxJG? zNfh#<%Kf_9-N>qw!Lp5!Pngy2xTJDFN=61ze1v4Lap`hg5VK{dGp5n$0% z5GDv&WUZ9kyO3r$$#JF`?!;sgO;eVkDQZ`=J8rF?bm9F4XwXVd$q)TkOG?;EnhI+r zi{v?Xs~B3z;2^+57TA83Wv|(-VopMsu?Bs}Vf!ev@f6uH*61C;+fKWDRJ2k*5B9h6 zkeh9=)BbkP>F+w*-&aB+frf%=qI%qlO;$CLC(gX3s;`rrA`#KTt5g{QU?+JQMT`a_ zWLz+gTw}%3!yuz>rU*$4f6Ur3Ag=Bf&Z8-)GgqY%POjQK(Z z-o%)*8Ng@jcsFI137RCv3I?y0LFkSH#o&{d!|9)*_ECf_X2n)==wlkp*s0wVRW8L)p3U)KEeqdXaCnxcM@G`R4@0Yo< zc@k^DZ;x!liO=|kwP43~C}Xp6DDOnts9PjDFSC9yzzH>2^+#l|Ox{E&!4TV{(q*;m zL?tV1xllokoWE|>OR|cD3S{azdOdamb1vm6OqG^3mMd{yxngot<_gBA6tK)mE|zqI zUzwSfzU)PSp1kj1rb+0Ud{bzqC*{p_B^N*D%yebhOES|?h?A()nbw@VeNSSV%XkK1 z>n;tzNh}8I*@gFcS%5HEe|rH_c%t<@bJ(#^Xy$~Cc6Q_m_0vrI`Jrj=C)0kl-x<>` z{DV9Nf7)veAmYV9D8RH zk%7kM0@nZibTU#ccXm426VT+&yiQ(a0<4>TF!-JB|H1Hdw!g_l69;t$i_DF;4G#?G z-vGxWAy<|+1|kbRx4anbaL2sUFhIC{$VqdQJm;!IRPA)<{LKg>*^B=6K*@dAZSJka zaXahn4q;HHw@Ktlvl}RUVPNOo{MdFgG26}W=FpAVs6S15G(ThdR`#3wP9LipJ+wX~ z=~+3gAkPT=T0vD_QW+~-LQ5f(HS?Rg@G3gdw2(a$?#eG#X;-6I&Iy_ zY5grJCyI{0Mq_2R_0I<6x85fB&w2=QbjPQrbpCA?-z1m#kH0lX4Nbp&0WajbU5>)` z4hCl9oUWBN>F!n~BXdvW{RUxY2=$>LZw`b9lQsW1*iOQX`3DJ`}TbgU3 zE^$sb;9>UTnfI9-lo=OvHoent@dupX7dy3b5IKQ&x@onJwuuil@TbF56f%7-)Ty&> z3G2$;+4%{vU;3#==u2}aiQf7tx_AX)Mp-+c|KK%-s75q;9ShlAma891l zw>0Wj_2rQFioV0D_!W(v=#*6S9p{u(^}Wz3Iiv3cr{tc#(y&u#1>mZhjaBZ(wsC`=h82=T-5fiMr5`&z zn)<_R`J6sF$sbDJxF6-BCCg4r4>&e6>0Wsiml77Bs*=l!xtO!I?i@5%_fylC_vf2H zvFVTHjmV1e-=*^J7=M56nNjz{^0O=5w(_%NsFm((4E4*!EHIhc%Q!JL?3=joGjxcu zYr&}8vLpw;m#4bV;l{KxkD#Dr&%HxUtu1~i$1nK?Z%3w%E#LAi2Q8k?LuIP4@8ZLx z6G@d!%K7l>ujKbC`tb zq@$>CGx4GS^STgEkIl~G$2rMTj=gNzRev7F&&pK2(3@?d%8eGqhZo8v>jEbqWs+6l zZ>ucf+{RBUm+t6-4Zw_7maS|`UPdYT=OoCUWt80&qCISLLdCI>DIF&FtX)oqF6E=? zOV*wzv{e4f@(a#iZte*Y>JXc$E%Ws0GWMJzvQC4g@cwHun%!9nPV$!V45mna#rWlS z6uZ;nuK$)yk58UzYpKuDi%$(r1#(OS_ifRW(pCr}xvwFrF9pqV^ZRWd^arSv&KhQn zj3QMkM!;^2JsKbS(>H*Lt#m)4RD9?W=4r8cdfzpyrUsJMQ@GEM6 z@p%|O*vJpmZvls8g8_>sf#SoR9a?hDxPIF3MOQkvByqah)E|ZHFZvP zDZ5&d+dv965%p04F!Rn|{U+?9#qHYg%qaY}soRtRmSjl%jJnHgZT88*Nz2<#AB3hT zEtvj^%~X|qDi@fre)R6ZnFxUF`l(x_lo9KJ>M>6Gy`NKY2_Bd78^Zb+SG2l4?^b*5 zvrLlDUYZB)0+Ax+sos5^#H30_x4qPfpT`fkxw0#Q2mQX>?cG;ywS=>{{rD2yy4GNI zH?UD|uc}pq#}~=m7B~%8LGMoT>=Fvw9!OZ>DZWSv&q<7+Kzxx*4cv1e57p^wzbS7j z|3>6mQ_?4g{*BcopA%6La;sdr4c3vC9->=k>7TAi{o^h*tk0=j8egR33$le8U8O%( zH_MB(Uut&M`bVYZs}EZ2KnqrEF9TA~bomZKclZTIt|B#oY8AUS@2(2~#vfk;))YV| zar6MWvW8n@eh1uPvYLL15Qk4zb@C)BckTqp>Zc5G>Y~eN))3VRC@OJfZL$qd=fk97 z2iUq($WF1<)3Ew*SC;`pwySgHDdB8M zuPkk{{%3>C@y1h1RuP||Ttt^s+0sep#}!vl)kMnBiV}m>A0!}VDZ}p)*%I#RO{m;- zB`lfdDtJ{d0Fl1H1Q-lwNcp{d0#z>E^b!r)P8LQl^$ufecTfPyrh- z)rE8AK$#X9)Od0|S!4d}C7&xlPy>f4$nE1`l7-uxL^@~YFY=>&mYSB_jGzbVHF zxy~A;T&kd=ix8-Ab@gRRucBqMtT;KBDV2%IFD9GB`bu z=1D-5ek;1_knKn-+%>TqB(agx<>jO4Bz9@Lp=(ulmJ;%iD|O8BO2>Qy{nEOCS3Y&S zA?4X%lZ_nOC|Q)+cH@Y2j{_=7nsvltKpDEh-8ol-mRk+~&wR{fSO$mQoqPxgYAmu0 z_p|oHreA-u&K;TDa?6>OH815(mXKuT_A3-r`K_S7M0=q{T)z!Yp%^phs)(pwQeL)_ zO(U!V5eX^`=5k%8yb;)t%>U>6-}Ln96b#=da*pEuZ7`VSL{ZV zhl~xnH(c)&9iGyh(d&rMJBh!xib1}`nf@n!RA@mYE+TPgWgqk0U+7Nfgm-h@-39*838te=uLyx9g%RRqBlf zil*c}EIKg>qczE>(8ZOFQLbtj$4@75D=9M3nqj33a*%vuyIFkEY$`ycFJj+RrFuu2 zl5^w*|3-?7V6J`OG7K%(uqWk6rsyl`22r&nKe&+3w6UAYe}%wFev7Ua7WpfaW9YNk zm-h`+vGQJ8M&9cmZnT!C9C<%OT1Vasq;9f~|DELHKh_o4$U}vxQ*o3Q0IJx*7NS`1 z_#%O(XL)*<5%(3&$i|cos$$o*yX#Pq_vP_s9B2w2XEB^20v|&!%1FZ#ckRjHiK~&P zK#$B9_!V1N*+$?Cnsm!mfF>jB6|nZQ{^6WnX65vfFYDKTl`HE<=F~kgR5z7eCCD?f z{z0mR*hJz^o~^70mx5o}%J{3wnpM8EHv&SD%|;UnWcImKkdc;G%6i7rMy_Pos**uV z+a;s;kR{XT)SpY@K_K;GL$xs_iLlg$j#7!k=?PSgM2tYHc}2?Hb`$;E1t?X^l54?}Gi?x68G`hM6T1;TU@3VJ zr}l7{HU6usyT)A>e?QXruR{D|6c3(vanrI2gXeCfABCU0yJ=an&iv=Z#<)p7Ep7f6 zO}S~IG0k2&YY%-E47+RStl86NnQM1xqt`{BX7f~@8bkjwt>vjb-L%ZLyQZ?{tfRHW zWO?t*AJa3wy{#cF3x@JVZd!;dRvfUEjfJV+y&(IB8xFvHaL+2_URg?1)|}c8H6?aP zP;f(GsxX4l(Qus>>}H6It2-&pvF`lOY*sHFx(aG>rXNC~cw=!@O{Q|`hh6Mma;JU} zwgvIPKBj_fBd;p?IM@|Yrh{?Pr%;)+IBByg-D74Q46ZV=l-ZfONT3&v$Gq(?gt*Jp zm4_SC@hYCHYGz4+)8a$c!Y0qrp_v5Yp(Fv z{#*Jt4o~;!DF<*YeZR0O!U4cNzHnDY%eGG1L|6OJ6^ir(0ZTRA;cdOw##=edUf($h zZ$HT{avHwixc1PZt)GG@3X!3qKWJ}SA*x57$~&LBsE(pA_HTS@7a8h&)sqNieEG1^ zW1RVFF>x~-pu{&umTu$-F{wdDG2>wRBdgtHp}r6aiAu$9w>7>Yvg;};i`BPlGwl|b z(o5g(N-O$FG=QZW3-xQOwEli%>HE9*Uz>TebYr(&o0q=deb-eD$sROI27x#ZXnW~~ zuJKjeSlf`?L%SBMjQzk;CQ){h%mp4(Vs7?a!f`z-@zNHp>$h&vTzZv5fAr7H8T?UA zHz~g|Pwt0B16J>mMy>sCbc#ogvUn|dF0xec`32>@1z-N>7+k3!7ykc*NI{vPGNqQb zkFvLMczj=!%??l|zcR0#q9}7;1W(?@yb08itIz>*)ko_~NF2!*1h**2#Eynyom z&|3zpp5l}oH93LTlI^!i-n&g;xPK!lJHkfEtP`FGSmZIy3uQ4(r1SDh*(RMoeb%WG4l6sNUwbe!?b9jtX- zB}>1$>?MwAowRUtdceS_-|&Mp9F4DZ`oE$FA4JuzJ+)6|WQ&}DkazY0nH8m6u2JQT z#3UqigzeAyj4C@bm%qIYeNFvgBuiO|>LgAAH@e1+c5AShxv2s_nNfJ*$uelK7X`5m z1U+&IcYM(deihVqVjD=Y%;Dz?#DEWqQP8UJT)K^ z);Fg~iNL`$S)OtYh4)%~k-&KH*}TlNRXXjEoWvFsQMI-{;YT~OM~6207r8@gpqbpE z4MY=eKeTCg)1-GhMqX9TJW+zGuiSzvHBV4nnYx}RnPM1C=PM&AIXJdtMgPV?R<;~M z;7~wtmm(g^yN)gu5y^S0YMi(|wnKzvJ0`syM#`Gw!bn*zPk|Dy(H5gTaH>rYqBe=) zNd0j2_fbl-IDJ)~g6cm}4x+k8`C=3}xWlj>iN+fShZ|T0DzXhcEl+_fjt9P(2E>vR z7>1F8OE2LjdgZ{-RblWQhph5;O%%s+?8ma4>PO{N7c+#@p4bwhP{b$q z%dkC)a$9>`Kl)zG`{XGYPi1avP-`JFGtnS08f{{U_=l^~V@mtKLh5@V%Q)40=7xvy z?I#<{-CnhsX!=w_rfLMVoMw?w8DCmhp1SrMbNt%7U@)Ej!^g~ z^1%422CH&-9ou-#KnKAT*Hbx+=MQnxWT)y)c?yPxAxw14wt6S6+J@}7q>o^1(HhQZ z`Oe{4kevA0Suk=&`j4EEKG1%oJ;NjIYDe1gU`NbDF6+%>9#wD;by@C$Vi;GQ7MEq) zKJqYI*qf95f(I@H;UVm@EEO4TT$XF_;kI{K{tu>IJD26dKww;!(jM64=|6B;o;Z!3 zumv#moy5MIgdOWd8dImdWR=sfp0(g}W;~XSv1_Vpnim(-6Fk03U53ItkO?w8Tzqr* zley(=k!{A@5U=6FkMfz><%g>0KuYJ@rLcEtNzK!RSZaaCQd=gQ34oxlwLp+HN{!N< zHBA|Zw5&GqDfC^gI(miMY^+pcpVt3^=8YS|=C0m?1#O2|vFW=fv+mdPzUUam;|XKs z4b_=HB$AnQv(R4F7kjy~ZQmDrp0e#6U+nS^d{~roCjZIsyvKNH;(FpCw4P@Z82qoj zcp-tof4~~sDf8LTuqyAO84D8O?4sIxn}T*_ZrSRZUL;DPwQDnD)^2MXy1uRL5Udb+ zZB5(y8rH|uMe<7SJ-B`lbFbgiJ(6{_Q#o~;36FfaHxKFZK5*f!{ux<;eUA|j@0RXT z_d83N7#40pTq?OnZig_Cc_DtE zc&0So3e}$g5`9zu*1dT!{sXS%R#!_(_rA%xbs8Q)2$%&etKF%;b>sJ2;Ez%7doA$X zwO0d_-cOjRu+}$9gj8TPmB~|};X~LtvGRKX(;7_Pix5w7YS8^bO5X%!~PCumFQ#k>2R?*-BU z;Rb#8%zxxtQNG=Ao=yOg=IM~P6<<|c?sm`mR&Y+JvDxPB_cpnFGtlPh6w}sWF>5Vk zjQc`FFk6UKolU7{qq^+%YG=gjl~cE$dFGkBIQ757A|IPR`e%5Hy9OtZe(Ka8&il&r zseSY+ladv_&qb}y_yh8X0Dd#4=FJ2YXn#^HG{;1$rAz!NOFuez>5fD2ct{?fKqI;8 z_dcRoIRYa(2DiSbIm{TO5;h7A;+PS249AQpXQbkCJ~+Oa**w_Bsip04BQY<@Vs1G$ zo1a!$Gpe*ab@l*qb`tjYFn&)H=S*e1DOy$55<8C%M~kbysJy8#A*0}h`rflIQj-Qn zIm~)hG`=Ge`+H^0*`<^z65Tp=aC9yXa2%JF=^p!3MK+eV^d??^z$-x1`KJW6HqPO^@lPxb6My5Q-F-O0Zk7#Ur#Tp>p<&lhm7%h=c)H*kcU8lUM8dm9IOQ{$*DA4v1j+!v@Ejc>4BC#&lg(hk_bn^P$2yTW z(bV3TJtlz;!nl$#`PQc(K+l`*poz1ou%w_12=6g*yYRLAKCYG)n;ONWx>&?&svs4; zkYj%1;2nBjaFlAfchP7~S0JJGgN8(WB4FucNIP|W;U@C9w z2Dq?&S)B6Eo66gcG7G(}hzG()x-4z@$a{vuni_ThIzw0ny_O?`R_4f{{7CTuYXcb+ ze^kV1C`0UFzz#CR?$w9QKuU&~P+qvl6H#!oQm;gw0;yL@*-$<~Vh-2~*M0BD;ks+& z$=1!u5WALYp#W6kS3KLOu>rhGN^|iD9iJ1;4;>dXu*}9$(or_Q;t*Q!^{_=77?_`C z(GRUfZS#mG4VA1aYjWyOKpF(0+|iW4j%cP5LlKkQ7~&?Qpp!hY|9PVWdtB1QZhPx3 zHU5f#vf`+D0!l?!&BUqbs_LnqNtN7E;jU)mf(*x*zV>x`&nB=KBmFWNX)8W*Mk>G6 z6L11Ov!y|*mHUGn(Mt_<5&2{e^&eUC+{m&woM~|y^(uiUn<8lf5a%oq$J$fF#Ji?h zi$V(VR(6bzfFsJG4~f0>2X4=w^8@WgO0ZO=i)!~JabkUnk8Vq<_wDMR+o$$ptCGST z6T1klNex;Y!~l~fC_ld=HjE(T`SNgc&ITqkq+ka@a7 zI?|xOQqR^`L+fNVC43UP12dxCIw?Tu4%W#52We9cRLWT=*~|**(YUYVm-bgrf8~pL zJ*C3k9QIq?cE1>G$}LT@jrH1@+>7!^qnxQXJ&so0neR#%ZRYI}3Y5&B_P4K$FYLQ| z2Gf?NrEq!4O6#{8$yqSdj-YK%%to@HOQFupy+`7(>PiDPy~ubz+pQHL2VE^jzn0GYQ&4qQi5;uPD9A3@g7F8Uzdusm8} zW;x4a6E95n;*nUI=_-pRzOg$CmE~IQ?o+$To5YlCNlvDPNGz!lF~CK8oGIi)Vx`P7 zJ{O^o%%-MoXk_{YR~LDd`q6key^%B&Uvv}YSTD!&kW$G^KDtP1y~w_kW?x*nlV(5M zkvoP$GX^I-hJOTQ7K@?X5w5-4C=*|lG2kuU1AL2P>aYCBwc$}IzQZv!W{pp;D8o+T zQjx^Q)jjPxaYxGJ0R@h%rQVGq;hT~hz<|BEGs924y|-L<%6OZR_gOn-H1)irU-Z=n z$f>})MbkdT&IYjyw;Re3qS}fCY34Q4vw=UED0sv>E3cRyB$>SRTx!G@$xEtV!$Sx2 zlGo6XXFF<0?hoL)7t_$=Ae!qYI!*2KicvvK5{P2y);$9(U3jfvNyL_5N%o}wg{8Jw zSVPH6(V8u?PvN$EUV$K2#ZSUBCIZh%oc=Pso3yB?+w9eVBW`9jz*IAfVW!%R=PXlg z?ZH#Pkny({cz+Z9$gjNwh8M0qjpuCb$?}w2dkN9WtOPVmt0S`fcWby@=cM^UPPxvP z>iv{sIeXnjNm|ru#=Z)16NY|Pjxf3{M;PhYUnBA&t-SP-P?<<$r803<2aPs6xsCpb z=PXK6@)Sh9w9$*19mpJzw6Q+#$)l(U`snDRkf1&m=%epA@;+ZLg?*QRw^1M4yBxgL z`oVA1xSX}Ux%xryp^tyjM_K9eXrK~G^BVY|*SKjGR3`ct* zJMpuAiNp$yv96AI-utqs-S;x}HG+o$Nz6eO`+J$Qu{-6=rhbguaq9^{Eol~O^4Lo; zZUXPM5PoLH(ruFL#7~0MbRaMBGQTWRUfybM+O)sWu*sAv)3VO=+jwJ2FczF)wbbx+ zs$38Eq<-JS`Q_aj3|hfDfiqMTCGu3e*q}qd?9Mff0Xht{^PX39uo5Ov+B;FOV)oI> zGZvaAdJQi!KELZvw*J2B4$JrTJ=MlPgnZ>HvrWfq-GSoMjP0viiDVy9%Ud8&+VkE2 zV;i^0=7?Z!u6jwDi2XOvsGo6A-`d-}&v8wey+wsnb~Ch&4hl&K5%GgvV#Q+mT|?zu zpuF1QMV-WPke(byawLC~s~1RL=+|nqTGQ1#{a-N1d4fvZBU~!M zkIZ4ikxPvclaTHt8zDGv%yW!vwKH9aLH5cN%U^%5OiyaTyv3(%aF=<7{57y5A9Tx% zL-nlYn9_Yr2nng-)b|D*3qZcjb;oL{{|SuMs9x-GK8GnTPo2@X&^Qey9udgOp5>&( z6{@$u>81H_-o9^>3AozpOPyR~wygD2e(f+%F3%a}@2TPadbOZeF~k51yyNU5JM_Zb zMfSzt!;9=9BHG>`vC(bFO=v83C8B-eSplfJ5v?lKvy&ur?|S4p2+hnHrcmLxXr|FO zSLF}Gb9tXPvN?f3oW)G5N->omxqTxiJMDa1yEeTfui7P6&W4@Y#7faG$c+@;E2Wv} zxrvpHyw6FjT*Zt0#LByPr>T>3P3cf#a}z5?zw02eaK5 z;z!<0bxtMYUY4bxds`-s$gKr!c~zJX;gwPv6zO24^k&KBLfEn}@A>82XYV4aDA0fC zfV`gUl)UbKNpL0-WtS0)<10u3Ktkk<2k!Bih!yOZX?zw;F1JMEv)z22>AQ(B%%y>g4 z9+y?!#5o~ZN#1d=?!}UsC46x9V9N*39bti#MVciMTA zCp^JGX}$`7$-LA%J8x5{Xlx`qZ&JeRONEZ-Z3Tij54k@l&mpe9Jy!F_G@}cnx!uCx zTIOK)d50+m2_3{|na8+U*!vQfio&d!f*e#bP6+ZR3=C!~X`wdJGugO6ASapCsaVyZ zU+}98qJY;2H{0SPEUtczAV!uu$&=UesX-1@6}vjUmhqBbBo*Xqr zgfp6HP)`O57bmPEZDc0@2&|e=kV#mTCK3JevC`e*9U#z%cCOlj#)?Sv5%G{&RHm?5 zPm3Q&O5P@dc>PkruFMMd;vFi?eJXMiuhX1QNlv^;o&wvbm?y7_3Ua+&%S;)PlU(qU zd47H`Uw?EGH_?N2a+E1NH+APx03+^|tfLvxvY(=6-ozips?xbmQYLq8I8T1pWZy}z z%x`85$y`}3C+6p&u#&7=m4m1|26c$2OW}y#yvB9_UJsYvs@r6JMKBLTXYvsUyc@NWTrOd#S1MLdE2LkXu zTHJ0rM+;&66hJ6#wlZhprjAjto#a)Z-Ft+ZA=&T5PYJW44&?uE$i#p!zz5+0;k7k1 zWSBcAnuMAAC+mIDvm^JzYkct6xP|cj6LeHQgwHLZ;oWFBzNi4?u%=(;O;$2EiGMS| z?3(^ao&w{(m?y7ZE6A1@KR?6U3+(z*>bH3-kzKwAv&OQSWwDX|4&RA`^LF=MyU4dr zK*ZVG$03WzXxUBD-_Fxq~)nV@-%m)f;bVM;72E2xkX-g+DOe4C0uB3gz3de9+RPc z1;ZDv{rpca;5qQlrdqBI?0xi(tnC~#IQn?58GH#-1=~%`mZE_v>?CLK>}^z^SsjoR z#Ez?S7Wa;Lzk%$+rqfWtTff}Fh-aM={$9`QuhqK_*N}~U@-gml`GjH^_j2A5HfCUgt&=ciLaKs7HGu`JUOYRp*);9lMZr8Y&NnoB zPhdPK&F=LU!4LN{dyYfjp20Z|YoE+-!Mh7CsOzE!ZRA2}XOt-xFwaD>4HS*$V--Fp zc>?R-Yol2o<)$hXXN3E!gmEX5_=z^<(g7i zIi;nJrc}TL{r*nO>CZ_nl8!DA_$*8G3+|a$uv!WZq@acdpJ0`D7#d`FGoUqsShMwy zMrJaPqoAW>i;ANh;M4iO2m-rPY=n^5mehe-r3I&cN^1_A&~*Nfp>jWr*uT*`7*!yo z1%$Y02O7WvR^3P{W!j0>7Vd~u|77;8By1P&EuhS$CvP^de0euYR{e3gBoTEM6Fj0& zKnW|+Wz;13uGlu?fNsA z8Sj638I8faRX*88of+hR8ZMuH&8I*`8N-{dQ>!*&!K%S1SCdZIlxa@|X{LNCwzWq4pC-zu8~G$taDsVzDK{rHH1Yl--dnZO ziH~b1V{*?tIe_mz$WFY6JXu@R?(*tQYsU4>M4?=sAYHWmuXc?guFU%%M=EBpwB*rA zek9E2RV)QlgDH^|NStE*cF?t9}mdq9R`IsFx=o-=x%?o*8i8V5H zr_~hBAvv&5bnEAKM{1ON!r5KU;qLCqqicFU#HRiJ^@kUu$XlqS zu{HA}yfj(5k`VL0YNF>XfzP%X^uAGIr+o{o&D#ag^CKv+`!Wl~dITg#>D|*e+6CO26IA(#x|ZnMD1SLs^+Nf?QL2S?kA5Ac z%pBg!Klv?6>THf4WYtNPVriJa``L~z1O|ET$8%~#j9+(9A@lUZpv_&eKwDvBqcfBH z-=!(eh1Qcdqa3vU?A=ebrMezgP{(#Tkf$yBRS!mDO99|SVL5CY3I{endvxjYN zqnJHx^HXUt6_<*(ew8~+58I5U?C??(IE|HaP)ojwF8#Jk@{?N*q=Kr>HLnxaB#)=; zS(#A$mLoT8?JB^;j^Gxz*lzu~Vr5gN7$7U$_c=>e(Cw}YPHe3R`qXn}U&tP&dB;?N zR?n5aQqPsWq~)<_Q(<4pk%+p#=v(AT4rS=1*>^ZP&OcpO@6XE~Li>5>)3uM})cRZK z(^et%Y^{aaPc89FXOy2&l|DNnn`fiy=i!+ z|4FDdLa*gQ)>E8mZ&IphL_e(~rb1iYNyj*e6DZ!lv94y1Z|iD$v|j3t*b_!m0I48W zoMd;xC$LQV*Xymi#4}Yxj&bTIW6m1DXB;`Yz?_o`RHBo46|^ky*NyH`?476&b-b77 zVcror&vo9uInP+aInO;knG%bybnp2i-BpVz&{kg38hIu1W(6UFF@X4| z;-8hq+je#8f5W)AF5~^FJ6?F(khpXy`n}dF|dKXSe{k9IWYZ@_3 zx^d<=yW>fkdL0C(MifPxMhucgA8)i%}W%-;V*!n-4i zIq0}&mAgS!4ksN~u!=TUyUpbbfpbdBq2!NOqzmgtx^L++EHC+dWTdeovT|hEs;Dz& zWhLsF+$SYeI?|aRjc}OG=Y}RH?VD_z{N7MS(lc7QWsSB^L}0h_x^3)iyAf0>fh#SK zig@MU%K7~1>u4}$=yM2!CmXc5^Q>GsyI_``Z0ujVzEpPEF)sHDPfmOE^Uc$}-3qr! zS#HTzrt^)m?ar8&LbF*avuV~%{U+K@u4Xp3DWJ=>TFWbfw<^ff>~@utv1Jjm=AN?| z1q0nHkJi_`ipt#`&j|Ltudw6Ny+K#AMVC)cAd3Siz6i!fTz0r1tJNo~X;cSc>kPsc z8ic(laIoOG&&^5viMHK|h2HJ_mG@EiIY=!6LLxci7y7HaF>;lYydJD@+d-F>H>Eu9 zE^`w7fm3iuDWOpB=aez)Eb6ZEM)M@}(nl6U9lH;cz4@giUbZ>5S2R@?S?NwZI$G8m zb%rw_a=VvxNy3VSOEqM6i2nCa@3XJN`wPHhms~t@CaRCelie%1hH3?v1;rMZ-m^LN z|1bEQ^vf*qEwRKGXJ18v8;RQ7-Mt$AK)78<<51XRKT1ykxf~?dpA<00wvw?iJ;S*QEp z;V!aFynj53S;~6QZ|}+PxDd=NWI6T-o`Gm z9`X^M;?3g4mJxfHH%j&?Q(U{5!f$qBym1qpK2^9(xP4+@d6ynPAetUMOqB+a?ak4e zX0b5F4{{o~{jN>87TnND%DI1fK;v+JxL1}|MqcwykA7Z)8sbkRTu zC=BTUU(#ZZ4iFa|;3*(%rvrR*gVh002MSVMV2SAW^q!7B5#NRma1Us1>-*w4KNZad zd1U2(7W`y6vzA4w>M{()8_H|s6`ZZubM$u|P#OK8P3Gwk|GCa1sU!4U+3!HhFKpsvDwPnlcEn~^P%FUocxWtMTcP-;?P zReDrm`mE;o_FYvD|I3J#7Yr+W$Ctyq#&;lwuLa@Ce<3VL%$tJ{pnXNSott<;Z% z?A~gGn4x#%MTPsO!HbpuqN;FfN9sme9$uK9r0b_%(peA_9~s=NGPqeg!^m5s`6c?% zvIyN`#feWp{(Qz;k+MfHY>2psc}5tIDNJ?qdh;sa@9`T8k-MidT$Qk1$V%VJ zSX60CJ_*4ppYz(NVCjE=aH5v=mVV(c0AA4Yl6|(!+ezHTYhgZAY+3!*JbMJUXhrzcmV9@J0 zb3I4Lyq)3Y>zLg4Ar6ChhE?BQZb5g#pybxQcpK_R4}L6`b=0Z)f$PAk9~%Hl)DJFw zHuPHr9Tjy*M<;ZocKpoL``+{u2WuVB4|;|ro(K)1Y-|@{fdD;0W&+fEy%)j2t09;1UfdI^hMc^o^iVs+%vw5Hm@4p2pw}#Y4Q&Gt&TSmDB65E{2iLP( z4oAUr)dJb!@;XoSms{B{wvUQ`L6oI`2B@*bAj^=KA>QEYcS_J?9L)*K+H&tbe|4G|GczKFatO`=c; zHju)JrcxCUN4+vX5cT>(NdQG4kOVk$CR#_m&NwgT-kH&PT^${HDUcRu02K>}yi^|J zj$CZZOSkQHGwp)_EOpTFI}g2i{7~3jU!Ca+cr!qbJs)-fuH!PMPF2?{Zjg%#z_v@)~zJFou$iZ#ynT&Idla@r~RG zV|{ro*FGC-GHRTg{I)g*f7U)qjpG|u?+#p@R^!Z^B8rh-2R+(f%e3gn^efffe%>MD zv_DPPpd0mWPq-$}X@=uu%1tK;^+a#Ll~Unklv|?3@l~z~`W0WZl{mpmb@Np<^ar{1 zr$|qXL}CIE)vXUnC%Ee53@yqy9cXCI2u{E44tAusr|(S>6#QbjG?aS9t_@rS5#5!F ziq#{gW3+5sm)G$&pRLvXRx!Gq{72{2*Ya?3ZN_N=|T5GvASxykt1}1VfpXdZxB%EnpvDBv3>;1|n}i6-AM+Sxv0*nd{x~ znBYCo9qqKgw9y}X*qObrV2;1^C^z_MvAt41HRN9(8+5fEt0lTzU-1Q9a0Q5!YmSt~ zYy137aA3w(Z|#wq$!uHd5+V9eMt}8hgF>KXfnJ8HelH* zO1TIqP0!L|b6yD!g2PhJ%eYU>P~#33*nF9ESb%gPIfH*XAR{?l783h5h;$K-VhC{K zNc|+8-2QRqkY+G-{I{pg-S^9&PM5!#vVQ$ZQtvxIC z$94{eK9swywt2?+j8pbaUT>>OR2N;Zb_rha-AAO=!a!F~0;=NJ%bXwQM^+mlGr2uD z@_j{bw->upRdtoejn6swB9z896itK&wMy+v-!NSaJ`BX+RKx?VEB(~({JT|+_My%> z8B%NuRMnXey6enwQ2u@#Am{u|jQHNS(ZiJ@G+JqCkstHx3xDBUm@6SG_%684*3WF$ zFHxe-nvxDkZxDve7I_%a(}U##i|GQ=Q%kk@P*$;=PTV&{Sw;#^BU%cP&E-m z2h|xPk)1kK$dOQSp(B7?1yBrUY60(km_XZS_muwBEG$Vr49>O4ef%qsIAT2-IgY85 zB(h#`6nra>p2Yk(1L4WOm^n-TtcFRkDbDEEz{-l6uY9aCKEvj4h2c|0Xd6zIc~&%( zUGE5-U!yH<)t5Tc|M`rMb?v2tx-qy|p|Jcw__$_lnR7;}O4<*n^1~;z*~Em56pQMA zc|QNB_^h9bAFp#Qi*9~k2cs^`P9HRtj_9u0smwR}#4YV#NI~b?+bC?`-_}lCieGug zaQaQx%h$6`ZdD73ES4)}cEj#v#&WbErz^sVG?rT=Qbv3hbtd3^O`{>#SW z;4*u{O!z4hQLTH%)fvs6u|DJNjN}vkjA-0<>waT&y>Radx-or*Xu_2z=+w^ggXh4)m6bW&==H{EoB8#BbH0f=zERuyD}veWr#n` z?+_Ny#;z$VkGE%Z9KUC5ow2rks3m^$g$C-@jpu%u`n2S$(T;TlYGx0WA@*m8lN;3dN;-@$Jr2fD(qVjAe5J=%k{O@E zZU_8+2R_vx{l=4OkTzD;5YvcVu!#Qs)8S64I1RU_519%&4f%BRnyP6q?3q1GhJU`o zu;c$4zhixkdkDl+b7uM;!*?WXk?{NXgx@RC9-+x^KBOzUCZ3ToHZC!Z@_o)Y6khLF zRE~65XWj*o`x@WsJ;{G%u_AK0BKkH~fp4Ykx^;fzm>wGo{eJ;jc-r38&04BX-@NB9 zJ(#|quhV?Y$kXA^ilVLNf;dpr7QO=gu;4@=l3#?myZP14UoRq47ilRr@gBeNf&yq_ z#CTGnU+()xNh_P)v~PrPnVJcbY29+BY%bVyVYFW?bqQ1FS=9A}xIdRN4DGP~Cv>W) zbi*%_K$fj5NQ7I`uZi%w^b_Z!i4jv8LL(9DM$CA54!_11x)FYve2(20$xkADkRPcg z5iaD%e#%cjksTr{KATU&@$tM0KMcuhA}lj6?{^9#doT)e4YqWQ#>gLgx1irdCl{-e~ zaL9d%VBt>d&l~~hMs0gD`D}Ot7iHRM&dVX|^fog}76y;#yt};hwmXumpExdh4p|z$ zSv4O1D=YF>YR}=e-rH-7-^ObD3P3#;68x%7?kXMxbAnH+nhVcGPB+#D9*{$ITmICI zr1qed@nY0Y&85Pssh?4nT{bI)r2 zckI>mSdc|nZSJjJH8QiinyW`fqEjLYD0@&N+u2=Ryn9YFviqryIUO?X2 za|PErX5}3sj1>jyl)STujKFYqcUAmVAnEWkn7=aq2Ju(IUon40{Pp9nkiS0s<@48* zKR17Q2u2y1sC%m7zb_BLAk*6k>Gwa8hxC6c53yfW!nV)&TE_UUh($`~_M2U}H@?o) z^Zli7i-87o!Wn>?qN%KWs87_HBo4juOG&C-5^f-QN8gf z_suj-AMY~~zS3=S_3T0xXgge&P}g;_o-6o)oc8O^V?IOIeYB5OvA4YsDy>(|Q2*EB zuGL8fR`e9hd$vLK4KT|NAzy7oxjsNQ@`|msA1XShbuA(aR63ycrheI#%670&TbQJI zUu^Kt^w?6V$$IKS-c6aRGit27kEy`ySu6=6qC1cI4H=?dUq{L^`M`Gx_jSm)xezmL zqEM3^m#WzL4%ej=TNP9+Ux|)Hs_gik993ih=rfM^O1W054bUIZj2*JyGX(VB4)BT% z{uPEh`jMT!(%pKxfv)V^eC8~>f$5BI4m0QwJMLAgZ!?kd2_K-ov&YKk>I}g8rTZJU z8=OKZsg{chHd;R-Dfty`E0HxB;;Dl?!~M;R6xt5zmkg(+TP7$}GjR)5KlO>%k$R>s z76YRjnb5%lhmnao$h%6mnfrYiICfud-P92@>+5+I@X9-=>wd^_b^zfYgU$z{{(xTlOBRCtYe zc+U|}c%3`C-lKWr1|`{WDAr-i>oi>f_4U*Z?jVKd&u#9YYqWkf40dFO1!B?)faU^J zf(-mRJD)Q8BM-b>De_dmlxX2KuhvoQnD;S|?f%OB(&)kht!fOPXStH~_bgsbWdSEiO9uolF=)v*SN!@UJjsJJjYwWSdlew;Vb-Ib* zPTd^s)>e8%6+cW5&#ZB1kv-CCY{??^GiQSJGKyU3z>AUqSQNoz#C$X!_P!v=k@aYI z>N(vU@Aj9b^u`mg^QsT{#$lb$*(_rqh)iIm9_#r_Nrbv(cNeRo%gRik%{nqbh8tZZ zx#o;~>uy=@6xG^^YIdSsQYgo;V1}M8ouBLl^>?JdUrIGz69AcK2@I2Qq43Q9iztEg zYyM8vFD)`qrj7xiT}oAJi~xoss9jZ(sbCHjWWGnfNKcRxTncW}RO^U+|43(7RSKOw zy@(R%s47%JY|7-9%b`2&x9DHmTjfMseUaJ^bE!Fius@a)TAj0+?q-v97)-R1YF@Oi z#R%XPDZ+uF@B_lg&D+a+>sn`^EcEdyW*DSBBOk)evWY3s28_27?PGnuwm?*rYR(@5 zj1y>KvD6oPb&>j+Il=0}QG!sa99-M{)TY(d4fasFFckDL!DL3mtwnDG^D0w>q)!f` zlJD5#$PGdmwx@HUw%`-$rN3I_FVdnpMYq`x^RK=n^f6B7^)MSXJVwC)!vo~=*f=1a zZ*~FB9rz>Tf)V*;_!lyKK4|BVRLB|h41QpIhA_-+)(>Q=s zSh@`)m4Kf1_9}%1PbrfQYhj;s3vGW=EZ1y0RhG_fGe@Lg)*;=N+E0+ z(s<0$n~l$_4%ztJo55#rK^B+ilGmvhk;h~#SzJn-RfS9YAmqQs<@J0nNKC_L2GlyG z#>SjYu=!k<2G+osFepGRh&!&$KTmy_T5I!3ng2JchK0K;!dFD!j(xsTB8Z@#it?>H z-~S(?zNl?ahL3c@dw+#Z@Gb^m{|wKuf57u58_&$pnxyC)h1+yk?>)D$^&Tg?maR(5 zBReGtF833lj9LymSl!ryJX>e}t$2}O+W6dO-caN-N0#WN>ulK~j#Q^T(ImOt$2+eZ zpCaS;5#jF1Th&Wj53FpsqVO!~0>sy0rcCfckw zexBox4r>p2UDVp-Jgm*h!_Y0x*Y8cYu8ZYGC10Y-l{TYBqmXl*ukvW%La&+Q zGYC_BA!uO7NlnP-7p^>E6WY*8Rj%OBwrD3^EpjNNn4bh4Q4 z3j9nDxAh=Ffn`nx9G7^6MRNnR;S~Sy|9S!r3Ec9aYhZ|Ek?7xK+=8U zTLJef#Y2JnF(u&8o043)(WebZRd@`%zO6lZJD5c9mutcPK(;6RO%HGER!}@ON7#WN z7j%s5jNDtuGu{#0Hhz)gjrCDG3{acb#YU_`aXi0r+w}cjV>35POO$AoO$8w6khgM^ z7U@s3=1>E{Z#O!AZDB8Ye=N@vKH)TGvay)_!0JTX!>2g@Elp|4oMHh5(AyJ)gR_23*A+;V9#TvNZ)QtWoexk zoQipderSXB%abSD(umQGwNSe(U|cOJ^pF&rbkiyPJ$fxvlzNr#7J;ohddG|jeI zt3R_@?h~G@oRA^tHtY9fdSr8{NI+l^IZ2HSu831<7SIDW1hmK+Y2IWv$Y4Vs9q}0q zxxR$ILI9FX@R2>g89e;*CZMK8EWQC^?8R_^>*^zFvw|G%2RzsKV46OohI$;#;CMkD|zRzfwt^*w2t=DPy${8pQOa4Y+tWs!yZPb!l&Rn-=P~O&YSmu$ zJpie!Emk^;U>KqdE^o80lh0@zdJL4OXH(5sVlWg=>u(Y0C;H;VEPEN2kUSU!{>I{Xey#wy<5q0EWPz5 z{1qBKL^)`~84&2QzNg;Lytm^w&Aib+D*;K`N&O-X@0-o83|l7uSV)+g1k$+7?2Msl znnI+INiRa5NC5Wg|HF6x%hmt3)!F)H)TA&lcXZgFpr|psa~*pAG*{)rC()RhPYdO9 zyDM_tO_=N~IH4r!#q#4~)${AvBt8%%Tf$&PhI zC?%XqO)o|FZS`fT4^FF3pSXcF`3Zkz^VIKo!ZS{G_r>&+!820>GW1D5!j;_v8cgw# zL$SP}nRE5hbv|@XT$SA>Dub+iYj3KJ!z@E?4*rcG((e34bfmS}9UL0^1apA=;P-S? zGFa^7$R5oY3&ha^8TU=FmqUB}m&kIyKc^kPI5SmFDVlywYqK+0ii}q@u0p&fQko( z98ns4K9|ABAPQs<<|s9e(iS=$BEvzVyFF3OyH4=Y&2es(D%@+7KJkWpGY3P>@j{U! zgd%~-yhT!xqDZ!4LXE6OiXzP^z>5EcAg9z|DfJ^>%j0N#GW+57uk%y8p+D*k4hy~I z>`yjl`-5Y zW8f?%GxO*-`lf#}t9oF4pDF$w+o{g`wRFwQFIiVJN*uQ}T)GmQf%apyb=3wc1#1^H z=M~aF(dzHy$Qo^X;*R99-=1jKKS-vWC1&v#Z4Kt>oEq!SQ%c<27xx*5C)a9U#O0s$ z^3P`ZXP0gq)j9B*yVq7g9eYP}I5;WhxNWjm3pnH-JzxH#*-=&lmf`f?gj=uf*82s>*82s>-a zC?8lYLvKM<`TtTazRJ~sTB+oJJqo|}r=9d`v+is`A)dkK|4G#ys-3JoxDm_`6r@kq zCal-1$>nCed);qKXCs^(gfxAu?I?*25K3NMi^0#xcwrw4MTjb2;TwGq-^zs({ zf^}L%4EJ1UOe7Kjt{k)7SJgOo7(67M}T%A*9DA3Dgj1^fm4)@^{-T zAH@CLHZa^Wf43$P!5?9YP~sE*KIHFns#zn&w(#c`J`9AJv z8S`PeaY2(Bh#JrefkFA{`fw$GW3zJ*DN)wxf3Pnxjsl{%OiPefLbt!>cS1g$Nb+}( zm+>HHn*iu5Ug`mo!tp^8-y`ub?}A?51B7!Jtc101%=>FaN@k)XaS~O%)!jr!?~64B2PtCS1l}l zLYNP#x+J(A#p+7;P;&Zv9%b^YaT)E86vx`eIdAQ_b0`n)$stRfF0gueXmK zF4b(4t+sM{tNi4VE_KE_PHlB#P_fuJ6mdvdTtp`iYqRr;Cu{e|8zyUWpli`Sv;+^! z2Kay;y90Bs;#?UD<0lk465|dX_=(GErG=LK-J;;9+*RFG*^;rH-~ep!1UUfrV?Urp zTbL_#vD=FgslU+0Du#E5zcj%;+pX8f@&@QeRWUjS{m5>A=_D-AN^vhgCXP02+))6? zVZZa8RFUGZ!Yk213JP9aQ&Fl#MJ0=by`Ac(pPocS+aTRa-ax@j`UWkcu6~kq ziO_GSa~P~psv7o}?(tXdxjt4k03FI2qPX}=xvnqnRG7>w2FKs8Gd}el*?mJSufqNw zYuLWpVt;=C=zj}jtq;zCg1+Z>w)!gHpNc>E85JlL_6G0tJ5Rw|vvUwv)}Ck7R`hfS zYh_$|<&H-_8y)L;Zk_W>U-(2@;6iXwUQ=;(@S5`VsouofSRBw`&`GCf=-_V1$(5V9 zwguh7@6-Ishdr@#gWOgXz8APBf1FPD=W{?`>!p#ZP4Lf;4%~Kv99qV_IzjBwhU>zy;EeoBwg{)VK@2sA72|gA>sJH6u znu^C=+=?asW0?_g{$+Cvt|VAJed}qACm{pM%G2rk2Ki&&Y6o7}ee%5(XeG7zH+8Bo z&4P|eh3_hDUpRr^EjF^K{V0vUF9C~ecFgPC;m)Cy6Sf(>D9Es zicqe=p-(Si6eLxL?`Fjl+nR$Iki|Cp3_uA(* zrVhw+9k>lUf|B;vTuLD%32{HEm^r#0LmfEKNNn236|zCd`nTWHJKlpII5bmwv1*@U7JR%IpC zDI6v8Q!H6&R`H{btU@kHhW?UW_!OWNIFkJY1zC31kX2jT2k@Am8z-z6dSZkfyN6}_ z8>cp3^v@D_?BO?19zsAym!&;rxnqGFnCWr0zqJe9fJ7O1i#>L2WPM<;B-CmvH`P|| z3+}EP)@9mtp3n?JBaZMitGi7)mJTAM%Q+jq5kbvoUSrK{qSZtf8l)2sAm4Rpl5)QA z0cYyj_5r1f>WNzUqGNHpUL`MaY$(>39^i`fbPO=@Ih56dzvt&}qa3h-om+|V=R&pKK-rznN>=1jfm&sr| z6%B6Xd%u%0ZMMgRYm68Zhos|bTz_UiiH1J;+_NV#^Gy#Q&t-m0yBkxgub^uTyV(Ny zc}C^WmZuS3k#Kf^2Ma#y6e246*<*)?bGidvBa3o9QLfJI%g8f*sMKkc2e6<&o@+du z7vvxJVR{05k%Usa+N)~_UyI89Y`9IBia0M&Pi~$rR8Kv5DpgPUJYBAy`tT(2QNnWy zc^amk`tju9Ny+B1Q3!&g^VL>en?{=KH@;ZUP9|29uSMmEYqB=YP5LI%H)qm4c6vVP z5X~36GU=sudLijsGHC^NnyNdK=Il^!CQbD4w596Iq{%rbX`Sj@Yo~Rp@2_^6>SyNL zUw%t{#y`{-d{p))3f@|YLn}dLUQ%DAl}ssPbH@H_CmWHSz+@VGr)~E5YXa;&r;U$i z2I(sc4km$}ialuG!5{+lwDEg7B*3z!u@%b}$W1-fpbiDV#Go|6Zq;~RUk91*Mu%{?yhHK(10Fcgxh*I|!UnFu70 zBtk5O#?b(#pz#-Zw6Da(O8c&oy68t*L@39n?3cxziI`4h!AsbwVAhJ0*|#_%EaAvj zTYOj?$J(~04B7e&5Sij0>EXiLiwE#LMxOZ{FW?dpf=jsBA(2wAQh1mmMI@_6vWn$N zm#2H=X@cqs?PF)8oFU#6XNZ1jXNcX_mGnV23uRQKHb5*Y9lRha#6^N81I0DUzb&Ra z+qR&w%g1#Y%aCbqJ}UwgZB$W|TrDfn+;0|Ld7aqour?IzJBc0LT_x(Y#`DIayz3mv zofK+-zbyOn`}desjXNS==YPI+bsQpd}4KU@7hum|%U`5stGQSl#~tE3vk~wXyo+aM@{B<7=Qr z|0sy8q;r8g&9hLv-71)wAeV7#(GMjL!tAut5ijASe7*scG~=ldxFzlKhNGJRNIoD% z5Y%~nR47+;u9w;#LTZhHj1DVVeTC5qsw4n}y*{QZ;=R41WfxzG>G{9V%*rC3R#oti zwHnWFUwC7ipDkl_1Lf5{wZ6G06;TY4{WMNGh1QAPa>5F{#s0KV-418hcXzhF?NZ-V z>hr8ngmWLYW#k{vn5Az(A8EDnnh^8^t_if##sb*yJIO=nKxUYlGWKzBdM*p9YwQV~ zZ~o*(ft}!g3{%N0^qUjy8Gg1R1KIh1`-}oz{g8hi<;cR?;c`MU2$WEPcudi(nqbg| zkcbdQiJDk#TNEv5QCR^59L!@oC|FH%P6orX!0@C06uCAZX5ROsb)oJeYaCq=Oc!PP z(V-8tmFWXMFsdWy1M$kA-HkCrl1ssiKKFz|@x?Os z{vXP`pID+OXj#r+=wvdbS02sM$dWfuN+da(4PC*44|2r>U3*@bc6+il;m4(w8KhFnV3ne2W(_d5@8LT#PNx>Xl@d;weqsN-Dk7p7tD zqM)$ScBD&x1nE=ozro{IAYLXWEL%M2*MM&s>K=dT0nd@R;tUTETQ@M!gEv-is0VJ# zlXF@@ngZG#UDYg~yG8*aV+h~Dua<+qmv2th zavpOk7fo+&V5I4Pu4i;T`)j$@7c0X+m6`V>q%cHkpomLMto%<>&3ci)PGP7sybI^P z#s;sMw*aCEiam-tYE*Liy4B_J$qlQQ0(r-3k=|tx4)bhw3v{HQ@=&mAs&_->A>75o z@jNr1W#`ag3U(Zh(l2AJrmQOFe)dx#3A0dKKviYbCqAu3%IzKXD0rMi8dNl*gy(yt zX?`cjuNW^+QS@p44L1XGPjaZqIs-3yQjHZzncXn;ivBG9S|oOEdP3kRGQqQr z#>NZYtBJG*s$x@)LmtxxD>32)DL!|Npb0HiX5klK`z(nX?k;_ZW_gTK8KxzP)PJV;eK0u$lnjuqr%$pAj(KyP?cgp)k0NMd_*2qsKnbldI7x{` ziW^kVz!<_sLPnJrC}Hecf0g~XLS&vf zd~EZT_m#SqdAxKzMKo7-KjT?CjD&F8FoP&>qvFd7__u9OzmW-TwGf*}H~Swex(GC^#Z)rbGj&CpPhf?L7Z}RXt<%re zOHmYl;g3x^3*F`?R<}{277f&ixj#$;ZQ88f)}%kCl_JdnzdtqscSw38=)DKEIVO{z zT91qbGH}ET{Kl22pfc1crV)%Y9lB5XPy3A_chM&brFNhr+uE`JW0%)_a6f9CWukgf zKD2hc5#>2+aJcl@J>nrgJwBA1^WJ}P_aD0Hctz!d58`S_X#rFJN)4wAugK0T($M_vim16oN*) zO}^N;9KYs0)TQ8`3u$Gpc9jIK-p zX*m49V_nJ_hSU;iq87g~3=3GlQT^%p7s%tbehwp_OZaG886k0ws0rBELbni@f6U zxK&p#P|wjKvW$g~=4z4OsR!_IEe{wihpQJ+rQrB3`Q<;|tR5+?nEfB(2hI!)&1mO0 zn1GFN6AESed6<7fnDDP$==zjZ?iIS$B4UQFo4Kr2!A%XxH{lJetBg#=1=Uuzg!h*b zSx%cTQTAA0TwnITNIEjiRcN<*jCTY?8s-?lDEL=ib))*`lLPs2`PEzhI^L}MBcMTS zmDgCc@@N)(QhE`VlJ8ExfJ3=y92~f|l8|-LPWxvo`tlnCmyyS*ObT=H8lq0szN~0x z6jHN4HYhhKhigD(G!4?xw&Z*U0`7Y74i=L`cx8XmI@zct2t#=rzl*dbV?%y(ND)P> zrx8Z=iDO?z!K=O0>_cg8xVnw6?J{3F{LffKstdigh`_!Zo1@aWs)oMyD$b;U6o_w*f&Z;Uc`T@92Pb+l!Osfjc&g^wa z4%yJlFZ2+%GlyAqur+VGJ7__4A5~o%*i&_l7JXj6?l7Hx#JfNCuTEx^-}pPe4&l{# zvAJqOZMtBcJ)x3>%rS?2ejXDlnVC?W8C_2k-W?98cUP{z^zU^n)b13_6c9FJlMjDf zE&Opibi`hui=v~XNAbt&YzI!^k28B)-ru!Px#t=QQFZW zMHH(uuCb@wZ|Ru=QKu<(7+&-bQ|u{<{tu?uet&w3^@VcO6!WVGrdTBp5O}_-aG|U$ zy3y;3Oiv>5K#!_H!NE|3(;+df3O+rTmdznY)lYRJKh~emN9J_({r*KtmvK84s!@2} z5H?<0-dZ(CdnQiMYoBwiJ-q9*$fb;`eV#428T5HX8j#6d2b+imA`Y4YbOF-$RCwt&3aw1;qsJc8bmQLSDr;DY+K1FP0J(wfNONmSp z>=Md6h}K+1s~Cx^fHA1KU1g8yz&SF){(X6~=XdfvR_dzDgD*)7PN82~Xs)_6!{0pG zGYQ4t61C#SBBO_cu4jfKzt_Gj?5_jcg9R$KHx3^f#rE15kHX0&_26ug@IlkCk16(AHZsHzKi;os4| zGVZx21s@8^QneP@C_rD7`g zi?(1Y`NH5JlH?WgoN&EZm}YB)jv#sutS1BXGg0PiScw7J$_H z;o;v0(BFx%>23l@yz;f^GZ5~=)erJnjuI@>V&%4k>!kv_eUT;;uBXy(JocrzoFVi- z;o3!N`mu;q;UJ`bOltb^2VV`$6u2e*IK3A|j$d$*L(n1ip(^r1c0Ys?Ix1n6Uzd*C zkc%|)UNschT}#b2yVRYl1%Br!2~V_es(iAMr}R1*-L+JzVENjf{3FSH?%;E~+|Sy} zfm_>VE*`F)hCJyAFDy|)D>vdH& zJJqwTSBZMNjKVA)XE9V6WLnNgmtbs>-G|q_p^qnK+}{-jC$Y(|?BZ|?>-Ab6nvJ{! zk+K(@d+Zf*XJ6-u-MG9qHuphZyvDkFHw%+@-6wCFFYdw0ePk?>BT;9U4~V92JhIE(@w$8Cp&Ol0$Y2^!GRK=jne%!fX$zx`7VuCWZ*9yCUSq6N z^>~a8NA`Ofj}M@_qb_f0i?Mp?Bygs^v|Z^`Dt83WqMh=%w{-Kpn`LKla7l9vH`wNZ^Y;(LzZv=whWI>2LWUM?M@uMD|~ zIL6vbP0R0Q*8~8TO7I-I98TpJ+Z#^|II^D|bLmdhMcR`7m(xiP5OR8A^|@Y6Z(9Cz zvF|4WQI9k3K`VvI%A@(3JV$nt=5@wL#`5ZEG}E%z*(9|!#qz}7%~48l?k3)bcg3So zZz}_Z5bXL zlY1=HtHB$q=~`RaG`lO!VyJe|pT(sQdxtxjL^i!^OI$ysDQyYjxl^CGS-*F)z|!Yz zVTl>0%^yNZu&YG}@o+kZUl;IY(5$_*y0Q`1Xv+EKDys2c;_5}+`b1X_KSr;7{v{fd z-*BDk4ewOz#;{%&OY;$NxwGk3d&1)Re?hyZYYEk#M!|}9e?!IEyx#Os(e7GkuY8w` zZh#|LdHUd1$lzXewhwP@Wur~GyE;+sY9U)6EfP-7Gq+LbPLK6F)3ZV-2ptPF+Jr~L z^Zto@h)J)Ad4#s)&&5K)+L90Sdv^)I{m#{(teYZ|P5W(9_LRmwY=t|M@Oq}QBH?x4 zO2W0;OKY=a9JX>irHbY$t0>r8+Jqhy+U*VP-YB%YAx*o-pxwrAq1|1?8$KQTGCC0Qh}f8%V`5Si z0gRF(^t^7?x6$)<2<=@>5Kyq5AEVbc{)K`ew6#2mI(YKbEEa;Ep zuQHomS)a9gUccXgN2+d&D+66%4kL7oJS4=r(> zBNf~HQmFhASH2`nEO7CIe8a!=37#$Ve}=3Q4psxx)twBOwh(CaPEweWZIb<6Gg7wC zYDUV9Ls_C-FFg0y0M8p8rsO)LqBWI`ff4EXn0yyrpVm{+V)CNn@@m7ERt;Kh?|AdF zcygvR)=^)DLaKdz?Tc)fUSIPRat*>AA5%a711Cz5VSNB=VmZn97AEV+O{ z49N>fRqZC?aURnVX(7_dyy>y(p7b;mRykCNXXo5CA!+4z;F|0MJ=(LM>X7}aoxQO` z_V5nb3FaGLztkc7<__6TA=p@TLx=3V4%wI6*$;QfF6fZ`2chZA{K~}VQQoQIQXnvo zwt3BgS3owpAyH1TP!#mmFfKL-eTAI(Pm8<^d1L!`d2QrC@M@&Um$^uU9m_HbSihC$ zgzFFK!eV4j%^4-J3Z4^^T1;2dTLU4bz(tF?vOwU)dd`S(ld`YZIUUcaiAGiLtp0eic#Wl+F zcDJSioCt|tCO!)G5!8qFH0}1uN%V&J8=9`qy90yDNbyhAc+a7kmGj^7Ne8WoC@Sa~ zdLu1zry|sZwR-`_^y%u1X1lf?sx~`bHNg1=6#sf2)mig?CeY#xg%==|-5(jQh0-cH z(kkrX-t?=*t7q;Rj*vkz9DrP*>Ox-t1s(H4Bj1IxhO^1e}@xL%*wszvwmP3Un>0=39{ zJo=q`k$!(d)nw%#;= z5sON2pvqh>uvmGnp!0{9*?Y!vnTQ#DOMqWXcA^+y)Fgk#ys*c+T=sw~Wk+O{roUTD z=JK;7S`cZ6lw%JWwq)#i;SPhxRmbcuO4no7y6+^)^LRz7m> z!1Vs89giDRO)A(+1*(jy08?$b->r@VipG6;I13Prf%pO9HshBoOyrO~!(63ebwCTA z^L5P4WOA0tQ7q9!4q|Mq%@h4LzB@y8=Mn4I4Um{@;avmmeHeLiWK|?5ZY93PPZ1;J zdx`JRs2f9GBG4NC5Cj3BnITW{R^BRyx9qU1U*!#TNEJU?F6 z2>MsiDEW=zVxRH8k;>4QD1Cjz#Fmih;cZGr)}21%25v}W=5JcKS_>~ysSlGnja0hw z-ok_yJ`eopvDu`~Cbi34&Y2yku;ci<86R|8OFy;wThy1M)Ae<2+*3IBV^Hmo><#o` z{_j))4+Ta_)go&x=q{r)dtKN?rs8qzgYy=8d(%hyIgEH9;UApVNv@};+^a3vf?%WP z7JTMHoD)}w%IYt9)ZW%79#}ZMn{HgJEy$;B6y|;t+d{MY6|%)BgIh8IjKjJD-45z+ zte2#waP<$#2i5DzgpCx+ot*ukx0HY4QDbfLw|ru+$LegnpqSDC{W>GByA9GC0O>j{ z{0r6FdPX?T2I+={e4vHLsPsoj7oZYLaUdD;YjfLv!}b3%vC6JwMZ{m zErg?M(aox~>*wi2;ojWLtrB5n3D-vCYX$g6pC*3!E^&KMbxXCmEW6H)Nx391P3uE0 zls-kvq$OrFo*$TG+mzyCHb47%H%ZmCIxfk+1RKzew?SE z5%XT$9pUVX?(OnbGbjk#?tWiM>rl~#z^L~8_I~vFu6~@8=?4cr(vJhukAkyQKlV?% zm_8lJp&zOfbUfxQB?RD@-aQmQ=-56)eLp1~5{D);n}(n#lJnyW!Z0jAjL{RzHa(korIWVx;f$<-Fm=%(jZ-^`=+FMEJ{<)wG? zJe?5am(J#an$OxZP}S^NAp}4|_jCd}z~Gt5Zm`B|{b&WpBZ&-_FEQJ~|F9(8n3E*L zuLDUyc|gX6uzzYl#alEQ16d-v-c2w z{EQ4bTpi|}S^t>4nFUW!3Gf}jJ^_t^%=gexFy0clDBC|20f=5f0zo8n0-;vEGp#$T z#Q_nESrX-BzH-a-^|Ulk>Ow3a=80=0&wkU*bmQWSUT%3adiCbVcVq|qA%}YZvTY!i zt3tU6*Itt3KOR3xKZ=i*={m_9%&dTK<)WL-c;yY0e&UDIwM~c;&&SYgwegh=!A zBEv|^1&ZYyTWun7l$3Zj?l%f9nr)g!``5 zqG6kttf7psnS4Oj?5z+}xBxkTT8rMtL-IEM@tbcH$AJnIDmRa&1pyHdtaoRNxxoov z>1u7^QrT>nxJU@lt9MGxvAoT=Q;NtoLw9Z`D1bKaC#qESePr{MzI3epUx5y@To6?I z6=Xa#nX2?85-3(z`FG?Wp6g2gu0=*mVr&F9!6T z1p_D|u39iukzhnJN%mvcg}`$1eUSf{z#?4zeY%7aLKHDT@AxT>+Fc*0QX8ezNPz@m zV(-4`8&=k_Z}pke)ViLmgR#Qzq`<*~bb%LCfg9`seJRk+k0_@$Jl1Loi*)2pK2HJp z{I8@WZ%x1a)~<{5yB~C{>>SmaSE0lTW!k%16`5_fx0wNUYR`^Td$V0w1*_E}F1|>f z&0;~rcK(%}@<0Ach6oEcZ^%z>Q;mxFpC$!7;jG+F7#&?Za>;2m|1EJFzDgj}S@}dNdCVK^5 zZgDm z6&*n;^8A~W=x85h-@lUfKTsD*p~5NA4dNCr+6sy#j@$&N^$gGc*c1#i(JidHn#M=R z23>@yleLo|+or47tro+`L?Oa(^)uLepfsGMNRnBK83ZR^)-^7?%nZCBa4Y}Nir*=B zo%Av&E0lx{mFrfXVH`ro!+BKqz!a45q(uaOesgd!vlfBaOPb#-cz|a8mkjyj#6Z!- z`7i1J8Bb`ZWKW*D0J;u6+T9TxQs*2@vE_uM1p`GjkVvTXIZWe4~3| zpDv+CdpLq}To7Da=j_)c#VM)22yRmJuA6y?hrKRABIn@QZ(Pd;aT=}SUfn#Zo1=M@ z8%&SNXO7mB>RovEInARAF$KERvx9LO{fG0zCs!V4Q1tJ+*NfFU0qStTWWDIW0%=z^ z?5r0=0)AvYI-d?sp{oEs?$pC4>g?;c}>223yyNKz?ai3hi1HLz>@Y6kV%+29YcYYmZ9ZsL)4$>CjE_@%V) z;i%(`?A9}$3JSb>8FY+(uBO>v`_^C;gL1^bW4?C35K3s-;io)S+EGVip- zBiu%9k+yhdH>QmeX&Au!e1sjZHTZm`Ot2lN&0N2M1*uWX8dLBiDPg*%s@hw83Hzp) zv`D`v&y%Q46WV^vKfI2EGRr_1*I?1jRk^c;BC!Y-DfxGl>h-zT97PDB=GV>Wj z;bHy{k3Rl&aZzVui?IJwKe)nw&^p!|0gbeb8q<%#?s`&k-qxGsJYQ?5Rnp zGrNg(q`&eVEqYY;?ke_XGa{0_h)#ne$)n3bpd&>fu^E;EWP)ii<0!Y~ng4Q7Huyjm z!zvQ53Em{}6z~M`7%jnfJjPf@@;6eG;rjGlmV43LKnZ6;76=8+iUU`F+zQoP zCZ)tsM34R8>+;RXM_H|EiFlU0O};dTtfy>p68X!fu&Y~sCRAxJITK{bdGiKQHud@& zg&>w+%8vx;{4MQ-9ur5{=cPsCz4AELPN{P+=ESFbxh+)e#T$5(&`533H6phe%1Cc@PVc*zNl zx29~7Z~EV=3cIeLQ=%vxx{*~Dn@p!wuks7J+4<*^Pt~cf=<8G}va!)4iwz|JRM%m! ztW@;3fEmo@kP@ z3Vq^zpBiU?|9w8KdG06|CYzq6jKI&D*nH9U5gwyD6vB`ZUfSoH@}`;KNWmlcK{b_ z(_;!qT2!v=tc`pWcrOd6Z#p76Da$~1e@+n7vu-vASZB>W-X^j3Cv7?@`=NF^=nGty z@<^ zJq{z>%n-Y;ELFsLT5L>@GHuBtgjo7g4slCNs zg;!7VprXzR5W^|e0zUIH=XBdo;=M61KPEPUKeXsV-7Y zc2h$SUYF`3!wwENhl%Z))pUYd+m9X76Ly4}z=;uR!Xm#Q;$%AgJ-gHAF)2HAU|5F^ z{H|lhO&v1c%F>5toIbH_=?x4e?bQX7azVyyTBeT`yKxSv{FSMx)oHkCOB8OnuIvk> zz)87n*7NIxKhHc%>1sg2ANydwMJeyXiC8K^{i$O-9l+#_Ksl1iU5?N-_ml1bhV14+Mx$<#mQYK|fdxsj9UP~!~h!cot;RnwC zhWM#j?lZX|Tzw;gpd;94>4lvNdZnNczjgdLctyg>6i}xwP1XoOw?x^3;?kApcdlH` ze@^E=7R(4gadY=+JA$ z#{r2Vki%uuT-}C}vshEUE(WvhJUkBkIOfP9_&e7AbC0)8GW!i|p#kn#&KvkH4`Lv* zeUf3nWbflG-&_}aO3IbDuIlY5axSe%!$8PKTOa|Iqj3+>p`x`sPNFU;jIt;qic8kI zzG^h_K%O3UZ0^5ju);s7>?2IkhjHScLSWJeEm!*?c1FRJh9zf`Qr@h~E z+B-Vwj{a`pHdF-%r^EkIk-WDQl2Ef#@vE~BuWsl(neBBc%W;4qZbuy_a0B&m7;C&Y z{d|4m(YlH3v^Fg50%o#I@LX|~t@+mV?jP!f-(w{z)`sv@2?CO>CFgKEHZ#3Y^ZRDh z(9FmwtxYwuoR1G)X1W~6gGm3ke_KU(|E`&$f@<6F(_@k15J2FBw@8)@FN&h^q9-M! zfVY@B@h4CH`ShNqmc1_BLkmQV0FHuDcNB^S*lqb+#bKW(aYmmg`Dj)1^@$WPwr7UJ zJe#h0QP<6;G=@<3$RcP9hDUZyf~ADtY?EllUhrE$r{p`Ee_o1tekcCP*mdryw}csU zjDWptc#Y06C_oR9uPg92gE(49}Sb=9&*9?^b;F6Ab zc3by;#mXb7Rq+PW*mW=MRMFXBS7^s={ai}3@T!ZJSEGkW<5|WnlL>ds>~bjdZ~KPJ zV%0IEN{P?>I=0qJ|0X z@R-pS0c_0cLI>?#i|Pl?QJ_UTLF*+%1q96j@%o7We3OL$nJ$+O>; zd!JdMzgAW~vP9Qd=3m%YrrjQ{WsaE+qbam8^kTkomY&fSWy~=G7bHIu^ub^J&X4s{ zd~S(3Bk`nKa|vu^k5~|7>`)F)T&isSDa2f3raWQqxiR68I5_H>XshiP#9T4f2)c-} zE*I7dgVt4$?Z=CYLKT+==csTKcJUU9i^{f4A2z1AC@=|~6wK9MToxKy6dWfpAi@Di zudebFZN6MxLw=5(|CsZU;1FI3H73O$%egdoQC;O{+P^jVD-UW+<*)q}{4wYgK?nmm|w7z+R2g6lU~a+4UjA&rM95dj+;(-yA@MuMvFL zsM(VJBChn^Yen;N3< zESe}{1@<{(u0EHBD;dURK94w@5DDZLl5Kx&SSR|IzB6yB2)uTzKuCt z;h9SeA{yK!3(LJ+DJ345`_vtP9cA^f^Pm`#zsts6K1p ztDq^N+w{s)T4W}WEsuw0pBn1Zyp712>GX*zonWQ=lCl#Nc#G$tTm-KK$uTz*Yp`l4 zE_I~PUJ=$v_&XCQ?sky}|ISLdQ*4uK(2kCFE@ZV#I3++_lX$TW!mZ8H7EgE9gic+C z2e5Rxa;Nd-v~8is+Aa@nf=N?65)W>Zb}O;-YzcIctN=DkP0nV=<#PRH_;>+|_Gwov zmwh9%d{t2$0>bayGS35d`@$#Bnbvo?GBGFbYRNO~yz9x!BhQuo?k355z|OmzJoogo zIM|5Ybr9)E!ox=>$Nd?$714*Q#!K;QRPo?8MQbV1uQSe^(6P$`qay2rSJM9+;-uy) z(AnR^bQRvU#iP(Me$HRQnG}bdG`|lWyF9Q?T?c9N3F^xwenL0Waa$FwQRU8QMFIt^ zPY_U>f@i4sonl-O8hUxaMSk!QwdT_Bb3(7`zbs2lA3S}X*-N8}3!a@6g^=A|MzH@r zYqD-$DYmtbc2zv{;|?sceG*6kYdO;{Hsc%#;b^`7uQCU*LtGP>NFrhY(T+a1ytO9? zs|ec{Ac}%meClK^MnyPL)&h5WldN;R_FTF`>p{D+z&XpN_z@4cLS-w5A}Fr%@{jd$ zCF0@vJR$NJpRbYy&+0dWk#x`>c{p!-M=k~5n7$LsW1Jj&GukRRoI zPs#AdX1bRP^jF3KrHo{*OYo{iUm%ymi+pjS!!!>5KC}1ou2OP6C9NN%i#*$cX_(~H{ z84*bPboEyr(iU`MBSkosTz8%GNFCfLe2{{5#@AvvK?Th?AQLUF&szDO1EVgSU-+E| z)pF8Ik|#XNkr&*?b>&6O+5ywv_JwDagqDiPKwW0LUj3NO6x};e07Rfx<&%EoNZm7JlRHuk6;%Z zLQC8O-|~}fzRERt77P2bYxXR=m3fOgpe#9>7TV{FFLulMUh}TE)S1ja){=LbQxg3+ zK;2(h)Wiw{^^+>cY6q4{-HG6f-$7{Uv#A<1`?KPHrkW6b#bV)Cc8m@>*da#8*(yfI zPiy4VTz3D~1NY19za#E9>y{>8qW__pX8`J#1=P`Jd1vBiRk`?T2hNDZJoCA6yn?1{(R~Zw@0HX`k$xo+gMltK4lh9?$nkgBLFWt+JU-Pa@iuJtTyfRr1 z%IpceCryQM%0p<8YspE9o3X5u8Tc;Ydx7s#0d#G&)vwjAOa7fg!c>+O>evr%&Aipf zo7niPyodN8xh(T$G1TOrc(dotf6dRVV@ukZ+1EmY{}X1`Z)uvDO^17YD>Iu+#y>K% zzd3AXc8@TfG&7U945u-(Sh^S{A8BSbjt|nzOjN6A8rzxK7&}jxS(ViL-(Y56QAa0c zc9@wX%&a86p8wzQvmvUP|1m$?NN2u{pG|8!D%&EPpZ$SC-^R~=O*-e)AN@0aHhorF zj`?T&>>emO%g?@HB#NJ1WAn4Ba^_e&J3C3E-^RqO3y&n~>;tStZP4omoU{v~RK z|B`>1ADzy>jMviqOM*LP=a=GNW<~lSo5&*ngl}C3Ao0V@19>iYv=Ma+?N<3b$zx9d{>QVpb?t z5^YnQL~z)d8(l$-!i{DNH|kHeRIj*4Rr*D-8DVFVqd3s_(l3hT6!6lZwiU{TMs(D3 zKP!YhbcxrvLUw<;@md)_#*S5{mja$Q}1HqeoX z7Lo}$!B$*b#Reo1m0Mg?N;rOgW*OjvBP|4@VgqADMOUJmsy<)%ql1$hT3ze0jpY`z zLSlHZDsos|ZX;TuI>okCVo}?cwHyZ58K0-FhfjNOaJ2nb zh9|tQikA_w6Bw(*Tp?q_bxy_USH+?)C?FK*RE)&ri;cw8>q^p)@`i^Wf3?^duxPhj zvgy6KLNzTWJ27t#?;PBkW!4p{ch3s^bn`VEnhC2Psp#|TNnsdb(h;JAZh0I9(%TiM?%#oU@)nXu-$)^;~FixN5B&u zPkuRP+DM7jjvBb~GfnIU(~r`h;l`L((NPzi^V~oOeG_mgIdh}XS1sp{ebR(INt6IN z0T-Hp;AMJPVcG5NwnFG6jdTgeszv2~0W&7aVtVl&$Xd!XQ>v4|rsOH&4%HePt=H}l zQi!DqQ#aCaz1R$?C_D*kaD~JHyKB4Gko~2ECG*^Q2l}D(d2I4(>X%3v5*1URaoI@a zHg+H&wlmV5A?N-ZjF`>1XwTDN^BNl!*t|x}qKq}*WdWSmRBypvtiG*dm(vF#*b&1heK&LKmpP9GMP@3lyh z%9?B1P;IOEzw{vT&Z;?omQ7JB>KGzg9HrY=(rvo(?lZzUGJHbr6{@RzYwA_R?_%aH zDscurBa9qVPTEsr&UO8PPcoBk#V)2-Wpi*IJC)QE7&9>yCGuCGyBd6Cu#DPNBds&I zm_bclhgjG@TR|4qiow2|Yh6T@%fF(ZHu#80+=Ae`s<%xP3#ZamL*Yv|6?&3)W$ZmX zp=(ea^rEihqx>UZU1WcC6JMp)$!1_X^DB9=!m~1%f?=S!)QE~@J@7-JW7~|XdeN`N zAJ-`b6Eb1j)GSDT4Z}ycvGp5S{w?8jJ!9&OH8*>?1;%#dG+tAD+r-MsSRn|RZsxu!bq)1?nr!^{Urzm*9R~cQzQ}82S<+DGPhg~-Bwbn6hK&k4`{S!c-c}Imh zBi++WXySL$^Hg8E-n71icn&CrY@LZP%-U8ZQ0sikgIYD+Dt*M6l)KCR4p2J&B>!ub-d(mt z_rKKr+5h=~*7rptVwp+ZvGhhOJzP`oPNacbkYr(|>1>Qv9EcI5Bz-JJ6Ej0@k2+7q z@-Ho|!;KJml$}43FUhINta38(L{HgQm-o-;Dev2-93+biW?<*Uob%B}e;;A}`DiC^ zE}eaNZ1lfxGjT<0t%&bVELdIhZx_z0b6!fmI-vE{ep?SFcU#WQ<^KCjP!GPDK`8;e zctj1PoE=rYM5H>U*x*;_eYDq{ zp6Z-~gscmbfIjs#uw-K9ve}=pWCGm6Za4paAr?A-Ku82X2B%o6M-{8|b4_xUu%7TN z309tc>X>PN93CQ;ML8JP)K3WR4qjKv4SPaBqRiXgH(}EervbQBndER*Y8051WsGvj zO{O*bv_QNSNf{X1RF#Yqb0iJ5{-(Fr9E2pT+EuVzpkolR=9HwAuJ~|G$bP< z2^!oUt5^d`)dmWCEHHUzJ%2!7j%A@1@C4?)%k>^6vvg!H7*{DLym>O_c>0bSEkfK#p)ABedCc2@c@>aMiU*Y0JghhK%7 zJ-cp2Kh;PNAOz~k0(JU5dJl{PN;a<4b}uNG3+KX@cy2Afy+$IU{8>dYtf@1DjdT$@ z(?3?x7Q-w)?>Q+p?s!-b$ZI8gU)1@jfwaGvM~EaJ7eYkQRw3jI8``*ns3=Xo$yf8@ z#kp66MWzYXmobcq4~`O5ypb>HU-C8f-80QxrwmpwMk^)DYlDltEPC%2{_OtYAza)~ zHQUot$ekoY`i4lM;4(N@Uk|eEgR?X^t~^EE9&%~y$cR)+lnO>vhuMyDqvZ!1b7x_k z15J%OZT9JOIj@S1xQ&>6a12GHreYv1>bjMFpHGE5gW;FPNkTdNIa&H9$DGFxoW_sS zHK6B*Ve586HqeljzKb_#&W7>wUZzR0tcRXmYN*Ki*?@W*jnG!`sRD#6&!XuT&iW3EpTN!K2AHr3utCR6$h_ zLKp}~kbb#P0LpF`+Q4(0cMlWdH_*JcW#?J+st1F!PypVNiG zB_5&<^Dn36FiS@m?pMNa(*a@=Kg{hRkNLXcQro6L+>PMCJM0giqRKUC*D%{#S=vi> zQSh!ZtR!CMoFELtS?BDkB^)Aq6{l4-1>3Cg1heU_enU^p>D*dAwFa2H0_4%ch(%m0 zwb;{>%urGGJKLFD5&rL0eA2BwPh3L1a9V50XQnvNzO!;_lsWn#pU_Q%Zl-aQJp8VO z!$Sjzc2m+lwD^}2G0M&_B{9^>64g4FS}PYLsLmbUYu$3cf`?$xPYn-ih(_T8eVkXa4Hx4;J z)ch2Gyd#F8p*01lWwQlyspoxs0+uDv(Pca~w0D|;=f!0+4DgIqcK*yFukKYC!LTVK zgp6RFfrx3k+4)f2Fce<~q9R&SAa*gegvcoJF7aULs2ntS zw|U=oihaU=_AKb5e;q7n@2!aehJU#Z`g8`8UEWz$bfAa6`+GX#yt8t>R4aFYKKmlV zveNhuqWRVGI7=CxFyb5tCqKvwCtu48b7YA+0Y=&RhHXvmYOWo)N%ThiW0rkX9bub4 zg_+MD4p-KIn=+*&`H@*zU7D5xZjhaW)#kj|yo7ZCIz9AnyzIWulubsFv_c$ypj5w$ zM!ZXp-`~A*rh5GgUXPv9lH7=qj$tKP+&OM?%Ad5y9m-5v&TTl)uAIwP{G;gGN{Pt* zI@5`>uR>ZyGlpZwrJ2;nr?h((tw4A5(EoSdm0a`^o6G|kMa{{R`~cG~MTjM&7wY<2 z_Z!2L`1#0w%6h^kGsN7y`u*75EC;gn`!A?-x~%kDToZpbCy&6^ez4@|vg9$02(m(; zKe+gu|M(-rjqgG0ooY7k&$CkZa)GXN#a}3Le1s+1gpd0dVAP6QgZ&PL%lj67`f{!? zUKH37t;J2R`quMlt8j z`U7S0OBh}Qmj4r(+pF`eC#K}ZcgRxdpB${L^iCEsXX}pVqKM(b_0?se#K$pbvuVdv zIGM$c10H}bM-ZN~fnnTi{K$gwX0g=tKQ|gi zfu(KC!I%81f9A%3#A3pFxwZ{1GlsYt3C4iJo*Xvk-~lKo>uu!Zo<;-+ovh3cB8+YW`NhlWn@Ris!aPV=z@ig z-_r8|nHd(v^Z~k7acG-Zz-{!OpsIm$&T=P=Gq)`_F06O7v>7IdT;koTak0_cJn(kj zqdj8=8|Qo8qmf|SK(F)j!^)PHhII(?^76b7Yfb-&C&485jN!dYr_~~W zbk^i_7XD#|zDJ4_bfwH&b&Z3X*VhC;O^dYa=oA#}I-9^G@6Dr? zK@)lqzQj-t(S8vOEa_ziiv{|v$~~z+TCGeUfm&+IY7DO1zhlko0N23!?~yA6>5+^p z0?d$i7KlL40H{}aw;3AJT7sDH3SG>beMY$c))Qq_SJNFo(JunJL4WFRE!0!u8>K@6 zxm;|B7Pm)vDv+#;-*5@2!spXIV?v5=j4yqK-ZXkJ$dr|OU7wMO>XQUl3V5s9vQqR5 z@mu8qIwT`Wl+Ydt=2-AYMzopg5<4F=Tg`2`H+`JxG%7!1VymT7Np3l{%Yh9tU>IvW@O@IWKsTRF zzGfi??T6btu21CCj#?8oN0a-BlYg24*1^26GrrtPW$!r9k3Zc?MS`+??nYn_8r&6d zH;TO`xa-edrInV(pR4K>$OrI-eLsGEo%3|G;-fm}^=NBHze$-P_fvpCACUn=Cs@m^ zPn45LL}`afP-{{Sx5;plthu*O*c+?baWgsdw$xR<7C!|KS$bD{Z#nJGW+SIht{_a1 zv#s|$4JHkfMSZxfwlH*ta)>o(uAH}h@f->aSjv6KKZX8^O}UzQ?pyp5SbSzB`h#^< zs2crrRiLXb>aJiNh5UDQ#f*gfH@F(PB~Xd`GDB_}F;Rw|c!n7}&ry>&(tt?8SrRf~ z!UNdJPmZxt^*rY4`1qy#EhJ-n@{@tYn%DP`Rx`qP1MA)Te;JE~^hiqlD!vhIA1@|7 z3-GjEVVccGldGVzMe4Mtt*AXeSANKL*);VKv^X&qfZ}mp zF&NYFdUDKrvxhU%^go#v#)|^2j~KcD(_DVe9Xw2$`|9FlHZk4TX0#z ziz*W*`gZo&PkE-6p5vjFx}3fNrss(FBfhGS{qdBhWoS)TH1fypYX|(PwzW!lvstTI z_wJYn`SEs+Lt3GofRp!hI_>>vOcvT?{wN&D6D#$QAy{Wub7QY~=IP)cf|1aB;fo2NWZEcPNN4IY zQ{-7*^fucwzh+&41s|)5m=S{7AP*FF^IIxx2Pd#+UPe&&%5alb1-3wH&z;g3&D;(J z58@ltwZxn$>%9k7qF7BHEQq;N)}z~Ou~L7d^7-zNk3(wHty>n&j71cDa@08aof8JB!`l>Uq<2@4bECd)@^g`6x9Cg-oq}hK>`~*G||88&7iT_p8 zgp>WSPt&zDt;Vv=(xY7lLYNSGRm4+u^v4508g@xbxw zbAnfq@ue=a++&ZrJ7lR%yoz&BB+CbW{BytMhgnb=!?JzoGzg zAFzMjV*hpzL{20E-?8QM{t8)JuqiR;8QFtv<3$)2IHfYH;XD8z8+~}?0!EcQ&L{>8 zHXt&9h=!e)BF;K#v10DBz&@Zeaa_mbaOVQaQjo)MW*4esFJ*g;R{>u0d}+T#$I{Y- zY>UOv-*%BX;cb*z)%<_x+kJ?WpqYMHxT2UI^;#xu%M4bIb z`un0VfRE0UgXc_L6?xy7qe# zq|TD{d`Mw1u8AuIQKy1aNl%x~1t&qm?LPue!Fsb&vQ!P$ zoRIGj%rodF3n(Mgpd*z6K-~)n8wi1wuNU3IXXk^w0*01cxe3%Xgn6=_m@fg5OeT<8 z_v4A}&M(mfXa1(203qMfNm|EPbFkuwqSWyJ{Zhy-f}K$-LbQb*Bt?GJ_q41^jX3dQ-YU4}R{!2&r1AX*BDq-w=j znw5d_XQx*kd>fy}(aa70*8|tpxle2Z*5(*$N$B+6Tgm;Jb0Aw z5(_Wz5@q4VoT|2?Y)G|8bY;gM^WzXD^#`E$;=aLr|8_=6+slNT0^`ZBpv0tvYu?$T zPk3Zg!1CvtvfG%$9iG3QIjsMg*%l!5{!x^nLCa`5GPUo>=cs`6CfYoPh*b z;}4*sp>ofeMj=ggOx}q4s=#*dhc^rlH63ERhtZwayoB8jnUL8B=mj7wZCtNsRz&89 z1rtBNl^jLa`92$t{TTaQdhLE@7E%u`v2gkVuG9Midx<2C_fhQsjjlFbF1QZm_!I29 z!@2cl_G8yI1w(oYPEf%m6sXlJg%93!RR_qwAky^QYJ()#BSS3W(K1UK0~{i&H4t- zO~3jEEh312yWL(d0nJq~itY7pgIl!2_uusnLeW_1{spLdbQZmm=OO=N^hfU5Z~f5N z%ckGs&L7Dipw9=JLx`gQ_%EW=ynq23aGK-WYIAn`{<8*UQp@#VY7K01wH2*$uFbE7Snmbgiu2Io}wnP)fz4? zI{{J-?A#x5ykre4ax_{bg|3d}eQYNiv-`D@`VlK;*LC6qKk1H7Bf|!9*?ANBrA%7K zbw%J-@m2muUbOWMR?Fnly1b8~a2bIF{F_vjxvmKT&Z+PZ%MNt6@hCYO!ZO3;$21Ic z#Q8MwNYE8`aj;eMxeJZ)r2?(!yQx0_#;}PsdxQyFMcgCo%`v3Ob_ER&PNW#2l#*O^ z+}u(WN;dXWd<(yS!oDNLF`vlo1gTB&YVXCqT^bUEoU@DfJP**<6$E=JoI5!@*ip+ZvbVt!&;%}ddDBf z&O`k}0CIR={^I`v7hh>Hv*SFm_1a*%t<+AQDyhoNl2>cKCwA4c$!8&DyBA{Ecsk0< z8=27qd9%;5-J5!*dgWgXkiwuw?{o*pqr~5RB?=6__jw>Z703k+8CRj?0sp7*d_C7b z@iK$llsSEx`=7z?(}Q2~7Gs^A5VBJHdNHhHV9<|4zl&xthhHmM^i$g#(D7Vl5-{5o-EobK;SkGZt@c(W-&pyA;T80@#6dx-q_BQ`n2KZd@f7q9; z?y&Q8;y1qB2m0XW=jXjGfOj;p&v69aSWTUSyC$tlJu4Gr6e@m%%ZF|5){gu*~I~{P%Di*KmE*L>~Vdcdj{DVUG zqDo9HPoIo|)9`Mc6*5C$+86B7ev&EJPOrk z0JT)vdO;8_3xV&S%UX2fK3TSnU+vIS#p1)h*3v^PS$N82oXcIo<*jw@$gr~)ZF{uU z?;lR?I*)jvZo#`SJ~OEScYvD1T(~pKV^s$gnrU+2|I$e!rhf6mI~N$mwUv5-YMn*` zQfj5usm{VzA2O_66pqHdS4@`dV;`Z2aK1BbrjFkkGR0H}uVhxcG^?8Vn|YLL5 z_UegSz25!VM_hpf_Et}Xlnr?+{9dcQ^*#HPF48>V5 zuO=YQzQO=%`CMsMQ4O!{Z4YZgM0hX-MyXuOdko?wHb}FNt|K1q+t$L@&3twwa`cf} zHEMk^(%*uXw+iYH^oxJJ{=lI4jaX^Mze(|2jb%2|EVjtB@f+IcSYha-JM^2t2au%a z@*#nsRO!4VxR)TosO`oTnPaz&+#eN9W{}t za+EN_9d%aW_V~aEz+WD7uN=W^+5r2Y`{~@B1iZ8uP(bnCC9346PMV+^!&OSoXew7Ffg)!8QcTxApC>ijZLDm|r z+JUkPX@oy999X68|!Fn4043k@P)p{93Ihqg76{8eFr|_kjXY_XR+MUcvf!kU*dt(Y?t4&R++-`^*=H=|g7MkxbC7;ov4RP4)-!Vv&7S9b$AC zp@(AmpkwgO)O>)BeWNmSn3dFJ&gFneC>TIR>2rvQ9(4|o?y69GdF!r1&V6}B9Y+a& z@(#xGHbtvGvKC-j0)JBp<(k};*i-Aw=!!YO+%^l@<4X*v#CN&iy;#MEu;a!vxu*k@ z^;J4j{=ejd+}d$o=&c-ziYgm6=f6>KP0wL5XAy25$@VZn^-HMc5C1Y+wmG)g?j!_fq6vYIuSCX66;Of0vaS z39bmv^2E#(NHE8X_v+B>7W89Ngt{e8^Y7xdKI>~Tt8y-q4%s=l1&e}eR*Dc92to>K zVuj zOP3LJ(U@{UC=hK}>27o2$1KSm)R7VvO&y5~v1KH8Nr0v>O<2rb7bLA{<+dNU-|xL8 z^?ZC{?`;9M)w+#kE-A!ihZhQYbgCXjh436iomL~ph0ypV_Q+NiEo~-VfrVi5a`r=I}f}kCV!fX?_so*>;>XkBC^|)3#YV*^WPSYBiqIFR-N2U<{RzG_+JpxkMcRgU}UU#V*qxq-5|$fJ8)tzWpfT zB*7q~4Mfs+1f59y7aoiYzEqYA_y5NjYECE53T2ZGB(RWcYMqF7V|l4tW{jYj4&SHWfZSI zM2ftZsS@foPrX2rWaF&x>?kdYH{!TDjKX=L`FI^jt~*=ciZu9ZwFC7cYIdrP{VsK- zt@6g?>fT4)_Ie?rX49X|EsjW_(&b#$ky<0Qkg{;+e6v$p=?Qx5E^Ogp)Lq!f59Btx z7!k$m-VII%M{})YK&689t)d{18I2j$YSq9&fkb^VUj%0T<&4@ zU}3z-`zN=sGX0M}KT}(I5+0inmB1-VQLN4j0>SJx2T$w~IgNUMT;2stKTUMVsF0=e zu9@Op{gtTGkV0o4}6_zkrB5U#_tU^#Gcej-Kk54m-THln40W5SO-P~gKUlq z{ZKP#NUON!cZmjWJ5w5SOU9YEn2|4KC9bD<*}9-w%gg+FT}0(;)(cVRA6^GHz=5e2 zGJ5|~nW-I6dG9HO@NiT4LhAM~2}22`q4n5Y zgQ}~06Tvie$9au&X+bu8i&2AV`5r+t@qrx0O1LB9WV&SqmAm6#$$h%Y%of%v;3Jee zdwb8CecO9Jc(ikm_L1!OTyxVC17q-2?FGY!(LWI&^jvKD$l%<^wLRf9BKnTy#(=1M zXT6~=5l$Kg*&~jRVS_P|(RAlOoDJ~}!ha9b&P)(eFw<|NyZ47)!U8Sh*J zU-f$i4qwtMl8#SGZp1Uf)WDSUJl+kv#iPw+SqpYR_g&L$G}%H1*8-Rr0V8?01&7KVLZ7_?*HO1Ii0xfryppLHv zBCI;RFZk`rq! z5^VCKZnNMP#7K%dcLoT8fr5dvm1?0kd`BJdI8?)fm}`G2&zq<6)poOHF%%5>Cs0Z9 z4|kz>QZ4pNBHO6&*i zxVM)5z4bNx$QFj^A5R)g60(Ilun}fDd zR$R+_0sUOWWO;vl9fO`AzWbD5$p)Sp5_qfS0nH&p(P-~w$>8lE3YF}W2X#yhGS`Ge}odXLxPKMUKg7%rM>NGlMxox;a>(nBSVk!;y~>(Xi6P#_bS zrlT>CI3sPYWocc4Wm;AxTbFfeGV2NB(G*VZfft`%gwu2Fz^=~1=YBCfl-FR2(6msWcBg7Workya zm6&rql91$Fp3odmll5Fq{4yJgtMzhWqv^Y8B9N5gPj;j)_MSsjiYC+ud5Z5*>zb|i zS&r$=Jcf6izb<(F&-tbcnPj%L26afIvYsf%2DU~j0JQH?5Idso04-ga?D{c z0W0)nCwV19gB>X{OEZ8^d-7=>((jNjmtt-0uUILWcy;_)=Nzj4ftwz9%FdwMYkQ=N z*!cLhIPI{^n2al!w!s{vPetAU7@iK?8Ef^`O{OALE%9Nr>LrP&+WLijQ6b*;p5}}m z3^zWQ`;I0)coJpVahtw2ifsDdQ8&;ZH`jn1Y(l@&nA|%@aA%J`{L`Oe)3Weq=GobM zxM8)`oX=0iUNU0Q!0bfKU0A8g-w0ty5o5jP-&d~ts!cb4FILfJ=e0pp0!fqgSHfy= zmYo0wEZ6sJ=j^*^w6lH)&?-nAS%0TYN(xLg?s`6oeBte)?xAg$nw$!(Vpgkp-pE+` zW|%M}rDqJk(wjYFs5E0(Xr7&YYA}XdqkYHlqyJ$H-}zsR;aRtL3`4VH5Ot9eeTwg@ zH-&i&LJy%poIjhow4H5%r_Dn^xd`#tMLi4;A~OMp`ysGm%J z`3{ZW&fth99(C}pm1~Jw;9`eiHaYMwZi zjcjQ$sNHpCFTO94(9BHFp4Z8k`MjZMI)j3Sv02}DY_n?nyik+G6ls^iM;=g{Wl#;ZD(P# zgD>OdMrRuC5aUb2^WWgDezlGX-NsPFX$j-p30Tm64cD5ksEeb)+F1S-dm|DHMCdK< z`)n7ns%3uPb7{XyYxX>#XiHmop(G4QbJDh*<~(Ca+3## zC!XSnt_=n)+dA#xLHV3rS`QS(C)QQHdGq*M_x@tK6(I!u(f%WcXTOJhpoB~qbG{Zv zEm|}@@t)4{iuqHll4$;b?oAX&or05Qzhc%`(hRQD&O|)UTpFmAz5>v=Y2k#nv16I( zaQ&Tz5^~xyGj64i;){USEI-w{MQY7MMT}~nD)O=nCK;Yv5dYZl-p3j=X)oxvsd+-k zf0buJ{R?I)a9ni0K`S&xn{4+dV8JSz?jS2y13L>L=vBLBeUp4N1S=&xNj{J}@YVPr z{&FT+eHdS4<>gNncL;FdUXGmeJbhU&tP;ZAqwazZB!Fjr&Ea-|iB#uw83(7G;C6^F zGLP&X_t$WV9w+A96Ktl83yy)1Bhln%!>v@CrZg8v)hi_hc3u83VpM&G_U0F|Ua*!A zo1W;B!m9&nth?I=?oG8Awl6VAt}~yN=^+jqT%xo!@8WQdEskt>cDRo)Re(M}TOfMjerNKy6FdJvV!Zurq;JG(QM)R=ZHOOBQg4`Rj#&94AY^FMkzq43x;)%k_z?BR zc9*?V&!*73UnQFj_kv)N1MbL|I}5LKM4eLq#_b9tHrY-Kz4aB-^F(AGMw1d*><{DG z$cHCPH3%pKl3M-*zESzaOk=`JzaL?&M3X}_@KVur5C+8P_9YG%L1kjU}C5<(SqA|d}1HW+iR zJQU7`&myOD7J%lk3M%#Hs|YG(O`?0k!ctcQj~-9ua-YDlh~A1;E&j5@@uYtLUMIwwC>LwEbMqg>BlXlL-3wUh5Z*zd0QoQVn%{PIhh_tJ9Y^YMX zX@<$EQdm(O3C2fI)vWOrD<-rXJfCy4l?+jjyp(uZ0mcu(+tuY468+%{fQTx6hgm1~ zbWNR-a;G+{hR5vrW2likPbHfxHGx)oJOWW)+TUP5t!R}EOWk5r2wk-2pTOH@J>Mzj zFq#j0HuP(gneNP}JY`}>L3+w__9-vIAd>7tO3xgV*gDAMF{;^=L*}5~6OStq{LH<*s0j6Igx6~?{)lTo>k4=9hVm%Q!WHE>zp_MO-!C)Lg zq*MPPbm78>k=-LV_~W?IhSY9iZE1SA6iL;kwO}#>Cd{!mtL&BpDarNkkp1XhKxeml zrP(bfmff1zdFqHJ1bKxGGCRU;11 zKz;YYSJ8Km|4rh3T) z-Uba;Z)5Lh?&6QP_Zd{UFulz@4%JxqlIiKQ0pMj#(O!67yu%I8+itkuLUF%&odXY! zepHKuU{L7VZPzfLF*nPK8Wz=`3B~T=7q3bF1l#76qKgHQ8kJe$2JR592j_!epL`Kr zj_z#~kim}WkEa$iL+2xcKnKBZM`Mp{L=o6YU5d1r!%I8E?bwk$o?+dnqgg&`sUc-3 z<&V#v-)8Uh|BZU-mkmoBA7o<0toRyijkc(qHsZW*eNh`Ro;ol%9}&36pR`wy6kpW4 zy#)f0;W{C?W6r$|G=jmM{LloLBX)vg%t#M@Ph1lQRkGYq6{sACJ@WeZpF@1IJ zUzhM>EpN52Z>fyQ@{VkcZ@(uvz13GNV8{bCLmgi;>z_A*{9L2f@ld{UM25s40+UG^ zc)~Q$5Gz{eVA0Y4`=!-CN40ty70753AvZ!ixi~Uxj#TbvqO2m#jv08XleGIwp1ZY z_52nlFPvO$HVG^JXV{#mYsi1pHJd?p6Y^y`cTMu&h4%-!OqvL#^!j};*V-)6m9 zutq)o?#B&CqNcmGPR%!*HvcV1nn*_cyE(RHb_~-}v$?G?yIdjEB(G)QrqQGW*SsCe z8($zA>Z@O`wzPKPokjK^9~q@J?a<=I<1kepyUi2~;}#3X2^4mhpoIkvtA-yBPSkk|^g z#{Qk=C4P%Q4W6gZF}FTg`Sqd$K@mD!CAA|G7d9ZvWc^a-w4w6oI9mJ_Zb5C8vC&tr zw~{Wk!pU0q(j5zWjSeDj$dS-&24TmhPAQtc_- z-fOvZd;JF6q#DlLf(oH4R^jpDtb3EU6!mkDPCT1DP>|SQ0tKyJ#U|oyyj!;Aw38T^ z>>_gSAXorX-0_E)OK;t)myUcH*&UIBT21}5#9oO?6OzIk)`e@UDB<(GhU6E67g5YW z^3mR3JJIK)UK+7n+NC#4wh$WGB)TIY^PatiA-I*9hw^;tv>_B3Sh(_f06ehpZhkOe zIgtQY#BPZItBa{O^5rZ*(GTq)Xj0huILGg2E@KKgZ~ThbOEBt#%Z%)2>+ah0yH=`z z&T^~;@Up1HIdi}5U~wIW?Y}BNPjhkeYVd%uLlF~*KDXJKi;NqiqFYQPE{_Ig_&4i; zXJ>s?6^QPmF~#z*0}4sd(gOzQ@77(>k%TL6&EtK-j`y}#KW{N)Qn_G2DEZK>ZTT+9NPGQzCa4%o}H#YUXt zvTNW7U$8Lt(v-s%m15OW@x%QslWkwsB=KzJ*iNh~D{{jp@0f1e&T z02>+?Wk6{SF1xhZ9`NM~tHXgN`F20AG9mkcM5B~^3J>MpxKue~1q1r>E|TPT^5Ul} zKDQ68n7$>Jel5O-Fk=YCk5Rd|FAi@@rECL<=NV87Grr7wg%U*AxdI0atcP1xx2-1( zJ7&z!ufd0?4MJruS`shX z$@h4&A@Khw>+S-rPsJq9A3VZ9!?F3+TX~6&s2f4*l~|&9&WPkOsPB_A%Jg|;%gC4g zVpw)KRZ+lL=6VuIKnXHay9lu9zsJ^E=Uz)I5rQ$@T6PLcQ_HB180~r9fDa9}g1A=d zNuCN>P>+|Q(1*YOHhDa4CqL@;$ESj033DY{n5oXUom+~%?Ki_4(K&D++TLG{a>yw% zp{KX`_<46Xg7+c+_vSpY88N=U6QK!)ttGI&#on*X>r-0zj*yd9yapa&1+J#J#Yj=a z%l|W{8asJoOP)V~_nV5p%You?3RZ7}#5BJlQvaLQuI{FHxay4)r+ujRbc8?TC5^** zlMUE8n9T?rb)KGL;;zkq+vt~#M08j8(5eYgaeK$2wQBqQDkKx3hu8=G8I|LCSwA`77hcyNfCPIKhd<0@wqJ3GB7gvww zT@EAdNRKyOse^Z%j#Ior@}Q-NB%hbt1DE$Vm;d=;-4bv{!p?2q6c zUy!j7rV78R9nLyEdl*joF_*rh%ld{TkA1@V2j2*HKTpWLm~(d5H9Q8gecTUw=p}jQ z^{*%Y4i<@xE&dHMq0SUQm00M7wp;+5+ub@Om?p-E43P;bD zIUGHm$;Kq1HWbR`wdcj)wFFw%F@Iq8J5~!na{6p+qGFlHTUgnQHZy(@3|#o)u=9~Z zf6sqgl5RHIr7D&ON_%=4mm&+XipO>7th$@OxTG}lBMsX+%GAEJxj);(jS09cclqQe z=UI2Yq6Vk0&GJBYd#Z37FB+!Rd8}{~*ZPhcDxhZd@bHuD5S*twp=B)Ej$?c5E$~3V zwWWG^{BZny238MBykquX^OZ%W+b`PFpF(_N>?v4B&SQt`Tk*qU&Xb4hOLT(QXG>l3 zUHTWrJ}mfl`aHgAPv2^19#=hkx*2362TDv+KgXr!`csYeav+^#-1IYE>`zj^PY!7) z+EUs6g8nAnG5MU4Smsrauu>Au#PEX*HgM~%UZ_GJ zCvXyI&ohit^{gP$q;;n_7dnw1&o2-*%%Jn60cj4*l!O>`lw?@`5&8=A#Hh)F;BqMA!X3Qm!C586|TQM@9RkB`9@RyC2V!C(7)A>i1xMe$9rr=&YmXd z75U=m(y>$rJnAP2XRxEpzogh1V5X|pMHbbbXJT~IK6BlVx$hTl8liz7X1-d>)Ft8t z)pHYWcC_gYZZYEx;_xI7@QLd+>P=?UYl<9{{*@BsG-`@Wj&%9wS+&mni|GS-CUox_QxTJ{BK0t4R?gfv0=|%fK=vW@$#y{BN_p#|4a5a4~71m9tW3SzfejSnmYx_up8>()lPn76#+t0j1I*3QLx z@HMB+9K^iGM;oc=5!&$ZO7Dz1qskJeW?zL@N|2+RolXt(jp+b=9*KR@wkGj<#QMWZ zZ6*13Y-e4^#-KlZbsJ?ww_~#|*X}$*J9edZ>>4?L+VO8&75F?_6$Cl7DlRUYX;u8X zte$tQiU-RUncqK`Eiu23nS3KwMUYC#&IFMZkdr9NT9IL}+%bPYOPi=9L9h&^(!%I` z!tY?M6qS^CM#V@#NFIEC|NQ^4znT_zOuzp{fA2+t2KfKy{{DXfTEUfbU%)-}LbUh` z5d8>Vuul(r_!0O66LeopkL}Jb@;dI2_{SW2;%6X)uY^BO9M$pdEWgJS>_1+PW7Kt) zVzfMIswX`2f|wv@)1~Cu?P*_+MsB&(*)%P%&t4IN*f!1OPsicfmspNiqixg?aJ}{! zT#F^LXnprQJ8!SO8SzKK9qtH}(Q{sq(Hb5f<^NN)gR}mbZ87l|x1Zu0Gp_nEC&HnH z5)jj&pZ);sGa=v$-`6GGgD)&RTr8YBbcY_fhwr&sB}n+HHqDt~yHzn{Flb3gC|0o- zTew;0L@A82$DN2UNRBzul@yNY~IBmZ^mQVOHw@4?h!2_ z=76ku3Te6HPl~UQOn_-d&{Nf#7~EF)Bfd}m86F1hk?SVgUeQ$AD>Ccksfq$6n&ttl;93J8b=AJmoRNdiqBEmMJNWxSXXiv-hx+ElttW1A95nMSt zt+YgxHJ$DKthD%DuE?nUO8KcHXvQ5?dR+CYbw^aqINNnlDltcfd^swRsWGrGR)E03sMvF`&qw57EQ(_l zA9z3cfsV#>m$AHZIbDYZ(~e*D)T|p=ey6dO7Mq@`U&zToocIpp3thI`P(weWRWHP> zv2T$E16GfGEDNPE!j;M#Dh%rYGf2>oV$MyJbhjZ5&VBF3?Dwjky7_K9?-jf1g;{53 z%h;+VM;92=Pp~mJ?FIK&XcGyR)?->)hyP7Wt5)lZ512!}4uOZ7{|9gWq36wC>&>mp z*u+hf%KjcSIYO&zMNh#)Jq0sV@LLK-wsidNkn~&~>H+1Hp6FBzlNEtxJC#Pg#8&S|%S&Q4>-dXIOXa9y8aHlc1KM7}V<^(glC|03cHj&xHZ$L8H zx~IS%J^0*NjmA|1d5#&l?S5lA??SSFqpx?A0K60v3kcui&Y^ZGS`|Re`&3ickdN=LJZUStpk)rr{xWs9Ro~y59H8xGR z>IUruUP8tIz2m;7OBq0cbPbApYq$05S4Fth~Ly zztX#h{ef~LMMbnl{O)P0RR;xIKc~23NI)MXx5hiPzr1bY@6#aMQ1Dqy4tnYG!9yK$r*G1Oc&)QG`AJ^l9V5x}PUz`Y z{OHCrc>fygf;#T%nZN8;1E&8{n00;JS<9NRr+0g={3|!8_zRhfSRF|9-$P~KJ%3pc z3-8cQH`R*W&{tMZ<*NBi{&@QzHiwM>Ukqsy6LghZFua6{sOpaJI$vYI17Rhz0-wI| z7ttJ|P{j;BCA&t>Ig)h``b=S3Ze3Rd+1rA=PPHT$1^G@eiU5}~kSFB*o(8i;i8qZ_ zq2ssBi=m(1VYv|%MtMDclmZNaWfZa3`#*sMbPwGL`GFpKSI~-i*=*!lx_-9vwVXf8 z0LlIL?Zjrm9$omuAuPX>-JvV^^@f}C5gcCNQ=UBhEMCgHbggNv$E)Sit6a_#J-m_D zcP{@_zy|{-_s$j$OR|E_&_~;CmO4!0|A2nsRoss1F9_^bY}LwLC9kS=&K^dOxkXuv z;ZOyzL6@%Xhp7y@A$ z&m*0JMlG_d9gVo4B(6sAPR<#sGtAD9g{h(I$sY}J_WaYU%GHXe2vx0+~&Nei$FY;C+ z{}FS(XgegdZi(Q7sK^7_yn7=L7#WZk1emSyve^|j8`4QSpMDbj^LUaLGMsGYr604M6&Z+%_gSf!>y ziRoywmLiFG-(y;8N@P1=dMvUsAlpM4Uh+8!tnD0Z`g<^0%7)_I^(H)Fgc)A(EQlXK zYCX5!{y!*k$-E_!r4J2UlZp}p+6qgiYCF0GA#}C_GwDEbZVAlwTQvA3eF(;$+$dV< zpjzAa!C#`zGtqr7poaRUJ=(w|*qqR5o+SN9E)L06Wf(9hP{tnbPk%emUB7CwhK>uT zYk=S-v`gf|+q^n*3wW|dxq!9V{X{5y-P%R;DcLB`=umtJ?6fFKXT5N%h;W3|X<8!m zMn(H>vjNC_8u-E>nr0qa=`tz>Q2X1VP+R+Zpyq5g8SSulIUF`^Y~R2ix$)HHz3IJ# z+7acsG3+^of%QFaW_{;ONbHN*eT-aT4rhx?dV&Hp9`OY;JZx^B7M9=mj#QTm>lr2J z5NJ!I(_aifDGvp5i*2G?r@sJX5U}0|9K`<``ln!Soz1VPjf&njIC!}Q<+!ZiJux9m zC$ltC1VVO!N7`=T*XWRqlmWS#Rr?Wrx$VyrB|-Oo*4vaCs+w9fXLUA|PZ(Pf??=7m z(ae;h^OM!(p*Z1s--$Xe_}2lMW=|N~;@yKWSMYsSc{XuHjvEbM;m@Wxps!Q1*$;6- zG^{Wlh@|I>xn~$#j(IKQd~zaBdspAYYzaU&!5%`R?k`l-T%qN%8LiYxuw)feN-3< z?Tb83S&fx`fOiO1QA|VlA{zS>>`TJVoqB?+QGY0kX>Q~%}h;#)Di_RXkpsU z)k}07+O=1@&qja@<*?yN6FVdBa&ZTER<=bNu|N2$0D`_6X2MFnOLuC? zVTCDv$JrxaURsnm0)Ur;LxB04ObO$^$c+C{9);a|)l?V*tuWqJ$-@j^vOo=zMKk7B z??u9H9AllfJJV|{0VzyvwE>+5Pn`p2MJ;tUorA!dAytJzZmg?Td+f;eV1rJVC zy1hB*H~e!&nDioRhRL>T0D7f6bA;y*iCn11XsootJLrZ32<$#L#6O|+n)br~`U=|x zpQDb}n0xi-H>CP`z?XOu#XMY!&2v@ymC1=r{EPB=wyU!iA z-db)VJzO)qsNkA0IL$wACs&%Oh;O{AhgrAMQJSlNKy?2T*op3;cMQWv-S8O5vQ0-(gG8k~0P!6VKaQVBuzpiD6g7QI8>#fT!A4pH z2jVUJ4FV5VoY#I&&noj9rB5*wff$@(8&dOtw#j1zZBqP)4L2Ctgbc$o3YJsj5lio?{SJ6J#Uf(QgzG1MyO2ir$u#mC1t|&JhD^{z8Kly z(mT-|_Ac>qXIRTCYcm(*T~q56%{p_UTfpk7mrabY>&T8{1G);EUSwBojgKK5s3Kjw zhvinD{DPk)%+#_v=d<`sjINfcX-G`P0e1Mg(&yQETfC|CM@By#3rL|kF*EAm#7yVRDnT(spl=0uWwhrwScK)WmRYSbXYcL-cs@8)1S?<(wqkqggLv!)C*Q1&TF%OiFT3FX`&3I?R~Hxw0JF)3rfBpwDXf z-LF{Ln%!!uhY!!<+Im>KR!_Amcp)>;sR zbZ!8ITL3~}OEmIRGQ%WS+I-*$Yr#WQY+9x|TTDmT(`)EOFe~z23x<9IUG@I>E6qwh z9n<-v%O-Dd#U^B)TLbRy7^K5D-zMo692EYERI~H8TTg88o`vXP8Ik^#9)U#p3UXh# zBt{evVoM^QV%JhkUfQhKW+Z7D%oRx=*>grm%m8_K56SY};!xr`8KPGF6NS;ur11+5 zsDWO|yo|<(S(K}6sa>@~15M083|G$gkZ74*-p+iN-DYyJJ$lUh6R-(S-9Q)BR3Isk zma3l4(%UhcDerhAd#}8JVX8J=c{zl#iW;lC0A6#xqB<`8CE_nrK-Sc3!B7?ahytTf z=owGI<=9O$)eSm^Y?Q!+PT)TgV9z{k} zU1NiMJ7v7gtn^_RgAn+(d;17Eewyu*fE6tCdZQS~tT47j#MGv1-bTF4J~Gf|3uD-B4T!eBmrwa;6a&Uq zzQ5jfjn?3VYZf_+{-yCbd6;(?#tGXF5$ZkSFwzBwiFbTUo5N1;RkHt@8)fc!o|_c{ zT6R8UQ^Feyt`M1;PHd@p>&XS#AM~njS7=MdeX3a{_UJmO*-)yr737mvx1c}YH32l+ z7pg02lMckck4ZD96r**B*Y(gVdwRWUk znu^%uqSTp$^(*6Y6%Rb|WGo1`RwsU_md{08+~vWiO0Gw4==heALsk7_cCBge1hwZb z&{wNA-JTCxWZ&mC4907#Hdrv?usZA6&)L+bo2u&ItLc`XEN_}A1l7+OU~yJ@2TkhxR{D9avfy3#TduKItrvXJE*ZZ5eeYUgQ<*Rx z--2bFS=9eaS6$fV2)p_o`Mz)mXv@k=JBU1GUnY$R8i zlaVn9K}ZO7t8+8jdZX@0LwE)Iy38sCB#UM)L@>J-uxH1I5f=D3wkvEb-vyY{mA3kr zSk;obFcVfpI&ZxeX z`_#myyuF}{#u@P{GjJzueyTpPQcLMVt&^5G(i`A2q9^7(plojDi4ltsk+r5_-UD^c z<2q+_oS?296KywgQ#BfHPiw>0Kk#Q8mjcs}WTTcM_JmZ`L;VY8+RU=1n3=ZH$Fo!- zDZXg%9;R*??tyBA<-_Kh|Dri*ssXJ6@AVhp66zk*0eT$m_vQFcVk%6J_5DF6-ktZ+ zv_@E;M58$7_DG95(H2=2iYReHj7dWZ*C==^{x@q?D>>$#PA>A3D9qt(?;83Y69qz< z;|760>41_+pM0W*9x3I!NEYa7R3V`q{P#^z>Uj;x9~VK=w!|?78(YdG?4pkM&_+pX zS5?x8(Z>~f_XST{c;dNScNTtxH7#4%bv%i>^NPHLsWGpz!^+Yj1OxFBI5WJdWA5!m z;M_ajWGeAI;n8}d+Bz?2*UWh)Ej+ZV+T(@Z*LWVTUnOD@vKpk%<&6>*OFvlX4G7*7 zie#UBykS3k%X{8C{OX7%I4(5d8{Hcldtjf7Ygj*TSxCk(g*(Q zviikP;v;E{P*&J^AA}vVl{ z0c>7hEf3tZY(1bk_4^zi_uWf1wT=9+BKain8*qZXN*qr|-&IFNwAOLF3Krc;uDXY&DTuk>c$Ocddiy<3&0em`i%n&Zu&$^vrCsxO ztP?4VsIA1C{#=ziLz_mU40=V^?mQNE&_CN5^IJVPALN<;q^aB$w0RX}HW@r-6`5A`^gExXqP%u&hKZOEC97F)Ui+exJ zjuKQ{&;z00sbW_~6$|GN0w_l99jPbYn1Jh|*l`MHP~czBJ@UAVvJ4;wED0nCI(&fd z-{?aEYtTE8772#D2DwB}LD8jws%Dq`Du@Ep%$H3V!~;(uMm1;cqQvV>FY@^RVej4J zqpHsR{|p2PitgB=f?AC=wv1v8UTUH!84bDzCrazRRcnp4+G<6e0jvtaOn~Vyfws1K zdU~PN_Shb6t+f;oX@cCX67a%J0dF{)0YR)J0U^KlXRW{Y(rKGbc)6z%o0FUCY}2$D`ITx4HgEq zN+_yYa|R^4?ye95<#}@!B*q@$V12Gogn_2gZmDon$5LLM z%6r>omxc|rTFJUp1LY3j(p`f5drxAjN}T+u&tP5TTZOrjWfjL+go>>dDi&xgXIh-_ zb%Mq|R@q3eIpHTNwSVJ;pQ)T-e&-r!Y}0wie1`Fy7#dBjvtsl&vDCVutrOoQ(!hyb z`kN>ly3`4^H*GwqDcdL2CwKTstUj35enb@)?wydVY$X;CQ!BMZWMX0Z)RjQE#Q#W+ivEb zY7Qlo>2LzqSjWPz$h-?~^h5WzZu&CPjV0NH!I5r`%`@;OZrM(K#84d2OMRux2}jDE zaI^yEjf~9hO~Za>_;V_(Oe_cA#VRWnymfE* zA#=yy!md?2EFUEfg784w7rb>BVal&4tRG=h4PDpWURle3Mt#10MgCw9FakQiXGGNh z%n0~DMQxFBe`+6qpy!M}AVCjA73LFX-cioHg9`FCiAi-fMP){|H+J>QxBy;Lyz=Z! zp2U=<&S^&5LM`CXVPZPc2vE>ow7N12c@o-^;FP-b*H zTTcCAsh7r{khj-l`lqCZWnz>x@1Q!ejZoH@Y(%QYou~x3N)InfwFh=I1y)wiPYhNi zl&e|tk^>cQzF4~Qy!MW@#Gk`+H^1TedO^H$N(X#-uuY2v4jes`+0H&?sBB!Y)t_Z> zEPdWFr}=l$P9;s0^@x*PO=6A~zWF8TCMRv?hZF1m_e(ORXZxNNG|OLQeqexNGYb0L$9qHuQ{F4ajUK@<+!cGH4Y=bjt&ODP z3(u_iaLm^*3k+YMm?X zNyoG9ZH;7Zz$CSMe5=2XGpMra!q#>`=Scdp{viD2(JOQF+#J(~^IF&6Uh?;en9Q;_{X?o_r*^5GWYTug`KPLH_Lh&ieGZn% zl6j92QJW>d`-%=pB<_l&FYX^pop(0TR8#&pA4NR&vpS=hVO*BeS{1EXgs#|!7v|wr^3p@bFPtDvzB%h&dq_QysBdPUrlyWBe?zZesluOh|eEfYl z@x0mHOnwkPeZ<3OX~8Ur9+Spk3SwIvvNiAInEXO4VlSxx#@z=@uI4L}an(HcuJn$vCCX)6zkQ$eb`Ho)?DV62f+e~Hr^TI?) zToRf1fT>YpCh5vdk|*S<;6I|xSC%J!9nJJF&HZ~2=3fDI$$~h9jQ{>z$`#TT* zi6_O|*=Nw1X1H(W15+Q$?2;nxS8MKNp!|!i`Lk)w={;NX^B%3y1`@bz%fOwp|@qmMB5 zZr%CXw7CC>nva}m@*^0jd1L$###5=f!o zt?3Ua#jr`CrXrcC>7+Xd>_Im6;sdf3)%2qMYH9|7t!aI8eR(2dsyW#ZbK=DFKH6{Zt5l0<6pW+^8yRc>=TRl z2G6m!T;hEI@tL}ZcpVIod75SZ{v-Zii)kjBw_atfOk7xKj+)|3I?}L(t&ia3*&7q~Y2Et8F?;xwDl=1ai%cl@k0htKhTP7?90t%o+D zt=t>OlXoa`v=At%gM|s6210B$QMG&S(NOOO)zu%A&Lmy(>aE~=kao;eI~H~(nyf5U zR%Sd1AL{*%s0IDeO`o?$VB5^anwzwVcD`n%|!X6aJu|M3hR0a zP2s$NI8G0%^v;|RVhXDz@VrixrxIN(W1q`xqapz zMRn3w%gl&lv3JO-P9+A)d>3dvqx$V;sV=;^%x!*Z$ed zxrr6o(ci|+_X*`)GrLxWp((N?<9cZkjS{sCrC97oZxtwVy)8Mck}FE&3hgFu~91}|MiS>uEE@c<}xvM+3+49epakCp|Q$9J3GnFvqt0MXK zkIJ`yl-e&vw>GMrRb^C3;(N-#Ra#;Pb)Vg?oNWWH82}69TcSKhWm{|>U-O%T z;~VbcX7}AT2=1(_ycIA0WpUSC+^b~n?IpS4zTRf&n>gGwY+MnKt9_%go1UV5Z>xQ3 zKTsjQR%F}xswX%5)8Enx)fcjmx@Z4i5ms@8zTJg_Q#i1-=IH=%0DnGRQI4{ zHfrl|mQTb})v(&0M1(6KB7RT|5q(~0R9_nUyl?6A)SsY_VVyjCPUnnRDdGik_1TWh zc;1{GMTD5KK54p9Y`+wfr>NeyBEb4`TrIBgP$i|2^`uc!)SrhNJ7^vbulY6ITd_Zv zkFq2P4U&sr7x%7h6?a~QWA_-thuv>pM&nH;YF!%)XqTc~k$0sW|NhPk`t(l3-SnjV zZ4ZA`1HeK!e=Bu;-}e1$i6ApsEK|B9LRfRFsYp!T?Ry2H2?=1veITDCzO1V^H?%n0 zJqh{5Bvhdz-fSbDPL{PSJAhuW?(PbWi4^=5Gb+PN%t1-t6MP@YiGMIUiy_YW$;G{m zAKmv6&9ocg=9yE}x+)W5W&iT9$}(hAf$0_%l>3b#`Sy6>{vp#>noOX1U!S0P3Lj!V z&^=uCBXLj*RVLR;2B-h#>WAYw;YHr$gIK=%xFIN0eEwQgyxBd)@`OE)?z*W`?9VK8 zm7K~lZsUjoMmRg5Qdj98?B3T&zFmP>;ahE1ck#hnm0~@5lvJ{;TGcZKO$Y0`a^@2y zpyO+)^r-F%&aZ4aKzW(7j-cKDMTsk*?EhkkZg)jtsVECU6wuare0UkfW7WwI z=R$tU%H(+x^_g%;U1c`3G{s$;{pRDL7pqCX`Lp(7nhv+Ob(R-p0Lb&=sudP2^Hx0i``(u zH;3*WkgE#jW4-I(Y5X|4YL%PrkK_I&anG%38`Rpgu@~DvRu3@8OVI}+S96V~Jz1cm zfiJ)x;9R>f7sWL!jT!f~!VU-^CD@z@y|`qU!EdgzeuhykHe?(w(FAoX&Ea5bXDl;} z&g`@t+P1Mb2TD6#xSAPy^maFWd*9Aj`sTjdqsI0V*M<%w0FJJC(V5g@1{I1-EORW9 zjzJy`KOb$%g`6ovRUF&b>}B;b*b-T36s5X8^{(+|c3q`gk8#$CQT+2N@kX#OK+<}< z;k6Pqp>{V6F#JOWG24zWH?HV6sJYxu2um;)YHmg*PWwnLQP%indAdn8y@sTNi1r7w=j<@CMo{L*Rzt=iHS|s>ycn8SEv1JM8 zl5<9PXA~!@kx+32Q^l3E(&BP^N)0%L7%OwHQ(6}s;Qf~eHqB3cL3qR_77m=;J_TqL9hjA{skb5wik8)|?}qEsL@Vv3T)gKntno?~L+rDSr+;?ni%_gHAT+q9x2 z_mt*?p{)#wSZW#0gl!+9z2S?dZDnr92X5+Ov{S0gVH&2f`Y^Z4tQ>z*v|}x)aN!Qzf|(CK zi{TvCCK;J3bz(KExbilo`!ewewXv87!pkDhguF3oN6qqk`q5Ztk}gh;g_p+$wfTO! zbm8sYgVouVEip5S1z6&b>dtDL-dbV?I#XPOC-99?u;^Y{Bp)uKaR3 zww>p-B+SNASCeqjMhe=f4DMNA()tNWWDDJ1G&|65mI|M@RA6gA<~%7Xlv51`(gaf# z@Avyq;>iLf7+E(cGXE!R&y9_~jGIO%QEe$`W z(}^BRQPG1QPeKnmKURFF? zLXQB+98JBX`}d-$S1yks(^>UJn>vpdqQd3;k~8fINTRWaS*gs(6r`!H6Y6hX5=(^D z$PPD?3Q0Jhe`#jeyQC>$c;Hg>&N8Q^oi{u_Q)&9_*bVsj1x1xR#kVhTst2Db!iaUT zqj*WG?mQv`6G0b@)^G*rkCZyyAEDV58oR=1j0r}syaMAgoa1lXvgIVqEwuU7OL!sM zcSP~{5XF3oQ6@wuslo;V83Dj5=kD7HYT;}}WS(*%iNjhbcqU@_Ourqg z6WhF331_^AKZcr@WrpD30Mg?qV+seCAFofnQlDDSwU6`#gX>#M&{qKLqB!XAna&QS zM$FJ5ZQZ0f;*o-es4k<|X<8NJS`*vEq`ec5)Q8^VWG=9K z?udHcY5A6BpHx?U>Mi7PH1#qt>?!oyu7ZtVsLP2fi6rfJcYSIhh7RjWPD=_GFWp*Ez!qq>@$bhncWLYLc&FucGb93a7lDw~0uf}q*0VQP zmR*{;|0Ae{;O)L79n<5c>^NFwJ|R_&2Y0mXBT6nw_s1#w+F0nr?A1iz+Z$AJfm@{P z&>oymOTi>_md()>A2UMCG!P9fiiQx$((W^*a)F^7(BVU!=+RX4vodw0&?~5loK`5b zB6}#6HHtcDO=&uJaE`3Gm3YpSr~Q_dnfRQ9?9NW(j0h^wV5&`dW8mM z?#;{G--odeS&WiTsazbiH+vcBO>L(Al`N1KwnDlFJIOfacsIx5P8@%V{t|>lg9IFp z%Eb4S=O*iIZ65Mop)K?+`Gv4bf*+wdKMRu)sI!J1U3Y97^uwb?E^ zvd`;SMR>8T&P58%FIr5kwq-w%Dp;JPoGiJ)Abz1JR_&&bv~ms)bz`bnpvhqm)yfUB z{7MDWtQP@*u({%<+)mkv@y`CP(Ze*?zcYRS_8;+Lfgv}d=TZ?2ClF2RqgZHj_Tk&$ z2eo30F`CF0oj!_#rg#9N!F`=cujo4~RTY1nwNr>d>2Z{QwGi%r-aDPOO?$i+QbKQ{!YS+5F@*C*?%XTL1<*x z0dO<8afzMc9O2rRARcx99j zLPfS^pJ5wEg6jik%C)8?bc>ln%zb3YM8Tvp<=EaEc)=M2*J5I8=c z%AfIpbf8y-G5)@nE&A4tIFB7UYj;W_ywC{Jz;igm~wW!f1=Cp6yD> zRc1QdMcK=5{`CHlg9y_JH?2p(jU;2DD%}(~x!hR&O;&@DO6Z&R#q484u zq2n!ISC9yAI$wT=9k=Pt?b%9bLbB=gEU{&AIGRcFC8Yfo%lLEu^6gZiV+{t0xZ{S} zusYm-WPDI`MK*Uif9g~1^=R*zXld?reY-LLEq77Br$^z)P|8vCB-1(&cae-W2v1^q0%8 zbTda|7efb+iHYuC#T0(#YiOs=oVQEvu8d`5okYRSoXj`mX)nhhWn&qJOX>Pp=HOgR zQr1cR0Qwic61ga8E*h-w_+F3WZ=1UQ@E6#N*r4idASbu!Rq59C;k7~1=;2w;_HCev z8&rcRW-(P^+-#eTNspgU(ouQRxr%?377#J~ghwezv|H^S-hREmU%kUQysnbPm;PY6 zZF_%sYN!qo&qI#!&%tkjccyy+A=xUf=0-u9=;+qFCuKg5M2@L*LsVzn!btikqihY_8`r_ z3GN9?;v=anD%uCbn{n2?guQ95K%y$W$f7RXn(7r4kA4AinTE!& z8~^?5_l>XhgKz7>mznVwHISv~V#K|aDW(P~FQc56Z)-l#P2j8QQ!nCecd3;-&dlE6 zfL&0!!UB&u9E(uAPvo4E_@%K>j?bTEj(XDQ84*n6n5Hji&qQ$2Fn|J@IzJoln`+BF zt91g}DOj8vt6HO}(=chP{GnS3{G~02Bb2ovTp1*#iC143O3cv7wi4O+8~LS#)=*vb z6}`I?lSkk~vSdVZWg@3b*QkOw4vGiy07GX}r6(@_fwh&!Ql*vIhuJEQrjLrIu~wE= zx*=R$Z>Ab!F5n7>ynd|p`u7o5W9?e~?oRx_1Ds8~Yj&?ttrNma4Pfl!5M8ctuCfN$gjR^Lj%qxk@V(uz|2fPlgnu6YmVoaz_VxPMX8M-1J0i&URlSU!8%<9WX!l+C)r3!9OE95YN?hhSga z`XJwQiDG!Q)_bw$&CXBeJ2O{C`mI1A7>L^qjeIO&PVzsfuhC!MOSSnK^slT>52?)l z6<2SzPd2YVXAyN%VVMf#|w#L?1-UATVA}X(0^**3^pU( z#q$xJ-B7gk=Ec24>JK$Dl@re2=B*LuCyUt!R6)558Fxx|tI`#bUWpk9Mh{Zu1iNjc zHcDHEMd9TvHKbOmB=s`2N(?YRs&G&}$e~CR_lkn?@t|aRq$A@O>H%(%qowH#Vy)HR z%bs&xsKl!a#y|LOr}-YT_@V!(4d`7?~nIIo$$kWC~KqY(U)m;R-Hs6 zEZzL3ILVRpr_-Y2A%2sb-?C4#-_L48OIqgFiCb8A1H*OG z5msH`W1Qw6!rt1dW7p0;n6-Z_eQT{I;0mqAzV(VZTdqZ9l_um0CwT#>qUlk$Ms;Rj zak6rTQuEKwm!cqX8=C6Rw^@7zUUzhx=MK)V6!vtOWZeuYnNjrK)H8v)M##z&V7OX*e33X zJ3{2bXhf6eyWtP0KYq-+*y;*Joq0nlGxhCQI4X2hN}AS->Ha@x^1j*F)n^R5(L0?f zHPkbjt{rWf@(_HKE`5C1Xs7wc5Cg|FC3z)}Bb<3$qZ?`5bt zj&^WeZ&r{Zwm+h6yL*8r(T6$tIO(aCGt~VZTx(|{x^269Y4<);`Xg@0bJ;xz&yV8h zWa_eG#iY;hH`27Zs=i?*QBo3@tfwzg2V|2$Bvwj#fc4~k|HlB&}8E4zDSv^kZrTbE*KFWWP@{{QShLERED@m_gs|pR0r-lB zF;Vz&GyTtYLoe9eG?Md~K)ERmKxkwu3h$E9*SV}c8UhB=KIe;Mu8%<`cx#&0r5ZGK zzT!-sNNGd2GUS}*GY%JZ_BxZ!RSg1W$wY<_bBHtfB);OzyXAI-mEtEy9#1s6bBXXU zYfuRptqil={lI-B7VZL-RhQ}-Uxt5{x^O3-LY<3}mD7mD{TYkKAHvqN|IYQREb-@7 z>a+yFk?@k#?LegvSZ*Y>5cxaM&DaCak?^ZA+< zWvv{DC;!SstdPM1#o$8S?_BLJ(C4()p2AhRDdzeY#+vLhicL6($71b7}gSEvi8*J=fGkNCNIK%AC2_6q>zkwMEMO+>|Zz<>2uZ z;?n7KyPLTt#JstnRXo5yH)W&6YTkA-8{l5M@sC?23Ad0FxNzMlG})uxqMG7wBFCb25=3ZiD(b;WiJ2tlXG~|h!mdxsA%17(@~%%x9sg?P^3G38c~<5UHi#&91;&{4+*kajnVQE3Hf0Zvh1P0` zYkLJ5VPXiTh6irgNZvltytQq5;jXUkrac2kE>6B97SO+u>8bCu^6N~C(o+#8wLRk0 zP=sR%dr`GU>C?wz*IMHujj`%-=>s8GCHyw+H$YcLfFT#VajK3%?k&mr)q) zU{{ry5}@67ff#-Jv~Y~uEsk-!k7Mkg`0U7YlZJ0BmN6E3^By3mR|wgu4L=5(h?cF+ zVQa2QZfT{a@z0xYidAi-$=pZnVM>nJ1t+(h$q|8 zDq|c~Hx+;orV~kN=FJjf5kAUocnxb(+V&%nESI;uNlnP(3b$b~H#()CF{QYvXH0iH zE%R;gHEzQy6Kp;cY@#_W0;ZArx=%=*w81wXF!lJ`NO|)CQ;xrspj!`|>I{NzKX599 z(%i~M%0!U)w0Ou;4NqZqrXUb?aw(i^9L%rQgYz7ITOO*Mp@f)8-G=R~NW(kk)$$?C zmcI>Z+B*=EBVaPM17{B=D3*E12%0e1k}YuG6s1Q*y_^*7aOt}!rpua0iYR8-$+AmyEmDgr2rv=;uu69us=_excncO&RxN z6Z)YPs2(}LX+n3K&{y{hecpubGNFIlFZ8!2w9AD4+kT;wO=zbHy>GwJ+e~PO3B7*5 zP%TW5IC9)Lz->UPTR~c4EW=J+Tb(m=s!Vqt%(xneJ zWxvVVX>u5kLH@c29}X-gxD7qZvLdz3>jDFz^6fhDR;m9L@JEUFPbT<+Jq8$r_b|DP zNWSAFFNI`M_ae?i3nGoXzm@1`K0i)Y!go|_hGj==y`;-vZCc*&dqB#prUr7}PfLa5 z!7RiiJ+M{wHT6YcRLFMIdVg;mA34oG!TS{ox0lf`_WpeRyz5l2=`{VqP}8sn$AJJu zVeYZA-1-?Z*UHkaE4`piS0{!db=nk-G4cJ*^6JyVKizzWZF!`1F1=>g5HcU+=_ z^~t}ZR?HpO}j8#wggIIV)OdNu@v#8@P z;{->qDBip#_abAAY1~vaGIPb8kKNE~hM7{f6qLM!r6nQKb6@uD0}U(KWpi5Q5Rh^A zG-XR=@M6~Kx74PbYJ`cCypIUc)Kc32S^h8ES$7%a=^G2ZtS@{pE%&N0ZjbrTXxbf} z9`M7a%~w;A+^`9cn|YOb8Zz?FYR5I8P(1bm=4Qg z_s)-*No#rYj%0mk_>-C4s?XlF@QfD9z05kgmzK+By!=C(2R*-2PKoyn-%UNQ@8#F? zkk3j}=w$0`IM%7=k73v6>~d(2?k7ymB?TTshi>&==4tkg+eennQN`!oeK7WZ9Dr>& zOl~inW(@@mI4(Ep=048McYE8&eH8gatmSkH#-(l9Kbi!tQAQ)=b-fM(+ z(5vU&`y4MtC4SE@@eaSl%~YuIzTT!Rr8$%|PVzAI0NL8L@>=3>!JfBLzxbz%rJpd1 zs95^3%7Ku|nf5*d5?#Hrm3r3KeC$j*0mWXLb)1YM&uU;q!Z|0ofn`B3(bc8a7_(y? z1DlO<&c>|L`K*jW{F%$aP>fxdZ9sk@+>9K|-;f0Y@Yb?Bs`sA6uWdO0wT+X~bB6H2aI`%~i)3>n& z41`dPbM5lfX+BtTY^eN;U?6IZ z=FTsAH{m2*GtG1;tPLE*%|Fx$s+7KY6C?#2=6j>q#CK<{wVBwV^eRJXWM;^7KT*6v zWMsxg)1EaCu(k4YBPAfZccPhr;Jha)XArY?=vLEc8^LKQB{=9(G#7-B)HG_~>pC4F~R1 zku^mX$v0LGEqpor3G}*xVsp#k$BfnYyq8HL5Z+c09p(n$fk_0EbC69(wu%yS zQ@I$3wy_lQ+h+0)7(e&ZC=k|jwHRW#QY*^{@a9(&M~IBH*dq4n@odAzT)ZIXN2x4J zdPe(0|7=yen|2Hjx1ZO@BNv5EJB`^==7E-fBDgc-*!XIC4?(cFt?M9m###3|%^*z~ zgCpsvhs?Sr^3-tE<|&hzm5n7%^Viw5l@7Ut&%93ZU)$~L9scWT`#Rl!-DqFO`mb60 zdV~ME-M)_SUpwvVK>t-Mw$PxJ9V?sW_rvTKF`F@C4`m{ktAv_m5$ES^h!7(-;D!oj zYB7YVcEk2;@-1e~)$m`Sk-3=*doj;`x0hDX)yDGwlQO$8kieBMT3UX~BQm?3x&-6F z?pw$r9^ZkUx?VS!Z97l`?|Fhit+^d*jfpYV?mfavS5uEVyOlg8^JE=xn#ah5#0j{j zJ9rqnGh#+5fc98wrOqmLe1Neng|ndhl?t{`YGD;~o?ETe-3*@VxOfa3SF~YWUHA<* zyunB}8#MkqzBqq=MCQAQ^EJVs<@8Js$^K3tyT=+yUU#rvV2lW7wUY4uj0PmRdWl$E zgq2+Vx<>gvLc)eREyD>5$}-c~D{@cmS2#CK^IhaQ2~-;x32zNz<6da|Yjr8k9!ZKC zS!QR|*O%@mO1&Zpmix6-n&u}oKb>3UBp>C$ZtTyw>Pq`h$Hp^fVm}6D$|2Cb!!hvB zGOAa2N9OK9sbv%Q>dm=yQD_N-p7u4EW_HQ0-5j&tOEh z5Qi?!9);c0`z~9~@&`rZR%r&^#(@~LSJ@9myNr7t8ZF>OCc72!Q&ijLf4~Z8x7-yg zCrFLNVvMzhaMn%Wp9sXplGsWy#iiOl%Rah+GCSb7K!{Tnf8y}I)CrF+@s^=O$zt6+ zm>He}vl#z6k8jH!of*)(>8;^xY&6Wrc6gMNY-5GM(~(X~m+B_Tkg719%EzeZK(W67)5%xV?D74JO_8P@4Ic)CqpP#)*3*vD zXb0CVF&?qmp5ivVAY)E>YAx8m-o}M=hRsRVCLm@rXC5Y-YG`pbRLWwm$fCjX>w)Qw zf%bYU#TVH=z5BMnohWEaOiit1L%j`J>D|b>m{lYjRgXhBvtNg5t4mZK;a%&U*`(CJ zMwUHV>Uiah5G$FykCfU7DbJu#jSeKFvpb8P(!b-44)iD#W(DwE6Zv>w(?+i(7dJw+ z97AN*QL*$?BZp%RYm891H2siiO1LW;ewpzBdM(wZvvU1j!VrlS%CMKya+L&UYK6zV zV5CrZNAB}RYJFDvnD&1jYGacx$AXBvXNyb;>V`@Hr^YiVlk#ef{92e5CNy#aO9 zj@n(_-fnilfpmBanEfNqirdYK!F!stnxd*n@vcY&STEbE6hj#nMu{rYpc44w56ba1 zD7iOaiLTL~%`Q}CzV#c)JlLxv0ZUXv7eOIFCc_N2<=$0NIm31~E$;85lqhpwshfGm z2;Dhh>XrTaHB=69EKX^x4zriRzI5GYZ-JJ3+?d7!J?hjg@;0&Tiad+rUt+te{cTmj zE)=x>vkNDX1?V15w1#-!wiQ*%meg!W6Mr)1ri|<-Q(GU48=*#SS zIx}%i%vSrD9fif$^~yL^*8lCn;ZOWzRGWo>k)1SJaBcZcAEa8;EVP7 z_j(H3h^@JQ*V~D~Tc*$p0qxB^8@yQc&q}MU0Rtni(BveqPC1{;#L!yR2TqH;UVC5T z4*-z%5DmH|NkBnh=(^=fRF_&doGNDjZLHp$%9b;>>V9 zBkc5HW%2XX1&`fk8Q>9qz59)dj@neG1@Jm=5psN16+Gq}yJ9dB+3>eJ*P_%n+0?Dx z1*Ei8d@A4cMiFb&(15(>F=1IMzAdcX*#vMHXOxusa$26by1RA?r+6B7J>X3Ksy6S^ zr3|~a5}C| zS>WaJs)vk9mH;JUiZ4@Vd8DXzns%G!%B~3qBQZA_u`6JXD*#k&_WKXvv$SRb0$A{; zTA_1Xa0hsg;7-J+>0l0ojvc|u6bK&w?x}KSR!6x7D|4AV^2VHtbRdEmX?tQ5w;2xY z_PUhD_M~?e-KpDqy1lpcHE(NKsFfbW{W*Tw*iV#rm*?q!d45PNxt+Fr=d_@gqj~+R zN<-o+`GB7nS}(q+&IeqWPcc9#jt>HEnR9-rCD+0F-Z%I@=L`9=2dnJ&(Tprp%+Kf4 zpcJp>10KtlU8}O^62P?NO+q@`lt0N25gv)}Vo>iJ;=(2e;KxilD&M`%nPe2X2Cd%wkq+ziF_@dI82 zHT2eqRZ=UMTMoj4V%IbOKfW5wz}e5EcKu(#SD*9$Hom$F)YPZrtIzpAiLb6^jg`Ib z6h`EM@YNUQ14bi9?cg>kP9~tRAN0S1ua`7awP5!oY4dsdQ0w23a|t2|n2@HCeR58G zUb+6p=GwYXj{f>kF{b$Cj@!T7Jl?trL7m<3{eAJ)gZOOhioUr}cx$y;n=J>#Tc715 zbsmt_A^1}r2(?hyeeu>Ko)s(Q@zx=-{O{qd)xPNs(9`0rA#Z@UHYb6~2?sQk$6Ko) zgSS??Ym}}CZ>_}t(|Btq`5?VIo_nk<=6bjfP8Q~RD$0Y!T<`o6nCo+SoxUI5`n>(| z)+ZahHQpU?yD-aeO-ThtADmwZ+PTYeky;ub1k(B!rvHS~UXofrJ=fyfsr-bTTjDU3 zfnQI2e=l>1_Z_;tFkb#89QN1fXQ!o&g7Y|R?cV2c*pKd^w->jnN(GGc0dUx-&1Ol1 zS@b|SY@N8kzP>*W`%H@UmYC2wG2Q`i*sEs2vH1o^`*B8Q;_i^fRq}D_1R6U5?Jb=I zW&DtjQqNpSQH;l~=G||H84sp02WZE)DG#%4QSaniI2}jX;=ZDU5-rxcp_#^cKim4TLNJAU}4ZIgw9_4y8=4f9+EXW zYVu$bvJ;$#Xg4Z3{|fuZ2gGM@w06={v?Xt%CvU+zWYj!^&ps9Wg~4a9LQ+_*_W<~8 zEm=vkKR)}{1ZXXzJ!;ShWG%0x_tQA%p;lRI2RqI40Ec23?+MW!=0mi<9?4wX1ETGa zhXAOj7>IU+>I;Kv_(8gD-8sjC&pw&Ytc$J_K6_o_y=cwa#Aobo{0?-rU_Yn_KKt*i zzipIX7%Mfa4Os4316&2@`HRn~Uu2NP($cX;H5hE+*)xew70QLL4)EE(QDz6iXAk4b z_<5&AQy)9cBk15fKD*Q6v%B*6>`fM*z1QNiUnGH+kBg(?F&K5 zJCm#Oshf|W2jDqvkS87DyR#mK;rTbgY=^Hs8Z%?&VF8%k=K=tBjJ=W$wv&wCM>qAV z+qMVz^+J6p0%<=}*$59}!wn)9K-#jM8<4j689(wu)q0;?dgnggV_Eq-?a5&OPzS3*zP?2btaD@2uobcB8t<< zP5#nvR`XAInDu4qIdrFB+dBl?20Pwfm)g}6wp~|wr@?HO3A4>h0N8Fst_iT+z7JrV zZ9HqNjD$bh7qE>C$B5bku#IcaI_mq$c6w+Y_kue zHbFKz99J~l8XdHXN;jWHjt2Vib3ORbk4EYqKtEOs`q35(uccbr z-c^{>axbxGvjIsr0R8yNS#{y1{sy7iZMN1bpc7NVo$Og2!6REY_06sO;y&7Gc^-AR zE&FW@s9q^6DD4hsOc{!9N71_oYNJz`{lF zmBf|B8+HeH!_~wThk~gASzzEm1G67CVzV>{x8lbbV{^0yO|cacilad~6!3;xyDYfM z;tgNI&ZLRMz!2B$^DG4wFF!z@{NC#zir|2+nO zIL4GJIpdYlSagQ}LHyx|jKO03VI2U(3JzFv9?D66Ul?z{?`Lb!&5{0J7hX{pUMaT+ z%{zTGq8O4{K?ovN73SZBC>xmJ4_tOzGZBM9be(7$N4&rwf;QTE1ih8Hpxb?9WTtKw z7{o;Z2C-3jC8HXJbX!&K>;gU9hPEay6>qs1;gT7-2fv-vBGzw-O={%Bonm3{SnfWHI0jpy|{i$xj8f{w8g(#XOAOxsE z+&@~>;ASdcRNwu_jlnb8CcZDu4Dh;o#?Wl=j60g%uWH)cFTgV{G8|k$B3=U$aW_cB zz3g%okciuP^FC%R#ds;;5GTSrQU`@Yysol+NeB0)uGo_zx z+6XktZ2%m->r5y4E1eo>+I5E0GLjh(Z*tDGL-~|(|6wP2fAZ&`q_%dc)G%h~w@?JK z*F3I%l;V+xI!HQMsDqyLPcx!h40YI+9R(W5+sZyJ(72BQr3S(~mbu(QlM3tIztSA7 zi4&DWm)iY5I}mxGAj2H{n{3ZC@(_2IL%8W>DZtTD1)Lf4ux(NCt3WlI3-ZR z8F=<2(YTZSQ$#ZeEr}1v;pV266F%m|jQN%*gIhR9li19enONnW!EqV#?r0ZKS!0t^ zGn~c6TE@8<&dUh!mi-ejBrm4nV^9BRf||9=H(YRqf;0Ko5HFVbp(ZEq0(SN^P#7T= z!K}i~=O( z*lB)I>tPN@1-xTWnf^i1{866fXEoC3uEBW4X=*JqdTeW1(|pFtxXzOJ4g}#R0w+~l z5yBkunQQU24Lh^{3Bt#7X_`Oo_UwG%>#@{hCS3TxW31g)5Wq%qFu3Zof(TBF)C2l7 z=rz-+bRC%`iLKgN_V7+K2GEjOXYr8)CL$0a`p8Kh1$lu$WNdqlIMzX39PMEfUzlBj zpqgDvIyfa9;F-lMpaDajPE%G{hPT@_QhjK9v}u*WR$r$%(%#jOuTK;06XWOG_jT4T zcKOG$PxxxP=7Uj;BSOTgUHDx{CCq}))WiV26{Z6;SpmHb?*@&1noKP{d(tf^*lBr( zm9g;E(aaSbWw!9(M$<&Wk1bb?mul`41v+?7K|(>WcVeB`4}$%yFl;{bbOsq2`-fJ( z&672`3wk=9hfjf?PE;xsjbujk@S&%TJns)ZWl3oldgJf(my}fmxz|yPRlt8D=-dagH?l4!HLM+52i=v ziQ$SOMTEeAg>4$*34;28o&C)cKYPQkd`_c(>sV^D@WkI`Rs$mVfE0!vB2#i;aR>LrpCv*b&jf8aKe{4SqZgJpV4ZeI+v&FA+wh>7&4k>oNVDBKy?DeD3)l`@Db&_3hWm`*Q_H~qrMg6 zDM#a(+xsDX5s=T2s1Rdu_EN>@2NOJpf!|+5dC$@~F>82Njy=Z0_QA$l=O;|da@7GO zlojs&kkI8!h`AR65T!IJ3!?npY0yXO1HKf4D9f1lW@`bT2jLCY;@pl; z^S%5>K4R&&^Mua=v4#!d6~fcbASV7_FxI#)zn5BJ(6q}9n%4G%)3RIhFOKu3N#^=u z9N4F4s9!*dR?+1_`|vJTYp!*eTG>ecK5y?(Z`{IrWR78-Qz5AxO9gOYyO0oHJ-D+N zK&Rg4=*Q~;(C>x! zVLkw6MF(!Px!>Db>;tv?M?XRB+)>WV8c=oyVE02oIST+gJg`mRi`UE_iqOfYx4rMG z5FhRLQ=4%C;naF3&AW$;jgas`4=eK?>o(C8EuDXTp@mcYkY8^RYKXsS6RmmKX}N%R zF>m~P2L!4P^MR_jDx+)sj9h-T+vCjaTZB)wYw}x^U#i->f!{nnwOXl9_ER6tua8fa zK~4bGrxk9#Kdz_j1*XESxu5B6bMQ9Rw!Z*k8)({(VNKEg;z#q|0sC!Z?t?{(64M6k zgI=r32ke6~J&J$>g2cY060fx-_KEWAeJ@|?J`mQI``Y@Q7}T#WAF}{#dqgeyJuz+l z_QAAHCqO=73QN(mwO!^9|6ml^DcL)XVU9uPYYbDH*<*R&n*rWkNM=FOf;5SRxzoZ& zm}iD%5hmHM;n!QzqvZ$4Z|`1BxMr#i#4(a3%bBrEaJq!V=TA>#pxg@FG3~o5tKunnOs?NRfsdfJrI4$aqWAE0WckF4Gn&H5AOoj@jRv+dXiJNXS_+kgVVEokXM%}dm21i*)@fHF2pTOU8d-|1_Ba$I-n@#pt038ww#uhOlnG1~NSO*`Gs!^ca`8tek%f57~ZT|FiSRr-XA| zF1DCh^ZW6W3;R3kPTf3AXvj8l=)QSz=<~!}y<{C*9C#ite`9q42}y)pWcs>OmnnV^ zszQrAzo}9O@;louKcf5xA82ZmIKuqsuvJhkEf*Ba8r|b}j6Wlf4xCA?d~~3IkUwU4 zS|H@9IL`J4@*3EG_QOLSg9AML&we48&j9k#5+`{gGy&~6%l{5&F223rcKp(AcFn~t z?TCcRd$8pn03Z0b>GYtF4=ia6@PXo^jA0FPs7RWac4+r0lP6&o{+cuji>m2)1vUP;B##$|Dl?^#>j z?^7bQbecglAK^Hz z)>r`K!)G%tCNN7GW4c-RJINVB;GsxyL+hwpWd~@4M*8Pwt_kJ|_$21cJCP;O0^k2^ zr14|xe|8Ez$jd1dSFTj}XT^Mi4mRAZxsCzD5vc}^x1E7+q;c-3{CM*5Q8audp`;nm zmt$65k^5PLdu;p|c;jex*5*=Hut{Sq~5ms_NrxFddMX0MhKX8Z6q_o zARO_xAs@7VBo_g;2G><@pkA`$wdM}D`$OQhtb;v1LYkTO*7 z%=Xf1n!| zI+LHKH|sM$X@YN}bBoZ8(T*)XXc3EJwC&?w(J+@de>%ERYZAAOZU732onK^RE3y=L zU8}h+gJ2^EqBZ|?rale6H{#5D-bp^f6Kh_47iI<+#3Ng=qXIx9yCMPNaY^1Y?Y(YC z0r7Zyp1<>)QNsWS`51eqSBaq}E^1dm20pb`nLLpkSHPO%T zbQ&S9r%)A%J_{AK*D>>d$y)Kq9;71!Pxq1K0zRY0|e9tAKjEij3Uz^w*gjBS>8Y z;IZW_gM5T!$0@#$C`a%xD?(sraYeD*v?a%0KP9^m{aYao#^|->7U69|(FF_^16-N^{uN z#r|pO2JJT*|Fl7t$V94=_>b7ROh(#ot#y)jhVbDOxyxVU=E5+8>-Q|JVzWf(vLxzBl=?hLH&F}ldw=~v41RmS!k z{_ksv5$yoL#%1xIle|aph}1IOBVD-0e4~6)S-nH|Y*WK{aL=~s8D(=j z+{zu>9Q$^f|1Q)P56MPlT7*utZmF^$6C=PO!e)zrCCtk-5B91450^WYl~ZkRfEVK#IM2`~;AqH^dMO{v;ic#6=(pjYN-TF6xe- z?d@dt53p!aI6_?EV%G^O<0Kyv_Rz;uP0=$_>Ogp^+X=ID(oCK%o#gvJ{7*~@{`aPZ zn#^wD5cZ-F^S*a4K|T(V>G4KQKjq9gC0?98yl2%80x#` z{WTlCcHZ`f9-d_Rje7WSJL?khzw~=J`Olh}8|Djc*m$=OH#{5e2)cN7E##eJJZXLs z-0)a2?rbx)YjXc&xFNIt9l{LCkS$>qjc>w# zV6V;d^Q3vadH13jz|=|NlLG_ah))kM;vl!i0}GsaLje`|N4TiRS0(Zu;j5{o4$7EX zZh|f41JCzOxQf?^nG5T~n++!LHzWaFFHqnt9uEM~i_EhSy>G&C0YuM9_C=Pg>GQ^5 z7RfZO!l*1)6GH&K%lIwIC_oo>K4&u;NU+>;Rj}p$scsGzn*P+TUix=wdagknA+W0T&ddj}>f?HxWHG609yD;OS|*YLoa#m&PE~OLIMp=)56NG1 zN~R0+Mcgw+7vn=EkE_yd;(oX)<_-M90I7esfU9zAR?APdj<<$);5clo^;7-N8Prv{ zs;w4RB>+l=#HOnmP*5^z6vJQiXu|ZAUwW&_0CAXUvQEsg5zzLew zdUUd^Kns+{1Hw=?3WfqVln1_)yR$0*GI&GS;nq6aH~(0a8<3OKt6aGd6cGu3EKTo= zD09AfaIY*E1NdQmr?u5Mq{Wp)V>ZW%CWrzE+v8m7`l{fUApuF63 zdHEZ}Y+79FidT5*C{jigL-aQK9}npv|1?BT^7|W z@hzMgSWEzCekuFpM_r!|XRgKS$)(TEv=8W=roHg7+=6AUYCQl(&}jYtB}VYCKo-qZ z7hnV%Apxs}Vw@oB#s3N?SiTQVP|gm$2pewXPj@l<2^pg*RgGR#EQs|ao#s-aL#JQTdt%{kvX*#Q+Eoj59nGrC1)>j6j*X# z_Q-M4oa{6wi_^d+S_)WZq0Y&vdQQvTS~M4cHYb6Yv~ur zpwzq@USQ}()c$rXW_~>5VyY-c?F9vRT{PTZS3FVKNanRvq_Z|~0_#i*!LpQ7<~5=8 z!Pi>HwsaBENPO*=r8bWUuZ^Em0Ent!S*Z;`v@H91s-U)(8Hq1T^(Uc2YYf=Y*Plae z_l%2$wSe|9g!Lho)hkQ|n#V8>3h2TSnQLn!%yk76=>?2O>Xv&fKOY1wG6eT#YCr`u z3y$V;tpNqSH0HxRrqs(r|A*P>%o?*zz|b|8D@+KEqzQ0Bab>#IHUi@na<9 znm)U^;=#Kc^#v;dR`4YfT7o@xONP%;SLz_`bj0dvT$v;~tsSH|?j90n$R_Bk-=pDs57HQ+{a92iG7`>P@Agfct&{jP3r zEE5Ym7T(z~OJwdX2!4QdBIeVAIR-kO5(hvbsa|I(=_V>Qi>St~X@y7~I%$1XOyM*=nQdP_72Bc&d zefwSP;$Qj}>nsB!L^9$-b!ufJ*#;H#UZO0U&R_>kx?7d*NYdE=gRn6H#yi=bH-i8J z_c8&-W8pgl)zm~4!vwO^18b61gasJVS0I}C#W zu^T1w4BTtPFOF0{pSZ+so*kCor@A84o#6f-d13^=sC_D9_7An8seY4ru8pJg8*{TU zC!wr)?+L8rV+_~H#3VKN1%q$2bu(}|Q#a%6EkxafoEJA`UBa zjo(jDuyu>Q?eLe>B_9$ss;+u91BIfka8v83ESqWpBI=5Ry5m{z4Pw|r3|7k&V%!bh zr$QJe(a<9A5asQ+V4IC?@KYwXar9SD?E0D=PSa1-SW$)+m=z}=|DHg#AJqw{wuoa9 z`vBEA{|>7eu$nJ2k)p7+{dWm{!~yfRfbPWXPdAz(3s_%s1k2=VMh0(2uf$ZX?Q6#U1ry_v^w z=;Ys3{3i8Scj_R%u3ze{1aBy`T_Jk8i5_^o!+D{Jez1-HDA5I@+v;`mRIufoi+C1{ z?hJ`(ws5_efv?^QqV<820Ma@G{F>VX(%Qlo?;-xcalY;HbnIHw3zjk?zP|`%10|y8 z-cMT=|B%}MA(fjc%~018Zzok-y~OLtGlxOj8WI`DmN%>qXlKxmCcvN{M-YHz>t@!_ zmgoj*X~K>B(3A2B4cyHH81IVx^8p6#W&(_N#Sh=;2prb>>tL(==JAwhz}vEidfHqE zOnHbbd%N<*-!B-R$*e;1=67V4+Th*9OlPa7O+OoM+$l~X+y)q=s!7-?cZzoqVD}}@ zWh2vRF>Yd+AL4gu&6EfD_#6_Cu$(Gicj|kCIGDRGe%iWIxAL@pshO|$#r0ZK-c1+eJ%Dsr^I9kT9s_krd@e$wKl$-D_mt%9f2TeI4G%f;zpl^dbMp1ESkvzA zz9sHFaehfj=LBpoC(Kt~8;>BbemmTL%VeHw^C~7X&YY5dZSh}dU0y~UH0|8<|7LxU zT+`>U&+cE_0^!`$rtE?m)%DoQ#L6{&Hli!(&;>PF2arm&=^hT@%8|DNCcZ`GTl+1e zVgvfkk3TAyRqoOJ{NK^Hqykf5dHUkf&8_45eF(~|kpwL2jEsYE`|&o59J>jE{?XJ9 zpC8K7eNQSOa^kD8^yDeTy4g(+ISH$KN%Y)X%i?DnGe^^TZRtu1ICOi&`7@_}o+UVU zuzmg$&u+R&Nn`fMP2E}+X{s#^&4z7D-Nz6jRDEj`S)uS#?_hochI$q|cA6Bhyj-^Wt9b@NSP!>PSr{ldp5FPt(cm903 z)7%HS%?-7B+(inXihiqNsoJup3ra&n?Un1=@!pXA%LbyQ=BIn_To8(vW611|ADsS6 zD~X$Tj=yc^g2n{rWAhY^GatInpYZ;_E>R}H2Na;G=x%IgEYCjpGe)2; zxY+2{yd2*E4Ti4#I(y5CSdgc)3=!FZ=(YkBQhQ;C0vY+6724f=VlW1gGgE6*#-4utB4*GK4g0T&P?NkF)tX4EMkoe>;O zdLJzwas7whn+Wg#L{qPb)d&r2u49>p*UwAt`zgI|x0kx9{>^(tkMJj87lVI+fs!nT9rE40~o&r50 zu3ny}Y$mrOMmYbS*ad)8{-@IO!J#}Hx}gtDNU4Nz2vc}@mTrVugx_hARtE%g>*Ei- z*P|g)U4j=cF#z1C_>Ts6u{L5FIt`6`CCXE7b$up2(j}^<&{ByMtpH5!>|NZ7{noRvS{*0w|L^E!T)z@aJd)uSm;!0mwR@g3ydZ?i2~_+68`lqkou0d;m=*R0;e>ql>Y3bKNa-nWBi%1 zh5l@#KYQuV!Gb)gvXuVp!E0rZ{_HPsNY!QZr=mdmGEgA7O7U-dfmB~sAno5>2=f$; z;Zg!vtxlH~4;F*i3g!x?N9T`vw1%n2YSvL%vYsE7)G8?lhsWo2MdiPSzo^LmL4tE7d8}!v_1G)%05rfQW>^M~H2CtO^vHQ0-5$X9K5S!2H-$baj z$Pt8EMG3xxU^0lMo0S#+WV2j&1baA>T=+Q!4#n0#S>2c}J^vHT#yEURvyNaKm1cb~ zQZ-G9j^VmyX44&e(iKq9IhKhTp%eb$&|gRDODuAV`o; z+mIvpDL{!NezNHNWN8OKS%{y~I-j4)=(v+m7$ZnUsdl0D?z@8Qx)@{+#zEFRKh;F} zDXmTXL_?^wgde%Ib$;s6sr)paAV}b+Cy^ugX*MO2_{pmCleHcEWF>y;(fRx|KO@Rd zZz9zee)_H;`xu9-bWW!;N>Rv~=clSDKlNx6KhY2>t>J#?p|$m{d#CbK1bhBOe#!z& zf}b)ek;G55HHQAwr5*g#h4`s^=kwDbIuat})BQ+Asdgdx^j$&rT%RapTab!E);vE2 zqWsjoP5eYdsO%E{Cr*X5#!uZkm7m@u2omJezmX&Oshko?{Dd$r;-{|d;HR#{Pu)77 zpAI07ROcrN1Bg=XLj3eyL3T?FGB;9D$eQOTPn4g!wTYi-2$fyK3vdvoHGb+a8|N< z;HPfw;3tTtIgOY{oy|`}$u1_=yIDxJg`d7F$XT3 z1o~qDQL0^Nz5A{pyDbKp52+|*E%4J>gP*#ziJxc)mEFV7;`Byq{ABG^ewsxPB=FO( zkt6u2m=a0+ge>Bx9_`>KZ0+VWVjt4k{IncAuS)m$+**Qpe9kLtaAZvl2 z>J5Ifwuzr;2$em;!_h-){AB4=e(FyUB=D1r9Klbylt|(y%q!xjw07_lOiyzfVJGQq zeqzw^bgC^vsxAEVT|xGD>}GVxK0_)BSquDBWAKxuP5eYds7wnV$NsxDeoF0Be%eJ4 zB=A!Mas)rsP$G$+u!0aj^=t<}!8AUn5q8|p<|n!rNT=HM7(kS27h3PWE6DDPLADI3 zC}b`0Q=j}58m1QG{qd{r{|Gs3qO5VkgW&u zbWT5mR1~rn_{n4NlesPYR7pcPAQdOFiU{OrF8rzTg5ggG5#_KW8unCI5zn9aU8Zg| z_-Oz{eGTb_vqG+3h-iwlPcZ5I3OQ@fTpYqm>x)|!FJb;Zp|{N@E$tcnP+eBprtAR1 zL!06wq}9D}{W}V6iZ9gkon1JdY{dOQBgK=s`x8DXp6nM$ogYs&P{ofKgUzqi^yiH) z;VI(Do&hC9JXs+Ur=(dD{vn=hRs*4uqQ+)zr$2iOq#0+Cm_fm1GyX|`DiA7GSx=bU zULaMTLssQZaQ7~XAcJMDz%RHK9B}*cK??-8{;Jgz{|#(#_LL5d?Wh`rP?CdhZ7Wozz2Ly@zk$hY#P> z6dxw3)#Rhk+954ILN0p0(!B=LK*E{CUd-R~qg9v+mO`!f3t8m|n9K!q6hGDh+}5lu z_-cTF#^Ykg@{uEmC}pwullN7i>YGZ^=8R=NezU02U1X4JO++_9ltLl zg|px3dcO-hx!;{JfA~P7-*68KMQ)Nuv3R;!7&eJq4E^Tmft!__e@p6(sIE5jl9p5< z1}ywTycH9DvDANiY0@lx$DxZv`aX&rLEjmah@&r-a$2{O;<(yKUnqecO5XxF-gWwZ zfKQk zp`Q|clj5pCUw!7BPMSH`CUz)Am&QE*)krl_bU`QgOYs0YC(SYX)hQZ{cRz2wV&E}) z`rz(X8`7jDM`*sz!<(QdOb4Ar&)=YnM0$RJ96`@_C=o|bY~_faNpVeWoUbq{btrXL z$Nca;0cI0*ljU(o_j^mM-(|x8zcIbl`3ewX^nDHPXSJb+F<*a$H$h*R8as);@1cuC z`hJ8QLEjH45l7$VCnV!O2p9@mNA;YNpU}Iq%WLS9ZKKYm6;IGi@p7f$XDrEg!rt*?TQBGoc|JG$RjVxIIf!js+x`T~R)eXXdZHrNdM*1=RM z=!?*YPNMH+=rEDKBakELJA@K(^ld&arj7Ka5p>*+R$Ba%SX_W##09jpAL{6S*TWm3 z^Hm?C-&WUOfDohaKvY*7x*GJo1aE@A#D(A95Yb%h(=c?ANZ)&rBj`Jk5^?l}E05%J zQk+T~=}Qu*Bk6lr%uoL};iqqjz8&4~$33F-z0v5mRr&&i7=80lU2W)M(Dx?13Hs71 z(mC{DF*?_5Bm&!c|{zj;ga?dX1+{PmNJ zep{t4K#0-zK}-_0!7AzN?_|6Q`jQsdIrM!BT_n=?W#kC@E~P{qeL-%bZ&Dmb8|h0s zfR3c^f5$xRCxnN+CHi)BzgNWibsPP*N?(8wqpuH2jM`u^=sOQ@g1)qi>m2(223;i5 z_XFez`o2SnIQljpSJ6iL(hj~O>AM=*ygq+>0?d~6tB&sXmRP@ZZy@#CDt!S$jJ~g7 zlc_eO8ua}Y-UNNg_R~4^eGgqE()T0e2>Q~6yYckJa!m6#DbAsd^d*a1N78p6tSvfy zuLYPb)3>Ahy)V}9yGXT(z5pRc-z_lu;cgIvzH9I%=u1}9&Y^E5x=5t&H^>q6Jxz(Y z`3rrK=$jOG&_?=_#k?cwTMO&APTzch*)n}Qy5EJde)l5PCi((|7=1s3`x+O(81&tb zH$h+Wwsa1CzeX2{^t~K#3;On^L>zswT_XA>#R0UDzU1-hNc#2#+&X<9MXF``c67h5 z010}(x<9`S@);l)^qtd9ZNP7ReMULQU|r;?I9{B*;hp z{7J$;L;n1qlCLQ7ewZx{vj)D+%qBdqt<;}4Zo(7({CSVTmp|{JEse7z{Oh~ryz1s_eOuO6Z`<;h>WVE5Uk0``xJtL2bZy^q zvc7CfL(_#XE8%Ll|8t1R4LIMt| z&}QJHKtCCOy9*u0Z1T!mqK>1lk=-K<<% zbpfDm+vZQ6jJn-_rlV;&y7+bt;n&zGo_;(U3O__1*r-28QimZ=_}6bhf+hLapMD|9 zzrH05|9aaI8Fua760R@b@?`uCEX&~Yz;NQc=xd^0o4+S{Z6JL}Dkj~&0_;ZN*S&G8 zQA{8RxD)>K_F!CEyesA&xe9PZ#onT+9niEZ*7T03=fwd!6dV3D^Z@_&mInC0iTsBD z+lr#X|DB1V;X1eyiV6R{z9s(qpjmVnhyR<9BUYvBC=s_RVUZ&IpYP?qF#c28hyU>y zq0Xp(igTMJ;=i3upN@G(#u-hAo5z1j9R7W%B>d9?|MT!B@Za-W;(r+$O2q#fY^2@E(&t z=kb4P9R97SBK*l2g8$($5cp5~miX_3W)ty$6LNI^r$ik7Tl5-VnEx&9qr-TN(BOZh zVsuE5KkaP#bj+hM&S<&?{dUK-UR-8d`tWKBK~hej?Vv-h{J!2Ue^orf0y>*e>_HL@W0_6q2)bM{+4JEESE=GWh@arn2QsPJd%{NKaCzwKM%zYm&C#Q#mm(fOYearlQ7nDC!; zn!i>2+uDc!@fe}O|422D|8_QgI_5DMXEfac|J&m5??WZwZ`Ao8Z-W23eoOo>Lqm!9 zUxOT-|0xlNe>f=!|L1!ZFD!q$wGaQh(48Uw0Y~%rZ)el4SkpU@x`6!e7KeW;iVAR7MFMl%JFXzkub~b$) zlGKp@M$;|ufA={2>;4@0>vaA{69WI%Z;Ah9Xebf?YmlS!KPBSukGV?tKi?~NVf^=K zAO7iRrNRGzqj~;sXVb1&(>tP`m*(Yvk2w6(J;=hJrt?3PL4kkEx5R%RG@FS3n~6m9^oY8a({GS$we;+Cdf0xex zcoX5+|L1$PF3kTu+lT*M*lrvA4>+3V|8_R*iZ#8% z@R+oK|DJL9x1y-HLp3fq(P2#Q!ohl*IqY(fOYe zarnn}jPQTHSLnj{m)eK_UFgl=f56c^{@c}b^!ylgK+T5pV9*iv@$>9IQVjowKL@{G z5NXeFbo+a2{+i$Z;(zb2nMrk8^Vf`yFVy6(5kJ|1A2q;_CikZw==d*bbr)~I^<&RM zv&r=XhTj1h`!sL_cT(n7!WDj_j_2Vw8V=CUS+KeA& zIUs(61qS@5%+mUrkn@&0`k9Vme5hUxzf*Rg`U5&2*NVSr#6apC{vsPi--^ni-{3zD*&y1e`Z+}nV)hm;I{M(Qt2o<12 z(s_RfR+8vR9<3&OIHaTW{8cDLK5UAgz%N6HTl;U8_H^9E1vtNa{tt1KXGUq-6@W)i z)9W6#r2zZ8hv=3VL~f*_5QX={#UK0qh}M2T;2nwwi2Z({F^1Uh2Q0wp_IUsPcmMkV z_Y(vOXNoy;1pjy_k;FeKAO!d)$s^Y`{^_`jRGQ_V;wz&36GSRXtqbx`Cqr}&=hbzE z=EgXPn&+REelMT}{y|U}{a(Ou^w1jrbnfp3^d|@s_(w*L;GbMdB=HXveBz%Zk7C>S zr{gYmYLbJ2lFre#jek1sqPb@ICmkcv`R7)o+QdJd z4ADZ0wGxpx?~3@V3-M1&zX#9){~)NGeh=V%gdw%YKb`w~0Iw1R3G!!KG&Cwei6s89 z>im=B(QO<5blk<4&GJt1i3{p{!Zk~Tyy5GMA z{=uPDy5IjSqLEtTpU%DC{}4ftz(3uh(O@P$8jN(Z*zWQ1;Tak)V>w^5#$q+3>7?lpuyCR_KLi$fj_xZQLKR6dn_xZmM3wdk&({YoexiiwQ z5(EkSvkf^y{sbtIB!A#wC;mx_XlNV%beteE`(7eu5x@e>ie<{f81s{L_3yM%(zO;}p4O z`KK7(a(%W3k!lnFbTUNeVgXh9dHf6V&sl?ilJ4tofq!tWo9^o$jviX$pN`ukG{-;v z34#Rvk&&b8Ka@z~A7qjINs1_G8~=3NMzUG{nE>9_`Dcj;ziNa2)5#F6hqTrqI)hY{ zqnp=%O!Wr;B;C*70{`ILINi^G7WzbM{L^tpisty|5J8Z@Kiwz@jP77EQ6hxeWh1hNA5WOn`sxByhY7G8Kx{tpF{=vC)x{v>T z?1x+9pN=zxr)~Vxafb9}`KKJVDV?f0FLkZ=Qet zf4*P8Xkr`UyQaq%YKkvlId!gKh@f))glY2ZYKf^qbDnpb>xWGJ-0Zp%(MV>ev|7Ty zF%gHfx)c`$jJn!V=-Ph@*Oxm@h|}8C)EMG<9Cxv`le2E$xuPsD!!gM*5%FVt?_}CY z#_L&KnEsa5<7GE1ZRp9eO4&oDp4-hPmK9{?b5CB2_%AhVW`$cRbN(q-cy19A3$JME zf)#!tDyXF>CcZ8@&Ug)5XI*gW=SS||%~;*%^iI8$Hg;!O8~G#~d#ECv_TyRm*g9UM z|3`(IikiPdX)8)IzvaIf-_QJyTUhC_E_{-Ots5x6Xs7>KR=tRAi?6u5QLnTY{Duz7 zS=LrxtyJ_4W-@nYZ1@K$RPXiJ|A*Nly6^u3d+*qfccwgY%O}@_=V8W(_%>d~_)bjl z6joQw@S+3WMQ^o2@u%GkkO(XfnkJz6IaV4PDFb)v7iO8CRwQ|!%xmS+vm@ow#*}=& zBckvltn~9+P^qt4l}b>F8XHkvMlXKL4UBI@Pc{s?i;`6(^S$|5pN;oF@;8(CBbR=b zlArZOK0lMskLL5uG7#tQ?U74QjLbKmp`P;jR^+^xZ~i==f5u9WSO~YJUyNi~HL`i5 z!UO1Mtba%f<3Q}WF6aj#f8}!4UWIQ&hhjK1q|z#joV8UUf?-VNElSo=x%4$;^%D6et2A@N*Xy4+!BYd5i>J z>ERS5XO}xmj4A6YqKDstt2Fe{5Pa%6GrKgv>dKjwYOtJA$=@6O`IjuMk3^XNSM=a{ zz1eb>Q|`K)1p@)ZjLry}#({^j15@vH+~c^{ai92ofb0N9$MgHSe@gJJi*XWI*FWTD z#v1_!<`XeIKrPonwRlRsVs6lss{kzTh9s@NeC@l?0s{_D}iJ6JVir3M0oB7`{ zW&VAfNm?_eFUu)g_&q%r0zq11xeGaqPGRcuN$H{&%tW4_76-HkO_j{?dsj6=f17%ug`uq`-o^u#E#g55qU;pc0f8@B!F-hj%2zhblPF8q)5GrY19hy6x z@rm{c+9FGymS@YKo}b2@cBezj%fxdiuc-_3n$r6IeE05#tWtk(nV0dCrAJb-cFWTz z_2xTEzvvJ8EobI(861x)w(NjIJ(B7k#WcLcAym5uuOtu-h$(13NOMD5m z0*qEl-fN+7`+NVyywBhJE#^-H`bydK3Sh7ZT}f-a0)J}A%$6%=OmL??gZi7mG=#=F z?UZ)<0#ea+Xhy9c#)3|J`Y>P#&zba;o*RNM3c-{eSl8cIeLKG7;)6-ykJzUv{NIqD zDftL|T^hi!3oC&wv}-{HOWo)E05DS8n3}Z_j0wKX+Ju}?e~7|zz7N>U#4O1=$v2^f zU7jA0d4PZ##HI%s$Nx_IV1?p$Lu0@gU=9nos<(%wPPAwEotK__50IGzO7SUI_FIU5 zd;}Y2v*1BYD>~hv7pij`w+;}yxou9QMpZ|Njzh5OVFy5c`Z)N)3{qW@Z zS^rj26?=wk-aQViYhXGam5P~gAD_dfU&J&87^J!0+lD%rqFbd`N+Iw^4&Cj(hSBm< zi-EBc2o?Ho5%b>_VH>_N-d26Xa?Y)aFlqcoIVT`_8&NhtXS3uhgosjx=`;cU@TM&l zB=A+tzsd=`4bAgaN<|MqGk0R3L&1H^O7rON#-Y06!=1%*@{At99G5x2cW8rKP1P=)797&t%j0Q2CsV{6Mbs@>U={cj#8h zJDTV@y%f_6pQKkdmWKNe-7a~rp=^UEnmFNoy9Yf9W{|wy1Sja@Vg?X0p9Jn$YF~+B zNF%y^seP56PN#HvN+s%skb2(?fQU(V=cP1%<>b~xv7U>^Oh@zpI*B(GA zK|S0IB`w`Ve>N7~W1lwkpya(8Wl35MAeLAF!bhZ{OOOVk9q-S+rkfB-L#wkyd*-hl z&`aDuR`_R5ZH7J9QMj3kI1102Hup@IyqwsFe{!pTxZTO|y{^)+o`973aZnzDP0(IY zJ`Bq5bp4I-rS@W!AkI=9( zi4uu~@$9JF5fyl8v`!J#nMHMko{TjoJ0K1yEDeM=HpJqA^N<^xsNsiW<;Ap;R##xQ z~;DA(#^UBY7V~``ITzf=8;mN6&Haj}-p7 zP}VT-8O{5>uCbJ*&-p59b9X(%e!{O)MF>qy`w*r*^Y?=){o6RUcmG}HA2D8C{U^PD z<~spoKO%X*0+-OV@P#SCb*P$|I^k{jF329f4cw(*uFfW9^Ha%t3*NIUu^FjORro2f znShQdz&()yik$>eg%8S=Rp*JS)%pCi%s;OFJ1dEbBp~0+)?wWApGP2H z*&S9%uwb3>{*OptATJ0}bI*C?2+zj{$K)o}k@Ut4&^J`K_nQb*L=&lxx_YTSZRn4a zNPiq|=#PVw^+$`$|Akplm6BB|PtP;-$1`mD31$w-nA_Z9C;jnosymly7JIz<*bgdB zTeZiCwe8wtIVnI`ldLJ94ZunVg$KfHIEiC(lk#XYl*cK$@<`@jMe7Y%h3-gVYJwv6 z+|U`fLEFhb5vMg~fN?Tf*BbjZX^lghv_?$RsMa`0;pNR~jp^;z8gt{dM(iM=I@2HM zbV6mE7QPOwqsv#)8?QI?##PA8J|S3|ibG#U9cYZX(y}eYwfbtZz&?IDZ~j_T z80n_brgiAT3S$^$g~C{b`KJs6Y9;T}NJ1qd#7DKo!9rVf8rtIEByCZlx>$537}{bk zX^TwAygnI62AI$oQ3=c6aM$A?%9Qhz#oZxphb=mJ;hhx;V&TtYdoGxS4(3~PnF8@2>6v22Ek0}Dls5V}YcV|#1F znA~qdt<2|NR{uG=4z*D~ybSb->W71&UD4Z!vxFbLrW1YG;Gq4(Wq7jFj}jDfA4dV)ahe2eH?N zCKe7g^+Wm~>1@#@0$dMny~a*@*>U8PZs@_2Xg>IS#gJv4$tq=j*9lWpLBz`$6SPE9 z=!EUT(B{&cY!IXlX2vwe57D}zF&;ot*BF~L#0*0#94fTIe(lf(1()dBAoj^g+Tis< z8}!nIZ%rE{G$e=(&=gyY(3K|y!-=(H7Zm{xr-iQvaX??v2R+D)>4SOM5zyeCYQ%Ao z-CX8};`Bkq+!)md6`1*=EFRMbsU^rpd`r{^DL?e<;{p!%8_)<9{&n>qX`W#V3T)q# ztPe(8HYSh4bt;D@p^b15EG6h2{yBJv(Ow?A6H;h@8m|$4!r~R#gA9u7blSb?8ljj6 zB%IC~!U-$&0VcFq*}Pf7mTy|BxyoQ;c}6HQusV2Fq+u3 zBMzSy@}uQ2nJ%LH@flk0fgeJksEsCGzA)v~Cbu+0vkWXp7KB58ll#Ql9|DQIOtSha z7~kstXa*l5KI{ICI~o5P?u&I`6q7d2=F~=~NvoIihO|<&@q=MFmR8qz15(~Trp?I+ z-8bkQq~7Svsi^El4VafEL(R33jtbl6oj6E8pYfZd)r+YG21$*bnqnWSR=uj0WftkV z+Ts%W2=Kh)pwKWs!@83T?T6MoY(EEthafvD&sEHOd?$MvjEhvMFTU1#sDo+lDl!%g zW!x;SE*4$-pF~3o?78ZZSJmyAMS7;@iS<}YUB~qZnHO+h8U8D>^?ecgnST`Qh#rO@bTjtME&&({|{wj zXoEyogQ8uj$W9pA;Pbo6Y^kg3lDf*EuC5ASg6uf?j7~E|r%)nv`jPQ2q0`LsJ56t? z)8COqi=&@S$LBN1j?vF1`okZ+Kk`u|^q1b$pW^?St);F8h^}U$9WW<`c6sZfM+QU(qTkHlm=KCM9x7hq&P)YI6jy2yW{43QA3jR6`z!=XV~%c#h=zIW+cK-K{$~T zn66yyvS-TbQRE{LJ_VZrv3VxDnoKilRXsB!5iT(D2UGrpX#RxoCjvIgLVj*EKQ}zp z$cI7=%U(2pXm}6SC2D^t< zm`qfkNIY<)hVfChAOs$Y2S@3s<+p=aMf&=;j0&rVUsbnd7KtoP(1~1%A`!kE-+|I9 zflS|e%pJUy>u;;@27C|(9?pa2ZFcf1Iq2L%y_rV)7mPH+gP$6@d1^fkk?~EE_i@DO zDtxe$bgZXrihsB$tne>jlMlUhV?)H@ciL0PK+iwMk0ERdy-azY=lWvF0eW8%%cSNb zj?vP674FNK{t^yF*DI%HBiEF-92p>RI(l|jL-&h1d7YXGJ1F`-;VF{$Dhlll3MQeEYCd9Z{{oXf+;Kk@!-a)J z^1g%_rM*m_6}@fk-9dPPg^rivrXF7{ymy;r?jerlzYgH9hzeYDqD+v&quwV546%|y$pXRyQnm#G~ciGfXisE-}1xI(sJxn%fbs=@BOAaMx zW081uAJ)2NS1SHlHlSq+nkTf-x=x_;`qFVVlg;yc zonSfj?i1R}R94}~AWuJ{kyA(r7pxun^9>CcZSTt%e{B#7W!EzQsPyOp07=hKOGj(y z_`dpxPA-Rt25|BZG6;sC;7XdPYk?Y59uLAB&IN-bbVPfZXacAOZ~A+Wmi@yw7dX@u zvm>VtH%-mSi|Nn&%y|Eh0jOpLCX!heI};nZ~MYl3gkd@kCNgBDbXF{!6WNK=Kc z(50z=3d%r+xGs*$171W;hEBr1&$JIR#pj628mdA@9)yMOZmed^|KNeCdZ3Ks{(Cn8 zhu^Rf(3KWRzJ_`N{`|$R>ZGyQahk1#!>BZ^ZIbsnD-={~WbXhI*2*n_wxy*o^!|*v zW$;TeD#0mY@$=KFrYu1ijb680`Y`WjX8uhGpZ6fY_4=CKWr@A{{r*I)>FjC zNxq8#1{jlwrF}s2gf*?4kQwo-Cev6ZVG#Yy&S3m;Y$fo7N^4>KwoImt#fQf;8J~@R z4!q;3e;k9-45fwi;Ce4PKI&5Po&*gb`RFD5=enpJiXoVa8`CNnI`;=iLRuBnK!3n0 zqz^GOLOr=rZLn$t%MJSWt)ZV2j!qgG}-ZQ||dmT<_qmeo$jqbAz8Hhz- z(x~$6Z3vgNFzHQWp>X!S0s#QAff>qB=*w>BBA%g81$UwqnFqtq)JB2t9Rr@alf3tW zIh|UcJdJ>_kbId2@X!7}4tOz8F@QH|Fk%3&(9|hFDS&)c3}oPN3Jn8be-D`ejs`)% zkKPEM4S_Dk%=}LC6*L-yh*8LIG$8lU&6~#5k-V4U#jr!vT1zWv_IMYZp;hJFhUI@B z2R$OBJajG+o{2o8Ty`K#dK)$yUf@6|#5O{S?<>48E|48s0t*h<3ITeH1(l*SX#8g0 z1`(p97xVlsMxXFhG`e;+^;v=5vm>Da_tQkxH7d14=;YAKfbX@rtHznuH2|OMC!+j@ z;y1^cLhj5uKb9~Nd}zlMKf@Q$bc@m7>3 zv8C@Ecv<*K08(pxyd3=GcF-;)Ng9hyN$3Va;HN$M1jd?chzyt;zQX#pX%dk4B~tNN z_+m-3SV-5gu%h5xr22WW$KUE z%NP9*B+jsx2cv(<_ws2h3_?*R9pibtLBoRjMe`gRQQEnawwljj8u^bQ(qwpY2F_}GvR7nteA z^#rJP2R7Lj=+_fw%Vc=NJBhH;a3(^6WN4<_6%9EPVGZLuil+goWjouBS&AB#dP1LQ!g;`1a9x8Z%SI1hkYvM!fF&`T2|ICcof4~z;{SnRBzzjGGL=!Od310&Om1vXU z8j}yA$}*&B>L~0>@35#xBu`^^$@?-I)%tw6V*oti?o`H8VQUi(0S`XF-5Ur$2+Bp* zKiqR$LH-&%SI-Dq2I3+)VL4h4jnot-8Y_sy`OVsyv}lb--uj71ZJ19S8Mw3#!equ0 zy_Q;^BKht`g&9m6K9KlCI4y9Xqu;9S>kIKNS;HgnJyIUN2Y;~yW4)uW>qf^!1o;c^ z#2}_E859)=^MM~6EZ}P^P-#o222ag~Slq5QYp?hkmwKy90whN-h2(9pa%p45$hr1?; z#-*ZXgT|K-jq_wJLs~t`!cu=~Q>&!m-CdJ3>zQpJZ@`VE?Oqf1H+1JSmd1}2{$=PF zbe9_@tGaoRZei8q_$#Z|5uJ(tVlSyp0oUYO_F)_rg;65^O)iql)VsBq~Uv%A5SG5=gGx+9^#OHIVQ^d z!%6(iordjJc*Vxs)H0i4y8P1uRTcSI`5fd!p9*df5O|ihBXQA#fRvf>gwm zeGaXke;Fxf+DkU@08OWxQH?zCOuLK_tusw171c7atSNriCY!FGMJr!S7J4P;l>0=~ zjxF%a)c2@KliM51_QJ2XQz$`SE*fB3pP&TQWCu3iSznY7V6>S3(!x%9ZBZqF{o{0J4{y9uZw0=PgukK2GfH-&c z>xgR*7GT;2^MjbQ<+Z{RZgU?|co<=K{EHC9)l}~x{STLBM@Ix>eYB)CM2as9S`P#V zVALj4^$YO)x?afF7TM&|FH^Bya(Qd51MxM*eKlE8Qb*ey{>c%=zn~nF7yB`T7zRGS zcApSZhvdHJ7F~BNS$H1WHf#mbpg2ByFI1+Laq9ujd%=02`#Z5VoC0d5hyyYF=~axo z1B_2v!T5tKCGQUiO*lh=jVq$RbsLkkdK=F#iS9ng%Jg7ah;N2DCclJY>ho5S6)Eqx z4!+arzuOEWMD-Y5j^$zU4RZ(b_@R7$Qu3Ap6-=8Hz^1w^yVl9?U8V565+w`2f;)UR zGgpL$pi!rWY%QOZT__-nY*(gD8N_lnxnEV^`w!?8as9V8 z>9>xY{k(k6vqVP+-#p%bO;x^@50UeNuxLQ+f3G?t=AYdN`_w7d7^dAoYWtTcMb-`Q zyyTOB0u0EJ6MSM#;sAUj!Fx=5aAlI2gXb^jrFs0IGphl+k#Y>o6SZ72U{2waiZIY( zJXeJZt7;+L?gdLex@|U}E#`zcANQf#K=f^L8qPgX$?vYma z=lR87&c?YtfPD-@58>4AEu(hP zq=1O$uR;Xyok0H_LjPxnYC%&05_%{q7{$}3i+E1vf5N7H4@OY65xd|+U~UJm!0Xsy z{r0)5AutRS!#+WbFOVvEKch74!*b3^cXjwLc#F!jM1E9{&%|CR<9W?(Vp0}cevPp<_-H?kc5?y&KG@&ck5Fe{gFE{a> zxzf@gD?OUZhPjL9-hj+vvJHy%$6WCqEy>xCMebr&cSMN%Fw+50=zWqmX>{ z=m^1#sE5t0_H;@0#Z40opUIExx|ZeS4sxH&*)1)Opdilm6cc}{o^Sz@w zbO2ssPM!(q(}y1r6LKZU?(mN@g8`~<*7XV;YRqv5Fhj+BBnxEId;~MZO~t>UE${-S z95IzX0f#zq<#>UUrz5KbOas*PXTzora{oCx4`0#TD`Dj2HFK8I9FEf4!MBX}+e7(U znmukl_O0%hI3FeN0HDH{lhyHaay#;kIr%okOxz%R!}K{>RNXb0_XaV6K3YjhW zR^WvQo}*~fAdpmH2ud9Ql^UlvKTq{lIQ_qfxO-GzYUp!(zY_{wr1ysq{Uqq!Cs1jn z(MUJ3uBN6&%4v6}zAl(0Kj)0(n?YkMd~^lzKT{uFZkD(WmWL$qgVmLqGPwe^*4+Vu z&rAD5#J52UKuV=pHXkr^{{sBQ z?&TxGg#sC@=;Ey`)U%ST>Um`lm#bvn&#pk$YNEJP6Lm>uGL(qQ%nUI@c7_iD9A?IN zFt+e%vcy1u!v1s_&-XYX%^^I;k?;(?evpLnq*ZXm7L4J&9~Mzt`am|t26Bv4n&0(= z87V=W+A)3y-=mAuj}yh|#e$BsMoC@@TWAueU&Js)9x@$Mr>KKmbfC-Ed>+J-&-YQ3 zlg$4~aZWR9t#7U$U`m&@+?j|Gn2jdkg(t)*+Dv!|Ct#k*+LD=3re8w|D8(Yo>jk{X zsr?JoVP^Lg&YU?m$xGX4ZFD+KFTu^`P4v}uWNY3_IH)=d4(pe)x2>bw#vsL4{0x+2 z{(D!1`hD;<6mx{A=dDEks<}jA<|pfDz^VABXBfIh%;Q2Kwg?A74GI9c;@`FK>wMxq z{vH4_g-MDTas+W;uzqMmQWf(Tq5ncL0Oq@g@RsP8(DKvCpz;UQ*Ot-fvjfm}55mky z7(o*Xlp%t+h#&@pztW$9?RSq8>rm)_o~@5;5V?F)$d4E1zb93K`8MPcFV58dG*TJ} z1~dplx`n~qe!v(^cBQP%i%r;ruJg1zsGsZJ0vs@-D&x+_akPBB(umj12tkdx$8mkRK1Y%G|z(Z)^eyBL=*;M!E;UA(? z8A4Ik*x;zqGcxCVbDs{L%ujAG0W@qxpvC_A4wye@k+@3)-j5L)^bvHy>K)7zl!+fm z$@v4Z{%;5J?mjUPD+clc;AmR!6ZIFwA{HJmA|BUnoypx^KFK3ij7PAX2+^+nN=zu8 zSH!d>Q)o)*j(LxiQIkfRMMH@YcrREnov`er>K>%io zXC&r-zN2NnK_QxlD0sixwJHY6Qq1YppJ z^}BWjxOH6>YU`8lAWgmvUF#?UhOE7skL;kNC=4>zczvHKj-yYo=tdMr&W9NC5p4p+ zu6&l~`_#!pZYfD(kwbDlSyY^G)%iyW`y%5&G-RLmMZr5SmEqy!e;|jPZqs{du;9RD zLK^^fo)A{R)L~G~iUj{?lWn+Dp&FrA+od&6bm1op$bjdR)@;km`RClhcoq~MHF=zf z^MGYgT0O6-Hl81(9#3e(pkPQRYg4-SZw1e-(sbz`ww@jOw z(d}PYlwDV6Z>v?sAl*3UcF4&;cOuy39-*pC&A{=T0FHx;qVBz9tpLKrMHZXT)R&k% zy1y?`o)sQnE?DUDK5GU5S=uV`rmmoe5s<@5593mS-E_f1PMM^>VWsIYa9|;{%wP~K z59hDEmY!fqlPqFTD3#AYks=^t1KJ|r3D~IY7LlBQWG3bq=_lOp!JEQ;MR>5?p`dRX694t+tjB`B z8AuT>P z3ZoL%jpayg_5F!5AjY=({*2U|kl9-gU2ep|cQ7C_Bt=4Bs-&GbQwPBp5;fxZ@1aP* zPhj&s6xy{5+OdDW8SBAT)AgYMy{^A*_7k%T9(v@#t+_VSy464dL!#>UR9KJWbbN3S zQ^Uz4Gn`sxsDU>Eig$A%Th|q%5t4K776Nh@;dm*60mY$ts0B69eUgM@abcs$lx~t1 zUt=L!{q=R?fb=M>n90-|h$mVh+Z-M*3=x1P4w3*MAuz&Ef=&f6sJu&5hWxI=Bj5Z5 zg9y)-5isT@Yc^oU!BfDi^?c%O!t=rPgWrbkg$Y9Dx7z?=_--_W@82UUo!Gj=#_$@W zM*R-h7W}!CtV4*z_T0g>@%#AKsOQj+-onrkU5a#e1^Q!k|E3#>uB;6ezk`l}d-rAG zspwFjN5*9}>QIa1Q)r%Q*5ywFGJPCWAO3RX%CABjeR^%zKQSbjSwvX@S6=qE>_{H3 z7yg%ZU}|txZK$GHFAshrxG;V}8;rk*#_tzsQa>OxVV*siJKlfK^%mJb+M@8w@A@m@ z#<~a($w!M5@Hq_ygAR(*AuwVxaYrVSG)s_+l~k}k zl7o?4q2~^D1V^7G-a~8>QCg^ih^i78=K@T{{AK9QVL&T+<`7k9{nK9vL;5%P(NRnC zUI~O~eICJ=p!KKtOaH<6G036yK#dv5$=N+8)uCMsQz7r;#k=cv2*no>6ZTR)E;-Zn zBdzBT@CAkp#Xq(lK`6cbPa+QVixk;Er}UTwLP^Pirh%Kh*7Sm5WxTC` z_j1EeGveUN0Va6N%qBVOY<|vXa|TlcMU|k9Tz7_zAYO)JY+eSE08v_e5`SU&Fq1K> zu9i+kH;M?_Na%XRHUzDop+Uk=IB*td43?5Wg4=_FbasW;QgGY{r)j0qIVt?0C>02x zl;eY*U~Z-fE(t62!T&DN5j92R4Y--uz`%BB*ACiu8Hja{(;U5_$-(*gWCrRHY1a(` z9HEu*#VC#eU)((%+UTdEt7-iU{}OLxe=nh7;6Ia` zvw7|SVW6)90!qWUHRvSdMs@{RgUop0rQxt>Qhcwn0gKfi^FF`)GiZUSiCd*$N`qMe z(T8Gal+lHm;oi0QAVGj^F#$w~A%LQ}vCrQa5p#b1Odtpof6}ezA{!Rb;CkHG7>V;w zI5q1-=!i~fdQXXo(5K-~#30rqcnHrZ%i1pv+mCLbOS^Jvq{Xx&(0aaw0*cnBk%}Xl za3b3ink4(L8Fi<$CQq24ZdSCO|D>;^^dp2G(UwrxavJpWsnVL6wgMa$^Z7-$`iFZd z?Vky?{qldHre=K~f5FoTBlNBS_&L^xks&Q!iZoh(3@?giU4w_%aaY@hS;yjK&O9K; zBWn{qHrOq(Ud~X53$LHaWv-D*tyiFoQyX|c9&jz5mT^n~=blc(68J}$6?qvFD-5U= zo{1^&15ANwm;&A78;Xc_U>`;^0!DWs4V_{*eRNt;xE6VNd=-aOnu;Flaj>F3$NK7P z=)ZLCFA~cDzJ>I`X+Mi%I2M=2nbv0yvJit^K*v@Hzy99OAmV{oBh~s}_{L!Slg z{>&d^WDVQ#C8n?C)749T747@jm+!2H7j--SEZ9|po9gQRjevBQ1kDVt=LLOTm&&_C z)pz1gJ}<|GN6ar$hE$uwrj+?> z^=3r<$q?gvF$*q1Jx1j(VQK~5@e>|&0u;DAz%DAkmyQ_1f3I#`gbjS@k^Z^T>e|wy zm%ygF$kgqtZW|F)arTsy4u*^K=;FMx*0rE;Ya|tS_Khq&8liI>rALQAhe1qR_W*E3C9fdo^Z1RAdtKa9-v0?+-H@-gO#_O#G9cLR+`80aIn^HF?@Okg+;0DO4> zdN$MErvBB(EM_-?WyaX>Vp2zxV4XL)delUENxmb~TQ(fGvDK%EacIP6rm;h)lXOk;oCg1L@EU zx7Ja!=nm?N8yee71hqEGf`C2WHa^zk?uSE22Jl~Fkua(D=VX^DNv<>F_)fr2bo?pJv2;>WSW&|K{i?x#?5&Ut@eQ&sMj!=8MP% z_h>S>X_GSw$?xFVz-z~XvON_b6KnSfJizY=&#cFi-Sq|R&~OY0=Bsz|u@~XsSK{nV zA_iprOSBVk){HfUYR}X{c_%HT7B<^K&}d@#QjZV9nH@VvaMyCc%Qs z0<{0f#gcUgHi_|Tlc6ch!#o`sdY>c?ADuDPkSBMN)&%ZA>==d(z`!`e?To-}^0o4# z8`2$U|IPl?z8lUj+*qSm#BM3(l0}>q%!ecx5l>ZF{V_fD{>MY;H^DHIjt_`a+6Be2 z{&PkD3+%R2(n4IRARv(XiWKBPfwTxAOVLk?-6lSX+{`8b{4RU?hGK%$szZ7uK{~iO zNOJ|G1;v1~s>#|5`OF(}Eh$)uMAh0%!VN!`9XNZ6y$+?Up!gXZF6SLol$Q1kGuM{l zY?w%m-Gb|NP_eU%e zF#a#xOi*N3*tWrqw^87gX}?@aKwWK3c?J4h&*LwHVX?=-?SphRA8st*8)1&cdpcsu zOYsj^{e~cB%h@pNArzhiS<~kz5(TPdlzCH={i*PH88u8cWBoem5gSm-1aZpvUI+h| z>jwA_0#%Rbo8OQMdkcxX*9C;@GwH)+Xdv|YlCOygi-f5X6v>o#A72;y%=qOGp;?6w zyaNx$uN{VmlV5A6H{79-Sv5*F1-;^8K(v-ld4n*&v5~=P+-PEGG?5!kuxMgJG%+Qb zm=;aUj3&rIA{r!27yQh08{8s_`^#} zaz|k;=SP1nwhna-xU>@sF{T2hKOF_eR0C_TBb*8uGuVPQ3O5rO4AUL>6LWdQPku|n z^3w$Tr=l=c?CX))gxsLjMn&;oXgUB(Y)t4YVjETc>zID2S-<-I022uVuc$}!74`wr z448J4qTPze$1=jQanHtf~iwu2*vJ>5d#h4X;d1L_0Reiz7xMHm7eh?fK zeBl5YO<=1(Df_tq2K2Kb+z<^3z@o6=g2-c`+W|{>7Py7vUQ<}4`^OG-7wjJ*<~3m? z)$bF1!;?@2j|cE5C`NFouqW}n70jRKK~*bxz!d)IDkqLg!EaX3<}X5B7`lrQ ztiOD1ZXQ+{Ba$Zc?DgkhyW5-)rs}@z0?~-@dlys0+ztGeXazqics`)vf>>K|;0jjFy9dG!%EM$fLD0;x z&|j{>3K`{RnU>JwgR%p8(rV1N?Fx7n+>{1tn~=3#-21--FSuNtnek^MN z<2G>Y2hC-9-U?R%6@c1KTkmp|xeH~OIFT<3Y;)xq8{B+9v*KH>HP0Jx4WLXJdtlid zz^&W^(GjkS4rM3;Al&pGaDPN$7_jy0^N;bvu+4{8La$!Y}D| zk&>(MDp}bGa}8Qi|Mo#+Bu-tR^{k$3KigvMW6vwCo(~c=sz(;FJxA2iu5!0>L~6|c zRBaeJ?|bU8Tvty+y~AgGQ+Ssq`GEP2B}Rl8;?ncDcmsx;>{+ldlMqWFsjKjpVwbfS z14!Yp2E!*>r{vUSBuZi8msE`s{(H+5|A-&_JO!+TfL_EBaFV&qfvuOk zrwSNUx^2a!{qv8Y-*@c7?W;yEn&&6OpJF~1ywyfn!NoISQoZ$kBj8jUE}C~O{420V z9dHDlX+p$>C!z=%lf3UiRdaY6aA)gVNQG_~PN$L%gon^~X|>lr8;v?V^%2*ndA!u2 z9-fWDnUeQLG&6TS(z%lNa-@;M^;?hWjSY6M$=8+ z74zYsLl8sZ-NK&>^B>x5c7DXSTO-=ln|lYfaI?E*bkJ$hDfaugc8EXDhbz9mE51H7 zVN>{lHr5Y6MWiQauBdLdXg4upS>a@mn6JlPGrmvKwh zV9{fgRxQzA$8$bl8HDl@z2qERrPx4lUiW|T|h!K}@b-WOQ z(wq5Z(9Txs4E7Y7R&c_n^eE=xQJ67^E{yjIKY$Ny;R9$2B~83Q{jLi2L!XHAEQ_a= zkTe1S#Oaav7sL>^0K_0(6*^L{*93s8Vl`r=ccR@k0v@wyj-#XA2i|aXzJVG zkGA1I9V5B`{=cTr@%X3y2>*nMHsSw#{(?mK-|^R6^wr6Dy;zL1RE8h*Jdt0AGmuSE zzzN_lAg}YeuN>nGZ=_1vY+44pVQYk=`+aF$rW<`F=MJbCP~)CVWm>nWsu3{&-z~yrw^1)gQmsA1~<-zy4UFKMM87Q~JZLKW6EVhv)&-SC@Z|$?H5M zO>r!WLR}HzQ3sV2KUtz4XSg&S*3Ge4Q*&#B2;H8dr{E|rK#K3q4wQydYd2b8%W-uN zLh~W=2Q9T5Q(WC?pB+po;J2PrkC^x8==l(C8s8_<80ULjJbN;^&Z`5Fo` z3(!aZJHl)sY%%@?>54V^n$i7>k^>MfTs@jrKCv zK7ddQ&(qx=gy$p`zR?>o!SHTNm6kLDU?McOHiB=1ST`nv`sFb_iFMoRt(gBAo#IE! za2VMKhtASDbRHmc!(hQCaBkuwwTb4}Lj>sU;dU>x1G}DP8id~U?o8C#>U$i2Bhu#-#5Zl!r(Bv@|5Hww*`PAClOVg^YZLP%%@xpLOv>rr6 zMNvUT-8CZAD#SCt*E8>VXLmzD+xqM0`^RTtGVeK_nP;AvdFGjCt~UNojdZN~5dl-9 zN?II^8^Occk00?eI}7WdtO4Hej8t{sVvXN9eN@x??&fpOWoq)I)RIMt2NeE2r1*=< zv5LQn6gR66NO76^Nc3KqsmUM|aI9L0w_W<>W1Y=I?pY*L1Kt>jx|T&pYrZ9?4&#t% z>c5P&-rLaY4gQ9)a-##3O^KjZ72j<0oJ2IYBLl5h#;R^t^Wc6fP{j{W@;n!gfp_3N zk&clcRL`ShwNQ3d=k-ZWN27@H&h_o`PP$BblP;&f?-S|ScU>!9&gKUsetTmINeR{1 z3?zb_boKTOC2zE643mKN43P<_?+rW{)t)g)IoRda#16ma2X0V7%@W1gJS(m}!)b*R zQ#udOrIrVKFL)rS`2jV7WLucPHP1?HZLeK_sQhVdN zo+w+|8=ujRcD1Y%giJ)CQVm$E1(wp@=nnTw8yDMT(MvTESXvz+ooR=fmc5l}}! zo0UpdPe4AN9hT<;6}5S{<;r(nyHUy@?=r=2fM+%}@5kBR7z1t!JuX1Pmfdeyv4rUk zA8;b<%lz3^2>y<`sIg9B{RwZ2zsTcca-~rU*q~!^%JH_)Yp9*g zS4V8=Z#-~~8d6sM712!PD+6wOzlM((GUj|sSQMOwuoi1rk;`ZpSpqlUrTJ@fN(|bp zF1Ogen809Kt+adLJc^>ic>>phy^fE+GzG5vJ`dx8Ec_j5(!umq=JiUFi= zvbujFyM3kmr;`q1dMoKUn>MBT`m5WU0&Yh-SAlXEcOU$;f0VyoE_|krf={%;{1LAt z{eEmfwge%Iep(!IA`YQK3KfT*MH~_>tu=DVHPBGLY3K<5OWeWi^f8?IhH`F5szVkP zoQ0BnRA4IK988hVaeO)+QMsx!R5FUqqD2Lcl4^qI8i5p??xyyVmcZ>)H0r|v!XO*v z9T}wGz^}1s$6?~wm+&@Wz*6ghD~KQtX&QkF9Q7B(I2u`V@2AnqJ99O!XYLNcr|0+(6 zLr|r&QTPu6wS`}FKo*92(2WjUgtJ9S>sExwzy(s#*7~`K+_tx@N7?eI)3M$T=ofH= z#9tfq?xJSx__D?!>rm;<7b56&o#rZhi8i-A(Xr})V7xk)zxbc&Sapo`^)ohVSzo53 zaSV{ogWOBQy;~|#IWn3O0RXbaF$9Kb0xwl5j#kj34ZIrSSlYl*mLJm3o2u2_A!7rn zWVxHO5KSBer#Ed>H)uv&-I$d>ZLZB*-Pjdo~l3q2I5C6hZs(m(m)z5L$91@{jH0ONVoc0Y(oCU)|P9UdmPNa>{ zbA0aYiEwegn$ou?vP4b*P2taQS-boVUqv`>I!e;X>26N@R<7;84PZ$DU_j)L+k&eB zuKDr~Y1X8Yjf?dH$5UB6ca$C*8OXt-McV5+KBTicxLSdZ9Vw4~G_2g7Xix-#SpNu| zg{|6y%Kv&?H1Kaz8~i6*y_~i+)K$oKS2vwq3gozcF_Dnk+vXHTt?d6dG71foI%FU=9nJR=j`X84N4Etz11CvFVf1GOT!=4`H1R3Q zr;4TDq1gNXP!bwdV3PD_Uv)pII#8Ybyj7YJx`j+f#>?)AS5YiDZn#?fK<$1RH1u*# zPku7a9d12`b2WjL00~{Gfc`A(TiyI5N8=uq*r%kY-Z~lgDtl1_bMR#8!81@$u!N@! zgpK#4%rJD3UpQLKXH4K@N|5QhLyb?HBwQE=^pcs)=ZIL2)i3jRDq_*6V$+doBuBb$ zQ%B%K#3J?C6?juV556sR{gQlgW1-`3`^71bw25;78^pQ-4~eUJf@&1^$oI>;Q7KEv zuat`gVdc6}xmco7uB*jG8sn6!8W+2ulb!*Ls{*zJ@^tX&D)=IC{nE)gy#<^q?sy`r zP%f2~Ek3f>nABeloGI>}#D2RaaBP^z9a{pdo`l4>eM?|J+MpoFZ?*(>g?Ze%CGeuw z7fFMNveqYT*^M1H>2RK*>9j*sPcTuxxd#NLxr+qH(+C8l!;^-J{5C9bFU^M0PLk>$ zxC4jP&iV&#;hW*i%40PS-i?wzqWT%J4{1+!{|K;It$Qj{u0MjNW35zWOW+hinM>o6 z#P1PRy)k@R75%LxorLUv;l0@(Nh7o_aZztFAfeDiL?%grKOuR_UhtJ8hOu67VATk@ z=!miFGl1%!7;zdd*vi`8|jh>UO5B zb|j?<@vW15d-lg2UY`PWhw(i2xM%&hqo{MSb-X!x^A(I6R7IT1)ZLu$ARd{`KmUj< zcxsLH%uloX@pXF(9tLg)Fe-y+5;1rs2fauM=$y$xD~**-5!ac#Bkqe~45DKlNSN zWi=KXza!9%@zL7s67j9SP+dGno=&w1p5#-UjWFi9VQe92BRP%&jJ;w0Y1oI zRdksRgy0RCdvO1`fLvgKq|?qsvXNCy)iDt%`diz2t@1uJLd}jPPe-HZU+YE0n53c` z>T)nuH(a$WY71Gty!jLY?QY;~9`2Uw9d4tCgEcKFjvOLAXV}H_sC`AIJMy+T-~)1W zL$_}cI2yO&&h(wq`9_GmF5{8>>Rkg?w_ykRhh|6%PxQoWS!H!RQ3oSFq>rczTn+zM zrJ{-X1)6ppV#4NR}9BolE=0>J6$eGV7y)5ql z_g2i}6{eYGjoVVq%48+B=cQE$am#I>z#&;F0BTf(H2=%Un(S3PpY2myC!UD{jm_v2 zr-=aCoP2QEnTCJct!s(E#7sF2&++xipW}~Qb|b0yH*wt{^Mx(ZyT!9U`E{|jL_cR) zPg~Ygmi4G*J!n~fwX8o{*6%IrHMW~9EJvdpaX!$X7@fOm z#0bw(TN*50*Hk!3$<@11NsH!;|0q|i1<#}OxAb25`8lKqlm3gM(zTnVZuAB-t*=OJ z2v`b>N-EzP2b!;p*b-@^-oMXMd~ncB)wiYhAih$31mx^a*#1UK8E+kD^*hv%uM{(C zkK(&g4J(h2>F>#=WnUAoi^a5JxmOys(>Hh%&6z5%eG{}uyEDY33RA+mGc*+kIfdp85L@yIC5$1e3XZI<(tLgpDj2`~VBwNUbHs515 zed3bi@9#9c*w2L$K%H>x?r7*b%9GEe(mTCzZ;Q9gqPk!1>##n@?e&)+c(OgbO>+0$ zqF6qUp1R|C>zAx#q@Ao5z|AD0n3ThLNt^&>PbbwTy4)CX(d@$^NO|{NpmBH;> z9_!|azpH7F1+Vsv@AJR)0ittPbkinpNyAssybDNjnR0fPa|{8OZ?3UkZs<@2OYMG@ z{xQ=TLVz>+il+$Bw8=A9NH9$2b3FCl>7##8sGkcTP$kl(3mGt4!ZYV;zR=A7UeeOE zqx0D?{e>***eg1*_7Hzj{d(2vJg65WdA?5v6&6!B-n z%?20k$xcaYXFlVF0%(Fu35?vK(fN1P|Cs!au!_uKW(}Z`bF7WdBu^FyC&9g*RI$8A zi`Jv@WD?+BVvhMYb+|^aQrdH8q*}%7NkzJA2><8UdBeBITw@0HD}l>Nyzl^JVyYH( zkl8n#@I?OuTx?jp9DpL~umP4Nn~R5MkbzxfY+pPJ}iQ-HQ6LeW(X z_y?FRbWSd5fu*szHG?gz@N>n@Ew%^KwK$Kkv;H2ARmXUzSch%=P9|#l^SAFP{^?z3 ztuy)-?cm=0-Q3{Eu{bXW;jZd>ma3)Ss&#_Sw`u>k#)2XYWH%UE_1vBjOKz4RB6z6< zVRbpFGrj|pa^xoPLt= z439ev;bU$G+jI{>&FQNk)8~c6W9;$GqOVN1xX}Y5L)%x>!nqJtGRlU0LRUW&Qgl6= zIZh@o77ueb|FuK1Z+=oNP3pHZWfDW782eLt22_8${G$*AD4!@k zDWB+Fb@}$HqW;I_Q$<7RO~X;GMi4%10bR@#Tn$&n8mdSXf=W;Y`hb-N?{WTTX;?Dm z$I7_ofBe{k-G14%(#cu`Oo{!*(p>r~jQMXCrmy-ExkW^2)#g>*G+YyFc${TGb>tbEHm{DbC+{jFM~p4N3*oSDmT$t*f_!g7;b02?GAFHcZjK z`)0~xbsSse(2{gYy^hYkw<=$&y}FvZLz*mw%%VbtAkDwc7b0K#v0^Vm1PWKj9*52m zwj6}=U{`AQYcPV*sSRI8dy;hs?$gT-g8`)=82oze8P^xN%obDA$508jro zE>QX{IWr(P7Fy+Z7H;Cq_-0WaBkjp~vKXGvd*0r8#V=DxA}5*gPx*%MktvVlfPw-JW?3A0DL!*W_iV zU`KjJ@;9o*d)zt})NC0j#Xynl+3Q~|cNi)>)9?#Fs zQ4=VW9N35P1rQA%I&iQSvj>N}Ir^_D{m_c7r3-$J%4i*@3$*^+&8rm6(_=De)+aQ* z&ZclQxtwNv#l@k8ohu?UeM|?UMv$keWY8A3<0%2?*ZG2l4}zoKo@e1B)z2DJ7DK{I z%)i<1{to-fG6%?+h`M(>f5BOP3%=QcPgnUzS=-d$pYB2ljta;*Q>Bk#ztAuz2Z59Z z^FFwUEVWYiXfOjaRHS-}X!z5(+)(&M^K@28SvMCsvkj$L2=bC1{NfwfLLSO#S`f^j zb1El9*f3>npt@e#E&Hji@EoluO)XpfO7u$g*K`|o42vFgsUyI|+7l(`&V%Epl)t{t zinnMW`mY|hW9{652ru~TQ> zEOUgW0ISmeqiKLdlr;3bMwVMuW7Pam(g<7&U048K*9~fp#);xWb>e6o&6ipQ7P(*7 zpWR+(G<+zBB}`A|vg5E5y(8tp5@~CyT}nGW6aQGxaQ_bO5VY~fE6ck#SpMGalXLw# z5#3%b$zpkok}RCf^Xbtt*;Z%Ex$Dg=+2D_)0qvHPIeDNdJE1t_f>SBhpY{)gp*tSA z(sVV;kR~dUXBR-u~QIYWl+@2!vrzMTEDY-W=zvQg$vxm{{%JSJ5F}HPlqGR z&belEUh-@*ZSQH}O{VxvlCQYV>BxVwnKFkb3EIR9?O5)JNgj^$NC~UohFE3f6k_2#EK1S#wji%`xs!x2LLd+C;I-9Qqrrp1bGE&7B2u}m3OJ1RnYG$g^{Wl88_itdd zFExINct$gC_;`}<1ZgZeB0bYC;wTG;;N<2^HaZQXe$|;Km{v0hEdy|jYz*Pjc zSgo*)%Md-$sr8vAw>xrka`Sw~rvqTT7g-Z)nOIcT7N`xmLn}+&V8HnoCy(w)LE_{Z zt;Q|9<|Z#2N4TbB7`0JqDWK_%RNqmV%`19JceFDlis_G5VhKIsj| zsuhw6th5!{s5^&5Q2McA(Mo#`Nx|u-5SN{;Y&^;^n>LnQ`)(JPQheFP10u3Ng7mhR zj6AAq!@H3KI!aQTGR(jkc++2m+c#{U6w+GMxPX_w)gdH=+4jq-!Su8zk%u6#G@8$) zS5pmY1fa3duY0;U%Sf8>u-$nkU4jC!j7Q%7Hz<|wIJJsn_hU|YCIvpFI)uMp8Dn@( zc3Dp+%bN+@^UR~TywgUtUD^>F)`8_5nwtj4bw8dD4rI`Q$4Upzln(rXhg*v1z#sS* zPQ>e#V7F}GX=Fb5QkdOxge5#MK7Tzx1*WL7Xx*V;!l+`>C9_$YwyUXGpf>pb} z97j*Lm4!a|T4-|!>${C~REK(kD-`R-SyY70@1=i+5WGd`Yw1j7^N?cW3mj`_n)k3B zww}`7!*1$28oT3>G_&MSQrpfbXux6MaR)M?l{@LxS||7ajCa2Dk;~`qKuTN@7HM{huCivMbjf7v(){{3GakYN`Ft5}Q_jwhS?H%i5dk zy3oEl+tW-?K;e-Fr;i?*hcXQ9hCAs@$MxkxxV33QjK+V$fhE(?=p)=@sxF6=%bRBs zDL8(r{lL5Y#nJ>|`D(~ki*XvqU4avckJROEQt!~XBep^*$93LlP-(7a5pSDy%FdpD zKxwx;^dfCpUGVxEh_Ed!hF&3_AdS|Bk2v8+Db6P0J-VUCcJjCfo@~K#T)$iDjR#UQ zlfHE{{8SQ=u6beesneV{7ib&RxW#&HR%}t zYSl#5a-2*I6jO#HZ}lfI=@O2X-n387P%`V==s!vMfs&xHS_DH^)2@J5$l$A0GTbkO zDa&1k6oYNWJo!ivRo&FZS=rMJX&tYz_k;pmTWG2~bkMDGE8wbmx)`8vj()0XpZ`$~ zG(dZG{Ue2EABn``aFkTD6Ha!U6+v=ya->*?97r>%-rp&8le8&jQ^M)x+} zq>6Q)xJZiEusO7UBS|T_%-LKUL*rt1P*Xc3WSQetHDQ21#;W#{NfwH@a!v25?GT;| zV#n=er#@gk)f3Y2(T>)u@=N>Y3OUDhqEvA;SFt4iIqhFn9i*6TJ;1-Qm)&2{W2d$YzYk$Yp%ANPgct%~kbO|(}=z$w(Z?b02 zX!av%$I=MeshQlZFmGO6K*U!y;2F*u0nOISV>D{C$lb`k+}zKJwI!l+hk&L?2yH=H z5+jnU$qQGbDMTVvBuQs!loKgP(9#}TI1(;Voo)pwgj9DETkVF9C5mNNb5wh#uS!uf zM#jJL5wS{;fV*(5v9wlSI&8ctY6J|m83@I{FZ87!Bt+B;jR$5m;qZ7en?C2}T(TTG zg6uE!c@D-(1Gok~vr2}0Wk@|HW>$0h+5PBDuBNH&-kStNg_kRWLI}E2vG_oG|5fkP zck!d#Ij{!MNE=pvp&1bs3SHa~Y%s@PO z_<#8=uTl2&uYY6ywSWX{_nY!!x1>v5F`bz>LnFVGEb}%5aHeKYI?~X>13TUGBatz@;5TMeL?Q|P3p+x5^PKW zvnv$VySXJ(Hu}k)AHjTis#6$V7g;$Y=f>7gMhts}YwiiQ^kw1PL&=d%PX{U(N^E)x z^F^Q=psw@ohoHd4yIJ$;m`(HOTa|E@tIf=&F_}#zF`YkE`pG$_bIOq9@p2L3%s4K{ z5?q>woFg7h(L(@rHV>JBg%;+i1uXs9>(8mO5CZc}-J$Fz7i8JMZs!f&_kh?lPZ)Fb zML@`pI%rReQxWZ|Ad^Rk6ey#u1?epeGHm{&^J4_AK`&Rx`+iH=Q-tc8>!1(%uTpa& zYYdLULwduX*f#H2dsRP%0a{l#%j;J~PT>I-DVUnQGOLu`SFokyq+z7kXqob{1rH9Z zi9Esc4>EIBbKgY&PldY(D@ijs2PZ>nb6u3PkjU}v{^Cz0&*04Ked&z8T2p3T!j_^ci=aCL1^IxkeEq?f4G!G%HU?UA(PH-|15QEfMtFq9?1RA z@^;zpg&>77PTv$~M8KJ})p6Y{LS#nmZXVIWl@%i_|Jo}R*mm$8ccAn1*@fw>MyvZm z{BFk6>(&w=I~e7%47s+CIXZH4z}+160xn~A^9Uo8#9R>pchc5cYUA&nFJ~rw%A>2i z{87oE{umfbi7DZNTq$8%TxQd}xWMo6&nzq-5#@^5>q5|TX+iHV6h}=_w)l-sHP@iH zCQXTZZ=+)@9m0G9P&-ltG$MWxDNScmWGy!VFEyP_ONRx1EM!XhbouT6m0!RdL-nc5 zck0r8N6Cz-n!P#a9!rN%f_ILyy}wYM3+_xQnrzr;5?#@3THV#dN_e!^Gn&miCsR-U z<7?1;`l6@t?Q9x;zF5u4hH|CFEessETm_$|JSGlP){Hp0pNLU-o4$pkUUJDn9p3a6 ziv|6yd&{0m#M8fe2g43`U=x{}54R}Aq$R(AWe<8=W|;j-uAMD1TSM|?$50Tv2qAbY zoJ*j*zraH3Cwzl*gILYUZsii3r(3~GmB+*)WhtCx0^BqIJp_NSw{YIZs27T}Y^p11 z;TqXSc_ikW9A00hXfpG+-U;Lu_eWx-bM5gA29ZrUpt!zT(d|RN>DrzV&ZN>|-s1zZ zW6$PuNlS-$u3$V>53_Mk5bq!l|C@@x)59w;(RcFQd0KEhluY z;}ClzynCFaC4zEJ93#7p#}vWiJi&vAbF^A1s2^vTiR*kmgdRIXqNGy;R%&ch9Oh4X z>tJ{1ADwEy=1@WFXa2nhRC5f%2X@j?L+C5?@eY(LT(!K+c`b);0O zI?+=iStGT+!bUi)iKTtxu}W>7m$?E`q??PF8a5}|6L0prPJI3%8R}9%1Ho4+>_?8q zGU=_p;g1p|l{Fs(2oUVKK>JR7{r4eKaoya_d{YoOo#!D=o;#BU)(-CcvsM12fi-{O z93pKao3^pd`$;ed&+h}m5g04g10d?CGNa0V-85iu=!#&X}K-69_%>OE(@-zr=Ly3mPDU-YaCy~?@}O95(O$lVmVa8u8E&?~xpeXj>CU_I#dUh6?S zSr59SXFcdv3tq1Wb*|R@!(I=nh16F0`dn{1O!^!qb6h_O(A0+an8?dK4;$WK|k+M z@mI@!A%UFs%S71v%}yF)V;fAz^ZK|p+Oh|Q-a-GZ;!W2|bgYF*E{zaD%(03^99hNN zCA!{S{`*BhV6a8L;(?DX_&9{`$TT>Ep~4$6wVP{x7dTe^0kGhG9o%`ab{^3>8g_Hc zQSM9PJ{WZmKm_97$`MY-+Wu}%u?ht67hCn>V*Lvp?Q#G^4{WImciwYH;JtE0mSFCC z1Gy^+hm*Hc9jhZCuuQk&WDhP|M2hG-@E#Ji_@!fQ`G||hiR$`YWB|8ZO&_o{?b9iq z3gsPk6=8!N;TUG$F^_rGAPsFKr^4!ShI%bzf;3=t2n2l4Ij=H{9+I#A}b>dd~ zYgwQATD7?p8Euc^MJ(%S%i$-S%H5s`!}u%1MSRHmKBDOQ6cS+fSZeq7Mjm+F;=NiP zi4hLWt3Ox5NO_9sX3@$z6&K^-AF!Atxk|H6v=k}6U$inAlJ8i@BfpS$UrP99)_r`< zDdftx>5Tsf$yq+*JU95y+|NymidZY4VGsRb&Zm4_+J_8zfwNv3$@B)_-`y&Z#yq1w8fCl zwcYap1R`5SNFFqvXE?GdQVsvLoXI8DN8^aq9=#7seuzWfA)TiM>wlL#ZP_$@6XE`& zB@HMZ5Mi)hqO0lw!{L#nD?tM~8T(Vf6dmc6Xp+0h`YcHoNgp+^|GDiJzMI76ruSEc z@vBv5m7ZGd(rZT~`;-umGMF!`GK_ia0K?s$aeLXHRAlsd#lhrOV;+T~+NLi%(B&4R$p@ zDJc1$Em_M9;VRP~OE7m>#2^8gco_cfmq`@#*%xJ1W?(NqYFtCz%>;uukDv2pHwOxO z=;@1obmEz8o8QP^dHmGFb?zT?f3Gc1`C3$wee2dp$(tYGx^oEdfq}T=uOcm^`Z_>4 z0&$N-Xl$cREWyM3v|tkcJT`n@Eq{$`Ye@ccCiUwXyx(#E#Jcl|Ufwx?&kFf0Sl{|m zIj=T6dOD0#23X(mUi@hkSJ0Z|#|F%XZ{s{%U+i zId?J}82s;UlM3F+``7M9dO4;v4Xop%EX?{@G$K9BA{VV3cjT;H<3g|DYt`QyL$SK;$L zdp$|?Q?e(35>}Z?tFueQ6<@K5;O|%^li5tv+_+Hq$SLkjpBKjg&pck913)^!8W;~Q zmZQ7bFZ_GunlUWXcXeF-q_LipRlAhex6eci%aqp+@v?F6p#NMjmM8MwqbbsENIsF| z9jmHXA_``a8IpzRzo1tZr<9nRqHf*E*2GKllb`J@m6dCm;ZXH@y*Zs)$r zw{L4t`J|EU#wpV_!Oz|FzLR!Du~lX4#$VnyT}ow9q4H!+PhE?g8m#Mu3{-YqUlK%k zGozI+QMUeQy#R!`qaq?_Dp3 z&|{as1E+LKp@$kDWK;A~iyrtx4>c6nuhyykDn0E)_JRbdGM53_rbLy*;{g2`5WH0V22t>B9g!5Tw5T*rzgt*ebdGAT` zen&RKy7&rdA2h!z%8}XhvFrx~sCzS;nf|TH6-?cx_flyMeYC$k^5}d^$~>1ZO>c@K z2mAXd@2lUZycdRGbh1CW7eG zYr7wI@*dAV|E(%kx@zB!RZIGcw?pDpgvA@g_|&T}(61z3Mp(Rq^uNC24G)X=++p+m zoK5kX-jw5!KI5ryOJ4RDQ-l6C*^%x`F33RoVOSn$iRB+n6CrQ-6y>|qGY_d%_j^V% zkzw`tzEQb?EYup`g}>xhuI! zv0^#Dl>BL)>+=2T} z=P@uvhrp(1RK53xS7MOwnplg|eZoFIkY5*d{m`=+7f|88}@$3`8zdgGB_%jXh zWAYI-@j}BB>pun@2pB`S_=s#fvU8@b_tn#zkK2g^x%Y@oU7Tf4gqXld4zEeUw)tN< zCx*Ydra|^wjvt ziWT^c2;$fJPmNy|`Geon$3ap2g7}?g;djmv@ca5{3%}3A4#!WWukm}IOHfp~dg@y> zR;h1|pKg&iruNX!ET-8>i(Cg{;Fo|UenI@Mkxbj8e@4LJ=y$2cFZWRVRQejfjPHwI zR1m*>yM7Zb{O&%M9uro-yEZHQ1|I>xCnO5>`;ge-^i%0;{O%t1J?ZC33DWN~UB9g$ z2APh>GVu%2?*a?Il>{7)ey3{uh8~Kaq-FQ#=1+BGpZGoLmmb6~|8q^hYVwDE@3R^venI+mGX@dhJ_3Gk zN)+(hE_OJ6Dt(RL(jn{X(8 zDt(RL$nT5a&>()THhw7Jjk!jYJXtCw4gfRQejf#^b*y{Z=OT z(66;i)9)S-gMPyWKm3C9JI%sx6#<8%-`8yxexHfm3qMI;8K0IZ+lOSV4Sc3{PO@GB25%nMR&r#jnsD|5rE&vVR4Dr4w;^8P9GLwo% zD(t)qmD|LzibR)?t!CVwTxW9Do8^Xgu5V(bg!+>A6G{=Hamml$HcUx!0r5syII8n> z_K!7n`s9fzQHI9)Zuk&^d(Q(0c@_73bk z)r!X=rSCNVaD~`T?|x`-k-*7T&TGGsjlkaLMb=`;7pd{U`h(rFCY&N6U+I8abq6l3A+uFn%;|Q^9MI>L?RJh;4a#vf4zy7takzYQkpFlz?-#eqbo;+xu{32i303Ykp z8*c?;mv52?lH*(rb&}L-l5#g~B%>2-c{G?050Rxua(+V)IKTLNkZsd(375` zceg)9rDr`CDNTo6QaU|V=5Z=LDRbZH9TT43LI3{81-}f99}N?wGChs6OC_uZu%5Br-(yx9axko!A2}9BQb7&mcd0uF?>8a5dPzH}ja3 z&Bj<1mfbla`$6pWqU4t+!cC?m--X3`6HI57O55TW{<|Lo-K62GCG=x<4@DX9RL?S} zFX0rvWT45n=P?m1p0A= zH=FyI)iO6Ia7h4bg?qh!AlEJ3XTaxp`!jmv1afVzV}COWE|}K~;%<-Lh$TNuaT(b6 zsLW~Wm5=X9Nzwl%UTnbiMc0y+Z^%ggCOKog_p-)v4Bt-rF}rr#qZde4{QQ3r0NF-t z{g_#Gz;l?S#uho-m7fe-^Lo~Gww)`KQR_O!aHus+t?PWw(x~@bvVBw5NSls-MOoKX zQ~wRgcPJ29$azts#mPd>X8HP&TB&(d;_8)}y%QNo^h(YBtknEABrM{*VAvKl!Iojh zM*J{#gaNnUmtIy|U0$%lET}9pt81#3)D%>hp3-8oc15kHxWdfH$jY9RX%-cD3e3gj zRfS8(44hkAu%vjhL`Wzu2BgAVm{7WCVM6&LK8oc}tvR)@s;GEc^3-Jo<=*0H=ZqOM zX3;>?H0PIjO3lhDv!G^)x1zYxQ)?FK>?KQ`S7BA9N5aMkL_(>VkWgA&UM&uOHo9Ix zLPf|SLT$maVsl|hS$VNpSx`}|@*;AMc;~w3nVu>W+zZN0iDISe2CTfQpr{Wpw|EO! zi4?9kV7UO6)p|5SZax*kyp=`8HMO3qDhpN!P^+ja80o?k16y2EP^&Np!R+GNVhcKi z&K7=4h`NM8i;{L`RaHw(Z?##V&|AF1lw4FM%WKL!#R?Baaw&1Gr>M&7u~MrgHOZ=1 zy@WfdC7n+WQLQ{w1|(Kss&wrLt`ez6<#mq2rHra9E-&^J7mbmNo7gyyRW=t*ff-@zUT{h_s@T0{&X?()bKj zX$JLSNOCF(BdeyW$XnvMlxp86-sn5LT!-Ix82Dlx9&>P(`eJMk`_*dKLmIw!_!1qy?l9pw zI{eAQguBCXJG^77BSi)Jhx}`H)xQb%ujcc8<7f85=e?u9UwQWZi{-ZQ`AWl`uBc}i z8+AQcqpo3W)$TKO_)hH}q1^%P9;w}5YWFDZ9<?gEo|#*|%vD)ZWu%oB7cQ;!R+upBk&H-& z4ltd?!c-<3uvJ%)nd7N}#ZJbdps_S(QeJo#4K(n~t@6O++{KkkJf(0-JT({9LV@tC z0^#)*OV*)P)y0)0YcbfO$z~7K?740?LzZN1Ru|OP78e0J#u!^vyliaQ_`-xlJNdMN zN*PO3Lay;?3_HTWgd2+p6RfSX__=}WNz(A-ZD{M8uGIZH> zVv*0nS8%j4*MC(3AiX(H$9zJUL}o6!$=$H*w;*-vuj(>iku8Q+5Q+L+V_W z$Hr4fDKD;!i#JbCHpeAV7)4PP%}#GRBAZH1H@mpZ%(3a|V=v}smX=PgsF++^8*dHh zVQ>nMih@G3fYG@xTr?h1UWo!>Bvufe^TW{z#U~WTLMsFToi15VHmetoEL$Xnn|zL0 z!mtgk^G6n*rP|s2)a===*)x%(kdPUWRimW?OS>xYdaCGSWk|N=mIPmDbq;D$!Yhz8 zBuIFZP4}wGgrc$~WgaUd5ycj-=&6OtX57fyc$Ke?FS#l)&#bL3E-WjdAqe|eQd3OD z)F5ycR7#@}KySRHW>sgfpmsVnE2L|PBw1Tqwxp7;D#34s%D&c&t0)i&ujr68Z1~b* z#3gc;zEfOTI*$lchCx$j)M(B4Td=LcjDXiz93Ja5|S3*D>>e3Ww5L#}BPL z)j1?z$eNfqIsE@Q^xO(>xl{sO$ZjI^p&2tKhySWOz32JXDI==Sk9>^%Ceb#JctQQ(!` zH@v>>7o**42Rym*{;Q8lSoh)o41cPnDE5)zpPFkfb6)=FKi^JWzv`;(Z=Bq@=dFs1 z9^U?0d*jOu^KL6YuI-+sMOS>W_?wTPE&j=zOCyH9Uf#d3Fxm0t=R;zepD`<^{5ZDE zy(cyQm72?!{QjjqkyB@GkGk-i#v$95K0NU5FYkGHV)<#+$9JZD@x;CFmG2nu zy>wT`)*-LHd2#Yff4MjD^-+_Jw=b%{=(T4~DCl_V;m;mA{mjh|&im!9k8O3_{p7ma z*Y%5wxgk35f!7Cb84(zC|Me@Y#vbD?UGSIT1sjqRO4hcdzPYUb()zKJ2!m-+6qW;+X#@WW=Pxs#1zx>L(BTm`ySTZ>%@Zyf*6l`r2|?B4#>f`SJ!U%cqy$sXg0JKs%we0%EMyJo$1>yG4# z%`e^c)n~81d|99@?d#VoC(O8E$zMCx<-bvz5S9M^@W^xX+ynpo?8+f;O}#ui>(8nE z&Wep4w0^ZY_}P&Um(G8%vC15w96`n+;hogR}9*E^q${#54h#5`;3A2-+t6p>9;ucZ@V+*`qED$e)R3e z{$-2iFFyF(lH&Ty&nrLa!~RPvmz}cx+ufsIZo1@(H)5Zk_12QAU5|e8#lH17rLBMD z#8+-wlkdOt)mN{+<)z#2?=3|L_GDp7((BjnPAPxKA1Q zw*#{x&&$6eDs|Jo{9SW*ExBjkO_k$TtS_5!|Zzntki?!Ous| z9Q633C-ggG?5OCu>!&>SbljjPANc7d4~>qx?7>U_*!|kZaa%hc_TB#aIm7RJd*Pam zMZX^PY2nAex$`pbz*{Q%{i*+e-&}Cs(VdM;j;c9sz7c)htfy`rdd0eT?;Cypm6J|c zJNVZ(ZTsnv^{>4D$i6pMp1y16pzYgUUOoNY?f>X{@U7CyhBr=o;e_?qE*$mffp?a# zsaihskzpTP5_3cKWsdH@Pw8KB>7a;Xx^FMOx$M5hT`zYpEy&nfenQ>516x1YHsrP3 zhN#&aAB;>Y7`5b&2T#cF$edZ`+PS=P+N{f7y6??PUVXh}(5{sIQ+Ax6bKetxdiwUq z-@az+12Y5N4=0}b>61_XWaDFhPrT*9oIl+8(1_^sIv%^F|7$PA&wo4jsU@$UIp&Iz z2iMIi*xc`w(nUWTU3K>P>jypbyPF1YI%QY%CC&T#CH&v~z+#H_{2-&IhCu~MI8Uj1 z^2RT=#@OEe<81$Iv@c$3T3~9C+_R#(7=gQ2O6O__E5Cs%c(RFToi}6d?6ka`%;|G; z^0G5h)AOcZoSR{mcqeP4VU4vKn+grWU`=(t>iO15z@Cqj{>ZEiOz@GnFxg#tca1 zo@_2HuBk-hBobLwIrBI*=knH|5w5B*^74vHi)!*Lkm9`RQV~Q%@J~)Q#jYwb&(13< zC!nZC>RYF&1<@ijf;G&^itSAFgkzxLtt_rXqNK6ViqNr|(l{*vQY2b)aamJ}b(70jG0G)uhY<Mw$SWUZ1YR$!>eY2%9gm8pKMAsrzzoHICU0Z`5 z*_dn^BWvZ~CBm%n>9B#FU^^nos*Gk6qXj$P{w4#ojQBw z+|-#FM%J7h*8&4ovuMU^jj`U^nz6OSDjuuKiqf*qC@(U~y+-*0!)270p~W<6m^mLB z^AMke@`B1G)dhu1?b35swr6WQ zw!wm*{sY-Rbb3D&Uf-3@((fq0TZf<5E8ed)9c}wW9lmr`I9=Vn+)>)SLC620Y#R@| z9?sPHcr>23>HO??-$j@I3lFcy|CAp8ZMxg-)zH6)frFxk933;j7&vI~kfR;3kx|k8 zkBS*E;3WPyw4=Lwu>MkE5^jSVM@96DiHvf@4mkF>p~s(a;xL^|?8&5cjCL5tN%~7= zA=z;4f|bOAj2UrY$bo~_@4(6N3CDhW^nrsTx}*C`oWX;5*3=2ae z(&!fv9jSi(A|fJ<*kg_j{v@XL>-QbMff63w?`TKwc!R|wvbXP%-9y5HqrzPOJC2Bc zQeA_p%MmonlZ{I2qc*vRJbVnnjsVNX`PmeNrU{7dfaYYr&a}@>E!C+)B7Ss#J))tqSj3uPjaJ!}>hl`w+ zmy?^0aw^Y~c08UH#&TJ|tg5aBFT^vCw^mTe%ai5S!eySkYEefQh)g8EJlC8&1(2r} zs!PhNmRkYe^KbS0DJo`un`Q4;r@IZqY@VU~*Zjn?Q#M=Su`gS8>srfh`Np!VcUboR zjh4Np(SqCkiskOus_hpnd-oR0Zqxp22BsSFYty!Je2+i9@n7>~ih}z88~;{ajvpNV zHUA#|`!zj(DEgmMSV*TWDP+Hfr)qg&UM1T`s#QxIXZuzx4)e7tOWLFKF=@kjC9;}h z`5*4DU4Q#^JKU|?(e8tq4g;)qVZ3U&Q(m;}HM+cqw7(Cn@DA^PxBc1pr@Ue1e>nWB zJFIX+_lw^6@7C?=yYT;^+na{OiQ2a7r(TE0cBLrTtS>CP?HCPb^S7@p z|NVyLzefAFXnxhI?P_h?@#?j^H-D>O0jH`^4L#NI3DeZndlW0dV#=*sack1 z&&Mqi#2Zst52!XPYm(0xS#-vCcG^H=>R1Vo53LxQW?0EjX7XQc7M9{IYMsKW zni_Al$Iv!YbaoOgE-z-^Q{_@zvi->@sVOdwV@b_k;H|D=jAZvqZ-2?$up^bQNW#pX z6&%@`5+`xv+4fUFNeXK6sy#I_gcU3^n6_3HP-y(^!o?+;D=GK5c;>BzV4+bL6e_Ht zRHG|wzziz8z1N~V$Z^hb1E->gxJ%hcCUQeX zEregTaJ+f8S!Rwl&s`++Pc%}6{H(@J9%$%&fU-zft5%z7l~IB*W(87AJjt-Ur@m44EP=EP5IUKj06Pa2P)-I@t+r`ul~M8;<7mr91v zl~URuS@^6fH1aCSit=a#?EP9&X@}{0vz=CAMjnkc&km}n0j4@nwR>X8g2N!2n(o4V5?PsS-dnrLrCzm{N*i`Pw77!H!Bmt9#) zDy9EbRW6CgL*&)7`4D9gc6B^eIR0#va8-%2@;veKlf>hwbgC7hs9;>|A=vQ zPq7j%^w!Xah%dPY(+i73)9)2dQKuHvqG)3)r@~L++AC6cj0z?U9{5$SNXFS`pKWSQ zzoo+zy{6i4S!)tzlT|ouNfDA*ozm(G&+KssFR0e!mv|vTVL)N=Bqi0M!lHx$OZ=W_ zcKSUYVNt^p=@ZTxnP?Qn#jR11=BQB+Si7fM-8$YB z24Eh_MB?)D7JJLsz)+cIu_843aY$9Nwbf#K7K3D~M6jL2$B+ImG8CrT|GnJeEz>4$LSq;0kvr#O%T6q5zAzYMtJzRA9 zP%uczd!tQDkPLI zT){Ht90b)ajEfs*jqf!3@rw{C5)co*H{-B`kWn%<>zS=2#+xfwl3(xsVaJK@gUDd_ zfBcI6t>ik3QNTGwy3^GeIz^~k&_qI(#xIABomAwB0m zOA#f<1<+f~Q_I-%FJeX?E$ZLMgr;Q)VP;&2$fE_IaLGrv`5u+dWOI~k*vL~#ogO+? zAAy9lj~|YD-z%~IfN+OT|A(a6>9o%ykxYVrNUD9`^!@|F9Wjd^l6KN@Pe<@QLW?8x zU!dMHEj9JoTfb*g{{i8Sl*12AH*0`m3dq@^JPtrA@vSeFtHmCT9_jJ>Gkpd#VJU|y zr%*qrv7lIK_pA(h(wEtjHS+Wk3q8vJ!)l&z4bH!<GcS0 zw`zNswiC6TrR{2MuhI4mI-S-!E1i<%mi>mgZ@AZx-t7mw^@%%EZT_>*-&rnGaLnS$vJUQY%i@N<4lXau;^NB=F8s{my4Maa z5X|Dv;tnpU&f+HTj#sgH$))3U?49Jp9bqZGehYj3EQM0aN(Mg)FuI`Rm#6KVV%Y)s!zouTkg?O(iziLRo82~McemiyG`3Ww7oyW zioajGJDl3B?HHHkPSJM0w(GT>rQ@|~clD*9-1~92;%>oR zkNaudm*Y;wor*j4ny&5*7@pAR-hknKv+fO;i>~YHeg|_o&rn9J>gxU-CbhAvdp%|z z@S}hq1^g&r|9}|<>>n_rfc*pJJYctA<^lf!W;O7mfc+z83h;w~9|Zg$V11ZD!1^$Q zfc0Tc0roGLDZoC5Sql6hU|TRI@cYG(#(vVM27W)L8u1U~Abj^9pg-Xq zgm)00Pq<0ALHO>ws29Rp32!C5mGDHu_qP)F_uxf%3*ps-R})@MxIuUu;jM(%6P{0a zBH@XIClcOvJN|^{6P`l2N%(%jkuvP34E2Pk5N;A~5WX86*ATvj@HK>|5N=5R;J5}H zTM4fwyqfT8!VSXLfI~gu`GjW?ZW3-1ZW7+H3OY3r_7mdyh~G?{n@Hzo@^2yipHik< z$oFU9`*YIy1u(Y(`zzA_H88931HJ=z^G5uDZv#FS*!=$?9C!oRtXoMF`2E1A{E{?* z-wphaU&ekNIE;a5*+Dv(HLnp5)A1_lVD`U4KA2cc>vnL#v;jL0vjw<$m=AzkhUt&_ zIk2NJYk{4Cc@?-4%mLt5V@|;Q0a!QY31HorH-Rh1d=1=?F)Rz)r$E1MC8f zAGkV94CXdq<1p)hbz*h^SBmKZ?gq>l%%Hs)>MDly*zcN6AEnEQa8hItX# zA7efN?rO{k%+G)wfq4knbj)^Oi!h%7w+b^9a~H4^Fq?tR#q0sjgE<-V6JSrq{2AEE zn7;#i3FafT|3-bnWmtkTt^}xnrT7gZ(v;mui*$rGZ#=x`yYhu;_ zn}X>8E+1n&OZ*P}Fl)8~k6H5~HfGHW*qAlXV`J7lhmC3dJNaSifj#gH^$6^#m>Yo| zjJXlm!I&F?9gMjV*uj_^fgOxl3GBzfUW)k`_@4rMEap03`(dsFwjbs?VEbXN1GXRL zI$--@YJh(i*lf(Zz~2CD45kj)F5v1gUBK00x`3<0bOBd~=>oPCvjbQsW(V+B1N$wo zm6%U}t;Bo+Y$fIsU@I}709%Rq1lS*AUIca;=0)H=z<&m85oQmtMVLLn7Gd@PTZGvI zY!PM;u(_Dcz)rwy2L3YOKLYj=%p1U7f_VejOE7N$dkN+ZU@yVE0qiWyW5Aw`c?|e` z;CBO?h3Nn`3)2B?7N!H(EKCQmS(pxBQ!s0QH8E>|&jP*!*c40~uql`}U{f${z@}i@ zfK9=)0h@?v1vVBVJhJ6pzVE~S8}|L!4`4rp{V?_;*z2$#!+sq5N$mC5ZP**g7kC+G zT7ZvTgAIJ_gV?~wuEhpE_EBu$W1qkVKK3bW;A1yp)6QFH`z<>$Z((*}-odH)8I^JdgPpGx)MEy3fH(#keu$m>V(oVxGr*j2XO?I2bpk9CIV)Ud;2Dk1>PG zt+I?6GnP#VMeNZWTQ}*vyz?fERj1brY6?ro5>{BiOkXsIY!1>p>R2EeZ=7zPp-)zo z7F4rY^9+NN|3z%wEU4(c)6SyUq?R=G;nem~+K$zBwYCjy*K4~~+i}|d^kyra-uC`p z{t{^vFLtCcrJv=Vs{EsjWaZ!An5Nt@#sw-o%1Dhe72I@X zM;U3#jxo}e9cyGL+cah#a3!eGLg|TAS8*b%pGcuLi zh?qT0;^iCpf;T9aNV!eJSfa~cDmLY)Q{|5}Rw%olafPPGmCBAWR_gGplx-TvcLEn$9mNJJ#5yY}0sE)BQC~_Z^zn;c z##_oxG2T{oz45Lpr)j*W>=a{hyIjXNveJ7; z4Rc4~5+nK8d4)yzo(?;IJ6{`*whOKNtIzKn4?ABQkKWm-vyf~y9E?wx84XE85iQp|+y9TXyP{XSxK_I- zYB;aP_YCcSPOtbjKDIqa=WDzF+xDrte4{n~%X{JbOYLvtbw{so+rPJcjiy6y{~yYI zs>W-Gw*S-%FJCYB;qtZl&;QvLfB4^~!z^8It(x!ukGAWyJz2L`yFP7vZTENC>iPxu z#d&FSva>VNaybVOJQ`zNM=KY_ou#gIGtWv$;8qDGYDhdCu5VM3TZ4OUNDcyN!6YR9 zS#mQ4$8`$Wytl+#<*l7!R#$Pm+TybEG7o1=CJRVte3dKPGmC30&*H8!mgAO(<~6W) z{E>x{!}pJGrQcUE1}Z$fl{LkMRZA+_z-Hgkt4VQ$aD{{wuIY4E!hH6!hZkMp-Wz`% z?}!BmqmPwt-vt;mhNC1R1THUE~~4RZ!QBLTUhNKTUALRi;c4jtIes&=GiseAEJ&dvnN5+2DaQwV)_#x6(F&= zoTRG8I84$;W^qNXoXy~*0tc*?P8W|EY?AA7%g!wh{*e8lKl}V%{a%aT{J(O3kD4yw zqD0w&EoZK|(@#!oun`)17cMo~G+kS2-Srphua0kwR3|m$+=gl0qQjy%*Yk`{tTPfY z3o-VswujQA<)B4}9S1DCUc1-y^0&i#+pRiYo3^X9ZFGgFyI=e7)^>-sd#BgiZT3nh zR=X$l^6w3IICqCG=h$ThHDf&$)rR_@(a8bhL&;;zWD+-zLv^{%uo<0mP7Y`7U8y-4 zIR*#kQs<^KL*^qrWBS~gJs)}2Z9K|-@$A%0S6bfujMNLo&4K;w)a;9`lyT3=cFlCn z?r~;iXSnC2rb|pN)}P^WXUHd~^yZV-f_dVYo0E|zaq^~vhT)!*mg-KQlbPz8E#C^^ z%v3j@+y#`8b|Gi`EEn_nvb7tol zxtUoqjm^D8{z~3*+o-_~4R3YAvZC6mF{MUzDThq+)a6Vtm-FQg^n{`n+-YA{n4t88 zrJMvTsaiNbaZ$pwA}$vgQEqT971hu~`M zU^L@0%1h3hke6LtUJ!3Jnt?qRu+FWNt8n!hv~uoHSNEdE)y7K^<%W8bvk&RHc{ALp zGjsCB*%w0Tw#SVQYWtL?9p?~(%o0wk^#@h8T!vN5omGZw=IlAy89{x@5|j_iV9#Zo zD^n*TIgi_G2$AtgVyPSiqFnFA30;jVXE9ZI*%DM-t&tEl z3urLV_RfU36}|n~Ay!apRB#tR{oIu^Ct+OTc@xeXJ2x$7!dN5OH9MCkkm^pD<}Iw9 zU?j`mglV>~L9B!c?u@aA#3U^hmqX9N*deLs&X^Pq<0+X01b_REpO!P8_~br5Bs?6u z@rS7BjO2pa!m_fyAykktceX2S4$R3lQ_3LeTg@XB?OxgF2*wzCL-1$UhivhyF7Vjb z_y;5O`cm{AdkDc5K|v*iRH`DB|8yaA?~t^d!z2}qcqovnmzi&+|iboDN5sJU}5XLF|O=+(n18cP#~2DB2&oYr`u4}b}`=3SSmY6c_cN9EMN`TwzZF90@``~Syx2uVniByBPpGVZq|xrf|h zNN!`UW|&)ZaZ8dUNs=TRzF7=A9mlq7>!L~ zg!*r~_{jVEuK#rPU&_Unzj6H+sQ=Cmk^8@-{ynb>?|%|M{|N-PsQ>&FufO~G!b!!w z`t4W$AtR0)zeo|Uf3Zs5&q;<{du0D&yqwFXAEo}`Kffqe?4;0-Nt&vE_|I2d|5)`e zchiy6ck>_a#-Da%e>Z==FQ(bWM7`YM_Lq3FGTFx7l>=W~_**xjUmHApe&Oqu&}Yv6I)S|z z<2O@0Vw58~{Ie|>^WU0(q$wUT%Og6DQU8ML%friO(=S-aNd38ZJ6ivOrL?QO2;&#@ z_pZ#2sO@h%ep~<0XooBC+fj}v`R({DUt=D~aMd_s=-+nyc6>LY?NLnVx1$_U^4sxk zw8L}%ZT};tf8_ofVaGjUYenks-&zs+AD){H_}d+`pue};e=|VX+6+x0uy*IZ0|$L~ z4p<`vKOgpk_!m{$6d6?T;MPP%ECX?dE49YMV&DeLf8Df^ms#Kxk-ZI6^RzMzG^$b}DaWOvC@ zB}$!oYVndKN|i2i`l-PS0~HztF74EFK&oCF*p>SaJ-T*n6Uz+@T4S&38EWa)qkD%~ z?tfTecfNu5>fFv+V>@^AdUxpEo0k=HTcaJfDR`SvXt*|B&o=Gbb8{lpFSbM14m~?D zE$iQ{Lz~`xdUfd5p*yz*+QoHlPfO>Ho!hmsn-~Q*MUJd~VCT9c&ud}5|KpwRSq7Kk zGc2q;e7IwEvqHH46M7AFz_u;FViO-a-Fhvdw?W#=usJh&zmes=;4)wjdmU}sW$1Y_ z?6rL55rbl|#x79oBB(U1%$B7r{LTDE-u2D=@4U1>a&OI$pSv7 zR33ej8mM5Zyf-~`{eG0?cc1K|PuLArFy&)USBHdSOjkqw{^^DeFGrtfXb?^DnDyi~ z?=iNM4e|Tyr=#7`Yp8(=rusX!Q^BG0=u<8j?DsCe?ezH4pHt|?G1N$$-K7l^>rMq=jF~AbvN*Gt;(0G+>Jk1-Q$(5mF3)U z%C&X8>A3O2(~kMa!_FNxUQs0xY9dX`^^25|hPN_1XBF1ZKb^vcano?qapOc9-t~)= zp)c`~dQf(}{US~7Xwy2{@Zrm2=W|!)Z+GkAlt>d(+41&^G|8h)>uAH5q-P|heC4*! z+45NWx#hO;t=$?|R*ZHV$E^qJXN~Lc(uQ;G{%J>Qx8Wj{TiNfOMq%T-y1FdEG+nz* z+cj=oS+})YOx9F^mTesOfp2L-KO=jbK9+e6RK{+Vw|lVl>G> zfFH#s=TQBT{2QO1of;nq{XxgTC@;JhDuv$LAK>r8W~T-c_!~CE?J_qfJ&>Kx->_n| z%>0Z%AdkngZCZI*-qgH07Hi^tUpZXkqqo`132a-t?HcH&^JlxT^XMgE-JQd_3z}*zE?H%#&i2u=Y5(^2j!(+cGC3RbN+7l#RI+NYog`sp)9(ib7+jTlf3?4e(g=? zE9Hs`UUy&3Z=cHDboZ-!V<~U^gX%7(;Y%wkD61%IDC;O2EC1|z>g!&>yDJsj``}x$+|A<@$iG-R`ZIAxpgs-s5GUrA z@HHoeHSQPc-1Ker*)i=r*z{c!?OMp-U&J@dW40cv{x$)(3_DpLe}!XK`ZojoTJ+Gb zzm_oJz1;G-9=45a`&20yu<&u+AcuYp9AqClfKjf@<*}xJv~g`3wu`xGk>h>sq1K~K z|5)ROCcuf*_W!~fca7}M-!^Q)`Z>n9Zknuj*Mxp|%9UFlt^U^kXyaOcYuv=iKRo@T zjT@SHtAAtt9An(j^h5vrT67#~!kc5QAC|t*aSu=HS9dvexJYeB-M*n=3Ln=$v15I{ z+n@;mf%r5hR3lKPhc6I#Bw}^6?hse@eEesS**r$ScB)W7JtVJco8q*Wvs(1SdUk+ z0k2^rUdJ1F6PxfBHsftZ1V~q7fRS37VoAn&Tq0z{O~ZOVA3JqBY`?fJ7uA87UZwRHR`Th9eyr$V3*h zaW!&~i#+6G1V&;MMq>;HU?2uzFyb%-f7Sf2VP0c#Eym$GjK}qufEzFoH)0ZQ!ercx zDYykwaVw_bHcZFun1MSm6L(@3?!s)`jXAgnb8#=`;XcgA{aAnp@E{(-Li`Pj@GutR z5iG%@cnptYDW1SGJc;Fa3M=q5R^l0~!n0V7=dcFPV=exU7w{rp!pm5PSFj$hVgp{o zM!b$U@Fq6lEo{cy*n)Sk74Kpj-otjhj~(~`AL1kI#K+i$Pw*)|!)|!q4~x2k|c)!mk*Q6Wjm)==MKx{13Ed|8Ik~XovRb zfR4BfozNLwa5=i78@i(hdg2Q7LT|*P5BlOt^utx?j{z8nK^TlU48dPD|7)1nSX_&7 zxDMlS;`9H1^z+ZQ_wG~|IYt%@GF-T0jB~7My8b5(;i_}(@hizG_V+m2JW6uPj)+Tv zl7FJY>QIu)g^0KeDfuS~pMMdy;fdzN8u-7v28!^Lx+DK98Z6@e3+r>_a9-C*LyE0E z+J7at{r0~jhcEe#@4uHz{;vQ0Qz*IB_usmbzw19Y{)x|j(6{SH({9&*wR~kQX*aHk zaV?|`Z`XbP;q!g{>-gGR(QaH5q@@Asp)rDRO^_DXuOaQ$?V2DhjSy)(yNywg-FEHkpI3Ny7XAIx5AU}6xW=xj?fTj^*6p8n zdRVtzd;5pCZvXIBPk*;v)7$m8Ypi>W>mZZDx@}oqW7p}f@s|&Ag`{1_yQYO}A?+I5 zH9^-x{wLbqn(P~V`xTcSc1>aJscrz$ z>gpPQdskOTru*7$xm;uI{<_)sZ`auOaM$?PLt*XqUES8Df4+81xAJbN1=skGA3Z3v z<;ie8Nq_&gzHgDjp??sr3DV-mi`37iWz&q*&(4E|^>g!U$}mB=CP<4-%f^e; z&yCld{z14VNQ_hnLyCBiDqt`-ioD;nVb& z`G>Xker}=>+Wo`YaN*PSe@6WKw15Be@2_dTd0Bg;?(nh^zH!3a{li+n@M-$X{KH!N zDBpC$+x^2@zwqh$k3)7GbdCSB=06VDxg^F7q;~%~#q|#_^B?c6JyL&vnSUO(FS=%+ zYawg<+Q<6Z3%f?Ky7}v2^YeFGf8!eK@2`{VA88o>aCQvu1OGnNo9-U)pFgb3j>Wb= zy2g%`k;-gbD|d|zXY;wj6_9OU`>x%`b&VaXZCHO@tjy-^8mp6k+BU5JINdj_zxDI? zw|V-{L2g+o4mH-@S?w0~nX-9Uy@xW<*)@zyo2tdT1qU0GvanXMaJAO3Y= z^{{)@*3UI=eTSdZY~1kS{GWfDmThDIcs4C7x8-n+ttTsU&1JOsyKTMsyKS2OZfo~n z1K6^LZ%_aAxz*Xft?hho>$DbJV`a8Z!^;{)D6@4MKAfF9!poXQD6{iO_;Af5lwA~| z%<5dfkn%{&V`Y(+$;u-wmz76aHY<;`d{!Q58Ld3ha$0$$Wwr81%WHKnY%uiQjKABK%inFwuP1;^|i9_I$K$Iy{#;~?p79Fe=7@L1}h6+4!5rT%VEc}c!cj)2@%Q?Ba|gY zC`*n|mJ*@Nz9)vyH#I_8T7)wDt`a`(@Caq;5z6eEEPUL|2xVCj%CaMrT^*q;Cqh|n zgtEK{W%&`xMnotZ8KG=cgtE~Q%Em+}v-5WNda-kKc$uA}!^`a48eV4S+VC zc|E+WQ-re45z4wmD6{L9@afrkJ-p1WNy5vzM<}!F$ME5LMku=?LRqf}WxXSm#YQOW z6QQhcgt99ml=X{Hc2$HjyEhTOY$uKf-u>+G_40r1co2Ra;{RSbmi@*x7rGYmKizKI zz%}+=)%d@MT6?5!e_4=WT;nfy*Yk;?6S zAF15V`H{-)ydPd}bqwF0w!BszX?d+Y((+oli8TF4%WK0%T3#!Uw7gaxX?d+Y((+n) zq~*1`L|R@ekF>m29%*^4+~yI!yjE@^l}B1$8#dDNT6v`9wem>IYvqxa*X9|%yml?s z6Lvgzja{$#yX~Cc$Mq!by3hLO_{!`vXXhQ)WYc2Tg08V{n~rPjTFT#@AJ%QxU;h4f z-RAGM^SA%rfSsrP-FCg;@3y+c!>;vQW7CXOZgutFf3dpyyREL_-FBVo8mqg%+vel% zw(AzVwsMX24==Oj2`{r{3NMR|P-gY>FQ?VV-)-C1-)-~vcc;*8ovrrbVHu5sgqm)r2+Wp0|`<^E~gXVNwPY5U9FwEboNY5U7<*m}ry z6D9p+;dKfBT-kKP%eqA^F&{?ELP@9(zp{oOXczuVS_zuVS@zuTs7*R8Ix>HE8F`u=X4zQ5b1@9(zh`@3y@ z)`g8{=^8t3TtlhsI+R<(6-{$B4oLjja7yZ+=@%+an+t#Dunp9e>Uaqmv zyX_0ENu$NqgKI9Q#kj`WZ8=?Ib;@%cqyfudN#!*1wKyIMWTTvF={3gS7q7_Hozrre%cdAZuAR` z;~HzXI=jZY{dIN2hYu4zoYlj>elK(r{4YrVee1&7>-g&F-v$@^%I*5uHU4K3s<}ck z+Sgvo*KW^@yXIQgLZ0tyujy;||IEq1E@OPdg#UcV_3~e*4|IiO4PSeduf4Ue-L?9c zsk$p9{q-$udj93Oz&CDT>!z?}^=}jZa{ITB9dBGy-?fl--Rhc#u7zymYq#q|*EDf0 zWK&;zGhe%1W4gw!D_!H?FZ}z9fBX2iNh>!Z>EDl9`^ww++Wp5#JC?epy=x)u{*h}s zx)#!otFG}Mb2__1((Vhn#*Uk=>FQcY|1qe$ue^t^-HuJJxx%%O{^OM$pIl?tY_93! zT1fx7&wrlk=NslKUweOF`v70Nf8QVEE4TB%Yy8K9A+C`0pL_hr&qUuab`Eom-N$u} z9UEQaKYygULehUc9p)>y^OS4+$KecDNM`!l?cCy;Y}Z2i&)fd8HH2&Y z=Z}%Dko2GX{O4-_HN5{gH`X_<|Cl$qGx_U}4vLfAqTUKYcCtN6&Ho>#je#-3zvIS>G%F6UUzu`;4~_{8`u4e{`SuckWC0 z??s&0H@xk5;{4^Uhd=9>^H<)>I&m!ebB{%ZT^paccj~R@6Z_kV{q4l@&D#h5oA0p~ zc71;0_~vc9!hSY%;`nyr_;%v>cH;Q~H`5`&)glilKl1%I8K-%-37- z4Snmsk+1#FdOqj>*LwCXN~pCc|CU5)ltl%ch03UkDAa+igJ!VjitJe-yXSAu^w|AW zJO0=)#h#I|=U(ht7Q3#od)M~!RQoxGJ^NwLbJ#N)_T0twxDk_a3#Q?A%*0)ogL^R_ z4`3l4#u7Y^Wmt}3 zsVIZ;sEEoq7w4fG&PNn#AqEZ63@y+CaRp*=CHi9!h9D6sNJBcZk&6)+jj^~6 z6EOw1Vg~NSY}|u+xE~MVZ&-{+u@p~Y1)jlbJdbsF9b51|cHs-`!;d(GlZ&u#;0#p4 zIXDkB5RD5_4~@|RtM%=kYRL z!&`V4AK(*wfv>S2Kj9FH7UOe{(@-8~p$e)a8g`hd@h*1YW9-I1un*tkXZ(s{C$nu(24|oW z&P8=xfI4V^rnnfb(E(l11F^UYgOP|-WFQA4F&5Wj5^lkC+=)534-evDJccK+63^iU zyn>B*3tRC%cH%Sa#n;%6pKu68i?dyD8p`7=R6#Y=#D%DjCTM|6(H@tf3%a2vdZRC{ z!a&3!0m(>32Cl{kjK)|@z+_CrOw7T2EW{El!%D2dOW1%-*oqz4g+2HR`|&gE4@(qB zX_QALR7DNcMtwBFMYsfQ(GgwH9lg*O{V^B`NWm~ zFdoGdcnZ(pIs6?j<5j$lxA7i6#HZMcefS=~z)q4Sa4O2-OjO2ssEK-Lgl4!Hm!cgm z!{z9K-nbG25Qjtz#c*UHAER+CuE$N7is_h%*_ey@co2)Q1WU0T&)_-y9qaHK-o!iD zjt{X5yRjEv;amKGUtoU>q!>!z6r76FP!^}-44jFxa5m1txi}Bia6Y1N0cs-#_0b4T zaS>YLQnW<}bi(E6jw=w0E72c=Fa(K6K^oGLg&gEzB*x%cjK>X_gqtxHw_yhE#BAJy zdAJ`B;%``tN3j%7Vg;VTYCMk@@G{opHN1hhum$g8J3hcpe1hHh0$<{5e2edK0Kec6 zPAbK^MhTR{X()#?P!VUN3eH1yL?Id%qAnVsF`A(TE7~m01NRjmf&$L!&6v^XR!u<$4htx z8}K?d;caZid)R@GunV7I5B`C#@D29kNBoR`!TyL%Q5451D2=ixk26sT=b$R8p$0BM zZN#8H8lfpJLQ7nVw&;LPxE$Sa1!8d}`eP7=AQ34@LprjMgM5s_H5iBMF%dUm3U0-8 z+<{rR8*_0V7T_T)!XtPLPhdHo#wt9AwRjQh@G3UqO>D+H*oODJ#^VM|!p)e9+b{!nVm9u#Lv zHJ--{cp2;Q8s5NL*n)Sl9UovPKEZB$fiLkjzQy-AfM0M3C!NOUA0aBn-tcWFQ;47=h6ki|a4} zH)1kw!8F{CnYasca4+WL0W8GBSc1o~3{PPtp2Zsc9WUV(Y{2W-gtxI3?_mc%!Y+J< zJ@^N{!Z+BDAMrE(1^dHQMNu55pft*&JkCTVoP(;Uh8nm4wGo5*XoRM?2rY3b+M)wG z;c|4x6^O-^=#N1df<&Ys4e7{24)QSy*I*p3$3)zODYzBWaR+AMZp_7fSb&GH2#??~ zJb~qS8msUe*5XC1!>ibcH?bM-U>n}Yhxizu;&bf9Kd}$r;RpPLgZLFixG``tO5#+M z!Re@gvrrl5B8c-*6SYtW_0SMa&>R<|722RZE<+b|Lr?TZUtEQOh(iLBk&5BS#MQ{d zNQ}X?7>^q;2{&UZZo>@RiP^XZ^Kd^N#NV(Ok76mF#0orv)p#B+;AO1GYj^{1VGG{H zc6@-H_yoK01-``B_!i&e0Di$CoK%j_KT4n!PD44Ifr>aARd61vBMQ;D5OvW2jnND( za0yzY9Xg^jx}pbqp%40D00tu-Nf?S@$Uru7F#@A87S~|{Zp38Vf@!!NGjSK@;9ktf z16YWMu>_A}8J@yQJc~8>J6^&o*nrou32$R7-op-jgkAUyd+-l@g>SGQKjLTn3--tA zilR79L1~mld7Oz#I0scx4K;89Y9j{q(Fjd(5nAF>v_%JW!sY0WD-eq-(I0~_1c^vN z8q$%49OPpZuE985kBPVmQ*bM$;||Qi-I$B}umBHX5gx%~cmm7uG*;m`ti_91hgY!? zZ(=jv!8W{)5AiWR#pl?Ie_|iL!w>ig2k|S4l;`u0k~kG*a5^gBEL6t12;zLyL@m@o zJv2lUG{?ngg*Ir9%g_bg&=bAU7gu2*;*fx3q+&QSaW(QV5@T>J#^VM|!p)e9+b{!n zVm9u#LvHJ--{h}6ti;ls*Dl#ePOQ$D3!seD$sT50z#ty$wm z=$~dyNV!{S_ZO{cq_lgB*7OR?-s*N~_YbXkMY&%2s&a$!HRVR-H_C67-zity zy)v40%JoXS*JjP@%1z20$|Au~??6#yG3Ck1;>wcBQoF%FfC-niIh>nj^58z~zrFH&|;c2r)b?4<0h?5&Jd_EGj# zUa9P-yh_<$IY2p3IY>EJ8K)egj8`To6O~EIWMztSs4`WVrW~dmu1r^EC^MB=%53G; z${b~`GEbSW9HAVk9Hkts9HYEOIaYbCa-8xy<#go?B{oTGn5sSXDTZy&r()Wo~^8`JV#kYd9Jdm@;qfwSxtGqvW9YqGG3XWOjIT* zla(pTp~_TcnsS(OxH4Utq0CffDYKPVD|3{&$~##P)=0dsGOv{NjX`0vvP{^7Ufjst;%W2+mzFlw<~8T?@-QE-l?3Wyh}M- zdAD+o@*d?}<-N*z%KMb_mG>(bC?8NhsC-DdQ296IBIU!%#mYyNOO%f)A5%WAT&jFR zxlH+_a=G#;WlQC5WnOJ>y7|fx z%Fv7X=rzB-*Z+!!UiMPms(DElg}RQ6L|rR=X9pd6?iq#Ue_Q$C?wrhHPlT=|r8 zh4N|TO64=kRmx|TtCi0w*C?M?UabdUa+JBsJY~LegmS#{dgTP=4a$ki8_ly@m-EALj$QQo7RtGrh^PkEnmzVd$M z0_6kB2bB*g7b^dzT%>$hxmfv#a*6U$XpR4!LOrCgzWTDemBjB=Io zS>S&qPDc*lVv%A(3*%Hqme%FrKXxA6{XJY`X3G3Ck1 z;>r@rlFCz*rIe>CODj)PmQj{fc2jm&_E7dz_EN?w`zZS=uT);8?5`Z49H@*_4pGJ{ z6O@U{BxSNPMVYEhQw~!OSN^Iz=~t~sWl?1@<;lw8$`ZnLNCb(Qs$^_2~j4V8_Qjg?K5O_j}*&6O7^TPQD9wp3oCY^A(Z*;?5~*;d(3 z*LP%JRxHloga` zDl00_QdUx)t*op(M_EOAuCl7~JY`T>O<7%ezOsfgN?B8RfihZIOIcfap|XxLMp;)` zPg!5tK-o~)NZDA~MA=l?Oxav{k+OyIVr5I^CCXOHOO>saZIo@5?Ue169h4oFmnl0b zJ1e^=FIRR|c2jm&_E7dzUZL!z?5&Jd_Elb~?5Dg+*s<@L%5${Umul{YFUDQ{9vR^F_fqP#^pRe7s&n({W~bmi^J8Ol49GnIELXDRPe z&Q{*7oTI!)IafJPd7pBD@*(9y<-^Lw%14w-l#eMNS1wgPptUO0qMOjsOo-(McrmU_!Us*#L zrL3vEKpCy9rL3*IP+3PAqpYi}r>w7RplqmYq-?BgqHL;crfjafNO`fcrScMGD`jhC z8)aK%J7s%iM`ah~<;t$gZp!Y;9?G7|UdrCeSY;n&U*(m`e#)zq{gnfh1C@i6gOzd0 zAk;+lZ(aJH( zYm{S^*DA*;uTzd!Uay>>yg@lpd82ZY@+ReE<;}_|%3G9EmA5LVDQ{CwSKh9ip}a#m zQ+cOymhvv;Y~|g`Im&yKbCvfh=PB<~&R5>AT%deF`JnP4LRkl;M zS9VZ#R9>d+r0lHhqP$$$RoPA1UD-p~Q+b85m$J7qR@q0{S9ztfpYkeYf8_w>K;GnW4;7W+}6kS1WUrxyn3czH)?eq;iyU zv~rB{8s%8!waRhI>y+b_*DEI|Z%|HD-l&|Uyh%A(d9!kg@)qS(<*mwT%G;FFmA5Nr zDDP0tRNkqarMycyTY0x~j`AMmT;;vWdCL2g^Og527bqW4zVWVie0)>6N%@v?v+`}_ z7Uet2t;%zdhw@A1 zKb2o8zgF&3exv+W`JHmV@_XeE${&>nls_qdR{o+qsQj1mkn&e$=;p5eDMA*5{c5HC zie4%3>m&B74gq`QxjZVMA}XOWs-P-@ut%2c$LBQ>4f~OH9n^*WINN^2+ZavJ94*ii zt0CYA{#l#!w8JR7>va@jK>5_ z#3W3{6imf5OvenOCl9L&W$%*O&eh=o{$#aM#JuoTO%94oLAtFRhtuof@iC9K1G zY`{jmflb(qE!c`}*p40e5IeC8pJF%mU@yMJSJ;Pdu^&I+0Di_n972GPWf2rZag;Jpd8Ah0xF^sDx(UjB8cj!ftrX$ZPYMh@~Y0;4bnV=)fnF#!`X36n7eQ!x$GF#|I( z3$rl?b1@I|u>cQZAr@gVmf$fg#WF0%3arE`ti~Fw#S3@|>#!ahun})y6ERy5|D%xq+%G-k%?^Bdmr*J0;4bnV=)fnF#!`X36n7eQ!x$GF#|I(3$rl? zb1@I|u>cQZAr@gVmf$fg#WF0%3arE`ti~Fw#S3@|>#!ahun})y6EeHh~~9uqJTlQ0=mFcs4<9WyW!voITTFcaA|_!nreG?jVLE1DCT3wa=3p-7VLle%K`g`~EXEQ%hNW1B z;sv?N$sDYY@Ms3tVUD$hN z8lo|pqB-mxGcC~ytRy5|D%xq+%G-k%?^N zAP*xj3S%%9<1ii*FcFh58B;J7(=Z(~FcY&d8*?xh^DrL^@E{gq5f)Y>B!*Z;^ zO02?atif8mfS0fi>#+eF@dh?wGqzwWwqZMV;6v=hE_{mJ*n_?J5?^5-zQun0fCKm$ z2XP1i-aAtS#bEE$DTz|Bck7fvIoLaPDxf0lT|1Rg1@_LJAgaUOy;Bp>sEs>WLw&;?y#@9OCZdtXm1?43RRVDIf22zz(W5ZL>Bl3?%f zNyRXvBNN%kK^{h66vkjI#$h}rU?L`AGNxcEreQi}U?yf^Hs)Y1=3zb-;6W_JA}q!d zJcgxMhUHj+l~{$gE$0x zA5#(7JDG~3Bub$)%Ag#|qXH_T5-Ot#sv?N$sDYY@hP{`m4(h_*&D0Q$Vee;ZjuxxUvsE!(_344E3ZPbCiL#jR+qA{AHIqY3h zEzt_C(H8B|5uMNl_Fk#(=m~qbR4n?!-Y?Z317Yu&8iE8QAqA-zhIC{i8#&0s2#mrQ zjKw&N#{^8oBuvH>OvN-z#|+Fw6YgMM#44)~YZ`h{@VAv4tGkJ^sj``}xzeU#&81!h z($f+W18utZ?i|;zQQgKd4K8ZxhGhS0)Fm|3{O`OBCSM-v9`cjdz4IF{hbT44Kybgt zQx5rFE=l(t3`PbD1+9(WY(lo9)-tA|X#?~w=>+K)m>&0zfZz$e{qy5Nr zyFA|c+pQUEYH4BYX8_i?`9x($Fe=?mKzY3NcgL@i$Eb&!zki?iSK)Z)Z?}f6nXLJ{`E>5xqh99@ z?Sc&&H*L}|nAV_qX0T)XcI{$vlk)%|L^?^#ctqx~N%9gN88;Il;R5bct=(pkD8G4I9?G z^0J2YgE7Ih%)I2B%=o;ttjzfIv@xL;>e;SdR`7`V*9rC>o>w>6B`arWa%OI@O?rBA zuz8(e`^#e*G;Po%czISra%O7$h|FN$&~g^`k1b&fDt1xekGCDiD916A!fNi7AMf@r zr^)Wq_V4$jcO0CoEUm1pj8-;Py3b4dux?lGvXlCERqj-}{q1<`f5y>Q%U{-a$RTgN zwf@;lw_L6Q_7%)NyO!42RY)aNu?`yRrytV-B@O+|Uau$&y=ULH zA+Od7{ruk6M+KaTiZ}~4pR-XJ=fLK9E~?@@1W^suaXxAw3N>M;>1fnKZCr>th=H9O z>%p#*8^ErU?bllE`q-|G?Yh{miR~)au7z9RVzk61XoXAB8g0-P?a&?_&=HrR6FS4z ztX-vcMK{DaH9@k?6Zoov`h)K8!lW{Yq;1*29 zt(b<}FdesJ2JXO2+=*GZ3$t-I=HMR8#l4t^`!FB(V*wt(gLnuF@i#2O!&r<*umq3d zF+7f?cmm7tB$neTtiaP)iD$41&tf&6!x}t~wfH+;z>9bZFJm2E!Fs%k4R{S3@jBkX zo7jZ6uo-V-3*Nz2yo+sk58LrRcHjeih>x%nA7d9j!Ke5PyYV^p;0x@-{S}Thy(ZuKjRl1#J_L|zarF}RHSIJlZ%%qc}l5MOP^MzY`N3RpHbn= zif2_iyYe|z&aHZ0uv+!=Yedz&Ai7rV3+u$xtyjN6!$yspG;P-Wq81moyrk8ot=qJ1 z*Sj2tz3%r#@L9e3UM>nGeW@y1CvO}=@`EmLoucH8vZXWTLK&RKWOzI)C+bMKvZ z-~9U*Jn-N{3;(w0;l+mS2czWeCtDar`+?wat{{4j)UwV1nE9+m~ z@Y=@L-*|J=TbtkB^3K+Gx4pOh{T&~C_|eXfcYX5dXS+Y&^TpnOeEH9>zTWrEx8Lpm z{)ZnA{PgoL2mf{G*OLN814U0NQT*g$MT?xoQLSvbvSrJjj7nwCDqHrvvZt3V>(*4n zwC{s7*Y#23b^dy3BQ=Y?ruK{)okRbt|9Mwec_sA!-ClF{TOH0Cl*d1s%$ZM|adGH> zZ>-McPgkSysi4<1pZ1CUU#7{-cY6+QH~O@VUQ@b$=@&!)?^$q5-Bo)QoLX_&^c(9W zRXbJnDV2RmsdpdXpKUkaYyY1TwfwG4gWFznimG`^$=5Eqb?J_`OHTHhlI7Z#tTvH< zH2)I&{$Ap|vHWwB*Ocg4B0u!M7OR9?S%>$R!gmBWY@|Fqe&IV>URGRIeqMHdW@26- zIx{W3R$xR*b`BSEDRmPA(a|+C5_0q6^O9@Dw2F&M%*xNq3tn)2l{Re9xLM=ojhZ%Y7KqMG8la?2sz*S>z^3aTADwUL+mzs|C7B;Q*Qd+>z|-{ zo?X)GKee=%yOj<8=?(X839r1cZ3|G$0t*EBf#`v1Ml zU)cI{FpoTeqX+!w;tT*pt;t|?_K_XcmJQL`MdeL_4A)v{@L}s<^7+! z{CAi0>R;(XFB6p8l-28a<)f8#W4!Jg>U#O#zWi^g-r?K-B!2Y7gXYC~5TQt*=qZ7d zOS(owR^}_}8E2efUrbATMQ2)+51i(8Rpu4(^eOtbN6x>n z`CKqP@^Fc_MlLUGI&QgK|0}ippUm*4)}+=eJ@Z^-l_0{=KS) zo1aU!{N7QHV_)d_8#*!_KK#0#hjaYl)_}iVzII~LpVHyt_*(dIRcYI{fQ zzbc<>>do)1Mqd7+?&r?+y6W#~c2;X1dAcuG@X9xx>E+K_&W{>+-OU<$`R@5%W}V~Z9Ic;PHNEb|8t>CeUiWKN zygWO~%fgn&Ew{_UhWk&I|8HOZ8?|2-w*G$a@)tI~D|g%9b^qRU+uh~w9q;!J*G|jd zRi8umIoPi5-@E+(?*2bopEH-P{%*Nly7GTFKiB8>f9mqzq~prV%4ynOA1P01;vHA| zE5B5>({lf}FaKiI*KK!~C;i3W|He=C*5kgiUWR}FTRO!npMJZS*>`w(tnYvG@6vex z=J!8$y^zlevg?KLYlhzWiHXU%xq%+p$vL5CAA*@#c|kfd((<@B9q67F%*{_s4W^`V z=Q=AVn3R^oP3x?j(FJ|7bFxBH=xh&ClZ{VG%CTy+$r+j-x;dVnmYWyM%gPF-XJrlzbQqPK7);5^$%uE8 zXd9p8)hQ`CH!&wIn=0946I0W8W<*s=&JDDS&$Q*C9$AU}NFbPzoMCnEY0H;L6 z1F^}Y^1L;4xR#;y$uyHg)ya-$5z>=W@`9n&U`re5%wsJ>`PQAAoIE_xD>*(XCMz?2 zv^Smbnb~sX2HNIi4W~-kY1vGbZI_eARu8g@^3$1cK2m}?@tMrCms@Q~OgFTO<40tr zC9!Hlt1vS@Bl++aXIt7JtdtxY+cBv~XC*tIK=49n%C1#}ulXB8V zFt5<=nU@!zn94L*>UO<52Xpgs@)Ps&bCP{a@2a7>xjij;R3dd}?YaWnUz7Rl_&ygM zG)ypsA9&e3;xn_7emh2@zc4pFD=+k+NXg<(O6b$?eg53%AXIOwX>xpqO*1JzFWy(( z*fe$pJ{H-b&rT0-Kk$amwY?+s0m=<@W4Y7#QCnJWXhpDb^HP(8naO$FV;LUk8J{@Z zwqR(3XYxZm_Rge0kAz_yf@~Dqe0j;W8 zAH!sh#e8%^%XGNUk>`xVu9Gy{)&L6;=iL-NP&Ua!Tx@=sx+bJM_`aNglz;B8dk(M+ZkTP)@Ral37kR zBKvXZ4Af&}CfhK{&dIDgHh}FtTyt=o&I#=S-j!Z2cQUb$WL8dmj_qjqnTIQ)3&PHs z@!4z(?w{DS(y|is((OV*XLso4)(xz-*1ld>}6)9hADs44isrQ7Ks*G?+Aqcak+ z(m4QlCqi$yzIHF!JB`_iR`W{X7?6Q{(MK#jkL% zOryCcAL`HE!61oQ1=m+$Lvin&F<6J*CxiVjzOJ3b3dRVu@s3?KA@*pivF)XHNC;h4 z95LIpC41hP?d6yownm#LxafXtZO(9wx!^W155WM~Ht9j$CT zyZ-K|6X}o?I)-R`Rj=T}k&DEknbak8Qf0%qYeaXrN@Cy2rabZRafzBycdh}vdZ*-# zWRr3&YzG|zgq&oKp~-yEb6Zg7(A9HpHhX!pSJT5s1Dj_ym$_;7 zOiNN|rw{h(7&APLYYd*73|(jkv+eY4#{)KhQfNJR=TvWE5&q4tba|+BlybUqv2vAi zv+^_LugZ#Nd*eqdTe|LQUU?67rzl4$Co1PCmnqjMw<$kY{-`Wo*_-ZJ$|lO5nqOyi z_frm4UZla))Adz2Nbdc$9!taQHD-BjJZmCaS2r0#2! zGn7k|FDd(J_+9FrtnQ!Gead;>d={yElQO9Cibn#|UA`m5$wGHkiR z=fCfFE`MR`DSUdzS}r$y{cLZ2M`azE!9vR2aOIBCKM>Y`U)c2Bbk-J9?)v{v$$*w4 zHOE_zJ#+t>9Iy5Km(4G1`F=D1u>OVBtFZO-o9P{6J-XrRYq%lGU|6^7AD(XbKRe5X z&A+he@6`G#tpD#Vcgy95-=yif>AU{n>4ta1x$eR;pyhJIuPvnh^TW#B@Zr;S<@Ljw zw5$~SKF3p5_GCk--JOC%x%4jYIk+PVkE3Jyc<*z%^g1usj`MQ7a=vo<^%_py$1$t_ zucKs7^y)vojQ5;heWiPTaQqowdHC~#Yftye!=E1vYI=Y4`N5_7In&x>JWuGJ?K|EK zvbO&n83{RgStAo||BF+5X#3d>)cjogMUS|+%i8tm-Z!qt<-xIILpN5BEbq{*XY5sR zoxAt!6B~Je&Rx59xU5arqYl!&U5{=(yLO1}aI~R1_UYO+u1B9(=ESe1*bVZ!adB4B z8dSASyLKDzk;}-#|Ay>IwtYOU_HIXFrnTHc>`$piid#C?q#N zJrLVJ&?mNC;IeM90iF=0vwi1YfvDViQMt6Ir3CWE*pDKpGC!$_vzt7jP2M2Djfk{S zIr-__xjLdxLl(#zC(iCR+q0jinF_|xdV83HY=u8TGFUNJRw?>aU+djRj|Pa z2#fZ=phw z*XF;of&a9v8FpCkJ|6|Y6zCm0?a;tSP9L7Io;+agjpUBAg)Q&J+$qmv*V0j!=|%tE zDHig9t2LnhAU>s5J=$t9gB0K9=dkV_o7@cTmm!1K{K+-ojHDVgh){zDe?biz7Sy0& zgc|TWpLTpcVjUdr{4=&eqk{Q2viV=je{KeJ)v8r1Sm(jzVh?`N-jF@FyNQ3avrpBZsTOpLXOZbpFRYa@e8ch|9y{xoY7EWXGY7{g5H68`MEjuLO&g@XP1a}y&LMu)p=%iUV1$q3QJ1P&aKCj zE~BhtL_L1CoIk4GsOC-Mnl`S-VEhzzI2Y_{xZ-A(T)6WC^yu8=^c1d$(~@dY82T+N z@6=`2p(=Ah8K0ZM6>B<=?C=xE=;}PWl@N@IO37^z)w5xpsD%2}SxeO~xw^V< zL<%U5u3xK8uzFgkhr7nkN=e~ow4qvrp2rAg=cU?LggQa1kF6?x%+C`8R?P_2;o9i8 z)k$~NX;3FhwaE#q&2d%Yn#k4Q+g)?2VLwI=MpNP6R_JP9g|7aSYGh|MZ7X&r>X4nC zmJ~Q*yV}>PBUWm#HrFO>Y_E=?O{bbAhOa6c%y#$Ry}44^XvsNsL*v(BRb9yGL z1$Q=D+Ji>k6JzlitpYs86Q9E)*V*xTsh0#!IVCzOH<*%>#S>a~+>6SsRmv+QgFMwS z+Gb$AE{V!5>Gx;}~NSsd0vlREquqU*_{WkIWW4E@tX4{ziKa$;KL zcz3Pr%+V`0u1)*)fgZg&U)H&Mpl8=Mu^oH#>K5qQxvjl+R)_tV&^aJxXl8yOI-Sp9 zdgyM6eMw;oq2K1^-a!3;_dv0KaRb>rUzQQmil@v&H%v4}y$b>@E)HLaAt0xSI;)FodUi3bPuKX0FZ6PM0Nz8VxhHN*EYR-H{xaxW3Y^IS|!$*mYK#~ z9aeR2=nPe`^=IGYtw29hA-G7Y%Bji_TB`nrmuS( zzujAD(5(=a(hZTJd8RavDrqJ(&!Z-p5~WB3Nf|<+3>8r!k`S4dLQ!NW4IsveOEi;GXyKXf2sc#Q{6G5!eVJRf}a5@P5nGw=E8;*;5K~2!yg;fNd ztA#^(_<1`7#T!5j3s)Eya9WEv28Od|_z_~JfDDd2{2)DcybU|*=jHT#Y zp?ff#I~rD{ypcT%oij2IssNl69X$OB3Z2Pkydt29 zn2w@|_MkyBLh?}s@wTA3Bmj;cNKp_MOi-9|c0^9K@QH$%gvFpTV6-?AwTF2C z{A_swGQ9JFrL)3+J_sxj49#swn_%FOS&0q7khKN1reJzp7S zW8isdBuqPi7d-6LFHG&279_zz*ibKgl%S^`V7Cw_E#dhKdKNPDCIZZi=x8x$08~T5 zQUFm1S;>WUC@fsUf*e7udXYfhU43CrgINY^8BsH-MW{^7Jc22ASRK)>yf{8{g6)K7 zL=QE7%Qqh>4)B?V)dVCF#yU|QqCtbwiHRhWBfpm>iMd<@{~3{zdZv!1OO`CQu|PJ2 zqn^HnzPX;hx$ZLB2HH@Pp_T3u3w=P;T?|`hKo31?{F`w{lN`oJSd_v<4fFTfIhdw! zfpNt&lmf9DWi#{lH@BLtc;5+Vi9I)>_r#v9Hj zN1T`=;qZi@2WRXFxxkYb(C~zj^9C`$0Q8+$y4zjC4{X!i5!9;PR zscX>OLc`HBIcd!2ojZQgnxO0N>^tOmZqO4QnuvyYh7l(4VVZ(B>V~qQ5kQ<~EK49DU@4m|tN`xIB6^?&EKIE}^-W<0fqp_(J7LBk z%NoBB9y(bM8wW%efehii8sa3-M-No-nI6vz8zIcC5@KrvG>||3_LDRWT}fPck*$sP zScd$~U_NKiFi=G+9IOmXW%)U;TRVrO4jtne48|8W)WZUN1K{16MI^3abpZ_YekQaP ziTF@Uhz5;_>Rb#l$ct5YOd{@?aAsWK{3{+4pP9~#b)9fL=KY`IAcC$D5pxjnpYr{; z(p8E2RuSzVNw=Ix-#MaQac+1!y*x*6Z?gvuXW}vAk@WAokDh-d9`pV(L3ck9uOeb* z`u}!(ji~PiqWvSw6DI0YL&RYLgNqPMM)CK`WPeqXq+wVvB6008I_3!RWv&z8r5|LM z!|EH&s$gdmgO!-c(b64%D`IG%;FMtZ2_{ACr9^mEA5AaKcU>;3P<}2-G$+)}@&mn=jV4r0Ligii?Y5DjBIKG|2Hk*bacVH(@^( zEEf-0&-!6F*c%uK4V&^{cL6pMeo<+tWc-cDHSjt$zPLnlC!tNjo~ap9^L%MbbFH zL7v#eAZS3?1OfRn?gx{yAFRgjfY1*vdKrMwuL=H<0pT+P?!mKfFM|T{I8r}@m-HPF z`Wc##wh3YesU8q|84L=<<0=^pUVw=;G8mfR-*ywgfdYOZe!IE5gn2rKyAe)zpq0>r zsNY7;xkNXj-ui973C@Jz#tXiZWzr{}KSEnkN!ax59N`EvH*60@prZ~1B7p}b{A;{n zb;7IzZ03Val3{SP!vU_;Jl!3Kmi;8=Gy36(#M1WH+=Eo{iV^k!A+n>aZkY`wVpMyy z#(?DodZl>q`2iCROZUUfUvQ@j)(omGGZA8x4k{yb$kHK!ued;08MNOk1FK^an#f^? zj=8%8dqpUZr+cVlV6e9*^9{aX^Y6$<70|ypCUh~;JnS%l8_m-%&;@iy2rLlYk+7rH z77}*s(2*auuN49tdf5IT4a_j&bw6V3f`l6n!|Y_75=|m(0a_y9cU&YaBXTc?j#?@* ztH9imL1p9m0QwNK`Ou1UkX1|>b3}D>L~l)l;fEN2?ty%JnK+OsmYveq}ZCi;EM{8EelNC4HDY3~pAz(V59MT|L^m8>B_ zY$PB_X6|Lc4xASO-k8qEw<)+tu(H7=Y6#iQ532@=Ne6q85{mK* zg=G!4$B1a6&2?F(KE!rVQ5i7H{90RxllB$V@B^1u!raRp+l0eKMQIR zZTezI1cn3EY0NewzWNYN8IC?2_A55{Ph;{Ez1BXweONinRBY+$2#=tN(Fp?-p11)z zwkAd8{=UxxE2rQDQ)?w}>I}kZ*uP~B9us6xdITWS2!6qFf zqX;lUPz+cB_%FZ>#z2q(r9hsrVD!TTcJvM0UBDkjFiATo7-E1yK_+2-B<(Oyl9hW9 zX$iQSHxCR4XA7@`2-KO;W3ZV0tvGP5>_;cWh4oI83{KTiM1pqkR)NuObr5y zi50%+GD^nfD6bXp8u|WVKCm!@-{=WG^B(D1l+Lto?TFvZEkcxzc9swhy3lELw6lQx z526dvcZR^6vxk?5XrMIa=IZdWN2U#@J2K6Lpu?;)!bSCUfq*VV7nQ?&w_F>32MxPt zrZek-=ndxy^B%poj4qTPrF)_qxKNu=d59*umOwxU8klW1hu?^&;SkWJ2La(T4?Qr; zNA*K6e5VdChgna=PiFbd`k?kQ`-KTZILvkouP3T+2n1%GP#P*1T^10Szfpf8TtpY) zkL306{%4jy8Xlsxp<15l0ho91-sz;$$M;O~mO$e1M1#6Y)_ZK2F4Ei1;EA zmk}|Oeg$!Vhln2%@e?9`Ma1ukxQmE?5OE(7Gl+PS6V69bBA!LW%h|7t%fry=4@cKm&@d+aCA=0ae`$^6?-b^A^Bw{@xwkBdX zA`T_u7$Qz3;$uWyM8p+D+(VQj=!%z9OTa%6u{9C1GVzFbJ`rmX`MijD8xa=}u@Ql1 zO~iEsT-FUQ&z^{*h**&ihyN*-C-}6WRF(zxks@)={C=bIhD;_M zkxO>;iV@+)9lc|N-J|uxS`r|@#u_s9;e-tQBEf@~5PY410}w7U&SC!$j!^(D%nT>e z&~KDD7nWPW_-4#(a1W0yl|8`mj3bao^icWm3>n)cfjrpZQn0RRZY0cY9HJ>V908sn zVVfqdYw@apZI8Ax{DaUug|4|+I#7T^{E~98fg>p?uZZ55fe%kA&4GLQIkdSnIXG}H zLsLNal9I}Bb`XDPBtt_tI2KNh$p+XT!aUde!{!idjY+D>%PT0T$jd4yt12m~s3@t* zs+eLca-#hs@kh^qipT3EMU#hG$iRjhalz`=%@I4Z#AM|dlt-<}5TzkHe_18qguE*7 z1DJ!VGe)WZqCE;Kh@H?JtR+L`|0nGL8*Gpde_ekCRDC(T_!0Thi3d!kl+l|s=u-s$ zvO^IE&`Sb;M4a<4%Nd@3aI}C(4ks%$T0csmCz(VYhGYNRMCOdukAsxdVY~uM#^_fm z8aDc|6aLKlj8VUmdeTh{Q!xuL)czyDQmgbS1m987jZXVdVrf{=$qib5d@wyQTmfc@%n z*!f1lD2SsNqv#g>hcUgHjJN@q}qJMuJ;^j!ul!%cGwS((F7*9Y5Y0zKDj3rNF z$PdzU3bL4Dfa?5*^-z!s{`T*`B42JJO>VZs@2DCcQu%Hh1q8;>(% z@e;Ijcrid!+Fm^2bvGOK^2Sp1IL8tH0MYq-%A6!T@*wxT#Q*j$hkVy$(2U(v!e z>ejKyL{!MNz%Q{gAdX)dq3;TXxE(J%-^2q1wzJNtjE4m5!f3)T))DtiIC{>B(nh9J z0fySf4gpD8svpluN|sKCmYQ!JBB1H4z`Eh3^bQ_|wJY2NRDeC(L`MoG|Z6Ot}~Y zF#CBBK-&B%Z>xj0ztl%&rwt{MSj2p;x^=1sbfzDFPXD3VMp=S-YwU|<(H?2eeXl6} zssg++??PvM=zdhg(ZE{qyx>8p&?bc($}F)qb7m)xO=d8KWrOryhq#)u;KTKGaWVoE zZdtta4GJ)M#9O!LNx6vwJe)C4bVjAkq8ZPe8r*k?FQqG1uMmk{ z=6dJw<#{P`sjbJy%{_d0xp$dMg$`d*=sE}1x1wdj+0*Od`70DJu@z6MD}1SWb+Yiy zm^mL3hebH2bYI&7JqrhBnm{9D@_Ik`WTGJAKjSawz% zo@!jW&4gcTvUZdMY1NFcbYp|WY3wggC>vYd44HeS<@osYoNK8;f`*@rUp#iu^h>Gb zbUAITrYm*pC|xmirED#m@Y8w;V*LM?*#7@{GAvCB6WzTy-)fp|JohN^jj_0)^aty= zaUWyC*w0^%-=VxKt2x`o|A}2r(QpPvTAPMEJK6lc6P z<+^vzV-x9J9?AWctEFO&+jUsl%(&mVskcca_Ur2mnyPWp#B@cLYl<(e{Sq=HPaN0v zxGeS6?cQ4!Mrc%<^!B%@o38Pt1b#m8beiOe!prN@v?d8G@9eeQr#G!=;tkH0Gn0>% z9ueEZ|GCI*LT~7uOS^KPRz6i?7$xam5z=$F&8gtCS>>f{YNL=IYn(eEeuYQWctG9b znAG0mrtSCEkLN!W?|XBtVdhOoX=+`J9{r@SI*m6Z_pF^y&UedaE)B=y82b9DPOKhU zGRLm1S*enD=hHKf)~-DUp<5GlHmCXaWv$<^>zR;x*Lv*^1&3YV1?(J8`z7~tjC+xk zCvo;d%Zdnx&9`h{v>OC|Ec<9)XJaL#{!;Hq`Sy^5SA@f@gsS#ET73P`OSOmLJe$v! z1%3QrBfZwC=gH!O{@uN?+j^syf0}qxH(Bf0b_Gq{wKYFi(C^zD^hotA+O$GjuvK6V zeTBx3*^YWX>xy6W1d)>OexTIFD{g2#r=OBc@r!RPYkGO7(spAWb<)q8xmp}An>Kic zeSgAr<@2=ZWho_MKjV(E9(;H*@W$hrL4lesXCw);nTXOxz8Z{9=e z)!!9m%gWXZ9i7#jH|K4_<4}{APple>3tN$~^Uw7U2XGFslzYxiG!L$QziuFD=d}Gj zQ?xlgSubs}UV8cL#5t|L7Qtud^qSl4Yc_Cx-c>{Oiz;jOxww0kfc|xnW#x(+rbRxV zVYK0)shDVM){X;VudY7jE7N`(ar)KubDq8|!kcFBKFBT82$k?T^Q@)tZWL8|((GM( zocWDr%x6g_#clbq_+CuLwr#a7jb6@ECYG{sax=6ua;;~cn;32`DQlV9rmZUx5BeD@8ybGxZ_2m$-ZdQuvOc{0d?{tZ z1=lk>ZY#Y^NbWe+_C)1%rdyF#>x1gJD+^O}7%s^VzV4hQJ-J~O=hVZum#yqSA*K@~GJB9AIKW?ikUJ|F2LuhAlO=A+}AiAnQhT|cJ#4@lXIrb|?)i@w|762-N@ zI5GFOO8cQTygey8|`_qKP$d7rRYRX-ky5D2WA#Craqc`wzW55ji>Pa1s$r*IaGT z^qKXvUpwveRO{{L;}rMsQ+TwjmOtZ3(pM;M&KFANE8V_>&-%_WZP$4Vn>J~z*G=lo zOAqpRdha@i&3x}ts(Y98k`-6KE!p|%$ku&_8uJgUJ+50NZ*MPABGUY}_A{M#zf`#` zYma%t#Q4l>w^{lpt`2|PLRY+g{C+sg!7m!msrE} zzwlcTrD50FE0y&Zmz#UlO8W_i8u6sEpD}iAka-ZPQ4qKe|TXV0}5Es247s%>ntfg~WFzlRHU0TuO9duV4k?uOh>p^W^Jq$5{A4lG; zKmAdGfA;ix-plgF5)$QyxpLedEauZ^nIr4+kFx%U1OIT~9}WNqSfU=e&9YQH-0W)X zW@VAMe$J^bW0~9fB@uL9-HW~pcXLVgIM%YP&>)@*kt}`l3IFuemZrRT=efhd& zs_N@~$^sZm_p8J_K60>(Ykd2yLmL=zdn@*C+{)}dcUu(hc)i)u zbm;Q-s5NbebhK;h&iC?I%(=PR`q8X8WhGu(XYV{+?pij^Qcxgfi@05}5+x+Mh%}=^ zPD-xvK;u)kjO;`s39|?lE$R8sf2Jh*(4N`(Hj`(I-RhC;q*N({8?pmULTkF8m%{`yuIhxsDq1N|hF6k>m-nuk!af zE_{5Wao%%>`uZjF%IAH0dv((Da=qOZWm`*69crmKpA-L3dNN;@tJ$STLiO)_f_1p> z@Q!=$^Urvb=jQyW9Ahm?m_D ztG8sVu6$QwWqL&8rw2LEL!DZ@cFEiDw8fWM7CkcBH#4h@cS3$yY=imFERmhls(-96 zxj~_ZtWL@vuOg6s*659=+qU%3882o=2CF~5KUqBBnP<|Y(;+`20J%dOPGL_0OPlft5R+}S9d_x4uL z<}#O$UvzP$qJ*ww>x`>A%N5VAIRBihajC^2(sSqho@Y7Ak#?&pV@|a&u1H%wDW-ZQ zPRwhJxsny?Xi`mL-2a(iWs|TYwSYg$(nz{T|LwDNtcMsu?*qEZ*0g&oU*q+Zm@Jbw zD>c^7YZAK~U30;fPFEen1NMdMmecI=XKIT3Rs^0lU(}?bIdNY70sG~0CfALp-kYi# zqIykxvP9~g_0PGyO81vO%8uD9ofgEC#`SGNVxQ?J!A`H+c}|m7w(nP#<)0XN+pw}A zd!JO{0p$hu%DyC}rSbeNIhyZwu1+mlRj!eBQ6uD8(CRBZ)tB((+N&w8FJb z`tmhBhZ&WsA1}GsZ2VkONdE4+)%5<#*>~?%*RwU{y_nLG-#@n;By6R(zIwam=QmCPlUwa3=kjRhX3Cb&Eof{Uc+ePnQ?c$wtf}h0Cf54Z z*+z|ynHKt?D+<@Fc5L13-_UXDY{3Cu>+%P+TVK)For$%JiBoNEzPoGgEB-Cn-ztu7 zw-q?`En&f4w&RvER}Xg$yr1u4(rV;xwa~;+Sh6RWBfj=q!;F|k87W=H7ACAy$9-s1 zzW;K{)bVd=6D9lfeS~xreq1*~xl)^nG( z8SYvd74`g0jKDS3cMm?#T)8J}S(?^a3(l#IuAIxu2F|*d1Y0|Em9Mn)Y~paOeY0Kb z7~A_=&XhjgSv#)D|I9Yjv*Mq9rs3`s<;PtWX0e6R-k&CC`IPQj=FZ)q&7Qu;z}hX% z=2k0jMyN1P!{TYGHOHOj&bis(c;5WFsi98D*;`*e-gzaoFH4B)t@OjP#5Fr^Z8$|a z)fM~VcG+X=(@iXMOOoktU!E+V;bbX!`rE>Ag(HXVX&-BBG?2egv}3`Iqd)a-e@T*^ zyj7%MQ6l#7`woePfq@Dx`aTNdTjnQmum0@W`X%cl|A$~TON#L;ubKAc78guEEj{tY z?4H2upPDjvg^L|ss~6o8VLUxtzMSi6ebURoN)4{Yy6Y=nitbZ6m*?M>g5X zIh8%NQPmRi9K7Mj%t#E!IN^B*!nd}+_u#HtVHsoifv0Yzq}oh=T2>*8?(M^IjD+*| zeqQ|Mb0+51rn8^xIj)EAF`~ESq{hvUy`OK|98Ep8b@J}0n=H8t=V(p)8T0J!rdOh3 zF-}{3&rN^-aK~;nks@=6PA+#pHDw!@7lLr z*7gc-S;FMES=OBTDeJ9fq*qx<&GwWmNwA5X)fLUnxAOMSrE_e1_Pkg*?Y5V4e#-jC zMlBa)@9c{&7J3`{^5~S44^Dnm3b+?gZMN=7Ta>BhxEQk&4kts)A2BjIw#GaTc3ms* zplyoXs}r4T%+(EZU%Qv&FZ0f4EVC_lh*EtTFq=HHmwW3Z+N(y#>J%fm7GeOx~0;UE<-={Q|G#S9;uN!E0Uvocl8uW zN*T``SCg1D-s&HXyH0KWF#GeR%g@hqWw&g7xa4uS@MNFj_d?749vpsFZ6`UeZ)MkG zvkzHr1A;!{!HH{V(;YcXJ_qw3D5%R-?OLcO_UP7zm9r||7o2@QKT*xVtKrec8n*Z6 zTdL2PMDx#A9>*V4cVTbdw@5So{F$k4PnQ;RRlK`Z-N;Lk&$=D+_|9Apu@@h`wYDtY zX{ViEXmI=P=9ro(2{XCGq780$IEJ>Kkod=({D%YoaNr*f{KJ8NIPeb#{{PMa7SdtP zjb6pt0aN?$xqb{wXcrM$oS$a-jH@nn#)0R>(>hr*1?vaat`I4Bt8y{Rvvbn%`iLir z!gF~xl_gJB67_A@-O#+*cFXZrdC}XiC%>;DamU)bYt-kYX9z^g%$UgHJ$=H{%p2k% zUsHU_YEGKo%?^K4?YgwN{HegQf@=}$)*l;xns@Q5qb`9Tayj^UC==rq3~ImJZg6^1 z&F1*+$7_j?+{aiau1?rg9!cM}zx%MgvvPuLmX}3)GMr*yY;0xMe!onhA-A^nT}l(n zhMki?wnVI7elK^y`=$%NleSB$8NR93C(2DDQd2cH3t$6le za#d%O>+-ys`&&K*7+V%rTzx)|g;m30lTZPRx_?`~hD80GOION-ruyCtkyyVo1;E;VM}&j(67g z{+srU^vI9420u$KJ^az46B4*N!t-(XRLRP7{TWL=^b;GWoOV3LW!a@>&5cV|+I?A>I^VOHvwC}-&w^W#!5*@^?P|}f zdF85YVV98pB({#HOzHemo#{5;*lezJQFnPsQryn#%+Ko;*vtP^%rHa6eDguYx{c2r zjvO<+7`yl2+Y*)|uQx2eb5HKH{HChdGs&N#!ySCjzv4Bt4>|B8ZTmLorQgSEHQeG& z>I+i#K4Y7d$=R|oWY_C0-$FH0C{+KO@tbNNkwW*sV@pzR?=W@aH&;#2cz1496IXHl zB5vLp&ZJ{1t0%fC3hg&1X=|~yOm(TZIWlMWvz%V@U32wcLgw?hBQ0cl;3WNyK*`Sj1Ogs}3BRkTfZNGn!?wM? zj@%Za$_>0vwpvV^6gD9&PEj@H{h_Fc=^rguoPFHBE|t9g#em+0^ra^bG`Zze8E@Nq zs%*x@k`MfzPa}DajP|Z3*Si@ieP1Y!6a$ zswbTJD*JJIDBp9{%Z6^99Jay2HPgSGu?|#UXS@G+>4Ze;`kPJ$BE3%)0}cxt1!mki zII!i#ww}yGMs+{Si()n(d08I4bzOQ~tL*6yr6LLUjEqE8s+*{N1^iXU{l%%Z8xsxR zfAQ4FcgfA0+fu~Uy|GW!N?-bM7?nGYrQm|G|J9JG{hOjDsEj+@U}?W7(BjLRauey6 z-OIDn%(lL+y7ppLR`mK^+(NolS3h}AepT6cULyHUy9+I6il1S`7pHsC6a$I0wyo4M zwuI-3@t%Q-E;R2sZ3nvdpEnemnst>rJ-UDA)wXK_AI|Q3s;Ss@j$FkObgDi4QE~j5 z@)MmQOW$x5T)6d)WNxOp(n46Vao+^$p}#WA@sZ{r}0gaT*F@L zRr=4BFM4W<2)+|{+aGz-=G&BMmpRs1iZ@J{k{>+B%l5Gj>2rSB{j~MQcboQ2i`|+X z&tvhe;N$ZfHyR?p`&f9TcdRUPI=JCNM19+y$U>D=?))`jn?iLebjrpJJa+UyxiZ0Y zh|1TEZ|ETOX}Hp-`B6pIDYKtJjN+0lbg%^q~*I^ zz?|(|zH)9#-}_8WiYvH8_uqSZIIySJH`<%7vv7`h%?{tG{90#|XK%2n*Du^wEyhr< zo?nx>;KTQn@7q<5Z3@c0dTgy(N5YZ9B(v-F4bK%gk5HFMEN^_+KV zaYbo`b5}=9)$Csx&3V{pU4qGl6oJhfUa_fYCQ?Jbh~-RAJLjcRlOd54!_aL@ezZBd zF2MHICLJTm)Jmmgy^kO5NQgXHcbY3~#@$BwPaK<1{b2N_ol>jH+SdKxEh+N7;R{XQ z2T}XyzPA*&+#l_d*~w=+^+<9r$%q_X!El31Ghy}u8Q_vaY{TK7M%IXK&i8XN_Nx8 zy*qG(_Tro1giDR{&Y$c0#3J`|#mnT0DRR<}Cy8fk=6{T9Jj?M)CtNkVN-;20&&coD z6iS8Zo$cS=t#*2L;Yd-Fqrh5`04vSf%GDct7qQnTvO78+R|;AqC&`SeWl4wZ^YKNelHi1 zS#vN@XT!F@CmgvqqDZbeA9-#C)V5qOzq|3EsFyEy2>bIdOe?ZE zH#oRh+wy)txu9_GHipZ#xQbw_*1|b=7hl!?Bo?_{uI|g3+19*lhhC{~ZM_th$G+kl z>G_bEGg;+W#$xa zr6XNI9s!$w&c66?N&6$moF}&HC!ae!Z{UINje$F+rYCsi(;mcZov`TQiB3+5><_!v zzpjjIDAO;c%WGXbzP;r@Irll~zG<%*j?tecE%QseRhPKt!9v~+M}al9Gj7K%erl0D z-EObkHkTd3%jH_8B)P3S7`a$du>}?==QJhvO;5Yd|KRJ>28kK3 ztn*f7ADt;0@Oq7d_JhLmtp`ggKdm=@Yt7%bw`h!S)?dFL>HlV*``CYBc$I*}89yl(AqhLJ)i;t|UH2}z zOlmhXY3KBBJJ{klz~YF|3=D<&l0o3g@js#cRLmm`<$Ys1*%b`7;_CVp&=OqyPj zdW1{yX3lAufdZR&IjNN33ml)nH9CAIr=Ndi9-6j-l^MlAyJo?tmI>k#wX{PW^9x6iBIxQkV%lY57ELVB;& z-t}wb((b%YKhKs-cI4YkS!&Z|v-7RZ8`<;Ms@_bK-&s;k??0h;&5U6yD{R@cZ~G(< z5&jdFUUyD%blYuCHBnpq*{mURxAccp+n+uGYof0wv;LI%9w?|(abeq}AAy@FiPJvp zJ287rn9+puEZQ4Y9$oY@&(8K{vn$HXyg9c&LxVlk)MA6_w(QR~LI=36?&40AiT&2> zY{gicTvJ2smFvG%DfjxY(XEoLMPE9SeOuQgQBTa<7rRf#c7L3aS9W89Qve^&BC71- zuy8h-goDtNGxeubR;qD|wNll%nz)X9d|B2t&~3y2q&TE{cEF>K;6o8@;TJA__b5>% zTXJ&5_yynWFjP3w+~BSfUAai>SxUmd+eY=>AMVPZUQ2n*-#S%0$~{c`%G961g%aW? zS!F6>2Aa(q=ch<4u=3JNYg(9Z?5`XpIUpP(BDAyV^J~YQz02~K9=lU@a$$z_3)?S3 zGmmAy7jMf}->)8aG%0^qRpmpik}La?yCV%N6^!E(cPu;i{h)id$h5piMsbG~a!oSd zXckO=trA$OFWWJ2C-YQThWQlrYb)(DsYRFV8)`ccsYU}m9xmxh&mnl-K9wxA7 zlxCgfos)Ftv()z67y0t1*eojI3|&^0d}Ey6W*)N1`8y{Ep1yCY`*G^r6RiWQUYd03 zJ=ebaR6kSwR9xQ#sav=6I1Fb=i}NvNPvFt9>lm<*$Xxl}%j4w_(baouPyX58c6%pSRm3;-@{@hdCljnH+>a)o; z>ZEV#1D7rC%_zvS;k()Y$d$Baf9&qs=}k-dIv(~$>c=g;^XVX8U5cvbn|}4z!SbhS z6*p&;JLGS_I#qBsrE=O*PWkiVr((t5KP%oU_%1_pwZZn;8pgA3#!g%@_wkd8SN#t~ zB$qwPS(KjgO}ETE|JKd+joaydnOiLC=h{Bpa;2?V@qm*vRPv1PgFx4m=4npj=jZkY(OOq^qYNj=Hkw~GH{mZq=^W*D| z7YFP=am6;RDSy+zafCO68=wmS*{9im$fI{rDgi^ zH=fd1ep$m%)3UkUW>e_2DbqQ7X;0i@4h8v5-Sco9xuRdmzk?&}=ZQTPY9iGI?izBN zyCU`MW=%VP{42|h?*guzmv0_Fs=xRc<>WRQT~eG7hmglq^NuSX>o2cfI@7;7;(5M1Y>nG*9D0OEKF-bS?nhtTy^>+fw8+Gu+) zU;;7Dj&SIbIy3Py!w;PQpcmtH#Wa9^(6cGJ6!+4 z-W1_(>0b<>EIALfQ+O`LlDH_R$O0y|Fr?rB^R55oV~T z9I&55g+EtRc1QA2o%nzGf|4w3*dZU9=$$wP2*|+!yk15^@5!Ne)Knp;LC}Vv13?#p z9t89r8}cz^2*C(~F$5C`$XkXf1TzT8C(sfI$e+?u2$m3#Umj}+HV|wfApc4B5Rm^G z^xELa>u>Al3>ne+Mpp>v-8FXz9uUwweO?f}A;9Z#*n58H9Xo#r$R`Eza}xw%HH2UY z$S+eUgfIx<5Y|A5fPj1ht%HC&iX|fC91wY1^KcEoeXYSKF2jP5!$a^w2QT-6V`^}K zxEkE5A(Gf7>x#GqZ=<{5aTO6W;Z4MS7ZH;Pd}cZ`79`-A1Rm4RrEe{>Rlfrv!#y_)!N5!YVTuceduG*KK3z4U44wE&wY&YuaMpi>E9v!2c-A*F@j$8 zF=W9TYynF@LzV(DE5z&&kAs*KVlIfsL(Bs)c!(|FgLneO6CoDpXEY4}olAX;ouyDl z8PK{0^lw02ZbI3&f&N`6_kJIP?-7()-Nz`Xf%-h{V_4KdU7ka@2)~8<89PP#8CBEz z8GPdX42v0XF9G+n;eIaM&xdgL(+|!&|Uoq=g_^5u|idF{zgH zmBh~?%VN&r5ARKik<>{J(6f6<=SfdUbkYPCIhG|X0W9E-4}GHzdE*1ODd5c@V939) zo|QG`rV)LxWDV|X(8|VGPsYm7SdaNhA|yk<__+*=05`?p{*LB^T)(@xW6s}^OLW|c z%HW4yu#ZK6(^2?X1T7@YB_z~4Gz|G;hLem4Mjx=Of-#J|6R*d`qe-=hk_yw42#tio?}h%X5c z9}pShw*gi){M$f7V+->XYO3dGZKM`_yG_n z(rj#y;GYEmPyMUIypec;*ZPV9Rg zn159GHUqPM*f0Yxpor_hV8WU2@M`>$g5G@wS4zy>NNpoW+?dnzaQH3|_OYN}Tk)Ix zGBXc;q=bfjZV8hc<~K)z90@F>AczZj6(@8B^8AWb850W9uoUDIck~nx-O&>WcgU!n zIJsfvVU733zA*)T2OSuSG#3WNzT$=b0v=%M3NZ(+CBJ;b0rzu`Bo)5N5@pP&%T z1+GViId~3ohOaHSgLc8mkSwiX*qZCxThrkC7nrM7_+l9T#jW4J_yc(c()tHUn= z5K>jBx2NusLvZ9p!lEgzt4jr;Q1v8>M$N;Ak2V( z?gg`d4Rs(ZcOgtB(%InmLg$L#}a}o zgir`uAtb}tuR0AjH-skm9Ra}zetTU7eGH)vLMsGxFI)a=;DGzR0Pi8vP3u9YKq!Jx z0Ri2sKmRqn16U}8S|U9&9j!dU-ON5b?jqu-qxik-F+6r6;&LLc%E#fP(?mKEN1em( zgF3V@x&?*!{Uq!T-kVuxNn(lMW0^XB9LG+UaeN4l{A0{oMrX_=a8NWlJ`P9t9Lwp9 zIS5gY%7-GfW>$n?VM%99NB&ZDsC>y}L#kjB#e_;rWYwoiCa`H!Wn0sJEfpSTcz-2lFG1)WjC1VW79 z8vw4lk`8Ovp=$;FOa-_Fz|q~kd3K=u@vBLG^-=tF6bU$iz|Mk$802^Bfcm?KQ%%A2ZQ++ zqx^;_KY9Nk0jz(~9)=s>M>*0N0|b5&l9xn^K9!b$`ZpHIOEmius_HT>s;nN?6@x;e z&rRMj2-RnHz9BcTz!1Y6gdyVKa|l8$l*i{pXDmVhtly0Aev|d43hH8=hT-)Ao+RL5 zE~zj)Acp!^mh8_&)I&7EM@bamm7*Og;8zlo&*All%0#mpQ>(}ndk}Rb=fKOsCSZI( z2;|9h=BC8G>H^yk(7@={aM|C1Y7pns0(MAp452ZlQ$b-(< zgXF{#^`rSqPvtP=M*aQ)@GpAO89Rvb6OcT|qHz|@YCzQ@ui&E6 z3^1{V?q3Wnrs*>8Fx@eq74(4@oq_hqkUj|EqH-9cK@1m?XH!Twf^?)em>2r(25<|2 zqdhp(AJJs8K9vK5N8VTo7^udMAMu z#Dk$AKA=Z)0i!3)zmTzEB!m zs2=0N@0Vl{opA^Opnu7_(81c=-td13(apI22fR$ca3CVF0zzYDr9RaZMxCHS5<^n5!ikLT4x-0LE|s!Tv_&P8vsouVc^|{3xBc5I^SwToT|52IX%A|1mva zNJV=uh@UF}Up17_Lr~8|5PQ($P|sLaV>GXsQf0CB1D*xo4R0rcqib*;pD+%afAs){ zWY#nu=1YVynU5Sb(GdL~Z%D=N*z~ATER*@DQS3ZwfF;7i5&?6y(L_Fkg!YHgh3L3J znDJM1dbT4vF6&08lLvHu0>+=~a{;3xv3_(qbf8oHS9HQLI;D}L(@}^1Iq_F?lrTEp zn?|P-19Ue16&?CE#2?jB=$IltbAo;Yc|AkO4PoEF91)B37P4<-F{=bL?x1~R$W3;G z30;>70*#4uE$aIspl4Cj&o~Lcarq@5X9_Tq(^^O`2RTL01@LiC*ex`&2|hc6*+S?a zML=PNy%Ro=zg1{N!gz=!8}P7OBvX=D6WJ2jqsLM1uyBDHX~a#LN=85Q0S}Esb;yU> zoPcyWmQVNBe4AKtbQ=`ua#Nf!I@o-O%H06@jev9eksiVF8}YE~p>hpT!Fti-$j4Al zJ#O+c6dOXhXj~ORJ`%Lw7$Q6$a4j0mV`MF+T0`=!2YRw5^Kazx1Yn8qWWiV%ZJZ)j3BMe0NU+SBO*@%uk{2$3j zq|f}ulStbR(;1i|L$u&RaufsbD1aY>a`65%<6*ZR;tQn^6T8LSlof;k*&{{`+Eo>h zzw0QS;X;hBWMt2dJ|BT`K;c94(O8C+8&qKu__@@AHXyqIpWi@lk5113=28j|>lo{s zC8HLEnM|1cLpiM{VV)uCP1s|Y9ge!TWE6Wr52{oI`KnIQ8Mlb}m#{~{jvQ`JBOBtu z?{*LxL~x;Y_5mIHd^)2N&4-vhI_5kMd|NeYV@$azq3olr?oc6cp?11~^V9M|(0>R3 zj7Sr@e!$=L^>XJ1NZG{A2}Z}>Ws(8CsFsL(I#Oaq)>NPg$T1l@hm$#-L*jbb|ki&J>K! zfl=t7_A0^v)&f4{A^9_;7NE!!1%RtUPBy|mO-Ada-^Pt0>Mt{D5M})6b|IQwaJk6< zdOg?Z3~5AV#B+5jUz|E#&K}pfixzFfUZU4*+ik zIJ5spuODW&qD2I(Mn_Q-#DZrg&{GEkG2$kjAuu?vW9xL##>BjCfZKO&fERR&&X|ZQ zL+qoVetie?blB~`kq;BV65;Uy8l%a_e3%bS|B4PLMyGxhI`g4E<0k-rpgj(#J@|Z# zuZL;mA23Xz=7ZZE*!n^p@C7SjJ_Gb&;~Lr@%^E&9t}!)@;rju;D&U)qf*&ygAN6Af z;O_-|=(fQN!HWRC6W|aHUT*N~K7nt}3O7Ug0$X1X?Mo5s5+_RO=<;XGZ4Dhi#c z&Q*ktjJgNwwZYPHeQFBu2!JaM&O@WgKeK%D*-?uDyYF8u{82lLpd5?)z(+#=C!=-6 zZ{v)){vy90wH$43@|#fw99MWEP>u*NTlFEGk&N1DNNr*v$1%-J%nntD^b=#GD?*kP zkS_R$&Im#IF};uNGr{^Nnso_vCz-r>*m@Y@z=h;674kVjKHWh%1iMlvkz$s>8qG%j zh8szkMX1e<#?gG3$96uZGmtNB%s%1O9b-M@3|JyOsa2zoqfnsZ3K)N0$Ivi355}NV z3Un6y6`fbrs6Hpgpu-CD6+h7VbG!CqbehJXV+wTM0mh%{*kE)jMxle`0bMNXEKIST z<#80*RAUka-(SY{^-M_b0eRp9xnxa9HO2cJY;$67kzxrW4sF0;vpq%*vs2N$jC$tJ z^^?c=?hCaXO%E!ziFGXP!(@Hzy+>=kVP0GnU1 z{R3nq9vET&9EF0SJyiQQ{SXLPB0P&~es4FT zQwnre1IC~EHy5LGZVWoCFmG!A6`eOgL4+q|6gqCGJ|K@;zz6i{0M^sEToP+3*qbBf zYQ)Rqz)RRvht)E08-!GkI}{*;OK=PVyNJK6w=nAxUvCvbeGQ-d4gUlION8giDD_4B z>jOH%e?_MT9X*&2JO7G*Nf@1lqtHQmybtWJCg5K(;@=hKxW@L5v9$_? z_xEv)7zC}GD?}qquGOYaow+DDM;E)Uk*FBhh zMAk<8^UN9=a63^sZrr+$H6fOgK*sbUD-fU6^*8eL{S%TW>Wk6kz!d2G01T+kAN1Kd zjLx;j(dnRh`Tk$g@yF;`y!xGvB2*z1CX=c2pVo@Qky$#Sz z0_-9lMZ%sQu$EK{`J!6r3`zKn>2i~6;RZ$ltRY~j4{DT1vE(Mlzzx2- z7<|rv#$g7~z1TLSKZxfkn9f0)qlf^r3sAf61AbjQoiPp71LHr))#!FH@Q@;p*#En1 z;Q9yYPc$!opmzVoxVZvYB0Q%%f0uVe=RVN6`d4%!Fghh;(3u1iYRX^HQNZYAfBd~Z zNIvLb;L<)2&-F3+SPAl>!)*le0YjWLiAEyHLi+IaGs-s~;F18Bf#0}X4LvtO?VJe< zB2`E?2L7|Yh4G2$PNpnStk5h0AP@i@Zo|RfhTLZG8y5^cZq$#dG?=fU?sHh-X2due zTE`LNsEUQ$IO;IM7wV|q?|>fd3!Nbazwvr|4z6QRds)Syy^ub#y&?dY1o-m7e395V zS_Zk*0j3V=UXUI_jHBQ7lT4`PEM$0m_RIXX7~9`KFFdFpg)BC{Yau_0PG_VIj)S3fD8@fb4`J&=6DsiU?Wp4b=O5~inbTo@ z`$lK95$#Mu>&@ZMzhMx;^R^beM)0g1>I~x&RnSAg)K{e(S)>q#q| zDD(%W*ie1wfS(EYYXVU_1WUE2_gWB~0 z=HtwHe>2al1}qVt*BsrW+WU$y|Ahd?pZ70hF*+q<(AfZVO#Z4q9dl8APK_VEJ{3Sm z^snl33Zv6B2A%QHAUa_D*?x7$=+uuv#~SEV{uLb>MrRVw=N&a~0{%M|Ej{8fF-FghV)&_VNZ;9t?M^bEb{`di%E~xRJ`%4?6V>bq!BA|2Qujus6LhZ62gH9jN zNdr26?)S?W9p^FV=)pYa|5tR@VRY`z7@a=}Ku7Pd=%`_IibkP>>=(azFdvY+@$-go zk1k|i#Q@xi(#?3w0ymibg4t`>x^aZPi_QhY!7$a|mo4~XGt5q^1$umi{S0SRfE}FU z0>d8Jl^+1!%G%9XO~%U^Zm%-!N=hWmyT5F3;Twu*zMc>NBw;?2L-~j77_^q!I%M19 z2TKtC3izkW+0FQf+Vv|w*AV`YJ)8jeJzU-RIXuXMF2uKE0O#ZGW8lU`OD8YI3;?)AbSJ?=p$gJrm=0c$g)|@F ztpJZA+5>yJ_$Qv`~mqpZufyK0}hmp z*?ow=p@=?TH-iU$GcQCp0pOAV7oxxoMi=r9Ki>%JmS}d$J|v-FbiyJ;A0v!bDyV<% zLw=5l-Ha(jy@sD}CC3i(02?W&9({n{1NgArI(Q*Elh6WpQa2+KK{399y-nE18-68& z@lg-(Edc*I!Y3|7e+9rf1iBeVnLvoK_5(Z<;3}w|#D(Aq0KYxCn}M3oyik7}19&;W zHz45uWAA;yayXj&<$22rU7U1A$m zq?HnM$r2PrtsuLKA~d>Pf*@Ac*2->cx2P4gO`4?pyr26%_nDdJfSrTJubY9V0zWO}4`Wf~jqAYx+_T|+ zV#r<11586{6K`53<}cwMBzJiV@tFm@2KaemMy|HEE+J5gTIrnxwrTJY5$ zxYMzoO8U?Ud@1lzA$!H^>pb3=Nc-ln#l^cpv;nHG)J#ptQ#o#?`2S?5{Q|{3vOWbW zR4Jl9>Ha#UH|aRkZ^)lS^70U#4&0x%)3LvU@EqU?z>$rihwx(H0pRzBP-S;2fUgD~ zwo9IJU9l)%>)_rC_p?NQBlDH_hlj`QGzW;Grb{~@7Kq}pnfMNN>ILCDfOi9rtoMW` z9gp<8$fpDE0v@TCB%cF(lM7EV@DAWqZ2BSj3g8=E_-lc;y6`swUkjXud-@@s7U0dm zeHz3k;qAaz13%Niw*sg5pKRa*z!T873K)3GFQDIno%ZwyybRwnfNunTe=OxwMEj)% zH`BR^-c+g&gI$y+k{&c59P7}Xyxv0gXRmrtiX|$S+ND}m*ji9+1z!+-l9wdjk^2Z` z9VY0RWi(2C&nY*cg2X}tiL6g0S*XA1J8jzTs2{RtRlw_kb9>JAY>uu5 z+^#jiy$SAIe~^Bc_-4|SwqyQF_T`Y>=!Adk@Nm1hjM}Hjc?#NZJI(Mf{U@>;DJP&m z2LCtUyR!d$zD2E@!tzR68nVB+kZ*?kz9cUXjqBUczD`~lOFuRZQfZ^MfWvJaFA43` zPa!dM|NN8th-YmSo?`H!1HWOJP$L^`xD)H)_`YmOgtAc&$YSkJUhU1UQ9d( zGS7@CJUM9pjt0-r`n+ic<}0?Gu?Ssf#>3wc;X-Q&{+o|j|dxs!R8Md3-pfNVufJZCb`{ZV*| z!BZX+&nV_u7lo%0Jg0+aX#2czIpxoWx$gP16+HXK#Iu-r?uo*ak!@LDK;wsw&uPr_ zK@^@U@T>*T(B-~o8KrAW6rOe9xico7b3V4QYcXriL{(KdMXES)VQ4Jij{d%5x-i*SNjsfkun0T&ap6M0t>8b!v zJ$Q!JpQD)PUst&Ew1DT5n0U6{LHYAy6rKU_oEQ_&L(KF2RqpZ0J;ky{#Kdy}^Bh>| z&Qk}T&9DeV=g%1C8F95cPbYYu1<%m+tMhispUdaF^Q7gVe;5^gd&pym^?+xxeJHV3&o}u%({Wi*<%3rzj2{B0-m48#B&YvY;xgA zf$hqfgmF^}=J||y>|)>@V|Lmr$iB%#@)f{WKflMW)F3_yuLU05ANw&PCJYI0B>B{x zHqE_Z?>t70YM#FZxP^J)Mw!p5!vYuP=Zk3nujl5_{0y%*K&7m$kgq&wr=1;||H8V0 z%m?XpFV8w-K1dd3Xg)4|GW=s+xJK3`Y(aAUVct&Kbc(ZI#=g$bx2*Q zF`m!mRlwgi%tJ=%MF}WsfmdR_FG1${qn~HpJUB|&%8NP3Osoe)MwH8*l1;j^75srC zcG~};iDaHn-OG8YrZ{hd`vmRyMDP94T=<-8Ar7RkJ$k3TAL*GhU)q&cV!>g2;$;!v ztwj*6g}{DX<9(8_is`h3c8F0Ogsz)BY{K z>xarE4fsaj1Hvp^E3bPm0)KgMr@ehY#Xm^j zk;WzQyibu%pLq|Y+((#3y<(M514TRd5{h@)2T}fGX%OqJ-|`actmFjJgYD!#ZKvH$ z?uAqza2^fE%4ppZS0zb(@ca!s^T%RmegHS;q)vDjON{UFmgNO5a0#tQE*VzmTjpKP z)+-Ct#Z%Frn!eM1dypP@3y}nxKIWAtT7^>kUe8FR{H}w)u`_nspNXAuuLrc;zAtFZ z{GOcX^%0Dk9a$5^AaMG@zxqO~gZK~_*Mq(5*}o~j2kRNu0Vcp<@Ih;;bfizkFlIF~ zciQLTyMA)2IfgG!FsUR zp*kE;M7yHSYxJv#U>$pWB2ETVr0~5k(ep~^M=1T^DV>A;97HTn13oK&XJbqmA8JQ9 z|9PJWukW$Gi+vAzN4RIdI-i<1s2WU4^rn%I!4)KrOpZ%I>iGK3#Jo!RP8-LOLl3gd zN&~(c_=l1o%RIP0sE+P4l6%<@lwReJTqSzRXi8~mhRUG=eA)AMs`J+}%n5;!ykknh`0b zPOPuKvp|AAJ8|K%f&lH#Bt1?8J{CCTg;kLpxDYtmnJnO?z^4%o?Z8T3!kKh}2S16U z817AQKbG1XZU>M%9Dnc6V4y{xaRB!(_@NAdZnl}f0siZ+-D!`9cjBj2d3`W~!f%0l zE8MRWciNSHCY@TwZW4-XC)@)IciOi}x$VWS()#=ocRf>4B72rzg!Epw)Bc{qgWZU{ zzkzO<_z>rHuv10Vh=_hu3H*({UhLrB?M*K319;Ru9;(G4{aFLP)fhXRNAbYErp2DK z*F$&c%N%?ml=p#jLaqyP-x7dWEry-1iNhusGP`J&a66bE)`9oJP&xa~M*Fu|#tYEP zQ27JT2YwXs$V2j3z)OK2#1>yU5MBtp{1(xp2>CML9lzOWKRHT3e31Mi;MI`-CH;_x zzBT|adSWoo8j=UTSqtMc3;)}I2Um-}IP~oTC>Rc;A=zi(Iyb2~?3?WI0Q}8>zZ(eQ zaz(#L_PK<&42@5`O6e@jU0!0bE@x&@{j1z_ps(Q3=O6~@8|;LfdzzG7if*NgEkbR0 z$kljB&7gc)gK$*KB@E#w2uwKHh z4eD=ARriY2@8kU!_2&n-gRJR`K#_}vu5{y0`}d*#rCYlycD+8%b06ri1g*L;p|cSM zWCLA-$)}6!T&%j<=t1_N4dFMvEBjWUzt|YUcSXU8^=vELTj5UkA?b(mZ2)+0hwKj$ z2f|Z|VLv|DXumj~+(scCCGI!Z?IKNiKE%)Z(Lf5)sdDwIpkzaxi&aXoF z@6Fm}9}`hO)4^K?+<)RO`v}5ej+S_)QF};RPRKNIOHA>tgIwxKyX+ex{AU4Q1-vF3 z=@Y$M=7ANe^PU^(htOfbK&S^28fR~Yztz9oW%~>}y#sjDDZA{E5qJi|NkYT2^3+{+ z9==DkbKL(E8;D!jltCi-9LTSQJk<>)kNs)VU%bY!lavn?klzIPT_mr@C)mpiLXZnB zmrn!anorwhpT92&s)x%TcyG}z`_YJa6W#{A{@h*mY5QwwrC*zYubsQg(XS)<9mEg( zvZI~yNi$Ht?-?wg4%`ABZ^-8W?|pr+J{AM-27clpPW}qusej*PKXQN*uLa)RyUV`T z;BO@P^d8%r>XdH*?$7D54~uu=?ZC%Q=&?ITJMpc+yU*^ipD^SHfG?fVV~;WHV#@i* z&kK9(ON@AC0N*yh$G)5Dhdjmj%mrS#u*WVUo+8rkLelR7^jANkrgJ^id;R9ycrfIVB(qxx;AP3V=N(qqyI!>0o2w~_s+ zgWTAGAMA@szqx(k`oxFgK`I?gsaVDStliq>S_jdA+a87}D{gA$I1zrR^a(t5p zd;oYp@ChW$`Ef1cG$j!>iThP)Fxb^_hnk3cL2@Rx&{F4d3hjI&>opM_D*{Lc57~uc z_-lf{*_00MkKtZJG(B{Ejdu#)9U!~alzc7ZyKd}J{V+%WjrOHevJsA?lx$549M;AWqzEq z<9iv4)rF9rC+RpHH`x@QT*!Ap{tK#KTyC(%(vQSVx!x3X>;r&6g+3%lCj2uZU3K7D zdTWpBw{ySD=tqV7k)GSs1PJD$AOl$tbIPdRbW;46_ShMF?T_)i68fXwOd5B9+L%^S z`-mxh=@-G?EbFnG$R0cL<1D!#6GInd2ws?q&gq?neys4X0-pKsV0<0%yWpL`TY>*u!lVzfL)(F` ze5A)-5VC)`o*q{rtBS0SMo|1xW}>}#)EOS>RR-|vRj~h}=kDViIal56p{0oI!NUes z0V$kC;9L5XGoQ17Hvq2(elxx+edBW=$Z_oTO@)HM985~YtU&0y%I|jg+h*`lI9q{t z10PF#I5$lngbx5ucpB{}0bnoD=(JV5a3%m$8$>@i^ zmy|+ZT<|L3r3OxRrw({I@Eh@6*%72$&%cG|-1vwtmB%{BuZ4WSPs#74Jn#kq@5es3 zY7VdTEW-b!SqQ(m#~w}XINP7StP_-ak9Hpx7DOGdc`)JYGHuEhFbhG}A^hIw(T~7) zmHu#ll6wouejK01cu<>Ch>^cG`18NeW8X>npzTxSy|O=$Il}e5hq0OB{&5*Z2PnNS z_SnBp#t%1p>zI$k#%C98#(wq%BjFMn&xXvgvY!;cvf0q*w@~l!J)&GOKZo@?nxaq* zLm?Vo`Kr#vHNxK}_P}vZ*sxc0bdDxA1#bevU8mxKZ$UTH$vn2$Ll$R zkw{hlA-56!O?#UH7^b0N3EQhRz?Z^5y0M`r7vD0_j_rR#Ec@EO zzMl4@UyZ+R`|PX0^A$-D`(F3QKfyd_N8woqp0({gG3@iW2vTXIMj}ma@$sR(x-%x8 zH0GJ^!b54L>KzOsQw0uV@h#`*1})T>vEd zis7#;;88i{z~5?w$?Xb};i2$~fm?{tEd=nrk-w7ARJ&6J_e!{Pe;myjiBUP$0WSys z8v>w5?(1I#$xR-*rI-3^gBQApCkO4?%=e_fv)B9kG9i^V>d<%H^S>56$H&C;H5k%H zl}F*Bc6k_hQYl?~jnCuEbFK>yl~XM$>Ne!}LntR-kG@|=)<(MHy!q(J${ep)6_u}r zrIt1B{aEtD=KSb)37_({0X%Ur@x07DC*iM~UT+3ZXH5CAfO!se;i3F!z&!3o=*x1- zkNA7!z9G(!f@I`JmP>w+-tH)e{(+O4J?d}M2jNL`p??NW`kW5D6nHTSLNDuRe7}U= z$FtZ+?Mg1(o8Vqg?rd){UXt;i=VEFarX8^$VcYW@}4}^hD=d{)W2zj zTsGv|X&f1~eU|lcynN=T?i~`ID5kKsgKzBzJ$4-NO{4jQ3u!*#JZevi=>0SKG@rol zpYgOrnMo+5S@9+Db;FkVmV58?@H|EC<;c&EdhGNODxNOuZ$a-9@x}t<k~TC?KlC zXb6xzv=!sk{ZHU4+T3Hm6-qbyL6P$w;c+0XU)=|mXx%C<*R9~|_*;)-J(|jO0C?)> zGCnz*%wh?a{xNQYTNeJO%|m+y_hDogxtydO?e=PEFWx*uC)I`#UV)zSm zN&h{pFKkcs#b-z?mrDxdYaw3)dCI;>eQX3?4V)E}-0)DmTYy&r|A6ub*QsKk!{eB^ zU_Ns1gnQ&!$CZ5B_l$5 zm|lVM_y*&FP2yoGWHW zUAmXj4v}5TK>Ie|j-|bw45_qH{sDKpR0WVJnO&{h>7Q||4@9UMu`u# z%RP|z8RgSn`y;i?lO2Vp5Ipb2#50k3o{YlN0G`KU;_)!geNlKegJ)4pJa6ow{Mq8d zL-l6emFRy!FQKNPCkNj;fd{X~yY~o1{fj(5%KHJZH_!7ROb=>g$n=OlQN2&O3ickn zCy{@yA3XlX{(}ocwVvKUMuQdVOVdN~DTKejefoo1pMo3Vr0-?G>k*%?slE+m$AezW z>pGB85v2IFfG-pMxo7b`!Y&~-p1Tl1wWDB)GlCSq?eMp8dynIu0K$Ehm@hH#4B%Gan;C(LM$vk3$A4#h!LM%DdaS7Sc8Pv%)sZp-O?X>uP0?qAmX#XgGYhw@!%lpL~4ZD?#G=@<)1BFT~h~A}9})t#3Zs1K6^U3FCBPoE>?;AL`5E zc+5RH`rFu4I6efai#YNU=Q?Fzn?YFy{(A8L(u*HlpP(0^_J&^bbA_6qfHTQAK)wm~ zf!=SY|*ZoGO8og}4rB;N-4Oi!;pbC{M#|0{Bw-Wh7nxc%Hg{KI?glSzNP@o~xi z3moH9&ERs_HDSYn*w}ZLK*hl)fdw+~48i{Wa z@r~-WyC~jaKHgUx)?;Z`TjRW+x*G=02;yr8U;ci*5%1;Pd;IPlB7SLA(EkH^?ayM2 z-#>L5+Am*1F~;xSA>!8vzKtcZ$Im}R{I*m4F735% zj;4Q+{aEZbuG!1Lg6wI|LW~zL?{(axk_EgNcq#A!d{_2Mub+k9YsTwDxryh>s8IDE z>fkSXKHis3{^X%>Rsr|V>vgo-)V{0(o&fw)8lOO4Bj*`0sTt?l9-6q}u@x2s!|(T0 z=9Blw`>J6ND|+pxg=f$_dN^OOPtVips`c1c_Xk%86%g5{3WT%mie7s~$eu(UN09yW zYy;omaYT6iWF7djujzH%yFvNY2|NfqvR{}6d^_+|^uu@^4DHZj>_bt#HyQt5r`!*R zERDlxM`t>|rUSRYhw8%kV%pe__9qX2r}BdNc;3HV2)P-M+a~$AjOGcP=S+fhRj8xi znal4nj_irzK2d6GBj4_;&QGiX|F)`LHIGDb!Bd9+ZNR&MzZU8bh4U3}Hm<`xNf=M@ zd$O?J>3I{`>bBhJy@&LD@I-#7y~?;A?aRVm`;XDekHZmr+u@;wwQQ)4v97At*)kCC zMc~_X)gF6&XdH_6ir?eseQvn!^HC!4P`R#w{L1%#Q1`YnD(fG>YZmp|zoK|?|H4t< zrlNzfoq7xfv^5-`6a(TLfWM75_u2)*MIWT6DL3HHuY2u$>VI%M5YA7-ZqxV_m&>^% zQ#Q0wI?IUfmR`G<>>|ex>j;tkA8#3Vi)mqt^t1u;nRoO?+)p}&V%`$#BVGQWy@Z6e>Ft6#`~G((0B2mDfg zWh_GdsPA>;KjFE+Yk(hs@A@IU1o%?m`)ClKgjWHtcfsp`uXMpz0dE3+p24#Y_%`4_ zHSkX0-G+P`WVQp(UeRkGLGrx+O6}REpA@g8UqQd&j^ShIA)Fq(hxJ^GU#PBrgNn=Q zKFHH>#~STh*c2DmT7+nCTzsS(xol^e$|*{7K%08!i7R@4^ntpX^<@$?}i( zF6^@W!@LW(S$>~)VYlUv_b%+U{9fn)K0ad-F@PTSjIt%AeA<1(ZlG&y1cJ8 z1?}C9G4Y(jJa!bG67WomiKp*zickEb?(v~^IU^>XmzZZv6rSzi@y5hc%{=$6a*t0I z+P6<3G4y=VNz8Lk6rM%kc`hcNU5`=zyc&h44LnO@;`u%EG`jGR{ajT8eSE0bKFx<8 z+P+Ux_kOFl0OHjGuy`~>k_C}Y$On+uGw@yYi!g4N{YcopMUx3IYiBt2vXkB?-HiGV ze?JYi->`vobp9veybF3ijyD2LO`Pv+t0_=r8%n^JiZtCv0QwX30&so7IMu&Ja9@l5 z$j`-{Zb2iw0eB^HWIw{?A$$$+YT$ki;*;<;k>580r+&d^k$;-p-cLbx4bo{RZUilO>Ck{VQ7>hmUU_uV3 zfoOY!>fZ7Ei4X17Z~xO9!#VCNA(b}DUgKUb3aPz}iRUQhseZn~6Ri zRMD~Wg6;a~D&lBYXhM`ctNEDpTIdqO*+Br;zjGY(E1r)~`N$0q)z@OkH~sMkwZB@| zSIh$zEcfNhhPm(J#7h?BYavhZeW3_HBIG0H4be4)hy26})w5Ckv~}>ewy)QIi}c7y zC(rZZ?G_VwRn*bro=iuj9Epd{as9sq{STB`vFPOzkF56uurQ=oRxu$-d%;nivEEaV zh#L{*JH`MZp?qEkDgoak8)MIhI>=X}tRJNgip~c|Kk=)0NDU(L?#s2KnaGc8Bf@jjZo{zb8z$HyN4WXt?qcF+Out1G4ADm$DT4gt&b|0U&?n zoV0Q7+w++69x+b9A?nbM47@apyi@*`fv+aGTfMK1>nY~>Bge&b6LuhEc*ZBH_ku!F zNQ5T^?b)93v6Rz?kV+eM0{)tIlj1||awkdP``*{pRxnSR3lI6txefLQ>H0nKKzp$c zi?N{EAw%vZa9;|)cal5rgSj;{-$3!$ig>*K_U;(kw|YpWjq1;LPfrHg)4O8gnaVuR z7YybhJDhYo>Ko$w3d$>Ff0W%8v;DHRKgDc+pfF^Aa^bK0PrDuWBXjzJry|6t=|{X@ zfcwzxU@gb{3j8(8lkFeE3Bv7Y#6>@pzqx1!Uk&udkiW|zl{TuleK0@q)PbiyCY~wG z(;9_`+T}}P;_)$0+|T+3rI+H9R*UC__a9Q~ke?{e z4=sG5?c*270SsD2Lz5WM#J@M&wjn5NIk@E!4g*p%<-vIfW z5wGk}JB;}p>F?*&#TQ~7F-`X$av^?nrtX0mt43w@xB^$a}aNA%gJN8$Mb^V?yb35ht86K0Wf*Hn)?!Bcun zpS`c7C-S{Y{F17MkVnLan?X)T724H>$Hr1$@*$Nr>Vk3Z`ne7~1u^k>nP*`X9v|AZ zgCQ}rp1%f$v{Cb1cql*CRYO0JAIBm;d}FXr3}q~Nf;JUfW|-bZe%o9XufcyJSg%P> zkY_c2kg@{x=lDJ~56HTL{>llcYog=ZEaYAZLpIfI$elQ9vwe0!O3{HV@sCO2McnN~= z-G%v;U-a1@NO*(x%i#0`y+6ZY-LV12K&BuNM-P+eC_QE1uLu7R!XG_74-by||1don z2%{6>1+x0o{aW1KOx62PWc=y*wQg|8KKSlN`9QwYX)oC}V1nO!8w|e~TI8G3N9y0? zz+e7}efA_u7s6Rga~Nn{=w~|qm%zOm?pF}N@d%A4XXtG@)c({$t`%}^B**$&VCrwC zr_N|_upM3)C3B^Bh9X`CSFXuE$`JRWt(@e7eit0rJ_%crhAHM5{@HN0^06$KH_$0gy zc#VNmzHA1*8aT|atdoSF_hy2rov8ov4z6S1NCr7$p3U{T!R1ezWJ_GK#R^8w=R#d@$vI8Qg2& zK1JLmeArhcpJvZ6%s-R1D`GEm=JBH-4ukKi!agiuMBQ2G(Cu4#StSNKlpl=hV8XZT)6REEXzn5A^I z_n6_m#DFFx&UVVE@leYBs4vs|?B9j>(LTugy~6yS#gS}$FcI=pKE?3g1^=|INI!&E z0N(_Bfd=tOcrEbYd42ZEi1H-75%|XQojh5}s=@U%~65w`|WS zoSa6~&(c11UQ5Cuycl?37RE4w(FcWJ0X!S{4I#U3w67e#)Ta)w_X*Rmt9rvFO5v;n zUwN5xJV5!FgLd!W>m~hr-8cXJbu>=;ZKeBos}?*vATjiM>T}FC-y6uZ6!Ba%VdTeTv+-41L0T$#JyTQ8gzgj#mg~ zX_Q8x3TA*J=^=!7NuPZ=87^)o&l(jUagN%%jb}Ys|0%9HkT0+3Q~U2&UeD8e+Ev4* zHn7)*TG;}=2e%6T{8u6zaPYb?7JiAZj`)CYiN_DbY|uE&d&4kQ<5jdNA}J7UgTKIn zJ~huu>&&++zRkc_0{>OWp1@dy>`5@gp$9I1gGLvYNkAu_aewA+zI<7`6Bl!@_jdGa_Eq2xE+&qajF+B@Ye-@6sCpK z9*aE%p@^{kqjs|%HJ9AU{zZL1&iy1cYCE{hd3EBUcDWG}++OaLXFBtY#9xyq2Rvnu zU_J$5Y@+zEUK{H_7?F8?hdLQKKckvOo`*|9yLC@Y@wklRG1?^_l%8VnTpANkfO)=k z$rsAgtVdBl;5LWSgL;pC{3TiuD80pSCx%*bM|z{YA61s$RPR8~1E<4F1N>LQKbCcc zzld7@Gu1sMDr2bLuY=qs$kBKG(DzQ@UBJ&KaF)79h4gJZ@UbiU?6;|(qwE#zo7_u; z%YHE@g3js+`c#)UK#cg(SE0Xkx3irkJO}t%7rYpFvkP7Ue63C{t(^qxMoPgC4TKZ=2O0O#@j0_Zlnf--HycB%^QMfXbi za(#dfM6QQY<)5wEC|GP|>?dJ>G-!5B#iI>;_24UzIM7E4{%;1p5%_arUzU5&pIqiG z2)(Cw3bl`P_3Ftmx#pbV6z;4Vvx`zICH;>hzgPCD^?V7N^&hzP8wnS75bM{Y;wRR5 zG1IKKsRCnjiTTv5%Jy5Fv{uCH^X0CCTQuz+dZ=efFvT2!Fhu zrq366A044;Gw0`4$alPia6}Iz{g}m;dsLura*y03>}Ot&<`;;uZ98KAFl#l&Yp?X# z@5p%RPP!+1Io%5#c@9dq=cLIle4S($j`{QmRm_ zw`WA`H_ylNX`JY-r%lv^^(5&j*z-SPUU7uZ2csN#d?w{upWva1P9x%opz5elJuU&? z>W)5p2kAHGEA#RE$)I_`Qg4QPzc0+U27ELAjCw43GH9QRTR#GJW|CnTNR=sm1K?Zw zNuT``b>fV2H{!?Vvv#>hkSE}%UKT!$_T%$DdsGsB==K%s(39!>D;BQl0PG{u%u@TY z2=W`hmUhKc&j*I7{2G9lZbv^B-xUw~OFUmkbIx+UcS0gAEk+t3wWTr&wib78gJZ%_N{;q z!pN=aYM#3Ua%&++b%Ny3Pr^_^jWp5#ErNUMcYXE+!mix{KDf|(fr(8$KJLO9i z{I#aQ9|4>%$j>@jUtQwEG}_`}RNMG)apZtN4NyrhS|~na`qla#@2k3Bcfa{eMkm~x z_Ts(+?wR}d+YJ;x`>zZ6r*x$}3;PN8dF0M|rRU3e)?dw1Pn8L4lmv-UJ{7{>Hu$@e z0C_0BWx#_6^sDg?^mt}S%ay-cxLc|H_89F6pBeby2s{D!aiVwfo+F;;d|rFCN@sz7&j$vfp|Blz;cS3!V06t5QGO~C(5 z7{ZZwp>;j|nc+i48##5RjKuiI5Xz8CW6kUZNvB)O)HS-6 z7^3u0`qG|<{e{1K2;}rR_F>Vvy3e(pq<9xXe&b>N_Q@eT8E$`!eh)3H`{RWZG__#+m(q1=&&-GI}+aW*pn11_s3ZLbnQmWlVS4CEruzWcl zKhz}|`H58!^}T@n9*6u%!Vg@^ss=2P9dW-$4OQNK@BQgCS{aVfO8l~6%YAoxy)DCO zOf%u#3GYpKpGP)$57RfaJq<$}$QK#%2!bB6?~4#_{>lAzH35k4VqRb6=}A3Y&>L-Ph-h%e;^nS;Es%5})fNu=;+tY{cFVY}$n7h5fy_8?N zcc`iEQ2475PV1C@I~(7vl4QTWr*<9iZNRD6^h5HUz`KASszH2GUTp{73w%7`oZn|A z2XMb2b)m>T>G#l|g0S6R>^T#|p$k}m+%w=_4fn|*|7Rx$u2KFe+(NjohC5}ue#l=L z@Fw7w5{Pobsw=HFbA2a0sD*ns+!rbLQV-p=J((_;mdzxIr;B4;%n2yzp?aBx4q@~7J@%2I zdd7AS2E@}DGJNW|D(iU}Zw_?gD%HK6`FE8wOoPWv% z-UhrBcs<33+XKWWWZ#Rh$Q%HG0*5u9m{=Y8Q%1Eaf0JHB`JK_P-UD>LYNsdgZQv^W z47hKEd*u2d#VZ$h2k^*pC%gpstA;$4V-@h%fM1R86yMzB8J@YU4Jw=lxQ{-wU!Akf zL%p7-?tNYZyc+lkL$~9>%`VVLItNUlK zNg8I27@ja9e#8iW++u5=q#O4c^{ai77wt3p2I3-~9LQ%w{uBb_X~1VO@KWG6`tXDG zklO)6583YUqUvYvhG9Hkq#N0=p+UwxDNf+@g)|qPi_nlBWBm`|FnDARLqhT0j(Fvt z+i!bGPvjxo_Y(SN#ZH{^BMo@=w0`@x&^Q|HpL3oC6K62Um@TDpErk5a8PE@@7r1xr zfH>UvPeB#pe+9Xp-*4|GAe=8eKI8T=JkLSr%6}b7Byuj4NSVhZzIEWszo6gV5~}av z{$6IG3gmz<>1Ei{i~8-qNc`OQ6?jmA9R0UY|FaPOmtNd&UlNLs zQSRaNO~ySEsNF8nk@G)Uh(jazR?m|DG`HtdM#b~h>eOdKz855(rTQNi;Ri)p>18MU zb-^DEi}b_g54?JIzx}la@yX?n4qVYC{dS{)rvcvt9A-82kbD;Knlh&yBD@fIHSm2y z(u%(Hi1E2rye*3N1@)Mg#&0IjkRgie2 zD~|Tj6^|i52N19P`}*xW4~Zo|M|j_K&rcqhv;Mz^`oDH?ewG2R0sh|qf_^SSR9nDj zz0z;bjx9fNd4@}VPKcVH5v@z4;Z+?P(vK`m$aKHfZ?6yFM_3Qt+qb4Gyj$G!jVm1G zTP^r1KX>L^2JlAU<-qIkU5#gC9wHcd`zSf8epx%@H$r|50cAZlX#JAz2g;-im_$J_T_bZ*(ANCKH2CX;zoISuYCRchyqLNy zFrYNf<8p<24ctc(FUOPbbEXLppT2Dp7B^Hs)6s*=yz>WjZw$Q9L-Ec5p1&3IGz6e; zO1B6SUJSelI1P*SLwJSAAF4ro=HP!V@KVUXO*qFF6H-Wv8UU*IqfQ1gB@s)U$a2C9 z6Q|?v1l~{72LIjge?0j|?vx`QRBoGrr+(3ImlMvsbaf||l_DxO#mm=*@F7<~a@6xg zC!6pz;46XW6D|+oS-?AhU#LNR5?%U1wJ|=9)r+UCn4e=TM!^nOZ?j=8YFMO1LwcxA#^?+j>N%go9_)6f} z_^$N#T4=U_XBXQD1Hyun(sW zJnIYYDJ@g?%+$qWIjJr|Pj_KENlt(Ld z4(&qwMSMvcG2Z>{fIUX|+|TjIIldt6CU@yqNr!>*vjltz4-VK%J@~=-iScvfe#*0D zy$#MJUkCZ}rUAQjScH7!d~Z&8zL(_JL4M_91NL-pguGgR;*Air(v3++j19*pQaNmg z{KnM-_W7hQZt+peg}CrWy(njVVo|8P$$!S5&>pQBurI@Rs?U+@F|Zk6dlL+9A0 z6OkVk@Spn3fIV$^MEH@@%un%hB`*PHL8KA#`7HzXWXeD6vCs=07}zcLdDq0PhY{NV zU1^815VXWw=OKORgul{13=AIs0`CPrX#9(Yr{l$eLGwpxz_$VCb{V|%5PueM|Jnij zbVk&lTzs^kUH$asff)LMPeUqg)Yz8>-1|S^c_t>FOPS}oC_K4n|7svHbpPiN=6TPB zhx9D{9poqS;Uh{a_A}8sY=Dlt`>}R{dWvP~g!R)=0w^acH<~A={CN}g$XBG#8>8R2 z#LIg-NlkV~t|`G(q{Ckw!r6v6R8u(6PZbVYd!xN>fm{$V&LcVM4Fy$u-447OI8`70 zPsZODBJCN;5xi+E(GA;qT-a;dKjsCk$(l9zfsOF}%9jx}&!3HKu6 zk*5%!ZNNK#_lVsZR4@7V-&;)sJ28>2F?ZP9N!*`Gc^7)~>cF7;EHZ#s13!(z=KLr~ z4qVNp!}hBX?knMbE7e!H^S(D_kMi_-xaS@+DXQPL2=cwJ57_vib?8jbTdEuz05rD_ zZr|4cUk#k{LO=AqP2?wQ5T6S%%gg7mG1W>y@&SnZP7pB zqB2Vd9(V`g5)bTNWdDKZEfIHlzc;N)VD-zjWx%>vz7H;g4>rN#Hjtmlxn9)>iuF|U zr)wyF9}U=dk#cc7+~yZ${-@hVFU4?apww0b(whPBC2StB+o}Bsrz<>f7VbYxPVV-2 z?{`lZYcRDBh3{kjA*9Ak0F2Z5S|l7zF6cV!zcL);A0JbidQZ00C2LEWY1}nl*&ET z-mZ$mx6Xwx3lyEgH=6RB^$03M`=;uLdA5W`JL8dZSrdmC#V_eY*dxS)yy=JZIvsd7 z@bJB8=*RKBWVpX2zb+nzr0C{^nh|&@4s071*jH{y@<`&ze;NGy|2d%E$HDQ@>nQNA z_Qjpc{?At3Ezj9u|CF9p@ZSvoZ&0MP{{q!7hj#?8yx$r2#_jNC_{;y-fc;sdzli>4 zAqP5FBCP_Yd`Lk<-wl7=nfKEqkh zdA|~EEWRkRV&fG0ixKra3*ptl|HiKd)VvJmFWW!t5y4PH#_Q0oheAIvLqm0@4gQ+G z9#Hcfh$j|&p@moCZ-LZqHP5mga@!zRC;1}xnql8rosY-ku=jM%Gw8XLx1}KBC;%8# z7@jit$@m!dVf%pjKFV-=5iXyp)DB)i?FBGnhYRf-b7|@*QYxMe2&d*7>AxfR$a|Xk zy(8dM@m%a0&rbO7hX46e4(|JzrTi0?LnH#JOo2C!6;#)PXOxd%!-4#z#nZWV;hyAC>mKK8_CdxwJcY?ea&M zQE_phn3KNjKsepI_O35f-f5qpyn6=hRlX?kiR>RBKHaXNVtmjEhrxXto*J(|~6K5BKZC_vMpa&k^_iob_GJqrRkSDXLBZO;u9$ z#dn@lrD#yNi{L+X&*1S&18_g^!%481-}BD)aSiaX!22XTsTb&%$o@jE7qoHYZFTlK zvI0v_lI+?J@O1rWKK3Z%{uutS`AZ(1m@FE=rn52ghCe$P^v6vn>dx$g@Y?$IA8r zExDX~<@5P$$LLiJA0%f2h|C7!uh}!$lh?Y#hXEt7kym+Ni?d#e%jaK- zU&VRXd#szi$}wqG+=Fp=5#jCfd*4Sq|3tNTcZ7FkqSZcfC9;NS`{Pc4K6<@-yjGjg zCf@8Bw#j4NFCG)SMz2{@?e@TC89#i_E z>xZc)O;PkGuxju6A1xPt)SqZM^FPCf(x0XOCH*mDZR$^R6#XfE{73yU^X|X-JET9- z4(N77+XE`c$oQDQwY|_X=I_iK#%m}3?7H6hyUF>pu8*odOp^BKau#_%3Aeh=Xux!0L| znmsK2`?g&LOsqfohsz%=@8T2_6xIJ7YPS(>p@@8L!X8I2{_EbO&d%oZlzj8^&T((e z3(ntB!;?Tv`RqT$R?d-e{BL|8s$6tBLUCF9e`h*E@%!=1|F3hP`$cCx-1O=HUHUjw zJ*TZx^lTD)FqFKK-uvH>Ei#*cy?gtwxazo>cEq$hTJAqGL8O02i)8-+s$H2bpCk{j zH(e^fqxsYF+Q0U9?GXO7{1PL)`XT&jdF@|^_s9_bw0w&ZUfU4z^A^d51?O*#laR`5tql8yHgg+gg_OHX6H-x{Y zU#Rpq{h&SrbEa}ulHQ$!FOTX(?^;sWO>mS|nnK@qlZkEr$%zP#b z&Q_mA`tuU?+bWaKaFDLw#N61ECr&&$Fm~GP1y@!r2xN`R9+!2@@eBCZaW@{9H7+x2 z+%Jw&xMhvI=DI7YX3fTD)qM3?uD@M*Rn?qv<0nixrfSw@);Ruk*_8{%&0a9KqU@Nt zW!AX)b1G(ytE{N9#?8HQF8)@{sjjkS&a9X_`;wWL&Yv@9{+w%OUV5cQs>&7~vBq6?$t5%AR9`ZuvT7z0 zQvsxkxyMz_zUCSg&6%_2&!2Uj#bN93mtQj98b^YZB*X_qS0O$4qmrjMh{8x+Wz~Gp zUUJnHSIoJx%C$`XCm@{}7>@tCA739AWbb_U8NLPhSNM-^e>HLxzC`+O7XQsu(ecoJ z*T~28Py2oe)8TIt|C_{rcZ6r!mzf~HQ{{6KK1noQesA;y`P)Vzj68Ee4rch{fkpc7 z_5^`oKezaA;$PuE=BTg`PLclWy+IbPmwN4M7!mf2Z>IlqfJORmx=+>9ru&q?;j|$; z;xYY~!7b8%^9#y<^9#!V>IlE|)%5=>!~cvH<$p$t@~{4eNzD9PEdF)*)rkKZ@n17c zyC{x8n2NvMfxi_0kkre{?piM=vil7F8~&rqUn9T8mq`CJ#QzNOZ_1m$pEmrLivQ9W z{kIwZ%f)}W_)q^-$5efq;p51lBmQ*_q)|A#(vZZTIC|rFD6NrC7k&`tm4a!0Q1$1V zA5{JWaEpA*^8XhcDNfpdhxqRh|JjkA@!j@HM{Evoz;?m{Uv`&RzzfOg}@)&0XO#hjN z|Lm`v{xhB4L-t$4bOr+dEK^R0f3y~qPm-laf9`|tI_~Tse_oOJpP>Z>H-0it$o51K zYakoz|VyD~VNOv!+rEX`P zxYyF{rxW*C8$H2Dh`)QSVQA;v@OVqNW09V`Xz6wPS=wGZ@nlQeVJAKscC|1P;_qHqHElN|9lh2*mbPb3eBUVe zewMahPWco|+a)JH#tPY+2nVmVzoqR+1dQ|^fP;yuemU_}OV@iRexRl6vlBna()HAd zN1h;6E~KwM>pRC@1#%(n_Mq3L_2g;-@f?ExZt~-RlYE>nh;Nql7XQWZGJF!=^;D3N z#Zp0Vn#h&sGL|2X`)^b~rIUSG)$#;poH0M^T$bWc*ivQ1)xJ7oKc)m06EW!OpI^`z{eyo9?BlwvH zK1=W`4E##L>kORU2^eQ3TB%Zhb$ZtTchiTLgr`gLpU)B^ZLc#A?86Z<4wv-4D|nOO zS%Uvf@S-D~ZO;Mx7zJ|73-~h4|4kQ}Av>{z~Aahrtn3S?)sqYgspGJVD{zg0B#~ zXr#jT7yM~0?{Uh%D)_uOg^M~{Z)*ABPWeua$2;+VYJ8Xz->q?<6Hi2A$?5Vs@t+Fb zB?xFr+f4y=D}3~{Am68x5%#-T!;HyVvvz+(T8g#o+n(Ycuf5%EmQc%BL8cVFEZq5 z{K@%zfXZjBKM!kse`o%`pz(d3_*)tuupi0lGokakp4(|wf>v}9@3wAM*d6@e2L&%f9NhRH~lFS`L2ueIesVe zU(1>coa}b+bJZ>f1YaO{K=1^?YlNq@RPiXSwyb3$?-zOe+ zc~Y%_^yA9~e-yY|x|&&jB<{ae?U!Hl>NUm>#D(+H-;e~n6@}*m;FQlrcTD6Ei%{P5 z{6qMI9#vBUunY8jCwQq(;na_(XXG%&)3jXi{Ged#0FB?N@Y^JwhXN-(f5TEdi6VcB z$m{bY7fZMWz}@m;8uKJuD~wBv6DFEa2Km_OW4 zlVn+MGCsIJ`K9pa^D>%$r|`5&xo3()Ts-B^;Qnd=xLZCP3!KWaTjELfi=Lq1{sV&i zyN&UOyuiRgZ%p?1zYo39(wqe(nArq zY8X$o>ZL!d@p|BH=~^lLO-CyJ$Ay1Q6#18cQ#>=@QSsbYBqHM!2>VN8S*^|O^FyzTD`QKLgCe_zE zRB+3{Glf4hTk&5jJiiqAwSRKv|3r~*EL8HkUwXF4H;cRu_hP}D47^f!UNLxX68U-~ z-1`NuF?d>p=Tn2{4Z(LCc!%JrXE@{kncycG_;%owpRE#Zw&aiQ_v&%0PH#Wt-O4cm z0>l%L{MS7D30`WH%Mrlcczz-Bl_Kw#_?!xy^knL#&UEDqez}29i^6}2$k&U!=D%9- zCc*hG6NG&;a7tIb5&tEE*BJOR!B-pjgMv31__K^3WCg!+>hn6m^>`LP`DqoNX5sM( z{uXe`pXV!rjA*_6faO!IRb50`p1#dNYvIYOE;K`ESQw9Ihz$XZPpWxD5TLpr@V&KJs zmkO@qQv%#AALeTLkEU=;0urCA1P>bcf+#$?96O{OwI2Qo@>GuNZVNKAF2|+Jk8!k7 z?#o5~uZDc1;C%+Z8n|1!nngZvy9#%hWZVYer2m$jXVm)EDR{TUN9)zrDEvCTnR2d2 z^L!`aE^Bb6m+oSud{|@PBhjTJeS1*yS!Z(4@*+{{HcNOCwSMp zisu61KSJ=}dkVis;y+&S$_|C!EB)u`z$t&MPgMTs{$3?;w{%@6Jl2O8~A5}Z!mba3;u@1fAbUflB)@!tWp2&Ejm0-*dmjidx|7%zt z{YgV_moT1c>GSpZqFDEeygpAI(sPm5=c%>)OCsNF@VAS+K0mAFHv@Nz=NG_9Z!`TW zAMTX+>|`F;!@sEdqT@4qv^!5KaN=nmqj>lZe$?yvY)D0=G?k?$~g{?78@b;(MR-z9iJ_NnOp zyaxs3!Rl^~f%_Scw@MFC;m#L(9snL^rCLEbe=x}ZfRqzG_zgO_) zfa1~fHctuutRerB;BO1A^=+fzrH3dU-LLpW@XSLM{x^yLzXbOmrtnP?|J{OrY4FEm z!jS4q!fi@khdV~_BL&y`d?;}4pBwpnBIB?pPpJB(_4zcB?-u)@@gm`$VDMig@~sB{ zWg>r(AzvkUwGscD1;5Y0>xJL?z!}dbk?%f2<--ce&t}2@V1)a+;2#+L?V88H|0;O> zk%~V-^#2Rsr2pNLZ`v+>FY--CDf#~lQxO`52{h{e_7xBRVANwxY;5<`gSF+>vbN>V_a{<^8%4S+K`{i@*}O^OZ`HRjh|}4 zUpMeug=ezCbFbi+82F=t-(=v=3tn@oivIxSkLY<-@CQU*>-pP)zii-t5&SO(zD@96 z1MdM&iaEi|g2^Y;SKh+{%Q=;VG7WrERpJwpiBY2g8KPGt5 z#fs-Mu}jYbr*Ib<`Sym$XU1Za-Yj_LJQe?a#4f!i_-2vUcA#DGUIX7Oc*-)xqvf{)r}8Z{($z2WnIfXu_g~;o2*+=j*4g3(`#FH)ghUFN3GDUu_A%B|SwFZ8s;13yi ziQq3Acm?pdh<$6iU-3KOZsUuWSpFa@|0`#^|7sNZ4ZukcgCD4J>=FC(X%zW?F+cX1 z3@hODmrFi;BY3N<&uaXKC_H1aeqHV_0H^#6N`9`E zbiEaY=R@In|69eQ?aya|e`Vlb3qGt{$>S$KyYa;>p2M-UK;`(m@0|R49{5iNzOTq{ z6+zX{4@yOEjSqYd4};+OW!Y$Ao!btTXMc$r}q=V^|@y)zn$>|Eq(r3<8cSM z=T9&yXC3yYVTtD&IiM zk6JGtX$1tY5&M}Lh39nP={i*L1cc{&!CMXd8o_G>*X6iO@SuS|A$ZeaieKyb8-iOR ze~5(pSHW8kQSut!DR_XJgL(An%J3xfRp}r9j?MH7yhFKFE#M- zz}@)I6nX1-C(j(ggBebIf#8)QkM0>i%LT8=RPq6_KaUIEbgaU4`_(FV*D(sm+e`TQ zM9Uwia6QiYPViRYS*ygYBp7hYhi2iyFqWSq1#c8QN$}GJuMr&8il6C%2L;a(yi#z# z!Cxo1CAik}rvz`6d zK;=(B?j3*_Kgohyf0qz!`FMv}$t^AX!r%KwgzKK}GIqxy$G zmyFYPGTX3|OTgon|9XE>gOQ(iOSq5C$zx`npAQP&X5ddp;eQ!8*_lo`hca5?*%?J% zr_1`CN>_=ZO115V?kj#r%h>Z3%yOysp)JuynSL6QF?c@pQ0Zm-W0{Cfj00Z#efF?uS?>;B}m zQTS_x=N&n>qV430DDn@8{LiYL@p)YElMTE@@M(f;{x_rWzc2FBZ*cN|D)`j~zD@8t z!8QM`DEu~X%Aep4rEhvX6@Qq*>oZlpX?zrLH+?t&IF)@Fu~%f@cZd zEV#C}69jJ+e2d8EYx$cL{|ADfD|mg4!haC_0*&9S@J9qM15W9EO42n_@Ed`wm$p=MV=YNxdzZQjOqr@k0tBTAe5CdBU#Rrz{68GH zTmEaFbq3F|!sE$u@=O_mr_JD*HiUe;AwNsPJzm1q{lgog@M!rOk=OI0w?&a(0i5bl z$1AE_bbnH}3#HO7Xgz7-_+TFRGiQJAcY^y3{P%(f1uqqSdriU(ZcyQV8mAoI6?seK zeIoyN!J7VaJ%R@f z{4v2hjPiX}aK9n{d%-OOZxuY#z~2_U)!^?CyxG7%5xmR5w+P;C;NLPn(mGr2_0shs z;Rt1)DD_KZwnsSqwu$V%3)tj5K*|T!lU~G0l}LM{1<|E2|hyjCjh7N z>W-Vt$V}m%C3sQ1!e1PwJj@3kXN|F%W&T{ZJ2i}B9AxP2og%;1kiSpxRs(-f@Fu}^ zx}F72@$@H6=7`X~G7X#;8ZTbYL(A)UYDNT z!e4WqijU6EeKF7`J75W3t;DUL0(VQ-ks|Lu-^mjcynBYiv0Tp2`GR){uFH3R6#g4U zK3Dj4`Q8^r{$b#h-cq^8Tc78BR(QHDRPoW{ray^%_X?FizY#s$B=UI|DESc*|L+Aq zQE(lfq@&&Q=K$aopZfb1|M5~Ujs#BmTzawM*LG<<8l{5Y-~zdWDh?ihQl$)|Cp^f1;A7 z`w{3_FY%~ANj6!~(I*Y?mmPSvj_!LbdPpM!zBmCKR9soXn$s^X*1 zr({QwpCJ5+Eh5dI6J$d?O$_gKY0UF^~V;prBhQNpua@TTV#zt-C)qVTt{Job%C zxkz?e>jbYf@OK5TH_GuN!D|eBv*1kz&p!q4Fyy}x-0E`b$@hY{8uGgYUup3FNAPAt z-gm6h!!AR9ByhL#-5)rW@0+Kq{MYqv3lxU%&kX!fk?$2;*SpLp{3naNU+$x>mU5gF zMgDA&?-F_4u3a2O{xZ!k_gm}!=lm%0i$uO&PxmI! zGgolyBE@r;7}o0rZF@~SnDmp{S^vt z6?}`}9fEHa+!nm`3MD^V`cWyzseEg?THyj)M*w##FP+b&*D86P&!-4av*5a(o-KHX z;O|R(N_Dsk70+XWUnO`^wZbnG{1(Am1<#O(J|cMcbxMAu;4cVn-Jo#YKE5M(rQmhK z|1T}SNXhH{t9^nu|4QM{i2N9Aq#?a6y;0%wCEQ~L@489hGX>8UJb1IhPa3X>CIP2% zFE{Gfbiqpve75k^ELA)@T{j5cE%+)?p!Fm|;4=?zgud8&&+7h)Z~7iB;nj>!2k3=U5TxWo^s_|q%{O_U?XimQw8?u` z2T1R~7q>=w|9!0&DZb+-?{U3W@lD?cdpq!XP2S6TKl%9YkNx?Z@OcsV4v2T$-@Qn& z$NvO=pxEsfmnd>5@p&Bq-s*+CBI}_of>yp^Bhzb+-8an^x6Cqs>& z8yx;!vv`XQ4n9x*6H}I_b@}bvfbWKWjeoUKK3^f9^2d#SBm4Ux@tH5Bl(X|I9wpwg z()9mfKKIweXOFe^+)Dh9#1nJI=OwoPRp2{_Kfrx7x4z6nM|Ru{buSaf|DUAa5x9)Y z+;5jF=RJtO6Zl?;-&=XU*p15p!Uy#IXIp!2VtWp8d>%4BMdC|IKQYhb|r2jDSvw@2qPCVVn=RDH)9c=xQ_b1BF^@5|nb0x!fHaNJQ^pk_u&TnsT z7k&bKFUW1yJ8%0e>D}M&bL-t}z(vmE&zs)zvBCUKlh5=P#{Xwr_ZK*vdez7F>`lCX z%;b3@@ebfJF6C!aid2X%2aYX+O@2NIT;FN zOX63MzK`?H(SL&Y^xsXNKTi4^ln?Ufj89?S_2=`%C*Nvv_$TFXkKh=WS&oa-tM5Dd zhfNNzlh4z{=RRrAy^Z)^fQx)4UpCzFd6o1NjA!3R`ZtKToZG9&mDKayU_eBlTedO1 zI-2zR0~h|&*O=U%-NG&;NI%YeQ48sp0^b4iWy(9py^8d$hnbuoBmIYn2Yo3;j@-pA z6oHE#`tx^;^i%&a`m>EZxB|F5x0UtnP7gm1T;=20&#w^gyUzG*O+Mdo^e>q_ojv~{ zaFNe!?^2~)NVz>tJTYwJRol`Sy+SopZJxv=Wf!!0bJ~W`}^;=5Z}Is`1{O0MC&r}R?@_OrGQI2XC6r@d^Il~16=fB z{BnEl<;2$!pS#P(oG<-Me!`Y;7dBNtF^*RVHB|d$m*^M45^lilZereBj z{`oz`gR6~?d+v{cOZz80`|ud?@lV+kOgM3=3|L3#)&jA-ZKlO)3|KxQ?f4{ZI z*_q7`p`Lqw!nO|QIj`%;e|O;0&Q#vy^Wr?au#kA`ZPv~^NPh_VjK9xX{vz>J#An#A zR?7J};(f!${~6MsO1$Omlr!lw#HZewQcCBClz@w$)BmjTv0mf7_oVM1H9r5^!X9u9 zaFN@@3ypHS)A4`B`gJSYb06`EBDd@AZ@-yKZh5mJ%=DW6yQ#>~X+l91}cW>DJ9t zfbW3)^ou{!D2Mf=A3xPRpM&|_GnF3xv-dvvj{}$X&m3fO{wCY=dE!%9Ti5*wGeY{K9RCrc{{i)_-|?Y;wGa6W0oQfe)1UK5 zKY6F=+X-*A8?GaLpGW@<;4Sz&6l?~$2f;6ZOTT8mVeLGYSAI);?(-={9wPon;3A*d z3k-jX_~wThpVkYODDopds0Fytr(QSu?MS~H@fPaaJBaT^ywB6agMo`27SK=FiuC_O zeBA5rNs7b2_3U1Oc;L|;u21|Q>ccI{2k(QTe!6w`JESj9 zq?F#t=Rx8#4;$|IKMq{v-+#N=lWRGze@*&{qT%n~QrQJB5ubX_+Vf+BgV%xY0tvP9 zJDVB2LH^V9_jcsXH zT&l=?_G=aKsog1O;-?Z1zRmf|_GE##l4tzaMWj#NYwbUCbGv%A;9@^VjQ=&f>1N{n z+gp1+`A)m=%{SryGxDF=Vu=!dm3)3jyyc7b+?^@t=ZR0#Za97TCvfp+{+H*ooc{0d zev^OeZ7Y?tqklK?8T!3gruFAQ;5tvgV$YqKXL!5AKW1{H83+yqF7suU_4AH@FZuUf zZhX4P|5(zeK4*4*mUx=#kkAd_L)Ce_?jX;S#H}F<|j{ka?{8Jyc@m+V2UHy&Yf3nHh#S1Txes0p{(Z|@a{}P`W zZ*2cADbAO_ncRNOhwlYk#y8c|=$9T!`hMC0H{X{MpS#fX>cqf)jw3!j-|+1?FNzL- z7e3(U9Q_~fi%vC{!)JiYxXj82{IrnIm+*BzMH>J64sfvpzTQ3xT>PKsnICZNf0p!p z>+u0UEzPet;|H+12BSPx8D5)g;IOmv;Jjh7###_cVL5Gx=;F-v4RSA6Ne@ zuN6``oR1IqdD$Kte3JNVuhIX8`gSjHk@LOYI`t6ol$U>gihL5+njUT>|5u2&{KfR# z*_q9jS{|&$%Y*FzT-rJHN253EfgF|Ku%F{zexnDt*pr7Q%|1ANSV2DJvr^iUAznD% z;Y;uVKRMdT58$iFd5(EP=VuNA7yo>ce>eA3y(!_5Eu94E=QfJ-}5$KV5g>}n7^MEdD3q!ho9 z&wY$|`QL`i-!+t<=ZMcRABZ%L{=7`QmHxl;yXIjaWLy#_SiinT`gb{;`>h`!zAy1U z>Y*E#E{D&z{vJpAqlu?JV*2wq+j)}1Z#MepiLVE)^Md|{v!5fR@BgmRe~A1qB0l}w zlp-6*=hMJN&!?&9^GScZ<1=maAKlC@e1~`+;~lrIJwkkf>)rdv=MREIZ(9z6VDWPT z^HKin0(y0>_>d^n>H>VR&GJ?KH}qlGyZ!K zUjba6JH09nJ{^w9WClH@|$oOBfxiRVou6fZnY<*ck`Wor`UPDLlvkwJy z32=GtxaYr3IQ}0`DgBZ9e-PY6e0tiR>+)A$B3@=4dye#X5% z3FH4FFTOy0_Q8}QPH$fWF72P-yu(-h*%A{__)MI;M897`dG1Wy{T*(nCwl*fgglO!AwKu1lyY|Y zQgMT&{Zq^fxpnhu;5xqEJeBmO>LKMbKs~&J`1r2If0)nx2Kme|E^zVJ{iH8HX5*OQ zxIadG`t8Q&0Bvm${08`5@H4v)Fg>K0gXhTK-xqj;d}hzb2mCxhK5xV0#Gds3-SjO* zd{4!94Ic93*#TVon_@lfwxmCt_}qo~fS=2VpQ3!W4gzogbcFPiKQ;Pi*k8F_`1k+7 z^vC4^J_Wp$JmbIa0xsh|A@EkEZ2WJ9Rf1T}olK3p=i;Exs zK-}L?oFo5f`U6fruMscPK0Evk;H~US{FnSWSM9I2UdZc%1fP2_rR4ABO-bM~j;UG0 z7g3*=lYaI&>(`q3cEf7Yw|a5Y2S`7Dlksu;M;X%l`N`9P%l_j@KeKgeD`Ov=0bK0H z6Q13;f_%zczg(W=Cg9EV^Bbi1^L5_?-h%#qbqhD*_TZnBesXK;FU?-?2jXSVe~{OS zs6DyS`n!zdF0Ty{yp{R7)7YIXeyR2AKGLU1@9W_aj=z`pJ_fkdhxqaDsiYt0dqIyU|1|MQFD^R`xU^^L9_!ai z%I93-GriW%?Y1>WSCfzL|J*?OS;kpQ`P}~nE^_Ge7OD#+if_$ z>d!y$LE71JQA)qxPJR22(xd*L?-#;$u>S0Hl+jPKKF7_?y@?qgEn3j;-3aC`d^lS7e7~$(HBTRH)?#|%XxGs@fit7@iR+%`v~z}X=hx%nGgOiB&ai98Z${`0_fZAB>gz+ z9-q=t2!ekQ??2Gme?IY+V{9Dzk23svwzHM^1johM&!pg3cjj2HvIqIB1TOvZ^FOBm z7ysOkUy8t+#Wfq09(6>XeqI1v?8c1Oo=*^;-F~IEBC$fuR-)Xuy(M||!^n|Hsbd|o3yO@C|$(r??xb|zAa+(>*s;36MCzmxzje#^91 zzqf*XCK->QJV1XwNIv~uJwO(COR#Nl63-iwJUD}V{JiUhz-8U(|C7yMlU@*f9JtKW z4PJfV6!}a)l2X+eIrTS*iD^)zsiL#k%ab^7@-`Lt|ra=wx`{fqb% z_c2?DzYU2C;WOdwKfVLF=t<&t#^>pIcEkRHLvJT9H$UfW@>x#$x%*R!xO#x&i2MHe z0C0J(zy20UKg)F|P5vJt{RG?Z;?PSR{|kGS^1h4hh8u~`?3YpiU-jop9;%k@DTCTKTJMfrhJ|tKK(6QHz$bygLq%o+Ia%ov(=jB>CqA*p338~58t zKk=-so9^!b-s^BLFZx~JVy{v^EGTE^H_nhg!Sh)h-r)a8|C;B&{h9RBtY@Z~5B@_u z=v%J*mvFrHfI`Z?m4CkAJ-}sL{Q8yz@K*Lc{_8N{GAsyeELGe-8gQBz(?xPCcHYdZGfxX{$unz z=u?7VPvVo?+IY#|$(EmkiTm}0?ShLxQ?+^YT_X>cl75coC|ilICjBJqOm-ul1+M#~ zth;dfQz4)Jv#dS0Qh%-@o_NXh{4iGXArQe+&`wVekPyPaY7kCzKp1a@ku@H#-{XAF;aA{}j4~+jR3gX?w{d$0d z$!EHIrMBmLt@9@FCI%Ufi80J~?Q7e#d$DVdB1?Tu8i+`z8tUzYMs@^WK}y zo;!WJ3b^VOY zb<(%&VSIkf@!j?$)6Z#+;}GTfF5vRq$(vK!9Je36pVA{Q;l(>C(vP2K{C6V%6G(rp z=jW^=ecvuNUp~uDj}V{n>c`F@UVh!?-2yJa7b^b+!Sh~S<;Q@FUo^|}S#DgeS9QtCT;%Ng+ac*&t0|>>ka8{)pJ_3BH32_Qe$FO7 zd5z&$7#w_3aOmyKcT8?2;&%d<=T6^c^q(XDuai&T$5Kk^>c<`??)zQ81}=7Q(wldG zCH*+htM1R|&O5caJa+;v@}Ffse1!Dx1TO8Iect>HH;)c>^gNgPUeX^%+&@p(>+oS4 z-)BgFEO4EVKQsJL;wJ-F{pUGNOi%skC!f@lDgC|~<+g!%nfqwQ4dQS zd5kIMG4NG??jWD(Ri;-b%rpFl#QXnfw?A?UaG6Kb+?Ti2 zAqYlD@7H^uLp<@K>B-TQ+sA;*IQr**ZvfuR4&Mq~o;&%t+4);2&j-kVDq;9K;=d+7 z!}!Zq{~(wn-ZEq3CGXXepZ^d~e97=X8XRo@L6h_3U8Xtqe-JDHE_QN=>nzy>2arB^ zhe>7|@_9e;)F)DkI6Jf2;U$w#<{fs!sg4ipMx5U`2wddmpDP?CeLv5oeu&TgFzGk( zmw>C^yPw&^A<|z)KC{=G9NhTcsPxDyKH2C;-AelDubO0@BA>f~OFPT=7@zBie~Y+( zPUn~8(>h{&zC?jONBX%}jgPe!<4F2(FAp#e9hZ6GpL5&^xagICZhAN1B8S#rHtJOe z`6QMZ{tve2FyO81OZ?XL}&2Z5`-^6Jehz$Fgiau&rymymvndH5gE4qO3z zzxV_B`3u0MzkZ(ccH+U+DWyD`4$Aj{OMio9l;jr1=t-f+dNjrNqO4_q|LXW~U-j*L z?i;{Go_@afZ6WpQHj6tZNWV95Y3B^rg)ND9JN#m^d+Yez!-1>*{Ma;bPtqR?T;^Si z=O3Qp_hT^0F8im!zBYfm+0Lhd%Q*V)-}oEx@%EHHF~jH1!v~?C@XmL) z0GEE1y}ZP`iO;c}d~A>)pTvR2e_!%H47kX7#)~^vJKT%EP9PtDz7LUpl5y6auhMsKTF5ZnyBmG{Pf-9!4BZI&rKdXQcH0dVP;@BchP+|NJ! zf_z$;H(SexJPTapyuT;UInqzvVJ&=#^z*Vp5C7*58}|<4+X9#N`15fm;HnQN8=r6N zWH-Erc;7`!6!;7Iw3E*i_gQWwei-Tf_oy5RyqO-J2weJgu-C64^68U<0QmVT6M1J7 zpT5uRhO^t}0hfOH@!Cg8KXIke|8<@<^jhMHzo!&9kNBkESQq+Pw@@+i;C|Bg?QZh9 zhx9YVeLwBjj(?}|{~z*s0l19I{KYmdn-PD7^sO%&y_*+r$=SF}bsPSnZR~~}iO+g< zybFm>GJn--b3UKu|eqwgm#pw?cKbH6wF4Hd9D$1*CSSF6#O?}$BI*0-SGazi z2fS4|H~x36&|_Ytcn;`vUjDMuF9^oD&+G2`Ci%~PdAUMoy~VElgnayc!&%b%`wlM< zFZ0|D({I6lfQx=kdHL<_)|vc$`@bu2(I5YuavN~rbFs(g2-5rSu~|$0GoMRohu&x1 z3f2*yTzt49udu&ol8=9G{UgBTxe3}mC;zJyhu!wZ>kGg|{$C z`*s6y|NS0cA%FjT(0z{n!IU<{y!F?whiL(>>$tbSznkFDpBcVi&egT#9IzG`?eqP z4Dr-wY`)({{2bt7f0i@uWAlTnflHjy$9l+>`jjB}oYEr?;LXRoiQhs$b3W-GCjZok zt*6f~whNB~7df;r-}QacKkM+@t(`w$gZ@Ii|GJb?E@t~*2QK?Hu6c_*Ihh9{(Y>Qa(R+x9DlDa=q2D{SFiQ-P+u7f} zi2LugSO{Fk@meo0u>`ot!QVeUQt7dNd3o1U$iGhxXya#dCKB_cpYYOz zUR**xiTjL?iwmw79Qv7}e(uA5-Aj6ZT)qcf+V9un{m9X?PVAH9^9RMZ4Ep%qMbj3% z!xhbw`Pk2V?**ja2Dr$rOu4!Czf*DOx%Xa_cHpX497m`Bhmikxw>|N2>T@q~zfOA% z@zlA8YfGMBdve5EZcHgsB|ZvVo;%Lx(#!;Bk$&Mcl+N_~QFXIg-3d%XJOJ%k?PGR?f1 z8<%}a@7EVCB0k6W!0bW;cNp@wd#+=`#isT9vmu> zbAtJQXHVWryw%&sTtIy41>^r&c6uM;6Yn+654nDI5}*8r^=pvyy}+ekeq3`T>1X#f zJ};9#Lwx)q;{$clpN-_>=T9zixVOJ{o$$fYowp{&SRcKeEcWY z&RyA_kCIQB`5C8gSCKxoM@pagP3q50j*s_Vh}(e6x*yCtQt9_$JHIXTGQO;be4O}W zz-9N#&l^8U{{A_^-z$H-|B&{7fAX0led6+zB8xV+3$GEMVx9!cy8dimmgnvk3^89p zICwj79rxXAyuLyC>_NQ6tE)c{xQy2n^MqTIzKitZf3W$oyBl}nlYFnHTi1>u-ba7F zg$+sr7d>yKe>+5c6ga1dYr6ivoP7Lx$m@yw^XpFF(*BvZnVxS+Zub!P_2)an2jl4P z^FB=e6JNCcy8OvAe=Wa|K7f46-u})C;H~U?{MX6kQ}*^BbHx4ky;q6*=V;C)?!SlRD&l?LU#X96 z;lsa3JmL8*cLEoE82A3(*}bGM?``sblze{b`0zbu&c6MgxL>FA67g2A9`aS-BLCTM zn1z3y{I{x@{3rQ7fy;>R3|!io^76EMk$!yM5~bXV^oxm4v(En$#Fqfqe3uvZ9ZUKI z_i=6{eLwN38rLK0!|A}KJuAI+|4iU&Z&?TE-jjBL((jD-o>_nAlmAtUV_%Z*&v`fT zFA@)uX7^@@e+{_k=M47;cOd=);t8JjKbZKV#LKs*6q%-?{|>mc(?7rPC*abrKCfT@ zCZF+_jn6^kzY82xX-{it`gQ~5(@MO2mC^4+`h5k*e4pU^yZVT?1DCqZ8Si}A`^jhG zc#9(*-`;LG33w~-jsL2Verk#7t=kv-ByqoP;SS;nFJEyFaep6S8o0#cE??vH?N`8? zwdXJ7H?GJN6Dv3e2(_v5Vq$+;xnvYb>n!Q^2d9M=npu%^hL!{cft7g67v5# zaJ3trzD<*VAL|X=KEl)Fvx@mQPT%0qisL;Po}Kv@`S|Z`-fYz5pW^xGJ=mV@h$nb1 z=>+0?5})8Y>+ID+;=x5JrF8zuV&Z*w8h#%6EGItc#iu7Ze0!6><3C7zwr{C&IC)27 zGy+`oaGd#SC+G7?@4r9cQl&@o#q&#V6nf0ZDax7dbMR&I@$0uAAl~|-wR0=#!wm7h z?X8_oAD$r|@I7@7e+9UVyZ`?7d1Ka|1ns%40zt4naOv-f+~;zB!hwoozr!2%PQ~H3 zdw$gM!XM9_SZL$2n09QP;E+Qr_aolJ@j8d}b6;Dc$X!nVfver{_V2DB?(au`9Jti+ z&Ux**jr?2gGk@U2eD1x(rzQ+{^X>=4XT0~QJnnGMPyQ`%X{Y~Q?&nB9{%MoLm3;22 z#1sED{C?tZ5D%`f^~Ig%+HZsL_w$Vlfy;QMyuTN-QgNL7@W$(S;5sf|z4V8O`|l^o z1DEy7uL~-Z{$wvNaRKo;<^g`eeqBdC{(JIoA-!K${1xD0S6}nm|2@*rvd)ug70eL# z>m{B9-pV$_f4vA?#>;=-#b3#1n)c@s#v}h09C};!@=iN#G`?D;;5Bd+nz9Vdaevd!^dy};Ek;yH*rcyTRp|9sqO z#3yKf=Chq=2@buQ`N9(Aa4QG+GRMdJ`%~8t_uqSVJMjeT+*0Ve{Cpd@$j$$I1P_tk zkM|#Q_*rHTFEuv7OXTC9H+&7a=8C9t?w>`vu3i&$3>~t+T%+efbHaFR`6}11@p*5d8`#=N++-$^0sN zc5)x!I$yZYcs==a5cl`HmjYLPeyi!B%Wt0~INCW)zlG*7D3Xu=zVWk2-|F@2F@dMubZb2l0MkW{Pv3}&&P>R-)!Tx1s%H=i2M5~e+Mq| z@$;qsBK<7i6ZHU4Q4+0lIC%DD(5>6k6f$zs>#eaR2eEh%rb2ahQN|W1}v`e=U_v5U) zfJ-}r&)Rcm`H%;Q`+nEsjz9lC@25!rl;i($N)hLWza}{Jt&jfU?xf%GY?JdGlhU0vA2;D zeC-IOw7Y`fuZm;6qrOd$&ufm)cg?QuK*inp9Fv2;5Bo0QqW=ljKc7fG3rX+KyC5@^ z%d8Ivv(-fiA_(wX(ON;;DZ)5UB!oGw>`FjR`+ zT(z2Bms^x66|1#!rBueP>+oeX%nsnj!AdR{W^(SJn%=c*PYzccfAq4o ztByH33>Wouw=WLrG-0MRj5g#zYm6$nLM~m+h1FWFY^_Va2_O7XRDIxZDLYcgRnY`~ z&kYCbi>0w*tSQxCFps{}pBt2l89a1#SSUd-9c?{}<;zIXzP2aZ<6k?HJq=&G67jE{ zi4OT{cXr}WCB_(ab+n=Nxx!#r&DBCmu{ts!4X>ch=hJshRkb^|4 zwMxDmR14|qP_|TC)YIPH7Gz4X>jSS19KyVQDm187!2>f_0VBNI5Ky3=iZgL6}c=7x^WuPS!OAnw2$z*3w8+wr|CqjX%K)R9;Uy~-|3jUs<&~`+$J&8n6 z94QnOPDXH7M^cft7-ElUPsgBkk6RZ8NBFl7#E3BPb&+TrqtQ&Z_4LF?KG~jZ>j+Gy z;b0kJ9l}%zv-x%T+M;B8TTcQaAB$w}l%lJ%J0_wY=vIS-x{}@6s+fcz#6~%Eby@df zBIq<(#YBL|XzyYo=(GA8wAyf(DZt`ZF%LI^!Z2G3*A+?w=|Y&Tl`7RRJ+c9_e7Ic5)pFTI zFex%*O^8AfW0lQ3`zs1t}D?%C4 z*f0aWQM?6_U7;%YiOTwRw*i-e3rR}$-&TifDGBxVLEut-4#(lQA8J6g?kxiM%k zU&sYTcoD&HdV~CuHLbWVtd`Zoz*b5F0HOu}ciAvR?dV+G$!CZ5gmStzgh5VpH#86{ zrHwKgSIj{HHqTqKnH)t0tLRd-Szw){g$~yECKj{+3 zhb$EKqF1Bo3jW7j57GlA(_zXFP6RY{oi3(SB`hdWw~~w7g5j#&qQAqjd~FD(gKkhF zDC1_;v96wEGAIwhVk)!<-xEP*Lpnq!Hee~jyx}w3;(kmL%Sy8e)!hb_5}T06Y#7{7 zU%#47J}7iokS`6wo>j#|aZiFb<~}A(XuW=n%6rJz^Z-Zs-%xL#z?vfrZ1OC2BHX5!*xK4)$06QyL5xvmee4p3p_(2=j8dwE5|H3_ zb3D~oR+}phv^oe`SRvdlt_D0)L@Q`*#20f8hP*yhU5iyP^0=_OO+7RF3}2~E)zc9- zCOsxTrAsDy;_h4$j*#4E*OHCb+S*k~^jdp2{3}P;-UHKIe_DG_cU)&X5?yuDj$}u@ zksWPtKTgo;2Xrl+z)KTPz+co5^RkPtyOIEKwW?6mk65x<8!h^~c>jq(Ql6+x>p|tBw zeaT;ZT-DiziyHOmB~^9fXLrMI%8XR1dCY(eJiB^JX-Lr4He;wWKyM9eL%Qw?Tg;89 zy>Q)QijZ8~5x{k6%M6Va*PAaFAYMa%*;aF(bj=*f!7O2sT~~ygAYY`<>0r2$!~Dm+ z;DGxEM_@rhM0N?pB*Ws6LN53U4Xn2z(bdq1Hq5q2`t?4=+X;WY;VTR&f&@4Z!_HM? zgLT1zuNRmUV7uCkqCSa|-4Z89Yf7>kp&Gv0r0s?|Eb6^tPlhFyOLTQEb{HhFp%&Ik zqF8dp46EMSmVjZfr%GhwIJUKQ*Qab-TTjF4)Sl=J=<;rfa9bqxLeWT~rUWNlyqnlSwZr-#1kw>#mstWLGptAq z)J7@;;lRdN*pCQAw0mP%9fI$+UR7Zc5;<`L)6vxlc}L2SP}ec~nrt(Z#-U!^Eej?G zpfe#6N;Ei~vSjMiuzp2kZ4J-sT%3##Y3E|N1~Dex;&#*@pAZ+pb-5(LTcovZvi{e< z!aI(nr*d`A7xj)m5#J?iq)ag%WR}GFw0D9JagI>L2_90s$4M+A5T$U!^pd5lff1%J zVV@6zf%v+SY}0N!y>3f%$9X*Wm5odqYMH z-$ln`GK?v0vaP!zNRjXL*#UPFes6u;;1Rdu>Tn*3$4IEIL+x#lX`EI9!T5LNB;w6T zno8I#Z|{;YI?}Radza)h>TOP%XKKV9$wY&>>PRB-6}!2kLwwxW%{?(&)6vxtpQg!< zE;KVTcH(GTVzVottry!t*~@AGMaV}Z9sy1qnlDijw8vVzxYN9EPOjwQo`$Z$VTrY_ z(-T@}hxp6&u0T%GQ{&v()!?TjJG^(`iX2zr?&3uopZj1^jqA;#G8D!WI)T+63B_lBr!g+B7azPDQU${CO=^5mN z6*?x#5Al9PPpL-VH7f-F7f;GSVh|x7(&oB{C{b^Fvu?H}yV%WYUQ)1cLWi9Wc>GNphYVfw z;l-jN8rrNwiB4I5nqFBf+XqdrbjdbV(<|NBAZdQ33$vp66%9$7a_d26EsqplRYpsl zwPs{+jb-)SRIA0?d6RC#Cuu%KFv60gXv(eq%{qq^+MBhYLs!IRZR=FGwds|Fn>cD1 zp$NK(Nc~ofE>kY+W`^uhm>t!0FyXAM7Pcqp_B)ZzcUzrs#4r^k6&u9R>JZ{jm|xot zH7naxAU)lZfoLKrEc@6I%GEH=0n=IGwFOV*s+gx68M#~ruiaQw}TO&`;@ zq_1~P6Z~lG`ZR%;EML9`%$i(T+q=5AZzbB$VQW;~2NIfg-6X}qLNlT2G85$H@-+W*+KyEf-JxJ0m zTbPkC#RDx_j_spC?9|B?w1?CN3UvgYSOW#V%k^aohmjx04$np~ES8Y|8%^g6vR{l{ zuOc?3tB7F3io~pVaH$}ujOLV=@8?G34jj#vhuOQMyCuFKMR^1!gWAvM>H zbq#xe3+u^sIxr1^AToXQat6yoxeeN>CYA{q?u2rKDasG#vA)s&8^9Ky7;&p;tv#1``z zxk?FkN%jwr&Ib-_n=4|gQ(|3wP8SeeRKsFPv`_%a&lGaSb+sY+mM_Zx@bZT8gEjex zy*v3uiZ_u1O^2_G?+8hX2=e(wwsEUN(N}YK^QAF1e=JI;M;Y-kONpCj zg>+jts`KCi79hp(D}- z`C7Cq@Dqg~sMMhF7VuklQ5YlfCA(@%?O^j7m7Wesfi)9C7ji=Agp}|hPE8M^6o-?n zR$7lnG`$IVSva``%opWS^y`!Bo?&k^V&tuT4;i0WKqvzZ25s7K1fckSw~T9C`^aO zWcc5VtLz|v$mPLABe2}SUdrkL*BsL^lYBbqk=X;g7D zH0p21+6oR@Jw5E)ElGs4Q-Lff(o1x(d$RIrXRNXinVn|VU zi()Og1i(IMv!&F|1XtgPjCu{G*yI$RsBc)*BU@T96j)Sr#l}Y&nc;HLIU7y8ooquI zA7!MlHezwGjWtq%p@TyzC7;43QbyMY($D794#<5{`6pu~IV$u*h(qMD#WQcxXOsi$ zl8U+tvTsI}Oms-Xv&sFY#%O`=Nr*&V*~y`D(6rLnc=iKRoP%a^zr)d38mplF4QHh1c|fXcDx$ z{!Dkna#=A~N_|FMSPKWUxrN!hI34(em`}q*cnU6i$7)&}GSCtU`zjx$fDc&-2oCns z-KF^i6Mq9_6@CL~zij4&85H40@u;BY`87Jc(jM8Yg}3i$qgKiGPrBkUrZy#vZ%Wo0n~6>7U4zRU9hb6 z=4J-8P|j8hxDFhORkD*&%k>RqE6Xqt62D?%iuM4pl2|D#$jZZ^0tp0R*fG>kQs~k^ z$kOI;7z(^W_g&!MTO%=Fr0Upx;gHITsV&@OP(oI4_a41mE1sl&+kMVS%b+$GQOPY8 z(qX=gcrRBJS6u93R6{L5oxt4^BXN+_S>R&^@*a#e=vcxC9c7u5UAJ{ zTcchby3342Y~-|t4P|jsQKA}@DUXDMxis7}Omx(^VK4nOHjg1is6mHzL{k{-h4eW# zs*MTlm@*-^hPV-`P_b26?h`KxYmXJ0V-3#K3W3(}LRlafD?ySC_^`2gap8axPH2cd zIqdk26v86PLZNqJJVoYX*%I`kl#z-7Fj|L$36Laq+w}w17CVW-N#GKvdaIU-;#QRG zSBDu_tnYnwEx|a|5=g+7;#*c z>7w=rMKPL-!cq{gzrZRk(?%yBRuIIGuoh>8;sR82!d@8Qn@l;`Q;h2p*Y4(cEj*njRhb$gZwIEsF$Om2gcC8ivD;Xt?%RIS;4TtNRLP)f{5og^KIE zTYJzR6b#kdK0KmlTHKLN^>@WH5H%^vHi0M(jf1nxfZ*C|hAff|_&Ok(SCoq6cy)V6 zn`+CFqye4w+9sro2>$78#bYCz5JoFGly@}Ez<_Lc8&_}DUKQ;#|TIlar~CikpL_yAo|iLP%WJ>BVaz74lZUDn2%{ z{bKVFu{xS720|1Do1)l{FQs**ki=wBPZ3L21Wm)93b$Tly+Kn1bOx_7COWGP5K`8g z;Ul_^tRw813dfn4!Tbhie^B)1dwq@D)^5O}{UfYu&h=Remr885*b6AKtmrUU&`zvB zQr;T1PY#e~5X8zZ7DS=$4A(5%05b;YYF)9_Yr!2_&Y)Wex{YFX%snbSiYNloguTO2 zM%~m3q{nofYiG!fU_KU|n3m_ag-Ntm+yZgW{mCok#af9yTGd@tkVKw~Ha}XMr5`dH z;;G0lp7O#C-oT7iWPF4Xw)-@32?@31JEUe=FMKxTWA@upj576x;07bSgJpp=#7>i* z^wyMMx+c@c*%YnBphGJM4+_EQ8q%UMrD}ddtSDEMQO<4I;T=Stb`%6A&#m6ru7!^2 z`mMvjG82RZk@HBs5ME4FHqLj}U$BSqab-uX7)KBP%QLv)0V62$7Hr`b+6hw;4R?_7 zQBooJg*gPR#sPDsb!Iv`mZj>hyE9Tvf$)QdSwkpkvsrmD`7(0m@QO4!jpdoLXvYj6 zAX#vo$E#Nxmd6e(5Os$MjLIl~khN1MJH8`T4{_+xYAe`5L#j9`n88^=^cC%pf;drE zU2Zhjh>0s*)`gz20(1u3P;ROfOGWiVqDgspuC{E&65J*S3bi;`Et?sBwK%fMOQeS2 z3vmciQy`8pZIGyQKXnQeYy&+E*B-UZ#o8D;T^wwM1Sg9|2j#e!`XibtQ=WGCuYo<9 zpa*_L5+kVPt%;vy`id`Dwsk~sutIbdYcQ0O5`-{8YUy$}SR%pt#DRsbU_h#J0MPj$ zGW1eHfLm>R)fu#cEt`wtwTnJ7@NwP3jnTBX1fmpdU{GywmkK-Wm>mzSTN_(`A#h#Y z@mM^i+2A$eV%FdU>cG_%4K=0eyn>5{Aqc)pX8Q=JG(`Ton-JDZa#>1%8waGM0KaL` ztU+RT;Uvn=ryK^CZb7Z0%|~bE#Ceri)WTUFSrr6XEo@`EU1s4P^|#R|G}KFJ8{jU} zKb4`ubQF&nfuX7nWQBzpi7sJjb3hIe;aj#Kqua1@IUB%GRmKpzdC&*wgq*`N2Dlfp z%cGo0JX=TGToGcFv8lcC6;?JNJT&l3Ei_506b)ypv#Ym>wA=gF! zhh+Z&Luoz2Jm18>6w_ob6HH5?QqnzeT}&|HAb7h|4uDG{4%&Y@J^ zREKapg)e>Jbi)0jYa0A(=on;%vsgUjI5mQH%qkrJ@|WN!$d{oJZ2~h?;nW8qD%V3_ z#?qJZ&HddW6<#C5b%DH56;LL>XMB(IQC(*>h!o3Ji+nnwYP;P^y^TP`Ub&q~-FuE+JsU zdC4#k2zJDn=ptS!;@yja>a1tb;`6a$Q5igh z;9^z7Qk5AvG(pxe_?zNwYJ{sI(Fa&sQ%3@YA$GXZF4+2OtA{10WkJ!?%0V=q?j&s) zNAy^lh{s{yPnJvF4$zbi8t+b-qp)#gIIf4Amp#8Np$heZxQhepT@8+T1umpN@FWo?&%M!fFdu(PVZ~O^bWIw@rVXFJ(y$J z53*`6XMzTBpeF;nfc%F)V)c?-v1S(MNOBHBu=J#i6a?qYH3LCYXF7N8O$O+udGNGn z+I%?%htv?BjzT$2c7Z`#np|fb76Aq^$)MAeAO!%3){NRHlkON#U;P$5=`tq_IQp zOQUq1XKJd*U+h7&qS<4hGdiW6n-?=Bv>uT&VdmZ5^%5;KHnG+3bM8lMcpRi!;5uL0DxDge~a0irEa*ZCED=OU`p0qgM}iQ0E+W#K1mEyWp{!9f{V`SY|7# z($!L4+~p0sNK^Nj;Ce?Bh5H<8RibrSY&#yKfgjq-k{nt0O9dDhy=om}S$%!X;YP1> z{w|{+SQG4QbA66Y^vLJ27ctOwBU6`gPr`3(R7bhF5xlVx{wQpv)Y8Cs(T#!DFuk0y zoj7@zyadwu8P*^1@uGR?8y2&|=87UYB8NdysV>|6QkPLKsldUvkpYcx{W!2xjoMKR zc!usBUAPS*bE{003}gldSFPgPa-S#`7fCRgDrUf5F2yR;My=J;!&F_|Br{Sxw=y>S zBlE~@B8)g1p{}WHEn{j%<;j=^kUC1&W6mtN#U`R{l>>|KCx_<2Ik!b39Yk>(agar{ z2Z0}YCKI{{oxq-;M8y^x;@LXoWeQ7-7bRgUxzk5b+5smRk1C|kun+c38i`FD0yh(! z?*-O$?PPg}1LL&BUXn>M#L^M5SKFC+w0xF`(>A5)q#VH;z~+H8Jhrngsx0BC%JY(Y8G+3mkotl5Fn3J&Bu)hO0h)7Ouab2 zSd8%`Tk;sf+rAd}o^1mOBrN%gGGxnj)sE_rKrx7|by!Cn($-;A$1(C5qv;-sI|k}l zE>SBL`BoKaj7ue=v1^aQgtqNgq|0O*aBZ|jCGK`Cy-EL4HuIq^u?UW*>(q82;)pw_ z^;9Pws>f^ad>schnXv%G$q44f-p{JX6C=N@e!NZ}6B{wKMR(Z>$wYCGGg2dpNFsP7 zf(y-Pi~m)XthO2r9V~37saJyt5LOYiqCiaAI)9)0(HLV5^)1DTJrg-80va3{lVO+R zG`K&u%mGyOiBwx+L0LC(0RoYFDsa%E3^ygH;8JygVyHay7cA>;BOVgpjgcoix!a2p zG1IY66x781sGHWfi{p)+1h4h@+pQ~{|JqUrL`4M2NLrYfY)q(8z%dJ?MF*-#)1qD~ zfSRHJL(&5<(PQ#1RuPS+2_Zi*VB&PU>R?C@r!>^My40zV=!isd6?BcUmCYkM&IsLL z)F1+@euX4trBg3WB49b+qMYF_={l=Pc6A~^+SJ6jr5HU$Ozn9ZGMH{dLhLF2Y2P#| zWs^XoE|`qEUS#C$0`E8vHMM0H2BSr~JlcjD9S+!kmARNTR7#QJsZl zST#Uz6`4WZ&@PSrwd?uf5b}uee6uCY>V{K9Z#76^Mz8U8s5Z^$G|LL-_B*+>A>k(b z_?9<^D2iGH&}bNRcZIs8)5_Uin}f0S-W{tA2Q|i()Pji0Y?#tv=cOQTY&9nw7o#`f zDrr>96|aLaecQx)sh=!^T%qt56!Se3Vy#u2(aOoNK5trhsLc`6yON@)P+ zjWmvy^&8V1=TGZz#?aPUx)wTEkT?E?Rgu2ZwapKWp+y*yc8=_6{f&CIBY||e zC_m~LF?U8~4?=t-tpD(sRb=2u=Qvj6Gk_u=*@mrG`lx|(X(Qaj0gjdv47$!G#w)al z@uQeFa$aL&?+^60xgyTG=@mME*QFz(1t7k0sNNUk2HA3p*{xx2JYt1>Hk#-P{+X(% zB-I6jRjI$&5Ph+rMUp`E0y@Cv?bIzZ9<3YQa+VmH%9(&B%f^ouwcuG=JYyQD7H=Jj zccsm`Z0iOhWb58dUVphJNTP(H?Y_!Ru`FJ7!A6nv0A2$p@g!GW%)VvT#YP1~E3{}! z+ybuR&@CjsEY#)t?>vTBSx9UqV3SKWWz^r$XGA`xhEPz@D4(bCi*=&j=1t`-)*3_M zdlN1-=j?{q9`U@RcaGWSN~5K52l*vP@EN)+d=#+J|3LaP?th5zqPo_4_Q$zt4MpLQ zBQ|zngE!`LTK9nQj)k76j~GkCyd#Hhc@gs@-Js<4{pR|9c#Mn~2s_GDKW(nI+ad;B zhG&9FjW`0iK-uaLV<43=JfzD|EjCseT|cdM6CMp7A|?RJF5a@aZ>+DiU`f<6UKqe< zY9u2GaNS?2@6PdH5M&U~nAY1R@ffmgmW_8}wH&##W46AF_gP+#P;Q= z99oFdC}$IcEyr#aY8%j1?60D$kqwn@>ui)Ea4&nIf{V=cDFiX7fsh$hP-Qp0bT3D0@Gl7ju*Vf2C#(U;1 zs*~5(GoE)&WVACN^%Iz=*vqjbJA!4z>*fR5D1))PYedgK0MHItuz~@Lme$DZnADnu z9;hU)A3WA$&N32_kyRZDVg@P}+P;?_+zk|bKk!!;V0+HkOLsCjf3 z>*)$mnA9}BX5!GaRJ1SVAH@6`G1d(l7?n4vXd{D*5FS;Ecm#u74YqZcQ(m!Nf6+a? zl%nNmM7ts4qHVs)TB9xx485zBk(^6SPH@Ch*6VBBJ7k?5ayk+bB9&JRH=;6Gw`pav zKt9k_tA=1<1KnDUcw!Zprf;m*Zjd{8xUbHbr@d<8f z*F5j0K8$nuUAK|a$)Z)r3}=RL_Vk$Hk(~nYo$qFJ?@K^*0(4dEj2EQT0uOR z3#t#$+bHDZYR~i)JgHx{W#k-GY1n((F$o2O_7-cpmX_@O>cBfr#b>bR=C$nAA?d@M~?nxt%EEV<|>7LG(^`Wc2)VJ>Asc?$xVB(E7-bN;m9{kQOG#0|vJv zt|NpgDaza!li6}?WefFuBw7~BM`EUH&cZxGy+0nYHXOh3A~REZ#tag%;ZI<&k2W0dimGqXpy;Yq*I@7q1=-9p`=bj9 zKFhm9V-MyCtbm8uTNH-_b9_bJ3R%Cyb%EQLk;&Yc@2fAgGB#o=P01wbCvgatF|;8H z4b7HduY0hNmU4C6gKR{sKw1ysLTE5wuyP=`Dk$(!edPKC++G`nY@ifcNk8+|Ql_UT z5+o1yNg`hV=#H~8h|64Qmb|G|92x^Jt zIn-shFFK$*qL?T)SM0s!=!jbl<&~R~=+KGd zs`{N7!5kMMyFZL3QB|}SAlWM+pjL2-+|d%P5Hka$t^q?D9dNhtL2rY0N`2${$)2cr z@?cpN!fFX`$ z_S6Li8kma9WEHCEOa@!BQH{K0PUL`_T4gPb)tFgJTcX^Avk|eQ?Ln9m9|`xd#0#C! zRaMQ5*6cGCQTKAG6R_`kgc)~mn^=sWz3WW}tiGo-SU*XE?$l2qik8cErOSG#6;WkH z37ibKg=LLXAbK|=9*3s5-6qCFb$ecLFP_6z1v@9tbN+>hN~1;>Y1cx?7n<&ju2>FDu(-))iAZxQKnI_tak~syJTA4}B{A*%O9M7Gpi(gnB7m@f z9SPC_DU_CZ>cS1@NQuFzzegzETr3MhUq5gwq}-%X$4sq3c}N{n-IFN{NRWgD73&UG zba70yC0a3#T$fdh%e+TXwS*d(QK11dZ2w8)^(YOemW7cz9kJ7|HNc|UZqFQTVFp5` zwKlar2O4r;Xtp)i0y9pt<8rmb*Wlrr!;7Dm*wn$*#j|eYnaOmSQB%`qX&4k*Ya~M{ z=)u<5WP+*S;X(%8RHnKcxAvIh`}EDEQE~{bRaDRc1<_>$4T)F8#M)yomd0)%U(UgV zhrEEn9ps31Be)H3LxwQeynKwyKvf3S%~5syEFlx`3WnJQYc%dU@D@Tri)=eo^l1!T zFmJ&8c4nk?45O_kn-%VTf%QnpWuZZILHMBK+Q&+6Y zntHdmZW1Ru1CEKlOs5S*sKn9<+iH|{;Rql!4aWgch>HWTD)kCH0*tk0{cthA4s#}B zE-fgfYHtuSsA{lg2U(+9GV45MrHsC|18Fj`jNdY~h78}f42F8Zy38SYZM z0&6X6vMdHo&VAZ)KvE6NG2yhNuOJ0rQtGV739uaK85*=qN|;^QqpBXn?e7Mfhh`1n zktDIJavDPO&#rOi*NVk=Ckx%dTsq(`HHHB&ZRRr4+!VRmV6cz2XJR`o_Hqzbd7(XV z-_^NhQ8BTMfu>=iB8yn4BRAW5S65x&dc^e%U$JUiojaQx<&Q*bb?aVz7c+1g;A(PB z9Ao|4nRw&BmNJ|^lFzKSlZ*AC7Z*Jq<3^D}d@96KPh1~l6B=!!QI)lZDk;Mw?;x=; z)4!jLFG3JY7-M#c)v6ybMo*m9iSfZ5;tXjCa7gzs#Kx4omk8JBQ;g!T`&HI43l+6R z+EESE;naBn)=>s8R^w|?`6k90&5s>~z`g3nVgQ2hh*2Dvw*YIIyd6ekNcCZ42z3(` z^pOCg0vd{fugyXP(qI;BqRJmihz>MIEFwD`TDeGl5otKQ9x1)b9!5jXRv?=+hPb4LdRhff0(-oCa+YGW-S2S!Ln$n8NkzsAD6!`xIwo!DY{=du%J7dx& zk(hgLhuUpqPkGE0&$7Y~I#G}?svi)&ijG9_ZoT5pX#?nV`GHuG9%JbNm^FR7LH$KH zuK2{>^eNqoZ)mZRW_8WshpkjoF)MJ7EJ(IQV@blhF5Hq-k^ORW1z>_?hotUHHD;B| zLutH!OW*WSFED8E7tjEC=b|k&P8S=zw{^1nWDBKqM3>k|pX+}G+A5LbDMURy>2fcs u(JoGheUy3)H-mgBgI02+xa^{0dGm(8w4T8|G?07A)G!wVYPuV<_WuF-sV6u9 diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/Makefile b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/Makefile new file mode 100755 index 000000000000..aeffa4376588 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/Makefile @@ -0,0 +1,6 @@ +obj-m += inv_cpld.o inv_psoc.o +obj-m += inv_platform.o +obj-m += inv_eeprom.o +obj-m += swps.o +swps-objs := inv_swps.o io_expander.o transceiver.o + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_cpld.c b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_cpld.c new file mode 100644 index 000000000000..683ffa0ff3ce --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_cpld.c @@ -0,0 +1,415 @@ +/* + * 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 "I2CHostCommunication.h" + +#define USE_SMBUS 1 + +/* definition */ +#define CPLD_INFO_OFFSET 0x00 +#define CPLD_PSU_OFFSET 0x08 +#define CPLD_LED_OFFSET 0x0E +#define CPLD_LED_STATU_OFFSET 0x0D +#define CPLD_CTL_OFFSET 0x0C + + + +/* Each client has this additional data */ +struct cpld_data { + struct device *hwmon_dev; + struct mutex update_lock; +}; + +/*-----------------------------------------------------------------------*/ + +static ssize_t cpld_i2c_read(struct i2c_client *client, u8 *buf, u8 offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg[0].buf = msgbuf; + msg[0].len = 1; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + status = i2c_transfer(client->adapter, msg, 2); + + if(status == 2) + status = count; + + return status; +#endif +} + +static ssize_t cpld_i2c_write(struct i2c_client *client, char *buf, unsigned offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + return status; +#endif +} + +/*-----------------------------------------------------------------------*/ + +/* sysfs attributes for hwmon */ + +static ssize_t show_info(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[4]; + + memset(b, 0, 4); + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, b, CPLD_INFO_OFFSET, 4); + mutex_unlock(&data->update_lock); + + if(status != 4) return sprintf(buf, "read cpld info fail\n"); + + status = sprintf (buf, "The CPLD release date is %02d/%02d/%d.\n", b[2] & 0xf, (b[3] & 0x1f), 2014+(b[2] >> 4)); /* mm/dd/yyyy*/ + status = sprintf (buf, "%sThe PCB version is %X%X\n", buf, b[0]>>4, b[0]&0xf); + status = sprintf (buf, "%sThe CPLD version is %d.%d\n", buf, b[1]>>4, b[1]&0xf); + + return strlen(buf); +} + + +static ssize_t show_ctl(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[1]; + + mutex_lock(&data->update_lock); + + status = cpld_i2c_read(client, b, CPLD_CTL_OFFSET, 1); + + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld ctl fail\n"); + + + status = sprintf (buf, "0x%X\n", b[0]); + + return strlen(buf); +} + +static ssize_t set_ctl(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + + u8 temp = simple_strtol(buf, NULL, 10); + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_CTL_OFFSET, 1); + if(temp) byte |= (1<<0); + else byte &= ~(1<<0); + cpld_i2c_write(client, &byte, CPLD_CTL_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + + +static char* led_str[] = { + "OFF", //000 + "0.5 Hz", //001 + "1 Hz", //010 + "2 Hz", //011 + "NA", //100 + "NA", //101 + "NA", //110 + "ON", //111 +}; + +static ssize_t show_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 0)?3:0; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_LED_OFFSET, 1); + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld offset 0x%x\n", CPLD_LED_OFFSET); + + byte = (byte >> shift) & 0x7; + + /* + 0: off + 1: 0.5hz + 2: 1 hz + 3: 2 hz + 4~6: not define + 7: on + */ + + status = sprintf (buf, "%d: %s\n", byte, led_str[byte]); + + return strlen(buf); +} + +static ssize_t set_led(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + + u8 temp = simple_strtol(buf, NULL, 16); + u8 byte; + int shift = (attr->index == 0)?3:0; + + temp &= 0x7; + //validate temp value: 0,1,2,3,7, TBD + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_LED_OFFSET, 1); + byte &= ~(0x7<update_lock); + + return count; +} + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu0 | psu1 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 1)?0:3; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_PSU_OFFSET, 1); + mutex_unlock(&data->update_lock); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + + +static SENSOR_DEVICE_ATTR(info, S_IRUGO, show_info, 0, 0); +static SENSOR_DEVICE_ATTR(ctl, S_IWUSR|S_IRUGO, show_ctl, set_ctl, 0); + +static SENSOR_DEVICE_ATTR(grn_led, S_IWUSR|S_IRUGO, show_led, set_led, 0); +static SENSOR_DEVICE_ATTR(red_led, S_IWUSR|S_IRUGO, show_led, set_led, 1); + +static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu, 0, 0); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu, 0, 1); + +static struct attribute *cpld_attributes[] = { + //info + &sensor_dev_attr_info.dev_attr.attr, + &sensor_dev_attr_ctl.dev_attr.attr, + + &sensor_dev_attr_grn_led.dev_attr.attr, + &sensor_dev_attr_red_led.dev_attr.attr, + + &sensor_dev_attr_psu0.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + + NULL +}; + +static const struct attribute_group cpld_group = { + .attrs = cpld_attributes, +}; + +/*-----------------------------------------------------------------------*/ + +/* device probe and removal */ + +static int +cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct cpld_data *data; + int status; + + printk("+%s\n", __func__); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + return -EIO; + + data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cpld_group); + if (status) + goto exit_free; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &cpld_group); +exit_free: + i2c_set_clientdata(client, NULL); + kfree(data); + return status; +} + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cpld_group); + i2c_set_clientdata(client, NULL); + kfree(data); + return 0; +} + +static const struct i2c_device_id cpld_ids[] = { + { "inv_cpld", 0, }, + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, cpld_ids); + +static struct i2c_driver cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "inv_cpld", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_ids, +}; + +/*-----------------------------------------------------------------------*/ + +/* module glue */ + +static int __init inv_cpld_init(void) +{ + return i2c_add_driver(&cpld_driver); +} + +static void __exit inv_cpld_exit(void) +{ + i2c_del_driver(&cpld_driver); +} + +MODULE_AUTHOR("eddie.lan "); +MODULE_DESCRIPTION("inv cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_cpld_init); +module_exit(inv_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_eeprom.c b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_eeprom.c new file mode 100644 index 000000000000..3d13f3b04719 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_eeprom.c @@ -0,0 +1,181 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void inv_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, ((u8)addr >> 8) & 0xFF, (u8)addr & 0xFF); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } + +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t inv_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + inv_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static struct bin_attribute inv_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = inv_eeprom_read, +}; + +static int inv_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &inv_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int inv_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &inv_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id inv_eeprom_id[] = { + { "inv_eeprom", 0 }, + { } +}; + +static struct i2c_driver inv_eeprom_driver = { + .driver = { + .name = "inv_eeprom", + }, + .probe = inv_eeprom_probe, + .remove = inv_eeprom_remove, + .id_table = inv_eeprom_id, +}; + +module_i2c_driver(inv_eeprom_driver); + +MODULE_AUTHOR("Inventec"); +MODULE_DESCRIPTION("Inventec D7054 Mother Board EEPROM driver"); +MODULE_LICENSE("GPL"); + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_platform.c b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_platform.c new file mode 100644 index 000000000000..ea26970075b0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_platform.c @@ -0,0 +1,219 @@ +#include +//#include +#include +#include +#include +#include +#include + +#include +//#include +//#include + +//#include +//#define IO_EXPAND_BASE 64 +//#define IO_EXPAND_NGPIO 16 + +struct inv_i2c_board_info { + int ch; + int size; + struct i2c_board_info *board_info; +}; + +#define bus_id(id) (id) +static struct pca954x_platform_mode mux_modes_0[] = { + {.adap_id = bus_id(2),}, {.adap_id = bus_id(3),}, + {.adap_id = bus_id(4),}, {.adap_id = bus_id(5),}, + {.adap_id = bus_id(6),}, {.adap_id = bus_id(7),}, + {.adap_id = bus_id(8),}, {.adap_id = bus_id(9),}, +}; +static struct pca954x_platform_mode mux_modes_0_0[] = { + {.adap_id = bus_id(10),}, {.adap_id = bus_id(11),}, + {.adap_id = bus_id(12),}, {.adap_id = bus_id(13),}, + {.adap_id = bus_id(14),}, {.adap_id = bus_id(15),}, + {.adap_id = bus_id(16),}, {.adap_id = bus_id(17),}, +}; + +static struct pca954x_platform_mode mux_modes_0_1[] = { + {.adap_id = bus_id(18),}, {.adap_id = bus_id(19),}, + {.adap_id = bus_id(20),}, {.adap_id = bus_id(21),}, + {.adap_id = bus_id(22),}, {.adap_id = bus_id(23),}, + {.adap_id = bus_id(24),}, {.adap_id = bus_id(25),}, +}; + +static struct pca954x_platform_mode mux_modes_0_2[] = { + {.adap_id = bus_id(26),}, {.adap_id = bus_id(27),}, + {.adap_id = bus_id(28),}, {.adap_id = bus_id(29),}, + {.adap_id = bus_id(30),}, {.adap_id = bus_id(31),}, + {.adap_id = bus_id(32),}, {.adap_id = bus_id(33),}, +}; + +static struct pca954x_platform_mode mux_modes_0_3[] = { + {.adap_id = bus_id(34),}, {.adap_id = bus_id(35),}, + {.adap_id = bus_id(36),}, {.adap_id = bus_id(37),}, + {.adap_id = bus_id(38),}, {.adap_id = bus_id(39),}, + {.adap_id = bus_id(40),}, {.adap_id = bus_id(41),}, +}; + +static struct pca954x_platform_mode mux_modes_0_4[] = { + {.adap_id = bus_id(42),}, {.adap_id = bus_id(43),}, + {.adap_id = bus_id(44),}, {.adap_id = bus_id(45),}, + {.adap_id = bus_id(46),}, {.adap_id = bus_id(47),}, + {.adap_id = bus_id(48),}, {.adap_id = bus_id(49),}, +}; + +static struct pca954x_platform_mode mux_modes_0_5[] = { + {.adap_id = bus_id(50),}, {.adap_id = bus_id(51),}, + {.adap_id = bus_id(52),}, {.adap_id = bus_id(53),}, + {.adap_id = bus_id(54),}, {.adap_id = bus_id(55),}, + {.adap_id = bus_id(56),}, {.adap_id = bus_id(57),}, +}; + +static struct pca954x_platform_mode mux_modes_0_6[] = { + {.adap_id = bus_id(58),}, {.adap_id = bus_id(59),}, + {.adap_id = bus_id(60),}, {.adap_id = bus_id(61),}, + {.adap_id = bus_id(62),}, {.adap_id = bus_id(63),}, + {.adap_id = bus_id(64),}, {.adap_id = bus_id(65),}, +}; + +//no i2c device driver attach to mux 7 + + +static struct pca954x_platform_data mux_data_0 = { + .modes = mux_modes_0, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_0 = { + .modes = mux_modes_0_0, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_1 = { + .modes = mux_modes_0_1, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_2 = { + .modes = mux_modes_0_2, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_3 = { + .modes = mux_modes_0_3, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_4 = { + .modes = mux_modes_0_4, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_5 = { + .modes = mux_modes_0_5, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_6 = { + .modes = mux_modes_0_6, + .num_modes = 8, +}; + +static struct i2c_board_info i2c_device_info0[] __initdata = { + {"inv_psoc", 0, 0x66, 0, 0, 0},//psoc + {"inv_cpld", 0, 0x55, 0, 0, 0},//cpld + {"pca9548", 0, 0x71, &mux_data_0, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info2[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_0, 0, 0}, +}; +static struct i2c_board_info i2c_device_info3[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_1, 0, 0}, +}; +static struct i2c_board_info i2c_device_info4[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_2, 0, 0}, +}; +static struct i2c_board_info i2c_device_info5[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_3, 0, 0}, +}; +static struct i2c_board_info i2c_device_info6[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_4, 0, 0}, +}; +static struct i2c_board_info i2c_device_info7[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_5, 0, 0}, +}; +static struct i2c_board_info i2c_device_info8[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_6, 0, 0}, +}; + + +static struct inv_i2c_board_info i2cdev_list[] = { + {0, ARRAY_SIZE(i2c_device_info0), i2c_device_info0 }, //smbus 0 + + {bus_id(2), ARRAY_SIZE(i2c_device_info2), i2c_device_info2 }, //mux 0 + {bus_id(3), ARRAY_SIZE(i2c_device_info3), i2c_device_info3 }, //mux 1 + {bus_id(4), ARRAY_SIZE(i2c_device_info4), i2c_device_info4 }, //mux 2 + {bus_id(5), ARRAY_SIZE(i2c_device_info5), i2c_device_info5 }, //mux 3 + {bus_id(6), ARRAY_SIZE(i2c_device_info6), i2c_device_info6 }, //mux 4 + {bus_id(7), ARRAY_SIZE(i2c_device_info7), i2c_device_info7 }, //mux 5 + {bus_id(8), ARRAY_SIZE(i2c_device_info8), i2c_device_info8 }, //mux 6 + +}; + +///////////////////////////////////////////////////////////////////////////////////////// +#if 0 +static struct i2c_gpio_platform_data i2c_gpio_platdata0 = { + .scl_pin = 58, + .sda_pin = 75, + + .udelay = 5, //5:100kHz + .sda_is_open_drain = 0, + .scl_is_open_drain = 0, + .scl_is_output_only = 0 +}; + +static struct platform_device device_i2c_gpio0 = { + .name = "i2c-gpio", + .id = 0, // adapter number + .dev.platform_data = &i2c_gpio_platdata0, +}; +#endif +static int __init inv_platform_init(void) +{ + struct i2c_adapter *adap = NULL; + struct i2c_client *e = NULL; + int ret = 0; + int i,j; + + printk("%s \n", __func__); + +#if 0 + //use i2c-gpio + //register i2c gpio + //config gpio58,75 to gpio function 58=32+3*8+2 75=32*2+8*1+3 + outl( inl(0x533) | (1<<2), 0x533); + outl( inl(0x541) | (1<<3), 0x541); + + ret = platform_device_register(&device_i2c_gpio0); + if (ret) { + printk(KERN_ERR "i2c-gpio: device_i2c_gpio0 register fail %d\n", ret); + } + #endif + for(i=0; i +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//#include "I2CHostCommunication.h" + +#define IMPLEMENT_IPMI_CODE 1 +int USE_IPMI=0; +//================================= +#if IMPLEMENT_IPMI_CODE +#include +#include +#include +#include + +#define IPMI_MAX_INTF (4) +#define NETFN_OEM 0x30 +#define CMD_GETDATA 0x31 +#define CMD_SETDATA 0x32 + +struct mutex ipmi_mutex; + +static void msg_handler(struct ipmi_recv_msg *msg,void* handler_data); +static ipmi_user_t ipmi_mh_user = NULL; +static struct ipmi_user_hndl ipmi_hndlrs = { .ipmi_recv_hndl = msg_handler,}; + +static atomic_t dummy_count = ATOMIC_INIT(0); +static void dummy_smi_free(struct ipmi_smi_msg *msg) +{ + atomic_dec(&dummy_count); +} +static void dummy_recv_free(struct ipmi_recv_msg *msg) +{ + atomic_dec(&dummy_count); +} +static struct ipmi_smi_msg halt_smi_msg = { + .done = dummy_smi_free +}; +static struct ipmi_recv_msg halt_recv_msg = { + .done = dummy_recv_free +}; +#endif +//================================= + +#define USE_SMBUS 1 + +#define FAN_NUM 4 +#define PSU_NUM 2 + +struct __attribute__ ((__packed__)) psoc_psu_layout { + u16 psu1_iin; + u16 psu2_iin; + u16 psu1_iout; + u16 psu2_iout; + + u16 psu1_pin; + u16 psu2_pin; + u16 psu1_pout; + u16 psu2_pout; + + u16 psu1_vin; + u16 psu2_vin; + u16 psu1_vout; + u16 psu2_vout; +}; + +struct __attribute__ ((__packed__)) psoc_layout { + u8 ctl; //offset: 0 + u16 switch_temp; //offset: 1 + u8 reserve0; //offset: 3 + + u8 fw_upgrade; //offset: 4 + + //i2c bridge + u8 i2c_st; //offset: 5 + u8 i2c_ctl; //offset: 6 + u8 i2c_addr; //offset: 7 + u8 i2c_data[0x20]; //offset: 8 + + //gpo + u8 led_ctl; //offset: 28 + + u8 gpio; //offset: 29 + + //pwm duty + u8 pwm[FAN_NUM]; //offset: 2a + u8 pwm_psu[PSU_NUM]; //offset: 2e + + //fan rpm + u16 fan[FAN_NUM*2]; //offset: 30 + + u8 reserve1[4]; //offset: 40 + + //gpi + u8 gpi_fan; //offset: 44 + + //psu state + u8 psu_state; //offset: 45 + + //temperature + u16 temp[5]; //offset: 46 + u16 temp_psu[PSU_NUM]; //offset: 50 + + //version + u8 version[2]; //offset: 54 + + u8 reserve2[4]; //offset: 56 + struct psoc_psu_layout psu_info; //offset: 5a +}; + +/* definition */ +/* definition */ +#define PSOC_OFF(m) offsetof(struct psoc_layout, m) +#define PSOC_PSU_OFF(m) offsetof(struct psoc_psu_layout, m) + +#define SWITCH_TMP_OFFSET PSOC_OFF(switch_temp) +#define PWM_OFFSET PSOC_OFF(pwm) +#define THERMAL_OFFSET PSOC_OFF(temp) +#define RPM_OFFSET PSOC_OFF(fan) +#define DIAG_FLAG_OFFSET PSOC_OFF(ctl) +#define FAN_LED_OFFSET PSOC_OFF(led_ctl) +#define FAN_GPI_OFFSET PSOC_OFF(gpi_fan) +#define PSOC_PSU_OFFSET PSOC_OFF(psu_state) +#define VERSION_OFFSET PSOC_OFF(version) +#define PSU_INFO_OFFSET PSOC_OFF(psu_info) + +/* Each client has this additional data */ +struct psoc_data { + struct device *hwmon_dev; + struct mutex update_lock; + u32 diag; +}; + +/*-----------------------------------------------------------------------*/ +#if IMPLEMENT_IPMI_CODE +static void msg_handler(struct ipmi_recv_msg *recv_msg,void* handler_data) +{ + struct completion *comp = recv_msg->user_msg_data; + if (comp) + complete(comp); + else + ipmi_free_recv_msg(recv_msg); + return; +} + +int ipmi_command(char NetFn, char cmd,char *data,int data_length, char* result, int* result_length) +{ + int rv=0,i; + struct ipmi_system_interface_addr addr; + uint8_t _data[data_length]; + struct kernel_ipmi_msg msg; + struct completion comp; + + if(!mutex_trylock(&ipmi_mutex)) return 0; + +// for (i=0,rv=1; iaddr; + msg[0].buf = msgbuf; + msg[0].len = 1; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + status = i2c_transfer(client->adapter, msg, 2); + + if(status == 2) + status = count; + + return status; +#endif +} + +static ssize_t psoc_i2c_write(struct i2c_client *client, char *buf, unsigned offset, size_t count) +{ +#if USE_SMBUS +if(USE_IPMI==0) +{ + int i; + + for(i=0; iaddr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + return status; +#endif +} + +#if 0 +static u32 psoc_read32(struct i2c_client *client, u8 offset) +{ + u32 value = 0; + u8 buf[4]; + + if( psoc_i2c_read(client, buf, offset, 4) == 4) + value = (buf[0]<<24 | buf[1]<<16 | buf[2]<<8 | buf[3]); + + return value; +} +#endif + +static u16 psoc_read16(struct i2c_client *client, u8 offset) +{ + u16 value = 0; + u8 buf[2]; + + if(psoc_i2c_read(client, buf, offset, 2) == 2) + value = (buf[0]<<8 | buf[1]<<0); + + return value; +} + +static u8 psoc_read8(struct i2c_client *client, u8 offset) +{ + u8 value = 0; + u8 buf = 0; + + if(psoc_i2c_read(client, &buf, offset, 1) == 1) + value = buf; + + return value; +} + +//PSOC i2c bridge regsters +#define PSOC_I2C_STATUS 0x05 +#define PSOC_I2C_CNTRL 0x06 +#define PSOC_I2C_ADDR 0x07 +#define PSOC_I2C_DATA 0x08 + +//status bit definition +#define PSOC_I2C_START (1 << 0) +#define PSOC_PMB_SEL (1 << 7) + +//addr bits definition +#define PSOC_I2C_READ (1 << 0) + +//PMBUS registers definition +#define PMBUS_READ_VIN (0x88) +#define PMBUS_READ_IIN (0x89) +#define PMBUS_READ_VOUT (0x8B) +#define PMBUS_READ_IOUT (0x8C) +#define PMBUS_READ_POUT (0x96) +#define PMBUS_READ_PIN (0x97) + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu1 | psu0 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu_st(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 0)?3:0; + + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client, &byte, PSOC_PSU_OFFSET, 1); + mutex_unlock(&data->update_lock); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + +/*-----------------------------------------------------------------------*/ + +/* sysfs attributes for hwmon */ +#define PSU1 0x5800 +#define PSU2 0x5900 +#define BMC_I2cBus 3 //BMC's I2C-1 +#define PMBus_Vender 0x99 +#define PMBus_Serial 0x9E +#define PMBus_Temp2 0x8E +#define PMBus_Version 0x9B +#define MaxLeng_Result 0x20 +#define MaxLog +static long pmbus_reg2data_linear(int data, int linear16); + + +static ssize_t show_ipmi_i2c(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + uint8_t data[4],result[MaxLeng_Result]; + int result_len; + + data[0] = BMC_I2cBus; + data[1] = (attr->index & 0xFF00 ) >>7; + data[3] = attr->index & 0xff; + if(data[3]==PMBus_Temp2) + data[2]=2; + else + data[2]=MaxLeng_Result; + + if(ipmi_command(0x06, 0x52,data,4, result, &result_len)==0) + { + if(data[3]==PMBus_Temp2) + { + return sprintf(buf, "%ld \n", pmbus_reg2data_linear(result[0] | (result[1]<<8), 0 )); + } + result[result[0]+1]='\0'; + + return sprintf(buf, "%s\n",&result[1] ); + } + else + return 0; +} + +static ssize_t show_ipmi_sollog(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + uint8_t data[5],result[256]; + int result_len; + uint32_t i; + + for(i=0;i<0xffffff;i+=255) + { + data[0] = attr->index; + data[1] = (i & 0x0000ff); + data[2] = (i & 0x00ff00)>>8; + data[3] = (i & 0xff0000)>>16; + data[4] = 0; + + result_len=0; + + if(ipmi_command(0x32, 0xFE, data, 5, result, &result_len)==0) + { + if(result_len==0) break; + result[result_len+1]='\0'; + printk("%s",result); + } + else break; + + if(result_len==0) break; + } + + return 0; +} + +static ssize_t show_thermal(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index * 2 + THERMAL_OFFSET; + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + (s8)(status>>8) * 1000 ); +} + + + +static ssize_t show_pwm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index + PWM_OFFSET; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + status); +} + +static ssize_t set_pwm(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index + PWM_OFFSET; + + u8 pwm = simple_strtol(buf, NULL, 10); + if(pwm > 255) pwm = 255; + + if(data->diag) { + mutex_lock(&data->update_lock); + psoc_i2c_write(client, &pwm, offset, 1); + mutex_unlock(&data->update_lock); + } + + return count; +} + + +static ssize_t show_rpm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index*2 + RPM_OFFSET; + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + status); +} + +static ssize_t show_switch_tmp(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u16 temp = 0; + + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client, (u8*)&temp, SWITCH_TMP_OFFSET, 2); + mutex_unlock(&data->update_lock); + + status = sprintf (buf, "%d\n", (s8)(temp>>8) * 1000 ); + + return strlen(buf); +} + +static ssize_t set_switch_tmp(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + + long temp = simple_strtol(buf, NULL, 10); + u16 temp2 = ( (temp/1000) <<8 ) & 0xFF00 ; + + //printk("set_switch_tmp temp=%d, temp2=0x%x (%x,%x)\n", temp, temp2, ( ( (temp/1000) <<8 ) & 0xFF00 ), (( (temp%1000) / 10 ) & 0xFF)); + + mutex_lock(&data->update_lock); + psoc_i2c_write(client, (u8*)&temp2, SWITCH_TMP_OFFSET, 2); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_diag(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 diag_flag = 0; + + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client, (u8*)&diag_flag, DIAG_FLAG_OFFSET, 1); + mutex_unlock(&data->update_lock); + + data->diag = (diag_flag & 0x80)?1:0; + status = sprintf (buf, "%d\n", data->diag); + + return strlen(buf); +} + +static ssize_t set_diag(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 value = 0; + u8 diag = simple_strtol(buf, NULL, 10); + + diag = diag?1:0; + data->diag = diag; + + mutex_lock(&data->update_lock); + psoc_i2c_read(client, (u8*)&value, DIAG_FLAG_OFFSET, 1); + if(diag) value |= (1<<7); + else value &= ~(1<<7); + psoc_i2c_write(client, (u8*)&value, DIAG_FLAG_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, VERSION_OFFSET); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "ver: %x.%x\n", (status & 0xFF00)>>8, (status & 0xFF) ); +} + + +static ssize_t show_fan_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 bit = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, FAN_LED_OFFSET); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + (status & (1<index; + u8 led_state = 0; + + u8 v = simple_strtol(buf, NULL, 10); + + if(data->diag) { + mutex_lock(&data->update_lock); + led_state = psoc_read8(client, FAN_LED_OFFSET); + if(v) led_state |= (1<update_lock); + } + + return count; +} + +static ssize_t show_value8(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "0x%02X\n", status ); +} + +static long pmbus_reg2data_linear(int data, int linear16) +{ + s16 exponent; + s32 mantissa; + long val; + + if (linear16) { /* LINEAR16 */ + exponent = -9; + mantissa = (u16) data; + } else { /* LINEAR11 */ + exponent = ((s16)data) >> 11; + exponent = ((s16)( data & 0xF800) ) >> 11; + mantissa = ((s32)((data & 0x7ff) << 5)) >> 5; + } + + //printk("data=%d, m=%d, e=%d\n", data, exponent, mantissa); + val = mantissa; + + /* scale result to micro-units for power sensors */ + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val; +} + +static ssize_t show_psu_psoc(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index + PSU_INFO_OFFSET; + + mutex_lock(&data->update_lock); + status = psoc_read16(client, offset); + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%ld \n", pmbus_reg2data_linear(status, strstr(attr->dev_attr.attr.name, "vout")? 1:0 )); +} + + + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_thermal, 0, 0); +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_thermal, 0, 1); +static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_thermal, 0, 2); +static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_thermal, 0, 3); +static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_thermal, 0, 4); +static SENSOR_DEVICE_ATTR(thermal_psu1, S_IRUGO, show_thermal, 0, 5); +static SENSOR_DEVICE_ATTR(thermal_psu2, S_IRUGO, show_thermal, 0, 6); + +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 0); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 1); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 2); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 3); +static SENSOR_DEVICE_ATTR(pwm_psu1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 4); +static SENSOR_DEVICE_ATTR(pwm_psu2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 5); + +static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu_st, 0, 0); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu_st, 0, 1); + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_rpm, 0, 0); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_rpm, 0, 1); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_rpm, 0, 2); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_rpm, 0, 3); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_rpm, 0, 4); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_rpm, 0, 5); +static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_rpm, 0, 6); +static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_rpm, 0, 7); +static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8); +static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9); + +static SENSOR_DEVICE_ATTR(switch_tmp, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); + +static SENSOR_DEVICE_ATTR(diag, S_IWUSR|S_IRUGO, show_diag, set_diag, 0); +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, 0, 0); + +static SENSOR_DEVICE_ATTR(fan_led_grn1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 0); +static SENSOR_DEVICE_ATTR(fan_led_grn2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 1); +static SENSOR_DEVICE_ATTR(fan_led_grn3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 2); +static SENSOR_DEVICE_ATTR(fan_led_grn4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 3); +static SENSOR_DEVICE_ATTR(fan_led_red1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 4); +static SENSOR_DEVICE_ATTR(fan_led_red2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 5); +static SENSOR_DEVICE_ATTR(fan_led_red3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 6); +static SENSOR_DEVICE_ATTR(fan_led_red4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 7); + +static SENSOR_DEVICE_ATTR(fan_gpi, S_IRUGO, show_value8, 0, FAN_GPI_OFFSET); +static SENSOR_DEVICE_ATTR(psoc_psu1_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pout)); + + +static SENSOR_DEVICE_ATTR(psoc_psu2_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); + +//IPMI +static SENSOR_DEVICE_ATTR(thermal2_psu1, S_IRUGO, show_ipmi_i2c, 0, PSU1 | PMBus_Temp2); +static SENSOR_DEVICE_ATTR(psoc_psu1_vender, S_IRUGO, show_ipmi_i2c, 0, PSU1 | PMBus_Vender); +static SENSOR_DEVICE_ATTR(psoc_psu1_serial, S_IRUGO, show_ipmi_i2c, 0, PSU1 | PMBus_Serial); +static SENSOR_DEVICE_ATTR(psoc_psu1_version, S_IRUGO, show_ipmi_i2c, 0, PSU1 | PMBus_Version); + +static SENSOR_DEVICE_ATTR(thermal2_psu2, S_IRUGO, show_ipmi_i2c, 0, PSU2 | PMBus_Temp2); +static SENSOR_DEVICE_ATTR(psoc_psu2_vender, S_IRUGO, show_ipmi_i2c, 0, PSU2 | PMBus_Vender); +static SENSOR_DEVICE_ATTR(psoc_psu2_serial, S_IRUGO, show_ipmi_i2c, 0, PSU2 | PMBus_Serial); +static SENSOR_DEVICE_ATTR(psoc_psu2_version, S_IRUGO, show_ipmi_i2c, 0, PSU2 | PMBus_Version); + +static SENSOR_DEVICE_ATTR(sollog1, S_IRUGO, show_ipmi_sollog, 0, 1); +static SENSOR_DEVICE_ATTR(sollog2, S_IRUGO, show_ipmi_sollog, 0, 2); + +static struct attribute *psoc_attributes[] = { + //thermal + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp4_input.dev_attr.attr, + &sensor_dev_attr_temp5_input.dev_attr.attr, + + &sensor_dev_attr_thermal_psu1.dev_attr.attr, + &sensor_dev_attr_thermal_psu2.dev_attr.attr, + + + //pwm + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, + &sensor_dev_attr_pwm_psu1.dev_attr.attr, + &sensor_dev_attr_pwm_psu2.dev_attr.attr, + + //rpm + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan6_input.dev_attr.attr, + &sensor_dev_attr_fan7_input.dev_attr.attr, + &sensor_dev_attr_fan8_input.dev_attr.attr, + + &sensor_dev_attr_rpm_psu1.dev_attr.attr, + &sensor_dev_attr_rpm_psu2.dev_attr.attr, + + //switch temperature + &sensor_dev_attr_switch_tmp.dev_attr.attr, + + //diag flag + &sensor_dev_attr_diag.dev_attr.attr, + + //version + &sensor_dev_attr_version.dev_attr.attr, + + //fan led + &sensor_dev_attr_fan_led_grn1.dev_attr.attr, + &sensor_dev_attr_fan_led_grn2.dev_attr.attr, + &sensor_dev_attr_fan_led_grn3.dev_attr.attr, + &sensor_dev_attr_fan_led_grn4.dev_attr.attr, + &sensor_dev_attr_fan_led_red1.dev_attr.attr, + &sensor_dev_attr_fan_led_red2.dev_attr.attr, + &sensor_dev_attr_fan_led_red3.dev_attr.attr, + &sensor_dev_attr_fan_led_red4.dev_attr.attr, + + //fan GPI + &sensor_dev_attr_fan_gpi.dev_attr.attr, + &sensor_dev_attr_psu0.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + + + //psu_psoc, new added on psoc 1.9 + &sensor_dev_attr_psoc_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pout.dev_attr.attr, + + //ipmi_command + &sensor_dev_attr_thermal2_psu1.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_vender.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_serial.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_version.dev_attr.attr, + + &sensor_dev_attr_thermal2_psu2.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vender.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_serial.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_version.dev_attr.attr, + + &sensor_dev_attr_sollog1.dev_attr.attr, + &sensor_dev_attr_sollog2.dev_attr.attr, + + NULL +}; + +static const struct attribute_group psoc_group = { + .attrs = psoc_attributes, +}; + +/*-----------------------------------------------------------------------*/ + +/* device probe and removal */ + +static int +psoc_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct psoc_data *data; + int status,i,rv; + + printk("+%s\n", __func__); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + return -EIO; + + data = kzalloc(sizeof(struct psoc_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->diag = 0; + +#if IMPLEMENT_IPMI_CODE + for (i=0,rv=1; idev.kobj, &psoc_group); + if (status) + goto exit_free; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &psoc_group); +exit_free: + i2c_set_clientdata(client, NULL); + kfree(data); + return status; +} + +static int psoc_remove(struct i2c_client *client) +{ + struct psoc_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &psoc_group); + i2c_set_clientdata(client, NULL); + kfree(data); + return 0; +} + +static const struct i2c_device_id psoc_ids[] = { + { "inv_psoc", 0, }, + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, psoc_ids); + +static struct i2c_driver psoc_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "inv_psoc", + }, + .probe = psoc_probe, + .remove = psoc_remove, + .id_table = psoc_ids, +}; + +/*-----------------------------------------------------------------------*/ + +/* module glue */ + +static int __init inv_psoc_init(void) +{ + return i2c_add_driver(&psoc_driver); +} + +static void __exit inv_psoc_exit(void) +{ + i2c_del_driver(&psoc_driver); +} + +MODULE_AUTHOR("eddie.lan "); +MODULE_DESCRIPTION("inv psoc driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_psoc_init); +module_exit(inv_psoc_exit); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_swps.c b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_swps.c new file mode 100644 index 000000000000..08bd490e63b6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_swps.c @@ -0,0 +1,730 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "inv_swps.h" + +static int port_major; +static int ioexp_total; +static int port_total; +static struct class *swp_class_p = NULL; +static struct inv_platform_s *platform_p = NULL; +static struct inv_ioexp_layout_s *ioexp_layout = NULL; +static struct inv_port_layout_s *port_layout = NULL; + +static int +__swp_match(struct device *dev, +#ifdef SWPS_KERN_VER_AF_3_10 + + const void *data){ +#else + void *data){ +#endif + + char *name = (char *)data; + if (strcmp(dev_name(dev), name) == 0) + return 1; + return 0; +} + + +struct device * +get_swpdev_by_name(char *name){ + struct device *dev = class_find_device(swp_class_p, + NULL, + name, + (const void *)__swp_match); + return dev; +} + + +static int +sscanf_2_int(const char *buf) { + + int result = -EBFONT; + char *hex_tag = "0x"; + + if (strcspn(buf, hex_tag) == 0) { + if (sscanf(buf,"%x",&result)) { + return result; + } + } else { + if (sscanf(buf,"%d",&result)) { + return result; + } + if(sscanf(buf,"-%d",&result)) { + return -result; + } + if (sscanf(buf,"%x",&result)) { + return result; + } + } + return -EBFONT; +} + + +static int +sscanf_2_binary(const char *buf) { + + int result = sscanf_2_int(buf); + + if (result < 0){ + return -EBFONT; + } + switch (result) { + case 0: + case 1: + return result; + default: + break; + } + return -EBFONT; +} + +/* ========== Show functions: For I/O Expander attribute ========== + */ +static ssize_t +_show_ioexp_binary_attr(struct transvr_obj_s *tobj_p, + int (*get_func)(struct ioexp_obj_s *ioexp_p, int voffset), + char *buf_p) { + size_t len; + struct ioexp_obj_s *ioexp_p = tobj_p->ioexp_obj_p; + + if (!ioexp_p) { + SWPS_ERR(" %s: data corruption! :%s\n", __func__, tobj_p->swp_name); + return -ENODATA; + } + mutex_lock(&ioexp_p->lock); + len = snprintf(buf_p, 8, "%d\n", get_func(ioexp_p, tobj_p->ioexp_virt_offset)); + mutex_unlock(&ioexp_p->lock); + return len; +} + + +static ssize_t +show_attr_present(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_present, + buf_p); +} + +static ssize_t +show_attr_tx_fault(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_tx_fault, + buf_p); +} + +static ssize_t +show_attr_rxlos(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_rxlos, + buf_p); +} + +static ssize_t +show_attr_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_tx_disable, + buf_p); +} + +static ssize_t +show_attr_reset(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_reset, + buf_p); +} + +static ssize_t +show_attr_lpmod(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_lpmod, + buf_p); +} + + +static ssize_t +show_attr_modsel(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_modsel, + buf_p); +} + +/* ========== Store functions: For I/O Expander (R/W) attribute ========== + */ +static ssize_t +_store_ioexp_binary_attr(struct transvr_obj_s *tobj_p, + int (*set_func)(struct ioexp_obj_s *ioexp_p, + int virt_offset, int input_val), + const char *buf_p, + size_t count) { + + int input, err; + struct ioexp_obj_s *ioexp_p = tobj_p->ioexp_obj_p; + + if (!ioexp_p) { + SWPS_ERR("%s: data corruption! :%s\n", + __func__, tobj_p->swp_name); + return -ENODATA; + } + input = sscanf_2_binary(buf_p); + if (input < 0) { + return -EBFONT; + } + mutex_lock(&ioexp_p->lock); + err = set_func(ioexp_p, tobj_p->ioexp_virt_offset, input); + mutex_unlock(&ioexp_p->lock); + if (err < 0){ + return err; + } + return count; +} + +static ssize_t +store_attr_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_tx_disable, + buf_p, + count); +} + +static ssize_t +store_attr_reset(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_reset, + buf_p, + count); +} + + +static ssize_t +store_attr_lpmod(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_lpmod, + buf_p, + count); +} + + +static ssize_t +store_attr_modsel(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_modsel, + buf_p, + count); +} + +/* ========== IO Expander attribute: from expander ========== + */ +static DEVICE_ATTR(present, S_IRUGO, show_attr_present, NULL); +static DEVICE_ATTR(tx_fault, S_IRUGO, show_attr_tx_fault, NULL); +static DEVICE_ATTR(rxlos, S_IRUGO, show_attr_rxlos, NULL); +static DEVICE_ATTR(tx_disable, S_IRUGO|S_IWUSR, show_attr_tx_disable, store_attr_tx_disable); +static DEVICE_ATTR(reset, S_IRUGO|S_IWUSR, show_attr_reset, store_attr_reset); +static DEVICE_ATTR(lpmod, S_IRUGO|S_IWUSR, show_attr_lpmod, store_attr_lpmod); +static DEVICE_ATTR(modsel, S_IRUGO|S_IWUSR, show_attr_modsel, store_attr_modsel); + +/* ========== Functions for module handling ========== + */ +static void +clean_port_obj(void){ + + dev_t dev_num; + char dev_name[32]; + struct device *device_p; + struct transvr_obj_s *transvr_obj_p; + int minor_curr, port_id; + + for (minor_curr=0; minor_curri2c_client_p); + kfree(transvr_obj_p); + } + dev_num = MKDEV(port_major, minor_curr); + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); + } + SWPS_DEBUG("%s: done.\n", __func__); +} + + +static int +get_platform_type(void){ + + char log_msg[64] = "ERROR"; + + platform_p = kzalloc(sizeof(struct inv_platform_s), GFP_KERNEL); + if (!platform_p){ + snprintf(log_msg, sizeof(log_msg), "kzalloc fail"); + goto err_get_platform_type_1; + } + platform_p->id = PLATFORM_SETTINGS; + memset(platform_p->name, 0, sizeof(platform_p->name)); + snprintf(platform_p->name, (sizeof(platform_p->name) - 1), + "%s", platform_map.name); + snprintf(log_msg, sizeof(log_msg), + "User setup platform: %d (%s)", + platform_p->id, platform_p->name); + SWPS_DEBUG("%s: %s, :%d\n", __func__, log_msg, PLATFORM_SETTINGS); + return 0; + +err_get_platform_type_1: + SWPS_ERR("%s: %s :%d\n", __func__, log_msg, PLATFORM_SETTINGS); + return -1; +} + + +static int +get_layout_info(void){ + ioexp_layout = cypress_ga2_ioexp_layout; + port_layout = cypress_ga2_port_layout; + ioexp_total = ARRAY_SIZE(cypress_ga2_ioexp_layout); + port_total = ARRAY_SIZE(cypress_ga2_port_layout); + + SWPS_INFO("Start to initial platform: %d (%s)\n", + platform_p->id, platform_p->name); + return 0; +} + +/* ========== Functions for register something ========== + */ + +static int +register_ioexp_attr_sfp_1(struct device *device_p){ + /* Support machine type: + * - SFP : Magnolia + */ + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_present) < 0) { + err_attr = "dev_attr_present"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_tx_fault) < 0) { + err_attr = "dev_attr_tx_fault"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_rxlos) < 0) { + err_attr = "dev_attr_rxlos"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_tx_disable) < 0) { + err_attr = "dev_attr_tx_disable"; + goto err_ioexp_sfp1_attr; + } + return 0; + +err_ioexp_sfp1_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + +static int +register_ioexp_attr_sfp_2(struct device *device_p){ + /* Support machine type: + * - SFP28 : Cypress + */ + char *err_attr = NULL; + + if (register_ioexp_attr_sfp_1(device_p) < 0){ + goto err_ioexp_sfp2_attr; + } + return 0; + +err_ioexp_sfp2_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + +static int +register_ioexp_attr_qsfp_1(struct device *device_p){ + /* Support machine type: + * - QSFP : Magnolia, Redwood, Hudson32i + * - QSFP+ : Magnolia, Redwood, Hudson32i + * - QSFP28: Redwood + */ + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_present) < 0) { + err_attr = "dev_attr_present"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_reset) < 0) { + err_attr = "dev_attr_reset"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_lpmod) < 0) { + err_attr = "dev_attr_lpmod"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_modsel) < 0) { + err_attr = "dev_attr_modsel"; + goto err_ioexp_qsfp1_attr; + } + return 0; + +err_ioexp_qsfp1_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + +static int +register_ioexp_attr(struct device *device_p, + struct transvr_obj_s *transvr_obj){ + + char *err_msg = "ERR"; + + switch (transvr_obj->ioexp_obj_p->ioexp_type){ + case IOEXP_TYPE_CYPRESS_NABC: + if (register_ioexp_attr_sfp_2(device_p) < 0){ + err_msg = "register_ioexp_attr_sfp_2 fail"; + goto err_reg_ioexp_attr; + } + break; + case IOEXP_TYPE_CYPRESS_7ABC: + if (register_ioexp_attr_qsfp_1(device_p) < 0){ + err_msg = "register_ioexp_attr_qsfp_1 fail"; + goto err_reg_ioexp_attr; + } + break; + + default: + err_msg = "Unknow type"; + goto err_reg_ioexp_attr; + } + return 0; + +err_reg_ioexp_attr: + SWPS_ERR("%s: %s :%d \n", + __func__, err_msg, transvr_obj->ioexp_obj_p->ioexp_type); + return -1; +} + + +static int +register_port_device(char *dev_name, + dev_t dev_num, + struct transvr_obj_s *transvr_obj){ + + struct device *device_p = NULL; + device_p = device_create(swp_class_p, /* struct class *cls */ + NULL, /* struct device *parent */ + dev_num, /* dev_t devt */ + transvr_obj, /* void *private_data */ + dev_name); /* const char *fmt */ + if (IS_ERR(device_p)){ + goto err_regswp_create_dev; + } + if (register_ioexp_attr(device_p, transvr_obj) < 0){ + goto err_regswp_reg_attr; + } + return 0; + +err_regswp_reg_attr: + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); +err_regswp_create_dev: + SWPS_ERR("%s fail! :%s\n", __func__, dev_name); + return -1; +} + + +static int +register_swp_module(void){ + + dev_t port_devt = 0; + int dev_total = port_total + 1; /* char_dev for module control */ + + if (alloc_chrdev_region(&port_devt, 0, dev_total, SWP_CLS_NAME) < 0){ + SWPS_WARN("Allocate PORT MAJOR failure! \n"); + goto err_register_swp_module_3; + } + port_major = MAJOR(port_devt); + + /* Create class object */ + swp_class_p = class_create(THIS_MODULE, SWP_CLS_NAME); + if (IS_ERR(swp_class_p)) { + SWPS_ERR("Create class failure! \n"); + goto err_register_swp_module_3; + } + return 0; + +err_register_swp_module_3: + unregister_chrdev_region(MKDEV(port_major, 0), port_total); + return -1; +} + + +/* ========== Module initial relate ========== + */ +static int +create_ioexp_objs(void) { + + int i, run_mod; + + /* Clean IOEXP object */ + clean_ioexp_objs(); + /* Get running mode */ + run_mod = IOEXP_MODE_DIRECT; + /* Create IOEXP object */ + for(i=0; i devlen_max) { + snprintf(err_msg, sizeof(err_msg), + "SWP_DEV_PORT too long!"); + goto err_initport_create_tranobj; + } + memset(dev_name, 0, sizeof(dev_name)); + snprintf(dev_name, devlen_max, "%s%d", SWP_DEV_PORT, port_id); + /* Create transceiver object */ + ioexp_obj_p = get_ioexp_obj(ioexp_id); + if (!ioexp_obj_p){ + snprintf(err_msg, sizeof(err_msg), + "IOEXP object:%d not exist", ioexp_id); + goto err_initport_create_tranobj; + } + transvr_obj_p = create_transvr_obj(dev_name, chan_id, ioexp_obj_p, + ioexp_virt_offset, transvr_type, + chipset_type, run_mod); + if (!transvr_obj_p){ + snprintf(err_msg, sizeof(err_msg), + "Create transceiver object fail :%s", dev_name); + goto err_initport_create_tranobj; + } + /* Setup Lane_ID mapping */ + i = ARRAY_SIZE(port_layout[minor_curr].lane_id); + j = ARRAY_SIZE(transvr_obj_p->lane_id); + if (i != j) { + snprintf(err_msg, sizeof(err_msg), + "Lane_id size inconsistent %d/%d", i, j); + goto err_initport_reg_device; + } + memcpy(transvr_obj_p->lane_id, port_layout[minor_curr].lane_id, i*sizeof(int)); + /* Create and register device object */ + if (register_port_device(dev_name, MKDEV(port_major, minor_curr), transvr_obj_p) < 0){ + snprintf(err_msg, sizeof(err_msg), + "register_port_device fail"); + goto err_initport_reg_device; + } + /* Setup device_ptr of transvr_obj */ + dev_p = get_swpdev_by_name(dev_name); + if (!dev_p){ + snprintf(err_msg, sizeof(err_msg), + "get_swpdev_by_name fail"); + goto err_initport_reg_device; + } + transvr_obj_p->transvr_dev_p = dev_p; + /* Success */ + ok_count++; + } + SWPS_INFO("%s: initialed %d port-dev",__func__, ok_count); + return 0; + +err_initport_reg_device: + kfree(transvr_obj_p); +err_initport_create_tranobj: + clean_port_obj(); + SWPS_ERR("%s: %s", __func__, err_msg); + SWPS_ERR("Dump: :%d :%d :%d :%d :%d :%d\n", + port_id, chan_id, ioexp_id, ioexp_virt_offset, transvr_type, run_mod); + return -1; +} + +static int __init +swp_module_init(void){ + + if (get_platform_type() < 0){ + goto err_init_out; + } + if (get_layout_info() < 0){ + goto err_init_out; + } + if (register_swp_module() < 0){ + goto err_init_out; + } + if (create_ioexp_objs() < 0){ + goto err_init_ioexp; + } + if (create_port_objs() < 0){ + goto err_init_portobj; + } + if (init_ioexp_objs() < 0){ + goto err_init_portobj; + } + SWPS_INFO("Inventec switch-port module V.%s initial success.\n", SWP_VERSION); + return 0; + + +err_init_portobj: + clean_ioexp_objs(); +err_init_ioexp: + class_unregister(swp_class_p); + class_destroy(swp_class_p); + unregister_chrdev_region(MKDEV(port_major, 0), port_total); +err_init_out: + SWPS_ERR("Inventec switch-port module V.%s initial failure.\n", SWP_VERSION); + return -1; +} + + +static void __exit +swp_module_exit(void){ + clean_port_obj(); + clean_ioexp_objs(); + class_unregister(swp_class_p); + class_destroy(swp_class_p); + unregister_chrdev_region(MKDEV(port_major, 0), port_total); + SWPS_INFO("Remove Inventec switch-port module success.\n"); +} + + +/* Module information */ +MODULE_AUTHOR(SWP_AUTHOR); +MODULE_DESCRIPTION(SWP_DESC); +MODULE_VERSION(SWP_VERSION); +MODULE_LICENSE(SWP_LICENSE); + +module_init(swp_module_init); +module_exit(swp_module_exit); + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_swps.h b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_swps.h new file mode 100644 index 000000000000..f37fd387e4a5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_swps.h @@ -0,0 +1,170 @@ +#ifndef INV_SWPS_H +#define INV_SWPS_H + +#include "transceiver.h" +#include "io_expander.h" + +/* Module settings */ +#define SWP_CLS_NAME "swps" +#define SWP_DEV_PORT "port" +#define SWP_AUTOCONFIG_ENABLE (1) + +/* Module information */ +#define SWP_AUTHOR "Neil " +#define SWP_DESC "Inventec port and transceiver driver" +#define SWP_VERSION "4.2.3" +#define SWP_LICENSE "GPL" + +/* Module status define */ +#define SWP_STATE_NORMAL (0) +#define SWP_STATE_I2C_DIE (-91) + +/* [Note]: + * Functions and mechanism for auto-detect platform type is ready, + * But HW and BIOS not ready! We need to wait them. + * So, please do not use PLATFORM_TYPE_AUTO until they are ready. + * (2016.06.13) + */ +#define PLATFORM_TYPE_CYPRESS_GA2 (152) /* Down -> Up */ +#define PLATFORM_TYPE_CYPRESS_BAI (153) /* Down -> Up */ + +/* Current running platfrom */ +#define PLATFORM_SETTINGS PLATFORM_TYPE_CYPRESS_GA2 + +/* Define platform flag and kernel version */ +#if (PLATFORM_SETTINGS == PLATFORM_TYPE_CYPRESS_GA2) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_CYPRESS_BAI) + #define SWPS_KERN_VER_AF_3_10 (1) +#endif + + +struct inv_platform_s { + int id; + char name[64]; +}; + +struct inv_ioexp_layout_s { + int ioexp_id; + int ioexp_type; + struct ioexp_addr_s addr[4]; +}; + +struct inv_port_layout_s { + int port_id; + int chan_id; + int ioexp_id; + int ioexp_offset; + int transvr_type; + int chipset_type; + int lane_id[8]; +}; + +/* ========================================== + * Inventec Platform Settings + * ========================================== + */ +struct inv_platform_s platform_map = {PLATFORM_TYPE_CYPRESS_GA2, "D7054Q28B" }; + +/* ========================================== + * Cypress Layout configuration (Inventec version [Down->Up]) + * ========================================== + */ +struct inv_ioexp_layout_s cypress_ga2_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_CYPRESS_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {1, IOEXP_TYPE_CYPRESS_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {2, IOEXP_TYPE_CYPRESS_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {3, IOEXP_TYPE_CYPRESS_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {4, IOEXP_TYPE_CYPRESS_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {5, IOEXP_TYPE_CYPRESS_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {6, IOEXP_TYPE_CYPRESS_7ABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xc0, 0xc0}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xc0, 0xc0}, {0xff, 0xc0}, }, /* addr[1] = I/O Expander 7 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + +struct inv_port_layout_s cypress_ga2_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 2} }, + { 1, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 1} }, + { 2, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 4} }, + { 3, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 3} }, + { 4, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 6} }, + { 5, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 5} }, + { 6, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 8} }, + { 7, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 7} }, + { 8, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 10} }, + { 9, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 9} }, + {10, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 12} }, + {11, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 11} }, + {12, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 22} }, + {13, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 21} }, + {14, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 24} }, + {15, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 23} }, + {16, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 34} }, + {17, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 33} }, + {18, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 36} }, + {19, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 35} }, + {20, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 38} }, + {21, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 37} }, + {22, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 40} }, + {23, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 39} }, + {24, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 42} }, + {25, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 41} }, + {26, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 44} }, + {27, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 43} }, + {28, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 50} }, + {29, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 49} }, + {30, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 52} }, + {31, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 51} }, + {32, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 54} }, + {33, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 53} }, + {34, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 56} }, + {35, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 55} }, + {36, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 66} }, + {37, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 65} }, + {38, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 68} }, + {39, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 67} }, + {40, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 70} }, + {41, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 69} }, + {42, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 72} }, + {43, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 71} }, + {44, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 82} }, + {45, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 81} }, + {46, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 84} }, + {47, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 83} }, + {48, 59, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {49, 58, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {50, 61, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {51, 60, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {52, 63, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + {53, 62, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, +}; + + +#endif /* SFP_DRIVER_H */ + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/io_expander.c b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/io_expander.c new file mode 100644 index 000000000000..057995e4551a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/io_expander.c @@ -0,0 +1,944 @@ +#include +#include +#include "io_expander.h" + +static struct ioexp_obj_s *ioexp_head_p = NULL; +static struct ioexp_obj_s *ioexp_tail_p = NULL; + +struct ioexp_map_s ioexp_map_cypress_nabc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {0, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {1, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {1, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_tx_disable = { {0, 1, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 1, 1}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 2}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 3}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + {1, 1, 0}, /* map_tx_disable[4] = TXDISABLE_SFP+_P(X+4) */ + {1, 1, 1}, /* map_tx_disable[5] = TXDISABLE_SFP+_P(X+5) */ + {1, 1, 2}, /* map_tx_disable[6] = TXDISABLE_SFP+_P(X+6) */ + {1, 1, 3}, /* map_tx_disable[7] = TXDISABLE_SFP+_P(X+7) */ + }, + .map_tx_fault = { {0, 0, 0}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 0, 1}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 0, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 0, 3}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + {1, 0, 0}, /* map_tx_fault[4] = TXFAULT_SFP+_P(X+4) */ + {1, 0, 1}, /* map_tx_fault[5] = TXFAULT_SFP+_P(X+5) */ + {1, 0, 2}, /* map_tx_fault[6] = TXFAULT_SFP+_P(X+6) */ + {1, 0, 3}, /* map_tx_fault[7] = TXFAULT_SFP+_P(X+7) */ + }, + .map_rxlos = { {0, 1, 4}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 1, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 1, 6}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 1, 7}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + {1, 1, 4}, /* map_rxlos[4] = OPRXLOS_PORT(X+4) */ + {1, 1, 5}, /* map_rxlos[5] = OPRXLOS_PORT(X+5) */ + {1, 1, 6}, /* map_rxlos[6] = OPRXLOS_PORT(X+6) */ + {1, 1, 7}, /* map_rxlos[7] = OPRXLOS_PORT(X+7) */ + }, +}; + +struct ioexp_map_s ioexp_map_cypress_7abc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 0, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 0, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP_N_P(X+3) */ + {0, 0, 4}, /* map_reset[4] = QRESET_QSFP_N_P(X+4) */ + {0, 0, 5}, /* map_reset[5] = QRESET_QSFP_N_P(X+5) */ + }, + .map_lpmod = { {0, 1, 0}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {0, 1, 1}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {0, 1, 2}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + {0, 1, 3}, /* map_lpmod[3] = LPMODE_QSFP_P(X+3) */ + {0, 1, 4}, /* map_lpmod[4] = LPMODE_QSFP_P(X+4) */ + {0, 1, 5}, /* map_lpmod[5] = LPMODE_QSFP_P(X+5) */ + }, + .map_modsel = { {1, 1, 0}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {1, 1, 1}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {1, 1, 2}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + {1, 1, 3}, /* map_modsel[3] = MODSEL_QSFP_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP_N_P(X+5) */ + }, +}; + + + +/* ========== Private functions ========== + */ +int check_channel_tier_1(void); + +struct i2c_client * +_get_i2c_client(struct ioexp_obj_s *self, + int chip_id){ + + struct ioexp_i2c_s *i2c_curr_p = self->i2c_head_p; + + if (!(i2c_curr_p)){ + SWPS_ERR("%s: i2c_curr_p is NULL\n", __func__); + return NULL; + } + while (i2c_curr_p){ + if ((i2c_curr_p->chip_id) == chip_id){ + return i2c_curr_p->i2c_client_p; + } + i2c_curr_p = i2c_curr_p->next; + } + SWPS_ERR("%s: not exist! :%d\n", __func__, chip_id); + return NULL; +} + + +static int +_common_ioexp_update_one(struct ioexp_obj_s *self, + struct ioexp_addr_s *ioexp_addr, + int chip_id, + int data_width, + int show_err, + char *caller_name) { + int buf = 0; + int err = 0; + int data_id = 0; + int r_offset = 0; + + for(data_id=0; data_idread_offset[data_id]; + buf = i2c_smbus_read_byte_data(_get_i2c_client(self, chip_id), r_offset); + /* Check error */ + if (buf < 0) { + err = 1; + if (show_err) { + SWPS_INFO("IOEXP-%d read fail! :%d \n", self->ioexp_id, buf); + SWPS_INFO("Dump: :%d :0x%02x :%d, :%s\n", + ioexp_addr->chan_id, ioexp_addr->chip_addr, + ioexp_addr->read_offset[data_id], caller_name); + } + continue; + } + /* Update IOEXP object */ + self->chip_data[chip_id].data[data_id] = (uint8_t)buf; + } + if (err) { + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +static int +common_ioexp_update_all(struct ioexp_obj_s *self, + int show_err, + char *caller_name){ + + int err = 0; + int chip_id = 0; + int chip_amount = self->ioexp_map_p->chip_amount; + + for (chip_id=0; chip_idioexp_map_p->map_addr[chip_id]), + chip_id, + self->ioexp_map_p->data_width, + show_err, + caller_name) < 0) { + err = 1; + } + } + if (err) { + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + +static int +_common_get_bit(struct ioexp_obj_s *self, + struct ioexp_bitmap_s *bitmap_obj_p, + char *func_mane){ + uint8_t buf; + int err_code; + + /* Get address */ + err_code = self->fsm_4_direct(self); + if (err_code < 0){ + return err_code; + } + + if (!bitmap_obj_p){ + SWPS_ERR("Layout config incorrect! :%d :%s\n", + self->ioexp_id, func_mane); + return ERR_IOEXP_BADCONF; + } + /* Get data form cache */ + buf = self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset]; + return (int)(buf >> bitmap_obj_p->bit_shift & 0x01); +} + + +static int +_common_set_bit(struct ioexp_obj_s *self, + struct ioexp_bitmap_s *bitmap_obj_p, + int input_val, + char *func_mane){ + int err_code, target_offset; + uint8_t origin_byte; + uint8_t modify_byte; + + /* Get address */ + err_code = self->fsm_4_direct(self); + if (err_code < 0){ + return err_code; + } + if (!bitmap_obj_p){ + SWPS_ERR("Layout config incorrect! :%d :%s\n", + self->ioexp_id, func_mane); + return ERR_IOEXP_BADCONF; + } + /* Prepare write date */ + origin_byte = self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset]; + switch (input_val) { + case 0: + modify_byte = origin_byte; + SWP_BIT_CLEAR(modify_byte, bitmap_obj_p->bit_shift); + break; + case 1: + modify_byte = origin_byte; + SWP_BIT_SET(modify_byte, bitmap_obj_p->bit_shift); + break; + default: + SWPS_ERR("Input value incorrect! :%d :%d :%s\n", + input_val, self->ioexp_id, func_mane); + return ERR_IOEXP_BADINPUT; + } + /* Setup i2c client */ + target_offset = self->ioexp_map_p->map_addr[bitmap_obj_p->chip_id].write_offset[bitmap_obj_p->ioexp_voffset]; + /* Write byte to chip via I2C */ + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, bitmap_obj_p->chip_id), + target_offset, + modify_byte); + /* Update or bollback object */ + if (err_code < 0){ + self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset] = origin_byte; + SWPS_ERR("I2C write fail! :%d :%d :%s :%d\n", + input_val, self->ioexp_id, func_mane, err_code); + return err_code; + } + self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset] = modify_byte; + return 0; +} + + +/* ========== Object public functions ========== + */ +int +common_get_present(struct ioexp_obj_s *self, + int virt_offset){ + + int UNPLUG = 1; + int retval = ERR_IOEXP_UNEXCPT; + + retval = _common_get_bit(self, + &(self->ioexp_map_p->map_present[virt_offset]), + "common_get_present"); + if (retval < 0) { + /* [Note] + * => Transceiver object does not need to handle IOEXP layer issues. + */ + return UNPLUG; + } + return retval; +} + +int +common_get_tx_fault(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_tx_fault[virt_offset]), + "common_get_tx_fault"); +} + +int +common_get_rxlos(struct ioexp_obj_s *self, + int virt_offset){ + /* [Receiver Loss of Signal (Rx_LOS)] + * The post-amplification IC also includes transition detection circuitry + * which monitors the ac level of incoming optical signals and provides a + * TTL/CMOS compatible status signal to the host (pin 8). An adequate optical + * input results in a low Rx_LOS output while a high Rx_LOS output indicates + * an unusable optical input. The Rx_LOS thresholds are factory set so that + * a high output indicates a definite optical fault has occurred. Rx_LOS can + * also be monitored via the two-wire serial interface + * (address A2h, byte 110, bit 1). + * + * 0: Normal + * 1: Abnormal + */ + return _common_get_bit(self, + &(self->ioexp_map_p->map_rxlos[virt_offset]), + "common_get_rxlos"); +} + + +int +common_get_tx_disable(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_tx_disable[virt_offset]), + "common_get_tx_disable"); +} + +int +common_get_reset(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_reset[virt_offset]), + "common_get_reset"); +} + + +int +common_get_lpmod(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_lpmod[virt_offset]), + "common_get_lpmod"); +} + + +int +common_get_modsel(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_modsel[virt_offset]), + "common_get_modsel"); +} + +int +common_set_tx_disable(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_tx_disable[virt_offset]), + input_val, + "common_set_tx_disable"); +} + +int +common_set_reset(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_reset[virt_offset]), + input_val, + "common_set_reset"); +} + + +int +common_set_lpmod(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_lpmod[virt_offset]), + input_val, + "common_set_lpmod"); +} + + +int +common_set_modsel(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_modsel[virt_offset]), + input_val, + "common_set_modsel"); +} + +int +ioexp_get_not_support(struct ioexp_obj_s *self, + int virt_offset){ + return ERR_IOEXP_NOTSUPPORT; +} + + +int +ioexp_set_not_support(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + return ERR_IOEXP_NOTSUPPORT; +} + +/* ========== Initial functions for IO Expander ========== + */ +int +common_ioexp_init(struct ioexp_obj_s *self) { + + int chip_id, offset, err_code; + struct ioexp_addr_s *addr_p; + + if (self->mode == IOEXP_MODE_DIRECT) { ///important + goto update_common_ioexp_init; + } + /* Setup default value to each physical IO Expander */ + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + /* Get address mapping */ + addr_p = &(self->ioexp_map_p->map_addr[chip_id]); + if (!addr_p){ + SWPS_ERR("%s: IOEXP config incorrect! :%d \n", + __func__, chip_id); + return -1; + } + /* Setup default value */ + for (offset=0; offset<(self->ioexp_map_p->data_width); offset++){ + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, chip_id), + addr_p->write_offset[offset], + addr_p->data_default[offset]); + if (err_code < 0){ + SWPS_ERR("%s: set default fail! :%d \n", + __func__, err_code); + return ERR_IOEXP_UNEXCPT; + } + } + } + +update_common_ioexp_init: + /* Check and update info to object */ + err_code = self->update_all(self, 1, "common_ioexp_init"); + if (err_code < 0) { + SWPS_ERR("%s: update_all() fail! :%d \n", + __func__, err_code); + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +/* ========== Object functions for Final State Machine ========== + */ +int +_is_channel_ready(struct ioexp_obj_s *self){ + + int buf = 0; + int chip_id = 0; /* Use first chip which be registered */ + int data_id = 0; /* Use first byte which be registered */ + struct ioexp_addr_s *ioexp_addr = NULL; + + ioexp_addr = &(self->ioexp_map_p->map_addr[chip_id]); + if (!ioexp_addr){ + SWPS_ERR("%s: config incorrect!\n", __func__); + return ERR_IOEXP_UNEXCPT; + } + buf = i2c_smbus_read_byte_data(_get_i2c_client(self, chip_id), + ioexp_addr->read_offset[data_id]); + if (buf >= 0){ + return 1; + } + return 0; +} + +int +_ioexp_init_handler(struct ioexp_obj_s *self){ + + int return_val; + + switch (self->mode) { + case IOEXP_MODE_DIRECT: + return_val = self->init(self); + if (return_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + } else { + self->state = STATE_IOEXP_NORMAL; + } + return return_val; + default: + break; + } + SWPS_ERR("%s: exception occur :%d\n", __func__, self->mode); + return ERR_IOEXP_UNEXCPT; +} + + +int +common_ioexp_fsm_4_direct(struct ioexp_obj_s *self){ + + int result_val; + int show_err = 1; + char *func_mane = "common_ioexp_fsm_4_direct"; + + switch (self->state){ + case STATE_IOEXP_INIT: + result_val = _ioexp_init_handler(self); + /* Exception case: terminate initial procedure */ + if(result_val < 0){ + /* Initial fail */ + return result_val; + } + if(self->state == STATE_IOEXP_INIT){ + /* Keep in INIT state, and return error */ + return ERR_IOEXP_UNINIT; + } + /* Case: Initial done */ + return 0; + + case STATE_IOEXP_NORMAL: + result_val = self->update_all(self, show_err, func_mane); + if (result_val < 0){ + SWPS_INFO("%s: NORMAL -> ABNORMAL :%d\n", + __func__, result_val); + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + self->state = STATE_IOEXP_NORMAL; + return 0; + + case STATE_IOEXP_ABNORMAL: + result_val = self->update_all(self, show_err, func_mane); + if (result_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + SWPS_DEBUG("%s: ABNORMAL -> NORMAL :%d\n", + __func__, result_val); + self->state = STATE_IOEXP_NORMAL; + return 0; + + default: + break; + } + SWPS_ERR("%s: Exception occurs :%d\n", + __func__, self->state); + return ERR_IOEXP_UNEXCPT; +} + +/* ========== Functions for Factory pattern ========== + */ +static struct ioexp_map_s * +get_ioexp_map(int ioexp_type){ + switch (ioexp_type){ + case IOEXP_TYPE_CYPRESS_NABC: + return &ioexp_map_cypress_nabc; + case IOEXP_TYPE_CYPRESS_7ABC: + return &ioexp_map_cypress_7abc; + default: + return NULL; + } +} + + +int +setup_ioexp_ssize_attr(struct ioexp_obj_s *self, + struct ioexp_map_s *ioexp_map_p, + int ioexp_id, + int ioexp_type, + int run_mode){ + switch (run_mode){ + case IOEXP_MODE_DIRECT: /* Direct access device mode */ + self->mode = run_mode; + break; + default: + SWPS_ERR("%s: non-defined run_mode:%d\n", + __func__, run_mode); + self->mode = ERR_IOEXP_UNEXCPT; + return ERR_IOEXP_UNEXCPT; + } + self->ioexp_id = ioexp_id; + self->ioexp_type = ioexp_type; + self->ioexp_map_p = ioexp_map_p; + self->state = STATE_IOEXP_INIT; + mutex_init(&self->lock); + return 0; +} + + +static int +setup_addr_mapping(struct ioexp_obj_s *self, + struct ioexp_addr_s *addr_map_p){ + if (!addr_map_p){ + SWPS_ERR("%s: map is null\n", __func__); + return -1; + } + self->ioexp_map_p->map_addr = addr_map_p; + return 0; +} + + +static int +setup_ioexp_public_cb(struct ioexp_obj_s *self, + int ioexp_type){ + switch (ioexp_type){ + case IOEXP_TYPE_CYPRESS_NABC: + self->get_present = common_get_present; + self->get_tx_fault = common_get_tx_fault; + self->get_rxlos = common_get_rxlos; + self->get_tx_disable = common_get_tx_disable; + self->get_reset = ioexp_get_not_support; + self->get_lpmod = ioexp_get_not_support; + self->get_modsel = ioexp_get_not_support; + self->set_tx_disable = common_set_tx_disable; + self->set_reset = ioexp_set_not_support; + self->set_lpmod = ioexp_set_not_support; + self->set_modsel = ioexp_set_not_support; + return 0; + case IOEXP_TYPE_CYPRESS_7ABC: + self->get_present = common_get_present; + self->get_tx_fault = ioexp_get_not_support; + self->get_rxlos = ioexp_get_not_support; + self->get_tx_disable = ioexp_get_not_support; + self->get_reset = common_get_reset; + self->get_lpmod = common_get_lpmod; + self->get_modsel = common_get_modsel; + self->set_tx_disable = ioexp_set_not_support; + self->set_reset = common_set_reset; + self->set_lpmod = common_set_lpmod; + self->set_modsel = common_set_modsel; + return 0; + + default: + SWPS_ERR("%s: type:%d incorrect!\n", __func__, ioexp_type); + break; + } + return ERR_IOEXP_UNEXCPT; +} + + +static int +setup_ioexp_private_cb(struct ioexp_obj_s *self, + int ioexp_type){ + + switch (ioexp_type){ + case IOEXP_TYPE_CYPRESS_NABC: + case IOEXP_TYPE_CYPRESS_7ABC: + self->init = common_ioexp_init; + self->update_all = common_ioexp_update_all; + self->fsm_4_direct = common_ioexp_fsm_4_direct; + return 0; + + default: + SWPS_ERR("%s: type:%d incorrect!\n", __func__, ioexp_type); + break; + } + return ERR_IOEXP_UNEXCPT; +} + + +static int +setup_i2c_client_one(struct ioexp_obj_s *self, + int chip_id){ + + char *err_msg = "ERROR"; + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + struct ioexp_i2c_s *i2c_obj_p = NULL; + struct ioexp_i2c_s *i2c_curr_p = NULL; + + int chan_id = self->ioexp_map_p->map_addr[chip_id].chan_id; + adap = i2c_get_adapter(chan_id); + if(!adap){ + err_msg = "Can not get adap!"; + goto err_ioexp_setup_i2c_1; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + err_msg = "Can not kzalloc client!"; + goto err_ioexp_setup_i2c_1; + } + i2c_obj_p = kzalloc(sizeof(*i2c_obj_p), GFP_KERNEL); + if (!i2c_obj_p){ + err_msg = "Can not kzalloc i2c_obj_p!"; + goto err_ioexp_setup_i2c_2; + } + client->adapter = adap; + client->addr = self->ioexp_map_p->map_addr[chip_id].chip_addr; + i2c_obj_p->i2c_client_p = client; + i2c_obj_p->chip_id = chip_id; + i2c_obj_p->next = NULL; + if (!self->i2c_head_p){ + self->i2c_head_p = i2c_obj_p; + } else { + i2c_curr_p = self->i2c_head_p; + while (i2c_curr_p->next){ + i2c_curr_p = i2c_curr_p->next; + } + i2c_curr_p->next = i2c_obj_p; + } + return 0; + +err_ioexp_setup_i2c_2: + kfree(client); +err_ioexp_setup_i2c_1: + SWPS_ERR("%s: %s :%d\n", __func__, err_msg, chan_id); + return -1; +} + + +static int +setup_i2c_client(struct ioexp_obj_s* self){ + + int result; + int chip_id = 0; + + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + result = setup_i2c_client_one(self, chip_id); + if (result < 0){ + SWPS_ERR("%s fail! :%d\n", __func__, chip_id); + return -1; + } + } + return 0; +} + +static int +setup_ioexp_config(struct ioexp_obj_s *self) { + + int chip_id, offset, err_code; + struct ioexp_addr_s *addr_p; + + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + addr_p = &(self->ioexp_map_p->map_addr[chip_id]); + if (!addr_p){ + SWPS_ERR("IOEXP config incorrect! :%d \n",chip_id); + return -1; + } + for (offset=0; offset<(self->ioexp_map_p->data_width); offset++){ + + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, chip_id), + addr_p->conf_offset[offset], + addr_p->conf_default[offset]); + + if (err_code < 0){ + SWPS_INFO("%s: set conf fail! :%d \n", __func__, err_code); + return -2; + } + } + } + return 0; +} + +struct ioexp_obj_s * +_create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode){ + + struct ioexp_map_s* ioexp_map_p; + struct ioexp_obj_s* result_p; + struct ioexp_i2c_s *i2c_curr_p; + struct ioexp_i2c_s *i2c_next_p; + + /* Get layout */ + ioexp_map_p = get_ioexp_map(ioexp_type); + if (!ioexp_map_p){ + SWPS_ERR("%s: Invalid ioexp_type\n", __func__); + goto err_create_ioexp_fail; + } + /* Prepare IOEXP object */ + result_p = kzalloc(sizeof(*result_p), GFP_KERNEL); + if (!result_p){ + SWPS_ERR("%s: kzalloc failure!\n", __func__); + goto err_create_ioexp_fail; + } + /* Prepare static size attributes */ + if (setup_ioexp_ssize_attr(result_p, + ioexp_map_p, + ioexp_id, + ioexp_type, + run_mode) < 0){ + goto err_create_ioexp_setup_attr_fail; + } + /* Prepare address mapping */ + if (setup_addr_mapping(result_p, addr_map_p) < 0){ + goto err_create_ioexp_setup_attr_fail; + } + if (setup_i2c_client(result_p) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + /* Prepare call back functions of object */ + if (setup_ioexp_public_cb(result_p, ioexp_type) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + if (setup_ioexp_private_cb(result_p, ioexp_type) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + return result_p; + +err_create_ioexp_setup_i2c_fail: + i2c_curr_p = result_p->i2c_head_p; + i2c_next_p = result_p->i2c_head_p; + while (i2c_curr_p){ + i2c_next_p = i2c_curr_p->next; + kfree(i2c_curr_p->i2c_client_p); + kfree(i2c_curr_p); + i2c_curr_p = i2c_next_p; + } +err_create_ioexp_setup_attr_fail: + kfree(result_p); +err_create_ioexp_fail: + SWPS_ERR("%s: fail! :%d :%d \n", + __func__, ioexp_id, ioexp_type); + return NULL; +} + + +int +create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode){ + + struct ioexp_obj_s *ioexp_p = NULL; + + ioexp_p = _create_ioexp_obj(ioexp_id, ioexp_type, + addr_map_p, run_mode); + if (!ioexp_p){ + return -1; + } + if (ioexp_head_p == NULL){ + ioexp_head_p = ioexp_p; + ioexp_tail_p = ioexp_p; + return 0; + } + ioexp_tail_p->next = ioexp_p; + ioexp_tail_p = ioexp_p; + return 0; +} + +static int +_init_ioexp_obj(struct ioexp_obj_s* self) { + + char *err_msg = "ERR"; + char *func_name = "_init_ioexp_obj"; + + /* Setup IOEXP configure byte */ + if (setup_ioexp_config(self) < 0){ + err_msg = "setup_ioexp_config fail"; + goto err_init_ioexp_obj; + } + /* Setup default data */ + if (_ioexp_init_handler(self) < 0){ + err_msg = "_ioexp_init_handler fail"; + goto err_init_ioexp_obj; + } + /* Update all */ + if (self->state == STATE_IOEXP_NORMAL){ + if (self->update_all(self, 1, func_name) < 0){ + err_msg = "update_all() fail"; + goto err_init_ioexp_obj; + } + } + return 0; + +err_init_ioexp_obj: + SWPS_DEBUG("%s: %s\n", __func__, err_msg); + return -1; +} + +int +init_ioexp_objs(void){ + /* Return value: + * 0: Success + * -1: Detect topology error + * -2: SWPS internal error + */ + + struct ioexp_obj_s *curr_p = ioexp_head_p; + + if (!curr_p) { + SWPS_ERR("%s: ioexp_head_p is NULL\n", __func__); + return -2; + } + while (curr_p) { + if (_init_ioexp_obj(curr_p) < 0) { + SWPS_DEBUG("%s: _init_ioexp_obj() fail\n", __func__); + return -1; + } + curr_p = curr_p->next; + } + SWPS_DEBUG("%s: done.\n", __func__); + return 0; +} + +void +clean_ioexp_objs(void){ + + struct ioexp_i2c_s *i2c_curr_p = NULL; + struct ioexp_i2c_s *i2c_next_p = NULL; + struct ioexp_obj_s *ioexp_next_p = NULL; + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + if (ioexp_head_p == NULL){ + ioexp_tail_p = NULL; + return; + } + while(ioexp_curr_p){ + ioexp_next_p = ioexp_curr_p->next; + i2c_curr_p = ioexp_curr_p->i2c_head_p; + while (i2c_curr_p) { + i2c_next_p = i2c_curr_p->next; + kfree(i2c_curr_p->i2c_client_p); + kfree(i2c_curr_p); + i2c_curr_p = i2c_next_p; + } + kfree(ioexp_curr_p); + ioexp_curr_p = ioexp_next_p; + } + ioexp_tail_p = NULL; + SWPS_DEBUG("%s: done.\n", __func__); +} + +struct ioexp_obj_s * +get_ioexp_obj(int ioexp_id){ + + struct ioexp_obj_s *result_p = NULL; + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + if (ioexp_curr_p->ioexp_id == ioexp_id){ + result_p = ioexp_curr_p; + break; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return result_p; +} +int +check_channel_tier_1(void) { + + if ( (!_is_channel_ready(ioexp_head_p)) && + (!_is_channel_ready(ioexp_tail_p)) ){ + return -1; + } + return 0; +} + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/io_expander.h b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/io_expander.h new file mode 100644 index 000000000000..a5541617dd05 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/io_expander.h @@ -0,0 +1,143 @@ +#ifndef IO_EXPANDER_H +#define IO_EXPANDER_H + +#include + +/* IOEXP type define (QSFP series) */ +#define IOEXP_TYPE_CYPRESS_NABC (10102) +#define IOEXP_TYPE_CYPRESS_7ABC (10207) + +/* IOEXP mode define */ +#define IOEXP_MODE_DIRECT (19001) + +/* IOEXP state define */ +#define STATE_IOEXP_NORMAL (0) +#define STATE_IOEXP_INIT (-1) +#define STATE_IOEXP_ABNORMAL (-2) + +/* IOEXP error code define */ +#define ERR_IOEXP_NOTSUPPORT (-100) +#define ERR_IOEXP_UNINIT (-101) +#define ERR_IOEXP_BADCONF (-102) +#define ERR_IOEXP_BADINPUT (-105) +#define ERR_IOEXP_UNEXCPT (-199) + + +#define SWPS_INFO(fmt, args...) printk( KERN_INFO "[SWPS] " fmt, ##args) +#define SWPS_WARN(fmt, args...) printk( KERN_WARNING "[SWPS] " fmt, ##args) +#define SWPS_ERR(fmt, args...) printk( KERN_ERR "[SWPS] " fmt, ##args) + +#ifdef DEBUG_SWPS +# define SWPS_DEBUG(fmt, args...) printk( KERN_DEBUG "[SWPS] " fmt, ##args) +#else +# define SWPS_DEBUG(fmt, args...) +#endif + + +struct ioexp_addr_s { + int chan_id; + int chip_addr; + int read_offset[8]; + int write_offset[8]; + int conf_offset[8]; + uint8_t data_default[8]; + uint8_t conf_default[8]; +}; + +struct ioexp_i2c_s { + int chip_id; + struct i2c_client *i2c_client_p; + struct ioexp_i2c_s *next; +}; + + +struct ioexp_bitmap_s { + int chip_id; /* IOEXP chip id */ + int ioexp_voffset; /* IOEXP virtual offset */ + int bit_shift; +}; + +struct ioexp_map_s { + int chip_amount; /* Number of chips that IOEXP object content */ + int data_width; /* Number of (Read/Write/Config) bytes */ + struct ioexp_addr_s *map_addr; /* Chip address info */ + struct ioexp_bitmap_s map_present[8]; /* IOEXP for SFP / QSFP */ + struct ioexp_bitmap_s map_tx_disable[8]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_tx_fault[8]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_rxlos[8]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_reset[8]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_lpmod[8]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_modsel[8]; /* IOEXP for QSFP */ +}; + +struct ioexp_data_s { + uint8_t data[8]; +}; + +struct ioexp_obj_s { + + /* ============================ + * Object public property + * ============================ + */ + int ioexp_id; + int ioexp_type; + + /* ============================ + * Object private property + * ============================ + */ + struct ioexp_data_s chip_data[16]; /* Max: 8-ioexp in one virt-ioexp(ioexp_obj) */ + struct ioexp_map_s *ioexp_map_p; + struct ioexp_obj_s *next; + struct ioexp_i2c_s *i2c_head_p; + struct mutex lock; + int mode; + int state; + + /* =========================================== + * Object public functions + * =========================================== + */ + int (*get_present)(struct ioexp_obj_s *self, int virt_offset); + int (*get_tx_fault)(struct ioexp_obj_s *self, int virt_offset); + int (*get_rxlos)(struct ioexp_obj_s *self, int virt_offset); + int (*get_tx_disable)(struct ioexp_obj_s *self, int virt_offset); + int (*get_reset)(struct ioexp_obj_s *self, int virt_offset); + int (*get_lpmod)(struct ioexp_obj_s *self, int virt_offset); + int (*get_modsel)(struct ioexp_obj_s *self, int virt_offset); + int (*set_tx_disable)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_reset)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_lpmod)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_modsel)(struct ioexp_obj_s *self, int virt_offset, int input_val); + + /* =========================================== + * Object private functions + * =========================================== + */ + int (*init)(struct ioexp_obj_s *self); + int (*update_all)(struct ioexp_obj_s *self, int show_err, char *caller_name); + int (*fsm_4_direct)(struct ioexp_obj_s* self); +}; + + +struct ioexp_obj_s* get_ioexp_obj(int ioexp_id); +int create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode); +int init_ioexp_objs(void); +void clean_ioexp_objs(void); + +int check_channel_tier_1(void); + +/* Macro for bit control */ +#define SWP_BIT_SET(byte_val,bit_shift) ((byte_val) |= (1<<(bit_shift))) +#define SWP_BIT_CLEAR(byte_val,bit_shift) ((byte_val) &= ~(1<<(bit_shift))) + + +#endif /* IO_EXPANDER_H */ + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/transceiver.c b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/transceiver.c new file mode 100644 index 000000000000..368e412b19e2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/transceiver.c @@ -0,0 +1,906 @@ +#include +#include +#include +#include +#include "io_expander.h" +#include "transceiver.h" + + +/* ========== Register EEPROM address mapping ========== + */ +struct eeprom_map_s eeprom_map_sfp = { + .addr_rx_los =-1, .page_rx_los =-1, .offset_rx_los =-1, .length_rx_los =-1, + .addr_tx_disable =-1, .page_tx_disable =-1, .offset_tx_disable =-1, .length_tx_disable =-1, + .addr_tx_fault =-1, .page_tx_fault =-1, .offset_tx_fault =-1, .length_tx_fault =-1, +}; + +struct eeprom_map_s eeprom_map_qsfp = { + .addr_rx_los =0x50, .page_rx_los =-1, .offset_rx_los =3, .length_rx_los =1, + .addr_tx_disable =0x50, .page_tx_disable =-1, .offset_tx_disable =86, .length_tx_disable =1, + .addr_tx_fault =0x50, .page_tx_fault =-1, .offset_tx_fault =4, .length_tx_fault =1, +}; + +struct eeprom_map_s eeprom_map_qsfp28 = { + .addr_rx_los =0x50, .page_rx_los =-1, .offset_rx_los =3, .length_rx_los =1, + .addr_tx_disable =0x50, .page_tx_disable =-1, .offset_tx_disable =86, .length_tx_disable =1, + .addr_tx_fault =0x50, .page_tx_fault =-1, .offset_tx_fault =4, .length_tx_fault =1, +}; + + +/* ========== Utility Functions ========== + */ +void +alarm_msg_2_user(struct transvr_obj_s *self, + char *emsg) { + + SWPS_ERR("%s on %s.\n", emsg, self->swp_name); +} + + +/* ========== Private functions ========== + */ +static int +_reload_transvr_obj(struct transvr_obj_s *self,int new_type); + +static int +reload_transvr_obj(struct transvr_obj_s *self,int new_type); + +static int +_transvr_init_handler(struct transvr_obj_s *self); + +static void +_transvr_clean_retry(struct transvr_obj_s *self) { + self->retry = 0; +} + + +static int +_transvr_handle_retry(struct transvr_obj_s *self, int retry) { + /* Return: 0: keep retry + * -1: stop retry + */ + if (self->retry == 0) { + self->retry = retry; + } + self->retry -= 1; + if (self->retry <= 0) { + _transvr_clean_retry(self); + return -1; + } + return 0; +} + +static int +_common_setup_page(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + int show_e) { + /* return: + * 0 : OK + * -1 : EEPROM settings incorrect + * -2 : I2C R/W failure + * -3 : Undefined case + */ + int retval = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Check */ + if ((addr < 0) || (offset < 0) || (len < 0)) { + emsg = "EEPROM settings incorrect"; + retval = -1; + goto err_common_setup_page; + } + /* Case1: continue access */ + if ((self->i2c_client_p->addr == addr) && + (self->curr_page == page)) { + return 0; + } + self->i2c_client_p->addr = addr; + /* Case2: select lower page */ + if (page == -1) { + self->curr_page = page; + return 0; + } + /* Case3: select upper page */ + if (page >= 0) { + goto upper_common_setup_page; + } + /* Unexpected case */ + show_e = 1; + emsg = "Unexpected case"; + retval = -3; + goto err_common_setup_page; + +upper_common_setup_page: + if (i2c_smbus_write_byte_data(self->i2c_client_p, + VAL_TRANSVR_PAGE_SELECT_OFFSET, + page) < 0) { + emsg = "I2C R/W failure"; + retval = -2; + goto err_common_setup_page; + } + self->curr_page = page; + mdelay(VAL_TRANSVR_PAGE_SELECT_DELAY); + return 0; + +err_common_setup_page: + if (show_e) { + SWPS_INFO("%s: %s", __func__, emsg); + SWPS_INFO("%s: :0x%02x :%d :%d :%d\n", + __func__, addr, page, offset, len); + } + return retval; +} + +/* ========== Object functions for Final State Machine ========== + */ +int +is_plugged(struct transvr_obj_s *self){ + + int limit = 63; + int present = DEBUG_TRANSVR_INT_VAL; + char emsg[64] = DEBUG_TRANSVR_STR_VAL; + struct ioexp_obj_s *ioexp_p = self->ioexp_obj_p; + + if (!ioexp_p) { + snprintf(emsg, limit, "ioexp_p is null!"); + goto err_is_plugged_1; + } + present = ioexp_p->get_present(ioexp_p, self->ioexp_virt_offset); + switch (present){ + case 0: + return 1; + case 1: + return 0; + case ERR_IOEXP_UNINIT: + snprintf(emsg, limit, "ioexp_p not ready!"); + goto err_is_plugged_1; + default: + if (ioexp_p->state == STATE_IOEXP_INIT){ + snprintf(emsg, limit, "ioexp_p not ready!"); + goto err_is_plugged_1; + } + break; + } + SWPS_INFO("%s: Exception case! :%d :%d\n", + __func__, present, ioexp_p->state); + return 0; + +err_is_plugged_1: + SWPS_DEBUG("%s: %s\n", __func__, emsg); + return 0; +} + + +static int +detect_transvr_type(struct transvr_obj_s* self){ + + int type = TRANSVR_TYPE_ERROR; + + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + type = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + + /* Case: 1. Wait transceiver I2C module. + * 2. Transceiver I2C module failure. + * Note: 1. SFF allow maximum transceiver initial time is 2 second. So, there + * are exist some case that we need to wait transceiver. + * For these case, we keeps status on "TRANSVR_TYPE_UNPLUGGED", than + * state machine will keep trace with it. + * 2. There exist some I2C failure case we need to handle. Such as user + * insert the failure transceiver, or any reason cause it abnormal. + */ + if (type < 0){ + switch (type) { + case -EIO: + SWPS_DEBUG("%s: %s smbus return:-5 (I/O error)\n", + __func__, self->swp_name); + return TRANSVR_TYPE_UNPLUGGED; + case -ENXIO: + SWPS_DEBUG("%s: %s smbus return:-6 (No such device or address)\n", + __func__, self->swp_name); + return TRANSVR_TYPE_UNPLUGGED; + default: + break; + } + SWPS_INFO("%s: %s unexpected smbus return:%d \n", + __func__, self->swp_name, type); + return TRANSVR_TYPE_ERROR; + } + /* Identify valid transceiver type */ + switch (type){ + case TRANSVR_TYPE_SFP: + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + break; + case TRANSVR_TYPE_UNKNOW_1: + case TRANSVR_TYPE_UNKNOW_2: + type = TRANSVR_TYPE_UNKNOW_2; + break; + default: + SWPS_DEBUG("%s: unknow type:0x%02x \n", __func__, type); + type = TRANSVR_TYPE_ERROR; + break; + } + return type; +} + + +static int +detect_transvr_state(struct transvr_obj_s *self, + int result[2]){ + /* [return] [result-0] [result-1] + * 0 STATE_TRANSVR_CONNECTED TRANSVR_TYPE_FAKE + * 0 STATE_TRANSVR_DISCONNECTED TRANSVR_TYPE_UNPLUGGED + * 0 STATE_TRANSVR_ISOLATED TRANSVR_TYPE_ERROR + * 0 STATE_TRANSVR_INIT / + * 0 STATE_TRANSVR_SWAPPED + * 0 STATE_TRANSVR_CONNECTED + * ERR_TRNASVR_BE_ISOLATED STATE_TRANSVR_ISOLATED TRANSVR_TYPE_ERROR + * ERR_TRANSVR_I2C_CRASH STATE_TRANSVR_UNEXCEPTED TRANSVR_TYPE_ERROR + * ERR_TRANSVR_UNEXCPT STATE_TRANSVR_UNEXCEPTED TRANSVR_TYPE_UNKNOW_1/2 + */ + result[0] = STATE_TRANSVR_UNEXCEPTED; /* For return state */ + result[1] = TRANSVR_TYPE_ERROR; /* For return type */ + + /* Case1: Fake type */ + if (self->type == TRANSVR_TYPE_FAKE){ + result[0] = STATE_TRANSVR_CONNECTED; + result[1] = TRANSVR_TYPE_FAKE; + return 0; + } + /* Case2: Transceiver unplugged */ + if (!is_plugged(self)){ + result[0] = STATE_TRANSVR_DISCONNECTED; + result[1] = TRANSVR_TYPE_UNPLUGGED; + return 0; + } + /* Case3: Transceiver be isolated */ + if (self->state == STATE_TRANSVR_ISOLATED){ + result[0] = STATE_TRANSVR_ISOLATED; + result[1] = TRANSVR_TYPE_ERROR; + return ERR_TRNASVR_BE_ISOLATED; + } + /* Case4: Transceiver plugged */ + result[1] = detect_transvr_type(self); + /* Case4.1: I2C topology crash + * Note : There are some I2C issues cause by transceiver/cables. + * We need to check topology status when user insert it. + * But in this step, we can't not ensure this is the issues + * port. So, it return the ERR_TRANSVR_I2C_CRASH, then upper + * layer will diagnostic I2C topology. + */ + if (check_channel_tier_1() < 0) { + SWPS_INFO("%s: %s detect I2C crash :%d\n", + __func__, self->swp_name, self->state); + result[0] = STATE_TRANSVR_UNEXCEPTED; + result[1] = TRANSVR_TYPE_ERROR; + return ERR_TRANSVR_I2C_CRASH; + } + /* Case4.2: System initial not ready, + * Note : Sometime i2c channel or transceiver EEPROM will delay that will + * cause system in inconsistent state between EEPROM and IOEXP. + * In this case, SWP transceiver object keep state at LINK_DOWN + * to wait system ready. + * By the way, State Machine will handle these case. + */ + if (result[1] == TRANSVR_TYPE_UNPLUGGED){ + result[0] = STATE_TRANSVR_DISCONNECTED; + return 0; + } + /* Case4.3: Error transceiver type */ + if (result[1] == TRANSVR_TYPE_ERROR){ + result[0] = STATE_TRANSVR_ISOLATED; + SWPS_INFO("%s: %s detect error type\n", __func__, self->swp_name); + alarm_msg_2_user(self, "detected transceiver/cables not meet SFF standard!"); + return ERR_TRNASVR_BE_ISOLATED; + } + /* Case3.3: Unknow transceiver type */ + if ((result[1] == TRANSVR_TYPE_UNKNOW_1) || + (result[1] == TRANSVR_TYPE_UNKNOW_2) ){ + result[0] = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_UNEXCPT; + } + /* Case3.4: During initial process */ + if (self->state == STATE_TRANSVR_INIT){ + result[0] = STATE_TRANSVR_INIT; + return 0; + } + /* Case3.5: Transceiver be swapped */ + if (self->type != result[1]){ + result[0] = STATE_TRANSVR_SWAPPED; + return 0; + } + /* Case3.6: Link up state */ + result[0] = STATE_TRANSVR_CONNECTED; + return 0; +} +int +common_fsm_4_direct_mode(struct transvr_obj_s* self, + char *caller_name){ + + int err; + int detect_result[2]; + int current_state = STATE_TRANSVR_UNEXCEPTED; + int current_type = TRANSVR_TYPE_ERROR; + + if (self->state == STATE_TRANSVR_NEW) { + if (_transvr_init_handler(self) < 0){ + return ERR_TRANSVR_INIT_FAIL; + } + } + err = detect_transvr_state(self, detect_result); + if (err < 0) { + return err; + } + /* In Direct mode, driver only detect transceiver when user call driver interface + * which on sysfs. So it only need consider the state of Transceiver. + */ + current_state = detect_result[0]; + current_type = detect_result[1]; + + switch (current_state){ + + case STATE_TRANSVR_DISCONNECTED: /* Transceiver is not plugged */ + self->state = current_state; + self->type = current_type; + return ERR_TRANSVR_UNPLUGGED; + + case STATE_TRANSVR_INIT: /* Transceiver is plugged, system not ready */ + return ERR_TRANSVR_UNINIT; + + case STATE_TRANSVR_ISOLATED: /* Transceiver is plugged, but has some issues */ + return ERR_TRNASVR_BE_ISOLATED; + + case STATE_TRANSVR_CONNECTED: /* Transceiver is plugged, system is ready */ + self->state = current_state; + self->type = current_type; + return 0; + + case STATE_TRANSVR_SWAPPED: /* Transceiver is plugged, system detect user changed */ + self->type = current_type; + if (reload_transvr_obj(self, current_type) < 0){ + self->state = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_UNEXCPT; + } + self->state = current_state; + return 0; + + case STATE_TRANSVR_UNEXCEPTED: /* Transceiver type or state is unexpected case */ + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = TRANSVR_TYPE_ERROR; + return ERR_TRANSVR_UNEXCPT; + + default: + SWPS_INFO("%s: state:%d not in define.\n", __func__, current_state); + break; + } + return ERR_TRANSVR_UNEXCPT; +} + +int +fake_fsm_4_direct_mode(struct transvr_obj_s* self, + char *caller_name){ + self->state = STATE_TRANSVR_CONNECTED; + self->type = TRANSVR_TYPE_FAKE; + return 0; +} + +/* ========== Object Initial handler ========== + */ +static int +_is_transvr_valid(struct transvr_obj_s *self, + int type, + int state) { + /* [Return] + * 0 : OK, inserted + * EVENT_TRANSVR_INIT_DOWN : OK, removed + * EVENT_TRANSVR_INIT_FAIL : Outside error, type doesn't supported + * EVENT_TRANSVR_EXCEP_INIT : Internal error, state undefined + */ + switch (type) { + case TRANSVR_TYPE_SFP: + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + case TRANSVR_TYPE_UNPLUGGED: + case TRANSVR_TYPE_FAKE: + break; + default: + SWPS_INFO("detect undefined type:0x%02x on %s\n", + type, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; + } + switch (state) { + case STATE_TRANSVR_DISCONNECTED: + return EVENT_TRANSVR_INIT_DOWN; + case STATE_TRANSVR_INIT: + case STATE_TRANSVR_CONNECTED: + case STATE_TRANSVR_SWAPPED: + break; + default: + SWPS_INFO("detect undefined state:%d on %s\n", + state, self->swp_name); + return EVENT_TRANSVR_EXCEP_INIT; + } + return 0; +} + + +static int +_is_transvr_hw_ready(struct transvr_obj_s *self, + int type){ + /* [Return] + * EVENT_TRANSVR_TASK_DONE : Ready + * EVENT_TRANSVR_TASK_WAIT : Not ready + * EVENT_TRANSVR_INIT_FAIL : Error + */ + int addr = DEBUG_TRANSVR_INT_VAL; + int page = DEBUG_TRANSVR_INT_VAL; + int offs = DEBUG_TRANSVR_INT_VAL; + int bit = DEBUG_TRANSVR_INT_VAL; + int ready = DEBUG_TRANSVR_INT_VAL; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t ab_val = DEBUG_TRANSVR_HEX_VAL; + + switch (type) { + case TRANSVR_TYPE_SFP: + addr = VAL_TRANSVR_8472_READY_ADDR; + page = VAL_TRANSVR_8472_READY_PAGE; + offs = VAL_TRANSVR_8472_READY_OFFSET; + bit = VAL_TRANSVR_8472_READY_BIT; + ready = VAL_TRANSVR_8472_READY_VALUE; + ab_val = VAL_TRANSVR_8472_READY_ABNORMAL; + break; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + addr = VAL_TRANSVR_8436_READY_ADDR; + page = VAL_TRANSVR_8436_READY_PAGE; + offs = VAL_TRANSVR_8436_READY_OFFSET; + bit = VAL_TRANSVR_8436_READY_BIT; + ready = VAL_TRANSVR_8436_READY_VALUE; + ab_val = VAL_TRANSVR_8436_READY_ABNORMAL; + break; + + case TRANSVR_TYPE_UNPLUGGED: + case TRANSVR_TYPE_FAKE: + return EVENT_TRANSVR_TASK_DONE; + + default: + emsg = "unexpected case"; + goto err_is_transvr_hw_ready; + } + /* Select target page */ + err = _common_setup_page(self, addr, page, offs, 1, 0); + if (err < 0) { + emsg = "setup page fail"; + goto err_is_transvr_hw_ready; + } + /* Check feature supported + * [Note] + * Some of transceiver/cables doesn't support "Status Indicators" + * (ex:DAC, RJ45 copper SFP ...etc). In these case, we bypass the + * step of checking Status Indicators, then state machine will take + * the following handle procedure. + */ + err = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + if (err < 0) { + emsg = "doesn't support Status Indicators"; + goto bypass_is_transvr_hw_ready; + } + /* Filter abnormal case */ + if (err == ab_val) { + emsg = "detect using unusual definition."; + goto bypass_is_transvr_hw_ready; + } + /* Get Status Indicators */ + err = i2c_smbus_read_byte_data(self->i2c_client_p, offs); + if (err < 0) { + emsg = "detect current value fail"; + goto err_is_transvr_hw_ready; + } + if ((err & (1<:%d\n", __func__, emsg, type); + return EVENT_TRANSVR_TASK_DONE; + +err_is_transvr_hw_ready: + SWPS_DEBUG("%s: %s :%d\n", __func__, emsg, type); + return EVENT_TRANSVR_INIT_FAIL; +} + +static int +_transvr_init_handler(struct transvr_obj_s *self){ + + int detect[2]; + int d_state = STATE_TRANSVR_UNEXCEPTED; + int d_type = TRANSVR_TYPE_ERROR; + int result = ERR_TRANSVR_UNINIT; + int retry = 6; /* (6+1) x 0.3 = 2.1s > spec:2.0s */ + int elimit = 63; + char emsg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Clean and check callback */ + self->state = STATE_TRANSVR_INIT; + if (self->init == NULL) { + snprintf(emsg, elimit, "init() is null"); + goto initer_err_case_unexcept_0; + } + /* Detect transceiver information */ + result = detect_transvr_state(self, detect); + if (result < 0) { + snprintf(emsg, elimit, "detect_transvr_state() fail"); + switch (result) { + case ERR_TRANSVR_I2C_CRASH: + goto initer_err_case_i2c_ceash; + case ERR_TRNASVR_BE_ISOLATED: + goto initer_err_case_be_isolated; + + case ERR_TRANSVR_UNEXCPT: + default: + break; + } + goto initer_err_case_retry_1; + } + d_state = detect[0]; + d_type = detect[1]; + + /* Verify transceiver type and state */ + switch (_is_transvr_valid(self, d_type, d_state)) { + case 0: + break; + case EVENT_TRANSVR_INIT_DOWN: + goto initer_ok_case_down;; + case EVENT_TRANSVR_INIT_FAIL: + snprintf(emsg, elimit, "transceiver type doesn't support"); + goto initer_err_case_alarm_to_user; + case EVENT_TRANSVR_EXCEP_INIT: + default: + goto initer_err_case_unexcept_0; + } + + /* Handle reload case */ + if (self->type != d_type){ + /* This is the protect mechanism. Normally, This case will not happen. + * When State machine detect swap event during initial, It will trigger + * reload function to ensure type correct. */ + if (_reload_transvr_obj(self, d_type) < 0){ + snprintf(emsg, elimit, "reload object fail"); + goto initer_err_case_unexcept_0; + } + } + + /* Check transceiver HW initial ready */ + switch (_is_transvr_hw_ready(self, d_type)) { + case EVENT_TRANSVR_TASK_DONE: + break; + case EVENT_TRANSVR_TASK_WAIT: + goto initer_err_case_retry_1; + case EVENT_TRANSVR_INIT_FAIL: + default: + goto initer_err_case_unexcept_0; + } + + /* Try to update all and check */ + if (self->update_all(self, 1) < 0){ + /* For some transceiver, EEPROME has lag issues during initial stage. + * In this case, we set status back to STATE_TRANSVR_NEW, than it will + * be checked in next polling cycle. */ + goto initer_err_case_retry_1; + } + + /* Execute init() call back */ + result = self->init(self); + switch (result) { + case EVENT_TRANSVR_TASK_DONE: + break; + case EVENT_TRANSVR_TASK_WAIT: + goto initer_ok_case_wait; + + default: + snprintf(emsg, elimit, "undefined init() return:%d\n", result); + goto initer_err_case_unexcept_0; + } + goto initer_ok_case_up; + + +initer_ok_case_wait: + return EVENT_TRANSVR_TASK_WAIT; + +initer_ok_case_up: + self->state = STATE_TRANSVR_CONNECTED; + self->temp = 0; + return EVENT_TRANSVR_INIT_UP; + +initer_ok_case_down: + self->temp = 0; + self->state = STATE_TRANSVR_DISCONNECTED; + return EVENT_TRANSVR_INIT_DOWN; + +initer_err_case_i2c_ceash: + SWPS_DEBUG("%s: %s :%s :I2C crash\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + return EVENT_TRANSVR_I2C_CRASH; + +initer_err_case_be_isolated: + SWPS_DEBUG("%s: %s :%s :isolated\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_ISOLATED; + return EVENT_TRANSVR_EXCEP_ISOLATED; + +initer_err_case_retry_1: + SWPS_DEBUG("%s: %s :%s :retry\n", + __func__, emsg, self->swp_name); + if (_transvr_handle_retry(self, retry) == 0) { + self->state = STATE_TRANSVR_NEW; + return EVENT_TRANSVR_INIT_REINIT; + } + goto initer_err_case_alarm_to_user; + +initer_err_case_unexcept_0: + self->state = STATE_TRANSVR_UNEXCEPTED; + return EVENT_TRANSVR_INIT_FAIL; + +initer_err_case_alarm_to_user: + SWPS_DEBUG("%s: %s :%s :alarm_to_user\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + alarm_msg_2_user(self, "detected transceiver/cables not meet SFF standard"); + return EVENT_TRANSVR_INIT_FAIL; +} + +static int +setup_transvr_private_cb(struct transvr_obj_s *self, + int transvr_type){ + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + self->fsm_4_direct = common_fsm_4_direct_mode; + return 0; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + self->fsm_4_direct = common_fsm_4_direct_mode; + return 0; + + case TRANSVR_TYPE_QSFP_28: + self->fsm_4_direct = common_fsm_4_direct_mode; + return 0; + + case TRANSVR_TYPE_FAKE: + self->fsm_4_direct = fake_fsm_4_direct_mode; + return 0; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return ERR_TRANSVR_UNEXCPT; +} + + +static struct eeprom_map_s * +get_eeprom_map(int transvr_type){ + + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + return &eeprom_map_sfp; + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + return &eeprom_map_qsfp; + case TRANSVR_TYPE_QSFP_28: + return &eeprom_map_qsfp28; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return NULL; +} + + +static int +setup_transvr_ssize_attr(char *swp_name, + struct transvr_obj_s *self, + struct eeprom_map_s *map_p, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int chan_id, + int run_mode){ + switch (run_mode){ + case TRANSVR_MODE_DIRECT: /* Direct access device mode */ + self->mode = run_mode; + break; + default: + SWPS_ERR("%s: non-defined run_mode:%d\n", + __func__, run_mode); + self->mode = DEBUG_TRANSVR_INT_VAL; + return -1; + } + self->eeprom_map_p = map_p; + self->ioexp_obj_p = ioexp_obj_p; + self->ioexp_virt_offset = ioexp_virt_offset; + self->chan_id = chan_id; + self->layout = transvr_type; + self->type = transvr_type; + self->chipset_type = chipset_type; + self->state = STATE_TRANSVR_NEW; + self->info = STATE_TRANSVR_NEW; + self->auto_tx_disable = VAL_TRANSVR_FUNCTION_DISABLE; + strncpy(self->swp_name, swp_name, 32); + mutex_init(&self->lock); + return 0; +} + + + +static int +setup_i2c_client(struct transvr_obj_s *self){ + + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + adap = i2c_get_adapter(self->chan_id); + if(!adap){ + snprintf(err_msg, sizeof(err_msg), + "can not get adap:%d", self->chan_id); + goto err_setup_i2c_client; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + snprintf(err_msg, sizeof(err_msg), + "can not kzalloc client:%d", self->chan_id); + goto err_setup_i2c_client; + } + client->adapter = adap; + self->i2c_client_p = client; + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + return 0; + +err_setup_i2c_client: + SWPS_ERR("%s: %s\n", __func__, err_msg); + return ERR_TRANSVR_UNEXCPT; +} + + +struct transvr_obj_s * +create_transvr_obj(char *swp_name, + int chan_id, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int run_mode){ + + struct transvr_obj_s *result_p; + struct eeprom_map_s *map_p; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Allocate transceiver object */ + map_p = get_eeprom_map(transvr_type); + if (!map_p){ + snprintf(err_msg, sizeof(err_msg), + "Invalid transvr_type:%d", transvr_type); + goto err_create_transvr_fail; + } + result_p = kzalloc(sizeof(*result_p), GFP_KERNEL); + if (!result_p){ + snprintf(err_msg, sizeof(err_msg), "kzalloc fail"); + goto err_create_transvr_fail; + } + /* Prepare static size attributes */ + if (setup_transvr_ssize_attr(swp_name, + result_p, + map_p, + ioexp_obj_p, + ioexp_virt_offset, + transvr_type, + chipset_type, + chan_id, + run_mode) < 0){ + goto err_create_transvr_sattr_fail; + } + + /* Prepare call back functions of object */ + if (setup_transvr_private_cb(result_p, transvr_type) < 0){ + goto err_create_transvr_sattr_fail; + } + /* Prepare i2c client object */ + if (setup_i2c_client(result_p) < 0){ + goto err_create_transvr_sattr_fail; + } + return result_p; +err_create_transvr_sattr_fail: + kfree(result_p); +err_create_transvr_fail: + SWPS_ERR("%s: %s :%d :%d :%d\n", + __func__, err_msg, chan_id, ioexp_virt_offset, transvr_type); + return NULL; +} + + +static int +_reload_transvr_obj(struct transvr_obj_s *self, + int new_type){ + + struct eeprom_map_s *new_map_p; + struct eeprom_map_s *old_map_p = self->eeprom_map_p; + struct i2c_client *old_i2c_p = self->i2c_client_p; + int old_type = self->type; + + /* Change state to STATE_TRANSVR_INIT */ + self->state = STATE_TRANSVR_INIT; + self->type = new_type; + /* Replace EEPROME map */ + new_map_p = get_eeprom_map(new_type); + if (!new_map_p){ + goto err_private_reload_func_1; + } + self->eeprom_map_p = new_map_p; + /* Reload i2c client */ + if (setup_i2c_client(self) < 0){ + goto err_private_reload_func_2; + } + if (setup_transvr_private_cb(self, new_type) < 0){ + goto err_private_reload_func_3; + } + kfree(old_i2c_p); + return 0; + +err_private_reload_func_3: + SWPS_INFO("%s: init() fail!\n", __func__); + kfree(old_i2c_p); + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = TRANSVR_TYPE_ERROR; + return -2; + +err_private_reload_func_2: + self->eeprom_map_p = old_map_p; + self->i2c_client_p = old_i2c_p; +err_private_reload_func_1: + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = old_type; + SWPS_INFO("%s fail! :0x%02x\n", __func__, new_type); + return -1; +} + + +static int +reload_transvr_obj(struct transvr_obj_s *self, + int new_type){ + + int result_val = ERR_TRANSVR_UNEXCPT; + + /* Reload phase */ + result_val = _reload_transvr_obj(self, new_type); + if (result_val < 0){ + SWPS_INFO("%s: reload phase fail! :%d\n", + __func__, result_val); + return EVENT_TRANSVR_RELOAD_FAIL; + } + /* Initial phase */ + result_val = _transvr_init_handler(self); + if (result_val < 0){ + SWPS_INFO("%s: initial phase fail! :%d\n", + __func__, result_val); + } + return result_val; +} + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/transceiver.h b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/transceiver.h new file mode 100644 index 000000000000..0e79f0b9027f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/transceiver.h @@ -0,0 +1,168 @@ +#ifndef TRANSCEIVER_H +#define TRANSCEIVER_H + +#include + +/* Transceiver type define */ +#define TRANSVR_TYPE_UNKNOW_1 (0x00) +#define TRANSVR_TYPE_UNKNOW_2 (0xff) +#define TRANSVR_TYPE_SFP (0x03) /* Define for SFP, SFP+, SFP28 */ +#define TRANSVR_TYPE_QSFP (0x0c) +#define TRANSVR_TYPE_QSFP_PLUS (0x0d) +#define TRANSVR_TYPE_QSFP_28 (0x11) +#define TRANSVR_TYPE_UNPLUGGED (0xfa) /* Define for ERROR handle */ +#define TRANSVR_TYPE_FAKE (0xfc) /* Define for ERROR handle */ +#define TRANSVR_TYPE_INCONSISTENT (0xfd) /* Define for ERROR handle */ +#define TRANSVR_TYPE_ERROR (0xfe) /* Define for ERROR handle */ + +/* Transceiver mode define */ +#define TRANSVR_MODE_DIRECT (21000) + +/* Transceiver state define + * [Note] + * 1. State is used to represent the state of "Transceiver" and "Object". + * 2. State for different target has different means. The description as following: + */ +#define STATE_TRANSVR_CONNECTED (0) /* [Transvr]:Be plugged in. [Obj]:Link up, and work normally. */ +#define STATE_TRANSVR_NEW (-100) /* [Transvr]:(Not used) [Obj]:Create */ +#define STATE_TRANSVR_INIT (-101) /* [Transvr]:Be plugged in. [Obj]:Link up, and in initial process. */ +#define STATE_TRANSVR_ISOLATED (-102) /* [Transvr]:Be plugged in. [Obj]:Isolate, and not provide service. */ +#define STATE_TRANSVR_SWAPPED (-200) /* [Transvr]:Be plugged in. [Obj]:(Not used) */ +#define STATE_TRANSVR_DISCONNECTED (-300) /* [Transvr]:Un-plugged. [Obj]:Link down, and not provide service. */ +#define STATE_TRANSVR_UNEXCEPTED (-901) /* [Transvr]:Any [Obj]:Any, and not in expect case. */ + +/* Event for task handling */ +#define EVENT_TRANSVR_TASK_WAIT (2101) +#define EVENT_TRANSVR_TASK_DONE (0) +#define EVENT_TRANSVR_TASK_FAIL (-2101) +/* Event for initial handling */ +#define EVENT_TRANSVR_INIT_UP (2201) +#define EVENT_TRANSVR_INIT_DOWN (1) +#define EVENT_TRANSVR_INIT_REINIT (-2201) +#define EVENT_TRANSVR_INIT_FAIL (-2202) +/* Event for others */ +#define EVENT_TRANSVR_RELOAD_FAIL (-2301) +#define EVENT_TRANSVR_EXCEP_INIT (-2401) +#define EVENT_TRANSVR_EXCEP_UP (-2402) +#define EVENT_TRANSVR_EXCEP_DOWN (-2403) +#define EVENT_TRANSVR_EXCEP_SWAP (-2404) +#define EVENT_TRANSVR_EXCEP_EXCEP (-2405) +#define EVENT_TRANSVR_EXCEP_ISOLATED (-2406) +#define EVENT_TRANSVR_I2C_CRASH (-2501) + +/* Transceiver error code define */ +#define ERR_TRANSVR_UNINIT (-201) +#define ERR_TRANSVR_UNPLUGGED (-202) +#define ERR_TRANSVR_ABNORMAL (-203) +#define ERR_TRANSVR_NOSTATE (-204) +#define ERR_TRANSVR_NOTSUPPORT (-205) +#define ERR_TRANSVR_BADINPUT (-206) +#define ERR_TRANSVR_UPDATE_FAIL (-207) +#define ERR_TRANSVR_RELOAD_FAIL (-208) +#define ERR_TRANSVR_INIT_FAIL (-209) +#define ERR_TRANSVR_UNDEFINED (-210) +#define ERR_TRANSVR_TASK_FAIL (-211) +#define ERR_TRANSVR_TASK_BUSY (-212) +#define ERR_TRANSVR_FUNC_DISABLE (-214) +#define ERR_TRANSVR_I2C_CRASH (-297) +#define ERR_TRNASVR_BE_ISOLATED (-298) +#define ERR_TRANSVR_UNEXCPT (-299) + +/* For debug */ +#define DEBUG_TRANSVR_INT_VAL (-99) +#define DEBUG_TRANSVR_HEX_VAL (0xfe) +#define DEBUG_TRANSVR_STR_VAL "ERROR" + +/* For system internal */ +#define VAL_TRANSVR_COMID_ARREESS (0x50) +#define VAL_TRANSVR_COMID_OFFSET (0x00) +#define VAL_TRANSVR_8472_READY_ADDR (0x51) +#define VAL_TRANSVR_8472_READY_PAGE (-1) +#define VAL_TRANSVR_8472_READY_OFFSET (110) +#define VAL_TRANSVR_8472_READY_BIT (0) +#define VAL_TRANSVR_8472_READY_VALUE (0) +#define VAL_TRANSVR_8472_READY_ABNORMAL (0xff) +#define VAL_TRANSVR_8436_READY_ADDR (0x50) +#define VAL_TRANSVR_8436_READY_PAGE (-1) +#define VAL_TRANSVR_8436_READY_OFFSET (2) +#define VAL_TRANSVR_8436_READY_BIT (0) +#define VAL_TRANSVR_8436_READY_VALUE (0) +#define VAL_TRANSVR_8436_READY_ABNORMAL (0xff) +#define VAL_TRANSVR_8436_PWD_ADDR (0x50) +#define VAL_TRANSVR_8436_PWD_PAGE (-1) +#define VAL_TRANSVR_8436_PWD_OFFSET (123) +#define VAL_TRANSVR_PAGE_FREE (-99) +#define VAL_TRANSVR_PAGE_SELECT_OFFSET (127) +#define VAL_TRANSVR_PAGE_SELECT_DELAY (5) +#define VAL_TRANSVR_TASK_RETRY_FOREVER (-999) +#define VAL_TRANSVR_FUNCTION_DISABLE (-1) +#define STR_TRANSVR_SFP "SFP" +#define STR_TRANSVR_QSFP "QSFP" +#define STR_TRANSVR_QSFP_PLUS "QSFP+" +#define STR_TRANSVR_QSFP28 "QSFP28" + +/* BCM chip type define */ +#define BCM_CHIP_TYPE_TOMAHAWK (31002) /* Redwood, Cypress */ + +/* Info from transceiver EEPROM */ +struct eeprom_map_s { + int addr_rx_los; int page_rx_los; int offset_rx_los; int length_rx_los; + int addr_tx_disable; int page_tx_disable; int offset_tx_disable; int length_tx_disable; + int addr_tx_fault; int page_tx_fault; int offset_tx_fault; int length_tx_fault; +}; + +/* Class of transceiver object */ +struct transvr_obj_s { + /* ========== Object private property ========== + */ + struct device *transvr_dev_p; + struct eeprom_map_s *eeprom_map_p; + struct i2c_client *i2c_client_p; + struct ioexp_obj_s *ioexp_obj_p; + struct mutex lock; + char swp_name[32]; + int auto_tx_disable; + int chan_id; + int chipset_type; + int curr_page; + int info; + int ioexp_virt_offset; + int lane_id[8]; + int layout; + int mode; + int retry; + int state; + int temp; + int type; + + /* ========== Object private functions ========== + */ + int (*init)(struct transvr_obj_s *self); + int (*update_all)(struct transvr_obj_s *self, int show_err); + int (*fsm_4_direct)(struct transvr_obj_s* self, char *caller_name); +}; + + +/* For AVL Mapping */ +struct transvr_avl_s { + char vendor_name[32]; + char vendor_pn[32]; + int (*init)(struct transvr_obj_s *self); +}; + +struct transvr_obj_s * +create_transvr_obj(char *swp_name, + int chan_id, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int run_mode); + +void alarm_msg_2_user(struct transvr_obj_s *self, char *emsg); + +#endif /* TRANSCEIVER_H */ + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/utils/inventec_d7054_util.py b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/utils/inventec_d7054_util.py new file mode 100755 index 000000000000..7fbb707f4187 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/utils/inventec_d7054_util.py @@ -0,0 +1,234 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Inventec, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +DEBUG = False +args = [] +FORCE = 0 +i2c_prefix = '/sys/bus/i2c/devices/' + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + install() + elif arg == 'clean': + uninstall() + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print "[D7032]"+txt + return + +def exec_cmd(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + show_log (cmd +"with result:" + str(status)) + show_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +instantiate =[ +#'echo pca9548 0x71> /sys/bus/i2c/devices/i2c-0/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-2/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-3/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-4/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-5/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-6/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-7/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-8/new_device', +'echo inv_eeprom 0x53 > /sys/bus/i2c/devices/i2c-0/new_device'] +#'echo inv_psoc 0x66> /sys/bus/i2c/devices/i2c-0/new_device', +#'echo inv_cpld 0x55> /sys/bus/i2c/devices/i2c-0/new_device'] + +drivers =[ +'lpc_ich', +'i2c-i801', +'i2c-mux', +'i2c-mux-pca954x', +'i2c-dev', +'inv_eeprom', +'inv_platform', +'inv_psoc', +'inv_cpld', +'swps'] + + + +def system_install(): + global FORCE + + #install drivers + for i in range(0,len(drivers)): + status, output = exec_cmd("modprobe "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + + #instantiate devices + for i in range(0,len(instantiate)): + #time.sleep(1) + status, output = exec_cmd(instantiate[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(10,18): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-2/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(18,26): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-3/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(26,34): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-4/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(34,42): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-5/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(42,50): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-6/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(50,58): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-7/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(58,64): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-8/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + + +def system_ready(): + if not device_found(): + return False + return True + +def install(): + if not device_found(): + print "No device, installing...." + status = system_install() + if status: + if FORCE == 0: + return status + else: + print " D7032 devices detected...." + return + +def uninstall(): + global FORCE + #uninstall drivers + for i in range(len(drivers)-1,-1,-1): + status, output = exec_cmd("rmmod "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_found(): + ret1, log = exec_cmd("ls "+i2c_prefix+"*0072", 0) + ret2, log = exec_cmd("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/changelog b/platform/broadcom/sonic-platform-modules-inventec/debian/changelog index 3598fc1d40d1..9d33aa418ef5 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/changelog +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/changelog @@ -1,3 +1,8 @@ +sonic-inventec-platform-modules (1.1.0) unstable; urgency=low + * Add support for Inventec d7054 + + -- developer Tue, 18 Jul 2017 16:30:45 +0800 + sonic-inventec-platform-modules (1.0.0) unstable; urgency=low * Add support for Inventec d7032 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/control b/platform/broadcom/sonic-platform-modules-inventec/debian/control index 328de48c097b..d570e777de98 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/control +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/control @@ -10,3 +10,8 @@ Architecture: amd64 Depends: linux-image-3.16.0-4-amd64 Description: kernel modules for platform devices such as fan, led +Package: platform-modules-d7054q28b +Architecture: amd64 +Depends: linux-image-3.16.0-4-amd64 +Description: kernel modules for platform devices such as fan, led + diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init index 9b9683a4eb2a..5df1bb444123 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init @@ -15,43 +15,14 @@ case "$1" in start) echo -n "Setting up board... " - depmod -a - modprobe inv_platform - modprobe inv_psoc - modprobe inv_cpld - - /usr/local/bin/onie-syseeprom -S /tmp/eeprom - # Attach 32 instances of EEPROM driver QSFP ports on IO module 1 - #eeprom can dump data using below command - for ((i=22;i<=29;i++)); - do - echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-4/i2c-$i/new_device - done - - for ((i=30;i<=37;i++)); - do - echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-5/i2c-$i/new_device - done - - for ((i=6;i<=13;i++)); - do - echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-2/i2c-$i/new_device - done - - for ((i=14;i<=21;i++)); - do - echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-3/i2c-$i/new_device - done - + depmod -a + /usr/local/bin/inventec_d7032_util.py -f install echo "done." ;; stop) - - rmmod inv_cpld - rmmod inv_psoc - rmmod inv_platform - + + /usr/local/bin/inventec_d7032_util.py -f clean echo "done." ;; diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install index 996d5e36b781..0864a728ea79 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install @@ -1 +1 @@ -d7032q28b/conf/d7032q28b-modules.conf etc/modules-load.d +d7032q28b/utils/inventec_d7032_util.py usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.upstart b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.upstart new file mode 100644 index 000000000000..cbb96a664f6a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.upstart @@ -0,0 +1,5 @@ +description "SONiC platform service" + +respawn + +exec /usr/local/bin/inventec_d7032_util.py -f install diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init new file mode 100644 index 000000000000..20341f8527e5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init @@ -0,0 +1,40 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup Inventec d7054q28b board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + depmod -a + /usr/local/bin/inventec_d7054_util.py -f install + echo "done." + ;; + +stop) + + /usr/local/bin/inventec_d7054_util.py -f clean + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-d7054q28b.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install new file mode 100644 index 000000000000..42bf3f23c809 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install @@ -0,0 +1 @@ +d7054q28b/utils/inventec_d7054_util.py usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.upstart b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.upstart new file mode 100644 index 000000000000..9f185f47b623 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.upstart @@ -0,0 +1,5 @@ +description "SONiC platform service" + +respawn + +exec /usr/local/bin/inventec_d7054_util.py -f install diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/rules b/platform/broadcom/sonic-platform-modules-inventec/debian/rules index 166a3426b2ba..6ead4c21de50 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/rules +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/rules @@ -14,7 +14,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= d7032q28b +MODULE_DIRS:= d7032q28b d7054q28b %: dh $@ @@ -31,7 +31,8 @@ override_dh_auto_install: cp $(MOD_SRC_DIR)/$${mod}/modules/*.ko \ debian/platform-modules-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ dh_installdirs -pplatform-modules-$${mod} usr/local/bin; \ - cp -r $(MOD_SRC_DIR)/$${mod}/utils/onie-syseeprom debian/platform-modules-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$${mod}/utils/* \ + debian/platform-modules-$${mod}/usr/local/bin; \ done) override_dh_usrlocal: From a9566bdb1e708de2a0ec249e54d05bdf42c90618 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 19 Oct 2017 16:52:33 -0700 Subject: [PATCH 0852/1833] [Broadcom]: Update Broadcom SAI package to 3.0.3.2-8 (#1057) Update Inventec config.bcm files Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index bf20f0dc706f..bee229ddbebf 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-7_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-7_amd64.deb?sv=2015-04-05&sr=b&sig=RUUm3WJuGYmtIatkKtR5iAuI%2FG2KM9hMXewAEnR2AKY%3D&se=2031-06-26T21%3A45%3A55Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-8_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-8_amd64.deb?sv=2015-04-05&sr=b&sig=PYRdEo1SB0TfoahBoxwoNMt4g1V5aQpBH5RolBGZ6Lw%3D&se=2031-06-28T20%3A29%3A10Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-7_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-8_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-7_amd64.deb?sv=2015-04-05&sr=b&sig=hTQZeaqa7oiR9YTIuUGG1DGYNg8bwlWKB2J2r46Mq%2BE%3D&se=2031-06-26T21%3A46%3A16Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-8_amd64.deb?sv=2015-04-05&sr=b&sig=HWoCzzgNscATWcW0KXjh24LdoJ0AM4sVgISgyBh60MI%3D&se=2031-06-28T20%3A28%3A29Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 587b14a3bf4a043941e2bcbaee8eafad6aa3d2a2 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Fri, 20 Oct 2017 04:36:25 +0300 Subject: [PATCH 0853/1833] [Mellanox]: Add get_presence implementation for SFP on Mellanox platforms (#1056) Signed-off-by: Andriy Moroz --- .../x86_64-mlnx_msn2410-r0/plugins/sfputil.py | 17 ++++++++++++++++- .../x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 17 ++++++++++++++++- .../x86_64-mlnx_msn2740-r0/plugins/sfputil.py | 17 ++++++++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py index db71cb423503..0d7870b785fa 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py @@ -46,8 +46,23 @@ def __init__(self): SfpUtilBase.__init__(self) def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False - raise NotImplementedError + try: + reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string with the qsfp status + if content == "good": + return True + + return False def get_low_power_mode(self, port_num): 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 b746af219917..b768cc44022d 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -46,8 +46,23 @@ def __init__(self): SfpUtilBase.__init__(self) def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False - raise NotImplementedError + try: + reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string with the qsfp status + if content == "good": + return True + + return False def get_low_power_mode(self, port_num): diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py index b746af219917..b768cc44022d 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py @@ -46,8 +46,23 @@ def __init__(self): SfpUtilBase.__init__(self) def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False - raise NotImplementedError + try: + reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string with the qsfp status + if content == "good": + return True + + return False def get_low_power_mode(self, port_num): From bdbede51e0b5557727b86f25345d067231fe2071 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 20 Oct 2017 05:09:37 -0700 Subject: [PATCH 0854/1833] [docker ptf]: Install tcpdump (#1059) * Always start with Forwarding State flag set for bgpd * Install tcpdump into ptf container --- dockers/docker-ptf/Dockerfile.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 1d1231d9418e..01312687b93c 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -40,6 +40,7 @@ RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' / iputils-ping \ hping3 \ curl \ + tcpdump \ python \ python-dev \ python-scapy From 8bc6b5533186c14e69c5e785b0dbd0eb73acd395 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 20 Oct 2017 07:15:11 -0700 Subject: [PATCH 0855/1833] [bgpd.conf] Fix template issue with multiple lo addresses (#1060) --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 13 ++++++++----- src/sonic-config-engine/minigraph.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index 3d01d9d52714..bd8de7e4ba15 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -32,16 +32,15 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp graceful-restart {% endif %} {% for (name, prefix) in LOOPBACK_INTERFACE %} -{# TODO: use v4 lo for backward compatibility, will revisit the case with multiple lo interfaces #} -{% if prefix | ipv4 %} +{% if prefix | ipv4 and name == 'Loopback0' %} bgp router-id {{ prefix | ip }} {% endif %} {% endfor %} {# advertise loopback #} {% for (name, prefix) in LOOPBACK_INTERFACE %} -{% if prefix | ipv4 %} +{% if prefix | ipv4 and name == 'Loopback0' %} network {{ prefix | ip }}/32 -{% elif prefix | ipv6 %} +{% elif prefix | ipv6 and name == 'Loopback0' %} address-family ipv6 network {{ prefix | ip }}/64 exit-address-family @@ -97,7 +96,11 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} neighbor {{ bgp_peer['name'] }} remote-as {{ deployment_id_asn_map[DEVICE_METADATA['localhost']['deployment_id']] }} neighbor {{ bgp_peer['name'] }} ebgp-multihop 255 neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound - neighbor {{ bgp_peer['name'] }} update-source Loopback0 +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if name == 'Loopback1' %} + neighbor {{ bgp_peer['name'] }} update-source {{ prefix | ip }} +{% endif %} +{% endfor %} neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out {% for ip_range in bgp_peer['ip_range'] %} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 69299ce3c50a..2cb1c89981e1 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -274,7 +274,7 @@ def parse_cpg(cpg, hname): bgp_session = bgp_sessions[peer] if hostname == bgp_session['name']: bgp_session['asn'] = asn - + bgp_sessions = { key: bgp_sessions[key] for key in bgp_sessions if bgp_sessions[key].has_key('asn') and int(bgp_sessions[key]['asn']) != 0 } return bgp_sessions, myasn, bgp_peers_with_range From def0f2e4deb03f9bb14d590414047a735a9a15f1 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 20 Oct 2017 11:01:26 -0700 Subject: [PATCH 0856/1833] [sensors]: Workaround for apparent bug in lm-sensors (#1058) --- dockers/docker-platform-monitor/lm-sensors.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dockers/docker-platform-monitor/lm-sensors.sh b/dockers/docker-platform-monitor/lm-sensors.sh index 61e90c09a8e3..2f4768a8cdda 100755 --- a/dockers/docker-platform-monitor/lm-sensors.sh +++ b/dockers/docker-platform-monitor/lm-sensors.sh @@ -3,7 +3,19 @@ # Based off /etc/init.d/lm-sensors # -/usr/bin/sensors -s > /dev/null 2>&1 + +# NOTE: lm-sensors v3.3.5 appears to have a bug. If `sensors -s` is called, it +# will first load /etc/sensors.conf, then load all files in /etc/sensors.d/, +# overriding any values that may have already been specified in +# /etc/sensors.conf. However, it appears this overriding is not taking place. +# As a workaround, as long as a platform-specific sensors.conf has been copied +# to /etc/sensors.d/, we will ONLY load that file, otherwise we load the default. +if [ -e /etc/sensors.d/sensors.conf ]; then + /usr/bin/sensors -s -c /etc/sensors.d/sensors.conf > /dev/null 2>&1 +else + /usr/bin/sensors -s > /dev/null 2>&1 +fi + /usr/bin/sensors > /dev/null 2>&1 # Currently, there is no way to run sensord in the foreground, so we From 3417e78d55838e336d3fcc29e2510d1f328fcf09 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Sun, 22 Oct 2017 13:44:44 -0700 Subject: [PATCH 0857/1833] [swss-common]: Update sonic-swss-common submodule (#1064) Signed-off-by: Qi Luo --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index f6ff19bee131..31142b8fac17 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit f6ff19bee131048f2274a21ea1064a8493a7fd8b +Subproject commit 31142b8fac1796b7d665ed06609c9fec09c9707f From c74007bb837b2a92c8c65de67fbd714c80c91ceb Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Mon, 23 Oct 2017 11:46:26 -0700 Subject: [PATCH 0858/1833] [Arista]: Modified HWSKU to match the internally defined HWSKU string (#1062) --- .../{Arista-7060-CX32S => Arista-7060-CX-32S}/port_config.ini | 0 .../{Arista-7060-CX32S => Arista-7060-CX-32S}/sai.profile | 0 device/arista/x86_64-arista_7060_cx32s/minigraph.xml | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename device/arista/x86_64-arista_7060_cx32s/{Arista-7060-CX32S => Arista-7060-CX-32S}/port_config.ini (100%) rename device/arista/x86_64-arista_7060_cx32s/{Arista-7060-CX32S => Arista-7060-CX-32S}/sai.profile (100%) diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX-32S/port_config.ini similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/port_config.ini rename to device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX-32S/port_config.ini diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile b/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX-32S/sai.profile similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX32S/sai.profile rename to device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX-32S/sai.profile diff --git a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml index 513a60254818..7c9f66ab69da 100644 --- a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml +++ b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml @@ -1040,7 +1040,7 @@ switch1 - Arista-7060-CX32S + Arista-7060-CX-32S @@ -1075,5 +1075,5 @@ switch1 - Arista-7060-CX32S + Arista-7060-CX-32S From b6cc73a0ad7c2a44712722899955886354d6554f Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 23 Oct 2017 13:20:37 -0700 Subject: [PATCH 0859/1833] [dockers]: Remove deprecated docker-lldp and docker-snmp (#1068) Signed-off-by: Shu0T1an ChenG --- dockers/docker-lldp/Dockerfile | 25 --------------- dockers/docker-lldp/supervisord.conf | 19 ----------- dockers/docker-snmp/Dockerfile | 48 ---------------------------- dockers/docker-snmp/supervisord.conf | 14 -------- 4 files changed, 106 deletions(-) delete mode 100644 dockers/docker-lldp/Dockerfile delete mode 100644 dockers/docker-lldp/supervisord.conf delete mode 100644 dockers/docker-snmp/Dockerfile delete mode 100644 dockers/docker-snmp/supervisord.conf diff --git a/dockers/docker-lldp/Dockerfile b/dockers/docker-lldp/Dockerfile deleted file mode 100644 index 595c41bcd85e..000000000000 --- a/dockers/docker-lldp/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM docker-base - -COPY deps/swsssdk*.whl deps/lldpsyncd_*.deb deps/lldpd_*.deb /deps/ - -# Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -# Pre-install the fundamental packages -# Install Python SwSS SDK (lldpsyncd dependency) -# Install LLDP Sync Daemon -# Note: dpkg_apt function has the benefit to detect missing .deb file -# Clean up -RUN apt-get update && \ - dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ - dpkg_apt /deps/lldpd_*.deb && \ - dpkg_apt /deps/lldpsyncd_*.deb && \ - apt-get install -y python-pip supervisor && \ - pip install /deps/swsssdk*.whl && \ - apt-get remove -y python-pip && \ - apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \ - rm -rf /deps ~/.cache - -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf - -ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-lldp/supervisord.conf b/dockers/docker-lldp/supervisord.conf deleted file mode 100644 index faff70ed06fa..000000000000 --- a/dockers/docker-lldp/supervisord.conf +++ /dev/null @@ -1,19 +0,0 @@ -[supervisord] -nodaemon=true - -[program:lldpd] -# https://github.com/vincentbernat/lldpd/commit/9856f2792c301116cc4a3fcfba91b9672ee5db1f -# - `-d` means to stay in foreground, log to syslog -# - `-dd` means to stay in foreground, log warnings to console -# - `-ddd` means to stay in foreground, log warnings and info to console -# - `-dddd` means to stay in foreground, log all to console -command=/usr/sbin/lldpd -d -I Ethernet*,eth* -priority=100 - -[program:lldpsyncd] -command=/usr/sbin/lldpsyncd -priority=200 - -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n -priority=1 diff --git a/dockers/docker-snmp/Dockerfile b/dockers/docker-snmp/Dockerfile deleted file mode 100644 index 6a79db976adc..000000000000 --- a/dockers/docker-snmp/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -FROM docker-base - -COPY deps/snmp_*.deb deps/snmpd_*.deb deps/libsnmp-base_*.deb deps/libsnmp30_*.deb /deps/ -COPY deps/python3/*.whl /python3/ - -# enable -O for all Python calls -ENV PYTHONOPTIMIZE 1 - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -## Pre-install the fundamental packages -## Install SNMP subagent -## Note: dpkg_apt function has the benefit to detect missing .deb file -## Clean up -RUN apt-get update && \ - dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \ - dpkg_apt /deps/libsnmp-base_*.deb && \ - dpkg_apt /deps/libsnmp30_*.deb && \ - dpkg_apt /deps/snmp_*.deb && \ - dpkg_apt /deps/snmpd_*.deb && \ - rm -rf /deps - -# install subagent -RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \ - rm -rf /var/lib/apt/lists/* && \ - wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz && \ - tar xvf Python-3.5.2.tgz && cd Python-3.5.2 && \ - ./configure --without-doc-strings --prefix=/usr --without-pymalloc --enable-shared && \ - make && make install && \ - ldconfig && \ - cd .. && rm -rf Python-3.5.2 && rm Python-3.5.2.tgz && \ - pip3 install --no-cache-dir /python3/*py3*.whl hiredis && \ - rm -rf /python3 && \ - python3 -m acs_ax_impl install && \ - python3 -m pip uninstall -y pip setuptools && \ - /bin/bash -c "rm -rf /usr/lib/python3.5/{unittest,lib2to3,tkinter,idlelib,email,test}" && \ - apt-get -y purge build-essential wget libssl-dev openssl && \ - apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ - find / | grep -E "__pycache__" | xargs rm -rf && \ - rm -rf ~/.cache - -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf - -## Although exposing ports is not need for host net mode, keep it for possible bridge mode -EXPOSE 161/udp 162/udp - -ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-snmp/supervisord.conf b/dockers/docker-snmp/supervisord.conf deleted file mode 100644 index c954add628d0..000000000000 --- a/dockers/docker-snmp/supervisord.conf +++ /dev/null @@ -1,14 +0,0 @@ -[supervisord] -nodaemon=true - -[program:snmpd] -command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable -p /run/snmpd.pid -priority=100 - -[program:acs-snmp-subagent] -command=/usr/bin/env python3 -m acs_ax_impl -priority=200 - -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n -priority=1 From a4ecade8f6eba814e947204f36927d2a6561d31c Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 23 Oct 2017 15:46:07 -0700 Subject: [PATCH 0860/1833] [Broadcom]: Update Broadcom SAI package to 3.0.3.2-8 (#1070) Update Arista config.bcm files Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index bee229ddbebf..93cf129e0cbb 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-8_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-8_amd64.deb?sv=2015-04-05&sr=b&sig=PYRdEo1SB0TfoahBoxwoNMt4g1V5aQpBH5RolBGZ6Lw%3D&se=2031-06-28T20%3A29%3A10Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-9_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-9_amd64.deb?sv=2015-04-05&sr=b&sig=w4MY%2FMlnCe59xwMXRxODyLkaEDLEljeBlT3bPUnedoU%3D&se=2031-07-02T20%3A17%3A33Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-8_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-9_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-8_amd64.deb?sv=2015-04-05&sr=b&sig=HWoCzzgNscATWcW0KXjh24LdoJ0AM4sVgISgyBh60MI%3D&se=2031-06-28T20%3A28%3A29Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-9_amd64.deb?sv=2015-04-05&sr=b&sig=zfBAMJKd0LUesg88UjDdUor%2Bc4j8omvw08MKymQQFnE%3D&se=2031-07-02T20%3A17%3A10Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From fd34d907ffb2318d79ab60ba73af3d063b13fd92 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 23 Oct 2017 19:53:10 -0700 Subject: [PATCH 0861/1833] [lldp]: Get all interfaces from the database (#1069) The previous implementation only supports EthernetX while X varies from 0 - 124. Remove such hard coded logics and use the information from the database instead. Signed-off-by: Shu0T1an ChenG --- dockers/docker-lldp-sv2/Dockerfile.j2 | 2 +- dockers/docker-lldp-sv2/reconfigure.sh | 17 ++++++++--------- dockers/docker-lldp-sv2/supervisord.conf | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 158d5b52ffe7..bfb1f9ca678a 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -30,7 +30,7 @@ RUN pip install /python-wheels/swsssdk-2.0.1-py2-none-any.whl && \ COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["reconfigure.sh", "/opt/"] +COPY ["reconfigure.sh", "/usr/bin/"] COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"] COPY ["lldpd", "/etc/default/"] diff --git a/dockers/docker-lldp-sv2/reconfigure.sh b/dockers/docker-lldp-sv2/reconfigure.sh index 9f42a33a24b4..515e771aa6f2 100755 --- a/dockers/docker-lldp-sv2/reconfigure.sh +++ b/dockers/docker-lldp-sv2/reconfigure.sh @@ -2,9 +2,8 @@ set -e -num_of_interfaces=32 -if_step=4 -last_if_idx=$((num_of_interfaces*if_step - if_step)) +# TODO: Listen to state database when it is ready +interfaces=$(sonic-cfggen -d -v "PORT.keys() | join(' ')") function wait_until_if_exists { @@ -31,23 +30,23 @@ function wait_until_if_not_exists while /bin/true ; do # wait until all interfaces are created - echo Wait until all ifaces are created - for i in $(seq 0 $if_step $last_if_idx) + echo Wait until all interfaces are created + for i in $interfaces do - wait_until_if_exists "Ethernet$i" + wait_until_if_exists $i done echo Wait 10 seconds while lldpd finds new interfaces sleep 10 # apply lldpd configuration - echo apply lldpd configuration + echo Apply lldpd configuration lldpcli -c /etc/lldpd.conf # wait until all interfaces are destroyed echo Wait until all ifaces are destroyed - for i in $(seq 0 $if_step $last_if_idx) + for i in $interfaces do - wait_until_if_not_exists "Ethernet$i" + wait_until_if_not_exists $i done done diff --git a/dockers/docker-lldp-sv2/supervisord.conf b/dockers/docker-lldp-sv2/supervisord.conf index 505b72d18227..ab62d9ed2e87 100644 --- a/dockers/docker-lldp-sv2/supervisord.conf +++ b/dockers/docker-lldp-sv2/supervisord.conf @@ -33,7 +33,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:lldpd-conf-reload] -command=/opt/reconfigure.sh +command=/usr/bin/reconfigure.sh priority=150 autostart=false autorestart=false From a49ac2d211178552a3262479fc4666d7967ce227 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Mon, 23 Oct 2017 21:17:58 -0700 Subject: [PATCH 0862/1833] [FRR]: Change the FRR as a submodule (#1071) Signed-off-by: zxu@linkedin.com --- .gitmodules | 3 +++ src/sonic-frr/Makefile | 5 ----- src/sonic-frr/frr | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) create mode 160000 src/sonic-frr/frr diff --git a/.gitmodules b/.gitmodules index 4bddfb4a60da..c837451c9480 100644 --- a/.gitmodules +++ b/.gitmodules @@ -66,3 +66,6 @@ [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 +[submodule "src/sonic-frr/frr"] + path = src/sonic-frr/frr + url = https://github.com/FRRouting/frr.git diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index 80d5a9ad0900..b044781a60f2 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -5,11 +5,6 @@ SHELL = /bin/bash MAIN_TARGET = frr_$(FRR_VERSION)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - # Cloning FRR repo if not already done - if [ ! -d "frr" ]; then \ - git clone -b stable/$(FRR_VERSION) https://github.com/FRRouting/frr.git; \ - fi - # Replacing frr's rules/install files with SONiC's own versions to activate # specific knobs and adjust install process to address SONiC's needs. cp sonic_frr.rules frr/debian/rules diff --git a/src/sonic-frr/frr b/src/sonic-frr/frr new file mode 160000 index 000000000000..5424c62d6e9d --- /dev/null +++ b/src/sonic-frr/frr @@ -0,0 +1 @@ +Subproject commit 5424c62d6e9d574a00529edfc0a0b3bb3beb8811 From f073d8c6548de8d47ba42ab540a8adb72e84e0e9 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 23 Oct 2017 22:01:42 -0700 Subject: [PATCH 0863/1833] [virtualswitch]: build docker-sonic-vs docker based on SAI virtual switch (#1065) --- platform/vs/README.md | 17 +++++ platform/vs/create_vnet.sh | 38 +++++++++++ platform/vs/docker-sonic-vs.mk | 16 +++++ platform/vs/docker-sonic-vs/50-default.conf | 68 ++++++++++++++++++++ platform/vs/docker-sonic-vs/Dockerfile | 51 +++++++++++++++ platform/vs/docker-sonic-vs/Dockerfile.j2 | 56 ++++++++++++++++ platform/vs/docker-sonic-vs/brcm.profile.ini | 4 ++ platform/vs/docker-sonic-vs/orchagent.sh | 15 +++++ platform/vs/docker-sonic-vs/start.sh | 33 ++++++++++ platform/vs/docker-sonic-vs/supervisord.conf | 68 ++++++++++++++++++++ platform/vs/rules.mk | 4 ++ platform/vs/syncd-vs.mk | 13 ++++ rules/sairedis.mk | 15 +++++ slave.mk | 5 +- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 16 files changed, 404 insertions(+), 3 deletions(-) create mode 100644 platform/vs/README.md create mode 100755 platform/vs/create_vnet.sh create mode 100644 platform/vs/docker-sonic-vs.mk create mode 100644 platform/vs/docker-sonic-vs/50-default.conf create mode 100644 platform/vs/docker-sonic-vs/Dockerfile create mode 100644 platform/vs/docker-sonic-vs/Dockerfile.j2 create mode 100644 platform/vs/docker-sonic-vs/brcm.profile.ini create mode 100755 platform/vs/docker-sonic-vs/orchagent.sh create mode 100755 platform/vs/docker-sonic-vs/start.sh create mode 100644 platform/vs/docker-sonic-vs/supervisord.conf create mode 100644 platform/vs/rules.mk create mode 100644 platform/vs/syncd-vs.mk diff --git a/platform/vs/README.md b/platform/vs/README.md new file mode 100644 index 000000000000..a7ec58856124 --- /dev/null +++ b/platform/vs/README.md @@ -0,0 +1,17 @@ +HOWTO Use Virtual Switch + + +1. Create a docker with 32 front panel port + +``` +docker run -id --name sw debian bash +sudo ./create_vnet.sh sw +``` + +2. Create sonic virtual switch docker + +``` +docker run --privileged --network container:sw -d docker-sonic-vs +``` + +3. Run test in virtual switch docker (TBD) diff --git a/platform/vs/create_vnet.sh b/platform/vs/create_vnet.sh new file mode 100755 index 000000000000..857a61b52cc5 --- /dev/null +++ b/platform/vs/create_vnet.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +SWNAME=$1 + +pid=$(docker inspect --format '{{.State.Pid}}' $SWNAME) + +echo Seting up servers + +SERVERS=31 + +for srv in `seq 0 $SERVERS`; do + + SRV="$SWNAME-srv$srv" + + NSS="ip netns exec $SRV" + + ip netns add $SRV + + $NSS ip addr add 127.0.0.1/8 dev lo + $NSS ip addr add ::1/128 dev lo + $NSS ip link set dev lo up + + # add virtual link between neighbor and the virtual switch docker + + IF="vEthernet$((srv*4))" + + ip link add ${SRV}eth0 type veth peer name $IF + ip link set ${SRV}eth0 netns $SRV + ip link set $IF netns ${pid} + + echo "Bring ${SRV}eth0 up" + $NSS ip link set dev ${SRV}eth0 name eth0 + $NSS ip link set dev eth0 up + + echo "Bring $IF up in the virtual switch docker" + nsenter -t $pid -n ip link set dev $IF up + +done diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk new file mode 100644 index 000000000000..b52965787149 --- /dev/null +++ b/platform/vs/docker-sonic-vs.mk @@ -0,0 +1,16 @@ +# docker image for virtual switch based sonic docker image + +DOCKER_SONIC_VS = docker-sonic-vs.gz +$(DOCKER_SONIC_VS)_PATH = $(PLATFORM_PATH)/docker-sonic-vs +$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) $(SYNCD_VS) $(REDIS_SERVER) $(REDIS_TOOLS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_DEVICE_DATA) + +ifeq ($(SONIC_ROUTING_STACK), quagga) +$(DOCKER_SONIC_VS)_DEPENDS += $(QUAGGA) +else ifeq ($(SONIC_ROUTING_STACK), frr) +$(DOCKER_SONIC_VS)_DEPENDS += $(FRR) +else +$(DOCKER_SONIC_VS)_DEPENDS += $(GOBGP) +endif + +$(DOCKER_SONIC_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_VS) diff --git a/platform/vs/docker-sonic-vs/50-default.conf b/platform/vs/docker-sonic-vs/50-default.conf new file mode 100644 index 000000000000..d672d83af789 --- /dev/null +++ b/platform/vs/docker-sonic-vs/50-default.conf @@ -0,0 +1,68 @@ +# Default rules for rsyslog. +# +# For more information see rsyslog.conf(5) and /etc/rsyslog.conf + +# +# First some standard log files. Log by facility. +# +auth,authpriv.* /var/log/auth.log +*.*;auth,authpriv.none -/var/log/syslog +#cron.* /var/log/cron.log +#daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +#lpr.* -/var/log/lpr.log +mail.* -/var/log/mail.log +#user.* -/var/log/user.log + +# +# Logging for the mail system. Split it up so that +# it is easy to write scripts to parse these files. +# +#mail.info -/var/log/mail.info +#mail.warn -/var/log/mail.warn +mail.err /var/log/mail.err + +# +# Logging for INN news system. +# +news.crit /var/log/news/news.crit +news.err /var/log/news/news.err +news.notice -/var/log/news/news.notice + +# +# Some "catch-all" log files. +# +#*.=debug;\ +# auth,authpriv.none;\ +# news.none;mail.none -/var/log/debug +#*.=info;*.=notice;*.=warn;\ +# auth,authpriv.none;\ +# cron,daemon.none;\ +# mail,news.none -/var/log/messages + +# +# Emergencies are sent to everybody logged in. +# +*.emerg :omusrmsg:* + +# +# I like to have messages displayed on the console, but only on a virtual +# console I usually leave idle. +# +#daemon,mail.*;\ +# news.=crit;news.=err;news.=notice;\ +# *.=debug;*.=info;\ +# *.=notice;*.=warn /dev/tty8 + +# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, +# you must invoke `xconsole' with the `-file' option: +# +# $ xconsole -file /dev/xconsole [...] +# +# NOTE: adjust the list below, or you'll go crazy if you have a reasonably +# busy site.. +# +daemon.*;mail.*;\ + news.err;\ + *.=debug;*.=info;\ + *.=notice;*.=warn |/dev/xconsole diff --git a/platform/vs/docker-sonic-vs/Dockerfile b/platform/vs/docker-sonic-vs/Dockerfile new file mode 100644 index 000000000000..2a75868cd99d --- /dev/null +++ b/platform/vs/docker-sonic-vs/Dockerfile @@ -0,0 +1,51 @@ +FROM docker-config-engine + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +RUN apt-get install -y net-tools \ + ethtool \ + tcpdump \ + ifupdown \ + bridge-utils \ + python-ply \ + libqt5core5a \ + libqt5network5 \ + libboost-program-options1.55.0 \ + libboost-system1.55.0 \ + libboost-thread1.55.0 \ + libgmp10 \ + libjudydebian1 \ + libnanomsg0 \ + libdaemon0 \ + libjansson4 \ + libjemalloc1 \ + openssh-client \ + openssh-server \ + libc-ares2 \ + iproute + +COPY \ +debs/libnl-route-3-200_3.2.27-1_amd64.deb debs/libnl-genl-3-200_3.2.27-1_amd64.deb debs/libnl-nf-3-200_3.2.27-1_amd64.deb debs/libhiredis0.13_0.13.3-2_amd64.deb debs/libnl-3-200_3.2.27-1_amd64.deb debs/libnl-cli-3-200_3.2.27-1_amd64.deb debs/libswsscommon_1.0.0_amd64.deb debs/libsairedis_1.0.0_amd64.deb debs/libsaimetadata_1.0.0_amd64.deb debs/libteam5_1.26-1_amd64.deb debs/libsaivs_1.0.0_amd64.deb debs/swss_1.0.0_amd64.deb debs/syncd-vs_1.0.0_amd64.deb debs/redis-server_3.2.4-1~bpo8+1_amd64.deb debs/redis-tools_3.2.4-1~bpo8+1_amd64.deb debs/libteamdctl0_1.26-1_amd64.deb debs/libteam-utils_1.26-1_amd64.deb debs/sonic-device-data_1.0-1_all.deb debs/quagga_0.99.24.1-2.1_amd64.deb debs/ + +RUN dpkg -i \ +debs/libnl-route-3-200_3.2.27-1_amd64.deb debs/libnl-genl-3-200_3.2.27-1_amd64.deb debs/libnl-nf-3-200_3.2.27-1_amd64.deb debs/libhiredis0.13_0.13.3-2_amd64.deb debs/libnl-3-200_3.2.27-1_amd64.deb debs/libnl-cli-3-200_3.2.27-1_amd64.deb debs/libswsscommon_1.0.0_amd64.deb debs/libsairedis_1.0.0_amd64.deb debs/libsaimetadata_1.0.0_amd64.deb debs/libteam5_1.26-1_amd64.deb debs/libsaivs_1.0.0_amd64.deb debs/swss_1.0.0_amd64.deb debs/syncd-vs_1.0.0_amd64.deb debs/redis-server_3.2.4-1~bpo8+1_amd64.deb debs/redis-tools_3.2.4-1~bpo8+1_amd64.deb debs/libteamdctl0_1.26-1_amd64.deb debs/libteam-utils_1.26-1_amd64.deb debs/sonic-device-data_1.0-1_all.deb debs/quagga_0.99.24.1-2.1_amd64.deb + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +RUN sed -ri 's/^daemonize yes$/daemonize no/; \ + s/^logfile .*$/logfile ""/; \ + s/^# syslog-enabled no$/syslog-enabled no/; \ + s/^# unixsocket/unixsocket/ \ + ' /etc/redis/redis.conf + +COPY ["50-default.conf", "/etc/rsyslog.d/"] +COPY ["start.sh", "orchagent.sh", "/usr/bin/"] +COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 new file mode 100644 index 000000000000..f6e784017f78 --- /dev/null +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -0,0 +1,56 @@ +FROM docker-config-engine + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +RUN apt-get install -y net-tools \ + ethtool \ + tcpdump \ + ifupdown \ + bridge-utils \ + python-ply \ + libqt5core5a \ + libqt5network5 \ + libboost-program-options1.55.0 \ + libboost-system1.55.0 \ + libboost-thread1.55.0 \ + libgmp10 \ + libjudydebian1 \ + libnanomsg0 \ + libdaemon0 \ + libjansson4 \ + libjemalloc1 \ + openssh-client \ + openssh-server \ + libc-ares2 \ + iproute + +COPY \ +{% for deb in docker_sonic_vs_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_sonic_vs_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +RUN sed -ri 's/^daemonize yes$/daemonize no/; \ + s/^logfile .*$/logfile ""/; \ + s/^# syslog-enabled no$/syslog-enabled no/; \ + s/^# unixsocket/unixsocket/ \ + ' /etc/redis/redis.conf + +COPY ["50-default.conf", "/etc/rsyslog.d/"] +COPY ["start.sh", "orchagent.sh", "/usr/bin/"] +COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/vs/docker-sonic-vs/brcm.profile.ini b/platform/vs/docker-sonic-vs/brcm.profile.ini new file mode 100644 index 000000000000..23cd24c73a35 --- /dev/null +++ b/platform/vs/docker-sonic-vs/brcm.profile.ini @@ -0,0 +1,4 @@ +SAI_WARM_BOOT_READ_FILE=/var/cache/sai_warmboot.bin +SAI_WARM_BOOT_WRITE_FILE=/var/cache/sai_warmboot.bin +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850 +SAI_VS_HOSTIF_USE_TAP_DEVICE=true diff --git a/platform/vs/docker-sonic-vs/orchagent.sh b/platform/vs/docker-sonic-vs/orchagent.sh new file mode 100755 index 000000000000..7e250dfa20e9 --- /dev/null +++ b/platform/vs/docker-sonic-vs/orchagent.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` + +# Create a folder for SsWW record files +mkdir -p /var/log/swss +ORCHAGENT_ARGS="-d /var/log/swss " + +# Set orchagent pop batch size to 8192 +ORCHAGENT_ARGS+="-b 8192 " + +# Set mac address +ORCHAGENT_ARGS+="-m $MAC_ADDRESS" + +exec /usr/bin/orchagent ${ORCHAGENT_ARGS} diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh new file mode 100755 index 000000000000..26633c24a70b --- /dev/null +++ b/platform/vs/docker-sonic-vs/start.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +mkdir -p /etc/swss/config.d/ + +# sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json +# sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json +# sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json + +# export platform=`sonic-cfggen -v platform` + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +mkdir -p /var/run/redis + +supervisorctl start redis-server + +supervisorctl start syncd + +supervisorctl start orchagent + +supervisorctl start portsyncd + +supervisorctl start intfsyncd + +supervisorctl start neighsyncd + +# Start arp_update when VLAN exists +# VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` +# if [ "$VLAN" != "" ]; then +# supervisorctl start arp_update +# fi diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf new file mode 100644 index 000000000000..35c56420b463 --- /dev/null +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -0,0 +1,68 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:redis-server] +command=/usr/bin/redis-server /etc/redis/redis.conf +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd -uN -p /usr/share/sonic/device/vswitch/brcm.profile.ini +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:orchagent] +command=/usr/bin/orchagent.sh +priority=5 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:portsyncd] +command=/usr/bin/portsyncd -p /usr/share/sonic/device/x86_64-dell_s6000_s1220-r0/Force10-S6000/port_config.ini +priority=6 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:intfsyncd] +command=/usr/bin/intfsyncd +priority=7 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:neighsyncd] +command=/usr/bin/neighsyncd +priority=8 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/platform/vs/rules.mk b/platform/vs/rules.mk new file mode 100644 index 000000000000..28dba54a5a4e --- /dev/null +++ b/platform/vs/rules.mk @@ -0,0 +1,4 @@ +include $(PLATFORM_PATH)/syncd-vs.mk +include $(PLATFORM_PATH)/docker-sonic-vs.mk + +SONIC_ALL += $(DOCKER_SONIC_VS) diff --git a/platform/vs/syncd-vs.mk b/platform/vs/syncd-vs.mk new file mode 100644 index 000000000000..49035aaf958b --- /dev/null +++ b/platform/vs/syncd-vs.mk @@ -0,0 +1,13 @@ +$(LIBSAIREDIS)_DPKG_TARGET = binary-syncd-vs + +# inject libsaivs and libsaivs_dev to swss build dependency +$(SWSS)_DEPENDS += $(LIBSAIVS) $(LIBSAIVS_DEV) + +SYNCD_VS = syncd-vs_1.0.0_amd64.deb +$(SYNCD_VS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBSAIVS) +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_VS))) + +SYNCD_VS_DBG = syncd-vs-dbg_1.0.0_amd64.deb +$(SYNCD_VS_DBG)_DEPENDS += $(SYNCD_VS) +$(SYNCD_VS_DBG)_RDEPENDS += $(SYNCD_VS) +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_VS_DBG))) diff --git a/rules/sairedis.mk b/rules/sairedis.mk index 4a62954f4d1c..760d75c5a611 100644 --- a/rules/sairedis.mk +++ b/rules/sairedis.mk @@ -9,6 +9,13 @@ SONIC_DPKG_DEBS += $(LIBSAIREDIS) LIBSAIREDIS_DEV = libsairedis-dev_1.0.0_amd64.deb $(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIREDIS_DEV))) +LIBSAIVS = libsaivs_1.0.0_amd64.deb +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIVS))) + +LIBSAIVS_DEV = libsaivs-dev_1.0.0_amd64.deb +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIVS_DEV))) + +ifneq ($(CONFIGURED_PLATFORM),vs) SYNCD = syncd_1.0.0_amd64.deb $(SYNCD)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD))) @@ -16,6 +23,7 @@ $(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD))) SYNCD_RPC = syncd-rpc_1.0.0_amd64.deb $(SYNCD_RPC)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_RPC))) +endif LIBSAIMETADATA = libsaimetadata_1.0.0_amd64.deb $(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA))) @@ -29,6 +37,12 @@ $(LIBSAIREDIS_DBG)_DEPENDS += $(LIBSAIREDIS) $(LIBSAIREDIS_DBG)_RDEPENDS += $(LIBSAIREDIS) $(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIREDIS_DBG))) +LIBSAIVS_DBG = libsaivs-dbg_1.0.0_amd64.deb +$(LIBSAIVS_DBG)_DEPENDS += $(LIBSAIVS) +$(LIBSAIVS_DBG)_RDEPENDS += $(LIBSAIVS) +$(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIVS_DBG))) + +ifneq ($(CONFIGURED_PLATFORM),vs) SYNCD_DBG = syncd-dbg_1.0.0_amd64.deb $(SYNCD_DBG)_DEPENDS += $(SYNCD) $(SYNCD_DBG)_RDEPENDS += $(SYNCD) @@ -38,6 +52,7 @@ SYNCD_RPC_DBG = syncd-rpc-dbg_1.0.0_amd64.deb $(SYNCD_RPC_DBG)_DEPENDS += $(SYNCD_RPC) $(SYNCD_RPC_DBG)_RDEPENDS += $(SYNCD_RPC) $(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_RPC_DBG))) +endif LIBSAIMETADATA_DBG = libsaimetadata-dbg_1.0.0_amd64.deb $(LIBSAIMETADATA_DBG)_DEPENDS += $(LIBSAIMETADATA) diff --git a/slave.mk b/slave.mk index bbcdf4bc3599..114491b2f6b8 100644 --- a/slave.mk +++ b/slave.mk @@ -203,7 +203,10 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a # Build project pushd $($*_SRC_PATH) $(LOG) [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) + $(if $($*_DPKG_TARGET), + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG), + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) + ) popd $(LOG) # Clean up if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi diff --git a/src/sonic-sairedis b/src/sonic-sairedis index e4d24276cb6f..f5d9c8364f5f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit e4d24276cb6fc7122f756c637f30ddea27487c70 +Subproject commit f5d9c8364f5fbcc487a5f1a3e3e6203ab2293a83 diff --git a/src/sonic-swss b/src/sonic-swss index bcdea1323e70..e07d86b100cc 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit bcdea1323e70c73fa0a85c6df55eaed886bded81 +Subproject commit e07d86b100ccefe8b51e2c41b543cc93f33a0f13 From 8b8b8a130f4018069314b39f37c89301543f2c5f Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 24 Oct 2017 10:56:09 -0700 Subject: [PATCH 0864/1833] [cfg engine] Separate portconfig.py as individual module for port_config.ini parsing (#1072) Move port_config.ini related parsing code out of minigraph.py and create an independent portconfig.py. Add support to multiple optional fields according to Porting Guide --- src/sonic-config-engine/minigraph.py | 62 +++---------------- src/sonic-config-engine/portconfig.py | 54 ++++++++++++++++ src/sonic-config-engine/setup.py | 2 +- .../tests/sample_output/table_everflow.json | 2 +- src/sonic-config-engine/tests/test_cfggen.py | 2 +- 5 files changed, 64 insertions(+), 58 deletions(-) create mode 100644 src/sonic-config-engine/portconfig.py diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 2cb1c89981e1..3e1e603e6412 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -12,27 +12,13 @@ from lxml import etree as ET from lxml.etree import QName -DOCUMENTATION = ''' ---- -module: minigraph_facts +from portconfig import get_port_config + +"""minigraph.py version_added: "1.9" author: Guohan Lu (gulv@microsoft.com) -short_description: Retrive minigraph facts for a device. -description: - - Retrieve minigraph facts for a device, the facts will be - inserted to the ansible_facts key. -options: - host: - description: - - Set to target snmp server (normally {{inventory_hostname}}) - required: true -''' - -EXAMPLES = ''' -# Gather minigraph facts -- name: Gathering minigraph facts about the device - minigraph_facts: host={{ hostname }} -''' +short_description: Parse minigraph xml file and device description xml file +""" ns = "Microsoft.Search.Autopilot.Evolution" ns1 = "http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" @@ -319,40 +305,6 @@ def parse_deviceinfo(meta, hwsku): ethernet_interfaces[port_alias_map.get(alias, alias)] = speed return ethernet_interfaces -def parse_port_config(hwsku, platform=None, port_config_file=None): - port_config_candidates = [] - if port_config_file != None: - port_config_candidates.append(port_config_file) - port_config_candidates.append('/usr/share/sonic/hwsku/port_config.ini') - if platform != None: - port_config_candidates.append(os.path.join('/usr/share/sonic/device', platform, hwsku, 'port_config.ini')) - port_config_candidates.append(os.path.join('/usr/share/sonic/platform', hwsku, 'port_config.ini')) - port_config_candidates.append(os.path.join('/usr/share/sonic', hwsku, 'port_config.ini')) - port_config = None - for candidate in port_config_candidates: - if os.path.isfile(candidate): - port_config = candidate - break - if port_config == None: - return None - - ports = {} - with open(port_config) as data: - for line in data: - if line.startswith('#'): - continue - tokens = line.split() - if len(tokens) < 2: - continue - name = tokens[0].strip() - if len(tokens) == 2: - alias = name - else: - alias = tokens[2].strip() - ports[name] = {'alias': alias} - port_alias_map[alias] = name - return ports - def parse_xml(filename, platform=None, port_config_file=None): root = ET.parse(filename).getroot() mini_graph_path = filename @@ -389,8 +341,8 @@ def parse_xml(filename, platform=None, port_config_file=None): if child.tag == str(hostname_qn): hostname = child.text - ports = parse_port_config(hwsku, platform, port_config_file) - + (ports, alias_map) = get_port_config(hwsku, platform, port_config_file) + port_alias_map.update(alias_map) for child in root: if child.tag == str(QName(ns, "DpgDec")): (intfs, lo_intfs, mgmt_intf, vlans, pcs, acls) = parse_dpg(child, hostname) diff --git a/src/sonic-config-engine/portconfig.py b/src/sonic-config-engine/portconfig.py new file mode 100644 index 000000000000..db2baa308174 --- /dev/null +++ b/src/sonic-config-engine/portconfig.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +import os +import sys + + +def get_port_config_file_name(hwsku=None, platform=None): + port_config_candidates = [] + port_config_candidates.append('/usr/share/sonic/hwsku/port_config.ini') + if hwsku: + if platform: + port_config_candidates.append(os.path.join('/usr/share/sonic/device', platform, hwsku, 'port_config.ini')) + port_config_candidates.append(os.path.join('/usr/share/sonic/platform', hwsku, 'port_config.ini')) + port_config_candidates.append(os.path.join('/usr/share/sonic', hwsku, 'port_config.ini')) + for candidate in port_config_candidates: + if os.path.isfile(candidate): + return candidate + return None + + +def get_port_config(hwsku=None, platform=None, port_config_file=None): + if not port_config_file: + port_config_file = get_port_config_file_name(hwsku, platform) + if not port_config_file: + return ({}, {}) + return parse_port_config_file(port_config_file) + + +def parse_port_config_file(port_config_file): + ports = {} + port_alias_map = {} + # Default column definition + titles = ['name', 'lanes', 'alias', 'index'] + with open(port_config_file) as data: + for line in data: + if line.startswith('#'): + if "name" in line: + titles = line.strip('#').split() + continue; + tokens = line.split() + if len(tokens) < 2: + continue + name_index = titles.index('name') + name = tokens[name_index] + data = {} + for i, item in enumerate(tokens): + if i == name_index: + continue + data[titles[i]] = item + data.setdefault('alias', name) + ports[name] = data + port_alias_map[data['alias']] = name + return (ports, port_alias_map) + + diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index ac4eb16b30e1..1bb597f395f6 100755 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -15,7 +15,7 @@ def get_test_suite(): author='Taoyu Li', author_email='taoyl@microsoft.com', url='https://github.com/Azure/sonic-buildimage', - py_modules=['minigraph', 'openconfig_acl', 'sonic_platform'], + py_modules=['portconfig', 'minigraph', 'openconfig_acl', 'sonic_platform'], scripts=['sonic-cfggen', 'translate_acl'], install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind'], test_suite='setup.get_test_suite', diff --git a/src/sonic-config-engine/tests/sample_output/table_everflow.json b/src/sonic-config-engine/tests/sample_output/table_everflow.json index 9686f8e3890d..a4ad52bfe553 100644 --- a/src/sonic-config-engine/tests/sample_output/table_everflow.json +++ b/src/sonic-config-engine/tests/sample_output/table_everflow.json @@ -2,7 +2,7 @@ { "ACL_TABLE:EVERFLOW":{ "policy_desc":"everflow", - "ports":"Ethernet24,Ethernet40,Ethernet20,Ethernet44,Ethernet48,Ethernet28,Ethernet96,Ethernet92,Ethernet76,Ethernet116,Ethernet72,Ethernet112,Ethernet52,Ethernet108,Ethernet56,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet120,Ethernet8,Ethernet4,Ethernet0,Ethernet124,Ethernet68,Ethernet84,Ethernet100,Ethernet80,Ethernet60,Ethernet104,Ethernet64,Ethernet88", + "ports":"Ethernet24,Ethernet40,Ethernet20,Ethernet44,Ethernet48,Ethernet28,Ethernet96,Ethernet92,Ethernet76,Ethernet116,Ethernet72,Ethernet112,Ethernet52,Ethernet80,Ethernet56,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet60,Ethernet8,Ethernet4,Ethernet0,Ethernet64,Ethernet68,Ethernet84,Ethernet88,Ethernet108,Ethernet120,Ethernet104,Ethernet124,Ethernet100", "type":"mirror" }, "OP":"SET" diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 91d14a043042..57172af97c39 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -128,4 +128,4 @@ 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(), "{'alias': 'fortyGigE0/8', 'speed': '40000'}") + self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'speed': '40000'}") From 1b20ea1680e7f781467e2c825f5420899ba7ef38 Mon Sep 17 00:00:00 2001 From: paavaanan Date: Wed, 25 Oct 2017 01:27:20 +0530 Subject: [PATCH 0865/1833] [Dell]: Added support for S6100 sfputil.py (#1073) Check SFP Presence, toggling lpmode, reset, and print eeprom details --- .../plugins/sfputil.py | 442 +++++++++++++++++- 1 file changed, 424 insertions(+), 18 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py index 534e587ae722..d6fbcbcf6944 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py @@ -1,27 +1,433 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# +# +-i2c----+--------+ +# | 6 | 7 | +# | +-------------+ | +# | |IOM1 | IOM3 | | +# | |IOM2 | IOM4 | | +# | +-------------+ | +# | 8 | 9 | +# +--------+--------+ + try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") + import time + import os + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 63 + PORTS_IN_BLOCK = 64 + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0: [6, 18, 34, 50, 66], + 1: [6, 19, 35, 51, 67], + 2: [6, 20, 36, 52, 68], + 3: [6, 21, 37, 53, 69], + 4: [6, 22, 38, 54, 70], + 5: [6, 23, 39, 55, 71], + 6: [6, 24, 40, 56, 72], + 7: [6, 25, 41, 57, 73], + 8: [6, 26, 42, 58, 74], + 9: [6, 27, 43, 59, 75], + 10: [6, 28, 44, 60, 76], + 11: [6, 29, 45, 61, 77], + 12: [6, 30, 46, 62, 78], + 13: [6, 31, 47, 63, 79], + 14: [6, 32, 48, 64, 80], + 15: [6, 33, 49, 65, 81], + 16: [8, 18, 34, 50, 66], + 17: [8, 19, 35, 51, 67], + 18: [8, 20, 36, 52, 68], + 19: [8, 21, 37, 53, 69], + 20: [8, 22, 38, 54, 70], + 21: [8, 23, 39, 55, 71], + 22: [8, 24, 40, 56, 72], + 23: [8, 25, 41, 57, 73], + 24: [8, 26, 42, 58, 74], + 25: [8, 27, 43, 59, 75], + 26: [8, 28, 44, 60, 76], + 27: [8, 29, 45, 61, 77], + 28: [8, 30, 46, 62, 78], + 29: [8, 31, 47, 63, 79], + 30: [8, 32, 48, 64, 80], + 31: [8, 33, 49, 65, 81], + 32: [7, 18, 34, 50, 66], + 33: [7, 19, 35, 51, 67], + 34: [7, 20, 36, 52, 68], + 35: [7, 21, 37, 53, 69], + 36: [7, 22, 38, 54, 70], + 37: [7, 23, 39, 55, 71], + 38: [7, 24, 40, 56, 72], + 39: [7, 25, 41, 57, 73], + 40: [7, 26, 42, 58, 74], + 41: [7, 27, 43, 59, 75], + 42: [7, 28, 44, 60, 76], + 43: [7, 29, 45, 61, 77], + 44: [7, 30, 46, 62, 78], + 45: [7, 31, 47, 63, 79], + 46: [7, 32, 48, 64, 80], + 47: [7, 33, 49, 65, 81], + 48: [9, 18, 34, 50, 66], + 49: [9, 19, 35, 51, 67], + 50: [9, 20, 36, 52, 68], + 51: [9, 21, 37, 53, 69], + 52: [9, 22, 38, 54, 70], + 53: [9, 23, 39, 55, 71], + 54: [9, 24, 40, 56, 72], + 55: [9, 25, 41, 57, 73], + 56: [9, 26, 42, 58, 74], + 57: [9, 27, 43, 59, 75], + 58: [9, 28, 44, 60, 76], + 59: [9, 29, 45, 61, 77], + 60: [9, 30, 46, 62, 78], + 61: [9, 31, 47, 63, 79], + 62: [9, 32, 48, 64, 80], + 63: [9, 33, 49, 65, 81] +} + + IOM_1_PORT_START = 0 + IOM_1_PORT_END = 15 + + IOM_2_PORT_START = 16 + IOM_2_PORT_END = 31 + + IOM_3_PORT_START = 32 + IOM_3_PORT_END = 47 + + IOM_4_PORT_START = 48 + IOM_4_PORT_END = 63 + + BASE_VAL_PATH="/sys/class/i2c-adapter/i2c-{0}/{0}-003e/" + + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def iom1_port_start(self): + return self.IOM_1_PORT_START + + @property + def iom1_port_end(self): + return self.IOM_1_PORT_END + + @property + def iom2_port_start(self): + return self.IOM_2_PORT_START + + @property + def iom2_port_end(self): + return self.IOM_2_PORT_END + + @property + def iom3_port_start(self): + return self.IOM_3_PORT_START + + @property + def iom3_port_end(self): + return self.IOM_3_PORT_END + + @property + def iom4_port_start(self): + return self.IOM_4_PORT_START + + @property + def iom4_port_end(self): + return self.IOM_4_PORT_END + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + @property + def port_to_i2c_mapping(self): + return self._port_to_i2c_mapping + + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/i2c-{1}/{1}-0050/eeprom" + global port_to_eeprom_path + + for port_num in range(0, self.port_end + 1): + if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: + assigned=0 + #i2c-6 + for x in range(1,5): + port_to_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) + if ( os.path.isfile(port_to_eeprom_path) ): + self.port_to_eeprom_mapping[port_num]=port_to_eeprom_path + assigned=1 + elif (not assigned): + self.port_to_eeprom_mapping[port_num]="No IOM" + + elif port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: + assigned=0 + #i2c-8 + for x in range(1,5): + port_to_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) + if ( os.path.isfile(port_to_eeprom_path) ): + self.port_to_eeprom_mapping[port_num]=port_to_eeprom_path + assigned=1 + elif (not assigned): + self.port_to_eeprom_mapping[port_num]="No IOM" + + elif port_num >= self.iom3_port_start and port_num <= self.iom3_port_end: + assigned=0 + #i2c-7 + for x in range(1,5): + port_to_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) + if ( os.path.isfile(port_to_eeprom_path) ): + self.port_to_eeprom_mapping[port_num]=port_to_eeprom_path + assigned=1 + elif (not assigned): + self.port_to_eeprom_mapping[port_num]="No IOM" + + + elif port_num >= self.iom4_port_start and port_num <= self.iom4_port_end: + assigned=0 + #i2c-9 + for x in range(1,5): + port_to_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[port_num][0], self.port_to_i2c_mapping[port_num][x]) + if ( os.path.isfile(port_to_eeprom_path) ): + self.port_to_eeprom_mapping[port_num]=port_to_eeprom_path + assigned=1 + elif (not assigned): + self.port_to_eeprom_mapping[port_num]="No IOM" + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + + global i2c_line + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + #port_num and i2c match + if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: + i2c_line=14 + elif port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: + i2c_line=16 + elif port_num >= self.iom3_port_start and port_num <= self.iom3_port_end: + i2c_line=15 + elif port_num >= self.iom4_port_start and port_num <= self.iom4_port_end: + i2c_line=17 + + try: + qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_modprs" + reg_file = open(qsfp_path, "r") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + #Absence of IOM throws read error + if (content == 'read error'): + return False + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + #Rationalize port settings + if port_num > 15: + port_num=port_num%16 + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + #port_num and i2c match + if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: + i2c_line=14 + elif port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: + i2c_line=16 + elif port_num >= self.iom3_port_start and port_num <= self.iom3_port_end: + i2c_line=15 + elif port_num >= self.iom4_port_start and port_num <= self.iom4_port_end: + i2c_line=17 + + try: + qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" + reg_file = open(qsfp_path, "r") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + #Absence of IOM throws read error + if (content == 'read error'): + return False + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + #Rationalize port settings + if port_num > 15: + port_num=port_num%16 + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + #port_num and i2c match + if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: + i2c_line=14 + elif port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: + i2c_line=16 + elif port_num >= self.iom3_port_start and port_num <= self.iom3_port_end: + i2c_line=15 + elif port_num >= self.iom4_port_start and port_num <= self.iom4_port_end: + i2c_line=17 + + try: + qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" + reg_file = open(qsfp_path, "r+") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + #Absence of IOM throws read error + if (content == 'read error'): + return False + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + #Rationalize port settings + if port_num > 15: + port_num=port_num%16 + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + + global i2c_line + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + #port_num and i2c match + if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: + i2c_line=14 + elif port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: + i2c_line=16 + elif port_num >= self.iom3_port_start and port_num <= self.iom3_port_end: + i2c_line=15 + elif port_num >= self.iom4_port_start and port_num <= self.iom4_port_end: + i2c_line=17 + + try: + qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" + reg_file = open(qsfp_path, "r+") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + #Absence of IOM throws read error + if (content == 'read error'): + print("it's empty"); + return False + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + #Rationalize port settings + if port_num > 15: + port_num=port_num%16 + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + # ResetL is active low + reg_value = reg_value & ~mask -class sfputil(sfputilbase): - """Platform specific sfputil class""" + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() - port_start = 0 - port_end = 63 - ports_in_block = 64 + # Sleep 1 second to allow it to settle + time.sleep(1) - eeprom_offset = 18 + # Flip the bit back high and write back to the register to take port out of reset + try: + qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" + reg_file = open(qsfp_path, "w") - port_to_eeprom_mapping = {} + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False - _qsfp_ports = range(0, ports_in_block + 1) + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' - for x in range(0, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format(x + self.eeprom_offset) - sfputilbase.__init__(self, port_num) + return True From d7d6f3044fd06222c7d5ad6f6a00fd749fe87559 Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Tue, 24 Oct 2017 13:01:33 -0700 Subject: [PATCH 0866/1833] [Dell]: Update sonic-platform-modules-dell submodule Add eeprom driver for only valid devices Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sonic-platform-modules-dell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 8c330a508f78..f0e808fe518f 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 8c330a508f7860082ed4f6259fe8df4c5b4c9c92 +Subproject commit f0e808fe518f336e4cb97fdaf25e35a752c24d89 From 41f226f0dc9e73e2bbb3060661aeb7322fb0f43b Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 24 Oct 2017 19:49:37 -0700 Subject: [PATCH 0867/1833] [build] capture 2 initialization git commands in 'make init' target (#1074) --- Makefile | 6 +++++- README.md | 13 +++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index b5bd895b37ad..bf9e0da0c76a 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ SONIC_BUILD_INSTRUCTION := make \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) -.PHONY: sonic-slave-build sonic-slave-bash +.PHONY: sonic-slave-build sonic-slave-bash init .DEFAULT_GOAL := all @@ -89,3 +89,7 @@ sonic-slave-bash : { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash + +init : + git submodule update --init --recursive + git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' diff --git a/README.md b/README.md index 5edaf3ae7f89..53e8b8ff221a 100644 --- a/README.md +++ b/README.md @@ -25,19 +25,16 @@ To clone the code repository recursively, assuming git version 1.9 or newer: git clone --recursive https://github.com/Azure/sonic-buildimage.git -NOTE: If the repo has already been cloned, however there are no files under the submodule directories (e.g., src/lldpd, src/ptf, src/sonic-linux-kernel, etc.), you can manually fetch all the git submodules as follows: - - git submodule update --init --recursive - -You also need to change all git paths to relative path as we build all submodules inside the docker: - - git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $(realpath --relative-to=. $(cut -d" " -f2 .git))" > .git' - ## Usage To build SONiC installer image and docker images, run the following commands: + # Execute make init once after cloning the repo, or fetched remote repo with submodule updates + make init + + # Execute make configure once to configure ASIC make configure PLATFORM=[ASIC_VENDOR] + make **NOTE**: We recommend reserving 50G free space to build one platform. From a31c08047bbdb6cb5526f82ec37230275d27a4da Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 25 Oct 2017 05:06:30 -0700 Subject: [PATCH 0868/1833] [build]: add sonic-config-engine to sonic-utilitie build dependency (#1075) --- rules/sonic-utilities.mk | 1 + slave.mk | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 9349813f5c4e..7a935ba70ede 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -2,4 +2,5 @@ SONIC_UTILS = python-sonic-utilities_1.1-1_all.deb $(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities +$(SONIC_UTILS)_WHEEL_DEPENDS = $(SONIC_CONFIG_ENGINE) SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS) diff --git a/slave.mk b/slave.mk index 114491b2f6b8..6f823cf98340 100644 --- a/slave.mk +++ b/slave.mk @@ -222,7 +222,8 @@ SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) # $(SOME_NEW_DEB)_SRC_PATH = $(SRC_PATH)/project_name # $(SOME_NEW_DEB)_DEPENDS = $(SOME_OTHER_DEB1) $(SOME_OTHER_DEB2) ... # SONIC_PYTHON_STDEB_DEBS += $(SOME_NEW_DEB) -$(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) +$(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) \ + $$(addsuffix -install,$$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*_WHEEL_DEPENDS))) $(HEADER) # Apply series of patches if exist if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi From 2ae29caa035d7e8841fe9539b6b3b293351a0e53 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 25 Oct 2017 19:09:30 +0300 Subject: [PATCH 0869/1833] Update QoS config name for Mellanox platform (#1077) Signed-off-by: Andriy Moroz --- dockers/docker-orchagent/swssconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 55a22c5353c8..f780ae8afb20 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -49,7 +49,7 @@ elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [[ "$HWSKU" == "ACS-MSN27"* ]]; then sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json - SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json msn2700.32ports.qos.json " + SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json msn27xx.32ports.qos.json " fi for file in $SWSSCONFIG_ARGS; do From 47c8567d93ccebda00959acfa4246cc42c58e2c2 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 25 Oct 2017 16:43:43 -0700 Subject: [PATCH 0870/1833] [snmp]: Update sonic-snmpagent submodule (#1078) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index d9d85a1383d7..5e00a50cf397 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit d9d85a1383d752220054a714487899c06b697863 +Subproject commit 5e00a50cf397693808e1ccc7371a043d8d53cdab From 7f7ddc80a33851f4ea2e9aec942a4172fc9ab4e6 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 25 Oct 2017 17:57:28 -0700 Subject: [PATCH 0871/1833] [swss]: Change the env name from ASIC to platform (#1033) --- dockers/docker-orchagent/orchagent.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 57f28e4e78dc..f92dfe5fd543 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -2,9 +2,7 @@ # Export platform information. Required to be able to write # vendor specific code. -export platform=`sonic-cfggen -v onie_switch_asic` - -export ASIC=`sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type` +export platform=`sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type` MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` @@ -16,9 +14,9 @@ ORCHAGENT_ARGS="-d /var/log/swss " ORCHAGENT_ARGS+="-b 8192 " # Add platform specific arguments if necessary -if [ "$ASIC" == "broadcom" ]; then +if [ "$platform" == "broadcom" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" -elif [ "$ASIC" == "cavium" ]; then +elif [ "$platform" == "cavium" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" fi From 11e17e763fc8af85809dd77578800f91d031a685 Mon Sep 17 00:00:00 2001 From: Balaselvi Date: Wed, 25 Oct 2017 21:36:31 -0700 Subject: [PATCH 0872/1833] [Inventec]: Bug fix for sfputil in D7054 (#1080) --- device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py index d236146e495e..c2edefd2eb70 100755 --- a/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py @@ -95,7 +95,7 @@ def qsfp_port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): From 623e7fe93981d11619fbc175bee61c187b38345c Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 25 Oct 2017 21:37:09 -0700 Subject: [PATCH 0873/1833] [utilities]: update sonic-utilities submodule (#1076) --- .gitmodules | 1 - src/sonic-utilities | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index c837451c9480..cc2b5b416028 100644 --- a/.gitmodules +++ b/.gitmodules @@ -44,7 +44,6 @@ [submodule "src/sonic-utilities"] path = src/sonic-utilities url = https://github.com/Azure/sonic-utilities - branch = v1.0.3 [submodule "platform/broadcom/sonic-platform-modules-s6000"] path = platform/broadcom/sonic-platform-modules-s6000 url = https://github.com/Azure/sonic-platform-modules-s6000 diff --git a/src/sonic-utilities b/src/sonic-utilities index 8e20a3dc90fd..4804711c600b 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 8e20a3dc90fdfe86d3a74675c24de91b97e9d3c7 +Subproject commit 4804711c600b97c6bc5f24877b808721f91d1f84 From 3d290b96d99a504a36dae779d16823e9d52acf8b Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Thu, 26 Oct 2017 14:03:46 -0700 Subject: [PATCH 0874/1833] Submodule updated for py-swsssdk and utilities (#1083) --- src/sonic-py-swsssdk | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index a21b7a929ab6..3b074795c907 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit a21b7a929ab63f027e4a0d2f919145d8054b8011 +Subproject commit 3b074795c907a7d0afea6d337010393fe9a1509d diff --git a/src/sonic-utilities b/src/sonic-utilities index 4804711c600b..67f9f96b9a08 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 4804711c600b97c6bc5f24877b808721f91d1f84 +Subproject commit 67f9f96b9a0817aeeee8efca6e74d1729fd8d5be From d1156ca3b2b78d0803562faf5062df93c0a4fe72 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 26 Oct 2017 14:20:44 -0700 Subject: [PATCH 0875/1833] [teamd]: Bring down all member interfaces before starting teamd (#1081) teamd requires all members to be set down before adding as a team port Signed-off-by: Shu0T1an ChenG --- dockers/docker-teamd/start.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index 6b0a3d785894..6e80f6eb9a83 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -17,6 +17,12 @@ fi for pc in `sonic-cfggen -d -v "PORTCHANNEL.keys() | join(' ') if PORTCHANNEL"`; do sonic-cfggen -d -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf + # bring down all member ports before starting teamd + for member in $(sonic-cfggen -d -v "PORTCHANNEL['$pc']['members'] | join(' ')" ); do + if [ -L /sys/class/net/$member ]; then + ip link set $member down + fi + done done mkdir -p /var/sonic From 437419c79eae23e671d4648a24aa2c45941fd9ed Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 26 Oct 2017 16:49:25 -0700 Subject: [PATCH 0876/1833] Update submodule pointer and sonic-slave for test dependency (#1084) --- sonic-slave/Dockerfile | 3 +++ src/sonic-utilities | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index f194bf604caa..b66c917384af 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -223,6 +223,9 @@ RUN pip install j2cli # For sonic config engine testing RUN pip install pyangbind==0.5.10 +# For sonic utilities testing +RUN pip install click-default-group click natsort tabulate + # For supervisor build RUN pip install meld3 mock diff --git a/src/sonic-utilities b/src/sonic-utilities index 67f9f96b9a08..67f8806ce42f 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 67f9f96b9a0817aeeee8efca6e74d1729fd8d5be +Subproject commit 67f8806ce42f2511f170117d70ecfd0e8d205eb5 From 961a6669f7c896d0521b0a9bfc796330f12608fe Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 27 Oct 2017 13:59:51 -0700 Subject: [PATCH 0877/1833] [Broadcom]: Update Broadcom OpenNSL/SAI packages (#1090) Update OpenNSL to 3.2.3.3-2 Update SAI to 3.0.3.2-10 This commit fixes S6100 CPU high usage issue Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 93cf129e0cbb..5b66026f297f 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-9_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-9_amd64.deb?sv=2015-04-05&sr=b&sig=w4MY%2FMlnCe59xwMXRxODyLkaEDLEljeBlT3bPUnedoU%3D&se=2031-07-02T20%3A17%3A33Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-10_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-10_amd64.deb?sv=2015-04-05&sr=b&sig=tByZ7QDBsYlJ4UHbapnzqHYrbA8rD92%2FQXEpupITTmM%3D&se=2031-07-06T19%3A19%3A32Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-9_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-10_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-9_amd64.deb?sv=2015-04-05&sr=b&sig=zfBAMJKd0LUesg88UjDdUor%2Bc4j8omvw08MKymQQFnE%3D&se=2031-07-02T20%3A17%3A10Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-10_amd64.deb?sv=2015-04-05&sr=b&sig=T6U8sF%2BW8B%2FffBzPoUJ9peLcg2O9MunHBBKSu7SZOKo%3D&se=2031-07-06T19%3A19%3A52Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 04d540c64582..aff0cf07fe5c 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,4 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.3-1_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3-1_amd64.deb?sv=2015-04-05&sr=b&sig=Uepf4z2wOadX%2F6OR%2BCoQzjv2tkwEZ2AspBiuo5sb25s%3D&se=2031-05-30T19%3A37%3A19Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.3-2_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3-2_amd64.deb?sv=2015-04-05&sr=b&sig=RADtBDA9oZmwHnTzBY76ewajyJ8Af%2BchVCzNbe%2BPsbc%3D&se=2031-07-06T19%3A18%3A56Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) From c92b95383a661f96267dba785bdb62c0392e3735 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 27 Oct 2017 17:59:03 -0700 Subject: [PATCH 0878/1833] [build]: Add swig3.0 for building python-based swsscommon library (#1088) --- sonic-slave/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index b66c917384af..603c3b6cb357 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -200,7 +200,9 @@ RUN apt-get update && apt-get install -y \ procmail \ # For gtest libgtest-dev \ - cmake + cmake \ +# For python-based swsscommon + swig3.0 # For linux build RUN apt-get -y build-dep linux From a7ea0556c87b29e0fca4c440a1d8a59e1a8bc915 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 27 Oct 2017 18:01:02 -0700 Subject: [PATCH 0879/1833] [updategraph]: Support a special value to use empty configuration (#1086) When updategraph service is enabled, a special value 'default' from DHCP response will now initialize the system with an empty configuration instead of existing minigraph. A DHCP response without option 224 will remain the current behavior of skipping graph update and use existing default minigraph. --- files/dhcp/graphserviceurl | 2 +- files/image_config/updategraph/updategraph | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/files/dhcp/graphserviceurl b/files/dhcp/graphserviceurl index f255cdff9877..5c5d801cbc8c 100644 --- a/files/dhcp/graphserviceurl +++ b/files/dhcp/graphserviceurl @@ -3,7 +3,7 @@ case $reason in if [ -n "$new_minigraph_url" ]; then echo $new_minigraph_url > /tmp/dhcp_graph_url else - echo "N/A" > /tmp/dhcp_graph_url + echo "default" > /tmp/dhcp_graph_url fi if [ -n "$new_acl_url" ]; then echo $new_acl_url > /tmp/dhcp_acl_url diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 4e9846fba024..b72bc6e2c1c8 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -20,8 +20,25 @@ if [ "$src" = "dhcp" ]; then sleep 1 done + if [ "`cat /tmp/dhcp_graph_url`" = "default" ]; then + echo "No graph_url option in DHCP response. Skipping graph update and using existing minigraph." + if [ "$dhcp_as_static" = "true" ]; then + sed -i "/enabled=/d" /etc/sonic/updategraph.conf + echo "enabled=false" >> /etc/sonic/updategraph.conf + fi + exit 0 + fi if [ "`cat /tmp/dhcp_graph_url`" = "N/A" ]; then - echo "No graph_url option in DHCP response. Skipping graph update." + echo "'N/A' found in DHCP response. Skipping graph update and generating an empty configuration." + echo '{"DEVICE_METADATA":' > /tmp/device_meta.json + sonic-cfggen -m /etc/sonic/minigraph.xml --var-json DEVICE_METADATA >> /tmp/device_meta.json + echo '}' >> /tmp/device_meta.json + if [ -f /etc/sonic/init_cfg.json ]; then + sonic-cfggen -j /tmp/device_meta.json -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + else + cp -f /tmp/device_meta.json /etc/sonic/config_db.json + fi + if [ "$dhcp_as_static" = "true" ]; then sed -i "/enabled=/d" /etc/sonic/updategraph.conf echo "enabled=false" >> /etc/sonic/updategraph.conf @@ -29,6 +46,7 @@ if [ "$src" = "dhcp" ]; then exit 0 fi + HOSTNAME=`hostname -s` GRAPH_URL=`sonic-cfggen -t /tmp/dhcp_graph_url -a "{\"hostname\": \"$HOSTNAME\"}"` URL_REGEX='^(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]$' From 2ba281829c966222680f1d049a54181d1b11cef4 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sun, 29 Oct 2017 11:50:49 -0700 Subject: [PATCH 0880/1833] [swss]: Update sonic-swss submodule (#1091) Including: - [swss] a couple non-functional code cleanup changes - [bufferorch] move buffer pool definitions together - [orchagent] optimize the code structure - [orchagent]: Fix hang problem caused by erase operation on empty map - [orchagent]: Support port/LAG in multiple VLANs Signed-off-by: Shu0T1an ChenG --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index e07d86b100cc..3b7c3e334877 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit e07d86b100ccefe8b51e2c41b543cc93f33a0f13 +Subproject commit 3b7c3e3348779e1fc7b147a299d22942a34f5cb9 From 1a81715275dfd5e22225670462886d5bdde59ad6 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sun, 29 Oct 2017 11:50:57 -0700 Subject: [PATCH 0881/1833] [swss]: Add switch.json.j2 to set the hash seed according to the switch type (#1089) Set the ECMP/LAG hash seed to 10 when the switch is a ToR, 20 when the switch is a Leaf, 0 otherwise. Signed-off-by: Shu0T1an ChenG --- dockers/docker-orchagent/Dockerfile.j2 | 7 +++---- dockers/docker-orchagent/start.sh | 1 + dockers/docker-orchagent/switch.json.j2 | 18 ++++++++++++++++++ dockers/docker-orchagent/swssconfig.sh | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 dockers/docker-orchagent/switch.json.j2 diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index b2d20383e38e..9fba8d17b9d6 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -28,9 +28,8 @@ RUN rm -rf /debs COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"] -COPY ["mirror.json.j2", "/usr/share/sonic/templates/"] -COPY ["ports.json.j2", "/usr/share/sonic/templates/"] -COPY ["msn27xx.32ports.buffers.json.j2", "/usr/share/sonic/templates/"] + +## Copy all Jinja2 template files into the templates folder +COPY ["*.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 0931321a9436..bad88111c9a1 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -2,6 +2,7 @@ mkdir -p /etc/swss/config.d/ +sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/switch.json.j2 > /etc/swss/config.d/switch.json sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json diff --git a/dockers/docker-orchagent/switch.json.j2 b/dockers/docker-orchagent/switch.json.j2 new file mode 100644 index 000000000000..7a8c3522ecee --- /dev/null +++ b/dockers/docker-orchagent/switch.json.j2 @@ -0,0 +1,18 @@ +{# set default hash seed to 0 #} +{% set hash_seed = 0 %} +{% if DEVICE_METADATA.localhost.type %} +{% if DEVICE_METADATA.localhost.type == "ToRRouter" %} +{% set hash_seed = 10 %} +{% elif DEVICE_METADATA.localhost.type == "LeafRouter" %} +{% set hash_seed = 20 %} +{% endif %} +{% endif %} +[ + { + "SWITCH_TABLE:switch": { + "ecmp_hash_seed": "{{ hash_seed }}", + "lag_hash_seed": "{{ hash_seed }}" + }, + "OP": "SET" + } +] diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index f780ae8afb20..c00d203a71ab 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -39,7 +39,7 @@ fast_reboot HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v "DEVICE_METADATA['localhost']['hwsku']"` -SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json " +SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json switch.json " if [ "$HWSKU" == "Force10-S6000" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " From b0c13ea928028da6378bc92ba650927a63345bb1 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 30 Oct 2017 14:47:07 -0700 Subject: [PATCH 0882/1833] [snmpagent]: Update sonic-snmpagent submodule (#1094) Include the fix: [mibs]: Add oid:0x prefix to the SAI ID in counter table (#48) Signed-off-by: Shu0T1an ChenG --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 5e00a50cf397..39f1e23cb834 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 5e00a50cf397693808e1ccc7371a043d8d53cdab +Subproject commit 39f1e23cb834255955f5270234c8a72b14c11d6f From 4f59b2e4c7936d34a46888fac9dde5354f80b613 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Mon, 30 Oct 2017 18:02:44 -0700 Subject: [PATCH 0883/1833] Modified HWSKU to match internally defined SKU string (#1095) --- .../port_config.ini | 0 .../{Arista-7060-CX-32S => Arista-7060CX-32S-C32}/sai.profile | 0 device/arista/x86_64-arista_7060_cx32s/minigraph.xml | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename device/arista/x86_64-arista_7060_cx32s/{Arista-7060-CX-32S => Arista-7060CX-32S-C32}/port_config.ini (100%) rename device/arista/x86_64-arista_7060_cx32s/{Arista-7060-CX-32S => Arista-7060CX-32S-C32}/sai.profile (100%) diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX-32S/port_config.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/port_config.ini similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX-32S/port_config.ini rename to device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/port_config.ini diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX-32S/sai.profile b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/sai.profile similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/Arista-7060-CX-32S/sai.profile rename to device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/sai.profile diff --git a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml index 7c9f66ab69da..23282de17af1 100644 --- a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml +++ b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml @@ -1040,7 +1040,7 @@ switch1 - Arista-7060-CX-32S + Arista-7060CX-32S-C32 @@ -1075,5 +1075,5 @@ switch1 - Arista-7060-CX-32S + Arista-7060CX-32S-C32 From d7d6c411845d1eca3235510d67e50c9a4fbea060 Mon Sep 17 00:00:00 2001 From: byu343 Date: Mon, 30 Oct 2017 18:04:40 -0700 Subject: [PATCH 0884/1833] [Arista]: Fix the udev waiting in networking start (#1093) * [Arista]: Fix the udev waiting in networking start This change is to fix the issue in https://github.com/aristanetworks/sonic/issues/16 For the checking condition used, it is only applied to Arista switches Signed-off-by: Boyang Yu * [Arista]: Correct for PR comments Signed-off-by: Boyang Yu --- files/build_templates/sonic_debian_extension.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 8270af923078..37fcfbc56fcb 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -188,6 +188,11 @@ sudo dpkg --root=$FILESYSTEM_ROOT -P {{ debname }} sudo rm -f $FILESYSTEM_ROOT/usr/sbin/policy-rc.d +## Revise /etc/init.d/networking for Arista switches +if [ "$image_type" = "aboot" ]; then + sudo sed -i 's/udevadm settle/udevadm settle -E \/sys\/class\/net\/eth0/' $FILESYSTEM_ROOT/etc/init.d/networking +fi + ## copy platform rc.local sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/ From bfa034604045c8918ec5f3181fe2b3b9de1c12f3 Mon Sep 17 00:00:00 2001 From: paavaanan Date: Tue, 31 Oct 2017 23:11:29 +0530 Subject: [PATCH 0885/1833] =?UTF-8?q?Added=20support=20for=20Z9100=20to=20?= =?UTF-8?q?check=20SFP=20Presence,=20toggling=20lpmode,=20reset=E2=80=A6?= =?UTF-8?q?=20(#1087)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added support for Z9100 to check SFP Presence, toggling lpmode, reset, and eeprom details --- .../plugins/sfputil.py | 395 +++++++++++++++--- 1 file changed, 337 insertions(+), 58 deletions(-) diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py index 07e094db7bb8..5609abe9b49a 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py @@ -1,60 +1,339 @@ -#!/usr/bin/env python +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# try: - from sonic_sfp.sfputilbase import sfputilbase -except ImportError, e: - raise ImportError (str(e) + "- required module not found") - - -class sfputil(sfputilbase): - """Platform specific sfputil class""" - - port_start = 0 - port_end = 31 - ports_in_block = 32 - - port_to_eeprom_mapping = {} - port_to_i2c_mapping = { - 0: 18, - 1: 19, - 2: 20, - 3: 21, - 4: 22, - 5: 23, - 6: 24, - 7: 25, - 8: 26, - 9: 27, - 10: 28, - 11: 29, - 12: 31, - 13: 30, - 14: 33, - 15: 32, - 16: 34, - 17: 35, - 18: 36, - 19: 37, - 20: 38, - 21: 39, - 22: 40, - 23: 41, - 24: 42, - 25: 43, - 26: 44, - 27: 45, - 28: 46, - 29: 47, - 30: 48, - 31: 49 - } - - _qsfp_ports = range(0, ports_in_block + 1) - - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization - eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' - for x in range(0, self.port_end + 1): - port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) - self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + 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 = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + IOM_1_PORT_START = 0 + IOM_1_PORT_END = 11 + IOM_2_PORT_START = 12 + IOM_2_PORT_END = 21 + IOM_3_PORT_START = 22 + IOM_3_PORT_END = 31 + + BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{0}-003e/" + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0: [9, 18], + 1: [9, 19], + 2: [9, 20], + 3: [9, 21], + 4: [9, 22], + 5: [9, 23], + 6: [9, 24], + 7: [9, 25], + 8: [8, 26], + 9: [8, 27], + 10: [8, 28], + 11: [8, 29], + 12: [8, 31], # reordered + 13: [8, 30], + 14: [8, 33], # reordered + 15: [8, 32], + 16: [7, 34], + 17: [7, 35], + 18: [7, 36], + 19: [7, 37], + 20: [7, 38], + 21: [7, 39], + 22: [7, 40], + 23: [7, 41], + 24: [6, 42], + 25: [6, 43], + 26: [6, 44], + 27: [6, 45], + 28: [6, 46], + 29: [6, 47], + 30: [6, 48], + 31: [6, 49] + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def iom1_port_start(self): + return self.IOM_1_PORT_START + + @property + def iom1_port_end(self): + return self.IOM_1_PORT_END + + @property + def iom2_port_start(self): + return self.IOM_2_PORT_START + + @property + def iom2_port_end(self): + return self.IOM_2_PORT_END + + @property + def iom3_port_start(self): + return self.IOM_3_PORT_START + + @property + def iom3_port_end(self): + return self.IOM_3_PORT_END + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + @property + def port_to_i2c_mapping(self): + return self._port_to_i2c_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/i2c-{1}/{1}-0050/eeprom" + + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self.port_to_i2c_mapping[x][0], + self.port_to_i2c_mapping[x][1]) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + + global i2c_line + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + # port_num and i2c match + if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: + i2c_line = 14 + elif (port_num >= self.iom2_port_start and + port_num <= self.iom2_port_end): + i2c_line = 15 + elif (port_num >= self.iom3_port_start and + port_num <= self.iom3_port_end): + i2c_line = 16 + + try: + qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_modprs" + reg_file = open(qsfp_path, "r") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # Absence of IOM throws read error + if (content == 'read error'): + return False + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Rationalize port settings + if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: + port_num = port_num % 12 + elif (port_num >= self.iom3_port_start and + port_num <= self.iom3_port_end): + port_num = port_num % 22 + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # port_num and i2c match + if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: + i2c_line = 14 + elif (port_num >= self.iom2_port_start and + port_num <= self.iom2_port_end): + i2c_line = 15 + elif (port_num >= self.iom3_port_start and + port_num <= self.iom3_port_end): + i2c_line = 16 + + try: + qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" + reg_file = open(qsfp_path, "r") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # Absence of IOM throws read error + if (content == 'read error'): + return False + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Rationalize port settings + if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: + port_num = port_num % 12 + elif (port_num >= self.iom3_port_start and + port_num <= self.iom3_port_end): + port_num = port_num % 22 + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # port_num and i2c match + if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: + i2c_line = 14 + elif (port_num >= self.iom2_port_start and + port_num <= self.iom2_port_end): + i2c_line = 15 + elif (port_num >= self.iom3_port_start and + port_num <= self.iom3_port_end): + i2c_line = 16 + + try: + qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" + reg_file = open(qsfp_path, "r+") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # Absence of IOM throws read error + if (content == 'read error'): + return False + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Rationalize port settings + if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: + port_num = port_num % 12 + elif (port_num >= self.iom3_port_start and + port_num <= self.iom3_port_end): + port_num = port_num % 22 + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # port_num and i2c match + if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: + i2c_line = 14 + elif (port_num >= self.iom2_port_start and + port_num <= self.iom2_port_end): + i2c_line = 15 + elif (port_num >= self.iom3_port_start and + port_num <= self.iom3_port_end): + i2c_line = 16 + + try: + qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" + reg_file = open(qsfp_path, "r+") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of th + reg_value = int(content, 16) + + # Rationalize port settings + if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: + port_num = port_num % 12 + elif (port_num >= self.iom3_port_start and + port_num <= self.iom3_port_end): + port_num = port_num % 22 + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # 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: + qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" + reg_file = open(qsfp_path, "w+") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True From c832f2af62c44aef7d6f39ca71174db0d87cc81e Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 31 Oct 2017 22:20:18 -0700 Subject: [PATCH 0886/1833] [ntp]: Restart ntp after ntp-config (#1098) --- files/image_config/ntp/ntp-config.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/image_config/ntp/ntp-config.sh b/files/image_config/ntp/ntp-config.sh index 7c79a16c0ef3..601b7bd421f0 100755 --- a/files/image_config/ntp/ntp-config.sh +++ b/files/image_config/ntp/ntp-config.sh @@ -1,3 +1,5 @@ #!/bin/bash sonic-cfggen -d -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf + +systemctl restart ntp From 06c0f7d2e84a8d63a2b26b0cb7b37dfcdf737390 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 1 Nov 2017 18:40:33 -0700 Subject: [PATCH 0887/1833] Revert "[ntp]: Restart ntp after ntp-config (#1098)" (#1102) This reverts commit c832f2af62c44aef7d6f39ca71174db0d87cc81e. --- files/image_config/ntp/ntp-config.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/files/image_config/ntp/ntp-config.sh b/files/image_config/ntp/ntp-config.sh index 601b7bd421f0..7c79a16c0ef3 100755 --- a/files/image_config/ntp/ntp-config.sh +++ b/files/image_config/ntp/ntp-config.sh @@ -1,5 +1,3 @@ #!/bin/bash sonic-cfggen -d -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf - -systemctl restart ntp From 967030f24d2c75a77a86e3ea92c2d815ce065e5e Mon Sep 17 00:00:00 2001 From: Bairen Yi Date: Fri, 3 Nov 2017 02:19:05 +0800 Subject: [PATCH 0888/1833] Change third party repos from git:// to https:// for better compatibility (#1104) * Change git:// to https:// for better security and compatibility --- src/isc-dhcp/Makefile | 2 +- src/supervisor/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index 9cacd6cfe5e7..d2304876d1cf 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -10,7 +10,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./isc-dhcp # Clone isc-dhcp repo - git clone git://anonscm.debian.org/pkg-dhcp/isc-dhcp.git + git clone https://anonscm.debian.org/cgit/pkg-dhcp/isc-dhcp.git pushd ./isc-dhcp git checkout -f debian/4.3.1-6 popd diff --git a/src/supervisor/Makefile b/src/supervisor/Makefile index 5f06325960b1..778903194ffa 100644 --- a/src/supervisor/Makefile +++ b/src/supervisor/Makefile @@ -8,8 +8,8 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files rm -rf ./supervisor - # Clone isc-dhcp repo - git clone git://github.com/Supervisor/supervisor.git + # Clone supervisor repo + git clone https://github.com/Supervisor/supervisor.git pushd ./supervisor git checkout -f 3.3.2 From 29f67ebe5807dc37b9cf1f0c2e4695699e7f0dba Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Fri, 3 Nov 2017 00:09:27 +0200 Subject: [PATCH 0889/1833] [acl-loader]: acl-loader integration. (#1000) * [acl-loader]: acl-loader integration. acl-loader was inplemented based on translate_acl source code. acl-loader can't be tested with unittest. Same testcases will be covered with testbed tests. - Remove translate_acl utility and tests. - Remove mirror template. - Do not run ACL rules and mirror configuration generators. - Adopt minigraph parser to work with acl-loader. * Update sonic-swss-common and sonic-swss submodules. Enable ACL dynamic config feature. * Update sonic-utilities submodule. Include fix for acl-loader incremental update command. * [sonic-cfggen]: Add test for everflow cfggen configuration. --- dockers/docker-orchagent/mirror.json.j2 | 24 --- dockers/docker-orchagent/start.sh | 1 - dockers/docker-orchagent/swssconfig.sh | 16 +- src/sonic-config-engine/minigraph.py | 14 +- src/sonic-config-engine/setup.py | 2 +- .../tests/sample_output/mirror.json | 14 -- .../sample_output/rules_for_dataacl.json | 46 ----- .../sample_output/rules_for_everflow.json | 14 -- .../tests/sample_output/table_dataacl.json | 10 - .../tests/sample_output/table_everflow.json | 10 - src/sonic-config-engine/tests/test_acl.py | 58 ------ src/sonic-config-engine/tests/test_cfggen.py | 21 ++- src/sonic-config-engine/tests/test_j2files.py | 13 +- src/sonic-config-engine/translate_acl | 174 ------------------ src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- src/sonic-utilities | 2 +- 17 files changed, 27 insertions(+), 396 deletions(-) delete mode 100644 dockers/docker-orchagent/mirror.json.j2 delete mode 100644 src/sonic-config-engine/tests/sample_output/mirror.json delete mode 100644 src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json delete mode 100644 src/sonic-config-engine/tests/sample_output/rules_for_everflow.json delete mode 100644 src/sonic-config-engine/tests/sample_output/table_dataacl.json delete mode 100644 src/sonic-config-engine/tests/sample_output/table_everflow.json delete mode 100644 src/sonic-config-engine/tests/test_acl.py delete mode 100755 src/sonic-config-engine/translate_acl diff --git a/dockers/docker-orchagent/mirror.json.j2 b/dockers/docker-orchagent/mirror.json.j2 deleted file mode 100644 index 3a3fc6eed079..000000000000 --- a/dockers/docker-orchagent/mirror.json.j2 +++ /dev/null @@ -1,24 +0,0 @@ -[ -{% if MIRROR_SESSION %} -{% for session in MIRROR_SESSION %} - { - "MIRROR_SESSION_TABLE:{{session}}": { - "src_ip": "{{ MIRROR_SESSION[session]['src_ip'] }}", - "dst_ip": "{{ MIRROR_SESSION[session]['dst_ip'] }}", -{% if onie_switch_asic == "mlnx" %} - "gre_type": "0x6558", - "queue": "1", -{% else %} - "gre_type": "0x88be", - "queue": "0", -{% endif %} - "dscp": "8", - "ttl": "255" - }, - "OP": "SET" - }{% if not loop.last %},{% endif %} - -{% endfor %} -{% endif %} -] - diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index bad88111c9a1..aa4e5b7dae1d 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -4,7 +4,6 @@ mkdir -p /etc/swss/config.d/ sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/switch.json.j2 > /etc/swss/config.d/switch.json sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json -sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json export platform=`sonic-cfggen -v platform` diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index c00d203a71ab..3458ddae61e6 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -2,18 +2,6 @@ set -e -function config_acl { - if [ -f "/etc/sonic/acl.json" ]; then - mkdir -p /etc/swss/config.d/acl - rm -rf /etc/swss/config.d/acl/* - translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json - for filename in /etc/swss/config.d/acl/*.json; do - [ -e "$filename" ] || break - swssconfig $filename - done - fi -} - function fast_reboot { case "$(cat /proc/cmdline)" in *fast-reboot*) @@ -39,7 +27,7 @@ fast_reboot HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v "DEVICE_METADATA['localhost']['hwsku']"` -SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json switch.json " +SWSSCONFIG_ARGS="00-copp.config.json ipinip.json ports.json switch.json " if [ "$HWSKU" == "Force10-S6000" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " @@ -56,5 +44,3 @@ for file in $SWSSCONFIG_ARGS; do swssconfig /etc/swss/config.d/$file sleep 1 done - -config_acl diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 3e1e603e6412..c51b24afed08 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -29,7 +29,7 @@ class minigraph_encoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, ( - ipaddress.IPv4Network, ipaddress.IPv6Network, + ipaddress.IPv4Network, ipaddress.IPv6Network, ipaddress.IPv4Address, ipaddress.IPv6Address )): return str(obj) @@ -129,7 +129,7 @@ def parse_dpg(dpg, hname): intfname = lointf.find(str(QName(ns, "AttachTo"))).text ipprefix = lointf.find(str(QName(ns1, "PrefixStr"))).text lo_intfs[(intfname, ipprefix)] = {} - + mgmtintfs = child.find(str(QName(ns, "ManagementIPInterfaces"))) mgmt_intf = {} for mgmtintf in mgmtintfs.findall(str(QName(ns1, "ManagementIPInterface"))): @@ -175,7 +175,7 @@ def parse_dpg(dpg, hname): aclintfs = child.find(str(QName(ns, "AclInterfaces"))) acls = {} for aclintf in aclintfs.findall(str(QName(ns, "AclInterface"))): - aclname = aclintf.find(str(QName(ns, "InAcl"))).text.lower().replace(" ", "_").replace("-", "_") + aclname = aclintf.find(str(QName(ns, "InAcl"))).text.upper().replace(" ", "_").replace("-", "_") aclattach = aclintf.find(str(QName(ns, "AttachTo"))).text.split(';') acl_intfs = [] is_mirror = False @@ -193,7 +193,7 @@ def parse_dpg(dpg, hname): acl_intfs = port_alias_map.values() break; if acl_intfs: - acls[aclname] = { 'policy_desc': aclname, 'ports': acl_intfs, 'type': 'mirror' if is_mirror else 'L3'} + acls[aclname] = { 'policy_desc': aclname, 'ports': acl_intfs, 'type': 'MIRROR' if is_mirror else 'L3'} return intfs, lo_intfs, mgmt_intf, vlans, pcs, acls return None, None, None, None, None, None @@ -358,7 +358,7 @@ def parse_xml(filename, platform=None, port_config_file=None): port_speeds = parse_deviceinfo(child, hwsku) results = {} - results['DEVICE_METADATA'] = {'localhost': { + results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn, 'deployment_id': deployment_id, 'hostname': hostname, @@ -423,13 +423,13 @@ def parse_device_desc_xml(filename): (lo_prefix, mgmt_prefix, hostname, hwsku, d_type) = parse_device(root) results = {} - results['DEVICE_METADATA'] = {'localhost': { + results['DEVICE_METADATA'] = {'localhost': { 'hostname': hostname, 'hwsku': hwsku, }} results['LOOPBACK_INTERFACE'] = {('lo', lo_prefix): {}} - + mgmt_intf = {} mgmtipn = ipaddress.IPNetwork(mgmt_prefix) gwaddr = ipaddress.IPAddress(int(mgmtipn.network) + 1) diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 1bb597f395f6..296b7a03a6b9 100755 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -16,7 +16,7 @@ def get_test_suite(): author_email='taoyl@microsoft.com', url='https://github.com/Azure/sonic-buildimage', py_modules=['portconfig', 'minigraph', 'openconfig_acl', 'sonic_platform'], - scripts=['sonic-cfggen', 'translate_acl'], + scripts=['sonic-cfggen'], install_requires=['lxml', 'jinja2', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind'], test_suite='setup.get_test_suite', ) diff --git a/src/sonic-config-engine/tests/sample_output/mirror.json b/src/sonic-config-engine/tests/sample_output/mirror.json deleted file mode 100644 index 225235067e23..000000000000 --- a/src/sonic-config-engine/tests/sample_output/mirror.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "MIRROR_SESSION_TABLE:everflow0": { - "src_ip": "10.1.0.32", - "dst_ip": "2.2.2.2", - "gre_type": "0x88be", - "queue": "0", - "dscp": "8", - "ttl": "255" - }, - "OP": "SET" - } -] - diff --git a/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json b/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json deleted file mode 100644 index 709468f9d945..000000000000 --- a/src/sonic-config-engine/tests/sample_output/rules_for_dataacl.json +++ /dev/null @@ -1,46 +0,0 @@ -[ - { - "ACL_RULE_TABLE:DATAACL:RULE_1":{ - "IP_PROTOCOL":17, - "PACKET_ACTION":"FORWARD", - "SRC_IP":"10.0.0.0/8", - "priority":9999 - }, - "OP":"SET" - }, - { - "ACL_RULE_TABLE:DATAACL:RULE_3":{ - "IP_PROTOCOL":17, - "PACKET_ACTION":"FORWARD", - "SRC_IP":"25.0.0.0/8", - "priority":9997 - }, - "OP":"SET" - }, - { - "ACL_RULE_TABLE:DATAACL:RULE_2":{ - "IP_PROTOCOL":17, - "PACKET_ACTION":"FORWARD", - "SRC_IP":"100.64.0.0/10", - "priority":9998 - }, - "OP":"SET" - }, - { - "ACL_RULE_TABLE:DATAACL:RULE_4":{ - "IP_PROTOCOL":6, - "PACKET_ACTION":"FORWARD", - "TCP_FLAGS":"0x10/0x10", - "priority":9996 - }, - "OP":"SET" - }, - { - "ACL_RULE_TABLE:DATAACL:DEFAULT_RULE":{ - "ETHER_TYPE":"0x0800", - "PACKET_ACTION":"DROP", - "priority":1 - }, - "OP":"SET" - } -] \ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/rules_for_everflow.json b/src/sonic-config-engine/tests/sample_output/rules_for_everflow.json deleted file mode 100644 index 2f39a0dcc4a3..000000000000 --- a/src/sonic-config-engine/tests/sample_output/rules_for_everflow.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "ACL_RULE_TABLE:EVERFLOW:RULE_1":{ - "DST_IP":"127.0.0.1/32", - "IP_PROTOCOL":6, - "L4_DST_PORT":0, - "L4_SRC_PORT":0, - "MIRROR_ACTION":"everflow", - "SRC_IP":"127.0.0.1/32", - "priority":9999 - }, - "OP":"SET" - } -] \ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/table_dataacl.json b/src/sonic-config-engine/tests/sample_output/table_dataacl.json deleted file mode 100644 index a099680821d4..000000000000 --- a/src/sonic-config-engine/tests/sample_output/table_dataacl.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "ACL_TABLE:DATAACL":{ - "policy_desc":"dataacl", - "ports":"Ethernet112,Ethernet116,Ethernet120,Ethernet124", - "type":"L3" - }, - "OP":"SET" - } -] \ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/table_everflow.json b/src/sonic-config-engine/tests/sample_output/table_everflow.json deleted file mode 100644 index a4ad52bfe553..000000000000 --- a/src/sonic-config-engine/tests/sample_output/table_everflow.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "ACL_TABLE:EVERFLOW":{ - "policy_desc":"everflow", - "ports":"Ethernet24,Ethernet40,Ethernet20,Ethernet44,Ethernet48,Ethernet28,Ethernet96,Ethernet92,Ethernet76,Ethernet116,Ethernet72,Ethernet112,Ethernet52,Ethernet80,Ethernet56,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet60,Ethernet8,Ethernet4,Ethernet0,Ethernet64,Ethernet68,Ethernet84,Ethernet88,Ethernet108,Ethernet120,Ethernet104,Ethernet124,Ethernet100", - "type":"mirror" - }, - "OP":"SET" - } -] \ No newline at end of file diff --git a/src/sonic-config-engine/tests/test_acl.py b/src/sonic-config-engine/tests/test_acl.py deleted file mode 100644 index 319b2c1f73a7..000000000000 --- a/src/sonic-config-engine/tests/test_acl.py +++ /dev/null @@ -1,58 +0,0 @@ -import filecmp -import os -import subprocess - -from unittest import TestCase - -class TestAcl(TestCase): - def setUp(self): - self.test_dir = os.path.dirname(os.path.realpath(__file__)) - self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') - self.acl_script_file = os.path.join(self.test_dir, '..', 'translate_acl') - self.t0_minigraph = os.path.join(self.test_dir, 't0-sample-graph.xml') - self.t0_minigraph_everflow = os.path.join(self.test_dir, 't0-sample-graph-everflow.xml') - self.t0_acl = os.path.join(self.test_dir, 't0-sample-acl.json') - self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') - - def run_script(self, argument): - print 'CMD: sonic-cfggen ' + argument - output = '' - try: - output = subprocess.check_output(self.script_file + ' ' + argument, shell=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError, (p): - print 'CalledProcessError: CMD:%s returncode:%s' % (p.cmd, p.returncode) - print p.output - return output - - def run_acl_script(self, argument): - print 'CMD: translate_acl ' + argument - output = '' - try: - output = subprocess.check_output(self.acl_script_file + ' ' + argument, shell=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError, (p): - print 'CalledProcessError: CMD:%s returncode:%s' % (p.cmd, p.returncode) - print p.output - return output - - def test_translate_acl(self): - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -o ' + self.test_dir + ' ' + self.t0_acl - self.run_acl_script(argument) - for filename in ['rules_for_dataacl.json','table_dataacl.json']: - sample_output_file = os.path.join(self.test_dir, 'sample_output', filename) - output_file = os.path.join(self.test_dir, filename) - assert filecmp.cmp(sample_output_file, output_file) - - def test_translate_everflow(self): - argument = '-m ' + self.t0_minigraph_everflow + ' -p ' + self.t0_port_config + ' -o ' + self.test_dir + ' ' + self.t0_acl - self.run_acl_script(argument) - for filename in ['rules_for_everflow.json','table_everflow.json']: - sample_output_file = os.path.join(self.test_dir, 'sample_output', filename) - output_file = os.path.join(self.test_dir, filename) - assert filecmp.cmp(sample_output_file, output_file) - - def tearDown(self): - for filename in ['rules_for_dataacl.json','table_dataacl.json','rules_for_everflow.json','table_everflow.json']: - try: - os.remove(os.path.join(self.test_dir, filename)) - except OSError: - pass diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 57172af97c39..31663077c434 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -3,7 +3,7 @@ import os class TestCfgGen(TestCase): - + def setUp(self): self.test_dir = os.path.dirname(os.path.realpath(__file__)) self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') @@ -29,7 +29,7 @@ def test_dummy_run(self): argument = '' output = self.run_script(argument) self.assertEqual(output, '') - + def test_device_desc(self): argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -M "' + self.sample_device_desc + '"' output = self.run_script(argument) @@ -44,17 +44,17 @@ def test_minigraph_sku(self): argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -m "' + self.sample_graph + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'Force10-Z9100') - + def test_print_data(self): argument = '-m "' + self.sample_graph + '" --print-data' output = self.run_script(argument) self.assertTrue(len(output.strip()) > 0) - + def test_jinja_expression(self): argument = '-m "' + self.sample_graph + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"' output = self.run_script(argument) self.assertEqual(output.strip(), 'LeafRouter') - + def test_additional_json_data(self): argument = '-a \'{"key1":"value1"}\' -v key1' output = self.run_script(argument) @@ -64,7 +64,7 @@ def test_read_yaml(self): argument = '-v yml_item -y ' + os.path.join(self.test_dir, 'test.yml') output = self.run_script(argument) self.assertEqual(output.strip(), '[\'value1\', \'value2\']') - + def test_render_template(self): argument = '-y ' + os.path.join(self.test_dir, 'test.yml') + ' -t ' + os.path.join(self.test_dir, 'test.j2') output = self.run_script(argument) @@ -73,13 +73,18 @@ def test_render_template(self): def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'dataacl': {'type': 'L3', 'policy_desc': 'dataacl', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + self.assertEqual(output.strip(), "{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + + def test_minigraph_everflow(self): + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'everflow0': {'src_ip': '10.1.0.32', 'dst_ip': '2.2.2.2'}}") def test_minigraph_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v \'INTERFACE.keys()\'' output = self.run_script(argument) self.assertEqual(output.strip(), "[('Ethernet0', '10.0.0.58/31'), ('Ethernet0', 'FC00::75/126')]") - + def test_minigraph_vlans(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN' output = self.run_script(argument) diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 3d4139d0eb20..d1cc0d2a3296 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -31,14 +31,14 @@ def test_alias_map(self): argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + alias_map_template output = self.run_script(argument) data = json.loads(output) - self.assertEqual(data["Ethernet4"], "fortyGigE0/4") + self.assertEqual(data["Ethernet4"], "fortyGigE0/4") def test_lldp(self): lldpd_conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-lldp-sv2', 'lldpd.conf.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + lldpd_conf_template + ' > ' + self.output_file self.run_script(argument) self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'lldpd.conf'), self.output_file)) - + def test_teamd(self): def test_render_teamd(self, pc, minigraph, sample_output): @@ -77,15 +77,6 @@ def test_ipinip(self): assert filecmp.cmp(sample_output_file, self.output_file) - def test_everflow(self): - everflow_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'mirror.json.j2') - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + everflow_file + ' > ' + self.output_file - self.run_script(argument) - - sample_output_file = os.path.join(self.test_dir, 'sample_output', 'mirror.json') - - assert filecmp.cmp(sample_output_file, self.output_file) - def test_msn27xx_32ports_buffers(self): buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'msn27xx.32ports.buffers.json.j2') argument = '-m ' + self.t1_mlnx_minigraph + ' -p ' + self.mlnx_port_config + ' -t ' + buffer_file + ' > ' + self.output_file diff --git a/src/sonic-config-engine/translate_acl b/src/sonic-config-engine/translate_acl deleted file mode 100755 index b8138cf36b18..000000000000 --- a/src/sonic-config-engine/translate_acl +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env python - -import sys -import os.path -import json -import argparse - -import openconfig_acl -import pyangbind.lib.pybindJSON as pybindJSON -from minigraph import parse_xml - -def dump_json(filename, data): - with open(filename, 'w') as outfile: - json.dump(data, outfile, indent=4, sort_keys=True, separators=(',', ':')) - -def default_deny_rule(table_name): - rule_props = {} - rule_data = {} - rule_data["ACL_RULE_TABLE:"+table_name.upper()+":DEFAULT_RULE"] = rule_props - rule_data["OP"] = "SET" - rule_props["priority"] = 1 - rule_props["ETHER_TYPE"] = "0x0800" - rule_props["PACKET_ACTION"] = "DROP" - return rule_data - -def generate_rule_json(table_name, rule, max_priority, mirror): - rule_idx = rule.config.sequence_id - rule_props = {} - rule_data = {} - rule_data["ACL_RULE_TABLE:"+table_name.upper()+":RULE_"+str(rule_idx)] = rule_props - rule_data["OP"] = "SET" - - rule_props["priority"] = max_priority - rule_idx - if rule.actions.config.forwarding_action == "ACCEPT": - if mirror: - rule_props["MIRROR_ACTION"] = "everflow" - else: - rule_props["PACKET_ACTION"] = "FORWARD" - elif rule.actions.config.forwarding_action == "DROP": - rule_props["PACKET_ACTION"] = "DROP" - elif rule.actions.config.forwarding_action == "REJECT": - rule_props["PACKET_ACTION"] = "DROP" - else: - print "Unknown rule action %s in table %s, rule %d!" % (rule.actions.config.forwarding_action, table_name, rule_idx) - return {} - - ip_protocol_map = { - "IP_TCP" : 6, - "IP_ICMP" : 1, - "IP_UDP" : 17, - "IP_IGMP" : 2, - "IP_PIM" : 103, - "IP_RSVP" : 46, - "IP_GRE" : 47, - "IP_AUTH" : 51, - "IP_L2TP" : 115 - } - - if not rule.ip.config.protocol: - pass - elif ip_protocol_map.has_key(rule.ip.config.protocol): - rule_props["IP_PROTOCOL"] = ip_protocol_map[rule.ip.config.protocol] - else: - try: - int(rule.ip.config.protocol) - except: - print "Unknown rule protocol %s in table %s, rule %d!" % (rule.ip.config.protocol, table_name, rule_idx) - return {} - else: - rule_props["IP_PROTOCOL"] = rule.ip.config.protocol - - if rule.ip.config.source_ip_address != "": - rule_props["SRC_IP"] = rule.ip.config.source_ip_address - if rule.ip.config.destination_ip_address != "": - rule_props["DST_IP"] = rule.ip.config.destination_ip_address - - if rule.transport.config.source_port == "": - pass - elif str(rule.transport.config.source_port).find("..") < 0: - rule_props["L4_SRC_PORT"] = rule.transport.config.source_port - else: - rule_props["L4_SRC_PORT_RANGE"] = str(rule.transport.config.source_port).replace("..", "-") - - if rule.transport.config.destination_port == "": - pass - elif str(rule.transport.config.destination_port).find("..") < 0: - rule_props["L4_DST_PORT"] = rule.transport.config.destination_port - else: - rule_props["L4_DST_PORT_RANGE"] = str(rule.transport.config.destination_port).replace("..", "-") - - tcp_flags = 0x00; - for flag in rule.transport.config.tcp_flags: - if flag == "TCP_FIN": - tcp_flags = tcp_flags | 0x01 - if flag == "TCP_SYN": - tcp_flags = tcp_flags | 0x02 - if flag == "TCP_RST": - tcp_flags = tcp_flags | 0x04 - if flag == "TCP_PSH": - tcp_flags = tcp_flags | 0x08 - if flag == "TCP_ACK": - tcp_flags = tcp_flags | 0x10 - if flag == "TCP_URG": - tcp_flags = tcp_flags | 0x20 - if flag == "TCP_ECE": - tcp_flags = tcp_flags | 0x40 - if flag == "TCP_CWR": - tcp_flags = tcp_flags | 0x80 - if tcp_flags != 0x00: - rule_props["TCP_FLAGS"] = '0x{:02x}/0x{:02x}'.format(tcp_flags, tcp_flags) - return rule_data - -def generate_table_json(aclset, aclname, ports, t_type, max_priority, output_path='.'): - table_name = aclname.replace(" ", "_").replace("-", "_") - #table_name = generate_random_table_name() - mirror = (t_type == 'mirror') - - table_props = {} - table_props["policy_desc"] = table_name - table_props["type"] = t_type - table_props["ports"] = ports - - table_data = [{}] - table_data[0]["ACL_TABLE:"+table_name.upper()] = table_props - table_data[0]["OP"] = "SET" - dump_json(os.path.join(output_path, "table_"+table_name+".json"), table_data) - - rule_data = [] - for aclentryname in aclset.acl_entries.acl_entry: - aclentry = aclset.acl_entries.acl_entry[aclentryname] - rule_props = generate_rule_json(table_name, aclentry, max_priority, mirror) - if rule_props: - rule_data.append(rule_props) - if not mirror: - rule_data.append(default_deny_rule(table_name)) - dump_json(os.path.join(output_path, "rules_for_"+table_name+".json"), rule_data) - -def translate_acl_fixed_port(filename, output_path, port, max_priority): - yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") - for aclsetname in yang_acl.acl.acl_sets.acl_set: - aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] - generate_table_json(aclset, aclsetname, port, 'l3', max_priority, output_path) - return - -def translate_acl(filename, output_path, mini_acl, max_priority): - yang_acl = pybindJSON.load(filename, openconfig_acl, "openconfig_acl") - for aclsetname in yang_acl.acl.acl_sets.acl_set: - tablename = aclsetname.replace(" ", "_").replace("-", "_") - if mini_acl.has_key(tablename): - t_type = mini_acl[tablename]['type'] - ports = ','.join(mini_acl[tablename]['ports']) - aclset = yang_acl.acl.acl_sets.acl_set[aclsetname] - generate_table_json(aclset, aclsetname, ports, t_type, max_priority, output_path) - return - -def main(): - parser = argparse.ArgumentParser(description="Translate openconfig ACL json into SONiC ACL jsons") - parser.add_argument('input', metavar='INPUT', help='input json file in openconfig format') - group = parser.add_mutually_exclusive_group(required=True) - group.add_argument('-a', '--attach-to', help='the port(s) that this ACL is attached to') - group.add_argument('-m', '--minigraph', help='read ACL attaching information from minigraph') - parser.add_argument("-p", "--port-config", help="port config file, used with -m") - parser.add_argument('-n', '--max-priority', type=int, default=10000, help='the priority number of the first rule in ACL entries') - parser.add_argument('-o', '--output-path', default='.', help='output directory where SONiC ACL jsons will be generated') - args = parser.parse_args() - if args.attach_to: - translate_acl_fixed_port(args.input, args.output_path, args.port, args.max_priority) - elif args.minigraph: - mini_data = parse_xml(args.minigraph, port_config_file=args.port_config) - if mini_data['ACL_TABLE']: - translate_acl(args.input, args.output_path, mini_data['ACL_TABLE'], args.max_priority) - -if __name__ == "__main__": - main() diff --git a/src/sonic-swss b/src/sonic-swss index 3b7c3e334877..f90a4e1ef369 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 3b7c3e3348779e1fc7b147a299d22942a34f5cb9 +Subproject commit f90a4e1ef369491b84a048cbf234f4cd3442d552 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 31142b8fac17..2e94b54e3626 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 31142b8fac1796b7d665ed06609c9fec09c9707f +Subproject commit 2e94b54e3626a4acd73bb3edb2f94d61793ee0e4 diff --git a/src/sonic-utilities b/src/sonic-utilities index 67f8806ce42f..1d37c9c199b7 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 67f8806ce42f2511f170117d70ecfd0e8d205eb5 +Subproject commit 1d37c9c199b7934653f907095bf11e685889df23 From ef438002b871ee7175ad22632148c195e139761b Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 3 Nov 2017 09:33:23 -0700 Subject: [PATCH 0890/1833] [swsssdk] Update swsssdk pointer (#1107) --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 3b074795c907..294f5406e971 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 3b074795c907a7d0afea6d337010393fe9a1509d +Subproject commit 294f5406e971396352b06c3b4954a2f80dd8ba34 From a7e602501ce790651d7412de53b04db4f6b57a56 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 3 Nov 2017 14:36:26 -0700 Subject: [PATCH 0891/1833] Use sha1sum instead of shasum for portability (#1113) sha1sum is a better option to use since it is part of the coreutil package. shasum is owned by perl which might not always exist on the host system. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bf9e0da0c76a..800cd32093e3 100644 --- a/Makefile +++ b/Makefile @@ -25,8 +25,8 @@ $(shell rm -f .screen) MAKEFLAGS += -B -SLAVE_BASE_TAG = $(shell shasum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') -SLAVE_TAG = $(shell cat sonic-slave/Dockerfile.user sonic-slave/Dockerfile | shasum | awk '{print substr($$1,0,11);}') +SLAVE_BASE_TAG = $(shell sha1sum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') +SLAVE_TAG = $(shell cat sonic-slave/Dockerfile.user sonic-slave/Dockerfile | sha1sum | awk '{print substr($$1,0,11);}') SLAVE_BASE_IMAGE = sonic-slave-base SLAVE_IMAGE = sonic-slave-$(USER) From ca214b947c4eb11df9faf3c4ac2e9fc6b2c9c1e4 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 3 Nov 2017 15:22:05 -0700 Subject: [PATCH 0892/1833] [arista]: Bump sonic-platform-modules-arista submodule (#1111) * Bump sonic-platform-modules-arista Improves i2c performance for xcvrs Fix the led_plugin by ignoring unknown ports Miscellaneous improvements * Fix index column for Arista-7260CX3-D108C8 * Fix flash permissions for Arista platforms The ext4 flash uses acl to properly handle permissions in EOS. Aboot isn't built with this support and therefore can't be used to set the flash permissions. It has to be deferred in sonic initrd. --- .../Arista-7260CX3-D108C8/port_config.ini | 238 +++++++++--------- files/Aboot/boot0.j2 | 3 - files/initramfs-tools/arista-convertfs.j2 | 18 +- .../broadcom/sonic-platform-modules-arista | 2 +- 4 files changed, 137 insertions(+), 124 deletions(-) diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini index 35a2175cf21d..352926377a5c 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini @@ -1,121 +1,121 @@ # name lanes alias index Ethernet0 77,78 Ethernet1/1 1 -Ethernet2 79,80 Ethernet1/3 2 -Ethernet4 65,66 Ethernet2/1 3 -Ethernet6 67,68 Ethernet2/3 4 -Ethernet8 85,86 Ethernet3/1 5 -Ethernet10 87,88 Ethernet3/3 6 -Ethernet12 89,90 Ethernet4/1 7 -Ethernet14 91,92 Ethernet4/3 8 -Ethernet16 109,110 Ethernet5/1 9 -Ethernet18 111,112 Ethernet5/3 10 -Ethernet20 97,98 Ethernet6/1 11 -Ethernet22 99,100 Ethernet6/3 12 -Ethernet24 5,6 Ethernet7/1 13 -Ethernet26 7,8 Ethernet7/3 14 -Ethernet28 13,14 Ethernet8/1 15 -Ethernet30 15,16 Ethernet8/3 16 -Ethernet32 25,26 Ethernet9/1 17 -Ethernet34 27,28 Ethernet9/3 18 -Ethernet36 21,22 Ethernet10/1 19 -Ethernet38 23,24 Ethernet10/3 20 -Ethernet40 37,38 Ethernet11/1 21 -Ethernet42 39,40 Ethernet11/3 22 -Ethernet44 45,46 Ethernet12/1 23 -Ethernet46 47,48 Ethernet12/3 24 -Ethernet48 57,58 Ethernet13/1 25 -Ethernet50 59,60 Ethernet13/3 26 -Ethernet52 53,54 Ethernet14/1 27 -Ethernet54 55,56 Ethernet14/3 28 -Ethernet56 117,118 Ethernet15/1 29 -Ethernet58 119,120 Ethernet15/3 30 -Ethernet60 121,122 Ethernet16/1 31 -Ethernet62 123,124 Ethernet16/3 32 -Ethernet64 141,142 Ethernet17/1 33 -Ethernet66 143,144 Ethernet17/3 34 -Ethernet68 133,134,135,136 Ethernet18/1 35 -Ethernet72 197,198 Ethernet19/1 36 -Ethernet74 199,200 Ethernet19/3 37 -Ethernet76 205,206,207,208 Ethernet20/1 38 -Ethernet80 217,218 Ethernet21/1 39 -Ethernet82 219,220 Ethernet21/3 40 -Ethernet84 213,214 Ethernet22/1 41 -Ethernet86 215,216 Ethernet22/3 42 -Ethernet88 229,230 Ethernet23/1 43 -Ethernet90 231,232 Ethernet23/3 44 -Ethernet92 237,238 Ethernet24/1 45 -Ethernet94 239,240 Ethernet24/3 46 -Ethernet96 249,250 Ethernet25/1 47 -Ethernet98 251,252 Ethernet25/3 48 -Ethernet100 245,246 Ethernet26/1 49 -Ethernet102 247,248 Ethernet26/3 50 -Ethernet104 149,150 Ethernet27/1 51 -Ethernet106 151,152 Ethernet27/3 52 -Ethernet108 153,154 Ethernet28/1 53 -Ethernet110 155,156 Ethernet28/3 54 -Ethernet112 173,174 Ethernet29/1 55 -Ethernet114 175,176 Ethernet29/3 56 -Ethernet116 161,162 Ethernet30/1 57 -Ethernet118 163,164 Ethernet30/3 58 -Ethernet120 181,182 Ethernet31/1 59 -Ethernet122 183,184 Ethernet31/3 60 -Ethernet124 185,186 Ethernet32/1 61 -Ethernet126 187,188 Ethernet32/3 62 -Ethernet128 69,70 Ethernet33/1 63 -Ethernet130 71,72 Ethernet33/3 64 -Ethernet132 73,74 Ethernet34/1 65 -Ethernet134 75,76 Ethernet34/3 66 -Ethernet136 93,94 Ethernet35/1 67 -Ethernet138 95,96 Ethernet35/3 68 -Ethernet140 81,82 Ethernet36/1 69 -Ethernet142 83,84 Ethernet36/3 70 -Ethernet144 101,102 Ethernet37/1 71 -Ethernet146 103,104 Ethernet37/3 72 -Ethernet148 105,106 Ethernet38/1 73 -Ethernet150 107,108 Ethernet38/3 74 -Ethernet152 9,10 Ethernet39/1 75 -Ethernet154 11,12 Ethernet39/3 76 -Ethernet156 1,2 Ethernet40/1 77 -Ethernet158 3,4 Ethernet40/3 78 -Ethernet160 17,18 Ethernet41/1 79 -Ethernet162 19,20 Ethernet41/3 80 -Ethernet164 29,30 Ethernet42/1 81 -Ethernet166 31,32 Ethernet42/1 82 -Ethernet168 41,42 Ethernet43/1 83 -Ethernet170 43,44 Ethernet43/3 84 -Ethernet172 33,34 Ethernet44/1 85 -Ethernet174 35,36 Ethernet44/3 86 -Ethernet176 49,50,51,52 Ethernet45/1 87 -Ethernet180 61,62,63,64 Ethernet46/1 88 -Ethernet184 125,126,127,128 Ethernet47/1 89 -Ethernet188 113,114,115,116 Ethernet48/1 90 -Ethernet192 129,130,131,132 Ethernet49/1 91 -Ethernet196 137,138,139,140 Ethernet50/1 92 -Ethernet200 201,202,203,204 Ethernet51/1 93 -Ethernet204 193,194,195,196 Ethernet52/1 94 -Ethernet208 209,210 Ethernet53/1 95 -Ethernet210 211,212 Ethernet53/3 96 -Ethernet212 221,222 Ethernet54/1 97 -Ethernet214 223,224 Ethernet54/3 98 -Ethernet216 233,234 Ethernet55/1 99 -Ethernet218 235,236 Ethernet55/3 100 -Ethernet220 225,226 Ethernet56/1 101 -Ethernet222 227,228 Ethernet56/3 102 -Ethernet224 241,242 Ethernet57/1 103 -Ethernet226 243,244 Ethernet57/3 104 -Ethernet228 253,254 Ethernet58/1 105 -Ethernet230 255,256 Ethernet58/3 106 -Ethernet232 157,158 Ethernet59/1 107 -Ethernet234 159,160 Ethernet59/3 108 -Ethernet236 145,146 Ethernet60/1 109 -Ethernet238 147,148 Ethernet60/3 110 -Ethernet240 165,166 Ethernet61/1 111 -Ethernet242 167,168 Ethernet61/3 112 -Ethernet244 169,170 Ethernet62/1 113 -Ethernet246 171,172 Ethernet62/3 114 -Ethernet248 189,190 Ethernet63/1 115 -Ethernet250 191,192 Ethernet63/3 116 -Ethernet252 177,178 Ethernet64/1 117 -Ethernet254 179,180 Ethernet64/3 118 -Ethernet256 257 Ethernet257 119 -Ethernet260 259 Ethernet259 120 +Ethernet2 79,80 Ethernet1/3 1 +Ethernet4 65,66 Ethernet2/1 2 +Ethernet6 67,68 Ethernet2/3 2 +Ethernet8 85,86 Ethernet3/1 3 +Ethernet10 87,88 Ethernet3/3 3 +Ethernet12 89,90 Ethernet4/1 4 +Ethernet14 91,92 Ethernet4/3 4 +Ethernet16 109,110 Ethernet5/1 5 +Ethernet18 111,112 Ethernet5/3 5 +Ethernet20 97,98 Ethernet6/1 6 +Ethernet22 99,100 Ethernet6/3 6 +Ethernet24 5,6 Ethernet7/1 7 +Ethernet26 7,8 Ethernet7/3 7 +Ethernet28 13,14 Ethernet8/1 8 +Ethernet30 15,16 Ethernet8/3 8 +Ethernet32 25,26 Ethernet9/1 9 +Ethernet34 27,28 Ethernet9/3 9 +Ethernet36 21,22 Ethernet10/1 10 +Ethernet38 23,24 Ethernet10/3 10 +Ethernet40 37,38 Ethernet11/1 11 +Ethernet42 39,40 Ethernet11/3 11 +Ethernet44 45,46 Ethernet12/1 12 +Ethernet46 47,48 Ethernet12/3 12 +Ethernet48 57,58 Ethernet13/1 13 +Ethernet50 59,60 Ethernet13/3 13 +Ethernet52 53,54 Ethernet14/1 14 +Ethernet54 55,56 Ethernet14/3 14 +Ethernet56 117,118 Ethernet15/1 15 +Ethernet58 119,120 Ethernet15/3 15 +Ethernet60 121,122 Ethernet16/1 16 +Ethernet62 123,124 Ethernet16/3 16 +Ethernet64 141,142 Ethernet17/1 17 +Ethernet66 143,144 Ethernet17/3 17 +Ethernet68 133,134,135,136 Ethernet18/1 18 +Ethernet72 197,198 Ethernet19/1 19 +Ethernet74 199,200 Ethernet19/3 19 +Ethernet76 205,206,207,208 Ethernet20/1 20 +Ethernet80 217,218 Ethernet21/1 21 +Ethernet82 219,220 Ethernet21/3 21 +Ethernet84 213,214 Ethernet22/1 22 +Ethernet86 215,216 Ethernet22/3 22 +Ethernet88 229,230 Ethernet23/1 23 +Ethernet90 231,232 Ethernet23/3 23 +Ethernet92 237,238 Ethernet24/1 24 +Ethernet94 239,240 Ethernet24/3 24 +Ethernet96 249,250 Ethernet25/1 25 +Ethernet98 251,252 Ethernet25/3 25 +Ethernet100 245,246 Ethernet26/1 26 +Ethernet102 247,248 Ethernet26/3 26 +Ethernet104 149,150 Ethernet27/1 27 +Ethernet106 151,152 Ethernet27/3 27 +Ethernet108 153,154 Ethernet28/1 28 +Ethernet110 155,156 Ethernet28/3 28 +Ethernet112 173,174 Ethernet29/1 29 +Ethernet114 175,176 Ethernet29/3 29 +Ethernet116 161,162 Ethernet30/1 30 +Ethernet118 163,164 Ethernet30/3 30 +Ethernet120 181,182 Ethernet31/1 31 +Ethernet122 183,184 Ethernet31/3 31 +Ethernet124 185,186 Ethernet32/1 32 +Ethernet126 187,188 Ethernet32/3 32 +Ethernet128 69,70 Ethernet33/1 33 +Ethernet130 71,72 Ethernet33/3 33 +Ethernet132 73,74 Ethernet34/1 34 +Ethernet134 75,76 Ethernet34/3 34 +Ethernet136 93,94 Ethernet35/1 35 +Ethernet138 95,96 Ethernet35/3 35 +Ethernet140 81,82 Ethernet36/1 36 +Ethernet142 83,84 Ethernet36/3 36 +Ethernet144 101,102 Ethernet37/1 37 +Ethernet146 103,104 Ethernet37/3 37 +Ethernet148 105,106 Ethernet38/1 38 +Ethernet150 107,108 Ethernet38/3 38 +Ethernet152 9,10 Ethernet39/1 39 +Ethernet154 11,12 Ethernet39/3 39 +Ethernet156 1,2 Ethernet40/1 40 +Ethernet158 3,4 Ethernet40/3 40 +Ethernet160 17,18 Ethernet41/1 41 +Ethernet162 19,20 Ethernet41/3 41 +Ethernet164 29,30 Ethernet42/1 42 +Ethernet166 31,32 Ethernet42/1 42 +Ethernet168 41,42 Ethernet43/1 43 +Ethernet170 43,44 Ethernet43/3 43 +Ethernet172 33,34 Ethernet44/1 44 +Ethernet174 35,36 Ethernet44/3 44 +Ethernet176 49,50,51,52 Ethernet45/1 45 +Ethernet180 61,62,63,64 Ethernet46/1 46 +Ethernet184 125,126,127,128 Ethernet47/1 47 +Ethernet188 113,114,115,116 Ethernet48/1 48 +Ethernet192 129,130,131,132 Ethernet49/1 49 +Ethernet196 137,138,139,140 Ethernet50/1 50 +Ethernet200 201,202,203,204 Ethernet51/1 51 +Ethernet204 193,194,195,196 Ethernet52/1 52 +Ethernet208 209,210 Ethernet53/1 53 +Ethernet210 211,212 Ethernet53/3 53 +Ethernet212 221,222 Ethernet54/1 54 +Ethernet214 223,224 Ethernet54/3 54 +Ethernet216 233,234 Ethernet55/1 55 +Ethernet218 235,236 Ethernet55/3 55 +Ethernet220 225,226 Ethernet56/1 56 +Ethernet222 227,228 Ethernet56/3 56 +Ethernet224 241,242 Ethernet57/1 57 +Ethernet226 243,244 Ethernet57/3 57 +Ethernet228 253,254 Ethernet58/1 58 +Ethernet230 255,256 Ethernet58/3 58 +Ethernet232 157,158 Ethernet59/1 59 +Ethernet234 159,160 Ethernet59/3 59 +Ethernet236 145,146 Ethernet60/1 60 +Ethernet238 147,148 Ethernet60/3 60 +Ethernet240 165,166 Ethernet61/1 61 +Ethernet242 167,168 Ethernet61/3 61 +Ethernet244 169,170 Ethernet62/1 62 +Ethernet246 171,172 Ethernet62/3 62 +Ethernet248 189,190 Ethernet63/1 63 +Ethernet250 191,192 Ethernet63/3 63 +Ethernet252 177,178 Ethernet64/1 64 +Ethernet254 179,180 Ethernet64/3 64 +Ethernet256 257 Ethernet65 65 +Ethernet260 259 Ethernet66 66 diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index b88c0ec35b39..8ea085bf5e8d 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -65,9 +65,6 @@ extract_image() { ## vfat does not support symbol link if [ -n "$sonic_upgrade" ] || [ "$rootfs_type" != "vfat" ]; then - ## on ext4, other doesn't have access to the flash by default - chmod o+rx "$target_path" - mkdir -p "$image_path/{{ DOCKERFS_DIR }}" if [ -n "$sonic_upgrade" ]; then diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 75ce011e839a..cea25bd39837 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -82,6 +82,13 @@ run_cmd() { fi } +fixup_flash_permissions() { + # properly set flash permissions for others + # this allows the sonic admin user to have read access on the flash + local flash_mnt="$1" + chmod o+rx "$flash_mnt" +} + # Extract kernel parameters set -- $(cat /proc/cmdline) for x in "$@"; do @@ -111,7 +118,14 @@ if ! wait_for_root_dev; then fi # exit when the root is ext4 -blkid | grep "$root_dev.*vfat" -q || exit 0 +if ! blkid | grep "$root_dev.*vfat" -q; then + mkdir -p "$root_mnt" + mount -t ext4 "$root_dev" "$root_mnt" + fixup_flash_permissions "$root_mnt" + umount "$root_mnt" + rmdir "$root_mnt" + exit 0 +fi # Get flash dev name if [ -z "$block_flash" ]; then @@ -176,3 +190,5 @@ run_cmd "$cmd" "$err_msg" err_msg="Error: copying files form $tmp_mnt to $root_mnt failed" cmd="cp -a $tmp_mnt/. $root_mnt/" run_cmd "$cmd" "$err_msg" + +fixup_flash_permissions "$root_mnt" diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index d1417bff1778..f985b188326e 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit d1417bff17780255d4cc371b315f620087673eb8 +Subproject commit f985b188326e480124ec49541b4fecc51a213889 From 4e1fb6850fe0c3b4670d1068c16073e69822dcf0 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Sat, 4 Nov 2017 01:31:02 +0200 Subject: [PATCH 0893/1833] Update Mellanox buffers profile to use single pool for lossless (#1101) Signed-off-by: Andriy Moroz --- .../msn27xx.32ports.buffers.json.j2 | 17 +++++------------ .../tests/sample_output/msn27.32ports.json | 14 +++----------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 index 075385079a0d..ce1ddedbba37 100644 --- a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 +++ b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 @@ -4,14 +4,6 @@ {%- if port_names_list.append(port) %}{% endif %} {% endfor %} {% set port_names = port_names_list | join(',') %} - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { - "size": "3024486", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, { "BUFFER_POOL_TABLE:ingress_lossy_pool": { "size": "6422528", @@ -106,6 +98,7 @@ }, {# The following template part is for variable PG profile configuration #} +{% set non_pg_lossless_pool_size = 866726 %} {% set pg_range = '3-4' %} {# Lists of supported speed and cable length #} {% set supported_speed = [10000, 25000, 40000, 50000, 100000] %} @@ -239,7 +232,7 @@ {%- set profile_config = pg_profiles[profile_name] %} { "BUFFER_PROFILE_TABLE:{{ profile_name }}": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pg_pool]", + "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", "xon":"{{ profile_config['xon'] }}", "xoff":"{{ profile_config['xoff'] }}", "size":"{{ profile_config['size'] }}", @@ -249,10 +242,10 @@ }, {% endfor -%} - {# Pool declaration #} + {# Lossless pool declaration #} { - "BUFFER_POOL_TABLE:ingress_lossless_pg_pool": { - "size": "{{ ingress_lossless_pg_pool_size | sum }}", + "BUFFER_POOL_TABLE:ingress_lossless_pool": { + "size": "{{ ingress_lossless_pg_pool_size | sum + non_pg_lossless_pool_size }}", "type": "ingress", "mode": "dynamic" }, diff --git a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json index 876706b5de13..c65ebb847d7b 100644 --- a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json +++ b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json @@ -1,12 +1,4 @@ [ - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { - "size": "3024486", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, { "BUFFER_POOL_TABLE:ingress_lossy_pool": { "size": "6422528", @@ -297,7 +289,7 @@ { "BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pg_pool]", + "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", "xon":"18432", "xoff":"75776", "size":"94208", @@ -306,8 +298,8 @@ "OP": "SET" }, { - "BUFFER_POOL_TABLE:ingress_lossless_pg_pool": { - "size": "3014656", + "BUFFER_POOL_TABLE:ingress_lossless_pool": { + "size": "3881382", "type": "ingress", "mode": "dynamic" }, From 875bdf6be94f9652fd98623bab15df6e343175f0 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 3 Nov 2017 17:13:39 -0700 Subject: [PATCH 0894/1833] [vs] add teamsyncd into vs docker (#1112) * [vs] add teamsyncd into vs docker * add build badge for virtual switch --- .gitignore | 1 + README.md | 7 +- platform/vs/README.md | 68 ++++++++++++++++++-- platform/vs/docker-sonic-vs.mk | 2 +- platform/vs/docker-sonic-vs/Dockerfile | 51 --------------- platform/vs/docker-sonic-vs/Dockerfile.j2 | 3 +- platform/vs/docker-sonic-vs/start.sh | 2 + platform/vs/docker-sonic-vs/supervisord.conf | 8 +++ rules/swss-common.mk | 3 + src/sonic-swss-common | 2 +- 10 files changed, 86 insertions(+), 61 deletions(-) delete mode 100644 platform/vs/docker-sonic-vs/Dockerfile diff --git a/.gitignore b/.gitignore index 9ca9d2ff1a98..c5ed255e62a9 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ dockers/docker-teamd/Dockerfile dockers/docker-sonic-mgmt/Dockerfile platform/*/docker-syncd-*/Dockerfile platform/*/docker-syncd-*-rpc/Dockerfile +platform/vs/docker-sonic-vs/Dockerfile # Installer-related files and directories installer/x86_64/platforms/ diff --git a/README.md b/README.md index 53e8b8ff221a..b494f56bc0ae 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ Broadcom: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broad Cavium: [![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) Centec: [![Centec](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) Mellanox: [![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) -P4: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) +P4: [![P4](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) +VS: [![VS](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all) # sonic-buildimage @@ -10,7 +11,7 @@ P4: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buil # Description -Following is the instruction on how to build an [(ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also how to build docker images running inside the NOS. Note that SONiC image are build per ASIC platform. Switches using the same ASIC platform share a common image. For a list of supported switches and ASIC, please refer to this [document](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all). +Following is the instruction on how to build an [(ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also how to build docker images running inside the NOS. Note that SONiC image are build per ASIC platform. Switches using the same ASIC platform share a common image. For a list of supported switches and ASIC, please refer to this [list](https://github.com/Azure/SONiC/wiki/Supported-Devices-and-Platforms) # Hardware Any server can be a build image server. We are using a server with 1T hard disk. The OS is Ubuntu 16.04. @@ -47,6 +48,7 @@ The SONiC installer contains all docker images needed. SONiC uses one image for - PLATFORM=cavium - PLATFORM=centec - PLATFORM=p4 +- PLATFORM=vs For Broadcom ASIC, we build ONIE and EOS image. EOS image is used for Arista devices, ONIE image is used for all other Broadcom ASIC based devices. @@ -92,6 +94,7 @@ This may take a while, but it is a one-time action, so please be patient. - docker-syncd-cavm.gz: docker image for the daemon to sync database and Cavium switch ASIC (gzip tar archive) - docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) - docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive) + - docker-sonic-vs.gz: docker image for all-in-one for software virtual switch (gzip tar archive) ## Contribution Guide diff --git a/platform/vs/README.md b/platform/vs/README.md index a7ec58856124..52f3f30eac6d 100644 --- a/platform/vs/README.md +++ b/platform/vs/README.md @@ -4,14 +4,72 @@ HOWTO Use Virtual Switch 1. Create a docker with 32 front panel port ``` -docker run -id --name sw debian bash -sudo ./create_vnet.sh sw +$ docker run -id --name sw debian bash +$ sudo ./create_vnet.sh sw +$ ip netns list +sw-srv31 (id: 37) +sw-srv30 (id: 35) +sw-srv29 (id: 34) +sw-srv28 (id: 33) +sw-srv27 (id: 32) +sw-srv26 (id: 31) +sw-srv25 (id: 30) +sw-srv24 (id: 29) +sw-srv23 (id: 28) +sw-srv22 (id: 27) +sw-srv21 (id: 26) +sw-srv20 (id: 25) +sw-srv19 (id: 24) +sw-srv18 (id: 23) +sw-srv17 (id: 22) +sw-srv16 (id: 21) +sw-srv15 (id: 20) +sw-srv14 (id: 19) +sw-srv13 (id: 18) +sw-srv12 (id: 17) +sw-srv11 (id: 16) +sw-srv10 (id: 15) +sw-srv9 (id: 14) +sw-srv8 (id: 13) +sw-srv7 (id: 12) +sw-srv6 (id: 11) +sw-srv5 (id: 10) +sw-srv4 (id: 9) +sw-srv3 (id: 8) +sw-srv2 (id: 7) +sw-srv1 (id: 6) +sw-srv0 (id: 5) ``` -2. Create sonic virtual switch docker +2. Start sonic virtual switch docker ``` -docker run --privileged --network container:sw -d docker-sonic-vs +$ docker run --privileged --network container:sw -d docker-sonic-vs ``` -3. Run test in virtual switch docker (TBD) +3. Setup IP in the virtual switch docker + +``` +$ docker exec -it vs bash +root@2e9b5c2dc2a2:/# ifconfig Ethernet0 10.0.0.0/31 up +root@2e9b5c2dc2a2:/# ifconfig Ethernet4 10.0.0.2/31 up +``` + +4. Setup IP in the server network namespace + +``` +$ sudo ip netns exec sw-srv0 ifconfig eth0 10.0.0.1/31 +$ sudo ip netns exec sw-srv0 ip route add default via 10.0.0.0 +$ sudo ip netns exec sw-srv1 ifconfig eth0 10.0.0.3/31 +$ sudo ip netns exec sw-srv1 ip route add default via 10.0.0.2 +``` + +5. Ping from sw-srv0 to sw-srv1 + +``` +$ sudo ip netns exec sw-srv0 ping 10.0.0.3 +PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data. +64 bytes from 10.0.0.3: icmp_seq=1 ttl=63 time=0.137 ms +64 bytes from 10.0.0.3: icmp_seq=2 ttl=63 time=0.148 ms +64 bytes from 10.0.0.3: icmp_seq=3 ttl=63 time=0.149 ms +``` diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index b52965787149..e9d23db493db 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -2,7 +2,7 @@ DOCKER_SONIC_VS = docker-sonic-vs.gz $(DOCKER_SONIC_VS)_PATH = $(PLATFORM_PATH)/docker-sonic-vs -$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) $(SYNCD_VS) $(REDIS_SERVER) $(REDIS_TOOLS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_DEVICE_DATA) +$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) $(SYNCD_VS) $(REDIS_SERVER) $(REDIS_TOOLS) $(PYTHON_SWSSCOMMON) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_DEVICE_DATA) ifeq ($(SONIC_ROUTING_STACK), quagga) $(DOCKER_SONIC_VS)_DEPENDS += $(QUAGGA) diff --git a/platform/vs/docker-sonic-vs/Dockerfile b/platform/vs/docker-sonic-vs/Dockerfile deleted file mode 100644 index 2a75868cd99d..000000000000 --- a/platform/vs/docker-sonic-vs/Dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -FROM docker-config-engine - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -RUN apt-get install -y net-tools \ - ethtool \ - tcpdump \ - ifupdown \ - bridge-utils \ - python-ply \ - libqt5core5a \ - libqt5network5 \ - libboost-program-options1.55.0 \ - libboost-system1.55.0 \ - libboost-thread1.55.0 \ - libgmp10 \ - libjudydebian1 \ - libnanomsg0 \ - libdaemon0 \ - libjansson4 \ - libjemalloc1 \ - openssh-client \ - openssh-server \ - libc-ares2 \ - iproute - -COPY \ -debs/libnl-route-3-200_3.2.27-1_amd64.deb debs/libnl-genl-3-200_3.2.27-1_amd64.deb debs/libnl-nf-3-200_3.2.27-1_amd64.deb debs/libhiredis0.13_0.13.3-2_amd64.deb debs/libnl-3-200_3.2.27-1_amd64.deb debs/libnl-cli-3-200_3.2.27-1_amd64.deb debs/libswsscommon_1.0.0_amd64.deb debs/libsairedis_1.0.0_amd64.deb debs/libsaimetadata_1.0.0_amd64.deb debs/libteam5_1.26-1_amd64.deb debs/libsaivs_1.0.0_amd64.deb debs/swss_1.0.0_amd64.deb debs/syncd-vs_1.0.0_amd64.deb debs/redis-server_3.2.4-1~bpo8+1_amd64.deb debs/redis-tools_3.2.4-1~bpo8+1_amd64.deb debs/libteamdctl0_1.26-1_amd64.deb debs/libteam-utils_1.26-1_amd64.deb debs/sonic-device-data_1.0-1_all.deb debs/quagga_0.99.24.1-2.1_amd64.deb debs/ - -RUN dpkg -i \ -debs/libnl-route-3-200_3.2.27-1_amd64.deb debs/libnl-genl-3-200_3.2.27-1_amd64.deb debs/libnl-nf-3-200_3.2.27-1_amd64.deb debs/libhiredis0.13_0.13.3-2_amd64.deb debs/libnl-3-200_3.2.27-1_amd64.deb debs/libnl-cli-3-200_3.2.27-1_amd64.deb debs/libswsscommon_1.0.0_amd64.deb debs/libsairedis_1.0.0_amd64.deb debs/libsaimetadata_1.0.0_amd64.deb debs/libteam5_1.26-1_amd64.deb debs/libsaivs_1.0.0_amd64.deb debs/swss_1.0.0_amd64.deb debs/syncd-vs_1.0.0_amd64.deb debs/redis-server_3.2.4-1~bpo8+1_amd64.deb debs/redis-tools_3.2.4-1~bpo8+1_amd64.deb debs/libteamdctl0_1.26-1_amd64.deb debs/libteam-utils_1.26-1_amd64.deb debs/sonic-device-data_1.0-1_all.deb debs/quagga_0.99.24.1-2.1_amd64.deb - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs - -RUN sed -ri 's/^daemonize yes$/daemonize no/; \ - s/^logfile .*$/logfile ""/; \ - s/^# syslog-enabled no$/syslog-enabled no/; \ - s/^# unixsocket/unixsocket/ \ - ' /etc/redis/redis.conf - -COPY ["50-default.conf", "/etc/rsyslog.d/"] -COPY ["start.sh", "orchagent.sh", "/usr/bin/"] -COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] -COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] - -ENTRYPOINT ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index f6e784017f78..32b91e8cf44a 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -25,7 +25,8 @@ RUN apt-get install -y net-tools \ openssh-client \ openssh-server \ libc-ares2 \ - iproute + iproute \ + libpython2.7 COPY \ {% for deb in docker_sonic_vs_debs.split(' ') -%} diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 26633c24a70b..07d0fb7a0426 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -26,6 +26,8 @@ supervisorctl start intfsyncd supervisorctl start neighsyncd +supervisorctl start teamsyncd + # Start arp_update when VLAN exists # VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` # if [ "$VLAN" != "" ]; then diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index 35c56420b463..c6fefef1415a 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -66,3 +66,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:teamsyncd] +command=/usr/bin/teamsyncd +priority=9 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/rules/swss-common.mk b/rules/swss-common.mk index a4ccdafc2376..623410d4cdab 100644 --- a/rules/swss-common.mk +++ b/rules/swss-common.mk @@ -12,6 +12,9 @@ SONIC_DPKG_DEBS += $(LIBSWSSCOMMON) LIBSWSSCOMMON_DEV = libswsscommon-dev_1.0.0_amd64.deb $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV))) +PYTHON_SWSSCOMMON = python-swsscommon_1.0.0_amd64.deb +$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON_SWSSCOMMON))) + LIBSWSSCOMMON_DBG = libswsscommon-dbg_1.0.0_amd64.deb $(LIBSWSSCOMMON_DBG)_DEPENDS += $(LIBSWSSCOMMON) $(LIBSWSSCOMMON_DBG)_RDEPENDS += $(LIBSWSSCOMMON) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 2e94b54e3626..a6f74b67a580 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 2e94b54e3626a4acd73bb3edb2f94d61793ee0e4 +Subproject commit a6f74b67a58074439d8f3dbf84fa8ecc0a2e06a6 From ce6cbbbb99ed7c418f0c1d1de113fb8f25c7cb12 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 3 Nov 2017 17:58:34 -0700 Subject: [PATCH 0895/1833] [Arista7260CX3] Fix a typo in port_ini.cfg (#1114) --- .../Arista-7260CX3-D108C8/port_config.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini index 352926377a5c..541b197f6bb8 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini @@ -80,7 +80,7 @@ Ethernet158 3,4 Ethernet40/3 40 Ethernet160 17,18 Ethernet41/1 41 Ethernet162 19,20 Ethernet41/3 41 Ethernet164 29,30 Ethernet42/1 42 -Ethernet166 31,32 Ethernet42/1 42 +Ethernet166 31,32 Ethernet42/3 42 Ethernet168 41,42 Ethernet43/1 43 Ethernet170 43,44 Ethernet43/3 43 Ethernet172 33,34 Ethernet44/1 44 From c17d6a79f58ecbb2718cf812cd5a2fde04ce0d27 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 4 Nov 2017 18:31:07 -0700 Subject: [PATCH 0896/1833] [doc]: add badge for marvell and nephos build (#1116) --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b494f56bc0ae..bbae2e150b8e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,13 @@ -Broadcom: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) -Cavium: [![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) -Centec: [![Centec](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) +*master*: Broadcom: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) Mellanox: [![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) P4: [![P4](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) VS: [![VS](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all) +*201709*: Cavium: [![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) +Centec: [![Centec](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) +Nephos: [![Nephos](https://sonic-jenkins.westus.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/) +Marvell: [![Marvell](https://sonic-jenkins.westus.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/) + # sonic-buildimage ## Build SONiC Switch Images From 84cbfd5bbc6168e8a3d46b5819911a42b1559407 Mon Sep 17 00:00:00 2001 From: JipanYanga Date: Sun, 5 Nov 2017 01:31:29 -0600 Subject: [PATCH 0897/1833] [configdb]: Store switch mac to configDB switch table (#1108) Signed-off-by: Jipan Yang --- files/image_config/interfaces/interfaces-config.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index bd5111a01f73..28396774bfa1 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -12,6 +12,9 @@ fi sonic-cfggen -d -a '{"hwaddr":"'$SYSTEM_MAC_ADDRESS'"}' -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces +# Also store the system mac to configDB switch table. User configured switch_mac is not supported for now. +/usr/bin/docker exec database redis-cli -n 4 hset SWITCH\|SWITCH_ATTR switch_mac $SYSTEM_MAC_ADDRESS + [ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid systemctl restart networking From 7406d3709bbd8da3f5749151519dfc6a7ce4564c Mon Sep 17 00:00:00 2001 From: JipanYanga Date: Mon, 6 Nov 2017 00:37:16 -0600 Subject: [PATCH 0898/1833] [configdb]: Add support for vlanconfd and intfconfd (#1063) * Add support for vlanconfd and intfconfd Signed-off-by: Jipan Yang * Change name to vlanmgrd and intfmgrd Signed-off-by: Jipan Yang * Add missing vlan_members for parse_dpg result Signed-off-by: Jipan Yang * Remove cfgmgr debug CLI from image Signed-off-by: Jipan Yang * Update swss and swss-common submodules for VLAN trunk support Signed-off-by: Jipan Yang --- dockers/docker-orchagent/start.sh | 4 + dockers/docker-orchagent/supervisord.conf | 16 ++ files/image_config/interfaces/interfaces.j2 | 27 ---- src/sonic-config-engine/minigraph.py | 18 ++- .../tests/sample_output/interfaces | 153 ------------------ src/sonic-config-engine/tests/test_cfggen.py | 7 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 8 files changed, 40 insertions(+), 189 deletions(-) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index aa4e5b7dae1d..9f3ba3cb078d 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -22,6 +22,10 @@ supervisorctl start neighsyncd supervisorctl start swssconfig +supervisorctl start vlanmgrd + +supervisorctl start intfmgrd + # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 09850b13d4a1..95e92be622bb 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -67,3 +67,19 @@ autostart=false autorestart=true stdout_logfile=syslog stderr_logfile=syslog + +[program:vlanmgrd] +command=/usr/bin/vlanmgrd +priority=9 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:intfmgrd] +command=/usr/bin/intfmgrd +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 2fdd04804ca4..a06ff91518a7 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -55,19 +55,6 @@ iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # {% endfor %} -{% if VLAN %} -# "|| true" is added to suppress the error when interface is already a member of VLAN -{% for vlan in VLAN.keys()|sort %} -{% for member in VLAN[vlan]['members'] %} -allow-hotplug {{ member }} -iface {{ member }} inet manual - pre-up ifconfig {{ member }} up mtu 9100 - post-up brctl addif {{ vlan }} {{ member }} || true - post-down ifconfig {{ member }} down -# -{% endfor %} -{% endfor %} -{% endif %} {% if PORTCHANNEL %} # "|| true" is added to suppress the error when interface is already a member of LAG # "ip link show | grep -q master" is added to ensure interface is enslaved @@ -83,20 +70,6 @@ iface {{ member }} inet manual {% endfor %} {% endif %} {% endblock front_panel_interfaces %} -{% block vlan_interfaces %} -{% if VLAN_INTERFACE %} -# Vlan interfaces -{% for (name, prefix) in VLAN_INTERFACE.keys() | sort %} -auto {{ name }} -iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static - bridge_ports none - hwaddress ether {{ hwaddr }} - address {{ prefix | ip }} - netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} -{% endfor %} -# -{% endif %} -{% endblock vlan_interfaces %} {% block pc_interfaces %} {% if PORTCHANNEL_INTERFACE %} # Portchannel interfaces diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index c51b24afed08..826997063349 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -24,7 +24,7 @@ ns1 = "http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" ns2 = "Microsoft.Search.Autopilot.NetMux" ns3 = "http://www.w3.org/2001/XMLSchema-instance" - +KEY_SEPARATOR = '|' class minigraph_encoder(json.JSONEncoder): def default(self, obj): @@ -86,7 +86,7 @@ def parse_png(png, hname): if child.tag == str(QName(ns, "Devices")): for device in child.findall(str(QName(ns, "Device"))): (lo_prefix, mgmt_prefix, name, hwsku, d_type) = parse_device(device) - device_data = {'lo_addr': lo_prefix, 'type': d_type, 'mgmt_addr': mgmt_prefix, 'hwsku': hwsku } + device_data = {'lo_addr': lo_prefix, 'type': d_type, 'mgmt_addr': mgmt_prefix, 'hwsku': hwsku } devices[name] = device_data if child.tag == str(QName(ns, "DeviceInterfaceLinks")): @@ -153,6 +153,7 @@ def parse_dpg(dpg, hname): vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) vlan_intfs = [] vlans = {} + vlan_members = {} for vintf in vlanintfs.findall(str(QName(ns, "VlanInterface"))): vintfname = vintf.find(str(QName(ns, "Name"))).text vlanid = vintf.find(str(QName(ns, "VlanID"))).text @@ -160,7 +161,10 @@ def parse_dpg(dpg, hname): vmbr_list = vintfmbr.split(';') for i, member in enumerate(vmbr_list): vmbr_list[i] = port_alias_map.get(member, member) - vlan_attributes = {'members': vmbr_list, 'vlanid': vlanid} + sonic_vlan_member_name = "Vlan%s%s%s" % (vlanid, KEY_SEPARATOR, vmbr_list[i]) + vlan_members[sonic_vlan_member_name] = {'tagging_mode': 'untagged'} + + vlan_attributes = {'vlanid': vlanid} # If this VLAN requires a DHCP relay agent, it will contain a element # containing a list of DHCP server IPs @@ -194,8 +198,8 @@ def parse_dpg(dpg, hname): break; if acl_intfs: acls[aclname] = { 'policy_desc': aclname, 'ports': acl_intfs, 'type': 'MIRROR' if is_mirror else 'L3'} - return intfs, lo_intfs, mgmt_intf, vlans, pcs, acls - return None, None, None, None, None, None + return intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, acls + return None, None, None, None, None, None, None def parse_cpg(cpg, hname): @@ -318,6 +322,7 @@ def parse_xml(filename, platform=None, port_config_file=None): vlan_intfs = None pc_intfs = None vlans = None + vlan_members = None pcs = None mgmt_intf = None lo_intf = None @@ -345,7 +350,7 @@ def parse_xml(filename, platform=None, port_config_file=None): port_alias_map.update(alias_map) for child in root: if child.tag == str(QName(ns, "DpgDec")): - (intfs, lo_intfs, mgmt_intf, vlans, pcs, acls) = parse_dpg(child, hostname) + (intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, acls) = parse_dpg(child, hostname) elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_asn, bgp_peers_with_range) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): @@ -393,6 +398,7 @@ def parse_xml(filename, platform=None, port_config_file=None): results['PORT'] = ports results['PORTCHANNEL'] = pcs results['VLAN'] = vlans + results['VLAN_MEMBER'] = vlan_members results['DEVICE_NEIGHBOR'] = neighbors results['DEVICE_NEIGHBOR_METADATA'] = { key:devices[key] for key in devices if key != hostname } diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index 89a23471a7ee..2d54e6dabb3d 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -39,151 +39,6 @@ iface eth0 inet6 static down ip -6 rule delete from 2603:10e2:0:2902::8/128 table default # # The switch front panel interfaces -# "|| true" is added to suppress the error when interface is already a member of VLAN -allow-hotplug fortyGigE0/4 -iface fortyGigE0/4 inet manual - pre-up ifconfig fortyGigE0/4 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/4 || true - post-down ifconfig fortyGigE0/4 down -# -allow-hotplug fortyGigE0/8 -iface fortyGigE0/8 inet manual - pre-up ifconfig fortyGigE0/8 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/8 || true - post-down ifconfig fortyGigE0/8 down -# -allow-hotplug fortyGigE0/12 -iface fortyGigE0/12 inet manual - pre-up ifconfig fortyGigE0/12 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/12 || true - post-down ifconfig fortyGigE0/12 down -# -allow-hotplug fortyGigE0/16 -iface fortyGigE0/16 inet manual - pre-up ifconfig fortyGigE0/16 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/16 || true - post-down ifconfig fortyGigE0/16 down -# -allow-hotplug fortyGigE0/20 -iface fortyGigE0/20 inet manual - pre-up ifconfig fortyGigE0/20 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/20 || true - post-down ifconfig fortyGigE0/20 down -# -allow-hotplug fortyGigE0/24 -iface fortyGigE0/24 inet manual - pre-up ifconfig fortyGigE0/24 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/24 || true - post-down ifconfig fortyGigE0/24 down -# -allow-hotplug fortyGigE0/28 -iface fortyGigE0/28 inet manual - pre-up ifconfig fortyGigE0/28 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/28 || true - post-down ifconfig fortyGigE0/28 down -# -allow-hotplug fortyGigE0/32 -iface fortyGigE0/32 inet manual - pre-up ifconfig fortyGigE0/32 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/32 || true - post-down ifconfig fortyGigE0/32 down -# -allow-hotplug fortyGigE0/36 -iface fortyGigE0/36 inet manual - pre-up ifconfig fortyGigE0/36 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/36 || true - post-down ifconfig fortyGigE0/36 down -# -allow-hotplug fortyGigE0/40 -iface fortyGigE0/40 inet manual - pre-up ifconfig fortyGigE0/40 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/40 || true - post-down ifconfig fortyGigE0/40 down -# -allow-hotplug fortyGigE0/44 -iface fortyGigE0/44 inet manual - pre-up ifconfig fortyGigE0/44 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/44 || true - post-down ifconfig fortyGigE0/44 down -# -allow-hotplug fortyGigE0/48 -iface fortyGigE0/48 inet manual - pre-up ifconfig fortyGigE0/48 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/48 || true - post-down ifconfig fortyGigE0/48 down -# -allow-hotplug fortyGigE0/52 -iface fortyGigE0/52 inet manual - pre-up ifconfig fortyGigE0/52 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/52 || true - post-down ifconfig fortyGigE0/52 down -# -allow-hotplug fortyGigE0/56 -iface fortyGigE0/56 inet manual - pre-up ifconfig fortyGigE0/56 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/56 || true - post-down ifconfig fortyGigE0/56 down -# -allow-hotplug fortyGigE0/60 -iface fortyGigE0/60 inet manual - pre-up ifconfig fortyGigE0/60 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/60 || true - post-down ifconfig fortyGigE0/60 down -# -allow-hotplug fortyGigE0/64 -iface fortyGigE0/64 inet manual - pre-up ifconfig fortyGigE0/64 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/64 || true - post-down ifconfig fortyGigE0/64 down -# -allow-hotplug fortyGigE0/68 -iface fortyGigE0/68 inet manual - pre-up ifconfig fortyGigE0/68 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/68 || true - post-down ifconfig fortyGigE0/68 down -# -allow-hotplug fortyGigE0/72 -iface fortyGigE0/72 inet manual - pre-up ifconfig fortyGigE0/72 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/72 || true - post-down ifconfig fortyGigE0/72 down -# -allow-hotplug fortyGigE0/76 -iface fortyGigE0/76 inet manual - pre-up ifconfig fortyGigE0/76 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/76 || true - post-down ifconfig fortyGigE0/76 down -# -allow-hotplug fortyGigE0/80 -iface fortyGigE0/80 inet manual - pre-up ifconfig fortyGigE0/80 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/80 || true - post-down ifconfig fortyGigE0/80 down -# -allow-hotplug fortyGigE0/84 -iface fortyGigE0/84 inet manual - pre-up ifconfig fortyGigE0/84 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/84 || true - post-down ifconfig fortyGigE0/84 down -# -allow-hotplug fortyGigE0/88 -iface fortyGigE0/88 inet manual - pre-up ifconfig fortyGigE0/88 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/88 || true - post-down ifconfig fortyGigE0/88 down -# -allow-hotplug fortyGigE0/92 -iface fortyGigE0/92 inet manual - pre-up ifconfig fortyGigE0/92 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/92 || true - post-down ifconfig fortyGigE0/92 down -# -allow-hotplug fortyGigE0/96 -iface fortyGigE0/96 inet manual - pre-up ifconfig fortyGigE0/96 up mtu 9100 - post-up brctl addif Vlan1000 fortyGigE0/96 || true - post-down ifconfig fortyGigE0/96 down -# # "|| true" is added to suppress the error when interface is already a member of LAG # "ip link show | grep -q master" is added to ensure interface is enslaved allow-hotplug fortyGigE0/112 @@ -210,14 +65,6 @@ iface fortyGigE0/124 inet manual post-up ip link show fortyGigE0/124 | grep -q master && ifconfig fortyGigE0/124 up post-down ifconfig fortyGigE0/124 down # -# Vlan interfaces -auto Vlan1000 -iface Vlan1000 inet static - bridge_ports none - hwaddress ether e4:1d:2d:a5:f3:ad - address 192.168.0.1 - netmask 255.255.255.224 -# # Portchannel interfaces allow-hotplug PortChannel01 iface PortChannel01 inet static diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 31663077c434..47cc006f4662 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -88,7 +88,12 @@ def test_minigraph_interfaces(self): def test_minigraph_vlans(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'Vlan1000': {'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'members': ['Ethernet8'], 'vlanid': '1000'}}") + self.assertEqual(output.strip(), "{'Vlan1000': {'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}}") + + def test_minigraph_vlan_members(self): + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN_MEMBER' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'Vlan1000|Ethernet8': {'tagging_mode': 'untagged'}}") def test_minigraph_vlan_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "VLAN_INTERFACE.keys()"' diff --git a/src/sonic-swss b/src/sonic-swss index f90a4e1ef369..6e845042c1d9 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit f90a4e1ef369491b84a048cbf234f4cd3442d552 +Subproject commit 6e845042c1d9097bfe713a32dab7b414527962bf diff --git a/src/sonic-swss-common b/src/sonic-swss-common index a6f74b67a580..adf7d4cb3c22 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit a6f74b67a58074439d8f3dbf84fa8ecc0a2e06a6 +Subproject commit adf7d4cb3c22061bf781ef6ce7b79964ce505730 From 0e618033019ef6e956c9e980375c9a9dee55015e Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 6 Nov 2017 07:39:25 -0800 Subject: [PATCH 0899/1833] [swss]: update swss submodule (#1119) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 6e845042c1d9..8fc09d04a145 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 6e845042c1d9097bfe713a32dab7b414527962bf +Subproject commit 8fc09d04a14529dc83cca454536b9c6a2a1bdf38 From 8d3691e811d820fcc3a98eda7850a44fa412c743 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 6 Nov 2017 12:19:42 -0800 Subject: [PATCH 0900/1833] [sonic-platform-daemons]: Update submodule (#1120) --- src/sonic-platform-daemons | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index d68c286ba7c9..d1df4717627a 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit d68c286ba7c984c98ebfafc2bb5fe24905659e5f +Subproject commit d1df4717627acf9421861545b71e411acf3c5f32 From 7540893471095a07f6656411139687835c8f7726 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Mon, 6 Nov 2017 16:44:02 -0800 Subject: [PATCH 0901/1833] Submodule update for sonic-swss (#1123) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 8fc09d04a145..b641aeeac349 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 8fc09d04a14529dc83cca454536b9c6a2a1bdf38 +Subproject commit b641aeeac349462dd3e3e370bfc55f16602c937f From 28eb62fcff1a5147012bd4eb5af69df931290380 Mon Sep 17 00:00:00 2001 From: YonatanPitz Date: Tue, 7 Nov 2017 08:45:50 +0200 Subject: [PATCH 0902/1833] [saip4]: New p4 platform based on SAI behavioral model software switch (#1117) * merged new p4 platform from 1.0.3 * reverted SAI-P4-BM to SAI1.0 * changed port_config.ini from alias to name. changed tenjin makefile to https * updated SAI-P4-BM commit --- .gitmodules | 12 +++---- platform/p4/SAI-P4-BM | 1 + platform/p4/docker-sonic-p4.mk | 12 +++---- platform/p4/docker-sonic-p4/Dockerfile.j2 | 1 + platform/p4/docker-sonic-p4/port_config.ini | 38 ++++++++++++++++++--- platform/p4/docker-sonic-p4/rsyslog.conf | 2 ++ platform/p4/docker-sonic-p4/run_bm.sh | 23 +++++++++++++ platform/p4/docker-sonic-p4/startup.sh | 12 +++---- platform/p4/p4-bmv.mk | 6 ++-- platform/p4/p4-bmv/behavioral-model | 1 - platform/p4/p4-hlir.mk | 4 +++ platform/p4/p4-hlir/p4-hlir-v1.1 | 1 + platform/p4/p4-switch.mk | 12 +++---- platform/p4/p4-switch/Makefile | 17 --------- platform/p4/p4-switch/switch | 1 - platform/p4/p4c-bm.mk | 4 +-- platform/p4/rules.mk | 8 +++-- platform/p4/tenjin/Makefile | 2 +- 18 files changed, 100 insertions(+), 57 deletions(-) create mode 160000 platform/p4/SAI-P4-BM create mode 100755 platform/p4/docker-sonic-p4/run_bm.sh delete mode 160000 platform/p4/p4-bmv/behavioral-model create mode 160000 platform/p4/p4-hlir/p4-hlir-v1.1 delete mode 100644 platform/p4/p4-switch/Makefile delete mode 160000 platform/p4/p4-switch/switch diff --git a/.gitmodules b/.gitmodules index cc2b5b416028..26763fb16012 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,12 +10,6 @@ [submodule "sonic-swss"] path = src/sonic-swss url = https://github.com/Azure/sonic-swss -[submodule "src/p4-switch/switch"] - path = platform/p4/p4-switch/switch - url = https://github.com/krambn/switch -[submodule "src/p4-bmv2/behavioral-model"] - path = platform/p4/p4-bmv/behavioral-model - url = https://github.com/krambn/behavioral-model [submodule "src/p4c-bm/p4c-bm"] path = platform/p4/p4c-bm/p4c-bm url = https://github.com/krambn/p4c-bm @@ -68,3 +62,9 @@ [submodule "src/sonic-frr/frr"] path = src/sonic-frr/frr url = https://github.com/FRRouting/frr.git +[submodule "platform/p4/p4-hlir/p4-hlir-v1.1"] + path = platform/p4/p4-hlir/p4-hlir-v1.1 + url = https://github.com/p4lang/p4-hlir.git +[submodule "platform/p4/SAI-P4-BM"] + path = platform/p4/SAI-P4-BM + url = https://github.com/Mellanox/SAI-P4-BM.git diff --git a/platform/p4/SAI-P4-BM b/platform/p4/SAI-P4-BM new file mode 160000 index 000000000000..c25b5aecabbb --- /dev/null +++ b/platform/p4/SAI-P4-BM @@ -0,0 +1 @@ +Subproject commit c25b5aecabbb09270dc805459434ee396792ccb3 diff --git a/platform/p4/docker-sonic-p4.mk b/platform/p4/docker-sonic-p4.mk index a23284e50374..b5a63773fbbe 100644 --- a/platform/p4/docker-sonic-p4.mk +++ b/platform/p4/docker-sonic-p4.mk @@ -4,13 +4,13 @@ DOCKER_SONIC_P4 = docker-sonic-p4.gz $(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4 $(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) -ifeq ($(ROUTING_STACK), quagga) +# ifeq ($(ROUTING_STACK), quagga) $(DOCKER_SONIC_P4)_DEPENDS += $(QUAGGA) -else ifeq ($(ROUTING_STACK), frr) -$(DOCKER_SONIC_P4)_DEPENDS += $(FRR) -else -$(DOCKER_SONIC_P4)_DEPENDS += $(GOBGP) -endif +# else ifeq ($(ROUTING_STACK), frr) +# $(DOCKER_SONIC_P4)_DEPENDS += $(FRR) +# else +# $(DOCKER_SONIC_P4)_DEPENDS += $(GOBGP) +# endif $(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_P4) diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index 1b8d1746b2bb..debb89de9c14 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -20,6 +20,7 @@ debs/{{ deb }}{{' '}} ADD port_config.ini /port_config.ini ADD startup.sh /scripts/startup.sh +ADD run_bm.sh /scripts/run_bm.sh ADD rsyslog.conf /etc/rsyslog.conf diff --git a/platform/p4/docker-sonic-p4/port_config.ini b/platform/p4/docker-sonic-p4/port_config.ini index 574f8f976ef9..2a88c4a7235b 100644 --- a/platform/p4/docker-sonic-p4/port_config.ini +++ b/platform/p4/docker-sonic-p4/port_config.ini @@ -1,5 +1,33 @@ -# alias lanes -Ethernet0 1 -Ethernet1 2 -Ethernet2 3 -Ethernet3 4 +# name lanes +Ethernet0 0 +Ethernet1 1 +Ethernet2 2 +Ethernet3 3 +Ethernet4 4 +Ethernet5 5 +Ethernet6 6 +Ethernet7 7 +Ethernet8 8 +Ethernet9 9 +Ethernet10 10 +Ethernet11 11 +Ethernet12 12 +Ethernet13 13 +Ethernet14 14 +Ethernet15 15 +Ethernet16 16 +Ethernet17 17 +Ethernet18 18 +Ethernet19 19 +Ethernet20 20 +Ethernet21 21 +Ethernet22 22 +Ethernet23 23 +Ethernet24 24 +Ethernet25 25 +Ethernet26 26 +Ethernet27 27 +Ethernet28 28 +Ethernet29 29 +Ethernet30 30 +Ethernet31 31 \ No newline at end of file diff --git a/platform/p4/docker-sonic-p4/rsyslog.conf b/platform/p4/docker-sonic-p4/rsyslog.conf index 3480e18f9998..9afd889f500b 100644 --- a/platform/p4/docker-sonic-p4/rsyslog.conf +++ b/platform/p4/docker-sonic-p4/rsyslog.conf @@ -31,6 +31,8 @@ $ModLoad imuxsock # provides support for local system logging ########################### #Set remote syslog server *.* @172.17.0.1:514 +#Set local syslog +#*.* /var/log/messages # # Use traditional timestamp format. diff --git a/platform/p4/docker-sonic-p4/run_bm.sh b/platform/p4/docker-sonic-p4/run_bm.sh new file mode 100755 index 000000000000..66cea4f5d5cf --- /dev/null +++ b/platform/p4/docker-sonic-p4/run_bm.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# handler() +# { + # kill -s INT $ROUTER_PID + # kill -s INT $BRIDGE_PID +# } + +set -m +ip netns exec sw_net simple_switch -i 0@router_port1 -i 250@router_cpu_port --thrift-port 9091 --log-file /tmp/router_log --log-flush --notifications-addr ipc:///tmp/bmv2-router-notifications.ipc /usr/share/p4-sai-bm/sai_router.json & +export ROUTER_PID=$! +ip netns exec sw_net simple_switch -i 0@sw_port0 -i 1@sw_port1 -i 2@sw_port2 -i 3@sw_port3 -i 4@sw_port4 -i 5@sw_port5 -i 6@sw_port6 -i 7@sw_port7 -i 7@sw_port7 -i 8@sw_port8 -i 9@sw_port9 -i 10@sw_port10 -i 11@sw_port11 -i 12@sw_port12 -i 13@sw_port13 -i 14@sw_port14 -i 15@sw_port15 -i 16@sw_port16 -i 17@sw_port17 -i 18@sw_port18 -i 19@sw_port19 -i 20@sw_port20 -i 21@sw_port21 -i 22@sw_port22 -i 23@sw_port23 -i 24@sw_port24 -i 25@sw_port25 -i 26@sw_port26 -i 27@sw_port27 -i 28@sw_port28 -i 29@sw_port29 -i 30@sw_port30 -i 31@sw_port31 -i 250@cpu_port -i 251@router_port0 --log-file /tmp/bridge_log --log-flush /usr/share/p4-sai-bm/sai_bridge.json & +export BRIDGE_PID=$! +sleep 10 +simple_switch_CLI --pre SimplePreLAG < /usr/share/p4-sai-bm/bridge_default_config.txt +simple_switch_CLI < /usr/share/p4-sai-bm/bridge_default_config_mirror.txt +simple_switch_CLI --pre SimplePreLAG --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config.txt +simple_switch_CLI --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config_mirror.txt + +# echo "router and bridge are running send SIGINT to close" + +# trap handler INT +# sleep inf +# sudo kill -s SIGINT 3319 diff --git a/platform/p4/docker-sonic-p4/startup.sh b/platform/p4/docker-sonic-p4/startup.sh index 18cd4716580b..5880d431674c 100755 --- a/platform/p4/docker-sonic-p4/startup.sh +++ b/platform/p4/docker-sonic-p4/startup.sh @@ -8,16 +8,16 @@ rm -f /var/run/rsyslogd.pid service rsyslog start echo "Start redis server" -service redis-server start +service redis-server start & +sleep 3 -echo "Veth setup" -/usr/share/bmpd/tools/veth_setup.sh > /tmp/veth_setup.log 2>&1 +redis-cli flushall -echo "Disable IPv6" -/usr/share/bmpd/tools/veth_disable_ipv6.sh > /tmp/veth_disable.log 2>&1 +echo "Veth setup" +veth_setup.sh > /tmp/veth_setup.log 2>&1 echo "Start BMV2" -/run_bm.sh > /tmp/run_bm.log 2>&1 & +/scripts/run_bm.sh > /tmp/run_bm.log 2>&1 & sleep 15 redis-cli -n 1 set LOGLEVEL DEBUG diff --git a/platform/p4/p4-bmv.mk b/platform/p4/p4-bmv.mk index 6fe00d189eb7..affb0d5ac824 100644 --- a/platform/p4/p4-bmv.mk +++ b/platform/p4/p4-bmv.mk @@ -1,7 +1,7 @@ # p4 bmv package -P4_BMV = p4-bmv2_1.0.0_amd64.deb -$(P4_BMV)_DEPENDS += $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) +P4_BMV = sai-p4-bm_1.0.0_amd64.deb +$(P4_BMV)_DEPENDS += $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(P4C_BM) $(P4_BMV)_RDEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(THRIFT_COMPILER) -$(P4_BMV)_SRC_PATH = $(PLATFORM_PATH)/p4-bmv/behavioral-model +$(P4_BMV)_SRC_PATH = $(PLATFORM_PATH)/SAI-P4-BM/p4-switch SONIC_DPKG_DEBS += $(P4_BMV) diff --git a/platform/p4/p4-bmv/behavioral-model b/platform/p4/p4-bmv/behavioral-model deleted file mode 160000 index a6ccf267bc9c..000000000000 --- a/platform/p4/p4-bmv/behavioral-model +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a6ccf267bc9c5c31fd40fe5841893e38e03abeb4 diff --git a/platform/p4/p4-hlir.mk b/platform/p4/p4-hlir.mk index 2873275983a9..61307c7ff79a 100644 --- a/platform/p4/p4-hlir.mk +++ b/platform/p4/p4-hlir.mk @@ -1,5 +1,9 @@ # p4 bmv package +P4_HLIR_V1_1 = python-p4-hlir-v1-1_1.1.7-1_all.deb +$(P4_HLIR_V1_1)_SRC_PATH = $(PLATFORM_PATH)/p4-hlir/p4-hlir-v1.1 +SONIC_PYTHON_STDEB_DEBS += $(P4_HLIR_V1_1) + P4_HLIR = python-p4-hlir_0.9.36-1_all.deb $(P4_HLIR)_SRC_PATH = $(PLATFORM_PATH)/p4-hlir/p4-hlir SONIC_PYTHON_STDEB_DEBS += $(P4_HLIR) diff --git a/platform/p4/p4-hlir/p4-hlir-v1.1 b/platform/p4/p4-hlir/p4-hlir-v1.1 new file mode 160000 index 000000000000..fdee55e2567f --- /dev/null +++ b/platform/p4/p4-hlir/p4-hlir-v1.1 @@ -0,0 +1 @@ +Subproject commit fdee55e2567fe65463f328d70558b5079894b420 diff --git a/platform/p4/p4-switch.mk b/platform/p4/p4-switch.mk index 6fc07f908779..fb092fa2c5f3 100644 --- a/platform/p4/p4-switch.mk +++ b/platform/p4/p4-switch.mk @@ -1,7 +1,7 @@ -# p4 switch package +# p4 sai adapter package -P4_SWITCH = p4-switch_1.0.0_amd64.deb -$(P4_SWITCH)_DEPENDS += $(P4C_BM) $(P4_BMV) -$(P4_SWITCH)_RDEPENDS += $(P4C_BM) $(P4_BMV) -$(P4_SWITCH)_SRC_PATH = $(PLATFORM_PATH)/p4-switch -SONIC_MAKE_DEBS += $(P4_SWITCH) +P4_SWITCH = p4-sai-adapter_0.1-0_amd64.deb +$(P4_SWITCH)_DEPENDS += $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(P4_BMV) +$(P4_SWITCH)_RDEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(P4_BMV) +$(P4_SWITCH)_SRC_PATH = $(PLATFORM_PATH)/SAI-P4-BM/sai_adapter +SONIC_DPKG_DEBS += $(P4_SWITCH) diff --git a/platform/p4/p4-switch/Makefile b/platform/p4/p4-switch/Makefile deleted file mode 100644 index 57f6a05999a1..000000000000 --- a/platform/p4/p4-switch/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -SHELL = /bin/bash -.ONESHELL: - -MAIN_TARGET = p4-switch_1.0.0_amd64.deb - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - pushd switch - - mkdir -p p4-build/bmv2/switch - mkdir -p p4-build/bmv2/pd_thrift_gen - - ./autogen.sh - dpkg-buildpackage -us -uc -b -j4 - - popd - - mv $* $(DEST)/ diff --git a/platform/p4/p4-switch/switch b/platform/p4/p4-switch/switch deleted file mode 160000 index e934752f356d..000000000000 --- a/platform/p4/p4-switch/switch +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e934752f356d3ad48cbec99067f47c83795ddcec diff --git a/platform/p4/p4c-bm.mk b/platform/p4/p4c-bm.mk index f51595772c3a..1982ee359212 100644 --- a/platform/p4/p4c-bm.mk +++ b/platform/p4/p4c-bm.mk @@ -2,6 +2,6 @@ P4C_BM = python-p4c-bm_1.0.0-5415c416-1_all.deb $(P4C_BM)_SRC_PATH = $(PLATFORM_PATH)/p4c-bm/p4c-bm -$(P4C_BM)_DEPENDS += $(TENJIN) $(P4_HLIR) -$(P4C_BM)_RDEPENDS += $(TENJIN) $(P4_HLIR) +$(P4C_BM)_DEPENDS += $(TENJIN) $(P4_HLIR) $(P4_HLIR_V1_1) +$(P4C_BM)_RDEPENDS += $(TENJIN) $(P4_HLIR) $(P4_HLIR_V1_1) SONIC_PYTHON_STDEB_DEBS += $(P4C_BM) diff --git a/platform/p4/rules.mk b/platform/p4/rules.mk index 408a58041f56..20def91333c6 100644 --- a/platform/p4/rules.mk +++ b/platform/p4/rules.mk @@ -1,8 +1,10 @@ -include $(PLATFORM_PATH)/p4-switch.mk -include $(PLATFORM_PATH)/p4-bmv.mk +# include $(PLATFORM_PATH)/p4-softswitch.mk +include $(PLATFORM_PATH)/tenjin.mk include $(PLATFORM_PATH)/p4-hlir.mk include $(PLATFORM_PATH)/p4c-bm.mk -include $(PLATFORM_PATH)/tenjin.mk +# include $(PLATFORM_PATH)/p4-sai-bm.mk +include $(PLATFORM_PATH)/p4-bmv.mk +include $(PLATFORM_PATH)/p4-switch.mk include $(PLATFORM_PATH)/docker-sonic-p4.mk SONIC_ALL += $(DOCKER_SONIC_P4) diff --git a/platform/p4/tenjin/Makefile b/platform/p4/tenjin/Makefile index 3f36866fe0de..83b27d390abc 100644 --- a/platform/p4/tenjin/Makefile +++ b/platform/p4/tenjin/Makefile @@ -9,7 +9,7 @@ MAIN_TARGET = python-tenjin_$(TENJIN_VERSION_FULL)_all.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf Tenjin-$(TENJIN_VERSION) - wget -nc http://pypi.python.org/packages/source/T/Tenjin/Tenjin-$(TENJIN_VERSION).tar.gz + wget -nc https://pypi.python.org/packages/source/T/Tenjin/Tenjin-$(TENJIN_VERSION).tar.gz tar xzf Tenjin-$(TENJIN_VERSION).tar.gz pushd Tenjin-$(TENJIN_VERSION) From 1ce9b85e3cc02b2461778a66fc7d83bed13510be Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 6 Nov 2017 23:40:27 -0800 Subject: [PATCH 0903/1833] [init]: save the initial switch mac to config db (#1125) * [init]: save the initial switch mac to config db Save the initial switch mac to config db DEVICE_METADATA|localhost entry. * update sonic-swss submodule --- files/build_templates/swss.service.j2 | 1 + .../interfaces/interfaces-config.sh | 15 +------ files/image_config/platform/rc.local | 44 ++++++++++++++----- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 5 files changed, 37 insertions(+), 27 deletions(-) diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 74fafb003767..ad52f395d0cf 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -18,6 +18,7 @@ ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 5 FLUSHDB +ExecStartPre=/usr/bin/docker exec database redis-cli -n 6 FLUSHDB {% if sonic_asic_platform == 'mellanox' %} TimeoutStartSec=3min diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 28396774bfa1..06174790f04a 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,19 +1,6 @@ #!/bin/bash -SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) -SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') - -# Align last byte of MAC if necessary -if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then - last_byte=$(python -c "print '$SYSTEM_MAC_ADDRESS'[-2:]") - aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix - SYSTEM_MAC_ADDRESS=$(python -c "print '$SYSTEM_MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC -fi - -sonic-cfggen -d -a '{"hwaddr":"'$SYSTEM_MAC_ADDRESS'"}' -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces - -# Also store the system mac to configDB switch table. User configured switch_mac is not supported for now. -/usr/bin/docker exec database redis-cli -n 4 hset SWITCH\|SWITCH_ATTR switch_mac $SYSTEM_MAC_ADDRESS +sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces [ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index d3ecba7d8518..daeccfd5240d 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -43,6 +43,15 @@ firsttime_exit() exit 0 } +test_config() +{ + if [ -d /host/old_config ] && ( [ -f /host/old_config/minigraph.xml ] || [ -f /host/old_config/config_db.json ] ); then + return 0 + fi + + return 1 +} + # Given a string of tuples of the form field=value, extract the value for a field # In : $string, $field # Out: $value @@ -70,26 +79,39 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then firsttime_exit fi + # setup initial switch mac + SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) + SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') + + # Align last byte of MAC if necessary + if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then + last_byte=$(python -c "print '$SYSTEM_MAC_ADDRESS'[-2:]") + aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix + SYSTEM_MAC_ADDRESS=$(python -c "print '$SYSTEM_MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC + fi + + if [ -f /etc/sonic/init_cfg.json ]; then + sonic-cfggen -j /etc/sonic/init_cfg.json -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json + else + sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json + fi + # Try to take old configuration saved during installation - if [ -d /host/old_config ]; then + if test_config; then rm -f /host/old_config/sonic_version.yml mv -f /host/old_config/* /etc/sonic/ + if [ ! -f /etc/sonic/config_db.json ]; then + sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + fi elif [ -f /host/minigraph.xml ]; then mv /host/minigraph.xml /etc/sonic/ # Combine information in minigraph and init_cfg.json to form initiate config DB dump file. # TODO: After moving all information from minigraph to DB, sample config DB dump should be provide - if [ -f /etc/sonic/init_cfg.json ]; then - sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json - else - sonic-cfggen -m --print-data > /etc/sonic/config_db.json - fi + sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json else + # Use default minigraph.xml cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ - if [ -f /etc/sonic/init_cfg.json ]; then - sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json - else - sonic-cfggen -m --print-data > /etc/sonic/config_db.json - fi + sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json fi if [ -d /host/image-$sonic_version/platform/$platform ]; then diff --git a/src/sonic-swss b/src/sonic-swss index b641aeeac349..5da255c78cb5 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit b641aeeac349462dd3e3e370bfc55f16602c937f +Subproject commit 5da255c78cb5d02a49b0a5299764c325ed0bdc32 diff --git a/src/sonic-utilities b/src/sonic-utilities index 1d37c9c199b7..0a720caa0101 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 1d37c9c199b7934653f907095bf11e685889df23 +Subproject commit 0a720caa0101ebbd38309c97d4069e2545bc3259 From f7c39720f73b2eb2df290843cfecf3be911cb7ba Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 7 Nov 2017 14:51:07 -0800 Subject: [PATCH 0904/1833] Restart ntp after ntp-config (#1106) * Restart ntp after ntp-config * Remove ntp dependency to ntp-config --- files/image_config/ntp/ntp-config.service | 1 - files/image_config/ntp/ntp-config.sh | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/files/image_config/ntp/ntp-config.service b/files/image_config/ntp/ntp-config.service index 05e6211b9782..d41f1ba2ddca 100644 --- a/files/image_config/ntp/ntp-config.service +++ b/files/image_config/ntp/ntp-config.service @@ -1,6 +1,5 @@ [Unit] Description=Update NTP configuration -Before=ntp.service Requires=database.service After=database.service diff --git a/files/image_config/ntp/ntp-config.sh b/files/image_config/ntp/ntp-config.sh index 7c79a16c0ef3..601b7bd421f0 100755 --- a/files/image_config/ntp/ntp-config.sh +++ b/files/image_config/ntp/ntp-config.sh @@ -1,3 +1,5 @@ #!/bin/bash sonic-cfggen -d -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf + +systemctl restart ntp From a9a37aab2378a311f2a22746546c7d118e25c93f Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 7 Nov 2017 14:52:20 -0800 Subject: [PATCH 0905/1833] [py-swsssdk]: Update sonic-py-swsssdk submodule (#1126) Include: [interface]: Extend the max data wait time to 60s Signed-off-by: Shu0T1an ChenG --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 294f5406e971..674fb107dfb8 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 294f5406e971396352b06c3b4954a2f80dd8ba34 +Subproject commit 674fb107dfb8e45b23a55e3e7be34e39d5630942 From cb009ba80710e8c475f3e4b5ecd7e9c01729e080 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 7 Nov 2017 15:19:47 -0800 Subject: [PATCH 0906/1833] [Broadcom]: Update Broadcom SAI package to 3.0.3.2-11 (#1127) Fix memory leak in multipath routing Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 5b66026f297f..015d85b24a5d 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-10_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-10_amd64.deb?sv=2015-04-05&sr=b&sig=tByZ7QDBsYlJ4UHbapnzqHYrbA8rD92%2FQXEpupITTmM%3D&se=2031-07-06T19%3A19%3A32Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-11_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-11_amd64.deb?sv=2015-04-05&sr=b&sig=sXvf3ejJ8npF9iPfkTIYUneN4N8wvHKo2V6A8YoTbhk%3D&se=2031-07-17T23%3A08%3A43Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-10_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-11_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-10_amd64.deb?sv=2015-04-05&sr=b&sig=T6U8sF%2BW8B%2FffBzPoUJ9peLcg2O9MunHBBKSu7SZOKo%3D&se=2031-07-06T19%3A19%3A52Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-11_amd64.deb?sv=2015-04-05&sr=b&sig=Q%2FSC7B0xDuhvHGL7GERoOw483nv6hkAQrDUaabS9JOs%3D&se=2031-07-17T23%3A09%3A08Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From c64d423fec2ab1e0aedd07591e9b4d0473ec3147 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 8 Nov 2017 18:50:22 +0200 Subject: [PATCH 0907/1833] [rc.local]: Fix init_cfg.json (#1129) If device MAC is added to init_cfg.json, it has to be done using intermediate file. We cannot redirect to same file while trying to read from it because it will be truncated first. Signed-off-by: marian-pritsak --- files/image_config/platform/rc.local | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index daeccfd5240d..f4dd9cb3ad78 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -91,7 +91,8 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then fi if [ -f /etc/sonic/init_cfg.json ]; then - sonic-cfggen -j /etc/sonic/init_cfg.json -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json + sonic-cfggen -j /etc/sonic/init_cfg.json -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /tmp/init_cfg.json + mv /tmp/init_cfg.json /etc/sonic/init_cfg.json else sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json fi From 4e367c69849397fd4e6a36fa0be2e9b5ed565843 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 8 Nov 2017 15:09:19 -0800 Subject: [PATCH 0908/1833] [Arista7260cx3] update port_config.ini for Arista-7260CX3-D108C8 (#1130) - Port 18 and 20 are now in 50G breakout mode. --- .../Arista-7260CX3-D108C8/port_config.ini | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini index 541b197f6bb8..d67a4f1bc016 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/port_config.ini @@ -33,10 +33,12 @@ Ethernet60 121,122 Ethernet16/1 16 Ethernet62 123,124 Ethernet16/3 16 Ethernet64 141,142 Ethernet17/1 17 Ethernet66 143,144 Ethernet17/3 17 -Ethernet68 133,134,135,136 Ethernet18/1 18 +Ethernet68 133,134 Ethernet18/1 18 +Ethernet70 135,136 Ethernet18/3 18 Ethernet72 197,198 Ethernet19/1 19 Ethernet74 199,200 Ethernet19/3 19 -Ethernet76 205,206,207,208 Ethernet20/1 20 +Ethernet76 205,206 Ethernet20/1 20 +Ethernet78 207,208 Ethernet20/3 20 Ethernet80 217,218 Ethernet21/1 21 Ethernet82 219,220 Ethernet21/3 21 Ethernet84 213,214 Ethernet22/1 22 From 8990dc73df7f1255bfa5113847d08720c1ab108e Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 8 Nov 2017 21:57:47 -0800 Subject: [PATCH 0909/1833] [doc]: change build badge url to new build server (#1134) --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index bbae2e150b8e..dc0e34a61476 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -*master*: Broadcom: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) -Mellanox: [![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) -P4: [![P4](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all) -VS: [![VS](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all) - -*201709*: Cavium: [![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) -Centec: [![Centec](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) -Nephos: [![Nephos](https://sonic-jenkins.westus.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/) -Marvell: [![Marvell](https://sonic-jenkins.westus.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/) +*master*: Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) +Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) +P4: [![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all) +VS: [![VS](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all) + +*201709*: Cavium: [![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) +Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) +Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/) +Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/) # sonic-buildimage From 69b8d28e0929cb1f506135bdef4d18c8618ecfa6 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 9 Nov 2017 23:17:06 +0200 Subject: [PATCH 0910/1833] [mellanox]: Update SAI revision (#1135) Includes fixes for SAI 1.0.2 version Update SX-SDK to 4.2.6011 Update FW to 13.1530.0152 Signed-off-by: marian-pritsak --- platform/mellanox/fw.mk | 2 +- platform/mellanox/mlnx-sai.mk | 4 ++-- platform/mellanox/sdk.mk | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 8c40d46d9182..201e5205daf7 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1400.0126 +MLNX_FW_VERSION = 13.1530.0152 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/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index bba10132160d..80b6d893da38 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = sonic1.9.1fixes-master -MLNX_SAI_REVISION = dc0e84b3762f847369524a917e271ceb2878b4d3 +MLNX_SAI_VERSION = SAIRel1.9.2-master +MLNX_SAI_REVISION = 16900748ee3c97bc5836ab3684ee05b8db6ec31b export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 7c517627c23d..ad34ba84e277 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/4ebc01e95b754c56da7f8b5fb45b82fbe661d05a/sdk -MLNX_SDK_VERSION = 4.2.5010 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/16900748ee3c97bc5836ab3684ee05b8db6ec31b/sdk +MLNX_SDK_VERSION = 4.2.6011 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) From a69b353630154935c02db0d287e1a760b2698167 Mon Sep 17 00:00:00 2001 From: Haiyang Zheng Date: Sat, 11 Nov 2017 05:54:31 +0800 Subject: [PATCH 0911/1833] [interfaces.j2] Get mtu value from config DB if provided (#1128) Signed-off-by: Haiyang Zheng --- files/image_config/interfaces/interfaces.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index a06ff91518a7..9298348d3fb8 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -50,7 +50,7 @@ iface eth0 inet dhcp {% for (name, prefix) in INTERFACE %} allow-hotplug {{ name }} iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static - mtu 9100 + mtu {{ PORT[name]['mtu'] if PORT[name]['mtu'] else 9100 }} address {{ prefix | ip }} netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # @@ -76,7 +76,7 @@ iface {{ member }} inet manual {% for (name, prefix) in PORTCHANNEL_INTERFACE.keys() | sort %} allow-hotplug {{ name }} iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static - mtu 9100 + mtu {{ PORTCHANNEL[name]['mtu'] if PORTCHANNEL[name]['mtu'] else 9100 }} address {{ prefix | ip }} netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} # From 764cb913f1fd34cc1d837fb1852d3401b3f46f07 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 10 Nov 2017 15:47:38 -0800 Subject: [PATCH 0912/1833] [Arista7260cx3] Increase /var/log partition size to 4G (#1140) --- files/Aboot/boot0.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 8ea085bf5e8d..18d1ee126c00 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -130,7 +130,7 @@ platform_specific() { aboot_machine=arista_7260cx3_64 fi if [ "$platform" = "rook" ]; then - varlog_size=200 + varlog_size=4096 readprefdl -f /tmp/.system-prefdl -d > /mnt/flash/.system-prefdl fi From d7969dd4be42fbe71d91c43e516e48dc25ad773d Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 10 Nov 2017 16:51:47 -0800 Subject: [PATCH 0913/1833] [swss] update swss submodule head (#1141) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 5da255c78cb5..092f3a06e290 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 5da255c78cb5d02a49b0a5299764c325ed0bdc32 +Subproject commit 092f3a06e2900fb4cc0364648f6ea840de937b57 From 757ba00b5817ec84baa91cd36dcf096bcb961b50 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Sun, 12 Nov 2017 15:29:32 -0800 Subject: [PATCH 0914/1833] [utilities]: update sonic-utilities submodule (#1143) Signed-off-by: Qi Luo --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 0a720caa0101..e87bb97760a4 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 0a720caa0101ebbd38309c97d4069e2545bc3259 +Subproject commit e87bb97760a4cf069da51b2a0da732f7a40f3215 From f18ed0d35cc3042f438eff76cba7f45ea0b6d176 Mon Sep 17 00:00:00 2001 From: nikos-li <31227248+nikos-li@users.noreply.github.com> Date: Mon, 13 Nov 2017 09:39:10 -0800 Subject: [PATCH 0915/1833] [bgp]: Auto-completion, help (?), cmd navigation (up arrow) not working in vtysh on host system. (#1124) --- dockers/docker-fpm-frr/base_image_files/vtysh | 2 +- dockers/docker-fpm-quagga/base_image_files/vtysh | 2 +- src/sonic-quagga | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockers/docker-fpm-frr/base_image_files/vtysh b/dockers/docker-fpm-frr/base_image_files/vtysh index 359101c06c61..18529b7522c7 100755 --- a/dockers/docker-fpm-frr/base_image_files/vtysh +++ b/dockers/docker-fpm-frr/base_image_files/vtysh @@ -1,2 +1,2 @@ #!/bin/bash -docker exec -i bgp vtysh "$@" +docker exec -it bgp vtysh "$@" diff --git a/dockers/docker-fpm-quagga/base_image_files/vtysh b/dockers/docker-fpm-quagga/base_image_files/vtysh index 359101c06c61..18529b7522c7 100755 --- a/dockers/docker-fpm-quagga/base_image_files/vtysh +++ b/dockers/docker-fpm-quagga/base_image_files/vtysh @@ -1,2 +1,2 @@ #!/bin/bash -docker exec -i bgp vtysh "$@" +docker exec -it bgp vtysh "$@" diff --git a/src/sonic-quagga b/src/sonic-quagga index b066bef0e8dc..59f7c8ed56fa 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit b066bef0e8dcf23b8e1751652397c09e61ee4bdd +Subproject commit 59f7c8ed56fa1c9df2070596b25f5f019bdba8ca From cd4b11c8112a3761936b63db9be8b99b01685bd9 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 13 Nov 2017 10:07:09 -0800 Subject: [PATCH 0916/1833] [build]: add build badge for broadcom and mellanox on 201709 release (#1147) --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dc0e34a61476..5ba616c027e0 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,13 @@ Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mell P4: [![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all) VS: [![VS](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all) -*201709*: Cavium: [![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) +*201709*: +Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/) +Cavium: [![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/) Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/) +Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/) # sonic-buildimage From bf1bb06e2ecfd46c280a7cc15ddfdf73cd3cc79a Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 13 Nov 2017 10:49:29 -0800 Subject: [PATCH 0917/1833] [swss]: update sonic-swss submodule (#1146) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 092f3a06e290..0be8b8b757e4 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 092f3a06e2900fb4cc0364648f6ea840de937b57 +Subproject commit 0be8b8b757e40ac9f66e8175a2f978a8cba312ac From aa09bdc2c264860ffd2a1cc13a9d0124b3f0fba4 Mon Sep 17 00:00:00 2001 From: Harish Venkatraman Date: Mon, 13 Nov 2017 11:30:16 -0800 Subject: [PATCH 0918/1833] [docker-orchagent]: ADD PFC Broadcom recommended MMU Settings (#1136) This commit adds new code to support PFC and broadcom recommended MMU setting for PFC feature. Verified by running checking the hardware setting after the switch was booted. Signed-off-by: Harish Venkatraman --- dockers/docker-orchagent/swssconfig.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 3458ddae61e6..aee3ffaaa8cb 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -33,6 +33,8 @@ if [ "$HWSKU" == "Force10-S6000" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [ "$HWSKU" == "Force10-S6000-Q32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +elif [ "$HWSKU" == "Force10-S6100" ]; then + SWSSCONFIG_ARGS+="th.64ports.buffers.json th.64ports.qos.json " elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [[ "$HWSKU" == "ACS-MSN27"* ]]; then From 3e03df7a5e2cef4cbdf4d0b60d66737e02fbd331 Mon Sep 17 00:00:00 2001 From: wadelnn Date: Tue, 14 Nov 2017 04:33:59 +0800 Subject: [PATCH 0919/1833] Fixed sfputil show eeprom information is empty on SFP ports. (#1145) Signed-off-by: Wade He --- .../ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py | 2 +- .../ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py index 0bb52e88616a..076ecff4d42d 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py @@ -168,7 +168,7 @@ def port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py index 0b1ae8d3bc8e..78793beec69d 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py @@ -102,7 +102,7 @@ def port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): From a6edef2fa52f5b7771cc5751cde1a190d96ffa50 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 13 Nov 2017 14:16:19 -0800 Subject: [PATCH 0920/1833] [docker-teamd]: Manage teamd and teamsyncd processes with supervisor (#1137) --- dockers/docker-teamd/Dockerfile.j2 | 7 +- dockers/docker-teamd/docker-teamd-init.sh | 43 +++++++++++++ dockers/docker-teamd/docker-teamd-start.sh | 9 +++ .../docker-teamd.supervisord.conf.j2 | 52 +++++++++++++++ dockers/docker-teamd/start.sh | 35 ---------- dockers/docker-teamd/teamd.sh | 27 ++------ .../docker-dhcp-relay.supervisord.conf | 9 ++- .../docker-teamd.supervisord.conf | 64 +++++++++++++++++++ .../tests/sample_output/wait_for_intf.sh | 28 ++++++++ src/sonic-config-engine/tests/test_j2files.py | 30 ++++++++- 10 files changed, 240 insertions(+), 64 deletions(-) create mode 100755 dockers/docker-teamd/docker-teamd-init.sh create mode 100755 dockers/docker-teamd/docker-teamd-start.sh create mode 100644 dockers/docker-teamd/docker-teamd.supervisord.conf.j2 delete mode 100755 dockers/docker-teamd/start.sh rename dockers/docker-teamd/supervisord.conf => src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf (58%) create mode 100644 src/sonic-config-engine/tests/sample_output/docker-teamd.supervisord.conf create mode 100644 src/sonic-config-engine/tests/sample_output/wait_for_intf.sh diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index f604433a6c3f..9fded5183c3c 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -22,11 +22,10 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY ["start.sh", "teamd.sh", "/usr/bin/"] -COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["teamd.j2", "/usr/share/sonic/templates/"] +COPY ["docker-teamd-init.sh", "docker-teamd-start.sh", "teamd.sh", "/usr/bin/"] +COPY ["docker-teamd.supervisord.conf.j2", "teamd.j2", "/usr/share/sonic/templates/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["/usr/bin/docker-teamd-init.sh"] diff --git a/dockers/docker-teamd/docker-teamd-init.sh b/dockers/docker-teamd/docker-teamd-init.sh new file mode 100755 index 000000000000..a06ca4e8f890 --- /dev/null +++ b/dockers/docker-teamd/docker-teamd-init.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +TEAMD_CONF_PATH="/etc/teamd" + +rm -rf $TEAMD_CONF_PATH +mkdir -p $TEAMD_CONF_PATH + +SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) +MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') + +# Align last byte +if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then + last_byte=$(python -c "print '$MAC_ADDRESS'[-2:]") + aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix + MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC +fi + +for pc in `sonic-cfggen -d -v "PORTCHANNEL.keys() | join(' ') if PORTCHANNEL"`; do + sonic-cfggen -d -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf + # bring down all member ports before starting teamd + for member in $(sonic-cfggen -d -v "PORTCHANNEL['$pc']['members'] | join(' ')" ); do + if [ -L /sys/class/net/$member ]; then + ip link set $member down + fi + done +done + +# Create a Python dictionary where the key is the Jinja2 variable name +# "lags" and the value is a list of dctionaries containing the name of +# the LAG and the path of the LAG config file. Then output this in +# JSON format, as we will pass it to sonic-cfggen as additional data +# below for generating the supervisord config file. +# Example output: {"lags": [{"name": "PortChannel1", "file": "/etc/teamd/PortChannel1.conf"}, {"name": "PortChannel2", "file": "/etc/teamd/PortChannel2.conf"}]} +LAG_INFO_DICT=$(python -c "import json,os,sys; lags_dict = {}; lags_dict['lags'] = [{'name': os.path.basename(file).split('.')[0], 'file': os.path.join('${TEAMD_CONF_PATH}', file)} for file in sorted(os.listdir('${TEAMD_CONF_PATH}'))]; sys.stdout.write(json.dumps(lags_dict))") + +# Generate supervisord config file +mkdir -p /etc/supervisor/conf.d/ +sonic-cfggen -d -a "${LAG_INFO_DICT}" -t /usr/share/sonic/templates/docker-teamd.supervisord.conf.j2 > /etc/supervisor/conf.d/docker-teamd.supervisord.conf + +# The Docker container should start this script as PID 1, so now that we +# have generated the proper supervisord configuration, we exec supervisord +# so that it runs as PID 1 for the duration of the container's lifetime +exec /usr/bin/supervisord diff --git a/dockers/docker-teamd/docker-teamd-start.sh b/dockers/docker-teamd/docker-teamd-start.sh new file mode 100755 index 000000000000..95b167d22b40 --- /dev/null +++ b/dockers/docker-teamd/docker-teamd-start.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +supervisorctl start teamd:* + +supervisorctl start teamsyncd diff --git a/dockers/docker-teamd/docker-teamd.supervisord.conf.j2 b/dockers/docker-teamd/docker-teamd.supervisord.conf.j2 new file mode 100644 index 000000000000..abd3203b3477 --- /dev/null +++ b/dockers/docker-teamd/docker-teamd.supervisord.conf.j2 @@ -0,0 +1,52 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:docker-teamd-start.sh] +command=/usr/bin/docker-teamd-start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +{# If there are LAGs... #} +{% if lags -%} +[group:teamd] +programs= +{%- set add_preceding_comma = { 'flag': False } -%} +{%- for lag in lags -%} +{%- if add_preceding_comma.flag %},{% endif -%} +{%- set _dummy = add_preceding_comma.update({'flag': True}) -%} +teamd-{{ lag['name'] }} +{%- endfor %} + +{# Create a program entry for each teamd instance #} +{% for lag in lags %} + +[program:teamd-{{ lag['name'] }}] +command=/usr/bin/teamd.sh {{ lag['file'] }} +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog +{% endfor %} + +[program:teamsyncd] +command=/usr/bin/teamsyncd +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog +{% endif %} diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh deleted file mode 100755 index 6e80f6eb9a83..000000000000 --- a/dockers/docker-teamd/start.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -TEAMD_CONF_PATH=/etc/teamd - -rm -rf $TEAMD_CONF_PATH -mkdir -p $TEAMD_CONF_PATH - -SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) -MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') - -# Align last byte -if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then - last_byte=$(python -c "print '$MAC_ADDRESS'[-2:]") - aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix - MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC -fi - -for pc in `sonic-cfggen -d -v "PORTCHANNEL.keys() | join(' ') if PORTCHANNEL"`; do - sonic-cfggen -d -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf - # bring down all member ports before starting teamd - for member in $(sonic-cfggen -d -v "PORTCHANNEL['$pc']['members'] | join(' ')" ); do - if [ -L /sys/class/net/$member ]; then - ip link set $member down - fi - done -done - -mkdir -p /var/sonic -echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status - -rm -f /var/run/rsyslogd.pid - -supervisorctl start rsyslogd - -supervisorctl start teamd diff --git a/dockers/docker-teamd/teamd.sh b/dockers/docker-teamd/teamd.sh index 2b6d9fb53970..7192a2bdeca2 100755 --- a/dockers/docker-teamd/teamd.sh +++ b/dockers/docker-teamd/teamd.sh @@ -1,28 +1,15 @@ #!/usr/bin/env bash -TEAMD_CONF_PATH=/etc/teamd - -function start_app { - rm -f /var/run/teamd/* - if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then - for f in $TEAMD_CONF_PATH/*; do - teamd -f $f -d - done - fi - teamsyncd & -} +TEAMD_CONF_FILE=$1 function clean_up { - if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then - for f in $TEAMD_CONF_PATH/*; do - teamd -f $f -k - done - fi - pkill -9 teamsyncd - exit + teamd -f $TEAMD_CONF_FILE -k + exit $? } trap clean_up SIGTERM SIGKILL -start_app -read +teamd -f $TEAMD_CONF_FILE & +TEAMD_PID=$! +wait $TEAMD_PID +exit $? diff --git a/dockers/docker-teamd/supervisord.conf b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf similarity index 58% rename from dockers/docker-teamd/supervisord.conf rename to src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf index 48ef0ca9f29e..f955546cdc09 100644 --- a/dockers/docker-teamd/supervisord.conf +++ b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf @@ -19,10 +19,15 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog -[program:teamd] -command=/usr/bin/teamd.sh +[group:isc-dhcp-relay] +programs=isc-dhcp-relay-Vlan1000 + +[program:isc-dhcp-relay-Vlan1000] +command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -i Vlan1000 -i PortChannel02 -i PortChannel03 -i PortChannel04 -i PortChannel01 192.0.0.1 192.0.0.2 priority=3 autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + + diff --git a/src/sonic-config-engine/tests/sample_output/docker-teamd.supervisord.conf b/src/sonic-config-engine/tests/sample_output/docker-teamd.supervisord.conf new file mode 100644 index 000000000000..83feaf05b8c8 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/docker-teamd.supervisord.conf @@ -0,0 +1,64 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:docker-teamd-start.sh] +command=/usr/bin/docker-teamd-start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[group:teamd] +programs=teamd-PortChannel01,teamd-PortChannel02,teamd-PortChannel03,teamd-PortChannel04 + +[program:teamd-PortChannel01] +command=/usr/bin/teamd.sh /sonic/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel01.conf +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:teamd-PortChannel02] +command=/usr/bin/teamd.sh /sonic/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel02.conf +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:teamd-PortChannel03] +command=/usr/bin/teamd.sh /sonic/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel03.conf +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:teamd-PortChannel04] +command=/usr/bin/teamd.sh /sonic/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel04.conf +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:teamsyncd] +command=/usr/bin/teamsyncd +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh new file mode 100644 index 000000000000..26c453d487af --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +function wait_until_iface_exists +{ + IFACE=$1 + + echo "Waiting for interface ${IFACE}..." + + # Wait for the interface to come up (i.e., 'ip link show' returns 0) + until ip link show $IFACE > /dev/null 2>&1; do + sleep 1 + done + + echo "Interface ${IFACE} is created" +} + + +# Wait for all interfaces to come up before starting the DHCP relay +wait_until_iface_exists Vlan1000 +wait_until_iface_exists PortChannel04 +wait_until_iface_exists PortChannel02 +wait_until_iface_exists PortChannel03 +wait_until_iface_exists PortChannel03 +wait_until_iface_exists PortChannel01 +wait_until_iface_exists PortChannel02 +wait_until_iface_exists PortChannel04 +wait_until_iface_exists PortChannel01 + diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index d1cc0d2a3296..fb450ba77ae2 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -33,6 +33,19 @@ def test_alias_map(self): data = json.loads(output) self.assertEqual(data["Ethernet4"], "fortyGigE0/4") + def test_dhcp_relay(self): + # Test generation of wait_for_intf.sh + template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-dhcp-relay', 'wait_for_intf.sh.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'wait_for_intf.sh'), self.output_file)) + + # Test generation of docker-dhcp-relay.supervisord.conf + template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-dhcp-relay', 'docker-dhcp-relay.supervisord.conf.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'docker-dhcp-relay.supervisord.conf'), self.output_file)) + def test_lldp(self): lldpd_conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-lldp-sv2', 'lldpd.conf.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + lldpd_conf_template + ' > ' + self.output_file @@ -49,7 +62,7 @@ def test_render_teamd(self, pc, minigraph, sample_output): # Test T0 minigraph argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "PORTCHANNEL.keys() | join(\' \') if PORTCHANNEL"' - output = self.run_script(argument) # Mock the output via config.sh in docker-teamd + output = self.run_script(argument) # Mock the output via docker-teamd-init.sh in docker-teamd pc_list = output.split() for i in range(1, 5): @@ -58,9 +71,9 @@ def test_render_teamd(self, pc, minigraph, sample_output): sample_output = os.path.join(self.test_dir, 'sample_output', 't0_sample_output', pc_name + '.conf') test_render_teamd(self, pc_name, self.t0_minigraph, sample_output) - # Test port channel test minigraph + # Test port channel test minigraph (for testing proper 'min_ports' attribute generation) argument = '-m ' + self.pc_minigraph + ' -p ' + self.t0_port_config + ' -v "PORTCHANNEL.keys() | join(\' \') if PORTCHANNEL"' - output = self.run_script(argument) # Mock the output via config.sh in docker-teamd + output = self.run_script(argument) # Mock the output via docker-teamd-init.sh in docker-teamd pc_list = output.split() pc_name = 'PortChannel01' @@ -68,6 +81,17 @@ def test_render_teamd(self, pc, minigraph, sample_output): sample_output = os.path.join(self.test_dir, 'sample_output', 'pc_sample_output', pc_name + '.conf') test_render_teamd(self, pc_name, self.pc_minigraph, sample_output) + # Test generation of docker-teamd.supervisord.conf + template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-teamd', 'docker-teamd.supervisord.conf.j2') + teamd_conf_dir = os.path.join(self.test_dir, 'sample_output', 't0_sample_output') + + lags_dict = {} + lags_dict['lags'] = [{'name': os.path.basename(file).split('.')[0], 'file': os.path.join(teamd_conf_dir, file)} for file in sorted(os.listdir(teamd_conf_dir))] + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -a \'' + json.dumps(lags_dict) + '\' -t ' + template_path + ' > ' + self.output_file + + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'docker-teamd.supervisord.conf'), self.output_file)) + def test_ipinip(self): ipinip_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ipinip.json.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + ipinip_file + ' > ' + self.output_file From 50b4868a991b40b4ea5421776daa1a3ee8e4a95e Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 13 Nov 2017 14:38:07 -0800 Subject: [PATCH 0921/1833] [vs]: update virtual switch (#1148) * [vs]: add zebra/quagga/fpmsyncd in supervisord.conf * setup the hostname for vs docker * do not save to the disk for redis db * install ipaddress module in vs docker * update sonic-sairedis submodule --- platform/vs/docker-sonic-vs/Dockerfile.j2 | 11 +++++++-- platform/vs/docker-sonic-vs/start.sh | 2 ++ platform/vs/docker-sonic-vs/supervisord.conf | 24 ++++++++++++++++++++ src/sonic-sairedis | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 32b91e8cf44a..fe6ca837a11b 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -28,6 +28,9 @@ RUN apt-get install -y net-tools \ iproute \ libpython2.7 +RUN pip install setuptools \ + py2_ipaddress + COPY \ {% for deb in docker_sonic_vs_debs.split(' ') -%} debs/{{ deb }}{{' '}} @@ -43,10 +46,12 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -RUN sed -ri 's/^daemonize yes$/daemonize no/; \ +RUN sed -ri 's/^(save .*$)/# \1/g; \ + s/^daemonize yes$/daemonize no/; \ s/^logfile .*$/logfile ""/; \ s/^# syslog-enabled no$/syslog-enabled no/; \ - s/^# unixsocket/unixsocket/ \ + s/^# unixsocket/unixsocket/; \ + s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ ' /etc/redis/redis.conf COPY ["50-default.conf", "/etc/rsyslog.d/"] @@ -54,4 +59,6 @@ COPY ["start.sh", "orchagent.sh", "/usr/bin/"] COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +RUN echo "docker-sonic-vs" > /etc/hostname + ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 07d0fb7a0426..0782705bc912 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -28,6 +28,8 @@ supervisorctl start neighsyncd supervisorctl start teamsyncd +supervisorctl start fpmsyncd + # Start arp_update when VLAN exists # VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` # if [ "$VLAN" != "" ]; then diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index c6fefef1415a..c91d808b9856 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -74,3 +74,27 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:zebra] +command=/usr/lib/quagga/zebra -A 127.0.0.1 +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:bgpd] +command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F +priority=11 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:fpmsyncd] +command=/usr/bin/fpmsyncd +priority=12 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/src/sonic-sairedis b/src/sonic-sairedis index f5d9c8364f5f..d11f5501ff15 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit f5d9c8364f5fbcc487a5f1a3e3e6203ab2293a83 +Subproject commit d11f5501ff15cff7361c397ec937327ce343c94b From f48ba0e87296daf104b2ae21093c33a6d4c94b22 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 14 Nov 2017 03:23:39 -0800 Subject: [PATCH 0922/1833] [vs]: install py2_ipaddress correctly (#1151) --- platform/vs/docker-sonic-vs/Dockerfile.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index fe6ca837a11b..43f7f678e71e 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -28,8 +28,8 @@ RUN apt-get install -y net-tools \ iproute \ libpython2.7 -RUN pip install setuptools \ - py2_ipaddress +RUN pip install setuptools +RUN pip install py2_ipaddress COPY \ {% for deb in docker_sonic_vs_debs.split(' ') -%} From 6284452535440a9b1c4daea74fa311ae86c266fa Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 14 Nov 2017 03:23:55 -0800 Subject: [PATCH 0923/1833] [Broadcom]: Update Broadcom SAI package to 3.0.3.2-12 (#1150) Fix memory leak in multipath routing (part II) Update th-s6100-64x40G.config.bcm Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 015d85b24a5d..5fbfc47e980d 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-11_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-11_amd64.deb?sv=2015-04-05&sr=b&sig=sXvf3ejJ8npF9iPfkTIYUneN4N8wvHKo2V6A8YoTbhk%3D&se=2031-07-17T23%3A08%3A43Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-12_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-12_amd64.deb?sv=2015-04-05&sr=b&sig=iIHm3VuMr%2BcvLP4Mcq0I90JUmxuw35%2FbktTwt13%2FqbE%3D&se=2031-07-23T23%3A48%3A11Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-11_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-12_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-11_amd64.deb?sv=2015-04-05&sr=b&sig=Q%2FSC7B0xDuhvHGL7GERoOw483nv6hkAQrDUaabS9JOs%3D&se=2031-07-17T23%3A09%3A08Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-12_amd64.deb?sv=2015-04-05&sr=b&sig=Guh0wkJFpWssS10eiwxeuzAOQEsAtbdfVzpRS%2F9uC6k%3D&se=2031-07-23T23%3A48%3A26Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 803c263331e610c38600c95af2925713ce395656 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Tue, 14 Nov 2017 08:19:24 -0800 Subject: [PATCH 0924/1833] [baseimage]: Subnet route added for management interface (eth0) - "fixes #1023" (#1142) * Added management subnet route to route table-default in kernel. * Added sample output to interface file --- files/image_config/interfaces/interfaces.j2 | 2 ++ src/sonic-config-engine/tests/sample_output/interfaces | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 9298348d3fb8..71e2d2514fa2 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -28,12 +28,14 @@ iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static ########## management network policy routing rules # management port up rules up ip {{ '-4' if prefix | ipv4 else '-6' }} route add default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default + up ip {{ '-4' if prefix | ipv4 else '-6' }} route add {{ prefix | network }}/{{ prefix | prefixlen }} dev eth0 table default up ip {{ '-4' if prefix | ipv4 else '-6' }} rule add from {{ prefix | ip }}/{{ '32' if prefix | ipv4 else '128' }} table default {% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} up ip rule add to {{ route }} table default {% endfor %} # management port down rules down ip {{ '-4' if prefix | ipv4 else '-6' }} route delete default via {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} dev eth0 table default + down ip {{ '-4' if prefix | ipv4 else '-6' }} route delete {{ prefix | network }}/{{ prefix | prefixlen }} dev eth0 table default down ip {{ '-4' if prefix | ipv4 else '-6' }} rule delete from {{ prefix | ip }}/{{ '32' if prefix | ipv4 else '128' }} table default {% for route in MGMT_INTERFACE[(name, prefix)]['forced_mgmt_routes'] %} down ip rule delete to {{ route }} table default diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index 2d54e6dabb3d..c8da2fee8f76 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -23,9 +23,11 @@ iface eth0 inet static ########## management network policy routing rules # management port up rules up ip -4 route add default via 10.0.0.1 dev eth0 table default + up ip -4 route add 10.0.0.0/24 dev eth0 table default up ip -4 rule add from 10.0.0.100/32 table default # management port down rules down ip -4 route delete default via 10.0.0.1 dev eth0 table default + down ip -4 route delete 10.0.0.0/24 dev eth0 table default down ip -4 rule delete from 10.0.0.100/32 table default iface eth0 inet6 static address 2603:10e2:0:2902::8 @@ -33,9 +35,11 @@ iface eth0 inet6 static ########## management network policy routing rules # management port up rules up ip -6 route add default via 2603:10e2:0:2902::1 dev eth0 table default + up ip -6 route add 2603:10e2:0:2902::/64 dev eth0 table default up ip -6 rule add from 2603:10e2:0:2902::8/128 table default # management port down rules down ip -6 route delete default via 2603:10e2:0:2902::1 dev eth0 table default + down ip -6 route delete 2603:10e2:0:2902::/64 dev eth0 table default down ip -6 rule delete from 2603:10e2:0:2902::8/128 table default # # The switch front panel interfaces From cea87e985c9cb72f9aa71ec3a521052d90a42abc Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 14 Nov 2017 14:40:15 -0800 Subject: [PATCH 0925/1833] Add docker-router-advertiser to support IPv6 router advertisements (#1103) --- .gitignore | 1 + .../docker-router-advertiser/Dockerfile.j2 | 32 ++++++++++++++++ .../docker-router-advertiser.supervisord.conf | 28 ++++++++++++++ .../docker-router-advertiser/radvd.conf.j2 | 37 +++++++++++++++++++ dockers/docker-router-advertiser/start.sh | 11 ++++++ .../router_advertiser.service.j2 | 13 +++++++ rules/docker-router-advertiser.mk | 12 ++++++ 7 files changed, 134 insertions(+) create mode 100644 dockers/docker-router-advertiser/Dockerfile.j2 create mode 100644 dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf create mode 100644 dockers/docker-router-advertiser/radvd.conf.j2 create mode 100755 dockers/docker-router-advertiser/start.sh create mode 100644 files/build_templates/router_advertiser.service.j2 create mode 100644 rules/docker-router-advertiser.mk diff --git a/.gitignore b/.gitignore index c5ed255e62a9..463994a75e8e 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ dockers/docker-fpm-quagga/Dockerfile dockers/docker-lldp-sv2/Dockerfile dockers/docker-orchagent/Dockerfile dockers/docker-platform-monitor/Dockerfile +dockers/docker-router-advertiser/Dockerfile dockers/docker-snmp-sv2/Dockerfile dockers/docker-teamd/Dockerfile dockers/docker-sonic-mgmt/Dockerfile diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 new file mode 100644 index 000000000000..5007daf122cf --- /dev/null +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -0,0 +1,32 @@ +FROM docker-config-engine + +# Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Update apt's cache of available packages +RUN apt-get update + +# Install radvd Debian package +RUN apt-get -y install radvd + +{% if docker_router_advertiser_debs.strip() -%} +# Copy built Debian packages +{%- for deb in docker_router_advertiser_debs.split(' ') %} +COPY debs/{{ deb }} debs/ +{%- endfor %} + +# Install built Debian packages and implicitly install their dependencies +{%- for deb in docker_router_advertiser_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt debs/{{ deb }} +{%- endfor %} +{%- endif %} + +# Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +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/"] + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf new file mode 100644 index 000000000000..08a3e0a94872 --- /dev/null +++ b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf @@ -0,0 +1,28 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:radvd] +command=/usr/sbin/radvd -n +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/dockers/docker-router-advertiser/radvd.conf.j2 b/dockers/docker-router-advertiser/radvd.conf.j2 new file mode 100644 index 000000000000..940c26fd6588 --- /dev/null +++ b/dockers/docker-router-advertiser/radvd.conf.j2 @@ -0,0 +1,37 @@ +{% block banner %} +# =========== Managed by sonic-cfggen -- DO NOT edit manually! ==================== +# Generated by /usr/share/sonic/templates/radvd.conf.j2 using config DB data +# File: /etc/radvd.conf +# +{% endblock banner %} +# Config file for radvd, the router advertisement daemon +# See man page for radvd.conf for descriptions of all available options +# + +{# If our configuration has VLAN interfaces... #} +{% if VLAN_INTERFACE %} +{% for (name, prefix) in VLAN_INTERFACE %} +{# If this VLAN has an IPv6 address... #} +{% if prefix | ipv6 %} +interface {{ name }} +{ + IgnoreIfMissing on; + AdvSendAdvert on; + MinRtrAdvInterval 200; + MaxRtrAdvInterval 600; + AdvManagedFlag on; + AdvOtherConfigFlag off; + AdvLinkMTU 9100; + AdvHomeAgentFlag off; + prefix {{ prefix | network }}/{{ prefix | prefixlen }} { + AdvOnLink on; + AdvAutonomous off; + AdvRouterAddr off; + AdvValidLifetime infinity; + AdvPreferredLifetime infinity; + }; +}; + +{% endif %} +{% endfor %} +{% endif %} diff --git a/dockers/docker-router-advertiser/start.sh b/dockers/docker-router-advertiser/start.sh new file mode 100755 index 000000000000..cbd5ec383bd6 --- /dev/null +++ b/dockers/docker-router-advertiser/start.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Generate /etc/radvd.conf config file +sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +# Start the router advertiser +supervisorctl start radvd diff --git a/files/build_templates/router_advertiser.service.j2 b/files/build_templates/router_advertiser.service.j2 new file mode 100644 index 000000000000..12bdb371369d --- /dev/null +++ b/files/build_templates/router_advertiser.service.j2 @@ -0,0 +1,13 @@ +[Unit] +Description=Router advertiser container +Requires=docker.service +After=swss.service + +[Service] +User={{ sonicadmin_user }} +ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start +ExecStart=/usr/bin/{{ docker_container_name }}.sh attach +ExecStop=/usr/bin/{{ docker_container_name }}.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk new file mode 100644 index 000000000000..129246d8fa2d --- /dev/null +++ b/rules/docker-router-advertiser.mk @@ -0,0 +1,12 @@ +# Docker image for router advertiser + +DOCKER_ROUTER_ADVERTISER = docker-router-advertiser.gz +$(DOCKER_ROUTER_ADVERTISER)_PATH = $(DOCKERS_PATH)/docker-router-advertiser +$(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) + + +$(DOCKER_ROUTER_ADVERTISER)_CONTAINER_NAME = radv +$(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro From a99b5e9e2930261cd296eeb841c0d5bcba4236e8 Mon Sep 17 00:00:00 2001 From: Polly Hsu Date: Thu, 16 Nov 2017 07:41:15 +0800 Subject: [PATCH 0926/1833] [installer] FIX. ONIE installer error issue: (#1152) * [installer] FIX. ONIE installer error issue: mv: can't rename '//tmp/onie-support.tar.bz2': No such file or directory --- installer/x86_64/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 358da41071b5..2a62132be054 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -455,9 +455,9 @@ if [ "$install_env" = "onie" ]; then cp /etc/machine.conf $demo_mnt # Store installation log in target file system - rm -f $onie_initrd_tmp/tmp/onie-support.tar.bz2 + rm -f $onie_initrd_tmp/tmp/onie-support*.tar.bz2 ${onie_bin} onie-support /tmp - mv $onie_initrd_tmp/tmp/onie-support.tar.bz2 $demo_mnt/$image_dir/ + mv $onie_initrd_tmp/tmp/onie-support*.tar.bz2 $demo_mnt/$image_dir/ if [ "$firmware" = "uefi" ] ; then demo_install_uefi_grub "$demo_mnt" "$blk_dev" From d3765066fee07a07cea2accae431c864909fefd7 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 16 Nov 2017 08:15:14 -0800 Subject: [PATCH 0927/1833] [make] Introducing build option SOURCE_FOLDER (#1155) When KEEP_SLAVE_ON=yes and SOURCE_FOLDER is defined, the path pointed by SOURCE_FOLDER will be mounted in the build slave docker at /var/src. This option allows user to mount an extra path into the build slave when the slave is left running. Usually when user need to build extra stuff in SOURCE_FOLDER. --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 800cd32093e3..d1a28f031748 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ # * USERNAME: Desired username -- default at rules/config # * PASSWORD: Desired password -- default at rules/config # * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes. +# * SOURCE_FOLDER: host path to be mount as /var/src, only effective when KEEP_SLAVE_ON=yes # ############################################################################### @@ -72,7 +73,11 @@ SONIC_BUILD_INSTRUCTION := make \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } ifeq "$(KEEP_SLAVE_ON)" "yes" - @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" + ifdef SOURCE_FOLDER + @$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" + else + @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" + endif else @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) $(SONIC_BUILD_INSTRUCTION) $@ endif From c93c008bae115da65e981f09f0baac4e52a92635 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 16 Nov 2017 10:30:41 -0800 Subject: [PATCH 0928/1833] Revert "[docker-teamd]: Manage teamd and teamsyncd processes with supervisor (#1137)" (#1156) This reverts commit a6edef2fa52f5b7771cc5751cde1a190d96ffa50. The reason to revert this commit is that it breaks the current nightly test as no port channel interfaces are get created after boot. teamd failed to start and complained about 'Cannot allocate memory' possibly due to nlmsg_alloc function failure. Will revert this commit to investigate it further before moving to supervisor. Signed-off-by: Shu0T1an ChenG --- dockers/docker-teamd/Dockerfile.j2 | 7 +- dockers/docker-teamd/docker-teamd-init.sh | 43 ------------- dockers/docker-teamd/docker-teamd-start.sh | 9 --- .../docker-teamd.supervisord.conf.j2 | 52 --------------- dockers/docker-teamd/start.sh | 35 ++++++++++ .../docker-teamd/supervisord.conf | 9 +-- dockers/docker-teamd/teamd.sh | 27 ++++++-- .../docker-teamd.supervisord.conf | 64 ------------------- .../tests/sample_output/wait_for_intf.sh | 28 -------- src/sonic-config-engine/tests/test_j2files.py | 30 +-------- 10 files changed, 64 insertions(+), 240 deletions(-) delete mode 100755 dockers/docker-teamd/docker-teamd-init.sh delete mode 100755 dockers/docker-teamd/docker-teamd-start.sh delete mode 100644 dockers/docker-teamd/docker-teamd.supervisord.conf.j2 create mode 100755 dockers/docker-teamd/start.sh rename src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf => dockers/docker-teamd/supervisord.conf (58%) delete mode 100644 src/sonic-config-engine/tests/sample_output/docker-teamd.supervisord.conf delete mode 100644 src/sonic-config-engine/tests/sample_output/wait_for_intf.sh diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 9fded5183c3c..f604433a6c3f 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -22,10 +22,11 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY ["docker-teamd-init.sh", "docker-teamd-start.sh", "teamd.sh", "/usr/bin/"] -COPY ["docker-teamd.supervisord.conf.j2", "teamd.j2", "/usr/share/sonic/templates/"] +COPY ["start.sh", "teamd.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["teamd.j2", "/usr/share/sonic/templates/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/docker-teamd-init.sh"] +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-teamd/docker-teamd-init.sh b/dockers/docker-teamd/docker-teamd-init.sh deleted file mode 100755 index a06ca4e8f890..000000000000 --- a/dockers/docker-teamd/docker-teamd-init.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -TEAMD_CONF_PATH="/etc/teamd" - -rm -rf $TEAMD_CONF_PATH -mkdir -p $TEAMD_CONF_PATH - -SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) -MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') - -# Align last byte -if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then - last_byte=$(python -c "print '$MAC_ADDRESS'[-2:]") - aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix - MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC -fi - -for pc in `sonic-cfggen -d -v "PORTCHANNEL.keys() | join(' ') if PORTCHANNEL"`; do - sonic-cfggen -d -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf - # bring down all member ports before starting teamd - for member in $(sonic-cfggen -d -v "PORTCHANNEL['$pc']['members'] | join(' ')" ); do - if [ -L /sys/class/net/$member ]; then - ip link set $member down - fi - done -done - -# Create a Python dictionary where the key is the Jinja2 variable name -# "lags" and the value is a list of dctionaries containing the name of -# the LAG and the path of the LAG config file. Then output this in -# JSON format, as we will pass it to sonic-cfggen as additional data -# below for generating the supervisord config file. -# Example output: {"lags": [{"name": "PortChannel1", "file": "/etc/teamd/PortChannel1.conf"}, {"name": "PortChannel2", "file": "/etc/teamd/PortChannel2.conf"}]} -LAG_INFO_DICT=$(python -c "import json,os,sys; lags_dict = {}; lags_dict['lags'] = [{'name': os.path.basename(file).split('.')[0], 'file': os.path.join('${TEAMD_CONF_PATH}', file)} for file in sorted(os.listdir('${TEAMD_CONF_PATH}'))]; sys.stdout.write(json.dumps(lags_dict))") - -# Generate supervisord config file -mkdir -p /etc/supervisor/conf.d/ -sonic-cfggen -d -a "${LAG_INFO_DICT}" -t /usr/share/sonic/templates/docker-teamd.supervisord.conf.j2 > /etc/supervisor/conf.d/docker-teamd.supervisord.conf - -# The Docker container should start this script as PID 1, so now that we -# have generated the proper supervisord configuration, we exec supervisord -# so that it runs as PID 1 for the duration of the container's lifetime -exec /usr/bin/supervisord diff --git a/dockers/docker-teamd/docker-teamd-start.sh b/dockers/docker-teamd/docker-teamd-start.sh deleted file mode 100755 index 95b167d22b40..000000000000 --- a/dockers/docker-teamd/docker-teamd-start.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -rm -f /var/run/rsyslogd.pid - -supervisorctl start rsyslogd - -supervisorctl start teamd:* - -supervisorctl start teamsyncd diff --git a/dockers/docker-teamd/docker-teamd.supervisord.conf.j2 b/dockers/docker-teamd/docker-teamd.supervisord.conf.j2 deleted file mode 100644 index abd3203b3477..000000000000 --- a/dockers/docker-teamd/docker-teamd.supervisord.conf.j2 +++ /dev/null @@ -1,52 +0,0 @@ -[supervisord] -logfile_maxbytes=1MB -logfile_backups=2 -nodaemon=true - -[program:docker-teamd-start.sh] -command=/usr/bin/docker-teamd-start.sh -priority=1 -autostart=true -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n -priority=2 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - -{# If there are LAGs... #} -{% if lags -%} -[group:teamd] -programs= -{%- set add_preceding_comma = { 'flag': False } -%} -{%- for lag in lags -%} -{%- if add_preceding_comma.flag %},{% endif -%} -{%- set _dummy = add_preceding_comma.update({'flag': True}) -%} -teamd-{{ lag['name'] }} -{%- endfor %} - -{# Create a program entry for each teamd instance #} -{% for lag in lags %} - -[program:teamd-{{ lag['name'] }}] -command=/usr/bin/teamd.sh {{ lag['file'] }} -priority=3 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog -{% endfor %} - -[program:teamsyncd] -command=/usr/bin/teamsyncd -priority=4 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog -{% endif %} diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh new file mode 100755 index 000000000000..6e80f6eb9a83 --- /dev/null +++ b/dockers/docker-teamd/start.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +TEAMD_CONF_PATH=/etc/teamd + +rm -rf $TEAMD_CONF_PATH +mkdir -p $TEAMD_CONF_PATH + +SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) +MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') + +# Align last byte +if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then + last_byte=$(python -c "print '$MAC_ADDRESS'[-2:]") + aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix + MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC +fi + +for pc in `sonic-cfggen -d -v "PORTCHANNEL.keys() | join(' ') if PORTCHANNEL"`; do + sonic-cfggen -d -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf + # bring down all member ports before starting teamd + for member in $(sonic-cfggen -d -v "PORTCHANNEL['$pc']['members'] | join(' ')" ); do + if [ -L /sys/class/net/$member ]; then + ip link set $member down + fi + done +done + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +supervisorctl start teamd diff --git a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf b/dockers/docker-teamd/supervisord.conf similarity index 58% rename from src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf rename to dockers/docker-teamd/supervisord.conf index f955546cdc09..48ef0ca9f29e 100644 --- a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf +++ b/dockers/docker-teamd/supervisord.conf @@ -19,15 +19,10 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog -[group:isc-dhcp-relay] -programs=isc-dhcp-relay-Vlan1000 - -[program:isc-dhcp-relay-Vlan1000] -command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -i Vlan1000 -i PortChannel02 -i PortChannel03 -i PortChannel04 -i PortChannel01 192.0.0.1 192.0.0.2 +[program:teamd] +command=/usr/bin/teamd.sh priority=3 autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - - diff --git a/dockers/docker-teamd/teamd.sh b/dockers/docker-teamd/teamd.sh index 7192a2bdeca2..2b6d9fb53970 100755 --- a/dockers/docker-teamd/teamd.sh +++ b/dockers/docker-teamd/teamd.sh @@ -1,15 +1,28 @@ #!/usr/bin/env bash -TEAMD_CONF_FILE=$1 +TEAMD_CONF_PATH=/etc/teamd + +function start_app { + rm -f /var/run/teamd/* + if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then + for f in $TEAMD_CONF_PATH/*; do + teamd -f $f -d + done + fi + teamsyncd & +} function clean_up { - teamd -f $TEAMD_CONF_FILE -k - exit $? + if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then + for f in $TEAMD_CONF_PATH/*; do + teamd -f $f -k + done + fi + pkill -9 teamsyncd + exit } trap clean_up SIGTERM SIGKILL -teamd -f $TEAMD_CONF_FILE & -TEAMD_PID=$! -wait $TEAMD_PID -exit $? +start_app +read diff --git a/src/sonic-config-engine/tests/sample_output/docker-teamd.supervisord.conf b/src/sonic-config-engine/tests/sample_output/docker-teamd.supervisord.conf deleted file mode 100644 index 83feaf05b8c8..000000000000 --- a/src/sonic-config-engine/tests/sample_output/docker-teamd.supervisord.conf +++ /dev/null @@ -1,64 +0,0 @@ -[supervisord] -logfile_maxbytes=1MB -logfile_backups=2 -nodaemon=true - -[program:docker-teamd-start.sh] -command=/usr/bin/docker-teamd-start.sh -priority=1 -autostart=true -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n -priority=2 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - -[group:teamd] -programs=teamd-PortChannel01,teamd-PortChannel02,teamd-PortChannel03,teamd-PortChannel04 - -[program:teamd-PortChannel01] -command=/usr/bin/teamd.sh /sonic/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel01.conf -priority=3 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - -[program:teamd-PortChannel02] -command=/usr/bin/teamd.sh /sonic/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel02.conf -priority=3 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - -[program:teamd-PortChannel03] -command=/usr/bin/teamd.sh /sonic/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel03.conf -priority=3 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - -[program:teamd-PortChannel04] -command=/usr/bin/teamd.sh /sonic/src/sonic-config-engine/tests/sample_output/t0_sample_output/PortChannel04.conf -priority=3 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - -[program:teamsyncd] -command=/usr/bin/teamsyncd -priority=4 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog - diff --git a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh deleted file mode 100644 index 26c453d487af..000000000000 --- a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -function wait_until_iface_exists -{ - IFACE=$1 - - echo "Waiting for interface ${IFACE}..." - - # Wait for the interface to come up (i.e., 'ip link show' returns 0) - until ip link show $IFACE > /dev/null 2>&1; do - sleep 1 - done - - echo "Interface ${IFACE} is created" -} - - -# Wait for all interfaces to come up before starting the DHCP relay -wait_until_iface_exists Vlan1000 -wait_until_iface_exists PortChannel04 -wait_until_iface_exists PortChannel02 -wait_until_iface_exists PortChannel03 -wait_until_iface_exists PortChannel03 -wait_until_iface_exists PortChannel01 -wait_until_iface_exists PortChannel02 -wait_until_iface_exists PortChannel04 -wait_until_iface_exists PortChannel01 - diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index fb450ba77ae2..d1cc0d2a3296 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -33,19 +33,6 @@ def test_alias_map(self): data = json.loads(output) self.assertEqual(data["Ethernet4"], "fortyGigE0/4") - def test_dhcp_relay(self): - # Test generation of wait_for_intf.sh - template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-dhcp-relay', 'wait_for_intf.sh.j2') - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file - self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'wait_for_intf.sh'), self.output_file)) - - # Test generation of docker-dhcp-relay.supervisord.conf - template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-dhcp-relay', 'docker-dhcp-relay.supervisord.conf.j2') - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file - self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'docker-dhcp-relay.supervisord.conf'), self.output_file)) - def test_lldp(self): lldpd_conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-lldp-sv2', 'lldpd.conf.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + lldpd_conf_template + ' > ' + self.output_file @@ -62,7 +49,7 @@ def test_render_teamd(self, pc, minigraph, sample_output): # Test T0 minigraph argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "PORTCHANNEL.keys() | join(\' \') if PORTCHANNEL"' - output = self.run_script(argument) # Mock the output via docker-teamd-init.sh in docker-teamd + output = self.run_script(argument) # Mock the output via config.sh in docker-teamd pc_list = output.split() for i in range(1, 5): @@ -71,9 +58,9 @@ def test_render_teamd(self, pc, minigraph, sample_output): sample_output = os.path.join(self.test_dir, 'sample_output', 't0_sample_output', pc_name + '.conf') test_render_teamd(self, pc_name, self.t0_minigraph, sample_output) - # Test port channel test minigraph (for testing proper 'min_ports' attribute generation) + # Test port channel test minigraph argument = '-m ' + self.pc_minigraph + ' -p ' + self.t0_port_config + ' -v "PORTCHANNEL.keys() | join(\' \') if PORTCHANNEL"' - output = self.run_script(argument) # Mock the output via docker-teamd-init.sh in docker-teamd + output = self.run_script(argument) # Mock the output via config.sh in docker-teamd pc_list = output.split() pc_name = 'PortChannel01' @@ -81,17 +68,6 @@ def test_render_teamd(self, pc, minigraph, sample_output): sample_output = os.path.join(self.test_dir, 'sample_output', 'pc_sample_output', pc_name + '.conf') test_render_teamd(self, pc_name, self.pc_minigraph, sample_output) - # Test generation of docker-teamd.supervisord.conf - template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-teamd', 'docker-teamd.supervisord.conf.j2') - teamd_conf_dir = os.path.join(self.test_dir, 'sample_output', 't0_sample_output') - - lags_dict = {} - lags_dict['lags'] = [{'name': os.path.basename(file).split('.')[0], 'file': os.path.join(teamd_conf_dir, file)} for file in sorted(os.listdir(teamd_conf_dir))] - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -a \'' + json.dumps(lags_dict) + '\' -t ' + template_path + ' > ' + self.output_file - - self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'docker-teamd.supervisord.conf'), self.output_file)) - def test_ipinip(self): ipinip_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ipinip.json.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + ipinip_file + ' > ' + self.output_file From e784aafbdacec7016f3e8f00a9d8704ed7eb6cdf Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 16 Nov 2017 12:17:58 -0800 Subject: [PATCH 0929/1833] [submodule update] update swss, swss-common and sairedis submodules (#1158) --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index d11f5501ff15..f1f7f267f973 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit d11f5501ff15cff7361c397ec937327ce343c94b +Subproject commit f1f7f267f97316fd02359e796c8af2fa971862f8 diff --git a/src/sonic-swss b/src/sonic-swss index 0be8b8b757e4..4cb542f1d933 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 0be8b8b757e40ac9f66e8175a2f978a8cba312ac +Subproject commit 4cb542f1d933ea016bcf247a79d92684bb959284 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index adf7d4cb3c22..a67ee684ed33 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit adf7d4cb3c22061bf781ef6ce7b79964ce505730 +Subproject commit a67ee684ed33083f61df83cd1ba9c047e5ed8b68 From f4e37a66f92099cc5d3bbde33823cd38b30a48a8 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 16 Nov 2017 12:27:03 -0800 Subject: [PATCH 0930/1833] add INSTALLS, LAZY_INSTALLS, DEPENDS targets to image build (#1159) 1. _INSTALLS defines the packages to be installed in the image at the build time. 2. _LAZY_INSTALLS defines the packages to be installed in the image at the first run time 3. _DEPENDS defines the packages to at the build dependency of the image --- platform/broadcom/one-aboot.mk | 2 +- platform/broadcom/one-image.mk | 4 ++-- platform/broadcom/raw-image.mk | 4 ++-- platform/cavium/one-image.mk | 4 ++-- platform/centec/one-image.mk | 2 +- platform/generic/aboot-image.mk | 2 +- platform/generic/onie-image.mk | 2 +- platform/mellanox/one-image.mk | 2 +- slave.mk | 19 ++++++++++++++++--- 9 files changed, 27 insertions(+), 14 deletions(-) diff --git a/platform/broadcom/one-aboot.mk b/platform/broadcom/one-aboot.mk index fde8e06ff787..d13ce392b425 100644 --- a/platform/broadcom/one-aboot.mk +++ b/platform/broadcom/one-aboot.mk @@ -3,6 +3,6 @@ SONIC_ONE_ABOOT_IMAGE = sonic-aboot-broadcom.swi $(SONIC_ONE_ABOOT_IMAGE)_MACHINE = broadcom $(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot -$(SONIC_ONE_ABOOT_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) $(ARISTA_PLATFORM_MODULE) +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL) $(ARISTA_PLATFORM_MODULE) $(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_ABOOT_IMAGE) diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 60305c292b6b..ca9da1134eb2 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -3,8 +3,8 @@ SONIC_ONE_IMAGE = sonic-broadcom.bin $(SONIC_ONE_IMAGE)_MACHINE = broadcom $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) -$(SONIC_ONE_IMAGE)_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ +$(SONIC_ONE_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(DELL_Z9100_PLATFORM_MODULE) \ $(DELL_S6100_PLATFORM_MODULE) \ $(INGRASYS_S8900_54XC_PLATFORM_MODULE) \ diff --git a/platform/broadcom/raw-image.mk b/platform/broadcom/raw-image.mk index ae93683c543d..2591d32c1be8 100644 --- a/platform/broadcom/raw-image.mk +++ b/platform/broadcom/raw-image.mk @@ -3,7 +3,7 @@ SONIC_RAW_IMAGE = sonic-broadcom.raw $(SONIC_RAW_IMAGE)_MACHINE = broadcom $(SONIC_RAW_IMAGE)_IMAGE_TYPE = raw -$(SONIC_RAW_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) -$(SONIC_RAW_IMAGE)_INSTALLS += $($(SONIC_ONE_IMAGE)_INSTALLS) +$(SONIC_RAW_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL) +$(SONIC_RAW_IMAGE)_LAZY_INSTALLS += $($(SONIC_ONE_IMAGE)_LAZY_INSTALLS) $(SONIC_RAW_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_RAW_IMAGE) diff --git a/platform/cavium/one-image.mk b/platform/cavium/one-image.mk index 33bcd92cc047..696578451990 100644 --- a/platform/cavium/one-image.mk +++ b/platform/cavium/one-image.mk @@ -3,7 +3,7 @@ SONIC_ONE_IMAGE = sonic-cavium.bin $(SONIC_ONE_IMAGE)_MACHINE = cavium $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(CAVM_PLATFORM_DEB) -$(SONIC_ONE_IMAGE)_DEPENDS += $(CAVM_XPNET_DEB) +$(SONIC_ONE_IMAGE)_INSTALLS += $(CAVM_PLATFORM_DEB) +$(SONIC_ONE_IMAGE)_INSTALLS += $(CAVM_XPNET_DEB) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/centec/one-image.mk b/platform/centec/one-image.mk index 49c27aea4261..7ad205dce521 100644 --- a/platform/centec/one-image.mk +++ b/platform/centec/one-image.mk @@ -3,6 +3,6 @@ SONIC_ONE_IMAGE = sonic-centec.bin $(SONIC_ONE_IMAGE)_MACHINE = centec $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(CENTEC_SDK_KERNEL) +$(SONIC_ONE_IMAGE)_INSTALLS += $(CENTEC_SDK_KERNEL) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/generic/aboot-image.mk b/platform/generic/aboot-image.mk index 7f5b4639e4e9..ecc91bba54c0 100644 --- a/platform/generic/aboot-image.mk +++ b/platform/generic/aboot-image.mk @@ -3,6 +3,6 @@ SONIC_GENERIC_ABOOT_IMAGE = sonic-aboot-generic.swi $(SONIC_GENERIC_ABOOT_IMAGE)_MACHINE = generic $(SONIC_GENERIC_ABOOT_IMAGE)_IMAGE_TYPE = aboot -$(SONIC_GENERIC_ABOOT_IMAGE)_DEPENDS = +$(SONIC_GENERIC_ABOOT_IMAGE)_INSTALLS = $(SONIC_GENERIC_ABOOT_IMAGE)_DOCKERS = SONIC_INSTALLERS += $(SONIC_GENERIC_ABOOT_IMAGE) diff --git a/platform/generic/onie-image.mk b/platform/generic/onie-image.mk index 67f8adba61e1..1a2ddb143505 100644 --- a/platform/generic/onie-image.mk +++ b/platform/generic/onie-image.mk @@ -3,6 +3,6 @@ SONIC_GENERIC_ONIE_IMAGE = sonic-generic.bin $(SONIC_GENERIC_ONIE_IMAGE)_MACHINE = generic $(SONIC_GENERIC_ONIE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_GENERIC_ONIE_IMAGE)_DEPENDS = +$(SONIC_GENERIC_ONIE_IMAGE)_INSTALLS = $(SONIC_GENERIC_ONIE_IMAGE)_DOCKERS = SONIC_INSTALLERS += $(SONIC_GENERIC_ONIE_IMAGE) diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk index db8826951ca8..6f478ba76a51 100644 --- a/platform/mellanox/one-image.mk +++ b/platform/mellanox/one-image.mk @@ -3,7 +3,7 @@ SONIC_ONE_IMAGE = sonic-mellanox.bin $(SONIC_ONE_IMAGE)_MACHINE = mellanox $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DEPENDS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) +$(SONIC_ONE_IMAGE)_INSTALLS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) $(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW_FILE) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/slave.mk b/slave.mk index 6f823cf98340..71cee41e3d0a 100644 --- a/slave.mk +++ b/slave.mk @@ -380,7 +380,20 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA ############################################################################### # targets for building installers with base image -$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform onie-image.conf $$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS)) $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) $(LINUX_KERNEL) $(IGB_DRIVER) $(SONIC_DEVICE_DATA) $(SONIC_UTILS)) $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) +$(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ + .platform \ + onie-image.conf \ + $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) \ + $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) \ + $$(addprefix $(DEBS_PATH)/,$$($$*_LAZY_INSTALLS)) \ + $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \ + $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) \ + $(LINUX_KERNEL) \ + $(IGB_DRIVER) \ + $(SONIC_DEVICE_DATA) \ + $(SONIC_UTILS)) \ + $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ + $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) $(HEADER) # Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" @@ -392,8 +405,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform export enable_organization_extensions="$(ENABLE_ORGANIZATION_EXTENSIONS)" export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)" export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)" - export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))" - export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))" + export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_INSTALLS))" + export lazy_installer_debs="$(foreach deb, $($*_LAZY_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))" export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" export config_engine_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))" export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))" From 9e12678410ef6c6b4cc4c513807ca8b754123182 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Fri, 17 Nov 2017 10:32:36 +0200 Subject: [PATCH 0931/1833] [docker-syncd-mlnx-rpc]: Configure send and receive buffers for PTF agent (#1157) Signed-off-by: Volodymyr Samotiy --- platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf b/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf index fa1ed0eb1622..cd6a7d4db75d 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf +++ b/platform/mellanox/docker-syncd-mlnx-rpc/ptf_nn_agent.conf @@ -1,5 +1,5 @@ [program:ptf_nn_agent] -command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-nn-rcv-buffer=109430400 --set-iface-rcv-buffer=109430400 --set-nn-snd-buffer=109430400 --set-iface-snd-buffer=109430400 process_name=ptf_nn_agent stdout_logfile=/tmp/ptf_nn_agent.out.log stderr_logfile=/tmp/ptf_nn_agent.err.log From 343597ce22b76faeb4bcd043e358fdc2116ada1b Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 17 Nov 2017 09:36:02 -0800 Subject: [PATCH 0932/1833] [Broadcom]: Update Broadcom SAI package to 3.0.3.2-13 (#1161) Fix crash due to dirty pointers Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 5fbfc47e980d..376882d95825 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-12_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-12_amd64.deb?sv=2015-04-05&sr=b&sig=iIHm3VuMr%2BcvLP4Mcq0I90JUmxuw35%2FbktTwt13%2FqbE%3D&se=2031-07-23T23%3A48%3A11Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-13_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-13_amd64.deb?sv=2015-04-05&sr=b&sig=YeXV0av6rUxy3s5VlQf4wsv6dLOKIGkkkP8lldlGr00%3D&se=2031-07-27T07%3A49%3A38Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-12_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-13_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-12_amd64.deb?sv=2015-04-05&sr=b&sig=Guh0wkJFpWssS10eiwxeuzAOQEsAtbdfVzpRS%2F9uC6k%3D&se=2031-07-23T23%3A48%3A26Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-13_amd64.deb?sv=2015-04-05&sr=b&sig=u4dKbtc%2FAvlqq7l7BT9WcmLVEsWoV1LqOxSbBy0CkiA%3D&se=2031-07-27T07%3A50%3A08Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 2a69f372c3edc145165a0b5a26d6a36bf28f8d64 Mon Sep 17 00:00:00 2001 From: yurypm Date: Fri, 17 Nov 2017 20:03:51 +0000 Subject: [PATCH 0933/1833] [Arista7260cx3] fancontrol configuration file (#1163) Signed-off-by: Yury Murashka --- device/arista/x86_64-arista_7260cx3_64/fancontrol | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 device/arista/x86_64-arista_7260cx3_64/fancontrol diff --git a/device/arista/x86_64-arista_7260cx3_64/fancontrol b/device/arista/x86_64-arista_7260cx3_64/fancontrol new file mode 100644 index 000000000000..a9f3f97c051d --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=5 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1c.0/0000:06:00.0/i2c-1/1-004c hwmon3=devices/pci0000:ff/0000:ff:0b.3/i2c-85/85-0060 +DEVNAME=hwmon1=max6658 hwmon3=rook_cpld +FCTEMPS=hwmon3/pwm4=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input +FCFANS=hwmon3/pwm4=hwmon3/fan4_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm1=hwmon3/fan1_input +MINTEMP=hwmon3/pwm4=50 hwmon3/pwm3=50 hwmon3/pwm2=50 hwmon3/pwm1=50 +MINPWM=hwmon3/pwm4=102 hwmon3/pwm3=102 hwmon3/pwm2=102 hwmon3/pwm1=102 +MAXTEMP=hwmon3/pwm4=60 hwmon3/pwm3=60 hwmon3/pwm2=60 hwmon3/pwm1=60 +MINSTART=hwmon3/pwm4=102 hwmon3/pwm3=102 hwmon3/pwm2=102 hwmon3/pwm1=102 +MINSTOP=hwmon3/pwm4=102 hwmon3/pwm3=102 hwmon3/pwm2=102 hwmon3/pwm1=102 From 223a38c02f735bca216f636dd4d6d14af2440e02 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 17 Nov 2017 14:51:48 -0800 Subject: [PATCH 0934/1833] Update isc-dhcp source to v4.3.3-6; create new patch against it (#1164) - Found a bug in v4.3.1-6 in which dhcrelay would not start if passed an interface name with a length of 15 characters due to truncated copy of interface name in common/lpf.c. Bug was fixed in v4.3.2. - v4.3.3-6 is the newest version we can build for Debian Jessie, as all newer versions require newer versions of debhelper and libbind-export-dev dependencies than are available for Jessie. --- rules/isc-dhcp.mk | 2 +- src/isc-dhcp/Makefile | 4 +- ...d-remote_id-and-bridge-iface-support.patch | 442 ------------------ ...d-remote_id-and-bridge-iface-support.patch | 442 ++++++++++++++++++ 4 files changed, 445 insertions(+), 445 deletions(-) delete mode 100644 src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch create mode 100644 src/isc-dhcp/isc-dhcp-4.3.3-6_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index 82f5c3844c6f..7b7f69c6cfc6 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -1,6 +1,6 @@ # isc-dhcp packages -ISC_DHCP_VERSION = 4.3.1-6 +ISC_DHCP_VERSION = 4.3.3-6 export ISC_DHCP_VERSION diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index d2304876d1cf..ec4c185b79f9 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -12,11 +12,11 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Clone isc-dhcp repo git clone https://anonscm.debian.org/cgit/pkg-dhcp/isc-dhcp.git pushd ./isc-dhcp - git checkout -f debian/4.3.1-6 + git checkout -f debian/$(ISC_DHCP_VERSION) popd # Apply patch - patch -p1 < isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch + patch -p1 < isc-dhcp-$(ISC_DHCP_VERSION)_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch # Build source and Debian packages pushd ./isc-dhcp diff --git a/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch b/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch deleted file mode 100644 index 4dee30238acd..000000000000 --- a/src/isc-dhcp/isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch +++ /dev/null @@ -1,442 +0,0 @@ -This patch adds the following functionality to dhcrelay in isc-dhcp v4.3.1-6: -* Add customizable Circuit ID and Remote ID fields -* Support for obtaining name of physical interfaces that are part of a bridge interface - -diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c ---- a/isc-dhcp/relay/dhcrelay.c 2017-10-03 01:46:19.811524700 +0000 -+++ b/isc-dhcp/relay/dhcrelay.c 2017-10-03 01:45:50.699524700 +0000 -@@ -73,6 +73,8 @@ - did not match any known circuit ID. */ - int missing_circuit_id = 0; /* Circuit ID option in matching RAI option - was missing. */ -+const char *agent_circuit_id_fmt = NULL; /* Circuit ID custom format string. */ -+const char *agent_remote_id_fmt = NULL; /* Remote ID custom format string. */ - int max_hop_count = 10; /* Maximum hop count */ - - #ifdef DHCPv6 -@@ -120,6 +122,14 @@ - char *dhcrelay_sub_id = NULL; - #endif - -+struct interface_name_alias_tuple { -+ char if_name[IFNAMSIZ + 1]; -+ char if_alias[IFNAMSIZ + 1]; -+}; -+ -+static struct interface_name_alias_tuple *g_interface_name_alias_map = NULL; -+static size_t g_interface_name_alias_map_size = 0; -+ - static void do_relay4(struct interface_info *, struct dhcp_packet *, - unsigned int, unsigned int, struct iaddr, - struct hardware *); -@@ -132,6 +142,10 @@ - struct interface_info **, - struct dhcp_packet *, unsigned); - -+static int load_interface_alias_map(const char *port_alias_map_file_path); -+static int get_interface_alias_by_name(const char *if_name, char *if_alias_out); -+static void free_interface_alias_map(void); -+ - static const char copyright[] = - "Copyright 2004-2014 Internet Systems Consortium."; - static const char arr[] = "All rights reserved."; -@@ -140,28 +154,42 @@ - static const char url[] = - "For info, please visit https://www.isc.org/software/dhcp/"; - -+#define DHCRELAY_OPTION82_USAGE \ -+"circuit_id/remote_id interpreted sequences are:\n" \ -+"\n" \ -+" %%%% A single %%\n" \ -+" %%h Hostname of device\n" \ -+" %%p Alias of interface that generated the request\n" \ -+" %%P Hardware address of interface that generated the request\n" \ -+" %%C Client hardware address\n" \ -+" %%I DHCP relay agent IP Address\n" \ -+ - #ifdef DHCPv6 - #define DHCRELAY_USAGE \ --"Usage: dhcrelay [-4] [-d] [-q] [-a] [-D]\n"\ -+"Usage: dhcrelay [-4] [-d] [-q] [-a ] [-D]\n"\ - " [-A ] [-c ] [-p ]\n" \ - " [-pf ] [--no-pid]\n"\ - " [-m append|replace|forward|discard]\n" \ -+" [--name-alias-map-file ]\n" \ - " [-i interface0 [ ... -i interfaceN]\n" \ - " server0 [ ... serverN]\n\n" \ - " dhcrelay -6 [-d] [-q] [-I] [-c ] [-p ]\n" \ - " [-pf ] [--no-pid]\n" \ -+" [--name-alias-map-file ]\n" \ - " [-s ]\n" \ - " -l lower0 [ ... -l lowerN]\n" \ - " -u upper0 [ ... -u upperN]\n" \ - " lower (client link): [address%%]interface[#index]\n" \ --" upper (server link): [address%%]interface" -+" upper (server link): [address%%]interface\n\n" DHCRELAY_OPTION82_USAGE - #else - #define DHCRELAY_USAGE \ --"Usage: dhcrelay [-d] [-q] [-a] [-D] [-A ] [-c ] [-p ]\n" \ --" [-pf ] [--no-pid]\n" \ -+"Usage: dhcrelay [-d] [-q] [-a ] [-D]\n" \ -+" [-A ] [-c ] [-p ]\n" \ -+" [-pf ] [--no-pid]\n"\ - " [-m append|replace|forward|discard]\n" \ -+" [--name-alias-map-file ]\n" \ - " [-i interface0 [ ... -i interfaceN]\n" \ --" server0 [ ... serverN]\n\n" -+" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE - #endif - - static void usage() { -@@ -287,6 +315,15 @@ - local_family_set = 1; - local_family = AF_INET; - #endif -+ if (++i == argc) -+ usage(); -+ -+ if (argv[i] != NULL && argv[i][0] != '-') -+ agent_circuit_id_fmt = argv[i++]; -+ -+ if (argv[i] != NULL && argv[i][0] != '-') -+ agent_remote_id_fmt = argv[i]; -+ - add_agent_options = 1; - } else if (!strcmp(argv[i], "-A")) { - #ifdef DHCPv6 -@@ -383,6 +420,13 @@ - no_dhcrelay_pid = ISC_TRUE; - } else if (!strcmp(argv[i], "--no-pid")) { - no_pid_file = ISC_TRUE; -+ } else if (!strcmp(argv[i], "--name-alias-map-file")) { -+ if (++i == argc) -+ usage(); -+ if (load_interface_alias_map(argv[i]) != 0) -+ log_fatal("Failed to load interface name-alias map."); -+ path_dhcrelay_pid = argv[i]; -+ no_dhcrelay_pid = ISC_TRUE; - } else if (!strcmp(argv[i], "--version")) { - log_info("isc-dhcrelay-%s", PACKAGE_VERSION); - exit(0); -@@ -602,6 +646,8 @@ - dispatch(); - - /* In fact dispatch() never returns. */ -+ free_interface_alias_map(); -+ - return (0); - } - -@@ -690,10 +736,9 @@ - &to, htop) < 0) { - ++server_packet_errors; - } else { -- log_debug("Forwarded BOOTREPLY for %s to %s", -- print_hw_addr(packet->htype, packet->hlen, -- packet->chaddr), -- inet_ntoa(to.sin_addr)); -+ //log_debug("Forwarded BOOTREPLY for %s to %s", -+ // print_hw_addr(packet->htype, packet->hlen, packet->chaddr), -+ // inet_ntoa(to.sin_addr)); - - ++server_packets_relayed; - } -@@ -732,10 +777,10 @@ - &sp->to, NULL) < 0) { - ++client_packet_errors; - } else { -- log_debug("Forwarded BOOTREQUEST for %s to %s", -- print_hw_addr(packet->htype, packet->hlen, -- packet->chaddr), -- inet_ntoa(sp->to.sin_addr)); -+ //log_debug("Forwarded BOOTREQUEST for %s to %s", -+ // print_hw_addr(packet->htype, packet->hlen, packet->chaddr), -+ // inet_ntoa(sp->to.sin_addr)); -+ - ++client_packets_relayed; - } - } -@@ -937,6 +982,152 @@ - return (-1); - } - -+static int -+_bridgefdbquery(const char *hwAddr, char *interface, int *vlanid) { -+ -+#define xstr(s) str(s) -+#define str(s) #s -+#define FDB_STRING_LEN 100 -+#define FDB_BUFFER_LEN (FDB_STRING_LEN + 1) -+ -+/* -+ * Format for sscanf() to read the 1st, 3th, and 5th -+ * space-delimited fields -+ * -+ * bridge fdb show output -+ * 6c:64:1a:00:06:13 dev swp35 vlan 0 master bridge permanent -+ */ -+#define FDB_LINE_FORMAT "%" xstr(FDB_STRING_LEN) "s %*s " \ -+ "%" xstr(FDB_STRING_LEN) "s %*s %d %*s" -+ -+ char cmdstr[FDB_BUFFER_LEN]; -+ char buf[FDB_BUFFER_LEN]; -+ char macAddr[FDB_BUFFER_LEN]; -+ -+ if ((interface == NULL) || (vlanid == NULL)) { -+ return 0; -+ } -+ sprintf(cmdstr, "bridge fdb show | grep -m 1 %s", hwAddr); -+ FILE *cmd = popen(cmdstr, "r"); -+ -+ if (cmd != NULL) { -+ while (fgets(buf, sizeof(buf), cmd)) { -+ sscanf(buf, FDB_LINE_FORMAT, macAddr, interface, vlanid); -+ //log_debug("bridgefdbquery: macAddr:%s interface: %s vlanid %d", -+ // macAddr, interface, *vlanid); -+ } -+ pclose(cmd); -+ return 0; -+ } -+ -+ return -1; -+} -+ -+/* -+ * Format the message that will be used by circuit_id and remote_id -+ */ -+static int -+format_relay_agent_rfc3046_msg(struct interface_info *ip, struct dhcp_packet *packet, -+ const char *format, char *msg, size_t msgn) { -+ size_t len = 0; -+ char hostname[HOST_NAME_MAX + 1] = { 0 }; -+ char ifname[IFNAMSIZ + 1] = { 0 }; -+ char *buf = msg; -+ -+ for ( ; format && *format && len < msgn; ++format) { -+ size_t strn = 0; -+ const char *str = NULL; -+ -+ if (*format == '%') { -+ switch (*++format) { -+ case '\0': -+ --format; -+ break; -+ -+ case '%': /* A literal '%' */ -+ str = "%"; -+ break; -+ -+ case 'h': /* Hostname */ -+ gethostname(hostname, HOST_NAME_MAX); -+ str = hostname; -+ break; -+ -+ case 'p': /* Name of interface that we received the request from */ -+ /* -+ * Query FDB to identify the exact physical interface only when source MAC address -+ * is present and '20: DHCP relay agent IP address' (giaddr) is not present -+ */ -+ if (packet->htype && !packet->giaddr.s_addr) { -+ int ret = 0, vlanid = 0; -+ -+ ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr), -+ ip->name, -+ &vlanid); -+ -+ if (ret < 0) { -+ //log_debug("MAC Address: %s (interface:%s vlan:%d) not found in bridge fdb show", -+ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), -+ // ip->name, -+ // vlanid); -+ -+ strncpy(ifname, ip->name, IFNAMSIZ); -+ } -+ else if (strlen(ip->name) > 0) { -+ // Translate SONiC interface name to vendor alias -+ if (get_interface_alias_by_name(ip->name, ifname) < 0) { -+ log_error("Failed to retrieve alias for interface name '%s'. Defaulting to interface name.", ip->name); -+ strncpy(ifname, ip->name, IFNAMSIZ); -+ } -+ -+ //log_debug("Mapped interface name '%s' to alias '%s'", ip->name, ifname); -+ -+ //log_debug("Adding option 82 interface alias for MAC Address %s as '%s'", -+ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), -+ // ifname); -+ } -+ -+ str = ifname; -+ } -+ break; -+ -+ case 'P': /* Physical address of interface that we received the request from */ -+ str = print_hw_addr(ip->hw_address.hbuf[0], ip->hw_address.hlen - 1, &ip->hw_address.hbuf[1]); -+ break; -+ -+ case 'C': /* 24: Client hardware address */ -+ str = print_hw_addr(packet->htype, packet->hlen, packet->chaddr); -+ break; -+ -+ case 'I': /* 20: DHCP relay agent IP address */ -+ str = inet_ntoa(packet->giaddr); -+ break; -+ -+ default: -+ log_error("Option %%%c is unrecognized and will not be formatted!", *format); -+ continue; -+ } -+ -+ if (str) -+ strn = strlen(str); -+ } else { -+ str = format; -+ strn += 1; -+ } -+ -+ // Do we have room? -+ if ((strn+len) > msgn) { -+ return 0; -+ } -+ -+ memcpy(buf+len, str, strn); -+ len += strn; -+ } -+ -+ return len; -+} -+ -+ - /* - * Examine a packet to see if it's a candidate to have a Relay - * Agent Information option tacked onto its tail. If it is, tack -@@ -948,6 +1139,8 @@ - int is_dhcp = 0, mms; - unsigned optlen; - u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL; -+ char circuit_id_buf[255] = { '\0', }; -+ char remote_id_buf[255] = { '\0', }; - - /* If we're not adding agent options to packets, we can skip - this. */ -@@ -1077,6 +1270,38 @@ - op = sp; - #endif - -+ /* option82: custom string for circuit_id */ -+ if (agent_circuit_id_fmt) { -+ size_t len = 0; -+ -+ len = format_relay_agent_rfc3046_msg(ip, packet, agent_circuit_id_fmt, -+ circuit_id_buf, sizeof(circuit_id_buf)); -+ -+ if (len > 0) { -+ ip->circuit_id = (uint8_t *)circuit_id_buf; -+ ip->circuit_id_len = len; -+ -+ //log_debug("Sending on %s option82:circuit_id='%s' (%d)", -+ // ip->name, (char *)ip->circuit_id, ip->circuit_id_len); -+ } -+ } -+ -+ /* option82: custom string for remote_id */ -+ if (agent_remote_id_fmt) { -+ size_t len = 0; -+ -+ len = format_relay_agent_rfc3046_msg(ip, packet, agent_remote_id_fmt, -+ remote_id_buf, sizeof(remote_id_buf)); -+ -+ if (len > 0) { -+ ip->remote_id = (uint8_t *)remote_id_buf; -+ ip->remote_id_len = len; -+ -+ //log_debug("Sending on %s option82:remote_id='%s' (%d)", -+ // ip->name, (char *)ip->remote_id, ip->remote_id_len); -+ } -+ } -+ - /* Sanity check. Had better not ever happen. */ - if ((ip->circuit_id_len > 255) ||(ip->circuit_id_len < 1)) - log_fatal("Circuit ID length %d out of range [1-255] on " -@@ -1102,7 +1327,7 @@ - * If not, forward without adding the option. - */ - if (max - sp >= optlen + 3) { -- log_debug("Adding %d-byte relay agent option", optlen + 3); -+ //log_debug("Adding %d-byte relay agent option", optlen + 3); - - /* Okay, cons up *our* Relay Agent Information option. */ - *sp++ = DHO_DHCP_AGENT_OPTIONS; -@@ -1726,3 +1951,73 @@ - - exit(0); - } -+ -+#define MAX_PORT_CONFIG_LINE_LEN 1024 -+ -+// Allocates and loads global map g_interface_name_alias_map -+// Also sets global g_interface_name_alias_map_size -+static int -+load_interface_alias_map(const char *port_alias_map_file_path) { -+ int i = 0; -+ FILE *fp = NULL; -+ char line[MAX_PORT_CONFIG_LINE_LEN] = { 0 }; -+ -+ fp = fopen(port_alias_map_file_path,"r"); -+ if (fp == NULL) { -+ log_error("Unable to open %s", port_alias_map_file_path); -+ return -1; -+ } -+ -+ g_interface_name_alias_map_size = 0; -+ -+ // Count the number of interfaces listed in the file -+ while (fgets(line, sizeof(line), fp)) { -+ g_interface_name_alias_map_size++; -+ } -+ -+ // Allocate our map accordingly -+ g_interface_name_alias_map = ((struct interface_name_alias_tuple *) -+ dmalloc((sizeof(struct interface_name_alias_tuple) * g_interface_name_alias_map_size), -+ MDL)); -+ -+ // Reset file position indicator to beginning of file -+ fseek(fp, 0, SEEK_SET); -+ -+ // Every line should contain exactly one name-alias pair -+ while (fgets(line, sizeof(line), fp)) { -+ // Each line should read as "" -+ sscanf(line, "%s %s", g_interface_name_alias_map[i].if_name, g_interface_name_alias_map[i].if_alias); -+ i++; -+ } -+ -+ fclose(fp); -+ -+ log_info("Loaded %d interface name-alias mappings", i); -+ -+ return 0; -+} -+ -+// Locates alias for port named if_name, copies alias into if_alias_out, up to a -+// max of IFNAMSIZ bytes. -+// Returns 0 on success, -1 on failure -+static int -+get_interface_alias_by_name(const char *if_name, char *if_alias_out) { -+ int i = 0; -+ -+ for (i = 0; i < g_interface_name_alias_map_size; i++) { -+ if (strncmp(if_name, g_interface_name_alias_map[i].if_name, IFNAMSIZ) == 0) { -+ strncpy(if_alias_out, g_interface_name_alias_map[i].if_alias, IFNAMSIZ); -+ return 0; -+ } -+ } -+ -+ return -1; -+} -+ -+// Frees global map g_interface_name_alias_map -+// Sets g_interface_name_alias_map_size to 0 -+static void -+free_interface_alias_map(void) { -+ free(g_interface_name_alias_map); -+ g_interface_name_alias_map_size = 0; -+} diff --git a/src/isc-dhcp/isc-dhcp-4.3.3-6_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch b/src/isc-dhcp/isc-dhcp-4.3.3-6_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch new file mode 100644 index 000000000000..6d2a850379cd --- /dev/null +++ b/src/isc-dhcp/isc-dhcp-4.3.3-6_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch @@ -0,0 +1,442 @@ +This patch adds the following functionality to dhcrelay in isc-dhcp v4.3.3-6: +* Add customizable Circuit ID and Remote ID fields +* Support for obtaining name of physical interfaces that are part of a bridge interface + +diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c +--- a/isc-dhcp/relay/dhcrelay.c 2017-11-17 00:36:51.575121900 +0000 ++++ b/isc-dhcp/relay/dhcrelay.c 2017-11-17 00:52:51.024607833 +0000 +@@ -73,6 +73,8 @@ + did not match any known circuit ID. */ + int missing_circuit_id = 0; /* Circuit ID option in matching RAI option + was missing. */ ++const char *agent_circuit_id_fmt = NULL; /* Circuit ID custom format string. */ ++const char *agent_remote_id_fmt = NULL; /* Remote ID custom format string. */ + int max_hop_count = 10; /* Maximum hop count */ + + #ifdef DHCPv6 +@@ -120,6 +122,14 @@ + char *dhcrelay_sub_id = NULL; + #endif + ++struct interface_name_alias_tuple { ++ char if_name[IFNAMSIZ + 1]; ++ char if_alias[IFNAMSIZ + 1]; ++}; ++ ++static struct interface_name_alias_tuple *g_interface_name_alias_map = NULL; ++static size_t g_interface_name_alias_map_size = 0; ++ + static void do_relay4(struct interface_info *, struct dhcp_packet *, + unsigned int, unsigned int, struct iaddr, + struct hardware *); +@@ -132,6 +142,10 @@ + struct interface_info **, + struct dhcp_packet *, unsigned); + ++static int load_interface_alias_map(const char *port_alias_map_file_path); ++static int get_interface_alias_by_name(const char *if_name, char *if_alias_out); ++static void free_interface_alias_map(void); ++ + static const char copyright[] = + "Copyright 2004-2015 Internet Systems Consortium."; + static const char arr[] = "All rights reserved."; +@@ -140,28 +154,41 @@ + static const char url[] = + "For info, please visit https://www.isc.org/software/dhcp/"; + ++#define DHCRELAY_OPTION82_USAGE \ ++"circuit_id/remote_id interpreted sequences are:\n" \ ++"\n" \ ++" %%%% A single %%\n" \ ++" %%h Hostname of device\n" \ ++" %%p Alias of interface that generated the request\n" \ ++" %%P Hardware address of interface that generated the request\n" \ ++" %%C Client hardware address\n" \ ++" %%I DHCP relay agent IP Address\n" \ ++ + #ifdef DHCPv6 + #define DHCRELAY_USAGE \ +-"Usage: dhcrelay [-4] [-d] [-q] [-a] [-D]\n"\ ++"Usage: dhcrelay [-4] [-d] [-q] [-a ] [-D]\n"\ + " [-A ] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ ++" [--name-alias-map-file ]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ + " server0 [ ... serverN]\n\n" \ + " dhcrelay -6 [-d] [-q] [-I] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n" \ ++" [--name-alias-map-file ]\n" \ + " [-s ]\n" \ + " -l lower0 [ ... -l lowerN]\n" \ + " -u upper0 [ ... -u upperN]\n" \ + " lower (client link): [address%%]interface[#index]\n" \ +-" upper (server link): [address%%]interface" ++" upper (server link): [address%%]interface\n\n" DHCRELAY_OPTION82_USAGE + #else + #define DHCRELAY_USAGE \ +-"Usage: dhcrelay [-d] [-q] [-a] [-D] [-A ] [-c ] [-p ]\n" \ +-" [-pf ] [--no-pid]\n" \ ++"Usage: dhcrelay [-d] [-q] [-a ] [-D]\n" \ ++" [-A ] [-c ] [-p ]\n" \ ++" [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ +-" server0 [ ... serverN]\n\n" ++" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE + #endif + + static void usage() { +@@ -287,6 +314,15 @@ + local_family_set = 1; + local_family = AF_INET; + #endif ++ if (++i == argc) ++ usage(); ++ ++ if (argv[i] != NULL && argv[i][0] != '-') ++ agent_circuit_id_fmt = argv[i++]; ++ ++ if (argv[i] != NULL && argv[i][0] != '-') ++ agent_remote_id_fmt = argv[i]; ++ + add_agent_options = 1; + } else if (!strcmp(argv[i], "-A")) { + #ifdef DHCPv6 +@@ -383,6 +419,13 @@ + no_dhcrelay_pid = ISC_TRUE; + } else if (!strcmp(argv[i], "--no-pid")) { + no_pid_file = ISC_TRUE; ++ } else if (!strcmp(argv[i], "--name-alias-map-file")) { ++ if (++i == argc) ++ usage(); ++ if (load_interface_alias_map(argv[i]) != 0) ++ log_fatal("Failed to load interface name-alias map."); ++ path_dhcrelay_pid = argv[i]; ++ no_dhcrelay_pid = ISC_TRUE; + } else if (!strcmp(argv[i], "--version")) { + log_info("isc-dhcrelay-%s", PACKAGE_VERSION); + exit(0); +@@ -602,6 +645,8 @@ + dispatch(); + + /* In fact dispatch() never returns. */ ++ free_interface_alias_map(); ++ + return (0); + } + +@@ -690,10 +735,10 @@ + &to, htop) < 0) { + ++server_packet_errors; + } else { +- log_debug("Forwarded BOOTREPLY for %s to %s", +- print_hw_addr(packet->htype, packet->hlen, +- packet->chaddr), +- inet_ntoa(to.sin_addr)); ++ //log_debug("Forwarded BOOTREPLY for %s to %s", ++ // print_hw_addr(packet->htype, packet->hlen, ++ // packet->chaddr), ++ // inet_ntoa(to.sin_addr)); + + ++server_packets_relayed; + } +@@ -732,10 +777,11 @@ + &sp->to, NULL) < 0) { + ++client_packet_errors; + } else { +- log_debug("Forwarded BOOTREQUEST for %s to %s", +- print_hw_addr(packet->htype, packet->hlen, +- packet->chaddr), +- inet_ntoa(sp->to.sin_addr)); ++ //log_debug("Forwarded BOOTREQUEST for %s to %s", ++ // print_hw_addr(packet->htype, packet->hlen, ++ // packet->chaddr), ++ // inet_ntoa(sp->to.sin_addr)); ++ + ++client_packets_relayed; + } + } +@@ -937,6 +983,151 @@ + return (-1); + } + ++static int ++_bridgefdbquery(const char *hwAddr, char *interface, int *vlanid) { ++ ++#define xstr(s) str(s) ++#define str(s) #s ++#define FDB_STRING_LEN 100 ++#define FDB_BUFFER_LEN (FDB_STRING_LEN + 1) ++ ++/* ++ * Format for sscanf() to read the 1st, 3th, and 5th ++ * space-delimited fields ++ * ++ * bridge fdb show output ++ * 6c:64:1a:00:06:13 dev swp35 vlan 0 master bridge permanent ++ */ ++#define FDB_LINE_FORMAT "%" xstr(FDB_STRING_LEN) "s %*s " \ ++ "%" xstr(FDB_STRING_LEN) "s %*s %d %*s" ++ ++ char cmdstr[FDB_BUFFER_LEN]; ++ char buf[FDB_BUFFER_LEN]; ++ char macAddr[FDB_BUFFER_LEN]; ++ ++ if ((interface == NULL) || (vlanid == NULL)) { ++ return 0; ++ } ++ sprintf(cmdstr, "bridge fdb show | grep -m 1 %s", hwAddr); ++ FILE *cmd = popen(cmdstr, "r"); ++ ++ if (cmd != NULL) { ++ while (fgets(buf, sizeof(buf), cmd)) { ++ sscanf(buf, FDB_LINE_FORMAT, macAddr, interface, vlanid); ++ //log_debug("bridgefdbquery: macAddr:%s interface: %s vlanid %d", ++ // macAddr, interface, *vlanid); ++ } ++ pclose(cmd); ++ return 0; ++ } ++ ++ return -1; ++} ++ ++/* ++ * Format the message that will be used by circuit_id and remote_id ++ */ ++static int ++format_relay_agent_rfc3046_msg(struct interface_info *ip, struct dhcp_packet *packet, ++ const char *format, char *msg, size_t msgn) { ++ size_t len = 0; ++ char hostname[HOST_NAME_MAX + 1] = { 0 }; ++ char ifname[IFNAMSIZ + 1] = { 0 }; ++ char *buf = msg; ++ ++ for ( ; format && *format && len < msgn; ++format) { ++ size_t strn = 0; ++ const char *str = NULL; ++ ++ if (*format == '%') { ++ switch (*++format) { ++ case '\0': ++ --format; ++ break; ++ ++ case '%': /* A literal '%' */ ++ str = "%"; ++ break; ++ ++ case 'h': /* Hostname */ ++ gethostname(hostname, HOST_NAME_MAX); ++ str = hostname; ++ break; ++ ++ case 'p': /* Name of interface that we received the request from */ ++ /* ++ * Query FDB to identify the exact physical interface only when source MAC address ++ * is present and '20: DHCP relay agent IP address' (giaddr) is not present ++ */ ++ if (packet->htype && !packet->giaddr.s_addr) { ++ int ret = 0, vlanid = 0; ++ ++ ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr), ++ ip->name, ++ &vlanid); ++ ++ if (ret < 0) { ++ //log_debug("MAC Address: %s (interface:%s vlan:%d) not found in bridge fdb show", ++ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), ++ // ip->name, ++ // vlanid); ++ ++ strncpy(ifname, ip->name, IFNAMSIZ); ++ } ++ else if (strlen(ip->name) > 0) { ++ // Translate SONiC interface name to vendor alias ++ if (get_interface_alias_by_name(ip->name, ifname) < 0) { ++ log_error("Failed to retrieve alias for interface name '%s'. Defaulting to interface name.", ip->name); ++ strncpy(ifname, ip->name, IFNAMSIZ); ++ } ++ ++ //log_debug("Mapped interface name '%s' to alias '%s'", ip->name, ifname); ++ ++ //log_debug("Adding option 82 interface alias for MAC Address %s as '%s'", ++ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), ++ // ifname); ++ } ++ ++ str = ifname; ++ } ++ break; ++ ++ case 'P': /* Physical address of interface that we received the request from */ ++ str = print_hw_addr(ip->hw_address.hbuf[0], ip->hw_address.hlen - 1, &ip->hw_address.hbuf[1]); ++ break; ++ ++ case 'C': /* 24: Client hardware address */ ++ str = print_hw_addr(packet->htype, packet->hlen, packet->chaddr); ++ break; ++ ++ case 'I': /* 20: DHCP relay agent IP address */ ++ str = inet_ntoa(packet->giaddr); ++ break; ++ ++ default: ++ log_error("Option %%%c is unrecognized and will not be formatted!", *format); ++ continue; ++ } ++ ++ if (str) ++ strn = strlen(str); ++ } else { ++ str = format; ++ strn += 1; ++ } ++ ++ // Do we have room? ++ if ((strn+len) > msgn) { ++ return 0; ++ } ++ ++ memcpy(buf+len, str, strn); ++ len += strn; ++ } ++ ++ return len; ++} ++ + /* + * Examine a packet to see if it's a candidate to have a Relay + * Agent Information option tacked onto its tail. If it is, tack +@@ -948,6 +1139,8 @@ + int is_dhcp = 0, mms; + unsigned optlen; + u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL; ++ char circuit_id_buf[255] = { '\0', }; ++ char remote_id_buf[255] = { '\0', }; + + /* If we're not adding agent options to packets, we can skip + this. */ +@@ -1077,6 +1270,38 @@ + op = sp; + #endif + ++ /* option82: custom string for circuit_id */ ++ if (agent_circuit_id_fmt) { ++ size_t len = 0; ++ ++ len = format_relay_agent_rfc3046_msg(ip, packet, agent_circuit_id_fmt, ++ circuit_id_buf, sizeof(circuit_id_buf)); ++ ++ if (len > 0) { ++ ip->circuit_id = (uint8_t *)circuit_id_buf; ++ ip->circuit_id_len = len; ++ ++ //log_debug("Sending on %s option82:circuit_id='%s' (%d)", ++ // ip->name, (char *)ip->circuit_id, ip->circuit_id_len); ++ } ++ } ++ ++ /* option82: custom string for remote_id */ ++ if (agent_remote_id_fmt) { ++ size_t len = 0; ++ ++ len = format_relay_agent_rfc3046_msg(ip, packet, agent_remote_id_fmt, ++ remote_id_buf, sizeof(remote_id_buf)); ++ ++ if (len > 0) { ++ ip->remote_id = (uint8_t *)remote_id_buf; ++ ip->remote_id_len = len; ++ ++ //log_debug("Sending on %s option82:remote_id='%s' (%d)", ++ // ip->name, (char *)ip->remote_id, ip->remote_id_len); ++ } ++ } ++ + /* Sanity check. Had better not ever happen. */ + if ((ip->circuit_id_len > 255) ||(ip->circuit_id_len < 1)) + log_fatal("Circuit ID length %d out of range [1-255] on " +@@ -1102,7 +1327,7 @@ + * If not, forward without adding the option. + */ + if (max - sp >= optlen + 3) { +- log_debug("Adding %d-byte relay agent option", optlen + 3); ++ //log_debug("Adding %d-byte relay agent option", optlen + 3); + + /* Okay, cons up *our* Relay Agent Information option. */ + *sp++ = DHO_DHCP_AGENT_OPTIONS; +@@ -1735,3 +1960,73 @@ + + exit(0); + } ++ ++#define MAX_PORT_CONFIG_LINE_LEN 1024 ++ ++// Allocates and loads global map g_interface_name_alias_map ++// Also sets global g_interface_name_alias_map_size ++static int ++load_interface_alias_map(const char *port_alias_map_file_path) { ++ int i = 0; ++ FILE *fp = NULL; ++ char line[MAX_PORT_CONFIG_LINE_LEN] = { 0 }; ++ ++ fp = fopen(port_alias_map_file_path,"r"); ++ if (fp == NULL) { ++ log_error("Unable to open %s", port_alias_map_file_path); ++ return -1; ++ } ++ ++ g_interface_name_alias_map_size = 0; ++ ++ // Count the number of interfaces listed in the file ++ while (fgets(line, sizeof(line), fp)) { ++ g_interface_name_alias_map_size++; ++ } ++ ++ // Allocate our map accordingly ++ g_interface_name_alias_map = ((struct interface_name_alias_tuple *) ++ dmalloc((sizeof(struct interface_name_alias_tuple) * g_interface_name_alias_map_size), ++ MDL)); ++ ++ // Reset file position indicator to beginning of file ++ fseek(fp, 0, SEEK_SET); ++ ++ // Every line should contain exactly one name-alias pair ++ while (fgets(line, sizeof(line), fp)) { ++ // Each line should read as "" ++ sscanf(line, "%s %s", g_interface_name_alias_map[i].if_name, g_interface_name_alias_map[i].if_alias); ++ i++; ++ } ++ ++ fclose(fp); ++ ++ log_info("Loaded %d interface name-alias mappings", i); ++ ++ return 0; ++} ++ ++// Locates alias for port named if_name, copies alias into if_alias_out, up to a ++// max of IFNAMSIZ bytes. ++// Returns 0 on success, -1 on failure ++static int ++get_interface_alias_by_name(const char *if_name, char *if_alias_out) { ++ int i = 0; ++ ++ for (i = 0; i < g_interface_name_alias_map_size; i++) { ++ if (strncmp(if_name, g_interface_name_alias_map[i].if_name, IFNAMSIZ) == 0) { ++ strncpy(if_alias_out, g_interface_name_alias_map[i].if_alias, IFNAMSIZ); ++ return 0; ++ } ++ } ++ ++ return -1; ++} ++ ++// Frees global map g_interface_name_alias_map ++// Sets g_interface_name_alias_map_size to 0 ++static void ++free_interface_alias_map(void) { ++ free(g_interface_name_alias_map); ++ g_interface_name_alias_map_size = 0; ++} From eef4a89dc4b6312fe0d86b72240be3b90c5757bb Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 17 Nov 2017 17:20:18 -0800 Subject: [PATCH 0935/1833] [swss]: Update sonic-swss submodule (#1165) It contains: [pfcactionhandler]: match correct value when aclhandler creates ACL rules (#393) [orchagent]: Fix issue with bind ACL table group to port (#386) [vlanmgrd]: Use sonic-swss-common instead of exec redis-cli (#392) Signed-off-by: Shu0T1an ChenG --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 4cb542f1d933..7c9f01c5cb72 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 4cb542f1d933ea016bcf247a79d92684bb959284 +Subproject commit 7c9f01c5cb72dcfb9a142fa2cde4cb1c0191678b From df529efef706b5ea35abd6c7da079f34ae92cf30 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 20 Nov 2017 10:05:08 -0800 Subject: [PATCH 0936/1833] [baseimage]: fix mac address calculation on mellanox and centec platform (#1166) --- files/image_config/platform/rc.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index f4dd9cb3ad78..c7915db9eb7c 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -84,7 +84,7 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') # Align last byte of MAC if necessary - if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then + if [ "$SONIC_ASIC_TYPE" = "mellanox" ] || [ "$SONIC_ASIC_TYPE" = "centec" ]; then last_byte=$(python -c "print '$SYSTEM_MAC_ADDRESS'[-2:]") aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix SYSTEM_MAC_ADDRESS=$(python -c "print '$SYSTEM_MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC From b8e5c9f9044ef2eca9d76b76282e4b850dcb0f11 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 20 Nov 2017 14:23:13 -0800 Subject: [PATCH 0937/1833] [Mellanox]: Add Mellanox-SN2700 symlink (#1169) Signed-off-by: Qi Luo --- device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700 | 1 + 1 file changed, 1 insertion(+) create mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700 new file mode 120000 index 000000000000..9f12504c7c5a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700 @@ -0,0 +1 @@ +ACS-MSN2700 \ No newline at end of file From dc9f19e90d4eae88d50a2df2625c02be6c48ebcf Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 20 Nov 2017 18:46:59 -0800 Subject: [PATCH 0938/1833] [swss]: Update swss/sairedis submodules (#1172) sairedis: [syncd]: Only query queue counters that are needed by the application swss: [pfcwdorch]: Set correct polling interval for pfcWdOrch object [portsorch]: Only add stat IDs that are needed to query Signed-off-by: Shu0T1an ChenG --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index f1f7f267f973..0187c64a57b2 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit f1f7f267f97316fd02359e796c8af2fa971862f8 +Subproject commit 0187c64a57b288f9e4898bc9db00f7427eb61ca6 diff --git a/src/sonic-swss b/src/sonic-swss index 7c9f01c5cb72..00e38bef0803 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 7c9f01c5cb72dcfb9a142fa2cde4cb1c0191678b +Subproject commit 00e38bef0803eec5172930ba854d38fdf34ab186 From 1f9107d044190078dfc884249563d0eb8c28a4d7 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 20 Nov 2017 21:07:28 -0800 Subject: [PATCH 0939/1833] [DHCP relay]: Wait for all interfaces to be assigned IPv4 addresses before starting relay agent(s) (#1173) --- dockers/docker-dhcp-relay/start.sh | 7 ++++- dockers/docker-dhcp-relay/wait_for_intf.sh.j2 | 31 ++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index b53d7e4e238a..2ee80c4e3388 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -6,7 +6,12 @@ rm -f /var/run/rsyslogd.pid # Start rsyslog supervisorctl start rsyslogd -# Wait for all interfaces to come up before starting the DHCP relay agent(s) +# Wait for all interfaces to come up and be assigned IPv4 addresses before +# starting the DHCP relay agent(s). If an interface the relay should listen +# on is down, the relay agent will not start. If an interface the relay should +# listen on is up but does not have an IP address assigned when the relay +# agent starts, it will not listen or send on that interface for the lifetime +# of the process. /usr/bin/wait_for_intf.sh # Start the DHCP relay agent(s) diff --git a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 index 1524b3221312..037dc66ead63 100644 --- a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 +++ b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 @@ -1,27 +1,42 @@ #!/usr/bin/env bash -function wait_until_iface_exists +function wait_until_iface_ready { IFACE=$1 - echo "Waiting for interface ${IFACE}..." + echo "Waiting until interface $IFACE is up..." # Wait for the interface to come up (i.e., 'ip link show' returns 0) - until ip link show $IFACE > /dev/null 2>&1; do + until ip link show dev $IFACE up > /dev/null 2>&1; do sleep 1 done - echo "Interface ${IFACE} is created" + echo "Interface $IFACE is up" + + echo "Waiting until interface $IFACE has an IPv4 address..." + + # Wait until the interface gets assigned an IPv4 address + while true; do + IP=$(ip -4 addr show dev $IFACE | grep "inet " | awk '{ print $2 }' | cut -d '/' -f1) + + if [ -n "$IP" ]; then + break + fi + + sleep 1 + done + + echo "Interface $IFACE is configured with IP $IP" } -# Wait for all interfaces to come up before starting the DHCP relay +# Wait for all interfaces to come up and have IPv4 addresses assigned {% for (name, prefix) in INTERFACE %} -wait_until_iface_exists {{ name }} +wait_until_iface_ready {{ name }} {% endfor %} {% for (name, prefix) in VLAN_INTERFACE %} -wait_until_iface_exists {{ name }} +wait_until_iface_ready {{ name }} {% endfor %} {% for (name, prefix) in PORTCHANNEL_INTERFACE %} -wait_until_iface_exists {{ name }} +wait_until_iface_ready {{ name }} {% endfor %} From c5eba7dd34c0a9d92683a42f8e03b9ee1df82d6c Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 22 Nov 2017 00:51:05 -0800 Subject: [PATCH 0940/1833] [baseimage]: Fix racing condition between updategraph and rc.local (#1175) --- files/image_config/updategraph/updategraph.service | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/updategraph/updategraph.service b/files/image_config/updategraph/updategraph.service index c66e9be75702..0162754ab2db 100644 --- a/files/image_config/updategraph/updategraph.service +++ b/files/image_config/updategraph/updategraph.service @@ -1,5 +1,6 @@ [Unit] Description=download minigraph from graph service +After=rc-local.service Before=database.service [Service] From 21764008da7ea3ef013cd8c3a9662b6da48aac61 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Wed, 22 Nov 2017 02:58:20 -0800 Subject: [PATCH 0941/1833] [Aboot] Declare flash_size for all platform (#1171) The flash_size parameter can then be used to compute the varlog_size --- files/Aboot/boot0.j2 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 18d1ee126c00..4f2367807d90 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -110,24 +110,26 @@ platform_specific() { # set varlog size to 100MB local varlog_size=100 - # This is temporary as the platform= and sid= parameters don't provide enough - # information to identify the SKU - # An initramfs hook or a later processing done by the initscripts will be - # required to read the system eeprom + local flash_size=$(($(df | grep flash | tr -s ' ' | cut -f2 -d' ') / 1000)) + if [ "$platform" = "raven" ]; then aboot_machine=arista_7050_qx32 + flash_size=2000 echo "modprobe.blacklist=radeon" >>/tmp/append fi if [ "$platform" = "crow" ]; then aboot_machine=arista_7050_qx32s + flash_size=3700 echo "modprobe.blacklist=radeon" >>/tmp/append fi if [ "$sid" = "Upperlake" ] || [ "$sid" = "UpperlakeES" ]; then aboot_machine=arista_7060_cx32s + flash_size=3700 echo "amd_iommu=off" >> /tmp/append fi if [ "$sid" = "Gardena" ] || [ "$sid" = "GardenaSsd" ]; then aboot_machine=arista_7260cx3_64 + flash_size=28000 fi if [ "$platform" = "rook" ]; then varlog_size=4096 From 0f903d008bbd3adb3463f70be6d762d4f9b40675 Mon Sep 17 00:00:00 2001 From: Polly Hsu Date: Wed, 22 Nov 2017 18:59:28 +0800 Subject: [PATCH 0942/1833] [Accton]: Add a new supported platform, AS5712-54X (#1167) * Switch Vendor: Edge-core * Switch SKU: AS5712-54X * ASIC Vendor: Broadcom * Swich ASIC: TRIDENT2 * Port Configuration: 48x10G+6x40G * SONiC Image: SONiC-ONIE-Broadcom Signed-off-by: polly_hsu@accton.com --- .../Accton-AS5712-54X/port_config.ini | 147 ++++++------ .../Accton-AS5712-54X/sai.profile | 1 - .../x86_64-accton_as5712_54x-r0/minigraph.xml | 92 +++----- .../plugins/sfputil.py | 215 ++++++++---------- platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-accton.mk | 10 +- .../broadcom/sonic-platform-modules-accton | 2 +- 7 files changed, 220 insertions(+), 248 deletions(-) mode change 100644 => 100755 device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/port_config.ini mode change 100644 => 100755 device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile mode change 100644 => 100755 device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml mode change 100644 => 100755 device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py mode change 100644 => 100755 platform/broadcom/one-image.mk mode change 100644 => 100755 platform/broadcom/platform-modules-accton.mk diff --git a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/port_config.ini b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/port_config.ini old mode 100644 new mode 100755 index 61325e1ec43c..f41bf2ef648f --- a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/port_config.ini +++ b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/port_config.ini @@ -1,74 +1,73 @@ -# name lanes alias -Ethernet0 13 tenGigE0 -Ethernet1 14 tenGigE1 -Ethernet2 15 tenGigE2 -Ethernet3 16 tenGigE3 -Ethernet4 21 tenGigE4 -Ethernet5 22 tenGigE5 -Ethernet6 23 tenGigE6 -Ethernet7 24 tenGigE7 -Ethernet8 25 tenGigE8 -Ethernet9 26 tenGigE9 -Ethernet10 27 tenGigE10 -Ethernet11 28 tenGigE11 -Ethernet12 29 tenGigE12 -Ethernet13 30 tenGigE13 -Ethernet14 31 tenGigE14 -Ethernet15 32 tenGigE15 -Ethernet16 45 tenGigE16 -Ethernet17 46 tenGigE17 -Ethernet18 47 tenGigE18 -Ethernet19 48 tenGigE19 -Ethernet20 49 tenGigE20 -Ethernet21 50 tenGigE21 -Ethernet22 51 tenGigE22 -Ethernet23 52 tenGigE23 -Ethernet24 53 tenGigE24 -Ethernet25 54 tenGigE25 -Ethernet26 55 tenGigE26 -Ethernet27 56 tenGigE27 -Ethernet28 57 tenGigE28 -Ethernet29 58 tenGigE29 -Ethernet30 59 tenGigE30 -Ethernet31 60 tenGigE31 -Ethernet32 61 tenGigE32 -Ethernet33 62 tenGigE33 -Ethernet34 63 tenGigE34 -Ethernet35 64 tenGigE35 -Ethernet36 65 tenGigE36 -Ethernet37 66 tenGigE37 -Ethernet38 67 tenGigE38 -Ethernet39 68 tenGigE39 -Ethernet40 69 tenGigE40 -Ethernet41 70 tenGigE41 -Ethernet42 71 tenGigE42 -Ethernet43 72 tenGigE43 -Ethernet44 73 tenGigE44 -Ethernet45 74 tenGigE45 -Ethernet46 75 tenGigE46 -Ethernet47 76 tenGigE47 -Ethernet48 97 tenGigE48 -Ethernet49 98 tenGigE49 -Ethernet50 99 tenGigE50 -Ethernet51 100 tenGigE51 -Ethernet52 101 tenGigE52 -Ethernet53 102 tenGigE53 -Ethernet54 103 tenGigE54 -Ethernet55 104 tenGigE55 -Ethernet56 81 tenGigE56 -Ethernet57 82 tenGigE57 -Ethernet58 83 tenGigE58 -Ethernet59 84 tenGigE59 -Ethernet60 105 tenGigE60 -Ethernet61 106 tenGigE61 -Ethernet62 107 tenGigE62 -Ethernet63 108 tenGigE63 -Ethernet64 109 tenGigE64 -Ethernet65 110 tenGigE65 -Ethernet66 111 tenGigE66 -Ethernet67 112 tenGigE67 -Ethernet68 77 tenGigE68 -Ethernet69 78 tenGigE69 -Ethernet70 79 tenGigE70 -Ethernet71 80 tenGigE71 - +# name lanes alias index +Ethernet0 13 tenGigE0 0 +Ethernet1 14 tenGigE1 1 +Ethernet2 15 tenGigE2 2 +Ethernet3 16 tenGigE3 3 +Ethernet4 21 tenGigE4 4 +Ethernet5 22 tenGigE5 5 +Ethernet6 23 tenGigE6 6 +Ethernet7 24 tenGigE7 7 +Ethernet8 25 tenGigE8 8 +Ethernet9 26 tenGigE9 9 +Ethernet10 27 tenGigE10 10 +Ethernet11 28 tenGigE11 11 +Ethernet12 29 tenGigE12 12 +Ethernet13 30 tenGigE13 13 +Ethernet14 31 tenGigE14 14 +Ethernet15 32 tenGigE15 15 +Ethernet16 45 tenGigE16 16 +Ethernet17 46 tenGigE17 17 +Ethernet18 47 tenGigE18 18 +Ethernet19 48 tenGigE19 19 +Ethernet20 49 tenGigE20 20 +Ethernet21 50 tenGigE21 21 +Ethernet22 51 tenGigE22 22 +Ethernet23 52 tenGigE23 23 +Ethernet24 53 tenGigE24 24 +Ethernet25 54 tenGigE25 25 +Ethernet26 55 tenGigE26 26 +Ethernet27 56 tenGigE27 27 +Ethernet28 57 tenGigE28 28 +Ethernet29 58 tenGigE29 29 +Ethernet30 59 tenGigE30 30 +Ethernet31 60 tenGigE31 31 +Ethernet32 61 tenGigE32 32 +Ethernet33 62 tenGigE33 33 +Ethernet34 63 tenGigE34 34 +Ethernet35 64 tenGigE35 35 +Ethernet36 65 tenGigE36 36 +Ethernet37 66 tenGigE37 37 +Ethernet38 67 tenGigE38 38 +Ethernet39 68 tenGigE39 39 +Ethernet40 69 tenGigE40 40 +Ethernet41 70 tenGigE41 41 +Ethernet42 71 tenGigE42 42 +Ethernet43 72 tenGigE43 43 +Ethernet44 73 tenGigE44 44 +Ethernet45 74 tenGigE45 45 +Ethernet46 75 tenGigE46 46 +Ethernet47 76 tenGigE47 47 +Ethernet48 97 tenGigE48 48 +Ethernet49 98 tenGigE49 49 +Ethernet50 99 tenGigE50 50 +Ethernet51 100 tenGigE51 51 +Ethernet52 101 tenGigE52 52 +Ethernet53 102 tenGigE53 53 +Ethernet54 103 tenGigE54 54 +Ethernet55 104 tenGigE55 55 +Ethernet56 81 tenGigE56 56 +Ethernet57 82 tenGigE57 57 +Ethernet58 83 tenGigE58 58 +Ethernet59 84 tenGigE59 59 +Ethernet60 105 tenGigE60 60 +Ethernet61 106 tenGigE61 61 +Ethernet62 107 tenGigE62 62 +Ethernet63 108 tenGigE63 63 +Ethernet64 109 tenGigE64 64 +Ethernet65 110 tenGigE65 65 +Ethernet66 111 tenGigE66 66 +Ethernet67 112 tenGigE67 67 +Ethernet68 77 tenGigE68 68 +Ethernet69 78 tenGigE69 69 +Ethernet70 79 tenGigE70 70 +Ethernet71 80 tenGigE71 71 diff --git a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile old mode 100644 new mode 100755 index 7fafa54db963..01d0f6642549 --- a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile +++ b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile @@ -1,2 +1 @@ SAI_INIT_CONFIG_FILE=/etc/bcm/td2-as5712-72x10G.config.bcm - diff --git a/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml old mode 100644 new mode 100755 index 8d89f28b0d86..bf0b2e9c0fcd --- a/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml @@ -4,18 +4,18 @@ OCPSCH0104001MS - 10.10.1.26 - switch1 - 10.10.1.25 + 10.10.1.2 + OCPSCH01040AALF + 10.10.1.1 1 10 3 OCPSCH0104002MS - 10.10.2.26 - switch1 - 10.10.2.25 + 10.10.2.2 + OCPSCH01040AALF + 10.10.2.1 1 10 3 @@ -24,15 +24,15 @@ 64536 - switch1 + OCPSCH01040AALF -

10.10.1.26
+
10.10.1.1
-
10.10.2.26
+
10.10.2.1
@@ -59,29 +59,37 @@ HostIP Loopback0 - 100.0.0.9/32 + 100.0.0.3/32 - 100.0.0.9/32 + 100.0.0.3/32 + + ManagementIP1 + Management0 + + 192.168.200.12/24 + + 192.168.200.12/24 + - switch1 + OCPSCH01040AALF - Ethernet48 - 10.10.1.25/30 + tenGigE0 + 10.10.1.1/30 - Ethernet52 - 10.10.2.25/30 + tenGigE4 + 10.10.2.1/30 @@ -93,59 +101,33 @@ - 40000 + 10000 DeviceInterfaceLink OCPSCH0104001MS - Ethernet24 - switch1 - Ethernet48 + tenGigE0 + OCPSCH01040AALF + tenGigE0 - 40000 + 10000 DeviceInterfaceLink OCPSCH0104002MS - Ethernet24 - switch1 - Ethernet52 + tenGigE0 + OCPSCH01040AALF + tenGigE4 - + - switch1 + OCPSCH01040AALF Accton-AS5712-54X - + - - - switch1 - - - 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 - - - - + - switch1 + OCPSCH01040AALF Accton-AS5712-54X diff --git a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py old mode 100644 new mode 100755 index 070b1da934cb..c9862957bf31 --- a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py @@ -14,12 +14,90 @@ class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" PORT_START = 0 - PORT_END = 31 - PORTS_IN_BLOCK = 32 + PORT_END = 71 + PORTS_IN_BLOCK = 72 + QSFP_PORT_START = 72 + QSFP_PORT_END = 72 - EEPROM_OFFSET = 20 + BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/" + + _port_to_is_present = {} _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0: [2, 2], + 1: [3, 3], + 2: [4, 4], + 3: [5, 5], + 4: [6, 6], + 5: [7, 7], + 6: [8, 8], + 7: [9, 9], + 8: [10, 10], + 9: [11, 11], + 10: [12, 12], + 11: [13, 13], + 12: [14, 14], + 13: [15, 15], + 14: [16, 16], + 15: [17, 17], + 16: [18, 18], + 17: [19, 19], + 18: [20, 20], + 19: [21, 21], + 20: [22, 22], + 21: [23, 23], + 22: [24, 24], + 23: [25, 25], + 24: [26, 26], + 25: [27, 27], + 26: [28, 28], + 27: [29, 29], + 28: [30, 30], + 29: [31, 31], + 30: [32, 32], + 31: [33, 33], + 32: [34, 34], + 33: [35, 35], + 34: [36, 36], + 35: [37, 37], + 36: [38, 38], + 37: [39, 39], + 38: [40, 40], + 39: [41, 41], + 40: [42, 42], + 41: [43, 43], + 42: [44, 44], + 43: [45, 45], + 44: [46, 46], + 45: [47, 47], + 46: [48, 48], + 47: [49, 49], + 48: [50, 50], #QSFP49 + 49: [50, 50], + 50: [50, 50], + 51: [50, 50], + 52: [52, 52], #QSFP50 + 53: [52, 52], + 54: [52, 52], + 55: [52, 52], + 56: [54, 54], #QSFP51 + 57: [54, 54], + 58: [54, 54], + 59: [54, 54], + 60: [51, 51], #QSFP52 + 61: [51, 51], + 62: [51, 51], + 63: [51, 51], + 64: [53, 53], #QSFP53 + 65: [53, 53], + 66: [53, 53], + 67: [53, 53], + 68: [55, 55], #QSFP54 + 69: [55, 55], + 70: [55, 55], + 71: [55, 55], + } @property def port_start(self): @@ -31,17 +109,19 @@ def port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + eeprom_path = self.BASE_VAL_PATH + "sfp_eeprom" - for x in range(0, self.port_end + 1): - self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x][0], + self._port_to_i2c_mapping[x][1]) SfpUtilBase.__init__(self) @@ -50,126 +130,29 @@ def get_presence(self, port_num): if port_num < self.port_start or port_num > self.port_end: return False + present_path = self.BASE_VAL_PATH + "sfp_is_present" + self.__port_to_is_present = present_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + try: - reg_file = open("/sys/devices/platform/accton/qsfp_modprs") + val_file = open(self.__port_to_is_present) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print "Error: unable to open file: %s" % str(e) return False - content = reg_file.readline().rstrip() - - # content is a string containing the hex representation of the register - reg_value = int(content, 16) - - # Mask off the bit corresponding to our port - mask = (1 << port_num) + content = val_file.readline().rstrip() + val_file.close() - # ModPrsL is active low - if reg_value & mask == 0: + # content is a string, either "0" or "1" + if content == "1": return True return False def get_low_power_mode(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - try: - reg_file = open("/sys/devices/platform/accton/qsfp_lpmode") - except IOError as e: - print "Error: unable to open file: %s" % str(e) - - content = reg_file.readline().rstrip() - - # content is a string containing the hex representation of the register - reg_value = int(content, 16) - - # Mask off the bit corresponding to our port - mask = (1 << port_num) - - # LPMode is active high - if reg_value & mask == 0: - return False - - return True + raise NotImplementedError def set_low_power_mode(self, port_num, lpmode): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - try: - reg_file = open("/sys/devices/platform/accton/qsfp_lpmode", "r+") - except IOError as e: - print "Error: unable to open file: %s" % str(e) - return False - - content = reg_file.readline().rstrip() - - # content is a string containing the hex representation of the register - reg_value = int(content, 16) - - # Mask off the bit corresponding to our port - mask = (1 << port_num) - - # LPMode is active high; set or clear the bit accordingly - if lpmode is True: - reg_value = reg_value | mask - else: - reg_value = reg_value & ~mask - - # Convert our register value back to a hex string and write back - content = hex(reg_value) - - reg_file.seek(0) - reg_file.write(content) - reg_file.close() - - return True + raise NotImplementedError def reset(self, port_num): - QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/accton/qsfp_reset" - - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - try: - reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") - except IOError as e: - print "Error: unable to open file: %s" % str(e) - return False - - content = reg_file.readline().rstrip() - - # File content is a string containing the hex representation of the register - reg_value = int(content, 16) - - # Mask off the bit corresponding to our port - mask = (1 << port_num) - - # ResetL is active low - reg_value = reg_value & ~mask - - # Convert our register value back to a hex string and write back - reg_file.seek(0) - reg_file.write(hex(reg_value)) - reg_file.close() - - # 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(QSFP_RESET_REGISTER_DEVICE_FILE, "w") - except IOError as e: - print "Error: unable to open file: %s" % str(e) - return False - - reg_value = reg_value | mask - reg_file.seek(0) - reg_file.write(hex(reg_value)) - reg_file.close() - - return True + raise NotImplementedError diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk old mode 100644 new mode 100755 index ca9da1134eb2..378129d4da03 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -12,6 +12,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(INGRASYS_S9100_PLATFORM_MODULE) \ $(INGRASYS_S8810_32Q_PLATFORM_MODULE) \ $(ACCTON_AS7712_32X_PLATFORM_MODULE) \ + $(ACCTON_AS5712_54X_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk old mode 100644 new mode 100755 index e5357c5e9f14..6a2bf8c04b6f --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -1,11 +1,19 @@ # Accton Platform modules -ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION = 1.0 +ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION = 1.1 export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION +export ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION ACCTON_AS7712_32X_PLATFORM_MODULE = sonic-platform-accton-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7712_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton $(ACCTON_AS7712_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(ACCTON_AS7712_32X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7712_32x-r0 SONIC_DPKG_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) + +ACCTON_AS5712_54X_PLATFORM_MODULE = sonic-platform-accton-as5712-54x_$(ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS5712_54X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton +$(ACCTON_AS5712_54X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(ACCTON_AS5712_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as5712_54x-r0 +SONIC_DPKG_DEBS += $(ACCTON_AS5712_54X_PLATFORM_MODULE) diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index 99607d63220d..3fbde584ba15 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit 99607d63220de336a61d81f6b4d1e64062761abe +Subproject commit 3fbde584ba15f0178dc22cb7e56f2bb8481692d4 From 6d0329af3db1fa66ee17a70fe318cd5c478872f0 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 22 Nov 2017 18:58:22 +0200 Subject: [PATCH 0943/1833] Move QoS configuration to Config DB (#1178) * Move Mellanox QoS configuration to config DB Signed-off-by: Andriy Moroz * Move qos.json to hwsku subfolder Signed-off-by: Andriy Moroz * Remove copying of old qos config Signed-off-by: Andriy Moroz * Update WRED threshold values Signed-off-by: Andriy Moroz * hwsku2 Signed-off-by: Andriy Moroz * Fix syntax error in json Signed-off-by: Andriy Moroz * Add qos config for some Dell and Arista platforms Signed-off-by: Andriy Moroz * Fix inital qos config on clean boot Signed-off-by: Andriy Moroz * Updated swss-common and swss pointers (QoS in Config DB) Signed-off-by: Andriy Moroz --- .../Arista-7050-QX32/qos.json | 166 ++++++++++++++++++ .../Force10-S6000/qos.json | 166 ++++++++++++++++++ .../Force10-S6100/qos.json | 166 ++++++++++++++++++ .../ACS-MSN2700/qos.json | 166 ++++++++++++++++++ .../ACS-MSN2740/qos.json | 1 + dockers/docker-orchagent/swssconfig.sh | 2 +- files/image_config/platform/rc.local | 6 + src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 9 files changed, 674 insertions(+), 3 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json create mode 120000 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json new file mode 100644 index 000000000000..8de48a2d8d86 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json @@ -0,0 +1,166 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} + diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json new file mode 100644 index 000000000000..8de48a2d8d86 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json @@ -0,0 +1,166 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} + diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json new file mode 100644 index 000000000000..8de48a2d8d86 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json @@ -0,0 +1,166 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"512000", + "red_min_threshold":"512000", + "yellow_max_threshold":"512000", + "yellow_min_threshold":"512000", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json new file mode 100644 index 000000000000..3e01af3f2c64 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json @@ -0,0 +1,166 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} + diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json new file mode 120000 index 000000000000..ae738e606a9d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json \ No newline at end of file diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index aee3ffaaa8cb..eb73e342d7b9 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -39,7 +39,7 @@ elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [[ "$HWSKU" == "ACS-MSN27"* ]]; then sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json - SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json msn27xx.32ports.qos.json " + SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json " fi for file in $SWSSCONFIG_ARGS; do diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index c7915db9eb7c..436a7de9071e 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -112,6 +112,12 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then else # Use default minigraph.xml cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ + HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "DEVICE_METADATA['localhost']['hwsku']"` + if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then + # merge qos configuration into init config file + sonic-cfggen -j /etc/sonic/init_cfg.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/init_cfg.json + mv /tmp/init_cfg.json /etc/sonic/init_cfg.json + fi sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json fi diff --git a/src/sonic-swss b/src/sonic-swss index 00e38bef0803..3a9cf8f47847 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 00e38bef0803eec5172930ba854d38fdf34ab186 +Subproject commit 3a9cf8f478474dd0bf23af283ba7779575faae6d diff --git a/src/sonic-swss-common b/src/sonic-swss-common index a67ee684ed33..3d07426bc155 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit a67ee684ed33083f61df83cd1ba9c047e5ed8b68 +Subproject commit 3d07426bc155435290a0c81365436be5fbb31b17 From 617b3e43b1a5cdc0d8f4cf624506b43f73717c71 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 22 Nov 2017 14:36:25 -0800 Subject: [PATCH 0944/1833] Add service to config hostname based on configdb (#1174) --- files/build_templates/sonic_debian_extension.j2 | 5 +++++ files/image_config/hostname/hostname-config.service | 11 +++++++++++ files/image_config/hostname/hostname-config.sh | 11 +++++++++++ 3 files changed, 27 insertions(+) create mode 100644 files/image_config/hostname/hostname-config.service create mode 100755 files/image_config/hostname/hostname-config.sh diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 37fcfbc56fcb..0159be571f88 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -120,6 +120,11 @@ sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/usr/share/sonic/template # Copy initial interfaces configuration file, will be overwritten on first boot sudo cp $IMAGE_CONFIGS/interfaces/init_interfaces $FILESYSTEM_ROOT/etc/network +# Copy hostname configuration scripts +sudo cp $IMAGE_CONFIGS/hostname/hostname-config.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostname-config.service +sudo cp $IMAGE_CONFIGS/hostname/hostname-config.sh $FILESYSTEM_ROOT/usr/bin/ + # Copy updategraph script and service file sudo cp $IMAGE_CONFIGS/updategraph/updategraph.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable updategraph.service diff --git a/files/image_config/hostname/hostname-config.service b/files/image_config/hostname/hostname-config.service new file mode 100644 index 000000000000..e6e8f489883f --- /dev/null +++ b/files/image_config/hostname/hostname-config.service @@ -0,0 +1,11 @@ +[Unit] +Description=Update hostname based on configdb +Requires=database.service +After=database.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/hostname-config.sh + +[Install] +WantedBy=multi-user.target diff --git a/files/image_config/hostname/hostname-config.sh b/files/image_config/hostname/hostname-config.sh new file mode 100755 index 000000000000..eec7c2f732dc --- /dev/null +++ b/files/image_config/hostname/hostname-config.sh @@ -0,0 +1,11 @@ +#!/bin/bash -e + +CURRENT_HOSTNAME=`hostname` +HOSTNAME=`sonic-cfggen -d -v DEVICE_METADATA[\'localhost\'][\'hostname\']` + +echo $HOSTNAME > /etc/hostname +hostname -F /etc/hostname + +sed -i "/\s$CURRENT_HOSTNAME$/d" /etc/hosts +echo "127.0.0.1 $HOSTNAME" >> /etc/hosts + From ded9fbb7647b975426ba07d3f9d2d729152dfd44 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 23 Nov 2017 22:23:07 +0200 Subject: [PATCH 0945/1833] [Mellanox]: Update FW to 13_1534_0164 (#1180) This version has a fix for rx_pause_duration counter Signed-off-by: marian-pritsak --- platform/mellanox/fw.mk | 2 +- platform/mellanox/sdk.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 201e5205daf7..3eef7ca37b5f 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1530.0152 +MLNX_FW_VERSION = 13.1534.0164 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/sdk.mk b/platform/mellanox/sdk.mk index ad34ba84e277..d9bca2ed5af7 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,4 +1,4 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/16900748ee3c97bc5836ab3684ee05b8db6ec31b/sdk +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/564703412781016766b248b98266bd6f2c161431/sdk MLNX_SDK_VERSION = 4.2.6011 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ From dd7e9240c83f029cfdc9cd8c772c94de5bd19bb4 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 23 Nov 2017 16:31:37 -0800 Subject: [PATCH 0946/1833] [dockers] Remove dependency to minigraph (#1179) * Remove dependency to minigraph * Remove -m in swssconfig.sh --- dockers/docker-fpm-quagga/start.sh | 8 ++++---- dockers/docker-orchagent/start.sh | 6 +++--- dockers/docker-orchagent/swssconfig.sh | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dockers/docker-fpm-quagga/start.sh b/dockers/docker-fpm-quagga/start.sh index 1e7a49809d55..06fdd3bb3961 100755 --- a/dockers/docker-fpm-quagga/start.sh +++ b/dockers/docker-fpm-quagga/start.sh @@ -1,15 +1,15 @@ #!/usr/bin/env bash mkdir -p /etc/quagga -sonic-cfggen -m -d -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf +sonic-cfggen -d -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf -sonic-cfggen -m -d -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf +sonic-cfggen -d -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf -sonic-cfggen -m -d -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate +sonic-cfggen -d -t /usr/share/sonic/templates/isolate.j2 > /usr/sbin/bgp-isolate chown root:root /usr/sbin/bgp-isolate chmod 0755 /usr/sbin/bgp-isolate -sonic-cfggen -m -d -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate +sonic-cfggen -d -t /usr/share/sonic/templates/unisolate.j2 > /usr/sbin/bgp-unisolate chown root:root /usr/sbin/bgp-unisolate chmod 0755 /usr/sbin/bgp-unisolate diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 9f3ba3cb078d..dfdb5b897bbb 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -2,9 +2,9 @@ mkdir -p /etc/swss/config.d/ -sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/switch.json.j2 > /etc/swss/config.d/switch.json -sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json -sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json +sonic-cfggen -d -t /usr/share/sonic/templates/switch.json.j2 > /etc/swss/config.d/switch.json +sonic-cfggen -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json +sonic-cfggen -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json export platform=`sonic-cfggen -v platform` diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index eb73e342d7b9..c8ee8759333c 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -25,7 +25,7 @@ function fast_reboot { # Restore FDB and ARP table ASAP fast_reboot -HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v "DEVICE_METADATA['localhost']['hwsku']"` +HWSKU=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['hwsku']"` SWSSCONFIG_ARGS="00-copp.config.json ipinip.json ports.json switch.json " @@ -38,7 +38,7 @@ elif [ "$HWSKU" == "Force10-S6100" ]; then elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " elif [[ "$HWSKU" == "ACS-MSN27"* ]]; then - sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json + sonic-cfggen -d -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json " fi From 7f25b9437884c35c864616728245dc4b4f462922 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 24 Nov 2017 17:30:11 -0800 Subject: [PATCH 0947/1833] [aboot]: Add setfacl in the initramfs (#1185) Arista platforms need the filesystem ACLs to be removed on boot to prevent invalid permission to be set for new files. --- build_debian.sh | 2 ++ files/initramfs-tools/arista-convertfs.j2 | 3 +++ files/initramfs-tools/setfacl | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 files/initramfs-tools/setfacl diff --git a/build_debian.sh b/build_debian.sh index 3c6673a53ec4..0c765fdb6424 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -123,6 +123,8 @@ sudo cp files/initramfs-tools/arista-convertfs $FILESYSTEM_ROOT/etc/initramfs-to sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs sudo cp files/initramfs-tools/mke2fs $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs +sudo cp files/initramfs-tools/setfacl $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl +sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl # Hook into initramfs: rename the management interfaces on arista switches sudo cp files/initramfs-tools/arista-net $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index cea25bd39837..dfd2fc1d7407 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -87,6 +87,9 @@ fixup_flash_permissions() { # this allows the sonic admin user to have read access on the flash local flash_mnt="$1" chmod o+rx "$flash_mnt" + + # remove all the filesystem acls from the flash + setfacl -Rb "$flash_mnt" } # Extract kernel parameters diff --git a/files/initramfs-tools/setfacl b/files/initramfs-tools/setfacl new file mode 100644 index 000000000000..96564e06b245 --- /dev/null +++ b/files/initramfs-tools/setfacl @@ -0,0 +1,20 @@ +#!/bin/sh +#Part of the code is revised based on initramfs-tools/hooks/fsck and initramfs-tool is under GPL v2. + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +prereqs) + prereqs + exit 0 + ;; +esac + +. /usr/share/initramfs-tools/hook-functions + +copy_exec /usr/bin/setfacl /sbin/setfacl From 98fbddf60ffe0a02f3913ce5ce4708377c4f4019 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 27 Nov 2017 00:30:11 -0800 Subject: [PATCH 0948/1833] [kernel]: update kernel to 3.16.43 (#1181) --- rules/linux-kernel.mk | 4 ++-- src/sonic-linux-kernel | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 228b48a9d34b..1e7fad0fd840 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -2,8 +2,8 @@ KVERSION_SHORT = 3.16.0-4 KVERSION = $(KVERSION_SHORT)-amd64 -KERNEL_VERSION = 3.16.36 -KERNEL_SUBVERSION = 1+deb8u2 +KERNEL_VERSION = 3.16.43 +KERNEL_SUBVERSION = 2+deb8u5 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index b386d52bd68b..c9832d5e0835 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit b386d52bd68bdc5facbd837e265f49a8350e14a1 +Subproject commit c9832d5e08351d2f661374f51cf81e60677d2f42 From 8602360ffdd1f4fc9df6261dc2a5694a928ad0ce Mon Sep 17 00:00:00 2001 From: nealtai <33504193+nealtai@users.noreply.github.com> Date: Tue, 28 Nov 2017 06:29:22 +0800 Subject: [PATCH 0949/1833] [platform] Add a new supported platform, Delta-ag9032v1 (#1168) CPU : Intel Rangeley C2538 Swich ASIC: Broadcom Tomahawk BCM56960 Ports : 32x100G Switch SKU : Delta-ag9032v1 Signed-off-by: neal --- .../Delta-ag9032v1/port_config.ini | 33 + .../Delta-ag9032v1/sai.profile | 1 + .../delta/x86_64-delta_ag9032v1-r0/fancontrol | 10 + .../fancontrol.service | 244 +++ .../x86_64-delta_ag9032v1-r0/installer.conf | 2 + .../led_proc_init.soc | 45 + .../x86_64-delta_ag9032v1-r0/minigraph.xml | 1079 ++++++++++++ .../plugins/eeprom.py | 32 + .../plugins/sfputil.py | 175 ++ .../x86_64-delta_ag9032v1-r0/sensors.conf | 61 + platform/broadcom/one-image.mk | 3 +- platform/broadcom/platform-modules-delta.mk | 12 + platform/broadcom/rules.mk | 1 + .../sonic-platform-modules-delta/LICENSE | 16 + .../ag9032v1/cfg/ag9032v1-modules.conf | 13 + .../ag9032v1/modules/Makefile | 2 + .../ag9032v1/modules/at24.c | 698 ++++++++ .../modules/delta_ag9032v1_platform.c | 1530 +++++++++++++++++ .../ag9032v1/modules/dni_ag9032v1_psu.c | 545 ++++++ .../ag9032v1/modules/dni_emc2305.c | 381 ++++ .../scripts/ag9032v1_platform_init.sh | 9 + .../ag9032v1/scripts/led_status.sh | 225 +++ .../debian/changelog | 5 + .../debian/compat | 1 + .../debian/control | 11 + .../sonic-platform-modules-delta/debian/files | 1 + .../debian/platform-modules-ag9032v1.init | 49 + .../debian/platform-modules-ag9032v1.install | 3 + .../sonic-platform-modules-delta/debian/rules | 33 + 29 files changed, 5219 insertions(+), 1 deletion(-) create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/fancontrol create mode 100755 device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/installer.conf create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/led_proc_init.soc create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/plugins/eeprom.py create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/sensors.conf create mode 100644 platform/broadcom/platform-modules-delta.mk create mode 100644 platform/broadcom/sonic-platform-modules-delta/LICENSE create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9032v1/cfg/ag9032v1-modules.conf create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c create mode 100755 platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh create mode 100755 platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh create mode 100644 platform/broadcom/sonic-platform-modules-delta/debian/changelog create mode 100644 platform/broadcom/sonic-platform-modules-delta/debian/compat create mode 100644 platform/broadcom/sonic-platform-modules-delta/debian/control create mode 100644 platform/broadcom/sonic-platform-modules-delta/debian/files create mode 100755 platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init create mode 100644 platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install create mode 100644 platform/broadcom/sonic-platform-modules-delta/debian/rules diff --git a/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini new file mode 100644 index 000000000000..e000f29bef38 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 49,50,51,52 hundredGigE1/1 +Ethernet4 53,54,55,56 hundredGigE1/2 +Ethernet8 57,58,59,60 hundredGigE1/3 +Ethernet12 61,62,63,64 hundredGigE1/4 +Ethernet16 65,66,67,68 hundredGigE1/5 +Ethernet20 69,70,71,72 hundredGigE1/6 +Ethernet24 73,74,75,76 hundredGigE1/7 +Ethernet28 77,78,79,80 hundredGigE1/8 +Ethernet32 37,38,39,40 hundredGigE1/9 +Ethernet36 33,34,35,36 hundredGigE1/10 +Ethernet40 45,46,47,48 hundredGigE1/11 +Ethernet44 41,42,43,44 hundredGigE1/12 +Ethernet48 81,82,83,84 hundredGigE1/13 +Ethernet52 85,86,87,88 hundredGigE1/14 +Ethernet56 89,90,91,92 hundredGigE1/15 +Ethernet60 93,94,95,96 hundredGigE1/16 +Ethernet64 97,98,99,100 hundredGigE1/17 +Ethernet68 101,102,103,104 hundredGigE1/18 +Ethernet72 105,106,107,108 hundredGigE1/19 +Ethernet76 109,110,111,112 hundredGigE1/20 +Ethernet80 21,22,23,24 hundredGigE1/21 +Ethernet84 17,18,19,20 hundredGigE1/22 +Ethernet88 29,30,31,32 hundredGigE1/23 +Ethernet92 25,26,27,28 hundredGigE1/24 +Ethernet96 117,118,119,120 hundredGigE1/25 +Ethernet100 113,114,115,116 hundredGigE1/26 +Ethernet104 125,126,127,128 hundredGigE1/27 +Ethernet108 121,122,123,124 hundredGigE1/28 +Ethernet112 5,6,7,8 hundredGigE1/29 +Ethernet116 1,2,3,4 hundredGigE1/30 +Ethernet120 13,14,15,16 hundredGigE1/31 +Ethernet124 9,10,11,12 hundredGigE1/32 diff --git a/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile new file mode 100644 index 000000000000..08d9e7fa3b47 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th-ag9032v1-32x100G.config.bcm diff --git a/device/delta/x86_64-delta_ag9032v1-r0/fancontrol b/device/delta/x86_64-delta_ag9032v1-r0/fancontrol new file mode 100644 index 000000000000..4a1cde92478f --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=10 +DEVPATH=hwmon1=/sys/bus/i2c/devices +DEVNAME=hwmon1=emc2305 +FCTEMPS=hwmon1/2-004d/hwmon/hwmon*/temp1_input hwmon1/7-004c/hwmon/hwmon*/temp1_input hwmon1/7-004d/hwmon/hwmon*/temp1_input hwmon1/7-004e/hwmon/hwmon*/temp1_input hwmon1/30-004f/hwmon/hwmon*/temp1_input hwmon1/40-0058/temp1_input hwmon1/41-0058/temp1_input + +FCFANS=hwmon1/37-002c/fan1_input hwmon1/37-002c/fan2_input hwmon1/37-002c/fan3_input hwmon1/37-002c/fan4_input hwmon1/37-002c/fan5_input hwmon1/38-002d/fan1_input hwmon1/38-002d/fan2_input hwmon1/38-002d/fan3_input hwmon1/38-002d/fan4_input hwmon1/38-002d/fan5_input +MINTEMP=20 +MAXTEMP=60 +MINSTART=75 +MINSTOP=22 diff --git a/device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service b/device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service new file mode 100755 index 000000000000..17f647effb5b --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service @@ -0,0 +1,244 @@ +#!/bin/bash +# +# Simple script implementing a temperature dependent fan speed control +# Supported Linux kernel versions: 2.6.5 and later +# +# Version 0.70 +# +# Usage: fancontrol [CONFIGFILE] +# +# Dependencies: +# bash, egrep, sed, cut, sleep, readlink, lm_sensors :) +# +# Please send any questions, comments or success stories to +# marius.reiner@hdev.de +# Thanks! +# +# For configuration instructions and warnings please see fancontrol.txt, which +# can be found in the doc/ directory or at the website mentioned above. +# +# +# Copyright 2003 Marius Reiner +# Copyright (C) 2007-2009 Jean Delvare +# +# 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. +# +# + +PIDFILE="/var/run/fancontrol.pid" + +#DEBUG=1 +MAX=255 + +function LoadConfig +{ + local fcvcount fcv + + echo "Loading configuration from $1 ..." + if [ ! -r "$1" ] + then + echo "Error: Can't read configuration file" >&2 + exit 1 + fi + + # grep configuration from file + INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//g'` + DEVPATH=`egrep '^DEVPATH=.*$' $1 | sed -e 's/DEVPATH= *//g'` + DEVNAME=`egrep '^DEVNAME=.*$' $1 | sed -e 's/DEVNAME= *//g'` + FCTEMPS=`egrep '^FCTEMPS=.*$' $1 | sed -e 's/FCTEMPS=//g'` + MINTEMP=`egrep '^MINTEMP=.*$' $1 | sed -e 's/MINTEMP=//g'` + MAXTEMP=`egrep '^MAXTEMP=.*$' $1 | sed -e 's/MAXTEMP=//g'` + MINSTART=`egrep '^MINSTART=.*$' $1 | sed -e 's/MINSTART=//g'` + MINSTOP=`egrep '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP=//g'` + HWMON=$( echo "$DEVPATH" | sed 's/=.*$//g') + FCDEVPATH=$( echo "$DEVPATH" | sed 's/^.*=//g') + FCMINTEMP=$MINTEMP + FCMAXTEMP=$MAXTEMP + FCMINSTART=$MINSTART + FCMINSTOP=$MINSTOP + + FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'` + + # Check whether all mandatory settings are set + if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]] + then + echo "Some mandatory settings missing, please check your config file!" >&2 + exit 1 + fi + if [ "$INTERVAL" -le 0 ] + then + echo "Error in configuration file:" >&2 + echo "INTERVAL must be at least 1" >&2 + exit 1 + fi + + # write settings to arrays for easier use and print them + echo + echo "Common settings:" + + temp_string=$FCTEMPS + + let fcvcount=0 + for fcv in $FCTEMPS + do + fcvcount=$((fcvcount+1)) + AFCTEMP[$fcvcount]=$( echo "$temp_string" | cut -d" " -f $fcvcount ) + AFCTEMP[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + AFCTEMP_PATH[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + + AFCTEMP[$fcvcount]=$( cat ${AFCTEMP[$fcvcount]} ) + AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 )) + done + + fan_string=$FCFANS + fcvcount=0 + zero=0 + for fcv in $FCFANS + do + fcvcount=$((fcvcount+1)) + AFCFAN[$fcvcount]=$( echo "$fan_string" | cut -d" " -f $fcvcount ) + AFCFAN_PATH[$fcvcount]=$( echo "${AFCFAN[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + AFCFAN_TARGET[$fcvcount]=$( echo "${AFCFAN_PATH[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + AFCFAN_TARGET[$fcvcount]=$( echo "${AFCFAN_TARGET[$fcvcount]}" | sed 's/$/_percentage/g') + AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} ) + if [ "${AFCFAN[$fcvcount]}" == 960 ] + then + AFCFAN[$fcvcount]=$zero + fi + done +} + +# Check that all referenced sysfs files exist +function CheckFiles +{ + local outdated=0 fcvcount tsen fan + if [ $outdated -eq 1 ] + then + echo >&2 + echo "At least one referenced file is missing. Either some required kernel" >&2 + echo "modules haven't been loaded, or your configuration file is outdated." >&2 + echo "In the latter case, you should run pwmconfig again." >&2 + fi + return $outdated +} + +LoadConfig $1 + +# Detect path to sensors +if [ ! -d $DIR ] +then + echo $0: 'No sensors found! (did you load the necessary modules?)' >&2 + exit 1 +fi +cd $DIR + +# Check for configuration change +if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ] +then + echo "Configuration is too old, please run pwmconfig again" >&2 + exit 1 +fi +if [ "$DIR" = "/" -a -n "$DEVPATH" ] +then + echo "Unneeded DEVPATH with absolute device paths" >&2 + exit 1 +fi +CheckFiles || exit 1 + +if [ -f "$PIDFILE" ] +then + echo "File $PIDFILE exists, is fancontrol already running?" >&2 + exit 1 +fi +echo $$ > "$PIDFILE" + + +# main function +function UpdateThermalSensors +{ + echo "" + TEMP_HIGHEST=0 + FAN_PERCENTAGE=0 + + for i in ${AFCTEMP_PATH[@]}; do + if (( $(cat $i) > $TEMP_HIGHEST )); then + TEMP_HIGHEST=$(cat $i); + fi; + done + TEMP_HIGHEST=$((TEMP_HIGHEST/1000)) + echo "The highest temperature of thermal sensors: $TEMP_HIGHEST °C" +} + +function UpdateFanSpeeds +{ + if [ $TEMP_HIGHEST -lt 51 ]; then #TEMP<=50 + FAN_PERCENTAGE=40 + elif [ $TEMP_HIGHEST -lt 56 -a $TEMP_HIGHEST -gt 50 ]; then #50 ${AFCFAN_TARGET[$fcvcount]} + AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} ) + + if [ "${AFCFAN[$fcvcount]}" == 960 ] + then + AFCFAN[$fcvcount]=$zero + fi + done + + if [ $TEMP_HIGHEST -lt 51 ]; then #TEMP<=50 + FAN_ON_PSU_PERCENTAGE=50 + elif [ $TEMP_HIGHEST -lt 100 -a $TEMP_HIGHEST -gt 50 ]; then #50 '/sys/bus/i2c/devices/4-0058/psu_select_member' + echo "$FAN_ON_PSU_PERCENTAGE" > '/sys/bus/i2c/devices/40-0058/fan1_set_percentage' + echo "PSU fan1 =$( cat '/sys/bus/i2c/devices/40-0058/fan1_input' ) (rpm)" + #Set speed to PSU_FAN2 + #echo "0x20" > '/sys/bus/i2c/devices/4-0058/psu_select_member' + echo "$FAN_ON_PSU_PERCENTAGE" > '/sys/bus/i2c/devices/41-0058/fan1_set_percentage' + echo "PSU fan2 =$( cat '/sys/bus/i2c/devices/41-0058/fan1_input' ) (rpm)" + + rm -f "$PIDFILE" +} +# main loop calling the main function at specified intervals +while true +do + UpdateThermalSensors + UpdateFanSpeeds + echo "Sleep $INTERVAL seconds ..." + # Sleep while still handling signals + sleep $INTERVAL & + wait $! +done diff --git a/device/delta/x86_64-delta_ag9032v1-r0/installer.conf b/device/delta/x86_64-delta_ag9032v1-r0/installer.conf new file mode 100644 index 000000000000..fa2af8b7a007 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/installer.conf @@ -0,0 +1,2 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_SPEED=115200 diff --git a/device/delta/x86_64-delta_ag9032v1-r0/led_proc_init.soc b/device/delta/x86_64-delta_ag9032v1-r0/led_proc_init.soc new file mode 100644 index 000000000000..7f6789e90123 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/led_proc_init.soc @@ -0,0 +1,45 @@ +s CMIC_LEDUP0_PROGRAM_RAM 0 +s CMIC_LEDUP1_PROGRAM_RAM 0 + +led 0 stop +led 0 prog 02 00 60 E0 86 ED 2E E0 32 08 97 02 00 0E 00 60 E3 2E E0 32 00 32 01 B7 97 02 00 0E 00 12 E7 50 86 E0 86 E0 86 E0 86 E0 16 E7 61 EB 06 E3 67 4E 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 06 E0 D2 40 74 06 3A C0 D2 01 74 66 06 EB D2 00 70 62 16 ED 99 99 1A 00 71 62 77 66 32 0F 87 57 32 0E 87 57 +led 0 auto on +led 0 start +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=31 REMAP_PORT_1=30 REMAP_PORT_2=29 REMAP_PORT_3=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=27 REMAP_PORT_5=26 REMAP_PORT_6=25 REMAP_PORT_7=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=23 REMAP_PORT_9=22 REMAP_PORT_10=21 REMAP_PORT_11=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=19 REMAP_PORT_13=18 REMAP_PORT_14=17 REMAP_PORT_15=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=15 REMAP_PORT_17=14 REMAP_PORT_18=13 REMAP_PORT_19=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 REMAP_PORT_21=10 REMAP_PORT_22=9 REMAP_PORT_23=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=7 REMAP_PORT_25=6 REMAP_PORT_26=5 REMAP_PORT_27=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=3 REMAP_PORT_29=2 REMAP_PORT_30=1 REMAP_PORT_31=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 REMAP_PORT_33=62 REMAP_PORT_34=61 REMAP_PORT_35=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=59 REMAP_PORT_37=58 REMAP_PORT_38=57 REMAP_PORT_39=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=55 REMAP_PORT_41=54 REMAP_PORT_42=53 REMAP_PORT_43=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=51 REMAP_PORT_45=50 REMAP_PORT_46=49 REMAP_PORT_47=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=47 REMAP_PORT_49=46 REMAP_PORT_50=45 REMAP_PORT_51=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=43 REMAP_PORT_53=42 REMAP_PORT_54=41 REMAP_PORT_55=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=39 REMAP_PORT_57=38 REMAP_PORT_58=37 REMAP_PORT_59=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=35 REMAP_PORT_61=34 REMAP_PORT_62=33 REMAP_PORT_63=32 + +led 1 stop +led 1 prog 02 00 60 E0 86 ED 2E E0 32 08 97 02 00 0E 00 60 E3 2E E0 32 00 32 01 B7 97 02 00 0E 00 12 E7 50 86 E0 86 E0 86 E0 86 E0 16 E7 61 EB 06 E3 67 4E 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 67 66 06 E0 D2 40 74 06 3A C0 D2 01 74 66 06 EB D2 00 70 62 16 ED 99 99 1A 00 71 62 77 66 32 0F 87 57 32 0E 87 57 +led 1 auto on +led 1 start +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=3 REMAP_PORT_1=2 REMAP_PORT_2=1 REMAP_PORT_3=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=7 REMAP_PORT_5=6 REMAP_PORT_6=5 REMAP_PORT_7=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=11 REMAP_PORT_9=10 REMAP_PORT_10=9 REMAP_PORT_11=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=15 REMAP_PORT_13=14 REMAP_PORT_14=13 REMAP_PORT_15=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=19 REMAP_PORT_17=18 REMAP_PORT_18=17 REMAP_PORT_19=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=23 REMAP_PORT_21=22 REMAP_PORT_22=21 REMAP_PORT_23=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=27 REMAP_PORT_25=26 REMAP_PORT_26=25 REMAP_PORT_27=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=31 REMAP_PORT_29=30 REMAP_PORT_30=29 REMAP_PORT_31=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=35 REMAP_PORT_33=34 REMAP_PORT_34=33 REMAP_PORT_35=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=39 REMAP_PORT_37=38 REMAP_PORT_38=37 REMAP_PORT_39=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=43 REMAP_PORT_41=42 REMAP_PORT_42=41 REMAP_PORT_43=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=47 REMAP_PORT_45=46 REMAP_PORT_46=45 REMAP_PORT_47=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 REMAP_PORT_49=50 REMAP_PORT_50=49 REMAP_PORT_51=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 REMAP_PORT_53=54 REMAP_PORT_54=53 REMAP_PORT_55=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 REMAP_PORT_57=58 REMAP_PORT_58=57 REMAP_PORT_59=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=62 REMAP_PORT_62=61 REMAP_PORT_63=60 + diff --git a/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml b/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml new file mode 100644 index 000000000000..db8d62440534 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml @@ -0,0 +1,1079 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + hundredGigE1/1 + 10.0.0.0/31 + + + + hundredGigE1/2 + 10.0.0.2/31 + + + + hundredGigE1/3 + 10.0.0.4/31 + + + + hundredGigE1/4 + 10.0.0.6/31 + + + + hundredGigE1/5 + 10.0.0.8/31 + + + + hundredGigE1/6 + 10.0.0.10/31 + + + + hundredGigE1/7 + 10.0.0.12/31 + + + + hundredGigE1/8 + 10.0.0.14/31 + + + + hundredGigE1/9 + 10.0.0.16/31 + + + + hundredGigE1/10 + 10.0.0.18/31 + + + + hundredGigE1/11 + 10.0.0.20/31 + + + + hundredGigE1/12 + 10.0.0.22/31 + + + + hundredGigE1/13 + 10.0.0.24/31 + + + + hundredGigE1/14 + 10.0.0.26/31 + + + + hundredGigE1/15 + 10.0.0.28/31 + + + + hundredGigE1/16 + 10.0.0.30/31 + + + + hundredGigE1/17 + 10.0.0.32/31 + + + + hundredGigE1/18 + 10.0.0.34/31 + + + + hundredGigE1/19 + 10.0.0.36/31 + + + + hundredGigE1/20 + 10.0.0.38/31 + + + + hundredGigE1/21 + 10.0.0.40/31 + + + + hundredGigE1/22 + 10.0.0.42/31 + + + + hundredGigE1/23 + 10.0.0.44/31 + + + + hundredGigE1/24 + 10.0.0.46/31 + + + + hundredGigE1/25 + 10.0.0.48/31 + + + + hundredGigE1/26 + 10.0.0.50/31 + + + + hundredGigE1/27 + 10.0.0.52/31 + + + + hundredGigE1/28 + 10.0.0.54/31 + + + + hundredGigE1/29 + 10.0.0.56/31 + + + + hundredGigE1/30 + 10.0.0.58/31 + + + + hundredGigE1/31 + 10.0.0.60/31 + + + + hundredGigE1/32 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + hundredGigE1/1 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/2 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/3 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/4 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/5 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/6 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/7 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/8 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/9 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/10 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/11 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/12 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/13 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/14 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/15 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/16 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/17 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/18 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/19 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/20 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/21 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/22 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/23 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/24 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/25 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/26 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/27 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/28 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/29 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/30 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/31 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + hundredGigE1/32 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Delta-ag9032v1 + + + + + + + switch1 + + + 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 + + + + + + + switch1 + Delta-ag9032v1 +
diff --git a/device/delta/x86_64-delta_ag9032v1-r0/plugins/eeprom.py b/device/delta/x86_64-delta_ag9032v1-r0/plugins/eeprom.py new file mode 100644 index 000000000000..786e1fdc85e3 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/plugins/eeprom.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-2/2-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py b/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py new file mode 100644 index 000000000000..54d69446b1d8 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py @@ -0,0 +1,175 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + + EEPROM_OFFSET = 50 + + _port_to_eeprom_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(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_present") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_reset" + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # 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(QSFP_RESET_REGISTER_DEVICE_FILE, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True \ No newline at end of file diff --git a/device/delta/x86_64-delta_ag9032v1-r0/sensors.conf b/device/delta/x86_64-delta_ag9032v1-r0/sensors.conf new file mode 100644 index 000000000000..d3b2aea2a5af --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/sensors.conf @@ -0,0 +1,61 @@ +# libsensors configuration file for DCS-7060CX-32S +# ------------------------------------------------ +# + +bus "i2c-2" "i2c-1-mux (chan_id 0)" +bus "i2c-3" "i2c-1-mux (chan_id 1)" +bus "i2c-4" "i2c-1-mux (chan_id 2)" +bus "i2c-7" "i2c-1-mux (chan_id 5)" + + +# tmp75-i2c-2-4d CPU below side thermal sensor. +# tmp75-i2c-3-4f Wind thermal sensor. +# tmp75-i2c-7-4c MAC up side thermal sensor. +# tmp75-i2c-7-4d MAC down side thermal sensor. +# tmp75-i2c-7-4e Surroundings thermal sensor. + +chip "tmp75-i2c-2-4d" + label temp1 "CPU below side thermal sensor" + set temp1_max 60 + set temp1_max_hyst 55 + +chip "tmp75-i2c-*-4f" + label temp1 "Wind thermal sensor" + set temp1_max 65 + set temp1_max_hyst 60 +chip "tmp75-i2c-7-4c" + label temp1 "MAC up side thermal sensor" + set temp1_max 80 + set temp1_max_hyst 75 +chip "tmp75-i2c-7-4d" + label temp1 "MAC down side thermal sensor" + set temp1_max 75 + set temp1_max_hyst 70 +chip "tmp75-i2c-7-4e" + label temp1 "Surroundings thermal sensor" + set temp1_max 65 + set temp1_max_hyst 60 + + +chip "emc2305-i2c-3-2d" + label fan1 "FANTRAY 1 REAR" + label fan2 "FANTRAY 2 REAR" + label fan3 "FANTRAY 3 REAR" + label fan4 "FANTRAY 4 REAR" + label fan5 "FANTRAY 5 REAR" +chip "emc2305-i2c-3-2c" + label fan1 "FANTRAY 1 FRONT" + label fan2 "FANTRAY 2 FRONT" + label fan3 "FANTRAY 3 FRONT" + label fan4 "FANTRAY 4 FRONT" + label fan5 "FANTRAY 5 FRONT" +chip "pmbus-i2c-4-50" + label temp1 "Fan of power supply controller 1 sensor 1" + label temp2 "Fan of Power supply controller 1 sensor 2" + +chip "pmbus-i2c-4-40" + label temp1 "Power supply 1 hotspot sensor" + +chip "pmbus-i2c-4-40" + label temp1 "Power supply 2 hotspot sensor" + diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 378129d4da03..717ba7fa0f6b 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -15,6 +15,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(ACCTON_AS5712_54X_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ - $(CEL_DX010_PLATFORM_MODULE) + $(CEL_DX010_PLATFORM_MODULE) \ + $(DELTA_AG9032V1_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-delta.mk b/platform/broadcom/platform-modules-delta.mk new file mode 100644 index 000000000000..c73b128106a9 --- /dev/null +++ b/platform/broadcom/platform-modules-delta.mk @@ -0,0 +1,12 @@ +# Delta AG9032v1 Platform modules + +DELTA_AG9032V1_PLATFORM_MODULE_VERSION = 1.1 + +export DELTA_AG9032V1_PLATFORM_MODULE_VERSION + +DELTA_AG9032V1_PLATFORM_MODULE = platform-modules-ag9032v1_$(DELTA_AG9032V1_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELTA_AG9032V1_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-delta +$(DELTA_AG9032V1_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(DELTA_AG9032V1_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag9032v1-r0 +SONIC_DPKG_DEBS += $(DELTA_AG9032V1_PLATFORM_MODULE) + diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index b52118570251..e94361987963 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -7,6 +7,7 @@ include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk include $(PLATFORM_PATH)/platform-modules-inventec.mk include $(PLATFORM_PATH)/platform-modules-cel.mk +include $(PLATFORM_PATH)/platform-modules-delta.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk diff --git a/platform/broadcom/sonic-platform-modules-delta/LICENSE b/platform/broadcom/sonic-platform-modules-delta/LICENSE new file mode 100644 index 000000000000..ea87fe9caabe --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2017 Delta Networks, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 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-delta/ag9032v1/cfg/ag9032v1-modules.conf b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/cfg/ag9032v1-modules.conf new file mode 100644 index 000000000000..552b4103ed02 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/cfg/ag9032v1-modules.conf @@ -0,0 +1,13 @@ +# /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-delta/ag9032v1/modules/Makefile b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile new file mode 100644 index 000000000000..69b3b48885d3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := at24.o dni_ag9032v1_psu.o dni_emc2305.o delta_ag9032v1_platform.o + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c new file mode 100644 index 000000000000..8e73691647d8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/at24.c @@ -0,0 +1,698 @@ +/* + * at24.c - handle most I2C EEPROMs + * + * Copyright (C) 2005-2007 David Brownell + * Copyright (C) 2008 Wolfram Sang, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. + * Differences between different vendor product lines (like Atmel AT24C or + * MicroChip 24LC, etc) won't much matter for typical read/write access. + * There are also I2C RAM chips, likewise interchangeable. One example + * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). + * + * However, misconfiguration can lose data. "Set 16-bit memory address" + * to a part with 8-bit addressing will overwrite data. Writing with too + * big a page size also loses data. And it's not safe to assume that the + * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC + * uses 0x51, for just one example. + * + * Accordingly, explicit board-specific configuration data should be used + * in almost all cases. (One partial exception is an SMBus used to access + * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) + * + * So this driver uses "new style" I2C driver binding, expecting to be + * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or + * similar kernel-resident tables; or, configuration data coming from + * a bootloader. + * + * Other than binding model, current differences from "eeprom" driver are + * that this one handles write access and isn't restricted to 24c02 devices. + * It also handles larger devices (32 kbit and up) with two-byte addresses, + * which won't work on pure SMBus systems. + */ + +struct at24_data { + struct at24_platform_data chip; + struct memory_accessor macc; + int use_smbus; + + /* + * Lock protects against activities from other Linux tasks, + * but not from changes by other I2C masters. + */ + struct mutex lock; + struct bin_attribute bin; + + u8 *writebuf; + unsigned write_max; + unsigned num_addresses; + + /* + * Some chips tie up multiple I2C addresses; dummy devices reserve + * them for us, and we'll use them with SMBus calls. + */ + struct i2c_client *client[]; +}; + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = 32; +module_param(io_limit, uint, 0); +MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 32)"); + +/* + * Specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; +module_param(write_timeout, uint, 0); +MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); + +#define AT24_SIZE_BYTELEN 5 +#define AT24_SIZE_FLAGS 8 + +#define AT24_BITMASK(x) (BIT(x) - 1) + +/* create non-zero magic value for given eeprom parameters */ +#define AT24_DEVICE_MAGIC(_len, _flags) \ + ((1 << AT24_SIZE_FLAGS | (_flags)) \ + << AT24_SIZE_BYTELEN | ilog2(_len)) + +static const struct i2c_device_id at24_ids[] = { + /* needs 8 addresses as A0-A2 are ignored */ + { "24c00", AT24_DEVICE_MAGIC(128 / 8, AT24_FLAG_TAKE8ADDR) }, + /* old variants can't be handled with this generic entry! */ + { "24c01", AT24_DEVICE_MAGIC(1024 / 8, 0) }, + { "24c02", AT24_DEVICE_MAGIC(2048 / 8, 0) }, + /* spd is a 24c02 in memory DIMMs */ + { "spd", AT24_DEVICE_MAGIC(2048 / 8, + AT24_FLAG_READONLY | AT24_FLAG_IRUGO) }, + { "24c04", AT24_DEVICE_MAGIC(4096 / 8, 0) }, + /* 24rf08 quirk is handled at i2c-core */ + { "24c08", AT24_DEVICE_MAGIC(8192 / 8, 0) }, + { "24c16", AT24_DEVICE_MAGIC(16384 / 8, 0) }, + { "24c32", AT24_DEVICE_MAGIC(32768 / 8, AT24_FLAG_ADDR16) }, + { "24c64", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) }, + { "24c128", AT24_DEVICE_MAGIC(131072 / 8, AT24_FLAG_ADDR16) }, + { "24c256", AT24_DEVICE_MAGIC(262144 / 8, AT24_FLAG_ADDR16) }, + { "24c512", AT24_DEVICE_MAGIC(524288 / 8, AT24_FLAG_ADDR16) }, + { "24c1024", AT24_DEVICE_MAGIC(1048576 / 8, AT24_FLAG_ADDR16) }, + { "at24", 0 }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, at24_ids); + +/*-------------------------------------------------------------------------*/ + +/* + * This routine supports chips which consume multiple I2C addresses. It + * computes the addressing information to be used for a given r/w request. + * Assumes that sanity checks for offset happened at sysfs-layer. + */ +static struct i2c_client *at24_translate_offset(struct at24_data *at24, + unsigned *offset) +{ + unsigned i; + + if (at24->chip.flags & AT24_FLAG_ADDR16) { + i = *offset >> 16; + *offset &= 0xffff; + } else { + i = *offset >> 8; + *offset &= 0xff; + } + + return at24->client[i]; +} + +static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, + unsigned offset, size_t count) +{ + struct i2c_msg msg[2]; + u8 msgbuf[2]; + struct i2c_client *client; + unsigned long timeout, read_time; + int status, i; + + memset(msg, 0, sizeof(msg)); + + /* + * REVISIT some multi-address chips don't rollover page reads to + * the next slave address, so we may need to truncate the count. + * Those chips might need another quirk flag. + * + * If the real hardware used four adjacent 24c02 chips and that + * were misconfigured as one 24c08, that would be a similar effect: + * one "eeprom" file not four, but larger reads would fail when + * they crossed certain pages. + */ + + /* + * Slave address and byte offset derive from the offset. Always + * set the byte address; on a multi-master board, another master + * may have changed the chip's "current" address pointer. + */ + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + + switch (at24->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + /* Smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + break; + case I2C_SMBUS_WORD_DATA: + /* Check for odd length transaction */ + count = (count == 1) ? 1 : 2; + break; + case I2C_SMBUS_BYTE_DATA: + count = 1; + break; + default: + /* + * When we have a better choice than SMBus calls, use a + * combined I2C message. Write address; then read up to + * io_limit data bytes. Note that read page rollover helps us + * here (unlike writes). msgbuf is u8 and will cast to our + * needs. + */ + i = 0; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msgbuf[i++] = offset >> 8; + msgbuf[i++] = offset; + + msg[0].addr = client->addr; + msg[0].buf = msgbuf; + msg[0].len = i; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + } + + /* + * Reads fail if the previous write didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + read_time = jiffies; + switch (at24->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + status = i2c_smbus_read_i2c_block_data(client, offset, + count, buf); + break; + case I2C_SMBUS_WORD_DATA: + status = i2c_smbus_read_word_data(client, offset); + if (status >= 0) { + buf[0] = status & 0xff; + if (count == 2) + buf[1] = status >> 8; + status = count; + } + break; + case I2C_SMBUS_BYTE_DATA: + status = i2c_smbus_read_byte_data(client, offset); + if (status >= 0) { + buf[0] = status; + status = count; + } + break; + default: + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + status = count; + } + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(read_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t at24_read(struct at24_data *at24, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) + return count; + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + ssize_t status; + + status = at24_eeprom_read(at24, buf, off, count); + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&at24->lock); + + return retval; +} + +static ssize_t at24_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct at24_data *at24; + + at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return at24_read(at24, buf, off, count); +} + + +/* + * Note that if the hardware write-protect pin is pulled high, the whole + * chip is normally write protected. But there are plenty of product + * variants here, including OTP fuses and partial chip protect. + * + * We only use page mode writes; the alternative is sloooow. This routine + * writes at most one page. + */ +static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf, + unsigned offset, size_t count) +{ + struct i2c_client *client; + struct i2c_msg msg; + ssize_t status; + unsigned long timeout, write_time; + unsigned next_page; + + /* Get corresponding I2C address and adjust offset */ + client = at24_translate_offset(at24, &offset); + + /* write_max is at most a page */ + if (count > at24->write_max) + count = at24->write_max; + + /* Never roll over backwards, to the start of this page */ + next_page = roundup(offset + 1, at24->chip.page_size); + if (offset + count > next_page) + count = next_page - offset; + + /* If we'll use I2C calls for I/O, set up the message */ + if (!at24->use_smbus) { + int i = 0; + + msg.addr = client->addr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = at24->writebuf; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msg.buf[i++] = offset >> 8; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + } + + /* + * Writes fail if the previous one didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + write_time = jiffies; + if (at24->use_smbus) { + status = i2c_smbus_write_i2c_block_data(client, + offset, count, buf); + if (status == 0) + status = count; + } else { + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + } + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(write_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, + size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) + return count; + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + ssize_t status; + + status = at24_eeprom_write(at24, buf, off, count); + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&at24->lock); + + return retval; +} + +static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct at24_data *at24; + + if (unlikely(off >= attr->size)) + return -EFBIG; + + at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return at24_write(at24, buf, off, count); +} + +/*-------------------------------------------------------------------------*/ + +/* + * This lets other kernel code access the eeprom data. For example, it + * might hold a board's Ethernet address, or board-specific calibration + * data generated on the manufacturing floor. + */ + +static ssize_t at24_macc_read(struct memory_accessor *macc, char *buf, + off_t offset, size_t count) +{ + struct at24_data *at24 = container_of(macc, struct at24_data, macc); + + return at24_read(at24, buf, offset, count); +} + +static ssize_t at24_macc_write(struct memory_accessor *macc, const char *buf, + off_t offset, size_t count) +{ + struct at24_data *at24 = container_of(macc, struct at24_data, macc); + + return at24_write(at24, buf, offset, count); +} + +/*-------------------------------------------------------------------------*/ + +#ifdef CONFIG_OF +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ + const __be32 *val; + struct device_node *node = client->dev.of_node; + + if (node) { + if (of_get_property(node, "read-only", NULL)) + chip->flags |= AT24_FLAG_READONLY; + val = of_get_property(node, "pagesize", NULL); + if (val) + chip->page_size = be32_to_cpup(val); + } +} +#else +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ } +#endif /* CONFIG_OF */ + +static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct at24_platform_data chip; + bool writable; + int use_smbus = 0; + struct at24_data *at24; + int err; + unsigned i, num_addresses; + kernel_ulong_t magic; + + if (client->dev.platform_data) { + chip = *(struct at24_platform_data *)client->dev.platform_data; + } else { + if (!id->driver_data) + return -ENODEV; + + magic = id->driver_data; + chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); + magic >>= AT24_SIZE_BYTELEN; + chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); + /* + * This is slow, but we can't know all eeproms, so we better + * play safe. Specifying custom eeprom-types via platform_data + * is recommended anyhow. + */ + chip.page_size = 1; + + /* update chipdata if OF is present */ + at24_get_ofdata(client, &chip); + + chip.setup = NULL; + chip.context = NULL; + } + + if (!is_power_of_2(chip.byte_len)) + dev_warn(&client->dev, + "byte_len looks suspicious (no power of 2)!\n"); + if (!chip.page_size) { + dev_err(&client->dev, "page_size must not be 0!\n"); + return -EINVAL; + } + if (!is_power_of_2(chip.page_size)) + dev_warn(&client->dev, + "page_size looks suspicious (no power of 2)!\n"); + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + if (chip.flags & AT24_FLAG_ADDR16) + return -EPFNOSUPPORT; + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + return -EPFNOSUPPORT; + } + } + + if (chip.flags & AT24_FLAG_TAKE8ADDR) + num_addresses = 8; + else + num_addresses = DIV_ROUND_UP(chip.byte_len, + (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); + + at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); + if (!at24) + return -ENOMEM; + + mutex_init(&at24->lock); + at24->use_smbus = use_smbus; + at24->chip = chip; + at24->num_addresses = num_addresses; + + /* + * Export the EEPROM bytes through sysfs, since that's convenient. + * By default, only root should see the data (maybe passwords etc) + */ + sysfs_bin_attr_init(&at24->bin); + at24->bin.attr.name = "eeprom"; + at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; + at24->bin.read = at24_bin_read; + at24->bin.size = chip.byte_len; + + at24->macc.read = at24_macc_read; + + writable = !(chip.flags & AT24_FLAG_READONLY); + if (writable) { + if (!use_smbus || i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { + + unsigned write_max = chip.page_size; + + at24->macc.write = at24_macc_write; + + at24->bin.write = at24_bin_write; + at24->bin.attr.mode |= S_IWUSR; + + if (write_max > io_limit) + write_max = io_limit; + if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + at24->write_max = write_max; + + /* buffer (data + address at the beginning) */ + at24->writebuf = devm_kzalloc(&client->dev, + write_max + 2, GFP_KERNEL); + if (!at24->writebuf) + return -ENOMEM; + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + } + + at24->client[0] = client; + + /* use dummy devices for multiple-address chips */ + for (i = 1; i < num_addresses; i++) { + at24->client[i] = i2c_new_dummy(client->adapter, + client->addr + i); + if (!at24->client[i]) { + dev_err(&client->dev, "address 0x%02x unavailable\n", + client->addr + i); + err = -EADDRINUSE; + goto err_clients; + } + } + + err = sysfs_create_bin_file(&client->dev.kobj, &at24->bin); + if (err) + goto err_clients; + + i2c_set_clientdata(client, at24); + + dev_info(&client->dev, "%zu byte %s EEPROM, %s, %u bytes/write\n", + at24->bin.size, client->name, + writable ? "writable" : "read-only", at24->write_max); + if (use_smbus == I2C_SMBUS_WORD_DATA || + use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } + + /* export data to kernel code */ + if (chip.setup) + chip.setup(&at24->macc, chip.context); + + return 0; + +err_clients: + for (i = 1; i < num_addresses; i++) + if (at24->client[i]) + i2c_unregister_device(at24->client[i]); + + return err; +} + +static int at24_remove(struct i2c_client *client) +{ + struct at24_data *at24; + int i; + + at24 = i2c_get_clientdata(client); + sysfs_remove_bin_file(&client->dev.kobj, &at24->bin); + + for (i = 1; i < at24->num_addresses; i++) + i2c_unregister_device(at24->client[i]); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +static struct i2c_driver at24_driver = { + .driver = { + .name = "at24", + .owner = THIS_MODULE, + }, + .probe = at24_probe, + .remove = at24_remove, + .id_table = at24_ids, +}; + +static int __init at24_init(void) +{ + if (!io_limit) { + pr_err("at24: io_limit must not be 0!\n"); + return -EINVAL; + } + + io_limit = rounddown_pow_of_two(io_limit); + return i2c_add_driver(&at24_driver); +} +module_init(at24_init); + +static void __exit at24_exit(void) +{ + i2c_del_driver(&at24_driver); +} +module_exit(at24_exit); + +MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); +MODULE_AUTHOR("David Brownell and Wolfram Sang"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c new file mode 100644 index 000000000000..90454a5bdb4a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c @@ -0,0 +1,1530 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BUS3_DEV_NUM 9 +#define BUS4_DEV_NUM 6 +#define BUS5_DEV_NUM 32 +#define DEFAULT_NUM 1 +#define BUS3_BASE_NUM 30 +#define BUS4_BASE_NUM 40 +#define BUS5_BASE_NUM 50 + +#define BUS3_MUX_REG 0x21 +#define BUS4_MUX_REG 0x21 +#define BUS5_MUX_REG 0x20 + +#define TEMP_FAN_VAL 0x06 +#define FANIO_CTL_VAL 0x07 +#define FAN_CTRL_VAL 0x05 +#define PSU1_VAL 0x00 +#define PSU2_VAL 0x20 +#define HOT_SWAP1_VAL 0x10 +#define HOT_SWAP2_VAL 0x30 +#define FAN_EEPROM1_VAL 0x00 +#define FAN_EEPROM2_VAL 0x01 +#define FAN_EEPROM3_VAL 0x02 +#define FAN_EEPROM4_VAL 0x03 +#define FAN_EEPROM5_VAL 0x04 + +#define SWPLD_REG 0x31 +#define SWPLD_SFP_MUX_REG 0x20 + +#define SYS_LED_REG 0x1C +#define FAN1_LED_REG 0x1D +#define FAN2_LED_REG 0x1E + +#define SFP_PRESENCE_1 0x38 +#define SFP_PRESENCE_2 0x39 +#define SFP_PRESENCE_3 0x3A +#define SFP_PRESENCE_4 0x3B + +#define SFP_LP_MODE_1 0x34 +#define SFP_LP_MODE_2 0x35 +#define SFP_LP_MODE_3 0x36 +#define SFP_LP_MODE_4 0x37 + +#define SFP_RESET_1 0x3C +#define SFP_RESET_2 0x3D +#define SFP_RESET_3 0x3E +#define SFP_RESET_4 0x3F + +#define SFP_RESPONSE_1 0x30 +#define SFP_RESPONSE_2 0x31 +#define SFP_RESPONSE_3 0x32 +#define SFP_RESPONSE_4 0x33 + +#define SFF8436_INFO(data) \ + .type = "sff8436", .addr = 0x50, .platform_data = (data) + +#define SFF_8346_PORT(eedata) \ + .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY + +#define ag9032v1_i2c_device_num(NUM){ \ + .name = "delta-ag9032v1-i2c-device", \ + .id = NUM, \ + .dev = { \ + .platform_data = &ag9032v1_i2c_device_platform_data[NUM], \ + .release = device_release, \ + }, \ +} + +/*Define struct to get client of i2c_new_deivce */ +struct i2c_client * i2c_client_9547; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, +}; + +unsigned char reverse_8bits(unsigned char c) +{ + unsigned char s = 0; + int i; + for (i = 0; i < 8; ++i) { + s <<= 1; + s |= c & 1; + c >>= 1; + } + return s; +} +/*---------------- I2C device - start ------------- */ +static void device_release(struct device *dev) +{ + return; +} + +struct i2c_device_platform_data { + int parent; + struct i2c_board_info info; + struct i2c_client *client; +}; +/* pca9547 - add 8 bus */ +static struct pca954x_platform_mode pca954x_mode[] = { + { .adap_id = 2, + .deselect_on_exit = 1, + }, + { .adap_id = 3, + .deselect_on_exit = 1, + }, + { .adap_id = 4, + .deselect_on_exit = 1, + }, + { .adap_id = 5, + .deselect_on_exit = 1, + }, + { .adap_id = 6, + .deselect_on_exit = 1, + }, + { .adap_id = 7, + .deselect_on_exit = 1, + }, + { .adap_id = 8, + .deselect_on_exit = 1, + }, + { .adap_id = 9, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_data pca954x_data = { + .modes = pca954x_mode, + .num_modes = ARRAY_SIZE(pca954x_mode), +}; + +static struct i2c_board_info __initdata i2c_info_pca9547[] = +{ + { + I2C_BOARD_INFO("pca9547", 0x71), + .platform_data = &pca954x_data, + }, +}; + + +static struct sff_8436_platform_data sff_8436_port[] = { + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, +}; + +static struct i2c_device_platform_data ag9032v1_i2c_device_platform_data[] = { + { + /* tmp75 (0x4d) */ + .parent = 2, + .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, + .client = NULL, + }, + { + /* id eeprom (0x53) */ + .parent = 2, + .info = { I2C_BOARD_INFO("24c02", 0x53) }, + .client = NULL, + }, + { + /* tmp75 (0x4c) */ + .parent = 7, + .info = { I2C_BOARD_INFO("tmp75", 0x4c) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 7, + .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, + .client = NULL, + }, + { + /* tmp75 (0x4e) */ + .parent = 7, + .info = { I2C_BOARD_INFO("tmp75", 0x4e) }, + .client = NULL, + }, + { + /* tmp75 (0x4f) */ + .parent = 30, + .info = { I2C_BOARD_INFO("tmp75", 0x4f) }, + .client = NULL, + }, + { + /* FAN 1 Controller (0x2c) */ + .parent = 37, + .info = { I2C_BOARD_INFO("emc2305", 0x2c) }, + .client = NULL, + }, + { + /* FAN 2 Controller (0x2d) */ + .parent = 38, + .info = { I2C_BOARD_INFO("emc2305", 0x2d) }, + .client = NULL, + }, + { + /* psu 1 (0x58) */ + .parent = 40, + .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = 0 }, + .client = NULL, + }, + { + /* psu 2 (0x58) */ + .parent = 41, + .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = 1 }, + .client = NULL, + }, + { + /* hot-swap 1 (0x40) */ + .parent = 42, + .info = { .type = "ltc4215", .addr = 0x40, .platform_data = 0 }, + .client = NULL, + }, + { + /* hot-swap 2 (0x40) */ + .parent = 43, + .info = { .type = "ltc4215", .addr = 0x40, .platform_data = 1 }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 50, + .info = { SFF8436_INFO(&sff_8436_port[0]) }, + .client = NULL, + }, + { + /* qsfp 2 (0x50) */ + .parent = 51, + .info = { SFF8436_INFO(&sff_8436_port[1]) }, + .client = NULL, + }, + { + /* qsfp 3 (0x50) */ + .parent = 52, + .info = { SFF8436_INFO(&sff_8436_port[2]) }, + .client = NULL, + }, + { + /* qsfp 4 (0x50) */ + .parent = 53, + .info = { SFF8436_INFO(&sff_8436_port[3]) }, + .client = NULL, + }, + { + /* qsfp 5 (0x50) */ + .parent = 54, + .info = { SFF8436_INFO(&sff_8436_port[4]) }, + .client = NULL, + }, + { + /* qsfp 6 (0x50) */ + .parent = 55, + .info = { SFF8436_INFO(&sff_8436_port[5]) }, + .client = NULL, + }, + { + /* qsfp 7 (0x50) */ + .parent = 56, + .info = { SFF8436_INFO(&sff_8436_port[6]) }, + .client = NULL, + }, + { + /* qsfp 8 (0x50) */ + .parent = 57, + .info = { SFF8436_INFO(&sff_8436_port[7]) }, + .client = NULL, + }, + { + /* qsfp 9 (0x50) */ + .parent = 58, + .info = { SFF8436_INFO(&sff_8436_port[8]) }, + .client = NULL, + }, + { + /* qsfp 10 (0x50) */ + .parent = 59, + .info = { SFF8436_INFO(&sff_8436_port[9]) }, + .client = NULL, + }, + { + /* qsfp 11 (0x50) */ + .parent = 60, + .info = { SFF8436_INFO(&sff_8436_port[10]) }, + .client = NULL, + }, + { + /* qsfp 12 (0x50) */ + .parent = 61, + .info = { SFF8436_INFO(&sff_8436_port[11]) }, + .client = NULL, + }, + { + /* qsfp 13 (0x50) */ + .parent = 62, + .info = { SFF8436_INFO(&sff_8436_port[12]) }, + .client = NULL, + }, + { + /* qsfp 14 (0x50) */ + .parent = 63, + .info = { SFF8436_INFO(&sff_8436_port[13]) }, + .client = NULL, + }, + { + /* qsfp 15 (0x50) */ + .parent = 64, + .info = { SFF8436_INFO(&sff_8436_port[14]) }, + .client = NULL, + }, + { + /* qsfp 16 (0x50) */ + .parent = 65, + .info = { SFF8436_INFO(&sff_8436_port[15]) }, + .client = NULL, + }, + { + /* qsfp 17 (0x50) */ + .parent = 66, + .info = { SFF8436_INFO(&sff_8436_port[16]) }, + .client = NULL, + }, + { + /* qsfp 18 (0x50) */ + .parent = 67, + .info = { SFF8436_INFO(&sff_8436_port[17]) }, + .client = NULL, + }, + { + /* qsfp 19 (0x50) */ + .parent = 68, + .info = { SFF8436_INFO(&sff_8436_port[18]) }, + .client = NULL, + }, + { + /* qsfp 20 (0x50) */ + .parent = 69, + .info = { SFF8436_INFO(&sff_8436_port[19]) }, + .client = NULL, + }, + { + /* qsfp 21 (0x50) */ + .parent = 70, + .info = { SFF8436_INFO(&sff_8436_port[20]) }, + .client = NULL, + }, + { + /* qsfp 22 (0x50) */ + .parent = 71, + .info = { SFF8436_INFO(&sff_8436_port[21]) }, + .client = NULL, + }, + { + /* qsfp 23 (0x50) */ + .parent = 72, + .info = { SFF8436_INFO(&sff_8436_port[22]) }, + .client = NULL, + }, + { + /* qsfp 24 (0x50) */ + .parent = 73, + .info = { SFF8436_INFO(&sff_8436_port[23]) }, + .client = NULL, + }, + { + /* qsfp 25 (0x50) */ + .parent = 74, + .info = { SFF8436_INFO(&sff_8436_port[24]) }, + .client = NULL, + }, + { + /* qsfp 26 (0x50) */ + .parent = 75, + .info = { SFF8436_INFO(&sff_8436_port[25]) }, + .client = NULL, + }, + { + /* qsfp 27 (0x50) */ + .parent = 76, + .info = { SFF8436_INFO(&sff_8436_port[26]) }, + .client = NULL, + }, + { + /* qsfp 28 (0x50) */ + .parent = 77, + .info = { SFF8436_INFO(&sff_8436_port[27]) }, + .client = NULL, + }, + { + /* qsfp 29 (0x50) */ + .parent = 78, + .info = { SFF8436_INFO(&sff_8436_port[28]) }, + .client = NULL, + }, + { + /* qsfp 30 (0x50) */ + .parent = 79, + .info = { SFF8436_INFO(&sff_8436_port[29]) }, + .client = NULL, + }, + { + /* qsfp 31 (0x50) */ + .parent = 80, + .info = { SFF8436_INFO(&sff_8436_port[30]) }, + .client = NULL, + }, + { + /* qsfp 32 (0x50) */ + .parent = 81, + .info = { SFF8436_INFO(&sff_8436_port[31]) }, + .client = NULL, + }, +}; + + +static struct platform_device ag9032v1_i2c_device[] = { + ag9032v1_i2c_device_num(0), + ag9032v1_i2c_device_num(1), + ag9032v1_i2c_device_num(2), + ag9032v1_i2c_device_num(3), + ag9032v1_i2c_device_num(4), + ag9032v1_i2c_device_num(5), + ag9032v1_i2c_device_num(6), + ag9032v1_i2c_device_num(7), + ag9032v1_i2c_device_num(8), + ag9032v1_i2c_device_num(9), + ag9032v1_i2c_device_num(10), + ag9032v1_i2c_device_num(11), + ag9032v1_i2c_device_num(12), + ag9032v1_i2c_device_num(13), + ag9032v1_i2c_device_num(14), + ag9032v1_i2c_device_num(15), + ag9032v1_i2c_device_num(16), + ag9032v1_i2c_device_num(17), + ag9032v1_i2c_device_num(18), + ag9032v1_i2c_device_num(19), + ag9032v1_i2c_device_num(20), + ag9032v1_i2c_device_num(21), + ag9032v1_i2c_device_num(22), + ag9032v1_i2c_device_num(23), + ag9032v1_i2c_device_num(24), + ag9032v1_i2c_device_num(25), + ag9032v1_i2c_device_num(26), + ag9032v1_i2c_device_num(27), + ag9032v1_i2c_device_num(28), + ag9032v1_i2c_device_num(29), + ag9032v1_i2c_device_num(30), + ag9032v1_i2c_device_num(31), + ag9032v1_i2c_device_num(32), + ag9032v1_i2c_device_num(33), + ag9032v1_i2c_device_num(34), + ag9032v1_i2c_device_num(35), + ag9032v1_i2c_device_num(36), + ag9032v1_i2c_device_num(37), + ag9032v1_i2c_device_num(38), + ag9032v1_i2c_device_num(39), + ag9032v1_i2c_device_num(40), + ag9032v1_i2c_device_num(41), + ag9032v1_i2c_device_num(42), + ag9032v1_i2c_device_num(43), +}; + +/*---------------- I2C device - end ------------- */ + +/*---------------- I2C driver - start ------------- */ +static int __init i2c_device_probe(struct platform_device *pdev) +{ + struct i2c_device_platform_data *pdata; + struct i2c_adapter *parent; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + + pdata->client = i2c_new_device(parent, &pdata->info); + if (!pdata->client) { + dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", + pdata->info.type, pdata->parent); + return -ENODEV; + } + + return 0; +} + +static int __exit i2c_deivce_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent; + struct i2c_device_platform_data *pdata; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + if (pdata->client) { + parent = i2c_get_adapter(pdata->parent); + i2c_unregister_device(pdata->client); + i2c_put_adapter(parent); + } + + return 0; +} +static struct platform_driver i2c_device_driver = { + .probe = i2c_device_probe, + .remove = __exit_p(i2c_deivce_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9032v1-i2c-device", + } +}; + +/*---------------- I2C driver - end ------------- */ + +/*---------------- CPLD - start ------------- */ + +/* CPLD -- device */ + +enum cpld_type { + system_cpld, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data ag9032v1_cpld_platform_data[] = { + [system_cpld] = { + .reg_addr = SWPLD_REG, + }, +}; + +static struct platform_device ag9032v1_cpld = { + .name = "delta-ag9032v1-cpld", + .id = 0, + .dev = { + .platform_data = ag9032v1_cpld_platform_data, + .release = device_release + }, +}; + +static ssize_t get_present(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_1); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = (u32)reverse_8bits(ret) & 0xff; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_2); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_3); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_4); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_1); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = (u32)(reverse_8bits(ret) & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_2); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_3); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_4); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_1, (u8)reverse_8bits(data & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_2, (u8)(reverse_8bits(data >> 8) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_3, (u8)(reverse_8bits(data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_4, (u8)(reverse_8bits(data >> 24) & 0xff)); + + return count; +} + +static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_1); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = (u32)(reverse_8bits(ret) & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_2); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_3); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_4); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_1, (u8)reverse_8bits(data & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_2, (u8)reverse_8bits((data >> 8)& 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_3, (u8)reverse_8bits((data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_4, (u8)reverse_8bits((data >> 24) & 0xff)); + + return count; +} + +static ssize_t get_response(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_1); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data = (u32)(reverse_8bits(ret) & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_2); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_3); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_4); + if (ret < 0) + return sprintf(buf, "error number(%ld)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_1, (u8)reverse_8bits(data & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_2, (u8)reverse_8bits((data >> 8)& 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_3, (u8)reverse_8bits((data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_4, (u8)reverse_8bits((data >> 24) & 0xff)); + + return count; +} + +struct platform_led_status{ + int reg_data; + char *led_status; + int led_id; +}; + +static struct platform_led_status led_info[] = { + { + .reg_data = 0x40, + .led_status = "pwr1_green", + .led_id = 0, + }, + { + .reg_data = 0x80, + .led_status = "pwr1_amber", + .led_id = 0, + }, + { + .reg_data = 0x00, + .led_status = "pwr1_off", + .led_id = 0, + }, + { + .reg_data = 0xc0, + .led_status = "pwr1_off", + .led_id = 0, + }, + { + .reg_data = 0x10, + .led_status = "pwr2_green", + .led_id = 1, + }, + { + .reg_data = 0x20, + .led_status = "pwr2_amber", + .led_id = 1, + }, + { + .reg_data = 0x00, + .led_status = "pwr2_off", + .led_id = 1, + }, + { + .reg_data = 0x30, + .led_status = "pwr2_off", + .led_id = 1, + }, + { + .reg_data = 0x04, + .led_status = "sys_green", + .led_id = 2, + }, + { + .reg_data = 0x08, + .led_status = "sys_blinking_green", + .led_id = 2, + }, + { + .reg_data = 0x0c, + .led_status = "sys_red", + .led_id = 2, + }, + { + .reg_data = 0x00, + .led_status = "sys_off", + .led_id = 2, + }, + { + .reg_data = 0x01, + .led_status = "fan_green", + .led_id = 3, + }, + { + .reg_data = 0x02, + .led_status = "fan_amber", + .led_id = 3, + }, + { + .reg_data = 0x00, + .led_status = "fan_off", + .led_id = 3, + }, + { + .reg_data = 0x03, + .led_status = "fan_off", + .led_id = 3, + }, + { + .reg_data = 0x40, + .led_status = "fan1_green", + .led_id = 4, + }, + { + .reg_data = 0x80, + .led_status = "fan1_red", + .led_id = 4, + }, + { + .reg_data = 0x00, + .led_status = "fan1_off", + .led_id = 4, + }, + { + .reg_data = 0x10, + .led_status = "fan2_green", + .led_id = 5, + }, + { + .reg_data = 0x20, + .led_status = "fan2_red", + .led_id = 5, + }, + { + .reg_data = 0x00, + .led_status = "fan2_off", + .led_id = 5, + }, + { + .reg_data = 0x04, + .led_status = "fan3_green", + .led_id = 6, + }, + { + .reg_data = 0x08, + .led_status = "fan3_red", + .led_id = 6, + }, + { + .reg_data = 0x00, + .led_status = "fan3_off", + .led_id = 6, + }, + { + .reg_data = 0x01, + .led_status = "fan4_green", + .led_id = 7, + }, + { + .reg_data = 0x02, + .led_status = "fan4_red", + .led_id = 7, + }, + { + .reg_data = 0x00, + .led_status = "fan4_off", + .led_id = 7, + }, + { + .reg_data = 0x40, + .led_status = "fan5_green", + .led_id = 8, + }, + { + .reg_data = 0x80, + .led_status = "fan5_red", + .led_id = 8, + }, + { + .reg_data = 0x00, + .led_status = "fan5_off", + .led_id = 8, + }, +}; + +struct platform_led_data{ + int reg_addr; + int mask; +}; + +static struct platform_led_data led_data[] = { + { + .reg_addr = SYS_LED_REG, + .mask = 0xc0, + }, + { + .reg_addr = SYS_LED_REG, + .mask = 0x30, + }, + { + .reg_addr = SYS_LED_REG, + .mask = 0x0c, + }, + { + .reg_addr = SYS_LED_REG, + .mask = 0x03, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0xc0, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0x30, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0x0c, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0x03, + }, + { + .reg_addr = FAN2_LED_REG, + .mask = 0xc0, + }, +}; + + +static ssize_t get_led_color(struct device *dev, struct device_attribute *devattr, char *buf) +{ + char str[9][20] = {0}; + int board_data; + int led_data_number; + int led_info_number; + struct cpld_platform_data *pdata = dev->platform_data; + + for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ + board_data = i2c_smbus_read_byte_data(pdata[system_cpld].client, led_data[led_data_number].reg_addr); + if(board_data >= 0){ + board_data &= led_data[led_data_number].mask; + for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ + if (led_data_number == led_info[led_info_number].led_id){ + if(board_data == led_info[led_info_number].reg_data){ + sprintf(str[led_data_number], "%s", led_info[led_info_number].led_status); + } + } + } + } + else + printk( KERN_ERR "Missing LED board data\n"); + } + return sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",str[0],str[1],str[2],str[3],str[4],str[5],str[6],str[7],str[8]); +} + +static ssize_t set_led_color(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int led_info_number; + int led_data_number; + int str_compar; + int led_reg_value; + struct cpld_platform_data *pdata = dev->platform_data; + + for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ + str_compar = strncmp(buf,led_info[led_info_number].led_status,strlen(led_info[led_info_number].led_status)); + if(str_compar == 0){ + for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ + if(led_info[led_info_number].led_id == led_data_number){ + led_reg_value = i2c_smbus_read_byte_data(pdata[system_cpld].client, led_data[led_data_number].reg_addr); + if(led_reg_value >= 0){ + led_reg_value &= (~led_data[led_data_number].mask); + led_reg_value |= led_info[led_info_number].reg_data; + i2c_smbus_write_byte_data(pdata[system_cpld].client, (u8)(led_data[led_data_number].reg_addr & 0xff), (u8)(led_reg_value & 0xff)); + } + else + printk( KERN_ERR "Missing LED reg. data\n"); + } + } + } + } + return count; +} + + +static DEVICE_ATTR(sfp_present, S_IRUGO, get_present, NULL ); +static DEVICE_ATTR(sfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode ); +static DEVICE_ATTR(sfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset ); +static DEVICE_ATTR(sfp_response, S_IWUSR | S_IRUGO, get_response, set_response ); +static DEVICE_ATTR(led_control, S_IRUGO | S_IWUSR, get_led_color, set_led_color); + +static struct attribute *ag9032v1_cpld_attrs[] = { + &dev_attr_sfp_response.attr, + &dev_attr_sfp_present.attr, + &dev_attr_sfp_lpmode.attr, + &dev_attr_sfp_reset.attr, + &dev_attr_led_control.attr, + NULL, +}; + +static struct attribute_group ag9032v1_cpld_attr_grp = { + .attrs = ag9032v1_cpld_attrs, +}; + +/* CPLD -- driver */ +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS6); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS6); + return -ENODEV; + } + + pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); + if (!pdata[system_cpld].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); + goto error; + } + + ret = sysfs_create_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + return 0; + +error: + i2c_unregister_device(pdata[system_cpld].client); + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + if (pdata[system_cpld].client) { + if (!parent) { + parent = (pdata[system_cpld].client)->adapter; + } + i2c_unregister_device(pdata[system_cpld].client); + } + } + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9032v1-cpld", + }, +}; + +/*---------------- CPLD - end ------------- */ + +/*---------------- MUX - start ------------- */ + +struct swpld_mux_platform_data { + int parent; + int base_nr; + int reg_addr; + struct i2c_client *cpld; +}; + +struct swpld_mux { + struct i2c_adapter *parent; + struct i2c_adapter **child; + struct swpld_mux_platform_data data; +}; +static struct swpld_mux_platform_data ag9032v1_swpld_mux_platform_data[] = { + { + .parent = BUS3, + .base_nr = BUS3_BASE_NUM, + .cpld = NULL, + .reg_addr = BUS3_MUX_REG ,// the i2c register address which for select mux TEMP(FAN) + }, + { + .parent = BUS4, + .base_nr = BUS4_BASE_NUM , + .cpld = NULL, + .reg_addr = BUS4_MUX_REG , + }, + { + .parent = BUS5, + .base_nr = BUS5_BASE_NUM , + .cpld = NULL, + .reg_addr = BUS5_MUX_REG , + }, +}; + +static struct platform_device ag9032v1_swpld_mux[] = { + { + .name = "delta-ag9032v1-swpld-mux", + .id = 0, + .dev = { + .platform_data = &ag9032v1_swpld_mux_platform_data[0], + .release = device_release, + }, + }, + { + .name = "delta-ag9032v1-swpld-mux", + .id = 1, + .dev = { + .platform_data = &ag9032v1_swpld_mux_platform_data[1], + .release = device_release, + }, + }, + { + .name = "delta-ag9032v1-swpld-mux", + .id = 2, + .dev = { + .platform_data = &ag9032v1_swpld_mux_platform_data[2], + .release = device_release, + }, + }, +}; + +static int cpld_reg_write_byte(struct i2c_client *client, u8 regaddr, u8 val) +{ + union i2c_smbus_data data; + + data.byte = val; + return client->adapter->algo->smbus_xfer(client->adapter, client->addr, + client->flags, + I2C_SMBUS_WRITE, + regaddr, I2C_SMBUS_BYTE_DATA, &data); +} + +static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) +{ + struct swpld_mux *mux = data; + u8 swpld_mux_val=0; + + if ( mux->data.base_nr == BUS3_BASE_NUM ) + { + switch (chan) { + case 0: + swpld_mux_val = TEMP_FAN_VAL; + break; + case 1: + swpld_mux_val = FAN_EEPROM1_VAL; + break; + case 2: + swpld_mux_val = FAN_EEPROM2_VAL; + break; + case 3: + swpld_mux_val = FAN_EEPROM3_VAL; + break; + case 4: + swpld_mux_val = FAN_EEPROM4_VAL; + break; + case 5: + swpld_mux_val = FAN_EEPROM5_VAL; + break; + case 6: + swpld_mux_val = FANIO_CTL_VAL; + break; + case 7: + case 8: + swpld_mux_val = FAN_CTRL_VAL; + break; + } + } + else if ( mux->data.base_nr == BUS4_BASE_NUM ) + { + switch (chan) { + case 0: + swpld_mux_val = PSU1_VAL; + break; + case 1: + swpld_mux_val = PSU2_VAL; + break; + case 2: + swpld_mux_val = HOT_SWAP1_VAL; + break; + case 3: + swpld_mux_val = HOT_SWAP2_VAL; + break; + } + } + else if ( mux->data.base_nr == BUS5_BASE_NUM ){ + if (chan < 9){ + swpld_mux_val = (u8)(chan) + 0x01; + } + else if (8 < chan && chan < 19){ + swpld_mux_val = (u8)(chan - 9) + 0x10; + } + else if (18 < chan && chan < 29){ + swpld_mux_val = (u8)(chan - 19) + 0x20; + } + else if (28 < chan && chan < 39){ + swpld_mux_val = (u8)(chan - 29) + 0x30; + } + else{ + swpld_mux_val = 0x00; + } + } + else + { + swpld_mux_val = 0x00; + } + return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); +} + +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS3: + dev_num = BUS3_DEV_NUM; + break; + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + case BUS5: + dev_num = BUS5_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for mux\n"); + goto alloc_failed; + } + + mux->parent = parent; + mux->data = *pdata; + mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); + if (!mux->child) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for device on mux\n"); + goto alloc_failed2; + } + + for (i = 0; i < dev_num; i++) { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, + nr, i, class, + swpld_mux_select, NULL); + if (!mux->child[i]) { + ret = -ENODEV; + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + + platform_set_drvdata(pdev, mux); + return 0; + +add_adapter_failed: + for (; i > 0; i--) + i2c_del_mux_adapter(mux->child[i - 1]); + kfree(mux->child); +alloc_failed2: + kfree(mux); +alloc_failed: + i2c_put_adapter(parent); + + return ret; +} + + +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + int i; + struct swpld_mux *mux = platform_get_drvdata(pdev); + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + switch (pdata->parent) { + case BUS3: + dev_num = BUS3_DEV_NUM; + break; + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + case BUS5: + dev_num = BUS5_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + for (i = 0; i < dev_num; i++) + i2c_del_mux_adapter(mux->child[i]); + + platform_set_drvdata(pdev, NULL); + i2c_put_adapter(mux->parent); + kfree(mux->child); + kfree(mux); + + return 0; +} + +static struct platform_driver swpld_mux_driver = { + .probe = swpld_mux_probe, + .remove = __exit_p(swpld_mux_remove), /* TODO */ + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9032v1-swpld-mux", + }, +}; +/*---------------- MUX - end ------------- */ + +/*---------------- module initialization ------------- */ +static void __init delta_ag9032v1_platform_init(void) +{ + struct i2c_client *client; + struct i2c_adapter *adapter; + struct cpld_platform_data *cpld_pdata; + struct swpld_mux_platform_data *swpld_pdata; + int ret,i = 0; + printk("ag9032v1_platform module initialization\n"); + + //Use pca9547 in i2c_mux_pca954x.c + adapter = i2c_get_adapter(BUS1); + //client = i2c_new_device(adapter, &i2c_info_pca9547[0]); + i2c_client_9547 = i2c_new_device(adapter, &i2c_info_pca9547[0]); + + i2c_put_adapter(adapter); + + // set the CPLD prob and remove + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpld driver\n"); + goto error_cpld_driver; + } + // register the mux prob which call the CPLD + ret = platform_driver_register(&swpld_mux_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld mux driver\n"); + goto error_swpld_mux_driver; + } + + // register the i2c devices + ret = platform_driver_register(&i2c_device_driver); + if (ret) { + printk(KERN_WARNING "Fail to register i2c device driver\n"); + goto error_i2c_device_driver; + } + + // register the CPLD + ret = platform_device_register(&ag9032v1_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpld device\n"); + goto error_ag9032v1_cpld; + } + // link the CPLD and the Mux + cpld_pdata = ag9032v1_cpld.dev.platform_data; + + for (i = 0; i < ARRAY_SIZE(ag9032v1_swpld_mux); i++) + { + swpld_pdata = ag9032v1_swpld_mux[i].dev.platform_data; + swpld_pdata->cpld = cpld_pdata[system_cpld].client; + ret = platform_device_register(&ag9032v1_swpld_mux[i]); + if (ret) { + printk(KERN_WARNING "Fail to create swpld mux %d\n", i); + goto error_ag9032v1_swpld_mux; + } + } + + for (i = 0; i < ARRAY_SIZE(ag9032v1_i2c_device); i++) + { + ret = platform_device_register(&ag9032v1_i2c_device[i]); + if (ret) { + printk(KERN_WARNING "Fail to create i2c device %d\n", i); + goto error_ag9032v1_i2c_device; + } + } + + if (ret) + goto error_ag9032v1_swpld_mux; + + return 0; + +error_ag9032v1_i2c_device: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag9032v1_i2c_device[i]); + } + i = ARRAY_SIZE(ag9032v1_swpld_mux); +error_ag9032v1_swpld_mux: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag9032v1_swpld_mux[i]); + } + platform_driver_unregister(&ag9032v1_cpld); +error_ag9032v1_cpld: + platform_driver_unregister(&i2c_device_driver); +error_i2c_device_driver: + platform_driver_unregister(&swpld_mux_driver); +error_swpld_mux_driver: + platform_driver_unregister(&cpld_driver); +error_cpld_driver: + return ret; +} + +static void __exit delta_ag9032v1_platform_exit(void) +{ + int i = 0; + + for ( i = 0; i < ARRAY_SIZE(ag9032v1_i2c_device); i++ ) { + platform_device_unregister(&ag9032v1_i2c_device[i]); + } + + for (i = 0; i < ARRAY_SIZE(ag9032v1_swpld_mux); i++) { + platform_device_unregister(&ag9032v1_swpld_mux[i]); + } + + platform_device_unregister(&ag9032v1_cpld); + platform_driver_unregister(&i2c_device_driver); + platform_driver_unregister(&cpld_driver); + platform_driver_unregister(&swpld_mux_driver); + + i2c_unregister_device(i2c_client_9547); +} + +module_init(delta_ag9032v1_platform_init); +module_exit(delta_ag9032v1_platform_exit); + +MODULE_DESCRIPTION("DNI ag9032v1 Platform Support"); +MODULE_AUTHOR("Neal Tai "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c new file mode 100644 index 000000000000..b9ddb979a29b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c @@ -0,0 +1,545 @@ +/* + * An hwmon driver for delta AG9032v1 PSU + * dps_800ab_16_d.c - Support for DPS-800AB-16 D Power Supply Module + * + * Copyright (C) 2017 Delta Networks, Inc. + * + * Aries Lin + * + * Based on ym2651y.c + * Based on ad7414.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 +#define SWPLD_REG 0x31 +#define SWPLD_PSU_MUX_REG 0x21 +#define SELECT_PSU1_EEPROM 0x00 +#define SELECT_PSU2_EEPROM 0x20 + +u8 psu_member_data = 0x00; + +/* Address scanned */ +static const unsigned short normal_i2c[] = { 0x58, I2C_CLIENT_END }; + +/* This is additional data */ +struct dps_800ab_16_d_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; + unsigned long last_updated; /* In jiffies */ + + /* Registers value */ + u8 vout_mode; + u16 in1_input; + u16 in2_input; + u16 curr1_input; + u16 curr2_input; + u16 power1_input; + u16 power2_input; + u16 temp_input[2]; + u8 fan_target; + u16 fan_duty_cycle_input[2]; + u16 fan_speed_input[2]; + u8 mfr_model[16]; + u8 mfr_serial[16]; +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask); +static ssize_t set_fan_duty_cycle_input(struct device *dev, struct device_attribute \ + *dev_attr, const char *buf, size_t count); +static ssize_t for_linear_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static ssize_t for_fan_target(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static ssize_t for_vout_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static int dps_800ab_16_d_read_byte(struct i2c_client *client, u8 reg); +static int dps_800ab_16_d_read_word(struct i2c_client *client, u8 reg); +static int dps_800ab_16_d_write_word(struct i2c_client *client, u8 reg, \ + u16 value); +static int dps_800ab_16_d_read_block(struct i2c_client *client, u8 command, \ + u8 *data, int data_len); +static struct dps_800ab_16_d_data *dps_800ab_16_d_update_device( \ + struct device *dev); +static ssize_t for_ascii(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); +static ssize_t set_w_member_data(struct device *dev, struct device_attribute \ + *dev_att, const char *buf, size_t count); +static ssize_t for_r_member_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf); + +enum dps_800ab_16_d_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_FAULT, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, + PSU_MFR_MODEL, + PSU_MFR_SERIAL, + PSU_SELECT_MEMBER, +}; + +static ssize_t set_w_member_data(struct device *dev, struct device_attribute \ + *dev_attr, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + long data; + int error; + if (attr->index == PSU_SELECT_MEMBER) { + error = kstrtol(buf, 16, &data); + if (error) + return error; + if (SELECT_PSU1_EEPROM == data) { + psu_member_data = SELECT_PSU1_EEPROM; + } else if (SELECT_PSU2_EEPROM == data) { + psu_member_data = SELECT_PSU2_EEPROM; + } else { + return -EINVAL; + } + } + return count; +} + +static ssize_t for_r_member_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + return sprintf(buf, "0x%02X\n", psu_member_data); +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle_input(struct device *dev, struct device_attribute \ + *dev_attr, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct i2c_client *client = to_i2c_client(dev); + struct dps_800ab_16_d_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + /* Select SWPLD PSU offset */ + + mutex_lock(&data->update_lock); + data->fan_duty_cycle_input[nr] = speed; + dps_800ab_16_d_write_word(client, 0x3B + nr, data->fan_duty_cycle_input[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t for_linear_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_IN: + value = data->in1_input; + break; + case PSU_I_IN: + value = data->curr1_input; + break; + case PSU_I_OUT: + value = data->curr2_input; + break; + case PSU_P_IN: + value = data->power1_input; + multiplier = 1000*1000; + break; + case PSU_P_OUT: + value = data->power2_input; + multiplier = 1000*1000; + break; + case PSU_TEMP1_INPUT: + value = data->temp_input[0]; + break; + case PSU_FAN1_DUTY_CYCLE: + multiplier = 1; + value = data->fan_duty_cycle_input[0]; + break; + case PSU_FAN1_SPEED: + multiplier = 1; + value = data->fan_speed_input[0]; + break; + default: + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", \ + (mantissa << exponent) * multiplier) : \ + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t for_fan_target(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_target >> shift); +} + +static ssize_t for_vout_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->in2_input; + + return (exponent > 0) ? sprintf(buf, "%d\n", \ + (mantissa * multiplier) / (1 << exponent)): \ + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t for_ascii(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct dps_800ab_16_d_data *data = dps_800ab_16_d_update_device(dev); + u8 *ptr = NULL; + + if (!data->valid) + return 0; + + switch (attr->index) { + case PSU_MFR_MODEL: + ptr = data->mfr_model + 1; + break; + case PSU_MFR_SERIAL: + ptr = data->mfr_serial + 1; + break; + default: + return 0; + } + return sprintf(buf, "%s\n", ptr); +} +static int dps_800ab_16_d_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int dps_800ab_16_d_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int dps_800ab_16_d_write_word(struct i2c_client *client, u8 reg, \ + u16 value) +{ + union i2c_smbus_data data; + data.word = value; + return i2c_smbus_xfer(client->adapter, client->addr, + client->flags |= I2C_CLIENT_PEC, + I2C_SMBUS_WRITE, reg, + I2C_SMBUS_WORD_DATA, &data); + +} + +static int dps_800ab_16_d_read_block(struct i2c_client *client, u8 command, \ + u8 *data, int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, + data); + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; +abort: + return result; + +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct dps_800ab_16_d_data *dps_800ab_16_d_update_device( \ + struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct dps_800ab_16_d_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + /* Select SWPLD PSU offset */ + + if (time_after(jiffies, data->last_updated)) { + int i, status; + u8 command; + struct reg_data_byte regs_byte[] = { + {0x20, &data->vout_mode}, + {0x81, &data->fan_target} + }; + struct reg_data_word regs_word[] = { + {0x88, &data->in1_input}, + {0x8b, &data->in2_input}, + {0x89, &data->curr1_input}, + {0x8c, &data->curr2_input}, + {0x96, &data->power2_input}, + {0x97, &data->power1_input}, + {0x8d, &(data->temp_input[0])}, + {0x8e, &(data->temp_input[1])}, + {0x3b, &(data->fan_duty_cycle_input[0])}, + {0x90, &(data->fan_speed_input[0])}, + }; + + dev_dbg(&client->dev, "start data update\n"); + + /* one milliseconds from now */ + data->last_updated = jiffies + HZ / 1000; + + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = dps_800ab_16_d_read_byte(client, + regs_byte[i].reg); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + } else { + *(regs_byte[i].value) = status; + } + } + + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = dps_800ab_16_d_read_word(client, + regs_word[i].reg); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + } else { + *(regs_word[i].value) = status; + } + } + + command = 0x9a; /* PSU mfr_model */ + status = dps_800ab_16_d_read_block(client, command, + data->mfr_model, ARRAY_SIZE(data->mfr_model) - 1); + data->mfr_model[ARRAY_SIZE(data->mfr_model) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, + status); + } + + command = 0x9e; /* PSU mfr_serial */ + status = dps_800ab_16_d_read_block(client, command, + data->mfr_serial, ARRAY_SIZE(data->mfr_serial) - 1); + data->mfr_serial[ARRAY_SIZE(data->mfr_serial) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, + status); + } + + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; + +} + +/* sysfs attributes for hwmon */ +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, for_linear_data, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, for_vout_data, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, for_linear_data, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, for_linear_data, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, for_linear_data, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, for_linear_data, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(temp1_input, \ + S_IRUGO, for_linear_data, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(fan1_target, \ + S_IRUGO, for_fan_target, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(fan1_set_percentage, S_IWUGO | S_IRUGO, \ + for_linear_data, set_fan_duty_cycle_input, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(fan1_input, \ + S_IRUGO, for_linear_data, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_mfr_model, \ + S_IRUGO, for_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_serial, \ + S_IRUGO, for_ascii, NULL, PSU_MFR_SERIAL); +static SENSOR_DEVICE_ATTR(psu_select_member, S_IWUGO | S_IRUGO, \ + for_r_member_data, set_w_member_data, PSU_SELECT_MEMBER); + +static struct attribute *dps_800ab_16_d_attributes[] = { + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_target.dev_attr.attr, + &sensor_dev_attr_fan1_set_percentage.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_serial.dev_attr.attr, + &sensor_dev_attr_psu_select_member.dev_attr.attr, + NULL +}; + +static const struct attribute_group dps_800ab_16_d_group = { + .attrs = dps_800ab_16_d_attributes, +}; + +static int dps_800ab_16_d_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct dps_800ab_16_d_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "new chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &dps_800ab_16_d_group); + if (status) + goto exit_sysfs_create_group; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_hwmon_device_register; + } + + return 0; + +exit_hwmon_device_register: + sysfs_remove_group(&client->dev.kobj, &dps_800ab_16_d_group); +exit_sysfs_create_group: + kfree(data); +exit: + return status; +} + +static int dps_800ab_16_d_remove(struct i2c_client *client) +{ + struct dps_800ab_16_d_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &dps_800ab_16_d_group); + kfree(data); + + return 0; +} + +enum id_name { + dni_ag9032v1_psu, + dps_800ab_16_d +}; + +static const struct i2c_device_id dps_800ab_16_d_id[] = { + { "dni_ag9032v1_psu", dni_ag9032v1_psu }, + { "dps_800ab_16_d", dps_800ab_16_d }, + {} +}; +MODULE_DEVICE_TABLE(i2c, dps_800ab_16_d_id); + +/* This is the driver that will be inserted */ +static struct i2c_driver dps_800ab_16_d_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "dps_800ab_16_d", + }, + .probe = dps_800ab_16_d_probe, + .remove = dps_800ab_16_d_remove, + .id_table = dps_800ab_16_d_id, + .address_list = normal_i2c, +}; + +static int __init dps_800ab_16_d_init(void) +{ + return i2c_add_driver(&dps_800ab_16_d_driver); +} + +static void __exit dps_800ab_16_d_exit(void) +{ + i2c_del_driver(&dps_800ab_16_d_driver); +} + + +MODULE_AUTHOR("Aries Lin "); +MODULE_DESCRIPTION("DPS_800AB_16_D Driver"); +MODULE_LICENSE("GPL"); + +module_init(dps_800ab_16_d_init); +module_exit(dps_800ab_16_d_exit); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c new file mode 100644 index 000000000000..73d9900af5b4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_emc2305.c @@ -0,0 +1,381 @@ +/* + * + * + * Copyright (C) 2017 Delta Networks, Inc. + * + * This program is free software; you can redistribute it + * and/or modify it under the terms ofthe GNU General Public License as + * published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * + * + * + * + * A hwmon driver for the SMSC EMC2305 fan controller + * Complete datasheet is available (6/2013) at: + * http://www.smsc.com/media/Downloads_Public/Data_Sheets/2305.pdf + */ + +#include +#include +#include +#include +#include + + +static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf); +static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, + char *buf); +static ssize_t set_fan_percentage(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_fan_percentage(struct device *dev, struct device_attribute * devattr, + char *buf); +static const unsigned short normal_i2c[] = { 0x2C, 0x2D, 0x2E, 0x2F, 0x4C, + 0x4D, I2C_CLIENT_END + }; + + +#define EMC2305_REG_DEVICE 0xFD +#define EMC2305_REG_VENDOR 0xFE + +//#define FAN_MINIMUN 0x33 /*20%*/ +#define FAN_MINIMUN 0x0 /*0%*/ +#define FAN_RPM_BASED 0xAB + +#define EMC2305_REG_FAN_DRIVE(n) (0x30 + 0x10 * n) +#define EMC2305_REG_FAN_MIN_DRIVE(n) (0x38 + 0x10 * n) +#define EMC2305_REG_FAN_TACH(n) (0x3E + 0x10 * n) +#define EMC2305_REG_FAN_CONF(n) (0x32 + 0x10 * n) +#define EMC2305_REG_FAN_REAR_H_RPM(n) (0x3D + 0x10 * n) +#define EMC2305_REG_FAN_REAR_L_RPM(n) (0x3C + 0x10 * n) + +#define EMC2305_DEVICE 0x34 +#define EMC2305_VENDOR 0x5D +#define MAX_FAN_SPEED 23000 + +struct emc2305_data +{ + struct device *hwmon_dev; + struct attribute_group attrs; + struct mutex lock; +}; + +static int emc2305_probe(struct i2c_client *client, + const struct i2c_device_id *id); +static int emc2305_detect(struct i2c_client *client, + struct i2c_board_info *info); +static int emc2305_remove(struct i2c_client *client); + +static const struct i2c_device_id emc2305_id[] = +{ + { "emc2305", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, emc2305_id); + +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 = normal_i2c, +}; + +static SENSOR_DEVICE_ATTR(fan1_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 0); +static SENSOR_DEVICE_ATTR(fan2_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 1); +static SENSOR_DEVICE_ATTR(fan3_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 2); +static SENSOR_DEVICE_ATTR(fan4_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 3); +static SENSOR_DEVICE_ATTR(fan5_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 4); +static SENSOR_DEVICE_ATTR(fan1_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 0); +static SENSOR_DEVICE_ATTR(fan2_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 1); +static SENSOR_DEVICE_ATTR(fan3_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 2); +static SENSOR_DEVICE_ATTR(fan4_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 3); +static SENSOR_DEVICE_ATTR(fan5_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 4); +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3); +static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 4); + +static struct attribute *emc2305_attr[] = +{ + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan1_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan2_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan3_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan4_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan5_input_percentage.dev_attr.attr, + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, + &sensor_dev_attr_pwm5.dev_attr.attr, + NULL +}; + +static ssize_t show_fan_percentage(struct device *dev, struct device_attribute * devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + mutex_lock(&data->lock); + val = i2c_smbus_read_word_swapped(client, + EMC2305_REG_FAN_TACH(attr->index)); + mutex_unlock(&data->lock); + /* Left shift 3 bits for showing correct RPM */ + val = val >> 3; + if ((int)(3932160 * 2 / (val > 0 ? val : 1) == 960))return sprintf(buf, "%d\n", 0); + return sprintf(buf, "%d\n", (int)(3932160 * 2 / (val > 0 ? val : 1) * 100 / MAX_FAN_SPEED)); +} + + +static ssize_t set_fan_percentage(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long hsb, lsb; + unsigned long tech; + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 100) + { + return -EINVAL; + } + + if (val <= 5) + { + hsb = 0xff; /*high bit*/ + lsb = 0xe0; /*low bit*/ + } + else + { + val = val * 230; + tech = (3932160 * 2) / (val > 0 ? val : 1); + hsb = (uint8_t)(((tech << 3) >> 8) & 0x0ff); + lsb = (uint8_t)((tech << 3) & 0x0f8); + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_H_RPM(attr->index), hsb); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_L_RPM(attr->index), lsb); + mutex_unlock(&data->lock); + return count; +} + + +static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + + mutex_lock(&data->lock); + val = i2c_smbus_read_word_swapped(client, + EMC2305_REG_FAN_TACH(attr->index)); + mutex_unlock(&data->lock); + /* Left shift 3 bits for showing correct RPM */ + val = val >> 3; + return sprintf(buf, "%d\n", 3932160 * 2 / (val > 0 ? val : 1)); +} + +static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long hsb, lsb; + unsigned long tech; + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 23000) + { + return -EINVAL; + } + + if (val <= 960) + { + hsb = 0xff; /*high bit*/ + lsb = 0xe0; /*low bit*/ + } + else + { + tech = (3932160 * 2) / (val > 0 ? val : 1); + hsb = (uint8_t)(((tech << 3) >> 8) & 0x0ff); + lsb = (uint8_t)((tech << 3) & 0x0f8); + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_H_RPM(attr->index), hsb); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_L_RPM(attr->index), lsb); + mutex_unlock(&data->lock); + return count; +} + +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + mutex_lock(&data->lock); + val = i2c_smbus_read_byte_data(client, + EMC2305_REG_FAN_DRIVE(attr->index)); + mutex_unlock(&data->lock); + return sprintf(buf, "%d\n", val); +} + +static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 255) + { + return -EINVAL; + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, + EMC2305_REG_FAN_DRIVE(attr->index), + val); + mutex_unlock(&data->lock); + return count; +} + +static int emc2305_detect(struct i2c_client *client, + struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + int vendor, device; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + { + return -ENODEV; + } + + vendor = i2c_smbus_read_byte_data(client, EMC2305_REG_VENDOR); + if (vendor != EMC2305_VENDOR) + { + return -ENODEV; + } + + device = i2c_smbus_read_byte_data(client, EMC2305_REG_DEVICE); + if (device != EMC2305_DEVICE) + { + return -ENODEV; + } + + strlcpy(info->type, "emc2305", I2C_NAME_SIZE); + + return 0; +} + +static int emc2305_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct emc2305_data *data; + int err; + int i; + + data = devm_kzalloc(&client->dev, sizeof(struct emc2305_data), + GFP_KERNEL); + if (!data) + { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + + dev_info(&client->dev, "%s chip found\n", client->name); + + data->attrs.attrs = emc2305_attr; + err = sysfs_create_group(&client->dev.kobj, &data->attrs); + if (err) + { + return err; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + err = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + for (i = 0; i < 5; i++) + { + /* set minimum drive to 0% */ + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_MIN_DRIVE(i), FAN_MINIMUN); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_CONF(i), FAN_RPM_BASED); + } + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &data->attrs); + return err; +} + +static int emc2305_remove(struct i2c_client *client) +{ + struct emc2305_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &data->attrs); + return 0; +} + +module_i2c_driver(emc2305_driver); + +MODULE_AUTHOR("Neal Tai"); +MODULE_DESCRIPTION("SMSC EMC2305 fan controller driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh new file mode 100755 index 000000000000..c5f897ff007f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +#platform init script for Delta ag9032v1 + +#fan speed monitol start +/usr/share/sonic/device/x86_64-delta_ag9032v1-r0/fancontrol.service /usr/share/sonic/device/x86_64-delta_ag9032v1-r0/fancontrol & + +exit 0 + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh new file mode 100755 index 000000000000..5685bd71f58c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh @@ -0,0 +1,225 @@ +#!/bin/bash + +FAN1_EEPROM="-y 31 0x51 0x0a" +FAN2_EEPROM="-y 32 0x52 0x0a" +FAN3_EEPROM="-y 33 0x53 0x0a" +FAN4_EEPROM="-y 34 0x54 0x0a" +FAN5_EEPROM="-y 35 0x55 0x0a" +LED_CONTROL="/sys/devices/platform/delta-ag9032v1-cpld.0/led_control" +FAN1_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan5_input" +FAN1_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan5_input" +FAN2_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan4_input" +FAN2_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan4_input" +FAN3_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan3_input" +FAN3_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan3_input" +FAN4_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan2_input" +FAN4_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan2_input" +FAN5_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan1_input" +FAN5_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan1_input" + +PSU1_EEPROM="-y 40 0x50 0x00" +PSU2_EEPROM="-y 41 0x50 0x00" +PSU1_FAN_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-4/i2c-40/40-0058/fan1_input" +PSU2_FAN_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-4/i2c-41/41-0058/fan1_input" + +catfaneeprom(){ + fan_eeprom_num=0 + i2cget $FAN1_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan_eeprom_num=$((fan_eeprom_num)) + fi + i2cget $FAN2_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan_eeprom_num=$((fan_eeprom_num_num)) + fi + + i2cget $FAN3_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan_eeprom_num=$((fan_eeprom_num)) + fi + + i2cget $FAN4_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan_eeprom_num=$((fan_eeprom_num)) + fi + + i2cget $FAN5_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + fan_eeprom_num=$((fan_eeprom_num)) + fi +} + +catfanspeed(){ + fan_rpm_normal_num=0 + fan1_rpm_normal_num=0 + fan1_front_rpm=`cat $FAN1_FRONT_RPM` + fan1_rear_rpm=`cat $FAN1_REAR_RPM` + if [ "${fan1_front_rpm}" -ne "960" ] && [ "${fan1_rear_rpm}" -ne "960" ] && [ "${fan1_front_rpm}" -ne "0" ] && [ "${fan1_rear_rpm}" -ne "0" ]; then + fan1_rpm_normal_num=$((fan1_rpm_normal_num+1)) + elif [ "${fan1_front_rpm}" -eq "960" ] || [ "${fan1_rear_rpm}" -eq "960" ] || [ "${fan1_front_rpm}" -eq "0" ] || [ "${fan1_rear_rpm}" -eq "0" ]; then + fan1_rpm_normal_num=$((fan1_rpm_normal_num)) + fi + + fan2_rpm_normal_num=0 + fan2_front_rpm=`cat $FAN2_FRONT_RPM` + fan2_rear_rpm=`cat $FAN2_REAR_RPM` + if [ "${fan2_front_rpm}" -ne "960" ] && [ "${fan2_rear_rpm}" -ne "960" ] && [ "${fan2_front_rpm}" -ne "0" ] && [ "${fan2_rear_rpm}" -ne "0" ]; then + fan2_rpm_normal_num=$((fan2_rpm_normal_num+1)) + elif [ "${fan2_front_rpm}" -eq "960" ] || [ "${fan2_rear_rpm}" -eq "960" ] || [ "${fan2_front_rpm}" -eq "0" ] || [ "${fan2_rear_rpm}" -eq "0" ]; then + fan2_rpm_normal_num=$((fan2_rpm_normal_num)) + fi + + fan3_rpm_normal_num=0 + fan3_front_rpm=`cat $FAN3_FRONT_RPM` + fan3_rear_rpm=`cat $FAN3_REAR_RPM` + if [ "${fan3_front_rpm}" -ne "960" ] && [ "${fan3_rear_rpm}" -ne "960" ] && [ "${fan3_front_rpm}" -ne "0" ] && [ "${fan3_rear_rpm}" -ne "0" ]; then + fan3_rpm_normal_num=$((fan3_rpm_normal_num+1)) + elif [ "${fan3_front_rpm}" -eq "960" ] || [ "${fan3_rear_rpm}" -eq "960" ] || [ "${fan3_front_rpm}" -eq "0" ] || [ "${fan3_rear_rpm}" -eq "0" ]; then + fan3_rpm_normal_num=$((fan3_rpm_normal_num)) + fi + + fan4_rpm_normal_num=0 + fan4_front_rpm=`cat $FAN4_FRONT_RPM` + fan4_rear_rpm=`cat $FAN4_REAR_RPM` + if [ "${fan4_front_rpm}" -ne "960" ] && [ "${fan4_rear_rpm}" -ne "960" ] && [ "${fan4_front_rpm}" -ne "0" ] && [ "${fan4_rear_rpm}" -ne "0" ]; then + fan4_rpm_normal_num=$((fan4_rpm_normal_num+1)) + elif [ "${fan4_front_rpm}" -eq "960" ] || [ "${fan4_rear_rpm}" -eq "960" ] || [ "${fan4_front_rpm}" -eq "0" ] || [ "${fan4_rear_rpm}" -eq "0" ]; then + fan4_rpm_normal_num=$((fan4_rpm_normal_num)) + fi + + fan5_rpm_normal_num=0 + fan5_front_rpm=`cat $FAN5_FRONT_RPM` + fan5_rear_rpm=`cat $FAN5_REAR_RPM` + if [ "${fan5_front_rpm}" -ne "960" ] && [ "${fan5_rear_rpm}" -ne "960" ] && [ "${fan5_front_rpm}" -ne "0" ] && [ "${fan5_rear_rpm}" -ne "0" ]; then + fan5_rpm_normal_num=$((fan5_rpm_normal_num+1)) + elif [ "${fan5_front_rpm}" -eq "960" ] || [ "${fan5_rear_rpm}" -eq "960" ] || [ "${fan5_front_rpm}" -eq "0" ] || [ "${fan5_rear_rpm}" -eq "0" ]; then + fan5_rpm_normal_num=$((fan5_rpm_normal_num)) + fi + + fan_rpm_normal_num=$((fan1_rpm_normal_num+fan2_rpm_normal_num+fan3_rpm_normal_num+fan4_rpm_normal_num+fan5_rpm_normal_num)) + +} + +catpsueeprom(){ + psu1_eeprom_num=0 + i2cget $PSU1_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + psu1_eeprom_num=$((psu1_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + psu1_eeprom_num=$((psu1_eeprom_num)) + fi + + psu2_eeprom_num=0 + i2cget $PSU2_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + psu2_eeprom_num=$((psu2_eeprom_num+1)) + elif [ "`echo $?`" -eq "2" ]; then + psu2_eeprom_num=$((psu2_eeprom_num)) + fi +} + +catpsufanspeed(){ + + psu1_rpm_normal_num=0 + psu1_rpm=`cat $PSU1_FAN_RPM` + + if [ "${psu1_rpm}" -ne "960" ] && [ "${psu1_rpm}" -ne "0" ]; then + psu1_rpm_normal_num=$((psu1_rpm_normal_num+1)) + elif [ "${psu1_rpm}" -eq "960" ] || [ "${psu1_rpm}" -eq "0" ]; then + psu1_rpm_normal_num=$((psu1_rpm_normal_num)) + fi + + psu2_rpm_normal_num=0 + psu2_rpm=`cat $PSU2_FAN_RPM` + + if [ "${psu2_rpm}" -ne "960" ] && [ "${psu2_rpm}" -ne "0" ]; then + psu2_rpm_normal_num=$((psu2_rpm_normal_num+1)) + elif [ "${psu2_rpm}" -eq "960" ] || [ "${psu2_rpm}" -eq "0" ]; then + psu2_rpm_normal_num=$((psu2_rpm_normal_num)) + fi + +} + +setfanled(){ + if [ "${fan_eeprom_num}" -eq "5" ] && [ "${fan_rpm_normal_num}" -eq "5" ]; then + echo "fan_green" > $LED_CONTROL + elif [ "${fan_eeprom_num}" -lt "5" ] || [ "${fan_rpm_normal_num}" -lt "5" ]; then + echo "fan_amber" > $LED_CONTROL + fi +} + +setpsuled(){ + if [ "${psu1_eeprom_num}" -eq "1" ] && [ "${psu1_rpm_normal_num}" -eq "1" ]; then + echo "pwr1_green" > $LED_CONTROL + elif [ "${psu1_eeprom_num}" -eq "0" ] || [ "${psu1_rpm_normal_num}" -eq "0" ]; then + echo "pwr1_amber" > $LED_CONTROL + fi + + if [ "${psu2_eeprom_num}" -eq "1" ] && [ "${psu2_rpm_normal_num}" -eq "1" ]; then + echo "pwr2_green" > $LED_CONTROL + elif [ "${psu2_eeprom_num}" -eq "0" ] || [ "${psu2_rpm_normal_num}" -eq "0" ]; then + echo "pwr2_amber" > $LED_CONTROL + fi +} + +setfantrayled(){ + if [ "${fan1_rpm_normal_num}" -eq "1" ]; then + echo "fan1_green" > $LED_CONTROL + else + echo "fan1_red" > $LED_CONTROL + fi + + if [ "${fan2_rpm_normal_num}" -eq "1" ]; then + echo "fan2_green" > $LED_CONTROL + else + echo "fan2_red" > $LED_CONTROL + fi + + if [ "${fan3_rpm_normal_num}" -eq "1" ]; then + echo "fan3_green" > $LED_CONTROL + else + echo "fan3_red" > $LED_CONTROL + fi + + if [ "${fan4_rpm_normal_num}" -eq "1" ]; then + echo "fan4_green" > $LED_CONTROL + else + echo "fan4_red" > $LED_CONTROL + fi + + if [ "${fan5_rpm_normal_num}" -eq "1" ]; then + echo "fan5_green" > $LED_CONTROL + else + echo "fan5_red" > $LED_CONTROL + fi +} + +platformstatus(){ + + echo "sys_green" > $LED_CONTROL + catfaneeprom + catfanspeed + setfanled + setfantrayled + + catpsueeprom + catpsufanspeed + setpsuled +} + +while true +do + platformstatus + sleep 1 +done + diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/changelog b/platform/broadcom/sonic-platform-modules-delta/debian/changelog new file mode 100644 index 000000000000..ec8327e8ae7a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/changelog @@ -0,0 +1,5 @@ +sonic-delta-platform-modules (1.1) unstable; urgency=low + + * Initial release + + -- Neal Tai Fri, 21 APR 2017 11:11:11 -0800 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/compat b/platform/broadcom/sonic-platform-modules-delta/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control new file mode 100644 index 000000000000..7ad1550415be --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -0,0 +1,11 @@ +Source: sonic-delta-platform-modules +Section: main +Priority: extra +Maintainer: Neal Tai +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-ag9032v1 +Architecture: amd64 +Depends: linux-image-3.16.0-4-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/files b/platform/broadcom/sonic-platform-modules-delta/debian/files new file mode 100644 index 000000000000..ece02f8e80e2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/files @@ -0,0 +1 @@ +platform-modules-ag9032v1_1.1_amd64.deb main extra diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init new file mode 100755 index 000000000000..9b829652fd57 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init @@ -0,0 +1,49 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup ag9032v1 board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + depmod -a + rmmod i2c-i801 + rmmod i2c-ismt + modprobe i2c-dev + modprobe i2c-i801 + modprobe i2c-ismt + modprobe i2c-mux-pca954x + modprobe dni_ag9032v1_psu + modprobe dni_emc2305 + modprobe at24 + modprobe delta_ag9032v1_platform + + /usr/local/bin/ag9032v1_platform_init.sh + + echo "done." + ;; + +stop) + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-ag9032v1.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install new file mode 100644 index 000000000000..40f7e56d832d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install @@ -0,0 +1,3 @@ +ag9032v1/scripts/ag9032v1_platform_init.sh usr/local/bin +ag9032v1/scripts/led_status.sh usr/local/bin +ag9032v1/cfg/ag9032v1-modules.conf etc/modules-load.d diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/rules b/platform/broadcom/sonic-platform-modules-delta/debian/rules new file mode 100644 index 000000000000..ae590626c817 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/rules @@ -0,0 +1,33 @@ +#!/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:= ag9032v1 + +%: + 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) + From b7c2ffa73aa9bb97be25c34477a84cc4de8085b1 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 27 Nov 2017 19:07:58 -0800 Subject: [PATCH 0950/1833] [Broadcom]: Update Broadcom SAI package to 3.0.3.2-15 (#1186) Add support for TD2 BCM 56854 Add th-ag9032v1-32x100G.config.bcm for Delta AG9032v1 Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 376882d95825..28785d369395 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-13_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-13_amd64.deb?sv=2015-04-05&sr=b&sig=YeXV0av6rUxy3s5VlQf4wsv6dLOKIGkkkP8lldlGr00%3D&se=2031-07-27T07%3A49%3A38Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.2-15_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-15_amd64.deb?sv=2015-04-05&sr=b&sig=U1jDC%2FrbcCn3KgZsP9GoKFa9PtyXhliMd9iJrx8%2B%2F5M%3D&se=2031-08-07T00%3A51%3A44Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-13_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-15_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-13_amd64.deb?sv=2015-04-05&sr=b&sig=u4dKbtc%2FAvlqq7l7BT9WcmLVEsWoV1LqOxSbBy0CkiA%3D&se=2031-07-27T07%3A50%3A08Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-15_amd64.deb?sv=2015-04-05&sr=b&sig=nLvctIrLerXpG0SdQisirbOn1OBNLKl%2BQ7xLHRzgczM%3D&se=2031-08-07T00%3A52%3A02Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 6e57e1d272f0a1e6fbf79379359945760fc4b376 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Tue, 28 Nov 2017 14:52:26 -0800 Subject: [PATCH 0951/1833] [FRR]: Fix FRR tempelate for router-id (#1187) --- dockers/docker-fpm-frr/bgpd.conf.j2 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 index 07e2dd0c571e..9afd6a5a8bf0 100644 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ b/dockers/docker-fpm-frr/bgpd.conf.j2 @@ -23,8 +23,13 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp bestpath as-path multipath-relax no bgp default ipv4-unicast {# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} - bgp router-id {{ LOOPBACK_INTERFACE.keys()[0][1] }} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv4 and name == 'Loopback0' %} + bgp router-id {{ prefix | ip }} +{% endif %} +{% endfor %} {# advertise loopback #} + {% for (name, prefix) in LOOPBACK_INTERFACE %} {% if prefix | ipv4 %} network {{ prefix | ip }}/32 From 33d5e93b0ab4796601e96e14c159e8441b536e7e Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 28 Nov 2017 18:31:43 -0800 Subject: [PATCH 0952/1833] [devices]: Update 6000, 6100, 7050 QOS configurations (#1191) --- .../Arista-7050-QX32/qos.json | 34 ++++++----------- .../Force10-S6000/qos.json | 34 ++++++----------- .../Force10-S6100/qos.json | 38 +++++++------------ 3 files changed, 38 insertions(+), 68 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json index 8de48a2d8d86..2539513d8e1f 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json @@ -105,21 +105,12 @@ "weight": "20" } }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, "PORT_QOS_MAP": { "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP:AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE:AZURE]", "pfc_enable": "3,4" } }, @@ -148,19 +139,18 @@ } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { - "scheduler" : "[SCHEDULER|scheduler.2]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:0-1" : { "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:3-4" : { "scheduler" : "[SCHEDULER|scheduler.0]", "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" } } } - diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json index 8de48a2d8d86..2539513d8e1f 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json @@ -105,21 +105,12 @@ "weight": "20" } }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, "PORT_QOS_MAP": { "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP:AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE:AZURE]", "pfc_enable": "3,4" } }, @@ -148,19 +139,18 @@ } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { - "scheduler" : "[SCHEDULER|scheduler.2]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:0-1" : { "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:3-4" : { "scheduler" : "[SCHEDULER|scheduler.0]", "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" } } } - diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json index 8de48a2d8d86..32f337770c0f 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json @@ -105,21 +105,12 @@ "weight": "20" } }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP:AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP:AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE:AZURE]", "pfc_enable": "3,4" } }, @@ -148,19 +139,18 @@ } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { - "scheduler" : "[SCHEDULER|scheduler.1]" + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63:0-1" : { + "wred_profile" : "[WRED_PROFILE:AZURE]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { - "scheduler" : "[SCHEDULER|scheduler.2]" + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63:3-4" : { + "scheduler" : "[SCHEDULER:scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63:0" : { + "scheduler" : "[SCHEDULER:scheduler.1]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63:1" : { + "scheduler" : "[SCHEDULER:scheduler.2]" } } } - From 51dfa1768db51252a1d310211cc6d68f36ee99e4 Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Thu, 30 Nov 2017 03:57:35 +0800 Subject: [PATCH 0953/1833] [Ingrasys] Update platform configuration files (#1194) --- .../minigraph.xml | 4 +- .../INGRASYS-S8900-54XC/port_config.ini | 108 ++++---- .../INGRASYS-S8900-64XC/port_config.ini | 96 +++---- .../INGRASYS-S9200-64X/port_config.ini | 65 +++++ .../INGRASYS-S9200-64X/sai.profile | 1 + .../x86_64-ingrasys_s9200_64x-r0/fancontrol | 9 + .../installer.conf | 3 + .../led_proc_init.soc | 111 ++++++++ .../minigraph.xml | 151 ++++++++++ .../plugins/eeprom.py | 24 ++ .../plugins/sfputil.py | 260 ++++++++++++++++++ .../x86_64-ingrasys_s9200_64x-r0/sensors.conf | 68 +++++ platform/broadcom/one-image.mk | 1 + .../broadcom/platform-modules-ingrasys.mk | 6 + .../broadcom/sonic-platform-modules-ingrasys | 2 +- 15 files changed, 804 insertions(+), 105 deletions(-) create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/port_config.ini create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/sai.profile create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/fancontrol create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/installer.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/led_proc_init.soc create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml index ab90ada24274..991591585cca 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml @@ -103,7 +103,7 @@ 40000 DeviceInterfaceLink - OCPSCH8810MS + OCPSCH0104002MS Ethernet0 OCPSCH01040HHLF Ethernet52 @@ -111,7 +111,7 @@ - OCPSCH8810HHLF + OCPSCH01040HHLF INGRASYS-S8810-32Q diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini index 3350b68172cb..079bb63455f2 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/port_config.ini @@ -1,55 +1,55 @@ # name lanes alias index -Ethernet0 1 Ethernet1 0 -Ethernet1 2 Ethernet2 1 -Ethernet2 3 Ethernet3 2 -Ethernet3 4 Ethernet4 3 -Ethernet4 5 Ethernet5 4 -Ethernet5 6 Ethernet6 5 -Ethernet6 7 Ethernet7 6 -Ethernet7 8 Ethernet8 7 -Ethernet8 9 Ethernet9 8 -Ethernet9 10 Ethernet10 9 -Ethernet10 11 Ethernet11 10 -Ethernet11 12 Ethernet12 11 -Ethernet12 21 Ethernet13 12 -Ethernet13 22 Ethernet14 13 -Ethernet14 23 Ethernet15 14 -Ethernet15 24 Ethernet16 15 -Ethernet16 33 Ethernet17 16 -Ethernet17 34 Ethernet18 17 -Ethernet18 35 Ethernet19 18 -Ethernet19 36 Ethernet20 19 -Ethernet20 37 Ethernet21 20 -Ethernet21 38 Ethernet22 21 -Ethernet22 39 Ethernet23 22 -Ethernet23 40 Ethernet24 23 -Ethernet24 41 Ethernet25 24 -Ethernet25 42 Ethernet26 25 -Ethernet26 43 Ethernet27 26 -Ethernet27 44 Ethernet28 27 -Ethernet28 49 Ethernet29 28 -Ethernet29 50 Ethernet30 29 -Ethernet30 51 Ethernet31 30 -Ethernet31 52 Ethernet32 31 -Ethernet32 53 Ethernet33 32 -Ethernet33 54 Ethernet34 33 -Ethernet34 55 Ethernet35 34 -Ethernet35 56 Ethernet36 35 -Ethernet36 65 Ethernet37 36 -Ethernet37 66 Ethernet38 37 -Ethernet38 67 Ethernet39 38 -Ethernet39 68 Ethernet40 39 -Ethernet40 69 Ethernet41 40 -Ethernet41 70 Ethernet42 41 -Ethernet42 71 Ethernet43 42 -Ethernet43 72 Ethernet44 43 -Ethernet44 81 Ethernet45 44 -Ethernet45 82 Ethernet46 45 -Ethernet46 83 Ethernet47 46 -Ethernet47 84 Ethernet48 47 -Ethernet48 85,86,87,88 Ethernet49/1 48 -Ethernet52 97,98,99,100 Ethernet50/1 49 -Ethernet56 101,102,103,104 Ethernet51/1 50 -Ethernet60 105,106,107,108 Ethernet52/1 51 -Ethernet64 109,110,111,112 Ethernet53/1 52 -Ethernet68 117,118,119,120 Ethernet54/1 53 +Ethernet0 1 Ethernet1/1 0 +Ethernet1 2 Ethernet2/1 1 +Ethernet2 3 Ethernet3/1 2 +Ethernet3 4 Ethernet4/1 3 +Ethernet4 5 Ethernet5/1 4 +Ethernet5 6 Ethernet6/1 5 +Ethernet6 7 Ethernet7/1 6 +Ethernet7 8 Ethernet8/1 7 +Ethernet8 9 Ethernet9/1 8 +Ethernet9 10 Ethernet10/1 9 +Ethernet10 11 Ethernet11/1 10 +Ethernet11 12 Ethernet12/1 11 +Ethernet12 21 Ethernet13/1 12 +Ethernet13 22 Ethernet14/1 13 +Ethernet14 23 Ethernet15/1 14 +Ethernet15 24 Ethernet16/1 15 +Ethernet16 33 Ethernet17/1 16 +Ethernet17 34 Ethernet18/1 17 +Ethernet18 35 Ethernet19/1 18 +Ethernet19 36 Ethernet20/1 19 +Ethernet20 37 Ethernet21/1 20 +Ethernet21 38 Ethernet22/1 21 +Ethernet22 39 Ethernet23/1 22 +Ethernet23 40 Ethernet24/1 23 +Ethernet24 41 Ethernet25/1 24 +Ethernet25 42 Ethernet26/1 25 +Ethernet26 43 Ethernet27/1 26 +Ethernet27 44 Ethernet28/1 27 +Ethernet28 49 Ethernet29/1 28 +Ethernet29 50 Ethernet30/1 29 +Ethernet30 51 Ethernet31/1 30 +Ethernet31 52 Ethernet32/1 31 +Ethernet32 53 Ethernet33/1 32 +Ethernet33 54 Ethernet34/1 33 +Ethernet34 55 Ethernet35/1 34 +Ethernet35 56 Ethernet36/1 35 +Ethernet36 65 Ethernet37/1 36 +Ethernet37 66 Ethernet38/1 37 +Ethernet38 67 Ethernet39/1 38 +Ethernet39 68 Ethernet40/1 39 +Ethernet40 69 Ethernet41/1 40 +Ethernet41 70 Ethernet42/1 41 +Ethernet42 71 Ethernet43/1 42 +Ethernet43 72 Ethernet44/1 43 +Ethernet44 81 Ethernet45/1 44 +Ethernet45 82 Ethernet46/1 45 +Ethernet46 83 Ethernet47/1 46 +Ethernet47 84 Ethernet48/1 47 +Ethernet48 85,86,87,88 Ethernet52/1 48 +Ethernet52 97,98,99,100 Ethernet56/1 49 +Ethernet56 101,102,103,104 Ethernet60/1 50 +Ethernet60 105,106,107,108 Ethernet64/1 51 +Ethernet64 109,110,111,112 Ethernet68/1 52 +Ethernet68 117,118,119,120 Ethernet69/1 53 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini index b950538edba7..385056e6e8f0 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/port_config.ini @@ -1,52 +1,52 @@ # name lanes alias index -Ethernet0 17 Ethernet1 0 -Ethernet1 18 Ethernet2 1 -Ethernet2 19 Ethernet3 2 -Ethernet3 20 Ethernet4 3 -Ethernet4 24 Ethernet5 4 -Ethernet5 23 Ethernet6 5 -Ethernet6 22 Ethernet7 6 -Ethernet7 21 Ethernet8 7 -Ethernet8 28 Ethernet9 8 -Ethernet9 27 Ethernet10 9 -Ethernet10 26 Ethernet11 10 -Ethernet11 25 Ethernet12 11 -Ethernet12 32 Ethernet13 12 -Ethernet13 31 Ethernet14 13 -Ethernet14 30 Ethernet15 14 -Ethernet15 29 Ethernet16 15 -Ethernet16 1 Ethernet17 16 -Ethernet17 2 Ethernet18 17 -Ethernet18 3 Ethernet19 18 -Ethernet19 4 Ethernet20 19 -Ethernet20 8 Ethernet21 20 -Ethernet21 7 Ethernet22 21 -Ethernet22 6 Ethernet23 22 -Ethernet23 5 Ethernet24 23 -Ethernet24 12 Ethernet25 24 -Ethernet25 11 Ethernet26 25 -Ethernet26 10 Ethernet27 26 -Ethernet27 9 Ethernet28 27 -Ethernet28 13 Ethernet29 28 -Ethernet29 14 Ethernet30 29 -Ethernet30 15 Ethernet31 30 -Ethernet31 16 Ethernet32 31 -Ethernet32 33 Ethernet33 32 -Ethernet33 34 Ethernet34 33 -Ethernet34 35 Ethernet35 34 -Ethernet35 36 Ethernet36 35 -Ethernet36 38 Ethernet37 36 -Ethernet37 39 Ethernet38 37 -Ethernet38 40 Ethernet39 38 -Ethernet39 37 Ethernet40 39 -Ethernet40 41 Ethernet41 40 -Ethernet41 42 Ethernet42 41 -Ethernet42 43 Ethernet43 42 -Ethernet43 44 Ethernet44 43 -Ethernet44 48 Ethernet45 44 -Ethernet45 45 Ethernet46 45 -Ethernet46 46 Ethernet47 46 -Ethernet47 47 Ethernet48 47 +Ethernet0 17 Ethernet1/1 0 +Ethernet1 18 Ethernet2/1 1 +Ethernet2 19 Ethernet3/1 2 +Ethernet3 20 Ethernet4/1 3 +Ethernet4 24 Ethernet5/1 4 +Ethernet5 23 Ethernet6/1 5 +Ethernet6 22 Ethernet7/1 6 +Ethernet7 21 Ethernet8/1 7 +Ethernet8 28 Ethernet9/1 8 +Ethernet9 27 Ethernet10/1 9 +Ethernet10 26 Ethernet11/1 10 +Ethernet11 25 Ethernet12/1 11 +Ethernet12 32 Ethernet13/1 12 +Ethernet13 31 Ethernet14/1 13 +Ethernet14 30 Ethernet15/1 14 +Ethernet15 29 Ethernet16/1 15 +Ethernet16 1 Ethernet17/1 16 +Ethernet17 2 Ethernet18/1 17 +Ethernet18 3 Ethernet19/1 18 +Ethernet19 4 Ethernet20/1 19 +Ethernet20 8 Ethernet21/1 20 +Ethernet21 7 Ethernet22/1 21 +Ethernet22 6 Ethernet23/1 22 +Ethernet23 5 Ethernet24/1 23 +Ethernet24 12 Ethernet25/1 24 +Ethernet25 11 Ethernet26/1 25 +Ethernet26 10 Ethernet27/1 26 +Ethernet27 9 Ethernet28/1 27 +Ethernet28 13 Ethernet29/1 28 +Ethernet29 14 Ethernet30/1 29 +Ethernet30 15 Ethernet31/1 30 +Ethernet31 16 Ethernet32/1 31 +Ethernet32 33 Ethernet33/1 32 +Ethernet33 34 Ethernet34/1 33 +Ethernet34 35 Ethernet35/1 34 +Ethernet35 36 Ethernet36/1 35 +Ethernet36 38 Ethernet37/1 36 +Ethernet37 39 Ethernet38/1 37 +Ethernet38 40 Ethernet39/1 38 +Ethernet39 37 Ethernet40/1 39 +Ethernet40 41 Ethernet41/1 40 +Ethernet41 42 Ethernet42/1 41 +Ethernet42 43 Ethernet43/1 42 +Ethernet43 44 Ethernet44/1 43 +Ethernet44 48 Ethernet45/1 44 +Ethernet45 45 Ethernet46/1 45 +Ethernet46 46 Ethernet47/1 46 +Ethernet47 47 Ethernet48/1 47 Ethernet48 49,50,51,52 Ethernet49/1 48 Ethernet52 53,54,55,56 Ethernet50/1 49 Ethernet56 57,58,59,60 Ethernet51/1 50 diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/port_config.ini new file mode 100644 index 000000000000..f1127a5aa046 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias index +Ethernet0 1,2,3,4 Ethernet1/1 0 +Ethernet4 5,6,7,8 Ethernet2/1 1 +Ethernet8 17,18,19,20 Ethernet3/1 2 +Ethernet12 21,22,23,24 Ethernet4/1 3 +Ethernet16 33,34,35,36 Ethernet5/1 4 +Ethernet20 37,38,39,40 Ethernet6/1 5 +Ethernet24 49,50,51,52 Ethernet7/1 6 +Ethernet28 53,54,55,56 Ethernet8/1 7 +Ethernet32 65,66,67,68 Ethernet9/1 8 +Ethernet36 69,70,71,72 Ethernet10/1 9 +Ethernet40 81,82,83,84 Ethernet11/1 10 +Ethernet44 85,86,87,88 Ethernet12/1 11 +Ethernet48 97,98,99,100 Ethernet13/1 12 +Ethernet52 101,102,103,104 Ethernet14/1 13 +Ethernet56 113,114,115,116 Ethernet15/1 14 +Ethernet60 117,118,119,120 Ethernet16/1 15 +Ethernet64 129,130,131,132 Ethernet17/1 16 +Ethernet68 133,134,135,136 Ethernet18/1 17 +Ethernet72 145,146,147,148 Ethernet19/1 18 +Ethernet76 149,150,151,152 Ethernet20/1 19 +Ethernet80 161,162,163,164 Ethernet21/1 20 +Ethernet84 165,166,167,168 Ethernet22/1 21 +Ethernet88 177,178,179,180 Ethernet23/1 22 +Ethernet92 181,182,183,184 Ethernet24/1 23 +Ethernet96 193,194,195,196 Ethernet25/1 24 +Ethernet100 197,198,199,200 Ethernet26/1 25 +Ethernet104 209,210,211,212 Ethernet27/1 26 +Ethernet108 213,214,215,216 Ethernet28/1 27 +Ethernet112 225,226,227,228 Ethernet29/1 28 +Ethernet116 229,230,231,232 Ethernet30/1 29 +Ethernet120 241,242,243,244 Ethernet31/1 30 +Ethernet124 245,246,247,248 Ethernet32/1 31 +Ethernet128 9,10,11,12 Ethernet33/1 32 +Ethernet132 13,14,15,16 Ethernet34/1 33 +Ethernet136 25,26,27,28 Ethernet35/1 34 +Ethernet140 29,30,31,32 Ethernet36/1 35 +Ethernet144 41,42,43,44 Ethernet37/1 36 +Ethernet148 45,46,47,48 Ethernet38/1 37 +Ethernet152 57,58,59,60 Ethernet39/1 38 +Ethernet156 61,62,63,64 Ethernet40/1 39 +Ethernet160 73,74,75,76 Ethernet41/1 40 +Ethernet164 77,78,79,80 Ethernet42/1 41 +Ethernet168 89,90,91,92 Ethernet43/1 42 +Ethernet172 93,94,95,96 Ethernet44/1 43 +Ethernet176 105,106,107,108 Ethernet45/1 44 +Ethernet180 109,110,111,112 Ethernet46/1 45 +Ethernet184 121,122,123,124 Ethernet47/1 46 +Ethernet188 125,126,127,128 Ethernet48/1 47 +Ethernet192 137,138,139,140 Ethernet49/1 48 +Ethernet196 141,142,143,144 Ethernet50/1 49 +Ethernet200 153,154,155,156 Ethernet51/1 50 +Ethernet204 157,158,159,160 Ethernet52/1 51 +Ethernet208 169,170,171,172 Ethernet53/1 52 +Ethernet212 173,174,175,176 Ethernet54/1 53 +Ethernet216 185,186,187,188 Ethernet55/1 54 +Ethernet220 189,190,191,192 Ethernet56/1 55 +Ethernet224 201,202,203,204 Ethernet57/1 56 +Ethernet228 205,206,207,208 Ethernet58/1 57 +Ethernet232 217,218,219,220 Ethernet59/1 58 +Ethernet236 221,222,223,224 Ethernet60/1 59 +Ethernet240 233,234,235,236 Ethernet61/1 60 +Ethernet244 237,238,239,240 Ethernet62/1 61 +Ethernet248 249,250,251,252 Ethernet63/1 62 +Ethernet252 253,254,255,256 Ethernet64/1 63 diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/sai.profile b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/sai.profile new file mode 100644 index 000000000000..20bbcc6a07df --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/INGRASYS-S9200-64X/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th2-s9200-64x100G.config.bcm diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/fancontrol new file mode 100644 index 000000000000..185ee3a2fc25 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/fancontrol @@ -0,0 +1,9 @@ +INTERVAL=10 +DEVPATH=hwmon5=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-16/16-002f hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-7/7-004d +DEVNAME=hwmon5=w83795adg +FCTEMPS=hwmon5/device/pwm2=hwmon1/temp1_input +FCFANS=hwmon5/device/pwm2=hwmon5/device/fan7_input hwmon5/device/pwm2=hwmon5/device/fan5_input hwmon5/device/pwm2=hwmon5/device/fan3_input hwmon5/device/pwm2=hwmon5/device/fan1_input +MINTEMP=hwmon5/device/pwm2=20 +MAXTEMP=hwmon5/device/pwm2=60 +MINSTART=hwmon5/device/pwm2=75 +MINSTOP=hwmon5/device/pwm2=22 diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/led_proc_init.soc b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/led_proc_init.soc new file mode 100644 index 000000000000..774923ff868d --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/led_proc_init.soc @@ -0,0 +1,111 @@ +#processor initialization for Ingrasys S9200-64X + +led 0 stop +led 0 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0F 87 22 0E 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=56 REMAP_PORT_2=57 REMAP_PORT_1=58 REMAP_PORT_0=59 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=60 REMAP_PORT_6=61 REMAP_PORT_5=62 REMAP_PORT_4=63 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=52 REMAP_PORT_10=53 REMAP_PORT_9=54 REMAP_PORT_8=55 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=48 REMAP_PORT_14=49 REMAP_PORT_13=50 REMAP_PORT_12=51 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=40 REMAP_PORT_18=41 REMAP_PORT_17=42 REMAP_PORT_16=43 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=44 REMAP_PORT_22=45 REMAP_PORT_21=46 REMAP_PORT_20=47 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 REMAP_PORT_26=37 REMAP_PORT_25=38 REMAP_PORT_24=39 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 REMAP_PORT_30=33 REMAP_PORT_29=34 REMAP_PORT_28=35 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=24 REMAP_PORT_34=25 REMAP_PORT_33=26 REMAP_PORT_32=27 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=28 REMAP_PORT_38=29 REMAP_PORT_37=30 REMAP_PORT_36=31 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=20 REMAP_PORT_42=21 REMAP_PORT_41=22 REMAP_PORT_40=23 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=16 REMAP_PORT_46=17 REMAP_PORT_45=18 REMAP_PORT_44=19 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=8 REMAP_PORT_50=9 REMAP_PORT_49=10 REMAP_PORT_48=11 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=12 REMAP_PORT_54=13 REMAP_PORT_53=14 REMAP_PORT_52=15 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 REMAP_PORT_58=5 REMAP_PORT_57=6 REMAP_PORT_56=7 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 REMAP_PORT_62=1 REMAP_PORT_61=2 REMAP_PORT_60=3 + +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0F 87 22 0E 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 REMAP_PORT_2=1 REMAP_PORT_1=2 REMAP_PORT_0=3 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 REMAP_PORT_6=5 REMAP_PORT_5=6 REMAP_PORT_4=7 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=12 REMAP_PORT_10=13 REMAP_PORT_9=14 REMAP_PORT_8=15 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=8 REMAP_PORT_14=9 REMAP_PORT_13=10 REMAP_PORT_12=11 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=16 REMAP_PORT_18=17 REMAP_PORT_17=18 REMAP_PORT_16=19 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=20 REMAP_PORT_22=21 REMAP_PORT_21=22 REMAP_PORT_20=23 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=28 REMAP_PORT_26=29 REMAP_PORT_25=30 REMAP_PORT_24=31 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=24 REMAP_PORT_30=25 REMAP_PORT_29=26 REMAP_PORT_28=27 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=32 REMAP_PORT_34=33 REMAP_PORT_33=34 REMAP_PORT_32=35 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=36 REMAP_PORT_38=37 REMAP_PORT_37=38 REMAP_PORT_36=39 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=44 REMAP_PORT_42=45 REMAP_PORT_41=46 REMAP_PORT_40=47 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=40 REMAP_PORT_46=41 REMAP_PORT_45=42 REMAP_PORT_44=43 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=48 REMAP_PORT_50=49 REMAP_PORT_49=50 REMAP_PORT_48=51 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=52 REMAP_PORT_54=53 REMAP_PORT_53=54 REMAP_PORT_52=55 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=60 REMAP_PORT_58=61 REMAP_PORT_57=62 REMAP_PORT_56=63 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=56 REMAP_PORT_62=57 REMAP_PORT_61=58 REMAP_PORT_60=59 + +led 1 auto on +led 1 start + +led 2 stop +led 2 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0F 87 22 0E 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=56 REMAP_PORT_2=57 REMAP_PORT_1=58 REMAP_PORT_0=59 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=60 REMAP_PORT_6=61 REMAP_PORT_5=62 REMAP_PORT_4=63 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=52 REMAP_PORT_10=53 REMAP_PORT_9=54 REMAP_PORT_8=55 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=48 REMAP_PORT_14=49 REMAP_PORT_13=50 REMAP_PORT_12=51 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=40 REMAP_PORT_18=41 REMAP_PORT_17=42 REMAP_PORT_16=43 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=44 REMAP_PORT_22=45 REMAP_PORT_21=46 REMAP_PORT_20=47 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=36 REMAP_PORT_26=37 REMAP_PORT_25=38 REMAP_PORT_24=39 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=32 REMAP_PORT_30=33 REMAP_PORT_29=34 REMAP_PORT_28=35 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=24 REMAP_PORT_34=25 REMAP_PORT_33=26 REMAP_PORT_32=27 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=28 REMAP_PORT_38=29 REMAP_PORT_37=30 REMAP_PORT_36=31 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=20 REMAP_PORT_42=21 REMAP_PORT_41=22 REMAP_PORT_40=23 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=16 REMAP_PORT_46=17 REMAP_PORT_45=18 REMAP_PORT_44=19 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=8 REMAP_PORT_50=9 REMAP_PORT_49=10 REMAP_PORT_48=11 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=12 REMAP_PORT_54=13 REMAP_PORT_53=14 REMAP_PORT_52=15 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=4 REMAP_PORT_58=5 REMAP_PORT_57=6 REMAP_PORT_56=7 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 REMAP_PORT_62=1 REMAP_PORT_61=2 REMAP_PORT_60=3 + +led 2 auto on +led 2 start + +led 3 stop +led 3 prog 12 00 61 F1 12 10 61 F2 12 04 61 F3 12 04 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0F 87 22 0E 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 REMAP_PORT_2=1 REMAP_PORT_1=2 REMAP_PORT_0=3 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 REMAP_PORT_6=5 REMAP_PORT_5=6 REMAP_PORT_4=7 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=12 REMAP_PORT_10=13 REMAP_PORT_9=14 REMAP_PORT_8=15 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=8 REMAP_PORT_14=9 REMAP_PORT_13=10 REMAP_PORT_12=11 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=16 REMAP_PORT_18=17 REMAP_PORT_17=18 REMAP_PORT_16=19 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=20 REMAP_PORT_22=21 REMAP_PORT_21=22 REMAP_PORT_20=23 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=28 REMAP_PORT_26=29 REMAP_PORT_25=30 REMAP_PORT_24=31 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=24 REMAP_PORT_30=25 REMAP_PORT_29=26 REMAP_PORT_28=27 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=32 REMAP_PORT_34=33 REMAP_PORT_33=34 REMAP_PORT_32=35 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=36 REMAP_PORT_38=37 REMAP_PORT_37=38 REMAP_PORT_36=39 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=44 REMAP_PORT_42=45 REMAP_PORT_41=46 REMAP_PORT_40=47 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=40 REMAP_PORT_46=41 REMAP_PORT_45=42 REMAP_PORT_44=43 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=48 REMAP_PORT_50=49 REMAP_PORT_49=50 REMAP_PORT_48=51 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=52 REMAP_PORT_54=53 REMAP_PORT_53=54 REMAP_PORT_52=55 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=60 REMAP_PORT_58=61 REMAP_PORT_57=62 REMAP_PORT_56=63 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=56 REMAP_PORT_62=57 REMAP_PORT_61=58 REMAP_PORT_60=59 + +led 3 auto on +led 3 start + +led 4 stop +led 4 prog 12 00 61 F1 12 40 61 F2 12 01 61 F3 12 01 61 F4 67 16 86 F0 77 74 96 F2 2E F1 67 2B 67 3F 16 F3 FE F1 61 F1 12 00 DE F2 74 16 57 2E F1 32 00 32 01 B7 97 75 3A 02 01 60 FE 57 02 00 60 FE 57 2E F1 32 08 97 75 58 77 48 06 FE D2 01 70 50 77 66 06 F0 C2 08 74 58 77 66 16 F4 91 22 0E 87 22 0E 87 DA 00 74 5A 57 16 F4 91 22 0F 87 22 0E 87 DA 00 74 68 57 02 80 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=62 REMAP_PORT_2=0 REMAP_PORT_1=63 REMAP_PORT_0=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=0 REMAP_PORT_6=0 REMAP_PORT_5=0 REMAP_PORT_4=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=0 REMAP_PORT_10=0 REMAP_PORT_9=0 REMAP_PORT_8=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=0 REMAP_PORT_14=0 REMAP_PORT_13=0 REMAP_PORT_12=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=0 REMAP_PORT_18=0 REMAP_PORT_17=0 REMAP_PORT_16=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=0 REMAP_PORT_22=0 REMAP_PORT_21=0 REMAP_PORT_20=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=0 REMAP_PORT_26=0 REMAP_PORT_25=0 REMAP_PORT_24=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=0 REMAP_PORT_30=0 REMAP_PORT_29=0 REMAP_PORT_28=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=0 REMAP_PORT_34=0 REMAP_PORT_33=0 REMAP_PORT_32=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=0 REMAP_PORT_38=0 REMAP_PORT_37=0 REMAP_PORT_36=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=0 REMAP_PORT_42=0 REMAP_PORT_41=0 REMAP_PORT_40=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=0 REMAP_PORT_46=0 REMAP_PORT_45=0 REMAP_PORT_44=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=0 REMAP_PORT_50=0 REMAP_PORT_49=0 REMAP_PORT_48=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=0 REMAP_PORT_54=0 REMAP_PORT_53=0 REMAP_PORT_52=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=0 REMAP_PORT_58=0 REMAP_PORT_57=0 REMAP_PORT_56=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 REMAP_PORT_62=0 REMAP_PORT_61=0 REMAP_PORT_60=0 + +led 4 auto on +led 4 start diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml new file mode 100644 index 000000000000..2b05e9ed15b7 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml @@ -0,0 +1,151 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + OCPSCH01040GGLF + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040GGLF + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + OCPSCH01040GGLF + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + OCPSCH01040GGLF + Ethernet4 + + + + + OCPSCH01040GGLF + INGRASYS-S9200-64X + + + + + + + OCPSCH01040GGLF + + + 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 + + + + + + + OCPSCH01040GGLF + INGRASYS-S9200-64X +
diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..3d01608ef7b2 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S9200-64X +# +# 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): + i2c_bus = "0" + i2c_addr = "0055" + self.eeprom_path = "/sys/class/i2c-adapter/i2c-" + i2c_bus + "/" + i2c_bus + "-" + i2c_addr + "/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..4d5651c63a68 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py @@ -0,0 +1,260 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 63 + PORTS_IN_BLOCK = 64 + + EEPROM_OFFSET = 29 + + _port_to_eeprom_mapping = {} + + _logic_to_phy_port_mapping = { + 0: 0, + 1: 1, + 2: 4, + 3: 5, + 4: 8, + 5: 9, + 6: 12, + 7: 13, + 8: 16, + 9: 17, + 10: 20, + 11: 21, + 12: 24, + 13: 25, + 14: 28, + 15: 29, + 16: 32, + 17: 33, + 18: 36, + 19: 37, + 20: 40, + 21: 41, + 22: 44, + 23: 45, + 24: 48, + 25: 49, + 26: 52, + 27: 53, + 28: 56, + 29: 57, + 30: 60, + 31: 61, + 32: 2, + 33: 3, + 34: 6, + 35: 7, + 36: 10, + 37: 11, + 38: 14, + 39: 15, + 40: 18, + 41: 19, + 42: 22, + 43: 23, + 44: 26, + 45: 27, + 46: 30, + 47: 31, + 48: 34, + 49: 35, + 50: 38, + 51: 39, + 52: 42, + 53: 43, + 54: 46, + 55: 47, + 56: 50, + 57: 51, + 58: 54, + 59: 55, + 60: 58, + 61: 59, + 62: 62, + 63: 63 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + phy_port = self._logic_to_phy_port_mapping[x] + self._port_to_eeprom_mapping[x] = eeprom_path.format(phy_port + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + try: + reg_file = open("/sys/devices/platform/ingrasys-s9200-cpld.0/qsfp_modprs") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + try: + reg_file = open("/sys/devices/platform/ingrasys-s9200-cpld.0/qsfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + try: + reg_file = open("/sys/devices/platform/ingrasys-s9200-cpld.0/qsfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = format(reg_value, 'x') + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/ingrasys-s9200-cpld.0/qsfp_reset" + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = format(reg_value, 'x') + + reg_file.seek(0) + reg_file.write(content) + 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(QSFP_RESET_REGISTER_DEVICE_FILE, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + content = format(reg_value, 'x') + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf new file mode 100644 index 000000000000..ef694e96a056 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf @@ -0,0 +1,68 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + label temp1 "DIMM Temp" + set temp1_max 50 + set temp1_crit 85 + +chip "w83795adg-*" + ignore in0 + label in1 "P0V9" + set in1_min 0.90 * 0.97 + set in1_max 0.90 * 1.03 + ignore in2 + label in3 "P1V8" + set in3_min 1.8 * 0.97 + set in3_max 1.8 * 1.03 + label in4 "P1V0" + set in4_min 1.0 * 0.97 + set in4_max 1.0 * 1.03 + label in5 "P0V8" + set in5_min 0.8 * 0.97 + set in5_max 0.8 * 1.03 + ignore in6 + ignore in7 + ignore in8 + ignore in9 + ignore in10 + ignore in11 + ignore in12 + ignore in13 + ignore in14 + ignore in15 + ignore in16 + ignore in17 + ignore in18 + ignore in19 + label fan1 "FANTRAY 1" + ignore fan2 + label fan3 "FANTRAY 2" + ignore fan4 + label fan5 "FANTRAY 3" + ignore fan6 + label fan7 "FANTRAY 4" + ignore fan8 + ignore temp1 + ignore temp2 + ignore temp3 + ignore temp4 + ignore intrusion0 +bus "i2c-6" "i2c-0-mux (chan_id 5)" +chip "lm75-i2c-6-4E" + label temp1 "MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-6" "i2c-0-mux (chan_id 5)" +chip "lm75-i2c-6-4D" + label temp1 "REAR Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-7" "i2c-0-mux (chan_id 6)" +chip "lm75-i2c-7-4D" + label temp1 "Front Temp" + set temp1_max 50 + set temp1_max_hyst 45 diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 717ba7fa0f6b..5b2afedee7d7 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -11,6 +11,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(INGRASYS_S8900_64XC_PLATFORM_MODULE) \ $(INGRASYS_S9100_PLATFORM_MODULE) \ $(INGRASYS_S8810_32Q_PLATFORM_MODULE) \ + $(INGRASYS_S9200_64X_PLATFORM_MODULE) \ $(ACCTON_AS7712_32X_PLATFORM_MODULE) \ $(ACCTON_AS5712_54X_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-ingrasys.mk b/platform/broadcom/platform-modules-ingrasys.mk index e5ef4021eff7..f402a7fed1c6 100644 --- a/platform/broadcom/platform-modules-ingrasys.mk +++ b/platform/broadcom/platform-modules-ingrasys.mk @@ -4,11 +4,13 @@ INGRASYS_S9100_PLATFORM_MODULE_VERSION = 1.1.0 INGRASYS_S8900_64XC_PLATFORM_MODULE_VERSION = 1.1.0 INGRASYS_S8900_54XC_PLATFORM_MODULE_VERSION = 1.1.0 INGRASYS_S8810_32Q_PLATFORM_MODULE_VERSION = 1.1.0 +INGRASYS_S9200_64X_PLATFORM_MODULE_VERSION = 1.1.0 export INGRASYS_S9100_PLATFORM_MODULE_VERSION export INGRASYS_S8900_64XC_PLATFORM_MODULE_VERSION export INGRASYS_S8900_54XC_PLATFORM_MODULE_VERSION export INGRASYS_S8810_32Q_PLATFORM_MODULE_VERSION +export INGRASYS_S9200_64X_PLATFORM_MODULE_VERSION INGRASYS_S9100_PLATFORM_MODULE = sonic-platform-ingrasys-s9100_$(INGRASYS_S9100_PLATFORM_MODULE_VERSION)_amd64.deb $(INGRASYS_S9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys @@ -25,6 +27,10 @@ $(INGRASYS_S8900_54XC_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s8900_54xc-r0 INGRASYS_S8810_32Q_PLATFORM_MODULE = sonic-platform-ingrasys-s8810-32q_$(INGRASYS_S8810_32Q_PLATFORM_MODULE_VERSION)_amd64.deb $(INGRASYS_S8810_32Q_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s8810_32q-r0 +INGRASYS_S9200_64X_PLATFORM_MODULE = sonic-platform-ingrasys-s9200-64x_$(INGRASYS_S9200_64X_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S9200_64X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9200_64x-r0 + $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8900_64XC_PLATFORM_MODULE))) $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8900_54XC_PLATFORM_MODULE))) $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8810_32Q_PLATFORM_MODULE))) +$(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S9200_64X_PLATFORM_MODULE))) diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index e66b8839da21..e60d63d9b54d 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit e66b8839da2180fd586aae040701faf180d59477 +Subproject commit e60d63d9b54dc3673433615c555a4fc62bfc488d From d39dd396b52b9f66a2b7b10b6f31f39f18c94c9f Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 29 Nov 2017 16:36:26 -0800 Subject: [PATCH 0954/1833] Move tcpdump into /usr/bin Otherwise it's impossible to run tcpdump due to a docker bug (#1195) --- dockers/docker-ptf/Dockerfile.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 01312687b93c..2d9b1544d95a 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -100,6 +100,10 @@ RUN mkdir /var/run/sshd \ COPY ["supervisord.conf", "/etc/supervisor/"] COPY ["conf.d/supervisord.conf", "conf.d/sshd.conf", "conf.d/ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] +# Move tcpdump into /usr/bin Otherwise it's impossible to run tcpdump due to a docker bug +RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump +RUN ln -s /usr/bin/tcpdump /usr/sbin/tcpdump + RUN mkdir -p /var/log/supervisor EXPOSE 22 From 397f513362506b5e3e4915a24b93585747633cad Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Fri, 1 Dec 2017 03:19:41 +0800 Subject: [PATCH 0955/1833] [platform] Accton AS7712-32X. Update for sensors and sfputil (#1197) Revise kernel driver to duplicate nodes for support of lm-sensors, at fan and PSU. Update sfputil.py to to fit new SfpUtil prototype. Signed-off-by: roylee123 --- .../plugins/sfputil.py | 70 ++++++++++++++++--- .../broadcom/sonic-platform-modules-accton | 2 +- 2 files changed, 60 insertions(+), 12 deletions(-) diff --git a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py index 6dc35d72bb21..c13eecfd1759 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py @@ -1,19 +1,19 @@ #!/usr/bin/env python try: - from sonic_sfp.sfputilbase import sfputilbase + from sonic_sfp.sfputilbase import SfpUtilBase except ImportError, e: raise ImportError (str(e) + "- required module not found") -class sfputil(sfputilbase): - """Platform specific sfputil class""" +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" - port_start = 0 - port_end = 31 + _port_start = 0 + _port_end = 31 ports_in_block = 32 - port_to_eeprom_mapping = {} + _port_to_eeprom_mapping = {} port_to_i2c_mapping = { 9 : 18, 10 : 19, @@ -51,10 +51,58 @@ class sfputil(sfputilbase): _qsfp_ports = range(0, ports_in_block + 1) - def __init__(self, port_num): - # Override port_to_eeprom_mapping for class initialization + def __init__(self): eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' - for x in range(self.port_start, self.port_end + 1): + for x in range(0, self._port_end + 1): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x+1]) - self.port_to_eeprom_mapping[x] = port_eeprom_path - sfputilbase.__init__(self, port_num) + self._port_to_eeprom_mapping[x] = port_eeprom_path + SfpUtilBase.__init__(self) + + def reset(self, port_num): + return True + def set_low_power_mode(self, port_nuM, lpmode): + return True + def get_low_power_mode(self, port_num): + return True + +# def get_presence(self, port_num): +# return True + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + + try: + reg_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return range(0, self.ports_in_block + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index 3fbde584ba15..edfb5b2c1285 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit 3fbde584ba15f0178dc22cb7e56f2bb8481692d4 +Subproject commit edfb5b2c1285cbfd30d8a662ab738aee53a80439 From 73e4204521f122bd9e2776f9dbf70afcdefeba24 Mon Sep 17 00:00:00 2001 From: Polly Hsu Date: Fri, 1 Dec 2017 03:21:47 +0800 Subject: [PATCH 0956/1833] [device/accton]: Update Accton-AS5712_54X minigraph (#1196) * UPDATE. minigraph.xml to initialize the default IP address of all interfaces Signed-off-by: polly_hsu@accton.com --- .../x86_64-accton_as5712_54x-r0/minigraph.xml | 1245 ++++++++++++++++- 1 file changed, 1193 insertions(+), 52 deletions(-) diff --git a/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml index bf0b2e9c0fcd..78c3876d8381 100755 --- a/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml @@ -1,38 +1,458 @@ - + - OCPSCH0104001MS - 10.10.1.2 - OCPSCH01040AALF - 10.10.1.1 + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 1 - 10 - 3 + 180 + 60 - OCPSCH0104002MS - 10.10.2.2 - OCPSCH01040AALF - 10.10.2.1 + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 1 - 10 - 3 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 - 64536 - OCPSCH01040AALF + 65100 + switch1 -
10.10.1.1
+
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.10.2.1
+
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
@@ -40,13 +460,163 @@
- 64542 - OCPSCH0104001MS + 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 - 64543 - OCPSCH0104002MS + 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
@@ -58,38 +628,380 @@ HostIP Loopback0 - - 100.0.0.3/32 + + 10.1.0.32/32 - 100.0.0.3/32 + 10.1.0.32/32 - - ManagementIP1 - Management0 - - 192.168.200.12/24 - - 192.168.200.12/24 - - OCPSCH01040AALF + switch1 - + tenGigE0 - 10.10.1.1/30 + 10.0.0.0/31 + + + + tenGigE1 + 10.0.0.2/31 + + + + tenGigE2 + 10.0.0.4/31 + + + + tenGigE3 + 10.0.0.6/31 - + tenGigE4 - 10.10.2.1/30 + 10.0.0.8/31 + + + + tenGigE5 + 10.0.0.10/31 + + + + tenGigE6 + 10.0.0.12/31 + + + + tenGigE7 + 10.0.0.14/31 + + + + tenGigE8 + 10.0.0.16/31 + + + + tenGigE9 + 10.0.0.18/31 + + + + tenGigE10 + 10.0.0.20/31 + + + + tenGigE11 + 10.0.0.22/31 + + + + tenGigE12 + 10.0.0.24/31 + + + + tenGigE13 + 10.0.0.26/31 + + + + tenGigE14 + 10.0.0.28/31 + + + + tenGigE15 + 10.0.0.30/31 + + + + tenGigE16 + 10.0.0.32/31 + + + + tenGigE17 + 10.0.0.34/31 + + + + tenGigE18 + 10.0.0.36/31 + + + + tenGigE19 + 10.0.0.38/31 + + + + tenGigE20 + 10.0.0.40/31 + + + + tenGigE21 + 10.0.0.42/31 + + + + tenGigE22 + 10.0.0.44/31 + + + + tenGigE23 + 10.0.0.46/31 + + + + tenGigE24 + 10.0.0.48/31 + + + + tenGigE25 + 10.0.0.50/31 + + + + tenGigE26 + 10.0.0.52/31 + + + + tenGigE27 + 10.0.0.54/31 + + + + tenGigE28 + 10.0.0.56/31 + + + + tenGigE29 + 10.0.0.58/31 + + + + tenGigE30 + 10.0.0.60/31 + + + + tenGigE31 + 10.0.0.62/31 + + + + tenGigE32 + 10.0.0.64/31 + + + + tenGigE33 + 10.0.0.66/31 + + + + tenGigE34 + 10.0.0.68/31 + + + + tenGigE35 + 10.0.0.70/31 + + + + tenGigE36 + 10.0.0.72/31 + + + + tenGigE37 + 10.0.0.74/31 + + + + tenGigE38 + 10.0.0.76/31 + + + + tenGigE39 + 10.0.0.78/31 + + + + tenGigE40 + 10.0.0.80/31 + + + + tenGigE41 + 10.0.0.82/31 + + + + tenGigE42 + 10.0.0.84/31 + + + + tenGigE43 + 10.0.0.86/31 + + + + tenGigE44 + 10.0.0.88/31 + + + + tenGigE45 + 10.0.0.90/31 + + + + tenGigE46 + 10.0.0.92/31 + + + + tenGigE47 + 10.0.0.94/31 + + + + tenGigE48 + 10.0.0.96/31 + + + + tenGigE49 + 10.0.0.98/31 + + + + tenGigE50 + 10.0.0.100/31 + + + + tenGigE51 + 10.0.0.102/31 + + + + tenGigE52 + 10.0.0.104/31 + + + + tenGigE53 + 10.0.0.106/31 + + + + tenGigE54 + 10.0.0.108/31 + + + + tenGigE55 + 10.0.0.110/31 + + + + tenGigE56 + 10.0.0.112/31 + + + + tenGigE57 + 10.0.0.114/31 + + + + tenGigE58 + 10.0.0.116/31 + + + + tenGigE59 + 10.0.0.118/31 + + + + tenGigE60 + 10.0.0.120/31 + + + + tenGigE61 + 10.0.0.122/31 + + + + tenGigE62 + 10.0.0.124/31 + + + + tenGigE63 + 10.0.0.126/31 + + + + tenGigE64 + 10.0.0.128/31 + + + + tenGigE65 + 10.0.0.130/31 + + + + tenGigE66 + 10.0.0.132/31 + + + + tenGigE67 + 10.0.0.134/31 + + + + tenGigE68 + 10.0.0.136/31 + + + + tenGigE69 + 10.0.0.138/31 + + + + tenGigE70 + 10.0.0.140/31 + + + + tenGigE71 + 10.0.0.142/31 @@ -100,34 +1012,263 @@ - - 10000 + DeviceInterfaceLink - OCPSCH0104001MS + switch1 tenGigE0 - OCPSCH01040AALF - tenGigE0 + ARISTA01T2 + tenGigE1 - - 10000 + DeviceInterfaceLink - OCPSCH0104002MS - tenGigE0 - OCPSCH01040AALF - tenGigE4 + switch1 + tenGigE1 + ARISTA02T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE2 + ARISTA03T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE3 + ARISTA04T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE4 + ARISTA05T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE5 + ARISTA06T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE6 + ARISTA07T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE7 + ARISTA08T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE8 + ARISTA09T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE9 + ARISTA10T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE10 + ARISTA11T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE11 + ARISTA12T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE12 + ARISTA13T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE13 + ARISTA14T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE14 + ARISTA15T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE15 + ARISTA16T2 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE16 + ARISTA01T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE17 + ARISTA02T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE18 + ARISTA03T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE19 + ARISTA04T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE20 + ARISTA05T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE21 + ARISTA06T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE22 + ARISTA07T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE23 + ARISTA08T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE24 + ARISTA09T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE25 + ARISTA10T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE26 + ARISTA11T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE27 + ARISTA12T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE28 + ARISTA13T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE29 + ARISTA14T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE30 + ARISTA15T0 + tenGigE1 + + + DeviceInterfaceLink + switch1 + tenGigE31 + ARISTA16T0 + tenGigE1 - + - OCPSCH01040AALF + switch1 Accton-AS5712-54X - + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + - OCPSCH01040AALF + switch1 Accton-AS5712-54X
From b907e4e9f5b52b7c93b80d99959330230dffa2c6 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 30 Nov 2017 14:59:25 -0800 Subject: [PATCH 0957/1833] [vs]: add vlan configuration support in virtual switch (#1200) --- dockers/docker-database/Dockerfile.j2 | 2 +- dockers/docker-orchagent/Dockerfile.j2 | 3 +- .../scripts}/arp_update | 0 .../scripts}/configdb-load.sh | 0 platform/broadcom/docker-orchagent-brcm.mk | 1 + platform/cavium/docker-orchagent-cavm.mk | 1 + platform/centec/docker-orchagent-centec.mk | 1 + platform/marvell/docker-orchagent-mrvl.mk | 1 + platform/mellanox/docker-orchagent-mlnx.mk | 1 + platform/mellanox/sdk.mk | 10 +++--- platform/vs/docker-sonic-vs.mk | 14 +++++++- platform/vs/docker-sonic-vs/Dockerfile.j2 | 18 ++++++++++- platform/vs/docker-sonic-vs/sonic-dev.gpg.key | 30 +++++++++++++++++ platform/vs/docker-sonic-vs/start.sh | 32 ++++++++++++++++--- platform/vs/docker-sonic-vs/supervisord.conf | 30 +++++++++++++++-- rules/docker-database.mk | 1 + rules/iproute2.mk | 7 ++++ rules/scripts.mk | 11 +++++++ sonic-slave/Dockerfile | 12 ++++++- src/iproute2/Makefile | 20 ++++++++++++ src/sonic-swss | 2 +- 21 files changed, 178 insertions(+), 19 deletions(-) rename {dockers/docker-orchagent => files/scripts}/arp_update (100%) rename {dockers/docker-database => files/scripts}/configdb-load.sh (100%) create mode 100644 platform/vs/docker-sonic-vs/sonic-dev.gpg.key create mode 100644 rules/iproute2.mk create mode 100644 rules/scripts.mk create mode 100644 src/iproute2/Makefile diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 19fd412b0387..7fb3401184f2 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -33,6 +33,6 @@ RUN sed -ri 's/^(save .*$)/# \1/g; ' /etc/redis/redis.conf COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["configdb-load.sh", "/usr/bin/"] +COPY ["files/configdb-load.sh", "/usr/bin/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 9fba8d17b9d6..3d6671996358 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -26,7 +26,8 @@ debs/{{ deb }}{{' '}} RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] +COPY ["files/arp_update", "/usr/bin"] +COPY ["start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] ## Copy all Jinja2 template files into the templates folder diff --git a/dockers/docker-orchagent/arp_update b/files/scripts/arp_update similarity index 100% rename from dockers/docker-orchagent/arp_update rename to files/scripts/arp_update diff --git a/dockers/docker-database/configdb-load.sh b/files/scripts/configdb-load.sh similarity index 100% rename from dockers/docker-database/configdb-load.sh rename to files/scripts/configdb-load.sh diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index 196a4d589a24..066973967450 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_BRCM)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index 57ebb2fd1534..a171a6c801d7 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_CAVM)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk index 695e481546b1..e1d7fd6cf0d6 100644 --- a/platform/centec/docker-orchagent-centec.mk +++ b/platform/centec/docker-orchagent-centec.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_CENTEC)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/marvell/docker-orchagent-mrvl.mk b/platform/marvell/docker-orchagent-mrvl.mk index 9461cafe2e89..f2cb0c997d75 100644 --- a/platform/marvell/docker-orchagent-mrvl.mk +++ b/platform/marvell/docker-orchagent-mrvl.mk @@ -15,3 +15,4 @@ $(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /host/machine.conf:/host/machine.conf $(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_MRVL)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_MRVL)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index 20aa38335361..6dda3c446b06 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -16,3 +16,4 @@ $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_MLNX)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index d9bca2ed5af7..5aaee09fdb1d 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,10 +1,10 @@ MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/564703412781016766b248b98266bd6f2c161431/sdk MLNX_SDK_VERSION = 4.2.6011 -MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2) $(SX_ACL_RM) $(SX_COMPLIB) \ +MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) -MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_DEV) $(SX_ACL_RM_DEV) \ +MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_MLNX_DEV) $(SX_ACL_RM_DEV) \ $(SX_COMPLIB_DEV) $(SX_COMPLIB_DEV_STATIC) $(SX_EXAMPLES_DEV) \ $(SX_GEN_UTILS_DEV) $(SX_SCEW_DEV) $(SX_SCEW_DEV_STATIC) \ $(SX_SDN_HAL_DEV) $(SX_SDN_HAL_DEV_STATIC) $(SXD_LIBS_DEV) \ @@ -14,9 +14,9 @@ APPLIBS = applibs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(APPLIBS)_DEPENDS += $(SX_COMPLIB) $(SX_GEN_UTILS) $(SXD_LIBS) $(LIBNL3) $(LIBNL_GENL3) APPLIBS_DEV = applibs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DEV))) -IPROUTE2 = iproute2_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb -IPROUTE2_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(IPROUTE2),$(IPROUTE2_DEV))) +IPROUTE2_MLNX = iproute2_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +IPROUTE2_MLNX_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(IPROUTE2_MLNX),$(IPROUTE2_MLNX_DEV))) SX_COMPLIB = sx-complib_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV))) diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index e9d23db493db..656c53644637 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -2,7 +2,16 @@ DOCKER_SONIC_VS = docker-sonic-vs.gz $(DOCKER_SONIC_VS)_PATH = $(PLATFORM_PATH)/docker-sonic-vs -$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) $(SYNCD_VS) $(REDIS_SERVER) $(REDIS_TOOLS) $(PYTHON_SWSSCOMMON) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_DEVICE_DATA) +$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \ + $(SYNCD_VS) \ + $(REDIS_SERVER) \ + $(REDIS_TOOLS) \ + $(PYTHON_SWSSCOMMON) \ + $(LIBTEAMDCT) \ + $(LIBTEAM_UTILS) \ + $(SONIC_DEVICE_DATA) \ + $(SONIC_UTILS) \ + $(IPROUTE2) ifeq ($(SONIC_ROUTING_STACK), quagga) $(DOCKER_SONIC_VS)_DEPENDS += $(QUAGGA) @@ -12,5 +21,8 @@ else $(DOCKER_SONIC_VS)_DEPENDS += $(GOBGP) endif +$(DOCKER_SONIC_VS)_FILES += $(CONFIGDB_LOAD_SCRIPT) \ + $(ARP_UPDATE_SCRIPT) + $(DOCKER_SONIC_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_VS) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 43f7f678e71e..a26c3f475fa6 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -3,9 +3,13 @@ FROM docker-config-engine ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +COPY ["sonic-dev.gpg.key", "/etc/apt/"] +RUN apt-key add /etc/apt/sonic-dev.gpg.key +RUN echo "deb http://packages.microsoft.com/repos/sonic-dev/ jessie main" >> /etc/apt/sources.list RUN apt-get update RUN apt-get install -y net-tools \ + arping \ ethtool \ tcpdump \ ifupdown \ @@ -26,7 +30,15 @@ RUN apt-get install -y net-tools \ openssh-server \ libc-ares2 \ iproute \ - libpython2.7 + libpython2.7 \ + grub2-common \ + python-click-default-group \ + python-click \ + python-natsort \ + python-tabulate \ + bash-completion \ + libelf1 \ + libmnl0 RUN pip install setuptools RUN pip install py2_ipaddress @@ -51,6 +63,7 @@ RUN sed -ri 's/^(save .*$)/# \1/g; s/^logfile .*$/logfile ""/; \ s/^# syslog-enabled no$/syslog-enabled no/; \ s/^# unixsocket/unixsocket/; \ + s/notify-keyspace-events ""/notify-keyspace-events AKE/; \ s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ ' /etc/redis/redis.conf @@ -58,7 +71,10 @@ COPY ["50-default.conf", "/etc/rsyslog.d/"] COPY ["start.sh", "orchagent.sh", "/usr/bin/"] COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["files/configdb-load.sh", "/usr/bin/"] +COPY ["files/arp_update", "/usr/bin"] RUN echo "docker-sonic-vs" > /etc/hostname +RUN touch /etc/quagga/zebra.conf ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/vs/docker-sonic-vs/sonic-dev.gpg.key b/platform/vs/docker-sonic-vs/sonic-dev.gpg.key new file mode 100644 index 000000000000..fb9a37901bc7 --- /dev/null +++ b/platform/vs/docker-sonic-vs/sonic-dev.gpg.key @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQENBFQ1bTIBCAC7oGfkv/ck0XsLuG8cdcSB2ISqxFAcBvH9BitEtxmpW2uhykKk +xY4rVD/4Uys1s3PF1/64QfPR+hYcewueOwz0ZAcLyFXXk4McICXaPq3NrLiWYKKX +UZLnrPzcrGZoW/kHDDp4OmBiDmT1PGvZlpuimwkMCusUzIr7Cbbp2dIy8MERL5tA +LcgLu3KL6clJ+aTW2jgepI1D7sTepOeGd7eRSb5njKg2M7k/93v/7MipZxiVtyXH +B74YiK6jSbst5JpuYsLa/Dqryvx7Xq3n53oif892pv3euTduo1fYw8Hgh/OOYdeT +c9WCj03KA1jCSFURjdrug0kR8BPlfjqtRLXFABEBAAG0JE1TIE9wZW4gVGVjaCA8 +aW50ZXJvcEBtaWNyb3NvZnQuY29tPokBOAQTAQIAIgUCVDVtMgIbAwYLCQgHAwIG +FQgCCQoLBBYCAwECHgECF4AACgkQsCxG30F6CJO1uAf/cmL68bM8YgF/61hkaY56 +LqrppUTJH/w4fKq47Pf6KfgSLvxfNU6soi2KHYRjIvTRx3tV4vUM5n2plaQg2s8V +/Epg4FeIRTk75YwiHAzLhLnp5cdUaTvC4j4mwxoB6j9Ty+fXJwQ0MvpDhIZb9vM4 +GXw/fEQHCT4f3gx4nReeqE+FB2wVHleX9+Lpodu98JyJTKJRBRHYLqy6S+/lyp2W +aBlsI1LOqBcx1uRK24U7duIpbYwIyrx0cafSruqR2GjVdu+imkhHyUn52VbzYhq1 +af0rqYiZ1VOamVOG0By8+hVyNa1MLc1K2uWGs0o5fDe9F5/swbvLHVXI+M50Vs+m +J7kBDQRUNW0yAQgAu7DkTVj0ZQC4F7bFivAwrdby8gCakTXOl1kcK622hjRJ8nam +aZeW+eADfLRsTmdUmXgZu1YWS5Gn2ZVngC8SGPUBT071+oRETCz4uNB7IimB9QfP +++orI6o2vmnVVsq5wWCbEdNU+TCVv1zjrYev5lwckkKpjHt6o8MNoX2DFuQymSyR +eZKaqhdKmcji4Ke7OIYqwgPjch3wxzE1b5gNOR/iwxWyjjOffZPLr/VhIfIJRs86 +dSXrwjHtEh810SKDLghHM0VAdY34nyC5ZZ61yhts5HtQDFK+9mNpH1mkc4gDBlgG +266pVvknumK6lPNm/osF/cpjWmEw24ypcQIvOQARAQABiQEfBBgBAgAJBQJUNW0y +AhsMAAoJELAsRt9BegiTMBUH/0sZ6gZy7mCTSAYT+NSXLFtGC2zNUVL80SWvfgYm +k9XPVI22MrefZfQ6M01RylyxtWXjRM8UoN8SDKWPpXumzJf831f/7om5zwutaG7b +tjDPYqRKJSbAIFZu2mN+uLrNQ2SV6XK7FoV0dtcrEX9S7RICb6i19D+70+Oh/qgU +R04H1jqS29XBzqAlIzdBoA+sYAwbOIJsSL3YyNQcUv3B5+5yR/bo/L8pnUJt6iuL +nWW+mi7r8gWPHDSrcdYq1TmmlOM7CwZPgWRZzkQPSeZz52Tt7IP47eyGJ09U4PIf +FtMH1ElL2UgHoA/F9Q88e7LkztaTqE59uXWbIYyuSMJVvRU= +=sb3d +-----END PGP PUBLIC KEY BLOCK----- diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 0782705bc912..876bfd835728 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -1,4 +1,18 @@ -#!/usr/bin/env bash +#!/bin/bash -e + +# generate configuration + +[ -d /etc/sonic ] || mkdir -p /etc/sonic + +SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') +sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json + +if [ -f /etc/sonic/config_db.json ]; then + sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json +else + sonic-cfggen -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json +fi mkdir -p /etc/swss/config.d/ @@ -16,6 +30,8 @@ mkdir -p /var/run/redis supervisorctl start redis-server +/usr/bin/configdb-load.sh + supervisorctl start syncd supervisorctl start orchagent @@ -30,8 +46,14 @@ supervisorctl start teamsyncd supervisorctl start fpmsyncd +supervisorctl start intfmgrd + +supervisorctl start vlanmgrd + +supervisorctl start zebra + # Start arp_update when VLAN exists -# VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` -# if [ "$VLAN" != "" ]; then -# supervisorctl start arp_update -# fi +VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` +if [ "$VLAN" != "" ]; then + supervisorctl start arp_update +fi diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index c91d808b9856..2526aefe3a87 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -75,9 +75,25 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog +[program:vlanmgrd] +command=/usr/bin/vlanmgrd +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:intfmgrd] +command=/usr/bin/intfmgrd +priority=11 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + [program:zebra] command=/usr/lib/quagga/zebra -A 127.0.0.1 -priority=10 +priority=12 autostart=false autorestart=false stdout_logfile=syslog @@ -85,7 +101,7 @@ stderr_logfile=syslog [program:bgpd] command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F -priority=11 +priority=13 autostart=false autorestart=false stdout_logfile=syslog @@ -93,8 +109,16 @@ stderr_logfile=syslog [program:fpmsyncd] command=/usr/bin/fpmsyncd -priority=12 +priority=14 autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:arp_update] +command=bash -c "/usr/bin/arp_update; sleep 300" +priority=15 +autostart=false +autorestart=true +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/rules/docker-database.mk b/rules/docker-database.mk index 147b6538a098..ef77047e8431 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -12,3 +12,4 @@ $(DOCKER_DATABASE)_RUN_OPT += --net=host --privileged -t $(DOCKER_DATABASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_DATABASE)_BASE_IMAGE_FILES += redis-cli:/usr/bin/redis-cli +$(DOCKER_DATABASE)_FILES += $(CONFIGDB_LOAD_SCRIPT) diff --git a/rules/iproute2.mk b/rules/iproute2.mk new file mode 100644 index 000000000000..10d8fe4cff3d --- /dev/null +++ b/rules/iproute2.mk @@ -0,0 +1,7 @@ +# iproute2 package + +IPROUTE2_VERSION = 4.9.0-1 + +IPROUTE2 = iproute2_$(IPROUTE2_VERSION)_amd64.deb +$(IPROUTE2)_SRC_PATH = $(SRC_PATH)/iproute2 +SONIC_MAKE_DEBS += $(IPROUTE2) diff --git a/rules/scripts.mk b/rules/scripts.mk new file mode 100644 index 000000000000..fbefdd68d2cd --- /dev/null +++ b/rules/scripts.mk @@ -0,0 +1,11 @@ + +ARP_UPDATE_SCRIPT = arp_update +$(ARP_UPDATE_SCRIPT)_PATH = files/scripts + +CONFIGDB_LOAD_SCRIPT = configdb-load.sh +$(CONFIGDB_LOAD_SCRIPT)_PATH = files/scripts + +SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \ + $(ARP_UPDATE_SCRIPT) + + diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 603c3b6cb357..4e1bc644556b 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -202,7 +202,17 @@ RUN apt-get update && apt-get install -y \ libgtest-dev \ cmake \ # For python-based swsscommon - swig3.0 + swig3.0 \ +# For iproute2 + cm-super-minimal \ + libatm1-dev \ + libelf-dev \ + libmnl-dev \ + libselinux1-dev \ + linuxdoc-tools \ + lynx \ + texlive-latex-extra \ + texlive-latex-recommended # For linux build RUN apt-get -y build-dep linux diff --git a/src/iproute2/Makefile b/src/iproute2/Makefile new file mode 100644 index 000000000000..0181c9ca6d31 --- /dev/null +++ b/src/iproute2/Makefile @@ -0,0 +1,20 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e + +IPROUTE2_VERSION = 4.9.0 +IPROUTE2_VERSION_FULL = $(IPROUTE2_VERSION)-1 + +MAIN_TARGET = iproute2_$(IPROUTE2_VERSION_FULL)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + wget -O iproute2_$(IPROUTE2_VERSION).orig.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0.orig.tar.xz?sv=2015-04-05&sr=b&sig=9nvybd1xkXyRQbaG6Fy6wBazPA8IbZV0AO41GWXPEP8%3D&se=2154-10-23T11%3A59%3A00Z&sp=r" + wget -O iproute2_$(IPROUTE2_VERSION_FULL).dsc -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0-1.dsc?sv=2015-04-05&sr=b&sig=m6FcMH9dOh8ggipBgOsONiXvDxoi6bfUO%2BxvidsMNMQ%3D&se=2154-10-23T11%3A59%3A53Z&sp=r" + wget -O iproute2_$(IPROUTE2_VERSION_FULL).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0-1.debian.tar.xz?sv=2015-04-05&sr=b&sig=U5NFuwG5C3vZXlUUNvoPMnKDtMKk66zbweA9rQYbEVY%3D&se=2154-10-23T12%3A00%3A15Z&sp=r" + dpkg-source -x iproute2_$(IPROUTE2_VERSION_FULL).dsc + + pushd iproute2-$(IPROUTE2_VERSION) + dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + mv $* $(DEST)/ diff --git a/src/sonic-swss b/src/sonic-swss index 3a9cf8f47847..57a98acb893c 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 3a9cf8f478474dd0bf23af283ba7779575faae6d +Subproject commit 57a98acb893c73063792bf6d7adf8bca71f8b9d6 From 414e43bb748b899a5acc7e212e7e1252b50f33b4 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 1 Dec 2017 19:24:55 -0800 Subject: [PATCH 0958/1833] [build]: start docker service if not already started (#1203) docker start fails when docker service is already started --- slave.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index 71cee41e3d0a..e3ffc7e91ce7 100644 --- a/slave.mk +++ b/slave.mk @@ -336,7 +336,7 @@ $(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuff # start docker daemon docker-start : - @sudo service docker start &> /dev/null && sleep 1 + @sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && sleep 1 ) # targets for building simple docker images that do not depend on any debian packages $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) From db7fcd8a7a079be96bec7ee267db068b60f95245 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 4 Dec 2017 02:43:39 -0800 Subject: [PATCH 0959/1833] [submodule]: update swss, swss-common, sairedis submodules (#1206) --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 0187c64a57b2..345f179482db 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 0187c64a57b288f9e4898bc9db00f7427eb61ca6 +Subproject commit 345f179482dbf5258cad088414bc9eb230decd97 diff --git a/src/sonic-swss b/src/sonic-swss index 57a98acb893c..226f96c94e76 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 57a98acb893c73063792bf6d7adf8bca71f8b9d6 +Subproject commit 226f96c94e76713f48ebdb114759584f0e1357e6 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 3d07426bc155..82ceea09b623 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 3d07426bc155435290a0c81365436be5fbb31b17 +Subproject commit 82ceea09b62374cd3110c00b19536ed4d10f3d57 From 7e457564da3635d73a7743fbac4654c5aba4dd25 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Mon, 4 Dec 2017 12:45:24 +0200 Subject: [PATCH 0960/1833] [mellanox]: Update Mellanox buffer profiles config (#1198) Signed-off-by: Andriy Moroz --- dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 | 8 ++++---- .../tests/sample_output/msn27.32ports.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 index ce1ddedbba37..0a60f4584a19 100644 --- a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 +++ b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 @@ -32,7 +32,7 @@ "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"1" }, "OP": "SET" }, @@ -47,7 +47,7 @@ { "BUFFER_PROFILE_TABLE:egress_lossless_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", - "size":"1518", + "size":"0", "dynamic_th":"7" }, "OP": "SET" @@ -64,7 +64,7 @@ "BUFFER_PROFILE_TABLE:pg_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", - "dynamic_th":"3" + "dynamic_th":"7" }, "OP": "SET" }, @@ -80,7 +80,7 @@ "BUFFER_PROFILE_TABLE:q_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"0", - "dynamic_th":"1" + "dynamic_th":"7" }, "OP": "SET" }, diff --git a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json index c65ebb847d7b..a3cff0f0f0d5 100644 --- a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json +++ b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json @@ -27,7 +27,7 @@ "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"1" }, "OP": "SET" }, @@ -42,7 +42,7 @@ { "BUFFER_PROFILE_TABLE:egress_lossless_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", - "size":"1518", + "size":"0", "dynamic_th":"7" }, "OP": "SET" @@ -59,7 +59,7 @@ "BUFFER_PROFILE_TABLE:pg_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", - "dynamic_th":"3" + "dynamic_th":"7" }, "OP": "SET" }, @@ -75,7 +75,7 @@ "BUFFER_PROFILE_TABLE:q_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"0", - "dynamic_th":"1" + "dynamic_th":"7" }, "OP": "SET" }, From 2e31a38617b9d2ff9810cbaf33ef79f51404eb83 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 4 Dec 2017 14:28:43 -0800 Subject: [PATCH 0961/1833] [LLDP] Send interface name instead of mac as PORT_ID for mgmt interface (#1204) * Send interface name instead of mac thru lldp for mgmt interface * Fix j2 template test failure --- dockers/docker-lldp-sv2/lldpd.conf.j2 | 1 + src/sonic-config-engine/tests/sample_output/lldpd.conf | 1 + 2 files changed, 2 insertions(+) diff --git a/dockers/docker-lldp-sv2/lldpd.conf.j2 b/dockers/docker-lldp-sv2/lldpd.conf.j2 index eb7202df7c67..165ded79f392 100644 --- a/dockers/docker-lldp-sv2/lldpd.conf.j2 +++ b/dockers/docker-lldp-sv2/lldpd.conf.j2 @@ -1,3 +1,4 @@ +configure ports eth0 lldp portidsubtype local {{ MGMT_INTERFACE.keys()[0][0] }} {% for local_port in DEVICE_NEIGHBOR %} configure ports {{ local_port }} lldp portidsubtype local {{ PORT[local_port]['alias'] }} description {{ DEVICE_NEIGHBOR[local_port]['name'] }}:{{ DEVICE_NEIGHBOR[local_port]['port'] }} {% endfor %} diff --git a/src/sonic-config-engine/tests/sample_output/lldpd.conf b/src/sonic-config-engine/tests/sample_output/lldpd.conf index 0328385cf307..d906f909bc7d 100644 --- a/src/sonic-config-engine/tests/sample_output/lldpd.conf +++ b/src/sonic-config-engine/tests/sample_output/lldpd.conf @@ -1,3 +1,4 @@ +configure ports eth0 lldp portidsubtype local eth0 configure ports Ethernet116 lldp portidsubtype local fortyGigE0/116 description ARISTA02T1:Ethernet1/1 configure ports Ethernet124 lldp portidsubtype local fortyGigE0/124 description ARISTA04T1:Ethernet1/1 configure ports Ethernet112 lldp portidsubtype local fortyGigE0/112 description ARISTA01T1:Ethernet1/1 From 744927acd3b5a88b73b53d371147c4e11ebecb86 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Wed, 6 Dec 2017 15:13:18 -0800 Subject: [PATCH 0962/1833] Derive varlog size based on total flash size (#1209) --- files/Aboot/boot0.j2 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 4f2367807d90..a2c683b20c91 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -132,10 +132,15 @@ platform_specific() { flash_size=28000 fi if [ "$platform" = "rook" ]; then - varlog_size=4096 readprefdl -f /tmp/.system-prefdl -d > /mnt/flash/.system-prefdl fi + if [ $flash_size -ge 28000 ]; then + varlog_size=4096 + elif [ $flash_size -ge 3700 ]; then + varlog_size=400 + fi + echo "varlog_size=$varlog_size" >>/tmp/append } From eb086818d779a5455cfcfca3c9e45259c997bb20 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 6 Dec 2017 15:59:33 -0800 Subject: [PATCH 0963/1833] Install more debs for python3 in sonic-slave (#1211) Signed-off-by: Qi Luo --- sonic-slave/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 4e1bc644556b..d74c9adfebe5 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -164,10 +164,11 @@ RUN apt-get update && apt-get install -y \ cppcheck \ clang \ pylint \ - python-pytest \ gcovr \ python-pytest=2.6.3* \ + python3-pytest=2.6.3* \ python-pytest-cov \ + python3-pytest-cov \ python-parse \ # For snmpd libmysqlclient-dev \ @@ -196,6 +197,8 @@ RUN apt-get update && apt-get install -y \ python-netaddr \ python-ipaddr \ python-yaml \ +# For sonic utilities + python3-netaddr \ # For lockfile procmail \ # For gtest From 3d70b715d55dde24c7e5591f39b5cc7190be2caf Mon Sep 17 00:00:00 2001 From: Wataru Ishida Date: Thu, 7 Dec 2017 14:45:03 +0900 Subject: [PATCH 0964/1833] [sonic-cfggen] add option for redis connection (#1213) Signed-off-by: Wataru Ishida --- src/sonic-config-engine/sonic-cfggen | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 9f1323dab2eb..bb778ddefbf0 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -135,6 +135,7 @@ def main(): parser.add_argument("-j", "--json", help="json file that contains additional variables", action='append', default=[]) parser.add_argument("-a", "--additional-data", help="addition data, in json string") parser.add_argument("-d", "--from-db", help="read config from configdb", action='store_true') + parser.add_argument("-s", "--redis-unix-sock-file", help="unix sock file for redis connection") group = parser.add_mutually_exclusive_group() group.add_argument("-t", "--template", help="render the data with the template file") group.add_argument("-v", "--var", help="print the value of a variable, support jinja2 expression") @@ -151,6 +152,10 @@ def main(): if platform_info != None: data['platform'] = platform_info + db_kwargs = {} + if args.redis_unix_sock_file != None: + db_kwargs['unix_socket_path'] = args.redis_unix_sock_file + if args.minigraph != None: minigraph = args.minigraph if data.has_key('platform'): @@ -180,7 +185,7 @@ def main(): deep_update(data, json.loads(args.additional_data)) if args.from_db: - configdb = ConfigDBConnector() + configdb = ConfigDBConnector(**db_kwargs) configdb.connect() deep_update(data, FormatConverter.db_to_output(configdb.get_config())) @@ -203,7 +208,7 @@ def main(): print json.dumps(FormatConverter.to_serialized(data[args.var_json]), indent=4, cls=minigraph_encoder) if args.write_to_db: - configdb = ConfigDBConnector() + configdb = ConfigDBConnector(**db_kwargs) configdb.connect(False) configdb.set_config(FormatConverter.output_to_db(data)) From 4213b2dcc749ea5adc488b457d1d44907d223c4b Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Wed, 6 Dec 2017 21:45:45 -0800 Subject: [PATCH 0965/1833] [sonic-utilities]: Final code-drop for interface-description and interface-status enhancements (#1207) * Final code-drop for interface-description and interface-status enhancements. Here i'm adding minor extensions to support "show interface description" command. Please refer to PR#158 for more details: https://github.com/Azure/sonic-utilities/pull/158 * Add interface-description UT and adjust logic to have 'description' field being optional RB= G=lnos-reviewers R=ntrianta,rjonnadu,rmolina,sfardeen,zxu A= * Updating reference to sonic-utilities to collect latest changes --- dockers/docker-orchagent/ports.json.j2 | 1 + src/sonic-config-engine/minigraph.py | 16 ++++++++++++---- .../tests/simple-sample-graph.xml | 1 + src/sonic-config-engine/tests/test_cfggen.py | 2 +- src/sonic-utilities | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) mode change 100644 => 100755 src/sonic-config-engine/minigraph.py diff --git a/dockers/docker-orchagent/ports.json.j2 b/dockers/docker-orchagent/ports.json.j2 index 48be831025f8..770440036058 100644 --- a/dockers/docker-orchagent/ports.json.j2 +++ b/dockers/docker-orchagent/ports.json.j2 @@ -5,6 +5,7 @@ { "PORT_TABLE:{{ port }}": { "speed": "{{ PORT[port]['speed'] }}" + "description": "{{ PORT[port]['description'] }}" }, "OP": "SET" }{% if not loop.last %},{% endif %} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py old mode 100644 new mode 100755 index 826997063349..f33bd11f0b93 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -298,7 +298,8 @@ def parse_meta(meta, hname): return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id def parse_deviceinfo(meta, hwsku): - ethernet_interfaces = {} + port_speeds = {} + port_descriptions = {} for device_info in meta.findall(str(QName(ns, "DeviceInfo"))): dev_sku = device_info.find(str(QName(ns, "HwSku"))).text if dev_sku == hwsku: @@ -306,8 +307,11 @@ def parse_deviceinfo(meta, hwsku): for interface in interfaces.findall(str(QName(ns1, "EthernetInterface"))): alias = interface.find(str(QName(ns, "InterfaceName"))).text speed = interface.find(str(QName(ns, "Speed"))).text - ethernet_interfaces[port_alias_map.get(alias, alias)] = speed - return ethernet_interfaces + desc = interface.find(str(QName(ns, "Description"))) + if desc != None: + port_descriptions[port_alias_map.get(alias, alias)] = desc.text + port_speeds[port_alias_map.get(alias, alias)] = speed + return port_speeds, port_descriptions def parse_xml(filename, platform=None, port_config_file=None): root = ET.parse(filename).getroot() @@ -330,6 +334,7 @@ def parse_xml(filename, platform=None, port_config_file=None): devices = None hostname = None port_speeds = {} + port_descriptions = {} syslog_servers = [] dhcp_servers = [] ntp_servers = [] @@ -360,7 +365,7 @@ def parse_xml(filename, platform=None, port_config_file=None): elif child.tag == str(QName(ns, "MetadataDeclaration")): (syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) elif child.tag == str(QName(ns, "DeviceInfos")): - port_speeds = parse_deviceinfo(child, hwsku) + (port_speeds, port_descriptions) = parse_deviceinfo(child, hwsku) results = {} results['DEVICE_METADATA'] = {'localhost': { @@ -395,6 +400,9 @@ def parse_xml(filename, platform=None, port_config_file=None): for port_name in port_speeds: ports.setdefault(port_name, {})['speed'] = port_speeds[port_name] + for port_name in port_descriptions: + ports.setdefault(port_name, {})['description'] = port_descriptions[port_name] + results['PORT'] = ports results['PORTCHANNEL'] = pcs results['VLAN'] = vlans diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 89f53af83e41..cce833cc950d 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -243,6 +243,7 @@ 0 0 40000 + Interface description DeviceInterface diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 47cc006f4662..2eee6fe331c8 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -138,4 +138,4 @@ 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(), "{'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'speed': '40000'}") + self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '40000'}") diff --git a/src/sonic-utilities b/src/sonic-utilities index e87bb97760a4..0c0a2f02c32a 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit e87bb97760a4cf069da51b2a0da732f7a40f3215 +Subproject commit 0c0a2f02c32a8cafb3020d8248ea829bbc959d4a From 8383b1f256219358fe3af2ceda68afeb3c0d9047 Mon Sep 17 00:00:00 2001 From: Liuqu Date: Thu, 7 Dec 2017 19:36:17 +0800 Subject: [PATCH 0966/1833] [TACACS+]: Add support for TACACS+ Authentication (#1019) * [TACACS+]: Add support for TACACS+ Authentication * pam_tacplus - A TACACS+ protocol client library and PAM module to supports core TACACS+ functions for AAA. * nss_tacplus - A NSS plugin for TACACS+ to extend function getpwnam, make the TACACS+ authenticated user which is not found in local could login successfully. * Add make rules for pam_tacplus and install script * Add a patch for pam_tacplus to disable pam-auth-update pam-tacplus by default * Add a patch for pam_tacplus to inlucde and build nss_tacplus Signed-off-by: chenchen.qcc@alibaba-inc.com * [TACACS+]: Add nss-tacplus as a separate src repo * Separate nss-tacplus from pam-tacplus, modify tacacs.mk and makefile, add a patch to adapt to the new user map profile. * Use the lastest stable version for pam-tacplus, add a dependent package in sonic-salve, add two patches to fix build error. * Add scripts to disable tacplus by default. * Remove hostcfgd service file Signed-off-by: Chenchen Qi * [TACACS+]: Fix nss-tacplus filter some valid TACACS+ username * The NAME_REGEX for username check in plugin nss-tacplus is the ANSI version "^[0-9a-zA-Z_-\ ]*$", but the regular expression in /etc/adduser.conf is not defined as ANSI version. To avoid nss-tacplus filter some valid TACACS+ username, remove username check. Signed-off-by: Chenchen Qi --- .../build_templates/sonic_debian_extension.j2 | 8 + rules/tacacs.mk | 29 + slave.mk | 4 +- sonic-slave/Dockerfile | 2 + .../nss/0001-Modify-user-map-profile.patch | 1459 +++++++++++++++++ src/tacacs/nss/Makefile | 22 + ...on-t-init-declarations-in-a-for-loop.patch | 45 + ...-libtac2-bin-install-directory-error.patch | 19 + src/tacacs/pam/Makefile | 25 + 9 files changed, 1612 insertions(+), 1 deletion(-) create mode 100644 rules/tacacs.mk create mode 100644 src/tacacs/nss/0001-Modify-user-map-profile.patch create mode 100644 src/tacacs/nss/Makefile create mode 100644 src/tacacs/pam/0001-Don-t-init-declarations-in-a-for-loop.patch create mode 100644 src/tacacs/pam/0002-Fix-libtac2-bin-install-directory-error.patch create mode 100644 src/tacacs/pam/Makefile diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 0159be571f88..fd67444fb475 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -89,6 +89,14 @@ sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-device-data_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Install pam-tacplus and nss-tacplus +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libtac2_*.deb +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libpam-tacplus_*.deb +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libnss-tacplus_*.deb +# Disable tacplus by default +sudo LANG=C chroot $FILESYSTEM_ROOT pam-auth-update --remove tacplus +sudo sed -i -e '/^passwd/s/ tacplus//' $FILESYSTEM_ROOT/etc/nsswitch.conf + # Copy crontabs sudo cp -f $IMAGE_CONFIGS/cron.d/* $FILESYSTEM_ROOT/etc/cron.d/ diff --git a/rules/tacacs.mk b/rules/tacacs.mk new file mode 100644 index 000000000000..e31f52d9ab5d --- /dev/null +++ b/rules/tacacs.mk @@ -0,0 +1,29 @@ +# libpam-tacplus packages + +PAM_TACPLUS_VERSION = 1.4.1-1 + +export PAM_TACPLUS_VERSION + +LIBPAM_TACPLUS = libpam-tacplus_$(PAM_TACPLUS_VERSION)_amd64.deb +$(LIBPAM_TACPLUS)_RDEPENDS += $(LIBTAC2) +$(LIBPAM_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/pam +SONIC_MAKE_DEBS += $(LIBPAM_TACPLUS) + +LIBTAC_DEV = libtac-dev_$(PAM_TACPLUS_VERSION)_amd64.deb +$(LIBTAC_DEV)_DEPENDS += $(LIBTAC2) +$(eval $(call add_derived_package,$(LIBTAC2),$(LIBTAC_DEV))) + +LIBTAC2 = libtac2_$(PAM_TACPLUS_VERSION)_amd64.deb +$(eval $(call add_extra_package,$(LIBPAM_TACPLUS),$(LIBTAC2))) + + +# libnss-tacplus packages +NSS_TACPLUS_VERSION = 1.0.4-1 + +export NSS_TACPLUS_VERSION + +LIBNSS_TACPLUS = libnss-tacplus_$(NSS_TACPLUS_VERSION)_amd64.deb +$(LIBNSS_TACPLUS)_DEPENDS += $(LIBTAC_DEV) +$(LIBNSS_TACPLUS)_RDEPENDS += $(LIBTAC2) +$(LIBNSS_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/nss +SONIC_MAKE_DEBS += $(LIBNSS_TACPLUS) diff --git a/slave.mk b/slave.mk index e3ffc7e91ce7..1f00accb9e30 100644 --- a/slave.mk +++ b/slave.mk @@ -391,7 +391,9 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(LINUX_KERNEL) \ $(IGB_DRIVER) \ $(SONIC_DEVICE_DATA) \ - $(SONIC_UTILS)) \ + $(SONIC_UTILS) \ + $(LIBPAM_TACPLUS) \ + $(LIBNSS_TACPLUS)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) $(HEADER) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index d74c9adfebe5..6e48a4ff7339 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -204,6 +204,8 @@ RUN apt-get update && apt-get install -y \ # For gtest libgtest-dev \ cmake \ +# For pam_tacplus build + autoconf-archive \ # For python-based swsscommon swig3.0 \ # For iproute2 diff --git a/src/tacacs/nss/0001-Modify-user-map-profile.patch b/src/tacacs/nss/0001-Modify-user-map-profile.patch new file mode 100644 index 000000000000..75d037977de4 --- /dev/null +++ b/src/tacacs/nss/0001-Modify-user-map-profile.patch @@ -0,0 +1,1459 @@ +From 43096cf9813d6def1d1f8f1d8a0c122466c8c06b Mon Sep 17 00:00:00 2001 +From: Liuqu +Date: Mon, 9 Oct 2017 02:44:37 -0700 +Subject: [PATCH] Modify user map profile + +* Removed dependence from libtacplus_map and libaudit +* Removed NSS entry point for getpwuid() +* Modified user map profile, create local user account for each TACACS+ user + which not found in local. +* Added "many_to_one" mode, create one local user for many TACACS+ users which + has the same privilege. +* Modified configuration parse and file to adapt to the new user map profile. +--- + Makefile.am | 4 +- + Makefile.in | 2 +- + configure.ac | 2 +- + debian/changelog | 11 + + debian/control | 11 +- + debian/libnss-tacplus.symbols | 1 - + nss_tacplus.c | 1004 +++++++++++++++++++---------------------- + tacplus_nss.conf | 91 ++-- + 8 files changed, 518 insertions(+), 608 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 293951e..b33c455 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -19,7 +19,7 @@ nss_tacplus.h + libnss_tacplus_la_CFLAGS = $(AM_CFLAGS) + # Version 2.0 because that's the NSS module version, and they must match + libnss_tacplus_la_LDFLAGS = -module -version-info 2:0:0 -shared +-libnss_tacplus_la_LIBADD = -ltacplus_map -ltac -laudit ++libnss_tacplus_la_LIBADD = -ltac + + + EXTRA_DIST = tacplus_nss.conf README ChangeLog +@@ -52,7 +52,7 @@ install-data-hook: + rm -f $(DESTDIR)$(libdir)/libnss_tacplus.so $(DESTDIR)$(libdir)/libnss_tacplus.so.2.0.0 + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(sysconfdir) + cd .libs && $(INSTALL_PROGRAM) libnss_tacplus.so $(DESTDIR)$(libdir)/$(NSS_TACPLUS_LIBC_VERSIONED) +- $(STRIP) --keep-symbol=_nss_tacplus_getpwnam_r --keep-symbol=_nss_tacplus_getpwuid_r $(DESTDIR)$(libdir)/$(NSS_TACPLUS_LIBC_VERSIONED) ++ $(STRIP) --keep-symbol=_nss_tacplus_getpwnam_r $(DESTDIR)$(libdir)/$(NSS_TACPLUS_LIBC_VERSIONED) + cd $(DESTDIR)$(libdir); ln -sf $(NSS_TACPLUS_LIBC_VERSIONED) $(NSS_TACPLUS_NSS_VERSIONED) + ${INSTALL} -m 644 tacplus_nss.conf $(DESTDIR)$(sysconfdir) + +diff --git a/Makefile.in b/Makefile.in +index 0d18ce7..5159b37 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -273,7 +273,7 @@ nss_tacplus.h + libnss_tacplus_la_CFLAGS = $(AM_CFLAGS) + # Version 2.0 because that's the NSS module version, and they must match + libnss_tacplus_la_LDFLAGS = -module -version-info 2:0:0 -shared +-libnss_tacplus_la_LIBADD = -ltacplus_map -ltac -laudit ++libnss_tacplus_la_LIBADD = -ltac + EXTRA_DIST = tacplus_nss.conf README ChangeLog + MAINTAINERCLEANFILES = Makefile.in config.h.in configure aclocal.m4 \ + config/config.guess config/config.sub config/depcomp \ +diff --git a/configure.ac b/configure.ac +index 42fb8f9..8c04668 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -53,7 +53,7 @@ dnl -------------------------------------------------------------------- + dnl Checks for header files. + AC_HEADER_STDC + AC_CHECK_HEADERS([nss.h fcntl.h stdlib.h string.h strings.h sys/socket.h sys/time.h syslog.h unistd.h]) +-AC_CHECK_HEADERS([tacplus/libtac.h]) ++AC_CHECK_HEADERS([libtac/libtac.h]) + + dnl -------------------------------------------------------------------- + dnl Checks for typedefs, structures, and compiler characteristics. +diff --git a/debian/changelog b/debian/changelog +index b24ac24..d4103ed 100644 +--- a/debian/changelog ++++ b/debian/changelog +@@ -1,3 +1,14 @@ ++libnss-tacplus (1.0.4-1) unstable; urgency=low ++ * Removed dependence from libtacplus_map and libaudit ++ * Removed NSS entry point for getpwuid() ++ * Modified user map profile, create local user account for each TACACS+ user ++ which not found in local. ++ * Added "many_to_one" mode, create one local user for many TACACS+ users which ++ has the same privilege. ++ * Modified configuration parse and file to adapt to the new user map profile. ++ ++ -- Chenchen Qi Tue, 10 Oct 2017 14:23:44 +0800 ++ + libnss-tacplus (1.0.3-2) unstable; urgency=low + * Fixed package remove to clean up plugin entries in nsswitch.conf + * New Disabled: added user_homedir config variable to allow per-user +diff --git a/debian/control b/debian/control +index ea65d0b..bdc888f 100644 +--- a/debian/control ++++ b/debian/control +@@ -1,17 +1,14 @@ + Source: libnss-tacplus + Priority: optional + Maintainer: Dave Olson +-Build-Depends: debhelper (>= 9), autotools-dev, libtac-dev (>= 1.4.1~), +- libtacplus-map-dev, libaudit-dev, autoconf, libpam-tacplus-dev, +- dpkg-dev (>= 1.16.1), git ++Build-Depends: debhelper (>= 9), autotools-dev, libtac-dev (>= 1.4.1~) + Section: libs + Standards-Version: 3.9.6 + Homepage: http://www.cumulusnetworks.com + + Package: libnss-tacplus + Architecture: any +-Depends: ${shlibs:Depends}, ${misc:Depends}, libtac2 (>= 1.4.1~), +- libtacplus-map1, libaudit1 ++Depends: ${shlibs:Depends}, ${misc:Depends}, libtac2 (>= 1.4.1~) + Description: NSS module for TACACS+ authentication without local passwd entry +- Performs getpwname and getpwuid lookups via NSS for users logged in via +- tacacs authentication, and mapping done with libtacplus_map ++ Performs getpwname lookups via NSS for users logged in via ++ tacacs authentication +diff --git a/debian/libnss-tacplus.symbols b/debian/libnss-tacplus.symbols +index 2bf9b88..f476e7d 100644 +--- a/debian/libnss-tacplus.symbols ++++ b/debian/libnss-tacplus.symbols +@@ -1,3 +1,2 @@ + libnss_tacplus.so.2 libnss-tacplus #MINVER# + _nss_tacplus_getpwnam_r@Base 1.0.1 +- _nss_tacplus_getpwuid_r@Base 1.0.1 +diff --git a/nss_tacplus.c b/nss_tacplus.c +index 79e62b9..ecfa0b0 100644 +--- a/nss_tacplus.c ++++ b/nss_tacplus.c +@@ -1,7 +1,9 @@ + /* +- * Copyright (C) 2014, 2015, 2016, 2017 Cumulus Networks, Inc. ++ * Copyright (C) 2014, 2015, 2016 Cumulus Networks, Inc. ++ * Copyright (C) 2017 Chenchen Qi + * All rights reserved. + * Author: Dave Olson ++ * Chenchen Qi + * + * 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 +@@ -18,15 +20,9 @@ + */ + + /* +- * This plugin implements getpwnam_r for NSS over TACACS+ +- * and implements getpwuid_r for UIDs if and only if a mapped +- * TACACS+ user is currently logged in (libtacplus_map) +- * This means that if you do, e.g.: ls -ld ~tacacs15, you will +- * sometimes get a mapped username, and other times get tacacs15, +- * depending on whether a mapped user is logged in or not. ++ * This plugin implements getpwnam_r for NSS over TACACS+. + */ + +- + #include + #include + #include +@@ -35,18 +31,18 @@ + #include + #include + #include ++#include + #include +-#include +-#include +-#include + +-#include +-#include ++#include + +-#include "nss_tacplus.h" ++#define MIN_TACACS_USER_PRIV (1) ++#define MAX_TACACS_USER_PRIV (15) + + static const char *nssname = "nss_tacplus"; /* for syslogs */ + static const char *config_file = "/etc/tacplus_nss.conf"; ++static const char *user_conf = "/etc/tacplus_user"; ++static const char *user_conf_tmp = "/tmp/tacplus_user_tmp"; + + /* + * pwbuf is used to reduce number of arguments passed around; the strings in +@@ -63,255 +59,239 @@ struct pwbuf { + typedef struct { + struct addrinfo *addr; + char *key; +-} tacplus_server_t; ++ int timeout; ++}tacplus_server_t; ++ ++typedef struct { ++ char *info; ++ int gid; ++ char *secondary_grp; ++ char *shell; ++}useradd_info_t; + + /* set from configuration file parsing */ + static tacplus_server_t tac_srv[TAC_PLUS_MAXSERVERS]; +-static int tac_srv_no, tac_key_no; +-static char tac_service[] = "shell"; +-static char tac_protocol[] = "ssh"; +-static char tac_rhost[INET6_ADDRSTRLEN]; +-static char vrfname[64]; +-static char *exclude_users; +-static uid_t min_uid = ~0U; /* largest possible */ +-static int debug; +-uint16_t use_tachome; +-static int conf_parsed = 0; +- +-static void get_remote_addr(void); +- +-#define MAX_INCL 8 /* max config level nesting */ +- +-/* reset all config variables when we are going to re-parse */ +-static void +-reset_config(void) +-{ +- int i, nservers; ++static int tac_srv_no; ++static useradd_info_t useradd_grp_list[MAX_TACACS_USER_PRIV + 1]; + +- /* reset the config variables that we use, freeing memory where needed */ +- nservers = tac_srv_no; +- tac_srv_no = 0; +- tac_key_no = 0; +- vrfname[0] = '\0'; +- if(exclude_users) { +- (void)free(exclude_users); +- exclude_users = NULL; +- } +- debug = 0; +- use_tachome = 0; +- tac_timeout = 0; +- min_uid = ~0U; +- +- for(i = 0; i < nservers; i++) { +- if(tac_srv[i].key) { +- free(tac_srv[i].key); +- tac_srv[i].key = NULL; +- } +- tac_srv[i].addr = NULL; +- } +-} ++static char *tac_service = "shell"; ++static char *tac_protocol = "ssh"; ++static bool debug = false; ++static bool many_to_one = false; + +-static int nss_tacplus_config(int *errnop, const char *cfile, int top) ++static int parse_tac_server(char *srv_buf) + { +- FILE *conf; +- char lbuf[256]; +- static struct stat lastconf[MAX_INCL]; +- static char *cfilelist[MAX_INCL]; +- struct stat st, *lst; +- +- if(top > MAX_INCL) { +- syslog(LOG_NOTICE, "%s: Config file include depth > %d, ignoring %s", +- nssname, MAX_INCL, cfile); +- return 1; +- } +- +- lst = &lastconf[top-1]; +- if(conf_parsed && top == 1) { +- /* +- * check to see if the config file(s) have changed since last time, +- * in case we are part of a long-lived daemon. If any changed, +- * reparse. If not, return the appropriate status (err or OK) +- * This is somewhat complicated by the include file mechanism. +- * When we have nested includes, we have to check all the config +- * files we saw previously, not just the top level config file. +- */ +- int i; +- for(i=0; i < MAX_INCL; i++) { +- struct stat *cst; +- cst = &lastconf[i]; +- if(!cst->st_ino || !cfilelist[i]) /* end of files */ +- return conf_parsed == 2 ? 0 : 1; +- if (stat(cfilelist[i], &st) || st.st_ino != cst->st_ino || +- st.st_mtime != cst->st_mtime || st.st_ctime != cst->st_ctime) +- break; /* found removed or different file, so re-parse */ +- } +- reset_config(); +- syslog(LOG_NOTICE, "%s: Configuration file(s) have changed, re-initializing", +- nssname); +- } +- +- /* don't check for failures, we'll just skip, don't want to error out */ +- cfilelist[top-1] = strdup(cfile); +- conf = fopen(cfile, "r"); +- if(conf == NULL) { +- *errnop = errno; +- if(!conf_parsed && debug) /* debug because privileges may not allow */ +- syslog(LOG_DEBUG, "%s: can't open config file %s: %m", +- nssname, cfile); +- return 1; +- } +- if (fstat(fileno(conf), lst) != 0) +- memset(lst, 0, sizeof *lst); /* avoid stale data, no warning */ +- +- while(fgets(lbuf, sizeof lbuf, conf)) { +- if(*lbuf == '#' || isspace(*lbuf)) +- continue; /* skip comments, white space lines, etc. */ +- strtok(lbuf, " \t\n\r\f"); /* terminate buffer at first whitespace */ +- if(!strncmp(lbuf, "include=", 8)) { +- /* +- * allow include files, useful for centralizing tacacs +- * server IP address and secret. When running non-privileged, +- * may not be able to read one or more config files. +- */ +- if(lbuf[8]) +- (void)nss_tacplus_config(errnop, &lbuf[8], top+1); +- } +- else if(!strncmp(lbuf, "debug=", 6)) +- debug = strtoul(lbuf+6, NULL, 0); +- else if (!strncmp (lbuf, "user_homedir=", 13)) +- use_tachome = (uint16_t)strtoul(lbuf+13, NULL, 0); +- else if (!strncmp (lbuf, "timeout=", 8)) { +- tac_timeout = (int)strtoul(lbuf+8, NULL, 0); +- if (tac_timeout < 0) /* explict neg values disable poll() use */ +- tac_timeout = 0; +- else /* poll() only used if timeout is explictly set */ +- tac_readtimeout_enable = 1; +- } +- /* +- * This next group is here to prevent a warning in the +- * final "else" case. We don't need them, but if there +- * is a common included file, we might see them. +- */ +- else if(!strncmp(lbuf, "service=", 8) || +- !strncmp(lbuf, "protocol=", 9) || +- !strncmp(lbuf, "login=", 6)) +- ; +- else if(!strncmp(lbuf, "secret=", 7)) { +- int i; +- /* no need to complain if too many on this one */ +- if(tac_key_no < TAC_PLUS_MAXSERVERS) { +- if((tac_srv[tac_key_no].key = strdup(lbuf+7))) +- tac_key_no++; +- else +- syslog(LOG_ERR, "%s: unable to copy server secret %s", +- nssname, lbuf+7); +- } +- /* handle case where 'secret=' was given after a 'server=' +- * parameter, fill in the current secret */ +- for(i = tac_srv_no-1; i >= 0; i--) { +- if (tac_srv[i].key) +- continue; +- tac_srv[i].key = strdup(lbuf+7); +- } +- } +- else if(!strncmp(lbuf, "exclude_users=", 14)) { +- /* +- * Don't lookup users in this comma-separated list for both +- * robustness and performnce. Typically root and other commonly +- * used local users. If set, we also look up the uids +- * locally, and won't do remote lookup on those uids either. +- */ +- exclude_users = strdup(lbuf+14); +- } +- else if(!strncmp(lbuf, "min_uid=", 8)) { +- /* +- * Don't lookup uids that are local, typically set to either +- * 0 or smallest always local user's uid +- */ +- unsigned long uid; +- char *valid; +- uid = strtoul(lbuf+8, &valid, 0); +- if (valid > (lbuf+8)) +- min_uid = (uid_t)uid; +- } +- else if(!strncmp(lbuf, "vrf=", 4)) +- strncpy(vrfname, lbuf + 4, sizeof(vrfname)); +- else if(!strncmp(lbuf, "server=", 7)) { +- if(tac_srv_no < TAC_PLUS_MAXSERVERS) { +- struct addrinfo hints, *servers, *server; ++ char *token; ++ char delim[] = " ,\t\n\r\f"; ++ ++ token = strsep(&srv_buf, delim); ++ while(token) { ++ if('\0' != token) { ++ if(!strncmp(token, "server=", 7)) { ++ struct addrinfo hints, *server; + int rv; +- char *port, server_buf[sizeof lbuf]; ++ char *srv, *port; + + memset(&hints, 0, sizeof hints); +- hints.ai_family = AF_UNSPEC; /* use IPv4 or IPv6, whichever */ ++ hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + +- strcpy(server_buf, lbuf + 7); +- +- port = strchr(server_buf, ':'); +- if(port != NULL) { ++ srv = token + 7; ++ port = strchr(srv, ':'); ++ if(port) { + *port = '\0'; +- port++; ++ port++; + } +- if((rv = getaddrinfo(server_buf, (port == NULL) ? +- "49" : port, &hints, &servers)) == 0) { +- for(server = servers; server != NULL && +- tac_srv_no < TAC_PLUS_MAXSERVERS; +- server = server->ai_next) { ++ ++ if((rv = getaddrinfo(srv, (port == NULL) ? "49" : port, &hints, ++ &server)) == 0) { ++ if(server) { ++ if(tac_srv[tac_srv_no].addr) ++ freeaddrinfo(tac_srv[tac_srv_no].addr); ++ if(tac_srv[tac_srv_no].key) ++ free(tac_srv[tac_srv_no].key); ++ memset(tac_srv + tac_srv_no, 0, sizeof(tacplus_server_t)); ++ + tac_srv[tac_srv_no].addr = server; +- /* use current key, if our index not yet set */ +- if(tac_key_no && !tac_srv[tac_srv_no].key) +- tac_srv[tac_srv_no].key = +- strdup(tac_srv[tac_key_no-1].key); +- tac_srv_no++; ++ } ++ else { ++ syslog(LOG_ERR, "%s: server NULL", nssname); + } + } + else { +- syslog(LOG_ERR, +- "%s: skip invalid server: %s (getaddrinfo: %s)", +- nssname, server_buf, gai_strerror(rv)); ++ syslog(LOG_ERR, "%s: invalid server: %s (getaddrinfo: %s)", ++ nssname, srv, gai_strerror(rv)); ++ return -1; ++ } ++ } ++ else if(!strncmp(token, "secret=", 7)) { ++ if(tac_srv[tac_srv_no].key) ++ free(tac_srv[tac_srv_no].key); ++ tac_srv[tac_srv_no].key = strdup(token + 7); ++ } ++ else if(!strncmp(token, "timeout=", 8)) { ++ tac_srv[tac_srv_no].timeout = (int)strtoul(token + 8, NULL, 0); ++ if(tac_srv[tac_srv_no].timeout < 0) ++ tac_srv[tac_srv_no].timeout = 0; ++ /* Limit timeout to make sure upper application not wait ++ * for a long time*/ ++ if(tac_srv[tac_srv_no].timeout > 5) ++ tac_srv[tac_srv_no].timeout = 5; ++ } ++ } ++ token = strsep(&srv_buf, delim); ++ } ++ ++ return 0; ++} ++ ++static int parse_user_priv(char *buf) ++{ ++ char *token; ++ char delim[] = ";\n\r"; ++ int priv = 0; ++ int gid = 0; ++ char *info = NULL; ++ char *group = NULL; ++ char *shell = NULL; ++ ++ token = strsep(&buf, delim); ++ while(token) { ++ if('\0' != token) { ++ if(!strncmp(token, "user_priv=", 10)) { ++ priv = (int)strtoul(token + 10, NULL, 0); ++ if(priv > MAX_TACACS_USER_PRIV || priv < MIN_TACACS_USER_PRIV) ++ { ++ priv = 0; ++ syslog(LOG_WARNING, "%s: user_priv %d out of range", ++ nssname, priv); + } + } +- else { +- syslog(LOG_WARNING, "%s: maximum number of servers (%d) " +- "exceeded, skipping", nssname, TAC_PLUS_MAXSERVERS); ++ else if(!strncmp(token, "pw_info=", 8)) { ++ if(!info) ++ info = strdup(token + 8); ++ } ++ else if(!strncmp(token, "gid=", 4)) { ++ gid = (int)strtoul(token + 4, NULL, 0); ++ } ++ else if(!strncmp(token, "group=", 6)) { ++ if(!group) ++ group = strdup(token + 6); ++ } ++ else if(!strncmp(token, "shell=", 6)) { ++ if(!shell) ++ shell = strdup(token + 6); + } + } +- else if(debug) /* ignore unrecognized lines, unless debug on */ +- syslog(LOG_WARNING, "%s: unrecognized parameter: %s", +- nssname, lbuf); ++ token = strsep(&buf, delim); + } +- fclose(conf); + ++ if(priv && gid && info && group && shell) { ++ useradd_info_t *user = &useradd_grp_list[priv]; ++ if(user->info) ++ free(user->info); ++ if(user->secondary_grp) ++ free(user->secondary_grp); ++ if(user->shell) ++ free(user->shell); ++ ++ user->gid = gid; ++ user->info = info; ++ user->secondary_grp = group; ++ user->shell = shell; ++ syslog(LOG_DEBUG, "%s: user_priv=%d info=%s gid=%d group=%s shell=%s", ++ nssname, priv, info, gid, group, shell); ++ } ++ else { ++ if(info) ++ free(info); ++ if(group) ++ free(group); ++ if(shell) ++ free(shell); ++ } + + return 0; + } + +-/* +- * Separate function so we can print first time we try to connect, +- * rather than during config. +- * Don't print at config, because often the uid lookup is one we +- * skip due to min_uid, so no reason to clutter the log. +- */ +-static void print_servers(void) ++static void init_useradd_info() + { +- static int printed = 0; +- int n; +- +- if (printed || !debug) +- return; +- printed = 1; +- +- if(tac_srv_no == 0) +- syslog(LOG_DEBUG, "%s:%s: no TACACS %s in config (or no perm)," +- " giving up", +- nssname, __FUNCTION__, tac_srv_no ? "service" : +- (*tac_service ? "server" : "service and no server")); +- +- for(n = 0; n < tac_srv_no; n++) +- syslog(LOG_DEBUG, "%s: server[%d] { addr=%s, key='%s' }", nssname, +- n, tac_srv[n].addr ? tac_ntop(tac_srv[n].addr->ai_addr) +- : "unknown", tac_srv[n].key); ++ useradd_info_t *user; ++ ++ user = &useradd_grp_list[MIN_TACACS_USER_PRIV]; ++ user->gid = 999; ++ user->info = strdup("remote_user"); ++ user->secondary_grp = strdup("docker"); ++ user->shell = strdup("/bin/bash"); ++ ++ user = &useradd_grp_list[MAX_TACACS_USER_PRIV]; ++ user->gid = 1000; ++ user->info = strdup("remote_user_su"); ++ user->secondary_grp = strdup("sudo,docker"); ++ user->shell = strdup("/bin/bash"); ++} ++ ++static int parse_config(const char *file) ++{ ++ FILE *fp; ++ char buf[512] = {0}; ++ ++ init_useradd_info(); ++ fp = fopen(file, "r"); ++ if(!fp) { ++ syslog(LOG_ERR, "%s: %s fopen failed", nssname, file); ++ return NSS_STATUS_UNAVAIL; ++ } ++ ++ debug = false; ++ tac_srv_no = 0; ++ while(fgets(buf, sizeof buf, fp)) { ++ if('#' == *buf || isspace(*buf)) ++ continue; ++ ++ if(!strncmp(buf, "debug=on", 8)) { ++ debug = true; ++ } ++ else if(!strncmp(buf, "many_to_one=y", 13)) { ++ many_to_one = true; ++ } ++ else if(!strncmp(buf, "user_priv=", 10)) { ++ parse_user_priv(buf); ++ } ++ else if(!strncmp(buf, "server=", 7)) { ++ if(TAC_PLUS_MAXSERVERS <= tac_srv_no) { ++ syslog(LOG_ERR, "%s: tac server num is more than %d", ++ nssname, TAC_PLUS_MAXSERVERS); ++ } ++ else if(0 == parse_tac_server(buf)) ++ ++tac_srv_no; ++ } ++ } ++ fclose(fp); ++ ++ if(debug) { ++ int n; ++ useradd_info_t *user; ++ ++ for(n = 0; n < tac_srv_no; n++) { ++ syslog(LOG_DEBUG, "%s: server[%d] { addr=%s, key=%s, timeout=%d }", ++ nssname, n, tac_ntop(tac_srv[n].addr->ai_addr), ++ tac_srv[n].key, tac_srv[n].timeout); ++ } ++ syslog(LOG_DEBUG, "%s: many_to_one %s", nssname, 1 == many_to_one ++ ? "enable" : "disable"); ++ for(n = MIN_TACACS_USER_PRIV; n <= MAX_TACACS_USER_PRIV; n++) { ++ user = &useradd_grp_list[n]; ++ if(user) { ++ syslog(LOG_DEBUG, "%s: user_priv[%d] { gid=%d, info=%s, group=%s, shell=%s }", ++ nssname, n, user->gid, NULL == user->info ? "NULL" : user->info, ++ NULL == user->secondary_grp ? "NULL" : user->secondary_grp, ++ NULL == user->shell ? "NULL" : user->shell); ++ } ++ } ++ } ++ ++ return 0; + } + + /* +@@ -324,15 +304,13 @@ static void print_servers(void) + */ + static int + pwcopy(char *buf, size_t len, struct passwd *srcpw, struct passwd *destpw, +- const char *usename, uint16_t tachome) ++ const char *usename) + { +- int needlen, cnt, origlen = len; +- char *shell; ++ size_t needlen; ++ int cnt; + +- if(!usename) { ++ if(!usename) + usename = srcpw->pw_name; +- tachome = 0; /* early lookups; no tachome */ +- } + + needlen = usename ? strlen(usename) + 1 : 1 + + srcpw->pw_dir ? strlen(srcpw->pw_dir) + 1 : 1 + +@@ -341,8 +319,8 @@ pwcopy(char *buf, size_t len, struct passwd *srcpw, struct passwd *destpw, + srcpw->pw_passwd ? strlen(srcpw->pw_passwd) + 1 : 1; + if(needlen > len) { + if(debug) +- syslog(LOG_DEBUG, "%s provided password buffer too small (%ld<%d)", +- nssname, (long)len, needlen); ++ syslog(LOG_DEBUG, "%s provided password buffer too small (%ld<%ld)", ++ nssname, (long)len, (long)needlen); + return 1; + } + +@@ -354,21 +332,14 @@ pwcopy(char *buf, size_t len, struct passwd *srcpw, struct passwd *destpw, + cnt++; /* allow for null byte also */ + buf += cnt; + len -= cnt; +- cnt = snprintf(buf, len, "%s", srcpw->pw_passwd ? srcpw->pw_passwd : ""); ++ /* If many-to-one mapping, set pw_passwd "a" for pam_account success */ ++ cnt = snprintf(buf, len, "%s", 0 == many_to_one ? "x" : "a"); + destpw->pw_passwd = buf; + cnt++; + buf += cnt; + len -= cnt; + cnt = snprintf(buf, len, "%s", srcpw->pw_shell ? srcpw->pw_shell : ""); + destpw->pw_shell = buf; +- shell = strrchr(buf, '/'); +- shell = shell ? shell+1 : buf; +- if (tachome && *shell == 'r') { +- tachome = 0; +- if(debug > 1) +- syslog(LOG_DEBUG, "%s tacacs login %s with user_homedir not allowed; " +- "shell is %s", nssname, srcpw->pw_name, buf); +- } + cnt++; + buf += cnt; + len -= cnt; +@@ -377,148 +348,227 @@ pwcopy(char *buf, size_t len, struct passwd *srcpw, struct passwd *destpw, + cnt++; + buf += cnt; + len -= cnt; +- if (tachome && usename) { +- char *slash, dbuf[strlen(srcpw->pw_dir) + strlen(usename)]; +- snprintf(dbuf, sizeof dbuf, "%s", srcpw->pw_dir ? srcpw->pw_dir : ""); +- slash = strrchr(dbuf, '/'); +- if (slash) { +- slash++; +- snprintf(slash, sizeof dbuf - (slash-dbuf), "%s", usename); +- } +- cnt = snprintf(buf, len, "%s", dbuf); +- } +- else +- cnt = snprintf(buf, len, "%s", srcpw->pw_dir ? srcpw->pw_dir : ""); ++ cnt = snprintf(buf, len, "%s", srcpw->pw_dir ? srcpw->pw_dir : ""); + destpw->pw_dir = buf; + cnt++; + buf += cnt; + len -= cnt; +- if(len < 0) { +- if(debug) +- syslog(LOG_DEBUG, "%s provided password buffer too small (%ld<%d)", +- nssname, (long)origlen, origlen-(int)len); +- return 1; +- } + + return 0; + } + + /* +- * Find the username or the matching tacacs privilege user in /etc/passwd +- * We use fgetpwent() so we can check the local file, always. +- * This could cause problems if somebody is using local users, ldap, and tacacs, +- * but we just require that the mapped user always be a local user. Since the +- * local user password isn't supposed to be used, that should be OK. +- * +- * We shouldn't normally find the username, because tacacs lookup should be +- * configured to follow local in nsswitch.conf, but somebody may configure the +- * other way, so we look for both the given user, and our "matching" user name +- * based on the tacacs authorization level. +- * +- * If not found, then try to map to a localuser tacacsN where N <= to the +- * TACACS+ privilege level, using the APIs in libtacplus_map.so +- * algorithm in update_mapuser() +- * Returns 0 on success, else 1 ++ * If useradd finished, user name should be deleted in conf. + */ +-static int +-find_pw_userpriv(unsigned priv, struct pwbuf *pb) ++static int delete_conf_line(const char *name) + { +- FILE *pwfile; +- struct passwd upw, tpw, *ent; +- int matches, ret, retu, rett; +- unsigned origpriv = priv; +- char ubuf[pb->buflen], tbuf[pb->buflen]; +- char tacuser[9]; /* "tacacs" followed by 1-2 digits */ +- +- tacuser[0] = '\0'; +- +- pwfile = fopen("/etc/passwd", "r"); +- if(!pwfile) { +- syslog(LOG_WARNING, "%s: failed to open /etc/passwd: %m", nssname); +- return 1; ++ FILE *fp, *fp_tmp; ++ char line[128]; ++ char del_line[128]; ++ int len = strlen(name); ++ ++ if(len >= 126) { ++ syslog(LOG_ERR, "%s: user name %s out of range 128", nssname, name); ++ return -1; ++ } ++ else { ++ snprintf(del_line, 128, "%s\n", name); + } + +-recheck: +- snprintf(tacuser, sizeof tacuser, "tacacs%u", priv); +- tpw.pw_name = upw.pw_name = NULL; +- retu = 0, rett = 0; +- for(matches=0; matches < 2 && (ent = fgetpwent(pwfile)); ) { +- if(!ent->pw_name) +- continue; /* shouldn't happen */ +- if(!strcmp(ent->pw_name, pb->name)) { +- retu = pwcopy(ubuf, sizeof(ubuf), ent, &upw, NULL, use_tachome); +- matches++; +- } +- else if(!strcmp(ent->pw_name, tacuser)) { +- rett = pwcopy(tbuf, sizeof(tbuf), ent, &tpw, NULL, use_tachome); +- matches++; ++ fp = fopen(user_conf, "r"); ++ if(!fp) { ++ syslog(LOG_ERR, "%s: %s fopen failed", nssname, user_conf); ++ return NSS_STATUS_UNAVAIL; ++ } ++ fp_tmp = fopen(user_conf_tmp, "w"); ++ if(!fp_tmp) { ++ syslog(LOG_ERR, "%s: %s fopen failed", nssname, user_conf_tmp); ++ fclose(fp); ++ return NSS_STATUS_UNAVAIL; ++ } ++ ++ while(fgets(line, sizeof line, fp)) { ++ if(strcmp(line, del_line)) { ++ fprintf(fp_tmp, "%s", line); + } + } +- if(!matches && priv > 0) { +- priv--; +- rewind(pwfile); +- goto recheck; +- } +- ret = 1; +- fclose(pwfile); +- if(matches) { +- if(priv != origpriv && debug) +- syslog(LOG_DEBUG, "%s: local user not found at privilege=%u," +- " using %s", nssname, origpriv, tacuser); +- if(upw.pw_name && !retu) +- ret = pwcopy(pb->buf, pb->buflen, &upw, pb->pw, pb->name, +- use_tachome); +- else if(tpw.pw_name && !rett) +- ret = pwcopy(pb->buf, pb->buflen, &tpw, pb->pw, pb->name, +- use_tachome); +- } +- if(ret) +- *pb->errnop = ERANGE; ++ fclose(fp_tmp); ++ fclose(fp); + +- return ret; ++ if(0 != remove(user_conf) || 0 != rename(user_conf_tmp, user_conf)) { ++ syslog(LOG_ERR, "%s: %s rewrite failed", nssname, user_conf); ++ return -1; ++ } ++ ++ return 0; + } + + /* +- * This is similar to find_pw_userpriv(), but passes in a fixed +- * name for UID lookups, where we have the mapped name from the +- * map file, so trying multiple tacacsN users would be wrong. +- * Some commonality, but ugly to factor +- * Only applies to mapped users +- * returns 0 on success ++ * If not found in local, look up in tacacs user conf. If user name is not in ++ * conf, it will be written in conf and created by command 'useradd'. When ++ * useradd command use getpwnam(), it will return when username found in conf. + */ +-static int +-find_pw_user(const char *logname, const char *tacuser, struct pwbuf *pb, +- uint16_t usetachome) ++static int create_local_user(const char *name, int level) + { +- FILE *pwfile; +- struct passwd *ent; +- int ret = 1; ++ FILE *fp; ++ useradd_info_t *user; ++ char buf[512]; ++ int len = 512; ++ int lvl, cnt; ++ bool found = false; ++ ++ fp = fopen(user_conf, "ab+"); ++ if(!fp) { ++ syslog(LOG_ERR, "%s: %s fopen failed", nssname, user_conf); ++ return -1; ++ } + +- if(!tacuser) { ++ while(fgets(buf, sizeof buf, fp)) { ++ if('#' == *buf || isspace(*buf)) ++ continue; ++ // Delete line break ++ cnt = strlen(buf); ++ buf[cnt - 1] = '\0'; ++ if(!strcmp(buf, name)) { ++ found = true; ++ break; ++ } ++ } ++ ++ /* ++ * If user is found in user_conf, it means that getpwnam is called by ++ * useradd in this NSS module. ++ */ ++ if(found) { + if(debug) +- syslog(LOG_DEBUG, "%s: passed null username, failing", nssname); ++ syslog(LOG_DEBUG, "%s: %s found in %s", nssname, name, user_conf); ++ fclose(fp); + return 1; + } + +- pwfile = fopen("/etc/passwd", "r"); +- if(!pwfile) { +- syslog(LOG_WARNING, "%s: failed to open /etc/passwd: %m", +- nssname); +- return 1; ++ snprintf(buf, len, "%s\n", name); ++ if(EOF == fputs(buf, fp)) { ++ syslog(LOG_ERR, "%s: %s write local user failed", nssname, name); ++ fclose(fp); ++ return -1; ++ } ++ fclose(fp); ++ ++ lvl = level; ++ while(lvl >= MIN_TACACS_USER_PRIV) { ++ user = &useradd_grp_list[lvl]; ++ if(user->info && user->secondary_grp && user->shell) { ++ snprintf(buf, len, "useradd -G %s \"%s\" -g %d -c \"%s\" -d /home/%s -m -s %s", ++ user->secondary_grp, name, user->gid, user->info, name, user->shell); ++ fp = popen(buf, "r"); ++ if(!fp || -1 == pclose(fp)) { ++ syslog(LOG_ERR, "%s: useradd popen failed errno=%d %s", ++ nssname, errno, strerror(errno)); ++ delete_conf_line(name); ++ return -1; ++ } ++ if(debug) ++ syslog(LOG_DEBUG, "%s: create local user %s success", nssname, name); ++ delete_conf_line(name); ++ return 0; ++ } ++ lvl--; ++ } ++ ++ return -1; ++} ++ ++/* ++ * Lookup user in /etc/passwd, and fill up passwd info if found. ++ */ ++static int lookup_pw_local(char* username, struct pwbuf *pb, bool *found) ++{ ++ FILE *fp; ++ struct passwd *pw = NULL; ++ int ret = 0; ++ ++ if(!username) { ++ syslog(LOG_ERR, "%s: username invalid in check passwd", nssname); ++ return -1; + } + +- pb->pw->pw_name = NULL; /* be paranoid */ +- for(ret = 1; ret && (ent = fgetpwent(pwfile)); ) { +- if(!ent->pw_name) +- continue; /* shouldn't happen */ +- if(!strcmp(ent->pw_name, tacuser)) { +- ret = pwcopy(pb->buf, pb->buflen, ent, pb->pw, logname, usetachome); ++ fp = fopen("/etc/passwd", "r"); ++ if(!fp) { ++ syslog(LOG_ERR, "%s: /etc/passwd fopen failed", nssname); ++ return -1; ++ } ++ ++ while(0 != (pw = fgetpwent(fp))) { ++ if(!strcmp(pw->pw_name, username)) { ++ *found = true; ++ ret = pwcopy(pb->buf, pb->buflen, pw, pb->pw, username); ++ if(ret) ++ *pb->errnop = ERANGE; + break; + } + } +- fclose(pwfile); +- if(ret) +- *pb->errnop = ERANGE; ++ fclose(fp); ++ return ret; ++} ++ ++/* ++ * Lookup local user passwd info for TACACS+ user. If not found, local user will ++ * be created by user mapping strategy. ++ */ ++static int lookup_user_pw(struct pwbuf *pb, int level) ++{ ++ char *username = NULL; ++ char buf[128]; ++ int len = 128; ++ bool found = false; ++ int ret = 0; ++ ++ if(level < MIN_TACACS_USER_PRIV || level > MAX_TACACS_USER_PRIV) { ++ syslog(LOG_ERR, "%s: TACACS+ user %s privilege %d invalid", nssname, pb->name, level); ++ return -1; ++ } ++ ++ /* ++ * If many-to-one user mapping disable, create local user for each TACACS+ user ++ * The username of local user and TACACS+ user is the same. If many-to-one enable, ++ * look up the mapped local user name and passwd info. ++ */ ++ if(0 == many_to_one) { ++ username = pb->name; ++ } ++ else { ++ int lvl = level; ++ useradd_info_t *user; ++ ++ while(lvl >= MIN_TACACS_USER_PRIV) { ++ user = &useradd_grp_list[lvl]; ++ if(user->info && user->secondary_grp && user->shell) { ++ snprintf(buf, len, "%s", user->info); ++ username = buf; ++ if(debug) ++ syslog(LOG_DEBUG, "%s: %s mapping local user %s", nssname, ++ pb->name, username); ++ break; ++ } ++ lvl--; ++ } ++ } ++ ++ ret = lookup_pw_local(username, pb, &found); ++ if(debug) ++ syslog(LOG_DEBUG, "%s: %s passwd %s found in local", nssname, username, ++ found ? "is" : "isn't"); ++ if(0 != ret || found) ++ return ret; ++ ++ if(0 != create_local_user(username, level)) ++ return -1; ++ ++ ret = lookup_pw_local(username, pb, &found); ++ if(0 == ret && !found) { ++ syslog(LOG_ERR, "%s: %s not found in local after useradd", nssname, pb->name); ++ ret = -1; ++ } + + return ret; + } +@@ -532,6 +582,7 @@ static int + got_tacacs_user(struct tac_attrib *attr, struct pwbuf *pb) + { + unsigned long priv_level = 0; ++ int ret; + + while(attr != NULL) { + /* we are looking for the privilege attribute, can be in several forms, +@@ -550,14 +601,20 @@ got_tacacs_user(struct tac_attrib *attr, struct pwbuf *pb) + /* if this fails, we leave priv_level at 0, which is + * least privileged, so that's OK, but at least report it + */ +- if(ok == val && debug) +- syslog(LOG_WARNING, "%s: non-numeric privilege for %s, (%s)", +- nssname, pb->name, attr->attr); ++ if(debug) ++ syslog(LOG_DEBUG, "%s: privilege for %s, (%lu)", ++ nssname, pb->name, priv_level); + } + attr = attr->next; + } + +- return find_pw_userpriv(priv_level, pb); ++ ret = lookup_user_pw(pb, priv_level); ++ if(!ret && debug) ++ syslog(LOG_DEBUG, "%s: pw_name=%s, pw_passwd=%s, pw_shell=%s, dir=%s", ++ nssname, pb->pw->pw_name, pb->pw->pw_passwd, pb->pw->pw_shell, ++ pb->pw->pw_dir); ++ ++ return ret; + } + + /* +@@ -570,9 +627,13 @@ connect_tacacs(struct tac_attrib **attr, int srvr) + { + int fd; + ++ if(!*tac_service) /* reported at config file processing */ ++ return -1; ++ + fd = tac_connect_single(tac_srv[srvr].addr, tac_srv[srvr].key, NULL, +- vrfname[0]?vrfname:NULL); ++ tac_srv[srvr].timeout); + if(fd >= 0) { ++ *attr = NULL; /* so tac_add_attr() allocates memory */ + tac_add_attrib(attr, "service", tac_service); + if(tac_protocol[0]) + tac_add_attrib(attr, "protocol", tac_protocol); +@@ -598,34 +659,9 @@ lookup_tacacs_user(struct pwbuf *pb) + { + struct areply arep; + int ret = 1, done = 0; +- struct tac_attrib *attr = NULL; ++ struct tac_attrib *attr; + int tac_fd, srvr; + +- if (exclude_users) { +- char *user, *list; +- list = strdup(exclude_users); +- if (list) { +- static const char *delim = ", \t\n"; +- bool islocal = 0; +- user = strtok(list, delim); +- list = NULL; +- while (user) { +- if(!strcmp(user, pb->name)) { +- islocal = 1; +- break; +- } +- user = strtok(NULL, delim); +- } +- free(list); +- if (islocal) +- return 2; +- } +- } +- +- if(!*tac_service) /* reported at config file processing */ +- return ret; +- print_servers(); +- + for(srvr=0; srvr < tac_srv_no && !done; srvr++) { + arep.msg = NULL; + arep.attr = NULL; +@@ -636,14 +672,13 @@ lookup_tacacs_user(struct pwbuf *pb) + syslog(LOG_WARNING, "%s: failed to connect TACACS+ server %s," + " ret=%d: %m", nssname, tac_srv[srvr].addr ? + tac_ntop(tac_srv[srvr].addr->ai_addr) : "unknown", tac_fd); +- tac_free_attrib(&attr); + continue; + } +- ret = tac_author_send(tac_fd, pb->name, "", tac_rhost, attr); ++ ret = tac_author_send(tac_fd, pb->name, "", "", attr); + if(ret < 0) { + if(debug) +- syslog(LOG_WARNING, "%s: TACACS+ server %s authorization failed (%d) " +- " user (%s)", nssname, tac_srv[srvr].addr ? ++ syslog(LOG_WARNING, "%s: TACACS+ server %s send failed (%d) for" ++ " user %s: %m", nssname, tac_srv[srvr].addr ? + tac_ntop(tac_srv[srvr].addr->ai_addr) : "unknown", ret, + pb->name); + } +@@ -668,14 +703,11 @@ lookup_tacacs_user(struct pwbuf *pb) + if(arep.status == AUTHOR_STATUS_PASS_ADD || + arep.status == AUTHOR_STATUS_PASS_REPL) { + ret = got_tacacs_user(arep.attr, pb); +- if(debug>1) ++ if(debug) + syslog(LOG_DEBUG, "%s: TACACS+ server %s successful for user %s." + " local lookup %s", nssname, + tac_ntop(tac_srv[srvr].addr->ai_addr), pb->name, +- ret?"OK":"no match"); +- else if(debug) +- syslog(LOG_DEBUG, "%s: TACACS+ server %s successful for user %s", +- nssname, tac_ntop(tac_srv[srvr].addr->ai_addr), pb->name); ++ ret == 0?"OK":"no match"); + done = 1; /* break out of loop after arep cleanup */ + } + else { +@@ -692,30 +724,12 @@ lookup_tacacs_user(struct pwbuf *pb) + tac_free_attrib(&arep.attr); + } + +- return ret < 0? 1 : ret; +-} +- +-static int +-lookup_mapped_uid(struct pwbuf *pb, uid_t uid, uid_t auid, int session) +-{ +- char *loginname, mappedname[256]; +- uint16_t flag; +- +- mappedname[0] = '\0'; +- loginname = lookup_mapuid(uid, auid, session, +- mappedname, sizeof mappedname, &flag); +- if(loginname) +- return find_pw_user(loginname, mappedname, pb, flag & MAP_USERHOMEDIR); +- return 1; ++ return ret; + } + + /* + * This is an NSS entry point. +- * We implement getpwnam(), because we remap from the tacacs login +- * to the local tacacs0 ... tacacs15 users for all other info, and so +- * the normal order of "passwd tacplus" (possibly with ldap or anything +- * else prior to tacplus) will mean we only get used when there isn't +- * a local user to be found. ++ * We implement getpwnam(), because we remap from the tacacs. + * + * We try the lookup to the tacacs server first. If we can't make a + * connection to the server for some reason, we also try looking up +@@ -730,20 +744,25 @@ enum nss_status _nss_tacplus_getpwnam_r(const char *name, struct passwd *pw, + int result; + struct pwbuf pbuf; + +- result = nss_tacplus_config(errnop, config_file, 1); +- conf_parsed = result == 0 ? 2 : 1; ++ /* ++ * When filename completion is used with the tab key in bash, getpwnam ++ * is invoked. And the parameter "name" is '*'. In order not to connect to ++ * TACACS+ server frequently, check user name whether is valid. ++ */ ++ if(!strcmp(name, "*")) ++ return NSS_STATUS_NOTFOUND; + +- get_remote_addr(); ++ result = parse_config(config_file); + +- if(result) { /* no config file, no servers, etc. */ +- /* this is a debug because privileges may not allow access */ +- if(debug) +- syslog(LOG_DEBUG, "%s: bad config or server line for nss_tacplus", ++ if(result) { ++ syslog(LOG_ERR, "%s: bad config or server line for nss_tacplus", ++ nssname); ++ } ++ else if(0 == tac_srv_no) { ++ syslog(LOG_WARNING, "%s: no tacacs server in config for nss_tacplus", + nssname); + } + else { +- int lookup; +- + /* marshal the args for the lower level functions */ + pbuf.name = (char *)name; + pbuf.pw = pw; +@@ -751,126 +770,13 @@ enum nss_status _nss_tacplus_getpwnam_r(const char *name, struct passwd *pw, + pbuf.buflen = buflen; + pbuf.errnop = errnop; + +- lookup = lookup_tacacs_user(&pbuf); +- if(!lookup) ++ if(0 == lookup_tacacs_user(&pbuf)) { + status = NSS_STATUS_SUCCESS; +- else if(lookup == 1) { /* 2 means exclude_users match */ +- uint16_t flag; +- /* +- * If we can't contact a tacacs server (either not configured, or +- * more likely, we aren't running as root and the config for the +- * server is not readable by our uid for security reasons), see if +- * we can find the user via the mapping database, and if so, use +- * that. This will work for non-root users as long as the requested +- * name is in use (that is, logged in), which will be the most +- * common case of wanting to use the original login name by non-root +- * users. +- */ +- char *mapname = lookup_mapname(name, -1, -1, NULL, &flag); +- if(mapname != name && !find_pw_user(name, mapname, &pbuf, +- flag & MAP_USERHOMEDIR)) +- status = NSS_STATUS_SUCCESS; ++ if(debug) ++ syslog(LOG_DEBUG, "%s: name=%s, pw_name=%s, pw_passwd=%s, pw_shell=%s", ++ nssname, name, pw->pw_name, pw->pw_passwd, pw->pw_shell); + } + } +- return status; +-} + +-/* +- * This is an NSS entry point. +- * We implement getpwuid(), for anything that wants to get the original +- * login name from the uid. +- * If it matches an entry in the map, we use that data to replace +- * the data from the local passwd file (not via NSS). +- * locally from the map. +- * +- * This can be made to work 2 different ways, and we need to choose +- * one, or make it configurable. +- * +- * 1) Given a valid auid and a session id, and a mapped user logged in, +- * we'll match only that user. That is, we can only do the lookup +- * successfully for child processes of the mapped tacacs login, and +- * only while still logged in (map entry is valid). +- * +- * 2) Use auid/session wildcards, and and always match on the first valid +- * tacacs map file entry. This means if two tacacs users are logged in +- * at the same privilege level at the same time, uid lookups for ps, ls, +- * etc. will return the first (in the map file, not necessarily first +- * logged in) mapped name. +- * +- * For now, if auid and session are set, I try them, and if that lookup +- * fails, try the wildcard. +- * +- * Only works while the UID is in use for a mapped user, and only +- * for processes invoked from that session. Other callers will +- * just get the files, ldap, or nis entry for the UID +- * Only works while the UID is in use for a mapped user, and returns +- * the first match from the mapped users. +- */ +-enum nss_status _nss_tacplus_getpwuid_r(uid_t uid, struct passwd *pw, +- char *buffer, size_t buflen, int *errnop) +-{ +- struct pwbuf pb; +- enum nss_status status = NSS_STATUS_NOTFOUND; +- int session, ret; +- uid_t auid; +- +- ret = nss_tacplus_config(errnop, config_file, 1); +- conf_parsed = ret == 0 ? 2 : 1; +- +- if (min_uid != ~0U && uid < min_uid) { +- if(debug > 1) +- syslog(LOG_DEBUG, "%s: uid %u < min_uid %u, don't lookup", +- nssname, uid, min_uid); +- return status; +- } +- +- auid = audit_getloginuid(); /* audit_setloginuid not called */ +- session = map_get_sessionid(); +- +- /* marshal the args for the lower level functions */ +- pb.pw = pw; +- pb.buf = buffer; +- pb.buflen = buflen; +- pb.errnop = errnop; +- pb.name = NULL; +- +- /* +- * the else case will only be called if we don't have an auid or valid +- * sessionid, since otherwise the first call will be using wildcards, +- * since the getloginuid and get_sessionid calls will "fail". +- */ +- if(!lookup_mapped_uid(&pb, uid, auid, session)) +- status = NSS_STATUS_SUCCESS; +- else if((auid != (uid_t)-1 || session != ~0U) && +- !lookup_mapped_uid(&pb, uid, (uid_t)-1, ~0)) +- status = NSS_STATUS_SUCCESS; + return status; + } +- +-static void get_remote_addr(void) +-{ +- struct sockaddr_storage addr; +- socklen_t len = sizeof addr; +- char ipstr[INET6_ADDRSTRLEN]; +- +- /* This is so we can fill in the rhost field when we talk to the +- * TACACS+ server, when it's an ssh connection, so sites that refuse +- * authorization unless from specific IP addresses will get that +- * information. It's pretty much of a hack, but it works. +- */ +- if (getpeername(0, (struct sockaddr*)&addr, &len) == -1) +- return; +- +- *ipstr = 0; +- if (addr.ss_family == AF_INET) { +- struct sockaddr_in *s = (struct sockaddr_in *)&addr; +- inet_ntop(AF_INET, &s->sin_addr, ipstr, sizeof ipstr); +- } else { +- struct sockaddr_in6 *s = (struct sockaddr_in6 *)&addr; +- inet_ntop(AF_INET6, &s->sin6_addr, ipstr, sizeof ipstr); +- } +- +- snprintf(tac_rhost, sizeof tac_rhost, "%s", ipstr); +- if(debug > 1 && tac_rhost[0]) +- syslog(LOG_DEBUG, "%s: rhost=%s", nssname, tac_rhost); +-} +diff --git a/tacplus_nss.conf b/tacplus_nss.conf +index bb4eb1e..7cb756f 100644 +--- a/tacplus_nss.conf ++++ b/tacplus_nss.conf +@@ -1,53 +1,50 @@ +-#%NSS_TACPLUS-1.0 +-# Install this file as /etc/tacplus_nss.conf +-# Edit /etc/nsswitch.conf to add tacplus to the passwd lookup, similar to this +-# where tacplus precede compat (or files), and depending on local policy can +-# follow or precede ldap, nis, etc. +-# passwd: tacplus compat +-# +-# Servers are tried in the order listed, and once a server +-# replies, no other servers are attempted in a given process instantiation +-# +-# This configuration is similar to the libpam_tacplus configuration, but +-# is maintained as a configuration file, since nsswitch.conf doesn't +-# support passing parameters. Parameters must start in the first +-# column, and parsing stops at the first whitespace +- +-# if set, errors and other issues are logged with syslog +-# debug=1 ++# Configuration for libnss-tacplus + +-# min_uid is the minimum uid to lookup via tacacs. Setting this to 0 +-# means uid 0 (root) is never looked up, good for robustness and performance +-# Cumulus Linux ships with it set to 1001, so we never lookup our standard +-# local users, including the cumulus uid of 1000. Should not be greater +-# than the local tacacs{0..15} uids +-min_uid=1001 ++# debug - If you want to open debug log, set it on ++# ++# Default: off ++# debug=on + +-# This is a comma separated list of usernames that are never sent to +-# a tacacs server, they cause an early not found return. ++# src_ip - set source address of TACACS+ protocl packets + # +-# "*" is not a wild card. While it's not a legal username, it turns out +-# that during pathname completion, bash can do an NSS lookup on "*" +-# To avoid server round trip delays, or worse, unreachable server delays +-# on filename completion, we include "*" in the exclusion list. +-exclude_users=root,cumulus,quagga,sshd,ntp,* ++# Default: None (it means the ip address of out port) ++# src_ip=2.2.2.2 + +-# The include keyword allows centralizing the tacacs+ server information +-# including the IP address and shared secret +-include=/etc/tacplus_servers ++# server - set ip address, tcp port, secret string and timeout for TACACS+ servers ++# The maximum number of servers is 8. If there is no TACACS+ server, libnss-tacplus ++# will always return pwname not found. ++# ++# Default: None (no TACACS+ server) ++# server=1.1.1.1:49,secret=test,timeout=3 + +-# The server IP address can be optionally followed by a ':' and a port +-# number (server=1.1.1.1:49). It is strongly recommended that you NOT +-# add secret keys to this file, because it is world readable. +-#secret=SECRET1 +-#server=1.1.1.1 ++# user_priv - set the map between TACACS+ user privilege and local user's passwd ++# If TACACS+ user validate ok, it will get passwd info from local user which is ++# specially created for TACACS+ user in libnss-tacplus. This configuration is provided ++# to create local user. There is two user privilege map by default. ++# If the TACACS+ user's privilege value is in [1, 14], the config of user_priv 1 is ++# used to create local user. If user_priv 7 is added, the TACACS+ user which privilege ++# value is in [1, 6] will get the config of user_priv 1, and the value in [7, 14] will ++# get user_priv 7. ++# ++# If the passwd info of mapped local user is modified, like gid and shell, the new TACACS+ ++# user will create local user by the new config. But the old TACACS+ user which has logged ++# will not modify its mapped local user's passwd info. So it's better to keep this ++# configuration unchanged, not to modified at the running time. Or simply delete the old ++# mapped local user after modified. ++# ++# NOTE: If many_to_one enables, 'pw_info' is used for mapped local user name. So note the ++# naming rule for Linux user name when you set 'pw_info', and keep it different from other ++# 'pw_info'. ++# ++# Default: ++# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash ++# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash + +-# The connection timeout for an NSS library should be short, since it is +-# invoked for many programs and daemons, and a failure is usually not +-# catastrophic. Not set or set to a negative value disables use of poll(). +-# This follows the include of tacplus_servers, so it can override any +-# timeout value set in that file. +-# It's important to have this set in this file, even if the same value +-# as in tacplus_servers, since tacplus_servers should not be readable +-# by users other than root. +-timeout=5 ++# many_to_one - create one local user for many TACACS+ users which has the same privilege ++# The parameter 'pw_info' in 'user_priv' is used for the mapped local user name. ++# The default config is one to one mapping. It will create local user for each TACACS+ user ++# which has different username. The user mapping strategy should be set before enables ++# TACACS+, and keep constant at the running time. ++# ++# Default: many_to_one=n ++# many_to_one=y +-- +2.7.4 + diff --git a/src/tacacs/nss/Makefile b/src/tacacs/nss/Makefile new file mode 100644 index 000000000000..4f1a337b34b4 --- /dev/null +++ b/src/tacacs/nss/Makefile @@ -0,0 +1,22 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = libnss-tacplus_$(NSS_TACPLUS_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtain libnss-tacplus + rm -rf ./libnss-tacplus + git clone https://github.com/daveolson53/libnss-tacplus.git + pushd ./libnss-tacplus + git checkout -f 19008ab + + # Apply patch + git apply ../0001-Modify-user-map-profile.patch + + dpkg-buildpackage -rfakeroot -b -us -uc + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/tacacs/pam/0001-Don-t-init-declarations-in-a-for-loop.patch b/src/tacacs/pam/0001-Don-t-init-declarations-in-a-for-loop.patch new file mode 100644 index 000000000000..f9a9c29eb93f --- /dev/null +++ b/src/tacacs/pam/0001-Don-t-init-declarations-in-a-for-loop.patch @@ -0,0 +1,45 @@ +From f293353127c504490f8d892afe39766ec94137bf Mon Sep 17 00:00:00 2001 +From: Liuqu +Date: Sun, 8 Oct 2017 07:32:11 -0700 +Subject: [PATCH 1/2] Don't init declarations in a for loop + +* It comes from the commit "3299028... Don't init declarations in + a for loop", and modified source format to resolve conflict in + v1.4.1 +--- + libtac/lib/author_r.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/libtac/lib/author_r.c b/libtac/lib/author_r.c +index a028144..f3b544e 100644 +--- a/libtac/lib/author_r.c ++++ b/libtac/lib/author_r.c +@@ -47,6 +47,7 @@ int tac_author_read(int fd, struct areply *re) { + char *msg = NULL; + int timeleft; + re->msg = NULL; ++ unsigned int r = 0; + + bzero(re, sizeof(struct areply)); + if (tac_readtimeout_enable && +@@ -132,7 +133,7 @@ int tac_author_read(int fd, struct areply *re) { + pktp = (u_char *) tb + TAC_AUTHOR_REPLY_FIXED_FIELDS_SIZE; + + /* cycle through the arguments supplied in the packet */ +- for (unsigned int r = 0; r < tb->arg_cnt && r < TAC_PLUS_MAX_ARGCOUNT; r++) { ++ for (r = 0; r < tb->arg_cnt && r < TAC_PLUS_MAX_ARGCOUNT; r++) { + if (len_from_body > packet_read || ((void *)pktp - (void *) tb) > packet_read) { + TACSYSLOG((LOG_ERR,\ + "%s: arguments supplied in packet seem to exceed its size",\ +@@ -205,7 +206,7 @@ int tac_author_read(int fd, struct areply *re) { + TACSYSLOG((LOG_DEBUG, "Args cnt %d", tb->arg_cnt)); + /* argp points to current argument string + pktp points to current argument length */ +- for (unsigned int r = 0; r < tb->arg_cnt && r < TAC_PLUS_MAX_ARGCOUNT; ++ for (r = 0; r < tb->arg_cnt && r < TAC_PLUS_MAX_ARGCOUNT; + r++) { + unsigned char buff[256]; + unsigned char *sep; +-- +2.7.4 + diff --git a/src/tacacs/pam/0002-Fix-libtac2-bin-install-directory-error.patch b/src/tacacs/pam/0002-Fix-libtac2-bin-install-directory-error.patch new file mode 100644 index 000000000000..28518b3d2449 --- /dev/null +++ b/src/tacacs/pam/0002-Fix-libtac2-bin-install-directory-error.patch @@ -0,0 +1,19 @@ +From 85bae6b84d93c4b243d29ee08ff7030376bf80cb Mon Sep 17 00:00:00 2001 +From: Liuqu +Date: Sun, 8 Oct 2017 19:39:23 -0700 +Subject: [PATCH 2/2] Fix libtac2-bin install directory error + +--- + debian/libtac2-bin.install | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/debian/libtac2-bin.install b/debian/libtac2-bin.install +index 236670a..1df36c6 100644 +--- a/debian/libtac2-bin.install ++++ b/debian/libtac2-bin.install +@@ -1 +1 @@ +-usr/sbin ++usr/bin/* +-- +2.7.4 + diff --git a/src/tacacs/pam/Makefile b/src/tacacs/pam/Makefile new file mode 100644 index 000000000000..707668791402 --- /dev/null +++ b/src/tacacs/pam/Makefile @@ -0,0 +1,25 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = libpam-tacplus_$(PAM_TACPLUS_VERSION)_amd64.deb +DERIVED_TARGETS = libtac2_$(PAM_TACPLUS_VERSION)_amd64.deb \ + libtac-dev_$(PAM_TACPLUS_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtain pam_tacplus + rm -rf ./pam_tacplus + git clone https://github.com/jeroennijhof/pam_tacplus.git + pushd ./pam_tacplus + git checkout -f v1.4.1 + + # Apply patch + git apply ../0001-Don-t-init-declarations-in-a-for-loop.patch + git apply ../0002-Fix-libtac2-bin-install-directory-error.patch + + dpkg-buildpackage -rfakeroot -b -us -uc + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) From d9c0ede2e440764d3113521466d364cd17a23b48 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 7 Dec 2017 11:32:47 -0800 Subject: [PATCH 0967/1833] [Broadcom]: Update Broadcom SDK/SAI package (#1205) Update Broadcom OpenNSL to 3.2.3.7-1 Update Broadcom SAI to 3.0.3.3 Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 28785d369395..6b1795f87ecc 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.2-15_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.2-15_amd64.deb?sv=2015-04-05&sr=b&sig=U1jDC%2FrbcCn3KgZsP9GoKFa9PtyXhliMd9iJrx8%2B%2F5M%3D&se=2031-08-07T00%3A51%3A44Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.3_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.3_amd64.deb?sv=2015-04-05&sr=b&sig=itlsEt8vqhWfZzuq%2FOSWSGgHN5kokf5a9AYOSJhD3t4%3D&se=2031-08-16T03%3A11%3A13Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.2-15_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.3_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.2-15_amd64.deb?sv=2015-04-05&sr=b&sig=nLvctIrLerXpG0SdQisirbOn1OBNLKl%2BQ7xLHRzgczM%3D&se=2031-08-07T00%3A52%3A02Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.3_amd64.deb?sv=2015-04-05&sr=b&sig=0DXLHgPXuMHERp44qJNNdQyYSv969sQsY7USCL6gCRw%3D&se=2031-08-16T03%3A10%3A49Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index aff0cf07fe5c..dbabf8aaba15 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,4 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.3-2_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.3-2_amd64.deb?sv=2015-04-05&sr=b&sig=RADtBDA9oZmwHnTzBY76ewajyJ8Af%2BchVCzNbe%2BPsbc%3D&se=2031-07-06T19%3A18%3A56Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.7-1_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.7-1_amd64.deb?sv=2015-04-05&sr=b&sig=BJEFXfq2mgvSTIYZF8qF1Jj2ePkJaxBmA0HqhhAFPmQ%3D&se=2031-08-11T03%3A27%3A43Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) From c4f7cd376e8422a5afb14a1b32181eae058caf3b Mon Sep 17 00:00:00 2001 From: wadelnn Date: Fri, 8 Dec 2017 04:08:49 +0800 Subject: [PATCH 0968/1833] [Ingrasys]: Update QSFP monitor CoPP test and sensors config (#1202) * Increase read socket buffer for CoPP Test * Add QSFP monitor service * Update S8810-32Q sensors.conf Signed-off-by: Wade He --- device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf | 4 ++-- platform/broadcom/sonic-platform-modules-ingrasys | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf index 7ab599698225..8332fbdf9086 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/sensors.conf @@ -9,8 +9,8 @@ chip "jc42-*" chip "w83795adg-*" label in0 "ROV" - set in0_min 1 * 0.97 - set in0_max 1 * 1.033 + set in0_min 1.025 * 0.98 + set in0_max 1.025 * 1.02 ignore in1 ignore in2 label in3 "1.0V" diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index e60d63d9b54d..1d9ccb21aaf8 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit e60d63d9b54dc3673433615c555a4fc62bfc488d +Subproject commit 1d9ccb21aaf868a788fd593ff1c03fdaf150eaf0 From 4b2225bca573d7e17a07d21e9bc922ba6283ec8f Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 7 Dec 2017 13:08:23 -0800 Subject: [PATCH 0969/1833] [docker-snmpd]: asyncsnmp depends on sonic-utilities so it is possible to import sonic_psu (#1212) * asyncsnmp depends on sonic-utilities so it is possible to import sonic_psu Signed-off-by: Qi Luo * Ignore sonic_utilities test during build --- dockers/docker-snmp-sv2/Dockerfile.j2 | 1 + rules/asyncsnmp-py3.mk | 3 ++- rules/sonic-utilities.mk | 8 ++++++++ slave.mk | 2 +- src/sonic-utilities | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 2ab867031874..3c5473951116 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -7,6 +7,7 @@ COPY [ \ "/debs/"] # Install Python SwSSSDK (SNMP subagent dependency) +COPY python-wheels/sonic_utilities-*-py3-*.whl /python-wheels/ COPY python-wheels/swsssdk-*-py3-*.whl /python-wheels/ COPY python-wheels/asyncsnmp-*-py3-*.whl /python-wheels/ diff --git a/rules/asyncsnmp-py3.mk b/rules/asyncsnmp-py3.mk index a5a078e15bc3..f44d7f336534 100644 --- a/rules/asyncsnmp-py3.mk +++ b/rules/asyncsnmp-py3.mk @@ -3,5 +3,6 @@ ASYNCSNMP_PY3 = asyncsnmp-2.1.0-py3-none-any.whl $(ASYNCSNMP_PY3)_SRC_PATH = $(SRC_PATH)/sonic-snmpagent $(ASYNCSNMP_PY3)_PYTHON_VERSION = 3 -$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) +# Depends on sonic-utilities so it is possible to import sonic_psu +$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_UTILS_PY3) SONIC_PYTHON_WHEELS += $(ASYNCSNMP_PY3) diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 7a935ba70ede..0dae94d8aa70 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -4,3 +4,11 @@ SONIC_UTILS = python-sonic-utilities_1.1-1_all.deb $(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities $(SONIC_UTILS)_WHEEL_DEPENDS = $(SONIC_CONFIG_ENGINE) SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS) + +# Build sonic-utilities into python3 wheel, so we can use PSU code +# Note: _DEPENDS macro is not defined +SONIC_UTILS_PY3 = sonic_utilities-1.1-py3-none-any.whl +$(SONIC_UTILS_PY3)_SRC_PATH = $(SRC_PATH)/sonic-utilities +$(SONIC_UTILS_PY3)_PYTHON_VERSION = 3 +$(SONIC_UTILS_PY3)_TEST = n +SONIC_PYTHON_WHEELS += $(SONIC_UTILS_PY3) diff --git a/slave.mk b/slave.mk index 1f00accb9e30..8ec6832bd687 100644 --- a/slave.mk +++ b/slave.mk @@ -306,7 +306,7 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA pushd $($*_SRC_PATH) $(LOG) # apply series of patches if exist if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi - python$($*_PYTHON_VERSION) setup.py test $(LOG) + [ "$($*_TEST)" = "n" ] || python$($*_PYTHON_VERSION) setup.py test $(LOG) python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) # clean up if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then quilt pop -a -f; fi diff --git a/src/sonic-utilities b/src/sonic-utilities index 0c0a2f02c32a..ea108f3cac77 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 0c0a2f02c32a8cafb3020d8248ea829bbc959d4a +Subproject commit ea108f3cac773ed8e71110c7da577fde28e9219b From 2276333ca8eb003d4cc0aac3413480cb03c87883 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 7 Dec 2017 21:50:39 -0800 Subject: [PATCH 0970/1833] Added PSU util for Mellanox platforms, updated sonic-utilities submodule (#1218) --- .../x86_64-mlnx_msn2100-r0/plugins/psuutil.py | 64 ++++++++++++++++ .../x86_64-mlnx_msn2410-r0/plugins/psuutil.py | 74 +++++++++++++++++++ .../x86_64-mlnx_msn2700-r0/plugins/psuutil.py | 74 +++++++++++++++++++ .../x86_64-mlnx_msn2740-r0/plugins/psuutil.py | 74 +++++++++++++++++++ src/sonic-utilities | 2 +- 5 files changed, 287 insertions(+), 1 deletion(-) create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py new file mode 100644 index 000000000000..88bdd51e9b67 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_presence = "psu{}_status" + self.psu_oper_status = "psu{}_pg_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + return isinstance(index, int) and index > 0 and index <= self.get_num_psus() diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py new file mode 100644 index 000000000000..301569c13a94 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_presence = "psu{}_status" + self.psu_oper_status = "psu{}_pg_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py new file mode 100644 index 000000000000..301569c13a94 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_presence = "psu{}_status" + self.psu_oper_status = "psu{}_pg_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py new file mode 100644 index 000000000000..301569c13a94 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_presence = "psu{}_status" + self.psu_oper_status = "psu{}_pg_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/src/sonic-utilities b/src/sonic-utilities index ea108f3cac77..cc147b9d0f0a 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ea108f3cac773ed8e71110c7da577fde28e9219b +Subproject commit cc147b9d0f0a2edd1e89019052755a92840dd5f9 From 1859f53206aec3b230d30180d4de34cd88194e68 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 8 Dec 2017 09:06:22 -0800 Subject: [PATCH 0971/1833] [swss]: Fix missing comma in the ports.json.j2 file (#1217) Add J2 test case as well as a sample output Signed-off-by: Shu0T1an ChenG --- dockers/docker-orchagent/ports.json.j2 | 2 +- .../tests/sample_output/ports.json | 30 +++++++++++++++++++ .../tests/simple-sample-graph.xml | 1 + src/sonic-config-engine/tests/test_j2files.py | 7 +++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/sonic-config-engine/tests/sample_output/ports.json diff --git a/dockers/docker-orchagent/ports.json.j2 b/dockers/docker-orchagent/ports.json.j2 index 770440036058..e0438998114d 100644 --- a/dockers/docker-orchagent/ports.json.j2 +++ b/dockers/docker-orchagent/ports.json.j2 @@ -4,7 +4,7 @@ {% if PORT[port].has_key('speed') %} { "PORT_TABLE:{{ port }}": { - "speed": "{{ PORT[port]['speed'] }}" + "speed": "{{ PORT[port]['speed'] }}", "description": "{{ PORT[port]['description'] }}" }, "OP": "SET" diff --git a/src/sonic-config-engine/tests/sample_output/ports.json b/src/sonic-config-engine/tests/sample_output/ports.json new file mode 100644 index 000000000000..216627ef34cd --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/ports.json @@ -0,0 +1,30 @@ +[ + { + "PORT_TABLE:Ethernet8": { + "speed": "40000", + "description": "Interface description" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet0": { + "speed": "10000", + "description": "" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet4": { + "speed": "25000", + "description": "" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet12": { + "speed": "1000000", + "description": "Interface description" + }, + "OP": "SET" + }, +] diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index cce833cc950d..d3bc25272282 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -257,6 +257,7 @@ 0 0 1000000 + Interface description true diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index d1cc0d2a3296..ce96ab425c82 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -9,6 +9,7 @@ class TestJ2Files(TestCase): def setUp(self): self.test_dir = os.path.dirname(os.path.realpath(__file__)) self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen') + self.simple_minigraph = os.path.join(self.test_dir, 'simple-sample-graph.xml') self.t0_minigraph = os.path.join(self.test_dir, 't0-sample-graph.xml') self.pc_minigraph = os.path.join(self.test_dir, 'pc-test-graph.xml') self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') @@ -33,6 +34,12 @@ def test_alias_map(self): data = json.loads(output) self.assertEqual(data["Ethernet4"], "fortyGigE0/4") + def test_ports_json(self): + ports_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ports.json.j2') + argument = '-m ' + self.simple_minigraph + ' -p ' + self.t0_port_config + ' -t ' + ports_template + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'ports.json'), self.output_file)) + def test_lldp(self): lldpd_conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-lldp-sv2', 'lldpd.conf.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + lldpd_conf_template + ' > ' + self.output_file From e5898940a55d08d3b5a58c41364f76e12c7a502d Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 8 Dec 2017 09:06:48 -0800 Subject: [PATCH 0972/1833] [config-engine]: Change minigraph.py permission from 0755 to 0644 (#1219) --- src/sonic-config-engine/minigraph.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/sonic-config-engine/minigraph.py diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py old mode 100755 new mode 100644 From 6feff9519774bfa263e6632b5f5e4ce07feedf74 Mon Sep 17 00:00:00 2001 From: Travis Szucs Date: Fri, 8 Dec 2017 12:00:48 -0800 Subject: [PATCH 0973/1833] [device/arista]: Add MAX6697 sensor for Arista 7060CX-32S (#1210) --- .../x86_64-arista_7060_cx32s/sensors.conf | 25 ++++++++++++++----- src/sonic-linux-kernel | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/device/arista/x86_64-arista_7060_cx32s/sensors.conf b/device/arista/x86_64-arista_7060_cx32s/sensors.conf index 20ebbeb5bbc7..b87cb57a9d5d 100644 --- a/device/arista/x86_64-arista_7060_cx32s/sensors.conf +++ b/device/arista/x86_64-arista_7060_cx32s/sensors.conf @@ -11,12 +11,25 @@ bus "i2c-7" "SCD SMBus master 0 bus 5" chip "k10temp-pci-00c3" label temp1 "Cpu temp sensor" -# missing support for -# chip "max6697-i2c-2-1a" -# board sensor 65 75 -# (1) switch chip left sensor 95 105 -# (5) switch chip right sensor 95 105 -# (6) front panel temp sensor 65 75 +chip "max6697-i2c-2-1a" + label temp1 "Board sensor" + set temp1_max 95 + + label temp2 "Switch chip left sensor" + set temp2_max 95 + set temp2_crit 105 + + ignore temp3 + ignore temp4 + ignore temp5 + + label temp6 "Switch chip right sensor" + set temp6_max 95 + set temp6_crit 105 + + label temp7 "Front panel temp sensor" + set temp7_max 65 + set temp7_crit 75 chip "max6658-i2c-3-4c" label temp1 "Cpu board temp sensor" diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index c9832d5e0835..ff5a3b588cc7 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit c9832d5e08351d2f661374f51cf81e60677d2f42 +Subproject commit ff5a3b588cc7dbd763fb13c1125710134c8cdd12 From 5ca798d9bc770ddf9e4ed56b65fa600a04fbb26b Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Fri, 8 Dec 2017 12:01:06 -0800 Subject: [PATCH 0974/1833] [arista]: Unify labels for Arista sensors (#1216) --- .../x86_64-arista_7050_qx32/sensors.conf | 18 ++++++++--------- .../x86_64-arista_7060_cx32s/sensors.conf | 4 ++-- .../x86_64-arista_7260cx3_64/sensors.conf | 20 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/sensors.conf b/device/arista/x86_64-arista_7050_qx32/sensors.conf index dde0d35df8cb..469f63eaf1e4 100644 --- a/device/arista/x86_64-arista_7050_qx32/sensors.conf +++ b/device/arista/x86_64-arista_7050_qx32/sensors.conf @@ -12,38 +12,38 @@ chip "k10temp-pci-00c3" label temp1 "Cpu temp sensor" chip "lm73-i2c-3-48" - label temp1 "Rear Temp Sensor" + label temp1 "Back panel temp sensor" set temp1_max 65 #set temp1_max_alarm 75 # read-only chip "max6658-i2c-2-4c" - label temp1 "Board Temp Sensor" + label temp1 "Board temp sensor" set temp1_max 65 set temp1_crit 75 - label temp2 "Front-panel Temp Sensor" + label temp2 "Front panel temp sensor" set temp2_max 65 set temp2_crit 75 # disabled because of some eeprom corruption risks #chip "pmbus-i2c-3-4e" -# label temp1 "Power Controller Sensor 1" +# label temp1 "Power controller sensor 1" # set temp1_max 60 # set temp1_crit 70 -# label temp2 "Power Controller Sensor 2" +# label temp2 "Power controller sensor 2" # set temp2_max 60 # set temp2_crit 70 # ignore curr1 chip "dps460-i2c-5-58" - label temp1 "Power Supply 1 Sensor 1" + label temp1 "Power supply 1 inlet temp sensor" # maximum and critical thresholds are not supported for this psu set temp1_max 60 set temp1_crit 70 - label temp2 "Power Supply 1 Sensor 2" + label temp2 "Power supply 1 internal sensor" set temp2_max 60 set temp2_crit 70 @@ -60,12 +60,12 @@ chip "dps460-i2c-5-58" set curr2_crit 37 chip "dps460-i2c-6-58" - label temp1 "Power Supply 2 Sensor 1" + label temp1 "Power supply 2 inlet temp sensor" # maximum and critical thresholds are not supported for this psu set temp1_max 60 set temp1_crit 70 - label temp2 "Power Supply 2 Sensor 2" + label temp2 "Power supply 2 internal sensor" set temp2_max 60 set temp2_crit 70 diff --git a/device/arista/x86_64-arista_7060_cx32s/sensors.conf b/device/arista/x86_64-arista_7060_cx32s/sensors.conf index b87cb57a9d5d..21b21fcb5d1c 100644 --- a/device/arista/x86_64-arista_7060_cx32s/sensors.conf +++ b/device/arista/x86_64-arista_7060_cx32s/sensors.conf @@ -51,9 +51,9 @@ chip "pmbus-i2c-7-4e" chip "pmbus-i2c-6-58" label temp1 "Power supply 1 hotspot sensor" label temp2 "Power supply 1 inlet temp sensor" - label temp3 "Power supply 1 sensor" + label temp3 "Power supply 1 exhaust temp sensor" chip "pmbus-i2c-5-58" label temp1 "Power supply 2 hotspot sensor" label temp2 "Power supply 2 inlet temp sensor" - label temp3 "Power supply 2 sensor" + label temp3 "Power supply 2 exhaust temp sensor" diff --git a/device/arista/x86_64-arista_7260cx3_64/sensors.conf b/device/arista/x86_64-arista_7260cx3_64/sensors.conf index e0ad4b434972..1dc02fbaef98 100644 --- a/device/arista/x86_64-arista_7260cx3_64/sensors.conf +++ b/device/arista/x86_64-arista_7260cx3_64/sensors.conf @@ -8,7 +8,7 @@ bus "i2c-73" "SCD 0000:ff:0b.3 SMBus master 0 bus 0" bus "i2c-88" "SCD 0000:ff:0b.3 SMBus master 3 bus 3" chip "max6658-i2c-1-4c" - label temp1 "Temp sensor near TH2" + label temp1 "Asic temp sensor" set temp1_max 65 set temp1_crit 75 @@ -16,9 +16,9 @@ chip "max6658-i2c-1-4c" ignore temp2 chip "pmbus-i2c-3-58" - label temp1 "PSU1 primary hotspot temp" - label temp2 "PSU1 inlet temp" - label temp3 "PSU1 exhaust temp" + label temp1 "Power supply 1 hotspot sensor" + label temp2 "Power supply 1 inlet temp sensor" + label temp3 "Power supply 1 exhaust temp sensor" # setting maximum and critical thresholds is not supported for this psu # fault and warning limits defined internally by hardware @@ -27,9 +27,9 @@ chip "pmbus-i2c-3-58" ignore fan3 chip "pmbus-i2c-4-58" - label temp1 "PSU2 primary hotspot temp" - label temp2 "PSU2 inlet temp" - label temp3 "PSU2 exhaust temp" + label temp1 "Power supply 2 hotspot sensor" + label temp2 "Power supply 2 inlet temp sensor" + label temp3 "Power supply 2 exhaust temp sensor" # setting maximum and critical thresholds is not supported for this psu # fault and warning limits defined internally by hardware @@ -38,8 +38,8 @@ chip "pmbus-i2c-4-58" ignore fan3 chip "max6658-i2c-73-4c" - label temp1 "Rear air temp1" - label temp2 "Rear air temp2" + label temp1 "Back panel temp sensor 1" + label temp2 "Back panel temp sensor 2" set temp1_max 65 set temp1_crit 75 @@ -47,7 +47,7 @@ chip "max6658-i2c-73-4c" set temp2_crit 75 chip "lm73-i2c-88-48" - label temp1 "Front air temp" + label temp1 "Front panel temp sensor" set temp1_max 65 set temp1_crit 75 From 5184def0a40541d9803ccafbf88425d95906b3d7 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 8 Dec 2017 16:31:01 -0800 Subject: [PATCH 0975/1833] [dell]: Added psuutil support for S6100/Z9100 Dell Platforms (#1223) --- .../plugins/psuutil.py | 80 +++++++++++++++++++ .../plugins/psuutil.py | 80 +++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py new file mode 100644 index 000000000000..5ae96a841908 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py @@ -0,0 +1,80 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError, e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + # Get a mailbox register + def get_pmc_register(self, reg_name): + mailbox_dir = "/sys/devices/platform/dell_s6100_lpc" + retval = 'ERR' + mb_reg_file = mailbox_dir+'/' + reg_name + if (not os.path.isfile(mb_reg_file)): + print mb_reg_file, 'not found !' + return retval + + try: + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", mb_reg_file, "file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + S6100_MAX_PSUS = 2 + return S6100_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + psu_status = self.get_pmc_register('psu_'+str(index)+'_status') + if (psu_status != 'ERR'): + psu_status = int(psu_status, 16) + # Check for PSU statuse + if (~psu_status & 0b1000) or (psu_status & 0b0100): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') + if (psu_presence != 'ERR'): + psu_presence = int(psu_presence, 16) + # Check for PSU presence + if (~psu_presence & 0b1): + status = 1 + + return status diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py new file mode 100644 index 000000000000..d3d4f9d2b34c --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py @@ -0,0 +1,80 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError, e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + # Get a mailbox register + def get_pmc_register(self, reg_name): + mailbox_dir = "/sys/devices/platform/dell_mailbox" + retval = 'ERR' + mb_reg_file = mailbox_dir+'/' + reg_name + if (not os.path.isfile(mb_reg_file)): + print mb_reg_file, 'not found !' + return retval + + try: + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", mb_reg_file, "file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + Z9100_MAX_PSUS = 2 + return Z9100_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + psu_status = self.get_pmc_register('psu_'+str(index)+'_status') + if (psu_status != 'ERR'): + psu_status = int(psu_status, 16) + # Check for PSU statuse + if (~psu_status & 0b1000) or (psu_status & 0b0100): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') + if (psu_presence != 'ERR'): + psu_presence = int(psu_presence, 16) + # Check for PSU presence + if (~psu_presence & 0b1): + status = 1 + + return status From 9dc85620f37e6c187fd042bd488dde006d6404fe Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 8 Dec 2017 16:32:50 -0800 Subject: [PATCH 0976/1833] [device/arista] Add psuutil plugin for Arista platforms (#1221) * Bump sonic-platform-modules-arista submodule * Add psuutil plugnis for Arista platforms --- .../x86_64-arista_7050_qx32/plugins/psuutil.py | 12 ++++++++++++ .../x86_64-arista_7050_qx32s/plugins/psuutil.py | 12 ++++++++++++ .../x86_64-arista_7060_cx32s/plugins/psuutil.py | 12 ++++++++++++ .../x86_64-arista_7260cx3_64/plugins/psuutil.py | 12 ++++++++++++ platform/broadcom/sonic-platform-modules-arista | 2 +- 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 device/arista/x86_64-arista_7050_qx32/plugins/psuutil.py create mode 100644 device/arista/x86_64-arista_7050_qx32s/plugins/psuutil.py create mode 100644 device/arista/x86_64-arista_7060_cx32s/plugins/psuutil.py create mode 100644 device/arista/x86_64-arista_7260cx3_64/plugins/psuutil.py diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/psuutil.py b/device/arista/x86_64-arista_7050_qx32/plugins/psuutil.py new file mode 100644 index 000000000000..1a8682ae3c67 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/plugins/psuutil.py @@ -0,0 +1,12 @@ +# psuutil.py +# +# Platform-specific PSU interface for SONiC +# + +try: + import arista.utils.sonic_psu as arista_psuutil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +PsuUtil = arista_psuutil.getPsuUtil() diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/psuutil.py b/device/arista/x86_64-arista_7050_qx32s/plugins/psuutil.py new file mode 100644 index 000000000000..1a8682ae3c67 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/psuutil.py @@ -0,0 +1,12 @@ +# psuutil.py +# +# Platform-specific PSU interface for SONiC +# + +try: + import arista.utils.sonic_psu as arista_psuutil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +PsuUtil = arista_psuutil.getPsuUtil() diff --git a/device/arista/x86_64-arista_7060_cx32s/plugins/psuutil.py b/device/arista/x86_64-arista_7060_cx32s/plugins/psuutil.py new file mode 100644 index 000000000000..1a8682ae3c67 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/plugins/psuutil.py @@ -0,0 +1,12 @@ +# psuutil.py +# +# Platform-specific PSU interface for SONiC +# + +try: + import arista.utils.sonic_psu as arista_psuutil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +PsuUtil = arista_psuutil.getPsuUtil() diff --git a/device/arista/x86_64-arista_7260cx3_64/plugins/psuutil.py b/device/arista/x86_64-arista_7260cx3_64/plugins/psuutil.py new file mode 100644 index 000000000000..1a8682ae3c67 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/plugins/psuutil.py @@ -0,0 +1,12 @@ +# psuutil.py +# +# Platform-specific PSU interface for SONiC +# + +try: + import arista.utils.sonic_psu as arista_psuutil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +PsuUtil = arista_psuutil.getPsuUtil() diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index f985b188326e..8b8411551faa 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit f985b188326e480124ec49541b4fecc51a213889 +Subproject commit 8b8411551faab9e44aa1f66dae507e3d92ecf468 From b9a0ef883c70c2b3363795b097324a7cab1a6a42 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 8 Dec 2017 17:28:01 -0800 Subject: [PATCH 0977/1833] [utilities]: Update sonic-utilities and sonic-py-swsssdk submodule (#1220) [py-swsssdk]: Adapt to py-swsssdk refactor of mod_entry and mod_config (#165) [intfutil]: Fix python indentation (#166) Change set_config to mod_config Signed-off-by: Shu0T1an ChenG --- src/sonic-config-engine/sonic-cfggen | 2 +- src/sonic-py-swsssdk | 2 +- src/sonic-utilities | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index bb778ddefbf0..a5727d38b96f 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -210,7 +210,7 @@ def main(): if args.write_to_db: configdb = ConfigDBConnector(**db_kwargs) configdb.connect(False) - configdb.set_config(FormatConverter.output_to_db(data)) + configdb.mod_config(FormatConverter.output_to_db(data)) if args.print_data: print json.dumps(FormatConverter.to_serialized(data), indent=4, cls=minigraph_encoder) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 674fb107dfb8..1c7a6b449644 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 674fb107dfb8e45b23a55e3e7be34e39d5630942 +Subproject commit 1c7a6b4496440a8a9e7e2ab314564ce8e26aa378 diff --git a/src/sonic-utilities b/src/sonic-utilities index cc147b9d0f0a..cb8538962815 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit cc147b9d0f0a2edd1e89019052755a92840dd5f9 +Subproject commit cb8538962815ea82665a4d4b851d50ea0793811d From aa77f63378952c037a423584efdfd07eb972c2d9 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 9 Dec 2017 02:23:30 -0800 Subject: [PATCH 0978/1833] [submodules]: update sonic-swss and sonic-swss-common (#1215) --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 226f96c94e76..ff9042962145 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 226f96c94e76713f48ebdb114759584f0e1357e6 +Subproject commit ff904296214509d628ea868570f0b903ace8b146 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 82ceea09b623..283162b62d1d 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 82ceea09b62374cd3110c00b19536ed4d10f3d57 +Subproject commit 283162b62d1dda594a5962e9ad8b4f9b65bf65c3 From 389c3e1fd22f6bc6ea2a8518b9520a90a9e57ac6 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Mon, 11 Dec 2017 19:50:16 +0200 Subject: [PATCH 0979/1833] [mellanox]: Update MLNX SAI pointer (#1226) Signed-off-by: Andriy Moroz --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 80b6d893da38..1a73cb80a660 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.9.2-master -MLNX_SAI_REVISION = 16900748ee3c97bc5836ab3684ee05b8db6ec31b +MLNX_SAI_REVISION = d098a2c89cd700d9c1278e448fd6bb047cbd59e2 export MLNX_SAI_VERSION MLNX_SAI_REVISION From 60e0295b74ea878d27480dd336beff6a012bd50d Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 11 Dec 2017 18:19:21 -0800 Subject: [PATCH 0980/1833] [Dell]: Change Dell psuutil.py file to work with Python 3.* (#1231) * change except comma to as * remove print line * change CRLF to LF Signed-off-by: Shu0T1an ChenG --- .../plugins/psuutil.py | 159 +++++++++--------- .../plugins/psuutil.py | 3 +- 2 files changed, 80 insertions(+), 82 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py index 5ae96a841908..83452f69aaa4 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py @@ -1,80 +1,79 @@ -# -# psuutil.py -# Platform-specific PSU status interface for SONiC -# - - -import os.path - -try: - from sonic_psu.psu_base import PsuBase -except ImportError, e: - raise ImportError(str(e) + "- required module not found") - - -class PsuUtil(PsuBase): - """Platform-specific PSUutil class""" - - def __init__(self): - PsuBase.__init__(self) - - # Get a mailbox register - def get_pmc_register(self, reg_name): - mailbox_dir = "/sys/devices/platform/dell_s6100_lpc" - retval = 'ERR' - mb_reg_file = mailbox_dir+'/' + reg_name - if (not os.path.isfile(mb_reg_file)): - print mb_reg_file, 'not found !' - return retval - - try: - with open(mb_reg_file, 'r') as fd: - retval = fd.read() - except Exception as error: - logging.error("Unable to open ", mb_reg_file, "file !") - - retval = retval.rstrip('\r\n') - return retval - - def get_num_psus(self): - """ - Retrieves the number of PSUs available on the device - :return: An integer, the number of PSUs available on the device - """ - S6100_MAX_PSUS = 2 - return S6100_MAX_PSUS - - def get_psu_status(self, index): - """ - Retrieves the oprational status of power supply unit (PSU) defined - by index - :param index: An integer, index of the PSU of which to query status - :return: Boolean, True if PSU is operating properly, False if PSU is\ - faulty - """ - status = 0 - psu_status = self.get_pmc_register('psu_'+str(index)+'_status') - if (psu_status != 'ERR'): - psu_status = int(psu_status, 16) - # Check for PSU statuse - if (~psu_status & 0b1000) or (psu_status & 0b0100): - status = 1 - - return status - - def get_psu_presence(self, index): - """ - Retrieves the presence status of power supply unit (PSU) defined - by index - :param index: An integer, index of the PSU of which to query status - :return: Boolean, True if PSU is plugged, False if not - """ - status = 0 - psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') - if (psu_presence != 'ERR'): - psu_presence = int(psu_presence, 16) - # Check for PSU presence - if (~psu_presence & 0b1): - status = 1 - - return status +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + # Get a mailbox register + def get_pmc_register(self, reg_name): + mailbox_dir = "/sys/devices/platform/dell_s6100_lpc" + retval = 'ERR' + mb_reg_file = mailbox_dir+'/' + reg_name + if (not os.path.isfile(mb_reg_file)): + return retval + + try: + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", mb_reg_file, "file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + S6100_MAX_PSUS = 2 + return S6100_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + psu_status = self.get_pmc_register('psu_'+str(index)+'_status') + if (psu_status != 'ERR'): + psu_status = int(psu_status, 16) + # Check for PSU statuse + if (~psu_status & 0b1000) or (psu_status & 0b0100): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') + if (psu_presence != 'ERR'): + psu_presence = int(psu_presence, 16) + # Check for PSU presence + if (~psu_presence & 0b1): + status = 1 + + return status diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py index d3d4f9d2b34c..2ad6ae7d1491 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py @@ -8,7 +8,7 @@ try: from sonic_psu.psu_base import PsuBase -except ImportError, e: +except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -24,7 +24,6 @@ def get_pmc_register(self, reg_name): retval = 'ERR' mb_reg_file = mailbox_dir+'/' + reg_name if (not os.path.isfile(mb_reg_file)): - print mb_reg_file, 'not found !' return retval try: From 69d6ad56c674d21cd0e005e2e10a7e56d3d123f9 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 12 Dec 2017 00:16:25 -0800 Subject: [PATCH 0981/1833] [snmpagent]: Update sonic-snmpagent submodule (#1232) Signed-off-by: Shu0T1an ChenG --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 39f1e23cb834..5580935de8f8 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 39f1e23cb834255955f5270234c8a72b14c11d6f +Subproject commit 5580935de8f82caae071ef62cf9dc647b8f78ca0 From e0af519da2e9cca67d7fc040850e17934c8c6c57 Mon Sep 17 00:00:00 2001 From: YonatanPitz Date: Tue, 12 Dec 2017 10:38:36 +0200 Subject: [PATCH 0982/1833] [p4]: Updated p4 bm (#1228) * merged new p4 platform from 1.0.3 * reverted SAI-P4-BM to SAI1.0 * changed port_config.ini from alias to name. changed tenjin makefile to https * updated SAI-P4-BM commit * [platform/p4]: Updated P4 docker to be up to date with vs. * Merged swss, swss-common and sai-redis with master, now supports new ConfigDB. * Changed startup script to work with supervisor for managing processes. Signed-off-by: Yonatan Piasetzky yonatanp@mellanox.com * Updated SAI-BM submodule to sai v1.0.4 tag. now supports hostif vlan tag for port netdev * Updated SAI-P4-BM submodule. --- platform/p4/SAI-P4-BM | 2 +- platform/p4/docker-sonic-p4.mk | 17 ++- platform/p4/docker-sonic-p4/Dockerfile.j2 | 64 ++++++-- platform/p4/docker-sonic-p4/config_bm.sh | 4 + platform/p4/docker-sonic-p4/orchagent.sh | 15 ++ platform/p4/docker-sonic-p4/rsyslog.conf | 4 +- platform/p4/docker-sonic-p4/run_bm.sh | 23 --- platform/p4/docker-sonic-p4/sonic-dev.gpg.key | 30 ++++ platform/p4/docker-sonic-p4/start.sh | 97 ++++++++++++ platform/p4/docker-sonic-p4/startup.sh | 43 ------ platform/p4/docker-sonic-p4/supervisord.conf | 141 ++++++++++++++++++ 11 files changed, 358 insertions(+), 82 deletions(-) create mode 100755 platform/p4/docker-sonic-p4/config_bm.sh create mode 100755 platform/p4/docker-sonic-p4/orchagent.sh delete mode 100755 platform/p4/docker-sonic-p4/run_bm.sh create mode 100644 platform/p4/docker-sonic-p4/sonic-dev.gpg.key create mode 100755 platform/p4/docker-sonic-p4/start.sh delete mode 100755 platform/p4/docker-sonic-p4/startup.sh create mode 100644 platform/p4/docker-sonic-p4/supervisord.conf diff --git a/platform/p4/SAI-P4-BM b/platform/p4/SAI-P4-BM index c25b5aecabbb..c763924affd4 160000 --- a/platform/p4/SAI-P4-BM +++ b/platform/p4/SAI-P4-BM @@ -1 +1 @@ -Subproject commit c25b5aecabbb09270dc805459434ee396792ccb3 +Subproject commit c763924affd416df9c4d3e40d4f8ac1cb2be5fff diff --git a/platform/p4/docker-sonic-p4.mk b/platform/p4/docker-sonic-p4.mk index b5a63773fbbe..ebe7ceb080a2 100644 --- a/platform/p4/docker-sonic-p4.mk +++ b/platform/p4/docker-sonic-p4.mk @@ -2,7 +2,17 @@ DOCKER_SONIC_P4 = docker-sonic-p4.gz $(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4 -$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) $(SYNCD) $(P4_SWITCH) $(REDIS_SERVER) $(REDIS_TOOLS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) +$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) \ + $(SYNCD) \ + $(P4_SWITCH) \ + $(REDIS_SERVER) \ + $(REDIS_TOOLS) \ + $(PYTHON_SWSSCOMMON) \ + $(LIBTEAMDCT) \ + $(LIBTEAM_UTILS) \ + $(SONIC_DEVICE_DATA) \ + $(SONIC_UTILS) \ + $(IPROUTE2) # ifeq ($(ROUTING_STACK), quagga) $(DOCKER_SONIC_P4)_DEPENDS += $(QUAGGA) @@ -12,5 +22,8 @@ $(DOCKER_SONIC_P4)_DEPENDS += $(QUAGGA) # $(DOCKER_SONIC_P4)_DEPENDS += $(GOBGP) # endif -$(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_BASE) +$(DOCKER_SONIC_P4)_FILES += $(CONFIGDB_LOAD_SCRIPT) \ + $(ARP_UPDATE_SCRIPT) + +$(DOCKER_SONIC_P4)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_P4) diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index debb89de9c14..95ac5cc1646d 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -1,11 +1,47 @@ -FROM docker-base +FROM docker-config-engine ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +COPY ["sonic-dev.gpg.key", "/etc/apt/"] +RUN apt-key add /etc/apt/sonic-dev.gpg.key +RUN echo "deb http://packages.microsoft.com/repos/sonic-dev/ jessie main" >> /etc/apt/sources.list RUN apt-get update -RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1 openssh-client openssh-server libc-ares2 iproute +RUN apt-get install -y net-tools \ + arping \ + ethtool \ + tcpdump \ + ifupdown \ + bridge-utils \ + python-ply \ + libqt5core5a \ + libqt5network5 \ + libboost-program-options1.55.0 \ + libboost-system1.55.0 \ + libboost-thread1.55.0 \ + libgmp10 \ + libjudydebian1 \ + libnanomsg0 \ + libdaemon0 \ + libjansson4 \ + libjemalloc1 \ + openssh-client \ + openssh-server \ + libc-ares2 \ + iproute \ + libpython2.7 \ + grub2-common \ + python-click-default-group \ + python-click \ + python-natsort \ + python-tabulate \ + bash-completion \ + libelf1 \ + libmnl0 + +RUN pip install setuptools +RUN pip install py2_ipaddress COPY \ {% for deb in docker_sonic_p4_debs.split(' ') -%} @@ -18,20 +54,26 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -ADD port_config.ini /port_config.ini -ADD startup.sh /scripts/startup.sh -ADD run_bm.sh /scripts/run_bm.sh - -ADD rsyslog.conf /etc/rsyslog.conf - ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -RUN sed -ri 's/^daemonize yes$/daemonize no/; \ +RUN sed -ri 's/^(save .*$)/# \1/g; \ + s/^daemonize yes$/daemonize no/; \ s/^logfile .*$/logfile ""/; \ s/^# syslog-enabled no$/syslog-enabled no/; \ - s/^# unixsocket/unixsocket/ \ + s/^# unixsocket/unixsocket/; \ + s/notify-keyspace-events ""/notify-keyspace-events AKE/; \ + s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ ' /etc/redis/redis.conf -ENTRYPOINT /bin/bash +ADD port_config.ini /port_config.ini +ADD rsyslog.conf /etc/rsyslog.conf +COPY ["start.sh", "orchagent.sh", "config_bm.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["files/configdb-load.sh", "/usr/bin/"] +COPY ["files/arp_update", "/usr/bin"] +RUN echo "docker-sonic-p4" > /etc/hostname +RUN touch /etc/quagga/zebra.conf + +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/platform/p4/docker-sonic-p4/config_bm.sh b/platform/p4/docker-sonic-p4/config_bm.sh new file mode 100755 index 000000000000..25de26b4da74 --- /dev/null +++ b/platform/p4/docker-sonic-p4/config_bm.sh @@ -0,0 +1,4 @@ +simple_switch_CLI --pre SimplePreLAG < /usr/share/p4-sai-bm/bridge_default_config.txt +simple_switch_CLI < /usr/share/p4-sai-bm/bridge_default_config_mirror.txt +simple_switch_CLI --pre SimplePreLAG --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config.txt +simple_switch_CLI --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config_mirror.txt \ No newline at end of file diff --git a/platform/p4/docker-sonic-p4/orchagent.sh b/platform/p4/docker-sonic-p4/orchagent.sh new file mode 100755 index 000000000000..7e250dfa20e9 --- /dev/null +++ b/platform/p4/docker-sonic-p4/orchagent.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` + +# Create a folder for SsWW record files +mkdir -p /var/log/swss +ORCHAGENT_ARGS="-d /var/log/swss " + +# Set orchagent pop batch size to 8192 +ORCHAGENT_ARGS+="-b 8192 " + +# Set mac address +ORCHAGENT_ARGS+="-m $MAC_ADDRESS" + +exec /usr/bin/orchagent ${ORCHAGENT_ARGS} diff --git a/platform/p4/docker-sonic-p4/rsyslog.conf b/platform/p4/docker-sonic-p4/rsyslog.conf index 9afd889f500b..79926a8b30c7 100644 --- a/platform/p4/docker-sonic-p4/rsyslog.conf +++ b/platform/p4/docker-sonic-p4/rsyslog.conf @@ -30,9 +30,9 @@ $ModLoad imuxsock # provides support for local system logging #### GLOBAL DIRECTIVES #### ########################### #Set remote syslog server -*.* @172.17.0.1:514 +#*.* @172.17.0.1:514 #Set local syslog -#*.* /var/log/messages +*.* /var/log/messages # # Use traditional timestamp format. diff --git a/platform/p4/docker-sonic-p4/run_bm.sh b/platform/p4/docker-sonic-p4/run_bm.sh deleted file mode 100755 index 66cea4f5d5cf..000000000000 --- a/platform/p4/docker-sonic-p4/run_bm.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# handler() -# { - # kill -s INT $ROUTER_PID - # kill -s INT $BRIDGE_PID -# } - -set -m -ip netns exec sw_net simple_switch -i 0@router_port1 -i 250@router_cpu_port --thrift-port 9091 --log-file /tmp/router_log --log-flush --notifications-addr ipc:///tmp/bmv2-router-notifications.ipc /usr/share/p4-sai-bm/sai_router.json & -export ROUTER_PID=$! -ip netns exec sw_net simple_switch -i 0@sw_port0 -i 1@sw_port1 -i 2@sw_port2 -i 3@sw_port3 -i 4@sw_port4 -i 5@sw_port5 -i 6@sw_port6 -i 7@sw_port7 -i 7@sw_port7 -i 8@sw_port8 -i 9@sw_port9 -i 10@sw_port10 -i 11@sw_port11 -i 12@sw_port12 -i 13@sw_port13 -i 14@sw_port14 -i 15@sw_port15 -i 16@sw_port16 -i 17@sw_port17 -i 18@sw_port18 -i 19@sw_port19 -i 20@sw_port20 -i 21@sw_port21 -i 22@sw_port22 -i 23@sw_port23 -i 24@sw_port24 -i 25@sw_port25 -i 26@sw_port26 -i 27@sw_port27 -i 28@sw_port28 -i 29@sw_port29 -i 30@sw_port30 -i 31@sw_port31 -i 250@cpu_port -i 251@router_port0 --log-file /tmp/bridge_log --log-flush /usr/share/p4-sai-bm/sai_bridge.json & -export BRIDGE_PID=$! -sleep 10 -simple_switch_CLI --pre SimplePreLAG < /usr/share/p4-sai-bm/bridge_default_config.txt -simple_switch_CLI < /usr/share/p4-sai-bm/bridge_default_config_mirror.txt -simple_switch_CLI --pre SimplePreLAG --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config.txt -simple_switch_CLI --thrift-port 9091 < /usr/share/p4-sai-bm/router_default_config_mirror.txt - -# echo "router and bridge are running send SIGINT to close" - -# trap handler INT -# sleep inf -# sudo kill -s SIGINT 3319 diff --git a/platform/p4/docker-sonic-p4/sonic-dev.gpg.key b/platform/p4/docker-sonic-p4/sonic-dev.gpg.key new file mode 100644 index 000000000000..fb9a37901bc7 --- /dev/null +++ b/platform/p4/docker-sonic-p4/sonic-dev.gpg.key @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQENBFQ1bTIBCAC7oGfkv/ck0XsLuG8cdcSB2ISqxFAcBvH9BitEtxmpW2uhykKk +xY4rVD/4Uys1s3PF1/64QfPR+hYcewueOwz0ZAcLyFXXk4McICXaPq3NrLiWYKKX +UZLnrPzcrGZoW/kHDDp4OmBiDmT1PGvZlpuimwkMCusUzIr7Cbbp2dIy8MERL5tA +LcgLu3KL6clJ+aTW2jgepI1D7sTepOeGd7eRSb5njKg2M7k/93v/7MipZxiVtyXH +B74YiK6jSbst5JpuYsLa/Dqryvx7Xq3n53oif892pv3euTduo1fYw8Hgh/OOYdeT +c9WCj03KA1jCSFURjdrug0kR8BPlfjqtRLXFABEBAAG0JE1TIE9wZW4gVGVjaCA8 +aW50ZXJvcEBtaWNyb3NvZnQuY29tPokBOAQTAQIAIgUCVDVtMgIbAwYLCQgHAwIG +FQgCCQoLBBYCAwECHgECF4AACgkQsCxG30F6CJO1uAf/cmL68bM8YgF/61hkaY56 +LqrppUTJH/w4fKq47Pf6KfgSLvxfNU6soi2KHYRjIvTRx3tV4vUM5n2plaQg2s8V +/Epg4FeIRTk75YwiHAzLhLnp5cdUaTvC4j4mwxoB6j9Ty+fXJwQ0MvpDhIZb9vM4 +GXw/fEQHCT4f3gx4nReeqE+FB2wVHleX9+Lpodu98JyJTKJRBRHYLqy6S+/lyp2W +aBlsI1LOqBcx1uRK24U7duIpbYwIyrx0cafSruqR2GjVdu+imkhHyUn52VbzYhq1 +af0rqYiZ1VOamVOG0By8+hVyNa1MLc1K2uWGs0o5fDe9F5/swbvLHVXI+M50Vs+m +J7kBDQRUNW0yAQgAu7DkTVj0ZQC4F7bFivAwrdby8gCakTXOl1kcK622hjRJ8nam +aZeW+eADfLRsTmdUmXgZu1YWS5Gn2ZVngC8SGPUBT071+oRETCz4uNB7IimB9QfP +++orI6o2vmnVVsq5wWCbEdNU+TCVv1zjrYev5lwckkKpjHt6o8MNoX2DFuQymSyR +eZKaqhdKmcji4Ke7OIYqwgPjch3wxzE1b5gNOR/iwxWyjjOffZPLr/VhIfIJRs86 +dSXrwjHtEh810SKDLghHM0VAdY34nyC5ZZ61yhts5HtQDFK+9mNpH1mkc4gDBlgG +266pVvknumK6lPNm/osF/cpjWmEw24ypcQIvOQARAQABiQEfBBgBAgAJBQJUNW0y +AhsMAAoJELAsRt9BegiTMBUH/0sZ6gZy7mCTSAYT+NSXLFtGC2zNUVL80SWvfgYm +k9XPVI22MrefZfQ6M01RylyxtWXjRM8UoN8SDKWPpXumzJf831f/7om5zwutaG7b +tjDPYqRKJSbAIFZu2mN+uLrNQ2SV6XK7FoV0dtcrEX9S7RICb6i19D+70+Oh/qgU +R04H1jqS29XBzqAlIzdBoA+sYAwbOIJsSL3YyNQcUv3B5+5yR/bo/L8pnUJt6iuL +nWW+mi7r8gWPHDSrcdYq1TmmlOM7CwZPgWRZzkQPSeZz52Tt7IP47eyGJ09U4PIf +FtMH1ElL2UgHoA/F9Q88e7LkztaTqE59uXWbIYyuSMJVvRU= +=sb3d +-----END PGP PUBLIC KEY BLOCK----- diff --git a/platform/p4/docker-sonic-p4/start.sh b/platform/p4/docker-sonic-p4/start.sh new file mode 100755 index 000000000000..ae7bf4e5cf6f --- /dev/null +++ b/platform/p4/docker-sonic-p4/start.sh @@ -0,0 +1,97 @@ +#!/bin/bash -e + +# generate configuration +[ -d /etc/sonic ] || mkdir -p /etc/sonic + +if ! ip link show eth0 &> /dev/null; then + ip link add eth0 type dummy +fi + +SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') +sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json + +if [ -f /etc/sonic/config_db.json ]; then + sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json +else + sonic-cfggen -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json +fi + +mkdir -p /etc/swss/config.d/ + +# sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json +# sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json +# sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json + +# export platform=`sonic-cfggen -v platform` + +rm -f /var/run/rsyslogd.pid + +echo "Start rsyslogd" +supervisorctl start rsyslogd + +mkdir -p /var/run/redis + +echo "Start redis" +supervisorctl start redis-server + +echo "Veth Setup" +veth_setup.sh > /tmp/veth_setup.log + +echo "Start BM" +rm -rf bm_logs/bridge_log.* +rm -rf bm_logs/router_log.* +rm -rf log.txt +mkdir -p bm_logs +supervisorctl start bm_bridge +supervisorctl start bm_router + +sleep 10 +echo "BM Default config" +config_bm.sh > /tmp/config_bm.log + +/usr/bin/configdb-load.sh + +echo "Start syncd" +supervisorctl start syncd + +echo "Start orchagent" +supervisorctl start orchagent + +echo "Start portsyncd" +supervisorctl start portsyncd + +echo "Start intfsyncd" +supervisorctl start intfsyncd + +echo "Start neighsyncd" +supervisorctl start neighsyncd + +echo "Start teamsyncd" +supervisorctl start teamsyncd + +echo "Start fpmsyncd" +supervisorctl start fpmsyncd + +echo "Start intfmgrd" +supervisorctl start intfmgrd + +echo "Start vlanmgrd" +supervisorctl start vlanmgrd + +echo "Start zebra" +supervisorctl start zebra + +echo "Start bgpd" +supervisorctl start bgpd + +if [ -f /etc/swss/config.d/default_config.json ]; then + swssconfig /etc/swss/config.d/default_config.json +fi + +# Start arp_update when VLAN exists +VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` +if [ "$VLAN" != "" ]; then + echo "Start arp_update" + supervisorctl start arp_update +fi \ No newline at end of file diff --git a/platform/p4/docker-sonic-p4/startup.sh b/platform/p4/docker-sonic-p4/startup.sh deleted file mode 100755 index 5880d431674c..000000000000 --- a/platform/p4/docker-sonic-p4/startup.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -echo "Set onie_platform to x86_64-barefoot_p4-r0" -export onie_platform=x86_64-barefoot_p4-r0 - -echo "Start rsyslog" -rm -f /var/run/rsyslogd.pid -service rsyslog start - -echo "Start redis server" -service redis-server start & -sleep 3 - -redis-cli flushall - -echo "Veth setup" -veth_setup.sh > /tmp/veth_setup.log 2>&1 - -echo "Start BMV2" -/scripts/run_bm.sh > /tmp/run_bm.log 2>&1 & -sleep 15 - -redis-cli -n 1 set LOGLEVEL DEBUG - -echo "Start Syncd" -syncd -N > /tmp/syncd.log 2>&1 & -sleep 10 - -echo "Start Orchagent" -orchagent $* > /tmp/orchagent.log 2>&1 & -sleep 10 - -echo "Start Portsyncd" -portsyncd -p /port_config.ini > /tmp/portsyncd.log 2>&1 & - -echo "Start Intfsync" -intfsyncd > /tmp/intfsyncd.log 2>&1 & - -echo "Start Neighsyncd" -neighsyncd > /tmp/neighsyncd.log 2>&1 & - -echo "Start Fpmsyncd" -fpmsyncd > /tmp/fpmsyncd.log 2>&1 & diff --git a/platform/p4/docker-sonic-p4/supervisord.conf b/platform/p4/docker-sonic-p4/supervisord.conf new file mode 100644 index 000000000000..f4b80ceb4eb7 --- /dev/null +++ b/platform/p4/docker-sonic-p4/supervisord.conf @@ -0,0 +1,141 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=false + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:bm_router] +command=ip netns exec sw_net simple_switch -i 0@router_port1 -i 250@router_cpu_port --thrift-port 9091 --log-file bm_logs/router_log --log-flush --notifications-addr ipc:///tmp/bmv2-router-notifications.ipc /usr/share/p4-sai-bm/sai_router.json +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:bm_bridge] +command=ip netns exec sw_net simple_switch -i 0@sw_port0 -i 1@sw_port1 -i 2@sw_port2 -i 3@sw_port3 -i 4@sw_port4 -i 5@sw_port5 -i 6@sw_port6 -i 7@sw_port7 -i 7@sw_port7 -i 8@sw_port8 -i 9@sw_port9 -i 10@sw_port10 -i 11@sw_port11 -i 12@sw_port12 -i 13@sw_port13 -i 14@sw_port14 -i 15@sw_port15 -i 16@sw_port16 -i 17@sw_port17 -i 18@sw_port18 -i 19@sw_port19 -i 20@sw_port20 -i 21@sw_port21 -i 22@sw_port22 -i 23@sw_port23 -i 24@sw_port24 -i 25@sw_port25 -i 26@sw_port26 -i 27@sw_port27 -i 28@sw_port28 -i 29@sw_port29 -i 30@sw_port30 -i 31@sw_port31 -i 250@cpu_port -i 251@router_port0 --log-file bm_logs/bridge_log --log-flush /usr/share/p4-sai-bm/sai_bridge.json & +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:redis-server] +command=/usr/bin/redis-server /etc/redis/redis.conf +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd -uN +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:orchagent] +command=/usr/bin/orchagent.sh +priority=5 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:portsyncd] +command=/usr/bin/portsyncd -p /port_config.ini +priority=6 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:intfsyncd] +command=/usr/bin/intfsyncd +priority=7 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:neighsyncd] +command=/usr/bin/neighsyncd +priority=8 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:teamsyncd] +command=/usr/bin/teamsyncd +priority=9 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:vlanmgrd] +command=/usr/bin/vlanmgrd +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:intfmgrd] +command=/usr/bin/intfmgrd +priority=11 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:zebra] +command=/usr/lib/quagga/zebra -A 127.0.0.1 +priority=12 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:bgpd] +command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F +priority=13 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:fpmsyncd] +command=/usr/bin/fpmsyncd +priority=14 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:arp_update] +command=bash -c "/usr/bin/arp_update; sleep 300" +priority=15 +autostart=false +autorestart=true +stdout_logfile=syslog +stderr_logfile=syslog \ No newline at end of file From dce6d3536bfda3c5377ef0fdbdc1592e30c7982f Mon Sep 17 00:00:00 2001 From: Liuqu Date: Tue, 12 Dec 2017 19:45:44 +0800 Subject: [PATCH 0983/1833] [TACACS+]: Add configDB enforcer for TACACS+ (#1214) * [TACACS+]: Add configDB enforcer for TACACS+ * hostcfgd - configDB enforcer for TACACS+, listen configDB to modify the pam configuration for Authentication in host * Add a service script for hostcfgd Signed-off-by: Chenchen Qi * [TACACS+]: Generate conf file by template file * Generate common-auth-sonic and tacplus_nss.conf by jinja2 template Signed-off-by: Chenchen Qi --- .../build_templates/sonic_debian_extension.j2 | 6 + .../hostcfgd/common-auth-sonic.j2 | 43 +++++ files/image_config/hostcfgd/hostcfgd | 172 ++++++++++++++++++ files/image_config/hostcfgd/hostcfgd.service | 11 ++ .../image_config/hostcfgd/tacplus_nss.conf.j2 | 25 +++ 5 files changed, 257 insertions(+) create mode 100644 files/image_config/hostcfgd/common-auth-sonic.j2 create mode 100755 files/image_config/hostcfgd/hostcfgd create mode 100644 files/image_config/hostcfgd/hostcfgd.service create mode 100644 files/image_config/hostcfgd/tacplus_nss.conf.j2 diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index fd67444fb475..7de8f8597917 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -128,6 +128,12 @@ sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/usr/share/sonic/template # Copy initial interfaces configuration file, will be overwritten on first boot sudo cp $IMAGE_CONFIGS/interfaces/init_interfaces $FILESYSTEM_ROOT/etc/network +# Copy hostcfgd files +sudo cp $IMAGE_CONFIGS/hostcfgd/hostcfgd.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostcfgd.service +sudo cp $IMAGE_CONFIGS/hostcfgd/hostcfgd $FILESYSTEM_ROOT/usr/bin/ +sudo cp $IMAGE_CONFIGS/hostcfgd/*.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/ + # Copy hostname configuration scripts sudo cp $IMAGE_CONFIGS/hostname/hostname-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostname-config.service diff --git a/files/image_config/hostcfgd/common-auth-sonic.j2 b/files/image_config/hostcfgd/common-auth-sonic.j2 new file mode 100644 index 000000000000..d91a02120f82 --- /dev/null +++ b/files/image_config/hostcfgd/common-auth-sonic.j2 @@ -0,0 +1,43 @@ +# THIS IS AN AUTO-GENERATED FILE +# +# /etc/pam.d/common-auth- authentication settings common to all services +# This file is included from other service-specific PAM config files, +# and should contain a list of the authentication modules that define +# the central authentication scheme for use on the system +# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the +# traditional Unix authentication mechanisms. +# +# here are the per-package modules (the "Primary" block) + +{% if auth['login'] == 'local' %} +auth [success=1 default=ignore] pam_unix.so nullok try_first_pass + +{% elif auth['login'] == 'local,tacacs+' %} +auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_unix.so nullok try_first_pass +{% for server in servers | sub(0, -1) %} +auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_tacplus.so server={{ server.ip }}:{{ server.tcp_port }} secret={{ server.passkey }} login={{ server.auth_type }} timeout={{ server.timeout }} try_first_pass +{% endfor %} +{% if servers | count %} +{% set last_server = servers | last %} +auth [success=1 default=ignore] pam_tacplus.so server={{ last_server.ip }}:{{ last_server.tcp_port }} secret={{ last_server.passkey }} login={{ last_server.auth_type }} timeout={{ last_server.timeout }} try_first_pass + +{% endif %} +{% elif auth['login'] == 'tacacs+' or auth['login'] == 'tacacs+,local' %} +{% for server in servers %} +auth [success=done new_authtok_reqd=done default=ignore{{ ' auth_err=die' if not auth['failthrough'] }}] pam_tacplus.so server={{ server.ip }}:{{ server.tcp_port }} secret={{ server.passkey }} login={{ server.auth_type }} timeout={{ server.timeout }} try_first_pass +{% endfor %} +auth [success=1 default=ignore] pam_unix.so nullok try_first_pass + +{% else %} +auth [success=1 default=ignore] pam_unix.so nullok try_first_pass + +{% endif %} +# +# here's the fallback if no module succeeds +auth requisite pam_deny.so +# prime the stack with a positive return value if there isn't one already; +# this avoids us returning an error just because nothing sets a success code +# since the modules above will each just jump around +auth required pam_permit.so +# and here are more per-package modules (the "Additional" block) + diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd new file mode 100755 index 000000000000..837c5351e0eb --- /dev/null +++ b/files/image_config/hostcfgd/hostcfgd @@ -0,0 +1,172 @@ +#!/usr/bin/python -u +# -*- coding: utf-8 -*- + +import os +import sys +import subprocess +import syslog +import jinja2 +from swsssdk import ConfigDBConnector + +# FILE +PAM_AUTH_CONF = "/etc/pam.d/common-auth-sonic" +PAM_AUTH_CONF_TEMPLATE = "/usr/share/sonic/templates/common-auth-sonic.j2" +NSS_TACPLUS_CONF = "/etc/tacplus_nss.conf" +NSS_TACPLUS_CONF_TEMPLATE = "/usr/share/sonic/templates/tacplus_nss.conf.j2" +NSS_CONF = "/etc/nsswitch.conf" + +# TACACS+ +TACPLUS_SERVER_PASSKEY_DEFAULT = "" +TACPLUS_SERVER_TIMEOUT_DEFAULT = "5" +TACPLUS_SERVER_AUTH_TYPE_DEFAULT = "pap" + + +def is_true(val): + if val == 'True' or val == 'true': + return True + else: + return False + + +def sub(l, start, end): + return l[start:end] + + +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, + 'timeout': TACPLUS_SERVER_TIMEOUT_DEFAULT, + 'passkey': TACPLUS_SERVER_PASSKEY_DEFAULT + } + self.auth = {} + self.tacplus_global = {} + self.tacplus_servers = {} + self.debug = False + + # Load conf from ConfigDb + def load(self, aaa_conf, tac_global_conf, tacplus_conf): + for row in aaa_conf: + self.aaa_update(row, aaa_conf[row], modify_conf=False) + for row in tac_global_conf: + self.tacacs_global_update(row, tac_global_conf[row], modify_conf=False) + for row in tacplus_conf: + self.tacacs_server_update(row, tacplus_conf[row], modify_conf=False) + self.modify_conf_file() + + def aaa_update(self, key, data, modify_conf=True): + if key == 'authentication': + self.auth = data + if 'failthrough' in data: + self.auth['failthrough'] = is_true(data['failthrough']) + if 'debug' in data: + self.debug = is_true(data['debug']) + if modify_conf: + self.modify_conf_file() + + def tacacs_global_update(self, key, data, modify_conf=True): + if key == 'global': + self.tacplus_global = data + if modify_conf: + self.modify_conf_file() + + def tacacs_server_update(self, key, data, modify_conf=True): + if data == {}: + if key in self.tacplus_servers: + del self.tacplus_servers[key] + else: + self.tacplus_servers[key] = data + + if modify_conf: + self.modify_conf_file() + + def modify_conf_file(self): + auth = self.auth_default.copy() + auth.update(self.auth) + tacplus_global = self.tacplus_global_default.copy() + tacplus_global.update(self.tacplus_global) + + servers_conf = [] + if self.tacplus_servers: + for addr in self.tacplus_servers: + server = tacplus_global.copy() + server['ip'] = addr + server.update(self.tacplus_servers[addr]) + servers_conf.append(server) + sorted(servers_conf, key=lambda t: t['priority'], reverse=True) + + template_file = os.path.abspath(PAM_AUTH_CONF_TEMPLATE) + env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) + env.filters['sub'] = sub + template = env.get_template(template_file) + pam_conf = template.render(auth=auth, servers=servers_conf) + with open(PAM_AUTH_CONF, 'w') as f: + f.write(pam_conf) + + # Modify common-auth include file in /etc/pam.d/login and sshd + if os.path.isfile(PAM_AUTH_CONF): + os.system("sed -i -e '/^@include/s/common-auth$/common-auth-sonic/' /etc/pam.d/sshd") + os.system("sed -i -e '/^@include/s/common-auth$/common-auth-sonic/' /etc/pam.d/login") + else: + os.system("sed -i -e '/^@include/s/common-auth-sonic$/common-auth/' /etc/pam.d/sshd") + os.system("sed -i -e '/^@include/s/common-auth-sonic$/common-auth/' /etc/pam.d/login") + + # Add tacplus in nsswitch.conf if TACACS+ enable + if 'tacacs+' in auth['login']: + if os.path.isfile(NSS_CONF): + os.system("sed -i -e '/tacplus/b' -e '/^passwd/s/compat/& tacplus/' /etc/nsswitch.conf") + else: + if os.path.isfile(NSS_CONF): + os.system("sed -i -e '/^passwd/s/ tacplus//' /etc/nsswitch.conf") + + # Set tacacs+ server in nss-tacplus conf + template_file = os.path.abspath(NSS_TACPLUS_CONF_TEMPLATE) + template = env.get_template(template_file) + nss_tacplus_conf = template.render(debug=self.debug, servers=servers_conf) + with open(NSS_TACPLUS_CONF, 'w') as f: + f.write(nss_tacplus_conf) + + +class HostConfigDaemon: + def __init__(self): + self.config_db = ConfigDBConnector() + self.config_db.connect(wait_for_init=True, retry_on=True) + syslog.syslog(syslog.LOG_INFO, 'ConfigDB connect success') + aaa = self.config_db.get_table('AAA') + tacacs_global = self.config_db.get_table('TACPLUS') + tacacs_server = self.config_db.get_table('TACPLUS_SERVER') + self.aaacfg = AaaCfg() + self.aaacfg.load(aaa, tacacs_global, tacacs_server) + + def aaa_handler(self, key, data): + syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) + self.aaacfg.aaa_update(key, data) + + def tacacs_server_handler(self, key, data): + syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) + self.aaacfg.tacacs_server_update(key, data) + + def tacacs_global_handler(self, key, data): + syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) + self.aaacfg.tacacs_global_update(key, data) + + def start(self): + self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data)) + self.config_db.subscribe('TACPLUS_SERVER', lambda table, key, data: self.tacacs_server_handler(key, data)) + self.config_db.subscribe('TACPLUS', lambda table, key, data: self.tacacs_global_handler(key, data)) + self.config_db.listen() + + +def main(): + daemon = HostConfigDaemon() + daemon.start() + + +if __name__ == "__main__": + main() + diff --git a/files/image_config/hostcfgd/hostcfgd.service b/files/image_config/hostcfgd/hostcfgd.service new file mode 100644 index 000000000000..4f6151a471fe --- /dev/null +++ b/files/image_config/hostcfgd/hostcfgd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Host config enforcer daemon +Requires=database.service +After=database.service + +[Service] +Type=simple +ExecStart=/usr/bin/hostcfgd + +[Install] +WantedBy=multi-user.target diff --git a/files/image_config/hostcfgd/tacplus_nss.conf.j2 b/files/image_config/hostcfgd/tacplus_nss.conf.j2 new file mode 100644 index 000000000000..61ab905ecb84 --- /dev/null +++ b/files/image_config/hostcfgd/tacplus_nss.conf.j2 @@ -0,0 +1,25 @@ +onfiguration for libnss-tacplus + +# debug - If you want to open debug log, set it on +# Default: off +# debug=on +{% if debug %} +debug=on +{% endif %} + +# server - set ip address, tcp port, secret string and timeout for TACACS+ servers +# Default: None (no TACACS+ server) +# server=1.1.1.1:49,secret=test,timeout=3 +{% for server in servers %} +server={{ server.ip }}:{{ server.tcp_port }},secret={{ server.passkey }},timeout={{ server.timeout }} +{% endfor %} + +# user_priv - set the map between TACACS+ user privilege and local user's passwd +# Default: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash +# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash + +# many_to_one - create one local user for many TACACS+ users which has the same privilege +# Default: many_to_one=n +# many_to_one=y + From a47b93476b01dbf329ae05c0eb62d522ce8da67b Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Tue, 12 Dec 2017 17:18:57 +0200 Subject: [PATCH 0984/1833] Update sonic-utilities reference (ecnconfig) (#1225) Signed-off-by: Andriy Moroz --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index cb8538962815..be91f161b290 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit cb8538962815ea82665a4d4b851d50ea0793811d +Subproject commit be91f161b290328773b98f1e21f7feee797ce91c From 79f790409fa34bf62f9a34aeaafdaa0685216ed5 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 12 Dec 2017 16:29:32 -0800 Subject: [PATCH 0985/1833] [snmpagent]: Update sonic-snmpagent submodule (#1234) Signed-off-by: Qi Luo --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 5580935de8f8..bedc2ec1d018 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 5580935de8f82caae071ef62cf9dc647b8f78ca0 +Subproject commit bedc2ec1d018333fefe67390fba5b5f65c62ba6f From 2571cb59b6fc9da38d4f7c00dc39ae5b04ab2cf3 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 12 Dec 2017 23:56:59 -0800 Subject: [PATCH 0986/1833] [DHCP relay]: Fix bug which could cause incorrect interface name association (#1233) * [DHCP relay]: Fix bug which could cause incorrect interface name association * Add patches to series file and apply using stgit * Update .gitignore in order to ignore downloaded and generated files * Reorganize src/ subdirectories alphabetically in .gitignore --- .gitignore | 23 +- src/isc-dhcp/Makefile | 13 +- ...d-remote_id-and-bridge-iface-support.patch | 442 ------------------ ...ion-82-circuit-ID-and-remote-ID-fiel.patch | 266 +++++++++++ ...ining-name-of-physical-interface-tha.patch | 114 +++++ ...ing-port-alias-map-file-to-replace-p.patch | 177 +++++++ src/isc-dhcp/patch/series | 4 + 7 files changed, 582 insertions(+), 457 deletions(-) delete mode 100644 src/isc-dhcp/isc-dhcp-4.3.3-6_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch create mode 100644 src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch create mode 100644 src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch create mode 100644 src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch create mode 100644 src/isc-dhcp/patch/series diff --git a/.gitignore b/.gitignore index 463994a75e8e..069e663c1966 100644 --- a/.gitignore +++ b/.gitignore @@ -12,28 +12,31 @@ target/ # Subdirectories in src src/hiredis/* !src/hiredis/Makefile +src/igb/* +!src/igb/Makefile src/initramfs-tools/* !src/initramfs-tools/Makefile -src/redis/* -!src/redis/Makefile +src/isc-dhcp/* +!src/isc-dhcp/Makefile +!src/isc-dhcp/patch/ src/libnl3/* !src/libnl3/Makefile src/libteam/* !src/libteam/Makefile -src/snmpd/* -!src/snmpd/Makefile -src/thrift/* -!src/thrift/Makefile -src/sonic-device-data/src/device/ -src/sonic-device-data/src/debian/ -src/igb/* -!src/igb/Makefile src/mpdecimal/* !src/mpdecimal/Makefile src/python3/* !src/python3/Makefile +src/redis/* +!src/redis/Makefile +src/snmpd/* +!src/snmpd/Makefile +src/sonic-device-data/src/device/ +src/sonic-device-data/src/debian/ src/supervisor/* !src/supervisor/Makefile +src/thrift/* +!src/thrift/Makefile # Autogenerated Dockerfiles dockers/docker-base/Dockerfile diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index ec4c185b79f9..5b1cb8407005 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -12,14 +12,17 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Clone isc-dhcp repo git clone https://anonscm.debian.org/cgit/pkg-dhcp/isc-dhcp.git pushd ./isc-dhcp - git checkout -f debian/$(ISC_DHCP_VERSION) - popd - # Apply patch - patch -p1 < isc-dhcp-$(ISC_DHCP_VERSION)_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch + # Reset HEAD to the commit of the proper tag + # NOTE: Using "git checkout " here detaches our HEAD, + # which stg doesn't like, so we use this method instead + git reset --hard debian/$(ISC_DHCP_VERSION) + + # Apply patches + stg init + stg import -s ../patch/series # Build source and Debian packages - pushd ./isc-dhcp dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd diff --git a/src/isc-dhcp/isc-dhcp-4.3.3-6_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch b/src/isc-dhcp/isc-dhcp-4.3.3-6_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch deleted file mode 100644 index 6d2a850379cd..000000000000 --- a/src/isc-dhcp/isc-dhcp-4.3.3-6_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch +++ /dev/null @@ -1,442 +0,0 @@ -This patch adds the following functionality to dhcrelay in isc-dhcp v4.3.3-6: -* Add customizable Circuit ID and Remote ID fields -* Support for obtaining name of physical interfaces that are part of a bridge interface - -diff -ruN a/isc-dhcp/relay/dhcrelay.c b/isc-dhcp/relay/dhcrelay.c ---- a/isc-dhcp/relay/dhcrelay.c 2017-11-17 00:36:51.575121900 +0000 -+++ b/isc-dhcp/relay/dhcrelay.c 2017-11-17 00:52:51.024607833 +0000 -@@ -73,6 +73,8 @@ - did not match any known circuit ID. */ - int missing_circuit_id = 0; /* Circuit ID option in matching RAI option - was missing. */ -+const char *agent_circuit_id_fmt = NULL; /* Circuit ID custom format string. */ -+const char *agent_remote_id_fmt = NULL; /* Remote ID custom format string. */ - int max_hop_count = 10; /* Maximum hop count */ - - #ifdef DHCPv6 -@@ -120,6 +122,14 @@ - char *dhcrelay_sub_id = NULL; - #endif - -+struct interface_name_alias_tuple { -+ char if_name[IFNAMSIZ + 1]; -+ char if_alias[IFNAMSIZ + 1]; -+}; -+ -+static struct interface_name_alias_tuple *g_interface_name_alias_map = NULL; -+static size_t g_interface_name_alias_map_size = 0; -+ - static void do_relay4(struct interface_info *, struct dhcp_packet *, - unsigned int, unsigned int, struct iaddr, - struct hardware *); -@@ -132,6 +142,10 @@ - struct interface_info **, - struct dhcp_packet *, unsigned); - -+static int load_interface_alias_map(const char *port_alias_map_file_path); -+static int get_interface_alias_by_name(const char *if_name, char *if_alias_out); -+static void free_interface_alias_map(void); -+ - static const char copyright[] = - "Copyright 2004-2015 Internet Systems Consortium."; - static const char arr[] = "All rights reserved."; -@@ -140,28 +154,41 @@ - static const char url[] = - "For info, please visit https://www.isc.org/software/dhcp/"; - -+#define DHCRELAY_OPTION82_USAGE \ -+"circuit_id/remote_id interpreted sequences are:\n" \ -+"\n" \ -+" %%%% A single %%\n" \ -+" %%h Hostname of device\n" \ -+" %%p Alias of interface that generated the request\n" \ -+" %%P Hardware address of interface that generated the request\n" \ -+" %%C Client hardware address\n" \ -+" %%I DHCP relay agent IP Address\n" \ -+ - #ifdef DHCPv6 - #define DHCRELAY_USAGE \ --"Usage: dhcrelay [-4] [-d] [-q] [-a] [-D]\n"\ -+"Usage: dhcrelay [-4] [-d] [-q] [-a ] [-D]\n"\ - " [-A ] [-c ] [-p ]\n" \ - " [-pf ] [--no-pid]\n"\ - " [-m append|replace|forward|discard]\n" \ -+" [--name-alias-map-file ]\n" \ - " [-i interface0 [ ... -i interfaceN]\n" \ - " server0 [ ... serverN]\n\n" \ - " dhcrelay -6 [-d] [-q] [-I] [-c ] [-p ]\n" \ - " [-pf ] [--no-pid]\n" \ -+" [--name-alias-map-file ]\n" \ - " [-s ]\n" \ - " -l lower0 [ ... -l lowerN]\n" \ - " -u upper0 [ ... -u upperN]\n" \ - " lower (client link): [address%%]interface[#index]\n" \ --" upper (server link): [address%%]interface" -+" upper (server link): [address%%]interface\n\n" DHCRELAY_OPTION82_USAGE - #else - #define DHCRELAY_USAGE \ --"Usage: dhcrelay [-d] [-q] [-a] [-D] [-A ] [-c ] [-p ]\n" \ --" [-pf ] [--no-pid]\n" \ -+"Usage: dhcrelay [-d] [-q] [-a ] [-D]\n" \ -+" [-A ] [-c ] [-p ]\n" \ -+" [-pf ] [--no-pid]\n"\ - " [-m append|replace|forward|discard]\n" \ - " [-i interface0 [ ... -i interfaceN]\n" \ --" server0 [ ... serverN]\n\n" -+" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE - #endif - - static void usage() { -@@ -287,6 +314,15 @@ - local_family_set = 1; - local_family = AF_INET; - #endif -+ if (++i == argc) -+ usage(); -+ -+ if (argv[i] != NULL && argv[i][0] != '-') -+ agent_circuit_id_fmt = argv[i++]; -+ -+ if (argv[i] != NULL && argv[i][0] != '-') -+ agent_remote_id_fmt = argv[i]; -+ - add_agent_options = 1; - } else if (!strcmp(argv[i], "-A")) { - #ifdef DHCPv6 -@@ -383,6 +419,13 @@ - no_dhcrelay_pid = ISC_TRUE; - } else if (!strcmp(argv[i], "--no-pid")) { - no_pid_file = ISC_TRUE; -+ } else if (!strcmp(argv[i], "--name-alias-map-file")) { -+ if (++i == argc) -+ usage(); -+ if (load_interface_alias_map(argv[i]) != 0) -+ log_fatal("Failed to load interface name-alias map."); -+ path_dhcrelay_pid = argv[i]; -+ no_dhcrelay_pid = ISC_TRUE; - } else if (!strcmp(argv[i], "--version")) { - log_info("isc-dhcrelay-%s", PACKAGE_VERSION); - exit(0); -@@ -602,6 +645,8 @@ - dispatch(); - - /* In fact dispatch() never returns. */ -+ free_interface_alias_map(); -+ - return (0); - } - -@@ -690,10 +735,10 @@ - &to, htop) < 0) { - ++server_packet_errors; - } else { -- log_debug("Forwarded BOOTREPLY for %s to %s", -- print_hw_addr(packet->htype, packet->hlen, -- packet->chaddr), -- inet_ntoa(to.sin_addr)); -+ //log_debug("Forwarded BOOTREPLY for %s to %s", -+ // print_hw_addr(packet->htype, packet->hlen, -+ // packet->chaddr), -+ // inet_ntoa(to.sin_addr)); - - ++server_packets_relayed; - } -@@ -732,10 +777,11 @@ - &sp->to, NULL) < 0) { - ++client_packet_errors; - } else { -- log_debug("Forwarded BOOTREQUEST for %s to %s", -- print_hw_addr(packet->htype, packet->hlen, -- packet->chaddr), -- inet_ntoa(sp->to.sin_addr)); -+ //log_debug("Forwarded BOOTREQUEST for %s to %s", -+ // print_hw_addr(packet->htype, packet->hlen, -+ // packet->chaddr), -+ // inet_ntoa(sp->to.sin_addr)); -+ - ++client_packets_relayed; - } - } -@@ -937,6 +983,151 @@ - return (-1); - } - -+static int -+_bridgefdbquery(const char *hwAddr, char *interface, int *vlanid) { -+ -+#define xstr(s) str(s) -+#define str(s) #s -+#define FDB_STRING_LEN 100 -+#define FDB_BUFFER_LEN (FDB_STRING_LEN + 1) -+ -+/* -+ * Format for sscanf() to read the 1st, 3th, and 5th -+ * space-delimited fields -+ * -+ * bridge fdb show output -+ * 6c:64:1a:00:06:13 dev swp35 vlan 0 master bridge permanent -+ */ -+#define FDB_LINE_FORMAT "%" xstr(FDB_STRING_LEN) "s %*s " \ -+ "%" xstr(FDB_STRING_LEN) "s %*s %d %*s" -+ -+ char cmdstr[FDB_BUFFER_LEN]; -+ char buf[FDB_BUFFER_LEN]; -+ char macAddr[FDB_BUFFER_LEN]; -+ -+ if ((interface == NULL) || (vlanid == NULL)) { -+ return 0; -+ } -+ sprintf(cmdstr, "bridge fdb show | grep -m 1 %s", hwAddr); -+ FILE *cmd = popen(cmdstr, "r"); -+ -+ if (cmd != NULL) { -+ while (fgets(buf, sizeof(buf), cmd)) { -+ sscanf(buf, FDB_LINE_FORMAT, macAddr, interface, vlanid); -+ //log_debug("bridgefdbquery: macAddr:%s interface: %s vlanid %d", -+ // macAddr, interface, *vlanid); -+ } -+ pclose(cmd); -+ return 0; -+ } -+ -+ return -1; -+} -+ -+/* -+ * Format the message that will be used by circuit_id and remote_id -+ */ -+static int -+format_relay_agent_rfc3046_msg(struct interface_info *ip, struct dhcp_packet *packet, -+ const char *format, char *msg, size_t msgn) { -+ size_t len = 0; -+ char hostname[HOST_NAME_MAX + 1] = { 0 }; -+ char ifname[IFNAMSIZ + 1] = { 0 }; -+ char *buf = msg; -+ -+ for ( ; format && *format && len < msgn; ++format) { -+ size_t strn = 0; -+ const char *str = NULL; -+ -+ if (*format == '%') { -+ switch (*++format) { -+ case '\0': -+ --format; -+ break; -+ -+ case '%': /* A literal '%' */ -+ str = "%"; -+ break; -+ -+ case 'h': /* Hostname */ -+ gethostname(hostname, HOST_NAME_MAX); -+ str = hostname; -+ break; -+ -+ case 'p': /* Name of interface that we received the request from */ -+ /* -+ * Query FDB to identify the exact physical interface only when source MAC address -+ * is present and '20: DHCP relay agent IP address' (giaddr) is not present -+ */ -+ if (packet->htype && !packet->giaddr.s_addr) { -+ int ret = 0, vlanid = 0; -+ -+ ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr), -+ ip->name, -+ &vlanid); -+ -+ if (ret < 0) { -+ //log_debug("MAC Address: %s (interface:%s vlan:%d) not found in bridge fdb show", -+ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), -+ // ip->name, -+ // vlanid); -+ -+ strncpy(ifname, ip->name, IFNAMSIZ); -+ } -+ else if (strlen(ip->name) > 0) { -+ // Translate SONiC interface name to vendor alias -+ if (get_interface_alias_by_name(ip->name, ifname) < 0) { -+ log_error("Failed to retrieve alias for interface name '%s'. Defaulting to interface name.", ip->name); -+ strncpy(ifname, ip->name, IFNAMSIZ); -+ } -+ -+ //log_debug("Mapped interface name '%s' to alias '%s'", ip->name, ifname); -+ -+ //log_debug("Adding option 82 interface alias for MAC Address %s as '%s'", -+ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), -+ // ifname); -+ } -+ -+ str = ifname; -+ } -+ break; -+ -+ case 'P': /* Physical address of interface that we received the request from */ -+ str = print_hw_addr(ip->hw_address.hbuf[0], ip->hw_address.hlen - 1, &ip->hw_address.hbuf[1]); -+ break; -+ -+ case 'C': /* 24: Client hardware address */ -+ str = print_hw_addr(packet->htype, packet->hlen, packet->chaddr); -+ break; -+ -+ case 'I': /* 20: DHCP relay agent IP address */ -+ str = inet_ntoa(packet->giaddr); -+ break; -+ -+ default: -+ log_error("Option %%%c is unrecognized and will not be formatted!", *format); -+ continue; -+ } -+ -+ if (str) -+ strn = strlen(str); -+ } else { -+ str = format; -+ strn += 1; -+ } -+ -+ // Do we have room? -+ if ((strn+len) > msgn) { -+ return 0; -+ } -+ -+ memcpy(buf+len, str, strn); -+ len += strn; -+ } -+ -+ return len; -+} -+ - /* - * Examine a packet to see if it's a candidate to have a Relay - * Agent Information option tacked onto its tail. If it is, tack -@@ -948,6 +1139,8 @@ - int is_dhcp = 0, mms; - unsigned optlen; - u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL; -+ char circuit_id_buf[255] = { '\0', }; -+ char remote_id_buf[255] = { '\0', }; - - /* If we're not adding agent options to packets, we can skip - this. */ -@@ -1077,6 +1270,38 @@ - op = sp; - #endif - -+ /* option82: custom string for circuit_id */ -+ if (agent_circuit_id_fmt) { -+ size_t len = 0; -+ -+ len = format_relay_agent_rfc3046_msg(ip, packet, agent_circuit_id_fmt, -+ circuit_id_buf, sizeof(circuit_id_buf)); -+ -+ if (len > 0) { -+ ip->circuit_id = (uint8_t *)circuit_id_buf; -+ ip->circuit_id_len = len; -+ -+ //log_debug("Sending on %s option82:circuit_id='%s' (%d)", -+ // ip->name, (char *)ip->circuit_id, ip->circuit_id_len); -+ } -+ } -+ -+ /* option82: custom string for remote_id */ -+ if (agent_remote_id_fmt) { -+ size_t len = 0; -+ -+ len = format_relay_agent_rfc3046_msg(ip, packet, agent_remote_id_fmt, -+ remote_id_buf, sizeof(remote_id_buf)); -+ -+ if (len > 0) { -+ ip->remote_id = (uint8_t *)remote_id_buf; -+ ip->remote_id_len = len; -+ -+ //log_debug("Sending on %s option82:remote_id='%s' (%d)", -+ // ip->name, (char *)ip->remote_id, ip->remote_id_len); -+ } -+ } -+ - /* Sanity check. Had better not ever happen. */ - if ((ip->circuit_id_len > 255) ||(ip->circuit_id_len < 1)) - log_fatal("Circuit ID length %d out of range [1-255] on " -@@ -1102,7 +1327,7 @@ - * If not, forward without adding the option. - */ - if (max - sp >= optlen + 3) { -- log_debug("Adding %d-byte relay agent option", optlen + 3); -+ //log_debug("Adding %d-byte relay agent option", optlen + 3); - - /* Okay, cons up *our* Relay Agent Information option. */ - *sp++ = DHO_DHCP_AGENT_OPTIONS; -@@ -1735,3 +1960,73 @@ - - exit(0); - } -+ -+#define MAX_PORT_CONFIG_LINE_LEN 1024 -+ -+// Allocates and loads global map g_interface_name_alias_map -+// Also sets global g_interface_name_alias_map_size -+static int -+load_interface_alias_map(const char *port_alias_map_file_path) { -+ int i = 0; -+ FILE *fp = NULL; -+ char line[MAX_PORT_CONFIG_LINE_LEN] = { 0 }; -+ -+ fp = fopen(port_alias_map_file_path,"r"); -+ if (fp == NULL) { -+ log_error("Unable to open %s", port_alias_map_file_path); -+ return -1; -+ } -+ -+ g_interface_name_alias_map_size = 0; -+ -+ // Count the number of interfaces listed in the file -+ while (fgets(line, sizeof(line), fp)) { -+ g_interface_name_alias_map_size++; -+ } -+ -+ // Allocate our map accordingly -+ g_interface_name_alias_map = ((struct interface_name_alias_tuple *) -+ dmalloc((sizeof(struct interface_name_alias_tuple) * g_interface_name_alias_map_size), -+ MDL)); -+ -+ // Reset file position indicator to beginning of file -+ fseek(fp, 0, SEEK_SET); -+ -+ // Every line should contain exactly one name-alias pair -+ while (fgets(line, sizeof(line), fp)) { -+ // Each line should read as "" -+ sscanf(line, "%s %s", g_interface_name_alias_map[i].if_name, g_interface_name_alias_map[i].if_alias); -+ i++; -+ } -+ -+ fclose(fp); -+ -+ log_info("Loaded %d interface name-alias mappings", i); -+ -+ return 0; -+} -+ -+// Locates alias for port named if_name, copies alias into if_alias_out, up to a -+// max of IFNAMSIZ bytes. -+// Returns 0 on success, -1 on failure -+static int -+get_interface_alias_by_name(const char *if_name, char *if_alias_out) { -+ int i = 0; -+ -+ for (i = 0; i < g_interface_name_alias_map_size; i++) { -+ if (strncmp(if_name, g_interface_name_alias_map[i].if_name, IFNAMSIZ) == 0) { -+ strncpy(if_alias_out, g_interface_name_alias_map[i].if_alias, IFNAMSIZ); -+ return 0; -+ } -+ } -+ -+ return -1; -+} -+ -+// Frees global map g_interface_name_alias_map -+// Sets g_interface_name_alias_map_size to 0 -+static void -+free_interface_alias_map(void) { -+ free(g_interface_name_alias_map); -+ g_interface_name_alias_map_size = 0; -+} diff --git a/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch b/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch new file mode 100644 index 000000000000..4d47c8185ece --- /dev/null +++ b/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch @@ -0,0 +1,266 @@ +From 42319f1b56ba6362c874cd64383a055ba6498bee Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Mon, 11 Dec 2017 23:21:08 +0000 +Subject: [PATCH 1/3] Customizable Option 82 circuit ID and remote ID fields + +--- + relay/dhcrelay.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 147 insertions(+), 25 deletions(-) + +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index 15b4997..a26efca 100644 +--- a/relay/dhcrelay.c ++++ b/relay/dhcrelay.c +@@ -73,6 +73,8 @@ int bad_circuit_id = 0; /* Circuit ID option in matching RAI option + did not match any known circuit ID. */ + int missing_circuit_id = 0; /* Circuit ID option in matching RAI option + was missing. */ ++const char *agent_circuit_id_fmt = NULL; /* Circuit ID custom format string. */ ++const char *agent_remote_id_fmt = NULL; /* Remote ID custom format string. */ + int max_hop_count = 10; /* Maximum hop count */ + + #ifdef DHCPv6 +@@ -140,9 +142,19 @@ static const char message[] = + static const char url[] = + "For info, please visit https://www.isc.org/software/dhcp/"; + ++#define DHCRELAY_OPTION82_USAGE \ ++"circuit_id/remote_id interpreted sequences are:\n" \ ++"\n" \ ++" %%%% A single %%\n" \ ++" %%h Hostname of device\n" \ ++" %%p Name of interface that generated the request\n" \ ++" %%P Hardware address of interface that generated the request\n" \ ++" %%C Client hardware address\n" \ ++" %%I DHCP relay agent IP Address\n" \ ++ + #ifdef DHCPv6 + #define DHCRELAY_USAGE \ +-"Usage: dhcrelay [-4] [-d] [-q] [-a] [-D]\n"\ ++"Usage: dhcrelay [-4] [-d] [-q] [-a ] [-D]\n"\ + " [-A ] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ +@@ -154,14 +166,15 @@ static const char url[] = + " -l lower0 [ ... -l lowerN]\n" \ + " -u upper0 [ ... -u upperN]\n" \ + " lower (client link): [address%%]interface[#index]\n" \ +-" upper (server link): [address%%]interface" ++" upper (server link): [address%%]interface\n\n" DHCRELAY_OPTION82_USAGE + #else + #define DHCRELAY_USAGE \ +-"Usage: dhcrelay [-d] [-q] [-a] [-D] [-A ] [-c ] [-p ]\n" \ +-" [-pf ] [--no-pid]\n" \ ++"Usage: dhcrelay [-d] [-q] [-a ] [-D]\n" \ ++" [-A ] [-c ] [-p ]\n" \ ++" [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ +-" server0 [ ... serverN]\n\n" ++" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE + #endif + + static void usage() { +@@ -287,6 +300,15 @@ main(int argc, char **argv) { + local_family_set = 1; + local_family = AF_INET; + #endif ++ if (++i == argc) ++ usage(); ++ ++ if (argv[i] != NULL && argv[i][0] != '-') ++ agent_circuit_id_fmt = argv[i++]; ++ ++ if (argv[i] != NULL && argv[i][0] != '-') ++ agent_remote_id_fmt = argv[i]; ++ + add_agent_options = 1; + } else if (!strcmp(argv[i], "-A")) { + #ifdef DHCPv6 +@@ -938,6 +960,80 @@ find_interface_by_agent_option(struct dhcp_packet *packet, + } + + /* ++ * Format the message that will be used by circuit_id and remote_id ++ */ ++static int ++format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_packet *packet, ++ const char *format, char *msg, size_t msgn) { ++ size_t len = 0; ++ char hostname[HOST_NAME_MAX] = { 0 }; ++ char ifname[IFNAMSIZ] = { 0 }; ++ char *buf = msg; ++ ++ for ( ; format && *format && len < msgn; ++format) { ++ size_t strn = 0; ++ const char *str = NULL; ++ ++ if (*format == '%') { ++ switch (*++format) { ++ case '\0': ++ --format; ++ break; ++ ++ case '%': /* A literal '%' */ ++ str = "%"; ++ break; ++ ++ case 'h': /* Hostname */ ++ gethostname(hostname, HOST_NAME_MAX); ++ hostname[HOST_NAME_MAX - 1] = '\0'; ++ str = hostname; ++ break; ++ ++ case 'p': /* Name of interface that we received the request from */ ++ strncpy(ifname, ip->name, IFNAMSIZ); ++ str = ifname; ++ break; ++ ++ case 'P': /* Physical address of interface that we received the request from */ ++ str = print_hw_addr(ip->hw_address.hbuf[0], ip->hw_address.hlen - 1, &ip->hw_address.hbuf[1]); ++ break; ++ ++ case 'C': /* 24: Client hardware address */ ++ str = print_hw_addr(packet->htype, packet->hlen, packet->chaddr); ++ break; ++ ++ case 'I': /* 20: DHCP relay agent IP address */ ++ str = inet_ntoa(packet->giaddr); ++ break; ++ ++ default: ++ log_error("Option %%%c is unrecognized and will not be formatted!", *format); ++ continue; ++ } ++ ++ if (str) ++ strn = strlen(str); ++ } else { ++ str = format; ++ strn = 1; ++ } ++ ++ // Do we have room? ++ if ((strn+len) >= msgn) { ++ return 0; ++ } ++ ++ if (str && strn > 0) { ++ memcpy(buf+len, str, strn); ++ len += strn; ++ } ++ } ++ ++ return len; ++} ++ ++/* + * Examine a packet to see if it's a candidate to have a Relay + * Agent Information option tacked onto its tail. If it is, tack + * the option on. +@@ -948,6 +1044,9 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, + int is_dhcp = 0, mms; + unsigned optlen; + u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL; ++ char circuit_id_buf[256] = { '\0' }; ++ char remote_id_buf[256] = { '\0' }; ++ size_t circuit_id_len = 0, remote_id_len = 0; + + /* If we're not adding agent options to packets, we can skip + this. */ +@@ -1077,24 +1176,47 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, + op = sp; + #endif + +- /* Sanity check. Had better not ever happen. */ +- if ((ip->circuit_id_len > 255) ||(ip->circuit_id_len < 1)) +- log_fatal("Circuit ID length %d out of range [1-255] on " +- "%s\n", ip->circuit_id_len, ip->name); +- optlen = ip->circuit_id_len + 2; /* RAI_CIRCUIT_ID + len */ ++ /* option82: custom string for circuit_id */ ++ if (agent_circuit_id_fmt) { ++ circuit_id_len = format_relay_agent_rfc3046_msg(ip, packet, agent_circuit_id_fmt, ++ circuit_id_buf, sizeof(circuit_id_buf)); ++ ++ if (circuit_id_len == 0) ++ strncpy(circuit_id_buf, ip->name, sizeof(ip->name)); ++ ++ //log_debug("Sending on %s option82:circuit_id='%s' (%d)", ++ // ip->name, circuit_id_buf, circuit_id_len); ++ } ++ ++ /* option82: custom string for remote_id */ ++ if (agent_remote_id_fmt) { ++ remote_id_len = format_relay_agent_rfc3046_msg(ip, packet, agent_remote_id_fmt, ++ remote_id_buf, sizeof(remote_id_buf)); ++ ++ //log_debug("Sending on %s option82:remote_id='%s' (%d)", ++ // ip->name, remote_id_buf, remote_id_len); ++ } ++ ++ /* Sanity check. Had better not ever happen. */ ++ if (circuit_id_len > 255 || circuit_id_len < 1) ++ log_fatal("Circuit ID length %d out of range [1-255] on %s\n", ++ circuit_id_len, ip->name); ++ ++ optlen = circuit_id_len + 2; // RAI_CIRCUIT_ID + len + + if (ip->remote_id) { +- if (ip->remote_id_len > 255 || ip->remote_id_len < 1) +- log_fatal("Remote ID length %d out of range [1-255] " +- "on %s\n", ip->circuit_id_len, ip->name); +- optlen += ip->remote_id_len + 2; /* RAI_REMOTE_ID + len */ ++ if (remote_id_len > 255 || remote_id_len < 1) ++ log_fatal("Remote ID length %d out of range [1-255] on %s\n", ++ remote_id_len, ip->name); ++ ++ optlen += remote_id_len + 2; // RAI_REMOTE_ID + len + } + +- /* We do not support relay option fragmenting(multiple options to +- * support an option data exceeding 255 bytes). ++ /* We do not support relay option fragmenting (multiple options to ++ * support an option data exceeding 255 bytes) + */ +- if ((optlen < 3) ||(optlen > 255)) +- log_fatal("Total agent option length(%u) out of range " ++ if (optlen < 3 || optlen > 255) ++ log_fatal("Total agent option length (%u) out of range " + "[3 - 255] on %s\n", optlen, ip->name); + + /* +@@ -1102,7 +1224,7 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, + * If not, forward without adding the option. + */ + if (max - sp >= optlen + 3) { +- log_debug("Adding %d-byte relay agent option", optlen + 3); ++ //log_debug("Adding %d-byte relay agent option", optlen + 3); + + /* Okay, cons up *our* Relay Agent Information option. */ + *sp++ = DHO_DHCP_AGENT_OPTIONS; +@@ -1110,16 +1232,16 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, + + /* Copy in the circuit id... */ + *sp++ = RAI_CIRCUIT_ID; +- *sp++ = ip->circuit_id_len; +- memcpy(sp, ip->circuit_id, ip->circuit_id_len); +- sp += ip->circuit_id_len; ++ *sp++ = circuit_id_len; ++ memcpy(sp, circuit_id_buf, circuit_id_len); ++ sp += circuit_id_len; + + /* Copy in remote ID... */ + if (ip->remote_id) { + *sp++ = RAI_REMOTE_ID; +- *sp++ = ip->remote_id_len; +- memcpy(sp, ip->remote_id, ip->remote_id_len); +- sp += ip->remote_id_len; ++ *sp++ = remote_id_len; ++ memcpy(sp, remote_id_buf, remote_id_len); ++ sp += remote_id_len; + } + } else { + ++agent_option_errors; +-- +2.1.4 + diff --git a/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch b/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch new file mode 100644 index 000000000000..87c9ba266cb1 --- /dev/null +++ b/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch @@ -0,0 +1,114 @@ +From 18ca48b7c307e1644f653df4c8503f4ce2677f62 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Mon, 11 Dec 2017 23:39:10 +0000 +Subject: [PATCH 2/3] Support for obtaining name of physical interface that is + a member of a bridge interface + +--- + relay/dhcrelay.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 67 insertions(+), 2 deletions(-) + +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index a26efca..84ec79d 100644 +--- a/relay/dhcrelay.c ++++ b/relay/dhcrelay.c +@@ -758,6 +758,7 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, + print_hw_addr(packet->htype, packet->hlen, + packet->chaddr), + inet_ntoa(sp->to.sin_addr)); ++ + ++client_packets_relayed; + } + } +@@ -917,6 +918,7 @@ find_interface_by_agent_option(struct dhcp_packet *packet, + ++corrupt_agent_options; + return (-1); + } ++ + switch(buf[i]) { + /* Remember where the circuit ID is... */ + case RAI_CIRCUIT_ID: +@@ -959,6 +961,47 @@ find_interface_by_agent_option(struct dhcp_packet *packet, + return (-1); + } + ++static int ++_bridgefdbquery(const char *hwAddr, char *interface, int *vlanid) { ++ ++#define xstr(s) str(s) ++#define str(s) #s ++#define FDB_STRING_LEN 100 ++#define FDB_BUFFER_LEN (FDB_STRING_LEN + 1) ++ ++/* ++ * Format for sscanf() to read the 1st, 3th, and 5th ++ * space-delimited fields ++ * ++ * bridge fdb show output ++ * 6c:64:1a:00:06:13 dev swp35 vlan 0 master bridge permanent ++ */ ++#define FDB_LINE_FORMAT "%" xstr(FDB_STRING_LEN) "s %*s " \ ++ "%" xstr(FDB_STRING_LEN) "s %*s %d %*s" ++ ++ char cmdstr[FDB_BUFFER_LEN]; ++ char buf[FDB_BUFFER_LEN]; ++ char macAddr[FDB_BUFFER_LEN]; ++ ++ if ((interface == NULL) || (vlanid == NULL)) { ++ return 0; ++ } ++ sprintf(cmdstr, "bridge fdb show | grep -m 1 %s", hwAddr); ++ FILE *cmd = popen(cmdstr, "r"); ++ ++ if (cmd != NULL) { ++ while (fgets(buf, sizeof(buf), cmd)) { ++ sscanf(buf, FDB_LINE_FORMAT, macAddr, interface, vlanid); ++ //log_debug("bridgefdbquery: macAddr:%s interface: %s vlanid %d", ++ // macAddr, interface, *vlanid); ++ } ++ pclose(cmd); ++ return 0; ++ } ++ ++ return -1; ++} ++ + /* + * Format the message that will be used by circuit_id and remote_id + */ +@@ -991,8 +1034,30 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack + break; + + case 'p': /* Name of interface that we received the request from */ +- strncpy(ifname, ip->name, IFNAMSIZ); +- str = ifname; ++ /* ++ * Query FDB to identify the exact physical interface only when source MAC address ++ * is present and '20: DHCP relay agent IP address' (giaddr) is not present ++ */ ++ if (packet->htype && !packet->giaddr.s_addr) { ++ int ret = 0, vlanid = 0; ++ ++ ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr), ++ ifname, ++ &vlanid); ++ ++ // If we failed to find a physical interface using the source mac, default ++ // to the interface name we received it on. ++ if (ret < 0) { ++ //log_debug("MAC Address: %s (interface:%s vlan:%d) not found in bridge fdb show", ++ // print_hw_addr (packet->htype, packet->hlen, packet->chaddr), ++ // ip->name, ++ // vlanid); ++ ++ strncpy(ifname, ip->name, IFNAMSIZ); ++ } ++ ++ str = ifname; ++ } + break; + + case 'P': /* Physical address of interface that we received the request from */ +-- +2.1.4 + diff --git a/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch b/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch new file mode 100644 index 000000000000..216abf5ba7b7 --- /dev/null +++ b/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch @@ -0,0 +1,177 @@ +From 3be065305283b90ddfef92a8736221cbf7cf06e0 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Tue, 12 Dec 2017 00:49:09 +0000 +Subject: [PATCH 3/3] Support for loading port alias map file to replace + port name with alias in circuit id + +--- + relay/dhcrelay.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 102 insertions(+), 1 deletion(-) + +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index 84ec79d..0b56e2d 100644 +--- a/relay/dhcrelay.c ++++ b/relay/dhcrelay.c +@@ -122,6 +122,14 @@ static void setup_streams(void); + char *dhcrelay_sub_id = NULL; + #endif + ++struct interface_name_alias_tuple { ++ char if_name[IFNAMSIZ]; ++ char if_alias[IFNAMSIZ]; ++}; ++ ++static struct interface_name_alias_tuple *g_interface_name_alias_map = NULL; ++static size_t g_interface_name_alias_map_size = 0; ++ + static void do_relay4(struct interface_info *, struct dhcp_packet *, + unsigned int, unsigned int, struct iaddr, + struct hardware *); +@@ -134,6 +142,10 @@ static int strip_relay_agent_options(struct interface_info *, + struct interface_info **, + struct dhcp_packet *, unsigned); + ++static int load_interface_alias_map(const char *port_alias_map_file_path); ++static int get_interface_alias_by_name(const char *if_name, char *if_alias_out); ++static void free_interface_alias_map(void); ++ + static const char copyright[] = + "Copyright 2004-2015 Internet Systems Consortium."; + static const char arr[] = "All rights reserved."; +@@ -147,7 +159,7 @@ static const char url[] = + "\n" \ + " %%%% A single %%\n" \ + " %%h Hostname of device\n" \ +-" %%p Name of interface that generated the request\n" \ ++" %%p Alias of interface that generated the request\n" \ + " %%P Hardware address of interface that generated the request\n" \ + " %%C Client hardware address\n" \ + " %%I DHCP relay agent IP Address\n" \ +@@ -158,10 +170,12 @@ static const char url[] = + " [-A ] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ ++" [--name-alias-map-file ]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ + " server0 [ ... serverN]\n\n" \ + " dhcrelay -6 [-d] [-q] [-I] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n" \ ++" [--name-alias-map-file ]\n" \ + " [-s ]\n" \ + " -l lower0 [ ... -l lowerN]\n" \ + " -u upper0 [ ... -u upperN]\n" \ +@@ -405,6 +419,11 @@ main(int argc, char **argv) { + no_dhcrelay_pid = ISC_TRUE; + } else if (!strcmp(argv[i], "--no-pid")) { + no_pid_file = ISC_TRUE; ++ } else if (!strcmp(argv[i], "--name-alias-map-file")) { ++ if (++i == argc) ++ usage(); ++ if (load_interface_alias_map(argv[i]) != 0) ++ log_fatal("Failed to load interface name-alias map."); + } else if (!strcmp(argv[i], "--version")) { + log_info("isc-dhcrelay-%s", PACKAGE_VERSION); + exit(0); +@@ -624,6 +643,8 @@ main(int argc, char **argv) { + dispatch(); + + /* In fact dispatch() never returns. */ ++ free_interface_alias_map(); ++ + return (0); + } + +@@ -1056,6 +1077,16 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack + strncpy(ifname, ip->name, IFNAMSIZ); + } + ++ // Attempt to translate SONiC interface name to vendor alias ++ if (get_interface_alias_by_name(ip->name, ifname) < 0) { ++ //log_debug("Failed to retrieve alias for interface name '%s'. Defaulting to interface name.", ip->name); ++ strncpy(ifname, ip->name, IFNAMSIZ); ++ } ++ else { ++ //log_debug("Mapped interface name '%s' to alias '%s'. Adding as option 82 interface alias for MAC Address %s", ++ // ip->name, ifname, print_hw_addr (packet->htype, packet->hlen, packet->chaddr), ++ } ++ + str = ifname; + } + break; +@@ -1922,3 +1953,73 @@ dhcp_set_control_state(control_object_state_t oldstate, + + exit(0); + } ++ ++#define MAX_PORT_CONFIG_LINE_LEN 1024 ++ ++// Allocates and loads global map g_interface_name_alias_map ++// Also sets global g_interface_name_alias_map_size ++static int ++load_interface_alias_map(const char *port_alias_map_file_path) { ++ int i = 0; ++ FILE *fp = NULL; ++ char line[MAX_PORT_CONFIG_LINE_LEN] = { 0 }; ++ ++ fp = fopen(port_alias_map_file_path,"r"); ++ if (fp == NULL) { ++ log_error("Unable to open %s", port_alias_map_file_path); ++ return -1; ++ } ++ ++ g_interface_name_alias_map_size = 0; ++ ++ // Count the number of interfaces listed in the file ++ while (fgets(line, sizeof(line), fp)) { ++ g_interface_name_alias_map_size++; ++ } ++ ++ // Allocate our map accordingly ++ g_interface_name_alias_map = ((struct interface_name_alias_tuple *) ++ dmalloc((sizeof(struct interface_name_alias_tuple) * g_interface_name_alias_map_size), ++ MDL)); ++ ++ // Reset file position indicator to beginning of file ++ fseek(fp, 0, SEEK_SET); ++ ++ // Every line should contain exactly one name-alias pair ++ while (fgets(line, sizeof(line), fp)) { ++ // Each line should read as "" ++ sscanf(line, "%s %s", g_interface_name_alias_map[i].if_name, g_interface_name_alias_map[i].if_alias); ++ i++; ++ } ++ ++ fclose(fp); ++ ++ log_info("Loaded %d interface name-alias mappings", i); ++ ++ return 0; ++} ++ ++// Locates alias for port named if_name, copies alias into if_alias_out, up to a ++// max of IFNAMSIZ bytes. ++// Returns 0 on success, -1 on failure ++static int ++get_interface_alias_by_name(const char *if_name, char *if_alias_out) { ++ int i = 0; ++ ++ for (i = 0; i < g_interface_name_alias_map_size; i++) { ++ if (strncmp(if_name, g_interface_name_alias_map[i].if_name, IFNAMSIZ) == 0) { ++ strncpy(if_alias_out, g_interface_name_alias_map[i].if_alias, IFNAMSIZ); ++ return 0; ++ } ++ } ++ ++ return -1; ++} ++ ++// Frees global map g_interface_name_alias_map ++// Sets g_interface_name_alias_map_size to 0 ++static void ++free_interface_alias_map(void) { ++ free(g_interface_name_alias_map); ++ g_interface_name_alias_map_size = 0; ++} +-- +2.1.4 + diff --git a/src/isc-dhcp/patch/series b/src/isc-dhcp/patch/series new file mode 100644 index 000000000000..a896563077c2 --- /dev/null +++ b/src/isc-dhcp/patch/series @@ -0,0 +1,4 @@ +# This series applies on GIT commit ee3dffdda38a8cfc6ad2005d8d64a165d2a709ba +0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch +0002-Support-for-obtaining-name-of-physical-interface-tha.patch +0003-Support-for-loading-port-alias-map-file-to-replace-p.patch From a2af29aa785dfa8a8ae1503af0c2f4fd3370926c Mon Sep 17 00:00:00 2001 From: loshihyu <31527295+loshihyu@users.noreply.github.com> Date: Wed, 13 Dec 2017 22:57:06 -0800 Subject: [PATCH 0987/1833] Fixed D7054 missing front-panel port Interfaces (#1236) --- .../INVENTEC-D7054Q28B-S48-Q6/port_config.ini | 109 +++++++++--------- 1 file changed, 54 insertions(+), 55 deletions(-) diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini index a8eaeb1f0665..8b0addcada13 100644 --- a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/port_config.ini @@ -1,56 +1,55 @@ -# 48x25G + 6x100G # name lanes alias -Ethernet0 2 Ethernet0 -Ethernet4 1 Ethernet4 -Ethernet8 4 Ethernet8 -Ethernet12 3 Ethernet12 -Ethernet16 6 Ethernet16 -Ethernet20 5 Ethernet20 -Ethernet24 8 Ethernet24 -Ethernet28 7 Ethernet28 -Ethernet32 10 Ethernet32 -Ethernet36 9 Ethernet36 -Ethernet40 12 Ethernet40 -Ethernet44 11 Ethernet44 -Ethernet48 22 Ethernet48 -Ethernet52 21 Ethernet52 -Ethernet56 24 Ethernet56 -Ethernet60 23 Ethernet60 -Ethernet64 34 Ethernet64 -Ethernet68 33 Ethernet68 -Ethernet72 36 Ethernet72 -Ethernet76 35 Ethernet76 -Ethernet80 38 Ethernet80 -Ethernet84 37 Ethernet84 -Ethernet88 40 Ethernet88 -Ethernet92 39 Ethernet92 -Ethernet96 42 Ethernet96 -Ethernet100 41 Ethernet100 -Ethernet104 44 Ethernet104 -Ethernet108 43 Ethernet108 -Ethernet112 50 Ethernet112 -Ethernet116 49 Ethernet116 -Ethernet120 52 Ethernet120 -Ethernet124 51 Ethernet124 -Ethernet128 54 Ethernet128 -Ethernet132 53 Ethernet132 -Ethernet136 56 Ethernet136 -Ethernet140 55 Ethernet140 -Ethernet144 66 Ethernet144 -Ethernet148 65 Ethernet148 -Ethernet152 68 Ethernet152 -Ethernet156 67 Ethernet156 -Ethernet160 70 Ethernet160 -Ethernet164 69 Ethernet164 -Ethernet168 72 Ethernet168 -Ethernet172 71 Ethernet172 -Ethernet176 82 Ethernet176 -Ethernet180 81 Ethernet180 -Ethernet184 84 Ethernet184 -Ethernet188 83 Ethernet188 -Ethernet192 85,86,87,88 Ethernet192 -Ethernet196 97,98,99,100 Ethernet196 -Ethernet200 105,106,107,108 Ethernet200 -Ethernet204 101,102,103,104 Ethernet204 -Ethernet208 117,118,119,120 Ethernet208 -Ethernet212 109,110,111,112 Ethernet212 +Ethernet0 2 Ethernet0 +Ethernet4 1 Ethernet4 +Ethernet8 4 Ethernet8 +Ethernet12 3 Ethernet12 +Ethernet16 6 Ethernet16 +Ethernet20 5 Ethernet20 +Ethernet24 8 Ethernet24 +Ethernet28 7 Ethernet28 +Ethernet32 10 Ethernet32 +Ethernet36 9 Ethernet36 +Ethernet40 12 Ethernet40 +Ethernet44 11 Ethernet44 +Ethernet48 22 Ethernet48 +Ethernet52 21 Ethernet52 +Ethernet56 24 Ethernet56 +Ethernet60 23 Ethernet60 +Ethernet64 34 Ethernet64 +Ethernet68 33 Ethernet68 +Ethernet72 36 Ethernet72 +Ethernet76 35 Ethernet76 +Ethernet80 38 Ethernet80 +Ethernet84 37 Ethernet84 +Ethernet88 40 Ethernet88 +Ethernet92 39 Ethernet92 +Ethernet96 42 Ethernet96 +Ethernet100 41 Ethernet100 +Ethernet104 44 Ethernet104 +Ethernet108 43 Ethernet108 +Ethernet112 50 Ethernet112 +Ethernet116 49 Ethernet116 +Ethernet120 52 Ethernet120 +Ethernet124 51 Ethernet124 +Ethernet128 54 Ethernet128 +Ethernet132 53 Ethernet132 +Ethernet136 56 Ethernet136 +Ethernet140 55 Ethernet140 +Ethernet144 66 Ethernet144 +Ethernet148 65 Ethernet148 +Ethernet152 68 Ethernet152 +Ethernet156 67 Ethernet156 +Ethernet160 70 Ethernet160 +Ethernet164 69 Ethernet164 +Ethernet168 72 Ethernet168 +Ethernet172 71 Ethernet172 +Ethernet176 82 Ethernet176 +Ethernet180 81 Ethernet180 +Ethernet184 84 Ethernet184 +Ethernet188 83 Ethernet188 +Ethernet192 85,86,87,88 Ethernet192 +Ethernet196 97,98,99,100 Ethernet196 +Ethernet200 105,106,107,108 Ethernet200 +Ethernet204 101,102,103,104 Ethernet204 +Ethernet208 117,118,119,120 Ethernet208 +Ethernet212 109,110,111,112 Ethernet212 From 9f54aed9cf328ecbb65556fd40a9cbd9d16da11e Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 14 Dec 2017 00:40:33 -0800 Subject: [PATCH 0988/1833] [sonic-utilities]: update sonic-utilities submodule (#1237) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index be91f161b290..8677d5f457c9 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit be91f161b290328773b98f1e21f7feee797ce91c +Subproject commit 8677d5f457c9a20f0fac2a4fdde569a8338c77e3 From 1c0c3ff7a9ae0d17ebb3cabed9df8952e4f408c3 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 14 Dec 2017 17:34:58 -0800 Subject: [PATCH 0989/1833] [Dell S6100]: EEPROM plugin overrides serial_number_str() to return service tag instead of serial number (#1239) * [Dell S6100]: EEPROM plugin overrides serial_number_str() to return service tag instead of serial number * Refactor to simplify --- .../dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py index 6af56578c682..7265b90efb1f 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/eeprom.py @@ -21,3 +21,13 @@ def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0050/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) + def serial_number_str(self, e): + """Return service tag instead of serial number""" + + (is_valid, results) = self.get_tlv_field(e, self._TLV_CODE_SERVICE_TAG) + if is_valid == False: + return "Bad service tag" + + # 'results' is a list containing 3 elements, type (int), length (int), + # and value (string) of the requested TLV + return results[2] From db7f173f23469f500187cf087fbbf656c1a7db2d Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Fri, 15 Dec 2017 16:59:41 +0800 Subject: [PATCH 0990/1833] [Accton AS7712] Add sfp reset in driver and sfputil.py. (#1241) Signed-off-by: roylee123 --- .../plugins/sfputil.py | 32 +++++++++++++++---- .../broadcom/sonic-platform-modules-accton | 2 +- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py index c13eecfd1759..1f2a66d64ccd 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py @@ -1,6 +1,7 @@ #!/usr/bin/env python try: + import time from sonic_sfp.sfputilbase import SfpUtilBase except ImportError, e: raise ImportError (str(e) + "- required module not found") @@ -59,14 +60,33 @@ def __init__(self): SfpUtilBase.__init__(self) def reset(self, port_num): - return True + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + #toggle reset + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + return True + def set_low_power_mode(self, port_nuM, lpmode): - return True - def get_low_power_mode(self, port_num): - return True + raise NotImplementedErro -# def get_presence(self, port_num): -# return True + def get_low_power_mode(self, port_num): + raise NotImplementedErro def get_presence(self, port_num): # Check for invalid port_num diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index edfb5b2c1285..7ba26ec403c7 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit edfb5b2c1285cbfd30d8a662ab738aee53a80439 +Subproject commit 7ba26ec403c7f0d0acb958f794311ac3fd1af9a1 From 46a653485c034b0b78869463aab14517eeefb4db Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 15 Dec 2017 16:39:15 -0800 Subject: [PATCH 0991/1833] [device/Arista] Add fancontrol config for all Arista platforms (#1242) * Rename i2c busses for a7060cx-32 platform * Update fancontrol for a7260cx3-64 * Add fancontrol for a7050qx-32 * Add fancontrol for a7050qx-32s * Add fancontrol for a7060cx-32s --- device/arista/x86_64-arista_7050_qx32/fancontrol | 10 ++++++++++ device/arista/x86_64-arista_7050_qx32s/fancontrol | 10 ++++++++++ device/arista/x86_64-arista_7060_cx32s/fancontrol | 10 ++++++++++ device/arista/x86_64-arista_7060_cx32s/sensors.conf | 10 +++++----- device/arista/x86_64-arista_7260cx3_64/fancontrol | 6 +++--- 5 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32/fancontrol create mode 100644 device/arista/x86_64-arista_7050_qx32s/fancontrol create mode 100644 device/arista/x86_64-arista_7060_cx32s/fancontrol diff --git a/device/arista/x86_64-arista_7050_qx32/fancontrol b/device/arista/x86_64-arista_7050_qx32/fancontrol new file mode 100644 index 000000000000..02bf4d76dbec --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=5 +DEVPATH=hwmon1=devices/platform/sb800-fans hwmon2=devices/pci0000:00/0000:00:09.0/0000:04:00.0/i2c-2/2-004c +DEVNAME=hwmon1=fans hwmon2=max6658 +FCTEMPS=hwmon1/pwm4=hwmon2/temp1_input hwmon1/pwm3=hwmon2/temp1_input hwmon1/pwm2=hwmon2/temp1_input hwmon1/pwm1=hwmon2/temp1_input +FCFANS=hwmon1/pwm4=hwmon1/fan4_input hwmon1/pwm3=hwmon1/fan3_input hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm1=hwmon1/fan1_input +MINTEMP=hwmon1/pwm4=30 hwmon1/pwm3=30 hwmon1/pwm2=30 hwmon1/pwm1=30 +MINPWM=hwmon1/pwm4=179 hwmon1/pwm3=179 hwmon1/pwm2=179 hwmon1/pwm1=179 +MAXTEMP=hwmon1/pwm4=40 hwmon1/pwm3=40 hwmon1/pwm2=40 hwmon1/pwm1=40 +MINSTART=hwmon1/pwm4=179 hwmon1/pwm3=179 hwmon1/pwm2=179 hwmon1/pwm1=179 +MINSTOP=hwmon1/pwm4=179 hwmon1/pwm3=179 hwmon1/pwm2=179 hwmon1/pwm1=179 diff --git a/device/arista/x86_64-arista_7050_qx32s/fancontrol b/device/arista/x86_64-arista_7050_qx32s/fancontrol new file mode 100644 index 000000000000..9c329897c9e4 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=5 +DEVPATH=hwmon2=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-2/2-004c hwmon4=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060 +DEVNAME=hwmon2=max6658 hwmon4=crow_cpld +FCTEMPS=hwmon4/pwm4=hwmon2/temp1_input hwmon4/pwm3=hwmon2/temp1_input hwmon4/pwm2=hwmon2/temp1_input hwmon4/pwm1=hwmon2/temp1_input +FCFANS=hwmon4/pwm4=hwmon4/fan4_input hwmon4/pwm3=hwmon4/fan3_input hwmon4/pwm2=hwmon4/fan2_input hwmon4/pwm1=hwmon4/fan1_input +MINTEMP=hwmon4/pwm4=35 hwmon4/pwm3=35 hwmon4/pwm2=35 hwmon4/pwm1=35 +MINPWM=hwmon4/pwm4=179 hwmon4/pwm3=179 hwmon4/pwm2=179 hwmon4/pwm1=179 +MAXTEMP=hwmon4/pwm4=45 hwmon4/pwm3=45 hwmon4/pwm2=45 hwmon4/pwm1=45 +MINSTART=hwmon4/pwm4=179 hwmon4/pwm3=179 hwmon4/pwm2=179 hwmon4/pwm1=179 +MINSTOP=hwmon4/pwm4=179 hwmon4/pwm3=179 hwmon4/pwm2=179 hwmon4/pwm1=179 diff --git a/device/arista/x86_64-arista_7060_cx32s/fancontrol b/device/arista/x86_64-arista_7060_cx32s/fancontrol new file mode 100644 index 000000000000..e69f9d75acda --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=5 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-2/2-001a hwmon3=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060 +DEVNAME=hwmon1=max6697 hwmon3=crow_cpld +FCTEMPS=hwmon3/pwm4=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input +FCFANS=hwmon3/pwm4=hwmon3/fan4_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm1=hwmon3/fan1_input +MINTEMP=hwmon3/pwm4=40 hwmon3/pwm3=40 hwmon3/pwm2=40 hwmon3/pwm1=40 +MINPWM=hwmon3/pwm4=179 hwmon3/pwm3=179 hwmon3/pwm2=179 hwmon3/pwm1=179 +MAXTEMP=hwmon3/pwm4=50 hwmon3/pwm3=50 hwmon3/pwm2=50 hwmon3/pwm1=50 +MINSTART=hwmon3/pwm4=179 hwmon3/pwm3=179 hwmon3/pwm2=179 hwmon3/pwm1=179 +MINSTOP=hwmon3/pwm4=179 hwmon3/pwm3=179 hwmon3/pwm2=179 hwmon3/pwm1=179 diff --git a/device/arista/x86_64-arista_7060_cx32s/sensors.conf b/device/arista/x86_64-arista_7060_cx32s/sensors.conf index 21b21fcb5d1c..7b548f8493e0 100644 --- a/device/arista/x86_64-arista_7060_cx32s/sensors.conf +++ b/device/arista/x86_64-arista_7060_cx32s/sensors.conf @@ -2,11 +2,11 @@ # ------------------------------------------------ # -bus "i2c-2" "SCD SMBus master 0 bus 0" -bus "i2c-3" "SCD SMBus master 0 bus 1" -bus "i2c-5" "SCD SMBus master 0 bus 3" -bus "i2c-6" "SCD SMBus master 0 bus 4" -bus "i2c-7" "SCD SMBus master 0 bus 5" +bus "i2c-2" "SCD 0000:02:00.0 SMBus master 0 bus 0" +bus "i2c-3" "SCD 0000:02:00.0 SMBus master 0 bus 1" +bus "i2c-5" "SCD 0000:02:00.0 SMBus master 0 bus 3" +bus "i2c-6" "SCD 0000:02:00.0 SMBus master 0 bus 4" +bus "i2c-7" "SCD 0000:02:00.0 SMBus master 0 bus 5" chip "k10temp-pci-00c3" label temp1 "Cpu temp sensor" diff --git a/device/arista/x86_64-arista_7260cx3_64/fancontrol b/device/arista/x86_64-arista_7260cx3_64/fancontrol index a9f3f97c051d..c78f598ff111 100644 --- a/device/arista/x86_64-arista_7260cx3_64/fancontrol +++ b/device/arista/x86_64-arista_7260cx3_64/fancontrol @@ -4,7 +4,7 @@ DEVNAME=hwmon1=max6658 hwmon3=rook_cpld FCTEMPS=hwmon3/pwm4=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input FCFANS=hwmon3/pwm4=hwmon3/fan4_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm1=hwmon3/fan1_input MINTEMP=hwmon3/pwm4=50 hwmon3/pwm3=50 hwmon3/pwm2=50 hwmon3/pwm1=50 -MINPWM=hwmon3/pwm4=102 hwmon3/pwm3=102 hwmon3/pwm2=102 hwmon3/pwm1=102 +MINPWM=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 MAXTEMP=hwmon3/pwm4=60 hwmon3/pwm3=60 hwmon3/pwm2=60 hwmon3/pwm1=60 -MINSTART=hwmon3/pwm4=102 hwmon3/pwm3=102 hwmon3/pwm2=102 hwmon3/pwm1=102 -MINSTOP=hwmon3/pwm4=102 hwmon3/pwm3=102 hwmon3/pwm2=102 hwmon3/pwm1=102 +MINSTART=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 +MINSTOP=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 From 2abdf8dc582ea03e4c19b8873d4d86493a01d22e Mon Sep 17 00:00:00 2001 From: Haiyang Zheng Date: Sat, 16 Dec 2017 11:28:18 -0800 Subject: [PATCH 0992/1833] [libteam] Add fallback support for single-member-port LAG (#1118) * [libteam] Add fallback support for single-member-port LAG * Allow the port to be selected if the LAG is configured with fallback and port is in defaulted state due to missing LACP PDUs from remote end * Only enable port if LAG is admin up and the member port is link up * [team] Add lacp fallback config to teamd.j2 template * [teamd] Resolve config conflict between fallback and minlink * Remove min_link config if fallback is configured * Add support for fallback config in minigraph * [teamd] Only enable fallback if it is single-member-port LAG Signed-off-by: Haiyang Zheng * [teamd] Removing the admin status check in lacp_port_link_update Will submit another pull request to fix this issue. Signed-off-by: Haiyang Zheng --- dockers/docker-teamd/teamd.j2 | 4 + ...-fallback-support-for-single-member-.patch | 104 ++++++++++++++++++ src/libteam/Makefile | 1 + src/sonic-config-engine/minigraph.py | 5 +- 4 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 index d9ea1b790f89..9f53534a808b 100644 --- a/dockers/docker-teamd/teamd.j2 +++ b/dockers/docker-teamd/teamd.j2 @@ -4,8 +4,12 @@ "runner": { "name": "lacp", "active": true, +{% if PORTCHANNEL[pc]['fallback'] and ((PORTCHANNEL[pc]['members'] | length) == 1) %} + "fallback": {{ PORTCHANNEL[pc]['fallback'] }}, +{% else %} {# Use 75% links upperbound as min-links #} "min_ports": {{ (PORTCHANNEL[pc]['members'] | length * 0.75) | round(0, 'ceil') | int }}, +{% endif %} "tx_hash": ["eth", "ipv4", "ipv6"] }, "link_watch": { diff --git a/src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch b/src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch new file mode 100644 index 000000000000..3139f83f33a4 --- /dev/null +++ b/src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch @@ -0,0 +1,104 @@ +From ec966f9a0229bd7226e3abe15b56659b36af9d66 Mon Sep 17 00:00:00 2001 +From: Haiyang Zheng +Date: Fri, 15 Dec 2017 21:07:53 -0800 +Subject: [patch libteam] [libteam] Add fallback support for single-member-port + LAG + +Signed-off-by: Haiyang Zheng +--- + teamd/teamd_runner_lacp.c | 42 ++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 40 insertions(+), 2 deletions(-) + +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 9c77fae..a3646a6 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -138,6 +138,8 @@ struct lacp { + #define LACP_CFG_DFLT_SYS_PRIO 0xffff + bool fast_rate; + #define LACP_CFG_DFLT_FAST_RATE false ++ bool fallback; ++#define LACP_CFG_DFLT_FALLBACK false + int min_ports; + #define LACP_CFG_DFLT_MIN_PORTS 1 + enum lacp_agg_select_policy agg_select_policy; +@@ -272,6 +274,11 @@ static int lacp_load_config(struct teamd_context *ctx, struct lacp *lacp) + lacp->cfg.fast_rate = LACP_CFG_DFLT_FAST_RATE; + teamd_log_dbg("Using fast_rate \"%d\".", lacp->cfg.fast_rate); + ++ err = teamd_config_bool_get(ctx, &lacp->cfg.fallback, "$.runner.fallback"); ++ if (err) ++ lacp->cfg.fallback = LACP_CFG_DFLT_FALLBACK; ++ teamd_log_dbg("Using fallback \"%d\".", lacp->cfg.fallback); ++ + err = teamd_config_int_get(ctx, &tmp, "$.runner.min_ports"); + if (err) { + lacp->cfg.min_ports = LACP_CFG_DFLT_MIN_PORTS; +@@ -308,9 +315,24 @@ static bool lacp_port_loopback_free(struct lacp_port *lacp_port) + return true; + } + ++/* ++ * is_lacp_fallback_eligible - is lacp_port eligible to go into lacp fallback mode ++ * ++ * Return true if it is, false otherwise ++ */ ++static bool is_lacp_fallback_eligible(struct lacp_port *lacp_port) ++{ ++ teamd_log_dbg("%s fallback eligible state \"%d \" cfg \"%d\".", ++ lacp_port->tdport->ifname, lacp_port->state, ++ lacp_port->lacp->cfg.fallback); ++ return lacp_port->state == PORT_STATE_DEFAULTED && ++ lacp_port->lacp->cfg.fallback; ++} ++ + static bool lacp_port_selectable_state(struct lacp_port *lacp_port) + { +- if (lacp_port->state == PORT_STATE_CURRENT) ++ if (lacp_port->state == PORT_STATE_CURRENT || ++ is_lacp_fallback_eligible(lacp_port)) + return true; + return false; + } +@@ -318,7 +340,8 @@ static bool lacp_port_selectable_state(struct lacp_port *lacp_port) + static bool lacp_port_unselectable_state(struct lacp_port *lacp_port) + { + if (lacp_port->state == PORT_STATE_CURRENT || +- lacp_port->state == PORT_STATE_EXPIRED) ++ lacp_port->state == PORT_STATE_EXPIRED || ++ is_lacp_fallback_eligible(lacp_port)) + return false; + return true; + } +@@ -1452,6 +1475,16 @@ static int lacp_state_fast_rate_get(struct teamd_context *ctx, + return 0; + } + ++static int lacp_state_fallback_get(struct teamd_context *ctx, ++ struct team_state_gsc *gsc, ++ void *priv) ++{ ++ struct lacp *lacp = priv; ++ ++ gsc->data.bool_val = lacp->cfg.fallback; ++ return 0; ++} ++ + static int lacp_state_select_policy_get(struct teamd_context *ctx, + struct team_state_gsc *gsc, + void *priv) +@@ -1479,6 +1512,11 @@ static const struct teamd_state_val lacp_state_vals[] = { + .getter = lacp_state_fast_rate_get, + }, + { ++ .subpath = "fallback", ++ .type = TEAMD_STATE_ITEM_TYPE_BOOL, ++ .getter = lacp_state_fallback_get, ++ }, ++ { + .subpath = "select_policy", + .type = TEAMD_STATE_ITEM_TYPE_STRING, + .getter = lacp_state_select_policy_get, +-- +2.7.4 + diff --git a/src/libteam/Makefile b/src/libteam/Makefile index c84250749477..c96266a5c7fd 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -18,6 +18,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : 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 popd # Obtain debian packaging diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index f33bd11f0b93..a7297913eb44 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -148,7 +148,10 @@ def parse_dpg(dpg, hname): pcmbr_list = pcintfmbr.split(';') for i, member in enumerate(pcmbr_list): pcmbr_list[i] = port_alias_map.get(member, member) - pcs[pcintfname] = {'members': pcmbr_list} + if pcintf.find(str(QName(ns, "Fallback"))) != None: + pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text} + else: + pcs[pcintfname] = {'members': pcmbr_list} vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) vlan_intfs = [] From 52e07979e22cc57586c97b4445f1af7887fd6368 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 17 Dec 2017 02:03:39 -0800 Subject: [PATCH 0993/1833] [broadcom]: update sai to 3.0.3.3-1 (#1243) add SAI_ROUTER_INTERFACE_ATTR_MTU support in broadcom SAI --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 6b1795f87ecc..4f806ebd97f1 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.3_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.3_amd64.deb?sv=2015-04-05&sr=b&sig=itlsEt8vqhWfZzuq%2FOSWSGgHN5kokf5a9AYOSJhD3t4%3D&se=2031-08-16T03%3A11%3A13Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.3-1_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.3-1_amd64.deb?sv=2015-04-05&sr=b&sig=hoUotiQsgVMo6%2BzH87aaIeTsqPsRYWQT5oRdSc1uEm8%3D&se=2154-11-09T08%3A09%3A33Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.3_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.3-1_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.3_amd64.deb?sv=2015-04-05&sr=b&sig=0DXLHgPXuMHERp44qJNNdQyYSv969sQsY7USCL6gCRw%3D&se=2031-08-16T03%3A10%3A49Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.3-1_amd64.deb?sv=2015-04-05&sr=b&sig=LfvM2LkGj3dPnSCyVEgPA35jvjKOgq%2FNSvj2UiPeGm4%3D&se=2154-11-09T08%3A11%3A03Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From c90e9be9688eeeacd96a58b2f58dedece6d72580 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 17 Dec 2017 02:04:32 -0800 Subject: [PATCH 0994/1833] [swss]: update swss submodule (#1244) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index ff9042962145..fab3cea5b075 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit ff904296214509d628ea868570f0b903ace8b146 +Subproject commit fab3cea5b075ccdd26eb6d56cc68d6325bfb8b16 From 0a4c8884efc96cce98404ec96ffd684bebeb69f0 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Tue, 19 Dec 2017 20:26:45 +0200 Subject: [PATCH 0995/1833] [sonic-py-swsssdk]: Update submodule pointer (#1253) Include commit that makes sdk compatible with python3.6 Signed-off-by: marian-pritsak --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 1c7a6b449644..a0418a15a46e 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 1c7a6b4496440a8a9e7e2ab314564ce8e26aa378 +Subproject commit a0418a15a46e20c3d8fcd7c8cf2bb6ab0a4aafaf From f0d59cb00299401e66015edb90744235a474b46b Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 19 Dec 2017 10:28:45 -0800 Subject: [PATCH 0996/1833] [DHCP relay]: Fix circuit ID and remote ID bugs (#1248) * [DHCP relay]: Fix circuit ID and remote ID bugs * Set circuit_id_len after setting circuit_id_len to ip->name --- ...ion-82-circuit-ID-and-remote-ID-fiel.patch | 65 ++++++++++--------- ...ining-name-of-physical-interface-tha.patch | 6 +- ...ing-port-alias-map-file-to-replace-p.patch | 34 ++++++---- 3 files changed, 61 insertions(+), 44 deletions(-) diff --git a/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch b/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch index 4d47c8185ece..22a8f7faedd1 100644 --- a/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch +++ b/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch @@ -1,14 +1,14 @@ -From 42319f1b56ba6362c874cd64383a055ba6498bee Mon Sep 17 00:00:00 2001 +From 284c87ff4b3873d0215904273fe3c86b07b4ba94 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 11 Dec 2017 23:21:08 +0000 Subject: [PATCH 1/3] Customizable Option 82 circuit ID and remote ID fields --- - relay/dhcrelay.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 147 insertions(+), 25 deletions(-) + relay/dhcrelay.c | 182 ++++++++++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 152 insertions(+), 30 deletions(-) diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index 15b4997..a26efca 100644 +index 15b4997..b9f8326 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -73,6 +73,8 @@ int bad_circuit_id = 0; /* Circuit ID option in matching RAI option @@ -158,9 +158,12 @@ index 15b4997..a26efca 100644 * Examine a packet to see if it's a candidate to have a Relay * Agent Information option tacked onto its tail. If it is, tack * the option on. -@@ -948,6 +1044,9 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, +@@ -946,8 +1042,11 @@ static int + add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, + unsigned length, struct in_addr giaddr) { int is_dhcp = 0, mms; - unsigned optlen; +- unsigned optlen; ++ unsigned optlen = 0; u_int8_t *op, *nextop, *sp, *max, *end_pad = NULL; + char circuit_id_buf[256] = { '\0' }; + char remote_id_buf[256] = { '\0' }; @@ -177,16 +180,32 @@ index 15b4997..a26efca 100644 - log_fatal("Circuit ID length %d out of range [1-255] on " - "%s\n", ip->circuit_id_len, ip->name); - optlen = ip->circuit_id_len + 2; /* RAI_CIRCUIT_ID + len */ +- +- if (ip->remote_id) { +- if (ip->remote_id_len > 255 || ip->remote_id_len < 1) +- log_fatal("Remote ID length %d out of range [1-255] " +- "on %s\n", ip->circuit_id_len, ip->name); +- optlen += ip->remote_id_len + 2; /* RAI_REMOTE_ID + len */ +- } + /* option82: custom string for circuit_id */ + if (agent_circuit_id_fmt) { + circuit_id_len = format_relay_agent_rfc3046_msg(ip, packet, agent_circuit_id_fmt, + circuit_id_buf, sizeof(circuit_id_buf)); + -+ if (circuit_id_len == 0) ++ if (circuit_id_len == 0) { + strncpy(circuit_id_buf, ip->name, sizeof(ip->name)); ++ circuit_id_len = strlen(circuit_id_buf); ++ } ++ ++ /* Sanity check. Had better not ever happen. */ ++ if (circuit_id_len > 255 || circuit_id_len < 1) ++ log_fatal("Circuit ID length %d out of range [1-255] on %s\n", ++ (int)circuit_id_len, ip->name); ++ ++ optlen = circuit_id_len + 2; // RAI_CIRCUIT_ID + len + + //log_debug("Sending on %s option82:circuit_id='%s' (%d)", -+ // ip->name, circuit_id_buf, circuit_id_len); ++ // ip->name, circuit_id_buf, (int)circuit_id_len); + } + + /* option82: custom string for remote_id */ @@ -194,28 +213,15 @@ index 15b4997..a26efca 100644 + remote_id_len = format_relay_agent_rfc3046_msg(ip, packet, agent_remote_id_fmt, + remote_id_buf, sizeof(remote_id_buf)); + -+ //log_debug("Sending on %s option82:remote_id='%s' (%d)", -+ // ip->name, remote_id_buf, remote_id_len); -+ } ++ if (remote_id_len > 255 || remote_id_len < 1) ++ log_fatal("Remote ID length %d out of range [1-255] on %s\n", ++ (int)remote_id_len, ip->name); + -+ /* Sanity check. Had better not ever happen. */ -+ if (circuit_id_len > 255 || circuit_id_len < 1) -+ log_fatal("Circuit ID length %d out of range [1-255] on %s\n", -+ circuit_id_len, ip->name); ++ optlen += remote_id_len + 2; // RAI_REMOTE_ID + len + -+ optlen = circuit_id_len + 2; // RAI_CIRCUIT_ID + len - - if (ip->remote_id) { -- if (ip->remote_id_len > 255 || ip->remote_id_len < 1) -- log_fatal("Remote ID length %d out of range [1-255] " -- "on %s\n", ip->circuit_id_len, ip->name); -- optlen += ip->remote_id_len + 2; /* RAI_REMOTE_ID + len */ -+ if (remote_id_len > 255 || remote_id_len < 1) -+ log_fatal("Remote ID length %d out of range [1-255] on %s\n", -+ remote_id_len, ip->name); -+ -+ optlen += remote_id_len + 2; // RAI_REMOTE_ID + len - } ++ //log_debug("Sending on %s option82:remote_id='%s' (%d)", ++ // ip->name, remote_id_buf, (int)remote_id_len); ++ } - /* We do not support relay option fragmenting(multiple options to - * support an option data exceeding 255 bytes). @@ -250,7 +256,8 @@ index 15b4997..a26efca 100644 + sp += circuit_id_len; /* Copy in remote ID... */ - if (ip->remote_id) { +- if (ip->remote_id) { ++ if (remote_id_len > 0) { *sp++ = RAI_REMOTE_ID; - *sp++ = ip->remote_id_len; - memcpy(sp, ip->remote_id, ip->remote_id_len); diff --git a/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch b/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch index 87c9ba266cb1..ee85a7736287 100644 --- a/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch +++ b/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch @@ -1,4 +1,4 @@ -From 18ca48b7c307e1644f653df4c8503f4ce2677f62 Mon Sep 17 00:00:00 2001 +From caad3e05c31c9fad8cda378ce95a1969def771a2 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 11 Dec 2017 23:39:10 +0000 Subject: [PATCH 2/3] Support for obtaining name of physical interface that is @@ -9,7 +9,7 @@ Subject: [PATCH 2/3] Support for obtaining name of physical interface that is 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index a26efca..84ec79d 100644 +index b9f8326..8458ea9 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -758,6 +758,7 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, @@ -63,7 +63,7 @@ index a26efca..84ec79d 100644 + if (cmd != NULL) { + while (fgets(buf, sizeof(buf), cmd)) { + sscanf(buf, FDB_LINE_FORMAT, macAddr, interface, vlanid); -+ //log_debug("bridgefdbquery: macAddr:%s interface: %s vlanid %d", ++ //log_debug("bridgefdbquery: macAddr: %s interface: %s vlanid: %d", + // macAddr, interface, *vlanid); + } + pclose(cmd); diff --git a/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch b/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch index 216abf5ba7b7..7411e1c4ff3e 100644 --- a/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch +++ b/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch @@ -1,15 +1,15 @@ -From 3be065305283b90ddfef92a8736221cbf7cf06e0 Mon Sep 17 00:00:00 2001 +From 3a42b497716375c9347b51c3a28c5e91e7cd4cf4 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 12 Dec 2017 00:49:09 +0000 -Subject: [PATCH 3/3] Support for loading port alias map file to replace - port name with alias in circuit id +Subject: [PATCH 3/3] Support for loading port alias map file to replace port + name with alias in circuit id --- - relay/dhcrelay.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 102 insertions(+), 1 deletion(-) + relay/dhcrelay.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index 84ec79d..0b56e2d 100644 +index 8458ea9..15f0acf 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -122,6 +122,14 @@ static void setup_streams(void); @@ -81,24 +81,34 @@ index 84ec79d..0b56e2d 100644 return (0); } -@@ -1056,6 +1077,16 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack +@@ -1040,6 +1061,7 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack + */ + if (packet->htype && !packet->giaddr.s_addr) { + int ret = 0, vlanid = 0; ++ char ifalias[IFNAMSIZ] = { 0 }; + + ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr), + ifname, +@@ -1056,6 +1078,18 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack strncpy(ifname, ip->name, IFNAMSIZ); } + // Attempt to translate SONiC interface name to vendor alias -+ if (get_interface_alias_by_name(ip->name, ifname) < 0) { -+ //log_debug("Failed to retrieve alias for interface name '%s'. Defaulting to interface name.", ip->name); -+ strncpy(ifname, ip->name, IFNAMSIZ); ++ ret = get_interface_alias_by_name(ifname, ifalias); ++ if (ret < 0) { ++ //log_debug("Failed to retrieve alias for interface name '%s'. Defaulting to interface name.", ifname); + } + else { + //log_debug("Mapped interface name '%s' to alias '%s'. Adding as option 82 interface alias for MAC Address %s", -+ // ip->name, ifname, print_hw_addr (packet->htype, packet->hlen, packet->chaddr), ++ // ifname, ifalias, print_hw_addr (packet->htype, packet->hlen, packet->chaddr)); ++ ++ strncpy(ifname, ifalias, IFNAMSIZ); + } + str = ifname; } break; -@@ -1922,3 +1953,73 @@ dhcp_set_control_state(control_object_state_t oldstate, +@@ -1922,3 +1956,73 @@ dhcp_set_control_state(control_object_state_t oldstate, exit(0); } From 6e05b670700d8afd8c33f7df03cd5041f297db81 Mon Sep 17 00:00:00 2001 From: Phil Huang Date: Wed, 20 Dec 2017 07:41:48 +0800 Subject: [PATCH 0997/1833] [device/accton] Correct exception function name (#1249) NotImplementedErro(r) Signed-off-by: Phil Huang --- device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py index 1f2a66d64ccd..2e636292bfa9 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py @@ -83,10 +83,10 @@ def reset(self, port_num): return True def set_low_power_mode(self, port_nuM, lpmode): - raise NotImplementedErro + raise NotImplementedError def get_low_power_mode(self, port_num): - raise NotImplementedErro + raise NotImplementedError def get_presence(self, port_num): # Check for invalid port_num From ab2d066a4ddf4456b7946a504f29fde9889273a9 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 20 Dec 2017 02:02:26 +0200 Subject: [PATCH 0998/1833] [snmp]: Save S/N in state DB prior to starting service (#1246) snmp.service needs to read chassis serial number for one of its mibs. We save this value in state DB so that it is accessible from container. Signed-off-by: marian-pritsak --- files/build_templates/docker_image_ctl.j2 | 3 +++ files/build_templates/snmp.service.j2 | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index a7aee83c70e6..628964ec7b61 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -17,6 +17,9 @@ function postStartAction() sleep 1 done {%- endif %} +{%- if docker_container_name == "snmp" %} + docker exec -i database redis-cli -n 6 HSET 'DEVICE_METADATA|localhost' chassis_serial_number $(decode-syseeprom -s) +{%- endif %} } # Obtain our platform as we will mount directories with these names in each docker diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index 08c41a52a5f7..0c1558ad64aa 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -4,7 +4,6 @@ Requires=database.service swss.service After=database.service swss.service [Service] -User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start ExecStart=/usr/bin/{{docker_container_name}}.sh attach ExecStop=/usr/bin/{{docker_container_name}}.sh stop From 64602ad5b2294f2e1de6b0f1f1761fb7697b21a7 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 20 Dec 2017 11:22:08 -0800 Subject: [PATCH 0999/1833] [DHCP relay]: Add patch to always undef VLAN_TCI_PRESENT so as not to treat VLAN-tagged packets differently (#1254) --- ...N_TCI_PRESENT-so-as-not-to-treat-VLA.patch | 30 +++++++++++++++++++ ...on-82-circuit-ID-and-remote-ID-fiel.patch} | 4 +-- ...ning-name-of-physical-interface-tha.patch} | 4 +-- ...ng-port-alias-map-file-to-replace-p.patch} | 4 +-- src/isc-dhcp/patch/series | 7 +++-- 5 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 src/isc-dhcp/patch/0001-Always-undef-VLAN_TCI_PRESENT-so-as-not-to-treat-VLA.patch rename src/isc-dhcp/patch/{0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch => 0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch} (98%) rename src/isc-dhcp/patch/{0002-Support-for-obtaining-name-of-physical-interface-tha.patch => 0003-Support-for-obtaining-name-of-physical-interface-tha.patch} (96%) rename src/isc-dhcp/patch/{0003-Support-for-loading-port-alias-map-file-to-replace-p.patch => 0004-Support-for-loading-port-alias-map-file-to-replace-p.patch} (98%) diff --git a/src/isc-dhcp/patch/0001-Always-undef-VLAN_TCI_PRESENT-so-as-not-to-treat-VLA.patch b/src/isc-dhcp/patch/0001-Always-undef-VLAN_TCI_PRESENT-so-as-not-to-treat-VLA.patch new file mode 100644 index 000000000000..f5afc5692a5d --- /dev/null +++ b/src/isc-dhcp/patch/0001-Always-undef-VLAN_TCI_PRESENT-so-as-not-to-treat-VLA.patch @@ -0,0 +1,30 @@ +From 7fe46584c3d9cb6b1ecdee47ff5ac2b777f96ec6 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Wed, 20 Dec 2017 02:18:10 +0000 +Subject: [PATCH 1/4] Always undef VLAN_TCI_PRESENT so as not to treat + VLAN-tagged packets differently + +--- + configure.ac | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 3f1415b..fcfeba0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -600,9 +600,9 @@ AC_CHECK_MEMBER(struct msghdr.msg_control,, + #include + ]) + +-AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci, +- [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])] +- ,, [#include ]) ++#AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci, ++# [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])] ++# ,, [#include ]) + + libbind= + AC_ARG_WITH(libbind, +-- +2.1.4 + diff --git a/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch b/src/isc-dhcp/patch/0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch similarity index 98% rename from src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch rename to src/isc-dhcp/patch/0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch index 22a8f7faedd1..33197a80b0e0 100644 --- a/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch +++ b/src/isc-dhcp/patch/0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch @@ -1,7 +1,7 @@ -From 284c87ff4b3873d0215904273fe3c86b07b4ba94 Mon Sep 17 00:00:00 2001 +From c2361e2bf24408cc21a4691c3897cc64c95372f1 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 11 Dec 2017 23:21:08 +0000 -Subject: [PATCH 1/3] Customizable Option 82 circuit ID and remote ID fields +Subject: [PATCH 2/4] Customizable Option 82 circuit ID and remote ID fields --- relay/dhcrelay.c | 182 ++++++++++++++++++++++++++++++++++++++++++++++--------- diff --git a/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch b/src/isc-dhcp/patch/0003-Support-for-obtaining-name-of-physical-interface-tha.patch similarity index 96% rename from src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch rename to src/isc-dhcp/patch/0003-Support-for-obtaining-name-of-physical-interface-tha.patch index ee85a7736287..7d9169dc67af 100644 --- a/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch +++ b/src/isc-dhcp/patch/0003-Support-for-obtaining-name-of-physical-interface-tha.patch @@ -1,7 +1,7 @@ -From caad3e05c31c9fad8cda378ce95a1969def771a2 Mon Sep 17 00:00:00 2001 +From 236d4f1cb0afa2bee22f47a48b725427bfcb5a9c Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 11 Dec 2017 23:39:10 +0000 -Subject: [PATCH 2/3] Support for obtaining name of physical interface that is +Subject: [PATCH 3/4] Support for obtaining name of physical interface that is a member of a bridge interface --- diff --git a/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch b/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch similarity index 98% rename from src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch rename to src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch index 7411e1c4ff3e..1d42e9838f96 100644 --- a/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch +++ b/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch @@ -1,7 +1,7 @@ -From 3a42b497716375c9347b51c3a28c5e91e7cd4cf4 Mon Sep 17 00:00:00 2001 +From 1092578a8415b9d49182c2b9825753e96481246a Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 12 Dec 2017 00:49:09 +0000 -Subject: [PATCH 3/3] Support for loading port alias map file to replace port +Subject: [PATCH 4/4] Support for loading port alias map file to replace port name with alias in circuit id --- diff --git a/src/isc-dhcp/patch/series b/src/isc-dhcp/patch/series index a896563077c2..980b9b97e34b 100644 --- a/src/isc-dhcp/patch/series +++ b/src/isc-dhcp/patch/series @@ -1,4 +1,5 @@ # This series applies on GIT commit ee3dffdda38a8cfc6ad2005d8d64a165d2a709ba -0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch -0002-Support-for-obtaining-name-of-physical-interface-tha.patch -0003-Support-for-loading-port-alias-map-file-to-replace-p.patch +0001-Always-undef-VLAN_TCI_PRESENT-so-as-not-to-treat-VLA.patch +0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch +0003-Support-for-obtaining-name-of-physical-interface-tha.patch +0004-Support-for-loading-port-alias-map-file-to-replace-p.patch From b57cfd72957ade0056406b083e7a2a64c78d1038 Mon Sep 17 00:00:00 2001 From: yurypm Date: Wed, 20 Dec 2017 22:05:23 +0000 Subject: [PATCH 1000/1833] [arista] Delete sysfs entries for all Arista Digital Power Monitor/Management devices (#1256) * Bump sonic-platform-modules-arista submodule * [arista] Remove DPM entries from Arista sensors.conf files --- device/arista/x86_64-arista_7050_qx32s/sensors.conf | 8 -------- device/arista/x86_64-arista_7060_cx32s/sensors.conf | 8 -------- platform/broadcom/sonic-platform-modules-arista | 2 +- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32s/sensors.conf b/device/arista/x86_64-arista_7050_qx32s/sensors.conf index cf4977f1cc12..9c2dd38597a3 100644 --- a/device/arista/x86_64-arista_7050_qx32s/sensors.conf +++ b/device/arista/x86_64-arista_7050_qx32s/sensors.conf @@ -29,14 +29,6 @@ chip "max6658-i2c-3-4c" set temp2_max 75 set temp2_crit 80 -chip "pmbus-i2c-3-4e" - label temp1 "Power controller 1 sensor 1" - label temp2 "Power controller 1 sensor 2" - -chip "pmbus-i2c-7-4e" - label temp1 "Power controller 2 sensor 1" - label temp2 "Power controller 2 sensor 2" - chip "pmbus-i2c-6-58" label temp1 "Power supply 1 hotspot sensor" label temp2 "Power supply 1 inlet temp sensor" diff --git a/device/arista/x86_64-arista_7060_cx32s/sensors.conf b/device/arista/x86_64-arista_7060_cx32s/sensors.conf index 7b548f8493e0..57e785881912 100644 --- a/device/arista/x86_64-arista_7060_cx32s/sensors.conf +++ b/device/arista/x86_64-arista_7060_cx32s/sensors.conf @@ -40,14 +40,6 @@ chip "max6658-i2c-3-4c" set temp2_max 75 set temp2_crit 80 -chip "pmbus-i2c-3-4e" - label temp1 "Power controller 1 sensor 1" - label temp2 "Power controller 1 sensor 2" - -chip "pmbus-i2c-7-4e" - label temp1 "Power controller 2 sensor 1" - label temp2 "Power controller 2 sensor 2" - chip "pmbus-i2c-6-58" label temp1 "Power supply 1 hotspot sensor" label temp2 "Power supply 1 inlet temp sensor" diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 8b8411551faa..62b5b7da50f2 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 8b8411551faab9e44aa1f66dae507e3d92ecf468 +Subproject commit 62b5b7da50f29d4299aaca69bdb40bf9172bb4e6 From ee58ee2067cf48f8993e90c64fc45d5f3884eea3 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 20 Dec 2017 15:25:04 -0800 Subject: [PATCH 1001/1833] [build] make second Accton Debian package extra package of the first one (#1257) Both packages are built with a single build command. We only have to take the second one after the first one is built. --- platform/broadcom/platform-modules-accton.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index 6a2bf8c04b6f..7030ecb441f7 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -13,7 +13,6 @@ $(ACCTON_AS7712_32X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7712_32x-r0 SONIC_DPKG_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) ACCTON_AS5712_54X_PLATFORM_MODULE = sonic-platform-accton-as5712-54x_$(ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION)_amd64.deb -$(ACCTON_AS5712_54X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton -$(ACCTON_AS5712_54X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(ACCTON_AS5712_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as5712_54x-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS5712_54X_PLATFORM_MODULE))) SONIC_DPKG_DEBS += $(ACCTON_AS5712_54X_PLATFORM_MODULE) From eadd74fb8416b1e3dd00c0fd967ff52182282ada Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 20 Dec 2017 15:25:30 -0800 Subject: [PATCH 1002/1833] [build] allow user to override the default number of build jobs (#1255) User could issue SONIC_BUILD_JOBS= to set number of concurrent build job(s) to run. With this commit, the default setting is still left at 1. --- Makefile | 4 +++- slave.mk | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d1a28f031748..0adcbb99fa66 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ # * PASSWORD: Desired password -- default at rules/config # * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes. # * SOURCE_FOLDER: host path to be mount as /var/src, only effective when KEEP_SLAVE_ON=yes +# * SONIC_BUILD_JOB: Specifying number of concurrent build job(s) to run # ############################################################################### @@ -59,7 +60,8 @@ SONIC_BUILD_INSTRUCTION := make \ SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ PASSWORD=$(PASSWORD) \ - USERNAME=$(USERNAME) + USERNAME=$(USERNAME) \ + SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) .PHONY: sonic-slave-build sonic-slave-bash init diff --git a/slave.mk b/slave.mk index 8ec6832bd687..4843faee5066 100644 --- a/slave.mk +++ b/slave.mk @@ -74,7 +74,11 @@ ifeq ($(PASSWORD),) override PASSWORD := $(DEFAULT_PASSWORD) endif -MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) +ifeq ($(SONIC_BUILD_JOBS),) +override SONIC_BUILD_JOBS := $(SONIC_CONFIG_BUILD_JOBS) +endif + +MAKEFLAGS += -j $(SONIC_BUILD_JOBS) export SONIC_CONFIG_MAKE_JOBS ############################################################################### @@ -86,7 +90,7 @@ $(info ) $(info Build Configuration) $(info "CONFIGURED_PLATFORM" : "$(if $(PLATFORM),$(PLATFORM),$(CONFIGURED_PLATFORM))") $(info "SONIC_CONFIG_PRINT_DEPENDENCIES" : "$(SONIC_CONFIG_PRINT_DEPENDENCIES)") -$(info "SONIC_CONFIG_BUILD_JOBS" : "$(SONIC_CONFIG_BUILD_JOBS)") +$(info "SONIC_BUILD_JOBS" : "$(SONIC_BUILD_JOBS)") $(info "SONIC_CONFIG_MAKE_JOBS" : "$(SONIC_CONFIG_MAKE_JOBS)") $(info "DEFAULT_USERNAME" : "$(DEFAULT_USERNAME)") $(info "DEFAULT_PASSWORD" : "$(DEFAULT_PASSWORD)") From db49660b868b81cdc16e8d80f60e8ee3a8871466 Mon Sep 17 00:00:00 2001 From: jostar-yang Date: Thu, 21 Dec 2017 17:54:32 +0800 Subject: [PATCH 1003/1833] Add set/get lpmode and mode_rst feature for qsfp (#1261) * Add lpmode set/get . mode_reset feature for qsfp * Add lp mode, set/get and mode_rst feature for sfp --- .../plugins/sfputil.py | 76 +++++++++++++++++-- .../broadcom/sonic-platform-modules-accton | 2 +- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py index c9862957bf31..d554910ac5cd 100755 --- a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py @@ -16,12 +16,13 @@ class SfpUtil(SfpUtilBase): PORT_START = 0 PORT_END = 71 PORTS_IN_BLOCK = 72 - QSFP_PORT_START = 72 + QSFP_PORT_START = 48 QSFP_PORT_END = 72 BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/" _port_to_is_present = {} + _port_to_lp_mode = {} _port_to_eeprom_mapping = {} _port_to_i2c_mapping = { @@ -107,6 +108,14 @@ def port_start(self): def port_end(self): return self.PORT_END + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + @property def qsfp_ports(self): return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @@ -148,11 +157,66 @@ def get_presence(self, port_num): return False - def get_low_power_mode(self, port_num): - raise NotImplementedError + def get_low_power_mode(self, port_num): + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode" + self.__port_to_lp_mode = lp_mode_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + + try: + val_file = open(self.__port_to_lp_mode) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True - def set_low_power_mode(self, port_num, lpmode): - raise NotImplementedError + return False + + def set_low_power_mode(self, port_num, lpmode): + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode" + self.__port_to_lp_mode = lp_mode_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + + try: + reg_file = open(self.__port_to_lp_mode, 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + if lpmode is True: + reg_value = '1' + else: + reg_value = '0' + + reg_file.write(reg_value) + reg_file.close() + + return True def reset(self, port_num): - raise NotImplementedError + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + mod_rst_path = self.BASE_VAL_PATH + "sfp_mod_rst" + self.__port_to_mod_rst = mod_rst_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1]) + try: + reg_file = open(self.__port_to_mod_rst, 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = '1' + + reg_file.write(reg_value) + reg_file.close() + + return True \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index 7ba26ec403c7..7c39d916d2b5 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit 7ba26ec403c7f0d0acb958f794311ac3fd1af9a1 +Subproject commit 7c39d916d2b5d248c8067669e72b75ed7240b348 From c898a04b28f58f7ba6ea0b6268cbf038fb7f12cd Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 21 Dec 2017 11:03:08 -0800 Subject: [PATCH 1004/1833] [sudoers] Add 'docker ps' to READ_ONLY_CMDS (#1259) --- files/image_config/sudoers/sudoers | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 715a1979f1ab..317ace3bf99f 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -21,6 +21,7 @@ Cmnd_Alias READ_ONLY_CMDS = /usr/bin/decode-syseeprom, \ /usr/bin/docker images *, \ /usr/bin/docker exec -it snmp cat /etc/snmp/snmpd.conf, \ /usr/bin/docker exec -it bgp cat /etc/quagga/bgpd.conf, \ + /usr/bin/docker ps, \ /usr/bin/generate_dump, \ /usr/bin/lldpctl, \ /usr/bin/lldpshow, \ From ee73cdec26afae23ba2a712a5c5815b1c958d827 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 21 Dec 2017 11:15:06 -0800 Subject: [PATCH 1005/1833] Add 'make reset' target with warning prompt to reset git repo and submodules (#1258) --- Makefile | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0adcbb99fa66..8d864e914aa2 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ SONIC_BUILD_INSTRUCTION := make \ USERNAME=$(USERNAME) \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) -.PHONY: sonic-slave-build sonic-slave-bash init +.PHONY: sonic-slave-build sonic-slave-bash init reset .DEFAULT_GOAL := all @@ -98,5 +98,18 @@ sonic-slave-bash : @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash init : - git submodule update --init --recursive - git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' + @git submodule update --init --recursive + @git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' + +reset : + @echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: " + @read ans && \ + if [ $$ans == y ]; then \ + git clean -xfdf; \ + git reset --hard; \ + git submodule foreach --recursive git clean -xfdf; \ + git submodule foreach --recursive git reset --hard; \ + git submodule update --init --recursive;\ + else \ + echo "Reset aborted"; \ + fi From 63de341dd605585a126d233b66858a4194600ff2 Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Sat, 23 Dec 2017 02:04:29 +0800 Subject: [PATCH 1006/1833] [Platform] Add Ingrasys S9130-32X and S9230-64X with Nephos Switch ASIC (#1245) * Add switch ASIC vendor and platforms for Nephos - What I did Add switch ASIC vendor: Nephos Add Nephos platforms: Ingrasys S9130-32X, Ingrasys S9230-64X - How I did it Add platform/nephos files Add platform/nephos/sonic-platform-modules-ingrasys submodule Add device/ingrasys/x86_64-ingrasys_s9130_32x-r0 files Add device/ingrasys/x86_64-ingrasys_s9230_64x-r0 files Add SONiC to support Nephos platform - How to verify it To build SONiC installer image and docker images, run the following commands: make configure PLATFORM=nephos make target/sonic-nephos.bin Check system and network feature is worked as well - Description for the changelog Add switch ASIC vendor and platforms for Nephos - A picture of a cute animal (not mandatory but encouraged) Signed-off-by: Sam Yang * Advance sonic-sairedis submodule to include #271 (Add Nephos ASIC) --- .gitmodules | 3 + README.md | 3 + build_debian.sh | 3 + .../INGRASYS-S9130-32X/port_config.ini | 33 ++ .../INGRASYS-S9130-32X/port_config.nps | 0 .../INGRASYS-S9130-32X/sai.profile | 2 + .../x86_64-ingrasys_s9130_32x-r0/fancontrol | 12 + .../installer.conf | 3 + .../led_proc_init.nps | 20 ++ .../minigraph.xml | 151 +++++++++ .../plugins/eeprom.py | 22 ++ .../plugins/sfputil.py | 187 +++++++++++ .../x86_64-ingrasys_s9130_32x-r0/sensors.conf | 69 +++++ .../INGRASYS-S9230-64X/port_config.ini | 65 ++++ .../INGRASYS-S9230-64X/port_config.nps | 0 .../INGRASYS-S9230-64X/sai.profile | 2 + .../x86_64-ingrasys_s9230_64x-r0/fancontrol | 9 + .../installer.conf | 3 + .../led_proc_init.nps | 20 ++ .../minigraph.xml | 151 +++++++++ .../plugins/eeprom.py | 22 ++ .../plugins/psuutil.py | 92 ++++++ .../plugins/sfputil.py | 293 ++++++++++++++++++ .../x86_64-ingrasys_s9230_64x-r0/sensors.conf | 90 ++++++ dockers/docker-orchagent-nephos | 1 + dockers/docker-orchagent/orchagent.sh | 2 + files/build_templates/swss.service.j2 | 4 + platform/nephos/docker-orchagent-nephos.mk | 19 ++ platform/nephos/docker-ptf-nephos.mk | 7 + platform/nephos/docker-syncd-nephos-rpc.mk | 17 + .../docker-syncd-nephos-rpc/Dockerfile.j2 | 51 +++ .../docker-syncd-nephos-rpc/ptf_nn_agent.conf | 10 + platform/nephos/docker-syncd-nephos.mk | 19 ++ .../nephos/docker-syncd-nephos/Dockerfile.j2 | 31 ++ .../base_image_files/npx_diag | 3 + platform/nephos/docker-syncd-nephos/start.sh | 7 + .../docker-syncd-nephos/supervisord.conf | 28 ++ platform/nephos/libsaithrift-dev.mk | 7 + platform/nephos/one-image.mk | 10 + platform/nephos/platform-modules-ingrasys.mk | 18 ++ platform/nephos/platform.conf | 0 platform/nephos/python-saithrift.mk | 6 + platform/nephos/rules.mk | 26 ++ platform/nephos/sai.mk | 9 + platform/nephos/sdk.mk | 4 + .../nephos/sonic-platform-modules-ingrasys | 1 + rules/ixgbe.mk | 8 + slave.mk | 1 + src/ixgbe/Makefile | 22 ++ src/sonic-sairedis | 2 +- 50 files changed, 1567 insertions(+), 1 deletion(-) create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.ini create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/sai.profile create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/fancontrol create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/installer.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/sensors.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.ini create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/sai.profile create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/fancontrol create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/installer.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf create mode 120000 dockers/docker-orchagent-nephos create mode 100644 platform/nephos/docker-orchagent-nephos.mk create mode 100644 platform/nephos/docker-ptf-nephos.mk create mode 100644 platform/nephos/docker-syncd-nephos-rpc.mk create mode 100644 platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 create mode 100644 platform/nephos/docker-syncd-nephos-rpc/ptf_nn_agent.conf create mode 100644 platform/nephos/docker-syncd-nephos.mk create mode 100755 platform/nephos/docker-syncd-nephos/Dockerfile.j2 create mode 100755 platform/nephos/docker-syncd-nephos/base_image_files/npx_diag create mode 100755 platform/nephos/docker-syncd-nephos/start.sh create mode 100644 platform/nephos/docker-syncd-nephos/supervisord.conf create mode 100644 platform/nephos/libsaithrift-dev.mk create mode 100644 platform/nephos/one-image.mk create mode 100644 platform/nephos/platform-modules-ingrasys.mk create mode 100644 platform/nephos/platform.conf create mode 100644 platform/nephos/python-saithrift.mk create mode 100644 platform/nephos/rules.mk create mode 100644 platform/nephos/sai.mk create mode 100644 platform/nephos/sdk.mk create mode 160000 platform/nephos/sonic-platform-modules-ingrasys create mode 100644 rules/ixgbe.mk create mode 100644 src/ixgbe/Makefile diff --git a/.gitmodules b/.gitmodules index 26763fb16012..1c7a6da0281d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -68,3 +68,6 @@ [submodule "platform/p4/SAI-P4-BM"] path = platform/p4/SAI-P4-BM url = https://github.com/Mellanox/SAI-P4-BM.git +[submodule "platform/nephos/sonic-platform-modules-ingrasys"] + path = platform/nephos/sonic-platform-modules-ingrasys + url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys-nephos.git diff --git a/README.md b/README.md index 5ba616c027e0..0a361e38abec 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ The SONiC installer contains all docker images needed. SONiC uses one image for - PLATFORM=mellanox - PLATFORM=cavium - PLATFORM=centec +- PLATFORM=nephos - PLATFORM=p4 - PLATFORM=vs @@ -96,9 +97,11 @@ This may take a while, but it is a one-time action, so please be patient. - docker-orchagent-brcm.gz: docker image for SWitch State Service (SWSS) on Broadcom platform (gzip tar archive) - docker-orchagent-cavm.gz: docker image for SWitch State Service (SWSS) on Cavium platform (gzip tar archive) - docker-orchagent-mlnx.gz: docker image for SWitch State Service (SWSS) on Mellanox platform (gzip tar archive) + - docker-orchagent-nephos.gz: docker image for SWitch State Service (SWSS) on Nephos platform (gzip tar archive) - docker-syncd-brcm.gz: docker image for the daemon to sync database and Broadcom switch ASIC (gzip tar archive) - docker-syncd-cavm.gz: docker image for the daemon to sync database and Cavium switch ASIC (gzip tar archive) - docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) + - docker-syncd-nephos.gz: docker image for the daemon to sync database and Nephos switch ASIC (gzip tar archive) - docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive) - docker-sonic-vs.gz: docker image for all-in-one for software virtual switch (gzip tar archive) diff --git a/build_debian.sh b/build_debian.sh index 0c765fdb6424..15bde44c112e 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -144,6 +144,9 @@ sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Install latest intel igb driver sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko +## Install latest intel ixgbe driver +sudo cp target/debs/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko + ## Install docker echo '[INFO] Install docker' ## Install apparmor utils since they're missing and apparmor is enabled in the kernel diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.ini new file mode 100644 index 000000000000..bb26684cb7da --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index +Ethernet0 0,1,2,3 Ethernet1/1 0 +Ethernet4 4,5,6,7 Ethernet2/1 1 +Ethernet8 8,9,10,11 Ethernet3/1 2 +Ethernet12 12,13,14,15 Ethernet4/1 3 +Ethernet16 16,17,18,19 Ethernet5/1 4 +Ethernet20 20,21,22,23 Ethernet6/1 5 +Ethernet24 24,25,26,27 Ethernet7/1 6 +Ethernet28 28,29,30,31 Ethernet8/1 7 +Ethernet32 32,33,34,35 Ethernet9/1 8 +Ethernet36 36,37,38,39 Ethernet10/1 9 +Ethernet40 40,41,42,43 Ethernet11/1 10 +Ethernet44 44,45,46,47 Ethernet12/1 11 +Ethernet48 48,49,50,51 Ethernet13/1 12 +Ethernet52 52,53,54,55 Ethernet14/1 13 +Ethernet56 56,57,58,59 Ethernet15/1 14 +Ethernet60 60,61,62,63 Ethernet16/1 15 +Ethernet64 64,65,66,67 Ethernet17/1 16 +Ethernet68 68,69,70,71 Ethernet18/1 17 +Ethernet72 72,73,74,75 Ethernet19/1 18 +Ethernet76 76,77,78,79 Ethernet20/1 19 +Ethernet80 80,81,82,83 Ethernet21/1 20 +Ethernet84 84,85,86,87 Ethernet22/1 21 +Ethernet88 88,89,90,91 Ethernet23/1 22 +Ethernet92 92,93,94,95 Ethernet24/1 23 +Ethernet96 96,97,98,99 Ethernet25/1 24 +Ethernet100 100,101,102,103 Ethernet26/1 25 +Ethernet104 104,105,106,107 Ethernet27/1 26 +Ethernet108 108,109,110,111 Ethernet28/1 27 +Ethernet112 112,113,114,115 Ethernet29/1 28 +Ethernet116 116,117,118,119 Ethernet30/1 29 +Ethernet120 120,121,122,123 Ethernet31/1 30 +Ethernet124 124,125,126,127 Ethernet32/1 31 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/sai.profile b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/sai.profile new file mode 100644 index 000000000000..880f47910ac1 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/led_proc_init.nps +SAI_DSH_CONFIG_FILE=/usr/share/sonic/hwsku/port_config.nps diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/fancontrol new file mode 100644 index 000000000000..5ed165966b93 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon5=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-8/8-002f +DEVNAME=hwmon5=w83795adg +FCTEMPS=hwmon5/device/pwm2=hwmon1/temp1_input hwmon5/device/pwm1=hwmon1/temp1_input +FCFANS=hwmon5/device/pwm2=hwmon5/device/fan8_input hwmon5/device/pwm2=hwmon5/device/fan7_input hwmon5/device/pwm2=hwmon5/device/fan6_input hwmon5/device/pwm2=hwmon5/device/fan5_input hwmon5/device/pwm1=hwmon5/device/fan4_input hwmon5/device/pwm1=hwmon5/device/fan3_input hwmon5/device/pwm1=hwmon5/device/fan2_input hwmon5/device/pwm1=hwmon5/device/fan1_input +# TODO: check the temp value with HW after board ready +MINTEMP=hwmon5/device/pwm2=20 hwmon5/device/pwm1=20 +MAXTEMP=hwmon5/device/pwm2=60 hwmon5/device/pwm1=60 +MINSTART=hwmon5/device/pwm2=75 hwmon5/device/pwm1=75 +MINSTOP=hwmon5/device/pwm2=22 hwmon5/device/pwm1=22 + diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps new file mode 100644 index 000000000000..b482a7a0b977 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps @@ -0,0 +1,20 @@ +#This configuration file is for customer init value feature. Please refer to mtk_cfg.h/mtk_cfg.c for detail. +#1. The lines beginning with # are comment lines. The lines beginning with number are the setting lines. +#2. There are five parameters which can be set. +# 1) the first is unit. +# 2) the second is NPS_CFG_TYPE_XXX. Refer to NPS_CFG_TYPE_T. +# 3) the 3-5 are {param0, param1, value} pairs. Refer to NPS_CFG_VALUE_T. Support HEX format. +# 4) the (unit, NPS_CFG_TYPE_XXX, param0, param1) group is the key to get the correspingding value. +# There should be no same (unit, NPS_CFG_TYPE_XXX, param0, param1) group. +#3. User must follow correct format to apply the setting. Please refer to below commentted example(#0 NPS_CFG_TYPE_L2_ADDR_MODE 0 0 1); +#4. Usage under the linux shell: +# 1) ./image-path/image-name -c cfg-path/NPS_Ari_EVB_24.cfg : mamually specify directory path if they are not in current work dirctory. +# 2) ./image-name -c NPS_Ari_EVB_24.cfg : the image and the NPS_Ari_EVB_24.cfg are in the current work directory. + +#unit NPS_CFG_TYPE_XXX param0 param1 value +#---- ---------------- ------ ------ ----- +0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 +0 NPS_CFG_TYPE_LED_CFG 0 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 0 +0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 0 +0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml new file mode 100644 index 000000000000..6b29a7eb83b8 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml @@ -0,0 +1,151 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + OCPSCH01040GGLF + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040GGLF + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + OCPSCH01040GGLF + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + OCPSCH01040GGLF + Ethernet4 + + + + + OCPSCH01040GGLF + INGRASYS-S9130-32X + + + + + + + OCPSCH01040GGLF + + + 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 + + + + + + + OCPSCH01040GGLF + INGRASYS-S9130-32X +
diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..0f47704ed2cb --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S9130-32X +# +# 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-0055/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..387c8155eef2 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py @@ -0,0 +1,187 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + EEPROM_OFFSET = 21 + ABS_GPIO_BASE_0_15 = 240 + ABS_GPIO_BASE_16_31 = 224 + LP_MODE_GPIO_BASE_0_15 = 176 + LP_MODE_GPIO_BASE_16_31 = 160 + RST_GPIO_BASE_0_15 = 144 + RST_GPIO_BASE_16_31 = 128 + + GPIO_VAL_PATH = "/sys/class/gpio/gpio{0}/value" + + _port_to_eeprom_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(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + + def __init__(self): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom' + for x in range(self.port_start, self.port_end + 1): + port_eeprom_path = eeprom_path.format(x + self.EEPROM_OFFSET) + self.port_to_eeprom_mapping[x] = port_eeprom_path + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # open corrsponding gpio file + try: + if port_num <= 15: + gpio_base = self.ABS_GPIO_BASE_0_15 + else : + gpio_base = self.ABS_GPIO_BASE_16_31 + gpio_index = gpio_base + (port_num % 16) + gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index) + gpio_file = open(gpio_file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the gpio value + gpio_val = int(gpio_file.readline().rstrip()) + gpio_file.close() + + # the gpio pin is ACTIVE_LOW but reversed + if gpio_val == 0: + return False + + return True + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # open corrsponding gpio file + try: + if port_num <= 15: + gpio_base = self.LP_MODE_GPIO_BASE_0_15 + else : + gpio_base = self.LP_MODE_GPIO_BASE_16_31 + gpio_index = gpio_base + (port_num % 16) + gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index) + gpio_file = open(gpio_file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the gpio value + gpio_val = int(gpio_file.readline().rstrip()) + gpio_file.close() + + if gpio_val == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # open corrsponding gpio file + try: + if port_num <= 15: + gpio_base = self.LP_MODE_GPIO_BASE_0_15 + else : + gpio_base = self.LP_MODE_GPIO_BASE_16_31 + gpio_index = gpio_base + (port_num % 16) + gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index) + gpio_file = open(gpio_file_path, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # the gpio pin is ACTIVE_HIGH + if lpmode is True: + gpio_val = "1" + else: + gpio_val = "0" + + # write value to gpio + gpio_file.seek(0) + gpio_file.write(gpio_val) + gpio_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # open corrsponding gpio file + try: + if port_num <= 15: + gpio_base = self.RST_GPIO_BASE_0_15 + else : + gpio_base = self.RST_GPIO_BASE_16_31 + gpio_index = gpio_base + (port_num % 16) + gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index) + gpio_file = open(gpio_file_path, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # set the gpio to take port into reset + # the gpio pin is ACTIVE_LOW but reversed + gpio_val = "1" + # write value to gpio + gpio_file.seek(0) + gpio_file.write(gpio_val) + gpio_file.close() + + # Sleep 1 second to let it settle + time.sleep(1) + + # open corrsponding gpio file + try: + gpio_file = open(gpio_file_path, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # set gpio back low to take port out of reset + # the gpio pin is ACTIVE_LOW but reversed + gpio_val = "0" + # write value to gpio + gpio_file.seek(0) + gpio_file.write(gpio_val) + gpio_file.close() + + return True diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/sensors.conf new file mode 100644 index 000000000000..9b55f73af2af --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/sensors.conf @@ -0,0 +1,69 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + +bus "i2c-8" "i2c-mux-0 (chan_id 7)" +chip "w83795adg-*" + label in0 "0.9V" + set in0_max 0.945 + set in0_min 0.855 + label in1 "VDD_CORE" + set in1_max 0.945 + set in1_min 0.855 + label in2 "1.2V" + set in2_max 1.26 + set in2_min 1.14 + label in3 "1.8V" + set in3_max 1.89 + set in3_min 1.71 + label in4 "1.01V" + set in4_max 1.0605 + set in4_min 0.9595 + ignore in5 + ignore in6 + ignore in7 + ignore in11 + label in12 "3.3VDD" + set in12_max 3.465 + set in12_min 3.135 + # in12 and in13 are the same source + ignore in13 + label fan1 "FANTRAY 1-A" + label fan2 "FANTRAY 1-B" + label fan3 "FANTRAY 2-A" + label fan4 "FANTRAY 2-B" + label fan5 "FANTRAY 3-A" + label fan6 "FANTRAY 3-B" + label fan7 "FANTRAY 4-A" + label fan8 "FANTRAY 4-B" + ignore temp1 + ignore temp2 + ignore temp3 + ignore temp4 + ignore temp5 + ignore temp6 + ignore intrusion0 + +chip "tmp75-i2c-*-4A" + label temp1 "BMC board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-0" "i2c-main" +chip "tmp75-i2c-*-4F" + label temp1 "x86 CPU board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-12" "i2c-mux-1 (chan_id 3)" +chip "tmp75-i2c-*-4C" + label temp1 "rear MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +chip "tmp75-i2c-*-49" + label temp1 "front MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.ini new file mode 100644 index 000000000000..ddd76b51167f --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias index +Ethernet0 7,6,5,4 Ethernet1/1 0 +Ethernet4 3,2,1,0 Ethernet2/1 1 +Ethernet8 15,14,13,12 Ethernet3/1 2 +Ethernet12 11,10,9,8 Ethernet4/1 3 +Ethernet16 23,22,21,20 Ethernet5/1 4 +Ethernet20 19,18,17,16 Ethernet6/1 5 +Ethernet24 31,30,29,28 Ethernet7/1 6 +Ethernet28 27,26,25,24 Ethernet8/1 7 +Ethernet32 39,38,37,36 Ethernet9/1 8 +Ethernet36 35,34,33,32 Ethernet10/1 9 +Ethernet40 47,46,45,44 Ethernet11/1 10 +Ethernet44 43,42,41,40 Ethernet12/1 11 +Ethernet48 55,54,53,52 Ethernet13/1 12 +Ethernet52 51,50,49,48 Ethernet14/1 13 +Ethernet56 63,62,61,60 Ethernet15/1 14 +Ethernet60 59,58,57,56 Ethernet16/1 15 +Ethernet64 71,70,69,68 Ethernet17/1 16 +Ethernet68 67,66,65,64 Ethernet18/1 17 +Ethernet72 79,78,77,76 Ethernet19/1 18 +Ethernet76 75,74,73,72 Ethernet20/1 19 +Ethernet80 87,86,85,84 Ethernet21/1 20 +Ethernet84 83,82,81,80 Ethernet22/1 21 +Ethernet88 95,94,93,92 Ethernet23/1 22 +Ethernet92 91,90,89,88 Ethernet24/1 23 +Ethernet96 97,98,99,100 Ethernet25/1 24 +Ethernet100 101,102,103,104 Ethernet26/1 25 +Ethernet104 105,106,107,108 Ethernet27/1 26 +Ethernet108 109,110,111,112 Ethernet28/1 27 +Ethernet112 119,118,117,116 Ethernet29/1 28 +Ethernet116 115,114,113,112 Ethernet30/1 29 +Ethernet120 127,126,125,124 Ethernet31/1 30 +Ethernet124 123,122,121,120 Ethernet32/1 31 +Ethernet128 135,134,133,132 Ethernet33/1 32 +Ethernet132 131,130,129,128 Ethernet34/1 33 +Ethernet136 143,142,141,140 Ethernet35/1 34 +Ethernet140 139,138,137,136 Ethernet36/1 35 +Ethernet144 151,150,149,148 Ethernet37/1 36 +Ethernet148 147,146,145,144 Ethernet38/1 37 +Ethernet152 159,158,157,156 Ethernet39/1 38 +Ethernet156 155,154,153,152 Ethernet40/1 39 +Ethernet160 167,166,165,164 Ethernet41/1 40 +Ethernet164 163,162,161,160 Ethernet42/1 41 +Ethernet168 175,174,173,172 Ethernet43/1 42 +Ethernet172 171,170,169,168 Ethernet44/1 43 +Ethernet176 183,182,181,180 Ethernet45/1 44 +Ethernet180 179,178,177,176 Ethernet46/1 45 +Ethernet184 191,190,189,188 Ethernet47/1 46 +Ethernet188 187,186,185,184 Ethernet48/1 47 +Ethernet192 199,198,197,196 Ethernet49/1 48 +Ethernet196 195,194,193,192 Ethernet50/1 49 +Ethernet200 207,206,205,204 Ethernet51/1 50 +Ethernet204 203,202,201,200 Ethernet52/1 51 +Ethernet208 215,214,213,212 Ethernet53/1 52 +Ethernet212 211,210,209,208 Ethernet54/1 53 +Ethernet216 223,222,221,220 Ethernet55/1 54 +Ethernet220 219,218,217,216 Ethernet56/1 55 +Ethernet224 231,230,229,228 Ethernet57/1 56 +Ethernet228 227,226,225,224 Ethernet58/1 57 +Ethernet232 239,238,237,236 Ethernet59/1 58 +Ethernet236 235,234,233,232 Ethernet60/1 59 +Ethernet240 247,246,245,244 Ethernet61/1 60 +Ethernet244 243,242,241,240 Ethernet62/1 61 +Ethernet248 255,254,253,252 Ethernet63/1 62 +Ethernet252 251,250,249,248 Ethernet64/1 63 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/sai.profile b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/sai.profile new file mode 100644 index 000000000000..880f47910ac1 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/led_proc_init.nps +SAI_DSH_CONFIG_FILE=/usr/share/sonic/hwsku/port_config.nps diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/fancontrol new file mode 100644 index 000000000000..86b4e636375f --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/fancontrol @@ -0,0 +1,9 @@ +INTERVAL=10 +DEVPATH=hwmon7=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-16/16-002f hwmon4=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-7/7-004e +DEVNAME=hwmon7=w83795adg +FCTEMPS=hwmon7/device/pwm2=hwmon4/temp1_input +FCFANS=hwmon7/device/pwm2=hwmon7/device/fan7_input hwmon7/device/pwm2=hwmon7/device/fan5_input hwmon7/device/pwm2=hwmon7/device/fan3_input hwmon7/device/pwm2=hwmon7/device/fan1_input +MINTEMP=hwmon7/device/pwm2=20 +MAXTEMP=hwmon7/device/pwm2=60 +MINSTART=hwmon7/device/pwm2=75 +MINSTOP=hwmon7/device/pwm2=22 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps new file mode 100644 index 000000000000..e6fe6721350e --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps @@ -0,0 +1,20 @@ +#This configuration file is for customer init value feature. Please refer to nps_cfg.h/nps_cfg.c for detail. +#1. The lines beginning with # are comment lines. The lines beginning with number are the setting lines. +#2. There are five parameters which can be set. +# 1) the first is unit. +# 2) the second is NPS_CFG_TYPE_XXX. Refer to NPS_CFG_TYPE_T. +# 3) the 3-5 are {param0, param1, value} pairs. Refer to NPS_CFG_VALUE_T. Support HEX format. +# 4) the (unit, NPS_CFG_TYPE_XXX, param0, param1) group is the key to get the correspingding value. +# There should be no same (unit, NPS_CFG_TYPE_XXX, param0, param1) group. +#3. User must follow correct format to apply the setting. Please refer to below commentted example(#0 NPS_CFG_TYPE_L2_ADDR_MODE 0 0 1); +#4. Usage under the linux shell: +# 1) ./image-path/image-name -c cfg-path/NPS_TAU_EVB_6T4_64.cfg : mamually specify directory path if they are not in current work dirctory. +# 2) ./image-name -c NPS_TAU_EVB_6T4_64.cfg : the image and the NPS_TAU_EVB_3T2_32.cfg are in the current work directory. + +#unit NPS_CFG_TYPE_XXX param0 param1 value +#---- ---------------- ------ ------ ----- +0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 +0 NPS_CFG_TYPE_LED_CFG 0 0 2 +0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 0 +0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 0 +0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml new file mode 100644 index 000000000000..9ac02997e44d --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml @@ -0,0 +1,151 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + OCPSCH01040GGLF + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040GGLF + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + OCPSCH01040GGLF + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + OCPSCH01040GGLF + Ethernet4 + + + + + OCPSCH01040GGLF + INGRASYS-S9230-64X + + + + + + + OCPSCH01040GGLF + + + 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 + + + + + + + OCPSCH01040GGLF + INGRASYS-S9230-64X +
diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..ab398102c9b5 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S9230-64X +# +# 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-0055/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..91d7de05dc84 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-17/17-0050", + "/sys/bus/i2c/devices/i2c-18/18-0050"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_pg' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_abs' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 0): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..70e5ebff403d --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py @@ -0,0 +1,293 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 63 + PORTS_IN_BLOCK = 64 + #TODO: modify according to port map + EEPROM_OFFSET = 33 + CPLD1_PORTS = 12 + CPLDx_PORTS = 13 + CPLD_OFFSET = 1 + CPLD_PRES_BIT = 1 + CPLD_RESET_BIT = 0 + CPLD_LPMOD_BIT = 2 + CPLDx_I2C_ADDR = "33" + CPLD_PORT_STATUS_KEY = "cpld_qsfp_port_status" + CPLD_PORT_CONFIG_KEY = "cpld_qsfp_port_config" + CPLD_REG_PATH = "/sys/bus/i2c/devices/{0}-00{1}/{2}_{3}" + + _port_to_eeprom_mapping = {} + + _logic_to_phy_port_mapping = { + 0: 0, + 1: 1, + 2: 4, + 3: 5, + 4: 8, + 5: 9, + 6: 12, + 7: 13, + 8: 16, + 9: 17, + 10: 20, + 11: 21, + 12: 24, + 13: 25, + 14: 28, + 15: 29, + 16: 32, + 17: 33, + 18: 36, + 19: 37, + 20: 40, + 21: 41, + 22: 44, + 23: 45, + 24: 48, + 25: 49, + 26: 52, + 27: 53, + 28: 56, + 29: 57, + 30: 60, + 31: 61, + 32: 2, + 33: 3, + 34: 6, + 35: 7, + 36: 10, + 37: 11, + 38: 14, + 39: 15, + 40: 18, + 41: 19, + 42: 22, + 43: 23, + 44: 26, + 45: 27, + 46: 30, + 47: 31, + 48: 34, + 49: 35, + 50: 38, + 51: 39, + 52: 42, + 53: 43, + 54: 46, + 55: 47, + 56: 50, + 57: 51, + 58: 54, + 59: 55, + 60: 58, + 61: 59, + 62: 62, + 63: 63 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + + def __init__(self): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + for x in range(self.port_start, self.port_end + 1): + phy_port = self._logic_to_phy_port_mapping[x] + port_eeprom_path = eeprom_path.format(phy_port + self.EEPROM_OFFSET) + self.port_to_eeprom_mapping[x] = port_eeprom_path + + SfpUtilBase.__init__(self) + + def qsfp_to_cpld_index(self, port_num): + if port_num < self.CPLD1_PORTS: + cpld_id = 0 + cpld_port_index = port_num + 1 + else: + cpld_id = 1 + (port_num - self.CPLD1_PORTS) / self.CPLDx_PORTS + cpld_port_index = ((port_num - self.CPLD1_PORTS) % self.CPLDx_PORTS) + 1 + return cpld_id, cpld_port_index + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_STATUS_KEY, cpld_port_index) + + try: + reg_file = open(reg_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_file.close() + + reg_value = int(content, 16) + # mask for presence bit (bit 1) + mask = (1 << self.CPLD_PRES_BIT) + + # 0 - presence, 1 - absence + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_CONFIG_KEY, cpld_port_index) + + try: + reg_file = open(reg_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_file.close() + + reg_value = int(content, 16) + # mask for lp_mod bit (bit 2) + mask = (1 << self.CPLD_LPMOD_BIT) + + # 0 - disable, 1 - low power mode + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_CONFIG_KEY, cpld_port_index) + + try: + reg_file = open(reg_path, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_value = int(content, 16) + # mask for lp_mod bit (bit 2) + mask = (1 << self.CPLD_LPMOD_BIT) + + # 1 - low power mode, 0 - high power mode + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # convert value to hex string + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self._logic_to_phy_port_mapping[port_num] + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_CONFIG_KEY, cpld_port_index) + + # reset the port + try: + reg_file = open(reg_path, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_value = int(content, 16) + # mask for reset bit (bit 0) + mask = (1 << self.CPLD_RESET_BIT) + + # 1 - out of reset, 0 - reset + reg_value = reg_value & ~mask + + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 1 second to reset done + time.sleep(1) + + # take the port out of reset + try: + reg_file = open(reg_path, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf new file mode 100644 index 000000000000..b5daa9af42b7 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf @@ -0,0 +1,90 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + +bus "i2c-16" "i2c-mux-1 (chan_id 7)" +chip "w83795adg-*" + ignore in0 + label in1 "VDD_CORE" + set in1_min 0.90 * 0.98 + set in1_max 0.90 * 1.02 + ignore in2 + label in3 "1.8V" + set in3_min 1.8 * 0.97 + set in3_max 1.8 * 1.03 + label in4 "3.3V" + compute in4 @/(0.3052), (0.3052)*@ + set in4_min 3.3 * 0.95 + set in4_max 3.3 * 1.05 + label in5 "0.9V" + set in5_min 0.90 * 0.98 + set in5_max 0.90 * 1.02 + ignore in6 + ignore in7 + ignore in8 + ignore in9 + ignore in10 + ignore in11 + ignore in12 + ignore in13 + ignore in14 + ignore in15 + ignore in16 + ignore in17 + ignore in18 + ignore in19 + label fan1 "FANTRAY 1" + #label fan2 "FANTRAY 1-B" + ignore fan2 + label fan3 "FANTRAY 2" + #label fan4 "FANTRAY 2-B" + ignore fan4 + label fan5 "FANTRAY 3" + #label fan6 "FANTRAY 3-B" + ignore fan6 + label fan7 "FANTRAY 4" + #label fan8 "FANTRAY 4-B" + ignore fan8 + ignore temp1 + ignore temp2 + ignore temp3 + ignore temp4 + ignore temp5 + ignore temp6 + ignore intrusion0 + +# TODO: need to confirm the critial temp value with HW after board ready +chip "tmp75-i2c-*-4A" + label temp1 "BMC board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-0" "SMBus I801 adapter at f000" +chip "tmp75-i2c-*-4F" + label temp1 "x86 CPU board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-6" "i2c-0-mux (chan_id 5)" +chip "lm75-i2c-6-4D" + label temp1 "Rear Panel Temp" + set temp1_max 50 + set temp1_max_hyst 45 +chip "lm75-i2c-6-4E" + label temp1 "Rear MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-7" "i2c-0-mux (chan_id 6)" +chip "lm75-i2c-7-4D" + label temp1 "Front Panel Temp" + set temp1_max 50 + set temp1_max_hyst 45 +chip "lm75-i2c-7-4E" + label temp1 "Front MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 + + diff --git a/dockers/docker-orchagent-nephos b/dockers/docker-orchagent-nephos new file mode 120000 index 000000000000..8d52609c56e5 --- /dev/null +++ b/dockers/docker-orchagent-nephos @@ -0,0 +1 @@ +docker-orchagent \ No newline at end of file diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index f92dfe5fd543..027c6d52a2fe 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -18,6 +18,8 @@ if [ "$platform" == "broadcom" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$platform" == "cavium" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$platform" == "nephos" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" fi exec /usr/bin/orchagent ${ORCHAGENT_ARGS} diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index ad52f395d0cf..b18321676b78 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -3,11 +3,15 @@ Description=switch state service Requires=database.service {% if sonic_asic_platform == 'broadcom' %} Requires=opennsl-modules-3.16.0-4-amd64.service +{% elif sonic_asic_platform == 'nephos' %} +Requires=nps-modules-3.16.0-4-amd64.service {% endif %} After=database.service After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} After=opennsl-modules-3.16.0-4-amd64.service +{% elif sonic_asic_platform == 'nephos' %} +After=nps-modules-3.16.0-4-amd64.service {% endif %} [Service] diff --git a/platform/nephos/docker-orchagent-nephos.mk b/platform/nephos/docker-orchagent-nephos.mk new file mode 100644 index 000000000000..b21e69d6cf87 --- /dev/null +++ b/platform/nephos/docker-orchagent-nephos.mk @@ -0,0 +1,19 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_NEPHOS = docker-orchagent-nephos.gz +$(DOCKER_ORCHAGENT_NEPHOS)_PATH = $(DOCKERS_PATH)/docker-orchagent +$(DOCKER_ORCHAGENT_NEPHOS)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_NEPHOS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_NEPHOS) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_NEPHOS) + +$(DOCKER_ORCHAGENT_NEPHOS)_CONTAINER_NAME = swss +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw + +$(DOCKER_ORCHAGENT_NEPHOS)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_NEPHOS)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/nephos/docker-ptf-nephos.mk b/platform/nephos/docker-ptf-nephos.mk new file mode 100644 index 000000000000..6d7950f7516d --- /dev/null +++ b/platform/nephos/docker-ptf-nephos.mk @@ -0,0 +1,7 @@ +# docker image for docker-ptf-nephos + +DOCKER_PTF_NEPHOS = docker-ptf-nephos.gz +$(DOCKER_PTF_NEPHOS)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift +$(DOCKER_PTF_NEPHOS)_DEPENDS += $(PYTHON_SAITHRIFT_NEPHOS) +$(DOCKER_PTF_NEPHOS)_LOAD_DOCKERS += $(DOCKER_PTF) +#SONIC_DOCKER_IMAGES += $(DOCKER_PTF_NEPHOS) diff --git a/platform/nephos/docker-syncd-nephos-rpc.mk b/platform/nephos/docker-syncd-nephos-rpc.mk new file mode 100644 index 000000000000..e891d0b1a68d --- /dev/null +++ b/platform/nephos/docker-syncd-nephos-rpc.mk @@ -0,0 +1,17 @@ +# docker image for nephos syncd with rpc + +DOCKER_SYNCD_NEPHOS_RPC = docker-syncd-nephos-rpc.gz +$(DOCKER_SYNCD_NEPHOS_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-nephos-rpc +$(DOCKER_SYNCD_NEPHOS_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) +$(DOCKER_SYNCD_NEPHOS_RPC)_FILES += $(DSSERVE) $(NPX_DIAG) +$(DOCKER_SYNCD_NEPHOS_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_NEPHOS) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) +endif + +$(DOCKER_SYNCD_NEPHOS_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 new file mode 100644 index 000000000000..9a01d4e1e001 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 @@ -0,0 +1,51 @@ +FROM docker-syncd-nephos + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +COPY \ +{% for deb in docker_syncd_nephos_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -P syncd + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +{% for deb in docker_syncd_nephos_rpc_debs.split(' ') -%} +dpkg_apt debs/{{ deb }}{{'; '}} +{%- endfor %} + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + python-pip \ + build-essential \ + libssl-dev \ + libffi-dev \ + python-dev \ + wget \ + cmake \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ + && pip install cffi==1.7.0 \ + && pip install --upgrade cffi==1.7.0 \ + && pip install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /root/deps + +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/nephos/docker-syncd-nephos-rpc/ptf_nn_agent.conf b/platform/nephos/docker-syncd-nephos-rpc/ptf_nn_agent.conf new file mode 100644 index 000000000000..fa1ed0eb1622 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos-rpc/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/platform/nephos/docker-syncd-nephos.mk b/platform/nephos/docker-syncd-nephos.mk new file mode 100644 index 000000000000..a79c8524b890 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos.mk @@ -0,0 +1,19 @@ +# docker image for nephos syncd + +DOCKER_SYNCD_NEPHOS = docker-syncd-nephos.gz +$(DOCKER_SYNCD_NEPHOS)_PATH = $(PLATFORM_PATH)/docker-syncd-nephos +$(DOCKER_SYNCD_NEPHOS)_DEPENDS += $(SYNCD) +$(DOCKER_SYNCD_NEPHOS)_FILES += $(DSSERVE) $(NPX_DIAG) +$(DOCKER_SYNCD_NEPHOS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS) +ifneq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS) +endif + +$(DOCKER_SYNCD_NEPHOS)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +$(DOCKER_SYNCD_NEPHOS)_BASE_IMAGE_FILES += npx_diag:/usr/bin/npx_diag diff --git a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 new file mode 100755 index 000000000000..e0248d460a12 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -0,0 +1,31 @@ +FROM docker-config-engine + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +COPY \ +{% for deb in docker_syncd_nephos_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_syncd_nephos_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## TODO: add kmod into Depends +RUN apt-get install -f kmod + +COPY ["files/dsserve", "files/npx_diag", "start.sh", "/usr/bin/"] +RUN chmod +x /usr/bin/dsserve /usr/bin/npx_diag + +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/nephos/docker-syncd-nephos/base_image_files/npx_diag b/platform/nephos/docker-syncd-nephos/base_image_files/npx_diag new file mode 100755 index 000000000000..876bc1816ecc --- /dev/null +++ b/platform/nephos/docker-syncd-nephos/base_image_files/npx_diag @@ -0,0 +1,3 @@ +#!/bin/bash + +docker exec -i syncd npx_diag "$@" diff --git a/platform/nephos/docker-syncd-nephos/start.sh b/platform/nephos/docker-syncd-nephos/start.sh new file mode 100755 index 000000000000..623316050475 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos/start.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +supervisorctl start syncd diff --git a/platform/nephos/docker-syncd-nephos/supervisord.conf b/platform/nephos/docker-syncd-nephos/supervisord.conf new file mode 100644 index 000000000000..1af5d70a1d0c --- /dev/null +++ b/platform/nephos/docker-syncd-nephos/supervisord.conf @@ -0,0 +1,28 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd_start.sh +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/platform/nephos/libsaithrift-dev.mk b/platform/nephos/libsaithrift-dev.mk new file mode 100644 index 000000000000..4103d5c0c7b0 --- /dev/null +++ b/platform/nephos/libsaithrift-dev.mk @@ -0,0 +1,7 @@ +# libsaithrift-dev package + +LIBSAITHRIFT_DEV_NEPHOS = libsaithrift-dev_0.9.4_amd64.deb +$(LIBSAITHRIFT_DEV_NEPHOS)_SRC_PATH = $(SRC_PATH)/SAI +$(LIBSAITHRIFT_DEV_NEPHOS)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) +$(LIBSAITHRIFT_DEV_NEPHOS)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI) +#SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_NEPHOS) diff --git a/platform/nephos/one-image.mk b/platform/nephos/one-image.mk new file mode 100644 index 000000000000..8e9406dca89c --- /dev/null +++ b/platform/nephos/one-image.mk @@ -0,0 +1,10 @@ +# sonic nephos one image installer + +SONIC_ONE_IMAGE = sonic-nephos.bin +$(SONIC_ONE_IMAGE)_MACHINE = nephos +$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_ONE_IMAGE)_INSTALLS += $(NEPHOS_NPS_KERNEL) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9130_32X_PLATFORM_MODULE) \ + $(INGRASYS_S9230_64X_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/nephos/platform-modules-ingrasys.mk b/platform/nephos/platform-modules-ingrasys.mk new file mode 100644 index 000000000000..dde33e0b8745 --- /dev/null +++ b/platform/nephos/platform-modules-ingrasys.mk @@ -0,0 +1,18 @@ +# Ingrasys S9130-32X and S9230-64X Platform modules + +INGRASYS_S9130_32X_PLATFORM_MODULE_VERSION = 1.0.0 +INGRASYS_S9230_64X_PLATFORM_MODULE_VERSION = 1.0.0 + +export INGRASYS_S9130_32X_PLATFORM_MODULE_VERSION +export INGRASYS_S9230_64X_PLATFORM_MODULE_VERSION + +INGRASYS_S9130_32X_PLATFORM_MODULE = sonic-platform-ingrasys-s9130-32x_$(INGRASYS_S9130_32X_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S9130_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys +$(INGRASYS_S9130_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(INGRASYS_S9130_32X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9130_32x-r0 +SONIC_DPKG_DEBS += $(INGRASYS_S9130_32X_PLATFORM_MODULE) + +INGRASYS_S9230_64X_PLATFORM_MODULE = sonic-platform-ingrasys-s9230-64x_$(INGRASYS_S9230_64X_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S9230_64X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9230_64x-r0 + +$(eval $(call add_extra_package,$(INGRASYS_S9130_32X_PLATFORM_MODULE),$(INGRASYS_S9230_64X_PLATFORM_MODULE))) diff --git a/platform/nephos/platform.conf b/platform/nephos/platform.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/python-saithrift.mk b/platform/nephos/python-saithrift.mk new file mode 100644 index 000000000000..bc4a57b64cd3 --- /dev/null +++ b/platform/nephos/python-saithrift.mk @@ -0,0 +1,6 @@ +# python-saithrift package + +PYTHON_SAITHRIFT_NEPHOS = python-saithrift_0.9.4_amd64.deb +$(PYTHON_SAITHRIFT_NEPHOS)_SRC_PATH = $(SRC_PATH)/SAI +$(PYTHON_SAITHRIFT_NEPHOS)_DEPENDS += $(NEPHOS_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) +#SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_NEPHOS) diff --git a/platform/nephos/rules.mk b/platform/nephos/rules.mk new file mode 100644 index 000000000000..fc6200005db5 --- /dev/null +++ b/platform/nephos/rules.mk @@ -0,0 +1,26 @@ +include $(PLATFORM_PATH)/sdk.mk +include $(PLATFORM_PATH)/sai.mk +include $(PLATFORM_PATH)/platform-modules-ingrasys.mk +include $(PLATFORM_PATH)/docker-orchagent-nephos.mk +include $(PLATFORM_PATH)/docker-syncd-nephos.mk +include $(PLATFORM_PATH)/docker-syncd-nephos-rpc.mk +include $(PLATFORM_PATH)/one-image.mk +include $(PLATFORM_PATH)/libsaithrift-dev.mk +include $(PLATFORM_PATH)/python-saithrift.mk +#include $(PLATFORM_PATH)/docker-ptf-nephos.mk + +NPX_DIAG = npx_diag +$(NPX_DIAG)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/npx_diag_2.0.1-20171020" + +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" + +SONIC_ONLINE_FILES += $(NPX_DIAG) $(DSSERVE) + +SONIC_ALL += $(SONIC_ONE_IMAGE) $(DOCKER_FPM) + +# Inject nephos sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) #$(LIBSAITHRIFT_DEV_NEPHOS) + +# Runtime dependency on nephos sai is set only for syncd +$(SYNCD)_RDEPENDS += $(NEPHOS_SAI) diff --git a/platform/nephos/sai.mk b/platform/nephos/sai.mk new file mode 100644 index 000000000000..90ee027518e8 --- /dev/null +++ b/platform/nephos/sai.mk @@ -0,0 +1,9 @@ +NEPHOS_SAI = libsainps_2.0.2-20171204_amd64.deb +$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.2-20171204_amd64.deb" + +NEPHOS_SAI_DEV = libsainps-dev_2.0.2-20171124_amd64.deb +$(eval $(call add_derived_package,$(NEPHOS_SAI),$(NEPHOS_SAI_DEV))) +$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.2-20171124_amd64.deb" + +SONIC_ONLINE_DEBS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) +$(NEPHOS_SAI_DEV)_DEPENDS += $(NEPHOS_SAI) diff --git a/platform/nephos/sdk.mk b/platform/nephos/sdk.mk new file mode 100644 index 000000000000..392ae459cc57 --- /dev/null +++ b/platform/nephos/sdk.mk @@ -0,0 +1,4 @@ +NEPHOS_NPS_KERNEL = nps-modules-3.16.0-4-amd64_2.0.2-20171204_amd64.deb +$(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-3.16.0-4-amd64_2.0.2-20171204_amd64.deb" + +SONIC_ONLINE_DEBS += $(NEPHOS_NPS_KERNEL) diff --git a/platform/nephos/sonic-platform-modules-ingrasys b/platform/nephos/sonic-platform-modules-ingrasys new file mode 160000 index 000000000000..e8fd460120b7 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-ingrasys @@ -0,0 +1 @@ +Subproject commit e8fd460120b73cc175b509a344345f30a70e3126 diff --git a/rules/ixgbe.mk b/rules/ixgbe.mk new file mode 100644 index 000000000000..bdd175eac869 --- /dev/null +++ b/rules/ixgbe.mk @@ -0,0 +1,8 @@ +# initramfs-tools package + +IXGBE_DRIVER_VERSION = 5.2.4 +export IXGBE_DRIVER_VERSION + +IXGBE_DRIVER = ixgbe.ko +$(IXGBE_DRIVER)_SRC_PATH = $(SRC_PATH)/ixgbe +SONIC_MAKE_DEBS += $(IXGBE_DRIVER) diff --git a/slave.mk b/slave.mk index 4843faee5066..18d870d50560 100644 --- a/slave.mk +++ b/slave.mk @@ -394,6 +394,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) \ $(LINUX_KERNEL) \ $(IGB_DRIVER) \ + $(IXGBE_DRIVER) \ $(SONIC_DEVICE_DATA) \ $(SONIC_UTILS) \ $(LIBPAM_TACPLUS) \ diff --git a/src/ixgbe/Makefile b/src/ixgbe/Makefile new file mode 100644 index 000000000000..133fc7db0570 --- /dev/null +++ b/src/ixgbe/Makefile @@ -0,0 +1,22 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = ixgbe.ko + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf ./ixgbe-$(IXGBE_DRIVER_VERSION) + wget -O ixgbe-$(IXGBE_DRIVER_VERSION).tar.gz "https://sonicstorage.blob.core.windows.net/packages/ixgbe-5.2.4.tar.gz?sv=2015-04-05&sr=b&sig=AaqJHHaPiJRp8R3HKobi0GNDgHAVnqijk6hpahwJ0Mg%3D&se=2154-10-05T22%3A19%3A29Z&sp=r" + tar xzf ixgbe-$(IXGBE_DRIVER_VERSION).tar.gz + + # Patch + pushd ./ixgbe-$(IXGBE_DRIVER_VERSION) + + # Build the package + pushd src + export BUILD_KERNEL=3.16.0-4-amd64 + make + popd + + popd + mv ./ixgbe-$(IXGBE_DRIVER_VERSION)/src/$* $(DEST)/ diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 345f179482db..3b817bbe14f1 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 345f179482dbf5258cad088414bc9eb230decd97 +Subproject commit 3b817bbe14f1e5177e6200c7a80ab74db4768eaa From 683562cf2fff879a6133fc5a720a5687d41b9424 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Sat, 23 Dec 2017 02:06:21 +0800 Subject: [PATCH 1007/1833] [Accton AS7816-64X] Add new platform and device for AS7816-64X. (#1260) Signed-off-by: roylee123 --- .../Accton-AS7816-64X/port_config.ini | 1 + .../Accton-AS7816-64X/sai.profile | 0 .../installer.conf | 1 + .../led_proc_init.soc | 0 .../x86_64-accton_as7816_64x-r0/minigraph.xml | 1074 +++++++++++++++++ .../plugins/eeprom.py | 21 + .../plugins/sfputil.py | 159 +++ platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-accton.mk | 7 + .../broadcom/sonic-platform-modules-accton | 2 +- 10 files changed, 1265 insertions(+), 1 deletion(-) create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/port_config.ini create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/sai.profile create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/installer.conf create mode 100755 device/accton/x86_64-accton_as7816_64x-r0/led_proc_init.soc create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/plugins/eeprom.py create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py diff --git a/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/port_config.ini b/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/port_config.ini new file mode 100644 index 000000000000..f6c7b0c4a876 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/port_config.ini @@ -0,0 +1 @@ +# name lanes alias diff --git a/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/sai.profile b/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/sai.profile new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/accton/x86_64-accton_as7816_64x-r0/installer.conf b/device/accton/x86_64-accton_as7816_64x-r0/installer.conf new file mode 100644 index 000000000000..5e62742c11bf --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/installer.conf @@ -0,0 +1 @@ +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7816_64x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7816_64x-r0/led_proc_init.soc new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml b/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml new file mode 100644 index 000000000000..025985c83675 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml @@ -0,0 +1,1074 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch1 + 10.0.0.32 + 1 + 180 + 60 + + + switch1 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch1 + 10.0.0.34 + 1 + 180 + 60 + + + switch1 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch1 + 10.0.0.36 + 1 + 180 + 60 + + + switch1 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch1 + 10.0.0.38 + 1 + 180 + 60 + + + switch1 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch1 + 10.0.0.40 + 1 + 180 + 60 + + + switch1 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch1 + 10.0.0.42 + 1 + 180 + 60 + + + switch1 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch1 + 10.0.0.44 + 1 + 180 + 60 + + + switch1 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch1 + 10.0.0.46 + 1 + 180 + 60 + + + switch1 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch1 + 10.0.0.48 + 1 + 180 + 60 + + + switch1 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch1 + 10.0.0.50 + 1 + 180 + 60 + + + switch1 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch1 + 10.0.0.52 + 1 + 180 + 60 + + + switch1 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch1 + 10.0.0.54 + 1 + 180 + 60 + + + switch1 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch1 + 10.0.0.56 + 1 + 180 + 60 + + + switch1 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch1 + 10.0.0.58 + 1 + 180 + 60 + + + switch1 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch1 + 10.0.0.60 + 1 + 180 + 60 + + + switch1 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch1 + 10.0.0.62 + 1 + 180 + 60 + + + switch1 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch1 + + +
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 + + + + + + + + switch1 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch1 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch1 + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + switch1 + Accton-AS7712-32X + + + + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + switch1 + Accton-AS7712-32X +
diff --git a/device/accton/x86_64-accton_as7816_64x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7816_64x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..1e7d1046d93d --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/plugins/eeprom.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..7c82583c26bb --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py @@ -0,0 +1,159 @@ +#!/usr/bin/env python + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + _port_start = 0 + _port_end = 63 + ports_in_block = 64 + + _port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 61 : 25, + 62 : 26, + 63 : 27, + 64 : 28, + 55 : 29, + 56 : 30, + 53 : 31, + 54 : 32, + 9 : 33, + 10 : 34, + 11 : 35, + 12 : 36, + 1 : 37, + 2 : 38, + 3 : 39, + 4 : 40, + 6 : 41, + 5 : 42, + 8 : 43, + 7 : 44, + 13 : 45, + 14 : 46, + 15 : 47, + 16 : 48, + 17 : 49, + 18 : 50, + 19 : 51, + 20 : 52, + 25 : 53, + 26 : 54, + 27 : 55, + 28 : 56, + 29 : 57, + 30 : 58, + 31 : 59, + 32 : 60, + 21 : 61, + 22 : 62, + 23 : 63, + 24 : 64, + 41 : 65, + 42 : 66, + 43 : 67, + 44 : 68, + 33 : 69, + 34 : 70, + 35 : 71, + 36 : 72, + 45 : 73, + 46 : 74, + 47 : 75, + 48 : 76, + 37 : 77, + 38 : 78, + 39 : 79, + 40 : 80, + 57 : 81, + 58 : 82, + 59 : 83, + 60 : 84, + 49 : 85, + 50 : 86, + 51 : 87, + 52 : 88,} + + _qsfp_ports = range(0, ports_in_block + 1) + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' + for x in range(0, self._port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x+1]) + self._port_to_eeprom_mapping[x] = port_eeprom_path + SfpUtilBase.__init__(self) + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + #toggle reset + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedErro + + def get_low_power_mode(self, port_num): + raise NotImplementedErro + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present" + port_ps = path.format(self.port_to_i2c_mapping[port_num+1]) + + + try: + reg_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return range(0, self.ports_in_block + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 5b2afedee7d7..a29d32abd1c2 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -14,6 +14,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(INGRASYS_S9200_64X_PLATFORM_MODULE) \ $(ACCTON_AS7712_32X_PLATFORM_MODULE) \ $(ACCTON_AS5712_54X_PLATFORM_MODULE) \ + $(ACCTON_AS7816_64X_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index 7030ecb441f7..c03ca5944246 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -2,9 +2,11 @@ ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION = 1.1 export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION export ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION +export ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION ACCTON_AS7712_32X_PLATFORM_MODULE = sonic-platform-accton-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7712_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton @@ -16,3 +18,8 @@ ACCTON_AS5712_54X_PLATFORM_MODULE = sonic-platform-accton-as5712-54x_$(ACCTON_AS $(ACCTON_AS5712_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as5712_54x-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS5712_54X_PLATFORM_MODULE))) SONIC_DPKG_DEBS += $(ACCTON_AS5712_54X_PLATFORM_MODULE) + +ACCTON_AS7816_64X_PLATFORM_MODULE = sonic-platform-accton-as7816-64x_$(ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS7816_64X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7816_64x-r0 + +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7816_64X_PLATFORM_MODULE))) diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index 7c39d916d2b5..e66b74fcf7a9 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit 7c39d916d2b5d248c8067669e72b75ed7240b348 +Subproject commit e66b74fcf7a943d8c7c8f241a8221eca65171ced From 15d433d975d403bbb490c12b71aec5e6f5b810ab Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 23 Dec 2017 23:34:15 -0800 Subject: [PATCH 1008/1833] [build]: allow to use http(s) proxy in the build (#1265) * allow to use http(s) proxy in the build To enable this, use following command http_proxy=[your_proxy] https_proxy=[your_proxy] make --- Makefile | 8 ++++++- README.md | 7 ++++-- build_debian.sh | 12 +++++++--- .../build_templates/sonic_debian_extension.j2 | 8 +++---- slave.mk | 22 ++++++++++++++++--- 5 files changed, 44 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 8d864e914aa2..aa3492561cb2 100644 --- a/Makefile +++ b/Makefile @@ -35,10 +35,14 @@ SLAVE_IMAGE = sonic-slave-$(USER) DOCKER_RUN := docker run --rm=true --privileged \ -v $(PWD):/sonic \ -w /sonic \ + -e "http_proxy=$(http_proxy)" \ + -e "https_proxy=$(https_proxy)" \ -i$(if $(TERM),t,) DOCKER_BASE_BUILD = docker build --no-cache \ -t $(SLAVE_BASE_IMAGE) \ + --build-arg http_proxy=$(http_proxy) \ + --build-arg https_proxy=$(https_proxy) \ sonic-slave && \ docker tag $(SLAVE_BASE_IMAGE):latest $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) @@ -61,7 +65,9 @@ SONIC_BUILD_INSTRUCTION := make \ ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ - SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) + SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ + HTTP_PROXY=$(http_proxy) \ + HTTPS_PROXY=$(https_proxy) .PHONY: sonic-slave-build sonic-slave-bash init reset diff --git a/README.md b/README.md index 0a361e38abec..ea721a48e9ec 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,11 @@ To build SONiC installer image and docker images, run the following commands: make - **NOTE**: We recommend reserving 50G free space to build one platform. - + **NOTE**: + +- We recommend reserving 50G free space to build one platform. +- Use ```http_proxy=[your_proxy] https_proxy=[your_proxy] make``` to enable http(s) proxy in the build process. + The SONiC installer contains all docker images needed. SONiC uses one image for all devices of a same ASIC vendor. The supported ASIC vendors are: - PLATFORM=broadcom diff --git a/build_debian.sh b/build_debian.sh index 15bde44c112e..1aaa660eefda 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -68,7 +68,7 @@ touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime ## Build a basic Debian system by debootstrap echo '[INFO] Debootstrap...' -sudo debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://ftp.us.debian.org/debian +sudo http_proxy=$http_proxy debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://ftp.us.debian.org/debian ## Config hostname and hosts, otherwise 'sudo ...' will complain 'sudo: unable to resolve host ...' sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '$HOSTNAME' > /etc/hostname" @@ -79,6 +79,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '127.0.0.1 localhos sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'echo "proc /proc proc defaults 0 0" >> /etc/fstab' sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'echo "sysfs /sys sysfs defaults 0 0" >> /etc/fstab' +## Setup proxy +[ -n "$http_proxy" ] && sudo /bin/bash -c "echo 'Acquire::http::Proxy \"$http_proxy\";' > $FILESYSTEM_ROOT/etc/apt/apt.conf.d/01proxy" + ## Note: mounting is necessary to makedev and install linux image echo '[INFO] Mount all' ## Output all the mounted device for troubleshooting @@ -290,8 +293,8 @@ set /files/etc/sysctl.conf/net.core.rmem_max 2097152 " -r $FILESYSTEM_ROOT ## docker-py is needed by Ansible docker module -sudo LANG=C chroot $FILESYSTEM_ROOT easy_install pip -sudo LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0' +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT easy_install pip +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0' ## Note: keep pip installed for maintainance purpose ## Create /var/run/redis folder for docker-database to mount @@ -342,6 +345,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoclean sudo LANG=C chroot $FILESYSTEM_ROOT apt-get clean sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'rm -rf /usr/share/doc/* /usr/share/locale/* /var/lib/apt/lists/* /tmp/*' +## Clean up proxy +[ -n "$http_proxy" ] && sudo rm -f $FILESYSTEM_ROOT/etc/apt/apt.conf.d/01proxy + ## Umount all echo '[INFO] Umount all' ## Display all process details access /proc diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 7de8f8597917..bf603d249d95 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -64,17 +64,17 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in # Install SONiC config engine Python package CONFIG_ENGINE_WHEEL_NAME=$(basename {{config_engine_wheel_path}}) sudo cp {{config_engine_wheel_path}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHEEL_NAME -sudo LANG=C chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHEEL_NAME +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHEEL_NAME # Install Python client for Redis -sudo LANG=C chroot $FILESYSTEM_ROOT pip install redis -sudo LANG=C chroot $FILESYSTEM_ROOT pip install redis-dump-load +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install redis +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install redis-dump-load # Install SwSS SDK Python 2 package SWSSSDK_PY2_WHEEL_NAME=$(basename {{swsssdk_py2_wheel_path}}) sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME -sudo LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME # Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') diff --git a/slave.mk b/slave.mk index 18d870d50560..425ba4c41d82 100644 --- a/slave.mk +++ b/slave.mk @@ -100,6 +100,8 @@ $(info "SONIC_CONFIG_DEBUG" : "$(SONIC_CONFIG_DEBUG)") $(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)") $(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)") $(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)") +$(info "HTTP_PROXY" : "$(HTTP_PROXY)") +$(info "HTTPS_PROXY" : "$(HTTPS_PROXY)") $(info ) ############################################################################### @@ -329,7 +331,7 @@ $(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuff # put a lock here to avoid race conditions while true; do if mkdir $(PYTHON_WHEELS_PATH)/pip_lock &> /dev/null; then - { sudo pip$($*_PYTHON_VERSION) install $(PYTHON_WHEELS_PATH)/$* $(LOG) && rm -d $(PYTHON_WHEELS_PATH)/pip_lock && break; } || { rm -d $(PYTHON_WHEELS_PATH)/pip_lock && exit 1 ; } + { sudo -E pip$($*_PYTHON_VERSION) install $(PYTHON_WHEELS_PATH)/$* $(LOG) && rm -d $(PYTHON_WHEELS_PATH)/pip_lock && break; } || { rm -d $(PYTHON_WHEELS_PATH)/pip_lock && exit 1 ; } fi done $(FOOTER) @@ -340,12 +342,20 @@ $(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuff # start docker daemon docker-start : + @sudo sed -i '/http_proxy/d' /etc/default/docker + @sudo bash -c "echo \"export http_proxy=$$http_proxy\" >> /etc/default/docker" @sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && sleep 1 ) # targets for building simple docker images that do not depend on any debian packages $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $(HEADER) - docker build --squash --no-cache --build-arg user=$(USER) --build-arg uid=$(UID) --build-arg guid=$(GUID) -t $* $($*.gz_PATH) $(LOG) + docker build --squash --no-cache \ + --build-arg http_proxy=$(HTTP_PROXY) \ + --build-arg https_proxy=$(HTTPS_PROXY) \ + --build-arg user=$(USER) \ + --build-arg uid=$(UID) \ + --build-arg guid=$(GUID) \ + -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ $(FOOTER) @@ -365,7 +375,13 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile - docker build --squash --no-cache --build-arg user=$(USER) --build-arg uid=$(UID) --build-arg guid=$(GUID) -t $* $($*.gz_PATH) $(LOG) + docker build --squash --no-cache \ + --build-arg http_proxy=$(HTTP_PROXY) \ + --build-arg https_proxy=$(HTTPS_PROXY) \ + --build-arg user=$(USER) \ + --build-arg uid=$(UID) \ + --build-arg guid=$(GUID) \ + -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ $(FOOTER) From 5c40aa52ac60517b4da37b6eac10d82059c35efd Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 25 Dec 2017 18:42:51 -0800 Subject: [PATCH 1009/1833] [build]: add build badge for nephos platform (#1267) --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ea721a48e9ec..db4ac55d5fec 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ *master*: Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) +Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all) P4: [![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all) VS: [![VS](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all) @@ -7,7 +8,7 @@ VS: [![VS](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimag Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/) Cavium: [![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/) Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-all/) -Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/) +Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201709/) Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-all/) Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/) From 5eb5e2162ba9697384c82712d2bba3f05d012a42 Mon Sep 17 00:00:00 2001 From: chenyuqiang Date: Thu, 28 Dec 2017 03:25:53 +0800 Subject: [PATCH 1010/1833] [centec]: support sai1.0 (#1268) --- platform/centec/sai.mk | 2 +- platform/centec/sdk.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/centec/sai.mk b/platform/centec/sai.mk index de8615ac132c..299b36a69ebf 100644 --- a/platform/centec/sai.mk +++ b/platform/centec/sai.mk @@ -1,5 +1,5 @@ # Centec SAI CENTEC_SAI = libsai_1.0.0_amd64.deb -$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_0.9.4/libsai_1.0.0_amd64.deb +$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_1.0/libsai_1.0.0_amd64.deb SONIC_ONLINE_DEBS += $(CENTEC_SAI) diff --git a/platform/centec/sdk.mk b/platform/centec/sdk.mk index ac1939122f47..e3ce05f6b742 100644 --- a/platform/centec/sdk.mk +++ b/platform/centec/sdk.mk @@ -1,4 +1,4 @@ CENTEC_SDK_KERNEL = centec-gg-sdk3.5-modules-3.16.0-4-amd64.deb -$(CENTEC_SDK_KERNEL)_URL = "https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/centec-gg-sdk3.5-modules-3.16.0-4-amd64.deb" +$(CENTEC_SDK_KERNEL)_URL = "https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_1.0/centec-gg-sdk3.5-modules-3.16.0-4-amd64.deb" SONIC_ONLINE_DEBS += $(CENTEC_SDK_KERNEL) From 22eea55c9b348e539e867b6cabdd3b1df30289f7 Mon Sep 17 00:00:00 2001 From: wadelnn Date: Sat, 30 Dec 2017 02:41:43 +0800 Subject: [PATCH 1011/1833] [Platform] Add psuutil and update submodule for Ingrasys S9100-32X, S8810-32Q, S9200-64X on master branch (#1271) * [platform] Add Psuutil and fixed voltage alarm for S9100 * Add I2C CPLD kernel module for psuutil. * Support psuutil script. * Add voltage min and max threshold. Signed-off-by: Wade He * [Platform] Add Psuutil and update sensors.conf for S8810-32Q and S9200-64X * Support psuutil script. * Update sensors.conf for tmp75. Signed-off-by: Wade He --- .../plugins/psuutil.py | 92 +++++++++++++++++++ .../plugins/psuutil.py | 92 +++++++++++++++++++ .../x86_64-ingrasys_s9100-r0/sensors.conf | 10 ++ .../plugins/psuutil.py | 92 +++++++++++++++++++ .../x86_64-ingrasys_s9200_64x-r0/sensors.conf | 16 +++- .../broadcom/sonic-platform-modules-ingrasys | 2 +- 6 files changed, 300 insertions(+), 4 deletions(-) create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/psuutil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/psuutil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/psuutil.py diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/psuutil.py new file mode 100644 index 000000000000..7e69360b0402 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-3/3-0051", + "/sys/bus/i2c/devices/i2c-4/4-0051"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_pg' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_abs' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 0): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/psuutil.py new file mode 100644 index 000000000000..4f226c69fff3 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + PSU_CPLD_DIR = "/sys/bus/i2c/devices/0-0033" + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + mask = [ 0x08, 0x10 ] + attr_file = 'cpld_pw_good' + attr_path = self.PSU_CPLD_DIR +'/'+ attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value & mask[index-1]): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + mask = [ 0x01, 0x02 ] + attr_file ='cpld_pw_abs' + attr_path = self.PSU_CPLD_DIR +'/'+ attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (~attr_value & mask[index-1]): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf index c55f5c764e65..5535db7e7eb4 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/sensors.conf @@ -9,14 +9,24 @@ chip "jc42-*" chip "w83795adg-*" label in0 "1.0V" + set in0_min 1.00 * 0.97 + set in0_max 1.00 * 1.03 label in1 "1.0V_ROV" + set in1_min 1.00 * 0.98 + set in1_max 1.00 * 1.02 label in2 "1.25V" + set in2_min 1.25 * 0.97 + set in2_max 1.25 * 1.03 label in3 "1.8V" + set in3_min 1.80 * 0.97 + set in3_max 1.80 * 1.03 ignore in4 ignore in5 ignore in6 ignore in7 label in12 "+3.3V" + set in12_min 3.30 * 0.97 + set in12_max 3.30 * 1.03 ignore in14 ignore in15 ignore in16 diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..cc996057e09e --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-18/18-0050", + "/sys/bus/i2c/devices/i2c-17/17-0050"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_pg' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_abs' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 0): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf index ef694e96a056..065c1ebddf36 100644 --- a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf @@ -49,20 +49,30 @@ chip "w83795adg-*" ignore temp3 ignore temp4 ignore intrusion0 + +chip "tmp75-i2c-*-4A" + label temp1 "BMC Board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +chip "tmp75-i2c-*-4F" + label temp1 "x86 CPU Board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + bus "i2c-6" "i2c-0-mux (chan_id 5)" chip "lm75-i2c-6-4E" label temp1 "MAC Temp" set temp1_max 50 set temp1_max_hyst 45 -bus "i2c-6" "i2c-0-mux (chan_id 5)" chip "lm75-i2c-6-4D" - label temp1 "REAR Temp" + label temp1 "REAR MAC Temp" set temp1_max 50 set temp1_max_hyst 45 bus "i2c-7" "i2c-0-mux (chan_id 6)" chip "lm75-i2c-7-4D" - label temp1 "Front Temp" + label temp1 "Front MAC Temp" set temp1_max 50 set temp1_max_hyst 45 diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys index 1d9ccb21aaf8..f2dc0aa6b96a 160000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ b/platform/broadcom/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit 1d9ccb21aaf868a788fd593ff1c03fdaf150eaf0 +Subproject commit f2dc0aa6b96ab293b4ae6ebf3a942851dd9324b7 From 08b81f310a8c985e7db7c4ce39431a9798a8f7a8 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 3 Jan 2018 01:21:27 -0800 Subject: [PATCH 1012/1833] [submodules]: Update swss and utilitiles modules (#1276) --- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index fab3cea5b075..fbe781de8219 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit fab3cea5b075ccdd26eb6d56cc68d6325bfb8b16 +Subproject commit fbe781de82197304d6622736271649d4ac10de67 diff --git a/src/sonic-utilities b/src/sonic-utilities index 8677d5f457c9..5ad84866491e 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 8677d5f457c9a20f0fac2a4fdde569a8338c77e3 +Subproject commit 5ad84866491e7d4cf4cebcb96e469423c9c91961 From 41f14fcfef42d0e8d5995690902b95895bf51009 Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Thu, 4 Jan 2018 03:26:27 +0800 Subject: [PATCH 1013/1833] [Platform] Add psuutil support for Ingrasys S9130-32X (#1273) Update psuutil and psu kernel module on S9230 --- .../plugins/psuutil.py | 92 +++++++++++++++++++ .../plugins/psuutil.py | 4 +- .../nephos/sonic-platform-modules-ingrasys | 2 +- 3 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/psuutil.py diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..4a029c15b1a6 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-10/10-0050", + "/sys/bus/i2c/devices/i2c-9/9-0050"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_pg' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_abs' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 0): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py index 91d7de05dc84..cc996057e09e 100644 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/psuutil.py @@ -15,8 +15,8 @@ class PsuUtil(PsuBase): """Platform-specific PSUutil class""" - SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-17/17-0050", - "/sys/bus/i2c/devices/i2c-18/18-0050"] + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-18/18-0050", + "/sys/bus/i2c/devices/i2c-17/17-0050"] def __init__(self): PsuBase.__init__(self) diff --git a/platform/nephos/sonic-platform-modules-ingrasys b/platform/nephos/sonic-platform-modules-ingrasys index e8fd460120b7..b03499ed1d72 160000 --- a/platform/nephos/sonic-platform-modules-ingrasys +++ b/platform/nephos/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit e8fd460120b73cc175b509a344345f30a70e3126 +Subproject commit b03499ed1d72a239ed386e40370b146c9a479eaa From f8d32aa9f10849b915b17abc0e39cc5e06bab71d Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Thu, 4 Jan 2018 03:42:49 +0800 Subject: [PATCH 1014/1833] [platform]: As7712 32x add fancontrol (#1270) * Update sonic-platform-modules-accton to lastest Signed-off-by: roylee123 * [AS7712-32X] Add fancontrol. Signed-off-by: roylee123 * [AS7712-32X] add psuutil.py and sensors.conf Signed-off-by: roylee123 * Remove 1 reduntant line. Signed-off-by: roylee123 * [AS7712-32X] Change fan driver to support fancontrol. Signed-off-by: roylee123 --- .../x86_64-accton_as7712_32x-r0/fancontrol | 9 +++ .../plugins/psuutil.py | 61 +++++++++++++++++++ .../x86_64-accton_as7712_32x-r0/sensors.conf | 22 +++++++ platform/broadcom/platform-modules-accton.mk | 3 +- .../broadcom/sonic-platform-modules-accton | 2 +- 5 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/fancontrol create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/plugins/psuutil.py create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/sensors.conf diff --git a/device/accton/x86_64-accton_as7712_32x-r0/fancontrol b/device/accton/x86_64-accton_as7712_32x-r0/fancontrol new file mode 100644 index 000000000000..9d057024f946 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/fancontrol @@ -0,0 +1,9 @@ +INTERVAL=10 +FCTEMPS=/sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/sys_temp +FCFANS=/sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan1_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan2_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan3_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan4_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan5_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan6_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan11_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan12_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan13_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan14_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan15_input /sys/bus/i2c/devices/2-0066/pwm1=/sys/bus/i2c/devices/2-0066/fan16_input +MINTEMP=/sys/bus/i2c/devices/2-0066/pwm1=135 +MAXTEMP=/sys/bus/i2c/devices/2-0066/pwm1=160 +MINSTART=/sys/bus/i2c/devices/2-0066/pwm1=100 +MINSTOP=/sys/bus/i2c/devices/2-0066/pwm1=32 +MINPWM=/sys/bus/i2c/devices/2-0066/pwm1=32 +MAXPWM=/sys/bus/i2c/devices/2-0066/pwm1=69 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7712_32x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..d7600a2af4b1 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "11-0053", + 2: "10-0050", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf b/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf new file mode 100644 index 000000000000..21e1817916f9 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf @@ -0,0 +1,22 @@ +# libsensors configuration file for AS7712-32X +# ------------------------------------------------ +# + +chip "ym2651-*" + label power1 "PSU Output Power" + label temp1 "Power Supply Temp" + label fan1 "Fan Speed" + +chip "as7712_32x_fan-*" + label fan1 "Fan tray 1 front" + label fan2 "Fan tray 2 front" + label fan3 "Fan tray 3 front" + label fan4 "Fan tray 4 front" + label fan5 "Fan tray 5 front" + label fan6 "Fan tray 6 front" + label fan11 "Fan tray 1 rear" + label fan12 "Fan tray 2 rear" + label fan13 "Fan tray 3 rear" + label fan14 "Fan tray 4 rear" + label fan15 "Fan tray 5 rear" + label fan16 "Fan tray 6 rear" diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index c03ca5944246..7dcfb937de63 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -17,9 +17,8 @@ SONIC_DPKG_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) ACCTON_AS5712_54X_PLATFORM_MODULE = sonic-platform-accton-as5712-54x_$(ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS5712_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as5712_54x-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS5712_54X_PLATFORM_MODULE))) -SONIC_DPKG_DEBS += $(ACCTON_AS5712_54X_PLATFORM_MODULE) ACCTON_AS7816_64X_PLATFORM_MODULE = sonic-platform-accton-as7816-64x_$(ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7816_64X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7816_64x-r0 - $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7816_64X_PLATFORM_MODULE))) + diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index e66b74fcf7a9..dfff9a88cd94 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit e66b74fcf7a943d8c7c8f241a8221eca65171ced +Subproject commit dfff9a88cd94da081e80222872c33859e4132365 From b2109b0cec9c5ce3a52dde7639d9657459850aa8 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 3 Jan 2018 12:20:19 -0800 Subject: [PATCH 1015/1833] Disable autosuspend for USB devices, preventing usb drives to be stopped and then renamed (#1275) --- installer/x86_64/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 2a62132be054..c7f184bf0242 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -551,7 +551,7 @@ menuentry '$demo_grub_entry' { insmod ext2 linux /$image_dir/boot/vmlinuz-3.16.0-4-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ - apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX + apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' initrd /$image_dir/boot/initrd.img-3.16.0-4-amd64 } From 39a99e1a07fa04a4fe2ac7f038d2d58fe293c5f1 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 3 Jan 2018 21:43:06 -0800 Subject: [PATCH 1016/1833] [image]: Explicitly specify kernel_version as string (#1280) --- build_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 1aaa660eefda..89fd1c77daaf 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -318,7 +318,7 @@ sudo cp files/dhcp/dhclient.conf $FILESYSTEM_ROOT/etc/dhcp/ sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml > /dev/null < Date: Wed, 3 Jan 2018 21:45:08 -0800 Subject: [PATCH 1017/1833] [doc]: update sonic-buildimage clone instructions (#1278) * [doc]: update sonic-buildimage clone instructions --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index db4ac55d5fec..e368b60291b1 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,17 @@ Please refer to [SONiC roadmap](https://github.com/Azure/SONiC/wiki/Sonic-Roadma ## Clone or fetch the code repository with all git submodules To clone the code repository recursively, assuming git version 1.9 or newer: - git clone --recursive https://github.com/Azure/sonic-buildimage.git + git clone https://github.com/Azure/sonic-buildimage.git ## Usage To build SONiC installer image and docker images, run the following commands: + cd sonic-buildimage + + # (Optional) Checkout a specific branch. By default, it uses master branch + git checkout [branch_name] + # Execute make init once after cloning the repo, or fetched remote repo with submodule updates make init From f077f41ce940723c501c5b4b1f068fc56b12bdda Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 3 Jan 2018 22:22:58 -0800 Subject: [PATCH 1018/1833] Let debootstrap uses the same sources link as apt (#1279) --- build_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 89fd1c77daaf..01dca9a03aca 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -68,7 +68,7 @@ touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime ## Build a basic Debian system by debootstrap echo '[INFO] Debootstrap...' -sudo http_proxy=$http_proxy debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://ftp.us.debian.org/debian +sudo http_proxy=$http_proxy debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://debian-archive.trafficmanager.net/debian ## Config hostname and hosts, otherwise 'sudo ...' will complain 'sudo: unable to resolve host ...' sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '$HOSTNAME' > /etc/hostname" From a27b3d54e72c218b42af504d66b0e5d253979651 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 4 Jan 2018 12:45:36 -0800 Subject: [PATCH 1019/1833] [platform]: chmod a+x for debian/rules for platform-modules-delta (#1282) --- platform/broadcom/sonic-platform-modules-delta/debian/rules | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 platform/broadcom/sonic-platform-modules-delta/debian/rules diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/rules b/platform/broadcom/sonic-platform-modules-delta/debian/rules old mode 100644 new mode 100755 From ffc19d3e9d0fdf3570f8149a824207a0be2ded54 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 5 Jan 2018 11:51:59 -0700 Subject: [PATCH 1020/1833] [arista]: Update Arista platform modules and mount libraries to snmp docker (#1283) Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sonic-platform-modules-arista | 2 +- rules/docker-snmp-sv2.mk | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 62b5b7da50f2..e657481807db 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 62b5b7da50f29d4299aaca69bdb40bf9172bb4e6 +Subproject commit e657481807db53dd4b87fa346b157153e201a37d diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk index 95fdcc25775c..1a5f68c9c032 100644 --- a/rules/docker-snmp-sv2.mk +++ b/rules/docker-snmp-sv2.mk @@ -12,3 +12,5 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) $(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp $(DOCKER_SNMP_SV2)_RUN_OPT += --net=host --privileged -t $(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +# mount Arista platform python libraries to support corresponding platforms SNMP power status query +$(DOCKER_SNMP_SV2)_RUN_OPT += -v /usr/lib/python3/dist-packages/arista:/usr/lib/python3/dist-packages/arista:ro From 32559d4fce1685818341560947eee32d9651faaf Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 8 Jan 2018 07:49:42 -0800 Subject: [PATCH 1021/1833] [platform]: chmod 0644 for *.mk files (#1284) --- platform/broadcom/one-image.mk | 0 platform/broadcom/platform-modules-accton.mk | 0 platform/broadcom/platform-modules-inventec.mk | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 platform/broadcom/one-image.mk mode change 100755 => 100644 platform/broadcom/platform-modules-accton.mk mode change 100755 => 100644 platform/broadcom/platform-modules-inventec.mk diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk old mode 100755 new mode 100644 diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk old mode 100755 new mode 100644 diff --git a/platform/broadcom/platform-modules-inventec.mk b/platform/broadcom/platform-modules-inventec.mk old mode 100755 new mode 100644 From 16763dcc77ba11880aad8ea75f6ba8d9cd15238b Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Tue, 9 Jan 2018 04:10:40 +0200 Subject: [PATCH 1022/1833] [mellanox]: Update Mellanox buffers configuration (#1263) Signed-off-by: Andriy Moroz --- .../msn27xx.32ports.buffers.json.j2 | 89 ++++++++++--------- .../tests/sample_output/msn27.32ports.json | 34 +++---- 2 files changed, 64 insertions(+), 59 deletions(-) diff --git a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 index 0a60f4584a19..579832ecda11 100644 --- a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 +++ b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 @@ -4,9 +4,29 @@ {%- if port_names_list.append(port) %}{% endif %} {% endfor %} {% set port_names = port_names_list | join(',') %} +{% set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + { + "BUFFER_POOL_TABLE:ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, { "BUFFER_POOL_TABLE:ingress_lossy_pool": { - "size": "6422528", + "size": "{{ ingress_lossy_pool_size }}", "type": "ingress", "mode": "dynamic" }, @@ -14,7 +34,7 @@ }, { "BUFFER_POOL_TABLE:egress_lossless_pool": { - "size": "7291456", + "size": "{{ egress_lossless_pool_size }}", "type": "egress", "mode": "dynamic" }, @@ -22,7 +42,7 @@ }, { "BUFFER_POOL_TABLE:egress_lossy_pool": { - "size": "8254464", + "size": "{{ egress_lossy_pool_size }}", "type": "egress", "mode": "dynamic" }, @@ -32,7 +52,7 @@ "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", "size":"0", - "dynamic_th":"1" + "dynamic_th":"0" }, "OP": "SET" }, @@ -40,7 +60,7 @@ "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -56,7 +76,7 @@ "BUFFER_PROFILE_TABLE:egress_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"4096", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -64,7 +84,7 @@ "BUFFER_PROFILE_TABLE:pg_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -80,7 +100,7 @@ "BUFFER_PROFILE_TABLE:q_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -98,7 +118,6 @@ }, {# The following template part is for variable PG profile configuration #} -{% set non_pg_lossless_pool_size = 866726 %} {% set pg_range = '3-4' %} {# Lists of supported speed and cable length #} {% set supported_speed = [10000, 25000, 40000, 50000, 100000] %} @@ -129,23 +148,23 @@ {# PG profiles. All profiles reffered in portconfig2profile dictionary should be declared here #} {# Only those which were actually used will be created in SAI #} {%- set pg_profiles = { - 'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 1 }, + 'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 }, - 'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 1 }, - 'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 1 }, - 'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 1 }, - 'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 1 }, - 'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 1 }, + 'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 }, + 'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 0 }, + 'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 }, + 'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 }, + 'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 0 }, - 'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 1 }, - 'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 1 }, - 'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 1 }, - 'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 1 }, - 'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 1 }, + 'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 0 }, + 'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 0 }, + 'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 }, + 'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 }, + 'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 0 }, } -%} @@ -159,13 +178,11 @@ } %} -{% set switch_role = DEVICE_METADATA['localhost']['type'] %} - -{%- macro cable_length(port_name) -%} +{% 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 %} @@ -201,7 +218,6 @@ {{ new_speed.0 }}_{{ new_cable.0 }} {%- endmacro -%} -{% set ingress_lossless_pg_pool_size = [] %} {% set used_pg_profiles = [] %} {% for port in PORT %} {%- if PORT[port].speed -%} @@ -215,9 +231,8 @@ {% set port_config = find_closest_greater_config(speed, cable) -%} {%- endif -%} {% set profile = portconfig2profile[port_config] -%} - {% if ingress_lossless_pg_pool_size.append(pg_profiles[profile]['size']) %}{% endif %} {# add to list profiles which were actually used #} - {%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif -%} + {%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif %} { "BUFFER_PG_TABLE:{{ port }}:{{ pg_range }}": { "profile" : "[BUFFER_PROFILE_TABLE:{{ profile }}]" @@ -240,17 +255,7 @@ }, "OP": "SET" }, -{% endfor -%} - - {# Lossless pool declaration #} - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { - "size": "{{ ingress_lossless_pg_pool_size | sum + non_pg_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, +{% endfor %} { "BUFFER_PG_TABLE:{{ port_names }}:0-1": { "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" diff --git a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json index a3cff0f0f0d5..a1e8e1486d6d 100644 --- a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json +++ b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json @@ -1,7 +1,15 @@ [ + { + "BUFFER_POOL_TABLE:ingress_lossless_pool": { + "size": "2097152", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, { "BUFFER_POOL_TABLE:ingress_lossy_pool": { - "size": "6422528", + "size": "5242880", "type": "ingress", "mode": "dynamic" }, @@ -9,7 +17,7 @@ }, { "BUFFER_POOL_TABLE:egress_lossless_pool": { - "size": "7291456", + "size": "16777152", "type": "egress", "mode": "dynamic" }, @@ -17,7 +25,7 @@ }, { "BUFFER_POOL_TABLE:egress_lossy_pool": { - "size": "8254464", + "size": "5242880", "type": "egress", "mode": "dynamic" }, @@ -27,7 +35,7 @@ "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", "size":"0", - "dynamic_th":"1" + "dynamic_th":"0" }, "OP": "SET" }, @@ -35,7 +43,7 @@ "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -51,7 +59,7 @@ "BUFFER_PROFILE_TABLE:egress_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"4096", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -59,7 +67,7 @@ "BUFFER_PROFILE_TABLE:pg_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -75,7 +83,7 @@ "BUFFER_PROFILE_TABLE:q_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -293,15 +301,7 @@ "xon":"18432", "xoff":"75776", "size":"94208", - "dynamic_th":"1" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { - "size": "3881382", - "type": "ingress", - "mode": "dynamic" + "dynamic_th":"0" }, "OP": "SET" }, From 0fffa6c63b90b2af68f653b929f6e98b5b38bc75 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 9 Jan 2018 17:55:10 -0800 Subject: [PATCH 1023/1833] Add caclmgrd and related files to translate and install control plane ACL rules (#1240) --- build_debian.sh | 2 + .../build_templates/sonic_debian_extension.j2 | 6 + files/docker/docker.service.conf | 2 +- files/image_config/caclmgrd/caclmgrd | 251 ++++++++++++++++++ files/image_config/caclmgrd/caclmgrd-start.sh | 10 + files/image_config/caclmgrd/caclmgrd.service | 11 + src/sonic-config-engine/minigraph.py | 12 +- src/sonic-config-engine/tests/test_cfggen.py | 2 +- src/sonic-utilities | 2 +- 9 files changed, 294 insertions(+), 4 deletions(-) create mode 100755 files/image_config/caclmgrd/caclmgrd create mode 100755 files/image_config/caclmgrd/caclmgrd-start.sh create mode 100644 files/image_config/caclmgrd/caclmgrd.service diff --git a/build_debian.sh b/build_debian.sh index 01dca9a03aca..ab24d269bb83 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -232,6 +232,8 @@ sudo cp files/sshd/host-ssh-keygen.sh $FILESYSTEM_ROOT/usr/local/bin/ sudo cp -f files/sshd/sshd.service $FILESYSTEM_ROOT/lib/systemd/system/ssh.service ## Config sshd sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTEM_ROOT +sudo sed -i 's/^ListenAddress ::/#ListenAddress ::/' $FILESYSTEM_ROOT/etc/ssh/sshd_config +sudo sed -i 's/^#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' $FILESYSTEM_ROOT/etc/ssh/sshd_config ## Config monit sudo sed -i ' diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index bf603d249d95..f861543e98c8 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -162,6 +162,12 @@ sudo cp $IMAGE_CONFIGS/asn/deployment_id_asn_map.yml $FILESYSTEM_ROOT/etc/sonic/ # Copy sudoers configuration file sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ +# Copy control plane ACL management daemon files +sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable caclmgrd.service +sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd-start.sh $FILESYSTEM_ROOT/usr/bin/ +sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd $FILESYSTEM_ROOT/usr/bin/ + ## Install package without starting service ## ref: https://wiki.debian.org/chroot sudo tee -a $FILESYSTEM_ROOT/usr/sbin/policy-rc.d > /dev/null < 0: + rule_cmd += " --tcp-flags " + + if tcp_flags & 0x01: + rule_cmd += "FIN," + if tcp_flags & 0x02: + rule_cmd += "SYN," + if tcp_flags & 0x04: + rule_cmd += "RST," + if tcp_flags & 0x08: + rule_cmd += "PSH," + if tcp_flags & 0x10: + rule_cmd += "ACK," + if tcp_flags & 0x20: + rule_cmd += "URG," + if tcp_flags & 0x40: + rule_cmd += "ECE," + if tcp_flags & 0x80: + rule_cmd += "CWR," + + # Delete the trailing comma + rule_cmd = rule_cmd[:-1] + + # Append the packet action as the jump target + rule_cmd += " -j {}".format(rule_props["PACKET_ACTION"]) + + iptables_cmds.append(rule_cmd) + + return iptables_cmds + + def update_control_plane_acls(self): + """ + Convenience wrapper which retrieves current ACL tables and rules from + Config DB, translates control plane ACLs into a list of iptables + commands and runs them. + """ + iptables_cmds = self.get_acl_rules_and_translate_to_iptables_commands() + + log_info("Issuing the following iptables commands:") + for cmd in iptables_cmds: + log_info(" " + cmd) + + self.run_commands(iptables_cmds) + + def notification_handler(self, key, data): + log_info("ACL configuration changed. Updating iptables rules for control plane ACLs...") + self.update_control_plane_acls() + + def run(self): + # Unconditionally update control plane ACLs once at start + self.update_control_plane_acls() + + # Subscribe to notifications when ACL tables or rules change + self.config_db.subscribe(self.ACL_TABLE, + lambda table, key, data: self.notification_handler(key, data)) + self.config_db.subscribe(self.ACL_RULE, + lambda table, key, data: self.notification_handler(key, data)) + + # Indefinitely listen for Config DB notifications + self.config_db.listen() + + +# ============================= Functions ============================= + +def main(): + log_info("Starting up...") + + if not os.geteuid() == 0: + log_error("Must be root to run this daemon") + print "Error: Must be root to run this daemon" + sys.exit(1) + + # Instantiate a ControlPlaneAclManager object + caclmgr = ControlPlaneAclManager() + caclmgr.run() + + +if __name__ == "__main__": + main() diff --git a/files/image_config/caclmgrd/caclmgrd-start.sh b/files/image_config/caclmgrd/caclmgrd-start.sh new file mode 100755 index 000000000000..3c7a2afbdf8b --- /dev/null +++ b/files/image_config/caclmgrd/caclmgrd-start.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Only start control plance ACL manager daemon if not an Arista platform. +# Arista devices will use their own service ACL manager daemon(s) instead. +if [ "$(sonic-cfggen -v "platform" | grep -c "arista")" -gt 0 ]; then + echo "Not starting caclmgrd - unsupported platform" + exit 0 +fi + +exec /usr/bin/caclmgrd diff --git a/files/image_config/caclmgrd/caclmgrd.service b/files/image_config/caclmgrd/caclmgrd.service new file mode 100644 index 000000000000..8e6cbb0c8e64 --- /dev/null +++ b/files/image_config/caclmgrd/caclmgrd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Control Plane ACL configuration daemon +Requires=database.service +After=database.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/caclmgrd-start.sh + +[Install] +WantedBy=multi-user.target diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index a7297913eb44..0dc3085e1294 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -200,7 +200,17 @@ def parse_dpg(dpg, hname): acl_intfs = port_alias_map.values() break; if acl_intfs: - acls[aclname] = { 'policy_desc': aclname, 'ports': acl_intfs, 'type': 'MIRROR' if is_mirror else 'L3'} + acls[aclname] = {'policy_desc': aclname, + 'ports': acl_intfs, + 'type': 'MIRROR' if is_mirror else 'L3', + 'service': 'N/A'} + else: + # This ACL has no interfaces to attach to -- consider this a control plane ACL + aclservice = aclintf.find(str(QName(ns, "Type"))).text + acls[aclname] = {'policy_desc': aclname, + 'ports': acl_intfs, + 'type': 'CTRLPLANE', + 'service': aclservice if aclservice is not None else ''} return intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, acls return None, None, None, None, None, None, None diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 2eee6fe331c8..768052a1d7e2 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -73,7 +73,7 @@ def test_render_template(self): def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + self.assertEqual(output.strip(), "{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'service': 'N/A', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") def test_minigraph_everflow(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION' diff --git a/src/sonic-utilities b/src/sonic-utilities index 5ad84866491e..6823ce2f3e46 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 5ad84866491e7d4cf4cebcb96e469423c9c91961 +Subproject commit 6823ce2f3e46d9bbf5fcfa6b371705a7368929cb From 9e2facbdc97dbba2b0e7416120e846079a00fa78 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 10 Jan 2018 03:04:32 -0800 Subject: [PATCH 1024/1833] [baseimage]: Install sysfsutils package into SONiC host system (#1290) --- build_debian.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_debian.sh b/build_debian.sh index ab24d269bb83..6a27bd5d237f 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -216,6 +216,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in less \ unzip \ gdisk \ + sysfsutils \ grub2-common sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ From 6d39e3a0f0d8d9d1c08716ac5c3b3059b27dc89d Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 10 Jan 2018 03:05:08 -0800 Subject: [PATCH 1025/1833] [[submodule]: Update swss-common (#1289) --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 283162b62d1d..aa55f69a9b53 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 283162b62d1dda594a5962e9ad8b4f9b65bf65c3 +Subproject commit aa55f69a9b53588d1de872f2d6f15384659f1a36 From 50f060e8bdc48bae72767be9af8caa531382eaf5 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 10 Jan 2018 03:06:47 -0800 Subject: [PATCH 1026/1833] Revert "[DHCP relay]: Add patch to always undef VLAN_TCI_PRESENT so as not to treat VLAN-tagged packets differently (#1254)" (#1291) This reverts commit 64602ad5b2294f2e1de6b0f1f1761fb7697b21a7. Reverting this commit because the root cause of the issue was due to a Broadcom SDK bug which caused VLAN-tagged packets to be tagged twice. When packets were double-tagged, only one tag was getting stripped before the packet was trapped to the CPU. However, the second tag was left behind, which would cause the DHCP relay agent to ignore the packet. The bug has since been fixed, so now all VLAN-tagged packets should properly have their tag removed before being trapped to the CPU. Therefore the DHCP relay agent should never encounter a VLAN-tagged packet. --- ...N_TCI_PRESENT-so-as-not-to-treat-VLA.patch | 30 ------------------- ...on-82-circuit-ID-and-remote-ID-fiel.patch} | 4 +-- ...ning-name-of-physical-interface-tha.patch} | 4 +-- ...ng-port-alias-map-file-to-replace-p.patch} | 4 +-- src/isc-dhcp/patch/series | 7 ++--- 5 files changed, 9 insertions(+), 40 deletions(-) delete mode 100644 src/isc-dhcp/patch/0001-Always-undef-VLAN_TCI_PRESENT-so-as-not-to-treat-VLA.patch rename src/isc-dhcp/patch/{0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch => 0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch} (98%) rename src/isc-dhcp/patch/{0003-Support-for-obtaining-name-of-physical-interface-tha.patch => 0002-Support-for-obtaining-name-of-physical-interface-tha.patch} (96%) rename src/isc-dhcp/patch/{0004-Support-for-loading-port-alias-map-file-to-replace-p.patch => 0003-Support-for-loading-port-alias-map-file-to-replace-p.patch} (98%) diff --git a/src/isc-dhcp/patch/0001-Always-undef-VLAN_TCI_PRESENT-so-as-not-to-treat-VLA.patch b/src/isc-dhcp/patch/0001-Always-undef-VLAN_TCI_PRESENT-so-as-not-to-treat-VLA.patch deleted file mode 100644 index f5afc5692a5d..000000000000 --- a/src/isc-dhcp/patch/0001-Always-undef-VLAN_TCI_PRESENT-so-as-not-to-treat-VLA.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 7fe46584c3d9cb6b1ecdee47ff5ac2b777f96ec6 Mon Sep 17 00:00:00 2001 -From: Joe LeVeque -Date: Wed, 20 Dec 2017 02:18:10 +0000 -Subject: [PATCH 1/4] Always undef VLAN_TCI_PRESENT so as not to treat - VLAN-tagged packets differently - ---- - configure.ac | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 3f1415b..fcfeba0 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -600,9 +600,9 @@ AC_CHECK_MEMBER(struct msghdr.msg_control,, - #include - ]) - --AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci, -- [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])] -- ,, [#include ]) -+#AC_CHECK_MEMBER(struct tpacket_auxdata.tp_vlan_tci, -+# [AC_DEFINE([VLAN_TCI_PRESENT], [1], [tpacket_auxdata.tp_vlan_tci present])] -+# ,, [#include ]) - - libbind= - AC_ARG_WITH(libbind, --- -2.1.4 - diff --git a/src/isc-dhcp/patch/0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch b/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch similarity index 98% rename from src/isc-dhcp/patch/0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch rename to src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch index 33197a80b0e0..22a8f7faedd1 100644 --- a/src/isc-dhcp/patch/0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch +++ b/src/isc-dhcp/patch/0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch @@ -1,7 +1,7 @@ -From c2361e2bf24408cc21a4691c3897cc64c95372f1 Mon Sep 17 00:00:00 2001 +From 284c87ff4b3873d0215904273fe3c86b07b4ba94 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 11 Dec 2017 23:21:08 +0000 -Subject: [PATCH 2/4] Customizable Option 82 circuit ID and remote ID fields +Subject: [PATCH 1/3] Customizable Option 82 circuit ID and remote ID fields --- relay/dhcrelay.c | 182 ++++++++++++++++++++++++++++++++++++++++++++++--------- diff --git a/src/isc-dhcp/patch/0003-Support-for-obtaining-name-of-physical-interface-tha.patch b/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch similarity index 96% rename from src/isc-dhcp/patch/0003-Support-for-obtaining-name-of-physical-interface-tha.patch rename to src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch index 7d9169dc67af..ee85a7736287 100644 --- a/src/isc-dhcp/patch/0003-Support-for-obtaining-name-of-physical-interface-tha.patch +++ b/src/isc-dhcp/patch/0002-Support-for-obtaining-name-of-physical-interface-tha.patch @@ -1,7 +1,7 @@ -From 236d4f1cb0afa2bee22f47a48b725427bfcb5a9c Mon Sep 17 00:00:00 2001 +From caad3e05c31c9fad8cda378ce95a1969def771a2 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 11 Dec 2017 23:39:10 +0000 -Subject: [PATCH 3/4] Support for obtaining name of physical interface that is +Subject: [PATCH 2/3] Support for obtaining name of physical interface that is a member of a bridge interface --- diff --git a/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch b/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch similarity index 98% rename from src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch rename to src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch index 1d42e9838f96..7411e1c4ff3e 100644 --- a/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch +++ b/src/isc-dhcp/patch/0003-Support-for-loading-port-alias-map-file-to-replace-p.patch @@ -1,7 +1,7 @@ -From 1092578a8415b9d49182c2b9825753e96481246a Mon Sep 17 00:00:00 2001 +From 3a42b497716375c9347b51c3a28c5e91e7cd4cf4 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 12 Dec 2017 00:49:09 +0000 -Subject: [PATCH 4/4] Support for loading port alias map file to replace port +Subject: [PATCH 3/3] Support for loading port alias map file to replace port name with alias in circuit id --- diff --git a/src/isc-dhcp/patch/series b/src/isc-dhcp/patch/series index 980b9b97e34b..a896563077c2 100644 --- a/src/isc-dhcp/patch/series +++ b/src/isc-dhcp/patch/series @@ -1,5 +1,4 @@ # This series applies on GIT commit ee3dffdda38a8cfc6ad2005d8d64a165d2a709ba -0001-Always-undef-VLAN_TCI_PRESENT-so-as-not-to-treat-VLA.patch -0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch -0003-Support-for-obtaining-name-of-physical-interface-tha.patch -0004-Support-for-loading-port-alias-map-file-to-replace-p.patch +0001-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch +0002-Support-for-obtaining-name-of-physical-interface-tha.patch +0003-Support-for-loading-port-alias-map-file-to-replace-p.patch From 8ae3c6c88a22c509d098983a8e3a09e977807a43 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Wed, 10 Jan 2018 19:08:05 +0800 Subject: [PATCH 1027/1833] [Platform]As7712-32x update for sensors test (#1292) * Update sonic-platform-modules-accton to lastest Signed-off-by: roylee123 * [platform]AS7712. 1. update device driver. - move 7712 modules to common dir, and linked to them. - add new lm75 node at I2C address 0x4B. - add optoe module for QSFP eeprom access. - add accton_pmbus_3y.c module for pmbus access. 2. masked sensor.conf for matching of sku-sensors-data.yml. Signed-off-by: roylee123 --- .../x86_64-accton_as7712_32x-r0/sensors.conf | 37 ++++++++++--------- .../broadcom/sonic-platform-modules-accton | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf b/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf index 21e1817916f9..33d75d598123 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf +++ b/device/accton/x86_64-accton_as7712_32x-r0/sensors.conf @@ -2,21 +2,22 @@ # ------------------------------------------------ # -chip "ym2651-*" - label power1 "PSU Output Power" - label temp1 "Power Supply Temp" - label fan1 "Fan Speed" - -chip "as7712_32x_fan-*" - label fan1 "Fan tray 1 front" - label fan2 "Fan tray 2 front" - label fan3 "Fan tray 3 front" - label fan4 "Fan tray 4 front" - label fan5 "Fan tray 5 front" - label fan6 "Fan tray 6 front" - label fan11 "Fan tray 1 rear" - label fan12 "Fan tray 2 rear" - label fan13 "Fan tray 3 rear" - label fan14 "Fan tray 4 rear" - label fan15 "Fan tray 5 rear" - label fan16 "Fan tray 6 rear" +#Comment out the following for sku-sensors-data.yml +#chip "ym2651-*" +# label power1 "PSU Output Power" +# label temp1 "Power Supply Temp" +# label fan1 "Fan Speed" +# +#chip "as7712_32x_fan-*" +# label fan1 "Fan tray 1 front" +# label fan2 "Fan tray 2 front" +# label fan3 "Fan tray 3 front" +# label fan4 "Fan tray 4 front" +# label fan5 "Fan tray 5 front" +# label fan6 "Fan tray 6 front" +# label fan11 "Fan tray 1 rear" +# label fan12 "Fan tray 2 rear" +# label fan13 "Fan tray 3 rear" +# label fan14 "Fan tray 4 rear" +# label fan15 "Fan tray 5 rear" +# label fan16 "Fan tray 6 rear" diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index dfff9a88cd94..a7149adb425b 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit dfff9a88cd94da081e80222872c33859e4132365 +Subproject commit a7149adb425bdd42520780f009f764b985ee0ebc From 1ceb07a2c5d43e24a1e201884b0eb0833c0b996f Mon Sep 17 00:00:00 2001 From: paavaanan Date: Thu, 11 Jan 2018 01:23:50 +0530 Subject: [PATCH 1028/1833] [Dell S6100, Z9100] psusutil sysfs attribute changes for hwmon (#1264) --- device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py | 7 ++++--- device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py index 83452f69aaa4..b753cd711dae 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py @@ -20,10 +20,11 @@ def __init__(self): # Get a mailbox register def get_pmc_register(self, reg_name): - mailbox_dir = "/sys/devices/platform/dell_s6100_lpc" + mailbox_dir = "/sys/devices/platform/SMF.512/hwmon/hwmon1" retval = 'ERR' mb_reg_file = mailbox_dir+'/' + reg_name if (not os.path.isfile(mb_reg_file)): + print mb_reg_file, 'not found !' return retval try: @@ -52,7 +53,7 @@ def get_psu_status(self, index): faulty """ status = 0 - psu_status = self.get_pmc_register('psu_'+str(index)+'_status') + psu_status = self.get_pmc_register('psu'+str(index)+'_presence') if (psu_status != 'ERR'): psu_status = int(psu_status, 16) # Check for PSU statuse @@ -69,7 +70,7 @@ def get_psu_presence(self, index): :return: Boolean, True if PSU is plugged, False if not """ status = 0 - psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') + psu_presence = self.get_pmc_register('psu'+str(index)+'_presence') if (psu_presence != 'ERR'): psu_presence = int(psu_presence, 16) # Check for PSU presence diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py index 2ad6ae7d1491..2e07ee818818 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py @@ -20,10 +20,11 @@ def __init__(self): # Get a mailbox register def get_pmc_register(self, reg_name): - mailbox_dir = "/sys/devices/platform/dell_mailbox" + mailbox_dir = "/sys/devices/platform/SMF.512/hwmon/hwmon1" retval = 'ERR' mb_reg_file = mailbox_dir+'/' + reg_name if (not os.path.isfile(mb_reg_file)): + print mb_reg_file, 'not found !' return retval try: @@ -52,7 +53,7 @@ def get_psu_status(self, index): faulty """ status = 0 - psu_status = self.get_pmc_register('psu_'+str(index)+'_status') + psu_status = self.get_pmc_register('psu'+str(index)+'_presence') if (psu_status != 'ERR'): psu_status = int(psu_status, 16) # Check for PSU statuse @@ -69,7 +70,7 @@ def get_psu_presence(self, index): :return: Boolean, True if PSU is plugged, False if not """ status = 0 - psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') + psu_presence = self.get_pmc_register('psu'+str(index)+'_presence') if (psu_presence != 'ERR'): psu_presence = int(psu_presence, 16) # Check for PSU presence From 9669b3477ed45d0ba0bcd09ee6a8aa2044dcab27 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 10 Jan 2018 18:42:45 -0800 Subject: [PATCH 1029/1833] Revert "[Dell S6100, Z9100] psusutil sysfs attribute changes for hwmon (#1264)" (#1297) This reverts commit 1ceb07a2c5d43e24a1e201884b0eb0833c0b996f. --- device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py | 7 +++---- device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py index b753cd711dae..83452f69aaa4 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py @@ -20,11 +20,10 @@ def __init__(self): # Get a mailbox register def get_pmc_register(self, reg_name): - mailbox_dir = "/sys/devices/platform/SMF.512/hwmon/hwmon1" + mailbox_dir = "/sys/devices/platform/dell_s6100_lpc" retval = 'ERR' mb_reg_file = mailbox_dir+'/' + reg_name if (not os.path.isfile(mb_reg_file)): - print mb_reg_file, 'not found !' return retval try: @@ -53,7 +52,7 @@ def get_psu_status(self, index): faulty """ status = 0 - psu_status = self.get_pmc_register('psu'+str(index)+'_presence') + psu_status = self.get_pmc_register('psu_'+str(index)+'_status') if (psu_status != 'ERR'): psu_status = int(psu_status, 16) # Check for PSU statuse @@ -70,7 +69,7 @@ def get_psu_presence(self, index): :return: Boolean, True if PSU is plugged, False if not """ status = 0 - psu_presence = self.get_pmc_register('psu'+str(index)+'_presence') + psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') if (psu_presence != 'ERR'): psu_presence = int(psu_presence, 16) # Check for PSU presence diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py index 2e07ee818818..2ad6ae7d1491 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py @@ -20,11 +20,10 @@ def __init__(self): # Get a mailbox register def get_pmc_register(self, reg_name): - mailbox_dir = "/sys/devices/platform/SMF.512/hwmon/hwmon1" + mailbox_dir = "/sys/devices/platform/dell_mailbox" retval = 'ERR' mb_reg_file = mailbox_dir+'/' + reg_name if (not os.path.isfile(mb_reg_file)): - print mb_reg_file, 'not found !' return retval try: @@ -53,7 +52,7 @@ def get_psu_status(self, index): faulty """ status = 0 - psu_status = self.get_pmc_register('psu'+str(index)+'_presence') + psu_status = self.get_pmc_register('psu_'+str(index)+'_status') if (psu_status != 'ERR'): psu_status = int(psu_status, 16) # Check for PSU statuse @@ -70,7 +69,7 @@ def get_psu_presence(self, index): :return: Boolean, True if PSU is plugged, False if not """ status = 0 - psu_presence = self.get_pmc_register('psu'+str(index)+'_presence') + psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') if (psu_presence != 'ERR'): psu_presence = int(psu_presence, 16) # Check for PSU presence From 41cdb8971f2f3f90c20fa8446b112300980135a6 Mon Sep 17 00:00:00 2001 From: nealtai <33504193+nealtai@users.noreply.github.com> Date: Fri, 12 Jan 2018 07:17:55 +0800 Subject: [PATCH 1030/1833] [Delta]: Add psuutil support for ag9032v1 (#1298) Fix the bug of psu module for ag9032v1 Signed-off-by: neal --- .../plugins/psuutil.py | 57 +++++++++++++++++++ .../ag9032v1/modules/dni_ag9032v1_psu.c | 38 +++++++------ 2 files changed, 78 insertions(+), 17 deletions(-) create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py diff --git a/device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py b/device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py new file mode 100644 index 000000000000..4b370d9a7443 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/plugins/psuutil.py @@ -0,0 +1,57 @@ +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/{}-0058/" + self.psu_oper_status = "in1_input" + self.psu_presence = "i2cget -y {} 0x50 0x00" + + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + if index is None: + return False + Base_bus_number = 39 + status = 0 + #index from 1, psu attribute bus from 40 + try: + with open(self.psu_path.format(index + Base_bus_number) + self.psu_oper_status, 'r') as power_status: + if int(power_status.read()) == 0 : + return False + else: + status = 1 + except IOError: + return False + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + Base_bus_number = 39 + status = 0 + try: + p = os.popen(self.psu_presence.format(index + Base_bus_number)+ "> /dev/null 2>&1") + if p.readline() != None: + status = 1 + p.close() + except IOError: + return False + return status == 1 + + diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c index b9ddb979a29b..e47813af3e09 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c @@ -2,9 +2,9 @@ * An hwmon driver for delta AG9032v1 PSU * dps_800ab_16_d.c - Support for DPS-800AB-16 D Power Supply Module * - * Copyright (C) 2017 Delta Networks, Inc. + * Copyright (C) 2016 Delta Network Technology Corporation * - * Aries Lin + * DNI * * Based on ym2651y.c * Based on ad7414.c @@ -361,6 +361,7 @@ static struct dps_800ab_16_d_data *dps_800ab_16_d_update_device( \ if (status < 0) { dev_dbg(&client->dev, "reg %d, err %d\n", regs_byte[i].reg, status); + *(regs_byte[i].value) = 0; } else { *(regs_byte[i].value) = status; } @@ -372,28 +373,31 @@ static struct dps_800ab_16_d_data *dps_800ab_16_d_update_device( \ if (status < 0) { dev_dbg(&client->dev, "reg %d, err %d\n", regs_word[i].reg, status); + *(regs_word[i].value) = 0; } else { *(regs_word[i].value) = status; } } command = 0x9a; /* PSU mfr_model */ + //data->mfr_model[1] = '\0'; status = dps_800ab_16_d_read_block(client, command, - data->mfr_model, ARRAY_SIZE(data->mfr_model) - 1); - data->mfr_model[ARRAY_SIZE(data->mfr_model) - 1] = '\0'; - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", command, - status); - } - - command = 0x9e; /* PSU mfr_serial */ - status = dps_800ab_16_d_read_block(client, command, - data->mfr_serial, ARRAY_SIZE(data->mfr_serial) - 1); - data->mfr_serial[ARRAY_SIZE(data->mfr_serial) - 1] = '\0'; - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", command, - status); - } + data->mfr_model, ARRAY_SIZE(data->mfr_model) - 1); + data->mfr_model[ARRAY_SIZE(data->mfr_model) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command,status); + data->mfr_model[1] = '\0'; + } + + command = 0x9e; /* PSU mfr_serial */ + //data->mfr_serial[1] = '\0'; + status = dps_800ab_16_d_read_block(client, command, + data->mfr_serial, ARRAY_SIZE(data->mfr_serial) - 1); + data->mfr_serial[ARRAY_SIZE(data->mfr_serial) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command,status); + data->mfr_serial[1] = '\0'; + } data->valid = 1; } From ac0de13705f31951ff7fd4df5cb7458f87ca7084 Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Fri, 12 Jan 2018 07:18:50 +0800 Subject: [PATCH 1031/1833] [Platform] Update switch configuration files and download link for Ingrasys S9130-32X/S9230-64X (#1295) - What I did Updating switch configuration files and download link - How I did it Updating related switch configuration files in device/ingrasys Updating related mk files in platform/nephos - How to verify it Check system and network feature is worked as well - Description for the changelog Update switch configuration files and download link for Ingrasys S9130-32X/S9230-64X - A picture of a cute animal (not mandatory but encouraged) Signed-off-by: Sam Yang --- .../INGRASYS-S9130-32X/port_config.nps | 318 +++++++ .../led_proc_init.nps | 29 +- .../INGRASYS-S9230-64X/port_config.nps | 864 ++++++++++++++++++ .../led_proc_init.nps | 29 +- platform/nephos/rules.mk | 2 +- platform/nephos/sai.mk | 8 +- platform/nephos/sdk.mk | 4 +- 7 files changed, 1207 insertions(+), 47 deletions(-) diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps index e69de29bb2d1..ac6268716170 100644 --- a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps @@ -0,0 +1,318 @@ +init start stage low-level +init set port-map port=0 eth-macro=0 lane=0 max-speed=100g active=true +init set port-map port=1 eth-macro=1 lane=0 max-speed=100g active=true +init set port-map port=2 eth-macro=2 lane=0 max-speed=100g active=true +init set port-map port=3 eth-macro=3 lane=0 max-speed=100g active=true +init set port-map port=4 eth-macro=4 lane=0 max-speed=100g active=true +init set port-map port=5 eth-macro=5 lane=0 max-speed=100g active=true +init set port-map port=6 eth-macro=6 lane=0 max-speed=100g active=true +init set port-map port=7 eth-macro=7 lane=0 max-speed=100g active=true +init set port-map port=8 eth-macro=8 lane=0 max-speed=100g active=true +init set port-map port=9 eth-macro=9 lane=0 max-speed=100g active=true +init set port-map port=10 eth-macro=10 lane=0 max-speed=100g active=true +init set port-map port=11 eth-macro=11 lane=0 max-speed=100g active=true +init set port-map port=12 eth-macro=12 lane=0 max-speed=100g active=true +init set port-map port=13 eth-macro=13 lane=0 max-speed=100g active=true +init set port-map port=14 eth-macro=14 lane=0 max-speed=100g active=true +init set port-map port=15 eth-macro=15 lane=0 max-speed=100g active=true +init set port-map port=16 eth-macro=16 lane=0 max-speed=100g active=true +init set port-map port=17 eth-macro=17 lane=0 max-speed=100g active=true +init set port-map port=18 eth-macro=18 lane=0 max-speed=100g active=true +init set port-map port=19 eth-macro=19 lane=0 max-speed=100g active=true +init set port-map port=20 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map port=21 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map port=22 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map port=23 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map port=24 eth-macro=24 lane=0 max-speed=100g active=true +init set port-map port=25 eth-macro=25 lane=0 max-speed=100g active=true +init set port-map port=26 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map port=27 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map port=28 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map port=29 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map port=30 eth-macro=30 lane=0 max-speed=100g active=true +init set port-map port=31 eth-macro=31 lane=0 max-speed=100g active=true +init set port-map port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage task-rsrc +init start stage module +init start stage task +phy set lane-swap portlist=0 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=1 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=2 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=3 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=4 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=5 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=6 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=7 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=8 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=9 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=10 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=11 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=12 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=13 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=14 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=15 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=16 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=17 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=18 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=19 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=20 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=21 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=22 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=23 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=24 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=25 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=26 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=27 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=28 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=29 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=30 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=31 lane-num=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=129 lane-num=1 property=tx data=0x1 +phy set lane-swap portlist=130 lane-num=1 property=tx data=0x0 +phy set lane-swap portlist=0 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=1 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=2 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=3 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=4 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=5 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=6 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=7 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=8 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=9 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=10 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=11 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=12 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=13 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=14 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=15 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=16 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=17 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=18 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=19 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=20 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=21 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=22 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=23 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=24 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=25 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=26 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=27 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=28 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=29 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=30 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=31 lane-num=4 property=rx data=0x03.02.01.00 +phy set lane-swap portlist=129 lane-num=1 property=rx data=0x1 +phy set lane-swap portlist=130 lane-num=1 property=rx data=0x0 +phy set polarity-rev portlist=0 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=1 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=2 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=3 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=4 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=5 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=6 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=7 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=8 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=9 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=10 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=11 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=12 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=13 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=14 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=15 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=16 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=17 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=18 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=19 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=20 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=21 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=22 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=23 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=24 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=25 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=26 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=27 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=28 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=29 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=30 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=31 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=129 lane-num=1 property=tx data=0x0 +phy set polarity-rev portlist=130 lane-num=1 property=tx data=0x0 +phy set polarity-rev portlist=0 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=1 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=2 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=3 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=4 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=5 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=6 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=7 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=8 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=9 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=10 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=11 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=12 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=13 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=14 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=15 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=16 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=17 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=18 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=19 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=20 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=21 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=22 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=23 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=24 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=25 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=26 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=27 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=28 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=29 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=30 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=31 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=129 lane-num=1 property=rx data=0x0 +phy set polarity-rev portlist=130 lane-num=1 property=rx data=0x0 +phy set pre-emphasis portlist=0 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=0 lane-num=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis portlist=0 lane-num=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=0 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=1 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=1 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=1 lane-num=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=1 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=2 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=2 lane-num=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis portlist=2 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=2 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=3 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=3 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=3 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=3 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=4 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=4 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=4 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=4 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=5 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=5 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=5 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=5 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=6 lane-num=4 property=c2 data=0x03.03.03.03 +phy set pre-emphasis portlist=6 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=6 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=6 lane-num=4 property=c1 data=0x05.05.05.05 +phy set pre-emphasis portlist=7 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=7 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=7 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=7 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=8 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=8 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=8 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=8 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=9 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=9 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=9 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=9 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=10 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=10 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=10 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=10 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=11 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=11 lane-num=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis portlist=11 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=11 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=12 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=12 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=12 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=12 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=13 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=13 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=13 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=13 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=14 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=14 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=14 lane-num=4 property=c0 data=0x1D.1D.1D.1D +phy set pre-emphasis portlist=14 lane-num=4 property=c1 data=0x05.05.05.05 +phy set pre-emphasis portlist=15 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=15 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=15 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=15 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=16 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=16 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=16 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=16 lane-num=4 property=c1 data=0x05.05.05.05 +phy set pre-emphasis portlist=17 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=17 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=17 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=17 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=18 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=18 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=18 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=18 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=19 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=19 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=19 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=19 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=20 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=20 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=20 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=20 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=21 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=21 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=21 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=21 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=22 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=22 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=22 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=22 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=23 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=23 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=23 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=23 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=24 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=24 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=24 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=24 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=25 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=25 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=25 lane-num=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=25 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=26 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=26 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=26 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=26 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=27 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=27 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=27 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=27 lane-num=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis portlist=28 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=28 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=28 lane-num=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=28 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=29 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=29 lane-num=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis portlist=29 lane-num=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=29 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=30 lane-num=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis portlist=30 lane-num=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis portlist=30 lane-num=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=30 lane-num=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis portlist=31 lane-num=4 property=c2 data=0x01.01.01.01 +phy set pre-emphasis portlist=31 lane-num=4 property=cn1 data=0x03.03.03.03 +phy set pre-emphasis portlist=31 lane-num=4 property=c0 data=0x17.17.17.17 +phy set pre-emphasis portlist=31 lane-num=4 property=c1 data=0x09.09.09.09 +phy set pre-emphasis portlist=129 lane-num=1 property=c2 data=0x01 +phy set pre-emphasis portlist=129 lane-num=1 property=cn1 data=0x01 +phy set pre-emphasis portlist=129 lane-num=1 property=c0 data=0x02 +phy set pre-emphasis portlist=129 lane-num=1 property=c1 data=0x03 +phy set pre-emphasis portlist=130 lane-num=1 property=c2 data=0x01 +phy set pre-emphasis portlist=130 lane-num=1 property=cn1 data=0x01 +phy set pre-emphasis portlist=130 lane-num=1 property=c0 data=0x02 +phy set pre-emphasis portlist=130 lane-num=1 property=c1 data=0x03 +port set portlist=0-31 speed=100g +port set portlist=129-130 speed=10g +port set portlist=0-31 medium-type=sr4 +port set portlist=129-130 medium-type=kr +port set portlist=0-31 fec=rs +port advertise portlist=129-130 speed-10g-kr +port set portlist=129-130 an=enable +port set portlist=0-31,129-130 admin=enable diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps index b482a7a0b977..d1695e36b59a 100644 --- a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/led_proc_init.nps @@ -1,20 +1,9 @@ -#This configuration file is for customer init value feature. Please refer to mtk_cfg.h/mtk_cfg.c for detail. -#1. The lines beginning with # are comment lines. The lines beginning with number are the setting lines. -#2. There are five parameters which can be set. -# 1) the first is unit. -# 2) the second is NPS_CFG_TYPE_XXX. Refer to NPS_CFG_TYPE_T. -# 3) the 3-5 are {param0, param1, value} pairs. Refer to NPS_CFG_VALUE_T. Support HEX format. -# 4) the (unit, NPS_CFG_TYPE_XXX, param0, param1) group is the key to get the correspingding value. -# There should be no same (unit, NPS_CFG_TYPE_XXX, param0, param1) group. -#3. User must follow correct format to apply the setting. Please refer to below commentted example(#0 NPS_CFG_TYPE_L2_ADDR_MODE 0 0 1); -#4. Usage under the linux shell: -# 1) ./image-path/image-name -c cfg-path/NPS_Ari_EVB_24.cfg : mamually specify directory path if they are not in current work dirctory. -# 2) ./image-name -c NPS_Ari_EVB_24.cfg : the image and the NPS_Ari_EVB_24.cfg are in the current work directory. - -#unit NPS_CFG_TYPE_XXX param0 param1 value -#---- ---------------- ------ ------ ----- -0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 -0 NPS_CFG_TYPE_LED_CFG 0 0 1 -0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 0 -0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 0 -0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +#unit NPS_CFG_TYPE_XXX param0 param1 value +#---- ---------------- ------ ------ ----- +0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 +0 NPS_CFG_TYPE_LED_CFG 0 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 1 +0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +0 NPS_CFG_TYPE_HASH_L2_FDB_REGION_ENTRY_NUM 0 0 49152 +0 NPS_CFG_TYPE_HASH_L3_WITH_IPV6_PREFIX_64_REGION_ENTRY_NUM 0 0 32768 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps index e69de29bb2d1..2b013f7641eb 100644 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps @@ -0,0 +1,864 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=1 lane=0 max-speed=100g active=true +init set port-map unit=0 port=1 eth-macro=0 lane=0 max-speed=100g active=true +init set port-map unit=0 port=2 eth-macro=5 lane=0 max-speed=100g active=true +init set port-map unit=0 port=3 eth-macro=4 lane=0 max-speed=100g active=true +init set port-map unit=0 port=4 eth-macro=9 lane=0 max-speed=100g active=true +init set port-map unit=0 port=5 eth-macro=8 lane=0 max-speed=100g active=true +init set port-map unit=0 port=6 eth-macro=13 lane=0 max-speed=100g active=true +init set port-map unit=0 port=7 eth-macro=12 lane=0 max-speed=100g active=true +init set port-map unit=0 port=8 eth-macro=17 lane=0 max-speed=100g active=true +init set port-map unit=0 port=9 eth-macro=16 lane=0 max-speed=100g active=true +init set port-map unit=0 port=10 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=11 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=12 eth-macro=25 lane=0 max-speed=100g active=true +init set port-map unit=0 port=13 eth-macro=24 lane=0 max-speed=100g active=true +init set port-map unit=0 port=14 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=15 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=16 eth-macro=33 lane=0 max-speed=100g active=true +init set port-map unit=0 port=17 eth-macro=32 lane=0 max-speed=100g active=true +init set port-map unit=0 port=18 eth-macro=37 lane=0 max-speed=100g active=true +init set port-map unit=0 port=19 eth-macro=36 lane=0 max-speed=100g active=true +init set port-map unit=0 port=20 eth-macro=41 lane=0 max-speed=100g active=true +init set port-map unit=0 port=21 eth-macro=40 lane=0 max-speed=100g active=true +init set port-map unit=0 port=22 eth-macro=45 lane=0 max-speed=100g active=true +init set port-map unit=0 port=23 eth-macro=44 lane=0 max-speed=100g active=true +init set port-map unit=0 port=24 eth-macro=49 lane=0 max-speed=100g active=true +init set port-map unit=0 port=25 eth-macro=48 lane=0 max-speed=100g active=true +init set port-map unit=0 port=26 eth-macro=53 lane=0 max-speed=100g active=true +init set port-map unit=0 port=27 eth-macro=52 lane=0 max-speed=100g active=true +init set port-map unit=0 port=28 eth-macro=57 lane=0 max-speed=100g active=true +init set port-map unit=0 port=29 eth-macro=56 lane=0 max-speed=100g active=true +init set port-map unit=0 port=30 eth-macro=61 lane=0 max-speed=100g active=true +init set port-map unit=0 port=31 eth-macro=60 lane=0 max-speed=100g active=true +init set port-map unit=0 port=32 eth-macro=3 lane=0 max-speed=100g active=true +init set port-map unit=0 port=33 eth-macro=2 lane=0 max-speed=100g active=true +init set port-map unit=0 port=34 eth-macro=7 lane=0 max-speed=100g active=true +init set port-map unit=0 port=35 eth-macro=6 lane=0 max-speed=100g active=true +init set port-map unit=0 port=36 eth-macro=11 lane=0 max-speed=100g active=true +init set port-map unit=0 port=37 eth-macro=10 lane=0 max-speed=100g active=true +init set port-map unit=0 port=38 eth-macro=15 lane=0 max-speed=100g active=true +init set port-map unit=0 port=39 eth-macro=14 lane=0 max-speed=100g active=true +init set port-map unit=0 port=40 eth-macro=19 lane=0 max-speed=100g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=0 max-speed=100g active=true +init set port-map unit=0 port=42 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map unit=0 port=43 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map unit=0 port=44 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=45 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=46 eth-macro=31 lane=0 max-speed=100g active=true +init set port-map unit=0 port=47 eth-macro=30 lane=0 max-speed=100g active=true +init set port-map unit=0 port=48 eth-macro=35 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=34 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=39 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=38 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=43 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=42 lane=0 max-speed=100g active=true +init set port-map unit=0 port=54 eth-macro=47 lane=0 max-speed=100g active=true +init set port-map unit=0 port=55 eth-macro=46 lane=0 max-speed=100g active=true +init set port-map unit=0 port=56 eth-macro=51 lane=0 max-speed=100g active=true +init set port-map unit=0 port=57 eth-macro=50 lane=0 max-speed=100g active=true +init set port-map unit=0 port=58 eth-macro=55 lane=0 max-speed=100g active=true +init set port-map unit=0 port=59 eth-macro=54 lane=0 max-speed=100g active=true +init set port-map unit=0 port=60 eth-macro=59 lane=0 max-speed=100g active=true +init set port-map unit=0 port=61 eth-macro=58 lane=0 max-speed=100g active=true +init set port-map unit=0 port=62 eth-macro=63 lane=0 max-speed=100g active=true +init set port-map unit=0 port=63 eth-macro=62 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=1 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=2 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=3 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=4 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=5 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=6 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=7 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=8 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=9 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=10 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=11 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=12 lane-num=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=13 lane-num=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=14 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=15 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=16 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=17 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=18 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=19 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=20 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=21 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=22 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=23 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=24 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=25 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=26 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=27 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=28 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=29 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=30 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=31 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=32 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=33 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=34 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=35 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=36 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=37 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=38 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=39 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=40 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=41 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=42 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=43 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=44 lane-num=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=45 lane-num=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=46 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=47 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=48 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=49 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=50 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=51 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=52 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=53 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=54 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=55 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=56 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=57 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=58 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=59 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=60 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=61 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=62 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=63 lane-num=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=129 lane-num=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-num=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=0 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=1 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=2 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=3 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=4 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=5 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=6 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=7 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=8 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=9 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=10 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=11 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=12 lane-num=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=13 lane-num=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=14 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=15 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=16 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=17 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=18 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=19 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=20 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=21 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=22 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=23 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=24 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=25 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=26 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=27 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=28 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=29 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=30 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=31 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=32 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=33 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=34 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=35 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=36 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=37 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=38 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=39 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=40 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=41 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=42 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=43 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=44 lane-num=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=45 lane-num=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=46 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=47 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=48 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=49 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=50 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=51 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=52 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=53 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=54 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=55 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=56 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=57 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=58 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=59 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=60 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=61 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=62 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=63 lane-num=4 property=rx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=129 lane-num=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-num=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=1 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=2 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=3 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=4 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=5 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=6 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=7 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=8 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=9 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=10 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=11 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=12 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=13 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=14 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=15 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=16 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=17 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=18 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=19 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=20 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=21 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=22 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=23 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=24 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=25 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=26 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=27 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=28 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=29 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=30 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=31 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=32 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=33 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=34 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=35 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=36 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=37 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=38 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=39 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=40 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=41 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=42 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=43 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=44 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=45 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=46 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=47 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=48 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=49 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=51 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=55 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=56 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=57 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=58 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=59 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=60 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=61 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=62 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=63 lane-num=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-num=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-num=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=1 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=2 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=3 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=4 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=5 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=6 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=7 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=8 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=9 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=10 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=11 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=12 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=13 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=14 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=15 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=16 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=17 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=18 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=19 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=20 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=21 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=22 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=23 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=24 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=25 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=26 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=27 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=28 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=29 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=30 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=31 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=32 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=33 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=34 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=35 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=36 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=37 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=38 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=39 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=40 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=41 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=42 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=43 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=44 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=45 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=46 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=47 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=48 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=49 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=51 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=55 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=56 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=57 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=58 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=59 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=60 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=61 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=62 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=63 lane-num=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-num=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-num=1 property=rx data=0x0 +phy set pre-emphasis unit=0 portlist=0 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=0 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=0 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=0 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=1 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=1 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=1 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=1 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=2 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=2 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=2 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=2 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=3 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=3 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=3 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=3 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=4 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=4 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=4 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=4 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=5 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=5 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=5 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=5 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=6 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=6 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=6 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=6 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=7 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=7 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=7 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=7 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=8 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=8 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=8 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=8 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=9 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=9 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=9 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=9 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=10 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=10 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=10 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=10 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=11 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=11 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=11 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=11 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=12 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=12 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=12 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=12 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=13 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=13 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=13 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=13 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=14 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=14 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=14 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=14 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=15 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=15 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=15 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=15 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=16 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=16 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=16 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=16 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=17 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=17 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=17 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=17 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=18 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=18 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=18 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=18 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=19 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=19 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=19 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=19 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=20 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=20 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=20 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=20 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=21 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=21 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=21 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=21 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=22 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=22 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=22 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=22 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=23 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=23 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=23 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=23 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=24 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=24 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=24 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=24 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=25 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=25 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=25 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=25 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=26 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=26 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=26 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=26 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=27 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=27 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=27 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=27 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=28 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=28 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=28 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=28 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=29 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=29 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=29 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=29 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=30 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=30 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=30 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=30 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=31 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=31 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=31 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=31 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=32 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=32 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=32 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=32 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=33 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=33 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=33 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=33 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=34 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=34 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=34 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=34 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=35 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=35 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=35 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=35 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=36 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=36 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=36 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=36 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=37 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=37 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=37 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=37 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=38 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=38 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=38 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=38 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=39 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=39 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=39 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=39 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=40 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=40 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=40 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=40 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=41 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=41 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=41 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=41 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=42 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=42 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=42 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=42 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=43 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=43 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=43 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=43 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=44 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=44 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=44 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=44 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=45 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=45 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=45 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=45 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=46 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=46 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=46 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=46 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=47 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=47 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=47 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=47 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=48 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=48 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=48 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=48 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=49 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=49 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=49 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=49 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=50 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=50 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=50 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=50 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=51 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=51 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=51 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=51 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=52 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=52 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=52 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=52 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=53 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=53 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=53 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=53 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=54 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=54 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=54 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=54 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=55 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=55 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=55 lane-num=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis unit=0 portlist=55 lane-num=4 property=c1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=56 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=56 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=56 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=56 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=57 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=57 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=57 lane-num=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=57 lane-num=4 property=c1 data=0x5.5.5.5 +phy set pre-emphasis unit=0 portlist=58 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=58 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=58 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=58 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=59 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=59 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=59 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=59 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=60 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=60 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=60 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=60 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=61 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=61 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=61 lane-num=4 property=c0 data=0x19.19.19.19 +phy set pre-emphasis unit=0 portlist=61 lane-num=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis unit=0 portlist=62 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=62 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=62 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=62 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=63 lane-num=4 property=c2 data=0x1.1.1.1 +phy set pre-emphasis unit=0 portlist=63 lane-num=4 property=cn1 data=0x3.3.3.3 +phy set pre-emphasis unit=0 portlist=63 lane-num=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis unit=0 portlist=63 lane-num=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=129 lane-num=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-num=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-num=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=129 lane-num=1 property=c1 data=0x3 +phy set pre-emphasis unit=0 portlist=130 lane-num=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=130 lane-num=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=130 lane-num=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=130 lane-num=1 property=c1 data=0x3 +port set unit=0 portlist=0 speed=100g +port set unit=0 portlist=1 speed=100g +port set unit=0 portlist=2 speed=100g +port set unit=0 portlist=3 speed=100g +port set unit=0 portlist=4 speed=100g +port set unit=0 portlist=5 speed=100g +port set unit=0 portlist=6 speed=100g +port set unit=0 portlist=7 speed=100g +port set unit=0 portlist=8 speed=100g +port set unit=0 portlist=9 speed=100g +port set unit=0 portlist=10 speed=100g +port set unit=0 portlist=11 speed=100g +port set unit=0 portlist=12 speed=100g +port set unit=0 portlist=13 speed=100g +port set unit=0 portlist=14 speed=100g +port set unit=0 portlist=15 speed=100g +port set unit=0 portlist=16 speed=100g +port set unit=0 portlist=17 speed=100g +port set unit=0 portlist=18 speed=100g +port set unit=0 portlist=19 speed=100g +port set unit=0 portlist=20 speed=100g +port set unit=0 portlist=21 speed=100g +port set unit=0 portlist=22 speed=100g +port set unit=0 portlist=23 speed=100g +port set unit=0 portlist=24 speed=100g +port set unit=0 portlist=25 speed=100g +port set unit=0 portlist=26 speed=100g +port set unit=0 portlist=27 speed=100g +port set unit=0 portlist=28 speed=100g +port set unit=0 portlist=29 speed=100g +port set unit=0 portlist=30 speed=100g +port set unit=0 portlist=31 speed=100g +port set unit=0 portlist=32 speed=100g +port set unit=0 portlist=33 speed=100g +port set unit=0 portlist=34 speed=100g +port set unit=0 portlist=35 speed=100g +port set unit=0 portlist=36 speed=100g +port set unit=0 portlist=37 speed=100g +port set unit=0 portlist=38 speed=100g +port set unit=0 portlist=39 speed=100g +port set unit=0 portlist=40 speed=100g +port set unit=0 portlist=41 speed=100g +port set unit=0 portlist=42 speed=100g +port set unit=0 portlist=43 speed=100g +port set unit=0 portlist=44 speed=100g +port set unit=0 portlist=45 speed=100g +port set unit=0 portlist=46 speed=100g +port set unit=0 portlist=47 speed=100g +port set unit=0 portlist=48 speed=100g +port set unit=0 portlist=49 speed=100g +port set unit=0 portlist=50 speed=100g +port set unit=0 portlist=51 speed=100g +port set unit=0 portlist=52 speed=100g +port set unit=0 portlist=53 speed=100g +port set unit=0 portlist=54 speed=100g +port set unit=0 portlist=55 speed=100g +port set unit=0 portlist=56 speed=100g +port set unit=0 portlist=57 speed=100g +port set unit=0 portlist=58 speed=100g +port set unit=0 portlist=59 speed=100g +port set unit=0 portlist=60 speed=100g +port set unit=0 portlist=61 speed=100g +port set unit=0 portlist=62 speed=100g +port set unit=0 portlist=63 speed=100g +port set unit=0 portlist=129 speed=10g +port set unit=0 portlist=130 speed=10g +port set unit=0 portlist=0 medium-type=sr4 +port set unit=0 portlist=1 medium-type=sr4 +port set unit=0 portlist=2 medium-type=sr4 +port set unit=0 portlist=3 medium-type=sr4 +port set unit=0 portlist=4 medium-type=sr4 +port set unit=0 portlist=5 medium-type=sr4 +port set unit=0 portlist=6 medium-type=sr4 +port set unit=0 portlist=7 medium-type=sr4 +port set unit=0 portlist=8 medium-type=sr4 +port set unit=0 portlist=9 medium-type=sr4 +port set unit=0 portlist=10 medium-type=sr4 +port set unit=0 portlist=11 medium-type=sr4 +port set unit=0 portlist=12 medium-type=sr4 +port set unit=0 portlist=13 medium-type=sr4 +port set unit=0 portlist=14 medium-type=sr4 +port set unit=0 portlist=15 medium-type=sr4 +port set unit=0 portlist=16 medium-type=sr4 +port set unit=0 portlist=17 medium-type=sr4 +port set unit=0 portlist=18 medium-type=sr4 +port set unit=0 portlist=19 medium-type=sr4 +port set unit=0 portlist=20 medium-type=sr4 +port set unit=0 portlist=21 medium-type=sr4 +port set unit=0 portlist=22 medium-type=sr4 +port set unit=0 portlist=23 medium-type=sr4 +port set unit=0 portlist=24 medium-type=sr4 +port set unit=0 portlist=25 medium-type=sr4 +port set unit=0 portlist=26 medium-type=sr4 +port set unit=0 portlist=27 medium-type=sr4 +port set unit=0 portlist=28 medium-type=sr4 +port set unit=0 portlist=29 medium-type=sr4 +port set unit=0 portlist=30 medium-type=sr4 +port set unit=0 portlist=31 medium-type=sr4 +port set unit=0 portlist=32 medium-type=sr4 +port set unit=0 portlist=33 medium-type=sr4 +port set unit=0 portlist=34 medium-type=sr4 +port set unit=0 portlist=35 medium-type=sr4 +port set unit=0 portlist=36 medium-type=sr4 +port set unit=0 portlist=37 medium-type=sr4 +port set unit=0 portlist=38 medium-type=sr4 +port set unit=0 portlist=39 medium-type=sr4 +port set unit=0 portlist=40 medium-type=sr4 +port set unit=0 portlist=41 medium-type=sr4 +port set unit=0 portlist=42 medium-type=sr4 +port set unit=0 portlist=43 medium-type=sr4 +port set unit=0 portlist=44 medium-type=sr4 +port set unit=0 portlist=45 medium-type=sr4 +port set unit=0 portlist=46 medium-type=sr4 +port set unit=0 portlist=47 medium-type=sr4 +port set unit=0 portlist=48 medium-type=sr4 +port set unit=0 portlist=49 medium-type=sr4 +port set unit=0 portlist=50 medium-type=sr4 +port set unit=0 portlist=51 medium-type=sr4 +port set unit=0 portlist=52 medium-type=sr4 +port set unit=0 portlist=53 medium-type=sr4 +port set unit=0 portlist=54 medium-type=sr4 +port set unit=0 portlist=55 medium-type=sr4 +port set unit=0 portlist=56 medium-type=sr4 +port set unit=0 portlist=57 medium-type=sr4 +port set unit=0 portlist=58 medium-type=sr4 +port set unit=0 portlist=59 medium-type=sr4 +port set unit=0 portlist=60 medium-type=sr4 +port set unit=0 portlist=61 medium-type=sr4 +port set unit=0 portlist=62 medium-type=sr4 +port set unit=0 portlist=63 medium-type=sr4 +port set unit=0 portlist=129 medium-type=kr +port set unit=0 portlist=130 medium-type=kr +port set unit=0 portlist=0 fec=rs +port set unit=0 portlist=1 fec=rs +port set unit=0 portlist=2 fec=rs +port set unit=0 portlist=3 fec=rs +port set unit=0 portlist=4 fec=rs +port set unit=0 portlist=5 fec=rs +port set unit=0 portlist=6 fec=rs +port set unit=0 portlist=7 fec=rs +port set unit=0 portlist=8 fec=rs +port set unit=0 portlist=9 fec=rs +port set unit=0 portlist=10 fec=rs +port set unit=0 portlist=11 fec=rs +port set unit=0 portlist=12 fec=rs +port set unit=0 portlist=13 fec=rs +port set unit=0 portlist=14 fec=rs +port set unit=0 portlist=15 fec=rs +port set unit=0 portlist=16 fec=rs +port set unit=0 portlist=17 fec=rs +port set unit=0 portlist=18 fec=rs +port set unit=0 portlist=19 fec=rs +port set unit=0 portlist=20 fec=rs +port set unit=0 portlist=21 fec=rs +port set unit=0 portlist=22 fec=rs +port set unit=0 portlist=23 fec=rs +port set unit=0 portlist=24 fec=rs +port set unit=0 portlist=25 fec=rs +port set unit=0 portlist=26 fec=rs +port set unit=0 portlist=27 fec=rs +port set unit=0 portlist=28 fec=rs +port set unit=0 portlist=29 fec=rs +port set unit=0 portlist=30 fec=rs +port set unit=0 portlist=31 fec=rs +port set unit=0 portlist=32 fec=rs +port set unit=0 portlist=33 fec=rs +port set unit=0 portlist=34 fec=rs +port set unit=0 portlist=35 fec=rs +port set unit=0 portlist=36 fec=rs +port set unit=0 portlist=37 fec=rs +port set unit=0 portlist=38 fec=rs +port set unit=0 portlist=39 fec=rs +port set unit=0 portlist=40 fec=rs +port set unit=0 portlist=41 fec=rs +port set unit=0 portlist=42 fec=rs +port set unit=0 portlist=43 fec=rs +port set unit=0 portlist=44 fec=rs +port set unit=0 portlist=45 fec=rs +port set unit=0 portlist=46 fec=rs +port set unit=0 portlist=47 fec=rs +port set unit=0 portlist=48 fec=rs +port set unit=0 portlist=49 fec=rs +port set unit=0 portlist=50 fec=rs +port set unit=0 portlist=51 fec=rs +port set unit=0 portlist=52 fec=rs +port set unit=0 portlist=53 fec=rs +port set unit=0 portlist=54 fec=rs +port set unit=0 portlist=55 fec=rs +port set unit=0 portlist=56 fec=rs +port set unit=0 portlist=57 fec=rs +port set unit=0 portlist=58 fec=rs +port set unit=0 portlist=59 fec=rs +port set unit=0 portlist=60 fec=rs +port set unit=0 portlist=61 fec=rs +port set unit=0 portlist=62 fec=rs +port set unit=0 portlist=63 fec=rs +port advertise unit=0 portlist=129 speed-10g-kr +port advertise unit=0 portlist=130 speed-10g-kr +port set unit=0 portlist=129 an=enable +port set unit=0 portlist=130 an=enable +port set unit=0 portlist=0 admin=enable +port set unit=0 portlist=1 admin=enable +port set unit=0 portlist=2 admin=enable +port set unit=0 portlist=3 admin=enable +port set unit=0 portlist=4 admin=enable +port set unit=0 portlist=5 admin=enable +port set unit=0 portlist=6 admin=enable +port set unit=0 portlist=7 admin=enable +port set unit=0 portlist=8 admin=enable +port set unit=0 portlist=9 admin=enable +port set unit=0 portlist=10 admin=enable +port set unit=0 portlist=11 admin=enable +port set unit=0 portlist=12 admin=enable +port set unit=0 portlist=13 admin=enable +port set unit=0 portlist=14 admin=enable +port set unit=0 portlist=15 admin=enable +port set unit=0 portlist=16 admin=enable +port set unit=0 portlist=17 admin=enable +port set unit=0 portlist=18 admin=enable +port set unit=0 portlist=19 admin=enable +port set unit=0 portlist=20 admin=enable +port set unit=0 portlist=21 admin=enable +port set unit=0 portlist=22 admin=enable +port set unit=0 portlist=23 admin=enable +port set unit=0 portlist=24 admin=enable +port set unit=0 portlist=25 admin=enable +port set unit=0 portlist=26 admin=enable +port set unit=0 portlist=27 admin=enable +port set unit=0 portlist=28 admin=enable +port set unit=0 portlist=29 admin=enable +port set unit=0 portlist=30 admin=enable +port set unit=0 portlist=31 admin=enable +port set unit=0 portlist=32 admin=enable +port set unit=0 portlist=33 admin=enable +port set unit=0 portlist=34 admin=enable +port set unit=0 portlist=35 admin=enable +port set unit=0 portlist=36 admin=enable +port set unit=0 portlist=37 admin=enable +port set unit=0 portlist=38 admin=enable +port set unit=0 portlist=39 admin=enable +port set unit=0 portlist=40 admin=enable +port set unit=0 portlist=41 admin=enable +port set unit=0 portlist=42 admin=enable +port set unit=0 portlist=43 admin=enable +port set unit=0 portlist=44 admin=enable +port set unit=0 portlist=45 admin=enable +port set unit=0 portlist=46 admin=enable +port set unit=0 portlist=47 admin=enable +port set unit=0 portlist=48 admin=enable +port set unit=0 portlist=49 admin=enable +port set unit=0 portlist=50 admin=enable +port set unit=0 portlist=51 admin=enable +port set unit=0 portlist=52 admin=enable +port set unit=0 portlist=53 admin=enable +port set unit=0 portlist=54 admin=enable +port set unit=0 portlist=55 admin=enable +port set unit=0 portlist=56 admin=enable +port set unit=0 portlist=57 admin=enable +port set unit=0 portlist=58 admin=enable +port set unit=0 portlist=59 admin=enable +port set unit=0 portlist=60 admin=enable +port set unit=0 portlist=61 admin=enable +port set unit=0 portlist=62 admin=enable +port set unit=0 portlist=63 admin=enable +port set unit=0 portlist=129 admin=enable +port set unit=0 portlist=130 admin=enable diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps index e6fe6721350e..fc640e0d78f8 100644 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/led_proc_init.nps @@ -1,20 +1,9 @@ -#This configuration file is for customer init value feature. Please refer to nps_cfg.h/nps_cfg.c for detail. -#1. The lines beginning with # are comment lines. The lines beginning with number are the setting lines. -#2. There are five parameters which can be set. -# 1) the first is unit. -# 2) the second is NPS_CFG_TYPE_XXX. Refer to NPS_CFG_TYPE_T. -# 3) the 3-5 are {param0, param1, value} pairs. Refer to NPS_CFG_VALUE_T. Support HEX format. -# 4) the (unit, NPS_CFG_TYPE_XXX, param0, param1) group is the key to get the correspingding value. -# There should be no same (unit, NPS_CFG_TYPE_XXX, param0, param1) group. -#3. User must follow correct format to apply the setting. Please refer to below commentted example(#0 NPS_CFG_TYPE_L2_ADDR_MODE 0 0 1); -#4. Usage under the linux shell: -# 1) ./image-path/image-name -c cfg-path/NPS_TAU_EVB_6T4_64.cfg : mamually specify directory path if they are not in current work dirctory. -# 2) ./image-name -c NPS_TAU_EVB_6T4_64.cfg : the image and the NPS_TAU_EVB_3T2_32.cfg are in the current work directory. - -#unit NPS_CFG_TYPE_XXX param0 param1 value -#---- ---------------- ------ ------ ----- -0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 -0 NPS_CFG_TYPE_LED_CFG 0 0 2 -0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 0 -0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 0 -0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +#unit NPS_CFG_TYPE_XXX param0 param1 value +#---- ---------------- ------ ------ ----- +0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 +0 NPS_CFG_TYPE_LED_CFG 0 0 2 +0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 1 +0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +0 NPS_CFG_TYPE_HASH_L2_FDB_REGION_ENTRY_NUM 0 0 49152 +0 NPS_CFG_TYPE_HASH_L3_WITH_IPV6_PREFIX_64_REGION_ENTRY_NUM 0 0 32768 diff --git a/platform/nephos/rules.mk b/platform/nephos/rules.mk index fc6200005db5..3ce0287470d7 100644 --- a/platform/nephos/rules.mk +++ b/platform/nephos/rules.mk @@ -10,7 +10,7 @@ include $(PLATFORM_PATH)/python-saithrift.mk #include $(PLATFORM_PATH)/docker-ptf-nephos.mk NPX_DIAG = npx_diag -$(NPX_DIAG)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/npx_diag_2.0.1-20171020" +$(NPX_DIAG)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/npx_diag" 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" diff --git a/platform/nephos/sai.mk b/platform/nephos/sai.mk index 90ee027518e8..2da9e1f2c4fa 100644 --- a/platform/nephos/sai.mk +++ b/platform/nephos/sai.mk @@ -1,9 +1,9 @@ -NEPHOS_SAI = libsainps_2.0.2-20171204_amd64.deb -$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.2-20171204_amd64.deb" +NEPHOS_SAI = libsainps_2.0.3a63-20180110_amd64.deb +$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.3a63-20180110_amd64.deb" -NEPHOS_SAI_DEV = libsainps-dev_2.0.2-20171124_amd64.deb +NEPHOS_SAI_DEV = libsainps-dev_2.0.3a63-20180110_amd64.deb $(eval $(call add_derived_package,$(NEPHOS_SAI),$(NEPHOS_SAI_DEV))) -$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.2-20171124_amd64.deb" +$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.3a63-20180110_amd64.deb" SONIC_ONLINE_DEBS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(NEPHOS_SAI_DEV)_DEPENDS += $(NEPHOS_SAI) diff --git a/platform/nephos/sdk.mk b/platform/nephos/sdk.mk index 392ae459cc57..1bc7fe35c0d1 100644 --- a/platform/nephos/sdk.mk +++ b/platform/nephos/sdk.mk @@ -1,4 +1,4 @@ -NEPHOS_NPS_KERNEL = nps-modules-3.16.0-4-amd64_2.0.2-20171204_amd64.deb -$(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-3.16.0-4-amd64_2.0.2-20171204_amd64.deb" +NEPHOS_NPS_KERNEL = nps-modules-3.16.0-4-amd64_2.0.3a63-20180110_amd64.deb +$(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-3.16.0-4-amd64_2.0.3a63-20180110_amd64.deb" SONIC_ONLINE_DEBS += $(NEPHOS_NPS_KERNEL) From 47aba6f76d364452517cedf2f1b3d2f66ccdf61b Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 11 Jan 2018 20:32:14 -0800 Subject: [PATCH 1032/1833] [libsaithrift-dev]: Enable building libsaithrift-dev and pythonthrift libraries (#1296) * Fix build of libsaithrift for broadcom * Restore libsaithrift-dev building * Comment out libsaithrift library on cavium and marvell. Both of them have old SAI drivers * Revert back unintentional acton changes * Don't run the package checks when building sairedis package --- platform/broadcom/libsaithrift-dev.mk | 6 +++--- platform/broadcom/python-saithrift.mk | 6 +++--- platform/broadcom/rules.mk | 2 +- platform/cavium/libsaithrift-dev.mk | 4 ++-- platform/cavium/python-saithrift.mk | 4 ++-- platform/cavium/rules.mk | 2 +- platform/centec/libsaithrift-dev.mk | 4 ++-- platform/centec/python-saithrift.mk | 4 ++-- platform/marvell/libsaithrift-dev.mk | 4 ++-- platform/marvell/python-saithrift.mk | 4 ++-- platform/marvell/rules.mk | 2 +- platform/mellanox/libsaithrift-dev.mk | 6 +++--- platform/mellanox/python-saithrift.mk | 6 +++--- platform/nephos/libsaithrift-dev.mk | 6 +++--- platform/nephos/python-saithrift.mk | 6 +++--- platform/nephos/rules.mk | 2 +- rules/sairedis.mk | 1 + slave.mk | 4 ++-- src/sonic-sairedis | 2 +- 19 files changed, 38 insertions(+), 37 deletions(-) diff --git a/platform/broadcom/libsaithrift-dev.mk b/platform/broadcom/libsaithrift-dev.mk index 6e422db6e799..772f98339cbf 100644 --- a/platform/broadcom/libsaithrift-dev.mk +++ b/platform/broadcom/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_BRCM = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_BRCM)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_BRCM = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_BRCM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_BRCM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(BRCM_SAI) $(BRCM_SAI_DEV) $(LIBSAITHRIFT_DEV_BRCM)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) -#SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_BRCM) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_BRCM) diff --git a/platform/broadcom/python-saithrift.mk b/platform/broadcom/python-saithrift.mk index 18bf77c3d009..11efddc36843 100644 --- a/platform/broadcom/python-saithrift.mk +++ b/platform/broadcom/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_BRCM = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_BRCM)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_BRCM = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_BRCM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_BRCM)_DEPENDS += $(BRCM_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -#SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_BRCM) +SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_BRCM) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index e94361987963..0437758917c3 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -16,7 +16,7 @@ include $(PLATFORM_PATH)/raw-image.mk include $(PLATFORM_PATH)/one-aboot.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk -#include $(PLATFORM_PATH)/docker-ptf-brcm.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" diff --git a/platform/cavium/libsaithrift-dev.mk b/platform/cavium/libsaithrift-dev.mk index 4a19fabffaf2..b7203d8d1077 100644 --- a/platform/cavium/libsaithrift-dev.mk +++ b/platform/cavium/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_CAVM = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_CAVM)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_CAVM = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_CAVM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_CAVM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(CAVM_LIBSAI) $(CAVM_SAI) $(LIBSAITHRIFT_DEV_CAVM)_RDEPENDS += $(LIBTHRIFT) $(CAVM_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_CAVM) diff --git a/platform/cavium/python-saithrift.mk b/platform/cavium/python-saithrift.mk index 91d00ebaebc0..22c38503a6b1 100644 --- a/platform/cavium/python-saithrift.mk +++ b/platform/cavium/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_CAVM = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_CAVM)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_CAVM = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_CAVM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_CAVM)_DEPENDS += $(CAVM_LIBSAI) $(CAVM_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_CAVM) diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 37a9bd7c994b..81053227e299 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -15,7 +15,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_SYNCD_CAVM_RPC) # Inject cavium sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) $(LIBSAITHRIFT_DEV_CAVM) +$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) #$(LIBSAITHRIFT_DEV_CAVM) # Runtime dependency on cavium sai is set only for syncd $(SYNCD)_RDEPENDS += $(CAVM_SAI) diff --git a/platform/centec/libsaithrift-dev.mk b/platform/centec/libsaithrift-dev.mk index b8fddbdf7731..7e148d9df00c 100644 --- a/platform/centec/libsaithrift-dev.mk +++ b/platform/centec/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_CENTEC = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_CENTEC)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_CENTEC = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_CENTEC)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_CENTEC)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(CENTEC_SAI) $(LIBSAITHRIFT_DEV_CENTEC)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_CENTEC) diff --git a/platform/centec/python-saithrift.mk b/platform/centec/python-saithrift.mk index 37d1e935c041..0d320cba5619 100644 --- a/platform/centec/python-saithrift.mk +++ b/platform/centec/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_CENTEC = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_CENTEC)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_CENTEC = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_CENTEC)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_CENTEC)_DEPENDS += $(CENTEC_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_CENTEC) diff --git a/platform/marvell/libsaithrift-dev.mk b/platform/marvell/libsaithrift-dev.mk index 443406e9c2fb..e5b30f412bfa 100644 --- a/platform/marvell/libsaithrift-dev.mk +++ b/platform/marvell/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_MRVL = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_MRVL)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_MRVL = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_MRVL)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_MRVL)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(MRVL_FPA) $(MRVL_SAI) $(LIBSAITHRIFT_DEV_MRVL)_RDEPENDS += $(LIBTHRIFT) $(MRVL_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MRVL) diff --git a/platform/marvell/python-saithrift.mk b/platform/marvell/python-saithrift.mk index f7a63b19edb8..5830c982da99 100644 --- a/platform/marvell/python-saithrift.mk +++ b/platform/marvell/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_MRVL = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_MRVL)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_MRVL = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_MRVL)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_MRVL)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MRVL) diff --git a/platform/marvell/rules.mk b/platform/marvell/rules.mk index c5df6bab194e..185b7b5fd7a9 100644 --- a/platform/marvell/rules.mk +++ b/platform/marvell/rules.mk @@ -12,7 +12,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_SYNCD_MRVL_RPC) # Inject mrvl sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) $(LIBSAITHRIFT_DEV_MRVL) +$(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) #$(LIBSAITHRIFT_DEV_MRVL) # Runtime dependency on mrvl sai is set only for syncd $(SYNCD)_RDEPENDS += $(MRVL_SAI) diff --git a/platform/mellanox/libsaithrift-dev.mk b/platform/mellanox/libsaithrift-dev.mk index 39222be39cab..77c27aa7ab09 100644 --- a/platform/mellanox/libsaithrift-dev.mk +++ b/platform/mellanox/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_MLNX = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_MLNX)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_MLNX = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_MLNX)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_MLNX)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(MLNX_SAI) $(MLNX_SAI_DEV) $(LIBSAITHRIFT_DEV_MLNX)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI) -#SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MLNX) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MLNX) diff --git a/platform/mellanox/python-saithrift.mk b/platform/mellanox/python-saithrift.mk index 59685121e02c..a4485da0ca90 100644 --- a/platform/mellanox/python-saithrift.mk +++ b/platform/mellanox/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_MLNX = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_MLNX)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_MLNX = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_MLNX)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_MLNX)_DEPENDS += $(MLNX_SAI_DEV) $(MLNX_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -#SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MLNX) +SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MLNX) diff --git a/platform/nephos/libsaithrift-dev.mk b/platform/nephos/libsaithrift-dev.mk index 4103d5c0c7b0..44d92ef6db7b 100644 --- a/platform/nephos/libsaithrift-dev.mk +++ b/platform/nephos/libsaithrift-dev.mk @@ -1,7 +1,7 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_NEPHOS = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_NEPHOS)_SRC_PATH = $(SRC_PATH)/SAI +LIBSAITHRIFT_DEV_NEPHOS = libsaithrift-dev_1.0.4_amd64.deb +$(LIBSAITHRIFT_DEV_NEPHOS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_NEPHOS)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(LIBSAITHRIFT_DEV_NEPHOS)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI) -#SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_NEPHOS) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_NEPHOS) diff --git a/platform/nephos/python-saithrift.mk b/platform/nephos/python-saithrift.mk index bc4a57b64cd3..e0c56f4053ec 100644 --- a/platform/nephos/python-saithrift.mk +++ b/platform/nephos/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_NEPHOS = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_NEPHOS)_SRC_PATH = $(SRC_PATH)/SAI +PYTHON_SAITHRIFT_NEPHOS = python-saithrift_1.0.4_amd64.deb +$(PYTHON_SAITHRIFT_NEPHOS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_NEPHOS)_DEPENDS += $(NEPHOS_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -#SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_NEPHOS) +SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_NEPHOS) diff --git a/platform/nephos/rules.mk b/platform/nephos/rules.mk index 3ce0287470d7..a7fe1d1d118f 100644 --- a/platform/nephos/rules.mk +++ b/platform/nephos/rules.mk @@ -7,7 +7,7 @@ include $(PLATFORM_PATH)/docker-syncd-nephos-rpc.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk -#include $(PLATFORM_PATH)/docker-ptf-nephos.mk +include $(PLATFORM_PATH)/docker-ptf-nephos.mk NPX_DIAG = npx_diag $(NPX_DIAG)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/npx_diag" diff --git a/rules/sairedis.mk b/rules/sairedis.mk index 760d75c5a611..fc481e620cd7 100644 --- a/rules/sairedis.mk +++ b/rules/sairedis.mk @@ -4,6 +4,7 @@ LIBSAIREDIS = libsairedis_1.0.0_amd64.deb $(LIBSAIREDIS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis $(LIBSAIREDIS)_DEPENDS += $(LIBSWSSCOMMON_DEV) $(LIBTHRIFT_DEV) $(LIBSAIREDIS)_RDEPENDS += $(LIBSWSSCOMMON) +$(LIBSAIREDIS)_DEB_BUILD_OPTIONS = nocheck SONIC_DPKG_DEBS += $(LIBSAIREDIS) LIBSAIREDIS_DEV = libsairedis-dev_1.0.0_amd64.deb diff --git a/slave.mk b/slave.mk index 425ba4c41d82..2103c79046a7 100644 --- a/slave.mk +++ b/slave.mk @@ -210,8 +210,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a pushd $($*_SRC_PATH) $(LOG) [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) $(if $($*_DPKG_TARGET), - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG), - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) + DEB_BUILD_OPTIONS=$($*_DEB_BUILD_OPTIONS) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG), + DEB_BUILD_OPTIONS=$($*_DEB_BUILD_OPTIONS) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) ) popd $(LOG) # Clean up diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 3b817bbe14f1..f04e13e9d5ea 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 3b817bbe14f1e5177e6200c7a80ab74db4768eaa +Subproject commit f04e13e9d5ea49c6fbcf884734043ebfdd8b998e From fac28cf63f0fa79fc87799fd80158281960f18b6 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 12 Jan 2018 09:34:51 -0800 Subject: [PATCH 1033/1833] [build]: build libsaithrift-dev and docker-ptf-[platform] (#1300) --- platform/broadcom/docker-ptf-brcm.mk | 2 +- platform/broadcom/rules.mk | 2 +- platform/cavium/rules.mk | 2 +- platform/marvell/rules.mk | 2 +- platform/mellanox/docker-ptf-mlnx.mk | 2 +- platform/mellanox/rules.mk | 2 +- platform/nephos/docker-ptf-nephos.mk | 2 +- platform/nephos/rules.mk | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/docker-ptf-brcm.mk b/platform/broadcom/docker-ptf-brcm.mk index c57ce43dc905..7b78aa9ec316 100644 --- a/platform/broadcom/docker-ptf-brcm.mk +++ b/platform/broadcom/docker-ptf-brcm.mk @@ -4,4 +4,4 @@ DOCKER_PTF_BRCM = docker-ptf-brcm.gz $(DOCKER_PTF_BRCM)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift $(DOCKER_PTF_BRCM)_DEPENDS += $(PYTHON_SAITHRIFT_BRCM) $(DOCKER_PTF_BRCM)_LOAD_DOCKERS += $(DOCKER_PTF) -#SONIC_DOCKER_IMAGES += $(DOCKER_PTF_BRCM) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF_BRCM) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 0437758917c3..8147aa31c20a 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -30,7 +30,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE) \ $(DOCKER_FPM) # Inject brcm sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(BRCM_SAI) $(BRCM_SAI_DEV) #$(LIBSAITHRIFT_DEV_BRCM) +$(LIBSAIREDIS)_DEPENDS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(LIBSAITHRIFT_DEV_BRCM) # Runtime dependency on brcm sai is set only for syncd $(SYNCD)_RDEPENDS += $(BRCM_SAI) diff --git a/platform/cavium/rules.mk b/platform/cavium/rules.mk index 81053227e299..37a9bd7c994b 100644 --- a/platform/cavium/rules.mk +++ b/platform/cavium/rules.mk @@ -15,7 +15,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_SYNCD_CAVM_RPC) # Inject cavium sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) #$(LIBSAITHRIFT_DEV_CAVM) +$(LIBSAIREDIS)_DEPENDS += $(CAVM_SAI) $(CAVM_LIBSAI) $(LIBSAITHRIFT_DEV_CAVM) # Runtime dependency on cavium sai is set only for syncd $(SYNCD)_RDEPENDS += $(CAVM_SAI) diff --git a/platform/marvell/rules.mk b/platform/marvell/rules.mk index 185b7b5fd7a9..c5df6bab194e 100644 --- a/platform/marvell/rules.mk +++ b/platform/marvell/rules.mk @@ -12,7 +12,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_SYNCD_MRVL_RPC) # Inject mrvl sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) #$(LIBSAITHRIFT_DEV_MRVL) +$(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) $(LIBSAITHRIFT_DEV_MRVL) # Runtime dependency on mrvl sai is set only for syncd $(SYNCD)_RDEPENDS += $(MRVL_SAI) diff --git a/platform/mellanox/docker-ptf-mlnx.mk b/platform/mellanox/docker-ptf-mlnx.mk index 9f994f62de64..7f23dc715e32 100644 --- a/platform/mellanox/docker-ptf-mlnx.mk +++ b/platform/mellanox/docker-ptf-mlnx.mk @@ -4,4 +4,4 @@ DOCKER_PTF_MLNX = docker-ptf-mlnx.gz $(DOCKER_PTF_MLNX)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift $(DOCKER_PTF_MLNX)_DEPENDS += $(PYTHON_SAITHRIFT_MLNX) $(DOCKER_PTF_MLNX)_LOAD_DOCKERS += $(DOCKER_PTF) -#SONIC_DOCKER_IMAGES += $(DOCKER_PTF_MLNX) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF_MLNX) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index d67401df245d..1651f4a66806 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -15,7 +15,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM) # Inject mlnx sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) #$(LIBSAITHRIFT_DEV_MLNX) +$(LIBSAIREDIS)_DEPENDS += $(MLNX_SAI) $(LIBSAITHRIFT_DEV_MLNX) # Runtime dependency on mlnx sai is set only for syncd $(SYNCD)_RDEPENDS += $(MLNX_SAI) diff --git a/platform/nephos/docker-ptf-nephos.mk b/platform/nephos/docker-ptf-nephos.mk index 6d7950f7516d..7fbbd271cf65 100644 --- a/platform/nephos/docker-ptf-nephos.mk +++ b/platform/nephos/docker-ptf-nephos.mk @@ -4,4 +4,4 @@ DOCKER_PTF_NEPHOS = docker-ptf-nephos.gz $(DOCKER_PTF_NEPHOS)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift $(DOCKER_PTF_NEPHOS)_DEPENDS += $(PYTHON_SAITHRIFT_NEPHOS) $(DOCKER_PTF_NEPHOS)_LOAD_DOCKERS += $(DOCKER_PTF) -#SONIC_DOCKER_IMAGES += $(DOCKER_PTF_NEPHOS) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF_NEPHOS) diff --git a/platform/nephos/rules.mk b/platform/nephos/rules.mk index a7fe1d1d118f..96f39ef8aad1 100644 --- a/platform/nephos/rules.mk +++ b/platform/nephos/rules.mk @@ -20,7 +20,7 @@ SONIC_ONLINE_FILES += $(NPX_DIAG) $(DSSERVE) SONIC_ALL += $(SONIC_ONE_IMAGE) $(DOCKER_FPM) # Inject nephos sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) #$(LIBSAITHRIFT_DEV_NEPHOS) +$(LIBSAIREDIS)_DEPENDS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(LIBSAITHRIFT_DEV_NEPHOS) # Runtime dependency on nephos sai is set only for syncd $(SYNCD)_RDEPENDS += $(NEPHOS_SAI) From 5c83be5d2867f497569745203eecb4fc7fcae4fc Mon Sep 17 00:00:00 2001 From: jostar-yang Date: Sat, 13 Jan 2018 11:34:51 +0800 Subject: [PATCH 1034/1833] Add support for Accton AS7712-32X platform (#1299) * Add support as7716_32x sfp/psu/portled/eeprom * Add as7716_32x drv code(not inlcude .*.o) * Update platform-modules-accton.mk * Update platform-modules-accton.mk 1.Modify platform-modules-accton.mk to use new style code add_extra_package 2. fix error code * Add as7716_32x build to debian control,rule * Add as7716_32x export --- .../led_proc_init.soc | 41 ++++++ .../plugins/eeprom.py | 24 ++++ .../plugins/psuutil.py | 61 ++++++++ .../plugins/sfputil.py | 134 ++++++++++++++++++ platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-accton.mk | 6 + .../broadcom/sonic-platform-modules-accton | 2 +- 7 files changed, 268 insertions(+), 1 deletion(-) create mode 100755 device/accton/x86_64-accton_as7716_32x-r0/led_proc_init.soc create mode 100755 device/accton/x86_64-accton_as7716_32x-r0/plugins/eeprom.py create mode 100755 device/accton/x86_64-accton_as7716_32x-r0/plugins/psuutil.py create mode 100755 device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py mode change 100644 => 100755 platform/broadcom/one-image.mk mode change 100644 => 100755 platform/broadcom/platform-modules-accton.mk diff --git a/device/accton/x86_64-accton_as7716_32x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7716_32x-r0/led_proc_init.soc new file mode 100755 index 000000000000..719cb777719f --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/led_proc_init.soc @@ -0,0 +1,41 @@ +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=31 REMAP_PORT_1=30 REMAP_PORT_2=29 REMAP_PORT_3=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=27 REMAP_PORT_5=26 REMAP_PORT_6=25 REMAP_PORT_7=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=23 REMAP_PORT_9=22 REMAP_PORT_10=21 REMAP_PORT_11=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=19 REMAP_PORT_13=18 REMAP_PORT_14=17 REMAP_PORT_15=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=63 REMAP_PORT_17=62 REMAP_PORT_18=61 REMAP_PORT_19=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=59 REMAP_PORT_21=58 REMAP_PORT_22=57 REMAP_PORT_23=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=55 REMAP_PORT_25=54 REMAP_PORT_26=53 REMAP_PORT_27=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=51 REMAP_PORT_29=50 REMAP_PORT_30=49 REMAP_PORT_31=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=47 REMAP_PORT_33=46 REMAP_PORT_34=45 REMAP_PORT_35=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=43 REMAP_PORT_37=42 REMAP_PORT_38=41 REMAP_PORT_39=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=39 REMAP_PORT_41=38 REMAP_PORT_42=37 REMAP_PORT_43=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=35 REMAP_PORT_45=34 REMAP_PORT_46=33 REMAP_PORT_47=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 REMAP_PORT_49=14 REMAP_PORT_50=13 REMAP_PORT_51=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=35 REMAP_PORT_1=34 REMAP_PORT_2=33 REMAP_PORT_3=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=39 REMAP_PORT_5=38 REMAP_PORT_6=37 REMAP_PORT_7=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=43 REMAP_PORT_9=42 REMAP_PORT_10=41 REMAP_PORT_11=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=47 REMAP_PORT_13=46 REMAP_PORT_14=45 REMAP_PORT_15=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=3 REMAP_PORT_17=2 REMAP_PORT_18=1 REMAP_PORT_19=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=7 REMAP_PORT_21=6 REMAP_PORT_22=5 REMAP_PORT_23=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=11 REMAP_PORT_25=10 REMAP_PORT_26=9 REMAP_PORT_27=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=15 REMAP_PORT_29=14 REMAP_PORT_30=13 REMAP_PORT_31=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 REMAP_PORT_33=18 REMAP_PORT_34=17 REMAP_PORT_35=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 REMAP_PORT_37=22 REMAP_PORT_38=21 REMAP_PORT_39=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 REMAP_PORT_41=26 REMAP_PORT_42=25 REMAP_PORT_43=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 REMAP_PORT_45=30 REMAP_PORT_46=29 REMAP_PORT_47=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 REMAP_PORT_49=50 REMAP_PORT_50=49 REMAP_PORT_51=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 REMAP_PORT_53=54 REMAP_PORT_54=53 REMAP_PORT_55=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 REMAP_PORT_57=58 REMAP_PORT_58=57 REMAP_PORT_59=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=62 REMAP_PORT_62=61 REMAP_PORT_63=60 + +led 0 prog 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 E0 02 FB 42 40 06 F9 D2 00 74 1E 02 F9 42 03 67 AC 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 84 67 98 57 80 18 71 EB 67 98 67 84 57 67 84 67 84 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 start + +led 1 prog 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 E0 02 FB 42 40 06 F9 D2 00 74 1E 02 F9 42 03 67 AC 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 84 67 98 57 80 18 71 EB 67 98 67 84 57 67 84 67 84 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 1 start + +led auto on \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7716_32x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7716_32x-r0/plugins/eeprom.py new file mode 100755 index 000000000000..c0122e65844a --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom" + #Two i2c buses might get flipped order, check them both. + if not os.path.exists(self.eeprom_path): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7716_32x-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7716_32x-r0/plugins/psuutil.py new file mode 100755 index 000000000000..d8fddc23550b --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "18-0053", + 2: "17-0050", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py new file mode 100755 index 000000000000..7a36db7cf458 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py @@ -0,0 +1,134 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + + BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" + BASE_CPLD_PATH = "/sys/bus/i2c/devices/11-0060/" + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0: [1, 29], + 1: [2, 30], + 2: [3, 31], + 3: [4, 32], + 4: [5, 34], + 5: [6, 33], + 6: [7, 36], + 7: [8, 35], + 8: [9, 25], + 9: [10, 26], + 10: [11, 27], + 11: [12, 28], + 12: [14, 37], + 13: [15, 38], + 14: [16, 39], + 15: [17, 40], + 16: [18, 41], + 17: [19, 42], + 18: [20, 43], + 19: [21, 44], + 20: [22, 53], + 21: [23, 54], + 22: [24, 55], + 23: [25, 56], + 24: [26, 45], + 25: [27, 46], + 26: [28, 47], + 27: [29, 48], + 28: [30, 49], + 29: [31, 50], + 30: [32, 51], + 31: [33, 52], + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = self.BASE_OOM_PATH + "eeprom" + + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x][1] + ) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + present_path = self.BASE_CPLD_PATH + "module_present_" + str(port_num+1) + self.__port_to_is_present = present_path + + try: + val_file = open(self.__port_to_is_present) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + raise NotImplementedError + + def reset(self, port_num): + if port_num < self.port_start or port_num > self.port_end: + return False + + mod_rst_path = self.BASE_CPLD_PATH + "module_reset_" + str(port_num+1) + self.__port_to_mod_rst = mod_rst_path + try: + reg_file = open(self.__port_to_mod_rst, 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = '1' + + reg_file.write(reg_value) + reg_file.close() + + return True \ No newline at end of file diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk old mode 100644 new mode 100755 index a29d32abd1c2..2e54972dce3a --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -15,6 +15,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(ACCTON_AS7712_32X_PLATFORM_MODULE) \ $(ACCTON_AS5712_54X_PLATFORM_MODULE) \ $(ACCTON_AS7816_64X_PLATFORM_MODULE) \ + $(ACCTON_AS7716_32X_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk old mode 100644 new mode 100755 index 7dcfb937de63..08820e9a270a --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -3,10 +3,12 @@ ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION = 1.1 export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION export ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION export ACCTON_AS7816_64X_PLATFORM_MODULE_VERSION +export ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION ACCTON_AS7712_32X_PLATFORM_MODULE = sonic-platform-accton-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7712_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton @@ -22,3 +24,7 @@ ACCTON_AS7816_64X_PLATFORM_MODULE = sonic-platform-accton-as7816-64x_$(ACCTON_AS $(ACCTON_AS7816_64X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7816_64x-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7816_64X_PLATFORM_MODULE))) +ACCTON_AS7716_32X_PLATFORM_MODULE = sonic-platform-accton-as7716-32x_$(ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS7716_32X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7716_32x-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7716_32X_PLATFORM_MODULE))) + diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton index a7149adb425b..3f06d9f5864c 160000 --- a/platform/broadcom/sonic-platform-modules-accton +++ b/platform/broadcom/sonic-platform-modules-accton @@ -1 +1 @@ -Subproject commit a7149adb425bdd42520780f009f764b985ee0ebc +Subproject commit 3f06d9f5864c9daae4b582d60307ccb6d21c6ceb From a836fc42ac0ebc17c641d46305869be5d937d264 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Sat, 13 Jan 2018 03:43:14 -0800 Subject: [PATCH 1035/1833] [device]: Fix Mellanox sku check (#1303) Signed-off-by: Qi Luo --- dockers/docker-orchagent/swssconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index c8ee8759333c..959b6714d274 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -37,7 +37,7 @@ elif [ "$HWSKU" == "Force10-S6100" ]; then SWSSCONFIG_ARGS+="th.64ports.buffers.json th.64ports.qos.json " elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [[ "$HWSKU" == "ACS-MSN27"* ]]; then +elif [[ "$HWSKU" == "ACS-MSN27"* ]] || [[ "$HWSKU" == "Mellanox-SN2700" ]]; then sonic-cfggen -d -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json " fi From 292de7dcdacce55a140d0f3a3ad8b8b41d341d20 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 13 Jan 2018 09:33:56 -0800 Subject: [PATCH 1036/1833] [submodule]: update sonic-sairedis to enable syncd-rpc (#1304) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index f04e13e9d5ea..9364b7e95a9d 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit f04e13e9d5ea49c6fbcf884734043ebfdd8b998e +Subproject commit 9364b7e95a9d581ea91833aac39c8d44c65235bf From b8a0a10e8d9c66d7f9adc1aa4aadd10675205c0c Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 16 Jan 2018 10:50:43 -0800 Subject: [PATCH 1037/1833] [baseimage]: add mkfs.ext3 and fsck.ext3 in initrd to support ext3 partition (#1306) --- files/initramfs-tools/mke2fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/initramfs-tools/mke2fs b/files/initramfs-tools/mke2fs index de529eb57059..a67162199cf1 100644 --- a/files/initramfs-tools/mke2fs +++ b/files/initramfs-tools/mke2fs @@ -21,7 +21,7 @@ copy_exec /sbin/mke2fs copy_exec /sbin/sfdisk copy_exec /sbin/fdisk -fstypes="ext4" +fstypes="ext4 ext3" for type in $fstypes; do prog="/sbin/mkfs.${type}" From 8eb4241f0e3aabcdb91de7e94a490e4df3555103 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 16 Jan 2018 14:24:27 -0800 Subject: [PATCH 1038/1833] [snmpagent]: Update sonic-snmpagent submodule (#1308) Signed-off-by: Qi Luo --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index bedc2ec1d018..375363c13989 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit bedc2ec1d018333fefe67390fba5b5f65c62ba6f +Subproject commit 375363c13989ca3339689da106b66cfb38ef5eee From 6a8062da2c6f095b5780a36b6b063986b6376181 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 16 Jan 2018 16:37:38 -0800 Subject: [PATCH 1039/1833] [submodule]: Update sairedis (#1310) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 9364b7e95a9d..36752e19ae8f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 9364b7e95a9d581ea91833aac39c8d44c65235bf +Subproject commit 36752e19ae8f2709bd5d510d6e66ece73c16b71b From c568e8fd274c7fb892c33a8ac9358d5e7f90f224 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 16 Jan 2018 19:16:34 -0800 Subject: [PATCH 1040/1833] [Broadcom]: Update Boradcom SAI package to 3.0.3.3-3 (#1312) - update Arista 7050-QX32S config.bcm file - update Accton th-as771*-32x100G.config.bcm files --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 4f806ebd97f1..46bde157cf11 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.0.3.3-1_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.3-1_amd64.deb?sv=2015-04-05&sr=b&sig=hoUotiQsgVMo6%2BzH87aaIeTsqPsRYWQT5oRdSc1uEm8%3D&se=2154-11-09T08%3A09%3A33Z&sp=r" +BRCM_SAI = libsaibcm_3.0.3.3-3_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.0.3.3-3_amd64.deb?sv=2015-04-05&sr=b&sig=A%2Bcq%2B8XL%2BZfhOV6zqwRWm1jQ31PN0t54H9abZSRwTVw%3D&se=2031-09-25T22%3A41%3A43Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.0.3.3-1_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.0.3.3-3_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.3-1_amd64.deb?sv=2015-04-05&sr=b&sig=LfvM2LkGj3dPnSCyVEgPA35jvjKOgq%2FNSvj2UiPeGm4%3D&se=2154-11-09T08%3A11%3A03Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.0.3.3-3_amd64.deb?sv=2015-04-05&sr=b&sig=XT0v%2B25LZ5whTwH%2FE%2FykQLV8Kzn%2FoDyLNXjmqNuiFPo%3D&se=2031-09-25T22%3A41%3A21Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 22a3e4817a88051515e4bf005e811edd782e7a7e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 16 Jan 2018 23:20:13 -0800 Subject: [PATCH 1041/1833] Run docker containers with /tmp and /var/tmp mounted to tmpfs (#1313) --- files/build_templates/docker_image_ctl.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 628964ec7b61..a2bfb7d12503 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -63,6 +63,8 @@ start() { {%- if docker_container_name != "database" %} -v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \ {%- endif %} + --tmpfs /tmp \ + --tmpfs /var/tmp \ --name={{docker_container_name}} {{docker_image_name}}:latest postStartAction From 9d62fbfb66cde80a92504a1b84e18da85156929a Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 17 Jan 2018 17:03:44 -0800 Subject: [PATCH 1042/1833] [snmpagent]: Update sonic-snmpagent submodule (#1314) Signed-off-by: Qi Luo --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 375363c13989..d60afe1810e1 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 375363c13989ca3339689da106b66cfb38ef5eee +Subproject commit d60afe1810e1bd6ed7b68718b905f8bfe4ac39c4 From 6cd307920f8bfe5a364b734a7f6c80588bdde799 Mon Sep 17 00:00:00 2001 From: "Wenda Ni, Ph.D" Date: Wed, 17 Jan 2018 17:08:49 -0800 Subject: [PATCH 1043/1833] [baseimage]: Add missing dependency of igb & ixgbe (#1316) --- rules/igb.mk | 1 + rules/ixgbe.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/rules/igb.mk b/rules/igb.mk index 654c4bd77037..9857c0517a0a 100644 --- a/rules/igb.mk +++ b/rules/igb.mk @@ -4,5 +4,6 @@ IGB_DRIVER_VERSION = 5.3.5.4 export IGB_DRIVER_VERSION IGB_DRIVER = igb.ko +$(IGB_DRIVER)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(IGB_DRIVER)_SRC_PATH = $(SRC_PATH)/igb SONIC_MAKE_DEBS += $(IGB_DRIVER) diff --git a/rules/ixgbe.mk b/rules/ixgbe.mk index bdd175eac869..8819cd0018a3 100644 --- a/rules/ixgbe.mk +++ b/rules/ixgbe.mk @@ -5,4 +5,5 @@ export IXGBE_DRIVER_VERSION IXGBE_DRIVER = ixgbe.ko $(IXGBE_DRIVER)_SRC_PATH = $(SRC_PATH)/ixgbe +$(IXGBE_DRIVER)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_MAKE_DEBS += $(IXGBE_DRIVER) From 134707f8221c82bb9bfb2c124e5db819badcfd5b Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 17 Jan 2018 17:11:31 -0800 Subject: [PATCH 1044/1833] Move platform-specific hardware plugin base packages to sonic-platform-common submodule (#1301) --- .gitmodules | 3 +++ dockers/docker-snmp-sv2/Dockerfile.j2 | 2 +- .../build_templates/sonic_debian_extension.j2 | 6 ++++++ platform/p4/docker-sonic-p4.mk | 10 +++++----- rules/asyncsnmp-py3.mk | 4 ++-- rules/sonic-ledd.mk | 2 +- rules/sonic-platform-common.mk | 13 ++++++++++++ rules/sonic-utilities.mk | 20 ++++++++++--------- slave.mk | 4 +++- src/sonic-platform-common | 1 + src/sonic-platform-daemons | 2 +- src/sonic-utilities | 2 +- 12 files changed, 48 insertions(+), 21 deletions(-) create mode 100644 rules/sonic-platform-common.mk create mode 160000 src/sonic-platform-common diff --git a/.gitmodules b/.gitmodules index 1c7a6da0281d..bcc9a8f3038a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -50,6 +50,9 @@ [submodule "platform/broadcom/sonic-platform-modules-ingrasys"] path = platform/broadcom/sonic-platform-modules-ingrasys url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys +[submodule "src/sonic-platform-common"] + path = src/sonic-platform-common + url = https://github.com/Azure/sonic-platform-common [submodule "src/sonic-platform-daemons"] path = src/sonic-platform-daemons url = https://github.com/Azure/sonic-platform-daemons diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 3c5473951116..0e83b230746a 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -7,7 +7,7 @@ COPY [ \ "/debs/"] # Install Python SwSSSDK (SNMP subagent dependency) -COPY python-wheels/sonic_utilities-*-py3-*.whl /python-wheels/ +COPY python-wheels/sonic_platform_common-*-py3-*.whl /python-wheels/ COPY python-wheels/swsssdk-*-py3-*.whl /python-wheels/ COPY python-wheels/asyncsnmp-*-py3-*.whl /python-wheels/ diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index f861543e98c8..a2bea7a6baa6 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -77,6 +77,12 @@ sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME +# Install sonic-platform-common Python 2 package +PLATFORM_COMMON_PY2_WHEEL_NAME=$(basename {{platform_common_py2_wheel_path}}) +sudo cp {{platform_common_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $PLATFORM_COMMON_PY2_WHEEL_NAME +sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME + # Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f diff --git a/platform/p4/docker-sonic-p4.mk b/platform/p4/docker-sonic-p4.mk index ebe7ceb080a2..1cd15439fb77 100644 --- a/platform/p4/docker-sonic-p4.mk +++ b/platform/p4/docker-sonic-p4.mk @@ -3,11 +3,11 @@ DOCKER_SONIC_P4 = docker-sonic-p4.gz $(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4 $(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) \ - $(SYNCD) \ - $(P4_SWITCH) \ - $(REDIS_SERVER) \ - $(REDIS_TOOLS) \ - $(PYTHON_SWSSCOMMON) \ + $(SYNCD) \ + $(P4_SWITCH) \ + $(REDIS_SERVER) \ + $(REDIS_TOOLS) \ + $(PYTHON_SWSSCOMMON) \ $(LIBTEAMDCT) \ $(LIBTEAM_UTILS) \ $(SONIC_DEVICE_DATA) \ diff --git a/rules/asyncsnmp-py3.mk b/rules/asyncsnmp-py3.mk index f44d7f336534..cc0af244d856 100644 --- a/rules/asyncsnmp-py3.mk +++ b/rules/asyncsnmp-py3.mk @@ -3,6 +3,6 @@ ASYNCSNMP_PY3 = asyncsnmp-2.1.0-py3-none-any.whl $(ASYNCSNMP_PY3)_SRC_PATH = $(SRC_PATH)/sonic-snmpagent $(ASYNCSNMP_PY3)_PYTHON_VERSION = 3 -# Depends on sonic-utilities so it is possible to import sonic_psu -$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_UTILS_PY3) +# Depends on sonic-platform-common so it is possible to import sonic_psu +$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_PLATFORM_COMMON_PY3) SONIC_PYTHON_WHEELS += $(ASYNCSNMP_PY3) diff --git a/rules/sonic-ledd.mk b/rules/sonic-ledd.mk index aa95b46cf478..056f0f6c9bd8 100644 --- a/rules/sonic-ledd.mk +++ b/rules/sonic-ledd.mk @@ -1,5 +1,5 @@ # sonic-ledd (SONiC Front-panel LED control daemon) Debian package -SONIC_LEDD = python-sonic-ledd_1.0-1_all.deb +SONIC_LEDD = python-sonic-ledd_1.1-1_all.deb $(SONIC_LEDD)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-ledd SONIC_PYTHON_STDEB_DEBS += $(SONIC_LEDD) diff --git a/rules/sonic-platform-common.mk b/rules/sonic-platform-common.mk new file mode 100644 index 000000000000..95789354a4da --- /dev/null +++ b/rules/sonic-platform-common.mk @@ -0,0 +1,13 @@ +# sonic-platform-common package + +SONIC_PLATFORM_COMMON_PY2 = sonic_platform_common-1.0-py2-none-any.whl +$(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-platform-common +$(SONIC_PLATFORM_COMMON_PY2)_PYTHON_VERSION = 2 +SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) + +# Als build sonic-platform-common into python3 wheel, so we can use PSU code in SNMP docker +# Note: _DEPENDS macro is not defined +SONIC_PLATFORM_COMMON_PY3 = sonic_platform_common-1.0-py3-none-any.whl +$(SONIC_PLATFORM_COMMON_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-common +$(SONIC_PLATFORM_COMMON_PY3)_PYTHON_VERSION = 3 +SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) diff --git a/rules/sonic-utilities.mk b/rules/sonic-utilities.mk index 0dae94d8aa70..eba618d051dc 100644 --- a/rules/sonic-utilities.mk +++ b/rules/sonic-utilities.mk @@ -1,14 +1,16 @@ # sonic utilities package +# +# NOTE: sonic-config-engine is a build-time dependency of sonic-utilities +# due to unit tests which are run during the build. However, +# sonic-platform-common and swsssdk are runtime dependencies, and should be +# added here also. However, the current build system assumes all runtime +# dependencies are .deb packages. +# +# TODO: Create a way to specify both .deb and .whl runtime dependencies +# then add the aforementioned runtime dependencies here. +# -SONIC_UTILS = python-sonic-utilities_1.1-1_all.deb +SONIC_UTILS = python-sonic-utilities_1.2-1_all.deb $(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities $(SONIC_UTILS)_WHEEL_DEPENDS = $(SONIC_CONFIG_ENGINE) SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS) - -# Build sonic-utilities into python3 wheel, so we can use PSU code -# Note: _DEPENDS macro is not defined -SONIC_UTILS_PY3 = sonic_utilities-1.1-py3-none-any.whl -$(SONIC_UTILS_PY3)_SRC_PATH = $(SRC_PATH)/sonic-utilities -$(SONIC_UTILS_PY3)_PYTHON_VERSION = 3 -$(SONIC_UTILS_PY3)_TEST = n -SONIC_PYTHON_WHEELS += $(SONIC_UTILS_PY3) diff --git a/slave.mk b/slave.mk index 2103c79046a7..4309d882a5d1 100644 --- a/slave.mk +++ b/slave.mk @@ -416,7 +416,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(LIBPAM_TACPLUS) \ $(LIBNSS_TACPLUS)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ - $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) + $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) \ + $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2)) $(HEADER) # Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" @@ -433,6 +434,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" export config_engine_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))" export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))" + export platform_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2))" $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" diff --git a/src/sonic-platform-common b/src/sonic-platform-common new file mode 160000 index 000000000000..0581611b7be5 --- /dev/null +++ b/src/sonic-platform-common @@ -0,0 +1 @@ +Subproject commit 0581611b7be5cc52aea2877199785fe72f759a58 diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index d1df4717627a..920f29b39186 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit d1df4717627acf9421861545b71e411acf3c5f32 +Subproject commit 920f29b3918635cce14a1e03749ffb1e76bf9abd diff --git a/src/sonic-utilities b/src/sonic-utilities index 6823ce2f3e46..495584bd2f22 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 6823ce2f3e46d9bbf5fcfa6b371705a7368929cb +Subproject commit 495584bd2f228af81934b23e4cf19648ab387fab From 0fa64cc618e50bff92dea20204a5923ea7b1b923 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 18 Jan 2018 11:43:57 -0800 Subject: [PATCH 1045/1833] [supervisor] Add patch to prevent 'supervisorctl start' command from hanging if system time has rolled backward (#1311) * Add patch to prevent 'supervisorctl start' command from hanging if system time has rolled backward * Also add unit tests for clock rollback scenarios --- .gitignore | 1 + rules/supervisor.mk | 6 +- src/supervisor/Makefile | 12 +- ...e-hanging-delays-in-process-state-tr.patch | 83 ++++++++ ...ses-to-ensure-state-transitions-work.patch | 184 ++++++++++++++++++ src/supervisor/patch/series | 2 + 6 files changed, 285 insertions(+), 3 deletions(-) create mode 100644 src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch create mode 100644 src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch create mode 100644 src/supervisor/patch/series diff --git a/.gitignore b/.gitignore index 069e663c1966..98ef49099546 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ src/sonic-device-data/src/device/ src/sonic-device-data/src/debian/ src/supervisor/* !src/supervisor/Makefile +!src/supervisor/patch/ src/thrift/* !src/thrift/Makefile diff --git a/rules/supervisor.mk b/rules/supervisor.mk index cedacd96373e..7e7466bbad86 100644 --- a/rules/supervisor.mk +++ b/rules/supervisor.mk @@ -1,5 +1,9 @@ # supervisor package -SUPERVISOR = python-supervisor_3.3.2-1_all.deb +SUPERVISOR_VERSION = 3.3.2 + +export SUPERVISOR_VERSION + +SUPERVISOR = python-supervisor_$(SUPERVISOR_VERSION)-1_all.deb $(SUPERVISOR)_SRC_PATH = $(SRC_PATH)/supervisor SONIC_MAKE_DEBS += $(SUPERVISOR) diff --git a/src/supervisor/Makefile b/src/supervisor/Makefile index 778903194ffa..3f989c3d0173 100644 --- a/src/supervisor/Makefile +++ b/src/supervisor/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e -MAIN_TARGET = python-supervisor_3.3.2-1_all.deb +MAIN_TARGET = python-supervisor_$(SUPERVISOR_VERSION)-1_all.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files @@ -11,7 +11,15 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Clone supervisor repo git clone https://github.com/Supervisor/supervisor.git pushd ./supervisor - git checkout -f 3.3.2 + + # Reset HEAD to the commit of the proper tag + # NOTE: Using "git checkout " here detaches our HEAD, + # which stg doesn't like, so we use this method instead + git reset --hard $(SUPERVISOR_VERSION) + + # Apply patches + stg init + stg import -s ../patch/series # Build Python and Debian package python setup.py --command-packages=stdeb.command bdist_deb 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 new file mode 100644 index 000000000000..c0263e9baf10 --- /dev/null +++ b/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch @@ -0,0 +1,83 @@ +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/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch b/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch new file mode 100644 index 000000000000..cb01665ba80b --- /dev/null +++ b/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch @@ -0,0 +1,184 @@ +From 43b6f3ee93593f666af2c6a7af897bf3b5ee762d 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 + +--- + supervisor/tests/test_process.py | 146 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 146 insertions(+) + +diff --git a/supervisor/tests/test_process.py b/supervisor/tests/test_process.py +index 7f9bab2..ea16315 100644 +--- a/supervisor/tests/test_process.py ++++ b/supervisor/tests/test_process.py +@@ -736,6 +736,40 @@ class SubprocessTests(unittest.TestCase): + instance.stop_report() + self.assertEqual(len(options.logger.data), 1) # throttled + ++ def test_stop_report_laststopreport_in_future(self): ++ future_time = time.time() + 3600 # 1 hour into the future ++ options = DummyOptions() ++ config = DummyPConfig(options, 'test', '/test') ++ instance = self._makeOne(config) ++ instance.pid = 11 ++ dispatcher = DummyDispatcher(writable=True) ++ instance.dispatchers = {'foo':dispatcher} ++ from supervisor.states import ProcessStates ++ instance.state = ProcessStates.STOPPING ++ instance.laststopreport = future_time ++ ++ # This iteration of stop_report() should reset instance.laststopreport ++ # to the current time ++ instance.stop_report() ++ ++ # No logging should have taken place ++ self.assertEqual(len(options.logger.data), 0) ++ ++ # Ensure instance.laststopreport has rolled backward ++ self.assertTrue(instance.laststopreport < future_time) ++ ++ # Sleep for 2 seconds ++ time.sleep(2) ++ ++ # This iteration of stop_report() should actaully trigger the report ++ instance.stop_report() ++ ++ self.assertEqual(len(options.logger.data), 1) ++ self.assertEqual(options.logger.data[0], 'waiting for test to stop') ++ self.assertNotEqual(instance.laststopreport, 0) ++ instance.stop_report() ++ self.assertEqual(len(options.logger.data), 1) # throttled ++ + def test_give_up(self): + options = DummyOptions() + config = DummyPConfig(options, 'test', '/test') +@@ -1402,6 +1436,92 @@ class SubprocessTests(unittest.TestCase): + event = L[0] + self.assertEqual(event.__class__, events.ProcessStateRunningEvent) + ++ def test_transition_starting_to_running_laststart_in_future(self): ++ from supervisor import events ++ L = [] ++ events.subscribe(events.ProcessStateEvent, lambda x: L.append(x)) ++ from supervisor.states import ProcessStates ++ ++ future_time = time.time() + 3600 # 1 hour into the future ++ options = DummyOptions() ++ test_startsecs = 2 ++ ++ # this should go from STARTING to RUNNING via transition() ++ pconfig = DummyPConfig(options, 'process', 'process','/bin/process', ++ startsecs=test_startsecs) ++ process = self._makeOne(pconfig) ++ process.backoff = 1 ++ process.delay = 1 ++ process.system_stop = False ++ process.laststart = future_time ++ process.pid = 1 ++ process.stdout_buffer = 'abc' ++ process.stderr_buffer = 'def' ++ process.state = ProcessStates.STARTING ++ ++ # This iteration of transition() should reset process.laststart ++ # to the current time ++ process.transition() ++ ++ # Process state should still be STARTING ++ self.assertEqual(process.state, ProcessStates.STARTING) ++ ++ # Ensure process.laststart has rolled backward ++ self.assertTrue(process.laststart < future_time) ++ ++ # Sleep for (startsecs + 1) ++ time.sleep(test_startsecs + 1) ++ ++ # This iteration of transition() should actaully trigger the state ++ # transition to RUNNING ++ process.transition() ++ ++ # this implies RUNNING ++ self.assertEqual(process.backoff, 0) ++ self.assertEqual(process.delay, 0) ++ self.assertFalse(process.system_stop) ++ self.assertEqual(process.state, ProcessStates.RUNNING) ++ self.assertEqual(options.logger.data[0], ++ 'success: process entered RUNNING state, process has ' ++ 'stayed up for > than {} seconds (startsecs)'.format(test_startsecs)) ++ self.assertEqual(len(L), 1) ++ event = L[0] ++ self.assertEqual(event.__class__, events.ProcessStateRunningEvent) ++ ++ def test_transition_backoff_to_starting_delay_in_future(self): ++ from supervisor import events ++ L = [] ++ events.subscribe(events.ProcessStateEvent, lambda x: L.append(x)) ++ from supervisor.states import ProcessStates, SupervisorStates ++ ++ future_time = time.time() + 3600 # 1 hour into the future ++ options = DummyOptions() ++ ++ pconfig = DummyPConfig(options, 'process', 'process','/bin/process') ++ process = self._makeOne(pconfig) ++ process.laststart = 1 ++ process.delay = future_time ++ process.backoff = 0 ++ process.state = ProcessStates.BACKOFF ++ ++ # This iteration of transition() should reset process.delay ++ # to the current time ++ process.transition() ++ ++ # Process state should still be BACKOFF ++ self.assertEqual(process.state, ProcessStates.BACKOFF) ++ ++ # Ensure process.delay has rolled backward ++ self.assertTrue(process.delay < future_time) ++ ++ # This iteration of transition() should actaully trigger the state ++ # transition to STARTING ++ process.transition() ++ ++ self.assertEqual(process.state, ProcessStates.STARTING) ++ self.assertEqual(len(L), 1) ++ self.assertEqual(L[0].__class__, events.ProcessStateStartingEvent) ++ + def test_transition_backoff_to_fatal(self): + from supervisor import events + L = [] +@@ -2033,6 +2153,32 @@ class EventListenerPoolTests(ProcessGroupBaseTests): + self.assertEqual(process1.listener_state, EventListenerStates.BUSY) + self.assertEqual(process1.event, event) + ++ def test_transition_event_proc_running_with_dispatch_throttle_last_dispatch_in_future(self): ++ future_time = time.time() + 3600 # 1 hour into the future ++ options = DummyOptions() ++ from supervisor.states import ProcessStates ++ pconfig1 = DummyPConfig(options, 'process1', 'process1','/bin/process1') ++ process1 = DummyProcess(pconfig1, state=ProcessStates.RUNNING) ++ gconfig = DummyPGroupConfig(options, pconfigs=[pconfig1]) ++ pool = self._makeOne(gconfig) ++ pool.dispatch_throttle = 5 ++ pool.last_dispatch = future_time ++ pool.processes = {'process1': process1} ++ event = DummyEvent() ++ from supervisor.states import EventListenerStates ++ process1.listener_state = EventListenerStates.READY ++ class DummyGroup: ++ config = gconfig ++ process1.group = DummyGroup ++ pool._acceptEvent(event) ++ pool.transition() ++ ++ self.assertEqual(process1.transitioned, True) ++ self.assertEqual(pool.event_buffer, [event]) # not popped ++ ++ # Ensure pool.last_dispatch has been rolled backward ++ self.assertTrue(pool.last_dispatch < future_time) ++ + def test__dispatchEvent_notready(self): + options = DummyOptions() + from supervisor.states import ProcessStates +-- +2.1.4 + diff --git a/src/supervisor/patch/series b/src/supervisor/patch/series new file mode 100644 index 000000000000..d141fddf3301 --- /dev/null +++ b/src/supervisor/patch/series @@ -0,0 +1,2 @@ +0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch +0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch From 8db959d2a3ae2a7c9aa5820b0dd784ba65636d6c Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 18 Jan 2018 14:08:27 -0800 Subject: [PATCH 1046/1833] [sonic-py-swsssdk]: Update submodule pointer (#1319) Signed-off-by: Qi Luo --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index a0418a15a46e..cd4cb2784a9c 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit a0418a15a46e20c3d8fcd7c8cf2bb6ab0a4aafaf +Subproject commit cd4cb2784a9ccbb77d60575e2e2befa7a9cbe925 From 33157dc2adb7bd4874451bc33053bef0c0006d5e Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 18 Jan 2018 15:35:38 -0800 Subject: [PATCH 1047/1833] Install azure cli into docker-sonic-mgmt (#1322) Signed-off-by: Qi Luo --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index 6cfe28603894..be2f1b6518b5 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -18,7 +18,9 @@ RUN apt-get install -y \ sshpass \ libxml2 \ libxslt1-dev \ - python-setuptools + python-setuptools \ + build-essential \ + curl # For JNLP launcher RUN apt-get install -y default-jre @@ -87,4 +89,10 @@ RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers USER $user -RUN cd /var/$user && git clone https://github.com/Azure/sonic-mgmt +# Install Azure CLI +WORKDIR /var/$user +RUN curl -L https://aka.ms/InstallAzureCliBundled -o azure-cli_bundle.tar.gz +RUN tar -xvzf azure-cli_bundle.tar.gz +RUN azure-cli_bundle_*/installer + +RUN git clone https://github.com/Azure/sonic-mgmt From 163a0e216594d8da19807ad69d68e633b0e6c247 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 18 Jan 2018 17:28:36 -0800 Subject: [PATCH 1048/1833] [Arista7260cx3] Add platform specific reboot tool (#1318) * [Arista7260cx3] Add platform specific reboot tool * [utilities] update sonic-utilities submodule --- .../x86_64-arista_7260cx3_64/platform_reboot | 87 +++++++++++++++++++ src/sonic-utilities | 2 +- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100755 device/arista/x86_64-arista_7260cx3_64/platform_reboot diff --git a/device/arista/x86_64-arista_7260cx3_64/platform_reboot b/device/arista/x86_64-arista_7260cx3_64/platform_reboot new file mode 100755 index 000000000000..8a3722461157 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/platform_reboot @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# Copyright (c) 2018 Arista Networks, Inc. All rights reserved. +# Arista Networks, Inc. Confidential and Proprietary. + +# Reboot script for 7260CX3 + +from __future__ import print_function +import sys +import mmap, os +import subprocess +from struct import pack, unpack + +class MmapResource( object ): + """Resource implementation for a directly-mapped memory region.""" + + def __init__( self, path ): + try: + fd = os.open( path, os.O_RDWR ) + except EnvironmentError: + print( "FAIL can not open scd memory-map resource file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + try: + size = os.fstat( fd ).st_size + except EnvironmentError: + print( "FAIL can not fstat scd memory-map resource file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + try: + self.mmap_ = mmap.mmap( fd, size, mmap.MAP_SHARED, + mmap.PROT_READ | mmap.PROT_WRITE ) + except EnvironmentError: + print( "FAIL can not map scd memory-map file" ) + print( "FAIL are you running on the proper platform?" ) + sys.exit( 1 ) + finally: + try: + # Note that closing the file descriptor has no effect on the memory map + os.close( fd ) + except EnvironmentError: + print( "FAIL failed to close scd memory-map file" ) + sys.exit( 1 ) + + def read32( self, addr ): + return unpack( ' Date: Thu, 18 Jan 2018 19:55:11 -0800 Subject: [PATCH 1049/1833] [scripts]: Fix issues with checking status of the DB. Use one approach everywhere. (#1323) --- files/build_templates/docker_image_ctl.j2 | 7 ++----- files/build_templates/swss.service.j2 | 2 +- files/scripts/configdb-load.sh | 7 ++----- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index a2bfb7d12503..240a7514d65b 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -10,11 +10,8 @@ function postStartAction() {%- if docker_container_name != "database" %} : {%- else %} - while true; do - if [[ "$(docker exec -i database redis-cli ping)" =~ PONG.* ]]; then - break - fi - sleep 1 + until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; do + sleep 1; done {%- endif %} {%- if docker_container_name == "snmp" %} diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index b18321676b78..ebfb5027b297 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -17,7 +17,7 @@ After=nps-modules-3.16.0-4-amd64.service [Service] User=root # Wait for redis server start before database clean -ExecStartPre=/bin/bash -c "while true; do if [ \"$(/usr/bin/docker exec database redis-cli ping)\" == \"PONG\" ]; then break; fi; sleep 1; done" +ExecStartPre=/bin/bash -c 'until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; do sleep 1; done' ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB diff --git a/files/scripts/configdb-load.sh b/files/scripts/configdb-load.sh index 2175e37d5a75..42bb9959bca8 100755 --- a/files/scripts/configdb-load.sh +++ b/files/scripts/configdb-load.sh @@ -1,11 +1,8 @@ #!/usr/bin/env bash # Wait until redis starts -while true; do - if [ `redis-cli ping` == "PONG" ]; then - break - fi - sleep 1 +until [[ $(redis-cli ping | grep -c PONG) -gt 0 ]]; do + sleep 1; done # If there is a config db dump file, load it From 5e01fb366ec4bbe9218e701cf48aefb1465fc65b Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 18 Jan 2018 21:52:24 -0800 Subject: [PATCH 1050/1833] Prevent supervisor from restarting configdb-load.sh (#1324) --- dockers/docker-database/supervisord.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/dockers/docker-database/supervisord.conf b/dockers/docker-database/supervisord.conf index 9ad7ff32bcf9..8237ea876790 100644 --- a/dockers/docker-database/supervisord.conf +++ b/dockers/docker-database/supervisord.conf @@ -24,5 +24,6 @@ command=/usr/bin/configdb-load.sh priority=3 autostart=true autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog From ab26a5c589cf3bf3d4810638dc0726cd4f5a6c09 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 22 Jan 2018 10:52:52 -0800 Subject: [PATCH 1051/1833] Install sonic-platform-common package in platform-monitor docker for ledd (#1330) * Install sonic-platform-common package in platform-monitor docker for ledd * Specify Python wheel dependencies in docker-platform-monitor.mk; Remove explicit specifications from Dockerfile.j2 --- dockers/docker-platform-monitor/Dockerfile.j2 | 48 +++++++------------ rules/docker-platform-monitor.mk | 2 + 2 files changed, 19 insertions(+), 31 deletions(-) diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index b6406b3e3a6a..4dd8acaf0e26 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -9,44 +9,30 @@ RUN apt-get update # Install required packages RUN apt-get install -y python-pip sensord fancontrol -{% if docker_platform_monitor_debs.strip() %} -# Copy built Debian packages -COPY \ -{% for deb in docker_platform_monitor_debs.split(' ') -%} +{% if docker_platform_monitor_debs.strip() -%} +# Copy all locally-built Debian package dependencies +COPY{{' '}} +{%- for deb in docker_platform_monitor_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} -debs/ -{%- endif %} +/debs/ -{% if docker_platform_monitor_debs.strip() %} -# Install built Debian packages -RUN dpkg -i \ -{% for deb in docker_platform_monitor_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor %} -{%- endif %} +# Install all locally-built Debian package dependencies +# and implicitly install their dependencies +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/*.deb +{% endif %} -{% if docker_platform_monitor_whls.strip() %} -# Copy built Python wheels -COPY \ -{% for whl in docker_platform_monitor_whls.split(' ') -%} +{% if docker_platform_monitor_whls.strip() -%} +# Copy all locally-built Python wheel dependencies +COPY{{' '}} +{%- for whl in docker_platform_monitor_whls.split(' ') -%} python-wheels/{{ whl }}{{' '}} {%- endfor -%} -python-wheels/ -{%- endif %} - -{% if docker_platform_monitor_whls.strip() %} -# Install built Python wheels -RUN pip install \ -{% for whl in docker_platform_monitor_whls.split(' ') -%} -python-wheels/{{ whl }}{{' '}} -{%- endfor %} -{%- endif %} - -COPY python-wheels /python-wheels +/python-wheels/ -# Install Python SwSS SDK (dependency of sonic-ledd) -RUN pip install /python-wheels/swsssdk-2.0.1-py2-none-any.whl +# Install all locally-built Python wheel dependencies +RUN pip install /python-wheels/*.whl +{% endif %} # Clean up RUN apt-get remove -y python-pip diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 76e7dac4ab63..345e82f7b86f 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -3,6 +3,8 @@ DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(SONIC_LEDD) +$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) +$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) From 6f12ff286dea0afd5f68dd8c4bffd65a6922a294 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 23 Jan 2018 18:16:15 -0800 Subject: [PATCH 1052/1833] [minigraph]: Set hostname in all default minigraphs to 'sonic' (#1333) --- .../x86_64-accton_as5712_54x-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-accton_as7312_54x-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-accton_as7512_32x-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-accton_as7712_32x-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-accton_as7716_32x-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-accton_as7816_64x-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-arista_7050_qx32/minigraph.xml | 138 +++++++++--------- .../x86_64-arista_7050_qx32s/minigraph.xml | 138 +++++++++--------- .../x86_64-arista_7060_cx32s/minigraph.xml | 138 +++++++++--------- .../Seastone-DX010-10-50/minigraph.xml | 138 +++++++++--------- .../Seastone-DX010-50/minigraph.xml | 138 +++++++++--------- .../Seastone-DX010/minigraph.xml | 138 +++++++++--------- .../x86_64-cel_seastone-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-centec_e582_48x6q-r0/minigraph.xml | 136 ++++++++--------- .../x86_64-ew_es6220_x48q2h4-r0/minigraph.xml | 136 ++++++++--------- .../x86_64-dell_s6000_s1220-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-dell_s6100_c2538-r0/minigraph.xml | 114 +++++++-------- .../x86_64-dell_z9100_c2538-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-delta_ag9032v1-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-mlnx_msn2100-r0/minigraph.xml | 74 +++++----- .../x86_64-mlnx_msn2410-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-mlnx_msn2700-r0/minigraph.xml | 138 +++++++++--------- .../x86_64-mlnx_msn2740-r0/minigraph.xml | 138 +++++++++--------- 23 files changed, 1541 insertions(+), 1541 deletions(-) diff --git a/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml index 78c3876d8381..065105bf183a 100755 --- a/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -1014,224 +1014,224 @@ DeviceInterfaceLink - switch1 + sonic tenGigE0 ARISTA01T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE1 ARISTA02T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE2 ARISTA03T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE3 ARISTA04T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE4 ARISTA05T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE5 ARISTA06T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE6 ARISTA07T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE7 ARISTA08T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE8 ARISTA09T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE9 ARISTA10T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE10 ARISTA11T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE11 ARISTA12T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE12 ARISTA13T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE13 ARISTA14T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE14 ARISTA15T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE15 ARISTA16T2 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE16 ARISTA01T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE17 ARISTA02T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE18 ARISTA03T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE19 ARISTA04T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE20 ARISTA05T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE21 ARISTA06T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE22 ARISTA07T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE23 ARISTA08T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE24 ARISTA09T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE25 ARISTA10T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE26 ARISTA11T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE27 ARISTA12T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE28 ARISTA13T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE29 ARISTA14T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE30 ARISTA15T0 tenGigE1 DeviceInterfaceLink - switch1 + sonic tenGigE31 ARISTA16T0 tenGigE1 @@ -1239,7 +1239,7 @@ - switch1 + sonic Accton-AS5712-54X @@ -1247,7 +1247,7 @@ - switch1 + sonic DhcpResources @@ -1269,6 +1269,6 @@ - switch1 + sonic Accton-AS5712-54X
diff --git a/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml index 8547ceacbc58..a967047b237b 100644 --- a/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -924,224 +924,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet1 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet2 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet3 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet5 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet6 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet7 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet9 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet10 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet11 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet13 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet14 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet15 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet17 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet18 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet19 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet21 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet22 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet23 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet25 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet26 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet27 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet29 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet30 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet31 ARISTA16T0 Ethernet1 @@ -1149,7 +1149,7 @@ - switch1 + sonic Accton-AS7312-54X @@ -1157,7 +1157,7 @@ - switch1 + sonic DhcpResources @@ -1179,6 +1179,6 @@ - switch1 + sonic Accton-AS7312-54X diff --git a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml index 758aca3551d6..ac05be93960a 100644 --- a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic AS7512 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic AS7512 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml index 025985c83675..d252de01ca8a 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Accton-AS7712-32X @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1069,6 +1069,6 @@ - switch1 + sonic Accton-AS7712-32X diff --git a/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml index e197d4cd7178..148a17769129 100644 --- a/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Accton-AS7716-32X @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1069,6 +1069,6 @@ - switch1 + sonic Accton-AS7716-32X diff --git a/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml b/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml index 025985c83675..d252de01ca8a 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Accton-AS7712-32X @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1069,6 +1069,6 @@ - switch1 + sonic Accton-AS7712-32X diff --git a/device/arista/x86_64-arista_7050_qx32/minigraph.xml b/device/arista/x86_64-arista_7050_qx32/minigraph.xml index bbf2508ce4cc..538a0ca61a0d 100644 --- a/device/arista/x86_64-arista_7050_qx32/minigraph.xml +++ b/device/arista/x86_64-arista_7050_qx32/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet2/1 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet3/1 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4/1 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet5/1 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet6/1 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet7/1 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8/1 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet9/1 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet10/1 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet11/1 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12/1 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet13/1 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet14/1 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet15/1 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16/1 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet17/1 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet18/1 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet19/1 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20/1 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet21/1 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet22/1 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet23/1 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24/1 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Arista-7050-QX32 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Arista-7050-QX32 diff --git a/device/arista/x86_64-arista_7050_qx32s/minigraph.xml b/device/arista/x86_64-arista_7050_qx32s/minigraph.xml index efd30582947a..f28c9a9ae6cb 100644 --- a/device/arista/x86_64-arista_7050_qx32s/minigraph.xml +++ b/device/arista/x86_64-arista_7050_qx32s/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet2/1 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet3/1 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4/1 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet5/1 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet6/1 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet7/1 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8/1 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet9/1 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet10/1 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet11/1 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12/1 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet13/1 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet14/1 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet15/1 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16/1 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet17/1 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet18/1 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet19/1 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20/1 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet21/1 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet22/1 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet23/1 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24/1 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Arista-7050-QX-32S @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Arista-7050-QX-32S diff --git a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml index 23282de17af1..772325080e79 100644 --- a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml +++ b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet2/1 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet3/1 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4/1 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet5/1 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet6/1 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet7/1 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8/1 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet9/1 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet10/1 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet11/1 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12/1 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet13/1 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet14/1 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet15/1 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16/1 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet17/1 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet18/1 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet19/1 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20/1 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet21/1 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet22/1 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet23/1 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24/1 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet25/1 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet26/1 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet27/1 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28/1 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet29/1 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet30/1 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet31/1 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32/1 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Arista-7060CX-32S-C32 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Arista-7060CX-32S-C32 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/minigraph.xml index 7b918a5414c4..624403c913bb 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/minigraph.xml +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -1214,224 +1214,224 @@ DeviceInterfaceLink - switch1 + sonic tenGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic tenGigE1/32 ARISTA16T0 Ethernet1 @@ -1439,7 +1439,7 @@ - switch1 + sonic Seastone-DX010-10-50 @@ -1447,7 +1447,7 @@ - switch1 + sonic DhcpResources @@ -1474,6 +1474,6 @@ - switch1 + sonic Seastone-DX010-10-50 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml index 47dc749df6f5..d2259d4b2062 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -974,224 +974,224 @@ DeviceInterfaceLink - switch1 + sonic fiftyGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fiftyGigE1/32 ARISTA16T0 Ethernet1 @@ -1199,7 +1199,7 @@ - switch1 + sonic Seastone-DX010-50 @@ -1207,7 +1207,7 @@ - switch1 + sonic DhcpResources @@ -1234,6 +1234,6 @@ - switch1 + sonic Seastone-DX010-50 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml index 921839b0d72d..c32f9e47513d 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic hundredGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Seastone-DX010 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Seastone-DX010 diff --git a/device/celestica/x86_64-cel_seastone-r0/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/minigraph.xml index 921839b0d72d..c32f9e47513d 100644 --- a/device/celestica/x86_64-cel_seastone-r0/minigraph.xml +++ b/device/celestica/x86_64-cel_seastone-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic hundredGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Seastone-DX010 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Seastone-DX010 diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml b/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml index fd35742353c9..950c52a64134 100644 --- a/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml +++ b/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,11 +1039,11 @@ - switch1 + sonic E582-48x6q - switch1 + sonic E582-48x6q diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml b/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml index 03be9a51b7c1..cb0e9d4e2b0a 100644 --- a/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml +++ b/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,11 +1039,11 @@ - switch1 + sonic ES6428A-X48Q2H4 - switch1 + sonic ES6428A-X48Q2H4 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml b/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml index 871a91c7fd02..d5b453c43081 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml +++ b/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic fortyGigE0/0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic fortyGigE0/124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Force10-S6000 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Force10-S6000 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml index 37fba6c291b1..224cf4a9a6bb 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml +++ b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml @@ -5,7 +5,7 @@ ARISTA01T1 10.0.0.1 - switch1 + sonic 10.0.0.0 1 180 @@ -14,7 +14,7 @@ ARISTA02T1 10.0.0.5 - switch1 + sonic 10.0.0.4 1 180 @@ -23,7 +23,7 @@ ARISTA03T1 10.0.0.9 - switch1 + sonic 10.0.0.8 1 180 @@ -32,7 +32,7 @@ ARISTA04T1 10.0.0.13 - switch1 + sonic 10.0.0.12 1 180 @@ -41,7 +41,7 @@ ARISTA01T1 FC00::2 - switch1 + sonic FC00::1 1 180 @@ -50,7 +50,7 @@ ARISTA02T1 FC00::A - switch1 + sonic FC00::9 1 180 @@ -59,7 +59,7 @@ ARISTA03T1 FC00::12 - switch1 + sonic FC00::11 1 180 @@ -68,7 +68,7 @@ ARISTA04T1 FC00::1A - switch1 + sonic FC00::19 1 180 @@ -78,7 +78,7 @@ 64601 - switch1 + sonic BGPPeer @@ -187,7 +187,7 @@ - switch1 + sonic PortChannelInterface @@ -298,7 +298,7 @@ ARISTA01T1 Ethernet1 true - switch1 + sonic fortyGigE1/1/1
@@ -308,7 +308,7 @@ ARISTA01T1 Ethernet2 true - switch1 + sonic fortyGigE1/1/2 @@ -318,7 +318,7 @@ ARISTA02T1 Ethernet1 true - switch1 + sonic fortyGigE1/1/5 @@ -328,7 +328,7 @@ ARISTA02T1 Ethernet2 true - switch1 + sonic fortyGigE1/1/6 @@ -338,7 +338,7 @@ ARISTA03T1 Ethernet1 true - switch1 + sonic fortyGigE1/2/1 @@ -348,7 +348,7 @@ ARISTA03T1 Ethernet2 true - switch1 + sonic fortyGigE1/2/2 @@ -358,7 +358,7 @@ ARISTA04T1 Ethernet1 true - switch1 + sonic fortyGigE1/2/5 @@ -368,14 +368,14 @@ ARISTA04T1 Ethernet2 true - switch1 + sonic fortyGigE1/2/6 DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/7 true server-01 @@ -385,7 +385,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/8 true server-02 @@ -395,7 +395,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/9 true server-03 @@ -405,7 +405,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/10 true server-04 @@ -415,7 +415,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/11 true server-05 @@ -425,7 +425,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/12 true server-06 @@ -435,7 +435,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/13 true server-07 @@ -445,7 +445,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/14 true server-08 @@ -455,7 +455,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/15 true server-09 @@ -465,7 +465,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/1/16 true server-10 @@ -475,7 +475,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/1 true server-11 @@ -485,7 +485,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/5 true server-12 @@ -495,7 +495,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/6 true server-13 @@ -505,7 +505,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/7 true server-14 @@ -515,7 +515,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/8 true server-15 @@ -525,7 +525,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/9 true server-16 @@ -535,7 +535,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/10 true server-17 @@ -545,7 +545,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/3/11 true server-18 @@ -555,7 +555,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/7 true server-19 @@ -565,7 +565,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/8 true server-20 @@ -575,7 +575,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/9 true server-21 @@ -585,7 +585,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/10 true server-22 @@ -595,7 +595,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/11 true server-23 @@ -605,7 +605,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/12 true server-24 @@ -615,7 +615,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/13 true server-25 @@ -625,7 +625,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/14 true server-26 @@ -635,7 +635,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/15 true server-27 @@ -645,7 +645,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/2/16 true server-28 @@ -655,7 +655,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/1 true server-29 @@ -665,7 +665,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/5 true server-30 @@ -675,7 +675,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/6 true server-31 @@ -685,7 +685,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/7 true server-32 @@ -695,7 +695,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/8 true server-33 @@ -705,7 +705,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/9 true server-34 @@ -715,7 +715,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/10 true server-35 @@ -725,7 +725,7 @@ DeviceInterfaceLink true 40000 - switch1 + sonic fortyGigE1/4/11 true server-36 @@ -734,7 +734,7 @@ - switch1 + sonic Force10-S6100 @@ -742,7 +742,7 @@ - switch1 + sonic DhcpResources @@ -769,6 +769,6 @@ - switch1 + sonic Force10-S6100 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml index b45892801ed3..e1d42d180fe0 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml +++ b/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic hundredGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Force10-Z9100 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Force10-Z9100 diff --git a/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml b/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml index db8d62440534..129103ce6bfe 100644 --- a/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml +++ b/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch1 + sonic 10.0.0.32 1 180 60 - switch1 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch1 + sonic 10.0.0.34 1 180 60 - switch1 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch1 + sonic 10.0.0.36 1 180 60 - switch1 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch1 + sonic 10.0.0.38 1 180 60 - switch1 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch1 + sonic 10.0.0.40 1 180 60 - switch1 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch1 + sonic 10.0.0.42 1 180 60 - switch1 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch1 + sonic 10.0.0.44 1 180 60 - switch1 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch1 + sonic 10.0.0.46 1 180 60 - switch1 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch1 + sonic 10.0.0.48 1 180 60 - switch1 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch1 + sonic 10.0.0.50 1 180 60 - switch1 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch1 + sonic 10.0.0.52 1 180 60 - switch1 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch1 + sonic 10.0.0.54 1 180 60 - switch1 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch1 + sonic 10.0.0.56 1 180 60 - switch1 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch1 + sonic 10.0.0.58 1 180 60 - switch1 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch1 + sonic 10.0.0.60 1 180 60 - switch1 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch1 + sonic 10.0.0.62 1 180 60 - switch1 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch1 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch1 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch1 + sonic hundredGigE1/1 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/2 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/3 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/4 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/5 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/6 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/7 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/8 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/9 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/10 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/11 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/12 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/13 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/14 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/15 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/16 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/17 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/18 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/19 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/20 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/21 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/22 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/23 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/24 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/25 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/26 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/27 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/28 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/29 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/30 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/31 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch1 + sonic hundredGigE1/32 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch1 + sonic Delta-ag9032v1 @@ -1047,7 +1047,7 @@ - switch1 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch1 + sonic Delta-ag9032v1 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml index 859c22a7dac3..d902d6eac4d4 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml @@ -3,7 +3,7 @@ - switch2 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -12,7 +12,7 @@ 60 - switch2 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -21,7 +21,7 @@ 60 - switch2 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -30,7 +30,7 @@ 60 - switch2 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -39,7 +39,7 @@ 60 - switch2 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -48,7 +48,7 @@ 60 - switch2 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -57,7 +57,7 @@ 60 - switch2 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -66,7 +66,7 @@ 60 - switch2 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -75,7 +75,7 @@ 60 - switch2 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -84,7 +84,7 @@ 60 - switch2 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -93,7 +93,7 @@ 60 - switch2 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -102,7 +102,7 @@ 60 - switch2 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -111,7 +111,7 @@ 60 - switch2 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -120,7 +120,7 @@ 60 - switch2 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -129,7 +129,7 @@ 60 - switch2 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -138,7 +138,7 @@ 60 - switch2 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -150,7 +150,7 @@ 65100 - switch2 + sonic
10.0.0.1
@@ -335,7 +335,7 @@ - switch2 + sonic @@ -430,112 +430,112 @@ DeviceInterfaceLink - switch2 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet60 ARISTA16T2 Ethernet1 @@ -543,7 +543,7 @@ - switch2 + sonic ACS-MSN2700 ` @@ -551,7 +551,7 @@ - switch2 + sonic DhcpResources @@ -573,6 +573,6 @@ - switch2 + sonic ACS-MSN2100 diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml index ea765fab814d..8b417c35353f 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch2 + sonic 10.0.0.32 1 180 60 - switch2 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch2 + sonic 10.0.0.34 1 180 60 - switch2 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch2 + sonic 10.0.0.36 1 180 60 - switch2 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch2 + sonic 10.0.0.38 1 180 60 - switch2 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch2 + sonic 10.0.0.40 1 180 60 - switch2 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch2 + sonic 10.0.0.42 1 180 60 - switch2 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch2 + sonic 10.0.0.44 1 180 60 - switch2 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch2 + sonic 10.0.0.46 1 180 60 - switch2 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch2 + sonic 10.0.0.48 1 180 60 - switch2 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch2 + sonic 10.0.0.50 1 180 60 - switch2 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch2 + sonic 10.0.0.52 1 180 60 - switch2 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch2 + sonic 10.0.0.54 1 180 60 - switch2 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch2 + sonic 10.0.0.56 1 180 60 - switch2 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch2 + sonic 10.0.0.58 1 180 60 - switch2 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch2 + sonic 10.0.0.60 1 180 60 - switch2 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch2 + sonic 10.0.0.62 1 180 60 - switch2 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch2 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch2 + sonic @@ -934,224 +934,224 @@ DeviceInterfaceLink - switch2 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1159,7 +1159,7 @@ - switch2 + sonic ACS-MSN2410 @@ -1167,7 +1167,7 @@ - switch2 + sonic DhcpResources @@ -1194,6 +1194,6 @@ - switch2 + sonic ACS-MSN2410 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml index 50f49f63878a..19ea4a9670bf 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch2 + sonic 10.0.0.32 1 180 60 - switch2 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch2 + sonic 10.0.0.34 1 180 60 - switch2 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch2 + sonic 10.0.0.36 1 180 60 - switch2 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch2 + sonic 10.0.0.38 1 180 60 - switch2 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch2 + sonic 10.0.0.40 1 180 60 - switch2 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch2 + sonic 10.0.0.42 1 180 60 - switch2 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch2 + sonic 10.0.0.44 1 180 60 - switch2 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch2 + sonic 10.0.0.46 1 180 60 - switch2 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch2 + sonic 10.0.0.48 1 180 60 - switch2 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch2 + sonic 10.0.0.50 1 180 60 - switch2 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch2 + sonic 10.0.0.52 1 180 60 - switch2 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch2 + sonic 10.0.0.54 1 180 60 - switch2 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch2 + sonic 10.0.0.56 1 180 60 - switch2 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch2 + sonic 10.0.0.58 1 180 60 - switch2 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch2 + sonic 10.0.0.60 1 180 60 - switch2 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch2 + sonic 10.0.0.62 1 180 60 - switch2 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch2 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch2 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch2 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch2 + sonic ACS-MSN2700 @@ -1047,7 +1047,7 @@ - switch2 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch2 + sonic ACS-MSN2700 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml index 81deffca3ae3..f25aa94384e5 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml @@ -5,14 +5,14 @@ ARISTA01T0 10.0.0.33 - switch2 + sonic 10.0.0.32 1 180 60 - switch2 + sonic 10.0.0.0 ARISTA01T2 10.0.0.1 @@ -23,14 +23,14 @@ ARISTA02T0 10.0.0.35 - switch2 + sonic 10.0.0.34 1 180 60 - switch2 + sonic 10.0.0.2 ARISTA02T2 10.0.0.3 @@ -41,14 +41,14 @@ ARISTA03T0 10.0.0.37 - switch2 + sonic 10.0.0.36 1 180 60 - switch2 + sonic 10.0.0.4 ARISTA03T2 10.0.0.5 @@ -59,14 +59,14 @@ ARISTA04T0 10.0.0.39 - switch2 + sonic 10.0.0.38 1 180 60 - switch2 + sonic 10.0.0.6 ARISTA04T2 10.0.0.7 @@ -77,14 +77,14 @@ ARISTA05T0 10.0.0.41 - switch2 + sonic 10.0.0.40 1 180 60 - switch2 + sonic 10.0.0.8 ARISTA05T2 10.0.0.9 @@ -95,14 +95,14 @@ ARISTA06T0 10.0.0.43 - switch2 + sonic 10.0.0.42 1 180 60 - switch2 + sonic 10.0.0.10 ARISTA06T2 10.0.0.11 @@ -113,14 +113,14 @@ ARISTA07T0 10.0.0.45 - switch2 + sonic 10.0.0.44 1 180 60 - switch2 + sonic 10.0.0.12 ARISTA07T2 10.0.0.13 @@ -131,14 +131,14 @@ ARISTA08T0 10.0.0.47 - switch2 + sonic 10.0.0.46 1 180 60 - switch2 + sonic 10.0.0.14 ARISTA08T2 10.0.0.15 @@ -149,14 +149,14 @@ ARISTA09T0 10.0.0.49 - switch2 + sonic 10.0.0.48 1 180 60 - switch2 + sonic 10.0.0.16 ARISTA09T2 10.0.0.17 @@ -167,14 +167,14 @@ ARISTA10T0 10.0.0.51 - switch2 + sonic 10.0.0.50 1 180 60 - switch2 + sonic 10.0.0.18 ARISTA10T2 10.0.0.19 @@ -185,14 +185,14 @@ ARISTA11T0 10.0.0.53 - switch2 + sonic 10.0.0.52 1 180 60 - switch2 + sonic 10.0.0.20 ARISTA11T2 10.0.0.21 @@ -203,14 +203,14 @@ ARISTA12T0 10.0.0.55 - switch2 + sonic 10.0.0.54 1 180 60 - switch2 + sonic 10.0.0.22 ARISTA12T2 10.0.0.23 @@ -221,14 +221,14 @@ ARISTA13T0 10.0.0.57 - switch2 + sonic 10.0.0.56 1 180 60 - switch2 + sonic 10.0.0.24 ARISTA13T2 10.0.0.25 @@ -239,14 +239,14 @@ ARISTA14T0 10.0.0.59 - switch2 + sonic 10.0.0.58 1 180 60 - switch2 + sonic 10.0.0.26 ARISTA14T2 10.0.0.27 @@ -257,14 +257,14 @@ ARISTA15T0 10.0.0.61 - switch2 + sonic 10.0.0.60 1 180 60 - switch2 + sonic 10.0.0.28 ARISTA15T2 10.0.0.29 @@ -275,14 +275,14 @@ ARISTA16T0 10.0.0.63 - switch2 + sonic 10.0.0.62 1 180 60 - switch2 + sonic 10.0.0.30 ARISTA16T2 10.0.0.31 @@ -294,7 +294,7 @@ 65100 - switch2 + sonic
10.0.0.33
@@ -639,7 +639,7 @@ - switch2 + sonic @@ -814,224 +814,224 @@ DeviceInterfaceLink - switch2 + sonic Ethernet0 ARISTA01T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet4 ARISTA02T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet8 ARISTA03T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet12 ARISTA04T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet16 ARISTA05T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet20 ARISTA06T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet24 ARISTA07T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet28 ARISTA08T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet32 ARISTA09T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet36 ARISTA10T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet40 ARISTA11T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet44 ARISTA12T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet48 ARISTA13T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet52 ARISTA14T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet56 ARISTA15T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet60 ARISTA16T2 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet64 ARISTA01T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet68 ARISTA02T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet72 ARISTA03T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet76 ARISTA04T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet80 ARISTA05T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet84 ARISTA06T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet88 ARISTA07T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet92 ARISTA08T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet96 ARISTA09T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet100 ARISTA10T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet104 ARISTA11T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet108 ARISTA12T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet112 ARISTA13T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet116 ARISTA14T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet120 ARISTA15T0 Ethernet1 DeviceInterfaceLink - switch2 + sonic Ethernet124 ARISTA16T0 Ethernet1 @@ -1039,7 +1039,7 @@ - switch2 + sonic ACS-MSN2740 ` @@ -1047,7 +1047,7 @@ - switch2 + sonic DhcpResources @@ -1074,6 +1074,6 @@ - switch2 + sonic ACS-MSN2740 From 814e50fd5e4d001fbd729fa95aaabe0d395a45fd Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Fri, 26 Jan 2018 18:09:31 +0200 Subject: [PATCH 1053/1833] Buffers configuration update on port speed change (#1250) * Move buffer configuration to ConfigDB Signed-off-by: Andriy Moroz * Converted Dell and Arista configs Signed-off-by: Andriy Moroz * Add buffer configs for ACS-MSN2740 Signed-off-by: Andriy Moroz * Updated buffers template Signed-off-by: Andriy Moroz * Fixed j2 unit test Signed-off-by: Andriy Moroz * Update buffers config for Force10-S6100 Signed-off-by: Andriy Moroz * Update VS docker to support speed and buffers test Signed-off-by: Andriy Moroz * Update buffers config generation - fixed support of sonic-to-sonic install Signed-off-by: Andriy Moroz --- .../Arista-7050-QX32/buffers.json.j2 | 135 ++++++ .../Arista-7050-QX32/pg_profile_lookup.ini | 17 + .../Force10-S6000/buffers.json.j2 | 135 ++++++ .../Force10-S6000/pg_profile_lookup.ini | 17 + .../Force10-S6100/buffers.json.j2 | 126 ++++++ .../ACS-MSN2700/buffers.json.j2 | 162 ++++++++ .../ACS-MSN2700/pg_profile_lookup.ini | 17 + .../ACS-MSN2740/buffers.json.j2 | 162 ++++++++ .../ACS-MSN2740/pg_profile_lookup.ini | 17 + .../msn27xx.32ports.buffers.json.j2 | 292 ------------- dockers/docker-orchagent/ports.json.j2 | 6 +- dockers/docker-orchagent/start.sh | 2 + dockers/docker-orchagent/supervisord.conf | 8 + dockers/docker-orchagent/swssconfig.sh | 3 - files/image_config/platform/rc.local | 20 +- platform/vs/docker-sonic-vs/Dockerfile.j2 | 2 + platform/vs/docker-sonic-vs/buffers.json.j2 | 162 ++++++++ .../vs/docker-sonic-vs/pg_profile_lookup.ini | 17 + platform/vs/docker-sonic-vs/start.sh | 6 +- platform/vs/docker-sonic-vs/supervisord.conf | 8 + .../tests/sample_output/msn27.32ports.json | 387 ++++-------------- .../tests/sample_output/ports.json | 2 +- src/sonic-config-engine/tests/test_j2files.py | 3 +- 23 files changed, 1096 insertions(+), 610 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini delete mode 100644 dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 create mode 100644 platform/vs/docker-sonic-vs/buffers.json.j2 create mode 100644 platform/vs/docker-sonic-vs/pg_profile_lookup.ini diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 new file mode 100644 index 000000000000..560cae5dd1b4 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 @@ -0,0 +1,135 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "7274496", + "type": "ingress", + "mode": "static" + }, + "ingress_lossy_pool": { + "size": "5491712", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool0": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossless_pool1": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "5491712", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + }, + "egress_lossless_profile0": { + "pool":"[BUFFER_POOL|egress_lossless_pool0]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossless_profile1": { + "pool":"[BUFFER_POOL|egress_lossless_pool1]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" + }, + "{{ port_names }}|4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} 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 new file mode 100644 index 000000000000..f3a0840558a6 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 113664 18432 76800 0 + 25000 5m 113664 18432 76800 0 + 40000 5m 113664 18432 76800 0 + 50000 5m 113664 18432 76800 0 + 100000 5m 113664 18432 76800 0 + 10000 40m 113664 18432 76800 0 + 25000 40m 113664 18432 76800 0 + 40000 40m 113664 18432 76800 0 + 50000 40m 113664 18432 76800 0 + 100000 40m 113664 18432 76800 0 + 10000 300m 113664 18432 76800 0 + 25000 300m 113664 18432 76800 0 + 40000 300m 113664 18432 76800 0 + 50000 300m 113664 18432 76800 0 + 100000 300m 113664 18432 76800 0 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 new file mode 100644 index 000000000000..560cae5dd1b4 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 @@ -0,0 +1,135 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "7274496", + "type": "ingress", + "mode": "static" + }, + "ingress_lossy_pool": { + "size": "5491712", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool0": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossless_pool1": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "5491712", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + }, + "egress_lossless_profile0": { + "pool":"[BUFFER_POOL|egress_lossless_pool0]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossless_profile1": { + "pool":"[BUFFER_POOL|egress_lossless_pool1]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" + }, + "{{ port_names }}|4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} 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 new file mode 100644 index 000000000000..f3a0840558a6 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 113664 18432 76800 0 + 25000 5m 113664 18432 76800 0 + 40000 5m 113664 18432 76800 0 + 50000 5m 113664 18432 76800 0 + 100000 5m 113664 18432 76800 0 + 10000 40m 113664 18432 76800 0 + 25000 40m 113664 18432 76800 0 + 40000 40m 113664 18432 76800 0 + 50000 40m 113664 18432 76800 0 + 100000 40m 113664 18432 76800 0 + 10000 300m 113664 18432 76800 0 + 25000 300m 113664 18432 76800 0 + 40000 300m 113664 18432 76800 0 + 50000 300m 113664 18432 76800 0 + 100000 300m 113664 18432 76800 0 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 new file mode 100644 index 000000000000..b12fc3851177 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 @@ -0,0 +1,126 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 64 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % port_idx) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_lossy_pool": { + "size": "10443264", + "type": "ingress", + "mode": "dynamic", + "xoff": "4625920" + }, + "egress_lossy_pool": { + "size": "8877440", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982592", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool": "[BUFFER_POOL|ingress_lossless_lossy_pool]", + "xon": "4096", + "xoff": "58448", + "size": "1248", + "dynamic_th": "-4" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995648" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}:3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}:0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 new file mode 100644 index 000000000000..da9c764db92b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 @@ -0,0 +1,162 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 new file mode 100644 index 000000000000..da9c764db92b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 @@ -0,0 +1,162 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 deleted file mode 100644 index 579832ecda11..000000000000 --- a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 +++ /dev/null @@ -1,292 +0,0 @@ -[ -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') %} -{% set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%if switch_role == 'ToRRouter' %} -{% set ingress_lossless_pool_size = '4194304' %} -{% set ingress_lossy_pool_size = '7340032' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '7340032' %} -{% else %} -{% set ingress_lossless_pool_size = '2097152' %} -{% set ingress_lossy_pool_size = '5242880' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '5242880' %} -{%endif %} - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", - "size":"0", - "dynamic_th":"0" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", - "size":"4096", - "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:pg_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_INGRESS_PROFILE_LIST:{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_EGRESS_PROFILE_LIST:{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]" - }, - "OP": "SET" - }, - -{# The following template part is for variable PG profile configuration #} -{% set pg_range = '3-4' %} -{# Lists of supported speed and cable length #} -{% set supported_speed = [10000, 25000, 40000, 50000, 100000] %} -{% set supported_cable = [5, 40, 300] %} - -{# The key in this lictionary consist of two parts: (port speed)_(cable length) #} -{%- set portconfig2profile = { - '10000_5' : 'pg_lossless_10G_5m_profile', - '25000_5' : 'pg_lossless_25G_5m_profile', - '40000_5' : 'pg_lossless_40G_5m_profile', - '50000_5' : 'pg_lossless_50G_5m_profile', - '100000_5' : 'pg_lossless_100G_5m_profile', - - '10000_40' : 'pg_lossless_10G_40m_profile', - '25000_40' : 'pg_lossless_25G_40m_profile', - '40000_40' : 'pg_lossless_40G_40m_profile', - '50000_40' : 'pg_lossless_50G_40m_profile', - '100000_40' : 'pg_lossless_100G_40m_profile', - - '10000_300' : 'pg_lossless_10G_300m_profile', - '25000_300' : 'pg_lossless_25G_300m_profile', - '40000_300' : 'pg_lossless_40G_300m_profile', - '50000_300' : 'pg_lossless_50G_300m_profile', - '100000_300': 'pg_lossless_100G_300m_profile' - } --%} - -{# PG profiles. All profiles reffered in portconfig2profile dictionary should be declared here #} -{# Only those which were actually used will be created in SAI #} -{%- set pg_profiles = { - 'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, - 'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, - 'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, - 'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, - 'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 }, - - 'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 }, - 'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 0 }, - 'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 }, - 'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 }, - 'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 0 }, - - 'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 0 }, - 'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 0 }, - 'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 }, - 'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 }, - 'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 0 }, - } --%} - -{# 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' : '5', - 'LeafRouter_ToRRouter' : '40', - 'SpineRouter_LeafRouter' : '300' - } -%} - -{% macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {% endif %} - {% endif %} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ supported_cable | last }} - {%- endif -%} -{% endmacro %} - -{%- macro find_closest_greater_config(speed, cable) -%} -{%- set new_speed = [] -%} -{%- for std_speed in supported_speed -%} - {%- if std_speed | int >= speed | int -%} - {%- if new_speed.append(std_speed) -%}{%- endif -%} - {% endif -%} -{%- endfor -%} -{%- set new_cable = [] -%} -{%- for std_cable in supported_cable -%} - {% if std_cable | int >= cable | int -%} - {%- if new_cable.append(std_cable) -%}{%- endif -%} - {% endif %} -{%- endfor -%} -{{ new_speed.0 }}_{{ new_cable.0 }} -{%- endmacro -%} - -{% set used_pg_profiles = [] %} -{% for port in PORT %} - {%- if PORT[port].speed -%} - {%- set speed = PORT[port]['speed'] -%} - {% else %} - {%- set speed = supported_speed|last -%} - {%- endif -%} - {%- set cable = cable_length(port) -%} - {%- set port_config = speed|string + '_' + cable -%} - {%- if not port_config in portconfig2profile -%} - {% set port_config = find_closest_greater_config(speed, cable) -%} - {%- endif -%} - {% set profile = portconfig2profile[port_config] -%} - {# add to list profiles which were actually used #} - {%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif %} - { - "BUFFER_PG_TABLE:{{ port }}:{{ pg_range }}": { - "profile" : "[BUFFER_PROFILE_TABLE:{{ profile }}]" - }, - "OP": "SET" - }, -{% endfor -%} - -{# PG profiles declaration #} - -{% for profile_name in used_pg_profiles %} - {%- set profile_config = pg_profiles[profile_name] %} - { - "BUFFER_PROFILE_TABLE:{{ profile_name }}": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", - "xon":"{{ profile_config['xon'] }}", - "xoff":"{{ profile_config['xoff'] }}", - "size":"{{ profile_config['size'] }}", - "dynamic_th":"{{ profile_config['dynamic_th'] }}" - }, - "OP": "SET" - }, -{% endfor %} - { - "BUFFER_PG_TABLE:{{ port_names }}:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]" - }, - "OP": "SET" - }, - { - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - }, - "OP": "SET" - }, - { - "PORT_QOS_MAP_TABLE:{{ port_names }}": { - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]" - }, - "OP": "SET" - } -] diff --git a/dockers/docker-orchagent/ports.json.j2 b/dockers/docker-orchagent/ports.json.j2 index e0438998114d..b10d4d58a43d 100644 --- a/dockers/docker-orchagent/ports.json.j2 +++ b/dockers/docker-orchagent/ports.json.j2 @@ -1,7 +1,12 @@ [ +{% set ports_with_speed_set=[] %} {% if PORT %} {% for port in PORT %} {% if PORT[port].has_key('speed') %} + {%- if ports_with_speed_set.append(port) -%}{%- endif -%} +{%- endif -%} +{% endfor %} +{% for port in ports_with_speed_set %} { "PORT_TABLE:{{ port }}": { "speed": "{{ PORT[port]['speed'] }}", @@ -10,7 +15,6 @@ "OP": "SET" }{% if not loop.last %},{% endif %} -{% endif %} {% endfor %} {% endif %} ] diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index dfdb5b897bbb..80ccac913ff2 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -26,6 +26,8 @@ supervisorctl start vlanmgrd supervisorctl start intfmgrd +supervisorctl start buffermgrd + # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 95e92be622bb..84beaed440a3 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -83,3 +83,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:buffermgrd] +command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 959b6714d274..6dd3486ee3b6 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -37,9 +37,6 @@ elif [ "$HWSKU" == "Force10-S6100" ]; then SWSSCONFIG_ARGS+="th.64ports.buffers.json th.64ports.qos.json " elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [[ "$HWSKU" == "ACS-MSN27"* ]] || [[ "$HWSKU" == "Mellanox-SN2700" ]]; then - sonic-cfggen -d -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json - SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json " fi for file in $SWSSCONFIG_ARGS; do diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 436a7de9071e..a78c07d93b4a 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -112,15 +112,23 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then else # Use default minigraph.xml cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ - HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "DEVICE_METADATA['localhost']['hwsku']"` - if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then - # merge qos configuration into init config file - sonic-cfggen -j /etc/sonic/init_cfg.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/init_cfg.json - mv /tmp/init_cfg.json /etc/sonic/init_cfg.json - fi sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json fi + HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "DEVICE_METADATA['localhost']['hwsku']"` + if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then + # merge qos configuration into init config file + sonic-cfggen -j /etc/sonic/config_db.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json + fi + + if [ -f /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 ]; then + # generate and merge buffers configuration into config file + sonic-cfggen -m -t /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 > /tmp/buffers.json + sonic-cfggen -j /etc/sonic/config_db.json -j /tmp/buffers.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json + fi + if [ -d /host/image-$sonic_version/platform/$platform ]; then dpkg -i /host/image-$sonic_version/platform/$platform/*.deb fi diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index a26c3f475fa6..7599059164cb 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -70,6 +70,8 @@ RUN sed -ri 's/^(save .*$)/# \1/g; COPY ["50-default.conf", "/etc/rsyslog.d/"] COPY ["start.sh", "orchagent.sh", "/usr/bin/"] COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] +COPY ["buffers.json.j2", "/usr/share/sonic/device/vswitch/"] +COPY ["pg_profile_lookup.ini", "/usr/share/sonic/device/vswitch/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/configdb-load.sh", "/usr/bin/"] COPY ["files/arp_update", "/usr/bin"] diff --git a/platform/vs/docker-sonic-vs/buffers.json.j2 b/platform/vs/docker-sonic-vs/buffers.json.j2 new file mode 100644 index 000000000000..da9c764db92b --- /dev/null +++ b/platform/vs/docker-sonic-vs/buffers.json.j2 @@ -0,0 +1,162 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +} diff --git a/platform/vs/docker-sonic-vs/pg_profile_lookup.ini b/platform/vs/docker-sonic-vs/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/platform/vs/docker-sonic-vs/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 876bfd835728..9df6f9f5ad36 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -11,7 +11,9 @@ if [ -f /etc/sonic/config_db.json ]; then sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --print-data > /tmp/config_db.json mv /tmp/config_db.json /etc/sonic/config_db.json else - sonic-cfggen -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + # generate and merge buffers configuration into config file + sonic-cfggen -t /usr/share/sonic/device/vswitch/buffers.json.j2 > /tmp/buffers.json + sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json --print-data > /etc/sonic/config_db.json fi mkdir -p /etc/swss/config.d/ @@ -52,6 +54,8 @@ supervisorctl start vlanmgrd supervisorctl start zebra +supervisorctl start buffermgrd + # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index 2526aefe3a87..fc425142db75 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -122,3 +122,11 @@ autostart=false autorestart=true stdout_logfile=syslog stderr_logfile=syslog + +[program:buffermgrd] +command=/usr/bin/buffermgrd -l /usr/share/sonic/device/vswitch/pg_profile_lookup.ini +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json index a1e8e1486d6d..2a878c95f2c5 100644 --- a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json +++ b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json @@ -1,341 +1,120 @@ -[ - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet8": "300m", + "Ethernet0": "300m", + "Ethernet4": "300m", + "Ethernet108": "300m", + "Ethernet100": "300m", + "Ethernet104": "300m", + "Ethernet68": "300m", + "Ethernet96": "300m", + "Ethernet124": "300m", + "Ethernet92": "300m", + "Ethernet120": "300m", + "Ethernet52": "300m", + "Ethernet56": "300m", + "Ethernet76": "300m", + "Ethernet72": "300m", + "Ethernet64": "300m", + "Ethernet32": "300m", + "Ethernet16": "300m", + "Ethernet36": "300m", + "Ethernet12": "300m", + "Ethernet88": "300m", + "Ethernet116": "300m", + "Ethernet80": "300m", + "Ethernet112": "300m", + "Ethernet84": "300m", + "Ethernet48": "300m", + "Ethernet44": "300m", + "Ethernet40": "300m", + "Ethernet28": "300m", + "Ethernet60": "300m", + "Ethernet20": "300m", + "Ethernet24": "300m" + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { "size": "2097152", "type": "ingress", "mode": "dynamic" }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:ingress_lossy_pool": { + "ingress_lossy_pool": { "size": "5242880", "type": "ingress", "mode": "dynamic" }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossless_pool": { + "egress_lossless_pool": { "size": "16777152", "type": "egress", "mode": "dynamic" }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossy_pool": { + "egress_lossy_pool": { "size": "5242880", "type": "egress", "mode": "dynamic" - }, - "OP": "SET" + } }, - { - "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", "size":"0", "dynamic_th":"0" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", "size":"0", "dynamic_th":"3" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"0", "dynamic_th":"7" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", "size":"4096", "dynamic_th":"3" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:pg_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", "size":"0", "dynamic_th":"3" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"0", "dynamic_th":"7" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", "size":"0", "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_INGRESS_PROFILE_LIST:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_EGRESS_PROFILE_LIST:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]" - }, - "OP": "SET" - }, - - - - { - "BUFFER_PG_TABLE:Ethernet8:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet0:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet4:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet108:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet100:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet104:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet68:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet96:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet124:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet92:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet120:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet52:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet56:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet76:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet72:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet64:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet32:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet16:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet36:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet12:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet88:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet116:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet80:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet112:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet84:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet48:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet44:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet40:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet28:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet60:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet20:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet24:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - - { - "BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", - "xon":"18432", - "xoff":"75776", - "size":"94208", - "dynamic_th":"0" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]" - }, - "OP": "SET" - }, - { - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - }, - "OP": "SET" - }, - { - "PORT_QOS_MAP_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]" - }, - "OP": "SET" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } } -] +} diff --git a/src/sonic-config-engine/tests/sample_output/ports.json b/src/sonic-config-engine/tests/sample_output/ports.json index 216627ef34cd..6536c620f8cf 100644 --- a/src/sonic-config-engine/tests/sample_output/ports.json +++ b/src/sonic-config-engine/tests/sample_output/ports.json @@ -26,5 +26,5 @@ "description": "Interface description" }, "OP": "SET" - }, + } ] diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index ce96ab425c82..5afd1149979f 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -85,7 +85,7 @@ def test_ipinip(self): assert filecmp.cmp(sample_output_file, self.output_file) def test_msn27xx_32ports_buffers(self): - buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'msn27xx.32ports.buffers.json.j2') + buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'device', 'mellanox', 'x86_64-mlnx_msn2700-r0', 'ACS-MSN2700', 'buffers.json.j2') argument = '-m ' + self.t1_mlnx_minigraph + ' -p ' + self.mlnx_port_config + ' -t ' + buffer_file + ' > ' + self.output_file self.run_script(argument) @@ -93,7 +93,6 @@ def test_msn27xx_32ports_buffers(self): self.assertTrue(filecmp.cmp(sample_output_file, self.output_file)) - def tearDown(self): try: os.remove(self.output_file) From 2b91c9681d1022de70d96b1f88d8d7faf34c1fe1 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 26 Jan 2018 10:13:43 -0800 Subject: [PATCH 1054/1833] Revert "Buffers configuration update on port speed change (#1250)" (#1340) This reverts commit 814e50fd5e4d001fbd729fa95aaabe0d395a45fd. --- .../Arista-7050-QX32/buffers.json.j2 | 135 ------ .../Arista-7050-QX32/pg_profile_lookup.ini | 17 - .../Force10-S6000/buffers.json.j2 | 135 ------ .../Force10-S6000/pg_profile_lookup.ini | 17 - .../Force10-S6100/buffers.json.j2 | 126 ------ .../ACS-MSN2700/buffers.json.j2 | 162 -------- .../ACS-MSN2700/pg_profile_lookup.ini | 17 - .../ACS-MSN2740/buffers.json.j2 | 162 -------- .../ACS-MSN2740/pg_profile_lookup.ini | 17 - .../msn27xx.32ports.buffers.json.j2 | 292 +++++++++++++ dockers/docker-orchagent/ports.json.j2 | 6 +- dockers/docker-orchagent/start.sh | 2 - dockers/docker-orchagent/supervisord.conf | 8 - dockers/docker-orchagent/swssconfig.sh | 3 + files/image_config/platform/rc.local | 20 +- platform/vs/docker-sonic-vs/Dockerfile.j2 | 2 - platform/vs/docker-sonic-vs/buffers.json.j2 | 162 -------- .../vs/docker-sonic-vs/pg_profile_lookup.ini | 17 - platform/vs/docker-sonic-vs/start.sh | 6 +- platform/vs/docker-sonic-vs/supervisord.conf | 8 - .../tests/sample_output/msn27.32ports.json | 387 ++++++++++++++---- .../tests/sample_output/ports.json | 2 +- src/sonic-config-engine/tests/test_j2files.py | 3 +- 23 files changed, 610 insertions(+), 1096 deletions(-) delete mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 delete mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini delete mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 delete mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini delete mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 delete mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 delete mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini delete mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 delete mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini create mode 100644 dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 delete mode 100644 platform/vs/docker-sonic-vs/buffers.json.j2 delete mode 100644 platform/vs/docker-sonic-vs/pg_profile_lookup.ini diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 deleted file mode 100644 index 560cae5dd1b4..000000000000 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 +++ /dev/null @@ -1,135 +0,0 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_speed = '100G' %} -{% set default_ports_num = 32 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "7274496", - "type": "ingress", - "mode": "static" - }, - "ingress_lossy_pool": { - "size": "5491712", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool0": { - "size": "3637248", - "type": "egress", - "mode": "static" - }, - "egress_lossless_pool1": { - "size": "3637248", - "type": "egress", - "mode": "static" - }, - "egress_lossy_pool": { - "size": "5491712", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"1518", - "dynamic_th":"3" - }, - "egress_lossless_profile0": { - "pool":"[BUFFER_POOL|egress_lossless_pool0]", - "size":"1518", - "static_th":"3637248" - }, - "egress_lossless_profile1": { - "pool":"[BUFFER_POOL|egress_lossless_pool1]", - "size":"1518", - "static_th":"3637248" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"1518", - "dynamic_th":"3" - } - }, - "BUFFER_PG": { - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" - }, - "{{ port_names }}|4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - } - } -} 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 deleted file mode 100644 index f3a0840558a6..000000000000 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 113664 18432 76800 0 - 25000 5m 113664 18432 76800 0 - 40000 5m 113664 18432 76800 0 - 50000 5m 113664 18432 76800 0 - 100000 5m 113664 18432 76800 0 - 10000 40m 113664 18432 76800 0 - 25000 40m 113664 18432 76800 0 - 40000 40m 113664 18432 76800 0 - 50000 40m 113664 18432 76800 0 - 100000 40m 113664 18432 76800 0 - 10000 300m 113664 18432 76800 0 - 25000 300m 113664 18432 76800 0 - 40000 300m 113664 18432 76800 0 - 50000 300m 113664 18432 76800 0 - 100000 300m 113664 18432 76800 0 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 deleted file mode 100644 index 560cae5dd1b4..000000000000 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 +++ /dev/null @@ -1,135 +0,0 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_speed = '100G' %} -{% set default_ports_num = 32 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "7274496", - "type": "ingress", - "mode": "static" - }, - "ingress_lossy_pool": { - "size": "5491712", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool0": { - "size": "3637248", - "type": "egress", - "mode": "static" - }, - "egress_lossless_pool1": { - "size": "3637248", - "type": "egress", - "mode": "static" - }, - "egress_lossy_pool": { - "size": "5491712", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"1518", - "dynamic_th":"3" - }, - "egress_lossless_profile0": { - "pool":"[BUFFER_POOL|egress_lossless_pool0]", - "size":"1518", - "static_th":"3637248" - }, - "egress_lossless_profile1": { - "pool":"[BUFFER_POOL|egress_lossless_pool1]", - "size":"1518", - "static_th":"3637248" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"1518", - "dynamic_th":"3" - } - }, - "BUFFER_PG": { - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" - }, - "{{ port_names }}|4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - } - } -} 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 deleted file mode 100644 index f3a0840558a6..000000000000 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 113664 18432 76800 0 - 25000 5m 113664 18432 76800 0 - 40000 5m 113664 18432 76800 0 - 50000 5m 113664 18432 76800 0 - 100000 5m 113664 18432 76800 0 - 10000 40m 113664 18432 76800 0 - 25000 40m 113664 18432 76800 0 - 40000 40m 113664 18432 76800 0 - 50000 40m 113664 18432 76800 0 - 100000 40m 113664 18432 76800 0 - 10000 300m 113664 18432 76800 0 - 25000 300m 113664 18432 76800 0 - 40000 300m 113664 18432 76800 0 - 50000 300m 113664 18432 76800 0 - 100000 300m 113664 18432 76800 0 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 deleted file mode 100644 index b12fc3851177..000000000000 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 +++ /dev/null @@ -1,126 +0,0 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_speed = '100G' %} -{% set default_ports_num = 64 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % port_idx) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, - "BUFFER_POOL": { - "ingress_lossless_lossy_pool": { - "size": "10443264", - "type": "ingress", - "mode": "dynamic", - "xoff": "4625920" - }, - "egress_lossy_pool": { - "size": "8877440", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "15982592", - "type": "egress", - "mode": "static" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool": "[BUFFER_POOL|ingress_lossless_lossy_pool]", - "xon": "4096", - "xoff": "58448", - "size": "1248", - "dynamic_th": "-4" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"1518", - "static_th":"3995648" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"1518", - "dynamic_th":"3" - } - }, - "BUFFER_PG": { - "{{ port_names }}:3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" - }, - "{{ port_names }}:0-1": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - } - } -} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 deleted file mode 100644 index da9c764db92b..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 +++ /dev/null @@ -1,162 +0,0 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_ports_num = 32 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, -{%if switch_role == 'ToRRouter' %} -{% set ingress_lossless_pool_size = '4194304' %} -{% set ingress_lossy_pool_size = '7340032' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '7340032' %} -{% else %} -{% set ingress_lossless_pool_size = '2097152' %} -{% set ingress_lossy_pool_size = '5242880' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '5242880' %} -{%endif %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"0" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"4096", - "dynamic_th":"3" - }, - "pg_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "q_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - } - }, - "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - } - }, - "BUFFER_PG": { - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|q_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - } - } -} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini deleted file mode 100644 index b66b129fe43f..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 34816 18432 16384 0 - 25000 5m 34816 18432 16384 0 - 40000 5m 34816 18432 16384 0 - 50000 5m 34816 18432 16384 0 - 100000 5m 36864 18432 18432 0 - 10000 40m 36864 18432 18432 0 - 25000 40m 39936 18432 21504 0 - 40000 40m 41984 18432 23552 0 - 50000 40m 41984 18432 23552 0 - 100000 40m 54272 18432 35840 0 - 10000 300m 49152 18432 30720 0 - 25000 300m 71680 18432 53248 0 - 40000 300m 94208 18432 75776 0 - 50000 300m 94208 18432 75776 0 - 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 deleted file mode 100644 index da9c764db92b..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 +++ /dev/null @@ -1,162 +0,0 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_ports_num = 32 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, -{%if switch_role == 'ToRRouter' %} -{% set ingress_lossless_pool_size = '4194304' %} -{% set ingress_lossy_pool_size = '7340032' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '7340032' %} -{% else %} -{% set ingress_lossless_pool_size = '2097152' %} -{% set ingress_lossy_pool_size = '5242880' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '5242880' %} -{%endif %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"0" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"4096", - "dynamic_th":"3" - }, - "pg_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "q_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - } - }, - "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - } - }, - "BUFFER_PG": { - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|q_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - } - } -} diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini deleted file mode 100644 index b66b129fe43f..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 34816 18432 16384 0 - 25000 5m 34816 18432 16384 0 - 40000 5m 34816 18432 16384 0 - 50000 5m 34816 18432 16384 0 - 100000 5m 36864 18432 18432 0 - 10000 40m 36864 18432 18432 0 - 25000 40m 39936 18432 21504 0 - 40000 40m 41984 18432 23552 0 - 50000 40m 41984 18432 23552 0 - 100000 40m 54272 18432 35840 0 - 10000 300m 49152 18432 30720 0 - 25000 300m 71680 18432 53248 0 - 40000 300m 94208 18432 75776 0 - 50000 300m 94208 18432 75776 0 - 100000 300m 184320 18432 165888 0 diff --git a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 new file mode 100644 index 000000000000..579832ecda11 --- /dev/null +++ b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 @@ -0,0 +1,292 @@ +[ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') %} +{% set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + { + "BUFFER_POOL_TABLE:ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:pg_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:q_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:q_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "OP": "SET" + }, + { + "BUFFER_PORT_INGRESS_PROFILE_LIST:{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PORT_EGRESS_PROFILE_LIST:{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]" + }, + "OP": "SET" + }, + +{# The following template part is for variable PG profile configuration #} +{% set pg_range = '3-4' %} +{# Lists of supported speed and cable length #} +{% set supported_speed = [10000, 25000, 40000, 50000, 100000] %} +{% set supported_cable = [5, 40, 300] %} + +{# The key in this lictionary consist of two parts: (port speed)_(cable length) #} +{%- set portconfig2profile = { + '10000_5' : 'pg_lossless_10G_5m_profile', + '25000_5' : 'pg_lossless_25G_5m_profile', + '40000_5' : 'pg_lossless_40G_5m_profile', + '50000_5' : 'pg_lossless_50G_5m_profile', + '100000_5' : 'pg_lossless_100G_5m_profile', + + '10000_40' : 'pg_lossless_10G_40m_profile', + '25000_40' : 'pg_lossless_25G_40m_profile', + '40000_40' : 'pg_lossless_40G_40m_profile', + '50000_40' : 'pg_lossless_50G_40m_profile', + '100000_40' : 'pg_lossless_100G_40m_profile', + + '10000_300' : 'pg_lossless_10G_300m_profile', + '25000_300' : 'pg_lossless_25G_300m_profile', + '40000_300' : 'pg_lossless_40G_300m_profile', + '50000_300' : 'pg_lossless_50G_300m_profile', + '100000_300': 'pg_lossless_100G_300m_profile' + } +-%} + +{# PG profiles. All profiles reffered in portconfig2profile dictionary should be declared here #} +{# Only those which were actually used will be created in SAI #} +{%- set pg_profiles = { + 'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 }, + + 'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 }, + 'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 0 }, + 'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 }, + 'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 }, + 'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 0 }, + + 'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 0 }, + 'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 0 }, + 'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 }, + 'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 }, + 'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 0 }, + } +-%} + +{# 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' : '5', + 'LeafRouter_ToRRouter' : '40', + 'SpineRouter_LeafRouter' : '300' + } +%} + +{% macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {% endif %} + {% endif %} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ supported_cable | last }} + {%- endif -%} +{% endmacro %} + +{%- macro find_closest_greater_config(speed, cable) -%} +{%- set new_speed = [] -%} +{%- for std_speed in supported_speed -%} + {%- if std_speed | int >= speed | int -%} + {%- if new_speed.append(std_speed) -%}{%- endif -%} + {% endif -%} +{%- endfor -%} +{%- set new_cable = [] -%} +{%- for std_cable in supported_cable -%} + {% if std_cable | int >= cable | int -%} + {%- if new_cable.append(std_cable) -%}{%- endif -%} + {% endif %} +{%- endfor -%} +{{ new_speed.0 }}_{{ new_cable.0 }} +{%- endmacro -%} + +{% set used_pg_profiles = [] %} +{% for port in PORT %} + {%- if PORT[port].speed -%} + {%- set speed = PORT[port]['speed'] -%} + {% else %} + {%- set speed = supported_speed|last -%} + {%- endif -%} + {%- set cable = cable_length(port) -%} + {%- set port_config = speed|string + '_' + cable -%} + {%- if not port_config in portconfig2profile -%} + {% set port_config = find_closest_greater_config(speed, cable) -%} + {%- endif -%} + {% set profile = portconfig2profile[port_config] -%} + {# add to list profiles which were actually used #} + {%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif %} + { + "BUFFER_PG_TABLE:{{ port }}:{{ pg_range }}": { + "profile" : "[BUFFER_PROFILE_TABLE:{{ profile }}]" + }, + "OP": "SET" + }, +{% endfor -%} + +{# PG profiles declaration #} + +{% for profile_name in used_pg_profiles %} + {%- set profile_config = pg_profiles[profile_name] %} + { + "BUFFER_PROFILE_TABLE:{{ profile_name }}": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", + "xon":"{{ profile_config['xon'] }}", + "xoff":"{{ profile_config['xoff'] }}", + "size":"{{ profile_config['size'] }}", + "dynamic_th":"{{ profile_config['dynamic_th'] }}" + }, + "OP": "SET" + }, +{% endfor %} + { + "BUFFER_PG_TABLE:{{ port_names }}:0-1": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { + "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]" + }, + "OP": "SET" + }, + { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + }, + "OP": "SET" + }, + { + "PORT_QOS_MAP_TABLE:{{ port_names }}": { + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]" + }, + "OP": "SET" + } +] diff --git a/dockers/docker-orchagent/ports.json.j2 b/dockers/docker-orchagent/ports.json.j2 index b10d4d58a43d..e0438998114d 100644 --- a/dockers/docker-orchagent/ports.json.j2 +++ b/dockers/docker-orchagent/ports.json.j2 @@ -1,12 +1,7 @@ [ -{% set ports_with_speed_set=[] %} {% if PORT %} {% for port in PORT %} {% if PORT[port].has_key('speed') %} - {%- if ports_with_speed_set.append(port) -%}{%- endif -%} -{%- endif -%} -{% endfor %} -{% for port in ports_with_speed_set %} { "PORT_TABLE:{{ port }}": { "speed": "{{ PORT[port]['speed'] }}", @@ -15,6 +10,7 @@ "OP": "SET" }{% if not loop.last %},{% endif %} +{% endif %} {% endfor %} {% endif %} ] diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 80ccac913ff2..dfdb5b897bbb 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -26,8 +26,6 @@ supervisorctl start vlanmgrd supervisorctl start intfmgrd -supervisorctl start buffermgrd - # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 84beaed440a3..95e92be622bb 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -83,11 +83,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog - -[program:buffermgrd] -command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini -priority=10 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 6dd3486ee3b6..959b6714d274 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -37,6 +37,9 @@ elif [ "$HWSKU" == "Force10-S6100" ]; then SWSSCONFIG_ARGS+="th.64ports.buffers.json th.64ports.qos.json " elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " +elif [[ "$HWSKU" == "ACS-MSN27"* ]] || [[ "$HWSKU" == "Mellanox-SN2700" ]]; then + sonic-cfggen -d -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json + SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json " fi for file in $SWSSCONFIG_ARGS; do diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index a78c07d93b4a..436a7de9071e 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -112,23 +112,15 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then else # Use default minigraph.xml cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ + HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "DEVICE_METADATA['localhost']['hwsku']"` + if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then + # merge qos configuration into init config file + sonic-cfggen -j /etc/sonic/init_cfg.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/init_cfg.json + mv /tmp/init_cfg.json /etc/sonic/init_cfg.json + fi sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json fi - HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "DEVICE_METADATA['localhost']['hwsku']"` - if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then - # merge qos configuration into init config file - sonic-cfggen -j /etc/sonic/config_db.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/config_db.json - mv /tmp/config_db.json /etc/sonic/config_db.json - fi - - if [ -f /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 ]; then - # generate and merge buffers configuration into config file - sonic-cfggen -m -t /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 > /tmp/buffers.json - sonic-cfggen -j /etc/sonic/config_db.json -j /tmp/buffers.json --print-data > /tmp/config_db.json - mv /tmp/config_db.json /etc/sonic/config_db.json - fi - if [ -d /host/image-$sonic_version/platform/$platform ]; then dpkg -i /host/image-$sonic_version/platform/$platform/*.deb fi diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 7599059164cb..a26c3f475fa6 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -70,8 +70,6 @@ RUN sed -ri 's/^(save .*$)/# \1/g; COPY ["50-default.conf", "/etc/rsyslog.d/"] COPY ["start.sh", "orchagent.sh", "/usr/bin/"] COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] -COPY ["buffers.json.j2", "/usr/share/sonic/device/vswitch/"] -COPY ["pg_profile_lookup.ini", "/usr/share/sonic/device/vswitch/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/configdb-load.sh", "/usr/bin/"] COPY ["files/arp_update", "/usr/bin"] diff --git a/platform/vs/docker-sonic-vs/buffers.json.j2 b/platform/vs/docker-sonic-vs/buffers.json.j2 deleted file mode 100644 index da9c764db92b..000000000000 --- a/platform/vs/docker-sonic-vs/buffers.json.j2 +++ /dev/null @@ -1,162 +0,0 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_ports_num = 32 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, -{%if switch_role == 'ToRRouter' %} -{% set ingress_lossless_pool_size = '4194304' %} -{% set ingress_lossy_pool_size = '7340032' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '7340032' %} -{% else %} -{% set ingress_lossless_pool_size = '2097152' %} -{% set ingress_lossy_pool_size = '5242880' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '5242880' %} -{%endif %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"0" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"4096", - "dynamic_th":"3" - }, - "pg_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "q_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - } - }, - "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - } - }, - "BUFFER_PG": { - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|q_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - } - } -} diff --git a/platform/vs/docker-sonic-vs/pg_profile_lookup.ini b/platform/vs/docker-sonic-vs/pg_profile_lookup.ini deleted file mode 100644 index b66b129fe43f..000000000000 --- a/platform/vs/docker-sonic-vs/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 34816 18432 16384 0 - 25000 5m 34816 18432 16384 0 - 40000 5m 34816 18432 16384 0 - 50000 5m 34816 18432 16384 0 - 100000 5m 36864 18432 18432 0 - 10000 40m 36864 18432 18432 0 - 25000 40m 39936 18432 21504 0 - 40000 40m 41984 18432 23552 0 - 50000 40m 41984 18432 23552 0 - 100000 40m 54272 18432 35840 0 - 10000 300m 49152 18432 30720 0 - 25000 300m 71680 18432 53248 0 - 40000 300m 94208 18432 75776 0 - 50000 300m 94208 18432 75776 0 - 100000 300m 184320 18432 165888 0 diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 9df6f9f5ad36..876bfd835728 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -11,9 +11,7 @@ if [ -f /etc/sonic/config_db.json ]; then sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --print-data > /tmp/config_db.json mv /tmp/config_db.json /etc/sonic/config_db.json else - # generate and merge buffers configuration into config file - sonic-cfggen -t /usr/share/sonic/device/vswitch/buffers.json.j2 > /tmp/buffers.json - sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json --print-data > /etc/sonic/config_db.json + sonic-cfggen -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json fi mkdir -p /etc/swss/config.d/ @@ -54,8 +52,6 @@ supervisorctl start vlanmgrd supervisorctl start zebra -supervisorctl start buffermgrd - # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index fc425142db75..2526aefe3a87 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -122,11 +122,3 @@ autostart=false autorestart=true stdout_logfile=syslog stderr_logfile=syslog - -[program:buffermgrd] -command=/usr/bin/buffermgrd -l /usr/share/sonic/device/vswitch/pg_profile_lookup.ini -priority=10 -autostart=false -autorestart=false -stdout_logfile=syslog -stderr_logfile=syslog diff --git a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json index 2a878c95f2c5..a1e8e1486d6d 100644 --- a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json +++ b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json @@ -1,120 +1,341 @@ -{ - "CABLE_LENGTH": { - "AZURE": { - "Ethernet8": "300m", - "Ethernet0": "300m", - "Ethernet4": "300m", - "Ethernet108": "300m", - "Ethernet100": "300m", - "Ethernet104": "300m", - "Ethernet68": "300m", - "Ethernet96": "300m", - "Ethernet124": "300m", - "Ethernet92": "300m", - "Ethernet120": "300m", - "Ethernet52": "300m", - "Ethernet56": "300m", - "Ethernet76": "300m", - "Ethernet72": "300m", - "Ethernet64": "300m", - "Ethernet32": "300m", - "Ethernet16": "300m", - "Ethernet36": "300m", - "Ethernet12": "300m", - "Ethernet88": "300m", - "Ethernet116": "300m", - "Ethernet80": "300m", - "Ethernet112": "300m", - "Ethernet84": "300m", - "Ethernet48": "300m", - "Ethernet44": "300m", - "Ethernet40": "300m", - "Ethernet28": "300m", - "Ethernet60": "300m", - "Ethernet20": "300m", - "Ethernet24": "300m" - } - }, - "BUFFER_POOL": { - "ingress_lossless_pool": { +[ + { + "BUFFER_POOL_TABLE:ingress_lossless_pool": { "size": "2097152", "type": "ingress", "mode": "dynamic" }, - "ingress_lossy_pool": { + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:ingress_lossy_pool": { "size": "5242880", "type": "ingress", "mode": "dynamic" }, - "egress_lossless_pool": { + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:egress_lossless_pool": { "size": "16777152", "type": "egress", "mode": "dynamic" }, - "egress_lossy_pool": { + "OP": "SET" + }, + { + "BUFFER_POOL_TABLE:egress_lossy_pool": { "size": "5242880", "type": "egress", "mode": "dynamic" - } + }, + "OP": "SET" }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", + { + "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", "size":"0", "dynamic_th":"0" }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", "dynamic_th":"3" }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", "size":"0", "dynamic_th":"7" }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"4096", "dynamic_th":"3" }, - "pg_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:pg_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", "dynamic_th":"3" }, - "q_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:q_lossless_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", "size":"0", "dynamic_th":"7" }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:q_lossy_profile": { + "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"0", "dynamic_th":"3" - } - }, - "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - } - }, - "BUFFER_PG": { - "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|0-1": { - "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|3-4": { - "profile" : "[BUFFER_PROFILE|q_lossless_profile]" - }, - "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|0-1": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - } + }, + "OP": "SET" + }, + { + "BUFFER_PORT_INGRESS_PROFILE_LIST:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PORT_EGRESS_PROFILE_LIST:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]" + }, + "OP": "SET" + }, + + + + { + "BUFFER_PG_TABLE:Ethernet8:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet0:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet4:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet108:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet100:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet104:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet68:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet96:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet124:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet92:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet120:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet52:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet56:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet76:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet72:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet64:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet32:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet16:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet36:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet12:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet88:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet116:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet80:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet112:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet84:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet48:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet44:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet40:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet28:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet60:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet20:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet24:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" + }, + "OP": "SET" + }, + + { + "BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile": { + "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", + "xon":"18432", + "xoff":"75776", + "size":"94208", + "dynamic_th":"0" + }, + "OP": "SET" + }, + { + "BUFFER_PG_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:0-1": { + "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_QUEUE_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:3-4": { + "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]" + }, + "OP": "SET" + }, + { + "BUFFER_QUEUE_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:0-1": { + "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]" + }, + "OP": "SET" + }, + { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + }, + "OP": "SET" + }, + { + "PORT_QOS_MAP_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]" + }, + "OP": "SET" } -} +] diff --git a/src/sonic-config-engine/tests/sample_output/ports.json b/src/sonic-config-engine/tests/sample_output/ports.json index 6536c620f8cf..216627ef34cd 100644 --- a/src/sonic-config-engine/tests/sample_output/ports.json +++ b/src/sonic-config-engine/tests/sample_output/ports.json @@ -26,5 +26,5 @@ "description": "Interface description" }, "OP": "SET" - } + }, ] diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 5afd1149979f..ce96ab425c82 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -85,7 +85,7 @@ def test_ipinip(self): assert filecmp.cmp(sample_output_file, self.output_file) def test_msn27xx_32ports_buffers(self): - buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'device', 'mellanox', 'x86_64-mlnx_msn2700-r0', 'ACS-MSN2700', 'buffers.json.j2') + buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'msn27xx.32ports.buffers.json.j2') argument = '-m ' + self.t1_mlnx_minigraph + ' -p ' + self.mlnx_port_config + ' -t ' + buffer_file + ' > ' + self.output_file self.run_script(argument) @@ -93,6 +93,7 @@ def test_msn27xx_32ports_buffers(self): self.assertTrue(filecmp.cmp(sample_output_file, self.output_file)) + def tearDown(self): try: os.remove(self.output_file) From da10ff5aa9c8369d8e705b35c6b0501c91d37fc7 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 26 Jan 2018 20:29:20 -0800 Subject: [PATCH 1055/1833] [minigraph.py] Only add 'service' field to control plane ACLs, not dataplane ACLs (#1341) * [minigraph.py] Only add 'service' field to control plane ACLs, not dataplane ACLs * Modify unit test accordingly --- src/sonic-config-engine/minigraph.py | 5 ++--- src/sonic-config-engine/tests/test_cfggen.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 0dc3085e1294..23d02a363e47 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -202,15 +202,14 @@ def parse_dpg(dpg, hname): if acl_intfs: acls[aclname] = {'policy_desc': aclname, 'ports': acl_intfs, - 'type': 'MIRROR' if is_mirror else 'L3', - 'service': 'N/A'} + 'type': 'MIRROR' if is_mirror else 'L3'} else: # This ACL has no interfaces to attach to -- consider this a control plane ACL aclservice = aclintf.find(str(QName(ns, "Type"))).text acls[aclname] = {'policy_desc': aclname, 'ports': acl_intfs, 'type': 'CTRLPLANE', - 'service': aclservice if aclservice is not None else ''} + 'service': aclservice if aclservice is not None else 'UNKNOWN'} return intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, acls return None, None, None, None, None, None, None diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 768052a1d7e2..2eee6fe331c8 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -73,7 +73,7 @@ def test_render_template(self): def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'service': 'N/A', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + self.assertEqual(output.strip(), "{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") def test_minigraph_everflow(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION' From 58d8302b53a51aec22ed4152ccf27262134bd068 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Mon, 29 Jan 2018 18:11:05 +0200 Subject: [PATCH 1056/1833] Buffers configuration update on port speed change (#1345) * Move buffer configuration to ConfigDB Signed-off-by: Andriy Moroz * Converted Dell and Arista configs Signed-off-by: Andriy Moroz * Add buffer configs for ACS-MSN2740 Signed-off-by: Andriy Moroz * Updated buffers template Signed-off-by: Andriy Moroz * Fixed j2 unit test Signed-off-by: Andriy Moroz * Update buffers config for Force10-S6100 Signed-off-by: Andriy Moroz * Update VS docker to support speed and buffers test Signed-off-by: Andriy Moroz * Update buffers config generation - fixed support of sonic-to-sonic install Signed-off-by: Andriy Moroz * Update submodules pointers for buffers config Signed-off-by: Andriy Moroz --- .../Arista-7050-QX32/buffers.json.j2 | 135 ++++++ .../Arista-7050-QX32/pg_profile_lookup.ini | 17 + .../Force10-S6000/buffers.json.j2 | 135 ++++++ .../Force10-S6000/pg_profile_lookup.ini | 17 + .../Force10-S6100/buffers.json.j2 | 126 ++++++ .../ACS-MSN2700/buffers.json.j2 | 162 ++++++++ .../ACS-MSN2700/pg_profile_lookup.ini | 17 + .../ACS-MSN2740/buffers.json.j2 | 162 ++++++++ .../ACS-MSN2740/pg_profile_lookup.ini | 17 + .../msn27xx.32ports.buffers.json.j2 | 292 ------------- dockers/docker-orchagent/ports.json.j2 | 6 +- dockers/docker-orchagent/start.sh | 2 + dockers/docker-orchagent/supervisord.conf | 8 + dockers/docker-orchagent/swssconfig.sh | 3 - files/image_config/platform/rc.local | 20 +- platform/vs/docker-sonic-vs/Dockerfile.j2 | 2 + platform/vs/docker-sonic-vs/buffers.json.j2 | 162 ++++++++ .../vs/docker-sonic-vs/pg_profile_lookup.ini | 17 + platform/vs/docker-sonic-vs/start.sh | 6 +- platform/vs/docker-sonic-vs/supervisord.conf | 8 + .../tests/sample_output/msn27.32ports.json | 387 ++++-------------- .../tests/sample_output/ports.json | 2 +- src/sonic-config-engine/tests/test_j2files.py | 3 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- src/sonic-utilities | 2 +- 26 files changed, 1099 insertions(+), 613 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini delete mode 100644 dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 create mode 100644 platform/vs/docker-sonic-vs/buffers.json.j2 create mode 100644 platform/vs/docker-sonic-vs/pg_profile_lookup.ini diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 new file mode 100644 index 000000000000..560cae5dd1b4 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/buffers.json.j2 @@ -0,0 +1,135 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "7274496", + "type": "ingress", + "mode": "static" + }, + "ingress_lossy_pool": { + "size": "5491712", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool0": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossless_pool1": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "5491712", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + }, + "egress_lossless_profile0": { + "pool":"[BUFFER_POOL|egress_lossless_pool0]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossless_profile1": { + "pool":"[BUFFER_POOL|egress_lossless_pool1]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" + }, + "{{ port_names }}|4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} 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 new file mode 100644 index 000000000000..f3a0840558a6 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 113664 18432 76800 0 + 25000 5m 113664 18432 76800 0 + 40000 5m 113664 18432 76800 0 + 50000 5m 113664 18432 76800 0 + 100000 5m 113664 18432 76800 0 + 10000 40m 113664 18432 76800 0 + 25000 40m 113664 18432 76800 0 + 40000 40m 113664 18432 76800 0 + 50000 40m 113664 18432 76800 0 + 100000 40m 113664 18432 76800 0 + 10000 300m 113664 18432 76800 0 + 25000 300m 113664 18432 76800 0 + 40000 300m 113664 18432 76800 0 + 50000 300m 113664 18432 76800 0 + 100000 300m 113664 18432 76800 0 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 new file mode 100644 index 000000000000..560cae5dd1b4 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers.json.j2 @@ -0,0 +1,135 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "7274496", + "type": "ingress", + "mode": "static" + }, + "ingress_lossy_pool": { + "size": "5491712", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool0": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossless_pool1": { + "size": "3637248", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "5491712", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + }, + "egress_lossless_profile0": { + "pool":"[BUFFER_POOL|egress_lossless_pool0]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossless_profile1": { + "pool":"[BUFFER_POOL|egress_lossless_pool1]", + "size":"1518", + "static_th":"3637248" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile0]" + }, + "{{ port_names }}|4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile1]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} 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 new file mode 100644 index 000000000000..f3a0840558a6 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 113664 18432 76800 0 + 25000 5m 113664 18432 76800 0 + 40000 5m 113664 18432 76800 0 + 50000 5m 113664 18432 76800 0 + 100000 5m 113664 18432 76800 0 + 10000 40m 113664 18432 76800 0 + 25000 40m 113664 18432 76800 0 + 40000 40m 113664 18432 76800 0 + 50000 40m 113664 18432 76800 0 + 100000 40m 113664 18432 76800 0 + 10000 300m 113664 18432 76800 0 + 25000 300m 113664 18432 76800 0 + 40000 300m 113664 18432 76800 0 + 50000 300m 113664 18432 76800 0 + 100000 300m 113664 18432 76800 0 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 new file mode 100644 index 000000000000..b12fc3851177 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 @@ -0,0 +1,126 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 64 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % port_idx) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_lossy_pool": { + "size": "10443264", + "type": "ingress", + "mode": "dynamic", + "xoff": "4625920" + }, + "egress_lossy_pool": { + "size": "8877440", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982592", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool": "[BUFFER_POOL|ingress_lossless_lossy_pool]", + "xon": "4096", + "xoff": "58448", + "size": "1248", + "dynamic_th": "-4" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995648" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}:3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}:0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 new file mode 100644 index 000000000000..da9c764db92b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 @@ -0,0 +1,162 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 new file mode 100644 index 000000000000..da9c764db92b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers.json.j2 @@ -0,0 +1,162 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 deleted file mode 100644 index 579832ecda11..000000000000 --- a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 +++ /dev/null @@ -1,292 +0,0 @@ -[ -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') %} -{% set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%if switch_role == 'ToRRouter' %} -{% set ingress_lossless_pool_size = '4194304' %} -{% set ingress_lossy_pool_size = '7340032' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '7340032' %} -{% else %} -{% set ingress_lossless_pool_size = '2097152' %} -{% set ingress_lossy_pool_size = '5242880' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '5242880' %} -{%endif %} - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", - "size":"0", - "dynamic_th":"0" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", - "size":"4096", - "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:pg_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_INGRESS_PROFILE_LIST:{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_EGRESS_PROFILE_LIST:{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]" - }, - "OP": "SET" - }, - -{# The following template part is for variable PG profile configuration #} -{% set pg_range = '3-4' %} -{# Lists of supported speed and cable length #} -{% set supported_speed = [10000, 25000, 40000, 50000, 100000] %} -{% set supported_cable = [5, 40, 300] %} - -{# The key in this lictionary consist of two parts: (port speed)_(cable length) #} -{%- set portconfig2profile = { - '10000_5' : 'pg_lossless_10G_5m_profile', - '25000_5' : 'pg_lossless_25G_5m_profile', - '40000_5' : 'pg_lossless_40G_5m_profile', - '50000_5' : 'pg_lossless_50G_5m_profile', - '100000_5' : 'pg_lossless_100G_5m_profile', - - '10000_40' : 'pg_lossless_10G_40m_profile', - '25000_40' : 'pg_lossless_25G_40m_profile', - '40000_40' : 'pg_lossless_40G_40m_profile', - '50000_40' : 'pg_lossless_50G_40m_profile', - '100000_40' : 'pg_lossless_100G_40m_profile', - - '10000_300' : 'pg_lossless_10G_300m_profile', - '25000_300' : 'pg_lossless_25G_300m_profile', - '40000_300' : 'pg_lossless_40G_300m_profile', - '50000_300' : 'pg_lossless_50G_300m_profile', - '100000_300': 'pg_lossless_100G_300m_profile' - } --%} - -{# PG profiles. All profiles reffered in portconfig2profile dictionary should be declared here #} -{# Only those which were actually used will be created in SAI #} -{%- set pg_profiles = { - 'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, - 'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, - 'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, - 'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, - 'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 }, - - 'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 }, - 'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 0 }, - 'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 }, - 'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 }, - 'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 0 }, - - 'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 0 }, - 'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 0 }, - 'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 }, - 'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 }, - 'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 0 }, - } --%} - -{# 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' : '5', - 'LeafRouter_ToRRouter' : '40', - 'SpineRouter_LeafRouter' : '300' - } -%} - -{% macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {% endif %} - {% endif %} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ supported_cable | last }} - {%- endif -%} -{% endmacro %} - -{%- macro find_closest_greater_config(speed, cable) -%} -{%- set new_speed = [] -%} -{%- for std_speed in supported_speed -%} - {%- if std_speed | int >= speed | int -%} - {%- if new_speed.append(std_speed) -%}{%- endif -%} - {% endif -%} -{%- endfor -%} -{%- set new_cable = [] -%} -{%- for std_cable in supported_cable -%} - {% if std_cable | int >= cable | int -%} - {%- if new_cable.append(std_cable) -%}{%- endif -%} - {% endif %} -{%- endfor -%} -{{ new_speed.0 }}_{{ new_cable.0 }} -{%- endmacro -%} - -{% set used_pg_profiles = [] %} -{% for port in PORT %} - {%- if PORT[port].speed -%} - {%- set speed = PORT[port]['speed'] -%} - {% else %} - {%- set speed = supported_speed|last -%} - {%- endif -%} - {%- set cable = cable_length(port) -%} - {%- set port_config = speed|string + '_' + cable -%} - {%- if not port_config in portconfig2profile -%} - {% set port_config = find_closest_greater_config(speed, cable) -%} - {%- endif -%} - {% set profile = portconfig2profile[port_config] -%} - {# add to list profiles which were actually used #} - {%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif %} - { - "BUFFER_PG_TABLE:{{ port }}:{{ pg_range }}": { - "profile" : "[BUFFER_PROFILE_TABLE:{{ profile }}]" - }, - "OP": "SET" - }, -{% endfor -%} - -{# PG profiles declaration #} - -{% for profile_name in used_pg_profiles %} - {%- set profile_config = pg_profiles[profile_name] %} - { - "BUFFER_PROFILE_TABLE:{{ profile_name }}": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", - "xon":"{{ profile_config['xon'] }}", - "xoff":"{{ profile_config['xoff'] }}", - "size":"{{ profile_config['size'] }}", - "dynamic_th":"{{ profile_config['dynamic_th'] }}" - }, - "OP": "SET" - }, -{% endfor %} - { - "BUFFER_PG_TABLE:{{ port_names }}:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]" - }, - "OP": "SET" - }, - { - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - }, - "OP": "SET" - }, - { - "PORT_QOS_MAP_TABLE:{{ port_names }}": { - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]" - }, - "OP": "SET" - } -] diff --git a/dockers/docker-orchagent/ports.json.j2 b/dockers/docker-orchagent/ports.json.j2 index e0438998114d..b10d4d58a43d 100644 --- a/dockers/docker-orchagent/ports.json.j2 +++ b/dockers/docker-orchagent/ports.json.j2 @@ -1,7 +1,12 @@ [ +{% set ports_with_speed_set=[] %} {% if PORT %} {% for port in PORT %} {% if PORT[port].has_key('speed') %} + {%- if ports_with_speed_set.append(port) -%}{%- endif -%} +{%- endif -%} +{% endfor %} +{% for port in ports_with_speed_set %} { "PORT_TABLE:{{ port }}": { "speed": "{{ PORT[port]['speed'] }}", @@ -10,7 +15,6 @@ "OP": "SET" }{% if not loop.last %},{% endif %} -{% endif %} {% endfor %} {% endif %} ] diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index dfdb5b897bbb..80ccac913ff2 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -26,6 +26,8 @@ supervisorctl start vlanmgrd supervisorctl start intfmgrd +supervisorctl start buffermgrd + # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 95e92be622bb..84beaed440a3 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -83,3 +83,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:buffermgrd] +command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 959b6714d274..6dd3486ee3b6 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -37,9 +37,6 @@ elif [ "$HWSKU" == "Force10-S6100" ]; then SWSSCONFIG_ARGS+="th.64ports.buffers.json th.64ports.qos.json " elif [ "$HWSKU" == "Arista-7050-QX32" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " -elif [[ "$HWSKU" == "ACS-MSN27"* ]] || [[ "$HWSKU" == "Mellanox-SN2700" ]]; then - sonic-cfggen -d -t /usr/share/sonic/templates/msn27xx.32ports.buffers.json.j2 > /etc/swss/config.d/msn27xx.32ports.buffers.json - SWSSCONFIG_ARGS+="msn27xx.32ports.buffers.json " fi for file in $SWSSCONFIG_ARGS; do diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 436a7de9071e..a78c07d93b4a 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -112,15 +112,23 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then else # Use default minigraph.xml cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ - HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "DEVICE_METADATA['localhost']['hwsku']"` - if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then - # merge qos configuration into init config file - sonic-cfggen -j /etc/sonic/init_cfg.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/init_cfg.json - mv /tmp/init_cfg.json /etc/sonic/init_cfg.json - fi sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json fi + HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "DEVICE_METADATA['localhost']['hwsku']"` + if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then + # merge qos configuration into init config file + sonic-cfggen -j /etc/sonic/config_db.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json + fi + + if [ -f /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 ]; then + # generate and merge buffers configuration into config file + sonic-cfggen -m -t /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 > /tmp/buffers.json + sonic-cfggen -j /etc/sonic/config_db.json -j /tmp/buffers.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json + fi + if [ -d /host/image-$sonic_version/platform/$platform ]; then dpkg -i /host/image-$sonic_version/platform/$platform/*.deb fi diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index a26c3f475fa6..7599059164cb 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -70,6 +70,8 @@ RUN sed -ri 's/^(save .*$)/# \1/g; COPY ["50-default.conf", "/etc/rsyslog.d/"] COPY ["start.sh", "orchagent.sh", "/usr/bin/"] COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] +COPY ["buffers.json.j2", "/usr/share/sonic/device/vswitch/"] +COPY ["pg_profile_lookup.ini", "/usr/share/sonic/device/vswitch/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/configdb-load.sh", "/usr/bin/"] COPY ["files/arp_update", "/usr/bin"] diff --git a/platform/vs/docker-sonic-vs/buffers.json.j2 b/platform/vs/docker-sonic-vs/buffers.json.j2 new file mode 100644 index 000000000000..da9c764db92b --- /dev/null +++ b/platform/vs/docker-sonic-vs/buffers.json.j2 @@ -0,0 +1,162 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + }, + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "{{ port_names }}": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +} diff --git a/platform/vs/docker-sonic-vs/pg_profile_lookup.ini b/platform/vs/docker-sonic-vs/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/platform/vs/docker-sonic-vs/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 876bfd835728..9df6f9f5ad36 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -11,7 +11,9 @@ if [ -f /etc/sonic/config_db.json ]; then sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --print-data > /tmp/config_db.json mv /tmp/config_db.json /etc/sonic/config_db.json else - sonic-cfggen -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json + # generate and merge buffers configuration into config file + sonic-cfggen -t /usr/share/sonic/device/vswitch/buffers.json.j2 > /tmp/buffers.json + sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json --print-data > /etc/sonic/config_db.json fi mkdir -p /etc/swss/config.d/ @@ -52,6 +54,8 @@ supervisorctl start vlanmgrd supervisorctl start zebra +supervisorctl start buffermgrd + # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index 2526aefe3a87..fc425142db75 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -122,3 +122,11 @@ autostart=false autorestart=true stdout_logfile=syslog stderr_logfile=syslog + +[program:buffermgrd] +command=/usr/bin/buffermgrd -l /usr/share/sonic/device/vswitch/pg_profile_lookup.ini +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json index a1e8e1486d6d..2a878c95f2c5 100644 --- a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json +++ b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json @@ -1,341 +1,120 @@ -[ - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet8": "300m", + "Ethernet0": "300m", + "Ethernet4": "300m", + "Ethernet108": "300m", + "Ethernet100": "300m", + "Ethernet104": "300m", + "Ethernet68": "300m", + "Ethernet96": "300m", + "Ethernet124": "300m", + "Ethernet92": "300m", + "Ethernet120": "300m", + "Ethernet52": "300m", + "Ethernet56": "300m", + "Ethernet76": "300m", + "Ethernet72": "300m", + "Ethernet64": "300m", + "Ethernet32": "300m", + "Ethernet16": "300m", + "Ethernet36": "300m", + "Ethernet12": "300m", + "Ethernet88": "300m", + "Ethernet116": "300m", + "Ethernet80": "300m", + "Ethernet112": "300m", + "Ethernet84": "300m", + "Ethernet48": "300m", + "Ethernet44": "300m", + "Ethernet40": "300m", + "Ethernet28": "300m", + "Ethernet60": "300m", + "Ethernet20": "300m", + "Ethernet24": "300m" + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { "size": "2097152", "type": "ingress", "mode": "dynamic" }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:ingress_lossy_pool": { + "ingress_lossy_pool": { "size": "5242880", "type": "ingress", "mode": "dynamic" }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossless_pool": { + "egress_lossless_pool": { "size": "16777152", "type": "egress", "mode": "dynamic" }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:egress_lossy_pool": { + "egress_lossy_pool": { "size": "5242880", "type": "egress", "mode": "dynamic" - }, - "OP": "SET" + } }, - { - "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", "size":"0", "dynamic_th":"0" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", "size":"0", "dynamic_th":"3" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"0", "dynamic_th":"7" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:egress_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", "size":"4096", "dynamic_th":"3" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:pg_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", + "pg_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", "size":"0", "dynamic_th":"3" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossless_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossless_pool]", + "q_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", "size":"0", "dynamic_th":"7" }, - "OP": "SET" - }, - { - "BUFFER_PROFILE_TABLE:q_lossy_profile": { - "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", "size":"0", "dynamic_th":"3" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_INGRESS_PROFILE_LIST:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "profile_list" : "[BUFFER_PROFILE_TABLE:ingress_lossless_profile],[BUFFER_PROFILE_TABLE:ingress_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PORT_EGRESS_PROFILE_LIST:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "profile_list" : "[BUFFER_PROFILE_TABLE:egress_lossless_profile],[BUFFER_PROFILE_TABLE:egress_lossy_profile]" - }, - "OP": "SET" - }, - - - - { - "BUFFER_PG_TABLE:Ethernet8:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet0:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet4:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet108:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet100:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet104:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet68:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet96:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet124:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet92:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet120:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet52:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet56:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet76:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet72:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet64:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet32:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet16:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet36:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet12:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet88:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet116:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet80:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet112:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet84:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet48:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet44:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet40:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet28:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet60:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet20:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet24:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile]" - }, - "OP": "SET" - }, - - { - "BUFFER_PROFILE_TABLE:pg_lossless_40G_300m_profile": { - "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", - "xon":"18432", - "xoff":"75776", - "size":"94208", - "dynamic_th":"0" - }, - "OP": "SET" - }, - { - "BUFFER_PG_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:3-4": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossless_profile]" - }, - "OP": "SET" - }, - { - "BUFFER_QUEUE_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24:0-1": { - "profile" : "[BUFFER_PROFILE_TABLE:q_lossy_profile]" - }, - "OP": "SET" - }, - { - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - }, - "OP": "SET" - }, - { - "PORT_QOS_MAP_TABLE:Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]" - }, - "OP": "SET" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24": { + "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" + } + }, + "BUFFER_PG": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|0-1": { + "profile" : "[BUFFER_PROFILE|pg_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|3-4": { + "profile" : "[BUFFER_PROFILE|q_lossless_profile]" + }, + "Ethernet8,Ethernet0,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet68,Ethernet96,Ethernet124,Ethernet92,Ethernet120,Ethernet52,Ethernet56,Ethernet76,Ethernet72,Ethernet64,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet88,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet48,Ethernet44,Ethernet40,Ethernet28,Ethernet60,Ethernet20,Ethernet24|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } } -] +} diff --git a/src/sonic-config-engine/tests/sample_output/ports.json b/src/sonic-config-engine/tests/sample_output/ports.json index 216627ef34cd..6536c620f8cf 100644 --- a/src/sonic-config-engine/tests/sample_output/ports.json +++ b/src/sonic-config-engine/tests/sample_output/ports.json @@ -26,5 +26,5 @@ "description": "Interface description" }, "OP": "SET" - }, + } ] diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index ce96ab425c82..5afd1149979f 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -85,7 +85,7 @@ def test_ipinip(self): assert filecmp.cmp(sample_output_file, self.output_file) def test_msn27xx_32ports_buffers(self): - buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'msn27xx.32ports.buffers.json.j2') + buffer_file = os.path.join(self.test_dir, '..', '..', '..', 'device', 'mellanox', 'x86_64-mlnx_msn2700-r0', 'ACS-MSN2700', 'buffers.json.j2') argument = '-m ' + self.t1_mlnx_minigraph + ' -p ' + self.mlnx_port_config + ' -t ' + buffer_file + ' > ' + self.output_file self.run_script(argument) @@ -93,7 +93,6 @@ def test_msn27xx_32ports_buffers(self): self.assertTrue(filecmp.cmp(sample_output_file, self.output_file)) - def tearDown(self): try: os.remove(self.output_file) diff --git a/src/sonic-swss b/src/sonic-swss index fbe781de8219..60a90d762876 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit fbe781de82197304d6622736271649d4ac10de67 +Subproject commit 60a90d762876955116f6f4a0ec47b2ca2c6f57ed diff --git a/src/sonic-swss-common b/src/sonic-swss-common index aa55f69a9b53..04b8b84ab6d6 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit aa55f69a9b53588d1de872f2d6f15384659f1a36 +Subproject commit 04b8b84ab6d66c97d7d727ac80a431b7ba85cf57 diff --git a/src/sonic-utilities b/src/sonic-utilities index 26c3709786a4..17e0bf9be5f1 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 26c3709786a4072625d7f3ebb9f2e52d798a3ba0 +Subproject commit 17e0bf9be5f16ba301f30d3354e7554b49fd61e5 From 43554c8b1a98f8c5747a823d4ac30e258a87d224 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 29 Jan 2018 18:14:01 +0200 Subject: [PATCH 1057/1833] [slave.mk]: Clear deb_dist directory (#1344) Python packages, having their version changed, will fail to build because deb_dist directory contains both build directories for old and new version, and (for some uncleaer reason) debian utilities don't know which one to choose. Signed-off-by: marian-pritsak --- slave.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/slave.mk b/slave.mk index 4309d882a5d1..477fd2531611 100644 --- a/slave.mk +++ b/slave.mk @@ -235,6 +235,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platf if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi # Build project pushd $($*_SRC_PATH) $(LOG) + rm -rf deb_dist/* $(LOG) python setup.py --command-packages=stdeb.command bdist_deb $(LOG) popd $(LOG) # Clean up From a8a4c7b9aef5cdaf26ce89b678ae12ddc5862a34 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 29 Jan 2018 10:08:10 -0800 Subject: [PATCH 1058/1833] [device]: Remove unused qos.json files (#1315) --- .../Arista-7050-QX32/qos.json | 156 ------------------ .../Force10-S6000/qos.json | 156 ------------------ .../Force10-S6100/qos.json | 156 ------------------ 3 files changed, 468 deletions(-) delete mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json delete mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json delete mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json deleted file mode 100644 index 2539513d8e1f..000000000000 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP:AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP:AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE:AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json deleted file mode 100644 index 2539513d8e1f..000000000000 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP:AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP:AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE:AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json deleted file mode 100644 index 32f337770c0f..000000000000 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP:AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP:AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE:AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63:0-1" : { - "wred_profile" : "[WRED_PROFILE:AZURE]" - }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63:3-4" : { - "scheduler" : "[SCHEDULER:scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63:0" : { - "scheduler" : "[SCHEDULER:scheduler.1]" - }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63:1" : { - "scheduler" : "[SCHEDULER:scheduler.2]" - } - } -} From bdbf956dec9acb6612a8e856b21e7aaca76e018d Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 29 Jan 2018 11:08:32 -0800 Subject: [PATCH 1059/1833] [sonic-utilities] Update submodule (#1346) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 17e0bf9be5f1..71c696eaf7dd 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 17e0bf9be5f16ba301f30d3354e7554b49fd61e5 +Subproject commit 71c696eaf7dd0f974f64b69463dac4653db74cb8 From 1d0a57a465e70c36162a10ccfc642741b7dfadc2 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 29 Jan 2018 11:21:30 -0800 Subject: [PATCH 1060/1833] [dell]: add psuutil support for s6000 (#1342) also remove w83627dhg as it raises false alarm. --- .../plugins/psuutil.py | 74 +++++++++++++++++++ .../x86_64-dell_s6000_s1220-r0/sensors.conf | 21 ------ .../broadcom/sonic-platform-modules-s6000 | 2 +- 3 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/plugins/psuutil.py diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/psuutil.py b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/psuutil.py new file mode 100644 index 000000000000..537605f3975b --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/psuutil.py @@ -0,0 +1,74 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + def get_cpld_register(self, reg_name): + cpld_dir = "/sys/devices/platform/dell-s6000-cpld.0" + retval = 'ERR' + reg_file = cpld_dir +'/' + reg_name + if (not os.path.isfile(reg_file)): + return retval + + try: + with open(reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", reg_file, "file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + S6000_MAX_PSUS = 2 + return S6000_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + psu_status = self.get_cpld_register('psu'+str(index - 1)+'_status') + if (psu_status != 'ERR'): + status = int(psu_status, 10) + + presence = self.get_psu_presence(index) + + return (status & presence) + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_presence = self.get_cpld_register('psu'+str(index - 1)+'_prs') + if (psu_presence != 'ERR'): + status = int(psu_presence, 10) + + return status diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf b/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf index 2208bb6340d1..c87af11afacc 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf +++ b/device/dell/x86_64-dell_s6000_s1220-r0/sensors.conf @@ -27,27 +27,6 @@ chip "max6620-i2c-*-2a" ignore fan3 ignore fan4 -chip "w83627dhg-*" - label in0 "VCore 1" - label in1 "VCore 2" - set in0_min 0 - set in0_max 1.74 - set in1_min 0 - set in1_max 1.74 - ignore fan1 - ignore fan2 - ignore fan3 - ignore fan4 - ignore fan5 - ignore in4 - ignore in5 - ignore in6 - ignore temp1 - ignore temp2 - ignore temp3 - ignore cpu0_vid - ignore intrusion0 - chip "jc42-*" set temp1_max 50 set temp1_crit 85 diff --git a/platform/broadcom/sonic-platform-modules-s6000 b/platform/broadcom/sonic-platform-modules-s6000 index 1f6c70e7db89..952208ce52d8 160000 --- a/platform/broadcom/sonic-platform-modules-s6000 +++ b/platform/broadcom/sonic-platform-modules-s6000 @@ -1 +1 @@ -Subproject commit 1f6c70e7db890851510a36892b602c534e4f41a7 +Subproject commit 952208ce52d88095da9591cc548d1e013f363476 From 474b3f08e7bd20efdb5d4a7fe3fc47d45c25b37a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 29 Jan 2018 16:26:54 -0800 Subject: [PATCH 1061/1833] [dhcp_relay] make dhcp_relay service depends on teamd as well (#1348) When teamd service restarted, the port channels will be recreated. Dhcp relay service needs to be restarted after that to listen on the right port channels. --- files/build_templates/dhcp_relay.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index c1499c8f8797..ff43a3c2d024 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -1,6 +1,6 @@ [Unit] Description=DHCP relay container -Requires=docker.service +Requires=docker.service teamd.service After=swss.service [Service] From 26efb653fc884c4bb79de8e811c354e19280f0d0 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 29 Jan 2018 18:08:10 -0800 Subject: [PATCH 1062/1833] [snmpagent]: update sonic-snmpagent submodule (#1350) Signed-off-by: Qi Luo --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index d60afe1810e1..9a7a70ca2a50 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit d60afe1810e1bd6ed7b68718b905f8bfe4ac39c4 +Subproject commit 9a7a70ca2a50907f30181209f666fc685973d592 From 91effa249c5d4b1ce048bdf9c129efb5dafb3d5a Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Tue, 30 Jan 2018 09:13:23 -0800 Subject: [PATCH 1063/1833] Submodule update (#1351) --- src/sonic-py-swsssdk | 2 +- src/sonic-snmpagent | 2 +- src/sonic-utilities | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index cd4cb2784a9c..93010e14c89e 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit cd4cb2784a9ccbb77d60575e2e2befa7a9cbe925 +Subproject commit 93010e14c89e62b35553f1b5cf59af0c564d3055 diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 9a7a70ca2a50..12bc0e0c9843 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 9a7a70ca2a50907f30181209f666fc685973d592 +Subproject commit 12bc0e0c98432eb21add3b547e13bcf10e77ab51 diff --git a/src/sonic-utilities b/src/sonic-utilities index 71c696eaf7dd..ce9a36e7d459 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 71c696eaf7dd0f974f64b69463dac4653db74cb8 +Subproject commit ce9a36e7d459025bc0d39d744c078f60989f3556 From 8cf03b0b2846d63c1fcd30cc04ea93c446695a61 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 30 Jan 2018 11:19:03 -0800 Subject: [PATCH 1064/1833] [sonic-cfggen] Enhance ACL unit test to also test control plane (service) ACLs (#1349) --- .../tests/pc-test-graph.xml | 10 +++- .../tests/simple-sample-graph.xml | 10 +++- .../tests/t0-sample-acl.json | 57 +++++++++++++++++++ .../tests/t0-sample-bgp-speaker.xml | 10 +++- .../tests/t0-sample-graph.xml | 10 +++- src/sonic-config-engine/tests/test_cfggen.py | 3 +- 6 files changed, 87 insertions(+), 13 deletions(-) diff --git a/src/sonic-config-engine/tests/pc-test-graph.xml b/src/sonic-config-engine/tests/pc-test-graph.xml index 2cb281b879cb..6709d65c4969 100644 --- a/src/sonic-config-engine/tests/pc-test-graph.xml +++ b/src/sonic-config-engine/tests/pc-test-graph.xml @@ -134,10 +134,14 @@ - - PortChannel01;PortChannel02;PortChannel03;PortChannel04 - + PortChannel01;PortChannel02;PortChannel03;PortChannel04 DataAcl + DataPlane + + + SNMP + SNMP_ACL + SNMP diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index d3bc25272282..4062cd7ae0c8 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -166,10 +166,14 @@ - - PortChannel01 - + PortChannel01 DataAcl + DataPlane + + + SNMP + SNMP_ACL + SNMP diff --git a/src/sonic-config-engine/tests/t0-sample-acl.json b/src/sonic-config-engine/tests/t0-sample-acl.json index 4157a1701b60..1caf2ff02959 100644 --- a/src/sonic-config-engine/tests/t0-sample-acl.json +++ b/src/sonic-config-engine/tests/t0-sample-acl.json @@ -112,6 +112,63 @@ "config": { "name": "everflow" } + }, + "SNMP-ACL": { + "acl-entries": { + "acl-entry": { + "1": { + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "config": { + "sequence-id": 1 + }, + "ip": { + "config": { + "protocol": "IP_UDP", + "source-ip-address": "10.0.0.0/8" + } + } + }, + "2": { + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "config": { + "sequence-id": 2 + }, + "ip": { + "config": { + "protocol": "IP_UDP", + "source-ip-address": "100.64.0.0/10" + } + } + }, + "3": { + "actions": { + "config": { + "forwarding-action": "ACCEPT" + } + }, + "config": { + "sequence-id": 3 + }, + "ip": { + "config": { + "protocol": "IP_UDP", + "source-ip-address": "25.0.0.0/8" + } + } + } + } + }, + "config": { + "name": "SNMP-ACL" + } } } } diff --git a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml index 18a8baccdae2..f2690985d9f3 100644 --- a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml +++ b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml @@ -259,10 +259,14 @@ - - PortChannel01;PortChannel02;PortChannel03;PortChannel04 - + PortChannel01;PortChannel02;PortChannel03;PortChannel04 DataAcl + DataPlane + + + SNMP + SNMP_ACL + SNMP diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index fe0b1a1e2500..f3d05cbc22c1 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -262,10 +262,14 @@ - - PortChannel01;PortChannel02;PortChannel03;PortChannel04 - + PortChannel01;PortChannel02;PortChannel03;PortChannel04 DataAcl + DataPlane + + + SNMP + SNMP_ACL + SNMP diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 2eee6fe331c8..9c9b31abf203 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -73,7 +73,8 @@ def test_render_template(self): def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + self.assertEqual(output.strip(), "{'SNMP_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL', 'service': 'SNMP', 'ports': []}," + " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") def test_minigraph_everflow(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION' From 175bae84b9e733796c0a2a5849fbd689548f7226 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 30 Jan 2018 11:54:58 -0800 Subject: [PATCH 1065/1833] Remove /var/run/rsyslogd.pid otherwise rsyslogd will not start in database container (#1355) --- dockers/docker-database/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-database/supervisord.conf b/dockers/docker-database/supervisord.conf index 8237ea876790..f095e78bc144 100644 --- a/dockers/docker-database/supervisord.conf +++ b/dockers/docker-database/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [program:rsyslogd] -command=/usr/sbin/rsyslogd -n +command=/bin/bash -c "rm -f /var/run/rsyslogd.pid && /usr/sbin/rsyslogd -n" priority=1 autostart=true autorestart=false From a36527a6a57d6f72207a19962208812adc4e9864 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 30 Jan 2018 15:04:52 -0800 Subject: [PATCH 1066/1833] Store ConfigDB init indicator boolean value as 1/0 in Redis to be language-agnostic (#1352) --- files/scripts/configdb-load.sh | 3 +-- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/files/scripts/configdb-load.sh b/files/scripts/configdb-load.sh index 42bb9959bca8..5ba2e0e0bc7f 100755 --- a/files/scripts/configdb-load.sh +++ b/files/scripts/configdb-load.sh @@ -10,5 +10,4 @@ if [ -r /etc/sonic/config_db.json ]; then sonic-cfggen -j /etc/sonic/config_db.json --write-to-db fi -echo -en "SELECT 4\nSET CONFIG_DB_INITIALIZED true" | redis-cli - +redis-cli -n 4 SET "CONFIG_DB_INITIALIZED" "1" diff --git a/src/sonic-utilities b/src/sonic-utilities index ce9a36e7d459..fe6d04328e5a 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ce9a36e7d459025bc0d39d744c078f60989f3556 +Subproject commit fe6d04328e5a1c4fdba4b35821f2d66475a9f3b0 From 673c82f9a361fbf49d129c2069c1a75c7f30a36c Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 30 Jan 2018 17:30:38 -0800 Subject: [PATCH 1067/1833] [dhcp_relay] complete the dhcp_relay service dependency towards teamd (#1356) This change makes sure that the dhcp_relay service will be started after teamd service is started from a stopped state. --- files/build_templates/dhcp_relay.service.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index ff43a3c2d024..966e2782abe0 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=DHCP relay container Requires=docker.service teamd.service -After=swss.service +After=swss.service teamd.service [Service] User={{ sonicadmin_user }} @@ -10,4 +10,4 @@ ExecStart=/usr/bin/{{ docker_container_name }}.sh attach ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target teamd.service From 653f572f9c3580870dad237c0a80387138c89c3f Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Thu, 1 Feb 2018 00:58:02 +0800 Subject: [PATCH 1068/1833] [submodules]: update the pointers to pick up clear fdb cli support (#1354) --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 36752e19ae8f..a6b5be886bb4 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 36752e19ae8f2709bd5d510d6e66ece73c16b71b +Subproject commit a6b5be886bb470d8ff1baf2978bbdf1a9e8cf5e0 diff --git a/src/sonic-swss b/src/sonic-swss index 60a90d762876..918cf5ad6aec 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 60a90d762876955116f6f4a0ec47b2ca2c6f57ed +Subproject commit 918cf5ad6aec6b8f7ee863386de5b0dbcc035f60 From a4a91cbd4ab897b8ef33db382f02e55fead1400f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 31 Jan 2018 11:07:00 -0800 Subject: [PATCH 1069/1833] [sonic-cfggen] Add unit test for DHCP relay Jinja2 templates (#1357) --- .../docker-dhcp-relay.supervisord.conf | 33 ++++++++++++++ .../tests/sample_output/wait_for_intf.sh | 43 +++++++++++++++++++ src/sonic-config-engine/tests/test_j2files.py | 13 ++++++ 3 files changed, 89 insertions(+) create mode 100644 src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf create mode 100644 src/sonic-config-engine/tests/sample_output/wait_for_intf.sh diff --git a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf new file mode 100644 index 000000000000..f955546cdc09 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf @@ -0,0 +1,33 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[group:isc-dhcp-relay] +programs=isc-dhcp-relay-Vlan1000 + +[program:isc-dhcp-relay-Vlan1000] +command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -i Vlan1000 -i PortChannel02 -i PortChannel03 -i PortChannel04 -i PortChannel01 192.0.0.1 192.0.0.2 +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + + diff --git a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh new file mode 100644 index 000000000000..3cbde972fe18 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +function wait_until_iface_ready +{ + IFACE=$1 + + echo "Waiting until interface $IFACE is up..." + + # Wait for the interface to come up (i.e., 'ip link show' returns 0) + until ip link show dev $IFACE up > /dev/null 2>&1; do + sleep 1 + done + + echo "Interface $IFACE is up" + + echo "Waiting until interface $IFACE has an IPv4 address..." + + # Wait until the interface gets assigned an IPv4 address + while true; do + IP=$(ip -4 addr show dev $IFACE | grep "inet " | awk '{ print $2 }' | cut -d '/' -f1) + + if [ -n "$IP" ]; then + break + fi + + sleep 1 + done + + echo "Interface $IFACE is configured with IP $IP" +} + + +# Wait for all interfaces to come up and have IPv4 addresses assigned +wait_until_iface_ready Vlan1000 +wait_until_iface_ready PortChannel04 +wait_until_iface_ready PortChannel02 +wait_until_iface_ready PortChannel03 +wait_until_iface_ready PortChannel03 +wait_until_iface_ready PortChannel01 +wait_until_iface_ready PortChannel02 +wait_until_iface_ready PortChannel04 +wait_until_iface_ready PortChannel01 + diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 5afd1149979f..129c3973d7b5 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -40,6 +40,19 @@ def test_ports_json(self): self.run_script(argument) self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'ports.json'), self.output_file)) + def test_dhcp_relay(self): + # Test generation of wait_for_intf.sh + template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-dhcp-relay', 'wait_for_intf.sh.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'wait_for_intf.sh'), self.output_file)) + + # Test generation of docker-dhcp-relay.supervisord.conf + template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-dhcp-relay', 'docker-dhcp-relay.supervisord.conf.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'docker-dhcp-relay.supervisord.conf'), self.output_file)) + def test_lldp(self): lldpd_conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-lldp-sv2', 'lldpd.conf.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + lldpd_conf_template + ' > ' + self.output_file From 358949b4e5d245e5fc50942bb177c5fa96a7fbce Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 31 Jan 2018 11:39:48 -0800 Subject: [PATCH 1070/1833] Upgrade linux-image version (#1294) * Upgrade linux-image version * Add missing dependency of igb * Fix mft build rule * Add missing dependency of ixgbe * [Broadcom]: Update OpenNSL modules to be compatible with kernel 3.16.0-5 (#3) * [Nephos] Update SDK version to support new kernel module 3.16.0-5 (#4) * [mellanox]: Update URL for SDK (#5) --- build_debian.sh | 6 +++--- files/Aboot/boot0.j2 | 4 ++-- files/build_templates/swss.service.j2 | 4 ++-- installer/x86_64/install.sh | 4 ++-- platform/broadcom/sdk.mk | 4 ++-- platform/mellanox/mft.mk | 2 +- platform/mellanox/mft/Makefile | 5 ++--- platform/mellanox/sdk.mk | 2 +- platform/nephos/sdk.mk | 4 ++-- rules/linux-kernel.mk | 8 ++++---- src/igb/Makefile | 2 +- src/ixgbe/Makefile | 2 +- src/sonic-linux-kernel | 2 +- 13 files changed, 24 insertions(+), 25 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 6a27bd5d237f..2e0f7f152b51 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -114,7 +114,7 @@ echo '[INFO] Install SONiC linux kernel image' ## Note: duplicate apt-get command to ensure every line return zero sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/initramfs-tools_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-3.16.0-4-amd64_*.deb || \ +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-3.16.0-5-amd64_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f ## Update initramfs for booting with squashfs+aufs @@ -145,10 +145,10 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Install latest intel igb driver -sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko +sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-5-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko ## Install latest intel ixgbe driver -sudo cp target/debs/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-4-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko +sudo cp target/debs/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-5-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko ## Install docker echo '[INFO] Install docker' diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index a2c683b20c91..3f2d2cdecc3c 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -18,8 +18,8 @@ set -x -kernel=boot/vmlinuz-3.16.0-4-amd64 -initrd=boot/initrd.img-3.16.0-4-amd64 +kernel=boot/vmlinuz-3.16.0-5-amd64 +initrd=boot/initrd.img-3.16.0-5-amd64 kernel_params=kernel-params aboot_machine="arista_unknown" diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index ebfb5027b297..bf847dba77c3 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -2,14 +2,14 @@ Description=switch state service Requires=database.service {% if sonic_asic_platform == 'broadcom' %} -Requires=opennsl-modules-3.16.0-4-amd64.service +Requires=opennsl-modules-3.16.0-5-amd64.service {% elif sonic_asic_platform == 'nephos' %} Requires=nps-modules-3.16.0-4-amd64.service {% endif %} After=database.service After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} -After=opennsl-modules-3.16.0-4-amd64.service +After=opennsl-modules-3.16.0-5-amd64.service {% elif sonic_asic_platform == 'nephos' %} After=nps-modules-3.16.0-4-amd64.service {% endif %} diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index c7f184bf0242..517485ba03ea 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -549,11 +549,11 @@ menuentry '$demo_grub_entry' { if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 - linux /$image_dir/boot/vmlinuz-3.16.0-4-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ + linux /$image_dir/boot/vmlinuz-3.16.0-5-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' - initrd /$image_dir/boot/initrd.img-3.16.0-4-amd64 + initrd /$image_dir/boot/initrd.img-3.16.0-5-amd64 } EOF diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index dbabf8aaba15..0b64033b93d8 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,4 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-4-amd64_3.2.3.7-1_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-4-amd64_3.2.3.7-1_amd64.deb?sv=2015-04-05&sr=b&sig=BJEFXfq2mgvSTIYZF8qF1Jj2ePkJaxBmA0HqhhAFPmQ%3D&se=2031-08-11T03%3A27%3A43Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-5-amd64_3.2.3.7-1_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-5-amd64_3.2.3.7-1_amd64.deb?sv=2015-04-05&sr=b&sig=R%2BQp4mHlNi489Q6HP7vFUdBDmDazbiL02hQFdxYkCI0%3D&se=2031-09-27T20%3A17%3A41Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index 966cb48c013f..2fb3af338d75 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -5,5 +5,5 @@ $(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft $(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_MAKE_DEBS += $(MFT) -KERNEL_MFT = kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb +KERNEL_MFT = kernel-mft-dkms_4.5.0-$(KVERSION)_all.deb $(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT))) diff --git a/platform/mellanox/mft/Makefile b/platform/mellanox/mft/Makefile index a5b1e8609b70..eea78cd76031 100644 --- a/platform/mellanox/mft/Makefile +++ b/platform/mellanox/mft/Makefile @@ -3,11 +3,10 @@ SHELL = /bin/bash MFT_NAME = mft-4.5.0-31-x86_64-deb MFT_TGZ = $(MFT_NAME).tgz -KERNELVER = 3.16.0-4-amd64 SRC_DEB = kernel-mft-dkms_4.5.0-31_all.deb MAIN_TARGET = mft-4.5.0-31.amd64.deb -DERIVED_TARGETS = kernel-mft-dkms_4.5.0-3.16.0-4-amd64_all.deb +DERIVED_TARGETS = kernel-mft-dkms_4.5.0-$(KVERSION)_all.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf $(MFT_NAME) @@ -22,7 +21,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : fi done - tar xvf `sudo dkms mkdriverdisk kernel-mft-dkms/4.5.0 -a all -d ubuntu -k $(KERNELVER) --media tar | grep "Disk image location" | cut -d':' -f2` + tar xvf `sudo dkms mkdriverdisk kernel-mft-dkms/4.5.0 -a all -d ubuntu -k $(KVERSION) --media tar | grep "Disk image location" | cut -d':' -f2` popd # fix timestamp because we do not actually build tools, only kernel diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 5aaee09fdb1d..9dd8ff7703fa 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,4 +1,4 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/564703412781016766b248b98266bd6f2c161431/sdk +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/645052b0a285b190082beb858ba43a8b33bb667a/sdk MLNX_SDK_VERSION = 4.2.6011 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ diff --git a/platform/nephos/sdk.mk b/platform/nephos/sdk.mk index 1bc7fe35c0d1..743512366db6 100644 --- a/platform/nephos/sdk.mk +++ b/platform/nephos/sdk.mk @@ -1,4 +1,4 @@ -NEPHOS_NPS_KERNEL = nps-modules-3.16.0-4-amd64_2.0.3a63-20180110_amd64.deb -$(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-3.16.0-4-amd64_2.0.3a63-20180110_amd64.deb" +NEPHOS_NPS_KERNEL = nps-modules-3.16.0-5-amd64_2.0.3_amd64.deb +$(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-3.16.0-5-amd64_2.0.3_amd64.deb" SONIC_ONLINE_DEBS += $(NEPHOS_NPS_KERNEL) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 1e7fad0fd840..b7c1263990f5 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -1,9 +1,9 @@ # linux kernel package -KVERSION_SHORT = 3.16.0-4 -KVERSION = $(KVERSION_SHORT)-amd64 -KERNEL_VERSION = 3.16.43 -KERNEL_SUBVERSION = 2+deb8u5 +KVERSION_SHORT = 3.16.0-5 +KVERSION ?= $(KVERSION_SHORT)-amd64 +KERNEL_VERSION = 3.16.51 +KERNEL_SUBVERSION = 3+deb8u1 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION diff --git a/src/igb/Makefile b/src/igb/Makefile index e814ce0a7db7..cafa96aba772 100644 --- a/src/igb/Makefile +++ b/src/igb/Makefile @@ -15,7 +15,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Build the package pushd src - export BUILD_KERNEL=3.16.0-4-amd64 + export BUILD_KERNEL=$(KVERSION) make popd diff --git a/src/ixgbe/Makefile b/src/ixgbe/Makefile index 133fc7db0570..90d20e606ef6 100644 --- a/src/ixgbe/Makefile +++ b/src/ixgbe/Makefile @@ -14,7 +14,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Build the package pushd src - export BUILD_KERNEL=3.16.0-4-amd64 + export BUILD_KERNEL=$(KVERSION) make popd diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index ff5a3b588cc7..02b5c0b08f58 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit ff5a3b588cc7dbd763fb13c1125710134c8cdd12 +Subproject commit 02b5c0b08f5812d1d7af98f77dfdb2bb11ad1991 From 1ae86ca539a016bf62a95505f774630547218403 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 31 Jan 2018 23:01:24 -0800 Subject: [PATCH 1071/1833] Update swss and swss-common submodules (#1359) --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 918cf5ad6aec..4227beef783f 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 918cf5ad6aec6b8f7ee863386de5b0dbcc035f60 +Subproject commit 4227beef783ff16c3454ffc4f46fcfc5a8ce0c07 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 04b8b84ab6d6..4b29d77aa02e 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 04b8b84ab6d66c97d7d727ac80a431b7ba85cf57 +Subproject commit 4b29d77aa02e570732348458822815550a8c6b0c From 23bbf809990b361e5720bfcaae70dd0ead1e984c Mon Sep 17 00:00:00 2001 From: nikos-li <31227248+nikos-li@users.noreply.github.com> Date: Thu, 1 Feb 2018 08:49:24 -0800 Subject: [PATCH 1072/1833] [device]: Fix celestica's seastone sfputil for lpmode and transceiver presence (#1358) --- .../x86_64-cel_seastone-r0/plugins/sfputil.py | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py b/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py index 7ff632e152b9..f1e6b1daa3e1 100755 --- a/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py +++ b/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py @@ -45,10 +45,54 @@ def __init__(self): SfpUtilBase.__init__(self) def get_presence(self, port_num): - raise NotImplementedError + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/dx010_cpld/qsfp_modprs", "r") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False def get_low_power_mode(self, port_num): - raise NotImplementedError + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/dx010_cpld/qsfp_lpmode", "r") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True def set_low_power_mode(self, port_num, lpmode): raise NotImplementedError From 162089dd9ed24ca3bbd501558efd30d32eaaecc0 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 1 Feb 2018 15:15:39 -0800 Subject: [PATCH 1073/1833] [caclmgrd] Prevent service from blocking system boot indefinitely (#1362) --- files/image_config/caclmgrd/caclmgrd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/caclmgrd/caclmgrd.service b/files/image_config/caclmgrd/caclmgrd.service index 8e6cbb0c8e64..1acc23458c90 100644 --- a/files/image_config/caclmgrd/caclmgrd.service +++ b/files/image_config/caclmgrd/caclmgrd.service @@ -4,7 +4,7 @@ Requires=database.service After=database.service [Service] -Type=oneshot +Type=simple ExecStart=/usr/bin/caclmgrd-start.sh [Install] From b34bd1f978d0ba7d6e97b5c8025332c56efe453e Mon Sep 17 00:00:00 2001 From: Harish Venkatraman Date: Fri, 2 Feb 2018 14:02:57 -0800 Subject: [PATCH 1074/1833] [device/dell] Add dynamic buffer pg lookup tbl (#1366) This commit adds new support for dynamic buffer configuation. Adding pg_profile lookup table for supporting the buffer profile using cable length and port speed. Lookup table entries are calculated based on formula for different cable length and speed. The 50G entries needs to be updated once again as we are waiting for the interface sublayer MAC delay values. Additionally fixed some issues in the buffers.json.j2 file. Signed-off-by: Harish Venkatraman --- .../Force10-S6100/buffers.json.j2 | 18 ++++++++++-------- .../Force10-S6100/pg_profile_lookup.ini | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 index b12fc3851177..153e487f2f07 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/buffers.json.j2 @@ -68,7 +68,7 @@ } }, "BUFFER_POOL": { - "ingress_lossless_lossy_pool": { + "ingress_lossless_pool": { "size": "10443264", "type": "ingress", "mode": "dynamic", @@ -87,14 +87,14 @@ }, "BUFFER_PROFILE": { "ingress_lossless_profile": { - "pool": "[BUFFER_POOL|ingress_lossless_lossy_pool]", + "pool": "[BUFFER_POOL|ingress_lossless_pool]", "xon": "4096", "xoff": "58448", "size": "1248", "dynamic_th": "-4" }, "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_lossy_pool]", + "pool":"[BUFFER_POOL|ingress_lossless_pool]", "size":"0", "dynamic_th":"3" }, @@ -110,16 +110,18 @@ } }, "BUFFER_PG": { - "{{ port_names }}:3-4": { + "{{ port_names }}|3-4": { "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" }, - "{{ port_names }}:0-1": { + "{{ port_names }}|0-1": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "BUFFER_QUEUE_TABLE:{{ port_names }}:3-4": { + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, - "BUFFER_QUEUE_TABLE:{{ port_names }}:0-1": { + "{{ port_names }}|0-1": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } 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 new file mode 100644 index 000000000000..c2375046870e --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 1248 2288 35776 -4 + 25000 5m 1248 2288 53248 -4 + 40000 5m 1248 2288 66560 -4 + 50000 5m 1248 2288 90272 -4 + 100000 5m 1248 2288 165568 -4 + 10000 40m 1248 2288 37024 -4 + 25000 40m 1248 2288 53248 -4 + 40000 40m 1248 2288 71552 -4 + 50000 40m 1248 2288 96096 -4 + 100000 40m 1248 2288 177632 -4 + 10000 300m 1248 2288 46176 -4 + 25000 300m 1248 2288 79040 -4 + 40000 300m 1248 2288 108160 -4 + 50000 300m 1248 2288 141856 -4 + 100000 300m 1248 2288 268736 -4 From 628ad3da03488d03600bae63b1885310c3e254d1 Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Sat, 3 Feb 2018 17:46:00 +0800 Subject: [PATCH 1075/1833] [Platform] Update FEC value and SAI download link for Ingrasys S9130-32X/S9230-64X (#1365) - What I did Updating FEC value and SAI download link - How I did it Updating related switch configuration files in device/ingrasys Updating sai.mk files in platform/nephos - How to verify it Checking system and network feature is worked as well - Description for the changelog Updating FEC value and SAI download link for Ingrasys S9130-32X/S9230-64X - A picture of a cute animal (not mandatory but encouraged) Signed-off-by: Sam Yang --- .../INGRASYS-S9130-32X/port_config.nps | 2 +- .../INGRASYS-S9230-64X/port_config.nps | 128 +++++++++--------- platform/nephos/sai.mk | 4 +- 3 files changed, 67 insertions(+), 67 deletions(-) diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps index ac6268716170..dbc9a010a228 100644 --- a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps @@ -312,7 +312,7 @@ port set portlist=0-31 speed=100g port set portlist=129-130 speed=10g port set portlist=0-31 medium-type=sr4 port set portlist=129-130 medium-type=kr -port set portlist=0-31 fec=rs +port set portlist=0-31 fec=disable port advertise portlist=129-130 speed-10g-kr port set portlist=129-130 an=enable port set portlist=0-31,129-130 admin=enable diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps index 2b013f7641eb..4e5e8e998d7b 100644 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/port_config.nps @@ -728,70 +728,70 @@ port set unit=0 portlist=62 medium-type=sr4 port set unit=0 portlist=63 medium-type=sr4 port set unit=0 portlist=129 medium-type=kr port set unit=0 portlist=130 medium-type=kr -port set unit=0 portlist=0 fec=rs -port set unit=0 portlist=1 fec=rs -port set unit=0 portlist=2 fec=rs -port set unit=0 portlist=3 fec=rs -port set unit=0 portlist=4 fec=rs -port set unit=0 portlist=5 fec=rs -port set unit=0 portlist=6 fec=rs -port set unit=0 portlist=7 fec=rs -port set unit=0 portlist=8 fec=rs -port set unit=0 portlist=9 fec=rs -port set unit=0 portlist=10 fec=rs -port set unit=0 portlist=11 fec=rs -port set unit=0 portlist=12 fec=rs -port set unit=0 portlist=13 fec=rs -port set unit=0 portlist=14 fec=rs -port set unit=0 portlist=15 fec=rs -port set unit=0 portlist=16 fec=rs -port set unit=0 portlist=17 fec=rs -port set unit=0 portlist=18 fec=rs -port set unit=0 portlist=19 fec=rs -port set unit=0 portlist=20 fec=rs -port set unit=0 portlist=21 fec=rs -port set unit=0 portlist=22 fec=rs -port set unit=0 portlist=23 fec=rs -port set unit=0 portlist=24 fec=rs -port set unit=0 portlist=25 fec=rs -port set unit=0 portlist=26 fec=rs -port set unit=0 portlist=27 fec=rs -port set unit=0 portlist=28 fec=rs -port set unit=0 portlist=29 fec=rs -port set unit=0 portlist=30 fec=rs -port set unit=0 portlist=31 fec=rs -port set unit=0 portlist=32 fec=rs -port set unit=0 portlist=33 fec=rs -port set unit=0 portlist=34 fec=rs -port set unit=0 portlist=35 fec=rs -port set unit=0 portlist=36 fec=rs -port set unit=0 portlist=37 fec=rs -port set unit=0 portlist=38 fec=rs -port set unit=0 portlist=39 fec=rs -port set unit=0 portlist=40 fec=rs -port set unit=0 portlist=41 fec=rs -port set unit=0 portlist=42 fec=rs -port set unit=0 portlist=43 fec=rs -port set unit=0 portlist=44 fec=rs -port set unit=0 portlist=45 fec=rs -port set unit=0 portlist=46 fec=rs -port set unit=0 portlist=47 fec=rs -port set unit=0 portlist=48 fec=rs -port set unit=0 portlist=49 fec=rs -port set unit=0 portlist=50 fec=rs -port set unit=0 portlist=51 fec=rs -port set unit=0 portlist=52 fec=rs -port set unit=0 portlist=53 fec=rs -port set unit=0 portlist=54 fec=rs -port set unit=0 portlist=55 fec=rs -port set unit=0 portlist=56 fec=rs -port set unit=0 portlist=57 fec=rs -port set unit=0 portlist=58 fec=rs -port set unit=0 portlist=59 fec=rs -port set unit=0 portlist=60 fec=rs -port set unit=0 portlist=61 fec=rs -port set unit=0 portlist=62 fec=rs -port set unit=0 portlist=63 fec=rs +port set unit=0 portlist=0 fec=disable +port set unit=0 portlist=1 fec=disable +port set unit=0 portlist=2 fec=disable +port set unit=0 portlist=3 fec=disable +port set unit=0 portlist=4 fec=disable +port set unit=0 portlist=5 fec=disable +port set unit=0 portlist=6 fec=disable +port set unit=0 portlist=7 fec=disable +port set unit=0 portlist=8 fec=disable +port set unit=0 portlist=9 fec=disable +port set unit=0 portlist=10 fec=disable +port set unit=0 portlist=11 fec=disable +port set unit=0 portlist=12 fec=disable +port set unit=0 portlist=13 fec=disable +port set unit=0 portlist=14 fec=disable +port set unit=0 portlist=15 fec=disable +port set unit=0 portlist=16 fec=disable +port set unit=0 portlist=17 fec=disable +port set unit=0 portlist=18 fec=disable +port set unit=0 portlist=19 fec=disable +port set unit=0 portlist=20 fec=disable +port set unit=0 portlist=21 fec=disable +port set unit=0 portlist=22 fec=disable +port set unit=0 portlist=23 fec=disable +port set unit=0 portlist=24 fec=disable +port set unit=0 portlist=25 fec=disable +port set unit=0 portlist=26 fec=disable +port set unit=0 portlist=27 fec=disable +port set unit=0 portlist=28 fec=disable +port set unit=0 portlist=29 fec=disable +port set unit=0 portlist=30 fec=disable +port set unit=0 portlist=31 fec=disable +port set unit=0 portlist=32 fec=disable +port set unit=0 portlist=33 fec=disable +port set unit=0 portlist=34 fec=disable +port set unit=0 portlist=35 fec=disable +port set unit=0 portlist=36 fec=disable +port set unit=0 portlist=37 fec=disable +port set unit=0 portlist=38 fec=disable +port set unit=0 portlist=39 fec=disable +port set unit=0 portlist=40 fec=disable +port set unit=0 portlist=41 fec=disable +port set unit=0 portlist=42 fec=disable +port set unit=0 portlist=43 fec=disable +port set unit=0 portlist=44 fec=disable +port set unit=0 portlist=45 fec=disable +port set unit=0 portlist=46 fec=disable +port set unit=0 portlist=47 fec=disable +port set unit=0 portlist=48 fec=disable +port set unit=0 portlist=49 fec=disable +port set unit=0 portlist=50 fec=disable +port set unit=0 portlist=51 fec=disable +port set unit=0 portlist=52 fec=disable +port set unit=0 portlist=53 fec=disable +port set unit=0 portlist=54 fec=disable +port set unit=0 portlist=55 fec=disable +port set unit=0 portlist=56 fec=disable +port set unit=0 portlist=57 fec=disable +port set unit=0 portlist=58 fec=disable +port set unit=0 portlist=59 fec=disable +port set unit=0 portlist=60 fec=disable +port set unit=0 portlist=61 fec=disable +port set unit=0 portlist=62 fec=disable +port set unit=0 portlist=63 fec=disable port advertise unit=0 portlist=129 speed-10g-kr port advertise unit=0 portlist=130 speed-10g-kr port set unit=0 portlist=129 an=enable diff --git a/platform/nephos/sai.mk b/platform/nephos/sai.mk index 2da9e1f2c4fa..30fb458e638f 100644 --- a/platform/nephos/sai.mk +++ b/platform/nephos/sai.mk @@ -1,5 +1,5 @@ -NEPHOS_SAI = libsainps_2.0.3a63-20180110_amd64.deb -$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.3a63-20180110_amd64.deb" +NEPHOS_SAI = libsainps_2.0.3_amd64.deb +$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.3_amd64.deb" NEPHOS_SAI_DEV = libsainps-dev_2.0.3a63-20180110_amd64.deb $(eval $(call add_derived_package,$(NEPHOS_SAI),$(NEPHOS_SAI_DEV))) From a4bcccc9db552bb63699528d0e3af3d677cd0ef6 Mon Sep 17 00:00:00 2001 From: paavaanan Date: Sun, 4 Feb 2018 06:19:24 +0530 Subject: [PATCH 1076/1833] [dell-hwmon] Changed variables in psuutil scripts for both Z9100/S6100 platforms (#1305) * [dell-hwmon] Changes psuutil scripts for Z9100/S6100 platform to use hwmon variables * Updated sumbodule 23c5383780790234da3774155bd521db14d8daa4 - hwmon changes --- device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py | 7 ++++--- device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py | 7 ++++--- platform/broadcom/sonic-platform-modules-dell | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py index 83452f69aaa4..b753cd711dae 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/psuutil.py @@ -20,10 +20,11 @@ def __init__(self): # Get a mailbox register def get_pmc_register(self, reg_name): - mailbox_dir = "/sys/devices/platform/dell_s6100_lpc" + mailbox_dir = "/sys/devices/platform/SMF.512/hwmon/hwmon1" retval = 'ERR' mb_reg_file = mailbox_dir+'/' + reg_name if (not os.path.isfile(mb_reg_file)): + print mb_reg_file, 'not found !' return retval try: @@ -52,7 +53,7 @@ def get_psu_status(self, index): faulty """ status = 0 - psu_status = self.get_pmc_register('psu_'+str(index)+'_status') + psu_status = self.get_pmc_register('psu'+str(index)+'_presence') if (psu_status != 'ERR'): psu_status = int(psu_status, 16) # Check for PSU statuse @@ -69,7 +70,7 @@ def get_psu_presence(self, index): :return: Boolean, True if PSU is plugged, False if not """ status = 0 - psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') + psu_presence = self.get_pmc_register('psu'+str(index)+'_presence') if (psu_presence != 'ERR'): psu_presence = int(psu_presence, 16) # Check for PSU presence diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py index 2ad6ae7d1491..2e07ee818818 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/psuutil.py @@ -20,10 +20,11 @@ def __init__(self): # Get a mailbox register def get_pmc_register(self, reg_name): - mailbox_dir = "/sys/devices/platform/dell_mailbox" + mailbox_dir = "/sys/devices/platform/SMF.512/hwmon/hwmon1" retval = 'ERR' mb_reg_file = mailbox_dir+'/' + reg_name if (not os.path.isfile(mb_reg_file)): + print mb_reg_file, 'not found !' return retval try: @@ -52,7 +53,7 @@ def get_psu_status(self, index): faulty """ status = 0 - psu_status = self.get_pmc_register('psu_'+str(index)+'_status') + psu_status = self.get_pmc_register('psu'+str(index)+'_presence') if (psu_status != 'ERR'): psu_status = int(psu_status, 16) # Check for PSU statuse @@ -69,7 +70,7 @@ def get_psu_presence(self, index): :return: Boolean, True if PSU is plugged, False if not """ status = 0 - psu_presence = self.get_pmc_register('psu_'+str(index)+'_status') + psu_presence = self.get_pmc_register('psu'+str(index)+'_presence') if (psu_presence != 'ERR'): psu_presence = int(psu_presence, 16) # Check for PSU presence diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index f0e808fe518f..23c538378079 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit f0e808fe518f336e4cb97fdaf25e35a752c24d89 +Subproject commit 23c5383780790234da3774155bd521db14d8daa4 From 60452351ea2a24a8f4fe05e20bc28fc9aa10ef16 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 4 Feb 2018 12:48:48 +0800 Subject: [PATCH 1077/1833] [devices]: change platform modules to depend on 3.16.0-5-amdn64 kernel (#1368) * [devices]: change platform modules to depend on 3.16.0-5-amdn64 kernel * update kernel to 3.16.0-5-amd64 for dell s6100 and z9100 --- platform/broadcom/sonic-platform-modules-dell | 2 +- platform/broadcom/sonic-platform-modules-delta/debian/control | 2 +- .../broadcom/sonic-platform-modules-inventec/debian/control | 4 ++-- platform/broadcom/sonic-platform-modules-s6000 | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 23c538378079..d2f58195831e 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 23c5383780790234da3774155bd521db14d8daa4 +Subproject commit d2f58195831e6e7016992ef449778f3474e60e95 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control index 7ad1550415be..1928e9a767eb 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/control +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -7,5 +7,5 @@ Standards-Version: 3.9.3 Package: platform-modules-ag9032v1 Architecture: amd64 -Depends: linux-image-3.16.0-4-amd64 +Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/control b/platform/broadcom/sonic-platform-modules-inventec/debian/control index d570e777de98..27258c9226c3 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/control +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/control @@ -7,11 +7,11 @@ Standards-Version: 3.9.3 Package: platform-modules-d7032q28b Architecture: amd64 -Depends: linux-image-3.16.0-4-amd64 +Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d7054q28b Architecture: amd64 -Depends: linux-image-3.16.0-4-amd64 +Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led diff --git a/platform/broadcom/sonic-platform-modules-s6000 b/platform/broadcom/sonic-platform-modules-s6000 index 952208ce52d8..ed9ea067b5cb 160000 --- a/platform/broadcom/sonic-platform-modules-s6000 +++ b/platform/broadcom/sonic-platform-modules-s6000 @@ -1 +1 @@ -Subproject commit 952208ce52d88095da9591cc548d1e013f363476 +Subproject commit ed9ea067b5cbfd7d1c835a903729f9dc28d3b035 From e880c78f2a5058a2330e4104f24f8c4166fe43d4 Mon Sep 17 00:00:00 2001 From: StanleyCi <34563271+StanleyCi@users.noreply.github.com> Date: Tue, 6 Feb 2018 21:23:20 +0800 Subject: [PATCH 1078/1833] [Delta]: Updated port_config.ini & fix the bug of fancontrol.service for ag9032v1. (#1371) * [Delta]: Updated port_config.ini & fix the bug of fancontrol.service for ag9032v1. Signed-off-by: Stanley Chi * [Delta]: Updated port_config.ini & fix the bug of fancontrol.service for ag9032v1. Signed-off-by: Stanley Chi --- .../Delta-ag9032v1/port_config.ini | 48 ++++---- .../fancontrol.service | 109 +++++++++++++----- 2 files changed, 101 insertions(+), 56 deletions(-) diff --git a/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini index e000f29bef38..4fb783847b0a 100644 --- a/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini +++ b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/port_config.ini @@ -1,16 +1,16 @@ # name lanes alias -Ethernet0 49,50,51,52 hundredGigE1/1 -Ethernet4 53,54,55,56 hundredGigE1/2 -Ethernet8 57,58,59,60 hundredGigE1/3 -Ethernet12 61,62,63,64 hundredGigE1/4 -Ethernet16 65,66,67,68 hundredGigE1/5 -Ethernet20 69,70,71,72 hundredGigE1/6 -Ethernet24 73,74,75,76 hundredGigE1/7 -Ethernet28 77,78,79,80 hundredGigE1/8 -Ethernet32 37,38,39,40 hundredGigE1/9 -Ethernet36 33,34,35,36 hundredGigE1/10 -Ethernet40 45,46,47,48 hundredGigE1/11 -Ethernet44 41,42,43,44 hundredGigE1/12 +Ethernet0 41,42,43,44 hundredGigE1/1 +Ethernet4 45,46,47,48 hundredGigE1/2 +Ethernet8 49,50,51,52 hundredGigE1/3 +Ethernet12 37,38,39,40 hundredGigE1/4 +Ethernet16 33,34,35,36 hundredGigE1/5 +Ethernet20 53,54,55,56 hundredGigE1/6 +Ethernet24 57,58,59,60 hundredGigE1/7 +Ethernet28 61,62,63,64 hundredGigE1/8 +Ethernet32 65,66,67,68 hundredGigE1/9 +Ethernet36 69,70,71,72 hundredGigE1/10 +Ethernet40 73,74,75,76 hundredGigE1/11 +Ethernet44 77,78,79,80 hundredGigE1/12 Ethernet48 81,82,83,84 hundredGigE1/13 Ethernet52 85,86,87,88 hundredGigE1/14 Ethernet56 89,90,91,92 hundredGigE1/15 @@ -19,15 +19,15 @@ Ethernet64 97,98,99,100 hundredGigE1/17 Ethernet68 101,102,103,104 hundredGigE1/18 Ethernet72 105,106,107,108 hundredGigE1/19 Ethernet76 109,110,111,112 hundredGigE1/20 -Ethernet80 21,22,23,24 hundredGigE1/21 -Ethernet84 17,18,19,20 hundredGigE1/22 -Ethernet88 29,30,31,32 hundredGigE1/23 -Ethernet92 25,26,27,28 hundredGigE1/24 -Ethernet96 117,118,119,120 hundredGigE1/25 -Ethernet100 113,114,115,116 hundredGigE1/26 -Ethernet104 125,126,127,128 hundredGigE1/27 -Ethernet108 121,122,123,124 hundredGigE1/28 -Ethernet112 5,6,7,8 hundredGigE1/29 -Ethernet116 1,2,3,4 hundredGigE1/30 -Ethernet120 13,14,15,16 hundredGigE1/31 -Ethernet124 9,10,11,12 hundredGigE1/32 +Ethernet80 121,122,123,124 hundredGigE1/21 +Ethernet84 113,114,115,116 hundredGigE1/22 +Ethernet88 1,2,3,4 hundredGigE1/23 +Ethernet92 117,118,119,120 hundredGigE1/24 +Ethernet96 5,6,7,8 hundredGigE1/25 +Ethernet100 125,126,127,128 hundredGigE1/26 +Ethernet104 29,30,31,32 hundredGigE1/27 +Ethernet108 9,10,11,12 hundredGigE1/28 +Ethernet112 13,14,15,16 hundredGigE1/29 +Ethernet116 25,26,27,28 hundredGigE1/30 +Ethernet120 17,18,19,20 hundredGigE1/31 +Ethernet124 21,22,23,24 hundredGigE1/32 diff --git a/device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service b/device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service index 17f647effb5b..83f14245d1bd 100755 --- a/device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service +++ b/device/delta/x86_64-delta_ag9032v1-r0/fancontrol.service @@ -69,6 +69,17 @@ function LoadConfig FCMAXTEMP=$MAXTEMP FCMINSTART=$MINSTART FCMINSTOP=$MINSTOP + AFCTEMP_1_LOWER=(00 39 36 41 46 55) + AFCTEMP_1_UPPER=(39 39 44 49 54 150) + AFCTEMP_2_LOWER=(00 61 65 69 73 82) + AFCTEMP_2_UPPER=(63 67 71 75 79 150) + AFCTEMP_3_LOWER=(00 51 55 59 63 71) + AFCTEMP_3_UPPER=(53 57 61 65 69 150) + AFCTEMP_4_LOWER=(00 46 50 54 58 65) + AFCTEMP_4_UPPER=(45 52 56 60 64 150) + AFCTEMP_5_LOWER=(00 46 50 54 58 65) + AFCTEMP_5_UPPER=(45 52 56 60 64 150) + FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'` @@ -98,7 +109,6 @@ function LoadConfig AFCTEMP[$fcvcount]=$( echo "$temp_string" | cut -d" " -f $fcvcount ) AFCTEMP[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) AFCTEMP_PATH[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) - AFCTEMP[$fcvcount]=$( cat ${AFCTEMP[$fcvcount]} ) AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 )) done @@ -165,39 +175,79 @@ then fi echo $$ > "$PIDFILE" - # main function function UpdateThermalSensors { - echo "" - TEMP_HIGHEST=0 - FAN_PERCENTAGE=0 - - for i in ${AFCTEMP_PATH[@]}; do - if (( $(cat $i) > $TEMP_HIGHEST )); then - TEMP_HIGHEST=$(cat $i); - fi; + fcvcount=0 + for fcv in $FCTEMPS + do + fcvcount=$((fcvcount+1)) + AFCTEMP[$fcvcount]=$( cat ${AFCTEMP_PATH[$fcvcount]} ) + AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 )) done - TEMP_HIGHEST=$((TEMP_HIGHEST/1000)) - echo "The highest temperature of thermal sensors: $TEMP_HIGHEST °C" +} + +function UpdateThermalLevel +{ + AFCTEMP_NUM=$((6-${AFCTEMP_LEVEL[$i]})) + AFCTEMP_UPPER_BUF=AFCTEMP_"$i"_UPPER["$AFCTEMP_NUM"] + AFCTEMP_LOWER_BUF=AFCTEMP_"$i"_LOWER["$AFCTEMP_NUM"] + + AFCTEMP_UPPER=${!AFCTEMP_UPPER_BUF} + AFCTEMP_LOWER=${!AFCTEMP_LOWER_BUF} + + + if (( ("${AFCTEMP[$i]}" <= "$AFCTEMP_UPPER") && ("${AFCTEMP[$i]}" >= "$AFCTEMP_LOWER") )) ; then + FLAG=2 + elif (( "${AFCTEMP[$i]}" > "$AFCTEMP_UPPER" )); then + AFCTEMP_LEVEL[$i]=$((${AFCTEMP_LEVEL[$i]} - 1)) + FLAG=1 + elif (( "${AFCTEMP[$i]}" < "$AFCTEMP_LOWER" )); then + AFCTEMP_LEVEL[$i]=$((${AFCTEMP_LEVEL[$i]} + 1)) + FLAG=1 + else + AFCTEMP_LEVEL[$i]=1 + FLAG=2 + fi } function UpdateFanSpeeds { - if [ $TEMP_HIGHEST -lt 51 ]; then #TEMP<=50 - FAN_PERCENTAGE=40 - elif [ $TEMP_HIGHEST -lt 56 -a $TEMP_HIGHEST -gt 50 ]; then #50 '/sys/bus/i2c/devices/4-0058/psu_select_member' echo "$FAN_ON_PSU_PERCENTAGE" > '/sys/bus/i2c/devices/40-0058/fan1_set_percentage' echo "PSU fan1 =$( cat '/sys/bus/i2c/devices/40-0058/fan1_input' ) (rpm)" #Set speed to PSU_FAN2 - #echo "0x20" > '/sys/bus/i2c/devices/4-0058/psu_select_member' echo "$FAN_ON_PSU_PERCENTAGE" > '/sys/bus/i2c/devices/41-0058/fan1_set_percentage' echo "PSU fan2 =$( cat '/sys/bus/i2c/devices/41-0058/fan1_input' ) (rpm)" rm -f "$PIDFILE" } + # main loop calling the main function at specified intervals +AFCTEMP_LEVEL=(9 4 4 4 4 4) #inttial level while true do UpdateThermalSensors UpdateFanSpeeds echo "Sleep $INTERVAL seconds ..." + echo # Sleep while still handling signals sleep $INTERVAL & wait $! From 58c479d3af89e372c7039f386e77e2275176298a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 6 Feb 2018 14:59:15 -0800 Subject: [PATCH 1079/1833] [boot] log rc.local execution in syslog (#1375) --- files/image_config/platform/rc.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index a78c07d93b4a..145ef06e355e 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/sh -x # # rc.local # From e223610f4eb785537c08778f7f5e2480a78d6d59 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 7 Feb 2018 10:08:13 +0800 Subject: [PATCH 1080/1833] [devices]: change celestica platform modules to depend on 3.16.0-5-amd64 kernel (#1374) --- platform/broadcom/sonic-platform-modules-cel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel index be37af0179d9..190d0b71ac19 160000 --- a/platform/broadcom/sonic-platform-modules-cel +++ b/platform/broadcom/sonic-platform-modules-cel @@ -1 +1 @@ -Subproject commit be37af0179d97f1855fdec1f81c566ea69f5bb87 +Subproject commit 190d0b71ac1902679e2d720368e100d78eb09f3e From d0dd80c6d37f91eb5a6e39bf0f261661985411c8 Mon Sep 17 00:00:00 2001 From: kaiyu22 Date: Wed, 7 Feb 2018 20:09:14 +0800 Subject: [PATCH 1081/1833] [Nephos] Update SDK version to 3.16.0-5 in swss.service.j2 (#1377) - What I did Updating SDK version from 3.16.0-4 to 3.16.0-5 - How I did it Updating SDK version in files/build_templates/swss.service.j2 - How to verify it Checking command "config load_minigraph" without errors - Description for the changelog Updating SDK version from 3.16.0-4 to 3.16.0-5 in swss.service.j2 - A picture of a cute animal (not mandatory but encouraged) Signed-off-by: Sam Yang --- files/build_templates/swss.service.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index bf847dba77c3..bcda050e3ce0 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -4,14 +4,14 @@ Requires=database.service {% if sonic_asic_platform == 'broadcom' %} Requires=opennsl-modules-3.16.0-5-amd64.service {% elif sonic_asic_platform == 'nephos' %} -Requires=nps-modules-3.16.0-4-amd64.service +Requires=nps-modules-3.16.0-5-amd64.service {% endif %} After=database.service After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} After=opennsl-modules-3.16.0-5-amd64.service {% elif sonic_asic_platform == 'nephos' %} -After=nps-modules-3.16.0-4-amd64.service +After=nps-modules-3.16.0-5-amd64.service {% endif %} [Service] From 4925d48b1ae2e3dddcdbb43c16653023cc5a98e2 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Wed, 7 Feb 2018 06:06:41 -0800 Subject: [PATCH 1082/1833] Fix VLAN_INTERFACE attach issue upon vlan id-name mismatch (#1367) --- src/sonic-config-engine/minigraph.py | 6 ++++++ src/sonic-config-engine/tests/simple-sample-graph.xml | 4 ++-- src/sonic-config-engine/tests/test_cfggen.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 23d02a363e47..025fecb35e26 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -177,6 +177,8 @@ def parse_dpg(dpg, hname): vlan_attributes['dhcp_servers'] = vdhcpserver_list sonic_vlan_name = "Vlan%s" % vlanid + if sonic_vlan_name != vintfname: + vlan_attributes['alias'] = vintfname vlans[sonic_vlan_name] = vlan_attributes aclintfs = child.find(str(QName(ns, "AclInterfaces"))) @@ -398,9 +400,13 @@ def parse_xml(filename, platform=None, port_config_file=None): phyport_intfs = {} vlan_intfs = {} pc_intfs = {} + vlan_invert_mapping = { v['alias']:k for k,v in vlans.items() if v.has_key('alias') } + for intf in intfs: if intf[0][0:4] == 'Vlan': vlan_intfs[intf] = {} + elif vlan_invert_mapping.has_key(intf[0]): + vlan_intfs[(vlan_invert_mapping[intf[0]], intf[1])] = {} elif intf[0][0:11] == 'PortChannel': pc_intfs[intf] = {} else: diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 4062cd7ae0c8..0201aefd3b44 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -128,7 +128,7 @@ - Vlan1000 + ab1 fortyGigE0/8 192.0.0.1;192.0.0.2 1000 @@ -159,7 +159,7 @@ - Vlan1000 + ab1 192.168.0.1/27
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 9c9b31abf203..7d0c7b516cfa 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -89,7 +89,7 @@ def test_minigraph_interfaces(self): def test_minigraph_vlans(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'Vlan1000': {'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}}") + self.assertEqual(output.strip(), "{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}}") def test_minigraph_vlan_members(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN_MEMBER' From 0d0752e09980cbf105be7642ad9c39dc63f2c8f5 Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Wed, 7 Feb 2018 19:37:01 +0530 Subject: [PATCH 1083/1833] Reduce SONiC migration partition from 8G to 1G. (#1343) * Reduce SONiC migration partition from 8G to 1G. * Changes to create 1G partition with ability to resize post migration. * Remove redundant changes in varlog * Use findfs to interpret root. Move resize in case cmdline params are reordered --- build_debian.sh | 4 +++ build_image.sh | 2 +- files/initramfs-tools/mke2fs | 2 ++ files/initramfs-tools/resize-rootfs | 39 +++++++++++++++++++++++++++++ onie-image.conf | 2 +- 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 files/initramfs-tools/resize-rootfs diff --git a/build_debian.sh b/build_debian.sh index 2e0f7f152b51..2edb356d3d3e 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -133,6 +133,10 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl sudo cp files/initramfs-tools/arista-net $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net +# Hook into initramfs: resize root partition after migration from another NOS to SONiC on Dell switches +sudo cp files/initramfs-tools/resize-rootfs $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/resize-rootfs +sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/resize-rootfs + ## Hook into initramfs: after partition mount and loop file mount ## 1. Prepare layered file system ## 2. Bind-mount docker working directory (docker aufs cannot work over aufs rootfs) diff --git a/build_image.sh b/build_image.sh index ee7fb8a75823..757ea026f16d 100755 --- a/build_image.sh +++ b/build_image.sh @@ -56,7 +56,7 @@ elif [ "$IMAGE_TYPE" = "raw" ]; then echo "Creating SONiC raw partition : $OUTPUT_RAW_IMAGE of size $RAW_IMAGE_DISK_SIZE MB" fallocate -l "$RAW_IMAGE_DISK_SIZE"M $OUTPUT_RAW_IMAGE - ## Generate a compressed 8GB partition dump that can be used to 'dd' in-lieu of using the onie-nos-installer + ## Generate a partition dump that can be used to 'dd' in-lieu of using the onie-nos-installer ## Run the installer ## The 'build' install mode of the installer is used to generate this dump. sudo chmod a+x $OUTPUT_ONIE_IMAGE diff --git a/files/initramfs-tools/mke2fs b/files/initramfs-tools/mke2fs index a67162199cf1..52933d644a87 100644 --- a/files/initramfs-tools/mke2fs +++ b/files/initramfs-tools/mke2fs @@ -20,6 +20,8 @@ esac copy_exec /sbin/mke2fs copy_exec /sbin/sfdisk copy_exec /sbin/fdisk +copy_exec /sbin/resize2fs +copy_exec /sbin/findfs fstypes="ext4 ext3" diff --git a/files/initramfs-tools/resize-rootfs b/files/initramfs-tools/resize-rootfs new file mode 100644 index 000000000000..17ffcb94e693 --- /dev/null +++ b/files/initramfs-tools/resize-rootfs @@ -0,0 +1,39 @@ +#!/bin/sh + +case $1 in + prereqs) + exit 0 + ;; +esac + +# Extract kernel parameters +set -- $(cat /proc/cmdline) +for x in "$@"; do + case "$x" in + root=*) + root_val="${x#root=}" + ;; + resize-rootfs) + need_resize=1 + ;; + esac +done + +if [ -n "$need_resize" ]; then + if [ -z "$root_val" ]; then + echo "ERROR: resize required but unable to get root location from command line" + exit 1 + fi + + root_dev=$(findfs $root_val) + if [ $? != 0 ]; then + echo "ERROR: resize required but findfs failed" + exit 1 + fi + + resize2fs -f $root_dev + if [ $? != 0 ]; then + echo "ERROR: Unable to resize the root file system. Manual intervention needed to fix the issue." + exit 1 + fi +fi diff --git a/onie-image.conf b/onie-image.conf index b6564feb1a41..0ffc9914c732 100644 --- a/onie-image.conf +++ b/onie-image.conf @@ -31,7 +31,7 @@ OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin OUTPUT_RAW_IMAGE=target/sonic-$TARGET_MACHINE.raw ### Raw image size in MB -RAW_IMAGE_DISK_SIZE=8192 +RAW_IMAGE_DISK_SIZE=1024 ## Output file name for aboot installer OUTPUT_ABOOT_IMAGE=target/sonic-aboot-$TARGET_MACHINE.swi From 7b98238de689da1261170f002e64fb7ba37b9818 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Wed, 7 Feb 2018 08:12:30 -0800 Subject: [PATCH 1084/1833] [device/arista] Update Arista drivers submodule (#1376) - The driver package was split into bins, drivers, python2, python3 - Introduce some tracing regarding the switch chip reset - Add watchdog during boot for DCS-7260CX3-64 --- platform/broadcom/one-aboot.mk | 2 +- platform/broadcom/platform-modules-arista.mk | 14 +++++++++++++- platform/broadcom/sonic-platform-modules-arista | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/platform/broadcom/one-aboot.mk b/platform/broadcom/one-aboot.mk index d13ce392b425..71829fca4013 100644 --- a/platform/broadcom/one-aboot.mk +++ b/platform/broadcom/one-aboot.mk @@ -3,6 +3,6 @@ SONIC_ONE_ABOOT_IMAGE = sonic-aboot-broadcom.swi $(SONIC_ONE_ABOOT_IMAGE)_MACHINE = broadcom $(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot -$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL) $(ARISTA_PLATFORM_MODULE) +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL) $(ARISTA_PLATFORM_MODULE_DRIVERS) $(ARISTA_PLATFORM_MODULE_PYTHON2) $(ARISTA_PLATFORM_MODULE_PYTHON3) $(ARISTA_PLATFORM_MODULE) $(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_ABOOT_IMAGE) diff --git a/platform/broadcom/platform-modules-arista.mk b/platform/broadcom/platform-modules-arista.mk index 46f8709f53e9..ec7566318c8d 100644 --- a/platform/broadcom/platform-modules-arista.mk +++ b/platform/broadcom/platform-modules-arista.mk @@ -7,4 +7,16 @@ export ARISTA_PLATFORM_MODULE_VERSION ARISTA_PLATFORM_MODULE = sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb $(ARISTA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-arista $(ARISTA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -SONIC_DPKG_DEBS += $(ARISTA_PLATFORM_MODULE) +SONIC_MAKE_DEBS += $(ARISTA_PLATFORM_MODULE) + +ARISTA_PLATFORM_MODULE_PYTHON2 = python-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON2))) + +ARISTA_PLATFORM_MODULE_PYTHON3 = python3-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON3))) + +ARISTA_PLATFORM_MODULE_DRIVERS = drivers-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_DRIVERS))) + +export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MODULE_PYTHON3 ARISTA_PLATFORM_MODULE_DRIVERS + diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index e657481807db..3e8345b5d2ec 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit e657481807db53dd4b87fa346b157153e201a37d +Subproject commit 3e8345b5d2ec2a2127c201c7749b9283b8daa618 From 2b48886eec2aa1bd9fa00db2a616aa9ab6601432 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 7 Feb 2018 13:38:09 -0800 Subject: [PATCH 1085/1833] [config] activate qos configuration only when buffers configuration exists (#1378) --- files/image_config/platform/rc.local | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 145ef06e355e..563ba4cee7c9 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -116,17 +116,18 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then fi HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "DEVICE_METADATA['localhost']['hwsku']"` - if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then - # merge qos configuration into init config file - sonic-cfggen -j /etc/sonic/config_db.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/config_db.json - mv /tmp/config_db.json /etc/sonic/config_db.json - fi - if [ -f /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 ]; then # generate and merge buffers configuration into config file sonic-cfggen -m -t /usr/share/sonic/device/$platform/$HWSKU/buffers.json.j2 > /tmp/buffers.json sonic-cfggen -j /etc/sonic/config_db.json -j /tmp/buffers.json --print-data > /tmp/config_db.json mv /tmp/config_db.json /etc/sonic/config_db.json + + # Only apply qos.json when buffer configuration is available. + if [ -f /usr/share/sonic/device/$platform/$HWSKU/qos.json ]; then + # merge qos configuration into init config file + sonic-cfggen -j /etc/sonic/config_db.json -j /usr/share/sonic/device/$platform/$HWSKU/qos.json --print-data > /tmp/config_db.json + mv /tmp/config_db.json /etc/sonic/config_db.json + fi fi if [ -d /host/image-$sonic_version/platform/$platform ]; then From 01362847d07f232fda3eff77eac1d0248e3e2c4f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 7 Feb 2018 17:43:33 -0800 Subject: [PATCH 1086/1833] [sonic-dbsyncd] Update submodule (#1379) --- src/sonic-dbsyncd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd index 812f2cd50f83..1be79be45131 160000 --- a/src/sonic-dbsyncd +++ b/src/sonic-dbsyncd @@ -1 +1 @@ -Subproject commit 812f2cd50f83c1b83fbfc2688752e969cd5cd6f9 +Subproject commit 1be79be45131e85b2a15af6c8188e8443996835e From e9dd064f826eb30e0d0fb78a2f5ba4b2de0be4e5 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Thu, 8 Feb 2018 17:23:28 -0800 Subject: [PATCH 1087/1833] [swss/sairedis]: update submodules (#1382) Signed-off-by: Sihui Han --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index a6b5be886bb4..c9e25ec8bf0a 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit a6b5be886bb470d8ff1baf2978bbdf1a9e8cf5e0 +Subproject commit c9e25ec8bf0aea73f45d6e46dfd5919760f450d0 diff --git a/src/sonic-swss b/src/sonic-swss index 4227beef783f..9a037b8ed328 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 4227beef783ff16c3454ffc4f46fcfc5a8ce0c07 +Subproject commit 9a037b8ed328070ee09d04e08c90ffdc0405e022 From ecf5c8d3116665807e755e6ad3f1dc2fb52d88d7 Mon Sep 17 00:00:00 2001 From: byu343 Date: Thu, 8 Feb 2018 17:43:52 -0800 Subject: [PATCH 1088/1833] ssh and snmp allow list (#1363) - Service ACL framework for Arista platforms --- build_debian.sh | 3 + dockers/docker-snmp-sv2/Dockerfile.j2 | 2 + dockers/docker-snmp-sv2/snmpd-config-updater | 132 ++++++++ dockers/docker-snmp-sv2/supervisord.conf | 9 + .../build_templates/sonic_debian_extension.j2 | 12 + .../ssh/sshd-clear-denied-sessions | 82 +++++ files/image_config/ssh/sshd-config-updater | 133 ++++++++ .../ssh/sshd-config-updater.service | 14 + rules/docker-base.mk | 1 + rules/libwrap.mk | 10 + slave.mk | 1 + src/libwrap/Makefile | 23 ++ src/libwrap/tcp_wrappers-7.6-allowlist.patch | 306 ++++++++++++++++++ 13 files changed, 728 insertions(+) create mode 100755 dockers/docker-snmp-sv2/snmpd-config-updater create mode 100755 files/image_config/ssh/sshd-clear-denied-sessions create mode 100755 files/image_config/ssh/sshd-config-updater create mode 100644 files/image_config/ssh/sshd-config-updater.service create mode 100644 rules/libwrap.mk create mode 100644 src/libwrap/Makefile create mode 100644 src/libwrap/tcp_wrappers-7.6-allowlist.patch diff --git a/build_debian.sh b/build_debian.sh index 2edb356d3d3e..033ac6ff270f 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -228,6 +228,9 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y do sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libwrap0_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 0e83b230746a..da46cb9b1cfb 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -43,6 +43,8 @@ RUN apt-get update && apt-get install -y libperl5.20 libpci3 libwrap0 \ COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["*.j2", "/usr/share/sonic/templates/"] +COPY ["snmpd-config-updater", "/usr/bin/snmpd-config-updater"] +RUN chmod +x /usr/bin/snmpd-config-updater ## Although exposing ports is not needed for host net mode, keep it for possible bridge mode EXPOSE 161/udp 162/udp diff --git a/dockers/docker-snmp-sv2/snmpd-config-updater b/dockers/docker-snmp-sv2/snmpd-config-updater new file mode 100755 index 000000000000..9f3e858bdb04 --- /dev/null +++ b/dockers/docker-snmp-sv2/snmpd-config-updater @@ -0,0 +1,132 @@ +#!/usr/bin/env python + +# Daemon that listens to updates about the source IP prefixes from which snmp access +# is allowed. In case of change, it will update the snmp configuration file accordingly. +# Also, after a change, it will notify snmpd to re-read its config file (service reload). + +import os +import re +import sys +import time +import redis + +service="snmpd" +config_file_path="/etc/snmp" +redis_key="SNMP_ALLOW_LIST" # the redis list we listen to +subscription='__keyspace@0__:%s' % redis_key +temporization_duration = 3 # how long we wait for changes to settle (ride out a bursts of changes in redis_key) +fake_infinite = 9999 # How often we wake up when nothing is going on --get_message()'s timeout has no 'infinite' value +# after these operations we may need to revisit existing ssh connections because they removed or modified existing entries +delete_operations = ["lrem", "lpop", "rpop", "blpop", "brpop", "brpoplpush", "rpoplpush", "ltrim", "del", "lset"] + +r = redis.StrictRedis(host='localhost') +p = r.pubsub() + +# If redis is not up yet, this can fail, so wait for redis to be available +while True: + try: + p.subscribe(subscription) + break + except redis.exceptions.ConnectionError: + time.sleep(3) + +# We could loose contact with redis at a later stage, in which case we will exit with +# return code -2 and supervisor will restart us, at which point we are back in the +# while loop above waiting for redis to be ready. +try: + + # By default redis does enable events, so enable them + r.config_set("notify-keyspace-events", "KAE") + + + # To update the configuration file + # + # Example config file for reference: + # root@sonic:/# cat /etc/snmp/snmpd.conf + # <...some snmp config, like udp port to use etc...> + # rocommunity public 172.20.61.0/24 + # rocommunity public 172.20.60.0/24 + # rocommunity public 127.00.00.0/8 + # <...some more snmp config...> + # root@sonic:/# + # + # snmpd.conf supports include file, like so: + # includeFile /etc/snmp/community.conf + # includeDir /etc/snmp/config.d + # which could make file massaging simpler, but even then we still deal with lines + # that have shared "masters", since some other entity controls the community strings + # part of that line. + # If other database attributes need to be written to the snmp config file, then + # it should be done by this daemon as well (sure, we could inotify on the file + # and correct it back, but that's glitchy). + + def write_configuration_file(v): + filename="%s/%s.conf" % (config_file_path, service) + filename_tmp = filename + ".tmp" + f=open(filename, "r") + snmpd_config = f.read() + f.close() + f=open(filename_tmp, "w") + this_community = "not_a_community" + for l in snmpd_config.split('\n'): + m = re.match("^(..)community (\S+)", l) + if not m: + f.write(l) + f.write("\n") + else: + if not l.startswith(this_community): # already handled community (each community is duplicated per allow entry) + this_community="%scommunity %s" % (m.group(1), m.group(2)) + if len(v): + for value in v: + f.write("%s %s\n" % (this_community, value)) + else: + f.write("%s\n" % this_community) + f.close() + os.rename(filename_tmp, filename) + os.system("kill -HUP $(pgrep snmpd) > /dev/null 2> /dev/null || :") + + # write initial configuration + write_configuration_file(r.lrange(redis_key, 0, -1)) + + # listen for changes and rewrite configuration file if needed, after some temporization + # + # How those subscribed to messages look like, for reference: + # {'pattern': None, 'type': 'subscribe', 'channel': '__keyspace@0__:SNMP_PERMIT_LIST', 'data': 1L} + # {'pattern': None, 'type': 'message', 'channel': '__keyspace@0__:SNMP_PERMIT_LIST', 'data': 'rpush'} + # {'pattern': None, 'type': 'message', 'channel': '__keyspace@0__:SNMP_PERMIT_LIST', 'data': 'lpush'} + # {'pattern': None, 'type': 'message', 'channel': '__keyspace@0__:SNMP_PERMIT_LIST', 'data': 'lrem'} + # {'pattern': None, 'type': 'message', 'channel': '__keyspace@0__:SNMP_PERMIT_LIST', 'data': 'lset'} + # {'pattern': None, 'type': 'message', 'channel': '__keyspace@0__:SNMP_PERMIT_LIST', 'data': 'del'} + + select_timeout = fake_infinite + config_changed = False + while True: + try: + m = p.get_message(timeout=select_timeout) + except Exception: + sys.exit(-2) + # temporization: no change after 'timeout' seconds -> commit any accumulated changes + if not m and config_changed: + write_configuration_file(r.lrange(redis_key, 0, -1)) + config_changed = False + select_timeout = fake_infinite + if m and m['type'] == "message": + if m['channel'] != subscription: + print "WTF: unexpected case" + continue + config_changed = True + select_timeout = temporization_duration + # some debugs for now + print "-------------------- config change: ", + if m["data"] in delete_operations: + print "DELETE" + else: + print "" + v = r.lrange(redis_key, 0, -1) + for value in v: + print value + +except redis.exceptions.ConnectionError as e: + sys.exit(-2) + + diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index d80579506100..b760d5c0453e 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -11,6 +11,15 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog +[program:snmpd-config-updater] +command=/usr/bin/snmpd-config-updater +priority=1 +autostart=true +autorestart=unexpected +startsecs=0 +stdout_logfile=syslog +stderr_logfile=syslog + [program:rsyslogd] command=/usr/sbin/rsyslogd -n priority=2 diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index a2bea7a6baa6..218386baa1af 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -224,6 +224,18 @@ if [ "$image_type" = "aboot" ]; then sudo sed -i 's/udevadm settle/udevadm settle -E \/sys\/class\/net\/eth0/' $FILESYSTEM_ROOT/etc/init.d/networking fi +# Service to update the sshd config file based on database changes +sudo cp $IMAGE_CONFIGS/ssh/sshd-config-updater.service $FILESYSTEM_ROOT/etc/systemd/system +sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/multi-user.target.wants +cd $FILESYSTEM_ROOT/etc/systemd/system/multi-user.target.wants/ +sudo ln -s ../sshd-config-updater.service sshd-config-updater.service +cd - +sudo cp $IMAGE_CONFIGS/ssh/sshd-config-updater $FILESYSTEM_ROOT/usr/bin/ +sudo chmod +x $FILESYSTEM_ROOT/usr/bin/sshd-config-updater +sudo cp $IMAGE_CONFIGS/ssh/sshd-clear-denied-sessions $FILESYSTEM_ROOT/usr/bin +sudo chmod +x $FILESYSTEM_ROOT/usr/bin/sshd-clear-denied-sessions +sudo cp src/libwrap/tcp-wrappers-7.6.q/tcpdmatch $FILESYSTEM_ROOT/usr/bin + ## copy platform rc.local sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/ diff --git a/files/image_config/ssh/sshd-clear-denied-sessions b/files/image_config/ssh/sshd-clear-denied-sessions new file mode 100755 index 000000000000..76226e7fc699 --- /dev/null +++ b/files/image_config/ssh/sshd-clear-denied-sessions @@ -0,0 +1,82 @@ +#!/usr/bin/env python + +""" +This utility will find the ip addresses of all hosts that have connected to +this device via ssh, then validate they are still in the list of allowed prefixes, +and if not kill the ssh session with a SIGHUP. +""" + +import os +import re +import subprocess + +# Run utmpdump, capture and return its output +def run_utmpdump(_utmpFilename): + devnull = file("/dev/null", "w" ) + p = subprocess.Popen(args=["utmpdump", _utmpFilename], stdout=subprocess.PIPE, stderr=devnull) + (stdout, stderr) = p.communicate() + rc = p.returncode + assert rc is not None # because p.communicate() should wait. + out = (stdout or '') + (stderr or '') + if rc: + e = SystemCommandError("%r: error code %d" % (" ".join(argv), rc)) + e.error = rc + e.output = out + raise e + return stdout + +# Run utmpdump and parse its output into a list of dicts and return that +def get_utmp_data(utmpFileName=None): + """Reads the specified utmp file. + Returns a list of dictionaries, one for each utmp entry. + All dictionary keys and values are strings + Values are right padded with spaces and may contain all + spaces if that utmp field is empty. + Dictionary keys: + "type": See UTMP_TYPE_* above + "pid": Process ID as a string + "tty": TTY (line) name - device name of tty w/o "/dev/" + "tty4": 4 char abbreivated TTY (line) name + "user": User ID + "host": Hostname for remote login, + kernel release for Run Level and Boot Time + "ipAddr": IP Address + "time": Time and date entry was made + See linux docs on utmp and utmpdemp for more info. + Example output from utmpdump: + pid tty4 user tty host ipAddr time + [7] [22953] [/238] [myname ] [pts/238 ] [example.com] [253.122.98.159 ] [Mon Dec 18 21:08:09 2017 PST] + """ + if not utmpFileName: + utmpFileName = os.environ.get( "DEFAULT_UTMP_FILE", "/var/run/utmp" ) + if not os.path.exists(utmpFileName): + return [] + output = run_utmpdump(utmpFileName) + lines = re.split("\n", output) + regExp = re.compile( + r"\[(?P" r"[^\]]*?)\s*\] \[(?P" r"[^\]]*?)\s*\] " \ + r"\[(?P" r"[^\]]*?)\s*\] \[(?P" r"[^\]]*?)\s*\] " \ + r"\[(?P" r"[^\]]*?)\s*\] \[(?P" r"[^\]]*?)\s*\] " \ + r"\[(?P" r"[^\]]*?)\s*\] \[(?P
@@ -147,6 +152,16 @@ PortChannel01 FC00::71/126 + + + PortChannel1001 + 10.0.0.57/31 + + + + PortChannel1001 + FC00::72/126 + fortyGigE0/0 @@ -193,6 +208,28 @@ fortyGigE0/8 true
+ + DeviceInterfaceLink + true + 10000 + switch-t0 + fortyGigE0/1 + true + ARISTA05T1 + Ethernet1/32 + true + + + DeviceInterfaceLink + true + 10000 + switch-t0 + fortyGigE0/2 + true + ARISTA06T1 + Ethernet1/33 + true + @@ -240,7 +277,20 @@ true true 1 - fortyGigE0/1 + Ethernet1 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + true + 1 + Ethernet2 false 0 diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index ce0177d4c158..5eace767c468 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -338,6 +338,17 @@ switch-t0 fortyGigE0/124 + + DeviceInterfaceLink + true + 10000 + switch-t0 + fortyGigE0/2 + true + ARISTA05T1 + Ethernet1/33 + true + diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 901b882f7048..37b66a27b4c4 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -79,6 +79,8 @@ def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument, True) self.assertEqual(output.strip(), "Warning: Ignoring Control Plane ACL NTP_ACL without type\n" + "Warning: ignore interface 'fortyGigE0/2' as it is not in the port_config.ini\n" + "Warning: ignore interface 'fortyGigE0/2' in DEVICE_NEIGHBOR as it is not in the port_config.ini\n" "{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}," " 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}," " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}," @@ -130,6 +132,15 @@ def test_minigraph_neighbors(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}") + def test_minigraph_extra_neighbors(self): + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v DEVICE_NEIGHBOR' + output = self.run_script(argument) + self.assertEqual(output.strip(), \ + "{'Ethernet116': {'name': 'ARISTA02T1', 'port': 'Ethernet1/1'}, " + "'Ethernet124': {'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}, " + "'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}, " + "'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}}") + 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) From 4d564688bf75aaf0ff9aae44d2a80d18ea51ed63 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 24 May 2018 16:49:24 -0700 Subject: [PATCH 1333/1833] [broadcom sai] upgrade Broadcom SAI to version 3.1.3.4-12 (#1740) Signed-off-by: Ying Xie --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 572ad5271f10..62181597e7b3 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-11_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-11_amd64.deb?sv=2015-04-05&sr=b&sig=0pctCvAKfSqT8O%2FWSMxw532XAXFsxXdKljQqWfOX8xA%3D&se=2155-03-25T07%3A23%3A41Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-12_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-12_amd64.deb?sv=2015-04-05&sr=b&sig=iK79gjz8GQnPLU8OSxgzw35MzqmxwAXQg2N%2BalLUos0%3D&se=2032-01-31T20%3A36%3A51Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-11_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-12_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-11_amd64.deb?sv=2015-04-05&sr=b&sig=IO1g%2FdcObkureizN8ZMPqISP6opZXu%2FrHostog6aIrU%3D&se=2155-03-25T08%3A13%3A34Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-12_amd64.deb?sv=2015-04-05&sr=b&sig=tSBPnK%2BK9axdPbkWP19r5ngM0ggRTWWijUIKTl8WNW0%3D&se=2032-01-31T20%3A36%3A11Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From d165a5030aae03d0a834b35dd12455dbd1381ef8 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 24 May 2018 17:31:03 -0700 Subject: [PATCH 1334/1833] [sairedis] update sairedis sub-module (#1741) Signed-off-by: Ying Xie --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index a314ac45a189..4ef45eed56a4 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit a314ac45a1899fafc913fbf6f1df83cbf5d7d069 +Subproject commit 4ef45eed56a4ec34c225d2a37cc02efc2131033b From bb6ff62a3235763f4449e05f26f5344878c48daa Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 25 May 2018 10:52:35 -0700 Subject: [PATCH 1335/1833] [service] introducing serial port watchdog service (#1743) * [rc.local] refactor platform identification code to separate function Signed-off-by: Ying Xie * [rc.local] infrastructure to take action according to installer.conf * [serial port watchdog] add service to watch serial port processes Monitor serial port processes. Kill ones stuck for too long. Signed-off-by: Ying Xie * [rc.local] start watchdog on serial port specified by installer.conf Signed-off-by: Ying Xie --- .../build_templates/sonic_debian_extension.j2 | 5 + files/image_config/platform/rc.local | 44 ++- .../serial-port-watchdog.py | 328 ++++++++++++++++++ .../serial-port-watchdog.service | 12 + 4 files changed, 385 insertions(+), 4 deletions(-) create mode 100755 files/image_config/serial-port-watchdog/serial-port-watchdog.py create mode 100644 files/image_config/serial-port-watchdog/serial-port-watchdog.service diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index d0afa4659667..3d46f09aa67a 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -154,6 +154,11 @@ sudo cp $IMAGE_CONFIGS/hostname/hostname-config.service $FILESYSTEM_ROOT/etc/sy sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostname-config.service sudo cp $IMAGE_CONFIGS/hostname/hostname-config.sh $FILESYSTEM_ROOT/usr/bin/ +# Copy serial-port-watchdog configuration scripts +sudo cp $IMAGE_CONFIGS/serial-port-watchdog/serial-port-watchdog.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable serial-port-watchdog.service +sudo cp $IMAGE_CONFIGS/serial-port-watchdog/serial-port-watchdog.py $FILESYSTEM_ROOT/usr/bin/ + # Copy updategraph script and service file sudo cp $IMAGE_CONFIGS/updategraph/updategraph.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable updategraph.service diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index de54d141ef7e..ab88b7a3f5b4 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -183,15 +183,51 @@ for x in "$@"; do done } -eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") - -if [ -f /host/image-$sonic_version/platform/firsttime ]; then - +setup_platform() +{ if [ -n "$aboot_platform" ]; then platform=$aboot_platform elif [ -n "$onie_platform" ]; then platform=$onie_platform else + platform='' + fi +} + +# Setup default values in this function before reading installer.conf +# installer.conf could override the value set in this function. +setup_platform_defaults() +{ + # Default serial port: ttyS0 + CONSOLE_DEV=0 +} + +load_platform_installer_config() +{ + INSTALLER_CFG=/usr/share/sonic/device/$platform/installer.conf + if [ -f $INSTALLER_CFG ]; then + . $INSTALLER_CFG + fi +} + +program_serial_port() +{ + sed -i "s|ttyS.|ttyS$CONSOLE_DEV|g" /etc/systemd/system/serial-port-watchdog.service + systemctl daemon-reload + systemctl restart serial-port-watchdog.service +} + +eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") + +setup_platform +setup_platform_defaults +load_platform_installer_config + +program_serial_port + +if [ -f /host/image-$sonic_version/platform/firsttime ]; then + + if [ -z "$platform" ]; then echo "Unknown sonic platform" firsttime_exit fi diff --git a/files/image_config/serial-port-watchdog/serial-port-watchdog.py b/files/image_config/serial-port-watchdog/serial-port-watchdog.py new file mode 100755 index 000000000000..15c57556d065 --- /dev/null +++ b/files/image_config/serial-port-watchdog/serial-port-watchdog.py @@ -0,0 +1,328 @@ +#!/usr/bin/env python + +from __future__ import print_function, with_statement + +import argparse +import logging +import logging.handlers +import os +import time +import signal +import socket +import sys + +from collections import namedtuple + +PRGNAME = 'serial-port-watchdog' + +DEVFS_PATH = '/dev' +PROCFS_PATH = '/proc' + +# According to procfs(5) +ProcStat = namedtuple( 'ProcStat', [ + 'pid', 'comm', 'state', 'ppid', 'pgrp', 'session', 'tty_nr', 'tpgid', + 'flags', 'minflt', 'cminflt', 'majflt', 'cmajflt', 'utime', 'stime', + 'cutime', 'cstime', 'priority', 'nice', 'num_threads', 'itrealvalue', + 'starttime', 'vsize', 'rss', 'rsslim', 'startcode', 'endcode', + 'startstack', 'kstkesp', 'kstkeip', 'signal', 'blocked', 'sigignore', + 'sigcatch', 'wchan', 'nswap', 'cnswap', 'exit_signal', 'processor', + 'rt_priority', 'policy', 'delayacct_blkio_ticks', 'guest_time', + 'cguest_time', 'start_data', 'end_data', 'start_brk', 'arg_start', + 'arg_end', 'env_start', 'env_end', 'exit_code' +] ) + +# According to procfs(5) +ProcIo = namedtuple( 'ProcIo', [ + 'rchar', 'wchar', 'syscr', 'syscw', 'read_bytes', 'write_bytes', + 'cancelled_write_bytes' +] ) + +class Process( object ): + def __init__( self, pid, path=PROCFS_PATH ): + self.pid = pid + self.path = os.path.join( path, str( pid ) ) + self.childs = [] + self.parent = None + + self.stat = None + + self.io = None + self.stack = None + self.stackStartTime = None + + def refresh( self ): + with open( os.path.join( self.path, 'stat' ) ) as f: + data = f.read().rstrip().split() + self.stat = ProcStat( *data ) + + def getStat( self, key=None ): + self.refresh() + return self.stat + + def uid( self ): + return '%s/%s' % ( self.pid, self.stat.starttime ) + + def ppid( self ): + return self.stat.ppid + + def name( self ): + with open( os.path.join( self.path, 'comm' ) ) as f: + return f.read().rstrip() + + def getTtyForFd( self, fd ): + path = os.path.join( self.path, 'fd', str( fd ) ) + if not os.path.exists( path ): + return '' + return os.readlink( path ) + + def getStack( self ): + with open( os.path.join( self.path, 'stack' ) ) as f: + return f.read() + + def getIo( self ): + with open( os.path.join( self.path, 'io' ) ) as f: + data = [ int( l.split( ': ' )[ 1 ] ) for l in f.readlines() ] + return ProcIo( *data ) + + def isUsingTty( self, tty ): + return self.getTtyForFd( 0 ).endswith( tty ) + + def checkStuck( self, content ): + stack = self.getStack() + + found = False + for match in content: + if match in stack: + found = True + break + + if not found: + self.io = None + self.stack = None + self.stackStartTime = None + return 0 + + io = self.getIo() + + if self.stack != stack or self.io != io: + self.io = io + self.stack = stack + self.stackStartTime = time.time() + return 0 + + return time.time() - self.stackStartTime + + def __repr__( self ): + return '' % self.uid() + +class ProcessMonitor( object ): + def __init__( self, path=PROCFS_PATH ): + self.path = path + self.procs = {} + self.filters = [] + self.checkers = [] + self.whitelist = [] + + def addProcessFilter( self, func, *args ): + self.filters.append( ( func, args ) ) + + def addStuckChecker( self, func, *args ): + self.checkers.append( ( func, args ) ) + + def setWhitelist( self, whitelist ): + self.whitelist = whitelist + + def shouldHandleProcess( self, proc ): + matched = False + for func, args in self.filters: + if func( proc, *args ): + matched = True + break + + if not matched: + return False + + name = proc.name() + for item in self.whitelist: + if item in name: + return False + + return True + + def getRunningPids( self ): + pids = [] + for entry in os.listdir( self.path ): + if not entry.isdigit(): + continue + pids.append( int( entry ) ) + return pids + + def killStuckProcess( self, proc, elapsed, kill, timeout ): + if not elapsed: + return + + if elapsed < timeout: + if elapsed > timeout / 2: + logging.info( 'process %d seems stuck, idle for %ds, waiting ' + 'some more time', proc.pid, elapsed ) + return + + logging.warning( 'process %d has been stuck for %d seconds, killing...', + proc.pid, elapsed ) + logging.info( 'process %d kernel stack\n%s', proc.pid, proc.stack ) + if kill: + # XXX: SIGTERM sleep then if alive SIGKILL ? + os.kill( proc.pid, signal.SIGKILL ) + + def killStuckProcesses( self, kill, timeout ): + for proc in self.procs.values(): + for checker, args in self.checkers: + elapsed = checker( proc, *args ) + self.killStuckProcess( proc, elapsed, kill, timeout ) + + def updatePid( self, pid ): + p = Process( pid ) + + # if the process is already monitored (previously running) + r = self.procs.get( pid, None ) + if r: + p.refresh() + # if the process is still running + if p.uid() == r.uid(): + logging.debug( 'process %d still running', pid ) + return + # or the pid was reused but the process is different + logging.debug( 'pid %d reused for another process', pid ) + del self.procs[ pid ] + + # check if the process is relevant for monitoring + if not self.shouldHandleProcess( p ): + return + + logging.debug( 'watching process %d', pid ) + p.refresh() + self.procs[ pid ] = p + + def updateParenting( self ): + # clear parent and childs for monitored processes + for proc in self.procs.values(): + del proc.childs[:] + proc.parent = None + + # set parent and childs for monitored processes + for proc in self.procs.values(): + ppid = proc.ppid() + parent = self.procs.get( ppid, None ) + if parent: + proc.parent = parent + parent.childs.append( proc ) + + def update( self ): + pids = self.getRunningPids() + + # remove defunct processes + for pid in list(self.procs.keys()): + if pid not in pids: + logging.debug( 'process %d is defunct', pid ) + del self.procs[ pid ] + + # create or update running processes information + for pid in pids: + try: + self.updatePid( pid ) + except: + logging.warning( 'An issue occured whileupdating process %s', + pid ) + raise + + #self.updateParenting() + +def checkRootPermissions(): + if os.geteuid() != 0: + logging.error( 'You must be root to use this feature' ) + sys.exit( 1 ) + +def getHostname(): + try: + return socket.gethostname() + except: + return 'localhost' + +def setupLogging( verbose=False ): + loglevel = logging.DEBUG if verbose else logging.INFO + dateFmt = '%Y-%m-%d %H:%M:%S' + + log = logging.getLogger() + log.setLevel( logging.DEBUG ) + + logOut = logging.StreamHandler( sys.stdout ) + logOut.setFormatter( logging.Formatter( '%(levelname)s: %(message)s' ) ) + logOut.setLevel( loglevel ) + log.addHandler( logOut ) + + logSys = logging.handlers.SysLogHandler() + # format to rfc5424 format + fmt = '{} {}: %(message)s'.format( getHostname(), PRGNAME ) + logSys.setFormatter( logging.Formatter( fmt ) ) + logSys.setLevel( logging.WARNING ) + log.addHandler( logSys ) + try: + # the connection to the syslog socket happens with the first message + log.info( 'Attaching to syslog' ) + except: + log.warning( 'Failed open syslog' ) + +def listParser( value ): + if not value.strip(): + return [] + return value.split( ',' ) + +def ttyParser( dev, path=DEVFS_PATH ): + if not dev.startswith( DEVFS_PATH ): + dev = os.path.join( DEVFS_PATH, dev ) + if not os.path.exists( dev ): + raise argparse.ArgumentTypeError( '%s is not a device' % dev ) + return dev + +def parseArgs( args ): + parser = argparse.ArgumentParser() + + parser.add_argument( '-d', '--dry-run', action='store_true', + help='only print processes that would be killed' ) + parser.add_argument( '-f', '--funcs', default=[ 'tty_' ], type=listParser, + help='functions to look for in the stack trace' ) + parser.add_argument( '-i', '--interval', default=60, type=float, + help='interval at which to check the procfs' ) + parser.add_argument( '-k', '--timeout', default=3600, type=float, + help='timeout for which a process gets killed' ) + parser.add_argument( '-t', '--tty', default='ttyS0', type=ttyParser, + help='tty to check for stuck process' ) + parser.add_argument( '-v', '--verbose', action='store_true', + help='print all debug messages' ) + parser.add_argument( '-w', '--whitelist', default=[ 'agetty' ], type=listParser, + help='whitelist programs that should never be killed' ) + + return parser.parse_args( args ) + +def main( args ): + args = parseArgs( args ) + + setupLogging( args.verbose ) + checkRootPermissions() + + m = ProcessMonitor() + m.addProcessFilter( Process.isUsingTty, args.tty ) + m.addStuckChecker( Process.checkStuck, args.funcs ) + m.setWhitelist( args.whitelist ) + + while True: + logging.debug( 'updating processes' ) + m.update() + m.killStuckProcesses( kill=( not args.dry_run ), timeout=args.timeout ) + time.sleep( args.interval ) + + return 0 + +if __name__ == '__main__': + sys.exit( main( sys.argv[ 1: ] ) ) + diff --git a/files/image_config/serial-port-watchdog/serial-port-watchdog.service b/files/image_config/serial-port-watchdog/serial-port-watchdog.service new file mode 100644 index 000000000000..b86580ec2767 --- /dev/null +++ b/files/image_config/serial-port-watchdog/serial-port-watchdog.service @@ -0,0 +1,12 @@ +[Unit] +Description=Monitor serial port processes, kill stuck ones +Requires= +After=rc.local.Service + +[Service] +ExecStart=/usr/bin/serial-port-watchdog.py -t ttyS0 +Restart=always +RestartSec=0 + +[Install] +WantedBy=multi-user.target From 46c2d340ff51547442c233c4bbbdeb76ce3c6d67 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 25 May 2018 20:04:08 -0700 Subject: [PATCH 1336/1833] [docker_image_ctl]: Add --force while removing obsolete dockers (#1744) --- files/build_templates/docker_image_ctl.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index b17c70b4a9d2..1216013e63c2 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -52,7 +52,7 @@ start() { # docker created with a different HWSKU, remove and recreate echo "Removing obsolete {{docker_container_name}} container with HWSKU $DOCKERMOUNT" - docker rm {{docker_container_name}} + docker rm -f {{docker_container_name}} fi {%- if docker_container_name == "database" %} From a917517f60a0e3771421f5ec3e661ae865f04c86 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sun, 27 May 2018 00:43:36 +0800 Subject: [PATCH 1337/1833] [minigraph parser] Fix minigraph parser issue when handling LAG related ACL table configuration (#1712) * Fix minigraph parser issue when handling LAG related ACL table configuration * rephrase the warning message. * pick up swss change in https://github.com/Azure/sonic-swss/pull/494 --- src/sonic-config-engine/minigraph.py | 20 +++++++++++++++++--- src/sonic-config-engine/tests/test_cfggen.py | 2 +- src/sonic-swss | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 595915d9bee9..a8140408e97f 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -149,12 +149,15 @@ def parse_dpg(dpg, hname): pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) pc_intfs = [] pcs = {} + intfs_inpc = [] # List to hold all the LAG member interfaces for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): pcintfname = pcintf.find(str(QName(ns, "Name"))).text pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text pcmbr_list = pcintfmbr.split(';') + pc_intfs.append(pcintfname) for i, member in enumerate(pcmbr_list): pcmbr_list[i] = port_alias_map.get(member, member) + intfs_inpc.append(pcmbr_list[i]) if pcintf.find(str(QName(ns, "Fallback"))) != None: pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text} else: @@ -202,15 +205,26 @@ def parse_dpg(dpg, hname): for member in aclattach: member = member.strip() if pcs.has_key(member): - acl_intfs.extend(pcs[member]['members']) # For ACL attaching to port channels, we break them into port channel members + # If try to attach ACL to a LAG interface then we shall add the LAG to + # to acl_intfs directly instead of break it into member ports, ACL attach + # to LAG will be applied to all the LAG members internally by SAI/SDK + acl_intfs.append(member) elif vlans.has_key(member): print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a Vlan interface, which is currently not supported" elif port_alias_map.has_key(member): acl_intfs.append(port_alias_map[member]) + # Give a warning if trying to attach ACL to a LAG member interface, correct way is to attach ACL to the LAG interface + if port_alias_map[member] in intfs_inpc: + print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface" elif member.lower() == 'erspan': is_mirror = True; - # Erspan session will be attached to all front panel ports - acl_intfs = port_alias_map.values() + # Erspan session will be attached to all front panel ports, + # if panel ports is a member port of LAG, should add the LAG + # to acl table instead of the panel ports + acl_intfs = pc_intfs + for panel_port in port_alias_map.values(): + if panel_port not in intfs_inpc: + acl_intfs.append(panel_port) break; if acl_intfs: acls[aclname] = {'policy_desc': aclname, diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 37b66a27b4c4..d88f0525d546 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -83,7 +83,7 @@ def test_minigraph_acl(self): "Warning: ignore interface 'fortyGigE0/2' in DEVICE_NEIGHBOR as it is not in the port_config.ini\n" "{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}," " 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}," - " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}," + " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04']}," " 'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL'}," " 'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}}") diff --git a/src/sonic-swss b/src/sonic-swss index 7331f922de7a..4df9c289a6c2 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 7331f922de7af71b0f40d8b2bdd2e1d30fcba6b0 +Subproject commit 4df9c289a6c2d41e4dee09f3055f0ac6d8e98ded From 225b3e5b9155792c542255ad3d6a5b29f4f41eb7 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 29 May 2018 13:46:25 -0700 Subject: [PATCH 1338/1833] Fix a bug that default graph might be missing when generating minimal config (#1747) --- files/image_config/updategraph/updategraph | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index f0cea0894a9c..96827f09f97f 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -106,6 +106,9 @@ if [ "$src" = "dhcp" ]; then fi if [ "`cat /tmp/dhcp_graph_url`" = "N/A" ]; then echo "'N/A' found in DHCP response. Skipping graph update and generating an empty configuration." + if [ ! -f /etc/sonic/minigraph.xml ]; then + copy_default_minigraph + fi echo '{"DEVICE_METADATA":' > /tmp/device_meta.json sonic-cfggen -H -m /etc/sonic/minigraph.xml --var-json DEVICE_METADATA >> /tmp/device_meta.json echo '}' >> /tmp/device_meta.json From 2d7046c410558a4c1de86bf2def7163a39fb5eb8 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 30 May 2018 09:24:05 +0300 Subject: [PATCH 1339/1833] Add QoS and Buffers configs for Mellanox MSN2100 and MSN2410 (#1739) * Add QoS and Buffers config for Mellanox MSN2410 Signed-off-by: Andriy Moroz * Add QoS and Buffers config for Mellanox MSN2100 Signed-off-by: Andriy Moroz --- .../ACS-MSN2100/buffers.json.j2 | 1 + .../ACS-MSN2100/buffers_defaults_t0.j2 | 1 + .../ACS-MSN2100/buffers_defaults_t1.j2 | 1 + .../ACS-MSN2100/pg_profile_lookup.ini | 17 ++ .../ACS-MSN2100/qos.json | 165 ++++++++++++++++++ .../ACS-MSN2410/buffers.json.j2 | 1 + .../ACS-MSN2410/buffers_defaults_t0.j2 | 1 + .../ACS-MSN2410/buffers_defaults_t1.j2 | 1 + .../ACS-MSN2410/pg_profile_lookup.ini | 17 ++ .../ACS-MSN2410/qos.json | 165 ++++++++++++++++++ 10 files changed, 370 insertions(+) create mode 120000 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t0.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t1.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json create mode 120000 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t0.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t1.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers.json.j2 new file mode 120000 index 000000000000..add8bf8bb7c2 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..7bcae62336f6 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..a437d613434d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json new file mode 100644 index 000000000000..74045469dbfd --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json @@ -0,0 +1,165 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers.json.j2 new file mode 120000 index 000000000000..add8bf8bb7c2 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..7bcae62336f6 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..a437d613434d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json new file mode 100644 index 000000000000..95652cf96f4e --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json @@ -0,0 +1,165 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} From c1057177d9488cb1ad119efeb97ddcd7c400967c Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 30 May 2018 18:29:43 -0700 Subject: [PATCH 1340/1833] [serial watchdog] remove serial watchdog service dependency to rc.local (#1752) * [serial watchdog] remove serial watchdog service dependency to rc.local When restarting this service in rc.local, the dependency causes an error in syslog. Removing the dependency to mute the error log entry. * remove lines with empty inputs --- .../serial-port-watchdog/serial-port-watchdog.service | 2 -- 1 file changed, 2 deletions(-) diff --git a/files/image_config/serial-port-watchdog/serial-port-watchdog.service b/files/image_config/serial-port-watchdog/serial-port-watchdog.service index b86580ec2767..1fcb15a103a5 100644 --- a/files/image_config/serial-port-watchdog/serial-port-watchdog.service +++ b/files/image_config/serial-port-watchdog/serial-port-watchdog.service @@ -1,7 +1,5 @@ [Unit] Description=Monitor serial port processes, kill stuck ones -Requires= -After=rc.local.Service [Service] ExecStart=/usr/bin/serial-port-watchdog.py -t ttyS0 From a6d2d777c478c076f313a72c2e0b407c279dbcfd Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 31 May 2018 18:38:12 -0700 Subject: [PATCH 1341/1833] Fix links of debian git server (#1755) --- src/initramfs-tools/Makefile | 2 +- src/isc-dhcp/Makefile | 2 +- src/libnl3/Makefile | 2 +- src/libteam/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/initramfs-tools/Makefile b/src/initramfs-tools/Makefile index 95d5c24d1185..c5010e876d8b 100644 --- a/src/initramfs-tools/Makefile +++ b/src/initramfs-tools/Makefile @@ -7,7 +7,7 @@ MAIN_TARGET = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the initramfs-tools rm -rf ./initramfs-tools - git clone --branch v0.120 https://anonscm.debian.org/git/kernel/initramfs-tools.git ./initramfs-tools + git clone --branch v0.120 https://salsa.debian.org/kernel-team/initramfs-tools.git ./initramfs-tools # Patch pushd ./initramfs-tools diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index 5b1cb8407005..ce4fbc62608f 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -10,7 +10,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./isc-dhcp # Clone isc-dhcp repo - git clone https://anonscm.debian.org/cgit/pkg-dhcp/isc-dhcp.git + git clone https://salsa.debian.org/berni/isc-dhcp.git pushd ./isc-dhcp # Reset HEAD to the commit of the proper tag diff --git a/src/libnl3/Makefile b/src/libnl3/Makefile index efd234424dff..6f50e4e389fa 100644 --- a/src/libnl3/Makefile +++ b/src/libnl3/Makefile @@ -16,7 +16,7 @@ DERIVED_TARGETS = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb \ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the libnl3 rm -rf ./libnl3 - git clone https://anonscm.debian.org/git/collab-maint/libnl3.git + git clone https://github.com/qiluo-msft/libnl3.git pushd ./libnl3 git checkout -f b77c0e49cb diff --git a/src/libteam/Makefile b/src/libteam/Makefile index c96266a5c7fd..a20f8dbd35b0 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -22,7 +22,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : popd # Obtain debian packaging - git clone https://anonscm.debian.org/git/collab-maint/libteam.git tmp + git clone https://salsa.debian.org/debian/libteam.git tmp pushd ./tmp git checkout -f da006f2 # v1.26 popd From 54046d4d47b721b713ce4ae0275b9c3790ad2bed Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Fri, 1 Jun 2018 02:59:29 -0700 Subject: [PATCH 1342/1833] [devices]: change S6100 to use new ECN/WRED config (#1749) Signed-off-by: Wenda --- .../Force10-S6100/qos.json | 30 ++++++------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json index 99642cf8cf4c..e3a84924fd15 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" From e7d17c0a2bce4560c3b267cdc46d930ca34bfe88 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 1 Jun 2018 08:13:58 -0700 Subject: [PATCH 1343/1833] [broadcom]: update brcm sai to 3.1.3.4-13 (#1760) Signed-off-by: Guohan Lu --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 62181597e7b3..0012e8a8106a 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-12_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-12_amd64.deb?sv=2015-04-05&sr=b&sig=iK79gjz8GQnPLU8OSxgzw35MzqmxwAXQg2N%2BalLUos0%3D&se=2032-01-31T20%3A36%3A51Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-13_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-13_amd64.deb?sv=2015-04-05&sr=b&sig=Y7mQMOnQEzwb%2FG%2BY9dcEX0Y9tQBDCK2UmF4TjIz3Zn8%3D&se=2155-04-24T09%3A52%3A42Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-12_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-13_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-12_amd64.deb?sv=2015-04-05&sr=b&sig=tSBPnK%2BK9axdPbkWP19r5ngM0ggRTWWijUIKTl8WNW0%3D&se=2032-01-31T20%3A36%3A11Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-13_amd64.deb?sv=2015-04-05&sr=b&sig=YYjwAt47PlCYJgW0RtEsdcmGAc52UdAzHEd5qVKImxc%3D&se=2155-04-24T09%3A53%3A45Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From b58a94dc53e1c40927a27db50625fb25a27b8ba6 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 1 Jun 2018 11:33:13 -0700 Subject: [PATCH 1344/1833] [sonic-mgmt]: Install the latest Microsoft Azure Kusto Library for Python (#1756) https://github.com/Azure/azure-kusto-python azure-kusto-data Package provides the capability to query Kusto clusters with Python. azure-kusto-ingest Package allows sending data to Kusto service - i.e. ingest data. The removed package adal is a dependent of the Azure Kusto Library. The removed azure-storage is deprecated and being replaced with new packages that are also the dependents of the Azure Kusto Library. (https://github.com/Azure/azure-storage-python) Signed-off-by: Shu0T1an ChenG --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index c2f600c3c963..9396c7e56c0c 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -43,11 +43,11 @@ RUN pip install ipaddr \ pysnmp==4.2.5 \ jinja2==2.7.2 \ cffi==1.10.0 \ - paramiko==2.1.2 \ - adal + paramiko==2.1.2 -# Install Azure Storage package -RUN pip install azure-storage +# Install Microsoft Azure Kusto Library for Python +RUN pip install azure-kusto-data \ + azure-kusto-ingest ## Copy and install sonic-mgmt docker dependencies COPY \ From d54a7ae566bc69d70a7637d73a48ca14c7dd15d3 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 4 Jun 2018 21:01:53 -0700 Subject: [PATCH 1345/1833] [baseimage] Adding setuid permissions to ping binaries, so sudo is no longer needed (#1765) --- build_debian.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index fa461a7ca415..c5b395653ec2 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -239,6 +239,12 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libwrap0_*.deb || \ ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec +## 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 +## TODO: remove workaround when the overlay filesystem support extended attributes +sudo chmod u+s $FILESYSTEM_ROOT/bin/ping{,6} + ## Remove sshd host keys, and will regenerate on first sshd start sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* sudo cp files/sshd/host-ssh-keygen.sh $FILESYSTEM_ROOT/usr/local/bin/ From eee36719ea0ce386c586f4a6b611e50c4a752b7b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 4 Jun 2018 21:06:58 -0700 Subject: [PATCH 1346/1833] Revert the feature: serial port watchdog service (#1766) * Revert "[serial watchdog] remove serial watchdog service dependency to rc.local (#1752)" * Revert "[service] introducing serial port watchdog service (#1743)" --- .../build_templates/sonic_debian_extension.j2 | 5 - files/image_config/platform/rc.local | 44 +-- .../serial-port-watchdog.py | 328 ------------------ .../serial-port-watchdog.service | 10 - 4 files changed, 4 insertions(+), 383 deletions(-) delete mode 100755 files/image_config/serial-port-watchdog/serial-port-watchdog.py delete mode 100644 files/image_config/serial-port-watchdog/serial-port-watchdog.service diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 3d46f09aa67a..d0afa4659667 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -154,11 +154,6 @@ sudo cp $IMAGE_CONFIGS/hostname/hostname-config.service $FILESYSTEM_ROOT/etc/sy sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostname-config.service sudo cp $IMAGE_CONFIGS/hostname/hostname-config.sh $FILESYSTEM_ROOT/usr/bin/ -# Copy serial-port-watchdog configuration scripts -sudo cp $IMAGE_CONFIGS/serial-port-watchdog/serial-port-watchdog.service $FILESYSTEM_ROOT/etc/systemd/system/ -sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable serial-port-watchdog.service -sudo cp $IMAGE_CONFIGS/serial-port-watchdog/serial-port-watchdog.py $FILESYSTEM_ROOT/usr/bin/ - # Copy updategraph script and service file sudo cp $IMAGE_CONFIGS/updategraph/updategraph.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable updategraph.service diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index ab88b7a3f5b4..de54d141ef7e 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -183,51 +183,15 @@ for x in "$@"; do done } -setup_platform() -{ +eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") + +if [ -f /host/image-$sonic_version/platform/firsttime ]; then + if [ -n "$aboot_platform" ]; then platform=$aboot_platform elif [ -n "$onie_platform" ]; then platform=$onie_platform else - platform='' - fi -} - -# Setup default values in this function before reading installer.conf -# installer.conf could override the value set in this function. -setup_platform_defaults() -{ - # Default serial port: ttyS0 - CONSOLE_DEV=0 -} - -load_platform_installer_config() -{ - INSTALLER_CFG=/usr/share/sonic/device/$platform/installer.conf - if [ -f $INSTALLER_CFG ]; then - . $INSTALLER_CFG - fi -} - -program_serial_port() -{ - sed -i "s|ttyS.|ttyS$CONSOLE_DEV|g" /etc/systemd/system/serial-port-watchdog.service - systemctl daemon-reload - systemctl restart serial-port-watchdog.service -} - -eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") - -setup_platform -setup_platform_defaults -load_platform_installer_config - -program_serial_port - -if [ -f /host/image-$sonic_version/platform/firsttime ]; then - - if [ -z "$platform" ]; then echo "Unknown sonic platform" firsttime_exit fi diff --git a/files/image_config/serial-port-watchdog/serial-port-watchdog.py b/files/image_config/serial-port-watchdog/serial-port-watchdog.py deleted file mode 100755 index 15c57556d065..000000000000 --- a/files/image_config/serial-port-watchdog/serial-port-watchdog.py +++ /dev/null @@ -1,328 +0,0 @@ -#!/usr/bin/env python - -from __future__ import print_function, with_statement - -import argparse -import logging -import logging.handlers -import os -import time -import signal -import socket -import sys - -from collections import namedtuple - -PRGNAME = 'serial-port-watchdog' - -DEVFS_PATH = '/dev' -PROCFS_PATH = '/proc' - -# According to procfs(5) -ProcStat = namedtuple( 'ProcStat', [ - 'pid', 'comm', 'state', 'ppid', 'pgrp', 'session', 'tty_nr', 'tpgid', - 'flags', 'minflt', 'cminflt', 'majflt', 'cmajflt', 'utime', 'stime', - 'cutime', 'cstime', 'priority', 'nice', 'num_threads', 'itrealvalue', - 'starttime', 'vsize', 'rss', 'rsslim', 'startcode', 'endcode', - 'startstack', 'kstkesp', 'kstkeip', 'signal', 'blocked', 'sigignore', - 'sigcatch', 'wchan', 'nswap', 'cnswap', 'exit_signal', 'processor', - 'rt_priority', 'policy', 'delayacct_blkio_ticks', 'guest_time', - 'cguest_time', 'start_data', 'end_data', 'start_brk', 'arg_start', - 'arg_end', 'env_start', 'env_end', 'exit_code' -] ) - -# According to procfs(5) -ProcIo = namedtuple( 'ProcIo', [ - 'rchar', 'wchar', 'syscr', 'syscw', 'read_bytes', 'write_bytes', - 'cancelled_write_bytes' -] ) - -class Process( object ): - def __init__( self, pid, path=PROCFS_PATH ): - self.pid = pid - self.path = os.path.join( path, str( pid ) ) - self.childs = [] - self.parent = None - - self.stat = None - - self.io = None - self.stack = None - self.stackStartTime = None - - def refresh( self ): - with open( os.path.join( self.path, 'stat' ) ) as f: - data = f.read().rstrip().split() - self.stat = ProcStat( *data ) - - def getStat( self, key=None ): - self.refresh() - return self.stat - - def uid( self ): - return '%s/%s' % ( self.pid, self.stat.starttime ) - - def ppid( self ): - return self.stat.ppid - - def name( self ): - with open( os.path.join( self.path, 'comm' ) ) as f: - return f.read().rstrip() - - def getTtyForFd( self, fd ): - path = os.path.join( self.path, 'fd', str( fd ) ) - if not os.path.exists( path ): - return '' - return os.readlink( path ) - - def getStack( self ): - with open( os.path.join( self.path, 'stack' ) ) as f: - return f.read() - - def getIo( self ): - with open( os.path.join( self.path, 'io' ) ) as f: - data = [ int( l.split( ': ' )[ 1 ] ) for l in f.readlines() ] - return ProcIo( *data ) - - def isUsingTty( self, tty ): - return self.getTtyForFd( 0 ).endswith( tty ) - - def checkStuck( self, content ): - stack = self.getStack() - - found = False - for match in content: - if match in stack: - found = True - break - - if not found: - self.io = None - self.stack = None - self.stackStartTime = None - return 0 - - io = self.getIo() - - if self.stack != stack or self.io != io: - self.io = io - self.stack = stack - self.stackStartTime = time.time() - return 0 - - return time.time() - self.stackStartTime - - def __repr__( self ): - return '' % self.uid() - -class ProcessMonitor( object ): - def __init__( self, path=PROCFS_PATH ): - self.path = path - self.procs = {} - self.filters = [] - self.checkers = [] - self.whitelist = [] - - def addProcessFilter( self, func, *args ): - self.filters.append( ( func, args ) ) - - def addStuckChecker( self, func, *args ): - self.checkers.append( ( func, args ) ) - - def setWhitelist( self, whitelist ): - self.whitelist = whitelist - - def shouldHandleProcess( self, proc ): - matched = False - for func, args in self.filters: - if func( proc, *args ): - matched = True - break - - if not matched: - return False - - name = proc.name() - for item in self.whitelist: - if item in name: - return False - - return True - - def getRunningPids( self ): - pids = [] - for entry in os.listdir( self.path ): - if not entry.isdigit(): - continue - pids.append( int( entry ) ) - return pids - - def killStuckProcess( self, proc, elapsed, kill, timeout ): - if not elapsed: - return - - if elapsed < timeout: - if elapsed > timeout / 2: - logging.info( 'process %d seems stuck, idle for %ds, waiting ' - 'some more time', proc.pid, elapsed ) - return - - logging.warning( 'process %d has been stuck for %d seconds, killing...', - proc.pid, elapsed ) - logging.info( 'process %d kernel stack\n%s', proc.pid, proc.stack ) - if kill: - # XXX: SIGTERM sleep then if alive SIGKILL ? - os.kill( proc.pid, signal.SIGKILL ) - - def killStuckProcesses( self, kill, timeout ): - for proc in self.procs.values(): - for checker, args in self.checkers: - elapsed = checker( proc, *args ) - self.killStuckProcess( proc, elapsed, kill, timeout ) - - def updatePid( self, pid ): - p = Process( pid ) - - # if the process is already monitored (previously running) - r = self.procs.get( pid, None ) - if r: - p.refresh() - # if the process is still running - if p.uid() == r.uid(): - logging.debug( 'process %d still running', pid ) - return - # or the pid was reused but the process is different - logging.debug( 'pid %d reused for another process', pid ) - del self.procs[ pid ] - - # check if the process is relevant for monitoring - if not self.shouldHandleProcess( p ): - return - - logging.debug( 'watching process %d', pid ) - p.refresh() - self.procs[ pid ] = p - - def updateParenting( self ): - # clear parent and childs for monitored processes - for proc in self.procs.values(): - del proc.childs[:] - proc.parent = None - - # set parent and childs for monitored processes - for proc in self.procs.values(): - ppid = proc.ppid() - parent = self.procs.get( ppid, None ) - if parent: - proc.parent = parent - parent.childs.append( proc ) - - def update( self ): - pids = self.getRunningPids() - - # remove defunct processes - for pid in list(self.procs.keys()): - if pid not in pids: - logging.debug( 'process %d is defunct', pid ) - del self.procs[ pid ] - - # create or update running processes information - for pid in pids: - try: - self.updatePid( pid ) - except: - logging.warning( 'An issue occured whileupdating process %s', - pid ) - raise - - #self.updateParenting() - -def checkRootPermissions(): - if os.geteuid() != 0: - logging.error( 'You must be root to use this feature' ) - sys.exit( 1 ) - -def getHostname(): - try: - return socket.gethostname() - except: - return 'localhost' - -def setupLogging( verbose=False ): - loglevel = logging.DEBUG if verbose else logging.INFO - dateFmt = '%Y-%m-%d %H:%M:%S' - - log = logging.getLogger() - log.setLevel( logging.DEBUG ) - - logOut = logging.StreamHandler( sys.stdout ) - logOut.setFormatter( logging.Formatter( '%(levelname)s: %(message)s' ) ) - logOut.setLevel( loglevel ) - log.addHandler( logOut ) - - logSys = logging.handlers.SysLogHandler() - # format to rfc5424 format - fmt = '{} {}: %(message)s'.format( getHostname(), PRGNAME ) - logSys.setFormatter( logging.Formatter( fmt ) ) - logSys.setLevel( logging.WARNING ) - log.addHandler( logSys ) - try: - # the connection to the syslog socket happens with the first message - log.info( 'Attaching to syslog' ) - except: - log.warning( 'Failed open syslog' ) - -def listParser( value ): - if not value.strip(): - return [] - return value.split( ',' ) - -def ttyParser( dev, path=DEVFS_PATH ): - if not dev.startswith( DEVFS_PATH ): - dev = os.path.join( DEVFS_PATH, dev ) - if not os.path.exists( dev ): - raise argparse.ArgumentTypeError( '%s is not a device' % dev ) - return dev - -def parseArgs( args ): - parser = argparse.ArgumentParser() - - parser.add_argument( '-d', '--dry-run', action='store_true', - help='only print processes that would be killed' ) - parser.add_argument( '-f', '--funcs', default=[ 'tty_' ], type=listParser, - help='functions to look for in the stack trace' ) - parser.add_argument( '-i', '--interval', default=60, type=float, - help='interval at which to check the procfs' ) - parser.add_argument( '-k', '--timeout', default=3600, type=float, - help='timeout for which a process gets killed' ) - parser.add_argument( '-t', '--tty', default='ttyS0', type=ttyParser, - help='tty to check for stuck process' ) - parser.add_argument( '-v', '--verbose', action='store_true', - help='print all debug messages' ) - parser.add_argument( '-w', '--whitelist', default=[ 'agetty' ], type=listParser, - help='whitelist programs that should never be killed' ) - - return parser.parse_args( args ) - -def main( args ): - args = parseArgs( args ) - - setupLogging( args.verbose ) - checkRootPermissions() - - m = ProcessMonitor() - m.addProcessFilter( Process.isUsingTty, args.tty ) - m.addStuckChecker( Process.checkStuck, args.funcs ) - m.setWhitelist( args.whitelist ) - - while True: - logging.debug( 'updating processes' ) - m.update() - m.killStuckProcesses( kill=( not args.dry_run ), timeout=args.timeout ) - time.sleep( args.interval ) - - return 0 - -if __name__ == '__main__': - sys.exit( main( sys.argv[ 1: ] ) ) - diff --git a/files/image_config/serial-port-watchdog/serial-port-watchdog.service b/files/image_config/serial-port-watchdog/serial-port-watchdog.service deleted file mode 100644 index 1fcb15a103a5..000000000000 --- a/files/image_config/serial-port-watchdog/serial-port-watchdog.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Monitor serial port processes, kill stuck ones - -[Service] -ExecStart=/usr/bin/serial-port-watchdog.py -t ttyS0 -Restart=always -RestartSec=0 - -[Install] -WantedBy=multi-user.target From 711be8f7da49c7d5c7d3ef4ff6cfc7685aa884b4 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 5 Jun 2018 03:24:30 -0700 Subject: [PATCH 1347/1833] [caclmgrd] Heuristically determine whether ACL is IPv4 or IPv6, use iptables/ip6tables accordingly (#1767) * [caclmgrd] Heuristically determine whether ACL is IPv4 or IPv6, use iptables/ip6tables accordingly * Check all rules in table until we find one with a SRC_IP --- files/image_config/caclmgrd/caclmgrd | 31 +++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/files/image_config/caclmgrd/caclmgrd b/files/image_config/caclmgrd/caclmgrd index dee85d2e26ed..0dc59766b3d5 100755 --- a/files/image_config/caclmgrd/caclmgrd +++ b/files/image_config/caclmgrd/caclmgrd @@ -11,6 +11,7 @@ # try: + import ipaddr as ipaddress import os import subprocess import sys @@ -113,12 +114,22 @@ class ControlPlaneAclManager(object): # Add iptables command to delete all non-default chains iptables_cmds.append("iptables -X") + # Add same set of commands for ip6tables + iptables_cmds.append("ip6tables -P INPUT ACCEPT") + iptables_cmds.append("ip6tables -P FORWARD ACCEPT") + iptables_cmds.append("ip6tables -P OUTPUT ACCEPT") + iptables_cmds.append("ip6tables -F") + iptables_cmds.append("ip6tables -X") + # Get current ACL tables and rules from Config DB self._tables_db_info = self.config_db.get_table(self.ACL_TABLE) self._rules_db_info = self.config_db.get_table(self.ACL_RULE) # Walk the ACL tables for (table_name, table_data) in self._tables_db_info.iteritems(): + + table_ip_version = None + # Ignore non-control-plane ACL tables if table_data["type"] != self.ACL_TABLE_TYPE_CTRLPLANE: continue @@ -144,6 +155,23 @@ class ControlPlaneAclManager(object): if rule_table_name == table_name: acl_rules[rule_props["PRIORITY"]] = rule_props + # 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 + # src IP is an IPv4 or IPv6 address. + if not table_ip_version and "SRC_IP" in rule_props and rule_props["SRC_IP"]: + ip_addr = ipaddress.IPAddress(rule_props["SRC_IP"].split("/")[0]) + if isinstance(ip_addr, ipaddress.IPv6Address): + table_ip_version = 6 + elif isinstance(ip_addr, ipaddress.IPv4Address): + table_ip_version = 4 + + # If we were unable to determine whether this ACL table contains + # IPv4 or IPv6 rules, log a message and skip processing this table. + if not table_ip_version: + log_warning("Unable to determine if ACL table '{}' contains IPv4 or IPv6 rules. Skipping table..." + .format(table_name)) + continue + # For each ACL rule in this table (in descending order of priority) for priority in sorted(acl_rules.iterkeys(), reverse=True): rule_props = acl_rules[priority] @@ -155,7 +183,8 @@ class ControlPlaneAclManager(object): # Apply the rule to the default protocol(s) for this ACL service for ip_protocol in ip_protocols: for dst_port in dst_ports: - rule_cmd = "iptables -A INPUT -p {}".format(ip_protocol) + rule_cmd = "ip6tables" if table_ip_version == 6 else "iptables" + rule_cmd += " -A INPUT -p {}".format(ip_protocol) if "SRC_IP" in rule_props and rule_props["SRC_IP"]: rule_cmd += " -s {}".format(rule_props["SRC_IP"]) From 0ff7ba69f7038f4dcd1940e7f82254494c5fac21 Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Wed, 6 Jun 2018 20:05:46 +0300 Subject: [PATCH 1348/1833] [sai.profile] move hwsku specific device configs to device/mellanox/platform/hwsku (#1768) --- .../LS-SN2700/sai.profile | 2 +- .../LS-SN2700/sai_2700.xml | 243 +++++++++++ .../ACS-MSN2100/sai.profile | 2 +- .../ACS-MSN2100/sai_2100.xml | 131 ++++++ .../ACS-MSN2410/sai.profile | 2 +- .../ACS-MSN2410/sai_2410.xml | 411 ++++++++++++++++++ .../ACS-MSN2700/sai.profile | 2 +- .../ACS-MSN2700/sai_2700.xml | 243 +++++++++++ .../ACS-MSN2740/sai.profile | 2 +- .../ACS-MSN2740/sai_2740.xml | 243 +++++++++++ 10 files changed, 1276 insertions(+), 5 deletions(-) create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile index 9a9a38aeb068..696f3d8182f9 100644 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2700.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700.xml diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml new file mode 100644 index 000000000000..7831c9cf59d0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml @@ -0,0 +1,243 @@ + + + + + + 00:02:03:04:05:00 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 98368 + + + 3 + 4 + 17 + 1 + 98368 + + + 5 + 4 + 18 + 3 + 98368 + + + 7 + 4 + 19 + 1 + 98368 + + + 9 + 4 + 20 + 3 + 98368 + + + 11 + 4 + 21 + 1 + 98368 + + + 13 + 4 + 22 + 3 + 98368 + + + 15 + 4 + 23 + 1 + 98368 + + + 17 + 4 + 24 + 3 + 98368 + + + 19 + 4 + 25 + 1 + 98368 + + + 21 + 4 + 26 + 3 + 98368 + + + 23 + 4 + 27 + 1 + 98368 + + + 25 + 4 + 28 + 3 + 98368 + + + 27 + 4 + 29 + 1 + 98368 + + + 29 + 4 + 30 + 3 + 98368 + + + 31 + 4 + 31 + 1 + 98368 + + + 33 + 4 + 14 + 3 + 98368 + + + 35 + 4 + 15 + 1 + 98368 + + + 37 + 4 + 12 + 3 + 98368 + + + 39 + 4 + 13 + 1 + 98368 + + + 41 + 4 + 10 + 3 + 98368 + + + 43 + 4 + 11 + 1 + 98368 + + + 45 + 4 + 8 + 3 + 98368 + + + 47 + 4 + 9 + 1 + 98368 + + + 49 + 4 + 6 + 3 + 98368 + + + 51 + 4 + 7 + 1 + 98368 + + + 53 + 4 + 4 + 3 + 98368 + + + 55 + 4 + 5 + 1 + 98368 + + + 57 + 4 + 2 + 3 + 98368 + + + 59 + 4 + 3 + 1 + 98368 + + + 61 + 4 + 0 + 3 + 98368 + + + 63 + 4 + 1 + 1 + 98368 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile index d2a9fac29a5e..5a381e4666ee 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2100.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2100.xml diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml new file mode 100644 index 000000000000..c9b844cd4bf8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml @@ -0,0 +1,131 @@ + + + + + + 00:02:03:04:05:00 + + + 16 + + + + + 25 + 4 + 0 + + + 3 + + + 98368 + + + 29 + 4 + 1 + 3 + 98368 + + + 17 + 4 + 2 + 3 + 98368 + + + 21 + 4 + 3 + 3 + 98368 + + + 9 + 4 + 4 + 3 + 98368 + + + 13 + 4 + 5 + 3 + 98368 + + + 1 + 4 + 6 + 3 + 98368 + + + 5 + 4 + 7 + 3 + 98368 + + + 37 + 4 + 8 + 3 + 98368 + + + 33 + 4 + 9 + 3 + 98368 + + + 45 + 4 + 10 + 3 + 98368 + + + 41 + 4 + 11 + 3 + 98368 + + + 53 + 4 + 12 + 3 + 98368 + + + 49 + 4 + 13 + 3 + 98368 + + + 61 + 4 + 14 + 3 + 98368 + + + 57 + 4 + 15 + 3 + 98368 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile index e5dff6bfa098..f7cb264c2287 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2410.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2410.xml diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml new file mode 100644 index 000000000000..1f97994f887b --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml @@ -0,0 +1,411 @@ + + + + + + 00:02:03:04:05:00 + + + 56 + + + + + 1 + 32 + 1 + + + 0 + + + 939524096 + + + 2 + 33 + 1 + 0 + 939524096 + + + 3 + 34 + 1 + 0 + 939524096 + + + 4 + 35 + 1 + 0 + 939524096 + + + 5 + 36 + 1 + 0 + 939524096 + + + 6 + 37 + 1 + 0 + 939524096 + + + 7 + 38 + 1 + 0 + 939524096 + + + 8 + 39 + 1 + 0 + 939524096 + + + 9 + 40 + 1 + 0 + 939524096 + + + 10 + 41 + 1 + 0 + 939524096 + + + 11 + 42 + 1 + 0 + 939524096 + + + 12 + 43 + 1 + 0 + 939524096 + + + 13 + 44 + 1 + 0 + 939524096 + + + 14 + 45 + 1 + 0 + 939524096 + + + 15 + 46 + 1 + 0 + 939524096 + + + 16 + 47 + 1 + 0 + 939524096 + + + 17 + 48 + 4 + 3 + 11534336 + + + 19 + 49 + 4 + 1 + 11534336 + + + 21 + 50 + 4 + 3 + 11534336 + + + 23 + 51 + 4 + 1 + 11534336 + + + 25 + 52 + 4 + 3 + 11534336 + + + 27 + 53 + 4 + 1 + 11534336 + + + 29 + 54 + 4 + 3 + 11534336 + + + 31 + 55 + 4 + 1 + 11534336 + + + 33 + 28 + 1 + 0 + 939524096 + + + 34 + 29 + 1 + 0 + 939524096 + + + 35 + 30 + 1 + 0 + 939524096 + + + 36 + 31 + 1 + 0 + 939524096 + + + 37 + 24 + 1 + 0 + 939524096 + + + 38 + 25 + 1 + 0 + 939524096 + + + 39 + 26 + 1 + 0 + 939524096 + + + 40 + 27 + 1 + 0 + 939524096 + + + 41 + 20 + 1 + 0 + 939524096 + + + 42 + 21 + 1 + 0 + 939524096 + + + 43 + 22 + 1 + 0 + 939524096 + + + 44 + 23 + 1 + 0 + 939524096 + + + 45 + 16 + 1 + 0 + 939524096 + + + 46 + 17 + 1 + 0 + 939524096 + + + 47 + 18 + 1 + 0 + 939524096 + + + 48 + 19 + 1 + 0 + 939524096 + + + 49 + 12 + 1 + 0 + 939524096 + + + 50 + 13 + 1 + 0 + 939524096 + + + 51 + 14 + 1 + 0 + 939524096 + + + 52 + 15 + 1 + 0 + 939524096 + + + 53 + 8 + 1 + 0 + 939524096 + + + 54 + 9 + 1 + 0 + 939524096 + + + 55 + 10 + 1 + 0 + 939524096 + + + 56 + 11 + 1 + 0 + 939524096 + + + 57 + 4 + 1 + 0 + 939524096 + + + 58 + 5 + 1 + 0 + 939524096 + + + 59 + 6 + 1 + 0 + 939524096 + + + 60 + 7 + 1 + 0 + 939524096 + + + 61 + 0 + 1 + 0 + 939524096 + + + 62 + 1 + 1 + 0 + 939524096 + + + 63 + 2 + 1 + 0 + 939524096 + + + 64 + 3 + 1 + 0 + 939524096 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile index 9a9a38aeb068..696f3d8182f9 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2700.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml new file mode 100644 index 000000000000..7831c9cf59d0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml @@ -0,0 +1,243 @@ + + + + + + 00:02:03:04:05:00 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 98368 + + + 3 + 4 + 17 + 1 + 98368 + + + 5 + 4 + 18 + 3 + 98368 + + + 7 + 4 + 19 + 1 + 98368 + + + 9 + 4 + 20 + 3 + 98368 + + + 11 + 4 + 21 + 1 + 98368 + + + 13 + 4 + 22 + 3 + 98368 + + + 15 + 4 + 23 + 1 + 98368 + + + 17 + 4 + 24 + 3 + 98368 + + + 19 + 4 + 25 + 1 + 98368 + + + 21 + 4 + 26 + 3 + 98368 + + + 23 + 4 + 27 + 1 + 98368 + + + 25 + 4 + 28 + 3 + 98368 + + + 27 + 4 + 29 + 1 + 98368 + + + 29 + 4 + 30 + 3 + 98368 + + + 31 + 4 + 31 + 1 + 98368 + + + 33 + 4 + 14 + 3 + 98368 + + + 35 + 4 + 15 + 1 + 98368 + + + 37 + 4 + 12 + 3 + 98368 + + + 39 + 4 + 13 + 1 + 98368 + + + 41 + 4 + 10 + 3 + 98368 + + + 43 + 4 + 11 + 1 + 98368 + + + 45 + 4 + 8 + 3 + 98368 + + + 47 + 4 + 9 + 1 + 98368 + + + 49 + 4 + 6 + 3 + 98368 + + + 51 + 4 + 7 + 1 + 98368 + + + 53 + 4 + 4 + 3 + 98368 + + + 55 + 4 + 5 + 1 + 98368 + + + 57 + 4 + 2 + 3 + 98368 + + + 59 + 4 + 3 + 1 + 98368 + + + 61 + 4 + 0 + 3 + 98368 + + + 63 + 4 + 1 + 1 + 98368 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile index 79c24358c359..adaa280e6cd5 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2740.xml +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2740.xml diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml new file mode 100644 index 000000000000..559f2bdd10c8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml @@ -0,0 +1,243 @@ + + + + + + 00:02:03:04:05:00 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 98368 + + + 3 + 4 + 17 + 1 + 98368 + + + 5 + 4 + 18 + 3 + 98368 + + + 7 + 4 + 19 + 1 + 98368 + + + 9 + 4 + 20 + 3 + 98368 + + + 11 + 4 + 21 + 1 + 98368 + + + 13 + 4 + 22 + 3 + 98368 + + + 15 + 4 + 23 + 1 + 98368 + + + 17 + 4 + 24 + 3 + 98368 + + + 19 + 4 + 25 + 1 + 98368 + + + 21 + 4 + 26 + 3 + 98368 + + + 23 + 4 + 27 + 1 + 98368 + + + 25 + 4 + 28 + 3 + 98368 + + + 27 + 4 + 29 + 1 + 98368 + + + 29 + 4 + 30 + 3 + 98368 + + + 31 + 4 + 31 + 1 + 98368 + + + 33 + 4 + 14 + 3 + 98368 + + + 35 + 4 + 15 + 1 + 98368 + + + 37 + 4 + 12 + 3 + 98368 + + + 39 + 4 + 13 + 1 + 98368 + + + 41 + 4 + 10 + 3 + 98368 + + + 43 + 4 + 11 + 1 + 98368 + + + 45 + 4 + 8 + 3 + 98368 + + + 47 + 4 + 9 + 1 + 98368 + + + 49 + 4 + 6 + 3 + 98368 + + + 51 + 4 + 7 + 1 + 98368 + + + 53 + 4 + 4 + 3 + 98368 + + + 55 + 4 + 5 + 1 + 98368 + + + 57 + 4 + 2 + 3 + 98368 + + + 59 + 4 + 3 + 1 + 98368 + + + 61 + 4 + 0 + 3 + 98368 + + + 63 + 4 + 1 + 1 + 98368 + + + + From 83d9c7e5936b899148d68758b5afc770afa1bdb7 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Wed, 6 Jun 2018 15:39:23 -0700 Subject: [PATCH 1349/1833] [bcmsh] Fix the bcmsh issues. (#1761) bcmsh is not copied to /usr/bin/ at host side --- platform/broadcom/docker-syncd-brcm.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index 6ef1587adecd..80da1446a9a8 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -17,3 +17,4 @@ $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd +$(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh From d2b1a0bcea7a86e82092018574b8bcb265ea0e24 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Sat, 9 Jun 2018 11:21:01 -0700 Subject: [PATCH 1350/1833] [devices]: Add index and speed for port_config.ini on Celestica platform (#1780) --- .../Seastone-DX010-10-50/port_config.ini | 226 +++++++++--------- .../Seastone-DX010-50/port_config.ini | 130 +++++----- .../Seastone-DX010/port_config.ini | 66 ++--- 3 files changed, 211 insertions(+), 211 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini index 16b89088aab8..383cc5a6a7ab 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini @@ -1,113 +1,113 @@ -# name lanes alias -Ethernet0 65 Eth1/1 -Ethernet1 66 Eth1/2 -Ethernet2 67 Eth1/3 -Ethernet3 68 Eth1/4 -Ethernet4 69 Eth2/1 -Ethernet5 70 Eth2/2 -Ethernet6 71 Eth2/3 -Ethernet7 72 Eth2/4 -Ethernet8 73 Eth3/1 -Ethernet9 74 Eth3/2 -Ethernet10 75 Eth3/3 -Ethernet11 76 Eth3/4 -Ethernet12 77 Eth4/1 -Ethernet13 78 Eth4/2 -Ethernet14 79 Eth4/3 -Ethernet15 80 Eth4/4 -Ethernet16 33 Eth5/1 -Ethernet17 34 Eth5/2 -Ethernet18 35 Eth5/3 -Ethernet19 36 Eth5/4 -Ethernet20 37 Eth6/1 -Ethernet21 38 Eth6/2 -Ethernet22 39 Eth6/3 -Ethernet23 40 Eth6/4 -Ethernet24 41 Eth7/1 -Ethernet25 42 Eth7/2 -Ethernet26 43 Eth7/3 -Ethernet27 44 Eth7/4 -Ethernet28 45 Eth8/1 -Ethernet29 46 Eth8/2 -Ethernet30 47 Eth8/3 -Ethernet31 48 Eth8/4 -Ethernet32 49 Eth9/1 -Ethernet33 50 Eth9/2 -Ethernet34 51 Eth9/3 -Ethernet35 52 Eth9/4 -Ethernet36 53 Eth10/1 -Ethernet37 54 Eth10/2 -Ethernet38 55 Eth10/3 -Ethernet39 56 Eth10/4 -Ethernet40 57 Eth11/1 -Ethernet41 58 Eth11/2 -Ethernet42 59 Eth11/3 -Ethernet43 60 Eth11/4 -Ethernet44 61 Eth12/1 -Ethernet45 62 Eth12/2 -Ethernet46 63 Eth12/3 -Ethernet47 64 Eth12/4 -Ethernet48 81 Eth13/1 -Ethernet49 82 Eth13/2 -Ethernet50 83 Eth13/3 -Ethernet51 84 Eth13/4 -Ethernet52 85 Eth14/1 -Ethernet53 86 Eth14/2 -Ethernet54 87 Eth14/3 -Ethernet55 88 Eth14/4 -Ethernet56 89 Eth15/1 -Ethernet57 90 Eth15/2 -Ethernet58 91 Eth15/3 -Ethernet59 92 Eth15/4 -Ethernet60 93 Eth16/1 -Ethernet61 94 Eth16/2 -Ethernet62 95 Eth16/3 -Ethernet63 96 Eth16/4 -Ethernet64 97 Eth17/1 -Ethernet65 98 Eth17/2 -Ethernet66 99 Eth17/3 -Ethernet67 100 Eth17/4 -Ethernet68 101 Eth18/1 -Ethernet69 102 Eth18/2 -Ethernet70 103 Eth18/3 -Ethernet71 104 Eth18/4 -Ethernet72 105 Eth19/1 -Ethernet73 106 Eth19/2 -Ethernet74 107 Eth19/3 -Ethernet75 108 Eth19/4 -Ethernet76 109 Eth20/1 -Ethernet77 110 Eth20/2 -Ethernet78 111 Eth20/3 -Ethernet79 112 Eth20/4 -Ethernet80 1 Eth21/1 -Ethernet81 2 Eth21/2 -Ethernet82 3 Eth21/3 -Ethernet83 4 Eth21/4 -Ethernet84 5 Eth22/1 -Ethernet85 6 Eth22/2 -Ethernet86 7 Eth22/3 -Ethernet87 8 Eth22/4 -Ethernet88 9 Eth23/1 -Ethernet89 10 Eth23/2 -Ethernet90 11 Eth23/3 -Ethernet91 12 Eth23/4 -Ethernet92 13 Eth24/1 -Ethernet93 14 Eth24/2 -Ethernet94 15 Eth24/3 -Ethernet95 16 Eth24/4 -Ethernet96 17,18 Eth25/1 -Ethernet98 19,20 Eth25/2 -Ethernet100 21,22 Eth26/1 -Ethernet102 23,24 Eth26/2 -Ethernet104 25,26 Eth27/1 -Ethernet106 27,28 Eth27/2 -Ethernet108 29,30 Eth28/1 -Ethernet110 31,32 Eth28/2 -Ethernet112 113,114 Eth29/1 -Ethernet114 115,116 Eth29/2 -Ethernet116 117,118 Eth30/1 -Ethernet118 119,120 Eth30/2 -Ethernet120 121,122 Eth31/1 -Ethernet122 123,124 Eth31/2 -Ethernet124 125,126 Eth32/1 -Ethernet126 127,128 Eth32/2 +# name lanes alias index speed +Ethernet0 65 Eth1/1 0 10000 +Ethernet1 66 Eth1/2 0 10000 +Ethernet2 67 Eth1/3 0 10000 +Ethernet3 68 Eth1/4 0 10000 +Ethernet4 69 Eth2/1 1 10000 +Ethernet5 70 Eth2/2 1 10000 +Ethernet6 71 Eth2/3 1 10000 +Ethernet7 72 Eth2/4 1 10000 +Ethernet8 73 Eth3/1 2 10000 +Ethernet9 74 Eth3/2 2 10000 +Ethernet10 75 Eth3/3 2 10000 +Ethernet11 76 Eth3/4 2 10000 +Ethernet12 77 Eth4/1 3 10000 +Ethernet13 78 Eth4/2 3 10000 +Ethernet14 79 Eth4/3 3 10000 +Ethernet15 80 Eth4/4 3 10000 +Ethernet16 33 Eth5/1 4 10000 +Ethernet17 34 Eth5/2 4 10000 +Ethernet18 35 Eth5/3 4 10000 +Ethernet19 36 Eth5/4 4 10000 +Ethernet20 37 Eth6/1 5 10000 +Ethernet21 38 Eth6/2 5 10000 +Ethernet22 39 Eth6/3 5 10000 +Ethernet23 40 Eth6/4 5 10000 +Ethernet24 41 Eth7/1 6 10000 +Ethernet25 42 Eth7/2 6 10000 +Ethernet26 43 Eth7/3 6 10000 +Ethernet27 44 Eth7/4 6 10000 +Ethernet28 45 Eth8/1 7 10000 +Ethernet29 46 Eth8/2 7 10000 +Ethernet30 47 Eth8/3 7 10000 +Ethernet31 48 Eth8/4 7 10000 +Ethernet32 49 Eth9/1 8 10000 +Ethernet33 50 Eth9/2 8 10000 +Ethernet34 51 Eth9/3 8 10000 +Ethernet35 52 Eth9/4 8 10000 +Ethernet36 53 Eth10/1 9 10000 +Ethernet37 54 Eth10/2 9 10000 +Ethernet38 55 Eth10/3 9 10000 +Ethernet39 56 Eth10/4 9 10000 +Ethernet40 57 Eth11/1 10 10000 +Ethernet41 58 Eth11/2 10 10000 +Ethernet42 59 Eth11/3 10 10000 +Ethernet43 60 Eth11/4 10 10000 +Ethernet44 61 Eth12/1 11 10000 +Ethernet45 62 Eth12/2 11 10000 +Ethernet46 63 Eth12/3 11 10000 +Ethernet47 64 Eth12/4 11 10000 +Ethernet48 81 Eth13/1 12 10000 +Ethernet49 82 Eth13/2 12 10000 +Ethernet50 83 Eth13/3 12 10000 +Ethernet51 84 Eth13/4 12 10000 +Ethernet52 85 Eth14/1 13 10000 +Ethernet53 86 Eth14/2 13 10000 +Ethernet54 87 Eth14/3 13 10000 +Ethernet55 88 Eth14/4 13 10000 +Ethernet56 89 Eth15/1 14 10000 +Ethernet57 90 Eth15/2 14 10000 +Ethernet58 91 Eth15/3 14 10000 +Ethernet59 92 Eth15/4 14 10000 +Ethernet60 93 Eth16/1 15 10000 +Ethernet61 94 Eth16/2 15 10000 +Ethernet62 95 Eth16/3 15 10000 +Ethernet63 96 Eth16/4 15 10000 +Ethernet64 97 Eth17/1 16 10000 +Ethernet65 98 Eth17/2 16 10000 +Ethernet66 99 Eth17/3 16 10000 +Ethernet67 100 Eth17/4 16 10000 +Ethernet68 101 Eth18/1 17 10000 +Ethernet69 102 Eth18/2 17 10000 +Ethernet70 103 Eth18/3 17 10000 +Ethernet71 104 Eth18/4 17 10000 +Ethernet72 105 Eth19/1 18 10000 +Ethernet73 106 Eth19/2 18 10000 +Ethernet74 107 Eth19/3 18 10000 +Ethernet75 108 Eth19/4 18 10000 +Ethernet76 109 Eth20/1 19 10000 +Ethernet77 110 Eth20/2 19 10000 +Ethernet78 111 Eth20/3 19 10000 +Ethernet79 112 Eth20/4 19 10000 +Ethernet80 1 Eth21/1 20 10000 +Ethernet81 2 Eth21/2 20 10000 +Ethernet82 3 Eth21/3 20 10000 +Ethernet83 4 Eth21/4 20 10000 +Ethernet84 5 Eth22/1 21 10000 +Ethernet85 6 Eth22/2 21 10000 +Ethernet86 7 Eth22/3 21 10000 +Ethernet87 8 Eth22/4 21 10000 +Ethernet88 9 Eth23/1 22 10000 +Ethernet89 10 Eth23/2 22 10000 +Ethernet90 11 Eth23/3 22 10000 +Ethernet91 12 Eth23/4 22 10000 +Ethernet92 13 Eth24/1 23 10000 +Ethernet93 14 Eth24/2 23 10000 +Ethernet94 15 Eth24/3 23 10000 +Ethernet95 16 Eth24/4 23 10000 +Ethernet96 17,18 Eth25/1 24 50000 +Ethernet98 19,20 Eth25/2 24 50000 +Ethernet100 21,22 Eth26/1 25 50000 +Ethernet102 23,24 Eth26/2 25 50000 +Ethernet104 25,26 Eth27/1 26 50000 +Ethernet106 27,28 Eth27/2 26 50000 +Ethernet108 29,30 Eth28/1 27 50000 +Ethernet110 31,32 Eth28/2 27 50000 +Ethernet112 113,114 Eth29/1 28 50000 +Ethernet114 115,116 Eth29/2 28 50000 +Ethernet116 117,118 Eth30/1 29 50000 +Ethernet118 119,120 Eth30/2 29 50000 +Ethernet120 121,122 Eth31/1 30 50000 +Ethernet122 123,124 Eth31/2 30 50000 +Ethernet124 125,126 Eth32/1 31 50000 +Ethernet126 127,128 Eth32/2 31 50000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini index 70553360da28..3e2a0ebeafd5 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini @@ -1,65 +1,65 @@ -# name lanes alias -Ethernet0 65,66 Eth1/1 -Ethernet2 67,68 Eth1/2 -Ethernet4 69,70 Eth2/1 -Ethernet6 71,72 Eth2/2 -Ethernet8 73,74 Eth3/1 -Ethernet10 75,76 Eth3/2 -Ethernet12 77,78 Eth4/1 -Ethernet14 79,80 Eth4/2 -Ethernet16 33,34 Eth5/1 -Ethernet18 35,36 Eth5/2 -Ethernet20 37,38 Eth6/1 -Ethernet22 39,40 Eth6/2 -Ethernet24 41,42 Eth7/1 -Ethernet26 43,44 Eth7/2 -Ethernet28 45,46 Eth8/1 -Ethernet30 47,48 Eth8/2 -Ethernet32 49,50 Eth9/1 -Ethernet34 51,52 Eth9/2 -Ethernet36 53,54 Eth10/1 -Ethernet38 55,56 Eth10/2 -Ethernet40 57,58 Eth11/1 -Ethernet42 59,60 Eth11/2 -Ethernet44 61,62 Eth12/1 -Ethernet46 63,64 Eth12/2 -Ethernet48 81,82 Eth13/1 -Ethernet50 83,84 Eth13/2 -Ethernet52 85,86 Eth14/1 -Ethernet54 87,88 Eth14/2 -Ethernet56 89,90 Eth15/1 -Ethernet58 91,92 Eth15/2 -Ethernet60 93,94 Eth16/1 -Ethernet62 95,96 Eth16/2 -Ethernet64 97,98 Eth17/1 -Ethernet66 99,100 Eth17/2 -Ethernet68 101,102 Eth18/1 -Ethernet70 103,104 Eth18/2 -Ethernet72 105,106 Eth19/1 -Ethernet74 107,108 Eth19/2 -Ethernet76 109,110 Eth20/1 -Ethernet78 111,112 Eth20/2 -Ethernet80 1,2 Eth21/1 -Ethernet82 3,4 Eth21/2 -Ethernet84 5,6 Eth22/1 -Ethernet86 7,8 Eth22/2 -Ethernet88 9,10 Eth23/1 -Ethernet90 11,12 Eth23/2 -Ethernet92 13,14 Eth24/1 -Ethernet94 15,16 Eth24/2 -Ethernet96 17,18 Eth25/1 -Ethernet98 19,20 Eth25/2 -Ethernet100 21,22 Eth26/1 -Ethernet102 23,24 Eth26/2 -Ethernet104 25,26 Eth27/1 -Ethernet106 27,28 Eth27/2 -Ethernet108 29,30 Eth28/1 -Ethernet110 31,32 Eth28/2 -Ethernet112 113,114 Eth29/1 -Ethernet114 115,116 Eth29/2 -Ethernet116 117,118 Eth30/1 -Ethernet118 119,120 Eth30/2 -Ethernet120 121,122 Eth31/1 -Ethernet122 123,124 Eth31/2 -Ethernet124 125,126 Eth32/1 -Ethernet126 127,128 Eth32/2 +# 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 Eth17/1 16 50000 +Ethernet66 99,100 Eth17/2 16 50000 +Ethernet68 101,102 Eth18/1 17 50000 +Ethernet70 103,104 Eth18/2 17 50000 +Ethernet72 105,106 Eth19/1 18 50000 +Ethernet74 107,108 Eth19/2 18 50000 +Ethernet76 109,110 Eth20/1 19 50000 +Ethernet78 111,112 Eth20/2 19 50000 +Ethernet80 1,2 Eth21/1 20 50000 +Ethernet82 3,4 Eth21/2 20 50000 +Ethernet84 5,6 Eth22/1 21 50000 +Ethernet86 7,8 Eth22/2 21 50000 +Ethernet88 9,10 Eth23/1 22 50000 +Ethernet90 11,12 Eth23/2 22 50000 +Ethernet92 13,14 Eth24/1 23 50000 +Ethernet94 15,16 Eth24/2 23 50000 +Ethernet96 17,18 Eth25/1 24 50000 +Ethernet98 19,20 Eth25/2 24 50000 +Ethernet100 21,22 Eth26/1 25 50000 +Ethernet102 23,24 Eth26/2 25 50000 +Ethernet104 25,26 Eth27/1 26 50000 +Ethernet106 27,28 Eth27/2 26 50000 +Ethernet108 29,30 Eth28/1 27 50000 +Ethernet110 31,32 Eth28/2 27 50000 +Ethernet112 113,114 Eth29/1 28 50000 +Ethernet114 115,116 Eth29/2 28 50000 +Ethernet116 117,118 Eth30/1 29 50000 +Ethernet118 119,120 Eth30/2 29 50000 +Ethernet120 121,122 Eth31/1 30 50000 +Ethernet122 123,124 Eth31/2 30 50000 +Ethernet124 125,126 Eth32/1 31 50000 +Ethernet126 127,128 Eth32/2 31 50000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini index 9f039e003488..94282c3379e4 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias -Ethernet0 65,66,67,68 Eth1 -Ethernet4 69,70,71,72 Eth2 -Ethernet8 73,74,75,76 Eth3 -Ethernet12 77,78,79,80 Eth4 -Ethernet16 33,34,35,36 Eth5 -Ethernet20 37,38,39,40 Eth6 -Ethernet24 41,42,43,44 Eth7 -Ethernet28 45,46,47,48 Eth8 -Ethernet32 49,50,51,52 Eth9 -Ethernet36 53,54,55,56 Eth10 -Ethernet40 57,58,59,60 Eth11 -Ethernet44 61,62,63,64 Eth12 -Ethernet48 81,82,83,84 Eth13 -Ethernet52 85,86,87,88 Eth14 -Ethernet56 89,90,91,92 Eth15 -Ethernet60 93,94,95,96 Eth16 -Ethernet64 97,98,99,100 Eth17 -Ethernet68 101,102,103,104 Eth18 -Ethernet72 105,106,107,108 Eth19 -Ethernet76 109,110,111,112 Eth20 -Ethernet80 1,2,3,4 Eth21 -Ethernet84 5,6,7,8 Eth22 -Ethernet88 9,10,11,12 Eth23 -Ethernet92 13,14,15,16 Eth24 -Ethernet96 17,18,19,20 Eth25 -Ethernet100 21,22,23,24 Eth26 -Ethernet104 25,26,27,28 Eth27 -Ethernet108 29,30,31,32 Eth28 -Ethernet112 113,114,115,116 Eth29 -Ethernet116 117,118,119,120 Eth30 -Ethernet120 121,122,123,124 Eth31 -Ethernet124 125,126,127,128 Eth32 +# name lanes alias index speed +Ethernet0 65,66,67,68 Eth1 0 100000 +Ethernet4 69,70,71,72 Eth2 1 100000 +Ethernet8 73,74,75,76 Eth3 2 100000 +Ethernet12 77,78,79,80 Eth4 3 100000 +Ethernet16 33,34,35,36 Eth5 4 100000 +Ethernet20 37,38,39,40 Eth6 5 100000 +Ethernet24 41,42,43,44 Eth7 6 100000 +Ethernet28 45,46,47,48 Eth8 7 100000 +Ethernet32 49,50,51,52 Eth9 8 100000 +Ethernet36 53,54,55,56 Eth10 9 100000 +Ethernet40 57,58,59,60 Eth11 10 100000 +Ethernet44 61,62,63,64 Eth12 11 100000 +Ethernet48 81,82,83,84 Eth13 12 100000 +Ethernet52 85,86,87,88 Eth14 13 100000 +Ethernet56 89,90,91,92 Eth15 14 100000 +Ethernet60 93,94,95,96 Eth16 15 100000 +Ethernet64 97,98,99,100 Eth17 16 100000 +Ethernet68 101,102,103,104 Eth18 17 100000 +Ethernet72 105,106,107,108 Eth19 18 100000 +Ethernet76 109,110,111,112 Eth20 19 100000 +Ethernet80 1,2,3,4 Eth21 20 100000 +Ethernet84 5,6,7,8 Eth22 21 100000 +Ethernet88 9,10,11,12 Eth23 22 100000 +Ethernet92 13,14,15,16 Eth24 23 100000 +Ethernet96 17,18,19,20 Eth25 24 100000 +Ethernet100 21,22,23,24 Eth26 25 100000 +Ethernet104 25,26,27,28 Eth27 26 100000 +Ethernet108 29,30,31,32 Eth28 27 100000 +Ethernet112 113,114,115,116 Eth29 28 100000 +Ethernet116 117,118,119,120 Eth30 29 100000 +Ethernet120 121,122,123,124 Eth31 30 100000 +Ethernet124 125,126,127,128 Eth32 31 100000 From 8d88455509fc3469574b32cfb635189778d963c9 Mon Sep 17 00:00:00 2001 From: Serhey Popovych Date: Sat, 9 Jun 2018 21:29:16 +0300 Subject: [PATCH 1351/1833] [baseimage]: Improve password hashing for default user account (#1748) * [slave.mk]: Fix displaying username and password in build summary We display contents of DEFAULT_USERNAME and DEFAULT_PASSWORD, while image can be build with USERNAME and/or PASSWORD given on make(1) command line. For example: $ make USERNAME=adm PASSWORD=mypass target/sonic-broadcom.bin Fix by displaying USERNAME and PASSWORD variables in build summary. Signed-off-by: Sergey Popovich * [baseimage]: Improve default user account handling There are couple of issues with current implementation of default user account management in baseimage: 1) It uses DES to encrypt accounts password. Furthermore this effectively limits password length to 8 symbols, even if more provided with PASSWORD or DEFAULT_PASSWORD from rules/config. 2) Salt value for password is same on all builds even with different password increasing attack surface. 3) During the build process password passed as command line parameter either as plain text (if given to make(1) as "make PASSWORD=...") or DES encrypted (if given to build_debian.sh) can be seen by non-build users using /proc//cmdline file that has group and world readable permissions. Both 1) and 2) come from: perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" that by defalt uses DES if salt does not have format $$$, where is hashing function id. See crypt(3) for more details on valid values. To address issues above we propose following changes: 1) Do not create password by hands (e.g. using perl snippet above): put this job to chpasswd(8) which is aware about system wide password hashing policy specified in /etc/login.defs with ENCRYPT_METHOD (by default it is SHA512 for Debian 8). 2) Now chpasswd(8) will take care about proper salt value. 3) This has two steps: 3.1) For compatibility reasons accept USERNAME and PASSWORD as make(1) parameters, but warn user that this is unsafe. 3.2) Use process environment to pass USERNAME and PASSWORD variables from Makefile to build_debian.sh as more secure alternative to passing via command line parameters: /proc//environ readable only by user running process or privileged users like root. Before change: -------------- hash1 ----- # u='admin' # p="$(LANG=C perl -e 'print crypt("YourPaSs", "salt"),"\n"')" ^^^^^^^^ 8 symbols # echo "$u:$p" | chpasswd -e # getent shadow admin admin:sazQDkwgZPfSk:17680:0:99999:7::: ^^^^^^^^^^^^^ Note the hash (DES encrypted password) hash2 ----- # u='admin' # p="$(LANG=C perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"')" ^^^^^^^^^^^^ 12 symbols # echo "$u:$p" | chpasswd -e # getent shadow admin admin:sazQDkwgZPfSk:17680:0:99999:7::: ^^^^^^^^^^^^^ Hash is the same as for "YourPaSs" After change: ------------- hash1 ----- # echo "admin:YourPaSs" | chpasswd # getent shadow admin admin:$6$1Nho1jHC$T8YwK58FYToXMFuetQta7/XouAAN2q1IzWC3bdIg86woAs6WuTg\ ^^^^^^^^ Note salt here ksLO3oyQInax/wNVq.N4de6dyWZDsCAvsZ1:17681:0:99999:7::: hash2 ----- # echo "admin:YourPaSs" | chpasswd # getent shadow admin admin:$6$yKU5g7BO$kdT02Z1wHXhr1VCniKkZbLaMPZXK0WSSVGhSLGrNhsrsVxCJ.D9\ ^^^^^^^^ Here salt completely different from case above plFpd8ksGNpw/Vb92hvgYyCL2i5cfI8QEY/:17681:0:99999:7::: Since salt is different hashes for same password different too. hash1 ----- # LANG=C perl -e 'print crypt("YourPaSs", "\$6\$salt\$"),"\n"' ^^^^^ We want SHA512 hash $6$salt$qkwPvXqUeGpexO1vatnIQFAreOTXs6rnDX.OI.Sz2rcy51JrO8dFc9aGv82bB\ yd2ELrIMJ.FQLNjgSD0nNha7/ hash2 ----- # LANG=C perl -e 'print crypt("YourPaSsWoRd", "\$6\$salt\$"),"\n"' $6$salt$1JVndGzyy/dj7PaXo6hNcttlQoZe23ob8GWYWxVGEiGOlh6sofbaIvwl6Ho7N\ kYDI8zwRumRwga/A29nHm4mZ1 Now with same "salt" and $$, and same 8 symbol prefix in password, but different password length we have different hashes. Signed-off-by: Sergey Popovich --- build_debian.sh | 22 +++++++++------------- slave.mk | 18 ++++++++++++++---- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index c5b395653ec2..f66cf4ba62d1 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -3,26 +3,22 @@ ## an ONIE installer image. ## ## USAGE: -## ./build_debian USERNAME PASSWORD_ENCRYPTED -## PARAMETERS: +## USERNAME=username PASSWORD=password ./build_debian +## ENVIRONMENT: ## USERNAME ## The name of the default admin user -## PASSWORD_ENCRYPTED -## The encrypted password, expected by chpasswd command +## PASSWORD +## The password, expected by chpasswd command ## Default user -USERNAME=$1 [ -n "$USERNAME" ] || { - echo "Error: no or empty USERNAME argument" + echo "Error: no or empty USERNAME" exit 1 } -## Password for the default user, customizable by environment variable -## By default it is an empty password -## You may get a crypted password by: perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"' -PASSWORD_ENCRYPTED=$2 -[ -n "$PASSWORD_ENCRYPTED" ] || { - echo "Error: no or empty PASSWORD_ENCRYPTED argument" +## Password for the default user +[ -n "$PASSWORD" ] || { + echo "Error: no or empty PASSWORD" exit 1 } @@ -178,7 +174,7 @@ sudo cp files/docker/docker.service.conf $_ ## Note: user should be in the group with the same name, and also in sudo/docker group sudo LANG=C chroot $FILESYSTEM_ROOT useradd -G sudo,docker $USERNAME -c "$DEFAULT_USERINFO" -m -s /bin/bash ## Create password for the default user -echo $USERNAME:$PASSWORD_ENCRYPTED | sudo LANG=C chroot $FILESYSTEM_ROOT chpasswd -e +echo "$USERNAME:$PASSWORD" | sudo LANG=C chroot $FILESYSTEM_ROOT chpasswd ## Pre-install hardware drivers sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ diff --git a/slave.mk b/slave.mk index f642d3341a5c..a81acb1798f4 100644 --- a/slave.mk +++ b/slave.mk @@ -76,10 +76,14 @@ endif ifeq ($(USERNAME),) override USERNAME := $(DEFAULT_USERNAME) +else +$(warning USERNAME given on command line: could be visible to other users) endif ifeq ($(PASSWORD),) override PASSWORD := $(DEFAULT_PASSWORD) +else +$(warning PASSWORD given on command line: could be visible to other users) endif ifeq ($(SONIC_BUILD_JOBS),) @@ -100,8 +104,8 @@ $(info "CONFIGURED_PLATFORM" : "$(if $(PLATFORM),$(PLATFORM),$(CONFI $(info "SONIC_CONFIG_PRINT_DEPENDENCIES" : "$(SONIC_CONFIG_PRINT_DEPENDENCIES)") $(info "SONIC_BUILD_JOBS" : "$(SONIC_BUILD_JOBS)") $(info "SONIC_CONFIG_MAKE_JOBS" : "$(SONIC_CONFIG_MAKE_JOBS)") -$(info "DEFAULT_USERNAME" : "$(DEFAULT_USERNAME)") -$(info "DEFAULT_PASSWORD" : "$(DEFAULT_PASSWORD)") +$(info "USERNAME" : "$(USERNAME)") +$(info "PASSWORD" : "$(PASSWORD)") $(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)") $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)") $(info "ENABLE_PFCWD_ON_START" : "$(ENABLE_PFCWD_ON_START)") @@ -484,8 +488,14 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ DIRTY_SUFFIX="$(shell date +%Y%m%d\.%H%M%S)" export DIRTY_SUFFIX - ./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG) - TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) ./build_image.sh $(LOG) + + USERNAME="$(USERNAME)" \ + PASSWORD="$(PASSWORD)" \ + ./build_debian.sh $(LOG) + + TARGET_MACHINE=$($*_MACHINE) \ + IMAGE_TYPE=$($*_IMAGE_TYPE) \ + ./build_image.sh $(LOG) $(foreach docker, $($*_DOCKERS), \ rm -f $($(docker)_CONTAINER_NAME).sh From a4b830b3af256dc80dc358644290663c2a06880d Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Sat, 9 Jun 2018 21:29:52 +0300 Subject: [PATCH 1352/1833] [mellanox] Update hw-mgmt pointer (#1759) Signed-off-by: Stepan Blyschak --- platform/mellanox/hw-management.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index dcbce4564ee8..70dd2d330167 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,6 +1,6 @@ # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = V1.0.0160 +MLNX_HW_MANAGEMENT_VERSION = V1.0.0190 export MLNX_HW_MANAGEMENT_VERSION From dc547e4c8d4498d3d10c5495c5bfa871720c9088 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 9 Jun 2018 11:30:55 -0700 Subject: [PATCH 1353/1833] [sonic-platform-daemons] Update submodule (#1754) --- src/sonic-platform-daemons | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index 6d35814d9841..ce83d58b0aff 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit 6d35814d9841f34effa99fe053a5156602e106f4 +Subproject commit ce83d58b0afffaa3e0b9d57686c814a2b5fd771e From ed06aca40e715fee8d9ecf869848fed52aa160df Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Sat, 9 Jun 2018 21:31:34 +0300 Subject: [PATCH 1354/1833] [mellanox] Add cpldupdate utility to SONiC image (#1746) Signed-off-by: Stepan Blyschak --- platform/mellanox/mft.mk | 12 ++++++++++-- platform/mellanox/mft/Makefile | 14 +++++++------- platform/mellanox/one-image.mk | 2 +- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index 2fb3af338d75..1c84d3a66cd9 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -1,9 +1,17 @@ # Mellanox SAI -MFT = mft-4.5.0-31.amd64.deb +MFT_VERSION = 4.5.0 +MFT_REVISION = 31 + +export MFT_VERSION MFT_REVISION + +MFT = mft-$(MFT_VERSION)-$(MFT_REVISION).amd64.deb $(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft $(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_MAKE_DEBS += $(MFT) -KERNEL_MFT = kernel-mft-dkms_4.5.0-$(KVERSION)_all.deb +KERNEL_MFT = kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT))) + +MFT_OEM = mft-oem-$(MFT_VERSION)-$(MFT_REVISION).amd64.deb +$(eval $(call add_derived_package,$(MFT),$(MFT_OEM))) diff --git a/platform/mellanox/mft/Makefile b/platform/mellanox/mft/Makefile index eea78cd76031..450e59eec44b 100644 --- a/platform/mellanox/mft/Makefile +++ b/platform/mellanox/mft/Makefile @@ -1,12 +1,12 @@ .ONESHELL: SHELL = /bin/bash -MFT_NAME = mft-4.5.0-31-x86_64-deb +MFT_NAME = mft-$(MFT_VERSION)-$(MFT_REVISION)-x86_64-deb MFT_TGZ = $(MFT_NAME).tgz -SRC_DEB = kernel-mft-dkms_4.5.0-31_all.deb +SRC_DEB = kernel-mft-dkms_$(MFT_VERSION)-$(MFT_REVISION)_all.deb -MAIN_TARGET = mft-4.5.0-31.amd64.deb -DERIVED_TARGETS = kernel-mft-dkms_4.5.0-$(KVERSION)_all.deb +MAIN_TARGET = mft-$(MFT_VERSION)-$(MFT_REVISION).amd64.deb +DERIVED_TARGETS = kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb mft-oem-$(MFT_VERSION)-$(MFT_REVISION).amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf $(MFT_NAME) @@ -21,11 +21,11 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : fi done - tar xvf `sudo dkms mkdriverdisk kernel-mft-dkms/4.5.0 -a all -d ubuntu -k $(KVERSION) --media tar | grep "Disk image location" | cut -d':' -f2` + tar xvf `sudo dkms mkdriverdisk kernel-mft-dkms/$(MFT_VERSION) -a all -d ubuntu -k $(KVERSION) --media tar | grep "Disk image location" | cut -d':' -f2` popd # fix timestamp because we do not actually build tools, only kernel - touch $(MFT_NAME)/DEBS/$* - mv $(MFT_NAME)/SDEBS/ubuntu-drivers/3.16.0/$(DERIVED_TARGETS) $(MFT_NAME)/DEBS/$* $(DEST) + touch $(MFT_NAME)/DEBS/* + mv $(MFT_NAME)/SDEBS/ubuntu-drivers/3.16.0/kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(MFT_NAME)/DEBS/* $(DEST) $(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk index 6f478ba76a51..5360a4c27745 100644 --- a/platform/mellanox/one-image.mk +++ b/platform/mellanox/one-image.mk @@ -3,7 +3,7 @@ SONIC_ONE_IMAGE = sonic-mellanox.bin $(SONIC_ONE_IMAGE)_MACHINE = mellanox $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_INSTALLS += $(SX_KERNEL) $(KERNEL_MFT) $(MFT) $(MLNX_HW_MANAGEMENT) +$(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) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) From 481463ccbf84c57725d731336c759370c80a7955 Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Tue, 12 Jun 2018 00:40:58 +0700 Subject: [PATCH 1355/1833] Add Celestica seastone dx010 psuutil.py plugins (#1781) --- .../x86_64-cel_seastone-r0/plugins/psuutil.py | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py diff --git a/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py b/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py new file mode 100644 index 000000000000..9e8f99e7a7f2 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py @@ -0,0 +1,102 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + # DX010 PSU pin mapping + self.psu = [ + {'base':216}, # Reserved + {'abs':27, 'power':22}, + {'abs':28, 'power':25} + ] + + def init_psu_gpio(self, pinnum): + # export pin, input as default + gpio_base = self.psu[0]['base'] + export_file = "/sys/class/gpio/export" + direction_file = '/sys/class/gpio/gpio' + str(gpio_base+pinnum) + '/direction' + + try: + with open(export_file, 'w') as fd: + fd.write(str(gpio_base+pinnum)) + except Exception as error: + logging.error("Unable to export gpio ", pinnum) + + + # Get a psu status and presence + def read_psu_statuses(self, pinnum): + sys_gpio_dir = "/sys/class/gpio" + retval = 'ERR' + gpio_base = self.psu[0]['base'] + + gpio_dir = sys_gpio_dir + '/gpio' + str(gpio_base+pinnum) + gpio_file = gpio_dir + "/value" + + # init gpio + if (not os.path.isdir(gpio_dir)): + self.init_psu_gpio(pinnum) + + try: + with open(gpio_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", gpio_file, "file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + DX010_MAX_PSUS = 2 + return DX010_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + psu_status = self.read_psu_statuses(self.psu[index]['power']) + if (psu_status != 'ERR'): + psu_status = int(psu_status, 10) + # Check for PSU status + if (psu_status == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absence = self.read_psu_statuses(self.psu[index]['abs']) + if (psu_absence != 'ERR'): + psu_absence = (int(psu_absence, 10)) + # Check for PSU presence + if (psu_absence == 0): + status = 1 + + return status From 19421831857c48dda1f3bb08a0c5e2bed7a26dc3 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 11 Jun 2018 13:54:02 -0700 Subject: [PATCH 1356/1833] [devices]: Add Broadcom config files for Arista 7050 SKUs; Remove 'serdes_firmware_mode_xe=0x1' line (#1779) * Add Broadcom config files for Arista-7050-QX32 and Arista-7050-Q16S64 SKUs under respective directories * Remove 'serdes_firmware_mode_xe=0x1' line from Arista 7050 Broadcom config files --- .../Arista-7050-Q16S64/sai.profile | 2 +- ...-a7050-qx32-16x40G+32x10G+8x40G.config.bcm | 707 ++++++++++++++ .../Arista-7050-QX32/sai.profile | 2 +- .../td2-a7050-qx32-32x40G.config.bcm | 873 ++++++++++++++++++ 4 files changed, 1582 insertions(+), 2 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm create mode 100644 device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile index 0175b59a5da3..5c613675c37f 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/sai.profile @@ -1,2 +1,2 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm new file mode 100644 index 000000000000..6d72e20b2104 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm @@ -0,0 +1,707 @@ +#/****************************************************************************** +# * +# * File: config.bcm.cloverdales (7050-QX32) +# * Name: +# * +# * Description: This file contains SDK properties for an Arista +# * Cloverdales platform. +# * +# *----------------------------------------------------------------------------- +# ******************************************************************************/ +#################################################################### +# BCM Config file for Cloverdale platform +# - 16x40g + 32x10g + 8x40G Portmode + +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# l2 thread related config vars +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 + +bcm_num_cos=8 +bcm_stat_interval=2000000 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +scache_filename=/tmp/scache +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +# for GLC transceiver +phy_an_c73=0x0 +phy_an_c37=0x3 + +########################### +#port_init_speed_xe=40000 +#port_init_speed_xe.0=40000 + +#load_firmware=0x0102 +load_firmware.0=2 + +######################### +# All ports are in oversubscription mode +pbmp_oversubscribe=0x1fffffffffffffffffffffffffe +pbmp_xport_xe.0=0x1fffffffffffffffffffffffffe + +########################################## +#skip_L2_USER_ENTRY=0 +phy_aux_voltage_enable=1 +############################### +serdes_fiber_pref=1 +############################### +mdio_output_delay.0=0x0d +############################### +serdes_sgmii_m=0 +xgxs_lcpll_xtal_refclk=1 +xgxs_lcpll_xtal_refclk.0=1 +xgxs_lcpll_xtal_refclk.1=1 +xgxs_lcpll_xtal_refclk.2=1 +xgxs_lcpll_xtal_refclk.3=1 +tdma_intr_enable=1 +tslam_intr_enable=1 +tslam_dma_enable.2=1 +tslam_dma_enable.3=1 +#dport_map_port=0 +#pci2eb_overrid=0 +#bcm_xlate_port_enable.0=0 +#xgxs_pdetect_1=0 +table_dma_enable.0=1 +table_dma_enable.1=1 +table_dma_enable.2=1 +table_dma_enable.3=1 + + +phy_84328_1.0=1 +phy_84328_5.0=1 +phy_84328_9.0=1 +phy_84328_13.0=1 +phy_84328_101.0=1 +phy_84328_102.0=1 +phy_84328_103.0=1 +phy_84328_104.0=1 + +phy_an_c37_1.0=0 +phy_an_c37_5.0=0 +phy_an_c37_9.0=0 +phy_an_c37_13.0=0 +phy_an_c37_17.0=0 +phy_an_c37_21.0=0 +phy_an_c37_25.0=0 +phy_an_c37_29.0=0 +phy_an_c37_33.0=0 +phy_an_c37_37.0=0 +phy_an_c37_41.0=0 +phy_an_c37_45.0=0 +phy_an_c37_49.0=0 +phy_an_c37_53.0=0 +phy_an_c37_57.0=0 +phy_an_c37_61.0=0 +phy_an_c37_65.0=3 +phy_an_c37_66.0=3 +phy_an_c37_67.0=3 +phy_an_c37_68.0=3 +phy_an_c37_69.0=3 +phy_an_c37_70.0=3 +phy_an_c37_71.0=3 +phy_an_c37_72.0=3 +phy_an_c37_73.0=3 +phy_an_c37_74.0=3 +phy_an_c37_75.0=3 +phy_an_c37_76.0=3 +phy_an_c37_77.0=3 +phy_an_c37_78.0=3 +phy_an_c37_79.0=3 +phy_an_c37_80.0=3 +phy_an_c37_81.0=3 +phy_an_c37_82.0=3 +phy_an_c37_83.0=3 +phy_an_c37_84.0=3 +phy_an_c37_85.0=3 +phy_an_c37_86.0=3 +phy_an_c37_87.0=3 +phy_an_c37_88.0=3 +phy_an_c37_89.0=3 +phy_an_c37_90.0=3 +phy_an_c37_91.0=3 +phy_an_c37_92.0=3 +phy_an_c37_93.0=3 +phy_an_c37_94.0=3 +phy_an_c37_95.0=3 +phy_an_c37_96.0=3 +phy_an_c37_97.0=0 +phy_an_c37_98.0=0 +phy_an_c37_99.0=0 +phy_an_c37_100.0=0 +phy_an_c37_101.0=0 +phy_an_c37_102.0=0 +phy_an_c37_103.0=0 +phy_an_c37_104.0=0 + +phy_an_c73_1.0=2 +phy_an_c73_5.0=2 +phy_an_c73_9.0=2 +phy_an_c73_13.0=2 +phy_an_c73_17.0=2 +phy_an_c73_21.0=2 +phy_an_c73_25.0=2 +phy_an_c73_29.0=2 +phy_an_c73_33.0=2 +phy_an_c73_37.0=2 +phy_an_c73_41.0=2 +phy_an_c73_45.0=2 +phy_an_c73_49.0=2 +phy_an_c73_53.0=2 +phy_an_c73_57.0=2 +phy_an_c73_61.0=2 +phy_an_c73_65.0=0 +phy_an_c73_66.0=0 +phy_an_c73_67.0=0 +phy_an_c73_68.0=0 +phy_an_c73_69.0=0 +phy_an_c73_70.0=0 +phy_an_c73_71.0=0 +phy_an_c73_72.0=0 +phy_an_c73_73.0=0 +phy_an_c73_74.0=0 +phy_an_c73_75.0=0 +phy_an_c73_76.0=0 +phy_an_c73_77.0=0 +phy_an_c73_78.0=0 +phy_an_c73_79.0=0 +phy_an_c73_80.0=0 +phy_an_c73_81.0=0 +phy_an_c73_82.0=0 +phy_an_c73_83.0=0 +phy_an_c73_84.0=0 +phy_an_c73_85.0=0 +phy_an_c73_86.0=0 +phy_an_c73_87.0=0 +phy_an_c73_88.0=0 +phy_an_c73_89.0=0 +phy_an_c73_90.0=0 +phy_an_c73_91.0=0 +phy_an_c73_92.0=0 +phy_an_c73_93.0=0 +phy_an_c73_94.0=0 +phy_an_c73_95.0=0 +phy_an_c73_96.0=0 +phy_an_c73_97.0=2 +phy_an_c73_98.0=2 +phy_an_c73_99.0=2 +phy_an_c73_100.0=2 +phy_an_c73_101.0=2 +phy_an_c73_102.0=2 +phy_an_c73_103.0=2 +phy_an_c73_104.0=2 + +phy_aux_voltage_enable_1.0=0x1 +phy_aux_voltage_enable_5.0=0x1 +phy_aux_voltage_enable_9.0=0x1 +phy_aux_voltage_enable_13.0=0x1 +phy_aux_voltage_enable_101.0=0x1 +phy_aux_voltage_enable_102.0=0x1 +phy_aux_voltage_enable_103.0=0x1 +phy_aux_voltage_enable_104.0=0x1 + +phy_ext_rom_boot.0=0 + +phy_ext_rom_boot_1.0=0x0 +phy_ext_rom_boot_5.0=0x0 +phy_ext_rom_boot_9.0=0x0 +phy_ext_rom_boot_13.0=0x0 +phy_ext_rom_boot_101.0=0x0 +phy_ext_rom_boot_102.0=0x0 +phy_ext_rom_boot_103.0=0x0 +phy_ext_rom_boot_104.0=0x0 + + +phy_line_tx_mode_1.0=1 +phy_line_tx_mode_5.0=1 +phy_line_tx_mode_9.0=1 +phy_line_tx_mode_13.0=1 +phy_line_tx_mode_101.0=1 +phy_line_tx_mode_102.0=1 +phy_line_tx_mode_103.0=1 +phy_line_tx_mode_104.0=1 + + +phy_rx_polarity_flip_1.0=0x0 +phy_rx_polarity_flip_5.0=0x0 +phy_rx_polarity_flip_9.0=0x0 +phy_rx_polarity_flip_13.0=0x0 +phy_rx_polarity_flip_101.0=0x0 +phy_rx_polarity_flip_102.0=0x0 +phy_rx_polarity_flip_103.0=0x0 +phy_rx_polarity_flip_104.0=0x0 + +phy_system_tx_mode_1.0=0 +phy_system_tx_mode_5.0=0 +phy_system_tx_mode_9.0=0 +phy_system_tx_mode_13.0=0 +phy_system_tx_mode_101.0=0 +phy_system_tx_mode_102.0=0 +phy_system_tx_mode_103.0=0 +phy_system_tx_mode_104.0=0 + + +phy_tx_polarity_flip_1.0=0x0 +phy_tx_polarity_flip_5.0=0x0 +phy_tx_polarity_flip_9.0=0x0 +phy_tx_polarity_flip_13.0=0x0 +phy_tx_polarity_flip_101.0=0x0 +phy_tx_polarity_flip_102.0=0x0 +phy_tx_polarity_flip_103.0=0x0 +phy_tx_polarity_flip_104.0=0x0 + + +phy_xaui_rx_polarity_flip_1.0=0x0 +phy_xaui_rx_polarity_flip_5.0=0x0 +phy_xaui_rx_polarity_flip_9.0=0x0 +phy_xaui_rx_polarity_flip_13.0=0x0 +phy_xaui_rx_polarity_flip_17.0=0x0 +phy_xaui_rx_polarity_flip_21.0=0x0 +phy_xaui_rx_polarity_flip_25.0=0x0 +phy_xaui_rx_polarity_flip_29.0=0x0 +phy_xaui_rx_polarity_flip_33.0=0x0 +phy_xaui_rx_polarity_flip_37.0=0x0 +phy_xaui_rx_polarity_flip_41.0=0x0 +phy_xaui_rx_polarity_flip_45.0=0x0 +phy_xaui_rx_polarity_flip_49.0=0x0 +phy_xaui_rx_polarity_flip_53.0=0x0 +phy_xaui_rx_polarity_flip_57.0=0x0 +phy_xaui_rx_polarity_flip_61.0=0x0 +phy_xaui_rx_polarity_flip_65.0=0x0 +phy_xaui_rx_polarity_flip_66.0=0x0 +phy_xaui_rx_polarity_flip_67.0=0x0 +phy_xaui_rx_polarity_flip_68.0=0x0 +phy_xaui_rx_polarity_flip_69.0=0x0 +phy_xaui_rx_polarity_flip_70.0=0x0 +phy_xaui_rx_polarity_flip_71.0=0x0 +phy_xaui_rx_polarity_flip_72.0=0x0 +phy_xaui_rx_polarity_flip_73.0=0x0 +phy_xaui_rx_polarity_flip_74.0=0x0 +phy_xaui_rx_polarity_flip_75.0=0x0 +phy_xaui_rx_polarity_flip_76.0=0x0 +phy_xaui_rx_polarity_flip_77.0=0x0 +phy_xaui_rx_polarity_flip_78.0=0x0 +phy_xaui_rx_polarity_flip_79.0=0x0 +phy_xaui_rx_polarity_flip_80.0=0x0 +phy_xaui_rx_polarity_flip_81.0=0x0 +phy_xaui_rx_polarity_flip_82.0=0x0 +phy_xaui_rx_polarity_flip_83.0=0x0 +phy_xaui_rx_polarity_flip_84.0=0x0 +phy_xaui_rx_polarity_flip_85.0=0x0 +phy_xaui_rx_polarity_flip_86.0=0x0 +phy_xaui_rx_polarity_flip_87.0=0x0 +phy_xaui_rx_polarity_flip_88.0=0x0 +phy_xaui_rx_polarity_flip_89.0=0x0 +phy_xaui_rx_polarity_flip_90.0=0x0 +phy_xaui_rx_polarity_flip_91.0=0x0 +phy_xaui_rx_polarity_flip_92.0=0x0 +phy_xaui_rx_polarity_flip_93.0=0x0 +phy_xaui_rx_polarity_flip_94.0=0x0 +phy_xaui_rx_polarity_flip_95.0=0x0 +phy_xaui_rx_polarity_flip_96.0=0x0 +phy_xaui_rx_polarity_flip_97.0=0x0 +phy_xaui_rx_polarity_flip_98.0=0x0 +phy_xaui_rx_polarity_flip_99.0=0x0 +phy_xaui_rx_polarity_flip_100.0=0x0 +phy_xaui_rx_polarity_flip_101.0=0x0 +phy_xaui_rx_polarity_flip_102.0=0x0 +phy_xaui_rx_polarity_flip_103.0=0x0 +phy_xaui_rx_polarity_flip_104.0=0x0 + +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_5.0=0x0 +phy_xaui_tx_polarity_flip_9.0=0x0 +phy_xaui_tx_polarity_flip_13.0=0x0 +phy_xaui_tx_polarity_flip_17.0=0x0 +phy_xaui_tx_polarity_flip_21.0=0x0 +phy_xaui_tx_polarity_flip_25.0=0x0 +phy_xaui_tx_polarity_flip_29.0=0x0 +phy_xaui_tx_polarity_flip_33.0=0x0 +phy_xaui_tx_polarity_flip_37.0=0x0 +phy_xaui_tx_polarity_flip_41.0=0x0 +phy_xaui_tx_polarity_flip_45.0=0x0 +phy_xaui_tx_polarity_flip_49.0=0x0 +phy_xaui_tx_polarity_flip_53.0=0x0 +phy_xaui_tx_polarity_flip_57.0=0x0 +phy_xaui_tx_polarity_flip_61.0=0x0 +phy_xaui_tx_polarity_flip_65.0=0x0 +phy_xaui_tx_polarity_flip_66.0=0x0 +phy_xaui_tx_polarity_flip_67.0=0x0 +phy_xaui_tx_polarity_flip_68.0=0x0 +phy_xaui_tx_polarity_flip_69.0=0x0 +phy_xaui_tx_polarity_flip_70.0=0x0 +phy_xaui_tx_polarity_flip_71.0=0x0 +phy_xaui_tx_polarity_flip_72.0=0x0 +phy_xaui_tx_polarity_flip_73.0=0x0 +phy_xaui_tx_polarity_flip_74.0=0x0 +phy_xaui_tx_polarity_flip_75.0=0x0 +phy_xaui_tx_polarity_flip_76.0=0x0 +phy_xaui_tx_polarity_flip_77.0=0x0 +phy_xaui_tx_polarity_flip_78.0=0x0 +phy_xaui_tx_polarity_flip_79.0=0x0 +phy_xaui_tx_polarity_flip_80.0=0x0 +phy_xaui_tx_polarity_flip_81.0=0x0 +phy_xaui_tx_polarity_flip_82.0=0x0 +phy_xaui_tx_polarity_flip_83.0=0x0 +phy_xaui_tx_polarity_flip_84.0=0x0 +phy_xaui_tx_polarity_flip_85.0=0x0 +phy_xaui_tx_polarity_flip_86.0=0x0 +phy_xaui_tx_polarity_flip_87.0=0x0 +phy_xaui_tx_polarity_flip_88.0=0x0 +phy_xaui_tx_polarity_flip_89.0=0x0 +phy_xaui_tx_polarity_flip_90.0=0x0 +phy_xaui_tx_polarity_flip_91.0=0x0 +phy_xaui_tx_polarity_flip_92.0=0x0 +phy_xaui_tx_polarity_flip_93.0=0x0 +phy_xaui_tx_polarity_flip_94.0=0x0 +phy_xaui_tx_polarity_flip_95.0=0x0 +phy_xaui_tx_polarity_flip_96.0=0x0 +phy_xaui_tx_polarity_flip_97.0=0x0 +phy_xaui_tx_polarity_flip_98.0=0x0 +phy_xaui_tx_polarity_flip_99.0=0x0 +phy_xaui_tx_polarity_flip_100.0=0x0 +phy_xaui_tx_polarity_flip_101.0=0x0 +phy_xaui_tx_polarity_flip_102.0=0x0 +phy_xaui_tx_polarity_flip_103.0=0x0 +phy_xaui_tx_polarity_flip_104.0=0x0 + +port_init_autoneg_17.0=0 +port_init_autoneg_21.0=0 +port_init_autoneg_25.0=0 +port_init_autoneg_29.0=0 +port_init_autoneg_33.0=0 +port_init_autoneg_37.0=0 +port_init_autoneg_41.0=0 +port_init_autoneg_45.0=0 +port_init_autoneg_49.0=0 +port_init_autoneg_53.0=0 +port_init_autoneg_57.0=0 +port_init_autoneg_61.0=0 +port_init_autoneg_65.0=0 +port_init_autoneg_66.0=0 +port_init_autoneg_67.0=0 +port_init_autoneg_68.0=0 +port_init_autoneg_69.0=0 +port_init_autoneg_70.0=0 +port_init_autoneg_71.0=0 +port_init_autoneg_72.0=0 +port_init_autoneg_73.0=0 +port_init_autoneg_74.0=0 +port_init_autoneg_75.0=0 +port_init_autoneg_76.0=0 +port_init_autoneg_77.0=0 +port_init_autoneg_78.0=0 +port_init_autoneg_79.0=0 +port_init_autoneg_80.0=0 +port_init_autoneg_81.0=0 +port_init_autoneg_82.0=0 +port_init_autoneg_83.0=0 +port_init_autoneg_84.0=0 +port_init_autoneg_85.0=0 +port_init_autoneg_86.0=0 +port_init_autoneg_87.0=0 +port_init_autoneg_88.0=0 +port_init_autoneg_89.0=0 +port_init_autoneg_90.0=0 +port_init_autoneg_91.0=0 +port_init_autoneg_92.0=0 +port_init_autoneg_93.0=0 +port_init_autoneg_94.0=0 +port_init_autoneg_95.0=0 +port_init_autoneg_96.0=0 +port_init_autoneg_97.0=0 +port_init_autoneg_98.0=0 +port_init_autoneg_99.0=0 +port_init_autoneg_100.0=0 + +port_init_cl72_hg.0=0x11 + + +portmap_1.0=125:40 +portmap_5.0=121:40 +portmap_9.0=13:40 +portmap_13.0=9:40 +portmap_17.0=17:40 +portmap_21.0=21:40 +portmap_25.0=25:40 +portmap_29.0=29:40 +portmap_33.0=37:40 +portmap_37.0=33:40 +portmap_41.0=45:40 +portmap_45.0=41:40 +portmap_49.0=53:40 +portmap_53.0=49:40 +portmap_57.0=69:40 +portmap_61.0=65:40 +portmap_65.0=77:10 +portmap_66.0=78:10 +portmap_67.0=79:10 +portmap_68.0=80:10 +portmap_69.0=73:10 +portmap_70.0=74:10 +portmap_71.0=75:10 +portmap_72.0=76:10 +portmap_73.0=93:10 +portmap_74.0=94:10 +portmap_75.0=95:10 +portmap_76.0=96:10 +portmap_77.0=89:10 +portmap_78.0=90:10 +portmap_79.0=91:10 +portmap_80.0=92:10 +portmap_81.0=101:10 +portmap_82.0=102:10 +portmap_83.0=103:10 +portmap_84.0=104:10 +portmap_85.0=97:10 +portmap_86.0=98:10 +portmap_87.0=99:10 +portmap_88.0=100:10 +portmap_89.0=109:10 +portmap_90.0=110:10 +portmap_91.0=111:10 +portmap_92.0=112:10 +portmap_93.0=105:10 +portmap_94.0=106:10 +portmap_95.0=107:10 +portmap_96.0=108:10 +portmap_97.0=61:40 +portmap_98.0=57:40 +portmap_99.0=81:40 +portmap_100.0=85:40 +portmap_101.0=117:40 +portmap_102.0=113:40 +portmap_103.0=5:40 +portmap_104.0=1:40 + +port_phy_addr_1.0=0x4 +port_phy_addr_5.0=0x0 +port_phy_addr_9.0=0x2c +port_phy_addr_13.0=0x28 +port_phy_addr_17.0=0x7f +port_phy_addr_21.0=0x7f +port_phy_addr_25.0=0x7f +port_phy_addr_29.0=0x7f +port_phy_addr_33.0=0x7f +port_phy_addr_37.0=0x7f +port_phy_addr_41.0=0x7f +port_phy_addr_45.0=0x7f +port_phy_addr_49.0=0x7f +port_phy_addr_53.0=0x7f +port_phy_addr_57.0=0x7f +port_phy_addr_61.0=0x7f +port_phy_addr_65.0=0x7f +port_phy_addr_66.0=0x7f +port_phy_addr_67.0=0x7f +port_phy_addr_68.0=0x7f +port_phy_addr_69.0=0x7f +port_phy_addr_70.0=0x7f +port_phy_addr_71.0=0x7f +port_phy_addr_72.0=0x7f +port_phy_addr_73.0=0x7f +port_phy_addr_74.0=0x7f +port_phy_addr_75.0=0x7f +port_phy_addr_76.0=0x7f +port_phy_addr_77.0=0x7f +port_phy_addr_78.0=0x7f +port_phy_addr_79.0=0x7f +port_phy_addr_80.0=0x7f +port_phy_addr_81.0=0x7f +port_phy_addr_82.0=0x7f +port_phy_addr_83.0=0x7f +port_phy_addr_84.0=0x7f +port_phy_addr_85.0=0x7f +port_phy_addr_86.0=0x7f +port_phy_addr_87.0=0x7f +port_phy_addr_88.0=0x7f +port_phy_addr_89.0=0x7f +port_phy_addr_90.0=0x7f +port_phy_addr_91.0=0x7f +port_phy_addr_92.0=0x7f +port_phy_addr_93.0=0x7f +port_phy_addr_94.0=0x7f +port_phy_addr_95.0=0x7f +port_phy_addr_96.0=0x7f +port_phy_addr_97.0=0x7f +port_phy_addr_98.0=0x7f +port_phy_addr_99.0=0x7f +port_phy_addr_100.0=0x7f +port_phy_addr_101.0=0x54 +port_phy_addr_102.0=0x50 +port_phy_addr_103.0=0x7c +port_phy_addr_104.0=0x78 + +port_phy_clause_1.0=0x2d +port_phy_clause_5.0=0x2d +port_phy_clause_9.0=0x2d +port_phy_clause_13.0=0x2d +port_phy_clause_101.0=0x2d +port_phy_clause_102.0=0x2d +port_phy_clause_103.0=0x2d +port_phy_clause_104.0=0x2d + +port_phy_id0_1.0=0x600d +port_phy_id0_5.0=0x600d +port_phy_id0_9.0=0x600d +port_phy_id0_13.0=0x600d +port_phy_id0_101.0=0x600d +port_phy_id0_102.0=0x600d +port_phy_id0_103.0=0x600d +port_phy_id0_104.0=0x600d + +port_phy_id1_1.0=0x8500 +port_phy_id1_5.0=0x8500 +port_phy_id1_9.0=0x8500 +port_phy_id1_13.0=0x8500 +port_phy_id1_101.0=0x8500 +port_phy_id1_102.0=0x8500 +port_phy_id1_103.0=0x8500 +port_phy_id1_104.0=0x8500 + +xgxs_rx_lane_map_1.0=0x0123 +xgxs_rx_lane_map_5.0=0x0123 +xgxs_rx_lane_map_9.0=0x0123 +xgxs_rx_lane_map_13.0=0x0123 +xgxs_rx_lane_map_17.0=0x2031 +xgxs_rx_lane_map_21.0=0x2031 +xgxs_rx_lane_map_25.0=0x2031 +xgxs_rx_lane_map_29.0=0x2031 +xgxs_rx_lane_map_33.0=0x3120 +xgxs_rx_lane_map_37.0=0x3120 +xgxs_rx_lane_map_41.0=0x3120 +xgxs_rx_lane_map_45.0=0x3120 +xgxs_rx_lane_map_49.0=0x3120 +xgxs_rx_lane_map_53.0=0x3120 +xgxs_rx_lane_map_57.0=0x3120 +xgxs_rx_lane_map_61.0=0x3120 +xgxs_rx_lane_map_65.0=0x3120 +xgxs_rx_lane_map_69.0=0x3120 +xgxs_rx_lane_map_73.0=0x3120 +xgxs_rx_lane_map_77.0=0x3120 +xgxs_rx_lane_map_81.0=0x3120 +xgxs_rx_lane_map_85.0=0x3120 +xgxs_rx_lane_map_89.0=0x3120 +xgxs_rx_lane_map_93.0=0x3120 +xgxs_rx_lane_map_97.0=0x1302 +xgxs_rx_lane_map_98.0=0x1302 +xgxs_rx_lane_map_99.0=0x0213 +xgxs_tx_lane_map_100.0=0x0213 +xgxs_tx_lane_map_101.0=0x0123 +xgxs_tx_lane_map_102.0=0x0123 +xgxs_tx_lane_map_103.0=0x0123 +xgxs_tx_lane_map_104.0=0x0123 + +xgxs_tx_lane_map_1.0=0x0123 +xgxs_tx_lane_map_5.0=0x0123 +xgxs_tx_lane_map_9.0=0x0123 +xgxs_tx_lane_map_13.0=0x0123 +xgxs_tx_lane_map_17.0=0x1302 +xgxs_tx_lane_map_21.0=0x1302 +xgxs_tx_lane_map_25.0=0x1302 +xgxs_tx_lane_map_29.0=0x1302 +xgxs_tx_lane_map_33.0=0x3120 +xgxs_tx_lane_map_37.0=0x3120 +xgxs_tx_lane_map_41.0=0x3120 +xgxs_tx_lane_map_45.0=0x3120 +xgxs_tx_lane_map_49.0=0x3120 +xgxs_tx_lane_map_53.0=0x3120 +xgxs_tx_lane_map_57.0=0x3120 +xgxs_tx_lane_map_61.0=0x3120 +xgxs_tx_lane_map_65.0=0x3120 +xgxs_tx_lane_map_69.0=0x3120 +xgxs_tx_lane_map_73.0=0x3120 +xgxs_tx_lane_map_77.0=0x3120 +xgxs_tx_lane_map_81.0=0x3120 +xgxs_tx_lane_map_85.0=0x3120 +xgxs_tx_lane_map_89.0=0x3120 +xgxs_tx_lane_map_93.0=0x3120 +xgxs_tx_lane_map_97.0=0x2031 +xgxs_tx_lane_map_98.0=0x2031 +xgxs_tx_lane_map_99.0=0x0213 +xgxs_rx_lane_map_100.0=0x0213 +xgxs_rx_lane_map_101.0=0x0123 +xgxs_rx_lane_map_102.0=0x0123 +xgxs_rx_lane_map_103.0=0x0123 +xgxs_rx_lane_map_104.0=0x0123 + +serdes_firmware_mode_1.0=1 +serdes_firmware_mode_5.0=1 +serdes_firmware_mode_9.0=1 +serdes_firmware_mode_13.0=1 +serdes_firmware_mode_17.0=2 +serdes_firmware_mode_21.0=2 +serdes_firmware_mode_25.0=2 +serdes_firmware_mode_29.0=2 +serdes_firmware_mode_33.0=2 +serdes_firmware_mode_37.0=2 +serdes_firmware_mode_41.0=2 +serdes_firmware_mode_45.0=2 +serdes_firmware_mode_49.0=2 +serdes_firmware_mode_53.0=2 +serdes_firmware_mode_57.0=2 +serdes_firmware_mode_61.0=2 +serdes_firmware_mode_65.0=2 +serdes_firmware_mode_66.0=2 +serdes_firmware_mode_67.0=2 +serdes_firmware_mode_68.0=2 +serdes_firmware_mode_69.0=2 +serdes_firmware_mode_70.0=2 +serdes_firmware_mode_71.0=2 +serdes_firmware_mode_72.0=2 +serdes_firmware_mode_73.0=2 +serdes_firmware_mode_74.0=2 +serdes_firmware_mode_75.0=2 +serdes_firmware_mode_76.0=2 +serdes_firmware_mode_77.0=2 +serdes_firmware_mode_78.0=2 +serdes_firmware_mode_79.0=2 +serdes_firmware_mode_80.0=2 +serdes_firmware_mode_81.0=2 +serdes_firmware_mode_82.0=2 +serdes_firmware_mode_83.0=2 +serdes_firmware_mode_84.0=2 +serdes_firmware_mode_85.0=2 +serdes_firmware_mode_86.0=2 +serdes_firmware_mode_87.0=2 +serdes_firmware_mode_88.0=2 +serdes_firmware_mode_89.0=2 +serdes_firmware_mode_90.0=2 +serdes_firmware_mode_91.0=2 +serdes_firmware_mode_92.0=2 +serdes_firmware_mode_93.0=2 +serdes_firmware_mode_94.0=2 +serdes_firmware_mode_95.0=2 +serdes_firmware_mode_96.0=2 +serdes_firmware_mode_97.0=2 +serdes_firmware_mode_98.0=2 +serdes_firmware_mode_99.0=2 +serdes_firmware_mode_100.0=2 +serdes_firmware_mode_101.0=1 +serdes_firmware_mode_102.0=1 +serdes_firmware_mode_103.0=1 +serdes_firmware_mode_104.0=1 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile index 938d37180676..27d83fcc20e9 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/sai.profile @@ -1,2 +1,2 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/td2-a7050-qx32-32x40G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-a7050-qx32-32x40G.config.bcm SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm new file mode 100644 index 000000000000..701a8480dcb3 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm @@ -0,0 +1,873 @@ +#/****************************************************************************** +# * +# * File: config.bcm.cloverdales (7050-QX32) +# * Name: +# * +# * Description: This file contains SDK properties for an Arista +# * Cloverdales platform. +# * +# *----------------------------------------------------------------------------- +# ******************************************************************************/ +#################################################################### +# BCM Config file for Cloverdale platform +# - 32x40g Portmode + +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# l2 thread related config vars +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 + +bcm_num_cos=8 +bcm_stat_interval=2000000 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +scache_filename=/tmp/scache +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +# for GLC transceiver +phy_an_c73=0x0 +phy_an_c37=0x3 + +########################### +#port_init_speed_xe=40000 +#port_init_speed_xe.0=40000 + +#load_firmware=0x0102 +load_firmware.0=2 + +######################### +# All ports are in oversubscription mode +pbmp_oversubscribe=0x1fffffffffffffffffffffffffe +pbmp_xport_xe.0=0x1fffffffe + +phy_84328_1.0=1 +phy_84328_2.0=1 +phy_84328_29.0=1 +phy_84328_3.0=1 +phy_84328_30.0=1 +phy_84328_31.0=1 +phy_84328_32.0=1 +phy_84328_4.0=1 +phy_an_c37_1.0=3 +phy_an_c37_10.0=3 +phy_an_c37_11.0=3 +phy_an_c37_12.0=3 +phy_an_c37_13.0=3 +phy_an_c37_14.0=3 +phy_an_c37_15.0=3 +phy_an_c37_16.0=3 +phy_an_c37_17.0=3 +phy_an_c37_18.0=3 +phy_an_c37_19.0=3 +phy_an_c37_2.0=3 +phy_an_c37_20.0=3 +phy_an_c37_21.0=3 +phy_an_c37_22.0=3 +phy_an_c37_23.0=3 +phy_an_c37_24.0=3 +phy_an_c37_25.0=3 +phy_an_c37_26.0=3 +phy_an_c37_27.0=3 +phy_an_c37_28.0=3 +phy_an_c37_29.0=3 +phy_an_c37_3.0=3 +phy_an_c37_30.0=3 +phy_an_c37_31.0=3 +phy_an_c37_32.0=3 +phy_an_c37_4.0=3 +phy_an_c37_5.0=3 +phy_an_c37_6.0=3 +phy_an_c37_7.0=3 +phy_an_c37_8.0=3 +phy_an_c37_9.0=3 +phy_an_c73_1.0=1 +phy_an_c73_10.0=1 +phy_an_c73_11.0=1 +phy_an_c73_12.0=1 +phy_an_c73_13.0=1 +phy_an_c73_14.0=1 +phy_an_c73_15.0=1 +phy_an_c73_16.0=1 +phy_an_c73_17.0=1 +phy_an_c73_18.0=1 +phy_an_c73_19.0=1 +phy_an_c73_2.0=1 +phy_an_c73_20.0=1 +phy_an_c73_21.0=1 +phy_an_c73_22.0=1 +phy_an_c73_23.0=1 +phy_an_c73_24.0=1 +phy_an_c73_25.0=1 +phy_an_c73_26.0=1 +phy_an_c73_27.0=1 +phy_an_c73_28.0=1 +phy_an_c73_29.0=1 +phy_an_c73_3.0=1 +phy_an_c73_30.0=1 +phy_an_c73_31.0=1 +phy_an_c73_32.0=1 +phy_an_c73_4.0=1 +phy_an_c73_5.0=1 +phy_an_c73_6.0=1 +phy_an_c73_7.0=1 +phy_an_c73_8.0=1 +phy_an_c73_9.0=1 +phy_aux_voltage_enable_1.0=0x1 +phy_aux_voltage_enable_2.0=0x1 +phy_aux_voltage_enable_29.0=0x1 +phy_aux_voltage_enable_3.0=0x1 +phy_aux_voltage_enable_30.0=0x1 +phy_aux_voltage_enable_31.0=0x1 +phy_aux_voltage_enable_32.0=0x1 +phy_aux_voltage_enable_4.0=0x1 +phy_ext_rom_boot.0=0 +phy_ext_rom_boot_1.0=0x0 +phy_ext_rom_boot_2.0=0x0 +phy_ext_rom_boot_29.0=0x0 +phy_ext_rom_boot_3.0=0x0 +phy_ext_rom_boot_30.0=0x0 +phy_ext_rom_boot_31.0=0x0 +phy_ext_rom_boot_32.0=0x0 +phy_ext_rom_boot_4.0=0x0 +phy_line_tx_mode_1.0=1 +phy_line_tx_mode_2.0=1 +phy_line_tx_mode_29.0=1 +phy_line_tx_mode_3.0=1 +phy_line_tx_mode_30.0=1 +phy_line_tx_mode_31.0=1 +phy_line_tx_mode_32.0=1 +phy_line_tx_mode_4.0=1 +phy_rx_polarity_flip_1.0=0x0 +phy_rx_polarity_flip_2.0=0x0 +phy_rx_polarity_flip_29.0=0x0 +phy_rx_polarity_flip_3.0=0x0 +phy_rx_polarity_flip_30.0=0x0 +phy_rx_polarity_flip_31.0=0x0 +phy_rx_polarity_flip_32.0=0x0 +phy_rx_polarity_flip_4.0=0x0 +phy_system_tx_mode_1.0=0 +phy_system_tx_mode_2.0=0 +phy_system_tx_mode_29.0=0 +phy_system_tx_mode_3.0=0 +phy_system_tx_mode_30.0=0 +phy_system_tx_mode_31.0=0 +phy_system_tx_mode_32.0=0 +phy_system_tx_mode_4.0=0 +phy_tx_polarity_flip_1.0=0x0 +phy_tx_polarity_flip_2.0=0x0 +phy_tx_polarity_flip_29.0=0x0 +phy_tx_polarity_flip_3.0=0x0 +phy_tx_polarity_flip_30.0=0x0 +phy_tx_polarity_flip_31.0=0x0 +phy_tx_polarity_flip_32.0=0x0 +phy_tx_polarity_flip_4.0=0x0 +phy_xaui_rx_polarity_flip_1.0=0x0 +phy_xaui_rx_polarity_flip_10.0=0x0 +phy_xaui_rx_polarity_flip_11.0=0x0 +phy_xaui_rx_polarity_flip_12.0=0x0 +phy_xaui_rx_polarity_flip_13.0=0x0 +phy_xaui_rx_polarity_flip_14.0=0x0 +phy_xaui_rx_polarity_flip_15.0=0x0 +phy_xaui_rx_polarity_flip_16.0=0x0 +phy_xaui_rx_polarity_flip_17.0=0x0 +phy_xaui_rx_polarity_flip_18.0=0x0 +phy_xaui_rx_polarity_flip_19.0=0x0 +phy_xaui_rx_polarity_flip_2.0=0x0 +phy_xaui_rx_polarity_flip_20.0=0x0 +phy_xaui_rx_polarity_flip_21.0=0x0 +phy_xaui_rx_polarity_flip_22.0=0x0 +phy_xaui_rx_polarity_flip_23.0=0x0 +phy_xaui_rx_polarity_flip_24.0=0x0 +phy_xaui_rx_polarity_flip_25.0=0x0 +phy_xaui_rx_polarity_flip_26.0=0x0 +phy_xaui_rx_polarity_flip_27.0=0x0 +phy_xaui_rx_polarity_flip_28.0=0x0 +phy_xaui_rx_polarity_flip_29.0=0x0 +phy_xaui_rx_polarity_flip_3.0=0x0 +phy_xaui_rx_polarity_flip_30.0=0x0 +phy_xaui_rx_polarity_flip_31.0=0x0 +phy_xaui_rx_polarity_flip_32.0=0x0 +phy_xaui_rx_polarity_flip_4.0=0x0 +phy_xaui_rx_polarity_flip_5.0=0x0 +phy_xaui_rx_polarity_flip_6.0=0x0 +phy_xaui_rx_polarity_flip_7.0=0x0 +phy_xaui_rx_polarity_flip_8.0=0x0 +phy_xaui_rx_polarity_flip_9.0=0x0 +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_10.0=0x0 +phy_xaui_tx_polarity_flip_11.0=0x0 +phy_xaui_tx_polarity_flip_12.0=0x0 +phy_xaui_tx_polarity_flip_13.0=0x0 +phy_xaui_tx_polarity_flip_14.0=0x0 +phy_xaui_tx_polarity_flip_15.0=0x0 +phy_xaui_tx_polarity_flip_16.0=0x0 +phy_xaui_tx_polarity_flip_17.0=0x0 +phy_xaui_tx_polarity_flip_18.0=0x0 +phy_xaui_tx_polarity_flip_19.0=0x0 +phy_xaui_tx_polarity_flip_2.0=0x0 +phy_xaui_tx_polarity_flip_20.0=0x0 +phy_xaui_tx_polarity_flip_21.0=0x0 +phy_xaui_tx_polarity_flip_22.0=0x0 +phy_xaui_tx_polarity_flip_23.0=0x0 +phy_xaui_tx_polarity_flip_24.0=0x0 +phy_xaui_tx_polarity_flip_25.0=0x0 +phy_xaui_tx_polarity_flip_26.0=0x0 +phy_xaui_tx_polarity_flip_27.0=0x0 +phy_xaui_tx_polarity_flip_28.0=0x0 +phy_xaui_tx_polarity_flip_29.0=0x0 +phy_xaui_tx_polarity_flip_3.0=0x0 +phy_xaui_tx_polarity_flip_30.0=0x0 +phy_xaui_tx_polarity_flip_31.0=0x0 +phy_xaui_tx_polarity_flip_32.0=0x0 +phy_xaui_tx_polarity_flip_4.0=0x0 +phy_xaui_tx_polarity_flip_5.0=0x0 +phy_xaui_tx_polarity_flip_6.0=0x0 +phy_xaui_tx_polarity_flip_7.0=0x0 +phy_xaui_tx_polarity_flip_8.0=0x0 +phy_xaui_tx_polarity_flip_9.0=0x0 +port_init_autoneg_10.0=0 +port_init_autoneg_11.0=0 +port_init_autoneg_12.0=0 +port_init_autoneg_13.0=0 +port_init_autoneg_14.0=0 +port_init_autoneg_15.0=0 +port_init_autoneg_16.0=0 +port_init_autoneg_17.0=0 +port_init_autoneg_18.0=0 +port_init_autoneg_19.0=0 +port_init_autoneg_20.0=0 +port_init_autoneg_21.0=0 +port_init_autoneg_22.0=0 +port_init_autoneg_23.0=0 +port_init_autoneg_24.0=0 +port_init_autoneg_25.0=0 +port_init_autoneg_26.0=0 +port_init_autoneg_27.0=0 +port_init_autoneg_28.0=0 +port_init_autoneg_5.0=0 +port_init_autoneg_6.0=0 +port_init_autoneg_7.0=0 +port_init_autoneg_8.0=0 +port_init_autoneg_9.0=0 +port_init_cl72_hg.0=0x11 +port_phy_addr_1.0=0x4 +port_phy_addr_10.0=0x7f +port_phy_addr_11.0=0x7f +port_phy_addr_12.0=0x7f +port_phy_addr_13.0=0x7f +port_phy_addr_14.0=0x7f +port_phy_addr_15.0=0x7f +port_phy_addr_16.0=0x7f +port_phy_addr_17.0=0x7f +port_phy_addr_18.0=0x7f +port_phy_addr_19.0=0x7f +port_phy_addr_2.0=0x0 +port_phy_addr_20.0=0x7f +port_phy_addr_21.0=0x7f +port_phy_addr_22.0=0x7f +port_phy_addr_23.0=0x7f +port_phy_addr_24.0=0x7f +port_phy_addr_25.0=0x7f +port_phy_addr_26.0=0x7f +port_phy_addr_27.0=0x7f +port_phy_addr_28.0=0x7f +port_phy_addr_29.0=0x54 +port_phy_addr_3.0=0x2c +port_phy_addr_30.0=0x50 +port_phy_addr_31.0=0x7c +port_phy_addr_32.0=0x78 +port_phy_addr_4.0=0x28 +port_phy_addr_5.0=0x7f +port_phy_addr_6.0=0x7f +port_phy_addr_7.0=0x7f +port_phy_addr_8.0=0x7f +port_phy_addr_9.0=0x7f +port_phy_clause_1.0=0x2d +port_phy_clause_2.0=0x2d +port_phy_clause_29.0=0x2d +port_phy_clause_3.0=0x2d +port_phy_clause_30.0=0x2d +port_phy_clause_31.0=0x2d +port_phy_clause_32.0=0x2d +port_phy_clause_4.0=0x2d +port_phy_id0_1.0=0x600d +port_phy_id0_2.0=0x600d +port_phy_id0_29.0=0x600d +port_phy_id0_3.0=0x600d +port_phy_id0_30.0=0x600d +port_phy_id0_31.0=0x600d +port_phy_id0_32.0=0x600d +port_phy_id0_4.0=0x600d +port_phy_id1_1.0=0x8500 +port_phy_id1_2.0=0x8500 +port_phy_id1_29.0=0x8500 +port_phy_id1_3.0=0x8500 +port_phy_id1_30.0=0x8500 +port_phy_id1_31.0=0x8500 +port_phy_id1_32.0=0x8500 +port_phy_id1_4.0=0x8500 +portmap_1.0=125:40 +portmap_10.0=33:40 +portmap_11.0=45:40 +portmap_12.0=41:40 +portmap_13.0=53:40 +portmap_14.0=49:40 +portmap_15.0=69:40 +portmap_16.0=65:40 +portmap_17.0=77:40 +portmap_18.0=73:40 +portmap_19.0=93:40 +portmap_2.0=121:40 +portmap_20.0=89:40 +portmap_21.0=101:40 +portmap_22.0=97:40 +portmap_23.0=109:40 +portmap_24.0=105:40 +portmap_25.0=61:40 +portmap_26.0=57:40 +portmap_27.0=81:40 +portmap_28.0=85:40 +portmap_29.0=117:40 +portmap_3.0=13:40 +portmap_30.0=113:40 +portmap_31.0=5:40 +portmap_32.0=1:40 +portmap_4.0=9:40 +portmap_5.0=17:40 +portmap_6.0=21:40 +portmap_7.0=25:40 +portmap_8.0=29:40 +portmap_9.0=37:40 +serdes_firmware_mode_1.0=1 +serdes_firmware_mode_10.0=2 +serdes_firmware_mode_11.0=2 +serdes_firmware_mode_12.0=2 +serdes_firmware_mode_13.0=2 +serdes_firmware_mode_14.0=2 +serdes_firmware_mode_15.0=2 +serdes_firmware_mode_16.0=2 +serdes_firmware_mode_17.0=2 +serdes_firmware_mode_18.0=2 +serdes_firmware_mode_19.0=2 +serdes_firmware_mode_2.0=1 +serdes_firmware_mode_20.0=2 +serdes_firmware_mode_21.0=2 +serdes_firmware_mode_22.0=2 +serdes_firmware_mode_23.0=2 +serdes_firmware_mode_24.0=2 +serdes_firmware_mode_25.0=2 +serdes_firmware_mode_26.0=2 +serdes_firmware_mode_27.0=2 +serdes_firmware_mode_28.0=2 +serdes_firmware_mode_29.0=1 +serdes_firmware_mode_3.0=1 +serdes_firmware_mode_30.0=1 +serdes_firmware_mode_31.0=1 +serdes_firmware_mode_32.0=1 +serdes_firmware_mode_4.0=1 +serdes_firmware_mode_5.0=2 +serdes_firmware_mode_6.0=2 +serdes_firmware_mode_7.0=2 +serdes_firmware_mode_8.0=2 +serdes_firmware_mode_9.0=2 +xgxs_lcpll_xtal_refclk.0=1 +xgxs_rx_lane_map_1.0=0x0123 +xgxs_rx_lane_map_10.0=0x3120 +xgxs_rx_lane_map_11.0=0x3120 +xgxs_rx_lane_map_12.0=0x3120 +xgxs_rx_lane_map_13.0=0x3120 +xgxs_rx_lane_map_14.0=0x3120 +xgxs_rx_lane_map_15.0=0x3120 +xgxs_rx_lane_map_16.0=0x3120 +xgxs_rx_lane_map_17.0=0x3120 +xgxs_rx_lane_map_18.0=0x3120 +xgxs_rx_lane_map_19.0=0x3120 +xgxs_rx_lane_map_2.0=0x0123 +xgxs_rx_lane_map_20.0=0x3120 +xgxs_rx_lane_map_21.0=0x3120 +xgxs_rx_lane_map_22.0=0x3120 +xgxs_rx_lane_map_23.0=0x3120 +xgxs_rx_lane_map_24.0=0x3120 +xgxs_rx_lane_map_25.0=0x2031 +xgxs_rx_lane_map_26.0=0x2031 +xgxs_rx_lane_map_27.0=0x0213 +xgxs_rx_lane_map_28.0=0x0213 +xgxs_rx_lane_map_29.0=0x0123 +xgxs_rx_lane_map_3.0=0x0123 +xgxs_rx_lane_map_30.0=0x0123 +xgxs_rx_lane_map_31.0=0x0123 +xgxs_rx_lane_map_32.0=0x0123 +xgxs_rx_lane_map_4.0=0x0123 +xgxs_rx_lane_map_5.0=0x2031 +xgxs_rx_lane_map_6.0=0x2031 +xgxs_rx_lane_map_7.0=0x2031 +xgxs_rx_lane_map_8.0=0x2031 +xgxs_rx_lane_map_9.0=0x3120 +xgxs_tx_lane_map_1.0=0x0123 +xgxs_tx_lane_map_10.0=0x3120 +xgxs_tx_lane_map_11.0=0x3120 +xgxs_tx_lane_map_12.0=0x3120 +xgxs_tx_lane_map_13.0=0x3120 +xgxs_tx_lane_map_14.0=0x3120 +xgxs_tx_lane_map_15.0=0x3120 +xgxs_tx_lane_map_16.0=0x3120 +xgxs_tx_lane_map_17.0=0x3120 +xgxs_tx_lane_map_18.0=0x3120 +xgxs_tx_lane_map_19.0=0x3120 +xgxs_tx_lane_map_2.0=0x0123 +xgxs_tx_lane_map_20.0=0x3120 +xgxs_tx_lane_map_21.0=0x3120 +xgxs_tx_lane_map_22.0=0x3120 +xgxs_tx_lane_map_23.0=0x3120 +xgxs_tx_lane_map_24.0=0x3120 +xgxs_tx_lane_map_25.0=0x2031 +xgxs_tx_lane_map_26.0=0x2031 +xgxs_tx_lane_map_27.0=0x0213 +xgxs_tx_lane_map_28.0=0x0213 +xgxs_tx_lane_map_29.0=0x0123 +xgxs_tx_lane_map_3.0=0x0123 +xgxs_tx_lane_map_30.0=0x0123 +xgxs_tx_lane_map_31.0=0x0123 +xgxs_tx_lane_map_32.0=0x0123 +xgxs_tx_lane_map_4.0=0x0123 +xgxs_tx_lane_map_5.0=0x1302 +xgxs_tx_lane_map_6.0=0x1302 +xgxs_tx_lane_map_7.0=0x1302 +xgxs_tx_lane_map_8.0=0x1302 +xgxs_tx_lane_map_9.0=0x3120 + +########################################## +#skip_L2_USER_ENTRY=0 +phy_aux_voltage_enable=1 +############################### +serdes_fiber_pref=1 +############################### +mdio_output_delay.0=0x0d +############################### +serdes_sgmii_m=0 +xgxs_lcpll_xtal_refclk=1 +xgxs_lcpll_xtal_refclk.1=1 +xgxs_lcpll_xtal_refclk.2=1 +xgxs_lcpll_xtal_refclk.3=1 +tdma_intr_enable=1 +tslam_intr_enable=1 +tslam_dma_enable.2=1 +tslam_dma_enable.3=1 +#dport_map_port=0 +#dport_map_enable=0 +#dport_map_indexed=0 +#bcm_xlate_port_enable.0=0 +#xgxs_pdetect_1=0 +table_dma_enable.0=1 +table_dma_enable.1=1 +table_dma_enable.2=1 +table_dma_enable.3=1 +serdes_driver_current_lane0_1=2 +serdes_pre_driver_current_lane0_1=2 +serdes_preemphasis_lane0_1=0x8fc0 +serdes_driver_current_lane1_1=2 +serdes_pre_driver_current_lane1_1=2 +serdes_preemphasis_lane1_1=0x8fc0 +serdes_driver_current_lane2_1=2 +serdes_pre_driver_current_lane2_1=2 +serdes_preemphasis_lane2_1=0x8fc0 +serdes_driver_current_lane3_1=2 +serdes_pre_driver_current_lane3_1=2 +serdes_preemphasis_lane3_1=0x8fc0 +serdes_driver_current_lane0_2=3 +serdes_pre_driver_current_lane0_2=2 +serdes_preemphasis_lane0_2=0x8fc0 +serdes_driver_current_lane1_2=3 +serdes_pre_driver_current_lane1_2=2 +serdes_preemphasis_lane1_2=0x8fc0 +serdes_driver_current_lane2_2=3 +serdes_pre_driver_current_lane2_2=2 +serdes_preemphasis_lane2_2=0x8fc0 +serdes_driver_current_lane3_2=3 +serdes_pre_driver_current_lane3_2=2 +serdes_preemphasis_lane3_2=0x8fc0 +serdes_driver_current_lane0_3=2 +serdes_pre_driver_current_lane0_3=2 +serdes_preemphasis_lane0_3=0x8fc0 +serdes_driver_current_lane1_3=2 +serdes_pre_driver_current_lane1_3=2 +serdes_preemphasis_lane1_3=0x8fc0 +serdes_driver_current_lane2_3=2 +serdes_pre_driver_current_lane2_3=2 +serdes_preemphasis_lane2_3=0x8fc0 +serdes_driver_current_lane3_3=2 +serdes_pre_driver_current_lane3_3=2 +serdes_preemphasis_lane3_3=0x8fc0 +serdes_driver_current_lane0_4=2 +serdes_pre_driver_current_lane0_4=2 +serdes_preemphasis_lane0_4=0x8fc0 +serdes_driver_current_lane1_4=2 +serdes_pre_driver_current_lane1_4=2 +serdes_preemphasis_lane1_4=0x8fc0 +serdes_driver_current_lane2_4=2 +serdes_pre_driver_current_lane2_4=2 +serdes_preemphasis_lane2_4=0x8fc0 +serdes_driver_current_lane3_4=2 +serdes_pre_driver_current_lane3_4=2 +serdes_preemphasis_lane3_4=0x8fc0 +serdes_driver_current_lane0_5=4 +serdes_pre_driver_current_lane0_5=4 +serdes_preemphasis_lane0_5=0xbf00 +serdes_driver_current_lane1_5=4 +serdes_pre_driver_current_lane1_5=4 +serdes_preemphasis_lane1_5=0xbf00 +serdes_driver_current_lane2_5=4 +serdes_pre_driver_current_lane2_5=4 +serdes_preemphasis_lane2_5=0xbf00 +serdes_driver_current_lane3_5=4 +serdes_pre_driver_current_lane3_5=4 +serdes_preemphasis_lane3_5=0xbf00 +serdes_driver_current_lane0_6=4 +serdes_pre_driver_current_lane0_6=4 +serdes_preemphasis_lane0_6=0xbb10 +serdes_driver_current_lane1_6=4 +serdes_pre_driver_current_lane1_6=4 +serdes_preemphasis_lane1_6=0xbb10 +serdes_driver_current_lane2_6=4 +serdes_pre_driver_current_lane2_6=4 +serdes_preemphasis_lane2_6=0xbb10 +serdes_driver_current_lane3_6=4 +serdes_pre_driver_current_lane3_6=4 +serdes_preemphasis_lane3_6=0xbb10 +serdes_driver_current_lane0_7=3 +serdes_pre_driver_current_lane0_7=3 +serdes_preemphasis_lane0_7=0xcad0 +serdes_driver_current_lane1_7=3 +serdes_pre_driver_current_lane1_7=3 +serdes_preemphasis_lane1_7=0xcad0 +serdes_driver_current_lane2_7=3 +serdes_pre_driver_current_lane2_7=3 +serdes_preemphasis_lane2_7=0xcad0 +serdes_driver_current_lane3_7=3 +serdes_pre_driver_current_lane3_7=3 +serdes_preemphasis_lane3_7=0xcad0 +serdes_driver_current_lane0_8=3 +serdes_pre_driver_current_lane0_8=3 +serdes_preemphasis_lane0_8=0xcad0 +serdes_driver_current_lane1_8=3 +serdes_pre_driver_current_lane1_8=3 +serdes_preemphasis_lane1_8=0xcad0 +serdes_driver_current_lane2_8=3 +serdes_pre_driver_current_lane2_8=3 +serdes_preemphasis_lane2_8=0xcad0 +serdes_driver_current_lane3_8=3 +serdes_pre_driver_current_lane3_8=3 +serdes_preemphasis_lane3_8=0xcad0 +serdes_driver_current_lane0_9=3 +serdes_pre_driver_current_lane0_9=3 +serdes_preemphasis_lane0_9=0xc2f0 +serdes_driver_current_lane1_9=3 +serdes_pre_driver_current_lane1_9=3 +serdes_preemphasis_lane1_9=0xc2f0 +serdes_driver_current_lane2_9=3 +serdes_pre_driver_current_lane2_9=3 +serdes_preemphasis_lane2_9=0xc2f0 +serdes_driver_current_lane3_9=3 +serdes_pre_driver_current_lane3_9=3 +serdes_preemphasis_lane3_9=0xc2f0 +serdes_driver_current_lane0_10=3 +serdes_pre_driver_current_lane0_10=3 +serdes_preemphasis_lane0_10=0xc6e0 +serdes_driver_current_lane1_10=3 +serdes_pre_driver_current_lane1_10=3 +serdes_preemphasis_lane1_10=0xc6e0 +serdes_driver_current_lane2_10=3 +serdes_pre_driver_current_lane2_10=3 +serdes_preemphasis_lane2_10=0xc6e0 +serdes_driver_current_lane3_10=3 +serdes_pre_driver_current_lane3_10=3 +serdes_preemphasis_lane3_10=0xc6e0 +serdes_driver_current_lane0_11=3 +serdes_pre_driver_current_lane0_11=3 +serdes_preemphasis_lane0_11=0xc2f0 +serdes_driver_current_lane1_11=3 +serdes_pre_driver_current_lane1_11=3 +serdes_preemphasis_lane1_11=0xc2f0 +serdes_driver_current_lane2_11=3 +serdes_pre_driver_current_lane2_11=3 +serdes_preemphasis_lane2_11=0xc2f0 +serdes_driver_current_lane3_11=3 +serdes_pre_driver_current_lane3_11=3 +serdes_preemphasis_lane3_11=0xc2f0 +serdes_driver_current_lane0_12=3 +serdes_pre_driver_current_lane0_12=3 +serdes_preemphasis_lane0_12=0xc2f0 +serdes_driver_current_lane1_12=3 +serdes_pre_driver_current_lane1_12=3 +serdes_preemphasis_lane1_12=0xc2f0 +serdes_driver_current_lane2_12=3 +serdes_pre_driver_current_lane2_12=3 +serdes_preemphasis_lane2_12=0xc2f0 +serdes_driver_current_lane3_12=3 +serdes_pre_driver_current_lane3_12=3 +serdes_preemphasis_lane3_12=0xc2f0 +serdes_driver_current_lane0_13=3 +serdes_pre_driver_current_lane0_13=3 +serdes_preemphasis_lane0_13=0xc2f0 +serdes_driver_current_lane1_13=3 +serdes_pre_driver_current_lane1_13=3 +serdes_preemphasis_lane1_13=0xc2f0 +serdes_driver_current_lane2_13=3 +serdes_pre_driver_current_lane2_13=3 +serdes_preemphasis_lane2_13=0xc2f0 +serdes_driver_current_lane3_13=3 +serdes_pre_driver_current_lane3_13=3 +serdes_preemphasis_lane3_13=0xc2f0 +serdes_driver_current_lane0_14=3 +serdes_pre_driver_current_lane0_14=3 +serdes_preemphasis_lane0_14=0xc2f0 +serdes_driver_current_lane1_14=3 +serdes_pre_driver_current_lane1_14=3 +serdes_preemphasis_lane1_14=0xc2f0 +serdes_driver_current_lane2_14=3 +serdes_pre_driver_current_lane2_14=3 +serdes_preemphasis_lane2_14=0xc2f0 +serdes_driver_current_lane3_14=3 +serdes_pre_driver_current_lane3_14=3 +serdes_preemphasis_lane3_14=0xc2f0 +serdes_driver_current_lane0_15=3 +serdes_pre_driver_current_lane0_15=3 +serdes_preemphasis_lane0_15=0xc2f0 +serdes_driver_current_lane1_15=3 +serdes_pre_driver_current_lane1_15=3 +serdes_preemphasis_lane1_15=0xc2f0 +serdes_driver_current_lane2_15=3 +serdes_pre_driver_current_lane2_15=3 +serdes_preemphasis_lane2_15=0xc2f0 +serdes_driver_current_lane3_15=3 +serdes_pre_driver_current_lane3_15=3 +serdes_preemphasis_lane3_15=0xc2f0 +serdes_driver_current_lane0_16=3 +serdes_pre_driver_current_lane0_16=3 +serdes_preemphasis_lane0_16=0xc2f0 +serdes_driver_current_lane1_16=3 +serdes_pre_driver_current_lane1_16=3 +serdes_preemphasis_lane1_16=0xc2f0 +serdes_driver_current_lane2_16=3 +serdes_pre_driver_current_lane2_16=3 +serdes_preemphasis_lane2_16=0xc2f0 +serdes_driver_current_lane3_16=3 +serdes_pre_driver_current_lane3_16=3 +serdes_preemphasis_lane3_16=0xc2f0 +serdes_driver_current_lane0_17=3 +serdes_pre_driver_current_lane0_17=3 +serdes_preemphasis_lane0_17=0xc2f0 +serdes_driver_current_lane1_17=3 +serdes_pre_driver_current_lane1_17=3 +serdes_preemphasis_lane1_17=0xc2f0 +serdes_driver_current_lane2_17=3 +serdes_pre_driver_current_lane2_17=3 +serdes_preemphasis_lane2_17=0xc2f0 +serdes_driver_current_lane3_17=3 +serdes_pre_driver_current_lane3_17=3 +serdes_preemphasis_lane3_17=0xc2f0 +serdes_driver_current_lane0_18=3 +serdes_pre_driver_current_lane0_18=3 +serdes_preemphasis_lane0_18=0xc2f0 +serdes_driver_current_lane1_18=3 +serdes_pre_driver_current_lane1_18=3 +serdes_preemphasis_lane1_18=0xc2f0 +serdes_driver_current_lane2_18=3 +serdes_pre_driver_current_lane2_18=3 +serdes_preemphasis_lane2_18=0xc2f0 +serdes_driver_current_lane3_18=3 +serdes_pre_driver_current_lane3_18=3 +serdes_preemphasis_lane3_18=0xc2f0 +serdes_driver_current_lane0_19=3 +serdes_pre_driver_current_lane0_19=3 +serdes_preemphasis_lane0_19=0xc2f0 +serdes_driver_current_lane1_19=3 +serdes_pre_driver_current_lane1_19=3 +serdes_preemphasis_lane1_19=0xc2f0 +serdes_driver_current_lane2_19=3 +serdes_pre_driver_current_lane2_19=3 +serdes_preemphasis_lane2_19=0xc2f0 +serdes_driver_current_lane3_19=3 +serdes_pre_driver_current_lane3_19=3 +serdes_preemphasis_lane3_19=0xc2f0 +serdes_driver_current_lane0_20=3 +serdes_pre_driver_current_lane0_20=3 +serdes_preemphasis_lane0_20=0xc2f0 +serdes_driver_current_lane1_20=3 +serdes_pre_driver_current_lane1_20=3 +serdes_preemphasis_lane1_20=0xc2f0 +serdes_driver_current_lane2_20=3 +serdes_pre_driver_current_lane2_20=3 +serdes_preemphasis_lane2_20=0xc2f0 +serdes_driver_current_lane3_20=3 +serdes_pre_driver_current_lane3_20=3 +serdes_preemphasis_lane3_20=0xc2f0 +serdes_driver_current_lane0_21=3 +serdes_pre_driver_current_lane0_21=3 +serdes_preemphasis_lane0_21=0xc6e0 +serdes_driver_current_lane1_21=3 +serdes_pre_driver_current_lane1_21=3 +serdes_preemphasis_lane1_21=0xc6e0 +serdes_driver_current_lane2_21=3 +serdes_pre_driver_current_lane2_21=3 +serdes_preemphasis_lane2_21=0xc6e0 +serdes_driver_current_lane3_21=3 +serdes_pre_driver_current_lane3_21=3 +serdes_preemphasis_lane3_21=0xc6e0 +serdes_driver_current_lane0_22=3 +serdes_pre_driver_current_lane0_22=3 +serdes_preemphasis_lane0_22=0xc6e0 +serdes_driver_current_lane1_22=3 +serdes_pre_driver_current_lane1_22=3 +serdes_preemphasis_lane1_22=0xc6e0 +serdes_driver_current_lane2_22=3 +serdes_pre_driver_current_lane2_22=3 +serdes_preemphasis_lane2_22=0xc6e0 +serdes_driver_current_lane3_22=3 +serdes_pre_driver_current_lane3_22=3 +serdes_preemphasis_lane3_22=0xc6e0 +serdes_driver_current_lane0_23=3 +serdes_pre_driver_current_lane0_23=3 +serdes_preemphasis_lane0_23=0xcad0 +serdes_driver_current_lane1_23=3 +serdes_pre_driver_current_lane1_23=3 +serdes_preemphasis_lane1_23=0xcad0 +serdes_driver_current_lane2_23=3 +serdes_pre_driver_current_lane2_23=3 +serdes_preemphasis_lane2_23=0xcad0 +serdes_driver_current_lane3_23=3 +serdes_pre_driver_current_lane3_23=3 +serdes_preemphasis_lane3_23=0xcad0 +serdes_driver_current_lane0_24=3 +serdes_pre_driver_current_lane0_24=3 +serdes_preemphasis_lane0_24=0xcad0 +serdes_driver_current_lane1_24=3 +serdes_pre_driver_current_lane1_24=3 +serdes_preemphasis_lane1_24=0xcad0 +serdes_driver_current_lane2_24=3 +serdes_pre_driver_current_lane2_24=3 +serdes_preemphasis_lane2_24=0xcad0 +serdes_driver_current_lane3_24=3 +serdes_pre_driver_current_lane3_24=3 +serdes_preemphasis_lane3_24=0xcad0 +serdes_driver_current_lane0_25=5 +serdes_pre_driver_current_lane0_25=5 +serdes_preemphasis_lane0_25=0xc2f0 +serdes_driver_current_lane1_25=5 +serdes_pre_driver_current_lane1_25=5 +serdes_preemphasis_lane1_25=0xc2f0 +serdes_driver_current_lane2_25=5 +serdes_pre_driver_current_lane2_25=5 +serdes_preemphasis_lane2_25=0xc2f0 +serdes_driver_current_lane3_25=5 +serdes_pre_driver_current_lane3_25=5 +serdes_preemphasis_lane3_25=0xc2f0 +serdes_driver_current_lane0_26=5 +serdes_pre_driver_current_lane0_26=5 +serdes_preemphasis_lane0_26=0xc2f0 +serdes_driver_current_lane1_26=5 +serdes_pre_driver_current_lane1_26=5 +serdes_preemphasis_lane1_26=0xc2f0 +serdes_driver_current_lane2_26=5 +serdes_pre_driver_current_lane2_26=5 +serdes_preemphasis_lane2_26=0xc2f0 +serdes_driver_current_lane3_26=5 +serdes_pre_driver_current_lane3_26=5 +serdes_preemphasis_lane3_26=0xc2f0 +serdes_driver_current_lane0_27=5 +serdes_pre_driver_current_lane0_27=5 +serdes_preemphasis_lane0_27=0xc2f0 +serdes_driver_current_lane1_27=5 +serdes_pre_driver_current_lane1_27=5 +serdes_preemphasis_lane1_27=0xc2f0 +serdes_driver_current_lane2_27=5 +serdes_pre_driver_current_lane2_27=5 +serdes_preemphasis_lane2_27=0xc2f0 +serdes_driver_current_lane3_27=5 +serdes_pre_driver_current_lane3_27=5 +serdes_preemphasis_lane3_27=0xc2f0 +serdes_driver_current_lane0_28=8 +serdes_pre_driver_current_lane0_28=6 +serdes_preemphasis_lane0_28=0xc2f0 +serdes_driver_current_lane1_28=8 +serdes_pre_driver_current_lane1_28=6 +serdes_preemphasis_lane1_28=0xc2f0 +serdes_driver_current_lane2_28=8 +serdes_pre_driver_current_lane2_28=6 +serdes_preemphasis_lane2_28=0xc2f0 +serdes_driver_current_lane3_28=8 +serdes_pre_driver_current_lane3_28=6 +serdes_preemphasis_lane3_28=0xc2f0 +serdes_driver_current_lane0_29=2 +serdes_pre_driver_current_lane0_29=2 +serdes_preemphasis_lane0_29=0x8fc0 +serdes_driver_current_lane1_29=2 +serdes_pre_driver_current_lane1_29=2 +serdes_preemphasis_lane1_29=0x8fc0 +serdes_driver_current_lane2_29=2 +serdes_pre_driver_current_lane2_29=2 +serdes_preemphasis_lane2_29=0x8fc0 +serdes_driver_current_lane3_29=2 +serdes_pre_driver_current_lane3_29=2 +serdes_preemphasis_lane3_29=0x8fc0 +serdes_driver_current_lane0_30=2 +serdes_pre_driver_current_lane0_30=2 +serdes_preemphasis_lane0_30=0x8fc0 +serdes_driver_current_lane1_30=2 +serdes_pre_driver_current_lane1_30=2 +serdes_preemphasis_lane1_30=0x8fc0 +serdes_driver_current_lane2_30=2 +serdes_pre_driver_current_lane2_30=2 +serdes_preemphasis_lane2_30=0x8fc0 +serdes_driver_current_lane3_30=2 +serdes_pre_driver_current_lane3_30=2 +serdes_preemphasis_lane3_30=0x8fc0 +serdes_driver_current_lane0_31=2 +serdes_pre_driver_current_lane0_31=2 +serdes_preemphasis_lane0_31=0x8fc0 +serdes_driver_current_lane1_31=2 +serdes_pre_driver_current_lane1_31=2 +serdes_preemphasis_lane1_31=0x8fc0 +serdes_driver_current_lane2_31=2 +serdes_pre_driver_current_lane2_31=2 +serdes_preemphasis_lane2_31=0x8fc0 +serdes_driver_current_lane3_31=2 +serdes_pre_driver_current_lane3_31=2 +serdes_preemphasis_lane3_31=0x8fc0 +serdes_driver_current_lane0_32=2 +serdes_pre_driver_current_lane0_32=2 +serdes_preemphasis_lane0_32=0x8fc0 +serdes_driver_current_lane1_32=2 +serdes_pre_driver_current_lane1_32=2 +serdes_preemphasis_lane1_32=0x8fc0 +serdes_driver_current_lane2_32=2 +serdes_pre_driver_current_lane2_32=2 +serdes_preemphasis_lane2_32=0x8fc0 +serdes_driver_current_lane3_32=2 +serdes_pre_driver_current_lane3_32=2 +serdes_preemphasis_lane3_32=0x8fc0 From fae346f586e816d2852d86d5bd35d513d095b455 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 14 Jun 2018 12:11:29 -0700 Subject: [PATCH 1357/1833] Don't create a pty to run vtysh inside of the docker container (#1792) --- dockers/docker-fpm-frr/base_image_files/vtysh | 9 +-------- dockers/docker-fpm-quagga/base_image_files/vtysh | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/dockers/docker-fpm-frr/base_image_files/vtysh b/dockers/docker-fpm-frr/base_image_files/vtysh index 8f8cb2e67960..c479fcd3653b 100755 --- a/dockers/docker-fpm-frr/base_image_files/vtysh +++ b/dockers/docker-fpm-frr/base_image_files/vtysh @@ -1,10 +1,3 @@ #!/bin/bash -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS bgp vtysh "$@" +docker exec -i bgp vtysh "$@" diff --git a/dockers/docker-fpm-quagga/base_image_files/vtysh b/dockers/docker-fpm-quagga/base_image_files/vtysh index 8f8cb2e67960..c479fcd3653b 100755 --- a/dockers/docker-fpm-quagga/base_image_files/vtysh +++ b/dockers/docker-fpm-quagga/base_image_files/vtysh @@ -1,10 +1,3 @@ #!/bin/bash -DOCKER_EXEC_FLAGS="i" - -# Determine whether stdout is on a terminal -if [ -t 1 ] ; then - DOCKER_EXEC_FLAGS+="t" -fi - -docker exec -$DOCKER_EXEC_FLAGS bgp vtysh "$@" +docker exec -i bgp vtysh "$@" From 1c8bacb0078714f63b6f0428b6d471c3ed719f9d Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 14 Jun 2018 21:53:31 -0700 Subject: [PATCH 1358/1833] Fix comment typos (#1794) Signed-off-by: Qi Luo --- dockers/docker-fpm-frr/isolate.j2 | 2 +- dockers/docker-fpm-frr/unisolate.j2 | 2 +- dockers/docker-fpm-quagga/isolate.j2 | 2 +- dockers/docker-fpm-quagga/unisolate.j2 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dockers/docker-fpm-frr/isolate.j2 b/dockers/docker-fpm-frr/isolate.j2 index 7b7fecf9fa9e..cfcd023ea1f3 100755 --- a/dockers/docker-fpm-frr/isolate.j2 +++ b/dockers/docker-fpm-frr/isolate.j2 @@ -5,7 +5,7 @@ sed -n -e '9,$p' < "$0" | vtysh "$@" ## Exit with vtysh return code exit $? -## vtysh script start from next line, which line number MUST eqaul in 'sed' command above +## vtysh script start from next line, which line number MUST equal in 'sed' command above configure terminal router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} diff --git a/dockers/docker-fpm-frr/unisolate.j2 b/dockers/docker-fpm-frr/unisolate.j2 index f2129556747b..2a0780745d75 100755 --- a/dockers/docker-fpm-frr/unisolate.j2 +++ b/dockers/docker-fpm-frr/unisolate.j2 @@ -5,7 +5,7 @@ sed -n -e '9,$p' < "$0" | vtysh "$@" ## Exit with vtysh return code exit $? -## vtysh script start from next line, which line number MUST eqaul in 'sed' command above +## vtysh script start from next line, which line number MUST equal in 'sed' command above configure terminal router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} diff --git a/dockers/docker-fpm-quagga/isolate.j2 b/dockers/docker-fpm-quagga/isolate.j2 index 7b7fecf9fa9e..cfcd023ea1f3 100755 --- a/dockers/docker-fpm-quagga/isolate.j2 +++ b/dockers/docker-fpm-quagga/isolate.j2 @@ -5,7 +5,7 @@ sed -n -e '9,$p' < "$0" | vtysh "$@" ## Exit with vtysh return code exit $? -## vtysh script start from next line, which line number MUST eqaul in 'sed' command above +## vtysh script start from next line, which line number MUST equal in 'sed' command above configure terminal router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} diff --git a/dockers/docker-fpm-quagga/unisolate.j2 b/dockers/docker-fpm-quagga/unisolate.j2 index f2129556747b..2a0780745d75 100755 --- a/dockers/docker-fpm-quagga/unisolate.j2 +++ b/dockers/docker-fpm-quagga/unisolate.j2 @@ -5,7 +5,7 @@ sed -n -e '9,$p' < "$0" | vtysh "$@" ## Exit with vtysh return code exit $? -## vtysh script start from next line, which line number MUST eqaul in 'sed' command above +## vtysh script start from next line, which line number MUST equal in 'sed' command above configure terminal router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} From a8a7b795dbdb5f5f79a4c9088174391274ca6d05 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 19 Jun 2018 13:12:28 -0700 Subject: [PATCH 1359/1833] [libnl3]: Upgrade libnl3 version to 3.2.27-2, same version as in Debian Stretch (#1795) Signed-off-by: Qi Luo --- rules/libnl3.mk | 4 +++- src/libnl3/Makefile | 17 ++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/rules/libnl3.mk b/rules/libnl3.mk index 70ffa87963d0..30e27c5c5157 100644 --- a/rules/libnl3.mk +++ b/rules/libnl3.mk @@ -1,7 +1,9 @@ # libnl3 -LIBNL3_VERSION = 3.2.27-1 +LIBNL3_VERSION_BASE = 3.2.27 +LIBNL3_VERSION = $(LIBNL3_VERSION_BASE)-2 +export LIBNL3_VERSION_BASE export LIBNL3_VERSION LIBNL3 = libnl-3-200_$(LIBNL3_VERSION)_amd64.deb diff --git a/src/libnl3/Makefile b/src/libnl3/Makefile index 6f50e4e389fa..3ebe885ea5dd 100644 --- a/src/libnl3/Makefile +++ b/src/libnl3/Makefile @@ -15,18 +15,13 @@ DERIVED_TARGETS = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb \ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the libnl3 - rm -rf ./libnl3 - git clone https://github.com/qiluo-msft/libnl3.git - pushd ./libnl3 - git checkout -f b77c0e49cb + rm -rf ./libnl3-$(LIBNL3_VERSION_BASE) + wget -O libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz" + wget -O libnl3_$(LIBNL3_VERSION).dsc -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION).dsc" + wget -O libnl3_$(LIBNL3_VERSION).debian.tar.xz -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION).debian.tar.xz" + dpkg-source -x libnl3_$(LIBNL3_VERSION).dsc - # Patch - export QUILT_PATCHES=debian/patches - quilt push - quilt push - quilt push - quilt push - quilt push + pushd ./libnl3-$(LIBNL3_VERSION_BASE) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd From b5f153b3ae291794d6a7f71ae48a279738dc9760 Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Tue, 19 Jun 2018 15:59:12 -0700 Subject: [PATCH 1360/1833] Introducing 'debugging' and 'profiling' options in sonic build-infra (#1782) --- rules/config | 12 ++++++++++-- rules/docker-base.mk | 2 +- slave.mk | 18 ++++++++++++++---- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/rules/config b/rules/config index 86d106637de2..1505dfd71782 100644 --- a/rules/config +++ b/rules/config @@ -40,9 +40,9 @@ DEFAULT_PASSWORD = YourPaSsWoRd # by default for TOR switch # ENABLE_PFCWD_ON_START = y -# SONIC_CONFIG_DEBUG - install debug packages +# SONIC_INSTALL_DEBUG_TOOLS - installs debugging tools in baseline docker # Uncomment next line to enable: -# SONIC_CONFIG_DEBUG = y +# SONIC_INSTALL_DEBUG_TOOLS = y # SONIC_ROUTING_STACK - specify the routing-stack being elected to drive SONiC's control-plane. # Quagga will be the default routing-stack for all the SONiC platforms. Other supported @@ -56,5 +56,13 @@ SONIC_ROUTING_STACK = quagga # Enable Origanization Extensions - Specific to the deployment scenarios of the Organization ENABLE_ORGANIZATION_EXTENSIONS = y +# Debugging option allows sonic debian packages to get built including symbols +# information. Profiling option, disables compiler optimizations (-O0) as well +# as includes symbols information. Given that 'profiling' option is a superset +# of 'debugging' one, user should only enable either one option or the other -- +# if both options are enabled, the 'profiling' one will prevail. +#SONIC_DEBUGGING_ON = y +#SONIC_PROFILING_ON = y + # ENABLE_SYSTEM_TELEMETRY - build docker-sonic-telemetry for system telemetry support # ENABLE_SYSTEM_TELEMETRY = y diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 4a419008e915..1bdaaa0b4de0 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -5,7 +5,7 @@ $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base $(DOCKER_BASE)_DEPENDS += $(SUPERVISOR) $(DOCKER_BASE)_DEPENDS += $(LIBWRAP) -ifeq ($(SONIC_CONFIG_DEBUG),y) +ifeq ($(SONIC_INSTALL_DEBUG_TOOLS),y) GDB = gdb VIM = vim OPENSSH = openssh-client diff --git a/slave.mk b/slave.mk index a81acb1798f4..7ca92dc4ce1b 100644 --- a/slave.mk +++ b/slave.mk @@ -86,6 +86,14 @@ else $(warning PASSWORD given on command line: could be visible to other users) endif +ifeq ($(SONIC_DEBUGGING_ON),y) +DEB_BUILD_OPTIONS_GENERIC := "nostrip" +endif + +ifeq ($(SONIC_PROFILING_ON),y) +DEB_BUILD_OPTIONS_GENERIC := "nostrip noopt" +endif + ifeq ($(SONIC_BUILD_JOBS),) override SONIC_BUILD_JOBS := $(SONIC_CONFIG_BUILD_JOBS) endif @@ -109,13 +117,15 @@ $(info "PASSWORD" : "$(PASSWORD)") $(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)") $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)") $(info "ENABLE_PFCWD_ON_START" : "$(ENABLE_PFCWD_ON_START)") -$(info "SONIC_CONFIG_DEBUG" : "$(SONIC_CONFIG_DEBUG)") +$(info "SONIC_INSTALL_DEBUG_TOOLS" : "$(SONIC_INSTALL_DEBUG_TOOLS)") $(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)") $(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)") $(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)") $(info "HTTP_PROXY" : "$(HTTP_PROXY)") $(info "HTTPS_PROXY" : "$(HTTPS_PROXY)") $(info "ENABLE_SYSTEM_TELEMETRY" : "$(ENABLE_SYSTEM_TELEMETRY)") +$(info "SONIC_DEBUGGING_ON" : "$(SONIC_DEBUGGING_ON)") +$(info "SONIC_PROFILING_ON" : "$(SONIC_PROFILING_ON)") $(info ) ############################################################################### @@ -201,7 +211,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(a # Apply series of patches if exist if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi # Build project and take package - make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG) + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC}" make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG) # Clean up if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi $(FOOTER) @@ -224,8 +234,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a pushd $($*_SRC_PATH) $(LOG) [ ! -f ./autogen.sh ] || ./autogen.sh $(LOG) $(if $($*_DPKG_TARGET), - DEB_BUILD_OPTIONS=$($*_DEB_BUILD_OPTIONS) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG), - DEB_BUILD_OPTIONS=$($*_DEB_BUILD_OPTIONS) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC} ${$*_DEB_BUILD_OPTIONS}" dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG), + DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC} ${$*_DEB_BUILD_OPTIONS}" dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG) ) popd $(LOG) # Clean up From 493ae71f8f31b5f8592523db345fb921650d90c3 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 19 Jun 2018 17:52:09 -0700 Subject: [PATCH 1361/1833] [Broadcom]: update Broadcom SAI to 3.1.3.4-14 (#1797) Fix mirror session destination update bug causing no resources issue Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 0012e8a8106a..52214493edd0 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-13_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-13_amd64.deb?sv=2015-04-05&sr=b&sig=Y7mQMOnQEzwb%2FG%2BY9dcEX0Y9tQBDCK2UmF4TjIz3Zn8%3D&se=2155-04-24T09%3A52%3A42Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-14_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-14_amd64.deb?sv=2015-04-05&sr=b&sig=RUib2nzuTwstNgT9OJ6DGv5OraWc6oyOmMtaRh6pDdw%3D&se=2032-02-25T17%3A38%3A41Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-13_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-14_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-13_amd64.deb?sv=2015-04-05&sr=b&sig=YYjwAt47PlCYJgW0RtEsdcmGAc52UdAzHEd5qVKImxc%3D&se=2155-04-24T09%3A53%3A45Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-14_amd64.deb?sv=2015-04-05&sr=b&sig=GRdByGTrNZbZoQmXhsVC%2BL7ZeDwzstl4Vq6vGssrmyo%3D&se=2032-02-25T17%3A39%3A09Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 81b782cb8658417caad8636ed2dceb5b886ad4e6 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 19 Jun 2018 21:09:08 -0700 Subject: [PATCH 1362/1833] [libnl3]: Backup libnl3 source packages in Azure Storage (#1799) Signed-off-by: Qi Luo --- src/libnl3/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libnl3/Makefile b/src/libnl3/Makefile index 3ebe885ea5dd..bf5ba60ab91d 100644 --- a/src/libnl3/Makefile +++ b/src/libnl3/Makefile @@ -16,9 +16,9 @@ DERIVED_TARGETS = libnl-3-dev_$(LIBNL3_VERSION)_amd64.deb \ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the libnl3 rm -rf ./libnl3-$(LIBNL3_VERSION_BASE) - wget -O libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz" - wget -O libnl3_$(LIBNL3_VERSION).dsc -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION).dsc" - wget -O libnl3_$(LIBNL3_VERSION).debian.tar.xz -N "http://http.debian.net/debian/pool/main/libn/libnl3/libnl3_$(LIBNL3_VERSION).debian.tar.xz" + wget -O libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz -N "https://sonicstorage.blob.core.windows.net/packages/libnl3_$(LIBNL3_VERSION_BASE).orig.tar.gz?sv=2015-04-05&sr=b&sig=b4DnqrIsyVBDLmYhw7qwfaUJWqGCX2lDVMmmx7ihfrU%3D&se=2028-06-16T21%3A06%3A00Z&sp=r" + wget -O libnl3_$(LIBNL3_VERSION).dsc -N "https://sonicstorage.blob.core.windows.net/packages/libnl3_$(LIBNL3_VERSION).dsc?sv=2015-04-05&sr=b&sig=AWTX45oDbeGA%2BRJZyiCcHmeIfCAgSeNV3IqopOBaRDg%3D&se=2028-06-16T21%3A05%3A30Z&sp=r" + wget -O libnl3_$(LIBNL3_VERSION).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/libnl3_$(LIBNL3_VERSION).debian.tar.xz?sv=2015-04-05&sr=b&sig=upIZ9dp5WEcLqp3ODeWKJXq5pJWCfeT0TIM0bx76wxM%3D&se=2028-06-16T21%3A04%3A44Z&sp=r" dpkg-source -x libnl3_$(LIBNL3_VERSION).dsc pushd ./libnl3-$(LIBNL3_VERSION_BASE) From d82db79051468c1548bb5f6cd07dc2ea1d395ed6 Mon Sep 17 00:00:00 2001 From: Denis Maslov Date: Wed, 20 Jun 2018 07:14:49 +0300 Subject: [PATCH 1363/1833] [caclmgrd] Translation of ACL Control Plane rules into iptables commands fixed (#1798) Signed-off-by: Denis Maslov --- files/image_config/caclmgrd/caclmgrd | 61 ++++++++++++++++------------ 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/files/image_config/caclmgrd/caclmgrd b/files/image_config/caclmgrd/caclmgrd index 0dc59766b3d5..ec26b6001f50 100755 --- a/files/image_config/caclmgrd/caclmgrd +++ b/files/image_config/caclmgrd/caclmgrd @@ -89,6 +89,32 @@ class ControlPlaneAclManager(object): if proc.returncode != 0: log_error("Error running command '{}'".format(cmd)) + def parse_int_to_tcp_flags(self, hex_value): + tcp_flags_str = "" + if hex_value & 0x01: + tcp_flags_str += "FIN," + if hex_value & 0x02: + tcp_flags_str += "SYN," + if hex_value & 0x04: + tcp_flags_str += "RST," + if hex_value & 0x08: + tcp_flags_str += "PSH," + if hex_value & 0x10: + tcp_flags_str += "ACK," + if hex_value & 0x20: + tcp_flags_str += "URG," + # iptables doesn't handle the flags below now. It has some special keys for it: + # --ecn-tcp-cwr This matches if the TCP ECN CWR (Congestion Window Received) bit is set. + # --ecn-tcp-ece This matches if the TCP ECN ECE (ECN Echo) bit is set. + # if hex_value & 0x40: + # tcp_flags_str += "ECE," + # if hex_value & 0x80: + # tcp_flags_str += "CWR," + + # Delete the trailing comma + tcp_flags_str = tcp_flags_str[:-1] + return tcp_flags_str + def get_acl_rules_and_translate_to_iptables_commands(self): """ Retrieves current ACL tables and rules from Config DB, translates @@ -191,32 +217,15 @@ class ControlPlaneAclManager(object): rule_cmd += " --dport {}".format(dst_port) - # If there are TCP flags present, append them - if "TCP_FLAGS" in rule_props and rule_props["TCP_FLAGS"]: - tcp_flags = int(rule_props["TCP_FLAGS"], 16) - - if tcp_flags > 0: - rule_cmd += " --tcp-flags " - - if tcp_flags & 0x01: - rule_cmd += "FIN," - if tcp_flags & 0x02: - rule_cmd += "SYN," - if tcp_flags & 0x04: - rule_cmd += "RST," - if tcp_flags & 0x08: - rule_cmd += "PSH," - if tcp_flags & 0x10: - rule_cmd += "ACK," - if tcp_flags & 0x20: - rule_cmd += "URG," - if tcp_flags & 0x40: - rule_cmd += "ECE," - if tcp_flags & 0x80: - rule_cmd += "CWR," - - # Delete the trailing comma - rule_cmd = rule_cmd[:-1] + # If there are TCP flags present and ip protocol is TCP, append them + if ip_protocol == "tcp" and "TCP_FLAGS" in rule_props and rule_props["TCP_FLAGS"]: + tcp_flags, tcp_flags_mask = rule_props["TCP_FLAGS"].split("/") + + tcp_flags = int(tcp_flags, 16) + tcp_flags_mask = int(tcp_flags_mask, 16) + + if tcp_flags_mask > 0: + rule_cmd += " --tcp-flags {mask} {flags}".format(mask = self.parse_int_to_tcp_flags(tcp_flags_mask), flags = self.parse_int_to_tcp_flags(tcp_flags)) # Append the packet action as the jump target rule_cmd += " -j {}".format(rule_props["PACKET_ACTION"]) From bbca58329bf4ebc41a53ea768fc4595f346aae4d Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 20 Jun 2018 12:15:09 -0700 Subject: [PATCH 1364/1833] Manually send SIGHUP to vtysh when the current session was disconnected (#1801) * Manually send SIGHUP to vtysh when the current session was disconnected * Address comments --- dockers/docker-fpm-frr/base_image_files/vtysh | 15 ++++++++++++++- dockers/docker-fpm-quagga/base_image_files/vtysh | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/dockers/docker-fpm-frr/base_image_files/vtysh b/dockers/docker-fpm-frr/base_image_files/vtysh index c479fcd3653b..24016bd96b2c 100755 --- a/dockers/docker-fpm-frr/base_image_files/vtysh +++ b/dockers/docker-fpm-frr/base_image_files/vtysh @@ -1,3 +1,16 @@ #!/bin/bash -docker exec -i bgp vtysh "$@" +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + # Prepare a function to send HUP signal to vtysh in the container + # we mark the new instance of vtysh with the current tty as a tag + TTY=$(tty) + function cleanup + { + docker exec -i bgp pkill -HUP -f "vtysh $TTY" + } + trap cleanup HUP + docker exec -ti bgp vtysh "$TTY" "$@" +else + docker exec -i bgp vtysh "$@" +fi diff --git a/dockers/docker-fpm-quagga/base_image_files/vtysh b/dockers/docker-fpm-quagga/base_image_files/vtysh index c479fcd3653b..24016bd96b2c 100755 --- a/dockers/docker-fpm-quagga/base_image_files/vtysh +++ b/dockers/docker-fpm-quagga/base_image_files/vtysh @@ -1,3 +1,16 @@ #!/bin/bash -docker exec -i bgp vtysh "$@" +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + # Prepare a function to send HUP signal to vtysh in the container + # we mark the new instance of vtysh with the current tty as a tag + TTY=$(tty) + function cleanup + { + docker exec -i bgp pkill -HUP -f "vtysh $TTY" + } + trap cleanup HUP + docker exec -ti bgp vtysh "$TTY" "$@" +else + docker exec -i bgp vtysh "$@" +fi From 75570077613f2da77aedac7fa207670094d17f21 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 21 Jun 2018 10:40:28 -0700 Subject: [PATCH 1365/1833] [interface-config] Force eth0 before reconfiguration (#1802) --- files/image_config/interfaces/interfaces-config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 75660e713e7f..a702917419ca 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,6 +1,6 @@ #!/bin/bash -ifdown eth0 +ifdown --force eth0 sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces From b745c0bf1b50ed91e64109ab11514a3f8e60c3e3 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 21 Jun 2018 10:41:50 -0700 Subject: [PATCH 1366/1833] Modify sudo lecture message to be more informational (#1800) --- files/build_templates/sonic_debian_extension.j2 | 1 + files/image_config/sudoers/sudoers | 1 + files/image_config/sudoers/sudoers.lecture | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 files/image_config/sudoers/sudoers.lecture diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index d0afa4659667..698a29ec22a7 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -179,6 +179,7 @@ sudo cp $IMAGE_CONFIGS/asn/deployment_id_asn_map.yml $FILESYSTEM_ROOT/etc/sonic/ # Copy sudoers configuration file sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ +sudo cp $IMAGE_CONFIGS/sudoers/sudoers.lecture $FILESYSTEM_ROOT/etc/ # Copy control plane ACL management daemon files sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd.service $FILESYSTEM_ROOT/etc/systemd/system/ diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 4d651957afe2..66ca00f9de95 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -10,6 +10,7 @@ Defaults env_reset #Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" Defaults env_keep += "VTYSH_PAGER" +Defaults lecture_file = /etc/sudoers.lecture # Host alias specification diff --git a/files/image_config/sudoers/sudoers.lecture b/files/image_config/sudoers/sudoers.lecture new file mode 100644 index 000000000000..e89340092c70 --- /dev/null +++ b/files/image_config/sudoers/sudoers.lecture @@ -0,0 +1,4 @@ + +Make sure your account has RW permission to current device. +Otherwise sudo requests will be rejected. + From aaac49737087a66777bc69b2a94d1795bb3645d0 Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Fri, 22 Jun 2018 00:57:32 +0700 Subject: [PATCH 1367/1833] [device]: Fix a bug that psuutil cannot access gpio sysfs to get PSU status (#1789) --- .../x86_64-cel_seastone-r0/plugins/psuutil.py | 49 +++++++------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py b/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py index 9e8f99e7a7f2..510c03a43ff1 100644 --- a/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py +++ b/device/celestica/x86_64-cel_seastone-r0/plugins/psuutil.py @@ -3,7 +3,8 @@ # Platform-specific PSU status interface for SONiC # -import os.path +import os + try: from sonic_psu.psu_base import PsuBase @@ -18,42 +19,32 @@ def __init__(self): PsuBase.__init__(self) # DX010 PSU pin mapping self.psu = [ - {'base':216}, # Reserved + {'base': self.get_gpio_base()}, {'abs':27, 'power':22}, {'abs':28, 'power':25} ] - def init_psu_gpio(self, pinnum): - # export pin, input as default - gpio_base = self.psu[0]['base'] - export_file = "/sys/class/gpio/export" - direction_file = '/sys/class/gpio/gpio' + str(gpio_base+pinnum) + '/direction' - - try: - with open(export_file, 'w') as fd: - fd.write(str(gpio_base+pinnum)) - except Exception as error: - logging.error("Unable to export gpio ", pinnum) + def get_gpio_base(self): + sys_gpio_dir = "/sys/class/gpio" + for r in os.listdir(sys_gpio_dir): + if "gpiochip" in r: + return int(r[8:],10) + return 216 #Reserve # Get a psu status and presence def read_psu_statuses(self, pinnum): sys_gpio_dir = "/sys/class/gpio" - retval = 'ERR' gpio_base = self.psu[0]['base'] gpio_dir = sys_gpio_dir + '/gpio' + str(gpio_base+pinnum) gpio_file = gpio_dir + "/value" - - # init gpio - if (not os.path.isdir(gpio_dir)): - self.init_psu_gpio(pinnum) try: with open(gpio_file, 'r') as fd: retval = fd.read() - except Exception as error: - logging.error("Unable to open ", gpio_file, "file !") + except IOError: + raise IOError("Unable to open " + gpio_file + "file !") retval = retval.rstrip('\r\n') return retval @@ -76,11 +67,10 @@ def get_psu_status(self, index): """ status = 0 psu_status = self.read_psu_statuses(self.psu[index]['power']) - if (psu_status != 'ERR'): - psu_status = int(psu_status, 10) - # Check for PSU status - if (psu_status == 1): - status = 1 + psu_status = int(psu_status, 10) + # Check for PSU status + if (psu_status == 1): + status = 1 return status @@ -93,10 +83,9 @@ def get_psu_presence(self, index): """ status = 0 psu_absence = self.read_psu_statuses(self.psu[index]['abs']) - if (psu_absence != 'ERR'): - psu_absence = (int(psu_absence, 10)) - # Check for PSU presence - if (psu_absence == 0): - status = 1 + psu_absence = (int(psu_absence, 10)) + # Check for PSU presence + if (psu_absence == 0): + status = 1 return status From 3681cfa55351000daf765e220a464c95e55118cd Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 21 Jun 2018 11:51:37 -0700 Subject: [PATCH 1368/1833] Use only active ports when applying buffers/qos configuration (#1787) * First part of skipping not used port for qos configuration * Use active ports only to set QoS parameters for 6100 * Add a test for qos.json.j2 * Add a test for Dell S6100 buffers.json template * Update submodulre --- .../{qos.json => qos.json.j2} | 0 .../AS7212-54x/{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../Force10-S6000/{qos.json => qos.json.j2} | 0 .../Force10-S6100/{qos.json => qos.json.j2} | 35 +- .../{qos.json => qos.json.j2} | 0 .../Force10-Z9100/{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../LS-SN2700/{qos.json => qos.json.j2} | 0 .../ACS-MSN2100/{qos.json => qos.json.j2} | 0 .../ACS-MSN2410/{qos.json => qos.json.j2} | 0 .../ACS-MSN2700/{qos.json => qos.json.j2} | 0 .../{qos.json => qos.json.j2} | 0 .../ACS-MSN2740/{qos.json => qos.json.j2} | 0 files/build_templates/buffers_config.j2 | 27 +- .../tests/sample-dell-6100-t0-minigraph.xml | 770 ++++++++++++++++++ .../tests/sample_output/buffers-dell6100.json | 121 +++ .../tests/sample_output/qos-dell6100.json | 156 ++++ src/sonic-config-engine/tests/test_j2files.py | 31 + src/sonic-utilities | 2 +- 26 files changed, 1128 insertions(+), 14 deletions(-) rename device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/{qos.json => qos.json.j2} (100%) rename device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/{qos.json => qos.json.j2} (100%) rename device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/{qos.json => qos.json.j2} (100%) rename device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/{qos.json => qos.json.j2} (100%) rename device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/{qos.json => qos.json.j2} (55%) rename device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/{qos.json => qos.json.j2} (100%) rename device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/{qos.json => qos.json.j2} (100%) rename device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/{qos.json => qos.json.j2} (100%) rename device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/{qos.json => qos.json.j2} (100%) rename device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/{qos.json => qos.json.j2} (100%) create mode 100644 src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml create mode 100644 src/sonic-config-engine/tests/sample_output/buffers-dell6100.json create mode 100644 src/sonic-config-engine/tests/sample_output/qos-dell6100.json diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json.j2 similarity index 100% rename from device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json rename to device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json.j2 diff --git a/device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json b/device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json.j2 similarity index 100% rename from device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json rename to device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json.j2 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json rename to device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json rename to device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json rename to device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json rename to device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json rename to device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json.j2 similarity index 100% rename from device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json rename to device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json.j2 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 similarity index 55% rename from device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json rename to device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 index e3a84924fd15..054a8f832cd4 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 @@ -1,3 +1,30 @@ +{%- set PORT_ALL = [] %} + +{%- if PORT is not defined %} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- else %} + {%- for port in PORT %} + {%- if PORT_ALL.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} +{%- endfor %} +{%- set port_names_active = port_names_list_active | join(',') %} + { "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { @@ -118,7 +145,7 @@ } }, "PORT_QOS_MAP": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63": { + "{{ port_names_active }}": { "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", @@ -141,14 +168,14 @@ } }, "QUEUE": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|3-4" : { + "{{ port_names_active }}|3-4" : { "scheduler" : "[SCHEDULER|scheduler.0]", "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|0" : { + "{{ port_names_active }}|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58,Ethernet59,Ethernet60,Ethernet61,Ethernet62,Ethernet63|1" : { + "{{ port_names_active }}|1" : { "scheduler" : "[SCHEDULER|scheduler.2]" } } diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 similarity index 100% rename from device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json rename to device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 similarity index 100% rename from device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json rename to device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json.j2 similarity index 100% rename from device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json rename to device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json.j2 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json.j2 similarity index 100% rename from device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json rename to device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json rename to device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json rename to device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json rename to device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json rename to device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json rename to device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json rename to device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 20019d20afae..23503017f179 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -90,11 +90,20 @@ def {%- endfor %} {%- endif %} -{%- set port_names_list_all = [] %} -{%- for port in PORT_ALL %} - {%- if port_names_list_all.append(port) %}{%- endif %} +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} {%- endfor %} -{%- set port_names_all = port_names_list_all | join(',') %} +{%- set port_names_active = port_names_list_active | join(',') %} { "CABLE_LENGTH": { @@ -112,27 +121,27 @@ def {% endif %} {%- if defs.generate_profile_lists is defined %} -{{ defs.generate_profile_lists(port_names_all) }}, +{{ defs.generate_profile_lists(port_names_active) }}, {% endif %} {%- if defs.generate_pg_profils is defined %} {{ defs.generate_pg_profils }}, {% else %} "BUFFER_PG": { - "{{ port_names_all }}|0-1": { + "{{ port_names_active }}|0-1": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } }, {% endif %} {% if defs.generate_queue_buffers is defined %} -{{ defs.generate_queue_buffers(port_names_all) }} +{{ defs.generate_queue_buffers(port_names_active) }} {% else %} "BUFFER_QUEUE": { - "{{ port_names_all }}|3-4": { + "{{ port_names_active }}|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, - "{{ port_names_all }}|0-1": { + "{{ port_names_active }}|0-1": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } diff --git a/src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml b/src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml new file mode 100644 index 000000000000..536a2c8a73c7 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-dell-6100-t0-minigraph.xml @@ -0,0 +1,770 @@ + + + + + + ARISTA01T1 + 10.0.0.1 + s6100-dev-1 + 10.0.0.0 + 1 + 180 + 60 + + + ARISTA02T1 + 10.0.0.5 + s6100-dev-1 + 10.0.0.4 + 1 + 180 + 60 + + + ARISTA03T1 + 10.0.0.9 + s6100-dev-1 + 10.0.0.8 + 1 + 180 + 60 + + + ARISTA04T1 + 10.0.0.13 + s6100-dev-1 + 10.0.0.12 + 1 + 180 + 60 + + + ARISTA01T1 + FC00::2 + s6100-dev-1 + FC00::1 + 1 + 180 + 60 + + + ARISTA02T1 + FC00::A + s6100-dev-1 + FC00::9 + 1 + 180 + 60 + + + ARISTA03T1 + FC00::12 + s6100-dev-1 + FC00::11 + 1 + 180 + 60 + + + ARISTA04T1 + FC00::1A + s6100-dev-1 + FC00::19 + 1 + 180 + 60 + + + + + 64601 + s6100-dev-1 + + + BGPPeer +
10.0.0.1
+ + + +
+ + BGPPeer +
10.0.0.5
+ + + +
+ + BGPPeer +
10.0.0.9
+ + + +
+ + BGPPeer +
10.0.0.13
+ + + +
+ + BGPPeer +
FC00::2
+ + + +
+ + BGPPeer +
FC00::A
+ + + +
+ + BGPPeer +
FC00::12
+ + + +
+ + BGPPeer +
FC00::1A
+ + + +
+
+ +
+ + 64802 + ARISTA01T1 + + + + 64802 + ARISTA02T1 + + + + 64802 + ARISTA03T1 + + + + 64802 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.243/23 + + 10.0.0.243/23 + + + + + + s6100-dev-1 + + + PortChannelInterface + PortChannel1 + fortyGigE1/1/1;fortyGigE1/1/2 + + + + PortChannelInterface + PortChannel4 + fortyGigE1/1/5;fortyGigE1/1/6 + + + + PortChannelInterface + PortChannel16 + fortyGigE1/2/1;fortyGigE1/2/2 + + + + PortChannelInterface + PortChannel20 + fortyGigE1/2/5;fortyGigE1/2/6 + + + + + + VlanInterface + Vlan2 + fortyGigE1/1/7;fortyGigE1/1/8;fortyGigE1/1/9;fortyGigE1/1/10;fortyGigE1/1/11;fortyGigE1/1/12;fortyGigE1/1/13;fortyGigE1/1/14;fortyGigE1/1/15;fortyGigE1/1/16;fortyGigE1/3/1;fortyGigE1/3/5;fortyGigE1/3/6;fortyGigE1/3/7;fortyGigE1/3/8;fortyGigE1/3/9;fortyGigE1/3/10;fortyGigE1/3/11;fortyGigE1/2/7;fortyGigE1/2/8;fortyGigE1/2/9;fortyGigE1/2/10;fortyGigE1/2/11;fortyGigE1/2/12;fortyGigE1/2/13;fortyGigE1/2/14;fortyGigE1/2/15;fortyGigE1/2/16;fortyGigE1/4/1;fortyGigE1/4/5;fortyGigE1/4/6;fortyGigE1/4/7;fortyGigE1/4/8;fortyGigE1/4/9;fortyGigE1/4/10;fortyGigE1/4/11 + False + 0.0.0.0/0 + + 2 + 2 + 172.0.0.0/21 + + + + + IPInterface + + PortChannel1 + 10.0.0.0/31 + + + IPInterface + + PortChannel4 + 10.0.0.4/31 + + + IPInterface + + PortChannel16 + 10.0.0.8/31 + + + IPInterface + + PortChannel20 + 10.0.0.12/31 + + + IPInterface + + PortChannel1 + FC00::1/126 + + + IPInterface + + PortChannel4 + FC00::9/126 + + + IPInterface + + PortChannel16 + FC00::11/126 + + + IPInterface + + PortChannel20 + FC00::19/126 + + + IPInterface + + Vlan2 + 172.0.0.1/21 + + + + + + + + + + + + DeviceInterfaceLink + true + 40000 + ARISTA01T1 + Ethernet1 + true + s6100-dev-1 + fortyGigE1/1/1 + + + DeviceInterfaceLink + true + 40000 + ARISTA01T1 + Ethernet2 + true + s6100-dev-1 + fortyGigE1/1/2 + + + DeviceInterfaceLink + true + 40000 + ARISTA02T1 + Ethernet1 + true + s6100-dev-1 + fortyGigE1/1/5 + + + DeviceInterfaceLink + true + 40000 + ARISTA02T1 + Ethernet2 + true + s6100-dev-1 + fortyGigE1/1/6 + + + DeviceInterfaceLink + true + 40000 + ARISTA03T1 + Ethernet1 + true + s6100-dev-1 + fortyGigE1/2/1 + + + DeviceInterfaceLink + true + 40000 + ARISTA03T1 + Ethernet2 + true + s6100-dev-1 + fortyGigE1/2/2 + + + DeviceInterfaceLink + true + 40000 + ARISTA04T1 + Ethernet1 + true + s6100-dev-1 + fortyGigE1/2/5 + + + DeviceInterfaceLink + true + 40000 + ARISTA04T1 + Ethernet2 + true + s6100-dev-1 + fortyGigE1/2/6 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/7 + true + server-01 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/8 + true + server-02 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/9 + true + server-03 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/10 + true + server-04 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/11 + true + server-05 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/12 + true + server-06 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/13 + true + server-07 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/14 + true + server-08 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/15 + true + server-09 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/1/16 + true + server-10 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/1 + true + server-11 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/5 + true + server-12 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/6 + true + server-13 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/7 + true + server-14 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/8 + true + server-15 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/9 + true + server-16 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/10 + true + server-17 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/3/11 + true + server-18 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/7 + true + server-19 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/8 + true + server-20 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/9 + true + server-21 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/10 + true + server-22 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/11 + true + server-23 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/12 + true + server-24 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/13 + true + server-25 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/14 + true + server-26 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/15 + true + server-27 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/2/16 + true + server-28 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/1 + true + server-29 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/5 + true + server-30 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/6 + true + server-31 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/7 + true + server-32 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/8 + true + server-33 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/9 + true + server-34 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/10 + true + server-35 + 0 + + + DeviceInterfaceLink + true + 40000 + s6100-dev-1 + fortyGigE1/4/11 + true + server-36 + 0 + + + + + s6100-dev-1 + Force10-S6100 + + 10.0.0.243 + + + + + + + + s6100-dev-1 + + + ErspanDestinationIpv4 + + 10.0.0.16 + + + + + + + s6100-dev-1 + Force10-S6100 +
\ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json new file mode 100644 index 000000000000..9f2ae6583913 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json @@ -0,0 +1,121 @@ + +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "5m", + "Ethernet1": "5m", + "Ethernet2": "5m", + "Ethernet3": "5m", + "Ethernet4": "5m", + "Ethernet5": "5m", + "Ethernet6": "5m", + "Ethernet7": "5m", + "Ethernet8": "5m", + "Ethernet9": "5m", + "Ethernet10": "5m", + "Ethernet11": "5m", + "Ethernet12": "5m", + "Ethernet13": "5m", + "Ethernet14": "5m", + "Ethernet15": "5m", + "Ethernet16": "5m", + "Ethernet17": "5m", + "Ethernet18": "5m", + "Ethernet19": "5m", + "Ethernet20": "5m", + "Ethernet21": "5m", + "Ethernet22": "5m", + "Ethernet23": "5m", + "Ethernet24": "5m", + "Ethernet25": "5m", + "Ethernet26": "5m", + "Ethernet27": "5m", + "Ethernet28": "5m", + "Ethernet29": "5m", + "Ethernet30": "5m", + "Ethernet31": "5m", + "Ethernet32": "5m", + "Ethernet33": "5m", + "Ethernet34": "5m", + "Ethernet35": "5m", + "Ethernet36": "5m", + "Ethernet37": "5m", + "Ethernet38": "5m", + "Ethernet39": "5m", + "Ethernet40": "5m", + "Ethernet41": "5m", + "Ethernet42": "5m", + "Ethernet43": "5m", + "Ethernet44": "5m", + "Ethernet45": "5m", + "Ethernet46": "5m", + "Ethernet47": "5m", + "Ethernet48": "5m", + "Ethernet49": "5m", + "Ethernet50": "5m", + "Ethernet51": "5m", + "Ethernet52": "5m", + "Ethernet53": "5m", + "Ethernet54": "5m", + "Ethernet55": "5m", + "Ethernet56": "5m", + "Ethernet57": "5m", + "Ethernet58": "5m", + "Ethernet59": "5m", + "Ethernet60": "5m", + "Ethernet61": "5m", + "Ethernet62": "5m", + "Ethernet63": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "11213696", + "type": "ingress", + "mode": "dynamic", + "xoff": "3855488" + }, + "egress_lossy_pool": { + "size": "9532224", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "15982720", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"1518", + "static_th":"3995680" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "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]" + } + }, + + "BUFFER_QUEUE": { + "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": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/qos-dell6100.json b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json new file mode 100644 index 000000000000..0db51148bdc5 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json @@ -0,0 +1,156 @@ + +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet1,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": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" + } + }, + "QUEUE": { + "Ethernet0,Ethernet1,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" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "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" : { + "scheduler" : "[SCHEDULER|scheduler.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|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index aba7feb194ad..ce4b17500f8d 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -2,6 +2,7 @@ import os import subprocess import json +import shutil from unittest import TestCase @@ -15,6 +16,7 @@ def setUp(self): self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') self.t1_mlnx_minigraph = os.path.join(self.test_dir, 't1-sample-graph-mlnx.xml') self.mlnx_port_config = os.path.join(self.test_dir, 'sample-port-config-mlnx.ini') + self.dell6100_t0_minigraph = os.path.join(self.test_dir, 'sample-dell-6100-t0-minigraph.xml') self.output_file = os.path.join(self.test_dir, 'output') def run_script(self, argument): @@ -119,6 +121,35 @@ def test_sku_render_template(self): self.assertTrue(filecmp.cmp(sample_output_file, self.output_file)) + def test_qos_dell6100_render_template(self): + dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100') + qos_file = os.path.join(dell_dir_path, 'qos.json.j2') + port_config_ini_file = os.path.join(dell_dir_path, 'port_config.ini') + argument = '-m ' + self.dell6100_t0_minigraph + ' -p ' + port_config_ini_file + ' -t ' + qos_file + ' > ' + self.output_file + self.run_script(argument) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', 'qos-dell6100.json') + assert filecmp.cmp(sample_output_file, self.output_file) + + def test_buffers_dell6100_render_template(self): + dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100') + buffers_file = os.path.join(dell_dir_path, 'buffers.json.j2') + port_config_ini_file = os.path.join(dell_dir_path, 'port_config.ini') + + # copy buffers_config.j2 to the Dell S6100 directory to have all templates in one directory + buffers_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'buffers_config.j2') + shutil.copy2(buffers_config_file, dell_dir_path) + + argument = '-m ' + self.dell6100_t0_minigraph + ' -p ' + port_config_ini_file + ' -t ' + buffers_file + ' > ' + self.output_file + self.run_script(argument) + + # cleanup + buffers_config_file_new = os.path.join(dell_dir_path, 'buffers_config.j2') + os.remove(buffers_config_file_new) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', 'buffers-dell6100.json') + assert filecmp.cmp(sample_output_file, self.output_file) + def tearDown(self): try: os.remove(self.output_file) diff --git a/src/sonic-utilities b/src/sonic-utilities index e2a3228843be..5baa30528bd7 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit e2a3228843bec8280c965b847f5c168f4d96d231 +Subproject commit 5baa30528bd73ffc364de03c9098263d42a2d320 From 3ea616dcc34e6110f74e6dae77456f0d12dde234 Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Sat, 23 Jun 2018 01:56:22 +0700 Subject: [PATCH 1369/1833] [platform] Celestica: dx010 init gpio sysfs (#1807) --- platform/broadcom/platform-modules-cel.mk | 2 +- platform/broadcom/sonic-platform-modules-cel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 09e8b374e861..551ff37e3b37 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -1,6 +1,6 @@ # Celestica DX010 Platform modules -CEL_DX010_PLATFORM_MODULE_VERSION = 0.6 +CEL_DX010_PLATFORM_MODULE_VERSION = 0.7 export CEL_DX010_PLATFORM_MODULE_VERSION diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel index 7875e46964fc..4c8bcd1584e5 160000 --- a/platform/broadcom/sonic-platform-modules-cel +++ b/platform/broadcom/sonic-platform-modules-cel @@ -1 +1 @@ -Subproject commit 7875e46964fcc329ff92a80c379c026da530221f +Subproject commit 4c8bcd1584e5afb05476a67e0ed82ca02fba6da0 From d0803b76ce8b9e7a495bb63dc77dbd8628a77e0a Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 22 Jun 2018 11:56:57 -0700 Subject: [PATCH 1370/1833] [sonic-platform-common] Update submodule (#1806) --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 9adb75feee6d..76ae431e41dc 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 9adb75feee6de75bd2e9faf542ac5610edc3fa35 +Subproject commit 76ae431e41dca1255f8056b590668c9ca187f031 From deacbb8261f4e807635a8efce697e0a4fb1ad29d Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 22 Jun 2018 11:57:44 -0700 Subject: [PATCH 1371/1833] [tacacs] To modify local user permission according to priv lvl (#1804) --- ...able-modifying-local-user-permission.patch | 71 +++++++++++++++++++ src/tacacs/nss/Makefile | 3 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 src/tacacs/nss/0002-Enable-modifying-local-user-permission.patch diff --git a/src/tacacs/nss/0002-Enable-modifying-local-user-permission.patch b/src/tacacs/nss/0002-Enable-modifying-local-user-permission.patch new file mode 100644 index 000000000000..2c476354705a --- /dev/null +++ b/src/tacacs/nss/0002-Enable-modifying-local-user-permission.patch @@ -0,0 +1,71 @@ +From 7045acb8f530331d3fbabef20bcf2787d3430c55 Mon Sep 17 00:00:00 2001 +From: Taoyu Li +Date: Thu, 21 Jun 2018 19:21:01 +0000 +Subject: [PATCH] Do authorization and modify user permission even if local + user exists + +--- + nss_tacplus.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/nss_tacplus.c b/nss_tacplus.c +index 63f01d4..a13c278 100644 +--- a/nss_tacplus.c ++++ b/nss_tacplus.c +@@ -408,7 +408,7 @@ static int delete_conf_line(const char *name) + * conf, it will be written in conf and created by command 'useradd'. When + * useradd command use getpwnam(), it will return when username found in conf. + */ +-static int create_local_user(const char *name, int level) ++static int create_or_modify_local_user(const char *name, int level, bool existing_user) + { + FILE *fp; + useradd_info_t *user; +@@ -416,6 +416,7 @@ static int create_local_user(const char *name, int level) + int len = 512; + int lvl, cnt; + bool found = false; ++ const char* command = existing_user ? "/usr/sbin/usermod": "/usr/sbin/useradd"; + + fp = fopen(user_conf, "ab+"); + if(!fp) { +@@ -458,17 +459,18 @@ static int create_local_user(const char *name, int level) + while(lvl >= MIN_TACACS_USER_PRIV) { + user = &useradd_grp_list[lvl]; + if(user->info && user->secondary_grp && user->shell) { +- snprintf(buf, len, "useradd -G %s \"%s\" -g %d -c \"%s\" -d /home/%s -m -s %s", +- user->secondary_grp, name, user->gid, user->info, name, user->shell); ++ snprintf(buf, len, "%s -G %s \"%s\" -g %d -c \"%s\" -d /home/%s -m -s %s", ++ command, user->secondary_grp, name, user->gid, user->info, name, user->shell); ++ if(debug) syslog(LOG_DEBUG, "%s", buf); + fp = popen(buf, "r"); + if(!fp || -1 == pclose(fp)) { +- syslog(LOG_ERR, "%s: useradd popen failed errno=%d %s", +- nssname, errno, strerror(errno)); ++ syslog(LOG_ERR, "%s: %s popen failed errno=%d %s", ++ nssname, command, errno, strerror(errno)); + delete_conf_line(name); + return -1; + } + if(debug) +- syslog(LOG_DEBUG, "%s: create local user %s success", nssname, name); ++ syslog(LOG_DEBUG, "%s: %s %s success", nssname, command, name); + delete_conf_line(name); + return 0; + } +@@ -558,10 +560,10 @@ static int lookup_user_pw(struct pwbuf *pb, int level) + if(debug) + syslog(LOG_DEBUG, "%s: %s passwd %s found in local", nssname, username, + found ? "is" : "isn't"); +- if(0 != ret || found) ++ if(0 != ret) + return ret; + +- if(0 != create_local_user(username, level)) ++ if(0 != create_or_modify_local_user(username, level, found)) + return -1; + + ret = lookup_pw_local(username, pb, &found); +-- +2.9.3 + diff --git a/src/tacacs/nss/Makefile b/src/tacacs/nss/Makefile index 4f1a337b34b4..259e9b281389 100644 --- a/src/tacacs/nss/Makefile +++ b/src/tacacs/nss/Makefile @@ -12,7 +12,8 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : git checkout -f 19008ab # Apply patch - git apply ../0001-Modify-user-map-profile.patch + git am ../0001-Modify-user-map-profile.patch + git am ../0002-Enable-modifying-local-user-permission.patch dpkg-buildpackage -rfakeroot -b -us -uc popd From b37540febd70a1dddf54aadfebf11007968585c9 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Fri, 22 Jun 2018 12:14:09 -0700 Subject: [PATCH 1372/1833] [vs-test]: not forward routes with no-export community (#1774) Signed-off-by: Sihui Han --- platform/vs/tests/bounce/files/bgpd.conf | 13 ++++++ platform/vs/tests/bounce/files/exabgp1.conf | 21 ++++++++++ platform/vs/tests/bounce/files/exabgp2.conf | 11 +++++ platform/vs/tests/bounce/test_bounce.py | 45 +++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 platform/vs/tests/bounce/files/bgpd.conf create mode 100644 platform/vs/tests/bounce/files/exabgp1.conf create mode 100644 platform/vs/tests/bounce/files/exabgp2.conf create mode 100644 platform/vs/tests/bounce/test_bounce.py diff --git a/platform/vs/tests/bounce/files/bgpd.conf b/platform/vs/tests/bounce/files/bgpd.conf new file mode 100644 index 000000000000..40322cedbc69 --- /dev/null +++ b/platform/vs/tests/bounce/files/bgpd.conf @@ -0,0 +1,13 @@ +router bgp 65501 + bgp router-id 1.1.1.1 + no bgp default ipv4-unicast + neighbor 10.0.0.1 remote-as 65502 + address-family ipv4 + neighbor 10.0.0.1 activate + maximum-paths 64 + exit-address-family + neighbor 10.0.0.3 remote-as 65503 + address-family ipv4 + neighbor 10.0.0.3 activate + maximum-paths 64 + exit-address-family diff --git a/platform/vs/tests/bounce/files/exabgp1.conf b/platform/vs/tests/bounce/files/exabgp1.conf new file mode 100644 index 000000000000..0e78bd61db42 --- /dev/null +++ b/platform/vs/tests/bounce/files/exabgp1.conf @@ -0,0 +1,21 @@ +neighbor 10.0.0.0 { + router-id 1.1.1.2; + local-address 10.0.0.1; + local-as 65502; + peer-as 65501; + group-updates false; + + family{ + ipv4 unicast; + } + + static { + route 1.1.1.1/32{ + next-hop 10.0.0.1; + community no-export; + } + route 2.2.2.2/32{ + next-hop 10.0.0.1; + } + } +} diff --git a/platform/vs/tests/bounce/files/exabgp2.conf b/platform/vs/tests/bounce/files/exabgp2.conf new file mode 100644 index 000000000000..3e67c18a82f6 --- /dev/null +++ b/platform/vs/tests/bounce/files/exabgp2.conf @@ -0,0 +1,11 @@ +neighbor 10.0.0.2 { + router-id 1.1.1.3; + local-address 10.0.0.3; + local-as 65503; + peer-as 65501; + group-updates false; + + family { + ipv4 unicast; + } +} diff --git a/platform/vs/tests/bounce/test_bounce.py b/platform/vs/tests/bounce/test_bounce.py new file mode 100644 index 000000000000..57616ec0bc76 --- /dev/null +++ b/platform/vs/tests/bounce/test_bounce.py @@ -0,0 +1,45 @@ +from swsscommon import swsscommon +import os +import re +import time +import json + +def test_bounce(dvs): + dvs.servers[0].runcmd("pkill -f exabgp") + dvs.copy_file("/etc/quagga/", "bounce/files/bgpd.conf") + dvs.runcmd("supervisorctl start bgpd") + dvs.runcmd("ip addr add 10.0.0.0/31 dev Ethernet0") + dvs.runcmd("ifconfig Ethernet0 up") + + dvs.runcmd("ip addr add 10.0.0.2/31 dev Ethernet4") + dvs.runcmd("ifconfig Ethernet4 up") + + dvs.servers[0].runcmd("ip addr add 10.0.0.1/31 dev eth0") + dvs.servers[0].runcmd("ifconfig eth0 up") + + dvs.servers[1].runcmd("ip addr add 10.0.0.3/31 dev eth0") + dvs.servers[1].runcmd("ifconfig eth0 up") + + time.sleep(5) + + p1 = dvs.servers[0].runcmd_async("exabgp -d bounce/files/exabgp1.conf") + p2 = dvs.servers[1].runcmd_async("exabgp -d bounce/files/exabgp2.conf") + + time.sleep(20) + + sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"]) + all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"]) + announce_route = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) + + p1.terminate() + p1 = p1.wait() + + p2.terminate() + p2 = p2.wait() + + print sum_res + print announce_route + assert "1.1.1.1/32" in all_route + assert "1.1.1.1/32" not in announce_route + assert "2.2.2.2/32" in all_route + assert "2.2.2.2/32" in announce_route From 82343ca1655b7c7406e15f29063130ac68e743e3 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Fri, 22 Jun 2018 18:03:27 -0700 Subject: [PATCH 1373/1833] [sai]: update SAI version to 3.1.3.4-15 (#1808) Signed-off-by: Sihui Han --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 52214493edd0..5cda170b3391 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-14_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-14_amd64.deb?sv=2015-04-05&sr=b&sig=RUib2nzuTwstNgT9OJ6DGv5OraWc6oyOmMtaRh6pDdw%3D&se=2032-02-25T17%3A38%3A41Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.4-15_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-15_amd64.deb?sv=2015-04-05&sr=b&sig=7CIkdlBB%2BY6Xjae0vc1QBnlAVedRkreJRhWM93SyHOI%3D&se=2032-02-29T18%3A31%3A54Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-14_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-15_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-14_amd64.deb?sv=2015-04-05&sr=b&sig=GRdByGTrNZbZoQmXhsVC%2BL7ZeDwzstl4Vq6vGssrmyo%3D&se=2032-02-25T17%3A39%3A09Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-15_amd64.deb?sv=2015-04-05&sr=b&sig=rBOT802o1o%2BAcogaXq%2FgqyuTAmSlFKhtPzYM%2BtXlIdM%3D&se=2032-02-29T18%3A34%3A10Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From a2a6aead4cd6c952fb75b05fd9059229342132f7 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 22 Jun 2018 18:04:18 -0700 Subject: [PATCH 1374/1833] [bgp]: Enable bgp soft-reconfiguration inbound for quagga templates (#1803) * Enable bgp soft-reconfiguration inbound for quagga templates --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 2 ++ src/sonic-config-engine/tests/sample_output/bgpd.conf | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index 1adb660ec00a..ee3aba2c23c3 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -78,6 +78,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} neighbor {{ neighbor_addr }} activate + neighbor {{ neighbor_addr }} soft-reconfiguration inbound maximum-paths 64 exit-address-family {% endif %} @@ -87,6 +88,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} neighbor {{ neighbor_addr }} allowas-in 1 {% endif %} neighbor {{ neighbor_addr }} activate + neighbor {{ neighbor_addr }} soft-reconfiguration inbound maximum-paths 64 exit-address-family {% endif %} diff --git a/src/sonic-config-engine/tests/sample_output/bgpd.conf b/src/sonic-config-engine/tests/sample_output/bgpd.conf index 4416b4628569..86ce28f3b67d 100644 --- a/src/sonic-config-engine/tests/sample_output/bgpd.conf +++ b/src/sonic-config-engine/tests/sample_output/bgpd.conf @@ -32,6 +32,7 @@ router bgp 65100 address-family ipv4 neighbor 10.0.0.57 allowas-in 1 neighbor 10.0.0.57 activate + neighbor 10.0.0.57 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor 10.0.0.59 remote-as 64600 @@ -39,6 +40,7 @@ router bgp 65100 address-family ipv4 neighbor 10.0.0.59 allowas-in 1 neighbor 10.0.0.59 activate + neighbor 10.0.0.59 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor 10.0.0.61 remote-as 64600 @@ -46,6 +48,7 @@ router bgp 65100 address-family ipv4 neighbor 10.0.0.61 allowas-in 1 neighbor 10.0.0.61 activate + neighbor 10.0.0.61 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor 10.0.0.63 remote-as 64600 @@ -53,6 +56,7 @@ router bgp 65100 address-family ipv4 neighbor 10.0.0.63 allowas-in 1 neighbor 10.0.0.63 activate + neighbor 10.0.0.63 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor fc00::7a remote-as 64600 @@ -60,6 +64,7 @@ router bgp 65100 address-family ipv6 neighbor fc00::7a allowas-in 1 neighbor fc00::7a activate + neighbor fc00::7a soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor fc00::7e remote-as 64600 @@ -67,6 +72,7 @@ router bgp 65100 address-family ipv6 neighbor fc00::7e allowas-in 1 neighbor fc00::7e activate + neighbor fc00::7e soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor fc00::72 remote-as 64600 @@ -74,6 +80,7 @@ router bgp 65100 address-family ipv6 neighbor fc00::72 allowas-in 1 neighbor fc00::72 activate + neighbor fc00::72 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor fc00::76 remote-as 64600 @@ -81,6 +88,7 @@ router bgp 65100 address-family ipv6 neighbor fc00::76 allowas-in 1 neighbor fc00::76 activate + neighbor fc00::76 soft-reconfiguration inbound maximum-paths 64 exit-address-family ! From bac572229e62a42a95b3a92781278054b49cc210 Mon Sep 17 00:00:00 2001 From: Serhey Popovych Date: Sat, 23 Jun 2018 04:46:05 +0300 Subject: [PATCH 1375/1833] [docker-fpm-frr]: Fix build with frr used for routing stack (#1728) After commit 832be7b8f4c3 ("[dockers] Prevent apt-get from installing suggested and recommended packages by default (#1666)") SONiC fails to build when FRR is used for routing stack (e.g. SONIC_ROUTING_STACK is set to frr in rules/config). To fix issue just replicate changes from docker-fpm-quagga to docker-fpm-frr to make dependencies installed correctly after above change to package installing behaviour. Signed-off-by: Sergey Popovich --- dockers/docker-fpm-frr/Dockerfile.j2 | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 332a0cdd508d..350b3b2efb91 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -1,26 +1,31 @@ FROM docker-config-engine -## Make apt-get non-interactive +# Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +# Update apt's cache of available packages RUN apt-get update +# Install required packages RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 libc-ares2 iproute -COPY \ -{% for deb in docker_fpm_frr_debs.split(' ') -%} -debs/{{ deb }}{{' '}} -{%- endfor -%} -debs/ +{% if docker_fpm_frr_debs.strip() -%} +# Copy locally-built Debian package dependencies +{%- for deb in docker_fpm_frr_debs.split(' ') %} +COPY debs/{{ deb }} /debs/ +{%- endfor %} -RUN dpkg -i \ -{% for deb in docker_fpm_frr_debs.split(' ') -%} -debs/{{ deb }}{{' '}} +# Install locally-built Debian packages and implicitly install their dependencies +{%- for deb in docker_fpm_frr_debs.split(' ') %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} {%- endfor %} +{%- endif %} -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs +# Clean up +RUN apt-get clean -y +RUN apt-get autoclean -y +RUN apt-get autoremove -y +RUN rm -rf /debs ~/.cache COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["start.sh", "config.sh", "/usr/bin/"] From 7389443597d3b9571bc7046e7e7bfaffc58a146c Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Fri, 22 Jun 2018 18:53:30 -0700 Subject: [PATCH 1376/1833] [devices]: Migrate a7050-qx-32s to use the new buffers config architecture and create the profile for t1 (#1709) Move the ingress lossless profile from buffers.json.j2 to pg_profile_lookup.ini Move pool and the rest of the profile from buffers.json.j2 to buffers_defaults_t1.j2 Add port speed info in port_config.ini Make buffers_default_t1.j2 the default profile in buffers.json.j2 Signed-off-by: Wenda Ni --- .../Arista-7050-QX-32S/buffers.json.j2 | 129 +----------------- .../Arista-7050-QX-32S/buffers_defaults_t1.j2 | 45 ++++++ .../Arista-7050-QX-32S/pg_profile_lookup.ini | 11 ++ .../Arista-7050-QX-32S/port_config.ini | 66 ++++----- 4 files changed, 91 insertions(+), 160 deletions(-) create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t1.j2 create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 index 551f73ca0477..b67cf577ab75 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers.json.j2 @@ -1,128 +1,3 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_speed = '100G' %} -{% set default_ports_num = 32 -%} +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "12766208", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "12766208", - "type": "egress", - "mode": "static" - }, - "egress_lossy_pool": { - "size": "8072396", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "xon":"18432", - "xoff":"40560", - "size":"41808", - "dynamic_th":"-4", - "xon_offset":"2496" - }, - "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" - } - }, - "BUFFER_PG": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - } - } -} 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 new file mode 100644 index 000000000000..2d0cc548be30 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/buffers_defaults_t1.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": "8072396", + "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/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini new file mode 100644 index 000000000000..a1181e7befff --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/pg_profile_lookup.ini @@ -0,0 +1,11 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 40000 5m 41808 18432 40560 -4 2496 + 50000 5m 41808 18432 40560 -4 2496 + 100000 5m 41808 18432 40560 -4 2496 + 40000 40m 41808 18432 40560 -4 2496 + 50000 40m 41808 18432 40560 -4 2496 + 100000 40m 41808 18432 40560 -4 2496 + 40000 300m 41808 18432 40560 -4 2496 + 50000 300m 41808 18432 40560 -4 2496 + 100000 300m 41808 18432 40560 -4 2496 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini index fda62e998c1a..857b126bf833 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias index -Ethernet0 9,10,11,12 Ethernet5/1 5 -Ethernet4 13,14,15,16 Ethernet6/1 6 -Ethernet8 17,18,19,20 Ethernet7/1 7 -Ethernet12 21,22,23,24 Ethernet8/1 8 -Ethernet16 29,30,31,32 Ethernet9/1 9 -Ethernet20 25,26,27,28 Ethernet10/1 10 -Ethernet24 33,34,35,36 Ethernet11/1 11 -Ethernet28 37,38,39,40 Ethernet12/1 12 -Ethernet32 45,46,47,48 Ethernet13/1 13 -Ethernet36 41,42,43,44 Ethernet14/1 14 -Ethernet40 49,50,51,52 Ethernet15/1 15 -Ethernet44 53,54,55,56 Ethernet16/1 16 -Ethernet48 69,70,71,72 Ethernet17/1 17 -Ethernet52 65,66,67,68 Ethernet18/1 18 -Ethernet56 73,74,75,76 Ethernet19/1 19 -Ethernet60 77,78,79,80 Ethernet20/1 20 -Ethernet64 93,94,95,96 Ethernet21/1 21 -Ethernet68 89,90,91,92 Ethernet22/1 22 -Ethernet72 97,98,99,100 Ethernet23/1 23 -Ethernet76 101,102,103,104 Ethernet24/1 24 -Ethernet80 109,110,111,112 Ethernet25/1 25 -Ethernet84 105,106,107,108 Ethernet26/1 26 -Ethernet88 121,122,123,124 Ethernet27/1 27 -Ethernet92 125,126,127,128 Ethernet28/1 28 -Ethernet96 61,62,63,64 Ethernet29 29 -Ethernet100 57,58,59,60 Ethernet30 30 -Ethernet104 81,82,83,84 Ethernet31 31 -Ethernet108 85,86,87,88 Ethernet32 32 -Ethernet112 117,118,119,120 Ethernet33 33 -Ethernet116 113,114,115,116 Ethernet34 34 -Ethernet120 1,2,3,4 Ethernet35 35 -Ethernet124 5,6,7,8 Ethernet36 36 +# name lanes alias index speed +Ethernet0 9,10,11,12 Ethernet5/1 5 40000 +Ethernet4 13,14,15,16 Ethernet6/1 6 40000 +Ethernet8 17,18,19,20 Ethernet7/1 7 40000 +Ethernet12 21,22,23,24 Ethernet8/1 8 40000 +Ethernet16 29,30,31,32 Ethernet9/1 9 40000 +Ethernet20 25,26,27,28 Ethernet10/1 10 40000 +Ethernet24 33,34,35,36 Ethernet11/1 11 40000 +Ethernet28 37,38,39,40 Ethernet12/1 12 40000 +Ethernet32 45,46,47,48 Ethernet13/1 13 40000 +Ethernet36 41,42,43,44 Ethernet14/1 14 40000 +Ethernet40 49,50,51,52 Ethernet15/1 15 40000 +Ethernet44 53,54,55,56 Ethernet16/1 16 40000 +Ethernet48 69,70,71,72 Ethernet17/1 17 40000 +Ethernet52 65,66,67,68 Ethernet18/1 18 40000 +Ethernet56 73,74,75,76 Ethernet19/1 19 40000 +Ethernet60 77,78,79,80 Ethernet20/1 20 40000 +Ethernet64 93,94,95,96 Ethernet21/1 21 40000 +Ethernet68 89,90,91,92 Ethernet22/1 22 40000 +Ethernet72 97,98,99,100 Ethernet23/1 23 40000 +Ethernet76 101,102,103,104 Ethernet24/1 24 40000 +Ethernet80 109,110,111,112 Ethernet25/1 25 40000 +Ethernet84 105,106,107,108 Ethernet26/1 26 40000 +Ethernet88 121,122,123,124 Ethernet27/1 27 40000 +Ethernet92 125,126,127,128 Ethernet28/1 28 40000 +Ethernet96 61,62,63,64 Ethernet29 29 40000 +Ethernet100 57,58,59,60 Ethernet30 30 40000 +Ethernet104 81,82,83,84 Ethernet31 31 40000 +Ethernet108 85,86,87,88 Ethernet32 32 40000 +Ethernet112 117,118,119,120 Ethernet33 33 40000 +Ethernet116 113,114,115,116 Ethernet34 34 40000 +Ethernet120 1,2,3,4 Ethernet35 35 40000 +Ethernet124 5,6,7,8 Ethernet36 36 40000 From 07ea9741fba01d862343f16fedb5fe5f1d27a01f Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 22 Jun 2018 19:53:51 -0700 Subject: [PATCH 1377/1833] Enable sairedis counter thread in 3 minutes after SONiC was started (#1805) --- files/build_templates/enable_counters.service | 7 +++++++ files/build_templates/enable_counters.timer | 9 +++++++++ files/build_templates/snmp.service.j2 | 7 ++----- files/build_templates/snmp.timer | 9 +++++++++ files/build_templates/sonic_debian_extension.j2 | 8 ++++++++ src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 8 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 files/build_templates/enable_counters.service create mode 100644 files/build_templates/enable_counters.timer create mode 100644 files/build_templates/snmp.timer diff --git a/files/build_templates/enable_counters.service b/files/build_templates/enable_counters.service new file mode 100644 index 000000000000..98db4da3d2a3 --- /dev/null +++ b/files/build_templates/enable_counters.service @@ -0,0 +1,7 @@ +[Unit] +Description=Enable SONiC counters + +[Service] +Type=oneshot +ExecStart=/usr/bin/counterpoll queue enable +RemainAfterExit=yes diff --git a/files/build_templates/enable_counters.timer b/files/build_templates/enable_counters.timer new file mode 100644 index 000000000000..7382a1658c1b --- /dev/null +++ b/files/build_templates/enable_counters.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Delays the SONiC counters gathering until SONiC has started + +[Timer] +OnBootSec=3min +Unit=enable_counters.service + +[Install] +WantedBy=timers.target diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index f0612a9cfcb6..93ef869b86e1 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -1,12 +1,9 @@ [Unit] Description=SNMP container -Requires=updategraph.service swss.service -After=updategraph.service swss.service +Requires=updategraph.service swss.service enable_counters.service +After=updategraph.service swss.service enable_counters.service [Service] ExecStartPre=/usr/bin/{{docker_container_name}}.sh start ExecStart=/usr/bin/{{docker_container_name}}.sh attach ExecStop=/usr/bin/{{docker_container_name}}.sh stop - -[Install] -WantedBy=multi-user.target diff --git a/files/build_templates/snmp.timer b/files/build_templates/snmp.timer new file mode 100644 index 000000000000..464cf01459ba --- /dev/null +++ b/files/build_templates/snmp.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Delays snmp container until SONiC has started + +[Timer] +OnBootSec=3min 30 sec +Unit=snmp.service + +[Install] +WantedBy=timers.target diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 698a29ec22a7..b4a45ed16149 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -276,6 +276,14 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys {% endif %} +# Copy systemd timer configuration +# It implements delayed start of services +sudo cp $BUILD_TEMPLATES/enable_counters.timer $FILESYSTEM_ROOT/etc/systemd/system/ +sudo cp $BUILD_TEMPLATES/enable_counters.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable enable_counters.timer +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable snmp.timer + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get remove -y python-dev sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get autoremove -y diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 4ef45eed56a4..5fee797a1d2a 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 4ef45eed56a4ec34c225d2a37cc02efc2131033b +Subproject commit 5fee797a1d2ae4d4ba7d7c7ea8cc79578f5c19f5 diff --git a/src/sonic-swss b/src/sonic-swss index 4df9c289a6c2..98ad0bd500fc 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 4df9c289a6c2d41e4dee09f3055f0ac6d8e98ded +Subproject commit 98ad0bd500fc23fb61197e0ff8390d332216c9e8 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index b4367a440fb7..8c5dab6b3417 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit b4367a440fb7b188c60774808195164438061bba +Subproject commit 8c5dab6b341752b4bda3f63917a9c143df778322 From ec850df74b36eb5580e40e23c88e0923bd42e7fd Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Sat, 23 Jun 2018 17:24:56 -0700 Subject: [PATCH 1378/1833] [devices]: Use arista library as led plugin for more platforms. (#1809) This apply to arista_7050_qx32 and arista_7050_qx32s. --- .../plugins/led_control.py | 98 +------------------ .../plugins/led_control.py | 93 +----------------- 2 files changed, 6 insertions(+), 185 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py index 31effbaf11c6..8d387e513c6c 100644 --- a/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32/plugins/led_control.py @@ -1,98 +1,6 @@ -#!/usr/bin/env python -# -# led_control.py -# -# Platform-specific LED control functionality for SONiC -# - try: - from sonic_led.led_control_base import LedControlBase - import swsssdk + import arista.utils.sonic_leds as arista_leds except ImportError, e: - raise ImportError (str(e) + " - required module not found") - - -class LedControl(LedControlBase): - """Platform specific LED control class""" - PORT_TABLE_PREFIX = "PORT_TABLE:" - - SONIC_PORT_NAME_PREFIX = "Ethernet" - - LED_SYSFS_PATH_BREAKOUT_CAPABLE = "/sys/class/leds/qsfp{0}_{1}/brightness" - LED_SYSFS_PATH_NO_BREAKOUT = "/sys/class/leds/qsfp{0}/brightness" - - QSFP_BREAKOUT_START_IDX = 1 - QSFP_BREAKOUT_END_IDX = 24 - QSFP_NO_BREAKOUT_START_IDX = 25 - QSFP_NO_BREAKOUT_END_IDX = 32 - - LED_COLOR_OFF = 0 - LED_COLOR_GREEN = 1 - LED_COLOR_YELLOW = 2 - - # Helper method to map SONiC port name to Arista QSFP index - def _port_name_to_qsfp_index(self, port_name): - # Strip "Ethernet" off port name - if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): - return -1 - - sonic_port_num = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) - - swss = swsssdk.SonicV2Connector() - swss.connect(swss.APPL_DB) - - lanes = swss.get(swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes') - - # SONiC port nums are 0-based and increment by 4 - # Arista QSFP indices are 1-based and increment by 1 - return (((sonic_port_num/4) + 1), sonic_port_num%4, len(lanes.split(','))) - - # Concrete implementation of port_link_state_change() method - def port_link_state_change(self, port, state): - qsfp_index, lane_index, lanes = self._port_name_to_qsfp_index(port) - - # Ignore invalid QSFP indices - if qsfp_index <= 0 or lanes <= 0 or lanes > 4: - return - - # QSFP indices 1-24 are breakout-capable and have four LEDs, and each LED indicate one lane. - # whereas indices 25-32 are not breakout-capable, and only have one - if qsfp_index <= self.QSFP_BREAKOUT_END_IDX: - # assuming 40G, then we need to control four lanes - led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, i) for i in range(lane_index + 1, lane_index + 1 + lanes) ] - else: - led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) ] - - for led_sysfs_path in led_sysfs_paths: - led_file = open(led_sysfs_path, "w") - - if state == "up": - led_file.write("%d" % self.LED_COLOR_GREEN) - else: - led_file.write("%d" % self.LED_COLOR_OFF) - - led_file.close() - - # Constructor - def __init__(self): - # Initialize all front-panel status LEDs to green - with open("/sys/class/leds/status/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/fan_status/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/psu1/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/psu2/brightness", "w") as f: - f.write("1") - - # Initialize: Turn all front panel QSFP LEDs off - for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): - for lane in range(1, 5): - led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, lane) - with open(led_sysfs_path, 'w') as led_file: - led_file.write("%d" % self.LED_COLOR_OFF) + raise ImportError (str(e) + "- required module not found") - for qsfp_index in range(self.QSFP_NO_BREAKOUT_START_IDX, self.QSFP_NO_BREAKOUT_END_IDX + 1): - led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) - with open(led_sysfs_path, 'w') as led_file: - led_file.write("%d" % self.LED_COLOR_OFF) +LedControl = arista_leds.getLedControl() diff --git a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py index 6424516a59d9..8d387e513c6c 100644 --- a/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py +++ b/device/arista/x86_64-arista_7050_qx32s/plugins/led_control.py @@ -1,93 +1,6 @@ -#!/usr/bin/env python -# -# led_control.py -# -# Platform-specific LED control functionality for SONiC -# - try: - from sonic_led.led_control_base import LedControlBase + import arista.utils.sonic_leds as arista_leds except ImportError, e: - raise ImportError (str(e) + " - required module not found") - - -class LedControl(LedControlBase): - """Platform specific LED control class""" - - SONIC_PORT_NAME_PREFIX = "Ethernet" - - LED_SYSFS_PATH_BREAKOUT_CAPABLE = "/sys/class/leds/qsfp{0}_{1}/brightness" - LED_SYSFS_PATH_NO_BREAKOUT = "/sys/class/leds/qsfp{0}/brightness" - - QSFP_BREAKOUT_START_IDX = 1 - QSFP_BREAKOUT_END_IDX = 24 - QSFP_NO_BREAKOUT_START_IDX = 25 - QSFP_NO_BREAKOUT_END_IDX = 32 - - LED_QSFP_OFFSET = 4 - - LED_COLOR_OFF = 0 - LED_COLOR_GREEN = 1 - LED_COLOR_YELLOW = 2 - - # Helper method to map SONiC port name to Arista QSFP index - def _port_name_to_qsfp_index(self, port_name): - # Strip "Ethernet" off port name - if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): - return -1 - - sonic_port_num = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) - - # SONiC port nums are 0-based and increment by 4 - # Arista QSFP indices are 1-based and increment by 1 - return ((sonic_port_num/4) + 1) - - # Concrete implementation of port_link_state_change() method - def port_link_state_change(self, port, state): - qsfp_index = self._port_name_to_qsfp_index(port) - - # Ignore invalid QSFP indices - if qsfp_index <= 0: - return - - # QSFP indices 1-24 are breakout-capable and have four LEDs, and each LED indicate one lane. - # whereas indices 25-32 are not breakout-capable, and only have one - if qsfp_index <= self.QSFP_BREAKOUT_END_IDX: - # assuming 40G, then we need to control four lanes - led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index + self.LED_QSFP_OFFSET, i) for i in range(1, 5) ] - else: - led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index + self.LED_QSFP_OFFSET) ] - - for led_sysfs_path in led_sysfs_paths: - led_file = open(led_sysfs_path, "w") - - if state == "up": - led_file.write("%d" % self.LED_COLOR_GREEN) - else: - led_file.write("%d" % self.LED_COLOR_OFF) - - led_file.close() - - # Constructor - def __init__(self): - # Initialize all front-panel status LEDs to green - with open("/sys/class/leds/status/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/fan_status/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/psu1/brightness", "w") as f: - f.write("1") - with open("/sys/class/leds/psu2/brightness", "w") as f: - f.write("1") - - # Initialize: Turn all front panel QSFP LEDs off - for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): - for lane in range(1, 5): - led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index + self.LED_QSFP_OFFSET, lane) - with open(led_sysfs_path, 'w') as led_file: - led_file.write("%d" % self.LED_COLOR_OFF) + raise ImportError (str(e) + "- required module not found") - for qsfp_index in range(self.QSFP_NO_BREAKOUT_START_IDX, self.QSFP_NO_BREAKOUT_END_IDX + 1): - led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index + self.LED_QSFP_OFFSET) - with open(led_sysfs_path, 'w') as led_file: - led_file.write("%d" % self.LED_COLOR_OFF) +LedControl = arista_leds.getLedControl() From 3d2430525314521d8eb190953ddff1ba2ac1060c Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Mon, 25 Jun 2018 18:43:22 +0300 Subject: [PATCH 1379/1833] [mellanox] Update SAI, SDK, FW pointers (#1811) SAI 1.12.0 SDK 4.2.8103 FW 13.1701.0008 Signed-off-by: Stepan Blyschak --- platform/mellanox/fw.mk | 2 +- platform/mellanox/mlnx-sai.mk | 4 ++-- platform/mellanox/sdk.mk | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 73d1236f5a9a..579c5e5e4986 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1620.0222 +MLNX_FW_VERSION = 13.1701.0008 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/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 53e74021bb84..5b2994360621 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.11.5-master -MLNX_SAI_REVISION = 957f61820e441e490081cb3724f702ed507f7477 +MLNX_SAI_VERSION = SAIRel1.12.0-master +MLNX_SAI_REVISION = 5be04c71508e0688ae004ed838b998dba521f693 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index f301032846c3..88bfe76d0f0d 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/957f61820e441e490081cb3724f702ed507f7477/sdk -MLNX_SDK_VERSION = 4.2.7303 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/5be04c71508e0688ae004ed838b998dba521f693/sdk +MLNX_SDK_VERSION = 4.2.8103 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) From 7ba08e5bf6eb2b37ec0a79785b64b456eba4b59f Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 25 Jun 2018 10:48:42 -0700 Subject: [PATCH 1380/1833] Prefix docker container name to syslog syslogtag (program name) (#1810) --- dockers/docker-base/etc/rsyslog.conf | 6 ++++-- dockers/docker-database/Dockerfile.j2 | 3 +++ dockers/docker-dhcp-relay/Dockerfile.j2 | 3 +++ dockers/docker-fpm-frr/Dockerfile.j2 | 3 +++ dockers/docker-fpm-quagga/Dockerfile.j2 | 3 +++ dockers/docker-lldp-sv2/Dockerfile.j2 | 3 +++ dockers/docker-orchagent/Dockerfile.j2 | 3 +++ dockers/docker-platform-monitor/Dockerfile.j2 | 3 +++ dockers/docker-router-advertiser/Dockerfile.j2 | 3 +++ dockers/docker-snmp-sv2/Dockerfile.j2 | 3 +++ dockers/docker-sonic-telemetry/Dockerfile.j2 | 3 +++ dockers/docker-teamd/Dockerfile.j2 | 3 +++ platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 3 +++ platform/cavium/docker-syncd-cavm/Dockerfile.j2 | 3 +++ platform/centec/docker-syncd-centec/Dockerfile.j2 | 3 +++ platform/marvell/docker-syncd-mrvl/Dockerfile.j2 | 3 +++ platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 3 +++ platform/nephos/docker-syncd-nephos/Dockerfile.j2 | 3 +++ platform/p4/docker-sonic-p4/Dockerfile.j2 | 5 ++++- platform/vs/docker-sonic-vs/Dockerfile.j2 | 3 +++ slave.mk | 2 ++ 21 files changed, 64 insertions(+), 3 deletions(-) diff --git a/dockers/docker-base/etc/rsyslog.conf b/dockers/docker-base/etc/rsyslog.conf index 8cd8928e2b14..cf5509a3e8b3 100644 --- a/dockers/docker-base/etc/rsyslog.conf +++ b/dockers/docker-base/etc/rsyslog.conf @@ -29,8 +29,10 @@ $ModLoad imuxsock # provides support for local system logging ########################### #### GLOBAL DIRECTIVES #### ########################### -#Set remote syslog server -*.* @127.0.0.1:514 + +# Set remote syslog server +template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%") +*.* action(type="omfwd" target="127.0.0.1" port="514" protocol="udp" Template="ForwardFormatInContainer") # # Use traditional timestamp format. diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 4690e1587c14..712ada91a904 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 2c2bdcaecbf7..7382664c64f3 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 350b3b2efb91..4796552d20c7 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index 8836459e4e93..39037f3d042d 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index f75e4ea31422..fb91af231592 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 3d6671996358..0df8e9ba1bb4 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 95e9d150ea2c..c53ed494c474 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 5007daf122cf..c6c770bb7677 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 2605e9b50c2d..e463d00441c7 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + # Enable -O for all Python calls ENV PYTHONOPTIMIZE 1 diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index bbb15db69aaa..51d272c2a212 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index f604433a6c3f..f405fdde10e2 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 042e7e764fd1..bd6d6cc35706 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index a35abf576f6d..9f6e872ff1e1 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index d9b12bb426e4..7fa2bd2ae0e4 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 index 7676b3f2ffa1..6e7c34d644d5 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 966ef35ac9c8..73a16fac2a4b 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 index e0248d460a12..b25272be1a0d 100755 --- a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index 95ac5cc1646d..971d7a962ed3 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -76,4 +79,4 @@ COPY ["files/arp_update", "/usr/bin"] RUN echo "docker-sonic-p4" > /etc/hostname RUN touch /etc/quagga/zebra.conf -ENTRYPOINT ["/bin/bash"] \ No newline at end of file +ENTRYPOINT ["/bin/bash"] diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 0c242bb373ef..2d9b72aa3298 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/slave.mk b/slave.mk index 7ca92dc4ce1b..fc14a8f10a61 100644 --- a/slave.mk +++ b/slave.mk @@ -382,6 +382,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g --build-arg user=$(USER) \ --build-arg uid=$(UID) \ --build-arg guid=$(GUID) \ + --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ # Clean up @@ -412,6 +413,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl --build-arg user=$(USER) \ --build-arg uid=$(UID) \ --build-arg guid=$(GUID) \ + --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ # Clean up From d57bef55dbb584352c05e7d0bdb2cea215a537a9 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 26 Jun 2018 06:34:25 -0700 Subject: [PATCH 1381/1833] Enable all counters: queue, port, and pfcwd (#1814) * Enable all counters: queue, port, and pfcwd * Fixed a small bug inside of sonic-utilities * Another typo --- files/build_templates/enable_counters.service | 2 +- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/build_templates/enable_counters.service b/files/build_templates/enable_counters.service index 98db4da3d2a3..f19249369f87 100644 --- a/files/build_templates/enable_counters.service +++ b/files/build_templates/enable_counters.service @@ -3,5 +3,5 @@ Description=Enable SONiC counters [Service] Type=oneshot -ExecStart=/usr/bin/counterpoll queue enable +ExecStart=/bin/bash -c '/usr/bin/counterpoll queue enable ; /usr/bin/counterpoll port enable ; /usr/bin/pfcwd counter_poll enable' RemainAfterExit=yes diff --git a/src/sonic-swss b/src/sonic-swss index 98ad0bd500fc..72a7f3a5cb99 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 98ad0bd500fc23fb61197e0ff8390d332216c9e8 +Subproject commit 72a7f3a5cb99cec297c7eb0e9e3b2b583eccf8bd diff --git a/src/sonic-utilities b/src/sonic-utilities index 5baa30528bd7..27ae65122582 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 5baa30528bd73ffc364de03c9098263d42a2d320 +Subproject commit 27ae651225820e3eb4f08ed4cd80f93bbb5fe9bf From 0a41247402533af6ab6bf736193da33cbece356d Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 26 Jun 2018 14:48:07 -0700 Subject: [PATCH 1382/1833] Update sonic-swss. Postpone creation of queue maps (#1816) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 72a7f3a5cb99..258ffe64c7f1 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 72a7f3a5cb99cec297c7eb0e9e3b2b583eccf8bd +Subproject commit 258ffe64c7f11a3e63f7cff09ae8bd2f98788c03 From 9a646553939b595c8a45d413c9db3addccd50589 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 26 Jun 2018 17:29:33 -0700 Subject: [PATCH 1383/1833] sonic-quagga update. Don't spam with 'Vtysh connected from' message (#1817) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index 0bc6bd6b208e..cde29666c363 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 0bc6bd6b208e3701df89c3e231c48f3bdb3d046f +Subproject commit cde29666c363e34ea7f230bb827644457acedcbc From d995147050dd5bf6aaf94a2779cf263dc67e2d84 Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Wed, 27 Jun 2018 19:22:37 -0700 Subject: [PATCH 1384/1833] Migrate brcm platform to use new ECN config, which is (#1818) applied on lossless traffic Arista-7060CX-32S-C32 Arista-7060CX-32S-D48C8 Arista-7060CX-32S-Q32 Arista-7260CX3-D108C8 Force10-Z9100-T0 Force10-Z9100 Signed-off-by: Wenda Ni --- .../Arista-7060CX-32S-C32/qos.json.j2 | 30 ++++++------------- .../Arista-7060CX-32S-D48C8/qos.json.j2 | 30 ++++++------------- .../Arista-7060CX-32S-Q32/qos.json.j2 | 30 ++++++------------- .../Arista-7260CX3-D108C8/qos.json.j2 | 30 ++++++------------- .../Force10-Z9100-T0/qos.json.j2 | 30 ++++++------------- .../Force10-Z9100/qos.json.j2 | 30 ++++++------------- 6 files changed, 54 insertions(+), 126 deletions(-) diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 index b724b48c2c23..84f74ecab3be 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 index 8149f1f111ce..5142832ecae4 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0": { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 index b724b48c2c23..84f74ecab3be 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 index 2aa5a902448b..06efa3591771 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet26,Ethernet28,Ethernet30,Ethernet32,Ethernet34,Ethernet36,Ethernet38,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126,Ethernet128,Ethernet130,Ethernet132,Ethernet134,Ethernet136,Ethernet138,Ethernet140,Ethernet142,Ethernet144,Ethernet146,Ethernet148,Ethernet150,Ethernet152,Ethernet154,Ethernet156,Ethernet158,Ethernet160,Ethernet162,Ethernet164,Ethernet166,Ethernet168,Ethernet170,Ethernet172,Ethernet174,Ethernet176,Ethernet178,Ethernet180,Ethernet182,Ethernet184,Ethernet186,Ethernet188,Ethernet190,Ethernet192,Ethernet194,Ethernet196,Ethernet198,Ethernet200,Ethernet202,Ethernet204,Ethernet206,Ethernet208,Ethernet210,Ethernet212,Ethernet214,Ethernet216,Ethernet218,Ethernet220,Ethernet222,Ethernet224,Ethernet226,Ethernet228,Ethernet230,Ethernet232,Ethernet234,Ethernet236,Ethernet238,Ethernet240,Ethernet242,Ethernet244,Ethernet246,Ethernet248,Ethernet250,Ethernet252,Ethernet254|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet26,Ethernet28,Ethernet30,Ethernet32,Ethernet34,Ethernet36,Ethernet38,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126,Ethernet128,Ethernet130,Ethernet132,Ethernet134,Ethernet136,Ethernet138,Ethernet140,Ethernet142,Ethernet144,Ethernet146,Ethernet148,Ethernet150,Ethernet152,Ethernet154,Ethernet156,Ethernet158,Ethernet160,Ethernet162,Ethernet164,Ethernet166,Ethernet168,Ethernet170,Ethernet172,Ethernet174,Ethernet176,Ethernet178,Ethernet180,Ethernet182,Ethernet184,Ethernet186,Ethernet188,Ethernet190,Ethernet192,Ethernet194,Ethernet196,Ethernet198,Ethernet200,Ethernet202,Ethernet204,Ethernet206,Ethernet208,Ethernet210,Ethernet212,Ethernet214,Ethernet216,Ethernet218,Ethernet220,Ethernet222,Ethernet224,Ethernet226,Ethernet228,Ethernet230,Ethernet232,Ethernet234,Ethernet236,Ethernet238,Ethernet240,Ethernet242,Ethernet244,Ethernet246,Ethernet248,Ethernet250,Ethernet252,Ethernet254|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet26,Ethernet28,Ethernet30,Ethernet32,Ethernet34,Ethernet36,Ethernet38,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126,Ethernet128,Ethernet130,Ethernet132,Ethernet134,Ethernet136,Ethernet138,Ethernet140,Ethernet142,Ethernet144,Ethernet146,Ethernet148,Ethernet150,Ethernet152,Ethernet154,Ethernet156,Ethernet158,Ethernet160,Ethernet162,Ethernet164,Ethernet166,Ethernet168,Ethernet170,Ethernet172,Ethernet174,Ethernet176,Ethernet178,Ethernet180,Ethernet182,Ethernet184,Ethernet186,Ethernet188,Ethernet190,Ethernet192,Ethernet194,Ethernet196,Ethernet198,Ethernet200,Ethernet202,Ethernet204,Ethernet206,Ethernet208,Ethernet210,Ethernet212,Ethernet214,Ethernet216,Ethernet218,Ethernet220,Ethernet222,Ethernet224,Ethernet226,Ethernet228,Ethernet230,Ethernet232,Ethernet234,Ethernet236,Ethernet238,Ethernet240,Ethernet242,Ethernet244,Ethernet246,Ethernet248,Ethernet250,Ethernet252,Ethernet254|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 index 09cb63d5d474..57bb4c532177 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0": { "scheduler" : "[SCHEDULER|scheduler.1]" diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 index b724b48c2c23..84f74ecab3be 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 @@ -127,35 +127,23 @@ } }, "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, "AZURE_LOSSLESS" : { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold": "312000", + "green_min_threshold": "104000" } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" From 301fc282a7fd2d9627f9c56b5e4c361e6bf474ba Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 28 Jun 2018 05:29:14 -0700 Subject: [PATCH 1385/1833] Add initial support for keeping track of and displaying reboot cause (#1812) * [rc.local] Move all constants and functions to top of file; Unify style; Reword messages * Add function to process reboot cause upon boot * Simplify retrieval of SONIC_VERSION per comments * Change wording --- files/image_config/platform/rc.local | 84 ++++++++++++++++++---------- 1 file changed, 55 insertions(+), 29 deletions(-) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index de54d141ef7e..b99ecdbcee9d 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -11,6 +11,9 @@ # # By default this script does nothing. +SONIC_VERSION=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v build_version) +FIRST_BOOT_FILE="/host/image-${SONIC_VERSION}/platform/firsttime" + # In case the unit is migrating from another NOS, save the logs log_migration() { echo $1 >> /host/migration/migration.log @@ -85,6 +88,51 @@ update_mgmt_interface_macaddr() { sed -i "/eth0/ s/ATTR{address}==\"$old_mac\"/ATTR{address}==\"$new_mac\"/g" /etc/udev/rules.d/70-persistent-net.rules } +firsttime_exit() { + rm -rf $FIRST_BOOT_FILE + exit 0 +} + +# Given a string of tuples of the form field=value, extract the value for a field +# In : $string, $field +# Out: $value +value_extract() { + set -- $string + for x in "$@"; do + case "$x" in + $field=*) + value="${x#$field=}" + esac + done +} + +# Set up previous and next reboot cause files +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 + if [ -f $FIRST_BOOT_FILE ]; then + echo "SONiC image installation" > $PREVIOUS_REBOOT_CAUSE_FILE + elif [ -f $REBOOT_CAUSE_FILE ]; then + mv -f $REBOOT_CAUSE_FILE $PREVIOUS_REBOOT_CAUSE_FILE + else + echo "Unknown reboot cause" > $PREVIOUS_REBOOT_CAUSE_FILE + fi + + # Set the default cause for the next reboot + echo "Unexpected reboot" > $REBOOT_CAUSE_FILE +} + +#### Begin Main Body #### + +# Set up previous and next reboot cause files +process_reboot_cause + # If the machine.conf is absent, it indicates that the unit booted # into SONiC from another NOS. Extract the machine.conf from ONIE. if [ ! -e /host/machine.conf ]; then @@ -161,38 +209,16 @@ fi . /host/machine.conf -echo "install platform dependent packages at the first boot time" - -firsttime_exit() -{ - rm /host/image-$sonic_version/platform/firsttime - exit 0 -} - -# Given a string of tuples of the form field=value, extract the value for a field -# In : $string, $field -# Out: $value -value_extract() -{ -set -- $string -for x in "$@"; do - case "$x" in - $field=*) - value="${x#$field=}" - esac -done -} - -eval sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") +if [ -f $FIRST_BOOT_FILE ]; then -if [ -f /host/image-$sonic_version/platform/firsttime ]; then + echo "First boot detected. Performing first boot tasks..." if [ -n "$aboot_platform" ]; then platform=$aboot_platform elif [ -n "$onie_platform" ]; then platform=$onie_platform else - echo "Unknown sonic platform" + echo "Unknown SONiC platform" firsttime_exit fi @@ -216,15 +242,15 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then touch /tmp/pending_config_initialization fi - if [ -d /host/image-$sonic_version/platform/$platform ]; then - dpkg -i /host/image-$sonic_version/platform/$platform/*.deb + if [ -d /host/image-$SONIC_VERSION/platform/$platform ]; then + dpkg -i /host/image-$SONIC_VERSION/platform/$platform/*.deb fi # If the unit booted into SONiC from another NOS's grub, # we now install a grub for SONiC. if [ -n "$onie_platform" ] && [ -n "$migration" ]; then - grub_bin=$(ls /host/image-$sonic_version/platform/x86_64-grub/grub-pc-bin*.deb 2> /dev/null) + grub_bin=$(ls /host/image-$SONIC_VERSION/platform/x86_64-grub/grub-pc-bin*.deb 2> /dev/null) if [ -z "$grub_bin" ]; then log_migration "Unable to locate grub package !" firsttime_exit @@ -302,7 +328,7 @@ if [ -f /host/image-$sonic_version/platform/firsttime ]; then mv /host/grub.cfg /host/grub/grub.cfg fi - rm /host/image-$sonic_version/platform/firsttime + firsttime_exit fi exit 0 From a89b8d86cc35072d5fa243f032b55f7c6f447d89 Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Thu, 28 Jun 2018 16:50:14 -0700 Subject: [PATCH 1386/1833] Correct a7060 config for tor (#1823) Move a7060 configs out of syncd docker Signed-off-by: Wenda --- .../Arista-7060CX-32S-Q32/sai.profile.j2 | 6 +- .../th-a7060-cx32s-32x40G-t0.config.bcm | 444 ++++++++++++++++++ .../th-a7060-cx32s-32x40G-t1.config.bcm | 444 ++++++++++++++++++ 3 files changed, 891 insertions(+), 3 deletions(-) create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 index bef6932f1eac..638fd28b0765 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/sai.profile.j2 @@ -2,12 +2,12 @@ {%- if DEVICE_METADATA is defined -%} {%- set switch_role = DEVICE_METADATA['localhost']['type'] -%} {%- if switch_role.lower() == 'torrouter' %} -{% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x40G.config.bcm' -%} +{% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-a7060-cx32s-32x40G-t0.config.bcm' -%} {%- else %} -{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x40G-t1.config.bcm' -%} +{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-a7060-cx32s-32x40G-t1.config.bcm' -%} {%- endif %} {%- else %} -{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x40G-t1.config.bcm' -%} +{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-a7060-cx32s-32x40G-t1.config.bcm' -%} {%- endif %} {# Write the contents of sai_ profile_filename to sai.profile file #} {{ sai_profile_contents }} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm new file mode 100644 index 000000000000..0cb4ae4a474a --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm @@ -0,0 +1,444 @@ +# Arista 7060CX-32S + +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 +dma_desc_timeout_usec=15000000 +higig2_hdr_mode=1 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +l2xmsg_mode=1 +max_vp_lags=0 +miim_intr_enable=0 +module_64ports=1 +os=unix +oversubscribe_mode=1 +ptp_bs_fref.0=25000000 +ptp_ts_pll_fref.0=25000000 +robust_hash_disable_egress_vlan.0=1 +robust_hash_disable_mpls.0=1 +robust_hash_disable_vlan.0=1 +tdma_timeout_usec.0=15000000 +tslam_timeout_usec.0=15000000 +pbmp_xport_xe.0=0x7ffffffffffffffffffffffffffffffffe +phy_an_allow_pll_change_hg.0=0 +phy_an_c73_1.0=1 +phy_an_c73_2.0=1 +phy_an_c73_3.0=1 +phy_an_c73_4.0=1 +phy_an_c73_5.0=1 +phy_an_c73_6.0=1 +phy_an_c73_7.0=1 +phy_an_c73_8.0=1 +phy_an_c73_34.0=1 +phy_an_c73_35.0=1 +phy_an_c73_36.0=1 +phy_an_c73_37.0=1 +phy_an_c73_38.0=1 +phy_an_c73_39.0=1 +phy_an_c73_40.0=1 +phy_an_c73_41.0=1 +phy_an_c73_68.0=1 +phy_an_c73_69.0=1 +phy_an_c73_70.0=1 +phy_an_c73_71.0=1 +phy_an_c73_72.0=1 +phy_an_c73_73.0=1 +phy_an_c73_74.0=1 +phy_an_c73_75.0=1 +phy_an_c73_102.0=1 +phy_an_c73_103.0=1 +phy_an_c73_104.0=1 +phy_an_c73_105.0=1 +phy_an_c73_106.0=1 +phy_an_c73_107.0=1 +phy_an_c73_108.0=1 +phy_an_c73_109.0=1 +phy_an_fec_1.0=1 +phy_an_fec_2.0=1 +phy_an_fec_3.0=1 +phy_an_fec_4.0=1 +phy_an_fec_5.0=1 +phy_an_fec_6.0=1 +phy_an_fec_7.0=1 +phy_an_fec_8.0=1 +phy_an_fec_9.0=1 +phy_an_fec_10.0=1 +phy_an_fec_11.0=1 +phy_an_fec_12.0=1 +phy_an_fec_13.0=1 +phy_an_fec_14.0=1 +phy_an_fec_15.0=1 +phy_an_fec_16.0=1 +phy_an_fec_17.0=1 +phy_an_fec_18.0=1 +phy_an_fec_19.0=1 +phy_an_fec_20.0=1 +phy_an_fec_21.0=1 +phy_an_fec_22.0=1 +phy_an_fec_23.0=1 +phy_an_fec_24.0=1 +phy_an_fec_25.0=1 +phy_an_fec_26.0=1 +phy_an_fec_27.0=1 +phy_an_fec_28.0=1 +phy_an_fec_29.0=1 +phy_an_fec_30.0=1 +phy_an_fec_31.0=1 +phy_an_fec_32.0=1 +phy_an_fec_34.0=1 +phy_an_fec_38.0=1 +phy_an_fec_39.0=1 +phy_an_fec_40.0=1 +phy_an_fec_41.0=1 +phy_an_fec_42.0=1 +phy_an_fec_43.0=1 +phy_an_fec_44.0=1 +phy_an_fec_45.0=1 +phy_an_fec_46.0=1 +phy_an_fec_47.0=1 +phy_an_fec_48.0=1 +phy_an_fec_49.0=1 +phy_an_fec_50.0=1 +phy_an_fec_51.0=1 +phy_an_fec_52.0=1 +phy_an_fec_53.0=1 +phy_an_fec_54.0=1 +phy_an_fec_55.0=1 +phy_an_fec_56.0=1 +phy_an_fec_57.0=1 +phy_an_fec_58.0=1 +phy_an_fec_59.0=1 +phy_an_fec_60.0=1 +phy_an_fec_61.0=1 +phy_an_fec_62.0=1 +phy_an_fec_63.0=1 +phy_an_fec_64.0=1 +phy_an_fec_65.0=1 +phy_an_fec_68.0=1 +phy_an_fec_69.0=1 +phy_an_fec_70.0=1 +phy_an_fec_71.0=1 +phy_an_fec_72.0=1 +phy_an_fec_73.0=1 +phy_an_fec_74.0=1 +phy_an_fec_75.0=1 +phy_an_fec_76.0=1 +phy_an_fec_77.0=1 +phy_an_fec_78.0=1 +phy_an_fec_79.0=1 +phy_an_fec_80.0=1 +phy_an_fec_81.0=1 +phy_an_fec_82.0=1 +phy_an_fec_83.0=1 +phy_an_fec_84.0=1 +phy_an_fec_85.0=1 +phy_an_fec_86.0=1 +phy_an_fec_87.0=1 +phy_an_fec_88.0=1 +phy_an_fec_89.0=1 +phy_an_fec_90.0=1 +phy_an_fec_91.0=1 +phy_an_fec_92.0=1 +phy_an_fec_93.0=1 +phy_an_fec_94.0=1 +phy_an_fec_95.0=1 +phy_an_fec_96.0=1 +phy_an_fec_97.0=1 +phy_an_fec_98.0=1 +phy_an_fec_99.0=1 +phy_an_fec_102.0=1 +phy_an_fec_103.0=1 +phy_an_fec_104.0=1 +phy_an_fec_105.0=1 +phy_an_fec_106.0=1 +phy_an_fec_107.0=1 +phy_an_fec_108.0=1 +phy_an_fec_109.0=1 +phy_an_fec_110.0=1 +phy_an_fec_111.0=1 +phy_an_fec_112.0=1 +phy_an_fec_113.0=1 +phy_an_fec_114.0=1 +phy_an_fec_115.0=1 +phy_an_fec_116.0=1 +phy_an_fec_117.0=1 +phy_an_fec_118.0=1 +phy_an_fec_119.0=1 +phy_an_fec_120.0=1 +phy_an_fec_121.0=1 +phy_an_fec_122.0=1 +phy_an_fec_123.0=1 +phy_an_fec_124.0=1 +phy_an_fec_125.0=1 +phy_an_fec_126.0=1 +phy_an_fec_127.0=1 +phy_an_fec_128.0=1 +phy_an_fec_129.0=1 +phy_an_fec_130.0=1 +phy_an_fec_131.0=1 +phy_an_fec_132.0=1 +phy_an_fec_133.0=1 +phy_xaui_rx_polarity_flip_1.0=0x1 +phy_xaui_rx_polarity_flip_2.0=0x5 +phy_xaui_rx_polarity_flip_3.0=0x1 +phy_xaui_rx_polarity_flip_4.0=0x7 +phy_xaui_rx_polarity_flip_5.0=0xc +phy_xaui_rx_polarity_flip_6.0=0xf +phy_xaui_rx_polarity_flip_7.0=0xc +phy_xaui_rx_polarity_flip_8.0=0xf +phy_xaui_rx_polarity_flip_34.0=0x0 +phy_xaui_rx_polarity_flip_35.0=0x7 +phy_xaui_rx_polarity_flip_36.0=0x4 +phy_xaui_rx_polarity_flip_37.0=0x7 +phy_xaui_rx_polarity_flip_38.0=0x4 +phy_xaui_rx_polarity_flip_39.0=0x6 +phy_xaui_rx_polarity_flip_40.0=0x1 +phy_xaui_rx_polarity_flip_41.0=0x2 +phy_xaui_rx_polarity_flip_68.0=0xd +phy_xaui_rx_polarity_flip_69.0=0x6 +phy_xaui_rx_polarity_flip_70.0=0x1 +phy_xaui_rx_polarity_flip_71.0=0x8 +phy_xaui_rx_polarity_flip_72.0=0x7 +phy_xaui_rx_polarity_flip_73.0=0xc +phy_xaui_rx_polarity_flip_74.0=0x7 +phy_xaui_rx_polarity_flip_75.0=0x8 +phy_xaui_rx_polarity_flip_102.0=0xb +phy_xaui_rx_polarity_flip_103.0=0xc +phy_xaui_rx_polarity_flip_104.0=0x3 +phy_xaui_rx_polarity_flip_105.0=0xc +phy_xaui_rx_polarity_flip_106.0=0xb +phy_xaui_rx_polarity_flip_107.0=0x5 +phy_xaui_rx_polarity_flip_108.0=0x1 +phy_xaui_rx_polarity_flip_109.0=0x9 +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_2.0=0xe +phy_xaui_tx_polarity_flip_3.0=0x2 +phy_xaui_tx_polarity_flip_4.0=0xe +phy_xaui_tx_polarity_flip_5.0=0xc +phy_xaui_tx_polarity_flip_6.0=0xf +phy_xaui_tx_polarity_flip_7.0=0xc +phy_xaui_tx_polarity_flip_8.0=0xf +phy_xaui_tx_polarity_flip_34.0=0x0 +phy_xaui_tx_polarity_flip_35.0=0xe +phy_xaui_tx_polarity_flip_36.0=0x0 +phy_xaui_tx_polarity_flip_37.0=0xe +phy_xaui_tx_polarity_flip_38.0=0xf +phy_xaui_tx_polarity_flip_39.0=0xe +phy_xaui_tx_polarity_flip_40.0=0x6 +phy_xaui_tx_polarity_flip_41.0=0xb +phy_xaui_tx_polarity_flip_68.0=0x9 +phy_xaui_tx_polarity_flip_69.0=0xb +phy_xaui_tx_polarity_flip_70.0=0xd +phy_xaui_tx_polarity_flip_71.0=0x9 +phy_xaui_tx_polarity_flip_72.0=0x6 +phy_xaui_tx_polarity_flip_73.0=0xc +phy_xaui_tx_polarity_flip_74.0=0x9 +phy_xaui_tx_polarity_flip_75.0=0x9 +phy_xaui_tx_polarity_flip_102.0=0x6 +phy_xaui_tx_polarity_flip_103.0=0xb +phy_xaui_tx_polarity_flip_104.0=0x6 +phy_xaui_tx_polarity_flip_105.0=0xb +phy_xaui_tx_polarity_flip_106.0=0x6 +phy_xaui_tx_polarity_flip_107.0=0xf +phy_xaui_tx_polarity_flip_108.0=0x6 +phy_xaui_tx_polarity_flip_109.0=0xc +portmap_1.0=1:40 +portmap_2.0=5:40 +portmap_3.0=9:40 +portmap_4.0=13:40 +portmap_5.0=17:40 +portmap_6.0=21:40 +portmap_7.0=25:40 +portmap_8.0=29:40 +portmap_34.0=33:40 +portmap_35.0=37:40 +portmap_36.0=41:40 +portmap_37.0=45:40 +portmap_38.0=49:40 +portmap_39.0=53:40 +portmap_40.0=57:40 +portmap_41.0=61:40 +portmap_68.0=65:40 +portmap_69.0=69:40 +portmap_70.0=73:40 +portmap_71.0=77:40 +portmap_72.0=81:40 +portmap_73.0=85:40 +portmap_74.0=89:40 +portmap_75.0=93:40 +portmap_102.0=97:40 +portmap_103.0=101:40 +portmap_104.0=105:40 +portmap_105.0=109:40 +portmap_106.0=113:40 +portmap_107.0=117:40 +portmap_108.0=121:40 +portmap_109.0=125:40 +port_phy_addr_1.0=0xff +port_phy_addr_2.0=0xff +port_phy_addr_3.0=0xff +port_phy_addr_4.0=0xff +port_phy_addr_5.0=0xff +port_phy_addr_6.0=0xff +port_phy_addr_7.0=0xff +port_phy_addr_8.0=0xff +port_phy_addr_34.0=0xff +port_phy_addr_35.0=0xff +port_phy_addr_36.0=0xff +port_phy_addr_37.0=0xff +port_phy_addr_38.0=0xff +port_phy_addr_39.0=0xff +port_phy_addr_40.0=0xff +port_phy_addr_41.0=0xff +port_phy_addr_68.0=0xff +port_phy_addr_69.0=0xff +port_phy_addr_70.0=0xff +port_phy_addr_71.0=0xff +port_phy_addr_72.0=0xff +port_phy_addr_73.0=0xff +port_phy_addr_74.0=0xff +port_phy_addr_75.0=0xff +port_phy_addr_102.0=0xff +port_phy_addr_103.0=0xff +port_phy_addr_104.0=0xff +port_phy_addr_105.0=0xff +port_phy_addr_106.0=0xff +port_phy_addr_107.0=0xff +port_phy_addr_108.0=0xff +port_phy_addr_109.0=0xff +xgxs_rx_lane_map_1.0=0x3210 +xgxs_rx_lane_map_2.0=0x3210 +xgxs_rx_lane_map_3.0=0x3210 +xgxs_rx_lane_map_4.0=0x3210 +xgxs_rx_lane_map_5.0=0x0123 +xgxs_rx_lane_map_6.0=0x2301 +xgxs_rx_lane_map_7.0=0x0123 +xgxs_rx_lane_map_8.0=0x2301 +xgxs_rx_lane_map_34.0=0x0123 +xgxs_rx_lane_map_35.0=0x0321 +xgxs_rx_lane_map_36.0=0x0321 +xgxs_rx_lane_map_37.0=0x0321 +xgxs_rx_lane_map_38.0=0x1230 +xgxs_rx_lane_map_39.0=0x2301 +xgxs_rx_lane_map_40.0=0x1230 +xgxs_rx_lane_map_41.0=0x2103 +xgxs_rx_lane_map_68.0=0x1230 +xgxs_rx_lane_map_69.0=0x2301 +xgxs_rx_lane_map_70.0=0x1230 +xgxs_rx_lane_map_71.0=0x2103 +xgxs_rx_lane_map_72.0=0x1230 +xgxs_rx_lane_map_73.0=0x2301 +xgxs_rx_lane_map_74.0=0x1230 +xgxs_rx_lane_map_75.0=0x2103 +xgxs_rx_lane_map_102.0=0x3210 +xgxs_rx_lane_map_103.0=0x3210 +xgxs_rx_lane_map_104.0=0x3210 +xgxs_rx_lane_map_105.0=0x3210 +xgxs_rx_lane_map_106.0=0x3210 +xgxs_rx_lane_map_107.0=0x3210 +xgxs_rx_lane_map_108.0=0x3210 +xgxs_rx_lane_map_109.0=0x3210 +xgxs_tx_lane_map_1.0=0x0321 +xgxs_tx_lane_map_2.0=0x2301 +xgxs_tx_lane_map_3.0=0x0321 +xgxs_tx_lane_map_4.0=0x2301 +xgxs_tx_lane_map_5.0=0x0123 +xgxs_tx_lane_map_6.0=0x0123 +xgxs_tx_lane_map_7.0=0x0123 +xgxs_tx_lane_map_8.0=0x0123 +xgxs_tx_lane_map_34.0=0x2301 +xgxs_tx_lane_map_35.0=0x0321 +xgxs_tx_lane_map_36.0=0x2301 +xgxs_tx_lane_map_37.0=0x0321 +xgxs_tx_lane_map_38.0=0x0123 +xgxs_tx_lane_map_39.0=0x1230 +xgxs_tx_lane_map_40.0=0x2301 +xgxs_tx_lane_map_41.0=0x1032 +xgxs_tx_lane_map_68.0=0x0123 +xgxs_tx_lane_map_69.0=0x1230 +xgxs_tx_lane_map_70.0=0x2301 +xgxs_tx_lane_map_71.0=0x1032 +xgxs_tx_lane_map_72.0=0x0123 +xgxs_tx_lane_map_73.0=0x1230 +xgxs_tx_lane_map_74.0=0x2301 +xgxs_tx_lane_map_75.0=0x1032 +xgxs_tx_lane_map_102.0=0x0321 +xgxs_tx_lane_map_103.0=0x2301 +xgxs_tx_lane_map_104.0=0x0321 +xgxs_tx_lane_map_105.0=0x2301 +xgxs_tx_lane_map_106.0=0x0321 +xgxs_tx_lane_map_107.0=0x2301 +xgxs_tx_lane_map_108.0=0x0321 +xgxs_tx_lane_map_109.0=0x2301 +serdes_driver_current_1=0x4 +serdes_preemphasis_1=0x145c00 +serdes_driver_current_2=0x4 +serdes_preemphasis_2=0x145c00 +serdes_driver_current_3=0x8 +serdes_preemphasis_3=0x185800 +serdes_driver_current_4=0x8 +serdes_preemphasis_4=0x185800 +serdes_driver_current_5=0x8 +serdes_preemphasis_5=0x185800 +serdes_driver_current_6=0x8 +serdes_preemphasis_6=0x185800 +serdes_driver_current_7=0xf +serdes_preemphasis_7=0x205000 +serdes_driver_current_8=0xf +serdes_preemphasis_8=0x205000 +serdes_driver_current_34=0xf +serdes_preemphasis_34=0x205000 +serdes_driver_current_35=0xf +serdes_preemphasis_35=0x205000 +serdes_driver_current_36=0xf +serdes_preemphasis_36=0x205000 +serdes_driver_current_37=0xf +serdes_preemphasis_37=0x205000 +serdes_driver_current_38=0x8 +serdes_preemphasis_38=0x185800 +serdes_driver_current_39=0x8 +serdes_preemphasis_39=0x185800 +serdes_driver_current_40=0x8 +serdes_preemphasis_40=0x185800 +serdes_driver_current_41=0x8 +serdes_preemphasis_41=0x185800 +serdes_driver_current_68=0x4 +serdes_preemphasis_68=0x145c00 +serdes_driver_current_69=0x4 +serdes_preemphasis_69=0x145c00 +serdes_driver_current_70=0x4 +serdes_preemphasis_70=0x145c00 +serdes_driver_current_71=0x4 +serdes_preemphasis_71=0x145c00 +serdes_driver_current_72=0x4 +serdes_preemphasis_72=0x145c00 +serdes_driver_current_73=0x4 +serdes_preemphasis_73=0x145c00 +serdes_driver_current_74=0x4 +serdes_preemphasis_74=0x145c00 +serdes_driver_current_75=0x4 +serdes_preemphasis_75=0x145c00 +serdes_driver_current_102=0x4 +serdes_preemphasis_102=0x145c00 +serdes_driver_current_103=0x4 +serdes_preemphasis_103=0x145c00 +serdes_driver_current_104=0x4 +serdes_preemphasis_104=0x145c00 +serdes_driver_current_105=0x4 +serdes_preemphasis_105=0x145c00 +serdes_driver_current_106=0x4 +serdes_preemphasis_106=0x145c00 +serdes_driver_current_107=0x4 +serdes_preemphasis_107=0x145c00 +serdes_driver_current_108=0x4 +serdes_preemphasis_108=0x145c00 +serdes_driver_current_109=0x4 +serdes_preemphasis_109=0x145c00 + +mmu_init_config="MSFT-TH-Tier0" diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm new file mode 100644 index 000000000000..c3218645ac2d --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm @@ -0,0 +1,444 @@ +# Arista 7060CX-32S + +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 +dma_desc_timeout_usec=15000000 +higig2_hdr_mode=1 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +l2xmsg_mode=1 +max_vp_lags=0 +miim_intr_enable=0 +module_64ports=1 +os=unix +oversubscribe_mode=1 +ptp_bs_fref.0=25000000 +ptp_ts_pll_fref.0=25000000 +robust_hash_disable_egress_vlan.0=1 +robust_hash_disable_mpls.0=1 +robust_hash_disable_vlan.0=1 +tdma_timeout_usec.0=15000000 +tslam_timeout_usec.0=15000000 +pbmp_xport_xe.0=0x7ffffffffffffffffffffffffffffffffe +phy_an_allow_pll_change_hg.0=0 +phy_an_c73_1.0=1 +phy_an_c73_2.0=1 +phy_an_c73_3.0=1 +phy_an_c73_4.0=1 +phy_an_c73_5.0=1 +phy_an_c73_6.0=1 +phy_an_c73_7.0=1 +phy_an_c73_8.0=1 +phy_an_c73_34.0=1 +phy_an_c73_35.0=1 +phy_an_c73_36.0=1 +phy_an_c73_37.0=1 +phy_an_c73_38.0=1 +phy_an_c73_39.0=1 +phy_an_c73_40.0=1 +phy_an_c73_41.0=1 +phy_an_c73_68.0=1 +phy_an_c73_69.0=1 +phy_an_c73_70.0=1 +phy_an_c73_71.0=1 +phy_an_c73_72.0=1 +phy_an_c73_73.0=1 +phy_an_c73_74.0=1 +phy_an_c73_75.0=1 +phy_an_c73_102.0=1 +phy_an_c73_103.0=1 +phy_an_c73_104.0=1 +phy_an_c73_105.0=1 +phy_an_c73_106.0=1 +phy_an_c73_107.0=1 +phy_an_c73_108.0=1 +phy_an_c73_109.0=1 +phy_an_fec_1.0=1 +phy_an_fec_2.0=1 +phy_an_fec_3.0=1 +phy_an_fec_4.0=1 +phy_an_fec_5.0=1 +phy_an_fec_6.0=1 +phy_an_fec_7.0=1 +phy_an_fec_8.0=1 +phy_an_fec_9.0=1 +phy_an_fec_10.0=1 +phy_an_fec_11.0=1 +phy_an_fec_12.0=1 +phy_an_fec_13.0=1 +phy_an_fec_14.0=1 +phy_an_fec_15.0=1 +phy_an_fec_16.0=1 +phy_an_fec_17.0=1 +phy_an_fec_18.0=1 +phy_an_fec_19.0=1 +phy_an_fec_20.0=1 +phy_an_fec_21.0=1 +phy_an_fec_22.0=1 +phy_an_fec_23.0=1 +phy_an_fec_24.0=1 +phy_an_fec_25.0=1 +phy_an_fec_26.0=1 +phy_an_fec_27.0=1 +phy_an_fec_28.0=1 +phy_an_fec_29.0=1 +phy_an_fec_30.0=1 +phy_an_fec_31.0=1 +phy_an_fec_32.0=1 +phy_an_fec_34.0=1 +phy_an_fec_38.0=1 +phy_an_fec_39.0=1 +phy_an_fec_40.0=1 +phy_an_fec_41.0=1 +phy_an_fec_42.0=1 +phy_an_fec_43.0=1 +phy_an_fec_44.0=1 +phy_an_fec_45.0=1 +phy_an_fec_46.0=1 +phy_an_fec_47.0=1 +phy_an_fec_48.0=1 +phy_an_fec_49.0=1 +phy_an_fec_50.0=1 +phy_an_fec_51.0=1 +phy_an_fec_52.0=1 +phy_an_fec_53.0=1 +phy_an_fec_54.0=1 +phy_an_fec_55.0=1 +phy_an_fec_56.0=1 +phy_an_fec_57.0=1 +phy_an_fec_58.0=1 +phy_an_fec_59.0=1 +phy_an_fec_60.0=1 +phy_an_fec_61.0=1 +phy_an_fec_62.0=1 +phy_an_fec_63.0=1 +phy_an_fec_64.0=1 +phy_an_fec_65.0=1 +phy_an_fec_68.0=1 +phy_an_fec_69.0=1 +phy_an_fec_70.0=1 +phy_an_fec_71.0=1 +phy_an_fec_72.0=1 +phy_an_fec_73.0=1 +phy_an_fec_74.0=1 +phy_an_fec_75.0=1 +phy_an_fec_76.0=1 +phy_an_fec_77.0=1 +phy_an_fec_78.0=1 +phy_an_fec_79.0=1 +phy_an_fec_80.0=1 +phy_an_fec_81.0=1 +phy_an_fec_82.0=1 +phy_an_fec_83.0=1 +phy_an_fec_84.0=1 +phy_an_fec_85.0=1 +phy_an_fec_86.0=1 +phy_an_fec_87.0=1 +phy_an_fec_88.0=1 +phy_an_fec_89.0=1 +phy_an_fec_90.0=1 +phy_an_fec_91.0=1 +phy_an_fec_92.0=1 +phy_an_fec_93.0=1 +phy_an_fec_94.0=1 +phy_an_fec_95.0=1 +phy_an_fec_96.0=1 +phy_an_fec_97.0=1 +phy_an_fec_98.0=1 +phy_an_fec_99.0=1 +phy_an_fec_102.0=1 +phy_an_fec_103.0=1 +phy_an_fec_104.0=1 +phy_an_fec_105.0=1 +phy_an_fec_106.0=1 +phy_an_fec_107.0=1 +phy_an_fec_108.0=1 +phy_an_fec_109.0=1 +phy_an_fec_110.0=1 +phy_an_fec_111.0=1 +phy_an_fec_112.0=1 +phy_an_fec_113.0=1 +phy_an_fec_114.0=1 +phy_an_fec_115.0=1 +phy_an_fec_116.0=1 +phy_an_fec_117.0=1 +phy_an_fec_118.0=1 +phy_an_fec_119.0=1 +phy_an_fec_120.0=1 +phy_an_fec_121.0=1 +phy_an_fec_122.0=1 +phy_an_fec_123.0=1 +phy_an_fec_124.0=1 +phy_an_fec_125.0=1 +phy_an_fec_126.0=1 +phy_an_fec_127.0=1 +phy_an_fec_128.0=1 +phy_an_fec_129.0=1 +phy_an_fec_130.0=1 +phy_an_fec_131.0=1 +phy_an_fec_132.0=1 +phy_an_fec_133.0=1 +phy_xaui_rx_polarity_flip_1.0=0x1 +phy_xaui_rx_polarity_flip_2.0=0x5 +phy_xaui_rx_polarity_flip_3.0=0x1 +phy_xaui_rx_polarity_flip_4.0=0x7 +phy_xaui_rx_polarity_flip_5.0=0xc +phy_xaui_rx_polarity_flip_6.0=0xf +phy_xaui_rx_polarity_flip_7.0=0xc +phy_xaui_rx_polarity_flip_8.0=0xf +phy_xaui_rx_polarity_flip_34.0=0x0 +phy_xaui_rx_polarity_flip_35.0=0x7 +phy_xaui_rx_polarity_flip_36.0=0x4 +phy_xaui_rx_polarity_flip_37.0=0x7 +phy_xaui_rx_polarity_flip_38.0=0x4 +phy_xaui_rx_polarity_flip_39.0=0x6 +phy_xaui_rx_polarity_flip_40.0=0x1 +phy_xaui_rx_polarity_flip_41.0=0x2 +phy_xaui_rx_polarity_flip_68.0=0xd +phy_xaui_rx_polarity_flip_69.0=0x6 +phy_xaui_rx_polarity_flip_70.0=0x1 +phy_xaui_rx_polarity_flip_71.0=0x8 +phy_xaui_rx_polarity_flip_72.0=0x7 +phy_xaui_rx_polarity_flip_73.0=0xc +phy_xaui_rx_polarity_flip_74.0=0x7 +phy_xaui_rx_polarity_flip_75.0=0x8 +phy_xaui_rx_polarity_flip_102.0=0xb +phy_xaui_rx_polarity_flip_103.0=0xc +phy_xaui_rx_polarity_flip_104.0=0x3 +phy_xaui_rx_polarity_flip_105.0=0xc +phy_xaui_rx_polarity_flip_106.0=0xb +phy_xaui_rx_polarity_flip_107.0=0x5 +phy_xaui_rx_polarity_flip_108.0=0x1 +phy_xaui_rx_polarity_flip_109.0=0x9 +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_2.0=0xe +phy_xaui_tx_polarity_flip_3.0=0x2 +phy_xaui_tx_polarity_flip_4.0=0xe +phy_xaui_tx_polarity_flip_5.0=0xc +phy_xaui_tx_polarity_flip_6.0=0xf +phy_xaui_tx_polarity_flip_7.0=0xc +phy_xaui_tx_polarity_flip_8.0=0xf +phy_xaui_tx_polarity_flip_34.0=0x0 +phy_xaui_tx_polarity_flip_35.0=0xe +phy_xaui_tx_polarity_flip_36.0=0x0 +phy_xaui_tx_polarity_flip_37.0=0xe +phy_xaui_tx_polarity_flip_38.0=0xf +phy_xaui_tx_polarity_flip_39.0=0xe +phy_xaui_tx_polarity_flip_40.0=0x6 +phy_xaui_tx_polarity_flip_41.0=0xb +phy_xaui_tx_polarity_flip_68.0=0x9 +phy_xaui_tx_polarity_flip_69.0=0xb +phy_xaui_tx_polarity_flip_70.0=0xd +phy_xaui_tx_polarity_flip_71.0=0x9 +phy_xaui_tx_polarity_flip_72.0=0x6 +phy_xaui_tx_polarity_flip_73.0=0xc +phy_xaui_tx_polarity_flip_74.0=0x9 +phy_xaui_tx_polarity_flip_75.0=0x9 +phy_xaui_tx_polarity_flip_102.0=0x6 +phy_xaui_tx_polarity_flip_103.0=0xb +phy_xaui_tx_polarity_flip_104.0=0x6 +phy_xaui_tx_polarity_flip_105.0=0xb +phy_xaui_tx_polarity_flip_106.0=0x6 +phy_xaui_tx_polarity_flip_107.0=0xf +phy_xaui_tx_polarity_flip_108.0=0x6 +phy_xaui_tx_polarity_flip_109.0=0xc +portmap_1.0=1:40 +portmap_2.0=5:40 +portmap_3.0=9:40 +portmap_4.0=13:40 +portmap_5.0=17:40 +portmap_6.0=21:40 +portmap_7.0=25:40 +portmap_8.0=29:40 +portmap_34.0=33:40 +portmap_35.0=37:40 +portmap_36.0=41:40 +portmap_37.0=45:40 +portmap_38.0=49:40 +portmap_39.0=53:40 +portmap_40.0=57:40 +portmap_41.0=61:40 +portmap_68.0=65:40 +portmap_69.0=69:40 +portmap_70.0=73:40 +portmap_71.0=77:40 +portmap_72.0=81:40 +portmap_73.0=85:40 +portmap_74.0=89:40 +portmap_75.0=93:40 +portmap_102.0=97:40 +portmap_103.0=101:40 +portmap_104.0=105:40 +portmap_105.0=109:40 +portmap_106.0=113:40 +portmap_107.0=117:40 +portmap_108.0=121:40 +portmap_109.0=125:40 +port_phy_addr_1.0=0xff +port_phy_addr_2.0=0xff +port_phy_addr_3.0=0xff +port_phy_addr_4.0=0xff +port_phy_addr_5.0=0xff +port_phy_addr_6.0=0xff +port_phy_addr_7.0=0xff +port_phy_addr_8.0=0xff +port_phy_addr_34.0=0xff +port_phy_addr_35.0=0xff +port_phy_addr_36.0=0xff +port_phy_addr_37.0=0xff +port_phy_addr_38.0=0xff +port_phy_addr_39.0=0xff +port_phy_addr_40.0=0xff +port_phy_addr_41.0=0xff +port_phy_addr_68.0=0xff +port_phy_addr_69.0=0xff +port_phy_addr_70.0=0xff +port_phy_addr_71.0=0xff +port_phy_addr_72.0=0xff +port_phy_addr_73.0=0xff +port_phy_addr_74.0=0xff +port_phy_addr_75.0=0xff +port_phy_addr_102.0=0xff +port_phy_addr_103.0=0xff +port_phy_addr_104.0=0xff +port_phy_addr_105.0=0xff +port_phy_addr_106.0=0xff +port_phy_addr_107.0=0xff +port_phy_addr_108.0=0xff +port_phy_addr_109.0=0xff +xgxs_rx_lane_map_1.0=0x3210 +xgxs_rx_lane_map_2.0=0x3210 +xgxs_rx_lane_map_3.0=0x3210 +xgxs_rx_lane_map_4.0=0x3210 +xgxs_rx_lane_map_5.0=0x0123 +xgxs_rx_lane_map_6.0=0x2301 +xgxs_rx_lane_map_7.0=0x0123 +xgxs_rx_lane_map_8.0=0x2301 +xgxs_rx_lane_map_34.0=0x0123 +xgxs_rx_lane_map_35.0=0x0321 +xgxs_rx_lane_map_36.0=0x0321 +xgxs_rx_lane_map_37.0=0x0321 +xgxs_rx_lane_map_38.0=0x1230 +xgxs_rx_lane_map_39.0=0x2301 +xgxs_rx_lane_map_40.0=0x1230 +xgxs_rx_lane_map_41.0=0x2103 +xgxs_rx_lane_map_68.0=0x1230 +xgxs_rx_lane_map_69.0=0x2301 +xgxs_rx_lane_map_70.0=0x1230 +xgxs_rx_lane_map_71.0=0x2103 +xgxs_rx_lane_map_72.0=0x1230 +xgxs_rx_lane_map_73.0=0x2301 +xgxs_rx_lane_map_74.0=0x1230 +xgxs_rx_lane_map_75.0=0x2103 +xgxs_rx_lane_map_102.0=0x3210 +xgxs_rx_lane_map_103.0=0x3210 +xgxs_rx_lane_map_104.0=0x3210 +xgxs_rx_lane_map_105.0=0x3210 +xgxs_rx_lane_map_106.0=0x3210 +xgxs_rx_lane_map_107.0=0x3210 +xgxs_rx_lane_map_108.0=0x3210 +xgxs_rx_lane_map_109.0=0x3210 +xgxs_tx_lane_map_1.0=0x0321 +xgxs_tx_lane_map_2.0=0x2301 +xgxs_tx_lane_map_3.0=0x0321 +xgxs_tx_lane_map_4.0=0x2301 +xgxs_tx_lane_map_5.0=0x0123 +xgxs_tx_lane_map_6.0=0x0123 +xgxs_tx_lane_map_7.0=0x0123 +xgxs_tx_lane_map_8.0=0x0123 +xgxs_tx_lane_map_34.0=0x2301 +xgxs_tx_lane_map_35.0=0x0321 +xgxs_tx_lane_map_36.0=0x2301 +xgxs_tx_lane_map_37.0=0x0321 +xgxs_tx_lane_map_38.0=0x0123 +xgxs_tx_lane_map_39.0=0x1230 +xgxs_tx_lane_map_40.0=0x2301 +xgxs_tx_lane_map_41.0=0x1032 +xgxs_tx_lane_map_68.0=0x0123 +xgxs_tx_lane_map_69.0=0x1230 +xgxs_tx_lane_map_70.0=0x2301 +xgxs_tx_lane_map_71.0=0x1032 +xgxs_tx_lane_map_72.0=0x0123 +xgxs_tx_lane_map_73.0=0x1230 +xgxs_tx_lane_map_74.0=0x2301 +xgxs_tx_lane_map_75.0=0x1032 +xgxs_tx_lane_map_102.0=0x0321 +xgxs_tx_lane_map_103.0=0x2301 +xgxs_tx_lane_map_104.0=0x0321 +xgxs_tx_lane_map_105.0=0x2301 +xgxs_tx_lane_map_106.0=0x0321 +xgxs_tx_lane_map_107.0=0x2301 +xgxs_tx_lane_map_108.0=0x0321 +xgxs_tx_lane_map_109.0=0x2301 +serdes_driver_current_1=0x4 +serdes_preemphasis_1=0x145c00 +serdes_driver_current_2=0x4 +serdes_preemphasis_2=0x145c00 +serdes_driver_current_3=0x8 +serdes_preemphasis_3=0x185800 +serdes_driver_current_4=0x8 +serdes_preemphasis_4=0x185800 +serdes_driver_current_5=0x8 +serdes_preemphasis_5=0x185800 +serdes_driver_current_6=0x8 +serdes_preemphasis_6=0x185800 +serdes_driver_current_7=0xf +serdes_preemphasis_7=0x205000 +serdes_driver_current_8=0xf +serdes_preemphasis_8=0x205000 +serdes_driver_current_34=0xf +serdes_preemphasis_34=0x205000 +serdes_driver_current_35=0xf +serdes_preemphasis_35=0x205000 +serdes_driver_current_36=0xf +serdes_preemphasis_36=0x205000 +serdes_driver_current_37=0xf +serdes_preemphasis_37=0x205000 +serdes_driver_current_38=0x8 +serdes_preemphasis_38=0x185800 +serdes_driver_current_39=0x8 +serdes_preemphasis_39=0x185800 +serdes_driver_current_40=0x8 +serdes_preemphasis_40=0x185800 +serdes_driver_current_41=0x8 +serdes_preemphasis_41=0x185800 +serdes_driver_current_68=0x4 +serdes_preemphasis_68=0x145c00 +serdes_driver_current_69=0x4 +serdes_preemphasis_69=0x145c00 +serdes_driver_current_70=0x4 +serdes_preemphasis_70=0x145c00 +serdes_driver_current_71=0x4 +serdes_preemphasis_71=0x145c00 +serdes_driver_current_72=0x4 +serdes_preemphasis_72=0x145c00 +serdes_driver_current_73=0x4 +serdes_preemphasis_73=0x145c00 +serdes_driver_current_74=0x4 +serdes_preemphasis_74=0x145c00 +serdes_driver_current_75=0x4 +serdes_preemphasis_75=0x145c00 +serdes_driver_current_102=0x4 +serdes_preemphasis_102=0x145c00 +serdes_driver_current_103=0x4 +serdes_preemphasis_103=0x145c00 +serdes_driver_current_104=0x4 +serdes_preemphasis_104=0x145c00 +serdes_driver_current_105=0x4 +serdes_preemphasis_105=0x145c00 +serdes_driver_current_106=0x4 +serdes_preemphasis_106=0x145c00 +serdes_driver_current_107=0x4 +serdes_preemphasis_107=0x145c00 +serdes_driver_current_108=0x4 +serdes_preemphasis_108=0x145c00 +serdes_driver_current_109=0x4 +serdes_preemphasis_109=0x145c00 + +mmu_init_config="MSFT-TH-Tier1" From ff237aaf180981bf9b9d13d6bc180767a84fc6a5 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 29 Jun 2018 08:37:20 -0700 Subject: [PATCH 1387/1833] [syncd] Treat bcmcmd as a supervisor task so we could collect stdout/stderr (#1825) --- platform/broadcom/docker-syncd-brcm/start.sh | 3 ++- platform/broadcom/docker-syncd-brcm/supervisord.conf | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index d2180bce1ed7..4f027256a022 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -18,6 +18,7 @@ else fi fi +rm -f /var/run/sswsyncd/sswsyncd.socket supervisorctl start syncd # Function: wait until syncd has created the socket for bcmcmd to connect to @@ -33,5 +34,5 @@ wait_syncd() { # If this platform has an initialization file for the Broadcom LED microprocessor, load it if [ -r ${PLATFORM_DIR}/led_proc_init.soc ]; then wait_syncd - /usr/bin/bcmcmd -t 60 "rcload ${PLATFORM_DIR}/led_proc_init.soc" + supervisorctl start ledinit fi diff --git a/platform/broadcom/docker-syncd-brcm/supervisord.conf b/platform/broadcom/docker-syncd-brcm/supervisord.conf index 1af5d70a1d0c..fe590ede18c5 100644 --- a/platform/broadcom/docker-syncd-brcm/supervisord.conf +++ b/platform/broadcom/docker-syncd-brcm/supervisord.conf @@ -26,3 +26,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:ledinit] +command=/usr/bin/bcmcmd -t 60 "rcload /usr/share/sonic/platform/led_proc_init.soc" +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog From 5ad7d24d168dfe12d55a14e1d3280217c3fd9b43 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 29 Jun 2018 08:39:12 -0700 Subject: [PATCH 1388/1833] [mgmt] Fix pycparser installation (#1820) --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index 9396c7e56c0c..cd2fd5ff37dd 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -30,6 +30,8 @@ RUN apt-get install -y rsyslog psmisc # Remove cffi 1.5.2, will install 1.10.0 by pip later RUN apt-get remove -y python-cffi python-cffi-backend +# Remove pycparser 2.14, will install >=2.17 by pip later +RUN apt-get remove -y python-ply python-pycparser RUN easy_install pip From 043435958cb5e23fc6b59c33e9adf45a824b563e Mon Sep 17 00:00:00 2001 From: Polly Hsu Date: Sat, 30 Jun 2018 00:40:43 +0800 Subject: [PATCH 1389/1833] [device]: Add a new supported device AS7312-54XS (#1821) * Switch Vendor: Edge-core * Switch SKU: AS7312-54XS * ASIC Vendor: Broadcom * Swich ASIC: Tomahawk+ * Port Configuration: 48x25G + 6x100G * SONiC Image: SONiC-ONIE-Broadcom Signed-off-by: polly_hsu@edge-core.com --- .../Accton-AS7312-54XS/port_config.ini | 55 + .../Accton-AS7312-54XS/sai.profile | 1 + .../th-as7312-48x25G+6x100G.config.bcm | 519 ++++++++ .../installer.conf | 3 + .../led_proc_init.soc | 79 ++ .../minigraph.xml | 1184 +++++++++++++++++ .../plugins/eeprom.py | 24 + .../plugins/psuutil.py | 61 + .../plugins/sfputil.py | 215 +++ 9 files changed, 2141 insertions(+) create mode 100755 device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/port_config.ini create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/sai.profile create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/th-as7312-48x25G+6x100G.config.bcm create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/installer.conf create mode 100755 device/accton/x86_64-accton_as7312_54xs-r0/led_proc_init.soc create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/plugins/eeprom.py create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/plugins/psuutil.py create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/port_config.ini b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/port_config.ini new file mode 100755 index 000000000000..18b0ed20d305 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/port_config.ini @@ -0,0 +1,55 @@ +# name lanes alias index +Ethernet0 41 twentyfiveGigE1 0 +Ethernet1 42 twentyfiveGigE2 1 +Ethernet2 43 twentyfiveGigE3 2 +Ethernet3 44 twentyfiveGigE4 3 +Ethernet4 49 twentyfiveGigE5 4 +Ethernet5 50 twentyfiveGigE6 5 +Ethernet6 51 twentyfiveGigE7 6 +Ethernet7 52 twentyfiveGigE8 7 +Ethernet8 53 twentyfiveGigE9 8 +Ethernet9 54 twentyfiveGigE10 9 +Ethernet10 55 twentyfiveGigE11 10 +Ethernet11 56 twentyfiveGigE12 11 +Ethernet12 65 twentyfiveGigE13 12 +Ethernet13 66 twentyfiveGigE14 13 +Ethernet14 67 twentyfiveGigE15 14 +Ethernet15 68 twentyfiveGigE16 15 +Ethernet16 33 twentyfiveGigE17 16 +Ethernet17 34 twentyfiveGigE18 17 +Ethernet18 35 twentyfiveGigE19 18 +Ethernet19 36 twentyfiveGigE20 19 +Ethernet20 37 twentyfiveGigE21 20 +Ethernet21 38 twentyfiveGigE22 21 +Ethernet22 39 twentyfiveGigE23 22 +Ethernet23 40 twentyfiveGigE24 23 +Ethernet24 69 twentyfiveGigE25 24 +Ethernet25 70 twentyfiveGigE26 25 +Ethernet26 71 twentyfiveGigE27 26 +Ethernet27 72 twentyfiveGigE28 27 +Ethernet28 81 twentyfiveGigE29 28 +Ethernet29 82 twentyfiveGigE30 29 +Ethernet30 83 twentyfiveGigE31 30 +Ethernet31 84 twentyfiveGigE32 31 +Ethernet32 85 twentyfiveGigE33 32 +Ethernet33 86 twentyfiveGigE34 33 +Ethernet34 87 twentyfiveGigE35 34 +Ethernet35 88 twentyfiveGigE36 35 +Ethernet36 97 twentyfiveGigE37 36 +Ethernet37 98 twentyfiveGigE38 37 +Ethernet38 99 twentyfiveGigE39 38 +Ethernet39 100 twentyfiveGigE40 39 +Ethernet40 101 twentyfiveGigE41 40 +Ethernet41 102 twentyfiveGigE42 41 +Ethernet42 103 twentyfiveGigE43 42 +Ethernet43 104 twentyfiveGigE44 43 +Ethernet44 105 twentyfiveGigE45 44 +Ethernet45 106 twentyfiveGigE46 45 +Ethernet46 107 twentyfiveGigE47 46 +Ethernet47 108 twentyfiveGigE48 47 +Ethernet48 5,6,7,8 hundredGigE49 48 +Ethernet52 1,2,3,4 hundredGigE50 52 +Ethernet56 109,110,111,112 hundredGigE51 56 +Ethernet60 21,22,23,24 hundredGigE52 60 +Ethernet64 9,10,11,12 hundredGigE53 64 +Ethernet68 117,118,119,120 hundredGigE54 68 diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/sai.profile b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/sai.profile new file mode 100644 index 000000000000..31aefe2c2905 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-as7312-48x25G+6x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/th-as7312-48x25G+6x100G.config.bcm b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/th-as7312-48x25G+6x100G.config.bcm new file mode 100644 index 000000000000..eef4d987e8ed --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/Accton-AS7312-54XS/th-as7312-48x25G+6x100G.config.bcm @@ -0,0 +1,519 @@ +# accton_as7312_54x 48x25G+6x100G SDK config +os=unix +schan_intr_enable=0 + +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 +mmu_lossless=1 + +pbmp_oversubscribe=0x0407ffc00ff00ff003fc3ffc00200222 +pbmp_xport_xe=0x0407ffd00ff00ff403fc3ffc00200222 + +## FC10 ## +dport_map_port_42=1 +dport_map_port_43=2 +dport_map_port_44=3 +dport_map_port_45=4 + +## FC12 ## +dport_map_port_50=5 +dport_map_port_51=6 +dport_map_port_52=7 +dport_map_port_53=8 + +## FC13 ## +dport_map_port_54=9 +dport_map_port_55=10 +dport_map_port_56=11 +dport_map_port_57=12 + +## FC16 ## +dport_map_port_68=13 +dport_map_port_69=14 +dport_map_port_70=15 +dport_map_port_71=16 + +## FC8 ## +dport_map_port_34=17 +dport_map_port_35=18 +dport_map_port_36=19 +dport_map_port_37=20 + +## FC9 ## +dport_map_port_38=21 +dport_map_port_39=22 +dport_map_port_40=23 +dport_map_port_41=24 + +## FC17 ## +dport_map_port_72=25 +dport_map_port_73=26 +dport_map_port_74=27 +dport_map_port_75=28 + +## FC20 ## +dport_map_port_84=29 +dport_map_port_85=30 +dport_map_port_86=31 +dport_map_port_87=32 + +## FC21 ## +dport_map_port_88=33 +dport_map_port_89=34 +dport_map_port_90=35 +dport_map_port_91=36 + +## FC24 ## +dport_map_port_102=37 +dport_map_port_103=38 +dport_map_port_104=39 +dport_map_port_105=40 + +## FC25 ## +dport_map_port_106=41 +dport_map_port_107=42 +dport_map_port_108=43 +dport_map_port_109=44 + +## FC26 ## +dport_map_port_110=45 +dport_map_port_111=46 +dport_map_port_112=47 +dport_map_port_113=48 + +## FC1 ## +dport_map_port_5=49 + +## FC0 ## +dport_map_port_1=50 + +## FC27 ## +dport_map_port_114=51 + +## FC5 ## +dport_map_port_21=52 + +## FC2 ## +dport_map_port_9=53 + +## FC29 ## +dport_map_port_122=54 + +#for KR +#dport_map_port_66=55 +#dport_map_port_100=56 + +/* Port Map */ +## FC10 ## +portmap_42=41:25 +portmap_43=42:25 +portmap_44=43:25 +portmap_45=44:25 + +## FC12 ## +portmap_50=49:25 +portmap_51=50:25 +portmap_52=51:25 +portmap_53=52:25 + + +## FC13 ## +portmap_54=53:25 +portmap_55=54:25 +portmap_56=55:25 +portmap_57=56:25 + +## FC16 ## +portmap_68=65:25 +portmap_69=66:25 +portmap_70=67:25 +portmap_71=68:25 + + +## FC8 ## +portmap_34=33:25 +portmap_35=34:25 +portmap_36=35:25 +portmap_37=36:25 + +## FC9 ## +portmap_38=37:25 +portmap_39=38:25 +portmap_40=39:25 +portmap_41=40:25 + +## FC17 ## +portmap_72=69:25 +portmap_73=70:25 +portmap_74=71:25 +portmap_75=72:25 + +## FC20 ## +portmap_84=81:25 +portmap_85=82:25 +portmap_86=83:25 +portmap_87=84:25 + + +## FC21 ## +portmap_88=85:25 +portmap_89=86:25 +portmap_90=87:25 +portmap_91=88:25 + +## FC24 ## +portmap_102=97:25 +portmap_103=98:25 +portmap_104=99:25 +portmap_105=100:25 + +## FC25 ## +portmap_106=101:25 +portmap_107=102:25 +portmap_108=103:25 +portmap_109=104:25 + +## FC26 ## +portmap_110=105:25 +portmap_111=106:25 +portmap_112=107:25 +portmap_113=108:25 + +## FC1 ## +portmap_5=5:100 + +## FC0 ## +portmap_1=1:100 + +## FC27 ## +portmap_114=109:100 + +## FC5 ## +portmap_21=21:100 + +## FC2 ## +portmap_9=9:100 + +## FC29 ## +portmap_122=117:100 + +# CPU to MAC +# TSC-E management port 1 +#portmap_66=129:10 +# TSC-E management port 2 +#portmap_100=131:10 + +xgxs_rx_lane_map_42=0x2310 +xgxs_rx_lane_map_43=0x2310 +xgxs_rx_lane_map_44=0x2310 +xgxs_rx_lane_map_45=0x2310 +xgxs_rx_lane_map_50=0x3210 +xgxs_rx_lane_map_51=0x3210 +xgxs_rx_lane_map_52=0x3210 +xgxs_rx_lane_map_53=0x3210 +xgxs_rx_lane_map_54=0x3210 +xgxs_rx_lane_map_55=0x3210 +xgxs_rx_lane_map_56=0x3210 +xgxs_rx_lane_map_57=0x3210 +xgxs_rx_lane_map_68=0x0123 +xgxs_rx_lane_map_69=0x0123 +xgxs_rx_lane_map_70=0x0123 +xgxs_rx_lane_map_71=0x0123 +xgxs_rx_lane_map_34=0x0123 +xgxs_rx_lane_map_35=0x0123 +xgxs_rx_lane_map_36=0x0123 +xgxs_rx_lane_map_37=0x0123 +xgxs_rx_lane_map_38=0x0123 +xgxs_rx_lane_map_39=0x0123 +xgxs_rx_lane_map_40=0x0123 +xgxs_rx_lane_map_41=0x0123 +xgxs_rx_lane_map_72=0x3210 +xgxs_rx_lane_map_73=0x3210 +xgxs_rx_lane_map_74=0x3210 +xgxs_rx_lane_map_75=0x3210 +xgxs_rx_lane_map_84=0x1032 +xgxs_rx_lane_map_85=0x1032 +xgxs_rx_lane_map_86=0x1032 +xgxs_rx_lane_map_87=0x1032 +xgxs_rx_lane_map_88=0x2301 +xgxs_rx_lane_map_89=0x2301 +xgxs_rx_lane_map_90=0x2301 +xgxs_rx_lane_map_91=0x2301 +xgxs_rx_lane_map_102=0x0123 +xgxs_rx_lane_map_103=0x0123 +xgxs_rx_lane_map_104=0x0123 +xgxs_rx_lane_map_105=0x0123 +xgxs_rx_lane_map_106=0x3210 +xgxs_rx_lane_map_107=0x3210 +xgxs_rx_lane_map_108=0x3210 +xgxs_rx_lane_map_109=0x3210 +xgxs_rx_lane_map_110=0x1032 +xgxs_rx_lane_map_111=0x1032 +xgxs_rx_lane_map_112=0x1032 +xgxs_rx_lane_map_113=0x1032 +xgxs_rx_lane_map_5=0x3210 +xgxs_rx_lane_map_1=0x3210 +xgxs_rx_lane_map_114=0x0123 +xgxs_rx_lane_map_21=0x0213 +xgxs_rx_lane_map_9=0x3210 +xgxs_rx_lane_map_122=0x1230 + +xgxs_tx_lane_map_42=0x0132 +xgxs_tx_lane_map_43=0x0132 +xgxs_tx_lane_map_44=0x0132 +xgxs_tx_lane_map_45=0x0132 +xgxs_tx_lane_map_50=0x3210 +xgxs_tx_lane_map_51=0x3210 +xgxs_tx_lane_map_52=0x3210 +xgxs_tx_lane_map_53=0x3210 +xgxs_tx_lane_map_54=0x3210 +xgxs_tx_lane_map_55=0x3210 +xgxs_tx_lane_map_56=0x3210 +xgxs_tx_lane_map_57=0x3210 +xgxs_tx_lane_map_68=0x0123 +xgxs_tx_lane_map_69=0x0123 +xgxs_tx_lane_map_70=0x0123 +xgxs_tx_lane_map_71=0x0123 +xgxs_tx_lane_map_34=0x0123 +xgxs_tx_lane_map_35=0x0123 +xgxs_tx_lane_map_36=0x0123 +xgxs_tx_lane_map_37=0x0123 +xgxs_tx_lane_map_38=0x0123 +xgxs_tx_lane_map_39=0x0123 +xgxs_tx_lane_map_40=0x0123 +xgxs_tx_lane_map_41=0x0123 +xgxs_tx_lane_map_72=0x0123 +xgxs_tx_lane_map_73=0x0123 +xgxs_tx_lane_map_74=0x0123 +xgxs_tx_lane_map_75=0x0123 +xgxs_tx_lane_map_84=0x0123 +xgxs_tx_lane_map_85=0x0123 +xgxs_tx_lane_map_86=0x0123 +xgxs_tx_lane_map_87=0x0123 +xgxs_tx_lane_map_88=0x2301 +xgxs_tx_lane_map_89=0x2301 +xgxs_tx_lane_map_90=0x2301 +xgxs_tx_lane_map_91=0x2301 +xgxs_tx_lane_map_102=0x0123 +xgxs_tx_lane_map_103=0x0123 +xgxs_tx_lane_map_104=0x0123 +xgxs_tx_lane_map_105=0x0123 +xgxs_tx_lane_map_106=0x3210 +xgxs_tx_lane_map_107=0x3210 +xgxs_tx_lane_map_108=0x3210 +xgxs_tx_lane_map_109=0x3210 +xgxs_tx_lane_map_110=0x1032 +xgxs_tx_lane_map_111=0x1032 +xgxs_tx_lane_map_112=0x1032 +xgxs_tx_lane_map_113=0x1032 +xgxs_tx_lane_map_5=0x3210 +xgxs_tx_lane_map_1=0x3210 +xgxs_tx_lane_map_114=0x0123 +xgxs_tx_lane_map_21=0x3210 +xgxs_tx_lane_map_9=0x3210 +xgxs_tx_lane_map_122=0x3210 + +#Polarity RX +phy_xaui_rx_polarity_flip_34=0x1 +phy_xaui_rx_polarity_flip_35=0x1 +phy_xaui_rx_polarity_flip_36=0x1 +phy_xaui_rx_polarity_flip_37=0x1 +phy_xaui_rx_polarity_flip_38=0x1 +phy_xaui_rx_polarity_flip_39=0x1 +phy_xaui_rx_polarity_flip_40=0x1 +phy_xaui_rx_polarity_flip_41=0x1 +phy_xaui_rx_polarity_flip_84=0x1 +phy_xaui_rx_polarity_flip_85=0x0 +phy_xaui_rx_polarity_flip_86=0x1 +phy_xaui_rx_polarity_flip_87=0x0 +phy_xaui_rx_polarity_flip_88=0x1 +phy_xaui_rx_polarity_flip_89=0x0 +phy_xaui_rx_polarity_flip_90=0x1 +phy_xaui_rx_polarity_flip_91=0x1 +phy_xaui_rx_polarity_flip_102=0x0 +phy_xaui_rx_polarity_flip_103=0x0 +phy_xaui_rx_polarity_flip_104=0x1 +phy_xaui_rx_polarity_flip_105=0x0 +phy_xaui_rx_polarity_flip_122=0xf +#Polarity TX +phy_xaui_tx_polarity_flip_42=0x1 +phy_xaui_tx_polarity_flip_43=0x1 +phy_xaui_tx_polarity_flip_44=0x1 +phy_xaui_tx_polarity_flip_45=0x1 +phy_xaui_tx_polarity_flip_34=0x1 +phy_xaui_tx_polarity_flip_35=0x1 +phy_xaui_tx_polarity_flip_36=0x1 +phy_xaui_tx_polarity_flip_37=0x1 +phy_xaui_tx_polarity_flip_38=0x0 +phy_xaui_tx_polarity_flip_39=0x1 +phy_xaui_tx_polarity_flip_40=0x0 +phy_xaui_tx_polarity_flip_41=0x1 +phy_xaui_tx_polarity_flip_72=0x1 +phy_xaui_tx_polarity_flip_73=0x1 +phy_xaui_tx_polarity_flip_74=0x1 +phy_xaui_tx_polarity_flip_75=0x1 +phy_xaui_tx_polarity_flip_84=0x1 +phy_xaui_tx_polarity_flip_85=0x1 +phy_xaui_tx_polarity_flip_86=0x1 +phy_xaui_tx_polarity_flip_87=0x1 +phy_xaui_tx_polarity_flip_88=0x1 +phy_xaui_tx_polarity_flip_89=0x1 +phy_xaui_tx_polarity_flip_90=0x1 +phy_xaui_tx_polarity_flip_91=0x1 +phy_xaui_tx_polarity_flip_102=0x1 +phy_xaui_tx_polarity_flip_103=0x1 +phy_xaui_tx_polarity_flip_104=0x1 +phy_xaui_tx_polarity_flip_105=0x1 +phy_xaui_tx_polarity_flip_122=0xb + +#Driver Current +serdes_driver_current_42=0x8 +serdes_driver_current_43=0x8 +serdes_driver_current_44=0x8 +serdes_driver_current_45=0x8 +serdes_driver_current_50=0x8 +serdes_driver_current_51=0x8 +serdes_driver_current_52=0x8 +serdes_driver_current_53=0x8 +serdes_driver_current_54=0x8 +serdes_driver_current_55=0x8 +serdes_driver_current_56=0x8 +serdes_driver_current_57=0x8 +serdes_driver_current_68=0x8 +serdes_driver_current_69=0x8 +serdes_driver_current_70=0x8 +serdes_driver_current_71=0x8 +serdes_driver_current_34=0x8 +serdes_driver_current_35=0x8 +serdes_driver_current_36=0x8 +serdes_driver_current_37=0x8 +serdes_driver_current_38=0x8 +serdes_driver_current_39=0x8 +serdes_driver_current_40=0x8 +serdes_driver_current_41=0x8 +serdes_driver_current_72=0x8 +serdes_driver_current_73=0x8 +serdes_driver_current_74=0x8 +serdes_driver_current_75=0x8 +serdes_driver_current_84=0x8 +serdes_driver_current_85=0x8 +serdes_driver_current_86=0x8 +serdes_driver_current_87=0x8 +serdes_driver_current_88=0x8 +serdes_driver_current_89=0x8 +serdes_driver_current_90=0x8 +serdes_driver_current_91=0x8 +serdes_driver_current_102=0x8 +serdes_driver_current_103=0x8 +serdes_driver_current_104=0x8 +serdes_driver_current_105=0x8 +serdes_driver_current_106=0x8 +serdes_driver_current_107=0x8 +serdes_driver_current_108=0x8 +serdes_driver_current_109=0x8 +serdes_driver_current_110=0x8 +serdes_driver_current_111=0x8 +serdes_driver_current_112=0x8 +serdes_driver_current_113=0x8 +serdes_driver_current_lane0_5=0x8 +serdes_driver_current_lane1_5=0x8 +serdes_driver_current_lane2_5=0x8 +serdes_driver_current_lane3_5=0x8 +serdes_driver_current_lane0_1=0x8 +serdes_driver_current_lane1_1=0x8 +serdes_driver_current_lane2_1=0x8 +serdes_driver_current_lane3_1=0x8 +serdes_driver_current_lane0_114=0x8 +serdes_driver_current_lane1_114=0x8 +serdes_driver_current_lane2_114=0x8 +serdes_driver_current_lane3_114=0x8 +serdes_driver_current_lane0_21=0x8 +serdes_driver_current_lane1_21=0x8 +serdes_driver_current_lane2_21=0x8 +serdes_driver_current_lane3_21=0x8 +serdes_driver_current_lane0_9=0x8 +serdes_driver_current_lane1_9=0x8 +serdes_driver_current_lane2_9=0x8 +serdes_driver_current_lane3_9=0x8 +serdes_driver_current_lane0_122=0x8 +serdes_driver_current_lane1_122=0x8 +serdes_driver_current_lane2_122=0x8 +serdes_driver_current_lane3_122=0x8 + +#Preemphasis +serdes_preemphasis_42=0x264006 +serdes_preemphasis_43=0x264006 +serdes_preemphasis_44=0x254106 +serdes_preemphasis_45=0x254106 +serdes_preemphasis_50=0x254106 +serdes_preemphasis_51=0x254106 +serdes_preemphasis_52=0x254106 +serdes_preemphasis_53=0x254106 +serdes_preemphasis_54=0x254106 +serdes_preemphasis_55=0x254106 +serdes_preemphasis_56=0x254106 +serdes_preemphasis_57=0x234306 +serdes_preemphasis_68=0x234306 +serdes_preemphasis_69=0x204606 +serdes_preemphasis_70=0x204606 +serdes_preemphasis_71=0x204606 +serdes_preemphasis_34=0x234306 +serdes_preemphasis_35=0x234306 +serdes_preemphasis_36=0x234306 +serdes_preemphasis_37=0x234306 +serdes_preemphasis_38=0x234306 +serdes_preemphasis_39=0x234306 +serdes_preemphasis_40=0x234306 +serdes_preemphasis_41=0x234306 +serdes_preemphasis_72=0x1e4806 +serdes_preemphasis_73=0x1e4806 +serdes_preemphasis_74=0x1e4806 +serdes_preemphasis_75=0x1e4806 +serdes_preemphasis_84=0x1e4806 +serdes_preemphasis_85=0x1a4c06 +serdes_preemphasis_86=0x1a4c06 +serdes_preemphasis_87=0x1b4b06 +serdes_preemphasis_88=0x1b4b06 +serdes_preemphasis_89=0x1e4806 +serdes_preemphasis_90=0x1e4806 +serdes_preemphasis_91=0x1e4806 +serdes_preemphasis_102=0x1e4806 +serdes_preemphasis_103=0x1e4806 +serdes_preemphasis_104=0x1e4806 +serdes_preemphasis_105=0x1e4806 +serdes_preemphasis_106=0x1e4806 +serdes_preemphasis_107=0x1e4806 +serdes_preemphasis_108=0x1e4806 +serdes_preemphasis_109=0x1e4806 +serdes_preemphasis_110=0x1e4806 +serdes_preemphasis_111=0x1d4906 +serdes_preemphasis_112=0x234306 +serdes_preemphasis_113=0x1f4706 +serdes_preemphasis_lane0_5=0x294106 +serdes_preemphasis_lane1_5=0x294106 +serdes_preemphasis_lane2_5=0x294106 +serdes_preemphasis_lane3_5=0x294106 +serdes_preemphasis_lane0_1=0x294106 +serdes_preemphasis_lane1_1=0x294106 +serdes_preemphasis_lane2_1=0x294106 +serdes_preemphasis_lane3_1=0x294106 +serdes_preemphasis_lane0_114=0x2a4006 +serdes_preemphasis_lane1_114=0x2a4006 +serdes_preemphasis_lane2_114=0x2a4006 +serdes_preemphasis_lane3_114=0x2a4006 +serdes_preemphasis_lane0_21=0x2c3c08 +serdes_preemphasis_lane1_21=0x2a4006 +serdes_preemphasis_lane2_21=0x2a4006 +serdes_preemphasis_lane3_21=0x2a4006 +serdes_preemphasis_lane0_9=0x284206 +serdes_preemphasis_lane1_9=0x284206 +serdes_preemphasis_lane2_9=0x284206 +serdes_preemphasis_lane3_9=0x284206 +serdes_preemphasis_lane0_122=0x283e06 +serdes_preemphasis_lane1_122=0x283e06 +serdes_preemphasis_lane2_122=0x283e06 +serdes_preemphasis_lane3_122=0x294601 diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/installer.conf b/device/accton/x86_64-accton_as7312_54xs-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7312_54xs-r0/led_proc_init.soc new file mode 100755 index 000000000000..3074649497e0 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/led_proc_init.soc @@ -0,0 +1,79 @@ +# accton_as7312_54x 48x25G+6x100G SDK port LED macro init SOC +s CMIC_LEDUP0_DATA_RAM 0 +s CMIC_LEDUP1_DATA_RAM 0 + +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=63 REMAP_PORT_1=63 REMAP_PORT_2=63 REMAP_PORT_3=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=63 REMAP_PORT_5=63 REMAP_PORT_6=63 REMAP_PORT_7=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=27 REMAP_PORT_9=26 REMAP_PORT_10=25 REMAP_PORT_11=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=63 REMAP_PORT_17=63 REMAP_PORT_18=63 REMAP_PORT_19=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=31 REMAP_PORT_21=30 REMAP_PORT_22=29 REMAP_PORT_23=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=15 REMAP_PORT_25=14 REMAP_PORT_26=13 REMAP_PORT_27=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=19 REMAP_PORT_29=18 REMAP_PORT_30=17 REMAP_PORT_31=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 REMAP_PORT_33=63 REMAP_PORT_34=63 REMAP_PORT_35=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=63 REMAP_PORT_37=63 REMAP_PORT_38=63 REMAP_PORT_39=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=35 REMAP_PORT_41=34 REMAP_PORT_42=33 REMAP_PORT_43=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 REMAP_PORT_45=63 REMAP_PORT_46=63 REMAP_PORT_47=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=23 REMAP_PORT_49=22 REMAP_PORT_50=21 REMAP_PORT_51=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=19 REMAP_PORT_1=18 REMAP_PORT_2=17 REMAP_PORT_3=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=23 REMAP_PORT_5=22 REMAP_PORT_6=21 REMAP_PORT_7=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=3 REMAP_PORT_9=2 REMAP_PORT_10=1 REMAP_PORT_11=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=63 REMAP_PORT_13=63 REMAP_PORT_14=63 REMAP_PORT_15=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=7 REMAP_PORT_17=6 REMAP_PORT_18=5 REMAP_PORT_19=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 REMAP_PORT_21=10 REMAP_PORT_22=9 REMAP_PORT_23=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=63 REMAP_PORT_25=63 REMAP_PORT_26=63 REMAP_PORT_27=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=63 REMAP_PORT_29=63 REMAP_PORT_30=63 REMAP_PORT_31=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=15 REMAP_PORT_33=14 REMAP_PORT_34=13 REMAP_PORT_35=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=27 REMAP_PORT_37=26 REMAP_PORT_38=25 REMAP_PORT_39=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=63 REMAP_PORT_41=63 REMAP_PORT_42=63 REMAP_PORT_43=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=63 REMAP_PORT_45=63 REMAP_PORT_46=63 REMAP_PORT_47=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=31 REMAP_PORT_49=30 REMAP_PORT_50=29 REMAP_PORT_51=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=35 REMAP_PORT_53=34 REMAP_PORT_54=33 REMAP_PORT_55=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=63 REMAP_PORT_57=63 REMAP_PORT_58=63 REMAP_PORT_59=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=63 REMAP_PORT_62=63 REMAP_PORT_63=63 + +led 0 stop +led 0 prog \ + 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 7E \ + 02 FB 42 24 06 F9 D2 00 74 1E 02 F9 42 03 67 AC \ + 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 \ + 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC \ + 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 \ + 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 \ + 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 \ + F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 \ + 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF \ + 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 \ + 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC \ + 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 \ + 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 \ + 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 98 67 \ + 84 57 80 18 71 EB 67 84 67 98 57 67 84 67 84 57 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 start +led auto on + +led 1 stop +led 1 prog \ + 02 FD 42 80 02 FF 42 00 02 FE 42 00 02 FA 42 7E \ + 02 FB 42 24 06 F9 D2 00 74 1E 02 F9 42 03 67 AC \ + 67 C3 67 52 86 FE 67 C3 67 52 86 FE 67 C3 67 52 \ + 86 FE 67 C3 67 52 86 FE 06 FB D6 FE 74 1E 86 FC \ + 3E FA 06 FE 88 4A 03 71 4C 67 84 57 67 84 57 67 \ + 98 57 06 FE 88 80 4A 00 27 97 75 4F 90 4A 00 27 \ + 4A 01 27 B7 97 71 69 77 42 06 F9 D6 FC 74 7C 02 \ + F9 4A 07 37 4E 07 02 FC 42 00 4E 07 06 F9 0A 07 \ + 71 4F 77 42 16 FF 06 FD 17 4D DA 07 74 95 12 FF \ + 52 00 86 FD 57 86 FF 57 16 FF 06 FD 07 4D DA 07 \ + 74 A9 12 FF 52 00 86 FD 57 86 FF 57 06 FE C2 FC \ + 98 98 12 F4 50 C2 FC 98 98 F2 F0 14 06 F4 C2 03 \ + 88 77 D1 06 FE C2 FC 98 98 F2 E0 14 06 FE C2 03 \ + 88 18 71 E2 80 18 71 DD 67 98 67 98 57 67 98 67 \ + 84 57 80 18 71 EB 67 84 67 98 57 67 84 67 84 57 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 1 start +led auto on diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml b/device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml new file mode 100644 index 000000000000..30f9962d1f11 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml @@ -0,0 +1,1184 @@ + + + + + + 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 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet1 + 10.0.0.2/31 + + + + Ethernet2 + 10.0.0.4/31 + + + + Ethernet3 + 10.0.0.6/31 + + + + Ethernet4 + 10.0.0.8/31 + + + + Ethernet5 + 10.0.0.10/31 + + + + Ethernet6 + 10.0.0.12/31 + + + + Ethernet7 + 10.0.0.14/31 + + + + Ethernet8 + 10.0.0.16/31 + + + + Ethernet9 + 10.0.0.18/31 + + + + Ethernet10 + 10.0.0.20/31 + + + + Ethernet11 + 10.0.0.22/31 + + + + Ethernet12 + 10.0.0.24/31 + + + + Ethernet13 + 10.0.0.26/31 + + + + Ethernet14 + 10.0.0.28/31 + + + + Ethernet15 + 10.0.0.30/31 + + + + Ethernet16 + 10.0.0.32/31 + + + + Ethernet17 + 10.0.0.34/31 + + + + Ethernet18 + 10.0.0.36/31 + + + + Ethernet19 + 10.0.0.38/31 + + + + Ethernet20 + 10.0.0.40/31 + + + + Ethernet21 + 10.0.0.42/31 + + + + Ethernet22 + 10.0.0.44/31 + + + + Ethernet23 + 10.0.0.46/31 + + + + Ethernet24 + 10.0.0.48/31 + + + + Ethernet25 + 10.0.0.50/31 + + + + Ethernet26 + 10.0.0.52/31 + + + + Ethernet27 + 10.0.0.54/31 + + + + Ethernet28 + 10.0.0.56/31 + + + + Ethernet29 + 10.0.0.58/31 + + + + Ethernet30 + 10.0.0.60/31 + + + + Ethernet31 + 10.0.0.62/31 + + + + Ethernet32 + 10.0.0.64/31 + + + + Ethernet33 + 10.0.0.66/31 + + + + Ethernet34 + 10.0.0.68/31 + + + + Ethernet35 + 10.0.0.70/31 + + + + Ethernet36 + 10.0.0.72/31 + + + + Ethernet37 + 10.0.0.74/31 + + + + Ethernet38 + 10.0.0.76/31 + + + + Ethernet39 + 10.0.0.78/31 + + + + Ethernet40 + 10.0.0.80/31 + + + + Ethernet41 + 10.0.0.82/31 + + + + Ethernet42 + 10.0.0.84/31 + + + + Ethernet43 + 10.0.0.86/31 + + + + Ethernet44 + 10.0.0.88/31 + + + + Ethernet45 + 10.0.0.90/31 + + + + Ethernet46 + 10.0.0.92/31 + + + + Ethernet47 + 10.0.0.94/31 + + + + Ethernet48 + 10.0.0.96/31 + + + + Ethernet52 + 10.0.0.98/31 + + + + Ethernet56 + 10.0.0.100/31 + + + + Ethernet60 + 10.0.0.102/31 + + + + Ethernet64 + 10.0.0.104/31 + + + + Ethernet68 + 10.0.0.106/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet1 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet2 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet3 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet4 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet5 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet6 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet7 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet8 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet9 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet10 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet11 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet12 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet13 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet14 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet15 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet16 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet17 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet18 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet19 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet20 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet21 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet22 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet23 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet24 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet25 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet26 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet27 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet28 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet29 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet30 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet31 + ARISTA16T0 + Ethernet1 + + + + + sonic + Accton-AS7312-54XS + + + + + + + sonic + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + sonic + Accton-AS7312-54XS +
diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/eeprom.py new file mode 100644 index 000000000000..7681caafeef4 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + #Two i2c buses might get flipped order, check them both. + if not os.path.exists(self.eeprom_path): + self.eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/psuutil.py new file mode 100644 index 000000000000..d73e65bf7981 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 2: "11-0053", + 1: "10-0050", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py new file mode 100644 index 000000000000..956b6b352f9c --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py @@ -0,0 +1,215 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 71 + PORTS_IN_BLOCK = 72 + QSFP_PORT_START = 48 + QSFP_PORT_END = 72 + + BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/" + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _cpld_mapping = { + 0: "4-0060", + 1: "5-0062", + 2: "6-0064", + } + _port_to_i2c_mapping = { + 0: 18, + 1: 19, + 2: 20, + 3: 21, + 4: 22, + 5: 23, + 6: 24, + 7: 25, + 8: 26, + 9: 27, + 10: 28, + 11: 29, + 12: 30, + 13: 31, + 14: 32, + 15: 33, + 16: 34, + 17: 35, + 18: 36, + 19: 37, + 20: 38, + 21: 39, + 22: 40, + 23: 41, + 24: 42, + 25: 43, + 26: 44, + 27: 45, + 28: 46, + 29: 47, + 30: 48, + 31: 49, + 32: 50, + 33: 51, + 34: 52, + 35: 53, + 36: 54, + 37: 55, + 38: 56, + 39: 57, + 40: 58, + 41: 59, + 42: 60, + 43: 61, + 44: 62, + 45: 63, + 46: 64, + 47: 65, + 48: 66, #QSFP49 + 49: 66, + 50: 66, + 51: 66, + 52: 67, #QSFP50 + 53: 67, + 54: 67, + 55: 67, + 56: 68, #QSFP51 + 57: 68, + 58: 68, + 59: 68, + 60: 69, #QSFP52 + 61: 69, + 62: 69, + 63: 69, + 64: 70, #QSFP53 + 65: 70, + 66: 70, + 67: 70, + 68: 71, #QSFP54 + 69: 71, + 70: 71, + 71: 71, + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x]) + + SfpUtilBase.__init__(self) + + + # For port 48~51 are QSFP, here presumed they're all split to 4 lanes. + def get_cage_num(self, port_num): + cage_num = port_num + if (port_num >= self.QSFP_PORT_START): + cage_num = (port_num - self.QSFP_PORT_START)/4 + cage_num = cage_num + self.QSFP_PORT_START + + return cage_num + + # For cage 0~23 and 48~51 are at cpld2, others are at cpld3. + def get_cpld_num(self, port_num): + cpld_i = 1 + cage_num = self.get_cage_num(port_num) + if (port_num > 23 and port_num < self.QSFP_PORT_START): + cpld_i = 2 + + if (cage_num >= 52): + cpld_i = 2 + + return cpld_i + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + cage_num = self.get_cage_num(port_num) + cpld_i = self.get_cpld_num(port_num) + + cpld_ps = self._cpld_mapping[cpld_i] + path = "/sys/bus/i2c/devices/{0}/module_present_{1}" + port_ps = path.format(cpld_ps, cage_num+1) + + try: + val_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + raise NotImplementedError + + def reset(self, port_num): + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + cage_num = self.get_cage_num(port_num) + cpld_i = self.get_cpld_num(port_num) + cpld_ps = self._cpld_mapping[cpld_i] + path = "/sys/bus/i2c/devices/{0}/module_reset_{1}" + port_ps = path.format(cpld_ps, cage_num+1) + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = '0' + + reg_file.write(reg_value) + reg_file.close() + + return True From f04f0704f70fcd0f114563d3d567b9f2cc9b1ee5 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 29 Jun 2018 09:59:46 -0700 Subject: [PATCH 1390/1833] Build python-click Debian package from version 6.7-4 source to fix CLI autocomplete/suggest (#1824) --- .gitignore | 2 ++ .../build_templates/sonic_debian_extension.j2 | 6 +++++ rules/python-click.mk | 16 ++++++++++++ slave.mk | 1 + sonic-slave/Dockerfile | 14 +++++++--- src/python-click/Makefile | 26 +++++++++++++++++++ 6 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 rules/python-click.mk create mode 100644 src/python-click/Makefile diff --git a/.gitignore b/.gitignore index 74998573e491..4eb7ab7e9ab7 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,8 @@ src/lldpd/* !src/lldpd/patch/ src/mpdecimal/* !src/mpdecimal/Makefile +src/python-click/* +!src/python-click/Makefile src/python3/* !src/python3/Makefile src/redis/* diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index b4a45ed16149..d12c5a45f9de 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -89,6 +89,12 @@ sudo cp {{platform_common_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2 sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $PLATFORM_COMMON_PY2_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME +# Install built Python Click package (and its dependencies via 'apt-get -y install -f') +# Do this before installing sonic-utilities so that it doesn't attempt to install +# an older version as part of its dependencies +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-click*_all.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f diff --git a/rules/python-click.mk b/rules/python-click.mk new file mode 100644 index 000000000000..0212f5e5584a --- /dev/null +++ b/rules/python-click.mk @@ -0,0 +1,16 @@ +# python-click package +# +# Python Click versions < 6.7 have a bug which causes bash completion +# functionality to stop working after two sublevels. sonic-utilities depends +# on this package, and the most recent version provided by Debian Jessie and +# Stretch is v6.6. We build version 6.7 from source in order to fix this bug. +# TODO: If we upgrade to a distro which provides a version >= 6.7 we will no +# longer need to build this. + +PYTHON_CLICK_VERSION = 6.7-4 + +export PYTHON_CLICK_VERSION + +PYTHON_CLICK = python-click_$(PYTHON_CLICK_VERSION)_all.deb +$(PYTHON_CLICK)_SRC_PATH = $(SRC_PATH)/python-click +SONIC_MAKE_DEBS += $(PYTHON_CLICK) diff --git a/slave.mk b/slave.mk index fc14a8f10a61..57e09d4c74ad 100644 --- a/slave.mk +++ b/slave.mk @@ -447,6 +447,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(IGB_DRIVER) \ $(IXGBE_DRIVER) \ $(SONIC_DEVICE_DATA) \ + $(PYTHON_CLICK) \ $(SONIC_UTILS) \ $(LIBWRAP) \ $(LIBPAM_TACPLUS) \ diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 213daf1a8e47..8949db34a973 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -193,8 +193,6 @@ RUN apt-get update && apt-get install -y \ python-netaddr \ python-ipaddr \ python-yaml \ -# For sonic utilities - python3-netaddr \ # For lockfile procmail \ # For gtest @@ -213,7 +211,17 @@ RUN apt-get update && apt-get install -y \ linuxdoc-tools \ lynx \ texlive-latex-extra \ - texlive-latex-recommended + texlive-latex-recommended \ +# For python-click build + python-sphinx \ + python-docutils \ + python3-all \ + python3-setuptools \ + python3-sphinx \ + python3-docutils \ + python3-requests \ + python3-pytest \ + python3-colorama # For linux build RUN apt-get -y build-dep linux diff --git a/src/python-click/Makefile b/src/python-click/Makefile new file mode 100644 index 000000000000..4deb27257fd2 --- /dev/null +++ b/src/python-click/Makefile @@ -0,0 +1,26 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = python-click_$(PYTHON_CLICK_VERSION)_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./python-click + + # Clone python-click Debian repo + git clone https://salsa.debian.org/debian/python-click + + pushd ./python-click + + # Reset HEAD to the commit of the proper tag + # NOTE: Using "git checkout " here detaches our HEAD, + # which stg doesn't like, so we use this method instead + git reset --hard debian/$(PYTHON_CLICK_VERSION) + + # Build source and Debian packages + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + # Move the newly-built .deb package to the destination directory + mv $* $(DEST)/ From 1caad016f9d674a771246f23ae739c38d28ecfa9 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Fri, 29 Jun 2018 14:33:11 -0700 Subject: [PATCH 1391/1833] Support T1 sku, create symlink (#1827) --- device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32-T1 | 1 + 1 file changed, 1 insertion(+) create mode 120000 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32-T1 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32-T1 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32-T1 new file mode 120000 index 000000000000..42c11d5f05fb --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32-T1 @@ -0,0 +1 @@ +Arista-7060CX-32S-C32 \ No newline at end of file From 6459275397eee140892f583375558c51d7e7b613 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 29 Jun 2018 14:33:43 -0700 Subject: [PATCH 1392/1833] Revert "[vs-test]: not forward routes with no-export community (#1774)" (#1828) This reverts commit b37540febd70a1dddf54aadfebf11007968585c9. --- platform/vs/tests/bounce/files/bgpd.conf | 13 ------ platform/vs/tests/bounce/files/exabgp1.conf | 21 ---------- platform/vs/tests/bounce/files/exabgp2.conf | 11 ----- platform/vs/tests/bounce/test_bounce.py | 45 --------------------- 4 files changed, 90 deletions(-) delete mode 100644 platform/vs/tests/bounce/files/bgpd.conf delete mode 100644 platform/vs/tests/bounce/files/exabgp1.conf delete mode 100644 platform/vs/tests/bounce/files/exabgp2.conf delete mode 100644 platform/vs/tests/bounce/test_bounce.py diff --git a/platform/vs/tests/bounce/files/bgpd.conf b/platform/vs/tests/bounce/files/bgpd.conf deleted file mode 100644 index 40322cedbc69..000000000000 --- a/platform/vs/tests/bounce/files/bgpd.conf +++ /dev/null @@ -1,13 +0,0 @@ -router bgp 65501 - bgp router-id 1.1.1.1 - no bgp default ipv4-unicast - neighbor 10.0.0.1 remote-as 65502 - address-family ipv4 - neighbor 10.0.0.1 activate - maximum-paths 64 - exit-address-family - neighbor 10.0.0.3 remote-as 65503 - address-family ipv4 - neighbor 10.0.0.3 activate - maximum-paths 64 - exit-address-family diff --git a/platform/vs/tests/bounce/files/exabgp1.conf b/platform/vs/tests/bounce/files/exabgp1.conf deleted file mode 100644 index 0e78bd61db42..000000000000 --- a/platform/vs/tests/bounce/files/exabgp1.conf +++ /dev/null @@ -1,21 +0,0 @@ -neighbor 10.0.0.0 { - router-id 1.1.1.2; - local-address 10.0.0.1; - local-as 65502; - peer-as 65501; - group-updates false; - - family{ - ipv4 unicast; - } - - static { - route 1.1.1.1/32{ - next-hop 10.0.0.1; - community no-export; - } - route 2.2.2.2/32{ - next-hop 10.0.0.1; - } - } -} diff --git a/platform/vs/tests/bounce/files/exabgp2.conf b/platform/vs/tests/bounce/files/exabgp2.conf deleted file mode 100644 index 3e67c18a82f6..000000000000 --- a/platform/vs/tests/bounce/files/exabgp2.conf +++ /dev/null @@ -1,11 +0,0 @@ -neighbor 10.0.0.2 { - router-id 1.1.1.3; - local-address 10.0.0.3; - local-as 65503; - peer-as 65501; - group-updates false; - - family { - ipv4 unicast; - } -} diff --git a/platform/vs/tests/bounce/test_bounce.py b/platform/vs/tests/bounce/test_bounce.py deleted file mode 100644 index 57616ec0bc76..000000000000 --- a/platform/vs/tests/bounce/test_bounce.py +++ /dev/null @@ -1,45 +0,0 @@ -from swsscommon import swsscommon -import os -import re -import time -import json - -def test_bounce(dvs): - dvs.servers[0].runcmd("pkill -f exabgp") - dvs.copy_file("/etc/quagga/", "bounce/files/bgpd.conf") - dvs.runcmd("supervisorctl start bgpd") - dvs.runcmd("ip addr add 10.0.0.0/31 dev Ethernet0") - dvs.runcmd("ifconfig Ethernet0 up") - - dvs.runcmd("ip addr add 10.0.0.2/31 dev Ethernet4") - dvs.runcmd("ifconfig Ethernet4 up") - - dvs.servers[0].runcmd("ip addr add 10.0.0.1/31 dev eth0") - dvs.servers[0].runcmd("ifconfig eth0 up") - - dvs.servers[1].runcmd("ip addr add 10.0.0.3/31 dev eth0") - dvs.servers[1].runcmd("ifconfig eth0 up") - - time.sleep(5) - - p1 = dvs.servers[0].runcmd_async("exabgp -d bounce/files/exabgp1.conf") - p2 = dvs.servers[1].runcmd_async("exabgp -d bounce/files/exabgp2.conf") - - time.sleep(20) - - sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"]) - all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"]) - announce_route = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) - - p1.terminate() - p1 = p1.wait() - - p2.terminate() - p2 = p2.wait() - - print sum_res - print announce_route - assert "1.1.1.1/32" in all_route - assert "1.1.1.1/32" not in announce_route - assert "2.2.2.2/32" in all_route - assert "2.2.2.2/32" in announce_route From 9b8d985a40ebee70941a3de87d0d709e1333e3aa Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Sat, 30 Jun 2018 04:34:11 +0700 Subject: [PATCH 1393/1833] [device/celestica] Update fancontrol configuration file and sensor label in sensor.conf (#1826) * update fancontrol config follow cel fsc document * update lm75 sensors label --- .../x86_64-cel_seastone-r0/fancontrol | 14 +++++------ .../x86_64-cel_seastone-r0/sensors.conf | 25 +++++++++++-------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/fancontrol b/device/celestica/x86_64-cel_seastone-r0/fancontrol index ba3010c7c9cc..8d5cbccb9d00 100644 --- a/device/celestica/x86_64-cel_seastone-r0/fancontrol +++ b/device/celestica/x86_64-cel_seastone-r0/fancontrol @@ -2,11 +2,11 @@ INTERVAL=10 DEVPATH=hwmon6=devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e hwmon7=devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d DEVNAME=hwmon6=emc2305 hwmon7=emc2305 -FCTEMPS=hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-6/6-0049/hwmon/hwmon2/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-7/7-004a/hwmon/hwmon3/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-14/14-0048/hwmon/hwmon4/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-15/15-004e/hwmon/hwmon5/temp1_input -FCFANS= hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm5 hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm4 hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm3 hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm2 hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm1 hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm5 hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm4 hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm3 hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm2 hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm1 -MINTEMP=hwmon6/device/pwm1=25 hwmon6/device/pwm2=25 hwmon6/device/pwm3=25 hwmon6/device/pwm4=25 hwmon6/device/pwm5=25 hwmon7/device/pwm1=25 hwmon7/device/pwm2=25 hwmon7/device/pwm3=25 hwmon7/device/pwm4=25 hwmon7/device/pwm5=25 -MAXTEMP=hwmon6/device/pwm1=40 hwmon6/device/pwm2=40 hwmon6/device/pwm3=40 hwmon6/device/pwm4=40 hwmon6/device/pwm5=40 hwmon7/device/pwm1=40 hwmon7/device/pwm2=40 hwmon7/device/pwm3=40 hwmon7/device/pwm4=40 hwmon7/device/pwm5=40 -MINSTART=hwmon6/device/pwm1=75 hwmon6/device/pwm2=75 hwmon6/device/pwm3=75 hwmon6/device/pwm4=75 hwmon6/device/pwm5=75 hwmon7/device/pwm1=75 hwmon7/device/pwm2=75 hwmon7/device/pwm3=75 hwmon7/device/pwm4=75 hwmon7/device/pwm5=75 -MINSTOP=hwmon6/device/pwm1=50 hwmon6/device/pwm2=50 hwmon6/device/pwm3=50 hwmon6/device/pwm4=50 hwmon6/device/pwm5=50 hwmon7/device/pwm1=50 hwmon7/device/pwm2=50 hwmon7/device/pwm3=50 hwmon7/device/pwm4=50 hwmon7/device/pwm5=50 -MINPWM=hwmon6/device/pwm1=50 hwmon6/device/pwm2=50 hwmon6/device/pwm3=50 hwmon6/device/pwm4=50 hwmon6/device/pwm5=50 hwmon7/device/pwm1=50 hwmon7/device/pwm2=50 hwmon7/device/pwm3=50 hwmon7/device/pwm4=50 hwmon7/device/pwm5=50 +FCTEMPS=hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-5/5-0048/hwmon/hwmon1/temp1_input +FCFANS=hwmon7/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm5 hwmon7/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm4 hwmon7/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm3 hwmon7/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm2 hwmon7/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-004d/pwm1 hwmon6/device/pwm5=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm5 hwmon6/device/pwm4=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm4 hwmon6/device/pwm3=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm3 hwmon6/device/pwm2=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm2 hwmon6/device/pwm1=/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-13/13-002e/pwm1 +MINTEMP=hwmon6/device/pwm1=26 hwmon6/device/pwm2=26 hwmon6/device/pwm3=26 hwmon6/device/pwm4=26 hwmon6/device/pwm5=26 hwmon7/device/pwm1=26 hwmon7/device/pwm2=26 hwmon7/device/pwm3=26 hwmon7/device/pwm4=26 hwmon7/device/pwm5=26 +MAXTEMP=hwmon6/device/pwm1=45 hwmon6/device/pwm2=45 hwmon6/device/pwm3=45 hwmon6/device/pwm4=45 hwmon6/device/pwm5=45 hwmon7/device/pwm1=45 hwmon7/device/pwm2=45 hwmon7/device/pwm3=45 hwmon7/device/pwm4=45 hwmon7/device/pwm5=45 +MINSTART=hwmon6/device/pwm1=89 hwmon6/device/pwm2=89 hwmon6/device/pwm3=89 hwmon6/device/pwm4=89 hwmon6/device/pwm5=89 hwmon7/device/pwm1=89 hwmon7/device/pwm2=89 hwmon7/device/pwm3=89 hwmon7/device/pwm4=89 hwmon7/device/pwm5=89 +MINSTOP=hwmon6/device/pwm1=89 hwmon6/device/pwm2=89 hwmon6/device/pwm3=89 hwmon6/device/pwm4=89 hwmon6/device/pwm5=89 hwmon7/device/pwm1=89 hwmon7/device/pwm2=89 hwmon7/device/pwm3=89 hwmon7/device/pwm4=89 hwmon7/device/pwm5=89 +MINPWM=hwmon6/device/pwm1=89 hwmon6/device/pwm2=89 hwmon6/device/pwm3=89 hwmon6/device/pwm4=89 hwmon6/device/pwm5=89 hwmon7/device/pwm1=89 hwmon7/device/pwm2=89 hwmon7/device/pwm3=89 hwmon7/device/pwm4=89 hwmon7/device/pwm5=89 MAXPWM=hwmon6/device/pwm1=255 hwmon6/device/pwm2=255 hwmon6/device/pwm3=255 hwmon6/device/pwm4=255 hwmon6/device/pwm5=255 hwmon7/device/pwm1=255 hwmon7/device/pwm2=255 hwmon7/device/pwm3=255 hwmon7/device/pwm4=255 hwmon7/device/pwm5=255 diff --git a/device/celestica/x86_64-cel_seastone-r0/sensors.conf b/device/celestica/x86_64-cel_seastone-r0/sensors.conf index 11461a0afef9..6ce4540b226e 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sensors.conf +++ b/device/celestica/x86_64-cel_seastone-r0/sensors.conf @@ -36,30 +36,33 @@ chip "dps460-i2c-*-5b" set in3_crit 13.0 set in3_lcrit 11.0 -# These sensors located on Main Switch Board. +# These sensors located on CPU Board. chip "dx010_lm75b-i2c-*-48" - label temp1 "Front-panel temp sensor 1" + label temp1 "CPU_external temp sensor" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-*-49" - label temp1 "Front-panel temp sensor 2" +chip "dx010_lm75b-i2c-*-4e" + label temp1 "Rear_panel temp sensor" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-*-4a" - label temp1 "ASIC temp sensor" +# These sensors located on Main Switch Board. +bus "i2c-5" "i2c-1-mux (chan_id 3)" +chip "dx010_lm75b-i2c-5-48" + label temp1 "Front_panel left temp sensor" set temp1_max 43 set temp1_max_hyst 28 -# These sensors located on CPU Board. -chip "dx010_lm75b-i2c-*-48" - label temp1 "Rear-panel temp sensor 1" +bus "i2c-6" "i2c-1-mux (chan_id 4)" +chip "dx010_lm75b-i2c-6-49" + label temp1 "Front_panel right temp sensor" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-*-4e" - label temp1 "Rear-panel temp sensor 2" +bus "i2c-7" "i2c-1-mux (chan_id 5)" +chip "dx010_lm75b-i2c-7-4a" + label temp1 "Switch_external temp sensor" set temp1_max 43 set temp1_max_hyst 28 From 77aec964e60c6f12bb2f3b600ef013c055c2d001 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 29 Jun 2018 16:34:53 -0700 Subject: [PATCH 1394/1833] Update sonic-swss with QueueMaps fixes (#1829) * sonic-quagga update. Don't spam with 'Vtysh connected from' message * Update swss submodule with QueueMaps fixes --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 258ffe64c7f1..90ea7a41adfd 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 258ffe64c7f11a3e63f7cff09ae8bd2f98788c03 +Subproject commit 90ea7a41adfdeef69ec20db498f6b737e258cf71 From 3fc56f07e82076f22ee1b35d127c1eaf9094ae27 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 30 Jun 2018 09:41:39 -0700 Subject: [PATCH 1395/1833] [sonic-utilities] Update submodule (#1830) --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 27ae65122582..9c4c3620e4fb 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 27ae651225820e3eb4f08ed4cd80f93bbb5fe9bf +Subproject commit 9c4c3620e4fb488325e9d146c8b312ae8bb95c15 From 0e5c5f2601c143676be90ae74e35695a330ce887 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 1 Jul 2018 09:46:25 -0700 Subject: [PATCH 1396/1833] [baseimage]: add commonly used network tools (#1832) * [baseimage]: add commonly used network tools --- build_debian.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index f66cf4ba62d1..c960a3946ca6 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -222,7 +222,11 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in sysfsutils \ grub2-common \ ethtool \ - screen + screen \ + hping3 \ + python-scapy \ + tcptraceroute \ + mtr-tiny sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ grub-pc-bin From 7edbf5d6f0f76008c2d6cbb27ee870a830294361 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 1 Jul 2018 09:46:42 -0700 Subject: [PATCH 1397/1833] [build]: add show docker tag (#1833) --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index c954402ab312..347041e1b12a 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,10 @@ sonic-slave-bash : $(DOCKER_BUILD) ; } @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash +showtag: + @echo $(SLAVE_IMAGE):$(SLAVE_TAG) + @echo $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) + init : @git submodule update --init --recursive @git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' From 92eb7b47b2992a1b6c21ac0b19370c49f115d8b9 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Tue, 3 Jul 2018 19:39:27 +0300 Subject: [PATCH 1398/1833] [mellanox]: Fix symlink to QOS config file for MSN2740 platform (#1842) Signed-off-by: Volodymyr Samotiy --- device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 index ae738e606a9d..eccf286dc879 120000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/qos.json.j2 @@ -1 +1 @@ -../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json \ No newline at end of file +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 \ No newline at end of file From 117dc2b00839e2456ff78e112ea5bcdc7ab6958d Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Wed, 4 Jul 2018 07:42:50 +0800 Subject: [PATCH 1399/1833] [docker-syncd-mlnx] add new mlnx-sfpd daemon to docker-syncd-mlnx (#1841) * This new daemon will listen to the SDK for the SDK change event, * after got a SFP change event will publish a notification via DB. modified: platform/mellanox/docker-syncd-mlnx-rpc.mk modified: platform/mellanox/docker-syncd-mlnx.mk modified: platform/mellanox/docker-syncd-mlnx/start.sh modified: platform/mellanox/docker-syncd-mlnx/supervisord.conf new file: platform/mellanox/mlnx-sfpd.mk new file: platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd new file: platform/mellanox/mlnx-sfpd/setup.py modified: platform/mellanox/rules.mk signed-off-by Liu Kebo kebol@mellanox.com --- platform/mellanox/docker-syncd-mlnx-rpc.mk | 2 +- platform/mellanox/docker-syncd-mlnx.mk | 2 +- platform/mellanox/docker-syncd-mlnx/start.sh | 2 + .../docker-syncd-mlnx/supervisord.conf | 8 + platform/mellanox/mlnx-sfpd.mk | 5 + platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd | 199 ++++++++++++++++++ platform/mellanox/mlnx-sfpd/setup.py | 28 +++ platform/mellanox/rules.mk | 1 + 8 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 platform/mellanox/mlnx-sfpd.mk create mode 100644 platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd create mode 100644 platform/mellanox/mlnx-sfpd/setup.py diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index f27242ce17dc..d6011884c45c 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) +$(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 2da5961fc046..6ac895d2eb9c 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) +$(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) diff --git a/platform/mellanox/docker-syncd-mlnx/start.sh b/platform/mellanox/docker-syncd-mlnx/start.sh index 623316050475..3adbd04d536a 100755 --- a/platform/mellanox/docker-syncd-mlnx/start.sh +++ b/platform/mellanox/docker-syncd-mlnx/start.sh @@ -5,3 +5,5 @@ rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd supervisorctl start syncd + +supervisorctl start mlnx-sfpd diff --git a/platform/mellanox/docker-syncd-mlnx/supervisord.conf b/platform/mellanox/docker-syncd-mlnx/supervisord.conf index 1af5d70a1d0c..8860bd6c0205 100644 --- a/platform/mellanox/docker-syncd-mlnx/supervisord.conf +++ b/platform/mellanox/docker-syncd-mlnx/supervisord.conf @@ -26,3 +26,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:mlnx-sfpd] +command=/usr/bin/mlnx-sfpd +priority=4 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/platform/mellanox/mlnx-sfpd.mk b/platform/mellanox/mlnx-sfpd.mk new file mode 100644 index 000000000000..416dd7d0f2cd --- /dev/null +++ b/platform/mellanox/mlnx-sfpd.mk @@ -0,0 +1,5 @@ +# mlnx-sfpd (SONiC MLNX platform sfp event monitoring daemon) Debian package + +MLNX_SFPD = python-mlnx-sfpd_1.0-1_all.deb +$(MLNX_SFPD)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sfpd +SONIC_PYTHON_STDEB_DEBS += $(MLNX_SFPD) diff --git a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd new file mode 100644 index 000000000000..e91dbb7a8aa6 --- /dev/null +++ b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd @@ -0,0 +1,199 @@ +#!/usr/bin/env python +''' +This code is for a mlnx platform specific daemon, mlnx-sfpd. +Which listen to the SDK for the SFP change event and post the event to DB. +''' + +from __future__ import print_function +import sys, errno +import os +import time +import syslog +import signal +import json +from python_sdk_api.sx_api import * +from swsssdk import SonicV2Connector + +VERSION = '1.0' + +SYSLOG_IDENTIFIER = "mlnx-sfpd" + +REDIS_HOSTIP = "127.0.0.1" + +SDK_SFP_STATE_IN = 0x1 +SDK_SFP_STATE_OUT = 0x2 +STATUS_PLUGIN = '1' +STATUS_PLUGOUT = '0' +STATUS_UNKNOWN = '2' + +sfp_value_status_dict = {SDK_SFP_STATE_IN:STATUS_PLUGIN, SDK_SFP_STATE_OUT:STATUS_PLUGOUT} + +#========================== Syslog wrappers ========================== + +def log_info(msg, also_print_to_console=False): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + + if also_print_to_console: + print(msg) + +def log_warning(msg, also_print_to_console=False): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_WARNING, msg) + syslog.closelog() + + if also_print_to_console: + print(msg) + +def log_error(msg, also_print_to_console=False): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + + if also_print_to_console: + print(msg) + +#========================== Signal Handling ========================== + +def signal_handler(sig, frame): + if sig == signal.SIGHUP: + log_info("Caught SIGHUP - ignoring...") + return + elif sig == signal.SIGINT: + log_info("Caught SIGINT - exiting...") + sys.exit(128 + sig) + elif sig == signal.SIGTERM: + log_info("Caught SIGTERM - exiting...") + sys.exit(128 + sig) + else: + log_warning("Caught unhandled signal '" + sig + "'") + + +def sx_recv(fd_p, handle): + # recv parameters + pkt_size = 2000 + pkt_size_p = new_uint32_t_p() + uint32_t_p_assign(pkt_size_p, pkt_size) + pkt = new_uint8_t_arr(pkt_size) + recv_info_p = new_sx_receive_info_t_p() + pmpe_t = sx_event_pmpe_t() + logical_port_list = new_sx_port_log_id_t_arr(4) + port_attributes_list = new_sx_port_attributes_t_arr(64) + port_cnt_p = new_uint32_t_p() + uint32_t_p_assign(port_cnt_p,64) + label_port_list = [] + + rc = sx_lib_host_ifc_recv(fd_p, pkt, pkt_size_p, recv_info_p) + if rc != 0: + log_error("event receive exit with error, rc %d" % rc) + exit(rc) + + pmpe_t = recv_info_p.event_info.pmpe + port_list_size = pmpe_t.list_size + logical_port_list = pmpe_t.log_port_list + module_state = pmpe_t.module_state + + for i in range(0, port_list_size): + logical_port = sx_port_log_id_t_arr_getitem(logical_port_list, i) + rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) + port_cnt = uint32_t_p_value(port_cnt_p) + + for i in range(0,port_cnt): + port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list,i) + if port_attributes.log_port == logical_port: + lable_port = port_attributes.port_mapping.module_port + break + label_port_list.append(lable_port) + + return label_port_list, module_state + +def send_sfp_notification(db, interface, state): + sfp_notify = [interface,state] + msg = json.dumps(sfp_notify,separators=(',',':')) + db.publish('STATE_DB','TRANSCEIVER_NOTIFY', msg) + return + +# main start +def main(): + # Register our signal handlers + signal.signal(signal.SIGHUP, signal_handler) + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + + #open SDK handler + log_info("starting mlnx-sfpd...") + rc, handle = sx_api_open(None) + retry_time = 1 + while rc != SX_STATUS_SUCCESS: + time.sleep(2**retry_time) + retry_time += 1 + rc, handle = sx_api_open(None) + if retry_time > 20: + log_error("Failed to open api handle.\nPlease check that SDK is running.") + sys.exit(errno.EACCES) + + #open recv fd + rx_fd_p = new_sx_fd_t_p() + rc = sx_api_host_ifc_open(handle, rx_fd_p) + if rc != 0: + log_error("sx_api_host_ifc_open exit with error, rc %d" % rc) + exit(rc) + + # set up general host ifc parameters + swid = 0 + cmd = SX_ACCESS_CMD_REGISTER + uc_p = new_sx_user_channel_t_p() + uc_p.type = SX_USER_CHANNEL_TYPE_FD + uc_p.channel.fd = rx_fd_p + trap_id = SX_TRAP_ID_PMPE + + rc = sx_api_host_ifc_trap_id_register_set(handle, cmd, swid, trap_id, uc_p) + if rc != 0: + log_error("sx_api_host_ifc_trap_id_register_set exit with error, rc %d" % rc) + exit(rc) + + #connect to state db for notification sending + state_db = SonicV2Connector(host=REDIS_HOSTIP) + state_db.connect(state_db.STATE_DB) + + #main loop for sfp event listening + log_info("mlnx-sfpd started") + while True: + state = STATUS_UNKNOWN + port_list, module_state = sx_recv(rx_fd_p, handle) + if module_state in sfp_value_status_dict: state = sfp_value_status_dict[module_state] + + if state != STATUS_UNKNOWN: + for port in port_list: + log_info("SFP on port %d state %s" % (port, state)) + send_sfp_notification(state_db, str(port), state) + + log_info("sfp change event handling done") + + ''' + # TODO: clean open handlers before exit, need find out which errors can be raised by SDK in this case. + # unregister trap id + cmd = SX_ACCESS_CMD_DEREGISTER + rc = sx_api_host_ifc_trap_id_register_set(handle, cmd, swid, trap_id, uc_p) + if rc != 0: + log_error("sx_api_host_ifc_trap_id_register_set exit with error, rc %d" % rc) + exit(rc) + + # close read fp + rc = sx_api_host_ifc_close(handle, rx_fd_p) + if rc != 0: + log_error("sx_api_host_ifc_close exit with error, rc %d" % rc) + exit(rc) + + # close sdk handler + rc = sx_api_close(handle) + if rc != 0: + log_error("exit with error, rc %d" % rc) + exit(rc) + + log_info("mlnx-sfpd exited") + ''' + +if __name__ == '__main__': + main() diff --git a/platform/mellanox/mlnx-sfpd/setup.py b/platform/mellanox/mlnx-sfpd/setup.py new file mode 100644 index 000000000000..ea9b895cb1f4 --- /dev/null +++ b/platform/mellanox/mlnx-sfpd/setup.py @@ -0,0 +1,28 @@ +from setuptools import setup + +setup( + name='mlnx-sfpd', + version='1.0', + description='SFP event mmonitoring daemon for SONiC on mellanox platform', + license='Apache 2.0', + author='SONiC Community', + url='https://github.com/Azure/sonic-buildimage/', + maintainer='Kebo Liu', + maintainer_email='kebol@mellanox.com', + scripts=[ + 'scripts/mlnx-sfpd', + ], + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: No Input/Output (Daemon)', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.7', + 'Topic :: System :: Hardware', + ], + keywords='sonic SONiC SFP sfp MELLANOX mellanox daemon SFPD sfpd', +) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 1651f4a66806..ff5c96fe0042 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -10,6 +10,7 @@ include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk include $(PLATFORM_PATH)/docker-ptf-mlnx.mk +include $(PLATFORM_PATH)/mlnx-sfpd.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM) From 78ed06d6be0ef776ae7a48b3e085023f0404f13a Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Wed, 4 Jul 2018 08:00:13 +0800 Subject: [PATCH 1400/1833] [Platform/Celestica] Add dx010 fan led control. (#1834) --- platform/broadcom/platform-modules-cel.mk | 2 +- platform/broadcom/sonic-platform-modules-cel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 551ff37e3b37..96cb59144fa5 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -1,6 +1,6 @@ # Celestica DX010 Platform modules -CEL_DX010_PLATFORM_MODULE_VERSION = 0.7 +CEL_DX010_PLATFORM_MODULE_VERSION = 0.8 export CEL_DX010_PLATFORM_MODULE_VERSION diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel index 4c8bcd1584e5..5ec0c5e5d4fe 160000 --- a/platform/broadcom/sonic-platform-modules-cel +++ b/platform/broadcom/sonic-platform-modules-cel @@ -1 +1 @@ -Subproject commit 4c8bcd1584e5afb05476a67e0ed82ca02fba6da0 +Subproject commit 5ec0c5e5d4fe8f2ec1ab5a6abefa7d168a81ca98 From 162e9b6f56dcf9e76fa999d783d6fb7574b066b0 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 3 Jul 2018 17:00:31 -0700 Subject: [PATCH 1401/1833] Add monit for /var/log disk usage (#1836) Signed-off-by: Qi Luo --- build_debian.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index c960a3946ca6..767dd7b83b79 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -269,6 +269,8 @@ sudo sed -i ' sudo tee -a $FILESYSTEM_ROOT/etc/monit/monitrc > /dev/null <<'EOF' check filesystem root-aufs with path / if space usage > 90% for 5 times within 10 cycles then alert +check filesystem var-log with path /var/log + if space usage > 90% for 5 times within 10 cycles then alert check system $HOST if memory usage > 90% for 5 times within 10 cycles then alert if cpu usage (user) > 90% for 5 times within 10 cycles then alert From f6fffda7bbca101b0cd9c56b79ba69b25d86a77a Mon Sep 17 00:00:00 2001 From: yurypm Date: Wed, 4 Jul 2018 01:01:41 +0100 Subject: [PATCH 1402/1833] [device] Update arista driver submodule (#1835) * [device] Update arista driver submodule * Set Arista scd driver config Set ARISTA_SCD_DRIVER_CONFIG config to build and include scd driver to resulting arista deb packages --- platform/broadcom/platform-modules-arista.mk | 1 + platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/platform-modules-arista.mk b/platform/broadcom/platform-modules-arista.mk index ec7566318c8d..633435c0550a 100644 --- a/platform/broadcom/platform-modules-arista.mk +++ b/platform/broadcom/platform-modules-arista.mk @@ -20,3 +20,4 @@ $(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODU export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MODULE_PYTHON3 ARISTA_PLATFORM_MODULE_DRIVERS +export ARISTA_SCD_DRIVER_CONFIG=m diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index a35c7eddaf94..c114bb1f903a 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a35c7eddaf945a1ff09ea71b47f69b6ddba5e892 +Subproject commit c114bb1f903a5630c3a02d450a026949c323defd From 73a2e64d9f3cdb5643d0a71cfb9d7981f2ba4f07 Mon Sep 17 00:00:00 2001 From: byu343 Date: Tue, 3 Jul 2018 17:10:11 -0700 Subject: [PATCH 1403/1833] [arista]: Add platform support for DCS-7170-64C (#1718) --- .gitmodules | 3 + .../Arista-7170-64C/port_config.ini | 67 ++++++++++++++++++ .../arista/x86_64-arista_7170_64c/fancontrol | 10 +++ .../x86_64-arista_7170_64c/minigraph.xml | 70 +++++++++++++++++++ .../x86_64-arista_7170_64c/plugins/eeprom.py | 8 +++ .../plugins/led_control.py | 8 +++ .../x86_64-arista_7170_64c/plugins/psuutil.py | 12 ++++ .../x86_64-arista_7170_64c/plugins/sfputil.py | 8 +++ .../x86_64-arista_7170_64c/sensors.conf | 53 ++++++++++++++ files/Aboot/boot0.j2 | 6 ++ platform/p4/one-aboot.mk | 12 ++++ platform/p4/platform-modules-arista.mk | 22 ++++++ platform/p4/rules.mk | 2 + platform/p4/sonic-platform-modules-arista | 1 + 14 files changed, 282 insertions(+) create mode 100644 device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini create mode 100644 device/arista/x86_64-arista_7170_64c/fancontrol create mode 100644 device/arista/x86_64-arista_7170_64c/minigraph.xml create mode 100644 device/arista/x86_64-arista_7170_64c/plugins/eeprom.py create mode 100644 device/arista/x86_64-arista_7170_64c/plugins/led_control.py create mode 100644 device/arista/x86_64-arista_7170_64c/plugins/psuutil.py create mode 100644 device/arista/x86_64-arista_7170_64c/plugins/sfputil.py create mode 100644 device/arista/x86_64-arista_7170_64c/sensors.conf create mode 100644 platform/p4/one-aboot.mk create mode 100644 platform/p4/platform-modules-arista.mk create mode 160000 platform/p4/sonic-platform-modules-arista diff --git a/.gitmodules b/.gitmodules index e0cfc0869d05..bb4eae528c72 100755 --- a/.gitmodules +++ b/.gitmodules @@ -77,3 +77,6 @@ [submodule "platform/broadcom/sonic-platform-modules-mitac"] path = platform/broadcom/sonic-platform-modules-mitac url = https://github.com/MiTAC-EBU/sonic-platform-modules-mitac.git +[submodule "platform/p4/sonic-platform-modules-arista"] + path = platform/p4/sonic-platform-modules-arista + url = https://github.com/aristanetworks/sonic diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini new file mode 100644 index 000000000000..1020ea1382c2 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini @@ -0,0 +1,67 @@ +# name lanes alias port +Ethernet0 444,445,446,447 Ethernet1/1 1 +Ethernet4 52,53,54,55 Ethernet2/1 2 +Ethernet8 436,437,438,439 Ethernet3/1 3 +Ethernet12 432,433,434,435 Ethernet4/1 4 +Ethernet16 412,413,414,415 Ethernet5/1 5 +Ethernet20 424,425,426,427 Ethernet6/1 6 +Ethernet24 404,405,406,407 Ethernet7/1 7 +Ethernet28 0,1,2,3 Ethernet8/1 8 +Ethernet32 12,13,14,15 Ethernet9/1 9 +Ethernet36 8,9,10,11 Ethernet10/1 10 +Ethernet40 24,25,26,27 Ethernet11/1 11 +Ethernet44 32,33,34,35 Ethernet12/1 12 +Ethernet48 44,45,46,47 Ethernet13/1 13 +Ethernet52 40,41,42,43 Ethernet14/1 14 +Ethernet56 396,397,398,399 Ethernet15/1 15 +Ethernet60 392,393,394,395 Ethernet16/1 16 +Ethernet64 260,261,262,263 Ethernet17/1 17 +Ethernet68 384,385,386,387 Ethernet18/1 18 +Ethernet72 180,181,182,183 Ethernet19/1 19 +Ethernet76 172,173,174,175 Ethernet20/1 20 +Ethernet80 160,161,162,163 Ethernet21/1 21 +Ethernet84 164,165,166,167 Ethernet22/1 22 +Ethernet88 148,149,150,151 Ethernet23/1 23 +Ethernet92 140,141,142,143 Ethernet24/1 24 +Ethernet96 272,273,274,275 Ethernet25/1 25 +Ethernet100 132,133,134,135 Ethernet26/1 26 +Ethernet104 280,281,282,283 Ethernet27/1 27 +Ethernet108 284,285,286,287 Ethernet28/1 28 +Ethernet112 304,305,306,307 Ethernet29/1 29 +Ethernet116 292,293,294,295 Ethernet30/1 30 +Ethernet120 312,313,314,315 Ethernet31/1 31 +Ethernet124 316,317,318,319 Ethernet32/1 32 +Ethernet128 56,57,58,59 Ethernet33/1 33 +Ethernet132 60,61,62,63 Ethernet34/1 34 +Ethernet136 428,429,430,431 Ethernet35/1 35 +Ethernet140 440,441,442,443 Ethernet36/1 36 +Ethernet144 420,421,422,423 Ethernet37/1 37 +Ethernet148 416,417,418,419 Ethernet38/1 38 +Ethernet152 128,129,130,131 Ethernet39/1 39 +Ethernet156 408,409,410,411 Ethernet40/1 40 +Ethernet160 4,5,6,7 Ethernet41/1 41 +Ethernet164 16,17,18,19 Ethernet42/1 42 +Ethernet168 28,29,30,31 Ethernet43/1 43 +Ethernet172 20,21,22,23 Ethernet44/1 44 +Ethernet176 36,37,38,39 Ethernet45/1 45 +Ethernet180 48,49,50,51 Ethernet46/1 46 +Ethernet184 388,389,390,391 Ethernet47/1 47 +Ethernet188 400,401,402,403 Ethernet48/1 48 +Ethernet192 256,257,258,259 Ethernet49/1 49 +Ethernet196 264,265,266,267 Ethernet50/1 50 +Ethernet200 176,177,178,179 Ethernet51/1 51 +Ethernet204 184,185,186,187 Ethernet52/1 52 +Ethernet208 168,169,170,171 Ethernet53/1 53 +Ethernet212 156,157,158,159 Ethernet54/1 54 +Ethernet216 144,145,146,147 Ethernet55/1 55 +Ethernet220 152,153,154,155 Ethernet56/1 56 +Ethernet224 136,137,138,139 Ethernet57/1 57 +Ethernet228 268,269,270,271 Ethernet58/1 58 +Ethernet232 288,289,290,291 Ethernet59/1 59 +Ethernet236 276,277,278,279 Ethernet60/1 60 +Ethernet240 296,297,298,299 Ethernet61/1 61 +Ethernet244 300,301,302,303 Ethernet62/1 62 +Ethernet248 188,189,190,191 Ethernet63/1 63 +Ethernet252 308,309,310,311 Ethernet64/1 64 +Ethernet256 64 Ethernet65 65 +Ethernet260 65 Ethernet66 66 diff --git a/device/arista/x86_64-arista_7170_64c/fancontrol b/device/arista/x86_64-arista_7170_64c/fancontrol new file mode 100644 index 000000000000..639185a7119f --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=5 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1c.0/0000:06:00.0/i2c-8/8-004c hwmon3=devices/pci0000:ff/0000:ff:0b.3/i2c-93/93-0060 +DEVNAME=hwmon1=max6658 hwmon3=rook_cpld +FCTEMPS=hwmon3/pwm4=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input +FCFANS=hwmon3/pwm4=hwmon3/fan4_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm1=hwmon3/fan1_input +MINTEMP=hwmon3/pwm4=50 hwmon3/pwm3=50 hwmon3/pwm2=50 hwmon3/pwm1=50 +MINPWM=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 +MAXTEMP=hwmon3/pwm4=60 hwmon3/pwm3=60 hwmon3/pwm2=60 hwmon3/pwm1=60 +MINSTART=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 +MINSTOP=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 diff --git a/device/arista/x86_64-arista_7170_64c/minigraph.xml b/device/arista/x86_64-arista_7170_64c/minigraph.xml new file mode 100644 index 000000000000..2b2586cf7596 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/minigraph.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + HostIP + Loopback0 + + 100.1.0.1/32 + + 100.1.0.1/32 + + + + + + + ManagementIP1 + Management0 + + 172.24.37.166/18 + + 172.24.37.166/18 + + + + + + + sonic + + + + + + + + + + + + + + + + + + sonic + Arista-7170-64C + + + + + + + + sonic + Arista-7170-64C + diff --git a/device/arista/x86_64-arista_7170_64c/plugins/eeprom.py b/device/arista/x86_64-arista_7170_64c/plugins/eeprom.py new file mode 100644 index 000000000000..d439e442ee33 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/plugins/eeprom.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +try: + import arista.utils.sonic_eeprom as arista_eeprom +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +board = arista_eeprom.getTlvInfoDecoder() diff --git a/device/arista/x86_64-arista_7170_64c/plugins/led_control.py b/device/arista/x86_64-arista_7170_64c/plugins/led_control.py new file mode 100644 index 000000000000..fae2d504beb6 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/plugins/led_control.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +try: + import arista.utils.sonic_leds as arista_leds +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +LedControl = arista_leds.getLedControl() diff --git a/device/arista/x86_64-arista_7170_64c/plugins/psuutil.py b/device/arista/x86_64-arista_7170_64c/plugins/psuutil.py new file mode 100644 index 000000000000..1a8682ae3c67 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/plugins/psuutil.py @@ -0,0 +1,12 @@ +# psuutil.py +# +# Platform-specific PSU interface for SONiC +# + +try: + import arista.utils.sonic_psu as arista_psuutil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +PsuUtil = arista_psuutil.getPsuUtil() diff --git a/device/arista/x86_64-arista_7170_64c/plugins/sfputil.py b/device/arista/x86_64-arista_7170_64c/plugins/sfputil.py new file mode 100644 index 000000000000..1357ad786434 --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/plugins/sfputil.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +try: + import arista.utils.sonic_sfputil as arista_sfputil +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +SfpUtil = arista_sfputil.getSfpUtil() diff --git a/device/arista/x86_64-arista_7170_64c/sensors.conf b/device/arista/x86_64-arista_7170_64c/sensors.conf new file mode 100644 index 000000000000..196769f95c0c --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/sensors.conf @@ -0,0 +1,53 @@ +# libsensors configuration file for DCS-7260CX3-64 +# ------------------------------------------------ + +bus "i2c-6" "SCD 0000:06:00.0 SMBus master 0 bus 5" +bus "i2c-7" "SCD 0000:06:00.0 SMBus master 0 bus 6" +bus "i2c-8" "SCD 0000:06:00.0 SMBus master 0 bus 7" +bus "i2c-81" "SCD 0000:ff:0b.3 SMBus master 0 bus 0" +bus "i2c-93" "SCD 0000:ff:0b.3 SMBus master 3 bus 0" +bus "i2c-96" "SCD 0000:ff:0b.3 SMBus master 3 bus 3" + +chip "max6658-i2c-8-4c" + label temp1 "Temp sensor near ASIC" + + set temp1_max 100 + set temp1_crit 110 + + ignore temp2 + +chip "dps1900-i2c-6-58" + label temp1 "PSU1 primary hotspot temp" + label temp2 "PSU1 inlet temp" + label temp3 "PSU1 exhaust temp" + + # setting maximum and critical thresholds is not supported for this psu + # fault and warning limits defined internally by hardware + + ignore fan2 + ignore fan3 + +chip "dps1900-i2c-7-58" + label temp1 "PSU2 primary hotspot temp" + label temp2 "PSU2 inlet temp" + label temp3 "PSU2 exhaust temp" + + # setting maximum and critical thresholds is not supported for this psu + # fault and warning limits defined internally by hardware + + ignore fan2 + ignore fan3 + +chip "max6658-i2c-81-4c" + label temp1 "Rear air temp1" + label temp2 "Rear air temp2" + + set temp1_max 50 + set temp1_crit 60 + set temp2_max 50 + set temp2_crit 60 + +chip "lm73-i2c-96-48" + label temp1 "Front air temp" + + set temp1_max 65 diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index ee77746676e0..ab2cdedb6383 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -169,6 +169,11 @@ platform_specific() { aboot_machine=arista_7260cx3_64 flash_size=28000 fi + if [ "$sid" = "Alhambra" ] || [ "$sid" = "AlhambraSsd" ]; then + aboot_machine=arista_7170_64c + flash_size=28000 + echo "hugepages=128" >> /tmp/append + fi if [ "$platform" = "rook" ]; then if [ -x /bin/readprefdl ]; then readprefdl -f /tmp/.system-prefdl -d > /mnt/flash/.system-prefdl @@ -176,6 +181,7 @@ platform_specific() { cp /etc/prefdl /mnt/flash/.system-prefdl chmod a+r /mnt/flash/.system-prefdl fi + echo "reassign_prefmem" >> /tmp/append fi if [ $flash_size -ge 28000 ]; then diff --git a/platform/p4/one-aboot.mk b/platform/p4/one-aboot.mk new file mode 100644 index 000000000000..95babf045c00 --- /dev/null +++ b/platform/p4/one-aboot.mk @@ -0,0 +1,12 @@ +# sonic broadcom one image installer + +SONIC_ONE_ABOOT_IMAGE = sonic-aboot-p4.swi +$(SONIC_ONE_ABOOT_IMAGE)_MACHINE = p4 +$(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_DRIVERS) $(ARISTA_PLATFORM_MODULE_PYTHON2) $(ARISTA_PLATFORM_MODULE_PYTHON3) $(ARISTA_PLATFORM_MODULE) + +# FIXME: this is a temporary workaround for testing the platform driver +$(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += docker-platform-monitor.gz +# $(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) + +SONIC_INSTALLERS += $(SONIC_ONE_ABOOT_IMAGE) diff --git a/platform/p4/platform-modules-arista.mk b/platform/p4/platform-modules-arista.mk new file mode 100644 index 000000000000..ec7566318c8d --- /dev/null +++ b/platform/p4/platform-modules-arista.mk @@ -0,0 +1,22 @@ +# Arista Platform modules + +ARISTA_PLATFORM_MODULE_VERSION = 1.0 + +export ARISTA_PLATFORM_MODULE_VERSION + +ARISTA_PLATFORM_MODULE = sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb +$(ARISTA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-arista +$(ARISTA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_MAKE_DEBS += $(ARISTA_PLATFORM_MODULE) + +ARISTA_PLATFORM_MODULE_PYTHON2 = python-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON2))) + +ARISTA_PLATFORM_MODULE_PYTHON3 = python3-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON3))) + +ARISTA_PLATFORM_MODULE_DRIVERS = drivers-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_DRIVERS))) + +export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MODULE_PYTHON3 ARISTA_PLATFORM_MODULE_DRIVERS + diff --git a/platform/p4/rules.mk b/platform/p4/rules.mk index 7fe6a60fadac..ea3e31e973e2 100644 --- a/platform/p4/rules.mk +++ b/platform/p4/rules.mk @@ -1,4 +1,6 @@ # include $(PLATFORM_PATH)/p4-softswitch.mk +include $(PLATFORM_PATH)/platform-modules-arista.mk +include $(PLATFORM_PATH)/one-aboot.mk include $(PLATFORM_PATH)/tenjin.mk include $(PLATFORM_PATH)/p4-hlir.mk include $(PLATFORM_PATH)/p4c-bm.mk diff --git a/platform/p4/sonic-platform-modules-arista b/platform/p4/sonic-platform-modules-arista new file mode 160000 index 000000000000..02b22ae91135 --- /dev/null +++ b/platform/p4/sonic-platform-modules-arista @@ -0,0 +1 @@ +Subproject commit 02b22ae91135d4e4a9e11e06656dcff3056e2c7f From 3950da10e0b3b64bd26c5cacab1d63e641032957 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 4 Jul 2018 20:15:03 +0300 Subject: [PATCH 1404/1833] [sonic-swss]: Update submodule pointer (#1843) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 90ea7a41adfd..22bb2cdf461d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 90ea7a41adfdeef69ec20db498f6b737e258cf71 +Subproject commit 22bb2cdf461d7456293219fada0998acad2bfe74 From 26afa348ea394b211a757c89d60f40fd0ce560f2 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Thu, 5 Jul 2018 14:30:57 -0700 Subject: [PATCH 1405/1833] [device] Misc fixes for Arista platforms (#1844) * Update sensors.conf for 7050QX-32 and 7050QX-32S These two platforms were using a previous version of a kernel driver. The new one names the i2c buses differently. We therefore need to rename them here. * Fix the default minigraph for the 7050QX-32S The interface offset is invalid which makes sonic-cfggen generate an invalid config_db.jon in rc.local. This config then silently makes orchagent/syncd fail. * Use the partition on which sonic-aboot.swi is Instead of always assuming /mnt/flash, use the partition where the image to be installed lies. This allow for the image to be on any partition. --- .../x86_64-arista_7050_qx32/sensors.conf | 10 +- .../x86_64-arista_7050_qx32s/minigraph.xml | 903 +----------------- .../x86_64-arista_7050_qx32s/sensors.conf | 10 +- files/initramfs-tools/arista-convertfs.j2 | 13 +- 4 files changed, 50 insertions(+), 886 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/sensors.conf b/device/arista/x86_64-arista_7050_qx32/sensors.conf index 469f63eaf1e4..481c9ec30114 100644 --- a/device/arista/x86_64-arista_7050_qx32/sensors.conf +++ b/device/arista/x86_64-arista_7050_qx32/sensors.conf @@ -2,11 +2,11 @@ # ------------------------------------------------ # -bus "i2c-2" "SCD SMBus master 0 bus 0" -bus "i2c-3" "SCD SMBus master 0 bus 1" -bus "i2c-5" "SCD SMBus master 0 bus 3" -bus "i2c-6" "SCD SMBus master 0 bus 4" -bus "i2c-7" "SCD SMBus master 0 bus 5" +bus "i2c-2" "SCD 0000:04:00.0 SMBus master 0 bus 0" +bus "i2c-3" "SCD 0000:04:00.0 SMBus master 0 bus 1" +bus "i2c-5" "SCD 0000:04:00.0 SMBus master 0 bus 3" +bus "i2c-6" "SCD 0000:04:00.0 SMBus master 0 bus 4" +bus "i2c-7" "SCD 0000:04:00.0 SMBus master 0 bus 5" chip "k10temp-pci-00c3" label temp1 "Cpu temp sensor" diff --git a/device/arista/x86_64-arista_7050_qx32s/minigraph.xml b/device/arista/x86_64-arista_7050_qx32s/minigraph.xml index f28c9a9ae6cb..f8b99096ab24 100644 --- a/device/arista/x86_64-arista_7050_qx32s/minigraph.xml +++ b/device/arista/x86_64-arista_7050_qx32s/minigraph.xml @@ -2,623 +2,8 @@ - - 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 - -
@@ -645,162 +30,162 @@ - Ethernet1/1 + Ethernet5/1 10.0.0.0/31 - Ethernet2/1 + Ethernet6/1 10.0.0.2/31 - Ethernet3/1 + Ethernet7/1 10.0.0.4/31 - Ethernet4/1 + Ethernet8/1 10.0.0.6/31 - Ethernet5/1 + Ethernet9/1 10.0.0.8/31 - Ethernet6/1 + Ethernet10/1 10.0.0.10/31 - Ethernet7/1 + Ethernet11/1 10.0.0.12/31 - Ethernet8/1 + Ethernet12/1 10.0.0.14/31 - Ethernet9/1 + Ethernet13/1 10.0.0.16/31 - Ethernet10/1 + Ethernet14/1 10.0.0.18/31 - Ethernet11/1 + Ethernet15/1 10.0.0.20/31 - Ethernet12/1 + Ethernet16/1 10.0.0.22/31 - Ethernet13/1 + Ethernet17/1 10.0.0.24/31 - Ethernet14/1 + Ethernet18/1 10.0.0.26/31 - Ethernet15/1 + Ethernet19/1 10.0.0.28/31 - Ethernet16/1 + Ethernet20/1 10.0.0.30/31 - Ethernet17/1 + Ethernet21/1 10.0.0.32/31 - Ethernet18/1 + Ethernet22/1 10.0.0.34/31 - Ethernet19/1 + Ethernet23/1 10.0.0.36/31 - Ethernet20/1 + Ethernet24/1 10.0.0.38/31 - Ethernet21/1 + Ethernet25/1 10.0.0.40/31 - Ethernet22/1 + Ethernet26/1 10.0.0.42/31 - Ethernet23/1 + Ethernet27/1 10.0.0.44/31 - Ethernet24/1 + Ethernet28/1 10.0.0.46/31 - Ethernet25 + Ethernet29 10.0.0.48/31 - Ethernet26 + Ethernet30 10.0.0.50/31 - Ethernet27 + Ethernet31 10.0.0.52/31 - Ethernet28 + Ethernet32 10.0.0.54/31 - Ethernet29 + Ethernet33 10.0.0.56/31 - Ethernet30 + Ethernet34 10.0.0.58/31 - Ethernet31 + Ethernet35 10.0.0.60/31 - Ethernet32 + Ethernet36 10.0.0.62/31 @@ -812,230 +197,6 @@ - - DeviceInterfaceLink - sonic - Ethernet1/1 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet2/1 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet3/1 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4/1 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet5/1 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet6/1 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet7/1 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8/1 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet9/1 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet10/1 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet11/1 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12/1 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet13/1 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet14/1 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet15/1 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16/1 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet17/1 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet18/1 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet19/1 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20/1 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet21/1 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet22/1 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet23/1 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24/1 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet25 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet26 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet27 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet29 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet30 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet31 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA16T0 - Ethernet1 - diff --git a/device/arista/x86_64-arista_7050_qx32s/sensors.conf b/device/arista/x86_64-arista_7050_qx32s/sensors.conf index 9c2dd38597a3..6030de90eea5 100644 --- a/device/arista/x86_64-arista_7050_qx32s/sensors.conf +++ b/device/arista/x86_64-arista_7050_qx32s/sensors.conf @@ -2,11 +2,11 @@ # ------------------------------------------------ # -bus "i2c-2" "SCD SMBus master 0 bus 0" -bus "i2c-3" "SCD SMBus master 0 bus 1" -bus "i2c-5" "SCD SMBus master 0 bus 3" -bus "i2c-6" "SCD SMBus master 0 bus 4" -bus "i2c-7" "SCD SMBus master 0 bus 5" +bus "i2c-2" "SCD 0000:02:00.0 SMBus master 0 bus 0" +bus "i2c-3" "SCD 0000:02:00.0 SMBus master 0 bus 1" +bus "i2c-5" "SCD 0000:02:00.0 SMBus master 0 bus 3" +bus "i2c-6" "SCD 0000:02:00.0 SMBus master 0 bus 4" +bus "i2c-7" "SCD 0000:02:00.0 SMBus master 0 bus 5" chip "k10temp-pci-00c3" label temp1 "Cpu temp sensor" diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index dfd2fc1d7407..cd3b381aa276 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -105,6 +105,7 @@ for x in "$@"; do loop=*) x1="${x#loop=}" image_dir="${x1%/*}" + ;; esac done root_dev="$ROOT" @@ -168,12 +169,14 @@ umount "$root_mnt" #### Lines below will modify the root file system, so any failure will be trapped to shell for manual interventions. -# Create a new partition table (content in flash_dev will be deleted) -err_msg="Error: repartitioning $flash_dev failed" -cmd="echo ';' | sfdisk $flash_dev || (sleep 3; blockdev --rereadpt $flash_dev && fdisk -l $flash_dev | grep -q ${root_dev}.*Linux)" -run_cmd "$cmd" "$err_msg" +if [ $(echo -n "$root_dev" | tail -c 1) == "1" ]; then + # Create a new partition table (content in flash_dev will be deleted) + err_msg="Error: repartitioning $flash_dev failed" + cmd="echo ';' | sfdisk $flash_dev || (sleep 3; blockdev --rereadpt $flash_dev && fdisk -l $flash_dev | grep -q ${root_dev}.*Linux)" + run_cmd "$cmd" "$err_msg" +fi -sleep 5 +sleep 2 err_msg="Error: timeout in waiting for $root_dev after repartition" cmd="wait_for_root_dev" run_cmd "$cmd" "$err_msg" From a8af2e57f0d1ff377338b69ae6e51c9eadba2b94 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 6 Jul 2018 02:50:42 -0700 Subject: [PATCH 1406/1833] [sonic_debian_extension.j2] Create /var/cache/sonic/ directory (#1845) --- files/build_templates/sonic_debian_extension.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index d12c5a45f9de..ad22394ff000 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -58,6 +58,7 @@ sudo cp $IMAGE_CONFIGS/environment/motd $FILESYSTEM_ROOT/etc/ # Create all needed directories sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ +sudo mkdir -p $FILESYSTEM_ROOT/var/cache/sonic/ sudo mkdir -p $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ # Install dependencies for SONiC config engine From 51bfc2ebd592fcf653d103b6e559dfc2b56de636 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Fri, 6 Jul 2018 09:30:53 -0700 Subject: [PATCH 1407/1833] [SAI] update SAI header to 1.3 (#1778) --- platform/broadcom/libsaithrift-dev.mk | 2 +- platform/broadcom/python-saithrift.mk | 2 +- platform/broadcom/sai.mk | 8 ++++---- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/libsaithrift-dev.mk b/platform/broadcom/libsaithrift-dev.mk index d5b2c8d35dd0..1c38f0edc7d3 100644 --- a/platform/broadcom/libsaithrift-dev.mk +++ b/platform/broadcom/libsaithrift-dev.mk @@ -1,6 +1,6 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_BRCM = libsaithrift-dev_1.2.1_amd64.deb +LIBSAITHRIFT_DEV_BRCM = libsaithrift-dev_1.3.0_amd64.deb $(LIBSAITHRIFT_DEV_BRCM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_BRCM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(BRCM_SAI) $(BRCM_SAI_DEV) $(LIBSAITHRIFT_DEV_BRCM)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) diff --git a/platform/broadcom/python-saithrift.mk b/platform/broadcom/python-saithrift.mk index 5f9b88eafea4..53456e06ddb6 100644 --- a/platform/broadcom/python-saithrift.mk +++ b/platform/broadcom/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_BRCM = python-saithrift_1.2.1_amd64.deb +PYTHON_SAITHRIFT_BRCM = python-saithrift_1.3.0_amd64.deb $(PYTHON_SAITHRIFT_BRCM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_BRCM)_DEPENDS += $(BRCM_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_BRCM) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 5cda170b3391..cd2f570f20e6 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.4-15_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.4-15_amd64.deb?sv=2015-04-05&sr=b&sig=7CIkdlBB%2BY6Xjae0vc1QBnlAVedRkreJRhWM93SyHOI%3D&se=2032-02-29T18%3A31%3A54Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.5_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.5_amd64.deb?sv=2015-04-05&sr=b&sig=ui%2FF8c4fZOCqWp6KkYLvsJrJtfuWVmBCQkQWJgcyD%2FE%3D&se=2032-03-13T22%3A02%3A37Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.4-15_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.4-15_amd64.deb?sv=2015-04-05&sr=b&sig=rBOT802o1o%2BAcogaXq%2FgqyuTAmSlFKhtPzYM%2BtXlIdM%3D&se=2032-02-29T18%3A34%3A10Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.5_amd64.deb?sv=2015-04-05&sr=b&sig=Yk%2Bg8x84m8MBFJKSVmoPAkPFR6BCqmTrGlLY89JXGe8%3D&se=2032-03-13T22%3A03%3A27Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 5fee797a1d2a..8585fc84d422 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 5fee797a1d2ae4d4ba7d7c7ea8cc79578f5c19f5 +Subproject commit 8585fc84d422abf74d472702de7ad5ab20aa55e5 diff --git a/src/sonic-swss b/src/sonic-swss index 22bb2cdf461d..19f910864157 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 22bb2cdf461d7456293219fada0998acad2bfe74 +Subproject commit 19f9108641571ee38903bb4ad9fb6969a7f0437e From 7c632a903a6e14dc261f5321bbf02733af619801 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Sat, 7 Jul 2018 16:58:39 -0700 Subject: [PATCH 1408/1833] [swss]: sonic-swss submodule update (#1847) Fixes in bufferorchs ready_lists --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 19f910864157..5d31b2db4557 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 19f9108641571ee38903bb4ad9fb6969a7f0437e +Subproject commit 5d31b2db455763eafce8ac6fac2a137d9e3bd2c4 From 48e3e15f526c605875ebf5be916d63fcf7eadd8f Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 8 Jul 2018 11:32:17 -0700 Subject: [PATCH 1409/1833] [broadcom]: update sai.mk (#1850) * Add function pointers for extended get stats API Signed-off-by: Guohan Lu --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index cd2f570f20e6..ffa6bd6182ef 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.5_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.5_amd64.deb?sv=2015-04-05&sr=b&sig=ui%2FF8c4fZOCqWp6KkYLvsJrJtfuWVmBCQkQWJgcyD%2FE%3D&se=2032-03-13T22%3A02%3A37Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.5-1_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.5-1_amd64.deb?sv=2015-04-05&sr=b&sig=iakBOA9VRsMmdbZWDEsQNLix%2B41gnnVX75YV%2F7VGqNU%3D&se=2155-05-31T10%3A05%3A28Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-1_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.5_amd64.deb?sv=2015-04-05&sr=b&sig=Yk%2Bg8x84m8MBFJKSVmoPAkPFR6BCqmTrGlLY89JXGe8%3D&se=2032-03-13T22%3A03%3A27Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.5-1_amd64.deb?sv=2015-04-05&sr=b&sig=XipVKYmbKC%2BjrKc67BPoqhXiVSU5IF6PiF37P%2BxRxMk%3D&se=2155-05-31T10%3A07%3A38Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From a0bd65623d2db0625277758dccf28b1897a88411 Mon Sep 17 00:00:00 2001 From: Harish Venkatraman Date: Mon, 9 Jul 2018 18:02:49 -0700 Subject: [PATCH 1410/1833] [device/dell] Update Shared headroom values (#1846) This commit updates the shared headroom value for z9100 T0 and T1 profile based on the ratio. The ratio is derived from the 40G broadcom recommended XL Sheet. Unit tested the above configuration by dumping the registers for the shared headroom. The shared headroom values in registers reflects the correct new values for both T1 and T0. Signed-off-by: Harish Venkatraman --- .../Force10-Z9100-T0/buffers_defaults_t0.j2 | 2 +- .../Force10-Z9100/buffers_defaults_t1.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers_defaults_t0.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers_defaults_t0.j2 index 77c5761b9b30..83d99c78201b 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers_defaults_t0.j2 +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/buffers_defaults_t0.j2 @@ -28,7 +28,7 @@ "size": "11213696", "type": "ingress", "mode": "dynamic", - "xoff": "8356608" + "xoff": "6387264" }, "egress_lossy_pool": { "size": "9532224", diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers_defaults_t1.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers_defaults_t1.j2 index 5c654ab9e8a1..912f72a4c07c 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers_defaults_t1.j2 +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/buffers_defaults_t1.j2 @@ -14,7 +14,7 @@ "size": "10443264", "type": "ingress", "mode": "dynamic", - "xoff": "4625920" + "xoff": "7335744" }, "egress_lossy_pool": { "size": "8877440", From a6b5acb50468620cf60af0c98f98a412ebfb44b3 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 11 Jul 2018 18:41:29 +0300 Subject: [PATCH 1411/1833] [mellanox]: Update MFT tools to v4.9.0 (#1851) Signed-off-by: Andriy Moroz --- platform/mellanox/mft.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index 1c84d3a66cd9..9f9c65ec5176 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MFT_VERSION = 4.5.0 -MFT_REVISION = 31 +MFT_VERSION = 4.9.0 +MFT_REVISION = 38 export MFT_VERSION MFT_REVISION From 3d043a18e8246788e2671cd2274244683e790c80 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 11 Jul 2018 18:42:15 +0300 Subject: [PATCH 1412/1833] [mellanox]: Update SAI pointer to 1.3 (#1852) Signed-off-by: Volodymyr Samotiy --- platform/mellanox/libsaithrift-dev.mk | 2 +- platform/mellanox/mlnx-sai.mk | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/mellanox/libsaithrift-dev.mk b/platform/mellanox/libsaithrift-dev.mk index e91252e5ab0e..23133a5b5aeb 100644 --- a/platform/mellanox/libsaithrift-dev.mk +++ b/platform/mellanox/libsaithrift-dev.mk @@ -1,6 +1,6 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_MLNX = libsaithrift-dev_1.2.1_amd64.deb +LIBSAITHRIFT_DEV_MLNX = libsaithrift-dev_1.3.0_amd64.deb $(LIBSAITHRIFT_DEV_MLNX)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_MLNX)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(MLNX_SAI) $(MLNX_SAI_DEV) $(LIBSAITHRIFT_DEV_MLNX)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 5b2994360621..e22705a88e3a 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.12.0-master -MLNX_SAI_REVISION = 5be04c71508e0688ae004ed838b998dba521f693 +MLNX_SAI_VERSION = SAIRel1.12.1-master +MLNX_SAI_REVISION = fe6e9d418223de9debd5348bb61af514b1df15f5 export MLNX_SAI_VERSION MLNX_SAI_REVISION From f598397b07103f9ec49103e47e4ed274bf2aa34b Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 12 Jul 2018 01:52:19 -0700 Subject: [PATCH 1413/1833] Pavelsh/restart swss counters (#1854) * sonic-quagga update. Don't spam with 'Vtysh connected from' message * Restart counters in 60 seconds after manual swss restart --- files/build_templates/enable_counters.service | 3 ++- files/build_templates/enable_counters.timer | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/files/build_templates/enable_counters.service b/files/build_templates/enable_counters.service index f19249369f87..95424474cb15 100644 --- a/files/build_templates/enable_counters.service +++ b/files/build_templates/enable_counters.service @@ -1,7 +1,8 @@ [Unit] Description=Enable SONiC counters +PartOf=swss.service [Service] Type=oneshot -ExecStart=/bin/bash -c '/usr/bin/counterpoll queue enable ; /usr/bin/counterpoll port enable ; /usr/bin/pfcwd counter_poll enable' +ExecStart=/bin/bash -c 'sleep 60 ; /usr/bin/counterpoll queue enable ; /usr/bin/counterpoll port enable ; /usr/bin/pfcwd counter_poll enable' RemainAfterExit=yes diff --git a/files/build_templates/enable_counters.timer b/files/build_templates/enable_counters.timer index 7382a1658c1b..40a91525a712 100644 --- a/files/build_templates/enable_counters.timer +++ b/files/build_templates/enable_counters.timer @@ -2,7 +2,7 @@ Description=Delays the SONiC counters gathering until SONiC has started [Timer] -OnBootSec=3min +OnBootSec=2min Unit=enable_counters.service [Install] From daf590e6777b81fc06abd19baa10f2b52670267e Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 12 Jul 2018 01:52:38 -0700 Subject: [PATCH 1414/1833] [broadcom sai] update Broadcom SDK/SAI version (#1853) Signed-off-by: Ying Xie --- platform/broadcom/sai.mk | 8 ++++---- platform/broadcom/sdk.mk | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index ffa6bd6182ef..99f26493cd90 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.5-1_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.5-1_amd64.deb?sv=2015-04-05&sr=b&sig=iakBOA9VRsMmdbZWDEsQNLix%2B41gnnVX75YV%2F7VGqNU%3D&se=2155-05-31T10%3A05%3A28Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.5-2_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.5-2_amd64.deb?sv=2015-04-05&sr=b&sig=wAXRViJp5SZtlHqEZVeAHZ0b%2F8Cfxw0QIjCaAigWS2s%3D&se=2032-03-19T18%3A25%3A07Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-1_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-2_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.5-1_amd64.deb?sv=2015-04-05&sr=b&sig=XipVKYmbKC%2BjrKc67BPoqhXiVSU5IF6PiF37P%2BxRxMk%3D&se=2155-05-31T10%3A07%3A38Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.5-2_amd64.deb?sv=2015-04-05&sr=b&sig=1LqBLe%2BPNHyVmcaes21TMuZ8VoUS%2FDIuGS5Vzn9N8L4%3D&se=2032-03-19T18%3A25%3A53Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 05d51fc28d07..2ffa374b1ba5 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,4 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-5-amd64_3.4.1.11-2_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-5-amd64_3.4.1.11-2_amd64.deb?sv=2015-04-05&sr=b&sig=xtf8nafmS1pcqx5hhBsfmLNSx2BeqmwN4Dwq5uwM1bo%3D&se=2031-11-16T21%3A54%3A27Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-5-amd64_3.4.1.11-5_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-5-amd64_3.4.1.11-5_amd64.deb?sv=2015-04-05&sr=b&sig=VefDUeIdEvgV1007LX9P3aRmMAeO4hnMcIAyXkOBEp8%3D&se=2032-03-19T18%3A23%3A58Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) From eb3ef2f7e82917a9707f5aaefdc476b930629225 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 12 Jul 2018 21:40:58 -0700 Subject: [PATCH 1415/1833] [mellanox]: fix mellanox SAI 1.3 build issue (#1859) --- platform/mellanox/python-saithrift.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/python-saithrift.mk b/platform/mellanox/python-saithrift.mk index de4b02369b84..5f9d22a238c4 100644 --- a/platform/mellanox/python-saithrift.mk +++ b/platform/mellanox/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_MLNX = python-saithrift_1.2.1_amd64.deb +PYTHON_SAITHRIFT_MLNX = python-saithrift_1.3.0_amd64.deb $(PYTHON_SAITHRIFT_MLNX)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_MLNX)_DEPENDS += $(MLNX_SAI_DEV) $(MLNX_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MLNX) From 5e6d36c2a522744a67e5780c05d86993c69fe43f Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 13 Jul 2018 00:07:30 -0700 Subject: [PATCH 1416/1833] [vs]: set platform=vs for orchagent (#1860) Signed-off-by: Guohan Lu --- platform/vs/docker-sonic-vs/orchagent.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/vs/docker-sonic-vs/orchagent.sh b/platform/vs/docker-sonic-vs/orchagent.sh index 7e250dfa20e9..26dae28a6e15 100755 --- a/platform/vs/docker-sonic-vs/orchagent.sh +++ b/platform/vs/docker-sonic-vs/orchagent.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash +export platform=vs + MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` -# Create a folder for SsWW record files +# Create a folder for SwSS record files mkdir -p /var/log/swss ORCHAGENT_ARGS="-d /var/log/swss " From 1a93dd548dc6d88afc3e4177984c8f3a7a5b36a7 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 13 Jul 2018 02:18:21 -0700 Subject: [PATCH 1417/1833] [sonic-dbsyncd]: Support empty string in lldp_rem_port_desc (#1857) Signed-off-by: Qi Luo --- src/sonic-dbsyncd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd index 1d0b2165e097..a091914b4e6d 160000 --- a/src/sonic-dbsyncd +++ b/src/sonic-dbsyncd @@ -1 +1 @@ -Subproject commit 1d0b2165e097ee668c8e982cf3cf413e4f2555d2 +Subproject commit a091914b4e6dd6ee85131106a1da1bdf036a5912 From 2ccfefc919edde1a454c376a13f2269c642e8a3b Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 13 Jul 2018 10:27:47 -0700 Subject: [PATCH 1418/1833] [caclmgrd] Add a rule to allow all connections from localhost (#1858) --- files/image_config/caclmgrd/caclmgrd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/image_config/caclmgrd/caclmgrd b/files/image_config/caclmgrd/caclmgrd index ec26b6001f50..a7ec952ca21f 100755 --- a/files/image_config/caclmgrd/caclmgrd +++ b/files/image_config/caclmgrd/caclmgrd @@ -147,6 +147,10 @@ class ControlPlaneAclManager(object): iptables_cmds.append("ip6tables -F") iptables_cmds.append("ip6tables -X") + # Add iptables commands to allow all IPv4 and IPv6 traffic from localhost + iptables_cmds.append("iptables -A INPUT -s 127.0.0.1 -i lo -j ACCEPT") + iptables_cmds.append("ip6tables -A INPUT -s ::1 -i lo -j ACCEPT") + # Get current ACL tables and rules from Config DB self._tables_db_info = self.config_db.get_table(self.ACL_TABLE) self._rules_db_info = self.config_db.get_table(self.ACL_RULE) From 2944f3e3cb6bae69ef54ac9cbd960a4509047322 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 13 Jul 2018 13:43:16 -0700 Subject: [PATCH 1419/1833] [swss]: sonic-swss submodule update (#1856) * [swss]: sonic-swss submodule update Signed-off-by: Guohan Lu * [broadcom]: update sai.mk Signed-off-by: Guohan Lu --- platform/broadcom/sai.mk | 8 ++++---- src/sonic-swss | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 99f26493cd90..611592c98182 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.5-2_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.5-2_amd64.deb?sv=2015-04-05&sr=b&sig=wAXRViJp5SZtlHqEZVeAHZ0b%2F8Cfxw0QIjCaAigWS2s%3D&se=2032-03-19T18%3A25%3A07Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.5-3_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.5-3_amd64.deb?sv=2015-04-05&sr=b&sig=lzB9IHpJuMEENr9N9W0LBFamJ7mpvRVWgigfQmpIrPc%3D&se=2155-06-05T09%3A13%3A41Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-2_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-3_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.5-2_amd64.deb?sv=2015-04-05&sr=b&sig=1LqBLe%2BPNHyVmcaes21TMuZ8VoUS%2FDIuGS5Vzn9N8L4%3D&se=2032-03-19T18%3A25%3A53Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.5-3_amd64.deb?sv=2015-04-05&sr=b&sig=WoRAz6j8G3Xk%2BT3MOmhp5f%2BvWggw%2BgGgk2JtDJHkKjs%3D&se=2155-06-05T09%3A14%3A46Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/src/sonic-swss b/src/sonic-swss index 5d31b2db4557..762e7da80142 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 5d31b2db455763eafce8ac6fac2a137d9e3bd2c4 +Subproject commit 762e7da80142358af0d348dea1143f38aa60a992 From 015d2d1d09044ed94568d4df4c20e5d448d3f8c1 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 13 Jul 2018 16:58:46 -0700 Subject: [PATCH 1420/1833] [sonic-dbsyncd]: Fix parse_chassis on partial lldp data (#1861) --- src/sonic-dbsyncd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd index a091914b4e6d..94f2700f67f8 160000 --- a/src/sonic-dbsyncd +++ b/src/sonic-dbsyncd @@ -1 +1 @@ -Subproject commit a091914b4e6dd6ee85131106a1da1bdf036a5912 +Subproject commit 94f2700f67f87b431c7ce45e4b9d7788707c6732 From 1955a430556afed48ad0bf87ce07f6e5b70cdfbb Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 14 Jul 2018 15:55:58 -0700 Subject: [PATCH 1421/1833] [vs]: clean up process running in server namespace for vstests (#1862) Signed-off-by: Guohan Lu --- platform/vs/tests/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/vs/tests/conftest.py b/platform/vs/tests/conftest.py index 0752b86fde1b..9256597f5e37 100644 --- a/platform/vs/tests/conftest.py +++ b/platform/vs/tests/conftest.py @@ -90,6 +90,11 @@ def __init__(self, ctn_name, pid, i): def __del__(self): if self.cleanup: + pids = subprocess.check_output("ip netns pids %s" % (self.nsname), shell=True) + if pids: + for pid in pids.split('\n'): + if len(pid) > 0: + os.system("kill %s" % int(pid)) os.system("ip netns delete %s" % self.nsname) def runcmd(self, cmd): From 00083471ec097aea0f746c7c9ac866080ddf1a70 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Tue, 17 Jul 2018 11:13:11 -0700 Subject: [PATCH 1422/1833] [sonic-utilities]: update submodule (#1865) Signed-off-by: Sihui Han --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 9c4c3620e4fb..4a36190b0bd7 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 9c4c3620e4fb488325e9d146c8b312ae8bb95c15 +Subproject commit 4a36190b0bd7f8e551431af6804060d5cf8ab26a From f033cbe29662d9a5f15922d60e1982ccb3e1b58a Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 18 Jul 2018 09:38:41 -0700 Subject: [PATCH 1423/1833] [bcm syncd]: Wait initializing led_proc for 60 seconds (#1863) * Wait initializing led_proc for 60 seconds. bcm sdk need time to be ready accept a connection --- platform/broadcom/docker-syncd-brcm/start.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index 4f027256a022..cc0a0948e9aa 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -34,5 +34,6 @@ wait_syncd() { # If this platform has an initialization file for the Broadcom LED microprocessor, load it if [ -r ${PLATFORM_DIR}/led_proc_init.soc ]; then wait_syncd + sleep 60 # wait until bcm sdk is ready to get a request supervisorctl start ledinit fi From c52fb762dd30a17b3181a9084ef844b3799e09ce Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 18 Jul 2018 13:04:57 -0700 Subject: [PATCH 1424/1833] Convert arp_update into a 'start-it-once' mode (#1864) * Run arp_update just once, don't restart it. It will run continuosly with 5 min pauses --- dockers/docker-orchagent/supervisord.conf | 4 ++-- files/scripts/arp_update | 21 +++++++++++--------- platform/p4/docker-sonic-p4/supervisord.conf | 4 ++-- platform/vs/docker-sonic-vs/supervisord.conf | 4 ++-- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 84beaed440a3..dc28e3369ca5 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -61,10 +61,10 @@ stdout_logfile=syslog stderr_logfile=syslog [program:arp_update] -command=bash -c "/usr/bin/arp_update; sleep 300" +command=/usr/bin/arp_update priority=8 autostart=false -autorestart=true +autorestart=unexpected stdout_logfile=syslog stderr_logfile=syslog diff --git a/files/scripts/arp_update b/files/scripts/arp_update index cfd87c1dc51f..ab44ca6a4580 100755 --- a/files/scripts/arp_update +++ b/files/scripts/arp_update @@ -4,14 +4,17 @@ # arp_update: Send gratuitous ARP requests to VLAN member neighbors to refresh # the neighbors state. -VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` -for vlan in $VLAN; do - # generate a list of arping commands: - # arping -q -w 0 -c 1 -i ; - # arping -q -w 0 -c 1 -i ; - # ... - arpingcmd="sed -e 's/ / -i /' -e 's/^/arping -q -w 0 -c 1 /' -e 's/$/;/'" - ipcmd="ip -4 neigh show | grep $vlan | cut -d ' ' -f 1,3 | $arpingcmd" +while /bin/true; do + VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` + for vlan in $VLAN; do + # generate a list of arping commands: + # arping -q -w 0 -c 1 -i ; + # arping -q -w 0 -c 1 -i ; + # ... + arpingcmd="sed -e 's/ / -i /' -e 's/^/arping -q -w 0 -c 1 /' -e 's/$/;/'" + ipcmd="ip -4 neigh show | grep $vlan | cut -d ' ' -f 1,3 | $arpingcmd" - eval `eval $ipcmd` + eval `eval $ipcmd` + done + sleep 300 done diff --git a/platform/p4/docker-sonic-p4/supervisord.conf b/platform/p4/docker-sonic-p4/supervisord.conf index 46178e9f11f5..5815689f9301 100644 --- a/platform/p4/docker-sonic-p4/supervisord.conf +++ b/platform/p4/docker-sonic-p4/supervisord.conf @@ -133,9 +133,9 @@ stdout_logfile=syslog stderr_logfile=syslog [program:arp_update] -command=bash -c "/usr/bin/arp_update; sleep 300" +command=/usr/bin/arp_update priority=15 autostart=false -autorestart=true +autorestart=unexpected stdout_logfile=syslog stderr_logfile=syslog diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index 571c802cda1e..a4b24334d1bd 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -116,10 +116,10 @@ stdout_logfile=syslog stderr_logfile=syslog [program:arp_update] -command=bash -c "/usr/bin/arp_update; sleep 300" +command=/usr/bin/arp_update priority=15 autostart=false -autorestart=true +autorestart=unexpected stdout_logfile=syslog stderr_logfile=syslog From 0ec932234e8f8562548afd639759893344c7f35c Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Thu, 19 Jul 2018 22:04:28 +0700 Subject: [PATCH 1425/1833] Change dx010 console speed (#1867) --- device/celestica/x86_64-cel_seastone-r0/installer.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/installer.conf b/device/celestica/x86_64-cel_seastone-r0/installer.conf index 925a32fc0c3a..306c42218785 100644 --- a/device/celestica/x86_64-cel_seastone-r0/installer.conf +++ b/device/celestica/x86_64-cel_seastone-r0/installer.conf @@ -1,3 +1,3 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 -CONSOLE_SPEED=115200 +CONSOLE_SPEED=9600 From 927c41f26cb1312db336cc2864da9c86c1b3b018 Mon Sep 17 00:00:00 2001 From: simonJi2018 <37395146+simonJi2018@users.noreply.github.com> Date: Tue, 24 Jul 2018 01:44:26 +0800 Subject: [PATCH 1426/1833] [nephos]: add support sai 1.3.0 (#1868) * Upgrade SAI to v1.2.4 * Add a new supported device accton as7116 * Add maintainer info for deb * Add mk file for accton 7116 * fix some bug for sai 1.2.4 * fix git commit error for sdk and sai * change sai and sdk deb name * add config file for qos support * initial commit * Delete qos.json * Delete buffers.json.j2 * Delete qos.json * Delete buffers.json.j2 * Delete buffers.json.j2 * Delete qos.json * add support for sai 1.3.0 --- .../Accton-AS7116-54X/buffers.json.j2 | 1 - .../INGRASYS-S9130-32X/buffers.json.j2 | 1 - .../INGRASYS-S9230-64X/buffers.json.j2 | 1 - platform/nephos/libsaithrift-dev.mk | 2 +- platform/nephos/python-saithrift.mk | 2 +- platform/nephos/sai.mk | 8 ++++---- platform/nephos/sdk.mk | 4 ++-- 7 files changed, 8 insertions(+), 11 deletions(-) delete mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 delete mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 delete mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 deleted file mode 100644 index 9e26dfeeb6e6..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/platform/nephos/libsaithrift-dev.mk b/platform/nephos/libsaithrift-dev.mk index 067a64ed72c4..8eb11bbef4aa 100644 --- a/platform/nephos/libsaithrift-dev.mk +++ b/platform/nephos/libsaithrift-dev.mk @@ -1,6 +1,6 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_NEPHOS = libsaithrift-dev_1.2.1_amd64.deb +LIBSAITHRIFT_DEV_NEPHOS = libsaithrift-dev_1.3.0_amd64.deb $(LIBSAITHRIFT_DEV_NEPHOS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(LIBSAITHRIFT_DEV_NEPHOS)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(LIBSAITHRIFT_DEV_NEPHOS)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI) diff --git a/platform/nephos/python-saithrift.mk b/platform/nephos/python-saithrift.mk index 2eb1bbdc9b43..f9e934f6310d 100644 --- a/platform/nephos/python-saithrift.mk +++ b/platform/nephos/python-saithrift.mk @@ -1,6 +1,6 @@ # python-saithrift package -PYTHON_SAITHRIFT_NEPHOS = python-saithrift_1.2.1_amd64.deb +PYTHON_SAITHRIFT_NEPHOS = python-saithrift_1.3.0_amd64.deb $(PYTHON_SAITHRIFT_NEPHOS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI $(PYTHON_SAITHRIFT_NEPHOS)_DEPENDS += $(NEPHOS_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_NEPHOS) diff --git a/platform/nephos/sai.mk b/platform/nephos/sai.mk index 213692d0fe6a..9bb04931ef97 100644 --- a/platform/nephos/sai.mk +++ b/platform/nephos/sai.mk @@ -1,9 +1,9 @@ -NEPHOS_SAI = libsainps_2.0.3_sai_1.2.4_d15aca_amd64.deb -$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.3_sai_1.2.4_d15aca_amd64.deb" +NEPHOS_SAI = libsainps_2.0.3_sai_1.3.0_3147dc_amd64.deb +$(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_2.0.3_sai_1.3.0_3147dc_amd64.deb" -NEPHOS_SAI_DEV = libsainps-dev_2.0.3_sai_1.2.4_d15aca_amd64.deb +NEPHOS_SAI_DEV = libsainps-dev_2.0.3_sai_1.3.0_3147dc_amd64.deb $(eval $(call add_derived_package,$(NEPHOS_SAI),$(NEPHOS_SAI_DEV))) -$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.3_sai_1.2.4_d15aca_amd64.deb" +$(NEPHOS_SAI_DEV)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps-dev_2.0.3_sai_1.3.0_3147dc_amd64.deb" SONIC_ONLINE_DEBS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(NEPHOS_SAI_DEV)_DEPENDS += $(NEPHOS_SAI) diff --git a/platform/nephos/sdk.mk b/platform/nephos/sdk.mk index 92642a19d028..ce5748745242 100644 --- a/platform/nephos/sdk.mk +++ b/platform/nephos/sdk.mk @@ -1,4 +1,4 @@ -NEPHOS_NPS_KERNEL = nps-modules-3.16.0-5_2.0.3_d15aca_amd64.deb -$(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-3.16.0-5_2.0.3_d15aca_amd64.deb" +NEPHOS_NPS_KERNEL = nps-modules-3.16.0-5_2.0.3_3147dc_amd64.deb +$(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-3.16.0-5_2.0.3_3147dc_amd64.deb" SONIC_ONLINE_DEBS += $(NEPHOS_NPS_KERNEL) From dadc17d9e6c4bebe10078171e7e565d07e909c7c Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Tue, 24 Jul 2018 01:51:03 +0300 Subject: [PATCH 1427/1833] [Mellanox] Use MAC from EEPROM for PortChannels and VLAN Interfaces (#1793) * Use MAC from EEPROM for PortChannels Signed-off-by: Andriy Moroz * Use MAC from EEPROM in DEVICE_METADATA Will affect MAC for VLAN interfaces Signed-off-by: Andriy Moroz * Get MAC via decode-syseeprom Signed-off-by: Andriy Moroz * hw-management is now a service Signed-off-by: Andriy Moroz * Add error handling for MAC fetch process Signed-off-by: Andriy Moroz --- dockers/docker-teamd/start.sh | 7 ++- .../build_templates/sonic_debian_extension.j2 | 2 +- .../updategraph.service.j2} | 4 ++ platform/mellanox/.gitignore | 1 + .../Add-systemd-service-config.patch | 58 +++++++++++++++++++ platform/mellanox/hw-management/Makefile | 1 + slave.mk | 2 + src/sonic-config-engine/sonic_platform.py | 13 ++++- 8 files changed, 84 insertions(+), 4 deletions(-) rename files/{image_config/updategraph/updategraph.service => build_templates/updategraph.service.j2} (74%) create mode 100644 platform/mellanox/hw-management/Add-systemd-service-config.patch diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index 6e80f6eb9a83..fb3b7c3dadf8 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -6,7 +6,12 @@ rm -rf $TEAMD_CONF_PATH mkdir -p $TEAMD_CONF_PATH SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) -MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') + +if [ "$SONIC_ASIC_TYPE" == "mellanox" ]; then + MAC_ADDRESS=$(sonic-cfggen -d -v DEVICE_METADATA.localhost.mac) +else + MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') +fi # Align last byte if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index ad22394ff000..94be71a80935 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -162,7 +162,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostname-config.service sudo cp $IMAGE_CONFIGS/hostname/hostname-config.sh $FILESYSTEM_ROOT/usr/bin/ # Copy updategraph script and service file -sudo cp $IMAGE_CONFIGS/updategraph/updategraph.service $FILESYSTEM_ROOT/etc/systemd/system/ +j2 files/build_templates/updategraph.service.j2 | sudo tee $FILESYSTEM_ROOT/etc/systemd/system/updategraph.service sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable updategraph.service sudo cp $IMAGE_CONFIGS/updategraph/updategraph $FILESYSTEM_ROOT/usr/bin/ {% if enable_dhcp_graph_service == "y" %} diff --git a/files/image_config/updategraph/updategraph.service b/files/build_templates/updategraph.service.j2 similarity index 74% rename from files/image_config/updategraph/updategraph.service rename to files/build_templates/updategraph.service.j2 index ec478d93a132..8039f42531cd 100644 --- a/files/image_config/updategraph/updategraph.service +++ b/files/build_templates/updategraph.service.j2 @@ -3,6 +3,10 @@ Description=Update minigraph and set configuration based on minigraph After=rc-local.service After=database.service Requires=database.service +{% if sonic_asic_platform == 'mellanox' -%} +Requires=hw-management.service +{% endif -%} + [Service] Type=oneshot diff --git a/platform/mellanox/.gitignore b/platform/mellanox/.gitignore index 3c0769067437..ac1ce990d56d 100644 --- a/platform/mellanox/.gitignore +++ b/platform/mellanox/.gitignore @@ -3,6 +3,7 @@ mlnx-sai/* !mlnx-sai/Makefile hw-management/* !hw-management/Makefile +!hw-management/*.patch mft/* !mft/Makefile diff --git a/platform/mellanox/hw-management/Add-systemd-service-config.patch b/platform/mellanox/hw-management/Add-systemd-service-config.patch new file mode 100644 index 000000000000..4903f508bce6 --- /dev/null +++ b/platform/mellanox/hw-management/Add-systemd-service-config.patch @@ -0,0 +1,58 @@ +From 22fef644b1150677353ab0559828ea45a982d901 Mon Sep 17 00:00:00 2001 +From: Andriy Moroz +Date: Wed, 11 Jul 2018 16:51:07 +0300 +Subject: [PATCH] Add systemd service config + +Signed-off-by: Andriy Moroz +--- + debian/control | 2 +- + debian/hw-management.service | 10 ++++++++++ + debian/rules | 2 +- + 3 files changed, 12 insertions(+), 2 deletions(-) + create mode 100644 debian/hw-management.service + +diff --git a/debian/control b/debian/control +index 048cd61..7e3a545 100644 +--- a/debian/control ++++ b/debian/control +@@ -1,7 +1,7 @@ + Source: hw-management + Priority: extra + Maintainer: Adir Atias +-Build-Depends: ++Build-Depends: dh-systemd + Standards-Version: + Section: libs + Homepage: http://www.mellanox.com +diff --git a/debian/hw-management.service b/debian/hw-management.service +new file mode 100644 +index 0000000..d18916d +--- /dev/null ++++ b/debian/hw-management.service +@@ -0,0 +1,10 @@ ++[Unit] ++Description=Mellanox Hardware Management ++ ++[Service] ++Type=oneshot ++EnvironmentFile=/host/machine.conf ++ExecStart=/bin/bash -c "/usr/share/sonic/device/$onie_platform/hw-management start" ++ ++[Install] ++WantedBy=multi-user.target +diff --git a/debian/rules b/debian/rules +index fc38817..fba4150 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -8,7 +8,7 @@ K_SRC ?= "/lib/modules/$(KVERSION)/build" + pwd=$(shell pwd) + + %: +- dh $@ ++ dh $@ --with systemd + + override_dh_auto_configure: + +-- +1.9.1 + diff --git a/platform/mellanox/hw-management/Makefile b/platform/mellanox/hw-management/Makefile index ee2899d07c39..4fa5d2cf328c 100644 --- a/platform/mellanox/hw-management/Makefile +++ b/platform/mellanox/hw-management/Makefile @@ -10,6 +10,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # build pushd hw-management + git am ../*.patch sed "s~@SED_VERSION@~$(MLNX_HW_MANAGEMENT_VERSION)~" -i debian/changelog chmod +x ./debian/rules sudo ./debian/rules binary KVERSION=$(KVERSION) diff --git a/slave.mk b/slave.mk index 57e09d4c74ad..a4199bb1ebb6 100644 --- a/slave.mk +++ b/slave.mk @@ -494,6 +494,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ j2 -f env files/initramfs-tools/union-mount.j2 onie-image.conf > files/initramfs-tools/union-mount j2 -f env files/initramfs-tools/arista-convertfs.j2 onie-image.conf > files/initramfs-tools/arista-convertfs + j2 files/build_templates/updategraph.service.j2 > updategraph.service + $(if $($*_DOCKERS), j2 files/build_templates/sonic_debian_extension.j2 > sonic_debian_extension.sh chmod +x sonic_debian_extension.sh, diff --git a/src/sonic-config-engine/sonic_platform.py b/src/sonic-config-engine/sonic_platform.py index f573d6a6575d..55ad2325f5db 100644 --- a/src/sonic-config-engine/sonic_platform.py +++ b/src/sonic-config-engine/sonic_platform.py @@ -41,12 +41,21 @@ def get_sonic_version_info(): return data def get_system_mac(): - proc = subprocess.Popen("ip link show eth0 | grep ether | awk '{print $2}'", shell=True, stdout=subprocess.PIPE) + version_info = get_sonic_version_info() + + if (version_info['asic_type'] == 'mellanox'): + get_mac_cmd = "sudo decode-syseeprom -m" + else: + get_mac_cmd = "ip link show eth0 | grep ether | awk '{print $2}'" + + proc = subprocess.Popen(get_mac_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (mac, err) = proc.communicate() + if err: + return None + mac = mac.strip() # Align last byte of MAC if necessary - version_info = get_sonic_version_info() if version_info and (version_info['asic_type'] == 'mellanox' or version_info['asic_type'] == 'centec'): last_byte = mac[-2:] aligned_last_byte = format(int(int(last_byte, 16) & 0b11000000), '02x') From 76391ba5445c82a080d2feaa13b119db7ef4016c Mon Sep 17 00:00:00 2001 From: paavaanan Date: Tue, 24 Jul 2018 10:48:59 +0530 Subject: [PATCH 1428/1833] [devices]: Added sensors.conf for S6100/Z9100 platform (#1788) --- device/dell/x86_64-dell_s6100_c2538-r0/sensors.conf | 9 +++++++++ device/dell/x86_64-dell_z9100_c2538-r0/sensors.conf | 12 ++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/sensors.conf create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/sensors.conf diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/sensors.conf b/device/dell/x86_64-dell_s6100_c2538-r0/sensors.conf new file mode 100644 index 000000000000..43fa7357c177 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/sensors.conf @@ -0,0 +1,9 @@ +chip "SMF_S6100_ON-isa-0000" +label power1 "PSU1 Input Power" +label power2 "PSU1 Output Power" +label power3 "PSU2 Input Power" +label power4 "PSU2 Output Power" +label temp14 "PSU1 Temp" +label temp15 "PSU1 Temp" +ignore temp12 +ignore temp13 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/sensors.conf b/device/dell/x86_64-dell_z9100_c2538-r0/sensors.conf new file mode 100644 index 000000000000..31a656fcf0b3 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/sensors.conf @@ -0,0 +1,12 @@ +chip "SMF_Z9100_ON-isa-0000" +label power1 "PSU1 Input Power" +label power2 "PSU1 Output Power" +label power3 "PSU2 Input Power" +label power4 "PSU2 Output Power" +label temp14 "PSU1 Temp" +label temp15 "PSU1 Temp" +ignore temp12 +ignore temp13 +ignore temp5 +ignore temp7 +ignore temp8 From 216d2fadb8ff721be95c69a632c0222d9ae1ff72 Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Mon, 23 Jul 2018 22:19:45 -0700 Subject: [PATCH 1429/1833] [vs-test]: not forward routes with no-export community (#1869) * Revert "Revert "[vs-test]: not forward routes with no-export community (#1774)" (#1828)" This reverts commit 6459275397eee140892f583375558c51d7e7b613. * [no-export]: move no export test under bgp folder Signed-off-by: Sihui Han * [no-export]: increase wait time to avoid random failure Signed-off-by: Sihui Han --- .../bgp/files/{ => invalid_nexthop}/bgpd.conf | 0 .../invalid_nexthop.conf | 0 .../vs/tests/bgp/files/no_export/bgpd.conf | 13 ++++++ .../vs/tests/bgp/files/no_export/exabgp1.conf | 21 +++++++++ .../vs/tests/bgp/files/no_export/exabgp2.conf | 11 +++++ platform/vs/tests/bgp/test_invalid_nexthop.py | 4 +- platform/vs/tests/bgp/test_no_export.py | 45 +++++++++++++++++++ 7 files changed, 92 insertions(+), 2 deletions(-) rename platform/vs/tests/bgp/files/{ => invalid_nexthop}/bgpd.conf (100%) rename platform/vs/tests/bgp/files/{ => invalid_nexthop}/invalid_nexthop.conf (100%) create mode 100644 platform/vs/tests/bgp/files/no_export/bgpd.conf create mode 100644 platform/vs/tests/bgp/files/no_export/exabgp1.conf create mode 100644 platform/vs/tests/bgp/files/no_export/exabgp2.conf create mode 100644 platform/vs/tests/bgp/test_no_export.py diff --git a/platform/vs/tests/bgp/files/bgpd.conf b/platform/vs/tests/bgp/files/invalid_nexthop/bgpd.conf similarity index 100% rename from platform/vs/tests/bgp/files/bgpd.conf rename to platform/vs/tests/bgp/files/invalid_nexthop/bgpd.conf diff --git a/platform/vs/tests/bgp/files/invalid_nexthop.conf b/platform/vs/tests/bgp/files/invalid_nexthop/invalid_nexthop.conf similarity index 100% rename from platform/vs/tests/bgp/files/invalid_nexthop.conf rename to platform/vs/tests/bgp/files/invalid_nexthop/invalid_nexthop.conf diff --git a/platform/vs/tests/bgp/files/no_export/bgpd.conf b/platform/vs/tests/bgp/files/no_export/bgpd.conf new file mode 100644 index 000000000000..40322cedbc69 --- /dev/null +++ b/platform/vs/tests/bgp/files/no_export/bgpd.conf @@ -0,0 +1,13 @@ +router bgp 65501 + bgp router-id 1.1.1.1 + no bgp default ipv4-unicast + neighbor 10.0.0.1 remote-as 65502 + address-family ipv4 + neighbor 10.0.0.1 activate + maximum-paths 64 + exit-address-family + neighbor 10.0.0.3 remote-as 65503 + address-family ipv4 + neighbor 10.0.0.3 activate + maximum-paths 64 + exit-address-family diff --git a/platform/vs/tests/bgp/files/no_export/exabgp1.conf b/platform/vs/tests/bgp/files/no_export/exabgp1.conf new file mode 100644 index 000000000000..0e78bd61db42 --- /dev/null +++ b/platform/vs/tests/bgp/files/no_export/exabgp1.conf @@ -0,0 +1,21 @@ +neighbor 10.0.0.0 { + router-id 1.1.1.2; + local-address 10.0.0.1; + local-as 65502; + peer-as 65501; + group-updates false; + + family{ + ipv4 unicast; + } + + static { + route 1.1.1.1/32{ + next-hop 10.0.0.1; + community no-export; + } + route 2.2.2.2/32{ + next-hop 10.0.0.1; + } + } +} diff --git a/platform/vs/tests/bgp/files/no_export/exabgp2.conf b/platform/vs/tests/bgp/files/no_export/exabgp2.conf new file mode 100644 index 000000000000..3e67c18a82f6 --- /dev/null +++ b/platform/vs/tests/bgp/files/no_export/exabgp2.conf @@ -0,0 +1,11 @@ +neighbor 10.0.0.2 { + router-id 1.1.1.3; + local-address 10.0.0.3; + local-as 65503; + peer-as 65501; + group-updates false; + + family { + ipv4 unicast; + } +} diff --git a/platform/vs/tests/bgp/test_invalid_nexthop.py b/platform/vs/tests/bgp/test_invalid_nexthop.py index cdb67337b896..b6e7cfc86e5e 100644 --- a/platform/vs/tests/bgp/test_invalid_nexthop.py +++ b/platform/vs/tests/bgp/test_invalid_nexthop.py @@ -6,7 +6,7 @@ def test_InvalidNexthop(dvs): - dvs.copy_file("/etc/quagga/", "bgp/files/bgpd.conf") + dvs.copy_file("/etc/quagga/", "bgp/files/invalid_nexthop/bgpd.conf") dvs.runcmd("supervisorctl start bgpd") dvs.runcmd("ip addr add fc00::1/126 dev Ethernet0") dvs.runcmd("ifconfig Ethernet0 up") @@ -18,7 +18,7 @@ def test_InvalidNexthop(dvs): print dvs.runcmd("supervisorctl status") - p = dvs.servers[0].runcmd_async("exabgp -d bgp/files/invalid_nexthop.conf") + p = dvs.servers[0].runcmd_async("exabgp -d bgp/files/invalid_nexthop/invalid_nexthop.conf") time.sleep(10) diff --git a/platform/vs/tests/bgp/test_no_export.py b/platform/vs/tests/bgp/test_no_export.py new file mode 100644 index 000000000000..371d5f0b29ec --- /dev/null +++ b/platform/vs/tests/bgp/test_no_export.py @@ -0,0 +1,45 @@ +from swsscommon import swsscommon +import os +import re +import time +import json + +def test_bounce(dvs): + dvs.servers[0].runcmd("pkill -f exabgp") + dvs.copy_file("/etc/quagga/", "bgp/files/no_export/bgpd.conf") + dvs.runcmd("supervisorctl start bgpd") + dvs.runcmd("ip addr add 10.0.0.0/31 dev Ethernet0") + dvs.runcmd("ifconfig Ethernet0 up") + + dvs.runcmd("ip addr add 10.0.0.2/31 dev Ethernet4") + dvs.runcmd("ifconfig Ethernet4 up") + + dvs.servers[0].runcmd("ip addr add 10.0.0.1/31 dev eth0") + dvs.servers[0].runcmd("ifconfig eth0 up") + + dvs.servers[1].runcmd("ip addr add 10.0.0.3/31 dev eth0") + dvs.servers[1].runcmd("ifconfig eth0 up") + + time.sleep(5) + + p1 = dvs.servers[0].runcmd_async("exabgp -d bgp/files/no_export/exabgp1.conf") + p2 = dvs.servers[1].runcmd_async("exabgp -d bgp/files/no_export/exabgp2.conf") + + time.sleep(60) + + sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"]) + all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"]) + announce_route = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) + + p1.terminate() + p1 = p1.wait() + + p2.terminate() + p2 = p2.wait() + + print sum_res + print announce_route + assert "1.1.1.1/32" in all_route + assert "1.1.1.1/32" not in announce_route + assert "2.2.2.2/32" in all_route + assert "2.2.2.2/32" in announce_route From 93905d3d825a23fd055dd5fc490172e27965a87c Mon Sep 17 00:00:00 2001 From: Sagar Balani Date: Tue, 24 Jul 2018 10:23:12 -0700 Subject: [PATCH 1430/1833] [barefoot]: Support for platforms based on Barefoot Networks' device (#1796) * Initial commit * Add Ingrasys S9180-32X platform dirver. Signed-off-by: Wade He * Add bfn.service for init barefoot. Signed-off-by: Wade He * [Barefoot Beta] Add some functions and fixed some bugs. 1. Update sensors.conf. 2. Fixed IO expander init. 3. Fixed PSU EEPROM. 4. Fixed MB EEPROM. 5. Add fancontrol and fan init. 6. Add SYS LED control (sys, fan, fan tray). 7. 2.5V compute and setup max and min. 8. Fixed typo MB eeprom delete address. 9. Remove coretemp to BMC. 10. Add active CPLD. 11. Modify SFP+ GPIO slave address. 12. Modify tmp75 Near Port 32 slave address. Signed-off-by: Wade He * Add bfn script in /etc/init.d/ Signed-off-by: Wade He * Add bfn service in debian Signed-off-by: Wade He * Fixed CPLD switch LED behavior. Signed-off-by: Wade He * [Barefoot Beta] Fixed sensors and hwmon order. 1. Fixed ignore sensors Vbat. 2. Reorg hwmon order. Signed-off-by: Wade He * Fixed PSU1 and PSU2 EEPROM order. Signed-off-by: Wade He * initial barefoot checkin october 2017 * update refpoint * update refpoints * update refpoints to bf-master * update refpoint * update refpoint to tested version * change to platform from asic * update refpoint for swss * revert core creation setting * update refpoints * add telnet for debug shell * update refpoints 11/17/17 * missed change in file on previous merge * [CPLD] Fixed blink LED issue. * Fixed blink LED mask set error. Signed-off-by: Wade He * Update bf_kdrv.c for 6.0.2.39 * Update bf kernel driver * Add bf_fun kernel module. * Update bf_tun for fixed build error * merge with Azure master (12/12/17) * update swss refpoint * update refpoint of swss * library dependency for stack unroll * update refpoint to bf-master * [DHCP relay]: Fix circuit ID and remote ID bugs (#1248) * [DHCP relay]: Fix circuit ID and remote ID bugs * Set circuit_id_len after setting circuit_id_len to ip->name * [Platform] Add Psuutil and update sensors.conf for S9100-32X, S8810-32Q and S9200-64X (#1272) * Add I2C CPLD kernel module for psuutil. * Support psuutil script. * Add voltage min and max threshold. * Update sensors.conf for tmp75. Signed-off-by: Wade He * Allow multi platform support - infra (more changes to follow) * update relative path to include platform for clarity * [Platform] Add Ingrasys S9130-32X and S9230-64X with Nephos Switch ASIC for "branch 201712" (#1274) - What I did Add switch ASIC vendor: Nephos Add Nephos platforms: Ingrasys S9130-32X, Ingrasys S9230-64X - How I did it Add platform/nephos files Add platform/nephos/sonic-platform-modules-ingrasys submodule Add device/ingrasys/x86_64-ingrasys_s9130_32x-r0 files Add device/ingrasys/x86_64-ingrasys_s9230_64x-r0 files Add SONiC to support Nephos platform Update Head of submodule src/sonic-sairedis to "3b817bb" - How to verify it To build SONiC installer image and docker images, run the following commands: make configure PLATFORM=nephos make target/sonic-nephos.bin Check system and network feature is worked as well - Description for the changelog Add switch ASIC vendor and platforms for Nephos - A picture of a cute animal (not mandatory but encouraged) Signed-off-by: Sam Yang * change source of files to github (from dropbox), update sairedis refpoint * update refpoint of sairedis * [centec] support CENTEC SAI 1.0 on 201712 branch and update e582-48x6q board (#1269) * [marvel]: Marvell's updates for SONiC.201712 & SAI v1.0 (#1287) * update sairedis (fast-boot refpoint) * fix syncd rpc make files * update refpoint to handle Makefile change (no functional change) * [Marvell]: Add support for SLM5401-54x device (#1307) * Marvell's updates for SONiC.201712 & SAI v1.0 * [Platform] Add Marvell's SLM5401-54x for branch 201712 * [Broadcom]: Update Boradcom SAI package to 3.0.3.3-3 (#1312) (#1321) - update Arista 7050-QX32S config.bcm file - update Accton th-as771*-32x100G.config.bcm files * update refpoint for Makefile chnage in sairedis * update refpoint - sairedis * update sairedis to older refpoint till we debug clean build * export asic platform for build * update refpoint for makefiles * [PLATFORM] Centec update E582 driver fan/epprom/sensor (#1332) * Upload wnc-osw1800 * Modify for Barefoot suggest * Revert bfn-platform.mk * Update bfn-platform-wnc.mk Update parameter name * Update parameter name * initial support for WNC platform * change switch name to "switch" * Delete bf modules for rel_7_0 * Add Ingrasys S9180 platform Signed-off-by: Wade He * Modify bfnsdk for Ingrasys S9180 platform Signed-off-by: Wade He * Resolved the conflict. * Resolved the conflict. * Update submodule path and url. * Delete unused file. * Update PSU GPIO and EEPROM for psuutil. * Add psuutil in S9180-32X Signed-off-by: Wade He * update refpoint * update refpoint * change contact email, update refpoint * cleanup and update kernel modules * updates based on review * update refpoint * update refpoint * fix typo in config script to check for platforms * remove stale file * resolve conflicts * cleanup diffs with Azure repo and update SDK debs * update refpoints to Azure * address review comments * revert refpoint of swss-common * porting the build fix from master * porting build fix from master * Minor Fix * Minor fix * Temp to sde deb packages url * Update sonic - sairedis,swss & swss-common refpoints * Update git modules url path to bfn repo * updated paths for swss, swss-common & sairedis * Update refpoint for sonic-swss to local bfn repo * Update URL for downloading sde debian packages * porting fix links of debian git server from master * porting fix links of debian git server from master * [Ingrasys] Add platform support for S9280-64X with Barefoot ASIC * Update ref points for swss, swss-common and sairedis repos * Add sonic platform scripts for bfn montara/maverick * Call sh scripts instead of calling py scripts * Address upstream PR Comments (#10) * Update bf-master with azure/master * Undo changes to some files * Revert "Address upstream PR Comments (#10)" This reverts commit a7fddb83ca1073f90fbe46955ba57a9b43742c73. * Address upstream comments (#11) * Remove all non bfn specific changes from upstream PR * Revert "Address upstream comments (#11)" This reverts commit 559132103e5c73e43f4282d1559ede03f16abfea. * Undo non bfn changes * Little more cleanup * Add back code removed in merge * export CONFIGURED_PLATFORM * Update sairedis and swss refpoints * Address Upstream PR comment * change deb pkg dependency from 3.16.0-4-amd64 to 3.16.0-5-amd64 * Set default tx queue len for usb0 interface to 64 * Update sairedis refpoint * Update swss ref point * Add bfn buffer cfg files for montara/maverick as per new design * Update buffer cfg templates for bfn montara * add non zero size to buffer profile * add macro to generate port lists * Update buffer cfg templates for bfn mavericks * add non zero size for buffer profiles * add port generation macro * Add missing psmisc package * BGP docker seems to be missing killall utility being used by fast-reboot script. This is causing non graceful termination of BGP sessions. Adding psmisc to resolve this issue. * Update swss ref point * Update swss ref point * Update sairedis refpoint * Update sairedis refpoint * Update sairedis refpoint * Update sairedis refpoint * Update refpoint for sairedis and swss * sairedis to azure master * swss to latest bfn bf-master * Update gitmodules Update url for sairedis to azure master * Correct typo in bfn platform script * Update swss and sairedis ref points * Update swss ref point * Address Review comments * Update swws path in gitmodules to azure master * update swss refpoint * update base docker j2 file -remove psmisc package (could be a concern, would cause fast reboot to not work correctly will fix in another PR) * Fix sairedis refpoint broken in by previous merge * Remove psmisc from docker base image * This will break fast reboot as killall is required for killing bgp process and initiating graceful termination of BGP session. Will fix this in a seperate PR. Need this for SONIC upstreaming * Address upstream comments * Remove bmc interface from interface jinja template and sample output interfaces file * Add bmc interface at boot time to network interfaces for bfn bmc based platforms * Remove autogen ingrasys debian files * Revert "Remove autogen ingrasys debian files" * Buffer and qos config template fix for bfn platforms (#21) SWI-1509 Buffer and qos config template fix for bfn platforms * Fix qos config files for montara & mavericks (#22) * Reference only ppg 3,4 in qos files as no profiles are attached to 0,1 in buffer configs * Fix vs test (#23) --- .../installer.conf | 1 + .../minigraph.xml | 1079 ++++++++ .../montara/buffers.json.j2 | 2 + .../montara/buffers_defaults_t0.j2 | 83 + .../montara/buffers_defaults_t1.j2 | 83 + .../montara/pg_profile_lookup.ini | 17 + .../montara/port_config.ini | 33 + .../montara/qos.json.j2 | 161 ++ .../montara/switch-sai.conf | 34 + .../installer.conf | 1 + .../mavericks/buffers.json.j2 | 2 + .../mavericks/buffers_defaults_t0.j2 | 83 + .../mavericks/buffers_defaults_t1.j2 | 83 + .../mavericks/pg_profile_lookup.ini | 17 + .../mavericks/port_config.ini | 66 + .../mavericks/qos.json.j2 | 161 ++ .../mavericks/switch-sai.conf | 34 + .../minigraph.xml | 1079 ++++++++ .../INGRASYS-S9180-32X/port_config.ini | 33 + .../INGRASYS-S9180-32X/switch-sai.conf | 33 + .../x86_64-ingrasys_s9180_32x-r0/fancontrol | 12 + .../installer.conf | 3 + .../minigraph.xml | 151 ++ .../plugins/eeprom.py | 22 + .../plugins/psuutil.py | 90 + .../plugins/sfputil.py | 290 ++ .../x86_64-ingrasys_s9180_32x-r0/sensors.conf | 76 + .../OSW1800-48x6q/port_config.ini | 55 + .../OSW1800-48x6q/switch-sai.conf | 33 + device/wnc/x86_64-wnc_osw1800-r0/fancontrol | 11 + .../wnc/x86_64-wnc_osw1800-r0/installer.conf | 3 + .../wnc/x86_64-wnc_osw1800-r0/minigraph.xml | 1761 ++++++++++++ .../x86_64-wnc_osw1800-r0/plugins/eeprom.py | 22 + .../x86_64-wnc_osw1800-r0/plugins/psuutil.py | 64 + .../x86_64-wnc_osw1800-r0/plugins/sfputil.py | 205 ++ device/wnc/x86_64-wnc_osw1800-r0/sensors.conf | 33 + dockers/docker-orchagent-bfn | 1 + dockers/docker-orchagent/orchagent.sh | 2 + dockers/docker-saiserver-bfn/Dockerfile | 38 + dockers/docker-saiserver-bfn/portmap.ini | 33 + dockers/docker-saiserver-bfn/profile.ini | 1 + dockers/docker-saiserver-bfn/sai_tofino.xml | 2 + dockers/docker-saiserver-bfn/start.sh | 8 + dockers/docker-saiserver-bfn/supervisord.conf | 29 + files/build_templates/buffers_config.j2 | 2 +- .../interfaces/interfaces-config.sh | 11 + files/image_config/interfaces/interfaces.j2 | 1 + platform/barefoot/bfn-platform-ingrasys.mk | 5 + platform/barefoot/bfn-platform-wnc.mk | 5 + platform/barefoot/bfn-platform.mk | 5 + platform/barefoot/bfn-sai.mk | 5 + platform/barefoot/docker-orchagent-bfn.mk | 19 + platform/barefoot/docker-ptf-bfn.mk | 5 + platform/barefoot/docker-syncd-bfn-rpc.mk | 15 + .../docker-syncd-bfn-rpc/Dockerfile.j2 | 52 + .../docker-syncd-bfn-rpc/ptf_nn_agent.conf | 10 + platform/barefoot/docker-syncd-bfn.mk | 15 + .../barefoot/docker-syncd-bfn/Dockerfile.j2 | 29 + platform/barefoot/docker-syncd-bfn/start.sh | 9 + .../docker-syncd-bfn/supervisord.conf | 29 + platform/barefoot/libsaithrift-dev.mk | 7 + platform/barefoot/one-image.mk | 11 + .../barefoot/platform-modules-bfn-montara.mk | 11 + platform/barefoot/platform-modules-bfn.mk | 11 + .../barefoot/platform-modules-ingrasys.mk | 11 + .../barefoot/platform-modules-wnc-osw1800.mk | 11 + platform/barefoot/platform.conf | 0 platform/barefoot/python-saithrift.mk | 6 + platform/barefoot/rules.mk | 23 + .../LICENSE | 15 + .../MAINTAINERS | 3 + .../README.md | 2 + .../debian/changelog | 5 + .../debian/compat | 1 + .../debian/control | 12 + .../debian/copyright | 15 + .../debian/rules | 32 + .../modules/Makefile | 1 + .../modules/bf_kdrv.c | 1 + .../modules/bf_tun.c | 1 + .../scripts/eeprom | 10 + .../scripts/fancontrol | 11 + .../scripts/ps_info | 10 + .../scripts/sensors | 12 + .../scripts/sfputil | 10 + .../scripts/test | 1 + .../sonic-platform-modules-bfn/LICENSE | 15 + .../sonic-platform-modules-bfn/MAINTAINERS | 4 + .../sonic-platform-modules-bfn/README.md | 2 + .../debian/changelog | 5 + .../sonic-platform-modules-bfn/debian/compat | 1 + .../sonic-platform-modules-bfn/debian/control | 12 + .../debian/copyright | 15 + .../sonic-platform-modules-bfn/debian/files | 1 + .../sonic-platform-modules-bfn/debian/rules | 32 + .../modules/Makefile | 2 + .../modules/bf_kdrv.c | 1254 +++++++++ .../modules/bf_tun.c | 2396 +++++++++++++++++ .../sonic-platform-modules-bfn/scripts/eeprom | 10 + .../scripts/fancontrol | 11 + .../scripts/ps_info | 10 + .../scripts/sensors | 12 + .../scripts/sfputil | 10 + .../sonic-platform-modules-bfn/scripts/test | 1 + .../.gitignore | 52 + .../sonic-platform-modules-ingrasys/LICENSE | 674 +++++ .../debian/changelog | 17 + .../debian/compat | 1 + .../debian/control | 10 + .../debian/rules | 81 + .../sonic-platform-ingrasys-s9180-32x.dirs | 4 + .../sonic-platform-ingrasys-s9180-32x.install | 4 + ...sonic-platform-ingrasys-s9180-32x.postinst | 57 + .../sonic-platform-ingrasys-s9180-32x.postrm | 42 + .../sonic-platform-ingrasys-s9180-32x.prerm | 21 + .../sonic-platform-ingrasys-s9180-32x.upstart | 7 + .../s9180-32x/README.md | 185 ++ .../s9180-32x/modules/Makefile | 1 + .../s9180-32x/modules/eeprom_mb.c | 211 ++ .../s9180-32x/service/bfn.service | 13 + .../s9180-32x/service/qsfp-monitor.service | 15 + .../service/s9180-32x-monitor.service | 19 + .../s9180-32x/utils/bfn | 44 + .../s9180-32x/utils/i2c_utils.sh | 1423 ++++++++++ .../s9180-32x/utils/qsfp_monitor.sh | 104 + .../s9180-32x/utils/s9180_32x_monitor.sh | 41 + .../LICENSE | 15 + .../MAINTAINERS | 7 + .../README.md | 2 + .../debian/changelog | 5 + .../debian/compat | 1 + .../debian/control | 12 + .../debian/copyright | 15 + .../debian/rules | 38 + .../modules/Makefile | 6 + .../modules/bf_kdrv.c | 1254 +++++++++ .../modules/bf_tun.c | 2396 +++++++++++++++++ .../modules/i2c-mcp2221.c | 611 +++++ .../modules/wnc_cpld.c | 198 ++ .../modules/wnc_cpld3.c | 200 ++ .../modules/wnc_eeprom.c | 286 ++ .../scripts/device_node.sh | 91 + .../scripts/driver_load.sh | 50 + .../scripts/test | 1 + .../service/device_node.service | 11 + .../service/driver_load.service | 10 + platform/vs/tests/conftest.py | 17 +- slave.mk | 1 + sonic-slave/Dockerfile | 5 + .../tests/sample_output/interfaces | 1 + src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 153 files changed, 18532 insertions(+), 6 deletions(-) create mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/installer.conf create mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/minigraph.xml create mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers.json.j2 create mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t0.j2 create mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t1.j2 create mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/pg_profile_lookup.ini create mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/port_config.ini create mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/qos.json.j2 create mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/installer.conf create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers.json.j2 create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers_defaults_t0.j2 create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers_defaults_t1.j2 create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/pg_profile_lookup.ini create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/port_config.ini create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/qos.json.j2 create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/port_config.ini create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-sai.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/fancontrol create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/installer.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/eeprom.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/psuutil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/sfputil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/sensors.conf create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/port_config.ini create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-sai.conf create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/fancontrol create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/installer.conf create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/minigraph.xml create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/plugins/eeprom.py create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/plugins/psuutil.py create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/plugins/sfputil.py create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/sensors.conf create mode 120000 dockers/docker-orchagent-bfn create mode 100755 dockers/docker-saiserver-bfn/Dockerfile create mode 100644 dockers/docker-saiserver-bfn/portmap.ini create mode 100644 dockers/docker-saiserver-bfn/profile.ini create mode 100644 dockers/docker-saiserver-bfn/sai_tofino.xml create mode 100755 dockers/docker-saiserver-bfn/start.sh create mode 100644 dockers/docker-saiserver-bfn/supervisord.conf create mode 100644 platform/barefoot/bfn-platform-ingrasys.mk create mode 100644 platform/barefoot/bfn-platform-wnc.mk create mode 100644 platform/barefoot/bfn-platform.mk create mode 100644 platform/barefoot/bfn-sai.mk create mode 100644 platform/barefoot/docker-orchagent-bfn.mk create mode 100644 platform/barefoot/docker-ptf-bfn.mk create mode 100644 platform/barefoot/docker-syncd-bfn-rpc.mk create mode 100644 platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 create mode 100644 platform/barefoot/docker-syncd-bfn-rpc/ptf_nn_agent.conf create mode 100644 platform/barefoot/docker-syncd-bfn.mk create mode 100755 platform/barefoot/docker-syncd-bfn/Dockerfile.j2 create mode 100755 platform/barefoot/docker-syncd-bfn/start.sh create mode 100644 platform/barefoot/docker-syncd-bfn/supervisord.conf create mode 100644 platform/barefoot/libsaithrift-dev.mk create mode 100644 platform/barefoot/one-image.mk create mode 100644 platform/barefoot/platform-modules-bfn-montara.mk create mode 100644 platform/barefoot/platform-modules-bfn.mk create mode 100644 platform/barefoot/platform-modules-ingrasys.mk create mode 100644 platform/barefoot/platform-modules-wnc-osw1800.mk create mode 100644 platform/barefoot/platform.conf create mode 100644 platform/barefoot/python-saithrift.mk create mode 100644 platform/barefoot/rules.mk create mode 100644 platform/barefoot/sonic-platform-modules-bfn-montara/LICENSE create mode 100644 platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS create mode 100644 platform/barefoot/sonic-platform-modules-bfn-montara/README.md create mode 100644 platform/barefoot/sonic-platform-modules-bfn-montara/debian/changelog create mode 100644 platform/barefoot/sonic-platform-modules-bfn-montara/debian/compat create mode 100644 platform/barefoot/sonic-platform-modules-bfn-montara/debian/control create mode 100644 platform/barefoot/sonic-platform-modules-bfn-montara/debian/copyright create mode 100755 platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules create mode 120000 platform/barefoot/sonic-platform-modules-bfn-montara/modules/Makefile create mode 120000 platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_kdrv.c create mode 120000 platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_tun.c create mode 100755 platform/barefoot/sonic-platform-modules-bfn-montara/scripts/eeprom create mode 100755 platform/barefoot/sonic-platform-modules-bfn-montara/scripts/fancontrol create mode 100755 platform/barefoot/sonic-platform-modules-bfn-montara/scripts/ps_info create mode 100755 platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sensors create mode 100755 platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sfputil create mode 100755 platform/barefoot/sonic-platform-modules-bfn-montara/scripts/test create mode 100644 platform/barefoot/sonic-platform-modules-bfn/LICENSE create mode 100644 platform/barefoot/sonic-platform-modules-bfn/MAINTAINERS create mode 100644 platform/barefoot/sonic-platform-modules-bfn/README.md create mode 100644 platform/barefoot/sonic-platform-modules-bfn/debian/changelog create mode 100644 platform/barefoot/sonic-platform-modules-bfn/debian/compat create mode 100644 platform/barefoot/sonic-platform-modules-bfn/debian/control create mode 100644 platform/barefoot/sonic-platform-modules-bfn/debian/copyright create mode 100644 platform/barefoot/sonic-platform-modules-bfn/debian/files create mode 100755 platform/barefoot/sonic-platform-modules-bfn/debian/rules create mode 100644 platform/barefoot/sonic-platform-modules-bfn/modules/Makefile create mode 100644 platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c create mode 100644 platform/barefoot/sonic-platform-modules-bfn/modules/bf_tun.c create mode 100755 platform/barefoot/sonic-platform-modules-bfn/scripts/eeprom create mode 100755 platform/barefoot/sonic-platform-modules-bfn/scripts/fancontrol create mode 100755 platform/barefoot/sonic-platform-modules-bfn/scripts/ps_info create mode 100755 platform/barefoot/sonic-platform-modules-bfn/scripts/sensors create mode 100755 platform/barefoot/sonic-platform-modules-bfn/scripts/sfputil create mode 100755 platform/barefoot/sonic-platform-modules-bfn/scripts/test create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/.gitignore create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/LICENSE create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/changelog create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/compat create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/control create mode 100755 platform/barefoot/sonic-platform-modules-ingrasys/debian/rules create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.dirs create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.install create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postinst create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postrm create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.prerm create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.upstart create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/README.md create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/Makefile create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/eeprom_mb.c create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/bfn.service create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/qsfp-monitor.service create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/s9180-32x-monitor.service create mode 100755 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/bfn create mode 100755 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/i2c_utils.sh create mode 100755 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/qsfp_monitor.sh create mode 100755 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/s9180_32x_monitor.sh create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/LICENSE create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/MAINTAINERS create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/README.md create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/changelog create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/compat create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/control create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/copyright create mode 100755 platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/rules create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/Makefile create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/i2c-mcp2221.c create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_cpld.c create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_cpld3.c create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_eeprom.c create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/device_node.sh create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/driver_load.sh create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/test create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/service/device_node.service create mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/service/driver_load.service diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/installer.conf b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/installer.conf new file mode 100644 index 000000000000..3714ff053bb0 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/installer.conf @@ -0,0 +1 @@ +CONSOLE_SPEED=57600 diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/minigraph.xml b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/minigraph.xml new file mode 100644 index 000000000000..60d93ad69d66 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/minigraph.xml @@ -0,0 +1,1079 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch + 10.0.0.32 + 1 + 180 + 60 + + + switch + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch + 10.0.0.34 + 1 + 180 + 60 + + + switch + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch + 10.0.0.36 + 1 + 180 + 60 + + + switch + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch + 10.0.0.38 + 1 + 180 + 60 + + + switch + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch + 10.0.0.40 + 1 + 180 + 60 + + + switch + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch + 10.0.0.42 + 1 + 180 + 60 + + + switch + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch + 10.0.0.44 + 1 + 180 + 60 + + + switch + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch + 10.0.0.46 + 1 + 180 + 60 + + + switch + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch + 10.0.0.48 + 1 + 180 + 60 + + + switch + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch + 10.0.0.50 + 1 + 180 + 60 + + + switch + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch + 10.0.0.52 + 1 + 180 + 60 + + + switch + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch + 10.0.0.54 + 1 + 180 + 60 + + + switch + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch + 10.0.0.56 + 1 + 180 + 60 + + + switch + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch + 10.0.0.58 + 1 + 180 + 60 + + + switch + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch + 10.0.0.60 + 1 + 180 + 60 + + + switch + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch + 10.0.0.62 + 1 + 180 + 60 + + + switch + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch + + +
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 + + + + + + + + switch + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + switch + montara + + ` + + + + + switch + + + 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 + + + + + + + switch + montara +
diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers.json.j2 b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t0.j2 b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..73e95a457a2a --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t0.j2 @@ -0,0 +1,83 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"4096", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"4096", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_pg_profils(port_names) %} + "BUFFER_PG": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + } + }, +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +{%- endmacro %} diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t1.j2 b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..fce82ea2edf5 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/buffers_defaults_t1.j2 @@ -0,0 +1,83 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"4096", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"4096", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_pg_profils(port_names) %} + "BUFFER_PG": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + } + }, +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +{%- endmacro %} diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/pg_profile_lookup.ini b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/port_config.ini b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/port_config.ini new file mode 100644 index 000000000000..816bb0e94a70 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/port_config.ini @@ -0,0 +1,33 @@ +# name lanes +Ethernet0 0,1,2,3 +Ethernet4 4,5,6,7 +Ethernet8 8,9,10,11 +Ethernet12 12,13,14,15 +Ethernet16 16,17,18,19 +Ethernet20 20,21,22,23 +Ethernet24 24,25,26,27 +Ethernet28 28,29,30,31 +Ethernet32 32,33,34,35 +Ethernet36 36,37,38,39 +Ethernet40 40,41,42,43 +Ethernet44 44,45,46,47 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 64,65,66,67 +Ethernet68 68,69,70,71 +Ethernet72 72,73,74,75 +Ethernet76 76,77,78,79 +Ethernet80 80,81,82,83 +Ethernet84 84,85,86,87 +Ethernet88 88,89,90,91 +Ethernet92 92,93,94,95 +Ethernet96 96,97,98,99 +Ethernet100 100,101,102,103 +Ethernet104 104,105,106,107 +Ethernet108 108,109,110,111 +Ethernet112 112,113,114,115 +Ethernet116 116,117,118,119 +Ethernet120 120,121,122,123 +Ethernet124 124,125,126,127 diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/qos.json.j2 b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/qos.json.j2 new file mode 100644 index 000000000000..7b8732e2e125 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/qos.json.j2 @@ -0,0 +1,161 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf new file mode 100644 index 000000000000..089153b6a5ce --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf @@ -0,0 +1,34 @@ +{ + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", + "pcie_domain": 0, + "pcie_bus": 5, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "instance": 0, + "p4_program_list": [ + { + "id": "pgm-0", + "instance": 0, + "path": "switch", + "program-name": "switch", + "pd": "lib/tofinopd/switch/libpd.so", + "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", + "table-config": "share/tofinopd/switch/context.json", + "tofino-bin": "share/tofinopd/switch/tofino.bin", + "switchapi": "lib/libswitchapi.so", + "switchsai": "lib/libswitchsai.so", + "agent0": "lib/platform/x86_64-accton_wedge100bf_32x-r0/libpltfm_mgr.so", + "switchapi_port_add": false, + "non_default_port_ppgs": 5 + } + ] +} diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/installer.conf b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/installer.conf new file mode 100644 index 000000000000..3714ff053bb0 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/installer.conf @@ -0,0 +1 @@ +CONSOLE_SPEED=57600 diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers.json.j2 b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers_defaults_t0.j2 b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..e5b949faed00 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers_defaults_t0.j2 @@ -0,0 +1,83 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,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": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"4096", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"4096", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_pg_profils(port_names) %} + "BUFFER_PG": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + } + }, +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +{%- endmacro %} diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers_defaults_t1.j2 b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..1d8096c0d6cc --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/buffers_defaults_t1.j2 @@ -0,0 +1,83 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,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": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"4096", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"4096", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"4096", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_pg_profils(port_names) %} + "BUFFER_PG": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + } + }, +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|q_lossy_profile]" + } + } +{%- endmacro %} diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/pg_profile_lookup.ini b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/port_config.ini b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/port_config.ini new file mode 100644 index 000000000000..c1001741d28a --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/port_config.ini @@ -0,0 +1,66 @@ +# name lanes +Ethernet0 0,1,2,3 +Ethernet4 4,5,6,7 +Ethernet8 8,9,10,11 +Ethernet12 12,13,14,15 +Ethernet16 16,17,18,19 +Ethernet20 20,21,22,23 +Ethernet24 24,25,26,27 +Ethernet28 28,29,30,31 +Ethernet32 32,33,34,35 +Ethernet36 36,37,38,39 +Ethernet40 40,41,42,43 +Ethernet44 44,45,46,47 +Ethernet48 48,49,50,51 +Ethernet52 52,53,54,55 +Ethernet56 56,57,58,59 +Ethernet60 60,61,62,63 +Ethernet64 64,65,66,67 +Ethernet68 68,69,70,71 +Ethernet72 72,73,74,75 +Ethernet76 76,77,78,79 +Ethernet80 80,81,82,83 +Ethernet84 84,85,86,87 +Ethernet88 88,89,90,91 +Ethernet92 92,93,94,95 +Ethernet96 96,97,98,99 +Ethernet100 100,101,102,103 +Ethernet104 104,105,106,107 +Ethernet108 108,109,110,111 +Ethernet112 112,113,114,115 +Ethernet116 116,117,118,119 +Ethernet120 120,121,122,123 +Ethernet124 124,125,126,127 +Ethernet128 128,129,130,131 +Ethernet132 132,133,134,135 +Ethernet136 136,137,138,139 +Ethernet140 140,141,142,143 +Ethernet144 144,145,146,147 +Ethernet148 148,149,150,151 +Ethernet152 152,153,154,155 +Ethernet156 156,157,158,159 +Ethernet160 160,161,162,163 +Ethernet164 164,165,166,167 +Ethernet168 168,169,170,171 +Ethernet172 172,173,174,175 +Ethernet176 176,177,178,179 +Ethernet180 180,181,182,183 +Ethernet184 184,185,186,187 +Ethernet188 188,189,190,191 +Ethernet192 192,193,194,195 +Ethernet196 196,197,198,199 +Ethernet200 200,201,202,203 +Ethernet204 204,205,206,207 +Ethernet208 208,209,210,211 +Ethernet212 212,213,214,215 +Ethernet216 216,217,218,219 +Ethernet220 220,221,222,223 +Ethernet224 224,225,226,227 +Ethernet228 228,229,230,231 +Ethernet232 232,233,234,235 +Ethernet236 236,237,238,239 +Ethernet240 240,241,242,243 +Ethernet244 244,245,246,247 +Ethernet248 248,249,250,251 +Ethernet252 252,253,254,255 +Ethernet256 256,257,258,259 diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/qos.json.j2 b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/qos.json.j2 new file mode 100644 index 000000000000..7b8732e2e125 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/qos.json.j2 @@ -0,0 +1,161 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"516096", + "red_min_threshold":"516096", + "yellow_max_threshold":"516096", + "yellow_min_threshold":"516096", + "green_max_threshold": "184320", + "green_min_threshold": "184320" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf new file mode 100644 index 000000000000..1f0ff8b32bb1 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf @@ -0,0 +1,34 @@ +{ + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", + "pcie_domain": 0, + "pcie_bus": 5, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "instance": 0, + "p4_program_list": [ + { + "id": "pgm-0", + "instance": 0, + "path": "switch", + "program-name": "switch", + "pd": "lib/tofinopd/switch/libpd.so", + "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", + "table-config": "share/tofinopd/switch/context.json", + "tofino-bin": "share/tofinopd/switch/tofino.bin", + "switchapi": "lib/libswitchapi.so", + "switchsai": "lib/libswitchsai.so", + "agent0": "lib/platform/x86_64-accton_wedge100bf_65x-r0/libpltfm_mgr.so", + "switchapi_port_add": false, + "non_default_port_ppgs": 5 + } + ] +} diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/minigraph.xml b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/minigraph.xml new file mode 100644 index 000000000000..18d614739737 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/minigraph.xml @@ -0,0 +1,1079 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + switch + 10.0.0.32 + 1 + 180 + 60 + + + switch + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.35 + switch + 10.0.0.34 + 1 + 180 + 60 + + + switch + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.37 + switch + 10.0.0.36 + 1 + 180 + 60 + + + switch + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.39 + switch + 10.0.0.38 + 1 + 180 + 60 + + + switch + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.41 + switch + 10.0.0.40 + 1 + 180 + 60 + + + switch + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.43 + switch + 10.0.0.42 + 1 + 180 + 60 + + + switch + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.45 + switch + 10.0.0.44 + 1 + 180 + 60 + + + switch + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.47 + switch + 10.0.0.46 + 1 + 180 + 60 + + + switch + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.49 + switch + 10.0.0.48 + 1 + 180 + 60 + + + switch + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.51 + switch + 10.0.0.50 + 1 + 180 + 60 + + + switch + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.53 + switch + 10.0.0.52 + 1 + 180 + 60 + + + switch + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.55 + switch + 10.0.0.54 + 1 + 180 + 60 + + + switch + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.57 + switch + 10.0.0.56 + 1 + 180 + 60 + + + switch + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.59 + switch + 10.0.0.58 + 1 + 180 + 60 + + + switch + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.61 + switch + 10.0.0.60 + 1 + 180 + 60 + + + switch + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.63 + switch + 10.0.0.62 + 1 + 180 + 60 + + + switch + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + + + 65100 + switch + + +
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 + + + + + + + + switch + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + + + + + + + + + DeviceInterfaceLink + switch + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet84 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet88 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet92 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet96 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet100 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet104 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet108 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet112 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet116 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet120 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch + Ethernet124 + ARISTA16T0 + Ethernet1 + + + + + switch + mavericks + + ` + + + + + switch + + + 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 + + + + + + + switch + mavericks +
diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/port_config.ini new file mode 100644 index 000000000000..8b25c1333a67 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias speed autoneg fec index +Ethernet0 0,1,2,3 Ethernet0 100000 0 none 0 +Ethernet4 4,5,6,7 Ethernet4 100000 0 none 1 +Ethernet8 8,9,10,11 Ethernet8 100000 0 none 2 +Ethernet12 12,13,14,15 Ethernet12 100000 0 none 3 +Ethernet16 16,17,18,19 Ethernet16 100000 0 none 4 +Ethernet20 20,21,22,23 Ethernet20 100000 0 none 5 +Ethernet24 24,25,26,27 Ethernet24 100000 0 none 6 +Ethernet28 28,29,30,31 Ethernet28 100000 0 none 7 +Ethernet32 32,33,34,35 Ethernet32 100000 0 none 8 +Ethernet36 36,37,38,39 Ethernet36 100000 0 none 9 +Ethernet40 40,41,42,43 Ethernet40 100000 0 none 10 +Ethernet44 44,45,46,47 Ethernet44 100000 0 none 11 +Ethernet48 48,49,50,51 Ethernet48 100000 0 none 12 +Ethernet52 52,53,54,55 Ethernet52 100000 0 none 13 +Ethernet56 56,57,58,59 Ethernet56 100000 0 none 14 +Ethernet60 60,61,62,63 Ethernet60 100000 0 none 15 +Ethernet64 64,65,66,67 Ethernet64 100000 0 none 16 +Ethernet68 68,69,70,71 Ethernet68 100000 0 none 17 +Ethernet72 72,73,74,75 Ethernet72 100000 0 none 18 +Ethernet76 76,77,78,79 Ethernet76 100000 0 none 19 +Ethernet80 80,81,82,83 Ethernet80 100000 0 none 20 +Ethernet84 84,85,86,87 Ethernet84 100000 0 none 21 +Ethernet88 88,89,90,91 Ethernet88 100000 0 none 22 +Ethernet92 92,93,94,95 Ethernet92 100000 0 none 23 +Ethernet96 96,97,98,99 Ethernet96 100000 0 none 24 +Ethernet100 100,101,102,103 Ethernet100 100000 0 none 25 +Ethernet104 104,105,106,107 Ethernet104 100000 0 none 26 +Ethernet108 108,109,110,111 Ethernet108 100000 0 none 27 +Ethernet112 112,113,114,115 Ethernet112 100000 0 none 28 +Ethernet116 116,117,118,119 Ethernet116 100000 0 none 29 +Ethernet120 120,121,122,123 Ethernet120 100000 0 none 30 +Ethernet124 124,125,126,127 Ethernet124 100000 0 none 31 diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-sai.conf b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-sai.conf new file mode 100644 index 000000000000..4f316bb9e5af --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-sai.conf @@ -0,0 +1,33 @@ +{ + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", + "pcie_domain": 0, + "pcie_bus": 5, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "instance": 0, + "p4_program_list": [ + { + "id": "pgm-0", + "instance": 0, + "path": "switch", + "program-name": "switch", + "pd": "lib/tofinopd/switch/libpd.so", + "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", + "table-config": "share/tofinopd/switch/context.json", + "tofino-bin": "share/tofinopd/switch/tofino.bin", + "switchapi": "lib/libswitchapi.so", + "switchsai": "lib/libswitchsai.so", + "agent0": "lib/platform/x86_64-ingrasys_s9180_32x-r0/libpltfm_mgr.so", + "switchapi_port_add": false + } + ] +} diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/fancontrol new file mode 100644 index 000000000000..dc303afac034 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-56/56-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm2=hwmon2/temp2_input hwmon1/device/pwm1=hwmon2/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +# TODO: check the temp value with HW after board ready +MINTEMP=hwmon1/device/pwm2=20 hwmon1/device/pwm1=20 +MAXTEMP=hwmon1/device/pwm2=60 hwmon1/device/pwm1=60 +MINSTART=hwmon1/device/pwm2=75 hwmon1/device/pwm1=75 +MINSTOP=hwmon1/device/pwm2=22 hwmon1/device/pwm1=22 + diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml new file mode 100644 index 000000000000..e2d151e6ec47 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml @@ -0,0 +1,151 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + OCPSCH01040GGLF + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040GGLF + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + OCPSCH01040GGLF + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 40000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + OCPSCH01040GGLF + Ethernet0 + + + 40000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + OCPSCH01040GGLF + Ethernet4 + + + + + OCPSCH01040GGLF + INGRASYS-S9180-32X + + + + + + + OCPSCH01040GGLF + + + 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 + + + + + + + OCPSCH01040GGLF + INGRASYS-S9180-32X +
diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..d1270eeffbf6 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S9180-32X +# +# 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-0055/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..8a719388266a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/psuutil.py @@ -0,0 +1,90 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYS_GPIO_DIR = "/sys/class/gpio/" + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + gpio_path = [ 'gpio99/value', 'gpio96/value' ] + attr_path = self.SYS_GPIO_DIR + gpio_path[index-1] + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 10) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + gpio_path = [ 'gpio100/value', 'gpio97/value' ] + attr_path = self.SYS_GPIO_DIR + gpio_path[index-1] + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 10) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..e0f85a981182 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/sfputil.py @@ -0,0 +1,290 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 33 + SFP_PORT_START = 32 + PORTS_IN_BLOCK = 34 + + BASE_DIR_PATH = "/sys/class/gpio/gpio{0}/direction" + BASE_VAL_PATH = "/sys/class/gpio/gpio{0}/value" + + _port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: 10, + 1: 9, + 2: 12, + 3: 11, + 4: 14, + 5: 13, + 6: 16, + 7: 15, + 8: 18, + 9: 17, + 10: 20, + 11: 19, + 12: 22, + 13: 21, + 14: 24, + 15: 23, + 16: 26, + 17: 25, + 18: 28, + 19: 27, + 20: 30, + 21: 29, + 22: 32, + 23: 31, + 24: 34, + 25: 33, + 26: 36, + 27: 35, + 28: 38, + 29: 37, + 30: 40, + 31: 39, + 32: 45, + 33: 46 + } + + abs_to_gpio_mapping = { + 0: 241, + 1: 240, + 2: 243, + 3: 242, + 4: 245, + 5: 244, + 6: 247, + 7: 246, + 8: 249, + 9: 248, + 10: 251, + 11: 250, + 12: 253, + 13: 252, + 14: 255, + 15: 254, + 16: 225, + 17: 224, + 18: 227, + 19: 226, + 20: 229, + 21: 228, + 22: 231, + 23: 230, + 24: 233, + 25: 232, + 26: 235, + 27: 234, + 28: 237, + 29: 236, + 30: 239, + 31: 238, + 32: 177, + 33: 176 + } + + lpmode_to_gpio_mapping = { + 0: 161, + 1: 160, + 2: 163, + 3: 162, + 4: 165, + 5: 164, + 6: 167, + 7: 166, + 8: 169, + 9: 168, + 10: 171, + 11: 170, + 12: 173, + 13: 172, + 14: 175, + 15: 174, + 16: 145, + 17: 144, + 18: 147, + 19: 146, + 20: 149, + 21: 148, + 22: 151, + 23: 150, + 24: 153, + 25: 152, + 26: 155, + 27: 154, + 28: 157, + 29: 156, + 30: 159, + 31: 158 + } + + reset_to_gpio_mapping = { + 0: 129, + 1: 128, + 2: 131, + 3: 130, + 4: 133, + 5: 132, + 6: 135, + 7: 134, + 8: 137, + 9: 136, + 10: 139, + 11: 138, + 12: 141, + 13: 140, + 14: 143, + 15: 142, + 16: 113, + 17: 112, + 18: 115, + 19: 114, + 20: 117, + 21: 116, + 22: 119, + 23: 118, + 24: 121, + 25: 120, + 26: 123, + 27: 122, + 28: 125, + 29: 124, + 30: 127, + 31: 126 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + @property + def sfp_port_start(self): + return self.SFP_PORT_START + + def __init__(self): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(self.port_start, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + abs_device_file = self.BASE_VAL_PATH.format( + self.abs_to_gpio_mapping[port_num]) + val_file = open(abs_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.sfp_port_start: # TBD + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.sfp_port_start: # TBD + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1" if lpmode is True else "0") + val_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.sfp_port_start: # TBD + return False + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1") + val_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("0") + val_file.close() + + return True diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/sensors.conf new file mode 100644 index 000000000000..eb5a5b4b69f3 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/sensors.conf @@ -0,0 +1,76 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + label temp1 "DIMM Temp" + set temp1_max 50 + set temp1_crit 85 + +bus "i2c-0" "I2C I801" +chip "tmp75-i2c-*-4f" + label temp1 "CPU Board Temp" + set temp1_max 50 + +bus "i2c-41" "i2c-7-switch (chan_id 0)" +chip "tmp75-i2c-*-48" + label temp1 "Near PSU1" + set temp1_max 50 +chip "tmp75-i2c-*-4a" + label temp1 "Rear MAC" + set temp1_max 50 +chip "tmp75-i2c-*-4b" + label temp1 "Near Port 32" + set temp1_max 50 +chip "tmp75-i2c-*-4d" + label temp1 "Near PSU2" + set temp1_max 50 +chip "lm86-i2c-*-4c" + label temp1 "Front MAC" + label temp2 "ASIC Core Temp" + set temp1_min 20 + set temp1_max 65 + set temp1_crit 70 + set temp2_min 20 + set temp2_max 70 + set temp2_crit 80 + +bus "i2c-56" "i2c-0-mux (chan_id 7)" +chip "w83795adg-*" + label in0 "0.9V" + set in0_max 0.927 + set in0_min 0.873 + label in1 "0.86V" + set in1_max 0.877 + set in1_min 0.843 + ignore in2 + ignore in3 + ignore in4 + ignore in5 + ignore in6 + ignore in7 + label in12 "2.5V" + #compute in12 (2*4*@)/10, @-(2*4*@/10) + compute in12 @/(1+(3/10)), @*(1+(3/10)) + set in12_max 2.625 + set in12_min 2.375 + # in12 and in13 are the same source + ignore in13 + ignore in14 + ignore in15 + ignore in16 + label fan1 "FANTRAY 1-A" + label fan2 "FANTRAY 1-B" + label fan3 "FANTRAY 2-A" + label fan4 "FANTRAY 2-B" + label fan5 "FANTRAY 3-A" + label fan6 "FANTRAY 3-B" + label fan7 "FANTRAY 4-A" + label fan8 "FANTRAY 4-B" + ignore temp1 + ignore temp2 + ignore temp3 + ignore temp4 + ignore temp5 + ignore temp6 + ignore intrusion0 diff --git a/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/port_config.ini b/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/port_config.ini new file mode 100644 index 000000000000..578f59203d30 --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/port_config.ini @@ -0,0 +1,55 @@ +# name lanes alias speed autoneg fec +Ethernet0 0 Ethernet0 25000 1 rs +Ethernet4 1 Ethernet4 25000 1 rs +Ethernet8 2 Ethernet8 25000 1 rs +Ethernet12 3 Ethernet12 25000 1 rs +Ethernet16 4 Ethernet16 25000 1 rs +Ethernet20 5 Ethernet20 25000 1 rs +Ethernet24 6 Ethernet24 25000 1 rs +Ethernet28 7 Ethernet28 25000 1 rs +Ethernet32 8 Ethernet32 25000 1 rs +Ethernet36 9 Ethernet36 25000 1 rs +Ethernet40 10 Ethernet40 25000 1 rs +Ethernet44 11 Ethernet44 25000 1 rs +Ethernet48 12 Ethernet48 25000 1 rs +Ethernet52 13 Ethernet52 25000 1 rs +Ethernet56 14 Ethernet56 25000 1 rs +Ethernet60 15 Ethernet60 25000 1 rs +Ethernet64 16 Ethernet64 25000 1 rs +Ethernet68 17 Ethernet68 25000 1 rs +Ethernet72 18 Ethernet72 25000 1 rs +Ethernet76 19 Ethernet76 25000 1 rs +Ethernet80 20 Ethernet80 25000 1 rs +Ethernet84 21 Ethernet84 25000 1 rs +Ethernet88 22 Ethernet88 25000 1 rs +Ethernet92 23 Ethernet92 25000 1 rs +Ethernet96 24 Ethernet96 25000 1 rs +Ethernet100 25 Ethernet100 25000 1 rs +Ethernet104 26 Ethernet104 25000 1 rs +Ethernet108 27 Ethernet108 25000 1 rs +Ethernet112 28 Ethernet112 25000 1 rs +Ethernet116 29 Ethernet116 25000 1 rs +Ethernet120 30 Ethernet120 25000 1 rs +Ethernet124 31 Ethernet124 25000 1 rs +Ethernet128 32 Ethernet128 25000 1 rs +Ethernet132 33 Ethernet132 25000 1 rs +Ethernet136 34 Ethernet136 25000 1 rs +Ethernet140 35 Ethernet140 25000 1 rs +Ethernet144 36 Ethernet144 25000 1 rs +Ethernet148 37 Ethernet148 25000 1 rs +Ethernet152 38 Ethernet152 25000 1 rs +Ethernet156 39 Ethernet156 25000 1 rs +Ethernet160 40 Ethernet160 25000 1 rs +Ethernet164 41 Ethernet164 25000 1 rs +Ethernet168 42 Ethernet168 25000 1 rs +Ethernet172 43 Ethernet172 25000 1 rs +Ethernet176 44 Ethernet176 25000 1 rs +Ethernet180 45 Ethernet180 25000 1 rs +Ethernet184 46 Ethernet184 25000 1 rs +Ethernet188 47 Ethernet188 25000 1 rs +Ethernet192 48,49,50,51 Ethernet192 100000 1 rs +Ethernet196 52,53,54,55 Ethernet196 100000 1 rs +Ethernet200 56,57,58,59 Ethernet200 100000 1 rs +Ethernet204 60,61,62,63 Ethernet204 100000 1 rs +Ethernet208 64,65,66,67 Ethernet208 100000 1 rs +Ethernet212 68,69,70,71 Ethernet212 100000 1 rs diff --git a/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-sai.conf b/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-sai.conf new file mode 100644 index 000000000000..65a02a621f03 --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-sai.conf @@ -0,0 +1,33 @@ +{ + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", + "pcie_domain": 0, + "pcie_bus": 5, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "instance": 0, + "p4_program_list": [ + { + "id": "pgm-0", + "instance": 0, + "path": "switch", + "program-name": "switch", + "pd": "lib/tofinopd/switch/libpd.so", + "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", + "table-config": "share/tofinopd/switch/context.json", + "tofino-bin": "share/tofinopd/switch/tofino.bin", + "switchapi": "lib/libswitchapi.so", + "switchsai": "lib/libswitchsai.so", + "agent0": "lib/platform/x86_64-wnc_osw1800-r0/libpltfm_mgr.so", + "switchapi_port_add": false + } + ] +} diff --git a/device/wnc/x86_64-wnc_osw1800-r0/fancontrol b/device/wnc/x86_64-wnc_osw1800-r0/fancontrol new file mode 100644 index 000000000000..d661bd11f1b2 --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/fancontrol @@ -0,0 +1,11 @@ +INTERVAL=10 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:16.0/usb1/1-1/1-1.2/1-1.2.3/1-1.2.3:1.2/i2c-2/i2c-5/5-0033 hwmon2=devices/pci0000:00/0000:00:16.0/usb1/1-1/1-1.2/1-1.2.3/1-1.2.3:1.2/i2c-2/i2c-7/7-001e hwmon3=devices/pci0000:00/0000:00:16.0/usb1/1-1/1-1.2/1-1.2.3/1-1.2.3:1.2/i2c-2/i2c-7/7-004e hwmon4=devices/pci0000:00/0000:00:16.0/usb1/1-1/1-1.2/1-1.2.3/1-1.2.3:1.2/i2c-2/i2c-7/7-004f +DEVNAME=hwmon1=wnc_cpld3 hwmon2=tmp421 hwmon3=tmp75 hwmon4=tmp421 +FCTEMPS=hwmon1/pwm1=hwmon2/temp1_input hwmon1/pwm2=hwmon2/temp2_input hwmon1/pwm3=hwmon3/temp1_input hwmon1/pwm4=hwmon4/temp1_input hwmon1/pwm5=hwmon4/temp2_input +FCFANS=hwmon1/pwm1=hwmon1/fan1_input hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm3=hwmon1/fan3_input hwmon1/pwm4=hwmon1/fan4_input hwmon1/pwm5=hwmon1/fan5_input +MINTEMP=hwmon1/pwm1=20 hwmon1/pwm2=20 hwmon1/pwm3=20 hwmon1/pwm4=20 hwmon1/pwm5=20 +MAXTEMP=hwmon1/pwm1=50 hwmon1/pwm2=50 hwmon1/pwm3=50 hwmon1/pwm4=50 hwmon1/pwm5=50 +MINSTART=hwmon1/pwm1=32 hwmon1/pwm2=32 hwmon1/pwm3=32 hwmon1/pwm4=32 hwmon1/pwm5=32 +MINSTOP=hwmon1/pwm1=22 hwmon1/pwm2=22 hwmon1/pwm3=22 hwmon1/pwm4=22 hwmon1/pwm5=22 +MINPWM=hwmon1/pwm1=10 hwmon1/pwm2=10 hwmon1/pwm3=10 hwmon1/pwm4=10 hwmon1/pwm5=10 +MAXPWM=hwmon1/pwm1=100 hwmon1/pwm2=100 hwmon1/pwm3=100 hwmon1/pwm4=100 hwmon1/pwm5=100 diff --git a/device/wnc/x86_64-wnc_osw1800-r0/installer.conf b/device/wnc/x86_64-wnc_osw1800-r0/installer.conf new file mode 100644 index 000000000000..dfa6df22689b --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=57600 diff --git a/device/wnc/x86_64-wnc_osw1800-r0/minigraph.xml b/device/wnc/x86_64-wnc_osw1800-r0/minigraph.xml new file mode 100644 index 000000000000..fc4dcee3058e --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/minigraph.xml @@ -0,0 +1,1761 @@ + + + + + + ARISTA01T0 + 10.0.0.55 + switch2 + 10.0.0.54 + 1 + 180 + 60 + + + switch2 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 180 + 60 + + + ARISTA02T0 + 10.0.0.57 + switch2 + 10.0.0.56 + 1 + 180 + 60 + + + switch2 + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 180 + 60 + + + ARISTA03T0 + 10.0.0.59 + switch2 + 10.0.0.58 + 1 + 180 + 60 + + + switch2 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 180 + 60 + + + ARISTA04T0 + 10.0.0.61 + switch2 + 10.0.0.60 + 1 + 180 + 60 + + + switch2 + 10.0.0.6 + ARISTA04T2 + 10.0.0.7 + 1 + 180 + 60 + + + ARISTA05T0 + 10.0.0.63 + switch2 + 10.0.0.62 + 1 + 180 + 60 + + + switch2 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 180 + 60 + + + ARISTA06T0 + 10.0.0.65 + switch2 + 10.0.0.64 + 1 + 180 + 60 + + + switch2 + 10.0.0.10 + ARISTA06T2 + 10.0.0.11 + 1 + 180 + 60 + + + ARISTA07T0 + 10.0.0.67 + switch2 + 10.0.0.66 + 1 + 180 + 60 + + + switch2 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 180 + 60 + + + ARISTA08T0 + 10.0.0.69 + switch2 + 10.0.0.68 + 1 + 180 + 60 + + + switch2 + 10.0.0.14 + ARISTA08T2 + 10.0.0.15 + 1 + 180 + 60 + + + ARISTA09T0 + 10.0.0.71 + switch2 + 10.0.0.70 + 1 + 180 + 60 + + + switch2 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 180 + 60 + + + ARISTA10T0 + 10.0.0.73 + switch2 + 10.0.0.72 + 1 + 180 + 60 + + + switch2 + 10.0.0.18 + ARISTA10T2 + 10.0.0.19 + 1 + 180 + 60 + + + ARISTA11T0 + 10.0.0.75 + switch2 + 10.0.0.74 + 1 + 180 + 60 + + + switch2 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 180 + 60 + + + ARISTA12T0 + 10.0.0.77 + switch2 + 10.0.0.76 + 1 + 180 + 60 + + + switch2 + 10.0.0.22 + ARISTA12T2 + 10.0.0.23 + 1 + 180 + 60 + + + ARISTA13T0 + 10.0.0.79 + switch2 + 10.0.0.78 + 1 + 180 + 60 + + + switch2 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 180 + 60 + + + ARISTA14T0 + 10.0.0.81 + switch2 + 10.0.0.80 + 1 + 180 + 60 + + + switch2 + 10.0.0.26 + ARISTA14T2 + 10.0.0.27 + 1 + 180 + 60 + + + ARISTA15T0 + 10.0.0.83 + switch2 + 10.0.0.82 + 1 + 180 + 60 + + + switch2 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 180 + 60 + + + ARISTA16T0 + 10.0.0.85 + switch2 + 10.0.0.84 + 1 + 180 + 60 + + + switch2 + 10.0.0.30 + ARISTA16T2 + 10.0.0.31 + 1 + 180 + 60 + + + ARISTA17T0 + 10.0.0.87 + switch2 + 10.0.0.86 + 1 + 180 + 60 + + + switch2 + 10.0.0.32 + ARISTA17T2 + 10.0.0.33 + 1 + 180 + 60 + + + ARISTA18T0 + 10.0.0.89 + switch2 + 10.0.0.88 + 1 + 180 + 60 + + + switch2 + 10.0.0.34 + ARISTA18T2 + 10.0.0.35 + 1 + 180 + 60 + + + ARISTA19T0 + 10.0.0.91 + switch2 + 10.0.0.90 + 1 + 180 + 60 + + + switch2 + 10.0.0.36 + ARISTA19T2 + 10.0.0.37 + 1 + 180 + 60 + + + ARISTA20T0 + 10.0.0.93 + switch2 + 10.0.0.92 + 1 + 180 + 60 + + + switch2 + 10.0.0.38 + ARISTA20T2 + 10.0.0.39 + 1 + 180 + 60 + + + ARISTA21T0 + 10.0.0.95 + switch2 + 10.0.0.94 + 1 + 180 + 60 + + + switch2 + 10.0.0.40 + ARISTA21T2 + 10.0.0.41 + 1 + 180 + 60 + + + ARISTA22T0 + 10.0.0.97 + switch2 + 10.0.0.96 + 1 + 180 + 60 + + + switch2 + 10.0.0.42 + ARISTA22T2 + 10.0.0.43 + 1 + 180 + 60 + + + ARISTA23T0 + 10.0.0.99 + switch2 + 10.0.0.98 + 1 + 180 + 60 + + + switch2 + 10.0.0.44 + ARISTA23T2 + 10.0.0.45 + 1 + 180 + 60 + + + ARISTA24T0 + 10.0.0.101 + switch2 + 10.0.0.100 + 1 + 180 + 60 + + + switch2 + 10.0.0.46 + ARISTA24T2 + 10.0.0.47 + 1 + 180 + 60 + + + ARISTA25T0 + 10.0.0.103 + switch2 + 10.0.0.102 + 1 + 180 + 60 + + + switch2 + 10.0.0.48 + ARISTA25T2 + 10.0.0.49 + 1 + 180 + 60 + + + ARISTA26T0 + 10.0.0.105 + switch2 + 10.0.0.104 + 1 + 180 + 60 + + + switch2 + 10.0.0.50 + ARISTA26T2 + 10.0.0.51 + 1 + 180 + 60 + + + ARISTA27T0 + 10.0.0.107 + switch2 + 10.0.0.106 + 1 + 180 + 60 + + + switch2 + 10.0.0.52 + ARISTA27T2 + 10.0.0.53 + 1 + 180 + 60 + + + + + 65100 + switch2 + + +
10.0.0.55
+ + +
+ +
10.0.0.1
+ + +
+ +
10.0.0.57
+ + +
+ +
10.0.0.3
+ + +
+ +
10.0.0.59
+ + +
+ +
10.0.0.5
+ + +
+ +
10.0.0.61
+ + +
+ +
10.0.0.7
+ + +
+ +
10.0.0.63
+ + +
+ +
10.0.0.9
+ + +
+ +
10.0.0.65
+ + +
+ +
10.0.0.11
+ + +
+ +
10.0.0.67
+ + +
+ +
10.0.0.13
+ + +
+ +
10.0.0.69
+ + +
+ +
10.0.0.15
+ + +
+ +
10.0.0.71
+ + +
+ +
10.0.0.17
+ + +
+ +
10.0.0.73
+ + +
+ +
10.0.0.19
+ + +
+ +
10.0.0.75
+ + +
+ +
10.0.0.21
+ + +
+ +
10.0.0.77
+ + +
+ +
10.0.0.23
+ + +
+ +
10.0.0.79
+ + +
+ +
10.0.0.25
+ + +
+ +
10.0.0.81
+ + +
+ +
10.0.0.27
+ + +
+ +
10.0.0.83
+ + +
+ +
10.0.0.29
+ + +
+ +
10.0.0.85
+ + +
+ +
10.0.0.31
+ + +
+ +
10.0.0.87
+ + +
+ +
10.0.0.33
+ + +
+ +
10.0.0.89
+ + +
+ +
10.0.0.35
+ + +
+ +
10.0.0.91
+ + +
+ +
10.0.0.37
+ + +
+ +
10.0.0.93
+ + +
+ +
10.0.0.39
+ + +
+ +
10.0.0.95
+ + +
+ +
10.0.0.41
+ + +
+ +
10.0.0.97
+ + +
+ +
10.0.0.43
+ + +
+ +
10.0.0.99
+ + +
+ +
10.0.0.45
+ + +
+ +
10.0.0.101
+ + +
+ +
10.0.0.47
+ + +
+ +
10.0.0.103
+ + +
+ +
10.0.0.49
+ + +
+ +
10.0.0.105
+ + +
+ +
10.0.0.51
+ + +
+ +
10.0.0.107
+ + +
+ +
10.0.0.53
+ + +
+
+ +
+ + 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 + + + + 64016 + ARISTA17T0 + + + + 65200 + ARISTA17T2 + + + + 64016 + ARISTA18T0 + + + + 65200 + ARISTA18T2 + + + + 64016 + ARISTA19T0 + + + + 65200 + ARISTA19T2 + + + + 64016 + ARISTA20T0 + + + + 65200 + ARISTA20T2 + + + + 64016 + ARISTA21T0 + + + + 65200 + ARISTA21T2 + + + + 64016 + ARISTA22T0 + + + + 65200 + ARISTA22T2 + + + + 64016 + ARISTA23T0 + + + + 65200 + ARISTA23T2 + + + + 64016 + ARISTA24T0 + + + + 65200 + ARISTA24T2 + + + + 64016 + ARISTA25T0 + + + + 65200 + ARISTA25T2 + + + + 64016 + ARISTA26T0 + + + + 65200 + ARISTA26T2 + + + + 64016 + ARISTA27T0 + + + + 65200 + ARISTA27T2 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + switch2 + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet124 + 10.0.0.62/31 + + + + Ethernet128 + 10.0.0.64/31 + + + + Ethernet132 + 10.0.0.66/31 + + + + Ethernet136 + 10.0.0.68/31 + + + + Ethernet140 + 10.0.0.70/31 + + + + Ethernet144 + 10.0.0.72/31 + + + + Ethernet148 + 10.0.0.74/31 + + + + Ethernet152 + 10.0.0.76/31 + + + + Ethernet156 + 10.0.0.78/31 + + + + Ethernet160 + 10.0.0.80/31 + + + + Ethernet164 + 10.0.0.82/31 + + + + Ethernet168 + 10.0.0.84/31 + + + + Ethernet172 + 10.0.0.86/31 + + + + Ethernet176 + 10.0.0.88/31 + + + + Ethernet180 + 10.0.0.90/31 + + + + Ethernet184 + 10.0.0.92/31 + + + + Ethernet188 + 10.0.0.94/31 + + + + Ethernet192 + 10.0.0.96/31 + + + + Ethernet196 + 10.0.0.98/31 + + + + Ethernet200 + 10.0.0.100/31 + + + + Ethernet204 + 10.0.0.102/31 + + + + Ethernet208 + 10.0.0.104/31 + + + + Ethernet212 + 10.0.0.106/31 + + + + + + + + + + + + DeviceInterfaceLink + switch2 + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet64 + ARISTA17T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet68 + ARISTA18T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet72 + ARISTA19T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet76 + ARISTA20T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet80 + ARISTA21T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet84 + ARISTA22T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet88 + ARISTA23T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet92 + ARISTA24T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet96 + ARISTA25T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet100 + ARISTA26T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet104 + ARISTA27T2 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet108 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet112 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet116 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet120 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet124 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet128 + ARISTA06T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet132 + ARISTA07T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet136 + ARISTA08T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet140 + ARISTA09T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet144 + ARISTA10T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet148 + ARISTA11T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet152 + ARISTA12T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet156 + ARISTA13T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet160 + ARISTA14T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet164 + ARISTA15T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet168 + ARISTA16T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet172 + ARISTA17T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet176 + ARISTA18T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet180 + ARISTA19T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet184 + ARISTA20T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet188 + ARISTA21T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet192 + ARISTA22T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet196 + ARISTA23T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet200 + ARISTA24T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet204 + ARISTA25T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet208 + ARISTA26T0 + Ethernet1 + + + DeviceInterfaceLink + switch2 + Ethernet212 + ARISTA27T0 + Ethernet1 + + + + + switch2 + OSW1800-48x6q + + + + + + + switch2 + + + DhcpResources + + 192.168.1.111 + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + 192.0.0.1 + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + switch2 + OSW1800-48x6q +
diff --git a/device/wnc/x86_64-wnc_osw1800-r0/plugins/eeprom.py b/device/wnc/x86_64-wnc_osw1800-r0/plugins/eeprom.py new file mode 100644 index 000000000000..a073374794fa --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + 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-8/8-0052/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/wnc/x86_64-wnc_osw1800-r0/plugins/psuutil.py b/device/wnc/x86_64-wnc_osw1800-r0/plugins/psuutil.py new file mode 100644 index 000000000000..e62159c8a8cc --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/plugins/psuutil.py @@ -0,0 +1,64 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + def get_num_psus(self): + return 2 + + def get_psu_status(self, index): + if index == 1: + psu_path = "/sys/bus/i2c/devices/6-0050/eeprom" + elif index == 2: + psu_path = "/sys/bus/i2c/devices/6-0051/eeprom" + else: + return False + + try: + data = open(psu_path, "rb") + except IOError: + return False + + result = int(data.read(1).encode("hex"), 16) + data.close() + + if result != 255 and result != 0: + return True + else: + return False + + def get_psu_presence(self, index): + if index == 1: + psu_path = "/sys/bus/i2c/devices/6-0050/eeprom" + elif index == 2: + psu_path = "/sys/bus/i2c/devices/6-0051/eeprom" + else: + return False + + try: + data = open(psu_path, "rb") + except IOError: + return False + + result = int(data.read(1).encode("hex"), 16) + data.close() + + if result != 255 and result != 0: + return True + else: + return False diff --git a/device/wnc/x86_64-wnc_osw1800-r0/plugins/sfputil.py b/device/wnc/x86_64-wnc_osw1800-r0/plugins/sfputil.py new file mode 100644 index 000000000000..1c1e86bc5d6e --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/plugins/sfputil.py @@ -0,0 +1,205 @@ +#! /usr/bin/python +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase + import sys + sys.path.append('/usr/lib/python2.7/dist-packages/sonic_sfp/') + from sff8472 import sff8472InterfaceId + from sff8472 import sff8472Dom + from sff8436 import sff8436InterfaceId + from sff8436 import sff8436Dom +except ImportError, e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 53 + PORTS_IN_BLOCK = 54 + + EEPROM_OFFSET = 11 + + _port_to_eeprom_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.PORT_START + 48, self.PORTS_IN_BLOCK) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + bit_mask = port_num % 8 + + if port_num <= 7: + presence_path = "/sys/bus/i2c/devices/3-0031/sfp_mod_abs1" + elif 8 <= port_num and port_num <= 15: + presence_path = "/sys/bus/i2c/devices/3-0031/sfp_mod_abs2" + elif 16 <= port_num and port_num <= 23: + presence_path = "/sys/bus/i2c/devices/3-0031/sfp_mod_abs3" + elif 24 <= port_num and port_num <= 27: + presence_path = "/sys/bus/i2c/devices/3-0031/sfp_mod_abs4" + elif 28 <= port_num and port_num <= 31: + presence_path = "/sys/bus/i2c/devices/4-0032/sfp_mod_abs1" + bit_mask = bit_mask - 4 + elif 32 <= port_num and port_num <= 39: + presence_path = "/sys/bus/i2c/devices/4-0032/sfp_mod_abs2" + elif 40 <= port_num and port_num <= 47: + presence_path = "/sys/bus/i2c/devices/4-0032/sfp_mod_abs3" + elif 48 <= port_num and port_num <= 71: + presence_path = "/sys/bus/i2c/devices/4-0032/qsfp_modprs" + else: + return False + + try: + reg_file = open(presence_path, "rb") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + reg_value = int(content, 16) + reg_file.close() + + if reg_value & (1 << bit_mask) == 0: + return True + else: + return False + + def get_low_power_mode(self, port_num): + if port_num in self.qsfp_ports: + bit_mask = port_num % 8 + else: + return False + + try: + reg_file = open("/sys/bus/i2c/devices/4-0032/qsfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + content = reg_file.readline().rstrip() + reg_value = int(content, 16) + reg_file.close() + + if reg_value & (1 << bit_mask) == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + if port_num in self.qsfp_ports: + bit_mask = port_num % 8 + else: + return False + + try: + reg_file = open("/sys/bus/i2c/devices/4-0032/qsfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + reg_value = int(content, 16) + + if lpmode is True: + reg_value = reg_value | (1 << bit_mask) + else: + reg_value = reg_value & ~(1 << bit_mask) + + reg_file.seek(0) + reg_file.write(str(reg_value)) + reg_file.close() + + return True + + def reset(self, port_num): + if port_num in self.qsfp_ports: + bit_mask = (port_num % 8) + 2 + else: + return False + + try: + reg_file = open("/sys/bus/i2c/devices/4-0032/reset_control", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + reg_value = int(content, 16) + reg_value = reg_value & ~(1 << bit_mask) + + reg_file.seek(0) + reg_file.write(str(reg_value)) + reg_file.close() + + time.sleep(1) + + try: + reg_file = open("/sys/bus/i2c/devices/4-0032/reset_control", "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | (1 << bit_mask) + reg_file.seek(0) + reg_file.write(str(reg_value)) + reg_file.close() + + return True + + def get_eeprom_dict(self, port_num): + if not self.get_presence(port_num): + return None + + sfp_data = {} + + eeprom_ifraw = self.get_eeprom_raw(port_num) + eeprom_domraw = self.get_eeprom_dom_raw(port_num) + + if eeprom_ifraw is None: + return None + + if port_num in self.qsfp_ports: + sfpi_obj = sff8436InterfaceId(eeprom_ifraw) + if sfpi_obj is not None: + sfp_data['interface'] = sfpi_obj.get_data_pretty() + + sfpd_obj = sff8436Dom(eeprom_ifraw) + if sfpd_obj is not None: + sfp_data['dom'] = sfpd_obj.get_data_pretty() + return sfp_data + + sfpi_obj = sff8472InterfaceId(eeprom_ifraw) + if sfpi_obj is not None: + sfp_data['interface'] = sfpi_obj.get_data_pretty() + cal_type = sfpi_obj.get_calibration_type() + + if eeprom_domraw is not None: + sfpd_obj = sff8472Dom(eeprom_domraw, cal_type) + if sfpd_obj is not None: + sfp_data['dom'] = sfpd_obj.get_data_pretty() + + return sfp_data diff --git a/device/wnc/x86_64-wnc_osw1800-r0/sensors.conf b/device/wnc/x86_64-wnc_osw1800-r0/sensors.conf new file mode 100644 index 000000000000..d91945ff722b --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/sensors.conf @@ -0,0 +1,33 @@ +# libsensors configuration filei +# -------------------------------------------------- +# + +bus "i2c-7" "i2c-2-mux" +chip "tmp421-i2c-7-1E" + label temp1 "ts1" + set temp1_max 50 + set temp1_max_hyst 25 + label temp2 "ts4" + set temp2_max 50 + set temp2_max_hyst 25 + +chip "tmp75-i2c-7-4E" + label temp1 "ts3" + set temp1_max 50 + set temp1_max_hyst 25 + +chip "tmp421-i2c-7-4F" + label temp1 "ts2" + set temp1_max 50 + set temp1_max_hyst 25 + label temp2 "ts5" + set temp2_max 50 + set temp2_max_hyst 25 + +bus "i2c-5" "i2c-2-mux" +chip "wnc_cpld3-i2c-5-33" + label fan1 "fan1" + label fan2 "fan2" + label fan3 "fan3" + label fan4 "fan4" + label fan5 "fan5" diff --git a/dockers/docker-orchagent-bfn b/dockers/docker-orchagent-bfn new file mode 120000 index 000000000000..8d52609c56e5 --- /dev/null +++ b/dockers/docker-orchagent-bfn @@ -0,0 +1 @@ +docker-orchagent \ No newline at end of file diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 027c6d52a2fe..af9e5b0766ab 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -20,6 +20,8 @@ elif [ "$platform" == "cavium" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$platform" == "nephos" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$platform" == "barefoot" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" fi exec /usr/bin/orchagent ${ORCHAGENT_ARGS} diff --git a/dockers/docker-saiserver-bfn/Dockerfile b/dockers/docker-saiserver-bfn/Dockerfile new file mode 100755 index 000000000000..427a551e0096 --- /dev/null +++ b/dockers/docker-saiserver-bfn/Dockerfile @@ -0,0 +1,38 @@ +FROM docker-base + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +COPY ["deps/applibs_*.deb", "/deps/applibs-dev_*.deb", "/deps/sx-complib_*.deb", "/deps/sxd-libs_*.deb", "/deps/sx-scew_*.deb", "/deps/sx-examples_*.deb", "/deps/sx-gen-utils_*.deb", "/deps/python-sdk-api_*.deb", "/deps/iproute2_*.deb", "/deps/mlnx-sai_*.deb", "/deps/libthrift-0.9.3_*.deb", "/deps/libnl-3-200_*.deb", "/deps/libnl-genl-3-200_*.deb", "/deps/libnl-route-3-200_*.deb", "/deps/"] + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \ + dpkg_apt /deps/applibs_*.deb \ + && dpkg_apt /deps/applibs-dev_*.deb \ + && dpkg_apt /deps/sx-complib_*.deb \ + && dpkg_apt /deps/sxd-libs_*.deb \ + && dpkg_apt /deps/sx-scew_*.deb \ + && dpkg_apt /deps/sx-examples_*.deb \ + && dpkg_apt /deps/sx-gen-utils_*.deb \ + && dpkg_apt /deps/python-sdk-api_*.deb \ + && dpkg_apt /deps/iproute2_*.deb \ + && dpkg_apt /deps/mlnx-sai_*.deb \ + && dpkg_apt /deps/libthrift-0.9.3_*.deb \ + && dpkg_apt /deps/libnl-3-200_*.deb \ + && dpkg_apt /deps/libnl-genl-3-200_*.deb \ + && dpkg_apt /deps/libnl-route-3-200_*.deb + +COPY ["deps/saiserver", "start.sh", "/usr/bin/"] + +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +COPY ["profile.ini", "portmap.ini", "/etc/sai/"] + + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /deps + +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/dockers/docker-saiserver-bfn/portmap.ini b/dockers/docker-saiserver-bfn/portmap.ini new file mode 100644 index 000000000000..4d3be08ce5f8 --- /dev/null +++ b/dockers/docker-saiserver-bfn/portmap.ini @@ -0,0 +1,33 @@ +# alias lanes +Ethernet1 0,1,2,3 +Ethernet2 4,5,6,7 +Ethernet3 8,9,10,11 +Ethernet4 12,13,14,15 +Ethernet5 16,17,18,19 +Ethernet6 20,21,22,23 +Ethernet7 24,25,26,27 +Ethernet8 28,29,30,31 +Ethernet9 32,33,34,35 +Ethernet10 36,37,38,39 +Ethernet11 40,41,42,43 +Ethernet12 44,45,46,47 +Ethernet13 48,49,50,51 +Ethernet14 52,53,54,55 +Ethernet15 56,57,58,59 +Ethernet16 60,61,62,63 +Ethernet17 64,65,66,67 +Ethernet18 68,69,70,71 +Ethernet19 72,73,74,75 +Ethernet20 76,77,78,79 +Ethernet21 80,81,82,83 +Ethernet22 84,85,86,87 +Ethernet23 88,89,90,91 +Ethernet24 92,93,94,95 +Ethernet25 96,97,98,99 +Ethernet26 100,101,102,103 +Ethernet27 104,105,106,107 +Ethernet28 108,109,110,111 +Ethernet29 112,113,114,115 +Ethernet30 116,117,118,119 +Ethernet31 120,121,122,123 +Ethernet32 124,125,126,127 \ No newline at end of file diff --git a/dockers/docker-saiserver-bfn/profile.ini b/dockers/docker-saiserver-bfn/profile.ini new file mode 100644 index 000000000000..b20b2c6f0e06 --- /dev/null +++ b/dockers/docker-saiserver-bfn/profile.ini @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sai_tofino.xml diff --git a/dockers/docker-saiserver-bfn/sai_tofino.xml b/dockers/docker-saiserver-bfn/sai_tofino.xml new file mode 100644 index 000000000000..139597f9cb07 --- /dev/null +++ b/dockers/docker-saiserver-bfn/sai_tofino.xml @@ -0,0 +1,2 @@ + + diff --git a/dockers/docker-saiserver-bfn/start.sh b/dockers/docker-saiserver-bfn/start.sh new file mode 100755 index 000000000000..16457d13e03a --- /dev/null +++ b/dockers/docker-saiserver-bfn/start.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +supervisorctl start saiserver + diff --git a/dockers/docker-saiserver-bfn/supervisord.conf b/dockers/docker-saiserver-bfn/supervisord.conf new file mode 100644 index 000000000000..e09ac3cbb449 --- /dev/null +++ b/dockers/docker-saiserver-bfn/supervisord.conf @@ -0,0 +1,29 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:saiserver] +command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 23503017f179..b4d260092c43 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -125,7 +125,7 @@ def {% endif %} {%- if defs.generate_pg_profils is defined %} -{{ defs.generate_pg_profils }}, +{{ defs.generate_pg_profils(port_names_active) }} {% else %} "BUFFER_PG": { "{{ port_names_active }}|0-1": { diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index a702917419ca..b5b06904c508 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -4,6 +4,17 @@ ifdown --force eth0 sonic-cfggen -d -t /usr/share/sonic/templates/interfaces.j2 > /etc/network/interfaces +# Add usb0 interface for bfn platforms +platform=$(sonic-cfggen -H -v 'DEVICE_METADATA["localhost"]["platform"]') +if [[ "$platform" == "x86_64-accton_wedge100bf_32x-r0" || "$platform" == "x86_64-accton_wedge100bf_65x-r0" ]]; then +cat <<'EOF' >> /etc/network/interfaces +# BMC interface +auto usb0 +iface usb0 inet6 auto +up ifconfig usb0 txqueuelen 64 +EOF +fi + [ -f /var/run/dhclient.eth0.pid ] && kill `cat /var/run/dhclient.eth0.pid` && rm -f /var/run/dhclient.eth0.pid systemctl restart networking diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 71e2d2514fa2..924ff54af308 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -18,6 +18,7 @@ iface lo {{ 'inet' if prefix | ipv4 else 'inet6' }} static {% endfor %} {% endblock loopback %} {% block mgmt_interface %} + # The management network interface auto eth0 {% if MGMT_INTERFACE %} diff --git a/platform/barefoot/bfn-platform-ingrasys.mk b/platform/barefoot/bfn-platform-ingrasys.mk new file mode 100644 index 000000000000..a85d69baab79 --- /dev/null +++ b/platform/barefoot/bfn-platform-ingrasys.mk @@ -0,0 +1,5 @@ +BFN_INGRASYS_PLATFORM = bfnplatform-ingrasys_1.0.0_amd64.deb +$(BFN_INGRASYS_PLATFORM)_URL = "https://github.com/Ingrasys-sonic/packages/raw/master/lib/bfnplatform-ingrasys_1.0.0_amd64.deb" + +SONIC_ONLINE_DEBS += $(BFN_INGRASYS_PLATFORM) # $(BFN_SAI_DEV) +$(BFN_SAI_DEV)_DEPENDS += $(BFN_INGRASYS_PLATFORM) diff --git a/platform/barefoot/bfn-platform-wnc.mk b/platform/barefoot/bfn-platform-wnc.mk new file mode 100644 index 000000000000..e2f45d35b2b8 --- /dev/null +++ b/platform/barefoot/bfn-platform-wnc.mk @@ -0,0 +1,5 @@ +WNC_OSW1800_PLATFORM = bfnplatformwnc_1.0.0_amd64.deb +$(WNC_OSW1800_PLATFORM)_URL = "https://github.com/YaoTien/download/raw/master/sonic/sde/7_0_0_18/bfnplatformwnc_1.0.0_amd64.deb" + +SONIC_ONLINE_DEBS += $(WNC_OSW1800_PLATFORM) # $(BFN_SAI_DEV) +$(BFN_SAI_DEV)_DEPENDS += $(WNC_OSW1800_PLATFORM) diff --git a/platform/barefoot/bfn-platform.mk b/platform/barefoot/bfn-platform.mk new file mode 100644 index 000000000000..6f1e6e302961 --- /dev/null +++ b/platform/barefoot/bfn-platform.mk @@ -0,0 +1,5 @@ +BFN_PLATFORM = bfnplatform_1.0.0_amd64.deb +$(BFN_PLATFORM)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_2/bfnplatform_1.0.0_amd64.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 new file mode 100644 index 000000000000..7e507d15a9fe --- /dev/null +++ b/platform/barefoot/bfn-sai.mk @@ -0,0 +1,5 @@ +BFN_SAI = bfnsdk_1.0.0_amd64.deb +$(BFN_SAI)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_2/bfnsdk_1.0.0_amd64.deb" + +SONIC_ONLINE_DEBS += $(BFN_SAI) # $(BFN_SAI_DEV) +$(BFN_SAI_DEV)_DEPENDS += $(BFN_SAI) diff --git a/platform/barefoot/docker-orchagent-bfn.mk b/platform/barefoot/docker-orchagent-bfn.mk new file mode 100644 index 000000000000..f13fa63d6f2a --- /dev/null +++ b/platform/barefoot/docker-orchagent-bfn.mk @@ -0,0 +1,19 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_BFN = docker-orchagent-bfn.gz +$(DOCKER_ORCHAGENT_BFN)_PATH = $(DOCKERS_PATH)/docker-orchagent +$(DOCKER_ORCHAGENT_BFN)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_BFN)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BFN) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BFN) + +$(DOCKER_ORCHAGENT_BFN)_CONTAINER_NAME = swss +$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro +$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro +$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro +$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw + +$(DOCKER_ORCHAGENT_BFN)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_BFN)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/barefoot/docker-ptf-bfn.mk b/platform/barefoot/docker-ptf-bfn.mk new file mode 100644 index 000000000000..573e9cd9cffa --- /dev/null +++ b/platform/barefoot/docker-ptf-bfn.mk @@ -0,0 +1,5 @@ +# docker image for docker-ptf + +DOCKER_PTF_BFN = docker-ptf-bfn.gz +$(DOCKER_PTF_BFN)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift +$(DOCKER_PTF_BFN)_LOAD_DOCKERS += $(DOCKER_PTF) diff --git a/platform/barefoot/docker-syncd-bfn-rpc.mk b/platform/barefoot/docker-syncd-bfn-rpc.mk new file mode 100644 index 000000000000..61f5570c1612 --- /dev/null +++ b/platform/barefoot/docker-syncd-bfn-rpc.mk @@ -0,0 +1,15 @@ +# docker image for syncd with rpc + +DOCKER_SYNCD_BFN_RPC = docker-syncd-bfn-rpc.gz +$(DOCKER_SYNCD_BFN_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-bfn-rpc +$(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) +$(DOCKER_SYNCD_BFN_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BFN) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN_RPC) +endif + +$(DOCKER_SYNCD_BFN_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 new file mode 100644 index 000000000000..9efeeb3f6b51 --- /dev/null +++ b/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 @@ -0,0 +1,52 @@ +FROM docker-syncd-bfn + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +COPY \ +{% for deb in docker_syncd_bfn_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -P syncd + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +{% for deb in docker_syncd_bfn_rpc_debs.split(' ') -%} +dpkg_apt debs/{{ deb }}{{'; '}} +{%- endfor %} + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + python-pip \ + build-essential \ + libssl-dev \ + libffi-dev \ + python-dev \ + wget \ + cmake \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ + && pip install cffi==1.7.0 \ + && pip install --upgrade cffi==1.7.0 \ + && pip install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /root/deps + +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/platform/barefoot/docker-syncd-bfn-rpc/ptf_nn_agent.conf b/platform/barefoot/docker-syncd-bfn-rpc/ptf_nn_agent.conf new file mode 100644 index 000000000000..fa1ed0eb1622 --- /dev/null +++ b/platform/barefoot/docker-syncd-bfn-rpc/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/platform/barefoot/docker-syncd-bfn.mk b/platform/barefoot/docker-syncd-bfn.mk new file mode 100644 index 000000000000..22bb10763e75 --- /dev/null +++ b/platform/barefoot/docker-syncd-bfn.mk @@ -0,0 +1,15 @@ +# docker image for syncd + +DOCKER_SYNCD_BFN = docker-syncd-bfn.gz +$(DOCKER_SYNCD_BFN)_PATH = $(PLATFORM_PATH)/docker-syncd-bfn +$(DOCKER_SYNCD_BFN)_DEPENDS += $(SYNCD) +$(DOCKER_SYNCD_BFN)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN) +ifneq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN) +endif + +$(DOCKER_SYNCD_BFN)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BFN)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_BFN)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_BFN)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 new file mode 100755 index 000000000000..3e31e4b94417 --- /dev/null +++ b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 @@ -0,0 +1,29 @@ +FROM docker-config-engine + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +COPY \ +{% for deb in docker_syncd_bfn_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN apt-get install -y libxml2 libpcap-dev libusb-1.0-0-dev libcurl3 libcurl4-gnutls-dev libunwind8-dev + +RUN dpkg -i \ +{% for deb in docker_syncd_bfn_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +COPY ["start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/bin/supervisord"] + diff --git a/platform/barefoot/docker-syncd-bfn/start.sh b/platform/barefoot/docker-syncd-bfn/start.sh new file mode 100755 index 000000000000..1a39db4a9d83 --- /dev/null +++ b/platform/barefoot/docker-syncd-bfn/start.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +. /opt/bfn/install/bin/dma_setup.sh +# . /opt/bfn/install/bin/bf_kdrv_mod_load /opt/bfn/install +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/bfn/install/lib supervisorctl start syncd diff --git a/platform/barefoot/docker-syncd-bfn/supervisord.conf b/platform/barefoot/docker-syncd-bfn/supervisord.conf new file mode 100644 index 000000000000..1e015fef931f --- /dev/null +++ b/platform/barefoot/docker-syncd-bfn/supervisord.conf @@ -0,0 +1,29 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:syncd] +command=/usr/bin/syncd_start.sh +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + diff --git a/platform/barefoot/libsaithrift-dev.mk b/platform/barefoot/libsaithrift-dev.mk new file mode 100644 index 000000000000..c9c8cbb3adca --- /dev/null +++ b/platform/barefoot/libsaithrift-dev.mk @@ -0,0 +1,7 @@ +# libsaithrift-dev package + +LIBSAITHRIFT_DEV_BFN = libsaithrift-dev_0.9.4_amd64.deb +$(LIBSAITHRIFT_DEV_BFN)_SRC_PATH = $(SRC_PATH)/SAI +$(LIBSAITHRIFT_DEV_BFN)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(BFN_SAI) $(BFN_SAI_DEV) +$(LIBSAITHRIFT_DEV_BFN)_RDEPENDS += $(LIBTHRIFT) $(BFN_SAI) +#SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_BFN) diff --git a/platform/barefoot/one-image.mk b/platform/barefoot/one-image.mk new file mode 100644 index 000000000000..a7b5d009516d --- /dev/null +++ b/platform/barefoot/one-image.mk @@ -0,0 +1,11 @@ +# sonic one image installer + +SONIC_ONE_IMAGE = sonic-barefoot.bin +$(SONIC_ONE_IMAGE)_MACHINE = barefoot +$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_ONE_IMAGE)_INSTALLS += $(BFN_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(WNC_OSW1800_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9180_32X_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/barefoot/platform-modules-bfn-montara.mk b/platform/barefoot/platform-modules-bfn-montara.mk new file mode 100644 index 000000000000..113faf201e41 --- /dev/null +++ b/platform/barefoot/platform-modules-bfn-montara.mk @@ -0,0 +1,11 @@ +# BFN Platform modules + +BFN_MONTARA_PLATFORM_MODULE_VERSION = 1.0 + +export BFN_MONTARA_PLATFORM_MODULE_VERSION + +BFN_MONTARA_PLATFORM_MODULE = platform-modules-bfn-montara_$(BFN_MONTARA_PLATFORM_MODULE_VERSION)_amd64.deb +$(BFN_MONTARA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-bfn-montara +$(BFN_MONTARA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(BFN_MONTARA_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_32x-r0 +SONIC_DPKG_DEBS += $(BFN_MONTARA_PLATFORM_MODULE) diff --git a/platform/barefoot/platform-modules-bfn.mk b/platform/barefoot/platform-modules-bfn.mk new file mode 100644 index 000000000000..3f76e94aa0b2 --- /dev/null +++ b/platform/barefoot/platform-modules-bfn.mk @@ -0,0 +1,11 @@ +# BFN Platform modules + +BFN_PLATFORM_MODULE_VERSION = 1.0 + +export BFN_PLATFORM_MODULE_VERSION + +BFN_PLATFORM_MODULE = platform-modules-bfn_$(BFN_PLATFORM_MODULE_VERSION)_amd64.deb +$(BFN_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-bfn +$(BFN_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(BFN_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_65x-r0 +SONIC_DPKG_DEBS += $(BFN_PLATFORM_MODULE) diff --git a/platform/barefoot/platform-modules-ingrasys.mk b/platform/barefoot/platform-modules-ingrasys.mk new file mode 100644 index 000000000000..7204adb7e02d --- /dev/null +++ b/platform/barefoot/platform-modules-ingrasys.mk @@ -0,0 +1,11 @@ +# Ingrasys S9180-32X Platform modules + +INGRASYS_S9180_32X_PLATFORM_MODULE_VERSION = 1.1.0 + +export INGRASYS_S9180_32X_PLATFORM_MODULE_VERSION + +INGRASYS_S9180_32X_PLATFORM_MODULE = sonic-platform-ingrasys-s9180-32x_$(INGRASYS_S9180_32X_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S9180_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys +$(INGRASYS_S9180_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(INGRASYS_S9180_32X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9180_32x-r0 +SONIC_DPKG_DEBS += $(INGRASYS_S9180_32X_PLATFORM_MODULE) diff --git a/platform/barefoot/platform-modules-wnc-osw1800.mk b/platform/barefoot/platform-modules-wnc-osw1800.mk new file mode 100644 index 000000000000..a85ba6b19326 --- /dev/null +++ b/platform/barefoot/platform-modules-wnc-osw1800.mk @@ -0,0 +1,11 @@ +# BFN Platform modules + +WNC_OSW1800_PLATFORM_MODULE_VERSION = 1.0 + +export WNC_OSW1800_PLATFORM_MODULE_VERSION + +WNC_OSW1800_PLATFORM_MODULE = platform-modules-wnc-osw1800_$(WNC_OSW1800_PLATFORM_MODULE_VERSION)_amd64.deb +$(WNC_OSW1800_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-wnc-osw1800 +$(WNC_OSW1800_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(WNC_OSW1800_PLATFORM_MODULE)_PLATFORM = x86_64-wnc_osw1800-r0 +SONIC_DPKG_DEBS += $(WNC_OSW1800_PLATFORM_MODULE) diff --git a/platform/barefoot/platform.conf b/platform/barefoot/platform.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/barefoot/python-saithrift.mk b/platform/barefoot/python-saithrift.mk new file mode 100644 index 000000000000..ba4846402fb8 --- /dev/null +++ b/platform/barefoot/python-saithrift.mk @@ -0,0 +1,6 @@ +# python-saithrift package + +PYTHON_SAITHRIFT_BFN = python-saithrift_0.9.4_amd64.deb +$(PYTHON_SAITHRIFT_BFN)_SRC_PATH = $(SRC_PATH)/SAI +$(PYTHON_SAITHRIFT_BFN)_DEPENDS += $(BFN_SAI_DEV) $(BFN_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) +#SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_BFN) diff --git a/platform/barefoot/rules.mk b/platform/barefoot/rules.mk new file mode 100644 index 000000000000..f10952dfadc2 --- /dev/null +++ b/platform/barefoot/rules.mk @@ -0,0 +1,23 @@ +include $(PLATFORM_PATH)/platform-modules-bfn.mk +include $(PLATFORM_PATH)/platform-modules-bfn-montara.mk +include $(PLATFORM_PATH)/platform-modules-wnc-osw1800.mk +include $(PLATFORM_PATH)/platform-modules-ingrasys.mk +include $(PLATFORM_PATH)/bfn-sai.mk +include $(PLATFORM_PATH)/docker-syncd-bfn.mk +include $(PLATFORM_PATH)/docker-syncd-bfn-rpc.mk +include $(PLATFORM_PATH)/docker-orchagent-bfn.mk +include $(PLATFORM_PATH)/one-image.mk +include $(PLATFORM_PATH)/libsaithrift-dev.mk +include $(PLATFORM_PATH)/python-saithrift.mk +include $(PLATFORM_PATH)/docker-ptf-bfn.mk +include $(PLATFORM_PATH)/bfn-platform.mk +include $(PLATFORM_PATH)/bfn-platform-wnc.mk +include $(PLATFORM_PATH)/bfn-platform-ingrasys.mk +SONIC_ALL += $(SONIC_ONE_IMAGE) \ + $(DOCKER_FPM) + +# Inject sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(BFN_SAI) $(WNC_OSW1800_PLATFORM) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) #$(LIBSAITHRIFT_DEV_BFN) + +# Runtime dependency on sai is set only for syncd +$(SYNCD)_RDEPENDS += $(BFN_SAI) $(WNC_OSW1800_PLATFORM) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/LICENSE b/platform/barefoot/sonic-platform-modules-bfn-montara/LICENSE new file mode 100644 index 000000000000..676cdeec726b --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2016 Microsoft, Inc + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS b/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS new file mode 100644 index 000000000000..ed64c7824250 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS @@ -0,0 +1,3 @@ +# This file describes the maintainers for sonic-platform-modules-bfn +# See the SONiC project governance document for more information +Mailinglist = sonicproject@googlegroups.com diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/README.md b/platform/barefoot/sonic-platform-modules-bfn-montara/README.md new file mode 100644 index 000000000000..5dc055a1d9c3 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/README.md @@ -0,0 +1,2 @@ +# sonic-platform-modules-bfn +Device drivers for support of BFN platform for the SONiC project diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/changelog b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/changelog new file mode 100644 index 000000000000..80c1d96d3445 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/changelog @@ -0,0 +1,5 @@ +platform-modules-bfn-montara (1.0) unstable; urgency=low + + * Initial release + + -- Support Mon, 11 Nov 2015 11:11:11 -0800 diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/compat b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/compat new file mode 100644 index 000000000000..45a4fb75db86 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/compat @@ -0,0 +1 @@ +8 diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control new file mode 100644 index 000000000000..2b1a9804baea --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control @@ -0,0 +1,12 @@ +Source: platform-modules-bfn-montara +Section: main +Priority: extra +Maintainer: Support +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-bfn-montara +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/copyright b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/copyright new file mode 100644 index 000000000000..ade42b7aa75a --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/copyright @@ -0,0 +1,15 @@ +Provides linux kernel driver for BF PCIe devices + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules new file mode 100755 index 000000000000..e48edc304904 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules @@ -0,0 +1,32 @@ +#!/usr/bin/make -f + +export INSTALL_MOD_DIR:=extra + +PACKAGE_NAME := platform-modules-bfn-montara +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MODULE_SRC := $(shell pwd)/modules +SCRIPT_SRC := $(shell pwd)/scripts + +%: + dh $@ + +override_dh_auto_build: + make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + +override_dh_auto_install: + dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR) + cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) + dh_installdirs -p$(PACKAGE_NAME) usr/local/bin + cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin + +override_dh_usrlocal: + +override_dh_pysupport: + +override_dh_clean: + dh_clean + rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd + rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order + rm -rf $(MODULE_SRC)/.tmp_versions + diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/modules/Makefile b/platform/barefoot/sonic-platform-modules-bfn-montara/modules/Makefile new file mode 120000 index 000000000000..d394585dd286 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/modules/Makefile @@ -0,0 +1 @@ +../../sonic-platform-modules-bfn/modules/Makefile \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_kdrv.c b/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_kdrv.c new file mode 120000 index 000000000000..959d811823c0 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_kdrv.c @@ -0,0 +1 @@ +../../sonic-platform-modules-bfn/modules/bf_kdrv.c \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_tun.c b/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_tun.c new file mode 120000 index 000000000000..ea380c3075a7 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_tun.c @@ -0,0 +1 @@ +../../sonic-platform-modules-bfn/modules/bf_tun.c \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/eeprom b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/eeprom new file mode 100755 index 000000000000..07d98556cbbf --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/eeprom @@ -0,0 +1,10 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS syncd eeprom "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/fancontrol b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/fancontrol new file mode 100755 index 000000000000..515fcbdd69da --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/fancontrol @@ -0,0 +1,11 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS syncd fancontrol "$@" + diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/ps_info b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/ps_info new file mode 100755 index 000000000000..38c9d3330414 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/ps_info @@ -0,0 +1,10 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS syncd ps_info "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sensors b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sensors new file mode 100755 index 000000000000..07af6955321e --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sensors @@ -0,0 +1,12 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS syncd sensors "$@" + + diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sfputil b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sfputil new file mode 100755 index 000000000000..3df67614e499 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sfputil @@ -0,0 +1,10 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS syncd sfputil "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/test b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/test new file mode 100755 index 000000000000..38327722c91f --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/test @@ -0,0 +1 @@ +echo "test" diff --git a/platform/barefoot/sonic-platform-modules-bfn/LICENSE b/platform/barefoot/sonic-platform-modules-bfn/LICENSE new file mode 100644 index 000000000000..676cdeec726b --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2016 Microsoft, Inc + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/barefoot/sonic-platform-modules-bfn/MAINTAINERS b/platform/barefoot/sonic-platform-modules-bfn/MAINTAINERS new file mode 100644 index 000000000000..b9c62ce01546 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/MAINTAINERS @@ -0,0 +1,4 @@ +# This file describes the maintainers for sonic-platform-modules-bfn +# See the SONiC project governance document for more information + +Mailinglist = sonicproject@googlegroups.com diff --git a/platform/barefoot/sonic-platform-modules-bfn/README.md b/platform/barefoot/sonic-platform-modules-bfn/README.md new file mode 100644 index 000000000000..5dc055a1d9c3 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/README.md @@ -0,0 +1,2 @@ +# sonic-platform-modules-bfn +Device drivers for support of BFN platform for the SONiC project diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/changelog b/platform/barefoot/sonic-platform-modules-bfn/debian/changelog new file mode 100644 index 000000000000..d5df34112672 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/changelog @@ -0,0 +1,5 @@ +platform-modules-bfn (1.0) unstable; urgency=low + + * Initial release + + -- Support Mon, 11 Nov 2015 11:11:11 -0800 diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/compat b/platform/barefoot/sonic-platform-modules-bfn/debian/compat new file mode 100644 index 000000000000..45a4fb75db86 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/compat @@ -0,0 +1 @@ +8 diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/control b/platform/barefoot/sonic-platform-modules-bfn/debian/control new file mode 100644 index 000000000000..09d0cc82d2c3 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/control @@ -0,0 +1,12 @@ +Source: platform-modules-bfn +Section: main +Priority: extra +Maintainer: support +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-bfn +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/copyright b/platform/barefoot/sonic-platform-modules-bfn/debian/copyright new file mode 100644 index 000000000000..ade42b7aa75a --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/copyright @@ -0,0 +1,15 @@ +Provides linux kernel driver for BF PCIe devices + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/files b/platform/barefoot/sonic-platform-modules-bfn/debian/files new file mode 100644 index 000000000000..1cfb92c60ae1 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/files @@ -0,0 +1 @@ +platform-modules-bfn_1.0_amd64.deb main extra diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/rules b/platform/barefoot/sonic-platform-modules-bfn/debian/rules new file mode 100755 index 000000000000..73aa5d84da0b --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/rules @@ -0,0 +1,32 @@ +#!/usr/bin/make -f + +export INSTALL_MOD_DIR:=extra + +PACKAGE_NAME := platform-modules-bfn +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MODULE_SRC := $(shell pwd)/modules +SCRIPT_SRC := $(shell pwd)/scripts + +%: + dh $@ + +override_dh_auto_build: + make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + +override_dh_auto_install: + dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR) + cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) + dh_installdirs -p$(PACKAGE_NAME) usr/local/bin + cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin + +override_dh_usrlocal: + +override_dh_pysupport: + +override_dh_clean: + dh_clean + rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd + rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order + rm -rf $(MODULE_SRC)/.tmp_versions + diff --git a/platform/barefoot/sonic-platform-modules-bfn/modules/Makefile b/platform/barefoot/sonic-platform-modules-bfn/modules/Makefile new file mode 100644 index 000000000000..d180b29f6ae2 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := bf_kdrv.o +obj-m += bf_tun.o diff --git a/platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c b/platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c new file mode 100644 index 000000000000..fd66ad09493a --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c @@ -0,0 +1,1254 @@ +/******************************************************************************* + * BAREFOOT NETWORKS CONFIDENTIAL & PROPRIETARY + * + * Copyright (c) 2015-2016 Barefoot Networks, Inc. + + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains the property of + * Barefoot Networks, Inc. and its suppliers, if any. The intellectual and + * technical concepts contained herein are proprietary to Barefoot Networks, + * Inc. + * and its suppliers and may be covered by U.S. and Foreign Patents, patents in + * process, and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from + * Barefoot Networks, Inc. + * + * No warranty, explicit or implicit is provided, unless granted under a + * written agreement with Barefoot Networks, Inc. + * + * $Id: $ + * + ******************************************************************************/ +/** + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2015 Barefoot Networks. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the... + * + **/ + +/* bf_drv kernel module + * + * This is kernel mode driver for Tofino chip. + * Provides user space mmap service and user space "wait for interrupt" + * and "enable interrupt" services. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + #include +#else + #include +#endif + +#include +#include +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) +//#error unsupported linux kernel version +#endif + +/* TBD: Need to build with CONFIG_PCI_MSI */ +extern int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); +extern int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, int minvec, int maxvec); + +#define PCI_VENDOR_ID_BF 0x1d1c +#define TOFINO_DEV_ID_A0 0x01 +#define TOFINO_DEV_ID_B0 0x10 + +#ifndef PCI_MSIX_ENTRY_SIZE +#define PCI_MSIX_ENTRY_SIZE 16 +#define PCI_MSIX_ENTRY_LOWER_ADDR 0 +#define PCI_MSIX_ENTRY_UPPER_ADDR 4 +#define PCI_MSIX_ENTRY_DATA 8 +#define PCI_MSIX_ENTRY_VECTOR_CTRL 12 +#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 +#endif + +#define BF_CLASS_NAME "bf" +#define BF_MAX_DEVICE_CNT 256 +#define BF_INTR_MODE_NONE_NAME "none" +#define BF_INTR_MODE_LEGACY_NAME "legacy" +#define BF_INTR_MODE_MSI_NAME "msi" +#define BF_INTR_MODE_MSIX_NAME "msix" +#define BF_MAX_BAR_MAPS 6 +#define BF_MSIX_ENTRY_CNT 128 /* TBD make it 512 */ +#define BF_MSI_ENTRY_CNT 2 + +/* interrupt mode */ +enum bf_intr_mode { + BF_INTR_MODE_NONE = 0, + BF_INTR_MODE_LEGACY, + BF_INTR_MODE_MSI, + BF_INTR_MODE_MSIX +}; + +/* device memory */ +struct bf_dev_mem { + const char *name; + phys_addr_t addr; + resource_size_t size; + void __iomem *internal_addr; +}; + +struct bf_listener { + struct bf_pci_dev *bfdev; + s32 event_count[BF_MSIX_ENTRY_CNT]; + int minor; + struct bf_listener *next; +}; + +/* device information */ +struct bf_dev_info { + struct module *owner; + struct device *dev; + int minor; + atomic_t event[BF_MSIX_ENTRY_CNT]; + wait_queue_head_t wait; + const char *version; + struct bf_dev_mem mem[BF_MAX_BAR_MAPS]; + struct msix_entry *msix_entries; + long irq; /* first irq vector */ + int num_irq; /* number of irq vectors */ + unsigned long irq_flags;/* sharable ?? */ + int pci_error_state; /* was there a pci bus error */ +}; + +/* cookie to be passed to IRQ handler, useful especially with MSIX */ +struct bf_int_vector { + struct bf_pci_dev *bf_dev; + int int_vec_offset; +}; + + +/** + * A structure describing the private information for a BF pcie device. + */ +struct bf_pci_dev { + struct bf_dev_info info; + struct pci_dev *pdev; + enum bf_intr_mode mode; + u8 instance; + char name[16]; + struct bf_int_vector bf_int_vec[BF_MSIX_ENTRY_CNT]; + struct bf_listener *listener_head; /* head of a singly linked list of + listeners */ +}; + +/* Keep any global information here that must survive even after the + * bf_pci_dev is free-ed up. + */ +struct bf_global { + struct bf_pci_dev *bfdev ; + struct cdev *bf_cdev; + struct fasync_struct *async_queue; +}; + +static int bf_major; +static int bf_minor[BF_MAX_DEVICE_CNT] = {0}; +static struct class *bf_class = NULL; +static char *intr_mode = NULL; +static enum bf_intr_mode bf_intr_mode_default = BF_INTR_MODE_MSI; +static spinlock_t bf_nonisr_lock; +/* dev->minor should index into this array */ +static struct bf_global bf_global[BF_MAX_DEVICE_CNT]; + +static void bf_add_listener(struct bf_pci_dev *bfdev, + struct bf_listener *listener) +{ + struct bf_listener **cur_listener = &bfdev->listener_head; + + if (!listener) { + return; + } + spin_lock(&bf_nonisr_lock); + + while (*cur_listener) { + cur_listener = &((*cur_listener)->next); + } + *cur_listener = listener; + listener->next = NULL; + + spin_unlock(&bf_nonisr_lock); +} + +static void bf_remove_listener(struct bf_pci_dev *bfdev, + struct bf_listener *listener) +{ + struct bf_listener **cur_listener = &bfdev->listener_head; + + /* in case of certain error conditions, this function might be called after bf_pci_remove() + */ + if (!bfdev || !listener) { + return; + } + spin_lock(&bf_nonisr_lock); + + if (*cur_listener == listener) { + *cur_listener = listener->next; + } else { + while (*cur_listener) { + if ((*cur_listener)->next == listener) { + (*cur_listener)->next = listener->next; + break; + } + cur_listener = &((*cur_listener)->next); + } + listener->next = NULL; + } + + spin_unlock(&bf_nonisr_lock); +} + +/* a pool of minor numbers is maintained */ +/* return the first available minor number */ +static int bf_get_next_minor_no(int *minor) +{ + int i; + + spin_lock(&bf_nonisr_lock); + for(i = 0; i < BF_MAX_DEVICE_CNT; i++) { + if (bf_minor[i] == 0) { + *minor = i; + bf_minor[i] = 1; /* mark it as taken */ + spin_unlock(&bf_nonisr_lock); + return 0; + } + } + *minor = -1; + spin_unlock(&bf_nonisr_lock); + return -1; +} + +/* return a minor number back to the pool for recycling */ +static int bf_return_minor_no(int minor) +{ + int err; + + spin_lock(&bf_nonisr_lock); + if (bf_minor[minor] == 0) { /* was already returned */ + err = -1; /* don't change anything, but return error */ + } else { + bf_minor[minor] = 0; /* mark it as available */ + err = 0; + } + spin_unlock(&bf_nonisr_lock); + return err; +} + +static inline struct bf_pci_dev *bf_get_pci_dev(struct bf_dev_info *info) +{ + return container_of(info, struct bf_pci_dev, info); +} + +/* + * It masks the msix on/off of generating MSI-X messages. + */ +static void +bf_msix_mask_irq(struct msi_desc *desc, int32_t state) +{ + u32 mask_bits = desc->masked; + unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_VECTOR_CTRL; + + if (state != 0) + mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT; + else + mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT; + + if (mask_bits != desc->masked) { + writel(mask_bits, desc->mask_base + offset); + readl(desc->mask_base); + desc->masked = mask_bits; + } +} + +/** + * irqcontrol can be used to disable/enable interrupt from user space processes. + * + * @param bf_dev + * pointer to bf_pci_dev + * @param irq_state + * state value. 1 to enable interrupt, 0 to disable interrupt. + * + * @return + * - On success, 0. + * - On failure, a negative value. + */ +static int +bf_pci_irqcontrol(struct bf_pci_dev *bfdev, s32 irq_state) +{ + struct pci_dev *pdev = bfdev->pdev; + + pci_cfg_access_lock(pdev); + if (bfdev->mode == BF_INTR_MODE_LEGACY) + pci_intx(pdev, !!irq_state); + + else if (bfdev->mode == BF_INTR_MODE_MSIX) { + struct msi_desc *desc; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + list_for_each_entry(desc, &pdev->msi_list, list) + bf_msix_mask_irq(desc, irq_state); +#else + for_each_pci_msi_entry(desc, pdev) + bf_msix_mask_irq(desc, irq_state); +#endif + } + pci_cfg_access_unlock(pdev); + + return 0; +} + +/** + * interrupt handler which will check if the interrupt is from the right + * device. If so, disable it here and will be enabled later. + */ +static irqreturn_t bf_pci_irqhandler(int irq, struct bf_pci_dev *bfdev) +{ + /* Legacy mode need to mask in hardware */ + if (bfdev->mode == BF_INTR_MODE_LEGACY && + !pci_check_and_mask_intx(bfdev->pdev)) + return IRQ_NONE; + + /* NOTE : if bfdev->info.pci_error_state == 1, then do not access the + * device and return IRQ_NOTHANDLED. + */ + /* Message signal mode, no share IRQ and automasked */ + return IRQ_HANDLED; +} + +/* Remap pci resources described by bar #pci_bar */ +static int +bf_pci_setup_iomem(struct pci_dev *dev, struct bf_dev_info *info, + int n, int pci_bar, const char *name) +{ + unsigned long addr, len; + void *internal_addr; + + if (sizeof(info->mem) / sizeof(info->mem[0]) <= n) + return -EINVAL; + + addr = pci_resource_start(dev, pci_bar); + len = pci_resource_len(dev, pci_bar); + if (addr == 0 || len == 0) + return -1; + internal_addr = pci_ioremap_bar(dev, pci_bar); + if (internal_addr == NULL) + return -1; + info->mem[n].name = name; + info->mem[n].addr = addr; + info->mem[n].internal_addr = internal_addr; + info->mem[n].size = len; + return 0; +} + +/* Unmap previously ioremap'd resources */ +static void +bf_pci_release_iomem(struct bf_dev_info *info) +{ + int i; + + for (i = 0; i < BF_MAX_BAR_MAPS; i++) { + if (info->mem[i].internal_addr) + iounmap(info->mem[i].internal_addr); + } +} + +static int +bf_setup_bars(struct pci_dev *dev, struct bf_dev_info *info) +{ + int i, iom, ret; + unsigned long flags; + static const char *bar_names[BF_MAX_BAR_MAPS] = { + "BAR0", "BAR1", "BAR2", "BAR3", "BAR4", "BAR5", + }; + + iom = 0; + + for (i = 0; i < BF_MAX_BAR_MAPS; i++) { + if (pci_resource_len(dev, i) != 0 && + pci_resource_start(dev, i) != 0) { + flags = pci_resource_flags(dev, i); + if (flags & IORESOURCE_MEM) { + ret = bf_pci_setup_iomem(dev, info, iom, i, bar_names[i]); + if (ret != 0) + return ret; + iom++; + } + } + } + return (iom != 0) ? ret : -ENOENT; +} + +static irqreturn_t bf_interrupt(int irq, void *bfdev_id) +{ + struct bf_pci_dev *bfdev = ((struct bf_int_vector *)bfdev_id)->bf_dev; + int vect_off = ((struct bf_int_vector *)bfdev_id)->int_vec_offset; + + irqreturn_t ret = bf_pci_irqhandler(irq, bfdev); + + if (ret == IRQ_HANDLED) + atomic_inc(&(bfdev->info.event[vect_off])); + + return ret; +} + +static unsigned int bf_poll(struct file *filep, poll_table *wait) +{ + struct bf_listener *listener = (struct bf_listener *)filep->private_data; + struct bf_pci_dev *bfdev = listener->bfdev; + int i; + + if (!bfdev) { + return -ENODEV; + } + if (!bfdev->info.irq) + return -EIO; + + poll_wait(filep, &bfdev->info.wait, wait); + + for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) + if (listener->event_count[i] != atomic_read(&bfdev->info.event[i])) + return POLLIN | POLLRDNORM; + return 0; +} + +static int bf_find_mem_index(struct vm_area_struct *vma) +{ + struct bf_pci_dev *bfdev = vma->vm_private_data; + if (vma->vm_pgoff < BF_MAX_BAR_MAPS) { + if (bfdev->info.mem[vma->vm_pgoff].size == 0) + return -1; + return (int)vma->vm_pgoff; + } + return -1; +} + +static const struct vm_operations_struct bf_physical_vm_ops = { +#ifdef CONFIG_HAVE_IOREMAP_PROT + .access = generic_access_phys, +#endif +}; + +static int bf_mmap_physical(struct vm_area_struct *vma) +{ + struct bf_pci_dev *bfdev = vma->vm_private_data; + int bar = bf_find_mem_index(vma); + struct bf_dev_mem *mem; + if (bar < 0) + return -EINVAL; + + mem = bfdev->info.mem + bar; + + if (mem->addr & ~PAGE_MASK) + return -ENODEV; + if (vma->vm_end - vma->vm_start > mem->size) + return -EINVAL; + + vma->vm_ops = &bf_physical_vm_ops; + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + + /* + * We cannot use the vm_iomap_memory() helper here, + * because vma->vm_pgoff is the map index we looked + * up above in bf_find_mem_index(), rather than an + * actual page offset into the mmap. + * + * So we just do the physical mmap without a page + * offset. + */ + return remap_pfn_range(vma, vma->vm_start, mem->addr >> PAGE_SHIFT, + vma->vm_end - vma->vm_start, vma->vm_page_prot); +} + +static int bf_mmap(struct file *filep, struct vm_area_struct *vma) +{ + struct bf_listener *listener = filep->private_data; + struct bf_pci_dev *bfdev = listener->bfdev; + int bar; + unsigned long requested_pages, actual_pages; + + if (!bfdev) { + return -ENODEV; + } + if (vma->vm_end < vma->vm_start) + return -EINVAL; + + vma->vm_private_data = bfdev; + + bar = bf_find_mem_index(vma); + if (bar < 0) + return -EINVAL; + + requested_pages = vma_pages(vma); + actual_pages = ((bfdev->info.mem[bar].addr & ~PAGE_MASK) + + bfdev->info.mem[bar].size + PAGE_SIZE -1) >> PAGE_SHIFT; + if (requested_pages > actual_pages) + return -EINVAL; + + return bf_mmap_physical(vma); +} + +static int bf_fasync(int fd, struct file *filep, int mode) +{ + int minor; + + if (!filep->private_data) { + return (-EINVAL); + } + minor = ((struct bf_listener *)filep->private_data)->minor; + if (minor >= BF_MAX_DEVICE_CNT) { + return (-EINVAL); + } + if (mode == 0 && &bf_global[minor].async_queue == NULL) { + return 0; /* nothing to do */ + } + return (fasync_helper(fd, filep, mode, &bf_global[minor].async_queue)); +} + +static int bf_open(struct inode *inode, struct file *filep) +{ + struct bf_pci_dev *bfdev; + struct bf_listener *listener; + int i; + + bfdev = bf_global[iminor(inode)].bfdev; + listener = kmalloc(sizeof(*listener), GFP_KERNEL); + if (listener) { + listener->bfdev = bfdev; + listener->minor = bfdev->info.minor; + listener->next = NULL; + bf_add_listener(bfdev, listener); + for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) + listener->event_count[i] = atomic_read(&bfdev->info.event[i]); + filep->private_data = listener; + return 0; + } else { + return(-ENOMEM); + } +} + +static int bf_release(struct inode *inode, struct file *filep) +{ + struct bf_listener *listener = filep->private_data; + + bf_fasync(-1, filep, 0); /* empty any process id in the notification list */ + if (listener->bfdev) { + bf_remove_listener(listener->bfdev, listener); + } + kfree(listener); + return 0; +} + +/* user space support: make read() system call after poll() of select() */ +static ssize_t bf_read(struct file *filep, char __user *buf, + size_t count, loff_t *ppos) +{ + struct bf_listener *listener = filep->private_data; + struct bf_pci_dev *bfdev = listener->bfdev; + int retval, event_count[BF_MSIX_ENTRY_CNT]; + int i, mismatch_found = 0; /* OR of per vector mismatch */ + unsigned char cnt_match[BF_MSIX_ENTRY_CNT]; /* per vector mismatch */ + + if (!bfdev) { + return -ENODEV; + } + /* irq must be setup for read() to work */ + if (!bfdev->info.irq) + return -EIO; + + /* ensure that there is enough space on user buffer for the given interrupt + * mode */ + if (bfdev->mode == BF_INTR_MODE_MSIX) { + if (count < sizeof(s32)*BF_MSIX_ENTRY_CNT) + return -EINVAL; + count = sizeof(s32)*BF_MSIX_ENTRY_CNT; + } else if (bfdev->mode == BF_INTR_MODE_MSI) { + if (count < sizeof(s32)*BF_MSI_ENTRY_CNT) + return -EINVAL; + count = sizeof(s32)*BF_MSI_ENTRY_CNT; + } else { + if (count < sizeof(s32)) + return -EINVAL; + count = sizeof(s32); + } + + do { + set_current_state(TASK_INTERRUPTIBLE); + + for (i = 0; i < (count/sizeof(s32)); i++) { + event_count[i] = atomic_read(&(bfdev->info.event[i])); + if (event_count[i] != listener->event_count[i]) { + mismatch_found |= 1; + cnt_match[i] = 1; + } else { + event_count[i] = 0; + cnt_match[i] = 0; + } + } + if (mismatch_found) { + __set_current_state(TASK_RUNNING); + if (copy_to_user(buf, &event_count, count)) + retval = -EFAULT; + else { /* adjust the listener->event_count; */ + for (i = 0 ; i < (count/sizeof(s32)); i++) { + if (cnt_match[i]) { + listener->event_count[i] = event_count[i]; + } + } + retval = count; + } + break; + } + + if (filep->f_flags & O_NONBLOCK) { + retval = -EAGAIN; + break; + } + + if (signal_pending(current)) { + retval = -ERESTARTSYS; + break; + } + schedule(); + } while (1); + + __set_current_state(TASK_RUNNING); + + return retval; +} + +/* user space is supposed to call this after it is done with interrupt + * processing + */ +static ssize_t bf_write(struct file *filep, const char __user *buf, + size_t count, loff_t *ppos) +{ + struct bf_listener *listener = filep->private_data; + struct bf_pci_dev *bfdev = listener->bfdev; + ssize_t ret; + s32 int_en; + + if (!bfdev || !bfdev->info.irq) + return -EIO; + + if (count != sizeof(s32)) + return -EINVAL; + + if (copy_from_user(&int_en, buf, count)) + return -EFAULT; + + /* clear pci_error_state */ + bfdev->info.pci_error_state = 0; + + ret = bf_pci_irqcontrol(bfdev, int_en); + + return ret ? ret : sizeof(s32); +} + +static const struct file_operations bf_fops = { + .owner = THIS_MODULE, + .open = bf_open, + .release = bf_release, + .read = bf_read, + .write = bf_write, + .mmap = bf_mmap, + .poll = bf_poll, + .fasync = bf_fasync, +}; + +static int bf_major_init(struct bf_pci_dev *bfdev, int minor) +{ + struct cdev *cdev; + static const char name[] = "bf"; + dev_t bf_dev = 0; + int result; + + result = alloc_chrdev_region(&bf_dev, 0, BF_MAX_DEVICE_CNT, name); + if (result) + return result; + + result = -ENOMEM; + cdev = cdev_alloc(); + if (!cdev) { + goto fail_dev_add; + } + cdev->ops = &bf_fops; + cdev->owner = THIS_MODULE; + kobject_set_name(&cdev->kobj, "%s", name); + result = cdev_add(cdev, bf_dev, BF_MAX_DEVICE_CNT); + + if (result) + goto fail_dev_add; + + bf_major = MAJOR(bf_dev); + bf_global[minor].bf_cdev = cdev; + return 0; + +fail_dev_add: + unregister_chrdev_region(bf_dev, BF_MAX_DEVICE_CNT); + return result; +} + +static void bf_major_cleanup(struct bf_pci_dev *bfdev, int minor) +{ + unregister_chrdev_region(MKDEV(bf_major, 0), BF_MAX_DEVICE_CNT); + cdev_del(bf_global[minor].bf_cdev); +} + +static int bf_init_cdev(struct bf_pci_dev *bfdev, int minor) +{ + int ret; + ret = bf_major_init(bfdev, minor); + if (ret) + return ret; + + bf_class = class_create(THIS_MODULE, BF_CLASS_NAME); + if (!bf_class) { + printk(KERN_ERR "create_class failed for bf_dev\n"); + ret = -ENODEV; + goto err_class_register; + } + return 0; + +err_class_register: + bf_major_cleanup(bfdev, minor); + return ret; +} + +static void bf_remove_cdev(struct bf_pci_dev *bfdev) +{ + class_destroy(bf_class); + bf_major_cleanup(bfdev, bfdev->info.minor); +} + + +/** + * bf_register_device - register a new userspace mem device + * @parent: parent device + * @bfdev: bf pci device + * + * returns zero on success or a negative error code. + */ +int bf_register_device(struct device *parent, struct bf_pci_dev *bfdev) +{ + struct bf_dev_info *info = &bfdev->info; + int i, j, ret = 0; + int minor; + + if (!parent || !info || !info->version) + return -EINVAL; + + init_waitqueue_head(&info->wait); + + for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) { + atomic_set(&info->event[i], 0); + } + + if (bf_get_next_minor_no(&minor)) { + return -EINVAL; + } + + ret = bf_init_cdev(bfdev, minor); + if (ret) { + printk(KERN_ERR "BF: device cdev creation failed\n"); + return ret; + } + + info->dev = device_create(bf_class, parent, + MKDEV(bf_major, minor), bfdev, + "bf%d", minor); + if (!info->dev) { + printk(KERN_ERR "BF: device creation failed\n"); + return -ENODEV; + } + + info->minor = minor; + + /* bind ISRs and request interrupts */ + if (info->irq && (bfdev->mode != BF_INTR_MODE_NONE)) { + /* + * Note that we deliberately don't use devm_request_irq + * here. The parent module can unregister the UIO device + * and call pci_disable_msi, which requires that this + * irq has been freed. However, the device may have open + * FDs at the time of unregister and therefore may not be + * freed until they are released. + */ + if (bfdev->mode == BF_INTR_MODE_LEGACY) { + ret = request_irq(info->irq, bf_interrupt, + info->irq_flags, bfdev->name, + (void *)&(bfdev->bf_int_vec[0])); + if (ret) { + printk(KERN_ERR "bf failed to request legacy irq %ld error %d\n", + info->irq, ret); + return ret; + } + printk(KERN_NOTICE "BF allocating legacy int vector %ld\n", info->irq); + } else if (bfdev->mode == BF_INTR_MODE_MSIX) { + for (i = 0; i < info->num_irq; i++) { + ret = request_irq(info->msix_entries[i].vector, bf_interrupt, + info->irq_flags, bfdev->name, + (void *)&(bfdev->bf_int_vec[i])); + if (ret) { + /* undo all other previous bindings */ + printk(KERN_ERR "bf failed to request MSIX ret %d itr %d\n", ret, i); + for (j = i - 1; j >= 0; j--) { + free_irq(info->msix_entries[j].vector, + (void *)&(bfdev->bf_int_vec[j])); + } + return ret; + } + } + printk(KERN_NOTICE "BF allocating %d MSIx vectors from %ld\n", + info->num_irq, info->irq); + } else if (bfdev->mode == BF_INTR_MODE_MSI) { + for (i = 0; i < info->num_irq; i++) { + ret = request_irq(info->irq + i, bf_interrupt, + info->irq_flags, bfdev->name, + (void *)&(bfdev->bf_int_vec[i])); + if (ret) { + /* undo all other previous bindings */ + printk(KERN_ERR "bf failed to request MSI ret %d itr %d\n", ret, i); + for (j = i - 1; j >= 0; j--) { + free_irq(info->irq + j, (void *)&(bfdev->bf_int_vec[j])); + } + return ret; + } + } + printk(KERN_NOTICE "BF allocating %d MSI vectors from %ld\n", + info->num_irq, info->irq); + } + } + return 0; +} + +/** + * bf_unregister_device - register a new userspace mem device + * @bfdev: bf pci device + * + * returns none + */ +void bf_unregister_device(struct bf_pci_dev *bfdev) +{ + struct bf_dev_info *info = &bfdev->info; + int i; + + if (info->irq) { + if (bfdev->mode == BF_INTR_MODE_LEGACY) { + free_irq(info->irq, (void *)&(bfdev->bf_int_vec[0])); + } else if (bfdev->mode == BF_INTR_MODE_MSIX) { + for (i = 0; i < info->num_irq; i++) { + free_irq(info->msix_entries[i].vector, (void *)&(bfdev->bf_int_vec[i])); + } + } else if (bfdev->mode == BF_INTR_MODE_MSI) { + for (i = 0; i < info->num_irq; i++) { + free_irq(info->irq + i, (void *)&(bfdev->bf_int_vec[i])); + } + } + } + device_destroy(bf_class, MKDEV(bf_major, info->minor)); + bf_remove_cdev(bfdev); + bf_return_minor_no(info->minor); + return; +} + +static inline struct device *pci_dev_to_dev(struct pci_dev *pdev) +{ + return &pdev->dev; +} + +static int +bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) +{ + struct bf_pci_dev *bfdev; + int err, pci_use_highmem; + int i, num_irq; + + memset(bf_global, 0, sizeof(bf_global)); + + bfdev = kzalloc(sizeof(struct bf_pci_dev), GFP_KERNEL); + if (!bfdev) + return -ENOMEM; + + /* init the cookies to be passed to ISRs */ + for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) { + bfdev->bf_int_vec[i].int_vec_offset = i; + bfdev->bf_int_vec[i].bf_dev = bfdev; + } + + /* initialize intr_mode to none */ + bfdev->mode = BF_INTR_MODE_NONE; + + /* clear pci_error_state */ + bfdev->info.pci_error_state = 0; + + /* + * enable device + */ + err = pci_enable_device(pdev); + if (err != 0) { + dev_err(&pdev->dev, "Cannot enable PCI device\n"); + goto fail_free; + } + + /* + * reserve device's PCI memory regions for use by this + * module + */ + err = pci_request_regions(pdev, "bf_umem"); + if (err != 0) { + dev_err(&pdev->dev, "Cannot request regions\n"); + goto fail_pci_disable; + } + /* remap IO memory */ + err = bf_setup_bars(pdev, &bfdev->info); + if (err != 0) + goto fail_release_iomem; + + if (!dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64)) && + !dma_set_coherent_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64))) { + pci_use_highmem = 1; + } else { + err = dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(32)); + if (err) { + err = dma_set_coherent_mask(pci_dev_to_dev(pdev), + DMA_BIT_MASK(32)); + if (err) { + dev_err(pci_dev_to_dev(pdev), "No usable DMA " + "configuration, aborting\n"); + goto fail_release_iomem; + } + } + pci_use_highmem = 0; + } + + /* enable pci error reporting */ + /* for the current kernel version, kernel config must have set the followings: + * CONFIG_PCIEPORTBUS=y and CONFIG_PCIEAER = y + * we have pci_error_handlers defined that gets invoked by kernel AER module + * upon detecting the pcie error on this device's addresses. + * However, there seems no way that AER would pass the offending addresses + * to the callback functions. AER logs the error messages on the console. + * This driver's calback function send the SIGIO signal to the user space + * to indicate the error condition. + */ + pci_enable_pcie_error_reporting(pdev); + + /* enable bus mastering on the device */ + pci_set_master(pdev); + + /* fill in bfdev info */ + bfdev->info.version = "0.2"; + bfdev->info.owner = THIS_MODULE; + bfdev->pdev = pdev; + + switch (bf_intr_mode_default) { +#ifdef CONFIG_PCI_MSI + case BF_INTR_MODE_MSIX: + /* Only 1 msi-x vector needed */ + bfdev->info.msix_entries = kcalloc(BF_MSIX_ENTRY_CNT, + sizeof(struct msix_entry), GFP_KERNEL); + if (!bfdev->info.msix_entries) { + err = -ENOMEM; + goto fail_clear_pci_master; + } + for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) { + bfdev->info.msix_entries[i].entry= i; + } + num_irq = pci_enable_msix_range(pdev, bfdev->info.msix_entries, + BF_MSIX_ENTRY_CNT, BF_MSIX_ENTRY_CNT); + if (num_irq == BF_MSIX_ENTRY_CNT) { + dev_dbg(&pdev->dev, "using MSI-X"); + bfdev->info.num_irq = num_irq; + bfdev->info.irq = bfdev->info.msix_entries[0].vector; + bfdev->mode = BF_INTR_MODE_MSIX; + printk(KERN_DEBUG "bf using %d MSIX irq from %ld\n", num_irq, + bfdev->info.irq); + break; + } else { + if (num_irq) + pci_disable_msix(pdev); + kfree(bfdev->info.msix_entries); + bfdev->info.msix_entries = NULL; + printk(KERN_ERR "bf error allocating MSIX vectors. Trying MSI...\n"); + /* and, fall back to MSI */ + } + /* ** intentional no-break */ + case BF_INTR_MODE_MSI: + num_irq = pci_enable_msi_range(pdev, BF_MSI_ENTRY_CNT, BF_MSI_ENTRY_CNT); + if (num_irq > 0) { + dev_dbg(&pdev->dev, "using MSI"); + bfdev->info.num_irq = num_irq; + bfdev->info.irq = pdev->irq; + bfdev->mode = BF_INTR_MODE_MSI; + printk(KERN_DEBUG "bf using %d MSI irq from %ld\n", bfdev->info.num_irq, + bfdev->info.irq); + break; + } +#endif /* CONFIG_PCI_MSI */ + /* fall back to Legacy Interrupt, intentional no-break */ + + case BF_INTR_MODE_LEGACY: + if (pci_intx_mask_supported(pdev)) { + dev_dbg(&pdev->dev, "using INTX"); + bfdev->info.irq_flags = IRQF_SHARED; + bfdev->info.irq = pdev->irq; + bfdev->mode = BF_INTR_MODE_LEGACY; + printk(KERN_DEBUG "bf using LEGACY irq %ld\n", bfdev->info.irq); + break; + } + dev_notice(&pdev->dev, "PCI INTx mask not supported\n"); + /* fall back to no Interrupt, intentional no-break */ + case BF_INTR_MODE_NONE: + bfdev->info.irq = 0; + bfdev->info.num_irq = 0; + bfdev->mode = BF_INTR_MODE_NONE; + break; + + default: + dev_err(&pdev->dev, "invalid IRQ mode %u", bf_intr_mode_default); + err = -EINVAL; + goto fail_clear_pci_master; + } + + pci_set_drvdata(pdev, bfdev); + sprintf(bfdev->name, "bf_%d", bfdev->info.minor); + /* register bf driver */ + err = bf_register_device(&pdev->dev, bfdev); + if (err != 0) + goto fail_release_irq; + + bf_global[bfdev->info.minor].async_queue = NULL; + bf_global[bfdev->info.minor].bfdev = bfdev; + + dev_info(&pdev->dev, "bf device %d registered with irq %ld\n", + bfdev->instance, bfdev->info.irq); + printk(KERN_ALERT "bf probe ok\n"); + return 0; + +fail_release_irq: + pci_set_drvdata(pdev, NULL); + if (bfdev->mode == BF_INTR_MODE_MSIX) { + pci_disable_msix(bfdev->pdev); + kfree(bfdev->info.msix_entries); + bfdev->info.msix_entries = NULL; + } + else if (bfdev->mode == BF_INTR_MODE_MSI) + pci_disable_msi(bfdev->pdev); +fail_clear_pci_master: + pci_clear_master(pdev); +fail_release_iomem: + bf_pci_release_iomem(&bfdev->info); + pci_release_regions(pdev); +fail_pci_disable: + pci_disable_device(pdev); +fail_free: + kfree(bfdev); + + printk(KERN_ERR "bf probe not ok\n"); + return err; +} + +static void +bf_pci_remove(struct pci_dev *pdev) +{ + struct bf_pci_dev *bfdev = pci_get_drvdata(pdev); + struct bf_listener *cur_listener; + + bf_unregister_device(bfdev); + if (bfdev->mode == BF_INTR_MODE_MSIX) { + pci_disable_msix(pdev); + kfree(bfdev->info.msix_entries); + bfdev->info.msix_entries = NULL; + } + else if (bfdev->mode == BF_INTR_MODE_MSI) + pci_disable_msi(pdev); + pci_clear_master(pdev); + bf_pci_release_iomem(&bfdev->info); + pci_release_regions(pdev); + pci_disable_pcie_error_reporting(pdev); + pci_disable_device(pdev); + pci_set_drvdata(pdev, NULL); + bf_global[bfdev->info.minor].bfdev = NULL; + /* existing filep structures in open file(s) must be informed that + * bf_pci_dev is no longer valid */ + spin_lock(&bf_nonisr_lock); + cur_listener = bfdev->listener_head; + while (cur_listener) { + cur_listener->bfdev = NULL; + cur_listener = cur_listener->next; + } + spin_unlock(&bf_nonisr_lock); + kfree(bfdev); +} + +/** + * bf_pci_error_detected - called when PCI error is detected + * @pdev: Pointer to PCI device + * @state: The current pci connection state + * + * called when root complex detects pci error associated with the device + */ +static pci_ers_result_t bf_pci_error_detected(struct pci_dev *pdev, + pci_channel_state_t state) +{ + struct bf_pci_dev *bfdev = pci_get_drvdata(pdev); + int minor; + + if (!bfdev) { + return PCI_ERS_RESULT_NONE; + } + printk(KERN_ERR "pci_err_detected state %d\n", state); + if (state == pci_channel_io_perm_failure || state == pci_channel_io_frozen) { + bfdev->info.pci_error_state = 1; + /* send a signal to the user space program of the error */ + minor = bfdev->info.minor; + if (minor < BF_MAX_DEVICE_CNT && bf_global[minor].async_queue) { + kill_fasync(&bf_global[minor].async_queue, SIGIO, POLL_ERR); + } + return PCI_ERS_RESULT_DISCONNECT; + } else { + return PCI_ERS_RESULT_NONE; + } +} + +/** + * bf_pci_slot_reset - called after the pci bus has been reset. + * @pdev: Pointer to PCI device + * + * Restart the card from scratch, as if from a cold-boot. + */ +static pci_ers_result_t bf_pci_slot_reset(struct pci_dev *pdev) +{ + /* nothing to do for now as we do not expect to get backto normal after + * a pcie link reset + * TBD: fill in this function if tofino can recover after an error + */ + return PCI_ERS_RESULT_DISCONNECT; +} + +/** + * bf_pci_resume - called when kernel thinks the device is up on PCIe. + * @pdev: Pointer to PCI device + * + * This callback is called when the error recovery driver tells us that + * its OK to resume normal operation. + */ +static void bf_pci_resume(struct pci_dev *pdev) +{ + /* this function should never be called for Tofinoi */ + struct bf_pci_dev *bfdev = pci_get_drvdata(pdev); + + printk(KERN_ERR "BF io_resume invoked after pci error\n"); + if (bfdev) { + bfdev->info.pci_error_state = 0; + } +} + +static int +bf_config_intr_mode(char *intr_str) +{ + if (!intr_str) { + pr_info("Use MSIX interrupt by default\n"); + return 0; + } + + if (!strcmp(intr_str, BF_INTR_MODE_MSIX_NAME)) { + bf_intr_mode_default = BF_INTR_MODE_MSIX; + pr_info("Use MSIX interrupt\n"); + } else if (!strcmp(intr_str, BF_INTR_MODE_MSI_NAME)) { + bf_intr_mode_default = BF_INTR_MODE_MSI; + pr_info("Use MSI interrupt\n"); + } else if (!strcmp(intr_str, BF_INTR_MODE_LEGACY_NAME)) { + bf_intr_mode_default = BF_INTR_MODE_LEGACY; + pr_info("Use legacy interrupt\n"); + } else { + pr_info("Error: bad parameter - %s\n", intr_str); + return -EINVAL; + } + + return 0; +} + +static const struct pci_device_id bf_pci_tbl[] = { + {PCI_VDEVICE(BF, TOFINO_DEV_ID_A0), 0}, + {PCI_VDEVICE(BF, TOFINO_DEV_ID_B0), 0}, + /* required last entry */ + { .device = 0 } +}; + +/* PCI bus error handlers */ +static struct pci_error_handlers bf_pci_err_handler = { + .error_detected = bf_pci_error_detected, + .slot_reset = bf_pci_slot_reset, + .resume = bf_pci_resume, +}; + +static struct pci_driver bf_pci_driver = { + .name = "bf", + .id_table = bf_pci_tbl, + .probe = bf_pci_probe, + .remove = bf_pci_remove, + .err_handler = &bf_pci_err_handler +}; + +static int __init +bfdrv_init(void) +{ + int ret; + + ret = bf_config_intr_mode(intr_mode); + if (ret < 0) + return ret; + + spin_lock_init(&bf_nonisr_lock); + return pci_register_driver(&bf_pci_driver); +} + +static void __exit +bfdrv_exit(void) +{ + pci_unregister_driver(&bf_pci_driver); +} + +module_init(bfdrv_init); +module_exit(bfdrv_exit); + +module_param(intr_mode, charp, S_IRUGO); +MODULE_PARM_DESC(intr_mode, +"bf interrupt mode (default=msix):\n" +" " BF_INTR_MODE_MSIX_NAME " Use MSIX interrupt\n" +" " BF_INTR_MODE_MSI_NAME " Use MSI interrupt\n" +" " BF_INTR_MODE_LEGACY_NAME " Use Legacy interrupt\n" +"\n"); + +MODULE_DEVICE_TABLE(pci, bf_pci_tbl); +MODULE_DESCRIPTION("Barefoot Tofino PCI device"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Barefoot Networks"); diff --git a/platform/barefoot/sonic-platform-modules-bfn/modules/bf_tun.c b/platform/barefoot/sonic-platform-modules-bfn/modules/bf_tun.c new file mode 100644 index 000000000000..a1ba7047baaa --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/modules/bf_tun.c @@ -0,0 +1,2396 @@ +/* + * TUN - Universal TUN/TAP device driver. + * Copyright (C) 1999-2002 Maxim Krasnyansky + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * $Id: tun.c,v 1.15 2002/03/01 02:44:24 maxk Exp $ + */ + +/* + * Changes: + * + * Mike Kershaw 2005/08/14 + * Add TUNSETLINK ioctl to set the link encapsulation + * + * Mark Smith + * Use eth_random_addr() for tap MAC address. + * + * Harald Roelle 2004/04/20 + * Fixes in packet dropping, queue length setting and queue wakeup. + * Increased default tx queue length. + * Added ethtool API. + * Minor cleanups + * + * Daniel Podlejski + * Modifications for 2.3.99-pre5 kernel. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#define DRV_NAME "bf_tun" +#define DRV_VERSION "1.6" +#define DRV_DESCRIPTION "Universal TUN/TAP device driver" +#define DRV_COPYRIGHT "(C) 1999-2004 Max Krasnyansky " + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* Uncomment to enable debugging */ +/* #define TUN_DEBUG 1 */ + +#define TUN_MINOR1 201 + +#ifdef TUN_DEBUG +static int debug; + +#define tun_debug(level, tun, fmt, args...) \ +do { \ + if (tun->debug) \ + netdev_printk(level, tun->dev, fmt, ##args); \ +} while (0) +#define DBG1(level, fmt, args...) \ +do { \ + if (debug == 2) \ + printk(level fmt, ##args); \ +} while (0) +#else +#define tun_debug(level, tun, fmt, args...) \ +do { \ + if (0) \ + netdev_printk(level, tun->dev, fmt, ##args); \ +} while (0) +#define DBG1(level, fmt, args...) \ +do { \ + if (0) \ + printk(level fmt, ##args); \ +} while (0) +#endif + +#define GOODCOPY_LEN 128 + +#define FLT_EXACT_COUNT 8 +struct tap_filter { + unsigned int count; /* Number of addrs. Zero means disabled */ + u32 mask[2]; /* Mask of the hashed addrs */ + unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN]; +}; + +/* DEFAULT_MAX_NUM_RSS_QUEUES were chosen to let the rx/tx queues allocated for + * the netdevice to be fit in one page. So we can make sure the success of + * memory allocation. TODO: increase the limit. */ +#define MAX_TAP_QUEUES DEFAULT_MAX_NUM_RSS_QUEUES +#define MAX_TAP_FLOWS 4096 + +#define TUN_FLOW_EXPIRE (3 * HZ) + +/* A tun_file connects an open character device to a tuntap netdevice. It + * also contains all socket related structures (except sock_fprog and tap_filter) + * to serve as one transmit queue for tuntap device. The sock_fprog and + * tap_filter were kept in tun_struct since they were used for filtering for the + * netdevice not for a specific queue (at least I didn't see the requirement for + * this). + * + * RCU usage: + * The tun_file and tun_struct are loosely coupled, the pointer from one to the + * other can only be read while rcu_read_lock or rtnl_lock is held. + */ +struct tun_file { + struct sock sk; + struct socket socket; + struct socket_wq wq; + struct tun_struct __rcu *tun; + struct net *net; + struct fasync_struct *fasync; + /* only used for fasnyc */ + unsigned int flags; + union { + u16 queue_index; + unsigned int ifindex; + }; + struct list_head next; + struct tun_struct *detached; +}; + +struct tun_flow_entry { + struct hlist_node hash_link; + struct rcu_head rcu; + struct tun_struct *tun; + + u32 rxhash; + u32 rps_rxhash; + int queue_index; + unsigned long updated; +}; + +#define TUN_NUM_FLOW_ENTRIES 1024 + +/* Since the socket were moved to tun_file, to preserve the behavior of persist + * device, socket filter, sndbuf and vnet header size were restore when the + * file were attached to a persist device. + */ +struct tun_struct { + struct tun_file __rcu *tfiles[MAX_TAP_QUEUES]; + unsigned int numqueues; + unsigned int flags; + kuid_t owner; + kgid_t group; + + struct net_device *dev; + netdev_features_t set_features; +#define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ + NETIF_F_TSO6|NETIF_F_UFO) + + int vnet_hdr_sz; + int sndbuf; + struct tap_filter txflt; + struct sock_fprog fprog; + /* protected by rtnl lock */ + bool filter_attached; +#ifdef TUN_DEBUG + int debug; +#endif + spinlock_t lock; + struct hlist_head flows[TUN_NUM_FLOW_ENTRIES]; + struct timer_list flow_gc_timer; + unsigned long ageing_time; + unsigned int numdisabled; + struct list_head disabled; + void *security; + u32 flow_count; +}; + +static inline u32 tun_hashfn(u32 rxhash) +{ + return rxhash & 0x3ff; +} + +static struct tun_flow_entry *tun_flow_find(struct hlist_head *head, u32 rxhash) +{ + struct tun_flow_entry *e; + + hlist_for_each_entry_rcu(e, head, hash_link) { + if (e->rxhash == rxhash) + return e; + } + return NULL; +} + +static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun, + struct hlist_head *head, + u32 rxhash, u16 queue_index) +{ + struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC); + + if (e) { + tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n", + rxhash, queue_index); + e->updated = jiffies; + e->rxhash = rxhash; + e->rps_rxhash = 0; + e->queue_index = queue_index; + e->tun = tun; + hlist_add_head_rcu(&e->hash_link, head); + ++tun->flow_count; + } + return e; +} + +static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) +{ + tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", + e->rxhash, e->queue_index); + sock_rps_reset_flow_hash(e->rps_rxhash); + hlist_del_rcu(&e->hash_link); + kfree_rcu(e, rcu); + --tun->flow_count; +} + +static void tun_flow_flush(struct tun_struct *tun) +{ + int i; + + spin_lock_bh(&tun->lock); + for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { + struct tun_flow_entry *e; + struct hlist_node *n; + + hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) + tun_flow_delete(tun, e); + } + spin_unlock_bh(&tun->lock); +} + +static void tun_flow_delete_by_queue(struct tun_struct *tun, u16 queue_index) +{ + int i; + + spin_lock_bh(&tun->lock); + for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { + struct tun_flow_entry *e; + struct hlist_node *n; + + hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) { + if (e->queue_index == queue_index) + tun_flow_delete(tun, e); + } + } + spin_unlock_bh(&tun->lock); +} + +static void tun_flow_cleanup(unsigned long data) +{ + struct tun_struct *tun = (struct tun_struct *)data; + unsigned long delay = tun->ageing_time; + unsigned long next_timer = jiffies + delay; + unsigned long count = 0; + int i; + + tun_debug(KERN_INFO, tun, "tun_flow_cleanup\n"); + + spin_lock_bh(&tun->lock); + for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { + struct tun_flow_entry *e; + struct hlist_node *n; + + hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) { + unsigned long this_timer; + count++; + this_timer = e->updated + delay; + if (time_before_eq(this_timer, jiffies)) + tun_flow_delete(tun, e); + else if (time_before(this_timer, next_timer)) + next_timer = this_timer; + } + } + + if (count) + mod_timer(&tun->flow_gc_timer, round_jiffies_up(next_timer)); + spin_unlock_bh(&tun->lock); +} + +static void tun_flow_update(struct tun_struct *tun, u32 rxhash, + struct tun_file *tfile) +{ + struct hlist_head *head; + struct tun_flow_entry *e; + unsigned long delay = tun->ageing_time; + u16 queue_index = tfile->queue_index; + + if (!rxhash) + return; + else + head = &tun->flows[tun_hashfn(rxhash)]; + + rcu_read_lock(); + + /* We may get a very small possibility of OOO during switching, not + * worth to optimize.*/ + if (tun->numqueues == 1 || tfile->detached) + goto unlock; + + e = tun_flow_find(head, rxhash); + if (likely(e)) { + /* TODO: keep queueing to old queue until it's empty? */ + e->queue_index = queue_index; + e->updated = jiffies; + sock_rps_record_flow_hash(e->rps_rxhash); + } else { + spin_lock_bh(&tun->lock); + if (!tun_flow_find(head, rxhash) && + tun->flow_count < MAX_TAP_FLOWS) + tun_flow_create(tun, head, rxhash, queue_index); + + if (!timer_pending(&tun->flow_gc_timer)) + mod_timer(&tun->flow_gc_timer, + round_jiffies_up(jiffies + delay)); + spin_unlock_bh(&tun->lock); + } + +unlock: + rcu_read_unlock(); +} + +/** + * Save the hash received in the stack receive path and update the + * flow_hash table accordingly. + */ +static inline void tun_flow_save_rps_rxhash(struct tun_flow_entry *e, u32 hash) +{ + if (unlikely(e->rps_rxhash != hash)) { + sock_rps_reset_flow_hash(e->rps_rxhash); + e->rps_rxhash = hash; + } +} + +/* We try to identify a flow through its rxhash first. The reason that + * we do not check rxq no. is because some cards(e.g 82599), chooses + * the rxq based on the txq where the last packet of the flow comes. As + * the userspace application move between processors, we may get a + * different rxq no. here. If we could not get rxhash, then we would + * hope the rxq no. may help here. + */ +static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb, + void *accel_priv, select_queue_fallback_t fallback) +{ + struct tun_struct *tun = netdev_priv(dev); + struct tun_flow_entry *e; + u32 txq = 0; + u32 numqueues = 0; + + rcu_read_lock(); + numqueues = ACCESS_ONCE(tun->numqueues); + + txq = skb_get_hash(skb); + if (txq) { + e = tun_flow_find(&tun->flows[tun_hashfn(txq)], txq); + if (e) { + tun_flow_save_rps_rxhash(e, txq); + txq = e->queue_index; + } else + /* use multiply and shift instead of expensive divide */ + txq = ((u64)txq * numqueues) >> 32; + } else if (likely(skb_rx_queue_recorded(skb))) { + txq = skb_get_rx_queue(skb); + while (unlikely(txq >= numqueues)) + txq -= numqueues; + } + + rcu_read_unlock(); + return txq; +} + +static inline bool tun_not_capable(struct tun_struct *tun) +{ + const struct cred *cred = current_cred(); + struct net *net = dev_net(tun->dev); + + return ((uid_valid(tun->owner) && !uid_eq(cred->euid, tun->owner)) || + (gid_valid(tun->group) && !in_egroup_p(tun->group))) && + !ns_capable(net->user_ns, CAP_NET_ADMIN); +} + +static void tun_set_real_num_queues(struct tun_struct *tun) +{ + netif_set_real_num_tx_queues(tun->dev, tun->numqueues); + netif_set_real_num_rx_queues(tun->dev, tun->numqueues); +} + +static void tun_disable_queue(struct tun_struct *tun, struct tun_file *tfile) +{ + tfile->detached = tun; + list_add_tail(&tfile->next, &tun->disabled); + ++tun->numdisabled; +} + +static struct tun_struct *tun_enable_queue(struct tun_file *tfile) +{ + struct tun_struct *tun = tfile->detached; + + tfile->detached = NULL; + list_del_init(&tfile->next); + --tun->numdisabled; + return tun; +} + +static void tun_queue_purge(struct tun_file *tfile) +{ + skb_queue_purge(&tfile->sk.sk_receive_queue); + skb_queue_purge(&tfile->sk.sk_error_queue); +} + +static void __tun_detach(struct tun_file *tfile, bool clean) +{ + struct tun_file *ntfile; + struct tun_struct *tun; + + tun = rtnl_dereference(tfile->tun); + + if (tun && !tfile->detached) { + u16 index = tfile->queue_index; + BUG_ON(index >= tun->numqueues); + + rcu_assign_pointer(tun->tfiles[index], + tun->tfiles[tun->numqueues - 1]); + ntfile = rtnl_dereference(tun->tfiles[index]); + ntfile->queue_index = index; + + --tun->numqueues; + if (clean) { + RCU_INIT_POINTER(tfile->tun, NULL); + sock_put(&tfile->sk); + } else + tun_disable_queue(tun, tfile); + + synchronize_net(); + tun_flow_delete_by_queue(tun, tun->numqueues + 1); + /* Drop read queue */ + tun_queue_purge(tfile); + tun_set_real_num_queues(tun); + } else if (tfile->detached && clean) { + tun = tun_enable_queue(tfile); + sock_put(&tfile->sk); + } + + if (clean) { + if (tun && tun->numqueues == 0 && tun->numdisabled == 0) { + netif_carrier_off(tun->dev); + + if (!(tun->flags & TUN_PERSIST) && + tun->dev->reg_state == NETREG_REGISTERED) + unregister_netdevice(tun->dev); + } + + BUG_ON(!test_bit(SOCK_EXTERNALLY_ALLOCATED, + &tfile->socket.flags)); + sk_release_kernel(&tfile->sk); + } +} + +static void tun_detach(struct tun_file *tfile, bool clean) +{ + rtnl_lock(); + __tun_detach(tfile, clean); + rtnl_unlock(); +} + +static void tun_detach_all(struct net_device *dev) +{ + struct tun_struct *tun = netdev_priv(dev); + struct tun_file *tfile, *tmp; + int i, n = tun->numqueues; + + for (i = 0; i < n; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + BUG_ON(!tfile); + tfile->socket.sk->sk_data_ready(tfile->socket.sk); + RCU_INIT_POINTER(tfile->tun, NULL); + --tun->numqueues; + } + list_for_each_entry(tfile, &tun->disabled, next) { + tfile->socket.sk->sk_data_ready(tfile->socket.sk); + RCU_INIT_POINTER(tfile->tun, NULL); + } + BUG_ON(tun->numqueues != 0); + + synchronize_net(); + for (i = 0; i < n; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + /* Drop read queue */ + tun_queue_purge(tfile); + sock_put(&tfile->sk); + } + list_for_each_entry_safe(tfile, tmp, &tun->disabled, next) { + tun_enable_queue(tfile); + tun_queue_purge(tfile); + sock_put(&tfile->sk); + } + BUG_ON(tun->numdisabled != 0); + + if (tun->flags & TUN_PERSIST) + module_put(THIS_MODULE); +} + +static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filter) +{ + struct tun_file *tfile = file->private_data; + int err; + + err = security_tun_dev_attach(tfile->socket.sk, tun->security); + if (err < 0) + goto out; + + err = -EINVAL; + if (rtnl_dereference(tfile->tun) && !tfile->detached) + goto out; + + err = -EBUSY; + if (!(tun->flags & TUN_TAP_MQ) && tun->numqueues == 1) + goto out; + + err = -E2BIG; + if (!tfile->detached && + tun->numqueues + tun->numdisabled == MAX_TAP_QUEUES) + goto out; + + err = 0; + + /* Re-attach the filter to persist device */ + if (!skip_filter && (tun->filter_attached == true)) { + err = __sk_attach_filter(&tun->fprog, tfile->socket.sk, + lockdep_rtnl_is_held()); + if (!err) + goto out; + } + tfile->queue_index = tun->numqueues; + rcu_assign_pointer(tfile->tun, tun); + rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); + tun->numqueues++; + + if (tfile->detached) + tun_enable_queue(tfile); + else + sock_hold(&tfile->sk); + + tun_set_real_num_queues(tun); + + /* device is allowed to go away first, so no need to hold extra + * refcnt. + */ + +out: + return err; +} + +static struct tun_struct *__tun_get(struct tun_file *tfile) +{ + struct tun_struct *tun; + + rcu_read_lock(); + tun = rcu_dereference(tfile->tun); + if (tun) + dev_hold(tun->dev); + rcu_read_unlock(); + + return tun; +} + +static struct tun_struct *tun_get(struct file *file) +{ + return __tun_get(file->private_data); +} + +static void tun_put(struct tun_struct *tun) +{ + dev_put(tun->dev); +} + +/* TAP filtering */ +static void addr_hash_set(u32 *mask, const u8 *addr) +{ + int n = ether_crc(ETH_ALEN, addr) >> 26; + mask[n >> 5] |= (1 << (n & 31)); +} + +static unsigned int addr_hash_test(const u32 *mask, const u8 *addr) +{ + int n = ether_crc(ETH_ALEN, addr) >> 26; + return mask[n >> 5] & (1 << (n & 31)); +} + +static int update_filter(struct tap_filter *filter, void __user *arg) +{ + struct { u8 u[ETH_ALEN]; } *addr; + struct tun_filter uf; + int err, alen, n, nexact; + + if (copy_from_user(&uf, arg, sizeof(uf))) + return -EFAULT; + + if (!uf.count) { + /* Disabled */ + filter->count = 0; + return 0; + } + + alen = ETH_ALEN * uf.count; + addr = kmalloc(alen, GFP_KERNEL); + if (!addr) + return -ENOMEM; + + if (copy_from_user(addr, arg + sizeof(uf), alen)) { + err = -EFAULT; + goto done; + } + + /* The filter is updated without holding any locks. Which is + * perfectly safe. We disable it first and in the worst + * case we'll accept a few undesired packets. */ + filter->count = 0; + wmb(); + + /* Use first set of addresses as an exact filter */ + for (n = 0; n < uf.count && n < FLT_EXACT_COUNT; n++) + memcpy(filter->addr[n], addr[n].u, ETH_ALEN); + + nexact = n; + + /* Remaining multicast addresses are hashed, + * unicast will leave the filter disabled. */ + memset(filter->mask, 0, sizeof(filter->mask)); + for (; n < uf.count; n++) { + if (!is_multicast_ether_addr(addr[n].u)) { + err = 0; /* no filter */ + goto done; + } + addr_hash_set(filter->mask, addr[n].u); + } + + /* For ALLMULTI just set the mask to all ones. + * This overrides the mask populated above. */ + if ((uf.flags & TUN_FLT_ALLMULTI)) + memset(filter->mask, ~0, sizeof(filter->mask)); + + /* Now enable the filter */ + wmb(); + filter->count = nexact; + + /* Return the number of exact filters */ + err = nexact; + +done: + kfree(addr); + return err; +} + +/* Returns: 0 - drop, !=0 - accept */ +static int run_filter(struct tap_filter *filter, const struct sk_buff *skb) +{ + /* Cannot use eth_hdr(skb) here because skb_mac_hdr() is incorrect + * at this point. */ + struct ethhdr *eh = (struct ethhdr *) skb->data; + int i; + + /* Exact match */ + for (i = 0; i < filter->count; i++) + if (ether_addr_equal(eh->h_dest, filter->addr[i])) + return 1; + + /* Inexact match (multicast only) */ + if (is_multicast_ether_addr(eh->h_dest)) + return addr_hash_test(filter->mask, eh->h_dest); + + return 0; +} + +/* + * Checks whether the packet is accepted or not. + * Returns: 0 - drop, !=0 - accept + */ +static int check_filter(struct tap_filter *filter, const struct sk_buff *skb) +{ + if (!filter->count) + return 1; + + return run_filter(filter, skb); +} + +/* Network device part of the driver */ + +static const struct ethtool_ops tun_ethtool_ops; + +/* Net device detach from fd. */ +static void tun_net_uninit(struct net_device *dev) +{ + tun_detach_all(dev); +} + +/* Net device open. */ +static int tun_net_open(struct net_device *dev) +{ + netif_tx_start_all_queues(dev); + return 0; +} + +/* Net device close. */ +static int tun_net_close(struct net_device *dev) +{ + netif_tx_stop_all_queues(dev); + return 0; +} + +/* Net device start xmit */ +static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) +{ + struct tun_struct *tun = netdev_priv(dev); + int txq = skb->queue_mapping; + struct tun_file *tfile; + u32 numqueues = 0; + + rcu_read_lock(); + tfile = rcu_dereference(tun->tfiles[txq]); + numqueues = ACCESS_ONCE(tun->numqueues); + + /* Drop packet if interface is not attached */ + if (txq >= numqueues) + goto drop; + + if (numqueues == 1) { + /* Select queue was not called for the skbuff, so we extract the + * RPS hash and save it into the flow_table here. + */ + __u32 rxhash; + + rxhash = skb_get_hash(skb); + if (rxhash) { + struct tun_flow_entry *e; + e = tun_flow_find(&tun->flows[tun_hashfn(rxhash)], + rxhash); + if (e) + tun_flow_save_rps_rxhash(e, rxhash); + } + } + + tun_debug(KERN_INFO, tun, "tun_net_xmit %d\n", skb->len); + + BUG_ON(!tfile); + + /* Drop if the filter does not like it. + * This is a noop if the filter is disabled. + * Filter can be enabled only for the TAP devices. */ + if (!check_filter(&tun->txflt, skb)) + goto drop; + + if (tfile->socket.sk->sk_filter && + sk_filter(tfile->socket.sk, skb)) + goto drop; + + /* Limit the number of packets queued by dividing txq length with the + * number of queues. + */ + if (skb_queue_len(&tfile->socket.sk->sk_receive_queue) * numqueues + >= dev->tx_queue_len) + goto drop; + + if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) + goto drop; + + if (skb->sk) { + sock_tx_timestamp(skb->sk, &skb_shinfo(skb)->tx_flags); + sw_tx_timestamp(skb); + } + + /* Orphan the skb - required as we might hang on to it + * for indefinite time. + */ + skb_orphan(skb); + + nf_reset(skb); + + /* Enqueue packet */ + skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb); + + /* Notify and wake up reader process */ + if (tfile->flags & TUN_FASYNC) + kill_fasync(&tfile->fasync, SIGIO, POLL_IN); + tfile->socket.sk->sk_data_ready(tfile->socket.sk); + + rcu_read_unlock(); + return NETDEV_TX_OK; + +drop: + dev->stats.tx_dropped++; + skb_tx_error(skb); + kfree_skb(skb); + rcu_read_unlock(); + return NETDEV_TX_OK; +} + +static void tun_net_mclist(struct net_device *dev) +{ + /* + * This callback is supposed to deal with mc filter in + * _rx_ path and has nothing to do with the _tx_ path. + * In rx path we always accept everything userspace gives us. + */ +} + +#define MIN_MTU 68 +#define MAX_MTU 65535 + +static int +tun_net_change_mtu(struct net_device *dev, int new_mtu) +{ + if (new_mtu < MIN_MTU || new_mtu + dev->hard_header_len > MAX_MTU) + return -EINVAL; + dev->mtu = new_mtu; + return 0; +} + +static netdev_features_t tun_net_fix_features(struct net_device *dev, + netdev_features_t features) +{ + struct tun_struct *tun = netdev_priv(dev); + + return (features & tun->set_features) | (features & ~TUN_USER_FEATURES); +} + +static int +tun_change_carrier(struct net_device *dev, bool new_carrier) { + if (new_carrier) + netif_carrier_on(dev); + else + netif_carrier_off(dev); + return 0; +} + +#ifdef CONFIG_NET_POLL_CONTROLLER +static void tun_poll_controller(struct net_device *dev) +{ + /* + * Tun only receives frames when: + * 1) the char device endpoint gets data from user space + * 2) the tun socket gets a sendmsg call from user space + * Since both of those are synchronous operations, we are guaranteed + * never to have pending data when we poll for it + * so there is nothing to do here but return. + * We need this though so netpoll recognizes us as an interface that + * supports polling, which enables bridge devices in virt setups to + * still use netconsole + */ + return; +} +#endif +static const struct net_device_ops tun_netdev_ops = { + .ndo_uninit = tun_net_uninit, + .ndo_open = tun_net_open, + .ndo_stop = tun_net_close, + .ndo_start_xmit = tun_net_xmit, + .ndo_change_mtu = tun_net_change_mtu, + .ndo_fix_features = tun_net_fix_features, + .ndo_select_queue = tun_select_queue, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = tun_poll_controller, +#endif +}; + +static const struct net_device_ops tap_netdev_ops = { + .ndo_uninit = tun_net_uninit, + .ndo_open = tun_net_open, + .ndo_stop = tun_net_close, + .ndo_start_xmit = tun_net_xmit, + .ndo_change_mtu = tun_net_change_mtu, + .ndo_fix_features = tun_net_fix_features, + .ndo_set_rx_mode = tun_net_mclist, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_select_queue = tun_select_queue, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = tun_poll_controller, +#endif + .ndo_change_carrier = tun_change_carrier, +}; + +static void tun_flow_init(struct tun_struct *tun) +{ + int i; + + for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) + INIT_HLIST_HEAD(&tun->flows[i]); + + tun->ageing_time = TUN_FLOW_EXPIRE; + setup_timer(&tun->flow_gc_timer, tun_flow_cleanup, (unsigned long)tun); + mod_timer(&tun->flow_gc_timer, + round_jiffies_up(jiffies + tun->ageing_time)); +} + +static void tun_flow_uninit(struct tun_struct *tun) +{ + del_timer_sync(&tun->flow_gc_timer); + tun_flow_flush(tun); +} + +/* Initialize net device. */ +static void tun_net_init(struct net_device *dev) +{ + struct tun_struct *tun = netdev_priv(dev); + + switch (tun->flags & TUN_TYPE_MASK) { + case TUN_TUN_DEV: + dev->netdev_ops = &tun_netdev_ops; + + /* Point-to-Point TUN Device */ + dev->hard_header_len = 0; + dev->addr_len = 0; + dev->mtu = 1500; + + /* Zero header length */ + dev->type = ARPHRD_NONE; + dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; + dev->tx_queue_len = TUN_READQ_SIZE*2; /* We prefer our own queue length */ + break; + + case TUN_TAP_DEV: + dev->netdev_ops = &tap_netdev_ops; + /* Ethernet TAP Device */ + ether_setup(dev); + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; + + eth_hw_addr_random(dev); + + dev->tx_queue_len = TUN_READQ_SIZE*2; /* We prefer our own queue length */ + break; + } +} + +/* Character device part */ + +/* Poll */ +static unsigned int tun_chr_poll(struct file *file, poll_table *wait) +{ + struct tun_file *tfile = file->private_data; + struct tun_struct *tun = __tun_get(tfile); + struct sock *sk; + unsigned int mask = 0; + + if (!tun) + return POLLERR; + + sk = tfile->socket.sk; + + tun_debug(KERN_INFO, tun, "tun_chr_poll\n"); + + poll_wait(file, sk_sleep(sk), wait); + + if (!skb_queue_empty(&sk->sk_receive_queue)) + mask |= POLLIN | POLLRDNORM; + + if (sock_writeable(sk) || + (!test_and_set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags) && + sock_writeable(sk))) + mask |= POLLOUT | POLLWRNORM; + + if (tun->dev->reg_state != NETREG_REGISTERED) + mask = POLLERR; + + tun_put(tun); + return mask; +} + +/* prepad is the amount to reserve at front. len is length after that. + * linear is a hint as to how much to copy (usually headers). */ +static struct sk_buff *tun_alloc_skb(struct tun_file *tfile, + size_t prepad, size_t len, + size_t linear, int noblock) +{ + struct sock *sk = tfile->socket.sk; + struct sk_buff *skb; + int err; + + /* Under a page? Don't bother with paged skb. */ + if (prepad + len < PAGE_SIZE || !linear) + linear = len; + + skb = sock_alloc_send_pskb(sk, prepad + linear, len - linear, noblock, + &err, 0); + if (!skb) + return ERR_PTR(err); + + skb_reserve(skb, prepad); + skb_put(skb, linear); + skb->data_len = len - linear; + skb->len += len - linear; + + return skb; +} + +/* Get packet from user space buffer */ +static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, + void *msg_control, const struct iovec *iv, + size_t total_len, size_t count, int noblock) +{ + struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) }; + struct sk_buff *skb; + size_t len = total_len, align = NET_SKB_PAD, linear; + struct virtio_net_hdr gso = { 0 }; + int good_linear; + int offset = 0; + int copylen; + bool zerocopy = false; + int err; + u32 rxhash; + + if (!(tun->flags & TUN_NO_PI)) { + if (len < sizeof(pi)) + return -EINVAL; + len -= sizeof(pi); + + if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) + return -EFAULT; + offset += sizeof(pi); + } + + if (tun->flags & TUN_VNET_HDR) { + if (len < tun->vnet_hdr_sz) + return -EINVAL; + len -= tun->vnet_hdr_sz; + + if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) + return -EFAULT; + + if ((gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && + gso.csum_start + gso.csum_offset + 2 > gso.hdr_len) + gso.hdr_len = gso.csum_start + gso.csum_offset + 2; + + if (gso.hdr_len > len) + return -EINVAL; + offset += tun->vnet_hdr_sz; + } + + if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) { + align += NET_IP_ALIGN; + if (unlikely(len < ETH_HLEN || + (gso.hdr_len && gso.hdr_len < ETH_HLEN))) + return -EINVAL; + } + + good_linear = SKB_MAX_HEAD(align); + + if (msg_control) { + /* There are 256 bytes to be copied in skb, so there is + * enough room for skb expand head in case it is used. + * The rest of the buffer is mapped from userspace. + */ + copylen = gso.hdr_len ? gso.hdr_len : GOODCOPY_LEN; + if (copylen > good_linear) + copylen = good_linear; + linear = copylen; + if (iov_pages(iv, offset + copylen, count) <= MAX_SKB_FRAGS) + zerocopy = true; + } + + if (!zerocopy) { + copylen = len; + if (gso.hdr_len > good_linear) + linear = good_linear; + else + linear = gso.hdr_len; + } + + skb = tun_alloc_skb(tfile, align, copylen, linear, noblock); + if (IS_ERR(skb)) { + if (PTR_ERR(skb) != -EAGAIN) + tun->dev->stats.rx_dropped++; + return PTR_ERR(skb); + } + + if (zerocopy) + err = zerocopy_sg_from_iovec(skb, iv, offset, count); + else { + err = skb_copy_datagram_from_iovec(skb, 0, iv, offset, len); + if (!err && msg_control) { + struct ubuf_info *uarg = msg_control; + uarg->callback(uarg, false); + } + } + + if (err) { + tun->dev->stats.rx_dropped++; + kfree_skb(skb); + return -EFAULT; + } + + if (gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { + if (!skb_partial_csum_set(skb, gso.csum_start, + gso.csum_offset)) { + tun->dev->stats.rx_frame_errors++; + kfree_skb(skb); + return -EINVAL; + } + } + + switch (tun->flags & TUN_TYPE_MASK) { + case TUN_TUN_DEV: + if (tun->flags & TUN_NO_PI) { + switch (skb->data[0] & 0xf0) { + case 0x40: + pi.proto = htons(ETH_P_IP); + break; + case 0x60: + pi.proto = htons(ETH_P_IPV6); + break; + default: + tun->dev->stats.rx_dropped++; + kfree_skb(skb); + return -EINVAL; + } + } + + skb_reset_mac_header(skb); + skb->protocol = pi.proto; + skb->dev = tun->dev; + break; + case TUN_TAP_DEV: + skb->protocol = eth_type_trans(skb, tun->dev); + break; + } + + skb_reset_network_header(skb); + + if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { + pr_debug("GSO!\n"); + switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { + case VIRTIO_NET_HDR_GSO_TCPV4: + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; + break; + case VIRTIO_NET_HDR_GSO_TCPV6: + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; + break; + case VIRTIO_NET_HDR_GSO_UDP: + skb_shinfo(skb)->gso_type = SKB_GSO_UDP; + if (skb->protocol == htons(ETH_P_IPV6)) + ipv6_proxy_select_ident(skb); + break; + default: + tun->dev->stats.rx_frame_errors++; + kfree_skb(skb); + return -EINVAL; + } + + if (gso.gso_type & VIRTIO_NET_HDR_GSO_ECN) + skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; + + skb_shinfo(skb)->gso_size = gso.gso_size; + if (skb_shinfo(skb)->gso_size == 0) { + tun->dev->stats.rx_frame_errors++; + kfree_skb(skb); + return -EINVAL; + } + + /* Header must be checked, and gso_segs computed. */ + skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; + skb_shinfo(skb)->gso_segs = 0; + } + + /* copy skb_ubuf_info for callback when skb has no error */ + if (zerocopy) { + skb_shinfo(skb)->destructor_arg = msg_control; + skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; + skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; + } + + skb_probe_transport_header(skb, 0); + + rxhash = skb_get_hash(skb); + netif_rx_ni(skb); + + tun->dev->stats.rx_packets++; + tun->dev->stats.rx_bytes += len; + + tun_flow_update(tun, rxhash, tfile); + return total_len; +} + +static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, + unsigned long count, loff_t pos) +{ + struct file *file = iocb->ki_filp; + struct tun_struct *tun = tun_get(file); + struct tun_file *tfile = file->private_data; + ssize_t result; + + if (!tun) + return -EBADFD; + + tun_debug(KERN_INFO, tun, "tun_chr_write %ld\n", count); + + result = tun_get_user(tun, tfile, NULL, iv, iov_length(iv, count), + count, file->f_flags & O_NONBLOCK); + + tun_put(tun); + return result; +} + +/* Put packet to the user space buffer */ +static ssize_t tun_put_user(struct tun_struct *tun, + struct tun_file *tfile, + struct sk_buff *skb, + const struct iovec *iv, int len) +{ + struct tun_pi pi = { 0, skb->protocol }; + ssize_t total = 0; + int vlan_offset = 0, copied; + int vlan_hlen = 0; + + if (vlan_tx_tag_present(skb)) + vlan_hlen = VLAN_HLEN; + + if (!(tun->flags & TUN_NO_PI)) { + if ((len -= sizeof(pi)) < 0) + return -EINVAL; + + if (len < skb->len) { + /* Packet will be striped */ + pi.flags |= TUN_PKT_STRIP; + } + + if (memcpy_toiovecend(iv, (void *) &pi, 0, sizeof(pi))) + return -EFAULT; + total += sizeof(pi); + } + + if (tun->flags & TUN_VNET_HDR) { + struct virtio_net_hdr gso = { 0 }; /* no info leak */ + if ((len -= tun->vnet_hdr_sz) < 0) + return -EINVAL; + + if (skb_is_gso(skb)) { + struct skb_shared_info *sinfo = skb_shinfo(skb); + + /* This is a hint as to how much should be linear. */ + gso.hdr_len = skb_headlen(skb); + gso.gso_size = sinfo->gso_size; + if (sinfo->gso_type & SKB_GSO_TCPV4) + gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; + else if (sinfo->gso_type & SKB_GSO_TCPV6) + gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; + else if (sinfo->gso_type & SKB_GSO_UDP) + gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; + else { + pr_err("unexpected GSO type: " + "0x%x, gso_size %d, hdr_len %d\n", + sinfo->gso_type, gso.gso_size, + gso.hdr_len); + print_hex_dump(KERN_ERR, "tun: ", + DUMP_PREFIX_NONE, + 16, 1, skb->head, + min((int)gso.hdr_len, 64), true); + WARN_ON_ONCE(1); + return -EINVAL; + } + if (sinfo->gso_type & SKB_GSO_TCP_ECN) + gso.gso_type |= VIRTIO_NET_HDR_GSO_ECN; + } else + gso.gso_type = VIRTIO_NET_HDR_GSO_NONE; + + if (skb->ip_summed == CHECKSUM_PARTIAL) { + gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; + gso.csum_start = skb_checksum_start_offset(skb) + + vlan_hlen; + gso.csum_offset = skb->csum_offset; + } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { + gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; + } /* else everything is zero */ + + if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total, + sizeof(gso)))) + return -EFAULT; + total += tun->vnet_hdr_sz; + } + + copied = total; + len = min_t(int, skb->len + vlan_hlen, len); + total += skb->len + vlan_hlen; + if (vlan_hlen) { + int copy, ret; + struct { + __be16 h_vlan_proto; + __be16 h_vlan_TCI; + } veth; + + veth.h_vlan_proto = skb->vlan_proto; + veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); + + vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); + + copy = min_t(int, vlan_offset, len); + ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); + len -= copy; + copied += copy; + if (ret || !len) + goto done; + + copy = min_t(int, sizeof(veth), len); + ret = memcpy_toiovecend(iv, (void *)&veth, copied, copy); + len -= copy; + copied += copy; + if (ret || !len) + goto done; + } + + skb_copy_datagram_const_iovec(skb, vlan_offset, iv, copied, len); + +done: + tun->dev->stats.tx_packets++; + tun->dev->stats.tx_bytes += len; + + return total; +} + +static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile, + const struct iovec *iv, ssize_t len, int noblock) +{ + struct sk_buff *skb; + ssize_t ret = 0; + int peeked, err, off = 0; + + tun_debug(KERN_INFO, tun, "tun_do_read\n"); + + if (!len) + return ret; + + if (tun->dev->reg_state != NETREG_REGISTERED) + return -EIO; + + /* Read frames from queue */ + skb = __skb_recv_datagram(tfile->socket.sk, noblock ? MSG_DONTWAIT : 0, + &peeked, &off, &err); + if (skb) { + ret = tun_put_user(tun, tfile, skb, iv, len); + kfree_skb(skb); + } else + ret = err; + + return ret; +} + +static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, + unsigned long count, loff_t pos) +{ + struct file *file = iocb->ki_filp; + struct tun_file *tfile = file->private_data; + struct tun_struct *tun = __tun_get(tfile); + ssize_t len, ret; + + if (!tun) + return -EBADFD; + len = iov_length(iv, count); + if (len < 0) { + ret = -EINVAL; + goto out; + } + + ret = tun_do_read(tun, tfile, iv, len, + file->f_flags & O_NONBLOCK); + ret = min_t(ssize_t, ret, len); + if (ret > 0) + iocb->ki_pos = ret; +out: + tun_put(tun); + return ret; +} + +static void tun_free_netdev(struct net_device *dev) +{ + struct tun_struct *tun = netdev_priv(dev); + + BUG_ON(!(list_empty(&tun->disabled))); + tun_flow_uninit(tun); + security_tun_dev_free_security(tun->security); + free_netdev(dev); +} + +static void tun_setup(struct net_device *dev) +{ + struct tun_struct *tun = netdev_priv(dev); + + tun->owner = INVALID_UID; + tun->group = INVALID_GID; + + dev->ethtool_ops = &tun_ethtool_ops; + dev->destructor = tun_free_netdev; +} + +/* Trivial set of netlink ops to allow deleting tun or tap + * device with netlink. + */ +static int tun_validate(struct nlattr *tb[], struct nlattr *data[]) +{ + return -EINVAL; +} + +static struct rtnl_link_ops tun_link_ops __read_mostly = { + .kind = DRV_NAME, + .priv_size = sizeof(struct tun_struct), + .setup = tun_setup, + .validate = tun_validate, +}; + +static void tun_sock_write_space(struct sock *sk) +{ + struct tun_file *tfile; + wait_queue_head_t *wqueue; + + if (!sock_writeable(sk)) + return; + + if (!test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags)) + return; + + wqueue = sk_sleep(sk); + if (wqueue && waitqueue_active(wqueue)) + wake_up_interruptible_sync_poll(wqueue, POLLOUT | + POLLWRNORM | POLLWRBAND); + + tfile = container_of(sk, struct tun_file, sk); + kill_fasync(&tfile->fasync, SIGIO, POLL_OUT); +} + +static int tun_sendmsg(struct kiocb *iocb, struct socket *sock, + struct msghdr *m, size_t total_len) +{ + int ret; + struct tun_file *tfile = container_of(sock, struct tun_file, socket); + struct tun_struct *tun = __tun_get(tfile); + + if (!tun) + return -EBADFD; + ret = tun_get_user(tun, tfile, m->msg_control, m->msg_iov, total_len, + m->msg_iovlen, m->msg_flags & MSG_DONTWAIT); + tun_put(tun); + return ret; +} + +static int tun_recvmsg(struct kiocb *iocb, struct socket *sock, + struct msghdr *m, size_t total_len, + int flags) +{ + struct tun_file *tfile = container_of(sock, struct tun_file, socket); + struct tun_struct *tun = __tun_get(tfile); + int ret; + + if (!tun) + return -EBADFD; + + if (flags & ~(MSG_DONTWAIT|MSG_TRUNC|MSG_ERRQUEUE)) { + ret = -EINVAL; + goto out; + } + if (flags & MSG_ERRQUEUE) { + ret = sock_recv_errqueue(sock->sk, m, total_len, + SOL_PACKET, TUN_TX_TIMESTAMP); + goto out; + } + ret = tun_do_read(tun, tfile, m->msg_iov, total_len, + flags & MSG_DONTWAIT); + if (ret > total_len) { + m->msg_flags |= MSG_TRUNC; + ret = flags & MSG_TRUNC ? ret : total_len; + } +out: + tun_put(tun); + return ret; +} + +static int tun_release(struct socket *sock) +{ + if (sock->sk) + sock_put(sock->sk); + return 0; +} + +/* Ops structure to mimic raw sockets with tun */ +static const struct proto_ops tun_socket_ops = { + .sendmsg = tun_sendmsg, + .recvmsg = tun_recvmsg, + .release = tun_release, +}; + +static struct proto tun_proto = { + .name = "bf_tun", + .owner = THIS_MODULE, + .obj_size = sizeof(struct tun_file), +}; + +static int tun_flags(struct tun_struct *tun) +{ + int flags = 0; + + if (tun->flags & TUN_TUN_DEV) + flags |= IFF_TUN; + else + flags |= IFF_TAP; + + if (tun->flags & TUN_NO_PI) + flags |= IFF_NO_PI; + + /* This flag has no real effect. We track the value for backwards + * compatibility. + */ + if (tun->flags & TUN_ONE_QUEUE) + flags |= IFF_ONE_QUEUE; + + if (tun->flags & TUN_VNET_HDR) + flags |= IFF_VNET_HDR; + + if (tun->flags & TUN_TAP_MQ) + flags |= IFF_MULTI_QUEUE; + + if (tun->flags & TUN_PERSIST) + flags |= IFF_PERSIST; + + return flags; +} + +static ssize_t tun_show_flags(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct tun_struct *tun = netdev_priv(to_net_dev(dev)); + return sprintf(buf, "0x%x\n", tun_flags(tun)); +} + +static ssize_t tun_show_owner(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct tun_struct *tun = netdev_priv(to_net_dev(dev)); + return uid_valid(tun->owner)? + sprintf(buf, "%u\n", + from_kuid_munged(current_user_ns(), tun->owner)): + sprintf(buf, "-1\n"); +} + +static ssize_t tun_show_group(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct tun_struct *tun = netdev_priv(to_net_dev(dev)); + return gid_valid(tun->group) ? + sprintf(buf, "%u\n", + from_kgid_munged(current_user_ns(), tun->group)): + sprintf(buf, "-1\n"); +} + +static DEVICE_ATTR(tun_flags, 0444, tun_show_flags, NULL); +static DEVICE_ATTR(owner, 0444, tun_show_owner, NULL); +static DEVICE_ATTR(group, 0444, tun_show_group, NULL); + +static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) +{ + struct tun_struct *tun; + struct tun_file *tfile = file->private_data; + struct net_device *dev; + int err; + + if (tfile->detached) + return -EINVAL; + + dev = __dev_get_by_name(net, ifr->ifr_name); + if (dev) { + if (ifr->ifr_flags & IFF_TUN_EXCL) + return -EBUSY; + if ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops) + tun = netdev_priv(dev); + else if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops) + tun = netdev_priv(dev); + else + return -EINVAL; + + if (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) != + !!(tun->flags & TUN_TAP_MQ)) + return -EINVAL; + + if (tun_not_capable(tun)) + return -EPERM; + err = security_tun_dev_open(tun->security); + if (err < 0) + return err; + + err = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER); + if (err < 0) + return err; + + if (tun->flags & TUN_TAP_MQ && + (tun->numqueues + tun->numdisabled > 1)) { + /* One or more queue has already been attached, no need + * to initialize the device again. + */ + return 0; + } + } + else { + char *name; + unsigned long flags = 0; + int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ? + MAX_TAP_QUEUES : 1; + + if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) + return -EPERM; + err = security_tun_dev_create(); + if (err < 0) + return err; + + /* Set dev type */ + if (ifr->ifr_flags & IFF_TUN) { + /* TUN device */ + flags |= TUN_TUN_DEV; + name = "tun%d"; + } else if (ifr->ifr_flags & IFF_TAP) { + /* TAP device */ + flags |= TUN_TAP_DEV; + name = "tap%d"; + } else + return -EINVAL; + + if (*ifr->ifr_name) + name = ifr->ifr_name; + + dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, + tun_setup, queues, queues); + + if (!dev) + return -ENOMEM; + + dev_net_set(dev, net); + dev->rtnl_link_ops = &tun_link_ops; + dev->ifindex = tfile->ifindex; + + tun = netdev_priv(dev); + tun->dev = dev; + tun->flags = flags; + tun->txflt.count = 0; + tun->vnet_hdr_sz = sizeof(struct virtio_net_hdr); + + tun->filter_attached = false; + tun->sndbuf = tfile->socket.sk->sk_sndbuf; + + spin_lock_init(&tun->lock); + + err = security_tun_dev_alloc_security(&tun->security); + if (err < 0) + goto err_free_dev; + + tun_net_init(dev); + tun_flow_init(tun); + + dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | + TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX; + dev->features = dev->hw_features; + dev->vlan_features = dev->features & + ~(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX); + + INIT_LIST_HEAD(&tun->disabled); + err = tun_attach(tun, file, false); + if (err < 0) + goto err_free_flow; + + err = register_netdevice(tun->dev); + if (err < 0) + goto err_detach; + + if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) || + device_create_file(&tun->dev->dev, &dev_attr_owner) || + device_create_file(&tun->dev->dev, &dev_attr_group)) + pr_err("Failed to create tun sysfs files\n"); + } + + netif_carrier_on(tun->dev); + + tun_debug(KERN_INFO, tun, "tun_set_iff\n"); + + if (ifr->ifr_flags & IFF_NO_PI) + tun->flags |= TUN_NO_PI; + else + tun->flags &= ~TUN_NO_PI; + + /* This flag has no real effect. We track the value for backwards + * compatibility. + */ + if (ifr->ifr_flags & IFF_ONE_QUEUE) + tun->flags |= TUN_ONE_QUEUE; + else + tun->flags &= ~TUN_ONE_QUEUE; + + if (ifr->ifr_flags & IFF_VNET_HDR) + tun->flags |= TUN_VNET_HDR; + else + tun->flags &= ~TUN_VNET_HDR; + + if (ifr->ifr_flags & IFF_MULTI_QUEUE) + tun->flags |= TUN_TAP_MQ; + else + tun->flags &= ~TUN_TAP_MQ; + + /* Make sure persistent devices do not get stuck in + * xoff state. + */ + if (netif_running(tun->dev)) + netif_tx_wake_all_queues(tun->dev); + + strcpy(ifr->ifr_name, tun->dev->name); + return 0; + +err_detach: + tun_detach_all(dev); +err_free_flow: + tun_flow_uninit(tun); + security_tun_dev_free_security(tun->security); +err_free_dev: + free_netdev(dev); + return err; +} + +static void tun_get_iff(struct net *net, struct tun_struct *tun, + struct ifreq *ifr) +{ + tun_debug(KERN_INFO, tun, "tun_get_iff\n"); + + strcpy(ifr->ifr_name, tun->dev->name); + + ifr->ifr_flags = tun_flags(tun); + +} + +/* This is like a cut-down ethtool ops, except done via tun fd so no + * privs required. */ +static int set_offload(struct tun_struct *tun, unsigned long arg) +{ + netdev_features_t features = 0; + + if (arg & TUN_F_CSUM) { + features |= NETIF_F_HW_CSUM; + arg &= ~TUN_F_CSUM; + + if (arg & (TUN_F_TSO4|TUN_F_TSO6)) { + if (arg & TUN_F_TSO_ECN) { + features |= NETIF_F_TSO_ECN; + arg &= ~TUN_F_TSO_ECN; + } + if (arg & TUN_F_TSO4) + features |= NETIF_F_TSO; + if (arg & TUN_F_TSO6) + features |= NETIF_F_TSO6; + arg &= ~(TUN_F_TSO4|TUN_F_TSO6); + } + + if (arg & TUN_F_UFO) { + features |= NETIF_F_UFO; + arg &= ~TUN_F_UFO; + } + } + + /* This gives the user a way to test for new features in future by + * trying to set them. */ + if (arg) + return -EINVAL; + + tun->set_features = features; + netdev_update_features(tun->dev); + + return 0; +} + +static void tun_detach_filter(struct tun_struct *tun, int n) +{ + int i; + struct tun_file *tfile; + + for (i = 0; i < n; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + __sk_detach_filter(tfile->socket.sk, lockdep_rtnl_is_held()); + } + + tun->filter_attached = false; +} + +static int tun_attach_filter(struct tun_struct *tun) +{ + int i, ret = 0; + struct tun_file *tfile; + + for (i = 0; i < tun->numqueues; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + ret = __sk_attach_filter(&tun->fprog, tfile->socket.sk, + lockdep_rtnl_is_held()); + if (ret) { + tun_detach_filter(tun, i); + return ret; + } + } + + tun->filter_attached = true; + return ret; +} + +static void tun_set_sndbuf(struct tun_struct *tun) +{ + struct tun_file *tfile; + int i; + + for (i = 0; i < tun->numqueues; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + tfile->socket.sk->sk_sndbuf = tun->sndbuf; + } +} + +static int tun_set_queue(struct file *file, struct ifreq *ifr) +{ + struct tun_file *tfile = file->private_data; + struct tun_struct *tun; + int ret = 0; + + rtnl_lock(); + + if (ifr->ifr_flags & IFF_ATTACH_QUEUE) { + tun = tfile->detached; + if (!tun) { + ret = -EINVAL; + goto unlock; + } + ret = security_tun_dev_attach_queue(tun->security); + if (ret < 0) + goto unlock; + ret = tun_attach(tun, file, false); + } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { + tun = rtnl_dereference(tfile->tun); + if (!tun || !(tun->flags & TUN_TAP_MQ) || tfile->detached) + ret = -EINVAL; + else + __tun_detach(tfile, false); + } else + ret = -EINVAL; + +unlock: + rtnl_unlock(); + return ret; +} + +static long __tun_chr_ioctl(struct file *file, unsigned int cmd, + unsigned long arg, int ifreq_len) +{ + struct tun_file *tfile = file->private_data; + struct tun_struct *tun; + void __user* argp = (void __user*)arg; + struct ifreq ifr; + kuid_t owner; + kgid_t group; + int sndbuf; + int vnet_hdr_sz; + unsigned int ifindex; + int ret; + + if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == 0x89) { + if (copy_from_user(&ifr, argp, ifreq_len)) + return -EFAULT; + } else { + memset(&ifr, 0, sizeof(ifr)); + } + if (cmd == TUNGETFEATURES) { + /* Currently this just means: "what IFF flags are valid?". + * This is needed because we never checked for invalid flags on + * TUNSETIFF. */ + return put_user(IFF_TUN | IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE | + IFF_VNET_HDR | IFF_MULTI_QUEUE, + (unsigned int __user*)argp); + } else if (cmd == TUNSETQUEUE) + return tun_set_queue(file, &ifr); + + ret = 0; + rtnl_lock(); + + tun = __tun_get(tfile); + if (cmd == TUNSETIFF && !tun) { + ifr.ifr_name[IFNAMSIZ-1] = '\0'; + + ret = tun_set_iff(tfile->net, file, &ifr); + + if (ret) + goto unlock; + + if (copy_to_user(argp, &ifr, ifreq_len)) + ret = -EFAULT; + goto unlock; + } + if (cmd == TUNSETIFINDEX) { + ret = -EPERM; + if (tun) + goto unlock; + + ret = -EFAULT; + if (copy_from_user(&ifindex, argp, sizeof(ifindex))) + goto unlock; + + ret = 0; + tfile->ifindex = ifindex; + goto unlock; + } + + ret = -EBADFD; + if (!tun) + goto unlock; + + tun_debug(KERN_INFO, tun, "tun_chr_ioctl cmd %u\n", cmd); + + ret = 0; + switch (cmd) { + case TUNGETIFF: + tun_get_iff(current->nsproxy->net_ns, tun, &ifr); + + if (tfile->detached) + ifr.ifr_flags |= IFF_DETACH_QUEUE; + if (!tfile->socket.sk->sk_filter) + ifr.ifr_flags |= IFF_NOFILTER; + + if (copy_to_user(argp, &ifr, ifreq_len)) + ret = -EFAULT; + break; + + case TUNSETNOCSUM: + /* Disable/Enable checksum */ + + /* [unimplemented] */ + tun_debug(KERN_INFO, tun, "ignored: set checksum %s\n", + arg ? "disabled" : "enabled"); + break; + + case TUNSETPERSIST: + /* Disable/Enable persist mode. Keep an extra reference to the + * module to prevent the module being unprobed. + */ + if (arg && !(tun->flags & TUN_PERSIST)) { + tun->flags |= TUN_PERSIST; + __module_get(THIS_MODULE); + } + if (!arg && (tun->flags & TUN_PERSIST)) { + tun->flags &= ~TUN_PERSIST; + module_put(THIS_MODULE); + } + + tun_debug(KERN_INFO, tun, "persist %s\n", + arg ? "enabled" : "disabled"); + break; + + case TUNSETOWNER: + /* Set owner of the device */ + owner = make_kuid(current_user_ns(), arg); + if (!uid_valid(owner)) { + ret = -EINVAL; + break; + } + tun->owner = owner; + tun_debug(KERN_INFO, tun, "owner set to %u\n", + from_kuid(&init_user_ns, tun->owner)); + break; + + case TUNSETGROUP: + /* Set group of the device */ + group = make_kgid(current_user_ns(), arg); + if (!gid_valid(group)) { + ret = -EINVAL; + break; + } + tun->group = group; + tun_debug(KERN_INFO, tun, "group set to %u\n", + from_kgid(&init_user_ns, tun->group)); + break; + + case TUNSETLINK: + /* Only allow setting the type when the interface is down */ + if (tun->dev->flags & IFF_UP) { + tun_debug(KERN_INFO, tun, + "Linktype set failed because interface is up\n"); + ret = -EBUSY; + } else { + tun->dev->type = (int) arg; + tun_debug(KERN_INFO, tun, "linktype set to %d\n", + tun->dev->type); + ret = 0; + } + break; + +#ifdef TUN_DEBUG + case TUNSETDEBUG: + tun->debug = arg; + break; +#endif + case TUNSETOFFLOAD: + ret = set_offload(tun, arg); + break; + + case TUNSETTXFILTER: + /* Can be set only for TAPs */ + ret = -EINVAL; + if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + break; + ret = update_filter(&tun->txflt, (void __user *)arg); + break; + + case SIOCGIFHWADDR: + /* Get hw address */ + memcpy(ifr.ifr_hwaddr.sa_data, tun->dev->dev_addr, ETH_ALEN); + ifr.ifr_hwaddr.sa_family = tun->dev->type; + if (copy_to_user(argp, &ifr, ifreq_len)) + ret = -EFAULT; + break; + + case SIOCSIFHWADDR: + /* Set hw address */ + tun_debug(KERN_DEBUG, tun, "set hw address: %pM\n", + ifr.ifr_hwaddr.sa_data); + + ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); + break; + + case TUNGETSNDBUF: + sndbuf = tfile->socket.sk->sk_sndbuf; + if (copy_to_user(argp, &sndbuf, sizeof(sndbuf))) + ret = -EFAULT; + break; + + case TUNSETSNDBUF: + if (copy_from_user(&sndbuf, argp, sizeof(sndbuf))) { + ret = -EFAULT; + break; + } + + tun->sndbuf = sndbuf; + tun_set_sndbuf(tun); + break; + + case TUNGETVNETHDRSZ: + vnet_hdr_sz = tun->vnet_hdr_sz; + if (copy_to_user(argp, &vnet_hdr_sz, sizeof(vnet_hdr_sz))) + ret = -EFAULT; + break; + + case TUNSETVNETHDRSZ: + if (copy_from_user(&vnet_hdr_sz, argp, sizeof(vnet_hdr_sz))) { + ret = -EFAULT; + break; + } + if (vnet_hdr_sz < (int)sizeof(struct virtio_net_hdr)) { + ret = -EINVAL; + break; + } + + tun->vnet_hdr_sz = vnet_hdr_sz; + break; + + case TUNATTACHFILTER: + /* Can be set only for TAPs */ + ret = -EINVAL; + if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + break; + ret = -EFAULT; + if (copy_from_user(&tun->fprog, argp, sizeof(tun->fprog))) + break; + + ret = tun_attach_filter(tun); + break; + + case TUNDETACHFILTER: + /* Can be set only for TAPs */ + ret = -EINVAL; + if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + break; + ret = 0; + tun_detach_filter(tun, tun->numqueues); + break; + + case TUNGETFILTER: + ret = -EINVAL; + if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + break; + ret = -EFAULT; + if (copy_to_user(argp, &tun->fprog, sizeof(tun->fprog))) + break; + ret = 0; + break; + + default: + ret = -EINVAL; + break; + } + +unlock: + rtnl_unlock(); + if (tun) + tun_put(tun); + return ret; +} + +static long tun_chr_ioctl(struct file *file, + unsigned int cmd, unsigned long arg) +{ + return __tun_chr_ioctl(file, cmd, arg, sizeof (struct ifreq)); +} + +#ifdef CONFIG_COMPAT +static long tun_chr_compat_ioctl(struct file *file, + unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case TUNSETIFF: + case TUNGETIFF: + case TUNSETTXFILTER: + case TUNGETSNDBUF: + case TUNSETSNDBUF: + case SIOCGIFHWADDR: + case SIOCSIFHWADDR: + arg = (unsigned long)compat_ptr(arg); + break; + default: + arg = (compat_ulong_t)arg; + break; + } + + /* + * compat_ifreq is shorter than ifreq, so we must not access beyond + * the end of that structure. All fields that are used in this + * driver are compatible though, we don't need to convert the + * contents. + */ + return __tun_chr_ioctl(file, cmd, arg, sizeof(struct compat_ifreq)); +} +#endif /* CONFIG_COMPAT */ + +static int tun_chr_fasync(int fd, struct file *file, int on) +{ + struct tun_file *tfile = file->private_data; + int ret; + + if ((ret = fasync_helper(fd, file, on, &tfile->fasync)) < 0) + goto out; + + if (on) { + ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0); + if (ret) + goto out; + tfile->flags |= TUN_FASYNC; + } else + tfile->flags &= ~TUN_FASYNC; + ret = 0; +out: + return ret; +} + +static int tun_chr_open(struct inode *inode, struct file * file) +{ + struct tun_file *tfile; + + DBG1(KERN_INFO, "tunX: tun_chr_open\n"); + + tfile = (struct tun_file *)sk_alloc(&init_net, AF_UNSPEC, GFP_KERNEL, + &tun_proto); + if (!tfile) + return -ENOMEM; + RCU_INIT_POINTER(tfile->tun, NULL); + tfile->net = get_net(current->nsproxy->net_ns); + tfile->flags = 0; + tfile->ifindex = 0; + + init_waitqueue_head(&tfile->wq.wait); + RCU_INIT_POINTER(tfile->socket.wq, &tfile->wq); + + tfile->socket.file = file; + tfile->socket.ops = &tun_socket_ops; + + sock_init_data(&tfile->socket, &tfile->sk); + sk_change_net(&tfile->sk, tfile->net); + + tfile->sk.sk_write_space = tun_sock_write_space; + tfile->sk.sk_sndbuf = INT_MAX; + + file->private_data = tfile; + set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags); + INIT_LIST_HEAD(&tfile->next); + + sock_set_flag(&tfile->sk, SOCK_ZEROCOPY); + + return 0; +} + +static int tun_chr_close(struct inode *inode, struct file *file) +{ + struct tun_file *tfile = file->private_data; + struct net *net = tfile->net; + + tun_detach(tfile, true); + put_net(net); + + return 0; +} + +#ifdef CONFIG_PROC_FS +static int tun_chr_show_fdinfo(struct seq_file *m, struct file *f) +{ + struct tun_struct *tun; + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); + + rtnl_lock(); + tun = tun_get(f); + if (tun) + tun_get_iff(current->nsproxy->net_ns, tun, &ifr); + rtnl_unlock(); + + if (tun) + tun_put(tun); + + return seq_printf(m, "iff:\t%s\n", ifr.ifr_name); +} +#endif + +static const struct file_operations tun_fops = { + .owner = THIS_MODULE, + .llseek = no_llseek, + .read = do_sync_read, + .aio_read = tun_chr_aio_read, + .write = do_sync_write, + .aio_write = tun_chr_aio_write, + .poll = tun_chr_poll, + .unlocked_ioctl = tun_chr_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = tun_chr_compat_ioctl, +#endif + .open = tun_chr_open, + .release = tun_chr_close, + .fasync = tun_chr_fasync, +#ifdef CONFIG_PROC_FS + .show_fdinfo = tun_chr_show_fdinfo, +#endif +}; + +static struct miscdevice tun_miscdev = { + .minor = (TUN_MINOR1), + .name = "bf_tun", + .nodename = "net/bf_tun", + .fops = &tun_fops, +}; + +/* ethtool interface */ + +static int tun_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +{ + cmd->supported = 0; + cmd->advertising = 0; + ethtool_cmd_speed_set(cmd, SPEED_10); + cmd->duplex = DUPLEX_FULL; + cmd->port = PORT_TP; + cmd->phy_address = 0; + cmd->transceiver = XCVR_INTERNAL; + cmd->autoneg = AUTONEG_DISABLE; + cmd->maxtxpkt = 0; + cmd->maxrxpkt = 0; + return 0; +} + +static void tun_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) +{ + struct tun_struct *tun = netdev_priv(dev); + + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); + + switch (tun->flags & TUN_TYPE_MASK) { + case TUN_TUN_DEV: + strlcpy(info->bus_info, "bf_tun", sizeof(info->bus_info)); + break; + case TUN_TAP_DEV: + strlcpy(info->bus_info, "tap", sizeof(info->bus_info)); + break; + } +} + +static u32 tun_get_msglevel(struct net_device *dev) +{ +#ifdef TUN_DEBUG + struct tun_struct *tun = netdev_priv(dev); + return tun->debug; +#else + return -EOPNOTSUPP; +#endif +} + +static void tun_set_msglevel(struct net_device *dev, u32 value) +{ +#ifdef TUN_DEBUG + struct tun_struct *tun = netdev_priv(dev); + tun->debug = value; +#endif +} + +static const struct ethtool_ops tun_ethtool_ops = { + .get_settings = tun_get_settings, + .get_drvinfo = tun_get_drvinfo, + .get_msglevel = tun_get_msglevel, + .set_msglevel = tun_set_msglevel, + .get_link = ethtool_op_get_link, + .get_ts_info = ethtool_op_get_ts_info, +}; + + +static int __init tun_init(void) +{ + int ret = 0; + + pr_info("%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); + pr_info("%s\n", DRV_COPYRIGHT); + + ret = rtnl_link_register(&tun_link_ops); + if (ret) { + pr_err("Can't register link_ops\n"); + goto err_linkops; + } + + ret = misc_register(&tun_miscdev); + if (ret) { + pr_err("Can't register misc device %d\n", (TUN_MINOR1)); + goto err_misc; + } + return 0; +err_misc: + rtnl_link_unregister(&tun_link_ops); +err_linkops: + return ret; +} + +static void tun_cleanup(void) +{ + misc_deregister(&tun_miscdev); + rtnl_link_unregister(&tun_link_ops); +} + +/* Get an underlying socket object from tun file. Returns error unless file is + * attached to a device. The returned object works like a packet socket, it + * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for + * holding a reference to the file for as long as the socket is in use. */ +struct socket *bf_tun_get_socket(struct file *file) +{ + struct tun_file *tfile; + if (file->f_op != &tun_fops) + return ERR_PTR(-EINVAL); + tfile = file->private_data; + if (!tfile) + return ERR_PTR(-EBADFD); + return &tfile->socket; +} +EXPORT_SYMBOL_GPL(bf_tun_get_socket); + +module_init(tun_init); +module_exit(tun_cleanup); +MODULE_DESCRIPTION(DRV_DESCRIPTION); +MODULE_AUTHOR(DRV_COPYRIGHT); +MODULE_LICENSE("GPL"); +MODULE_ALIAS_MISCDEV(TUN_MINOR1); +MODULE_ALIAS("devname:net/bf_tun"); diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/eeprom b/platform/barefoot/sonic-platform-modules-bfn/scripts/eeprom new file mode 100755 index 000000000000..07d98556cbbf --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/scripts/eeprom @@ -0,0 +1,10 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS syncd eeprom "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/fancontrol b/platform/barefoot/sonic-platform-modules-bfn/scripts/fancontrol new file mode 100755 index 000000000000..515fcbdd69da --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/scripts/fancontrol @@ -0,0 +1,11 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS syncd fancontrol "$@" + diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/ps_info b/platform/barefoot/sonic-platform-modules-bfn/scripts/ps_info new file mode 100755 index 000000000000..38c9d3330414 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/scripts/ps_info @@ -0,0 +1,10 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS syncd ps_info "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/sensors b/platform/barefoot/sonic-platform-modules-bfn/scripts/sensors new file mode 100755 index 000000000000..07af6955321e --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/scripts/sensors @@ -0,0 +1,12 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS syncd sensors "$@" + + diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/sfputil b/platform/barefoot/sonic-platform-modules-bfn/scripts/sfputil new file mode 100755 index 000000000000..3df67614e499 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/scripts/sfputil @@ -0,0 +1,10 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS syncd sfputil "$@" diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/test b/platform/barefoot/sonic-platform-modules-bfn/scripts/test new file mode 100755 index 000000000000..38327722c91f --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn/scripts/test @@ -0,0 +1 @@ +echo "test" diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/.gitignore b/platform/barefoot/sonic-platform-modules-ingrasys/.gitignore new file mode 100644 index 000000000000..c6127b38c1aa --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/.gitignore @@ -0,0 +1,52 @@ +# 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 diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/LICENSE b/platform/barefoot/sonic-platform-modules-ingrasys/LICENSE new file mode 100644 index 000000000000..9cecc1d4669e --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/changelog b/platform/barefoot/sonic-platform-modules-ingrasys/debian/changelog new file mode 100644 index 000000000000..f5c70c166031 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/changelog @@ -0,0 +1,17 @@ +platform-driver (1.1.0) unstable; urgency=low + + * Add support for s9180-32x + + -- developer Fri, 26 May 2017 11:00:00 +0800 + +platform-driver (1.1.0) unstable; urgency=low + + * Add support for s8900 series + + -- developer Wed, 29 Mar 2017 11:00:00 +0800 + +platform-driver (1.0.0) unstable; urgency=low + + * Initial release (Closes: #nnnn) + + -- developer Wed, 05 Oct 2016 16:30:45 +0800 diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/compat b/platform/barefoot/sonic-platform-modules-ingrasys/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/control b/platform/barefoot/sonic-platform-modules-ingrasys/debian/control new file mode 100644 index 000000000000..ec2c1f20c0f7 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/control @@ -0,0 +1,10 @@ +Source: platform-driver +Section: unknown +Priority: optional +Maintainer: Wade He +Build-Depends: debhelper (>= 9), dh-systemd +Standards-Version: 1.0.0 + +Package: sonic-platform-ingrasys-s9180-32x +Architecture: amd64 +Description: This package contains S9180-32X platform driver utility for SONiC project. diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/rules b/platform/barefoot/sonic-platform-modules-ingrasys/debian/rules new file mode 100755 index 000000000000..3ac0d3de6049 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/rules @@ -0,0 +1,81 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +PACKAGE_PRE_NAME := sonic-platform-ingrasys +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= s9180-32x +MODULE_DIR := modules +UTILS_DIR := utils +SERVICE_DIR := service +CONF_DIR := conf + +%: + dh $@ --with systemd + +clean: + dh_testdir + dh_testroot + dh_clean + +build: + #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + done) + +binary: binary-arch binary-indep + # Nothing to do + +binary-arch: + # Nothing to do + +#install: build + #dh_testdir + #dh_testroot + #dh_clean -k + #dh_installdirs + +binary-indep: + dh_testdir + dh_installdirs + + # Custom package commands + (for mod in $(MODULE_DIRS); do \ + mkdir debian/tmp/usr/sbin -p; \ + mkdir debian/tmp/lib/systemd/system -p; \ + mkdir debian/tmp/etc/init.d -p; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.sh debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/sbin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/bfn debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/init\.d/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + done) + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +.PHONY: build binary binary-arch binary-indep clean diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.dirs b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.dirs new file mode 100644 index 000000000000..401d79eb79b8 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.dirs @@ -0,0 +1,4 @@ +usr/sbin +lib/systemd/system +etc/ +etc/init.d/ \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.install b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.install new file mode 100644 index 000000000000..99bda5d123ae --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.install @@ -0,0 +1,4 @@ +lib/systemd/ +usr/sbin/ +etc/ +etc/init.d/ diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postinst b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postinst new file mode 100644 index 000000000000..38e5cac148c4 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postinst @@ -0,0 +1,57 @@ +# Automatically added by dh_systemd_enable +# This will only remove masks created by d-s-h on package removal. +deb-systemd-helper unmask s9180-32x-monitor.service >/dev/null || true +deb-systemd-helper unmask bfn.service >/dev/null || true +deb-systemd-helper unmask qsfp-monitor.service >/dev/null || true +# Generate kernel modules.dep and map files for add eeprom_mb. +depmod -a || true +# was-enabled defaults to true, so new installations run enable. +if deb-systemd-helper --quiet was-enabled s9180-32x-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable s9180-32x-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state s9180-32x-monitor.service >/dev/null || true +fi +if deb-systemd-helper --quiet was-enabled bfn.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable bfn.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state bfn.service >/dev/null || true +fi +if deb-systemd-helper --quiet was-enabled qsfp-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable qsfp-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state qsfp-monitor.service >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s9180-32x-monitor" ]; then + update-rc.d s9180-32x-monitor defaults >/dev/null + invoke-rc.d s9180-32x-monitor start || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + update-rc.d qsfp-monitor defaults >/dev/null + invoke-rc.d qsfp-monitor start || exit $? +fi +if [ -x "/etc/init.d/bfn" ]; then + invoke-rc.d bfn start || exit $? +fi +# End automatically added section +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + deb-systemd-invoke start s9180-32x-monitor.service >/dev/null || true + deb-systemd-invoke start qsfp-monitor.service >/dev/null || true + deb-systemd-invoke start bfn.service >/dev/null || true +fi +# End automatically added section diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postrm b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postrm new file mode 100644 index 000000000000..19c6bcb2945f --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postrm @@ -0,0 +1,42 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + fi +# End automatically added section +# Automatically added by dh_installinit +if [ "$1" = "purge" ] ; then + update-rc.d s9180-32x-monitor remove >/dev/null + update-rc.d bfn remove >/dev/null + update-rc.d qsfp-monitor remove >/dev/null +fi + + +# In case this system is running systemd, we make systemd reload the unit files +# to pick up changes. +if [ -d /run/systemd/system ] ; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_systemd_enable +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask s9180-32x-monitor.service >/dev/null + deb-systemd-helper mask bfn.service >/dev/null + deb-systemd-helper mask qsfp-monitor.service >/dev/null + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge s9180-32x-monitor.service >/dev/null + deb-systemd-helper unmask s9180-32x-monitor.service >/dev/null + deb-systemd-helper purge bfn.service >/dev/null + deb-systemd-helper unmask bfn.service >/dev/null + deb-systemd-helper purge qsfp-monitor.service >/dev/null + deb-systemd-helper unmask qsfp-monitor.service >/dev/null + fi +fi +# Generate kernel modules.dep and map files for remove eeprom_mb. +depmod -a || true +# End automatically added section + diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.prerm b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.prerm new file mode 100644 index 000000000000..76533bfe6889 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.prerm @@ -0,0 +1,21 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + deb-systemd-invoke stop s9180-32x-monitor.service >/dev/null + deb-systemd-invoke stop bfn.service >/dev/null + deb-systemd-invoke stop qsfp-monitor.service >/dev/null +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s9180-32x-monitor" ]; then + invoke-rc.d s9180-32x-monitor stop || exit $? +fi +if [ -x "/etc/init.d/bfn" ]; then + invoke-rc.d bfn stop || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + invoke-rc.d qsfp-monitor stop || exit $? +fi +# Driver deinit +/usr/sbin/i2c_utils.sh i2c_deinit +# End automatically added section + diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.upstart b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.upstart new file mode 100644 index 000000000000..2c8d2ebec6d7 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.upstart @@ -0,0 +1,7 @@ +description "SONiC platform service" + +respawn + +exec /usr/sbin/s9180_32x_monitor.sh +exec /usr/sbin/qsfp_monitor.sh +exec /etc/init.d/bfn start diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/README.md b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/README.md new file mode 100644 index 000000000000..fa3760ab9ab7 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/README.md @@ -0,0 +1,185 @@ +# Ingrasys S9180-32X Platform Driver for SONiC + +Copyright (C) 2016 Ingrasys, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +## Licensing terms + +The Licensing terms of the files within this project is split 2 parts. +The Linux kernel is released under the GNU General Public License version 2. +All other code is released under the GNU General Public License version 3. +Please see the LICENSE file for copies of both licenses. + +## Contents of this package + + - service/ + > Service config files for platform initialization and monitoring + - utils/ + > Scripts useful during platform bringup and sysfs function + - conf/ + > Platform configure files. + +## Kernel modules and drivers + +The driver for interacting with Ingrasys S9180-32X is contained in the I2C +kernel module and initialization script. The initialization script loads +the modules in the correct order. It has been built and tested against +the Linux 3.16 kernel. + +The initialization script will modprobe the needed modules, navigate to the +module's device directory in sysfs, and write configuration data to +the kernel module. + +### IGB + +This is OOB Ports on front panel for management plane. + +The IGB module must be loaded first on Ingrasys S9180-32X platform. + +### I2C i801 + +The I2C i801 on Ingrasys S9180-32X can be found in +`/sys/bus/i2c/devices/i2c-0/` + +This is I2C bus for Clock Gen, DIMM channel and digital potentiometers. + +The i801 module must be loaded second on Ingrasys S9180-32X. + +### I2C iSMT + +The I2C iSMT module on S9180-32X can be found in +`/sys/bus/i2c/devices/i2c-1/` + +This is I2C bus for CPLD, HWM, power controller and I2C Switches. + +The i801 module must be loaded third on Ingrasys S9180-32X. + +### I2C PCA9548 +The PCA9548 module on S9180-32X can be found in +`/sys/bus/i2c/devices/i2c-2/` , `/sys/bus/i2c/devices/i2c-3/`, +`/sys/bus/i2c/devices/i2c-4/`, `/sys/bus/i2c/devices/i2c-5/`, +`/sys/bus/i2c/devices/i2c-6/`, `/sys/bus/i2c/devices/i2c-7/`, +`/sys/bus/i2c/devices/i2c-8/`, `/sys/bus/i2c/devices/i2c-9/`. + +The pca9548 module for zQSFP module get/set functions, PSU information, +fan status and EEPROM. + +## Hardware components + +The hardware components are initialized in the init script on S9180-32X. +The following describes manual initialization as well as interaction. +The examples below are just for Ingrasys S9180-32X platform. + +### Hardware initialization + +When the sonic-platform-ingrasys-s9180 package is installed on the S9180-32X, +it is automatically initialized. If you want to manual initialization, the +utility command usage as follows: +``` + i2c_utils.sh i2c_init +``` + +### EEPROM + +The EEPROM is including the board SKU, model name, vendor name, serial number, +and other information can be accessed with the specific eeprom kernel module. +After using `modprobe eeprom_mb` to detect the eeprom, it will show up in sysfs. + +The hexdump utility can be used to decode the raw output of the EEPROM. +For example, +``` + bash# echo "mb_eeprom 0x54" > /sys/bus/i2c/devices/i2c-9/new_device + bash# cat /sys/bus/i2c/drivers/mb_eeprom/9-0054/eeprom | hexdump -C +``` + +### Front panel LEDs + +LEDs can be setup on/off by using i2c utility `/usr/sbin/i2c_utils.sh`. +Utility function command usage as follows: + +``` +Status LED: + i2c_utils.sh i2c_sys_led green|amber on|off + +Fan status LED: + i2c_utils.sh i2c_fan_led green|amber on|off + +PSU1 status LED: + i2c_utils.sh i2c_psu1_led green|amber on|off + +PSU2 status LED: + i2c_utils.sh i2c_psu2_led green|amber on|off + +``` +QSFP Module Port LEDs control by ASIC library. + + +### Fan speed + +Fan speed are controlled by the w83795 kernel module. +It can be found in `/sys/class/hwmon/hwmon3/device/`. +If they were compiled as modules, you will need to modprobe w83795 for +their sysfs entries to show up. Each fan has an `fan_input` file +for reading the fan speed. And `pwm1` setting fan1 to fan4, +`pwm2` setting fan5 to fan8. + +There is docker-platform-monitor container installed fancontrol package that can +automatic control platform fan speed. + + +### Temperature sensors + +Temperature sensors are controlled by the w83795 kernel +module. It can be found in `/sys/class/hwmon/hwmon3/device/`. +If they were compiled as modules, then you will need to modprobe w83795 for +their sysfs entries to show up. +`temp1_input` is front MAC temperature sensor. `temp2_input` is rear MAC +temperature sensor. + +There is docker-platform-monitor container installed lm-sensors package that can +monitor platform temperature. And `sensors` command can show each +temperature sensors status. + +### Power supplies + +Power supplies status and its EEPROM info can be used i2c utility +`/usr/sbin/i2c_utils.sh` to get. +The usage as follows: +``` +PSU EEPROM: + i2c_utils.sh i2c_psu_eeprom_get + hexdump -C psu0.rom + hexdump -C psu1.rom + +PSU Status: + i2c_utils.sh i2c_psu_status +``` + +### QSFPs +QSFP modules are managed by the pca9548 kernel driver. +The i2c utility `/usr/sbin/i2c_utils.sh` can be used to get status and +module EEPROM informations. +The usage as follows: +``` +QSFP EEPROM: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + +QSFP Insert Event: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + 0 => not insert + 1 => inserted +``` + diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/Makefile b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/Makefile new file mode 100644 index 000000000000..3edb8690475e --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/Makefile @@ -0,0 +1 @@ +obj-m := eeprom_mb.o diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/eeprom_mb.c b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/eeprom_mb.c new file mode 100644 index 000000000000..61f0caf96130 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/eeprom_mb.c @@ -0,0 +1,211 @@ +/* + * Copyright (C) 1998, 1999 Frodo Looijaard and + * Philip Edelbrock + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003 IBM Corp. + * Copyright (C) 2004 Jean Delvare + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void mb_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, ((u8)addr >> 8) & 0xFF, (u8)addr & 0xFF); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t mb_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + mb_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static struct bin_attribute mb_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = mb_eeprom_read, +}; + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int mb_eeprom_detect(struct i2c_client *client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + + /* EDID EEPROMs are often 24C00 EEPROMs, which answer to all + addresses 0x50-0x57, but we only care about 0x50. So decline + attaching to addresses >= 0x51 on DDC buses */ + if (!(adapter->class & I2C_CLASS_SPD) && client->addr >= 0x51) { + return -ENODEV; + } + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE) + && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + return -ENODEV; + } + + strlcpy(info->type, "eeprom", I2C_NAME_SIZE); + + return 0; +} + +static int mb_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &mb_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int mb_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &mb_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id mb_eeprom_id[] = { + { "mb_eeprom", 0 }, + { } +}; + +static struct i2c_driver mb_eeprom_driver = { + .driver = { + .name = "mb_eeprom", + }, + .probe = mb_eeprom_probe, + .remove = mb_eeprom_remove, + .id_table = mb_eeprom_id, + + .class = I2C_CLASS_DDC | I2C_CLASS_SPD, + .detect = mb_eeprom_detect, + .address_list = normal_i2c, +}; + +module_i2c_driver(mb_eeprom_driver); + +MODULE_AUTHOR("Wade "); +MODULE_DESCRIPTION("Ingrasys Mother Borad EEPROM driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/bfn.service b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/bfn.service new file mode 100644 index 000000000000..6c8c2fb71517 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/bfn.service @@ -0,0 +1,13 @@ +[Unit] +Description=Barefoot Kernel Module +After=local-fs.target +Before=docker.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/bfn start +ExecStop=-/etc/init.d/bfn stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/qsfp-monitor.service b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/qsfp-monitor.service new file mode 100644 index 000000000000..fde9dcf9f50a --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/qsfp-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description= This QSFP Monitor service is to setup QSFP SI. +Requires=s9180-32x-monitor.service +After=s9180-32x-monitor.service + +[Service] +ExecStart=/usr/sbin/qsfp_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/s9180-32x-monitor.service b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/s9180-32x-monitor.service new file mode 100644 index 000000000000..884284b241ad --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/s9180-32x-monitor.service @@ -0,0 +1,19 @@ +[Unit] +Description= This Platform Monitor service is to initialize platform and monitor platform. +Before=platform-monitor.service +After=sysinit.target +Wants=fancontrol.service +Wants=qsfp-monitor.service +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/sbin/i2c_utils.sh i2c_init +ExecStart=/usr/sbin/s9180_32x_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/bfn b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/bfn new file mode 100755 index 000000000000..c52b1fab4ea1 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/bfn @@ -0,0 +1,44 @@ +#!/bin/bash +# This script load/unload Barefoot kernel modules + +### BEGIN INIT INFO +# Provides: +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Load Barefoot kernel modules +### END INIT INFO + +case "$1" in +start) + echo -n "Load Barefoot kernel modules... " + + modprobe bf_kdrv + modprobe bf_tun + + echo "done." + ;; + +stop) + echo -n "Unload Barefoot kernel modules... " + + rmmod bf_tun + rmmod bf_kdrv + + echo "done." + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/bfn {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/i2c_utils.sh b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/i2c_utils.sh new file mode 100755 index 000000000000..e765ed1da6a9 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/i2c_utils.sh @@ -0,0 +1,1423 @@ +#!/bin/bash + +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +VERSION="1.0.0" +TRUE=200 +FALSE=404 + +EXEC_FUNC=${1} +QSFP_PORT=${2} +QSFP_ACTION=${2} +MB_EEPROM_ACTION=${2} +COLOR_PORT_LED=${3} +ONOFF_LED=${3} +COLOR_SYS_LED=${2} +BLINK_LED=${4} +FAN_TRAY=${4} + +############################################################ +# Distributor ID: Debian +# Description: Debian GNU/Linux 8.6 (jessie) +# Release: 8.6 +# Codename: jessie +# Linux debian 3.16.0-4-amd64 #1 +# SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux +############################################################ + +# Color Definition +COLOR_TITLE="\e[1;32m" ### Green ### +COLOR_WARNING="\e[1;33m" ### Yellow ### +COLOR_ERROR="\e[1;31m" ### Red ### +COLOR_END="\e[0m" ### END ### + +NUM_I801_DEVICE=0 # Main I2C +NUM_MUX1_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 1 )) # zQSFP I/O 0-7 +NUM_MUX1_CHAN1_DEVICE=$(( ${NUM_MUX1_CHAN0_DEVICE} + 1 )) # zQSFP I/O 8-15 +NUM_MUX1_CHAN2_DEVICE=$(( ${NUM_MUX1_CHAN1_DEVICE} + 1 )) # zQSFP I/O 16-23 +NUM_MUX1_CHAN3_DEVICE=$(( ${NUM_MUX1_CHAN2_DEVICE} + 1 )) # zQSFP I/O 24-31 +NUM_MUX1_CHAN4_DEVICE=$(( ${NUM_MUX1_CHAN3_DEVICE} + 1 )) # zQSFP I/O ABS#, INT +NUM_MUX1_CHAN5_DEVICE=$(( ${NUM_MUX1_CHAN4_DEVICE} + 1 )) # zQSFP I/O LPMODE, RST, MODSEL +NUM_MUX1_CHAN6_DEVICE=$(( ${NUM_MUX1_CHAN5_DEVICE} + 1 )) # MAC CLK CPLD +NUM_MUX1_CHAN7_DEVICE=$(( ${NUM_MUX1_CHAN6_DEVICE} + 1 )) # P1V0 PWR +NUM_MUX3_CHAN0_DEVICE=$(( ${NUM_MUX1_CHAN7_DEVICE} + 1 )) # zQSFP I/O 0-7 +NUM_MUX4_CHAN0_DEVICE=$(( ${NUM_MUX3_CHAN0_DEVICE} + 8 )) # zQSFP I/O 8-15 +NUM_MUX5_CHAN0_DEVICE=$(( ${NUM_MUX4_CHAN0_DEVICE} + 8 )) # zQSFP I/O 16-23 +NUM_MUX6_CHAN0_DEVICE=$(( ${NUM_MUX5_CHAN0_DEVICE} + 8 )) # zQSFP I/O 24-31 +NUM_MUX7_CHAN0_DEVICE=$(( ${NUM_MUX6_CHAN0_DEVICE} + 8 )) # Temp Sensor 0x48-0x4D +NUM_MAIN_MUX_CHAN0_DEVICE=$(( ${NUM_MUX7_CHAN0_DEVICE} + 8 )) # System LED HWMON +NUM_MAIN_MUX_CHAN1_DEVICE=$(( ${NUM_MAIN_MUX_CHAN0_DEVICE} + 1 )) # System LED +NUM_MAIN_MUX_CHAN2_DEVICE=$(( ${NUM_MAIN_MUX_CHAN0_DEVICE} + 2 )) # Board ID +NUM_MAIN_MUX_CHAN3_DEVICE=$(( ${NUM_MAIN_MUX_CHAN0_DEVICE} + 3 )) # MAX_Slave +NUM_MAIN_MUX_CHAN4_DEVICE=$(( ${NUM_MAIN_MUX_CHAN0_DEVICE} + 4 )) # TEMP Sensor +NUM_MAIN_MUX_CHAN5_DEVICE=$(( ${NUM_MAIN_MUX_CHAN0_DEVICE} + 5 )) # CLK GEN +NUM_MAIN_MUX_CHAN6_DEVICE=$(( ${NUM_MAIN_MUX_CHAN0_DEVICE} + 6 )) # VDD CORE +NUM_MAIN_MUX_CHAN7_DEVICE=$(( ${NUM_MAIN_MUX_CHAN0_DEVICE} + 7 )) # HWMON +NUM_FRU_MUX_CHAN0_DEVICE=$(( ${NUM_MAIN_MUX_CHAN0_DEVICE} + 8 )) # PSU2 +NUM_FRU_MUX_CHAN1_DEVICE=$(( ${NUM_FRU_MUX_CHAN0_DEVICE} + 1 )) # PSU1 +NUM_FRU_MUX_CHAN2_DEVICE=$(( ${NUM_FRU_MUX_CHAN0_DEVICE} + 2 )) # FAN +NUM_CPLD_DEVICE=$(( ${NUM_MUX7_CHAN0_DEVICE} + 3 )) # CPLD +NUM_SFP1_DEVICE=$(( ${NUM_MUX7_CHAN0_DEVICE} + 4 )) # CPLD +NUM_SFP2_DEVICE=$(( ${NUM_MUX7_CHAN0_DEVICE} + 5 )) # CPLD + +PATH_SYS_I2C_DEVICES="/sys/bus/i2c/devices" +PATH_HWMON_ROOT_DEVICES="/sys/class/hwmon" +PATH_HWMON_W83795_DEVICE="${PATH_HWMON_ROOT_DEVICES}/hwmon1" +PATH_I801_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}" +PATH_ISMT_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_ISMT_DEVICE}" +PATH_MUX_CHAN0_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN0_DEVICE}" +PATH_MUX_CHAN1_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN1_DEVICE}" +PATH_MUX_CHAN2_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN2_DEVICE}" +PATH_MUX_CHAN3_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN3_DEVICE}" +PATH_MUX_CHAN4_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN4_DEVICE}" +PATH_MUX_CHAN5_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN5_DEVICE}" +PATH_MUX_CHAN6_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN6_DEVICE}" +PATH_MUX_CHAN7_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN7_DEVICE}" +PATH_MUX7_CHAN0_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX7_CHAN0_DEVICE}" +PATH_MAIN_MUX_CHAN0_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MAIN_MUX_CHAN0_DEVICE}" + +#Power Supply Status +PSU_DC_ON=1 +PSU_DC_OFF=0 +PSU_EXIST=1 +PSU_NOT_EXIST=0 + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} i2c_init" + echo " : ${0} i2c_deinit" + echo " : ${0} i2c_temp_init" + echo " : ${0} i2c_fan_init" + echo " : ${0} i2c_volmon_init" + echo " : ${0} i2c_io_exp_init" + echo " : ${0} i2c_gpio_init" + echo " : ${0} i2c_gpio_deinit" + + echo " : ${0} i2c_psu_eeprom_get" + echo " : ${0} i2c_mb_eeprom_get" + echo " : ${0} i2c_cpu_eeprom_get" + echo " : ${0} i2c_qsfp_eeprom_get [1-34]" + echo " : ${0} i2c_qsfp_eeprom_init new|delete" + echo " : ${0} i2c_sfp_eeprom_init new|delete" + echo " : ${0} i2c_mb_eeprom_init new|delete" + echo " : ${0} i2c_psu_eeprom_init new|delete" + echo " : ${0} i2c_qsfp_status_get [1-34]" + echo " : ${0} i2c_qsfp_type_get [1-34]" + echo " : ${0} i2c_board_type_get" + echo " : ${0} i2c_psu_status" + echo " : ${0} i2c_led_fan_status_set" + echo " : ${0} i2c_led_fan_tray_status_set" + echo " : ${0} i2c_cpld_version" + echo " : ${0} i2c_port_led_set [1-34] green|yellow|off blink|noblink" + echo " : ${0} i2c_test_all" + echo " : ${0} i2c_sys_led green|amber" + echo " : ${0} i2c_fan_led green|amber on|off" + echo " : ${0} i2c_fan_tray_led green|amber on|off [1-4]" + echo "----------------------------------------------------" +} + +#Pause function +function _pause { + read -p "$*" +} + +#Retry command function +function _retry { + local i + for i in {1..5}; + do + eval "${*}" && break || echo "retry"; sleep 1; + done +} + +#I2C Init +function _i2c_init { + echo "=========================================================" + echo "# Description: I2C Init" + echo "=========================================================" + + rmmod eeprom + rmmod i2c_i801 + modprobe i2c_i801 + modprobe i2c_dev + modprobe i2c_mux_pca954x force_deselect_on_exit=1 + + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x70' > ${PATH_I801_DEVICE}/new_device" + else + echo "${PATH_I801_DEVICE} 0x70 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX3_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN0_DEVICE}/new_device" + else + echo "${PATH_MUX_CHAN0_DEVICE} 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX4_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN1_DEVICE}/new_device" + else + echo "${PATH_MUX_CHAN1_DEVICE} 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX5_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN2_DEVICE}/new_device" + else + echo "${PATH_MUX_CHAN2_DEVICE} 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX6_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN3_DEVICE}/new_device" + else + echo "${PATH_MUX_CHAN3_DEVICE} 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX7_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN6_DEVICE}/new_device" + else + echo "${PATH_MUX_CHAN6_DEVICE} 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MAIN_MUX_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x76' > ${PATH_I801_DEVICE}/new_device" + else + echo "${PATH_MAIN_MUX_CHAN0_DEVICE} 0x76 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_FRU_MUX_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9545 0x72' > ${PATH_I801_DEVICE}/new_device" + else + echo "${PATH_MAIN_MUX_CHAN0_DEVICE} 0x72 already init." + fi + + rmmod coretemp + rmmod jc42 + rmmod w83795 + rmmod lm75 + rmmod lm90 + rmmod eeprom + modprobe coretemp + modprobe w83795 + modprobe lm75 + modprobe lm90 + modprobe eeprom_mb + modprobe gpio-pca953x + _i2c_io_exp_init + _i2c_fan_init + _i2c_volmon_init + _i2c_fan_speed_init + _i2c_temp_init + modprobe jc42 + _i2c_gpio_init + _i2c_mb_eeprom_init "new" + _i2c_qsfp_eeprom_init "new" + _i2c_sfp_eeprom_init "new" + _i2c_psu_eeprom_init "new" + _i2c_led_fan_status_set + _i2c_led_fan_tray_status_set + + #SYS LED set green + COLOR_SYS_LED="green" + _i2c_sys_led +} + +#I2C Deinit +function _i2c_deinit { + _i2c_gpio_deinit + for mod in coretemp jc42 w83795 lm75 lm90 eeprom eeprom_mb gpio-pca953x i2c_mux_pca954x i2c_ismt i2c_i801; + do + [ "$(lsmod | grep "^$mod ")" != "" ] && rmmod $mod + done +} + +#FAN Init +function _i2c_fan_speed_init { + echo -n "FAN INIT..." + if [ -e "${PATH_HWMON_W83795_DEVICE}" ]; then + echo 120 > ${PATH_HWMON_W83795_DEVICE}/device/pwm1 + echo 120 > ${PATH_HWMON_W83795_DEVICE}/device/pwm2 + echo "SUCCESS" + else + echo "FAIL" + fi + +} + +#VOLMON Init +function _i2c_volmon_init { + echo "VOLMON INIT..." + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x00 0x80 + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x01 0x1C + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x00 0x80 + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x02 0xFF + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x03 0x50 + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x04 0x0A + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x00 0x80 + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x01 0x1D + + # add w83795 to sysfs + dev_path="${PATH_SYS_I2C_DEVICES}/${NUM_MAIN_MUX_CHAN7_DEVICE}-0x2f" + if ! [ -L ${dev_path} ]; then + echo "w83795adg 0x2f" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MAIN_MUX_CHAN7_DEVICE}/new_device #hwmon + else + echo "${dev_path} already exist" + fi + echo "Done" +} + +#IO Expander Init +function _i2c_io_exp_init { + echo "=========================================================" + echo "# Description: I2C IO Expender Init" + echo "=========================================================" + + #Golden Finger to active CPLD + i2cget -y ${NUM_CPLD_DEVICE} 0x74 2 + #BMC dummy board reset + echo "BMC dummy board reset" + i2cset -y -r ${NUM_I801_DEVICE} 0x26 4 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x26 5 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x26 2 0x3F + i2cset -y -r ${NUM_I801_DEVICE} 0x26 3 0x1F + i2cset -y -r ${NUM_I801_DEVICE} 0x26 6 0xC0 + i2cset -y -r ${NUM_I801_DEVICE} 0x26 7 0x00 + + #CPU Baord + i2cset -y -r ${NUM_I801_DEVICE} 0x77 6 0xFF + i2cset -y -r ${NUM_I801_DEVICE} 0x77 7 0xFF + + #SMBUS1 + #ABS + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x20 6 0xFF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x20 7 0xFF + + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x21 6 0xFF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x21 7 0xFF + + #Transcevior INT + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 6 0xFF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 7 0xFF + + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x23 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x23 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x23 2 0xCF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x23 3 0xF0 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x23 6 0xCF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x23 7 0xF0 + + #SFP+ PRES, TX FAULT, TX DIS, RX LOS, RS, TS + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x27 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x27 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x27 2 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x27 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x27 6 0xCF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x27 7 0xF0 + + + echo "Init ZQSFP IO Expender" + echo "set ZQSFP LP_MODE = 0" + #set ZQSFP LP_MODE = 0 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 2 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 7 0x00 + + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 2 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 7 0x00 + + echo "set ZQSFP RST = 1" + #set ZQSFP RST = 1 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 2 0xFF + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 3 0xFF + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 7 0x00 + + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 2 0xFF + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 3 0xFF + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 7 0x00 + + #0.0: TH_RST_L - 0:Reset + #0.1: TH_PCIE_RST_L - 0:Reset + #0.2: LED_CLR - 0: Off, 1:On + #0.3: Host to BMC + #0.4: UART_SEL - 0:Host + #0.5: USB_SEL - 0: Host + #0.[7:6]: TH_CLK_FSEL (00) + #1.0: TH_INT_L + #1.1: QSFP0_INT_L - 0:Interrupt + #1.2: QSFP1_INT_L - 0:Interrupt + #1.3: QSFP2_INT_L - 0:Interrupt + #1.4: QSFP3_INT_L - 0:Interrupt + #1.5: TH_CLK_SEL (0) + #1.6: I210_RST_L - 0:Reset + #1.6: I210_PE_RST_L - 0:Reset + echo "Init HOST GPIO" + i2cset -y -r ${NUM_I801_DEVICE} 0x74 4 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x74 5 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x74 2 0x0F + i2cset -y -r ${NUM_I801_DEVICE} 0x74 3 0xDF + i2cset -y -r ${NUM_I801_DEVICE} 0x74 6 0x08 + i2cset -y -r ${NUM_I801_DEVICE} 0x74 7 0x1F + + + #LED board after PVT (BAREFOOT_IO_EXP_LED_ID) + echo "Init LED IO Expender" + echo "LED_CHANNEL=${NUM_MAIN_MUX_CHAN1_DEVICE}" + i2cset -y -r ${NUM_MAIN_MUX_CHAN1_DEVICE} 0x75 4 0x00 + i2cset -y -r ${NUM_MAIN_MUX_CHAN1_DEVICE} 0x75 5 0x00 + i2cset -y -r ${NUM_MAIN_MUX_CHAN1_DEVICE} 0x75 6 0x00 + i2cset -y -r ${NUM_MAIN_MUX_CHAN1_DEVICE} 0x75 7 0xFF + + #Board ID + echo "Init Board ID" + i2cset -y -r ${NUM_MAIN_MUX_CHAN2_DEVICE} 0x27 4 0x00 + i2cset -y -r ${NUM_MAIN_MUX_CHAN2_DEVICE} 0x27 5 0x00 + i2cset -y -r ${NUM_MAIN_MUX_CHAN2_DEVICE} 0x27 6 0xFF + i2cset -y -r ${NUM_MAIN_MUX_CHAN2_DEVICE} 0x27 7 0xFF + + #Board ID of dummy card + echo "Init Board ID of dummy card" + i2cset -y -r ${NUM_I801_DEVICE} 0x24 4 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x24 5 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x24 6 0xFF + i2cset -y -r ${NUM_I801_DEVICE} 0x24 7 0xFF + + #PSU I/O (BAREFOOT_IO_EXP_PSU_ID) + echo "Init PSU IO Expender" + i2cset -y -r ${NUM_I801_DEVICE} 0x25 4 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x25 5 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x25 2 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x25 3 0x1D + i2cset -y -r ${NUM_I801_DEVICE} 0x25 6 0xDB + i2cset -y -r ${NUM_I801_DEVICE} 0x25 7 0x03 + + #FAN I/O (BAREFOOT_IO_EXP_FAN_ID) + echo "Init FAN IO Expender" + i2cset -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} 0x20 2 0x11 + i2cset -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} 0x20 3 0x11 + i2cset -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} 0x20 6 0xCC + i2cset -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} 0x20 7 0xCC + +} + +#FANIN Init +function _i2c_fan_init { + echo "FANIN INIT..." + # enable fan monitor on w83795 + # 4 fantray with 8 FANIN + # select bank0 + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x00 0x80 + # enable FANIN1~8 + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x06 0xFF + # disable FANIN9~14 + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x07 0x00 + + # select bank 2 + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x00 0x82 + # set PWM mode in FOMC + i2cset -y -r ${NUM_MAIN_MUX_CHAN7_DEVICE} 0x2F 0x0F 0x00 + + echo "Done" +} + +#GPIO Init +function _i2c_gpio_init { + local i=0 + #ABS Port 0-15 + echo "pca9535 0x20" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/new_device + for i in {240..255}; + do + echo $i > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio${i}/active_low + done + + #ABS Port 16-31 + echo "pca9535 0x21" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/new_device + for i in {224..239}; + do + echo $i > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio${i}/active_low + done + + #INT Port 0-15 + echo "pca9535 0x22" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/new_device + for i in {208..223}; + do + echo $i > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio${i}/active_low + done + + #INT Port 16-31 + echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/new_device + for i in {192..207}; + do + echo $i > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio${i}/active_low + done + + #SFP+ + echo "pca9535 0x27" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/new_device + for i in {176..191}; + do + echo $i > /sys/class/gpio/export + case ${i} in + 176|177|178|179|182|183|188|189|190|191) + echo 1 > /sys/class/gpio/gpio${i}/active_low + ;; + 180|181|184|185|186|187) + echo out > /sys/class/gpio/gpio${i}/direction + ;; + esac + + done + #echo 176 > /sys/class/gpio/export + #echo 177 > /sys/class/gpio/export + #echo 178 > /sys/class/gpio/export + #echo 179 > /sys/class/gpio/export + #echo 180 > /sys/class/gpio/export + #echo 181 > /sys/class/gpio/export + #echo 182 > /sys/class/gpio/export + #echo 183 > /sys/class/gpio/export + #echo 184 > /sys/class/gpio/export + #echo 185 > /sys/class/gpio/export + #echo 186 > /sys/class/gpio/export + #echo 187 > /sys/class/gpio/export + #echo 188 > /sys/class/gpio/export + #echo 189 > /sys/class/gpio/export + #echo 190 > /sys/class/gpio/export + #echo 191 > /sys/class/gpio/export + #echo 1 > /sys/class/gpio/gpio176/active_low #SFP+0 ABS + #echo 1 > /sys/class/gpio/gpio177/active_low #SFP+1 ABS + #echo 1 > /sys/class/gpio/gpio178/active_low #SFP+0 TX_FAULT + #echo 1 > /sys/class/gpio/gpio179/active_low #SFP+1 TX_FAULT + #echo out > /sys/class/gpio/gpio180/direction #SFP+0 TX_DIS + #echo out > /sys/class/gpio/gpio181/direction #SFP+1 TX_DIS + #echo 1 > /sys/class/gpio/gpio182/active_low #SFP+0 RX_LOS + #echo 1 > /sys/class/gpio/gpio183/active_low #SFP+1 RX_LOS + #echo out > /sys/class/gpio/gpio184/direction #SFP+0 RS + #echo out > /sys/class/gpio/gpio185/direction #SFP+1 RS + #echo out > /sys/class/gpio/gpio186/direction #SFP+0 TS + #echo out > /sys/class/gpio/gpio187/direction #SFP+1 TS + #echo 1 > /sys/class/gpio/gpio188/active_low #N/A + #echo 1 > /sys/class/gpio/gpio189/active_low #N/A + #echo 1 > /sys/class/gpio/gpio190/active_low #N/A + #echo 1 > /sys/class/gpio/gpio191/active_low #N/A + + #LP Mode Port 0-15 + echo "pca9535 0x20" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/new_device + for i in {160..175}; + do + echo $i > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio${i}/direction + done + + #LP Mode Port 16-31 + echo "pca9535 0x21" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/new_device + for i in {144..159}; + do + echo $i > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio${i}/direction + done + + #RST Port 0-15 + echo "pca9535 0x22" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/new_device + for i in {128..143}; + do + echo $i > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio${i}/direction + echo 1 > /sys/class/gpio/gpio${i}/active_low + echo 0 > /sys/class/gpio/gpio${i}/value + done + + #RST Port 16-31 + echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/new_device + for i in {112..127}; + do + echo $i > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio${i}/direction + echo 1 > /sys/class/gpio/gpio${i}/active_low + echo 0 > /sys/class/gpio/gpio${i}/value + done + + #PSU I/O on Dummy Board 0x25 + echo "pca9535 0x25" > /sys/bus/i2c/devices/i2c-${NUM_I801_DEVICE}/new_device + for i in {96..111}; + do + echo $i > /sys/class/gpio/export + case ${i} in + 97|98|100|101|102|105|106|108) + echo 1 > /sys/class/gpio/gpio${i}/active_low + ;; + 98|101|106|107|108) + echo out > /sys/class/gpio/gpio${i}/direction + ;; + esac + done +} + +#GPIO DeInit +function _i2c_gpio_deinit { + echo "0x20" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/delete_device + echo "0x21" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/delete_device + echo "0x22" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/delete_device + echo "0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/delete_device + echo "0x27" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/delete_device + echo "0x20" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/delete_device + echo "0x21" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/delete_device + echo "0x22" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/delete_device + echo "0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/delete_device + echo "0x25" > /sys/bus/i2c/devices/i2c-${NUM_I801_DEVICE}/delete_device +} + +#TMP75 Init +function _i2c_temp_init { + echo "lm86 0x4c" > ${PATH_MUX7_CHAN0_DEVICE}/new_device # ASIC Coretemp and Front MAC + echo "tmp75 0x4f" > ${PATH_I801_DEVICE}/new_device #CPU Board + echo "tmp75 0x48" > ${PATH_MUX7_CHAN0_DEVICE}/new_device # Near PSU1 + echo "tmp75 0x4a" > ${PATH_MUX7_CHAN0_DEVICE}/new_device # Rear MAC + echo "tmp75 0x4b" > ${PATH_MUX7_CHAN0_DEVICE}/new_device # Near Port 32 + echo "tmp75 0x4d" > ${PATH_MUX7_CHAN0_DEVICE}/new_device # Near PSU2 +} + +#Set FAN Tray LED +function _i2c_led_fan_tray_status_set { + echo "FAN Tray Status Setup" + #FAN Status get + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan2_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan4_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN6_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan6_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + FAN8_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan8_alarm` + + # check if io expander for fan tray exist + #i2cset -m $mask -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} $i2cAddr $ioPort 0x33 + result=`i2cget -y ${NUM_FRU_MUX_CHAN2_DEVICE} 0x20 0 2>/dev/null` + err_code=$? + if [ "$err_code" != "0" ]; then + echo "fan tray not exist!" + return + fi + + if [ "${FAN1_ALARM}" == "0" ] && [ "${FAN2_ALARM}" == "0" ]; then + FAN_TRAY=1 + echo "FAN_TRAY${FAN_TRAY}..." + COLOR_SYS_LED="green" + ONOFF_LED="on" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_SYS_LED="amber" + ONOFF_LED="off" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=1 + echo "FAN_TRAY${FAN_TRAY}..." + COLOR_SYS_LED="green" + ONOFF_LED="off" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_SYS_LED="amber" + ONOFF_LED="on" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + if [ "${FAN3_ALARM}" == "0" ] && [ "${FAN4_ALARM}" == "0" ]; then + FAN_TRAY=2 + echo "FAN_TRAY${FAN_TRAY}..." + COLOR_SYS_LED="green" + ONOFF_LED="on" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_SYS_LED="amber" + ONOFF_LED="off" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=2 + echo "FAN_TRAY${FAN_TRAY}..." + COLOR_SYS_LED="green" + ONOFF_LED="off" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_SYS_LED="amber" + ONOFF_LED="on" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + if [ "${FAN5_ALARM}" == "0" ] && [ "${FAN6_ALARM}" == "0" ]; then + FAN_TRAY=3 + echo "FAN_TRAY${FAN_TRAY}..." + COLOR_SYS_LED="green" + ONOFF_LED="on" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_SYS_LED="amber" + ONOFF_LED="off" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=3 + echo "FAN_TRAY${FAN_TRAY}..." + COLOR_SYS_LED="green" + ONOFF_LED="off" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_SYS_LED="amber" + ONOFF_LED="on" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + if [ "${FAN7_ALARM}" == "0" ] && [ "${FAN8_ALARM}" == "0" ]; then + FAN_TRAY=4 + echo "FAN_TRAY${FAN_TRAY}..." + COLOR_SYS_LED="green" + ONOFF_LED="on" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_SYS_LED="amber" + ONOFF_LED="off" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=4 + echo "FAN_TRAY${FAN_TRAY}..." + COLOR_SYS_LED="green" + ONOFF_LED="off" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_SYS_LED="amber" + ONOFF_LED="on" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi +} + +#Set FAN LED +function _i2c_led_fan_status_set { + echo "FAN Status Setup" + #PSU Status set + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan2_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan4_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN6_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan6_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + FAN8_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan8_alarm` + + echo "led_fan setup..." + # all fan ok + if [ "${FAN1_ALARM}" == "0" ] && [ "${FAN2_ALARM}" == "0" ] \ + && [ "${FAN3_ALARM}" == "0" ] && [ "${FAN4_ALARM}" == "0" ] \ + && [ "${FAN5_ALARM}" == "0" ] && [ "${FAN6_ALARM}" == "0" ] \ + && [ "${FAN7_ALARM}" == "0" ] && [ "${FAN8_ALARM}" == "0" ]; then + COLOR_SYS_LED="green" + ONOFF_LED="on" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_led + # all fan fail + elif [ "${FAN1_ALARM}" == "1" ] && [ "${FAN2_ALARM}" == "1" ] \ + && [ "${FAN3_ALARM}" == "1" ] && [ "${FAN4_ALARM}" == "1" ] \ + && [ "${FAN5_ALARM}" == "1" ] && [ "${FAN6_ALARM}" == "1" ] \ + && [ "${FAN7_ALARM}" == "1" ] && [ "${FAN8_ALARM}" == "1" ]; then + COLOR_SYS_LED="green" + ONOFF_LED="off" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_led + # partial fan fail + else + COLOR_SYS_LED="amber" + ONOFF_LED="on" + echo "${COLOR_SYS_LED} ${ONOFF_LED}" + _i2c_fan_led + fi +} + +#Set QSFP Port variable +function _qsfp_port_i2c_var_set { + local port=$1 + case ${port} in + 1|2|3|4|5|6|7|8) + i2cbus=${NUM_MUX1_CHAN4_DEVICE} + regAddr=0x20 + dataAddr=0 + eeprombusbase=${NUM_MUX3_CHAN0_DEVICE} + gpioBase=240 + ;; + 9|10|11|12|13|14|15|16) + i2cbus=${NUM_MUX1_CHAN4_DEVICE} + regAddr=0x20 + dataAddr=1 + eeprombusbase=${NUM_MUX4_CHAN0_DEVICE} + gpioBase=240 + ;; + 17|18|19|20|21|22|23|24) + i2cbus=${NUM_MUX1_CHAN4_DEVICE} + regAddr=0x21 + dataAddr=0 + eeprombusbase=${NUM_MUX5_CHAN0_DEVICE} + gpioBase=$((224 - 16)) + ;; + 25|26|27|28|29|30|31|32) + i2cbus=${NUM_MUX1_CHAN4_DEVICE} + regAddr=0x21 + dataAddr=1 + eeprombusbase=${NUM_MUX6_CHAN0_DEVICE} + gpioBase=$((224 - 16)) + ;; + 33) + i2cbus=${NUM_MUX1_CHAN7_DEVICE} + regAddr=0x27 + dataAddr=0 + gpioBase=145 + ;; + 34) + i2cbus=${NUM_MUX1_CHAN7_DEVICE} + regAddr=0x27 + dataAddr=1 + gpioBase=143 + ;; + *) + echo "Please input 1~34" + ;; + esac +} + +#Set QSFP Port variable +function _qsfp_eeprom_var_set { + local port=$1 + if [ ${port} -lt 33 ]; then + eeprombusidx=$(( ${port} % 8)) + case $eeprombusidx in + 1) + eeprombus=$(( $eeprombusbase + 1 )) + eepromAddr=0x50 + ;; + 2) + eeprombus=$(( $eeprombusbase + 0 )) + eepromAddr=0x50 + ;; + 3) + eeprombus=$(( $eeprombusbase + 3 )) + eepromAddr=0x50 + ;; + 4) + eeprombus=$(( $eeprombusbase + 2 )) + eepromAddr=0x50 + ;; + 5) + eeprombus=$(( $eeprombusbase + 5 )) + eepromAddr=0x50 + ;; + 6) + eeprombus=$(( $eeprombusbase + 4 )) + eepromAddr=0x50 + ;; + 7) + eeprombus=$(( $eeprombusbase + 7 )) + eepromAddr=0x50 + ;; + 0) + eeprombus=$(( $eeprombusbase + 6 )) + eepromAddr=0x50 + ;; + esac + else + case $port in + 33) + eeprombus=${NUM_SFP1_DEVICE} + eepromAddr=0x50 + ;; + 34) + eeprombus=${NUM_SFP2_DEVICE} + eepromAddr=0x50 + ;; + esac + fi +} + +#Get QSFP EEPROM Information +function _i2c_qsfp_eeprom_get { + + _qsfp_port_i2c_var_set ${QSFP_PORT} + + #status: 0 -> Down, 1 -> Up + status=`cat /sys/class/gpio/gpio$(( $(($gpioBase + (${QSFP_PORT} - 1) ^ 1)) ))/value` + echo $status + + if [ $status = 0 ]; then + exit + fi + + _qsfp_eeprom_var_set ${QSFP_PORT} + + cat ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom | hexdump -C +} + +#Init QSFP EEPROM +function _i2c_qsfp_eeprom_init { + echo -n "QSFP EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init 1-32 ports EEPROM + local i + for i in {1..32}; + do + _qsfp_port_i2c_var_set ${i} + + _qsfp_eeprom_var_set ${i} + + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr) ]; then + echo "sff8436 $eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr) ]; then + echo "$eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/delete_device + fi + done + echo "DONE" +} + +#Init Main Board EEPROM +function _i2c_mb_eeprom_init { + echo -n "Main Board EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init CPU EEPROM + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_I801_DEVICE}-0051 ]; then + echo "mb_eeprom 0x51" > ${PATH_I801_DEVICE}/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_I801_DEVICE}-0051 ]; then + echo "0x51" > ${PATH_I801_DEVICE}/delete_device + fi + #Init MB EEPROM + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_I801_DEVICE}-0055 ]; then + echo "mb_eeprom 0x55" > ${PATH_I801_DEVICE}/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_I801_DEVICE}-0055 ]; then + echo "0x55" > ${PATH_I801_DEVICE}/delete_device + fi + echo "DONE" +} + +#Init PSU EEPROM +function _i2c_psu_eeprom_init { + echo -n "PSU EEPROM INIT..." + + ## modprobe eeprom + modprobe eeprom + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init PSU EEPROM + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_FRU_MUX_CHAN1_DEVICE}-0050 ] || \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_FRU_MUX_CHAN0_DEVICE}-0050 ]; then + ## PUS(0) EEPROM + echo "eeprom 0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_FRU_MUX_CHAN1_DEVICE}/new_device + ## PUS(1) EEPROM + echo "eeprom 0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_FRU_MUX_CHAN0_DEVICE}/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_FRU_MUX_CHAN1_DEVICE}-0050 ] || \ + [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_FRU_MUX_CHAN0_DEVICE}-0050 ]; then + ## PUS(0) EEPROM + echo "0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_FRU_MUX_CHAN1_DEVICE}/delete_device + ## PUS(1) EEPROM + echo "0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_FRU_MUX_CHAN0_DEVICE}/delete_device + fi + echo "DONE" +} + +#Init SFP EEPROM +function _i2c_sfp_eeprom_init { + echo -n "SFP EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init 1-32 ports EEPROM + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_SFP1_DEVICE}-0050 ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_SFP2_DEVICE}-0050 ]; then + echo "sff8436 0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_SFP1_DEVICE}/new_device + echo "sff8436 0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_SFP2_DEVICE}/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_SFP1_DEVICE}-0050 ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_SFP2_DEVICE}-0050 ]; then + echo "0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_SFP1_DEVICE}/delete_device + echo "0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_SFP2_DEVICE}/delete_device + fi + echo "DONE" +} + +#Get MotherBoard EEPROM Information +function _i2c_mb_eeprom_get { + echo "=========================================================" + echo "# Description: I2C MB EEPROM Get..." + echo "=========================================================" + + ## MB EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_I801_DEVICE}-0055/eeprom | hexdump -C + echo "done..." +} + +#Get CPU EEPROM Information +function _i2c_cpu_eeprom_get { + echo "=========================================================" + echo "# Description: I2C MB EEPROM Get..." + echo "=========================================================" + + ## MB EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_I801_DEVICE}-0051/eeprom | hexdump -C + echo "done..." +} + +#get QSFP Status +function _i2c_qsfp_status_get { + + _qsfp_port_i2c_var_set ${QSFP_PORT} + + #status: 0 -> Down, 1 -> Up + status=`cat /sys/class/gpio/gpio$(( $(($gpioBase + (${QSFP_PORT} - 1) ^ 1)) ))/value` + echo "status=$status" +} + +#get QSFP Type +function _i2c_qsfp_type_get { + + _qsfp_port_i2c_var_set ${QSFP_PORT} + + _qsfp_eeprom_var_set ${QSFP_PORT} + + #Get QSFP EEPROM info + qsfp_info=$(base64 ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom) + + identifier=$(echo $qsfp_info | base64 -d -i | hexdump -s 128 -n 1 -e '"%x"') + connector=$(echo $qsfp_info | base64 -d -i | hexdump -s 130 -n 1 -e '"%x"') + transceiver=$(echo $qsfp_info | base64 -d -i | hexdump -s 131 -n 1 -e '"%x"') + + echo "identifier=$identifier" + echo "connector=$connector" + echo "transceiver=$transceiver" +} + +#Get Board Version and Type +function _i2c_board_type_get { + boardType=`i2cget -y ${NUM_CPLD_DEVICE} 0x33 0x00` + boardBuildRev=$((($boardType) & 0x03)) + boardHwRev=$((($boardType) >> 2 & 0x03)) + boardId=$((($boardType) >> 4)) + printf "BOARD_ID is 0x%02x, HW Rev %d, Build Rev %d\n" $boardId $boardHwRev $boardBuildRev + +} + +#Get CPLD Version +function _i2c_cpld_version { + cpldRev=`i2cget -y ${NUM_CPLD_DEVICE} 0x33 0x01` + cpldRelease=$((($cpldRev) >> 6 & 0x01)) + cpldVersion=$((($cpldRev) & 0x3F)) + printf "CPLD is %s version(0:RD 1:Release), Revision is 0x%02x\n" $cpldRelease $cpldVersion + +} + +#Set Port LED behavior +function _i2c_port_led_set { + local gy_offset=0x0 + local bl_offset=0x0 + local mask=0x0 + if [ "${QSFP_PORT}" == "" ]; then + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + case ${QSFP_PORT} in + 1|2|3|4) + gy_offset=0x80 + bl_offset=0x90 + ;; + 5|6|7|8) + gy_offset=0x81 + bl_offset=0x90 + ;; + 9|10|11|12) + gy_offset=0x82 + bl_offset=0x91 + ;; + 13|14|15|16) + gy_offset=0x83 + bl_offset=0x91 + ;; + 17|18|19|20) + gy_offset=0x84 + bl_offset=0x92 + ;; + 21|22|23|24) + gy_offset=0x85 + bl_offset=0x92 + ;; + 25|26|27|28) + gy_offset=0x86 + bl_offset=0x93 + ;; + 29|30|31|32) + gy_offset=0x87 + bl_offset=0x93 + ;; + 33) + gy_offset=0x88 + bl_offset=0x94 + mask=0x01 + ;; + 34) + gy_offset=0x88 + bl_offset=0x94 + mask=0x02 + ;; + *) + echo "Please input 1~34" + ;; + esac + + #Set green/yellow/off + if [ ${QSFP_PORT} -lt 33 ]; then + mask=$(( 0x3 << $(( $((${QSFP_PORT} - 0x1)) % 0x4 )) * 0x2 )) + elif [ ${QSFP_PORT} = 33 ]; then + value=1 + elif [ ${QSFP_PORT} = 34 ]; then + value=2 + fi + + if [ ${QSFP_PORT} -lt 33 ]; then + if [ "${COLOR_PORT_LED}" == "green" ]; then + i2cset -m $mask -y -r ${NUM_CPLD_DEVICE} 0x33 ${gy_offset} 0x55 + elif [ "${COLOR_PORT_LED}" == "yellow" ]; then + i2cset -m $mask -y -r ${NUM_CPLD_DEVICE} 0x33 ${gy_offset} 0xaa + elif [ "${COLOR_PORT_LED}" == "off" ]; then + i2cset -m $mask -y -r ${NUM_CPLD_DEVICE} 0x33 ${gy_offset} 0x00 + return + fi + elif [ ${QSFP_PORT} -ge 33 ]; then + if [ "${COLOR_PORT_LED}" == "green" ] || + [ "${COLOR_PORT_LED}" == "yellow" ]; then + i2cset -m $mask -y -r ${NUM_CPLD_DEVICE} 0x33 ${gy_offset} $value + elif [ "${COLOR_PORT_LED}" == "off" ]; then + i2cset -m $mask -y -r ${NUM_CPLD_DEVICE} 0x33 ${gy_offset} $((! ${value} )) + return + fi + fi + + #Set Blink/Unblink + if [ ${QSFP_PORT} -lt 33 ]; then + mask=$(( 0x1 << $(( $((${QSFP_PORT} - 0x1)) % 0x8 )) )) + elif [ ${QSFP_PORT} = 33 ]; then + value=1 + elif [ ${QSFP_PORT} = 34 ]; then + value=2 + fi + + if [ "${BLINK_LED}" == "blink" ]; then + i2cset -m $mask -y -r ${NUM_CPLD_DEVICE} 0x33 ${bl_offset} 0x00 + elif [ "${BLINK_LED}" == "noblink" ]; then + i2cset -m $mask -y -r ${NUM_CPLD_DEVICE} 0x33 ${bl_offset} 0xff + fi + +} + +#Get PSU EEPROM Information +function _i2c_psu_eeprom_get { + echo "=========================================================" + echo "# Description: I2C PSU EEPROM Get..." + echo "=========================================================" + + ## PUS(0) EEPROM + echo "========PSU1=========" + cat ${PATH_SYS_I2C_DEVICES}/${NUM_FRU_MUX_CHAN1_DEVICE}-0050/eeprom | hexdump -C + + ## PUS(1) EEPROM + echo "========PSU2=========" + cat ${PATH_SYS_I2C_DEVICES}/${NUM_FRU_MUX_CHAN0_DEVICE}-0050/eeprom | hexdump -C + + echo "done..." +} + +#Set System Status LED +function _i2c_sys_led { + + if [ "${COLOR_SYS_LED}" == "green" ]; then + # set sys_led_g (0.7) = 1 + output_reg=2 + mask=0x01 + value=0x01 + elif [ "${COLOR_SYS_LED}" == "amber" ]; then + # set sys_led_g (0.7) = 0 + output_reg=2 + mask=0x01 + value=0x00 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + #apply to io expander + i2cset -m ${mask} -y ${NUM_MAIN_MUX_CHAN1_DEVICE} 0x75 2 ${value} + echo "Done" + +} + +#Set FAN Tray LED +function _i2c_fan_tray_led { + case ${FAN_TRAY} in + 1) + i2cAddr=0x20 + ioPort=2 + if [ "${COLOR_SYS_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_SYS_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 2) + i2cAddr=0x20 + ioPort=2 + if [ "${COLOR_SYS_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_SYS_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + 3) + i2cAddr=0x20 + ioPort=3 + if [ "${COLOR_SYS_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_SYS_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 4) + i2cAddr=0x20 + ioPort=3 + if [ "${COLOR_SYS_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_SYS_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + *) + echo "Please input 1~4" + exit + ;; + esac + + if [ "${COLOR_SYS_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m $mask -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} $i2cAddr $ioPort 0x33 + elif [ "${COLOR_SYS_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m $mask -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} $i2cAddr $ioPort 0x00 + elif [ "${COLOR_SYS_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m $mask -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} $i2cAddr $ioPort 0x33 + elif [ "${COLOR_SYS_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m $mask -y -r ${NUM_FRU_MUX_CHAN2_DEVICE} $i2cAddr $ioPort 0x00 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set FAN LED +function _i2c_fan_led { + if [ "${COLOR_SYS_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x06 -y -r ${NUM_MAIN_MUX_CHAN1_DEVICE} 0x75 2 0x02 + elif [ "${COLOR_SYS_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x06 -y -r ${NUM_MAIN_MUX_CHAN1_DEVICE} 0x75 2 0x00 + elif [ "${COLOR_SYS_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x06 -y -r ${NUM_MAIN_MUX_CHAN1_DEVICE} 0x75 2 0x06 + elif [ "${COLOR_SYS_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x06 -y -r ${NUM_MAIN_MUX_CHAN1_DEVICE} 0x75 2 0x00 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + + +#Get PSU Status +function _i2c_psu_status { + psu2PwGood=`cat /sys/class/gpio/gpio96/value` # PSU0_PWROK (0.0) + psu2Exist=`cat /sys/class/gpio/gpio97/value` # PSU0_PRSNT_L (0.1) + + psu1PwGood=`cat /sys/class/gpio/gpio99/value` # PSU1_PWROK (0.3) + psu1Exist=`cat /sys/class/gpio/gpio100/value` # PSU1_PRSNT_L (0.4) + printf "PSU1 Exist:%d PSU1 PW Good:%d\n" $psu1Exist $psu1PwGood + printf "PSU2 Exist:%d PSU2 PW Good:%d\n" $psu2Exist $psu2PwGood +} + + +#Main Function +function _main { + start_time_str=`date` + start_time_sec=$(date +%s) + + if [ "${EXEC_FUNC}" == "help" ]; then + _help + elif [ "${EXEC_FUNC}" == "i2c_init" ]; then + _i2c_init + elif [ "${EXEC_FUNC}" == "i2c_deinit" ]; then + _i2c_deinit + elif [ "${EXEC_FUNC}" == "i2c_temp_init" ]; then + _i2c_temp_init + elif [ "${EXEC_FUNC}" == "i2c_fan_init" ]; then + _i2c_fan_init + elif [ "${EXEC_FUNC}" == "i2c_volmon_init" ]; then + _i2c_volmon_init + elif [ "${EXEC_FUNC}" == "i2c_io_exp_init" ]; then + _i2c_io_exp_init + elif [ "${EXEC_FUNC}" == "i2c_gpio_init" ]; then + _i2c_gpio_init + elif [ "${EXEC_FUNC}" == "i2c_gpio_deinit" ]; then + _i2c_gpio_deinit + elif [ "${EXEC_FUNC}" == "i2c_temp_init" ]; then + _i2c_temp_init + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_get" ]; then + _i2c_mb_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_cpu_eeprom_get" ]; then + _i2c_cpu_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_psu_eeprom_get" ]; then + _i2c_psu_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_get" ]; then + _i2c_qsfp_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_init" ]; then + _i2c_qsfp_eeprom_init ${QSFP_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_sfp_eeprom_init" ]; then + _i2c_sfp_eeprom_init ${QSFP_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_init" ]; then + _i2c_mb_eeprom_init ${MB_EEPROM_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_psu_eeprom_init" ]; then + _i2c_psu_eeprom_init ${MB_EEPROM_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_qsfp_status_get" ]; then + _i2c_qsfp_status_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_type_get" ]; then + _i2c_qsfp_type_get + elif [ "${EXEC_FUNC}" == "i2c_led_fan_status_set" ]; then + _i2c_led_fan_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_tray_status_set" ]; then + _i2c_led_fan_tray_status_set + elif [ "${EXEC_FUNC}" == "i2c_sys_led" ]; then + _i2c_sys_led + elif [ "${EXEC_FUNC}" == "i2c_fan_led" ]; then + _i2c_fan_led + elif [ "${EXEC_FUNC}" == "i2c_fan_tray_led" ]; then + _i2c_fan_tray_led + elif [ "${EXEC_FUNC}" == "i2c_board_type_get" ]; then + _i2c_board_type_get + elif [ "${EXEC_FUNC}" == "i2c_cpld_version" ]; then + _i2c_cpld_version + elif [ "${EXEC_FUNC}" == "i2c_psu_status" ]; then + _i2c_psu_status + elif [ "${EXEC_FUNC}" == "i2c_port_led_set" ]; then + _i2c_port_led_set + elif [ "${EXEC_FUNC}" == "i2c_test_all" ]; then + _i2c_init + _i2c_temp_init + _i2c_fan_init + _i2c_io_exp_init + _i2c_psu_eeprom_get + _i2c_mb_eeprom_get + _i2c_cpu_eeprom_get + _i2c_board_type_get + _i2c_cpld_version + _i2c_psu_status + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + end_time_str=`date` + end_time_sec=$(date +%s) + diff_time=$[ ${end_time_sec} - ${start_time_sec} ] + echo "Start Time: ${start_time_str} (${start_time_sec})" + echo "End Time : ${end_time_str} (${end_time_sec})" + echo "Total Execution Time: ${diff_time} sec" + + echo "done!!!" +} + +_main diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/qsfp_monitor.sh b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/qsfp_monitor.sh new file mode 100755 index 000000000000..249f179216a6 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/qsfp_monitor.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=3 +I2C_UTILS="/usr/sbin/i2c_utils.sh" +QSFP_SI_SCRIPT="/usr/sbin/qsfp_si_cfg.sh" +QSFP_ARRAY=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + +#QSFP SI monitor +function _qsfp_si_monitor { + local i + local status + for i in {0..31}; + do + status=`${I2C_UTILS} i2c_qsfp_status_get $(expr $i + 1) | egrep '^status=.*$' | sed -e 's/status=//g'` + if [ "${status}" == "1" ]; then + _qsfp_type_check $i + fi + done +} + +#QSFP type +function _qsfp_type_check { + local port=$1 + local qsfp_type=`${I2C_UTILS} i2c_qsfp_type_get $(expr $port + 1)` + local identifier=`echo "$qsfp_type" | grep '^identifier=.*$' | sed -e 's/identifier=//g'` + if [ "${identifier}" == "11" ]; then + connector=`echo "$qsfp_type" | grep '^connector=.*$' | sed -e 's/connector=//g'` + case ${connector} in + 21|23) + #DAC + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to DAC" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} dac $port >/dev/null + fi + ;; + *) + #Optical + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to Optical" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} optical $port >/dev/null + fi + ;; + esac + fi +} + +#Docker exist check +function _docker_swss_check { + while true + do + # Check if syncd starts + result=`docker exec -i swss bash -c "echo -en \"SELECT 1\\nHLEN HIDDEN\" | redis-cli | sed -n 2p"` #TBD FIX ME + if [ "$result" == "3" ]; then + return + fi + sleep $INTERVAL + done +} + +#Docker exist check +function _qsfp_si_cfg_script_check { + + if [ -f ${QSFP_SI_SCRIPT} ] && [ -x ${QSFP_SI_SCRIPT} ]; then + echo "SI Script exists. Start monitor." + return + else + echo "SI Script not exist. Exit monitor." + exit + fi +} + +# main function +function _main { + #Check SI Script + _qsfp_si_cfg_script_check + #Check docker swss is running + _docker_swss_check + while true + do + _qsfp_si_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main + diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/s9180_32x_monitor.sh b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/s9180_32x_monitor.sh new file mode 100755 index 000000000000..c110bdeaaf04 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/s9180_32x_monitor.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=5 +I2C_UTILS="/usr/sbin/i2c_utils.sh" + + +# TBD: LED status monitor +function _led_monitor { + ${I2C_UTILS} i2c_led_fan_status_set >/dev/null + ${I2C_UTILS} i2c_led_fan_tray_status_set >/dev/null +} + +# main function +function _main { + while true + do + #PSU controlled by dummy board, + #but fan LED and fan tray LED must controlled by this service + _led_monitor + + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/LICENSE b/platform/barefoot/sonic-platform-modules-wnc-osw1800/LICENSE new file mode 100644 index 000000000000..676cdeec726b --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2016 Microsoft, Inc + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/MAINTAINERS b/platform/barefoot/sonic-platform-modules-wnc-osw1800/MAINTAINERS new file mode 100644 index 000000000000..a578b60e24de --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/MAINTAINERS @@ -0,0 +1,7 @@ +# This file describes the maintainers for sonic-platform-modules-wnc-osw1800 +# See the SONiC project governance document for more information + +Name = "WNC" +Email = "wnc@wnc.com.tw" +Github = barefootnetworks +Mailinglist = wnc@wnc.com.tw diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/README.md b/platform/barefoot/sonic-platform-modules-wnc-osw1800/README.md new file mode 100644 index 000000000000..707c1068d6e6 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/README.md @@ -0,0 +1,2 @@ +# sonic-platform-modules-wnc-osw1800 +Device drivers for support of BFN platform for the SONiC project diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/changelog b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/changelog new file mode 100644 index 000000000000..466378b892d1 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/changelog @@ -0,0 +1,5 @@ +platform-modules-wnc-osw1800 (1.0) unstable; urgency=low + + * Initial release + + -- WNC Mon, 11 Nov 2015 11:11:11 -0800 diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/compat b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/compat new file mode 100644 index 000000000000..45a4fb75db86 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/compat @@ -0,0 +1 @@ +8 diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/control b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/control new file mode 100644 index 000000000000..6070cf9ad1fc --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/control @@ -0,0 +1,12 @@ +Source: platform-modules-wnc-osw1800 +Section: main +Priority: extra +Maintainer: WNC +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-wnc-osw1800 +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/copyright b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/copyright new file mode 100644 index 000000000000..ade42b7aa75a --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/copyright @@ -0,0 +1,15 @@ +Provides linux kernel driver for BF PCIe devices + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/rules b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/rules new file mode 100755 index 000000000000..644ab1ade433 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/rules @@ -0,0 +1,38 @@ +#!/usr/bin/make -f + +export INSTALL_MOD_DIR:=extra + +PACKAGE_NAME := platform-modules-wnc-osw1800 +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MODULE_SRC := $(shell pwd)/modules +SCRIPT_SRC := $(shell pwd)/scripts +SERVICE_SRC := $(shell pwd)/service + +%: + dh $@ + +override_dh_auto_build: + make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + +override_dh_auto_install: + dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR) + cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) + dh_installdirs -p$(PACKAGE_NAME) usr/local/bin + cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin + dh_installdirs -p$(PACKAGE_NAME) /etc/systemd/system + cp -r $(SERVICE_SRC)/* debian/$(PACKAGE_NAME)/etc/systemd/system + dh_installdirs -p$(PACKAGE_NAME) /etc/systemd/system/multi-user.target.wants + ln -s ../device_node.service debian/$(PACKAGE_NAME)/etc/systemd/system/multi-user.target.wants/device_node.service + ln -s ../driver_load.service debian/$(PACKAGE_NAME)/etc/systemd/system/multi-user.target.wants/driver_load.service + +override_dh_usrlocal: + +override_dh_pysupport: + +override_dh_clean: + dh_clean + rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd + rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order + rm -rf $(MODULE_SRC)/.tmp_versions + diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/Makefile b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/Makefile new file mode 100644 index 000000000000..29b904dd3232 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/Makefile @@ -0,0 +1,6 @@ +obj-m := bf_kdrv.o +obj-m += bf_tun.o +obj-m += i2c-mcp2221.o +obj-m += wnc_cpld.o +obj-m += wnc_cpld3.o +obj-m += wnc_eeprom.o diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c new file mode 100644 index 000000000000..fd66ad09493a --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c @@ -0,0 +1,1254 @@ +/******************************************************************************* + * BAREFOOT NETWORKS CONFIDENTIAL & PROPRIETARY + * + * Copyright (c) 2015-2016 Barefoot Networks, Inc. + + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains the property of + * Barefoot Networks, Inc. and its suppliers, if any. The intellectual and + * technical concepts contained herein are proprietary to Barefoot Networks, + * Inc. + * and its suppliers and may be covered by U.S. and Foreign Patents, patents in + * process, and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from + * Barefoot Networks, Inc. + * + * No warranty, explicit or implicit is provided, unless granted under a + * written agreement with Barefoot Networks, Inc. + * + * $Id: $ + * + ******************************************************************************/ +/** + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2015 Barefoot Networks. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the... + * + **/ + +/* bf_drv kernel module + * + * This is kernel mode driver for Tofino chip. + * Provides user space mmap service and user space "wait for interrupt" + * and "enable interrupt" services. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + #include +#else + #include +#endif + +#include +#include +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) +//#error unsupported linux kernel version +#endif + +/* TBD: Need to build with CONFIG_PCI_MSI */ +extern int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); +extern int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, int minvec, int maxvec); + +#define PCI_VENDOR_ID_BF 0x1d1c +#define TOFINO_DEV_ID_A0 0x01 +#define TOFINO_DEV_ID_B0 0x10 + +#ifndef PCI_MSIX_ENTRY_SIZE +#define PCI_MSIX_ENTRY_SIZE 16 +#define PCI_MSIX_ENTRY_LOWER_ADDR 0 +#define PCI_MSIX_ENTRY_UPPER_ADDR 4 +#define PCI_MSIX_ENTRY_DATA 8 +#define PCI_MSIX_ENTRY_VECTOR_CTRL 12 +#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 +#endif + +#define BF_CLASS_NAME "bf" +#define BF_MAX_DEVICE_CNT 256 +#define BF_INTR_MODE_NONE_NAME "none" +#define BF_INTR_MODE_LEGACY_NAME "legacy" +#define BF_INTR_MODE_MSI_NAME "msi" +#define BF_INTR_MODE_MSIX_NAME "msix" +#define BF_MAX_BAR_MAPS 6 +#define BF_MSIX_ENTRY_CNT 128 /* TBD make it 512 */ +#define BF_MSI_ENTRY_CNT 2 + +/* interrupt mode */ +enum bf_intr_mode { + BF_INTR_MODE_NONE = 0, + BF_INTR_MODE_LEGACY, + BF_INTR_MODE_MSI, + BF_INTR_MODE_MSIX +}; + +/* device memory */ +struct bf_dev_mem { + const char *name; + phys_addr_t addr; + resource_size_t size; + void __iomem *internal_addr; +}; + +struct bf_listener { + struct bf_pci_dev *bfdev; + s32 event_count[BF_MSIX_ENTRY_CNT]; + int minor; + struct bf_listener *next; +}; + +/* device information */ +struct bf_dev_info { + struct module *owner; + struct device *dev; + int minor; + atomic_t event[BF_MSIX_ENTRY_CNT]; + wait_queue_head_t wait; + const char *version; + struct bf_dev_mem mem[BF_MAX_BAR_MAPS]; + struct msix_entry *msix_entries; + long irq; /* first irq vector */ + int num_irq; /* number of irq vectors */ + unsigned long irq_flags;/* sharable ?? */ + int pci_error_state; /* was there a pci bus error */ +}; + +/* cookie to be passed to IRQ handler, useful especially with MSIX */ +struct bf_int_vector { + struct bf_pci_dev *bf_dev; + int int_vec_offset; +}; + + +/** + * A structure describing the private information for a BF pcie device. + */ +struct bf_pci_dev { + struct bf_dev_info info; + struct pci_dev *pdev; + enum bf_intr_mode mode; + u8 instance; + char name[16]; + struct bf_int_vector bf_int_vec[BF_MSIX_ENTRY_CNT]; + struct bf_listener *listener_head; /* head of a singly linked list of + listeners */ +}; + +/* Keep any global information here that must survive even after the + * bf_pci_dev is free-ed up. + */ +struct bf_global { + struct bf_pci_dev *bfdev ; + struct cdev *bf_cdev; + struct fasync_struct *async_queue; +}; + +static int bf_major; +static int bf_minor[BF_MAX_DEVICE_CNT] = {0}; +static struct class *bf_class = NULL; +static char *intr_mode = NULL; +static enum bf_intr_mode bf_intr_mode_default = BF_INTR_MODE_MSI; +static spinlock_t bf_nonisr_lock; +/* dev->minor should index into this array */ +static struct bf_global bf_global[BF_MAX_DEVICE_CNT]; + +static void bf_add_listener(struct bf_pci_dev *bfdev, + struct bf_listener *listener) +{ + struct bf_listener **cur_listener = &bfdev->listener_head; + + if (!listener) { + return; + } + spin_lock(&bf_nonisr_lock); + + while (*cur_listener) { + cur_listener = &((*cur_listener)->next); + } + *cur_listener = listener; + listener->next = NULL; + + spin_unlock(&bf_nonisr_lock); +} + +static void bf_remove_listener(struct bf_pci_dev *bfdev, + struct bf_listener *listener) +{ + struct bf_listener **cur_listener = &bfdev->listener_head; + + /* in case of certain error conditions, this function might be called after bf_pci_remove() + */ + if (!bfdev || !listener) { + return; + } + spin_lock(&bf_nonisr_lock); + + if (*cur_listener == listener) { + *cur_listener = listener->next; + } else { + while (*cur_listener) { + if ((*cur_listener)->next == listener) { + (*cur_listener)->next = listener->next; + break; + } + cur_listener = &((*cur_listener)->next); + } + listener->next = NULL; + } + + spin_unlock(&bf_nonisr_lock); +} + +/* a pool of minor numbers is maintained */ +/* return the first available minor number */ +static int bf_get_next_minor_no(int *minor) +{ + int i; + + spin_lock(&bf_nonisr_lock); + for(i = 0; i < BF_MAX_DEVICE_CNT; i++) { + if (bf_minor[i] == 0) { + *minor = i; + bf_minor[i] = 1; /* mark it as taken */ + spin_unlock(&bf_nonisr_lock); + return 0; + } + } + *minor = -1; + spin_unlock(&bf_nonisr_lock); + return -1; +} + +/* return a minor number back to the pool for recycling */ +static int bf_return_minor_no(int minor) +{ + int err; + + spin_lock(&bf_nonisr_lock); + if (bf_minor[minor] == 0) { /* was already returned */ + err = -1; /* don't change anything, but return error */ + } else { + bf_minor[minor] = 0; /* mark it as available */ + err = 0; + } + spin_unlock(&bf_nonisr_lock); + return err; +} + +static inline struct bf_pci_dev *bf_get_pci_dev(struct bf_dev_info *info) +{ + return container_of(info, struct bf_pci_dev, info); +} + +/* + * It masks the msix on/off of generating MSI-X messages. + */ +static void +bf_msix_mask_irq(struct msi_desc *desc, int32_t state) +{ + u32 mask_bits = desc->masked; + unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_VECTOR_CTRL; + + if (state != 0) + mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT; + else + mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT; + + if (mask_bits != desc->masked) { + writel(mask_bits, desc->mask_base + offset); + readl(desc->mask_base); + desc->masked = mask_bits; + } +} + +/** + * irqcontrol can be used to disable/enable interrupt from user space processes. + * + * @param bf_dev + * pointer to bf_pci_dev + * @param irq_state + * state value. 1 to enable interrupt, 0 to disable interrupt. + * + * @return + * - On success, 0. + * - On failure, a negative value. + */ +static int +bf_pci_irqcontrol(struct bf_pci_dev *bfdev, s32 irq_state) +{ + struct pci_dev *pdev = bfdev->pdev; + + pci_cfg_access_lock(pdev); + if (bfdev->mode == BF_INTR_MODE_LEGACY) + pci_intx(pdev, !!irq_state); + + else if (bfdev->mode == BF_INTR_MODE_MSIX) { + struct msi_desc *desc; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + list_for_each_entry(desc, &pdev->msi_list, list) + bf_msix_mask_irq(desc, irq_state); +#else + for_each_pci_msi_entry(desc, pdev) + bf_msix_mask_irq(desc, irq_state); +#endif + } + pci_cfg_access_unlock(pdev); + + return 0; +} + +/** + * interrupt handler which will check if the interrupt is from the right + * device. If so, disable it here and will be enabled later. + */ +static irqreturn_t bf_pci_irqhandler(int irq, struct bf_pci_dev *bfdev) +{ + /* Legacy mode need to mask in hardware */ + if (bfdev->mode == BF_INTR_MODE_LEGACY && + !pci_check_and_mask_intx(bfdev->pdev)) + return IRQ_NONE; + + /* NOTE : if bfdev->info.pci_error_state == 1, then do not access the + * device and return IRQ_NOTHANDLED. + */ + /* Message signal mode, no share IRQ and automasked */ + return IRQ_HANDLED; +} + +/* Remap pci resources described by bar #pci_bar */ +static int +bf_pci_setup_iomem(struct pci_dev *dev, struct bf_dev_info *info, + int n, int pci_bar, const char *name) +{ + unsigned long addr, len; + void *internal_addr; + + if (sizeof(info->mem) / sizeof(info->mem[0]) <= n) + return -EINVAL; + + addr = pci_resource_start(dev, pci_bar); + len = pci_resource_len(dev, pci_bar); + if (addr == 0 || len == 0) + return -1; + internal_addr = pci_ioremap_bar(dev, pci_bar); + if (internal_addr == NULL) + return -1; + info->mem[n].name = name; + info->mem[n].addr = addr; + info->mem[n].internal_addr = internal_addr; + info->mem[n].size = len; + return 0; +} + +/* Unmap previously ioremap'd resources */ +static void +bf_pci_release_iomem(struct bf_dev_info *info) +{ + int i; + + for (i = 0; i < BF_MAX_BAR_MAPS; i++) { + if (info->mem[i].internal_addr) + iounmap(info->mem[i].internal_addr); + } +} + +static int +bf_setup_bars(struct pci_dev *dev, struct bf_dev_info *info) +{ + int i, iom, ret; + unsigned long flags; + static const char *bar_names[BF_MAX_BAR_MAPS] = { + "BAR0", "BAR1", "BAR2", "BAR3", "BAR4", "BAR5", + }; + + iom = 0; + + for (i = 0; i < BF_MAX_BAR_MAPS; i++) { + if (pci_resource_len(dev, i) != 0 && + pci_resource_start(dev, i) != 0) { + flags = pci_resource_flags(dev, i); + if (flags & IORESOURCE_MEM) { + ret = bf_pci_setup_iomem(dev, info, iom, i, bar_names[i]); + if (ret != 0) + return ret; + iom++; + } + } + } + return (iom != 0) ? ret : -ENOENT; +} + +static irqreturn_t bf_interrupt(int irq, void *bfdev_id) +{ + struct bf_pci_dev *bfdev = ((struct bf_int_vector *)bfdev_id)->bf_dev; + int vect_off = ((struct bf_int_vector *)bfdev_id)->int_vec_offset; + + irqreturn_t ret = bf_pci_irqhandler(irq, bfdev); + + if (ret == IRQ_HANDLED) + atomic_inc(&(bfdev->info.event[vect_off])); + + return ret; +} + +static unsigned int bf_poll(struct file *filep, poll_table *wait) +{ + struct bf_listener *listener = (struct bf_listener *)filep->private_data; + struct bf_pci_dev *bfdev = listener->bfdev; + int i; + + if (!bfdev) { + return -ENODEV; + } + if (!bfdev->info.irq) + return -EIO; + + poll_wait(filep, &bfdev->info.wait, wait); + + for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) + if (listener->event_count[i] != atomic_read(&bfdev->info.event[i])) + return POLLIN | POLLRDNORM; + return 0; +} + +static int bf_find_mem_index(struct vm_area_struct *vma) +{ + struct bf_pci_dev *bfdev = vma->vm_private_data; + if (vma->vm_pgoff < BF_MAX_BAR_MAPS) { + if (bfdev->info.mem[vma->vm_pgoff].size == 0) + return -1; + return (int)vma->vm_pgoff; + } + return -1; +} + +static const struct vm_operations_struct bf_physical_vm_ops = { +#ifdef CONFIG_HAVE_IOREMAP_PROT + .access = generic_access_phys, +#endif +}; + +static int bf_mmap_physical(struct vm_area_struct *vma) +{ + struct bf_pci_dev *bfdev = vma->vm_private_data; + int bar = bf_find_mem_index(vma); + struct bf_dev_mem *mem; + if (bar < 0) + return -EINVAL; + + mem = bfdev->info.mem + bar; + + if (mem->addr & ~PAGE_MASK) + return -ENODEV; + if (vma->vm_end - vma->vm_start > mem->size) + return -EINVAL; + + vma->vm_ops = &bf_physical_vm_ops; + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + + /* + * We cannot use the vm_iomap_memory() helper here, + * because vma->vm_pgoff is the map index we looked + * up above in bf_find_mem_index(), rather than an + * actual page offset into the mmap. + * + * So we just do the physical mmap without a page + * offset. + */ + return remap_pfn_range(vma, vma->vm_start, mem->addr >> PAGE_SHIFT, + vma->vm_end - vma->vm_start, vma->vm_page_prot); +} + +static int bf_mmap(struct file *filep, struct vm_area_struct *vma) +{ + struct bf_listener *listener = filep->private_data; + struct bf_pci_dev *bfdev = listener->bfdev; + int bar; + unsigned long requested_pages, actual_pages; + + if (!bfdev) { + return -ENODEV; + } + if (vma->vm_end < vma->vm_start) + return -EINVAL; + + vma->vm_private_data = bfdev; + + bar = bf_find_mem_index(vma); + if (bar < 0) + return -EINVAL; + + requested_pages = vma_pages(vma); + actual_pages = ((bfdev->info.mem[bar].addr & ~PAGE_MASK) + + bfdev->info.mem[bar].size + PAGE_SIZE -1) >> PAGE_SHIFT; + if (requested_pages > actual_pages) + return -EINVAL; + + return bf_mmap_physical(vma); +} + +static int bf_fasync(int fd, struct file *filep, int mode) +{ + int minor; + + if (!filep->private_data) { + return (-EINVAL); + } + minor = ((struct bf_listener *)filep->private_data)->minor; + if (minor >= BF_MAX_DEVICE_CNT) { + return (-EINVAL); + } + if (mode == 0 && &bf_global[minor].async_queue == NULL) { + return 0; /* nothing to do */ + } + return (fasync_helper(fd, filep, mode, &bf_global[minor].async_queue)); +} + +static int bf_open(struct inode *inode, struct file *filep) +{ + struct bf_pci_dev *bfdev; + struct bf_listener *listener; + int i; + + bfdev = bf_global[iminor(inode)].bfdev; + listener = kmalloc(sizeof(*listener), GFP_KERNEL); + if (listener) { + listener->bfdev = bfdev; + listener->minor = bfdev->info.minor; + listener->next = NULL; + bf_add_listener(bfdev, listener); + for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) + listener->event_count[i] = atomic_read(&bfdev->info.event[i]); + filep->private_data = listener; + return 0; + } else { + return(-ENOMEM); + } +} + +static int bf_release(struct inode *inode, struct file *filep) +{ + struct bf_listener *listener = filep->private_data; + + bf_fasync(-1, filep, 0); /* empty any process id in the notification list */ + if (listener->bfdev) { + bf_remove_listener(listener->bfdev, listener); + } + kfree(listener); + return 0; +} + +/* user space support: make read() system call after poll() of select() */ +static ssize_t bf_read(struct file *filep, char __user *buf, + size_t count, loff_t *ppos) +{ + struct bf_listener *listener = filep->private_data; + struct bf_pci_dev *bfdev = listener->bfdev; + int retval, event_count[BF_MSIX_ENTRY_CNT]; + int i, mismatch_found = 0; /* OR of per vector mismatch */ + unsigned char cnt_match[BF_MSIX_ENTRY_CNT]; /* per vector mismatch */ + + if (!bfdev) { + return -ENODEV; + } + /* irq must be setup for read() to work */ + if (!bfdev->info.irq) + return -EIO; + + /* ensure that there is enough space on user buffer for the given interrupt + * mode */ + if (bfdev->mode == BF_INTR_MODE_MSIX) { + if (count < sizeof(s32)*BF_MSIX_ENTRY_CNT) + return -EINVAL; + count = sizeof(s32)*BF_MSIX_ENTRY_CNT; + } else if (bfdev->mode == BF_INTR_MODE_MSI) { + if (count < sizeof(s32)*BF_MSI_ENTRY_CNT) + return -EINVAL; + count = sizeof(s32)*BF_MSI_ENTRY_CNT; + } else { + if (count < sizeof(s32)) + return -EINVAL; + count = sizeof(s32); + } + + do { + set_current_state(TASK_INTERRUPTIBLE); + + for (i = 0; i < (count/sizeof(s32)); i++) { + event_count[i] = atomic_read(&(bfdev->info.event[i])); + if (event_count[i] != listener->event_count[i]) { + mismatch_found |= 1; + cnt_match[i] = 1; + } else { + event_count[i] = 0; + cnt_match[i] = 0; + } + } + if (mismatch_found) { + __set_current_state(TASK_RUNNING); + if (copy_to_user(buf, &event_count, count)) + retval = -EFAULT; + else { /* adjust the listener->event_count; */ + for (i = 0 ; i < (count/sizeof(s32)); i++) { + if (cnt_match[i]) { + listener->event_count[i] = event_count[i]; + } + } + retval = count; + } + break; + } + + if (filep->f_flags & O_NONBLOCK) { + retval = -EAGAIN; + break; + } + + if (signal_pending(current)) { + retval = -ERESTARTSYS; + break; + } + schedule(); + } while (1); + + __set_current_state(TASK_RUNNING); + + return retval; +} + +/* user space is supposed to call this after it is done with interrupt + * processing + */ +static ssize_t bf_write(struct file *filep, const char __user *buf, + size_t count, loff_t *ppos) +{ + struct bf_listener *listener = filep->private_data; + struct bf_pci_dev *bfdev = listener->bfdev; + ssize_t ret; + s32 int_en; + + if (!bfdev || !bfdev->info.irq) + return -EIO; + + if (count != sizeof(s32)) + return -EINVAL; + + if (copy_from_user(&int_en, buf, count)) + return -EFAULT; + + /* clear pci_error_state */ + bfdev->info.pci_error_state = 0; + + ret = bf_pci_irqcontrol(bfdev, int_en); + + return ret ? ret : sizeof(s32); +} + +static const struct file_operations bf_fops = { + .owner = THIS_MODULE, + .open = bf_open, + .release = bf_release, + .read = bf_read, + .write = bf_write, + .mmap = bf_mmap, + .poll = bf_poll, + .fasync = bf_fasync, +}; + +static int bf_major_init(struct bf_pci_dev *bfdev, int minor) +{ + struct cdev *cdev; + static const char name[] = "bf"; + dev_t bf_dev = 0; + int result; + + result = alloc_chrdev_region(&bf_dev, 0, BF_MAX_DEVICE_CNT, name); + if (result) + return result; + + result = -ENOMEM; + cdev = cdev_alloc(); + if (!cdev) { + goto fail_dev_add; + } + cdev->ops = &bf_fops; + cdev->owner = THIS_MODULE; + kobject_set_name(&cdev->kobj, "%s", name); + result = cdev_add(cdev, bf_dev, BF_MAX_DEVICE_CNT); + + if (result) + goto fail_dev_add; + + bf_major = MAJOR(bf_dev); + bf_global[minor].bf_cdev = cdev; + return 0; + +fail_dev_add: + unregister_chrdev_region(bf_dev, BF_MAX_DEVICE_CNT); + return result; +} + +static void bf_major_cleanup(struct bf_pci_dev *bfdev, int minor) +{ + unregister_chrdev_region(MKDEV(bf_major, 0), BF_MAX_DEVICE_CNT); + cdev_del(bf_global[minor].bf_cdev); +} + +static int bf_init_cdev(struct bf_pci_dev *bfdev, int minor) +{ + int ret; + ret = bf_major_init(bfdev, minor); + if (ret) + return ret; + + bf_class = class_create(THIS_MODULE, BF_CLASS_NAME); + if (!bf_class) { + printk(KERN_ERR "create_class failed for bf_dev\n"); + ret = -ENODEV; + goto err_class_register; + } + return 0; + +err_class_register: + bf_major_cleanup(bfdev, minor); + return ret; +} + +static void bf_remove_cdev(struct bf_pci_dev *bfdev) +{ + class_destroy(bf_class); + bf_major_cleanup(bfdev, bfdev->info.minor); +} + + +/** + * bf_register_device - register a new userspace mem device + * @parent: parent device + * @bfdev: bf pci device + * + * returns zero on success or a negative error code. + */ +int bf_register_device(struct device *parent, struct bf_pci_dev *bfdev) +{ + struct bf_dev_info *info = &bfdev->info; + int i, j, ret = 0; + int minor; + + if (!parent || !info || !info->version) + return -EINVAL; + + init_waitqueue_head(&info->wait); + + for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) { + atomic_set(&info->event[i], 0); + } + + if (bf_get_next_minor_no(&minor)) { + return -EINVAL; + } + + ret = bf_init_cdev(bfdev, minor); + if (ret) { + printk(KERN_ERR "BF: device cdev creation failed\n"); + return ret; + } + + info->dev = device_create(bf_class, parent, + MKDEV(bf_major, minor), bfdev, + "bf%d", minor); + if (!info->dev) { + printk(KERN_ERR "BF: device creation failed\n"); + return -ENODEV; + } + + info->minor = minor; + + /* bind ISRs and request interrupts */ + if (info->irq && (bfdev->mode != BF_INTR_MODE_NONE)) { + /* + * Note that we deliberately don't use devm_request_irq + * here. The parent module can unregister the UIO device + * and call pci_disable_msi, which requires that this + * irq has been freed. However, the device may have open + * FDs at the time of unregister and therefore may not be + * freed until they are released. + */ + if (bfdev->mode == BF_INTR_MODE_LEGACY) { + ret = request_irq(info->irq, bf_interrupt, + info->irq_flags, bfdev->name, + (void *)&(bfdev->bf_int_vec[0])); + if (ret) { + printk(KERN_ERR "bf failed to request legacy irq %ld error %d\n", + info->irq, ret); + return ret; + } + printk(KERN_NOTICE "BF allocating legacy int vector %ld\n", info->irq); + } else if (bfdev->mode == BF_INTR_MODE_MSIX) { + for (i = 0; i < info->num_irq; i++) { + ret = request_irq(info->msix_entries[i].vector, bf_interrupt, + info->irq_flags, bfdev->name, + (void *)&(bfdev->bf_int_vec[i])); + if (ret) { + /* undo all other previous bindings */ + printk(KERN_ERR "bf failed to request MSIX ret %d itr %d\n", ret, i); + for (j = i - 1; j >= 0; j--) { + free_irq(info->msix_entries[j].vector, + (void *)&(bfdev->bf_int_vec[j])); + } + return ret; + } + } + printk(KERN_NOTICE "BF allocating %d MSIx vectors from %ld\n", + info->num_irq, info->irq); + } else if (bfdev->mode == BF_INTR_MODE_MSI) { + for (i = 0; i < info->num_irq; i++) { + ret = request_irq(info->irq + i, bf_interrupt, + info->irq_flags, bfdev->name, + (void *)&(bfdev->bf_int_vec[i])); + if (ret) { + /* undo all other previous bindings */ + printk(KERN_ERR "bf failed to request MSI ret %d itr %d\n", ret, i); + for (j = i - 1; j >= 0; j--) { + free_irq(info->irq + j, (void *)&(bfdev->bf_int_vec[j])); + } + return ret; + } + } + printk(KERN_NOTICE "BF allocating %d MSI vectors from %ld\n", + info->num_irq, info->irq); + } + } + return 0; +} + +/** + * bf_unregister_device - register a new userspace mem device + * @bfdev: bf pci device + * + * returns none + */ +void bf_unregister_device(struct bf_pci_dev *bfdev) +{ + struct bf_dev_info *info = &bfdev->info; + int i; + + if (info->irq) { + if (bfdev->mode == BF_INTR_MODE_LEGACY) { + free_irq(info->irq, (void *)&(bfdev->bf_int_vec[0])); + } else if (bfdev->mode == BF_INTR_MODE_MSIX) { + for (i = 0; i < info->num_irq; i++) { + free_irq(info->msix_entries[i].vector, (void *)&(bfdev->bf_int_vec[i])); + } + } else if (bfdev->mode == BF_INTR_MODE_MSI) { + for (i = 0; i < info->num_irq; i++) { + free_irq(info->irq + i, (void *)&(bfdev->bf_int_vec[i])); + } + } + } + device_destroy(bf_class, MKDEV(bf_major, info->minor)); + bf_remove_cdev(bfdev); + bf_return_minor_no(info->minor); + return; +} + +static inline struct device *pci_dev_to_dev(struct pci_dev *pdev) +{ + return &pdev->dev; +} + +static int +bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) +{ + struct bf_pci_dev *bfdev; + int err, pci_use_highmem; + int i, num_irq; + + memset(bf_global, 0, sizeof(bf_global)); + + bfdev = kzalloc(sizeof(struct bf_pci_dev), GFP_KERNEL); + if (!bfdev) + return -ENOMEM; + + /* init the cookies to be passed to ISRs */ + for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) { + bfdev->bf_int_vec[i].int_vec_offset = i; + bfdev->bf_int_vec[i].bf_dev = bfdev; + } + + /* initialize intr_mode to none */ + bfdev->mode = BF_INTR_MODE_NONE; + + /* clear pci_error_state */ + bfdev->info.pci_error_state = 0; + + /* + * enable device + */ + err = pci_enable_device(pdev); + if (err != 0) { + dev_err(&pdev->dev, "Cannot enable PCI device\n"); + goto fail_free; + } + + /* + * reserve device's PCI memory regions for use by this + * module + */ + err = pci_request_regions(pdev, "bf_umem"); + if (err != 0) { + dev_err(&pdev->dev, "Cannot request regions\n"); + goto fail_pci_disable; + } + /* remap IO memory */ + err = bf_setup_bars(pdev, &bfdev->info); + if (err != 0) + goto fail_release_iomem; + + if (!dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64)) && + !dma_set_coherent_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64))) { + pci_use_highmem = 1; + } else { + err = dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(32)); + if (err) { + err = dma_set_coherent_mask(pci_dev_to_dev(pdev), + DMA_BIT_MASK(32)); + if (err) { + dev_err(pci_dev_to_dev(pdev), "No usable DMA " + "configuration, aborting\n"); + goto fail_release_iomem; + } + } + pci_use_highmem = 0; + } + + /* enable pci error reporting */ + /* for the current kernel version, kernel config must have set the followings: + * CONFIG_PCIEPORTBUS=y and CONFIG_PCIEAER = y + * we have pci_error_handlers defined that gets invoked by kernel AER module + * upon detecting the pcie error on this device's addresses. + * However, there seems no way that AER would pass the offending addresses + * to the callback functions. AER logs the error messages on the console. + * This driver's calback function send the SIGIO signal to the user space + * to indicate the error condition. + */ + pci_enable_pcie_error_reporting(pdev); + + /* enable bus mastering on the device */ + pci_set_master(pdev); + + /* fill in bfdev info */ + bfdev->info.version = "0.2"; + bfdev->info.owner = THIS_MODULE; + bfdev->pdev = pdev; + + switch (bf_intr_mode_default) { +#ifdef CONFIG_PCI_MSI + case BF_INTR_MODE_MSIX: + /* Only 1 msi-x vector needed */ + bfdev->info.msix_entries = kcalloc(BF_MSIX_ENTRY_CNT, + sizeof(struct msix_entry), GFP_KERNEL); + if (!bfdev->info.msix_entries) { + err = -ENOMEM; + goto fail_clear_pci_master; + } + for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) { + bfdev->info.msix_entries[i].entry= i; + } + num_irq = pci_enable_msix_range(pdev, bfdev->info.msix_entries, + BF_MSIX_ENTRY_CNT, BF_MSIX_ENTRY_CNT); + if (num_irq == BF_MSIX_ENTRY_CNT) { + dev_dbg(&pdev->dev, "using MSI-X"); + bfdev->info.num_irq = num_irq; + bfdev->info.irq = bfdev->info.msix_entries[0].vector; + bfdev->mode = BF_INTR_MODE_MSIX; + printk(KERN_DEBUG "bf using %d MSIX irq from %ld\n", num_irq, + bfdev->info.irq); + break; + } else { + if (num_irq) + pci_disable_msix(pdev); + kfree(bfdev->info.msix_entries); + bfdev->info.msix_entries = NULL; + printk(KERN_ERR "bf error allocating MSIX vectors. Trying MSI...\n"); + /* and, fall back to MSI */ + } + /* ** intentional no-break */ + case BF_INTR_MODE_MSI: + num_irq = pci_enable_msi_range(pdev, BF_MSI_ENTRY_CNT, BF_MSI_ENTRY_CNT); + if (num_irq > 0) { + dev_dbg(&pdev->dev, "using MSI"); + bfdev->info.num_irq = num_irq; + bfdev->info.irq = pdev->irq; + bfdev->mode = BF_INTR_MODE_MSI; + printk(KERN_DEBUG "bf using %d MSI irq from %ld\n", bfdev->info.num_irq, + bfdev->info.irq); + break; + } +#endif /* CONFIG_PCI_MSI */ + /* fall back to Legacy Interrupt, intentional no-break */ + + case BF_INTR_MODE_LEGACY: + if (pci_intx_mask_supported(pdev)) { + dev_dbg(&pdev->dev, "using INTX"); + bfdev->info.irq_flags = IRQF_SHARED; + bfdev->info.irq = pdev->irq; + bfdev->mode = BF_INTR_MODE_LEGACY; + printk(KERN_DEBUG "bf using LEGACY irq %ld\n", bfdev->info.irq); + break; + } + dev_notice(&pdev->dev, "PCI INTx mask not supported\n"); + /* fall back to no Interrupt, intentional no-break */ + case BF_INTR_MODE_NONE: + bfdev->info.irq = 0; + bfdev->info.num_irq = 0; + bfdev->mode = BF_INTR_MODE_NONE; + break; + + default: + dev_err(&pdev->dev, "invalid IRQ mode %u", bf_intr_mode_default); + err = -EINVAL; + goto fail_clear_pci_master; + } + + pci_set_drvdata(pdev, bfdev); + sprintf(bfdev->name, "bf_%d", bfdev->info.minor); + /* register bf driver */ + err = bf_register_device(&pdev->dev, bfdev); + if (err != 0) + goto fail_release_irq; + + bf_global[bfdev->info.minor].async_queue = NULL; + bf_global[bfdev->info.minor].bfdev = bfdev; + + dev_info(&pdev->dev, "bf device %d registered with irq %ld\n", + bfdev->instance, bfdev->info.irq); + printk(KERN_ALERT "bf probe ok\n"); + return 0; + +fail_release_irq: + pci_set_drvdata(pdev, NULL); + if (bfdev->mode == BF_INTR_MODE_MSIX) { + pci_disable_msix(bfdev->pdev); + kfree(bfdev->info.msix_entries); + bfdev->info.msix_entries = NULL; + } + else if (bfdev->mode == BF_INTR_MODE_MSI) + pci_disable_msi(bfdev->pdev); +fail_clear_pci_master: + pci_clear_master(pdev); +fail_release_iomem: + bf_pci_release_iomem(&bfdev->info); + pci_release_regions(pdev); +fail_pci_disable: + pci_disable_device(pdev); +fail_free: + kfree(bfdev); + + printk(KERN_ERR "bf probe not ok\n"); + return err; +} + +static void +bf_pci_remove(struct pci_dev *pdev) +{ + struct bf_pci_dev *bfdev = pci_get_drvdata(pdev); + struct bf_listener *cur_listener; + + bf_unregister_device(bfdev); + if (bfdev->mode == BF_INTR_MODE_MSIX) { + pci_disable_msix(pdev); + kfree(bfdev->info.msix_entries); + bfdev->info.msix_entries = NULL; + } + else if (bfdev->mode == BF_INTR_MODE_MSI) + pci_disable_msi(pdev); + pci_clear_master(pdev); + bf_pci_release_iomem(&bfdev->info); + pci_release_regions(pdev); + pci_disable_pcie_error_reporting(pdev); + pci_disable_device(pdev); + pci_set_drvdata(pdev, NULL); + bf_global[bfdev->info.minor].bfdev = NULL; + /* existing filep structures in open file(s) must be informed that + * bf_pci_dev is no longer valid */ + spin_lock(&bf_nonisr_lock); + cur_listener = bfdev->listener_head; + while (cur_listener) { + cur_listener->bfdev = NULL; + cur_listener = cur_listener->next; + } + spin_unlock(&bf_nonisr_lock); + kfree(bfdev); +} + +/** + * bf_pci_error_detected - called when PCI error is detected + * @pdev: Pointer to PCI device + * @state: The current pci connection state + * + * called when root complex detects pci error associated with the device + */ +static pci_ers_result_t bf_pci_error_detected(struct pci_dev *pdev, + pci_channel_state_t state) +{ + struct bf_pci_dev *bfdev = pci_get_drvdata(pdev); + int minor; + + if (!bfdev) { + return PCI_ERS_RESULT_NONE; + } + printk(KERN_ERR "pci_err_detected state %d\n", state); + if (state == pci_channel_io_perm_failure || state == pci_channel_io_frozen) { + bfdev->info.pci_error_state = 1; + /* send a signal to the user space program of the error */ + minor = bfdev->info.minor; + if (minor < BF_MAX_DEVICE_CNT && bf_global[minor].async_queue) { + kill_fasync(&bf_global[minor].async_queue, SIGIO, POLL_ERR); + } + return PCI_ERS_RESULT_DISCONNECT; + } else { + return PCI_ERS_RESULT_NONE; + } +} + +/** + * bf_pci_slot_reset - called after the pci bus has been reset. + * @pdev: Pointer to PCI device + * + * Restart the card from scratch, as if from a cold-boot. + */ +static pci_ers_result_t bf_pci_slot_reset(struct pci_dev *pdev) +{ + /* nothing to do for now as we do not expect to get backto normal after + * a pcie link reset + * TBD: fill in this function if tofino can recover after an error + */ + return PCI_ERS_RESULT_DISCONNECT; +} + +/** + * bf_pci_resume - called when kernel thinks the device is up on PCIe. + * @pdev: Pointer to PCI device + * + * This callback is called when the error recovery driver tells us that + * its OK to resume normal operation. + */ +static void bf_pci_resume(struct pci_dev *pdev) +{ + /* this function should never be called for Tofinoi */ + struct bf_pci_dev *bfdev = pci_get_drvdata(pdev); + + printk(KERN_ERR "BF io_resume invoked after pci error\n"); + if (bfdev) { + bfdev->info.pci_error_state = 0; + } +} + +static int +bf_config_intr_mode(char *intr_str) +{ + if (!intr_str) { + pr_info("Use MSIX interrupt by default\n"); + return 0; + } + + if (!strcmp(intr_str, BF_INTR_MODE_MSIX_NAME)) { + bf_intr_mode_default = BF_INTR_MODE_MSIX; + pr_info("Use MSIX interrupt\n"); + } else if (!strcmp(intr_str, BF_INTR_MODE_MSI_NAME)) { + bf_intr_mode_default = BF_INTR_MODE_MSI; + pr_info("Use MSI interrupt\n"); + } else if (!strcmp(intr_str, BF_INTR_MODE_LEGACY_NAME)) { + bf_intr_mode_default = BF_INTR_MODE_LEGACY; + pr_info("Use legacy interrupt\n"); + } else { + pr_info("Error: bad parameter - %s\n", intr_str); + return -EINVAL; + } + + return 0; +} + +static const struct pci_device_id bf_pci_tbl[] = { + {PCI_VDEVICE(BF, TOFINO_DEV_ID_A0), 0}, + {PCI_VDEVICE(BF, TOFINO_DEV_ID_B0), 0}, + /* required last entry */ + { .device = 0 } +}; + +/* PCI bus error handlers */ +static struct pci_error_handlers bf_pci_err_handler = { + .error_detected = bf_pci_error_detected, + .slot_reset = bf_pci_slot_reset, + .resume = bf_pci_resume, +}; + +static struct pci_driver bf_pci_driver = { + .name = "bf", + .id_table = bf_pci_tbl, + .probe = bf_pci_probe, + .remove = bf_pci_remove, + .err_handler = &bf_pci_err_handler +}; + +static int __init +bfdrv_init(void) +{ + int ret; + + ret = bf_config_intr_mode(intr_mode); + if (ret < 0) + return ret; + + spin_lock_init(&bf_nonisr_lock); + return pci_register_driver(&bf_pci_driver); +} + +static void __exit +bfdrv_exit(void) +{ + pci_unregister_driver(&bf_pci_driver); +} + +module_init(bfdrv_init); +module_exit(bfdrv_exit); + +module_param(intr_mode, charp, S_IRUGO); +MODULE_PARM_DESC(intr_mode, +"bf interrupt mode (default=msix):\n" +" " BF_INTR_MODE_MSIX_NAME " Use MSIX interrupt\n" +" " BF_INTR_MODE_MSI_NAME " Use MSI interrupt\n" +" " BF_INTR_MODE_LEGACY_NAME " Use Legacy interrupt\n" +"\n"); + +MODULE_DEVICE_TABLE(pci, bf_pci_tbl); +MODULE_DESCRIPTION("Barefoot Tofino PCI device"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Barefoot Networks"); diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c new file mode 100644 index 000000000000..a1ba7047baaa --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c @@ -0,0 +1,2396 @@ +/* + * TUN - Universal TUN/TAP device driver. + * Copyright (C) 1999-2002 Maxim Krasnyansky + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * $Id: tun.c,v 1.15 2002/03/01 02:44:24 maxk Exp $ + */ + +/* + * Changes: + * + * Mike Kershaw 2005/08/14 + * Add TUNSETLINK ioctl to set the link encapsulation + * + * Mark Smith + * Use eth_random_addr() for tap MAC address. + * + * Harald Roelle 2004/04/20 + * Fixes in packet dropping, queue length setting and queue wakeup. + * Increased default tx queue length. + * Added ethtool API. + * Minor cleanups + * + * Daniel Podlejski + * Modifications for 2.3.99-pre5 kernel. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#define DRV_NAME "bf_tun" +#define DRV_VERSION "1.6" +#define DRV_DESCRIPTION "Universal TUN/TAP device driver" +#define DRV_COPYRIGHT "(C) 1999-2004 Max Krasnyansky " + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* Uncomment to enable debugging */ +/* #define TUN_DEBUG 1 */ + +#define TUN_MINOR1 201 + +#ifdef TUN_DEBUG +static int debug; + +#define tun_debug(level, tun, fmt, args...) \ +do { \ + if (tun->debug) \ + netdev_printk(level, tun->dev, fmt, ##args); \ +} while (0) +#define DBG1(level, fmt, args...) \ +do { \ + if (debug == 2) \ + printk(level fmt, ##args); \ +} while (0) +#else +#define tun_debug(level, tun, fmt, args...) \ +do { \ + if (0) \ + netdev_printk(level, tun->dev, fmt, ##args); \ +} while (0) +#define DBG1(level, fmt, args...) \ +do { \ + if (0) \ + printk(level fmt, ##args); \ +} while (0) +#endif + +#define GOODCOPY_LEN 128 + +#define FLT_EXACT_COUNT 8 +struct tap_filter { + unsigned int count; /* Number of addrs. Zero means disabled */ + u32 mask[2]; /* Mask of the hashed addrs */ + unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN]; +}; + +/* DEFAULT_MAX_NUM_RSS_QUEUES were chosen to let the rx/tx queues allocated for + * the netdevice to be fit in one page. So we can make sure the success of + * memory allocation. TODO: increase the limit. */ +#define MAX_TAP_QUEUES DEFAULT_MAX_NUM_RSS_QUEUES +#define MAX_TAP_FLOWS 4096 + +#define TUN_FLOW_EXPIRE (3 * HZ) + +/* A tun_file connects an open character device to a tuntap netdevice. It + * also contains all socket related structures (except sock_fprog and tap_filter) + * to serve as one transmit queue for tuntap device. The sock_fprog and + * tap_filter were kept in tun_struct since they were used for filtering for the + * netdevice not for a specific queue (at least I didn't see the requirement for + * this). + * + * RCU usage: + * The tun_file and tun_struct are loosely coupled, the pointer from one to the + * other can only be read while rcu_read_lock or rtnl_lock is held. + */ +struct tun_file { + struct sock sk; + struct socket socket; + struct socket_wq wq; + struct tun_struct __rcu *tun; + struct net *net; + struct fasync_struct *fasync; + /* only used for fasnyc */ + unsigned int flags; + union { + u16 queue_index; + unsigned int ifindex; + }; + struct list_head next; + struct tun_struct *detached; +}; + +struct tun_flow_entry { + struct hlist_node hash_link; + struct rcu_head rcu; + struct tun_struct *tun; + + u32 rxhash; + u32 rps_rxhash; + int queue_index; + unsigned long updated; +}; + +#define TUN_NUM_FLOW_ENTRIES 1024 + +/* Since the socket were moved to tun_file, to preserve the behavior of persist + * device, socket filter, sndbuf and vnet header size were restore when the + * file were attached to a persist device. + */ +struct tun_struct { + struct tun_file __rcu *tfiles[MAX_TAP_QUEUES]; + unsigned int numqueues; + unsigned int flags; + kuid_t owner; + kgid_t group; + + struct net_device *dev; + netdev_features_t set_features; +#define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ + NETIF_F_TSO6|NETIF_F_UFO) + + int vnet_hdr_sz; + int sndbuf; + struct tap_filter txflt; + struct sock_fprog fprog; + /* protected by rtnl lock */ + bool filter_attached; +#ifdef TUN_DEBUG + int debug; +#endif + spinlock_t lock; + struct hlist_head flows[TUN_NUM_FLOW_ENTRIES]; + struct timer_list flow_gc_timer; + unsigned long ageing_time; + unsigned int numdisabled; + struct list_head disabled; + void *security; + u32 flow_count; +}; + +static inline u32 tun_hashfn(u32 rxhash) +{ + return rxhash & 0x3ff; +} + +static struct tun_flow_entry *tun_flow_find(struct hlist_head *head, u32 rxhash) +{ + struct tun_flow_entry *e; + + hlist_for_each_entry_rcu(e, head, hash_link) { + if (e->rxhash == rxhash) + return e; + } + return NULL; +} + +static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun, + struct hlist_head *head, + u32 rxhash, u16 queue_index) +{ + struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC); + + if (e) { + tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n", + rxhash, queue_index); + e->updated = jiffies; + e->rxhash = rxhash; + e->rps_rxhash = 0; + e->queue_index = queue_index; + e->tun = tun; + hlist_add_head_rcu(&e->hash_link, head); + ++tun->flow_count; + } + return e; +} + +static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) +{ + tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", + e->rxhash, e->queue_index); + sock_rps_reset_flow_hash(e->rps_rxhash); + hlist_del_rcu(&e->hash_link); + kfree_rcu(e, rcu); + --tun->flow_count; +} + +static void tun_flow_flush(struct tun_struct *tun) +{ + int i; + + spin_lock_bh(&tun->lock); + for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { + struct tun_flow_entry *e; + struct hlist_node *n; + + hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) + tun_flow_delete(tun, e); + } + spin_unlock_bh(&tun->lock); +} + +static void tun_flow_delete_by_queue(struct tun_struct *tun, u16 queue_index) +{ + int i; + + spin_lock_bh(&tun->lock); + for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { + struct tun_flow_entry *e; + struct hlist_node *n; + + hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) { + if (e->queue_index == queue_index) + tun_flow_delete(tun, e); + } + } + spin_unlock_bh(&tun->lock); +} + +static void tun_flow_cleanup(unsigned long data) +{ + struct tun_struct *tun = (struct tun_struct *)data; + unsigned long delay = tun->ageing_time; + unsigned long next_timer = jiffies + delay; + unsigned long count = 0; + int i; + + tun_debug(KERN_INFO, tun, "tun_flow_cleanup\n"); + + spin_lock_bh(&tun->lock); + for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { + struct tun_flow_entry *e; + struct hlist_node *n; + + hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) { + unsigned long this_timer; + count++; + this_timer = e->updated + delay; + if (time_before_eq(this_timer, jiffies)) + tun_flow_delete(tun, e); + else if (time_before(this_timer, next_timer)) + next_timer = this_timer; + } + } + + if (count) + mod_timer(&tun->flow_gc_timer, round_jiffies_up(next_timer)); + spin_unlock_bh(&tun->lock); +} + +static void tun_flow_update(struct tun_struct *tun, u32 rxhash, + struct tun_file *tfile) +{ + struct hlist_head *head; + struct tun_flow_entry *e; + unsigned long delay = tun->ageing_time; + u16 queue_index = tfile->queue_index; + + if (!rxhash) + return; + else + head = &tun->flows[tun_hashfn(rxhash)]; + + rcu_read_lock(); + + /* We may get a very small possibility of OOO during switching, not + * worth to optimize.*/ + if (tun->numqueues == 1 || tfile->detached) + goto unlock; + + e = tun_flow_find(head, rxhash); + if (likely(e)) { + /* TODO: keep queueing to old queue until it's empty? */ + e->queue_index = queue_index; + e->updated = jiffies; + sock_rps_record_flow_hash(e->rps_rxhash); + } else { + spin_lock_bh(&tun->lock); + if (!tun_flow_find(head, rxhash) && + tun->flow_count < MAX_TAP_FLOWS) + tun_flow_create(tun, head, rxhash, queue_index); + + if (!timer_pending(&tun->flow_gc_timer)) + mod_timer(&tun->flow_gc_timer, + round_jiffies_up(jiffies + delay)); + spin_unlock_bh(&tun->lock); + } + +unlock: + rcu_read_unlock(); +} + +/** + * Save the hash received in the stack receive path and update the + * flow_hash table accordingly. + */ +static inline void tun_flow_save_rps_rxhash(struct tun_flow_entry *e, u32 hash) +{ + if (unlikely(e->rps_rxhash != hash)) { + sock_rps_reset_flow_hash(e->rps_rxhash); + e->rps_rxhash = hash; + } +} + +/* We try to identify a flow through its rxhash first. The reason that + * we do not check rxq no. is because some cards(e.g 82599), chooses + * the rxq based on the txq where the last packet of the flow comes. As + * the userspace application move between processors, we may get a + * different rxq no. here. If we could not get rxhash, then we would + * hope the rxq no. may help here. + */ +static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb, + void *accel_priv, select_queue_fallback_t fallback) +{ + struct tun_struct *tun = netdev_priv(dev); + struct tun_flow_entry *e; + u32 txq = 0; + u32 numqueues = 0; + + rcu_read_lock(); + numqueues = ACCESS_ONCE(tun->numqueues); + + txq = skb_get_hash(skb); + if (txq) { + e = tun_flow_find(&tun->flows[tun_hashfn(txq)], txq); + if (e) { + tun_flow_save_rps_rxhash(e, txq); + txq = e->queue_index; + } else + /* use multiply and shift instead of expensive divide */ + txq = ((u64)txq * numqueues) >> 32; + } else if (likely(skb_rx_queue_recorded(skb))) { + txq = skb_get_rx_queue(skb); + while (unlikely(txq >= numqueues)) + txq -= numqueues; + } + + rcu_read_unlock(); + return txq; +} + +static inline bool tun_not_capable(struct tun_struct *tun) +{ + const struct cred *cred = current_cred(); + struct net *net = dev_net(tun->dev); + + return ((uid_valid(tun->owner) && !uid_eq(cred->euid, tun->owner)) || + (gid_valid(tun->group) && !in_egroup_p(tun->group))) && + !ns_capable(net->user_ns, CAP_NET_ADMIN); +} + +static void tun_set_real_num_queues(struct tun_struct *tun) +{ + netif_set_real_num_tx_queues(tun->dev, tun->numqueues); + netif_set_real_num_rx_queues(tun->dev, tun->numqueues); +} + +static void tun_disable_queue(struct tun_struct *tun, struct tun_file *tfile) +{ + tfile->detached = tun; + list_add_tail(&tfile->next, &tun->disabled); + ++tun->numdisabled; +} + +static struct tun_struct *tun_enable_queue(struct tun_file *tfile) +{ + struct tun_struct *tun = tfile->detached; + + tfile->detached = NULL; + list_del_init(&tfile->next); + --tun->numdisabled; + return tun; +} + +static void tun_queue_purge(struct tun_file *tfile) +{ + skb_queue_purge(&tfile->sk.sk_receive_queue); + skb_queue_purge(&tfile->sk.sk_error_queue); +} + +static void __tun_detach(struct tun_file *tfile, bool clean) +{ + struct tun_file *ntfile; + struct tun_struct *tun; + + tun = rtnl_dereference(tfile->tun); + + if (tun && !tfile->detached) { + u16 index = tfile->queue_index; + BUG_ON(index >= tun->numqueues); + + rcu_assign_pointer(tun->tfiles[index], + tun->tfiles[tun->numqueues - 1]); + ntfile = rtnl_dereference(tun->tfiles[index]); + ntfile->queue_index = index; + + --tun->numqueues; + if (clean) { + RCU_INIT_POINTER(tfile->tun, NULL); + sock_put(&tfile->sk); + } else + tun_disable_queue(tun, tfile); + + synchronize_net(); + tun_flow_delete_by_queue(tun, tun->numqueues + 1); + /* Drop read queue */ + tun_queue_purge(tfile); + tun_set_real_num_queues(tun); + } else if (tfile->detached && clean) { + tun = tun_enable_queue(tfile); + sock_put(&tfile->sk); + } + + if (clean) { + if (tun && tun->numqueues == 0 && tun->numdisabled == 0) { + netif_carrier_off(tun->dev); + + if (!(tun->flags & TUN_PERSIST) && + tun->dev->reg_state == NETREG_REGISTERED) + unregister_netdevice(tun->dev); + } + + BUG_ON(!test_bit(SOCK_EXTERNALLY_ALLOCATED, + &tfile->socket.flags)); + sk_release_kernel(&tfile->sk); + } +} + +static void tun_detach(struct tun_file *tfile, bool clean) +{ + rtnl_lock(); + __tun_detach(tfile, clean); + rtnl_unlock(); +} + +static void tun_detach_all(struct net_device *dev) +{ + struct tun_struct *tun = netdev_priv(dev); + struct tun_file *tfile, *tmp; + int i, n = tun->numqueues; + + for (i = 0; i < n; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + BUG_ON(!tfile); + tfile->socket.sk->sk_data_ready(tfile->socket.sk); + RCU_INIT_POINTER(tfile->tun, NULL); + --tun->numqueues; + } + list_for_each_entry(tfile, &tun->disabled, next) { + tfile->socket.sk->sk_data_ready(tfile->socket.sk); + RCU_INIT_POINTER(tfile->tun, NULL); + } + BUG_ON(tun->numqueues != 0); + + synchronize_net(); + for (i = 0; i < n; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + /* Drop read queue */ + tun_queue_purge(tfile); + sock_put(&tfile->sk); + } + list_for_each_entry_safe(tfile, tmp, &tun->disabled, next) { + tun_enable_queue(tfile); + tun_queue_purge(tfile); + sock_put(&tfile->sk); + } + BUG_ON(tun->numdisabled != 0); + + if (tun->flags & TUN_PERSIST) + module_put(THIS_MODULE); +} + +static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filter) +{ + struct tun_file *tfile = file->private_data; + int err; + + err = security_tun_dev_attach(tfile->socket.sk, tun->security); + if (err < 0) + goto out; + + err = -EINVAL; + if (rtnl_dereference(tfile->tun) && !tfile->detached) + goto out; + + err = -EBUSY; + if (!(tun->flags & TUN_TAP_MQ) && tun->numqueues == 1) + goto out; + + err = -E2BIG; + if (!tfile->detached && + tun->numqueues + tun->numdisabled == MAX_TAP_QUEUES) + goto out; + + err = 0; + + /* Re-attach the filter to persist device */ + if (!skip_filter && (tun->filter_attached == true)) { + err = __sk_attach_filter(&tun->fprog, tfile->socket.sk, + lockdep_rtnl_is_held()); + if (!err) + goto out; + } + tfile->queue_index = tun->numqueues; + rcu_assign_pointer(tfile->tun, tun); + rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); + tun->numqueues++; + + if (tfile->detached) + tun_enable_queue(tfile); + else + sock_hold(&tfile->sk); + + tun_set_real_num_queues(tun); + + /* device is allowed to go away first, so no need to hold extra + * refcnt. + */ + +out: + return err; +} + +static struct tun_struct *__tun_get(struct tun_file *tfile) +{ + struct tun_struct *tun; + + rcu_read_lock(); + tun = rcu_dereference(tfile->tun); + if (tun) + dev_hold(tun->dev); + rcu_read_unlock(); + + return tun; +} + +static struct tun_struct *tun_get(struct file *file) +{ + return __tun_get(file->private_data); +} + +static void tun_put(struct tun_struct *tun) +{ + dev_put(tun->dev); +} + +/* TAP filtering */ +static void addr_hash_set(u32 *mask, const u8 *addr) +{ + int n = ether_crc(ETH_ALEN, addr) >> 26; + mask[n >> 5] |= (1 << (n & 31)); +} + +static unsigned int addr_hash_test(const u32 *mask, const u8 *addr) +{ + int n = ether_crc(ETH_ALEN, addr) >> 26; + return mask[n >> 5] & (1 << (n & 31)); +} + +static int update_filter(struct tap_filter *filter, void __user *arg) +{ + struct { u8 u[ETH_ALEN]; } *addr; + struct tun_filter uf; + int err, alen, n, nexact; + + if (copy_from_user(&uf, arg, sizeof(uf))) + return -EFAULT; + + if (!uf.count) { + /* Disabled */ + filter->count = 0; + return 0; + } + + alen = ETH_ALEN * uf.count; + addr = kmalloc(alen, GFP_KERNEL); + if (!addr) + return -ENOMEM; + + if (copy_from_user(addr, arg + sizeof(uf), alen)) { + err = -EFAULT; + goto done; + } + + /* The filter is updated without holding any locks. Which is + * perfectly safe. We disable it first and in the worst + * case we'll accept a few undesired packets. */ + filter->count = 0; + wmb(); + + /* Use first set of addresses as an exact filter */ + for (n = 0; n < uf.count && n < FLT_EXACT_COUNT; n++) + memcpy(filter->addr[n], addr[n].u, ETH_ALEN); + + nexact = n; + + /* Remaining multicast addresses are hashed, + * unicast will leave the filter disabled. */ + memset(filter->mask, 0, sizeof(filter->mask)); + for (; n < uf.count; n++) { + if (!is_multicast_ether_addr(addr[n].u)) { + err = 0; /* no filter */ + goto done; + } + addr_hash_set(filter->mask, addr[n].u); + } + + /* For ALLMULTI just set the mask to all ones. + * This overrides the mask populated above. */ + if ((uf.flags & TUN_FLT_ALLMULTI)) + memset(filter->mask, ~0, sizeof(filter->mask)); + + /* Now enable the filter */ + wmb(); + filter->count = nexact; + + /* Return the number of exact filters */ + err = nexact; + +done: + kfree(addr); + return err; +} + +/* Returns: 0 - drop, !=0 - accept */ +static int run_filter(struct tap_filter *filter, const struct sk_buff *skb) +{ + /* Cannot use eth_hdr(skb) here because skb_mac_hdr() is incorrect + * at this point. */ + struct ethhdr *eh = (struct ethhdr *) skb->data; + int i; + + /* Exact match */ + for (i = 0; i < filter->count; i++) + if (ether_addr_equal(eh->h_dest, filter->addr[i])) + return 1; + + /* Inexact match (multicast only) */ + if (is_multicast_ether_addr(eh->h_dest)) + return addr_hash_test(filter->mask, eh->h_dest); + + return 0; +} + +/* + * Checks whether the packet is accepted or not. + * Returns: 0 - drop, !=0 - accept + */ +static int check_filter(struct tap_filter *filter, const struct sk_buff *skb) +{ + if (!filter->count) + return 1; + + return run_filter(filter, skb); +} + +/* Network device part of the driver */ + +static const struct ethtool_ops tun_ethtool_ops; + +/* Net device detach from fd. */ +static void tun_net_uninit(struct net_device *dev) +{ + tun_detach_all(dev); +} + +/* Net device open. */ +static int tun_net_open(struct net_device *dev) +{ + netif_tx_start_all_queues(dev); + return 0; +} + +/* Net device close. */ +static int tun_net_close(struct net_device *dev) +{ + netif_tx_stop_all_queues(dev); + return 0; +} + +/* Net device start xmit */ +static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) +{ + struct tun_struct *tun = netdev_priv(dev); + int txq = skb->queue_mapping; + struct tun_file *tfile; + u32 numqueues = 0; + + rcu_read_lock(); + tfile = rcu_dereference(tun->tfiles[txq]); + numqueues = ACCESS_ONCE(tun->numqueues); + + /* Drop packet if interface is not attached */ + if (txq >= numqueues) + goto drop; + + if (numqueues == 1) { + /* Select queue was not called for the skbuff, so we extract the + * RPS hash and save it into the flow_table here. + */ + __u32 rxhash; + + rxhash = skb_get_hash(skb); + if (rxhash) { + struct tun_flow_entry *e; + e = tun_flow_find(&tun->flows[tun_hashfn(rxhash)], + rxhash); + if (e) + tun_flow_save_rps_rxhash(e, rxhash); + } + } + + tun_debug(KERN_INFO, tun, "tun_net_xmit %d\n", skb->len); + + BUG_ON(!tfile); + + /* Drop if the filter does not like it. + * This is a noop if the filter is disabled. + * Filter can be enabled only for the TAP devices. */ + if (!check_filter(&tun->txflt, skb)) + goto drop; + + if (tfile->socket.sk->sk_filter && + sk_filter(tfile->socket.sk, skb)) + goto drop; + + /* Limit the number of packets queued by dividing txq length with the + * number of queues. + */ + if (skb_queue_len(&tfile->socket.sk->sk_receive_queue) * numqueues + >= dev->tx_queue_len) + goto drop; + + if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) + goto drop; + + if (skb->sk) { + sock_tx_timestamp(skb->sk, &skb_shinfo(skb)->tx_flags); + sw_tx_timestamp(skb); + } + + /* Orphan the skb - required as we might hang on to it + * for indefinite time. + */ + skb_orphan(skb); + + nf_reset(skb); + + /* Enqueue packet */ + skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb); + + /* Notify and wake up reader process */ + if (tfile->flags & TUN_FASYNC) + kill_fasync(&tfile->fasync, SIGIO, POLL_IN); + tfile->socket.sk->sk_data_ready(tfile->socket.sk); + + rcu_read_unlock(); + return NETDEV_TX_OK; + +drop: + dev->stats.tx_dropped++; + skb_tx_error(skb); + kfree_skb(skb); + rcu_read_unlock(); + return NETDEV_TX_OK; +} + +static void tun_net_mclist(struct net_device *dev) +{ + /* + * This callback is supposed to deal with mc filter in + * _rx_ path and has nothing to do with the _tx_ path. + * In rx path we always accept everything userspace gives us. + */ +} + +#define MIN_MTU 68 +#define MAX_MTU 65535 + +static int +tun_net_change_mtu(struct net_device *dev, int new_mtu) +{ + if (new_mtu < MIN_MTU || new_mtu + dev->hard_header_len > MAX_MTU) + return -EINVAL; + dev->mtu = new_mtu; + return 0; +} + +static netdev_features_t tun_net_fix_features(struct net_device *dev, + netdev_features_t features) +{ + struct tun_struct *tun = netdev_priv(dev); + + return (features & tun->set_features) | (features & ~TUN_USER_FEATURES); +} + +static int +tun_change_carrier(struct net_device *dev, bool new_carrier) { + if (new_carrier) + netif_carrier_on(dev); + else + netif_carrier_off(dev); + return 0; +} + +#ifdef CONFIG_NET_POLL_CONTROLLER +static void tun_poll_controller(struct net_device *dev) +{ + /* + * Tun only receives frames when: + * 1) the char device endpoint gets data from user space + * 2) the tun socket gets a sendmsg call from user space + * Since both of those are synchronous operations, we are guaranteed + * never to have pending data when we poll for it + * so there is nothing to do here but return. + * We need this though so netpoll recognizes us as an interface that + * supports polling, which enables bridge devices in virt setups to + * still use netconsole + */ + return; +} +#endif +static const struct net_device_ops tun_netdev_ops = { + .ndo_uninit = tun_net_uninit, + .ndo_open = tun_net_open, + .ndo_stop = tun_net_close, + .ndo_start_xmit = tun_net_xmit, + .ndo_change_mtu = tun_net_change_mtu, + .ndo_fix_features = tun_net_fix_features, + .ndo_select_queue = tun_select_queue, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = tun_poll_controller, +#endif +}; + +static const struct net_device_ops tap_netdev_ops = { + .ndo_uninit = tun_net_uninit, + .ndo_open = tun_net_open, + .ndo_stop = tun_net_close, + .ndo_start_xmit = tun_net_xmit, + .ndo_change_mtu = tun_net_change_mtu, + .ndo_fix_features = tun_net_fix_features, + .ndo_set_rx_mode = tun_net_mclist, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, + .ndo_select_queue = tun_select_queue, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = tun_poll_controller, +#endif + .ndo_change_carrier = tun_change_carrier, +}; + +static void tun_flow_init(struct tun_struct *tun) +{ + int i; + + for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) + INIT_HLIST_HEAD(&tun->flows[i]); + + tun->ageing_time = TUN_FLOW_EXPIRE; + setup_timer(&tun->flow_gc_timer, tun_flow_cleanup, (unsigned long)tun); + mod_timer(&tun->flow_gc_timer, + round_jiffies_up(jiffies + tun->ageing_time)); +} + +static void tun_flow_uninit(struct tun_struct *tun) +{ + del_timer_sync(&tun->flow_gc_timer); + tun_flow_flush(tun); +} + +/* Initialize net device. */ +static void tun_net_init(struct net_device *dev) +{ + struct tun_struct *tun = netdev_priv(dev); + + switch (tun->flags & TUN_TYPE_MASK) { + case TUN_TUN_DEV: + dev->netdev_ops = &tun_netdev_ops; + + /* Point-to-Point TUN Device */ + dev->hard_header_len = 0; + dev->addr_len = 0; + dev->mtu = 1500; + + /* Zero header length */ + dev->type = ARPHRD_NONE; + dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; + dev->tx_queue_len = TUN_READQ_SIZE*2; /* We prefer our own queue length */ + break; + + case TUN_TAP_DEV: + dev->netdev_ops = &tap_netdev_ops; + /* Ethernet TAP Device */ + ether_setup(dev); + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; + + eth_hw_addr_random(dev); + + dev->tx_queue_len = TUN_READQ_SIZE*2; /* We prefer our own queue length */ + break; + } +} + +/* Character device part */ + +/* Poll */ +static unsigned int tun_chr_poll(struct file *file, poll_table *wait) +{ + struct tun_file *tfile = file->private_data; + struct tun_struct *tun = __tun_get(tfile); + struct sock *sk; + unsigned int mask = 0; + + if (!tun) + return POLLERR; + + sk = tfile->socket.sk; + + tun_debug(KERN_INFO, tun, "tun_chr_poll\n"); + + poll_wait(file, sk_sleep(sk), wait); + + if (!skb_queue_empty(&sk->sk_receive_queue)) + mask |= POLLIN | POLLRDNORM; + + if (sock_writeable(sk) || + (!test_and_set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags) && + sock_writeable(sk))) + mask |= POLLOUT | POLLWRNORM; + + if (tun->dev->reg_state != NETREG_REGISTERED) + mask = POLLERR; + + tun_put(tun); + return mask; +} + +/* prepad is the amount to reserve at front. len is length after that. + * linear is a hint as to how much to copy (usually headers). */ +static struct sk_buff *tun_alloc_skb(struct tun_file *tfile, + size_t prepad, size_t len, + size_t linear, int noblock) +{ + struct sock *sk = tfile->socket.sk; + struct sk_buff *skb; + int err; + + /* Under a page? Don't bother with paged skb. */ + if (prepad + len < PAGE_SIZE || !linear) + linear = len; + + skb = sock_alloc_send_pskb(sk, prepad + linear, len - linear, noblock, + &err, 0); + if (!skb) + return ERR_PTR(err); + + skb_reserve(skb, prepad); + skb_put(skb, linear); + skb->data_len = len - linear; + skb->len += len - linear; + + return skb; +} + +/* Get packet from user space buffer */ +static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, + void *msg_control, const struct iovec *iv, + size_t total_len, size_t count, int noblock) +{ + struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) }; + struct sk_buff *skb; + size_t len = total_len, align = NET_SKB_PAD, linear; + struct virtio_net_hdr gso = { 0 }; + int good_linear; + int offset = 0; + int copylen; + bool zerocopy = false; + int err; + u32 rxhash; + + if (!(tun->flags & TUN_NO_PI)) { + if (len < sizeof(pi)) + return -EINVAL; + len -= sizeof(pi); + + if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) + return -EFAULT; + offset += sizeof(pi); + } + + if (tun->flags & TUN_VNET_HDR) { + if (len < tun->vnet_hdr_sz) + return -EINVAL; + len -= tun->vnet_hdr_sz; + + if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) + return -EFAULT; + + if ((gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && + gso.csum_start + gso.csum_offset + 2 > gso.hdr_len) + gso.hdr_len = gso.csum_start + gso.csum_offset + 2; + + if (gso.hdr_len > len) + return -EINVAL; + offset += tun->vnet_hdr_sz; + } + + if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) { + align += NET_IP_ALIGN; + if (unlikely(len < ETH_HLEN || + (gso.hdr_len && gso.hdr_len < ETH_HLEN))) + return -EINVAL; + } + + good_linear = SKB_MAX_HEAD(align); + + if (msg_control) { + /* There are 256 bytes to be copied in skb, so there is + * enough room for skb expand head in case it is used. + * The rest of the buffer is mapped from userspace. + */ + copylen = gso.hdr_len ? gso.hdr_len : GOODCOPY_LEN; + if (copylen > good_linear) + copylen = good_linear; + linear = copylen; + if (iov_pages(iv, offset + copylen, count) <= MAX_SKB_FRAGS) + zerocopy = true; + } + + if (!zerocopy) { + copylen = len; + if (gso.hdr_len > good_linear) + linear = good_linear; + else + linear = gso.hdr_len; + } + + skb = tun_alloc_skb(tfile, align, copylen, linear, noblock); + if (IS_ERR(skb)) { + if (PTR_ERR(skb) != -EAGAIN) + tun->dev->stats.rx_dropped++; + return PTR_ERR(skb); + } + + if (zerocopy) + err = zerocopy_sg_from_iovec(skb, iv, offset, count); + else { + err = skb_copy_datagram_from_iovec(skb, 0, iv, offset, len); + if (!err && msg_control) { + struct ubuf_info *uarg = msg_control; + uarg->callback(uarg, false); + } + } + + if (err) { + tun->dev->stats.rx_dropped++; + kfree_skb(skb); + return -EFAULT; + } + + if (gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { + if (!skb_partial_csum_set(skb, gso.csum_start, + gso.csum_offset)) { + tun->dev->stats.rx_frame_errors++; + kfree_skb(skb); + return -EINVAL; + } + } + + switch (tun->flags & TUN_TYPE_MASK) { + case TUN_TUN_DEV: + if (tun->flags & TUN_NO_PI) { + switch (skb->data[0] & 0xf0) { + case 0x40: + pi.proto = htons(ETH_P_IP); + break; + case 0x60: + pi.proto = htons(ETH_P_IPV6); + break; + default: + tun->dev->stats.rx_dropped++; + kfree_skb(skb); + return -EINVAL; + } + } + + skb_reset_mac_header(skb); + skb->protocol = pi.proto; + skb->dev = tun->dev; + break; + case TUN_TAP_DEV: + skb->protocol = eth_type_trans(skb, tun->dev); + break; + } + + skb_reset_network_header(skb); + + if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { + pr_debug("GSO!\n"); + switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { + case VIRTIO_NET_HDR_GSO_TCPV4: + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; + break; + case VIRTIO_NET_HDR_GSO_TCPV6: + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; + break; + case VIRTIO_NET_HDR_GSO_UDP: + skb_shinfo(skb)->gso_type = SKB_GSO_UDP; + if (skb->protocol == htons(ETH_P_IPV6)) + ipv6_proxy_select_ident(skb); + break; + default: + tun->dev->stats.rx_frame_errors++; + kfree_skb(skb); + return -EINVAL; + } + + if (gso.gso_type & VIRTIO_NET_HDR_GSO_ECN) + skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; + + skb_shinfo(skb)->gso_size = gso.gso_size; + if (skb_shinfo(skb)->gso_size == 0) { + tun->dev->stats.rx_frame_errors++; + kfree_skb(skb); + return -EINVAL; + } + + /* Header must be checked, and gso_segs computed. */ + skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; + skb_shinfo(skb)->gso_segs = 0; + } + + /* copy skb_ubuf_info for callback when skb has no error */ + if (zerocopy) { + skb_shinfo(skb)->destructor_arg = msg_control; + skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; + skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; + } + + skb_probe_transport_header(skb, 0); + + rxhash = skb_get_hash(skb); + netif_rx_ni(skb); + + tun->dev->stats.rx_packets++; + tun->dev->stats.rx_bytes += len; + + tun_flow_update(tun, rxhash, tfile); + return total_len; +} + +static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, + unsigned long count, loff_t pos) +{ + struct file *file = iocb->ki_filp; + struct tun_struct *tun = tun_get(file); + struct tun_file *tfile = file->private_data; + ssize_t result; + + if (!tun) + return -EBADFD; + + tun_debug(KERN_INFO, tun, "tun_chr_write %ld\n", count); + + result = tun_get_user(tun, tfile, NULL, iv, iov_length(iv, count), + count, file->f_flags & O_NONBLOCK); + + tun_put(tun); + return result; +} + +/* Put packet to the user space buffer */ +static ssize_t tun_put_user(struct tun_struct *tun, + struct tun_file *tfile, + struct sk_buff *skb, + const struct iovec *iv, int len) +{ + struct tun_pi pi = { 0, skb->protocol }; + ssize_t total = 0; + int vlan_offset = 0, copied; + int vlan_hlen = 0; + + if (vlan_tx_tag_present(skb)) + vlan_hlen = VLAN_HLEN; + + if (!(tun->flags & TUN_NO_PI)) { + if ((len -= sizeof(pi)) < 0) + return -EINVAL; + + if (len < skb->len) { + /* Packet will be striped */ + pi.flags |= TUN_PKT_STRIP; + } + + if (memcpy_toiovecend(iv, (void *) &pi, 0, sizeof(pi))) + return -EFAULT; + total += sizeof(pi); + } + + if (tun->flags & TUN_VNET_HDR) { + struct virtio_net_hdr gso = { 0 }; /* no info leak */ + if ((len -= tun->vnet_hdr_sz) < 0) + return -EINVAL; + + if (skb_is_gso(skb)) { + struct skb_shared_info *sinfo = skb_shinfo(skb); + + /* This is a hint as to how much should be linear. */ + gso.hdr_len = skb_headlen(skb); + gso.gso_size = sinfo->gso_size; + if (sinfo->gso_type & SKB_GSO_TCPV4) + gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; + else if (sinfo->gso_type & SKB_GSO_TCPV6) + gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; + else if (sinfo->gso_type & SKB_GSO_UDP) + gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; + else { + pr_err("unexpected GSO type: " + "0x%x, gso_size %d, hdr_len %d\n", + sinfo->gso_type, gso.gso_size, + gso.hdr_len); + print_hex_dump(KERN_ERR, "tun: ", + DUMP_PREFIX_NONE, + 16, 1, skb->head, + min((int)gso.hdr_len, 64), true); + WARN_ON_ONCE(1); + return -EINVAL; + } + if (sinfo->gso_type & SKB_GSO_TCP_ECN) + gso.gso_type |= VIRTIO_NET_HDR_GSO_ECN; + } else + gso.gso_type = VIRTIO_NET_HDR_GSO_NONE; + + if (skb->ip_summed == CHECKSUM_PARTIAL) { + gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; + gso.csum_start = skb_checksum_start_offset(skb) + + vlan_hlen; + gso.csum_offset = skb->csum_offset; + } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { + gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; + } /* else everything is zero */ + + if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total, + sizeof(gso)))) + return -EFAULT; + total += tun->vnet_hdr_sz; + } + + copied = total; + len = min_t(int, skb->len + vlan_hlen, len); + total += skb->len + vlan_hlen; + if (vlan_hlen) { + int copy, ret; + struct { + __be16 h_vlan_proto; + __be16 h_vlan_TCI; + } veth; + + veth.h_vlan_proto = skb->vlan_proto; + veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); + + vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); + + copy = min_t(int, vlan_offset, len); + ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); + len -= copy; + copied += copy; + if (ret || !len) + goto done; + + copy = min_t(int, sizeof(veth), len); + ret = memcpy_toiovecend(iv, (void *)&veth, copied, copy); + len -= copy; + copied += copy; + if (ret || !len) + goto done; + } + + skb_copy_datagram_const_iovec(skb, vlan_offset, iv, copied, len); + +done: + tun->dev->stats.tx_packets++; + tun->dev->stats.tx_bytes += len; + + return total; +} + +static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile, + const struct iovec *iv, ssize_t len, int noblock) +{ + struct sk_buff *skb; + ssize_t ret = 0; + int peeked, err, off = 0; + + tun_debug(KERN_INFO, tun, "tun_do_read\n"); + + if (!len) + return ret; + + if (tun->dev->reg_state != NETREG_REGISTERED) + return -EIO; + + /* Read frames from queue */ + skb = __skb_recv_datagram(tfile->socket.sk, noblock ? MSG_DONTWAIT : 0, + &peeked, &off, &err); + if (skb) { + ret = tun_put_user(tun, tfile, skb, iv, len); + kfree_skb(skb); + } else + ret = err; + + return ret; +} + +static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, + unsigned long count, loff_t pos) +{ + struct file *file = iocb->ki_filp; + struct tun_file *tfile = file->private_data; + struct tun_struct *tun = __tun_get(tfile); + ssize_t len, ret; + + if (!tun) + return -EBADFD; + len = iov_length(iv, count); + if (len < 0) { + ret = -EINVAL; + goto out; + } + + ret = tun_do_read(tun, tfile, iv, len, + file->f_flags & O_NONBLOCK); + ret = min_t(ssize_t, ret, len); + if (ret > 0) + iocb->ki_pos = ret; +out: + tun_put(tun); + return ret; +} + +static void tun_free_netdev(struct net_device *dev) +{ + struct tun_struct *tun = netdev_priv(dev); + + BUG_ON(!(list_empty(&tun->disabled))); + tun_flow_uninit(tun); + security_tun_dev_free_security(tun->security); + free_netdev(dev); +} + +static void tun_setup(struct net_device *dev) +{ + struct tun_struct *tun = netdev_priv(dev); + + tun->owner = INVALID_UID; + tun->group = INVALID_GID; + + dev->ethtool_ops = &tun_ethtool_ops; + dev->destructor = tun_free_netdev; +} + +/* Trivial set of netlink ops to allow deleting tun or tap + * device with netlink. + */ +static int tun_validate(struct nlattr *tb[], struct nlattr *data[]) +{ + return -EINVAL; +} + +static struct rtnl_link_ops tun_link_ops __read_mostly = { + .kind = DRV_NAME, + .priv_size = sizeof(struct tun_struct), + .setup = tun_setup, + .validate = tun_validate, +}; + +static void tun_sock_write_space(struct sock *sk) +{ + struct tun_file *tfile; + wait_queue_head_t *wqueue; + + if (!sock_writeable(sk)) + return; + + if (!test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags)) + return; + + wqueue = sk_sleep(sk); + if (wqueue && waitqueue_active(wqueue)) + wake_up_interruptible_sync_poll(wqueue, POLLOUT | + POLLWRNORM | POLLWRBAND); + + tfile = container_of(sk, struct tun_file, sk); + kill_fasync(&tfile->fasync, SIGIO, POLL_OUT); +} + +static int tun_sendmsg(struct kiocb *iocb, struct socket *sock, + struct msghdr *m, size_t total_len) +{ + int ret; + struct tun_file *tfile = container_of(sock, struct tun_file, socket); + struct tun_struct *tun = __tun_get(tfile); + + if (!tun) + return -EBADFD; + ret = tun_get_user(tun, tfile, m->msg_control, m->msg_iov, total_len, + m->msg_iovlen, m->msg_flags & MSG_DONTWAIT); + tun_put(tun); + return ret; +} + +static int tun_recvmsg(struct kiocb *iocb, struct socket *sock, + struct msghdr *m, size_t total_len, + int flags) +{ + struct tun_file *tfile = container_of(sock, struct tun_file, socket); + struct tun_struct *tun = __tun_get(tfile); + int ret; + + if (!tun) + return -EBADFD; + + if (flags & ~(MSG_DONTWAIT|MSG_TRUNC|MSG_ERRQUEUE)) { + ret = -EINVAL; + goto out; + } + if (flags & MSG_ERRQUEUE) { + ret = sock_recv_errqueue(sock->sk, m, total_len, + SOL_PACKET, TUN_TX_TIMESTAMP); + goto out; + } + ret = tun_do_read(tun, tfile, m->msg_iov, total_len, + flags & MSG_DONTWAIT); + if (ret > total_len) { + m->msg_flags |= MSG_TRUNC; + ret = flags & MSG_TRUNC ? ret : total_len; + } +out: + tun_put(tun); + return ret; +} + +static int tun_release(struct socket *sock) +{ + if (sock->sk) + sock_put(sock->sk); + return 0; +} + +/* Ops structure to mimic raw sockets with tun */ +static const struct proto_ops tun_socket_ops = { + .sendmsg = tun_sendmsg, + .recvmsg = tun_recvmsg, + .release = tun_release, +}; + +static struct proto tun_proto = { + .name = "bf_tun", + .owner = THIS_MODULE, + .obj_size = sizeof(struct tun_file), +}; + +static int tun_flags(struct tun_struct *tun) +{ + int flags = 0; + + if (tun->flags & TUN_TUN_DEV) + flags |= IFF_TUN; + else + flags |= IFF_TAP; + + if (tun->flags & TUN_NO_PI) + flags |= IFF_NO_PI; + + /* This flag has no real effect. We track the value for backwards + * compatibility. + */ + if (tun->flags & TUN_ONE_QUEUE) + flags |= IFF_ONE_QUEUE; + + if (tun->flags & TUN_VNET_HDR) + flags |= IFF_VNET_HDR; + + if (tun->flags & TUN_TAP_MQ) + flags |= IFF_MULTI_QUEUE; + + if (tun->flags & TUN_PERSIST) + flags |= IFF_PERSIST; + + return flags; +} + +static ssize_t tun_show_flags(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct tun_struct *tun = netdev_priv(to_net_dev(dev)); + return sprintf(buf, "0x%x\n", tun_flags(tun)); +} + +static ssize_t tun_show_owner(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct tun_struct *tun = netdev_priv(to_net_dev(dev)); + return uid_valid(tun->owner)? + sprintf(buf, "%u\n", + from_kuid_munged(current_user_ns(), tun->owner)): + sprintf(buf, "-1\n"); +} + +static ssize_t tun_show_group(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct tun_struct *tun = netdev_priv(to_net_dev(dev)); + return gid_valid(tun->group) ? + sprintf(buf, "%u\n", + from_kgid_munged(current_user_ns(), tun->group)): + sprintf(buf, "-1\n"); +} + +static DEVICE_ATTR(tun_flags, 0444, tun_show_flags, NULL); +static DEVICE_ATTR(owner, 0444, tun_show_owner, NULL); +static DEVICE_ATTR(group, 0444, tun_show_group, NULL); + +static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) +{ + struct tun_struct *tun; + struct tun_file *tfile = file->private_data; + struct net_device *dev; + int err; + + if (tfile->detached) + return -EINVAL; + + dev = __dev_get_by_name(net, ifr->ifr_name); + if (dev) { + if (ifr->ifr_flags & IFF_TUN_EXCL) + return -EBUSY; + if ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops) + tun = netdev_priv(dev); + else if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops) + tun = netdev_priv(dev); + else + return -EINVAL; + + if (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) != + !!(tun->flags & TUN_TAP_MQ)) + return -EINVAL; + + if (tun_not_capable(tun)) + return -EPERM; + err = security_tun_dev_open(tun->security); + if (err < 0) + return err; + + err = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER); + if (err < 0) + return err; + + if (tun->flags & TUN_TAP_MQ && + (tun->numqueues + tun->numdisabled > 1)) { + /* One or more queue has already been attached, no need + * to initialize the device again. + */ + return 0; + } + } + else { + char *name; + unsigned long flags = 0; + int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ? + MAX_TAP_QUEUES : 1; + + if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) + return -EPERM; + err = security_tun_dev_create(); + if (err < 0) + return err; + + /* Set dev type */ + if (ifr->ifr_flags & IFF_TUN) { + /* TUN device */ + flags |= TUN_TUN_DEV; + name = "tun%d"; + } else if (ifr->ifr_flags & IFF_TAP) { + /* TAP device */ + flags |= TUN_TAP_DEV; + name = "tap%d"; + } else + return -EINVAL; + + if (*ifr->ifr_name) + name = ifr->ifr_name; + + dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, + tun_setup, queues, queues); + + if (!dev) + return -ENOMEM; + + dev_net_set(dev, net); + dev->rtnl_link_ops = &tun_link_ops; + dev->ifindex = tfile->ifindex; + + tun = netdev_priv(dev); + tun->dev = dev; + tun->flags = flags; + tun->txflt.count = 0; + tun->vnet_hdr_sz = sizeof(struct virtio_net_hdr); + + tun->filter_attached = false; + tun->sndbuf = tfile->socket.sk->sk_sndbuf; + + spin_lock_init(&tun->lock); + + err = security_tun_dev_alloc_security(&tun->security); + if (err < 0) + goto err_free_dev; + + tun_net_init(dev); + tun_flow_init(tun); + + dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | + TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX; + dev->features = dev->hw_features; + dev->vlan_features = dev->features & + ~(NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_STAG_TX); + + INIT_LIST_HEAD(&tun->disabled); + err = tun_attach(tun, file, false); + if (err < 0) + goto err_free_flow; + + err = register_netdevice(tun->dev); + if (err < 0) + goto err_detach; + + if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) || + device_create_file(&tun->dev->dev, &dev_attr_owner) || + device_create_file(&tun->dev->dev, &dev_attr_group)) + pr_err("Failed to create tun sysfs files\n"); + } + + netif_carrier_on(tun->dev); + + tun_debug(KERN_INFO, tun, "tun_set_iff\n"); + + if (ifr->ifr_flags & IFF_NO_PI) + tun->flags |= TUN_NO_PI; + else + tun->flags &= ~TUN_NO_PI; + + /* This flag has no real effect. We track the value for backwards + * compatibility. + */ + if (ifr->ifr_flags & IFF_ONE_QUEUE) + tun->flags |= TUN_ONE_QUEUE; + else + tun->flags &= ~TUN_ONE_QUEUE; + + if (ifr->ifr_flags & IFF_VNET_HDR) + tun->flags |= TUN_VNET_HDR; + else + tun->flags &= ~TUN_VNET_HDR; + + if (ifr->ifr_flags & IFF_MULTI_QUEUE) + tun->flags |= TUN_TAP_MQ; + else + tun->flags &= ~TUN_TAP_MQ; + + /* Make sure persistent devices do not get stuck in + * xoff state. + */ + if (netif_running(tun->dev)) + netif_tx_wake_all_queues(tun->dev); + + strcpy(ifr->ifr_name, tun->dev->name); + return 0; + +err_detach: + tun_detach_all(dev); +err_free_flow: + tun_flow_uninit(tun); + security_tun_dev_free_security(tun->security); +err_free_dev: + free_netdev(dev); + return err; +} + +static void tun_get_iff(struct net *net, struct tun_struct *tun, + struct ifreq *ifr) +{ + tun_debug(KERN_INFO, tun, "tun_get_iff\n"); + + strcpy(ifr->ifr_name, tun->dev->name); + + ifr->ifr_flags = tun_flags(tun); + +} + +/* This is like a cut-down ethtool ops, except done via tun fd so no + * privs required. */ +static int set_offload(struct tun_struct *tun, unsigned long arg) +{ + netdev_features_t features = 0; + + if (arg & TUN_F_CSUM) { + features |= NETIF_F_HW_CSUM; + arg &= ~TUN_F_CSUM; + + if (arg & (TUN_F_TSO4|TUN_F_TSO6)) { + if (arg & TUN_F_TSO_ECN) { + features |= NETIF_F_TSO_ECN; + arg &= ~TUN_F_TSO_ECN; + } + if (arg & TUN_F_TSO4) + features |= NETIF_F_TSO; + if (arg & TUN_F_TSO6) + features |= NETIF_F_TSO6; + arg &= ~(TUN_F_TSO4|TUN_F_TSO6); + } + + if (arg & TUN_F_UFO) { + features |= NETIF_F_UFO; + arg &= ~TUN_F_UFO; + } + } + + /* This gives the user a way to test for new features in future by + * trying to set them. */ + if (arg) + return -EINVAL; + + tun->set_features = features; + netdev_update_features(tun->dev); + + return 0; +} + +static void tun_detach_filter(struct tun_struct *tun, int n) +{ + int i; + struct tun_file *tfile; + + for (i = 0; i < n; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + __sk_detach_filter(tfile->socket.sk, lockdep_rtnl_is_held()); + } + + tun->filter_attached = false; +} + +static int tun_attach_filter(struct tun_struct *tun) +{ + int i, ret = 0; + struct tun_file *tfile; + + for (i = 0; i < tun->numqueues; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + ret = __sk_attach_filter(&tun->fprog, tfile->socket.sk, + lockdep_rtnl_is_held()); + if (ret) { + tun_detach_filter(tun, i); + return ret; + } + } + + tun->filter_attached = true; + return ret; +} + +static void tun_set_sndbuf(struct tun_struct *tun) +{ + struct tun_file *tfile; + int i; + + for (i = 0; i < tun->numqueues; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + tfile->socket.sk->sk_sndbuf = tun->sndbuf; + } +} + +static int tun_set_queue(struct file *file, struct ifreq *ifr) +{ + struct tun_file *tfile = file->private_data; + struct tun_struct *tun; + int ret = 0; + + rtnl_lock(); + + if (ifr->ifr_flags & IFF_ATTACH_QUEUE) { + tun = tfile->detached; + if (!tun) { + ret = -EINVAL; + goto unlock; + } + ret = security_tun_dev_attach_queue(tun->security); + if (ret < 0) + goto unlock; + ret = tun_attach(tun, file, false); + } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { + tun = rtnl_dereference(tfile->tun); + if (!tun || !(tun->flags & TUN_TAP_MQ) || tfile->detached) + ret = -EINVAL; + else + __tun_detach(tfile, false); + } else + ret = -EINVAL; + +unlock: + rtnl_unlock(); + return ret; +} + +static long __tun_chr_ioctl(struct file *file, unsigned int cmd, + unsigned long arg, int ifreq_len) +{ + struct tun_file *tfile = file->private_data; + struct tun_struct *tun; + void __user* argp = (void __user*)arg; + struct ifreq ifr; + kuid_t owner; + kgid_t group; + int sndbuf; + int vnet_hdr_sz; + unsigned int ifindex; + int ret; + + if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == 0x89) { + if (copy_from_user(&ifr, argp, ifreq_len)) + return -EFAULT; + } else { + memset(&ifr, 0, sizeof(ifr)); + } + if (cmd == TUNGETFEATURES) { + /* Currently this just means: "what IFF flags are valid?". + * This is needed because we never checked for invalid flags on + * TUNSETIFF. */ + return put_user(IFF_TUN | IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE | + IFF_VNET_HDR | IFF_MULTI_QUEUE, + (unsigned int __user*)argp); + } else if (cmd == TUNSETQUEUE) + return tun_set_queue(file, &ifr); + + ret = 0; + rtnl_lock(); + + tun = __tun_get(tfile); + if (cmd == TUNSETIFF && !tun) { + ifr.ifr_name[IFNAMSIZ-1] = '\0'; + + ret = tun_set_iff(tfile->net, file, &ifr); + + if (ret) + goto unlock; + + if (copy_to_user(argp, &ifr, ifreq_len)) + ret = -EFAULT; + goto unlock; + } + if (cmd == TUNSETIFINDEX) { + ret = -EPERM; + if (tun) + goto unlock; + + ret = -EFAULT; + if (copy_from_user(&ifindex, argp, sizeof(ifindex))) + goto unlock; + + ret = 0; + tfile->ifindex = ifindex; + goto unlock; + } + + ret = -EBADFD; + if (!tun) + goto unlock; + + tun_debug(KERN_INFO, tun, "tun_chr_ioctl cmd %u\n", cmd); + + ret = 0; + switch (cmd) { + case TUNGETIFF: + tun_get_iff(current->nsproxy->net_ns, tun, &ifr); + + if (tfile->detached) + ifr.ifr_flags |= IFF_DETACH_QUEUE; + if (!tfile->socket.sk->sk_filter) + ifr.ifr_flags |= IFF_NOFILTER; + + if (copy_to_user(argp, &ifr, ifreq_len)) + ret = -EFAULT; + break; + + case TUNSETNOCSUM: + /* Disable/Enable checksum */ + + /* [unimplemented] */ + tun_debug(KERN_INFO, tun, "ignored: set checksum %s\n", + arg ? "disabled" : "enabled"); + break; + + case TUNSETPERSIST: + /* Disable/Enable persist mode. Keep an extra reference to the + * module to prevent the module being unprobed. + */ + if (arg && !(tun->flags & TUN_PERSIST)) { + tun->flags |= TUN_PERSIST; + __module_get(THIS_MODULE); + } + if (!arg && (tun->flags & TUN_PERSIST)) { + tun->flags &= ~TUN_PERSIST; + module_put(THIS_MODULE); + } + + tun_debug(KERN_INFO, tun, "persist %s\n", + arg ? "enabled" : "disabled"); + break; + + case TUNSETOWNER: + /* Set owner of the device */ + owner = make_kuid(current_user_ns(), arg); + if (!uid_valid(owner)) { + ret = -EINVAL; + break; + } + tun->owner = owner; + tun_debug(KERN_INFO, tun, "owner set to %u\n", + from_kuid(&init_user_ns, tun->owner)); + break; + + case TUNSETGROUP: + /* Set group of the device */ + group = make_kgid(current_user_ns(), arg); + if (!gid_valid(group)) { + ret = -EINVAL; + break; + } + tun->group = group; + tun_debug(KERN_INFO, tun, "group set to %u\n", + from_kgid(&init_user_ns, tun->group)); + break; + + case TUNSETLINK: + /* Only allow setting the type when the interface is down */ + if (tun->dev->flags & IFF_UP) { + tun_debug(KERN_INFO, tun, + "Linktype set failed because interface is up\n"); + ret = -EBUSY; + } else { + tun->dev->type = (int) arg; + tun_debug(KERN_INFO, tun, "linktype set to %d\n", + tun->dev->type); + ret = 0; + } + break; + +#ifdef TUN_DEBUG + case TUNSETDEBUG: + tun->debug = arg; + break; +#endif + case TUNSETOFFLOAD: + ret = set_offload(tun, arg); + break; + + case TUNSETTXFILTER: + /* Can be set only for TAPs */ + ret = -EINVAL; + if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + break; + ret = update_filter(&tun->txflt, (void __user *)arg); + break; + + case SIOCGIFHWADDR: + /* Get hw address */ + memcpy(ifr.ifr_hwaddr.sa_data, tun->dev->dev_addr, ETH_ALEN); + ifr.ifr_hwaddr.sa_family = tun->dev->type; + if (copy_to_user(argp, &ifr, ifreq_len)) + ret = -EFAULT; + break; + + case SIOCSIFHWADDR: + /* Set hw address */ + tun_debug(KERN_DEBUG, tun, "set hw address: %pM\n", + ifr.ifr_hwaddr.sa_data); + + ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); + break; + + case TUNGETSNDBUF: + sndbuf = tfile->socket.sk->sk_sndbuf; + if (copy_to_user(argp, &sndbuf, sizeof(sndbuf))) + ret = -EFAULT; + break; + + case TUNSETSNDBUF: + if (copy_from_user(&sndbuf, argp, sizeof(sndbuf))) { + ret = -EFAULT; + break; + } + + tun->sndbuf = sndbuf; + tun_set_sndbuf(tun); + break; + + case TUNGETVNETHDRSZ: + vnet_hdr_sz = tun->vnet_hdr_sz; + if (copy_to_user(argp, &vnet_hdr_sz, sizeof(vnet_hdr_sz))) + ret = -EFAULT; + break; + + case TUNSETVNETHDRSZ: + if (copy_from_user(&vnet_hdr_sz, argp, sizeof(vnet_hdr_sz))) { + ret = -EFAULT; + break; + } + if (vnet_hdr_sz < (int)sizeof(struct virtio_net_hdr)) { + ret = -EINVAL; + break; + } + + tun->vnet_hdr_sz = vnet_hdr_sz; + break; + + case TUNATTACHFILTER: + /* Can be set only for TAPs */ + ret = -EINVAL; + if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + break; + ret = -EFAULT; + if (copy_from_user(&tun->fprog, argp, sizeof(tun->fprog))) + break; + + ret = tun_attach_filter(tun); + break; + + case TUNDETACHFILTER: + /* Can be set only for TAPs */ + ret = -EINVAL; + if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + break; + ret = 0; + tun_detach_filter(tun, tun->numqueues); + break; + + case TUNGETFILTER: + ret = -EINVAL; + if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + break; + ret = -EFAULT; + if (copy_to_user(argp, &tun->fprog, sizeof(tun->fprog))) + break; + ret = 0; + break; + + default: + ret = -EINVAL; + break; + } + +unlock: + rtnl_unlock(); + if (tun) + tun_put(tun); + return ret; +} + +static long tun_chr_ioctl(struct file *file, + unsigned int cmd, unsigned long arg) +{ + return __tun_chr_ioctl(file, cmd, arg, sizeof (struct ifreq)); +} + +#ifdef CONFIG_COMPAT +static long tun_chr_compat_ioctl(struct file *file, + unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case TUNSETIFF: + case TUNGETIFF: + case TUNSETTXFILTER: + case TUNGETSNDBUF: + case TUNSETSNDBUF: + case SIOCGIFHWADDR: + case SIOCSIFHWADDR: + arg = (unsigned long)compat_ptr(arg); + break; + default: + arg = (compat_ulong_t)arg; + break; + } + + /* + * compat_ifreq is shorter than ifreq, so we must not access beyond + * the end of that structure. All fields that are used in this + * driver are compatible though, we don't need to convert the + * contents. + */ + return __tun_chr_ioctl(file, cmd, arg, sizeof(struct compat_ifreq)); +} +#endif /* CONFIG_COMPAT */ + +static int tun_chr_fasync(int fd, struct file *file, int on) +{ + struct tun_file *tfile = file->private_data; + int ret; + + if ((ret = fasync_helper(fd, file, on, &tfile->fasync)) < 0) + goto out; + + if (on) { + ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0); + if (ret) + goto out; + tfile->flags |= TUN_FASYNC; + } else + tfile->flags &= ~TUN_FASYNC; + ret = 0; +out: + return ret; +} + +static int tun_chr_open(struct inode *inode, struct file * file) +{ + struct tun_file *tfile; + + DBG1(KERN_INFO, "tunX: tun_chr_open\n"); + + tfile = (struct tun_file *)sk_alloc(&init_net, AF_UNSPEC, GFP_KERNEL, + &tun_proto); + if (!tfile) + return -ENOMEM; + RCU_INIT_POINTER(tfile->tun, NULL); + tfile->net = get_net(current->nsproxy->net_ns); + tfile->flags = 0; + tfile->ifindex = 0; + + init_waitqueue_head(&tfile->wq.wait); + RCU_INIT_POINTER(tfile->socket.wq, &tfile->wq); + + tfile->socket.file = file; + tfile->socket.ops = &tun_socket_ops; + + sock_init_data(&tfile->socket, &tfile->sk); + sk_change_net(&tfile->sk, tfile->net); + + tfile->sk.sk_write_space = tun_sock_write_space; + tfile->sk.sk_sndbuf = INT_MAX; + + file->private_data = tfile; + set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags); + INIT_LIST_HEAD(&tfile->next); + + sock_set_flag(&tfile->sk, SOCK_ZEROCOPY); + + return 0; +} + +static int tun_chr_close(struct inode *inode, struct file *file) +{ + struct tun_file *tfile = file->private_data; + struct net *net = tfile->net; + + tun_detach(tfile, true); + put_net(net); + + return 0; +} + +#ifdef CONFIG_PROC_FS +static int tun_chr_show_fdinfo(struct seq_file *m, struct file *f) +{ + struct tun_struct *tun; + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); + + rtnl_lock(); + tun = tun_get(f); + if (tun) + tun_get_iff(current->nsproxy->net_ns, tun, &ifr); + rtnl_unlock(); + + if (tun) + tun_put(tun); + + return seq_printf(m, "iff:\t%s\n", ifr.ifr_name); +} +#endif + +static const struct file_operations tun_fops = { + .owner = THIS_MODULE, + .llseek = no_llseek, + .read = do_sync_read, + .aio_read = tun_chr_aio_read, + .write = do_sync_write, + .aio_write = tun_chr_aio_write, + .poll = tun_chr_poll, + .unlocked_ioctl = tun_chr_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = tun_chr_compat_ioctl, +#endif + .open = tun_chr_open, + .release = tun_chr_close, + .fasync = tun_chr_fasync, +#ifdef CONFIG_PROC_FS + .show_fdinfo = tun_chr_show_fdinfo, +#endif +}; + +static struct miscdevice tun_miscdev = { + .minor = (TUN_MINOR1), + .name = "bf_tun", + .nodename = "net/bf_tun", + .fops = &tun_fops, +}; + +/* ethtool interface */ + +static int tun_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +{ + cmd->supported = 0; + cmd->advertising = 0; + ethtool_cmd_speed_set(cmd, SPEED_10); + cmd->duplex = DUPLEX_FULL; + cmd->port = PORT_TP; + cmd->phy_address = 0; + cmd->transceiver = XCVR_INTERNAL; + cmd->autoneg = AUTONEG_DISABLE; + cmd->maxtxpkt = 0; + cmd->maxrxpkt = 0; + return 0; +} + +static void tun_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) +{ + struct tun_struct *tun = netdev_priv(dev); + + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); + + switch (tun->flags & TUN_TYPE_MASK) { + case TUN_TUN_DEV: + strlcpy(info->bus_info, "bf_tun", sizeof(info->bus_info)); + break; + case TUN_TAP_DEV: + strlcpy(info->bus_info, "tap", sizeof(info->bus_info)); + break; + } +} + +static u32 tun_get_msglevel(struct net_device *dev) +{ +#ifdef TUN_DEBUG + struct tun_struct *tun = netdev_priv(dev); + return tun->debug; +#else + return -EOPNOTSUPP; +#endif +} + +static void tun_set_msglevel(struct net_device *dev, u32 value) +{ +#ifdef TUN_DEBUG + struct tun_struct *tun = netdev_priv(dev); + tun->debug = value; +#endif +} + +static const struct ethtool_ops tun_ethtool_ops = { + .get_settings = tun_get_settings, + .get_drvinfo = tun_get_drvinfo, + .get_msglevel = tun_get_msglevel, + .set_msglevel = tun_set_msglevel, + .get_link = ethtool_op_get_link, + .get_ts_info = ethtool_op_get_ts_info, +}; + + +static int __init tun_init(void) +{ + int ret = 0; + + pr_info("%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); + pr_info("%s\n", DRV_COPYRIGHT); + + ret = rtnl_link_register(&tun_link_ops); + if (ret) { + pr_err("Can't register link_ops\n"); + goto err_linkops; + } + + ret = misc_register(&tun_miscdev); + if (ret) { + pr_err("Can't register misc device %d\n", (TUN_MINOR1)); + goto err_misc; + } + return 0; +err_misc: + rtnl_link_unregister(&tun_link_ops); +err_linkops: + return ret; +} + +static void tun_cleanup(void) +{ + misc_deregister(&tun_miscdev); + rtnl_link_unregister(&tun_link_ops); +} + +/* Get an underlying socket object from tun file. Returns error unless file is + * attached to a device. The returned object works like a packet socket, it + * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for + * holding a reference to the file for as long as the socket is in use. */ +struct socket *bf_tun_get_socket(struct file *file) +{ + struct tun_file *tfile; + if (file->f_op != &tun_fops) + return ERR_PTR(-EINVAL); + tfile = file->private_data; + if (!tfile) + return ERR_PTR(-EBADFD); + return &tfile->socket; +} +EXPORT_SYMBOL_GPL(bf_tun_get_socket); + +module_init(tun_init); +module_exit(tun_cleanup); +MODULE_DESCRIPTION(DRV_DESCRIPTION); +MODULE_AUTHOR(DRV_COPYRIGHT); +MODULE_LICENSE("GPL"); +MODULE_ALIAS_MISCDEV(TUN_MINOR1); +MODULE_ALIAS("devname:net/bf_tun"); diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/i2c-mcp2221.c b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/i2c-mcp2221.c new file mode 100644 index 000000000000..fcaa57fbafac --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/i2c-mcp2221.c @@ -0,0 +1,611 @@ +/* + * i2c bus driver for MCP2221 + * + * Derived from: + * i2c-tiny-usb.c + * i2c-diolan-u2c.c + * usb-serial.c + * onetouch.c + * usb-skeleton.c + * + * Copyright (C) 2014 Microchip Technology Inc. + * + * Author: Bogdan Bolocan http://www.microchip.com/support + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "i2c-mcp2221" + +#define USB_VENDOR_ID_MCP2221 0x04d8 +#define USB_DEVICE_ID_MCP2221 0x00dd + +#define MCP2221_OUTBUF_LEN 64 /* USB write packet length */ +#define MCP2221_INBUF_LEN 64 /* USB read packet length */ + +#define MCP2221_MAX_I2C_DATA_LEN 60 + +//#define MCP2221_FREQ_STD 100000 +#define MCP2221_FREQ_STD 400000 +//#define MCP2221_FREQ_STD 50000 +#define MCP2221_FREQ_MAX 500000 + +#define MCP2221_RETRY_MAX 50 +#define MCP2221_STD_DELAY_MS 1 +//#define MCP2221_STD_DELAY_MS 2 + +#define RESP_ERR_NOERR 0x00 +#define RESP_ADDR_NACK 0x25 +#define RESP_READ_ERR 0x7F +#define RESP_READ_COMPL 0x55 +#define RESP_I2C_IDLE 0x00 +#define RESP_I2C_START_TOUT 0x12 +#define RESP_I2C_RSTART_TOUT 0x17 +#define RESP_I2C_WRADDRL_TOUT 0x23 +#define RESP_I2C_WRADDRL_WSEND 0x21 +#define RESP_I2C_WRADDRL_NACK 0x25 +#define RESP_I2C_WRDATA_TOUT 0x44 +#define RESP_I2C_RDDATA_TOUT 0x52 +#define RESP_I2C_STOP_TOUT 0x62 + +#define CMD_MCP2221_STATUS 0x10 +#define SUBCMD_STATUS_CANCEL 0x10 +#define SUBCMD_STATUS_SPEED 0x20 +#define MASK_ADDR_NACK 0x40 + +#define CMD_MCP2221_RDDATA7 0x91 +#define CMD_MCP2221_GET_RDDATA 0x40 + +#define CMD_MCP2221_WRDATA7 0x90 + +/* Structure to hold all of our device specific stuff */ +struct i2c_mcp2221 { + u8 obuffer[MCP2221_OUTBUF_LEN]; /* USB write buffer */ + u8 ibuffer[MCP2221_INBUF_LEN]; /* USB read buffer */ + /* I2C/SMBus data buffer */ + u8 user_data_buffer[MCP2221_MAX_I2C_DATA_LEN]; + int ep_in, ep_out; /* Endpoints */ + struct usb_device *usb_dev; /* the usb device for this device */ + struct usb_interface *interface;/* the interface for this device */ + struct i2c_adapter adapter; /* i2c related things */ + uint frequency; /* I2C/SMBus communication frequency */ + /* Mutex for low-level USB transactions */ + struct mutex mcp2221_usb_op_lock; + /* wq to wait for an ongoing read/write */ + wait_queue_head_t usb_urb_completion_wait; + bool ongoing_usb_ll_op; /* a ll is in progress */ + + struct urb *interrupt_in_urb; + struct urb *interrupt_out_urb; +}; + +static uint frequency = MCP2221_FREQ_STD; /* I2C clock frequency in Hz */ + +module_param(frequency, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(frequency, "I2C clock frequency in hertz"); + +/* usb layer */ + + +/* + * Return list of supported functionality. + */ +static u32 mcp2221_usb_func(struct i2c_adapter *a) +{ + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | + I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL; +} + +static void mcp2221_usb_cmpl_cbk(struct urb *urb) +{ + struct i2c_mcp2221 *dev = urb->context; + int status = urb->status; + int retval; + + switch (status) { + case 0: /* success */ + break; + case -ECONNRESET: /* unlink */ + case -ENOENT: + case -ESHUTDOWN: + return; + /* -EPIPE: should clear the halt */ + default: /* error */ + goto resubmit; + } + + /* wake up the waitting function + modify the flag indicating the ll status */ + dev->ongoing_usb_ll_op = 0; + wake_up_interruptible(&dev->usb_urb_completion_wait); + return; + +resubmit: + retval = usb_submit_urb(urb, GFP_ATOMIC); + if (retval) { + dev_err(&dev->interface->dev, + "mcp2221(irq): can't resubmit intrerrupt urb, retval %d\n", + retval); + } +} + +static int mcp2221_ll_cmd(struct i2c_mcp2221 *dev) +{ + int rv; + + /* tell everybody to leave the URB alone */ + dev->ongoing_usb_ll_op = 1; + + /* submit the interrupt out ep packet */ + if (usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL)) { + dev_err(&dev->interface->dev, + "mcp2221(ll): usb_submit_urb intr out failed\n"); + dev->ongoing_usb_ll_op = 0; + return -EIO; + } + + /* wait for its completion */ + rv = wait_event_interruptible(dev->usb_urb_completion_wait, + (!dev->ongoing_usb_ll_op)); + if (rv < 0) { + dev_err(&dev->interface->dev, "mcp2221(ll): wait interrupted\n"); + goto ll_exit_clear_flag; + } + + /* tell everybody to leave the URB alone */ + dev->ongoing_usb_ll_op = 1; + + /* submit the interrupt in ep packet */ + if (usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL)) { + dev_err(&dev->interface->dev, "mcp2221(ll): usb_submit_urb intr in failed\n"); + dev->ongoing_usb_ll_op = 0; + return -EIO; + } + + /* wait for its completion */ + rv = wait_event_interruptible(dev->usb_urb_completion_wait, + (!dev->ongoing_usb_ll_op)); + if (rv < 0) { + dev_err(&dev->interface->dev, "mcp2221(ll): wait interrupted\n"); + goto ll_exit_clear_flag; + } + +ll_exit_clear_flag: + dev->ongoing_usb_ll_op = 0; + return rv; +} + +static int mcp2221_init(struct i2c_mcp2221 *dev) +{ + int ret; + + ret = 0; + if (frequency > MCP2221_FREQ_MAX) + frequency = MCP2221_FREQ_MAX; + + /* initialize the MCP2221 and bring it to "idle/ready" state */ + dev_info(&dev->interface->dev, + "MCP2221 at USB bus %03d address %03d Freq=%dKhz-- mcp2221_init()\n", + dev->usb_dev->bus->busnum, dev->usb_dev->devnum, frequency/1000); + + /* initialize unlocked mutex */ + mutex_init(&dev->mcp2221_usb_op_lock); + + dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); + if (!dev->interrupt_out_urb) + goto init_error; + + usb_fill_int_urb(dev->interrupt_out_urb, dev->usb_dev, + usb_sndintpipe(dev->usb_dev, + dev->ep_out), + (void *)&dev->obuffer, MCP2221_OUTBUF_LEN, + mcp2221_usb_cmpl_cbk, dev, + 1); + + dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); + if (!dev->interrupt_in_urb) + goto init_error; + + usb_fill_int_urb(dev->interrupt_in_urb, dev->usb_dev, + usb_rcvintpipe(dev->usb_dev, + dev->ep_in), + (void *)&dev->ibuffer, MCP2221_INBUF_LEN, + mcp2221_usb_cmpl_cbk, dev, + 1); + ret = 0; + goto init_no_error; + +init_error: + dev_err(&dev->interface->dev, "mcp2221_init: Error = %d\n", ret); + ret = -ENODEV; + +init_no_error: + dev_info(&dev->interface->dev, "mcp2221_init: Success\n"); + return ret; +} + +static int mcp2221_i2c_readwrite(struct i2c_mcp2221 *dev, + struct i2c_msg *pmsg) +{ + u8 ucI2cDiv, ucCancelXfer, ucXferLen; + int rv, retries; + unsigned int sleepCmd; + u8 *pSrc, *pDst, usbCmdStatus; + + retries = 0; + ucCancelXfer = 0; + /* clock divider for I2C operations */ + ucI2cDiv = (u8)((12000000/frequency) - 3); + + /* determine the best delay value here */ + /* (MCP2221_STD_DELAY_MS * MCP2221_FREQ_MAX)/frequency; */ + sleepCmd = MCP2221_STD_DELAY_MS; + + if (pmsg->len > MCP2221_MAX_I2C_DATA_LEN) + return -EINVAL; + +readwrite_reinit: + dev->obuffer[0] = CMD_MCP2221_STATUS; /* code for STATUS cmd */ + dev->obuffer[1] = 0x00; + dev->obuffer[2] = ucCancelXfer; /* cancel subcmd */ + dev->obuffer[3] = SUBCMD_STATUS_SPEED; /* set the xfer speed */ + dev->obuffer[4] = ucI2cDiv; + dev->obuffer[5] = 0x00; + dev->obuffer[6] = 0x00; + dev->obuffer[7] = 0x00; + + rv = mcp2221_ll_cmd(dev); + if (rv < 0) + return -EFAULT; + + if (dev->ibuffer[1] != RESP_ERR_NOERR) + return -EFAULT; + + if (dev->ibuffer[3] != SUBCMD_STATUS_SPEED) { + /* the speed could not be set - wait a while and retry */ + if (retries < MCP2221_RETRY_MAX) { + /* wait a while and retry the operation */ + retries++; + msleep(MCP2221_STD_DELAY_MS); + ucCancelXfer = SUBCMD_STATUS_CANCEL; + goto readwrite_reinit; + } else { + /* max number of retries was reached - return error */ + dev_err(&dev->interface->dev, + "mcp2221 CANCEL ERROR:retries = %d\n", retries); + return -EFAULT; + } + } + + if (pmsg->flags & I2C_M_RD) { + /* I2C read */ + ucXferLen = (u8)pmsg->len; + dev->obuffer[0] = CMD_MCP2221_RDDATA7; + dev->obuffer[1] = ucXferLen; /* LSB of the xfer length */ + dev->obuffer[2] = 0; /* no MSB for the xfer length */ + /* address in 8-bit format */ + dev->obuffer[3] = (u8)((pmsg->addr) << 1); + + rv = mcp2221_ll_cmd(dev); + if (rv < 0) + return -EFAULT; + + if (dev->ibuffer[1] != RESP_ERR_NOERR) + return -EFAULT; + + retries = 0; + dev->obuffer[0] = CMD_MCP2221_GET_RDDATA; + dev->obuffer[1] = 0x00; + dev->obuffer[2] = 0x00; + dev->obuffer[3] = 0x00; + + while (retries < MCP2221_RETRY_MAX) { + msleep(sleepCmd); + + rv = mcp2221_ll_cmd(dev); + if (rv < 0) + return -EFAULT; + + if (dev->ibuffer[1] != RESP_ERR_NOERR) + return -EFAULT; + + if (dev->ibuffer[2] == RESP_ADDR_NACK) + return -EFAULT; + + /* break the loop - cmd ended ok - used for bus scan */ + if ((dev->ibuffer[3] == 0x00) && + (dev->ibuffer[2] == 0x00)) + break; + + if (dev->ibuffer[3] == RESP_READ_ERR) { + retries++; + continue; + } + + if ((dev->ibuffer[2] == RESP_READ_COMPL) && + (dev->ibuffer[3] == ucXferLen)) { + /* we got the data - copy it */ + pSrc = (u8 *)&dev->ibuffer[4]; + pDst = (u8 *)&pmsg->buf[0]; + memcpy(pDst, pSrc, ucXferLen); + + if (pmsg->flags & I2C_M_RECV_LEN) + pmsg->len = ucXferLen; + + break; + } + + } + if (retries >= MCP2221_RETRY_MAX) + return -EFAULT; + } else { + /* I2C write */ + ucXferLen = (u8)pmsg->len; + dev->obuffer[0] = CMD_MCP2221_WRDATA7; + dev->obuffer[1] = ucXferLen; /* LSB of the xfer length */ + dev->obuffer[2] = 0; /* no MSB for the xfer length */ + /* address in 8-bit format */ + dev->obuffer[3] = (u8)((pmsg->addr) << 1); + /* copy the data we've read back */ + pSrc = (u8 *)&pmsg->buf[0]; + pDst = (u8 *)&dev->obuffer[4]; + memcpy(pDst, pSrc, ucXferLen); + + retries = 0; + + while (retries < MCP2221_RETRY_MAX) { + rv = mcp2221_ll_cmd(dev); + if (rv < 0) + return -EFAULT; + + if (dev->ibuffer[1] != RESP_ERR_NOERR) { + usbCmdStatus = dev->ibuffer[2]; + if (usbCmdStatus == RESP_I2C_START_TOUT) + return -EFAULT; + + if (usbCmdStatus == RESP_I2C_WRADDRL_TOUT) + return -EFAULT; + + if (usbCmdStatus == RESP_I2C_WRADDRL_NACK) + return -EFAULT; + + if (usbCmdStatus == RESP_I2C_WRDATA_TOUT) + return -EFAULT; + + if (usbCmdStatus == RESP_I2C_STOP_TOUT) + return -EFAULT; + + msleep(sleepCmd); + retries++; + continue; + } else { /* command completed successfully */ + break; + } + } + if (retries >= MCP2221_RETRY_MAX) + return -EFAULT; + + /* now, prepare for the STATUS stage */ + retries = 0; + dev->obuffer[0] = CMD_MCP2221_STATUS; /* code for STATUS cmd */ + dev->obuffer[1] = 0x00; + dev->obuffer[2] = 0x00; + dev->obuffer[3] = 0x00; + dev->obuffer[4] = 0x00; + dev->obuffer[5] = 0x00; + dev->obuffer[6] = 0x00; + dev->obuffer[7] = 0x00; + + while (retries < MCP2221_RETRY_MAX) { + rv = mcp2221_ll_cmd(dev); + if (rv < 0) + return -EFAULT; + + if (dev->ibuffer[1] != RESP_ERR_NOERR) + return -EFAULT; + + /* i2c slave address was nack-ed */ + if (dev->ibuffer[20] & MASK_ADDR_NACK) + return -EFAULT; + + usbCmdStatus = dev->ibuffer[8]; + if (usbCmdStatus == RESP_I2C_IDLE) + break; + + if (usbCmdStatus == RESP_I2C_START_TOUT) + return -EFAULT; + + if (usbCmdStatus == RESP_I2C_WRADDRL_TOUT) + return -EFAULT; + + if (usbCmdStatus == RESP_I2C_WRADDRL_WSEND) + return -EFAULT; + + if (usbCmdStatus == RESP_I2C_WRADDRL_NACK) + return -EFAULT; + + if (usbCmdStatus == RESP_I2C_WRDATA_TOUT) + return -EFAULT; + + if (usbCmdStatus == RESP_I2C_STOP_TOUT) + return -EFAULT; + + msleep(sleepCmd); + retries++; + } + if (retries >= MCP2221_RETRY_MAX) + return -EFAULT; + } + + return 0; +} + +/* device layer */ +static int mcp2221_usb_i2c_xfer(struct i2c_adapter *adap, + struct i2c_msg *msgs, int num) +{ + struct i2c_mcp2221 *dev = i2c_get_adapdata(adap); + struct i2c_msg *pmsg; + int ret, count; + + for (count = 0; count < num; count++) { + pmsg = &msgs[count]; + /* no concurrent users of the mcp2221 i2c xfer */ + ret = mutex_lock_interruptible(&dev->mcp2221_usb_op_lock); + if (ret < 0) + goto abort; + + ret = mcp2221_i2c_readwrite(dev, pmsg); + mutex_unlock(&dev->mcp2221_usb_op_lock); + if (ret < 0) + goto abort; + } + + /* if all the messages were transferred ok, return "num" */ + ret = num; + +abort: + return ret; +} + +static const struct i2c_algorithm mcp2221_usb_algorithm = { + .master_xfer = mcp2221_usb_i2c_xfer, + .functionality = mcp2221_usb_func, +}; + +static const struct usb_device_id mcp2221_table[] = { + { USB_DEVICE(USB_VENDOR_ID_MCP2221, USB_DEVICE_ID_MCP2221) }, + { } +}; + +MODULE_DEVICE_TABLE(usb, mcp2221_table); + +static void mcp2221_free(struct i2c_mcp2221 *dev) +{ + usb_put_dev(dev->usb_dev); + kfree(dev); +} + +static int mcp2221_probe(struct usb_interface *interface, + const struct usb_device_id *id) +{ + struct usb_host_interface *hostif = interface->cur_altsetting; + struct i2c_mcp2221 *dev; + int ret; + + if ((hostif->desc.bInterfaceNumber != 2) + || (hostif->desc.bInterfaceClass != 3)) { + pr_info("i2c-mcp2221(probe): Interface doesn't match the MCP2221 HID\n"); + return -ENODEV; + } + + /* allocate memory for our device state and initialize it */ + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (dev == NULL) { + pr_info("i2c-mcp2221(probe): no memory for device state\n"); + ret = -ENOMEM; + goto error; + } + + dev->ep_in = hostif->endpoint[0].desc.bEndpointAddress; + dev->ep_out = hostif->endpoint[1].desc.bEndpointAddress; + + dev->usb_dev = usb_get_dev(interface_to_usbdev(interface)); + dev->interface = interface; + + init_waitqueue_head(&dev->usb_urb_completion_wait); + + /* save our data pointer in this interface device */ + usb_set_intfdata(interface, dev); + + /* setup i2c adapter description */ + dev->adapter.owner = THIS_MODULE; + dev->adapter.class = I2C_CLASS_HWMON; + dev->adapter.algo = &mcp2221_usb_algorithm; + i2c_set_adapdata(&dev->adapter, dev); + + snprintf(dev->adapter.name, sizeof(dev->adapter.name), + DRIVER_NAME " at bus %03d device %03d", + dev->usb_dev->bus->busnum, dev->usb_dev->devnum); + + dev->adapter.dev.parent = &dev->interface->dev; + + /* initialize mcp2221 i2c interface */ + ret = mcp2221_init(dev); + if (ret < 0) { + dev_err(&interface->dev, "failed to initialize adapter\n"); + goto error_free; + } + + /* and finally attach to i2c layer */ + ret = i2c_add_adapter(&dev->adapter); + if (ret < 0) { + dev_err(&interface->dev, "failed to add I2C adapter\n"); + goto error_free; + } + + dev_info(&dev->interface->dev, + "mcp2221_probe() -> chip connected -> Success\n"); + return 0; + +error_free: + usb_set_intfdata(interface, NULL); + mcp2221_free(dev); +error: + return ret; +} + +static void mcp2221_disconnect(struct usb_interface *interface) +{ + struct i2c_mcp2221 *dev = usb_get_intfdata(interface); + + i2c_del_adapter(&dev->adapter); + + usb_kill_urb(dev->interrupt_in_urb); + usb_kill_urb(dev->interrupt_out_urb); + usb_free_urb(dev->interrupt_in_urb); + usb_free_urb(dev->interrupt_out_urb); + + usb_set_intfdata(interface, NULL); + mcp2221_free(dev); + + pr_info("i2c-mcp2221(disconnect) -> chip disconnected"); +} + +static struct usb_driver mcp2221_driver = { + .name = DRIVER_NAME, + .probe = mcp2221_probe, + .disconnect = mcp2221_disconnect, + .id_table = mcp2221_table, +}; + +module_usb_driver(mcp2221_driver); + +MODULE_AUTHOR("Bogdan Bolocan"); +MODULE_DESCRIPTION(DRIVER_NAME "I2C MCP2221"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_cpld.c b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_cpld.c new file mode 100644 index 000000000000..3a7d40ba9177 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_cpld.c @@ -0,0 +1,198 @@ +/* + * wnc_cpld.c - A driver for control wnc_cpld base on lm75.c + * + * Copyright (c) 1998, 1999 Frodo Looijaard + * Copyright (c) 2017 WNC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x31, 0x32, I2C_CLIENT_END }; + +/* Size of EEPROM in bytes */ +#define CPLD_SIZE 3 + +/* Each client has this additional data */ +struct cpld_data { + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 data[CPLD_SIZE]; /* Register value */ +}; + +static ssize_t show_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + data->data[0] = i2c_smbus_read_byte_data(client, attr->index); + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%02x\n", data->data[0]); +} + +static ssize_t set_value(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 temp; + int error; + + error = kstrtou8(buf, 10, &temp); + if (error) + return error; + + mutex_lock(&data->update_lock); + i2c_smbus_write_byte_data(client, attr->index, temp); + mutex_unlock(&data->update_lock); + + return count; +} + +static SENSOR_DEVICE_ATTR(reset_control, S_IWUSR | S_IRUGO, show_value, set_value, 2); +static SENSOR_DEVICE_ATTR(sfp_mod_abs1, S_IRUGO, show_value, NULL, 3); +static SENSOR_DEVICE_ATTR(sfp_mod_abs2, S_IRUGO, show_value, NULL, 4); +static SENSOR_DEVICE_ATTR(sfp_mod_abs3, S_IRUGO, show_value, NULL, 5); +static SENSOR_DEVICE_ATTR(sfp_mod_abs4, S_IRUGO, show_value, NULL, 6); +static SENSOR_DEVICE_ATTR(qsfp_modprs, S_IRUGO, show_value, NULL, 22); +static SENSOR_DEVICE_ATTR(qsfp_lpmode, S_IWUSR | S_IRUGO, show_value, set_value, 24); + +static struct attribute *cpld2_attributes[] = { + &sensor_dev_attr_reset_control.dev_attr.attr, + &sensor_dev_attr_sfp_mod_abs1.dev_attr.attr, + &sensor_dev_attr_sfp_mod_abs2.dev_attr.attr, + &sensor_dev_attr_sfp_mod_abs3.dev_attr.attr, + &sensor_dev_attr_qsfp_modprs.dev_attr.attr, + &sensor_dev_attr_qsfp_lpmode.dev_attr.attr, + NULL +}; + +static struct attribute *cpld1_attributes[] = { + &sensor_dev_attr_sfp_mod_abs1.dev_attr.attr, + &sensor_dev_attr_sfp_mod_abs2.dev_attr.attr, + &sensor_dev_attr_sfp_mod_abs3.dev_attr.attr, + &sensor_dev_attr_sfp_mod_abs4.dev_attr.attr, + NULL +}; + +static const struct attribute_group cpld2_group = { + .attrs = cpld2_attributes, +}; + +static const struct attribute_group cpld1_group = { + .attrs = cpld1_attributes, +}; + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int cpld_detect(struct i2c_client *new_client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = new_client->adapter; + int conf; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + return -ENODEV; + + /* Unused bits */ + conf = i2c_smbus_read_byte_data(new_client, 0); + if (!conf) + return -ENODEV; + + return 0; +} + + +static int cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct cpld_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) + return -EIO; +#if 1 + data = devm_kzalloc(&client->dev, sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); +#endif + + if (client->addr == 49) /* 0x31 */ + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cpld1_group); + else if (client->addr == 50) /* 0x32 */ + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cpld2_group); + else + status = 1; + + if (status) + return status; + + dev_info(&client->dev, "cpld 0x%x found\n", client->addr); + + return 0; +} + +static int cpld_remove(struct i2c_client *client) +{ + if (client->addr == 49) /* 0x31 */ + sysfs_remove_group(&client->dev.kobj, &cpld1_group); + else if (client->addr == 50) /* 0x32 */ + sysfs_remove_group(&client->dev.kobj, &cpld2_group); + else + return 1; + + return 0; +} + +static const struct i2c_device_id cpld_id[] = { + { "wnc_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, cpld_id); + +static struct i2c_driver cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "wnc_cpld", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_id, + .detect = cpld_detect, + .address_list = normal_i2c, +}; + +module_i2c_driver(cpld_driver); + +MODULE_AUTHOR("WNC "); +MODULE_DESCRIPTION("WNC CPLD driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_cpld3.c b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_cpld3.c new file mode 100644 index 000000000000..a24698aa9cef --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_cpld3.c @@ -0,0 +1,200 @@ +/* + * wnc_cpld.c - A driver for control wnc_cpld3 base on lm75.c + * + * Copyright (c) 1998, 1999 Frodo Looijaard + * Copyright (c) 2017 WNC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x33, I2C_CLIENT_END }; + +/* Size of EEPROM in bytes */ +#define CPLD_SIZE 3 + +/* Each client has this additional data */ +struct cpld_data { + struct i2c_client *client; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 data[CPLD_SIZE]; /* Register value */ +}; + +static ssize_t show_hwmon_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int index = to_sensor_dev_attr_2(da)->index; + + mutex_lock(&data->update_lock); + data->data[0] = i2c_smbus_read_byte_data(client, index); + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", data->data[0]); +} + +static ssize_t show_sysfs_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + data->data[0] = i2c_smbus_read_byte_data(client, attr->index); + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%02x\n", data->data[0]); +} + +static ssize_t set_hwmon_value(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int index = to_sensor_dev_attr_2(da)->index; + u8 temp; + int error; + + error = kstrtou8(buf, 10, &temp); + if (error) + return error; + + mutex_lock(&data->update_lock); + i2c_smbus_write_byte_data(client, index, temp); + mutex_unlock(&data->update_lock); + + return count; +} + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_hwmon_value, NULL, 6); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_hwmon_value, NULL, 7); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_hwmon_value, NULL, 8); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_hwmon_value, NULL, 9); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_hwmon_value, NULL, 10); +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_hwmon_value, set_hwmon_value, 6); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_hwmon_value, set_hwmon_value, 7); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_hwmon_value, set_hwmon_value, 8); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_hwmon_value, set_hwmon_value, 9); +static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR | S_IRUGO, show_hwmon_value, set_hwmon_value, 10); + +static struct attribute *cpld3_hwmon_attrs[] = { + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, + &sensor_dev_attr_pwm5.dev_attr.attr, + NULL +}; + +ATTRIBUTE_GROUPS(cpld3_hwmon); + +static SENSOR_DEVICE_ATTR(cpld_version, S_IRUGO, show_sysfs_value, NULL, 1); +static SENSOR_DEVICE_ATTR(power_good, S_IRUGO, show_sysfs_value, NULL, 4); + +static struct attribute *cpld3_sysfs_attrs[] = { + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_power_good.dev_attr.attr, + NULL +}; + +static const struct attribute_group cpld3_sysfs_group = { + .attrs = cpld3_sysfs_attrs, +}; + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int cpld_detect(struct i2c_client *new_client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = new_client->adapter; + int conf; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + return -ENODEV; + + /* Unused bits */ + conf = i2c_smbus_read_byte_data(new_client, 0); + if (!conf) + return -ENODEV; + + return 0; +} + + +static int cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct device *hwmon_dev; + struct cpld_data *data; + int status; + + data = devm_kzalloc(&client->dev, sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->client = client; + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + status = sysfs_create_group(&client->dev.kobj, &cpld3_sysfs_group); + hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev, client->name, data, cpld3_hwmon_groups); + + return PTR_ERR_OR_ZERO(hwmon_dev); +} + +static int cpld_remove(struct i2c_client *client) +{ + devm_hwmon_device_unregister(&client->dev); + sysfs_remove_group(&client->dev.kobj, &cpld3_sysfs_group); + return 0; +} + +static const struct i2c_device_id cpld_id[] = { + { "wnc_cpld3", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, cpld_id); + +static struct i2c_driver cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "wnc_cpld3", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_id, + .detect = cpld_detect, + .address_list = normal_i2c, +}; + +module_i2c_driver(cpld_driver); + +MODULE_AUTHOR("WNC "); +MODULE_DESCRIPTION("WNC CPLD3 driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_eeprom.c b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_eeprom.c new file mode 100644 index 000000000000..8ddf1f2af279 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/wnc_eeprom.c @@ -0,0 +1,286 @@ +/* + * Copyright (C) 1998, 1999 Frodo Looijaard and + * Philip Edelbrock + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003 IBM Corp. + * Copyright (C) 2004 Jean Delvare + * + * 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. + */ + +#include +#include +#include +#include +#include +#include + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, + 0x55, 0x56, 0x57, I2C_CLIENT_END }; + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +/* possible types of eeprom devices */ +enum eeprom_nature { + UNKNOWN, + VAIO, +}; + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[8]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ + enum eeprom_nature nature; +}; + + +static void eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i; + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + //for (i = slice << 5; i < (slice + 1) << 5; i += 32) + for (i = slice << 5; i < (slice + 1) << 5; i += 24) + if (i2c_smbus_read_i2c_block_data(client, i, + 24, data->data + i) + != 24) + goto exit; + } else { + for (i = slice << 5; i < (slice + 1) << 5; i += 2) { + int word = i2c_smbus_read_word_data(client, i); + if (word < 0) + goto exit; + data->data[i] = word & 0xff; + data->data[i + 1] = word >> 8; + } + } + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + data->valid = 0; + + if (off > EEPROM_SIZE) + return 0; + if (off + count > EEPROM_SIZE) + count = EEPROM_SIZE - off; + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++) + eeprom_update_client(client, slice); + + /* Hide Vaio private settings to regular users: + - BIOS passwords: bytes 0x00 to 0x0f + - UUID: bytes 0x10 to 0x1f + - Serial number: 0xc0 to 0xdf */ + if (data->nature == VAIO && !capable(CAP_SYS_ADMIN)) { + int i; + + for (i = 0; i < count; i++) { + if ((off + i <= 0x1f) || + (off + i >= 0xc0 && off + i <= 0xdf)) + buf[i] = 0; + else + buf[i] = data->data[off + i]; + } + } else { + memcpy(buf, &data->data[off], count); + } + + return count; +} + +static ssize_t eeprom_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 temp; + int error, reg; + + mutex_lock(&data->update_lock); + + error = kstrtou8(buf, 10, &temp); + if (error) + return error; + + if (client->addr == 0x51) { /* SFP AOC cable, page selection byte is 126 */ + reg = 126; + } + else if (client->addr == 0x50) { /* QSFP, page selection byte is 127 */ + data->data[0] = i2c_smbus_read_byte_data(client, 0); + + /* Base on SFF-8024, determine this module is SFP or QSFP by byte 0 (Identifier) */ + switch (data->data[0]){ + case 12: + case 13: + case 17: + case 24: + reg = 127; + break; + + default: + goto exit; + } + } + else + goto exit; + + i2c_smbus_write_byte_data(client, reg, temp); + +exit: + mutex_unlock(&data->update_lock); + + return count; +} + +static struct bin_attribute eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IWUSR | S_IRUGO | S_IWGRP | S_IWOTH, + }, + .size = EEPROM_SIZE, + .read = eeprom_read, + .write = eeprom_write, +}; + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int eeprom_detect(struct i2c_client *client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + + /* EDID EEPROMs are often 24C00 EEPROMs, which answer to all + addresses 0x50-0x57, but we only care about 0x50. So decline + attaching to addresses >= 0x51 on DDC buses */ + if (!(adapter->class & I2C_CLASS_SPD) && client->addr >= 0x51) + return -ENODEV; + + /* There are four ways we can read the EEPROM data: + (1) I2C block reads (faster, but unsupported by most adapters) + (2) Word reads (128% overhead) + (3) Consecutive byte reads (88% overhead, unsafe) + (4) Regular byte data reads (265% overhead) + The third and fourth methods are not implemented by this driver + because all known adapters support one of the first two. */ + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_WORD_DATA) + && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) + return -ENODEV; + + strlcpy(info->type, "wnc_eeprom", I2C_NAME_SIZE); + + return 0; +} + +static int eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adapter = client->adapter; + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->nature = UNKNOWN; + + /* Detect the Vaio nature of EEPROMs. + We use the "PCG-" or "VGN-" prefix as the signature. */ + if (client->addr == 0x57 + && i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + char name[4]; + + name[0] = i2c_smbus_read_byte_data(client, 0x80); + name[1] = i2c_smbus_read_byte_data(client, 0x81); + name[2] = i2c_smbus_read_byte_data(client, 0x82); + name[3] = i2c_smbus_read_byte_data(client, 0x83); + + if (!memcmp(name, "PCG-", 4) || !memcmp(name, "VGN-", 4)) { + dev_info(&client->dev, "Vaio EEPROM detected, " + "enabling privacy protection\n"); + data->nature = VAIO; + } + } + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &eeprom_attr); + if (err) + goto exit_kfree; + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id eeprom_id[] = { + { "wnc_eeprom", 0 }, + { } +}; + +static struct i2c_driver eeprom_driver = { + .driver = { + .name = "wnc_eeprom", + }, + .probe = eeprom_probe, + .remove = eeprom_remove, + .id_table = eeprom_id, + + .class = I2C_CLASS_DDC | I2C_CLASS_SPD, + .detect = eeprom_detect, + .address_list = normal_i2c, +}; + +module_i2c_driver(eeprom_driver); + +MODULE_AUTHOR("Frodo Looijaard and " + "Philip Edelbrock and " + "Greg Kroah-Hartman "); +MODULE_DESCRIPTION("I2C EEPROM driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/device_node.sh b/platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/device_node.sh new file mode 100644 index 000000000000..7e1c7c45a725 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/device_node.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +SEARCH_I2C_BUS=$(ls /sys/bus/i2c/devices) +I2C_BUS=-1 + +for i in $SEARCH_I2C_BUS +do + if [[ -n $(cat /sys/bus/i2c/devices/$i/name | grep i2c-mcp2221) ]]; then + I2C_BUS=$(echo $i | sed 's/i2c-//g') + break + fi +done + +if [[ $I2C_BUS == -1 ]]; then + echo "Can't find i2c-mcp2221" + exit +fi + +TOTAL_MUX=8 +START_NODE_NUM=$((I2C_BUS+1)) + +modprobe i2c_mux_pca954x force_deselect_on_exit=1 + +echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-$I2C_BUS/new_device +echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-$I2C_BUS/new_device +echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-$I2C_BUS/new_device +echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-$I2C_BUS/new_device +echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-$I2C_BUS/new_device +echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-$I2C_BUS/new_device +echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-$I2C_BUS/new_device +echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-$I2C_BUS/new_device + +sleep 5 + +/sbin/modprobe wnc_cpld +/sbin/modprobe wnc_cpld3 +/sbin/modprobe wnc_eeprom +/sbin/modprobe eeprom + +# MUX0: i2c-3~i2c-10 +# MUX1: i2c-11~i2c-18 +# MUX2: i2c-19~i2c-26 +# MUX3: i2c-27~i2c-34 +# MUX4: i2c-35~i2c-42 +# MUX5: i2c-43~i2c-50 +# MUX6: i2c-51~i2c-58 +# MUX7: i2c-59~i2c-66 + +# MUX0 channel0 +CHANNEL=0 +echo wnc_cpld 0x31 > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device + +# MUX0 channel1 +CHANNEL=1 +echo wnc_cpld 0x32 > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device + +# MUX0 channel2 +CHANNEL=2 +echo wnc_cpld3 0x33 > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device +echo wnc_eeprom 0x53 > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device + +# MUX0 channel3 +CHANNEL=3 +echo wnc_eeprom 0x50 > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device +echo wnc_eeprom 0x51 > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device + +# MUX0 channel4 +CHANNEL=4 +echo wnc_eeprom 0x54 > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device +echo tmp421 0x1E > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device +sleep 1 +echo tmp75 0x4E > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device +sleep 1 +echo tmp421 0x4F > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device + +# MUX0 channel5 +CHANNEL=5 +echo wnc_eeprom 0x52 > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device + +# MUX0 channel7 +CHANNEL=7 +#echo wnc_eeprom 0x5B > /sys/bus/i2c/devices/i2c-$(($START_NODE_NUM+$CHANNEL))/new_device + +START_PORT_NUM=$((START_NODE_NUM+8)) +END_PORT_NUM=$((TOTAL_MUX*8+1)) + +for i in $(seq $START_PORT_NUM $END_PORT_NUM) +do + echo wnc_eeprom 0x50 > /sys/bus/i2c/devices/i2c-$i/new_device + echo wnc_eeprom 0x51 > /sys/bus/i2c/devices/i2c-$i/new_device +done diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/driver_load.sh b/platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/driver_load.sh new file mode 100644 index 000000000000..81cee0383ff2 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/driver_load.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +vid=04d8 +pid=00dd + +#check to see if sysfs is mounted +sysfs_path=`awk '/^sysfs/{ print $2 }' < /proc/mounts` +curr_path=`pwd` + +#if variable is empty, we should exit. No SYSFS found +if [[ -z $sysfs_path ]]; then + echo "No sysfs in this system! Exiting..." + exit 1 +fi + +function load_drivers +{ + modprobe i2c-dev + if [[ $? -ne 0 ]]; then + echo "Cannot load the \"i2c-dev\" driver! Exiting..." + exit 1 + fi + modprobe i2c-mcp2221 + if [[ $? -ne 0 ]]; then + echo "Cannot load the \"i2c-mcp2221\" driver! Exiting..." + exit 1 + fi + echo "I2C related drivers are loaded" +} + +usb_device_path=${sysfs_path}/bus/usb/devices + +cd $usb_device_path + +for usbdev in *; do + idvendor=${usb_device_path}/${usbdev}/idVendor + idproduct=${usb_device_path}/${usbdev}/idProduct + usb_driver=${usb_device_path}/${usbdev}/${usbdev}:1.2/driver + if [[ -f $idvendor ]]; then + dev_vid=`grep -i $vid < $idvendor` + dev_pid=`grep -i $pid < $idproduct` + if [[ -n $dev_vid ]] && [[ -n $dev_pid ]]; then + echo "I found the requested VID/PID: $dev_vid, $dev_pid" + load_drivers + echo -n "${usbdev}:1.2" > ${usb_driver}/unbind + echo -n "${usbdev}:1.2" > ${sysfs_path}/bus/usb/drivers/i2c-mcp2221/bind + fi + fi +done + diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/test b/platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/test new file mode 100644 index 000000000000..38327722c91f --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/scripts/test @@ -0,0 +1 @@ +echo "test" diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/service/device_node.service b/platform/barefoot/sonic-platform-modules-wnc-osw1800/service/device_node.service new file mode 100644 index 000000000000..fd1bd9b15648 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/service/device_node.service @@ -0,0 +1,11 @@ +[Unit] +Description=Create device nodes for i2c devices. +Requires=driver_load.service +After=driver_load.service + +[Service] +Type=oneshot +ExecStart=/bin/bash /usr/local/bin/device_node.sh + +[Install] +WantedBy=multi-user.target diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/service/driver_load.service b/platform/barefoot/sonic-platform-modules-wnc-osw1800/service/driver_load.service new file mode 100644 index 000000000000..52ce4d2f4442 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/service/driver_load.service @@ -0,0 +1,10 @@ +[Unit] +Description=Initialize i2c-mcp2221 driver. +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=/bin/bash /usr/local/bin/driver_load.sh + +[Install] +WantedBy=multi-user.target diff --git a/platform/vs/tests/conftest.py b/platform/vs/tests/conftest.py index 9256597f5e37..48ad7e15661a 100644 --- a/platform/vs/tests/conftest.py +++ b/platform/vs/tests/conftest.py @@ -54,8 +54,21 @@ def __init__(self, dvs): atbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_ACL_TABLE") keys = atbl.getKeys() - assert len(keys) == 1 - self.default_acl_table = keys[0] + assert len(keys) >= 1 + # Filter out DTel Acl tables + default_table_found = False + for k in keys: + if default_table_found: + break + (status, fvs) = atbl.get(k) + for item in fvs: + if item[0] == "SAI_ACL_TABLE_ATTR_ACL_BIND_POINT_TYPE_LIST": + if 'SAI_ACL_BIND_POINT_TYPE_PORT' in item[1]: + self.default_acl_table = k + default_table_found = True + break + else: + break atbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_ACL_ENTRY") keys = atbl.getKeys() diff --git a/slave.mk b/slave.mk index a4199bb1ebb6..a7cb518cb078 100644 --- a/slave.mk +++ b/slave.mk @@ -31,6 +31,7 @@ PROJECT_ROOT = $(shell pwd) CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo generic) PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM) export BUILD_NUMBER +export CONFIGURED_PLATFORM ############################################################################### ## Utility rules diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 8949db34a973..2737dab75f85 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -114,6 +114,11 @@ RUN apt-get update && apt-get install -y \ # For mellanox sai build libtool-bin \ libxml2-dev \ +# For BFN sdk build + libusb-1.0-0-dev \ + libcurl3-nss-dev \ + libunwind8-dev \ + telnet \ # For build image cpio \ squashfs-tools \ diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index 96dc577ffe8b..e3f09afd1a83 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -19,6 +19,7 @@ iface lo inet static address 10.10.0.99 netmask 255.255.255.255 # + # The management network interface auto eth0 iface eth0 inet static diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 8585fc84d422..c2c5e7cf7fa4 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 8585fc84d422abf74d472702de7ad5ab20aa55e5 +Subproject commit c2c5e7cf7fa477691cda579405dde3d2573e066c diff --git a/src/sonic-swss b/src/sonic-swss index 762e7da80142..dcf6c905410f 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 762e7da80142358af0d348dea1143f38aa60a992 +Subproject commit dcf6c905410f08b004e880dbed56823d29e7bd5e diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 8c5dab6b3417..dd470177f592 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 8c5dab6b341752b4bda3f63917a9c143df778322 +Subproject commit dd470177f5920ca546d1cc65dd206193c35d7e43 From e3abf0c070e7cb92e116afc0fd2ab23ebe9173e8 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 24 Jul 2018 21:46:55 -0700 Subject: [PATCH 1431/1833] [docker] Exit if docker run fails (#1870) --- files/build_templates/docker_image_ctl.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 1216013e63c2..e1873851c9c4 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -78,7 +78,10 @@ start() { {%- endif %} --tmpfs /tmp \ --tmpfs /var/tmp \ - --name={{docker_container_name}} {{docker_image_name}}:latest + --name={{docker_container_name}} {{docker_image_name}}:latest || { + echo "Failed to docker run" >&1 + exit 4 + } postStartAction } From 3c33737d589d81ba8d937291fb1d0de08110ac4b Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 25 Jul 2018 08:14:18 -0700 Subject: [PATCH 1432/1833] [make] introducing new build option KERNEL_PROCURE_METHOD (#1837) * [make] introducing new build option KERNEL_BUILD_METHOD - Kernel could be built from source files with method 'build' - Kernel could be downloaded from Azure storage with method 'download' Signed-off-by: Ying Xie * Replace BUILD with PROCURE * fix typo --- Makefile | 4 +++- rules/config | 5 +++++ slave.mk | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 347041e1b12a..ccbefc9e0138 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ # * PASSWORD: Desired password -- default at rules/config # * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes. # * SOURCE_FOLDER: host path to be mount as /var/$(USER)/src, only effective when KEEP_SLAVE_ON=yes -# * SONIC_BUILD_JOB: Specifying number of concurrent build job(s) to run +# * SONIC_BUILD_JOBS: Specifying number of concurrent build job(s) to run +# * KERNEL_PROCURE_METHOD: Specifying method of obtaining kernel Debian package: download or build # ############################################################################### @@ -69,6 +70,7 @@ SONIC_BUILD_INSTRUCTION := make \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ + KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \ HTTP_PROXY=$(http_proxy) \ HTTPS_PROXY=$(https_proxy) \ SONIC_ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY) diff --git a/rules/config b/rules/config index 1505dfd71782..5e8a3389530d 100644 --- a/rules/config +++ b/rules/config @@ -66,3 +66,8 @@ ENABLE_ORGANIZATION_EXTENSIONS = y # ENABLE_SYSTEM_TELEMETRY - build docker-sonic-telemetry for system telemetry support # ENABLE_SYSTEM_TELEMETRY = y + +# DEFAULT_KERNEL_PROCURE_METHOD - default method for obtaining kernel +# build: build kernel from source +# download: download pre-built kernel from Azure storage. +DEFAULT_KERNEL_PROCURE_METHOD = build diff --git a/slave.mk b/slave.mk index a7cb518cb078..9ba1732e6a58 100644 --- a/slave.mk +++ b/slave.mk @@ -99,6 +99,10 @@ ifeq ($(SONIC_BUILD_JOBS),) override SONIC_BUILD_JOBS := $(SONIC_CONFIG_BUILD_JOBS) endif +ifeq ($(KERNEL_PROCURE_METHOD),) +override KERNEL_PROCURE_METHOD := $(DEFAULT_KERNEL_PROCURE_METHOD) +endif + MAKEFLAGS += -j $(SONIC_BUILD_JOBS) export SONIC_CONFIG_MAKE_JOBS @@ -127,6 +131,7 @@ $(info "HTTPS_PROXY" : "$(HTTPS_PROXY)") $(info "ENABLE_SYSTEM_TELEMETRY" : "$(ENABLE_SYSTEM_TELEMETRY)") $(info "SONIC_DEBUGGING_ON" : "$(SONIC_DEBUGGING_ON)") $(info "SONIC_PROFILING_ON" : "$(SONIC_PROFILING_ON)") +$(info "KERNEL_PROCURE_METHOD" : "$(KERNEL_PROCURE_METHOD)") $(info ) ############################################################################### @@ -134,6 +139,8 @@ $(info ) ## All rules must go after includes for propper targets expansion ############################################################################### +export kernel_procure_method="$(KERNEL_PROCURE_METHOD)" + ############################################################################### ## Local targets ############################################################################### @@ -149,6 +156,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) : $(DEBS_PATH)/% : .platform { cp $($(deb)_PATH)/$(deb) $(DEBS_PATH)/ $(LOG) || exit 1 ; } ; ) $(FOOTER) + SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) # Copy regular files from local directory From 10b4bbcae893fc41194813c053e9e2cd10e0cac1 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 26 Jul 2018 13:39:08 -0700 Subject: [PATCH 1433/1833] [swss]: Start counter from swss container (#1875) * sonic-quagga update. Don't spam with 'Vtysh connected from' message * Enable counters inside swss container. systemd is not flexible enough to follow our business rules --- dockers/docker-orchagent/Dockerfile.j2 | 1 + dockers/docker-orchagent/enable_counters.py | 34 +++++++++++++++++++ dockers/docker-orchagent/start.sh | 2 ++ dockers/docker-orchagent/supervisord.conf | 8 +++++ files/build_templates/enable_counters.service | 8 ----- files/build_templates/enable_counters.timer | 9 ----- files/build_templates/snmp.service.j2 | 4 +-- .../build_templates/sonic_debian_extension.j2 | 3 -- 8 files changed, 47 insertions(+), 22 deletions(-) create mode 100755 dockers/docker-orchagent/enable_counters.py delete mode 100644 files/build_templates/enable_counters.service delete mode 100644 files/build_templates/enable_counters.timer diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 0df8e9ba1bb4..eceb82a06c76 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -30,6 +30,7 @@ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs COPY ["files/arp_update", "/usr/bin"] +COPY ["enable_counters.py", "/usr/bin"] COPY ["start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] diff --git a/dockers/docker-orchagent/enable_counters.py b/dockers/docker-orchagent/enable_counters.py new file mode 100755 index 000000000000..712d34492b47 --- /dev/null +++ b/dockers/docker-orchagent/enable_counters.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +import swsssdk +import time + +def enable_counter_group(db, name): + info = {} + info['FLEX_COUNTER_STATUS'] = 'enable' + db.mod_entry("FLEX_COUNTER_TABLE", name, info) + +def enable_counters(): + db = swsssdk.ConfigDBConnector() + db.connect() + enable_counter_group(db, 'PORT') + enable_counter_group(db, 'QUEUE') + enable_counter_group(db, 'PFCWD') + +def get_uptime(): + with open('/proc/uptime') as fp: + return float(fp.read().split(' ')[0]) + +def main(): + # If the switch was just started (uptime less than 5 minutes), + # wait for 3 minutes and enable counters + # otherwise wait for 60 seconds and enable counters + uptime = get_uptime() + if uptime < 300: + time.sleep(180) + else: + time.sleep(60) + enable_counters() + +if __name__ == '__main__': + main() diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index e26be9286aa3..0321bf8428f4 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -28,6 +28,8 @@ supervisorctl start intfmgrd supervisorctl start buffermgrd +supervisorctl start enable_counters + # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index dc28e3369ca5..2369a4c31b05 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -91,3 +91,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:enable_counters] +command=/usr/bin/enable_counters.py +priority=11 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/files/build_templates/enable_counters.service b/files/build_templates/enable_counters.service deleted file mode 100644 index 95424474cb15..000000000000 --- a/files/build_templates/enable_counters.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Enable SONiC counters -PartOf=swss.service - -[Service] -Type=oneshot -ExecStart=/bin/bash -c 'sleep 60 ; /usr/bin/counterpoll queue enable ; /usr/bin/counterpoll port enable ; /usr/bin/pfcwd counter_poll enable' -RemainAfterExit=yes diff --git a/files/build_templates/enable_counters.timer b/files/build_templates/enable_counters.timer deleted file mode 100644 index 40a91525a712..000000000000 --- a/files/build_templates/enable_counters.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Delays the SONiC counters gathering until SONiC has started - -[Timer] -OnBootSec=2min -Unit=enable_counters.service - -[Install] -WantedBy=timers.target diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index 93ef869b86e1..6398477ab6a1 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=SNMP container -Requires=updategraph.service swss.service enable_counters.service -After=updategraph.service swss.service enable_counters.service +Requires=updategraph.service swss.service +After=updategraph.service swss.service [Service] ExecStartPre=/usr/bin/{{docker_container_name}}.sh start diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 94be71a80935..4580f3f7e741 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -285,10 +285,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys # Copy systemd timer configuration # It implements delayed start of services -sudo cp $BUILD_TEMPLATES/enable_counters.timer $FILESYSTEM_ROOT/etc/systemd/system/ -sudo cp $BUILD_TEMPLATES/enable_counters.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT/etc/systemd/system/ -sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable enable_counters.timer sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable snmp.timer sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get remove -y python-dev From da12f571e2f682e5274f7e7178e65efe6f27648a Mon Sep 17 00:00:00 2001 From: sihuihan88 Date: Thu, 26 Jul 2018 13:39:22 -0700 Subject: [PATCH 1434/1833] [sonic-utilities]: update submodule (#1871) Signed-off-by: Sihui Han --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 4a36190b0bd7..747d5c386299 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 4a36190b0bd7f8e551431af6804060d5cf8ab26a +Subproject commit 747d5c386299a8fac2acb4f4594fe2498d33df36 From 7cbadb70ba313adde8f98f1d093e1ecbfb939812 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 26 Jul 2018 23:32:49 -0700 Subject: [PATCH 1435/1833] Update submodule: swss-common, swss (#1878) Signed-off-by: Qi Luo --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index dcf6c905410f..902239ad4c67 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit dcf6c905410f08b004e880dbed56823d29e7bd5e +Subproject commit 902239ad4c67c8e85da296b00badbc08b9820001 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index dd470177f592..9fa06dac45d7 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit dd470177f5920ca546d1cc65dd206193c35d7e43 +Subproject commit 9fa06dac45d7a8eac7aeb478ac834d7596eb25a5 From b86c3ee8ced5eb39d0aced6b81d8a27836418f9c Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 27 Jul 2018 12:36:23 -0700 Subject: [PATCH 1436/1833] [build]: add barefoot master build badge (#1881) --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 20cc432cbbe6..6bc218bf00a7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -*master*: Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) +*master*: +Barefoot: [![Barefoot](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-all) +Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all) Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all) Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-all) P4: [![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all) From 77b899b1a03d25b655e79f6b07164fbcc3e2e971 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 27 Jul 2018 16:52:58 -0700 Subject: [PATCH 1437/1833] [submodule] advance sonic-linux-kernel submodule (#1882) - Include delta DPS1900 support - Make kernel build to fail on any error - Enable downloading pre-built kernel debian packages Signed-off-by: Ying Xie --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index b511c96bcea0..61923df04554 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit b511c96bcea09ae2b2adb3c3df7c4c41f14b6929 +Subproject commit 61923df04554c64107fc91c095016232fb1859a0 From c3c8f7fd7f62d09b1e8d3172e86601f6cd5ed0f1 Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Fri, 27 Jul 2018 17:46:33 -0700 Subject: [PATCH 1438/1833] Fix for bash's memory-leak (#1879) * Fix for bash's memory-leak Memory leak is observed during the execution of scripts that make use of bash-arrays. In scenarios where the offending script is executed on a regular basis (e.g. fancontrol), the leaking process may end up consuming most of the system resources. In this PR i'm replacing bash in all the contexts where it executes (both host and dockers). The official patch for this issue is here: https://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-040 * Fixing minor issue during code-merge Signed-off-by: Rodny Molina --- files/build_templates/sonic_debian_extension.j2 | 5 +++++ rules/bash.mk | 17 +++++++++++++++++ rules/docker-base.mk | 1 + slave.mk | 1 + sonic-slave/Dockerfile | 5 ++++- src/bash/Makefile | 16 ++++++++++++++++ 6 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 rules/bash.mk create mode 100644 src/bash/Makefile diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 4580f3f7e741..02ac97ba2b9a 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -100,6 +100,11 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-click*_all.deb || \ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Install customized bash version to patch memory-leak issue. This instruction shall be removed +# once the migration to Debian-9 (Stretch) is completed. +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/bash_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # SONiC utilities installs bash-completion as a dependency. However, it is disabled by default # in bash.bashrc, so we copy a version of the file with it enabled here. sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ diff --git a/rules/bash.mk b/rules/bash.mk new file mode 100644 index 000000000000..e31b237ae11b --- /dev/null +++ b/rules/bash.mk @@ -0,0 +1,17 @@ +# bash package +# +# Created to patch memory-leak issue in the bash-package included in Debian-8 (Jessie) +# release. This rule file, and the associated building-infra created to solve this +# bug (src/bash/), should be eliminated once the migration to Debian-9 (Stretch) is +# completed. + +# Bash major release-number corresponding to Debian-8 (Jessie) +BASH_VERSION_MAJOR = 4.3 +# Bash complete release-number. This image contains all 4.3 fixes up to patch '42'. +BASH_VERSION_FULL = $(BASH_VERSION_MAJOR)-14 + +export BASH_VERSION_MAJOR BASH_VERSION_FULL + +BASH = bash_$(BASH_VERSION_FULL)_amd64.deb +$(BASH)_SRC_PATH = $(SRC_PATH)/bash +SONIC_MAKE_DEBS += $(BASH) diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 1bdaaa0b4de0..5ef06c7fc873 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -4,6 +4,7 @@ DOCKER_BASE = docker-base.gz $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base $(DOCKER_BASE)_DEPENDS += $(SUPERVISOR) $(DOCKER_BASE)_DEPENDS += $(LIBWRAP) +$(DOCKER_BASE)_DEPENDS += $(BASH) ifeq ($(SONIC_INSTALL_DEBUG_TOOLS),y) GDB = gdb diff --git a/slave.mk b/slave.mk index 9ba1732e6a58..722698b5c7cb 100644 --- a/slave.mk +++ b/slave.mk @@ -458,6 +458,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(SONIC_DEVICE_DATA) \ $(PYTHON_CLICK) \ $(SONIC_UTILS) \ + $(BASH) \ $(LIBWRAP) \ $(LIBPAM_TACPLUS) \ $(LIBNSS_TACPLUS)) \ diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 2737dab75f85..f66b3e07d7b0 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -226,7 +226,10 @@ RUN apt-get update && apt-get install -y \ python3-docutils \ python3-requests \ python3-pytest \ - python3-colorama + python3-colorama \ +# For bash + texi2html + # For linux build RUN apt-get -y build-dep linux diff --git a/src/bash/Makefile b/src/bash/Makefile new file mode 100644 index 000000000000..2e9f093aedb4 --- /dev/null +++ b/src/bash/Makefile @@ -0,0 +1,16 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e + +MAIN_TARGET = bash_$(BASH_VERSION_FULL)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf bash-$(BASH_VERSION_MAJOR) + + dget -u https://launchpad.net/debian/+archive/primary/+sourcefiles/bash/$(BASH_VERSION_FULL)/bash_$(BASH_VERSION_FULL).dsc + + pushd bash-$(BASH_VERSION_MAJOR) + DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + mv $* $(DEST)/ From 81ee8fa34f99ce0474724b236ecbb2bf8fff5a2f Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 27 Jul 2018 22:47:59 -0700 Subject: [PATCH 1439/1833] [platform]: add sonic port alias for mellanox SN2700 platform (#1883) --- .../ACS-MSN2700/port_config.ini | 66 +++++----- .../Mellanox-SN2700-D48C8/port_config.ini | 114 +++++++++--------- 2 files changed, 90 insertions(+), 90 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini index 816bb0e94a70..1e1906ff0ef5 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini @@ -1,33 +1,33 @@ -# name lanes -Ethernet0 0,1,2,3 -Ethernet4 4,5,6,7 -Ethernet8 8,9,10,11 -Ethernet12 12,13,14,15 -Ethernet16 16,17,18,19 -Ethernet20 20,21,22,23 -Ethernet24 24,25,26,27 -Ethernet28 28,29,30,31 -Ethernet32 32,33,34,35 -Ethernet36 36,37,38,39 -Ethernet40 40,41,42,43 -Ethernet44 44,45,46,47 -Ethernet48 48,49,50,51 -Ethernet52 52,53,54,55 -Ethernet56 56,57,58,59 -Ethernet60 60,61,62,63 -Ethernet64 64,65,66,67 -Ethernet68 68,69,70,71 -Ethernet72 72,73,74,75 -Ethernet76 76,77,78,79 -Ethernet80 80,81,82,83 -Ethernet84 84,85,86,87 -Ethernet88 88,89,90,91 -Ethernet92 92,93,94,95 -Ethernet96 96,97,98,99 -Ethernet100 100,101,102,103 -Ethernet104 104,105,106,107 -Ethernet108 108,109,110,111 -Ethernet112 112,113,114,115 -Ethernet116 116,117,118,119 -Ethernet120 120,121,122,123 -Ethernet124 124,125,126,127 +# name lanes alias +Ethernet0 0,1,2,3 etp1 +Ethernet4 4,5,6,7 etp2 +Ethernet8 8,9,10,11 etp3 +Ethernet12 12,13,14,15 etp4 +Ethernet16 16,17,18,19 etp5 +Ethernet20 20,21,22,23 etp6 +Ethernet24 24,25,26,27 etp7 +Ethernet28 28,29,30,31 etp8 +Ethernet32 32,33,34,35 etp9 +Ethernet36 36,37,38,39 etp10 +Ethernet40 40,41,42,43 etp11 +Ethernet44 44,45,46,47 etp12 +Ethernet48 48,49,50,51 etp13 +Ethernet52 52,53,54,55 etp14 +Ethernet56 56,57,58,59 etp15 +Ethernet60 60,61,62,63 etp16 +Ethernet64 64,65,66,67 etp17 +Ethernet68 68,69,70,71 etp18 +Ethernet72 72,73,74,75 etp19 +Ethernet76 76,77,78,79 etp20 +Ethernet80 80,81,82,83 etp21 +Ethernet84 84,85,86,87 etp22 +Ethernet88 88,89,90,91 etp23 +Ethernet92 92,93,94,95 etp24 +Ethernet96 96,97,98,99 etp25 +Ethernet100 100,101,102,103 etp26 +Ethernet104 104,105,106,107 etp27 +Ethernet108 108,109,110,111 etp28 +Ethernet112 112,113,114,115 etp29 +Ethernet116 116,117,118,119 etp30 +Ethernet120 120,121,122,123 etp31 +Ethernet124 124,125,126,127 etp32 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini index d54a31851614..ffe3fe0ce6d9 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini @@ -1,57 +1,57 @@ -# name lanes speed -Ethernet0 0,1 50000 -Ethernet2 2,3 50000 -Ethernet4 4,5 50000 -Ethernet6 6,7 50000 -Ethernet8 8,9 50000 -Ethernet10 10,11 50000 -Ethernet12 12,13 50000 -Ethernet14 14,15 50000 -Ethernet16 16,17 50000 -Ethernet18 18,19 50000 -Ethernet20 20,21 50000 -Ethernet22 22,23 50000 -Ethernet24 24,25,26,27 100000 -Ethernet28 28,29,30,31 100000 -Ethernet32 32,33,34,35 100000 -Ethernet36 36,37,38,39 100000 -Ethernet40 40,41 50000 -Ethernet42 42,43 50000 -Ethernet44 44,45 50000 -Ethernet46 46,47 50000 -Ethernet48 48,49 50000 -Ethernet50 50,51 50000 -Ethernet52 52,53 50000 -Ethernet54 54,55 50000 -Ethernet56 56,57 50000 -Ethernet58 58,59 50000 -Ethernet60 60,61 50000 -Ethernet62 62,63 50000 -Ethernet64 64,65 50000 -Ethernet66 66,67 50000 -Ethernet68 68,69 50000 -Ethernet70 70,71 50000 -Ethernet72 72,73 50000 -Ethernet74 74,75 50000 -Ethernet76 76,77 50000 -Ethernet78 78,79 50000 -Ethernet80 80,81 50000 -Ethernet82 82,83 50000 -Ethernet84 84,85 50000 -Ethernet86 86,87 50000 -Ethernet88 88,89,90,91 100000 -Ethernet92 92,93,94,95 100000 -Ethernet96 96,97,98,99 100000 -Ethernet100 100,101,102,103 100000 -Ethernet104 104,105 50000 -Ethernet106 106,107 50000 -Ethernet108 108,109 50000 -Ethernet110 110,111 50000 -Ethernet112 112,113 50000 -Ethernet114 114,115 50000 -Ethernet116 116,117 50000 -Ethernet118 118,119 50000 -Ethernet120 120,121 50000 -Ethernet122 122,123 50000 -Ethernet124 124,125 50000 -Ethernet126 126,127 50000 +# name lanes speed alias +Ethernet0 0,1 50000 etp1a +Ethernet2 2,3 50000 etp1b +Ethernet4 4,5 50000 etp2a +Ethernet6 6,7 50000 etp2b +Ethernet8 8,9 50000 etp3a +Ethernet10 10,11 50000 etp3b +Ethernet12 12,13 50000 etp4a +Ethernet14 14,15 50000 etp4b +Ethernet16 16,17 50000 etp5a +Ethernet18 18,19 50000 etp5b +Ethernet20 20,21 50000 etp6a +Ethernet22 22,23 50000 etp6b +Ethernet24 24,25,26,27 100000 etp7 +Ethernet28 28,29,30,31 100000 etp8 +Ethernet32 32,33,34,35 100000 etp9 +Ethernet36 36,37,38,39 100000 etp10 +Ethernet40 40,41 50000 etp11a +Ethernet42 42,43 50000 etp11b +Ethernet44 44,45 50000 etp12a +Ethernet46 46,47 50000 etp12b +Ethernet48 48,49 50000 etp13a +Ethernet50 50,51 50000 etp13b +Ethernet52 52,53 50000 etp14a +Ethernet54 54,55 50000 etp14b +Ethernet56 56,57 50000 etp15a +Ethernet58 58,59 50000 etp15b +Ethernet60 60,61 50000 etp16a +Ethernet62 62,63 50000 etp16b +Ethernet64 64,65 50000 etp17a +Ethernet66 66,67 50000 etp17b +Ethernet68 68,69 50000 etp18a +Ethernet70 70,71 50000 etp18b +Ethernet72 72,73 50000 etp19a +Ethernet74 74,75 50000 etp19b +Ethernet76 76,77 50000 etp20a +Ethernet78 78,79 50000 etp20b +Ethernet80 80,81 50000 etp21a +Ethernet82 82,83 50000 etp21b +Ethernet84 84,85 50000 etp22a +Ethernet86 86,87 50000 etp22b +Ethernet88 88,89,90,91 100000 etp23 +Ethernet92 92,93,94,95 100000 etp24 +Ethernet96 96,97,98,99 100000 etp25 +Ethernet100 100,101,102,103 100000 etp26 +Ethernet104 104,105 50000 etp27a +Ethernet106 106,107 50000 etp27b +Ethernet108 108,109 50000 etp28a +Ethernet110 110,111 50000 etp28b +Ethernet112 112,113 50000 etp29a +Ethernet114 114,115 50000 etp29b +Ethernet116 116,117 50000 etp30a +Ethernet118 118,119 50000 etp30b +Ethernet120 120,121 50000 etp31a +Ethernet122 122,123 50000 etp31b +Ethernet124 124,125 50000 etp32a +Ethernet126 126,127 50000 etp32b From 5011622c6f50194b5dda03ecdeb31438613ae325 Mon Sep 17 00:00:00 2001 From: Sagar Balani Date: Mon, 30 Jul 2018 09:54:05 -0700 Subject: [PATCH 1440/1833] [platform]: bfn intf: allow-hotplug for usb0 interface (#1889) --- files/image_config/interfaces/interfaces-config.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index b5b06904c508..29664bcda564 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -10,6 +10,7 @@ if [[ "$platform" == "x86_64-accton_wedge100bf_32x-r0" || "$platform" == "x86_64 cat <<'EOF' >> /etc/network/interfaces # BMC interface auto usb0 +allow-hotplug usb0 iface usb0 inet6 auto up ifconfig usb0 txqueuelen 64 EOF From d166a0150226cb060e1dfbda69d41eea84201648 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 30 Jul 2018 10:33:53 -0700 Subject: [PATCH 1441/1833] [submodule] Update submodule: swss-common (#1885) --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 9fa06dac45d7..a2a2e3570fa5 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 9fa06dac45d7a8eac7aeb478ac834d7596eb25a5 +Subproject commit a2a2e3570fa58469c100689a907b50ff195b2266 From 530e2dc4e17eb737b157ef1bebce98a383a3fa3b Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 31 Jul 2018 12:50:54 -0700 Subject: [PATCH 1442/1833] Only keep most recent one in old_config (#1884) --- files/image_config/platform/rc.local | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index b99ecdbcee9d..0db4278932f6 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -226,6 +226,7 @@ if [ -f $FIRST_BOOT_FILE ]; then # and create a flag in /tmp/ to let updategraph service know if [ -d /host/old_config ]; then mv -f /host/old_config /etc/sonic/ + rm -rf /etc/sonic/old_config/old_config touch /tmp/pending_config_migration elif [ -f /host/minigraph.xml ]; then mkdir -p /etc/sonic/old_config From d389c09335d6ac6925909729fc75ef4670ab8baa Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 31 Jul 2018 18:45:28 -0700 Subject: [PATCH 1443/1833] [submodule] Update submodule: swss-common (#1895) --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index a2a2e3570fa5..051e08d79548 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit a2a2e3570fa58469c100689a907b50ff195b2266 +Subproject commit 051e08d79548eb362c12d8800b5d2cb7bf8a1e41 From 2522565e15c4b9187f3c19b785171e176b930302 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 31 Jul 2018 22:11:57 -0700 Subject: [PATCH 1444/1833] [devices]: Move Arista bfn platforms under platform/barefoot (#1894) The work on Arista 7170 was originally submitted under platform/p4. Since the platform/barefoot was recently introduced, this is where this platform support needs to go. Signed-off-by: Samuel Angebault --- .gitmodules | 2 +- platform/barefoot/one-aboot.mk | 13 +++++++++++++ .../{p4 => barefoot}/platform-modules-arista.mk | 0 platform/barefoot/rules.mk | 5 ++++- .../{p4 => barefoot}/sonic-platform-modules-arista | 0 platform/p4/one-aboot.mk | 12 ------------ platform/p4/rules.mk | 2 -- 7 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 platform/barefoot/one-aboot.mk rename platform/{p4 => barefoot}/platform-modules-arista.mk (100%) rename platform/{p4 => barefoot}/sonic-platform-modules-arista (100%) delete mode 100644 platform/p4/one-aboot.mk diff --git a/.gitmodules b/.gitmodules index bb4eae528c72..57cd558057fe 100755 --- a/.gitmodules +++ b/.gitmodules @@ -78,5 +78,5 @@ path = platform/broadcom/sonic-platform-modules-mitac url = https://github.com/MiTAC-EBU/sonic-platform-modules-mitac.git [submodule "platform/p4/sonic-platform-modules-arista"] - path = platform/p4/sonic-platform-modules-arista + path = platform/barefoot/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic diff --git a/platform/barefoot/one-aboot.mk b/platform/barefoot/one-aboot.mk new file mode 100644 index 000000000000..4c4a6b6f626a --- /dev/null +++ b/platform/barefoot/one-aboot.mk @@ -0,0 +1,13 @@ +# sonic one aboot installer + +SONIC_ONE_ABOOT_IMAGE = sonic-aboot-barefoot.swi +$(SONIC_ONE_ABOOT_IMAGE)_MACHINE = barefoot +$(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(BFN_PLATFORM_MODULE) +$(SONIC_ONE_ABOOT_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_PLATFORM_MODULE) +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_DRIVERS) \ + $(ARISTA_PLATFORM_MODULE_PYTHON2) \ + $(ARISTA_PLATFORM_MODULE_PYTHON3) \ + $(ARISTA_PLATFORM_MODULE) +$(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_ABOOT_IMAGE) diff --git a/platform/p4/platform-modules-arista.mk b/platform/barefoot/platform-modules-arista.mk similarity index 100% rename from platform/p4/platform-modules-arista.mk rename to platform/barefoot/platform-modules-arista.mk diff --git a/platform/barefoot/rules.mk b/platform/barefoot/rules.mk index f10952dfadc2..2ee49adb8a0f 100644 --- a/platform/barefoot/rules.mk +++ b/platform/barefoot/rules.mk @@ -1,3 +1,4 @@ +include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-bfn.mk include $(PLATFORM_PATH)/platform-modules-bfn-montara.mk include $(PLATFORM_PATH)/platform-modules-wnc-osw1800.mk @@ -6,6 +7,7 @@ include $(PLATFORM_PATH)/bfn-sai.mk include $(PLATFORM_PATH)/docker-syncd-bfn.mk include $(PLATFORM_PATH)/docker-syncd-bfn-rpc.mk include $(PLATFORM_PATH)/docker-orchagent-bfn.mk +include $(PLATFORM_PATH)/one-aboot.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/python-saithrift.mk @@ -13,7 +15,8 @@ include $(PLATFORM_PATH)/docker-ptf-bfn.mk include $(PLATFORM_PATH)/bfn-platform.mk include $(PLATFORM_PATH)/bfn-platform-wnc.mk include $(PLATFORM_PATH)/bfn-platform-ingrasys.mk -SONIC_ALL += $(SONIC_ONE_IMAGE) \ + +SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT) \ $(DOCKER_FPM) # Inject sai into sairedis diff --git a/platform/p4/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista similarity index 100% rename from platform/p4/sonic-platform-modules-arista rename to platform/barefoot/sonic-platform-modules-arista diff --git a/platform/p4/one-aboot.mk b/platform/p4/one-aboot.mk deleted file mode 100644 index 95babf045c00..000000000000 --- a/platform/p4/one-aboot.mk +++ /dev/null @@ -1,12 +0,0 @@ -# sonic broadcom one image installer - -SONIC_ONE_ABOOT_IMAGE = sonic-aboot-p4.swi -$(SONIC_ONE_ABOOT_IMAGE)_MACHINE = p4 -$(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot -$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_DRIVERS) $(ARISTA_PLATFORM_MODULE_PYTHON2) $(ARISTA_PLATFORM_MODULE_PYTHON3) $(ARISTA_PLATFORM_MODULE) - -# FIXME: this is a temporary workaround for testing the platform driver -$(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += docker-platform-monitor.gz -# $(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) - -SONIC_INSTALLERS += $(SONIC_ONE_ABOOT_IMAGE) diff --git a/platform/p4/rules.mk b/platform/p4/rules.mk index ea3e31e973e2..7fe6a60fadac 100644 --- a/platform/p4/rules.mk +++ b/platform/p4/rules.mk @@ -1,6 +1,4 @@ # include $(PLATFORM_PATH)/p4-softswitch.mk -include $(PLATFORM_PATH)/platform-modules-arista.mk -include $(PLATFORM_PATH)/one-aboot.mk include $(PLATFORM_PATH)/tenjin.mk include $(PLATFORM_PATH)/p4-hlir.mk include $(PLATFORM_PATH)/p4c-bm.mk From a8c41d9a66ff3e31d709c3aa9c321da6acf6969f Mon Sep 17 00:00:00 2001 From: yurypm Date: Wed, 1 Aug 2018 22:47:36 +0100 Subject: [PATCH 1445/1833] [device] Update arista driver submodule (#1897) --- .gitmodules | 2 +- platform/barefoot/platform-modules-arista.mk | 1 + platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 57cd558057fe..b36e0f3e8865 100755 --- a/.gitmodules +++ b/.gitmodules @@ -77,6 +77,6 @@ [submodule "platform/broadcom/sonic-platform-modules-mitac"] path = platform/broadcom/sonic-platform-modules-mitac url = https://github.com/MiTAC-EBU/sonic-platform-modules-mitac.git -[submodule "platform/p4/sonic-platform-modules-arista"] +[submodule "platform/barefoot/sonic-platform-modules-arista"] path = platform/barefoot/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic diff --git a/platform/barefoot/platform-modules-arista.mk b/platform/barefoot/platform-modules-arista.mk index ec7566318c8d..633435c0550a 100644 --- a/platform/barefoot/platform-modules-arista.mk +++ b/platform/barefoot/platform-modules-arista.mk @@ -20,3 +20,4 @@ $(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODU export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MODULE_PYTHON3 ARISTA_PLATFORM_MODULE_DRIVERS +export ARISTA_SCD_DRIVER_CONFIG=m diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 02b22ae91135..98b983c32da2 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 02b22ae91135d4e4a9e11e06656dcff3056e2c7f +Subproject commit 98b983c32da28eaf35f9991d6dc1f6aca00d9335 diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index c114bb1f903a..98b983c32da2 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit c114bb1f903a5630c3a02d450a026949c323defd +Subproject commit 98b983c32da28eaf35f9991d6dc1f6aca00d9335 From 8e74230e864de8066b4033421b62cc40dcc12e4b Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Thu, 2 Aug 2018 08:02:48 +0800 Subject: [PATCH 1446/1833] [Ingrasys] Add platform support for S9180-32X/S9280-64X with Barefoot ASIC on master branch (#1880) * delete barefoot sonic-platform-modules-ingrasys * add submodule for barefoot sonic-platform-modules-ingrasys * add barefoot platform supports on master branch * change the default speed from 40G to 100G * remove barefoot sonic-platform-modules-ingrasys submodule * add ingrasys s9180-32x, s9280-64x barefoot platform drivers * update s9280-64x vdd core voltage * update ingrasys barefoot platform debian rules --- .../minigraph.xml | 4 +- .../x86_64-ingrasys_s9180_32x-r0/sensors.conf | 6 +- .../INGRASYS-S9280-64X/port_config.ini | 65 + .../INGRASYS-S9280-64X/switch-sai.conf | 33 + .../x86_64-ingrasys_s9280_64x-r0/fancontrol | 9 + .../installer.conf | 3 + .../minigraph.xml | 151 ++ .../plugins/eeprom.py | 22 + .../plugins/psuutil.py | 93 + .../plugins/sfputil.py | 300 +++ .../x86_64-ingrasys_s9280_64x-r0/sensors.conf | 85 + platform/barefoot/bfn-platform-ingrasys.mk | 4 +- platform/barefoot/one-image.mk | 1 + .../barefoot/platform-modules-ingrasys.mk | 7 + .../debian/changelog | 8 +- .../debian/control | 4 + .../debian/rules | 77 +- .../sonic-platform-ingrasys-s9180-32x.dirs | 4 - .../sonic-platform-ingrasys-s9180-32x.init | 41 + .../sonic-platform-ingrasys-s9180-32x.install | 4 - ...sonic-platform-ingrasys-s9180-32x.postinst | 57 - .../sonic-platform-ingrasys-s9180-32x.postrm | 42 - .../sonic-platform-ingrasys-s9180-32x.prerm | 21 - .../sonic-platform-ingrasys-s9180-32x.upstart | 7 - .../sonic-platform-ingrasys-s9280-64x.init | 41 + .../s9180-32x/modules/Makefile | 2 + .../s9180-32x/modules/cpld_wdt.c | 296 +++ .../s9180-32x/service/bfn.service | 13 - .../s9180-32x/utils/bfn | 44 - .../s9180-32x/utils/i2c_utils.sh | 42 +- .../s9180-32x/utils/s9180_32x_monitor.sh | 3 +- .../s9280-64x/README.md | 175 ++ .../s9280-64x/modules/Makefile | 3 + .../s9280-64x/modules/eeprom_mb.c | 267 +++ .../modules/ingrasys_s9280_64x_i2c_cpld.c | 1618 +++++++++++++++ .../modules/ingrasys_s9280_64x_i2c_cpld.h | 338 +++ .../modules/ingrasys_s9280_64x_platform.h | 158 ++ .../modules/ingrasys_s9280_64x_psu.c | 394 ++++ .../s9280-64x/service/qsfp-monitor.service | 15 + .../service/s9280-64x-monitor.service | 19 + .../s9280-64x/utils/i2c_utils.sh | 1844 +++++++++++++++++ .../s9280-64x/utils/qsfp_monitor.sh | 105 + .../s9280-64x/utils/s9280_64x_monitor.sh | 42 + 43 files changed, 6199 insertions(+), 268 deletions(-) create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/port_config.ini create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-sai.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/fancontrol create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/installer.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/eeprom.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/psuutil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/sfputil.py create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/sensors.conf delete mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.dirs create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.init delete mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.install delete mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postinst delete mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postrm delete mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.prerm delete mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.upstart create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9280-64x.init create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/cpld_wdt.c delete mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/bfn.service delete mode 100755 platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/bfn create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/README.md create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/Makefile create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/eeprom_mb.c create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_i2c_cpld.c create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_i2c_cpld.h create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_platform.h create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_psu.c create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/service/qsfp-monitor.service create mode 100644 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/service/s9280-64x-monitor.service create mode 100755 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/i2c_utils.sh create mode 100755 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/qsfp_monitor.sh create mode 100755 platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/s9280_64x_monitor.sh diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml index e2d151e6ec47..803ae39d22c2 100644 --- a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml @@ -93,7 +93,7 @@ - 40000 + 100000 DeviceInterfaceLink OCPSCH0104001MS Ethernet24 @@ -101,7 +101,7 @@ Ethernet0 - 40000 + 100000 DeviceInterfaceLink OCPSCH0104002MS Ethernet24 diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/sensors.conf index eb5a5b4b69f3..eb991d771d15 100644 --- a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/sensors.conf +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/sensors.conf @@ -40,9 +40,9 @@ chip "w83795adg-*" label in0 "0.9V" set in0_max 0.927 set in0_min 0.873 - label in1 "0.86V" - set in1_max 0.877 - set in1_min 0.843 + label in1 "VDD" + set in1_max 0.962 + set in1_min 0.717 ignore in2 ignore in3 ignore in4 diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/port_config.ini b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/port_config.ini new file mode 100644 index 000000000000..749f9f484a3d --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias speed autoneg fec index +Ethernet0 0,1,2,3 Ethernet0 100000 0 0 0 +Ethernet4 4,5,6,7 Ethernet4 100000 0 0 1 +Ethernet8 8,9,10,11 Ethernet8 100000 0 0 2 +Ethernet12 12,13,14,15 Ethernet12 100000 0 0 3 +Ethernet16 16,17,18,19 Ethernet16 100000 0 0 4 +Ethernet20 20,21,22,23 Ethernet20 100000 0 0 5 +Ethernet24 24,25,26,27 Ethernet24 100000 0 0 6 +Ethernet28 28,29,30,31 Ethernet28 100000 0 0 7 +Ethernet32 32,33,34,35 Ethernet32 100000 0 0 8 +Ethernet36 36,37,38,39 Ethernet36 100000 0 0 9 +Ethernet40 40,41,42,43 Ethernet40 100000 0 0 10 +Ethernet44 44,45,46,47 Ethernet44 100000 0 0 11 +Ethernet48 48,49,50,51 Ethernet48 100000 0 0 12 +Ethernet52 52,53,54,55 Ethernet52 100000 0 0 13 +Ethernet56 56,57,58,59 Ethernet56 100000 0 0 14 +Ethernet60 60,61,62,63 Ethernet60 100000 0 0 15 +Ethernet64 64,65,66,67 Ethernet64 100000 0 0 16 +Ethernet68 68,69,70,71 Ethernet68 100000 0 0 17 +Ethernet72 72,73,74,75 Ethernet72 100000 0 0 18 +Ethernet76 76,77,78,79 Ethernet76 100000 0 0 19 +Ethernet80 80,81,82,83 Ethernet80 100000 0 0 20 +Ethernet84 84,85,86,87 Ethernet84 100000 0 0 21 +Ethernet88 88,89,90,91 Ethernet88 100000 0 0 22 +Ethernet92 92,93,94,95 Ethernet92 100000 0 0 23 +Ethernet96 96,97,98,99 Ethernet96 100000 0 0 24 +Ethernet100 100,101,102,103 Ethernet100 100000 0 0 25 +Ethernet104 104,105,106,107 Ethernet104 100000 0 0 26 +Ethernet108 108,109,110,111 Ethernet108 100000 0 0 27 +Ethernet112 112,113,114,115 Ethernet112 100000 0 0 28 +Ethernet116 116,117,118,119 Ethernet116 100000 0 0 29 +Ethernet120 120,121,122,123 Ethernet120 100000 0 0 30 +Ethernet124 124,125,126,127 Ethernet124 100000 0 0 31 +Ethernet128 128,129,130,131 Ethernet128 100000 0 0 32 +Ethernet132 132,133,134,135 Ethernet132 100000 0 0 33 +Ethernet136 136,137,138,139 Ethernet136 100000 0 0 34 +Ethernet140 140,141,142,143 Ethernet140 100000 0 0 35 +Ethernet144 144,145,146,147 Ethernet144 100000 0 0 36 +Ethernet148 148,149,150,151 Ethernet148 100000 0 0 37 +Ethernet152 152,153,154,155 Ethernet152 100000 0 0 38 +Ethernet156 156,157,158,159 Ethernet156 100000 0 0 39 +Ethernet160 160,161,162,163 Ethernet160 100000 0 0 40 +Ethernet164 164,165,166,167 Ethernet164 100000 0 0 41 +Ethernet168 168,169,170,171 Ethernet168 100000 0 0 42 +Ethernet172 172,173,174,175 Ethernet172 100000 0 0 43 +Ethernet176 176,177,178,179 Ethernet176 100000 0 0 44 +Ethernet180 180,181,182,183 Ethernet180 100000 0 0 45 +Ethernet184 184,185,186,187 Ethernet184 100000 0 0 46 +Ethernet188 188,189,190,191 Ethernet188 100000 0 0 47 +Ethernet192 192,193,194,195 Ethernet192 100000 0 0 48 +Ethernet196 196,197,198,199 Ethernet196 100000 0 0 49 +Ethernet200 200,201,202,203 Ethernet200 100000 0 0 50 +Ethernet204 204,205,206,207 Ethernet204 100000 0 0 51 +Ethernet208 208,209,210,211 Ethernet208 100000 0 0 52 +Ethernet212 212,213,214,215 Ethernet212 100000 0 0 53 +Ethernet216 216,217,218,219 Ethernet216 100000 0 0 54 +Ethernet220 220,221,222,223 Ethernet220 100000 0 0 55 +Ethernet224 224,225,226,227 Ethernet224 100000 0 0 56 +Ethernet228 228,229,230,231 Ethernet228 100000 0 0 57 +Ethernet232 232,233,234,235 Ethernet232 100000 0 0 58 +Ethernet236 236,237,238,239 Ethernet236 100000 0 0 59 +Ethernet240 240,241,242,243 Ethernet240 100000 0 0 60 +Ethernet244 244,245,246,247 Ethernet244 100000 0 0 61 +Ethernet248 248,249,250,251 Ethernet248 100000 0 0 62 +Ethernet252 252,253,254,255 Ethernet252 100000 0 0 63 diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-sai.conf b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-sai.conf new file mode 100644 index 000000000000..224d1fc58b18 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-sai.conf @@ -0,0 +1,33 @@ +{ + "chip_list": [ + { + "id": "asic-0", + "chip_family": "Tofino", + "instance": 0, + "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", + "pcie_domain": 0, + "pcie_bus": 5, + "pcie_fn": 0, + "pcie_dev": 0, + "pcie_int_mode": 1, + "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + } + ], + "instance": 0, + "p4_program_list": [ + { + "id": "pgm-0", + "instance": 0, + "path": "switch", + "program-name": "switch", + "pd": "lib/tofinopd/switch/libpd.so", + "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", + "table-config": "share/tofinopd/switch/context.json", + "tofino-bin": "share/tofinopd/switch/tofino.bin", + "switchapi": "lib/libswitchapi.so", + "switchsai": "lib/libswitchsai.so", + "agent0": "lib/platform/x86_64-ingrasys_s9280_64x-r0/libpltfm_mgr.so", + "switchapi_port_add": false + } + ] +} diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/fancontrol b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/fancontrol new file mode 100644 index 000000000000..c131df9df32c --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/fancontrol @@ -0,0 +1,9 @@ +INTERVAL=10 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-16/16-002f hwmon3=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-6/6-004e +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm2=hwmon3/temp1_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm2=hwmon1/device/fan3_input hwmon1/device/pwm2=hwmon1/device/fan1_input +MINTEMP=hwmon1/device/pwm2=20 +MAXTEMP=hwmon1/device/pwm2=60 +MINSTART=hwmon1/device/pwm2=75 +MINSTOP=hwmon1/device/pwm2=22 diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/installer.conf b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/minigraph.xml new file mode 100644 index 000000000000..ffc71df148e5 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/minigraph.xml @@ -0,0 +1,151 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + OCPSCH01040GGLF + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + OCPSCH01040GGLF + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + OCPSCH01040GGLF + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + OCPSCH01040GGLF + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + 100000 + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + OCPSCH01040GGLF + Ethernet0 + + + 100000 + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + OCPSCH01040GGLF + Ethernet4 + + + + + OCPSCH01040GGLF + INGRASYS-S9280-64X + + + + + + + OCPSCH01040GGLF + + + 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 + + + + + + + OCPSCH01040GGLF + INGRASYS-S9280-64X +
diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/eeprom.py b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..ecf171539843 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Ingrasys S9280-64X +# +# 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-0051/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/psuutil.py b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..c4b78c943e81 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/psuutil.py @@ -0,0 +1,93 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + # TODO: need to check if the patch mapping correct + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-18/18-0050", + "/sys/bus/i2c/devices/i2c-17/17-0050"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_pg' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_abs' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 0): + status = 1 + + return status + diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..d9ef84c331c5 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/sfputil.py @@ -0,0 +1,300 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 63 + PORTS_IN_BLOCK = 64 + EEPROM_OFFSET = 41 + CPLD1_PORTS = 12 + CPLDx_PORTS = 13 + #TODO: check init sequence for CPLD i2c bus + CPLD_OFFSET = 1 + CPLD_PRES_BIT = 1 + CPLD_RESET_BIT = 0 + CPLD_LPMOD_BIT = 2 + CPLDx_I2C_ADDR = "33" + EEPROM_I2C_ADDR = "50" + CPLD_PORT_STATUS_KEY = "cpld_qsfp_port_status" + CPLD_PORT_CONFIG_KEY = "cpld_qsfp_port_config" + CPLD_REG_PATH = "/sys/bus/i2c/devices/{0}-00{1}/{2}_{3}" + + _port_to_eeprom_mapping = {} + + #TODO: check the fp port to phy port mapping + _fp2phy_port_mapping = { + 0: 0, + 1: 1, + 2: 4, + 3: 5, + 4: 8, + 5: 9, + 6: 12, + 7: 13, + 8: 16, + 9: 17, + 10: 20, + 11: 21, + 12: 24, + 13: 25, + 14: 28, + 15: 29, + 16: 32, + 17: 33, + 18: 36, + 19: 37, + 20: 40, + 21: 41, + 22: 44, + 23: 45, + 24: 48, + 25: 49, + 26: 52, + 27: 53, + 28: 56, + 29: 57, + 30: 60, + 31: 61, + 32: 2, + 33: 3, + 34: 6, + 35: 7, + 36: 10, + 37: 11, + 38: 14, + 39: 15, + 40: 18, + 41: 19, + 42: 22, + 43: 23, + 44: 26, + 45: 27, + 46: 30, + 47: 31, + 48: 34, + 49: 35, + 50: 38, + 51: 39, + 52: 42, + 53: 43, + 54: 46, + 55: 47, + 56: 50, + 57: 51, + 58: 54, + 59: 55, + 60: 58, + 61: 59, + 62: 62, + 63: 63 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + + def __init__(self): + # Override port_to_eeprom_mapping for class initialization + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-00{1}/eeprom" + for x in range(self.port_start, self.port_end + 1): + phy_port = self.fp2phy_port_num(x) + port_eeprom_path = eeprom_path.format(phy_port + self.EEPROM_OFFSET, self.EEPROM_I2C_ADDR) + self.port_to_eeprom_mapping[x] = port_eeprom_path + + SfpUtilBase.__init__(self) + + def qsfp_to_cpld_index(self, port_num): + if port_num < self.CPLD1_PORTS: + cpld_id = 0 + cpld_port_index = port_num + 1 + else: + cpld_id = 1 + (port_num - self.CPLD1_PORTS) / self.CPLDx_PORTS + cpld_port_index = ((port_num - self.CPLD1_PORTS) % self.CPLDx_PORTS) + 1 + return cpld_id, cpld_port_index + + def fp2phy_port_num(self, fp_port_num): + + phy_port_num = self._fp2phy_port_mapping[fp_port_num] + return phy_port_num + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self.fp2phy_port_num(port_num) + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_STATUS_KEY, cpld_port_index) + + try: + reg_file = open(reg_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_file.close() + + reg_value = int(content, 16) + # mask for presence bit (bit 1) + mask = (1 << self.CPLD_PRES_BIT) + + # 0 - presence, 1 - absence + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self.fp2phy_port_num(port_num) + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_CONFIG_KEY, cpld_port_index) + + try: + reg_file = open(reg_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_file.close() + + reg_value = int(content, 16) + # mask for lp_mod bit (bit 2) + mask = (1 << self.CPLD_LPMOD_BIT) + + # 0 - disable, 1 - low power mode + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self.fp2phy_port_num(port_num) + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_CONFIG_KEY, cpld_port_index) + + try: + reg_file = open(reg_path, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_value = int(content, 16) + # mask for lp_mod bit (bit 2) + mask = (1 << self.CPLD_LPMOD_BIT) + + # 1 - low power mode, 0 - high power mode + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # convert value to hex string + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # logic port to physical port mapping + port_num = self.fp2phy_port_num(port_num) + + cpld_id, cpld_port_index = self.qsfp_to_cpld_index(port_num) + i2c_id = self.CPLD_OFFSET + cpld_id + reg_path = self.CPLD_REG_PATH.format(i2c_id, self.CPLDx_I2C_ADDR, \ + self.CPLD_PORT_CONFIG_KEY, cpld_port_index) + + # reset the port + try: + reg_file = open(reg_path, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # content is a string containing the status register value + content = reg_file.readline().rstrip() + reg_value = int(content, 16) + # mask for reset bit (bit 0) + mask = (1 << self.CPLD_RESET_BIT) + + # 1 - out of reset, 0 - reset + reg_value = reg_value & ~mask + + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 1 second to reset done + time.sleep(1) + + # take the port out of reset + try: + reg_file = open(reg_path, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/sensors.conf b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/sensors.conf new file mode 100644 index 000000000000..ddc04a5f4ad6 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/sensors.conf @@ -0,0 +1,85 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + +bus "i2c-16" "i2c-mux-1 (chan_id 7)" +chip "w83795adg-*" + ignore in0 + label in1 "VDD_CORE" + set in1_min 0.717 + set in1_max 0.962 + ignore in2 + ignore in3 + label in4 "3.3V" + compute in4 @/(0.3052), (0.3052)*@ + set in4_min 3.3 * 0.95 + set in4_max 3.3 * 1.05 + label in5 "0.9V" + set in5_min 0.90 * 0.98 + set in5_max 0.90 * 1.02 + ignore in6 + ignore in7 + ignore in8 + ignore in9 + ignore in10 + ignore in11 + ignore in12 + ignore in13 + ignore in14 + ignore in15 + ignore in16 + ignore in17 + ignore in18 + ignore in19 + label fan1 "FANTRAY 1" + ignore fan2 + label fan3 "FANTRAY 2" + ignore fan4 + label fan5 "FANTRAY 3" + ignore fan6 + label fan7 "FANTRAY 4" + ignore fan8 + ignore temp1 + ignore temp2 + ignore temp3 + ignore temp4 + ignore temp5 + ignore temp6 + ignore intrusion0 + +chip "tmp75-i2c-*-4A" + label temp1 "BMC Board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-0" "SMBus I801 adapter at f000" +chip "tmp75-i2c-*-4F" + label temp1 "x86 CPU Board Temp" + set temp1_max 50 + set temp1_max_hyst 45 + +bus "i2c-6" "i2c-0-mux (chan_id 5)" +chip "lm75-i2c-6-4D" + label temp1 "Rear Panel Temp" + set temp1_max 50 + set temp1_max_hyst 45 +chip "lm75-i2c-6-4E" + label temp1 "Rear MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 +chip "lm86-i2c-6-4C" + label temp1 "MB Temp" + set temp1_max 50 + label temp2 "MAC Temp" + set temp2_max 70 +bus "i2c-7" "i2c-0-mux (chan_id 6)" +chip "lm75-i2c-7-4D" + label temp1 "Front Panel Temp" + set temp1_max 50 + set temp1_max_hyst 45 +chip "lm75-i2c-7-4E" + label temp1 "Front MAC Temp" + set temp1_max 50 + set temp1_max_hyst 45 diff --git a/platform/barefoot/bfn-platform-ingrasys.mk b/platform/barefoot/bfn-platform-ingrasys.mk index a85d69baab79..7f3ba4746572 100644 --- a/platform/barefoot/bfn-platform-ingrasys.mk +++ b/platform/barefoot/bfn-platform-ingrasys.mk @@ -1,5 +1,5 @@ -BFN_INGRASYS_PLATFORM = bfnplatform-ingrasys_1.0.0_amd64.deb -$(BFN_INGRASYS_PLATFORM)_URL = "https://github.com/Ingrasys-sonic/packages/raw/master/lib/bfnplatform-ingrasys_1.0.0_amd64.deb" +BFN_INGRASYS_PLATFORM = bfnplatform-ingrasys_8.2.0_amd64.deb +$(BFN_INGRASYS_PLATFORM)_URL = "https://github.com/Ingrasys-sonic/packages/raw/master/lib/bfnplatform-ingrasys_8.2.0_amd64.deb" SONIC_ONLINE_DEBS += $(BFN_INGRASYS_PLATFORM) # $(BFN_SAI_DEV) $(BFN_SAI_DEV)_DEPENDS += $(BFN_INGRASYS_PLATFORM) diff --git a/platform/barefoot/one-image.mk b/platform/barefoot/one-image.mk index a7b5d009516d..490712f6818e 100644 --- a/platform/barefoot/one-image.mk +++ b/platform/barefoot/one-image.mk @@ -7,5 +7,6 @@ $(SONIC_ONE_IMAGE)_INSTALLS += $(BFN_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(WNC_OSW1800_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9180_32X_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9280_64X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/barefoot/platform-modules-ingrasys.mk b/platform/barefoot/platform-modules-ingrasys.mk index 7204adb7e02d..5145dcbc5ffa 100644 --- a/platform/barefoot/platform-modules-ingrasys.mk +++ b/platform/barefoot/platform-modules-ingrasys.mk @@ -1,11 +1,18 @@ # Ingrasys S9180-32X Platform modules INGRASYS_S9180_32X_PLATFORM_MODULE_VERSION = 1.1.0 +INGRASYS_S9280_64X_PLATFORM_MODULE_VERSION = 1.1.0 export INGRASYS_S9180_32X_PLATFORM_MODULE_VERSION +export INGRASYS_S9280_64X_PLATFORM_MODULE_VERSION INGRASYS_S9180_32X_PLATFORM_MODULE = sonic-platform-ingrasys-s9180-32x_$(INGRASYS_S9180_32X_PLATFORM_MODULE_VERSION)_amd64.deb $(INGRASYS_S9180_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ingrasys $(INGRASYS_S9180_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(INGRASYS_S9180_32X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9180_32x-r0 SONIC_DPKG_DEBS += $(INGRASYS_S9180_32X_PLATFORM_MODULE) + +INGRASYS_S9280_64X_PLATFORM_MODULE = sonic-platform-ingrasys-s9280-64x_$(INGRASYS_S9280_64X_PLATFORM_MODULE_VERSION)_amd64.deb +$(INGRASYS_S9280_64X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9280_64x-r0 + +$(eval $(call add_extra_package,$(INGRASYS_S9180_32X_PLATFORM_MODULE),$(INGRASYS_S9280_64X_PLATFORM_MODULE))) diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/changelog b/platform/barefoot/sonic-platform-modules-ingrasys/debian/changelog index f5c70c166031..cfbeb17d018a 100644 --- a/platform/barefoot/sonic-platform-modules-ingrasys/debian/changelog +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/changelog @@ -1,15 +1,9 @@ platform-driver (1.1.0) unstable; urgency=low - * Add support for s9180-32x + * Add support for s9180-32x s9280-64x -- developer Fri, 26 May 2017 11:00:00 +0800 -platform-driver (1.1.0) unstable; urgency=low - - * Add support for s8900 series - - -- developer Wed, 29 Mar 2017 11:00:00 +0800 - platform-driver (1.0.0) unstable; urgency=low * Initial release (Closes: #nnnn) diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/control b/platform/barefoot/sonic-platform-modules-ingrasys/debian/control index ec2c1f20c0f7..a912ed8ace2e 100644 --- a/platform/barefoot/sonic-platform-modules-ingrasys/debian/control +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/control @@ -8,3 +8,7 @@ Standards-Version: 1.0.0 Package: sonic-platform-ingrasys-s9180-32x Architecture: amd64 Description: This package contains S9180-32X platform driver utility for SONiC project. + +Package: sonic-platform-ingrasys-s9280-64x +Architecture: amd64 +Description: This package contains S9280-64X platform driver utility for SONiC project. diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/rules b/platform/barefoot/sonic-platform-modules-ingrasys/debian/rules index 3ac0d3de6049..428b4731eb75 100755 --- a/platform/barefoot/sonic-platform-modules-ingrasys/debian/rules +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/rules @@ -1,13 +1,4 @@ #!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 export INSTALL_MOD_DIR:=extra @@ -15,7 +6,7 @@ PACKAGE_PRE_NAME := sonic-platform-ingrasys KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= s9180-32x +MODULE_DIRS:= s9180-32x s9280-64x MODULE_DIR := modules UTILS_DIR := utils SERVICE_DIR := service @@ -24,58 +15,28 @@ CONF_DIR := conf %: dh $@ --with systemd -clean: - dh_testdir - dh_testroot - dh_clean - -build: - #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) +override_dh_auto_build: (for mod in $(MODULE_DIRS); do \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ done) -binary: binary-arch binary-indep - # Nothing to do - -binary-arch: - # Nothing to do - -#install: build - #dh_testdir - #dh_testroot - #dh_clean -k - #dh_installdirs - -binary-indep: - dh_testdir - dh_installdirs +override_dh_auto_install: + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} \ + $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko \ + debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/sbin; \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.sh \ + debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/sbin; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service \ + debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ + done) - # Custom package commands +override_dh_clean: + dh_clean (for mod in $(MODULE_DIRS); do \ - mkdir debian/tmp/usr/sbin -p; \ - mkdir debian/tmp/lib/systemd/system -p; \ - mkdir debian/tmp/etc/init.d -p; \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.sh debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/sbin/; \ - cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/bfn debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/init\.d/; \ - cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ done) - # Resuming debhelper scripts - dh_testroot - dh_install - dh_installchangelogs - dh_installdocs - dh_systemd_enable - dh_installinit - dh_systemd_start - dh_link - dh_fixperms - dh_compress - dh_strip - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb -.PHONY: build binary binary-arch binary-indep clean + diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.dirs b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.dirs deleted file mode 100644 index 401d79eb79b8..000000000000 --- a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.dirs +++ /dev/null @@ -1,4 +0,0 @@ -usr/sbin -lib/systemd/system -etc/ -etc/init.d/ \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.init b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.init new file mode 100644 index 000000000000..9479fa354949 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.init @@ -0,0 +1,41 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup S9180-32X board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + depmod -a + + echo "done." + ;; + +stop) + + i2c_utils.sh i2c_deinit + + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/sonic-platform-ingrasys-s9180-32x.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.install b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.install deleted file mode 100644 index 99bda5d123ae..000000000000 --- a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.install +++ /dev/null @@ -1,4 +0,0 @@ -lib/systemd/ -usr/sbin/ -etc/ -etc/init.d/ diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postinst b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postinst deleted file mode 100644 index 38e5cac148c4..000000000000 --- a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postinst +++ /dev/null @@ -1,57 +0,0 @@ -# Automatically added by dh_systemd_enable -# This will only remove masks created by d-s-h on package removal. -deb-systemd-helper unmask s9180-32x-monitor.service >/dev/null || true -deb-systemd-helper unmask bfn.service >/dev/null || true -deb-systemd-helper unmask qsfp-monitor.service >/dev/null || true -# Generate kernel modules.dep and map files for add eeprom_mb. -depmod -a || true -# was-enabled defaults to true, so new installations run enable. -if deb-systemd-helper --quiet was-enabled s9180-32x-monitor.service; then - # Enables the unit on first installation, creates new - # symlinks on upgrades if the unit file has changed. - deb-systemd-helper enable s9180-32x-monitor.service >/dev/null || true -else - # Update the statefile to add new symlinks (if any), which need to be - # cleaned up on purge. Also remove old symlinks. - deb-systemd-helper update-state s9180-32x-monitor.service >/dev/null || true -fi -if deb-systemd-helper --quiet was-enabled bfn.service; then - # Enables the unit on first installation, creates new - # symlinks on upgrades if the unit file has changed. - deb-systemd-helper enable bfn.service >/dev/null || true -else - # Update the statefile to add new symlinks (if any), which need to be - # cleaned up on purge. Also remove old symlinks. - deb-systemd-helper update-state bfn.service >/dev/null || true -fi -if deb-systemd-helper --quiet was-enabled qsfp-monitor.service; then - # Enables the unit on first installation, creates new - # symlinks on upgrades if the unit file has changed. - deb-systemd-helper enable qsfp-monitor.service >/dev/null || true -else - # Update the statefile to add new symlinks (if any), which need to be - # cleaned up on purge. Also remove old symlinks. - deb-systemd-helper update-state qsfp-monitor.service >/dev/null || true -fi -# End automatically added section -# Automatically added by dh_installinit -if [ -x "/etc/init.d/s9180-32x-monitor" ]; then - update-rc.d s9180-32x-monitor defaults >/dev/null - invoke-rc.d s9180-32x-monitor start || exit $? -fi -if [ -x "/etc/init.d/qsfp-monitor" ]; then - update-rc.d qsfp-monitor defaults >/dev/null - invoke-rc.d qsfp-monitor start || exit $? -fi -if [ -x "/etc/init.d/bfn" ]; then - invoke-rc.d bfn start || exit $? -fi -# End automatically added section -# Automatically added by dh_systemd_start -if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true - deb-systemd-invoke start s9180-32x-monitor.service >/dev/null || true - deb-systemd-invoke start qsfp-monitor.service >/dev/null || true - deb-systemd-invoke start bfn.service >/dev/null || true -fi -# End automatically added section diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postrm b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postrm deleted file mode 100644 index 19c6bcb2945f..000000000000 --- a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.postrm +++ /dev/null @@ -1,42 +0,0 @@ -# Automatically added by dh_systemd_start -if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true - fi -# End automatically added section -# Automatically added by dh_installinit -if [ "$1" = "purge" ] ; then - update-rc.d s9180-32x-monitor remove >/dev/null - update-rc.d bfn remove >/dev/null - update-rc.d qsfp-monitor remove >/dev/null -fi - - -# In case this system is running systemd, we make systemd reload the unit files -# to pick up changes. -if [ -d /run/systemd/system ] ; then - systemctl --system daemon-reload >/dev/null || true -fi -# End automatically added section -# Automatically added by dh_systemd_enable -if [ "$1" = "remove" ]; then - if [ -x "/usr/bin/deb-systemd-helper" ]; then - deb-systemd-helper mask s9180-32x-monitor.service >/dev/null - deb-systemd-helper mask bfn.service >/dev/null - deb-systemd-helper mask qsfp-monitor.service >/dev/null - fi -fi - -if [ "$1" = "purge" ]; then - if [ -x "/usr/bin/deb-systemd-helper" ]; then - deb-systemd-helper purge s9180-32x-monitor.service >/dev/null - deb-systemd-helper unmask s9180-32x-monitor.service >/dev/null - deb-systemd-helper purge bfn.service >/dev/null - deb-systemd-helper unmask bfn.service >/dev/null - deb-systemd-helper purge qsfp-monitor.service >/dev/null - deb-systemd-helper unmask qsfp-monitor.service >/dev/null - fi -fi -# Generate kernel modules.dep and map files for remove eeprom_mb. -depmod -a || true -# End automatically added section - diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.prerm b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.prerm deleted file mode 100644 index 76533bfe6889..000000000000 --- a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.prerm +++ /dev/null @@ -1,21 +0,0 @@ -# Automatically added by dh_systemd_start -if [ -d /run/systemd/system ]; then - deb-systemd-invoke stop s9180-32x-monitor.service >/dev/null - deb-systemd-invoke stop bfn.service >/dev/null - deb-systemd-invoke stop qsfp-monitor.service >/dev/null -fi -# End automatically added section -# Automatically added by dh_installinit -if [ -x "/etc/init.d/s9180-32x-monitor" ]; then - invoke-rc.d s9180-32x-monitor stop || exit $? -fi -if [ -x "/etc/init.d/bfn" ]; then - invoke-rc.d bfn stop || exit $? -fi -if [ -x "/etc/init.d/qsfp-monitor" ]; then - invoke-rc.d qsfp-monitor stop || exit $? -fi -# Driver deinit -/usr/sbin/i2c_utils.sh i2c_deinit -# End automatically added section - diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.upstart b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.upstart deleted file mode 100644 index 2c8d2ebec6d7..000000000000 --- a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9180-32x.upstart +++ /dev/null @@ -1,7 +0,0 @@ -description "SONiC platform service" - -respawn - -exec /usr/sbin/s9180_32x_monitor.sh -exec /usr/sbin/qsfp_monitor.sh -exec /etc/init.d/bfn start diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9280-64x.init b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9280-64x.init new file mode 100644 index 000000000000..545ec8e9987a --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9280-64x.init @@ -0,0 +1,41 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup S9280-64X board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + depmod -a + + echo "done." + ;; + +stop) + + i2c_utils i2c_deinit + + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/sonic-platform-ingrasys-s9280-64x.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/Makefile b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/Makefile index 3edb8690475e..df7bfd3e770e 100644 --- a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/Makefile +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/Makefile @@ -1 +1,3 @@ obj-m := eeprom_mb.o +obj-m+= cpld_wdt.o + diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/cpld_wdt.c b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/cpld_wdt.c new file mode 100644 index 000000000000..4cf70b4b80ab --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/modules/cpld_wdt.c @@ -0,0 +1,296 @@ +/* + * CPLD Watchdog Driver + * + * Copyright (c) 2018 Ingrasys Corp. + * + * Author: Wade He + * + * 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, see . + */ + +/* + * Includes, defines, variables, module parameters, ... + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +/* Module and version information */ +#define DRV_NAME "cpld_wdt" +#define DRV_VERSION "1.0" + +/* Includes */ +#include /* For module specific items */ +#include /* For new moduleparam's */ +#include /* For standard types (like size_t) */ +#include /* For the -ENODEV/... values */ +#include /* For printk/panic/... */ +#include /* For the watchdog specific items */ +#include /* For __init/__exit/... */ +#include /* For file operations */ +#include /* For platform_driver framework */ +#include /* For pci functions */ +#include /* For io-port access */ +#include /* For spin_lock/spin_unlock/... */ +#include /* For copy_to_user/put_user/... */ +#include /* For inb/outb/... */ +#include +#include +#include +#include + + +/* Address definitions for the CPLD */ +/* CPLD base address */ +#define TCOBASE 0x600 +/* SMI Control and Enable Register */ + +#define TCO_RLD (TCOBASE + 0x00) /* TCO Timer Reload and Curr. Value */ +#define TCOv1_TMR (TCOBASE + 0x01) /* TCOv1 Timer Initial Value */ +#define TCO_DAT_IN (TCOBASE + 0x02) /* TCO Data In Register */ +#define TCO_DAT_OUT (TCOBASE + 0x03) /* TCO Data Out Register */ +#define TCO1_STS (TCOBASE + 0x04) /* Control Watchdog Register */ +#define TCO2_STS (TCOBASE + 0x06) /* TCO2 Status Register */ +#define TCO1_CNT (TCOBASE + 0x08) /* TCO1 Control Register */ +#define TCO2_CNT (TCOBASE + 0x0a) /* TCO2 Control Register */ +#define TCOv2_TMR (TCOBASE + 0x12) /* TCOv2 Timer Initial Value */ + +#define DEBUG +#ifdef DEBUG + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s[%d]: " fmt "\r\n", \ + __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define ERROR_MSG(fmt, args...) \ + printk(KERN_ERR "%s[%d]: " fmt "\r\n", \ + __FUNCTION__, __LINE__, ##args) + + + +/* internal variables */ +static struct { /* this is private data for the cpld_wdt device */ + /* the lock for io operations */ + spinlock_t io_lock; + struct platform_device *dev; +} cpld_wdt_private; + +static struct task_struct *cpld_wdt_tsk; +static int data; + +static void device_release(struct device *dev) +{ + return; +} + +static struct platform_device cpld_wdt = { + .name = DRV_NAME, + .id = 0, + .dev = { + .platform_data = NULL, + .release = device_release + }, +}; + +/* module parameters */ +#define WATCHDOG_TIMEOUT 15 /* 15 sec default heartbeat */ +static int heartbeat = WATCHDOG_TIMEOUT; /* in seconds */ +module_param(heartbeat, int, 0); +MODULE_PARM_DESC(heartbeat, "Watchdog ping period in seconds. " + "5..20, default=" + __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); + +static bool nowayout = WATCHDOG_NOWAYOUT; +module_param(nowayout, bool, 0); +MODULE_PARM_DESC(nowayout, + "Watchdog cannot be stopped once started (default=" + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); + + +static int cpld_wdt_check_timeout_range(unsigned int tmrval) +{ + if (tmrval < 5 || tmrval > 20) { + DEBUG_PRINT("heartbeat out of range, using default=%d\n", WATCHDOG_TIMEOUT); + heartbeat = WATCHDOG_TIMEOUT; + } else { + DEBUG_PRINT("heartbeat using %d seconds\n", heartbeat); + } + + return 0; +} + +/* + * Some TCO specific functions + */ + +static int cpld_wdt_stop(void *arg) +{ + + spin_lock(&cpld_wdt_private.io_lock); + + outb(0x1, TCO1_STS); + + DEBUG_PRINT("cpld_wdt_stop done"); + + spin_unlock(&cpld_wdt_private.io_lock); + + return 0; +} + +static int cpld_wdt_ping(void *arg) +{ + spin_lock(&cpld_wdt_private.io_lock); + + /* Reload the timer by writing to the TCO Timer Counter register */ + outb(0x1, TCO1_STS); /* write 1 to clear bit */ + udelay(100); + outb(0x3, TCO1_STS); + + DEBUG_PRINT("cpld_wdt_ping done"); + + spin_unlock(&cpld_wdt_private.io_lock); + return 0; +} + +static int kthread_wdt_ping_loop(void *arg) +{ + int i; + + set_current_state(TASK_INTERRUPTIBLE); + + while(!kthread_should_stop()) { + DEBUG_PRINT("ping start"); + cpld_wdt_ping(NULL); + set_current_state(TASK_INTERRUPTIBLE); + for (i=0;i"); +MODULE_DESCRIPTION("CPLD Watchdog Timer Kernel Driver"); +MODULE_VERSION(DRV_VERSION); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" DRV_NAME); diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/bfn.service b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/bfn.service deleted file mode 100644 index 6c8c2fb71517..000000000000 --- a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/service/bfn.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Barefoot Kernel Module -After=local-fs.target -Before=docker.service - -[Service] -Type=oneshot -ExecStart=-/etc/init.d/bfn start -ExecStop=-/etc/init.d/bfn stop -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/bfn b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/bfn deleted file mode 100755 index c52b1fab4ea1..000000000000 --- a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/bfn +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# This script load/unload Barefoot kernel modules - -### BEGIN INIT INFO -# Provides: -# Required-Start: -# Required-Stop: -# Should-Start: -# Should-Stop: -# Default-Start: S -# Default-Stop: 0 6 -# Short-Description: Load Barefoot kernel modules -### END INIT INFO - -case "$1" in -start) - echo -n "Load Barefoot kernel modules... " - - modprobe bf_kdrv - modprobe bf_tun - - echo "done." - ;; - -stop) - echo -n "Unload Barefoot kernel modules... " - - rmmod bf_tun - rmmod bf_kdrv - - echo "done." - ;; - -force-reload|restart) - echo "Not supported" - ;; - -*) - echo "Usage: /etc/init.d/bfn {start|stop}" - exit 1 - ;; -esac - -exit 0 diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/i2c_utils.sh b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/i2c_utils.sh index e765ed1da6a9..969ba09f84cb 100755 --- a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/i2c_utils.sh +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/i2c_utils.sh @@ -72,6 +72,7 @@ NUM_FRU_MUX_CHAN2_DEVICE=$(( ${NUM_FRU_MUX_CHAN0_DEVICE} + 2 )) # FAN NUM_CPLD_DEVICE=$(( ${NUM_MUX7_CHAN0_DEVICE} + 3 )) # CPLD NUM_SFP1_DEVICE=$(( ${NUM_MUX7_CHAN0_DEVICE} + 4 )) # CPLD NUM_SFP2_DEVICE=$(( ${NUM_MUX7_CHAN0_DEVICE} + 5 )) # CPLD +NUM_ROV_DEVICE=${NUM_MAIN_MUX_CHAN6_DEVICE} PATH_SYS_I2C_DEVICES="/sys/bus/i2c/devices" PATH_HWMON_ROOT_DEVICES="/sys/class/hwmon" @@ -89,12 +90,20 @@ PATH_MUX_CHAN7_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN7_DEVICE}" PATH_MUX7_CHAN0_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX7_CHAN0_DEVICE}" PATH_MAIN_MUX_CHAN0_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MAIN_MUX_CHAN0_DEVICE}" +# i2c address for deviecs +CPLD_I2C_ADDR=0x33 +ROV_I2C_ADDR=0x22 + #Power Supply Status PSU_DC_ON=1 PSU_DC_OFF=0 PSU_EXIST=1 PSU_NOT_EXIST=0 +# vdd value for mac +rov_val_array=( 0.85 0.82 0.77 0.87 0.74 0.84 0.79 0.89 ) +rov_reg_array=( 0x24 0x21 0x1c 0x26 0x19 0x23 0x1e 0x28 ) + # Help usage function function _help { echo "=========================================================" @@ -159,6 +168,7 @@ function _i2c_init { modprobe i2c_i801 modprobe i2c_dev modprobe i2c_mux_pca954x force_deselect_on_exit=1 + #modprobe cpld_wdt if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN0_DEVICE}" ]; then _retry "echo 'pca9548 0x70' > ${PATH_I801_DEVICE}/new_device" @@ -227,9 +237,35 @@ function _i2c_init { _i2c_led_fan_status_set _i2c_led_fan_tray_status_set + # rov for mac init + _mac_vdd_init + #SYS LED set green COLOR_SYS_LED="green" _i2c_sys_led + +} + +function _mac_vdd_init { + # read mac vid register value from CPLD + val=`i2cget -y ${NUM_CPLD_DEVICE} ${CPLD_I2C_ADDR} 0x42 2>/dev/null` + + # get vid form register value [0:2] + vid=$(($val & 0x7)) + + # get rov val and reg according to vid + rov_val=${rov_val_array[$vid]} + rov_reg=${rov_reg_array[$vid]} + echo "vid=${vid}, rov_val=${rov_val}, rov_reg=${rov_reg}" + + # write the rov reg to rov + i2cset -y -r ${NUM_ROV_DEVICE} ${ROV_I2C_ADDR} 0x21 ${rov_reg} w + + if [ $? -eq 0 ]; then + echo "set ROV for mac vdd done" + else + echo "set ROV for mac vdd fail" + fi } #I2C Deinit @@ -290,7 +326,7 @@ function _i2c_io_exp_init { i2cset -y -r ${NUM_I801_DEVICE} 0x26 5 0x00 i2cset -y -r ${NUM_I801_DEVICE} 0x26 2 0x3F i2cset -y -r ${NUM_I801_DEVICE} 0x26 3 0x1F - i2cset -y -r ${NUM_I801_DEVICE} 0x26 6 0xC0 + i2cset -y -r ${NUM_I801_DEVICE} 0x26 6 0xD0 i2cset -y -r ${NUM_I801_DEVICE} 0x26 7 0x00 #CPU Baord @@ -914,7 +950,7 @@ function _i2c_qsfp_eeprom_init { if [ "${action}" == "new" ] && \ ! [ -L ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr) ]; then - echo "sff8436 $eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/new_device + echo "optoe1 $eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/new_device elif [ "${action}" == "delete" ] && \ [ -L ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr) ]; then echo "$eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/delete_device @@ -1006,7 +1042,7 @@ function _i2c_sfp_eeprom_init { return fi - #Init 1-32 ports EEPROM + #Init 33-34 ports EEPROM if [ "${action}" == "new" ] && \ ! [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_SFP1_DEVICE}-0050 ] && \ ! [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_SFP2_DEVICE}-0050 ]; then diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/s9180_32x_monitor.sh b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/s9180_32x_monitor.sh index c110bdeaaf04..eedf685b290b 100755 --- a/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/s9180_32x_monitor.sh +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9180-32x/utils/s9180_32x_monitor.sh @@ -21,6 +21,7 @@ I2C_UTILS="/usr/sbin/i2c_utils.sh" # TBD: LED status monitor function _led_monitor { ${I2C_UTILS} i2c_led_fan_status_set >/dev/null + ${I2C_UTILS} i2c_led_psu_status_set >/dev/null ${I2C_UTILS} i2c_led_fan_tray_status_set >/dev/null } @@ -38,4 +39,4 @@ function _main { done } -_main \ No newline at end of file +_main diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/README.md b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/README.md new file mode 100644 index 000000000000..7411603ba608 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/README.md @@ -0,0 +1,175 @@ +# Ingrasys S9280-64X Platform Driver for SONiC + +Copyright (C) 2016 Ingrasys, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +## Licensing terms + +The Licensing terms of the files within this project is split 2 parts. +The Linux kernel is released under the GNU General Public License version 2. +All other code is released under the GNU General Public License version 3. +Please see the LICENSE file for copies of both licenses. + +## Contents of this package + + - service/ + > Service config files for platform initialization and monitoring + - utils/ + > Scripts useful during platform bringup and sysfs function + - conf/ + > Platform configure files. + +## Kernel modules and drivers + +The driver for interacting with Ingrasys S9280-64X is contained in the I2C +kernel module and initialization script. The initialization script loads +the modules in the correct order. It has been built and tested against +the Linux 3.16 kernel. + +The initialization script will modprobe the needed modules, navigate to the +module's device directory in sysfs, and write configuration data to +the kernel module. + +### IGB + +This is OOB Ports on front panel for management plane. + +The IGB module must be loaded first on Ingrasys S9280-64X platform. + +### I2C i801 + +The I2C i801 on Ingrasys S9280-64X can be found in +`/sys/bus/i2c/devices/i2c-0/` + +This is I2C bus for Clock Gen, DIMM channel and digital potentiometers. + +The i801 module must be loaded second on Ingrasys S9280-64X. + +### I2C PCA9548 +The PCA9548 module on S9280-64X can be found in +`/sys/bus/i2c/devices/i2c-0/` , `/sys/bus/i2c/devices/i2c-17/`, +`/sys/bus/i2c/devices/i2c-18/` , `/sys/bus/i2c/devices/i2c-19/`, +`/sys/bus/i2c/devices/i2c-20/`, `/sys/bus/i2c/devices/i2c-21/`, +`/sys/bus/i2c/devices/i2c-22/`, `/sys/bus/i2c/devices/i2c-23/`, +`/sys/bus/i2c/devices/i2c-24/`. + +The pca9548 module for zQSFP module get/set functions, PSU information, +fan status and EEPROM. + +## Hardware components + +The hardware components are initialized in the init script on S9280-64X. +The following describes manual initialization as well as interaction. +The examples below are just for Ingrasys S9280-64X platform. + +### Hardware initialization + +When the sonic-platform-ingrasys-s9280 package is installed on the S9280-64X, +it is automatically initialized. If you want to manual initialization, the +utility command usage as follows: +``` + i2c_utils.sh i2c_init +``` + +### EEPROM + +The EEPROM is including the board SKU, model name, vendor name, serial number, +and other information can be accessed with the specific eeprom kernel module. +After using `modprobe eeprom_mb` to detect the eeprom, it will show up in sysfs. + +The hexdump utility can be used to decode the raw output of the EEPROM. +For example, +``` + bash# echo "mb_eeprom 0x55" > /sys/bus/i2c/devices/i2c-0/new_device + bash# cat /sys/bus/i2c/drivers/mb_eeprom/0-0055/eeprom | hexdump -C +``` + +### Front panel LEDs + +LEDs can be setup on/off by using i2c utility `/usr/sbin/i2c_utils.sh`. +Utility function command usage as follows: + +``` +Status LED: + i2c_utils.sh i2c_sys_led green|amber on|off + +Fan status LED: + i2c_utils.sh i2c_fan_led green|amber on|off + +PSU1 status LED: + i2c_utils.sh i2c_psu1_led green|amber on|off + +PSU2 status LED: + i2c_utils.sh i2c_psu2_led green|amber on|off + +``` +QSFP Module Port LEDs control by ASIC library. + + +### Fan speed + +Fan speed are controlled by the w83795 kernel module. +It can be found in `/sys/class/hwmon/hwmon2/device/`. +If they were compiled as modules, you will need to modprobe w83795 for +their sysfs entries to show up. Each fan has an `fan_input` file +for reading the fan speed. And `pwm1` setting fan1 to fan4, +`pwm2` setting fan5 to fan8. + +There is docker-platform-monitor container installed fancontrol package that can +automatic control platform fan speed. + + +### Temperature sensors + +Temperature sensors are controlled by the w83795 kernel +module. It can be found in `/sys/class/hwmon/hwmon3/device/`. +If they were compiled as modules, then you will need to modprobe w83795 for +their sysfs entries to show up. +`temp1_input` is front MAC temperature sensor. `temp2_input` is rear MAC +temperature sensor. + +There is docker-platform-monitor container installed lm-sensors package that can +monitor platform temperature. And `sensors` command can show each +temperature sensors status. + +### Power supplies + +Power supplies status and its EEPROM info can be used i2c utility +`/usr/sbin/i2c_utils.sh` to get. +The usage as follows: +``` +PSU EEPROM: + i2c_utils.sh i2c_psu_eeprom_get + +PSU Status: + i2c_utils.sh i2c_psu_status +``` + +### QSFPs +QSFP modules are managed by the pca9548 kernel driver. +The i2c utility `/usr/sbin/i2c_utils.sh` can be used to get status and +module EEPROM informations. +The usage as follows: +``` +QSFP EEPROM: + i2c_utils.sh i2c_qsfp_eeprom_get [1-64] + +QSFP Insert Event: + i2c_utils.sh i2c_qsfp_status_get [1-64] + 0 => not insert + 1 => inserted +``` + diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/Makefile b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/Makefile new file mode 100644 index 000000000000..af1a5abe1d12 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/Makefile @@ -0,0 +1,3 @@ +obj-m := eeprom_mb.o +obj-m += ingrasys_s9280_64x_i2c_cpld.o +obj-m += ingrasys_s9280_64x_psu.o diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/eeprom_mb.c b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/eeprom_mb.c new file mode 100644 index 000000000000..528864d93382 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/eeprom_mb.c @@ -0,0 +1,267 @@ +/* + * Copyright (C) 1998, 1999 Frodo Looijaard and + * Philip Edelbrock + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003 IBM Corp. + * Copyright (C) 2004 Jean Delvare + * + * 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. + */ + +/* enable dev_dbg print out */ +//#define DEBUG + +#include +#include +#include +#include +#include +#include +#include + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { /*0x50, 0x51, 0x52, 0x53, 0x54, + 0x55, 0x56, 0x57,*/ I2C_CLIENT_END }; + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 512 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void mb_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, (u8)((addr >> 8) & 0xFF), (u8)(addr & 0xFF)); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t mb_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + mb_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static ssize_t mb_eeprom_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + int ret; + int i; + u8 cmd; + u16 value16; + + dev_dbg(&client->dev, "mb_eeprom_write off=%d, count=%d\n", (int)off, (int)count); + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + mutex_lock(&data->update_lock); + + for(i=0; i < count; i++) { + /* write command */ + cmd = (off >> 8) & 0xff; + value16 = off & 0xff; + value16 |= buf[i] << 8; + ret = i2c_smbus_write_word_data(client, cmd, value16); + + if (ret < 0) { + dev_err(&client->dev, "write address failed at %d \n", (int)off); + goto exit; + } + + off++; + + /* need to wait for write complete */ + udelay(10000); + } +exit: + mutex_unlock(&data->update_lock); + /* force to update client when reading */ + for(i=0; i < SLICE_NUM; i++) { + data->last_updated[i] = 0; + } + + return count; +} + +static struct bin_attribute mb_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO | S_IWUSR, + }, + .size = EEPROM_SIZE, + .read = mb_eeprom_read, + .write = mb_eeprom_write, +}; + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int mb_eeprom_detect(struct i2c_client *client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + + /* EDID EEPROMs are often 24C00 EEPROMs, which answer to all + addresses 0x50-0x57, but we only care about 0x51 and 0x55. So decline + attaching to addresses >= 0x56 on DDC buses */ + if (!(adapter->class & I2C_CLASS_SPD) && client->addr >= 0x56) { + return -ENODEV; + } + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE) + && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + return -ENODEV; + } + + strlcpy(info->type, "eeprom", I2C_NAME_SIZE); + + return 0; +} + +static int mb_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &mb_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int mb_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &mb_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id mb_eeprom_id[] = { + { "mb_eeprom", 0 }, + { } +}; + +static struct i2c_driver mb_eeprom_driver = { + .driver = { + .name = "mb_eeprom", + }, + .probe = mb_eeprom_probe, + .remove = mb_eeprom_remove, + .id_table = mb_eeprom_id, + + .class = I2C_CLASS_DDC | I2C_CLASS_SPD, + .detect = mb_eeprom_detect, + .address_list = normal_i2c, +}; + +module_i2c_driver(mb_eeprom_driver); + +MODULE_AUTHOR("Wade "); +MODULE_DESCRIPTION("Ingrasys Mother Borad EEPROM driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_i2c_cpld.c b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_i2c_cpld.c new file mode 100644 index 000000000000..912060cc93e5 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_i2c_cpld.c @@ -0,0 +1,1618 @@ +/* + * A i2c cpld driver for the ingrasys_s9280_64x + * + * Copyright (C) 2017 Ingrasys Technology Corporation. + * Leo Lin + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ingrasys_s9280_64x_i2c_cpld.h" + +#ifdef DEBUG +#define DEBUG_PRINT(fmt, args...) \ + printk(KERN_INFO "%s:%s[%d]: " fmt "\r\n", \ + __FILE__, __func__, __LINE__, ##args) +#else +#define DEBUG_PRINT(fmt, args...) +#endif + +#define I2C_READ_BYTE_DATA(ret, lock, i2c_client, reg) \ +{ \ + mutex_lock(lock); \ + ret = i2c_smbus_read_byte_data(i2c_client, reg); \ + mutex_unlock(lock); \ +} +#define I2C_WRITE_BYTE_DATA(ret, lock, i2c_client, reg, val) \ +{ \ + mutex_lock(lock); \ + ret = i2c_smbus_write_byte_data(i2c_client, reg, val); \ + mutex_unlock(lock); \ +} + +/* CPLD sysfs attributes index */ +enum s9280_64x_cpld_sysfs_attributes { + CPLD_ACCESS_REG, + CPLD_REGISTER_VAL, + CPLD_PORT_START, + CPLD_PORTS, + CPLD_VERSION, + CPLD_ID, + CPLD_BOARD_TYPE, + CPLD_EXT_BOARD_TYPE, + CPLD_QSFP_PORT_STATUS_1, + CPLD_QSFP_PORT_STATUS_2, + CPLD_QSFP_PORT_STATUS_3, + CPLD_QSFP_PORT_STATUS_4, + CPLD_QSFP_PORT_STATUS_5, + CPLD_QSFP_PORT_STATUS_6, + CPLD_QSFP_PORT_STATUS_7, + CPLD_QSFP_PORT_STATUS_8, + CPLD_QSFP_PORT_STATUS_9, + CPLD_QSFP_PORT_STATUS_10, + CPLD_QSFP_PORT_STATUS_11, + CPLD_QSFP_PORT_STATUS_12, + CPLD_QSFP_PORT_STATUS_13, + CPLD_QSFP_PORT_CONFIG_1, + CPLD_QSFP_PORT_CONFIG_2, + CPLD_QSFP_PORT_CONFIG_3, + CPLD_QSFP_PORT_CONFIG_4, + CPLD_QSFP_PORT_CONFIG_5, + CPLD_QSFP_PORT_CONFIG_6, + CPLD_QSFP_PORT_CONFIG_7, + CPLD_QSFP_PORT_CONFIG_8, + CPLD_QSFP_PORT_CONFIG_9, + CPLD_QSFP_PORT_CONFIG_10, + CPLD_QSFP_PORT_CONFIG_11, + CPLD_QSFP_PORT_CONFIG_12, + CPLD_QSFP_PORT_CONFIG_13, + CPLD_QSFP_PORT_INTERRUPT, + CPLD_SFP_PORT_STATUS, + CPLD_SFP_PORT_CONFIG, + CPLD_10GMUX_CONFIG, + CPLD_BMC_STATUS, + CPLD_BMC_WATCHDOG, + CPLD_USB_STATUS, + CPLD_RESET_CONTROL, + CPLD_SFP_LED, + CPLD_SFP_LED_BLINK, + CPLD_QSFP_LED_1, + CPLD_QSFP_LED_2, + CPLD_QSFP_LED_3, + CPLD_QSFP_LED_4, + CPLD_QSFP_LED_5, + CPLD_QSFP_LED_6, + CPLD_QSFP_LED_7, + CPLD_QSFP_LED_8, + CPLD_QSFP_LED_9, + CPLD_QSFP_LED_10, + CPLD_QSFP_LED_11, + CPLD_QSFP_LED_12, + CPLD_QSFP_LED_13, + CPLD_QSFP_LED_14, + CPLD_QSFP_LED_15, + CPLD_QSFP_LED_16, + CPLD_QSFP_LED_BLINK, + CPLD_RTMR_RESET, + CPLD_ROV_STATUS, + +}; + +/* CPLD sysfs attributes hook functions */ +static ssize_t read_access_register(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_access_register(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_register_value(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_register_value(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t get_qsfp_port_start(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t get_qsfp_ports(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_cpld_version(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_cpld_id(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_board_type(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_ext_board_type(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_qsfp_port_status(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_qsfp_port_config(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_qsfp_port_config(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_qsfp_port_interrupt(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_sfp_port_status(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_sfp_port_config(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_sfp_port_config(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_10gmux_config(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_10gmux_config(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_bmc_status(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_bmc_watchdog(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_bmc_watchdog(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_usb_status(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_reset_control(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_reset_control(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_sfp_led(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_sfp_led(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_sfp_led_blink(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_sfp_led_blink(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_qsfp_led(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_qsfp_led(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_qsfp_led_blink(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_qsfp_led_blink(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_rtmr_reset(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_rtmr_reset(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_rov_status(struct device *dev, + struct device_attribute *da, char *buf); + +static LIST_HEAD(cpld_client_list); /* client list for cpld */ +static struct mutex list_lock; /* mutex for client list */ + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +struct cpld_data { + int index; /* CPLD index */ + struct mutex access_lock; /* mutex for cpld access */ + u8 access_reg; /* register to access */ +}; + +/* CPLD device id and data */ +static const struct i2c_device_id ingrasys_i2c_cpld_id[] = { + { "ingrasys_cpld1", cpld1 }, + { "ingrasys_cpld2", cpld2 }, + { "ingrasys_cpld3", cpld3 }, + { "ingrasys_cpld4", cpld4 }, + { "ingrasys_cpld5", cpld5 }, + {} +}; + +/* Addresses scanned for ingrasys_i2c_cpld */ +static const unsigned short cpld_i2c_addr[] = { 0x33, I2C_CLIENT_END }; + +/* define all support register access of cpld in attribute */ +static SENSOR_DEVICE_ATTR(cpld_access_register, S_IWUSR | S_IRUGO, + read_access_register, write_access_register, CPLD_ACCESS_REG); +static SENSOR_DEVICE_ATTR(cpld_register_value, S_IWUSR | S_IRUGO, + read_register_value, write_register_value, CPLD_REGISTER_VAL); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_start, S_IRUGO, + get_qsfp_port_start, NULL, CPLD_PORT_START); +static SENSOR_DEVICE_ATTR(cpld_qsfp_ports, S_IRUGO, + get_qsfp_ports, NULL, CPLD_PORTS); +static SENSOR_DEVICE_ATTR(cpld_version, S_IRUGO, + read_cpld_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(cpld_id, S_IRUGO, read_cpld_id, NULL, CPLD_ID); +static SENSOR_DEVICE_ATTR(cpld_board_type, S_IRUGO, + read_board_type, NULL, CPLD_BOARD_TYPE); +static SENSOR_DEVICE_ATTR(cpld_ext_board_type, S_IRUGO, + read_ext_board_type, NULL, CPLD_EXT_BOARD_TYPE); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_1, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_1); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_2, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_2); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_3, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_3); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_4, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_4); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_5, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_5); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_6, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_6); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_7, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_7); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_8, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_8); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_9, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_9); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_10, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_10); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_11, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_11); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_12, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_12); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_status_13, S_IRUGO, + read_qsfp_port_status, NULL, CPLD_QSFP_PORT_STATUS_13); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_1, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_1); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_2, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_2); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_3, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_3); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_4, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_4); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_5, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_5); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_6, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_6); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_7, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_7); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_8, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_8); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_9, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_9); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_10, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_10); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_11, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_11); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_12, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_12); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_config_13, S_IWUSR | S_IRUGO, + read_qsfp_port_config, write_qsfp_port_config, + CPLD_QSFP_PORT_CONFIG_13); +static SENSOR_DEVICE_ATTR(cpld_qsfp_port_interrupt, S_IRUGO, + read_qsfp_port_interrupt, NULL, CPLD_QSFP_PORT_INTERRUPT); +static SENSOR_DEVICE_ATTR(cpld_sfp_port_status, S_IRUGO, + read_sfp_port_status, NULL, CPLD_SFP_PORT_STATUS); +static SENSOR_DEVICE_ATTR(cpld_sfp_port_config, S_IWUSR | S_IRUGO, + read_sfp_port_config, write_sfp_port_config, CPLD_SFP_PORT_CONFIG); +static SENSOR_DEVICE_ATTR(cpld_10gmux_config, S_IWUSR | S_IRUGO, + read_10gmux_config, write_10gmux_config, + CPLD_10GMUX_CONFIG); +static SENSOR_DEVICE_ATTR(cpld_bmc_status, S_IRUGO, + read_bmc_status, NULL, CPLD_BMC_STATUS); +static SENSOR_DEVICE_ATTR(cpld_bmc_watchdog, S_IWUSR | S_IRUGO, + read_bmc_watchdog, write_bmc_watchdog, + CPLD_BMC_WATCHDOG); +static SENSOR_DEVICE_ATTR(cpld_usb_status, S_IRUGO, + read_usb_status, NULL, CPLD_USB_STATUS); +static SENSOR_DEVICE_ATTR(cpld_reset_control, S_IWUSR | S_IRUGO, + read_reset_control, write_reset_control, + CPLD_BMC_WATCHDOG); +static SENSOR_DEVICE_ATTR(cpld_sfp_led, S_IWUSR | S_IRUGO, + read_sfp_led, write_sfp_led, CPLD_SFP_LED); +static SENSOR_DEVICE_ATTR(cpld_sfp_led_blink, S_IWUSR | S_IRUGO, + read_sfp_led_blink, write_sfp_led_blink, CPLD_SFP_LED_BLINK); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_1, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_1); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_2, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_2); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_3, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_3); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_4, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_4); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_5, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_5); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_6, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_6); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_7, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_7); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_8, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_8); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_9, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_9); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_10, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_10); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_11, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_11); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_12, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_12); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_13, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_13); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_14, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_14); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_15, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_15); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_16, S_IWUSR | S_IRUGO, + read_qsfp_led, write_qsfp_led, CPLD_QSFP_LED_16); +static SENSOR_DEVICE_ATTR(cpld_qsfp_led_blink, S_IWUSR | S_IRUGO, + read_qsfp_led_blink, write_qsfp_led_blink, CPLD_QSFP_LED_BLINK); +static SENSOR_DEVICE_ATTR(cpld_rtmr_reset, S_IWUSR | S_IRUGO, + read_rtmr_reset, write_rtmr_reset, CPLD_RTMR_RESET); +static SENSOR_DEVICE_ATTR(cpld_rov_status, S_IRUGO, + read_rov_status, NULL, CPLD_ROV_STATUS); + +/* define support attributes of cpldx , total 5 */ +/* cpld 1 */ +static struct attribute *s9280_64x_cpld1_attributes[] = { + &sensor_dev_attr_cpld_access_register.dev_attr.attr, + &sensor_dev_attr_cpld_register_value.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_start.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_ports.dev_attr.attr, + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_cpld_id.dev_attr.attr, + &sensor_dev_attr_cpld_board_type.dev_attr.attr, + &sensor_dev_attr_cpld_ext_board_type.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_1.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_2.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_3.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_4.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_5.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_6.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_7.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_8.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_9.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_10.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_11.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_12.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_1.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_2.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_3.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_4.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_5.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_6.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_7.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_8.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_9.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_10.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_11.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_12.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_interrupt.dev_attr.attr, + &sensor_dev_attr_cpld_sfp_port_status.dev_attr.attr, + &sensor_dev_attr_cpld_sfp_port_config.dev_attr.attr, + &sensor_dev_attr_cpld_10gmux_config.dev_attr.attr, + &sensor_dev_attr_cpld_bmc_status.dev_attr.attr, + &sensor_dev_attr_cpld_bmc_watchdog.dev_attr.attr, + &sensor_dev_attr_cpld_usb_status.dev_attr.attr, + &sensor_dev_attr_cpld_reset_control.dev_attr.attr, + &sensor_dev_attr_cpld_sfp_led.dev_attr.attr, + &sensor_dev_attr_cpld_sfp_led_blink.dev_attr.attr, + &sensor_dev_attr_cpld_rtmr_reset.dev_attr.attr, + &sensor_dev_attr_cpld_rov_status.dev_attr.attr, + NULL +}; + +/* cpld 2 / cpld 3 / cpld 4 / cpld 5 */ +static struct attribute *s9280_64x_cpld2345_attributes[] = { +&sensor_dev_attr_cpld_access_register.dev_attr.attr, + &sensor_dev_attr_cpld_register_value.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_start.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_ports.dev_attr.attr, + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_cpld_id.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_1.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_2.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_3.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_4.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_5.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_6.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_7.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_8.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_9.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_10.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_11.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_12.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_status_13.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_1.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_2.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_3.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_4.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_5.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_6.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_7.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_8.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_9.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_10.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_11.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_12.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_config_13.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_port_interrupt.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_1.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_2.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_3.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_4.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_5.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_6.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_7.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_8.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_9.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_10.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_11.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_12.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_13.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_14.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_15.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_16.dev_attr.attr, + &sensor_dev_attr_cpld_qsfp_led_blink.dev_attr.attr, + NULL +}; + +/* cpld 1 attributes group */ +static const struct attribute_group s9280_64x_cpld1_group = { + .attrs = s9280_64x_cpld1_attributes, +}; +/* cpld 2/3/4/5 attributes group */ +static const struct attribute_group s9280_64x_cpld2345_group = { + .attrs = s9280_64x_cpld2345_attributes, +}; + +/* read access register from cpld data */ +static ssize_t read_access_register(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg = data->access_reg; + + return sprintf(buf, "0x%x\n", reg); +} + +/* write access register to cpld data */ +static ssize_t write_access_register(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + + if (kstrtou8(buf, 0, ®) < 0) + return -EINVAL; + + data->access_reg = reg; + return count; +} + +/* read the value of access register in cpld data */ +static ssize_t read_register_value(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg = data->access_reg; + int reg_val; + + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + + if (reg_val < 0) + return -1; + + return sprintf(buf, "0x%x\n", reg_val); +} + +/* wrtie the value to access register in cpld data */ +static ssize_t write_register_value(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + int ret = -EIO; + u8 reg = data->access_reg; + u8 reg_val; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, client, reg, reg_val); + + return count; +} + +/* get qsfp port start number of the cpld device */ +/* the start number use to tranlate qsfp port to cpld port */ +/* the cpld port use to access the qsfp port register in cpld */ +static ssize_t get_qsfp_port_start(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + int port_base_num; + + if (attr->index == CPLD_PORT_START) { + if (data->index == cpld1) { + port_base_num = 1; + } else { + port_base_num = CPLD_1_PORT_NUM + + CPLD_2_PORT_NUM*(data->index - 1) + 1; + } + return sprintf(buf, "%d\n", port_base_num); + } + return -1; +} + +/* get total qsfp port which contain register in the cpld device */ +static ssize_t get_qsfp_ports(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + int ports; + + if (attr->index == CPLD_PORTS) { + if (data->index == cpld1) + ports = CPLD_1_PORT_NUM; + else + ports = CPLD_2_PORT_NUM; + return sprintf(buf, "%d\n", ports); + } + return -1; +} + +/* get cpdl version register value */ +static ssize_t read_cpld_version(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_VERSION) { + reg = CPLD_VERSION_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get cpdl id register value */ +static ssize_t read_cpld_id(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_ID) { + reg = CPLD_ID_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get board type register value */ +static ssize_t read_board_type(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_BOARD_TYPE) { + reg = CPLD_BOARD_TYPE_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get extend board type register value */ +static ssize_t read_ext_board_type(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_EXT_BOARD_TYPE) { + reg = CPLD_EXT_BOARD_TYPE_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get qsfp port status register value */ +static ssize_t read_qsfp_port_status(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index >= CPLD_QSFP_PORT_STATUS_1 && + attr->index <= CPLD_QSFP_PORT_STATUS_13) { + reg = CPLD_QSFP_PORT_STATUS_BASE_REG + + (attr->index - CPLD_QSFP_PORT_STATUS_1); + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get qsfp port config register value */ +static ssize_t read_qsfp_port_config(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index >= CPLD_QSFP_PORT_CONFIG_1 && + attr->index <= CPLD_QSFP_PORT_CONFIG_13) { + reg = CPLD_QSFP_PORT_CONFIG_BASE_REG + + (attr->index - CPLD_QSFP_PORT_CONFIG_1); + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* set value to qsfp port config register */ +static ssize_t write_qsfp_port_config(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg, reg_val; + int ret; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + if (attr->index >= CPLD_QSFP_PORT_CONFIG_1 && + attr->index <= CPLD_QSFP_PORT_CONFIG_13) { + reg = CPLD_QSFP_PORT_CONFIG_BASE_REG + + (attr->index - CPLD_QSFP_PORT_CONFIG_1); + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + client, reg, reg_val); + } + return count; +} + +/* get qsfp port interrupt register value */ +static ssize_t read_qsfp_port_interrupt(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_QSFP_PORT_INTERRUPT) { + reg = CPLD_QSFP_PORT_INTERRUPT_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get sfp port status register value */ +static ssize_t read_sfp_port_status(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_SFP_PORT_STATUS) { + reg = CPLD_SFP_PORT_STATUS_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get sfp port config register value */ +static ssize_t read_sfp_port_config(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_SFP_PORT_CONFIG) { + reg = CPLD_SFP_PORT_CONFIG_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* set value to sfp port config register */ +static ssize_t write_sfp_port_config(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg, reg_val; + int ret; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + if (attr->index == CPLD_SFP_PORT_CONFIG) { + reg = CPLD_SFP_PORT_CONFIG_REG; + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + client, reg, reg_val); + } + return count; +} + +/* get 10g mux config register value */ +static ssize_t read_10gmux_config(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_10GMUX_CONFIG) { + reg = CPLD_10GMUX_CONFIG_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* set value to 10g mux config register */ +static ssize_t write_10gmux_config(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg, reg_val; + int ret; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + if (attr->index == CPLD_10GMUX_CONFIG) { + reg = CPLD_10GMUX_CONFIG_REG; + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + client, reg, reg_val); + } + return count; +} + +/* get bmc status register value */ +static ssize_t read_bmc_status(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_BMC_STATUS) { + reg = CPLD_BMC_STATUS_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get bmc watchdog register value */ +static ssize_t read_bmc_watchdog(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_BMC_WATCHDOG) { + reg = CPLD_BMC_WATCHDOG_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* set value to bmc watchdog register */ +static ssize_t write_bmc_watchdog(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg, reg_val; + int ret; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + if (attr->index == CPLD_BMC_WATCHDOG) { + reg = CPLD_BMC_WATCHDOG_REG; + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + client, reg, reg_val); + } + return count; +} + +/* get usb status register value */ +static ssize_t read_usb_status(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_USB_STATUS) { + reg = CPLD_USB_STATUS_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get reset control register value */ +static ssize_t read_reset_control(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_RESET_CONTROL) { + reg = CPLD_RESET_CONTROL_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* set value to reset control register */ +static ssize_t write_reset_control(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg, reg_val; + int ret; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + if (attr->index == CPLD_RESET_CONTROL) { + reg = CPLD_RESET_CONTROL_REG; + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + client, reg, reg_val); + } + return count; +} + +/* get sfp port 0/1 led register */ +static ssize_t read_sfp_led(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_SFP_LED) { + reg = CPLD_SFP_LED_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* set value to sfp 0/1 port led register */ +static ssize_t write_sfp_led(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg, reg_val; + int ret; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + if (attr->index == CPLD_SFP_LED) { + reg = CPLD_SFP_LED_REG; + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + client, reg, reg_val); + } + return count; +} + +/* get sfp port 0/1 led blink register */ +static ssize_t read_sfp_led_blink(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_SFP_LED_BLINK) { + reg = CPLD_SFP_LED_BLINK_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* set value to sfp port 0/1 led blink register */ +static ssize_t write_sfp_led_blink(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg, reg_val; + int ret; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + if (attr->index == CPLD_SFP_LED_BLINK) { + reg = CPLD_SFP_LED_BLINK_REG; + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + client, reg, reg_val); + } + return count; +} + +/* get qsfp port led register */ +static ssize_t read_qsfp_led(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index >= CPLD_QSFP_LED_1 && + attr->index <= CPLD_QSFP_LED_16) { + reg = CPLD_QSFP_LED_BASE_REG + (attr->index - CPLD_QSFP_LED_1); + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* set value to qsfp port led register */ +static ssize_t write_qsfp_led(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg, reg_val; + int ret; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + if (attr->index >= CPLD_QSFP_LED_1 && + attr->index <= CPLD_QSFP_LED_16) { + reg = CPLD_QSFP_LED_BASE_REG + (attr->index - CPLD_QSFP_LED_1); + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + client, reg, reg_val); + } + return count; +} + +/* get qsfp 16 port led blink register value in 64 bit map */ +/* + each register for 2 port, each port has 4 channel for led blink + bit 64 56 48 40 32 24 16 8 0 + port 16/15 14/13 12/11 10/9 8/7 6/5 4/3 2/1 + */ +static ssize_t read_qsfp_led_blink(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val, i; + u64 bitmap = 0; + + if (attr->index == CPLD_QSFP_LED_BLINK) { + for (i = 0; i <= 7; i++) { + reg = CPLD_QSFP_LED_BLINK_BASE_REG + i; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + reg_val = reg_val & 0xff; + bitmap = bitmap | (reg_val<<(i*8)); + } + return sprintf(buf, "0x%llx\n", bitmap); + } + return -1; +} + +/* set 64 bit map value to qsfp port led blink register */ +/* + each register for 2 port, each port has 4 channel for led blink + bit 63 56 48 40 32 24 16 8 0 + port 16/15 14/13 12/11 10/9 8/7 6/5 4/3 2/1 + */ +static ssize_t write_qsfp_led_blink(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg, reg_val, i; + int ret; + u64 bitmap = 0; + + if (kstrtou64(buf, 0, &bitmap) < 0) + return -EINVAL; + + if (attr->index == CPLD_QSFP_LED_BLINK) { + for (i = 0; i <= 7; i++) { + reg = CPLD_QSFP_LED_BLINK_BASE_REG + i; + reg_val = (u8)((bitmap >> i*8) & 0xFF); + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + client, reg, reg_val); + } + } + return count; +} + +/* get retimer reset register */ +static ssize_t read_rtmr_reset(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_RTMR_RESET) { + reg = CPLD_RTMR_RESET_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* set value to retimer reset register */ +static ssize_t write_rtmr_reset(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg, reg_val; + int ret; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + if (attr->index == CPLD_RTMR_RESET) { + reg = CPLD_RTMR_RESET_REG; + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + client, reg, reg_val); + } + return count; +} + +/* get rov status register */ +static ssize_t read_rov_status(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_ROV_STATUS) { + reg = CPLD_ROV_STATUS_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* add valid cpld client to list */ +static void ingrasys_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = NULL; + + node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + if (!node) { + dev_info(&client->dev, + "Can't allocate cpld_client_node for index %d\n", + client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +/* remove exist cpld client in list */ +static void ingrasys_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + list_for_each(list_node, &cpld_client_list) { + cpld_node = list_entry(list_node, + struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + mutex_unlock(&list_lock); +} + +/* cpld drvier probe */ +static int ingrasys_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct cpld_data *data = NULL; + int ret = -EPERM; + int idx; + + data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + /* init cpld data for client */ + i2c_set_clientdata(client, data); + mutex_init(&data->access_lock); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_info(&client->dev, + "i2c_check_functionality failed (0x%x)\n", + client->addr); + status = -EIO; + goto exit; + } + + /* get cpld id from device */ + ret = i2c_smbus_read_byte_data(client, CPLD_ID_REG); + + if (ret < 0) { + dev_info(&client->dev, + "fail to get cpld id (0x%x) at addr (0x%x)\n", + CPLD_ID_REG, client->addr); + status = -EIO; + goto exit; + } + + CPLD_ID_ID_GET(ret, idx); + + if (INVALID(idx, cpld1, cpld5)) { + dev_info(&client->dev, + "cpld id %d(device) not valid\n", idx); + //status = -EPERM; + //goto exit; + } + +#if 0 + /* change client name for each cpld with index */ + snprintf(client->name, sizeof(client->name), "%s_%d", client->name, + data->index); +#endif + + data->index = dev_id->driver_data; + + /* register sysfs hooks for different cpld group */ + dev_info(&client->dev, "probe cpld with index %d\n", data->index); + switch (data->index) { + case cpld1: + status = sysfs_create_group(&client->dev.kobj, + &s9280_64x_cpld1_group); + break; + case cpld2: + case cpld3: + case cpld4: + case cpld5: + status = sysfs_create_group(&client->dev.kobj, + &s9280_64x_cpld2345_group); + break; + default: + status = -EINVAL; + } + + if (status) + goto exit; + + dev_info(&client->dev, "chip found\n"); + + /* add probe chip to client list */ + ingrasys_i2c_cpld_add_client(client); + + return 0; +exit: + sysfs_remove_group(&client->dev.kobj, &s9280_64x_cpld2345_group); + return status; +} + +/* cpld drvier remove */ +static int ingrasys_i2c_cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + + switch (data->index) { + case cpld1: + sysfs_remove_group(&client->dev.kobj, &s9280_64x_cpld1_group); + break; + case cpld2: + case cpld3: + case cpld4: + case cpld5: + sysfs_remove_group(&client->dev.kobj, + &s9280_64x_cpld2345_group); + break; + } + + ingrasys_i2c_cpld_remove_client(client); + return 0; +} + +MODULE_DEVICE_TABLE(i2c, ingrasys_i2c_cpld_id); + +static struct i2c_driver ingrasys_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "ingrasys_i2c_cpld", + }, + .probe = ingrasys_i2c_cpld_probe, + .remove = ingrasys_i2c_cpld_remove, + .id_table = ingrasys_i2c_cpld_id, + .address_list = cpld_i2c_addr, +}; + +/* provid cpld register read */ +/* cpld_idx indicate the index of cpld device */ +int ingrasys_i2c_cpld_read(u8 cpld_idx, + u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + struct cpld_data *data; + + list_for_each(list_node, &cpld_client_list) { + cpld_node = list_entry(list_node, + struct cpld_client_node, list); + data = i2c_get_clientdata(cpld_node->client); + if (data->index == cpld_idx) { + DEBUG_PRINT("cpld_idx=%d, read reg 0x%02x", + cpld_idx, reg); + I2C_READ_BYTE_DATA(ret, &data->access_lock, + cpld_node->client, reg); + DEBUG_PRINT("cpld_idx=%d, read reg 0x%02x = 0x%02x", + cpld_idx, reg, ret); + break; + } + } + + return ret; +} +EXPORT_SYMBOL(ingrasys_i2c_cpld_read); + +/* provid cpld register write */ +/* cpld_idx indicate the index of cpld device */ +int ingrasys_i2c_cpld_write(u8 cpld_idx, + u8 reg, + u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + struct cpld_data *data; + + list_for_each(list_node, &cpld_client_list) { + cpld_node = list_entry(list_node, + struct cpld_client_node, list); + data = i2c_get_clientdata(cpld_node->client); + + if (data->index == cpld_idx) { + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, + cpld_node->client, + reg, value); + DEBUG_PRINT("cpld_idx=%d, write reg 0x%02x val 0x%02x, ret=%d", + cpld_idx, reg, value, ret); + break; + } + } + + return ret; +} +EXPORT_SYMBOL(ingrasys_i2c_cpld_write); + +/* provid qsfp port status register read */ +/* port_num indicate the front panel qsfp port number */ +int ingrasys_i2c_cpld_get_qsfp_port_status_val(u8 port_num) +{ + u8 cpld_idx, cpld_port, reg; + int reg_val; + + if (INVALID(port_num, QSFP_MIN_PORT_NUM, QSFP_MAX_PORT_NUM)) { + DEBUG_PRINT("invalid input value %d", port_num); + return -1; + } + QSFP_TO_CPLD_IDX(port_num, cpld_idx, cpld_port); + reg = QSFP_PORT_STATUS_REG(cpld_port); + DEBUG_PRINT("port_num=%d, cpld_idx=%d, cpld_port=%d, reg=0x%x", + port_num, cpld_idx, cpld_port, reg); + reg_val = ingrasys_i2c_cpld_read(cpld_idx, reg); + return reg_val; +} +EXPORT_SYMBOL(ingrasys_i2c_cpld_get_qsfp_port_status_val); + +/* provid qsfp port config register read */ +/* port_num indicate the front panel qsfp port number */ +int ingrasys_i2c_cpld_get_qsfp_port_config_val(u8 port_num) +{ + u8 cpld_idx, cpld_port, reg; + int reg_val; + + if (INVALID(port_num, QSFP_MIN_PORT_NUM, QSFP_MAX_PORT_NUM)) { + DEBUG_PRINT("invalid input value %d", port_num); + return -1; + } + QSFP_TO_CPLD_IDX(port_num, cpld_idx, cpld_port); + reg = QSFP_PORT_CONFIG_REG(cpld_port); + DEBUG_PRINT("port_num=%d, cpld_idx=%d, cpld_port=%d, reg=0x%x", + port_num, cpld_idx, cpld_port, reg); + reg_val = ingrasys_i2c_cpld_read(cpld_idx, reg); + return reg_val; +} +EXPORT_SYMBOL(ingrasys_i2c_cpld_get_qsfp_port_config_val); + +/* provid qsfp port config register write */ +/* port_num indicate the front panel qsfp port number */ +int ingrasys_i2c_cpld_set_qsfp_port_config_val(u8 port_num, + u8 reg_val) +{ + u8 cpld_idx, cpld_port, reg, ret; + + if (INVALID(port_num, QSFP_MIN_PORT_NUM, QSFP_MAX_PORT_NUM)) { + DEBUG_PRINT("invalid input value %d", port_num); + return -1; + } + QSFP_TO_CPLD_IDX(port_num, cpld_idx, cpld_port); + reg = QSFP_PORT_CONFIG_REG(cpld_port); + DEBUG_PRINT("port_num=%d, cpld_idx=%d, cpld_port=%d, reg=0x%x", + port_num, cpld_idx, cpld_port, reg); + ret = ingrasys_i2c_cpld_write(cpld_idx, reg, reg_val); + return ret; +} +EXPORT_SYMBOL(ingrasys_i2c_cpld_set_qsfp_port_config_val); + +/* provid sfp port 0/1 status register read */ +int ingrasys_i2c_cpld_get_sfp_port_status_val(void) +{ + u8 cpld_idx, reg; + int reg_val; + + cpld_idx = cpld1; + reg = CPLD_SFP_PORT_STATUS_REG; + DEBUG_PRINT("cpld_idx=%d, reg=0x%x", + cpld_idx, reg); + reg_val = ingrasys_i2c_cpld_read(cpld_idx, reg); + return reg_val; +} +EXPORT_SYMBOL(ingrasys_i2c_cpld_get_sfp_port_status_val); + +/* provid qsfp port config register read */ +/* port_num indicate the front panel qsfp port number */ +int ingrasys_i2c_cpld_get_sfp_port_config_val(void) +{ + u8 cpld_idx, reg; + int reg_val; + + cpld_idx = cpld1; + reg = CPLD_SFP_PORT_CONFIG_REG; + DEBUG_PRINT("cpld_idx=%d, reg=0x%x", + cpld_idx, reg); + reg_val = ingrasys_i2c_cpld_read(cpld_idx, reg); + return reg_val; +} +EXPORT_SYMBOL(ingrasys_i2c_cpld_get_sfp_port_config_val); + +/* provid qsfp port config register write */ +/* port_num indicate the front panel qsfp port number */ +int ingrasys_i2c_cpld_set_sfp_port_config_val(u8 reg_val) +{ + u8 cpld_idx, reg, ret; + + cpld_idx = cpld1; + reg = CPLD_SFP_PORT_CONFIG_REG; + DEBUG_PRINT("cpld_idx=%d, reg=0x%x", + cpld_idx, reg); + ret = ingrasys_i2c_cpld_write(cpld_idx, reg, reg_val); + return ret; +} +EXPORT_SYMBOL(ingrasys_i2c_cpld_set_sfp_port_config_val); + +static int __init ingrasys_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&ingrasys_i2c_cpld_driver); +} + +static void __exit ingrasys_i2c_cpld_exit(void) +{ + i2c_del_driver(&ingrasys_i2c_cpld_driver); +} + +MODULE_AUTHOR("Leo Lin "); +MODULE_DESCRIPTION("ingrasys_i2c_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(ingrasys_i2c_cpld_init); +module_exit(ingrasys_i2c_cpld_exit); + diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_i2c_cpld.h b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_i2c_cpld.h new file mode 100644 index 000000000000..8d1df5dee49d --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_i2c_cpld.h @@ -0,0 +1,338 @@ +/* header file for i2c cpld driver of ingrasys_s9280_64x + * + * Copyright (C) 2017 Ingrasys Technology Corporation. + * Leo Lin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef INGRASYS_S9280_64X_I2C_CPLD_H +#define INGRASYS_S9280_64X_I2C_CPLD_H + +/* CPLD device index value */ +enum cpld_id { + cpld1, + cpld2, + cpld3, + cpld4, + cpld5 +}; + +enum LED_BLINK { + BLINK, + NOBLINK, +}; + +enum LED_YELLOW { + YELLOW_OFF, + YELLOW_ON, +}; + +enum LED_GREEN { + GREEN_OFF, + GREEN_ON, +}; + +/* port number on CPLD */ +#define CPLD_1_PORT_NUM 12 +#define CPLD_2_PORT_NUM 13 + +/* QSFP port number */ +#define QSFP_MAX_PORT_NUM 64 +#define QSFP_MIN_PORT_NUM 1 + +/* SFP+ port number */ +#define SFP_MAX_PORT_NUM 2 +#define SFP_MIN_PORT_NUM 1 + + +/* CPLD registers */ +#define CPLD_BOARD_TYPE_REG 0x0 +#define CPLD_EXT_BOARD_TYPE_REG 0x7 +#define CPLD_VERSION_REG 0x1 +#define CPLD_ID_REG 0x2 +#define CPLD_QSFP_PORT_STATUS_BASE_REG 0x20 +#define CPLD_QSFP_PORT_CONFIG_BASE_REG 0x30 +#define CPLD_QSFP_PORT_INTERRUPT_REG 0x40 +#define CPLD_SFP_PORT_STATUS_REG 0x2F +#define CPLD_SFP_PORT_CONFIG_REG 0x3F +#define CPLD_QSFP_PORT_INTERRUPT_REG 0x40 +#define CPLD_10GMUX_CONFIG_REG 0x41 +#define CPLD_BMC_STATUS_REG 0x42 +#define CPLD_BMC_WATCHDOG_REG 0x43 +#define CPLD_USB_STATUS_REG 0x44 +#define CPLD_RESET_CONTROL_REG 0x4A +#define CPLD_SFP_LED_REG 0x80 +#define CPLD_SFP_LED_BLINK_REG 0x90 +#define CPLD_QSFP_LED_BASE_REG 0x80 +#define CPLD_QSFP_LED_BLINK_BASE_REG 0x90 +#define CPLD_RTMR_RESET_REG 0x4B +#define CPLD_ROV_STATUS_REG 0x4C + +/* bit definition for register value */ +enum CPLD_QSFP_PORT_STATUS_BITS { + CPLD_QSFP_PORT_STATUS_INT_BIT, + CPLD_QSFP_PORT_STATUS_ABS_BIT, +}; +enum CPLD_QSFP_PORT_CONFIG_BITS { + CPLD_QSFP_PORT_CONFIG_RESET_BIT, + CPLD_QSFP_PORT_CONFIG_RESERVE_BIT, + CPLD_QSFP_PORT_CONFIG_LPMODE_BIT, +}; +enum CPLD_SFP_PORT_STATUS_BITS { + CPLD_SFP0_PORT_STATUS_PRESENT_BIT, + CPLD_SFP0_PORT_STATUS_TXFAULT_BIT, + CPLD_SFP0_PORT_STATUS_RXLOS_BIT, + CPLD_SFP_PORT_STATUS_DUMMY, + CPLD_SFP1_PORT_STATUS_PRESENT_BIT, + CPLD_SFP1_PORT_STATUS_TXFAULT_BIT, + CPLD_SFP1_PORT_STATUS_RXLOS_BIT, +}; +enum CPLD_SFP_PORT_CONFIG_BITS { + CPLD_SFP0_PORT_CONFIG_TXDIS_BIT, + CPLD_SFP0_PORT_CONFIG_RS_BIT, + CPLD_SFP0_PORT_CONFIG_TS_BIT, + CPLD_SFP_PORT_CONFIG_DUMMY, + CPLD_SFP1_PORT_CONFIG_TXDIS_BIT, + CPLD_SFP1_PORT_CONFIG_RS_BIT, + CPLD_SFP1_PORT_CONFIG_TS_BIT, + +}; +enum CPLD_10GMUX_CONFIG_BITS { + CPLD_10GMUX_CONFIG_ENSMB_BIT, + CPLD_10GMUX_CONFIG_ENINPUT_BIT, + CPLD_10GMUX_CONFIG_SEL1_BIT, + CPLD_10GMUX_CONFIG_SEL0_BIT, +}; +enum CPLD_BMC_WATCHDOG_BITS { + CPLD_10GMUX_CONFIG_ENTIMER_BIT, + CPLD_10GMUX_CONFIG_TIMEOUT_BIT, +}; +enum CPLD_RESET_CONTROL_BITS { + CPLD_RESET_CONTROL_SWRST_BIT, + CPLD_RESET_CONTROL_CP2104RST_BIT, + CPLD_RESET_CONTROL_82P33814RST_BIT, + CPLD_RESET_CONTROL_BMCRST_BIT, +}; +enum CPLD_SFP_LED_BITS { + CPLD_SFP_LED_SFP0_GREEN_BIT, + CPLD_SFP_LED_SFP0_YELLOW_BIT, + CPLD_SFP_LED_SFP1_GREEN_BIT, + CPLD_SFP_LED_SFP1_YELLOW_BIT, +}; +enum CPLD_SFP_LED_BLINK_BITS { + CPLD_SFP_LED_BLINK_SFP0_BIT, + CPLD_SFP_LED_BLINK_SFP1_BIT, +}; +enum CPLD_QSFP_LED_BITS { + CPLD_QSFP_LED_CHAN_0_GREEN_BIT, + CPLD_QSFP_LED_CHAN_0_YELLOW_BIT, + CPLD_QSFP_LED_CHAN_1_GREEN_BIT, + CPLD_QSFP_LED_CHAN_1_YELLOW_BIT, + CPLD_QSFP_LED_CHAN_2_GREEN_BIT, + CPLD_QSFP_LED_CHAN_2_YELLOW_BIT, + CPLD_QSFP_LED_CHAN_3_GREEN_BIT, + CPLD_QSFP_LED_CHAN_3_YELLOW_BIT, + +}; +enum CPLD_QSFP_LED_BLINK_BITS { + CPLD_QSFP_LED_BLINK_X_CHAN0_BIT, + CPLD_QSFP_LED_BLINK_X_CHAN1_BIT, + CPLD_QSFP_LED_BLINK_X_CHAN2_BIT, + CPLD_QSFP_LED_BLINK_X_CHAN3_BIT, + CPLD_QSFP_LED_BLINK_XPLUS_CHAN0_BIT, + CPLD_QSFP_LED_BLINK_XPLUS_CHAN1_BIT, + CPLD_QSFP_LED_BLINK_XPLUS_CHAN2_BIT, + CPLD_QSFP_LED_BLINK_XPLUS_CHAN3_BIT, +}; + +/* bit field structure for register value */ +struct cpld_reg_board_type_t { + u8 build_rev:2; + u8 hw_rev:2; + u8 board_id:4; +}; + +struct cpld_reg_version_t { + u8 revision:6; + u8 release:1; + u8 reserve:1; +}; + +struct cpld_reg_id_t { + u8 id:3; + u8 release:5; +}; + +/* common manipulation */ +#define INVALID(i, min, max) ((i < min) || (i > max) ? 1u : 0u) +#define READ_BIT(val, bit) ((0u == (val & (1<bf_name) +#define READ_BF_1(bf_struct, val, bf_name, bf_value) \ + bf_struct bf; \ + bf.data = val; \ + bf_value = bf.bf_name +#define BOARD_TYPE_BUILD_REV_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, build_rev, res) +#define BOARD_TYPE_HW_REV_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, hw_rev, res) +#define BOARD_TYPE_BOARD_ID_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, board_id, res) +#define CPLD_VERSION_REV_GET(val, res) \ + READ_BF(cpld_reg_version_t, val, revision, res) +#define CPLD_VERSION_REL_GET(val, res) \ + READ_BF(cpld_reg_version_t, val, release, res) +#define CPLD_ID_ID_GET(val, res) \ + READ_BF(cpld_reg_id_t, val, id, res) +#define CPLD_ID_REL_GET(val, res) \ + READ_BF(cpld_reg_id_t, val, release, res) +/* SFP/QSFP port led registers manipulation */ +#define SFP_LED_TO_CPLD_IDX(sfp_port) cpld1 +#define SFP_LED_REG(sfp_port) CPLD_SFP_LED_REG +#define SFP_LED_BLINK_REG(sfp_port) CPLD_SFP_LED_BLINK_REG +#define QSFP_LED_TO_CPLD_IDX(qsfp_port) \ + ((qsfp_port - 1) / 16 + 2) +#define QSFP_LED_REG(qsfp_port) \ + ((qsfp_port - 1) % 16 + CPLD_QSFP_LED_BASE_REG) +#define QSFP_LED_BLINK_REG(qsfp_port) \ + (((qsfp_port - 1) % 16) / 2 + CPLD_QSFP_LED_BLINK_BASE_REG) +/* QSFP/SFP port status registers manipulation */ +#define QSFP_TO_CPLD_IDX(qsfp_port, cpld_index, cpld_port) \ +{ \ + if (QSFP_MIN_PORT_NUM <= qsfp_port && qsfp_port <= CPLD_1_PORT_NUM) { \ + cpld_index = cpld1; \ + cpld_port = qsfp_port - 1; \ + } else if (CPLD_1_PORT_NUM < qsfp_port \ + && qsfp_port <= QSFP_MAX_PORT_NUM) { \ + cpld_index = cpld2 + (qsfp_port - 1 - CPLD_1_PORT_NUM) \ + / CPLD_2_PORT_NUM; \ + cpld_port = (qsfp_port - 1 - CPLD_1_PORT_NUM) % \ + CPLD_2_PORT_NUM; \ + } else { \ + cpld_index = 0; \ + cpld_port = 0; \ + } \ +} +#define QSFP_PORT_STATUS_REG(cpld_port) \ + (CPLD_QSFP_PORT_STATUS_BASE_REG + cpld_port) +#define QSFP_PORT_CONFIG_REG(cpld_port) \ + (CPLD_QSFP_PORT_CONFIG_BASE_REG + cpld_port) +#define QSFP_PORT_INT_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_QSFP_PORT_STATUS_INT_BIT) +#define QSFP_PORT_ABS_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_QSFP_PORT_STATUS_ABS_BIT) +#define QSFP_PORT_RESET_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_LPMODE_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define QSFP_PORT_RESET_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_RESET_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_LPMODE_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define QSFP_PORT_LPMODE_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define SFP_PORT_PRESENT_BIT_GET(sfp_port, port_status_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + READ_BIT(port_status_value, CPLD_SFP0_PORT_STATUS_PRESENT_BIT); \ + } else { \ + READ_BIT(port_status_value, CPLD_SFP1_PORT_STATUS_PRESENT_BIT); \ + } +#define SFP_PORT_TXFAULT_BIT_GET(sfp_port, port_status_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + READ_BIT(port_status_value, CPLD_SFP0_PORT_STATUS_TXFAULT_BIT); \ + } else { \ + READ_BIT(port_status_value, CPLD_SFP1_PORT_STATUS_TXFAULT_BIT); \ + } +#define SFP_PORT_RXLOS_BIT_GET(sfp_port, port_status_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + READ_BIT(port_status_value, CPLD_SFP0_PORT_STATUS_RXLOS_BIT); \ + } else { \ + READ_BIT(port_status_value, CPLD_SFP1_PORT_STATUS_RXLOS_BIT); \ + } +#define SFP_PORT_TXDIS_BIT_GET(sfp_port, port_config_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + READ_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TXDIS_BIT); \ + } else { \ + READ_BIT(port_config_value, CPLD_SFP1_PORT_STATUS_RXLOS_BIT); \ + } +#define SFP_PORT_RS_BIT_GET(sfp_port, port_config_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + READ_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_RS_BIT); \ + } else { \ + READ_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_RS_BIT); \ + } +#define SFP_PORT_TS_BIT_GET(sfp_port, port_config_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + READ_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TS_BIT); \ + } else { \ + READ_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TS_BIT); \ + } +#define SFP_PORT_TXDIS_BIT_SET(sfp_port, port_config_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + SET_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TXDIS_BIT); \ + } else { \ + SET_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_TXDIS_BIT); \ + } +#define SFP_PORT_TXDIS_BIT_CLEAR(sfp_port, port_config_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + CLEAR_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TXDIS_BIT); \ + } else { \ + CLEAR_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_TXDIS_BIT); \ + } +#define SFP_PORT_RS_BIT_SET(sfp_port, port_config_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + SET_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_RS_BIT); \ + } else { \ + SET_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_RS_BIT); \ + } +#define SFP_PORT_RS_BIT_CLEAR(sfp_port, port_config_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + CLEAR_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_RS_BIT); \ + } else { \ + CLEAR_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_RS_BIT); \ + } +#define SFP_PORT_TS_BIT_SET(sfp_port, port_config_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + SET_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TS_BIT); \ + } else { \ + SET_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_TS_BIT); \ + } +#define SFP_PORT_TS_BIT_CLEAR(sfp_port, port_config_value) \ + if (sfp_port == SFP_MIN_PORT_NUM) { \ + CLEAR_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TS_BIT); \ + } else { \ + CLEAR_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_TS_BIT); \ + } + +/* CPLD access functions */ +extern int ingrasys_i2c_cpld_get_qsfp_port_status_val(u8 port_num); +extern int ingrasys_i2c_cpld_get_qsfp_port_config_val(u8 port_num); +extern int ingrasys_i2c_cpld_set_qsfp_port_config_val(u8 port_num, u8 reg_val); +extern int ingrasys_i2c_cpld_get_sfp_port_status_val(void); +extern int ingrasys_i2c_cpld_get_sfp_port_config_val(void); +extern int ingrasys_i2c_cpld_set_sfp_port_config_val(u8 reg_val); +extern u8 fp_port_to_phy_port(u8 fp_port); +#endif + diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_platform.h b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_platform.h new file mode 100644 index 000000000000..08f14c0bd96b --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_platform.h @@ -0,0 +1,158 @@ +#ifndef _S9230_64X_PLATFORM_H +#define _S9230_64X_PLATFORM_H + +#include + +// remove debug before release +#define DEBUG + +enum bus_order { + I2C_BUS_MAIN, + MUX_9548_0_CH0, + MUX_9548_0_CH1, + MUX_9548_0_CH2, + MUX_9548_0_CH3, + MUX_9548_0_CH4, + MUX_9548_0_CH5, + MUX_9548_0_CH6, + MUX_9548_0_CH7, + MUX_9548_1_CH0, + MUX_9548_1_CH1, + MUX_9548_1_CH2, + MUX_9548_1_CH3, + MUX_9548_1_CH4, + MUX_9548_1_CH5, + MUX_9548_1_CH6, + MUX_9548_1_CH7, + MUX_9548_2_CH0, + MUX_9548_2_CH1, + MUX_9548_2_CH2, + MUX_9548_2_CH3, + MUX_9548_2_CH4, + MUX_9548_2_CH5, + MUX_9548_2_CH6, + MUX_9548_2_CH7, + MUX_9546_0_CH0, + MUX_9546_0_CH1, + MUX_9546_0_CH2, + MUX_9546_0_CH3, + MUX_9546_1_CH0, + MUX_9546_1_CH1, + MUX_9546_1_CH2, + MUX_9546_1_CH3, + MUX_9548_11_CH0, + MUX_9548_11_CH1, + MUX_9548_11_CH2, + MUX_9548_11_CH3, + MUX_9548_11_CH4, + MUX_9548_11_CH5, + MUX_9548_11_CH6, + MUX_9548_11_CH7, + MUX_9548_3_CH0, + MUX_9548_3_CH1, + MUX_9548_3_CH2, + MUX_9548_3_CH3, + MUX_9548_3_CH4, + MUX_9548_3_CH5, + MUX_9548_3_CH6, + MUX_9548_3_CH7, + MUX_9548_4_CH0, + MUX_9548_4_CH1, + MUX_9548_4_CH2, + MUX_9548_4_CH3, + MUX_9548_4_CH4, + MUX_9548_4_CH5, + MUX_9548_4_CH6, + MUX_9548_4_CH7, + MUX_9548_5_CH0, + MUX_9548_5_CH1, + MUX_9548_5_CH2, + MUX_9548_5_CH3, + MUX_9548_5_CH4, + MUX_9548_5_CH5, + MUX_9548_5_CH6, + MUX_9548_5_CH7, + MUX_9548_6_CH0, + MUX_9548_6_CH1, + MUX_9548_6_CH2, + MUX_9548_6_CH3, + MUX_9548_6_CH4, + MUX_9548_6_CH5, + MUX_9548_6_CH6, + MUX_9548_6_CH7, + MUX_9548_7_CH0, + MUX_9548_7_CH1, + MUX_9548_7_CH2, + MUX_9548_7_CH3, + MUX_9548_7_CH4, + MUX_9548_7_CH5, + MUX_9548_7_CH6, + MUX_9548_7_CH7, + MUX_9548_8_CH0, + MUX_9548_8_CH1, + MUX_9548_8_CH2, + MUX_9548_8_CH3, + MUX_9548_8_CH4, + MUX_9548_8_CH5, + MUX_9548_8_CH6, + MUX_9548_8_CH7, + MUX_9548_9_CH0, + MUX_9548_9_CH1, + MUX_9548_9_CH2, + MUX_9548_9_CH3, + MUX_9548_9_CH4, + MUX_9548_9_CH5, + MUX_9548_9_CH6, + MUX_9548_9_CH7, + MUX_9548_10_CH0, + MUX_9548_10_CH1, + MUX_9548_10_CH2, + MUX_9548_10_CH3, + MUX_9548_10_CH4, + MUX_9548_10_CH5, + MUX_9548_10_CH6, + MUX_9548_10_CH7, +}; + +#define I2C_ADDR_MUX_9555_0 (0x20) +#define I2C_ADDR_MUX_9555_1 (0x24) +#define I2C_ADDR_MUX_9555_2 (0x25) +#define I2C_ADDR_MUX_9555_3 (0x26) +#define I2C_ADDR_MUX_9539_0 (0x76) +#define I2C_ADDR_MUX_9539_1 (0x76) +#define I2C_BUS_FAN_STATUS (I2C_BUS_MAIN) +#define I2C_BUS_SYS_LED (MUX_9548_1_CH1) +#define I2C_BUS_PSU_STATUS (I2C_BUS_MAIN) +#define I2C_ADDR_PSU_STATUS (I2C_ADDR_MUX_9555_2) + +#define NUM_OF_I2C_MUX (11) +#define NUM_OF_CPLD (5) +#define NUM_OF_QSFP_PORT (64) +#define NUM_OF_SFP_PORT (2) +#define QSFP_EEPROM_I2C_ADDR (0x50) + +enum gpio_reg { + REG_PORT0_IN, + REG_PORT1_IN, + REG_PORT0_OUT, + REG_PORT1_OUT, + REG_PORT0_POL, + REG_PORT1_POL, + REG_PORT0_DIR, + REG_PORT1_DIR, +}; + +struct ing_i2c_board_info { + int ch; + int size; + struct i2c_board_info *board_info; +}; + +struct i2c_init_data { + __u16 ch; + __u16 addr; + __u8 reg; + __u8 value; +}; + +#endif diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_psu.c b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_psu.c new file mode 100644 index 000000000000..c2537bf40858 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/modules/ingrasys_s9280_64x_psu.c @@ -0,0 +1,394 @@ +/* + * S9280-64x PSU driver + * + * Copyright (C) 2017 Ingrasys, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ingrasys_s9280_64x_platform.h" + +static ssize_t show_psu_eeprom(struct device *dev, + struct device_attribute *da, + char *buf); +static struct s9280_psu_data *s9280_psu_update_status(struct device *dev); +static struct s9280_psu_data *s9280_psu_update_eeprom(struct device *dev); +static int s9280_psu_read_block(struct i2c_client *client, + u8 command, + u8 *data, + int data_len); + + +#define DRIVER_NAME "psu" + +// Addresses scanned +static const unsigned short normal_i2c[] = { 0x50, I2C_CLIENT_END }; + +/* PSU EEPROM SIZE */ +#define EEPROM_SZ 256 +#define READ_EEPROM 1 +#define NREAD_EEPROM 0 + +static struct i2c_client pca9555_client; + +/* pca9555 gpio pin mapping */ +#define PSU2_PWROK 0 +#define PSU2_PRSNT_L 1 +#define PSU2_PWRON_L 2 +#define PSU1_PWROK 3 +#define PSU1_PRSNT_L 4 +#define PSU1_PWRON_L 5 +#define TMP_75_INT_L 6 + +/* Driver Private Data */ +struct s9280_psu_data { + struct mutex lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + s32 status; /* IO expander value */ + char eeprom[EEPROM_SZ]; /* psu eeprom data */ + char psuABS; /* PSU absent */ + char psuPG; /* PSU power good */ +}; + +enum psu_index +{ + s9280_psu1, + s9280_psu2 +}; + +/* + * display power good attribute + */ +static ssize_t +show_psu_pg(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct s9280_psu_data *data = s9280_psu_update_status(dev); + unsigned int value; + + mutex_lock(&data->lock); + value = data->psuPG; + mutex_unlock(&data->lock); + + return sprintf(buf, "%d\n", value); +} + +/* + * display power absent attribute + */ +static ssize_t +show_psu_abs(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct s9280_psu_data *data = s9280_psu_update_status(dev); + unsigned int value; + + mutex_lock(&data->lock); + value = data->psuABS; + mutex_unlock(&data->lock); + + return sprintf(buf, "%d\n", value); +} + + +/* + * sysfs attributes for psu + */ +static DEVICE_ATTR(psu_pg, S_IRUGO, show_psu_pg, NULL); +static DEVICE_ATTR(psu_abs, S_IRUGO, show_psu_abs, NULL); +static DEVICE_ATTR(psu_eeprom, S_IRUGO, show_psu_eeprom, NULL); + +static struct attribute *s9280_psu_attributes[] = { + &dev_attr_psu_pg.attr, + &dev_attr_psu_abs.attr, + &dev_attr_psu_eeprom.attr, + NULL +}; + +/* + * display psu eeprom content + */ +static ssize_t +show_psu_eeprom(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct s9280_psu_data *data = s9280_psu_update_eeprom(dev); + + memcpy(buf, (char *)data->eeprom, EEPROM_SZ); + return EEPROM_SZ; +} + +static const struct attribute_group s9280_psu_group = { + .attrs = s9280_psu_attributes, +}; + +/* + * check gpio expander is accessible + */ +static int +pca9555_detect(struct i2c_client *client) +{ + if (i2c_smbus_read_byte_data(client, REG_PORT0_DIR) < 0) { + return -ENODEV; + } + + return 0; +} + +/* + * client init + */ +static void +i2c_devices_client_address_init(struct i2c_client *client) +{ + pca9555_client = *client; + + /* get i2c adapter for the target */ + pca9555_client.adapter = i2c_get_adapter(I2C_BUS_PSU_STATUS); + + /* get the i2c addr for the target */ + pca9555_client.addr = I2C_ADDR_PSU_STATUS; +} + +static int +s9280_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct s9280_psu_data *data; + int status, err; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct s9280_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + memset(data, 0, sizeof(struct s9280_psu_data)); + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->lock); + + i2c_devices_client_address_init(client); + + err = pca9555_detect(&pca9555_client); + if (err) { + return err; + } + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &s9280_psu_group); + if (status) { + goto exit_free; + } + + return 0; + +exit_free: + kfree(data); +exit: + + return status; +} + +static int +s9280_psu_remove(struct i2c_client *client) +{ + struct s9280_psu_data *data = i2c_get_clientdata(client); + + sysfs_remove_group(&client->dev.kobj, &s9280_psu_group); + kfree(data); + + /* free i2c adapter */ + i2c_put_adapter(pca9555_client.adapter); + + return 0; +} + + +/* + * psu eeprom read utility + */ +static int +s9280_psu_read_block(struct i2c_client *client, + u8 command, + u8 *data, + int data_len) +{ + int i=0, ret=0; + int blk_max = 32; //max block read size + + /* read eeprom, 32 * 8 = 256 bytes */ + for (i=0; i < EEPROM_SZ/blk_max; i++) { + ret = i2c_smbus_read_i2c_block_data(client, (i*blk_max), blk_max, + data + (i*blk_max)); + if (ret < 0) { + return ret; + } + } + return ret; +} + +/* + * update eeprom content + */ +static struct s9280_psu_data +*s9280_psu_update_eeprom(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct s9280_psu_data *data = i2c_get_clientdata(client); + s32 status = 0; + int psu_pwrok = 0; + int psu_prsnt_l = 0; + + mutex_lock(&data->lock); + + if (time_after(jiffies, data->last_updated + 300 * HZ) + || !data->valid) { + + /* Read psu status */ + + status = i2c_smbus_read_word_data(&(pca9555_client), REG_PORT0_IN); + data->status = status; + + /*read psu status from io expander*/ + + if (data->index == s9280_psu1) { + psu_pwrok = PSU1_PWROK; + psu_prsnt_l = PSU1_PRSNT_L; + } else { + psu_pwrok = PSU2_PWROK; + psu_prsnt_l = PSU2_PRSNT_L; + } + data->psuPG = (status >> psu_pwrok) & 0x1; + data->psuABS = (status >> psu_prsnt_l) & 0x1; + + /* Read eeprom */ + if (!data->psuABS) { + //clear local eeprom data + memset(data->eeprom, 0, EEPROM_SZ); + + //read eeprom + status = s9280_psu_read_block(client, 0, data->eeprom, + ARRAY_SIZE(data->eeprom)); + + if (status < 0) { + memset(data->eeprom, 0, EEPROM_SZ); + dev_err(&client->dev, "Read eeprom failed, status=(%d)\n", status); + } else { + data->valid = 1; + } + } else { + memset(data->eeprom, 0, EEPROM_SZ); + } + data->last_updated = jiffies; + } + + mutex_unlock(&data->lock); + + return data; +} + +/* + * update psu status + */ +static struct s9280_psu_data +*s9280_psu_update_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct s9280_psu_data *data = i2c_get_clientdata(client); + s32 status = 0; + int psu_pwrok = 0; + int psu_prsnt_l = 0; + + mutex_lock(&data->lock); + + /* Read psu status */ + + status = i2c_smbus_read_word_data(&(pca9555_client), REG_PORT0_IN); + data->status = status; + + /*read psu status from io expander*/ + + if (data->index == s9280_psu1) { + psu_pwrok = PSU1_PWROK; + psu_prsnt_l = PSU1_PRSNT_L; + } else { + psu_pwrok = PSU2_PWROK; + psu_prsnt_l = PSU2_PRSNT_L; + } + data->psuPG = (status >> psu_pwrok) & 0x1; + data->psuABS = (status >> psu_prsnt_l) & 0x1; + + mutex_unlock(&data->lock); + + return data; +} + +static const struct i2c_device_id s9280_psu_id[] = { + { "psu1", s9280_psu1 }, + { "psu2", s9280_psu2 }, + {} +}; + +MODULE_DEVICE_TABLE(i2c, s9280_psu_id); + +static struct i2c_driver s9280_psu_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = s9280_psu_probe, + .remove = s9280_psu_remove, + .id_table = s9280_psu_id, + .address_list = normal_i2c, +}; + +static int __init s9280_psu_init(void) +{ + return i2c_add_driver(&s9280_psu_driver); +} + +static void __exit s9280_psu_exit(void) +{ + i2c_del_driver(&s9280_psu_driver); +} + +module_init(s9280_psu_init); +module_exit(s9280_psu_exit); + +MODULE_AUTHOR("Leo Lin "); +MODULE_DESCRIPTION("S9280-64X psu driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/service/qsfp-monitor.service b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/service/qsfp-monitor.service new file mode 100644 index 000000000000..c801ad68966d --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/service/qsfp-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description= This QSFP Monitor service is to setup QSFP SI. +Requires=s9280-64x-monitor.service +After=s9280-64x-monitor.service + +[Service] +ExecStart=/usr/sbin/qsfp_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/service/s9280-64x-monitor.service b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/service/s9280-64x-monitor.service new file mode 100644 index 000000000000..5f22b6164dd0 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/service/s9280-64x-monitor.service @@ -0,0 +1,19 @@ +[Unit] +Description= This Platform Monitor service is to initialize platform and monitor platform. +Before=platform-monitor.service +After=sysinit.target +Wants=fancontrol.service +Wants=qsfp-monitor.service +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/sbin/i2c_utils.sh i2c_init +ExecStart=/usr/sbin/s9280_64x_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/i2c_utils.sh b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/i2c_utils.sh new file mode 100755 index 000000000000..fcb7b6372efa --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/i2c_utils.sh @@ -0,0 +1,1844 @@ +#!/bin/bash + +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# trun on for more debug output +#DEBUG="on" + +VERSION="1.0.0" +TRUE=200 +FALSE=404 + +EXEC_FUNC=${1} +COLOR_LED=${2} +QSFP_PORT=${2} +SFP_PORT=${2} +QSFP_ACTION=${2} +SFP_ACTION=${2} +MB_EEPROM_ACTION=${2} +ONOFF_LED=${3} +FAN_TRAY=${4} + +############################################################ +# Distributor ID: Debian +# Description: Debian GNU/Linux 8.6 (jessie) +# Release: 8.6 +# Codename: jessie +# Linux debian 3.16.0-4-amd64 #1 +# SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux +############################################################ + +# Color Definition +COLOR_TITLE="\e[1;32m" ### Green ### +COLOR_WARNING="\e[1;33m" ### Yellow ### +COLOR_ERROR="\e[1;31m" ### Red ### +COLOR_END="\e[0m" ### END ### + +NUM_I801_DEVICE=0 + +# PCA9548#0 0x70 +NUM_MUX_9548_0_CH0=$(( ${NUM_I801_DEVICE} + 1 )) # CPLD1 +NUM_MUX_9548_0_CH1=$(( ${NUM_I801_DEVICE} + 2 )) # CPLD2 +NUM_MUX_9548_0_CH2=$(( ${NUM_I801_DEVICE} + 3 )) # CPLD3 +NUM_MUX_9548_0_CH3=$(( ${NUM_I801_DEVICE} + 4 )) # CPLD4 +NUM_MUX_9548_0_CH4=$(( ${NUM_I801_DEVICE} + 5 )) # CPLD5 +NUM_MUX_9548_0_CH5=$(( ${NUM_I801_DEVICE} + 6 )) # LM75_1 LM75_2 LM86 +NUM_MUX_9548_0_CH6=$(( ${NUM_I801_DEVICE} + 7 )) # LM75_3 LM75_4 + +# PCA9548#1 0x73 +NUM_MUX_9548_1_CH0=$(( ${NUM_I801_DEVICE} + 9 )) # UCD9090 +NUM_MUX_9548_1_CH1=$(( ${NUM_I801_DEVICE} + 10 )) # PCA9539#0 0x76 for FP LED & HW ID +NUM_MUX_9548_1_CH2=$(( ${NUM_I801_DEVICE} + 11 )) # NONE +NUM_MUX_9548_1_CH3=$(( ${NUM_I801_DEVICE} + 12 )) # EEPROM for debug 0x57 +#NUM_MUX_9548_1_CH4=$(( ${NUM_I801_DEVICE} + 13 )) # NONE +NUM_MUX_9548_1_CH5=$(( ${NUM_I801_DEVICE} + 14 )) # CLK gen +NUM_MUX_9548_1_CH6=$(( ${NUM_I801_DEVICE} + 15 )) # ROV +NUM_MUX_9548_1_CH7=$(( ${NUM_I801_DEVICE} + 16 )) # HWM on BMC + +# PCA9546#0 0X72 +NUM_MUX_9546_0_CH0=$(( ${NUM_I801_DEVICE} + 17 )) # PSU1 0x58 +NUM_MUX_9546_0_CH1=$(( ${NUM_I801_DEVICE} + 18 )) # PSU2 0x58 +NUM_MUX_9546_0_CH2=$(( ${NUM_I801_DEVICE} + 19 )) # NONE +NUM_MUX_9546_0_CH3=$(( ${NUM_I801_DEVICE} + 20 )) # NONE + +# PCA9548#2 0X71 +NUM_MUX_9548_2_CH0=$(( ${NUM_I801_DEVICE} + 21 )) # PCA9548#3 0x74 +NUM_MUX_9548_2_CH1=$(( ${NUM_I801_DEVICE} + 22 )) # PCA9548#4 0x74 +NUM_MUX_9548_2_CH2=$(( ${NUM_I801_DEVICE} + 23 )) # PCA9548#5 0x74 +NUM_MUX_9548_2_CH3=$(( ${NUM_I801_DEVICE} + 24 )) # PCA9548#6 0x74 +NUM_MUX_9548_2_CH4=$(( ${NUM_I801_DEVICE} + 25 )) # PCA9548#7 0x74 +NUM_MUX_9548_2_CH5=$(( ${NUM_I801_DEVICE} + 26 )) # PCA9548#8 0x74 +NUM_MUX_9548_2_CH6=$(( ${NUM_I801_DEVICE} + 27 )) # PCA9548#9 0x74 +NUM_MUX_9548_2_CH7=$(( ${NUM_I801_DEVICE} + 28 )) # PCA9548#10 0x74 + + + +# PCA9546#1 0X77 +NUM_MUX_9546_1_CH0=$(( ${NUM_I801_DEVICE} + 29 )) # SFP0 EEPROM 0x50 +NUM_MUX_9546_1_CH1=$(( ${NUM_I801_DEVICE} + 30 )) # SFP1 EEPROM 0x50 +NUM_MUX_9546_1_CH2=$(( ${NUM_I801_DEVICE} + 31 )) # NONE +NUM_MUX_9546_1_CH3=$(( ${NUM_I801_DEVICE} + 32 )) # PCA9539#1 0x76 for sys control + +# PCA9548#11 0X75 +NUM_MUX_9548_11_CH0=$(( ${NUM_I801_DEVICE} + 33 )) # SW upgrade for CPLD1 +NUM_MUX_9548_11_CH1=$(( ${NUM_I801_DEVICE} + 34 )) # SW upgrade for CPLD2 +NUM_MUX_9548_11_CH2=$(( ${NUM_I801_DEVICE} + 35 )) # SW upgrade for CPLD3 +NUM_MUX_9548_11_CH3=$(( ${NUM_I801_DEVICE} + 36 )) # SW upgrade for CPLD4 +NUM_MUX_9548_11_CH4=$(( ${NUM_I801_DEVICE} + 37 )) # SW upgrade for CPLD5 +NUM_MUX_9548_11_CH5=$(( ${NUM_I801_DEVICE} + 38 )) # EEPROM for debug 0x57 +NUM_MUX_9548_11_CH6=$(( ${NUM_I801_DEVICE} + 39 )) # Retimer#0~3 +NUM_MUX_9548_11_CH7=$(( ${NUM_I801_DEVICE} + 40 )) # Retimer#4~7 + +# PCA9548#3~10 0X74 +NUM_MUX_9548_3_CH0=$(( ${NUM_I801_DEVICE} + 41 )) # QSFP 0 EEPROM +NUM_MUX_9548_4_CH0=$(( ${NUM_I801_DEVICE} + 49 )) # QSFP 8 EEPROM +NUM_MUX_9548_5_CH0=$(( ${NUM_I801_DEVICE} + 57 )) # QSFP 16 EEPROM +NUM_MUX_9548_6_CH0=$(( ${NUM_I801_DEVICE} + 65 )) # QSFP 24 EEPROM +NUM_MUX_9548_7_CH0=$(( ${NUM_I801_DEVICE} + 73 )) # QSFP 32 EEPROM +NUM_MUX_9548_8_CH0=$(( ${NUM_I801_DEVICE} + 81 )) # QSFP 40 EEPROM +NUM_MUX_9548_9_CH0=$(( ${NUM_I801_DEVICE} + 89 )) # QSFP 48 EEPROM +NUM_MUX_9548_10_CH0=$(( ${NUM_I801_DEVICE} + 97 )) # QSFP 56 EEPROM + +# MUX Alias +I2C_BUS_MAIN=${NUM_I801_DEVICE} +I2C_BUS_HWM=${NUM_MUX_9548_1_CH7} +I2C_BUS_FAN_STATUS=${I2C_BUS_MAIN} +I2C_BUS_SYS_LED=${NUM_MUX_9548_1_CH1} +I2C_BUS_HW_ID=${NUM_MUX_9548_1_CH1} +I2C_BUS_BMC_HW_ID=${I2C_BUS_MAIN} +I2C_BUS_PSU_STAT=${I2C_BUS_MAIN} +I2C_BUS_FANTRAY_LED=${I2C_BUS_MAIN} +I2C_BUS_MB_EEPROM=${I2C_BUS_MAIN} +I2C_BUS_CB_EEPROM=${I2C_BUS_MAIN} +# TODO: check i2c channel of PSU1/PSU2, it swap in s9230 +I2C_BUS_PSU1_EEPROM=${NUM_MUX_9546_0_CH1} +I2C_BUS_PSU2_EEPROM=${NUM_MUX_9546_0_CH0} +I2C_BUS_CPLD1=${NUM_MUX_9548_0_CH0} +I2C_BUS_CPLD2=${NUM_MUX_9548_0_CH1} +I2C_BUS_CPLD3=${NUM_MUX_9548_0_CH2} +I2C_BUS_CPLD4=${NUM_MUX_9548_0_CH3} +I2C_BUS_CPLD5=${NUM_MUX_9548_0_CH4} +I2C_BUS_ROV=${NUM_MUX_9548_1_CH6} + +# I2C BUS path +PATH_SYS_I2C_DEVICES="/sys/bus/i2c/devices" +PATH_HWMON_ROOT_DEVICES="/sys/class/hwmon" +# TODO: need to verify HWM deivce path after board ready +PATH_HWMON_W83795_DEVICE="${PATH_HWMON_ROOT_DEVICES}/hwmon1" +PATH_I801_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}" +PATH_MUX_9548_0_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CH0}" +PATH_MUX_9548_0_CH1="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CH1}" +PATH_MUX_9548_0_CH2="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CH2}" +PATH_MUX_9548_0_CH3="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CH3}" +PATH_MUX_9548_0_CH4="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CH4}" +PATH_MUX_9548_0_CH5="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CH5}" +PATH_MUX_9548_0_CH6="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CH6}" +PATH_MUX_9548_0_CH7="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CH7}" +PATH_MUX_9548_1_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CH0}" +PATH_MUX_9548_1_CH1="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CH1}" +PATH_MUX_9548_1_CH2="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CH2}" +PATH_MUX_9548_1_CH3="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CH3}" +PATH_MUX_9548_1_CH4="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CH4}" +PATH_MUX_9548_1_CH5="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CH5}" +PATH_MUX_9548_1_CH6="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CH6}" +PATH_MUX_9548_1_CH7="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CH7}" +PATH_MUX_9548_2_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_2_CH0}" +PATH_MUX_9548_2_CH1="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_2_CH1}" +PATH_MUX_9548_2_CH2="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_2_CH2}" +PATH_MUX_9548_2_CH3="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_2_CH3}" +PATH_MUX_9548_2_CH4="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_2_CH4}" +PATH_MUX_9548_2_CH5="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_2_CH5}" +PATH_MUX_9548_2_CH6="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_2_CH6}" +PATH_MUX_9548_2_CH7="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_2_CH7}" +PATH_MUX_9546_0_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9546_0_CH0}" +PATH_MUX_9546_0_CH1="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9546_0_CH1}" +PATH_MUX_9546_0_CH2="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9546_0_CH2}" +PATH_MUX_9546_0_CH3="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9546_0_CH3}" +PATH_MUX_9546_1_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9546_1_CH0}" +PATH_MUX_9546_1_CH1="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9546_1_CH1}" +PATH_MUX_9546_1_CH2="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9546_1_CH2}" +PATH_MUX_9546_1_CH3="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9546_1_CH3}" +PATH_MUX_9548_11_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_11_CH0}" +PATH_MUX_9548_3_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_3_CH0}" +PATH_MUX_9548_4_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_4_CH0}" +PATH_MUX_9548_5_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_5_CH0}" +PATH_MUX_9548_6_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_6_CH0}" +PATH_MUX_9548_7_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_7_CH0}" +PATH_MUX_9548_8_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_8_CH0}" +PATH_MUX_9548_9_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_9_CH0}" +PATH_MUX_9548_10_CH0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_10_CH0}" +PATH_CPLD1_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_CPLD1}" +PATH_CPLD2_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_CPLD2}" +PATH_CPLD3_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_CPLD3}" +PATH_CPLD4_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_CPLD4}" +PATH_CPLD5_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_CPLD5}" + + +# I2C Address +### I2C MUX +I2C_ADDR_MUX_9548_0=0x70 +I2C_ADDR_MUX_9548_1=0x73 +I2C_ADDR_MUX_9548_2=0x71 +I2C_ADDR_MUX_9546_0=0x72 +I2C_ADDR_MUX_9546_1=0x71 +I2C_ADDR_MUX_9548_11=0x75 +I2C_ADDR_MUX_9548_3=0x74 +I2C_ADDR_MUX_9548_4=0x74 +I2C_ADDR_MUX_9548_5=0x74 +I2C_ADDR_MUX_9548_6=0x74 +I2C_ADDR_MUX_9548_7=0x74 +I2C_ADDR_MUX_9548_8=0x74 +I2C_ADDR_MUX_9548_9=0x74 +I2C_ADDR_MUX_9548_10=0x74 + +### GPIO Expander +I2C_ADDR_MUX_9539_0=0x76 # LED & HW ID +I2C_ADDR_MUX_9539_1=0x76 # SYS config +I2C_ADDR_MUX_9539_2=0x76 # on CPU board, STATUS and ERR from CPLD +I2C_ADDR_MUX_9555_0=0x20 # on FAN board, fan status and led config +I2C_ADDR_MUX_9555_1=0x24 # on BMC board, INT and HW ID +I2C_ADDR_MUX_9555_2=0x25 # on BMC board, PSU status +I2C_ADDR_MUX_9555_3=0x26 # on BMC board, RST and SEL + + +### peripheral +I2C_ADDR_MB_EEPROM=0x55 # on main board +I2C_ADDR_CB_EEPROM=0x51 # on cpu board +I2C_ADDR_UCD9090=0x34 +I2C_ADDR_W83795=0x2F +I2C_ADDR_PSU1_EEPROM=0x50 +I2C_ADDR_PSU2_EEPROM=0x50 +I2C_ADDR_LM75_1=0x4D # Rear Panel +I2C_ADDR_LM75_2=0x4E # Rear MAC +I2C_ADDR_LM86=0x4C # TBD +I2C_ADDR_LM75_3=0x4D # Front Panel +I2C_ADDR_LM75_4=0x4E # Front MAC +I2C_ADDR_TMP75_CB=0x4F # on cpu board +I2C_ADDR_TMP75_BB=0x4A # on bmc board +I2C_ADDR_QSFP_EEPROM=0x50 +I2C_ADDR_SFP_EEPROM=0x50 +I2C_ADDR_CPLD=0x33 +I2C_ADDR_ROV=0x76 + +#sysfs +PATH_SYSFS_PSU1="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_PSU1_EEPROM}-$(printf "%04x" $I2C_ADDR_PSU1_EEPROM)" +PATH_SYSFS_PSU2="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_PSU2_EEPROM}-$(printf "%04x" $I2C_ADDR_PSU2_EEPROM)" + +#ACTIVE LOW enable flag +ACTIVE_LOW_EN=1 +ACTIVE_HIGH_EN=0 +#GPIO Direction In/Out +DIR_IN=in +DIR_OUT=out + +#Power Supply Status +PSU_DC_ON=1 +PSU_DC_OFF=0 +PSU_EXIST=1 +PSU_NOT_EXIST=0 + +# IO expander register +# direction +REG_PORT0_DIR=6 +REG_PORT1_DIR=7 +# polarity +REG_PORT0_POL=4 +REG_PORT1_POL=5 +# output +REG_PORT0_OUT=2 +REG_PORT1_OUT=3 +# input +REG_PORT0_IN=0 +REG_PORT1_IN=1 + +# qsfp port number range +MIN_QSFP_PORT_NUM=1 +MAX_QSFP_PORT_NUM=64 + +# sfp+ port number range +MIN_SFP_PORT_NUM=1 +MAX_SFP_PORT_NUM=2 + +# CPLD access +# ROV status +CPLD_ROV_STATUS_KEY=cpld_rov_status +# port status +CPLD_QSFP_STATUS_KEY=cpld_qsfp_port_status +CPLD_SFP_STATUS_KEY=cpld_sfp_port_status +# bit define +CPLD_QSFP_STATUS_ABS_BIT=1 +CPLD_SFP0_STATUS_PRES_BIT=0 +CPLD_SFP1_STATUS_PRES_BIT=4 + +# fp port to phy port mapping +fp2phy_array=( 0 1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 + 32 33 36 37 40 41 44 45 48 49 52 53 56 57 60 61 + 2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31 + 34 35 38 39 42 43 46 47 50 51 54 55 58 59 62 63) +# fp port to led port mapping +fp2led_array=( 1 2 5 6 9 10 13 14 1 2 5 6 9 10 13 14 + 1 2 5 6 9 10 13 14 1 2 5 6 9 10 13 14 + 3 4 7 8 11 12 15 16 3 4 7 8 11 12 15 16 + 3 4 7 8 11 12 15 16 3 4 7 8 11 12 15 16) +# vdd value for mac +rov_val_array=( 0.85 0.82 0.77 0.87 0.74 0.84 0.79 0.89 ) +rov_reg_array=( 0x79 0x73 0x69 0x7D 0x63 0x77 0x6D 0x81 ) + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} i2c_init" + echo " : ${0} i2c_deinit" + echo " : ${0} i2c_fan_speed_init" + echo " : ${0} i2c_io_exp_init" + echo " : ${0} i2c_led_test" + echo " : ${0} i2c_psu_eeprom_get" + echo " : ${0} i2c_mb_eeprom_get" + echo " : ${0} i2c_cb_eeprom_get" + echo " : ${0} i2c_qsfp_eeprom_get [${MIN_QSFP_PORT_NUM}-${MAX_QSFP_PORT_NUM}]" + echo " : ${0} i2c_sfp_eeprom_get [${MIN_SFP_PORT_NUM}-${MAX_SFP_PORT_NUM}]" + echo " : ${0} i2c_qsfp_eeprom_init new|delete" + echo " : ${0} i2c_sfp_eeprom_init new|delete" + echo " : ${0} i2c_mb_eeprom_init new|delete" + echo " : ${0} i2c_cb_eeprom_init new|delete" + echo " : ${0} i2c_qsfp_status_get [${MIN_QSFP_PORT_NUM}-${MAX_QSFP_PORT_NUM}]" + echo " : ${0} i2c_sfp_status_get [${MIN_SFP_PORT_NUM}-${MAX_SFP_PORT_NUM}]" + echo " : ${0} i2c_qsfp_type_get [${MIN_QSFP_PORT_NUM}-${MAX_QSFP_PORT_NUM}]" + echo " : ${0} i2c_sfp_type_get [${MIN_SFP_PORT_NUM}-${MAX_SFP_PORT_NUM}]" + echo " : ${0} i2c_board_type_get" + echo " : ${0} i2c_bmc_board_type_get" + echo " : ${0} i2c_cpld_version" + echo " : ${0} i2c_psu_status" + echo " : ${0} i2c_led_psu_status_set" + echo " : ${0} i2c_led_fan_status_set" + echo " : ${0} i2c_led_fan_tray_status_set" + echo " : ${0} i2c_test_all" + echo " : ${0} i2c_sys_led green|amber" + echo " : ${0} i2c_fan_led green|amber|off" + echo " : ${0} i2c_psu1_led green|amber|off" + echo " : ${0} i2c_psu2_led green|amber|off" + echo " : ${0} i2c_fan_tray_led green|amber on|off [1-4]" + echo "----------------------------------------------------" +} + +#Pause function +function _pause { + read -p "$*" +} + +#Retry command function +function _retry { + local i + for i in {1..5}; + do + echo "${*}" + eval "${*}" && break || echo "retry"; sleep 1; + done +} + +# front panel port to physical port mapping +function _port_fp2phy { + + local fp_port=$1 + local phy_port=0 + local index=$((${fp_port} - 1)) + # change to 1 base index for internal use + phy_port=$((${fp2phy_array[$index]} + 1)) + #phy_port=${fp2phy_array[$index]} + + echo $phy_port +} + +#front panel port to led port mapping +function _port_fp2led { + + local logic_port=$1 + local led_port=0 + led_port=${fp2led_array[$logic_port]} + + echo $led_port +} + +#I2C Init +function _i2c_init { + echo "=========================================================" + echo "# Description: I2C Init" + echo "=========================================================" + + #remove optoe module + rmmod optoe + + #rmmod i2c_ismt + _util_rmmod i2c_i801 + modprobe i2c_i801 + modprobe i2c_dev + modprobe i2c_mux_pca954x force_deselect_on_exit=1 + + # add MUX PCA9548#0 on I801, assume to be i2c-1~8 + if [ ! -e ${PATH_MUX_9548_0_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_0}' > ${PATH_I801_DEVICE}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_0} already init." + fi + + # add MUX PCA9548#1 on I801, assume to be i2c-9~16 + if [ ! -e ${PATH_MUX_9548_1_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_1}' > ${PATH_I801_DEVICE}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_1} already init." + fi + + # add MUX PCA9546#0 on I801, assume to be i2c-17~20 + if [ ! -e ${PATH_MUX_9546_0_CH0} ]; then + _retry "echo 'pca9546 ${I2C_ADDR_MUX_9546_0}' > ${PATH_I801_DEVICE}/new_device" + else + echo "pca9546 ${I2C_ADDR_MUX_9546_0} already init." + fi + + # add MUX PCA9548#2 on I801, assume to be i2c-21~28 + if [ ! -e ${PATH_MUX_9548_2_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_2}' > ${PATH_MUX_9546_0_CH2}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_2} already init." + fi + + # add MUX PCA9546#1 on I801, assume to be i2c-29~32 + if [ ! -e ${PATH_MUX_9546_1_CH0} ]; then + _retry "echo 'pca9546 ${I2C_ADDR_MUX_9546_1}' > ${PATH_MUX_9546_0_CH3}/new_device" + else + echo "pca9546 ${I2C_ADDR_MUX_9546_1} already init." + fi + + # add MUX PCA9548#11 on I801, assume to be i2c-33~40 + if [ ! -e ${PATH_MUX_9548_11_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_11}' > ${PATH_I801_DEVICE}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_11} already init." + fi + + # add MUX PCA9548#3 on PCA9548#2 CH0, assume to be i2c-41~48 + if [ ! -e ${PATH_MUX_9548_3_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_3}' > ${PATH_MUX_9548_2_CH0}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_4} already init." + fi + + # add MUX PCA9548#4 on PCA9548#2 CH1, assume to be i2c-49~56 + if [ ! -e ${PATH_MUX_9548_4_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_4}' > ${PATH_MUX_9548_2_CH1}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_4} already init." + fi + + # add MUX PCA9548#5 on PCA9548#2 CH2, assume to be i2c-57~64 + if [ ! -e ${PATH_MUX_9548_5_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_5}' > ${PATH_MUX_9548_2_CH2}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_5} already init." + fi + + # add MUX PCA9548#6 on PCA9548#2 CH3, assume to be i2c-65~72 + if [ ! -e ${PATH_MUX_9548_6_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_6}' > ${PATH_MUX_9548_2_CH3}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_6} already init." + fi + + # add MUX PCA9548#7 on PCA9548#2 CH4, assume to be i2c-73~80 + if [ ! -e ${PATH_MUX_9548_7_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_7}' > ${PATH_MUX_9548_2_CH4}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_7} already init." + fi + + # add MUX PCA9548#8 on PCA9548#2 CH5, assume to be i2c-81~88 + if [ ! -e ${PATH_MUX_9548_8_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_8}' > ${PATH_MUX_9548_2_CH5}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_8} already init." + fi + + # add MUX PCA9548#9 on PCA9548#2 CH6, assume to be i2c-89~96 + if [ ! -e ${PATH_MUX_9548_9_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_9}' > ${PATH_MUX_9548_2_CH6}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_9} already init." + fi + + # add MUX PCA9548#10 on PCA9548#2 CH7, assume to be i2c-97~104 + if [ ! -e ${PATH_MUX_9548_10_CH0} ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_10}' > ${PATH_MUX_9548_2_CH7}/new_device" + else + echo "pca9548 ${I2C_ADDR_MUX_9548_10} already init." + fi + + _i2c_hwm_init + _util_rmmod eeprom + modprobe eeprom_mb + modprobe gpio-pca953x + _i2c_io_exp_init + _i2c_sensors_init + _i2c_cpld_init + _i2c_psu_init + + _i2c_qsfp_eeprom_init "new" + _i2c_sfp_eeprom_init "new" + _i2c_mb_eeprom_init "new" + _i2c_cb_eeprom_init "new" + _i2c_fan_speed_init + _i2c_led_psu_status_set + _i2c_led_fan_status_set + + # clear port led + _util_port_led_clear + + # rov for mac init + _mac_vdd_init + + # trun on sys led + echo "led_sys setup..." + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_sys_led + + _config_rmem +} + +function _mac_vdd_init { + # read mac vid register value from CPLD + cpld_index=1 + _i2c_cpld_reg_read ${cpld_index} ${CPLD_ROV_STATUS_KEY} + # get vid form register value [0:2] + vid=$(($cpld_reg_val & 0x7)) + # get rov val and reg according to vid + rov_val=${rov_val_array[$vid]} + rov_reg=${rov_reg_array[$vid]} + echo "vid=${vid}, rov_val=${rov_val}, rov_reg=${rov_reg}" + + # write the rov reg to rov + i2cset -y -r ${I2C_BUS_ROV} ${I2C_ADDR_ROV} 0x21 ${rov_reg} w + + if [ $? -eq 0 ]; then + echo "set ROV for mac vdd done" + else + echo "set ROV for mac vdd fail" + fi +} + +#I2C Deinit +function _i2c_deinit { + echo "i2c deinit..." + for mod in coretemp jc42 w83795 ingrasys_s9280_64x_psu ingrasys_s9280_64x_i2c_cpld eeprom eeprom_mb gpio-pca953x i2c_mux_pca954x i2c_i801; + do + _util_rmmod $mod + done + echo "Done" +} + +function _i2c_cpld_init { + echo "CPLD init..." + _util_rmmod ingrasys_s9280_64x_i2c_cpld + modprobe ingrasys_s9280_64x_i2c_cpld + + # add cpld 1~5 to sysfs + for i in {1..5}; + do + local cpld_bus="I2C_BUS_CPLD${i}" + local cpld_path="PATH_CPLD${i}_DEVICE" + dev_path="${PATH_SYS_I2C_DEVICES}/${!cpld_bus}-$(printf "%04x" ${I2C_ADDR_CPLD})" + if ! [ -L ${dev_path} ]; then + echo "ingrasys_cpld${i} ${I2C_ADDR_CPLD}" > ${!cpld_path}/new_device + else + echo "${dev_path} already exist" + fi + done + + echo "Done" +} + +function _i2c_sensors_init { + echo "SENSORS init..." + local dev_path + # to make sure hwmon index in sysfs as expected, + # need to remove kernel module and then probe them in expected order + # remove all sensors kernel module + _util_rmmod coretemp + _util_rmmod jc42 + _util_rmmod w83795 + # probe coretemp kernel module + modprobe coretemp #hwmon0 + # probe hwmon kernel module + modprobe w83795 + # add w83795 to sysfs + dev_path="${PATH_SYS_I2C_DEVICES}/${NUM_MUX_9548_1_CH7}-$(printf "%04x" ${I2C_ADDR_W83795})" + if ! [ -L ${dev_path} ]; then + echo "w83795adg ${I2C_ADDR_W83795}" > ${PATH_MUX_9548_1_CH7}/new_device #hwmon1 + sleep 0.1 + else + echo "${dev_path} already exist" + fi + # add lm75/lm86 to sysfs + ####Main board thermal + ####lm75_1 + dev_path="${PATH_SYS_I2C_DEVICES}/${NUM_MUX_9548_0_CH5}-$(printf "%04x" ${I2C_ADDR_LM75_1})" + if ! [ -L ${dev_path} ]; then + echo "lm75 ${I2C_ADDR_LM75_1}" > ${PATH_MUX_9548_0_CH5}/new_device # hwmon2 + sleep 0.1 + else + echo "${dev_path} already exist" + fi + ####lm75_2 + dev_path="${PATH_SYS_I2C_DEVICES}/${NUM_MUX_9548_0_CH5}-$(printf "%04x" ${I2C_ADDR_LM75_2})" + if ! [ -L ${dev_path} ]; then + echo "lm75 ${I2C_ADDR_LM75_2}" > ${PATH_MUX_9548_0_CH5}/new_device #hwmon3 + sleep 0.1 + else + echo "${dev_path} already exist" + fi + ####lm86 + dev_path="${PATH_SYS_I2C_DEVICES}/${NUM_MUX_9548_0_CH5}-$(printf "%04x" ${I2C_ADDR_LM86})" + if ! [ -L ${dev_path} ]; then + echo "lm86 ${I2C_ADDR_LM86}" > ${PATH_MUX_9548_0_CH5}/new_device #hwmon4 + sleep 0.1 + else + echo "${dev_path} already exist" + fi + ####lm75_3 + dev_path="${PATH_SYS_I2C_DEVICES}/${NUM_MUX_9548_0_CH6}-$(printf "%04x" ${I2C_ADDR_LM75_3})" + if ! [ -L ${dev_path} ]; then + echo "lm75 ${I2C_ADDR_LM75_3}" > ${PATH_MUX_9548_0_CH6}/new_device # hwmon5 + sleep 0.1 + else + echo "${dev_path} already exist" + fi + ####lm75_4 + dev_path="${PATH_SYS_I2C_DEVICES}/${NUM_MUX_9548_0_CH6}-$(printf "%04x" ${I2C_ADDR_LM75_4})" + if ! [ -L ${dev_path} ]; then + echo "lm75 ${I2C_ADDR_LM75_4}" > ${PATH_MUX_9548_0_CH6}/new_device #hwmon6 + sleep 0.1 + else + echo "${dev_path} already exist" + fi + ####BMC board thermal + dev_path="${PATH_SYS_I2C_DEVICES}/${NUM_MUX_9548_1_CH7}-$(printf "%04x" ${I2C_ADDR_TMP75_BB})" + if ! [ -L ${dev_path} ]; then + echo "tmp75 ${I2C_ADDR_TMP75_BB}" > ${PATH_MUX_9548_1_CH7}/new_device #hwmon7 + sleep 0.1 + else + echo "${dev_path} already exist" + fi + ####CPU board thermal + dev_path="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_MAIN}-$(printf "%04x" ${I2C_ADDR_TMP75_CB})" + if ! [ -L ${dev_path} ]; then + echo "tmp75 ${I2C_ADDR_TMP75_CB}" > ${PATH_I801_DEVICE}/new_device #hwmon8 + sleep 0.1 + else + echo "${dev_path} already exist" + fi + + # probe jc42 kernel module + modprobe jc42 #hwmon9 + + echo "Done" +} + +#FAN Speed Init +function _i2c_fan_speed_init { + echo -n "FAN SPEED INIT..." + if [ -e "${PATH_HWMON_W83795_DEVICE}" ]; then + # init fan speed + echo 120 > ${PATH_HWMON_W83795_DEVICE}/device/pwm2 + echo "SUCCESS" + else + echo "FAIL" + fi +} + +# HWM init +function _i2c_hwm_init { + echo "HWM INIT..." + # select bank0 + _util_i2cset -y -r ${I2C_BUS_HWM} ${I2C_ADDR_W83795} 0x00 0x80 + # SW reset, Disable monitor + _util_i2cset -y -r ${I2C_BUS_HWM} ${I2C_ADDR_W83795} 0x01 0x9C + # disable TR5/TR6 DTS + _util_i2cset -y -r ${I2C_BUS_HWM} ${I2C_ADDR_W83795} 0x04 0x0 + # enable FANIN1~8 + _util_i2cset -y -r ${I2C_BUS_HWM} ${I2C_ADDR_W83795} 0x06 0xFF + # disable FANIN9~14 + _util_i2cset -y -r ${I2C_BUS_HWM} ${I2C_ADDR_W83795} 0x07 0x00 + # CLKIN clock frequency set as 48Mhz + _util_i2cset -y -r ${I2C_BUS_HWM} ${I2C_ADDR_W83795} 0x01 0x1C + # select bank 2 + _util_i2cset -y -r ${I2C_BUS_HWM} ${I2C_ADDR_W83795} 0x00 0x82 + # set PWM mode in FOMC + _util_i2cset -y -r ${I2C_BUS_HWM} ${I2C_ADDR_W83795} 0x0F 0x00 + # set 25KHz fan output frequency in F1OPFP&F2OPFP + _util_i2cset -y -r ${I2C_BUS_HWM} ${I2C_ADDR_W83795} 0x18 0x84 + _util_i2cset -y -r ${I2C_BUS_HWM} ${I2C_ADDR_W83795} 0x19 0x84 +} + +#IO Expander Init +function _i2c_io_exp_init { + echo "=========================================================" + echo "# Description: I2C IO Expender Init" + echo "=========================================================" + + # need to init BMC io expander first due to some io expander are reset default + echo "Init BMC INT & HW ID IO Expander" + # all input + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_1} ${REG_PORT0_DIR} 0xFF + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_1} ${REG_PORT1_DIR} 0xFF + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_1} ${REG_PORT0_POL} 0x00 + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_1} ${REG_PORT1_POL} 0x00 + + echo "Init BMC PSU status IO Expander" + # PWRON default 0 (ACTIVE_LOW) + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_2} ${REG_PORT0_OUT} 0x00 + # default 0 (ACTIVE_LOW) + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_2} ${REG_PORT1_OUT} 0x00 + # I/O 0.2 0.5 output(PWRON), rest input + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_2} ${REG_PORT0_DIR} 0xDB + # I/O 1.0~1.1 input, 1.2~1.4 output (1.5~1.7 not enable) + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_2} ${REG_PORT1_DIR} 0xE3 + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_2} ${REG_PORT0_POL} 0x00 + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_2} ${REG_PORT1_POL} 0x00 + + echo "Init BMC RST and SEL IO Expander" + # RST default is 1 (ACTIVE_LOW) + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_3} ${REG_PORT0_OUT} 0x3F + # SEL default is 0 (HOST), EN default is 1 (ACTIVE_HIGH) + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_3} ${REG_PORT1_OUT} 0x1F + # I/O 0.0~0.5 output, 0.6~0.7 not use + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_3} ${REG_PORT0_DIR} 0xD0 + # all output + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_3} ${REG_PORT1_DIR} 0x00 + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_3} ${REG_PORT0_POL} 0x00 + _util_i2cset -y -r ${I2C_BUS_MAIN} ${I2C_ADDR_MUX_9555_3} ${REG_PORT1_POL} 0x00 + + echo "Init System LED & HW ID IO Expander" + # I/O_0.x for System LED default 0, I/O_1.x for HW ID + _util_i2cset -y -r ${I2C_BUS_SYS_LED} ${I2C_ADDR_MUX_9539_0} ${REG_PORT0_OUT} 0x00 + # System LED => all output + _util_i2cset -y -r ${I2C_BUS_SYS_LED} ${I2C_ADDR_MUX_9539_0} ${REG_PORT0_DIR} 0x00 + # HW ID => all input + _util_i2cset -y -r ${I2C_BUS_SYS_LED} ${I2C_ADDR_MUX_9539_0} ${REG_PORT1_DIR} 0xFF + _util_i2cset -y -r ${I2C_BUS_SYS_LED} ${I2C_ADDR_MUX_9539_0} ${REG_PORT0_POL} 0x00 + _util_i2cset -y -r ${I2C_BUS_SYS_LED} ${I2C_ADDR_MUX_9539_0} ${REG_PORT1_POL} 0x00 + + echo "Init FAN Board Status IO Expander" + # LED_G_H set to 1, LED_Y_G set to 0 (ACTIVE_HIGH) + _util_i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9555_0} ${REG_PORT0_OUT} 0x11 + _util_i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9555_0} ${REG_PORT1_OUT} 0x11 + # DIR/ABS is input, LED_Y/LED_G is output + _util_i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9555_0} ${REG_PORT0_DIR} 0xCC + _util_i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9555_0} ${REG_PORT1_DIR} 0xCC + _util_i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9555_0} ${REG_PORT0_POL} 0x00 + _util_i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9555_0} ${REG_PORT1_POL} 0x00 + + echo "Init System SEL and RST IO Expander" + # default 0 (ACTIVE high) + # 0.4~0.5 SEL set to value 0 (host) + # 0.2 LED_CLR set to 0 will clear all switch LED bitmap, set to 1 here + _util_i2cset -y -r ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_2} ${REG_PORT0_OUT} 0x04 + # RST 1.6~1.7 default 1 (ACTIVE low), INT 1.0~1.4 default 1 (ACTIVE low) + _util_i2cset -y -r ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_2} ${REG_PORT1_OUT} 0xDF + # all output, but ISO_TF_CORE_RST_N 0.0 need to set as input to prevent reboot issue + _util_i2cset -y -r ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_2} ${REG_PORT0_DIR} 0x09 + # RST 1.6~1.7 output, rest are input + _util_i2cset -y -r ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_2} ${REG_PORT1_DIR} 0x3F + _util_i2cset -y -r ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_2} ${REG_PORT0_POL} 0x00 + _util_i2cset -y -r ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_2} ${REG_PORT1_POL} 0x00 + + echo "Init CPU CPLD IO Expander (FIXME)" + # all input + #echo "NUM_MUX_9546_1_CH3=${NUM_MUX_9546_1_CH3}, I2C_ADDR_MUX_9539_2=${I2C_ADDR_MUX_9539_2}" + #_util_i2cset -y -r ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_2} ${REG_PORT0_DIR} 0xFF + # all input + #_util_i2cset -y -r ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_2} ${REG_PORT1_DIR} 0xFF + #_util_i2cset -y -r ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_2} ${REG_PORT0_POL} 0x00 + #_util_i2cset -y -r ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_2} ${REG_PORT1_POL} 0x00 +} + +#Set FAN Tray LED +function _i2c_led_fan_tray_status_set { + echo "FAN Tray Status Setup" + #FAN Status get + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + + # check if io expander for fan tray exist + result=`i2cget -y ${I2C_BUS_FANTRAY_LED} ${I2C_ADDR_MUX_9555_0} ${REG_PORT0_IN} 2>/dev/null` + err_code=$? + if [ "$err_code" != "0" ]; then + echo "fan tray not exist!" + return + fi + + for FAN_TRAY in {1..4}; + do + FAN_ALARM="FAN${FAN_TRAY}_ALARM" + if [ "${!FAN_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + _i2c_fan_tray_led + + COLOR_LED="amber" + ONOFF_LED="off" + _i2c_fan_tray_led + + echo "set [FAN TRAY ${FAN_TRAY}] [Green]=on [Amber]=off" + else + COLOR_LED="green" + ONOFF_LED="off" + _i2c_fan_tray_led + + COLOR_LED="amber" + ONOFF_LED="on" + _i2c_fan_tray_led + + echo "set [FAN TRAY ${FAN_TRAY}] [Green]=off [Amber]=on" + fi + done +} + +#Set FAN LED +function _i2c_led_fan_status_set { + echo "FAN Status Setup" + #PSU Status set + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + + echo "led_fan setup..." + # all fan ok + if [ "${FAN1_ALARM}" == "0" ] \ + && [ "${FAN3_ALARM}" == "0" ] \ + && [ "${FAN5_ALARM}" == "0" ] \ + && [ "${FAN7_ALARM}" == "0" ]; then + COLOR_LED="green" + echo "${COLOR_LED}" + _i2c_fan_led + # all fan fail + elif [ "${FAN1_ALARM}" == "1" ] \ + && [ "${FAN3_ALARM}" == "1" ] \ + && [ "${FAN5_ALARM}" == "1" ] \ + && [ "${FAN7_ALARM}" == "1" ] ; then + COLOR_LED="amber" + echo "${COLOR_LED}" + _i2c_fan_led + # partial fan fail + else + COLOR_LED="amber" + echo "${COLOR_LED}" + _i2c_fan_led + fi + # if fan not present, no led need to be set +} + +#Set Power Supply LED +function _i2c_led_psu_status_set { + echo "PSU LED Status Setup" + + #PSU Status set + _i2c_psu_status + + #PSU1 Status + echo "led_psu1 setup..." + if [ "${psu1Exist}" == ${PSU_EXIST} ]; then + if [ "${psu1PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + echo "${COLOR_LED}" + _i2c_psu1_led + else + COLOR_LED="amber" + echo "${COLOR_LED}" + _i2c_psu1_led + fi + else + COLOR_LED="off" + echo "${COLOR_LED}" + _i2c_psu1_led + fi + + #PSU2 Status + echo "led_psu2 setup..." + if [ "${psu2Exist}" == ${PSU_EXIST} ]; then + if [ "${psu2PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + echo "${COLOR_LED}" + _i2c_psu2_led + else + COLOR_LED="amber" + echo "${COLOR_LED}" + _i2c_psu2_led + fi + else + COLOR_LED="off" + echo "${COLOR_LED}" + _i2c_psu2_led + fi +} + +#LED Test +function _i2c_led_test { + echo "=========================================================" + echo "# Description: I2C SYSTEM LED TEST..." + echo "=========================================================" + + #sys led (green) + COLOR_LED="green" + _i2c_sys_led + _pause 'Check SYS LED green light and Press [Enter] key to continue...' + #sys led (amber) + COLOR_LED="amber" + _i2c_sys_led + _pause 'Check SYS LED amber light and Press [Enter] key to continue...' + + #FAN led (green) + COLOR_LED="green" + _i2c_fan_led + _pause 'Check FAN LED green light and Press [Enter] key to continue...' + #FAN led (amber) + COLOR_LED="amber" + _i2c_fan_led + _pause 'Check FAN LED amber light and Press [Enter] key to continue...' + + #PSU1 led (green) + COLOR_LED="green" + _i2c_psu1_led + _pause 'Check PSU1 LED green light and Press [Enter] key to continue...' + #PSU1 led (amber) + COLOR_LED="amber" + _i2c_psu1_led + _pause 'Check PSU1 LED amber light and Press [Enter] key to continue...' + + #PSU2 led (green) + COLOR_LED="green" + _i2c_psu2_led + _pause 'Check PSU2 LED green light and Press [Enter] key to continue...' + #PSU2 led (amber) + COLOR_LED="amber" + _i2c_psu2_led + _pause 'Check PSU2 LED amber light and Press [Enter] key to continue...' + + #Turn OFF All LED (can't trun off system led) + COLOR_LED="off" + _i2c_sys_led + _i2c_fan_led + _i2c_psu1_led + _i2c_psu2_led + _pause 'Check turn off all LEDs (exclude SYS LED) and Press [Enter] key to continue...' + + # restore sys led + COLOR_LED="green" + _i2c_sys_led +} + +#Set QSFP Port cpld variable +function _qsfp_cpld_var_set { + local port=$1 + local reg_port_base + local reg_port_shift + + echo "_qsfp_cpld_var_set port=$port" + if [[ $1 -le 12 && $1 -ge 1 ]]; then + cpld_index=1 + reg_port_base=0 + elif [[ $1 -le 25 && $1 -ge 13 ]]; then + cpld_index=2 + reg_port_base=12 + elif [[ $1 -le 38 && $1 -ge 26 ]]; then + cpld_index=3 + reg_port_base=25 + elif [[ $1 -le 51 && $1 -ge 39 ]]; then + cpld_index=4 + reg_port_base=38 + elif [[ $1 -le 64 && $1 -ge 52 ]]; then + cpld_index=5 + reg_port_base=51 + else + echo "invalid port number" + fi + + cpld_port_index=$(( $port - $reg_port_base )) +} + +#Set QSFP Port eeporm variable +function _qsfp_eeprom_var_set { + local port=$1 + local eeprombusbase + local eeprombusshift + # port 1 => zqsfp0 + # port 2 => zqsfp1 + # ... + local port_group=$(( ($port - 1) / 8 )) + + case ${port_group} in + 0) + eeprombusbase=${NUM_MUX_9548_3_CH0} + ;; + 1) + eeprombusbase=${NUM_MUX_9548_4_CH0} + ;; + 2) + eeprombusbase=${NUM_MUX_9548_5_CH0} + ;; + 3) + eeprombusbase=${NUM_MUX_9548_6_CH0} + ;; + 4) + eeprombusbase=${NUM_MUX_9548_7_CH0} + ;; + 5) + eeprombusbase=${NUM_MUX_9548_8_CH0} + ;; + 6) + eeprombusbase=${NUM_MUX_9548_9_CH0} + ;; + 7) + eeprombusbase=${NUM_MUX_9548_10_CH0} + ;; + *) + ;; + esac + + eeprombusshift=$(( (${port} - 1) % 8)) + eepromBus=$(( ${eeprombusbase} + ${eeprombusshift} )) + eepromAddr=${I2C_ADDR_QSFP_EEPROM} +} + + +#Set SFP Port cpld variable +function _sfp_cpld_var_set { + local port=$1 + case ${port} in + 1) + cpld_index=1 + ;; + 2) + cpld_index=1 + ;; + *) + ;; + esac +} + +#Set QSFP Port eeporm variable +function _sfp_eeprom_var_set { + local port=$1 + + case ${port} in + 1) + eepromBus=${NUM_MUX_9546_1_CH0} + ;; + 2) + eepromBus=${NUM_MUX_9546_1_CH1} + ;; + *) + ;; + esac + + eepromAddr=${I2C_ADDR_SFP_EEPROM} +} + +#Get QSFP EEPROM Information +function _i2c_qsfp_eeprom_get { + local phy_port=0 + + # input parameter validation + _util_input_check ${QSFP_PORT} ${MIN_QSFP_PORT_NUM} ${MAX_QSFP_PORT_NUM} + + #get physical port + phy_port=$(_port_fp2phy $QSFP_PORT) + + _qsfp_eeprom_var_set ${phy_port} + + _util_get_qsfp_abs + + if [ $status = 0 ]; then + exit + fi + + # debug + echo "${PATH_SYS_I2C_DEVICES}/$eepromBus-$(printf '%04x' $eepromAddr)/eeprom | hexdump -C" + cat ${PATH_SYS_I2C_DEVICES}/$eepromBus-$(printf "%04x" $eepromAddr)/eeprom | hexdump -C +} + +#Init QSFP EEPROM +function _i2c_qsfp_eeprom_init { + echo "QSFP EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init 1-64 ports EEPROM + local i + for i in {1..64}; + do + + #get physical port + phy_port=$(_port_fp2phy $i) + + _qsfp_eeprom_var_set ${phy_port} + + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/$eepromBus-$(printf "%04x" $eepromAddr) ]; then + echo "sff8436 $eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eepromBus/new_device + #echo "optoe1 $eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eepromBus/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/$eepromBus-$(printf "%04x" $eepromAddr) ]; then + echo "$eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eepromBus/delete_device + fi + done + echo "Done" +} + +#Get SFP EEPROM Information +function _i2c_sfp_eeprom_get { + + # input parameter validation + _util_input_check ${SFP_PORT} ${MIN_SFP_PORT_NUM} ${MAX_SFP_PORT_NUM} + _util_get_sfp_pres + + if [ $status = 0 ]; then + exit + fi + + _sfp_eeprom_var_set ${SFP_PORT} + + cat ${PATH_SYS_I2C_DEVICES}/$eepromBus-$(printf "%04x" $eepromAddr)/eeprom | hexdump -C +} + +#Init SFP EEPROM +function _i2c_sfp_eeprom_init { + echo "SFP EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init 1-2 sfp+ EEPROM + local i + for i in {1..2}; + do + _sfp_eeprom_var_set ${i} + + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/$eepromBus-$(printf "%04x" $eepromAddr) ]; then + echo "sff8436 $eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eepromBus/new_device + #echo "optoe1 $eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eepromBus/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/$eepromBus-$(printf "%04x" $eepromAddr) ]; then + echo "$eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eepromBus/delete_device + fi + done + echo "Done" +} + +#Init Main Board EEPROM +function _i2c_mb_eeprom_init { + echo -n "Main Board EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init mb EEPROM + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/${I2C_BUS_MB_EEPROM}-$(printf "%04x" $I2C_ADDR_MB_EEPROM) ]; then + echo "mb_eeprom ${I2C_ADDR_MB_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_MB_EEPROM}/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/${I2C_BUS_MB_EEPROM}-$(printf "%04x" $I2C_ADDR_MB_EEPROM) ]; then + echo "$I2C_ADDR_MB_EEPROM" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_MB_EEPROM}/delete_device + fi + echo "Done" +} + +#Init CPU Board EEPROM +function _i2c_cb_eeprom_init { + echo -n "CPU Board EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init cpu EEPROM + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/${I2C_BUS_CB_EEPROM}-$(printf "%04x" $I2C_ADDR_CB_EEPROM) ]; then + echo "mb_eeprom ${I2C_ADDR_CB_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_CB_EEPROM}/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/${I2C_BUS_CB_EEPROM}-$(printf "%04x" $I2C_ADDR_CB_EEPROM) ]; then + echo "$I2C_ADDR_CB_EEPROM" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_CB_EEPROM}/delete_device + fi + echo "Done" +} + +#Init PSU Kernel Module +function _i2c_psu_init { + echo "=========================================================" + echo "# Description: I2C PSU Init" + echo "=========================================================" + modprobe ingrasys_s9280_64x_psu + + echo "psu1 ${I2C_ADDR_PSU1_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_PSU1_EEPROM}/new_device + echo "psu2 ${I2C_ADDR_PSU2_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_PSU2_EEPROM}/new_device +} + +#Deinit PSU Kernel Module +function _i2c_psu_deinit { + echo "${I2C_ADDR_PSU1_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_PSU1_EEPROM}/delete_device + echo "${I2C_ADDR_PSU2_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_PSU2_EEPROM}/delete_device + _util_rmmod ingrasys_s9280_64x_psu +} + +#get QSFP Status +function _i2c_qsfp_status_get { + + # input parameter validation + _util_input_check ${QSFP_PORT} ${MIN_QSFP_PORT_NUM} ${MAX_QSFP_PORT_NUM} + + local stat + _util_get_qsfp_abs + echo "status=$status" +} + +#get QSFP Type +function _i2c_qsfp_type_get { + local phy_port=0 + + phy_port=$(_port_fp2phy ${QSFP_PORT}) + + # input parameter validation + _util_input_check ${QSFP_PORT} ${MIN_QSFP_PORT_NUM} ${MAX_QSFP_PORT_NUM} + + _qsfp_eeprom_var_set ${phy_port} + + #Get QSFP EEPROM info + qsfp_info=$(base64 ${PATH_SYS_I2C_DEVICES}/$eepromBus-$(printf "%04x" $eepromAddr)/eeprom) + + identifier=$(echo $qsfp_info | base64 -d -i | hexdump -s 128 -n 1 -e '"%x"') + connector=$(echo $qsfp_info | base64 -d -i | hexdump -s 130 -n 1 -e '"%x"') + transceiver=$(echo $qsfp_info | base64 -d -i | hexdump -s 131 -n 1 -e '"%x"') + + echo "identifier=$identifier" + echo "connector=$connector" + echo "transceiver=$transceiver" +} + +function _i2c_sfp_status_get { + + # input parameter validation + _util_input_check ${SFP_PORT} ${MIN_SFP_PORT_NUM} ${MAX_SFP_PORT_NUM} + + local stat + _util_get_sfp_pres + #status: 0 -> Down, 1 -> Up + if [ $status = 0 ]; then + stat="down" + else + stat="up" + fi + echo "status is $stat" +} + +#get SFP Type +function _i2c_sfp_type_get { + + # input parameter validation + _util_input_check ${SFP_PORT} ${MIN_SFP_PORT_NUM} ${MAX_SFP_PORT_NUM} + + _sfp_eeprom_var_set ${SFP_PORT} + + #Get QSFP EEPROM info + sfp_info=$(base64 ${PATH_SYS_I2C_DEVICES}/$eepromBus-$(printf "%04x" $eepromAddr)/eeprom) + + identifier=$(echo $sfp_info | base64 -d -i | hexdump -s 128 -n 1 -e '"%x"') + connector=$(echo $sfp_info | base64 -d -i | hexdump -s 130 -n 1 -e '"%x"') + transceiver=$(echo $sfp_info | base64 -d -i | hexdump -s 131 -n 1 -e '"%x"') + + echo "identifier=$identifier" + echo "connector=$connector" + echo "transceiver=$transceiver" +} + +#Get PSU EEPROM Information +function _i2c_psu_eeprom_get { + local eeprom_psu1="" + local eeprom_psu2="" + + echo "=========================================================" + echo "# Description: I2C PSU EEPROM Get..." + echo "=========================================================" + + eeprom_psu1="${PATH_SYSFS_PSU1}/psu_eeprom" + cat ${eeprom_psu1} | hexdump -C + + eeprom_psu2="${PATH_SYSFS_PSU2}/psu_eeprom" + cat ${eeprom_psu2} | hexdump -C +} + +#Get Main Board EEPROM Information +function _i2c_mb_eeprom_get { + echo "=========================================================" + echo "# Description: I2C MB EEPROM Get..." + echo "=========================================================" + _i2c_sys_eeprom_get mb +} + +#Get CPU Board EEPROM Information +function _i2c_cb_eeprom_get { + echo "=========================================================" + echo "# Description: I2C CB EEPROM Get..." + echo "=========================================================" + _i2c_sys_eeprom_get cb +} + +#Get system EEPROM Information +##input: "cb" for cpu board, "mb" for main board +function _i2c_sys_eeprom_get { + local eeprom_dev + + if [ "$1" == "cb" ]; then + eeprom_dev="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_CB_EEPROM}-$(printf "%04x" $I2C_ADDR_CB_EEPROM)/eeprom" + elif [ "$1" == "mb" ]; then + eeprom_dev="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_MB_EEPROM}-$(printf "%04x" $I2C_ADDR_MB_EEPROM)/eeprom" + else + echo "wrong eeprom type" + return + fi + + # check if eeprom device exist in sysfs + if [ ! -f ${eeprom_dev} ]; then + echo "eeprom device not init" + return + fi + + cat ${eeprom_dev} | hexdump -C + echo "Done" +} + +#sync eeprom content between mb and cb eeprom +function _i2c_eeprom_sync { + echo "=========================================================" + echo "# Description: EEPROM sync..." + echo "=========================================================" + + local mb_eeprom_dev="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_MB_EEPROM}-$(printf "%04x" $I2C_ADDR_MB_EEPROM)/eeprom" + local cb_eeprom_dev="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_CB_EEPROM}-$(printf "%04x" $I2C_ADDR_CB_EEPROM)/eeprom" + + # check if eeprom device exist in sysfs + if [[ ! -f ${mb_eeprom_dev} || ! -f ${cb_eeprom_dev} ]]; then + echo "eeprom device not init" + return + fi + + ## check if MB eeprom is empty + if [ ! -z "$(cat ${mb_eeprom_dev} | hexdump -n2 | grep ffff)" ]; then + echo "copy cb eeprom to mb eeprom..." + cat ${cb_eeprom_dev} > ${mb_eeprom_dev} + else + echo "no need to sync" + fi + + echo "Done" +} + +#Set System Status LED +function _i2c_sys_led { + # only green/amber, on/off can't control + if [ "${COLOR_LED}" == "green" ]; then + # set sys_led_g (0.7) = 1 + output_reg=${REG_PORT0_OUT} + mask=0x80 + value=0x80 + elif [ "${COLOR_LED}" == "amber" ]; then + # set sys_led_g (0.7) = 0 + output_reg=${REG_PORT0_OUT} + mask=0x80 + value=0x00 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + #apply to io expander + _util_i2cset -m ${mask} -y ${I2C_BUS_SYS_LED} ${I2C_ADDR_MUX_9539_0} ${output_reg} ${value} + echo "Done" +} + +#Set FAN LED +function _i2c_fan_led { + if [ "${COLOR_LED}" == "green" ]; then + # set fan_led_en (0.6) = 1 & fan_led_y (0.5) = 0 + output_reg=${REG_PORT0_OUT} + mask=0x60 + value=0x40 + elif [ "${COLOR_LED}" == "amber" ]; then + # set fan_led_en (0.6) = 1 & fan_led_y (0.5) = 1 + output_reg=${REG_PORT0_OUT} + mask=0x60 + value=0x60 + elif [ "${COLOR_LED}" == "off" ]; then + # set fan_led_en (0.6) = 0 & fan_led_y (0.5) = 0 + output_reg=${REG_PORT0_OUT} + mask=0x60 + value=0x00 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + #apply to io expander + _util_i2cset -m ${mask} -y ${I2C_BUS_SYS_LED} ${I2C_ADDR_MUX_9539_0} ${output_reg} ${value} + echo "Done" +} + +#Set PSU1 LED +function _i2c_psu1_led { + if [ "${COLOR_LED}" == "green" ]; then + # set psu1_pwr_ok_oe (0.4) = 1 & psu1_led_y (0.3) = 0 + output_reg=${REG_PORT0_OUT} + mask=0x18 + value=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + # set psu1_pwr_ok_oe (0.4) = 1 & psu1_led_y (0.3) = 1 + output_reg=${REG_PORT0_OUT} + mask=0x18 + value=0x18 + elif [ "${COLOR_LED}" == "off" ]; then + # set psu1_pwr_ok_oe (0.4) = 0 & psu1_led_y (0.3) = 0 + output_reg=${REG_PORT0_OUT} + mask=0x18 + value=0x00 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + #apply to io expander + _util_i2cset -m ${mask} -y ${I2C_BUS_SYS_LED} ${I2C_ADDR_MUX_9539_0} ${output_reg} ${value} + echo "Done" +} + +#Set PSU2 LED +function _i2c_psu2_led { + if [ "${COLOR_LED}" == "green" ]; then + # set psu0_pwr_ok_oe (0.2) = 1 & psu0_led_y (0.1) = 0 + output_reg=${REG_PORT0_OUT} + mask=0x06 + value=0x04 + elif [ "${COLOR_LED}" == "amber" ]; then + # set psu0_pwr_ok_oe (0.2) = 1 & psu0_led_y (0.1) = 1 + output_reg=${REG_PORT0_OUT} + mask=0x06 + value=0x06 + elif [ "${COLOR_LED}" == "off" ]; then + # set psu0_pwr_ok_oe (0.2) = 0 & psu0_led_y (0.1) = 0 + output_reg=${REG_PORT0_OUT} + mask=0x06 + value=0x00 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + #apply to io expander + _util_i2cset -m ${mask} -y ${I2C_BUS_SYS_LED} ${I2C_ADDR_MUX_9539_0} ${output_reg} ${value} + echo "Done" +} + +#Set FAN Tray LED +function _i2c_fan_tray_led { + + i2cAddr=${I2C_ADDR_MUX_9555_0} + output_reg=${REG_PORT0_OUT} + + case ${FAN_TRAY} in + 1) + output_reg=${REG_PORT0_OUT} + if [ "${COLOR_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 2) + output_reg=${REG_PORT0_OUT} + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + 3) + output_reg=${REG_PORT1_OUT} + if [ "${COLOR_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 4) + output_reg=${REG_PORT1_OUT} + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + *) + echo "Please input 1~4" + exit + ;; + esac + + # LED PIN value is ACTIVE HIGH + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + _util_i2cset -m $mask -y -r ${I2C_BUS_FANTRAY_LED} $i2cAddr ${output_reg} 0xff + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + _util_i2cset -m $mask -y -r ${I2C_BUS_FANTRAY_LED} $i2cAddr ${output_reg} 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + _util_i2cset -m $mask -y -r ${I2C_BUS_FANTRAY_LED} $i2cAddr ${output_reg} 0xff + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + _util_i2cset -m $mask -y -r ${I2C_BUS_FANTRAY_LED} $i2cAddr ${output_reg} 0x00 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "Done" +} + +#Get Board Version and Type +function _i2c_board_type_get { + # read input port 1 value from io expander + input_reg=${REG_PORT1_IN} + boardType=`i2cget -y ${I2C_BUS_HW_ID} ${I2C_ADDR_MUX_9539_0} ${input_reg}` + boardBuildRev=$((($boardType) & 0x03)) + boardHwRev=$((($boardType) >> 2 & 0x03)) + boardId=$((($boardType) >> 4)) + printf "MAIN_BOARD BOARD_ID is 0x%02x, HW Rev 0x%02x, Build Rev 0x%02x\n" $boardId $boardHwRev $boardBuildRev +} + +#Get BMC Board Version and Type +function _i2c_bmc_board_type_get { + # read input port 1 value from io expander + input_reg=${REG_PORT1_IN} + boardType=`i2cget -y ${I2C_BUS_BMC_HW_ID} ${I2C_ADDR_MUX_9555_1} ${input_reg}` + boardBuildRev=$((($boardType) & 0x03)) + boardHwRev=$((($boardType) >> 2 & 0x03)) + boardId=$((($boardType) >> 4)) + printf "BMC_BOARD BOARD_ID is 0x%02x, HW Rev 0x%02x, Build Rev 0x%02x\n" $boardId $boardHwRev $boardBuildRev +} + +#Get CPLD Version +function _i2c_cpld_version { + echo "=========================================================" + echo "# Description: CPLD Version" + echo "=========================================================" + + for i in {1..5}; + do + local cpld_bus="I2C_BUS_CPLD${i}" + local cpld_path="PATH_CPLD${i}_DEVICE" + local file_path="${PATH_SYS_I2C_DEVICES}/${!cpld_bus}-$(printf "%04x" ${I2C_ADDR_CPLD})/cpld_version" + printf "[CPLD %d] %s\n" ${i} $(cat ${file_path}) + done +} + +#Get PSU Status +function _i2c_psu_status { + local psu_abs="" + + psu1PwGood=`cat ${PATH_SYSFS_PSU1}/psu_pg` + psu_abs=`cat ${PATH_SYSFS_PSU1}/psu_abs` + if [ "$psu_abs" == "0" ]; then + psu1Exist=1 + else + psu1Exist=0 + fi + + psu2PwGood=`cat ${PATH_SYSFS_PSU2}/psu_pg` + psu_abs=`cat ${PATH_SYSFS_PSU2}/psu_abs` + if [ "$psu_abs" == "0" ]; then + psu2Exist=1 + else + psu2Exist=0 + fi + + printf "PSU1 Exist:%x PSU1 PW Good:%d\n" $psu1Exist $psu1PwGood + printf "PSU2 Exist:%d PSU2 PW Good:%d\n" $psu2Exist $psu2PwGood +} + +#Get register value from CPLD +function _i2c_cpld_reg_read { + local idx=$1 + local file_name=$2 + local cpld_i2c_addr=${I2C_ADDR_CPLD} + local reg_file_path + + case ${idx} in + 1) + cpld_i2c_bus=${I2C_BUS_CPLD1} + ;; + 2) + cpld_i2c_bus=${I2C_BUS_CPLD2} + ;; + 3) + cpld_i2c_bus=${I2C_BUS_CPLD3} + ;; + 4) + cpld_i2c_bus=${I2C_BUS_CPLD4} + ;; + 5) + cpld_i2c_bus=${I2C_BUS_CPLD5} + ;; + *) + echo "invalid cpld index" + exit + ;; + esac + + reg_file_path="${PATH_SYS_I2C_DEVICES}/${cpld_i2c_bus}-$(printf "%04x" ${cpld_i2c_addr})/${file_name}" + cpld_reg_val=`cat ${reg_file_path}` + # TODO: debug + echo "cat ${reg_file_path} => ${cpld_reg_val}" +} + +#util functions +function _util_i2cset { + if [ "$DEBUG" == "on" ]; then + i2cset $@ + else + i2cset $@ 1>/dev/null + fi +} + +function _i2c_set { + local i2c_bus=$1 + local i2c_addr=$2 + local reg=$3 + local mask=$4 + local value=$5 + + echo `i2cset -m $mask -y -r ${i2c_bus} ${i2c_addr} ${reg} ${value}` +} + +function _util_rmmod { + local mod=$1 + [ "$(lsmod | grep "^$mod ")" != "" ] && rmmod $mod +} + +# get qsfp presence +function _util_get_qsfp_abs { + local phy_port=0 + + #get physical port + phy_port=$(_port_fp2phy $QSFP_PORT) + + echo "fp port $QSFP_PORT => phy port $phy_port" + # read status from cpld + _qsfp_cpld_var_set ${phy_port} + cpld_reg_file_name="${CPLD_QSFP_STATUS_KEY}_${cpld_port_index}" + _i2c_cpld_reg_read ${cpld_index} ${cpld_reg_file_name} + #status: 0 -> Down, 1 -> Up (ACTIVE_LOW in ABS_BIT) + status=$(( $(( $((${cpld_reg_val})) & (1 << ($CPLD_QSFP_STATUS_ABS_BIT)) ))?0:1 )) +} + +# get sfp presence +function _util_get_sfp_pres { + local pres_bit + # read status from cpld + _sfp_cpld_var_set ${SFP_PORT} + cpld_reg_file_name="${CPLD_SFP_STATUS_KEY}" + _i2c_cpld_reg_read ${cpld_index} ${cpld_reg_file_name} + if [ "${SFP_PORT}" == "1" ]; then + pres_bit=${CPLD_SFP0_STATUS_PRES_BIT} + else + pres_bit=${CPLD_SFP1_STATUS_PRES_BIT} + fi + #status: 0 -> Down, 1 -> Up (ACTIVE_LOW in PRES_BIT) + status=$(( $(( $((${cpld_reg_val})) & (1 << ($pres_bit)) ))?0:1 )) +} + +# valid input number +function _util_input_check { + # input parameter validation + if [[ $1 -lt $2 || $1 -gt $3 ]]; then + echo "Please input number $2~$3" + exit + fi +} + +# clear all switch port led bitmap +function _util_port_led_clear { + echo "port led clear..." + # gpio pin on GPIO MUX PCA9539#1 I/O 0.2 + # pull low to reset bitamp + output_reg=${REG_PORT0_OUT} + mask=0x04 + value=0x00 + _util_i2cset -m ${mask} -y ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_1} ${output_reg} ${value} + sleep 1 + # pull high to out of reset + value=0xFF + _util_i2cset -m ${mask} -y ${NUM_MUX_9546_1_CH3} ${I2C_ADDR_MUX_9539_1} ${output_reg} ${value} + echo "Done" +} + +#Increase read socket buffer for CoPP Test +function _config_rmem { + echo "109430400" > /proc/sys/net/core/rmem_max +} + +#Main Function +function _main { + tart_time_str=`date` + start_time_sec=$(date +%s) + + if [ "${EXEC_FUNC}" == "help" ]; then + _help + elif [ "${EXEC_FUNC}" == "i2c_init" ]; then + _i2c_init + elif [ "${EXEC_FUNC}" == "i2c_deinit" ]; then + _i2c_deinit + elif [ "${EXEC_FUNC}" == "i2c_fan_speed_init" ]; then + _i2c_fan_speed_init + elif [ "${EXEC_FUNC}" == "i2c_io_exp_init" ]; then + _i2c_io_exp_init + elif [ "${EXEC_FUNC}" == "i2c_led_test" ]; then + _i2c_led_test + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_get" ]; then + _i2c_mb_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_cb_eeprom_get" ]; then + _i2c_cb_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_eeprom_sync" ]; then + _i2c_eeprom_sync + elif [ "${EXEC_FUNC}" == "i2c_psu_eeprom_get" ]; then + _i2c_psu_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_get" ]; then + _i2c_qsfp_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_sfp_eeprom_get" ]; then + _i2c_sfp_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_init" ]; then + _i2c_qsfp_eeprom_init ${QSFP_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_sfp_eeprom_init" ]; then + _i2c_sfp_eeprom_init ${SFP_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_init" ]; then + _i2c_mb_eeprom_init ${MB_EEPROM_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_cb_eeprom_init" ]; then + _i2c_cb_eeprom_init ${MB_EEPROM_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_qsfp_status_get" ]; then + _i2c_qsfp_status_get + elif [ "${EXEC_FUNC}" == "i2c_sfp_status_get" ]; then + _i2c_sfp_status_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_type_get" ]; then + _i2c_qsfp_type_get + elif [ "${EXEC_FUNC}" == "i2c_sfp_type_get" ]; then + _i2c_sfp_type_get + elif [ "${EXEC_FUNC}" == "i2c_led_psu_status_set" ]; then + _i2c_led_psu_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_status_set" ]; then + _i2c_led_fan_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_tray_status_set" ]; then + _i2c_led_fan_tray_status_set + elif [ "${EXEC_FUNC}" == "i2c_sys_led" ]; then + _i2c_sys_led + elif [ "${EXEC_FUNC}" == "i2c_fan_led" ]; then + _i2c_fan_led + elif [ "${EXEC_FUNC}" == "i2c_fan_tray_led" ]; then + _i2c_fan_tray_led + elif [ "${EXEC_FUNC}" == "i2c_psu1_led" ]; then + _i2c_psu1_led + elif [ "${EXEC_FUNC}" == "i2c_psu2_led" ]; then + _i2c_psu2_led + elif [ "${EXEC_FUNC}" == "i2c_board_type_get" ]; then + _i2c_board_type_get + elif [ "${EXEC_FUNC}" == "i2c_bmc_board_type_get" ]; then + _i2c_bmc_board_type_get + elif [ "${EXEC_FUNC}" == "i2c_cpld_version" ]; then + _i2c_cpld_version + elif [ "${EXEC_FUNC}" == "i2c_psu_status" ]; then + _i2c_psu_status + elif [ "${EXEC_FUNC}" == "i2c_test_all" ]; then + _i2c_init + _i2c_led_test + _i2c_psu_eeprom_get + _i2c_mb_eeprom_get + _i2c_cb_eeprom_get + _i2c_board_type_get + _i2c_bmc_board_type_get + _i2c_cpld_version + _i2c_psu_status + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + if [ "$DEBUG" == "on" ]; then + echo "-----------------------------------------------------" + end_time_str=`date` + end_time_sec=$(date +%s) + diff_time=$[ ${end_time_sec} - ${start_time_sec} ] + echo "Start Time: ${start_time_str} (${start_time_sec})" + echo "End Time : ${end_time_str} (${end_time_sec})" + echo "Total Execution Time: ${diff_time} sec" + + echo "done!!!" + fi +} + +_main diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/qsfp_monitor.sh b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/qsfp_monitor.sh new file mode 100755 index 000000000000..23a3fd066bee --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/qsfp_monitor.sh @@ -0,0 +1,105 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=3 +I2C_UTILS="/usr/sbin/i2c_utils.sh" +QSFP_SI_SCRIPT="/usr/sbin/qsfp_si_cfg.sh" +QSFP_ARRAY=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + +#QSFP SI monitor +function _qsfp_si_monitor { + local i + local status + for i in {0..63}; + do + status=`${I2C_UTILS} i2c_qsfp_status_get $(expr $i + 1) | egrep '^status=.*$' | sed -e 's/status=//g'` + if [ "${status}" == "1" ]; then + _qsfp_type_check $i + fi + done +} + +#QSFP type +function _qsfp_type_check { + local port=$1 + local qsfp_type=`${I2C_UTILS} i2c_qsfp_type_get $(expr $port + 1)` + local identifier=`echo "$qsfp_type" | grep '^identifier=.*$' | sed -e 's/identifier=//g'` + if [ "${identifier}" == "11" ]; then + connector=`echo "$qsfp_type" | grep '^connector=.*$' | sed -e 's/connector=//g'` + case ${connector} in + 21|23) + #DAC + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to DAC" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} dac $port >/dev/null + fi + ;; + *) + #Optical + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to Optical" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} optical $port >/dev/null + fi + ;; + esac + fi +} + +#Docker exist check +function _docker_swss_check { + while true + do + # Check if syncd starts + result=`docker exec -i swss bash -c "echo -en \"SELECT 1\\nHLEN HIDDEN\" | redis-cli | sed -n 2p"` #TBD FIX ME + if [ "$result" == "3" ]; then + return + fi + sleep $INTERVAL + done +} + +#Docker exist check +function _qsfp_si_cfg_script_check { + + if [ -f ${QSFP_SI_SCRIPT} ] && [ -x ${QSFP_SI_SCRIPT} ]; then + echo "SI Script exists. Start monitor." + return + else + echo "SI Script not exist. Exit monitor." + exit + fi +} + +# main function +function _main { + #Check SI Script + _qsfp_si_cfg_script_check + #Check docker swss is running + _docker_swss_check + while true + do + _qsfp_si_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main + diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/s9280_64x_monitor.sh b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/s9280_64x_monitor.sh new file mode 100755 index 000000000000..eedf685b290b --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-ingrasys/s9280-64x/utils/s9280_64x_monitor.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=5 +I2C_UTILS="/usr/sbin/i2c_utils.sh" + + +# TBD: LED status monitor +function _led_monitor { + ${I2C_UTILS} i2c_led_fan_status_set >/dev/null + ${I2C_UTILS} i2c_led_psu_status_set >/dev/null + ${I2C_UTILS} i2c_led_fan_tray_status_set >/dev/null +} + +# main function +function _main { + while true + do + #PSU controlled by dummy board, + #but fan LED and fan tray LED must controlled by this service + _led_monitor + + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main From a215bcd8f1cdbfe27ad808817cce5c12a12e7d4b Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Fri, 3 Aug 2018 07:53:30 +0800 Subject: [PATCH 1447/1833] [mlnx-sfp-plugin] enhancement to support transceiver sensor monitoring (#1839) * [mlnx-sfpplugin] enhancement to support tranceiver sensor monitoring * Modify the eeprom folder to make it accessably from pmon container * implement the get_transceiver_change_event API file change list modified: device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py modified: device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py modified: device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py modified: device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py modified: device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py signed-off-by Liu Kebo kebol@mellanox.com * remove commented code * revise the get_transceiver_change_event implementation and remove unused function * remove blank --- .../plugins/sfputil.py | 43 ++++++++++++++++- .../x86_64-mlnx_msn2100-r0/plugins/sfputil.py | 43 ++++++++++++++++- .../x86_64-mlnx_msn2410-r0/plugins/sfputil.py | 48 +++++++++++++++++-- .../x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 43 ++++++++++++++++- .../x86_64-mlnx_msn2740-r0/plugins/sfputil.py | 43 ++++++++++++++++- 5 files changed, 208 insertions(+), 12 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py index 6aef1310d51f..2eb3d628ff9f 100644 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py @@ -10,10 +10,13 @@ except ImportError as e: raise ImportError("%s - required module not found" % str(e)) +# parameters for DB connection +REDIS_HOSTNAME = "localhost" +REDIS_PORT = 6379 +REDIS_TIMEOUT_USECS = 0 class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" - PORT_START = 0 PORT_END = 31 PORTS_IN_BLOCK = 32 @@ -22,6 +25,12 @@ class SfpUtil(SfpUtilBase): _port_to_eeprom_mapping = {} + db_sel = None + db_sel_timeout = None + db_sel_object = None + db_sel_tbl = None + state_db = None + @property def port_start(self): return self.PORT_START @@ -39,7 +48,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/bsp/qsfp/qsfp{0}" + eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon7/qsfp{0}_eeprom" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) @@ -149,3 +158,33 @@ def reset(self, port_num): return False return False + + def get_transceiver_change_event(self, timeout=0): + phy_port_dict = {} + status = True + + if self.db_sel == None: + from swsscommon import swsscommon + self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, + REDIS_HOSTNAME, + REDIS_PORT, + REDIS_TIMEOUT_USECS) + + # Subscribe to state table for SFP change notifications + self.db_sel = swsscommon.Select() + self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') + self.db_sel.addSelectable(self.db_sel_tbl) + self.db_sel_timeout = swsscommon.Select.TIMEOUT + self.db_sel_object = swsscommon.Select.OBJECT + + (state, c) = self.db_sel.select(timeout) + if state == self.db_sel_timeout: + status = True + elif state != self.db_sel_object: + status = False + else: + (key, op, fvp) = self.db_sel_tbl.pop() + phy_port_dict[key] = op + + return status, phy_port_dict + diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py index 4a7b063ac608..631a6b774fb3 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py @@ -10,10 +10,13 @@ except ImportError as e: raise ImportError("%s - required module not found" % str(e)) +# parameters for DB connection +REDIS_HOSTNAME = "localhost" +REDIS_PORT = 6379 +REDIS_TIMEOUT_USECS = 0 class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" - PORT_START = 0 PORT_END = 15 PORTS_IN_BLOCK = 16 @@ -22,6 +25,12 @@ class SfpUtil(SfpUtilBase): _port_to_eeprom_mapping = {} + db_sel = None + db_sel_timeout = None + db_sel_object = None + db_sel_tbl = None + state_db = None + @property def port_start(self): return self.PORT_START @@ -39,7 +48,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/bsp/qsfp/qsfp{0}" + eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon4/qsfp{0}_eeprom" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) @@ -149,3 +158,33 @@ def reset(self, port_num): return False return False + + def get_transceiver_change_event(self, timeout=0): + phy_port_dict = {} + status = True + + if self.db_sel == None: + from swsscommon import swsscommon + self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, + REDIS_HOSTNAME, + REDIS_PORT, + REDIS_TIMEOUT_USECS) + + # Subscribe to state table for SFP change notifications + self.db_sel = swsscommon.Select() + self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') + self.db_sel.addSelectable(self.db_sel_tbl) + self.db_sel_timeout = swsscommon.Select.TIMEOUT + self.db_sel_object = swsscommon.Select.OBJECT + + (state, c) = self.db_sel.select(timeout) + if state == self.db_sel_timeout: + status = True + elif state != self.db_sel_object: + status = False + else: + (key, op, fvp) = self.db_sel_tbl.pop() + phy_port_dict[key] = op + + return status, phy_port_dict + diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py index d9699aca45a6..c379155b82e7 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py @@ -10,18 +10,27 @@ except ImportError as e: raise ImportError("%s - required module not found" % str(e)) +# parameters for DB connection +REDIS_HOSTNAME = "localhost" +REDIS_PORT = 6379 +REDIS_TIMEOUT_USECS = 0 class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" - PORT_START = 0 PORT_END = 55 PORTS_IN_BLOCK = 56 - + QSFP_PORT_START = 48 EEPROM_OFFSET = 1 _port_to_eeprom_mapping = {} + db_sel = None + db_sel_timeout = None + db_sel_object = None + db_sel_tbl = None + state_db = None + @property def port_start(self): return self.PORT_START @@ -32,20 +41,21 @@ def port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/bsp/qsfp/qsfp{0}" + eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon6/qsfp{0}_eeprom" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) SfpUtilBase.__init__(self) + def get_presence(self, port_num): # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: @@ -149,3 +159,33 @@ def reset(self, port_num): return False return False + + def get_transceiver_change_event(self, timeout=0): + phy_port_dict = {} + status = True + + if self.db_sel == None: + from swsscommon import swsscommon + self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, + REDIS_HOSTNAME, + REDIS_PORT, + REDIS_TIMEOUT_USECS) + + # Subscribe to state table for SFP change notifications + self.db_sel = swsscommon.Select() + self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') + self.db_sel.addSelectable(self.db_sel_tbl) + self.db_sel_timeout = swsscommon.Select.TIMEOUT + self.db_sel_object = swsscommon.Select.OBJECT + + (state, c) = self.db_sel.select(timeout) + if state == self.db_sel_timeout: + status = True + elif state != self.db_sel_object: + status = False + else: + (key, op, fvp) = self.db_sel_tbl.pop() + phy_port_dict[key] = op + + return status, phy_port_dict + 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 6aef1310d51f..2eb3d628ff9f 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -10,10 +10,13 @@ except ImportError as e: raise ImportError("%s - required module not found" % str(e)) +# parameters for DB connection +REDIS_HOSTNAME = "localhost" +REDIS_PORT = 6379 +REDIS_TIMEOUT_USECS = 0 class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" - PORT_START = 0 PORT_END = 31 PORTS_IN_BLOCK = 32 @@ -22,6 +25,12 @@ class SfpUtil(SfpUtilBase): _port_to_eeprom_mapping = {} + db_sel = None + db_sel_timeout = None + db_sel_object = None + db_sel_tbl = None + state_db = None + @property def port_start(self): return self.PORT_START @@ -39,7 +48,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/bsp/qsfp/qsfp{0}" + eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon7/qsfp{0}_eeprom" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) @@ -149,3 +158,33 @@ def reset(self, port_num): return False return False + + def get_transceiver_change_event(self, timeout=0): + phy_port_dict = {} + status = True + + if self.db_sel == None: + from swsscommon import swsscommon + self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, + REDIS_HOSTNAME, + REDIS_PORT, + REDIS_TIMEOUT_USECS) + + # Subscribe to state table for SFP change notifications + self.db_sel = swsscommon.Select() + self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') + self.db_sel.addSelectable(self.db_sel_tbl) + self.db_sel_timeout = swsscommon.Select.TIMEOUT + self.db_sel_object = swsscommon.Select.OBJECT + + (state, c) = self.db_sel.select(timeout) + if state == self.db_sel_timeout: + status = True + elif state != self.db_sel_object: + status = False + else: + (key, op, fvp) = self.db_sel_tbl.pop() + phy_port_dict[key] = op + + return status, phy_port_dict + diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py index 6aef1310d51f..d617135e3e89 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py @@ -10,10 +10,13 @@ except ImportError as e: raise ImportError("%s - required module not found" % str(e)) +# parameters for DB connection +REDIS_HOSTNAME = "localhost" +REDIS_PORT = 6379 +REDIS_TIMEOUT_USECS = 0 class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" - PORT_START = 0 PORT_END = 31 PORTS_IN_BLOCK = 32 @@ -22,6 +25,12 @@ class SfpUtil(SfpUtilBase): _port_to_eeprom_mapping = {} + db_sel = None + db_sel_timeout = None + db_sel_object = None + db_sel_tbl = None + state_db = None + @property def port_start(self): return self.PORT_START @@ -39,7 +48,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/bsp/qsfp/qsfp{0}" + eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon6/qsfp{0}_eeprom" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) @@ -149,3 +158,33 @@ def reset(self, port_num): return False return False + + def get_transceiver_change_event(self, timeout=0): + phy_port_dict = {} + status = True + + if self.db_sel == None: + from swsscommon import swsscommon + self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, + REDIS_HOSTNAME, + REDIS_PORT, + REDIS_TIMEOUT_USECS) + + # Subscribe to state table for SFP change notifications + self.db_sel = swsscommon.Select() + self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') + self.db_sel.addSelectable(self.db_sel_tbl) + self.db_sel_timeout = swsscommon.Select.TIMEOUT + self.db_sel_object = swsscommon.Select.OBJECT + + (state, c) = self.db_sel.select(timeout) + if state == self.db_sel_timeout: + status = True + elif state != self.db_sel_object: + status = False + else: + (key, op, fvp) = self.db_sel_tbl.pop() + phy_port_dict[key] = op + + return status, phy_port_dict + From 38beca654c678dafe4399d208addf2b1a51a4c5d Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sat, 4 Aug 2018 07:33:56 +0800 Subject: [PATCH 1448/1833] [docker-platform-monitor] make file and supervisord conf change for new xcvrd deamon (#1840) * [docker-platform-monitor] make file and supervisord conf change for new xcvrd deamon * make file change for the new daemon * supervisord conf change for the new daemon signed-off-by Liu Kebo kebol@mellanox.com * make xcvrd start sequence aligned with the supervisord conf * update submodules to include xcvrd modification --- dockers/docker-platform-monitor/start.sh | 2 ++ dockers/docker-platform-monitor/supervisord.conf | 9 +++++++++ rules/docker-platform-monitor.mk | 2 +- rules/sonic-xcvrd.mk | 5 +++++ src/sonic-platform-daemons | 2 +- 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 rules/sonic-xcvrd.mk diff --git a/dockers/docker-platform-monitor/start.sh b/dockers/docker-platform-monitor/start.sh index b4023c16367a..30699694b6d2 100755 --- a/dockers/docker-platform-monitor/start.sh +++ b/dockers/docker-platform-monitor/start.sh @@ -26,3 +26,5 @@ if [ -e /usr/share/sonic/platform/fancontrol ]; then fi supervisorctl start ledd + +supervisorctl start xcvrd diff --git a/dockers/docker-platform-monitor/supervisord.conf b/dockers/docker-platform-monitor/supervisord.conf index 13790d70f614..aa947ce2c9ae 100644 --- a/dockers/docker-platform-monitor/supervisord.conf +++ b/dockers/docker-platform-monitor/supervisord.conf @@ -45,3 +45,12 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog startsecs=0 + +[program:xcvrd] +command=/usr/bin/xcvrd +priority=6 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog +startsecs=0 diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 00b4d48687cd..d6404e18c47f 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -2,7 +2,7 @@ DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor -$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(SONIC_LEDD) +$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(SONIC_LEDD) $(SONIC_XCVRD) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) diff --git a/rules/sonic-xcvrd.mk b/rules/sonic-xcvrd.mk new file mode 100644 index 000000000000..b97f8dd11b79 --- /dev/null +++ b/rules/sonic-xcvrd.mk @@ -0,0 +1,5 @@ +# sonic-xcvrd (SONiC Transceiver monitoring daemon) Debian package + +SONIC_XCVRD = python-sonic-xcvrd_1.0-1_all.deb +$(SONIC_XCVRD)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-xcvrd +SONIC_PYTHON_STDEB_DEBS += $(SONIC_XCVRD) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index ce83d58b0aff..b1b9169bf4cf 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit ce83d58b0afffaa3e0b9d57686c814a2b5fd771e +Subproject commit b1b9169bf4cf5b3d0e4778dc51c03b99b15c0c6b From c822b3c75d87ea9bc7ee6c9b42d82008a102198d Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Fri, 3 Aug 2018 16:34:27 -0700 Subject: [PATCH 1449/1833] Update arista driver submodule (#1900) Includes changes to enable interrupt handling. --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 98b983c32da2..8f65ad92c5b5 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 98b983c32da28eaf35f9991d6dc1f6aca00d9335 +Subproject commit 8f65ad92c5b5dfec24e8faf068cc9d2374244edf diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 98b983c32da2..8f65ad92c5b5 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 98b983c32da28eaf35f9991d6dc1f6aca00d9335 +Subproject commit 8f65ad92c5b5dfec24e8faf068cc9d2374244edf From 75361042f53c1cbbdad01a2d12e36598cf1e8626 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 4 Aug 2018 21:19:29 -0700 Subject: [PATCH 1450/1833] [device]: add support for celestica E1031 (#1528) --- .../Celestica-E1031-T48S4/port_config.ini | 53 ++ .../Celestica-E1031-T48S4/sai.profile | 1 + .../x86_64-cel_e1031-r0/installer.conf | 3 + .../x86_64-cel_e1031-r0/minigraph.xml | 810 ++++++++++++++++++ platform/broadcom/sai.mk | 8 +- 5 files changed, 871 insertions(+), 4 deletions(-) create mode 100644 device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/port_config.ini create mode 100644 device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/sai.profile create mode 100644 device/celestica/x86_64-cel_e1031-r0/installer.conf create mode 100644 device/celestica/x86_64-cel_e1031-r0/minigraph.xml diff --git a/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/port_config.ini b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/port_config.ini new file mode 100644 index 000000000000..6a7debfa45f6 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/port_config.ini @@ -0,0 +1,53 @@ +# name lanes speed alias autoneg +Ethernet0 2 1000 etp1 1 +Ethernet1 1 1000 etp2 1 +Ethernet2 4 1000 etp3 1 +Ethernet3 3 1000 etp4 1 +Ethernet4 6 1000 etp5 1 +Ethernet5 5 1000 etp6 1 +Ethernet6 8 1000 etp7 1 +Ethernet7 7 1000 etp8 1 +Ethernet8 10 1000 etp9 1 +Ethernet9 9 1000 etp10 1 +Ethernet10 12 1000 etp11 1 +Ethernet11 11 1000 etp12 1 +Ethernet12 14 1000 etp13 1 +Ethernet13 13 1000 etp14 1 +Ethernet14 16 1000 etp15 1 +Ethernet15 15 1000 etp16 1 +Ethernet16 18 1000 etp17 1 +Ethernet17 17 1000 etp18 1 +Ethernet18 20 1000 etp19 1 +Ethernet19 19 1000 etp20 1 +Ethernet20 22 1000 etp21 1 +Ethernet21 21 1000 etp22 1 +Ethernet22 24 1000 etp23 1 +Ethernet23 23 1000 etp24 1 +Ethernet24 26 1000 etp25 1 +Ethernet25 25 1000 etp26 1 +Ethernet26 28 1000 etp27 1 +Ethernet27 27 1000 etp28 1 +Ethernet28 30 1000 etp29 1 +Ethernet29 29 1000 etp30 1 +Ethernet30 32 1000 etp31 1 +Ethernet31 31 1000 etp32 1 +Ethernet32 34 1000 etp33 1 +Ethernet33 33 1000 etp34 1 +Ethernet34 36 1000 etp35 1 +Ethernet35 35 1000 etp36 1 +Ethernet36 38 1000 etp37 1 +Ethernet37 37 1000 etp38 1 +Ethernet38 40 1000 etp39 1 +Ethernet39 39 1000 etp40 1 +Ethernet40 42 1000 etp41 1 +Ethernet41 41 1000 etp42 1 +Ethernet42 44 1000 etp43 1 +Ethernet43 43 1000 etp44 1 +Ethernet44 46 1000 etp45 1 +Ethernet45 45 1000 etp46 1 +Ethernet46 48 1000 etp47 1 +Ethernet47 47 1000 etp48 1 +Ethernet48 54 10000 etp49 0 +Ethernet49 53 10000 etp50 0 +Ethernet50 56 10000 etp51 0 +Ethernet51 55 10000 etp52 0 diff --git a/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/sai.profile b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/sai.profile new file mode 100644 index 000000000000..1f36f82fd515 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/helix4-e1031-48x1G+4x10G.config.bcm diff --git a/device/celestica/x86_64-cel_e1031-r0/installer.conf b/device/celestica/x86_64-cel_e1031-r0/installer.conf new file mode 100644 index 000000000000..9b49af780817 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=9600 diff --git a/device/celestica/x86_64-cel_e1031-r0/minigraph.xml b/device/celestica/x86_64-cel_e1031-r0/minigraph.xml new file mode 100644 index 000000000000..7b24807718ac --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/minigraph.xml @@ -0,0 +1,810 @@ + + + + + + ARISTA01T1 + 10.0.0.1 + sonic + 10.0.0.0 + 1 + 180 + 60 + + + ARISTA02T1 + 10.0.0.5 + sonic + 10.0.0.4 + 1 + 180 + 60 + + + ARISTA03T1 + 10.0.0.9 + sonic + 10.0.0.8 + 1 + 180 + 60 + + + ARISTA04T1 + 10.0.0.13 + sonic + 10.0.0.12 + 1 + 180 + 60 + + + ARISTA01T1 + FC00::2 + sonic + FC00::1 + 1 + 180 + 60 + + + ARISTA02T1 + FC00::A + sonic + FC00::9 + 1 + 180 + 60 + + + ARISTA03T1 + FC00::12 + sonic + FC00::11 + 1 + 180 + 60 + + + ARISTA04T1 + FC00::1A + sonic + FC00::19 + 1 + 180 + 60 + + + + + 64601 + sonic + + + BGPPeer +
10.0.0.1
+ + + +
+ + BGPPeer +
10.0.0.5
+ + + +
+ + BGPPeer +
10.0.0.9
+ + + +
+ + BGPPeer +
10.0.0.13
+ + + +
+ + BGPPeer +
FC00::2
+ + + +
+ + BGPPeer +
FC00::A
+ + + +
+ + BGPPeer +
FC00::12
+ + + +
+ + BGPPeer +
FC00::1A
+ + + +
+
+ +
+ + 64802 + ARISTA01T1 + + + + 64802 + ARISTA02T1 + + + + 64802 + ARISTA03T1 + + + + 64802 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.251.0.243/23 + + 10.251.0.243/23 + + + + + + sonic + + + + VlanInterface + Vlan2 + etp1;etp2;etp3;etp4;etp5;etp6;etp7;etp8;etp9;etp10;etp11;etp12;etp13;etp14;etp15;etp16;etp17;etp18;etp19;etp20;etp21;etp22;etp23;etp24;etp25;etp26;etp27;etp28;etp29;etp30;etp31;etp32;etp33;etp34;etp35;etp36;etp37;etp38;etp39;etp40;etp41;etp42;etp43;etp44;etp45;etp46;etp47;etp48 + False + 0.0.0.0/0 + + 2 + 2 + 172.0.0.0/26 + + + + + IPInterface + + etp49 + 10.0.0.0/31 + + + IPInterface + + etp50 + 10.0.0.4/31 + + + IPInterface + + etp51 + 10.0.0.8/31 + + + IPInterface + + etp52 + 10.0.0.12/31 + + + IPInterface + + etp49 + FC00::1/126 + + + IPInterface + + etp50 + FC00::9/126 + + + IPInterface + + etp51 + FC00::11/126 + + + IPInterface + + etp52 + FC00::19/126 + + + IPInterface + + Vlan2 + 172.0.0.1/26 + + + + + + + + + + + + DeviceInterfaceLink + true + 10000 + ARISTA01T1 + Ethernet1 + true + sonic + etp49 + + + DeviceInterfaceLink + true + 10000 + ARISTA02T1 + Ethernet1 + true + sonic + etp50 + + + DeviceInterfaceLink + true + 10000 + ARISTA03T1 + Ethernet1 + true + sonic + etp51 + + + DeviceInterfaceLink + true + 10000 + ARISTA04T1 + Ethernet1 + true + sonic + etp52 + + + DeviceInterfaceLink + true + 1000 + sonic + etp1 + true + server-01 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp2 + true + server-02 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp3 + true + server-03 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp4 + true + server-04 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp5 + true + server-05 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp6 + true + server-06 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp7 + true + server-07 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp8 + true + server-08 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp9 + true + server-09 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp10 + true + server-10 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp11 + true + server-11 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp12 + true + server-12 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp13 + true + server-13 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp14 + true + server-14 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp15 + true + server-15 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp16 + true + server-16 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp17 + true + server-17 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp18 + true + server-18 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp19 + true + server-19 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp20 + true + server-20 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp21 + true + server-21 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp22 + true + server-22 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp23 + true + server-23 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp24 + true + server-24 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp25 + true + server-25 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp26 + true + server-26 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp27 + true + server-27 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp28 + true + server-28 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp29 + true + server-29 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp30 + true + server-30 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp31 + true + server-31 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp32 + true + server-32 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp33 + true + server-33 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp34 + true + server-34 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp35 + true + server-35 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp36 + true + server-36 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp37 + true + server-37 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp38 + true + server-38 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp39 + true + server-39 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp40 + true + server-40 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp41 + true + server-41 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp42 + true + server-42 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp43 + true + server-43 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp44 + true + server-44 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp45 + true + server-45 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp46 + true + server-46 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp47 + true + server-47 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + etp48 + true + server-48 + 0 + + + + + sonic + Celestica-E1031-T48S4 + + 10.251.0.243 + + + + + sonic + Celestica-E1031-T48S4 +
diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 611592c98182..77171281d8e3 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.5-3_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm_3.1.3.5-3_amd64.deb?sv=2015-04-05&sr=b&sig=lzB9IHpJuMEENr9N9W0LBFamJ7mpvRVWgigfQmpIrPc%3D&se=2155-06-05T09%3A13%3A41Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.5-5_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm_3.1.3.5-5_amd64.deb?sv=2015-04-05&sr=b&sig=QPeazVTcPxPiWnLQRX4BqAAoyo0kTXJlfNAAtp2nilk%3D&se=2155-06-28T00%3A35%3A53Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-3_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-5_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/libsaibcm-dev_3.1.3.5-3_amd64.deb?sv=2015-04-05&sr=b&sig=WoRAz6j8G3Xk%2BT3MOmhp5f%2BvWggw%2BgGgk2JtDJHkKjs%3D&se=2155-06-05T09%3A14%3A46Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-5_amd64.deb?sv=2015-04-05&sr=b&sig=6yrT5BVHkTr5955Rf9sADlVVN8o8TzxSjoj3JZg6nHw%3D&se=2155-06-28T00%3A37%3A34Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 1a55ae2b3a801ac438d914cf4dfbb58ee67487f9 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Mon, 6 Aug 2018 14:06:56 +0800 Subject: [PATCH 1451/1833] update sonic-platform-common submodule for xcvrd support (#1901) --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 76ae431e41dc..d98600e8ed8d 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 76ae431e41dca1255f8056b590668c9ca187f031 +Subproject commit d98600e8ed8df0280cb07487132e20adc48d7f6e From 33b713e7eff544777d8b2d453ed0a571a1e15e48 Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Tue, 7 Aug 2018 07:36:54 +0300 Subject: [PATCH 1452/1833] [submodule] update snmpagent and dbsyncd, extending/implementing ieee802.1ab, rfc3433, rfc2737 MIBs (#1902) --- src/sonic-dbsyncd | 2 +- src/sonic-snmpagent | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd index 94f2700f67f8..eeb678cb44a3 160000 --- a/src/sonic-dbsyncd +++ b/src/sonic-dbsyncd @@ -1 +1 @@ -Subproject commit 94f2700f67f87b431c7ce45e4b9d7788707c6732 +Subproject commit eeb678cb44a37c15bd3250dc64d932c3ea33ac26 diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index bf1b165458e4..ae99de071b33 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit bf1b165458e4e19286d245a3398921057f4df21c +Subproject commit ae99de071b332882aa3ac1e163188af93f602231 From 3d137654be6597f9214f4426a75bc9836e7e2ade Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 7 Aug 2018 08:43:08 -0700 Subject: [PATCH 1453/1833] [minigraph.py] add support to parse deployment id of neighbor devices (#1890) * [minigraph.py] add support to parse deployment id of neighbor devices * Add unitest * Fix function name --- src/sonic-config-engine/minigraph.py | 11 ++++-- .../tests/simple-sample-graph-case.xml | 36 +++++++++++-------- .../tests/test_minigraph_case.py | 5 +++ 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index a8140408e97f..1ad76b0b37d9 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -41,6 +41,7 @@ def parse_device(device): d_type = None # don't shadow type() hwsku = None name = None + deployment_id = None if str(QName(ns3, "type")) in device.attrib: d_type = device.attrib[str(QName(ns3, "type"))] @@ -53,7 +54,9 @@ def parse_device(device): name = node.text elif node.tag == str(QName(ns, "HwSku")): hwsku = node.text - return (lo_prefix, mgmt_prefix, name, hwsku, d_type) + elif node.tag == str(QName(ns, "DeploymentId")): + deployment_id = node.text + return (lo_prefix, mgmt_prefix, name, hwsku, d_type, deployment_id) def parse_png(png, hname): neighbors = {} @@ -92,8 +95,10 @@ def parse_png(png, hname): if child.tag == str(QName(ns, "Devices")): for device in child.findall(str(QName(ns, "Device"))): - (lo_prefix, mgmt_prefix, name, hwsku, d_type) = parse_device(device) + (lo_prefix, mgmt_prefix, name, hwsku, d_type, deployment_id) = parse_device(device) device_data = {'lo_addr': lo_prefix, 'type': d_type, 'mgmt_addr': mgmt_prefix, 'hwsku': hwsku } + if deployment_id: + device_data['deployment_id'] = deployment_id devices[name] = device_data if child.tag == str(QName(ns, "DeviceInterfaceLinks")): @@ -546,7 +551,7 @@ def parse_xml(filename, platform=None, port_config_file=None): def parse_device_desc_xml(filename): root = ET.parse(filename).getroot() - (lo_prefix, mgmt_prefix, hostname, hwsku, d_type) = parse_device(root) + (lo_prefix, mgmt_prefix, hostname, hwsku, d_type, _) = parse_device(root) results = {} results['DEVICE_METADATA'] = {'localhost': { diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml index 2d2f08f4d0d2..722d50f5ecd6 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -181,27 +181,33 @@ - + + + DeviceInterfaceLink + true + 10000 + switch-t0 + fortyGigE0/0 + switch-01t1 + port1 + + switch-t0 Force10-S6000 - ARISTA01T1 - Arista - - - ARISTA02T1 - Arista - - - ARISTA03T1 - Arista - - - ARISTA04T1 - Arista + switch-01t1 +
+ 10.1.0.186/32 +
+ 2 + + + 10.7.0.196/26 + + Force10-S6000
diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 754bdae799f4..4ceccb32a686 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -94,6 +94,11 @@ def test_minigraph_deployment_id(self): output = self.run_script(argument) self.assertEqual(output.strip(), "1") + def test_minigraph_neighbor_metadata(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_NEIGHBOR_METADATA"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'switch-01t1': {'lo_addr': '10.1.0.186/32', 'mgmt_addr': '10.7.0.196/26', 'hwsku': 'Force10-S6000', 'type': 'LeafRouter', 'deployment_id': '2'}}") + def test_metadata_everflow(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "MIRROR_SESSION"' output = self.run_script(argument) From 634814b15230ee79b492525c0688f06193a100fc Mon Sep 17 00:00:00 2001 From: simonJi2018 <37395146+simonJi2018@users.noreply.github.com> Date: Wed, 8 Aug 2018 00:01:47 +0800 Subject: [PATCH 1454/1833] change buffer template and fix some device driver bug (#1903) * Upgrade SAI to v1.2.4 * Add a new supported device accton as7116 * Add maintainer info for deb * Add mk file for accton 7116 * fix some bug for sai 1.2.4 * fix git commit error for sdk and sai * change sai and sdk deb name * add config file for qos support * initial commit * Delete qos.json * Delete buffers.json.j2 * Delete qos.json * Delete buffers.json.j2 * Delete buffers.json.j2 * Delete qos.json * add support for sai 1.3.0 * add qos and buffer file for device and add sensor driver for 7116 * change buffer template --- .../Accton-AS7116-54X/buffers.json.j2 | 2 + .../Accton-AS7116-54X/buffers_defaults_t0.j2 | 72 ++ .../Accton-AS7116-54X/buffers_defaults_t1.j2 | 72 ++ .../Accton-AS7116-54X/pg_profile_lookup.ini | 17 + .../Accton-AS7116-54X/port_config.ini | 15 +- .../Accton-AS7116-54X/port_config.nps | 358 ++++++ .../Accton-AS7116-54X/port_config.nps.AOC.R0B | 358 ++++++ .../Accton-AS7116-54X/port_config.nps.DAC.R0B | 357 ++++++ .../Accton-AS7116-54X/port_config_as7116.ini | 55 - .../Accton-AS7116-54X/qos.json.j2 | 289 +++-- .../Accton-AS7116-54X/sai.profile | 4 +- .../installer.conf | 1 + .../led_proc_init.nps | 20 +- .../x86_64-accton_as7116_54x-r0/minigraph.xml | 1008 +---------------- .../plugins/psuutil.py | 92 ++ .../plugins/sfputil.py | 7 +- .../x86_64-accton_as7116_54x-r0/sensors.conf | 13 + .../INGRASYS-S9130-32X/buffers.json.j2 | 2 + .../INGRASYS-S9130-32X/buffers_defaults_t0.j2 | 69 ++ .../INGRASYS-S9130-32X/buffers_defaults_t1.j2 | 69 ++ .../INGRASYS-S9130-32X/pg_profile_lookup.ini | 17 + .../INGRASYS-S9130-32X/port_config.nps.3T2AOC | 318 ++++++ .../INGRASYS-S9130-32X/port_config.nps.3T2DAC | 318 ++++++ .../INGRASYS-S9130-32X/qos.json.j2 | 289 +++-- .../minigraph.xml | 86 +- .../INGRASYS-S9230-64X/buffers.json.j2 | 2 + .../INGRASYS-S9230-64X/buffers_defaults_t0.j2 | 69 ++ .../INGRASYS-S9230-64X/buffers_defaults_t1.j2 | 69 ++ .../INGRASYS-S9230-64X/pg_profile_lookup.ini | 17 + .../INGRASYS-S9230-64X/qos.json.j2 | 289 +++-- .../minigraph.xml | 86 +- .../modules/x86-64-accton-as7116-54x-fan.c | 52 +- .../as7116-54x/utils/accton_as7116_util.py | 10 +- 33 files changed, 2779 insertions(+), 1723 deletions(-) create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t0.j2 create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t1.j2 create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/pg_profile_lookup.ini create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps.AOC.R0B create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps.DAC.R0B delete mode 100644 device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config_as7116.ini create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/plugins/psuutil.py create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/sensors.conf create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers_defaults_t0.j2 create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers_defaults_t1.j2 create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/pg_profile_lookup.ini create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps.3T2AOC create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps.3T2DAC create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers_defaults_t0.j2 create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers_defaults_t1.j2 create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/pg_profile_lookup.ini diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 new file mode 100644 index 000000000000..9354b7ec5b59 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t0.j2 b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..7e7c32676eb7 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t0.j2 @@ -0,0 +1,72 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '20971328' %} +{% set ingress_lossy_pool_size = '20971328' %} +{% set egress_lossless_pool_size = '20971328' %} +{% set egress_lossy_pool_size = '20971328' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0, 48) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(48, 54) %} + {%- if PORT_ALL.append("Ethernet%d" % (48 + (port_idx-48) * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xon":"78400", + "xoff":"132160", + "size":"3584", + "static_th":"82880" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"3584", + "dynamic_th":"-1" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"3584", + "dynamic_th":"-4" + } + }, +{%- endmacro %} + +{# the typo of generate_pg_profils dued to buffers_config.j2 #} +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_pg_profils(port_names) %} + "BUFFER_PG": { + } +{%- endmacro %} + +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + } +{%- endmacro %} \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t1.j2 b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..7e7c32676eb7 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t1.j2 @@ -0,0 +1,72 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '20971328' %} +{% set ingress_lossy_pool_size = '20971328' %} +{% set egress_lossless_pool_size = '20971328' %} +{% set egress_lossy_pool_size = '20971328' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0, 48) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} + {%- for port_idx in range(48, 54) %} + {%- if PORT_ALL.append("Ethernet%d" % (48 + (port_idx-48) * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xon":"78400", + "xoff":"132160", + "size":"3584", + "static_th":"82880" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"3584", + "dynamic_th":"-1" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"3584", + "dynamic_th":"-4" + } + }, +{%- endmacro %} + +{# the typo of generate_pg_profils dued to buffers_config.j2 #} +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_pg_profils(port_names) %} + "BUFFER_PG": { + } +{%- endmacro %} + +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + } +{%- endmacro %} \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/pg_profile_lookup.ini b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/pg_profile_lookup.ini new file mode 100644 index 000000000000..d98b0eca6d19 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 3584 32256 59136 36736 + 25000 5m 3584 41216 68096 45696 + 40000 5m 3584 47488 74368 51968 + 50000 5m 3584 52864 79744 57344 + 100000 5m 3584 78400 132160 82880 + 10000 40m 3584 32256 59136 36736 + 25000 40m 3584 41216 68096 45696 + 40000 40m 3584 47488 74368 51968 + 50000 40m 3584 52864 79744 57344 + 100000 40m 3584 78400 132160 82880 + 10000 300m 3584 32256 65856 36736 + 25000 300m 3584 41216 84672 45696 + 40000 300m 3584 47488 101024 51968 + 50000 300m 3584 52864 113120 57344 + 100000 300m 3584 78400 198688 82880 \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini index 6e5276fc726b..32125b076537 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini @@ -47,12 +47,9 @@ Ethernet44 76 Ethernet45/1 44 Ethernet45 77 Ethernet46/1 45 Ethernet46 78 Ethernet47/1 46 Ethernet47 79 Ethernet48/1 47 -Ethernet48 80 Ethernet49/1 48 -Ethernet49 81 Ethernet50/1 49 -Ethernet50 82 Ethernet51/1 50 -Ethernet51 83 Ethernet52/1 51 -Ethernet52 84,85,86,87 Ethernet53/1 52 -Ethernet53 104,105,106,107 Ethernet54/1 53 -Ethernet54 108,109,110,111 Ethernet55/1 54 -Ethernet55 112,113,114,115 Ethernet56/1 55 -Ethernet56 116,117,118,119 Ethernet57/1 56 +Ethernet48 84,85,86,87 Ethernet49/1 48 +Ethernet52 80,81,82,83 Ethernet50/1 49 +Ethernet56 104,105,106,107 Ethernet51/1 50 +Ethernet60 108,109,110,111 Ethernet52/1 51 +Ethernet64 112,113,114,115 Ethernet53/1 52 +Ethernet68 116,117,118,119 Ethernet54/1 53 \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps new file mode 100644 index 000000000000..34e5a2daab80 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps @@ -0,0 +1,358 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map unit=0 port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map unit=0 port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map unit=0 port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map unit=0 port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map unit=0 port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map unit=0 port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map unit=0 port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map unit=0 port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map unit=0 port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map unit=0 port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map unit=0 port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map unit=0 port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map unit=0 port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map unit=0 port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map unit=0 port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map unit=0 port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map unit=0 port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map unit=0 port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map unit=0 port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map unit=0 port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map unit=0 port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map unit=0 port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map unit=0 port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map unit=0 port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map unit=0 port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map unit=0 port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map unit=0 port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map unit=0 port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map unit=0 port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map unit=0 port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map unit=0 port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map unit=0 port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map unit=0 port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map unit=0 port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map unit=0 port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map unit=0 port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map unit=0 port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map unit=0 port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map unit=0 port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map unit=0 port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map unit=0 port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map unit=0 port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map unit=0 port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map unit=0 port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map unit=0 port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map unit=0 port=48 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=4 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=5 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=6 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=7 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=12 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=13 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=14 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=15 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=18 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=19 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=20 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=21 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=22 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=23 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=24 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=25 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=26 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=27 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=28 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=29 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=30 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=31 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=48 lane-cnt=4 property=tx data=0x1.3.0.2 +phy set lane-swap portlist=49 lane-cnt=4 property=tx data=0x0.3.1.2 +phy set lane-swap portlist=50 lane-cnt=4 property=tx data=0x1.3.0.2 +phy set lane-swap portlist=51 lane-cnt=4 property=tx data=0x2.0.3.1 +phy set lane-swap portlist=52 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap portlist=53 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=4 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=5 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=6 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=7 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=14 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=15 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=20 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=21 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=22 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=23 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=24 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=25 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=26 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=27 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=28 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=29 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=30 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=31 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=32 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=33 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=34 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=35 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=36 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=37 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=38 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=39 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=40 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=41 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=42 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=43 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=44 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=45 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=46 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=47 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=48 lane-cnt=4 property=rx data=0x2.1.0.3 +phy set lane-swap portlist=49 lane-cnt=4 property=rx data=0x0.1.3.2 +phy set lane-swap portlist=50 lane-cnt=4 property=rx data=0x3.1.0.2 +phy set lane-swap portlist=51 lane-cnt=4 property=rx data=0x1.3.0.2 +phy set lane-swap portlist=52 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap portlist=53 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set polarity-rev portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=5 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=48 lane-cnt=4 property=tx data=0x0.0.0.1 +phy set polarity-rev portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=50 lane-cnt=4 property=tx data=0x1.1.0.0 +phy set polarity-rev portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=48 lane-cnt=4 property=rx data=0x0.1.0.1 +phy set polarity-rev portlist=49 lane-cnt=4 property=rx data=0x1.0.1.0 +phy set polarity-rev portlist=50 lane-cnt=4 property=rx data=0x0.0.1.0 +phy set polarity-rev portlist=51 lane-cnt=4 property=rx data=0x0.0.0.1 +phy set polarity-rev portlist=52 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set pre-emphasis portlist=0 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=0 lane-cnt=4 property=cn1 data=0x1.1.1.1 +phy set pre-emphasis portlist=0 lane-cnt=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis portlist=0 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=4 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=4 lane-cnt=4 property=cn1 data=0x1.1.1.1 +phy set pre-emphasis portlist=4 lane-cnt=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis portlist=4 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=8 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=8 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=8 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=8 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=12 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=12 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=12 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis portlist=12 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=16 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=16 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=16 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=16 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=20 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=20 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=20 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=20 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=24 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=24 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=24 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=24 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=28 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=28 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=28 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=28 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=32 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=32 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=32 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=32 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=36 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=36 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=36 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=36 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=40 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=40 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=40 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=40 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=44 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=44 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=44 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=44 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=48 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=48 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=48 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis portlist=48 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=49 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=49 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=49 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis portlist=49 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=50 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=50 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=50 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis portlist=50 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=51 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=51 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=51 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis portlist=51 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=52 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=52 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=52 lane-cnt=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis portlist=52 lane-cnt=4 property=c1 data=0x8.8.8.8 +phy set pre-emphasis portlist=53 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=53 lane-cnt=4 property=cn1 data=0x1.1.1.1 +phy set pre-emphasis portlist=53 lane-cnt=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis portlist=53 lane-cnt=4 property=c1 data=0x7.7.7.7 +port set property portlist=0-47 speed=25g +port set property portlist=48-53 speed=100g +port set property portlist=129-130 speed=10g +port set property portlist=0-47 medium-type=sr +port set property portlist=48-53 medium-type=sr4 +port set property portlist=129-130 medium-type=kr +port set adver portlist=129-130 speed-10g-kr +port set property portlist=129-130 an=enable +port set property portlist=0-53,129-130 admin=enable + diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps.AOC.R0B b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps.AOC.R0B new file mode 100644 index 000000000000..34e5a2daab80 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps.AOC.R0B @@ -0,0 +1,358 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map unit=0 port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map unit=0 port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map unit=0 port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map unit=0 port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map unit=0 port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map unit=0 port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map unit=0 port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map unit=0 port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map unit=0 port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map unit=0 port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map unit=0 port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map unit=0 port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map unit=0 port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map unit=0 port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map unit=0 port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map unit=0 port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map unit=0 port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map unit=0 port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map unit=0 port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map unit=0 port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map unit=0 port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map unit=0 port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map unit=0 port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map unit=0 port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map unit=0 port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map unit=0 port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map unit=0 port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map unit=0 port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map unit=0 port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map unit=0 port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map unit=0 port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map unit=0 port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map unit=0 port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map unit=0 port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map unit=0 port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map unit=0 port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map unit=0 port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map unit=0 port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map unit=0 port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map unit=0 port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map unit=0 port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map unit=0 port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map unit=0 port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map unit=0 port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map unit=0 port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map unit=0 port=48 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=4 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=5 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=6 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=7 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=12 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=13 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=14 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=15 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=18 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=19 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=20 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=21 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=22 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=23 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=24 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=25 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=26 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=27 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=28 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=29 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=30 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=31 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=48 lane-cnt=4 property=tx data=0x1.3.0.2 +phy set lane-swap portlist=49 lane-cnt=4 property=tx data=0x0.3.1.2 +phy set lane-swap portlist=50 lane-cnt=4 property=tx data=0x1.3.0.2 +phy set lane-swap portlist=51 lane-cnt=4 property=tx data=0x2.0.3.1 +phy set lane-swap portlist=52 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap portlist=53 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=4 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=5 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=6 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=7 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=14 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=15 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=20 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=21 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=22 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=23 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=24 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=25 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=26 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=27 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=28 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=29 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=30 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=31 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=32 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=33 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=34 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=35 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=36 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=37 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=38 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=39 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=40 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=41 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=42 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=43 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=44 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=45 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=46 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=47 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=48 lane-cnt=4 property=rx data=0x2.1.0.3 +phy set lane-swap portlist=49 lane-cnt=4 property=rx data=0x0.1.3.2 +phy set lane-swap portlist=50 lane-cnt=4 property=rx data=0x3.1.0.2 +phy set lane-swap portlist=51 lane-cnt=4 property=rx data=0x1.3.0.2 +phy set lane-swap portlist=52 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap portlist=53 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set polarity-rev portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=5 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=48 lane-cnt=4 property=tx data=0x0.0.0.1 +phy set polarity-rev portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=50 lane-cnt=4 property=tx data=0x1.1.0.0 +phy set polarity-rev portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=48 lane-cnt=4 property=rx data=0x0.1.0.1 +phy set polarity-rev portlist=49 lane-cnt=4 property=rx data=0x1.0.1.0 +phy set polarity-rev portlist=50 lane-cnt=4 property=rx data=0x0.0.1.0 +phy set polarity-rev portlist=51 lane-cnt=4 property=rx data=0x0.0.0.1 +phy set polarity-rev portlist=52 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set pre-emphasis portlist=0 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=0 lane-cnt=4 property=cn1 data=0x1.1.1.1 +phy set pre-emphasis portlist=0 lane-cnt=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis portlist=0 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=4 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=4 lane-cnt=4 property=cn1 data=0x1.1.1.1 +phy set pre-emphasis portlist=4 lane-cnt=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis portlist=4 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=8 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=8 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=8 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=8 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=12 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=12 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=12 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis portlist=12 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=16 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=16 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=16 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=16 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=20 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=20 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=20 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=20 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=24 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=24 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=24 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=24 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=28 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=28 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=28 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=28 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=32 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=32 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=32 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=32 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=36 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=36 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=36 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=36 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=40 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=40 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=40 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=40 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=44 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=44 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=44 lane-cnt=4 property=c0 data=0x1c.1c.1c.1c +phy set pre-emphasis portlist=44 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=48 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=48 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=48 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis portlist=48 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=49 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=49 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=49 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis portlist=49 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=50 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=50 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=50 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis portlist=50 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=51 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=51 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=51 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis portlist=51 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=52 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=52 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=52 lane-cnt=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis portlist=52 lane-cnt=4 property=c1 data=0x8.8.8.8 +phy set pre-emphasis portlist=53 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=53 lane-cnt=4 property=cn1 data=0x1.1.1.1 +phy set pre-emphasis portlist=53 lane-cnt=4 property=c0 data=0x1a.1a.1a.1a +phy set pre-emphasis portlist=53 lane-cnt=4 property=c1 data=0x7.7.7.7 +port set property portlist=0-47 speed=25g +port set property portlist=48-53 speed=100g +port set property portlist=129-130 speed=10g +port set property portlist=0-47 medium-type=sr +port set property portlist=48-53 medium-type=sr4 +port set property portlist=129-130 medium-type=kr +port set adver portlist=129-130 speed-10g-kr +port set property portlist=129-130 an=enable +port set property portlist=0-53,129-130 admin=enable + diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps.DAC.R0B b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps.DAC.R0B new file mode 100644 index 000000000000..af9927ae2884 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps.DAC.R0B @@ -0,0 +1,357 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map unit=0 port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map unit=0 port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map unit=0 port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map unit=0 port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map unit=0 port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map unit=0 port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map unit=0 port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map unit=0 port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map unit=0 port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map unit=0 port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map unit=0 port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map unit=0 port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map unit=0 port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map unit=0 port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map unit=0 port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map unit=0 port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map unit=0 port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map unit=0 port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map unit=0 port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map unit=0 port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map unit=0 port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map unit=0 port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map unit=0 port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map unit=0 port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map unit=0 port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map unit=0 port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map unit=0 port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map unit=0 port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map unit=0 port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map unit=0 port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map unit=0 port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map unit=0 port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map unit=0 port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map unit=0 port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map unit=0 port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map unit=0 port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map unit=0 port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map unit=0 port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map unit=0 port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map unit=0 port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map unit=0 port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map unit=0 port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map unit=0 port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map unit=0 port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map unit=0 port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map unit=0 port=48 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=tx data=0x1.3.0.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=tx data=0x0.3.1.2 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=tx data=0x1.3.0.2 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=tx data=0x2.0.3.1 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=rx data=0x2.1.0.3 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=rx data=0x0.1.3.2 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=rx data=0x3.1.0.2 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=rx data=0x1.3.0.2 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=tx data=0x0.0.0.1 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=tx data=0x1.1.0.0 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=rx data=0x0.1.0.1 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=rx data=0x1.0.1.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=rx data=0x0.0.1.0 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=rx data=0x0.0.0.1 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=32 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=36 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=40 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=44 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c0 data=0x1e.1e.1e.1e +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c1 data=0x2.2.2.2 +port set property unit=0 portlist=0-47 speed=25g +port set property unit=0 portlist=48-53 speed=100g +port set property unit=0 portlist=129-130 speed=10g +port set property unit=0 portlist=0-47 medium-type=cr +port set property unit=0 portlist=48-53 medium-type=cr4 +port set property unit=0 portlist=129-130 medium-type=kr +port set adver unit=0 portlist=129-130 speed-10g-kr +port set property unit=0 portlist=129-130 an=enable +port set property unit=0 portlist=0-53,129-130 admin=enable diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config_as7116.ini b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config_as7116.ini deleted file mode 100644 index 0c124743d9ec..000000000000 --- a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config_as7116.ini +++ /dev/null @@ -1,55 +0,0 @@ -# name lanes alias index -Ethernet0 8 Ethernet1/1 0 -Ethernet1 9 Ethernet2/1 1 -Ethernet2 10 Ethernet3/1 2 -Ethernet3 11 Ethernet4/1 3 -Ethernet4 12 Ethernet5/1 4 -Ethernet5 13 Ethernet6/1 5 -Ethernet6 14 Ethernet7/1 6 -Ethernet7 15 Ethernet8/1 7 -Ethernet8 16 Ethernet9/1 8 -Ethernet9 17 Ethernet10/1 9 -Ethernet10 18 Ethernet11/1 10 -Ethernet11 19 Ethernet12/1 11 -Ethernet12 20 Ethernet13/1 12 -Ethernet13 21 Ethernet14/1 13 -Ethernet14 22 Ethernet15/1 14 -Ethernet15 23 Ethernet16/1 15 -Ethernet16 32 Ethernet17/1 16 -Ethernet17 33 Ethernet18/1 17 -Ethernet18 34 Ethernet19/1 18 -Ethernet19 35 Ethernet20/1 19 -Ethernet20 40 Ethernet21/1 20 -Ethernet21 41 Ethernet22/1 21 -Ethernet22 42 Ethernet23/1 22 -Ethernet23 43 Ethernet24/1 23 -Ethernet24 48 Ethernet25/1 24 -Ethernet25 49 Ethernet26/1 25 -Ethernet26 50 Ethernet27/1 26 -Ethernet27 51 Ethernet28/1 27 -Ethernet28 56 Ethernet29/1 28 -Ethernet29 57 Ethernet30/1 29 -Ethernet30 58 Ethernet31/1 30 -Ethernet31 59 Ethernet32/1 31 -Ethernet32 64 Ethernet33/1 32 -Ethernet33 65 Ethernet34/1 33 -Ethernet34 66 Ethernet35/1 34 -Ethernet35 67 Ethernet36/1 35 -Ethernet36 68 Ethernet37/1 36 -Ethernet37 69 Ethernet38/1 37 -Ethernet38 70 Ethernet39/1 38 -Ethernet39 71 Ethernet40/1 39 -Ethernet40 72 Ethernet41/1 40 -Ethernet41 73 Ethernet42/1 41 -Ethernet42 74 Ethernet43/1 42 -Ethernet43 75 Ethernet44/1 43 -Ethernet44 76 Ethernet45/1 44 -Ethernet45 77 Ethernet46/1 45 -Ethernet46 78 Ethernet47/1 46 -Ethernet47 79 Ethernet48/1 47 -Ethernet48 80,81,82,83 Ethernet49/1 48 -Ethernet49 84,85,86,87 Ethernet50/1 49 -Ethernet50 104,105,106,107 Ethernet51/1 50 -Ethernet51 108,109,110,111 Ethernet52/1 51 -Ethernet52 112,113,114,115 Ethernet53/1 52 -Ethernet53 116,117,118,119 Ethernet54/1 56 \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json.j2 b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json.j2 index 6f3f6990d87c..5c5fc6e4969b 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json.j2 +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/qos.json.j2 @@ -1,153 +1,136 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "1", - "1": "0", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "1", - "1": "0", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"1", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184128", - "green_min_threshold": "184128" - }, - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184128", - "green_min_threshold": "184128" - } - }, - "QUEUE": { - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"1", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"613984", + "red_min_threshold":"76608", + "yellow_max_threshold":"628320", + "yellow_min_threshold":"78400", + "green_max_threshold": "642656", + "green_min_threshold": "80192" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"613984", + "red_min_threshold":"76608", + "yellow_max_threshold":"628320", + "yellow_min_threshold":"78400", + "green_max_threshold": "642656", + "green_min_threshold": "80192" + } + }, + "QUEUE": { + } +} diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile index d43b2a33f42d..880f47910ac1 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile @@ -1,2 +1,2 @@ -SAI_INIT_CONFIG_FILE=/etc/nps/tau-as7116-4806.cfg -SAI_DSH_CONFIG_FILE=/etc/nps/tau-as7116-4806.dsh +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/led_proc_init.nps +SAI_DSH_CONFIG_FILE=/usr/share/sonic/hwsku/port_config.nps diff --git a/device/accton/x86_64-accton_as7116_54x-r0/installer.conf b/device/accton/x86_64-accton_as7116_54x-r0/installer.conf index 925a32fc0c3a..4eeedca86a48 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/installer.conf +++ b/device/accton/x86_64-accton_as7116_54x-r0/installer.conf @@ -1,3 +1,4 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="pci=noaer" \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/led_proc_init.nps b/device/accton/x86_64-accton_as7116_54x-r0/led_proc_init.nps index 9a97d94c0b0e..e25c78018adb 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/led_proc_init.nps +++ b/device/accton/x86_64-accton_as7116_54x-r0/led_proc_init.nps @@ -1,20 +1,10 @@ -#This configuration file is for customer init value feature. Please refer to mtk_cfg.h/mtk_cfg.c for detail. -#1. The lines beginning with # are comment lines. The lines beginning with number are the setting lines. -#2. There are five parameters which can be set. -# 1) the first is unit. -# 2) the second is NPS_CFG_TYPE_XXX. Refer to NPS_CFG_TYPE_T. -# 3) the 3-5 are {param0, param1, value} pairs. Refer to NPS_CFG_VALUE_T. Support HEX format. -# 4) the (unit, NPS_CFG_TYPE_XXX, param0, param1) group is the key to get the correspingding value. -# There should be no same (unit, NPS_CFG_TYPE_XXX, param0, param1) group. -#3. User must follow correct format to apply the setting. Please refer to below commentted example(#0 NPS_CFG_TYPE_L2_ADDR_MODE 0 0 1); -#4. Usage under the linux shell: -# 1) ./image-path/image-name -c cfg-path/NPS_Ari_EVB_24.cfg : mamually specify directory path if they are not in current work dirctory. -# 2) ./image-name -c NPS_Ari_EVB_24.cfg : the image and the NPS_Ari_EVB_24.cfg are in the current work directory. - #unit NPS_CFG_TYPE_XXX param0 param1 value #---- ---------------- ------ ------ ----- 0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 -0 NPS_CFG_TYPE_LED_CFG 0 0 3 -0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +0 NPS_CFG_TYPE_LED_CFG 0 0 5 0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 1 0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 1 +0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +0 NPS_CFG_TYPE_HASH_L2_FDB_REGION_ENTRY_NUM 0 0 49152 +0 NPS_CFG_TYPE_HASH_L3_WITH_IPV6_PREFIX_64_REGION_ENTRY_NUM 0 0 32768 + diff --git a/device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml index d538a8cbd709..91269c2f68f6 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml +++ b/device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml @@ -1,625 +1,6 @@ - - - ARISTA01T0 - 10.1.1.33 - switch1 - 10.0.0.32 - 1 - 180 - 60 - - - switch1 - 10.0.0.0 - ARISTA01T2 - 10.0.0.1 - 1 - 180 - 60 - - - ARISTA02T0 - 10.0.0.35 - switch1 - 10.0.0.34 - 1 - 180 - 60 - - - switch1 - 10.0.0.2 - ARISTA02T2 - 10.0.0.3 - 1 - 180 - 60 - - - ARISTA03T0 - 10.0.0.37 - switch1 - 10.0.0.36 - 1 - 180 - 60 - - - switch1 - 10.0.0.4 - ARISTA03T2 - 10.0.0.5 - 1 - 180 - 60 - - - ARISTA04T0 - 10.0.0.39 - switch1 - 10.0.0.38 - 1 - 180 - 60 - - - switch1 - 10.0.0.6 - ARISTA04T2 - 10.0.0.7 - 1 - 180 - 60 - - - ARISTA05T0 - 10.0.0.41 - switch1 - 10.0.0.40 - 1 - 180 - 60 - - - switch1 - 10.0.0.8 - ARISTA05T2 - 10.0.0.9 - 1 - 180 - 60 - - - ARISTA06T0 - 10.0.0.43 - switch1 - 10.0.0.42 - 1 - 180 - 60 - - - switch1 - 10.0.0.10 - ARISTA06T2 - 10.0.0.11 - 1 - 180 - 60 - - - ARISTA07T0 - 10.0.0.45 - switch1 - 10.0.0.44 - 1 - 180 - 60 - - - switch1 - 10.0.0.12 - ARISTA07T2 - 10.0.0.13 - 1 - 180 - 60 - - - ARISTA08T0 - 10.0.0.47 - switch1 - 10.0.0.46 - 1 - 180 - 60 - - - switch1 - 10.0.0.14 - ARISTA08T2 - 10.0.0.15 - 1 - 180 - 60 - - - ARISTA09T0 - 10.0.0.49 - switch1 - 10.0.0.48 - 1 - 180 - 60 - - - switch1 - 10.0.0.16 - ARISTA09T2 - 10.0.0.17 - 1 - 180 - 60 - - - ARISTA10T0 - 10.0.0.51 - switch1 - 10.0.0.50 - 1 - 180 - 60 - - - switch1 - 10.0.0.18 - ARISTA10T2 - 10.0.0.19 - 1 - 180 - 60 - - - ARISTA11T0 - 10.0.0.53 - switch1 - 10.0.0.52 - 1 - 180 - 60 - - - switch1 - 10.0.0.20 - ARISTA11T2 - 10.0.0.21 - 1 - 180 - 60 - - - ARISTA12T0 - 10.0.0.55 - switch1 - 10.0.0.54 - 1 - 180 - 60 - - - switch1 - 10.0.0.22 - ARISTA12T2 - 10.0.0.23 - 1 - 180 - 60 - - - ARISTA13T0 - 10.0.0.57 - switch1 - 10.0.0.56 - 1 - 180 - 60 - - - switch1 - 10.0.0.24 - ARISTA13T2 - 10.0.0.25 - 1 - 180 - 60 - - - ARISTA14T0 - 10.0.0.59 - switch1 - 10.0.0.58 - 1 - 180 - 60 - - - switch1 - 10.0.0.26 - ARISTA14T2 - 10.0.0.27 - 1 - 180 - 60 - - - ARISTA15T0 - 10.0.0.61 - switch1 - 10.0.0.60 - 1 - 180 - 60 - - - switch1 - 10.0.0.28 - ARISTA15T2 - 10.0.0.29 - 1 - 180 - 60 - - - ARISTA16T0 - 10.0.0.63 - switch1 - 10.0.0.62 - 1 - 180 - 60 - - - switch1 - 10.0.0.30 - ARISTA16T2 - 10.0.0.31 - 1 - 180 - 60 - - - - - 65100 - switch1 - - -
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 - - -
@@ -642,168 +23,7 @@ switch1 - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - + @@ -811,232 +31,6 @@ - - - DeviceInterfaceLink - switch1 - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet124 - ARISTA16T0 - Ethernet1 - - switch1 diff --git a/device/accton/x86_64-accton_as7116_54x-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7116_54x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..08fd2648f314 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/10-0050", + "/sys/bus/i2c/devices/11-0053"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_power_good' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_present' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 1): + status = 1 + + return status + diff --git a/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py index 974bedc4db19..8abcd46ccb56 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py @@ -79,10 +79,7 @@ def __init__(self): eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' for x in range(self._port_start, self._port_end + 1): port_eeprom_path = eeprom_path.format(self._port_to_i2c_mapping[x]) - if x == 53: - self._port_to_eeprom_mapping[56] = port_eeprom_path # ugly!!!! - else: - self._port_to_eeprom_mapping[x] = port_eeprom_path + self._port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self) @@ -151,5 +148,3 @@ def qsfp_ports(self): @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping - - diff --git a/device/accton/x86_64-accton_as7116_54x-r0/sensors.conf b/device/accton/x86_64-accton_as7116_54x-r0/sensors.conf new file mode 100644 index 000000000000..9edb51a9e72d --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/sensors.conf @@ -0,0 +1,13 @@ +# libsensors configuration file + +chip "as7116_54x_fan-*" + label fan1 "front fan 1" + label fan2 "front fan 2" + label fan3 "front fan 3" + label fan4 "front fan 4" + label fan5 "front fan 5" + label fan6 "rear fan 1" + label fan7 "rear fan 2" + label fan8 "rear fan 3" + label fan9 "rear fan 4" + label fan10 "rear fan 5" diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 new file mode 100644 index 000000000000..9354b7ec5b59 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers_defaults_t0.j2 b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..b008aa892bc1 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers_defaults_t0.j2 @@ -0,0 +1,69 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '20971328' %} +{% set ingress_lossy_pool_size = '20971328' %} +{% set egress_lossless_pool_size = '20971328' %} +{% set egress_lossy_pool_size = '20971328' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0, 32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx*4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xon":"78400", + "xoff":"132160", + "size":"3584", + "static_th":"82880" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"3584", + "dynamic_th":"-1" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"3584", + "dynamic_th":"-4" + } + }, +{%- endmacro %} + +{# the typo of generate_pg_profils dued to buffers_config.j2 #} +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_pg_profils(port_names) %} + "BUFFER_PG": { + } +{%- endmacro %} + +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + } +{%- endmacro %} \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers_defaults_t1.j2 b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..b008aa892bc1 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/buffers_defaults_t1.j2 @@ -0,0 +1,69 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '20971328' %} +{% set ingress_lossy_pool_size = '20971328' %} +{% set egress_lossless_pool_size = '20971328' %} +{% set egress_lossy_pool_size = '20971328' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0, 32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx*4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xon":"78400", + "xoff":"132160", + "size":"3584", + "static_th":"82880" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"3584", + "dynamic_th":"-1" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"3584", + "dynamic_th":"-4" + } + }, +{%- endmacro %} + +{# the typo of generate_pg_profils dued to buffers_config.j2 #} +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_pg_profils(port_names) %} + "BUFFER_PG": { + } +{%- endmacro %} + +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + } +{%- endmacro %} \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/pg_profile_lookup.ini b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/pg_profile_lookup.ini new file mode 100644 index 000000000000..d98b0eca6d19 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 3584 32256 59136 36736 + 25000 5m 3584 41216 68096 45696 + 40000 5m 3584 47488 74368 51968 + 50000 5m 3584 52864 79744 57344 + 100000 5m 3584 78400 132160 82880 + 10000 40m 3584 32256 59136 36736 + 25000 40m 3584 41216 68096 45696 + 40000 40m 3584 47488 74368 51968 + 50000 40m 3584 52864 79744 57344 + 100000 40m 3584 78400 132160 82880 + 10000 300m 3584 32256 65856 36736 + 25000 300m 3584 41216 84672 45696 + 40000 300m 3584 47488 101024 51968 + 50000 300m 3584 52864 113120 57344 + 100000 300m 3584 78400 198688 82880 \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps.3T2AOC b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps.3T2AOC new file mode 100644 index 000000000000..f9e5396d0cfc --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps.3T2AOC @@ -0,0 +1,318 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=0 lane=0 max-speed=100g active=true +init set port-map unit=0 port=1 eth-macro=1 lane=0 max-speed=100g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=0 max-speed=100g active=true +init set port-map unit=0 port=3 eth-macro=3 lane=0 max-speed=100g active=true +init set port-map unit=0 port=4 eth-macro=4 lane=0 max-speed=100g active=true +init set port-map unit=0 port=5 eth-macro=5 lane=0 max-speed=100g active=true +init set port-map unit=0 port=6 eth-macro=6 lane=0 max-speed=100g active=true +init set port-map unit=0 port=7 eth-macro=7 lane=0 max-speed=100g active=true +init set port-map unit=0 port=8 eth-macro=8 lane=0 max-speed=100g active=true +init set port-map unit=0 port=9 eth-macro=9 lane=0 max-speed=100g active=true +init set port-map unit=0 port=10 eth-macro=10 lane=0 max-speed=100g active=true +init set port-map unit=0 port=11 eth-macro=11 lane=0 max-speed=100g active=true +init set port-map unit=0 port=12 eth-macro=12 lane=0 max-speed=100g active=true +init set port-map unit=0 port=13 eth-macro=13 lane=0 max-speed=100g active=true +init set port-map unit=0 port=14 eth-macro=14 lane=0 max-speed=100g active=true +init set port-map unit=0 port=15 eth-macro=15 lane=0 max-speed=100g active=true +init set port-map unit=0 port=16 eth-macro=16 lane=0 max-speed=100g active=true +init set port-map unit=0 port=17 eth-macro=17 lane=0 max-speed=100g active=true +init set port-map unit=0 port=18 eth-macro=18 lane=0 max-speed=100g active=true +init set port-map unit=0 port=19 eth-macro=19 lane=0 max-speed=100g active=true +init set port-map unit=0 port=20 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=21 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=22 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map unit=0 port=23 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map unit=0 port=24 eth-macro=24 lane=0 max-speed=100g active=true +init set port-map unit=0 port=25 eth-macro=25 lane=0 max-speed=100g active=true +init set port-map unit=0 port=26 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=27 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=28 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=29 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=30 eth-macro=30 lane=0 max-speed=100g active=true +init set port-map unit=0 port=31 eth-macro=31 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=1 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=2 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=3 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=4 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=5 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=6 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=7 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=8 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=9 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=10 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=11 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=12 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=13 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=14 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=15 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=16 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=17 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=18 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=19 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=20 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=21 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=22 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=23 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=24 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=25 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=26 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=27 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=28 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=29 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=30 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=31 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=0 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=1 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=2 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=3 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=4 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=5 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=6 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=7 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=8 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=9 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=10 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=11 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=12 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=13 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=14 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=15 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=16 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=17 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=18 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=19 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=20 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=21 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=22 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=23 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=24 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=25 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=26 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=27 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=28 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=29 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=30 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=31 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis unit=0 portlist=1 lane-cnt=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis unit=0 portlist=2 lane-cnt=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis unit=0 portlist=3 lane-cnt=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis unit=0 portlist=5 lane-cnt=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=4 property=c2 data=0x03.03.03.03 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=6 lane-cnt=4 property=c1 data=0x05.05.05.05 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=7 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=9 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=10 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=11 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=13 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=4 property=c0 data=0x1D.1D.1D.1D +phy set pre-emphasis unit=0 portlist=14 lane-cnt=4 property=c1 data=0x05.05.05.05 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=15 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=c1 data=0x05.05.05.05 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=17 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=18 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=19 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis unit=0 portlist=21 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=22 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=23 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis unit=0 portlist=25 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis unit=0 portlist=26 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis unit=0 portlist=27 lane-cnt=4 property=c1 data=0x06.06.06.06 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=4 property=cn1 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis unit=0 portlist=29 lane-cnt=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=4 property=c2 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=4 property=cn1 data=0x01.01.01.01 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis unit=0 portlist=30 lane-cnt=4 property=c1 data=0x07.07.07.07 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=4 property=c2 data=0x01.01.01.01 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=4 property=cn1 data=0x03.03.03.03 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=4 property=c0 data=0x17.17.17.17 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=4 property=c1 data=0x09.09.09.09 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c2 data=0x01 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=cn1 data=0x01 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c0 data=0x02 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c1 data=0x03 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c2 data=0x01 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=cn1 data=0x01 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c0 data=0x02 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c1 data=0x03 +port set property unit=0 portlist=0-31 speed=100g +port set property unit=0 portlist=129-130 speed=10g +port set property unit=0 portlist=0-31 medium-type=sr4 +port set property unit=0 portlist=129-130 medium-type=kr +port set property unit=0 portlist=0-31 fec=disable +port set adver unit=0 portlist=129-130 speed-10g-kr +port set property unit=0 portlist=129-130 an=enable +port set property unit=0 portlist=0-31,129-130 admin=enable diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps.3T2DAC b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps.3T2DAC new file mode 100644 index 000000000000..c8f6602f8ab1 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/port_config.nps.3T2DAC @@ -0,0 +1,318 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=0 lane=0 max-speed=100g active=true +init set port-map unit=0 port=1 eth-macro=1 lane=0 max-speed=100g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=0 max-speed=100g active=true +init set port-map unit=0 port=3 eth-macro=3 lane=0 max-speed=100g active=true +init set port-map unit=0 port=4 eth-macro=4 lane=0 max-speed=100g active=true +init set port-map unit=0 port=5 eth-macro=5 lane=0 max-speed=100g active=true +init set port-map unit=0 port=6 eth-macro=6 lane=0 max-speed=100g active=true +init set port-map unit=0 port=7 eth-macro=7 lane=0 max-speed=100g active=true +init set port-map unit=0 port=8 eth-macro=8 lane=0 max-speed=100g active=true +init set port-map unit=0 port=9 eth-macro=9 lane=0 max-speed=100g active=true +init set port-map unit=0 port=10 eth-macro=10 lane=0 max-speed=100g active=true +init set port-map unit=0 port=11 eth-macro=11 lane=0 max-speed=100g active=true +init set port-map unit=0 port=12 eth-macro=12 lane=0 max-speed=100g active=true +init set port-map unit=0 port=13 eth-macro=13 lane=0 max-speed=100g active=true +init set port-map unit=0 port=14 eth-macro=14 lane=0 max-speed=100g active=true +init set port-map unit=0 port=15 eth-macro=15 lane=0 max-speed=100g active=true +init set port-map unit=0 port=16 eth-macro=16 lane=0 max-speed=100g active=true +init set port-map unit=0 port=17 eth-macro=17 lane=0 max-speed=100g active=true +init set port-map unit=0 port=18 eth-macro=18 lane=0 max-speed=100g active=true +init set port-map unit=0 port=19 eth-macro=19 lane=0 max-speed=100g active=true +init set port-map unit=0 port=20 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=21 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=22 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map unit=0 port=23 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map unit=0 port=24 eth-macro=24 lane=0 max-speed=100g active=true +init set port-map unit=0 port=25 eth-macro=25 lane=0 max-speed=100g active=true +init set port-map unit=0 port=26 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=27 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=28 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=29 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=30 eth-macro=30 lane=0 max-speed=100g active=true +init set port-map unit=0 port=31 eth-macro=31 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=1 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=2 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=3 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=4 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=5 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=6 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=7 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=8 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=9 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=10 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=11 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=12 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=13 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=14 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=15 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=16 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=17 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=18 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=19 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=20 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=21 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=22 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=23 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=24 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=25 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=26 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=27 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=28 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=29 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=30 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=31 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=0 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=1 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=2 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=3 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=4 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=5 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=6 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=7 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=8 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=9 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=10 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=11 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=12 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=13 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=14 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=15 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=16 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=17 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=18 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=19 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=20 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=21 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=22 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=23 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=24 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=25 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=26 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=27 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=28 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=29 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=30 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=31 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=0 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=1 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=2 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=3 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=4 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=5 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=6 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=7 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=8 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=9 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=10 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=11 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=12 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=13 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=14 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=15 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=16 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=17 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=18 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=19 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=20 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=21 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=22 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=23 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=24 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=25 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=26 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=27 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=28 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=29 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=30 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=4 property=c2 data=0x00.00.00.00 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=4 property=cn1 data=0x04.04.04.04 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis unit=0 portlist=31 lane-cnt=4 property=c1 data=0x02.02.02.02 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c2 data=0x01 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=cn1 data=0x01 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c0 data=0x02 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c1 data=0x03 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c2 data=0x01 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=cn1 data=0x01 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c0 data=0x02 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c1 data=0x03 +port set property unit=0 portlist=0-31 speed=100g +port set property unit=0 portlist=129-130 speed=10g +port set property unit=0 portlist=0-31 medium-type=cr4 +port set property unit=0 portlist=129-130 medium-type=kr +port set property unit=0 portlist=0-31 fec=disable +port set adver unit=0 portlist=129-130 speed-10g-kr +port set property unit=0 portlist=129-130 an=enable +port set property unit=0 portlist=0-31,129-130 admin=enable diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json.j2 b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json.j2 index 62464d7d39f0..5c5fc6e4969b 100644 --- a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json.j2 +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/INGRASYS-S9130-32X/qos.json.j2 @@ -1,153 +1,136 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "1", - "1": "0", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "1", - "1": "0", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"1", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184128", - "green_min_threshold": "184128" - }, - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184128", - "green_min_threshold": "184128" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"1", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"613984", + "red_min_threshold":"76608", + "yellow_max_threshold":"628320", + "yellow_min_threshold":"78400", + "green_max_threshold": "642656", + "green_min_threshold": "80192" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"613984", + "red_min_threshold":"76608", + "yellow_max_threshold":"628320", + "yellow_min_threshold":"78400", + "green_max_threshold": "642656", + "green_min_threshold": "80192" + } + }, + "QUEUE": { + } +} diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml index 6b29a7eb83b8..949ea6641b07 100644 --- a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml @@ -1,55 +1,6 @@ - - - OCPSCH0104001MS - 10.10.1.26 - OCPSCH01040GGLF - 10.10.1.25 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.26 - OCPSCH01040GGLF - 10.10.2.25 - 1 - 10 - 3 - - - - - 64536 - OCPSCH01040GGLF - - -
10.10.1.26
- - -
- -
10.10.2.26
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
@@ -72,18 +23,7 @@ OCPSCH01040GGLF - - - - Ethernet0 - 10.10.1.25/30 - - - - Ethernet4 - 10.10.2.25/30 - - + @@ -91,24 +31,7 @@ - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - OCPSCH01040GGLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - OCPSCH01040GGLF - Ethernet4 - - + OCPSCH01040GGLF @@ -136,11 +59,6 @@ - - ErspanDestinationIpv4 - - 2.2.2.2 - diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 new file mode 100644 index 000000000000..9354b7ec5b59 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers_defaults_t0.j2 b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..82194b2c3188 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers_defaults_t0.j2 @@ -0,0 +1,69 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '20971328' %} +{% set ingress_lossy_pool_size = '20971328' %} +{% set egress_lossless_pool_size = '20971328' %} +{% set egress_lossy_pool_size = '20971328' %} + +{%- 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": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xon":"78400", + "xoff":"132160", + "size":"3584", + "static_th":"82880" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"3584", + "dynamic_th":"-1" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"3584", + "dynamic_th":"-4" + } + }, +{%- endmacro %} + +{# the typo of generate_pg_profils dued to buffers_config.j2 #} +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_pg_profils(port_names) %} + "BUFFER_PG": { + } +{%- endmacro %} + +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + } +{%- endmacro %} \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers_defaults_t1.j2 b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..82194b2c3188 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/buffers_defaults_t1.j2 @@ -0,0 +1,69 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '20971328' %} +{% set ingress_lossy_pool_size = '20971328' %} +{% set egress_lossless_pool_size = '20971328' %} +{% set egress_lossy_pool_size = '20971328' %} + +{%- 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": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xon":"78400", + "xoff":"132160", + "size":"3584", + "static_th":"82880" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"3584", + "dynamic_th":"-1" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"3584", + "dynamic_th":"-4" + } + }, +{%- endmacro %} + +{# the typo of generate_pg_profils dued to buffers_config.j2 #} +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_pg_profils(port_names) %} + "BUFFER_PG": { + } +{%- endmacro %} + +{# Default, we do not bind any buffer profiles. #} +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { + } +{%- endmacro %} \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/pg_profile_lookup.ini b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/pg_profile_lookup.ini new file mode 100644 index 000000000000..d98b0eca6d19 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 3584 32256 59136 36736 + 25000 5m 3584 41216 68096 45696 + 40000 5m 3584 47488 74368 51968 + 50000 5m 3584 52864 79744 57344 + 100000 5m 3584 78400 132160 82880 + 10000 40m 3584 32256 59136 36736 + 25000 40m 3584 41216 68096 45696 + 40000 40m 3584 47488 74368 51968 + 50000 40m 3584 52864 79744 57344 + 100000 40m 3584 78400 132160 82880 + 10000 300m 3584 32256 65856 36736 + 25000 300m 3584 41216 84672 45696 + 40000 300m 3584 47488 101024 51968 + 50000 300m 3584 52864 113120 57344 + 100000 300m 3584 78400 198688 82880 \ No newline at end of file diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json.j2 b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json.j2 index 434226afca71..5c5fc6e4969b 100644 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json.j2 +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/INGRASYS-S9230-64X/qos.json.j2 @@ -1,153 +1,136 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "1", - "1": "0", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "1", - "1": "0", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"1", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220,Ethernet224,Ethernet228,Ethernet232,Ethernet236,Ethernet240,Ethernet244,Ethernet248,Ethernet252": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184128", - "green_min_threshold": "184128" - }, - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184128", - "green_min_threshold": "184128" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220,Ethernet224,Ethernet228,Ethernet232,Ethernet236,Ethernet240,Ethernet244,Ethernet248,Ethernet252|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220,Ethernet224,Ethernet228,Ethernet232,Ethernet236,Ethernet240,Ethernet244,Ethernet248,Ethernet252|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220,Ethernet224,Ethernet228,Ethernet232,Ethernet236,Ethernet240,Ethernet244,Ethernet248,Ethernet252|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"1", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"613984", + "red_min_threshold":"76608", + "yellow_max_threshold":"628320", + "yellow_min_threshold":"78400", + "green_max_threshold": "642656", + "green_min_threshold": "80192" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"613984", + "red_min_threshold":"76608", + "yellow_max_threshold":"628320", + "yellow_min_threshold":"78400", + "green_max_threshold": "642656", + "green_min_threshold": "80192" + } + }, + "QUEUE": { + } +} diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml index 9ac02997e44d..048bbbdd156f 100644 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml @@ -1,55 +1,6 @@ - - - OCPSCH0104001MS - 10.10.1.26 - OCPSCH01040GGLF - 10.10.1.25 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.26 - OCPSCH01040GGLF - 10.10.2.25 - 1 - 10 - 3 - - - - - 64536 - OCPSCH01040GGLF - - -
10.10.1.26
- - -
- -
10.10.2.26
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
@@ -72,18 +23,7 @@ OCPSCH01040GGLF - - - - Ethernet0 - 10.10.1.25/30 - - - - Ethernet4 - 10.10.2.25/30 - - + @@ -91,24 +31,7 @@ - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - OCPSCH01040GGLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - OCPSCH01040GGLF - Ethernet4 - - + OCPSCH01040GGLF @@ -136,11 +59,6 @@ - - ErspanDestinationIpv4 - - 2.2.2.2 - diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-fan.c b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-fan.c index 4fd1b91e26dc..f5159c8f166e 100644 --- a/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-fan.c +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/x86-64-accton-as7116-54x-fan.c @@ -109,7 +109,17 @@ enum sysfs_fan_attributes { FAN2_REAR_FAULT, FAN3_REAR_FAULT, FAN4_REAR_FAULT, - FAN5_REAR_FAULT + FAN5_REAR_FAULT, + FAN1_INPUT, /* FAN1_FRONT_SPEED_RPM, */ + FAN2_INPUT, /* FAN2_FRONT_SPEED_RPM, */ + FAN3_INPUT, /* FAN3_FRONT_SPEED_RPM, */ + FAN4_INPUT, /* FAN4_FRONT_SPEED_RPM, */ + FAN5_INPUT, /* FAN5_FRONT_SPEED_RPM, */ + FAN6_INPUT, /* FAN1_REAR_SPEED_RPM, */ + FAN7_INPUT, /* FAN2_REAR_SPEED_RPM, */ + FAN8_INPUT, /* FAN3_REAR_SPEED_RPM, */ + FAN9_INPUT, /* FAN4_REAR_SPEED_RPM, */ + FAN10_INPUT, /* FAN5_REAR_SPEED_RPM */ }; /* Define attributes @@ -138,6 +148,10 @@ enum sysfs_fan_attributes { #define DECLARE_FAN_SPEED_RPM_ATTR(index) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr +#define DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_INPUT) +#define DECLARE_FAN_INPUT_ATTR(index) &sensor_dev_attr_fan##index##_input.dev_attr.attr + /* 6 fan fault attributes in this platform */ DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1); DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2); @@ -165,6 +179,19 @@ DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); /* 1 fan duty cycle attribute in this platform */ DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(); +/* fan input attributes in this platform */ +DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(5); + +DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(6); +DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(7); +DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(8); +DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(9); +DECLARE_FAN_INPUT_SENSOR_DEV_ATTR(10); + static struct attribute *as7116_54x_fan_attributes[] = { /* fan related attributes */ DECLARE_FAN_FAULT_ATTR(1), @@ -188,6 +215,16 @@ static struct attribute *as7116_54x_fan_attributes[] = { DECLARE_FAN_DIRECTION_ATTR(4), DECLARE_FAN_DIRECTION_ATTR(5), DECLARE_FAN_DUTY_CYCLE_ATTR(), + DECLARE_FAN_INPUT_ATTR(1), + DECLARE_FAN_INPUT_ATTR(2), + DECLARE_FAN_INPUT_ATTR(3), + DECLARE_FAN_INPUT_ATTR(4), + DECLARE_FAN_INPUT_ATTR(5), + DECLARE_FAN_INPUT_ATTR(6), + DECLARE_FAN_INPUT_ATTR(7), + DECLARE_FAN_INPUT_ATTR(8), + DECLARE_FAN_INPUT_ATTR(9), + DECLARE_FAN_INPUT_ATTR(10), NULL }; @@ -340,6 +377,19 @@ static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, reg_val_to_direction(data->reg_val[FAN_DIRECTION_REG], attr->index - FAN1_DIRECTION)); break; + case FAN1_INPUT: + case FAN2_INPUT: + case FAN3_INPUT: + case FAN4_INPUT: + case FAN5_INPUT: + case FAN6_INPUT: + case FAN7_INPUT: + case FAN8_INPUT: + case FAN9_INPUT: + case FAN10_INPUT: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index + - FAN1_INPUT + FAN1_FRONT_SPEED_RPM])); + break; default: break; } diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/accton_as7116_util.py b/platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/accton_as7116_util.py index 17c56f7beb53..26a8a3cc8f84 100755 --- a/platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/accton_as7116_util.py +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/utils/accton_as7116_util.py @@ -251,7 +251,15 @@ def device_install(): if status: print output if FORCE == 0: - return status + return status + + if i <= 47: + status, output =log_os_system("echo as7116_54x_sfp"+str(i+1)+" 0x51 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return def device_uninstall(): From b7eeba8b917ad2e7baa81dd0d347945c0118706a Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Tue, 7 Aug 2018 09:03:35 -0700 Subject: [PATCH 1455/1833] Moving get_routing_stack() to a centralized location to avoid code dups (#1714) * Moving get_routing_stack() to a centralized location to avoid code duplication Various areas of sonic-utilities are now demanding this functionality so i'm simply moving this routing to a centralized location. After spending some time debating about the ideal location for this function, we thought about sonic-config-engine/sonic_platform.py as the closest match. Functional tests' output will be provided as part of the equivalent PR to be submitted shortly within sonic-utilities repo. * Adding comment to function. --- src/sonic-config-engine/sonic_platform.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/sonic-config-engine/sonic_platform.py b/src/sonic-config-engine/sonic_platform.py index 55ad2325f5db..20890d765cab 100644 --- a/src/sonic-config-engine/sonic_platform.py +++ b/src/sonic-config-engine/sonic_platform.py @@ -54,7 +54,7 @@ def get_system_mac(): return None mac = mac.strip() - + # Align last byte of MAC if necessary if version_info and (version_info['asic_type'] == 'mellanox' or version_info['asic_type'] == 'centec'): last_byte = mac[-2:] @@ -62,3 +62,24 @@ def get_system_mac(): mac = mac[:-2] + aligned_last_byte return mac +# +# Function to obtain the routing-stack being utilized. Function is not +# platform-specific; it's being placed in this file temporarily till a more +# suitable location is identified as part of upcoming refactoring efforts. +# +def get_system_routing_stack(): + command = "sudo docker ps | grep bgp | awk '{print$2}' | cut -d'-' -f3 | cut -d':' -f1" + + try: + proc = subprocess.Popen(command, + stdout=subprocess.PIPE, + shell=True, + stderr=subprocess.STDOUT) + stdout = proc.communicate()[0] + proc.wait() + result = stdout.rstrip('\n') + + except OSError, e: + raise OSError("Cannot detect routing-stack") + + return result From 314eae5c9e829f1d74f62e45ca290fb06fb4fb86 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 7 Aug 2018 14:36:54 -0700 Subject: [PATCH 1456/1833] [minigraph.py] Support parsing console ports (#1898) --- src/sonic-config-engine/minigraph.py | 30 +++++++++++++++++-- .../tests/simple-sample-graph-case.xml | 9 ++++++ .../tests/test_minigraph_case.py | 5 ++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 1ad76b0b37d9..19a4b0ceba7a 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -66,10 +66,32 @@ def parse_png(png, hname): mgmt_dev = '' mgmt_port = '' port_speeds = {} + console_ports = {} for child in png: if child.tag == str(QName(ns, "DeviceInterfaceLinks")): for link in child.findall(str(QName(ns, "DeviceLinkBase"))): linktype = link.find(str(QName(ns, "ElementType"))).text + if linktype == "DeviceSerialLink": + enddevice = link.find(str(QName(ns, "EndDevice"))).text + endport = link.find(str(QName(ns, "EndPort"))).text + startdevice = link.find(str(QName(ns, "StartDevice"))).text + startport = link.find(str(QName(ns, "StartPort"))).text + baudrate = link.find(str(QName(ns, "Bandwidth"))).text + flowcontrol = 1 if link.find(str(QName(ns, "FlowControl"))) is not None and link.find(str(QName(ns, "FlowControl"))).text == 'true' else 0 + if enddevice.lower() == hname.lower(): + console_ports[endport] = { + 'remote_device': startdevice, + 'baud_rate': baudrate, + 'flow_control': flowcontrol + } + else: + console_ports[startport] = { + 'remote_device': enddevice, + 'baud_rate': baudrate, + 'flow_control': flowcontrol + } + continue + if linktype != "DeviceInterfaceLink" and linktype != "UnderlayInterfaceLink": continue @@ -118,7 +140,7 @@ def parse_png(png, hname): elif node.tag == str(QName(ns, "EndDevice")): mgmt_dev = node.text - return (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speeds) + return (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speeds, console_ports) def parse_dpg(dpg, hname): @@ -399,6 +421,7 @@ def parse_xml(filename, platform=None, port_config_file=None): port_speeds_default = {} port_speed_png = {} port_descriptions = {} + console_ports = {} syslog_servers = [] dhcp_servers = [] ntp_servers = [] @@ -424,9 +447,9 @@ def parse_xml(filename, platform=None, port_config_file=None): elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_asn, bgp_peers_with_range) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): - (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speed_png) = parse_png(child, hostname) + (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speed_png, console_ports) = parse_png(child, hostname) elif child.tag == str(QName(ns, "UngDec")): - (u_neighbors, u_devices, _, _, _, _, _) = parse_png(child, hostname) + (u_neighbors, u_devices, _, _, _, _, _, _) = parse_png(child, hostname) elif child.tag == str(QName(ns, "MetadataDeclaration")): (syslog_servers, dhcp_servers, ntp_servers, tacacs_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname) elif child.tag == str(QName(ns, "DeviceInfos")): @@ -494,6 +517,7 @@ def parse_xml(filename, platform=None, port_config_file=None): ports.setdefault(port_name, {})['description'] = port_descriptions[port_name] results['PORT'] = ports + results['CONSOLE_PORT'] = console_ports if port_config_file: port_set = set(ports.keys()) diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml index 722d50f5ecd6..5a776099017d 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -182,6 +182,15 @@ + + DeviceSerialLink + 9600 + switch-t0 + 1 + true + managed_device + console + DeviceInterfaceLink true diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 4ceccb32a686..85110f56f7b9 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -89,6 +89,11 @@ def test_minigraph_portchannels(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'PortChannel01': {'members': ['Ethernet4']}}") + def test_minigraph_console_port(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v CONSOLE_PORT' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'1': {'baud_rate': '9600', 'remote_device': 'managed_device', 'flow_control': 1}}") + def test_minigraph_deployment_id(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"' output = self.run_script(argument) From 4d784d82ce3197762a97859df2c7a2a7580f136c Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 8 Aug 2018 18:29:17 -0700 Subject: [PATCH 1457/1833] Upgrade azure-keyvault to known compatible version (#1906) * Upgrade azure-keyvault to known compatible version * (fix typo) --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index cd2fd5ff37dd..2feac5403539 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -101,6 +101,7 @@ RUN azure-cli_bundle_*/installer # Known bug: azure keyvault cannot work behind a proxy # Temporary fix: upgrade the azure-keyvault package within az cli -RUN ~/lib/azure-cli/bin/python -m pip install azure-keyvault -U +# TODO: if azure-cli contains newer version azure-keyvault, remove this +RUN ~/lib/azure-cli/bin/python -m pip install azure-keyvault==0.3.7 -U RUN git clone https://github.com/Azure/sonic-mgmt From 7aefa185d4774cf5d1794a3e3add7962a2b91213 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 9 Aug 2018 23:56:41 -0700 Subject: [PATCH 1458/1833] Download newer version (8.23.0-2) of rsyslog from jessie-backports in hopes of eliminating memory leaks (#1912) --- build_debian.sh | 5 ++++- dockers/docker-base/Dockerfile.j2 | 5 ++++- dockers/docker-base/sources.list | 1 + files/apt/sources.list | 1 + .../debian_archive_trafficmanager_net_debian.list | 1 + sonic-slave/Dockerfile | 2 +- 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 767dd7b83b79..993687534787 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -200,7 +200,6 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in openssh-server \ python \ python-setuptools \ - rsyslog \ monit \ python-apt \ traceroute \ @@ -228,6 +227,10 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in tcptraceroute \ mtr-tiny +# Install a newer version of rsyslog from jessie-backports in hopes of +# eliminating memory leaks +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y -t jessie-backports install rsyslog + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ grub-pc-bin diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index 98f8237cee57..bd5c91faa9db 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -25,12 +25,15 @@ RUN apt-get update # Pre-install fundamental packages RUN apt-get -y install \ - rsyslog \ vim-tiny \ perl \ python \ 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 + # Pre-install troubleshooting packages RUN apt-get -y install socat diff --git a/dockers/docker-base/sources.list b/dockers/docker-base/sources.list index 2ed195cff416..7121d6fd8c2d 100644 --- a/dockers/docker-base/sources.list +++ b/dockers/docker-base/sources.list @@ -5,3 +5,4 @@ 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/files/apt/sources.list b/files/apt/sources.list index 2ed195cff416..7121d6fd8c2d 100644 --- a/files/apt/sources.list +++ b/files/apt/sources.list @@ -5,3 +5,4 @@ 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/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list b/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list index d5ecf56d4069..4daa3ccba677 100644 --- a/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list +++ b/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list @@ -1,2 +1,3 @@ deb 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 http://debian-archive.trafficmanager.net/debian/ jessie-backports main contrib non-free diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index f66b3e07d7b0..768d1c73e89e 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -6,7 +6,7 @@ RUN echo "deb http://debian-archive.trafficmanager.net/debian/ jessie main contr 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' >> /etc/apt/sources.list + echo "deb http://debian-archive.trafficmanager.net/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive From 3c3c19e600e05a775ca72eaea0f92b3cd7dea65d Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Thu, 9 Aug 2018 23:58:30 -0700 Subject: [PATCH 1459/1833] [lldp]: LLDP is misbehaving if netlink messages were lost due to timing issue. (#1909) The behavior could be that we are sending LLDP message but not using lldpcli configured properties if netlink delete messages were lost. It also could be that some interfaces do not sending messages at all. "lldpcli show statistics" could see duplicated or missing interfaces. Changes: Upgrade lldpd to 0.9.6 (which introduced the adjustable netlink buffer size) Change the netlink receive buffer size to 1MB --- rules/lldpd.mk | 2 +- src/lldpd/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/lldpd.mk b/rules/lldpd.mk index 10f3a200fc94..0e0d13721f83 100644 --- a/rules/lldpd.mk +++ b/rules/lldpd.mk @@ -1,6 +1,6 @@ # lldpd package -LLDPD_VERSION = 0.9.5 +LLDPD_VERSION = 0.9.6 LLDPD = lldpd_$(LLDPD_VERSION)-0_amd64.deb $(LLDPD)_DEPENDS += $(LIBSNMP_DEV) diff --git a/src/lldpd/Makefile b/src/lldpd/Makefile index c34062505d4e..5f502b86863c 100644 --- a/src/lldpd/Makefile +++ b/src/lldpd/Makefile @@ -23,7 +23,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : stg import -s ../patch/series # Build source and Debian packages - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + env "with_netlink_receive_bufsize=1024*1024" dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd # Move the newly-built .deb packages to the destination directory From 36e9ad510db55ac25eea8d8c7acf81a2a6cd1a71 Mon Sep 17 00:00:00 2001 From: simonJi2018 <37395146+simonJi2018@users.noreply.github.com> Date: Fri, 10 Aug 2018 14:59:16 +0800 Subject: [PATCH 1460/1833] [devices]: update submodule platform/nephos/sonic-platform-modules-ingrasys from 7181a0 to 796169 (#1910) * Upgrade SAI to v1.2.4 * Add a new supported device accton as7116 * Add maintainer info for deb * Add mk file for accton 7116 * fix some bug for sai 1.2.4 * fix git commit error for sdk and sai * change sai and sdk deb name * add config file for qos support * initial commit * Delete qos.json * Delete buffers.json.j2 * Delete qos.json * Delete buffers.json.j2 * Delete buffers.json.j2 * Delete qos.json * add support for sai 1.3.0 * add qos and buffer file for device and add sensor driver for 7116 * change buffer template * fix fan led bug --- platform/nephos/sonic-platform-modules-ingrasys | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/nephos/sonic-platform-modules-ingrasys b/platform/nephos/sonic-platform-modules-ingrasys index 7181a00e42c2..796169e43aee 160000 --- a/platform/nephos/sonic-platform-modules-ingrasys +++ b/platform/nephos/sonic-platform-modules-ingrasys @@ -1 +1 @@ -Subproject commit 7181a00e42c292472e1327b9890bdcfac810e407 +Subproject commit 796169e43aee944fdf7b549d04cb181117e0fb89 From ae843186a56238dab46188608fd1c6eb96f012da Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Sat, 11 Aug 2018 01:37:16 +0300 Subject: [PATCH 1461/1833] [Mellanox] Update hw-management service config (#1914) Signed-off-by: Andriy Moroz --- .../mellanox/hw-management/Add-systemd-service-config.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/mellanox/hw-management/Add-systemd-service-config.patch b/platform/mellanox/hw-management/Add-systemd-service-config.patch index 4903f508bce6..bbaed885dcb3 100644 --- a/platform/mellanox/hw-management/Add-systemd-service-config.patch +++ b/platform/mellanox/hw-management/Add-systemd-service-config.patch @@ -29,7 +29,7 @@ new file mode 100644 index 0000000..d18916d --- /dev/null +++ b/debian/hw-management.service -@@ -0,0 +1,10 @@ +@@ -0,0 +1,11 @@ +[Unit] +Description=Mellanox Hardware Management + @@ -37,6 +37,7 @@ index 0000000..d18916d +Type=oneshot +EnvironmentFile=/host/machine.conf +ExecStart=/bin/bash -c "/usr/share/sonic/device/$onie_platform/hw-management start" ++ExecStop=/bin/bash -c "/usr/share/sonic/device/$onie_platform/hw-management stop" + +[Install] +WantedBy=multi-user.target From 9e2ceb7cba6b69349057e0d611dfa3543559f39d Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 10 Aug 2018 21:56:15 -0700 Subject: [PATCH 1462/1833] [sonic-platform-common] Update submodule (#1915) --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index d98600e8ed8d..664d6cc37b14 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit d98600e8ed8df0280cb07487132e20adc48d7f6e +Subproject commit 664d6cc37b1404ce076bf1addb62e55f93240258 From 4d701ad0374a828507a7d6ab181f6266ac37a799 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 5 Sep 2017 09:07:05 +0000 Subject: [PATCH 1463/1833] [baseimage]: update base image from jessie to stretch --- build_debian.sh | 4 ++-- files/apt/sources.list | 9 ++++----- .../debian_archive_trafficmanager_net_debian.list | 5 ++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 993687534787..90d218ce9986 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -29,7 +29,7 @@ set -x -e ## docker engine version (with platform) -DOCKER_VERSION=1.11.1-0~jessie_amd64 +DOCKER_VERSION=1.11.1-0~stretch_amd64 ## Working directory to prepare the file system FILESYSTEM_ROOT=./fsroot @@ -64,7 +64,7 @@ touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime ## Build a basic Debian system by debootstrap echo '[INFO] Debootstrap...' -sudo http_proxy=$http_proxy debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://debian-archive.trafficmanager.net/debian +sudo http_proxy=$http_proxy debootstrap --variant=minbase --arch amd64 stretch $FILESYSTEM_ROOT http://debian-archive.trafficmanager.net/debian ## Config hostname and hosts, otherwise 'sudo ...' will complain 'sudo: unable to resolve host ...' sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '$HOSTNAME' > /etc/hostname" diff --git a/files/apt/sources.list b/files/apt/sources.list index 7121d6fd8c2d..bbcbbe64f691 100644 --- a/files/apt/sources.list +++ b/files/apt/sources.list @@ -1,8 +1,7 @@ ## Debian mirror on Microsoft Azure ## Ref: http://debian-archive.trafficmanager.net/ -deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free -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 +deb http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free +deb-src http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free +deb http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free +deb-src http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free diff --git a/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list b/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list index 4daa3ccba677..1ddb193b1034 100644 --- a/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list +++ b/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list @@ -1,3 +1,2 @@ -deb 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 http://debian-archive.trafficmanager.net/debian/ jessie-backports main contrib non-free +deb http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free +deb http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free From ff1f508f33aa95836f5a098db12b0a8728eef1cb Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Fri, 1 Sep 2017 07:35:36 +0000 Subject: [PATCH 1464/1833] [baseimage]: use debian 4.9.0-3 kernel --- .gitmodules | 3 ++- build_debian.sh | 5 +++-- installer/x86_64/install.sh | 4 ++-- rules/linux-kernel.mk | 8 ++++---- slave.mk | 2 ++ src/igb/Makefile | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index b36e0f3e8865..ffde4484d85c 100755 --- a/.gitmodules +++ b/.gitmodules @@ -3,7 +3,8 @@ url = https://github.com/Azure/sonic-swss-common [submodule "sonic-linux-kernel"] path = src/sonic-linux-kernel - url = https://github.com/Azure/sonic-linux-kernel + url = https://github.com/lguohan/sonic-linux-kernel + branch = stretch [submodule "sonic-sairedis"] path = src/sonic-sairedis url = https://github.com/Azure/sonic-sairedis diff --git a/build_debian.sh b/build_debian.sh index 90d218ce9986..ef367b4125a5 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -30,6 +30,7 @@ set -x -e ## docker engine version (with platform) DOCKER_VERSION=1.11.1-0~stretch_amd64 +LINUX_KERNEL_VERSION=4.9.0-3 ## Working directory to prepare the file system FILESYSTEM_ROOT=./fsroot @@ -110,7 +111,7 @@ echo '[INFO] Install SONiC linux kernel image' ## Note: duplicate apt-get command to ensure every line return zero sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/initramfs-tools_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-3.16.0-5-amd64_*.deb || \ +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-${LINUX_KERNEL_VERSION}-amd64_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f ## Update initramfs for booting with squashfs+aufs @@ -148,7 +149,7 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Install latest intel igb driver -sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-5-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko +sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/${LINUX_KERNEL_VERSION}-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko ## Install latest intel ixgbe driver sudo cp target/debs/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-5-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 91dd57a74ba1..e40dfbd31642 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -570,11 +570,11 @@ menuentry '$demo_grub_entry' { if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 - linux /$image_dir/boot/vmlinuz-3.16.0-5-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ + linux /$image_dir/boot/vmlinuz-4.9.0-3-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' - initrd /$image_dir/boot/initrd.img-3.16.0-5-amd64 + initrd /$image_dir/boot/initrd.img-4.9.0-3-amd64 } EOF diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index b7c1263990f5..c7eea31354bb 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -1,9 +1,9 @@ # linux kernel package -KVERSION_SHORT = 3.16.0-5 -KVERSION ?= $(KVERSION_SHORT)-amd64 -KERNEL_VERSION = 3.16.51 -KERNEL_SUBVERSION = 3+deb8u1 +KVERSION_SHORT = 4.9.0-3 +KVERSION = $(KVERSION_SHORT)-amd64 +KERNEL_VERSION = 4.9.30 +KERNEL_SUBVERSION = 2+deb9u5 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION diff --git a/slave.mk b/slave.mk index 722698b5c7cb..d21670d241b5 100644 --- a/slave.mk +++ b/slave.mk @@ -447,6 +447,8 @@ $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TA $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ .platform \ onie-image.conf \ + build_debian.sh \ + build_image.sh \ $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) \ $$(addprefix $(DEBS_PATH)/,$$($$*_INSTALLS)) \ $$(addprefix $(DEBS_PATH)/,$$($$*_LAZY_INSTALLS)) \ diff --git a/src/igb/Makefile b/src/igb/Makefile index cafa96aba772..8fefa2ed2ae5 100644 --- a/src/igb/Makefile +++ b/src/igb/Makefile @@ -15,7 +15,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Build the package pushd src - export BUILD_KERNEL=$(KVERSION) + export BUILD_KERNEL=4.9.0-3-amd64 make popd From b6af83ccf8da6af3b27160069e603c3e0d85af8f Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Fri, 1 Sep 2017 08:53:21 +0000 Subject: [PATCH 1465/1833] [baseimage]: upgrade initramfs to 0.130 --- build_debian.sh | 2 ++ rules/initramfs-tools.mk | 2 +- src/initramfs-tools/Makefile | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index ef367b4125a5..bd5a363761ec 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -109,6 +109,8 @@ sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c 'cd /dev && MAKEDEV generic' sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install busybox echo '[INFO] Install SONiC linux kernel image' ## Note: duplicate apt-get command to ensure every line return zero +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/initramfs-tools-core_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/initramfs-tools_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-${LINUX_KERNEL_VERSION}-amd64_*.deb || \ diff --git a/rules/initramfs-tools.mk b/rules/initramfs-tools.mk index ef06c1056d41..9fbeb249a6b0 100644 --- a/rules/initramfs-tools.mk +++ b/rules/initramfs-tools.mk @@ -1,6 +1,6 @@ # initramfs-tools package -INITRAMFS_TOOLS_VERSION = 0.120 +INITRAMFS_TOOLS_VERSION = 0.130 export INITRAMFS_TOOLS_VERSION INITRAMFS_TOOLS = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb diff --git a/src/initramfs-tools/Makefile b/src/initramfs-tools/Makefile index c5010e876d8b..c92d1b54838a 100644 --- a/src/initramfs-tools/Makefile +++ b/src/initramfs-tools/Makefile @@ -3,11 +3,12 @@ SHELL = /bin/bash .SHELLFLAGS += -e MAIN_TARGET = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb +DERIVED_TARGETS = initramfs-tools-core_$(INITRAMFS_TOOLS_VERSION)_all.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the initramfs-tools rm -rf ./initramfs-tools - git clone --branch v0.120 https://salsa.debian.org/kernel-team/initramfs-tools.git ./initramfs-tools + git clone --branch v0.130 https://salsa.debian.org/kernel-team/initramfs-tools.git ./initramfs-tools # Patch pushd ./initramfs-tools @@ -18,4 +19,6 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd - mv $* $(DEST)/ + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) From 72d70e98bea2077895d2677818d49293bcb5676d Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 2 Sep 2017 22:29:21 +0000 Subject: [PATCH 1466/1833] [baseimage]: install systemd-sysv in the base image --- build_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index bd5a363761ec..969ff9f0726b 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -95,7 +95,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'apt-mark auto `apt-mark showmanual` sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y update sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y upgrade echo '[INFO] Install packages for building image' -sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install makedev psmisc +sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install makedev psmisc systemd-sysv ## Create device files echo '[INFO] MAKEDEV' From f64ffe85717f952877876cb0dea889237a03f22b Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 2 Sep 2017 22:32:31 +0000 Subject: [PATCH 1467/1833] [baseimage]: build root filesystem via overlay fs instead of aufs --- build_debian.sh | 5 +++-- files/initramfs-tools/modules | 2 +- files/initramfs-tools/udev.patch | 10 ++++++++++ files/initramfs-tools/union-mount.j2 | 9 +++++---- 4 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 files/initramfs-tools/udev.patch diff --git a/build_debian.sh b/build_debian.sh index 969ff9f0726b..c5c1d23050eb 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -116,7 +116,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/initramfs-tools_*.deb || \ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-${LINUX_KERNEL_VERSION}-amd64_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f -## Update initramfs for booting with squashfs+aufs +## Update initramfs for booting with squashfs+overlay cat files/initramfs-tools/modules | sudo tee -a $FILESYSTEM_ROOT/etc/initramfs-tools/modules > /dev/null ## Hook into initramfs: change fs type from vfat to ext4 on arista switches @@ -148,6 +148,7 @@ sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tool 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 sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Install latest intel igb driver @@ -273,7 +274,7 @@ sudo sed -i ' ' $FILESYSTEM_ROOT/etc/monit/monitrc sudo tee -a $FILESYSTEM_ROOT/etc/monit/monitrc > /dev/null <<'EOF' -check filesystem root-aufs with path / +check filesystem root-overlay with path / if space usage > 90% for 5 times within 10 cycles then alert check filesystem var-log with path /var/log if space usage > 90% for 5 times within 10 cycles then alert diff --git a/files/initramfs-tools/modules b/files/initramfs-tools/modules index 1bd0eab15996..33f28b98b3f7 100644 --- a/files/initramfs-tools/modules +++ b/files/initramfs-tools/modules @@ -1,5 +1,5 @@ squashfs -aufs +overlay vfat nls_cp437 nls_utf8 diff --git a/files/initramfs-tools/udev.patch b/files/initramfs-tools/udev.patch new file mode 100644 index 000000000000..38c43dc27d69 --- /dev/null +++ b/files/initramfs-tools/udev.patch @@ -0,0 +1,10 @@ +--- a/udev 2017-09-02 23:13:45.078773236 +0000 ++++ b/udev 2017-09-02 22:40:08.502773236 +0000 +@@ -1,6 +1,6 @@ + #!/bin/sh -e + +-PREREQS="" ++PREREQS="union-mount" + + prereqs() { echo "$PREREQS"; } + diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index db40d4f08601..6369b8449681 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -11,18 +11,19 @@ case $1 in ;; esac -## Mount the aufs file system: rw layer over squashfs +## Mount the overlay file system: rw layer over squashfs image_dir=$(cat /proc/cmdline | sed -e 's/.*loop=\(\S*\)\/.*/\1/') mkdir -p ${rootmnt}/host/$image_dir/rw -mount -n -o dirs=${rootmnt}/host/$image_dir/rw:${rootmnt}=ro -t aufs root-aufs ${rootmnt} +mkdir -p ${rootmnt}/host/$image_dir/work +mount -n -o lowerdir=${rootmnt},upperdir=${rootmnt}/host/$image_dir/rw,workdir=${rootmnt}/host/$image_dir/work -t overlay root-overlay ${rootmnt} ## Check if the root block device is still there [ -b ${ROOT} ] || mdev -s ## Mount the raw partition again mount ${ROOT} ${rootmnt}/host -## Mount the working directory of docker engine in the raw partition, bypass the aufs +## Mount the working directory of docker engine in the raw partition, bypass the overlay mkdir -p ${rootmnt}/var/lib/docker mount --bind ${rootmnt}/host/$image_dir/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker -## Mount the boot directory in the raw partition, bypass the aufs +## Mount the boot directory in the raw partition, bypass the overlay mkdir -p ${rootmnt}/boot mount --bind ${rootmnt}/host/$image_dir/boot ${rootmnt}/boot ## Mount loop device for /var/log From dabbe63f998646e8ddcddb1df17d161196510cca Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 3 Sep 2017 08:02:31 +0000 Subject: [PATCH 1468/1833] [baseimage]: Disable consistent network device naming consistent network device naming is enabled in debian 9 kernel by default --- installer/x86_64/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index e40dfbd31642..eb7cab38609a 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -571,6 +571,7 @@ menuentry '$demo_grub_entry' { insmod part_msdos insmod ext2 linux /$image_dir/boot/vmlinuz-4.9.0-3-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ + net.ifnames=0 biosdevname=0 \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' From b03e974bb3ee0da499430dc2834964ee096fe8fa Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 5 Sep 2017 05:57:12 +0000 Subject: [PATCH 1469/1833] [baseimage]: let docker in base image use overlay fs instead of aufs --- files/build_templates/sonic_debian_extension.j2 | 1 + files/docker/docker.service.conf | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 02ac97ba2b9a..e57ac20528ca 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -42,6 +42,7 @@ clean_sys() { trap_push clean_sys sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs +sudo bash -c "echo \"DOCKER_OPTS=\"--storage-driver=overlay\"\" >> $FILESYSTEM_ROOT/etc/default/docker" sudo chroot $FILESYSTEM_ROOT service docker start # Apply apt configuration files diff --git a/files/docker/docker.service.conf b/files/docker/docker.service.conf index fba63af8f5f6..b124d94f70d1 100644 --- a/files/docker/docker.service.conf +++ b/files/docker/docker.service.conf @@ -1,3 +1,3 @@ [Service] ExecStart= -ExecStart=/usr/bin/docker daemon -H fd:// --storage-driver=aufs --bip=240.127.1.1/24 --iptables=false +ExecStart=/usr/bin/docker daemon -H fd:// --storage-driver=overlay --bip=240.127.1.1/24 --iptables=false From 376cabe6bf3b959c7b1bc6e02fcd4d07188cae9a Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 3 Sep 2017 09:11:31 +0000 Subject: [PATCH 1470/1833] [baseimage]: update igb driver to 5.3.5.10 --- rules/igb.mk | 2 +- src/igb/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/igb.mk b/rules/igb.mk index 9857c0517a0a..287689ad8d9e 100644 --- a/rules/igb.mk +++ b/rules/igb.mk @@ -1,6 +1,6 @@ # initramfs-tools package -IGB_DRIVER_VERSION = 5.3.5.4 +IGB_DRIVER_VERSION = 5.3.5.10 export IGB_DRIVER_VERSION IGB_DRIVER = igb.ko diff --git a/src/igb/Makefile b/src/igb/Makefile index 8fefa2ed2ae5..627c2035301e 100644 --- a/src/igb/Makefile +++ b/src/igb/Makefile @@ -6,7 +6,7 @@ MAIN_TARGET = igb.ko $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./igb-$(IGB_DRIVER_VERSION) - wget -O igb-$(IGB_DRIVER_VERSION).tar.gz "https://sonicstorage.blob.core.windows.net/packages/igb-5.3.5.4.tar.gz?sv=2015-04-05&sr=b&sig=Y7pO2Y%2FLTdQe1XucyRhMZdbHV5duAdvRYOqgJ5D7l4c%3D&se=2031-03-08T08%3A31%3A39Z&sp=r" + wget -O igb-$(IGB_DRIVER_VERSION).tar.gz "https://sonicstorage.blob.core.windows.net/packages/igb-5.3.5.10.tar.gz?sv=2015-04-05&sr=b&sig=JShcQUqXm13Ni6Qaa3RTo%2FeEDIfuaqUTec%2FpV2J5dyA%3D&se=2154-07-27T09%3A09%3A02Z&sp=r" tar xzf igb-$(IGB_DRIVER_VERSION).tar.gz # Patch From 87ec4f113b3498fd9e4d51ba609765875861fab4 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 5 Sep 2017 05:02:37 +0000 Subject: [PATCH 1471/1833] [docker-syncd]: install kmod in docker-syncd-brcm without prompt --- platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index bd6d6cc35706..8fab6c032b12 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -20,7 +20,7 @@ debs/{{ deb }}{{' '}} {%- endfor %} ## TODO: add kmod into Depends -RUN apt-get install -f kmod +RUN apt-get install -yf kmod COPY ["files/dsserve", "files/bcmcmd", "start.sh", "bcmsh", "/usr/bin/"] RUN chmod +x /usr/bin/dsserve /usr/bin/bcmcmd From 8d43f3b672275ed2ab3f18d6666a45d25bd5858d Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 9 Sep 2017 02:35:42 +0000 Subject: [PATCH 1472/1833] [sonic-slave]: add deps for build initramfs 0.130 --- sonic-slave/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 768d1c73e89e..961df459d003 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -228,8 +228,9 @@ RUN apt-get update && apt-get install -y \ python3-pytest \ python3-colorama \ # For bash - texi2html - + texi2html \ +# For initramfs + bash-completion # For linux build RUN apt-get -y build-dep linux From 8c72d8c6f27ab5b2f0a9dabd8afe0efbd1d1945d Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 13 Sep 2017 07:02:53 +0000 Subject: [PATCH 1473/1833] [build]: insert overlay kmod for base image build --- Makefile | 3 +++ files/build_templates/sonic_debian_extension.j2 | 1 + 2 files changed, 4 insertions(+) diff --git a/Makefile b/Makefile index ccbefc9e0138..e0118af892b4 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ SLAVE_TAG = $(shell cat sonic-slave/Dockerfile.user sonic-slave/Dockerfile | sha SLAVE_BASE_IMAGE = sonic-slave-base SLAVE_IMAGE = sonic-slave-$(USER) +INSMOD_OVERLAY := sudo modprobe overlay DOCKER_RUN := docker run --rm=true --privileged \ -v $(PWD):/sonic \ -w /sonic \ @@ -86,6 +87,7 @@ SONIC_BUILD_INSTRUCTION := make \ @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } + @$(INSMOD_OVERLAY) ifeq "$(KEEP_SLAVE_ON)" "yes" ifdef SOURCE_FOLDER @$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/$(USER)/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" @@ -107,6 +109,7 @@ sonic-slave-bash : @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } + @$(INSMOD_OVERLAY) @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash showtag: diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index e57ac20528ca..3160f76a53ea 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -44,6 +44,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs sudo bash -c "echo \"DOCKER_OPTS=\"--storage-driver=overlay\"\" >> $FILESYSTEM_ROOT/etc/default/docker" sudo chroot $FILESYSTEM_ROOT service docker start +sudo chroot $FILESYSTEM_ROOT docker info # Apply apt configuration files sudo cp $IMAGE_CONFIGS/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ From a87da7b1f94676a0490e9c4f4a3318ec5ad91d6d Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 23 Sep 2017 07:29:48 +0000 Subject: [PATCH 1474/1833] [build]: build stretch-based sonic slave docker --- Makefile | 15 +- sonic-slave-stretch/Dockerfile | 255 +++++++++++++++++++ sonic-slave-stretch/Dockerfile.user | 29 +++ sonic-slave-stretch/sonic-jenkins-id_rsa.pub | 1 + 4 files changed, 297 insertions(+), 3 deletions(-) create mode 100644 sonic-slave-stretch/Dockerfile create mode 100644 sonic-slave-stretch/Dockerfile.user create mode 100644 sonic-slave-stretch/sonic-jenkins-id_rsa.pub diff --git a/Makefile b/Makefile index e0118af892b4..6ce7250a9069 100644 --- a/Makefile +++ b/Makefile @@ -30,10 +30,19 @@ $(shell rm -f .screen) MAKEFLAGS += -B +ifeq ($(BLDENV), stretch) +SLAVE_BASE_TAG = $(shell sha1sum sonic-slave-stretch/Dockerfile | awk '{print substr($$1,0,11);}') +SLAVE_TAG = $(shell sha1sum sonic-slave-stretch/Dockerfile.user | awk '{print substr($$1,0,11);}') +SLAVE_BASE_IMAGE = sonic-slave-stretch-base +SLAVE_IMAGE = sonic-slave-stretch-$(USER) +SLAVE_DIR = sonic-slave-stretch +else SLAVE_BASE_TAG = $(shell sha1sum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') SLAVE_TAG = $(shell cat sonic-slave/Dockerfile.user sonic-slave/Dockerfile | sha1sum | awk '{print substr($$1,0,11);}') SLAVE_BASE_IMAGE = sonic-slave-base SLAVE_IMAGE = sonic-slave-$(USER) +SLAVE_DIR = sonic-slave +endif INSMOD_OVERLAY := sudo modprobe overlay DOCKER_RUN := docker run --rm=true --privileged \ @@ -47,7 +56,7 @@ DOCKER_BASE_BUILD = docker build --no-cache \ -t $(SLAVE_BASE_IMAGE) \ --build-arg http_proxy=$(http_proxy) \ --build-arg https_proxy=$(https_proxy) \ - sonic-slave && \ + $(SLAVE_DIR) && \ docker tag $(SLAVE_BASE_IMAGE):latest $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) DOCKER_BUILD = docker build --no-cache \ @@ -56,8 +65,8 @@ DOCKER_BUILD = docker build --no-cache \ --build-arg guid=$(shell id -g) \ --build-arg hostname=$(shell echo $$HOSTNAME) \ -t $(SLAVE_IMAGE) \ - -f sonic-slave/Dockerfile.user \ - sonic-slave && \ + -f $(SLAVE_DIR)/Dockerfile.user \ + $(SLAVE_DIR) && \ docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG) SONIC_BUILD_INSTRUCTION := make \ diff --git a/sonic-slave-stretch/Dockerfile b/sonic-slave-stretch/Dockerfile new file mode 100644 index 000000000000..3b1a333f4831 --- /dev/null +++ b/sonic-slave-stretch/Dockerfile @@ -0,0 +1,255 @@ +FROM debian:stretch + +MAINTAINER gulv@microsoft.com + +RUN echo "deb http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ + echo 'deb http://debian-archive.trafficmanager.net/debian stretch-backports main' >> /etc/apt/sources.list + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y \ + apt-utils \ + default-jre-headless \ + openssh-server \ + curl \ + wget \ + unzip \ + git \ + build-essential \ + libtool \ + lintian \ + sudo \ + dh-make \ + dh-exec \ + kmod \ + libtinyxml2-4 \ + libboost-program-options1.62-dev \ + libtinyxml2-dev \ + python \ + python-pip \ + libncurses5-dev \ + texinfo \ + dh-autoreconf \ + python3-pip \ + doxygen \ + devscripts \ + git-buildpackage \ + perl-modules \ + libswitch-perl \ + dh-systemd \ +# For quagga build + libreadline-dev \ + texlive-latex-base \ + texlive-generic-recommended \ + texlive-fonts-recommended \ + libpam0g-dev \ + libpam-dev \ + libcap-dev \ + imagemagick \ + ghostscript \ + groff \ + libpcre3-dev \ + gawk \ + chrpath \ +# For frr build + libc-ares-dev \ + libsnmp-dev \ + libjson-c3 \ + libjson-c-dev \ + libsystemd-dev \ + python-ipaddr \ +# For libnl3 (local) build + cdbs \ +# For SAI meta build + libxml-simple-perl \ + graphviz \ + aspell \ +# For linux build + bc \ + fakeroot \ + build-essential \ + devscripts \ + quilt \ + stgit \ +# For platform-modules build + module-assistant \ +# For thrift build\ + gem2deb \ + libboost-all-dev \ + libevent-dev \ + libglib2.0-dev \ + libqt4-dev \ + python-all-dev \ + python-twisted \ + phpunit \ + libbit-vector-perl \ + openjdk-8-jdk \ + javahelper \ + maven-debian-helper \ + ant \ + libmaven-ant-tasks-java \ + libhttpclient-java \ + libslf4j-java \ + libservlet3.1-java \ + qt5-default \ +# For mellanox sdk build + libpcre3 \ + libpcre3-dev \ + byacc \ + flex \ + libglib2.0-dev \ + bison \ + expat \ + libexpat1-dev \ + dpatch \ + libdb-dev \ + iptables-dev \ + swig \ +# For mellanox sai build + libtool-bin \ + libxml2-dev \ +# For build image + cpio \ + squashfs-tools \ + zip \ +# For broadcom sdk build + linux-compiler-gcc-6-x86 \ + linux-kbuild-4.9 \ +# teamd build + libdaemon-dev \ + libdbus-1-dev \ + libjansson-dev \ +# For cavium sdk build + libpcap-dev \ + dnsutils \ + libusb-dev \ +# For debian image reconfiguration + augeas-tools \ +# For p4 build + libyaml-dev \ + libevent-dev \ + libjudy-dev \ + libedit-dev \ + libnanomsg-dev \ + python-stdeb \ +# For redis build + libjemalloc-dev \ +# For mft kernel module build + dkms \ +# For python3.5 build + sharutils \ + libncursesw5-dev \ + libbz2-dev \ + liblzma-dev \ + libgdbm-dev \ + tk-dev \ + blt-dev \ + libmpdec-dev \ + libbluetooth-dev \ + locales \ + libsqlite3-dev \ + libgpm2 \ + time \ + net-tools \ + xvfb \ + python-sphinx \ + python3-sphinx \ +# For Jenkins static analysis, unit testing and code coverage + cppcheck \ + clang \ + pylint \ + python-pytest \ + gcovr \ + python-pytest-cov \ + python-parse \ +# For snmpd + default-libmysqlclient-dev \ + libssl-dev \ + libperl-dev \ + libpci-dev \ + libpci3 \ + libsensors4 \ + libsensors4-dev \ + libwrap0-dev \ +# For mpdecimal + docutils-common \ + libjs-sphinxdoc \ + libjs-underscore \ + python-docutils \ + python-jinja2 \ + python-markupsafe \ + python-pygments \ + python-roman \ + python-sphinx \ + sphinx-common \ + python3-sphinx \ +# For sonic config engine testing + python-lxml \ + python-jinja2 \ + python-netaddr \ + python-ipaddr \ + python-yaml \ +# For lockfile + procmail \ +# For gtest + libgtest-dev \ + cmake \ +# For initramfs + bash-completion + +# For linux build +RUN apt-get -y build-dep linux + +# For gobgp build +RUN export VERSION=1.8.3 \ + && wget https://storage.googleapis.com/golang/go$VERSION.linux-amd64.tar.gz \ + && tar -C /usr/local -xzf go$VERSION.linux-amd64.tar.gz \ + && echo 'export GOROOT=/usr/local/go' >> /etc/bash.bashrc \ + && echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/bash.bashrc + +# For p4 build +RUN pip install \ + ctypesgen \ + crc16 + +# For templating +RUN pip install j2cli + +# For sonic config engine testing +RUN pip install pyangbind==0.5.10 + +# For supervisor build +RUN pip install meld3 mock + +# Install dependencies for isc-dhcp-relay build +RUN apt-get -y build-dep isc-dhcp + +RUN cd /usr/src/gtest && cmake . && make -C /usr/src/gtest + +RUN mkdir /var/run/sshd +EXPOSE 22 + +# Install depot-tools (for git-retry) +RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /usr/share/depot_tools +ENV PATH /usr/share/depot_tools:$PATH + +# Install docker engine 17.03.2~ce-0 inside docker and enable experimental feature +RUN apt-get update +RUN apt-get install -y \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg2 \ + software-properties-common +RUN curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - +RUN add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/debian \ + $(lsb_release -cs) \ + stable" +RUN apt-get update +RUN apt-get install -y docker-ce=17.03.2~ce-0~debian-stretch +RUN echo "DOCKER_OPTS=\"--experimental\"" >> /etc/default/docker diff --git a/sonic-slave-stretch/Dockerfile.user b/sonic-slave-stretch/Dockerfile.user new file mode 100644 index 000000000000..0b44faaf4a53 --- /dev/null +++ b/sonic-slave-stretch/Dockerfile.user @@ -0,0 +1,29 @@ +FROM sonic-slave-stretch-base + +# Add user +ARG user +ARG uid +ARG guid +ARG hostname + +ENV BUILD_HOSTNAME $hostname +ENV USER $user + +RUN groupadd -f -r -g $guid g$user + +RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash + +RUN gpasswd -a $user docker + +# Config git for stg +RUN su $user -c "git config --global user.name $user" +RUN su $user -c "git config --global user.email $user@contoso.com" + +COPY sonic-jenkins-id_rsa.pub /var/$user/.ssh/authorized_keys2 +RUN chown $user /var/$user/.ssh -R +RUN chmod go= /var/$user/.ssh -R + +# Add user to sudoers +RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers + +USER $user diff --git a/sonic-slave-stretch/sonic-jenkins-id_rsa.pub b/sonic-slave-stretch/sonic-jenkins-id_rsa.pub new file mode 100644 index 000000000000..2a19c9e70d3c --- /dev/null +++ b/sonic-slave-stretch/sonic-jenkins-id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC769BQUJVeSIOyPsN4/Vo8xTqXQ6RI7ysVyCw/ABP3FIxf+fxmtm8t/Nbp9hq0uLHOjCw8UQbJ+XltsThFWJfH6RJY5NbfvwG7nUDjfjjp+SGEIHaVgIlpiuqiPbZ6QMjZ8Q0Sgi5p5ts1xe/4TFThwOJBHmhwydD5nk3BH7P3DDwlOCov5gjM40uMZJkketlO83zGG+25zu7O0hfDVt1vyK9bNWAhhPmGc79zdetfeFCxjimsff2m31B1KuVXiT5PDB1w+BSrUK6nNzJubnYCRgjg4prVTjA50EhlT2P7EoJAbW3TnTq8vUDkcstsGe/HZpfIB1VHBX97u4fAfGJZ root@acs-jenkins From a7192939a08529537cb8b55f97605a9ed7469101 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 26 Sep 2017 08:25:17 +0000 Subject: [PATCH 1475/1833] [build]: sonic-slave-stretch- sha both Dockerfile and Dockerfile.user --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6ce7250a9069..c5c5d59620c8 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ MAKEFLAGS += -B ifeq ($(BLDENV), stretch) SLAVE_BASE_TAG = $(shell sha1sum sonic-slave-stretch/Dockerfile | awk '{print substr($$1,0,11);}') -SLAVE_TAG = $(shell sha1sum sonic-slave-stretch/Dockerfile.user | awk '{print substr($$1,0,11);}') +SLAVE_TAG = $(shell cat sonic-slave-stretch/Dockerfile.user sonic-slave-stretch/Dockerfile | sha1sum | awk '{print substr($$1,0,11);}') SLAVE_BASE_IMAGE = sonic-slave-stretch-base SLAVE_IMAGE = sonic-slave-stretch-$(USER) SLAVE_DIR = sonic-slave-stretch From 540a87a9db285198186718ef5c47fe41f3373aee Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 5 Sep 2017 05:43:05 +0000 Subject: [PATCH 1476/1833] [opennsl]: use opennsl kernel module based on kernel 4.9.0-3 --- files/build_templates/swss.service.j2 | 8 ++++---- platform/broadcom/sdk.mk | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index e16ca6636121..510a5fff2e96 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -2,16 +2,16 @@ Description=switch state service Requires=database.service updategraph.service {% if sonic_asic_platform == 'broadcom' %} -Requires=opennsl-modules-3.16.0-5-amd64.service +Requires=opennsl-modules-4.9.0-3-amd64.service {% elif sonic_asic_platform == 'nephos' %} -Requires=nps-modules-3.16.0-5-amd64.service +Requires=nps-modules-4.9.0-3-amd64.service {% endif %} After=database.service updategraph.service After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} -After=opennsl-modules-3.16.0-5-amd64.service +After=opennsl-modules-4.9.0-3-amd64.service {% elif sonic_asic_platform == 'nephos' %} -After=nps-modules-3.16.0-5-amd64.service +After=nps-modules-4.9.0-3-amd64.service {% endif %} [Service] diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 2ffa374b1ba5..abdf689fe346 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,4 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-3.16.0-5-amd64_3.4.1.11-5_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-3.16.0-5-amd64_3.4.1.11-5_amd64.deb?sv=2015-04-05&sr=b&sig=VefDUeIdEvgV1007LX9P3aRmMAeO4hnMcIAyXkOBEp8%3D&se=2032-03-19T18%3A23%3A58Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-4.9.0-3-amd64_3.2.3.3-2_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-4.9.0-3-amd64_3.2.3.3-2_amd64.deb?sv=2015-04-05&sr=b&sig=HieTgULvva7WlMRegUhfoRFqkj2Oe9sAVxU%2FgCGj9Ys%3D&se=2154-09-28T04%3A46%3A03Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) From 5d1a7a1f3a8058c4b9c846f98fbe7e38895aeeee Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 3 Sep 2017 22:21:07 +0000 Subject: [PATCH 1477/1833] [temp]: disable building platform drivers tempoerarily --- platform/broadcom/rules.mk | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index d883b1668bb3..0e4551718547 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,15 +1,15 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk -include $(PLATFORM_PATH)/platform-modules-s6000.mk -include $(PLATFORM_PATH)/platform-modules-dell.mk -include $(PLATFORM_PATH)/platform-modules-arista.mk -include $(PLATFORM_PATH)/platform-modules-ingrasys.mk -include $(PLATFORM_PATH)/platform-modules-accton.mk -include $(PLATFORM_PATH)/platform-modules-inventec.mk -include $(PLATFORM_PATH)/platform-modules-cel.mk -include $(PLATFORM_PATH)/platform-modules-delta.mk -include $(PLATFORM_PATH)/platform-modules-quanta.mk -include $(PLATFORM_PATH)/platform-modules-mitac.mk +#include $(PLATFORM_PATH)/platform-modules-s6000.mk +#include $(PLATFORM_PATH)/platform-modules-dell.mk +#include $(PLATFORM_PATH)/platform-modules-arista.mk +#include $(PLATFORM_PATH)/platform-modules-ingrasys.mk +#include $(PLATFORM_PATH)/platform-modules-accton.mk +#include $(PLATFORM_PATH)/platform-modules-inventec.mk +#include $(PLATFORM_PATH)/platform-modules-cel.mk +#include $(PLATFORM_PATH)/platform-modules-delta.mk +#include $(PLATFORM_PATH)/platform-modules-quanta.mk +#include $(PLATFORM_PATH)/platform-modules-mitac.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk From 23c3bfe186515462702dff81c6cb5b0021b7ec3a Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 6 Nov 2017 02:49:04 +0000 Subject: [PATCH 1478/1833] [kernel]: fix linux-headers common deb file name --- rules/linux-kernel.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index c7eea31354bb..f1d589505a4d 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -7,7 +7,7 @@ KERNEL_SUBVERSION = 2+deb9u5 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION -LINUX_HEADERS_COMMON = linux-headers-$(KVERSION_SHORT)-common_$(KERNEL_VERSION)-$(KERNEL_SUBVERSION)_amd64.deb +LINUX_HEADERS_COMMON = linux-headers-$(KVERSION_SHORT)-common_$(KERNEL_VERSION)-$(KERNEL_SUBVERSION)_all.deb $(LINUX_HEADERS_COMMON)_SRC_PATH = $(SRC_PATH)/sonic-linux-kernel SONIC_MAKE_DEBS += $(LINUX_HEADERS_COMMON) From a0280dd5002d5c1769bf78b2714286edb458986f Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 6 Nov 2017 04:54:25 +0000 Subject: [PATCH 1479/1833] update build instructions --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 6bc218bf00a7..8d4a9e2f20fc 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,9 @@ The SONiC installer contains all docker images needed. SONiC uses one image for For Broadcom ASIC, we build ONIE and EOS image. EOS image is used for Arista devices, ONIE image is used for all other Broadcom ASIC based devices. make configure PLATFORM=broadcom + BLDENV=stretch make target/debs/linux-headers-4.9.0-3-common_4.9.30-2+deb9u5_all.deb target/debs/igb.ko # build ONIE image make target/sonic-broadcom.bin - # build EOS image - make target/sonic-aboot-broadcom.swi You may find the rules/config file useful. It contains configuration options for the build process, like adding more verbosity or showing dependencies, username and password for base image etc. From 2449fafae0820e40a213537a883253052d3d5bd4 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 6 Dec 2017 08:51:28 +0000 Subject: [PATCH 1480/1833] [kernel]: update kernel submodule and remove standalone igb driver --- README.md | 2 +- build_debian.sh | 3 - rules/igb.mk | 9 --- slave.mk | 1 - src/igb/Makefile | 23 ------- ...1-add-PHY-support-for-Broadcom-54616.patch | 61 ------------------- src/sonic-linux-kernel | 2 +- 7 files changed, 2 insertions(+), 99 deletions(-) delete mode 100644 rules/igb.mk delete mode 100644 src/igb/Makefile delete mode 100644 src/igb/patch/0001-add-PHY-support-for-Broadcom-54616.patch diff --git a/README.md b/README.md index 8d4a9e2f20fc..dc359d2b56d3 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ The SONiC installer contains all docker images needed. SONiC uses one image for For Broadcom ASIC, we build ONIE and EOS image. EOS image is used for Arista devices, ONIE image is used for all other Broadcom ASIC based devices. make configure PLATFORM=broadcom - BLDENV=stretch make target/debs/linux-headers-4.9.0-3-common_4.9.30-2+deb9u5_all.deb target/debs/igb.ko + BLDENV=stretch make target/debs/linux-headers-4.9.0-3-common_4.9.30-2+deb9u5_all.deb # build ONIE image make target/sonic-broadcom.bin diff --git a/build_debian.sh b/build_debian.sh index c5c1d23050eb..6af4346ab1d5 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -151,9 +151,6 @@ 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 sudo chroot $FILESYSTEM_ROOT update-initramfs -u -## Install latest intel igb driver -sudo cp target/debs/igb.ko $FILESYSTEM_ROOT/lib/modules/${LINUX_KERNEL_VERSION}-amd64/kernel/drivers/net/ethernet/intel/igb/igb.ko - ## Install latest intel ixgbe driver sudo cp target/debs/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-5-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko diff --git a/rules/igb.mk b/rules/igb.mk deleted file mode 100644 index 287689ad8d9e..000000000000 --- a/rules/igb.mk +++ /dev/null @@ -1,9 +0,0 @@ -# initramfs-tools package - -IGB_DRIVER_VERSION = 5.3.5.10 -export IGB_DRIVER_VERSION - -IGB_DRIVER = igb.ko -$(IGB_DRIVER)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -$(IGB_DRIVER)_SRC_PATH = $(SRC_PATH)/igb -SONIC_MAKE_DEBS += $(IGB_DRIVER) diff --git a/slave.mk b/slave.mk index d21670d241b5..c10b9c877e35 100644 --- a/slave.mk +++ b/slave.mk @@ -455,7 +455,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \ $(addprefix $(DEBS_PATH)/,$(INITRAMFS_TOOLS) \ $(LINUX_KERNEL) \ - $(IGB_DRIVER) \ $(IXGBE_DRIVER) \ $(SONIC_DEVICE_DATA) \ $(PYTHON_CLICK) \ diff --git a/src/igb/Makefile b/src/igb/Makefile deleted file mode 100644 index 627c2035301e..000000000000 --- a/src/igb/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -.ONESHELL: -SHELL = /bin/bash -.SHELLFLAGS += -e - -MAIN_TARGET = igb.ko - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - rm -rf ./igb-$(IGB_DRIVER_VERSION) - wget -O igb-$(IGB_DRIVER_VERSION).tar.gz "https://sonicstorage.blob.core.windows.net/packages/igb-5.3.5.10.tar.gz?sv=2015-04-05&sr=b&sig=JShcQUqXm13Ni6Qaa3RTo%2FeEDIfuaqUTec%2FpV2J5dyA%3D&se=2154-07-27T09%3A09%3A02Z&sp=r" - tar xzf igb-$(IGB_DRIVER_VERSION).tar.gz - - # Patch - pushd ./igb-$(IGB_DRIVER_VERSION) - patch -p1 < ../patch/0001-add-PHY-support-for-Broadcom-54616.patch - - # Build the package - pushd src - export BUILD_KERNEL=4.9.0-3-amd64 - make - popd - - popd - mv ./igb-$(IGB_DRIVER_VERSION)/src/$* $(DEST)/ diff --git a/src/igb/patch/0001-add-PHY-support-for-Broadcom-54616.patch b/src/igb/patch/0001-add-PHY-support-for-Broadcom-54616.patch deleted file mode 100644 index fc468f337356..000000000000 --- a/src/igb/patch/0001-add-PHY-support-for-Broadcom-54616.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 10ed7b7e0fd06c312f497e4647c4140b1cc8eef8 Mon Sep 17 00:00:00 2001 -From: Guohan Lu -Date: Mon, 8 May 2017 05:53:38 +0000 -Subject: [PATCH] add PHY support for Broadcom 54616 - ---- - src/e1000_82575.c | 5 +++++ - src/e1000_defines.h | 1 + - src/e1000_hw.h | 1 + - 3 files changed, 7 insertions(+) - -diff --git a/src/e1000_82575.c b/src/e1000_82575.c -index b4b973e..afaa7e5 100644 ---- a/src/e1000_82575.c -+++ b/src/e1000_82575.c -@@ -302,6 +302,9 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) - phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82580; - phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; - break; -+ case BCM54616_E_PHY_ID: -+ phy->type = e1000_phy_bcm54616; -+ break; - default: - ret_val = -E1000_ERR_PHY; - goto out; -@@ -1602,6 +1605,8 @@ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) - case e1000_phy_82580: - ret_val = e1000_copper_link_setup_82577(hw); - break; -+ case e1000_phy_bcm54616: -+ break; - default: - ret_val = -E1000_ERR_PHY; - break; -diff --git a/src/e1000_defines.h b/src/e1000_defines.h -index 6de3988..773c464 100644 ---- a/src/e1000_defines.h -+++ b/src/e1000_defines.h -@@ -1185,6 +1185,7 @@ - #define I210_I_PHY_ID 0x01410C00 - #define IGP04E1000_E_PHY_ID 0x02A80391 - #define M88_VENDOR 0x0141 -+#define BCM54616_E_PHY_ID 0x03625D10 - - /* M88E1000 Specific Registers */ - #define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Reg */ -diff --git a/src/e1000_hw.h b/src/e1000_hw.h -index 3bcecf1..cca5d77 100644 ---- a/src/e1000_hw.h -+++ b/src/e1000_hw.h -@@ -133,6 +133,7 @@ enum e1000_phy_type { - e1000_phy_82580, - e1000_phy_vf, - e1000_phy_i210, -+ e1000_phy_bcm54616, - }; - - enum e1000_bus_type { --- -2.7.4 - diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 61923df04554..a21a592baf4b 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 61923df04554c64107fc91c095016232fb1859a0 +Subproject commit a21a592baf4b189591f63fe7930f7d889bccd57a From 0e141a54e919cf36fb8b08a4d8b12f7a64153c9c Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 11 Dec 2017 17:00:41 +0000 Subject: [PATCH 1481/1833] [baseimage]: install acl package --- build_debian.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_debian.sh b/build_debian.sh index 6af4346ab1d5..4d361c8a500c 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -115,6 +115,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/initramfs-tools_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/linux-image-${LINUX_KERNEL_VERSION}-amd64_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install acl ## Update initramfs for booting with squashfs+overlay cat files/initramfs-tools/modules | sudo tee -a $FILESYSTEM_ROOT/etc/initramfs-tools/modules > /dev/null From 0827ed3b1a86626afadcbbc3805c31b3c5d25538 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 11 Dec 2017 19:05:03 +0000 Subject: [PATCH 1482/1833] [baseimage]: install tacacs dependencies --- files/build_templates/sonic_debian_extension.j2 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 3160f76a53ea..0faaa5582ea6 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -116,9 +116,12 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-device-data_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f # Install pam-tacplus and nss-tacplus -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libtac2_*.deb -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libpam-tacplus_*.deb -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libnss-tacplus_*.deb +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libtac2_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libpam-tacplus_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libnss-tacplus_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f # Disable tacplus by default sudo LANG=C chroot $FILESYSTEM_ROOT pam-auth-update --remove tacplus sudo sed -i -e '/^passwd/s/ tacplus//' $FILESYSTEM_ROOT/etc/nsswitch.conf From 9aebe0985449b6a702d024f74a5cde6042eb04a2 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 27 Dec 2017 20:46:37 +0200 Subject: [PATCH 1483/1833] [Mellanox]: Upgrade MFT package to 4.8.26 (#3) This version is compatible with Linux kernel 4.9 Signed-off-by: marian-pritsak --- platform/mellanox/mft.mk | 4 ++-- platform/mellanox/mft/Makefile | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index 9f9c65ec5176..559ff3b4cd99 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MFT_VERSION = 4.9.0 -MFT_REVISION = 38 +MFT_VERSION = 4.8.0 +MFT_REVISION = 26 export MFT_VERSION MFT_REVISION diff --git a/platform/mellanox/mft/Makefile b/platform/mellanox/mft/Makefile index 450e59eec44b..15a12decb4e8 100644 --- a/platform/mellanox/mft/Makefile +++ b/platform/mellanox/mft/Makefile @@ -1,5 +1,6 @@ .ONESHELL: SHELL = /bin/bash +.SHELLFLAGS += -e MFT_NAME = mft-$(MFT_VERSION)-$(MFT_REVISION)-x86_64-deb MFT_TGZ = $(MFT_NAME).tgz @@ -17,7 +18,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # put a lock here because dpkg does not allow installing packages in parallel while true; do if mkdir $(DEST)/dpkg_lock &> /dev/null; then - { echo here && sudo dpkg -i $(SRC_DEB) && rm -d $(DEST)/dpkg_lock && break; } || { rm -d $(DEST)/dpkg_lock && exit 1 ; } + { sudo dpkg -i $(SRC_DEB) && rm -d $(DEST)/dpkg_lock && break; } || { rm -d $(DEST)/dpkg_lock && exit 1 ; } fi done @@ -26,6 +27,6 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # fix timestamp because we do not actually build tools, only kernel touch $(MFT_NAME)/DEBS/* - mv $(MFT_NAME)/SDEBS/ubuntu-drivers/3.16.0/kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(MFT_NAME)/DEBS/* $(DEST) + mv $(MFT_NAME)/SDEBS/ubuntu-drivers/4.9.0/kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(MFT_NAME)/DEBS/* $(DEST) $(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) From cd1d1b1896b5e22e7167bd769f1a118513f0c35c Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Sat, 30 Dec 2017 06:39:58 +0200 Subject: [PATCH 1484/1833] [Mellanox]: Update recipe for hw-management (#4) Update package revision Create submodule for sources Signed-off-by: marian-pritsak --- .gitmodules | 3 + platform/mellanox/hw-management.mk | 4 +- .../Add-systemd-service-config.patch | 59 ------------------- platform/mellanox/hw-management/Makefile | 19 ------ 4 files changed, 5 insertions(+), 80 deletions(-) delete mode 100644 platform/mellanox/hw-management/Add-systemd-service-config.patch delete mode 100644 platform/mellanox/hw-management/Makefile diff --git a/.gitmodules b/.gitmodules index ffde4484d85c..1ef6b76f5947 100755 --- a/.gitmodules +++ b/.gitmodules @@ -81,3 +81,6 @@ [submodule "platform/barefoot/sonic-platform-modules-arista"] path = platform/barefoot/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic +[submodule "platform/mellanox/hw-management"] + path = platform/mellanox/hw-management + url = https://github.com/Mellanox/hw-mgmt/ diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 70dd2d330167..b165390cea56 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,10 +1,10 @@ # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = V1.0.0190 +MLNX_HW_MANAGEMENT_VERSION = onl.deb9.13.12.2017 export MLNX_HW_MANAGEMENT_VERSION MLNX_HW_MANAGEMENT = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb $(MLNX_HW_MANAGEMENT)_SRC_PATH = $(PLATFORM_PATH)/hw-management $(MLNX_HW_MANAGEMENT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -SONIC_MAKE_DEBS += $(MLNX_HW_MANAGEMENT) +SONIC_DPKG_DEBS += $(MLNX_HW_MANAGEMENT) diff --git a/platform/mellanox/hw-management/Add-systemd-service-config.patch b/platform/mellanox/hw-management/Add-systemd-service-config.patch deleted file mode 100644 index bbaed885dcb3..000000000000 --- a/platform/mellanox/hw-management/Add-systemd-service-config.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 22fef644b1150677353ab0559828ea45a982d901 Mon Sep 17 00:00:00 2001 -From: Andriy Moroz -Date: Wed, 11 Jul 2018 16:51:07 +0300 -Subject: [PATCH] Add systemd service config - -Signed-off-by: Andriy Moroz ---- - debian/control | 2 +- - debian/hw-management.service | 10 ++++++++++ - debian/rules | 2 +- - 3 files changed, 12 insertions(+), 2 deletions(-) - create mode 100644 debian/hw-management.service - -diff --git a/debian/control b/debian/control -index 048cd61..7e3a545 100644 ---- a/debian/control -+++ b/debian/control -@@ -1,7 +1,7 @@ - Source: hw-management - Priority: extra - Maintainer: Adir Atias --Build-Depends: -+Build-Depends: dh-systemd - Standards-Version: - Section: libs - Homepage: http://www.mellanox.com -diff --git a/debian/hw-management.service b/debian/hw-management.service -new file mode 100644 -index 0000000..d18916d ---- /dev/null -+++ b/debian/hw-management.service -@@ -0,0 +1,11 @@ -+[Unit] -+Description=Mellanox Hardware Management -+ -+[Service] -+Type=oneshot -+EnvironmentFile=/host/machine.conf -+ExecStart=/bin/bash -c "/usr/share/sonic/device/$onie_platform/hw-management start" -+ExecStop=/bin/bash -c "/usr/share/sonic/device/$onie_platform/hw-management stop" -+ -+[Install] -+WantedBy=multi-user.target -diff --git a/debian/rules b/debian/rules -index fc38817..fba4150 100755 ---- a/debian/rules -+++ b/debian/rules -@@ -8,7 +8,7 @@ K_SRC ?= "/lib/modules/$(KVERSION)/build" - pwd=$(shell pwd) - - %: -- dh $@ -+ dh $@ --with systemd - - override_dh_auto_configure: - --- -1.9.1 - diff --git a/platform/mellanox/hw-management/Makefile b/platform/mellanox/hw-management/Makefile deleted file mode 100644 index 4fa5d2cf328c..000000000000 --- a/platform/mellanox/hw-management/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -.ONESHELL: -SHELL = /bin/bash - -MAIN_TARGET = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - # get sources - sudo rm -rf hw-management - git clone https://github.com/Mellanox/hw-mgmt/ -b $(MLNX_HW_MANAGEMENT_VERSION) hw-management - - # build - pushd hw-management - git am ../*.patch - sed "s~@SED_VERSION@~$(MLNX_HW_MANAGEMENT_VERSION)~" -i debian/changelog - chmod +x ./debian/rules - sudo ./debian/rules binary KVERSION=$(KVERSION) - popd - - mv $* $(DEST)/ From 13c83ac6f94ab24789d4d844564950f7163189b1 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 3 Jan 2018 00:52:57 -0800 Subject: [PATCH 1485/1833] [platform]: enable platform driver for dell s6000 (#5) --- .gitmodules | 3 ++- platform/broadcom/rules.mk | 2 +- platform/broadcom/sonic-platform-modules-s6000 | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 1ef6b76f5947..1f78a328b631 100755 --- a/.gitmodules +++ b/.gitmodules @@ -38,7 +38,8 @@ url = https://github.com/Azure/sonic-utilities [submodule "platform/broadcom/sonic-platform-modules-s6000"] path = platform/broadcom/sonic-platform-modules-s6000 - url = https://github.com/Azure/sonic-platform-modules-s6000 + url = https://github.com/lguohan/sonic-platform-modules-s6000 + branch = stretch [submodule "platform/broadcom/sonic-platform-modules-arista"] path = platform/broadcom/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 0e4551718547..680b03afdf41 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,6 +1,6 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk -#include $(PLATFORM_PATH)/platform-modules-s6000.mk +include $(PLATFORM_PATH)/platform-modules-s6000.mk #include $(PLATFORM_PATH)/platform-modules-dell.mk #include $(PLATFORM_PATH)/platform-modules-arista.mk #include $(PLATFORM_PATH)/platform-modules-ingrasys.mk diff --git a/platform/broadcom/sonic-platform-modules-s6000 b/platform/broadcom/sonic-platform-modules-s6000 index ed9ea067b5cb..168674d34148 160000 --- a/platform/broadcom/sonic-platform-modules-s6000 +++ b/platform/broadcom/sonic-platform-modules-s6000 @@ -1 +1 @@ -Subproject commit ed9ea067b5cbfd7d1c835a903729f9dc28d3b035 +Subproject commit 168674d34148fbf7e8a989edae6a341272a9cffa From 35ab7a6e093820a2b0f944b5dd4906306b058704 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 10 Jan 2018 01:34:46 -0800 Subject: [PATCH 1486/1833] [kernel]: upgrade linux kernel to 4.9.0-5 (4.9.65-3+deb9u2) (#8) --- build_debian.sh | 2 +- files/build_templates/swss.service.j2 | 8 ++++---- installer/x86_64/install.sh | 4 ++-- platform/broadcom/sdk.mk | 4 ++-- rules/linux-kernel.mk | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 4d361c8a500c..119aded61ee7 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -30,7 +30,7 @@ set -x -e ## docker engine version (with platform) DOCKER_VERSION=1.11.1-0~stretch_amd64 -LINUX_KERNEL_VERSION=4.9.0-3 +LINUX_KERNEL_VERSION=4.9.0-5 ## Working directory to prepare the file system FILESYSTEM_ROOT=./fsroot diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 510a5fff2e96..1ceb706a175d 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -2,16 +2,16 @@ Description=switch state service Requires=database.service updategraph.service {% if sonic_asic_platform == 'broadcom' %} -Requires=opennsl-modules-4.9.0-3-amd64.service +Requires=opennsl-modules-4.9.0-5-amd64.service {% elif sonic_asic_platform == 'nephos' %} -Requires=nps-modules-4.9.0-3-amd64.service +Requires=nps-modules-4.9.0-5-amd64.service {% endif %} After=database.service updategraph.service After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} -After=opennsl-modules-4.9.0-3-amd64.service +After=opennsl-modules-4.9.0-5-amd64.service {% elif sonic_asic_platform == 'nephos' %} -After=nps-modules-4.9.0-3-amd64.service +After=nps-modules-4.9.0-5-amd64.service {% endif %} [Service] diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index eb7cab38609a..327c0c47f111 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -570,12 +570,12 @@ menuentry '$demo_grub_entry' { if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 - linux /$image_dir/boot/vmlinuz-4.9.0-3-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ + linux /$image_dir/boot/vmlinuz-4.9.0-5-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ net.ifnames=0 biosdevname=0 \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' - initrd /$image_dir/boot/initrd.img-4.9.0-3-amd64 + initrd /$image_dir/boot/initrd.img-4.9.0-5-amd64 } EOF diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index abdf689fe346..12b0262b9305 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,4 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-4.9.0-3-amd64_3.2.3.3-2_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-4.9.0-3-amd64_3.2.3.3-2_amd64.deb?sv=2015-04-05&sr=b&sig=HieTgULvva7WlMRegUhfoRFqkj2Oe9sAVxU%2FgCGj9Ys%3D&se=2154-09-28T04%3A46%3A03Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-4.9.0-5-amd64_3.2.3.7-1_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-4.9.0-5-amd64_3.2.3.7-1_amd64.deb?sv=2015-04-05&sr=b&sig=nju9vaqIjRlzV7V0wirMP6%2FNCJRsNqC%2FdqdqgxA0wrQ%3D&se=2154-12-03T07%3A37%3A17Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index f1d589505a4d..333301644d50 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -1,9 +1,9 @@ # linux kernel package -KVERSION_SHORT = 4.9.0-3 +KVERSION_SHORT = 4.9.0-5 KVERSION = $(KVERSION_SHORT)-amd64 -KERNEL_VERSION = 4.9.30 -KERNEL_SUBVERSION = 2+deb9u5 +KERNEL_VERSION = 4.9.65 +KERNEL_SUBVERSION = 3+deb9u2 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION From 5ae64e7f2d07a244c87fe4489a75619912cba6b0 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 10 Jan 2018 10:48:24 +0000 Subject: [PATCH 1487/1833] [ixgbe]: compile and install ixgbe to 4.9.0-5 kernel --- build_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 119aded61ee7..05eb3d91fcee 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -153,7 +153,7 @@ pushd $FILESYSTEM_ROOT/usr/share/initramfs-tools/scripts/init-bottom && sudo pat sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Install latest intel ixgbe driver -sudo cp target/debs/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/3.16.0-5-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko +sudo cp target/debs/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/${LINUX_KERNEL_VERSION}-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko ## Install docker echo '[INFO] Install docker' From f9c57838b1fc0394ba8f2eda1c754c6289c2dff4 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Fri, 26 Jan 2018 20:16:51 +0200 Subject: [PATCH 1488/1833] [mellanox]: Adapt to new hw-management package (#12) Use single start script for all platforms and remove symbolic links Change path to system eeprom Signed-off-by: marian-pritsak --- device/mellanox/x86_64-mlnx_msn2100-r0/hw-management | 1 - device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py | 2 +- device/mellanox/x86_64-mlnx_msn2410-r0/hw-management | 1 - device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py | 2 +- device/mellanox/x86_64-mlnx_msn2700-r0/hw-management | 1 - device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py | 2 +- device/mellanox/x86_64-mlnx_msn2740-r0/hw-management | 1 - device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py | 2 +- 8 files changed, 4 insertions(+), 8 deletions(-) delete mode 120000 device/mellanox/x86_64-mlnx_msn2100-r0/hw-management delete mode 120000 device/mellanox/x86_64-mlnx_msn2410-r0/hw-management delete mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/hw-management delete mode 120000 device/mellanox/x86_64-mlnx_msn2740-r0/hw-management diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/hw-management b/device/mellanox/x86_64-mlnx_msn2100-r0/hw-management deleted file mode 120000 index daef0037ddae..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/hw-management +++ /dev/null @@ -1 +0,0 @@ -/etc/mlnx/msn2100 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py index 3650d9c8b70b..61e37b51db71 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py @@ -28,5 +28,5 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): _TLV_INFO_MAX_LEN = 256 def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/bsp/eeprom/sys_eeprom" + self.eeprom_path = "/bsp/eeprom/vpd_info" super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/hw-management b/device/mellanox/x86_64-mlnx_msn2410-r0/hw-management deleted file mode 120000 index 5b9a76d3d47b..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/hw-management +++ /dev/null @@ -1 +0,0 @@ -/etc/mlnx/msn2410 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py index 3650d9c8b70b..61e37b51db71 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py @@ -28,5 +28,5 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): _TLV_INFO_MAX_LEN = 256 def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/bsp/eeprom/sys_eeprom" + self.eeprom_path = "/bsp/eeprom/vpd_info" super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/hw-management b/device/mellanox/x86_64-mlnx_msn2700-r0/hw-management deleted file mode 120000 index eb5e941daad7..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/hw-management +++ /dev/null @@ -1 +0,0 @@ -/etc/mlnx/msn2700 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py index 3650d9c8b70b..61e37b51db71 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py @@ -28,5 +28,5 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): _TLV_INFO_MAX_LEN = 256 def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/bsp/eeprom/sys_eeprom" + self.eeprom_path = "/bsp/eeprom/vpd_info" super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/hw-management b/device/mellanox/x86_64-mlnx_msn2740-r0/hw-management deleted file mode 120000 index b231cbeea1bf..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/hw-management +++ /dev/null @@ -1 +0,0 @@ -/etc/mlnx/msn2740 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py index 3650d9c8b70b..61e37b51db71 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py @@ -28,5 +28,5 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): _TLV_INFO_MAX_LEN = 256 def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/bsp/eeprom/sys_eeprom" + self.eeprom_path = "/bsp/eeprom/vpd_info" super(board, self).__init__(self.eeprom_path, 0, '', True) From 9801ba9cc93216d1e31a42fca5d16d7b3038e6fe Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 12 Feb 2018 21:19:11 +0000 Subject: [PATCH 1489/1833] [devices]: enable platform modules for various platforms --- README.md | 8 +++++++- platform/broadcom/rules.mk | 10 +++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index dc359d2b56d3..12aafefa44b6 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,13 @@ The SONiC installer contains all docker images needed. SONiC uses one image for For Broadcom ASIC, we build ONIE and EOS image. EOS image is used for Arista devices, ONIE image is used for all other Broadcom ASIC based devices. make configure PLATFORM=broadcom - BLDENV=stretch make target/debs/linux-headers-4.9.0-3-common_4.9.30-2+deb9u5_all.deb + BLDENV=stretch make target/debs/linux-headers-4.9.0-3-common_4.9.30-2+deb9u5_all.deb \ + target/debs/sonic-platform-quanta-ix1b-32x_1.0_amd64.deb \ + target/debs/platform-modules-d7032q28b_1.1.0_amd64.deb \ + target/debs/sonic-platform-accton-as7712-32x_1.1_amd64.deb \ + target/debs/sonic-platform-ingrasys-s9100_1.1.0_amd64.deb \ + target/debs/platform-modules-z9100_1.1_amd64.deb \ + target/debs/platform-modules-s6000_1.0_amd64.deb # build ONIE image make target/sonic-broadcom.bin diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 680b03afdf41..9b1941008654 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,14 +1,14 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-s6000.mk -#include $(PLATFORM_PATH)/platform-modules-dell.mk +include $(PLATFORM_PATH)/platform-modules-dell.mk #include $(PLATFORM_PATH)/platform-modules-arista.mk -#include $(PLATFORM_PATH)/platform-modules-ingrasys.mk -#include $(PLATFORM_PATH)/platform-modules-accton.mk -#include $(PLATFORM_PATH)/platform-modules-inventec.mk +include $(PLATFORM_PATH)/platform-modules-ingrasys.mk +include $(PLATFORM_PATH)/platform-modules-accton.mk +include $(PLATFORM_PATH)/platform-modules-inventec.mk #include $(PLATFORM_PATH)/platform-modules-cel.mk #include $(PLATFORM_PATH)/platform-modules-delta.mk -#include $(PLATFORM_PATH)/platform-modules-quanta.mk +include $(PLATFORM_PATH)/platform-modules-quanta.mk #include $(PLATFORM_PATH)/platform-modules-mitac.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk From 759edc93c9595af6e6021a6c48663c20f4bda7e2 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 13 Feb 2018 14:02:37 +0000 Subject: [PATCH 1490/1833] [dell]: update to stretch-kernel based dell modules --- .gitmodules | 3 ++- platform/broadcom/sonic-platform-modules-dell | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 1f78a328b631..d4131be318d3 100755 --- a/.gitmodules +++ b/.gitmodules @@ -45,7 +45,8 @@ url = https://github.com/aristanetworks/sonic [submodule "platform/broadcom/sonic-platform-modules-dell"] path = platform/broadcom/sonic-platform-modules-dell - url = https://github.com/Azure/sonic-platform-modules-dell + url = https://github.com/lguohan/sonic-platform-modules-dell + branch = stretch [submodule "platform/broadcom/sonic-platform-modules-ingrasys"] path = platform/broadcom/sonic-platform-modules-ingrasys url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 8bc799d26011..31993888a172 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 8bc799d26011622be07e03f888b4dd4c6b014d38 +Subproject commit 31993888a17291eb28ef674d6e2c973c539e806d From f489bea10577bda30000597080a315c61d5b0aa6 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Fri, 16 Feb 2018 03:22:49 +0000 Subject: [PATCH 1491/1833] [platform]: incorporate sonic-platform-modules-cel into sonic buildimage repo --- .gitmodules | 3 - platform/broadcom/sonic-platform-modules-cel | 1 - .../sonic-platform-modules-cel/.gitignore | 33 + .../sonic-platform-modules-cel/LICENSE | 15 + .../sonic-platform-modules-cel/README.md | 1 + .../debian/changelog | 38 + .../sonic-platform-modules-cel/debian/compat | 1 + .../sonic-platform-modules-cel/debian/control | 12 + .../debian/platform-modules-dx010.init | 106 +++ .../debian/platform-modules-dx010.install | 2 + .../sonic-platform-modules-cel/debian/rules | 33 + .../dx010/cfg/dx010-modules.conf | 15 + .../dx010/modules/Makefile | 1 + .../dx010/modules/dx010_cpld.c | 506 ++++++++++ .../dx010/modules/dx010_wdt.c | 215 +++++ .../dx010/modules/emc2305.c | 877 ++++++++++++++++++ .../dx010/modules/leds-dx010.c | 289 ++++++ .../dx010/modules/lm75.c | 553 +++++++++++ .../dx010/modules/lm75.h | 49 + .../dx010/modules/mc24lc64t.c | 142 +++ .../dx010/scripts/dx010_check_qsfp.sh | 7 + 21 files changed, 2895 insertions(+), 4 deletions(-) delete mode 160000 platform/broadcom/sonic-platform-modules-cel create mode 100644 platform/broadcom/sonic-platform-modules-cel/.gitignore create mode 100644 platform/broadcom/sonic-platform-modules-cel/LICENSE create mode 100644 platform/broadcom/sonic-platform-modules-cel/README.md create mode 100644 platform/broadcom/sonic-platform-modules-cel/debian/changelog create mode 100644 platform/broadcom/sonic-platform-modules-cel/debian/compat create mode 100644 platform/broadcom/sonic-platform-modules-cel/debian/control create mode 100644 platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init create mode 100644 platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install create mode 100644 platform/broadcom/sonic-platform-modules-cel/debian/rules create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/cfg/dx010-modules.conf create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_wdt.c create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.c create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/scripts/dx010_check_qsfp.sh diff --git a/.gitmodules b/.gitmodules index d4131be318d3..f0cbe5c2a38c 100755 --- a/.gitmodules +++ b/.gitmodules @@ -59,9 +59,6 @@ [submodule "platform/broadcom/sonic-platform-modules-accton"] path = platform/broadcom/sonic-platform-modules-accton url = https://github.com/edge-core/sonic-platform-modules-accton.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 [submodule "src/sonic-frr/frr"] path = src/sonic-frr/frr url = https://github.com/FRRouting/frr.git diff --git a/platform/broadcom/sonic-platform-modules-cel b/platform/broadcom/sonic-platform-modules-cel deleted file mode 160000 index 5ec0c5e5d4fe..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5ec0c5e5d4fe8f2ec1ab5a6abefa7d168a81ca98 diff --git a/platform/broadcom/sonic-platform-modules-cel/.gitignore b/platform/broadcom/sonic-platform-modules-cel/.gitignore new file mode 100644 index 000000000000..f805e810e5c6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/.gitignore @@ -0,0 +1,33 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# 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 diff --git a/platform/broadcom/sonic-platform-modules-cel/LICENSE b/platform/broadcom/sonic-platform-modules-cel/LICENSE new file mode 100644 index 000000000000..2386a3920c07 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/LICENSE @@ -0,0 +1,15 @@ +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 new file mode 100644 index 000000000000..b09a36b51d95 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/README.md @@ -0,0 +1 @@ +platform drivers for Celestica DX010 for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/changelog b/platform/broadcom/sonic-platform-modules-cel/debian/changelog new file mode 100644 index 000000000000..20ce5072b874 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/debian/changelog @@ -0,0 +1,38 @@ +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 new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/control b/platform/broadcom/sonic-platform-modules-cel/debian/control new file mode 100644 index 000000000000..72bcd54ee62c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/debian/control @@ -0,0 +1,12 @@ +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-3.16.0-5-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 new file mode 100644 index 000000000000..0c883cd388ae --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init @@ -0,0 +1,106 @@ +#!/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 + +case "$1" in +start) + echo -n "Setting up board... " + + depmod -a + modprobe i2c-dev + modprobe i2c-mux-pca954x + modprobe dx010_wdt + modprobe leds-dx010 + + 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 dx010_lm75b 0x48 > /sys/bus/i2c/devices/i2c-5/new_device + echo dx010_lm75b 0x49 > /sys/bus/i2c/devices/i2c-6/new_device + echo dx010_lm75b 0x4a > /sys/bus/i2c/devices/i2c-7/new_device + echo dx010_lm75b 0x48 > /sys/bus/i2c/devices/i2c-14/new_device + echo dx010_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 + + # 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 new file mode 100644 index 000000000000..329b584dc427 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install @@ -0,0 +1,2 @@ +dx010/scripts/dx010_check_qsfp.sh usr/local/bin +dx010/cfg/dx010-modules.conf etc/modules-load.d diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/rules b/platform/broadcom/sonic-platform-modules-cel/debian/rules new file mode 100644 index 000000000000..fa9bb741d5a6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/debian/rules @@ -0,0 +1,33 @@ +#!/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 + +%: + 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 new file mode 100644 index 000000000000..66f002a5fc94 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/cfg/dx010-modules.conf @@ -0,0 +1,15 @@ +# /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 new file mode 100644 index 000000000000..c4109ec772ea --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile @@ -0,0 +1 @@ +obj-m := dx010_cpld.o mc24lc64t.o emc2305.o dx010_wdt.o leds-dx010.o lm75.o 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 new file mode 100644 index 000000000000..ab0692faab78 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_cpld.c @@ -0,0 +1,506 @@ +/* + * 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 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_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_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_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; + char read_byte; + 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; + struct dx010_i2c_data *new_data; + + 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 new file mode 100644 index 000000000000..a386c065051a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_wdt.c @@ -0,0 +1,215 @@ +/* + * 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 new file mode 100644 index 000000000000..f08033e080ce --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c @@ -0,0 +1,877 @@ +/* + * 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/dx010/modules/leds-dx010.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c new file mode 100644 index 000000000000..fac8322f06b0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c @@ -0,0 +1,289 @@ +/* + * 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/lm75.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.c new file mode 100644 index 000000000000..a83745212bbf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.c @@ -0,0 +1,553 @@ +/* + * lm75.c - Part of lm_sensors, Linux kernel modules for hardware + * monitoring + * Copyright (c) 1998, 1999 Frodo Looijaard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "lm75.h" + + +/* + * This driver handles the LM75 and compatible digital temperature sensors. + */ + +enum lm75_type { /* keep sorted in alphabetical order */ + adt75, + ds1775, + ds75, + ds7505, + g751, + lm75, + lm75a, + lm75b, + max6625, + max6626, + mcp980x, + stds75, + tcn75, + tmp100, + tmp101, + tmp105, + tmp112, + tmp175, + tmp275, + tmp75, +}; + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, + 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; + + +/* The LM75 registers */ +#define LM75_REG_CONF 0x01 +static const u8 LM75_REG_TEMP[3] = { + 0x00, /* input */ + 0x03, /* max */ + 0x02, /* hyst */ +}; + +/* Each client has this additional data */ +struct lm75_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct thermal_zone_device *tz; + struct mutex update_lock; + u8 orig_conf; + u8 resolution; /* In bits, between 9 and 12 */ + u8 resolution_limits; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + unsigned long sample_time; /* In jiffies */ + s16 temp[3]; /* Register values, + 0 = input + 1 = max + 2 = hyst */ +}; + +static int lm75_read_value(struct i2c_client *client, u8 reg); +static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value); +static struct lm75_data *lm75_update_device(struct device *dev); + + +/*-----------------------------------------------------------------------*/ + +static inline long lm75_reg_to_mc(s16 temp, u8 resolution) +{ + return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); +} + +/* sysfs attributes for hwmon */ + +static int lm75_read_temp(void *dev, long *temp) +{ + struct lm75_data *data = lm75_update_device(dev); + + if (IS_ERR(data)) + return PTR_ERR(data); + + *temp = lm75_reg_to_mc(data->temp[0], data->resolution); + + return 0; +} + +static ssize_t show_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct lm75_data *data = lm75_update_device(dev); + + if (IS_ERR(data)) + return PTR_ERR(data); + + return sprintf(buf, "%ld\n", lm75_reg_to_mc(data->temp[attr->index], + data->resolution)); +} + +static ssize_t set_temp(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct lm75_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int nr = attr->index; + long temp; + int error; + u8 resolution; + + error = kstrtol(buf, 10, &temp); + if (error) + return error; + + /* + * Resolution of limit registers is assumed to be the same as the + * temperature input register resolution unless given explicitly. + */ + if (attr->index && data->resolution_limits) + resolution = data->resolution_limits; + else + resolution = data->resolution; + + mutex_lock(&data->update_lock); + temp = clamp_val(temp, LM75_TEMP_MIN, LM75_TEMP_MAX); + data->temp[nr] = DIV_ROUND_CLOSEST(temp << (resolution - 8), + 1000) << (16 - resolution); + lm75_write_value(client, LM75_REG_TEMP[nr], data->temp[nr]); + mutex_unlock(&data->update_lock); + return count; +} + +static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, + show_temp, set_temp, 1); +static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, + show_temp, set_temp, 2); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); + +static struct attribute *lm75_attrs[] = { + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, + + NULL +}; +ATTRIBUTE_GROUPS(lm75); + +/*-----------------------------------------------------------------------*/ + +/* device probe and removal */ + +static int +lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct device *dev = &client->dev; + struct lm75_data *data; + int status; + u8 set_mask, clr_mask; + int new; + enum lm75_type kind = id->driver_data; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + return -EIO; + + data = devm_kzalloc(dev, sizeof(struct lm75_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->client = client; + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* Set to LM75 resolution (9 bits, 1/2 degree C) and range. + * Then tweak to be more precise when appropriate. + */ + set_mask = 0; + clr_mask = LM75_SHUTDOWN; /* continuous conversions */ + + switch (kind) { + case adt75: + clr_mask |= 1 << 5; /* not one-shot mode */ + data->resolution = 12; + data->sample_time = HZ / 8; + break; + case ds1775: + case ds75: + case stds75: + clr_mask |= 3 << 5; + set_mask |= 2 << 5; /* 11-bit mode */ + data->resolution = 11; + data->sample_time = HZ; + break; + case ds7505: + set_mask |= 3 << 5; /* 12-bit mode */ + data->resolution = 12; + data->sample_time = HZ / 4; + break; + case g751: + case lm75: + case lm75a: + data->resolution = 9; + data->sample_time = HZ / 2; + break; + case lm75b: + data->resolution = 11; + data->sample_time = HZ / 4; + break; + case max6625: + data->resolution = 9; + data->sample_time = HZ / 4; + break; + case max6626: + data->resolution = 12; + data->resolution_limits = 9; + data->sample_time = HZ / 4; + break; + case tcn75: + data->resolution = 9; + data->sample_time = HZ / 8; + break; + case mcp980x: + data->resolution_limits = 9; + /* fall through */ + case tmp100: + case tmp101: + set_mask |= 3 << 5; /* 12-bit mode */ + data->resolution = 12; + data->sample_time = HZ; + clr_mask |= 1 << 7; /* not one-shot mode */ + break; + case tmp112: + set_mask |= 3 << 5; /* 12-bit mode */ + clr_mask |= 1 << 7; /* not one-shot mode */ + data->resolution = 12; + data->sample_time = HZ / 4; + break; + case tmp105: + case tmp175: + case tmp275: + case tmp75: + set_mask |= 3 << 5; /* 12-bit mode */ + clr_mask |= 1 << 7; /* not one-shot mode */ + data->resolution = 12; + data->sample_time = HZ / 2; + break; + } + + /* configure as specified */ + status = lm75_read_value(client, LM75_REG_CONF); + if (status < 0) { + dev_dbg(dev, "Can't read config? %d\n", status); + return status; + } + data->orig_conf = status; + new = status & ~clr_mask; + new |= set_mask; + if (status != new) + lm75_write_value(client, LM75_REG_CONF, new); + dev_dbg(dev, "Config %02x\n", new); + + data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name, + data, lm75_groups); + if (IS_ERR(data->hwmon_dev)) + return PTR_ERR(data->hwmon_dev); + + data->tz = thermal_zone_of_sensor_register(data->hwmon_dev, + 0, + data->hwmon_dev, + lm75_read_temp, NULL); + if (IS_ERR(data->tz)) + data->tz = NULL; + + dev_info(dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; +} + +static int lm75_remove(struct i2c_client *client) +{ + struct lm75_data *data = i2c_get_clientdata(client); + + thermal_zone_of_sensor_unregister(data->hwmon_dev, data->tz); + hwmon_device_unregister(data->hwmon_dev); + lm75_write_value(client, LM75_REG_CONF, data->orig_conf); + return 0; +} + +static const struct i2c_device_id lm75_ids[] = { + { "adt75", adt75, }, + { "ds1775", ds1775, }, + { "ds75", ds75, }, + { "ds7505", ds7505, }, + { "g751", g751, }, + { "lm75", lm75, }, + { "lm75a", lm75a, }, + { "dx010_lm75b", lm75b, }, + { "max6625", max6625, }, + { "max6626", max6626, }, + { "mcp980x", mcp980x, }, + { "stds75", stds75, }, + { "tcn75", tcn75, }, + { "tmp100", tmp100, }, + { "tmp101", tmp101, }, + { "tmp105", tmp105, }, + { "tmp112", tmp112, }, + { "tmp175", tmp175, }, + { "tmp275", tmp275, }, + { "tmp75", tmp75, }, + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, lm75_ids); + +#define LM75A_ID 0xA1 + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int lm75_detect(struct i2c_client *new_client, + struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = new_client->adapter; + int i; + int conf, hyst, os; + bool is_lm75a = 0; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + return -ENODEV; + + /* + * Now, we do the remaining detection. There is no identification- + * dedicated register so we have to rely on several tricks: + * unused bits, registers cycling over 8-address boundaries, + * addresses 0x04-0x07 returning the last read value. + * The cycling+unused addresses combination is not tested, + * since it would significantly slow the detection down and would + * hardly add any value. + * + * The National Semiconductor LM75A is different than earlier + * LM75s. It has an ID byte of 0xaX (where X is the chip + * revision, with 1 being the only revision in existence) in + * register 7, and unused registers return 0xff rather than the + * last read value. + * + * Note that this function only detects the original National + * Semiconductor LM75 and the LM75A. Clones from other vendors + * aren't detected, on purpose, because they are typically never + * found on PC hardware. They are found on embedded designs where + * they can be instantiated explicitly so detection is not needed. + * The absence of identification registers on all these clones + * would make their exhaustive detection very difficult and weak, + * and odds are that the driver would bind to unsupported devices. + */ + + /* Unused bits */ + conf = i2c_smbus_read_byte_data(new_client, 1); + if (conf & 0xe0) + return -ENODEV; + + /* First check for LM75A */ + if (i2c_smbus_read_byte_data(new_client, 7) == LM75A_ID) { + /* LM75A returns 0xff on unused registers so + just to be sure we check for that too. */ + if (i2c_smbus_read_byte_data(new_client, 4) != 0xff + || i2c_smbus_read_byte_data(new_client, 5) != 0xff + || i2c_smbus_read_byte_data(new_client, 6) != 0xff) + return -ENODEV; + is_lm75a = 1; + hyst = i2c_smbus_read_byte_data(new_client, 2); + os = i2c_smbus_read_byte_data(new_client, 3); + } else { /* Traditional style LM75 detection */ + /* Unused addresses */ + hyst = i2c_smbus_read_byte_data(new_client, 2); + if (i2c_smbus_read_byte_data(new_client, 4) != hyst + || i2c_smbus_read_byte_data(new_client, 5) != hyst + || i2c_smbus_read_byte_data(new_client, 6) != hyst + || i2c_smbus_read_byte_data(new_client, 7) != hyst) + return -ENODEV; + os = i2c_smbus_read_byte_data(new_client, 3); + if (i2c_smbus_read_byte_data(new_client, 4) != os + || i2c_smbus_read_byte_data(new_client, 5) != os + || i2c_smbus_read_byte_data(new_client, 6) != os + || i2c_smbus_read_byte_data(new_client, 7) != os) + return -ENODEV; + } + + /* Addresses cycling */ + for (i = 8; i <= 248; i += 40) { + if (i2c_smbus_read_byte_data(new_client, i + 1) != conf + || i2c_smbus_read_byte_data(new_client, i + 2) != hyst + || i2c_smbus_read_byte_data(new_client, i + 3) != os) + return -ENODEV; + if (is_lm75a && i2c_smbus_read_byte_data(new_client, i + 7) + != LM75A_ID) + return -ENODEV; + } + + strlcpy(info->type, is_lm75a ? "lm75a" : "lm75", I2C_NAME_SIZE); + + return 0; +} + +#ifdef CONFIG_PM +static int lm75_suspend(struct device *dev) +{ + int status; + struct i2c_client *client = to_i2c_client(dev); + status = lm75_read_value(client, LM75_REG_CONF); + if (status < 0) { + dev_dbg(&client->dev, "Can't read config? %d\n", status); + return status; + } + status = status | LM75_SHUTDOWN; + lm75_write_value(client, LM75_REG_CONF, status); + return 0; +} + +static int lm75_resume(struct device *dev) +{ + int status; + struct i2c_client *client = to_i2c_client(dev); + status = lm75_read_value(client, LM75_REG_CONF); + if (status < 0) { + dev_dbg(&client->dev, "Can't read config? %d\n", status); + return status; + } + status = status & ~LM75_SHUTDOWN; + lm75_write_value(client, LM75_REG_CONF, status); + return 0; +} + +static const struct dev_pm_ops lm75_dev_pm_ops = { + .suspend = lm75_suspend, + .resume = lm75_resume, +}; +#define LM75_DEV_PM_OPS (&lm75_dev_pm_ops) +#else +#define LM75_DEV_PM_OPS NULL +#endif /* CONFIG_PM */ + +static struct i2c_driver lm75_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "dx010_lm75", + .pm = LM75_DEV_PM_OPS, + }, + .probe = lm75_probe, + .remove = lm75_remove, + .id_table = lm75_ids, +/* + .detect = lm75_detect, + .address_list = normal_i2c, +*/ +}; + +/*-----------------------------------------------------------------------*/ + +/* register access */ + +/* + * All registers are word-sized, except for the configuration register. + * LM75 uses a high-byte first convention, which is exactly opposite to + * the SMBus standard. + */ +static int lm75_read_value(struct i2c_client *client, u8 reg) +{ + if (reg == LM75_REG_CONF) + return i2c_smbus_read_byte_data(client, reg); + else + return i2c_smbus_read_word_swapped(client, reg); +} + +static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) +{ + if (reg == LM75_REG_CONF) + return i2c_smbus_write_byte_data(client, reg, value); + else + return i2c_smbus_write_word_swapped(client, reg, value); +} + +static struct lm75_data *lm75_update_device(struct device *dev) +{ + struct lm75_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + struct lm75_data *ret = data; + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + data->sample_time) + || !data->valid) { + int i; + dev_dbg(&client->dev, "Starting lm75 update\n"); + + for (i = 0; i < ARRAY_SIZE(data->temp); i++) { + int status; + + status = lm75_read_value(client, LM75_REG_TEMP[i]); + if (unlikely(status < 0)) { + dev_dbg(dev, + "LM75: Failed to read value: reg %d, error %d\n", + LM75_REG_TEMP[i], status); + ret = ERR_PTR(status); + data->valid = 0; + goto abort; + } + data->temp[i] = status; + } + data->last_updated = jiffies; + data->valid = 1; + } + +abort: + mutex_unlock(&data->update_lock); + return ret; +} + +module_i2c_driver(lm75_driver); + +MODULE_AUTHOR("Frodo Looijaard "); +MODULE_DESCRIPTION("LM75 driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h new file mode 100644 index 000000000000..5cde94e56f17 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h @@ -0,0 +1,49 @@ +/* + lm75.h - Part of lm_sensors, Linux kernel modules for hardware + monitoring + Copyright (c) 2003 Mark M. Hoffman + + 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. +*/ + +/* + This file contains common code for encoding/decoding LM75 type + temperature readings, which are emulated by many of the chips + we support. As the user is unlikely to load more than one driver + which contains this code, we don't worry about the wasted space. +*/ + +#include + +/* straight from the datasheet */ +#define LM75_TEMP_MIN (-55000) +#define LM75_TEMP_MAX 125000 +#define LM75_SHUTDOWN 0x01 + +/* TEMP: 0.001C/bit (-55C to +125C) + REG: (0.5C/bit, two's complement) << 7 */ +static inline u16 LM75_TEMP_TO_REG(long temp) +{ + int ntemp = clamp_val(temp, LM75_TEMP_MIN, LM75_TEMP_MAX); + ntemp += (ntemp < 0 ? -250 : 250); + return (u16)((ntemp / 500) << 7); +} + +static inline int LM75_TEMP_FROM_REG(u16 reg) +{ + /* use integer division instead of equivalent right shift to + guarantee arithmetic shift and preserve the sign */ + return ((s16)reg / 128) * 500; +} diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c new file mode 100644 index 000000000000..a391056d09a7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c @@ -0,0 +1,142 @@ +/* + * 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 new file mode 100644 index 000000000000..938b07952e0d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/scripts/dx010_check_qsfp.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +#Usage: +# TBD + +echo "Do we need to check qsfp?" + From ec9dc577042fd8d76b27de464e560fb168540228 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Fri, 16 Feb 2018 03:53:12 +0000 Subject: [PATCH 1492/1833] [devices]: enable sonic-platform-modules-cel --- platform/broadcom/rules.mk | 2 +- .../sonic-platform-modules-cel/.gitignore | 3 + .../sonic-platform-modules-cel/debian/control | 2 +- .../sonic-platform-modules-cel/debian/rules | 0 .../dx010/modules/Makefile | 5 + .../dx010/modules/lm75.c | 682 +++++++++--------- .../dx010/modules/lm75.h | 2 +- 7 files changed, 354 insertions(+), 342 deletions(-) mode change 100644 => 100755 platform/broadcom/sonic-platform-modules-cel/debian/rules diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 9b1941008654..eff7236da249 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -6,7 +6,7 @@ include $(PLATFORM_PATH)/platform-modules-dell.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk include $(PLATFORM_PATH)/platform-modules-inventec.mk -#include $(PLATFORM_PATH)/platform-modules-cel.mk +include $(PLATFORM_PATH)/platform-modules-cel.mk #include $(PLATFORM_PATH)/platform-modules-delta.mk include $(PLATFORM_PATH)/platform-modules-quanta.mk #include $(PLATFORM_PATH)/platform-modules-mitac.mk diff --git a/platform/broadcom/sonic-platform-modules-cel/.gitignore b/platform/broadcom/sonic-platform-modules-cel/.gitignore index f805e810e5c6..988e49257d47 100644 --- a/platform/broadcom/sonic-platform-modules-cel/.gitignore +++ b/platform/broadcom/sonic-platform-modules-cel/.gitignore @@ -7,6 +7,9 @@ # Precompiled Headers *.gch *.pch +*.mod.c +*.ko.cmd +*.o.cmd # Libraries *.lib diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/control b/platform/broadcom/sonic-platform-modules-cel/debian/control index 72bcd54ee62c..a63df5359271 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/control +++ b/platform/broadcom/sonic-platform-modules-cel/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: platform-modules-dx010 Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 +Depends: linux-image-4.9.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/rules b/platform/broadcom/sonic-platform-modules-cel/debian/rules old mode 100644 new mode 100755 diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile index c4109ec772ea..bb398cc5a745 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile @@ -1 +1,6 @@ obj-m := dx010_cpld.o mc24lc64t.o emc2305.o dx010_wdt.o leds-dx010.o lm75.o +KVERSION = $(shell uname -r) +all: + make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules +clean: + make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.c index a83745212bbf..140d8f365598 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.c +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.c @@ -37,50 +37,50 @@ */ enum lm75_type { /* keep sorted in alphabetical order */ - adt75, - ds1775, - ds75, - ds7505, - g751, - lm75, - lm75a, - lm75b, - max6625, - max6626, - mcp980x, - stds75, - tcn75, - tmp100, - tmp101, - tmp105, - tmp112, - tmp175, - tmp275, - tmp75, +adt75, +ds1775, +ds75, +ds7505, +g751, +lm75, +lm75a, +lm75b, +max6625, +max6626, +mcp980x, +stds75, +tcn75, +tmp100, +tmp101, +tmp105, +tmp112, +tmp175, +tmp275, +tmp75, }; /* Addresses scanned */ static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, - 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; + 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; /* The LM75 registers */ #define LM75_REG_CONF 0x01 -static const u8 LM75_REG_TEMP[3] = { + static const u8 LM75_REG_TEMP[3] = { 0x00, /* input */ 0x03, /* max */ 0x02, /* hyst */ -}; + }; /* Each client has this additional data */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; + struct lm75_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct thermal_zone_device *tz; + struct mutex update_lock; + u8 orig_conf; u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; + u8 resolution_limits; char valid; /* !=0 if registers are valid */ unsigned long last_updated; /* In jiffies */ unsigned long sample_time; /* In jiffies */ @@ -88,276 +88,280 @@ struct lm75_data { 0 = input 1 = max 2 = hyst */ -}; + }; -static int lm75_read_value(struct i2c_client *client, u8 reg); -static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value); -static struct lm75_data *lm75_update_device(struct device *dev); + static int lm75_read_value(struct i2c_client *client, u8 reg); + static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value); + static struct lm75_data *lm75_update_device(struct device *dev); /*-----------------------------------------------------------------------*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} + static inline long lm75_reg_to_mc(s16 temp, u8 resolution) + { + return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); + } /* sysfs attributes for hwmon */ -static int lm75_read_temp(void *dev, long *temp) -{ - struct lm75_data *data = lm75_update_device(dev); + static int lm75_read_temp(void *dev, int *temp) + { + struct lm75_data *data = lm75_update_device(dev); - if (IS_ERR(data)) - return PTR_ERR(data); + if (IS_ERR(data)) + return PTR_ERR(data); - *temp = lm75_reg_to_mc(data->temp[0], data->resolution); + *temp = lm75_reg_to_mc(data->temp[0], data->resolution); - return 0; -} + return 0; + } -static ssize_t show_temp(struct device *dev, struct device_attribute *da, - char *buf) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct lm75_data *data = lm75_update_device(dev); + static ssize_t show_temp(struct device *dev, struct device_attribute *da, + char *buf) + { + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct lm75_data *data = lm75_update_device(dev); - if (IS_ERR(data)) - return PTR_ERR(data); + if (IS_ERR(data)) + return PTR_ERR(data); - return sprintf(buf, "%ld\n", lm75_reg_to_mc(data->temp[attr->index], - data->resolution)); -} + return sprintf(buf, "%ld\n", lm75_reg_to_mc(data->temp[attr->index], + data->resolution)); + } -static ssize_t set_temp(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct lm75_data *data = dev_get_drvdata(dev); - struct i2c_client *client = data->client; - int nr = attr->index; - long temp; - int error; - u8 resolution; - - error = kstrtol(buf, 10, &temp); - if (error) - return error; + static ssize_t set_temp(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) + { + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct lm75_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int nr = attr->index; + long temp; + int error; + u8 resolution; + + error = kstrtol(buf, 10, &temp); + if (error) + return error; /* * Resolution of limit registers is assumed to be the same as the * temperature input register resolution unless given explicitly. */ - if (attr->index && data->resolution_limits) - resolution = data->resolution_limits; - else - resolution = data->resolution; - - mutex_lock(&data->update_lock); - temp = clamp_val(temp, LM75_TEMP_MIN, LM75_TEMP_MAX); - data->temp[nr] = DIV_ROUND_CLOSEST(temp << (resolution - 8), - 1000) << (16 - resolution); - lm75_write_value(client, LM75_REG_TEMP[nr], data->temp[nr]); - mutex_unlock(&data->update_lock); - return count; -} + if (attr->index && data->resolution_limits) + resolution = data->resolution_limits; + else + resolution = data->resolution; + + mutex_lock(&data->update_lock); + temp = clamp_val(temp, LM75_TEMP_MIN, LM75_TEMP_MAX); + data->temp[nr] = DIV_ROUND_CLOSEST(temp << (resolution - 8), + 1000) << (16 - resolution); + lm75_write_value(client, LM75_REG_TEMP[nr], data->temp[nr]); + mutex_unlock(&data->update_lock); + return count; + } -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, - show_temp, set_temp, 1); -static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, - show_temp, set_temp, 2); -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); + static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, + show_temp, set_temp, 1); + static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, + show_temp, set_temp, 2); + static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); -static struct attribute *lm75_attrs[] = { - &sensor_dev_attr_temp1_input.dev_attr.attr, - &sensor_dev_attr_temp1_max.dev_attr.attr, - &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, + static struct attribute *lm75_attrs[] = { + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, - NULL -}; -ATTRIBUTE_GROUPS(lm75); + NULL + }; + ATTRIBUTE_GROUPS(lm75); /*-----------------------------------------------------------------------*/ + static const struct thermal_zone_of_device_ops lm75_of_thermal_ops = { + .get_temp = lm75_read_temp, + }; + /* device probe and removal */ -static int -lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - struct device *dev = &client->dev; - struct lm75_data *data; - int status; - u8 set_mask, clr_mask; - int new; - enum lm75_type kind = id->driver_data; - - if (!i2c_check_functionality(client->adapter, + static int + lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) + { + struct device *dev = &client->dev; + struct lm75_data *data; + int status; + u8 set_mask, clr_mask; + int new; + enum lm75_type kind = id->driver_data; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) - return -EIO; + return -EIO; - data = devm_kzalloc(dev, sizeof(struct lm75_data), GFP_KERNEL); - if (!data) - return -ENOMEM; + data = devm_kzalloc(dev, sizeof(struct lm75_data), GFP_KERNEL); + if (!data) + return -ENOMEM; - data->client = client; - i2c_set_clientdata(client, data); - mutex_init(&data->update_lock); + data->client = client; + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); /* Set to LM75 resolution (9 bits, 1/2 degree C) and range. * Then tweak to be more precise when appropriate. */ - set_mask = 0; + set_mask = 0; clr_mask = LM75_SHUTDOWN; /* continuous conversions */ - switch (kind) { - case adt75: + switch (kind) { + case adt75: clr_mask |= 1 << 5; /* not one-shot mode */ - data->resolution = 12; - data->sample_time = HZ / 8; - break; - case ds1775: - case ds75: - case stds75: - clr_mask |= 3 << 5; + data->resolution = 12; + data->sample_time = HZ / 8; + break; + case ds1775: + case ds75: + case stds75: + clr_mask |= 3 << 5; set_mask |= 2 << 5; /* 11-bit mode */ - data->resolution = 11; - data->sample_time = HZ; - break; - case ds7505: + data->resolution = 11; + data->sample_time = HZ; + break; + case ds7505: set_mask |= 3 << 5; /* 12-bit mode */ - data->resolution = 12; - data->sample_time = HZ / 4; - break; - case g751: - case lm75: - case lm75a: - data->resolution = 9; - data->sample_time = HZ / 2; - break; - case lm75b: - data->resolution = 11; - data->sample_time = HZ / 4; - break; - case max6625: - data->resolution = 9; - data->sample_time = HZ / 4; - break; - case max6626: - data->resolution = 12; - data->resolution_limits = 9; - data->sample_time = HZ / 4; - break; - case tcn75: - data->resolution = 9; - data->sample_time = HZ / 8; - break; - case mcp980x: - data->resolution_limits = 9; + data->resolution = 12; + data->sample_time = HZ / 4; + break; + case g751: + case lm75: + case lm75a: + data->resolution = 9; + data->sample_time = HZ / 2; + break; + case lm75b: + data->resolution = 11; + data->sample_time = HZ / 4; + break; + case max6625: + data->resolution = 9; + data->sample_time = HZ / 4; + break; + case max6626: + data->resolution = 12; + data->resolution_limits = 9; + data->sample_time = HZ / 4; + break; + case tcn75: + data->resolution = 9; + data->sample_time = HZ / 8; + break; + case mcp980x: + data->resolution_limits = 9; /* fall through */ - case tmp100: - case tmp101: + case tmp100: + case tmp101: set_mask |= 3 << 5; /* 12-bit mode */ - data->resolution = 12; - data->sample_time = HZ; + data->resolution = 12; + data->sample_time = HZ; clr_mask |= 1 << 7; /* not one-shot mode */ - break; - case tmp112: + break; + case tmp112: set_mask |= 3 << 5; /* 12-bit mode */ clr_mask |= 1 << 7; /* not one-shot mode */ - data->resolution = 12; - data->sample_time = HZ / 4; - break; - case tmp105: - case tmp175: - case tmp275: - case tmp75: + data->resolution = 12; + data->sample_time = HZ / 4; + break; + case tmp105: + case tmp175: + case tmp275: + case tmp75: set_mask |= 3 << 5; /* 12-bit mode */ clr_mask |= 1 << 7; /* not one-shot mode */ - data->resolution = 12; - data->sample_time = HZ / 2; - break; - } + data->resolution = 12; + data->sample_time = HZ / 2; + break; + } /* configure as specified */ - status = lm75_read_value(client, LM75_REG_CONF); - if (status < 0) { - dev_dbg(dev, "Can't read config? %d\n", status); - return status; + status = lm75_read_value(client, LM75_REG_CONF); + if (status < 0) { + dev_dbg(dev, "Can't read config? %d\n", status); + return status; + } + data->orig_conf = status; + new = status & ~clr_mask; + new |= set_mask; + if (status != new) + lm75_write_value(client, LM75_REG_CONF, new); + dev_dbg(dev, "Config %02x\n", new); + + data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name, + data, lm75_groups); + if (IS_ERR(data->hwmon_dev)) + return PTR_ERR(data->hwmon_dev); + + data->tz = thermal_zone_of_sensor_register(data->hwmon_dev, + 0, + data->hwmon_dev, + &lm75_of_thermal_ops); + if (IS_ERR(data->tz)) + data->tz = NULL; + + dev_info(dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; } - data->orig_conf = status; - new = status & ~clr_mask; - new |= set_mask; - if (status != new) - lm75_write_value(client, LM75_REG_CONF, new); - dev_dbg(dev, "Config %02x\n", new); - - data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name, - data, lm75_groups); - if (IS_ERR(data->hwmon_dev)) - return PTR_ERR(data->hwmon_dev); - - data->tz = thermal_zone_of_sensor_register(data->hwmon_dev, - 0, - data->hwmon_dev, - lm75_read_temp, NULL); - if (IS_ERR(data->tz)) - data->tz = NULL; - - dev_info(dev, "%s: sensor '%s'\n", - dev_name(data->hwmon_dev), client->name); - - return 0; -} -static int lm75_remove(struct i2c_client *client) -{ - struct lm75_data *data = i2c_get_clientdata(client); + static int lm75_remove(struct i2c_client *client) + { + struct lm75_data *data = i2c_get_clientdata(client); - thermal_zone_of_sensor_unregister(data->hwmon_dev, data->tz); - hwmon_device_unregister(data->hwmon_dev); - lm75_write_value(client, LM75_REG_CONF, data->orig_conf); - return 0; -} + thermal_zone_of_sensor_unregister(data->hwmon_dev, data->tz); + hwmon_device_unregister(data->hwmon_dev); + lm75_write_value(client, LM75_REG_CONF, data->orig_conf); + return 0; + } -static const struct i2c_device_id lm75_ids[] = { - { "adt75", adt75, }, - { "ds1775", ds1775, }, - { "ds75", ds75, }, - { "ds7505", ds7505, }, - { "g751", g751, }, - { "lm75", lm75, }, - { "lm75a", lm75a, }, - { "dx010_lm75b", lm75b, }, - { "max6625", max6625, }, - { "max6626", max6626, }, - { "mcp980x", mcp980x, }, - { "stds75", stds75, }, - { "tcn75", tcn75, }, - { "tmp100", tmp100, }, - { "tmp101", tmp101, }, - { "tmp105", tmp105, }, - { "tmp112", tmp112, }, - { "tmp175", tmp175, }, - { "tmp275", tmp275, }, - { "tmp75", tmp75, }, + static const struct i2c_device_id lm75_ids[] = { + { "adt75", adt75, }, + { "ds1775", ds1775, }, + { "ds75", ds75, }, + { "ds7505", ds7505, }, + { "g751", g751, }, + { "lm75", lm75, }, + { "lm75a", lm75a, }, + { "dx010_lm75b", lm75b, }, + { "max6625", max6625, }, + { "max6626", max6626, }, + { "mcp980x", mcp980x, }, + { "stds75", stds75, }, + { "tcn75", tcn75, }, + { "tmp100", tmp100, }, + { "tmp101", tmp101, }, + { "tmp105", tmp105, }, + { "tmp112", tmp112, }, + { "tmp175", tmp175, }, + { "tmp275", tmp275, }, + { "tmp75", tmp75, }, { /* LIST END */ } -}; -MODULE_DEVICE_TABLE(i2c, lm75_ids); + }; + MODULE_DEVICE_TABLE(i2c, lm75_ids); #define LM75A_ID 0xA1 /* Return 0 if detection is successful, -ENODEV otherwise */ -static int lm75_detect(struct i2c_client *new_client, - struct i2c_board_info *info) -{ - struct i2c_adapter *adapter = new_client->adapter; - int i; - int conf, hyst, os; - bool is_lm75a = 0; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA)) - return -ENODEV; + static int lm75_detect(struct i2c_client *new_client, + struct i2c_board_info *info) + { + struct i2c_adapter *adapter = new_client->adapter; + int i; + int conf, hyst, os; + bool is_lm75a = 0; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + return -ENODEV; /* * Now, we do the remaining detection. There is no identification- @@ -385,105 +389,105 @@ static int lm75_detect(struct i2c_client *new_client, */ /* Unused bits */ - conf = i2c_smbus_read_byte_data(new_client, 1); - if (conf & 0xe0) - return -ENODEV; + conf = i2c_smbus_read_byte_data(new_client, 1); + if (conf & 0xe0) + return -ENODEV; /* First check for LM75A */ - if (i2c_smbus_read_byte_data(new_client, 7) == LM75A_ID) { + if (i2c_smbus_read_byte_data(new_client, 7) == LM75A_ID) { /* LM75A returns 0xff on unused registers so just to be sure we check for that too. */ - if (i2c_smbus_read_byte_data(new_client, 4) != 0xff - || i2c_smbus_read_byte_data(new_client, 5) != 0xff - || i2c_smbus_read_byte_data(new_client, 6) != 0xff) - return -ENODEV; - is_lm75a = 1; - hyst = i2c_smbus_read_byte_data(new_client, 2); - os = i2c_smbus_read_byte_data(new_client, 3); + if (i2c_smbus_read_byte_data(new_client, 4) != 0xff + || i2c_smbus_read_byte_data(new_client, 5) != 0xff + || i2c_smbus_read_byte_data(new_client, 6) != 0xff) + return -ENODEV; + is_lm75a = 1; + hyst = i2c_smbus_read_byte_data(new_client, 2); + os = i2c_smbus_read_byte_data(new_client, 3); } else { /* Traditional style LM75 detection */ /* Unused addresses */ - hyst = i2c_smbus_read_byte_data(new_client, 2); - if (i2c_smbus_read_byte_data(new_client, 4) != hyst - || i2c_smbus_read_byte_data(new_client, 5) != hyst - || i2c_smbus_read_byte_data(new_client, 6) != hyst - || i2c_smbus_read_byte_data(new_client, 7) != hyst) - return -ENODEV; - os = i2c_smbus_read_byte_data(new_client, 3); - if (i2c_smbus_read_byte_data(new_client, 4) != os - || i2c_smbus_read_byte_data(new_client, 5) != os - || i2c_smbus_read_byte_data(new_client, 6) != os - || i2c_smbus_read_byte_data(new_client, 7) != os) - return -ENODEV; - } + hyst = i2c_smbus_read_byte_data(new_client, 2); + if (i2c_smbus_read_byte_data(new_client, 4) != hyst + || i2c_smbus_read_byte_data(new_client, 5) != hyst + || i2c_smbus_read_byte_data(new_client, 6) != hyst + || i2c_smbus_read_byte_data(new_client, 7) != hyst) + return -ENODEV; + os = i2c_smbus_read_byte_data(new_client, 3); + if (i2c_smbus_read_byte_data(new_client, 4) != os + || i2c_smbus_read_byte_data(new_client, 5) != os + || i2c_smbus_read_byte_data(new_client, 6) != os + || i2c_smbus_read_byte_data(new_client, 7) != os) + return -ENODEV; + } /* Addresses cycling */ - for (i = 8; i <= 248; i += 40) { - if (i2c_smbus_read_byte_data(new_client, i + 1) != conf - || i2c_smbus_read_byte_data(new_client, i + 2) != hyst - || i2c_smbus_read_byte_data(new_client, i + 3) != os) - return -ENODEV; - if (is_lm75a && i2c_smbus_read_byte_data(new_client, i + 7) + for (i = 8; i <= 248; i += 40) { + if (i2c_smbus_read_byte_data(new_client, i + 1) != conf + || i2c_smbus_read_byte_data(new_client, i + 2) != hyst + || i2c_smbus_read_byte_data(new_client, i + 3) != os) + return -ENODEV; + if (is_lm75a && i2c_smbus_read_byte_data(new_client, i + 7) != LM75A_ID) - return -ENODEV; - } + return -ENODEV; + } - strlcpy(info->type, is_lm75a ? "lm75a" : "lm75", I2C_NAME_SIZE); + strlcpy(info->type, is_lm75a ? "lm75a" : "lm75", I2C_NAME_SIZE); - return 0; -} + return 0; + } #ifdef CONFIG_PM -static int lm75_suspend(struct device *dev) -{ - int status; - struct i2c_client *client = to_i2c_client(dev); - status = lm75_read_value(client, LM75_REG_CONF); - if (status < 0) { - dev_dbg(&client->dev, "Can't read config? %d\n", status); - return status; + static int lm75_suspend(struct device *dev) + { + int status; + struct i2c_client *client = to_i2c_client(dev); + status = lm75_read_value(client, LM75_REG_CONF); + if (status < 0) { + dev_dbg(&client->dev, "Can't read config? %d\n", status); + return status; + } + status = status | LM75_SHUTDOWN; + lm75_write_value(client, LM75_REG_CONF, status); + return 0; } - status = status | LM75_SHUTDOWN; - lm75_write_value(client, LM75_REG_CONF, status); - return 0; -} -static int lm75_resume(struct device *dev) -{ - int status; - struct i2c_client *client = to_i2c_client(dev); - status = lm75_read_value(client, LM75_REG_CONF); - if (status < 0) { - dev_dbg(&client->dev, "Can't read config? %d\n", status); - return status; + static int lm75_resume(struct device *dev) + { + int status; + struct i2c_client *client = to_i2c_client(dev); + status = lm75_read_value(client, LM75_REG_CONF); + if (status < 0) { + dev_dbg(&client->dev, "Can't read config? %d\n", status); + return status; + } + status = status & ~LM75_SHUTDOWN; + lm75_write_value(client, LM75_REG_CONF, status); + return 0; } - status = status & ~LM75_SHUTDOWN; - lm75_write_value(client, LM75_REG_CONF, status); - return 0; -} -static const struct dev_pm_ops lm75_dev_pm_ops = { - .suspend = lm75_suspend, - .resume = lm75_resume, -}; + static const struct dev_pm_ops lm75_dev_pm_ops = { + .suspend = lm75_suspend, + .resume = lm75_resume, + }; #define LM75_DEV_PM_OPS (&lm75_dev_pm_ops) #else #define LM75_DEV_PM_OPS NULL #endif /* CONFIG_PM */ -static struct i2c_driver lm75_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = "dx010_lm75", - .pm = LM75_DEV_PM_OPS, - }, - .probe = lm75_probe, - .remove = lm75_remove, - .id_table = lm75_ids, + static struct i2c_driver lm75_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "dx010_lm75", + .pm = LM75_DEV_PM_OPS, + }, + .probe = lm75_probe, + .remove = lm75_remove, + .id_table = lm75_ids, /* .detect = lm75_detect, .address_list = normal_i2c, */ -}; + }; /*-----------------------------------------------------------------------*/ @@ -494,33 +498,33 @@ static struct i2c_driver lm75_driver = { * LM75 uses a high-byte first convention, which is exactly opposite to * the SMBus standard. */ -static int lm75_read_value(struct i2c_client *client, u8 reg) -{ - if (reg == LM75_REG_CONF) - return i2c_smbus_read_byte_data(client, reg); - else - return i2c_smbus_read_word_swapped(client, reg); -} + static int lm75_read_value(struct i2c_client *client, u8 reg) + { + if (reg == LM75_REG_CONF) + return i2c_smbus_read_byte_data(client, reg); + else + return i2c_smbus_read_word_swapped(client, reg); + } -static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) -{ - if (reg == LM75_REG_CONF) - return i2c_smbus_write_byte_data(client, reg, value); - else - return i2c_smbus_write_word_swapped(client, reg, value); -} + static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) + { + if (reg == LM75_REG_CONF) + return i2c_smbus_write_byte_data(client, reg, value); + else + return i2c_smbus_write_word_swapped(client, reg, value); + } -static struct lm75_data *lm75_update_device(struct device *dev) -{ - struct lm75_data *data = dev_get_drvdata(dev); - struct i2c_client *client = data->client; - struct lm75_data *ret = data; + static struct lm75_data *lm75_update_device(struct device *dev) + { + struct lm75_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + struct lm75_data *ret = data; - mutex_lock(&data->update_lock); + mutex_lock(&data->update_lock); - if (time_after(jiffies, data->last_updated + data->sample_time) - || !data->valid) { - int i; + if (time_after(jiffies, data->last_updated + data->sample_time) + || !data->valid) { + int i; dev_dbg(&client->dev, "Starting lm75 update\n"); for (i = 0; i < ARRAY_SIZE(data->temp); i++) { @@ -541,7 +545,7 @@ static struct lm75_data *lm75_update_device(struct device *dev) data->valid = 1; } -abort: + abort: mutex_unlock(&data->update_lock); return ret; } diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h index 5cde94e56f17..c9097f9db7ab 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h @@ -46,4 +46,4 @@ static inline int LM75_TEMP_FROM_REG(u16 reg) /* use integer division instead of equivalent right shift to guarantee arithmetic shift and preserve the sign */ return ((s16)reg / 128) * 500; -} +} \ No newline at end of file From 025dad0e11377d642976e213a27a79826e1bf5d4 Mon Sep 17 00:00:00 2001 From: pwisutti <33824525+pwisutti@users.noreply.github.com> Date: Thu, 1 Mar 2018 01:20:01 +0700 Subject: [PATCH 1493/1833] [celestica] change to use lm75 standard driver (#19) --- .../x86_64-cel_seastone-r0/sensors.conf | 27 +- .../debian/platform-modules-dx010.init | 11 +- .../dx010/modules/Makefile | 7 +- .../dx010/modules/lm75.c | 557 ------------------ .../dx010/modules/lm75.h | 49 -- 5 files changed, 19 insertions(+), 632 deletions(-) delete mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.c delete mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h diff --git a/device/celestica/x86_64-cel_seastone-r0/sensors.conf b/device/celestica/x86_64-cel_seastone-r0/sensors.conf index 6ce4540b226e..307587f687e5 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sensors.conf +++ b/device/celestica/x86_64-cel_seastone-r0/sensors.conf @@ -36,33 +36,30 @@ chip "dps460-i2c-*-5b" set in3_crit 13.0 set in3_lcrit 11.0 -# These sensors located on CPU Board. -chip "dx010_lm75b-i2c-*-48" - label temp1 "CPU_external temp sensor" +# These sensors located on Main Switch Board. +chip "lm75b-i2c-*-48" + label temp1 "Front-panel temp sensor 1" set temp1_max 43 set temp1_max_hyst 28 -chip "dx010_lm75b-i2c-*-4e" - label temp1 "Rear_panel temp sensor" +chip "lm75b-i2c-*-49" + label temp1 "Front-panel temp sensor 2" set temp1_max 43 set temp1_max_hyst 28 -# These sensors located on Main Switch Board. -bus "i2c-5" "i2c-1-mux (chan_id 3)" -chip "dx010_lm75b-i2c-5-48" - label temp1 "Front_panel left temp sensor" +chip "lm75b-i2c-*-4a" + label temp1 "ASIC temp sensor" set temp1_max 43 set temp1_max_hyst 28 -bus "i2c-6" "i2c-1-mux (chan_id 4)" -chip "dx010_lm75b-i2c-6-49" - label temp1 "Front_panel right temp sensor" +# These sensors located on CPU Board. +chip "lm75b-i2c-*-48" + label temp1 "Rear-panel temp sensor 1" set temp1_max 43 set temp1_max_hyst 28 -bus "i2c-7" "i2c-1-mux (chan_id 5)" -chip "dx010_lm75b-i2c-7-4a" - label temp1 "Switch_external temp sensor" +chip "lm75b-i2c-*-4e" + label temp1 "Rear-panel temp sensor 2" set temp1_max 43 set temp1_max_hyst 28 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 index 0c883cd388ae..c51aa742076b 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init @@ -20,6 +20,7 @@ start) modprobe i2c-mux-pca954x modprobe dx010_wdt modprobe leds-dx010 + modprobe lm75 found=0 for devnum in 0 1; do @@ -56,11 +57,11 @@ start) echo 24lc64t 0x50 > /sys/bus/i2c/devices/i2c-12/new_device # Attach temperature sensors - echo dx010_lm75b 0x48 > /sys/bus/i2c/devices/i2c-5/new_device - echo dx010_lm75b 0x49 > /sys/bus/i2c/devices/i2c-6/new_device - echo dx010_lm75b 0x4a > /sys/bus/i2c/devices/i2c-7/new_device - echo dx010_lm75b 0x48 > /sys/bus/i2c/devices/i2c-14/new_device - echo dx010_lm75b 0x4e > /sys/bus/i2c/devices/i2c-15/new_device + 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 diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile index bb398cc5a745..9b0f10604811 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/Makefile @@ -1,6 +1 @@ -obj-m := dx010_cpld.o mc24lc64t.o emc2305.o dx010_wdt.o leds-dx010.o lm75.o -KVERSION = $(shell uname -r) -all: - make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules -clean: - make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean +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/lm75.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.c deleted file mode 100644 index 140d8f365598..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - * lm75.c - Part of lm_sensors, Linux kernel modules for hardware - * monitoring - * Copyright (c) 1998, 1999 Frodo Looijaard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "lm75.h" - - -/* - * This driver handles the LM75 and compatible digital temperature sensors. - */ - -enum lm75_type { /* keep sorted in alphabetical order */ -adt75, -ds1775, -ds75, -ds7505, -g751, -lm75, -lm75a, -lm75b, -max6625, -max6626, -mcp980x, -stds75, -tcn75, -tmp100, -tmp101, -tmp105, -tmp112, -tmp175, -tmp275, -tmp75, -}; - -/* Addresses scanned */ -static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, - 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; - - -/* The LM75 registers */ -#define LM75_REG_CONF 0x01 - static const u8 LM75_REG_TEMP[3] = { - 0x00, /* input */ - 0x03, /* max */ - 0x02, /* hyst */ - }; - -/* Each client has this additional data */ - struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ - }; - - static int lm75_read_value(struct i2c_client *client, u8 reg); - static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value); - static struct lm75_data *lm75_update_device(struct device *dev); - - -/*-----------------------------------------------------------------------*/ - - static inline long lm75_reg_to_mc(s16 temp, u8 resolution) - { - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); - } - -/* sysfs attributes for hwmon */ - - static int lm75_read_temp(void *dev, int *temp) - { - struct lm75_data *data = lm75_update_device(dev); - - if (IS_ERR(data)) - return PTR_ERR(data); - - *temp = lm75_reg_to_mc(data->temp[0], data->resolution); - - return 0; - } - - static ssize_t show_temp(struct device *dev, struct device_attribute *da, - char *buf) - { - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct lm75_data *data = lm75_update_device(dev); - - if (IS_ERR(data)) - return PTR_ERR(data); - - return sprintf(buf, "%ld\n", lm75_reg_to_mc(data->temp[attr->index], - data->resolution)); - } - - static ssize_t set_temp(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) - { - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct lm75_data *data = dev_get_drvdata(dev); - struct i2c_client *client = data->client; - int nr = attr->index; - long temp; - int error; - u8 resolution; - - error = kstrtol(buf, 10, &temp); - if (error) - return error; - - /* - * Resolution of limit registers is assumed to be the same as the - * temperature input register resolution unless given explicitly. - */ - if (attr->index && data->resolution_limits) - resolution = data->resolution_limits; - else - resolution = data->resolution; - - mutex_lock(&data->update_lock); - temp = clamp_val(temp, LM75_TEMP_MIN, LM75_TEMP_MAX); - data->temp[nr] = DIV_ROUND_CLOSEST(temp << (resolution - 8), - 1000) << (16 - resolution); - lm75_write_value(client, LM75_REG_TEMP[nr], data->temp[nr]); - mutex_unlock(&data->update_lock); - return count; - } - - static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, - show_temp, set_temp, 1); - static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, - show_temp, set_temp, 2); - static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); - - static struct attribute *lm75_attrs[] = { - &sensor_dev_attr_temp1_input.dev_attr.attr, - &sensor_dev_attr_temp1_max.dev_attr.attr, - &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, - - NULL - }; - ATTRIBUTE_GROUPS(lm75); - -/*-----------------------------------------------------------------------*/ - - static const struct thermal_zone_of_device_ops lm75_of_thermal_ops = { - .get_temp = lm75_read_temp, - }; - -/* device probe and removal */ - - static int - lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) - { - struct device *dev = &client->dev; - struct lm75_data *data; - int status; - u8 set_mask, clr_mask; - int new; - enum lm75_type kind = id->driver_data; - - if (!i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) - return -EIO; - - data = devm_kzalloc(dev, sizeof(struct lm75_data), GFP_KERNEL); - if (!data) - return -ENOMEM; - - data->client = client; - i2c_set_clientdata(client, data); - mutex_init(&data->update_lock); - - /* Set to LM75 resolution (9 bits, 1/2 degree C) and range. - * Then tweak to be more precise when appropriate. - */ - set_mask = 0; - clr_mask = LM75_SHUTDOWN; /* continuous conversions */ - - switch (kind) { - case adt75: - clr_mask |= 1 << 5; /* not one-shot mode */ - data->resolution = 12; - data->sample_time = HZ / 8; - break; - case ds1775: - case ds75: - case stds75: - clr_mask |= 3 << 5; - set_mask |= 2 << 5; /* 11-bit mode */ - data->resolution = 11; - data->sample_time = HZ; - break; - case ds7505: - set_mask |= 3 << 5; /* 12-bit mode */ - data->resolution = 12; - data->sample_time = HZ / 4; - break; - case g751: - case lm75: - case lm75a: - data->resolution = 9; - data->sample_time = HZ / 2; - break; - case lm75b: - data->resolution = 11; - data->sample_time = HZ / 4; - break; - case max6625: - data->resolution = 9; - data->sample_time = HZ / 4; - break; - case max6626: - data->resolution = 12; - data->resolution_limits = 9; - data->sample_time = HZ / 4; - break; - case tcn75: - data->resolution = 9; - data->sample_time = HZ / 8; - break; - case mcp980x: - data->resolution_limits = 9; - /* fall through */ - case tmp100: - case tmp101: - set_mask |= 3 << 5; /* 12-bit mode */ - data->resolution = 12; - data->sample_time = HZ; - clr_mask |= 1 << 7; /* not one-shot mode */ - break; - case tmp112: - set_mask |= 3 << 5; /* 12-bit mode */ - clr_mask |= 1 << 7; /* not one-shot mode */ - data->resolution = 12; - data->sample_time = HZ / 4; - break; - case tmp105: - case tmp175: - case tmp275: - case tmp75: - set_mask |= 3 << 5; /* 12-bit mode */ - clr_mask |= 1 << 7; /* not one-shot mode */ - data->resolution = 12; - data->sample_time = HZ / 2; - break; - } - - /* configure as specified */ - status = lm75_read_value(client, LM75_REG_CONF); - if (status < 0) { - dev_dbg(dev, "Can't read config? %d\n", status); - return status; - } - data->orig_conf = status; - new = status & ~clr_mask; - new |= set_mask; - if (status != new) - lm75_write_value(client, LM75_REG_CONF, new); - dev_dbg(dev, "Config %02x\n", new); - - data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name, - data, lm75_groups); - if (IS_ERR(data->hwmon_dev)) - return PTR_ERR(data->hwmon_dev); - - data->tz = thermal_zone_of_sensor_register(data->hwmon_dev, - 0, - data->hwmon_dev, - &lm75_of_thermal_ops); - if (IS_ERR(data->tz)) - data->tz = NULL; - - dev_info(dev, "%s: sensor '%s'\n", - dev_name(data->hwmon_dev), client->name); - - return 0; - } - - static int lm75_remove(struct i2c_client *client) - { - struct lm75_data *data = i2c_get_clientdata(client); - - thermal_zone_of_sensor_unregister(data->hwmon_dev, data->tz); - hwmon_device_unregister(data->hwmon_dev); - lm75_write_value(client, LM75_REG_CONF, data->orig_conf); - return 0; - } - - static const struct i2c_device_id lm75_ids[] = { - { "adt75", adt75, }, - { "ds1775", ds1775, }, - { "ds75", ds75, }, - { "ds7505", ds7505, }, - { "g751", g751, }, - { "lm75", lm75, }, - { "lm75a", lm75a, }, - { "dx010_lm75b", lm75b, }, - { "max6625", max6625, }, - { "max6626", max6626, }, - { "mcp980x", mcp980x, }, - { "stds75", stds75, }, - { "tcn75", tcn75, }, - { "tmp100", tmp100, }, - { "tmp101", tmp101, }, - { "tmp105", tmp105, }, - { "tmp112", tmp112, }, - { "tmp175", tmp175, }, - { "tmp275", tmp275, }, - { "tmp75", tmp75, }, - { /* LIST END */ } - }; - MODULE_DEVICE_TABLE(i2c, lm75_ids); - -#define LM75A_ID 0xA1 - -/* Return 0 if detection is successful, -ENODEV otherwise */ - static int lm75_detect(struct i2c_client *new_client, - struct i2c_board_info *info) - { - struct i2c_adapter *adapter = new_client->adapter; - int i; - int conf, hyst, os; - bool is_lm75a = 0; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA)) - return -ENODEV; - - /* - * Now, we do the remaining detection. There is no identification- - * dedicated register so we have to rely on several tricks: - * unused bits, registers cycling over 8-address boundaries, - * addresses 0x04-0x07 returning the last read value. - * The cycling+unused addresses combination is not tested, - * since it would significantly slow the detection down and would - * hardly add any value. - * - * The National Semiconductor LM75A is different than earlier - * LM75s. It has an ID byte of 0xaX (where X is the chip - * revision, with 1 being the only revision in existence) in - * register 7, and unused registers return 0xff rather than the - * last read value. - * - * Note that this function only detects the original National - * Semiconductor LM75 and the LM75A. Clones from other vendors - * aren't detected, on purpose, because they are typically never - * found on PC hardware. They are found on embedded designs where - * they can be instantiated explicitly so detection is not needed. - * The absence of identification registers on all these clones - * would make their exhaustive detection very difficult and weak, - * and odds are that the driver would bind to unsupported devices. - */ - - /* Unused bits */ - conf = i2c_smbus_read_byte_data(new_client, 1); - if (conf & 0xe0) - return -ENODEV; - - /* First check for LM75A */ - if (i2c_smbus_read_byte_data(new_client, 7) == LM75A_ID) { - /* LM75A returns 0xff on unused registers so - just to be sure we check for that too. */ - if (i2c_smbus_read_byte_data(new_client, 4) != 0xff - || i2c_smbus_read_byte_data(new_client, 5) != 0xff - || i2c_smbus_read_byte_data(new_client, 6) != 0xff) - return -ENODEV; - is_lm75a = 1; - hyst = i2c_smbus_read_byte_data(new_client, 2); - os = i2c_smbus_read_byte_data(new_client, 3); - } else { /* Traditional style LM75 detection */ - /* Unused addresses */ - hyst = i2c_smbus_read_byte_data(new_client, 2); - if (i2c_smbus_read_byte_data(new_client, 4) != hyst - || i2c_smbus_read_byte_data(new_client, 5) != hyst - || i2c_smbus_read_byte_data(new_client, 6) != hyst - || i2c_smbus_read_byte_data(new_client, 7) != hyst) - return -ENODEV; - os = i2c_smbus_read_byte_data(new_client, 3); - if (i2c_smbus_read_byte_data(new_client, 4) != os - || i2c_smbus_read_byte_data(new_client, 5) != os - || i2c_smbus_read_byte_data(new_client, 6) != os - || i2c_smbus_read_byte_data(new_client, 7) != os) - return -ENODEV; - } - - /* Addresses cycling */ - for (i = 8; i <= 248; i += 40) { - if (i2c_smbus_read_byte_data(new_client, i + 1) != conf - || i2c_smbus_read_byte_data(new_client, i + 2) != hyst - || i2c_smbus_read_byte_data(new_client, i + 3) != os) - return -ENODEV; - if (is_lm75a && i2c_smbus_read_byte_data(new_client, i + 7) - != LM75A_ID) - return -ENODEV; - } - - strlcpy(info->type, is_lm75a ? "lm75a" : "lm75", I2C_NAME_SIZE); - - return 0; - } - -#ifdef CONFIG_PM - static int lm75_suspend(struct device *dev) - { - int status; - struct i2c_client *client = to_i2c_client(dev); - status = lm75_read_value(client, LM75_REG_CONF); - if (status < 0) { - dev_dbg(&client->dev, "Can't read config? %d\n", status); - return status; - } - status = status | LM75_SHUTDOWN; - lm75_write_value(client, LM75_REG_CONF, status); - return 0; - } - - static int lm75_resume(struct device *dev) - { - int status; - struct i2c_client *client = to_i2c_client(dev); - status = lm75_read_value(client, LM75_REG_CONF); - if (status < 0) { - dev_dbg(&client->dev, "Can't read config? %d\n", status); - return status; - } - status = status & ~LM75_SHUTDOWN; - lm75_write_value(client, LM75_REG_CONF, status); - return 0; - } - - static const struct dev_pm_ops lm75_dev_pm_ops = { - .suspend = lm75_suspend, - .resume = lm75_resume, - }; -#define LM75_DEV_PM_OPS (&lm75_dev_pm_ops) -#else -#define LM75_DEV_PM_OPS NULL -#endif /* CONFIG_PM */ - - static struct i2c_driver lm75_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = "dx010_lm75", - .pm = LM75_DEV_PM_OPS, - }, - .probe = lm75_probe, - .remove = lm75_remove, - .id_table = lm75_ids, -/* - .detect = lm75_detect, - .address_list = normal_i2c, -*/ - }; - -/*-----------------------------------------------------------------------*/ - -/* register access */ - -/* - * All registers are word-sized, except for the configuration register. - * LM75 uses a high-byte first convention, which is exactly opposite to - * the SMBus standard. - */ - static int lm75_read_value(struct i2c_client *client, u8 reg) - { - if (reg == LM75_REG_CONF) - return i2c_smbus_read_byte_data(client, reg); - else - return i2c_smbus_read_word_swapped(client, reg); - } - - static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) - { - if (reg == LM75_REG_CONF) - return i2c_smbus_write_byte_data(client, reg, value); - else - return i2c_smbus_write_word_swapped(client, reg, value); - } - - static struct lm75_data *lm75_update_device(struct device *dev) - { - struct lm75_data *data = dev_get_drvdata(dev); - struct i2c_client *client = data->client; - struct lm75_data *ret = data; - - mutex_lock(&data->update_lock); - - if (time_after(jiffies, data->last_updated + data->sample_time) - || !data->valid) { - int i; - dev_dbg(&client->dev, "Starting lm75 update\n"); - - for (i = 0; i < ARRAY_SIZE(data->temp); i++) { - int status; - - status = lm75_read_value(client, LM75_REG_TEMP[i]); - if (unlikely(status < 0)) { - dev_dbg(dev, - "LM75: Failed to read value: reg %d, error %d\n", - LM75_REG_TEMP[i], status); - ret = ERR_PTR(status); - data->valid = 0; - goto abort; - } - data->temp[i] = status; - } - data->last_updated = jiffies; - data->valid = 1; - } - - abort: - mutex_unlock(&data->update_lock); - return ret; -} - -module_i2c_driver(lm75_driver); - -MODULE_AUTHOR("Frodo Looijaard "); -MODULE_DESCRIPTION("LM75 driver"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h deleted file mode 100644 index c9097f9db7ab..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/lm75.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - lm75.h - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2003 Mark M. Hoffman - - 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. -*/ - -/* - This file contains common code for encoding/decoding LM75 type - temperature readings, which are emulated by many of the chips - we support. As the user is unlikely to load more than one driver - which contains this code, we don't worry about the wasted space. -*/ - -#include - -/* straight from the datasheet */ -#define LM75_TEMP_MIN (-55000) -#define LM75_TEMP_MAX 125000 -#define LM75_SHUTDOWN 0x01 - -/* TEMP: 0.001C/bit (-55C to +125C) - REG: (0.5C/bit, two's complement) << 7 */ -static inline u16 LM75_TEMP_TO_REG(long temp) -{ - int ntemp = clamp_val(temp, LM75_TEMP_MIN, LM75_TEMP_MAX); - ntemp += (ntemp < 0 ? -250 : 250); - return (u16)((ntemp / 500) << 7); -} - -static inline int LM75_TEMP_FROM_REG(u16 reg) -{ - /* use integer division instead of equivalent right shift to - guarantee arithmetic shift and preserve the sign */ - return ((s16)reg / 128) * 500; -} \ No newline at end of file From 4142d7f4bfabf611ebc88c3791d8ae1dbd2fb130 Mon Sep 17 00:00:00 2001 From: nealtai <33504193+nealtai@users.noreply.github.com> Date: Thu, 1 Mar 2018 16:55:28 +0800 Subject: [PATCH 1494/1833] [Delta]: Modify delta-ag9032v1 driver for kernel 4.9 (#20) Signed-off-by: neal tai --- platform/broadcom/rules.mk | 2 +- .../ag9032v1/modules/Makefile | 1 - .../modules/delta_ag9032v1_platform.c | 219 ++++++++++++++++-- .../ag9032v1/modules/dni_ag9032v1_psu.c | 7 +- .../debian/control | 2 +- .../debian/platform-modules-ag9032v1.install | 1 + .../sonic-platform-modules-delta/debian/rules | 2 +- .../systemd/platform-modules-ag9032v1.service | 13 ++ 8 files changed, 217 insertions(+), 30 deletions(-) create mode 100644 platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag9032v1.service diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index eff7236da249..a065506a4287 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -7,7 +7,7 @@ include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk include $(PLATFORM_PATH)/platform-modules-inventec.mk include $(PLATFORM_PATH)/platform-modules-cel.mk -#include $(PLATFORM_PATH)/platform-modules-delta.mk +include $(PLATFORM_PATH)/platform-modules-delta.mk include $(PLATFORM_PATH)/platform-modules-quanta.mk #include $(PLATFORM_PATH)/platform-modules-mitac.mk include $(PLATFORM_PATH)/docker-orchagent-brcm.mk diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile index fc335c2a977f..d77d3b78408f 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/Makefile @@ -1,2 +1 @@ obj-m := dni_ag9032v1_psu.o dni_emc2305.o delta_ag9032v1_platform.o delta_ag9032v1_cpupld.o - diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c index abf5b7e3a024..982110236272 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c @@ -248,25 +248,25 @@ static struct i2c_device_platform_data ag9032v1_i2c_device_platform_data[] = { { /* psu 1 (0x58) */ .parent = 40, - .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = 0 }, + .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = (void *) 0 }, .client = NULL, }, { /* psu 2 (0x58) */ .parent = 41, - .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = 1 }, + .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = (void *) 1 }, .client = NULL, }, { /* hot-swap 1 (0x40) */ .parent = 42, - .info = { .type = "ltc4215", .addr = 0x40, .platform_data = 0 }, + .info = { .type = "ltc4215", .addr = 0x40, .platform_data = (void *) 0 }, .client = NULL, }, { /* hot-swap 2 (0x40) */ .parent = 43, - .info = { .type = "ltc4215", .addr = 0x40, .platform_data = 1 }, + .info = { .type = "ltc4215", .addr = 0x40, .platform_data = (void *) 1 }, .client = NULL, }, { @@ -1043,22 +1043,22 @@ static ssize_t get_present(struct device *dev, struct device_attribute \ ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_1); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data = (u32)reverse_8bits(ret) & 0xff; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_2); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 8; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_3); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 16; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_4); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 24; return sprintf(buf, "0x%08x\n", data); //return 32bits data @@ -1072,22 +1072,22 @@ static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_1); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data = (u32)(reverse_8bits(ret) & 0xff); ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_2); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 8; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_3); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 16; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_4); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 24; return sprintf(buf, "0x%08x\n", data); //return 32bits data @@ -1119,22 +1119,22 @@ static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, c ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_1); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data = (u32)(reverse_8bits(ret) & 0xff); ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_2); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 8; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_3); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 16; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_4); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 24; return sprintf(buf, "0x%08x\n", data); //return 32bits data @@ -1166,22 +1166,22 @@ static ssize_t get_response(struct device *dev, struct device_attribute *devattr ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_1); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data = (u32)(reverse_8bits(ret) & 0xff); ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_2); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 8; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_3); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 16; ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_4); if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); + return sprintf(buf, "error number(%d)",ret); data |= (u32)(reverse_8bits(ret) & 0xff) << 24; return sprintf(buf, "0x%08x\n", data); //return 32bits data @@ -2048,6 +2048,7 @@ static int cpld_reg_write_byte(struct i2c_client *client, u8 regaddr, u8 val) regaddr, I2C_SMBUS_BYTE_DATA, &data); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) { struct swpld_mux *mux = data; @@ -2123,7 +2124,86 @@ static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) } return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); } +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int swpld_mux_select(struct i2c_mux_core *muxc, u32 chan) +{ + struct swpld_mux *mux = i2c_mux_priv(muxc); + u8 swpld_mux_val=0; + + if ( mux->data.base_nr == BUS3_BASE_NUM ) + { + switch (chan) { + case 0: + swpld_mux_val = TEMP_FAN_VAL; + break; + case 1: + swpld_mux_val = FAN_EEPROM1_VAL; + break; + case 2: + swpld_mux_val = FAN_EEPROM2_VAL; + break; + case 3: + swpld_mux_val = FAN_EEPROM3_VAL; + break; + case 4: + swpld_mux_val = FAN_EEPROM4_VAL; + break; + case 5: + swpld_mux_val = FAN_EEPROM5_VAL; + break; + case 6: + swpld_mux_val = FANIO_CTL_VAL; + break; + case 7: + case 8: + swpld_mux_val = FAN_CTRL_VAL; + break; + } + } + else if ( mux->data.base_nr == BUS4_BASE_NUM ) + { + switch (chan) { + case 0: + swpld_mux_val = PSU1_VAL; + break; + case 1: + swpld_mux_val = PSU2_VAL; + break; + case 2: + swpld_mux_val = HOT_SWAP1_VAL; + break; + case 3: + swpld_mux_val = HOT_SWAP2_VAL; + break; + } + } + else if ( mux->data.base_nr == BUS5_BASE_NUM ){ + if (chan < 9){ + swpld_mux_val = (u8)(chan) + 0x01; + } + else if (8 < chan && chan < 19){ + swpld_mux_val = (u8)(chan - 9) + 0x10; + } + else if (18 < chan && chan < 29){ + swpld_mux_val = (u8)(chan - 19) + 0x20; + } + else if (28 < chan && chan < 39){ + swpld_mux_val = (u8)(chan - 29) + 0x30; + } + else{ + swpld_mux_val = 0x00; + } + } + else + { + swpld_mux_val = 0x00; + } + + return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); +} +#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) static int __init swpld_mux_probe(struct platform_device *pdev) { struct swpld_mux *mux; @@ -2202,8 +2282,89 @@ static int __init swpld_mux_probe(struct platform_device *pdev) return ret; } +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc; + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + printk(KERN_ERR "Failed to allocate memory for mux\n"); + return -ENOMEM; + } + mux->data = *pdata; + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + kfree(mux); + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS3: + dev_num = BUS3_DEV_NUM; + break; + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + case BUS5: + dev_num = BUS5_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + + + muxc = i2c_mux_alloc(parent, &pdev->dev, dev_num, 0, 0, + swpld_mux_select, NULL); + if (!muxc) { + ret = -ENOMEM; + goto alloc_failed; + } + muxc->priv = mux; + platform_set_drvdata(pdev, muxc); + + + for (i = 0; i < dev_num; i++) { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + ret = i2c_mux_add_adapter(muxc, nr, i, class); + if (ret) { + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + dev_info(&pdev->dev, "%d port mux on %s adapter\n", dev_num, parent->name); + return 0; + +add_adapter_failed: + i2c_mux_del_adapters(muxc); +alloc_failed: + kfree(mux); + i2c_put_adapter(parent); + + return ret; +} +#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) static int __exit swpld_mux_remove(struct platform_device *pdev) { int i; @@ -2249,6 +2410,18 @@ static int __exit swpld_mux_remove(struct platform_device *pdev) return 0; } +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc = platform_get_drvdata(pdev); + struct i2c_adapter *parent=muxc->parent; + + i2c_mux_del_adapters(muxc); + i2c_put_adapter(parent); + + return 0; +} +#endif static struct platform_driver swpld_mux_driver = { .probe = swpld_mux_probe, @@ -2261,9 +2434,9 @@ static struct platform_driver swpld_mux_driver = { /*---------------- MUX - end ------------- */ /*---------------- module initialization ------------- */ -static void __init delta_ag9032v1_platform_init(void) +static int __init delta_ag9032v1_platform_init(void) { - struct i2c_client *client; +// struct i2c_client *client; struct i2c_adapter *adapter; struct cpld_platform_data *cpld_pdata; struct swpld_mux_platform_data *swpld_mux_pdata; @@ -2342,7 +2515,7 @@ static void __init delta_ag9032v1_platform_init(void) for (; i >= 0; i--) { platform_device_unregister(&ag9032v1_swpld_mux[i]); } - platform_driver_unregister(&ag9032v1_cpld); + platform_driver_unregister((struct platform_driver *) &ag9032v1_cpld); error_ag9032v1_cpld: platform_driver_unregister(&i2c_device_driver); error_i2c_device_driver: diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c index e47813af3e09..7d9350bc55bd 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/dni_ag9032v1_psu.c @@ -24,8 +24,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include +#include #include #include #include @@ -43,6 +43,7 @@ u8 psu_member_data = 0x00; + /* Address scanned */ static const unsigned short normal_i2c[] = { 0x58, I2C_CLIENT_END }; @@ -419,7 +420,7 @@ static SENSOR_DEVICE_ATTR(temp1_input, \ S_IRUGO, for_linear_data, NULL, PSU_TEMP1_INPUT); static SENSOR_DEVICE_ATTR(fan1_target, \ S_IRUGO, for_fan_target, NULL, PSU_FAN1_FAULT); -static SENSOR_DEVICE_ATTR(fan1_set_percentage, S_IWUGO | S_IRUGO, \ +static SENSOR_DEVICE_ATTR(fan1_set_percentage, S_IWUSR | S_IRUGO, \ for_linear_data, set_fan_duty_cycle_input, PSU_FAN1_DUTY_CYCLE); static SENSOR_DEVICE_ATTR(fan1_input, \ S_IRUGO, for_linear_data, NULL, PSU_FAN1_SPEED); @@ -427,7 +428,7 @@ static SENSOR_DEVICE_ATTR(psu_mfr_model, \ S_IRUGO, for_ascii, NULL, PSU_MFR_MODEL); static SENSOR_DEVICE_ATTR(psu_mfr_serial, \ S_IRUGO, for_ascii, NULL, PSU_MFR_SERIAL); -static SENSOR_DEVICE_ATTR(psu_select_member, S_IWUGO | S_IRUGO, \ +static SENSOR_DEVICE_ATTR(psu_select_member, S_IWUSR | S_IRUGO, \ for_r_member_data, set_w_member_data, PSU_SELECT_MEMBER); static struct attribute *dps_800ab_16_d_attributes[] = { diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control index 455a5f296ac0..06ac0c80a87d 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/control +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.3 Package: platform-modules-ag9032v1 Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 +Depends: linux-image-4.9.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ag9064 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install index 40f7e56d832d..beca4f51b1f8 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.install @@ -1,3 +1,4 @@ ag9032v1/scripts/ag9032v1_platform_init.sh usr/local/bin ag9032v1/scripts/led_status.sh usr/local/bin ag9032v1/cfg/ag9032v1-modules.conf etc/modules-load.d +systemd/platform-modules-ag9032v1.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/rules b/platform/broadcom/sonic-platform-modules-delta/debian/rules index 57383e7241f2..d0398ecaca17 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/rules +++ b/platform/broadcom/sonic-platform-modules-delta/debian/rules @@ -8,7 +8,7 @@ MOD_SRC_DIR:= $(shell pwd) MODULE_DIRS:= ag9032v1 ag9064 ag5648 %: - dh $@ + dh $@ --with=systemd override_dh_auto_build: (for mod in $(MODULE_DIRS); do \ diff --git a/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag9032v1.service b/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag9032v1.service new file mode 100644 index 000000000000..bfa0fd296f59 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag9032v1.service @@ -0,0 +1,13 @@ +[Unit] +Description=Delta ag9032v1 Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-ag9032v1 start +ExecStop=-/etc/init.d/platform-modules-ag9032v1 stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target From 0edb3802b046723fcca597f8832285848098472d Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Thu, 1 Mar 2018 09:24:35 +0000 Subject: [PATCH 1495/1833] [build]: add stretch target to build in stretch docker --- README.md | 8 +------- platform/broadcom/platform-modules-accton.mk | 1 + platform/broadcom/platform-modules-arista.mk | 2 ++ platform/broadcom/platform-modules-cel.mk | 2 ++ platform/broadcom/platform-modules-dell.mk | 2 ++ platform/broadcom/platform-modules-delta.mk | 2 +- platform/broadcom/platform-modules-ingrasys.mk | 2 ++ platform/broadcom/platform-modules-inventec.mk | 2 ++ platform/broadcom/platform-modules-mitac.mk | 2 ++ platform/broadcom/platform-modules-quanta.mk | 2 +- platform/broadcom/platform-modules-s6000.mk | 2 ++ platform/mellanox/hw-management.mk | 2 ++ platform/mellanox/mft.mk | 2 ++ rules/ixgbe.mk | 2 ++ slave.mk | 2 ++ 15 files changed, 26 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 12aafefa44b6..0c9ded3441d8 100644 --- a/README.md +++ b/README.md @@ -80,13 +80,7 @@ The SONiC installer contains all docker images needed. SONiC uses one image for For Broadcom ASIC, we build ONIE and EOS image. EOS image is used for Arista devices, ONIE image is used for all other Broadcom ASIC based devices. make configure PLATFORM=broadcom - BLDENV=stretch make target/debs/linux-headers-4.9.0-3-common_4.9.30-2+deb9u5_all.deb \ - target/debs/sonic-platform-quanta-ix1b-32x_1.0_amd64.deb \ - target/debs/platform-modules-d7032q28b_1.1.0_amd64.deb \ - target/debs/sonic-platform-accton-as7712-32x_1.1_amd64.deb \ - target/debs/sonic-platform-ingrasys-s9100_1.1.0_amd64.deb \ - target/debs/platform-modules-z9100_1.1_amd64.deb \ - target/debs/platform-modules-s6000_1.0_amd64.deb + BLDENV=stretch make stretch # build ONIE image make target/sonic-broadcom.bin diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index b09c9559f775..729e76e3ed1d 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -46,3 +46,4 @@ ACCTON_AS7716_32XB_PLATFORM_MODULE = sonic-platform-accton-as7716-32xb_$(ACCTON_ $(ACCTON_AS7716_32XB_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7716_32xb-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7716_32XB_PLATFORM_MODULE))) +SONIC_STRETCH_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-arista.mk b/platform/broadcom/platform-modules-arista.mk index 633435c0550a..480aa0cf8396 100644 --- a/platform/broadcom/platform-modules-arista.mk +++ b/platform/broadcom/platform-modules-arista.mk @@ -21,3 +21,5 @@ $(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODU export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MODULE_PYTHON3 ARISTA_PLATFORM_MODULE_DRIVERS export ARISTA_SCD_DRIVER_CONFIG=m + +SONIC_STRETCH_DEBS += $(ARISTA_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 96cb59144fa5..234f2d5399ef 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -9,3 +9,5 @@ $(CEL_DX010_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules- $(CEL_DX010_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(CEL_DX010_PLATFORM_MODULE)_PLATFORM = x86_64-cel_seastone-r0 SONIC_DPKG_DEBS += $(CEL_DX010_PLATFORM_MODULE) + +SONIC_STRETCH_DEBS += $(CEL_DX010_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-dell.mk b/platform/broadcom/platform-modules-dell.mk index f0b5d261e05b..a6b2a9c2c365 100644 --- a/platform/broadcom/platform-modules-dell.mk +++ b/platform/broadcom/platform-modules-dell.mk @@ -15,3 +15,5 @@ SONIC_DPKG_DEBS += $(DELL_Z9100_PLATFORM_MODULE) DELL_S6100_PLATFORM_MODULE = platform-modules-s6100_$(DELL_S6100_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_S6100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6100_c2538-r0 $(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S6100_PLATFORM_MODULE))) + +SONIC_STRETCH_DEBS += $(DELL_Z9100_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-delta.mk b/platform/broadcom/platform-modules-delta.mk index f1e8562844d4..bc5bf91fd90b 100644 --- a/platform/broadcom/platform-modules-delta.mk +++ b/platform/broadcom/platform-modules-delta.mk @@ -14,7 +14,6 @@ $(DELTA_AG9032V1_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_CO $(DELTA_AG9032V1_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag9032v1-r0 SONIC_DPKG_DEBS += $(DELTA_AG9032V1_PLATFORM_MODULE) - DELTA_AG9064_PLATFORM_MODULE = platform-modules-ag9064_$(DELTA_AG9064_PLATFORM_MODULE_VERSION)_amd64.deb $(DELTA_AG9064_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag9064-r0 $(eval $(call add_extra_package,$(DELTA_AG9032V1_PLATFORM_MODULE),$(DELTA_AG9064_PLATFORM_MODULE))) @@ -23,3 +22,4 @@ DELTA_AG5648_PLATFORM_MODULE = platform-modules-ag5648_$(DELTA_AG5648_PLATFORM_M $(DELTA_AG5648_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag5648-r0 $(eval $(call add_extra_package,$(DELTA_AG9032V1_PLATFORM_MODULE),$(DELTA_AG5648_PLATFORM_MODULE))) +SONIC_STRETCH_DEBS += $(DELTA_AG9032V1_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-ingrasys.mk b/platform/broadcom/platform-modules-ingrasys.mk index f402a7fed1c6..b6195698a1f9 100644 --- a/platform/broadcom/platform-modules-ingrasys.mk +++ b/platform/broadcom/platform-modules-ingrasys.mk @@ -34,3 +34,5 @@ $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S89 $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8900_54XC_PLATFORM_MODULE))) $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S8810_32Q_PLATFORM_MODULE))) $(eval $(call add_extra_package,$(INGRASYS_S9100_PLATFORM_MODULE),$(INGRASYS_S9200_64X_PLATFORM_MODULE))) + +SONIC_STRETCH_DEBS += $(INGRASYS_S9100_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-inventec.mk b/platform/broadcom/platform-modules-inventec.mk index f4a2e65e5147..0960c2aefbcc 100644 --- a/platform/broadcom/platform-modules-inventec.mk +++ b/platform/broadcom/platform-modules-inventec.mk @@ -15,3 +15,5 @@ SONIC_DPKG_DEBS += $(INVENTEC_D7032Q28B_PLATFORM_MODULE) INVENTEC_D7054Q28B_PLATFORM_MODULE = platform-modules-d7054q28b_$(INVENTEC_D7054Q28B_PLATFORM_MODULE_VERSION)_amd64.deb $(INVENTEC_D7054Q28B_PLATFORM_MODULE)_PLATFORM = x86_64-inventec_d7054q28b-r0 $(eval $(call add_extra_package,$(INVENTEC_D7032Q28B_PLATFORM_MODULE),$(INVENTEC_D7054Q28B_PLATFORM_MODULE))) + +SONIC_STRETCH_DEBS += $(INVENTEC_D7032Q28B_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-mitac.mk b/platform/broadcom/platform-modules-mitac.mk index 07cf8617dd5c..6e7e05bf6c57 100644 --- a/platform/broadcom/platform-modules-mitac.mk +++ b/platform/broadcom/platform-modules-mitac.mk @@ -9,3 +9,5 @@ $(MITAC_LY1200_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-m $(MITAC_LY1200_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(MITAC_LY1200_32X_PLATFORM_MODULE)_PLATFORM = x86_64-mitac_ly1200_b32h0_c3-r0 SONIC_DPKG_DEBS += $(MITAC_LY1200_32X_PLATFORM_MODULE) + +SONIC_STRETCH_DEBS += $(MITAC_LY1200_32X_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-quanta.mk b/platform/broadcom/platform-modules-quanta.mk index fe4ebe405673..e1c633cd08f3 100755 --- a/platform/broadcom/platform-modules-quanta.mk +++ b/platform/broadcom/platform-modules-quanta.mk @@ -10,4 +10,4 @@ $(QUANTA_IX1B_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_C $(QUANTA_IX1B_32X_PLATFORM_MODULE)_PLATFORM = x86_64-quanta_ix1b_32x-r0 SONIC_DPKG_DEBS += $(QUANTA_IX1B_32X_PLATFORM_MODULE) - +SONIC_STRETCH_DEBS += $(QUANTA_IX1B_32X_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-s6000.mk b/platform/broadcom/platform-modules-s6000.mk index d2c105ffdc8d..00cd2cadf2d3 100644 --- a/platform/broadcom/platform-modules-s6000.mk +++ b/platform/broadcom/platform-modules-s6000.mk @@ -9,3 +9,5 @@ $(DELL_S6000_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules $(DELL_S6000_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(DELL_S6000_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6000_s1220-r0 SONIC_DPKG_DEBS += $(DELL_S6000_PLATFORM_MODULE) + +SONIC_STRETCH_DEBS += $(DELL_S6000_PLATFORM_MODULE) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index b165390cea56..ee5f923058e5 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -8,3 +8,5 @@ MLNX_HW_MANAGEMENT = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.de $(MLNX_HW_MANAGEMENT)_SRC_PATH = $(PLATFORM_PATH)/hw-management $(MLNX_HW_MANAGEMENT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_DPKG_DEBS += $(MLNX_HW_MANAGEMENT) + +SONIC_STRETCH_DEBS += $(MLNX_HW_MANAGEMENT) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index 559ff3b4cd99..9e4c08a33519 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -15,3 +15,5 @@ $(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT))) MFT_OEM = mft-oem-$(MFT_VERSION)-$(MFT_REVISION).amd64.deb $(eval $(call add_derived_package,$(MFT),$(MFT_OEM))) + +SONIC_STRETCH_DEBS += $(KERNEL_MFT) diff --git a/rules/ixgbe.mk b/rules/ixgbe.mk index 8819cd0018a3..c9ce6d97ad63 100644 --- a/rules/ixgbe.mk +++ b/rules/ixgbe.mk @@ -7,3 +7,5 @@ IXGBE_DRIVER = ixgbe.ko $(IXGBE_DRIVER)_SRC_PATH = $(SRC_PATH)/ixgbe $(IXGBE_DRIVER)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_MAKE_DEBS += $(IXGBE_DRIVER) + +SONIC_STRETCH_DEBS += $(IXGBE_DRIVER) diff --git a/slave.mk b/slave.mk index c10b9c877e35..d6ce78e6f19c 100644 --- a/slave.mk +++ b/slave.mk @@ -587,6 +587,8 @@ clean : .platform clean-logs $$(SONIC_CLEAN_DEBS) $$(SONIC_CLEAN_FILES) $$(SONIC all : .platform $$(addprefix $(TARGET_PATH)/,$$(SONIC_ALL)) +stretch : $$(addprefix $(DEBS_PATH)/,$$(SONIC_STRETCH_DEBS)) + ############################################################################### ## Standard targets ############################################################################### From 5364926b4574a0f3b8e58b37e57c47b046b9cf3a Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Thu, 1 Mar 2018 09:52:00 +0000 Subject: [PATCH 1496/1833] [build]: build initramfs, libwrap, tacacs packages under stretch docker initramfs/libwrap/tacacs packages are installed on stretch base image --- rules/initramfs-tools.mk | 2 ++ rules/libwrap.mk | 4 +++- rules/tacacs.mk | 2 ++ sonic-slave-stretch/Dockerfile | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/rules/initramfs-tools.mk b/rules/initramfs-tools.mk index 9fbeb249a6b0..974da74b028c 100644 --- a/rules/initramfs-tools.mk +++ b/rules/initramfs-tools.mk @@ -6,3 +6,5 @@ export INITRAMFS_TOOLS_VERSION INITRAMFS_TOOLS = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb $(INITRAMFS_TOOLS)_SRC_PATH = $(SRC_PATH)/initramfs-tools SONIC_MAKE_DEBS += $(INITRAMFS_TOOLS) + +SONIC_STRETCH_DEBS += $(INITRAMFS_TOOLS) diff --git a/rules/libwrap.mk b/rules/libwrap.mk index aab8e959d143..20a4b5ed204b 100644 --- a/rules/libwrap.mk +++ b/rules/libwrap.mk @@ -1,6 +1,6 @@ # libwrap packages -LIBWRAP_VERSION = 7.6.q-25 +LIBWRAP_VERSION = 7.6.q-26 export LIBWRAP_VERSION @@ -10,3 +10,5 @@ SONIC_MAKE_DEBS += $(LIBWRAP) TCPD = tcpd_$(LIBWRAP_VERSION)_amd64.deb $(eval $(call add_derived_package,$(LIBWRAP),$(TCPD))) + +SONIC_STRETCH_DEBS += $(LIBWRAP) diff --git a/rules/tacacs.mk b/rules/tacacs.mk index e31f52d9ab5d..649f6af080ed 100644 --- a/rules/tacacs.mk +++ b/rules/tacacs.mk @@ -27,3 +27,5 @@ $(LIBNSS_TACPLUS)_DEPENDS += $(LIBTAC_DEV) $(LIBNSS_TACPLUS)_RDEPENDS += $(LIBTAC2) $(LIBNSS_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/nss SONIC_MAKE_DEBS += $(LIBNSS_TACPLUS) + +SONIC_STRETCH_DEBS += $(LIBPAM_TACPLUS) $(LIBNSS_TACPLUS) diff --git a/sonic-slave-stretch/Dockerfile b/sonic-slave-stretch/Dockerfile index 3b1a333f4831..4f7582efa0b4 100644 --- a/sonic-slave-stretch/Dockerfile +++ b/sonic-slave-stretch/Dockerfile @@ -198,6 +198,8 @@ RUN apt-get update && apt-get install -y \ # For gtest libgtest-dev \ cmake \ +# For pam_tacplus build + autoconf-archive \ # For initramfs bash-completion From 689bbd2b7211367294a7b1e4424eda7e2c03479b Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 3 Mar 2018 09:10:18 +0000 Subject: [PATCH 1497/1833] [broadcom]: update opennsl module to 3.4.1.11-1 --- platform/broadcom/sdk.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk index 12b0262b9305..a74db331aba7 100644 --- a/platform/broadcom/sdk.mk +++ b/platform/broadcom/sdk.mk @@ -1,4 +1,4 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-4.9.0-5-amd64_3.2.3.7-1_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-4.9.0-5-amd64_3.2.3.7-1_amd64.deb?sv=2015-04-05&sr=b&sig=nju9vaqIjRlzV7V0wirMP6%2FNCJRsNqC%2FdqdqgxA0wrQ%3D&se=2154-12-03T07%3A37%3A17Z&sp=r" +BRCM_OPENNSL_KERNEL = opennsl-modules-4.9.0-5-amd64_3.4.1.11-1_amd64.deb +$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-4.9.0-5-amd64_3.4.1.11-1_amd64.deb?sv=2015-04-05&sr=b&sig=vdIqSXaJhvN7Blk08WyxWhfMxky0XBx37JYAmNozx3k%3D&se=2155-01-24T09%3A08%3A25Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) From 91891af27e939741614bc2f0af809ddd0a8061ed Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 3 Mar 2018 18:26:12 +0000 Subject: [PATCH 1498/1833] [bug fix]: fix delta ag9032v1 driver compilation. disable ag9064 --- .../ag9032v1/modules/delta_ag9032v1_cpupld.c | 4 ++-- .../ag9032v1/modules/delta_ag9032v1_platform.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_cpupld.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_cpupld.c index 3c8c8f8c4646..ba920f7558df 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_cpupld.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_cpupld.c @@ -348,7 +348,7 @@ static struct platform_driver cpld_driver = { /*---------------- module initialization ------------- */ -static void __init delta_ag9032v1_cpupld_init(void) +static int __init delta_ag9032v1_cpupld_init(void) { int ret; printk(KERN_WARNING "ag9032v1_platform_cpupld module initialization\n"); @@ -384,4 +384,4 @@ module_exit(delta_ag9032v1_cpupld_exit); MODULE_DESCRIPTION("DNI ag9032v1 CPLD Platform Support"); MODULE_AUTHOR("Stanley Chi "); -MODULE_LICENSE("GPL"); \ No newline at end of file +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c index 982110236272..520a935561ab 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c @@ -1613,7 +1613,7 @@ static ssize_t set_swpld_data(struct device *dev, struct device_attribute *dev_a int val; u8 mask_out; - ret = kstrtoul(buf, 0, &val); + ret = kstrtoint(buf, 0, &val); if (ret) { From 0d2ffd885f8e805cf595b00d2a1d10edb371fd69 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 5 Mar 2018 07:07:40 +0000 Subject: [PATCH 1499/1833] [baseimage]: move update initramfs to later stage some platform drivers install blacklist.conf in /etc/modprobe.d. Those configuration should be proprogated into initramfs to avoid loading those blacklisted driver. --- build_debian.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 05eb3d91fcee..c5368c4a2229 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -150,7 +150,6 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf 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 -sudo chroot $FILESYSTEM_ROOT update-initramfs -u ## Install latest intel ixgbe driver sudo cp target/debs/ixgbe.ko $FILESYSTEM_ROOT/lib/modules/${LINUX_KERNEL_VERSION}-amd64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko @@ -369,6 +368,9 @@ if [ "${enable_organization_extensions}" = "y" ]; then fi fi +## Update initramfs +sudo chroot $FILESYSTEM_ROOT update-initramfs -u + ## Clean up apt sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoremove sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoclean From 764a7edd83685a2245e436c8ce5e36f407434084 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 27 Mar 2018 09:32:05 -0700 Subject: [PATCH 1500/1833] [device]: Enable arista drivers for sonic-linux-kernel 4.9 (#21) * Enable arista drivers * Add vfat ascii charset in initramfs * Update boot0.j2 for 4.9 kernel * Fix i2c offsets in sensors.conf * Bump sonic-platform-modules-arista submodule --- .../x86_64-arista_7050_qx32/sensors.conf | 20 +++++++++---------- files/Aboot/boot0.j2 | 6 ++++-- files/initramfs-tools/modules | 1 + platform/broadcom/rules.mk | 2 +- .../broadcom/sonic-platform-modules-arista | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/sensors.conf b/device/arista/x86_64-arista_7050_qx32/sensors.conf index 481c9ec30114..8b6ca752fe83 100644 --- a/device/arista/x86_64-arista_7050_qx32/sensors.conf +++ b/device/arista/x86_64-arista_7050_qx32/sensors.conf @@ -2,21 +2,21 @@ # ------------------------------------------------ # -bus "i2c-2" "SCD 0000:04:00.0 SMBus master 0 bus 0" -bus "i2c-3" "SCD 0000:04:00.0 SMBus master 0 bus 1" -bus "i2c-5" "SCD 0000:04:00.0 SMBus master 0 bus 3" -bus "i2c-6" "SCD 0000:04:00.0 SMBus master 0 bus 4" -bus "i2c-7" "SCD 0000:04:00.0 SMBus master 0 bus 5" +bus "i2c-5" "SCD 0000:04:00.0 SMBus master 0 bus 0" +bus "i2c-6" "SCD 0000:04:00.0 SMBus master 0 bus 1" +bus "i2c-8" "SCD 0000:04:00.0 SMBus master 0 bus 3" +bus "i2c-9" "SCD 0000:04:00.0 SMBus master 0 bus 4" +bus "i2c-10" "SCD 0000:04:00.0 SMBus master 0 bus 5" chip "k10temp-pci-00c3" label temp1 "Cpu temp sensor" -chip "lm73-i2c-3-48" +chip "lm73-i2c-6-48" label temp1 "Back panel temp sensor" set temp1_max 65 #set temp1_max_alarm 75 # read-only -chip "max6658-i2c-2-4c" +chip "max6658-i2c-5-4c" label temp1 "Board temp sensor" set temp1_max 65 set temp1_crit 75 @@ -26,7 +26,7 @@ chip "max6658-i2c-2-4c" set temp2_crit 75 # disabled because of some eeprom corruption risks -#chip "pmbus-i2c-3-4e" +#chip "pmbus-i2c-6-4e" # label temp1 "Power controller sensor 1" # set temp1_max 60 # set temp1_crit 70 @@ -37,7 +37,7 @@ chip "max6658-i2c-2-4c" # ignore curr1 -chip "dps460-i2c-5-58" +chip "dps460-i2c-8-58" label temp1 "Power supply 1 inlet temp sensor" # maximum and critical thresholds are not supported for this psu set temp1_max 60 @@ -59,7 +59,7 @@ chip "dps460-i2c-5-58" set curr2_max 36 set curr2_crit 37 -chip "dps460-i2c-6-58" +chip "dps460-i2c-9-58" label temp1 "Power supply 2 inlet temp sensor" # maximum and critical thresholds are not supported for this psu set temp1_max 60 diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index ab2cdedb6383..94f9b760352d 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -153,12 +153,12 @@ platform_specific() { if [ "$platform" = "raven" ]; then aboot_machine=arista_7050_qx32 flash_size=2000 - echo "modprobe.blacklist=radeon" >>/tmp/append + echo "modprobe.blacklist=radeon,sp5100_tco acpi=off" >>/tmp/append fi if [ "$platform" = "crow" ]; then aboot_machine=arista_7050_qx32s flash_size=3700 - echo "modprobe.blacklist=radeon" >>/tmp/append + echo "modprobe.blacklist=radeon,sp5100_tco" >>/tmp/append fi if [ "$sid" = "Upperlake" ] || [ "$sid" = "UpperlakeES" ]; then aboot_machine=arista_7060_cx32s @@ -191,6 +191,8 @@ platform_specific() { fi echo "varlog_size=$varlog_size" >>/tmp/append + # disable deterministic interface naming + echo "net.ifnames=0" >>/tmp/append } get_uuid_for() { diff --git a/files/initramfs-tools/modules b/files/initramfs-tools/modules index 33f28b98b3f7..e7fcbef870d2 100644 --- a/files/initramfs-tools/modules +++ b/files/initramfs-tools/modules @@ -1,5 +1,6 @@ squashfs overlay vfat +nls_ascii nls_cp437 nls_utf8 diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index a065506a4287..582af46b86a9 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -2,7 +2,7 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-s6000.mk include $(PLATFORM_PATH)/platform-modules-dell.mk -#include $(PLATFORM_PATH)/platform-modules-arista.mk +include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk include $(PLATFORM_PATH)/platform-modules-inventec.mk diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 8f65ad92c5b5..a7edec0e19e6 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 8f65ad92c5b5dfec24e8faf068cc9d2374244edf +Subproject commit a7edec0e19e63b4ec437d32928a5362a6d0a9bc9 From cbf204ba014ca670b4223f2e36c42afd32c20d09 Mon Sep 17 00:00:00 2001 From: hans-tseng Date: Wed, 28 Mar 2018 00:33:25 +0800 Subject: [PATCH 1501/1833] [device]: add the new platform ag9064 (#23) Signed-off-by: hans --- .../plugins/sfputil.py | 10 +- .../Delta-ag9064/port_config.ini | 132 ++- .../modules/delta_ag9032v1_platform.c | 2 +- .../ag9064/modules/delta_ag9064_platform.c | 758 +++++++++++++++++- .../ag9064/modules/i2c-mei_main.c | 3 +- .../debian/control | 2 +- .../debian/platform-modules-ag9064.init | 4 +- .../debian/platform-modules-ag9064.install | 1 + .../systemd/platform-modules-ag9064.service | 13 + 9 files changed, 840 insertions(+), 85 deletions(-) create mode 100644 platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag9064.service diff --git a/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py b/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py index 54d69446b1d8..dc5f8037f26a 100644 --- a/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py +++ b/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py @@ -51,7 +51,7 @@ def get_presence(self, port_num): return False try: - reg_file = open("/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_present") + reg_file = open("/sys/devices/platform/delta-ag9032v1-swpld.0/sfp_present") except IOError as e: print "Error: unable to open file: %s" % str(e) return False @@ -76,7 +76,7 @@ def get_low_power_mode(self, port_num): return False try: - reg_file = open("/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_lpmode") + reg_file = open("/sys/devices/platform/delta-ag9032v1-swpld.0/sfp_lpmode") except IOError as e: print "Error: unable to open file: %s" % str(e) @@ -100,7 +100,7 @@ def set_low_power_mode(self, port_num, lpmode): return False try: - reg_file = open("/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_lpmode", "r+") + reg_file = open("/sys/devices/platform/delta-ag9032v1-swpld.0/sfp_lpmode", "r+") except IOError as e: print "Error: unable to open file: %s" % str(e) return False @@ -129,7 +129,7 @@ def set_low_power_mode(self, port_num, lpmode): return True def reset(self, port_num): - QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/delta-ag9032v1-cpld.0/sfp_reset" + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/delta-ag9032v1-swpld.0/sfp_reset" # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: @@ -172,4 +172,4 @@ def reset(self, port_num): reg_file.write(hex(reg_value)) reg_file.close() - return True \ No newline at end of file + return True diff --git a/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/port_config.ini b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/port_config.ini index 2c4eb341369e..be43857f82b1 100644 --- a/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/port_config.ini +++ b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/port_config.ini @@ -1,67 +1,65 @@ -# name lanes alias index -Ethernet0 49,50,51,52 Ethernet1/1 1 -Ethernet4 53,54,55,56 Ethernet2/1 2 -Ethernet8 65,66,67,68 Ethernet3/1 3 -Ethernet12 69,70,71,72 Ethernet4/1 4 -Ethernet16 81,82,83,84 Ethernet5/1 5 -Ethernet20 85,86,87,88 Ethernet6/1 6 -Ethernet24 1,2,3,4 Ethernet7/1 7 -Ethernet28 101,102,103,104 Ethernet8/1 8 -Ethernet32 5,6,7,8 Ethernet9/1 9 -Ethernet36 17,18,19,20 Ethernet10/1 10 -Ethernet40 21,22,23,24 Ethernet11/1 11 -Ethernet44 33,34,35,36 Ethernet12/1 12 -Ethernet48 37,38,39,40 Ethernet13/1 13 -Ethernet52 97,98,99,100 Ethernet14/1 14 -Ethernet56 113,114,115,116 Ethernet15/1 15 -Ethernet60 117,118,119,120 Ethernet16/1 16 -Ethernet64 129,130,131,132 Ethernet17/1 17 -Ethernet68 133,134,135,136 Ethernet18/1 18 -Ethernet72 145,146,147,148 Ethernet19/1 19 -Ethernet76 209,210,211,212 Ethernet20/1 20 -Ethernet80 213,214,215,216 Ethernet21/1 21 -Ethernet84 225,226,227,228 Ethernet22/1 22 -Ethernet88 229,230,231,232 Ethernet23/1 23 -Ethernet92 241,242,243,244 Ethernet24/1 24 -Ethernet96 245,246,247,248 Ethernet25/1 25 -Ethernet100 157,158,159,160 Ethernet26/1 26 -Ethernet104 161,162,163,164 Ethernet27/1 27 -Ethernet108 165,166,167,168 Ethernet28/1 28 -Ethernet112 177,178,179,180 Ethernet29/1 29 -Ethernet116 181,182,183,184 Ethernet30/1 30 -Ethernet120 193,194,195,196 Ethernet31/1 31 -Ethernet124 197,198,199,200 Ethernet32/1 32 -Ethernet128 61,62,63,64 Ethernet33/1 33 -Ethernet132 57,58,59,60 Ethernet34/1 34 -Ethernet136 77,78,79,80 Ethernet35/1 35 -Ethernet140 73,74,75,76 Ethernet36/1 36 -Ethernet144 93,94,95,96 Ethernet37/1 37 -Ethernet148 89,90,91,92 Ethernet38/1 38 -Ethernet152 105,106,107,108 Ethernet39/1 39 -Ethernet156 9,10,11,12 Ethernet40/1 40 -Ethernet160 25,26,27,28 Ethernet41/1 41 -Ethernet164 13,14,15,16 Ethernet42/1 42 -Ethernet168 41,42,43,44 Ethernet43/1 43 -Ethernet172 29,30,31,32 Ethernet44/1 44 -Ethernet176 45,46,47,48 Ethernet45/1 45 -Ethernet180 109,110,111,112 Ethernet46/1 46 -Ethernet184 125,126,127,128 Ethernet47/1 47 -Ethernet188 121,122,123,124 Ethernet48/1 48 -Ethernet192 141,142,143,144 Ethernet49/1 49 -Ethernet196 137,138,139,140 Ethernet50/1 50 -Ethernet200 217,218,219,220 Ethernet51/1 51 -Ethernet204 149,150,151,152 Ethernet52/1 52 -Ethernet208 233,234,235,236 Ethernet53/1 53 -Ethernet212 221,222,223,224 Ethernet54/1 54 -Ethernet216 249,250,251,252 Ethernet55/1 55 -Ethernet220 237,238,239,240 Ethernet56/1 56 -Ethernet224 153,154,155,156 Ethernet57/1 57 -Ethernet228 253,254,255,256 Ethernet58/1 58 -Ethernet232 173,174,175,176 Ethernet59/1 59 -Ethernet236 169,170,171,172 Ethernet60/1 60 -Ethernet240 189,190,191,192 Ethernet61/1 61 -Ethernet244 185,186,187,188 Ethernet62/1 62 -Ethernet248 205,206,207,208 Ethernet63/1 63 -Ethernet252 201,202,203,204 Ethernet64/1 64 -Ethernet256 257 Ethernet65 65 -Ethernet260 259 Ethernet66 66 +# name lanes alias +Ethernet0 49,50,51,52 Ethernet1/1 +Ethernet4 53,54,55,56 Ethernet2/1 +Ethernet8 65,66,67,68 Ethernet3/1 +Ethernet12 69,70,71,72 Ethernet4/1 +Ethernet16 81,82,83,84 Ethernet5/1 +Ethernet20 85,86,87,88 Ethernet6/1 +Ethernet24 1,2,3,4 Ethernet7/1 +Ethernet28 101,102,103,104 Ethernet8/1 +Ethernet32 5,6,7,8 Ethernet9/1 +Ethernet36 17,18,19,20 Ethernet10/1 +Ethernet40 21,22,23,24 Ethernet11/1 +Ethernet44 33,34,35,36 Ethernet12/1 +Ethernet48 37,38,39,40 Ethernet13/1 +Ethernet52 97,98,99,100 Ethernet14/1 +Ethernet56 113,114,115,116 Ethernet15/1 +Ethernet60 117,118,119,120 Ethernet16/1 +Ethernet64 129,130,131,132 Ethernet17/1 +Ethernet68 133,134,135,136 Ethernet18/1 +Ethernet72 145,146,147,148 Ethernet19/1 +Ethernet76 209,210,211,212 Ethernet20/1 +Ethernet80 213,214,215,216 Ethernet21/1 +Ethernet84 225,226,227,228 Ethernet22/1 +Ethernet88 229,230,231,232 Ethernet23/1 +Ethernet92 241,242,243,244 Ethernet24/1 +Ethernet96 245,246,247,248 Ethernet25/1 +Ethernet100 157,158,159,160 Ethernet26/1 +Ethernet104 161,162,163,164 Ethernet27/1 +Ethernet108 165,166,167,168 Ethernet28/1 +Ethernet112 177,178,179,180 Ethernet29/1 +Ethernet116 181,182,183,184 Ethernet30/1 +Ethernet120 193,194,195,196 Ethernet31/1 +Ethernet124 197,198,199,200 Ethernet32/1 +Ethernet128 61,62,63,64 Ethernet33/1 +Ethernet132 57,58,59,60 Ethernet34/1 +Ethernet136 77,78,79,80 Ethernet35/1 +Ethernet140 73,74,75,76 Ethernet36/1 +Ethernet144 93,94,95,96 Ethernet37/1 +Ethernet148 89,90,91,92 Ethernet38/1 +Ethernet152 105,106,107,108 Ethernet39/1 +Ethernet156 9,10,11,12 Ethernet40/1 +Ethernet160 25,26,27,28 Ethernet41/1 +Ethernet164 13,14,15,16 Ethernet42/1 +Ethernet168 41,42,43,44 Ethernet43/1 +Ethernet172 29,30,31,32 Ethernet44/1 +Ethernet176 45,46,47,48 Ethernet45/1 +Ethernet180 109,110,111,112 Ethernet46/1 +Ethernet184 125,126,127,128 Ethernet47/1 +Ethernet188 121,122,123,124 Ethernet48/1 +Ethernet192 141,142,143,144 Ethernet49/1 +Ethernet196 137,138,139,140 Ethernet50/1 +Ethernet200 217,218,219,220 Ethernet51/1 +Ethernet204 149,150,151,152 Ethernet52/1 +Ethernet208 233,234,235,236 Ethernet53/1 +Ethernet212 221,222,223,224 Ethernet54/1 +Ethernet216 249,250,251,252 Ethernet55/1 +Ethernet220 237,238,239,240 Ethernet56/1 +Ethernet224 153,154,155,156 Ethernet57/1 +Ethernet228 253,254,255,256 Ethernet58/1 +Ethernet232 173,174,175,176 Ethernet59/1 +Ethernet236 169,170,171,172 Ethernet60/1 +Ethernet240 189,190,191,192 Ethernet61/1 +Ethernet244 185,186,187,188 Ethernet62/1 +Ethernet248 205,206,207,208 Ethernet63/1 +Ethernet252 201,202,203,204 Ethernet64/1 diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c index 520a935561ab..20a91db4c0f9 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c @@ -554,7 +554,7 @@ static int __exit i2c_deivce_remove(struct platform_device *pdev) } if (pdata->client) { - parent = i2c_get_adapter(pdata->parent); + parent = (pdata->client)->adapter; i2c_unregister_device(pdata->client); i2c_put_adapter(parent); } diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c index 38fb82d443c7..f4222907d4f2 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c @@ -776,7 +776,7 @@ static int __exit i2c_deivce_remove(struct platform_device *pdev) } if (pdata->client) { - parent = i2c_get_adapter(pdata->parent); + parent = (pdata->client)->adapter; i2c_unregister_device(pdata->client); i2c_put_adapter(parent); } @@ -799,7 +799,7 @@ static struct platform_driver i2c_device_driver = { struct swpld_mux_platform_data { int parent; int base_nr; - struct i2c_client *cpld; +// struct i2c_client *cpld; }; struct swpld_mux { @@ -812,7 +812,7 @@ static struct swpld_mux_platform_data ag9064_swpld_mux_platform_data[] = { { .parent = BUS9, .base_nr = BUS9_BASE_NUM, - .cpld = NULL, +// .cpld = NULL, }, }; @@ -827,11 +827,36 @@ static struct platform_device ag9064_swpld_mux[] = }, }, }; - +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) { + uint8_t cmd_data[4]={0}; struct swpld_mux *mux = data; + uint8_t set_cmd; + int cmd_data_len; + + if ( mux->data.base_nr == BUS9_BASE_NUM ) + { + set_cmd = CMD_SETDATA; + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PORT_MUX_REG; + cmd_data[3] = chan + 1; + cmd_data_len = sizeof(cmd_data); + // return 0; + return dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + } + else + { + printk(KERN_ERR "Swpld mux QSFP select port error\n"); + return 0; + } +} +#else +static int swpld_mux_select(struct i2c_mux_core *muxc, u32 chan) +{ uint8_t cmd_data[4]={0}; + struct swpld_mux *mux = i2c_mux_priv(muxc); uint8_t set_cmd; int cmd_data_len; @@ -844,14 +869,18 @@ static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) cmd_data[3] = chan + 1; cmd_data_len = sizeof(cmd_data); return dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + return 0; } else { printk(KERN_ERR "Swpld mux QSFP select port error\n"); return 0; } + } +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) static int __init swpld_mux_probe(struct platform_device *pdev) { struct swpld_mux *mux; @@ -926,7 +955,76 @@ static int __init swpld_mux_probe(struct platform_device *pdev) return ret; } +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc; + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + printk(KERN_ERR "Failed to allocate memory for mux\n"); + return -ENOMEM; + } + mux->data = *pdata; + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + kfree(mux); + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS9: + dev_num = BUS9_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + muxc = i2c_mux_alloc(parent, &pdev->dev, dev_num, 0, 0,swpld_mux_select, NULL); + if (!muxc) { + ret = -ENOMEM; + goto alloc_failed; + } + muxc->priv = mux; + platform_set_drvdata(pdev, muxc); + + for (i = 0; i < dev_num; i++) + { + int nr = pdata->base_nr + i; + unsigned int class = 0; + ret = i2c_mux_add_adapter(muxc, nr, i, class); + if (ret) { + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + dev_info(&pdev->dev, "%d port mux on %s adapter\n", dev_num, parent->name); + return 0; + +add_adapter_failed: + i2c_mux_del_adapters(muxc); +alloc_failed2: + kfree(mux); +alloc_failed: + i2c_put_adapter(parent); + + return ret; +} +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) static int __exit swpld_mux_remove(struct platform_device *pdev) { int i; @@ -966,6 +1064,18 @@ static int __exit swpld_mux_remove(struct platform_device *pdev) return 0; } +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc = platform_get_drvdata(pdev); + struct i2c_adapter *parent=muxc->parent; + + i2c_mux_del_adapters(muxc); + i2c_put_adapter(parent); + + return 0; +} +#endif static struct platform_driver swpld_mux_driver = { .probe = swpld_mux_probe, @@ -977,13 +1087,627 @@ static struct platform_driver swpld_mux_driver = { }; /*---------------- MUX - end ------------- */ +/*---------------- CPLD - start ------------- */ + +/* CPLD -- device */ + +static ssize_t get_present(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + uint8_t cmd_data[4]={0}; + int ret; + u64 data = 0; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_PRESENCE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + ret=0; + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PRESENCE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); +// ret=0; + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_PRESENCE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_PRESENCE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_PRESENCE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PRESENCE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_PRESENCE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_PRESENCE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + uint8_t cmd_data[4]={0}; + int ret; + u64 data = 0; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + ret=0; + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_reset(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + uint8_t cmd_data[4]={0}; + int ret; + u64 data = 0; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret=0; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_response(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + uint8_t cmd_data[4]={0}; + int ret; + u64 data = 0; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = 0; + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_2; + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_3; + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_4; + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_5; + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_6; + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_7; + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_8; + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_interrupt(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + uint8_t cmd_data[4]={0}; + int ret; + u64 data = 0; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_INTERRUPT_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret=0; + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_INTERRUPT_2; + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_INTERRUPT_3; + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_INTERRUPT_4; + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_INTERRUPT_5; + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_INTERRUPT_6; + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_INTERRUPT_7; + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_INTERRUPT_8; + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + uint8_t cmd_data[4]={0}; + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + + return count; +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + uint8_t cmd_data[4]={0}; + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + + return count; +} + +static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + uint8_t cmd_data[4]={0}; + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + + return count; +} + +static DEVICE_ATTR(qsfp_present, S_IRUGO, get_present, NULL); +static DEVICE_ATTR(qsfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode); +static DEVICE_ATTR(qsfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset); +static DEVICE_ATTR(qsfp_modsel, S_IWUSR | S_IRUGO, get_response, set_response); +static DEVICE_ATTR(qsfp_interrupt, S_IRUGO, get_interrupt, NULL); + +static struct attribute *ag9064_cpld_attrs[] = { + &dev_attr_qsfp_present.attr, + &dev_attr_qsfp_lpmode.attr, + &dev_attr_qsfp_reset.attr, + &dev_attr_qsfp_modsel.attr, + &dev_attr_qsfp_interrupt.attr, + NULL, +}; + +static struct attribute_group ag9064_cpld_attr_grp = { + .attrs = ag9064_cpld_attrs, +}; + +enum cpld_type { + system_cpld, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data ag9064_cpld_platform_data[] = { + [system_cpld] = { + .reg_addr = CPLD_REG, + }, +}; + +static struct platform_device ag9064_cpld = { + .name = "delta-ag9064-cpld", + .id = 0, + .dev = { + .platform_data = ag9064_cpld_platform_data, + .release = device_release + }, +}; + +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS7); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS7); + return -ENODEV; + } + + pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); + if (!pdata[system_cpld].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); + goto error; + } + + ret = sysfs_create_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + return 0; + +error: + i2c_unregister_device(pdata[system_cpld].client); + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + if (pdata[system_cpld].client) { + if (!parent) { + parent = (pdata[system_cpld].client)->adapter; + } + i2c_unregister_device(pdata[system_cpld].client); + } + } + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-cpld", + }, +}; + +/*---------------- CPLD - end ------------- */ + /*---------------- module initialization ------------- */ -static void __init delta_ag9064_platform_init(void) +static int __init delta_ag9064_platform_init(void) { struct i2c_client *client; struct i2c_adapter *adapter; struct swpld_mux_platform_data *swpld_pdata; + struct cpld_platform_data * cpld_pdata; int ret,i = 0; printk("ag9064_platform module initialization\n"); @@ -997,6 +1721,12 @@ static void __init delta_ag9064_platform_init(void) printk(KERN_WARNING "Fail to create IPMI user\n"); } + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpld driver\n"); + goto error_cpld_driver; + } + // register the mux prob which call the SWPLD ret = platform_driver_register(&swpld_mux_driver); if (ret) { @@ -1011,9 +1741,15 @@ static void __init delta_ag9064_platform_init(void) goto error_i2c_device_driver; } + // register the CPLD + ret = platform_device_register(&ag9064_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpld device\n"); + goto error_ag9064_cpld; + } + swpld_pdata = ag9064_swpld_mux[0].dev.platform_data; - //swpld_pdata->cpld = cpld_pdata[system_cpld].client; - ret = platform_device_register(&ag9064_swpld_mux); + ret = platform_device_register(&ag9064_swpld_mux[0]); if (ret) { printk(KERN_WARNING "Fail to create swpld mux\n"); goto error_ag9064_swpld_mux; @@ -1044,10 +1780,14 @@ static void __init delta_ag9064_platform_init(void) for (; i >= 0; i--) { platform_device_unregister(&ag9064_swpld_mux); } + platform_driver_unregister(&ag9064_cpld); +error_ag9064_cpld: platform_driver_unregister(&i2c_device_driver); error_i2c_device_driver: platform_driver_unregister(&swpld_mux_driver); error_swpld_mux_driver: + platform_driver_unregister(&cpld_driver); +error_cpld_driver: return ret; } @@ -1060,8 +1800,10 @@ static void __exit delta_ag9064_platform_exit(void) } platform_device_unregister(&ag9064_swpld_mux); + platform_device_unregister(&ag9064_cpld); platform_driver_unregister(&i2c_device_driver); platform_driver_unregister(&swpld_mux_driver); + platform_driver_unregister(&cpld_driver); i2c_unregister_device(i2c_client_9548); } @@ -1070,4 +1812,4 @@ module_exit(delta_ag9064_platform_exit); MODULE_DESCRIPTION("DELTA ag9064 Platform Support"); MODULE_AUTHOR("Johnson Lu "); -MODULE_LICENSE("GPL"); \ No newline at end of file +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_main.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_main.c index 6a412a783c54..a5dbbd22b4a5 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_main.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/i2c-mei_main.c @@ -147,9 +147,10 @@ static int mei_TxRx(u8 sensor_bus, u16 addr, u8 command, char read_write, int int i = 0; struct mei_msg * msg; - unsigned char blen; +// unsigned char blen; UINT32 timeout, dwTimeout; + UINT32 blen; HECI_DEVICE sHeciDev; recv_buf = kmalloc(sizeof(unsigned char) * (32), GFP_KERNEL); diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control index 06ac0c80a87d..bb543a5a70ae 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/control +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -12,7 +12,7 @@ Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ag9064 Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 +Depends: linux-image-4.9.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ag5648 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init index dee41fd6f457..57665353e3c7 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init @@ -20,11 +20,11 @@ start) modprobe i2c-dev modprobe i2c-i801 modprobe i2c-ismt + modprobe ipmi_devintf + modprobe ipmi_si ports=0xca2 modprobe i2c-mei modprobe i2c-mux-pca954x modprobe at24 - modprobe ipmi_devintf - modprobe ipmi_si trydefaults=1 modprobe delta_ag9064_platform modprobe delta_ag9064_cpld modprobe delta_ag9064_swpld diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.install b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.install index 7776ea509487..ad7c793da3c0 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.install +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.install @@ -1 +1,2 @@ ag9064/cfg/ag9064-modules.conf etc/modules-load.d +systemd/platform-modules-ag9064.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag9064.service b/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag9064.service new file mode 100644 index 000000000000..80f6836bfdbc --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag9064.service @@ -0,0 +1,13 @@ +[Unit] +Description=Delta ag9064 Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-ag9064 start +ExecStop=-/etc/init.d/platform-modules-ag9064 stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target From d50332f6f0023e1174b82f55f26d8a39d3c0e975 Mon Sep 17 00:00:00 2001 From: AndriiS Date: Mon, 2 Apr 2018 18:35:23 +0300 Subject: [PATCH 1502/1833] [devices]: Added new Mellanox MSN2010 platform (#24) --- .../ACS-MSN2010/port_config.ini | 23 + .../ACS-MSN2010/sai.profile | 1 + .../x86_64-mlnx_msn2010-r0/installer.conf | 1 + .../x86_64-mlnx_msn2010-r0/minigraph.xml | 855 ++++++++++++++++++ .../x86_64-mlnx_msn2010-r0/plugins/eeprom.py | 32 + .../x86_64-mlnx_msn2010-r0/plugins/psuutil.py | 73 ++ .../plugins/sfplpmget.py | 43 + .../plugins/sfplpmset.py | 107 +++ .../plugins/sfpreset.py | 45 + .../x86_64-mlnx_msn2010-r0/plugins/sfputil.py | 151 ++++ .../x86_64-mlnx_msn2010-r0/sensors.conf | 19 + platform/mellanox/mlnx-sai/Makefile | 4 +- 12 files changed, 1352 insertions(+), 2 deletions(-) create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai.profile create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/installer.conf create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/sensors.conf diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini new file mode 100644 index 000000000000..1cb2cb69c592 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini @@ -0,0 +1,23 @@ +# name lanes +Ethernet0 0 +Ethernet4 4 +Ethernet8 8 +Ethernet12 12 +Ethernet16 16 +Ethernet20 20 +Ethernet24 24 +Ethernet28 28 +Ethernet32 32 +Ethernet36 36 +Ethernet40 40 +Ethernet44 44 +Ethernet48 48 +Ethernet52 52 +Ethernet56 56 +Ethernet60 60 +Ethernet64 64 +Ethernet68 68 +Ethernet72 72,73,74,75 +Ethernet76 76,77,78,79 +Ethernet80 80,81,82,83 +Ethernet84 84,85,86,87 \ No newline at end of file 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 new file mode 100644 index 000000000000..32994eb9a823 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sai_2010.xml diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/installer.conf b/device/mellanox/x86_64-mlnx_msn2010-r0/installer.conf new file mode 100644 index 000000000000..c9c9493a5404 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/installer.conf @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2010-r0/minigraph.xml new file mode 100644 index 000000000000..580cdff142f2 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/minigraph.xml @@ -0,0 +1,855 @@ + + + + + + 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 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + sonic + + + + + + Ethernet0 + 10.0.0.0/31 + + + + Ethernet4 + 10.0.0.2/31 + + + + Ethernet8 + 10.0.0.4/31 + + + + Ethernet12 + 10.0.0.6/31 + + + + Ethernet16 + 10.0.0.8/31 + + + + Ethernet20 + 10.0.0.10/31 + + + + Ethernet24 + 10.0.0.12/31 + + + + Ethernet28 + 10.0.0.14/31 + + + + Ethernet32 + 10.0.0.16/31 + + + + Ethernet36 + 10.0.0.18/31 + + + + Ethernet40 + 10.0.0.20/31 + + + + Ethernet44 + 10.0.0.22/31 + + + + Ethernet48 + 10.0.0.24/31 + + + + Ethernet52 + 10.0.0.26/31 + + + + Ethernet56 + 10.0.0.28/31 + + + + Ethernet60 + 10.0.0.30/31 + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet84 + 10.0.0.42/31 + + + + + + + + + + + + DeviceInterfaceLink + sonic + Ethernet0 + ARISTA01T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet4 + ARISTA02T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet8 + ARISTA03T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet12 + ARISTA04T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet16 + ARISTA05T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet20 + ARISTA06T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet24 + ARISTA07T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet28 + ARISTA08T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet32 + ARISTA09T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet36 + ARISTA10T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet40 + ARISTA11T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet44 + ARISTA12T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet48 + ARISTA13T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet52 + ARISTA14T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet56 + ARISTA15T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet60 + ARISTA16T2 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet64 + ARISTA01T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet68 + ARISTA02T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet72 + ARISTA03T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet76 + ARISTA04T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet80 + ARISTA05T0 + Ethernet1 + + + DeviceInterfaceLink + sonic + Ethernet84 + ARISTA06T0 + Ethernet1 + + + + + sonic + ACS-MSN2010 + + + + + + + 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 + ACS-MSN2010 +
+ diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py new file mode 100644 index 000000000000..61e37b51db71 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/bsp/eeprom/vpd_info" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py new file mode 100644 index 000000000000..b1900d173f57 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/bsp/module/" + self.psu_presence = "psu{}_pwr_status" + self.psu_oper_status = "psu{}_pwr_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + try: + with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: + return True + except IOError: + return False + + return False diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py new file mode 100644 index 000000000000..170766e9bce4 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +import sys, errno +import os +from python_sdk_api.sxd_api import * +from python_sdk_api.sx_api import * + +# Check if SFP port number is provided +if len(sys.argv) < 2: + print "SFP module number is missed." + print "Usage: sfplpmget.py " + sys.exit(errno.EINVAL) + +# Init SDK API +rc, handle = sx_api_open(None) +if (rc != SX_STATUS_SUCCESS): + print "Failed to open api handle.\nPlease check that SDK is running." + sys.exit(errno.EACCES) + +pid = os.getpid() +rc = sxd_access_reg_init(pid, None, 0) +if (rc != 0): + print "Failed to initializing register access.\nPlease check that SDK is running." + sys.exit(errno.EACCES) + +# Get SFP module number +sfp_module = int(sys.argv[1]) + +# Get MCION +mcion = ku_mcion_reg() +mcion.module = sfp_module +meta = sxd_reg_meta_t() +meta.dev_id = 1 +meta.swid = 0 +meta.access_cmd = SXD_ACCESS_CMD_GET + +rc = sxd_access_reg_mcion(mcion, meta, 1, None, None) +assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_mcion failed, rc = %d" % rc + +# Get low power mode status +lpm_mask = 1 << 8 +lpm_status = (lpm_mask & mcion.module_status_bits) != 0 +print "LPM ON" if lpm_status else "LPM OFF" diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py new file mode 100644 index 000000000000..3f31af9f2944 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python + +import sys, errno +import time +import os +from python_sdk_api.sxd_api import * +from python_sdk_api.sx_api import * + +def get_log_ports(handle, sfp_module): + port_attributes_list = new_sx_port_attributes_t_arr(64) + port_cnt_p = new_uint32_t_p() + uint32_t_p_assign(port_cnt_p, 64) + + rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) + assert rc == SX_STATUS_SUCCESS, "sx_api_port_device_get failed, rc = %d" % rc + + port_cnt = uint32_t_p_value(port_cnt_p) + 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: + log_port_list.append(port_attributes.log_port) + + return log_port_list + +def set_sfp_admin_status(handle, meta, sfp_module, sfp_log_port_list, admin_status): + # Get PMAOS + pmaos = ku_pmaos_reg() + pmaos.module = sfp_module + meta.access_cmd = SXD_ACCESS_CMD_GET + rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) + assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc + + # Set admin status to PMAOS + pmaos.ase = 1 + pmaos.ee = 1 + pmaos.e = 2 + pmaos.rst = 0 + if admin_status == SX_PORT_ADMIN_STATUS_DOWN: + pmaos.admin_status = 2 + else: + pmaos.admin_status = 1 + + meta.access_cmd = SXD_ACCESS_CMD_SET + rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) + assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc + +# Check if SFP port number is provided +if len(sys.argv) < 3: + print "SFP module number or LPM is missed." + print "Usage: sfplpmset.py " + sys.exit(errno.EINVAL) + +lpm_enable = None +if sys.argv[2] == 'on': + lpm_enable = True +elif sys.argv[2] == 'off': + lpm_enable = False +else: + print "Unrecognized LPM parameter. Please use or values" + sys.exit(errno.EINVAL) + +# Init SDK API +rc, handle = sx_api_open(None) +if (rc != SX_STATUS_SUCCESS): + print "Failed to open api handle.\nPlease check that SDK is running." + sys.exit(errno.EACCES) + +pid = os.getpid() +rc = sxd_access_reg_init(pid, None, 0) +if (rc != 0): + print "Failed to initializing register access.\nPlease check that SDK is running." + sys.exit(errno.EACCES); + +# Get SFP module and log ports number and LPM status +sfp_module = int(sys.argv[1]) +log_port_list = get_log_ports(handle, sfp_module) +if not log_port_list: + print "Failed to get log ports" + sys.exit(errno.EACCES) + +# Get PMMP +pmmp = ku_pmmp_reg() +pmmp.module = sfp_module +meta = sxd_reg_meta_t() +meta.dev_id = 1 +meta.swid = 0 +meta.access_cmd = SXD_ACCESS_CMD_GET +rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) +assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc + +# Disable admin status before LPM settings +set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_DOWN) + +# Set low power mode status +lpm_mask = 1 << 8 +if lpm_enable: + pmmp.eeprom_override = pmmp.eeprom_override | lpm_mask +else: + pmmp.eeprom_override = pmmp.eeprom_override & (~lpm_mask) + +meta.access_cmd = SXD_ACCESS_CMD_SET +rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) +assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc + +# Enable admin status after LPM settings +set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_UP) diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py new file mode 100644 index 000000000000..69fa2be614c2 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +import sys, errno +import os +from python_sdk_api.sxd_api import * +from python_sdk_api.sx_api import * + +# Check if SFP port number is provided +if len(sys.argv) < 2: + print "SFP module number or LPM is missed." + print "Usage: sfpreset.py " + sys.exit(errno.EINVAL) + +# Init SDK API +rc, handle = sx_api_open(None) +if (rc != SX_STATUS_SUCCESS): + print "Failed to open api handle.\nPlease check that SDK is running." + sys.exit(errno.EACCES) + +pid = os.getpid() +rc = sxd_access_reg_init(pid, None, 0) +if (rc != 0): + print "Failed to initializing register access.\nPlease check that SDK is running." + sys.exit(errno.EACCES) + +# Get SFP module number +sfp_module = int(sys.argv[1]) + +# Get PMAOS +pmaos = ku_pmaos_reg() +pmaos.module = sfp_module +meta = sxd_reg_meta_t() +meta.dev_id = 1 +meta.swid = 0 +meta.access_cmd = SXD_ACCESS_CMD_GET + +rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) +assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc + +# Reset SFP +pmaos.rst = 1 +meta.access_cmd = SXD_ACCESS_CMD_SET +rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) +assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc +print "Reset flag is set" diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py new file mode 100644 index 000000000000..d15c11943280 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py @@ -0,0 +1,151 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + import subprocess + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 55 + PORTS_IN_BLOCK = 56 + + EEPROM_OFFSET = 1 + + _port_to_eeprom_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(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/bsp/qsfp/qsfp{0}" + + for x in range(0, self.port_end + 1): + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string with the qsfp status + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmget.py {}".format(port_num) + + try: + output = subprocess.check_output(lpm_cmd, shell=True) + if 'LPM ON' in output: + return True + except subprocess.CalledProcessError as e: + print "Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) + return False + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + curr_lpmode = self.get_low_power_mode(port_num) + if curr_lpmode == lpmode: + return True + + lpm = 'on' if lpmode else 'off' + lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmset.py {} {}".format(port_num, lpm) + sfp_port_names = self.physical_to_logical[port_num] + + # Get port admin status + try: + enabled_ports = subprocess.check_output("ip link show up", shell=True) + except subprocess.CalledProcessError as e: + print "Error! Unable to get ports status, err msg: {}".format(e.output) + return False + + port_to_disable = [] + for port in sfp_port_names: + if port in enabled_ports: + port_to_disable.append(port) + + # Disable ports before LPM settings + for port in port_to_disable: + try: + subprocess.check_output("ifconfig {} down".format(port), shell=True) + except subprocess.CalledProcessError as e: + print "Error! Unable to set admin status to DOWN for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) + return False + + time.sleep(3) + + # Set LPM + try: + subprocess.check_output(lpm_cmd, shell=True) + except subprocess.CalledProcessError as e: + print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) + return False + + # Enable ports after LPM settings + for port in port_to_disable: + try: + subprocess.check_output("ifconfig {} up".format(port), shell=True) + except subprocess.CalledProcessError as e: + print "Error! Unable to set admin status to UP for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) + return False + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfpreset.py {}".format(port_num) + + try: + subprocess.check_output(lpm_cmd, shell=True) + return True + except subprocess.CalledProcessError as e: + print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) + return False + + return False diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2010-r0/sensors.conf new file mode 100644 index 000000000000..170b0371fb0d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/sensors.conf @@ -0,0 +1,19 @@ +bus "i2c-2" "i2c-1-mux (chan_id 1)" +chip "mlxsw-i2c-2-48" + label temp1 "ASIC Temp" + +bus "i2c-7" "i2c-1-mux (chan_id 6)" +chip "lm75-*" + label temp1 "Ambient Port Temp" + +bus "i2c-5" "i2c-1-mux (chan_id 4)" +chip "tps53679-*" + label vin "TPS vin" + label vout1 "TPS vout1" + label vout2 "TPS vout2" + label temp1 "TPS Temp1" + label temp2 "TPS Temp2" + label pout1 "TPS pouti1" + label pout2 "TPS pout2" + label iout1 "TPS iout1" + label iout2 "TPS iout2" diff --git a/platform/mellanox/mlnx-sai/Makefile b/platform/mellanox/mlnx-sai/Makefile index 9a8005e5461f..a858bf098df2 100644 --- a/platform/mellanox/mlnx-sai/Makefile +++ b/platform/mellanox/mlnx-sai/Makefile @@ -6,8 +6,8 @@ MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # get sources - rm -rf SAI-Implementation - git clone https://github.com/Mellanox/SAI-Implementation.git + #rm -rf SAI-Implementation + #git clone https://github.com/Mellanox/SAI-Implementation.git # build pushd SAI-Implementation From 244aaca1973eeb0bfc5b0d2fcf9c8a0631518ec1 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Fri, 6 Apr 2018 14:58:18 +0000 Subject: [PATCH 1503/1833] [devices]: disable compiling ag9064 and ag5648 Signed-off-by: Guohan Lu --- platform/broadcom/sonic-platform-modules-delta/debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/rules b/platform/broadcom/sonic-platform-modules-delta/debian/rules index d0398ecaca17..58a3597e7a44 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/rules +++ b/platform/broadcom/sonic-platform-modules-delta/debian/rules @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= ag9032v1 ag9064 ag5648 +MODULE_DIRS:= ag9032v1 %: dh $@ --with=systemd From b53fa5ee67cdbde326c92f74bf671e68d779ad52 Mon Sep 17 00:00:00 2001 From: StanleyCi <34563271+StanleyCi@users.noreply.github.com> Date: Sat, 14 Apr 2018 13:48:36 +0800 Subject: [PATCH 1504/1833] [devices]: Modified and fixed delta ag5648 modules. (#30) * Modified and fixed delta ag5648 modules 1. modified and fixed delta ag5648 modules. 2. enable build ag5648. Signed-off-by: neal tai * Enable build ag9064 Signed-off-by: neal tai --- .../ag5648/modules/delta_ag5648_platform.c | 3186 +++++++++-------- .../sonic-platform-modules-delta/debian/rules | 2 +- 2 files changed, 1645 insertions(+), 1543 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/delta_ag5648_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/delta_ag5648_platform.c index 814889464596..16b9ba2fbc4c 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/delta_ag5648_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/delta_ag5648_platform.c @@ -1,1542 +1,1644 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BUS4_DEV_NUM 54 -#define DEFAULT_NUM 1 -#define BUS4_BASE_NUM 10 -#define BUS4_MUX_REG 0x18 - -#define TEMP_FAN_VAL 0x06 -#define FANIO_CTL_VAL 0x07 -#define FAN_CTRL_VAL 0x05 -#define PSU1_VAL 0x00 -#define PSU2_VAL 0x20 -#define HOT_SWAP1_VAL 0x10 -#define HOT_SWAP2_VAL 0x30 - -#define SYSTEM_CPLD_REG 0x31 -#define MASTER_CPLD_REG 0x35 -#define SLAVE_CPLD_REG 0x39 - -#define FAN_LED_REG 0x05 -#define LED_REG 0x04 - -#define SFP_PRESENCE_1 0x08 -#define SFP_PRESENCE_2 0x09 -#define SFP_PRESENCE_3 0x0a -#define SFP_PRESENCE_4 0x0b -#define SFP_PRESENCE_5 0x0c -#define SFP_PRESENCE_6 0x08 -#define SFP_PRESENCE_7 0x09 -#define QSFP_PRESENCE 0x12 - -#define QSFP_RESPONSE 0x10 -#define QSFP_LP_MODE 0x11 -#define QSFP_RESET 0x13 - - -#define SFF8436_INFO(data) \ - .type = "sff8436", .addr = 0x50, .platform_data = (data) - -#define SFF_8346_PORT(eedata) \ - .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY - -#define ag5648_i2c_device_num(NUM){ \ - .name = "delta-ag5648-i2c-device", \ - .id = NUM, \ - .dev = { \ - .platform_data = &ag5648_i2c_device_platform_data[NUM], \ - .release = device_release, \ - }, \ -} - -/*Define struct to get client of i2c_new_deivce */ -struct i2c_client * i2c_client_9548; - -enum{ - BUS0 = 0, - BUS1, - BUS2, - BUS3, - BUS4, - BUS5, - BUS6, - BUS7, -}; - -unsigned char reverse_8bits(unsigned char c) -{ - unsigned char s = 0; - int i; - for (i = 0; i < 8; ++i) { - s <<= 1; - s |= c & 1; - c >>= 1; - } - return s; -} -/*---------------- I2C device - start ------------- */ -static void device_release(struct device *dev) -{ - return; -} - -struct i2c_device_platform_data { - int parent; - struct i2c_board_info info; - struct i2c_client *client; -}; -/* pca9547 - add 8 bus */ -static struct pca954x_platform_mode pca954x_mode[] = { - { .adap_id = 2, - .deselect_on_exit = 1, - }, - { .adap_id = 3, - .deselect_on_exit = 1, - }, - { .adap_id = 4, - .deselect_on_exit = 1, - }, - { .adap_id = 5, - .deselect_on_exit = 1, - }, - { .adap_id = 6, - .deselect_on_exit = 1, - }, - { .adap_id = 7, - .deselect_on_exit = 1, - }, - { .adap_id = 8, - .deselect_on_exit = 1, - }, - { .adap_id = 9, - .deselect_on_exit = 1, - }, -}; - -static struct pca954x_platform_data pca954x_data = { - .modes = pca954x_mode, - .num_modes = ARRAY_SIZE(pca954x_mode), -}; - -static struct i2c_board_info __initdata i2c_info_pca9548[] = -{ - { - I2C_BOARD_INFO("pca9548", 0x70), - .platform_data = &pca954x_data, - }, -}; - - -static struct sff_8436_platform_data sff_8436_port[] = { - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, -}; - - -static struct i2c_device_platform_data ag5648_i2c_device_platform_data[] = { - { - /* id eeprom (0x53) */ - .parent = 2, - .info = { I2C_BOARD_INFO("24c02", 0x53) }, - .client = NULL, - }, - { - /* tmp75 (0x4d) */ - .parent = 2, - .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, - .client = NULL, - }, - { - /* tmp75 (0x4d) */ - .parent = 3, - .info = { I2C_BOARD_INFO("tmp75", 0x49) }, - .client = NULL, - }, - { - /* tmp75 (0x4d) */ - .parent = 3, - .info = { I2C_BOARD_INFO("tmp75", 0x4b) }, - }, - { - /* tmp75 (0x4d) */ - .parent = 3, - .info = { I2C_BOARD_INFO("tmp75", 0x4c) }, - .client = NULL, - }, - { - /* tmp75 (0x4d) */ - .parent = 3, - .info = { I2C_BOARD_INFO("tmp75", 0x4e) }, - .client = NULL, - }, - { - /* tmp75 (0x4d) */ - .parent = 3, - .info = { I2C_BOARD_INFO("tmp75", 0x4f) }, - }, - { - /* tmp75 (0x4d) */ - .parent = 3, - .info = { I2C_BOARD_INFO("emc2305", 0x4d) }, - .client = NULL, - }, - { - /* tmp75 (0x4d) */ - .parent = 5, - .info = { I2C_BOARD_INFO("emc2305", 0x4d) }, - .client = NULL, - }, - { - /* tmp75 (0x4d) */ - .parent = 3, - .info = { I2C_BOARD_INFO("ltc4215", 0x40) }, - .client = NULL, - }, - { - /* tmp75 (0x4d) */ - .parent = 3, - .info = { I2C_BOARD_INFO("ltc4215", 0x42) }, - }, - { - /* psu1 (0x59) */ - .parent = 6, - .info = { I2C_BOARD_INFO("dni_ag5648_psu", 0x59) }, - .client = NULL, - }, - { - /* psu2 (0x58) */ - .parent = 6, - .info = { I2C_BOARD_INFO("dni_ag5648_psu", 0x58) }, - }, - { - /* qsfp 1 (0x50) */ - .parent = 10, - .info = { SFF8436_INFO(&sff_8436_port[0]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 11, - .info = { SFF8436_INFO(&sff_8436_port[1]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 12, - .info = { SFF8436_INFO(&sff_8436_port[2]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 13, - .info = { SFF8436_INFO(&sff_8436_port[3]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 14, - .info = { SFF8436_INFO(&sff_8436_port[4]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 15, - .info = { SFF8436_INFO(&sff_8436_port[5]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 16, - .info = { SFF8436_INFO(&sff_8436_port[6]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 17, - .info = { SFF8436_INFO(&sff_8436_port[7]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 18, - .info = { SFF8436_INFO(&sff_8436_port[8]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 19, - .info = { SFF8436_INFO(&sff_8436_port[9]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 20, - .info = { SFF8436_INFO(&sff_8436_port[10]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 21, - .info = { SFF8436_INFO(&sff_8436_port[11]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 22, - .info = { SFF8436_INFO(&sff_8436_port[12]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 23, - .info = { SFF8436_INFO(&sff_8436_port[13]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 24, - .info = { SFF8436_INFO(&sff_8436_port[14]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 25, - .info = { SFF8436_INFO(&sff_8436_port[15]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 26, - .info = { SFF8436_INFO(&sff_8436_port[16]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 27, - .info = { SFF8436_INFO(&sff_8436_port[17]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 28, - .info = { SFF8436_INFO(&sff_8436_port[18]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 29, - .info = { SFF8436_INFO(&sff_8436_port[19]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 30, - .info = { SFF8436_INFO(&sff_8436_port[20]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 31, - .info = { SFF8436_INFO(&sff_8436_port[21]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 32, - .info = { SFF8436_INFO(&sff_8436_port[22]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 33, - .info = { SFF8436_INFO(&sff_8436_port[23]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 34, - .info = { SFF8436_INFO(&sff_8436_port[24]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 35, - .info = { SFF8436_INFO(&sff_8436_port[25]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 36, - .info = { SFF8436_INFO(&sff_8436_port[26]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 37, - .info = { SFF8436_INFO(&sff_8436_port[27]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 38, - .info = { SFF8436_INFO(&sff_8436_port[28]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 39, - .info = { SFF8436_INFO(&sff_8436_port[29]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 40, - .info = { SFF8436_INFO(&sff_8436_port[30]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 41, - .info = { SFF8436_INFO(&sff_8436_port[31]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 42, - .info = { SFF8436_INFO(&sff_8436_port[32]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 43, - .info = { SFF8436_INFO(&sff_8436_port[33]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 44, - .info = { SFF8436_INFO(&sff_8436_port[34]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 45, - .info = { SFF8436_INFO(&sff_8436_port[35]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 46, - .info = { SFF8436_INFO(&sff_8436_port[36]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 47, - .info = { SFF8436_INFO(&sff_8436_port[37]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 48, - .info = { SFF8436_INFO(&sff_8436_port[38]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 49, - .info = { SFF8436_INFO(&sff_8436_port[39]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 50, - .info = { SFF8436_INFO(&sff_8436_port[40]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 51, - .info = { SFF8436_INFO(&sff_8436_port[41]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 52, - .info = { SFF8436_INFO(&sff_8436_port[42]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 53, - .info = { SFF8436_INFO(&sff_8436_port[43]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 54, - .info = { SFF8436_INFO(&sff_8436_port[44]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 55, - .info = { SFF8436_INFO(&sff_8436_port[45]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 56, - .info = { SFF8436_INFO(&sff_8436_port[46]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 57, - .info = { SFF8436_INFO(&sff_8436_port[47]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 58, - .info = { SFF8436_INFO(&sff_8436_port[48]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 59, - .info = { SFF8436_INFO(&sff_8436_port[49]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 60, - .info = { SFF8436_INFO(&sff_8436_port[50]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 61, - .info = { SFF8436_INFO(&sff_8436_port[51]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 62, - .info = { SFF8436_INFO(&sff_8436_port[52]) }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 63, - .info = { SFF8436_INFO(&sff_8436_port[53]) }, - .client = NULL, - }, -}; - - -static struct platform_device ag5648_i2c_device[] = { - ag5648_i2c_device_num(0), - ag5648_i2c_device_num(1), - ag5648_i2c_device_num(2), - ag5648_i2c_device_num(3), - ag5648_i2c_device_num(4), - ag5648_i2c_device_num(5), - ag5648_i2c_device_num(6), - ag5648_i2c_device_num(7), - ag5648_i2c_device_num(8), - ag5648_i2c_device_num(9), - ag5648_i2c_device_num(10), - ag5648_i2c_device_num(11), - ag5648_i2c_device_num(12), - ag5648_i2c_device_num(13), - ag5648_i2c_device_num(14), - ag5648_i2c_device_num(15), - ag5648_i2c_device_num(16), - ag5648_i2c_device_num(17), - ag5648_i2c_device_num(18), - ag5648_i2c_device_num(19), - ag5648_i2c_device_num(20), - ag5648_i2c_device_num(21), - ag5648_i2c_device_num(22), - ag5648_i2c_device_num(23), - ag5648_i2c_device_num(24), - ag5648_i2c_device_num(25), - ag5648_i2c_device_num(26), - ag5648_i2c_device_num(27), - ag5648_i2c_device_num(28), - ag5648_i2c_device_num(29), - ag5648_i2c_device_num(30), - ag5648_i2c_device_num(31), - ag5648_i2c_device_num(32), - ag5648_i2c_device_num(33), - ag5648_i2c_device_num(34), - ag5648_i2c_device_num(35), - ag5648_i2c_device_num(36), - ag5648_i2c_device_num(37), - ag5648_i2c_device_num(38), - ag5648_i2c_device_num(39), - ag5648_i2c_device_num(40), - ag5648_i2c_device_num(41), - ag5648_i2c_device_num(42), - ag5648_i2c_device_num(43), - ag5648_i2c_device_num(44), - ag5648_i2c_device_num(45), - ag5648_i2c_device_num(46), - ag5648_i2c_device_num(47), - ag5648_i2c_device_num(48), - ag5648_i2c_device_num(49), - ag5648_i2c_device_num(50), - ag5648_i2c_device_num(51), - ag5648_i2c_device_num(52), - ag5648_i2c_device_num(53), - ag5648_i2c_device_num(54), - ag5648_i2c_device_num(55), - ag5648_i2c_device_num(56), - ag5648_i2c_device_num(57), - ag5648_i2c_device_num(58), - ag5648_i2c_device_num(59), - ag5648_i2c_device_num(60), - ag5648_i2c_device_num(61), - ag5648_i2c_device_num(62), - ag5648_i2c_device_num(63), - ag5648_i2c_device_num(64), - ag5648_i2c_device_num(65), - ag5648_i2c_device_num(66), -}; - -/*---------------- I2C device - end ------------- */ - -/*---------------- I2C driver - start ------------- */ -static int __init i2c_device_probe(struct platform_device *pdev) -{ - struct i2c_device_platform_data *pdata; - struct i2c_adapter *parent; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", - pdata->parent); - return -ENODEV; - } - - pdata->client = i2c_new_device(parent, &pdata->info); - if (!pdata->client) { - dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", - pdata->info.type, pdata->parent); - return -ENODEV; - } - - return 0; -} - -static int __exit i2c_deivce_remove(struct platform_device *pdev) -{ - struct i2c_adapter *parent; - struct i2c_device_platform_data *pdata; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - return -ENODEV; - } - - if (pdata->client) { - parent = i2c_get_adapter(pdata->parent); - i2c_unregister_device(pdata->client); - i2c_put_adapter(parent); - } - - return 0; -} -static struct platform_driver i2c_device_driver = { - .probe = i2c_device_probe, - .remove = __exit_p(i2c_deivce_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag5648-i2c-device", - } -}; - -/*---------------- I2C driver - end ------------- */ - -/*---------------- CPLD - start ------------- */ - -/* CPLD -- device */ - -enum cpld_type { - system_cpld, - master_cpld, - slave_cpld, -}; - -struct cpld_platform_data { - int reg_addr; - struct i2c_client *client; -}; - -static struct cpld_platform_data ag5648_cpld_platform_data[] = { - [system_cpld] = { - .reg_addr = SYSTEM_CPLD_REG, - }, - [master_cpld] = { - .reg_addr = MASTER_CPLD_REG, - }, - [slave_cpld] = { - .reg_addr = SLAVE_CPLD_REG, - }, -}; - -static struct platform_device ag5648_cpld = { - .name = "delta-ag5648-cpld", - .id = 0, - .dev = { - .platform_data = ag5648_cpld_platform_data, - .release = device_release - }, -}; - -static ssize_t get_present(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - u64 data2 = 0; - struct cpld_platform_data *pdata = dev->platform_data; - - ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_1); - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - data = (u32)(ret & 0xff); - - ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_2); - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - data |= (u32)(ret & 0xff) << 8; - - ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_3); - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - data |= (u32)(ret & 0xff) << 16; - - ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_4); - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - data |= (u32)(ret & 0xff) << 24; - - ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_5); - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - data2 = ((u32)(ret & 0xf)) ; - - ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, SFP_PRESENCE_6); - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - data2 |= (u32)(ret & 0xff) << 4; - - ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, SFP_PRESENCE_7); - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - data2 |= (u32)((ret >> 4) & 0xf) << 12; - - ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_PRESENCE); - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - data2 |= (u32)(ret & 0x3f) << 16; - - return sprintf(buf, "0x%06x%x\n", data2, data); -} - -static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) -{ - int ret; - u32 data = 0; - struct cpld_platform_data *pdata = dev->platform_data; - - ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_LP_MODE); - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - data = ((u8)ret & 0x3f) ; - - return sprintf(buf, "0x%02x%012x\n", data); -} - -static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long data; - int err; - - struct cpld_platform_data *pdata = dev->platform_data; - - err = kstrtoul(buf, 16, &data); - if (err) - return err; - - data = data >> 48; - i2c_smbus_write_byte_data(pdata[master_cpld].client, QSFP_LP_MODE, (u8)(data & 0xff)); - - return count; -} - -static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) -{ - int ret; - u64 data = 0; - struct cpld_platform_data *pdata = dev->platform_data; - - ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_RESET); - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - - data = ((u8)ret & 0x3f); - - return sprintf(buf, "0x%02x%012x\n", data); -} - -static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long data; - int err; - struct cpld_platform_data *pdata = dev->platform_data; - - err = kstrtoul(buf, 16, &data); - if (err) - return err; - data = data >> 48; - i2c_smbus_write_byte_data(pdata[master_cpld].client, QSFP_RESET, (u8)(data & 0xff)); - - return count; -} - -static ssize_t get_response(struct device *dev, struct device_attribute *devattr, char *buf) -{ - int ret; - u8 data = 0; - struct cpld_platform_data *pdata = dev->platform_data; - - ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_RESPONSE); - - if (ret < 0) - return sprintf(buf, "error number(%ld)",ret); - data = (u8)ret & 0x3f; - - return sprintf(buf, "0x%02x%012x\n", data); -} - -static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long data; - int err; - struct cpld_platform_data *pdata = dev->platform_data; - - err = kstrtoul(buf, 16, &data); - if (err) - return err; - data = data >> 48; - i2c_smbus_write_byte_data(pdata[master_cpld].client, QSFP_RESPONSE, (u8)(data & 0xff)); - - return count; -} - -struct platform_led_status{ - int reg_data; - char *led_status; - int led_id; -}; - -static struct platform_led_status led_info[] = { - { - .reg_data = 0x00,//0000 0000 - .led_status = "fan_off", - .led_id = 0, - }, - { - .reg_data = 1 << 6,//0100 0000 - .led_status = "fan_Amber", - .led_id = 0, - }, - { - .reg_data = 2 << 6,//1000 0000 - .led_status = "fan_green", - .led_id = 0, - }, - { - .reg_data = 3 << 6,//1100 0000 - .led_status = "fan_Blinking_yellow", - .led_id = 0, - }, - { - .reg_data = 0x00, - .led_status = "sys_Blinking_green", - .led_id = 1, - }, - { - .reg_data = 1 << 4, - .led_status = "sys_green", - .led_id = 1, - }, - { - .reg_data = 2 << 4, - .led_status = "sys_Amber", - .led_id = 1, - }, - { - .reg_data = 3 << 4 , - .led_status = "sys_Amber", - .led_id = 1, - }, - { - .reg_data = 0x00, - .led_status = "pwr_off", - .led_id = 2, - }, - { - .reg_data = 1 << 1, - .led_status = "pwr_Amber", - .led_id = 2, - }, - { - .reg_data = 2 << 1, - .led_status = "pwr_green", - .led_id = 2, - }, - { - .reg_data = 3 << 1, - .led_status = "pwr_Blinking_Amber", - .led_id = 2, - }, - { - .reg_data = 0x00, - .led_status = "fan4_off", - .led_id = 3, - }, - { - .reg_data = 1 << 6, - .led_status = "fan4_green", - .led_id = 3, - }, - { - .reg_data = 2 << 6, - .led_status = "fan4_Amber", - .led_id = 3, - }, - { - .reg_data = 0x00, - .led_status = "fan3_off", - .led_id = 4, - }, - { - .reg_data = 1 << 4, - .led_status = "fan3_green", - .led_id = 4, - }, - { - .reg_data = 2 << 4, - .led_status = "fan3_Amber", - .led_id = 4, - }, - { - .reg_data = 0x00, - .led_status = "fan2_off", - .led_id = 5, - }, - { - .reg_data = 1 << 2, - .led_status = "fan2_green", - .led_id = 5, - }, - { - .reg_data = 1 << 3, - .led_status = "fan2_Amber", - .led_id = 5, - }, - { - .reg_data = 0x00, - .led_status = "fan1_off", - .led_id = 6, - }, - { - .reg_data = 1, - .led_status = "fan1_green", - .led_id = 6, - }, - { - .reg_data = 2, - .led_status = "fan1_Amber", - .led_id = 6, - }, -}; - -struct platform_led_data{ - int reg_addr; - int mask; -}; - -static struct platform_led_data led_data[] = { - { - .reg_addr = LED_REG, //0x04 - .mask = 0xc0,//1100 0000 - }, - { - .reg_addr = LED_REG, - .mask = 0x30,//0011 0000 - }, - { - .reg_addr = LED_REG, - .mask = 0x06,//0000 0110 - }, - { - .reg_addr = FAN_LED_REG,//0x05 - .mask = 0xc0,//1100 0000 - }, - { - .reg_addr = FAN_LED_REG, - .mask = 0x30,//0011 0000 - }, - { - .reg_addr = FAN_LED_REG, - .mask = 0x0c,//0000 1100 - }, - { - .reg_addr = FAN_LED_REG, - .mask = 0x03,//0000 0011 - }, -}; - - -static ssize_t get_led_color(struct device *dev, struct device_attribute *devattr, char *buf) -{ - char str[9][20] = {0}; - int board_data; - int led_data_number; - int led_info_number; - struct cpld_platform_data *pdata = dev->platform_data; - - for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ - board_data = i2c_smbus_read_byte_data(pdata[slave_cpld].client, led_data[led_data_number].reg_addr); - if(board_data >= 0){ - board_data &= led_data[led_data_number].mask; - for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ - if (led_data_number == led_info[led_info_number].led_id \ - && board_data == led_info[led_info_number].reg_data){ - sprintf(str[led_data_number], "%s", led_info[led_info_number].led_status); - } - } - } - else - printk( KERN_ERR "Missing LED board data\n"); - } - return sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n",str[0],str[1],str[2],str[3],str[4],str[5],str[6]); -} - -static ssize_t set_led_color(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - int led_info_number; - int led_data_number; - int str_compar; - int led_reg_value; - struct cpld_platform_data *pdata = dev->platform_data; - - for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ - str_compar = strncmp(buf,led_info[led_info_number].led_status,strlen(led_info[led_info_number].led_status)); - if(str_compar == 0){ - for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ - if(led_info[led_info_number].led_id == led_data_number){ - led_reg_value = i2c_smbus_read_byte_data(pdata[slave_cpld].client, led_data[led_data_number].reg_addr); - if(led_reg_value >= 0){ - led_reg_value &= (~led_data[led_data_number].mask); - led_reg_value |= led_info[led_info_number].reg_data; - i2c_smbus_write_byte_data(pdata[slave_cpld].client, (u8)(led_data[led_data_number].reg_addr & 0xff), (u8)(led_reg_value & 0xff)); - } - else - printk( KERN_ERR "Missing LED reg. data\n"); - } - } - } - } - return count; -} - -static DEVICE_ATTR(sfp_response, S_IWUSR | S_IRUGO, get_response, set_response ); -static DEVICE_ATTR(sfp_present, S_IRUGO, get_present, NULL ); -static DEVICE_ATTR(sfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode ); -static DEVICE_ATTR(sfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset ); - -static DEVICE_ATTR(led_control, S_IRUGO | S_IWUSR, get_led_color, set_led_color); - -static struct attribute *ag5648_cpld_attrs[] = { - &dev_attr_sfp_response.attr, - &dev_attr_sfp_present.attr, - &dev_attr_sfp_lpmode.attr, - &dev_attr_sfp_reset.attr, - &dev_attr_led_control.attr, - NULL, -}; - -static struct attribute_group ag5648_cpld_attr_grp = { - .attrs = ag5648_cpld_attrs, -}; - -/* CPLD -- driver */ -static int __init cpld_probe(struct platform_device *pdev) -{ - struct cpld_platform_data *pdata; - struct i2c_adapter *parent; - int ret,i; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "CPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(BUS2); - if (!parent) { - printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS2); - return -ENODEV; - } - - for (i = 0; i < ARRAY_SIZE(ag5648_cpld_platform_data); i++) { - pdata[i].client = i2c_new_dummy(parent, pdata[i].reg_addr); - if (!pdata[i].client) { - printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr); - goto error; - } - } - - ret = sysfs_create_group(&pdev->dev.kobj, &ag5648_cpld_attr_grp); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - goto error; - } - - return 0; - -error: - i--; - for (; i >= 0; i--) { - if (pdata[i].client) { - i2c_unregister_device(pdata[i].client); - } - } - i2c_put_adapter(parent); - - return -ENODEV; -} - -static int __exit cpld_remove(struct platform_device *pdev) -{ - struct i2c_adapter *parent = NULL; - struct cpld_platform_data *pdata = pdev->dev.platform_data; - int i; - sysfs_remove_group(&pdev->dev.kobj, &ag5648_cpld_attr_grp); - - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - } - else { - for (i = 0; i < ARRAY_SIZE(ag5648_cpld_platform_data); i++) { - if (pdata[i].client) { - if (!parent) { - parent = (pdata[i].client)->adapter; - } - i2c_unregister_device(pdata[i].client); - } - } - } - - i2c_put_adapter(parent); - - return 0; -} - -static struct platform_driver cpld_driver = { - .probe = cpld_probe, - .remove = __exit_p(cpld_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag5648-cpld", - }, -}; - -/*---------------- CPLD - end ------------- */ - -/*---------------- MUX - start ------------- */ - -struct swpld_mux_platform_data { - int parent; - int base_nr; - int reg_addr; - struct i2c_client *cpld; -}; - -struct swpld_mux { - struct i2c_adapter *parent; - struct i2c_adapter **child; - struct swpld_mux_platform_data data; -}; - -static struct swpld_mux_platform_data ag5648_swpld_mux_platform_data[] = { - { - .parent = BUS4, - .base_nr = BUS4_BASE_NUM, - .cpld = NULL, - .reg_addr = BUS4_MUX_REG , - }, -}; - - -static struct platform_device ag5648_swpld_mux[] = { - { - .name = "delta-ag5648-swpld-mux", - .id = 0, - .dev = { - .platform_data = &ag5648_swpld_mux_platform_data[0], - .release = device_release, - }, - }, -}; - - -static int cpld_reg_write_byte(struct i2c_client *client, u8 regaddr, u8 val) -{ - union i2c_smbus_data data; - - data.byte = val; - return client->adapter->algo->smbus_xfer(client->adapter, client->addr, - client->flags, - I2C_SMBUS_WRITE, - regaddr, I2C_SMBUS_BYTE_DATA, &data); -} - -static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) -{ - struct swpld_mux *mux = data; - u8 swpld_mux_val=0; - if ( mux->data.base_nr == BUS4_BASE_NUM ) - { - swpld_mux_val = (chan + 0x01); - } - else - { - swpld_mux_val = 0x00; - } - swpld_mux_val=swpld_mux_val & (u8)0x3F; - - return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); -} - -static int __init swpld_mux_probe(struct platform_device *pdev) -{ - struct swpld_mux *mux; - struct swpld_mux_platform_data *pdata; - struct i2c_adapter *parent; - int i, ret, dev_num; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "SWPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); - return -ENODEV; - } - - /* Judge bus number to decide how many devices*/ - switch (pdata->parent) { - case BUS4: - dev_num = BUS4_DEV_NUM; - break; - default : - dev_num = DEFAULT_NUM; - break; - } - - mux = kzalloc(sizeof(*mux), GFP_KERNEL); - if (!mux) { - ret = -ENOMEM; - printk(KERN_ERR "Failed to allocate memory for mux\n"); - goto alloc_failed; - } - - mux->parent = parent; - mux->data = *pdata; - mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); - if (!mux->child) { - ret = -ENOMEM; - printk(KERN_ERR "Failed to allocate memory for device on mux\n"); - goto alloc_failed2; - } - - for (i = 0; i < dev_num; i++) { - int nr = pdata->base_nr + i; - unsigned int class = 0; - - mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, - nr, i, class, - swpld_mux_select, NULL); - if (!mux->child[i]) { - ret = -ENODEV; - dev_err(&pdev->dev, "Failed to add adapter %d\n", i); - goto add_adapter_failed; - } - } - - platform_set_drvdata(pdev, mux); - return 0; - -add_adapter_failed: - for (; i > 0; i--) - i2c_del_mux_adapter(mux->child[i - 1]); - kfree(mux->child); -alloc_failed2: - kfree(mux); -alloc_failed: - i2c_put_adapter(parent); - - return ret; -} - - -static int __exit swpld_mux_remove(struct platform_device *pdev) -{ - int i; - struct swpld_mux *mux = platform_get_drvdata(pdev); - struct swpld_mux_platform_data *pdata; - struct i2c_adapter *parent; - int dev_num; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "SWPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", - pdata->parent); - return -ENODEV; - } - switch (pdata->parent) { - case BUS4: - dev_num = BUS4_DEV_NUM; - break; - default : - dev_num = DEFAULT_NUM; - break; - } - - for (i = 0; i < dev_num; i++) - i2c_del_mux_adapter(mux->child[i]); - - platform_set_drvdata(pdev, NULL); - i2c_put_adapter(mux->parent); - kfree(mux->child); - kfree(mux); - - return 0; -} - -static struct platform_driver swpld_mux_driver = { - .probe = swpld_mux_probe, - .remove = __exit_p(swpld_mux_remove), /* TODO */ - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag5648-swpld-mux", - }, -}; -/*---------------- MUX - end ------------- */ - - -/*---------------- module initialization ------------- */ -static void __init delta_ag5648_platform_init(void) -{ - struct i2c_client *client; - struct i2c_adapter *adapter; - struct cpld_platform_data *cpld_pdata; - struct swpld_mux_platform_data *swpld_pdata; - int ret,i = 0; - - //Use pca9547 in i2c_mux_pca954x.c - adapter = i2c_get_adapter(BUS1); - //client = i2c_new_device(adapter, &i2c_info_pca9548[0]); - i2c_client_9548 = i2c_new_device(adapter, &i2c_info_pca9548[0]); - i2c_put_adapter(adapter); - - // set the CPLD prob and remove - ret = platform_driver_register(&cpld_driver); - if (ret) { - printk(KERN_WARNING "Fail to register cpld driver\n"); - goto error_cpld_driver; - } - - // register the mux prob which call the CPLD - ret = platform_driver_register(&swpld_mux_driver); - if (ret) { - printk(KERN_WARNING "Fail to register swpld mux driver\n"); - goto error_swpld_mux_driver; - } - - // register the i2c devices - ret = platform_driver_register(&i2c_device_driver); - if (ret) { - printk(KERN_WARNING "Fail to register i2c device driver\n"); - goto error_i2c_device_driver; - } - - // register the CPLD - ret = platform_device_register(&ag5648_cpld); - if (ret) { - printk(KERN_WARNING "Fail to create cpld device\n"); - goto error_ag5648_cpld; - } - // link the CPLD and the Mux - cpld_pdata = ag5648_cpld.dev.platform_data; - - - swpld_pdata = ag5648_swpld_mux[0].dev.platform_data; - swpld_pdata->cpld = cpld_pdata[master_cpld].client; - ret = platform_device_register(&ag5648_swpld_mux[0]); - if (ret) { - printk(KERN_WARNING "Fail to create swpld mux %d\n", i); - goto error_ag5648_swpld_mux; - } - - for (i = 0; i < ARRAY_SIZE(ag5648_i2c_device); i++) - { - ret = platform_device_register(&ag5648_i2c_device[i]); - if (ret) { - printk(KERN_WARNING "Fail to create i2c device %d\n", i); - goto error_ag5648_i2c_device; - } - } - - if (ret) - goto error_ag5648_swpld_mux; - - return 0; - -error_ag5648_i2c_device: - i--; - for (; i >= 0; i--) { - platform_device_unregister(&ag5648_i2c_device[i]); - } - i = ARRAY_SIZE(ag5648_swpld_mux); -error_ag5648_swpld_mux: - i--; - for (; i >= 0; i--) { - platform_device_unregister(&ag5648_swpld_mux[0]); - } - platform_driver_unregister(&ag5648_cpld); -error_ag5648_cpld: - platform_driver_unregister(&i2c_device_driver); -error_i2c_device_driver: - platform_driver_unregister(&swpld_mux_driver); -error_swpld_mux_driver: - platform_driver_unregister(&cpld_driver); -error_cpld_driver: - return ret; -} - -static void __exit delta_ag5648_platform_exit(void) -{ - int i = 0; - - for ( i = 0; i < ARRAY_SIZE(ag5648_i2c_device); i++ ) { - platform_device_unregister(&ag5648_i2c_device[i]); - } - - for (i = 0; i < ARRAY_SIZE(ag5648_swpld_mux); i++) { - platform_device_unregister(&ag5648_swpld_mux[i]); - } - - platform_device_unregister(&ag5648_cpld); - platform_driver_unregister(&i2c_device_driver); - platform_driver_unregister(&cpld_driver); - platform_driver_unregister(&swpld_mux_driver); - - i2c_unregister_device(i2c_client_9548); -} - -module_init(delta_ag5648_platform_init); -module_exit(delta_ag5648_platform_exit); - -MODULE_DESCRIPTION("DNI ag5648 Platform Support"); -MODULE_AUTHOR("Neal Tai "); -MODULE_LICENSE("GPL"); +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BUS4_DEV_NUM 54 +#define DEFAULT_NUM 1 +#define BUS4_BASE_NUM 10 +#define BUS4_MUX_REG 0x18 + +#define TEMP_FAN_VAL 0x06 +#define FANIO_CTL_VAL 0x07 +#define FAN_CTRL_VAL 0x05 +#define PSU1_VAL 0x00 +#define PSU2_VAL 0x20 +#define HOT_SWAP1_VAL 0x10 +#define HOT_SWAP2_VAL 0x30 + +#define SYSTEM_CPLD_REG 0x31 +#define MASTER_CPLD_REG 0x35 +#define SLAVE_CPLD_REG 0x39 + +#define FAN_LED_REG 0x05 +#define LED_REG 0x04 + +#define SFP_PRESENCE_1 0x08 +#define SFP_PRESENCE_2 0x09 +#define SFP_PRESENCE_3 0x0a +#define SFP_PRESENCE_4 0x0b +#define SFP_PRESENCE_5 0x0c +#define SFP_PRESENCE_6 0x08 +#define SFP_PRESENCE_7 0x09 +#define QSFP_PRESENCE 0x12 + +#define QSFP_RESPONSE 0x10 +#define QSFP_LP_MODE 0x11 +#define QSFP_RESET 0x13 + + +#define SFF8436_INFO(data) \ + .type = "sff8436", .addr = 0x50, .platform_data = (data) + +#define SFF_8436_PORT(eedata) \ + .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY + +#define ag5648_i2c_device_num(NUM){ \ + .name = "delta-ag5648-i2c-device", \ + .id = NUM, \ + .dev = { \ + .platform_data = &ag5648_i2c_device_platform_data[NUM], \ + .release = device_release, \ + }, \ +} + +/*Define struct to get client of i2c_new_deivce */ +struct i2c_client * i2c_client_9548; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, +}; + +unsigned char reverse_8bits(unsigned char c) +{ + unsigned char s = 0; + int i; + for (i = 0; i < 8; ++i) { + s <<= 1; + s |= c & 1; + c >>= 1; + } + return s; +} +/*---------------- I2C device - start ------------- */ +static void device_release(struct device *dev) +{ + return; +} + +struct i2c_device_platform_data { + int parent; + struct i2c_board_info info; + struct i2c_client *client; +}; +/* pca9548 - add 8 bus */ +static struct pca954x_platform_mode pca954x_mode[] = { + { .adap_id = 2, + .deselect_on_exit = 1, + }, + { .adap_id = 3, + .deselect_on_exit = 1, + }, + { .adap_id = 4, + .deselect_on_exit = 1, + }, + { .adap_id = 5, + .deselect_on_exit = 1, + }, + { .adap_id = 6, + .deselect_on_exit = 1, + }, + { .adap_id = 7, + .deselect_on_exit = 1, + }, + { .adap_id = 8, + .deselect_on_exit = 1, + }, + { .adap_id = 9, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_data pca954x_data = { + .modes = pca954x_mode, + .num_modes = ARRAY_SIZE(pca954x_mode), +}; + +static struct i2c_board_info __initdata i2c_info_pca9548[] = +{ + { + I2C_BOARD_INFO("pca9548", 0x70), + .platform_data = &pca954x_data, + }, +}; + + +static struct sff_8436_platform_data sff_8436_port[] = { + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, + { SFF_8436_PORT() }, +}; + + +static struct i2c_device_platform_data ag5648_i2c_device_platform_data[] = { + { + /* id eeprom (0x53) */ + .parent = 2, + .info = { I2C_BOARD_INFO("24c02", 0x53) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 2, + .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, + .client = NULL, + }, + { + /* tmp75 (0x49) */ + .parent = 3, + .info = { I2C_BOARD_INFO("tmp75", 0x49) }, + .client = NULL, + }, + { + /* tmp75 (0x4b) */ + .parent = 3, + .info = { I2C_BOARD_INFO("tmp75", 0x4b) }, + }, + { + /* tmp75 (0x4c) */ + .parent = 3, + .info = { I2C_BOARD_INFO("tmp75", 0x4c) }, + .client = NULL, + }, + { + /* tmp75 (0x4e) */ + .parent = 3, + .info = { I2C_BOARD_INFO("tmp75", 0x4e) }, + .client = NULL, + }, + { + /* tmp75 (0x4f) */ + .parent = 3, + .info = { I2C_BOARD_INFO("tmp75", 0x4f) }, + }, + { + /* tmp75 (0x4d) */ + .parent = 3, + .info = { I2C_BOARD_INFO("emc2305", 0x4d) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 5, + .info = { I2C_BOARD_INFO("emc2305", 0x4d) }, + .client = NULL, + }, + { + /* tmp75 (0x40) */ + .parent = 3, + .info = { I2C_BOARD_INFO("ltc4215", 0x40) }, + .client = NULL, + }, + { + /* tmp75 (0x42) */ + .parent = 3, + .info = { I2C_BOARD_INFO("ltc4215", 0x42) }, + }, + { + /* psu1 (0x59) */ + .parent = 6, + .info = { I2C_BOARD_INFO("dni_ag5648_psu", 0x59) }, + .client = NULL, + }, + { + /* psu2 (0x58) */ + .parent = 6, + .info = { I2C_BOARD_INFO("dni_ag5648_psu", 0x58) }, + }, + { + /* qsfp 1 (0x50) */ + .parent = 10, + .info = { SFF8436_INFO(&sff_8436_port[0]) }, + .client = NULL, + }, + { + /* qsfp 2 (0x50) */ + .parent = 11, + .info = { SFF8436_INFO(&sff_8436_port[1]) }, + .client = NULL, + }, + { + /* qsfp 3 (0x50) */ + .parent = 12, + .info = { SFF8436_INFO(&sff_8436_port[2]) }, + .client = NULL, + }, + { + /* qsfp 4 (0x50) */ + .parent = 13, + .info = { SFF8436_INFO(&sff_8436_port[3]) }, + .client = NULL, + }, + { + /* qsfp 5 (0x50) */ + .parent = 14, + .info = { SFF8436_INFO(&sff_8436_port[4]) }, + .client = NULL, + }, + { + /* qsfp 6 (0x50) */ + .parent = 15, + .info = { SFF8436_INFO(&sff_8436_port[5]) }, + .client = NULL, + }, + { + /* qsfp 7 (0x50) */ + .parent = 16, + .info = { SFF8436_INFO(&sff_8436_port[6]) }, + .client = NULL, + }, + { + /* qsfp 8 (0x50) */ + .parent = 17, + .info = { SFF8436_INFO(&sff_8436_port[7]) }, + .client = NULL, + }, + { + /* qsfp 9 (0x50) */ + .parent = 18, + .info = { SFF8436_INFO(&sff_8436_port[8]) }, + .client = NULL, + }, + { + /* qsfp 10 (0x50) */ + .parent = 19, + .info = { SFF8436_INFO(&sff_8436_port[9]) }, + .client = NULL, + }, + { + /* qsfp 11 (0x50) */ + .parent = 20, + .info = { SFF8436_INFO(&sff_8436_port[10]) }, + .client = NULL, + }, + { + /* qsfp 12 (0x50) */ + .parent = 21, + .info = { SFF8436_INFO(&sff_8436_port[11]) }, + .client = NULL, + }, + { + /* qsfp 13 (0x50) */ + .parent = 22, + .info = { SFF8436_INFO(&sff_8436_port[12]) }, + .client = NULL, + }, + { + /* qsfp 14 (0x50) */ + .parent = 23, + .info = { SFF8436_INFO(&sff_8436_port[13]) }, + .client = NULL, + }, + { + /* qsfp 15 (0x50) */ + .parent = 24, + .info = { SFF8436_INFO(&sff_8436_port[14]) }, + .client = NULL, + }, + { + /* qsfp 16 (0x50) */ + .parent = 25, + .info = { SFF8436_INFO(&sff_8436_port[15]) }, + .client = NULL, + }, + { + /* qsfp 17 (0x50) */ + .parent = 26, + .info = { SFF8436_INFO(&sff_8436_port[16]) }, + .client = NULL, + }, + { + /* qsfp 18 (0x50) */ + .parent = 27, + .info = { SFF8436_INFO(&sff_8436_port[17]) }, + .client = NULL, + }, + { + /* qsfp 19 (0x50) */ + .parent = 28, + .info = { SFF8436_INFO(&sff_8436_port[18]) }, + .client = NULL, + }, + { + /* qsfp 20 (0x50) */ + .parent = 29, + .info = { SFF8436_INFO(&sff_8436_port[19]) }, + .client = NULL, + }, + { + /* qsfp 21 (0x50) */ + .parent = 30, + .info = { SFF8436_INFO(&sff_8436_port[20]) }, + .client = NULL, + }, + { + /* qsfp 22 (0x50) */ + .parent = 31, + .info = { SFF8436_INFO(&sff_8436_port[21]) }, + .client = NULL, + }, + { + /* qsfp 23 (0x50) */ + .parent = 32, + .info = { SFF8436_INFO(&sff_8436_port[22]) }, + .client = NULL, + }, + { + /* qsfp 24 (0x50) */ + .parent = 33, + .info = { SFF8436_INFO(&sff_8436_port[23]) }, + .client = NULL, + }, + { + /* qsfp 25 (0x50) */ + .parent = 34, + .info = { SFF8436_INFO(&sff_8436_port[24]) }, + .client = NULL, + }, + { + /* qsfp 26 (0x50) */ + .parent = 35, + .info = { SFF8436_INFO(&sff_8436_port[25]) }, + .client = NULL, + }, + { + /* qsfp 27 (0x50) */ + .parent = 36, + .info = { SFF8436_INFO(&sff_8436_port[26]) }, + .client = NULL, + }, + { + /* qsfp 28 (0x50) */ + .parent = 37, + .info = { SFF8436_INFO(&sff_8436_port[27]) }, + .client = NULL, + }, + { + /* qsfp 29 (0x50) */ + .parent = 38, + .info = { SFF8436_INFO(&sff_8436_port[28]) }, + .client = NULL, + }, + { + /* qsfp 30 (0x50) */ + .parent = 39, + .info = { SFF8436_INFO(&sff_8436_port[29]) }, + .client = NULL, + }, + { + /* qsfp 31 (0x50) */ + .parent = 40, + .info = { SFF8436_INFO(&sff_8436_port[30]) }, + .client = NULL, + }, + { + /* qsfp 32 (0x50) */ + .parent = 41, + .info = { SFF8436_INFO(&sff_8436_port[31]) }, + .client = NULL, + }, + { + /* qsfp 33 (0x50) */ + .parent = 42, + .info = { SFF8436_INFO(&sff_8436_port[32]) }, + .client = NULL, + }, + { + /* qsfp 34 (0x50) */ + .parent = 43, + .info = { SFF8436_INFO(&sff_8436_port[33]) }, + .client = NULL, + }, + { + /* qsfp 35 (0x50) */ + .parent = 44, + .info = { SFF8436_INFO(&sff_8436_port[34]) }, + .client = NULL, + }, + { + /* qsfp 36 (0x50) */ + .parent = 45, + .info = { SFF8436_INFO(&sff_8436_port[35]) }, + .client = NULL, + }, + { + /* qsfp 37 (0x50) */ + .parent = 46, + .info = { SFF8436_INFO(&sff_8436_port[36]) }, + .client = NULL, + }, + { + /* qsfp 38 (0x50) */ + .parent = 47, + .info = { SFF8436_INFO(&sff_8436_port[37]) }, + .client = NULL, + }, + { + /* qsfp 39 (0x50) */ + .parent = 48, + .info = { SFF8436_INFO(&sff_8436_port[38]) }, + .client = NULL, + }, + { + /* qsfp 40 (0x50) */ + .parent = 49, + .info = { SFF8436_INFO(&sff_8436_port[39]) }, + .client = NULL, + }, + { + /* qsfp 41 (0x50) */ + .parent = 50, + .info = { SFF8436_INFO(&sff_8436_port[40]) }, + .client = NULL, + }, + { + /* qsfp 42 (0x50) */ + .parent = 51, + .info = { SFF8436_INFO(&sff_8436_port[41]) }, + .client = NULL, + }, + { + /* qsfp 43 (0x50) */ + .parent = 52, + .info = { SFF8436_INFO(&sff_8436_port[42]) }, + .client = NULL, + }, + { + /* qsfp 44 (0x50) */ + .parent = 53, + .info = { SFF8436_INFO(&sff_8436_port[43]) }, + .client = NULL, + }, + { + /* qsfp 45 (0x50) */ + .parent = 54, + .info = { SFF8436_INFO(&sff_8436_port[44]) }, + .client = NULL, + }, + { + /* qsfp 46 (0x50) */ + .parent = 55, + .info = { SFF8436_INFO(&sff_8436_port[45]) }, + .client = NULL, + }, + { + /* qsfp 47 (0x50) */ + .parent = 56, + .info = { SFF8436_INFO(&sff_8436_port[46]) }, + .client = NULL, + }, + { + /* qsfp 48 (0x50) */ + .parent = 57, + .info = { SFF8436_INFO(&sff_8436_port[47]) }, + .client = NULL, + }, + { + /* qsfp 49 (0x50) */ + .parent = 58, + .info = { SFF8436_INFO(&sff_8436_port[48]) }, + .client = NULL, + }, + { + /* qsfp 50 (0x50) */ + .parent = 59, + .info = { SFF8436_INFO(&sff_8436_port[49]) }, + .client = NULL, + }, + { + /* qsfp 51 (0x50) */ + .parent = 60, + .info = { SFF8436_INFO(&sff_8436_port[50]) }, + .client = NULL, + }, + { + /* qsfp 52 (0x50) */ + .parent = 61, + .info = { SFF8436_INFO(&sff_8436_port[51]) }, + .client = NULL, + }, + { + /* qsfp 53 (0x50) */ + .parent = 62, + .info = { SFF8436_INFO(&sff_8436_port[52]) }, + .client = NULL, + }, + { + /* qsfp 54 (0x50) */ + .parent = 63, + .info = { SFF8436_INFO(&sff_8436_port[53]) }, + .client = NULL, + }, +}; + + +static struct platform_device ag5648_i2c_device[] = { + ag5648_i2c_device_num(0), + ag5648_i2c_device_num(1), + ag5648_i2c_device_num(2), + ag5648_i2c_device_num(3), + ag5648_i2c_device_num(4), + ag5648_i2c_device_num(5), + ag5648_i2c_device_num(6), + ag5648_i2c_device_num(7), + ag5648_i2c_device_num(8), + ag5648_i2c_device_num(9), + ag5648_i2c_device_num(10), + ag5648_i2c_device_num(11), + ag5648_i2c_device_num(12), + ag5648_i2c_device_num(13), + ag5648_i2c_device_num(14), + ag5648_i2c_device_num(15), + ag5648_i2c_device_num(16), + ag5648_i2c_device_num(17), + ag5648_i2c_device_num(18), + ag5648_i2c_device_num(19), + ag5648_i2c_device_num(20), + ag5648_i2c_device_num(21), + ag5648_i2c_device_num(22), + ag5648_i2c_device_num(23), + ag5648_i2c_device_num(24), + ag5648_i2c_device_num(25), + ag5648_i2c_device_num(26), + ag5648_i2c_device_num(27), + ag5648_i2c_device_num(28), + ag5648_i2c_device_num(29), + ag5648_i2c_device_num(30), + ag5648_i2c_device_num(31), + ag5648_i2c_device_num(32), + ag5648_i2c_device_num(33), + ag5648_i2c_device_num(34), + ag5648_i2c_device_num(35), + ag5648_i2c_device_num(36), + ag5648_i2c_device_num(37), + ag5648_i2c_device_num(38), + ag5648_i2c_device_num(39), + ag5648_i2c_device_num(40), + ag5648_i2c_device_num(41), + ag5648_i2c_device_num(42), + ag5648_i2c_device_num(43), + ag5648_i2c_device_num(44), + ag5648_i2c_device_num(45), + ag5648_i2c_device_num(46), + ag5648_i2c_device_num(47), + ag5648_i2c_device_num(48), + ag5648_i2c_device_num(49), + ag5648_i2c_device_num(50), + ag5648_i2c_device_num(51), + ag5648_i2c_device_num(52), + ag5648_i2c_device_num(53), + ag5648_i2c_device_num(54), + ag5648_i2c_device_num(55), + ag5648_i2c_device_num(56), + ag5648_i2c_device_num(57), + ag5648_i2c_device_num(58), + ag5648_i2c_device_num(59), + ag5648_i2c_device_num(60), + ag5648_i2c_device_num(61), + ag5648_i2c_device_num(62), + ag5648_i2c_device_num(63), + ag5648_i2c_device_num(64), + ag5648_i2c_device_num(65), + ag5648_i2c_device_num(66), +}; + +/*---------------- I2C device - end ------------- */ + +/*---------------- I2C driver - start ------------- */ +static int __init i2c_device_probe(struct platform_device *pdev) +{ + struct i2c_device_platform_data *pdata; + struct i2c_adapter *parent; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + + pdata->client = i2c_new_device(parent, &pdata->info); + if (!pdata->client) { + dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", + pdata->info.type, pdata->parent); + return -ENODEV; + } + + return 0; +} + +static int __exit i2c_deivce_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent; + struct i2c_device_platform_data *pdata; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + if (pdata->client) { + parent = (pdata->client)->adapter; + i2c_unregister_device(pdata->client); + i2c_put_adapter(parent); + } + + return 0; +} +static struct platform_driver i2c_device_driver = { + .probe = i2c_device_probe, + .remove = __exit_p(i2c_deivce_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag5648-i2c-device", + } +}; + +/*---------------- I2C driver - end ------------- */ + +/*---------------- CPLD - start ------------- */ + +/* CPLD -- device */ + +enum cpld_type { + system_cpld, + master_cpld, + slave_cpld, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data ag5648_cpld_platform_data[] = { + [system_cpld] = { + .reg_addr = SYSTEM_CPLD_REG, + }, + [master_cpld] = { + .reg_addr = MASTER_CPLD_REG, + }, + [slave_cpld] = { + .reg_addr = SLAVE_CPLD_REG, + }, +}; + +static struct platform_device ag5648_cpld = { + .name = "delta-ag5648-cpld", + .id = 0, + .dev = { + .platform_data = ag5648_cpld_platform_data, + .release = device_release + }, +}; + +static ssize_t get_present(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u32 data = 0; + u32 data2 = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_1); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data = (u32)(ret & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_2); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(ret & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_3); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(ret & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_4); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(ret & 0xff) << 24; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, SFP_PRESENCE_5); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data2 = ((u32)(ret & 0xf)) ; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, SFP_PRESENCE_6); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data2 |= (u32)(ret & 0xff) << 4; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, SFP_PRESENCE_7); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data2 |= (u32)((ret >> 4) & 0xf) << 12; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_PRESENCE); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data2 |= (u32)(ret & 0x3f) << 16; + + return sprintf(buf, "0x%06x%x\n", data2, data); +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_LP_MODE); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data = ((u8)ret & 0x3f) ; + + return sprintf(buf, "0x%02x%012x\n", data, 0); +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + data = data >> 48; + i2c_smbus_write_byte_data(pdata[master_cpld].client, QSFP_LP_MODE, (u8)(data & 0xff)); + + return count; +} + +static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_RESET); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + + data = ((u8)ret & 0x3f); + + return sprintf(buf, "0x%02x%012x\n", data, 0); +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + data = data >> 48; + i2c_smbus_write_byte_data(pdata[master_cpld].client, QSFP_RESET, (u8)(data & 0xff)); + + return count; +} + +static ssize_t get_response(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u8 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, QSFP_RESPONSE); + + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data = (u8)ret & 0x3f; + + return sprintf(buf, "0x%02x%012x\n", data, 0); +} + +static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + data = data >> 48; + i2c_smbus_write_byte_data(pdata[master_cpld].client, QSFP_RESPONSE, (u8)(data & 0xff)); + + return count; +} + +struct platform_led_status{ + int reg_data; + char *led_status; + int led_id; +}; + +static struct platform_led_status led_info[] = { + { + .reg_data = 0x00,//0000 0000 + .led_status = "fan_off", + .led_id = 0, + }, + { + .reg_data = 1 << 6,//0100 0000 + .led_status = "fan_Amber", + .led_id = 0, + }, + { + .reg_data = 2 << 6,//1000 0000 + .led_status = "fan_green", + .led_id = 0, + }, + { + .reg_data = 3 << 6,//1100 0000 + .led_status = "fan_Blinking_yellow", + .led_id = 0, + }, + { + .reg_data = 0x00, + .led_status = "sys_Blinking_green", + .led_id = 1, + }, + { + .reg_data = 1 << 4, + .led_status = "sys_green", + .led_id = 1, + }, + { + .reg_data = 2 << 4, + .led_status = "sys_Amber", + .led_id = 1, + }, + { + .reg_data = 3 << 4 , + .led_status = "sys_Amber", + .led_id = 1, + }, + { + .reg_data = 0x00, + .led_status = "pwr_off", + .led_id = 2, + }, + { + .reg_data = 1 << 1, + .led_status = "pwr_Amber", + .led_id = 2, + }, + { + .reg_data = 2 << 1, + .led_status = "pwr_green", + .led_id = 2, + }, + { + .reg_data = 3 << 1, + .led_status = "pwr_Blinking_Amber", + .led_id = 2, + }, + { + .reg_data = 0x00, + .led_status = "fan4_off", + .led_id = 3, + }, + { + .reg_data = 1 << 6, + .led_status = "fan4_green", + .led_id = 3, + }, + { + .reg_data = 2 << 6, + .led_status = "fan4_Amber", + .led_id = 3, + }, + { + .reg_data = 0x00, + .led_status = "fan3_off", + .led_id = 4, + }, + { + .reg_data = 1 << 4, + .led_status = "fan3_green", + .led_id = 4, + }, + { + .reg_data = 2 << 4, + .led_status = "fan3_Amber", + .led_id = 4, + }, + { + .reg_data = 0x00, + .led_status = "fan2_off", + .led_id = 5, + }, + { + .reg_data = 1 << 2, + .led_status = "fan2_green", + .led_id = 5, + }, + { + .reg_data = 1 << 3, + .led_status = "fan2_Amber", + .led_id = 5, + }, + { + .reg_data = 0x00, + .led_status = "fan1_off", + .led_id = 6, + }, + { + .reg_data = 1, + .led_status = "fan1_green", + .led_id = 6, + }, + { + .reg_data = 2, + .led_status = "fan1_Amber", + .led_id = 6, + }, +}; + +struct platform_led_data{ + int reg_addr; + int mask; +}; + +static struct platform_led_data led_data[] = { + { + .reg_addr = LED_REG, //0x04 + .mask = 0xc0,//1100 0000 + }, + { + .reg_addr = LED_REG, + .mask = 0x30,//0011 0000 + }, + { + .reg_addr = LED_REG, + .mask = 0x06,//0000 0110 + }, + { + .reg_addr = FAN_LED_REG,//0x05 + .mask = 0xc0,//1100 0000 + }, + { + .reg_addr = FAN_LED_REG, + .mask = 0x30,//0011 0000 + }, + { + .reg_addr = FAN_LED_REG, + .mask = 0x0c,//0000 1100 + }, + { + .reg_addr = FAN_LED_REG, + .mask = 0x03,//0000 0011 + }, +}; + + +static ssize_t get_led_color(struct device *dev, struct device_attribute *devattr, char *buf) +{ + char str[9][20] = {0}; + int board_data; + int led_data_number; + int led_info_number; + struct cpld_platform_data *pdata = dev->platform_data; + + for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ + board_data = i2c_smbus_read_byte_data(pdata[slave_cpld].client, led_data[led_data_number].reg_addr); + if(board_data >= 0){ + board_data &= led_data[led_data_number].mask; + for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ + if (led_data_number == led_info[led_info_number].led_id \ + && board_data == led_info[led_info_number].reg_data){ + sprintf(str[led_data_number], "%s", led_info[led_info_number].led_status); + } + } + } + else + printk( KERN_ERR "Missing LED board data\n"); + } + return sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n",str[0],str[1],str[2],str[3],str[4],str[5],str[6]); +} + +static ssize_t set_led_color(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int led_info_number; + int led_data_number; + int str_compar; + int led_reg_value; + struct cpld_platform_data *pdata = dev->platform_data; + + for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ + str_compar = strncmp(buf,led_info[led_info_number].led_status,strlen(led_info[led_info_number].led_status)); + if(str_compar == 0){ + for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ + if(led_info[led_info_number].led_id == led_data_number){ + led_reg_value = i2c_smbus_read_byte_data(pdata[slave_cpld].client, led_data[led_data_number].reg_addr); + if(led_reg_value >= 0){ + led_reg_value &= (~led_data[led_data_number].mask); + led_reg_value |= led_info[led_info_number].reg_data; + i2c_smbus_write_byte_data(pdata[slave_cpld].client, (u8)(led_data[led_data_number].reg_addr & 0xff), (u8)(led_reg_value & 0xff)); + } + else + printk( KERN_ERR "Missing LED reg. data\n"); + } + } + } + } + return count; +} + +static DEVICE_ATTR(sfp_response, S_IWUSR | S_IRUGO, get_response, set_response ); +static DEVICE_ATTR(sfp_present, S_IRUGO, get_present, NULL ); +static DEVICE_ATTR(sfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode ); +static DEVICE_ATTR(sfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset ); + +static DEVICE_ATTR(led_control, S_IRUGO | S_IWUSR, get_led_color, set_led_color); + +static struct attribute *ag5648_cpld_attrs[] = { + &dev_attr_sfp_response.attr, + &dev_attr_sfp_present.attr, + &dev_attr_sfp_lpmode.attr, + &dev_attr_sfp_reset.attr, + &dev_attr_led_control.attr, + NULL, +}; + +static struct attribute_group ag5648_cpld_attr_grp = { + .attrs = ag5648_cpld_attrs, +}; + +/* CPLD -- driver */ +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret,i; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS2); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS2); + return -ENODEV; + } + + for (i = 0; i < ARRAY_SIZE(ag5648_cpld_platform_data); i++) { + pdata[i].client = i2c_new_dummy(parent, pdata[i].reg_addr); + if (!pdata[i].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr); + goto error; + } + } + + ret = sysfs_create_group(&pdev->dev.kobj, &ag5648_cpld_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + return 0; + +error: + i--; + for (; i >= 0; i--) { + if (pdata[i].client) { + i2c_unregister_device(pdata[i].client); + } + } + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + int i; + sysfs_remove_group(&pdev->dev.kobj, &ag5648_cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + for (i = 0; i < ARRAY_SIZE(ag5648_cpld_platform_data); i++) { + if (pdata[i].client) { + if (!parent) { + parent = (pdata[i].client)->adapter; + } + i2c_unregister_device(pdata[i].client); + } + } + } + + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag5648-cpld", + }, +}; + +/*---------------- CPLD - end ------------- */ + +/*---------------- MUX - start ------------- */ + +struct swpld_mux_platform_data { + int parent; + int base_nr; + int reg_addr; + struct i2c_client *cpld; +}; + +struct swpld_mux { + struct i2c_adapter *parent; + struct i2c_adapter **child; + struct swpld_mux_platform_data data; +}; + +static struct swpld_mux_platform_data ag5648_swpld_mux_platform_data[] = { + { + .parent = BUS4, + .base_nr = BUS4_BASE_NUM, + .cpld = NULL, + .reg_addr = BUS4_MUX_REG , + }, +}; + + +static struct platform_device ag5648_swpld_mux[] = { + { + .name = "delta-ag5648-swpld-mux", + .id = 0, + .dev = { + .platform_data = &ag5648_swpld_mux_platform_data[0], + .release = device_release, + }, + }, +}; + + +static int cpld_reg_write_byte(struct i2c_client *client, u8 regaddr, u8 val) +{ + union i2c_smbus_data data; + + data.byte = val; + return client->adapter->algo->smbus_xfer(client->adapter, client->addr, + client->flags, + I2C_SMBUS_WRITE, + regaddr, I2C_SMBUS_BYTE_DATA, &data); +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) +{ + struct swpld_mux *mux = data; + u8 swpld_mux_val=0; + if ( mux->data.base_nr == BUS4_BASE_NUM ) + { + swpld_mux_val = (chan + 0x01); + } + else + { + swpld_mux_val = 0x00; + } + swpld_mux_val=swpld_mux_val & (u8)0x3F; + + return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); +} +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int swpld_mux_select(struct i2c_mux_core *muxc, u32 chan) +{ + struct swpld_mux *mux = i2c_mux_priv(muxc); + u8 swpld_mux_val=0; + if ( mux->data.base_nr == BUS4_BASE_NUM ) + { + swpld_mux_val = (chan + 0x01); + } + else + { + swpld_mux_val = 0x00; + } + swpld_mux_val=swpld_mux_val & (u8)0x3F; + + return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for mux\n"); + goto alloc_failed; + } + + mux->parent = parent; + mux->data = *pdata; + mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); + if (!mux->child) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for device on mux\n"); + goto alloc_failed2; + } + + for (i = 0; i < dev_num; i++) { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, + nr, i, class, + swpld_mux_select, NULL); + if (!mux->child[i]) { + ret = -ENODEV; + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + + platform_set_drvdata(pdev, mux); + return 0; + +add_adapter_failed: + for (; i > 0; i--) + i2c_del_mux_adapter(mux->child[i - 1]); + kfree(mux->child); +alloc_failed2: + kfree(mux); +alloc_failed: + i2c_put_adapter(parent); + + return ret; +} +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc; + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + printk(KERN_ERR "Failed to allocate memory for mux\n"); + return -ENOMEM; + } + mux->data = *pdata; + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + kfree(mux); + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + muxc = i2c_mux_alloc(parent, &pdev->dev, dev_num, 0, 0, + swpld_mux_select, NULL); + if (!muxc) { + ret = -ENOMEM; + goto alloc_failed; + } + muxc->priv = mux; + platform_set_drvdata(pdev, muxc); + + + for (i = 0; i < dev_num; i++) { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + ret = i2c_mux_add_adapter(muxc, nr, i, class); + if (ret) { + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + + dev_info(&pdev->dev, "%d port mux on %s adapter\n", dev_num, parent->name); + + return 0; + +add_adapter_failed: + i2c_mux_del_adapters(muxc); +alloc_failed: + kfree(mux); + i2c_put_adapter(parent); + + return ret; +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + int i; + struct swpld_mux *mux = platform_get_drvdata(pdev); + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + switch (pdata->parent) { + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + for (i = 0; i < dev_num; i++) + i2c_del_mux_adapter(mux->child[i]); + + platform_set_drvdata(pdev, NULL); + i2c_put_adapter(mux->parent); + kfree(mux->child); + kfree(mux); + + return 0; +} +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc = platform_get_drvdata(pdev); + + i2c_mux_del_adapters(muxc); + i2c_put_adapter(muxc->parent); + + return 0; +} +#endif + +static struct platform_driver swpld_mux_driver = { + .probe = swpld_mux_probe, + .remove = __exit_p(swpld_mux_remove), /* TODO */ + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag5648-swpld-mux", + }, +}; +/*---------------- MUX - end ------------- */ + + +/*---------------- module initialization ------------- */ +static int __init delta_ag5648_platform_init(void) +{ + //struct i2c_client *client; + struct i2c_adapter *adapter; + struct cpld_platform_data *cpld_pdata; + struct swpld_mux_platform_data *swpld_pdata; + int ret,i = 0; + + //Use pca9548 in i2c_mux_pca954x.c + adapter = i2c_get_adapter(BUS1); + + i2c_client_9548 = i2c_new_device(adapter, &i2c_info_pca9548[0]); + i2c_put_adapter(adapter); + + // set the CPLD prob and remove + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpld driver\n"); + goto error_cpld_driver; + } + + // register the mux prob which call the CPLD + ret = platform_driver_register(&swpld_mux_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld mux driver\n"); + goto error_swpld_mux_driver; + } + + // register the i2c devices + ret = platform_driver_register(&i2c_device_driver); + if (ret) { + printk(KERN_WARNING "Fail to register i2c device driver\n"); + goto error_i2c_device_driver; + } + + // register the CPLD + ret = platform_device_register(&ag5648_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpld device\n"); + goto error_ag5648_cpld; + } + // link the CPLD and the Mux + cpld_pdata = ag5648_cpld.dev.platform_data; + + + swpld_pdata = ag5648_swpld_mux[0].dev.platform_data; + swpld_pdata->cpld = cpld_pdata[master_cpld].client; + ret = platform_device_register(&ag5648_swpld_mux[0]); + if (ret) { + printk(KERN_WARNING "Fail to create swpld mux %d\n", i); + goto error_ag5648_swpld_mux; + } + + for (i = 0; i < ARRAY_SIZE(ag5648_i2c_device); i++) + { + ret = platform_device_register(&ag5648_i2c_device[i]); + if (ret) { + printk(KERN_WARNING "Fail to create i2c device %d\n", i); + goto error_ag5648_i2c_device; + } + } + + if (ret) + goto error_ag5648_swpld_mux; + return 0; + +error_ag5648_i2c_device: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag5648_i2c_device[i]); + } + i = ARRAY_SIZE(ag5648_swpld_mux); +error_ag5648_swpld_mux: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag5648_swpld_mux[0]); + } + platform_device_unregister(&ag5648_cpld); +error_ag5648_cpld: + platform_driver_unregister(&i2c_device_driver); +error_i2c_device_driver: + platform_driver_unregister(&swpld_mux_driver); +error_swpld_mux_driver: + platform_driver_unregister(&cpld_driver); +error_cpld_driver: + return ret; +} + +static void __exit delta_ag5648_platform_exit(void) +{ + int i = 0; + + for ( i = 0; i < ARRAY_SIZE(ag5648_i2c_device); i++ ) { + platform_device_unregister(&ag5648_i2c_device[i]); + } + + for (i = 0; i < ARRAY_SIZE(ag5648_swpld_mux); i++) { + platform_device_unregister(&ag5648_swpld_mux[i]); + } + + platform_device_unregister(&ag5648_cpld); + platform_driver_unregister(&i2c_device_driver); + platform_driver_unregister(&cpld_driver); + platform_driver_unregister(&swpld_mux_driver); + i2c_unregister_device(i2c_client_9548); +} + +module_init(delta_ag5648_platform_init); +module_exit(delta_ag5648_platform_exit); + +MODULE_DESCRIPTION("DNI ag5648 Platform Support"); +MODULE_AUTHOR("Neal Tai "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/rules b/platform/broadcom/sonic-platform-modules-delta/debian/rules index 58a3597e7a44..d0398ecaca17 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/rules +++ b/platform/broadcom/sonic-platform-modules-delta/debian/rules @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= ag9032v1 +MODULE_DIRS:= ag9032v1 ag9064 ag5648 %: dh $@ --with=systemd From c77ddbc79e98281daf6d6773c6058356a245da69 Mon Sep 17 00:00:00 2001 From: hans-tseng Date: Sat, 14 Apr 2018 13:49:35 +0800 Subject: [PATCH 1505/1833] [devices]: modified and fixed delta ag9064 modules (#28) 2. enable build ag9064 Signed-off-by: neal tai --- .../ag9064/modules/Makefile | 3 +- .../ag9064/modules/delta_ag9064_common.h | 1132 +++---- .../ag9064/modules/delta_ag9064_cpld.c | 1722 +++++----- .../ag9064/modules/delta_ag9064_platform.c | 2993 +++++++---------- .../ag9064/modules/delta_ag9064_swpld.c | 1243 +++---- 5 files changed, 3230 insertions(+), 3863 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile index 124e0ff5b820..5642e82fa058 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/Makefile @@ -2,5 +2,4 @@ obj-m += delta_ag9064_platform.o obj-m += delta_ag9064_cpld.o obj-m += delta_ag9064_swpld.o obj-m += i2c-mei.o -i2c-mei-objs := i2c-mei_io.o i2c-mei_main.o i2c-mei_rw.o - +i2c-mei-objs := i2c-mei_io.o i2c-mei_main.o i2c-mei_rw.o \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h index f30081a8829e..5be2eb91fedf 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h @@ -1,567 +1,567 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define IPMI_MAX_INTF (4) -#define DELTA_NETFN 0x38 -#define BMC_BUS_5 0x04 -#define CMD_SETDATA 0x03 -#define CMD_GETDATA 0x02 - -#define CPUPLD_ADDR 0x31 -#define SWPLD1_ADDR 0x35 -#define SWPLD2_ADDR 0x34 -#define SWPLD3_ADDR 0x33 -#define SWPLD4_ADDR 0x32 -#define QSFP_PORT_MUX_REG 0x13 - -#define DEFAULT_NUM 1 -#define BUS9_DEV_NUM 64 -#define BUS9_BASE_NUM 20 - -extern int dni_bmc_cmd(char set_cmd, char *cmd_data, int cmd_data_len); -extern int dni_create_user(void); -extern unsigned char dni_log2 (unsigned char num); - -extern void device_release(struct device *dev); -extern void msg_handler(struct ipmi_recv_msg *recv_msg,void* handler_data); -extern void dummy_smi_free(struct ipmi_smi_msg *msg); -extern void dummy_recv_free(struct ipmi_recv_msg *msg); - -static ipmi_user_t ipmi_mh_user = NULL; -static struct ipmi_user_hndl ipmi_hndlrs = { .ipmi_recv_hndl = msg_handler,}; -static atomic_t dummy_count = ATOMIC_INIT(0); - -static struct ipmi_smi_msg halt_smi_msg = { - .done = dummy_smi_free -}; -static struct ipmi_recv_msg halt_recv_msg = { - .done = dummy_recv_free -}; - -enum{ - BUS0 = 0, - BUS1, - BUS2, - BUS3, - BUS4, - BUS5, - BUS6, - BUS7, - BUS8, - BUS9, - BUS10, - BUS11, - BUS12, - BUS13, - BUS14, -}; - -static struct cpld_attribute_data { - uint8_t bus; - uint8_t addr; - uint8_t reg; - uint8_t mask; - char note[200]; -}; - - -enum cpld_type { - system_cpld, - swpld1, - swpld2, - swpld3, - swpld4, -}; - -struct cpld_platform_data { - int reg_addr; - struct i2c_client *client; -}; - -static struct cpld_platform_data ag9064_cpld_platform_data[] = { - [system_cpld] = { - .reg_addr = CPUPLD_ADDR, - }, -}; - -static struct cpld_platform_data ag9064_swpld1_platform_data[] = { - [swpld1] = { - .reg_addr = SWPLD1_ADDR, - }, -}; - -static struct cpld_platform_data ag9064_swpld2_platform_data[] = { - [swpld2] = { - .reg_addr = SWPLD2_ADDR, - }, -}; - -static struct cpld_platform_data ag9064_swpld3_platform_data[] = { - [swpld3] = { - .reg_addr = SWPLD3_ADDR, - }, -}; - -static struct cpld_platform_data ag9064_swpld4_platform_data[] = { - [swpld4] = { - .reg_addr = SWPLD4_ADDR, - }, -}; - -enum cpld_attributes { - CPLD_REG_ADDR, - CPLD_REG_VALUE, - SWPLD1_REG_ADDR, - SWPLD1_REG_VALUE, - SWPLD2_REG_ADDR, - SWPLD2_REG_VALUE, - SWPLD3_REG_ADDR, - SWPLD3_REG_VALUE, - SWPLD4_REG_ADDR, - SWPLD4_REG_VALUE, - //CPLD - CPLD_VER, - CPU_BOARD_VER, - CPU_ID, - MB_ID, - MB_VER, - CPU0_PWR_OK, - PSU_OVER_TEMP, - PWR_RAIL_OVER_TEMP, - CPU_DISOMIC_OVER_TEMP, - DDR_OVER_TEMP, - CPLD_PWR_ON_RST, - CPLD_HARD_RST, - CPLD_RST, - MB_PWR, - MB_RST, - PSU_FAN_INT, - OP_MODULE_INT, -//SWPLD1 - SWPLD1_MAJOR_VER, - SWPLD1_MINOR_VER, - SWPLD1_SCRTCH_REG, - PSU1_PWR_OK, - PSU1_INT, - PSU2_PWR_OK, - PSU2_INT, - SYNCE_INT, - SYNCE_RST, - SYNCE_EEPROM_WP, - PSU1_GREEN_LED, - PSU1_RED_LED, - PSU2_GREEN_LED, - PSU2_RED_LED, - PSU_LED_MODE, -//SWPLD2 - SWPLD2_MAJOR_VER, - SWPLD2_MINOR_VER, - SWPLD2_SCRTCH_REG, - FAN_LED, - SYS_LED, - FAN_MOD1_LED, - FAN_MOD2_LED, - FAN_MOD3_LED, - FAN_MOD4_LED, -//SWPLD3 - SWPLD3_MAJOR_VER, - SWPLD3_MINOR_VER, - SWPLD3_SCRTCH_REG, - SB_VER, - PLATFORM_TYPE, -//SWPLD4 - SWPLD4_MAJOR_VER, - SWPLD4_MINOR_VER, - SWPLD4_SCRTCH_REG, - BMC_RST, - CPLD_LPC_RST, - CPLD_SW_RST, - MB_CPLD_RST, - BCM56970_RST, - CPLD_UPGRADE_RST, - MB_RST_CPLD, - CPU_RST_MB_OOB, - GPIO_PHY_RST, - PSU_FAN_EVENT, - CPU_THERMAL_INT, - FAN_INT, - CPLD_SPI_WP, - RJ45_CONSOLE_SEL, - SYSTEM_INT, - CPLD_MB_RST_DONE, - MB_PWR_OK, - FAN_EEPROM_WP, -}; - -static struct cpld_attribute_data attribute_data[] = { - [CPLD_REG_ADDR] = { - }, - [CPLD_REG_VALUE] = { - }, - [SWPLD1_REG_ADDR] = { - }, - [SWPLD1_REG_VALUE] = { - }, - [SWPLD2_REG_ADDR] = { - }, - [SWPLD2_REG_VALUE] = { - }, - [SWPLD3_REG_ADDR] = { - }, - [SWPLD3_REG_VALUE] = { - }, - [SWPLD4_REG_ADDR] = { - }, - [SWPLD4_REG_VALUE] = { - }, -//CPLD - [CPLD_VER] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x01, .mask = 0xFF, - .note = "CPLD Version, controlled by CPLD editor" - }, - [CPU_BOARD_VER] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x02, .mask = 0xF0, - .note = "“0x0”: proto A1\n“0x1”: proto A2\n“0x2”: PR (Production)" - }, - [CPU_ID] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x02, .mask = 0x0F, - .note = "“0x0”: C2558 ECC\n“0x1”: Rangeley ECC\n“0x2”: BROADWELL-DE ECC" - }, - [MB_ID] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x03, .mask = 0xFF, - .note = "“0x00”: proto A1\n“0x01”: proto A2\n“0x02”: PR (Production)" - }, - [MB_VER] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x04, .mask = 0x0F, - .note = "“0x0”: proto-A\n“0x1”: proto-B" - }, - [CPU0_PWR_OK] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x08, .mask = 1 << 3, - .note = "“1” =Power rail is good\n“0” = Power rail is failed" - }, - [PSU_OVER_TEMP] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x0b, .mask = 1 << 4, - .note = "“1” = Not over temperature\n“0” = Over temperature" - }, - [PWR_RAIL_OVER_TEMP] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x0b, .mask = 1 << 3, - .note = "“1” = Not over temperature\n“0” = Over temperature" - }, - [CPU_DISOMIC_OVER_TEMP] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x0b, .mask = 1 << 1, - .note = "“1” = Not over temperature\n“0” = Over temperature" - }, - [DDR_OVER_TEMP] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x0b, .mask = 1 << 0, - .note = "“1” = Not over temperature\n“0” = Over temperature" - }, - [CPLD_PWR_ON_RST] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x11, .mask = 1 << 4, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [CPLD_HARD_RST] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x11, .mask = 1 << 2, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [CPLD_RST] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x11, .mask = 1 << 0, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [MB_PWR] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x12, .mask = 1 << 2, - .note = "“0” = Power rail is failed\n“1” =Power rail is good" - }, - [MB_RST] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x12, .mask = 1 << 0, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [PSU_FAN_INT] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x15, .mask = 1 << 1, - .note = "“0” = Interrupt occurs\n“1” = Interrupt doesn't occur" - }, - [OP_MODULE_INT] = { - .bus = BUS0, .addr = CPUPLD_ADDR, - .reg = 0x15, .mask = 1 << 0, - .note = "“0” = Interrupt occurs\n“1” = Interrupt doesn't occur" - }, -//SWPLD1 - [SWPLD1_MAJOR_VER] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x00, .mask = 0xF0, - .note = "CPLD Major Version, controlled by CPLD editor." - }, - [SWPLD1_MINOR_VER] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x00, .mask = 0x0F, - .note = "CPLD Minor Version, controlled by CPLD editor." - }, - [SWPLD1_SCRTCH_REG] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x01, .mask = 0xFF, - .note = "CPLD read/write test register, to provide a way to test CPLD access." - }, - [PSU1_PWR_OK] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x02, .mask = 1 << 6, - .note = "‘0’ = Power rail is good\n‘1’ = Power rail is failed" - }, - [PSU1_INT] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x02, .mask = 1 << 5, - .note = "‘0’ = Interrupt doesn’t occur\n‘1’ = Interrupt occurs" - }, - [PSU2_PWR_OK] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x02, .mask = 1 << 2, - .note = "‘0’ = Power rail is good\n‘1’ = Power rail is failed" - }, - [PSU2_INT] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x02, .mask = 1 << 1, - .note = "‘0’ = Interrupt doesn’t occur\n‘1’ = Interrupt occurs" - }, - [SYNCE_INT] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x12, .mask = 1 << 7, - .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" - }, - [SYNCE_RST] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x12, .mask = 1 << 6, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [SYNCE_EEPROM_WP] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x12, .mask = 1 << 5, - .note = "“1” = enables the lock-down mechanism.\n“0” = overrides the lock-down function enabling blocks to be erased or programmed using software commands." - }, - [PSU1_GREEN_LED] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x13, .mask = 1 << 7, - .note = "“0”: Solid Green – Power Supply 1 is supplied to the switch & operating normally\n“1”: OFF" - }, - [PSU1_RED_LED] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x13, .mask = 1 << 6, - .note = "“0”: Solid Red – Power Supply 1 is supplied to the switch & operating normally\n“1”: OFF" - }, - [PSU2_GREEN_LED] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x13, .mask = 1 << 5, - .note = "“0”: Solid Green – Power Supply 2 is supplied to the switch & operating normally\n“1”: OFF" - }, - [PSU2_RED_LED] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x13, .mask = 1 << 4, - .note = "“0”: Solid Red – Power Supply 1=2 is supplied to the switch & operating normally\n“1”: OFF" - }, - [PSU_LED_MODE] = { - .bus = BUS0, .addr = SWPLD1_ADDR, - .reg = 0x13, .mask = 1 << 0, - .note = "“0”: PSU LED can be changed manually\n“1”: PSU LED can’t be changed manually" - }, -//SWPLD2 - [SWPLD2_MAJOR_VER] = { - .bus = BUS0, .addr = SWPLD2_ADDR, - .reg = 0x00, .mask =0xF0 , - .note = "CPLD Major Version, controlled by CPLD editor." - }, - [SWPLD2_MINOR_VER] = { - .bus = BUS0, .addr = SWPLD2_ADDR, - .reg = 0x00, .mask = 0x0F, - .note = "CPLD Minor Version, controlled by CPLD editor." - }, - [SWPLD2_SCRTCH_REG] = { - .bus = BUS0, .addr = SWPLD2_ADDR, - .reg = 0x01, .mask = 0xFF, - .note = "CPLD read/write test register, to provide a way to test CPLD access." - }, - [FAN_LED] = { - .bus = BUS0, .addr = SWPLD2_ADDR, - .reg = 0x02, .mask = 0xC0, - .note = "“00’/”11”: OFF\n“01”: Solid Green – FANs are operating normally\n“10”: Solid Amber – FANs are Error" - }, - [SYS_LED] = { - .bus = BUS0, .addr = SWPLD2_ADDR, - .reg = 0x02, .mask = 0x30, - .note = "‘00’: Off\n‘01’: Solid Green – Normal operation\n‘10’: Blinking Green – Booting Progress\n‘11’: Solid Red – System Fail" - }, - [FAN_MOD1_LED] = { - .bus = BUS0, .addr = SWPLD2_ADDR, - .reg = 0x1b, .mask = 1 << 7, - .note = "‘0’ = Amber\n‘1’ = Green" - }, - [FAN_MOD2_LED] = { - .bus = BUS0, .addr = SWPLD2_ADDR, - .reg = 0x1b, .mask = 1 << 6, - .note = "‘0’ = Amber\n‘1’ = Green" - }, - [FAN_MOD3_LED] = { - .bus = BUS0, .addr = SWPLD2_ADDR, - .reg = 0x1b, .mask = 1 << 5, - .note = "‘0’ = Amber\n‘1’ = Green" - }, - [FAN_MOD4_LED] = { - .bus = BUS0, .addr = SWPLD2_ADDR, - .reg = 0x1b, .mask = 1 << 4, - .note = "‘0’ = Amber\n‘1’ = Green" - }, -//SWPLD3 - [SWPLD3_MAJOR_VER] = { - .bus = BUS0, .addr = SWPLD3_ADDR, - .reg = 0x00, .mask = 0xF0, - .note = "CPLD Major Version, controlled by CPLD editor." - }, - [SWPLD3_MINOR_VER] = { - .bus = BUS0, .addr = SWPLD3_ADDR, - .reg = 0x00, .mask = 0x0F, - .note = "CPLD Minor Version, controlled by CPLD editor." - }, - [SWPLD3_SCRTCH_REG] = { - .bus = BUS0, .addr = SWPLD3_ADDR, - .reg = 0x01, .mask = 0xFF, - .note = "CPLD read/write test register, to provide a way to test CPLD access." - }, - [SB_VER] = { - .bus = BUS0, .addr = SWPLD3_ADDR, - .reg = 0x02, .mask = 0xF0, - .note = "“0x0”: proto-A\n“0x1”: proto-B" - }, - [PLATFORM_TYPE] = { - .bus = BUS0, .addr = SWPLD3_ADDR, - .reg = 0x02, .mask = 0x0F, - .note = "“0x0”: 64X100G_2U\n“0x1”~”0xF” Reserved" - }, -//SWPLD4 - [SWPLD4_MAJOR_VER] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x00, .mask = 0xF0, - .note = "CPLD Major Version, controlled by CPLD editor." - }, - [SWPLD4_MINOR_VER] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x00, .mask = 0x0F, - .note = "CPLD Minor Version, controlled by CPLD editor." - }, - [SWPLD4_SCRTCH_REG] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x01, .mask = 0xFF, - .note = "CPLD read/write test register, to provide a way to test CPLD access." - }, - [BMC_RST] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x02, .mask = 1 << 6, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [CPLD_LPC_RST] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x02, .mask = 1 << 5, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [CPLD_SW_RST] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x02, .mask = 1 << 3, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [MB_CPLD_RST] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x02, .mask = 1 << 2, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [BCM56970_RST] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x02, .mask = 1 << 1, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [CPLD_UPGRADE_RST] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x03, .mask = 1 << 7, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [MB_RST_CPLD] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x03, .mask = 1 << 6, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [CPU_RST_MB_OOB] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x03, .mask = 1 << 5, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [GPIO_PHY_RST] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x03, .mask = 1 << 4, - .note = "“0” = Reset\n“1” = Normal operation" - }, - [PSU_FAN_EVENT] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x04, .mask = 1 << 4, - .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" - }, - [CPU_THERMAL_INT] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x04, .mask = 1 << 1, - .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" - }, - [FAN_INT] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x04, .mask = 1 << 0, - .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" - }, - [CPLD_SPI_WP] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x06, .mask = 1 << 3, - .note = "“0” = SPI write operation is disabled\n“1” = SPI write operation is enabled" - }, - [RJ45_CONSOLE_SEL] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x06, .mask = 1 << 2, - .note = "“0” = Use BCM UART\n“1” = Use CPU UART" - }, - [SYSTEM_INT] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x07, .mask = 1 << 2, - .note = "“0” = Interrupt is asserted\n“1” = Interrupt is deasserted" - }, - [CPLD_MB_RST_DONE] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x07, .mask = 1 << 1, - .note = "“0” = Is done\n“1” = Is not done" - }, - [MB_PWR_OK] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x07, .mask = 1 << 0, - .note = "‘0’ = Power is failed\n‘1’ = Power is good" - }, - [FAN_EEPROM_WP] = { - .bus = BUS0, .addr = SWPLD4_ADDR, - .reg = 0x15, .mask = 1 << 2, - .note = "“1” = enables the lock-down mechanism.\n“0” = overrides the lock-down function enabling blocks to be erased or programmed using software commands." - }, +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define IPMI_MAX_INTF (4) +#define DELTA_NETFN 0x38 +#define BMC_BUS_5 0x04 +#define CMD_SETDATA 0x03 +#define CMD_GETDATA 0x02 + +#define CPUPLD_ADDR 0x31 +#define SWPLD1_ADDR 0x35 +#define SWPLD2_ADDR 0x34 +#define SWPLD3_ADDR 0x33 +#define SWPLD4_ADDR 0x32 +#define QSFP_PORT_MUX_REG 0x13 + +#define DEFAULT_NUM 1 +#define BUS9_DEV_NUM 64 +#define BUS9_BASE_NUM 20 + +extern int dni_bmc_cmd(char set_cmd, char *cmd_data, int cmd_data_len); +extern int dni_create_user(void); +extern unsigned char dni_log2 (unsigned char num); + +extern void device_release(struct device *dev); +extern void msg_handler(struct ipmi_recv_msg *recv_msg,void* handler_data); +extern void dummy_smi_free(struct ipmi_smi_msg *msg); +extern void dummy_recv_free(struct ipmi_recv_msg *msg); + +static ipmi_user_t ipmi_mh_user = NULL; +static struct ipmi_user_hndl ipmi_hndlrs = { .ipmi_recv_hndl = msg_handler,}; +static atomic_t dummy_count = ATOMIC_INIT(0); + +static struct ipmi_smi_msg halt_smi_msg = { + .done = dummy_smi_free +}; +static struct ipmi_recv_msg halt_recv_msg = { + .done = dummy_recv_free +}; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, + BUS8, + BUS9, + BUS10, + BUS11, + BUS12, + BUS13, + BUS14, +}; + +static struct cpld_attribute_data { + uint8_t bus; + uint8_t addr; + uint8_t reg; + uint8_t mask; + char note[200]; +}; + + +enum cpld_type { + system_cpld, + swpld1, + swpld2, + swpld3, + swpld4, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data ag9064_cpld_platform_data[] = { + [system_cpld] = { + .reg_addr = CPUPLD_ADDR, + }, +}; + +static struct cpld_platform_data ag9064_swpld1_platform_data[] = { + [swpld1] = { + .reg_addr = SWPLD1_ADDR, + }, +}; + +static struct cpld_platform_data ag9064_swpld2_platform_data[] = { + [swpld2] = { + .reg_addr = SWPLD2_ADDR, + }, +}; + +static struct cpld_platform_data ag9064_swpld3_platform_data[] = { + [swpld3] = { + .reg_addr = SWPLD3_ADDR, + }, +}; + +static struct cpld_platform_data ag9064_swpld4_platform_data[] = { + [swpld4] = { + .reg_addr = SWPLD4_ADDR, + }, +}; + +enum cpld_attributes { + CPLD_REG_ADDR, + CPLD_REG_VALUE, + SWPLD1_REG_ADDR, + SWPLD1_REG_VALUE, + SWPLD2_REG_ADDR, + SWPLD2_REG_VALUE, + SWPLD3_REG_ADDR, + SWPLD3_REG_VALUE, + SWPLD4_REG_ADDR, + SWPLD4_REG_VALUE, + //CPLD + CPLD_VER, + CPU_BOARD_VER, + CPU_ID, + MB_ID, + MB_VER, + CPU0_PWR_OK, + PSU_OVER_TEMP, + PWR_RAIL_OVER_TEMP, + CPU_DISOMIC_OVER_TEMP, + DDR_OVER_TEMP, + CPLD_PWR_ON_RST, + CPLD_HARD_RST, + CPLD_RST, + MB_PWR, + MB_RST, + PSU_FAN_INT, + OP_MODULE_INT, +//SWPLD1 + SWPLD1_MAJOR_VER, + SWPLD1_MINOR_VER, + SWPLD1_SCRTCH_REG, + PSU1_PWR_OK, + PSU1_INT, + PSU2_PWR_OK, + PSU2_INT, + SYNCE_INT, + SYNCE_RST, + SYNCE_EEPROM_WP, + PSU1_GREEN_LED, + PSU1_RED_LED, + PSU2_GREEN_LED, + PSU2_RED_LED, + PSU_LED_MODE, +//SWPLD2 + SWPLD2_MAJOR_VER, + SWPLD2_MINOR_VER, + SWPLD2_SCRTCH_REG, + FAN_LED, + SYS_LED, + FAN_MOD1_LED, + FAN_MOD2_LED, + FAN_MOD3_LED, + FAN_MOD4_LED, +//SWPLD3 + SWPLD3_MAJOR_VER, + SWPLD3_MINOR_VER, + SWPLD3_SCRTCH_REG, + SB_VER, + PLATFORM_TYPE, +//SWPLD4 + SWPLD4_MAJOR_VER, + SWPLD4_MINOR_VER, + SWPLD4_SCRTCH_REG, + BMC_RST, + CPLD_LPC_RST, + CPLD_SW_RST, + MB_CPLD_RST, + BCM56970_RST, + CPLD_UPGRADE_RST, + MB_RST_CPLD, + CPU_RST_MB_OOB, + GPIO_PHY_RST, + PSU_FAN_EVENT, + CPU_THERMAL_INT, + FAN_INT, + CPLD_SPI_WP, + RJ45_CONSOLE_SEL, + SYSTEM_INT, + CPLD_MB_RST_DONE, + MB_PWR_OK, + FAN_EEPROM_WP, +}; + +static struct cpld_attribute_data attribute_data[] = { + [CPLD_REG_ADDR] = { + }, + [CPLD_REG_VALUE] = { + }, + [SWPLD1_REG_ADDR] = { + }, + [SWPLD1_REG_VALUE] = { + }, + [SWPLD2_REG_ADDR] = { + }, + [SWPLD2_REG_VALUE] = { + }, + [SWPLD3_REG_ADDR] = { + }, + [SWPLD3_REG_VALUE] = { + }, + [SWPLD4_REG_ADDR] = { + }, + [SWPLD4_REG_VALUE] = { + }, +//CPLD + [CPLD_VER] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x01, .mask = 0xFF, + .note = "CPLD Version, controlled by CPLD editor" + }, + [CPU_BOARD_VER] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x02, .mask = 0xF0, + .note = "“0x0”: proto A1\n“0x1”: proto A2\n“0x2”: PR (Production)" + }, + [CPU_ID] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x02, .mask = 0x0F, + .note = "“0x0”: C2558 ECC\n“0x1”: Rangeley ECC\n“0x2”: BROADWELL-DE ECC" + }, + [MB_ID] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x03, .mask = 0xFF, + .note = "“0x00”: proto A1\n“0x01”: proto A2\n“0x02”: PR (Production)" + }, + [MB_VER] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x04, .mask = 0x0F, + .note = "“0x0”: proto-A\n“0x1”: proto-B" + }, + [CPU0_PWR_OK] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x08, .mask = 1 << 3, + .note = "“1” =Power rail is good\n“0” = Power rail is failed" + }, + [PSU_OVER_TEMP] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x0b, .mask = 1 << 4, + .note = "“1” = Not over temperature\n“0” = Over temperature" + }, + [PWR_RAIL_OVER_TEMP] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x0b, .mask = 1 << 3, + .note = "“1” = Not over temperature\n“0” = Over temperature" + }, + [CPU_DISOMIC_OVER_TEMP] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x0b, .mask = 1 << 1, + .note = "“1” = Not over temperature\n“0” = Over temperature" + }, + [DDR_OVER_TEMP] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x0b, .mask = 1 << 0, + .note = "“1” = Not over temperature\n“0” = Over temperature" + }, + [CPLD_PWR_ON_RST] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x11, .mask = 1 << 4, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPLD_HARD_RST] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x11, .mask = 1 << 2, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPLD_RST] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x11, .mask = 1 << 0, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [MB_PWR] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x12, .mask = 1 << 2, + .note = "“0” = Power rail is failed\n“1” =Power rail is good" + }, + [MB_RST] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x12, .mask = 1 << 0, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [PSU_FAN_INT] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x15, .mask = 1 << 1, + .note = "“0” = Interrupt occurs\n“1” = Interrupt doesn't occur" + }, + [OP_MODULE_INT] = { + .bus = BUS0, .addr = CPUPLD_ADDR, + .reg = 0x15, .mask = 1 << 0, + .note = "“0” = Interrupt occurs\n“1” = Interrupt doesn't occur" + }, +//SWPLD1 + [SWPLD1_MAJOR_VER] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x00, .mask = 0xF0, + .note = "CPLD Major Version, controlled by CPLD editor." + }, + [SWPLD1_MINOR_VER] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x00, .mask = 0x0F, + .note = "CPLD Minor Version, controlled by CPLD editor." + }, + [SWPLD1_SCRTCH_REG] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x01, .mask = 0xFF, + .note = "CPLD read/write test register, to provide a way to test CPLD access." + }, + [PSU1_PWR_OK] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x02, .mask = 1 << 6, + .note = "‘0’ = Power rail is good\n‘1’ = Power rail is failed" + }, + [PSU1_INT] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x02, .mask = 1 << 5, + .note = "‘0’ = Interrupt doesn’t occur\n‘1’ = Interrupt occurs" + }, + [PSU2_PWR_OK] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x02, .mask = 1 << 2, + .note = "‘0’ = Power rail is good\n‘1’ = Power rail is failed" + }, + [PSU2_INT] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x02, .mask = 1 << 1, + .note = "‘0’ = Interrupt doesn’t occur\n‘1’ = Interrupt occurs" + }, + [SYNCE_INT] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x12, .mask = 1 << 7, + .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [SYNCE_RST] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x12, .mask = 1 << 6, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [SYNCE_EEPROM_WP] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x12, .mask = 1 << 5, + .note = "“1” = enables the lock-down mechanism.\n“0” = overrides the lock-down function enabling blocks to be erased or programmed using software commands." + }, + [PSU1_GREEN_LED] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x13, .mask = 1 << 7, + .note = "“0”: Solid Green – Power Supply 1 is supplied to the switch & operating normally\n“1”: OFF" + }, + [PSU1_RED_LED] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x13, .mask = 1 << 6, + .note = "“0”: Solid Red – Power Supply 1 is supplied to the switch & operating normally\n“1”: OFF" + }, + [PSU2_GREEN_LED] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x13, .mask = 1 << 5, + .note = "“0”: Solid Green – Power Supply 2 is supplied to the switch & operating normally\n“1”: OFF" + }, + [PSU2_RED_LED] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x13, .mask = 1 << 4, + .note = "“0”: Solid Red – Power Supply 1=2 is supplied to the switch & operating normally\n“1”: OFF" + }, + [PSU_LED_MODE] = { + .bus = BUS0, .addr = SWPLD1_ADDR, + .reg = 0x13, .mask = 1 << 0, + .note = "“0”: PSU LED can be changed manually\n“1”: PSU LED can’t be changed manually" + }, +//SWPLD2 + [SWPLD2_MAJOR_VER] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x00, .mask =0xF0 , + .note = "CPLD Major Version, controlled by CPLD editor." + }, + [SWPLD2_MINOR_VER] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x00, .mask = 0x0F, + .note = "CPLD Minor Version, controlled by CPLD editor." + }, + [SWPLD2_SCRTCH_REG] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x01, .mask = 0xFF, + .note = "CPLD read/write test register, to provide a way to test CPLD access." + }, + [FAN_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x02, .mask = 0xC0, + .note = "“00’/”11”: OFF\n“01”: Solid Green – FANs are operating normally\n“10”: Solid Amber – FANs are Error" + }, + [SYS_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x02, .mask = 0x30, + .note = "‘00’: Off\n‘01’: Solid Green – Normal operation\n‘10’: Blinking Green – Booting Progress\n‘11’: Solid Red – System Fail" + }, + [FAN_MOD1_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x1b, .mask = 1 << 7, + .note = "‘0’ = Amber\n‘1’ = Green" + }, + [FAN_MOD2_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x1b, .mask = 1 << 6, + .note = "‘0’ = Amber\n‘1’ = Green" + }, + [FAN_MOD3_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x1b, .mask = 1 << 5, + .note = "‘0’ = Amber\n‘1’ = Green" + }, + [FAN_MOD4_LED] = { + .bus = BUS0, .addr = SWPLD2_ADDR, + .reg = 0x1b, .mask = 1 << 4, + .note = "‘0’ = Amber\n‘1’ = Green" + }, +//SWPLD3 + [SWPLD3_MAJOR_VER] = { + .bus = BUS0, .addr = SWPLD3_ADDR, + .reg = 0x00, .mask = 0xF0, + .note = "CPLD Major Version, controlled by CPLD editor." + }, + [SWPLD3_MINOR_VER] = { + .bus = BUS0, .addr = SWPLD3_ADDR, + .reg = 0x00, .mask = 0x0F, + .note = "CPLD Minor Version, controlled by CPLD editor." + }, + [SWPLD3_SCRTCH_REG] = { + .bus = BUS0, .addr = SWPLD3_ADDR, + .reg = 0x01, .mask = 0xFF, + .note = "CPLD read/write test register, to provide a way to test CPLD access." + }, + [SB_VER] = { + .bus = BUS0, .addr = SWPLD3_ADDR, + .reg = 0x02, .mask = 0xF0, + .note = "“0x0”: proto-A\n“0x1”: proto-B" + }, + [PLATFORM_TYPE] = { + .bus = BUS0, .addr = SWPLD3_ADDR, + .reg = 0x02, .mask = 0x0F, + .note = "“0x0”: 64X100G_2U\n“0x1”~”0xF” Reserved" + }, +//SWPLD4 + [SWPLD4_MAJOR_VER] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x00, .mask = 0xF0, + .note = "CPLD Major Version, controlled by CPLD editor." + }, + [SWPLD4_MINOR_VER] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x00, .mask = 0x0F, + .note = "CPLD Minor Version, controlled by CPLD editor." + }, + [SWPLD4_SCRTCH_REG] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x01, .mask = 0xFF, + .note = "CPLD read/write test register, to provide a way to test CPLD access." + }, + [BMC_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x02, .mask = 1 << 6, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPLD_LPC_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x02, .mask = 1 << 5, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPLD_SW_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x02, .mask = 1 << 3, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [MB_CPLD_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x02, .mask = 1 << 2, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [BCM56970_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x02, .mask = 1 << 1, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPLD_UPGRADE_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x03, .mask = 1 << 7, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [MB_RST_CPLD] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x03, .mask = 1 << 6, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [CPU_RST_MB_OOB] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x03, .mask = 1 << 5, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [GPIO_PHY_RST] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x03, .mask = 1 << 4, + .note = "“0” = Reset\n“1” = Normal operation" + }, + [PSU_FAN_EVENT] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x04, .mask = 1 << 4, + .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [CPU_THERMAL_INT] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x04, .mask = 1 << 1, + .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [FAN_INT] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x04, .mask = 1 << 0, + .note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [CPLD_SPI_WP] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x06, .mask = 1 << 3, + .note = "“0” = SPI write operation is disabled\n“1” = SPI write operation is enabled" + }, + [RJ45_CONSOLE_SEL] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x06, .mask = 1 << 2, + .note = "“0” = Use BCM UART\n“1” = Use CPU UART" + }, + [SYSTEM_INT] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x07, .mask = 1 << 2, + .note = "“0” = Interrupt is asserted\n“1” = Interrupt is deasserted" + }, + [CPLD_MB_RST_DONE] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x07, .mask = 1 << 1, + .note = "“0” = Is done\n“1” = Is not done" + }, + [MB_PWR_OK] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x07, .mask = 1 << 0, + .note = "‘0’ = Power is failed\n‘1’ = Power is good" + }, + [FAN_EEPROM_WP] = { + .bus = BUS0, .addr = SWPLD4_ADDR, + .reg = 0x15, .mask = 1 << 2, + .note = "“1” = enables the lock-down mechanism.\n“0” = overrides the lock-down function enabling blocks to be erased or programmed using software commands." + }, }; \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c index 0db05d967ccf..97e1b640010b 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c @@ -1,860 +1,862 @@ -#include "delta_ag9064_common.h" - -#define QSFP_PRESENCE_1 0x03 -#define QSFP_PRESENCE_2 0x03 -#define QSFP_PRESENCE_3 0x24 -#define QSFP_PRESENCE_4 0x24 -#define QSFP_PRESENCE_5 0x04 -#define QSFP_PRESENCE_6 0x04 -#define QSFP_PRESENCE_7 0x25 -#define QSFP_PRESENCE_8 0x25 - -#define QSFP_LP_MODE_1 0x0c -#define QSFP_LP_MODE_2 0x0c -#define QSFP_LP_MODE_3 0x2a -#define QSFP_LP_MODE_4 0x2a -#define QSFP_LP_MODE_5 0x0d -#define QSFP_LP_MODE_6 0x0d -#define QSFP_LP_MODE_7 0x2b -#define QSFP_LP_MODE_8 0x2b - -#define QSFP_RESET_1 0x06 -#define QSFP_RESET_2 0x06 -#define QSFP_RESET_3 0x26 -#define QSFP_RESET_4 0x26 -#define QSFP_RESET_5 0x07 -#define QSFP_RESET_6 0x07 -#define QSFP_RESET_7 0x27 -#define QSFP_RESET_8 0x27 - -#define QSFP_RESPONSE_1 0x09 -#define QSFP_RESPONSE_2 0x09 -#define QSFP_RESPONSE_3 0x28 -#define QSFP_RESPONSE_4 0x28 -#define QSFP_RESPONSE_5 0x0a -#define QSFP_RESPONSE_6 0x0a -#define QSFP_RESPONSE_7 0x29 -#define QSFP_RESPONSE_8 0x29 - -#define QSFP_INTERRUPT_1 0x0f -#define QSFP_INTERRUPT_2 0x0f -#define QSFP_INTERRUPT_3 0x2c -#define QSFP_INTERRUPT_4 0x2c -#define QSFP_INTERRUPT_5 0x10 -#define QSFP_INTERRUPT_6 0x10 -#define QSFP_INTERRUPT_7 0x2d -#define QSFP_INTERRUPT_8 0x2d - -unsigned char cpupld_reg_addr; -/*---------------- CPLD - start ------------- */ -/* CPLD -- device */ -static struct platform_device ag9064_cpld = { - .name = "delta-ag9064-cpld", - .id = 0, - .dev = { - .platform_data = ag9064_cpld_platform_data, - .release = device_release - }, -}; - -static ssize_t get_present(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_PRESENCE_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_PRESENCE_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_PRESENCE_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_PRESENCE_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_PRESENCE_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_PRESENCE_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_PRESENCE_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_PRESENCE_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_lpmode(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_reset(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_response(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_interrupt(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u64 data = 0; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_INTERRUPT_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_INTERRUPT_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_INTERRUPT_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_INTERRUPT_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_INTERRUPT_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_INTERRUPT_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_INTERRUPT_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_INTERRUPT_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long long set_data; - int err; - - err = kstrtoull(buf, 16, &set_data); - if (err){ - return err; - } - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_1; - cmd_data[3] = (set_data & 0xff); - cmd_data_len = sizeof(cmd_data); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_2; - cmd_data[3] = ((set_data >> 8 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_3; - cmd_data[3] = ((set_data >> 16 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_4; - cmd_data[3] = ((set_data >> 24 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_5; - cmd_data[3] = ((set_data >> 32 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_6; - cmd_data[3] = ((set_data >> 40 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_7; - cmd_data[3] = ((set_data >> 48 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_8; - cmd_data[3] = ((set_data >> 56 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - return count; -} - -static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long long set_data; - int err; - - err = kstrtoull(buf, 16, &set_data); - if (err){ - return err; - } - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_1; - cmd_data[3] = (set_data & 0xff); - cmd_data_len = sizeof(cmd_data); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_2; - cmd_data[3] = ((set_data >> 8 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_3; - cmd_data[3] = ((set_data >> 16 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_4; - cmd_data[3] = ((set_data >> 24 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_5; - cmd_data[3] = ((set_data >> 32 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_6; - cmd_data[3] = ((set_data >> 40 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_7; - cmd_data[3] = ((set_data >> 48 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_8; - cmd_data[3] = ((set_data >> 56 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - return count; -} - -static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long long set_data; - int err; - - err = kstrtoull(buf, 16, &set_data); - if (err){ - return err; - } - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_1; - cmd_data[3] = (set_data & 0xff); - cmd_data_len = sizeof(cmd_data); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_2; - cmd_data[3] = ((set_data >> 8 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_3; - cmd_data[3] = ((set_data >> 16 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_4; - cmd_data[3] = ((set_data >> 24 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_5; - cmd_data[3] = ((set_data >> 32 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_6; - cmd_data[3] = ((set_data >> 40 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_7; - cmd_data[3] = ((set_data >> 48 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_8; - cmd_data[3] = ((set_data >> 56 ) & 0xff); - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - - return count; -} - -static ssize_t get_cpld_reg(struct device *dev, struct device_attribute *dev_attr, char *buf) -{ - int ret; - int mask; - int value; - char note[200]; - unsigned char reg; - struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); - struct cpld_platform_data *pdata = dev->platform_data; - - switch (attr->index) { - case CPLD_REG_ADDR: - return sprintf(buf, "0x%02x\n", cpupld_reg_addr); - case CPLD_REG_VALUE: - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, cpupld_reg_addr); - return sprintf(buf, "0x%02x\n", ret); - case CPLD_VER ... OP_MODULE_INT: - reg = attribute_data[attr->index].reg; - mask = attribute_data[attr->index].mask; - value = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); - sprintf(note, "\n%s\n",attribute_data[attr->index].note); - value = (value & mask); - break; - default: - return sprintf(buf, "%d not found", attr->index); - } - - switch (mask) { - case 0xFF: - return sprintf(buf, "0x%02x%s", value, note); - case 0x0F: - return sprintf(buf, "0x%01x%s", value, note); - case 0xF0: - value = value >> 4; - return sprintf(buf, "0x%01x%s", value, note); - default : - value = value >> dni_log2(mask); - return sprintf(buf, "%d%s", value, note); - } -} - -static ssize_t set_cpld_reg(struct device *dev, struct device_attribute *dev_attr, - const char *buf, size_t count) -{ - int err; - int value; - int set_data; - unsigned char reg; - unsigned char mask; - unsigned char mask_out; - - struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); - struct cpld_platform_data *pdata = dev->platform_data; - - err = kstrtoul(buf, 0, &set_data); - if (err){ - return err; - } - - if (set_data > 0xff){ - printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); - return count; - } - - switch (attr->index) { - case CPLD_REG_ADDR: - cpupld_reg_addr = set_data; - return count; - case CPLD_REG_VALUE: - i2c_smbus_write_byte_data(pdata[system_cpld].client, cpupld_reg_addr, set_data); - return count; - case CPLD_VER ... OP_MODULE_INT: - reg = attribute_data[attr->index].reg; - mask = attribute_data[attr->index].mask; - value = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); - mask_out = value & ~(mask); - break; - default: - return sprintf(buf, "%d not found", attr->index); - } - - switch (mask) { - case 0xFF: - set_data = mask_out | (set_data & mask); - break; - case 0x0F: - set_data = mask_out | (set_data & mask); - break; - case 0xF0: - set_data = set_data << 4; - set_data = mask_out | (set_data & mask); - break; - default : - set_data = mask_out | (set_data << dni_log2(mask) ); - } - - i2c_smbus_write_byte_data(pdata[system_cpld].client, reg, set_data); - return count; -} - -static DEVICE_ATTR(qsfp_present, S_IRUGO, get_present, NULL); -static DEVICE_ATTR(qsfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode); -static DEVICE_ATTR(qsfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset); -static DEVICE_ATTR(qsfp_modsel, S_IWUSR | S_IRUGO, get_response, set_response); -static DEVICE_ATTR(qsfp_interrupt, S_IRUGO, get_interrupt, NULL); - -static SENSOR_DEVICE_ATTR(cpld_reg_addr, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_REG_ADDR); -static SENSOR_DEVICE_ATTR(cpld_reg_value, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_REG_VALUE); -static SENSOR_DEVICE_ATTR(cpld_ver, S_IRUGO, get_cpld_reg, NULL, CPLD_VER); -static SENSOR_DEVICE_ATTR(cpu_board_ver, S_IRUGO, get_cpld_reg, NULL, CPU_BOARD_VER); -static SENSOR_DEVICE_ATTR(cpu_id, S_IRUGO, get_cpld_reg, NULL, CPU_ID); -static SENSOR_DEVICE_ATTR(mb_id, S_IRUGO, get_cpld_reg, NULL, MB_ID); -static SENSOR_DEVICE_ATTR(mb_ver, S_IRUGO, get_cpld_reg, NULL, MB_VER); -static SENSOR_DEVICE_ATTR(cpu0_pwr_ok, S_IRUGO, get_cpld_reg, NULL, CPU0_PWR_OK); -static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, get_cpld_reg, NULL, PSU_OVER_TEMP); -static SENSOR_DEVICE_ATTR(pwr_rail_over_temp, S_IRUGO, get_cpld_reg, NULL, PWR_RAIL_OVER_TEMP); -static SENSOR_DEVICE_ATTR(cpu_disomic_over_temp, S_IRUGO, get_cpld_reg, NULL, CPU_DISOMIC_OVER_TEMP); -static SENSOR_DEVICE_ATTR(ddr_over_temp, S_IRUGO, get_cpld_reg, NULL, DDR_OVER_TEMP); -static SENSOR_DEVICE_ATTR(cpld_pwr_on_rst, S_IRUGO, get_cpld_reg, NULL, CPLD_PWR_ON_RST); -static SENSOR_DEVICE_ATTR(cpld_hard_rst, S_IRUGO, get_cpld_reg, NULL, CPLD_HARD_RST); -static SENSOR_DEVICE_ATTR(cpld_rst, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_RST); -static SENSOR_DEVICE_ATTR(mb_pwr, S_IRUGO, get_cpld_reg, NULL, MB_PWR); -static SENSOR_DEVICE_ATTR(mb_rst, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, MB_RST); -static SENSOR_DEVICE_ATTR(psu_fan_int, S_IRUGO, get_cpld_reg, NULL, PSU_FAN_INT); -static SENSOR_DEVICE_ATTR(op_module_int, S_IRUGO, get_cpld_reg, NULL, OP_MODULE_INT); - -static struct attribute *ag9064_cpld_attrs[] = { - &dev_attr_qsfp_present.attr, - &dev_attr_qsfp_lpmode.attr, - &dev_attr_qsfp_reset.attr, - &dev_attr_qsfp_modsel.attr, - &dev_attr_qsfp_interrupt.attr, - &sensor_dev_attr_cpld_reg_value.dev_attr.attr, - &sensor_dev_attr_cpld_reg_addr.dev_attr.attr, - &sensor_dev_attr_cpld_ver.dev_attr.attr, - &sensor_dev_attr_cpu_board_ver.dev_attr.attr, - &sensor_dev_attr_cpu_id.dev_attr.attr, - &sensor_dev_attr_mb_id.dev_attr.attr, - &sensor_dev_attr_mb_ver.dev_attr.attr, - &sensor_dev_attr_cpu0_pwr_ok.dev_attr.attr, - &sensor_dev_attr_psu_over_temp.dev_attr.attr, - &sensor_dev_attr_pwr_rail_over_temp.dev_attr.attr, - &sensor_dev_attr_cpu_disomic_over_temp.dev_attr.attr, - &sensor_dev_attr_ddr_over_temp.dev_attr.attr, - &sensor_dev_attr_cpld_pwr_on_rst.dev_attr.attr, - &sensor_dev_attr_cpld_hard_rst.dev_attr.attr, - &sensor_dev_attr_cpld_rst.dev_attr.attr, - &sensor_dev_attr_mb_pwr.dev_attr.attr, - &sensor_dev_attr_mb_rst.dev_attr.attr, - &sensor_dev_attr_psu_fan_int.dev_attr.attr, - &sensor_dev_attr_op_module_int.dev_attr.attr, - NULL, -}; - -static struct attribute_group ag9064_cpld_attr_grp = { - .attrs = ag9064_cpld_attrs, -}; - -static int __init cpld_probe(struct platform_device *pdev) -{ - struct cpld_platform_data *pdata; - struct i2c_adapter *parent; - int ret; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "CPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(BUS7); - if (!parent) { - printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS7); - return -ENODEV; - } - - pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); - if (!pdata[system_cpld].client) { - printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); - goto error; - } - - ret = sysfs_create_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - goto error; - } - - return 0; - -error: - i2c_unregister_device(pdata[system_cpld].client); - i2c_put_adapter(parent); - - return -ENODEV; -} - -static int __exit cpld_remove(struct platform_device *pdev) -{ - struct i2c_adapter *parent = NULL; - struct cpld_platform_data *pdata = pdev->dev.platform_data; - sysfs_remove_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); - - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - } - else { - if (pdata[system_cpld].client) { - if (!parent) { - parent = (pdata[system_cpld].client)->adapter; - } - i2c_unregister_device(pdata[system_cpld].client); - } - } - i2c_put_adapter(parent); - - return 0; -} - -static struct platform_driver cpld_driver = { - .probe = cpld_probe, - .remove = __exit_p(cpld_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9064-cpld", - }, -}; - -/*---------------- CPLD - end ------------- */ - -/*---------------- module initialization ------------- */ -static void __init delta_ag9064_cpupld_init(void) -{ - int ret; - printk(KERN_WARNING "ag9064_platform_cpupld module initialization\n"); - - ret = dni_create_user(); - if (ret != 0){ - printk(KERN_WARNING "Fail to create IPMI user\n"); - } - - // set the CPUPLD prob and remove - ret = platform_driver_register(&cpld_driver); - if (ret) { - printk(KERN_WARNING "Fail to register cpupld driver\n"); - goto error_cpupld_driver; - } - - // register the CPUPLD - ret = platform_device_register(&ag9064_cpld); - if (ret) { - printk(KERN_WARNING "Fail to create cpupld device\n"); - goto error_ag9064_cpupld; - } - return 0; - -error_ag9064_cpupld: - platform_driver_unregister(&cpld_driver); -error_cpupld_driver: - return ret; -} - -static void __exit delta_ag9064_cpupld_exit(void) -{ - platform_device_unregister(&ag9064_cpld); - platform_driver_unregister(&cpld_driver); -} -module_init(delta_ag9064_cpupld_init); -module_exit(delta_ag9064_cpupld_exit); - -MODULE_DESCRIPTION("DNI ag9064 CPLD Platform Support"); -MODULE_AUTHOR("Stanley Chi "); -MODULE_LICENSE("GPL"); \ No newline at end of file +#include "delta_ag9064_common.h" + +#define QSFP_PRESENCE_1 0x03 +#define QSFP_PRESENCE_2 0x03 +#define QSFP_PRESENCE_3 0x24 +#define QSFP_PRESENCE_4 0x24 +#define QSFP_PRESENCE_5 0x04 +#define QSFP_PRESENCE_6 0x04 +#define QSFP_PRESENCE_7 0x25 +#define QSFP_PRESENCE_8 0x25 + +#define QSFP_LP_MODE_1 0x0c +#define QSFP_LP_MODE_2 0x0c +#define QSFP_LP_MODE_3 0x2a +#define QSFP_LP_MODE_4 0x2a +#define QSFP_LP_MODE_5 0x0d +#define QSFP_LP_MODE_6 0x0d +#define QSFP_LP_MODE_7 0x2b +#define QSFP_LP_MODE_8 0x2b + +#define QSFP_RESET_1 0x06 +#define QSFP_RESET_2 0x06 +#define QSFP_RESET_3 0x26 +#define QSFP_RESET_4 0x26 +#define QSFP_RESET_5 0x07 +#define QSFP_RESET_6 0x07 +#define QSFP_RESET_7 0x27 +#define QSFP_RESET_8 0x27 + +#define QSFP_RESPONSE_1 0x09 +#define QSFP_RESPONSE_2 0x09 +#define QSFP_RESPONSE_3 0x28 +#define QSFP_RESPONSE_4 0x28 +#define QSFP_RESPONSE_5 0x0a +#define QSFP_RESPONSE_6 0x0a +#define QSFP_RESPONSE_7 0x29 +#define QSFP_RESPONSE_8 0x29 + +#define QSFP_INTERRUPT_1 0x0f +#define QSFP_INTERRUPT_2 0x0f +#define QSFP_INTERRUPT_3 0x2c +#define QSFP_INTERRUPT_4 0x2c +#define QSFP_INTERRUPT_5 0x10 +#define QSFP_INTERRUPT_6 0x10 +#define QSFP_INTERRUPT_7 0x2d +#define QSFP_INTERRUPT_8 0x2d + +unsigned char cpupld_reg_addr; +/*---------------- CPLD - start ------------- */ +/* CPLD -- device */ +static struct platform_device ag9064_cpld = { + .name = "delta-ag9064-cpld", + .id = 0, + .dev = { + .platform_data = ag9064_cpld_platform_data, + .release = device_release + }, +}; + +static ssize_t get_present(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_PRESENCE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PRESENCE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_PRESENCE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_PRESENCE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_PRESENCE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PRESENCE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_PRESENCE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_PRESENCE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_reset(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_response(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t get_interrupt(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u64 data = 0; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_GETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_INTERRUPT_1; + cmd_data[3] = 1; + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data = (u64)(ret & 0xff); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_INTERRUPT_2; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 8; + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_INTERRUPT_3; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 16; + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_INTERRUPT_4; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 24; + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_INTERRUPT_5; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 32; + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_INTERRUPT_6; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 40; + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_INTERRUPT_7; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 48; + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_INTERRUPT_8; + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + data |= (u64)(ret & 0xff) << 56; + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_LP_MODE_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_LP_MODE_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_LP_MODE_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_LP_MODE_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + return count; +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESET_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESET_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESET_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESET_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + return count; +} + +static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long long set_data; + int err; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + + set_cmd = CMD_SETDATA; + + /*QSFP1~8*/ + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_1; + cmd_data[3] = (set_data & 0xff); + cmd_data_len = sizeof(cmd_data); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP9~16*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_2; + cmd_data[3] = ((set_data >> 8 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP17~24*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_3; + cmd_data[3] = ((set_data >> 16 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP25~32*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_4; + cmd_data[3] = ((set_data >> 24 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP33~40*/ + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = QSFP_RESPONSE_5; + cmd_data[3] = ((set_data >> 32 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP41~48*/ + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_RESPONSE_6; + cmd_data[3] = ((set_data >> 40 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP49~56*/ + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = QSFP_RESPONSE_7; + cmd_data[3] = ((set_data >> 48 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + /*QSFP57~64*/ + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = QSFP_RESPONSE_8; + cmd_data[3] = ((set_data >> 56 ) & 0xff); + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + return count; +} + +static ssize_t get_cpld_reg(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + int ret; + int mask; + int value; + char note[200]; + unsigned char reg; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cpld_platform_data *pdata = dev->platform_data; + + switch (attr->index) { + case CPLD_REG_ADDR: + return sprintf(buf, "0x%02x\n", cpupld_reg_addr); + case CPLD_REG_VALUE: + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, cpupld_reg_addr); + return sprintf(buf, "0x%02x\n", ret); + case CPLD_VER ... OP_MODULE_INT: + reg = attribute_data[attr->index].reg; + mask = attribute_data[attr->index].mask; + value = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + sprintf(note, "\n%s\n",attribute_data[attr->index].note); + value = (value & mask); + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + + switch (mask) { + case 0xFF: + return sprintf(buf, "0x%02x%s", value, note); + case 0x0F: + return sprintf(buf, "0x%01x%s", value, note); + case 0xF0: + value = value >> 4; + return sprintf(buf, "0x%01x%s", value, note); + default : + value = value >> dni_log2(mask); + return sprintf(buf, "%d%s", value, note); + } +} + +static ssize_t set_cpld_reg(struct device *dev, struct device_attribute *dev_attr, + const char *buf, size_t count) +{ + int err; + int value; + int set_data; + unsigned long set_data_ul; + unsigned char reg; + unsigned char mask; + unsigned char mask_out; + + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 0, &set_data_ul); + if (err){ + return err; + } + + set_data = (int)set_data_ul; + if (set_data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + return count; + } + + switch (attr->index) { + case CPLD_REG_ADDR: + cpupld_reg_addr = set_data; + return count; + case CPLD_REG_VALUE: + i2c_smbus_write_byte_data(pdata[system_cpld].client, cpupld_reg_addr, set_data); + return count; + case CPLD_VER ... OP_MODULE_INT: + reg = attribute_data[attr->index].reg; + mask = attribute_data[attr->index].mask; + value = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + mask_out = value & ~(mask); + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + + switch (mask) { + case 0xFF: + set_data = mask_out | (set_data & mask); + break; + case 0x0F: + set_data = mask_out | (set_data & mask); + break; + case 0xF0: + set_data = set_data << 4; + set_data = mask_out | (set_data & mask); + break; + default : + set_data = mask_out | (set_data << dni_log2(mask) ); + } + + i2c_smbus_write_byte_data(pdata[system_cpld].client, reg, set_data); + return count; +} + +static DEVICE_ATTR(qsfp_present, S_IRUGO, get_present, NULL); +static DEVICE_ATTR(qsfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode); +static DEVICE_ATTR(qsfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset); +static DEVICE_ATTR(qsfp_modsel, S_IWUSR | S_IRUGO, get_response, set_response); +static DEVICE_ATTR(qsfp_interrupt, S_IRUGO, get_interrupt, NULL); + +static SENSOR_DEVICE_ATTR(cpld_reg_addr, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_REG_ADDR); +static SENSOR_DEVICE_ATTR(cpld_reg_value, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_REG_VALUE); +static SENSOR_DEVICE_ATTR(cpld_ver, S_IRUGO, get_cpld_reg, NULL, CPLD_VER); +static SENSOR_DEVICE_ATTR(cpu_board_ver, S_IRUGO, get_cpld_reg, NULL, CPU_BOARD_VER); +static SENSOR_DEVICE_ATTR(cpu_id, S_IRUGO, get_cpld_reg, NULL, CPU_ID); +static SENSOR_DEVICE_ATTR(mb_id, S_IRUGO, get_cpld_reg, NULL, MB_ID); +static SENSOR_DEVICE_ATTR(mb_ver, S_IRUGO, get_cpld_reg, NULL, MB_VER); +static SENSOR_DEVICE_ATTR(cpu0_pwr_ok, S_IRUGO, get_cpld_reg, NULL, CPU0_PWR_OK); +static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, get_cpld_reg, NULL, PSU_OVER_TEMP); +static SENSOR_DEVICE_ATTR(pwr_rail_over_temp, S_IRUGO, get_cpld_reg, NULL, PWR_RAIL_OVER_TEMP); +static SENSOR_DEVICE_ATTR(cpu_disomic_over_temp, S_IRUGO, get_cpld_reg, NULL, CPU_DISOMIC_OVER_TEMP); +static SENSOR_DEVICE_ATTR(ddr_over_temp, S_IRUGO, get_cpld_reg, NULL, DDR_OVER_TEMP); +static SENSOR_DEVICE_ATTR(cpld_pwr_on_rst, S_IRUGO, get_cpld_reg, NULL, CPLD_PWR_ON_RST); +static SENSOR_DEVICE_ATTR(cpld_hard_rst, S_IRUGO, get_cpld_reg, NULL, CPLD_HARD_RST); +static SENSOR_DEVICE_ATTR(cpld_rst, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_RST); +static SENSOR_DEVICE_ATTR(mb_pwr, S_IRUGO, get_cpld_reg, NULL, MB_PWR); +static SENSOR_DEVICE_ATTR(mb_rst, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, MB_RST); +static SENSOR_DEVICE_ATTR(psu_fan_int, S_IRUGO, get_cpld_reg, NULL, PSU_FAN_INT); +static SENSOR_DEVICE_ATTR(op_module_int, S_IRUGO, get_cpld_reg, NULL, OP_MODULE_INT); + +static struct attribute *ag9064_cpld_attrs[] = { + &dev_attr_qsfp_present.attr, + &dev_attr_qsfp_lpmode.attr, + &dev_attr_qsfp_reset.attr, + &dev_attr_qsfp_modsel.attr, + &dev_attr_qsfp_interrupt.attr, + &sensor_dev_attr_cpld_reg_value.dev_attr.attr, + &sensor_dev_attr_cpld_reg_addr.dev_attr.attr, + &sensor_dev_attr_cpld_ver.dev_attr.attr, + &sensor_dev_attr_cpu_board_ver.dev_attr.attr, + &sensor_dev_attr_cpu_id.dev_attr.attr, + &sensor_dev_attr_mb_id.dev_attr.attr, + &sensor_dev_attr_mb_ver.dev_attr.attr, + &sensor_dev_attr_cpu0_pwr_ok.dev_attr.attr, + &sensor_dev_attr_psu_over_temp.dev_attr.attr, + &sensor_dev_attr_pwr_rail_over_temp.dev_attr.attr, + &sensor_dev_attr_cpu_disomic_over_temp.dev_attr.attr, + &sensor_dev_attr_ddr_over_temp.dev_attr.attr, + &sensor_dev_attr_cpld_pwr_on_rst.dev_attr.attr, + &sensor_dev_attr_cpld_hard_rst.dev_attr.attr, + &sensor_dev_attr_cpld_rst.dev_attr.attr, + &sensor_dev_attr_mb_pwr.dev_attr.attr, + &sensor_dev_attr_mb_rst.dev_attr.attr, + &sensor_dev_attr_psu_fan_int.dev_attr.attr, + &sensor_dev_attr_op_module_int.dev_attr.attr, + NULL, +}; + +static struct attribute_group ag9064_cpld_attr_grp = { + .attrs = ag9064_cpld_attrs, +}; + +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS7); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS7); + return -ENODEV; + } + + pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); + if (!pdata[system_cpld].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); + goto error; + } + + ret = sysfs_create_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + return 0; + +error: + i2c_unregister_device(pdata[system_cpld].client); + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + if (pdata[system_cpld].client) { + if (!parent) { + parent = (pdata[system_cpld].client)->adapter; + } + i2c_unregister_device(pdata[system_cpld].client); + } + } + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-cpld", + }, +}; + +/*---------------- CPLD - end ------------- */ + +/*---------------- module initialization ------------- */ +static int __init delta_ag9064_cpupld_init(void) +{ + int ret; + printk(KERN_WARNING "ag9064_platform_cpupld module initialization\n"); + + ret = dni_create_user(); + if (ret != 0){ + printk(KERN_WARNING "Fail to create IPMI user\n"); + } + + // set the CPUPLD prob and remove + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpupld driver\n"); + goto error_cpupld_driver; + } + + // register the CPUPLD + ret = platform_device_register(&ag9064_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpupld device\n"); + goto error_ag9064_cpupld; + } + return 0; + +error_ag9064_cpupld: + platform_driver_unregister(&cpld_driver); +error_cpupld_driver: + return ret; +} + +static void __exit delta_ag9064_cpupld_exit(void) +{ + platform_device_unregister(&ag9064_cpld); + platform_driver_unregister(&cpld_driver); +} +module_init(delta_ag9064_cpupld_init); +module_exit(delta_ag9064_cpupld_exit); + +MODULE_DESCRIPTION("DNI ag9064 CPLD Platform Support"); +MODULE_AUTHOR("Stanley Chi "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c index f4222907d4f2..099d7ea987da 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c @@ -1,1815 +1,1178 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "delta_ag9064_common.h" - -#define SFF8436_INFO(data) \ - .type = "sff8436", .addr = 0x50, .platform_data = (data) - -#define SFF_8346_PORT(eedata) \ - .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY - -#define ag9064_i2c_device_num(NUM){ \ - .name = "delta-ag9064-i2c-device", \ - .id = NUM, \ - .dev = { \ - .platform_data = &ag9064_i2c_device_platform_data[NUM], \ - .release = device_release, \ - }, \ -} - -struct i2c_client * i2c_client_9548; - -/* pca9548 - add 8 bus */ -static struct pca954x_platform_mode pca954x_mode[] = -{ - { - .adap_id = 7, - .deselect_on_exit = 1, - }, - { - .adap_id = 8, - .deselect_on_exit = 1, - }, - { - .adap_id = 9, - .deselect_on_exit = 1, - }, - { - .adap_id = 10, - .deselect_on_exit = 1, - }, - { - .adap_id = 11, - .deselect_on_exit = 1, - }, - { - .adap_id = 12, - .deselect_on_exit = 1, - }, - { - .adap_id = 13, - .deselect_on_exit = 1, - }, - { - .adap_id = 14, - .deselect_on_exit = 1, - }, -}; - -static struct pca954x_platform_data pca954x_data = -{ - .modes = pca954x_mode, - .num_modes = ARRAY_SIZE(pca954x_mode), -}; - -static struct i2c_board_info __initdata i2c_info_pca9548[] = -{ - { - I2C_BOARD_INFO("pca9548", 0x70), - .platform_data = &pca954x_data, - }, -}; - -static struct sff_8436_platform_data sff_8436_port[] = { - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, -}; - -void device_release(struct device *dev) -{ - return; -} -EXPORT_SYMBOL(device_release); - -void msg_handler(struct ipmi_recv_msg *recv_msg, void* handler_data) -{ - struct completion *comp = recv_msg->user_msg_data; - if (comp) - complete(comp); - else - ipmi_free_recv_msg(recv_msg); - return; -} -EXPORT_SYMBOL(msg_handler); - -void dummy_smi_free(struct ipmi_smi_msg *msg) -{ - atomic_dec(&dummy_count); -} -EXPORT_SYMBOL(dummy_smi_free); - -void dummy_recv_free(struct ipmi_recv_msg *msg) -{ - atomic_dec(&dummy_count); -} -EXPORT_SYMBOL(dummy_recv_free); - -unsigned char dni_log2 (unsigned char num){ - unsigned char num_log2 = 0; - while(num > 0){ - num = num >> 1; - num_log2 += 1; - } - return num_log2 -1; -} -EXPORT_SYMBOL(dni_log2); -/*---------------- IPMI - start ------------- */ -int dni_create_user(void) -{ - int rv, i; - - for (i=0,rv=1; idev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", - pdata->parent); - return -ENODEV; - } - - pdata->client = i2c_new_device(parent, &pdata->info); - if (!pdata->client) { - dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", - pdata->info.type, pdata->parent); - return -ENODEV; - } - - return 0; - -} - -static int __exit i2c_deivce_remove(struct platform_device *pdev) -{ - struct i2c_adapter *parent; - struct i2c_device_platform_data *pdata; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - return -ENODEV; - } - - if (pdata->client) { - parent = (pdata->client)->adapter; - i2c_unregister_device(pdata->client); - i2c_put_adapter(parent); - } - - return 0; -} -static struct platform_driver i2c_device_driver = { - .probe = i2c_device_probe, - .remove = __exit_p(i2c_deivce_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9064-i2c-device", - } -}; - -/*---------------- I2C driver - end ------------- */ - -/*---------------- MUX - start ------------- */ - -struct swpld_mux_platform_data { - int parent; - int base_nr; -// struct i2c_client *cpld; -}; - -struct swpld_mux { - struct i2c_adapter *parent; - struct i2c_adapter **child; - struct swpld_mux_platform_data data; -}; - -static struct swpld_mux_platform_data ag9064_swpld_mux_platform_data[] = { - { - .parent = BUS9, - .base_nr = BUS9_BASE_NUM, -// .cpld = NULL, - }, -}; - -static struct platform_device ag9064_swpld_mux[] = -{ - { - .name = "delta-ag9064-swpld-mux", - .id = 0, - .dev = { - .platform_data = &ag9064_swpld_mux_platform_data[0], - .release = device_release, - }, - }, -}; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) -{ - uint8_t cmd_data[4]={0}; - struct swpld_mux *mux = data; - uint8_t set_cmd; - int cmd_data_len; - - if ( mux->data.base_nr == BUS9_BASE_NUM ) - { - set_cmd = CMD_SETDATA; - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_PORT_MUX_REG; - cmd_data[3] = chan + 1; - cmd_data_len = sizeof(cmd_data); - // return 0; - return dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - } - else - { - printk(KERN_ERR "Swpld mux QSFP select port error\n"); - return 0; - } -} -#else -static int swpld_mux_select(struct i2c_mux_core *muxc, u32 chan) -{ - uint8_t cmd_data[4]={0}; - struct swpld_mux *mux = i2c_mux_priv(muxc); - uint8_t set_cmd; - int cmd_data_len; - - if ( mux->data.base_nr == BUS9_BASE_NUM ) - { - set_cmd = CMD_SETDATA; - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_PORT_MUX_REG; - cmd_data[3] = chan + 1; - cmd_data_len = sizeof(cmd_data); - return dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - return 0; - } - else - { - printk(KERN_ERR "Swpld mux QSFP select port error\n"); - return 0; - } - -} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static int __init swpld_mux_probe(struct platform_device *pdev) -{ - struct swpld_mux *mux; - struct swpld_mux_platform_data *pdata; - struct i2c_adapter *parent; - int i, ret, dev_num; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "SWPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); - return -ENODEV; - } - /* Judge bus number to decide how many devices*/ - switch (pdata->parent) { - case BUS9: - dev_num = BUS9_DEV_NUM; - break; - default : - dev_num = DEFAULT_NUM; - break; - } - - mux = kzalloc(sizeof(*mux), GFP_KERNEL); - if (!mux) { - ret = -ENOMEM; - printk(KERN_ERR "Failed to allocate memory for mux\n"); - goto alloc_failed; - } - - mux->parent = parent; - mux->data = *pdata; - mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); - if (!mux->child) { - ret = -ENOMEM; - printk(KERN_ERR "Failed to allocate memory for device on mux\n"); - goto alloc_failed2; - } - - for (i = 0; i < dev_num; i++) - { - int nr = pdata->base_nr + i; - unsigned int class = 0; - - mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, - nr, i, class, - swpld_mux_select, NULL); - if (!mux->child[i]) - { - ret = -ENODEV; - dev_err(&pdev->dev, "Failed to add adapter %d\n", i); - goto add_adapter_failed; - } - } - - platform_set_drvdata(pdev, mux); - return 0; - -add_adapter_failed: - for (; i > 0; i--) - i2c_del_mux_adapter(mux->child[i - 1]); - kfree(mux->child); -alloc_failed2: - kfree(mux); -alloc_failed: - i2c_put_adapter(parent); - - return ret; -} -#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) -static int __init swpld_mux_probe(struct platform_device *pdev) -{ - struct i2c_mux_core *muxc; - struct swpld_mux *mux; - struct swpld_mux_platform_data *pdata; - struct i2c_adapter *parent; - int i, ret, dev_num; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "SWPLD platform data not found\n"); - return -ENODEV; - } - mux = kzalloc(sizeof(*mux), GFP_KERNEL); - if (!mux) { - printk(KERN_ERR "Failed to allocate memory for mux\n"); - return -ENOMEM; - } - mux->data = *pdata; - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - kfree(mux); - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); - return -ENODEV; - } - /* Judge bus number to decide how many devices*/ - switch (pdata->parent) { - case BUS9: - dev_num = BUS9_DEV_NUM; - break; - default : - dev_num = DEFAULT_NUM; - break; - } - - muxc = i2c_mux_alloc(parent, &pdev->dev, dev_num, 0, 0,swpld_mux_select, NULL); - if (!muxc) { - ret = -ENOMEM; - goto alloc_failed; - } - muxc->priv = mux; - platform_set_drvdata(pdev, muxc); - - for (i = 0; i < dev_num; i++) - { - int nr = pdata->base_nr + i; - unsigned int class = 0; - ret = i2c_mux_add_adapter(muxc, nr, i, class); - if (ret) { - dev_err(&pdev->dev, "Failed to add adapter %d\n", i); - goto add_adapter_failed; - } - } - dev_info(&pdev->dev, "%d port mux on %s adapter\n", dev_num, parent->name); - return 0; - -add_adapter_failed: - i2c_mux_del_adapters(muxc); -alloc_failed2: - kfree(mux); -alloc_failed: - i2c_put_adapter(parent); - - return ret; -} -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static int __exit swpld_mux_remove(struct platform_device *pdev) -{ - int i; - struct swpld_mux *mux = platform_get_drvdata(pdev); - struct swpld_mux_platform_data *pdata; - struct i2c_adapter *parent; - int dev_num; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "SWPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", - pdata->parent); - return -ENODEV; - } - switch (pdata->parent) { - case BUS9: - dev_num = BUS9_DEV_NUM; - break; - default : - dev_num = DEFAULT_NUM; - break; - } - - for (i = 0; i < dev_num; i++) - i2c_del_mux_adapter(mux->child[i]); - - platform_set_drvdata(pdev, NULL); - i2c_put_adapter(mux->parent); - kfree(mux->child); - kfree(mux); - - return 0; -} -#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) -static int __exit swpld_mux_remove(struct platform_device *pdev) -{ - struct i2c_mux_core *muxc = platform_get_drvdata(pdev); - struct i2c_adapter *parent=muxc->parent; - - i2c_mux_del_adapters(muxc); - i2c_put_adapter(parent); - - return 0; -} -#endif - -static struct platform_driver swpld_mux_driver = { - .probe = swpld_mux_probe, - .remove = __exit_p(swpld_mux_remove), /* TODO */ - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9064-swpld-mux", - }, -}; -/*---------------- MUX - end ------------- */ - -/*---------------- CPLD - start ------------- */ - -/* CPLD -- device */ - -static ssize_t get_present(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - uint8_t cmd_data[4]={0}; - int ret; - u64 data = 0; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_PRESENCE_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - ret=0; - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_PRESENCE_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); -// ret=0; - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_PRESENCE_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_PRESENCE_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_PRESENCE_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_PRESENCE_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_PRESENCE_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_PRESENCE_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_lpmode(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - uint8_t cmd_data[4]={0}; - int ret; - u64 data = 0; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - ret=0; - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_reset(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - uint8_t cmd_data[4]={0}; - int ret; - u64 data = 0; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret=0; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_2; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_3; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_4; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_5; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_6; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_7; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_8; - ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_response(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - uint8_t cmd_data[4]={0}; - int ret; - u64 data = 0; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret = 0; - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_2; - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_3; - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_4; - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_5; - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_6; - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_7; - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_8; - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - -static ssize_t get_interrupt(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - uint8_t cmd_data[4]={0}; - int ret; - u64 data = 0; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_GETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_INTERRUPT_1; - cmd_data[3] = 1; - cmd_data_len = sizeof(cmd_data); - ret=0; - data = (u64)(ret & 0xff); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_INTERRUPT_2; - data |= (u64)(ret & 0xff) << 8; - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_INTERRUPT_3; - data |= (u64)(ret & 0xff) << 16; - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_INTERRUPT_4; - data |= (u64)(ret & 0xff) << 24; - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_INTERRUPT_5; - data |= (u64)(ret & 0xff) << 32; - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_INTERRUPT_6; - data |= (u64)(ret & 0xff) << 40; - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_INTERRUPT_7; - data |= (u64)(ret & 0xff) << 48; - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_INTERRUPT_8; - data |= (u64)(ret & 0xff) << 56; - - return sprintf(buf, "0x%016llx\n", data); -} - - -static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - uint8_t cmd_data[4]={0}; - unsigned long long set_data; - int err; - - err = kstrtoull(buf, 16, &set_data); - if (err){ - return err; - } - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_1; - cmd_data[3] = (set_data & 0xff); - cmd_data_len = sizeof(cmd_data); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_2; - cmd_data[3] = ((set_data >> 8 ) & 0xff); - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_3; - cmd_data[3] = ((set_data >> 16 ) & 0xff); - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_4; - cmd_data[3] = ((set_data >> 24 ) & 0xff); - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_LP_MODE_5; - cmd_data[3] = ((set_data >> 32 ) & 0xff); - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_LP_MODE_6; - cmd_data[3] = ((set_data >> 40 ) & 0xff); - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_LP_MODE_7; - cmd_data[3] = ((set_data >> 48 ) & 0xff); - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_LP_MODE_8; - cmd_data[3] = ((set_data >> 56 ) & 0xff); - - return count; -} - -static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - uint8_t cmd_data[4]={0}; - unsigned long long set_data; - int err; - - err = kstrtoull(buf, 16, &set_data); - if (err){ - return err; - } - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_1; - cmd_data[3] = (set_data & 0xff); - cmd_data_len = sizeof(cmd_data); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_2; - cmd_data[3] = ((set_data >> 8 ) & 0xff); - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_3; - cmd_data[3] = ((set_data >> 16 ) & 0xff); - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_4; - cmd_data[3] = ((set_data >> 24 ) & 0xff); - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESET_5; - cmd_data[3] = ((set_data >> 32 ) & 0xff); - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESET_6; - cmd_data[3] = ((set_data >> 40 ) & 0xff); - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESET_7; - cmd_data[3] = ((set_data >> 48 ) & 0xff); - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESET_8; - cmd_data[3] = ((set_data >> 56 ) & 0xff); - - return count; -} - -static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - uint8_t cmd_data[4]={0}; - unsigned long long set_data; - int err; - - err = kstrtoull(buf, 16, &set_data); - if (err){ - return err; - } - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; - - /*QSFP1~8*/ - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_1; - cmd_data[3] = (set_data & 0xff); - cmd_data_len = sizeof(cmd_data); - - /*QSFP9~16*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_2; - cmd_data[3] = ((set_data >> 8 ) & 0xff); - - /*QSFP17~24*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_3; - cmd_data[3] = ((set_data >> 16 ) & 0xff); - - /*QSFP25~32*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_4; - cmd_data[3] = ((set_data >> 24 ) & 0xff); - - /*QSFP33~40*/ - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = QSFP_RESPONSE_5; - cmd_data[3] = ((set_data >> 32 ) & 0xff); - - /*QSFP41~48*/ - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_RESPONSE_6; - cmd_data[3] = ((set_data >> 40 ) & 0xff); - - /*QSFP49~56*/ - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = QSFP_RESPONSE_7; - cmd_data[3] = ((set_data >> 48 ) & 0xff); - - /*QSFP57~64*/ - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = QSFP_RESPONSE_8; - cmd_data[3] = ((set_data >> 56 ) & 0xff); - - return count; -} - -static DEVICE_ATTR(qsfp_present, S_IRUGO, get_present, NULL); -static DEVICE_ATTR(qsfp_lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode); -static DEVICE_ATTR(qsfp_reset, S_IWUSR | S_IRUGO, get_reset, set_reset); -static DEVICE_ATTR(qsfp_modsel, S_IWUSR | S_IRUGO, get_response, set_response); -static DEVICE_ATTR(qsfp_interrupt, S_IRUGO, get_interrupt, NULL); - -static struct attribute *ag9064_cpld_attrs[] = { - &dev_attr_qsfp_present.attr, - &dev_attr_qsfp_lpmode.attr, - &dev_attr_qsfp_reset.attr, - &dev_attr_qsfp_modsel.attr, - &dev_attr_qsfp_interrupt.attr, - NULL, -}; - -static struct attribute_group ag9064_cpld_attr_grp = { - .attrs = ag9064_cpld_attrs, -}; - -enum cpld_type { - system_cpld, -}; - -struct cpld_platform_data { - int reg_addr; - struct i2c_client *client; -}; - -static struct cpld_platform_data ag9064_cpld_platform_data[] = { - [system_cpld] = { - .reg_addr = CPLD_REG, - }, -}; - -static struct platform_device ag9064_cpld = { - .name = "delta-ag9064-cpld", - .id = 0, - .dev = { - .platform_data = ag9064_cpld_platform_data, - .release = device_release - }, -}; - -static int __init cpld_probe(struct platform_device *pdev) -{ - struct cpld_platform_data *pdata; - struct i2c_adapter *parent; - int ret; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "CPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(BUS7); - if (!parent) { - printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS7); - return -ENODEV; - } - - pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); - if (!pdata[system_cpld].client) { - printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); - goto error; - } - - ret = sysfs_create_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - goto error; - } - - return 0; - -error: - i2c_unregister_device(pdata[system_cpld].client); - i2c_put_adapter(parent); - - return -ENODEV; -} - -static int __exit cpld_remove(struct platform_device *pdev) -{ - struct i2c_adapter *parent = NULL; - struct cpld_platform_data *pdata = pdev->dev.platform_data; - sysfs_remove_group(&pdev->dev.kobj, &ag9064_cpld_attr_grp); - - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - } - else { - if (pdata[system_cpld].client) { - if (!parent) { - parent = (pdata[system_cpld].client)->adapter; - } - i2c_unregister_device(pdata[system_cpld].client); - } - } - i2c_put_adapter(parent); - - return 0; -} - -static struct platform_driver cpld_driver = { - .probe = cpld_probe, - .remove = __exit_p(cpld_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9064-cpld", - }, -}; - -/*---------------- CPLD - end ------------- */ - -/*---------------- module initialization ------------- */ - -static int __init delta_ag9064_platform_init(void) -{ - struct i2c_client *client; - struct i2c_adapter *adapter; - struct swpld_mux_platform_data *swpld_pdata; - struct cpld_platform_data * cpld_pdata; - int ret,i = 0; - - printk("ag9064_platform module initialization\n"); - - adapter = i2c_get_adapter(BUS2); - i2c_client_9548 = i2c_new_device(adapter, &i2c_info_pca9548[0]); - i2c_put_adapter(adapter); - - ret = dni_create_user(); - if (ret != 0){ - printk(KERN_WARNING "Fail to create IPMI user\n"); - } - - ret = platform_driver_register(&cpld_driver); - if (ret) { - printk(KERN_WARNING "Fail to register cpld driver\n"); - goto error_cpld_driver; - } - - // register the mux prob which call the SWPLD - ret = platform_driver_register(&swpld_mux_driver); - if (ret) { - printk(KERN_WARNING "Fail to register swpld mux driver\n"); - goto error_swpld_mux_driver; - } - - // register the i2c devices - ret = platform_driver_register(&i2c_device_driver); - if (ret) { - printk(KERN_WARNING "Fail to register i2c device driver\n"); - goto error_i2c_device_driver; - } - - // register the CPLD - ret = platform_device_register(&ag9064_cpld); - if (ret) { - printk(KERN_WARNING "Fail to create cpld device\n"); - goto error_ag9064_cpld; - } - - swpld_pdata = ag9064_swpld_mux[0].dev.platform_data; - ret = platform_device_register(&ag9064_swpld_mux[0]); - if (ret) { - printk(KERN_WARNING "Fail to create swpld mux\n"); - goto error_ag9064_swpld_mux; - } - - for (i = 0; i < ARRAY_SIZE(ag9064_i2c_device); i++) - { - ret = platform_device_register(&ag9064_i2c_device[i]); - if (ret) - { - printk(KERN_WARNING "Fail to create i2c device %d\n", i); - goto error_ag9064_i2c_device; - } - } - if (ret) - goto error_ag9064_swpld_mux; - - return 0; - -error_ag9064_i2c_device: - i--; - for (; i >= 0; i--) { - platform_device_unregister(&ag9064_i2c_device[i]); - } - i = ARRAY_SIZE(ag9064_swpld_mux); -error_ag9064_swpld_mux: - i--; - for (; i >= 0; i--) { - platform_device_unregister(&ag9064_swpld_mux); - } - platform_driver_unregister(&ag9064_cpld); -error_ag9064_cpld: - platform_driver_unregister(&i2c_device_driver); -error_i2c_device_driver: - platform_driver_unregister(&swpld_mux_driver); -error_swpld_mux_driver: - platform_driver_unregister(&cpld_driver); -error_cpld_driver: - return ret; -} - -static void __exit delta_ag9064_platform_exit(void) -{ - int i = 0; - - for ( i = 0; i < ARRAY_SIZE(ag9064_i2c_device); i++ ) { - platform_device_unregister(&ag9064_i2c_device[i]); - } - - platform_device_unregister(&ag9064_swpld_mux); - platform_device_unregister(&ag9064_cpld); - platform_driver_unregister(&i2c_device_driver); - platform_driver_unregister(&swpld_mux_driver); - platform_driver_unregister(&cpld_driver); - i2c_unregister_device(i2c_client_9548); -} - -module_init(delta_ag9064_platform_init); -module_exit(delta_ag9064_platform_exit); - -MODULE_DESCRIPTION("DELTA ag9064 Platform Support"); -MODULE_AUTHOR("Johnson Lu "); -MODULE_LICENSE("GPL"); +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "delta_ag9064_common.h" + +#define SFF8436_INFO(data) \ + .type = "sff8436", .addr = 0x50, .platform_data = (data) + +#define SFF_8346_PORT(eedata) \ + .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY + +#define ag9064_i2c_device_num(NUM){ \ + .name = "delta-ag9064-i2c-device", \ + .id = NUM, \ + .dev = { \ + .platform_data = &ag9064_i2c_device_platform_data[NUM], \ + .release = device_release, \ + }, \ +} + +struct i2c_client * i2c_client_9548; + + +/* pca9548 - add 8 bus */ +static struct pca954x_platform_mode pca954x_mode[] = +{ + { + .adap_id = 7, + .deselect_on_exit = 1, + }, + { + .adap_id = 8, + .deselect_on_exit = 1, + }, + { + .adap_id = 9, + .deselect_on_exit = 1, + }, + { + .adap_id = 10, + .deselect_on_exit = 1, + }, + { + .adap_id = 11, + .deselect_on_exit = 1, + }, + { + .adap_id = 12, + .deselect_on_exit = 1, + }, + { + .adap_id = 13, + .deselect_on_exit = 1, + }, + { + .adap_id = 14, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_data pca954x_data = +{ + .modes = pca954x_mode, + .num_modes = ARRAY_SIZE(pca954x_mode), +}; + +static struct i2c_board_info __initdata i2c_info_pca9548[] = +{ + { + I2C_BOARD_INFO("pca9548", 0x70), + .platform_data = &pca954x_data, + }, +}; + +static struct sff_8436_platform_data sff_8436_port[] = { + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, +}; + +void device_release(struct device *dev) +{ + return; +} +EXPORT_SYMBOL(device_release); +void msg_handler(struct ipmi_recv_msg *recv_msg, void* handler_data) +{ + struct completion *comp = recv_msg->user_msg_data; + if (comp) + complete(comp); + else + ipmi_free_recv_msg(recv_msg); + return; +} +EXPORT_SYMBOL(msg_handler); +void dummy_smi_free(struct ipmi_smi_msg *msg) +{ + atomic_dec(&dummy_count); +} +EXPORT_SYMBOL(dummy_smi_free); +void dummy_recv_free(struct ipmi_recv_msg *msg) +{ + atomic_dec(&dummy_count); +} +EXPORT_SYMBOL(dummy_recv_free); +unsigned char dni_log2 (unsigned char num){ + unsigned char num_log2 = 0; + while(num > 0){ + num = num >> 1; + num_log2 += 1; + } + return num_log2 -1; +} +EXPORT_SYMBOL(dni_log2); + +/*---------------- IPMI - start ------------- */ + +int dni_create_user(void) +{ + int rv, i; + + for (i=0,rv=1; idev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + + pdata->client = i2c_new_device(parent, &pdata->info); + if (!pdata->client) { + dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", + pdata->info.type, pdata->parent); + return -ENODEV; + } + + return 0; + +} + +static int __exit i2c_deivce_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent; + struct i2c_device_platform_data *pdata; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + if (pdata->client) { + parent = (pdata->client)->adapter; + i2c_unregister_device(pdata->client); + i2c_put_adapter(parent); + } + + return 0; +} +static struct platform_driver i2c_device_driver = { + .probe = i2c_device_probe, + .remove = __exit_p(i2c_deivce_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-i2c-device", + } +}; + +/*---------------- I2C driver - end ------------- */ + +/*---------------- MUX - start ------------- */ + +struct swpld_mux_platform_data { + int parent; + int base_nr; +// struct i2c_client *cpld; +}; + +struct swpld_mux { + struct i2c_adapter *parent; + struct i2c_adapter **child; + struct swpld_mux_platform_data data; +}; + +static struct swpld_mux_platform_data ag9064_swpld_mux_platform_data[] = { + { + .parent = BUS9, + .base_nr = BUS9_BASE_NUM, +// .cpld = NULL, + }, +}; + +static struct platform_device ag9064_swpld_mux[] = +{ + { + .name = "delta-ag9064-swpld-mux", + .id = 0, + .dev = { + .platform_data = &ag9064_swpld_mux_platform_data[0], + .release = device_release, + }, + }, +}; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) +{ + uint8_t cmd_data[4]={0}; + struct swpld_mux *mux = data; + uint8_t set_cmd; + int cmd_data_len; + + if ( mux->data.base_nr == BUS9_BASE_NUM ) + { + set_cmd = CMD_SETDATA; + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PORT_MUX_REG; + cmd_data[3] = chan + 1; + cmd_data_len = sizeof(cmd_data); + return dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + } + else + { + printk(KERN_ERR "Swpld mux QSFP select port error\n"); + return 0; + } +} +#else +static int swpld_mux_select(struct i2c_mux_core *muxc, u32 chan) +{ + uint8_t cmd_data[4]={0}; + struct swpld_mux *mux = i2c_mux_priv(muxc); + uint8_t set_cmd; + int cmd_data_len; + + if ( mux->data.base_nr == BUS9_BASE_NUM ) + { + set_cmd = CMD_SETDATA; + cmd_data[0] = BMC_BUS_5; + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = QSFP_PORT_MUX_REG; + cmd_data[3] = chan + 1; + cmd_data_len = sizeof(cmd_data); + return dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + } + else + { + printk(KERN_ERR "Swpld mux QSFP select port error\n"); + return 0; + } + +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS9: + dev_num = BUS9_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for mux\n"); + goto alloc_failed; + } + + mux->parent = parent; + mux->data = *pdata; + mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); + if (!mux->child) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for device on mux\n"); + goto alloc_failed2; + } + + for (i = 0; i < dev_num; i++) + { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, + nr, i, class, + swpld_mux_select, NULL); + if (!mux->child[i]) + { + ret = -ENODEV; + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + + platform_set_drvdata(pdev, mux); + return 0; + +add_adapter_failed: + for (; i > 0; i--) + i2c_del_mux_adapter(mux->child[i - 1]); + kfree(mux->child); +alloc_failed2: + kfree(mux); +alloc_failed: + i2c_put_adapter(parent); + + return ret; +} +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc; + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + printk(KERN_ERR "Failed to allocate memory for mux\n"); + return -ENOMEM; + } + mux->data = *pdata; + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + kfree(mux); + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS9: + dev_num = BUS9_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + muxc = i2c_mux_alloc(parent, &pdev->dev, dev_num, 0, 0,swpld_mux_select, NULL); + if (!muxc) { + ret = -ENOMEM; + goto alloc_failed; + } + muxc->priv = mux; + platform_set_drvdata(pdev, muxc); + + for (i = 0; i < dev_num; i++) + { + int nr = pdata->base_nr + i; + unsigned int class = 0; + ret = i2c_mux_add_adapter(muxc, nr, i, class); + if (ret) { + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + dev_info(&pdev->dev, "%d port mux on %s adapter\n", dev_num, parent->name); + return 0; + +add_adapter_failed: + i2c_mux_del_adapters(muxc); +alloc_failed2: + kfree(mux); +alloc_failed: + i2c_put_adapter(parent); + + return ret; +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + int i; + struct swpld_mux *mux = platform_get_drvdata(pdev); + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + switch (pdata->parent) { + case BUS9: + dev_num = BUS9_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + for (i = 0; i < dev_num; i++) + i2c_del_mux_adapter(mux->child[i]); + + platform_set_drvdata(pdev, NULL); + i2c_put_adapter(mux->parent); + kfree(mux->child); + kfree(mux); + + return 0; +} +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc = platform_get_drvdata(pdev); + struct i2c_adapter *parent=muxc->parent; + + i2c_mux_del_adapters(muxc); + i2c_put_adapter(parent); + + return 0; +} +#endif + +static struct platform_driver swpld_mux_driver = { + .probe = swpld_mux_probe, + .remove = __exit_p(swpld_mux_remove), /* TODO */ + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-swpld-mux", + }, +}; + +/*---------------- MUX - end ------------- */ + +/*---------------- module initialization ------------- */ + +static int __init delta_ag9064_platform_init(void) +{ +// struct i2c_client *client; + struct i2c_adapter *adapter; + struct swpld_mux_platform_data *swpld_pdata; +// struct cpld_platform_data * cpld_pdata; + int ret,i = 0; + + printk("ag9064_platform module initialization\n"); + + adapter = i2c_get_adapter(BUS2); + i2c_client_9548 = i2c_new_device(adapter, &i2c_info_pca9548[0]); + i2c_put_adapter(adapter); + + ret = dni_create_user(); + if (ret != 0){ + printk(KERN_WARNING "Fail to create IPMI user\n"); + } + + // register the mux prob which call the SWPLD + ret = platform_driver_register(&swpld_mux_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld mux driver\n"); + goto error_swpld_mux_driver; + } + + // register the i2c devices + ret = platform_driver_register(&i2c_device_driver); + if (ret) { + printk(KERN_WARNING "Fail to register i2c device driver\n"); + goto error_i2c_device_driver; + } + + swpld_pdata = ag9064_swpld_mux[0].dev.platform_data; + ret = platform_device_register(&ag9064_swpld_mux[0]); + if (ret) { + printk(KERN_WARNING "Fail to create swpld mux\n"); + goto error_ag9064_swpld_mux; + } + + for (i = 0; i < ARRAY_SIZE(ag9064_i2c_device); i++) + { + ret = platform_device_register(&ag9064_i2c_device[i]); + if (ret) + { + printk(KERN_WARNING "Fail to create i2c device %d\n", i); + goto error_ag9064_i2c_device; + } + } + if (ret) + goto error_ag9064_swpld_mux; + + return 0; + +error_ag9064_i2c_device: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag9064_i2c_device[i]); + } + i = ARRAY_SIZE(ag9064_swpld_mux); +error_ag9064_swpld_mux: + platform_device_unregister(&ag9064_swpld_mux[0]); + platform_driver_unregister(&i2c_device_driver); +error_i2c_device_driver: + platform_driver_unregister(&swpld_mux_driver); +error_swpld_mux_driver: + return ret; +} + +static void __exit delta_ag9064_platform_exit(void) +{ + int i = 0; + + for ( i = 0; i < ARRAY_SIZE(ag9064_i2c_device); i++ ) { + platform_device_unregister(&ag9064_i2c_device[i]); + } + + platform_device_unregister(&ag9064_swpld_mux[0]); + platform_driver_unregister(&i2c_device_driver); + platform_driver_unregister(&swpld_mux_driver); + i2c_unregister_device(i2c_client_9548); +} + +module_init(delta_ag9064_platform_init); +module_exit(delta_ag9064_platform_exit); + +MODULE_DESCRIPTION("DELTA ag9064 Platform Support"); +MODULE_AUTHOR("Johnson Lu "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c index 80a0ddc0d370..cab54a43bb07 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c @@ -1,620 +1,623 @@ -#include "delta_ag9064_common.h" - -unsigned char swpld1_reg_addr; -unsigned char swpld2_reg_addr; -unsigned char swpld3_reg_addr; -unsigned char swpld4_reg_addr; - -/*---------------- CPLD - start ------------- */ -/* SWPLD1 -- device */ -static struct platform_device swpld1_device = { - .name = "delta-ag9064-swpld1", - .id = 0, - .dev = { - .platform_data = ag9064_swpld1_platform_data, - .release = device_release - }, -}; - -static struct platform_device swpld2_device = { - .name = "delta-ag9064-swpld2", - .id = 0, - .dev = { - .platform_data = ag9064_swpld2_platform_data, - .release = device_release - }, -}; -static struct platform_device swpld3_device = { - .name = "delta-ag9064-swpld3", - .id = 0, - .dev = { - .platform_data = ag9064_swpld3_platform_data, - .release = device_release - }, -}; -static struct platform_device swpld4_device = { - .name = "delta-ag9064-swpld4", - .id = 0, - .dev = { - .platform_data = ag9064_swpld4_platform_data, - .release = device_release - }, -}; - -static ssize_t get_swpld_reg(struct device *dev, struct device_attribute *dev_attr, char *buf) -{ - int ret; - int mask; - int value; - int cmd_data_len; - char note[200]; - uint8_t cmd_data[4]={0}; - uint8_t get_cmd; - struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); - - cmd_data_len = sizeof(cmd_data); - get_cmd = CMD_GETDATA; - cmd_data[0] = BMC_BUS_5; - cmd_data[3] = 1; - mask = attribute_data[attr->index].mask; - sprintf(note, "\n%s\n",attribute_data[attr->index].note); - - if (attr->index <= SWPLD4_REG_VALUE){ - switch (attr->index) { - case SWPLD1_REG_ADDR: - return sprintf(buf, "0x%02x\n", swpld1_reg_addr); - case SWPLD2_REG_ADDR: - return sprintf(buf, "0x%02x\n", swpld2_reg_addr); - case SWPLD3_REG_ADDR: - return sprintf(buf, "0x%02x\n", swpld3_reg_addr); - case SWPLD4_REG_ADDR: - return sprintf(buf, "0x%02x\n", swpld4_reg_addr); - case SWPLD1_REG_VALUE: - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = swpld1_reg_addr; - break; - case SWPLD2_REG_VALUE: - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = swpld2_reg_addr; - break; - case SWPLD3_REG_VALUE: - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = swpld3_reg_addr; - break; - case SWPLD4_REG_VALUE: - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = swpld4_reg_addr; - break; - default: - return sprintf(buf, "%d not found", attr->index); - } - ret = dni_bmc_cmd(get_cmd, cmd_data, cmd_data_len); - ret = ret & 0xff; - return sprintf(buf, "0x%02x\n", ret); - }else{ - - switch (attr->index) { - case SWPLD1_MAJOR_VER ... PSU_LED_MODE : - cmd_data[1] = SWPLD1_ADDR; - break; - case SWPLD2_MAJOR_VER ... FAN_MOD4_LED : - cmd_data[1] = SWPLD2_ADDR; - break; - case SWPLD3_MAJOR_VER ... PLATFORM_TYPE : - cmd_data[1] = SWPLD3_ADDR; - break; - case SWPLD4_MAJOR_VER ... FAN_EEPROM_WP : - cmd_data[1] = SWPLD4_ADDR; - break; - default: - return sprintf(buf, "%d not found", attr->index); - } - cmd_data[2] = attribute_data[attr->index].reg; - value = dni_bmc_cmd(get_cmd, cmd_data, cmd_data_len); - value = value & mask; - switch (mask) { - case 0xFF: - return sprintf(buf, "0x%02x%s", value, note); - case 0x0F: - return sprintf(buf, "0x%01x%s", value, note); - case 0xF0: - value = value >> 4; - return sprintf(buf, "0x%01x%s", value, note); - case 0xC0: - value = value >> 6; - return sprintf(buf, "0x%01x%s", value, note); - case 0x30: - value = value >> 4; - return sprintf(buf, "0x%01x%s", value, note); - default : - value = value >> dni_log2(mask); - return sprintf(buf, "%d%s", value, note); - } - } -} - -static ssize_t set_swpld_reg(struct device *dev, struct device_attribute *dev_attr, - const char *buf, size_t count) -{ - int err; - int value; - int set_data; - int cmd_data_len; - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - uint8_t get_cmd; - unsigned char mask; - unsigned char mask_out; - struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); - - cmd_data_len = sizeof(cmd_data); - set_cmd = CMD_SETDATA; - get_cmd = CMD_GETDATA; - - err = kstrtoul(buf, 0, &set_data); - if (err){ - return err; - } - - if (set_data > 0xff){ - printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); - return count; - } - if (attr->index <= SWPLD4_REG_VALUE){ - cmd_data[0] = BMC_BUS_5; - cmd_data[3] = set_data; - switch (attr->index) { - //reg_addr - case SWPLD1_REG_ADDR: - swpld1_reg_addr = set_data; - return count; - case SWPLD2_REG_ADDR: - swpld2_reg_addr = set_data; - return count; - case SWPLD3_REG_ADDR: - swpld3_reg_addr = set_data; - return count; - case SWPLD4_REG_ADDR: - swpld4_reg_addr = set_data; - return count; - //reg_value - case SWPLD1_REG_VALUE: - cmd_data[1] = SWPLD1_ADDR; - cmd_data[2] = swpld1_reg_addr; - break; - case SWPLD2_REG_VALUE: - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = swpld2_reg_addr; - break; - case SWPLD3_REG_VALUE: - cmd_data[1] = SWPLD3_ADDR; - cmd_data[2] = swpld3_reg_addr; - break; - case SWPLD4_REG_VALUE: - cmd_data[1] = SWPLD4_ADDR; - cmd_data[2] = swpld4_reg_addr; - break; - default : - return sprintf(buf, "%d not found", attr->index); - } - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - return count; - } - else{ - cmd_data[0] = BMC_BUS_5; - cmd_data[2] = attribute_data[attr->index].reg; - cmd_data[3] = 1; - switch (attr->index) { - //attributes - case SWPLD1_MAJOR_VER ... PSU_LED_MODE://SWPLD1 - cmd_data[1] = SWPLD1_ADDR; - break; - case SWPLD2_MAJOR_VER ... FAN_MOD4_LED://SWPLD2 - cmd_data[1] = SWPLD2_ADDR; - break; - case SWPLD3_MAJOR_VER ... PLATFORM_TYPE://SWPLD3 - cmd_data[1] = SWPLD3_ADDR; - break; - case SWPLD4_MAJOR_VER ... FAN_EEPROM_WP://SWPLD4 - cmd_data[1] = SWPLD4_ADDR; - break; - default: - return sprintf(buf, "%d not found", attr->index); - } - - value = dni_bmc_cmd(get_cmd, cmd_data, cmd_data_len); - mask = attribute_data[attr->index].mask; - mask_out = value & ~(mask); - cmd_data[3] = set_data; - switch (mask) { - case 0xFF: - set_data = mask_out | (set_data & mask); - break; - case 0x0F: - set_data = mask_out | (set_data & mask); - break; - case 0xF0: - set_data = set_data << 4; - set_data = mask_out | (set_data & mask); - break; - case 0xC0: - set_data = set_data << 6; - set_data = mask_out | (set_data & mask); - break; - case 0x30: - set_data = set_data << 4; - set_data = mask_out | (set_data & mask); - break; - default : - set_data = mask_out | (set_data << dni_log2(mask) ); - } - dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - return count; - } -} - -//SWPLD -static SENSOR_DEVICE_ATTR(swpld1_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD1_REG_ADDR); -static SENSOR_DEVICE_ATTR(swpld1_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD1_REG_VALUE); -static SENSOR_DEVICE_ATTR(swpld2_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD2_REG_ADDR); -static SENSOR_DEVICE_ATTR(swpld2_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD2_REG_VALUE); -static SENSOR_DEVICE_ATTR(swpld3_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD3_REG_ADDR); -static SENSOR_DEVICE_ATTR(swpld3_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD3_REG_VALUE); -static SENSOR_DEVICE_ATTR(swpld4_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD4_REG_ADDR); -static SENSOR_DEVICE_ATTR(swpld4_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD4_REG_VALUE); -//SWPLD1 -static SENSOR_DEVICE_ATTR(swpld1_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD1_MAJOR_VER); -static SENSOR_DEVICE_ATTR(swpld1_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD1_MINOR_VER); -static SENSOR_DEVICE_ATTR(swpld1_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD1_SCRTCH_REG); -static SENSOR_DEVICE_ATTR(psu1_pwr_ok, S_IRUGO, get_swpld_reg, NULL, PSU1_PWR_OK); -static SENSOR_DEVICE_ATTR(psu1_int, S_IRUGO, get_swpld_reg, NULL, PSU1_INT); -static SENSOR_DEVICE_ATTR(psu2_pwr_ok, S_IRUGO, get_swpld_reg, NULL, PSU2_PWR_OK); -static SENSOR_DEVICE_ATTR(psu2_int, S_IRUGO, get_swpld_reg, NULL, PSU2_INT); -static SENSOR_DEVICE_ATTR(synce_int, S_IRUGO, get_swpld_reg, NULL, SYNCE_INT); -static SENSOR_DEVICE_ATTR(synce_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYNCE_RST); -static SENSOR_DEVICE_ATTR(synce_eeprom_wp, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYNCE_EEPROM_WP); -static SENSOR_DEVICE_ATTR(psu1_green_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU1_GREEN_LED); -static SENSOR_DEVICE_ATTR(psu1_red_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU1_RED_LED); -static SENSOR_DEVICE_ATTR(psu2_green_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU2_GREEN_LED); -static SENSOR_DEVICE_ATTR(psu2_red_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU2_RED_LED); -static SENSOR_DEVICE_ATTR(psu_led_mode, S_IRUGO, get_swpld_reg, NULL, PSU_LED_MODE); -//SWPLD2 -static SENSOR_DEVICE_ATTR(swpld2_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD2_MAJOR_VER); -static SENSOR_DEVICE_ATTR(swpld2_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD2_MINOR_VER); -static SENSOR_DEVICE_ATTR(swpld2_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD2_SCRTCH_REG); -static SENSOR_DEVICE_ATTR(fan_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_LED); -static SENSOR_DEVICE_ATTR(sys_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYS_LED); -static SENSOR_DEVICE_ATTR(fan_mod1_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD1_LED); -static SENSOR_DEVICE_ATTR(fan_mod2_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD2_LED); -static SENSOR_DEVICE_ATTR(fan_mod3_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD3_LED); -static SENSOR_DEVICE_ATTR(fan_mod4_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD4_LED); -//SWPLD3 -static SENSOR_DEVICE_ATTR(swpld3_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD3_MAJOR_VER); -static SENSOR_DEVICE_ATTR(swpld3_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD3_MINOR_VER); -static SENSOR_DEVICE_ATTR(swpld3_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD3_SCRTCH_REG); -static SENSOR_DEVICE_ATTR(sb_ver, S_IRUGO, get_swpld_reg, NULL, SB_VER); -static SENSOR_DEVICE_ATTR(platform_type, S_IRUGO, get_swpld_reg, NULL, PLATFORM_TYPE); - -//SWPLD4 -static SENSOR_DEVICE_ATTR(swpld4_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD4_MAJOR_VER); -static SENSOR_DEVICE_ATTR(swpld4_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD4_MINOR_VER); -static SENSOR_DEVICE_ATTR(swpld4_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD4_SCRTCH_REG); -static SENSOR_DEVICE_ATTR(bmc_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, BMC_RST); -static SENSOR_DEVICE_ATTR(cpld_lpc_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_LPC_RST); -static SENSOR_DEVICE_ATTR(cpld_sw_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_SW_RST); -static SENSOR_DEVICE_ATTR(mb_cpld_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, MB_CPLD_RST); -static SENSOR_DEVICE_ATTR(bcm56970_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, BCM56970_RST); - -static SENSOR_DEVICE_ATTR(cpld_upgrade_rst, S_IRUGO, get_swpld_reg, NULL, CPLD_UPGRADE_RST); -static SENSOR_DEVICE_ATTR(mb_rst_cpld, S_IRUGO, get_swpld_reg, NULL, MB_RST_CPLD); -static SENSOR_DEVICE_ATTR(cpu_rst_mb_oob, S_IRUGO, get_swpld_reg, NULL, CPU_RST_MB_OOB); -static SENSOR_DEVICE_ATTR(gpio_phy_rst, S_IRUGO, get_swpld_reg, NULL, GPIO_PHY_RST); -static SENSOR_DEVICE_ATTR(psu_fan_event, S_IRUGO, get_swpld_reg, NULL, PSU_FAN_EVENT); -static SENSOR_DEVICE_ATTR(cpu_thermal_int, S_IRUGO, get_swpld_reg, NULL, CPU_THERMAL_INT); -static SENSOR_DEVICE_ATTR(fan_int, S_IRUGO, get_swpld_reg, NULL, FAN_INT); - -static SENSOR_DEVICE_ATTR(cpld_spi_wp, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_SPI_WP); -static SENSOR_DEVICE_ATTR(rj45_console_sel, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, RJ45_CONSOLE_SEL); -static SENSOR_DEVICE_ATTR(system_int, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYSTEM_INT); -static SENSOR_DEVICE_ATTR(cpld_mb_rst_done, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_MB_RST_DONE); -static SENSOR_DEVICE_ATTR(mb_pwr_ok, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, MB_PWR_OK); -static SENSOR_DEVICE_ATTR(fan_eeprom_wp, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_EEPROM_WP); - -static struct attribute *swpld1_device_attrs[] = { - &sensor_dev_attr_swpld1_reg_value.dev_attr.attr, - &sensor_dev_attr_swpld1_reg_addr.dev_attr.attr, - &sensor_dev_attr_swpld1_major_ver.dev_attr.attr, - &sensor_dev_attr_swpld1_minor_ver.dev_attr.attr, - &sensor_dev_attr_swpld1_scrtch_reg.dev_attr.attr, - &sensor_dev_attr_psu1_pwr_ok.dev_attr.attr, - &sensor_dev_attr_psu1_int.dev_attr.attr, - &sensor_dev_attr_psu2_pwr_ok.dev_attr.attr, - &sensor_dev_attr_psu2_int.dev_attr.attr, - &sensor_dev_attr_synce_int.dev_attr.attr, - &sensor_dev_attr_synce_rst.dev_attr.attr, - &sensor_dev_attr_synce_eeprom_wp.dev_attr.attr, - &sensor_dev_attr_psu1_green_led.dev_attr.attr, - &sensor_dev_attr_psu1_red_led.dev_attr.attr, - &sensor_dev_attr_psu2_green_led.dev_attr.attr, - &sensor_dev_attr_psu2_red_led.dev_attr.attr, - &sensor_dev_attr_psu_led_mode.dev_attr.attr, - NULL, -}; - -static struct attribute *swpld2_device_attrs[] = { - &sensor_dev_attr_swpld2_reg_value.dev_attr.attr, - &sensor_dev_attr_swpld2_reg_addr.dev_attr.attr, - &sensor_dev_attr_swpld2_major_ver.dev_attr.attr, - &sensor_dev_attr_swpld2_minor_ver.dev_attr.attr, - &sensor_dev_attr_swpld2_scrtch_reg.dev_attr.attr, - &sensor_dev_attr_fan_led.dev_attr.attr, - &sensor_dev_attr_sys_led.dev_attr.attr, - &sensor_dev_attr_fan_mod1_led.dev_attr.attr, - &sensor_dev_attr_fan_mod2_led.dev_attr.attr, - &sensor_dev_attr_fan_mod3_led.dev_attr.attr, - &sensor_dev_attr_fan_mod4_led.dev_attr.attr, - NULL, -}; - -static struct attribute *swpld3_device_attrs[] = { - &sensor_dev_attr_swpld3_reg_value.dev_attr.attr, - &sensor_dev_attr_swpld3_reg_addr.dev_attr.attr, - &sensor_dev_attr_swpld3_major_ver.dev_attr.attr, - &sensor_dev_attr_swpld3_minor_ver.dev_attr.attr, - &sensor_dev_attr_swpld3_scrtch_reg.dev_attr.attr, - &sensor_dev_attr_sb_ver.dev_attr.attr, - &sensor_dev_attr_platform_type.dev_attr.attr, - NULL, -}; - -static struct attribute *swpld4_device_attrs[] = { - &sensor_dev_attr_swpld4_reg_value.dev_attr.attr, - &sensor_dev_attr_swpld4_reg_addr.dev_attr.attr, - &sensor_dev_attr_swpld4_major_ver.dev_attr.attr, - &sensor_dev_attr_swpld4_minor_ver.dev_attr.attr, - &sensor_dev_attr_swpld4_scrtch_reg.dev_attr.attr, - &sensor_dev_attr_bmc_rst.dev_attr.attr, - &sensor_dev_attr_cpld_lpc_rst.dev_attr.attr, - &sensor_dev_attr_cpld_sw_rst.dev_attr.attr, - &sensor_dev_attr_mb_cpld_rst.dev_attr.attr, - &sensor_dev_attr_bcm56970_rst.dev_attr.attr, - &sensor_dev_attr_cpld_upgrade_rst.dev_attr.attr, - &sensor_dev_attr_mb_rst_cpld.dev_attr.attr, - &sensor_dev_attr_cpu_rst_mb_oob.dev_attr.attr, - &sensor_dev_attr_gpio_phy_rst.dev_attr.attr, - &sensor_dev_attr_psu_fan_event.dev_attr.attr, - &sensor_dev_attr_cpu_thermal_int.dev_attr.attr, - &sensor_dev_attr_fan_int.dev_attr.attr, - &sensor_dev_attr_cpld_spi_wp.dev_attr.attr, - &sensor_dev_attr_rj45_console_sel.dev_attr.attr, - &sensor_dev_attr_system_int.dev_attr.attr, - &sensor_dev_attr_cpld_mb_rst_done.dev_attr.attr, - &sensor_dev_attr_mb_pwr_ok.dev_attr.attr, - &sensor_dev_attr_fan_eeprom_wp.dev_attr.attr, - NULL, -}; - -static struct attribute_group swpld1_device_attr_grp = { - .attrs = swpld1_device_attrs, -}; - -static struct attribute_group swpld2_device_attr_grp = { - .attrs = swpld2_device_attrs, -}; - -static struct attribute_group swpld3_device_attr_grp = { - .attrs = swpld3_device_attrs, -}; - -static struct attribute_group swpld4_device_attr_grp = { - .attrs = swpld4_device_attrs, -}; - -static int __init swpld1_probe(struct platform_device *pdev) -{ - int ret; - ret = sysfs_create_group(&pdev->dev.kobj, &swpld1_device_attr_grp); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - return -ENODEV; - } - return 0; -} - -static int __init swpld2_probe(struct platform_device *pdev) -{ - int ret; - ret = sysfs_create_group(&pdev->dev.kobj, &swpld2_device_attr_grp); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - return -ENODEV; - } - return 0; -} - -static int __init swpld3_probe(struct platform_device *pdev) -{ - int ret; - ret = sysfs_create_group(&pdev->dev.kobj, &swpld3_device_attr_grp); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - return -ENODEV; - } - return 0; -} - -static int __init swpld4_probe(struct platform_device *pdev) -{ - int ret; - ret = sysfs_create_group(&pdev->dev.kobj, &swpld4_device_attr_grp); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - return -ENODEV; - } - return 0; -} - -static int __exit swpld1_remove(struct platform_device *pdev) -{ - sysfs_remove_group(&pdev->dev.kobj, &swpld1_device_attr_grp); - return 0; -} - -static int __exit swpld2_remove(struct platform_device *pdev) -{ - sysfs_remove_group(&pdev->dev.kobj, &swpld2_device_attr_grp); - return 0; -} - -static int __exit swpld3_remove(struct platform_device *pdev) -{ - sysfs_remove_group(&pdev->dev.kobj, &swpld3_device_attr_grp); - return 0; -} - -static int __exit swpld4_remove(struct platform_device *pdev) -{ - sysfs_remove_group(&pdev->dev.kobj, &swpld4_device_attr_grp); - return 0; -} - -static struct platform_driver swpld1_driver = { - .probe = swpld1_probe, - .remove = __exit_p(swpld1_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9064-swpld1", - }, -}; - -static struct platform_driver swpld2_driver = { - .probe = swpld2_probe, - .remove = __exit_p(swpld2_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9064-swpld2", - }, -}; - -static struct platform_driver swpld3_driver = { - .probe = swpld3_probe, - .remove = __exit_p(swpld3_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9064-swpld3", - }, -}; - -static struct platform_driver swpld4_driver = { - .probe = swpld4_probe, - .remove = __exit_p(swpld4_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9064-swpld4", - }, -}; -/*---------------- CPLD - end ------------- */ - -/*---------------- module initialization ------------- */ -static void __init delta_ag9064_swpld_init(void) -{ - int ret; - printk(KERN_WARNING "ag9064_platform_swpld module initialization\n"); - - ret = dni_create_user(); - if (ret != 0){ - printk(KERN_WARNING "Fail to create IPMI user\n"); - } - - // set the SWPLD prob and remove - ret = platform_driver_register(&swpld1_driver); - if (ret) { - printk(KERN_WARNING "Fail to register swpld driver\n"); - goto error_swpld1_driver; - } - - // register the SWPLD - ret = platform_device_register(&swpld1_device); - if (ret) { - printk(KERN_WARNING "Fail to create swpld device\n"); - goto error_swpld1_device; - } - - // set the SWPLD prob and remove - ret = platform_driver_register(&swpld2_driver); - if (ret) { - printk(KERN_WARNING "Fail to register swpld driver\n"); - goto error_swpld2_driver; - } - - // register the SWPLD - ret = platform_device_register(&swpld2_device); - if (ret) { - printk(KERN_WARNING "Fail to create swpld device\n"); - goto error_swpld2_device; - } - - // set the SWPLD prob and remove - ret = platform_driver_register(&swpld3_driver); - if (ret) { - printk(KERN_WARNING "Fail to register swpld driver\n"); - goto error_swpld3_driver; - } - - // register the SWPLD - ret = platform_device_register(&swpld3_device); - if (ret) { - printk(KERN_WARNING "Fail to create swpld device\n"); - goto error_swpld3_device; - } - - // set the SWPLD prob and remove - ret = platform_driver_register(&swpld4_driver); - if (ret) { - printk(KERN_WARNING "Fail to register swpld driver\n"); - goto error_swpld4_driver; - } - - // register the SWPLD - ret = platform_device_register(&swpld4_device); - if (ret) { - printk(KERN_WARNING "Fail to create swpld device\n"); - goto error_swpld4_device; - } - return 0; - -error_swpld4_device: - platform_driver_unregister(&swpld4_driver); -error_swpld4_driver: - platform_driver_unregister(&swpld3_device); -error_swpld3_device: - platform_driver_unregister(&swpld3_driver); -error_swpld3_driver: - platform_driver_unregister(&swpld2_device); -error_swpld2_device: - platform_driver_unregister(&swpld2_driver); -error_swpld2_driver: - platform_driver_unregister(&swpld1_device); -error_swpld1_device: - platform_driver_unregister(&swpld1_driver); -error_swpld1_driver: - return ret; -} - -static void __exit delta_ag9064_swpld_exit(void) -{ - platform_device_unregister(&swpld1_device); - platform_driver_unregister(&swpld1_driver); - platform_device_unregister(&swpld2_device); - platform_driver_unregister(&swpld2_driver); - platform_device_unregister(&swpld3_device); - platform_driver_unregister(&swpld3_driver); - platform_device_unregister(&swpld4_device); - platform_driver_unregister(&swpld4_driver); -} -module_init(delta_ag9064_swpld_init); -module_exit(delta_ag9064_swpld_exit); - -MODULE_DESCRIPTION("DNI ag9064 CPLD Platform Support"); -MODULE_AUTHOR("Stanley Chi "); -MODULE_LICENSE("GPL"); \ No newline at end of file +#include "delta_ag9064_common.h" + +unsigned char swpld1_reg_addr; +unsigned char swpld2_reg_addr; +unsigned char swpld3_reg_addr; +unsigned char swpld4_reg_addr; + +/*---------------- CPLD - start ------------- */ +/* SWPLD1 -- device */ +static struct platform_device swpld1_device = { + .name = "delta-ag9064-swpld1", + .id = 0, + .dev = { + .platform_data = ag9064_swpld1_platform_data, + .release = device_release + }, +}; + +static struct platform_device swpld2_device = { + .name = "delta-ag9064-swpld2", + .id = 0, + .dev = { + .platform_data = ag9064_swpld2_platform_data, + .release = device_release + }, +}; +static struct platform_device swpld3_device = { + .name = "delta-ag9064-swpld3", + .id = 0, + .dev = { + .platform_data = ag9064_swpld3_platform_data, + .release = device_release + }, +}; +static struct platform_device swpld4_device = { + .name = "delta-ag9064-swpld4", + .id = 0, + .dev = { + .platform_data = ag9064_swpld4_platform_data, + .release = device_release + }, +}; + +static ssize_t get_swpld_reg(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + int ret; + int mask; + int value; + int cmd_data_len; + char note[200]; + uint8_t cmd_data[4]={0}; + uint8_t get_cmd; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + + cmd_data_len = sizeof(cmd_data); + get_cmd = CMD_GETDATA; + cmd_data[0] = BMC_BUS_5; + cmd_data[3] = 1; + mask = attribute_data[attr->index].mask; + sprintf(note, "\n%s\n",attribute_data[attr->index].note); + + if (attr->index <= SWPLD4_REG_VALUE){ + switch (attr->index) { + case SWPLD1_REG_ADDR: + return sprintf(buf, "0x%02x\n", swpld1_reg_addr); + case SWPLD2_REG_ADDR: + return sprintf(buf, "0x%02x\n", swpld2_reg_addr); + case SWPLD3_REG_ADDR: + return sprintf(buf, "0x%02x\n", swpld3_reg_addr); + case SWPLD4_REG_ADDR: + return sprintf(buf, "0x%02x\n", swpld4_reg_addr); + case SWPLD1_REG_VALUE: + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = swpld1_reg_addr; + break; + case SWPLD2_REG_VALUE: + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = swpld2_reg_addr; + break; + case SWPLD3_REG_VALUE: + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = swpld3_reg_addr; + break; + case SWPLD4_REG_VALUE: + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = swpld4_reg_addr; + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + ret = dni_bmc_cmd(get_cmd, cmd_data, cmd_data_len); + ret = ret & 0xff; + return sprintf(buf, "0x%02x\n", ret); + }else{ + + switch (attr->index) { + case SWPLD1_MAJOR_VER ... PSU_LED_MODE : + cmd_data[1] = SWPLD1_ADDR; + break; + case SWPLD2_MAJOR_VER ... FAN_MOD4_LED : + cmd_data[1] = SWPLD2_ADDR; + break; + case SWPLD3_MAJOR_VER ... PLATFORM_TYPE : + cmd_data[1] = SWPLD3_ADDR; + break; + case SWPLD4_MAJOR_VER ... FAN_EEPROM_WP : + cmd_data[1] = SWPLD4_ADDR; + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + cmd_data[2] = attribute_data[attr->index].reg; + value = dni_bmc_cmd(get_cmd, cmd_data, cmd_data_len); + value = value & mask; + switch (mask) { + case 0xFF: + return sprintf(buf, "0x%02x%s", value, note); + case 0x0F: + return sprintf(buf, "0x%01x%s", value, note); + case 0xF0: + value = value >> 4; + return sprintf(buf, "0x%01x%s", value, note); + case 0xC0: + value = value >> 6; + return sprintf(buf, "0x%01x%s", value, note); + case 0x30: + value = value >> 4; + return sprintf(buf, "0x%01x%s", value, note); + default : + value = value >> dni_log2(mask); + return sprintf(buf, "%d%s", value, note); + } + } +} + +static ssize_t set_swpld_reg(struct device *dev, struct device_attribute *dev_attr, + const char *buf, size_t count) +{ + int err; + int value; + int set_data; + int cmd_data_len; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + uint8_t get_cmd; + unsigned long set_data_ul; + unsigned char mask; + unsigned char mask_out; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + + cmd_data_len = sizeof(cmd_data); + set_cmd = CMD_SETDATA; + get_cmd = CMD_GETDATA; + + err = kstrtoul(buf, 0, &set_data_ul); + if (err){ + return err; + } + + if (set_data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + return count; + } + + set_data = (int)set_data_ul; + if (attr->index <= SWPLD4_REG_VALUE){ + cmd_data[0] = BMC_BUS_5; + cmd_data[3] = set_data; + switch (attr->index) { + //reg_addr + case SWPLD1_REG_ADDR: + swpld1_reg_addr = set_data; + return count; + case SWPLD2_REG_ADDR: + swpld2_reg_addr = set_data; + return count; + case SWPLD3_REG_ADDR: + swpld3_reg_addr = set_data; + return count; + case SWPLD4_REG_ADDR: + swpld4_reg_addr = set_data; + return count; + //reg_value + case SWPLD1_REG_VALUE: + cmd_data[1] = SWPLD1_ADDR; + cmd_data[2] = swpld1_reg_addr; + break; + case SWPLD2_REG_VALUE: + cmd_data[1] = SWPLD2_ADDR; + cmd_data[2] = swpld2_reg_addr; + break; + case SWPLD3_REG_VALUE: + cmd_data[1] = SWPLD3_ADDR; + cmd_data[2] = swpld3_reg_addr; + break; + case SWPLD4_REG_VALUE: + cmd_data[1] = SWPLD4_ADDR; + cmd_data[2] = swpld4_reg_addr; + break; + default : + return sprintf(buf, "%d not found", attr->index); + } + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + return count; + } + else{ + cmd_data[0] = BMC_BUS_5; + cmd_data[2] = attribute_data[attr->index].reg; + cmd_data[3] = 1; + switch (attr->index) { + //attributes + case SWPLD1_MAJOR_VER ... PSU_LED_MODE://SWPLD1 + cmd_data[1] = SWPLD1_ADDR; + break; + case SWPLD2_MAJOR_VER ... FAN_MOD4_LED://SWPLD2 + cmd_data[1] = SWPLD2_ADDR; + break; + case SWPLD3_MAJOR_VER ... PLATFORM_TYPE://SWPLD3 + cmd_data[1] = SWPLD3_ADDR; + break; + case SWPLD4_MAJOR_VER ... FAN_EEPROM_WP://SWPLD4 + cmd_data[1] = SWPLD4_ADDR; + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + + value = dni_bmc_cmd(get_cmd, cmd_data, cmd_data_len); + mask = attribute_data[attr->index].mask; + mask_out = value & ~(mask); + cmd_data[3] = set_data; + switch (mask) { + case 0xFF: + set_data = mask_out | (set_data & mask); + break; + case 0x0F: + set_data = mask_out | (set_data & mask); + break; + case 0xF0: + set_data = set_data << 4; + set_data = mask_out | (set_data & mask); + break; + case 0xC0: + set_data = set_data << 6; + set_data = mask_out | (set_data & mask); + break; + case 0x30: + set_data = set_data << 4; + set_data = mask_out | (set_data & mask); + break; + default : + set_data = mask_out | (set_data << dni_log2(mask) ); + } + dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + return count; + } +} + +//SWPLD +static SENSOR_DEVICE_ATTR(swpld1_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD1_REG_ADDR); +static SENSOR_DEVICE_ATTR(swpld1_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD1_REG_VALUE); +static SENSOR_DEVICE_ATTR(swpld2_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD2_REG_ADDR); +static SENSOR_DEVICE_ATTR(swpld2_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD2_REG_VALUE); +static SENSOR_DEVICE_ATTR(swpld3_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD3_REG_ADDR); +static SENSOR_DEVICE_ATTR(swpld3_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD3_REG_VALUE); +static SENSOR_DEVICE_ATTR(swpld4_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD4_REG_ADDR); +static SENSOR_DEVICE_ATTR(swpld4_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD4_REG_VALUE); +//SWPLD1 +static SENSOR_DEVICE_ATTR(swpld1_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD1_MAJOR_VER); +static SENSOR_DEVICE_ATTR(swpld1_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD1_MINOR_VER); +static SENSOR_DEVICE_ATTR(swpld1_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD1_SCRTCH_REG); +static SENSOR_DEVICE_ATTR(psu1_pwr_ok, S_IRUGO, get_swpld_reg, NULL, PSU1_PWR_OK); +static SENSOR_DEVICE_ATTR(psu1_int, S_IRUGO, get_swpld_reg, NULL, PSU1_INT); +static SENSOR_DEVICE_ATTR(psu2_pwr_ok, S_IRUGO, get_swpld_reg, NULL, PSU2_PWR_OK); +static SENSOR_DEVICE_ATTR(psu2_int, S_IRUGO, get_swpld_reg, NULL, PSU2_INT); +static SENSOR_DEVICE_ATTR(synce_int, S_IRUGO, get_swpld_reg, NULL, SYNCE_INT); +static SENSOR_DEVICE_ATTR(synce_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYNCE_RST); +static SENSOR_DEVICE_ATTR(synce_eeprom_wp, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYNCE_EEPROM_WP); +static SENSOR_DEVICE_ATTR(psu1_green_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU1_GREEN_LED); +static SENSOR_DEVICE_ATTR(psu1_red_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU1_RED_LED); +static SENSOR_DEVICE_ATTR(psu2_green_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU2_GREEN_LED); +static SENSOR_DEVICE_ATTR(psu2_red_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, PSU2_RED_LED); +static SENSOR_DEVICE_ATTR(psu_led_mode, S_IRUGO, get_swpld_reg, NULL, PSU_LED_MODE); +//SWPLD2 +static SENSOR_DEVICE_ATTR(swpld2_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD2_MAJOR_VER); +static SENSOR_DEVICE_ATTR(swpld2_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD2_MINOR_VER); +static SENSOR_DEVICE_ATTR(swpld2_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD2_SCRTCH_REG); +static SENSOR_DEVICE_ATTR(fan_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_LED); +static SENSOR_DEVICE_ATTR(sys_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYS_LED); +static SENSOR_DEVICE_ATTR(fan_mod1_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD1_LED); +static SENSOR_DEVICE_ATTR(fan_mod2_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD2_LED); +static SENSOR_DEVICE_ATTR(fan_mod3_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD3_LED); +static SENSOR_DEVICE_ATTR(fan_mod4_led, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_MOD4_LED); +//SWPLD3 +static SENSOR_DEVICE_ATTR(swpld3_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD3_MAJOR_VER); +static SENSOR_DEVICE_ATTR(swpld3_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD3_MINOR_VER); +static SENSOR_DEVICE_ATTR(swpld3_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD3_SCRTCH_REG); +static SENSOR_DEVICE_ATTR(sb_ver, S_IRUGO, get_swpld_reg, NULL, SB_VER); +static SENSOR_DEVICE_ATTR(platform_type, S_IRUGO, get_swpld_reg, NULL, PLATFORM_TYPE); + +//SWPLD4 +static SENSOR_DEVICE_ATTR(swpld4_major_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD4_MAJOR_VER); +static SENSOR_DEVICE_ATTR(swpld4_minor_ver, S_IRUGO, get_swpld_reg, NULL, SWPLD4_MINOR_VER); +static SENSOR_DEVICE_ATTR(swpld4_scrtch_reg, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SWPLD4_SCRTCH_REG); +static SENSOR_DEVICE_ATTR(bmc_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, BMC_RST); +static SENSOR_DEVICE_ATTR(cpld_lpc_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_LPC_RST); +static SENSOR_DEVICE_ATTR(cpld_sw_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_SW_RST); +static SENSOR_DEVICE_ATTR(mb_cpld_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, MB_CPLD_RST); +static SENSOR_DEVICE_ATTR(bcm56970_rst, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, BCM56970_RST); + +static SENSOR_DEVICE_ATTR(cpld_upgrade_rst, S_IRUGO, get_swpld_reg, NULL, CPLD_UPGRADE_RST); +static SENSOR_DEVICE_ATTR(mb_rst_cpld, S_IRUGO, get_swpld_reg, NULL, MB_RST_CPLD); +static SENSOR_DEVICE_ATTR(cpu_rst_mb_oob, S_IRUGO, get_swpld_reg, NULL, CPU_RST_MB_OOB); +static SENSOR_DEVICE_ATTR(gpio_phy_rst, S_IRUGO, get_swpld_reg, NULL, GPIO_PHY_RST); +static SENSOR_DEVICE_ATTR(psu_fan_event, S_IRUGO, get_swpld_reg, NULL, PSU_FAN_EVENT); +static SENSOR_DEVICE_ATTR(cpu_thermal_int, S_IRUGO, get_swpld_reg, NULL, CPU_THERMAL_INT); +static SENSOR_DEVICE_ATTR(fan_int, S_IRUGO, get_swpld_reg, NULL, FAN_INT); + +static SENSOR_DEVICE_ATTR(cpld_spi_wp, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_SPI_WP); +static SENSOR_DEVICE_ATTR(rj45_console_sel, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, RJ45_CONSOLE_SEL); +static SENSOR_DEVICE_ATTR(system_int, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, SYSTEM_INT); +static SENSOR_DEVICE_ATTR(cpld_mb_rst_done, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, CPLD_MB_RST_DONE); +static SENSOR_DEVICE_ATTR(mb_pwr_ok, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, MB_PWR_OK); +static SENSOR_DEVICE_ATTR(fan_eeprom_wp, S_IRUGO | S_IWUSR, get_swpld_reg, set_swpld_reg, FAN_EEPROM_WP); + +static struct attribute *swpld1_device_attrs[] = { + &sensor_dev_attr_swpld1_reg_value.dev_attr.attr, + &sensor_dev_attr_swpld1_reg_addr.dev_attr.attr, + &sensor_dev_attr_swpld1_major_ver.dev_attr.attr, + &sensor_dev_attr_swpld1_minor_ver.dev_attr.attr, + &sensor_dev_attr_swpld1_scrtch_reg.dev_attr.attr, + &sensor_dev_attr_psu1_pwr_ok.dev_attr.attr, + &sensor_dev_attr_psu1_int.dev_attr.attr, + &sensor_dev_attr_psu2_pwr_ok.dev_attr.attr, + &sensor_dev_attr_psu2_int.dev_attr.attr, + &sensor_dev_attr_synce_int.dev_attr.attr, + &sensor_dev_attr_synce_rst.dev_attr.attr, + &sensor_dev_attr_synce_eeprom_wp.dev_attr.attr, + &sensor_dev_attr_psu1_green_led.dev_attr.attr, + &sensor_dev_attr_psu1_red_led.dev_attr.attr, + &sensor_dev_attr_psu2_green_led.dev_attr.attr, + &sensor_dev_attr_psu2_red_led.dev_attr.attr, + &sensor_dev_attr_psu_led_mode.dev_attr.attr, + NULL, +}; + +static struct attribute *swpld2_device_attrs[] = { + &sensor_dev_attr_swpld2_reg_value.dev_attr.attr, + &sensor_dev_attr_swpld2_reg_addr.dev_attr.attr, + &sensor_dev_attr_swpld2_major_ver.dev_attr.attr, + &sensor_dev_attr_swpld2_minor_ver.dev_attr.attr, + &sensor_dev_attr_swpld2_scrtch_reg.dev_attr.attr, + &sensor_dev_attr_fan_led.dev_attr.attr, + &sensor_dev_attr_sys_led.dev_attr.attr, + &sensor_dev_attr_fan_mod1_led.dev_attr.attr, + &sensor_dev_attr_fan_mod2_led.dev_attr.attr, + &sensor_dev_attr_fan_mod3_led.dev_attr.attr, + &sensor_dev_attr_fan_mod4_led.dev_attr.attr, + NULL, +}; + +static struct attribute *swpld3_device_attrs[] = { + &sensor_dev_attr_swpld3_reg_value.dev_attr.attr, + &sensor_dev_attr_swpld3_reg_addr.dev_attr.attr, + &sensor_dev_attr_swpld3_major_ver.dev_attr.attr, + &sensor_dev_attr_swpld3_minor_ver.dev_attr.attr, + &sensor_dev_attr_swpld3_scrtch_reg.dev_attr.attr, + &sensor_dev_attr_sb_ver.dev_attr.attr, + &sensor_dev_attr_platform_type.dev_attr.attr, + NULL, +}; + +static struct attribute *swpld4_device_attrs[] = { + &sensor_dev_attr_swpld4_reg_value.dev_attr.attr, + &sensor_dev_attr_swpld4_reg_addr.dev_attr.attr, + &sensor_dev_attr_swpld4_major_ver.dev_attr.attr, + &sensor_dev_attr_swpld4_minor_ver.dev_attr.attr, + &sensor_dev_attr_swpld4_scrtch_reg.dev_attr.attr, + &sensor_dev_attr_bmc_rst.dev_attr.attr, + &sensor_dev_attr_cpld_lpc_rst.dev_attr.attr, + &sensor_dev_attr_cpld_sw_rst.dev_attr.attr, + &sensor_dev_attr_mb_cpld_rst.dev_attr.attr, + &sensor_dev_attr_bcm56970_rst.dev_attr.attr, + &sensor_dev_attr_cpld_upgrade_rst.dev_attr.attr, + &sensor_dev_attr_mb_rst_cpld.dev_attr.attr, + &sensor_dev_attr_cpu_rst_mb_oob.dev_attr.attr, + &sensor_dev_attr_gpio_phy_rst.dev_attr.attr, + &sensor_dev_attr_psu_fan_event.dev_attr.attr, + &sensor_dev_attr_cpu_thermal_int.dev_attr.attr, + &sensor_dev_attr_fan_int.dev_attr.attr, + &sensor_dev_attr_cpld_spi_wp.dev_attr.attr, + &sensor_dev_attr_rj45_console_sel.dev_attr.attr, + &sensor_dev_attr_system_int.dev_attr.attr, + &sensor_dev_attr_cpld_mb_rst_done.dev_attr.attr, + &sensor_dev_attr_mb_pwr_ok.dev_attr.attr, + &sensor_dev_attr_fan_eeprom_wp.dev_attr.attr, + NULL, +}; + +static struct attribute_group swpld1_device_attr_grp = { + .attrs = swpld1_device_attrs, +}; + +static struct attribute_group swpld2_device_attr_grp = { + .attrs = swpld2_device_attrs, +}; + +static struct attribute_group swpld3_device_attr_grp = { + .attrs = swpld3_device_attrs, +}; + +static struct attribute_group swpld4_device_attr_grp = { + .attrs = swpld4_device_attrs, +}; + +static int __init swpld1_probe(struct platform_device *pdev) +{ + int ret; + ret = sysfs_create_group(&pdev->dev.kobj, &swpld1_device_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + return -ENODEV; + } + return 0; +} + +static int __init swpld2_probe(struct platform_device *pdev) +{ + int ret; + ret = sysfs_create_group(&pdev->dev.kobj, &swpld2_device_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + return -ENODEV; + } + return 0; +} + +static int __init swpld3_probe(struct platform_device *pdev) +{ + int ret; + ret = sysfs_create_group(&pdev->dev.kobj, &swpld3_device_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + return -ENODEV; + } + return 0; +} + +static int __init swpld4_probe(struct platform_device *pdev) +{ + int ret; + ret = sysfs_create_group(&pdev->dev.kobj, &swpld4_device_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + return -ENODEV; + } + return 0; +} + +static int __exit swpld1_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &swpld1_device_attr_grp); + return 0; +} + +static int __exit swpld2_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &swpld2_device_attr_grp); + return 0; +} + +static int __exit swpld3_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &swpld3_device_attr_grp); + return 0; +} + +static int __exit swpld4_remove(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, &swpld4_device_attr_grp); + return 0; +} + +static struct platform_driver swpld1_driver = { + .probe = swpld1_probe, + .remove = __exit_p(swpld1_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-swpld1", + }, +}; + +static struct platform_driver swpld2_driver = { + .probe = swpld2_probe, + .remove = __exit_p(swpld2_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-swpld2", + }, +}; + +static struct platform_driver swpld3_driver = { + .probe = swpld3_probe, + .remove = __exit_p(swpld3_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-swpld3", + }, +}; + +static struct platform_driver swpld4_driver = { + .probe = swpld4_probe, + .remove = __exit_p(swpld4_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9064-swpld4", + }, +}; +/*---------------- CPLD - end ------------- */ + +/*---------------- module initialization ------------- */ +static int __init delta_ag9064_swpld_init(void) +{ + int ret; + printk(KERN_WARNING "ag9064_platform_swpld module initialization\n"); + + ret = dni_create_user(); + if (ret != 0){ + printk(KERN_WARNING "Fail to create IPMI user\n"); + } + + // set the SWPLD prob and remove + ret = platform_driver_register(&swpld1_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld driver\n"); + goto error_swpld1_driver; + } + + // register the SWPLD + ret = platform_device_register(&swpld1_device); + if (ret) { + printk(KERN_WARNING "Fail to create swpld device\n"); + goto error_swpld1_device; + } + + // set the SWPLD prob and remove + ret = platform_driver_register(&swpld2_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld driver\n"); + goto error_swpld2_driver; + } + + // register the SWPLD + ret = platform_device_register(&swpld2_device); + if (ret) { + printk(KERN_WARNING "Fail to create swpld device\n"); + goto error_swpld2_device; + } + + // set the SWPLD prob and remove + ret = platform_driver_register(&swpld3_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld driver\n"); + goto error_swpld3_driver; + } + + // register the SWPLD + ret = platform_device_register(&swpld3_device); + if (ret) { + printk(KERN_WARNING "Fail to create swpld device\n"); + goto error_swpld3_device; + } + + // set the SWPLD prob and remove + ret = platform_driver_register(&swpld4_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld driver\n"); + goto error_swpld4_driver; + } + + // register the SWPLD + ret = platform_device_register(&swpld4_device); + if (ret) { + printk(KERN_WARNING "Fail to create swpld device\n"); + goto error_swpld4_device; + } + return 0; + +error_swpld4_device: + platform_driver_unregister(&swpld4_driver); +error_swpld4_driver: + platform_device_unregister(&swpld3_device); +error_swpld3_device: + platform_driver_unregister(&swpld3_driver); +error_swpld3_driver: + platform_device_unregister(&swpld2_device); +error_swpld2_device: + platform_driver_unregister(&swpld2_driver); +error_swpld2_driver: + platform_device_unregister(&swpld1_device); +error_swpld1_device: + platform_driver_unregister(&swpld1_driver); +error_swpld1_driver: + return ret; +} + +static void __exit delta_ag9064_swpld_exit(void) +{ + platform_device_unregister(&swpld1_device); + platform_driver_unregister(&swpld1_driver); + platform_device_unregister(&swpld2_device); + platform_driver_unregister(&swpld2_driver); + platform_device_unregister(&swpld3_device); + platform_driver_unregister(&swpld3_driver); + platform_device_unregister(&swpld4_device); + platform_driver_unregister(&swpld4_driver); +} +module_init(delta_ag9064_swpld_init); +module_exit(delta_ag9064_swpld_exit); + +MODULE_DESCRIPTION("DNI ag9064 CPLD Platform Support"); +MODULE_AUTHOR("Stanley Chi "); +MODULE_LICENSE("GPL"); From 420f003698690fa8a3eb78a3f59b68075854c799 Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Sat, 14 Apr 2018 08:50:34 +0300 Subject: [PATCH 1506/1833] [mellanox]: fix SAI build makefile (#29) --- platform/mellanox/mlnx-sai/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/mlnx-sai/Makefile b/platform/mellanox/mlnx-sai/Makefile index a858bf098df2..9a8005e5461f 100644 --- a/platform/mellanox/mlnx-sai/Makefile +++ b/platform/mellanox/mlnx-sai/Makefile @@ -6,8 +6,8 @@ MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # get sources - #rm -rf SAI-Implementation - #git clone https://github.com/Mellanox/SAI-Implementation.git + rm -rf SAI-Implementation + git clone https://github.com/Mellanox/SAI-Implementation.git # build pushd SAI-Implementation From 0fb388233ac6d5e7d21efe780e56dd8afdc8bed4 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Fri, 6 Apr 2018 14:58:18 +0000 Subject: [PATCH 1507/1833] [devices]: disable compiling ag9064 and ag5648 Signed-off-by: Guohan Lu --- platform/broadcom/sonic-platform-modules-delta/debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/rules b/platform/broadcom/sonic-platform-modules-delta/debian/rules index d0398ecaca17..58a3597e7a44 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/rules +++ b/platform/broadcom/sonic-platform-modules-delta/debian/rules @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= ag9032v1 ag9064 ag5648 +MODULE_DIRS:= ag9032v1 %: dh $@ --with=systemd From 6a0909e8a7044ce7c58aa95fcf9a9b8d8c5590cb Mon Sep 17 00:00:00 2001 From: yurypm Date: Wed, 18 Apr 2018 08:40:09 +0100 Subject: [PATCH 1508/1833] [baseimage]: Add derived package to initramfs-tools (#33) --- rules/initramfs-tools.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rules/initramfs-tools.mk b/rules/initramfs-tools.mk index 974da74b028c..3b797762dc28 100644 --- a/rules/initramfs-tools.mk +++ b/rules/initramfs-tools.mk @@ -7,4 +7,7 @@ INITRAMFS_TOOLS = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb $(INITRAMFS_TOOLS)_SRC_PATH = $(SRC_PATH)/initramfs-tools SONIC_MAKE_DEBS += $(INITRAMFS_TOOLS) -SONIC_STRETCH_DEBS += $(INITRAMFS_TOOLS) +INITRAMFS_TOOLS_CORE = initramfs-tools-core_$(INITRAMFS_TOOLS_VERSION)_all.deb +$(eval $(call add_derived_package,$(INITRAMFS_TOOLS),$(INITRAMFS_TOOLS_CORE))) + +SONIC_STRETCH_DEBS += $(INITRAMFS_TOOLS) $(INITRAMFS_TOOLS_CORE) From 0f0e7ab7e8aa57e3a2f142ceb7b74883de7fd230 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 27 Apr 2018 11:50:36 -0700 Subject: [PATCH 1509/1833] Add support 4.9 support for 7260CX3 (#34) --- files/Aboot/boot0.j2 | 2 ++ files/initramfs-tools/arista-convertfs.j2 | 3 +++ 2 files changed, 5 insertions(+) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 94f9b760352d..89a5299c4c67 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -175,6 +175,8 @@ platform_specific() { echo "hugepages=128" >> /tmp/append fi if [ "$platform" = "rook" ]; then + echo "iommu=on intel_iommu=on tsc=reliable pcie_ports=native" >>/tmp/append + echo "rhash_entries=1 usb-storage.delay_use=0" >>/tmp/append if [ -x /bin/readprefdl ]; then readprefdl -f /tmp/.system-prefdl -d > /mnt/flash/.system-prefdl elif [ -f /etc/prefdl ]; then diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index cd3b381aa276..81de6750837a 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -41,6 +41,9 @@ get_flash_dev() { wait_for_root_dev() { local try_rounds=30 while [ $try_rounds -gt 0 ]; do + if blkid | sed 's/"//g' | grep -q "$root_dev"; then + return 0 + fi if [ -e "$root_dev" ]; then return 0 fi From 145aa4ff70a76eaa94d306cbada53d9cef1f0893 Mon Sep 17 00:00:00 2001 From: StanleyCi <34563271+StanleyCi@users.noreply.github.com> Date: Wed, 2 May 2018 17:46:02 +0800 Subject: [PATCH 1510/1833] [delta]: Enable ag5648, et-6248brb, ag9064 and fix the build error of ag5648 PSU module. (#32) * 1. Fixed delta ag5648 PSU modules. 2. Enable build ag5648. Signed-off-by: neal tai * 1. Modified the kernel depends for ag5648. 2. Modified platform-modules-ag5648.service for install ag5648. Signed-off-by: neal tai * Enable the ag9064. Signed-off-by: Stanley Chi * Add Delta platform et-6248brb Signed-off-by: neal tai --- .../Delta-et-6248brb/port_config.ini | 51 + .../Delta-et-6248brb/sai.profile | 1 + .../x86_64-delta_et-6248brb-r0/fancontrol | 12 + .../fancontrol.service | 279 ++++++ .../x86_64-delta_et-6248brb-r0/installer.conf | 3 + .../led_proc_init.soc | 46 + .../x86_64-delta_et-6248brb-r0/minigraph.xml | 766 +++++++++++++++ .../plugins/eeprom.py | 32 + .../plugins/psuutil.py | 55 ++ .../plugins/sfputil.py | 88 ++ .../x86_64-delta_et-6248brb-r0/sensors.conf | 15 + platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-delta.mk | 6 + .../ag5648/modules/dni_ag5648_psu.c | 2 +- .../debian/control | 8 +- .../debian/platform-modules-ag5648.install | 1 + .../debian/platform-modules-et-6248brb.init | 80 ++ .../platform-modules-et-6248brb.install | 4 + .../sonic-platform-modules-delta/debian/rules | 2 +- .../et-6248brb/cfg/et-6248brb-modules.conf | 13 + .../et-6248brb/modules/Makefile | 2 + .../modules/delta_et-6248brb_platform.c | 918 ++++++++++++++++++ .../et-6248brb/modules/dni_gpio.c | 695 +++++++++++++ .../scripts/et-6248brb_platform_init.sh | 11 + .../et-6248brb/scripts/led_status.sh | 165 ++++ .../systemd/platform-modules-ag5648.service | 13 + .../platform-modules-et-6248brb.service | 13 + 27 files changed, 3279 insertions(+), 3 deletions(-) create mode 100755 device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/port_config.ini create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/sai.profile create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/fancontrol create mode 100755 device/delta/x86_64-delta_et-6248brb-r0/fancontrol.service create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/installer.conf create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/led_proc_init.soc create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/minigraph.xml create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/plugins/eeprom.py create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/plugins/psuutil.py create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/plugins/sfputil.py create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/sensors.conf create mode 100755 platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init create mode 100644 platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.install create mode 100644 platform/broadcom/sonic-platform-modules-delta/et-6248brb/cfg/et-6248brb-modules.conf create mode 100644 platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/delta_et-6248brb_platform.c create mode 100644 platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/dni_gpio.c create mode 100755 platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/et-6248brb_platform_init.sh create mode 100644 platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh create mode 100644 platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag5648.service create mode 100644 platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-et-6248brb.service diff --git a/device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/port_config.ini b/device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/port_config.ini new file mode 100755 index 000000000000..3747a5c4989d --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/port_config.ini @@ -0,0 +1,51 @@ +# name lanes alias index +Ethernet0 1 1000 0 +Ethernet1 2 1000 1 +Ethernet2 3 1000 2 +Ethernet3 4 1000 3 +Ethernet4 5 1000 4 +Ethernet5 6 1000 5 +Ethernet6 7 1000 6 +Ethernet7 8 1000 7 +Ethernet8 9 1000 8 +Ethernet9 10 1000 9 +Ethernet10 11 1000 10 +Ethernet11 12 1000 11 +Ethernet12 13 1000 12 +Ethernet13 14 1000 13 +Ethernet14 15 1000 14 +Ethernet15 16 1000 15 +Ethernet16 17 1000 16 +Ethernet17 18 1000 17 +Ethernet18 19 1000 18 +Ethernet19 20 1000 19 +Ethernet20 21 1000 20 +Ethernet21 22 1000 21 +Ethernet22 23 1000 22 +Ethernet23 24 1000 23 +Ethernet24 25 1000 24 +Ethernet25 26 1000 25 +Ethernet26 27 1000 26 +Ethernet27 28 1000 27 +Ethernet28 29 1000 28 +Ethernet29 30 1000 29 +Ethernet30 31 1000 30 +Ethernet31 32 1000 31 +Ethernet32 33 1000 32 +Ethernet33 34 1000 33 +Ethernet34 35 1000 34 +Ethernet35 36 1000 35 +Ethernet36 37 1000 36 +Ethernet37 38 1000 37 +Ethernet38 39 1000 38 +Ethernet39 40 1000 39 +Ethernet40 41 1000 40 +Ethernet41 42 1000 41 +Ethernet42 43 1000 42 +Ethernet43 44 1000 43 +Ethernet44 45 1000 44 +Ethernet45 46 1000 45 +Ethernet46 47 1000 46 +Ethernet47 48 1000 47 +Ethernet48 54 10000 48 +Ethernet49 53 10000 49 diff --git a/device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/sai.profile b/device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/sai.profile new file mode 100644 index 000000000000..726e1b6dc667 --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/helix4-et-6248brb-48x1G+2x10G.config.bcm diff --git a/device/delta/x86_64-delta_et-6248brb-r0/fancontrol b/device/delta/x86_64-delta_et-6248brb-r0/fancontrol new file mode 100644 index 000000000000..0deef5b88ef8 --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/fancontrol @@ -0,0 +1,12 @@ +INTERVAL=10 +DEVPATH=hwmon1=/sys/bus/i2c/devices +DEVNAME=hwmon1=adt7473 +FCTEMPS=hwmon1/0-0048/hwmon/hwmon*/temp1_input hwmon1/7-0049/hwmon/hwmon*/temp1_input hwmon1/8-004a/hwmon/hwmon*/temp1_input + +FCFANS=hwmon1/0-002e/fan1_input hwmon1/0-002e/fan2_input + +FCTARGETS=hwmon1/0-002e/pwm1 hwmon1/0-002e/pwm2 +MINTEMP=20 +MAXTEMP=60 +MINSTART=75 +MINSTOP=22 diff --git a/device/delta/x86_64-delta_et-6248brb-r0/fancontrol.service b/device/delta/x86_64-delta_et-6248brb-r0/fancontrol.service new file mode 100755 index 000000000000..3864d6d99663 --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/fancontrol.service @@ -0,0 +1,279 @@ +#!/bin/bash +# +# Simple script implementing a temperature dependent fan speed control +# Supported Linux kernel versions: 2.6.5 and later +# +# Version 0.70 +# +# Usage: fancontrol [CONFIGFILE] +# +# Dependencies: +# bash, egrep, sed, cut, sleep, readlink, lm_sensors :) +# +# Please send any questions, comments or success stories to +# marius.reiner@hdev.de +# Thanks! +# +# For configuration instructions and warnings please see fancontrol.txt, which +# can be found in the doc/ directory or at the website mentioned above. +# +# +# Copyright 2003 Marius Reiner +# Copyright (C) 2007-2009 Jean Delvare +# +# 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. +# +# + +PIDFILE="/var/run/fancontrol.pid" + +#DEBUG=1 +MAX=255 + +function LoadConfig +{ + local fcvcount fcv + + echo "Loading configuration from $1 ..." + if [ ! -r "$1" ] + then + echo "Error: Can't read configuration file" >&2 + exit 1 + fi + + # grep configuration from file + INTERVAL=`egrep '^INTERVAL=.*$' $1 | sed -e 's/INTERVAL=//g'` + DEVPATH=`egrep '^DEVPATH=.*$' $1 | sed -e 's/DEVPATH= *//g'` + DEVNAME=`egrep '^DEVNAME=.*$' $1 | sed -e 's/DEVNAME= *//g'` + FCTEMPS=`egrep '^FCTEMPS=.*$' $1 | sed -e 's/FCTEMPS=//g'` + MINTEMP=`egrep '^MINTEMP=.*$' $1 | sed -e 's/MINTEMP=//g'` + MAXTEMP=`egrep '^MAXTEMP=.*$' $1 | sed -e 's/MAXTEMP=//g'` + MINSTART=`egrep '^MINSTART=.*$' $1 | sed -e 's/MINSTART=//g'` + MINSTOP=`egrep '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP=//g'` + HWMON=$( echo "$DEVPATH" | sed 's/=.*$//g') + FCDEVPATH=$( echo "$DEVPATH" | sed 's/^.*=//g') + FCMINTEMP=$MINTEMP + FCMAXTEMP=$MAXTEMP + FCMINSTART=$MINSTART + FCMINSTOP=$MINSTOP + AFCTEMP_1_LOWER=(00 39 36 41 46 55) + AFCTEMP_1_UPPER=(39 39 44 49 54 150) + AFCTEMP_2_LOWER=(00 61 65 69 73 82) + AFCTEMP_2_UPPER=(63 67 71 75 79 150) + AFCTEMP_3_LOWER=(00 51 55 59 63 71) + AFCTEMP_3_UPPER=(53 57 61 65 69 150) + + + FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'` + + FCTARGETS=`egrep '^FCTARGETS=.*$' $1 | sed -e 's/FCTARGETS=//g'` + + # Check whether all mandatory settings are set + if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]] + then + echo "Some mandatory settings missing, please check your config file!" >&2 + exit 1 + fi + if [ "$INTERVAL" -le 0 ] + then + echo "Error in configuration file:" >&2 + echo "INTERVAL must be at least 1" >&2 + exit 1 + fi + + # write settings to arrays for easier use and print them + echo + echo "Common settings:" + + temp_string=$FCTEMPS + + let fcvcount=0 + for fcv in $FCTEMPS + do + fcvcount=$((fcvcount+1)) + AFCTEMP[$fcvcount]=$( echo "$temp_string" | cut -d" " -f $fcvcount ) + AFCTEMP[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + AFCTEMP_PATH[$fcvcount]=$( echo "${AFCTEMP[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + AFCTEMP[$fcvcount]=$( cat ${AFCTEMP[$fcvcount]} ) + AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 )) + done + + fan_string=$FCFANS + fcvcount=0 + for fcv in $FCFANS + do + fcvcount=$((fcvcount+1)) + AFCFAN[$fcvcount]=$( echo "$fan_string" | cut -d" " -f $fcvcount ) + AFCFAN_PATH[$fcvcount]=$( echo "${AFCFAN[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} ) + done + + target_string=$FCTARGETS + fcvcount=0 + for fcv in $FCTARGETS + do + fcvcount=$((fcvcount+1)) + AFCTARGET[$fcvcount]=$( echo "$target_string" | cut -d" " -f $fcvcount ) + AFCFAN_TARGET[$fcvcount]=$( echo "${AFCTARGET[$fcvcount]}" | sed 's/hwmon1/\/sys\/bus\/i2c\/devices/g' ) + done + +} + +# Check that all referenced sysfs files exist +function CheckFiles +{ + local outdated=0 fcvcount tsen fan + if [ $outdated -eq 1 ] + then + echo >&2 + echo "At least one referenced file is missing. Either some required kernel" >&2 + echo "modules haven't been loaded, or your configuration file is outdated." >&2 + echo "In the latter case, you should run pwmconfig again." >&2 + fi + return $outdated +} + +LoadConfig $1 + +# Detect path to sensors +if [ ! -d $DIR ] +then + echo $0: 'No sensors found! (did you load the necessary modules?)' >&2 + exit 1 +fi +cd $DIR + +# Check for configuration change +if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ] +then + echo "Configuration is too old, please run pwmconfig again" >&2 + exit 1 +fi +if [ "$DIR" = "/" -a -n "$DEVPATH" ] +then + echo "Unneeded DEVPATH with absolute device paths" >&2 + exit 1 +fi +CheckFiles || exit 1 + +if [ -f "$PIDFILE" ] +then + echo "File $PIDFILE exists, is fancontrol already running?" >&2 + exit 1 +fi +echo $$ > "$PIDFILE" + +# main function +function UpdateThermalSensors +{ + fcvcount=0 + for fcv in $FCTEMPS + do + fcvcount=$((fcvcount+1)) + AFCTEMP[$fcvcount]=$( cat ${AFCTEMP_PATH[$fcvcount]} ) + AFCTEMP[$fcvcount]=$(( AFCTEMP[$fcvcount]/1000 )) + done +} + +function UpdateThermalLevel +{ + AFCTEMP_NUM=$((6-${AFCTEMP_LEVEL[$i]})) + AFCTEMP_UPPER_BUF=AFCTEMP_"$i"_UPPER["$AFCTEMP_NUM"] + AFCTEMP_LOWER_BUF=AFCTEMP_"$i"_LOWER["$AFCTEMP_NUM"] + + AFCTEMP_UPPER=${!AFCTEMP_UPPER_BUF} + AFCTEMP_LOWER=${!AFCTEMP_LOWER_BUF} + + + if (( ("${AFCTEMP[$i]}" <= "$AFCTEMP_UPPER") && ("${AFCTEMP[$i]}" >= "$AFCTEMP_LOWER") )) ; then + FLAG=2 + elif (( "${AFCTEMP[$i]}" > "$AFCTEMP_UPPER" )); then + AFCTEMP_LEVEL[$i]=$((${AFCTEMP_LEVEL[$i]} - 1)) + FLAG=1 + elif (( "${AFCTEMP[$i]}" < "$AFCTEMP_LOWER" )); then + AFCTEMP_LEVEL[$i]=$((${AFCTEMP_LEVEL[$i]} + 1)) + FLAG=1 + else + AFCTEMP_LEVEL[$i]=1 + FLAG=2 + fi +} + +function UpdateFanSpeeds +{ + #echo "num tmp lev F L H" + #Update level + for i in 1 2 3 + do + #echo "----------------------" + FLAG=0 + #FLAG=0 : initial flag + #FLAG=1 : update level + #FLAG=2 : final level + while [ $FLAG -ne 2 ] + do + UpdateThermalLevel + #echo " $i ${AFCTEMP[$i]} ${AFCTEMP_LEVEL[$i]} $FLAG $AFCTEMP_LOWER $AFCTEMP_UPPER " + done + done + + min=${AFCTEMP_LEVEL[0]} + for j in "${AFCTEMP_LEVEL[@]}"; do + (( j < min )) && min=$j + done + + if (($min == 1 || $min == 2)); then + FAN_PERCENTAGE=100 + elif (($min == 3)); then + FAN_PERCENTAGE=80 + elif (($min == 4)); then + FAN_PERCENTAGE=60 + elif (($min == 5)); then + FAN_PERCENTAGE=40 + elif (($min == 6)); then + FAN_PERCENTAGE=30 + else + FAN_PERCENTAGE=100 + fi + echo "The lowest level of thermal sensors: $min " + echo "Trying to set fan speed to $FAN_PERCENTAGE %" + #Set speed to fan1~fan10 + FAN_PERCENTAGE=`expr $FAN_PERCENTAGE \* 255 / 100` + let fcvcount=0 + for fcv in $FCFANS + do + fcvcount=$(( fcvcount + 1 )) + echo $FAN_PERCENTAGE > ${AFCFAN_TARGET[$fcvcount]} + AFCFAN[$fcvcount]=$( cat ${AFCFAN_PATH[$fcvcount]} ) + + echo "FAN fan$fcvcount = ${AFCFAN[$fcvcount]} (rpm)" + done + + rm -f "$PIDFILE" +} + +# main loop calling the main function at specified intervals +AFCTEMP_LEVEL=(9 4 4 4) #inttial level +while true +do + UpdateThermalSensors + UpdateFanSpeeds + echo "Sleep $INTERVAL seconds ..." + echo + # Sleep while still handling signals + sleep $INTERVAL & + wait $! +done diff --git a/device/delta/x86_64-delta_et-6248brb-r0/installer.conf b/device/delta/x86_64-delta_et-6248brb-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/delta/x86_64-delta_et-6248brb-r0/led_proc_init.soc b/device/delta/x86_64-delta_et-6248brb-r0/led_proc_init.soc new file mode 100644 index 000000000000..ebc8f238a332 --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/led_proc_init.soc @@ -0,0 +1,46 @@ +#ET_6248BRB Port_Remap +# Vlan set and port enable +clear c +port ge en=1 +port hg en=1 + +# led0 port order remap +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=0 REMAP_PORT_1=1 REMAP_PORT_2=2 REMAP_PORT_3=3 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=4 REMAP_PORT_5=5 REMAP_PORT_6=6 REMAP_PORT_7=7 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=51 REMAP_PORT_9=50 REMAP_PORT_10=49 REMAP_PORT_11=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=47 REMAP_PORT_13=46 REMAP_PORT_14=45 REMAP_PORT_15=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=43 REMAP_PORT_17=42 REMAP_PORT_18=41 REMAP_PORT_19=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=39 REMAP_PORT_21=38 REMAP_PORT_22=37 REMAP_PORT_23=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=35 REMAP_PORT_25=34 REMAP_PORT_26=33 REMAP_PORT_27=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=31 REMAP_PORT_29=30 REMAP_PORT_30=29 REMAP_PORT_31=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=27 REMAP_PORT_33=26 REMAP_PORT_34=25 REMAP_PORT_35=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 REMAP_PORT_37=22 REMAP_PORT_38=21 REMAP_PORT_39=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=19 REMAP_PORT_41=18 REMAP_PORT_42=17 REMAP_PORT_43=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=15 REMAP_PORT_45=14 REMAP_PORT_46=13 REMAP_PORT_47=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=11 REMAP_PORT_49=10 REMAP_PORT_50=9 REMAP_PORT_51=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=7 REMAP_PORT_53=6 REMAP_PORT_54=5 REMAP_PORT_55=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=3 REMAP_PORT_57=2 REMAP_PORT_58=1 REMAP_PORT_59=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=60 REMAP_PORT_61=61 REMAP_PORT_62=62 REMAP_PORT_63=63 + +echo "ET_6248BRB LED Port Remap: Done." + +#ET_6248BRB_LED + +#-------------------------------------------------------------------------------------------------- +#LED Auto link/up + +led stop +led prog '\ + 02 00 60 E0 02 A0 60 E2 86 E6 02 00 60 E1 06 E0\ + D2 30 75 28 02 00 2E E0 32 08 97 71 1F 77 44 2E\ + E0 32 04 97 71 3C 77 40 02 00 2E E0 32 08 97 71\ + 33 77 44 2E E0 32 03 97 71 3C 77 40 02 02 77 44\ + 02 04 77 44 60 E3 2E E0 32 00 32 01 B7 97 02 00\ + 0E 00 12 E4 FE E1 50 12 E4 05 60 E5 12 E3 05 0A\ + 02 71 67 67 9A 77 69 67 86 12 E3 05 0A 01 71 74\ + 67 9A 77 76 67 86 06 E2 F2 01 60 E2 86 E0 06 E0\ + D2 34 74 0A 3A 68 06 E5 D2 00 70 96 16 E6 99 99\ + 1A 00 71 96 77 9A 32 0F 87 57 32 0E 87 57 00 00\ +' +led auto on +led start diff --git a/device/delta/x86_64-delta_et-6248brb-r0/minigraph.xml b/device/delta/x86_64-delta_et-6248brb-r0/minigraph.xml new file mode 100644 index 000000000000..98318a862591 --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/minigraph.xml @@ -0,0 +1,766 @@ + + + + + + ARISTA01T1 + 10.0.0.1 + sonic + 10.0.0.0 + 1 + 180 + 60 + + + ARISTA02T1 + 10.0.0.5 + sonic + 10.0.0.4 + 1 + 180 + 60 + + + ARISTA03T1 + 10.0.0.9 + sonic + 10.0.0.8 + 1 + 180 + 60 + + + ARISTA04T1 + 10.0.0.13 + sonic + 10.0.0.12 + 1 + 180 + 60 + + + ARISTA01T1 + FC00::2 + sonic + FC00::1 + 1 + 180 + 60 + + + ARISTA02T1 + FC00::A + sonic + FC00::9 + 1 + 180 + 60 + + + ARISTA03T1 + FC00::12 + sonic + FC00::11 + 1 + 180 + 60 + + + ARISTA04T1 + FC00::1A + sonic + FC00::19 + 1 + 180 + 60 + + + + + 64601 + sonic + + + BGPPeer +
10.0.0.1
+ + + +
+ + BGPPeer +
10.0.0.5
+ + + +
+ + BGPPeer +
10.0.0.9
+ + + +
+ + BGPPeer +
10.0.0.13
+ + + +
+ + BGPPeer +
FC00::2
+ + + +
+ + BGPPeer +
FC00::A
+ + + +
+ + BGPPeer +
FC00::12
+ + + +
+ + BGPPeer +
FC00::1A
+ + + +
+
+ +
+ + 64802 + ARISTA01T1 + + + + 64802 + ARISTA02T1 + + + + 64802 + ARISTA03T1 + + + + 64802 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.251.0.243/23 + + 10.251.0.243/23 + + + + + + sonic + + + + VlanInterface + Vlan2 + Ethernet0;Ethernet1;Ethernet2;Ethernet3;Ethernet4;Ethernet5;Ethernet6;Ethernet7;Ethernet8;Ethernet9;Ethernet10;Ethernet11;Ethernet12;Ethernet13;Ethernet14;Ethernet15;Ethernet16;Ethernet17;Ethernet18;Ethernet19;Ethernet20;Ethernet21;Ethernet22;Ethernet23;Ethernet24;Ethernet25;Ethernet26;Ethernet27;Ethernet28;Ethernet29;Ethernet30;Ethernet31;Ethernet32;Ethernet33;Ethernet34;Ethernet35;Ethernet36;Ethernet37;Ethernet38;Ethernet39;Ethernet40;Ethernet41;Ethernet42;Ethernet43;Ethernet44;Ethernet45;Ethernet46;Ethernet47 + False + 0.0.0.0/0 + + 2 + 2 + 172.0.0.0/26 + + + + + IPInterface + + Ethernet48 + 10.0.0.0/31 + + + IPInterface + + Ethernet49 + 10.0.0.4/31 + + + IPInterface + + Ethernet48 + FC00::1/126 + + + IPInterface + + Ethernet49 + FC00::9/126 + + + IPInterface + + Vlan2 + 172.0.0.1/26 + + + + + + + + + + + + DeviceInterfaceLink + true + 10000 + ARISTA01T1 + Ethernet1 + true + sonic + Ethernet48 + + + DeviceInterfaceLink + true + 10000 + ARISTA02T1 + Ethernet1 + true + sonic + Ethernet49 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet0 + true + server-01 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet1 + true + server-02 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet2 + true + server-03 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet3 + true + server-04 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet4 + true + server-05 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet5 + true + server-06 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet6 + true + server-07 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet7 + true + server-08 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet8 + true + server-09 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet9 + true + server-10 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet10 + true + server-11 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet11 + true + server-12 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet12 + true + server-13 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet13 + true + server-14 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet14 + true + server-15 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet15 + true + server-16 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet16 + true + server-17 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet17 + true + server-18 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet18 + true + server-19 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet19 + true + server-20 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet20 + true + server-21 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet21 + true + server-22 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet22 + true + server-23 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet23 + true + server-24 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet24 + true + server-25 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet25 + true + server-26 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet26 + true + server-27 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet27 + true + server-28 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet28 + true + server-29 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet29 + true + server-30 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet30 + true + server-31 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet31 + true + server-32 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet32 + true + server-33 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet33 + true + server-34 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet34 + true + server-35 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet35 + true + server-36 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet36 + true + server-37 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet37 + true + server-38 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet38 + true + server-39 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet39 + true + server-40 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet40 + true + server-41 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet41 + true + server-42 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet42 + true + server-43 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet43 + true + server-44 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet44 + true + server-45 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet45 + true + server-46 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet46 + true + server-47 + 0 + + + DeviceInterfaceLink + true + 1000 + sonic + Ethernet47 + true + server-48 + 0 + + + + + sonic + Delta-et-6248brb + + 10.251.0.243 + + + + + sonic + Delta-et-6248brb +
diff --git a/device/delta/x86_64-delta_et-6248brb-r0/plugins/eeprom.py b/device/delta/x86_64-delta_et-6248brb-r0/plugins/eeprom.py new file mode 100644 index 000000000000..11c9285f47db --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/plugins/eeprom.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/1-0054/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/delta/x86_64-delta_et-6248brb-r0/plugins/psuutil.py b/device/delta/x86_64-delta_et-6248brb-r0/plugins/psuutil.py new file mode 100644 index 000000000000..99e8f1d17dd8 --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/plugins/psuutil.py @@ -0,0 +1,55 @@ +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/devices/platform/delta-et6248brb-gpio.0/PSU/psu{}_pg" + self.psu_oper_status = "in1_input" + self.psu_presence = "/sys/devices/platform/delta-et6248brb-gpio.0/PSU/psu{}_pres" + + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + if index is None: + return False + + try: + reg_file = open(self.psu_path.format(index)) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + if int(reg_file.readline()) == 1: + return True + + return False + + def get_psu_presence(self, index): + if index is None: + return False + + try: + reg_file = open(self.psu_presence.format(index)) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + if int(reg_file.readline()) == 0: + return True + + return False diff --git a/device/delta/x86_64-delta_et-6248brb-r0/plugins/sfputil.py b/device/delta/x86_64-delta_et-6248brb-r0/plugins/sfputil.py new file mode 100644 index 000000000000..ac2b84bcbca5 --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/plugins/sfputil.py @@ -0,0 +1,88 @@ +# sfputil.py +# +# 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 = 48 + PORT_END = 49 + PORTS_IN_BLOCK = 1 + + EEPROM_OFFSET = 44 + + _port_to_eeprom_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(0) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + if x >= self.port_start and x <= self.port_end: + self._port_to_eeprom_mapping[x] = eeprom_path.format(x - self.EEPROM_OFFSET) + else: + self._port_to_eeprom_mapping[x] = eeprom_path.format(x - x) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + presence_path = "/sys/devices/platform/delta-et6248brb-gpio.0/SFP/sfp_mod_p{}" + + try: + reg_file = open(presence_path.format(port_num - 47)) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + if int(reg_file.readline()) == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + return False + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + return False diff --git a/device/delta/x86_64-delta_et-6248brb-r0/sensors.conf b/device/delta/x86_64-delta_et-6248brb-r0/sensors.conf new file mode 100644 index 000000000000..f388bd71ecbe --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/sensors.conf @@ -0,0 +1,15 @@ +# libsensors configuration file for et-6248brb +# ------------------------------------------------ + +chip "tmp75-i2c-0-48" + label temp1 "0-0048 thermal sensor" +chip "tmp75-i2c-7-49" + label temp1 "7-0048 thermal sensor" +chip "tmp75-i2c-8-4a" + label temp1 "8-004a thermal sensor" + +chip "adt7473-i2c-0-2e" + label fan1 "FANTRAY 1" + label fan2 "FANTRAY 2" + + diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 001d7486101e..b009706a7850 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -25,6 +25,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(DELTA_AG9032V1_PLATFORM_MODULE) \ $(DELTA_AG9064_PLATFORM_MODULE) \ $(DELTA_AG5648_PLATFORM_MODULE) \ + $(DELTA_ET6248BRB_PLATFORM_MODULE) \ $(QUANTA_IX1B_32X_PLATFORM_MODULE) \ $(MITAC_LY1200_32X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) diff --git a/platform/broadcom/platform-modules-delta.mk b/platform/broadcom/platform-modules-delta.mk index bc5bf91fd90b..5e6137e74ac5 100644 --- a/platform/broadcom/platform-modules-delta.mk +++ b/platform/broadcom/platform-modules-delta.mk @@ -3,10 +3,12 @@ DELTA_AG9032V1_PLATFORM_MODULE_VERSION = 1.1 DELTA_AG9064_PLATFORM_MODULE_VERSION = 1.1 DELTA_AG5648_PLATFORM_MODULE_VERSION = 1.1 +DELTA_ET6248BRB_PLATFORM_MODULE_VERSION = 1.1 export DELTA_AG9032V1_PLATFORM_MODULE_VERSION export DELTA_AG9064_PLATFORM_MODULE_VERSION export DELTA_AG5648_PLATFORM_MODULE_VERSION +export DELTA_ET6248BRB_PLATFORM_MODULE_VERSION DELTA_AG9032V1_PLATFORM_MODULE = platform-modules-ag9032v1_$(DELTA_AG9032V1_PLATFORM_MODULE_VERSION)_amd64.deb $(DELTA_AG9032V1_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-delta @@ -22,4 +24,8 @@ DELTA_AG5648_PLATFORM_MODULE = platform-modules-ag5648_$(DELTA_AG5648_PLATFORM_M $(DELTA_AG5648_PLATFORM_MODULE)_PLATFORM = x86_64-delta_ag5648-r0 $(eval $(call add_extra_package,$(DELTA_AG9032V1_PLATFORM_MODULE),$(DELTA_AG5648_PLATFORM_MODULE))) +DELTA_ET6248BRB_PLATFORM_MODULE = platform-modules-et-6248brb_$(DELTA_ET6248BRB_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELTA_ET6248BRB_PLATFORM_MODULE)_PLATFORM = x86_64-delta_et-6248brb-r0 +$(eval $(call add_extra_package,$(DELTA_AG9032V1_PLATFORM_MODULE),$(DELTA_ET6248BRB_PLATFORM_MODULE))) + SONIC_STRETCH_DEBS += $(DELTA_AG9032V1_PLATFORM_MODULE) diff --git a/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_ag5648_psu.c b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_ag5648_psu.c index 185ba2222b91..d7e8a3bf8e7c 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_ag5648_psu.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag5648/modules/dni_ag5648_psu.c @@ -421,7 +421,7 @@ static SENSOR_DEVICE_ATTR(temp1_input, \ S_IRUGO, for_linear_data, NULL, PSU_TEMP1_INPUT); static SENSOR_DEVICE_ATTR(fan1_target, \ S_IRUGO, for_fan_target, NULL, PSU_FAN1_FAULT); -static SENSOR_DEVICE_ATTR(fan1_set_percentage, S_IWUGO | S_IRUGO, \ +static SENSOR_DEVICE_ATTR(fan1_set_percentage, S_IWUSR | S_IRUGO, \ for_linear_data, set_fan_duty_cycle_input, PSU_FAN1_DUTY_CYCLE); static SENSOR_DEVICE_ATTR(fan1_input, \ S_IRUGO, for_linear_data, NULL, PSU_FAN1_SPEED); diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control index bb543a5a70ae..9b0119dbe042 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/control +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -17,5 +17,11 @@ Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ag5648 Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 +Depends: linux-image-4.9.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-et-6248brb +Architecture: amd64 +Depends: linux-image-4.9.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.install b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.install index 15f218eea12d..06d536770167 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.install +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag5648.install @@ -1,3 +1,4 @@ ag5648/scripts/ag5648_platform_init.sh usr/local/bin ag5648/cfg/ag5648-modules.conf etc/modules-load.d ag5648/scripts/led_control usr/local/bin +systemd/platform-modules-ag5648.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init new file mode 100755 index 000000000000..e314a528a6e9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init @@ -0,0 +1,80 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup et-6248brb board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + depmod -a + rmmod i2c-i801 + rmmod i2c-ismt + modprobe i2c-dev + modprobe i2c-i801 + modprobe i2c-ismt + modprobe i2c-mux-pca954x + modprobe i2c-mux-gpio + modprobe dni_gpio + modprobe delta_et-6248brb_platform + + if [ `uname -a | awk '{print $3}'` = "4.9.0-5-amd64" ]; then + echo "453" > "/sys/class/gpio/export" + echo "454" > "/sys/class/gpio/export" + echo "455" > "/sys/class/gpio/export" + echo "485" > "/sys/class/gpio/export" + echo "489" > "/sys/class/gpio/export" + echo "494" > "/sys/class/gpio/export" + echo "out" > "/sys/class/gpio/gpio453/direction" + echo "out" > "/sys/class/gpio/gpio454/direction" + echo "out" > "/sys/class/gpio/gpio455/direction" + echo "out" > "/sys/class/gpio/gpio485/direction" + echo "out" > "/sys/class/gpio/gpio489/direction" + echo "out" > "/sys/class/gpio/gpio494/direction" + else + echo "197" > "/sys/class/gpio/export" + echo "198" > "/sys/class/gpio/export" + echo "199" > "/sys/class/gpio/export" + echo "229" > "/sys/class/gpio/export" + echo "233" > "/sys/class/gpio/export" + echo "238" > "/sys/class/gpio/export" + echo "out" > "/sys/class/gpio/gpio197/direction" + echo "out" > "/sys/class/gpio/gpio198/direction" + echo "out" > "/sys/class/gpio/gpio199/direction" + echo "out" > "/sys/class/gpio/gpio229/direction" + echo "out" > "/sys/class/gpio/gpio233/direction" + echo "out" > "/sys/class/gpio/gpio238/direction" + fi + + /usr/local/bin/et-6248brb_platform_init.sh + + sleep 1 + echo "Ethernet48" > "/sys/bus/i2c/devices/4-0050/port_name" + echo "Ethernet49" > "/sys/bus/i2c/devices/5-0050/port_name" + + echo "done." + ;; + +stop) + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-et-6248brb.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.install b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.install new file mode 100644 index 000000000000..936c43679d5c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.install @@ -0,0 +1,4 @@ +et-6248brb/scripts/et-6248brb_platform_init.sh usr/local/bin +et-6248brb/cfg/et-6248brb-modules.conf etc/modules-load.d +et-6248brb/scripts/led_status.sh usr/local/bin +systemd/platform-modules-et-6248brb.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/rules b/platform/broadcom/sonic-platform-modules-delta/debian/rules index 58a3597e7a44..63949e3a5399 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/rules +++ b/platform/broadcom/sonic-platform-modules-delta/debian/rules @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= ag9032v1 +MODULE_DIRS:= ag9032v1 ag9064 ag5648 et-6248brb %: dh $@ --with=systemd diff --git a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/cfg/et-6248brb-modules.conf b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/cfg/et-6248brb-modules.conf new file mode 100644 index 000000000000..552b4103ed02 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/cfg/et-6248brb-modules.conf @@ -0,0 +1,13 @@ +# /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-delta/et-6248brb/modules/Makefile b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/Makefile new file mode 100644 index 000000000000..fb5b18ed5b4c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := delta_et-6248brb_platform.o dni_gpio.o + diff --git a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/delta_et-6248brb_platform.c b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/delta_et-6248brb_platform.c new file mode 100644 index 000000000000..fc5ecf320033 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/delta_et-6248brb_platform.c @@ -0,0 +1,918 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define OPTOE_INFO(data) \ + .type = "optoe2", .addr = 0x50 + +#define et6248brb_i2c_device_num(NUM){ \ + .name = "delta-et6248brb-i2c-device", \ + .id = NUM, \ + .dev = { \ + .platform_data = &et6248brb_i2c_device_platform_data[NUM], \ + .release = device_release, \ + }, \ +} + +#define et6248brb_gpio_num(NUM){ \ + .name = "delta-et6248brb-gpio", \ + .id = NUM, \ + .dev = { \ + .platform_data = &et6248brb_gpio_device_platform_data[NUM], \ + .release = device_release, \ + }, \ +} + +#define PCA9555_A 0x20 +#define PCA9555_B 0x21 +#define PCA9555_C 0x23 + +static struct kobject *kobj_gpio; +static struct kobject *kobj_psu; +static struct kobject *kobj_fan; +static struct kobject *kobj_sfp; +static struct kobject *kobj_others; + +/*Define struct to get client of i2c_new_deivce */ +struct i2c_client * i2c_client_9547; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, + BUS8, + BUS9, + BUS10, +}; + +/*---------------- I2C device - start ------------- */ +static void device_release(struct device *dev) +{ + return; +} + +struct i2c_device_platform_data { + int parent; + struct i2c_board_info info; + struct i2c_client *client; +}; +/* pca9547 - add 8 bus */ +static struct pca954x_platform_mode pca954x_mode[] = { + { .adap_id = 2, + .deselect_on_exit = 1, + }, + { .adap_id = 3, + .deselect_on_exit = 1, + }, + { .adap_id = 4, + .deselect_on_exit = 1, + }, + { .adap_id = 5, + .deselect_on_exit = 1, + }, + { .adap_id = 6, + .deselect_on_exit = 1, + }, + { .adap_id = 7, + .deselect_on_exit = 1, + }, + { .adap_id = 8, + .deselect_on_exit = 1, + }, + { .adap_id = 9, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_data pca954x_data = { + .modes = pca954x_mode, + .num_modes = ARRAY_SIZE(pca954x_mode), +}; + +static struct i2c_board_info __initdata i2c_info_pca9547[] = +{ + { + I2C_BOARD_INFO("pca9547", 0x71), + .platform_data = &pca954x_data, + }, +}; + +static struct i2c_device_platform_data et6248brb_i2c_device_platform_data[] = { + { + /* FAN controller (0x2e) */ + .parent = 0, + .info = { I2C_BOARD_INFO("adt7473", 0x2e) }, + .client = NULL, + }, + { + /* tmp75 (0x48) */ + .parent = 0, + .info = { I2C_BOARD_INFO("tmp75", 0x48) }, + .client = NULL, + }, + { + /* EEPROM (0x54) */ + .parent = 1, + .info = { I2C_BOARD_INFO("24c08", 0x54) }, + .client = NULL, + }, + { + /* sfp 1 (0x50) */ + .parent = 4, + .info = { OPTOE_INFO() }, + .client = NULL, + }, + { + /* sfp 2 (0x50) */ + .parent = 5, + .info = { OPTOE_INFO() }, + .client = NULL, + }, + { + /* tmp75 (0x49) */ + .parent = 7, + .info = { I2C_BOARD_INFO("tmp75", 0x49) }, + .client = NULL, + }, + { + /* tmp75 (0x4a) */ + .parent = 8, + .info = { I2C_BOARD_INFO("tmp75", 0x4a) }, + .client = NULL, + }, +}; + +static struct platform_device et6248brb_i2c_device[] = { + et6248brb_i2c_device_num(0), + et6248brb_i2c_device_num(1), + et6248brb_i2c_device_num(2), + et6248brb_i2c_device_num(3), + et6248brb_i2c_device_num(4), + et6248brb_i2c_device_num(5), + et6248brb_i2c_device_num(6), +}; + +/*---------------- I2C device - end ------------- */ +/*---------------- I2C driver - start ------------- */ +static int __init i2c_device_probe(struct platform_device *pdev) +{ + struct i2c_device_platform_data *pdata; + struct i2c_adapter *parent; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + + pdata->client = i2c_new_device(parent, &pdata->info); + if (!pdata->client) { + dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", + pdata->info.type, pdata->parent); + return -ENODEV; + } + + return 0; +} + +static int __exit i2c_deivce_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent; + struct i2c_device_platform_data *pdata; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + if (pdata->client) { + parent = (pdata->client)->adapter; + i2c_unregister_device(pdata->client); + i2c_put_adapter(parent); + } + + return 0; +} +static struct platform_driver i2c_device_driver = { + .probe = i2c_device_probe, + .remove = __exit_p(i2c_deivce_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-et6248brb-i2c-device", + } +}; +/*---------------- I2C driver - end ------------- */ + +/*---------------- gpio device - start ----------- */ +static struct pca953x_platform_data pca9555_data_0 = { + .gpio_base = 200, +}; +static struct pca953x_platform_data pca9555_data_1 = { + .gpio_base = 216, +}; +static struct pca953x_platform_data pca9555_data_2 = { + .gpio_base = 232, +}; + +static struct i2c_board_info __initdata i2c_info_pca9555[] = +{ + { + I2C_BOARD_INFO("pca9555", 0x20), + .platform_data = &pca9555_data_0, + }, + { + I2C_BOARD_INFO("pca9555", 0x21), + .platform_data = &pca9555_data_1, + }, + { + I2C_BOARD_INFO("pca9555", 0x23), + .platform_data = &pca9555_data_2, + }, +}; + +static struct i2c_device_platform_data et6248brb_gpio_device_platform_data[] = { + { + /* GPIO expander A (0x20) */ + .parent = 0, + .info = { I2C_BOARD_INFO("pca9555", 0x20) }, + .client = NULL, + }, + { + /* GPIO expander B (0x21) */ + .parent = 0, + .info = { I2C_BOARD_INFO("pca9555", 0x21) }, + .client = NULL, + }, + { + /* GPIO expander C (0x23) */ + .parent = 0, + .info = { I2C_BOARD_INFO("pca9555", 0x23) }, + .client = NULL, + }, +}; + +static struct platform_device et6248brb_gpio_device[] = { + et6248brb_gpio_num(0), + et6248brb_gpio_num(1), + et6248brb_gpio_num(2), +}; + +static struct gpio_attribute_data { + uint8_t bus; + uint8_t addr; + uint8_t reg; + uint8_t mask; + char note[150]; +}; + +enum gpio_attributes { + PSU1_SMB_ALERT, + PSU2_SMB_ALERT, + EEPROM_WP, + FAN1_LED_AG, + FAN2_LED_AG, + D_FAN_ALERT, + PSU1_PRES, + PSU2_PRES, + FAN_EEPROM_WP, + D_FAN_M_PRESENT2, + D_FAN_M_PRESENT1, + PSU1_PG, + PSU2_PG, + BCM54282_INT, + SFP_MOD_P1, + SFP_RXLOS_P1, + SFP_MOD_P2, + SFP_RXLOS_P2, + SFP_TX_FAULT_P1, + SFP_TX_FAULT_P2, + SFP_TX_DIS_P1, + SFP_TX_DIS_P2, + OOB_BCM54616S_INT, +}; + +static struct gpio_attribute_data attribute_data[] = { +//PCA9555_A + [PSU1_SMB_ALERT] = { + .bus = BUS0, .addr = PCA9555_A, + .reg = 0x00, .mask = 1 << 0, + .note = "0=PSU1 interrupt is occurr\n1=PSU1 interrupt is NOT occurr" + }, + [PSU2_SMB_ALERT] = { + .bus = BUS0, .addr = PCA9555_A, + .reg = 0x00, .mask = 1 << 3, + .note = "0=PSU2 interrupt is occurr\n1=PSU2 interrupt is NOT occurr" + }, + [EEPROM_WP] = { + .bus = BUS0, .addr = PCA9555_A, + .reg = 0x03, .mask = 1 << 3, + .note = "0=SYS eeprom write protect is disable\n1=SYS eeprom write protect is enable and can not be programmed" + + }, + [FAN1_LED_AG] = { + .bus = BUS0, .addr = PCA9555_A, + .reg = 0x03, .mask = 0x30, + .note = "00=LED off or FAN tray1 is not present\n01=LED Red,FAN tray1 fail\n10=LED Green,FAN tray1 is present\n11=reserved" + }, + [FAN2_LED_AG] = { + .bus = BUS0, .addr = PCA9555_A, + .reg = 0x03, .mask = 0xc0, + .note = "00=LED off or FAN tray1 is not present\n01=LED Red,FAN tray1 fail\n10=LED Green,FAN tray1 is present\n11=reserved" + }, +//PCA9555_B + [D_FAN_ALERT] = { + .bus = BUS0, .addr = PCA9555_B, + .reg = 0x00, .mask = 1 << 0, + .note ="0=FAN is NOT issue the alram\n1=FAN issue the alarm" + + }, + [PSU1_PRES] = { + .bus = BUS0, .addr = PCA9555_B, + .reg = 0x00, .mask = 1 << 2, + .note ="0=PSU1 is present\n1=PSU1 is NOT present" + }, + [PSU2_PRES] = { + .bus = BUS0, .addr = PCA9555_B, + .reg = 0x00, .mask = 1 << 3, + .note ="0=PSU2 is present\n1=PSU2 is NOT present" + }, + [FAN_EEPROM_WP] = { + .bus = BUS0, .addr = PCA9555_B, + .reg = 0x01, .mask = 1 << 1, + .note ="0=FAN eeprom write protect is disable\n1=FAN eeprom write protect is enable and can not be programmed" + }, + [D_FAN_M_PRESENT2] = { + .bus = BUS0, .addr = PCA9555_B, + .reg = 0x01, .mask = 1 << 2, + .note ="0=FAN2 module is present\n1=FAN2 module is NOT present" + }, + [D_FAN_M_PRESENT1] = { + .bus = BUS0, .addr = PCA9555_B, + .reg = 0x01, .mask = 1 << 3, + .note ="0=FAN1 moduel is present\n1=FAN1 module is NOT present" + }, + [PSU1_PG] = { + .bus = BUS0, .addr = PCA9555_B, + .reg = 0x01, .mask = 1 << 4, + .note ="0=PSU1 is FAIL or not present\n1=PSU1 is GOOD" + }, + [PSU2_PG] = { + .bus = BUS0, .addr = PCA9555_B, + .reg = 0x01, .mask = 1 << 5, + .note ="0=PSU2 is FAIL or not present\n1=PSU2 is GOOD" + }, + [BCM54282_INT] = { + .bus = BUS0, .addr = PCA9555_B, + .reg = 0x01, .mask = 1 << 6, + .note ="0=BCM54282 PHY interrupt occurrs\n1=BCM54282 PHY interrupt is not occurrs" + }, +//PCA9555_C + [SFP_MOD_P1] = { + .bus = BUS0, .addr = PCA9555_C, + .reg = 0x00, .mask = 1 << 0, + .note ="0=SFP1 transceiver is present\n1=SFP1 transceiver is NOT present" + }, + [SFP_RXLOS_P1] = { + .bus = BUS0, .addr = PCA9555_C, + .reg = 0x00, .mask = 1 << 1, + .note ="0=SFP1 transceiver is NOT asserted Loss of signal\n1=SFP1 transceiver is asserted Loss of signal" + }, + [SFP_MOD_P2] = { + .bus = BUS0, .addr = PCA9555_C, + .reg = 0x00, .mask = 1 << 2, + .note ="0=SFP1 transceiver is present\n1=SFP1 transceiver is NOT present" + }, + [SFP_RXLOS_P2] = { + .bus = BUS0, .addr = PCA9555_C, + .reg = 0x00, .mask = 1 << 3, + .note ="0=SFP1 transceiver is NOT asserted Loss of signal\n1=SFP1 transceiver is asserted Loss of signal" + }, + [SFP_TX_FAULT_P1] = { + .bus = BUS0, .addr = PCA9555_C, + .reg = 0x00, .mask = 1 << 4, + .note ="0=SFP1 transceiver is NOT asserted TXFAULT signal\n1=SFP1 transceiver is asserted TXFAULT signal" + }, + [SFP_TX_FAULT_P2] = { + .bus = BUS0, .addr = PCA9555_C, + .reg = 0x00, .mask = 1 << 5, + .note ="0=SFP1 transceiver is NOT asserted TXFAULT signal\n1=SFP1 transceiver is asserted TXFAULT signal" + }, + [SFP_TX_DIS_P1] = { + .bus = BUS0, .addr = PCA9555_C, + .reg = 0x02, .mask = 1 << 6, + .note ="0=SFP1 transceiver is turn ON\n1=SFP1 transceiver is turn OFF" + }, + [SFP_TX_DIS_P2] = { + .bus = BUS0, .addr = PCA9555_C, + .reg = 0x02, .mask = 1 << 7, + .note ="0=SFP2 transceiver is turn ON\n1=SFP2 transceiver is turn OFF" + }, + [OOB_BCM54616S_INT] = { + .bus = BUS0, .addr = PCA9555_C, + .reg = 0x01, .mask = 1 << 3, + .note ="0=BCM54616S PHY interrupt occurrs\n1=BCM54616S PHY interrupt is not occurrs" + }, +}; + +unsigned char dni_log2 (unsigned char num){ + unsigned char num_log2 = 0; + while(num > 0){ + num = num >> 1; + num_log2 += 1; + } + return num_log2 -1; +} + +void set_direction(struct i2c_device_platform_data *pdata, unsigned char reg, unsigned char mask){ + + int value; + int read_only; + unsigned char mask_out; + unsigned char set_data; + + read_only = 1; //Configuration:GPI + if (reg > 0x1){ + reg = reg - 0x02; + read_only = 0; //Configuration:GPO + } + + value = i2c_smbus_read_byte_data(pdata->client, reg + 0x06); + mask_out = value & ~(mask); + + if(read_only){ + set_data = mask_out | mask; + } + else{ + set_data = mask_out; + } + + i2c_smbus_write_byte_data(pdata->client, reg + 0x06, set_data); + return; +} + +static ssize_t get_gpio_reg(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + int ret; + int mask; + int value; + char note[150]; + unsigned char pca9555_num; + unsigned char reg; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct device *i2cdev = kobj_to_dev(kobj_gpio); + struct i2c_device_platform_data *pdata = i2cdev->platform_data; + + switch(attribute_data[attr->index].addr){ + case PCA9555_A: + pca9555_num = 0; + break; + case PCA9555_B: + pca9555_num = 1; + break; + case PCA9555_C: + pca9555_num = 2; + break; + default: + return sprintf(buf, "attribute address error"); + } + + set_direction(&pdata[pca9555_num], attribute_data[attr->index].reg, attribute_data[attr->index].mask); + + switch (attr->index) { + case PSU1_SMB_ALERT ... OOB_BCM54616S_INT: + reg = attribute_data[attr->index].reg; + mask = attribute_data[attr->index].mask; + value = i2c_smbus_read_byte_data(pdata[pca9555_num].client, reg); + sprintf(note, "\n%s\n",attribute_data[attr->index].note); + value = (value & mask); + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + + switch (mask) { + case 0xFF: + return sprintf(buf, "0x%02x%s", value, note); + case 0x0F: + return sprintf(buf, "0x%01x%s", value, note); + case 0xF0: + value = value >> 4; + return sprintf(buf, "0x%01x%s", value, note); + case 0xC0: + value = value >> 6; + return sprintf(buf, "0x%01x%s", value, note); + case 0x30: + value = value >> 4; + return sprintf(buf, "0x%01x%s", value, note); + default : + value = value >> dni_log2(mask); + return sprintf(buf, "%d%s", value, note); + } +} + + +static ssize_t set_gpio_reg(struct device *dev, struct device_attribute *dev_attr, + const char *buf, size_t count) +{ + int err; + int value; + unsigned long set_data; + unsigned char set_reg; + unsigned char mask; + unsigned char mask_out; + unsigned char pca9555_num; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct device *i2cdev = kobj_to_dev(kobj_gpio); + struct i2c_device_platform_data *pdata = i2cdev->platform_data; + + err = kstrtoul(buf, 0, &set_data); + if (err){ + return err; + } + + if (set_data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + return count; + } + + switch(attribute_data[attr->index].addr){ + case PCA9555_A: + pca9555_num = 0; + break; + case PCA9555_B: + pca9555_num = 1; + break; + case PCA9555_C: + pca9555_num = 2; + break; + default: + return sprintf(buf, "attribute address error"); + } + + set_direction(&pdata[pca9555_num], attribute_data[attr->index].reg, attribute_data[attr->index].mask); + + switch (attr->index) { + case PSU1_SMB_ALERT ... OOB_BCM54616S_INT: + set_reg = attribute_data[attr->index].reg; + mask = attribute_data[attr->index].mask; + value = i2c_smbus_read_byte_data(pdata[pca9555_num].client, set_reg); + mask_out = value & ~(mask); + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + + switch (mask) { + case 0xFF: + set_data = mask_out | (set_data & mask); + break; + case 0x0F: + set_data = mask_out | (set_data & mask); + break; + case 0xF0: + set_data = set_data << 4; + set_data = mask_out | (set_data & mask); + break; + case 0xC0: + set_data = set_data << 6; + set_data = mask_out | (set_data & mask); + break; + case 0x30: + set_data = set_data << 4; + set_data = mask_out | (set_data & mask); + break; + default : + set_data = mask_out | (set_data << dni_log2(mask) ); + } + + i2c_smbus_write_byte_data(pdata[pca9555_num].client, set_reg, set_data); + return count; +} +static SENSOR_DEVICE_ATTR(psu1_smb_alert, S_IRUGO, get_gpio_reg, NULL, PSU1_SMB_ALERT); +static SENSOR_DEVICE_ATTR(psu2_smb_alert, S_IRUGO, get_gpio_reg, NULL, PSU2_SMB_ALERT); +static SENSOR_DEVICE_ATTR(eeprom_wp, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, EEPROM_WP); +static SENSOR_DEVICE_ATTR(fan1_led_ag, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, FAN1_LED_AG); +static SENSOR_DEVICE_ATTR(fan2_led_ag, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, FAN2_LED_AG); +static SENSOR_DEVICE_ATTR(d_fan_alert, S_IRUGO, get_gpio_reg, NULL, D_FAN_ALERT); +static SENSOR_DEVICE_ATTR(psu1_pres, S_IRUGO, get_gpio_reg, NULL, PSU1_PRES); +static SENSOR_DEVICE_ATTR(psu2_pres, S_IRUGO, get_gpio_reg, NULL, PSU2_PRES); +static SENSOR_DEVICE_ATTR(fan_eeprom_wp, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, FAN_EEPROM_WP); +static SENSOR_DEVICE_ATTR(d_fan_m_present2, S_IRUGO, get_gpio_reg, NULL, D_FAN_M_PRESENT2); +static SENSOR_DEVICE_ATTR(d_fan_m_present1, S_IRUGO, get_gpio_reg, NULL, D_FAN_M_PRESENT1); +static SENSOR_DEVICE_ATTR(psu1_pg, S_IRUGO, get_gpio_reg, NULL, PSU1_PG); +static SENSOR_DEVICE_ATTR(psu2_pg, S_IRUGO, get_gpio_reg, NULL, PSU2_PG); +static SENSOR_DEVICE_ATTR(bcm54282_int, S_IRUGO, get_gpio_reg, NULL, BCM54282_INT); + +static SENSOR_DEVICE_ATTR(sfp_mod_p1, S_IRUGO, get_gpio_reg, NULL, SFP_MOD_P1); +static SENSOR_DEVICE_ATTR(sfp_rxlos_p1, S_IRUGO, get_gpio_reg, NULL, SFP_RXLOS_P1); +static SENSOR_DEVICE_ATTR(sfp_mod_p2, S_IRUGO, get_gpio_reg, NULL, SFP_MOD_P2); +static SENSOR_DEVICE_ATTR(sfp_rxlos_p2, S_IRUGO, get_gpio_reg, NULL, SFP_RXLOS_P2); +static SENSOR_DEVICE_ATTR(sfp_tx_fault_p1, S_IRUGO, get_gpio_reg, NULL, SFP_TX_FAULT_P1); +static SENSOR_DEVICE_ATTR(sfp_tx_fault_p2, S_IRUGO , get_gpio_reg, NULL, SFP_TX_FAULT_P2); +static SENSOR_DEVICE_ATTR(sfp_tx_dis_p1, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, SFP_TX_DIS_P1); +static SENSOR_DEVICE_ATTR(sfp_tx_dis_p2, S_IRUGO | S_IWUSR, get_gpio_reg, set_gpio_reg, SFP_TX_DIS_P2); +static SENSOR_DEVICE_ATTR(oob_bcm54616s_int, S_IRUGO, get_gpio_reg, NULL, OOB_BCM54616S_INT); + +static struct attribute *et6248brb_psu_attrs[] = { + &sensor_dev_attr_psu1_smb_alert.dev_attr.attr, + &sensor_dev_attr_psu2_smb_alert.dev_attr.attr, + &sensor_dev_attr_psu1_pres.dev_attr.attr, + &sensor_dev_attr_psu2_pres.dev_attr.attr, + &sensor_dev_attr_psu1_pg.dev_attr.attr, + &sensor_dev_attr_psu2_pg.dev_attr.attr, + NULL, +}; + +static struct attribute *et6248brb_fan_attrs[] = { + &sensor_dev_attr_fan1_led_ag.dev_attr.attr, + &sensor_dev_attr_fan2_led_ag.dev_attr.attr, + &sensor_dev_attr_d_fan_alert.dev_attr.attr, + &sensor_dev_attr_fan_eeprom_wp.dev_attr.attr, + &sensor_dev_attr_d_fan_m_present1.dev_attr.attr, + &sensor_dev_attr_d_fan_m_present2.dev_attr.attr, + NULL, +}; + +static struct attribute *et6248brb_sfp_attrs[] = { + &sensor_dev_attr_sfp_mod_p1.dev_attr.attr, + &sensor_dev_attr_sfp_rxlos_p1.dev_attr.attr, + &sensor_dev_attr_sfp_mod_p2.dev_attr.attr, + &sensor_dev_attr_sfp_rxlos_p2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault_p1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault_p2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_dis_p1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_dis_p2.dev_attr.attr, + NULL, +}; + +static struct attribute *et6248brb_others_attrs[] = { + &sensor_dev_attr_eeprom_wp.dev_attr.attr, + &sensor_dev_attr_bcm54282_int.dev_attr.attr, + &sensor_dev_attr_oob_bcm54616s_int.dev_attr.attr, + NULL, +}; + +static struct attribute_group et6248brb_psu_attr_grp = { + .attrs = et6248brb_psu_attrs, +}; + +static struct attribute_group et6248brb_fan_attr_grp = { + .attrs = et6248brb_fan_attrs, + +}; +static struct attribute_group et6248brb_sfp_attr_grp = { + .attrs = et6248brb_sfp_attrs, +}; + +static struct attribute_group et6248brb_others_attr_grp = { + .attrs = et6248brb_others_attrs, +}; +/*---------------- gpio device - end ------------- */ + +/*---------------- gpio driver - start ----------- */ +static int __init gpio_device_probe(struct platform_device *pdev) +{ + struct i2c_device_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + + pdata->client = i2c_new_device(parent, &pdata->info); + if (!pdata->client) { + dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", + pdata->info.type, pdata->parent); + return -ENODEV; + } + + if(pdata->info.addr == PCA9555_A){ + kobj_gpio = &pdev->dev.kobj; + kobj_psu = kobject_create_and_add("PSU", &pdev->dev.kobj); + if (!kobj_psu){ + printk(KERN_WARNING "Fail to create 'PSU' directory"); + goto error; + } + + kobj_fan = kobject_create_and_add("FAN", &pdev->dev.kobj); + if (!kobj_fan){ + printk(KERN_WARNING "Fail to create 'FAN' directory"); + goto error; + } + + kobj_sfp = kobject_create_and_add("SFP", &pdev->dev.kobj); + if (!kobj_sfp){ + printk(KERN_WARNING "Fail to create 'SFP' directory"); + goto error; + } + kobj_others = kobject_create_and_add("Others", &pdev->dev.kobj); + if (!kobj_others){ + printk(KERN_WARNING "Fail to create 'Others' directory"); + goto error; + } + ret = sysfs_create_group(kobj_psu, &et6248brb_psu_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create 'psu' attribute group"); + goto error; + } + ret = sysfs_create_group(kobj_fan, &et6248brb_fan_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create 'fan' attribute group"); + goto error; + } + ret = sysfs_create_group(kobj_sfp, &et6248brb_sfp_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create 'sfp' attribute group"); + goto error; + } + ret = sysfs_create_group(kobj_others, &et6248brb_others_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create 'others' attribute group"); + goto error; + } + } + return 0; + +error: + kobject_put(kobj_gpio); + kobject_put(kobj_psu); + kobject_put(kobj_fan); + kobject_put(kobj_sfp); + kobject_put(kobj_others); + i2c_unregister_device(pdata->client); + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit gpio_deivce_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent; + struct i2c_device_platform_data *pdata; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else if(pdata->info.addr == PCA9555_A){ + sysfs_remove_group(kobj_gpio, &et6248brb_psu_attr_grp); + sysfs_remove_group(kobj_fan, &et6248brb_fan_attr_grp); + sysfs_remove_group(kobj_sfp, &et6248brb_sfp_attr_grp); + sysfs_remove_group(kobj_others, &et6248brb_others_attr_grp); + kobject_put(kobj_gpio); + kobject_put(kobj_fan); + kobject_put(kobj_psu); + kobject_put(kobj_sfp); + kobject_put(kobj_others); + } + + if (pdata->client) { + if (!parent) { + parent = (pdata->client)->adapter; + } + i2c_unregister_device(pdata->client); + } + + i2c_put_adapter(parent); + return 0; +} + +static struct platform_driver gpio_device_driver = { + .probe = gpio_device_probe, + .remove = __exit_p(gpio_deivce_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-et6248brb-gpio", + } +}; +/*---------------- gpio driver - end ------------- */ + +/*---------------- module initialization ------------- */ +static int __init delta_et6248brb_platform_init(void) +{ + struct i2c_adapter *adapter; + + int ret, i = 0, j = 0; + printk("et6248brb_platform module initialization\n"); + + //Use pca9547 in i2c_mux_pca954x.c + adapter = i2c_get_adapter(BUS1); + i2c_client_9547 = i2c_new_device(adapter, &i2c_info_pca9547[0]); + i2c_put_adapter(adapter); + + // register the i2c devices + ret = platform_driver_register(&i2c_device_driver); + if (ret) { + printk(KERN_WARNING "Fail to register i2c device driver\n"); + goto error_i2c_device_driver; + } + + // register the i2c devices + ret = platform_driver_register(&gpio_device_driver); + if (ret) { + printk(KERN_WARNING "Fail to register i2c device driver\n"); + goto error_gpio_device_driver; + } + + for (i = 0; i < ARRAY_SIZE(et6248brb_i2c_device); i++) + { + ret = platform_device_register(&et6248brb_i2c_device[i]); + if (ret) { + printk(KERN_WARNING "Fail to create i2c device %d\n", i); + goto error_et6248brb_i2c_device; + } + } + + for (j = 0; j < ARRAY_SIZE(et6248brb_gpio_device); j++) + { + ret = platform_device_register(&et6248brb_gpio_device[j]); + if (ret) { + printk(KERN_WARNING "Fail to create i2c device %d\n", j); + goto error_et6248brb_gpio_device; + } + } + + return 0; +error_et6248brb_gpio_device: + j--; + for (; j >= 0; j--) { + platform_device_unregister(&et6248brb_gpio_device[j]); + } +error_et6248brb_i2c_device: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&et6248brb_i2c_device[i]); + } + platform_driver_unregister(&gpio_device_driver); +error_gpio_device_driver: + platform_driver_unregister(&i2c_device_driver); +error_i2c_device_driver: + return ret; +} + +static void __exit delta_et6248brb_platform_exit(void) +{ + int i = 0; + + for ( i = 0; i < ARRAY_SIZE(et6248brb_i2c_device); i++ ) { + platform_device_unregister(&et6248brb_i2c_device[i]); + } + + for ( i = 0; i < ARRAY_SIZE(et6248brb_gpio_device); i++ ) { + platform_device_unregister(&et6248brb_gpio_device[i]); + } + platform_driver_unregister(&i2c_device_driver); + platform_driver_unregister(&gpio_device_driver); + i2c_unregister_device(i2c_client_9547); +} + +module_init(delta_et6248brb_platform_init); +module_exit(delta_et6248brb_platform_exit); + +MODULE_DESCRIPTION("DNI et6248brb Platform Support"); +MODULE_AUTHOR("Jacky Liu "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/dni_gpio.c b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/dni_gpio.c new file mode 100644 index 000000000000..b83ed4e6035f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/dni_gpio.c @@ -0,0 +1,695 @@ +/* + * Intel ICH6-10, Series 5 and 6, Atom C2000 (Avoton/Rangeley) GPIO driver + * + * Copyright (C) 2010 Extreme Engineering Solutions. + * + * 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. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +#include +#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + +#include +#include +#include +#include +#include + +#define DRV_NAME "gpio_ich" + +/* + * GPIO register offsets in GPIO I/O space. + * Each chunk of 32 GPIOs is manipulated via its own USE_SELx, IO_SELx, and + * LVLx registers. Logic in the read/write functions takes a register and + * an absolute bit number and determines the proper register offset and bit + * number in that register. For example, to read the value of GPIO bit 50 + * the code would access offset ichx_regs[2(=GPIO_LVL)][1(=50/32)], + * bit 18 (50%32). + */ +enum GPIO_REG { + GPIO_USE_SEL = 0, + GPIO_IO_SEL, + GPIO_LVL, + GPO_BLINK +}; + +static const u8 ichx_regs[4][3] = { + {0x00, 0x30, 0x40}, /* USE_SEL[1-3] offsets */ + {0x04, 0x34, 0x44}, /* IO_SEL[1-3] offsets */ + {0x0c, 0x38, 0x48}, /* LVL[1-3] offsets */ + {0x18, 0x18, 0x18}, /* BLINK offset */ +}; + +static const u8 ichx_reglen[3] = { + 0x30, 0x10, 0x10, +}; + +static const u8 avoton_regs[4][3] = { + {0x00, 0x80, 0x00}, + {0x04, 0x84, 0x00}, + {0x08, 0x88, 0x00}, +}; + +static const u8 avoton_reglen[3] = { + 0x10, 0x10, 0x00, +}; + +#define ICHX_WRITE(val, reg, base_res) outl(val, (reg) + (base_res)->start) +#define ICHX_READ(reg, base_res) inl((reg) + (base_res)->start) + +struct ichx_desc { + /* Max GPIO pins the chipset can have */ + uint ngpio; + + /* chipset registers */ + const u8 (*regs)[3]; + const u8 *reglen; + + /* GPO_BLINK is available on this chipset */ + bool have_blink; + + /* Whether the chipset has GPIO in GPE0_STS in the PM IO region */ + bool uses_gpe0; + + /* USE_SEL is bogus on some chipsets, eg 3100 */ + u32 use_sel_ignore[3]; + + /* Some chipsets have quirks, let these use their own request/get */ + int (*request)(struct gpio_chip *chip, unsigned offset); + int (*get)(struct gpio_chip *chip, unsigned offset); + + /* + * Some chipsets don't let reading output values on GPIO_LVL register + * this option allows driver caching written output values + */ + bool use_outlvl_cache; +}; + +static struct { + spinlock_t lock; + struct platform_device *dev; + struct gpio_chip chip; + struct resource *gpio_base; /* GPIO IO base */ + struct resource *pm_base; /* Power Mangagment IO base */ + struct ichx_desc *desc; /* Pointer to chipset-specific description */ + u32 orig_gpio_ctrl; /* Orig CTRL value, used to restore on exit */ + u8 use_gpio; /* Which GPIO groups are usable */ + int outlvl_cache[3]; /* cached output values */ +} ichx_priv; + +static int modparam_gpiobase = -1; /* dynamic */ +module_param_named(gpiobase, modparam_gpiobase, int, 0444); +MODULE_PARM_DESC(gpiobase, "The GPIO number base. -1 means dynamic, " + "which is the default."); + +static int ichx_write_bit(int reg, unsigned nr, int val, int verify) +{ + unsigned long flags; + u32 data, tmp; + int reg_nr = nr / 32; + int bit = nr & 0x1f; + int ret = 0; + + spin_lock_irqsave(&ichx_priv.lock, flags); + + if (reg == GPIO_LVL && ichx_priv.desc->use_outlvl_cache) + { + data = ichx_priv.outlvl_cache[reg_nr]; + } + else + { + data = ICHX_READ(ichx_priv.desc->regs[reg][reg_nr], + ichx_priv.gpio_base); + } + if (val) + data |= 1 << bit; + else + data &= ~(1 << bit); + + ICHX_WRITE(data, ichx_priv.desc->regs[reg][reg_nr], + ichx_priv.gpio_base); + if (reg == GPIO_LVL && ichx_priv.desc->use_outlvl_cache) + ichx_priv.outlvl_cache[reg_nr] = data; + + tmp = ICHX_READ(ichx_priv.desc->regs[reg][reg_nr], + ichx_priv.gpio_base); + if (verify && data != tmp) + ret = -EPERM; + + spin_unlock_irqrestore(&ichx_priv.lock, flags); + + return ret; +} + +static int ichx_read_bit(int reg, unsigned nr) +{ + unsigned long flags; + u32 data; + int reg_nr = nr / 32; + int bit = nr & 0x1f; + + spin_lock_irqsave(&ichx_priv.lock, flags); + + data = ICHX_READ(ichx_priv.desc->regs[reg][reg_nr], + ichx_priv.gpio_base); + + if (reg == GPIO_LVL && ichx_priv.desc->use_outlvl_cache) + data = ichx_priv.outlvl_cache[reg_nr] | data; + + spin_unlock_irqrestore(&ichx_priv.lock, flags); + + return data & (1 << bit) ? 1 : 0; +} + +static bool ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr) +{ + return !!(ichx_priv.use_gpio & (1 << (nr / 32))); +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int ichx_gpio_get_direction(struct gpio_chip *gpio, unsigned nr) +{ + return ichx_read_bit(GPIO_IO_SEL, nr) ? GPIOF_DIR_IN : GPIOF_DIR_OUT; +} +#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + +static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) +{ + /* + * Try setting pin as an input and verify it worked since many pins + * are output-only. + */ + if (ichx_write_bit(GPIO_IO_SEL, nr, 1, 1)) + return -EINVAL; + + return 0; +} + +static int ichx_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, + int val) +{ + /* Disable blink hardware which is available for GPIOs from 0 to 31. */ + if (nr < 32 && ichx_priv.desc->have_blink) + ichx_write_bit(GPO_BLINK, nr, 0, 0); + + /* Set GPIO output value. */ + ichx_write_bit(GPIO_LVL, nr, val, 0); + + /* + * Try setting pin as an output and verify it worked since many pins + * are input-only. + */ + if (ichx_write_bit(GPIO_IO_SEL, nr, 0, 1)) + return -EINVAL; + + return 0; +} + +static int ichx_gpio_get(struct gpio_chip *chip, unsigned nr) +{ + return ichx_read_bit(GPIO_LVL, nr); +} + +static int ich6_gpio_get(struct gpio_chip *chip, unsigned nr) +{ + unsigned long flags; + u32 data; + + /* + * GPI 0 - 15 need to be read from the power management registers on + * a ICH6/3100 bridge. + */ + if (nr < 16) { + if (!ichx_priv.pm_base) + return -ENXIO; + + spin_lock_irqsave(&ichx_priv.lock, flags); + + /* GPI 0 - 15 are latched, write 1 to clear*/ + ICHX_WRITE(1 << (16 + nr), 0, ichx_priv.pm_base); + data = ICHX_READ(0, ichx_priv.pm_base); + + spin_unlock_irqrestore(&ichx_priv.lock, flags); + + return (data >> 16) & (1 << nr) ? 1 : 0; + } else { + return ichx_gpio_get(chip, nr); + } +} + +static int ichx_gpio_request(struct gpio_chip *chip, unsigned nr) +{ + if (!ichx_gpio_check_available(chip, nr)) + return -ENXIO; + + /* + * Note we assume the BIOS properly set a bridge's USE value. Some + * chips (eg Intel 3100) have bogus USE values though, so first see if + * the chipset's USE value can be trusted for this specific bit. + * If it can't be trusted, assume that the pin can be used as a GPIO. + */ + if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f))) + return 0; + + return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV; +} + +static int ich6_gpio_request(struct gpio_chip *chip, unsigned nr) +{ + /* + * Fixups for bits 16 and 17 are necessary on the Intel ICH6/3100 + * bridge as they are controlled by USE register bits 0 and 1. See + * "Table 704 GPIO_USE_SEL1 register" in the i3100 datasheet for + * additional info. + */ + if (nr == 16 || nr == 17) + nr -= 16; + + return ichx_gpio_request(chip, nr); +} + +static void ichx_gpio_set(struct gpio_chip *chip, unsigned nr, int val) +{ + ichx_write_bit(GPIO_LVL, nr, val, 0); +} + +static void ichx_gpiolib_setup(struct gpio_chip *chip) +{ + chip->owner = THIS_MODULE; + chip->label = DRV_NAME; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + chip->dev = &ichx_priv.dev->dev; +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + chip->parent = &ichx_priv.dev->dev; + chip->get_direction = ichx_gpio_get_direction; +#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + + /* Allow chip-specific overrides of request()/get() */ + chip->request = ichx_priv.desc->request ? + ichx_priv.desc->request : ichx_gpio_request; + chip->get = ichx_priv.desc->get ? + ichx_priv.desc->get : ichx_gpio_get; + + chip->set = ichx_gpio_set; + chip->direction_input = ichx_gpio_direction_input; + chip->direction_output = ichx_gpio_direction_output; + chip->base = modparam_gpiobase; + chip->ngpio = ichx_priv.desc->ngpio; + chip->can_sleep = false; + chip->dbg_show = NULL; +} + +/* ICH6-based, 631xesb-based */ +static struct ichx_desc ich6_desc = { + /* Bridges using the ICH6 controller need fixups for GPIO 0 - 17 */ + .request = ich6_gpio_request, + .get = ich6_gpio_get, + + /* GPIO 0-15 are read in the GPE0_STS PM register */ + .uses_gpe0 = true, + + .ngpio = 50, + .have_blink = true, + .regs = ichx_regs, + .reglen = ichx_reglen, +}; + +/* Intel 3100 */ +static struct ichx_desc i3100_desc = { + /* + * Bits 16,17, 20 of USE_SEL and bit 16 of USE_SEL2 always read 0 on + * the Intel 3100. See "Table 712. GPIO Summary Table" of 3100 + * Datasheet for more info. + */ + .use_sel_ignore = {0x00130000, 0x00010000, 0x0}, + + /* The 3100 needs fixups for GPIO 0 - 17 */ + .request = ich6_gpio_request, + .get = ich6_gpio_get, + + /* GPIO 0-15 are read in the GPE0_STS PM register */ + .uses_gpe0 = true, + + .ngpio = 50, + .regs = ichx_regs, + .reglen = ichx_reglen, +}; + +/* ICH7 and ICH8-based */ +static struct ichx_desc ich7_desc = { + .ngpio = 50, + .have_blink = true, + .regs = ichx_regs, + .reglen = ichx_reglen, +}; + +/* ICH9-based */ +static struct ichx_desc ich9_desc = { + .ngpio = 61, + .have_blink = true, + .regs = ichx_regs, + .reglen = ichx_reglen, +}; + +/* ICH10-based - Consumer/corporate versions have different amount of GPIO */ +static struct ichx_desc ich10_cons_desc = { + .ngpio = 61, + .have_blink = true, + .regs = ichx_regs, + .reglen = ichx_reglen, +}; +static struct ichx_desc ich10_corp_desc = { + .ngpio = 72, + .have_blink = true, + .regs = ichx_regs, + .reglen = ichx_reglen, +}; + +/* Intel 5 series, 6 series, 3400 series, and C200 series */ +static struct ichx_desc intel5_desc = { + .ngpio = 76, + .regs = ichx_regs, + .reglen = ichx_reglen, +}; + +/* Avoton */ +static struct ichx_desc avoton_desc = { + /* Avoton has only 59 GPIOs, but we assume the first set of register + * (Core) has 32 instead of 31 to keep gpio-ich compliance + */ + .ngpio = 60, + .regs = avoton_regs, + .reglen = avoton_reglen, + .use_outlvl_cache = true, +}; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +static int ichx_gpio_request_regions(struct resource *res_base, + const char *name, u8 use_gpio) +{ + int i; + + if (!res_base || !res_base->start || !res_base->end) + return -ENODEV; + + for (i = 0; i < ARRAY_SIZE(ichx_priv.desc->regs[0]); i++) { + if (!(use_gpio & (1 << i))) + continue; + if (!request_region( + res_base->start + ichx_priv.desc->regs[0][i], + ichx_priv.desc->reglen[i], name)) + goto request_err; + } + return 0; + +request_err: + /* Clean up: release already requested regions, if any */ + for (i--; i >= 0; i--) { + if (!(use_gpio & (1 << i))) + continue; + release_region(res_base->start + ichx_priv.desc->regs[0][i], + ichx_priv.desc->reglen[i]); + } + return -EBUSY; +} + +static void ichx_gpio_release_regions(struct resource *res_base, u8 use_gpio) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(ichx_priv.desc->regs[0]); i++) { + if (!(use_gpio & (1 << i))) + continue; + release_region(res_base->start + ichx_priv.desc->regs[0][i], + ichx_priv.desc->reglen[i]); + } +} + +static int ichx_gpio_probe(struct platform_device *pdev) +{ + struct resource *res_base, *res_pm; + int err; + struct lpc_ich_info *ich_info = dev_get_platdata(&pdev->dev); + + if (!ich_info) + return -ENODEV; + + ichx_priv.dev = pdev; + + switch (ich_info->gpio_version) { + case ICH_I3100_GPIO: + ichx_priv.desc = &i3100_desc; + break; + case ICH_V5_GPIO: + ichx_priv.desc = &intel5_desc; + break; + case ICH_V6_GPIO: + ichx_priv.desc = &ich6_desc; + break; + case ICH_V7_GPIO: + ichx_priv.desc = &ich7_desc; + break; + case ICH_V9_GPIO: + ichx_priv.desc = &ich9_desc; + break; + case ICH_V10CORP_GPIO: + ichx_priv.desc = &ich10_corp_desc; + break; + case ICH_V10CONS_GPIO: + ichx_priv.desc = &ich10_cons_desc; + break; + case AVOTON_GPIO: + ichx_priv.desc = &avoton_desc; + ichx_priv.outlvl_cache[0] = 0x06; /*core output values*/ + ichx_priv.outlvl_cache[1] = 0x7c0008; /*sus output values*/ + ichx_priv.outlvl_cache[2] = 0x0; /*no used*/ + + break; + default: + return -ENODEV; + } + + spin_lock_init(&ichx_priv.lock); + res_base = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPIO); + ichx_priv.use_gpio = ich_info->use_gpio; + err = ichx_gpio_request_regions(res_base, pdev->name, + ichx_priv.use_gpio); + if (err) + return err; + + ichx_priv.gpio_base = res_base; + + /* + * If necessary, determine the I/O address of ACPI/power management + * registers which are needed to read the the GPE0 register for GPI pins + * 0 - 15 on some chipsets. + */ + if (!ichx_priv.desc->uses_gpe0) + goto init; + + res_pm = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPE0); + if (!res_pm) { + pr_warn("ACPI BAR is unavailable, GPI 0 - 15 unavailable\n"); + goto init; + } + + if (!request_region(res_pm->start, resource_size(res_pm), + pdev->name)) { + pr_warn("ACPI BAR is busy, GPI 0 - 15 unavailable\n"); + goto init; + } + + ichx_priv.pm_base = res_pm; + +init: + ichx_gpiolib_setup(&ichx_priv.chip); + err = gpiochip_add(&ichx_priv.chip); + if (err) { + pr_err("Failed to register GPIOs\n"); + goto add_err; + } + + pr_info("GPIO from %d to %d on %s\n", ichx_priv.chip.base, + ichx_priv.chip.base + ichx_priv.chip.ngpio - 1, DRV_NAME); + + return 0; + +add_err: + ichx_gpio_release_regions(ichx_priv.gpio_base, ichx_priv.use_gpio); + if (ichx_priv.pm_base) + release_region(ichx_priv.pm_base->start, + resource_size(ichx_priv.pm_base)); + return err; +} + +static int ichx_gpio_remove(struct platform_device *pdev) +{ + int err; + + err = gpiochip_remove(&ichx_priv.chip); + if (err) { + dev_err(&pdev->dev, "%s failed, %d\n", + "gpiochip_remove()", err); + return err; + } + + ichx_gpio_release_regions(ichx_priv.gpio_base, ichx_priv.use_gpio); + if (ichx_priv.pm_base) + release_region(ichx_priv.pm_base->start, + resource_size(ichx_priv.pm_base)); + + return 0; +} +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int ichx_gpio_request_regions(struct device *dev, + struct resource *res_base, const char *name, u8 use_gpio) +{ + int i; + + if (!res_base || !res_base->start || !res_base->end) + return -ENODEV; + + for (i = 0; i < ARRAY_SIZE(ichx_priv.desc->regs[0]); i++) { + if (!(use_gpio & (1 << i))) + continue; + if (!devm_request_region(dev, + res_base->start + ichx_priv.desc->regs[0][i], + ichx_priv.desc->reglen[i], name)) + return -EBUSY; + } + return 0; +} + +static int ichx_gpio_probe(struct platform_device *pdev) +{ + struct resource *res_base, *res_pm; + int err; + struct lpc_ich_info *ich_info = dev_get_platdata(&pdev->dev); + + if (!ich_info) + return -ENODEV; + + ichx_priv.dev = pdev; + + switch (ich_info->gpio_version) { + case ICH_I3100_GPIO: + ichx_priv.desc = &i3100_desc; + break; + case ICH_V5_GPIO: + ichx_priv.desc = &intel5_desc; + break; + case ICH_V6_GPIO: + ichx_priv.desc = &ich6_desc; + break; + case ICH_V7_GPIO: + ichx_priv.desc = &ich7_desc; + break; + case ICH_V9_GPIO: + ichx_priv.desc = &ich9_desc; + break; + case ICH_V10CORP_GPIO: + ichx_priv.desc = &ich10_corp_desc; + break; + case ICH_V10CONS_GPIO: + ichx_priv.desc = &ich10_cons_desc; + break; + case AVOTON_GPIO: + ichx_priv.desc = &avoton_desc; + ichx_priv.outlvl_cache[0] = 0x06; /*core output values*/ + ichx_priv.outlvl_cache[1] = 0x7c0008; /*sus output values*/ + ichx_priv.outlvl_cache[2] = 0x0; /*no used*/ + break; + default: + return -ENODEV; + } + + spin_lock_init(&ichx_priv.lock); + res_base = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPIO); + ichx_priv.use_gpio = ich_info->use_gpio; + err = ichx_gpio_request_regions(&pdev->dev, res_base, pdev->name, + ichx_priv.use_gpio); + if (err) + return err; + + ichx_priv.gpio_base = res_base; + + /* + * If necessary, determine the I/O address of ACPI/power management + * registers which are needed to read the the GPE0 register for GPI pins + * 0 - 15 on some chipsets. + */ + if (!ichx_priv.desc->uses_gpe0) + goto init; + + res_pm = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPE0); + if (!res_pm) { + pr_warn("ACPI BAR is unavailable, GPI 0 - 15 unavailable\n"); + goto init; + } + + if (!devm_request_region(&pdev->dev, res_pm->start, + resource_size(res_pm), pdev->name)) { + pr_warn("ACPI BAR is busy, GPI 0 - 15 unavailable\n"); + goto init; + } + + ichx_priv.pm_base = res_pm; + +init: + ichx_gpiolib_setup(&ichx_priv.chip); + err = gpiochip_add_data(&ichx_priv.chip, NULL); + if (err) { + pr_err("Failed to register GPIOs\n"); + return err; + } + + pr_info("GPIO from %d to %d on %s\n", ichx_priv.chip.base, + ichx_priv.chip.base + ichx_priv.chip.ngpio - 1, DRV_NAME); + + return 0; +} + +static int ichx_gpio_remove(struct platform_device *pdev) +{ + gpiochip_remove(&ichx_priv.chip); + + return 0; +} +#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + +static struct platform_driver ichx_gpio_driver = { + .driver = { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + .owner = THIS_MODULE, +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + .name = DRV_NAME, + }, + .probe = ichx_gpio_probe, + .remove = ichx_gpio_remove, +}; + +module_platform_driver(ichx_gpio_driver); + +MODULE_AUTHOR("Johnson Lu "); +MODULE_DESCRIPTION("GPIO interface for Intel ICH series"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:"DRV_NAME); diff --git a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/et-6248brb_platform_init.sh b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/et-6248brb_platform_init.sh new file mode 100755 index 000000000000..3779e4684d84 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/et-6248brb_platform_init.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +#platform init script for Delta et-6248brb + +#fan speed monitol start +/usr/share/sonic/device/x86_64-delta_et-6248brb-r0/fancontrol.service /usr/share/sonic/device/x86_64-delta_et-6248brb-r0/fancontrol & +sh /usr/local/bin/led_status.sh & + + +exit 0 + diff --git a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh new file mode 100644 index 000000000000..2ba61bbfecb3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh @@ -0,0 +1,165 @@ +#!/bin/bash + +FAN1_EEPROM="-y 0 0x55 0x0a" +FAN2_EEPROM="-y 0 0x56 0x0a" +FAN1_RPM="/sys/bus/i2c/devices/0-002e/fan1_input" +FAN2_RPM="/sys/bus/i2c/devices/0-002e/fan2_input" +FAN_TRAY1_LED="/sys/devices/platform/delta-et6248brb-gpio.0/FAN/fan1_led_ag" +FAN_TRAY2_LED="/sys/devices/platform/delta-et6248brb-gpio.0/FAN/fan2_led_ag" + +if [ `uname -a | awk '{print $3}'` = "4.9.0-5-amd64" ]; then + SYS_LED_G="/sys/class/gpio/gpio453/value" + SYS_LED_R="/sys/class/gpio/gpio454/value" + PWR_LED_G="/sys/class/gpio/gpio455/value" + PWR_LED_R="/sys/class/gpio/gpio489/value" + FAN_LED_G="/sys/class/gpio/gpio485/value" + FAN_LED_R="/sys/class/gpio/gpio494/value" +else + SYS_LED_G="/sys/class/gpio/gpio197/value" + SYS_LED_R="/sys/class/gpio/gpio198/value" + PWR_LED_G="/sys/class/gpio/gpio199/value" + PWR_LED_R="/sys/class/gpio/gpio233/value" + FAN_LED_G="/sys/class/gpio/gpio229/value" + FAN_LED_R="/sys/class/gpio/gpio238/value" +fi + +PSU1_EEPROM="-y 2 0x50 0x00" +PSU2_EEPROM="-y 3 0x51 0x00" +PSU1_PG="/sys/devices/platform/delta-et6248brb-gpio.0/PSU/psu1_pg" +PSU2_PG="/sys/devices/platform/delta-et6248brb-gpio.0/PSU/psu2_pg" + +catfaneeprom(){ + fan_eeprom_num=0 + i2cget $FAN1_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -ne "0" ]; then + fan_eeprom_num=$((fan_eeprom_num)) + fi + + i2cget $FAN2_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + fan_eeprom_num=$((fan_eeprom_num+1)) + elif [ "`echo $?`" -ne "0" ]; then + fan_eeprom_num=$((fan_eeprom_num_num)) + fi +} + +catfanspeed(){ + + fan_rpm_normal_num=0 + fan1_rpm_normal_num=0 + fan1_rpm=`cat $FAN1_RPM` + + if [ "${fan1_rpm}" -ne "960" ] && [ "${fan1_rpm}" -ne "0" ]; then + fan1_rpm_normal_num=$((fan1_rpm_normal_num+1)) + elif [ "${fan1_rpm}" -eq "960" ] || [ "${fan1_rpm}" -eq "0" ]; then + fan1_rpm_normal_num=$((fan1_rpm_normal_num)) + fi + + fan2_rpm_normal_num=0 + fan2_rpm=`cat $FAN2_RPM` + + if [ "${fan2_rpm}" -ne "960" ] && [ "${fan2_rpm}" -ne "0" ]; then + fan2_rpm_normal_num=$((fan2_rpm_normal_num+1)) + elif [ "${fan2_rpm}" -eq "960" ] || [ "${fan2_rpm}" -eq "0" ]; then + fan2_rpm_normal_num=$((fan2_rpm_normal_num)) + fi + + fan_rpm_normal_num=$((fan1_rpm_normal_num+fan2_rpm_normal_num)) +} + +setfanled(){ + if [ "${fan_eeprom_num}" -eq "2" ] && [ "${fan_rpm_normal_num}" -eq "2" ]; then + echo "1" > $FAN_LED_G + echo "0" > $FAN_LED_R + elif [ "${fan_eeprom_num}" -lt "2" ] || [ "${fan_rpm_normal_num}" -lt "2" ]; then + echo "1" > $FAN_LED_R + echo "0" > $FAN_LED_G + fi +} + +setfantrayled(){ + if [ "${fan1_rpm_normal_num}" -eq "1" ]; then + echo "0x02" > $FAN_TRAY1_LED + else + echo "0x01" > $FAN_TRAY1_LED + fi + + if [ "${fan2_rpm_normal_num}" -eq "1" ]; then + echo "0x02" > $FAN_TRAY2_LED + else + echo "0x01" > $FAN_TRAY2_LED + fi +} + +catpsueeprom(){ + psu_eeprom_num=0 + i2cget $PSU1_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + psu_eeprom_num=$((psu_eeprom_num+1)) + elif [ "`echo $?`" -ne "0" ]; then + psu_eeprom_num=$((psu_eeprom_num)) + fi + + i2cget $PSU2_EEPROM > /dev/null 2>&1 + if [ "`echo $?`" -eq "0" ]; then + psu_eeprom_num=$((psu_eeprom_num+1)) + elif [ "`echo $?`" -ne "0" ]; then + psu_eeprom_num=$((psu_eeprom_num)) + fi +} + +catpsupowergood(){ + + psu_normal_num=0 + psu1_normal_num=0 + psu1_good=`cat $PSU1_PG | head -n 1` + + if [ "${psu1_good}" -eq "1" ]; then + psu1_normal_num=$((psu1_normal_num+1)) + elif [ "${psu1_good}" -eq "0" ]; then + psu1_normal_num=$((psu1_normal_num)) + fi + + psu2_normal_num=0 + psu2_good=`cat $PSU2_PG | head -n 1` + + if [ "${psu2_good}" -eq "1" ]; then + psu2_normal_num=$((psu2_normal_num+1)) + elif [ "${psu2_good}" -eq "0" ]; then + psu2_normal_num=$((psu2_normal_num)) + fi + + psu_normal_num=$((psu1_normal_num+psu2_normal_num)) +} + +setpsuled(){ + if [ "${psu_eeprom_num}" -eq "2" ] && [ "${psu_normal_num}" -eq "2" ]; then + echo "1" > $PWR_LED_G + echo "0" > $PWR_LED_R + elif [ "${psu_eeprom_num}" -lt "2" ] || [ "${psu_normal_num}" -lt "2" ]; then + echo "1" > $PWR_LED_R + echo "0" > $PWR_LED_G + fi +} + +platformstatus(){ + echo "1" > $SYS_LED_G + echo "0" > $SYS_LED_R + catfaneeprom + catfanspeed + setfanled + setfantrayled + + catpsueeprom + catpsupowergood + setpsuled +} + +while true +do + platformstatus + sleep 1 +done + diff --git a/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag5648.service b/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag5648.service new file mode 100644 index 000000000000..7a74c0155473 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-ag5648.service @@ -0,0 +1,13 @@ +[Unit] +Description=Delta ag5648 Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-ag5648 start +ExecStop=-/etc/init.d/platform-modules-ag5648 stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-et-6248brb.service b/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-et-6248brb.service new file mode 100644 index 000000000000..901bcffaea8e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/systemd/platform-modules-et-6248brb.service @@ -0,0 +1,13 @@ +[Unit] +Description=Delta et-6248brb Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-et-6248brb start +ExecStop=-/etc/init.d/platform-modules-et-6248brb stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target From ecfca8bf230bf5843d6988a16a573f2976abe46e Mon Sep 17 00:00:00 2001 From: paavaanan Date: Fri, 22 Jun 2018 23:18:44 +0530 Subject: [PATCH 1511/1833] [devices]: DellEMC new platform support for z9264f - 64x100 (#26) * Added new platform support DellEMC - Z92264f - 64x100 * Includes changes with Makefiles, sfputil, eeprom and default minigraph * Led support for Z9264f platform * Includes changes on default minigraph * ipmitool implementation in pmon docker. platform_sensors script is inclued in pmon startup --- .../DellEMC-Z9264f/port_config.ini | 65 + .../DellEMC-Z9264f/sai.profile | 1 + .../installer.conf | 3 + .../led_proc_init.soc | 111 ++ .../minigraph.xml | 1541 +++++++++++++++++ .../plugins/eeprom.py | 22 + .../plugins/psuutil.py | 97 ++ .../plugins/sfputil.py | 192 ++ dockers/docker-platform-monitor/Dockerfile.j2 | 2 +- files/build_templates/docker_image_ctl.j2 | 11 + platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-dell.mk | 9 +- platform/broadcom/sonic-platform-modules-dell | 2 +- 13 files changed, 2054 insertions(+), 3 deletions(-) create mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/port_config.ini create mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/sai.profile create mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf create mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/led_proc_init.soc create mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/minigraph.xml create mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/eeprom.py create mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/psuutil.py create mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/port_config.ini b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/port_config.ini new file mode 100644 index 000000000000..2ae02b21b49c --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias index +Ethernet0 49,50,51,52 hundredGigE1/1 0 +Ethernet4 53,54,55,56 hundredGigE1/2 1 +Ethernet8 65,66,67,68 hundredGigE1/3 2 +Ethernet12 69,70,71,72 hundredGigE1/4 3 +Ethernet16 81,82,83,84 hundredGigE1/5 4 +Ethernet20 85,86,87,88 hundredGigE1/6 5 +Ethernet24 97,98,99,100 hundredGigE1/7 6 +Ethernet28 101,102,103,104 hundredGigE1/8 7 +Ethernet32 1,2,3,4 hundredGigE1/9 8 +Ethernet36 5,6,7,8 hundredGigE1/10 9 +Ethernet40 17,18,19,20 hundredGigE1/11 10 +Ethernet44 21,22,23,24 hundredGigE1/12 11 +Ethernet48 33,34,35,36 hundredGigE1/13 12 +Ethernet52 37,38,39,40 hundredGigE1/14 13 +Ethernet56 113,114,115,116 hundredGigE1/15 14 +Ethernet60 117,118,119,120 hundredGigE1/16 15 +Ethernet64 133,134,135,136 hundredGigE1/17 16 +Ethernet68 129,130,131,132 hundredGigE1/18 17 +Ethernet72 213,214,215,216 hundredGigE1/19 18 +Ethernet76 209,210,211,212 hundredGigE1/20 19 +Ethernet80 229,230,231,232 hundredGigE1/21 20 +Ethernet84 225,226,227,228 hundredGigE1/22 21 +Ethernet88 245,246,247,248 hundredGigE1/23 22 +Ethernet92 241,242,243,244 hundredGigE1/24 23 +Ethernet96 149,150,151,152 hundredGigE1/25 24 +Ethernet100 145,146,147,148 hundredGigE1/26 25 +Ethernet104 165,166,167,168 hundredGigE1/27 26 +Ethernet108 161,162,163,164 hundredGigE1/28 27 +Ethernet112 181,182,183,184 hundredGigE1/29 28 +Ethernet116 177,178,179,180 hundredGigE1/30 29 +Ethernet120 197,198,199,200 hundredGigE1/31 30 +Ethernet124 193,194,195,196 hundredGigE1/32 31 +Ethernet128 61,62,63,64 hundredGigE1/33 32 +Ethernet132 57,58,59,60 hundredGigE1/34 33 +Ethernet136 77,78,79,80 hundredGigE1/35 34 +Ethernet140 73,74,75,76 hundredGigE1/36 35 +Ethernet144 93,94,95,96 hundredGigE1/37 36 +Ethernet148 89,90,91,92 hundredGigE1/38 37 +Ethernet152 109,110,111,112 hundredGigE1/39 38 +Ethernet156 105,106,107,108 hundredGigE1/40 39 +Ethernet160 13,14,15,16 hundredGigE1/41 40 +Ethernet164 9,10,11,12 hundredGigE1/42 41 +Ethernet168 29,30,31,32 hundredGigE1/43 42 +Ethernet172 25,26,27,28 hundredGigE1/44 43 +Ethernet176 45,46,47,48 hundredGigE1/45 44 +Ethernet180 41,42,43,44 hundredGigE1/46 45 +Ethernet184 125,126,127,128 hundredGigE1/47 46 +Ethernet188 121,122,123,124 hundredGigE1/48 47 +Ethernet192 137,138,139,140 hundredGigE1/49 48 +Ethernet196 141,142,143,144 hundredGigE1/50 49 +Ethernet200 217,218,219,220 hundredGigE1/51 50 +Ethernet204 221,222,223,224 hundredGigE1/52 51 +Ethernet208 233,234,235,236 hundredGigE1/53 52 +Ethernet212 237,238,239,240 hundredGigE1/54 53 +Ethernet216 249,250,251,252 hundredGigE1/55 54 +Ethernet220 253,254,255,256 hundredGigE1/56 55 +Ethernet224 153,154,155,156 hundredGigE1/57 56 +Ethernet228 157,158,159,160 hundredGigE1/58 57 +Ethernet232 169,170,171,172 hundredGigE1/59 58 +Ethernet236 173,174,175,176 hundredGigE1/60 59 +Ethernet240 185,186,187,188 hundredGigE1/61 60 +Ethernet244 189,190,191,192 hundredGigE1/62 61 +Ethernet248 201,202,203,204 hundredGigE1/63 62 +Ethernet252 205,206,207,208 hundredGigE1/64 63 diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/sai.profile b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/sai.profile new file mode 100644 index 000000000000..a1755e764616 --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/etc/bcm/th2-z9264f-64x100G.config.bcm diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf b/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/led_proc_init.soc b/device/dell/x86_64-dellemc_z9264f_c3538-r0/led_proc_init.soc new file mode 100644 index 000000000000..d38282b6508e --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/led_proc_init.soc @@ -0,0 +1,111 @@ +# LED microprocessor initialization for DellEMC-Z9264f + +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=32 REMAP_PORT_2=33 REMAP_PORT_1=34 REMAP_PORT_0=35 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=36 REMAP_PORT_6=37 REMAP_PORT_5=38 REMAP_PORT_4=39 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=4 REMAP_PORT_10=5 REMAP_PORT_9=6 REMAP_PORT_8=7 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=0 REMAP_PORT_14=1 REMAP_PORT_13=2 REMAP_PORT_12=3 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=56 REMAP_PORT_18=57 REMAP_PORT_17=58 REMAP_PORT_16=59 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=60 REMAP_PORT_22=61 REMAP_PORT_21=62 REMAP_PORT_20=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=28 REMAP_PORT_26=29 REMAP_PORT_25=30 REMAP_PORT_24=31 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=24 REMAP_PORT_30=25 REMAP_PORT_29=26 REMAP_PORT_28=27 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=48 REMAP_PORT_34=49 REMAP_PORT_33=50 REMAP_PORT_32=51 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=52 REMAP_PORT_38=53 REMAP_PORT_37=54 REMAP_PORT_36=55 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=20 REMAP_PORT_42=21 REMAP_PORT_41=22 REMAP_PORT_40=23 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=16 REMAP_PORT_46=17 REMAP_PORT_45=18 REMAP_PORT_44=19 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=40 REMAP_PORT_50=41 REMAP_PORT_49=42 REMAP_PORT_48=43 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=44 REMAP_PORT_54=45 REMAP_PORT_53=46 REMAP_PORT_52=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=12 REMAP_PORT_58=13 REMAP_PORT_57=14 REMAP_PORT_56=15 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=8 REMAP_PORT_62=9 REMAP_PORT_61=10 REMAP_PORT_60=11 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 REMAP_PORT_2=1 REMAP_PORT_1=2 REMAP_PORT_0=3 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 REMAP_PORT_6=5 REMAP_PORT_5=6 REMAP_PORT_4=7 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=38 REMAP_PORT_8=39 REMAP_PORT_11=36 REMAP_PORT_10=37 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=32 REMAP_PORT_14=33 REMAP_PORT_13=34 REMAP_PORT_12=35 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=8 REMAP_PORT_18=9 REMAP_PORT_17=10 REMAP_PORT_16=11 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=12 REMAP_PORT_22=13 REMAP_PORT_21=14 REMAP_PORT_20=15 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=44 REMAP_PORT_26=45 REMAP_PORT_25=46 REMAP_PORT_24=47 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=40 REMAP_PORT_30=41 REMAP_PORT_29=42 REMAP_PORT_28=43 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 REMAP_PORT_34=17 REMAP_PORT_33=18 REMAP_PORT_32=19 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 REMAP_PORT_38=21 REMAP_PORT_37=22 REMAP_PORT_36=23 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=52 REMAP_PORT_42=53 REMAP_PORT_41=54 REMAP_PORT_40=55 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=48 REMAP_PORT_46=49 REMAP_PORT_45=50 REMAP_PORT_44=51 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=24 REMAP_PORT_50=25 REMAP_PORT_49=26 REMAP_PORT_48=27 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=28 REMAP_PORT_54=29 REMAP_PORT_53=30 REMAP_PORT_52=31 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=60 REMAP_PORT_58=61 REMAP_PORT_57=62 REMAP_PORT_56=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=56 REMAP_PORT_62=57 REMAP_PORT_61=58 REMAP_PORT_60=59 +m CMIC_LEDUP2_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=60 REMAP_PORT_2=61 REMAP_PORT_1=62 REMAP_PORT_0=63 +m CMIC_LEDUP2_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=56 REMAP_PORT_6=57 REMAP_PORT_5=58 REMAP_PORT_4=59 +m CMIC_LEDUP2_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=24 REMAP_PORT_10=25 REMAP_PORT_9=26 REMAP_PORT_8=27 +m CMIC_LEDUP2_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=28 REMAP_PORT_14=29 REMAP_PORT_13=30 REMAP_PORT_12=31 +m CMIC_LEDUP2_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=52 REMAP_PORT_18=53 REMAP_PORT_17=54 REMAP_PORT_16=55 +m CMIC_LEDUP2_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=48 REMAP_PORT_22=49 REMAP_PORT_21=50 REMAP_PORT_20=51 +m CMIC_LEDUP2_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=16 REMAP_PORT_26=17 REMAP_PORT_25=18 REMAP_PORT_24=19 +m CMIC_LEDUP2_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=20 REMAP_PORT_30=21 REMAP_PORT_29=22 REMAP_PORT_28=23 +m CMIC_LEDUP2_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=44 REMAP_PORT_34=45 REMAP_PORT_33=46 REMAP_PORT_32=47 +m CMIC_LEDUP2_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=40 REMAP_PORT_38=41 REMAP_PORT_37=42 REMAP_PORT_36=43 +m CMIC_LEDUP2_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=8 REMAP_PORT_42=9 REMAP_PORT_41=10 REMAP_PORT_40=11 +m CMIC_LEDUP2_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=12 REMAP_PORT_46=13 REMAP_PORT_45=14 REMAP_PORT_44=15 +m CMIC_LEDUP2_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=36 REMAP_PORT_50=37 REMAP_PORT_49=38 REMAP_PORT_48=39 +m CMIC_LEDUP2_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=32 REMAP_PORT_54=33 REMAP_PORT_53=34 REMAP_PORT_52=35 +m CMIC_LEDUP2_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=0 REMAP_PORT_58=1 REMAP_PORT_57=2 REMAP_PORT_56=3 +m CMIC_LEDUP2_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=4 REMAP_PORT_62=5 REMAP_PORT_61=6 REMAP_PORT_60=7 +m CMIC_LEDUP3_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=28 REMAP_PORT_2=29 REMAP_PORT_1=30 REMAP_PORT_0=31 +m CMIC_LEDUP3_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=24 REMAP_PORT_6=25 REMAP_PORT_5=26 REMAP_PORT_4=27 +m CMIC_LEDUP3_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 REMAP_PORT_10=57 REMAP_PORT_9=58 REMAP_PORT_8=59 +m CMIC_LEDUP3_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 REMAP_PORT_14=61 REMAP_PORT_13=62 REMAP_PORT_12=63 +m CMIC_LEDUP3_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=4 REMAP_PORT_18=5 REMAP_PORT_17=6 REMAP_PORT_16=7 +m CMIC_LEDUP3_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=0 REMAP_PORT_22=1 REMAP_PORT_21=2 REMAP_PORT_20=3 +m CMIC_LEDUP3_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=32 REMAP_PORT_26=33 REMAP_PORT_25=34 REMAP_PORT_24=35 +m CMIC_LEDUP3_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=36 REMAP_PORT_30=37 REMAP_PORT_29=38 REMAP_PORT_28=39 +m CMIC_LEDUP3_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=12 REMAP_PORT_34=13 REMAP_PORT_33=14 REMAP_PORT_32=15 +m CMIC_LEDUP3_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=8 REMAP_PORT_38=9 REMAP_PORT_37=10 REMAP_PORT_36=11 +m CMIC_LEDUP3_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=40 REMAP_PORT_42=41 REMAP_PORT_41=42 REMAP_PORT_40=43 +m CMIC_LEDUP3_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=44 REMAP_PORT_46=45 REMAP_PORT_45=46 REMAP_PORT_44=47 +m CMIC_LEDUP3_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=20 REMAP_PORT_50=21 REMAP_PORT_49=22 REMAP_PORT_48=23 +m CMIC_LEDUP3_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=16 REMAP_PORT_54=17 REMAP_PORT_53=18 REMAP_PORT_52=19 +m CMIC_LEDUP3_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=48 REMAP_PORT_58=49 REMAP_PORT_57=50 REMAP_PORT_56=51 +m CMIC_LEDUP3_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=52 REMAP_PORT_62=53 REMAP_PORT_61=54 REMAP_PORT_60=55 +m CMIC_LEDUP4_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=1 REMAP_PORT_1=0 + +led 0 stop +led 0 prog \ + 02 00 60 FE 2E FE 67 1C 86 FE 06 FE D2 40 71 04 \ + 12 FF 85 05 D2 05 71 1A 52 00 3A 80 32 08 97 71 \ + 23 77 4B 32 00 32 01 B7 97 75 32 12 BC FE FE 02 \ + 0A 50 12 BC FE FE 95 75 3C 85 77 44 16 FF DA 02 \ + 71 4B 77 44 22 0F 87 22 0E 87 57 22 0E 87 22 0E \ + 87 57 22 0E 87 22 0F 87 57 00 00 00 00 00 00 00 +led 0 auto on +led 0 start + +led 1 stop +led 1 prog \ + 02 00 60 FE 2E FE 67 1C 86 FE 06 FE D2 40 71 04 \ + 12 FF 85 05 D2 05 71 1A 52 00 3A 80 32 08 97 71 \ + 23 77 4B 32 00 32 01 B7 97 75 32 12 BC FE FE 02 \ + 0A 50 12 BC FE FE 95 75 3C 85 77 44 16 FF DA 02 \ + 71 4B 77 44 22 0F 87 22 0E 87 57 22 0E 87 22 0E \ + 87 57 22 0E 87 22 0F 87 57 00 00 00 00 00 00 00 +led 1 auto on +led 1 start + +led 2 stop +led 2 prog \ + 02 00 60 FE 2E FE 67 1C 86 FE 06 FE D2 40 71 04 \ + 12 FF 85 05 D2 05 71 1A 52 00 3A 80 32 08 97 71 \ + 23 77 4B 32 00 32 01 B7 97 75 32 12 BC FE FE 02 \ + 0A 50 12 BC FE FE 95 75 3C 85 77 44 16 FF DA 02 \ + 71 4B 77 44 22 0F 87 22 0E 87 57 22 0E 87 22 0E \ + 87 57 22 0E 87 22 0F 87 57 00 00 00 00 00 00 00 +led 2 auto on +led 2 start + +led 3 stop +led 3 prog \ + 02 00 60 FE 2E FE 67 1C 86 FE 06 FE D2 40 71 04 \ + 12 FF 85 05 D2 05 71 1A 52 00 3A 80 32 08 97 71 \ + 23 77 4B 32 00 32 01 B7 97 75 32 12 BC FE FE 02 \ + 0A 50 12 BC FE FE 95 75 3C 85 77 44 16 FF DA 02 \ + 71 4B 77 44 22 0F 87 22 0E 87 57 22 0E 87 22 0E \ + 87 57 22 0E 87 22 0F 87 57 00 00 00 00 00 00 00 +led 3 auto on +led 3 start diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/minigraph.xml b/device/dell/x86_64-dellemc_z9264f_c3538-r0/minigraph.xml new file mode 100644 index 000000000000..ba95944260df --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/minigraph.xml @@ -0,0 +1,1541 @@ + + + + + + ARISTA01T0 + 10.0.0.33 + sonic + 10.0.0.32 + 1 + 10 + 3 + + + ARISTA01T0 + FC00::42 + sonic + FC00::41 + 1 + 10 + 3 + + + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 10 + 3 + + + sonic + FC00::1 + ARISTA01T2 + FC00::2 + 1 + 10 + 3 + + + ARISTA02T0 + 10.0.0.35 + sonic + 10.0.0.34 + 1 + 10 + 3 + + + ARISTA02T0 + FC00::46 + sonic + FC00::45 + 1 + 10 + 3 + + + sonic + 10.0.0.2 + ARISTA02T2 + 10.0.0.3 + 1 + 10 + 3 + + + ARISTA04T1 + FC00::1A + sonic + FC00::19 + 1 + 180 + 60 + + + + + 65100 + sonic + + +
10.0.0.33
+ + +
+ +
10.0.0.1
+ + +
+ + BGPPeer +
10.0.0.5
+ + +
+ + BGPPeer +
10.0.0.9
+ + +
+ + BGPPeer +
10.0.0.13
+ + +
+ + BGPPeer +
FC00::2
+ + +
+ +
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 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + + + + sonic + + + + + IPInterface + + hundredGigE1/1 + 10.0.0.1/31 + + + + hundredGigE1/1 + FC00::1/1 + + + + hundredGigE1/2 + 10.0.0.3/31 + + + + hundredGigE1/1 + FC00::1/5 + + + + hundredGigE1/3 + 10.0.0.5/31 + + + + hundredGigE1/1 + FC00::1/9 + + + + hundredGigE1/4 + 10.0.0.7/31 + + + + hundredGigE1/1 + FC00::1/D + + + + hundredGigE1/5 + 10.0.0.9/31 + + + + hundredGigE1/1 + FC00::1/11 + + + + hundredGigE1/6 + 10.0.0.11/31 + + + + hundredGigE1/1 + FC00::1/15 + + + + hundredGigE1/7 + 10.0.0.13/31 + + + + hundredGigE1/1 + FC00::1/19 + + + + hundredGigE1/8 + 10.0.0.15/31 + + + + hundredGigE1/1 + FC00::1/1D + + + + hundredGigE1/9 + 10.0.0.17/31 + + + + hundredGigE1/1 + FC00::1/21 + + + + hundredGigE1/10 + 10.0.0.19/31 + + + + hundredGigE1/1 + FC00::1/25 + + + + hundredGigE1/11 + 10.0.0.21/31 + + + + hundredGigE1/1 + FC00::1/29 + + + + hundredGigE1/12 + 10.0.0.23/31 + + + + hundredGigE1/1 + FC00::1/2D + + + + hundredGigE1/13 + 10.0.0.25/31 + + + + hundredGigE1/1 + FC00::1/31 + + + + hundredGigE1/14 + 10.0.0.27/31 + + + + hundredGigE1/1 + FC00::1/35 + + + + hundredGigE1/15 + 10.0.0.29/31 + + + + hundredGigE1/1 + FC00::1/39 + + + + hundredGigE1/16 + 10.0.0.31/31 + + + + hundredGigE1/1 + FC00::1/3D + + + + hundredGigE1/17 + 10.0.0.33/31 + + + + hundredGigE1/1 + FC00::1/41 + + + + hundredGigE1/18 + 10.0.0.35/31 + + + + hundredGigE1/1 + FC00::1/45 + + + + hundredGigE1/19 + 10.0.0.37/31 + + + + hundredGigE1/1 + FC00::1/49 + + + + hundredGigE1/20 + 10.0.0.39/31 + + + + hundredGigE1/1 + FC00::1/4D + + + + hundredGigE1/21 + 10.0.0.41/31 + + + + hundredGigE1/1 + FC00::1/51 + + + + hundredGigE1/22 + 10.0.0.43/31 + + + + hundredGigE1/1 + FC00::1/55 + + + + hundredGigE1/23 + 10.0.0.45/31 + + + + hundredGigE1/1 + FC00::1/59 + + + + hundredGigE1/24 + 10.0.0.47/31 + + + + hundredGigE1/1 + FC00::1/5D + + + + hundredGigE1/25 + 10.0.0.49/31 + + + + hundredGigE1/1 + FC00::1/61 + + + + hundredGigE1/26 + 10.0.0.51/31 + + + + hundredGigE1/1 + FC00::1/65 + + + + hundredGigE1/27 + 10.0.0.53/31 + + + + hundredGigE1/1 + FC00::1/69 + + + + hundredGigE1/28 + 10.0.0.55/31 + + + + hundredGigE1/1 + FC00::1/6D + + + + hundredGigE1/29 + 10.0.0.57/31 + + + + hundredGigE1/1 + FC00::1/71 + + + + hundredGigE1/30 + 10.0.0.59/31 + + + + hundredGigE1/1 + FC00::1/75 + + + IPInterface + + hundredGigE1/31 + 10.0.0.61/31 + + + + hundredGigE1/1 + FC00::1/79 + + + IPInterface + + hundredGigE1/32 + 10.0.0.63/31 + + + + hundredGigE1/1 + FC00::1/7D + + + IPInterface + + hundredGigE1/33 + 10.0.0.65/31 + + + + hundredGigE1/1 + FC00::1/81 + + + + hundredGigE1/34 + 10.0.0.67/31 + + + + hundredGigE1/1 + FC00::1/85 + + + IPInterface + + hundredGigE1/35 + 10.0.0.69/31 + + + + hundredGigE1/1 + FC00::1/89 + + + IPInterface + + hundredGigE1/36 + 10.0.0.71/31 + + + + hundredGigE1/1 + FC00::1/8D + + + IPInterface + + hundredGigE1/37 + 10.0.0.73/31 + + + + hundredGigE1/1 + FC00::1/91 + + + + hundredGigE1/38 + 10.0.0.75/31 + + + + hundredGigE1/1 + FC00::1/95 + + + + hundredGigE1/39 + 10.0.0.77/31 + + + + hundredGigE1/1 + FC00::1/99 + + + + hundredGigE1/40 + 10.0.0.79/31 + + + + hundredGigE1/1 + FC00::1/9D + + + + hundredGigE1/41 + 10.0.0.81/31 + + + + hundredGigE1/1 + FC00::1/A1 + + + + hundredGigE1/42 + 10.0.0.83/31 + + + + hundredGigE1/1 + FC00::1/A5 + + + + hundredGigE1/43 + 10.0.0.85/31 + + + + hundredGigE1/1 + FC00::1/A9 + + + + hundredGigE1/44 + 10.0.0.87/31 + + + + hundredGigE1/1 + FC00::1/AD + + + + hundredGigE1/45 + 10.0.0.89/31 + + + + hundredGigE1/1 + FC00::1/B1 + + + + hundredGigE1/46 + 10.0.0.91/31 + + + + hundredGigE1/1 + FC00::1/B5 + + + + hundredGigE1/47 + 10.0.0.93/31 + + + + hundredGigE1/1 + FC00::1/B9 + + + + hundredGigE1/48 + 10.0.0.95/31 + + + + hundredGigE1/1 + FC00::1/BD + + + + hundredGigE1/49 + 10.0.0.97/31 + + + + hundredGigE1/1 + FC00::1/C1 + + + + hundredGigE1/50 + 10.0.0.99/31 + + + + hundredGigE1/1 + FC00::1/C5 + + + + hundredGigE1/51 + 10.0.0.101/31 + + + + hundredGigE1/1 + FC00::1/C9 + + + + hundredGigE1/52 + 10.0.0.103/31 + + + + hundredGigE1/1 + FC00::1/CD + + + + hundredGigE1/53 + 10.0.0.105/31 + + + + hundredGigE1/1 + FC00::1/D1 + + + + hundredGigE1/54 + 10.0.0.107/31 + + + + hundredGigE1/1 + FC00::1/D5 + + + + hundredGigE1/55 + 10.0.0.109/31 + + + + hundredGigE1/1 + FC00::1/D9 + + + + hundredGigE1/56 + 10.0.0.111/31 + + + + hundredGigE1/1 + FC00::1/DD + + + + hundredGigE1/57 + 10.0.0.113/31 + + + + hundredGigE1/1 + FC00::1/E1 + + + + hundredGigE1/58 + 10.0.0.115/31 + + + + hundredGigE1/1 + FC00::1/E5 + + + + hundredGigE1/59 + 10.0.0.117/31 + + + + hundredGigE1/1 + FC00::1/E9 + + + + hundredGigE1/60 + 10.0.0.119/31 + + + + hundredGigE1/1 + FC00::1/ED + + + + hundredGigE1/61 + 10.0.0.121/31 + + + + hundredGigE1/1 + FC00::1/F1 + + + + hundredGigE1/62 + 10.0.0.123/31 + + + + hundredGigE1/1 + FC00::1/F5 + + + + hundredGigE1/63 + 10.0.0.125/31 + + + + hundredGigE1/1 + FC00::1/F9 + + + + hundredGigE1/64 + 10.0.0.127/31 + + + + hundredGigE1/1 + FC00::1/FD + + + + + + + + + + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet1 + true + sonic + hundredGigE1/1 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet2 + true + sonic + hundredGigE1/2 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet3 + true + sonic + hundredGigE1/3 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet4 + true + sonic + hundredGigE1/4 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet5 + true + sonic + hundredGigE1/5 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet6 + true + sonic + hundredGigE1/6 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet7 + true + sonic + hundredGigE1/7 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet8 + true + sonic + hundredGigE1/8 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet9 + true + sonic + hundredGigE1/9 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet10 + true + sonic + hundredGigE1/10 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet11 + true + sonic + hundredGigE1/11 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet12 + true + sonic + hundredGigE1/12 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet13 + true + sonic + hundredGigE1/13 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet14 + true + sonic + hundredGigE1/14 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet15 + true + sonic + hundredGigE1/15 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet16 + true + sonic + hundredGigE1/16 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet17 + true + sonic + hundredGigE1/17 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet18 + true + sonic + hundredGigE1/18 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet19 + true + sonic + hundredGigE1/19 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet20 + true + sonic + hundredGigE1/20 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet21 + true + sonic + hundredGigE1/21 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet22 + true + sonic + hundredGigE1/22 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet23 + true + sonic + hundredGigE1/23 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet24 + true + sonic + hundredGigE1/24 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet25 + true + sonic + hundredGigE1/25 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet26 + true + sonic + hundredGigE1/26 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet27 + true + sonic + hundredGigE1/27 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet28 + true + sonic + hundredGigE1/28 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet29 + true + sonic + hundredGigE1/29 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet30 + true + sonic + hundredGigE1/30 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet31 + true + sonic + hundredGigE1/31 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet32 + true + sonic + hundredGigE1/32 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet33 + true + sonic + hundredGigE1/33 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet34 + true + sonic + hundredGigE1/34 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet35 + true + sonic + hundredGigE1/35 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet36 + true + sonic + hundredGigE1/36 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet37 + true + sonic + hundredGigE1/37 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet38 + true + sonic + hundredGigE1/38 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet39 + true + sonic + hundredGigE1/39 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet40 + true + sonic + hundredGigE1/40 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet41 + true + sonic + hundredGigE1/41 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet42 + true + sonic + hundredGigE1/42 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet43 + true + sonic + hundredGigE1/43 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet44 + true + sonic + hundredGigE1/44 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet45 + true + sonic + hundredGigE1/45 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet46 + true + sonic + hundredGigE1/46 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet47 + true + sonic + hundredGigE1/47 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet48 + true + sonic + hundredGigE1/48 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet49 + true + sonic + hundredGigE1/49 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet50 + true + sonic + hundredGigE1/50 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet51 + true + sonic + hundredGigE1/51 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet52 + true + sonic + hundredGigE1/52 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet53 + true + sonic + hundredGigE1/53 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet54 + true + sonic + hundredGigE1/54 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet55 + true + sonic + hundredGigE1/55 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet56 + true + sonic + hundredGigE1/56 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet57 + true + sonic + hundredGigE1/57 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet58 + true + sonic + hundredGigE1/58 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet59 + true + sonic + hundredGigE1/59 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet60 + true + sonic + hundredGigE1/60 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet61 + true + sonic + hundredGigE1/61 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet62 + true + sonic + hundredGigE1/62 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet63 + true + sonic + hundredGigE1/63 + + + DeviceInterfaceLink + true + 100000 + ARISTA01T1 + Ethernet64 + true + sonic + hundredGigE1/64 + + + + + sonic + DellEMC-Z9264f + + 10.11.150.26 + + + + + + + + sonic + + + DhcpResources + + + + + SnmpResources + + 10.0.0.9 + + + SyslogResources + + 10.0.0.5;10.0.0.6 + + + ErspanDestinationIpv4 + + 10.0.0.7 + + + + + + + sonic + DellEMC-Z9264f +
diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/eeprom.py b/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/eeprom.py new file mode 100644 index 000000000000..37ce00a0ca6c --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# DellEMC Z9264f +# +# 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-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/psuutil.py new file mode 100644 index 000000000000..d3fe5cf64240 --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/psuutil.py @@ -0,0 +1,97 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path +import logging +import commands + + +Z9264F_MAX_PSUS = 2 +IPMI_SENSOR_DATA = "ipmitool sdr list" +PSU_PRESENCE = "PSU{0}_state" +# Use this for older firmware +# PSU_PRESENCE="PSU{0}_prsnt" +ipmi_sdr_list = "" + + +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) + + # Fetch a BMC register + def get_pmc_register(self, reg_name): + + status = 1 + global ipmi_sdr_list + ipmi_dev_node = "/dev/pmi0" + + ipmi_cmd = IPMI_SENSOR_DATA + status, ipmi_sdr_list = commands.getstatusoutput(ipmi_cmd) + + if status: + logging.error('Failed to execute:' + ipmi_sdr_list) + sys.exit(0) + + for item in ipmi_sdr_list.split("\n"): + if reg_name in item: + output = item.strip() + + if not output: + print('\nFailed to fetch: ' + reg_name + ' sensor ') + sys.exit(0) + + output = output.split('|')[1] + + logging.basicConfig(level=logging.DEBUG) + return output + + + + 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 + """ + Z9264F_MAX_PSUS = 2 + return Z9264F_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + #Until psu_status is implemented this is hardcoded temporarily + + status = 1 + return status + + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_reg_name = PSU_PRESENCE.format(index) + psu_status = int(self.get_pmc_register(psu_reg_name),16) + if (psu_status != 'ERR'): + # Check for PSU presence + if (psu_status): + status = 1 + return status diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py b/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py new file mode 100644 index 000000000000..84a5e153b304 --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py @@ -0,0 +1,192 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import struct + import sys + import getopt + import time + from sonic_sfp.sfputilbase import SfpUtilBase + from os import * + from mmap import * + +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 63 + PORTS_IN_BLOCK = 32 + + BASE_RES_PATH = "/sys/bus/pci/devices/0000:04:00.0/resource0" + + _port_to_eeprom_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(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def pci_mem_read(self, mm, offset): + mm.seek(offset) + read_data_stream=mm.read(4) + reg_val=struct.unpack('I',read_data_stream) + mem_val = str(reg_val)[1:-2] + # print "reg_val read:%x"%reg_val + return mem_val + + def pci_mem_write(self, mm, offset, data): + mm.seek(offset) + # print "data to write:%x"%data + mm.write(struct.pack('I',data)) + + def pci_set_value(self, resource, val, offset): + fd=open(resource,O_RDWR) + mm=mmap(fd,0) + return self.pci_mem_write(mm,offset,val) + + def pci_get_value(self, resource, offset): + fd=open(resource,O_RDWR) + mm=mmap(fd,0) + return self.pci_mem_read(mm, offset) + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + port_num = x + 2 + self.port_to_eeprom_mapping[x] = eeprom_path.format( + port_num) + port_num = 0 + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # Port offset starts with 0x4004 + port_offset = 16388 + ((port_num) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == "" ): + return False + + # Mask off 4th bit for presence + mask = (1 << 4) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # Port offset starts with 0x4000 + port_offset = 16384 + ((port_num) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == "" ): + return False + + # Mask off 4th bit for presence + mask = (1 << 6) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # Port offset starts with 0x4000 + port_offset = 16384 + ((port_num) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == "" ): + return False + + # Mask off 4th bit for presence + mask = (1 << 6) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + + return True + + def reset(self, port_num): + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # Port offset starts with 0x4000 + port_offset = 16384 + ((port_num) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == "" ): + return False + + # Mask off 4th bit for presence + mask = (1 << 6) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + + # Sleep 1 second to allow it to settle + time.sleep(1) + + reg_value = reg_value | mask + + # Convert our register value back to a hex string and write back + status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + + return True diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index c53ed494c474..d7cb6a46f5f3 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -10,7 +10,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update # Install required packages -RUN apt-get install -y python-pip libpython2.7 sensord fancontrol +RUN apt-get install -y python-pip libpython2.7 sensord fancontrol ipmitool {% if docker_platform_monitor_debs.strip() -%} # Copy locally-built Debian package dependencies diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index e1873851c9c4..61f32f16b7b9 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -21,6 +21,17 @@ function postStartAction() rm -fr /host/fast-reboot fi docker exec swss touch /ready # signal swssconfig.sh to go +{%- elif docker_container_name == "pmon" %} + + DEVPATH="/usr/share/sonic/device" + REBOOT="platform_reboot" + PSENSOR="/usr/local/bin/platform_sensors.py" + if [ -d ${DEVPATH}/${PLATFORM} ] && [ -f $PSENSOR ]; then + exist=`docker exec -i pmon ls /usr/bin/platform_sensors.py "$@" 2>/dev/null` + if [ -z "$exist" ]; then + docker cp $PSENSOR pmon:/usr/bin/ + fi + fi {%- elif docker_container_name == "snmp" %} docker exec -i database redis-cli -n 6 HSET 'DEVICE_METADATA|localhost' chassis_serial_number $(decode-syseeprom -s) {%- else %} diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index b009706a7850..26ac0506aa71 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -5,6 +5,7 @@ $(SONIC_ONE_IMAGE)_MACHINE = broadcom $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ + $(DELL_Z9264F_PLATFORM_MODULE) \ $(DELL_Z9100_PLATFORM_MODULE) \ $(DELL_S6100_PLATFORM_MODULE) \ $(INGRASYS_S8900_54XC_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-dell.mk b/platform/broadcom/platform-modules-dell.mk index a6b2a9c2c365..a2d051ffd911 100644 --- a/platform/broadcom/platform-modules-dell.mk +++ b/platform/broadcom/platform-modules-dell.mk @@ -1,8 +1,10 @@ -# Dell Z9100 and S6100 Platform modules +# Dell Z9100, S6100, Z9264F Platform modules +DELL_Z9264F_PLATFORM_MODULE_VERSION = 1.1 DELL_Z9100_PLATFORM_MODULE_VERSION = 1.1 DELL_S6100_PLATFORM_MODULE_VERSION = 1.1 +export DELL_Z9264F_PLATFORM_MODULE_VERSION export DELL_Z9100_PLATFORM_MODULE_VERSION export DELL_S6100_PLATFORM_MODULE_VERSION @@ -16,4 +18,9 @@ DELL_S6100_PLATFORM_MODULE = platform-modules-s6100_$(DELL_S6100_PLATFORM_MODULE $(DELL_S6100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6100_c2538-r0 $(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S6100_PLATFORM_MODULE))) +DELL_Z9264F_PLATFORM_MODULE = platform-modules-z9264f_$(DELL_Z9264F_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELL_Z9264F_PLATFORM_MODULE)_PLATFORM = x86_64-dellemc_z9264f_c3538-r0 +$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_Z9264F_PLATFORM_MODULE))) + + SONIC_STRETCH_DEBS += $(DELL_Z9100_PLATFORM_MODULE) diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 31993888a172..6cfea2267688 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 31993888a17291eb28ef674d6e2c973c539e806d +Subproject commit 6cfea2267688b7fb5cd11a867057ed264a01502c From f7c16e3eba67d638717a8367f36140aff6f540f6 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 10 Jul 2018 18:06:03 +0000 Subject: [PATCH 1512/1833] [devices]: change celestica platform modules version back to 0.6 --- platform/broadcom/platform-modules-cel.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 234f2d5399ef..792970fc4397 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -1,6 +1,6 @@ # Celestica DX010 Platform modules -CEL_DX010_PLATFORM_MODULE_VERSION = 0.8 +CEL_DX010_PLATFORM_MODULE_VERSION = 0.6 export CEL_DX010_PLATFORM_MODULE_VERSION From 39b0e801ca58a2984bd4aeb435d39bbf688ef4c0 Mon Sep 17 00:00:00 2001 From: yurypm Date: Sat, 14 Jul 2018 21:11:22 +0100 Subject: [PATCH 1513/1833] [device] Update arista driver submodule (#38) * [device] Update arista driver submodule * Set Arista scd driver config Set ARISTA_SCD_DRIVER_CONFIG config to build and include scd driver to resulting Arista deb packages --- platform/broadcom/platform-modules-arista.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/broadcom/platform-modules-arista.mk b/platform/broadcom/platform-modules-arista.mk index 480aa0cf8396..73d86bda4e33 100644 --- a/platform/broadcom/platform-modules-arista.mk +++ b/platform/broadcom/platform-modules-arista.mk @@ -23,3 +23,5 @@ export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MOD export ARISTA_SCD_DRIVER_CONFIG=m SONIC_STRETCH_DEBS += $(ARISTA_PLATFORM_MODULE) + +export ARISTA_SCD_DRIVER_CONFIG=m From 16e16f550645cd3222bd21fbaa091edfd0416320 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Sat, 30 Dec 2017 06:39:58 +0200 Subject: [PATCH 1514/1833] [Mellanox]: Update recipe for hw-management (#4) Update package revision Create submodule for sources Signed-off-by: marian-pritsak --- platform/mellanox/hw-management | 1 + 1 file changed, 1 insertion(+) create mode 160000 platform/mellanox/hw-management diff --git a/platform/mellanox/hw-management b/platform/mellanox/hw-management new file mode 160000 index 000000000000..ff83e6490d5c --- /dev/null +++ b/platform/mellanox/hw-management @@ -0,0 +1 @@ +Subproject commit ff83e6490d5c36fff6bfb17781119b52e234f5f6 From 46b0847339b211ec428f548190a9f826e0cb3d14 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 30 Jul 2018 17:42:13 +0000 Subject: [PATCH 1515/1833] [baseimage]: use original stretch bash in the base image --- files/build_templates/sonic_debian_extension.j2 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 0faaa5582ea6..62637446dda2 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -102,11 +102,6 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-click*_all.deb || \ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f -# Install customized bash version to patch memory-leak issue. This instruction shall be removed -# once the migration to Debian-9 (Stretch) is completed. -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/bash_*.deb || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f - # SONiC utilities installs bash-completion as a dependency. However, it is disabled by default # in bash.bashrc, so we copy a version of the file with it enabled here. sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ From a32b7412c38c15930c0e5c2d61fb6e5208340128 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 30 Jul 2018 22:55:13 +0000 Subject: [PATCH 1516/1833] [kernel]: update sonic linux kernel submodule * 70fdaa2 2018-06-30 | Support Delta DPS1900 (#49) (HEAD -> stretch, origin/stretch) [Deni] * 77895c5 2018-04-17 | Add kexec reboot string (#46) [Joe LeVeque] --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index a21a592baf4b..70fdaa224c13 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit a21a592baf4b189591f63fe7930f7d889bccd57a +Subproject commit 70fdaa224c1373682be871c084bf0f590bfafd8f From b8a01dc3b4e59b806f54e1fa2bcdfd329aba1df9 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 5 Aug 2018 06:17:46 +0000 Subject: [PATCH 1517/1833] [build]: add .gitignore for cel, delta and inventec Signed-off-by: Guohan Lu --- .../sonic-platform-modules-cel/.gitignore | 29 ++++++++- .../sonic-platform-modules-delta/.gitignore | 59 +++++++++++++++++++ .../.gitignore | 59 +++++++++++++++++++ 3 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 platform/broadcom/sonic-platform-modules-delta/.gitignore create mode 100644 platform/broadcom/sonic-platform-modules-inventec/.gitignore diff --git a/platform/broadcom/sonic-platform-modules-cel/.gitignore b/platform/broadcom/sonic-platform-modules-cel/.gitignore index 988e49257d47..2490baa9d1e2 100644 --- a/platform/broadcom/sonic-platform-modules-cel/.gitignore +++ b/platform/broadcom/sonic-platform-modules-cel/.gitignore @@ -1,15 +1,20 @@ +# Prerequisites +*.d + # Object files *.o *.ko *.obj *.elf +# Linker output +*.ilk +*.map +*.exp + # Precompiled Headers *.gch *.pch -*.mod.c -*.ko.cmd -*.o.cmd # Libraries *.lib @@ -34,3 +39,21 @@ # 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-delta/.gitignore b/platform/broadcom/sonic-platform-modules-delta/.gitignore new file mode 100644 index 000000000000..2490baa9d1e2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-delta/.gitignore @@ -0,0 +1,59 @@ +# 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-inventec/.gitignore b/platform/broadcom/sonic-platform-modules-inventec/.gitignore new file mode 100644 index 000000000000..2490baa9d1e2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/.gitignore @@ -0,0 +1,59 @@ +# 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 From 8e0f1f526fbcdcb2592da0c418d6c29ee7e4e168 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 5 Aug 2018 06:21:23 +0000 Subject: [PATCH 1518/1833] [celestica]: update dx010 fan driver to support fault alarm Signed-off-by: Guohan Lu --- .../sonic-platform-modules-cel/dx010/modules/emc2305.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c index f08033e080ce..b406a29fd9be 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/emc2305.c @@ -448,6 +448,14 @@ show_fan_div(struct device *dev, struct device_attribute *da, char *buf) 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) @@ -577,6 +585,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *da, 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) \ From 7d13479aed62255e3a7adefdd13b632470f9d9f1 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 5 Aug 2018 06:23:59 +0000 Subject: [PATCH 1519/1833] [celestica]: Add dx010 gpio sysfs exported when platform modules load. Signed-off-by: Guohan Lu --- platform/broadcom/platform-modules-cel.mk | 2 +- .../debian/changelog | 6 +++ .../debian/platform-modules-dx010.init | 41 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 792970fc4397..758c1f99802d 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -1,6 +1,6 @@ # Celestica DX010 Platform modules -CEL_DX010_PLATFORM_MODULE_VERSION = 0.6 +CEL_DX010_PLATFORM_MODULE_VERSION = 0.7 export CEL_DX010_PLATFORM_MODULE_VERSION diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/changelog b/platform/broadcom/sonic-platform-modules-cel/debian/changelog index 20ce5072b874..3b194229773c 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/changelog +++ b/platform/broadcom/sonic-platform-modules-cel/debian/changelog @@ -1,3 +1,9 @@ +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. 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 index c51aa742076b..f32785a798ca 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init @@ -11,6 +11,24 @@ # 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... " @@ -77,6 +95,29 @@ start) 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 From 3021e4efd61f943e256740b3d4168263899ea299 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 5 Aug 2018 06:49:36 +0000 Subject: [PATCH 1520/1833] [devices]: add celstica haliburton Signed-off-by: Guohan Lu --- .../celestica/x86_64-cel_e1031-r0/fancontrol | 12 + .../x86_64-cel_e1031-r0/plugins/eeprom.py | 23 + .../x86_64-cel_e1031-r0/sensors.conf | 12 + platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-cel.mk | 10 +- .../sonic-platform-modules-cel/README.md | 2 +- .../debian/changelog | 6 + .../sonic-platform-modules-cel/debian/control | 5 + .../debian/platform-modules-haliburton.init | 86 ++ .../platform-modules-haliburton.install | 1 + .../sonic-platform-modules-cel/debian/rules | 2 +- .../haliburton/cfg/haliburton-modules.conf | 15 + .../haliburton/modules/Makefile | 1 + .../haliburton/modules/emc2305.c | 877 ++++++++++++++++++ .../haliburton/modules/mc24lc64t.c | 142 +++ 15 files changed, 1191 insertions(+), 4 deletions(-) create mode 100644 device/celestica/x86_64-cel_e1031-r0/fancontrol create mode 100644 device/celestica/x86_64-cel_e1031-r0/plugins/eeprom.py create mode 100644 device/celestica/x86_64-cel_e1031-r0/sensors.conf create mode 100644 platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init create mode 100644 platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install create mode 100644 platform/broadcom/sonic-platform-modules-cel/haliburton/cfg/haliburton-modules.conf create mode 100644 platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-cel/haliburton/modules/emc2305.c create mode 100644 platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c diff --git a/device/celestica/x86_64-cel_e1031-r0/fancontrol b/device/celestica/x86_64-cel_e1031-r0/fancontrol new file mode 100644 index 000000000000..a94c63055fd7 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=2 +DEVPATH=hwmon3=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-23/23-004d/ hwmon2=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-11/11-001a/hwmon/hwmon2 +DEVNAME=hwmon3=emc2305 hwmon2=max6697 +FCTEMPS=hwmon3/pwm1=hwmon2/temp2_input hwmon3/pwm2=hwmon2/temp2_input hwmon3/pwm4=hwmon2/temp2_input +FCFANS=hwmon3/device/pwm1=hwmon3/device/fan1_input hwmon3/device/pwm2=hwmon3/device/fan2_input hwmon3/device/pwm4=hwmon3/device/fan4_input +MINTEMP=hwmon3/device/pwm1=29 hwmon3/device/pwm2=29 hwmon3/device/pwm4=29 +MAXTEMP=hwmon3/device/pwm1=44 hwmon3/device/pwm2=44 hwmon3/device/pwm4=44 +MINSTART=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 +MINSTOP=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 +MINPWM=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 +MAXPWM=hwmon3/device/pwm1=255 hwmon3/device/pwm2=255 hwmon3/device/pwm4=255 diff --git a/device/celestica/x86_64-cel_e1031-r0/plugins/eeprom.py b/device/celestica/x86_64-cel_e1031-r0/plugins/eeprom.py new file mode 100644 index 000000000000..6577631c8908 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/plugins/eeprom.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica Haliburton +# +# 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-2/2-0050/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) + diff --git a/device/celestica/x86_64-cel_e1031-r0/sensors.conf b/device/celestica/x86_64-cel_e1031-r0/sensors.conf new file mode 100644 index 000000000000..1874548cff64 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/sensors.conf @@ -0,0 +1,12 @@ +# libsensors configuration file for Celestica DX010. +# The i2c bus portion is omit because adapter name +# changes every time when system boot up. + +chip "max6697-i2c-*-1a" + label temp1 "temp sensor 1" + label temp2 "temp sensor 2" + label temp3 "temp sensor 3" + label temp4 "temp sensor 4" + label temp5 "temp sensor 5" + ignore temp6 + ignore temp7 diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 26ac0506aa71..8b24216d0a9d 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -23,6 +23,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) \ + $(CEL_HALIBURTON_PLATFORM_MODULE) \ $(DELTA_AG9032V1_PLATFORM_MODULE) \ $(DELTA_AG9064_PLATFORM_MODULE) \ $(DELTA_AG5648_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 758c1f99802d..9226d9246308 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -1,8 +1,10 @@ -# Celestica DX010 Platform modules +# Celestica DX010 and Haliburton Platform modules -CEL_DX010_PLATFORM_MODULE_VERSION = 0.7 +CEL_DX010_PLATFORM_MODULE_VERSION = 0.8 +CEL_HALIBURTON_PLATFORM_MODULE_VERSION = 0.8 export CEL_DX010_PLATFORM_MODULE_VERSION +export CEL_HALIBURTON_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 @@ -10,4 +12,8 @@ $(CEL_DX010_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(CEL_DX010_PLATFORM_MODULE)_PLATFORM = x86_64-cel_seastone-r0 SONIC_DPKG_DEBS += $(CEL_DX010_PLATFORM_MODULE) +CEL_HALIBURTON_PLATFORM_MODULE = platform-modules-haliburton_$(CEL_HALIBURTON_PLATFORM_MODULE_VERSION)_amd64.deb +$(CEL_HALIBURTON_PLATFORM_MODULE)_PLATFORM = x86_64-cel_e1031-r0 +$(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_HALIBURTON_PLATFORM_MODULE))) + SONIC_STRETCH_DEBS += $(CEL_DX010_PLATFORM_MODULE) diff --git a/platform/broadcom/sonic-platform-modules-cel/README.md b/platform/broadcom/sonic-platform-modules-cel/README.md index b09a36b51d95..26e45c685e44 100644 --- a/platform/broadcom/sonic-platform-modules-cel/README.md +++ b/platform/broadcom/sonic-platform-modules-cel/README.md @@ -1 +1 @@ -platform drivers for Celestica DX010 for the SONiC project +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 index 3b194229773c..64f2decf2677 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/changelog +++ b/platform/broadcom/sonic-platform-modules-cel/debian/changelog @@ -1,3 +1,9 @@ +sonic-cel-platform-modules (0.8) unstable; urgency=low + + * Add haliburton platform + + -- Supakit Fuangkaew Thu, 5 Apr 2018 09:09:09 +0700 + sonic-cel-platform-modules (0.7) unstable; urgency=low * Add dx010 plaform gpio sysfs exported when module load. diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/control b/platform/broadcom/sonic-platform-modules-cel/debian/control index a63df5359271..a26bdea11395 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/control +++ b/platform/broadcom/sonic-platform-modules-cel/debian/control @@ -10,3 +10,8 @@ Architecture: amd64 Depends: linux-image-4.9.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-haliburton +Architecture: amd64 +Depends: linux-image-4.9.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp 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 new file mode 100644 index 000000000000..08770d1d64f6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init @@ -0,0 +1,86 @@ +#!/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... " + + depmod -a + modprobe i2c-dev + modprobe i2c-mux-pca954x + + 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 PSUs + echo dps200 0x5a > /sys/bus/i2c/devices/i2c-12/new_device + echo dps200 0x5b > /sys/bus/i2c/devices/i2c-13/new_device + + # Attach 4 SFP+ Uplink + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-14/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-15/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-16/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-17/new_device + + 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 new file mode 100644 index 000000000000..464b77855f95 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install @@ -0,0 +1 @@ +haliburton/cfg/haliburton-modules.conf etc/modules-load.d diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/rules b/platform/broadcom/sonic-platform-modules-cel/debian/rules index fa9bb741d5a6..5086302b70b2 100755 --- a/platform/broadcom/sonic-platform-modules-cel/debian/rules +++ b/platform/broadcom/sonic-platform-modules-cel/debian/rules @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= dx010 +MODULE_DIRS:= dx010 haliburton %: dh $@ 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 new file mode 100644 index 000000000000..66f002a5fc94 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/cfg/haliburton-modules.conf @@ -0,0 +1,15 @@ +# /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 new file mode 100644 index 000000000000..6d0c489154c2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile @@ -0,0 +1 @@ +obj-m := mc24lc64t.o emc2305.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 new file mode 100644 index 000000000000..f08033e080ce --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/emc2305.c @@ -0,0 +1,877 @@ +/* + * 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 new file mode 100644 index 000000000000..a391056d09a7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c @@ -0,0 +1,142 @@ +/* + * 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"); From aa2e340f5ab9b8d07ccfc503bd9a69281387cf8e Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 7 Aug 2018 07:14:37 +0000 Subject: [PATCH 1521/1833] [broadcom]: build broadcom kernel modules from gpl source codes Signed-off-by: Guohan Lu --- platform/broadcom/rules.mk | 2 +- platform/broadcom/sai-modules.mk | 11 + platform/broadcom/saibcm-modules/.gitignore | 4 + .../broadcom/saibcm-modules/debian/changelog | 48 + .../broadcom/saibcm-modules/debian/compat | 1 + .../broadcom/saibcm-modules/debian/control | 14 + .../debian/opennsl-modules-4.9.0-5-amd64.dirs | 1 + .../debian/opennsl-modules-4.9.0-5-amd64.init | 47 + .../opennsl-modules-4.9.0-5-amd64.install | 4 + platform/broadcom/saibcm-modules/debian/rules | 183 + .../broadcom/saibcm-modules/include/ibde.h | 158 + .../broadcom/saibcm-modules/include/kcom.h | 541 ++ .../saibcm-modules/include/sal/core/sync.h | 39 + .../saibcm-modules/include/sal/core/thread.h | 31 + .../saibcm-modules/include/sal/types.h | 156 + .../saibcm-modules/include/sdk_config.h | 46 + .../saibcm-modules/include/soc/cmic.h | 38 + .../saibcm-modules/include/soc/devids.h | 1948 +++++ .../broadcom/saibcm-modules/make/Make.config | 364 + .../broadcom/saibcm-modules/make/Make.depend | 109 + .../broadcom/saibcm-modules/make/Make.kernlib | 70 + .../broadcom/saibcm-modules/make/Make.lib | 81 + .../broadcom/saibcm-modules/make/Make.linux | 98 + .../broadcom/saibcm-modules/make/Make.local | 2 + .../broadcom/saibcm-modules/make/Make.subdirs | 45 + .../broadcom/saibcm-modules/make/Make.tools | 39 + .../saibcm-modules/make/Makefile.linux-gto | 115 + .../make/Makefile.linux-gto-2_6 | 271 + .../saibcm-modules/make/Makefile.linux-iproc | 93 + .../make/Makefile.linux-iproc-3_14 | 104 + .../saibcm-modules/make/Makefile.linux-kernel | 113 + .../make/Makefile.linux-kernel-2_6 | 149 + .../make/Makefile.linux-kernel-3_6 | 149 + .../make/Makefile.linux-kernel-4_4 | 158 + .../make/Makefile.linux-kmodule | 82 + .../make/Makefile.linux-x86-common-2_6 | 45 + .../Makefile.linux-x86-generic-common-2_6 | 52 + .../Makefile.linux-x86-smp_generic_64-2_6 | 45 + .../opennsl-modules-4.9.0-5-amd64.service | 13 + .../systems/bde/linux/include/linux-bde.h | 275 + .../systems/bde/linux/include/linux_dma.h | 76 + .../systems/bde/linux/include/mpool.h | 37 + .../systems/bde/linux/kernel/Makefile | 115 + .../bde/linux/kernel/linux-kernel-bde.c | 5173 +++++++++++++ .../systems/bde/linux/kernel/linux_dma.c | 906 +++ .../systems/bde/linux/kernel/linux_shbde.c | 121 + .../systems/bde/linux/kernel/linux_shbde.h | 34 + .../systems/bde/linux/shared/mpool.c | 295 + .../systems/bde/linux/user/kernel/Makefile | 71 + .../bde/linux/user/kernel/linux-user-bde.c | 1264 +++ .../bde/linux/user/kernel/linux-user-bde.h | 113 + .../systems/bde/shared/include/shbde.h | 77 + .../systems/bde/shared/include/shbde_iproc.h | 49 + .../systems/bde/shared/include/shbde_mdio.h | 60 + .../systems/bde/shared/include/shbde_pci.h | 47 + .../systems/bde/shared/shbde_iproc.c | 466 ++ .../systems/bde/shared/shbde_mdio.c | 187 + .../systems/bde/shared/shbde_pci.c | 393 + .../systems/linux/kernel/modules/Makefile | 32 + .../linux/kernel/modules/bcm-knet/Makefile | 68 + .../linux/kernel/modules/bcm-knet/bcm-knet.c | 6874 +++++++++++++++++ .../linux/kernel/modules/include/bcm-knet.h | 79 + .../linux/kernel/modules/include/gmodule.h | 66 + .../linux/kernel/modules/include/lkm.h | 180 + .../linux/kernel/modules/knet-cb/Makefile | 65 + .../linux/kernel/modules/knet-cb/knet-cb.c | 276 + .../linux/kernel/modules/shared/Makefile | 30 + .../linux/kernel/modules/shared/gmodule.c | 428 + .../linux/kernel/modules/shared/ksal.c | 250 + .../systems/linux/user/common/Makefile | 242 + .../systems/linux/user/gto-2_6/Makefile | 85 + .../systems/linux/user/gto/Makefile | 61 + .../systems/linux/user/iproc-3_14/Makefile | 66 + .../systems/linux/user/iproc/Makefile | 60 + .../user/x86-smp_generic_64-2_6/Makefile | 46 + .../broadcom/saibcm-modules/tools/mktool.pl | 293 + platform/broadcom/sdk.mk | 4 - 77 files changed, 24428 insertions(+), 5 deletions(-) create mode 100644 platform/broadcom/sai-modules.mk create mode 100644 platform/broadcom/saibcm-modules/.gitignore create mode 100644 platform/broadcom/saibcm-modules/debian/changelog create mode 100644 platform/broadcom/saibcm-modules/debian/compat create mode 100644 platform/broadcom/saibcm-modules/debian/control create mode 100644 platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.dirs create mode 100755 platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.init create mode 100644 platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.install create mode 100755 platform/broadcom/saibcm-modules/debian/rules create mode 100644 platform/broadcom/saibcm-modules/include/ibde.h create mode 100644 platform/broadcom/saibcm-modules/include/kcom.h create mode 100644 platform/broadcom/saibcm-modules/include/sal/core/sync.h create mode 100644 platform/broadcom/saibcm-modules/include/sal/core/thread.h create mode 100644 platform/broadcom/saibcm-modules/include/sal/types.h create mode 100644 platform/broadcom/saibcm-modules/include/sdk_config.h create mode 100644 platform/broadcom/saibcm-modules/include/soc/cmic.h create mode 100644 platform/broadcom/saibcm-modules/include/soc/devids.h create mode 100644 platform/broadcom/saibcm-modules/make/Make.config create mode 100644 platform/broadcom/saibcm-modules/make/Make.depend create mode 100644 platform/broadcom/saibcm-modules/make/Make.kernlib create mode 100644 platform/broadcom/saibcm-modules/make/Make.lib create mode 100644 platform/broadcom/saibcm-modules/make/Make.linux create mode 100644 platform/broadcom/saibcm-modules/make/Make.local create mode 100644 platform/broadcom/saibcm-modules/make/Make.subdirs create mode 100644 platform/broadcom/saibcm-modules/make/Make.tools create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-gto create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-gto-2_6 create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-iproc create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-iproc-3_14 create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-kernel create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-2_6 create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-3_6 create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-4_4 create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-kmodule create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-x86-common-2_6 create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-x86-generic-common-2_6 create mode 100644 platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 create mode 100644 platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-5-amd64.service create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/include/linux-bde.h create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/include/mpool.h create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_shbde.c create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_shbde.h create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/shared/mpool.c create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c create mode 100644 platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.h create mode 100644 platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde.h create mode 100644 platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_iproc.h create mode 100644 platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_mdio.h create mode 100644 platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_pci.h create mode 100644 platform/broadcom/saibcm-modules/systems/bde/shared/shbde_iproc.c create mode 100644 platform/broadcom/saibcm-modules/systems/bde/shared/shbde_mdio.c create mode 100644 platform/broadcom/saibcm-modules/systems/bde/shared/shbde_pci.c create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/bcm-knet.h create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/gmodule.h create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/knet-cb.c create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c create mode 100644 platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c create mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/gto-2_6/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/gto/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/iproc-3_14/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/iproc/Makefile create mode 100644 platform/broadcom/saibcm-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile create mode 100644 platform/broadcom/saibcm-modules/tools/mktool.pl delete mode 100644 platform/broadcom/sdk.mk diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 582af46b86a9..c7fa0f7aa80e 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,4 +1,4 @@ -include $(PLATFORM_PATH)/sdk.mk +include $(PLATFORM_PATH)/sai-modules.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-s6000.mk include $(PLATFORM_PATH)/platform-modules-dell.mk diff --git a/platform/broadcom/sai-modules.mk b/platform/broadcom/sai-modules.mk new file mode 100644 index 000000000000..31cd5996ef1c --- /dev/null +++ b/platform/broadcom/sai-modules.mk @@ -0,0 +1,11 @@ +# Broadcom SAI modules + +KVERSION = 4.9.0-5-amd64 +BRCM_OPENNSL_KERNEL_VERSION = 3.4.1.11-1 + +BRCM_OPENNSL_KERNEL = opennsl-modules-$(KVERSION)_$(BRCM_OPENNSL_KERNEL_VERSION)_amd64.deb +$(BRCM_OPENNSL_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/saibcm-modules +$(BRCM_OPENNSL_KERNEL)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_DPKG_DEBS += $(BRCM_OPENNSL_KERNEL) + +SONIC_STRETCH_DEBS += $(BRCM_OPENNSL_KERNEL) diff --git a/platform/broadcom/saibcm-modules/.gitignore b/platform/broadcom/saibcm-modules/.gitignore new file mode 100644 index 000000000000..338005f50ce9 --- /dev/null +++ b/platform/broadcom/saibcm-modules/.gitignore @@ -0,0 +1,4 @@ +*.debhelper.log +*.debhelper +*.substvars +*.ko diff --git a/platform/broadcom/saibcm-modules/debian/changelog b/platform/broadcom/saibcm-modules/debian/changelog new file mode 100644 index 000000000000..5ea7b289ee65 --- /dev/null +++ b/platform/broadcom/saibcm-modules/debian/changelog @@ -0,0 +1,48 @@ +opennsl (3.4.1.11-1) unstable; urgency=medium + + * Port Broadcom SAI 3.4.1.11 + * Cherry-pick change from master branch, 3.4.1.11-1 + + -- Ying Xie Fri, 05 Jan 2018 23:21:47 +0000 + +opennsl (3.4.1.10-1) unstable; urgency=medium + + * Upgrade to 3.4.1.10-1 + + -- Ying Xie Tue, 19 Dec 2017 21:33:48 +0000 + +opennsl (3.4.1.9-1) unstable; urgency=medium + + * Upgrade to 3.4.1.9-1 + + -- Ying Xie Thu, 14 Dec 2017 22:04:11 +0000 + +opennsl (3.4.1.7-2) unstable; urgency=medium + + * Add Arista 7260cx3 Rev2 hardware support + + -- Ying Xie Mon, 27 Nov 2017 18:13:50 +0000 + +opennsl (3.4.1.7-1) unstable; urgency=medium + + * Importing opennsl 3.4.1.7 + + -- Ying Xie Mon, 23 Oct 2017 23:47:25 +0000 + +opennsl (3.4.1.5-2) unstable; urgency=medium + + * Importing TD2 changes from opennsl 3.2.2.2 + + -- Ying Xie Tue, 26 Sep 2017 01:28:44 +0000 + +opennsl (3.4.1.5-1) unstable; urgency=medium + + * Importing opennsl 3.4.1.5 + + -- Ying Xie Wed, 20 Sep 2017 16:42:12 +0000 + +opennsl (3.4.1.3-1) unstable; urgency=low + + * Initial release + + -- Guohan Lu Fri, 17 Jul 2015 04:46:01 -0700 diff --git a/platform/broadcom/saibcm-modules/debian/compat b/platform/broadcom/saibcm-modules/debian/compat new file mode 100644 index 000000000000..45a4fb75db86 --- /dev/null +++ b/platform/broadcom/saibcm-modules/debian/compat @@ -0,0 +1 @@ +8 diff --git a/platform/broadcom/saibcm-modules/debian/control b/platform/broadcom/saibcm-modules/debian/control new file mode 100644 index 000000000000..e84d6de9fd52 --- /dev/null +++ b/platform/broadcom/saibcm-modules/debian/control @@ -0,0 +1,14 @@ +Source: opennsl +Section: main +Priority: extra +Maintainer: Guohan Lu +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 +#Vcs-Git: git://git.debian.org/collab-maint/bcmsdk.git +#Vcs-Browser: http://git.debian.org/?p=collab-maint/bcmsdk.git;a=summary + +Package: opennsl-modules-4.9.0-5-amd64 +Architecture: amd64 +Section: main +Depends: linux-image-4.9.0-5-amd64 +Description: kernel modules for broadcom SAI diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.dirs b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.dirs new file mode 100644 index 000000000000..30ebf9851ecb --- /dev/null +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.dirs @@ -0,0 +1 @@ +lib/modules/4.9.0-5-amd64/extra diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.init b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.init new file mode 100755 index 000000000000..07a6f834757b --- /dev/null +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.init @@ -0,0 +1,47 @@ +#!/bin/bash +# This script load/unload opennsl kernel modules + +### BEGIN INIT INFO +# Provides: load-opennsl-modules +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Load OpenNSL kernel modules +### END INIT INFO + +case "$1" in +start) + echo -n "Load OpenNSL kernel modules... " + + modprobe linux-kernel-bde dmasize=32M maxpayload=128 + modprobe linux-user-bde + modprobe linux-bcm-knet use_rx_skb=1 rx_buffer_size=9238 + + echo "done." + ;; + +stop) + echo -n "Unload OpenNSL kernel modules... " + + rmmod linux-bcm-knet + rmmod linux-user-bde + rmmod linux-kernel-bde + + echo "done." + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/opennsl-modules-4.9.0-5-amd64.init {start|stop}" + exit 1 + ;; +esac + +exit 0 + diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.install b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.install new file mode 100644 index 000000000000..d79178a4a549 --- /dev/null +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.install @@ -0,0 +1,4 @@ +systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/4.9.0-5-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.9.0-5-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.9.0-5-amd64/extra +systemd/opennsl-modules-4.9.0-5-amd64.service lib/systemd/system diff --git a/platform/broadcom/saibcm-modules/debian/rules b/platform/broadcom/saibcm-modules/debian/rules new file mode 100755 index 000000000000..231c52aa8ccd --- /dev/null +++ b/platform/broadcom/saibcm-modules/debian/rules @@ -0,0 +1,183 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. +# +# This version is for a hypothetical package that can build a kernel modules +# architecture-dependant package via make-kpkg, as well as an +# architecture-independent module source package, and other packages +# either dep/indep for things like common files or userspace components +# needed for the kernel modules. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + +# some default definitions, important! +# +# Name of the source package +psource:=opennsl-source + +# The short upstream name, used for the module source directory +sname:=opennsl + +### KERNEL SETUP +### Setup the stuff needed for making kernel module packages +### taken from /usr/share/kernel-package/sample.module.rules + +# prefix of the target package name +PACKAGE=opennsl-modules +# modifieable for experiments or debugging m-a +MA_DIR ?= /usr/share/modass +# load generic variable handling +-include $(MA_DIR)/include/generic.make +# load default rules, including kdist, kdist_image, ... +-include $(MA_DIR)/include/common-rules.make + + + +# module assistant calculates all needed things for us and sets +# following variables: +# KSRC (kernel source directory), KVERS (kernel version string), KDREV +# (revision of the Debian kernel-image package), CC (the correct +# compiler), VERSION (the final package version string), PKGNAME (full +# package name with KVERS included), DEB_DESTDIR (path to store DEBs) + +# The kdist_config target is called by make-kpkg modules_config and +# by kdist* rules by dependency. It should configure the module so it is +# ready for compilation (mostly useful for calling configure). +# prep-deb-files from module-assistant creates the neccessary debian/ files +kdist_config: prep-deb-files + +# the kdist_clean target is called by make-kpkg modules_clean and from +# kdist* rules. It is responsible for cleaning up any changes that have +# been made by the other kdist_commands (except for the .deb files created) +kdist_clean: clean + dh_testdir + dh_clean + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-5-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-5-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean +# rm -f driver/*.o driver/*.ko +# +### end KERNEL SETUP + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build-arch: configure-stamp build-arch-stamp +build-arch-stamp: + dh_testdir + + # Add here command to compile/build the package. + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-5-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-5-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 + + touch $@ + +#k = $(shell echo $(KVERS) | grep -q ^2.6 && echo k) + +build-indep: configure-stamp build-indep-stamp +build-indep-stamp: + dh_testdir + + # Add here command to compile/build the arch indep package. + # It's ok not to do anything here, if you don't need to build + # anything for this package. + #docbook-to-man debian/opennsl.sgml > opennsl.1 + + touch $@ + +build: build-arch + +clean: + dh_testdir + #dh_testroot + rm -f build-arch-stamp build-indep-stamp configure-stamp + + # Add here commands to clean up after the build process. + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-5-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-5-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean + + dh_clean + +install: DH_OPTIONS= +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + dh_install + +# Build architecture-independent files here. +# Pass -i to all debhelper commands in this target to reduce clutter. +binary-indep: build install + dh_testdir -i + dh_testroot -i + dh_installchangelogs -i + dh_installdocs -i + dh_installexamples -i +# dh_install -i +# dh_installmenu -i +# dh_installdebconf -i +# dh_installlogrotate -i +# dh_installemacsen -i +# dh_installpam -i +# dh_installmime -i +# dh_installinit -i +# dh_installcron -i +# dh_installinfo -i + dh_installman -i + dh_link -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i +# dh_perl -i +# dh_makeshlibs -i + dh_installdeb -i + dh_shlibdeps -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir -s + dh_testroot -s +# dh_installdebconf -s + + dh_installdocs -s + dh_installexamples -s + dh_installmenu -s +# dh_installlogrotate -s +# dh_installemacsen -s +# dh_installpam -s +# dh_installmime -s + dh_installmodules -s + dh_systemd_enable -s + dh_installinit -s + dh_systemd_start -s + dh_installcron -s +# dh_installman -s + dh_installinfo -s + dh_installchangelogs -s + dh_strip -s + dh_link -s + dh_compress -s + dh_fixperms -s + dh_makeshlibs -s + dh_installdeb -s +# dh_perl -s + dh_shlibdeps -s + dh_gencontrol -s + dh_md5sums -s + dh_builddeb -s + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure binary-modules kdist kdist_configure kdist_image kdist_clean diff --git a/platform/broadcom/saibcm-modules/include/ibde.h b/platform/broadcom/saibcm-modules/include/ibde.h new file mode 100644 index 000000000000..c022e0b95aa0 --- /dev/null +++ b/platform/broadcom/saibcm-modules/include/ibde.h @@ -0,0 +1,158 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: ibde.h,v 1.27 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ + +#ifndef __IBDE_H__ +#define __IBDE_H__ + +#include + +/* + * Represents a collection of devices + */ + +typedef struct ibde_dev_s { + uint16 device; + uint8 rev; + sal_vaddr_t base_address; + sal_vaddr_t base_address1; + sal_vaddr_t base_address2; +} ibde_dev_t; + + +typedef struct ibde_s { + + const char *(*name)(void); + + /* Returns the number of devices available */ + /* Each device is is accessed through a handle */ + /* Handles are assumed to index the array of devices */ + + /* Support SWITCH or ETHERNET or CPU devices */ + int (*num_devices)(int type); +#define BDE_ALL_DEVICES 0 +#define BDE_SWITCH_DEVICES 1 +#define BDE_ETHER_DEVICES 2 +#define BDE_CPU_DEVICES 3 + + const ibde_dev_t *(*get_dev)(int d); + + /* + * Get types of underlaying devices. + * A combination of bus type and functional type is returned. + * In case of bus type, support PCI and SPI device types. + * In case of functional type, specify if underlaying device is + * a switching or ethernet device. + */ + uint32 (*get_dev_type)(int d); +#define BDE_PCI_DEV_TYPE SAL_PCI_DEV_TYPE /* PCI device */ +#define BDE_SPI_DEV_TYPE SAL_SPI_DEV_TYPE /* SPI device */ +#define BDE_EB_DEV_TYPE SAL_EB_DEV_TYPE /* EB device */ +#define BDE_ICS_DEV_TYPE SAL_ICS_DEV_TYPE /* ICS device */ +#define BDE_MII_DEV_TYPE SAL_MII_DEV_TYPE /* MII device */ +#define BDE_I2C_DEV_TYPE SAL_I2C_DEV_TYPE /* I2C device */ +#define BDE_AXI_DEV_TYPE SAL_AXI_DEV_TYPE /* AXI device */ +#define BDE_EMMI_DEV_TYPE SAL_EMMI_DEV_TYPE /* EMMI device */ +#define BDE_DEV_BUS_ALT SAL_DEV_BUS_ALT /* Alternate Access */ +#define BDE_DEV_BUS_MSI SAL_DEV_BUS_MSI /* Message-signaled interrupts */ + +#define BDE_DEV_BUS_TYPE_MASK SAL_DEV_BUS_TYPE_MASK + +#define BDE_SWITCH_DEV_TYPE SAL_SWITCH_DEV_TYPE /* Switch device */ +#define BDE_ETHER_DEV_TYPE SAL_ETHER_DEV_TYPE /* Ethernet device */ +#define BDE_CPU_DEV_TYPE SAL_CPU_DEV_TYPE /* CPU device */ + +#define BDE_BYTE_SWAP 0x01000000 /* SW byte swap */ +#define BDE_NO_IPROC 0x02000000 /* Device uses two BARs, but is not iProc */ + +#define BDE_256K_REG_SPACE 0x20000000 /* Map 256K (v 64K) */ +#define BDE_128K_REG_SPACE 0x40000000 /* Map 128K (v 64K) */ +#define BDE_320K_REG_SPACE 0x80000000 /* Map 256K+64K */ + +/* Bus supports only 16bit reads */ +#define BDE_DEV_BUS_RD_16BIT SAL_DEV_BUS_RD_16BIT + +/* Bus supports only 16bit writes */ +#define BDE_DEV_BUS_WR_16BIT SAL_DEV_BUS_WR_16BIT + +/* Backward compatibility */ +#define BDE_ET_DEV_TYPE BDE_MII_DEV_TYPE + +#define BDE_DEV_MEM_MAPPED(_d) \ + ((_d) & (BDE_PCI_DEV_TYPE | BDE_ICS_DEV_TYPE | BDE_EB_DEV_TYPE |\ + BDE_EMMI_DEV_TYPE | BDE_AXI_DEV_TYPE)) + + /* + * PCI Bus Access + */ + uint32 (*pci_conf_read)(int d, uint32 addr); + int (*pci_conf_write)(int d, uint32 addr, uint32 data); + void (*pci_bus_features)(int d, int *be_pio, int *be_packet, + int *be_other); + + uint32 (*read)(int d, uint32 addr); + int (*write)(int d, uint32 addr, uint32 data); + + uint32* (*salloc)(int d, int size, const char *name); + void (*sfree)(int d, void *ptr); + int (*sflush)(int d, void *addr, int length); + int (*sinval)(int d, void *addr, int length); + + int (*interrupt_connect)(int d, void (*)(void*), void *data); + int (*interrupt_disconnect)(int d); + + sal_paddr_t (*l2p)(int d, void *laddr); + void* (*p2l)(int d, sal_paddr_t paddr); + + /* + * SPI Access via SMP + */ + int (*spi_read)(int d, uint32 addr, uint8 *buf, int len); + int (*spi_write)(int d, uint32 addr, uint8 *buf, int len); + /* Special SPI access addresses */ +#define BDE_DEV_OP_EMMI_INIT SAL_DEV_OP_EMMI_INIT + + /* + * iProc register access + */ + uint32 (*iproc_read)(int d, uint32 addr); + int (*iproc_write)(int d, uint32 addr, uint32 data); + + /* + * Shared memory access + */ + uint32 (*shmem_read)(int dev, uint32 addr, uint8 *buf, uint32 len); + void (*shmem_write)(int dev, uint32 addr, uint8 *buf, uint32 len); + sal_vaddr_t (*shmem_map)(int dev, uint32 addr, uint32 size); + + /* + * cmic + */ + int (*get_cmic_ver)(int d, uint32 *ver); + +} ibde_t; + + +/* System BDE */ +extern ibde_t *bde; + + +#endif /* __IBDE_H__ */ diff --git a/platform/broadcom/saibcm-modules/include/kcom.h b/platform/broadcom/saibcm-modules/include/kcom.h new file mode 100644 index 000000000000..5755df250fb6 --- /dev/null +++ b/platform/broadcom/saibcm-modules/include/kcom.h @@ -0,0 +1,541 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: kcom.h,v 1.9 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + * + * File: kcom.h + * Purpose: User/Kernel message definitions + */ + +#ifndef _KCOM_H +#define _KCOM_H + +#include + +#define KCOM_CHAN_KNET "KCOM_KNET" + +/* + * Message types + */ +#define KCOM_MSG_TYPE_CMD 1 /* Command */ +#define KCOM_MSG_TYPE_RSP 2 /* Command response */ +#define KCOM_MSG_TYPE_EVT 3 /* Unsolicited event */ + + +/* + * Message opcodes + */ +#define KCOM_M_NONE 0 /* Should not be used */ +#define KCOM_M_VERSION 1 /* Protocol version */ +#define KCOM_M_STRING 2 /* For debug messages */ +#define KCOM_M_HW_RESET 3 /* H/W not ready */ +#define KCOM_M_HW_INIT 4 /* H/W initialized */ +#define KCOM_M_ETH_HW_CONFIG 5 /* ETH HW config*/ +#define KCOM_M_DETACH 6 /* Detach kernel module */ +#define KCOM_M_NETIF_CREATE 11 /* Create network interface */ +#define KCOM_M_NETIF_DESTROY 12 /* Destroy network interface */ +#define KCOM_M_NETIF_LIST 13 /* Get list of network interface IDs */ +#define KCOM_M_NETIF_GET 14 /* Get network interface info */ +#define KCOM_M_FILTER_CREATE 21 /* Create Rx filter */ +#define KCOM_M_FILTER_DESTROY 22 /* Destroy Rx filter */ +#define KCOM_M_FILTER_LIST 23 /* Get list of Rx filter IDs */ +#define KCOM_M_FILTER_GET 24 /* Get Rx filter info */ +#define KCOM_M_DMA_INFO 31 /* Tx/Rx DMA info */ +#define KCOM_M_DBGPKT_SET 41 /* Enbale debug packet function */ +#define KCOM_M_DBGPKT_GET 42 /* Get debug packet function info */ + +#define KCOM_VERSION 8 /* Protocol version */ + +/* + * Message status codes + */ +#define KCOM_E_NONE 0 /* No errors */ +#define KCOM_E_PARAM 1 /* Invalid/unsupported parameter */ +#define KCOM_E_RESOURCE 2 /* Out of memory or other resource */ +#define KCOM_E_NOT_FOUND 3 /* Requested object not found */ + +typedef struct kcom_msg_hdr_s { + uint8 type; + uint8 opcode; + uint8 seqno; + uint8 status; + uint8 unit; + uint8 reserved; + uint16 id; +} kcom_msg_hdr_t; + + +/* + * Object types + */ + +/* + * System network interface + * + * Network interface types: + * + * KCOM_NETIF_T_VLAN + * Transmits to this interface will go to ingress PIPE of switch + * CPU port using specified VLAN ID. Packet will be switched. + * + * KCOM_NETIF_T_PORT + * Transmits to this interface will go to unmodified to specified + * physical switch port. All switching logic is bypassed. + * + * KCOM_NETIF_T_META + * Transmits to this interface will be done using raw meta data + * as DMA descriptors. Currently used for RCPU mode only. + * + * Network interface flags: + * + * KCOM_NETIF_F_ADD_TAG + * Add VLAN tag to packets sent directly to physical port. + * + * KCOM_NETIF_F_RCPU_ENCAP + * Use RCPU encapsulation for packets that enter and exit this + * interface. + */ +#define KCOM_NETIF_T_VLAN 0 +#define KCOM_NETIF_T_PORT 1 +#define KCOM_NETIF_T_META 2 + +#define KCOM_NETIF_F_ADD_TAG (1U << 0) +#define KCOM_NETIF_F_RCPU_ENCAP (1U << 1) +/* If a netif has this flag, the packet sent to the netif can't be stripped tag or added tag */ +#define KCOM_NETIF_F_KEEP_RX_TAG (1U << 2) + +#define KCOM_NETIF_NAME_MAX 16 + +typedef struct kcom_netif_s { + uint16 id; + uint8 type; + uint8 flags; + uint32 cb_user_data; + uint8 port; + uint8 reserved; + uint16 vlan; + uint16 qnum; + uint8 macaddr[6]; + uint8 ptch[2]; + uint8 itmh[4]; + char name[KCOM_NETIF_NAME_MAX]; +} kcom_netif_t; + +/* + * Packet filters + * + * Filters work like software TCAMs where a mask is applied to the + * source data, and the result is then compared to the filter data. + * + * Filters are checked in priority order with the lowest priority + * values being checked first (i.e. 0 is the highest priority). + * + * Filter types: + * + * KCOM_FILTER_T_RX_PKT + * Filter data and mask are applied to the Rx DMA control block + * as well as to the Rx packet contents. + * + * Destination types: + * + * KCOM_DEST_T_NULL + * Packet is dropped. + * + * KCOM_DEST_T_NETIF + * Packet is sent to network interface with ID . + * + * KCOM_DEST_T_API + * Packet is sent to Rx API through queue . + * + * KCOM_DEST_T_CB + * Packet destination is obtained from kernel call-back function. + * + * Filter flags: + * + * KCOM_FILTER_F_ANY_DATA + * When this flags is set the filter will match any packet on + * the associated unit. + * + * KCOM_FILTER_F_STRIP_TAG + * Strip VLAN tag before packet is sent to destination. + * This flag only applies to KCOM_DEST_T_NETIF. + * + */ +#define KCOM_FILTER_BYTES_MAX 256 +#define KCOM_FILTER_WORDS_MAX BYTES2WORDS(KCOM_FILTER_BYTES_MAX) + +#define KCOM_FILTER_T_RX_PKT 1 + +#define KCOM_DEST_T_NULL 0 +#define KCOM_DEST_T_NETIF 1 +#define KCOM_DEST_T_API 2 +#define KCOM_DEST_T_CB 3 + +#define KCOM_FILTER_F_ANY_DATA (1U << 0) +#define KCOM_FILTER_F_STRIP_TAG (1U << 1) + +#define KCOM_FILTER_DESC_MAX 32 + +typedef struct kcom_filter_s { + uint16 id; + uint8 type; + uint8 priority; + char desc[KCOM_FILTER_DESC_MAX]; + uint32 flags; + uint32 cb_user_data; + uint16 dest_type; + uint16 dest_id; + uint16 dest_proto; + uint16 mirror_type; + uint16 mirror_id; + uint16 mirror_proto; + uint16 oob_data_offset; + uint16 oob_data_size; + uint16 pkt_data_offset; + uint16 pkt_data_size; + union { + uint8 b[KCOM_FILTER_BYTES_MAX]; + uint32 w[KCOM_FILTER_WORDS_MAX]; + } data; + union { + uint8 b[KCOM_FILTER_BYTES_MAX]; + uint32 w[KCOM_FILTER_WORDS_MAX]; + } mask; +} kcom_filter_t; + +/* + * DMA buffer information + * + * Cookie field is reserved use by application (32/64-bit pointer). + * + * For Tx operation the application will submit the start address of + * the Tx DCB chain which is queued for transfer by the kernel module. + * Once DMA is done a DMA event is returned to the application with an + * optional sequence number. + * + * For Rx operation the application will submit the start address of + * the Rx DCB chain which should be use for packet reception by the + * kernel module. Once DMA is done a DMA event is returned to the + * application with an optional sequence number. + * + * Cookie field is reserved use by application (32/64-bit pointer). + * + * Packet info types: + * + * KCOM_DMA_INFO_T_TX_DCB + * Data is physical start address of Tx DCB chain. + * + * KCOM_DMA_INFO_T_RX_DCB + * Data is physical start address of Rx DCB chain. + * + * Packet info flags: + * + * KCOM_DMA_INFO_F_TX_DONE + * This flag is set by the kernel module and means that one or more + * packets have been sent. + * + * KCOM_DMA_INFO_F_RX_DONE + * This flag is set by the kernel module and means that one or more + * Rx buffers contain valid packet data. + */ +#define KCOM_DMA_INFO_T_TX_DCB 1 +#define KCOM_DMA_INFO_T_RX_DCB 2 + +#define KCOM_DMA_INFO_F_TX_DONE (1U << 0) +#define KCOM_DMA_INFO_F_RX_DONE (1U << 1) + +typedef struct kcom_dma_info_s { + uint8 type; + uint8 cnt; + uint16 size; + uint16 chan; + uint16 flags; + union { + void *p; + uint8 b[8]; + } cookie; + union { + uint32 dcb_start; + struct { + uint32 tx; + uint32 rx; + } seqno; + } data; + } kcom_dma_info_t; + +/* Default channel configuration */ +#define KCOM_DMA_TX_CHAN 0 +#define KCOM_DMA_RX_CHAN 1 + + +#define KCOM_ETH_HW_T_RESET 1 +#define KCOM_ETH_HW_T_INIT 2 +#define KCOM_ETH_HW_T_OTHER 3 + +#define KCOM_ETH_HW_C_ALL 0xff + +#define KCOM_ETH_HW_RESET_F_TX (1U << 0) +#define KCOM_ETH_HW_RESET_F_RX (1U << 1) +#define KCOM_ETH_HW_RESET_F_TX_RECLAIM (1U << 2) +#define KCOM_ETH_HW_RESET_F_RX_RECLAIM (1U << 3) + +#define KCOM_ETH_HW_INIT_F_TX (1U << 0) +#define KCOM_ETH_HW_INIT_F_RX (1U << 1) +#define KCOM_ETH_HW_INIT_F_RX_FILL (1U << 2) + + +#define KCOM_ETH_HW_OTHER_F_FIFO_LOOPBACK (1U << 0) +#define KCOM_ETH_HW_OTHER_F_INTERRUPT (1U << 1) + + + + +typedef struct kcom_eth_hw_config_s { + uint8 type; + uint8 chan; + uint32 flags; + uint32 value; + } kcom_eth_hw_config_t; + +/* + * Message types + */ + +/* + * Request KCOM interface version of kernel module. + */ +typedef struct kcom_msg_version_s { + kcom_msg_hdr_t hdr; + uint32 version; + uint32 netif_max; + uint32 filter_max; +} kcom_msg_version_t; + +/* + * Send literal string to/from kernel module. + * Mainly for debugging purposes. + */ +#define KCOM_MSG_STRING_MAX 128 + +typedef struct kcom_msg_string_s { + kcom_msg_hdr_t hdr; + uint32 len; + char val[KCOM_MSG_STRING_MAX]; +} kcom_msg_string_t; + + +/* + * Indicate that eth hardware is about to be reset. Active + * DMA operations should be aborted and DMA and interrupts + * should be disabled. + */ +/* + * Indicate that eth hardware has been properly initialized + * for DMA operation to commence. + */ +typedef struct kcom_msg_eth_hw_config_s { + kcom_msg_hdr_t hdr; + kcom_eth_hw_config_t config; +} kcom_msg_eth_hw_config_t; + + +/* + * Indicate that switch hardware is about to be reset. Active + * DMA operations should be aborted and DMA and interrupts + * should be disabled. + */ +typedef struct kcom_msg_hw_reset_s { + kcom_msg_hdr_t hdr; + uint32 channels; +} kcom_msg_hw_reset_t; + +/* + * Indicate that switch hardware has been properly initialized + * for DMA operation to commence. + */ +typedef struct kcom_msg_hw_init_s { + kcom_msg_hdr_t hdr; + uint16 dcb_size; + uint16 dcb_type; + uint32 cdma_channels; +} kcom_msg_hw_init_t; + +/* + * Release blocked IOCTL threads and clean up as necessary. + */ +typedef struct kcom_msg_detach_s { + kcom_msg_hdr_t hdr; + uint32 flags; +} kcom_msg_detach_t; + +/* + * Enable/Disable debugging packet function. + */ +typedef struct kcom_msg_dbg_pkt_set_s { + kcom_msg_hdr_t hdr; + int enable; +} kcom_msg_dbg_pkt_set_t; + +/* + * Get debugging packet function info. + */ +typedef struct kcom_msg_dbg_pkt_get_s { + kcom_msg_hdr_t hdr; + int value; +} kcom_msg_dbg_pkt_get_t; + +/* + * Create new system network interface. The network interface will + * be associated with the specified switch unit number. + * The interface id and name will be assigned by the kernel module. + */ +typedef struct kcom_msg_netif_create_s { + kcom_msg_hdr_t hdr; + kcom_netif_t netif; +} kcom_msg_netif_create_t; + +/* + * Destroy system network interface. + */ +typedef struct kcom_msg_netif_destroy_s { + kcom_msg_hdr_t hdr; +} kcom_msg_netif_destroy_t; + +/* + * Get list of currently defined system network interfaces. + */ +#ifndef KCOM_NETIF_MAX +#define KCOM_NETIF_MAX 128 +#endif + +typedef struct kcom_msg_netif_list_s { + kcom_msg_hdr_t hdr; + uint32 ifcnt; + uint16 id[KCOM_NETIF_MAX]; +} kcom_msg_netif_list_t; + +/* + * Get detailed network interface information. + */ +typedef struct kcom_msg_netif_get_s { + kcom_msg_hdr_t hdr; + kcom_netif_t netif; +} kcom_msg_netif_get_t; + +/* + * Create new packet filter. + * The filter id will be assigned by the kernel module. + */ +typedef struct kcom_msg_filter_create_s { + kcom_msg_hdr_t hdr; + kcom_filter_t filter; +} kcom_msg_filter_create_t; + +/* + * Destroy packet filter. + */ +typedef struct kcom_msg_filter_destroy_s { + kcom_msg_hdr_t hdr; +} kcom_msg_filter_destroy_t; + +/* + * Get list of currently defined packet filters. + */ +#ifndef KCOM_FILTER_MAX +/* OPENNSL_FIXUP - Increased the filters to 1024 from 128 */ +#define KCOM_FILTER_MAX 1024 +#endif + +typedef struct kcom_msg_filter_list_s { + kcom_msg_hdr_t hdr; + uint32 fcnt; + uint16 id[KCOM_FILTER_MAX]; +} kcom_msg_filter_list_t; + +/* + * Get detailed packet filter information. + */ +typedef struct kcom_msg_filter_get_s { + kcom_msg_hdr_t hdr; + kcom_filter_t filter; +} kcom_msg_filter_get_t; + +/* + * DMA info + */ +typedef struct kcom_msg_dma_info_s { + kcom_msg_hdr_t hdr; + kcom_dma_info_t dma_info; +} kcom_msg_dma_info_t; + + +/* + * All messages (e.g. for generic receive) + */ + +typedef union kcom_msg_s { + kcom_msg_hdr_t hdr; + kcom_msg_version_t version; + kcom_msg_string_t string; + kcom_msg_hw_reset_t hw_reset; + kcom_msg_hw_init_t hw_init; + kcom_msg_eth_hw_config_t eth_hw_config; + kcom_msg_detach_t detach; + kcom_msg_netif_create_t netif_create; + kcom_msg_netif_destroy_t netif_destroy; + kcom_msg_netif_list_t netif_list; + kcom_msg_netif_get_t netif_get; + kcom_msg_filter_create_t filter_create; + kcom_msg_filter_destroy_t filter_destroy; + kcom_msg_filter_list_t filter_list; + kcom_msg_filter_get_t filter_get; + kcom_msg_dma_info_t dma_info; + kcom_msg_dbg_pkt_set_t dbg_pkt_set; + kcom_msg_dbg_pkt_get_t dbg_pkt_get; +} kcom_msg_t; + + +/* + * KCOM communication channel vectors + * + * open + * Open KCOM channel. + * + * close + * Close KCOM channel. + * + * send + * Send KCOM message. If bufsz is non-zero, a synchronous send will be + * performed (if supported) and the function will return the number of + * bytes in the response. + * + * recv + * Receive KCOM message. This function is used t oreceive unsolicited + * messages from the kernel. If synchronous send is not supported, this + * function is also used to retrieve responses to command messages. + */ + +typedef struct kcom_chan_s { + void *(*open)(char *name); + int (*close)(void *handle); + int (*send)(void *handle, void *msg, unsigned int len, unsigned int bufsz); + int (*recv)(void *handle, void *msg, unsigned int bufsz); +} kcom_chan_t; + +#endif /* _KCOM_H */ diff --git a/platform/broadcom/saibcm-modules/include/sal/core/sync.h b/platform/broadcom/saibcm-modules/include/sal/core/sync.h new file mode 100644 index 000000000000..edac848b504b --- /dev/null +++ b/platform/broadcom/saibcm-modules/include/sal/core/sync.h @@ -0,0 +1,39 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: sync.h,v 1.1 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ + +#ifndef _SAL_SYNC_H +#define _SAL_SYNC_H + +typedef struct sal_sem_s{ + char sal_opaque_type; +} *sal_sem_t; + +#define sal_sem_FOREVER (-1) +#define sal_sem_BINARY 1 +#define sal_sem_COUNTING 0 + +sal_sem_t sal_sem_create(char *desc, int binary, int initial_count); +void sal_sem_destroy(sal_sem_t b); +int sal_sem_take(sal_sem_t b, int usec); +int sal_sem_give(sal_sem_t b); + +#endif /* !_SAL_SYNC_H */ diff --git a/platform/broadcom/saibcm-modules/include/sal/core/thread.h b/platform/broadcom/saibcm-modules/include/sal/core/thread.h new file mode 100644 index 000000000000..1bccb1aaa3ab --- /dev/null +++ b/platform/broadcom/saibcm-modules/include/sal/core/thread.h @@ -0,0 +1,31 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: thread.h,v 1.1 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ + +#ifndef _SAL_THREAD_H +#define _SAL_THREAD_H + +#include + +void sal_usleep(uint32 usec); +void sal_udelay(uint32 usec); + +#endif /* !_SAL_THREAD_H */ diff --git a/platform/broadcom/saibcm-modules/include/sal/types.h b/platform/broadcom/saibcm-modules/include/sal/types.h new file mode 100644 index 000000000000..29e6fc6522a0 --- /dev/null +++ b/platform/broadcom/saibcm-modules/include/sal/types.h @@ -0,0 +1,156 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: types.h,v 1.3 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + * + * File: types.h + * Purpose: SAL type definitions + */ + +#ifndef _SAL_TYPES_H +#define _SAL_TYPES_H + +/* + * Define platform-independent types + */ + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef DONT_CARE +#define DONT_CARE 0 +#endif + +#define VOL volatile + +/* + * 64-bit type + */ + +#ifdef LONGS_ARE_64BITS + +#define COMPILER_64BIT +#define COMPILER_UINT64 unsigned long +#define u64_H(v) (((uint32 *) &(v))[u64_MSW]) +#define u64_L(v) (((uint32 *) &(v))[u64_LSW]) + +#else /* !LONGS_ARE_64BITS */ + +#define COMPILER_64BIT +#define COMPILER_UINT64 unsigned long long +#define u64_H(v) (((uint32 *) &(v))[u64_MSW]) +#define u64_L(v) (((uint32 *) &(v))[u64_LSW]) + +#endif /* LONGS_ARE_64BITS */ + +/* + * Define unsigned and signed integers with guaranteed sizes. + * Adjust if your compiler uses different sizes for short or int. + */ + +typedef unsigned char uint8; /* 8-bit quantity */ +typedef unsigned short uint16; /* 16-bit quantity */ +typedef unsigned int uint32; /* 32-bit quantity */ +typedef COMPILER_UINT64 uint64; /* 64-bit quantity */ + +typedef signed char int8; /* 8-bit quantity */ +typedef signed short int16; /* 16-bit quantity */ +typedef signed int int32; /* 32-bit quantity */ + +#define BITS2BYTES(x) (((x) + 7) / 8) +#define BITS2WORDS(x) (((x) + 31) / 32) + +#define BYTES2BITS(x) ((x) * 8) +#define BYTES2WORDS(x) (((x) + 3) / 4) + +#define WORDS2BITS(x) ((x) * 32) +#define WORDS2BYTES(x) ((x) * 4) + +#define COUNTOF(ary) ((int) (sizeof (ary) / sizeof ((ary)[0]))) + +typedef uint32 sal_paddr_t; /* Physical address (PCI address) */ + +#ifdef PTRS_ARE_64BITS +typedef uint64 sal_vaddr_t; /* Virtual address (Host address) */ +#define PTR_TO_INT(x) ((uint32)(((sal_vaddr_t)(x))&0xFFFFFFFF)) +#else +typedef uint32 sal_vaddr_t; /* Virtual address (Host address) */ +#define PTR_TO_INT(x) ((uint32)(x)) +#endif + +#define INT_TO_PTR(x) ((void *)((sal_vaddr_t)(x))) + +#define PTR_TO_UINTPTR(x) ((sal_vaddr_t)(x)) +#define UINTPTR_TO_PTR(x) ((void *)(x)) + +typedef union +{ + uint8 u8; + uint16 u16; + uint32 u32; + uint64 u64; + sal_paddr_t paddr; + sal_vaddr_t vaddr; + void *ptr; +} any_t; + +/* Device bus types */ +#define SAL_PCI_DEV_TYPE 0x00001 /* PCI device */ +#define SAL_SPI_DEV_TYPE 0x00002 /* SPI device */ +#define SAL_EB_DEV_TYPE 0x00004 /* EB device */ +#define SAL_ICS_DEV_TYPE 0x00008 /* ICS device */ +#define SAL_MII_DEV_TYPE 0x00010 /* MII device */ +#define SAL_RCPU_DEV_TYPE 0x00020 /* RCPU device */ +#define SAL_I2C_DEV_TYPE 0x00040 /* I2C device */ +#define SAL_AXI_DEV_TYPE 0x00080 /* AXI device */ +#define SAL_EMMI_DEV_TYPE 0x10000 /* EMMI device */ +#define SAL_DEV_BUS_TYPE_MASK 0xf00ff /* Odd for historical reasons */ + +/* Device types */ +#define SAL_SWITCH_DEV_TYPE 0x00100 /* Switch device */ +#define SAL_ETHER_DEV_TYPE 0x00200 /* Ethernet device */ +#define SAL_CPU_DEV_TYPE 0x00400 /* CPU device */ +#define SAL_DEV_TYPE_MASK 0x00f00 + +/* Access types */ +#define SAL_DEV_BUS_RD_16BIT 0x01000 /* 16 bit reads on bus */ +#define SAL_DEV_BUS_WR_16BIT 0x02000 /* 16 bit writes on bus */ +#define SAL_DEV_BUS_ALT 0x04000 /* Alternate access */ +#define SAL_DEV_BUS_MSI 0x08000 /* Message-signaled interrupts */ +#define SAL_DEV_FLAG_MASK 0x0f000 + +/* BDE reserved mask (cannot be used by SAL) */ +#define SAL_DEV_BDE_MASK 0xff000000 + +/* Backward compatibility */ +#define SAL_ET_DEV_TYPE SAL_MII_DEV_TYPE + +/* Special access addresses */ +#define SAL_DEV_OP_EMMI_INIT 0x0fff1000 + +#endif /* !_SAL_TYPES_H */ diff --git a/platform/broadcom/saibcm-modules/include/sdk_config.h b/platform/broadcom/saibcm-modules/include/sdk_config.h new file mode 100644 index 000000000000..5a1bcaddfc40 --- /dev/null +++ b/platform/broadcom/saibcm-modules/include/sdk_config.h @@ -0,0 +1,46 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: sdk_config.h,v 1.5 Broadcom SDK $ + * $Copyright: (c) 2006 Broadcom Corp. + * All Rights Reserved.$ + * + * + */ + +#ifndef __SDK_CONFIG_H__ +#define __SDK_CONFIG_H__ + +/* + * Include custom overrides + */ +#ifdef SDK_INCLUDE_CUSTOM_CONFIG +#include +#endif + + +/* + * Memory Barrier operation if required. + * Defaults to nothing. + */ +#ifndef SDK_CONFIG_MEMORY_BARRIER +#define SDK_CONFIG_MEMORY_BARRIER +#endif + + + +#endif /* __SDK_CONFIG_H__ */ diff --git a/platform/broadcom/saibcm-modules/include/soc/cmic.h b/platform/broadcom/saibcm-modules/include/soc/cmic.h new file mode 100644 index 000000000000..c6cfc25c7595 --- /dev/null +++ b/platform/broadcom/saibcm-modules/include/soc/cmic.h @@ -0,0 +1,38 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: cmic.h,v 1.1 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + * + * File: cmic.h + * Purpose: Maps out structures used for CMIC operations and + * exports routines and constants. + */ + +#ifndef _SOC_CMIC_H +#define _SOC_CMIC_H + +/* IRQ Register (RO) */ +#define CMIC_IRQ_STAT 0x00000144 + +/* IRQ Mask Registers (R/W) */ +#define CMIC_IRQ_MASK 0x00000148 +#define CMIC_IRQ_MASK_1 0x0000006C +#define CMIC_IRQ_MASK_2 0x00000070 + +#endif /* !_SOC_CMIC_H */ diff --git a/platform/broadcom/saibcm-modules/include/soc/devids.h b/platform/broadcom/saibcm-modules/include/soc/devids.h new file mode 100644 index 000000000000..69fba7777c1a --- /dev/null +++ b/platform/broadcom/saibcm-modules/include/soc/devids.h @@ -0,0 +1,1948 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * Copyright: (c) 2017 Broadcom Corp. + * All Rights Reserved. + */ + +#ifndef _SOC_DEVIDS_H +#define _SOC_DEVIDS_H + + +#define BROADCOM_VENDOR_ID 0x14e4 + +#define BCM5690_DEVICE_ID 0x5690 +#define BCM5690_A0_REV_ID 1 +#define BCM5690_A1_REV_ID 2 +#define BCM5690_A2_REV_ID 3 + +#define BCM5691_DEVICE_ID 0x5691 +#define BCM5691_A0_REV_ID 1 +#define BCM5691_A1_REV_ID 2 +#define BCM5691_A2_REV_ID 3 + +#define BCM5692_DEVICE_ID 0x5692 +#define BCM5692_A0_REV_ID 1 +#define BCM5692_A1_REV_ID 2 +#define BCM5692_A2_REV_ID 3 + +#define BCM5693_DEVICE_ID 0x5693 +#define BCM5693_A0_REV_ID 1 +#define BCM5693_A1_REV_ID 2 +#define BCM5693_A2_REV_ID 3 + +#define BCM5695_DEVICE_ID 0x5695 +#define BCM5695_A0_REV_ID 1 +#define BCM5695_A1_REV_ID 2 +#define BCM5695_B0_REV_ID 0x11 + +#define BCM5696_DEVICE_ID 0x5696 +#define BCM5696_A0_REV_ID 1 +#define BCM5696_A1_REV_ID 2 +#define BCM5696_B0_REV_ID 0x11 + +#define BCM5697_DEVICE_ID 0x5697 +#define BCM5697_A0_REV_ID 1 +#define BCM5697_A1_REV_ID 2 +#define BCM5697_B0_REV_ID 0x11 + +#define BCM5698_DEVICE_ID 0x5698 +#define BCM5698_A0_REV_ID 1 +#define BCM5698_A1_REV_ID 2 +#define BCM5698_B0_REV_ID 0x11 + +#define BCM5670_DEVICE_ID 0x5670 +#define BCM5670_A0_REV_ID 1 +#define BCM5670_A1_REV_ID 2 + +#define BCM5671_DEVICE_ID 0x5671 +#define BCM5671_A0_REV_ID 1 +#define BCM5671_A1_REV_ID 2 +#define BCM5671_A2_REV_ID 3 + +#define BCM5675_DEVICE_ID 0x5675 +#define BCM5675_A0_REV_ID 1 +#define BCM5675_A1_REV_ID 2 + +#define BCM5676_DEVICE_ID 0x5676 +#define BCM5676_A0_REV_ID 1 +#define BCM5676_A1_REV_ID 2 + +#define BCM5673_DEVICE_ID 0x5673 +#define BCM5673_A0_REV_ID 1 +#define BCM5673_A1_REV_ID 2 +#define BCM5673_A2_REV_ID 3 + +#define BCM5674_DEVICE_ID 0x5674 +#define BCM5674_A0_REV_ID 1 + +#define BCM56100_DEVICE_ID 0xb100 +#define BCM56100_A0_REV_ID 1 +#define BCM56100_A1_REV_ID 2 +#define BCM56101_DEVICE_ID 0xb101 +#define BCM56101_A0_REV_ID 1 +#define BCM56101_A1_REV_ID 2 +#define BCM56102_DEVICE_ID 0xb102 +#define BCM56102_A0_REV_ID 1 +#define BCM56102_A1_REV_ID 2 +#define BCM56105_DEVICE_ID 0xb105 +#define BCM56105_A0_REV_ID 1 +#define BCM56105_A1_REV_ID 2 +#define BCM56106_DEVICE_ID 0xb106 +#define BCM56106_A0_REV_ID 1 +#define BCM56106_A1_REV_ID 2 +#define BCM56107_DEVICE_ID 0xb107 +#define BCM56107_A0_REV_ID 1 +#define BCM56107_A1_REV_ID 2 + +#define BCM56110_DEVICE_ID 0xb110 +#define BCM56110_A0_REV_ID 1 +#define BCM56111_DEVICE_ID 0xb111 +#define BCM56111_A0_REV_ID 1 +#define BCM56112_DEVICE_ID 0xb112 +#define BCM56112_A0_REV_ID 1 +#define BCM56115_DEVICE_ID 0xb115 +#define BCM56115_A0_REV_ID 1 +#define BCM56116_DEVICE_ID 0xb116 +#define BCM56116_A0_REV_ID 1 +#define BCM56117_DEVICE_ID 0xb117 +#define BCM56117_A0_REV_ID 1 + +#define BCM56300_DEVICE_ID 0xb300 +#define BCM56300_A0_REV_ID 1 +#define BCM56300_A1_REV_ID 2 +#define BCM56300_B0_REV_ID 0x11 +#define BCM56300_B1_REV_ID 0x12 +#define BCM56301_DEVICE_ID 0xb301 +#define BCM56301_A0_REV_ID 1 +#define BCM56301_A1_REV_ID 2 +#define BCM56301_B0_REV_ID 0x11 +#define BCM56301_B1_REV_ID 0x12 +#define BCM56302_DEVICE_ID 0xb302 +#define BCM56302_A0_REV_ID 1 +#define BCM56302_A1_REV_ID 2 +#define BCM56302_B0_REV_ID 0x11 +#define BCM56302_B1_REV_ID 0x12 +#define BCM56303_DEVICE_ID 0xb303 +#define BCM56303_A1_REV_ID 2 +#define BCM56303_A0_REV_ID 1 +#define BCM56303_B0_REV_ID 0x11 +#define BCM56303_B1_REV_ID 0x12 +#define BCM56304_DEVICE_ID 0xb304 +#define BCM56304_A0_REV_ID 1 +#define BCM56304_A1_REV_ID 2 +#define BCM56304_B0_REV_ID 0x11 +#define BCM56304_B1_REV_ID 0x12 +#define BCM56404_DEVICE_ID 0xb404 +#define BCM56404_A0_REV_ID 1 +#define BCM56404_A1_REV_ID 2 +#define BCM56305_DEVICE_ID 0xb305 +#define BCM56305_A0_REV_ID 1 +#define BCM56305_A1_REV_ID 2 +#define BCM56305_B0_REV_ID 0x11 +#define BCM56305_B1_REV_ID 0x12 +#define BCM56306_DEVICE_ID 0xb306 +#define BCM56306_A0_REV_ID 1 +#define BCM56306_A1_REV_ID 2 +#define BCM56306_B0_REV_ID 0x11 +#define BCM56306_B1_REV_ID 0x12 +#define BCM56307_DEVICE_ID 0xb307 +#define BCM56307_A0_REV_ID 1 +#define BCM56307_A1_REV_ID 2 +#define BCM56307_B0_REV_ID 0x11 +#define BCM56307_B1_REV_ID 0x12 +#define BCM56308_DEVICE_ID 0xb308 +#define BCM56308_A0_REV_ID 1 +#define BCM56308_A1_REV_ID 2 +#define BCM56308_B0_REV_ID 0x11 +#define BCM56308_B1_REV_ID 0x12 +#define BCM56309_DEVICE_ID 0xb309 +#define BCM56309_A0_REV_ID 1 +#define BCM56309_A1_REV_ID 2 +#define BCM56309_B0_REV_ID 0x11 +#define BCM56309_B1_REV_ID 0x12 + +#define BCM56310_DEVICE_ID 0xb310 +#define BCM56310_A0_REV_ID 1 +#define BCM56311_DEVICE_ID 0xb311 +#define BCM56311_A0_REV_ID 1 +#define BCM56312_DEVICE_ID 0xb312 +#define BCM56312_A0_REV_ID 1 +#define BCM56313_DEVICE_ID 0xb313 +#define BCM56313_A0_REV_ID 1 +#define BCM56314_DEVICE_ID 0xb314 +#define BCM56314_A0_REV_ID 1 +#define BCM56315_DEVICE_ID 0xb315 +#define BCM56315_A0_REV_ID 1 +#define BCM56316_DEVICE_ID 0xb316 +#define BCM56316_A0_REV_ID 1 +#define BCM56317_DEVICE_ID 0xb317 +#define BCM56317_A0_REV_ID 1 +#define BCM56318_DEVICE_ID 0xb318 +#define BCM56318_A0_REV_ID 1 +#define BCM56319_DEVICE_ID 0xb319 +#define BCM56319_A0_REV_ID 1 + +#ifndef EXCLUDE_BCM56324 +#define BCM56322_DEVICE_ID 0xb322 +#define BCM56322_A0_REV_ID 1 +#define BCM56324_DEVICE_ID 0xb324 +#define BCM56324_A0_REV_ID 1 +#endif + +#define BCM53300_DEVICE_ID 0xb006 +#define BCM53300_A0_REV_ID 0x11 +#define BCM53300_A1_REV_ID 0x12 +#define BCM53301_DEVICE_ID 0xb206 +#define BCM53301_A0_REV_ID 0x11 +#define BCM53301_A1_REV_ID 0x12 +#define BCM53302_DEVICE_ID 0xb008 +#define BCM53302_A0_REV_ID 0x11 +#define BCM53302_A1_REV_ID 0x12 + +#define BCM56500_DEVICE_ID 0xb500 +#define BCM56500_A0_REV_ID 1 +#define BCM56500_A1_REV_ID 2 +#define BCM56500_B0_REV_ID 0x11 +#define BCM56500_B1_REV_ID 0x12 +#define BCM56500_B2_REV_ID 0x13 +#define BCM56501_DEVICE_ID 0xb501 +#define BCM56501_A0_REV_ID 1 +#define BCM56501_A1_REV_ID 2 +#define BCM56501_B0_REV_ID 0x11 +#define BCM56501_B1_REV_ID 0x12 +#define BCM56501_B2_REV_ID 0x13 +#define BCM56502_DEVICE_ID 0xb502 +#define BCM56502_A0_REV_ID 1 +#define BCM56502_A1_REV_ID 2 +#define BCM56502_B0_REV_ID 0x11 +#define BCM56502_B1_REV_ID 0x12 +#define BCM56502_B2_REV_ID 0x13 +#define BCM56503_DEVICE_ID 0xb503 +#define BCM56503_A0_REV_ID 1 +#define BCM56503_A1_REV_ID 2 +#define BCM56503_B0_REV_ID 0x11 +#define BCM56503_B1_REV_ID 0x12 +#define BCM56503_B2_REV_ID 0x13 +#define BCM56504_DEVICE_ID 0xb504 +#define BCM56504_A0_REV_ID 1 +#define BCM56504_A1_REV_ID 2 +#define BCM56504_B0_REV_ID 0x11 +#define BCM56504_B1_REV_ID 0x12 +#define BCM56504_B2_REV_ID 0x13 +#define BCM56505_DEVICE_ID 0xb505 +#define BCM56505_A0_REV_ID 1 +#define BCM56505_A1_REV_ID 2 +#define BCM56505_B0_REV_ID 0x11 +#define BCM56505_B1_REV_ID 0x12 +#define BCM56505_B2_REV_ID 0x13 +#define BCM56506_DEVICE_ID 0xb506 +#define BCM56506_A0_REV_ID 1 +#define BCM56506_A1_REV_ID 2 +#define BCM56506_B0_REV_ID 0x11 +#define BCM56506_B1_REV_ID 0x12 +#define BCM56506_B2_REV_ID 0x13 +#define BCM56507_DEVICE_ID 0xb507 +#define BCM56507_A0_REV_ID 1 +#define BCM56507_A1_REV_ID 2 +#define BCM56507_B0_REV_ID 0x11 +#define BCM56507_B1_REV_ID 0x12 +#define BCM56507_B2_REV_ID 0x13 +#define BCM56508_DEVICE_ID 0xb508 +#define BCM56508_A0_REV_ID 1 +#define BCM56508_A1_REV_ID 2 +#define BCM56508_B0_REV_ID 0x11 +#define BCM56508_B1_REV_ID 0x12 +#define BCM56508_B2_REV_ID 0x13 +#define BCM56509_DEVICE_ID 0xb509 +#define BCM56509_A0_REV_ID 1 +#define BCM56509_A1_REV_ID 2 +#define BCM56509_B0_REV_ID 0x11 +#define BCM56509_B1_REV_ID 0x12 +#define BCM56509_B2_REV_ID 0x13 + +#define BCM56600_DEVICE_ID 0xb600 +#define BCM56600_A0_REV_ID 1 +#define BCM56600_B0_REV_ID 0x11 +#define BCM56600_C0_REV_ID 0x21 +#define BCM56601_DEVICE_ID 0xb601 +#define BCM56601_A0_REV_ID 1 +#define BCM56601_B0_REV_ID 0x11 +#define BCM56601_C0_REV_ID 0x21 +#define BCM56602_DEVICE_ID 0xb602 +#define BCM56602_A0_REV_ID 1 +#define BCM56602_B0_REV_ID 0x11 +#define BCM56602_C0_REV_ID 0x21 +#define BCM56603_DEVICE_ID 0xb603 +#define BCM56603_A0_REV_ID 1 +#define BCM56603_B0_REV_ID 0x11 +#define BCM56603_C0_REV_ID 0x21 +#define BCM56605_DEVICE_ID 0xb605 +#define BCM56605_A0_REV_ID 1 +#define BCM56605_B0_REV_ID 0x11 +#define BCM56605_C0_REV_ID 0x21 +#define BCM56606_DEVICE_ID 0xb606 +#define BCM56606_A0_REV_ID 1 +#define BCM56606_B0_REV_ID 0x11 +#define BCM56606_C0_REV_ID 0x21 +#define BCM56607_DEVICE_ID 0xb607 +#define BCM56607_A0_REV_ID 1 +#define BCM56607_B0_REV_ID 0x11 +#define BCM56607_C0_REV_ID 0x21 +#define BCM56608_DEVICE_ID 0xb608 +#define BCM56608_A0_REV_ID 1 +#define BCM56608_B0_REV_ID 0x11 +#define BCM56608_C0_REV_ID 0x21 + +#define BCM56580_DEVICE_ID 0xb580 +#define BCM56580_A0_REV_ID 1 + +#define BCM56700_DEVICE_ID 0xb700 +#define BCM56700_A0_REV_ID 1 +#define BCM56701_DEVICE_ID 0xb701 +#define BCM56701_A0_REV_ID 1 + +#define BCM56800_DEVICE_ID 0xb800 +#define BCM56800_A0_REV_ID 1 +#define BCM56801_DEVICE_ID 0xb801 +#define BCM56801_A0_REV_ID 1 +#define BCM56802_DEVICE_ID 0xb802 +#define BCM56802_A0_REV_ID 1 +#define BCM56803_DEVICE_ID 0xb803 +#define BCM56803_A0_REV_ID 1 + +#define BCM56224_DEVICE_ID 0xb224 +#define BCM56224_A0_REV_ID 1 +#define BCM56224_B0_REV_ID 0x11 +#define BCM56225_DEVICE_ID 0xb225 +#define BCM56225_A0_REV_ID 1 +#define BCM56225_B0_REV_ID 0x11 +#define BCM56226_DEVICE_ID 0xb226 +#define BCM56226_A0_REV_ID 1 +#define BCM56226_B0_REV_ID 0x11 +#define BCM56227_DEVICE_ID 0xb227 +#define BCM56227_A0_REV_ID 1 +#define BCM56227_B0_REV_ID 0x11 +#define BCM56228_DEVICE_ID 0xb228 +#define BCM56228_A0_REV_ID 1 +#define BCM56228_B0_REV_ID 0x11 +#define BCM56229_DEVICE_ID 0xb229 +#define BCM56229_A0_REV_ID 1 +#define BCM56229_B0_REV_ID 0x11 +#define BCM56024_DEVICE_ID 0xb024 +#define BCM56024_A0_REV_ID 1 +#define BCM56024_B0_REV_ID 0x11 +#define BCM56025_DEVICE_ID 0xb025 +#define BCM56025_A0_REV_ID 1 +#define BCM56025_B0_REV_ID 0x11 +#define BCM53724_DEVICE_ID 0xc724 +#define BCM53724_A0_REV_ID 1 +#define BCM53724_B0_REV_ID 0x11 +#define BCM53726_DEVICE_ID 0xc726 +#define BCM53726_A0_REV_ID 1 +#define BCM53726_B0_REV_ID 0x11 + +#define BCM53312_DEVICE_ID 0xc312 +#define BCM53312_A0_REV_ID 1 +#define BCM53312_B0_REV_ID 0x11 +#define BCM53313_DEVICE_ID 0xc313 +#define BCM53313_A0_REV_ID 1 +#define BCM53313_B0_REV_ID 0x11 +#define BCM53314_DEVICE_ID 0xc314 +#define BCM53314_A0_REV_ID 1 +#define BCM53314_B0_REV_ID 0x11 + +#define BCM53322_DEVICE_ID 0xc322 +#define BCM53322_A0_REV_ID 1 +#define BCM53323_DEVICE_ID 0xc323 +#define BCM53323_A0_REV_ID 1 +#define BCM53324_DEVICE_ID 0xc324 +#define BCM53324_A0_REV_ID 1 + + +#define BCM56218_DEVICE_ID 0xB218 +#define BCM56218_A0_REV_ID 1 +#define BCM56218_A1_REV_ID 2 +#define BCM56218_A2_REV_ID 3 +#define BCM56218X_DEVICE_ID 0xc710 +#define BCM56218X_A0_REV_ID 1 +#define BCM56218X_A1_REV_ID 2 +#define BCM56218X_A2_REV_ID 3 +#define BCM56219_DEVICE_ID 0xB219 +#define BCM56219_A0_REV_ID 1 +#define BCM56219_A1_REV_ID 2 +#define BCM56219_A2_REV_ID 3 +#define BCM56218R_DEVICE_ID 0xB21A +#define BCM56218R_A0_REV_ID 1 +#define BCM56218R_A1_REV_ID 2 +#define BCM56218R_A2_REV_ID 3 +#define BCM56219R_DEVICE_ID 0xB21B +#define BCM56219R_A0_REV_ID 1 +#define BCM56219R_A1_REV_ID 2 +#define BCM56219R_A2_REV_ID 3 +#define BCM56214_DEVICE_ID 0xB214 +#define BCM56214_A0_REV_ID 1 +#define BCM56214_A1_REV_ID 2 +#define BCM56214_A2_REV_ID 3 +#define BCM56215_DEVICE_ID 0xB215 +#define BCM56215_A0_REV_ID 1 +#define BCM56215_A1_REV_ID 2 +#define BCM56215_A2_REV_ID 3 +#define BCM56214R_DEVICE_ID 0xB21C +#define BCM56214R_A0_REV_ID 1 +#define BCM56214R_A1_REV_ID 2 +#define BCM56214R_A2_REV_ID 3 +#define BCM56215R_DEVICE_ID 0xB21D +#define BCM56215R_A0_REV_ID 1 +#define BCM56215R_A1_REV_ID 2 +#define BCM56215R_A2_REV_ID 3 +#define BCM56216_DEVICE_ID 0xB216 +#define BCM56216_A0_REV_ID 1 +#define BCM56216_A1_REV_ID 2 +#define BCM56216_A2_REV_ID 3 +#define BCM56217_DEVICE_ID 0xB217 +#define BCM56217_A0_REV_ID 1 +#define BCM56217_A1_REV_ID 2 +#define BCM56217_A2_REV_ID 3 +#define BCM56212_DEVICE_ID 0xB212 +#define BCM56212_A0_REV_ID 1 +#define BCM56212_A1_REV_ID 2 +#define BCM56212_A2_REV_ID 3 +#define BCM56213_DEVICE_ID 0xB213 +#define BCM56213_A0_REV_ID 1 +#define BCM56213_A1_REV_ID 2 +#define BCM56213_A2_REV_ID 3 +#define BCM53718_DEVICE_ID 0xC71A +#define BCM53718_A0_REV_ID 1 +#define BCM53718_A1_REV_ID 2 +#define BCM53718_A2_REV_ID 3 +#define BCM53714_DEVICE_ID 0xC71B +#define BCM53714_A0_REV_ID 1 +#define BCM53714_A1_REV_ID 2 +#define BCM53714_A2_REV_ID 3 +#define BCM53716_DEVICE_ID 0xC716 +#define BCM53716_A0_REV_ID 1 +#define BCM53716_A1_REV_ID 2 +#define BCM53716_A2_REV_ID 3 +#define BCM56018_DEVICE_ID 0xB018 +#define BCM56018_A0_REV_ID 1 +#define BCM56018_A1_REV_ID 2 +#define BCM56018_A2_REV_ID 3 +#define BCM56014_DEVICE_ID 0xB014 +#define BCM56014_A0_REV_ID 1 +#define BCM56014_A1_REV_ID 2 +#define BCM56014_A2_REV_ID 3 + +#define BCM56510_DEVICE_ID 0xb510 +#define BCM56510_A0_REV_ID 1 +#define BCM56511_DEVICE_ID 0xb511 +#define BCM56511_A0_REV_ID 1 +#define BCM56512_DEVICE_ID 0xb512 +#define BCM56512_A0_REV_ID 1 +#define BCM56513_DEVICE_ID 0xb513 +#define BCM56513_A0_REV_ID 1 +#define BCM56514_DEVICE_ID 0xb514 +#define BCM56514_A0_REV_ID 1 +#define BCM56516_DEVICE_ID 0xb516 +#define BCM56516_A0_REV_ID 1 +#define BCM56517_DEVICE_ID 0xb517 +#define BCM56517_A0_REV_ID 1 +#define BCM56518_DEVICE_ID 0xb518 +#define BCM56518_A0_REV_ID 1 +#define BCM56519_DEVICE_ID 0xb519 +#define BCM56519_A0_REV_ID 1 + +#define BCM56620_DEVICE_ID 0xb620 +#define BCM56620_A0_REV_ID 1 +#define BCM56620_A1_REV_ID 2 +#define BCM56620_B0_REV_ID 0x11 +#define BCM56620_B1_REV_ID 0x12 +#define BCM56620_B2_REV_ID 0x13 +#define BCM56624_DEVICE_ID 0xb624 +#define BCM56624_A0_REV_ID 1 +#define BCM56624_A1_REV_ID 2 +#define BCM56624_B0_REV_ID 0x11 +#define BCM56624_B1_REV_ID 0x12 +#define BCM56624_B2_REV_ID 0x13 +#define BCM56626_DEVICE_ID 0xb626 +#define BCM56626_A0_REV_ID 1 +#define BCM56626_A1_REV_ID 2 +#define BCM56626_B0_REV_ID 0x11 +#define BCM56626_B1_REV_ID 0x12 +#define BCM56626_B2_REV_ID 0x13 +#define BCM56628_DEVICE_ID 0xb628 +#define BCM56628_A0_REV_ID 1 +#define BCM56628_A1_REV_ID 2 +#define BCM56628_B0_REV_ID 0x11 +#define BCM56628_B1_REV_ID 0x12 +#define BCM56628_B2_REV_ID 0x13 +#define BCM56629_DEVICE_ID 0xb629 +#define BCM56629_A0_REV_ID 1 +#define BCM56629_A1_REV_ID 2 +#define BCM56629_B0_REV_ID 0x11 +#define BCM56629_B1_REV_ID 0x12 +#define BCM56629_B2_REV_ID 0x13 + +#define BCM56680_DEVICE_ID 0xb680 +#define BCM56680_A0_REV_ID 1 +#define BCM56680_A1_REV_ID 2 +#define BCM56680_B0_REV_ID 0x11 +#define BCM56680_B1_REV_ID 0x12 +#define BCM56680_B2_REV_ID 0x13 +#define BCM56684_DEVICE_ID 0xb684 +#define BCM56684_A0_REV_ID 1 +#define BCM56684_A1_REV_ID 2 +#define BCM56684_B0_REV_ID 0x11 +#define BCM56684_B1_REV_ID 0x12 +#define BCM56684_B2_REV_ID 0x13 +#define BCM56686_DEVICE_ID 0xb686 +#define BCM56686_B0_REV_ID 0x11 +#define BCM56686_B1_REV_ID 0x12 +#define BCM56686_B2_REV_ID 0x13 + +#define BCM56820_DEVICE_ID 0xb820 +#define BCM56820_A0_REV_ID 1 +#define BCM56820_B0_REV_ID 0x11 +#define BCM56821_DEVICE_ID 0xb821 +#define BCM56821_A0_REV_ID 1 +#define BCM56821_B0_REV_ID 0x11 +#define BCM56822_DEVICE_ID 0xb822 +#define BCM56822_A0_REV_ID 1 +#define BCM56822_B0_REV_ID 0x11 +#define BCM56823_DEVICE_ID 0xb823 +#define BCM56823_A0_REV_ID 1 +#define BCM56823_B0_REV_ID 0x11 +#define BCM56825_DEVICE_ID 0xb825 +#define BCM56825_B0_REV_ID 0x11 + +#define BCM56720_DEVICE_ID 0xb720 +#define BCM56720_A0_REV_ID 1 +#define BCM56720_B0_REV_ID 0x11 +#define BCM56721_DEVICE_ID 0xb721 +#define BCM56721_A0_REV_ID 1 +#define BCM56721_B0_REV_ID 0x11 + +#define BCM56725_DEVICE_ID 0xb725 +#define BCM56725_A0_REV_ID 1 +#define BCM56725_B0_REV_ID 0x11 + +#define BCM56630_DEVICE_ID 0xb630 +#define BCM56630_A0_REV_ID 1 +#define BCM56630_B0_REV_ID 0x11 +#define BCM56634_DEVICE_ID 0xb634 +#define BCM56634_A0_REV_ID 1 +#define BCM56634_B0_REV_ID 0x11 +#define BCM56636_DEVICE_ID 0xb636 +#define BCM56636_A0_REV_ID 1 +#define BCM56636_B0_REV_ID 0x11 +#define BCM56638_DEVICE_ID 0xb638 +#define BCM56638_A0_REV_ID 1 +#define BCM56638_B0_REV_ID 0x11 +#define BCM56639_DEVICE_ID 0xb639 +#define BCM56639_A0_REV_ID 1 +#define BCM56639_B0_REV_ID 0x11 + +#define BCM56685_DEVICE_ID 0xb685 +#define BCM56685_A0_REV_ID 1 +#define BCM56685_B0_REV_ID 0x11 +#define BCM56689_DEVICE_ID 0xb689 +#define BCM56689_A0_REV_ID 1 +#define BCM56689_B0_REV_ID 0x11 + +#define BCM56520_DEVICE_ID 0xb520 +#define BCM56520_A0_REV_ID 1 +#define BCM56520_B0_REV_ID 0x11 +#define BCM56521_DEVICE_ID 0xb521 +#define BCM56521_A0_REV_ID 1 +#define BCM56521_B0_REV_ID 0x11 +#define BCM56522_DEVICE_ID 0xb522 +#define BCM56522_A0_REV_ID 1 +#define BCM56522_B0_REV_ID 0x11 +#define BCM56524_DEVICE_ID 0xb524 +#define BCM56524_A0_REV_ID 1 +#define BCM56524_B0_REV_ID 0x11 +#define BCM56526_DEVICE_ID 0xb526 +#define BCM56526_A0_REV_ID 1 +#define BCM56526_B0_REV_ID 0x11 + +#define BCM56534_DEVICE_ID 0xb534 +#define BCM56534_B0_REV_ID 0x11 +#define BCM56538_DEVICE_ID 0xb538 +#define BCM56538_B0_REV_ID 0x11 + +#define BCM56331_DEVICE_ID 0xb331 +#define BCM56331_A0_REV_ID 1 +#define BCM56331_B0_REV_ID 0x11 +#define BCM56331_B1_REV_ID 0x12 +#define BCM56333_DEVICE_ID 0xb333 +#define BCM56333_A0_REV_ID 1 +#define BCM56333_B0_REV_ID 0x11 +#define BCM56333_B1_REV_ID 0x12 +#define BCM56334_DEVICE_ID 0xb334 +#define BCM56334_A0_REV_ID 1 +#define BCM56334_B0_REV_ID 0x11 +#define BCM56334_B1_REV_ID 0x12 +#define BCM56338_DEVICE_ID 0xb338 +#define BCM56338_A0_REV_ID 1 +#define BCM56338_B0_REV_ID 0x11 +#define BCM56338_B1_REV_ID 0x12 + +#define BCM56320_DEVICE_ID 0xb320 +#define BCM56320_A0_REV_ID 1 +#define BCM56320_B0_REV_ID 0x11 +#define BCM56320_B1_REV_ID 0x12 +#define BCM56321_DEVICE_ID 0xb321 +#define BCM56321_A0_REV_ID 1 +#define BCM56321_B0_REV_ID 0x11 +#define BCM56321_B1_REV_ID 0x12 + + +#define BCM56548H_DEVICE_ID 0xB54A +#define BCM56548H_A0_REV_ID 1 +#define BCM56548_DEVICE_ID 0xb548 +#define BCM56548_A0_REV_ID 1 +#define BCM56547_DEVICE_ID 0xb547 +#define BCM56547_A0_REV_ID 1 + +#define BCM56346_DEVICE_ID 0xb346 +#define BCM56346_A0_REV_ID 1 +#define BCM56345_DEVICE_ID 0xb345 +#define BCM56345_A0_REV_ID 1 +#define BCM56344_DEVICE_ID 0xb344 +#define BCM56344_A0_REV_ID 1 +#define BCM56342_DEVICE_ID 0xb342 +#define BCM56342_A0_REV_ID 1 +#define BCM56340_DEVICE_ID 0xb340 +#define BCM56340_A0_REV_ID 1 + +#define BCM56049_DEVICE_ID 0xb049 +#define BCM56049_A0_REV_ID 1 +#define BCM56048_DEVICE_ID 0xb048 +#define BCM56048_A0_REV_ID 1 +#define BCM56047_DEVICE_ID 0xb047 +#define BCM56047_A0_REV_ID 1 + +#define BCM56042_DEVICE_ID 0xb042 +#define BCM56042_A0_REV_ID 1 +#define BCM56041_DEVICE_ID 0xb041 +#define BCM56041_A0_REV_ID 1 +#define BCM56040_DEVICE_ID 0xb040 +#define BCM56040_A0_REV_ID 1 + +#define BCM56132_DEVICE_ID 0xb132 +#define BCM56132_A0_REV_ID 1 +#define BCM56132_B0_REV_ID 0x11 +#define BCM56132_B1_REV_ID 0x12 +#define BCM56134_DEVICE_ID 0xb134 +#define BCM56134_A0_REV_ID 1 +#define BCM56134_B0_REV_ID 0x11 +#define BCM56134_B1_REV_ID 0x12 + +#define BCM56230_DEVICE_ID 0xb230 +#define BCM56230_B1_REV_ID 0x12 +#define BCM56231_DEVICE_ID 0xb231 +#define BCM56231_B1_REV_ID 0x12 + +#define BCM56140_DEVICE_ID 0xb140 +#define BCM56140_A0_REV_ID 1 +#define BCM56142_DEVICE_ID 0xb142 +#define BCM56142_A0_REV_ID 1 +#define BCM56143_DEVICE_ID 0xb143 +#define BCM56143_A0_REV_ID 1 +#define BCM56144_DEVICE_ID 0xb144 +#define BCM56144_A0_REV_ID 1 +#define BCM56146_DEVICE_ID 0xb146 +#define BCM56146_A0_REV_ID 1 +#define BCM56147_DEVICE_ID 0xb147 +#define BCM56147_A0_REV_ID 1 +#define BCM56149_DEVICE_ID 0xb149 +#define BCM56149_A0_REV_ID 1 + +#define BCM56840_DEVICE_ID 0xb840 +#define BCM56840_A0_REV_ID 1 +#define BCM56840_A1_REV_ID 2 +#define BCM56840_A2_REV_ID 3 +#define BCM56840_A3_REV_ID 4 +#define BCM56840_A4_REV_ID 5 +#define BCM56840_B0_REV_ID 0x11 +#define BCM56840_B1_REV_ID 0x12 +#define BCM56841_DEVICE_ID 0xb841 +#define BCM56841_A0_REV_ID 1 +#define BCM56841_A1_REV_ID 2 +#define BCM56841_A2_REV_ID 3 +#define BCM56841_A3_REV_ID 4 +#define BCM56841_A4_REV_ID 5 +#define BCM56841_B0_REV_ID 0x11 +#define BCM56841_B1_REV_ID 0x12 +#define BCM56843_DEVICE_ID 0xb843 +#define BCM56843_A0_REV_ID 1 +#define BCM56843_A1_REV_ID 2 +#define BCM56843_A2_REV_ID 3 +#define BCM56843_A3_REV_ID 4 +#define BCM56843_A4_REV_ID 5 +#define BCM56843_B0_REV_ID 0x11 +#define BCM56843_B1_REV_ID 0x12 +#define BCM56845_DEVICE_ID 0xb845 +#define BCM56845_A0_REV_ID 1 +#define BCM56845_A1_REV_ID 2 +#define BCM56845_A2_REV_ID 3 +#define BCM56845_A3_REV_ID 4 +#define BCM56845_A4_REV_ID 5 +#define BCM56845_B0_REV_ID 0x11 +#define BCM56845_B1_REV_ID 0x12 + +#define BCM56743_DEVICE_ID 0xb743 +#define BCM56743_A0_REV_ID 1 +#define BCM56743_A1_REV_ID 2 +#define BCM56743_A2_REV_ID 3 +#define BCM56743_A3_REV_ID 4 +#define BCM56743_A4_REV_ID 5 +#define BCM56743_B0_REV_ID 0x11 +#define BCM56743_B1_REV_ID 0x12 +#define BCM56745_DEVICE_ID 0xb745 +#define BCM56745_A0_REV_ID 1 +#define BCM56745_A1_REV_ID 2 +#define BCM56745_A2_REV_ID 3 +#define BCM56745_A3_REV_ID 4 +#define BCM56745_A4_REV_ID 5 +#define BCM56745_B0_REV_ID 0x11 +#define BCM56745_B1_REV_ID 0x12 + +#define BCM56260_DEVICE_ID 0xb260 +#define BCM56260_A0_REV_ID 1 +#define BCM56260_B0_REV_ID 0x11 +#define BCM56261_DEVICE_ID 0xb261 +#define BCM56261_A0_REV_ID 1 +#define BCM56261_B0_REV_ID 0x11 +#define BCM56262_DEVICE_ID 0xb262 +#define BCM56262_A0_REV_ID 1 +#define BCM56262_B0_REV_ID 0x11 +#define BCM56263_DEVICE_ID 0xb263 +#define BCM56263_A0_REV_ID 1 +#define BCM56263_B0_REV_ID 0x11 + +#define BCM56265_DEVICE_ID 0xb265 +#define BCM56265_A0_REV_ID 1 +#define BCM56265_B0_REV_ID 0x11 +#define BCM56266_DEVICE_ID 0xb266 +#define BCM56266_A0_REV_ID 1 +#define BCM56266_B0_REV_ID 0x11 +#define BCM56267_DEVICE_ID 0xb267 +#define BCM56267_A0_REV_ID 1 +#define BCM56267_B0_REV_ID 0x11 +#define BCM56268_DEVICE_ID 0xb268 +#define BCM56268_A0_REV_ID 1 +#define BCM56268_B0_REV_ID 0x11 + +#define BCM56233_DEVICE_ID 0xb233 +#define BCM56233_B0_REV_ID 0x11 + +#define BCM56460_DEVICE_ID 0xb460 +#define BCM56460_A0_REV_ID 1 +#define BCM56460_B0_REV_ID 0x11 +#define BCM56461_DEVICE_ID 0xb461 +#define BCM56461_A0_REV_ID 1 +#define BCM56461_B0_REV_ID 0x11 +#define BCM56462_DEVICE_ID 0xb462 +#define BCM56462_A0_REV_ID 1 +#define BCM56462_B0_REV_ID 0x11 +#define BCM56463_DEVICE_ID 0xb463 +#define BCM56463_A0_REV_ID 1 +#define BCM56463_B0_REV_ID 0x11 + +#define BCM56465_DEVICE_ID 0xb465 +#define BCM56465_A0_REV_ID 1 +#define BCM56465_B0_REV_ID 0x11 +#define BCM56466_DEVICE_ID 0xb466 +#define BCM56466_A0_REV_ID 1 +#define BCM56466_B0_REV_ID 0x11 +#define BCM56467_DEVICE_ID 0xb467 +#define BCM56467_A0_REV_ID 1 +#define BCM56467_B0_REV_ID 0x11 +#define BCM56468_DEVICE_ID 0xb468 +#define BCM56468_A0_REV_ID 1 +#define BCM56468_B0_REV_ID 0x11 + +#define BCM56270_DEVICE_ID 0xb270 +#define BCM56270_A0_REV_ID 1 +#define BCM56271_DEVICE_ID 0xb271 +#define BCM56271_A0_REV_ID 1 +#define BCM56272_DEVICE_ID 0xb272 +#define BCM56272_A0_REV_ID 1 + +#define BCM53460_DEVICE_ID 0x8460 +#define BCM53460_A0_REV_ID 1 +#define BCM53461_DEVICE_ID 0x8461 +#define BCM53461_A0_REV_ID 1 + +#define BCM56842_DEVICE_ID 0xb842 +#define BCM56842_A0_REV_ID 1 +#define BCM56842_A1_REV_ID 2 +#define BCM56844_DEVICE_ID 0xb844 +#define BCM56844_A0_REV_ID 1 +#define BCM56844_A1_REV_ID 2 +#define BCM56846_DEVICE_ID 0xb846 +#define BCM56846_A0_REV_ID 1 +#define BCM56846_A1_REV_ID 2 +#define BCM56549_DEVICE_ID 0xb549 +#define BCM56549_A0_REV_ID 1 +#define BCM56549_A1_REV_ID 2 +#define BCM56053_DEVICE_ID 0xb053 +#define BCM56053_A0_REV_ID 1 +#define BCM56053_A1_REV_ID 2 +#define BCM56831_DEVICE_ID 0xb831 +#define BCM56831_A0_REV_ID 1 +#define BCM56831_A1_REV_ID 2 +#define BCM56835_DEVICE_ID 0xb835 +#define BCM56835_A0_REV_ID 1 +#define BCM56835_A1_REV_ID 2 +#define BCM56838_DEVICE_ID 0xb838 +#define BCM56838_A0_REV_ID 1 +#define BCM56838_A1_REV_ID 2 +#define BCM56847_DEVICE_ID 0xb847 +#define BCM56847_A0_REV_ID 1 +#define BCM56847_A1_REV_ID 2 +#define BCM56847_A2_REV_ID 3 +#define BCM56847_A3_REV_ID 4 +#define BCM56847_A4_REV_ID 5 +#define BCM56847_B0_REV_ID 0x11 +#define BCM56847_B1_REV_ID 0x12 +#define BCM56849_DEVICE_ID 0xb849 +#define BCM56849_A0_REV_ID 1 +#define BCM56849_A1_REV_ID 2 + +#define BCM56742_DEVICE_ID 0xb742 +#define BCM56742_A0_REV_ID 1 +#define BCM56742_A1_REV_ID 2 +#define BCM56742_A2_REV_ID 3 +#define BCM56744_DEVICE_ID 0xb744 +#define BCM56744_A0_REV_ID 1 +#define BCM56744_A1_REV_ID 2 +#define BCM56746_DEVICE_ID 0xb746 +#define BCM56746_A0_REV_ID 1 +#define BCM56746_A1_REV_ID 2 + +#define BCM88230_DEVICE_ID 0x0230 +#define BCM88230_A0_REV_ID 1 +#define BCM88230_B0_REV_ID 0x11 +#define BCM88230_C0_REV_ID 0x21 +#define BCM88231_DEVICE_ID 0x0231 +#define BCM88231_A0_REV_ID 1 +#define BCM88231_B0_REV_ID 0x11 +#define BCM88231_C0_REV_ID 0x21 +#define BCM88235_DEVICE_ID 0x0235 +#define BCM88235_A0_REV_ID 1 +#define BCM88235_B0_REV_ID 0x11 +#define BCM88235_C0_REV_ID 0x21 +#define BCM88236_DEVICE_ID 0x0236 +#define BCM88236_A0_REV_ID 1 +#define BCM88236_B0_REV_ID 0x11 +#define BCM88236_C0_REV_ID 0x21 +#define BCM88239_DEVICE_ID 0x0239 +#define BCM88239_A0_REV_ID 1 +#define BCM88239_B0_REV_ID 0x11 +#define BCM88239_C0_REV_ID 0x21 +#define BCM56613_DEVICE_ID 0xb613 +#define BCM56613_A0_REV_ID 1 +#define BCM56613_B0_REV_ID 0x11 +#define BCM56613_C0_REV_ID 0x21 + +#define BCM88732_DEVICE_ID 0x0732 +#define BCM88732_A0_REV_ID 1 +#define BCM88732_A1_REV_ID 2 +#define BCM88732_A2_REV_ID 4 +#define BCM88732_B0_REV_ID 0x11 +#define BCM88732_B1_REV_ID 0x12 +#define BCM88732_B2_REV_ID 0x13 + +#define BCM56640_DEVICE_ID 0xb640 +#define BCM56640_A0_REV_ID 1 +#define BCM56640_A1_REV_ID 2 +#define BCM56640_B0_REV_ID 0x11 +#define BCM56643_DEVICE_ID 0xb643 +#define BCM56643_A0_REV_ID 1 +#define BCM56643_A1_REV_ID 2 +#define BCM56643_B0_REV_ID 0x11 +#define BCM56644_DEVICE_ID 0xb644 +#define BCM56644_A0_REV_ID 1 +#define BCM56644_A1_REV_ID 2 +#define BCM56644_B0_REV_ID 0x11 +#define BCM56648_DEVICE_ID 0xb648 +#define BCM56648_A0_REV_ID 1 +#define BCM56648_A1_REV_ID 2 +#define BCM56648_B0_REV_ID 0x11 +#define BCM56649_DEVICE_ID 0xb649 +#define BCM56649_A0_REV_ID 1 +#define BCM56649_A1_REV_ID 2 +#define BCM56649_B0_REV_ID 0x11 + +#define BCM56540_DEVICE_ID 0xb540 +#define BCM56540_A0_REV_ID 1 +#define BCM56540_A1_REV_ID 2 +#define BCM56540_B0_REV_ID 0x11 +#define BCM56541_DEVICE_ID 0xb541 +#define BCM56541_A0_REV_ID 1 +#define BCM56541_A1_REV_ID 2 +#define BCM56541_B0_REV_ID 0x11 +#define BCM56542_DEVICE_ID 0xb542 +#define BCM56542_A0_REV_ID 1 +#define BCM56542_A1_REV_ID 2 +#define BCM56542_B0_REV_ID 0x11 +#define BCM56543_DEVICE_ID 0xb543 +#define BCM56543_A0_REV_ID 1 +#define BCM56543_A1_REV_ID 2 +#define BCM56543_B0_REV_ID 0x11 +#define BCM56544_DEVICE_ID 0xb544 +#define BCM56544_A0_REV_ID 1 +#define BCM56544_A1_REV_ID 2 +#define BCM56544_B0_REV_ID 0x11 + +#define BCM56545_DEVICE_ID 0xb545 +#define BCM56545_A0_REV_ID 1 +#define BCM56545_A1_REV_ID 2 +#define BCM56545_B0_REV_ID 0x11 +#define BCM56546_DEVICE_ID 0xb546 +#define BCM56546_A0_REV_ID 1 +#define BCM56546_A1_REV_ID 2 +#define BCM56546_B0_REV_ID 0x11 + +#define BCM56044_DEVICE_ID 0xb044 +#define BCM56044_B0_REV_ID 0x11 +#define BCM56045_DEVICE_ID 0xb045 +#define BCM56045_A0_REV_ID 1 +#define BCM56045_A1_REV_ID 2 +#define BCM56045_B0_REV_ID 0x11 +#define BCM56046_DEVICE_ID 0xb046 +#define BCM56046_A0_REV_ID 1 +#define BCM56046_A1_REV_ID 2 +#define BCM56046_B0_REV_ID 0x11 + + +#define BCM56440_DEVICE_ID 0xb440 +#define BCM56440_A0_REV_ID 1 +#define BCM56440_B0_REV_ID 0x11 +#define BCM56441_DEVICE_ID 0xb441 +#define BCM56441_A0_REV_ID 1 +#define BCM56441_B0_REV_ID 0x11 +#define BCM56442_DEVICE_ID 0xb442 +#define BCM56442_A0_REV_ID 1 +#define BCM56442_B0_REV_ID 0x11 +#define BCM56443_DEVICE_ID 0xb443 +#define BCM56443_A0_REV_ID 1 +#define BCM56443_B0_REV_ID 0x11 +#define BCM56445_DEVICE_ID 0xb445 +#define BCM56445_A0_REV_ID 1 +#define BCM56445_B0_REV_ID 0x11 +#define BCM56446_DEVICE_ID 0xb446 +#define BCM56446_A0_REV_ID 1 +#define BCM56446_B0_REV_ID 0x11 +#define BCM56447_DEVICE_ID 0xb447 +#define BCM56447_A0_REV_ID 1 +#define BCM56447_B0_REV_ID 0x11 +#define BCM56448_DEVICE_ID 0xb448 +#define BCM56448_A0_REV_ID 1 +#define BCM56448_B0_REV_ID 0x11 +#define BCM56449_DEVICE_ID 0xb449 +#define BCM56449_A0_REV_ID 1 +#define BCM56449_B0_REV_ID 0x11 +#define BCM56240_DEVICE_ID 0xb240 +#define BCM56240_A0_REV_ID 1 +#define BCM56240_B0_REV_ID 0x11 +#define BCM56241_DEVICE_ID 0xb241 +#define BCM56241_A0_REV_ID 1 +#define BCM56241_B0_REV_ID 0x11 +#define BCM56242_DEVICE_ID 0xb242 +#define BCM56242_A0_REV_ID 1 +#define BCM56242_B0_REV_ID 0x11 +#define BCM56243_DEVICE_ID 0xb243 +#define BCM56243_A0_REV_ID 1 +#define BCM56243_B0_REV_ID 0x11 +#define BCM56245_DEVICE_ID 0xb245 +#define BCM56245_A0_REV_ID 1 +#define BCM56245_B0_REV_ID 0x11 +#define BCM56246_DEVICE_ID 0xb246 +#define BCM56246_A0_REV_ID 1 +#define BCM56246_B0_REV_ID 0x11 +#define BCM55440_DEVICE_ID 0xa440 +#define BCM55440_A0_REV_ID 1 +#define BCM55440_B0_REV_ID 0x11 +#define BCM55441_DEVICE_ID 0xa441 +#define BCM55441_A0_REV_ID 1 +#define BCM55441_B0_REV_ID 0x11 + +#define BCM55450_DEVICE_ID 0xa450 +#define BCM55450_A0_REV_ID 1 +#define BCM55450_B0_REV_ID 0x11 +#define BCM55450_B1_REV_ID 0x12 + +#define BCM55455_DEVICE_ID 0xa455 +#define BCM55455_A0_REV_ID 1 +#define BCM55455_B0_REV_ID 0x11 +#define BCM55455_B1_REV_ID 0x12 + +#define BCM56248_DEVICE_ID 0xb248 +#define BCM56248_A0_REV_ID 1 +#define BCM56248_B0_REV_ID 0x11 +#define BCM56248_B1_REV_ID 0x12 + +#define BCM56450_DEVICE_ID 0xb450 +#define BCM56450_A0_REV_ID 1 +#define BCM56450_B0_REV_ID 0x11 +#define BCM56450_B1_REV_ID 0x12 + +#define BCM56452_DEVICE_ID 0xb452 +#define BCM56452_A0_REV_ID 1 +#define BCM56452_B0_REV_ID 0x11 +#define BCM56452_B1_REV_ID 0x12 + +#define BCM56454_DEVICE_ID 0xb454 +#define BCM56454_A0_REV_ID 1 +#define BCM56454_B0_REV_ID 0x11 +#define BCM56454_B1_REV_ID 0x12 + +#define BCM56455_DEVICE_ID 0xb455 +#define BCM56455_A0_REV_ID 1 +#define BCM56455_B0_REV_ID 0x11 +#define BCM56455_B1_REV_ID 0x12 + +#define BCM56456_DEVICE_ID 0xb456 +#define BCM56456_A0_REV_ID 1 +#define BCM56456_B0_REV_ID 0x11 +#define BCM56456_B1_REV_ID 0x12 + +#define BCM56457_DEVICE_ID 0xb457 +#define BCM56457_A0_REV_ID 1 +#define BCM56457_B0_REV_ID 0x11 +#define BCM56457_B1_REV_ID 0x12 + +#define BCM56458_DEVICE_ID 0xb458 +#define BCM56458_A0_REV_ID 1 +#define BCM56458_B0_REV_ID 0x11 +#define BCM56458_B1_REV_ID 0x12 + +#define BCM56850_DEVICE_ID 0xb850 +#define BCM56850_A0_REV_ID 1 +#define BCM56850_A1_REV_ID 2 +#define BCM56850_A2_REV_ID 3 +#define BCM56851_DEVICE_ID 0xb851 +#define BCM56851_A0_REV_ID 1 +#define BCM56851_A1_REV_ID 2 +#define BCM56851_A2_REV_ID 3 +#define BCM56852_DEVICE_ID 0xb852 +#define BCM56852_A0_REV_ID 1 +#define BCM56852_A1_REV_ID 2 +#define BCM56852_A2_REV_ID 3 +#define BCM56853_DEVICE_ID 0xb853 +#define BCM56853_A0_REV_ID 1 +#define BCM56853_A1_REV_ID 2 +#define BCM56853_A2_REV_ID 3 +#define BCM56854_DEVICE_ID 0xb854 +#define BCM56854_A0_REV_ID 1 +#define BCM56854_A1_REV_ID 2 +#define BCM56854_A2_REV_ID 3 +#define BCM56855_DEVICE_ID 0xb855 +#define BCM56855_A0_REV_ID 1 +#define BCM56855_A1_REV_ID 2 +#define BCM56855_A2_REV_ID 3 +#define BCM56834_DEVICE_ID 0xb834 +#define BCM56834_A0_REV_ID 1 +#define BCM56834_A1_REV_ID 2 +#define BCM56834_A2_REV_ID 3 + +#define BCM56860_DEVICE_ID 0xb860 +#define BCM56860_A0_REV_ID 1 +#define BCM56860_A1_REV_ID 2 +#define BCM56861_DEVICE_ID 0xb861 +#define BCM56861_A0_REV_ID 1 +#define BCM56861_A1_REV_ID 2 +#define BCM56862_DEVICE_ID 0xb862 +#define BCM56862_A0_REV_ID 1 +#define BCM56862_A1_REV_ID 2 +#define BCM56864_DEVICE_ID 0xb864 +#define BCM56864_A0_REV_ID 1 +#define BCM56864_A1_REV_ID 2 +#define BCM56865_DEVICE_ID 0xb865 +#define BCM56865_A0_REV_ID 1 +#define BCM56865_A1_REV_ID 2 +#define BCM56866_DEVICE_ID 0xb866 +#define BCM56866_A0_REV_ID 1 +#define BCM56866_A1_REV_ID 2 +#define BCM56867_DEVICE_ID 0xb867 +#define BCM56867_A0_REV_ID 1 +#define BCM56867_A1_REV_ID 2 +#define BCM56868_DEVICE_ID 0xb868 +#define BCM56868_A0_REV_ID 1 +#define BCM56868_A1_REV_ID 2 +#define BCM56832_DEVICE_ID 0xb832 +#define BCM56832_A0_REV_ID 1 +#define BCM56832_A1_REV_ID 2 +#define BCM56833_DEVICE_ID 0xb833 +#define BCM56833_A0_REV_ID 1 +#define BCM56833_A1_REV_ID 2 +#define BCM56836_DEVICE_ID 0xb836 +#define BCM56836_A0_REV_ID 1 +#define BCM56836_A1_REV_ID 2 + + +#define BCM56750_DEVICE_ID 0xb750 +#define BCM56750_A0_REV_ID 1 +#define BCM56750_A1_REV_ID 2 +#define BCM56750_A2_REV_ID 3 + +#define BCM56830_DEVICE_ID 0xb830 +#define BCM56830_A0_REV_ID 1 +#define BCM56830_A1_REV_ID 2 +#define BCM56830_A2_REV_ID 3 + +#define BCM56150_DEVICE_ID 0xb150 +#define BCM56150_A0_REV_ID 1 +#define BCM56151_DEVICE_ID 0xb151 +#define BCM56151_A0_REV_ID 1 +#define BCM56152_DEVICE_ID 0xb152 +#define BCM56152_A0_REV_ID 1 + +#define BCM53342_DEVICE_ID 0x8342 +#define BCM53342_A0_REV_ID 1 +#define BCM53343_DEVICE_ID 0x8343 +#define BCM53343_A0_REV_ID 1 +#define BCM53344_DEVICE_ID 0x8344 +#define BCM53344_A0_REV_ID 1 +#define BCM53346_DEVICE_ID 0x8346 +#define BCM53346_A0_REV_ID 1 +#define BCM53347_DEVICE_ID 0x8347 +#define BCM53347_A0_REV_ID 1 + +#define BCM53333_DEVICE_ID 0x8333 +#define BCM53333_A0_REV_ID 1 +#define BCM53334_DEVICE_ID 0x8334 +#define BCM53334_A0_REV_ID 1 + +#define BCM53393_DEVICE_ID 0x8393 +#define BCM53393_A0_REV_ID 1 +#define BCM53394_DEVICE_ID 0x8394 +#define BCM53394_A0_REV_ID 1 + +#define BCM53400_DEVICE_ID 0x8400 +#define BCM53400_A0_REV_ID 1 +#define BCM56060_DEVICE_ID 0xb060 +#define BCM56060_A0_REV_ID 1 +#define BCM56062_DEVICE_ID 0xb062 +#define BCM56062_A0_REV_ID 1 +#define BCM56063_DEVICE_ID 0xb063 +#define BCM56063_A0_REV_ID 1 +#define BCM56064_DEVICE_ID 0xb064 +#define BCM56064_A0_REV_ID 1 +#define BCM56065_DEVICE_ID 0xb065 +#define BCM56065_A0_REV_ID 1 +#define BCM56066_DEVICE_ID 0xb066 +#define BCM56066_A0_REV_ID 1 +#define BCM53401_DEVICE_ID 0x8401 +#define BCM53411_DEVICE_ID 0x8411 +#define BCM53401_A0_REV_ID 1 +#define BCM53402_DEVICE_ID 0x8402 +#define BCM53412_DEVICE_ID 0x8412 +#define BCM53402_A0_REV_ID 1 +#define BCM53403_DEVICE_ID 0x8403 +#define BCM53413_DEVICE_ID 0x8413 +#define BCM53403_A0_REV_ID 1 +#define BCM53404_DEVICE_ID 0x8404 +#define BCM53414_DEVICE_ID 0x8414 +#define BCM53404_A0_REV_ID 1 +#define BCM53405_DEVICE_ID 0x8405 +#define BCM53415_DEVICE_ID 0x8415 +#define BCM53405_A0_REV_ID 1 +#define BCM53406_DEVICE_ID 0x8406 +#define BCM53416_DEVICE_ID 0x8416 +#define BCM53406_A0_REV_ID 1 +#define BCM53408_DEVICE_ID 0x8408 +#define BCM53418_DEVICE_ID 0x8418 +#define BCM53408_A0_REV_ID 1 +#define BCM53365_DEVICE_ID 0x8365 +#define BCM53365_A0_REV_ID 1 +#define BCM53369_DEVICE_ID 0x8369 +#define BCM53369_A0_REV_ID 1 + +#define BCM53454_DEVICE_ID 0x8454 +#define BCM53455_DEVICE_ID 0x8455 +#define BCM53454_A0_REV_ID 1 +#define BCM53456_DEVICE_ID 0x8456 +#define BCM53457_DEVICE_ID 0x8457 +#define BCM53456_A0_REV_ID 1 + +#define BCM53422_DEVICE_ID 0x8422 +#define BCM53422_A0_REV_ID 1 +#define BCM53424_DEVICE_ID 0x8424 +#define BCM53424_A0_REV_ID 1 +#define BCM53426_DEVICE_ID 0x8426 +#define BCM53426_A0_REV_ID 1 + +#define BCM56960_DEVICE_ID 0xb960 +#define BCM56960_A0_REV_ID 1 +#define BCM56960_B0_REV_ID 0x11 +#define BCM56960_B1_REV_ID 0x12 +#define BCM56961_DEVICE_ID 0xb961 +#define BCM56961_A0_REV_ID 1 +#define BCM56961_B0_REV_ID 0x11 +#define BCM56961_B1_REV_ID 0x12 +#define BCM56962_DEVICE_ID 0xb962 +#define BCM56962_A0_REV_ID 1 +#define BCM56962_B0_REV_ID 0x11 +#define BCM56962_B1_REV_ID 0x12 +#define BCM56963_DEVICE_ID 0xb963 +#define BCM56963_A0_REV_ID 1 +#define BCM56963_B0_REV_ID 0x11 +#define BCM56963_B1_REV_ID 0x12 +#define BCM56930_DEVICE_ID 0xb930 +#define BCM56930_A0_REV_ID 1 +#define BCM56930_B0_REV_ID 0x11 +#define BCM56930_B1_REV_ID 0x12 +#define BCM56930_C0_REV_ID 0x21 +#define BCM56931_DEVICE_ID 0xb931 +#define BCM56931_A0_REV_ID 1 +#define BCM56931_B0_REV_ID 0x11 +#define BCM56931_C0_REV_ID 0x21 +#define BCM56935_DEVICE_ID 0xb935 +#define BCM56935_A0_REV_ID 1 +#define BCM56935_B0_REV_ID 0x11 +#define BCM56935_C0_REV_ID 0x21 +#define BCM56936_DEVICE_ID 0xb936 +#define BCM56936_A0_REV_ID 1 +#define BCM56936_B0_REV_ID 0x11 +#define BCM56936_C0_REV_ID 0x21 +#define BCM56939_DEVICE_ID 0xb939 +#define BCM56939_A0_REV_ID 1 +#define BCM56939_B0_REV_ID 0x11 +#define BCM56939_C0_REV_ID 0x21 + +#define BCM56168_DEVICE_ID 0xb168 +#define BCM56168_A0_REV_ID 1 +#define BCM56168_B0_REV_ID 0x11 +#define BCM56168_B1_REV_ID 0x12 +#define BCM56169_DEVICE_ID 0xb169 +#define BCM56169_A0_REV_ID 1 +#define BCM56169_B0_REV_ID 0x11 +#define BCM56169_B1_REV_ID 0x12 + +#define BCM56968_DEVICE_ID 0xb968 +#define BCM56968_A0_REV_ID 1 +#define BCM56968_B0_REV_ID 0x11 +#define BCM56968_B1_REV_ID 0x12 + +#define BCM56160_DEVICE_ID 0xb160 +#define BCM56160_A0_REV_ID 1 +#define BCM56160_B0_REV_ID 0x11 +#define BCM56162_DEVICE_ID 0xb162 +#define BCM56162_A0_REV_ID 1 +#define BCM56162_B0_REV_ID 0x11 + +#define BCM56163_DEVICE_ID 0xb163 +#define BCM56163_A0_REV_ID 1 +#define BCM56163_B0_REV_ID 0x11 +#define BCM56164_DEVICE_ID 0xb164 +#define BCM56164_A0_REV_ID 1 +#define BCM56164_B0_REV_ID 0x11 +#define BCM56166_DEVICE_ID 0xb166 +#define BCM56166_A0_REV_ID 1 +#define BCM56166_B0_REV_ID 0x11 + +#define BCM53440_DEVICE_ID 0x8440 +#define BCM53440_A0_REV_ID 1 +#define BCM53440_B0_REV_ID 0x11 +#define BCM53442_DEVICE_ID 0x8442 +#define BCM53442_A0_REV_ID 1 +#define BCM53442_B0_REV_ID 0x11 +#define BCM53443_DEVICE_ID 0x8443 +#define BCM53443_A0_REV_ID 1 +#define BCM53443_B0_REV_ID 0x11 + +#define BCM53434_DEVICE_ID 0x8434 +#define BCM53434_A0_REV_ID 1 +#define BCM53434_B0_REV_ID 0x11 + +#define BCM56560_DEVICE_ID 0xb560 +#define BCM56560_A0_REV_ID 1 +#define BCM56560_B0_REV_ID 0x11 +#define BCM56560_B1_REV_ID 0x12 + +#define BCM56561_DEVICE_ID 0xb561 +#define BCM56561_A0_REV_ID 1 +#define BCM56561_B0_REV_ID 0x11 +#define BCM56561_B1_REV_ID 0x12 + +#define BCM56562_DEVICE_ID 0xb562 +#define BCM56562_A0_REV_ID 1 +#define BCM56562_B0_REV_ID 0x11 +#define BCM56562_B1_REV_ID 0x12 + +#define BCM56565_DEVICE_ID 0xb565 +#define BCM56565_A0_REV_ID 1 +#define BCM56565_B0_REV_ID 0x11 +#define BCM56565_B1_REV_ID 0x12 + +#define BCM56566_DEVICE_ID 0xb566 +#define BCM56566_A0_REV_ID 1 +#define BCM56566_B0_REV_ID 0x11 +#define BCM56566_B1_REV_ID 0x12 + +#define BCM56567_DEVICE_ID 0xb567 +#define BCM56567_A0_REV_ID 1 +#define BCM56567_B0_REV_ID 0x11 +#define BCM56567_B1_REV_ID 0x12 + +#define BCM56568_DEVICE_ID 0xb568 +#define BCM56568_A0_REV_ID 1 +#define BCM56568_B0_REV_ID 0x11 +#define BCM56568_B1_REV_ID 0x12 + +#define BCM56760_DEVICE_ID 0xb760 +#define BCM56760_A0_REV_ID 1 +#define BCM56760_A1_REV_ID 2 +#define BCM56760_B0_REV_ID 0x11 +#define BCM56760_B1_REV_ID 0x12 + +#define BCM56762_DEVICE_ID 0xb762 +#define BCM56762_A0_REV_ID 1 +#define BCM56762_B0_REV_ID 0x11 +#define BCM56762_B1_REV_ID 0x12 + +#define BCM56764_DEVICE_ID 0xb764 +#define BCM56764_A0_REV_ID 1 +#define BCM56764_B0_REV_ID 0x11 +#define BCM56764_B1_REV_ID 0x12 + +#define BCM56765_DEVICE_ID 0xb765 +#define BCM56765_A0_REV_ID 1 +#define BCM56765_B0_REV_ID 0x11 +#define BCM56765_B1_REV_ID 0x12 + +#define BCM56766_DEVICE_ID 0xb766 +#define BCM56766_A0_REV_ID 1 +#define BCM56766_B0_REV_ID 0x11 +#define BCM56766_B1_REV_ID 0x12 + +#define BCM56768_DEVICE_ID 0xb768 +#define BCM56768_A0_REV_ID 1 +#define BCM56768_B0_REV_ID 0x11 +#define BCM56768_B1_REV_ID 0x12 + +#define BCM56068_DEVICE_ID 0xb068 +#define BCM56068_A0_REV_ID 1 +#define BCM56068_B0_REV_ID 0x11 +#define BCM56068_B1_REV_ID 0x12 + +#define BCM56069_DEVICE_ID 0xb069 +#define BCM56069_A0_REV_ID 1 +#define BCM56069_B0_REV_ID 0x11 +#define BCM56069_B1_REV_ID 0x12 + +#define BCM56170_DEVICE_ID 0xb170 +#define BCM56170_A0_REV_ID 1 +#define BCM56172_DEVICE_ID 0xb172 +#define BCM56172_A0_REV_ID 1 +#define BCM56174_DEVICE_ID 0xb174 +#define BCM56174_A0_REV_ID 1 + +#define BCM53570_DEVICE_ID 0x8570 +#define BCM53570_A0_REV_ID 1 +#define BCM53575_DEVICE_ID 0x8575 +#define BCM53575_A0_REV_ID 1 + + +#define BCM56965_DEVICE_ID 0xb965 +#define BCM56965_A0_REV_ID 1 +#define BCM56965_A1_REV_ID 2 +#define BCM56969_DEVICE_ID 0xb969 +#define BCM56969_A0_REV_ID 1 +#define BCM56966_DEVICE_ID 0xb966 +#define BCM56966_A0_REV_ID 1 +#define BCM56967_DEVICE_ID 0xb967 +#define BCM56967_A0_REV_ID 1 + +#define BCM56970_DEVICE_ID 0xb970 +#define BCM56970_A0_REV_ID 1 +#define BCM56970_B0_REV_ID 0x11 +#define BCM56971_DEVICE_ID 0xb971 +#define BCM56971_A0_REV_ID 1 +#define BCM56971_B0_REV_ID 0x11 +#define BCM56972_DEVICE_ID 0xb972 +#define BCM56972_A0_REV_ID 1 +#define BCM56972_B0_REV_ID 0x11 +#define BCM56974_DEVICE_ID 0xb974 +#define BCM56974_A0_REV_ID 1 +#define BCM56974_B0_REV_ID 0x11 + + +#define BCM56870_DEVICE_ID 0xb870 +#define BCM56870_A0_REV_ID 1 +#define BCM56873_DEVICE_ID 0xb873 +#define BCM56873_A0_REV_ID 1 + +#define BCM5665_DEVICE_ID 0x5665 +#define BCM5665_A0_REV_ID 1 +#define BCM5665_B0_REV_ID 0x11 + + +#define BCM5655_DEVICE_ID 0x5655 +#define BCM5655_A0_REV_ID 1 +#define BCM5655_B0_REV_ID 0x11 + + +#define BCM5650_DEVICE_ID 0x5650 +#define BCM5650_A0_REV_ID 1 +#define BCM5650_B0_REV_ID 0x11 +#define BCM5650_C0_REV_ID 0x21 + +#define BROADCOM_PHYID_HIGH 0x0040 + +#define BCM5338_PHYID_LOW 0x62b0 +#define BCM5338_A0_REV_ID 0 +#define BCM5338_A1_REV_ID 1 +#define BCM5338_B0_REV_ID 3 + +#define BCM5324_PHYID_LOW 0xbc20 +#define BCM5324_PHYID_HIGH 0x143 +#define BCM5324_A1_PHYID_HIGH 0x153 +#define BCM5324_DEVICE_ID 0xbc20 +#define BCM5324_A0_REV_ID 0 +#define BCM5324_A1_REV_ID 1 +#define BCM5324_A2_REV_ID 2 + +#define BCM5380_PHYID_LOW 0x6250 +#define BCM5380_A0_REV_ID 0 + +#define BCM5388_PHYID_LOW 0x6288 +#define BCM5388_A0_REV_ID 0 + +#define BCM5396_PHYID_LOW 0xbd70 +#define BCM5396_PHYID_HIGH 0x143 +#define BCM5396_DEVICE_ID 0x96 +#define BCM5396_A0_REV_ID 0 + +#define BCM5389_PHYID_LOW 0xbd70 +#define BCM5389_PHYID_HIGH 0x143 +#define BCM5389_DEVICE_ID 0x89 +#define BCM5389_A0_REV_ID 0 +#define BCM5389_A1_DEVICE_ID 0x86 +#define BCM5389_A1_REV_ID 1 + +#define BCM5398_PHYID_LOW 0xbcd0 +#define BCM5398_PHYID_HIGH 0x0143 +#define BCM5398_DEVICE_ID 0x98 +#define BCM5398_A0_REV_ID 0 + +#define BCM5325_PHYID_LOW 0xbc30 +#define BCM5325_PHYID_HIGH 0x143 +#define BCM5325_DEVICE_ID 0xbc30 +#define BCM5325_A0_REV_ID 0 +#define BCM5325_A1_REV_ID 1 + +#define BCM5348_PHYID_LOW 0xbe40 +#define BCM5348_PHYID_HIGH 0x0143 +#define BCM5348_DEVICE_ID 0x48 +#define BCM5348_A0_REV_ID 0 +#define BCM5348_A1_REV_ID 1 + +#define BCM5397_PHYID_LOW 0xbcd0 +#define BCM5397_PHYID_HIGH 0x0143 +#define BCM5397_DEVICE_ID 0x97 +#define BCM5397_A0_REV_ID 0 + +#define BCM5347_PHYID_LOW 0xbe40 +#define BCM5347_PHYID_HIGH 0x0143 +#define BCM5347_DEVICE_ID 0x47 +#define BCM5347_A0_REV_ID 0 + +#define BCM5395_PHYID_LOW 0xbcf0 +#define BCM5395_PHYID_HIGH 0x0143 +#define BCM5395_DEVICE_ID 0xbcf0 +#define BCM5395_A0_REV_ID 0 + +#define BCM53242_PHYID_LOW 0xbf10 +#define BCM53242_PHYID_HIGH 0x0143 +#define BCM53242_DEVICE_ID 0xbf10 +#define BCM53242_A0_REV_ID 0 +#define BCM53242_B0_REV_ID 4 +#define BCM53242_B1_REV_ID 5 + +#define BCM53262_PHYID_LOW 0xbf20 +#define BCM53262_PHYID_HIGH 0x0143 +#define BCM53262_DEVICE_ID 0xbf20 +#define BCM53262_A0_REV_ID 0 +#define BCM53262_B0_REV_ID 4 +#define BCM53262_B1_REV_ID 5 + +#define BCM53115_PHYID_LOW 0xbf80 +#define BCM53115_PHYID_HIGH 0x0143 +#define BCM53115_DEVICE_ID 0xbf80 +#define BCM53115_A0_REV_ID 0 +#define BCM53115_A1_REV_ID 1 +#define BCM53115_B0_REV_ID 2 +#define BCM53115_B1_REV_ID 3 +#define BCM53115_C0_REV_ID 8 + +#define BCM53118_PHYID_LOW 0xbfe0 +#define BCM53118_PHYID_HIGH 0x0143 +#define BCM53118_DEVICE_ID 0xbfe0 +#define BCM53118_A0_REV_ID 0 + +#define BCM53118_B0_REV_ID 4 +#define BCM53118_B1_REV_ID 5 + +#define BCM53280_PHYID_LOW 0x5e90 +#define BCM53280_PHYID_HIGH 0x0362 +#define BCM53280_DEVICE_ID (0x4 | BCM53280_PHYID_LOW) +#define BCM53280_A0_REV_ID 0 +#define BCM53280_B0_REV_ID 0x4 +#define BCM53280_B1_REV_ID 0x5 +#define BCM53280_B2_REV_ID 0x6 +#define BCM53286_DEVICE_ID (0x4 | BCM53280_PHYID_LOW) +#define BCM53288_DEVICE_ID (0xc | BCM53280_PHYID_LOW) +#define BCM53284_DEVICE_ID (0x7 | BCM53280_PHYID_LOW) +#define BCM53283_DEVICE_ID (0x6 | BCM53280_PHYID_LOW) +#define BCM53282_DEVICE_ID (0x5 | BCM53280_PHYID_LOW) +#define BCM53101_PHYID_LOW 0x5ed0 +#define BCM53101_PHYID_HIGH 0x0362 +#define BCM53101_DEVICE_ID 0x5ed0 +#define BCM53101_A0_REV_ID 0 +#define BCM53101_B0_REV_ID 4 + +#define BCM53125_PHYID_LOW 0x5f20 +#define BCM53125_PHYID_HIGH 0x0362 +#define BCM53125_DEVICE_ID 0x5f20 +#define BCM53125_A0_REV_ID 0 +#define BCM53125_B0_REV_ID 0x4 +#define BCM53125_MODEL_ID 0x53125 + +#define BCM53134_PHYID_LOW 0x5350 +#define BCM53134_PHYID_HIGH 0xAE02 +#define BCM53134_DEVICE_ID 0x5350 +#define BCM53134_A0_REV_ID 0x0 +#define BCM53134_B0_REV_ID 0x1 +#define BCM53134_B1_REV_ID 0x2 +#define BCM53134_A0_MODEL_ID 0x5035 +#define BCM53134_B0_MODEL_ID 0x5075 + +#define BCM53128_PHYID_LOW 0x5e10 +#define BCM53128_PHYID_HIGH 0x0362 +#define BCM53128_DEVICE_ID 0x5e10 +#define BCM53128_A0_REV_ID 0 +#define BCM53128_B0_REV_ID 0x4 +#define BCM53128_MODEL_ID 0x53128 + +#define BCM53600_PHYID_LOW 0x5f40 +#define BCM53600_PHYID_HIGH 0x0362 +#define BCM53600_DEVICE_ID (0x3 | BCM53600_PHYID_LOW) +#define BCM53600_A0_REV_ID 0 +#define BCM53602_DEVICE_ID (0x1 | BCM53600_PHYID_LOW) +#define BCM53603_DEVICE_ID (0x2 | BCM53600_PHYID_LOW) +#define BCM53604_DEVICE_ID (0x3 | BCM53600_PHYID_LOW) +#define BCM53606_DEVICE_ID (0x7 | BCM53600_PHYID_LOW) + +#define BCM89500_PHYID_LOW 0x5d30 +#define BCM89500_PHYID_HIGH 0x0362 +#define BCM89500_DEVICE_ID 0x9500 +#define BCM89501_DEVICE_ID 0x9501 +#define BCM89200_DEVICE_ID 0x9200 +#define BCM89500_A0_REV_ID 0 +#define BCM89500_B0_REV_ID 0x4 +#define BCM89500_MODEL_ID 0x89500 + +#define BCM53010_PHYID_LOW 0x8760 +#define BCM53010_PHYID_HIGH 0x600d +#define BCM53010_DEVICE_ID 0x3010 +#define BCM53011_DEVICE_ID 0x3011 +#define BCM53012_DEVICE_ID 0x3012 +#define BCM53010_A0_REV_ID 0 +#define BCM53010_A2_REV_ID 0x2 +#define BCM53010_MODEL_ID 0x53010 + +#define BCM53018_PHYID_LOW 0x87c0 +#define BCM53018_PHYID_HIGH 0x600d +#define BCM53017_DEVICE_ID 0x3016 +#define BCM53018_DEVICE_ID 0x3018 +#define BCM53019_DEVICE_ID 0x3019 +#define BCM53018_A0_REV_ID 0 +#define BCM53018_MODEL_ID 0x53016 + +#define BCM53020_PHYID_LOW 0x87f0 +#define BCM53020_PHYID_HIGH 0x600d +#define BCM53020_DEVICE_ID 0x8022 +#define BCM53022_DEVICE_ID 0x8022 +#define BCM53023_DEVICE_ID 0x8023 +#define BCM53025_DEVICE_ID 0x8025 +#define BCM58625_DEVICE_ID 0x8625 +#define BCM58622_DEVICE_ID 0x8622 +#define BCM58623_DEVICE_ID 0x8623 +#define BCM58525_DEVICE_ID 0x8525 +#define BCM58522_DEVICE_ID 0x8522 +#define BCM53020_A0_REV_ID 0 +#define BCM53020_MODEL_ID 0x3025 + +#define BCM4713_DEVICE_ID 0x4713 +#define BCM4713_A0_REV_ID 0 +#define BCM4713_A9_REV_ID 9 + +#define BCM53000_GMAC_DEVICE_ID 0x4715 +#define BCM53000_A0_REV_ID 0 + +#define BCM53010_GMAC_DEVICE_ID 0x4715 + +#define BCM53000PCIE_DEVICE_ID 0x5300 + +#define SANDBURST_VENDOR_ID 0x17ba +#define BME3200_DEVICE_ID 0x0280 +#define BME3200_A0_REV_ID 0x0000 +#define BME3200_B0_REV_ID 0x0001 +#define BM9600_DEVICE_ID 0x0480 +#define BM9600_A0_REV_ID 0x0000 +#define BM9600_B0_REV_ID 0x0010 +#define QE2000_DEVICE_ID 0x0300 +#define QE2000_A1_REV_ID 0x0001 +#define QE2000_A2_REV_ID 0x0002 +#define QE2000_A3_REV_ID 0x0003 +#define QE2000_A4_REV_ID 0x0004 +#define BCM88020_DEVICE_ID 0x0380 +#define BCM88020_A0_REV_ID 0x0000 +#define BCM88020_A1_REV_ID 0x0001 +#define BCM88020_A2_REV_ID 0x0002 +#define BCM88025_DEVICE_ID 0x0580 +#define BCM88025_A0_REV_ID 0x0000 +#define BCM88030_DEVICE_ID 0x0038 +#define BCM88030_A0_REV_ID 0x0001 +#define BCM88030_A1_REV_ID 0x0002 +#define BCM88030_B0_REV_ID 0x0011 +#define BCM88030_B1_REV_ID 0x0012 +#define BCM88034_DEVICE_ID 0x0034 +#define BCM88034_A0_REV_ID (BCM88030_A0_REV_ID) +#define BCM88034_A1_REV_ID (BCM88030_A1_REV_ID) +#define BCM88034_B0_REV_ID (BCM88030_B0_REV_ID) +#define BCM88034_B1_REV_ID (BCM88030_B1_REV_ID) +#define BCM88039_DEVICE_ID 0x0039 +#define BCM88039_A0_REV_ID (BCM88030_A0_REV_ID) +#define BCM88039_A1_REV_ID (BCM88030_A1_REV_ID) +#define BCM88039_B0_REV_ID (BCM88030_B0_REV_ID) +#define BCM88039_B1_REV_ID (BCM88030_B1_REV_ID) +#define BCM88130_DEVICE_ID 0x0480 +#define BCM88130_A0_REV_ID 0x0000 +#define BCM88130_A1_REV_ID 0x0001 +#define BCM88130_B0_REV_ID 0x0010 +#define PLX_VENDOR_ID 0x10b5 +#define PLX9656_DEVICE_ID 0x9656 +#define PLX9656_REV_ID 0x0000 +#define PLX9056_DEVICE_ID 0x9056 +#define PLX9056_REV_ID 0x0000 + +#define TK371X_DEVICE_ID 0x8600 +#define TK371X_A0_REV_ID 0x0 + +#define GEDI_DEVICE_ID 0xa100 +#define GEDI_REV_ID 0x0001 +#define ARAD_DEVICE_ID 0x8650 +#define ARAD_A0_REV_ID 0x0000 +#define ARAD_B0_REV_ID 0x0011 +#define ARAD_B1_REV_ID 0x0012 +#define BCM88650_DEVICE_ID ARAD_DEVICE_ID +#define BCM88650_A0_REV_ID ARAD_A0_REV_ID +#define BCM88650_B0_REV_ID ARAD_B0_REV_ID +#define BCM88650_B1_REV_ID ARAD_B1_REV_ID +#define BCM88750_DEVICE_ID 0x8750 +#define BCM88750_A0_REV_ID 0x0000 +#define BCM88750_B0_REV_ID 0x0011 +#define BCM88753_DEVICE_ID 0x8753 +#define BCM88753_A0_REV_ID 0x0000 +#define BCM88753_B0_REV_ID 0x0011 +#define BCM88754_DEVICE_ID 0x8754 +#define BCM88754_A0_REV_ID 0x0000 +#define BCM88754_ORIGINAL_VENDOR_ID 0x16FC +#define BCM88754_ORIGINAL_DEVICE_ID 0x020F +#define BCM88754_A0_ORIGINAL_REV_ID 0x0001 +#define BCM88755_DEVICE_ID 0x8755 +#define BCM88755_B0_REV_ID 0x0011 +#define BCM88770_DEVICE_ID 0x8770 +#define BCM88770_A1_REV_ID 0x0002 +#define BCM88773_DEVICE_ID 0x8773 +#define BCM88773_A1_REV_ID 0x0002 +#define BCM88774_DEVICE_ID 0x8774 +#define BCM88774_A1_REV_ID 0x0002 +#define BCM88775_DEVICE_ID 0x8775 +#define BCM88775_A1_REV_ID 0x0002 +#define BCM88776_DEVICE_ID 0x8776 +#define BCM88776_A1_REV_ID 0x0002 +#define BCM88777_DEVICE_ID 0x8777 +#define BCM88777_A1_REV_ID 0x0002 +#define BCM88950_DEVICE_ID 0x8950 +#define BCM88950_A0_REV_ID 0x0001 +#define BCM88950_A1_REV_ID 0x0002 +#define BCM88953_DEVICE_ID 0x8953 +#define BCM88953_A1_REV_ID 0x0002 +#define BCM88954_DEVICE_ID 0x8954 +#define BCM88954_A1_REV_ID 0x0002 +#define BCM88955_DEVICE_ID 0x8955 +#define BCM88955_A1_REV_ID 0x0002 +#define BCM88956_DEVICE_ID 0x8956 +#define BCM88956_A1_REV_ID 0x0002 +#define BCM88790_DEVICE_ID 0x8790 +#define BCM88790_A0_REV_ID 0x0001 +#define ARADPLUS_DEVICE_ID 0x8660 +#define ARADPLUS_A0_REV_ID 0x0001 +#define BCM88660_DEVICE_ID ARADPLUS_DEVICE_ID +#define BCM88660_A0_REV_ID ARADPLUS_A0_REV_ID +#define JERICHO_DEVICE_ID 0x8675 +#define JERICHO_A0_REV_ID 0x0001 +#define JERICHO_B0_REV_ID 0x0011 +#define JERICHO_A1_REV_ID 0x0002 +#define BCM88670_DEVICE_ID 0x8670 +#define BCM88670_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88670_A1_REV_ID JERICHO_A1_REV_ID +#define BCM88671_DEVICE_ID 0x8671 +#define BCM88671_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88671_A1_REV_ID JERICHO_A1_REV_ID +#define BCM88671M_DEVICE_ID 0x867A +#define BCM88671M_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88671M_A1_REV_ID JERICHO_A1_REV_ID + +#define BCM88670_B0_REV_ID JERICHO_B0_REV_ID +#define BCM88671_B0_REV_ID JERICHO_B0_REV_ID +#define BCM88671M_B0_REV_ID JERICHO_B0_REV_ID + +#define BCM88672_DEVICE_ID 0x8672 +#define BCM88672_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88672_A1_REV_ID JERICHO_A1_REV_ID + +#define BCM88672_B0_REV_ID JERICHO_B0_REV_ID + +#define BCM88673_DEVICE_ID 0x8673 +#define BCM88673_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88673_A1_REV_ID JERICHO_A1_REV_ID +#define BCM88674_DEVICE_ID 0x8674 +#define BCM88674_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88674_A1_REV_ID JERICHO_A1_REV_ID +#define BCM88675_DEVICE_ID JERICHO_DEVICE_ID +#define BCM88675_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88675_A1_REV_ID JERICHO_A1_REV_ID +#define BCM88675M_DEVICE_ID 0x867B +#define BCM88675M_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88675M_A1_REV_ID JERICHO_A1_REV_ID +#define BCM88676_DEVICE_ID 0x8676 +#define BCM88676_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88676_A1_REV_ID JERICHO_A1_REV_ID +#define BCM88676M_DEVICE_ID 0x867C +#define BCM88676M_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88676M_A1_REV_ID JERICHO_A1_REV_ID +#define BCM88677_DEVICE_ID 0x8677 +#define BCM88677_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88677_A1_REV_ID JERICHO_A1_REV_ID +#define BCM88678_DEVICE_ID 0x8678 +#define BCM88678_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88678_A1_REV_ID JERICHO_A1_REV_ID +#define BCM88679_DEVICE_ID 0x8679 +#define BCM88679_A0_REV_ID JERICHO_A0_REV_ID +#define BCM88679_A1_REV_ID JERICHO_A1_REV_ID + +#define BCM88673_B0_REV_ID JERICHO_B0_REV_ID +#define BCM88674_B0_REV_ID JERICHO_B0_REV_ID +#define BCM88675_B0_REV_ID JERICHO_B0_REV_ID +#define BCM88675M_B0_REV_ID JERICHO_B0_REV_ID +#define BCM88676_B0_REV_ID JERICHO_B0_REV_ID +#define BCM88676M_B0_REV_ID JERICHO_B0_REV_ID +#define BCM88677_B0_REV_ID JERICHO_B0_REV_ID +#define BCM88678_B0_REV_ID JERICHO_B0_REV_ID +#define BCM88679_B0_REV_ID JERICHO_B0_REV_ID +#define QMX_DEVICE_ID 0x8375 +#define QMX_A0_REV_ID 0x0001 +#define QMX_B0_REV_ID 0x0011 +#define QMX_A1_REV_ID 0x0002 +#define BCM88370_DEVICE_ID 0x8370 +#define BCM88370_A0_REV_ID QMX_A0_REV_ID +#define BCM88370_A1_REV_ID QMX_A1_REV_ID +#define BCM88371_DEVICE_ID 0x8371 +#define BCM88371_A0_REV_ID QMX_A0_REV_ID +#define BCM88371_A1_REV_ID QMX_A1_REV_ID +#define BCM88371M_DEVICE_ID 0x837A +#define BCM88371M_A0_REV_ID QMX_A0_REV_ID +#define BCM88371M_A1_REV_ID QMX_A1_REV_ID +#define BCM88375_DEVICE_ID QMX_DEVICE_ID +#define BCM88375_A0_REV_ID QMX_A0_REV_ID +#define BCM88375_A1_REV_ID QMX_A1_REV_ID +#define BCM88376_DEVICE_ID 0x8376 +#define BCM88376_A0_REV_ID QMX_A0_REV_ID +#define BCM88376_A1_REV_ID QMX_A1_REV_ID +#define BCM88376M_DEVICE_ID 0x837B +#define BCM88376M_A0_REV_ID QMX_A0_REV_ID +#define BCM88376M_A1_REV_ID QMX_A1_REV_ID +#define BCM88377_DEVICE_ID 0x8377 +#define BCM88377_A0_REV_ID QMX_A0_REV_ID +#define BCM88377_A1_REV_ID QMX_A1_REV_ID +#define BCM88378_DEVICE_ID 0x8378 +#define BCM88378_A0_REV_ID QMX_A0_REV_ID +#define BCM88378_A1_REV_ID QMX_A1_REV_ID +#define BCM88379_DEVICE_ID 0x8379 +#define BCM88379_A0_REV_ID QMX_A0_REV_ID +#define BCM88379_A1_REV_ID QMX_A1_REV_ID + +#define BCM88370_B0_REV_ID QMX_B0_REV_ID +#define BCM88371_B0_REV_ID QMX_B0_REV_ID +#define BCM88371M_B0_REV_ID QMX_B0_REV_ID +#define BCM88375_B0_REV_ID QMX_B0_REV_ID +#define BCM88376_B0_REV_ID QMX_B0_REV_ID +#define BCM88376M_B0_REV_ID QMX_B0_REV_ID +#define BCM88377_B0_REV_ID QMX_B0_REV_ID +#define BCM88378_B0_REV_ID QMX_B0_REV_ID +#define BCM88379_B0_REV_ID QMX_B0_REV_ID + + +#define JERICHO_PLUS_DEVICE_ID 0x8680 +#define JERICHO_PLUS_A0_REV_ID 0x0001 +#define BCM88680_DEVICE_ID JERICHO_PLUS_DEVICE_ID +#define BCM88680_A0_REV_ID JERICHO_PLUS_A0_REV_ID +#define BCM88680_A1_REV_ID 0x0002 + + +#define BCM88681_DEVICE_ID 0x8681 +#define BCM88681_A0_REV_ID JERICHO_PLUS_A0_REV_ID + +#define BCM88682_DEVICE_ID 0x8682 +#define BCM88682_A0_REV_ID JERICHO_PLUS_A0_REV_ID + +#define BCM88683_DEVICE_ID 0x8683 +#define BCM88683_A0_REV_ID JERICHO_PLUS_A0_REV_ID + +#define BCM88684_DEVICE_ID 0x8684 +#define BCM88684_A0_REV_ID JERICHO_PLUS_A0_REV_ID + +#define BCM88685_DEVICE_ID 0x8685 +#define BCM88685_A0_REV_ID JERICHO_PLUS_A0_REV_ID + +#define BCM88380_DEVICE_ID 0x8380 +#define BCM88380_A0_REV_ID JERICHO_PLUS_A0_REV_ID +#define BCM88381_DEVICE_ID 0x8381 +#define BCM88381_A0_REV_ID JERICHO_PLUS_A0_REV_ID + +#define JERICHO_2_DEVICE_ID 0x8690 +#define JERICHO_2_A0_REV_ID 0x0001 +#define BCM88690_DEVICE_ID JERICHO_2_DEVICE_ID +#define BCM88690_A0_REV_ID JERICHO_2_A0_REV_ID + +#define QAX_DEVICE_ID 0x8470 +#define QAX_A0_REV_ID 0x0001 +#define QAX_B0_REV_ID 0x0011 +#define BCM88470_DEVICE_ID QAX_DEVICE_ID +#define BCM88470_B0_REV_ID QAX_B0_REV_ID +#define BCM88470P_DEVICE_ID 0x847C +#define BCM88471_DEVICE_ID 0x8471 +#define BCM88473_DEVICE_ID 0x8473 +#define BCM88474_DEVICE_ID 0x8474 +#define BCM88474H_DEVICE_ID 0x847B +#define BCM88476_DEVICE_ID 0x8476 +#define BCM88477_DEVICE_ID 0x8477 + + + + +#define BCM88470_A0_REV_ID QAX_A0_REV_ID + +#define QUX_DEVICE_ID 0x8270 +#define QUX_A0_REV_ID 0x0001 +#define QUX_A1_REV_ID 0x0002 +#define QUX_B0_REV_ID 0x0011 +#define BCM88270_DEVICE_ID QUX_DEVICE_ID +#define BCM88270_A0_REV_ID QUX_A0_REV_ID +#define BCM88270_A1_REV_ID QUX_A1_REV_ID +#define BCM88272_DEVICE_ID 0x8272 +#define BCM88273_DEVICE_ID 0x8273 +#define BCM88278_DEVICE_ID 0x8278 + +#define FLAIR_DEVICE_ID 0xF000 +#define FLAIR_A0_REV_ID 0x0001 +#define BCM8206_DEVICE_ID FLAIR_DEVICE_ID +#define BCM8206_A0_REV_ID FLAIR_A0_REV_ID + +#define ARDON_DEVICE_ID 0x8202 +#define ARDON_A0_REV_ID 0x0000 +#define BCM88202_DEVICE_ID ARDON_DEVICE_ID +#define BCM88202_A0_REV_ID ARDON_A0_REV_ID +#define ARDON_A1_REV_ID 0x0001 +#define BCM88202_A1_REV_ID ARDON_A1_REV_ID +#define ARDON_A2_REV_ID 0x0002 +#define BCM88202_A2_REV_ID ARDON_A2_REV_ID +#define BCM2801PM_DEVICE_ID 0x2801 +#define BCM2801PM_A0_REV_ID 0x0000 +#define BCM88360_DEVICE_ID 0x8360 +#define BCM88360_A0_REV_ID ARADPLUS_A0_REV_ID +#define BCM88361_DEVICE_ID 0x8361 +#define BCM88361_A0_REV_ID ARADPLUS_A0_REV_ID +#define BCM88363_DEVICE_ID 0x8363 +#define BCM88363_A0_REV_ID ARADPLUS_A0_REV_ID +#define BCM88460_DEVICE_ID 0x8460 +#define BCM88460_A0_REV_ID ARADPLUS_A0_REV_ID +#define BCM88461_DEVICE_ID 0x8461 +#define BCM88461_A0_REV_ID ARADPLUS_A0_REV_ID +#define BCM88560_DEVICE_ID 0x8560 +#define BCM88560_A0_REV_ID ARADPLUS_A0_REV_ID +#define BCM88561_DEVICE_ID 0x8561 +#define BCM88561_A0_REV_ID ARADPLUS_A0_REV_ID +#define BCM88562_DEVICE_ID 0x8562 +#define BCM88562_A0_REV_ID ARADPLUS_A0_REV_ID +#define BCM88661_DEVICE_ID 0x8661 +#define BCM88661_A0_REV_ID ARADPLUS_A0_REV_ID +#define BCM88664_DEVICE_ID 0x8664 +#define BCM88664_A0_REV_ID ARADPLUS_A0_REV_ID + + +#define BCM88350_DEVICE_ID 0x8350 +#define BCM88350_B1_REV_ID ARAD_B1_REV_ID +#define BCM88351_DEVICE_ID 0x8351 +#define BCM88351_B1_REV_ID ARAD_B1_REV_ID +#define BCM88450_DEVICE_ID 0x8450 +#define BCM88450_B1_REV_ID ARAD_B1_REV_ID +#define BCM88451_DEVICE_ID 0x8451 +#define BCM88451_B1_REV_ID ARAD_B1_REV_ID +#define BCM88550_DEVICE_ID 0x8550 +#define BCM88550_B1_REV_ID ARAD_B0_REV_ID +#define BCM88551_DEVICE_ID 0x8551 +#define BCM88551_B1_REV_ID ARAD_B1_REV_ID +#define BCM88552_DEVICE_ID 0x8552 +#define BCM88552_B1_REV_ID ARAD_B1_REV_ID +#define BCM88651_DEVICE_ID 0x8651 +#define BCM88651_B1_REV_ID ARAD_B1_REV_ID +#define BCM88654_DEVICE_ID 0x8654 +#define BCM88654_B1_REV_ID ARAD_B1_REV_ID + +#define BCM88772_DEVICE_ID 0x8772 +#define BCM88952_DEVICE_ID 0x8952 +#define BCM88772_A1_REV_ID 0x0002 +#define BCM88952_A0_REV_ID 0x0001 +#define BCM88952_A1_REV_ID 0x0002 + +#define BCM88752_DEVICE_ID 0x8752 +#define BCM88752_A0_REV_ID 0x0000 +#define BCM88752_B0_REV_ID 0x0011 + + +#define BCM83207_DEVICE_ID 0x3207 +#define BCM83208_DEVICE_ID 0x3208 +#define BCM83207_A0_REV_ID 0x0001 +#define BCM83208_A0_REV_ID 1 + +#define PCP_PCI_VENDOR_ID 0x1172 +#define PCP_PCI_DEVICE_ID 0x4 + +#define ACP_PCI_VENDOR_ID 0x10ee +#define ACP_PCI_DEVICE_ID 0x7011 +#define ACP_PCI_REV_ID 0x0001 +#endif + diff --git a/platform/broadcom/saibcm-modules/make/Make.config b/platform/broadcom/saibcm-modules/make/Make.config new file mode 100644 index 000000000000..d3f83c24c3f0 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Make.config @@ -0,0 +1,364 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Make.config,v 1.3 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# + +ifneq ($(strip $(override-target)),) +override TARGET=$(override-target) +endif + +export TARGET + +# +# Set up the target name, and the target base variables. +# +# target = The full name of the target such as vxworks-bmw +# targetbase = 1st part of target (e.g. vxworks) +# targetplat = 2nd part of target (e.g. x86) if any; otherwise same as 1st +# +target = ${TARGET} +targetsplt = $(subst -, , ${target}) # change hyphens to spaces +targetbase = $(word 1,${targetsplt}) +targetplat = $(subst ${targetbase}-,,${TARGET}) + +# +# Common configuration for all platforms +# (Additional platform-dependent configurations are in Makefile.xxx) +# + +# +# THIS FILE SHOULD NOT BE MODIFIED LOCALLY, to override, add a file +# $SDK/make/Make.local that sets your local settings, and/or provide +# a path to your settings using the MAKE_LOCAL variable. If +# either of these files exists, their values will override those in this makefile. +# +ifdef MAKE_LOCAL +-include ${MAKE_LOCAL} +endif + +-include ${SDK}/make/Make.local + +ifdef ALL_CHIPS + ROBO_CHIPS = 1 + ESW_CHIPS = 1 +else + ifndef ROBO_CHIPS + ESW_CHIPS = 1 + endif +endif # ALL_CHIPS + +# +# By default, turn off the "changing directory" message. +# +MAKEFLAGS += --no-print-directory + +# +# Use gmake by default +# + +include ${SDK}/make/Make.tools +include ${SDK}/make/Makefile.${target} + +# use QUIET=1 to control printing of compilation lines +ifdef QUIET +Q:=@ +else +Q:= +endif + +# +# Suffix to add to the "target" files to allow local builds with different +# flags. Set "target_suffix" to XXX to cause the build to put built objects +# in ${target}${target_suffix}. This allows things like building a debug +# version with different flags. This may also be set in another Makefile. +# + +#target_suffix := + +# +# Optional suffix to add to the build directory and output binary files +# to allow multiple builds to co-exist for various reasons. +# +#chip_suffix := -$(shell echo $(CHIP) | tr A-Z a-z) + +# +# Combined suffixes +# +all_suffix = ${chip_suffix}${target_suffix} + +# +# Default location to place binaries and make depend files for building +# purposes. +# +ifeq "$(HOSTTYPE)" "Windows2000PC" +BLDROOTWITHDRIVE = ${SDK}/build/${target}${all_suffix}${bldroot_suffix} +BLDROOT = ${SDK_NO_DRIVE_NAME}/build/${target}${all_suffix}${bldroot_suffix} +else # ifeq "$(HOSTTYPE)" "Windows2000PC" + +ifndef SDKBUILD +SDKBUILD :=build +endif + +BLDROOT = ${SDK}/${SDKBUILD}/$(if ${BLDCONFIG},${BLDCONFIG}/)${target}${all_suffix}${bldroot_suffix} + +endif # ifeq "$(HOSTTYPE)" "Windows2000PC" + +# This is needed because we cannot include Make.vxworks before Make.config +ifndef DEST_DIR_SUFFIX +export DEST_DIR_SUFFIX :=$(subst $(realpath $(SDK))/systems,,$(realpath $(CURDIR)/$(dir ($(firstword $(MAKEFILE_LIST)))))) +ifeq ($(MAKELEVEL),0) +endif +endif + +ifeq ($(DEST_DIR),) +export DEST_DIR :=${SDK}/${SDKBUILD}$(if ${BLDCONFIG},/${BLDCONFIG})$(DEST_DIR_SUFFIX) +endif + +ifdef LOCALDIR +BLDDIR = ${BLDROOT}/${LOCALDIR} +ifeq "$(HOSTTYPE)" "Windows2000PC" +BLDDIRWITHDRIVE = ${BLDROOTWITHDRIVE}/${LOCALDIR} +endif +else # ifdef LOCALDIR +BLDDIR = ${BLDROOT} +ifeq "$(HOSTTYPE)" "Windows2000PC" +BLDDIRWITHDRIVE = ${BLDROOTWITHDRIVE} +endif +endif # ifdef LOCALDIR + +LIBDIR = ${BLDROOT} + +# +# Export directory, where build objects used by the outside world are +# placed (exported header files, libs, bins) +# +EXPDIR = ${SDK}/export/${target}${all_suffix} + +# +# Standard include paths +# +INCDIR = ${SDK}/include + +# +# Compilation Flags +# +# Flags may be added to (see below) +# + +INCFLAGS = -I${INCDIR} -I${SDK}/systems + +CFLAGS += ${INCFLAGS} +CXXFLAGS += ${INCFLAGS} +CPPFLAGS += ${INCFLAGS} + +# +# Debug #ifdef control +# +# Compiling out #ifdef DEBUG code saves about 1.3% on executable size. +# It is recommended to leave debug enabled when developing applications. +# +ifndef DEBUG_IFDEFS +DEBUG_IFDEFS=TRUE +endif + +ifeq ($(DEBUG_IFDEFS),TRUE) +CFLAGS += -DBROADCOM_DEBUG +CXXFLAGS += -DBROADCOM_DEBUG +CPPFLAGS += -DBROADCOM_DEBUG +endif + +# +# Debug symbol information control +# +ifndef DEBUG_SYMBOLS +DEBUG_SYMBOLS=TRUE +endif + +ifeq ($(DEBUG_SYMBOLS),TRUE) +CFLAGS += -g +CXXFLAGS += -g +CPPFLAGS += -g +endif + +# +# If DEBUG_CFLAGS is set, add its contents to CFLAGS. +# May be useful for setting on the command line or adding to Make.local. +# Example: gmake DEBUG_CFLAGS=-save-temps system.c +# + +ifneq ($(DEBUG_CFLAGS),) +CFLAGS += $(DEBUG_CFLAGS) +CXXFLAGS += $(DEBUG_CFLAGS) +CPPFLAGS += $(DEBUG_CFLAGS) +endif + +# +# Optimization level +# +# Set DEBUG_OPTIMIZE to TRUE (default) to use a normal optimization +# determined by OPTFLAGS_DEFAULT in the platform Makefile. +# Set DEBUG_OPTIMIZE to FALSE to use no optimization, +# strongly recommended when using any debugger. +# Set DEBUG_OPTIMIZE to any other option string to request specific +# optimization flags (for example -O2). +# +ifndef DEBUG_OPTIMIZE +DEBUG_OPTIMIZE=TRUE +endif + +ifeq ($(DEBUG_OPTIMIZE),TRUE) +OPTFLAGS += $(OPTFLAGS_DEFAULT) +else +ifneq ($(DEBUG_OPTIMIZE),FALSE) +OPTFLAGS += $(DEBUG_OPTIMIZE) +endif +endif + +# +# Debug assertion control. +# +# Compiling out assert() saves about 1.1% on executable size, +# however doing so is VERY MUCH discouraged. +# +ifndef DEBUG_ASSERTS +DEBUG_ASSERTS=TRUE +endif + +ifeq ($(DEBUG_ASSERTS),FALSE) +CFLAGS += -DNDEBUG +CXXFLAGS += -DNDEBUG +CPPFLAGS += -DNDEBUG +endif + +# +# GCC pedantic mode. +# +ifeq ($(DEBUG_PEDANTIC),TRUE) +CFGFLAGS += -D__PEDANTIC__ +CFLAGS += --pedantic +CXXFLAGS += --pedantic +endif + +# +# In each directory, build a list of local sources, objects, and headers +# +LSRCS = $(wildcard *.c *.cpp *.s *.cc *.C) +LOBJS = $(addsuffix .o, $(basename ${LSRCS})) +BOBJS = $(addprefix ${BLDDIR}/,${LOBJS}) +LHDRS = $(wildcard *.h *.H) +LDOTIS = $(wildcard *.i) + + +# +# Rule to create object file (build) directory +# + +.PHONY: all install clean distclean + +.PRECIOUS: ${BLDDIR}/.tree + +%/.tree: + @$(ECHO) 'Creating build directory $(dir $@)' + @$(MKDIR) $(dir $@) + @$(ECHO) "Build Directory for ${LOCALDIR} Created" > $@ + +# Rule allowing build through CPP only, creates .E file from .c file. + +%.E: %.c + $Q${CC} -E ${CFLAGS} $< | sed -e '/^ *$$/d' -e p -e d > $@ + +# Rule allowing build through source only, creates .s file from .c file. + +%.s: %.c + $Q${CC} -S ${CFLAGS} $< + +# +# Default Build rules for .c --> .o, leaving the binary in BLDDIR/X.o, +# even if file not built from directory of source. +# +ifeq ($(FAST),1) +${BLDDIR}/%.o: %.c +else +ifdef GENERATE_C_FILES +${BLDDIR}/%.o: %.c +else +${BLDDIR}/%.o: %.c +endif +endif +ifdef QUIET + @${ECHO} Compiling ${LOCALDIR}/$< +endif +ifdef LOCAL_D_FILE + $Q$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< --write-user-dependencies + -@/bin/cp $*.d $(BLDDIR)/$*.d + -@/bin/rm -f $*.d +else + $Q$(CC) -MD -MF $(BLDDIR)/$*.d $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< +endif + @/bin/cp $(BLDDIR)/$*.d $(BLDDIR)/$*.tmp;\ + /bin/sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' \ + < $(BLDDIR)/$*.d >> $(BLDDIR)/$*.tmp; \ + /bin/sed \ + -e 's| \([0-9a-zA-Z]\)| '$(SDK)/$(LOCALDIR)'\/\1|g' \ + -e 's|^\([0-9a-zA-Z]\)|'$(SDK)/$(LOCALDIR)'/\1|g' \ + -e 's| \(\.\.\/\)| '$(SDK)/$(LOCALDIR)'\/\1|g' \ + -e 's|'$(SDK)'|'$$\{SDK\}'|g' \ + -e 's/\w*\/\.\.\/*//g' \ + -e 's/\w*\/\.\.\/*//g' \ + -e 's/\w*\/\.\.\/*//g' \ + < $(BLDDIR)/$*.tmp > $(BLDDIR)/$*.P; \ + /bin/rm -f $(BLDDIR)/$*.d $(BLDDIR)/$*.tmp + +${BLDDIR}/%.o: %.s +ifdef QUIET + @${ECHO} Assembling ${LOCALDIR}/$< +endif + $Q${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c $< -o $@ + +${BLDDIR}/%.o: %.cpp +ifdef QUIET + @${ECHO} Compiling ${LOCALDIR}/$< +endif + $Q${CXX} -c ${CXXFLAGS} -c $< -o $@ + +${BLDDIR}/%.o: %.cc ${BLDDIR}/.tree +ifdef QUIET + @${ECHO} Compiling ${LOCALDIR}/$< +endif + $Q${CXX} -c ${CXXFLAGS} -c $< -o $@ + +# +# Cause "make foo.o" in any subdirectory to put the object in the build +# directory instead of the local directory. +# +%.o: ${BLDDIR}/%.o + @ + +# +# List of directories where built objects live. +# (we are not making the export directories for now) +# +#DIRS = ${BLDDIR} ${EXPDIR}/lib ${EXPDIR}/bin ${EXPDIR}/include +DIRS = ${BLDDIR} + +ifeq (C_COMPILER,$(MAKECMDGOALS)) +C_COMPILER: + @echo $(CC) +endif diff --git a/platform/broadcom/saibcm-modules/make/Make.depend b/platform/broadcom/saibcm-modules/make/Make.depend new file mode 100644 index 000000000000..3d8b8c59d938 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Make.depend @@ -0,0 +1,109 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Make.depend,v 1.14 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# +# Default rule to build dependencies. This builds a x.d file for each +# x.c file that describes the dependencies. We then conditionally include +# the generated .d files. +# + +# +# If making 'clean', do not include any .d files. If they are included, +# gmake intrinsically tries to remake them all. +# +ifeq (,$(findstring clean,$(MAKECMDGOALS))) + +ZFS :=$(wildcard *.zf) +ZFC := $(ZFS:.zf=.c) + +ifdef GENERATE_C_FILES +ifndef GEN_INCS +$(error "GEN_INCS was not defined") +endif + +ZF_GEN = ${SDK}/tools/zFrameCodeGen.pl + +# 1=.zf +define ZFS_RULE +$(1:.zf=Console.c) : $(1:.zf=.c) + @echo updated $$@ from $$? + +$(1:.zf=.c) : $(1) $(ZF_GEN) + @$(PERL) $(ZF_GEN) -s -z . -p . -g $1 -t c + @echo generated ${LOCALDIR}/$$@ from $(1) + @mv $$(*F).cx $$@ + @if [ -e $$(*F)Console.cx ] ; then \ + mv $$(*F)Console.cx $$(*F)Console.c; \ + echo Created $$(*F)Console.c ;\ + fi + @if [ -e $$(*F)Console.hx ] ; then \ + echo Created $(GEN_INCS)/$$(*F)Console.hx ;\ + mv $$(*F)Console.hx $(GEN_INCS)/ ; \ + fi + @mv $$(*F).hx $(GEN_INCS)/ +endef + +$(foreach zf,$(ZFS),$(eval $(call ZFS_RULE,$(zf)))) + +${BLDDIR}/%.P : ${BLDDIR}/.tree %.c + +.PHONY: GENFILES +GENFILES: $(ZFC) + +$(BOBJS) : $(ZFC) + +else +# +# Attempt to build the depend files. If it fails, the depend file is +# removed so that it is not included in later builds. +# +${BLDDIR}/%.P : %.c ${BLDDIR}/.tree + @$(ECHO) Dependencies for ${LOCALDIR}/$< + +${BLDDIR}/%.P : %.cc ${BLDDIR}/.tree + @$(ECHO) Dependencies for ${LOCALDIR}/$< + +endif + +# +# If there are C or C++ files in this directory, include the +# depend files for them. +# + +ifeq ($(findstring _COMPILER,$(MAKECMDGOALS))$(findstring variable,$(MAKECMDGOALS)),) +ifneq ($(strip ${LSRCS}),) +ifneq (,$(findstring .o,$(MAKECMDGOALS))) +-include $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.P)) $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.sig)) +else +-include $(addprefix ${BLDDIR}/,$(addsuffix .P,$(basename $(LSRCS)))) $(addprefix ${BLDDIR}/,$(addsuffix .sig,$(basename $(LSRCS)))) +endif +endif +endif + +endif # !CLEANING + +clean_d:: +ifdef QUIET + @$(ECHO) Cleaning dependencies for ${LOCALDIR} +endif +ifdef GENERATE_C_FILES + $Q$(RM) $(ZFC:%=$(SDK)/$(LOCALDIR)/%) $(ZFC:%.c=$(SDK)/$(LOCALDIR)/%Console.c) +endif + +clean:: clean_d diff --git a/platform/broadcom/saibcm-modules/make/Make.kernlib b/platform/broadcom/saibcm-modules/make/Make.kernlib new file mode 100644 index 000000000000..612b7e3479aa --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Make.kernlib @@ -0,0 +1,70 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Make.kernlib,v 1.7 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# +# Make rules/targets for handling libraries + +.SECONDARY:: ${BOBJS} + +targetlibsoname = ${lib}.so.${SHAREDLIBVER} +targetlibrealname = ${targetlibsoname} +targetlibso = ${LIBDIR}/${targetlibrealname} + +ifeq ($(TOOLS),Borland) + +LIBSUFFIX=lib + +${LIBDIR}/%.lib: ${BORLAND_BOBJS} + $(RM) $@ + $(FOREACH) -subdir "$(LIBDIR)" \ + "tlib $@ $(foreach obj, $(BORLAND_LOBJS), +-$(obj))" + +else # !Borland + +LIBSUFFIX=a + +${LIBDIR}/%.a: ${BOBJS} +ifdef QUIET + @$(ECHO) Building library $(notdir $@) +endif + $Q$(RM) $@ + $Q$(AR) ${ARFLAGS} $@ $(sort ${BOBJS}) +ifeq ($(LINUX_MAKE_SHARED_LIB),1) +ifeq ($(targetbase),unix) + $(CC) -shared -Wl,-soname,${targetlibsoname} -o ${targetlibso} ${BOBJS} -lc +endif +endif # LINUX_MAKE_SHARED_LIB # +endif # !Borland + +targetlib = ${LIBDIR}/${lib}.${LIBSUFFIX} + +all:: ${BLDDIR}/.tree ${targetlib} + +install:: all + +clean:: +ifdef QUIET + @$(ECHO) Cleaning objects for ${LOCALDIR} and ${lib} +endif + $Q$(RM) ${BOBJS} + $Q$(RM) ${targetlib} + $Q$(RM) ${targetlibso} + +distclean:: clean + diff --git a/platform/broadcom/saibcm-modules/make/Make.lib b/platform/broadcom/saibcm-modules/make/Make.lib new file mode 100644 index 000000000000..992a24e6955c --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Make.lib @@ -0,0 +1,81 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Make.lib,v 1.14 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# +# Make rules/targets for handling libraries + +.SECONDARY:: ${BOBJS} + +BOBJS_FAST = ${BOBJS} +BOBJS_MAKE_CMD = + +ifeq ($(FAST),1) + ifneq ($(strip $(BOBJS)),) + BOBJS_FAST = + BOBJS_ARGS = -j9 + BOBJS_MAKE_CMD = pwd && make LSRUN=$(SDK)/tools/lsrun.pl $(BOBJS_ARGS) ${BOBJS} + endif +endif + +ifeq ($(TOOLS),Borland) + +LIBSUFFIX=lib + +${LIBDIR}/%.lib: ${BORLAND_BOBJS} + $(RM) $@ + $(FOREACH) -subdir "$(LIBDIR)" \ + "tlib $@ $(foreach obj, $(BORLAND_LOBJS), +-$(obj))" + +else # !Borland + +ifeq ($(LINUX_MAKE_SHARED_LIB),1) +LIBSUFFIX=so.${SHAREDLIBVER} +else +LIBSUFFIX=a +endif + +targetlib = ${LIBDIR}/${lib}.${LIBSUFFIX} + +all:: ${BLDDIR}/.tree ${targetlib} + +${LIBDIR}/%.${LIBSUFFIX}: ${BOBJS_FAST} + $(BOBJS_MAKE_CMD) +ifdef QUIET + @$(ECHO) Building library $(notdir $@) +endif + $Q$(RM) $@ +ifeq ($(LINUX_MAKE_SHARED_LIB),1) + $(CC) -shared -Wl,-soname,${lib}.${LIBSUFFIX}${EXTRA_LIB_LDFLAGS} -o ${targetlib} ${BOBJS} -lc +else + ${Q}cd $(dir $(word 1,${BOBJS}));$(AR) ${ARFLAGS} $@ $(sort $(notdir ${BOBJS})) +endif + +endif # !Borland + + +install:: all + +clean:: +ifdef QUIET + @$(ECHO) Cleaning objects for ${LOCALDIR} and ${lib} +endif + $Q$(RM) ${BOBJS} + $Q$(RM) ${targetlib} + +distclean:: clean diff --git a/platform/broadcom/saibcm-modules/make/Make.linux b/platform/broadcom/saibcm-modules/make/Make.linux new file mode 100644 index 000000000000..18a6547bc660 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Make.linux @@ -0,0 +1,98 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# +# $Id: Make.linux,v 1.18 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# +# Common make targets for Linux user and kernel builds included by top +# level Linux makefiles +# +# Variables referenced: +# +# LINUX_MAKE_FLAGS +# Additional flags passed to Make +# +# LINUX_MAKE_USER +# Defined: user build +# Undefined: kernel build +# +# LINUX_MAKE_DIR +# Common makefile location, if it is not ../common +# +# + +export DEST_DIR_SUFFIX :=$(subst $(realpath $(SDK))/systems,,$(realpath $(CURDIR)/$(dir ($(firstword $(MAKEFILE_LIST)))))) + +ifeq (,$(kernel_version)) +kernel_version=2_4 +endif + +ifndef LINUX_MAKE_SHARED_LIB +LINUX_MAKE_SHARED_LIB=0 +endif + +ifeq (,$(SHAREDLIBVER)) +SHAREDLIBVER=1 +endif + +ifndef LINUX_MAKE_DIR +ifdef LINUX_MAKE_USER +LINUX_MAKE_DIR := $(SDK)/systems/linux/user/common +else +LINUX_MAKE_DIR := $(SDK)/systems/linux/kernel/common +endif +endif + +ifdef LINUX_MAKE_USER + CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \ + platform=$(platform) bldroot_suffix=/$(platform) kernel_version=$(kernel_version) \ + LINUX_MAKE_SHARED_LIB=$(LINUX_MAKE_SHARED_LIB) SHAREDLIBVER=$(SHAREDLIBVER) +else + export LINUX_MAKE_KERNEL := 1 + CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \ + platform=$(platform) kernel_version=$(kernel_version) +endif + +ifneq (,$(MIPS_TOOLS_DIR)) + CMD += MIPS_TOOLS_DIR=$(MIPS_TOOLS_DIR) +endif + +ifneq (,$(MIPS_CROSS_COMPILE)) + CMD += MIPS_CROSS_COMPILE=$(MIPS_CROSS_COMPILE) +endif + +ifneq (,$(LINUX_INCLUDE)) + CMD += LINUX_INCLUDE=$(LINUX_INCLUDE) +endif + +# gmake does not understand $(CMD) to be a submake +# options are to +$(CMD) or $(MAKE) $(CMD) +# trying the latter +build: + $(MAKE) $(CMD) + +DELIVER clean C_COMPILER CXX_COMPILER variable mod bcm user: + $(MAKE) $(CMD) $@ + +clean_d: clean + +distclean: + $(MAKE) $(CMD) $@ + +.PHONY: build clean distclean clean_d DELIVER variable mod bcm user + diff --git a/platform/broadcom/saibcm-modules/make/Make.local b/platform/broadcom/saibcm-modules/make/Make.local new file mode 100644 index 000000000000..be0603fad775 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Make.local @@ -0,0 +1,2 @@ +#Changing value of this Knet filter +CFGFLAGS += -UKCOM_FILTER_MAX -DKCOM_FILTER_MAX=256 diff --git a/platform/broadcom/saibcm-modules/make/Make.subdirs b/platform/broadcom/saibcm-modules/make/Make.subdirs new file mode 100644 index 000000000000..69363da2ffb2 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Make.subdirs @@ -0,0 +1,45 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Make.subdirs,v 1.8 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# +# Make rules/targets for handling subdirectories + +.PHONY: ${subdirs} + +all:: ${subdirs} +ifdef QUIET + @$(ECHO) Subdirectory build for ${subdirs} +endif + +${subdirs}:: + $Q$(MAKE) -C $@ kernel_version=$(kernel_version) LINUX_MAKE_SHARED_LIB=${LINUX_MAKE_SHARED_LIB} SHAREDLIBVER=${SHAREDLIBVER} + +ifeq "$(HOSTTYPE)" "Windows2000PC" +clean clean_d install distclean:: +ifdef QUIET + @$(ECHO) Subdirectory $@ for ${subdirs} +endif + $Q$(FOREACH) "$(subdirs)" "${MAKE} -C ## $@" +else +clean clean_d install distclean:: +ifdef QUIET + @$(ECHO) Subdirectory $@ for ${subdirs} +endif + @(for name in $(subdirs); do $(MAKE) -C $$name $@; done) +endif diff --git a/platform/broadcom/saibcm-modules/make/Make.tools b/platform/broadcom/saibcm-modules/make/Make.tools new file mode 100644 index 000000000000..c53d9d4276cc --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Make.tools @@ -0,0 +1,39 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Make.tools,v 1.2 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ + +SYSNAME := $(shell uname -s) +HCC ?=/usr/bin/gcc +SED = /bin/sed +COMPRESS = /usr/bin/compress +PERL = /usr/bin/perl +LN = /bin/ln +HOSTTYPE= i386-linux + +# +# Platform Independent +# +MKTOOL = $(PERL) ${SDK}/tools/mktool.pl +RM = $(MKTOOL) -rm +MKDIR = $(MKTOOL) -md +FOREACH = $(MKTOOL) -foreach +CP = $(MKTOOL) -cp +MAKEDEP = $(MKTOOL) -dep +ECHO = $(MKTOOL) -echo +MKBEEP = ${MKTOOL} -beep diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-gto b/platform/broadcom/saibcm-modules/make/Makefile.linux-gto new file mode 100644 index 000000000000..ee45fc26a595 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-gto @@ -0,0 +1,115 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-gto-4_4,v 1.42 Broadcom SDK $ +# $Copyright: (c) 2015 Broadcom Corp. +# All Rights Reserved.$ + +# User must select one platform from below. +ifeq (,$(BUILD_PLATFORM)) +BUILD_PLATFORM=POWERPC_LINUX +endif + +# TOOLCHAIN_BASE_DIR Toolchain base directory for GTO devices +# TARGET_ARCHITECTURE Compiler for target architecture +# KERNDIR Kernel directory for iPROC-CMICd devices +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/gto +TARGET_ARCHITECTURE := powerpc-broadcom-linux-gnuspe +KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/current + + +ifeq (,$(CROSS_COMPILE)) +CROSS_COMPILE := $(TARGET_ARCHITECTURE)- +endif + + +# GTO toolchain +TOOLCHAIN_BIN_DIR := $(TOOLCHAIN_BASE_DIR)/toolchain/host/usr/bin +override PATH := $(TOOLCHAIN_BIN_DIR)/../$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH) +export TOOLCHAIN_BIN_DIR + + +# Default Linux include directory +ifeq (,$(LINUX_INCLUDE)) +LINUX_INCLUDE := $(KERNDIR)/include +endif + +CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 +ENDIAN = BE_HOST=1 +CFGFLAGS += -D$(ENDIAN) +CFGFLAGS += -DBCM_PLATFORM_STRING=\"GTO_MPC8548\" +CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32 + +# Extra variables. +EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) + +ARCH = powerpc +KBUILD_VERBOSE = 1 + +export ARCH KBUILD_VERBOSE + + +# From linux/arch/ppc/Makefile +comma = , +basetarget = $(basename $(notdir $@)) +modname = $(basetarget) + +name-fix = $(subst $(comma),_,$(subst -,_,$1)) +basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" +modname_flags = $(if $(filter 1,$(words $(modname))),\ + -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") + +KFLAG_INCLD = $(TOOLCHAIN_BIN_DIR)/../lib/gcc/$(TARGET_ARCHITECTURE)/4.6.4/include + +ifdef BROADCOM_SVK +ifdef BCM_BME3200_B0 +PLX_PCI2LBUS=1 +endif +ifdef BCM_BM9600_B0 +PLX_PCI2LBUS=1 +endif +ifeq ($PLX_PCI2LBUS, 1) +CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE +endif +endif + +ifdef DPP_CHIPS +CFLAGS += -DDUNE_BCM -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ -D__DUNE_LINUX_BCM_CPU_PCP_DMA__ +CFGFLAGS += -DSOC_CM_FUNCTION +endif + +ifdef DFE_CHIPS +CFLAGS += -DDUNE_BCM -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ +CFGFLAGS += -DSOC_CM_FUNCTION +endif + +ifdef SHADOW_PLX +CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -DSHADOW_SVK +endif + +ifeq (,$(KFLAGS)) +KFLAGS := -D__KERNEL__ -m32 -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/uapi/linux/version.h -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/powerpc -I$(KERNDIR)/arch/powerpc/include -I$(KERNDIR)/include/asm-powerpc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -msoft-float -pipe -ffixed-r2 -mmultiple -mno-altivec -funit-at-a-time -Wa,-me500 -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign +endif + +ifneq (,$(findstring TCL,$(FEATURE_LIST))) +#LINK_STATIC = 0 +#export LINK_STATIC +endif + +ifneq ($(targetplat),user) +include ${SDK}/make/Makefile.linux-kernel-4_4 +endif + diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-gto-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-gto-2_6 new file mode 100644 index 000000000000..0ca62fc01f51 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-gto-2_6 @@ -0,0 +1,271 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-gto-2_6,v 1.42 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ + +# User must select one platform from below.By default WR_LINUX is selected. . +ifeq (,$(BUILD_PLATFORM)) +#BUILD_PLATFORM=ELDK +BUILD_PLATFORM=WR_LINUX +endif + +# Specify the ELDK version you want to use for building SDK. +ifeq (,$(ELDK_VERSION)) +ifeq (ELDK,$(BUILD_PLATFORM)) +ELDK_VERSION=4.0 +endif +endif + +# Specify the KERNEL VERSION you want to use for building SDK. +ifeq (,$(KERN_VER)) +ifeq (ELDK,$(BUILD_PLATFORM)) +KERN_VER=2.6.21.7 +endif +endif + + +# Specify the Windriver Linux version here.For example '2.0' as shown below. +ifeq (WR_LINUX,$(BUILD_PLATFORM)) +ifeq (,$(WRS_LINUX_VERSION)) +WRS_LINUX_VERSION=2.0 +endif +endif + + +#glibc_small and glibc_std have their own cross-compilation tools and and path for these tools are different as implemented below. To enable glibc_small build, line given below should be uncommented. + +#WRL_GLIBC_SMALL=TRUE + +ifeq (2.0,$(WRS_LINUX_VERSION)) +ifeq ($(WRL_GLIBC_SMALL),TRUE) + +ifeq (,$(CROSS_COMPILE)) +CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_small- +endif + +KERNDIR ?=/projects/ntsw-tools/linux/wrslinux_2.0/gto/glibc_small/build/linux-2.6.21-standard + +else + +ifeq (,$(CROSS_COMPILE)) +CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_std- +endif + +KERNDIR ?= /projects/ntsw-tools/linux/wrslinux_2.0/gto/glibc_std/build/linux-2.6.21-standard + +endif + +export WRL_GLIBC_SMALL + +# After this point glibc_std and glibc_small share these flags + +WRLINUX_BASE ?=/tools/windriver/linux_ed/2.0_GA/Linux +TOOLCHAIN_EXEC_PREFIX=$(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2 +TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_EXEC_PREFIX) +WIND_LIC_PROXY=$(WRLINUX_BASE)/setup/x86-linux2/bin +WRLINUX_GNU_PATH = $(WRLINUX_BASE)/gnu/4.1-wrlinux-2.0/x86-linux2/bin +override PATH := $(TOOLCHAIN_EXEC_PREFIX):$(KERNDIR)/../../host-cross/bin:$(KERNDIR)/../../host-cross/powerpc-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH) +export TOOLCHAIN_EXEC_PREFIX TOOLCHAIN_BIN_DIR WIND_LIC_PROXY +endif + + +ifeq (3.0,$(WRS_LINUX_VERSION)) +ifeq ($(WRL_GLIBC_SMALL),TRUE) + +ifeq (,$(CROSS_COMPILE)) +CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_small- +endif + +KERNDIR ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_small/build/linux-broadcom_bcm98548xmc-standard-build +KERNDIR_STD ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_small/build/linux + +else + +ifeq (,$(CROSS_COMPILE)) +CROSS_COMPILE := powerpc-wrs-linux-gnu-ppc_e500v2-glibc_std- +endif + +KERNDIR ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_std_debug/build/linux-broadcom_bcm98548xmc-standard-build +KERNDIR_STD ?=/projects/ntsw-tools/linux/wrslinux_3.0/gto/bcm98548xmc_30_glibc_std_debug/build/linux + +endif + +export WRL_GLIBC_SMALL + +# After this point glibc_std and glibc_small share these flags + +WRLINUX_BASE ?=/tools/windriver/linux_ed/3.0/Linux +TOOLCHAIN_EXEC_PREFIX=$(WRLINUX_BASE)/wrlinux-3.0/layers/wrll-toolchain-4.3-85/powerpc/toolchain/x86-linux2 +TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_EXEC_PREFIX) +WIND_LIC_PROXY=$(WRLINUX_BASE)/setup/x86-linux2/bin +WRLINUX_GNU_PATH = $(WRLINUX_BASE)/wrlinux-3.0/layers/wrll-toolchain-4.3-85/powerpc/toolchain/x86-linux2/bin +override PATH := $(TOOLCHAIN_EXEC_PREFIX):$(KERNDIR_STD)/../../host-cross/bin:$(KERNDIR_STD)/../../host-cross/powerpc-wrs-linux-gnu/bin:$(WRLINUX_GNU_PATH):$(PATH) +export TOOLCHAIN_EXEC_PREFIX TOOLCHAIN_BIN_DIR WIND_LIC_PROXY + +LINUX_INCLUDE_STD := $(KERNDIR_STD)/include + +endif + +ifeq (ELDK,$(BUILD_PLATFORM)) +ifeq (2.6.21.7, $(KERN_VER)) + +ifeq (,$(CROSS_COMPILE)) +CROSS_COMPILE := ppc_85xx- +endif + +ifeq (4.0, $(ELDK_VERSION)) +override PATH := /tools/eldk/4.0/usr/bin:$(PATH) +else +override PATH := /tools/eldk/4.1/usr/bin:$(PATH) +endif +KERNDIR ?= /projects/ntsw-tools/linux/eldk/gto_eldk/linux-2.6.21.7 +endif +endif + +ifeq (ELDK,$(BUILD_PLATFORM)) +ifeq (2.6.24.4, $(KERN_VER)) + +ifeq (,$(CROSS_COMPILE)) +CROSS_COMPILE := ppc_85xx- +endif + +ifeq (4.0, $(ELDK_VERSION)) +override PATH := /tools/eldk/4.0/usr/bin:$(PATH) +else +override PATH := /tools/eldk/4.1/usr/bin:$(PATH) +endif +KERNDIR ?= /projects/ntsw-tools/linux/eldk/gto_eldk/linux-2.6.24.4 +endif +endif + + +ifeq (ELDK,$(BUILD_PLATFORM)) +ifeq (2.6.25, $(KERN_VER)) + +ifeq (,$(CROSS_COMPILE)) +CROSS_COMPILE := ppc_85xx- +endif + +ifeq (4.0, $(ELDK_VERSION)) +override PATH := /tools/eldk/4.0/usr/bin:$(PATH) +else +override PATH := /tools/eldk/4.1/usr/bin:$(PATH) +endif +KERNDIR ?= /projects/ntsw-tools/linux/eldk/gto_eldk/linux-2.6.25 +endif +endif + + +# Default Linux include directory +ifeq (,$(LINUX_INCLUDE)) +LINUX_INCLUDE := $(KERNDIR)/include +endif + +CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 +ENDIAN = BE_HOST=1 +CFGFLAGS += -D$(ENDIAN) +CFGFLAGS += -DBCM_PLATFORM_STRING=\"GTO_MPC8548\" +CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=32 + +# Extra variables. +EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) + +ARCH = powerpc +KBUILD_VERBOSE = 1 + +export ARCH KBUILD_VERBOSE + + +# From linux/arch/ppc/Makefile +comma = , +basetarget = $(basename $(notdir $@)) +modname = $(basetarget) + +name-fix = $(subst $(comma),_,$(subst -,_,$1)) +basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" +modname_flags = $(if $(filter 1,$(words $(modname))),\ + -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") + + +ifeq (,$(KFLAG_INCLD)) +ifeq (4.0,$(ELDK_VERSION)) +ifeq (ELDK,$(BUILD_PLATFORM)) +KFLAG_INCLD = /tools/eldk/4.0/usr/lib/gcc/powerpc-linux/4.0.0/include +endif +endif + +ifeq (4.1,$(ELDK_VERSION)) +ifeq (ELDK,$(BUILD_PLATFORM)) +KFLAG_INCLD = /tools/eldk/4.1/usr/lib/gcc/powerpc-linux/4.0.0/include +endif +endif + +ifeq (2.0,$(WRS_LINUX_VERSION)) +KFLAG_INCLD = $(WRLINUX_GNU_PATH)/../lib/gcc/powerpc-wrs-linux-gnu/4.1.2/include +endif + +ifeq (3.0,$(WRS_LINUX_VERSION)) +KFLAG_INCLD = $(WRLINUX_GNU_PATH)/../lib/gcc/powerpc-wrs-linux-gnu/4.3.2/include +endif +endif + +ifdef BROADCOM_SVK +ifdef BCM_BME3200_B0 +PLX_PCI2LBUS=1 +endif +ifdef BCM_BM9600_B0 +PLX_PCI2LBUS=1 +endif +ifeq ($PLX_PCI2LBUS, 1) +CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE +endif +endif + +ifdef DPP_CHIPS +CFLAGS += -DDUNE_BCM -D__DUNE_LINUX_BCM_CPU_PCP_DMA__ +CFGFLAGS += -DSOC_CM_FUNCTION +endif + +ifdef DFE_CHIPS +CFLAGS += -DDUNE_BCM +CFGFLAGS += -DSOC_CM_FUNCTION +endif + +ifdef SAND_CHIPS +CFLAGS += -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ +endif + +ifdef SHADOW_PLX +CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -DSHADOW_SVK +endif + +ifeq (,$(KFLAGS)) +KFLAGS := -D__KERNEL__ -m32 -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/linux/version.h -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/powerpc -I$(KERNDIR)/arch/powerpc -I$(KERNDIR)/arch/powerpc/include -I$(KERNDIR)/include/asm-powerpc -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -msoft-float -pipe -ffixed-r2 -mmultiple -mno-altivec -funit-at-a-time -Wa,-me500 -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign +endif + +#Wind river Linux 3.0 needs addtional flags +ifeq (3.0,$(WRS_LINUX_VERSION)) + +# Use MSI interrupts if kernel is compiled with MSI support. +#CFLAGS += -DBDE_LINUX_USE_MSI_INTERRUPT +KFLAGS += -I$(LINUX_INCLUDE_STD) -I$(KERNDIR_STD)/arch/powerpc -I$(KERNDIR_STD)/arch/powerpc/include -I$(KERNDIR_STD)/include.asm-powerpc -mno-spe +endif + +ifneq ($(targetplat),user) +include ${SDK}/make/Makefile.linux-kernel-2_6 +endif diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc new file mode 100644 index 000000000000..272ad93ef842 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc @@ -0,0 +1,93 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-iproc Exp $ +# $Copyright: (c) 2007 Broadcom Corp. +# All Rights Reserved.$ +# Makefile for iproc-CMICd + +# User must select one platform from below.By default ARM_LINUX is selected. . +ifeq (,$(BUILD_PLATFORM)) +BUILD_PLATFORM=ARM_LINUX +endif + +# TOOLCHAIN_BASE_DIR Toolchain base directory for iPROC-CMICd devices +# TARGET_ARCHITECTURE Compiler for target architecture +# KERNDIR Kernel directory for iPROC-CMICd devices +ifeq (BE,$(ENDIAN_MODE)) +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/iproc-be/XLDK +TARGET_ARCHITECTURE:=armeb-broadcom-linux-uclibcgnueabi +KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux +else +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/iproc/XLDK +TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi +KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux +endif + +ifeq (,$(CROSS_COMPILE)) +CROSS_COMPILE:= $(TARGET_ARCHITECTURE)- +endif + +# arm9tools +TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/bin +override PATH:=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH) +LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib + +export TOOLCHAIN_BIN_DIR LD_LIBRARY_PATH + +# Default Linux include directory +ifeq (,$(LINUX_INCLUDE)) +LINUX_INCLUDE := $(KERNDIR)/include +endif + +ifeq (BE,$(ENDIAN_MODE)) +CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 +ENDIAN = BE_HOST=1 +else +CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0 +ENDIAN = LE_HOST=1 +endif + +CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD +CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\" + +ARCH = arm +KBUILD_VERBOSE = 1 + +export ARCH KBUILD_VERBOSE + +comma = , +basetarget = $(basename $(notdir $@)) +modname = $(basetarget) + +# Extra variables. +EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) + +name-fix = $(subst $(comma),_,$(subst -,_,$1)) +basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" +modname_flags = $(if $(filter 1,$(words $(modname))),\ + -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") + +KFLAG_INCLD ?= $(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/4.9.3/include + +ifeq (,$(KFLAGS)) +KFLAGS := -D__LINUX_ARM_ARCH__=7 -D__KERNEL__ -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm/include -I$(KERNDIR)/arch/arm/include/generated -I$(KERNDIR)/arch/arm/mach-iproc/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -marm -mabi=aapcs-linux -fno-pic -pipe -msoft-float -ffreestanding -march=armv7-a -mfpu=vfp -mfloat-abi=softfp -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mlong-calls +KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/arm/include/uapi -I$(KERNDIR)/arch/arm/include/generated/uapi +endif + +ifneq ($(targetplat),user) +include ${SDK}/make/Makefile.linux-kernel-3_6 +endif diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc-3_14 b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc-3_14 new file mode 100644 index 000000000000..e8a17b184710 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc-3_14 @@ -0,0 +1,104 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-iproc-3_6,v 1.1 Broadcom SDK $ +# $Copyright: (c) 2007 Broadcom Corp. +# All Rights Reserved.$ +# Makefile for iproc-CMICd + +# User must select one platform from below.By default ARM_LINUX is selected. . +ifeq (,$(BUILD_PLATFORM)) +BUILD_PLATFORM=ARM_LINUX +endif + +# TOOLCHAIN_BASE_DIR Toolchain base directory for iPROC-CMICd devices +# TARGET_ARCHITECTURE Compiler for target architecture +# KERNDIR Kernel directory for iPROC-CMICd devices +ifeq (BE,$(ENDIAN_MODE)) +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk37-be/buildroot-2013.11-gcc48-opt-broadcom +TARGET_ARCHITECTURE:=armeb-buildroot-linux-gnueabi +KERNDIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk37-be/XLDK/kernel/linux +else +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk37/XLDK +TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi +KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux +endif + + +ifeq (,$(CROSS_COMPILE)) +CROSS_COMPILE:= $(TARGET_ARCHITECTURE)- +endif + +# arm9tools +ifeq (BE,$(ENDIAN_MODE)) +TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/host/usr/bin +override PATH:=$(TOOLCHAIN_BASE_DIR)/host/usr/$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH) +LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/host/usr/lib +else +TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/buildroot/usr/bin +override PATH:=$(TOOLCHAIN_BASE_DIR)/buildroot/usr/$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH) +LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/buildroot/usr/lib +endif + +export TOOLCHAIN_BIN_DIR LD_LIBRARY_PATH + +# Default Linux include directory +ifeq (,$(LINUX_INCLUDE)) +LINUX_INCLUDE := $(KERNDIR)/include +endif + +ifeq (BE,$(ENDIAN_MODE)) +CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1 +ENDIAN = BE_HOST=1 +else +CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0 +ENDIAN = LE_HOST=1 +endif + +CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD +CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\" + +ARCH = arm +KBUILD_VERBOSE = 1 + +export ARCH KBUILD_VERBOSE + +comma = , +basetarget = $(basename $(notdir $@)) +modname = $(basetarget) + +# Extra variables. +EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) + +name-fix = $(subst $(comma),_,$(subst -,_,$1)) +basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" +modname_flags = $(if $(filter 1,$(words $(modname))),\ + -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") + +ifeq (BE,$(ENDIAN_MODE)) +KFLAG_INCLD ?= $(TOOLCHAIN_BASE_DIR)/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/4.8.2/include +else +KFLAG_INCLD ?= $(TOOLCHAIN_BASE_DIR)/buildroot/usr/lib/gcc/$(TARGET_ARCHITECTURE)/4.7.2/include +endif + +ifeq (,$(KFLAGS)) +KFLAGS := -D__LINUX_ARM_ARCH__=7 -D__KERNEL__ -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm/include -I$(KERNDIR)/arch/arm/include/generated -I$(KERNDIR)/arch/arm/mach-northstar/include -I$(KERNDIR)/arch/arm/plat-iproc/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -marm -mabi=aapcs-linux -fno-pic -pipe -msoft-float -ffreestanding -march=armv7-a -mfpu=vfp -mfloat-abi=softfp -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mlong-calls +KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/arm/include/uapi -I$(KERNDIR)/arch/arm/include/generated/uapi +endif + +ifneq ($(targetplat),user) +include ${SDK}/make/Makefile.linux-kernel-3_6 +endif diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel b/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel new file mode 100644 index 000000000000..2b8c36d6d4b0 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel @@ -0,0 +1,113 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-kernel,v 1.27 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ + +# Configuration Flags + +# Filter out features that cannot or should not be supported in kernel mode +_FEATURE_EXCLUDE_LIST += EDITLINE TCL OOB_RCPU CINT APIMODE DUNE_UI C_UNIT +FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST)) +# Tools + +CC = $(CROSS_COMPILE)gcc +CXX = $(CROSS_COMPILE)g++ +LD = $(CROSS_COMPILE)ld +AR = $(CROSS_COMPILE)ar +ARFLAGS = -rc +STRIP = $(CROSS_COMPILE)strip +RANLIB = $(CROSS_COMPILE)ranlib +OBJCOPY = $(CROSS_COMPILE)objcopy + +# Handle differences between gcc 2.x and gcc 3.x +gcc-tune-flag = $(shell if ${CC} -dumpspecs | grep mcpu >/dev/null; then echo cpu; else echo tune; fi) + +# Configuration Variables + +# OSType Defines: This defines the type of RTOS or microkernel which you +# are compiling the SAL (and its associated driver) for. New platforms +# can be created by porting the routines (system.c) to your platform and +# adding the define in this Makefile. + +OSTYPE = LINUX + +# +# ORIGIN is used to Optionally select different CFLAGS. It is used to import +# source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added +# to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT +# added. +# +# Default specifies Broadcom +# +ifndef ORIGIN + ORIGIN = Broadcom +endif + +# +# STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations +# BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files +# OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of +# this Makefile, to define local "Extra" flags. +# + +CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \ + -I$(SDK)/systems/bde/linux/include \ + -I$(LINUX_INCLUDE) + +CFGFLAGS += -DNO_FILEIO -DNO_CTRL_C -DNO_MEMTUNE + +CFGFLAGS += -D$(OSTYPE) + +# No user sal for the linux kernel +# NO_SAL_APPL=1 + +STD_CFLAGS = $(KFLAGS) $(CFGFLAGS) + + +STD_CPPFLAGS = ${STD_CFLAGS} +STD_CXXFLAGS = ${STD_CFLAGS} + +BCM_CFLAGS = -Wall -Werror +BCM_CPPFLAGS = ${BCM_CFLAGS} +BCM_CXXFLAGS = ${BCM_CFLAGS} + +ifeq (${ORIGIN}, Broadcom) + CFLAGS += ${STD_CFLAGS} ${BCM_CFLAGS} ${OPT_CFLAGS} + CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS} + CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS} +else + CFLAGS += ${STD_CFLAGS} ${OPT_CFLAGS} + CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS} + CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS} +endif + +# +# Ignore pedantic flag for kernel modules +# +ifdef DEBUG_PEDANTIC +DEBUG_PEDANTIC = FALSE +endif + +# +# DEPEND is used as a command to generate the list of dependencies. +# The format of the output must be +# "file.o : file.c a/b/c.h d/e/f.h ...", +# if it is on multiple lines, each line must end in a backslash. +# The output MUST be on standard out. +# +DEPEND = ${CC} -M $(CFLAGS) $< diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-2_6 new file mode 100644 index 000000000000..52660bc64f18 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-2_6 @@ -0,0 +1,149 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-kernel-2_6,v 1.40 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ + +# Configuration Flags + +# Filter out features that cannot or should not be supported in kernel mode + +_FEATURE_EXCLUDE_LIST += EDITLINE TCL OOB_RCPU CINT APIMODE DUNE_UI C_UNIT +FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST)) + +# Tools + +# Conditionally Replaces DEFAULT var +ifeq ($(origin CC),default) +CC = $(LSRUN) $(CROSS_COMPILE)gcc +endif + +ifeq ($(origin CXX),default) +CXX = $(CROSS_COMPILE)g++ +endif + +ifeq ($(origin LD),default) +LD = $(CROSS_COMPILE)ld +endif + +ifeq ($(origin AR),default) +AR = $(CROSS_COMPILE)ar +endif + +ifeq ($(origin AS),default) +AS = $(CROSS_COMPILE)as +endif + +ifeq ($(origin ARFLAGS),default) + ARFLAGS = -rc +endif + +STRIP = $(CROSS_COMPILE)strip +RANLIB = $(CROSS_COMPILE)ranlib +OBJCOPY = $(CROSS_COMPILE)objcopy +NM = $(CROSS_COMPILE)nm + +# Handle differences between gcc 2.x and gcc 3.x +gcc-tune-flag = $(shell if ${CC} -dumpspecs | grep mcpu >/dev/null; then echo cpu; else echo tune; fi) + +# Configuration Variables + +# OSType Defines: This defines the type of RTOS or microkernel which you +# are compiling the SAL (and its associated driver) for. New platforms +# can be created by porting the routines (system.c) to your platform and +# adding the define in this Makefile. + +OSTYPE = LINUX + +# +# ORIGIN is used to Optionally select different CFLAGS. It is used to import +# source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added +# to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT +# added. +# +# Default specifies Broadcom +# +ifndef ORIGIN + ORIGIN = Broadcom +endif + +# +# STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations +# BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files +# OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of +# this Makefile, to define local "Extra" flags. +# + +ifdef IPROC_BUILD +CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \ + -I$(SDK)/systems/bde/linux/include \ + -I$(LINUX_INCLUDE) \ + -I$(KERNDIR)/arch/$(ARCH) +else +CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \ + -I$(SDK)/systems/bde/linux/include \ + -I$(LINUX_INCLUDE) \ + -I$(LINUX_INCLUDE)/asm/gcc \ + -I$(LINUX_INCLUDE)/asm/mach-generic \ + -I$(KERNDIR)/arch/$(ARCH) +endif + +CFGFLAGS += -DNO_FILEIO -DNO_CTRL_C -DNO_MEMTUNE + +CFGFLAGS += -D$(OSTYPE) + +# No user sal for the linux kernel +# NO_SAL_APPL=1 + +STD_CFLAGS = $(KFLAGS) $(CFGFLAGS) + + +STD_CPPFLAGS = ${STD_CFLAGS} +STD_CXXFLAGS = ${STD_CFLAGS} + +ifndef BCM_CFLAGS +BCM_CFLAGS = -Wall -Werror +endif + +BCM_CPPFLAGS = ${BCM_CFLAGS} +BCM_CXXFLAGS = ${BCM_CFLAGS} + +ifeq (${ORIGIN}, Broadcom) + CFLAGS += ${STD_CFLAGS} ${BCM_CFLAGS} ${OPT_CFLAGS} + CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS} + CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS} +else + CFLAGS += ${STD_CFLAGS} ${OPT_CFLAGS} + CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS} + CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS} +endif + +# +# Ignore pedantic flag for kernel modules +# +ifdef DEBUG_PEDANTIC +DEBUG_PEDANTIC = FALSE +endif + +# +# DEPEND is used as a command to generate the list of dependencies. +# The format of the output must be +# "file.o : file.c a/b/c.h d/e/f.h ...", +# if it is on multiple lines, each line must end in a backslash. +# The output MUST be on standard out. +# +DEPEND = ${CC} -M $(CFLAGS) $< diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-3_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-3_6 new file mode 100644 index 000000000000..50f32816c686 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-3_6 @@ -0,0 +1,149 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-kernel-3_6,v 1.2 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ + +# Configuration Flags + +# Filter out features that cannot or should not be supported in kernel mode + +_FEATURE_EXCLUDE_LIST += EDITLINE TCL OOB_RCPU CINT APIMODE DUNE_UI +FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST)) + +# Tools + +# Conditionally Replaces DEFAULT var +ifeq ($(origin CC),default) +CC = $(LSRUN) $(CROSS_COMPILE)gcc +endif + +ifeq ($(origin CXX),default) +CXX = $(CROSS_COMPILE)g++ +endif + +ifeq ($(origin LD),default) +LD = $(CROSS_COMPILE)ld +endif + +ifeq ($(origin AR),default) +AR = $(CROSS_COMPILE)ar +endif + +ifeq ($(origin AS),default) +AS = $(CROSS_COMPILE)as +endif + +ifeq ($(origin ARFLAGS),default) + ARFLAGS = -rc +endif + +STRIP = $(CROSS_COMPILE)strip +RANLIB = $(CROSS_COMPILE)ranlib +OBJCOPY = $(CROSS_COMPILE)objcopy +NM = $(CROSS_COMPILE)nm + +# Handle differences between gcc 2.x and gcc 3.x +gcc-tune-flag = $(shell if ${CC} -dumpspecs | grep mcpu >/dev/null; then echo cpu; else echo tune; fi) + +# Configuration Variables + +# OSType Defines: This defines the type of RTOS or microkernel which you +# are compiling the SAL (and its associated driver) for. New platforms +# can be created by porting the routines (system.c) to your platform and +# adding the define in this Makefile. + +OSTYPE = LINUX + +# +# ORIGIN is used to Optionally select different CFLAGS. It is used to import +# source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added +# to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT +# added. +# +# Default specifies Broadcom +# +ifndef ORIGIN + ORIGIN = Broadcom +endif + +# +# STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations +# BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files +# OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of +# this Makefile, to define local "Extra" flags. +# + +ifdef IPROC_BUILD +CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \ + -I$(SDK)/systems/bde/linux/include \ + -I$(LINUX_INCLUDE) \ + -I$(KERNDIR)/arch/$(ARCH) +else +CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \ + -I$(SDK)/systems/bde/linux/include \ + -I$(LINUX_INCLUDE) \ + -I$(LINUX_INCLUDE)/asm/gcc \ + -I$(LINUX_INCLUDE)/asm/mach-generic \ + -I$(KERNDIR)/arch/$(ARCH) +endif + +CFGFLAGS += -DNO_FILEIO -DNO_CTRL_C -DNO_MEMTUNE + +CFGFLAGS += -D$(OSTYPE) + +# No user sal for the linux kernel +# NO_SAL_APPL=1 + +STD_CFLAGS = $(KFLAGS) $(CFGFLAGS) + + +STD_CPPFLAGS = ${STD_CFLAGS} +STD_CXXFLAGS = ${STD_CFLAGS} + +ifndef BCM_CFLAGS +BCM_CFLAGS = -Wall -Werror +endif + +BCM_CPPFLAGS = ${BCM_CFLAGS} +BCM_CXXFLAGS = ${BCM_CFLAGS} + +ifeq (${ORIGIN}, Broadcom) + CFLAGS += ${STD_CFLAGS} ${BCM_CFLAGS} ${OPT_CFLAGS} + CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS} + CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS} +else + CFLAGS += ${STD_CFLAGS} ${OPT_CFLAGS} + CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS} + CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS} +endif + +# +# Ignore pedantic flag for kernel modules +# +ifdef DEBUG_PEDANTIC +DEBUG_PEDANTIC = FALSE +endif + +# +# DEPEND is used as a command to generate the list of dependencies. +# The format of the output must be +# "file.o : file.c a/b/c.h d/e/f.h ...", +# if it is on multiple lines, each line must end in a backslash. +# The output MUST be on standard out. +# +DEPEND = ${CC} -M $(CFLAGS) $< diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-4_4 b/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-4_4 new file mode 100644 index 000000000000..d662b04334e7 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-4_4 @@ -0,0 +1,158 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-kernel-2_6,v 1.40 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ + +# Configuration Flags + +# Filter out features that cannot or should not be supported in kernel mode + +_FEATURE_EXCLUDE_LIST += EDITLINE TCL OOB_RCPU CINT APIMODE DUNE_UI C_UNIT +FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST)) + +# Tools + +# Conditionally Replaces DEFAULT var +ifeq ($(origin CC),default) +CC = $(LSRUN) $(CROSS_COMPILE)gcc +endif + +ifeq ($(origin CXX),default) +CXX = $(CROSS_COMPILE)g++ +endif + +ifeq ($(origin LD),default) +LD = $(CROSS_COMPILE)ld +endif + +ifeq ($(origin AR),default) +AR = $(CROSS_COMPILE)ar +endif + +ifeq ($(origin AS),default) +AS = $(CROSS_COMPILE)as +endif + +ifeq ($(origin ARFLAGS),default) + ARFLAGS = -rc +endif + +STRIP = $(CROSS_COMPILE)strip +RANLIB = $(CROSS_COMPILE)ranlib +OBJCOPY = $(CROSS_COMPILE)objcopy +NM = $(CROSS_COMPILE)nm + +# Handle differences between gcc 2.x and gcc 3.x +gcc-tune-flag = $(shell if ${CC} -dumpspecs | grep mcpu >/dev/null; then echo cpu; else echo tune; fi) + +# Configuration Variables + +# OSType Defines: This defines the type of RTOS or microkernel which you +# are compiling the SAL (and its associated driver) for. New platforms +# can be created by porting the routines (system.c) to your platform and +# adding the define in this Makefile. +OSTYPE = LINUX + +# +# ORIGIN is used to Optionally select different CFLAGS. It is used to import +# source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added +# to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT +# added. +# +# Default specifies Broadcom +# +ifndef ORIGIN + ORIGIN = Broadcom +endif + +# +# STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations +# BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files +# OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of +# this Makefile, to define local "Extra" flags. +# +ifdef IPROC_BUILD +CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \ + -I$(SDK)/systems/bde/linux/include \ + -I$(LINUX_INCLUDE) \ + -I$(LINUX_INCLUDE)/uapi \ + -I$(LINUX_INCLUDE)/generated/uapi \ + -I$(KERNDIR)/arch/$(ARCH) \ + -I$(KERNDIR)/arch/$(ARCH)/include/uapi \ + -I$(KERNDIR)/arch/$(ARCH)/include/generated \ + -I$(KERNDIR)/arch/$(ARCH)/include/generated/uapi +else +CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \ + -I$(SDK)/systems/bde/linux/include \ + -I$(LINUX_INCLUDE) \ + -I$(LINUX_INCLUDE)/asm/gcc \ + -I$(LINUX_INCLUDE)/asm/mach-generic \ + -I$(LINUX_INCLUDE)/uapi \ + -I$(LINUX_INCLUDE)/generated/uapi \ + -I$(KERNDIR)/arch/$(ARCH) \ + -I$(KERNDIR)/arch/$(ARCH)/include/uapi \ + -I$(KERNDIR)/arch/$(ARCH)/include/generated \ + -I$(KERNDIR)/arch/$(ARCH)/include/generated/uapi +endif + +CFGFLAGS += -DNO_FILEIO -DNO_CTRL_C -DNO_MEMTUNE + +CFGFLAGS += -D$(OSTYPE) + +# No user sal for the linux kernel +# NO_SAL_APPL=1 + +STD_CFLAGS = $(KFLAGS) $(CFGFLAGS) + + +STD_CPPFLAGS = ${STD_CFLAGS} +STD_CXXFLAGS = ${STD_CFLAGS} + +ifndef BCM_CFLAGS +BCM_CFLAGS = -Wall -Werror +endif + +BCM_CPPFLAGS = ${BCM_CFLAGS} +BCM_CXXFLAGS = ${BCM_CFLAGS} + +ifeq (${ORIGIN}, Broadcom) + CFLAGS += ${STD_CFLAGS} ${BCM_CFLAGS} ${OPT_CFLAGS} + CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS} + CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS} +else + CFLAGS += ${STD_CFLAGS} ${OPT_CFLAGS} + CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS} + CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS} +endif + +# +# Ignore pedantic flag for kernel modules +# +ifdef DEBUG_PEDANTIC +DEBUG_PEDANTIC = FALSE +endif + +# +# DEPEND is used as a command to generate the list of dependencies. +# The format of the output must be +# "file.o : file.c a/b/c.h d/e/f.h ...", +# if it is on multiple lines, each line must end in a backslash. +# The output MUST be on standard out. +# +DEPEND = ${CC} -M $(CFLAGS) $< + diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-kmodule b/platform/broadcom/saibcm-modules/make/Makefile.linux-kmodule new file mode 100644 index 000000000000..a49919c615b2 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-kmodule @@ -0,0 +1,82 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-kmodule-3_6,v 1.2 Broadcom SDK $ +# $Copyright: (c) 2006 Broadcom Corp. +# All Rights Reserved.$ + +# Due to the extensive use of driver libraries, the SDK usually builds +# kernel modules from a precompiled object. To avoid various warnings +# and conflicts, the pre-compiled object must be named differently +# from the target module, and the object file itself should be +# appended with "_shipped". + +# If a module exports any symbols, then the exporting source file must +# be compiled within the kernel source tree for correct generation of +# module symbol versions. The symbol source file should be passed to +# this Makefile via the MODULE_SYM variable. + +MODULE := $(MOD_NAME).o +KMODULE := $(MOD_NAME).ko +PRE_COMPILED_OBJ := obj_$(MOD_NAME).o + +obj-m := $(MODULE) +$(MOD_NAME)-y := $(MODULE_SYM) $(PRE_COMPILED_OBJ) + + +ifeq (,$(CROSS_COMPILE)) + +export CROSS_COMPILE + +endif + +SAVE_CFLAGS := ${CFLAGS} + +include $(SDK)/make/Make.config + +PWD := $(shell pwd) + +ifneq ($(ARCH),) +# ELDK does not seem to `automatically' define ARCH where other gccs may +A := ARCH=$(ARCH) +export ARCH +endif + +# Provide an option in case kernel was built in separate directory +KERNBLDDIR ?= $(KERNDIR) + +# Standard SDK include path for building source files that export +# kernel symbols. + +override EXTRA_CFLAGS = -I${SDK}/include -I${SDK}/systems/linux/kernel/modules/include -I${SDK}/systems/bde/linux/include + +# The precopiled object needs a dummy command file to avoid warnings +# from the Kbuild scripts (modpost stage). +# Kernels before 2.6.17 do not support external module symbols files, +# so we create a dummy to prevent build failures. + +$(KMODULE): + rm -f *.o *.ko .*.cmd + rm -fr .tmp_versions + ln -s $(LIBDIR)/$(MODULE) $(PRE_COMPILED_OBJ)_shipped + echo "suppress warning" > .$(PRE_COMPILED_OBJ).cmd + $(MAKE) -C $(KERNBLDDIR) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) modules + if [ ! -f Module.symvers ]; then echo "old kernel (pre-2.6.17)" > Module.symvers; fi + cp -f $(KMODULE) $(LIBDIR) + rm -f $(PRE_COMPILED_OBJ)_shipped + +EXTRA_CFLAGS = $(CFLAGS) +CFLAGS := ${SAVE_CFLAGS} diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-common-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-common-2_6 new file mode 100644 index 000000000000..29fb4cddd652 --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-common-2_6 @@ -0,0 +1,45 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-x86-common-2_6,v 1.13 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ + +CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0 +ENDIAN = LE_HOST=1 +CFGFLAGS += -D$(ENDIAN) +CFGFLAGS += -DBCM_PLATFORM_STRING=\"X86\" +ifeq (,$(findstring -DSAL_BDE_DMA_MEM_DEFAULT,$(CFGFLAGS))) +CFGFLAGS += -DSAL_BDE_DMA_MEM_DEFAULT=16 +endif + +# Extra variables. +EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) + +comma = , +basetarget = $(basename $(notdir $@)) +modname = $(basetarget) + +name-fix = $(subst $(comma),_,$(subst -,_,$1)) +basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" +modname_flags = $(if $(filter 1,$(words $(modname))),\ +-D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") + +ifneq ($(targetplat),user) +# By default we exclude -Werror from x86 kernel builds +BCM_CFLAGS = -Wall +include ${SDK}/make/Makefile.linux-kernel-2_6 +endif diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-generic-common-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-generic-common-2_6 new file mode 100644 index 000000000000..5e01f2843bae --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-generic-common-2_6 @@ -0,0 +1,52 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-x86-generic-common-2_6,v 1.2 Broadcom SDK $ +# $Copyright: (c) 2008 Broadcom Corp. +# All Rights Reserved.$ + +# Default kernel source directory +ifeq (,$(KERNDIR)) +KERNDIR := /lib/modules/$(shell uname -r)/build +export KERNDIR +endif + +# Default architecture +ifeq (,$(ARCH)) +ARCH = $(shell uname -p) +ifneq (x86_64,$(ARCH)) +ARCH = i386 +endif +endif + +# Noisy kernel build +KBUILD_VERBOSE = 1 + +export ARCH KBUILD_VERBOSE KERNDIR + +# Default Linux include directory +ifeq (,$(LINUX_INCLUDE)) +LINUX_INCLUDE := $(KERNDIR)/include +endif + +# autoconf.h was moved in later kernels +AUTOCONF = $(KERNDIR)/include/generated/autoconf.h +ifeq (,$(shell ls $(AUTOCONF) 2>/dev/null)) +AUTOCONF = $(KERNDIR)/include/linux/autoconf.h +endif + +# gcc system include path +SYSINC = $(shell gcc -print-search-dirs | grep install | cut -c 10-)include diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 new file mode 100644 index 000000000000..2c0242f9841f --- /dev/null +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 @@ -0,0 +1,45 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# $Id: Makefile.linux-x86-smp_generic_64-2_6,v 1.5 Broadcom SDK $ +# $Copyright: (c) 2008 Broadcom Corp. +# All Rights Reserved.$ + +CFGFLAGS += -DLONGS_ARE_64BITS +CFGFLAGS += -DPTRS_ARE_64BITS +CFGFLAGS += -DPHYS_ADDRS_ARE_64BITS +CFGFLAGS += -DSAL_SPL_LOCK_ON_IRQ + +include ${SDK}/make/Makefile.linux-x86-generic-common-2_6 + +ifeq (,$(KFLAGS)) +KFLAGS := -nostdinc -isystem $(SYSINC) -I$(KERNDIR)/include -I$(KERNDIR)/arch/x86/include -include $(AUTOCONF) -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign +endif + +KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/x86/include/generated -I$(KERNDIR)/arch/x86/include/uapi -I$(KERNDIR)/arch/x86/include/generated/uapi + +ifeq ($(LINUX_MAKE_SHARED_LIB),1) +KFLAGS += -fPIC -mcmodel=small +else +KFLAGS += -mcmodel=kernel -fno-pie +endif + +ifeq (1,$(DEBIAN_LINUX_HEADER)) +KERNDIR_COMMON := $(subst amd64,common,$(KERNDIR)) +KFLAGS += -I$(KERNDIR_COMMON)/include -I$(KERNDIR_COMMON)/include/uapi -I$(KERNDIR_COMMON)/arch/x86/include -I$(KERNDIR_COMMON)/arch/x86/include/uapi +endif + +include ${SDK}/make/Makefile.linux-x86-common-2_6 diff --git a/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-5-amd64.service b/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-5-amd64.service new file mode 100644 index 000000000000..4da3f9761991 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-5-amd64.service @@ -0,0 +1,13 @@ +[Unit] +Description=Opennsl kernel modules init +After=local-fs.target +Before=syncd.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/opennsl-modules-4.9.0-5-amd64 start +ExecStop=-/etc/init.d/opennsl-modules-4.9.0-5-amd64 stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux-bde.h b/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux-bde.h new file mode 100644 index 000000000000..e0c23f73050a --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux-bde.h @@ -0,0 +1,275 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/*********************************************************************** + * + * $Id: linux-bde.h,v 1.24 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + * + * Linux Broadcom Device Enumerators + * + * + * There are two Linux BDEs: + * + * 1. Linux Kernel BDE + * + * This is a kernel module implementing a BDE + * for the driver running as part of the kernel. + * + * It manages the devices through the linux PCI interfaces, + * and manages a chunk of contiguous, boot-time allocated + * DMA memory. This is all that is needed if the BCM driver + * is run as part of the kernel (in another module). + * + * 2. Linux User BDE + * + * This is a kernel module and userland library which implement + * a complete BDE for applications running in userland. + * + * The kernel module relies upon the real kernel bde, + * and allows a user space application (through the user library) + * to talk directly to the devices. It also virtualized the device + * interrupts, so the entire driver can be run as a userspace + * application. + * + * While this causes a significant degradation in performance, + * because the system runs as a user application, the development + * and debugging process is about a gillion times easier. + * After the core logic is debugged, it can be retargeted using + * only the kernel bde and run in the kernel. + * + * + **********************************************************************/ + +#ifndef __LINUX_BDE_H__ +#define __LINUX_BDE_H__ + +#include + +#include + + +/* + * Device Major Numbers + * + * The kernel and user bdes need unique major numbers + * on systems that do not use devfs. + * + * They are defined here, along with the module names, + * to document them if you need to mknod them (or open) them, + * and to keep them unique. + * + */ + +#include + +#ifdef __KERNEL__ +#include +/* Key stone and Raptor has 2.6.21 but don't have definition */ +#if defined(KEYSTONE) || defined(RAPTOR) +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,21)) + #ifdef PHYS_ADDRS_ARE_64BITS + typedef u64 phys_addr_t; + #else + typedef u32 phys_addr_t; + #endif + #endif +#endif +#endif + + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)) +#define LINUX_BDE_DMA_DEVICE_SUPPORT +#endif + +#define LINUX_KERNEL_BDE_NAME "linux-kernel-bde" +#define LINUX_KERNEL_BDE_MAJOR 127 + +#define LINUX_USER_BDE_NAME "linux-user-bde" +#define LINUX_USER_BDE_MAJOR 126 + + +/* Max devices */ +/* 16 switch chips + 2 out-of-band Ethernet + 2 CPUs */ +#define LINUX_BDE_MAX_SWITCH_DEVICES 16 +#define LINUX_BDE_MAX_ETHER_DEVICES 2 +#define LINUX_BDE_MAX_CPU_DEVICES 2 +#define LINUX_BDE_MAX_DEVICES (LINUX_BDE_MAX_SWITCH_DEVICES + \ + LINUX_BDE_MAX_ETHER_DEVICES + \ + LINUX_BDE_MAX_CPU_DEVICES) + +/* + * PCI devices will be initialized by the Linux Kernel, + * regardless of architecture. + * + * You need only provide bus endian settings. + */ + +typedef struct linux_bde_bus_s { + int be_pio; + int be_packet; + int be_other; +} linux_bde_bus_t; + + + +/* Device state used for PCI hot swap case. */ +/* + * BDE_DEV_STATE_NORMAL : A device is probed normally. Or when the device + * resource has been updated after "CHANGED", the state will move back to + * "NORMAL". + */ +#define BDE_DEV_STATE_NORMAL (0) +/* + * BDE_DEV_STATE_REMOVED : A previous probed device was removed. + * We will avoid any device access while the device is in this state. + * The state will be moved to "CHANGED" if the device is re-inserted + * and re-probed. + */ +#define BDE_DEV_STATE_REMOVED (1) +/* + * BDE_DEV_STATE_CHANGED : The device is re-probed after having been removed. + * The resouces assigned to the device might have been changed after + * re-probing, so we need to re-initialize our resource database accordingly. + * The state will change to "NORMAL" when the resource have been updated. + */ +#define BDE_DEV_STATE_CHANGED (2) + +extern int linux_bde_create(linux_bde_bus_t* bus, ibde_t** bde); +extern int linux_bde_destroy(ibde_t* bde); +#ifdef BCM_INSTANCE_SUPPORT +extern int linux_bde_instance_attach(unsigned int dev_mask,unsigned int dma_size); +#endif + +#ifdef __KERNEL__ + +/* + * Backdoors provided by the kernel bde + * + */ + +/* + * The user bde needs to get cpu physical address for + * the userland code to mmap. + * And the second address is bus address, it is either + * identical to cpu physical address or another address + * (IOVA) translated by IOMMU. + */ +extern int lkbde_get_dma_info(phys_addr_t *cpu_pbase, phys_addr_t *dma_pbase, ssize_t *size); +extern uint32 lkbde_get_dev_phys(int d); +extern uint32 lkbde_get_dev_phys_hi(int d); + +/* + * Virtual device address needed by kernel space + * interrupt handler. + */ +extern void *lkbde_get_dev_virt(int d); + +/* + * The user bde needs to get some physical addresses for + * the userland code to mmap. The following functions + * supports multiple resources for a single device. + */ +extern int lkbde_get_dev_resource(int d, int rsrc, uint32 *flags, + uint32 *phys_lo, uint32 *phys_hi); + +/* + * Backdoor to retrieve OS device structure to be used for + * DMA operations. + */ +extern void *lkbde_get_dma_dev(int d); + +/* + * Backdoor to retrieve original hardware/OS device. + */ +extern void *lkbde_get_hw_dev(int d); + +/* + * Retrive the device state from Kernel BDE. + * Used for KNET and User BDE for pci hot swap case. + */ +extern int lkbde_dev_state_get(int d, uint32 *state); +extern int lkbde_dev_state_set(int d, uint32 state); + +/* + * Retrive the mapping between emulated HW device and instance id + */ +extern int lkbde_dev_instid_get(int d, uint32 *instid); +extern int lkbde_dev_instid_set(int d, uint32 instid); + +/* + * Functions that allow an interrupt handler in user mode to + * coexist with interrupt handler in kernel module. + */ +extern int lkbde_irq_mask_set(int d, uint32 addr, uint32 mask, uint32 fmask); +extern int lkbde_irq_mask_get(int d, uint32 *mask, uint32 *fmask); + +#if (defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT)) +extern int lkbde_cpu_write(int d, uint32 addr, uint32 *buf); +extern int lkbde_cpu_read(int d, uint32 addr, uint32 *buf); +extern int lkbde_cpu_pci_register(int d); +#endif + +/* + * This flag must be OR'ed onto the device number when calling + * interrupt_connect/disconnect and irq_mask_set functions from + * a secondary device driver. + */ +#define LKBDE_ISR2_DEV 0x8000 + +#if defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) +#include +#if defined(__DUNE_LINUX_BCM_CPU_PCIE__) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) +#ifndef _SIMPLE_MEMORY_ALLOCATION_ +#define _SIMPLE_MEMORY_ALLOCATION_ 1 +#endif +#ifndef USE_LINUX_BDE_MMAP +#define USE_LINUX_BDE_MMAP 1 +#endif +#endif +#endif + +#if defined(IPROC_CMICD) && defined(CONFIG_CMA) +#ifndef _SIMPLE_MEMORY_ALLOCATION_ +#define _SIMPLE_MEMORY_ALLOCATION_ 1 +#endif +#endif + +/* Don't use _SIMPLE_MEMORY_ALLOCATION_ method for newer kernel than 3.10.0 */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) +#ifndef _SIMPLE_MEMORY_ALLOCATION_ +#define _SIMPLE_MEMORY_ALLOCATION_ 0 +#endif +#endif + +/* Allocation via dma_alloc_coherent is turned off by default */ +#ifndef _SIMPLE_MEMORY_ALLOCATION_ +#define _SIMPLE_MEMORY_ALLOCATION_ 9 /* compile in the allocation method, but do not use it by default */ +#endif + +/* By default we use our private mmap only if /dev/mem mmap has restrictions */ +#ifndef USE_LINUX_BDE_MMAP +#ifdef CONFIG_STRICT_DEVMEM +#define USE_LINUX_BDE_MMAP 1 +#else +#define USE_LINUX_BDE_MMAP 0 +#endif +#endif + +#endif /* __KERNEL__ */ + +#endif /* __LINUX_BDE_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h b/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h new file mode 100644 index 000000000000..f2621a982cc1 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h @@ -0,0 +1,76 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/*********************************************************************** + * + * $Id: linux_dma.h,v 1.24 Broadcom SDK $ + * $Copyright: (c) 2016 Broadcom Corp. + * All Rights Reserved.$ + * + **********************************************************************/ + +#ifndef __LINUX_DMA_H__ +#define __LINUX_DMA_H__ + +#include + +#ifdef __KERNEL__ + +#ifdef SAL_BDE_XLP +#define KMALLOC(size, flags) __kmalloc(size, flags) +#else +#define KMALLOC(size, flags) kmalloc(size, flags) +#endif + +#if defined(CONFIG_IDT_79EB334) || defined(CONFIG_BCM4702) +/* ioremap is broken in kernel */ +#define IOREMAP(addr, size) ((void *)KSEG1ADDR(addr)) +#else +#define IOREMAP(addr, size) ioremap_nocache(addr, size) +#endif + +#if defined (__mips__) +#if defined(CONFIG_NONCOHERENT_IO) || defined(CONFIG_DMA_NONCOHERENT) +/* Use flush/invalidate for cached memory */ +#define NONCOHERENT_DMA_MEMORY +/* Remap virtual DMA addresses to non-cached segment */ +#define REMAP_DMA_NONCACHED +#endif /* CONFIG_NONCOHERENT_IO || CONFIG_DMA_NONCOHERENT */ +#endif /* __mips__ */ + +#if defined(BCM958525) && (LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,5)) +#define REMAP_DMA_NONCACHED +#endif + +#ifndef DMA_BIT_MASK +#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) +#endif + +extern void _dma_init(int robo_switch); +extern int _dma_cleanup(void); +extern void _dma_pprint(void); +extern uint32_t *_salloc(int d, int size, const char *name); +extern void _sfree(int d, void *ptr); +extern int _sinval(int d, void *ptr, int length); +extern int _sflush(int d, void *ptr, int length); +extern sal_paddr_t _l2p(int d, void *vaddr); +extern void *_p2l(int d, sal_paddr_t paddr); +extern int _dma_pool_allocated(void); +extern int _dma_range_valid(unsigned long phys_addr, unsigned long size); + +#endif /* __KERNEL__ */ + +#endif /* __LINUX_DMA_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/include/mpool.h b/platform/broadcom/saibcm-modules/systems/bde/linux/include/mpool.h new file mode 100644 index 000000000000..001743d7192a --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/include/mpool.h @@ -0,0 +1,37 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: mpool.h,v 1.2 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ + +#ifndef __MPOOL_H__ +#define __MPOOL_H__ + +struct mpool_mem_s; +typedef struct mpool_mem_s* mpool_handle_t; + +extern int mpool_init(void); +extern mpool_handle_t mpool_create(void* base_address, int size); +extern void* mpool_alloc(mpool_handle_t pool, int size); +extern void mpool_free(mpool_handle_t pool, void* ptr); +extern int mpool_destroy(mpool_handle_t pool); + +extern int mpool_usage(mpool_handle_t pool); + +#endif /* __MPOOL_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile new file mode 100644 index 000000000000..0d126c9a2373 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile @@ -0,0 +1,115 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.18 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# +# Makefile for Linux kernel BDE +# +LOCALDIR = systems/bde/linux/kernel + +# Make sure we build for the kernel if this is a user-mode build +ifneq ($(platform), ) +override-target=linux-$(platform) +endif + +include $(SDK)/make/Make.config + +LIBS = $(LIBDIR)/libkern.a + +BDE = linux-kernel-bde.o + +ifdef ROBO_CHIPS +CFLAGS += -I$(ET_ROBO) -I${SDK}/include/shared/et +ET_ROBO = ${SDK}/systems/drv/et +endif + +# need to add vpath sources +VPATH = ../shared $(ET_ROBO) + +# Add the srcs to be found by vpath +LSRCS += mpool.c +ifdef ROBO_CHIPS +platformsplt = $(subst -, , ${platform}) # change hyphens to spaces +platformbase = $(word 1,${platformsplt}) + +ifeq ($(platformbase), keystone) + LSRCS += etc_robo_spi.c aiutils.c +else + ifeq ($(platformbase), keystone_le) + LSRCS += etc_robo_spi.c aiutils.c + else + ifeq ($(platformbase), iproc) + LSRCS += robo_srab.c robo_spi.c aiutils.c + endif + endif +endif # platformbase + +endif # ROBO_CHIPS + +# Add shared BDE sources +VPATH += ../../shared +LSRCS += shbde_pci.c shbde_iproc.c shbde_mdio.c +CFLAGS += -I../../shared/include + +LHDRS += mpool.h +LOBJS = $(addsuffix .o, $(basename $(LSRCS))) +BOBJS = $(addprefix $(BLDDIR)/,$(LOBJS)) + +ifneq ($(kernel_version),2_4) +KERNEL_MODULE_DIR = kernel_module + +THIS_MOD_NAME := linux-kernel-bde +MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o +KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko + +build: kernel_libs $(MODULE) $(KMODULE) +else +MODULE = $(LIBDIR)/linux-kernel-bde.o + +build: kernel_libs $(MODULE) +endif + +$(MODULE): $(BLDDIR)/.tree kernel_libs $(BOBJS) + mkdir -p $(@D) + $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ +ifneq ($(kernel_version),2_4) +$(KMODULE): $(MODULE) + rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) + mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) + cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile + MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko +endif + +kernel_libs: + $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared + +include $(SDK)/make/Make.depend + +# Make.depend is before clean:: so that Make.depend's clean:: runs first. + +clean:: + $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared $@ + $(RM) $(BOBJS) $(MODULE) + $(RM) $(BLDDIR)/$(KERNEL_MODULE_DIR) + +distclean:: + +ifneq ($(kernel_version),2_4) +.PHONY: build kernel_libs +endif diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c new file mode 100644 index 000000000000..105d3d9bd940 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c @@ -0,0 +1,5173 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: linux-kernel-bde.c,v 1.414 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + * + * Linux Kernel BDE + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "linux_shbde.h" + +#ifdef BCM_ROBO_SUPPORT +/* robo/et related header files */ +#include + +#include + +#if defined(KEYSTONE) +#include +#include +#include +#include +#elif defined(IPROC_CMICD) +#include +#include +#ifdef BCM_STARFIGHTER3_SUPPORT +#include +#endif +#include +#include +#else /* BCM4704 */ +#include +#include +#endif +#endif /* BCM_ROBO_SUPPORT */ + +#define PCI_USE_INT_NONE (-1) +#define PCI_USE_INT_INTX (0) +#define PCI_USE_INT_MSI (1) +#define PCI_USE_INT_MSIX (2) +#ifdef CONFIG_PCI_MSI +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,110)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) +#define msix_table_size(flags) ((flags & PCI_MSIX_FLAGS_QSIZE) + 1) +#endif +#define msi_control_reg(base) (base + PCI_MSI_FLAGS) +#endif +#endif +MODULE_AUTHOR("Broadcom Corporation"); +MODULE_DESCRIPTION("Kernel BDE"); +MODULE_LICENSE("GPL"); + +/* PCIe max payload */ +int maxpayload = 256; +LKM_MOD_PARAM(maxpayload, "i", int, 0); +MODULE_PARM_DESC(maxpayload, +"Limit maximum payload size and request size on PCIe devices"); + +/* Use MSI or MSIX interrupts */ +int usemsi = -1; +LKM_MOD_PARAM(usemsi, "i", int, 0); +MODULE_PARM_DESC(usemsi, +"Use MSI/ MSIX interrupts if supported by kernel"); + +/* Ignore all recognized devices (for debug purposes) */ +int nodevices; +LKM_MOD_PARAM(nodevices, "i", int, 0); +MODULE_PARM_DESC(nodevices, +"Ignore all recognized devices (default no)"); + +/* + * This usually is defined at /usr/include/linux/pci_ids.h + * But this ID is newer. + */ +#ifndef PCI_DEVICE_ID_PLX_9656 +#define PCI_DEVICE_ID_PLX_9656 0x9656 +#endif + +#ifndef PCI_DEVICE_ID_PLX_9056 +#define PCI_DEVICE_ID_PLX_9056 0x9056 +#endif + +/* local defined device IDs, refer to bcmdevs.h */ +#ifndef BCM53000_GMAC_ID +#define BCM53000_GMAC_ID 0x4715 /* 53003 gmac id */ +#endif +#ifndef BCM53010_GMAC_ID +#define BCM53010_GMAC_ID 0x4715 /* 5301x gmac id */ +#endif +#ifndef BCM47XX_ENET_ID +#define BCM47XX_ENET_ID 0x4713 /* 4710 enet */ +#endif +#ifndef BCM53010_CHIP_ID +#define BCM53010_CHIP_ID 0xcf12 /* 53010 chipcommon chipid */ +#endif +#ifndef BCM53018_CHIP_ID +#define BCM53018_CHIP_ID 0xcf1a /* 53018 chipcommon chipid */ +#endif +#ifndef BCM53020_CHIP_ID +#define BCM53020_CHIP_ID 0xcf1e /* 53020 chipcommon chipid */ +#endif + +/* For 2.4.x kernel support */ +#ifndef IRQF_SHARED +#define IRQF_SHARED SA_SHIRQ +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) +typedef unsigned long resource_size_t; +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */ + +#ifdef BCM_ICS +#define BCM_ICS_CMIC_BASE 0x08000000 +#else + +/* Force interrupt line */ +static int forceirq = -1; +static uint32_t forceirqubm = 0xffffffff; +LKM_MOD_PARAM(forceirq, "i", int, 0); +LKM_MOD_PARAM(forceirqubm, "i", uint, 0); +MODULE_PARM_DESC(forceirq, +"Override IRQ line assigned by boot loader"); +MODULE_PARM_DESC(forceirqubm, +"Bitmap for overriding the IRQ line assigned by boot loader for given units"); + +/* Create SPI slave device (cannot be probed) */ +static uint32_t spi_devid = 0; +LKM_MOD_PARAM(spi_devid, "i", uint, 0); +MODULE_PARM_DESC(spi_devid, +"Create SPI slave device using this device ID"); + +/* Select SPI device revision (cannot be probed) */ +static uint32_t spi_revid = 1; +LKM_MOD_PARAM(spi_revid, "i", uint, 0); +MODULE_PARM_DESC(spi_revid, +"Select device revision for SPI slave device"); + +#endif /* BCM_ICS */ + +/* Debug output */ +static int debug; +LKM_MOD_PARAM(debug, "i", int, 0); +MODULE_PARM_DESC(debug, +"Set debug level (default 0"); +/* Use high memory for DMA */ + +/* module param for probing EB devices. */ +static char *eb_bus; +LKM_MOD_PARAM(eb_bus, "s", charp, 0); +MODULE_PARM_DESC(eb_bus, +"List of EB devices on platform. Input format (BA=%x IRQ=%d RD16=%d WR16=%d"); + +#ifdef KEYSTONE +/* Force SPI Frequency */ +static int spifreq = 0; +LKM_MOD_PARAM(spifreq, "i", int, 0); +MODULE_PARM_DESC(spifreq, +"Force SPI Frequency for Keystone CPU (0 for default frequency)"); +#endif + +#if defined(BCM_EA_SUPPORT) +#if defined(BCM_TK371X_SUPPORT) +static int eadevices; +LKM_MOD_PARAM(eadevices, "i", int, 0); +MODULE_PARM_DESC(eadevices, +"Number of TK371X devices"); +#endif /* */ +#endif /* BCM_EA_SUPPORT */ + +/* Compatibility */ +#ifdef LKM_2_4 +#define _ISR_RET void +#define _ISR_PARAMS(_i,_d,_r) int _i, void *_d, struct pt_regs *_r +#define IRQ_NONE +#define IRQ_HANDLED +#define SYNC_IRQ(_i) synchronize_irq() +#else /* LKM_2_6 */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) +#define _ISR_RET irqreturn_t +#else +#define _ISR_RET int +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) +#define _ISR_PARAMS(_i,_d,_r) int _i, void *_d +#else +#define _ISR_PARAMS(_i,_d,_r) int _i, void *_d, struct pt_regs *_r +#endif +#define SYNC_IRQ(_i) synchronize_irq(_i) +char * ___strtok; +char * strtok(char * s,const char * ct) +{ + char *sbegin, *send; + sbegin = s ? s : ___strtok; + if (!sbegin) { + return NULL; + } + sbegin += strspn(sbegin,ct); + if (*sbegin == '\0') { + ___strtok = NULL; + return( NULL ); + } + send = strpbrk( sbegin, ct); + if (send && *send != '\0') + *send++ = '\0'; + ___strtok = send; + return (sbegin); +} +LKM_EXPORT_SYM(___strtok); +LKM_EXPORT_SYM(strtok); +#endif /* LKM_2_x */ + +/* PCIe capabilities */ +#ifndef PCI_CAP_ID_EXP +#define PCI_CAP_ID_EXP 0x10 +#endif +#ifndef PCI_EXP_DEVCAP +#define PCI_EXP_DEVCAP 4 +#endif +#ifndef PCI_EXP_DEVCTL +#define PCI_EXP_DEVCTL 8 +#endif +#ifndef PCI_EXT_CAP_START +#define PCI_EXT_CAP_START 0x100 +#endif +#ifndef PCI_EXT_CAP_ID +#define PCI_EXT_CAP_ID(_hdr) (_hdr & 0x0000ffff) +#endif +#ifndef PCI_EXT_CAP_VER +#define PCI_EXT_CAP_VER(_hdr) ((_hdr >> 16) & 0xf) +#endif +#ifndef PCI_EXT_CAP_NEXT +#define PCI_EXT_CAP_NEXT(_hdr) ((_hdr >> 20) & 0xffc) +#endif +#ifndef PCI_EXT_CAP_ID_VNDR +#define PCI_EXT_CAP_ID_VNDR 0x0b +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +#define PCI_FIND_DEV(_d, _v, _fr) pci_find_device(_d, _v, _fr) +#else +#define PCI_FIND_DEV(_d, _v, _fr) pci_get_device(_d, _v, _fr) +#endif + +#if defined(CONFIG_RESOURCES_64BIT) || defined(CONFIG_PHYS_ADDR_T_64BIT) +#define PHYS_ADDR_IS_64BIT +#endif + +/* Structure of private SPI device */ +struct spi_dev { + uint8 cid; /* Chip ID */ + uint32 part; /* Part number of the chip */ + uint8 rev; /* Revision of the chip */ + void *robo; /* ptr to robo info required to access SPI */ + unsigned short phyid_high; /* PHYID HIGH in MII regs of detected chip */ + unsigned short phyid_low; /* PHYID LOW in MII regs of detected chip */ +}; + +struct bde_spi_device_id { + unsigned short phyid_high; /* PHYID HIGH in MII regs of detected chip */ + unsigned short phyid_low; /* PHYID LOW in MII regs of detected chip */ + uint32 model_info; + uint32 rev_info; + uint32 spifreq; +}; + +/* Control Data */ +typedef struct bde_ctrl_s { + struct list_head list; + + /* Specify the type of device, pci, spi, switch, ether ... */ + uint32 dev_type; + + int domain_no; + int bus_no; + int be_pio; + int use_msi; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) + struct msix_entry *entries; +#endif + int msix_cnt; + union { + /* Linux PCI device pointer */ + struct pci_dev* _pci_dev; + + /* SPI device pointer */ + struct spi_dev* _spi_dev; + } dev; +#define pci_device dev._pci_dev +#define spi_device dev._spi_dev + +#ifdef LINUX_BDE_DMA_DEVICE_SUPPORT + struct device *dma_dev; +#endif + + /* Physical addresses */ + resource_size_t phys_address; + resource_size_t phys_address1; + resource_size_t phys_address2; + + /* Secondary mapped base address */ + sal_vaddr_t alt_base_addr; + + /* BDE device description */ + ibde_dev_t bde_dev; + + /* Interrupt Handling */ + int iLine; /* Interrupt line */ + void (*isr)(void *); + void *isr_data; + + /* + * Controls to allow two drivers to share a single set of + * hardware registers. Typically a kernel driver will handle + * a subset of hardware interrupts and a user mode driver + * will handle the remaining interrupts. + */ + void (*isr2)(void *); + void *isr2_data; + uint32_t fmask; /* Interrupts controlled by secondary handler */ + uint32_t imask; /* Enabled interrupts for primary handler */ + uint32_t imask2; /* Enabled interrupts for secondary handler */ + spinlock_t lock; /* Lock for IRQ mask synchronization */ + + /* Hardware abstraction for shared BDE functions */ + shbde_hal_t shbde; + + /* Device state : BDE_DEV_STATE_REMOVED/CHANGED */ + uint32 dev_state; + + /* inst_id */ + uint32 inst_id; +} bde_ctrl_t; + +static bde_ctrl_t _devices[LINUX_BDE_MAX_DEVICES]; +static int _ndevices = 0; +static int _switch_ndevices = 0; +static int _ether_ndevices = 0; +static int _cpu_ndevices = 0; +static int robo_switch = 0; + +#define VALID_DEVICE(_n) ((_n >= 0) && (_n < _ndevices)) + +/* CPU MMIO area used with CPU cards provided on demo boards */ +#if (defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT)) && (defined(__DUNE_WRX_BCM_CPU__) || defined(__DUNE_GTO_BCM_CPU__)) +static void *cpu_address = NULL; +#endif + +#ifdef BCM_ROBO_SUPPORT + +/* for SPI access via bcm4710 core */ +static void *robo = NULL; +static void *sbh = NULL; + +#ifdef ALTA_ROBO_SPI + +extern void *alta_eth_spi_ctrl; + +extern int +robo_spi_read(void *cookie, uint16_t reg, uint8_t *buf, int len); + +extern int +robo_spi_write(void *cookie, uint16_t reg, uint8_t *buf, int len); + +#define ROBO_RREG(_robo, _dev, _page, _reg, _buf, _len) \ + robo_spi_read(_dev ? NULL : alta_eth_spi_ctrl, \ + (_page << 8) | (_reg), _buf, _len) +#define ROBO_WREG(_robo, _dev, _page, _reg, _buf, _len) \ + robo_spi_write(_dev ? NULL : alta_eth_spi_ctrl, \ + (_page << 8) | (_reg), _buf, _len) + +#else /* !ALTA_ROBO_SPI */ + +#if defined(KEYSTONE) || defined(IPROC_CMICD) +#define ROBO_RREG(_robo, _dev, _page, _reg, _buf, _len) \ + robo_rreg(_robo, _dev, _page, _reg, _buf, _len) +#define ROBO_WREG(_robo, _dev, _page, _reg, _buf, _len) \ + robo_wreg(_robo, _dev, _page, _reg, _buf, _len) +#else +#define ROBO_RREG(_robo, _dev, _page, _reg, _buf, _len) +#define ROBO_WREG(_robo, _dev, _page, _reg, _buf, _len) +#endif + +#endif /* ALTA_ROBO_SPI */ + +#endif /* BCM_ROBO_SUPPORT */ + +/* Broadcom BCM4704 */ +#define BCM4704_VENDOR_ID 0x14E4 +#define BCM4704_DEVICE_ID 0x4704 + +/* SiByte PCI Host */ +#define SIBYTE_PCI_VENDOR_ID 0x166D +#define SIBYTE_PCI_DEVICE_ID 0x0001 + +/* Intel 21150 PCI-PCI Bridge */ +#define DC21150_VENDOR_ID 0x1011 +#define DC21150_DEVICE_ID 0x0022 + +/* HiNT HB4 PCI-PCI Bridge (21150 clone) */ +#define HINT_HB4_VENDOR_ID 0x3388 +#define HINT_HB4_DEVICE_ID 0x0022 + +/* Pericom PI7C8150 PCI-PCI Bridge (21150 clone) */ +#define PI7C8150_VENDOR_ID 0x12D8 +#define PI7C8150_DEVICE_ID 0x8150 + +/* Pericom PI7C9X130 PCI-PCIE Bridge */ +#define PCI_VNDID_PERICOM 0x12D8 +#define PCI_DEVID_PI7C9X130 0xE130 +#define DEV_CTRL_REG 0xb8 + +#define MAX_PAYLOAD_256B (1 << 5) +#define MAX_PAYLOAD_512B (2 << 5) +#define MAX_READ_REQ_256B (1 << 12) + + +/* Freescale 8548 PCI-E host Bridge */ +#define FSL_VENDOR_ID 0x1957 +#define FSL8548PCIE_DEVICE_ID 0x0013 +#define FSL2020EPCIE_DEVICE_ID 0x0070 +#define FSL8548PCIE_DEV_CTRL_REG 0x54 + +/* 4716 PCI-E host Bridge */ +#define BCM4716_VENDOR_ID 0x14e4 +#define BCM4716PCIE_DEVICE_ID 0x4716 +#define BCM4716PCIE_DEV_CAP_REG 0xd4 +#define BCM4716PCIE_DEV_CTRL_REG 0xd8 +#define BCM53000_VENDOR_ID 0x14e4 +#define BCM53000PCIE_DEVICE_ID 0x5300 + +#define BCM53000PCIE_DEV(port) ((port == 0) ? pcie0 : pcie1) +#define BCM53000PCIE_BASE(port) ((port == 0) ? 0xb8005000 : 0xb800e000) +#define BCM53000PCIE_FUNC0_COFIG_SPACE 0x400 +#define BCM53000PCIE_SROM_SPACE 0x800 +#define BCM53000PCIE_DEV_CAP_REG 0xd4 +#define BCM53000PCIE_DEV_CTRL_REG 0xd8 +#define BCM53000PCIE_MAX_PAYLOAD_MASK 0x7 +#define BCM53000PCIE_CAP_MAX_PAYLOAD_256B (1 << 0) +#define BCM53000PCIE_DEFAULT_STATUS 0x00100146 + +/* 16bit wide register. offset 14, 14*2 = 0x1c */ +#define BCM53000PCIE_SPROM_OFFSET 0x1c +/* bit 15:13 spromData.MaxPayloadSize. 1: 256 bytes */ +#define BCM53000PCIE_SPROM_MAX_PAYLOAD_MASK 0xe000 +#define BCM53000PCIE_SPROM_MAX_PAYLOAD_256B (1 << 13) + + +/* Intel 21150, HiNT HB4 and other 21150-compatible */ +#define PCI_CFG_DEC21150_SEC_CLK 0x68 + +#define BCM4704_ENUM_BASE 0x18000000 +#define BCM4704_MEMC_BASE (BCM4704_ENUM_BASE+0x8000) +#define BCM4704_MEMC_PRIORINV 0x18 + +/* PLX PCI-E Switch */ +#define PLX_PEX8608_DEV_ID 0x8608 +#define PLX_PEX8617_DEV_ID 0x8617 +#define PLX_PEX86XX_DEV_CTRL_REG 0x70 + +/* Broadcom BCM58525 */ +#define BCM58525_PCI_VENDOR_ID 0x14E4 +#define BCM58525_PCI_DEVICE_ID 0x8025 +#define BCM58522_PCI_DEVICE_ID 0x8022 + +/* Broadcom BCM58712 */ +#define BCM58712_PCI_VENDOR_ID 0x14E4 +#define BCM58712_PCI_DEVICE_ID 0x168E + +static uint32_t _read(int d, uint32_t addr); + +#ifdef BCM_ICS +#else +/* Used to determine overall memory limits across all devices */ +static uint32_t _pci_mem_start = 0xFFFFFFFF; +static uint32_t _pci_mem_end = 0; + +/* Used to control MSI interrupts */ +static int use_msi = 0; +#endif + +#ifdef BCM_PLX9656_LOCAL_BUS + +#define CPLD_OFFSET 0x00800000 +#define CPLD_REVISION_REG 0x0000 +#define CPLD_REVISION_MASK 0xffff +#define CPLD_RESET_REG 0x0004 +#define CPLD_RESET_NONE 0x0000 + +#define PL0_OFFSET 0x00800000 +#define PL0_SIZE 0x00040000 +#define PL0_REVISION_REG 0x0000 + +/* Assume there's only one PLX PCI-to-Local bus bridge if any */ +static bde_ctrl_t plx_ctrl; +static int num_plx = 0; + +#endif /* BCM_PLX9656_LOCAL_BUS */ + +static spinlock_t bus_lock; + +static int +_parse_eb_args(char *str, char * format, ...) + __attribute__ ((format (scanf, 2, 3))); + +static int +_parse_eb_args(char *str, char * format, ...) +{ + va_list args; + + va_start(args, format); + vsscanf(str, format, args); + va_end(args); + + return 0; +} + +static int +_eb_device_create(resource_size_t paddr, int irq, int rd_hw, int wr_hw) +{ + bde_ctrl_t *ctrl; + uint32 dev_rev_id = 0x0, dev_id; + + dev_id = _ndevices; + + ctrl = _devices + _ndevices++; + _switch_ndevices++; + + ctrl->dev_type |= BDE_EB_DEV_TYPE | BDE_SWITCH_DEV_TYPE; + ctrl->pci_device = NULL; /* No PCI bus */ + + if(rd_hw) { + ctrl->dev_type |= BDE_DEV_BUS_RD_16BIT; + } + + if (wr_hw) { + ctrl->dev_type |= BDE_DEV_BUS_WR_16BIT; + } + + /* Map in the device */ + ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(paddr, 0x10000); + ctrl->phys_address = paddr; + + dev_rev_id = _read(dev_id, 0x178); /* CMIC_DEV_REV_ID */ + + ctrl->bde_dev.device = dev_rev_id & 0xFFFF; + ctrl->bde_dev.rev = (dev_rev_id >> 16) & 0xFF; + + ctrl->iLine = irq; + ctrl->isr = NULL; + ctrl->isr_data = NULL; + + gprintk("Created EB device at BA=%x IRQ=%d RD16=%d WR16=%d device=0x%x\n", + (unsigned int)paddr, irq, rd_hw, wr_hw, ctrl->bde_dev.device); + + return 0; +} + +#if defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT) + +#include + +static int +sand_device_create(void) +{ + bde_ctrl_t* ctrl; + + ctrl = _devices; /* FIX_ME: on petra, take first device */ + +#ifndef __DUNE_LINUX_BCM_CPU_PCIE__ + _switch_ndevices++; + _ndevices++; + + ctrl->dev_type |= BDE_PCI_DEV_TYPE | BDE_SWITCH_DEV_TYPE; + ctrl->pci_device = NULL; /* No PCI bus */ + + /* Map in the device */ /* FIX_ME: not realy map anything */ + ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(0x40000000, 0x100000); + ctrl->phys_address = 0x40000000; + + ctrl->iLine = 0; + ctrl->isr = NULL; + ctrl->isr_data = NULL; + + ctrl->bde_dev.device = BCM88950_DEVICE_ID; + ctrl->bde_dev.rev = BCM88950_A0_REV_ID; +#endif + + /* Map CPU regs */ +#ifdef __DUNE_WRX_BCM_CPU__ + cpu_address = IOREMAP(0x18000000, 0x4000000); +#elif defined(__DUNE_GTO_BCM_CPU__) + cpu_address = IOREMAP(0xe0000000, 0x100000); +#endif + + if ((ctrl->bde_dev.device == PCP_PCI_DEVICE_ID)) { + ctrl->bde_dev.device = GEDI_DEVICE_ID; + ctrl->bde_dev.rev = GEDI_REV_ID; + } + + if ((ctrl->bde_dev.device == ACP_PCI_DEVICE_ID)) { + ctrl->dev_type |= BDE_PCI_DEV_TYPE | BDE_SWITCH_DEV_TYPE; + } + + return 0; +} +#endif + +#ifdef IPROC_CMICD +static void +iproc_cmicd_get_irqres(ibde_dev_t bde_dev, struct resource *res_irq) +{ + shbde_iproc_config_t iproc_config, *icfg = &iproc_config; + + /* iProc configuration parameters */ + memset(icfg, 0, sizeof(*icfg)); + shbde_iproc_config_init(icfg, bde_dev.device, bde_dev.rev); + + if ((icfg->iproc_ver == 0) && (debug >= 1)) { + gprintk("Unable to determine iProc version\n"); + } + + if (icfg->iproc_ver == 7) { + res_irq->start = 221; + } else if (icfg->iproc_ver == 10) { + res_irq->start = 184; + } + +} + +#include +#include + +extern void iproc_platform_driver_register(struct platform_driver *drv); +extern void iproc_platform_driver_unregister(struct platform_driver *drv); +extern void iproc_platform_device_register(struct platform_device *drv); +extern void iproc_platform_device_unregister(struct platform_device *drv); + +extern struct resource * +iproc_platform_get_resource(struct platform_device *dev, unsigned int type, + unsigned int num); + +#define IPROC_CHIPCOMMONA_BASE 0x18000000 +#define IPROC_CMICD_BASE 0x48000000 +#define IPROC_CMICD_SIZE 0x40000 +#define IPROC_CMICD_INT 194 + +#define IPROC_CMICD_COMPATIBLE "brcm,iproc-cmicd" + +static int +iproc_cmicd_probe(struct platform_device *pldev) +{ + bde_ctrl_t *ctrl; + uint32 size, dev_rev_id; + struct resource *memres, *irqres; +#ifdef CONFIG_OF + if (debug >= 1) { + gprintk("iproc_cmicd_probe %s\n", pldev->dev.of_node ? "with device node":""); + } +#endif + memres = iproc_platform_get_resource(pldev, IORESOURCE_MEM, 0); + if (memres == NULL) { + gprintk("Unable to retrieve iProc CMIC resources"); + return -1; + } + size = memres->end - memres->start + 1; + + ctrl = _devices + _ndevices++; + _switch_ndevices++; + + ctrl->dev_type = BDE_AXI_DEV_TYPE | BDE_SWITCH_DEV_TYPE | BDE_256K_REG_SPACE; + ctrl->pci_device = NULL; /* No PCI bus */ + + /* Map CMIC block in the AXI memory space into CPU address space */ + ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(memres->start, size); + if (!ctrl->bde_dev.base_address) { + gprintk("Error mapping iProc CMIC registers"); + return -1; + } + ctrl->phys_address = memres->start; + + /* Read switch device ID from CMIC */ + dev_rev_id = *((uint32_t*)(ctrl->bde_dev.base_address + 0x10224)); +#if defined(BCM_CMICM_SUPPORT) && defined(BE_HOST) + ctrl->bde_dev.device = ( (((dev_rev_id >> 16) & 0xff) << 8) | + ((dev_rev_id >> 24) & 0xff)); + ctrl->bde_dev.rev = (dev_rev_id >> 8) & 0xff ; +#else + ctrl->bde_dev.device = dev_rev_id & 0xffff; + ctrl->bde_dev.rev = (dev_rev_id >> 16) & 0xff; +#endif + +#ifdef CONFIG_OF + if (!pldev->dev.of_node) +#endif + { + /* Assign locally if not available from device node */ + iproc_cmicd_get_irqres(ctrl->bde_dev, &pldev->resource[0]); + } + irqres = iproc_platform_get_resource(pldev, IORESOURCE_IRQ, 0); + + ctrl->iLine = irqres->start; + + ctrl->isr = NULL; + ctrl ->isr_data = NULL; + +#ifdef LINUX_BDE_DMA_DEVICE_SUPPORT + ctrl->dma_dev = &pldev->dev; +#endif + + /* Let's boogie */ + return 0; +} + +static int +iproc_cmicd_remove(struct platform_device *pldev) +{ + return 0; +} +#ifdef CONFIG_OF +static const struct of_device_id iproc_cmicd_of_match[] = { + { .compatible = "brcm,iproc-cmicd" }, + {}, +}; +MODULE_DEVICE_TABLE(of, iproc_cmicd_of_match); +#endif +static char iproc_cmicd_string[] = "bcmiproc-cmicd"; + +static struct platform_driver iproc_cmicd_driver = +{ + .probe = iproc_cmicd_probe, + .remove = iproc_cmicd_remove, + .driver = + { + .name = iproc_cmicd_string, + .owner = THIS_MODULE, +#ifdef CONFIG_OF + .of_match_table = iproc_cmicd_of_match, +#endif + }, +}; + +typedef enum { + IPROC_CMICD_RES_INTR = 0, + IPROC_CMICD_RES_MEM +} IPROC_CMICD_RES_E; + +static struct resource iproc_cmicd_resources[] = { + [IPROC_CMICD_RES_INTR] = { + .flags = IORESOURCE_IRQ, + .start = IPROC_CMICD_INT, + }, + [IPROC_CMICD_RES_MEM] = { + .flags = IORESOURCE_MEM, + .start = IPROC_CMICD_BASE, + .end = IPROC_CMICD_BASE+IPROC_CMICD_SIZE-1, + }, +}; + +static void +iproc_cmicd_release(struct device *dev) +{ +} + +static u64 iproc_cmicd_dmamask = DMA_BIT_MASK(32); + +static struct platform_device iproc_cmicd_pdev = { + .name = iproc_cmicd_string, + .id = 0, + .dev = { + .release = iproc_cmicd_release, + .init_name = iproc_cmicd_string, + .dma_mask = &iproc_cmicd_dmamask, + .coherent_dma_mask = DMA_BIT_MASK(32), + }, + .resource = iproc_cmicd_resources, + .num_resources = ARRAY_SIZE(iproc_cmicd_resources), +}; + +static int +iproc_has_cmicd(void) +{ + void *iproc_cca_base; + uint32 cca_cid; + + /* Read ChipcommonA chip id register to identify current SOC */ + iproc_cca_base = IOREMAP(IPROC_CHIPCOMMONA_BASE, 0x3000); + if (iproc_cca_base == NULL) { + gprintk("iproc_has_cmicd: ioremap of ChipcommonA registers failed"); + return 0; + } + cca_cid = readl((uint32 *)iproc_cca_base); + cca_cid &= 0xffff; + iounmap(iproc_cca_base); + + /* Only allowed accessing CMICD module if the SOC has it */ + switch (cca_cid) { + case BCM53010_CHIP_ID: + case BCM53018_CHIP_ID: + case BCM53020_CHIP_ID: + return 0; + default: + break; + } + + /* Device has CMIC */ + return 1; +} + +#define IPROC_CHIPCOMMONA_EROM_PTR_OFFSET (0x180000fc) +#define EROM_MAX_SIZE (0x1000) +#define EROM_PARTNUM_CMICD (0x14) + +#define EROM_DESC_COMPIDENT (0x1) +#define EROM_DESC_MASTER (0x3) +#define EROM_DESC_ADDR (0x5) +#define EROM_DESC_END (0xF) +#define EROM_DESC_EMPTY (0) + +#define EROM_IS_DESC_COMPIDENT(x) ((x & 0x7) == EROM_DESC_COMPIDENT) +#define EROM_IS_DESC_MASTER(x) ((x & 0x7) == EROM_DESC_MASTER) +#define EROM_IS_DESC_ADDR(x) ((x & 0x7) == EROM_DESC_ADDR) +#define EROM_IS_DESC_END(x) ((x & 0xF) == EROM_DESC_END) + +#define EROM_GET_PARTNUM(x) ((x >> 8) & (0xFFF)) /* Bit 8~19 */ +#define EROM_GET_ADDRESS(x) ((x >> 12) & (0xFFFFF)) /* Bit 12~31 */ +#define EROM_GET_SIZETYPE(x) ((x >> 4) & (0x3)) /* Bit 4~5 */ +#define EROM_GET_AG32(x) ((x >> 3) & (0x1)) /* Bit 3 */ +#define EROM_GET_SIZE(x) ((x >> 12) & (0xFFFFF)) /* Bit 12~31 */ +#define EROM_GET_SG32(x) ((x >> 3) & (0x1)) /* Bit 3 */ + +#define EROM_ADDR_SIZETYPE_4K (0) +#define EROM_ADDR_SIZETYPE_8K (1) +#define EROM_ADDR_SIZETYPE_16K (2) +#define EROM_ADDR_SIZETYPE_MORE (3) + +#define EROM_ADDR_FLAG_AG32 (1) /* Address space greater than 32 bit */ +#define EROM_ADDR_FLAG_SIZE (2) /* Addition size descriptor */ +#define EROM_ADDR_FLAG_SG32 (4) /* Size descriptor greater than 32 bit */ + +static void +iproc_cmicd_get_memregion(struct resource *res_mem) +{ + void *erom_ptr_oft; + uint32_t erom_phy_addr; + uint32_t *erom_base; + uint32_t i = 0; + uint32_t word = 0; + uint8_t more_addr_word = 0; /* bit 0: AG32; bit 1: SIZE; bit 2: SG32 */ + uint8_t found_cmicd_dev = 0; + uint8_t size_type = 0; + bool is_compident_a = 1; /* 1: CompidentA; o/w: CompidentB */ + + erom_ptr_oft = IOREMAP(IPROC_CHIPCOMMONA_EROM_PTR_OFFSET, 0x100); + + erom_phy_addr = readl((uint32 *)(erom_ptr_oft)); + iounmap(erom_ptr_oft); + + erom_base = IOREMAP(erom_phy_addr, EROM_MAX_SIZE); + + while (1) { + word = readl((uint32 *)(erom_base + i)); + + if (EROM_IS_DESC_ADDR(word) || more_addr_word) { + if (more_addr_word == 0) { /* Normal Addr Desc */ + if (EROM_GET_AG32(word) == 1) { + more_addr_word |= EROM_ADDR_FLAG_AG32; + } + + size_type = EROM_GET_SIZETYPE(word); + if (size_type == EROM_ADDR_SIZETYPE_MORE) { + more_addr_word |= EROM_ADDR_FLAG_SIZE; + } + + if (found_cmicd_dev == 1) { + res_mem->start = EROM_GET_ADDRESS(word) << 12; + if (size_type < EROM_ADDR_SIZETYPE_MORE) { + res_mem->end = res_mem->start + 4096 * (1 << size_type) - 1; + } + } + } + else if (more_addr_word & EROM_ADDR_FLAG_AG32) { /* UpperAddr Desc */ + more_addr_word &= ~EROM_ADDR_FLAG_AG32; + + if (found_cmicd_dev == 1) { + /* res_mem->start |= word << 32; */ + gprintk("Expect cmicd address to be 32-bit\n"); + } + } + else if (more_addr_word & EROM_ADDR_FLAG_SIZE) { /* Size Desc */ + if (EROM_GET_SG32(word) == 1) { + more_addr_word |= EROM_ADDR_FLAG_SG32; + } + + more_addr_word &= ~EROM_ADDR_FLAG_SIZE; + + if (found_cmicd_dev == 1) { + res_mem->end = res_mem->start + (EROM_GET_SIZE(word) << 12) - 1; + } + } + else if (more_addr_word & EROM_ADDR_FLAG_SG32) { /* UpperSize Desc */ + more_addr_word &= ~EROM_ADDR_FLAG_SG32; + + if (found_cmicd_dev == 1) { + /* res_mem->end += (word) << 32; */ + gprintk("Expect cmicd size to be 32-bit\n"); + } + } + + if (found_cmicd_dev == 1 && more_addr_word == 0) { + break; /* We have gotten all necessary information, exit the loop */ + } + } + else if (EROM_IS_DESC_COMPIDENT(word)) { + if (is_compident_a == 1) { + if (EROM_GET_PARTNUM(word) == EROM_PARTNUM_CMICD) { + found_cmicd_dev = 1; + } + } + + is_compident_a = 1 - is_compident_a; + } + else if (EROM_IS_DESC_END(word)) { + break; + } + + i++; + } + iounmap(erom_base); + + if (debug >= 1) { + gprintk("CMICD info by %s: cmicd_mem.start=%x, cmicd_mem.end=%x\n", + found_cmicd_dev ? "EROM" : "Default", + iproc_cmicd_resources[IPROC_CMICD_RES_MEM].start, + iproc_cmicd_resources[IPROC_CMICD_RES_MEM].end); + } +} +#endif /* IPROC_CMICD */ + +#ifdef BCM_ICS +static int +_ics_bde_create(void) +{ + bde_ctrl_t *ctrl; + uint32 dev_rev_id = 0x0; + resource_size_t paddr; + + if (_ndevices == 0) { + ctrl = _devices + _ndevices++; + _switch_ndevices++; + + ctrl->dev_type |= BDE_ICS_DEV_TYPE | BDE_SWITCH_DEV_TYPE; + ctrl->pci_device = NULL; /* No PCI bus */ + + /* Map in the device */ + paddr = BCM_ICS_CMIC_BASE; + ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(paddr, 0x10000); + ctrl->phys_address = paddr; + + dev_rev_id = *((unsigned int *)(KSEG1ADDR(paddr + 0x178))); + + ctrl->bde_dev.device = dev_rev_id & 0xFFFF; + ctrl->bde_dev.rev = (dev_rev_id >> 16) & 0xFF; + + ctrl->iLine = 5; /* From raptor linux BSP */ + + ctrl->isr = NULL; + ctrl->isr_data = NULL; + printk("Created ICS device ..%x\n", ctrl->bde_dev.base_address); + } + + return 0; +} + +#else /* !BCM_ICS */ + +extern struct pci_bus *pci_find_bus(int domain, int busnr); + +/* + * PCI device table. + * Populated from the include/soc/devids.h file. + */ + +static struct pci_device_id _id_table[] = { + { BROADCOM_VENDOR_ID, BCM5675_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM5676_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56218X_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56218_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56219_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56218R_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56219R_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56214_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56215_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56214R_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56215R_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56216_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56217_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56212_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56213_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56230_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56231_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53718_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53714_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53716_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56018_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56014_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56224_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56225_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56226_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56227_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56228_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56229_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56024_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56025_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53724_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53726_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56100_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56101_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56102_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56105_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56106_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56107_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56110_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56111_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56112_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56115_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56116_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56117_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56300_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56301_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56302_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56303_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56304_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56404_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56305_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56306_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56307_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56308_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56309_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56310_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56311_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56312_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56313_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56314_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56315_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56316_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56317_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56318_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56319_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, +#ifndef EXCLUDE_BCM56324 + { BROADCOM_VENDOR_ID, BCM56322_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56324_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, +#endif /* EXCLUDE_BCM56324 */ + { BROADCOM_VENDOR_ID, BCM53312_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53313_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53314_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53324_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53333_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53334_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53342_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53343_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53344_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53346_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53347_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53393_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53394_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53300_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53301_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53302_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56500_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56501_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56502_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56503_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56504_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56505_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56506_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56507_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56508_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56509_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56510_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56511_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56512_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56513_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56514_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56516_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56517_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56518_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56519_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56580_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56620_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56624_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56626_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56628_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56629_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56680_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56684_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56700_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56701_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56720_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56721_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56725_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56800_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56801_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56802_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56803_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56820_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56821_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56822_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56823_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56825_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56630_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56634_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56636_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56638_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56639_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56538_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56520_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56521_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56522_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56524_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56526_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56534_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56685_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56689_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56331_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56333_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56334_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56338_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56320_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56321_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56132_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56134_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88732_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56140_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56142_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56143_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56144_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56146_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56147_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56149_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56150_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56151_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56152_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56613_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56930_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56931_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56935_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56936_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56939_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56840_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56841_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56842_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56843_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56844_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56845_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56846_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56847_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56549_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56053_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56838_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56831_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56835_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56849_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56742_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56743_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56744_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56745_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56746_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56640_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56548_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56547_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56346_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56345_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56344_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56342_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56340_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56049_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56048_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56047_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56042_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56041_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56040_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56643_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56644_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56648_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56649_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56540_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56541_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56542_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56543_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56544_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56545_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56546_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56044_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56045_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56046_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88230_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88030_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88034_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88039_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88231_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88235_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88236_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88239_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM55440_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56440_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56441_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56442_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56443_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56445_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56446_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56447_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56448_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56449_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56240_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56241_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56242_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56243_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56245_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56246_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM55450_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM55455_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56260_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56270_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56271_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56272_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53460_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53461_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56261_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56262_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56263_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56265_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56266_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56267_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56268_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56233_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56460_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56461_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56462_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56463_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56465_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56466_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56467_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56468_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56246_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56248_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56450_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56452_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56454_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56455_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56456_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56457_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56458_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56850_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56851_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56852_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56853_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56854_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56855_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56834_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56750_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56830_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM55440_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM55441_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56060_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56062_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56063_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56064_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56065_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56066_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53401_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53411_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53402_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53412_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53403_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53413_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53404_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53414_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53405_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53415_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53406_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53416_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53408_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53418_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53454_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53455_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53456_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53457_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53422_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53424_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53426_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53365_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53369_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56960_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56961_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56962_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56963_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56930_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56968_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56970_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56971_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56972_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56974_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56168_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56169_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56560_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56561_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56562_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56565_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56566_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56567_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56568_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56760_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56762_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56764_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56765_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56766_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56768_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56069_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56068_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56160_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56162_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56163_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56164_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56166_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53440_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53443_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53442_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53434_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56965_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56969_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56966_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56967_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56170_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56172_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56174_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53570_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM53575_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, +#ifdef BCM_ROBO_SUPPORT + { BROADCOM_VENDOR_ID, BCM47XX_ENET_ID, PCI_ANY_ID, PCI_ANY_ID }, +#ifdef KEYSTONE + { BROADCOM_VENDOR_ID, BCM53000_GMAC_ID, PCI_ANY_ID, PCI_ANY_ID }, +#endif +#endif + { SANDBURST_VENDOR_ID, QE2000_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { SANDBURST_VENDOR_ID, BCM88020_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { SANDBURST_VENDOR_ID, BCM88025_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9656, PCI_ANY_ID, PCI_ANY_ID }, + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9056, PCI_ANY_ID, PCI_ANY_ID }, + { BCM53000_VENDOR_ID, BCM53000PCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, +#ifdef BCM_PETRA_SUPPORT + { BROADCOM_VENDOR_ID, BCM88650_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88350_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88351_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88450_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88451_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88550_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88551_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88552_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88651_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88654_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { PCP_PCI_VENDOR_ID, PCP_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { ACP_PCI_VENDOR_ID, ACP_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88660_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88670_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88671_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88671M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88672_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88673_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88674_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88675_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88675M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88676_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88676M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88677_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88678_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88679_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88370_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88371_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88371M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88375_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88470_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88470P_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88471_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88473_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88474_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88474H_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88476_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88477_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + + + { BROADCOM_VENDOR_ID, BCM88270_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88272_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88273_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88278_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + + { BROADCOM_VENDOR_ID, BCM8206_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + + { BROADCOM_VENDOR_ID, BCM88376_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88376M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88377_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88378_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88379_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88680_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88681_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88682_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88683_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88684_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88685_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88380_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88381_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88690_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88202_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88360_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88361_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88363_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88460_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88461_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88560_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88561_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88562_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88661_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88664_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, +#endif +#ifdef BCM_DFE_SUPPORT + { BROADCOM_VENDOR_ID, BCM88750_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88753_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88755_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88770_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88773_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88774_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88775_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88776_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88777_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, +#ifndef DNX_IGNORE_FE3200 + { BROADCOM_VENDOR_ID, BCM88950_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, +#endif + { BROADCOM_VENDOR_ID, BCM88953_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88954_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88955_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88956_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88752_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88772_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88952_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, +#endif +#ifdef BCM_DNXF_SUPPORT + { BROADCOM_VENDOR_ID, BCM88790_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, +#endif + { BROADCOM_VENDOR_ID, BCM56860_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56861_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56862_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56864_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56865_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56866_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56867_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56868_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56833_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56832_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56836_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56870_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56873_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { 0, 0, 0, 0 } +};; + +#define pci_bus_b(n) list_entry(n, struct pci_bus, node) +#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) +#define MAX_RC_NUM 4 + +static struct pci_bus * +pci_do_bus_find(struct pci_bus* bus, int rc, int vendor, int device) +{ + struct list_head *tmp; + struct pci_dev *dev; + struct pci_bus *sub_bus; + int func = 0; + + if (unlikely(list_empty(&bus->children))) { + return NULL; + } + list_for_each(tmp, &bus->children) { + sub_bus = pci_bus_b(tmp); + dev = sub_bus->self; + func = dev->devfn & 0x7; + if (dev->vendor == vendor && dev->device == device && rc == func) { + if (debug >= 1) { + gprintk("pci_do_bus_find: dev->vendor = 0x%x, dev->device = 0x%x on rc(%d)\n", + dev->vendor, dev->device, rc); + } + return sub_bus; + } + } + return NULL; +} + +static struct pci_dev * +_pci_do_bus_dev_find(struct pci_bus* bus, unsigned int vendor, unsigned int device) +{ + struct list_head *tmp; + struct pci_dev *dev; + + if (unlikely(list_empty(&bus->devices))) { + return NULL; + } + list_for_each(tmp, &bus->devices) { + dev = pci_dev_b(tmp); + if (dev->vendor == vendor && (device == PCI_ANY_ID || dev->device == device)) { + if (debug >= 1) { + gprintk("_pci_do_rc_dev_find: vendor = %x, device = %x\n", vendor, device); + } + return dev; + } + } + return NULL; +} + +static struct pci_dev * +pci_do_rc_dev_find(int rc) +{ + struct pci_bus *root_bus = pci_find_bus(0,0); + struct pci_bus *bus_rc = NULL; + struct pci_dev *dev_on_rc = NULL; + unsigned int pci_dev_id = 0; + + if(NULL == root_bus) { + if (debug >= 1) gprintk("Not find root bus\n"); + return NULL; + } + bus_rc = pci_do_bus_find(root_bus, rc, 0x184e, 0x1004); + if (NULL == bus_rc) { + if (debug >= 1) { + gprintk("Not find vendor(0x184e) device(0x1004) bus\n"); + } + return NULL; + } + for(pci_dev_id = 0; pci_dev_id < sizeof(_id_table)/sizeof(struct pci_device_id); pci_dev_id++) { + dev_on_rc = _pci_do_bus_dev_find(bus_rc, _id_table[pci_dev_id].vendor, _id_table[pci_dev_id].device); + if (NULL != dev_on_rc) { + return dev_on_rc; + } + } + if (debug >= 1) { + gprintk("Not find device at rc(%d)\n", rc); + } + return NULL; +} + +/* + * Function: p2p_bridge + * + * Purpose: + * Finalize initialization secondary PCI-PCI bridge. + * Parameters: + * membase - start of memory address space for secondary PCI bus + * Returns: + * 0 + * Notes: + * The membase depends on the processor architecture, and is + * derived from the memory space addresses set up by the kernel. + */ +static int +p2p_bridge(void) +{ + struct pci_dev *dev, *dev_on_rc; + uint16 cmd; + uint16 mem_base; + uint16 mem_limit; + uint8 bridge_ctrl; + uint8 rc_index; + + if ((dev = PCI_FIND_DEV(DC21150_VENDOR_ID, DC21150_DEVICE_ID, NULL)) != NULL || + (dev = PCI_FIND_DEV(HINT_HB4_VENDOR_ID, HINT_HB4_DEVICE_ID, NULL)) != NULL || + (dev = PCI_FIND_DEV(PI7C8150_VENDOR_ID, PI7C8150_DEVICE_ID, NULL)) != NULL) { + + if (debug >= 1) gprintk("fixing up PCI-to-PCI bridge\n"); + /* Adjust command register */ + pci_read_config_word(dev, PCI_COMMAND, &cmd); + cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; + /* Disable device */ + pci_write_config_word(dev, PCI_COMMAND, 0); + /* Initialize non-prefetchable memory window if needed */ + pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base); + if (mem_base == 0) { + mem_base = (uint16)((_pci_mem_start & 0xFFF00000) >> 16); + mem_limit = (uint16)((_pci_mem_end & 0xFFF00000) >> 16); + pci_write_config_word(dev, PCI_MEMORY_BASE, mem_base); + pci_write_config_word(dev, PCI_MEMORY_LIMIT, mem_limit); + } + /* Enable PCI clocks on remote end */ + pci_write_config_word(dev, PCI_CFG_DEC21150_SEC_CLK, 0); + /* Re-enable config space */ + pci_write_config_word(dev, PCI_COMMAND, cmd); + + /* Avoid DMA data corruption */ + if (dev->vendor == HINT_HB4_VENDOR_ID) { + /* Fix for HiNT bridge and BCM4704 DMA problem */ + if ((dev = PCI_FIND_DEV(BCM4704_VENDOR_ID, BCM4704_DEVICE_ID, NULL)) != NULL) { + /* Reset PrefetchEn (PE) */ + pci_write_config_dword(dev, 0x8c, 1); + if (debug >= 1) { + gprintk("reset PrefetchEn on BCM4704 when HiNT bridge is present\n"); + } + } + } + } + /* Enable fast back-to-back read/write */ + if ((dev = PCI_FIND_DEV(PI7C8150_VENDOR_ID, PI7C8150_DEVICE_ID, NULL)) != NULL) { + pci_read_config_word(dev, PCI_COMMAND, &cmd); + cmd |= PCI_COMMAND_FAST_BACK; + pci_read_config_byte(dev, PCI_BRIDGE_CONTROL, &bridge_ctrl); + bridge_ctrl |= PCI_BRIDGE_CTL_FAST_BACK; + pci_write_config_word(dev, PCI_COMMAND, 0); + pci_write_config_byte(dev, PCI_BRIDGE_CONTROL, bridge_ctrl); + pci_write_config_word(dev, PCI_COMMAND, cmd); + } + /* Netlogic XLP CPU */ + for(rc_index = 0; rc_index < MAX_RC_NUM; rc_index++) { + dev_on_rc = pci_do_rc_dev_find(rc_index); + if (dev_on_rc != NULL ) { + dev = PCI_FIND_DEV(0x184e, 0x1004, NULL); + if (dev != NULL ) { + pci_write_config_dword(dev,0x78,MAX_PAYLOAD_256B | + MAX_READ_REQ_256B); + } + } + } + if ((dev = PCI_FIND_DEV(0x14e4, 0xb634, NULL)) != NULL) { + pci_write_config_dword(dev,0x78,MAX_PAYLOAD_256B | + MAX_READ_REQ_256B); + } + + if ((dev = PCI_FIND_DEV(PCI_VNDID_PERICOM, PCI_DEVID_PI7C9X130, NULL)) != NULL) { + /* + * Configure the PCIE cap: Max payload size: 256, Max Read + * Request size: 256, disabling relax ordering. + * Writes to the PCIE capability device control register + */ + pci_write_config_dword(dev, DEV_CTRL_REG, + MAX_PAYLOAD_256B | MAX_READ_REQ_256B); + } + + if ((dev = PCI_FIND_DEV(FSL_VENDOR_ID, FSL8548PCIE_DEVICE_ID, NULL)) != NULL || + (dev = PCI_FIND_DEV(FSL_VENDOR_ID, FSL2020EPCIE_DEVICE_ID, NULL)) != NULL) { + /* + * Configure the PCIE cap: Max payload size: 256, Max Read + * Request size: 256, disabling relax ordering. + * Writes to the PCIE capability device control register + */ + pci_write_config_dword(dev, FSL8548PCIE_DEV_CTRL_REG, + MAX_PAYLOAD_256B | MAX_READ_REQ_256B); + } + if ((dev = PCI_FIND_DEV(BCM4716_VENDOR_ID, BCM4716PCIE_DEVICE_ID, NULL)) != NULL || + (dev = PCI_FIND_DEV(BCM53000_VENDOR_ID, BCM53000PCIE_DEVICE_ID, NULL)) != NULL) { + uint32 tmp, maxpayld, device_bmp=0, mask; + unsigned long addr; + uint16 tmp16, tmp161; + int i, bus0 = -1, bus1 = -1, port; + struct pci_dev *pcie0, *pcie1; + + pcie0 = dev; + bus0 = dev->bus->number; + if ((pcie1 = PCI_FIND_DEV(BCM53000_VENDOR_ID, BCM53000PCIE_DEVICE_ID, pcie0)) != NULL) { + bus1 = pcie1->bus->number; + } + + for(i = 0; i < _ndevices; i++) { + bde_ctrl_t *ctrl = _devices + i; + + mask = BDE_SWITCH_DEV_TYPE | BDE_PCI_DEV_TYPE; + if ((ctrl->dev_type & mask) == mask) { + if (ctrl->pci_device->bus->number == bus0) { + device_bmp |= 1 << 0; + } + if (ctrl->pci_device->bus->number == bus1) { + device_bmp |= 1 << 1; + } + } + } + + /* configure the PCIE cap: Max payload size: 256, Max Read + * Request size: 256, disabling relax ordering. + * Writes to the PCIE capability device control register + */ + + i = 0; + while(device_bmp) { + if (device_bmp & (1 << i)){ + port = i ; + pci_read_config_dword(BCM53000PCIE_DEV(port), + BCM53000PCIE_DEV_CAP_REG, &tmp); + maxpayld = (tmp & BCM53000PCIE_MAX_PAYLOAD_MASK); + if (debug >= 1) { + gprintk("port %d\n",port); + gprintk("DevCap (@%x): 0x%x%c\n", BCM53000PCIE_DEV_CAP_REG, tmp, + (maxpayld != BCM53000PCIE_CAP_MAX_PAYLOAD_256B) ? ' ':'\n'); + } + if (maxpayld != BCM53000PCIE_CAP_MAX_PAYLOAD_256B) { + addr = BCM53000PCIE_BASE(port); + addr |= (BCM53000PCIE_SROM_SPACE | BCM53000PCIE_SPROM_OFFSET); + tmp16 = *((uint16 *)addr); + if (debug >= 1){ + gprintk("addr %lx spromData.MaxPayloadSize: 0x%x\n", addr, tmp16); + } + mask = BCM53000PCIE_SPROM_MAX_PAYLOAD_MASK; + if ((tmp16 & mask) != BCM53000PCIE_SPROM_MAX_PAYLOAD_256B) { + tmp161 = (tmp16 & ~mask) | BCM53000PCIE_SPROM_MAX_PAYLOAD_256B; + *((uint16 *)addr) = tmp161; + if (debug >= 1) { + tmp16 = 0; + tmp16 = *((uint16 *)addr); + gprintk("Enable spromData.MaxPayloadSize to 1 (256 bytes): " + "0x%x (%s w/ 0x%x)\n", tmp161, + ((tmp16 & mask) == BCM53000PCIE_SPROM_MAX_PAYLOAD_256B) ? + "Success":"Fail", + tmp16); + } + } + pci_read_config_dword(BCM53000PCIE_DEV(port), + BCM53000PCIE_DEV_CAP_REG, &tmp); + if (debug >= 1){ + gprintk("DevCap (@%x): now is 0x%x\n\n", + BCM53000PCIE_DEV_CAP_REG, tmp); + } + } + + addr = BCM53000PCIE_BASE(port); + addr |= (BCM53000PCIE_FUNC0_COFIG_SPACE | BCM53000PCIE_DEV_CTRL_REG); + tmp16 = *((uint16 *)addr); + if (debug >= 1) { + gprintk("DevControl (@%x): 0x%x\n", BCM53000PCIE_DEV_CTRL_REG, tmp16); + } + if (!(tmp16 & MAX_PAYLOAD_256B) || !(tmp16 & MAX_READ_REQ_256B)) { + tmp161 = tmp16 | MAX_PAYLOAD_256B | MAX_READ_REQ_256B; + *((uint16 *)addr) = tmp161; + if (debug >= 1) { + tmp16 = 0; + tmp16 = *((uint16 *)addr); + gprintk("addr %lx Enable DevControl MaxPayloadSize to 1 (256 bytes): " + "0x%x (%s w/ 0x%x)\n", addr, tmp161, + (tmp16 & MAX_PAYLOAD_256B) ? "Success":"Fail", + tmp16); + gprintk("Enable DevControl MaxReadRequestSize to 1 (256 bytes): " + "0x%x (%s w/ 0x%x)\n\n", tmp161, + (tmp16 & MAX_READ_REQ_256B) ? "Success":"Fail", + tmp16); + } + } + device_bmp &= ~(1 << i); + } + i++; + } + } + + /* + * Configure max payload to 512 on all ports in the PLX8608/PLX8617. + * The device supports 128, 512, and 1024 max payload sizes. + */ + dev = NULL; + while ((dev = PCI_FIND_DEV(PCI_VENDOR_ID_PLX, PCI_ANY_ID, dev)) != NULL) { + if ((dev->device == PLX_PEX8608_DEV_ID) || + (dev->device == PLX_PEX8617_DEV_ID)) { + uint16 ctrl_reg; + pci_read_config_word(dev, PLX_PEX86XX_DEV_CTRL_REG, &ctrl_reg); + ctrl_reg = (ctrl_reg & ~(7<<5)) | MAX_PAYLOAD_512B; + pci_write_config_word(dev, PLX_PEX86XX_DEV_CTRL_REG, ctrl_reg); + } + } + return 0; +} + +#ifdef BCM_PLX9656_LOCAL_BUS + +#define PLX_LAS0_BA 0x00000004 /* LAS0 Local Base Address Remap */ +#define PLX_LAS1_BA 0x000000f4 /* LAS1 Local Base Address Remap */ +#define PLX_LAS_EN 0x00000001 /* Space Enable bit */ + +#define PLX_MMAP_PCIBAR0 0 /* Memory-Mapped Config (PCIBAR0) */ +#define PLX_LAS0_PCIBAR2 2 /* Local Address Space 0 (PCIBAR2) */ +#define PLX_LAS1_PCIBAR3 3 /* Local Address Space 1 (PCIBAR3) */ + +STATIC int +_plx_las_bar_get(struct pci_dev *dev) +{ + void *local_config_addr; + int bar = -1; + + local_config_addr = IOREMAP(pci_resource_start(dev, PLX_MMAP_PCIBAR0), + pci_resource_len(dev, PLX_MMAP_PCIBAR0)); + if (local_config_addr) { + uint32 las_remap_reg; + /* + * Make sure LAS0BA or LAS1BA is enabled before returning + * BAR that will be used to access the Local Bus + */ + las_remap_reg = ioread32(local_config_addr + PLX_LAS0_BA); + if (las_remap_reg & PLX_LAS_EN) { + bar = PLX_LAS0_PCIBAR2; + } else { + las_remap_reg = ioread32(local_config_addr + PLX_LAS1_BA); + if (las_remap_reg & PLX_LAS_EN) { + bar = PLX_LAS1_PCIBAR3; + } + } + } + iounmap(local_config_addr); + return bar; +} +#endif /* BCM_PLX9656_LOCAL_BUS */ + +static void +_shbde_log_func(int level, const char *str, int param) +{ + level = (level >= SHBDE_DBG) ? 1 : 0; + if (debug >= level) { + gprintk("%s (%d)\n", str, param); + } +} +/* + * Function: _device_rescan_validate + * + * Purpose: + * Check if the device is ever probed or not. + * Parameters: + * dev - Linux PCI device structure + * Returns: + * >= 0 : dev is ever probed + * reutrn value is the index point to the _devices[] + * -1 : dev is not probed before. + */ +static int +_device_rescan_validate(struct pci_dev *dev) +{ + bde_ctrl_t *ctrl; + int i; + + if (PCI_FUNC(dev->devfn) > 0) { + return -1; + } + ctrl = NULL; + for (i = 0; i < _ndevices; i ++) { + ctrl = _devices + i; + /* check the device id */ + if (dev->device == ctrl->bde_dev.device) { + /* check the bus number */ + if ((dev->bus)) { + if ((dev->bus->number == ctrl->bus_no) && + (pci_domain_nr(dev->bus) == ctrl->domain_no)) { + return i; + } + } + } + } + return -1; +} + +#ifdef CONFIG_PCI_MSI + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) +/** + * _pci_msix_table_size - return the number of device's MSI-X table entries + * @dev: pointer to the pci_dev data structure of MSI-X device function + */ +static int +_pci_msix_table_size(struct pci_dev *dev) +{ + int nr_entries = 0; + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,110)) + u16 control; + int pos; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + if (pos) { + pci_read_config_word(dev, msi_control_reg(pos), &control); + nr_entries = msix_table_size(control); + } +#else +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)) +{ + /* Pass large entry value to enable MSIX to get # of entires */ + struct msix_entry *entries; + entries = kmalloc(sizeof(struct msix_entry) * + PCI_MSIX_FLAGS_QSIZE, GFP_KERNEL); + if (entries != NULL) { + nr_entries = pci_enable_msix(dev, + entries, PCI_MSIX_FLAGS_QSIZE); + if (nr_entries < 0) { + nr_entries = 0; + } + kfree(entries); + } +} +#else + nr_entries = pci_msix_vec_count(dev); +#endif +#endif + + return nr_entries; +} +#endif + +static int +_msi_connect(bde_ctrl_t *ctrl) +{ + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) + int ret; + if (ctrl->use_msi == PCI_USE_INT_MSIX) { + int i; + ret = _pci_msix_table_size(ctrl->pci_device); + + if (ret == 0) { + /* MSI-X failed */ + gprintk("MSI-X not supported.\n"); + goto er_intx; + } + ctrl->entries = kcalloc(ret, sizeof(struct msix_entry)*ret, GFP_KERNEL); + + if (!ctrl->entries) { + goto er_intx; + } + /* We need only that much interrupt vecotrs */ + ctrl->msix_cnt = ret/4; + if (unlikely(debug > 1)) + gprintk("MSIX Table size = %d\n", ctrl->msix_cnt); + for (i = 0; i < ctrl->msix_cnt; i++) + ctrl->entries[i].entry = i; + + ret = pci_enable_msix(ctrl->pci_device, + ctrl->entries, ctrl->msix_cnt); + if (ret > 0) { + /* Not enough vectors available , Retry MSI-X */ + gprintk("Retrying with MSI-X interrupts = %d\n", ret); + ctrl->msix_cnt = ret; + ret = pci_enable_msix(ctrl->pci_device, + ctrl->entries, ctrl->msix_cnt); + if (ret != 0) + goto er_intx_free; + } else if (ret < 0) { + /* Error */ + goto er_intx_free; + } else { + gprintk("Enabled MSI-X interrupts = %d\n", ctrl->msix_cnt); + } + } +#endif + + if (ctrl->use_msi == PCI_USE_INT_MSI) { + if (pci_enable_msi(ctrl->pci_device) == 0) { + ctrl->iLine = ctrl->pci_device->irq; + } else { + /* MSI failed */ + gprintk("Failed to initialize MSI interrupts.\n"); + goto er_intx; + } + } else { + /* failed */ + gprintk("Not MSI/MSIC interrupt.\n"); + goto er_intx; + } + return 0; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) +er_intx_free: + gprintk("Failed to enable MSI-X interrupts = %d\n", ret); + kfree(ctrl->entries); +#endif +er_intx: + return -1; + +} + +static int +_msi_disconnect(bde_ctrl_t *ctrl) +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) + if (ctrl->use_msi == PCI_USE_INT_MSIX) { + pci_disable_msix(ctrl->pci_device); + kfree(ctrl->entries); + ctrl->msix_cnt = 0; + } +#endif + if (ctrl->use_msi == PCI_USE_INT_MSI) { + pci_disable_msi(ctrl->pci_device); + } else { + gprintk("MSI not used\n"); + } + return 0; +} + +#endif + + +static void +config_pci_intr_type(bde_ctrl_t *ctrl) +{ + +#ifdef CONFIG_PCI_MSI + int ret; + + ctrl->use_msi = use_msi; + if (unlikely(debug > 1)) + gprintk("%s: msi = %d\n", __func__, ctrl->use_msi); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) + if (ctrl->use_msi == PCI_USE_INT_MSIX) { + /* check for support MSIX vector */ + ret = _pci_msix_table_size(ctrl->pci_device); + if (ret == 0) { + gprintk("%s: Zero MSIX table size\n", __func__); + ctrl->use_msi = PCI_USE_INT_MSI; + } + } +#endif + + if (ctrl->use_msi == PCI_USE_INT_MSI) { + /* check for support MSI vector */ + ret = pci_enable_msi(ctrl->pci_device); + if (ret < 0) { + ctrl->use_msi = PCI_USE_INT_INTX; + gprintk("%s: Failed to enable MSI\n", __func__); + } else { + pci_disable_msi(ctrl->pci_device); + } + } +#else + ctrl->use_msi = PCI_USE_INT_INTX; +#endif +} + +/* + * Function: _pci_probe + * + * Purpose: + * Device initialization callback used by the Linux PCI + * subsystem. Called as a result of pci_register_driver(). + * Parameters: + * dev - Linux PCI device structure + * Returns: + * 0 + */ +static int +_pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) +{ + bde_ctrl_t *ctrl; + resource_size_t paddr; + uint16 cmd = 0; + uint32 bar_len; + int cmic_bar; + int baroff = 0; + int iproc = 0; + uint32 gmac_base = 0; + int plx_dev = 0; + int eth_dev = 0; + int cpu_dev = 0; + int update_devid = 0; + int paxb_core = 0; + int rescan = 0, rescan_idx = -1; + shbde_hal_t shared_bde, *shbde = &shared_bde; + + if (debug >= 4) {gprintk("probing: vendor_id=0x%x, device_id=0x%x\n", dev->vendor, dev->device);} + if (nodevices == 1) { + return 0; + } + + /* Initialize Linux hardware abstraction for shared BDE functions */ + linux_shbde_hal_init(shbde, _shbde_log_func); + + /* + * If an AXI-based switch device has been found already, then it means + * that the AXI bus has been probed, and that we should ignore devices + * found on PCI bus zero. + */ + +#if defined(IPROC_CMICD) + if ((dev->bus) && (dev->bus->number == 0)) { + int i; + uint32 mask = BDE_SWITCH_DEV_TYPE | BDE_AXI_DEV_TYPE; + + for (i = 0; i < _ndevices; i++) { + ctrl = _devices + i; + + if ((ctrl->dev_type & mask) == mask) { + return 0; + } + } + } +#endif /* IPROC_CMICD */ + + /* + * Note that a few supported devices have a non-Broadcom PCI vendor ID, + * but since none of their associated PCI device IDs collide with the + * Broadcom device IDs, the probe code below only checks the device ID. + */ + + switch (dev->device) { + case PCI_DEVICE_ID_PLX_9056: +#ifdef DNX_TEST_BOARD + break; /* a PCIe bridge to a non PCIe device should be treated as the device */ +#endif /* DNX_TEST_BOARD */ + case PCI_DEVICE_ID_PLX_9656: + plx_dev = 1; + break; +#if defined (BCM_ROBO_SUPPORT) && defined(KEYSTONE) + case BCM53000_GMAC_ID: + eth_dev = 1; + gmac_base = SB_ENUM_BASE; + break; +#endif +#if defined (BCM_ROBO_SUPPORT) + case BCM47XX_ENET_ID: + eth_dev = 1; + break; +#endif + case BCM53000PCIE_DEVICE_ID: + cpu_dev = 1; + break; + /* + * The device ID for 56500, 56100 and 56300 family of devices may + * be incorrect just after a PCI HW reset. It needs to be read + * again after stabilization. + */ + case BCM56102_DEVICE_ID: + case BCM56504_DEVICE_ID: + case BCM56304_DEVICE_ID: + case BCM56314_DEVICE_ID: + case BCM56112_DEVICE_ID: + update_devid = 1; + break; + default: + break; + } + + /* Check if the device is ever probed. */ + rescan_idx = _device_rescan_validate(dev); + if (rescan_idx != -1) { + rescan = 1; + } + + ctrl = NULL; + if (plx_dev) { +#if defined(BCM_PLX9656_LOCAL_BUS) + /* PLX chip itself won't be part of _devices[]. */ + baroff = _plx_las_bar_get(dev); + if (baroff == -1) { + gprintk("No Local Address Space enabled in PLX\n"); + return 0; + } + ctrl = &plx_ctrl; + num_plx++; +#endif + } else if (eth_dev) { + if (_ether_ndevices >= LINUX_BDE_MAX_ETHER_DEVICES) { + return 0;; + } + ctrl = _devices + _ndevices++; + _ether_ndevices++; + ctrl->dev_type |= BDE_ETHER_DEV_TYPE; + ctrl->iLine = dev->irq; + if (debug >= 1) + gprintk("Found PCI device %04x:%04x as Ethernet device\n", + dev->vendor, dev->device); + } else if (cpu_dev) { + if (_cpu_ndevices >= LINUX_BDE_MAX_CPU_DEVICES) { + return 0;; + } + ctrl = _devices + _ndevices++; + _cpu_ndevices++; + ctrl->dev_type |= BDE_CPU_DEV_TYPE; + if (debug >= 1) + gprintk("Found PCI device %04x:%04x as CPU device\n", + dev->vendor, dev->device); + } else { + if (PCI_FUNC(dev->devfn) > 0) { + return 0; + } + if (_switch_ndevices >= LINUX_BDE_MAX_SWITCH_DEVICES) { + return 0;; + } + + if (rescan) { + if (debug >= 1) { + gprintk("PCI device %04x:%04x is re-probed \n", + dev->vendor, dev->device); + } + ctrl = _devices + rescan_idx; + ctrl->dev_state = BDE_DEV_STATE_CHANGED; + } else { + ctrl = _devices + _ndevices++; + _switch_ndevices++; + ctrl->dev_type |= BDE_SWITCH_DEV_TYPE; + ctrl->domain_no = pci_domain_nr(dev->bus); + ctrl->bus_no = dev->bus->number; + ctrl->dev_state = BDE_DEV_STATE_NORMAL; + } + + /* Save shared BDE HAL in device structure */ + memcpy(&ctrl->shbde, shbde, sizeof(ctrl->shbde)); + + if (update_devid) { + /* Re-read the device ID */ + pci_read_config_word(dev, + PCI_DEVICE_ID, + &ctrl->bde_dev.device); + dev->device = ctrl->bde_dev.device; + } + + if (debug >= 4) {gprintk("Enabling PCI device : vendor_id=0x%x, device_id=0x%x\n", dev->vendor, dev->device);} + if (pci_enable_device(dev)) { + gprintk("Cannot enable PCI device : vendor_id = %x, device_id = %x\n", + dev->vendor, dev->device); + } + + /* FIXME: "workarounds" previously called "total h_acks" */ + /* + * These are workarounds to get around some existing + * kernel problems :( + */ + + /* + * While probing we determine the overall limits for the PCI + * memory windows across all devices. These limits are used + * later on by the PCI-PCI bridge code. + */ + if (pci_resource_start(dev, baroff) < _pci_mem_start) { + _pci_mem_start = pci_resource_start(dev, baroff); + } + if (pci_resource_end(dev, baroff) > _pci_mem_end) { + _pci_mem_end = pci_resource_end(dev, baroff); + } + +#ifdef CONFIG_SANDPOINT + /* + * Something wrong with the PCI subsystem in the mousse kernel. + * The device is programmed correctly, but the irq in the pci + * structure is hosed. This checks for the hosed-ness and fixes it. + */ + if (dev->irq > 100) { + dev->irq = 2; + gprintk("irq problem: setting irq = %d\n", dev->irq); + } +#endif + +#ifdef CONFIG_BMW + /* + * PCI subsystem does not always program the system correctly. + */ + if (dev->irq < 16 && dev->irq != 2) { + dev->irq = 2; + gprintk("irq problem: setting irq = %d\n", dev->irq); + } +#endif + +#ifdef CONFIG_IDT_79EB334 + /* + * IDT kernel is not currently mapping interrupts correctly + * Hardwired to core mips interrupt, irq 3 for kernel 2.4.18 + */ + if (dev->irq != 3) { + dev->irq = 3; + gprintk("irq problem: setting irq = %d\n", dev->irq); + } +#endif + +#ifdef CONFIG_BCM94702_CPCI + /* + * Hardwired to core mips interrupt irq 6 on MBZ + */ + if (dev->irq != 6) { + dev->irq = 6; + gprintk("irq problem: setting irq = %d\n", dev->irq); + } +#endif + + if ((PCI_FIND_DEV(BCM4704_VENDOR_ID, BCM4704_DEVICE_ID, NULL)) != NULL) { + /* + * Decrease the PCI bus priority for the CPU for better overall + * system performance. This change significantly reduces the + * number of PCI retries from other devices on the PCI bus. + */ + void * _mc_vbase = IOREMAP(BCM4704_MEMC_BASE, 0x1000); + int priorinv = 0x80; + static int done = 0; + if (!done) { + done = 1; + writel(priorinv, _mc_vbase + BCM4704_MEMC_PRIORINV); + if (debug >= 1) + gprintk("set BCM4704 PriorInvTim register to 0x%x\n", priorinv); + iounmap(_mc_vbase); + } + } + + if ((PCI_FIND_DEV(SIBYTE_PCI_VENDOR_ID, SIBYTE_PCI_DEVICE_ID, NULL)) != NULL) { + /* + * The BCM91125CPCI CPU boards with a PCI-PCI bridge use the same + * interrupt line for all switch ships behind the bridge. + */ + if (PCI_FIND_DEV(DC21150_VENDOR_ID, DC21150_DEVICE_ID, NULL) || + PCI_FIND_DEV(HINT_HB4_VENDOR_ID, HINT_HB4_DEVICE_ID, NULL) || + PCI_FIND_DEV(PI7C8150_VENDOR_ID, PI7C8150_DEVICE_ID, NULL)) { + /* + * By default we try to guess the correct IRQ based on the design. + * For now we only look at the bridge vendor, but it may be necessary + * to look at the switch chip configuration as well. + */ + if (forceirq == -1) { + if ((PCI_FIND_DEV(HINT_HB4_VENDOR_ID, HINT_HB4_DEVICE_ID, NULL)) || + ((dev->device == BCM5674_DEVICE_ID) && + (PCI_FIND_DEV(PI7C8150_VENDOR_ID, PI7C8150_DEVICE_ID, NULL)))) { + forceirq = 58; + } else { + forceirq = 56; + } + } + } + } + + if (((PCI_FIND_DEV(BCM58525_PCI_VENDOR_ID, BCM58525_PCI_DEVICE_ID, NULL)) != NULL) || + ((PCI_FIND_DEV(BCM58525_PCI_VENDOR_ID, BCM58522_PCI_DEVICE_ID, NULL)) != NULL) || + ((PCI_FIND_DEV(BCM58712_PCI_VENDOR_ID, BCM58712_PCI_DEVICE_ID, NULL)) != NULL) ) { + /* BCM58525/BCM58712 CPU boards support 128 Max payload size */ + if (maxpayload) { + maxpayload = 128; + if (debug >= 1) gprintk("force max payload size to 128\n"); + } + } + + if (forceirq > 0 && dev->irq != (uint32) forceirq) { + if (forceirqubm & (1U << (_ndevices - 1))) { + dev->irq = forceirq; + if (debug >= 1) gprintk("force irq to %d\n", forceirq); + } + } else if (debug >= 1) gprintk("found irq %d\n", dev->irq); + + ctrl->iLine = dev->irq; + if (unlikely(debug > 1)) + gprintk("%s:irq = %d\n",__func__, ctrl->iLine); + + if (shbde_pci_is_pcie(shbde, dev)) { + /* Set PCIe max payload */ + shbde_pci_max_payload_set(shbde, dev, maxpayload); + } else { + /* Set PCI retry to infinite on non-PCIe switch device */ + pci_write_config_word(dev, 0x40, 0x0080); + if (debug >= 1) gprintk("set DMA retry to infinite on switch device\n"); + } + } + +#if defined(BCM_DFE_SUPPORT) + switch (dev->device) { + case BCM88750_DEVICE_ID: + case BCM88753_DEVICE_ID: + case BCM88755_DEVICE_ID: + case BCM88770_DEVICE_ID: + case BCM88773_DEVICE_ID: + case BCM88774_DEVICE_ID: + case BCM88775_DEVICE_ID: + case BCM88776_DEVICE_ID: + case BCM88777_DEVICE_ID: + case BCM88950_DEVICE_ID: + case BCM88953_DEVICE_ID: + case BCM88954_DEVICE_ID: + case BCM88955_DEVICE_ID: + case BCM88956_DEVICE_ID: + case BCM88752_DEVICE_ID: + case BCM88772_DEVICE_ID: + case BCM88952_DEVICE_ID: + + /* + * For DMA transactions - set Max_Payload_Size and + * Max_Read_Request_Size to 128 bytes. + */ + pci_write_config_byte(dev, 0xb5, 0x0c); + pci_write_config_byte(dev, 0xb4, 0x0); + break; + default: + break; + } +#endif /* BCM_DFE_SUPPORT */ + +#if defined(BCM_DNXF_SUPPORT) + switch (dev->device) { + case BCM88790_DEVICE_ID: + + /* + * For DMA transactions - set Max_Payload_Size and + * Max_Read_Request_Size to 128 bytes. + */ + pci_write_config_byte(dev, 0xb5, 0x0c); + pci_write_config_byte(dev, 0xb4, 0x0); + break; + default: + break; + } +#endif + + /* Prevent compiler warning */ + if (ctrl == NULL) { + return 0; + } + + ctrl->be_pio = 0; + ctrl->dev_type |= BDE_PCI_DEV_TYPE; + ctrl->pci_device = dev; + pci_set_drvdata(dev, ctrl); + + /* Check for iProc device */ + if (shbde_pci_is_iproc(shbde, dev, &cmic_bar)) { + iproc = 1; + if (cmic_bar >= 0) { + baroff = cmic_bar; + } + } +#ifdef DNX_TEST_BOARD + else if (dev->device == PLX9056_DEVICE_ID && baroff == 0) { + baroff = 2; + ctrl->dev_type |= BDE_NO_IPROC/* | BDE_BYTE_SWAP*/; + } +#endif /* DNX_TEST_BOARD */ + + /* Get the device revision */ + pci_read_config_byte(dev, PCI_REVISION_ID, &ctrl->bde_dev.rev); + + /* Map in the device */ + ctrl->bde_dev.device = dev->device; + paddr = pci_resource_start(dev, baroff); + + switch (dev->device) { +#if defined(BCM_PETRA_SUPPORT) && defined(__DUNE_LINUX_BCM_CPU_PCIE__) + case GEDI_DEVICE_ID: + case PCP_PCI_DEVICE_ID: + bar_len = 0x1000000; + break; +#endif + default: + bar_len = pci_resource_len(dev, baroff); + break; + } + + ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(paddr, bar_len); + ctrl->phys_address = paddr; + if (debug >= 3) { + gprintk("BAR %d: kernel addr:0x%lx phys addr:0x%lx length:%lx\n", + baroff, (unsigned long)ctrl->bde_dev.base_address, (unsigned long)paddr, (unsigned long)bar_len); + } + + /* Map secondary address spaces */ + if (iproc +#ifdef DNX_TEST_BOARD + || (dev->device == PLX9056_DEVICE_ID && baroff == 2) +#endif /* DNX_TEST_BOARD */ + ) { + paddr = pci_resource_start(dev, 0); + bar_len = pci_resource_len(dev, 0); + ctrl->bde_dev.base_address1 = (sal_vaddr_t)IOREMAP(paddr, bar_len); + ctrl->phys_address1 = paddr; + if (debug >= 3) { + gprintk("BAR 0: kernel addr:0x%lx phys addr:0x%lx length:%lx\n", + (unsigned long)ctrl->bde_dev.base_address1, (unsigned long)paddr, (unsigned long)bar_len); + } + } + + /* Each device follows global policy by default */ + ctrl->use_msi = use_msi; + + /* Check is MSI is properly supported in kernel for this device */ + if (ctrl->use_msi) { + if (pci_enable_msi(ctrl->pci_device) == 0) { + /* Release MSI resources until interrupt_connect is called */ + pci_disable_msi(ctrl->pci_device); + } else { + gprintk("Could not enable MSI interrupts\n"); + ctrl->use_msi = 0; + } + } + + /* configure interrupt type */ + config_pci_intr_type(ctrl); + + /* Configure iProc PCI-AXI bridge */ + if (iproc && ctrl->bde_dev.base_address1) { + void *iproc_regs; + shbde_iproc_config_t *icfg = &shbde->icfg; + + /* Mapped iProc regs in PCI BAR 0 */ + iproc_regs = (void *)ctrl->bde_dev.base_address1; + + /* iProc configuration parameters */ + (void)shbde_pci_iproc_version_get(shbde, dev, &icfg->iproc_ver, + &icfg->cmic_ver, &icfg->cmic_rev); + shbde_iproc_config_init(icfg, ctrl->bde_dev.device, ctrl->bde_dev.rev); + + if (debug >=2) { + gprintk("iproc version = %x dma_hi_bits = %x\n", icfg->iproc_ver, icfg->dma_hi_bits); + } + icfg->use_msi = ctrl->use_msi; + + /* Call shared function */ + paxb_core = shbde_iproc_paxb_init(shbde, iproc_regs, icfg); + + /* Save PCI core information for CMIC */ + if (paxb_core == 1) { + ctrl->dev_type |= BDE_DEV_BUS_ALT; + } + + /* Save MSI enable state information */ + if (ctrl->use_msi) { + ctrl->dev_type |= BDE_DEV_BUS_MSI; + } + + /* iProc PCIe preemphasis */ + shbde_iproc_pcie_preemphasis_set(shbde, iproc_regs, icfg, dev); + } + + /* Save shared BDE HAL in device structure */ + memcpy(&ctrl->shbde, shbde, sizeof(ctrl->shbde)); + +#if defined(VENDOR_BROADCOM) +#if defined(BCM_PLX9656_LOCAL_BUS) && defined(SHADOW_SVK) + if (num_plx) { + sal_vaddr_t base_address; + uint32 intr_enable; + + paddr = pci_resource_start(dev, 0); + bar_len = pci_resource_len(dev, 0); + base_address = (sal_vaddr_t)IOREMAP(paddr, bar_len); + + intr_enable = readl((uint32 *)(base_address + 0x68)); + gprintk("PLX Interrupt ENABLE: %x\n", intr_enable); + intr_enable |= 0x00080000; + writel(intr_enable, (uint32 *)(base_address + 0x68)); + gprintk("PLX Interrupt ENABLE: %x\n", intr_enable); + } +#endif +#endif + + /* + * Since the GMAC driver of Robo chips needs access to the + * ChipCommon and Wrapper registers, we set the base address + * as the enumeration base address and its size as 3MB to + * cover all Wrapper register regions. + */ + if (gmac_base) { + uint32_t offset; + + ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(gmac_base, 0x300000); + + /* Record the base address of GMAC core */ + offset = ctrl->phys_address - gmac_base; + ctrl->alt_base_addr = ctrl->bde_dev.base_address + offset; + ctrl->phys_address = gmac_base; + } + + /* + * Workaround bug in FE2K A1 part; shows as A0 part in PCI config space, + * read the FE's regs directly to get the true revision + */ + if (ctrl->bde_dev.device == BCM88020_DEVICE_ID && ctrl->bde_dev.rev == 0) { +#define FE2000_REVISION_OFFSET (0x0) + uint32_t fe_rev; + + fe_rev = *((uint32_t*)(ctrl->bde_dev.base_address + FE2000_REVISION_OFFSET)); + if ((fe_rev >> 16) == BCM88020_DEVICE_ID) { + fe_rev &= 0xff; + } else { + fe_rev = (fe_rev >> 24) & 0xff; + } + ctrl->bde_dev.rev = fe_rev; + } + + ctrl->isr = NULL; + ctrl->isr_data = NULL; + + pci_read_config_word(dev, PCI_COMMAND, &cmd); + if (!(cmd & PCI_COMMAND_MEMORY) || !(cmd & PCI_COMMAND_MASTER)) { + cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; + pci_write_config_word(dev, PCI_COMMAND, cmd); + if (debug >= 1) gprintk("enable PCI resources 0x%x (PCI_COMMAND)\n", cmd); + } + + /* Check if we need 256 KB memory window (default is 64 KB) */ + bar_len = pci_resource_len(dev, baroff); + if ((bar_len == 0x40000) || (bar_len == 0x800000)) { + ctrl->dev_type |= BDE_256K_REG_SPACE; + if (debug >= 1) gprintk("PCI resource len 256K\n"); + } + +#if defined (BCM_ROBO_SUPPORT) && !defined(ALTA_ROBO_SPI) + /* MDC/MDIO path for pseudo PHY access to ROBO register on BCM5836/4704 */ + if (dev->device == BCM47XX_ENET_ID) { + ((uint32 *)ctrl->bde_dev.base_address)[0x410 / 4] = 0; + } +#endif + +#ifdef LINUX_BDE_DMA_DEVICE_SUPPORT + ctrl->dma_dev = &dev->dev; +#endif + + if (debug >= 2) { + gprintk("_pci_probe: configured dev:0x%x rev:0x%x with base_addresses: 0x%lx 0x%lx\n", + (unsigned)ctrl->bde_dev.device, (unsigned)ctrl->bde_dev.rev, + (unsigned long)ctrl->bde_dev.base_address, (unsigned long)ctrl->bde_dev.base_address1); + } + /* Let's boogie */ + + return 0; +} + +/* + * Function: _pci_remove + * + * Purpose: + * Detach driver from device. Called from pci_unregister_driver(). + * Parameters: + * dev - Linux PCI device structure + * Returns: + * 0 + */ +static void +_pci_remove(struct pci_dev* dev) +{ + bde_ctrl_t *ctrl; + + if (nodevices == 1) { + return; + } + +#if defined(BCM_DFE_SUPPORT) + if (dev->device == PCI_DEVICE_ID_PLX_9056) { + return; + } +#endif + + ctrl = (bde_ctrl_t *) pci_get_drvdata(dev); + + if (ctrl == NULL) { + /* Unused device */ + return; + } + ctrl->dev_state = BDE_DEV_STATE_REMOVED; + if (debug >= 1) { + gprintk("PCI device %04x:%04x is removed. \n", + dev->vendor, dev->device); + } + if (ctrl->bde_dev.base_address1) { + iounmap((void *)ctrl->bde_dev.base_address1); + } + if (ctrl->bde_dev.base_address) { + iounmap((void *)ctrl->bde_dev.base_address); + } + + /* Free our interrupt handler, if we have one */ + if (ctrl->isr || ctrl->isr2) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) + if (ctrl->use_msi >= PCI_USE_INT_MSIX) { + int i; + for (i = 0; i < ctrl->msix_cnt; i++) + free_irq(ctrl->entries[i].vector, ctrl->pci_device); + } + else +#endif + { + free_irq(ctrl->iLine, ctrl); + } + } +#ifdef CONFIG_PCI_MSI + _msi_disconnect(ctrl); +#endif + ctrl->isr = NULL; + ctrl->isr_data = NULL; + ctrl->isr2 = NULL; + ctrl->isr2_data = NULL; +} + +static struct pci_driver _device_driver = { + probe: _pci_probe, + remove: _pci_remove, + id_table: _id_table, + /* The rest are dynamic */ +}; + +static void +_spi_device_setup(void) { + bde_ctrl_t *ctrl; + ctrl = _devices + _ndevices++; + _switch_ndevices++; + ctrl->dev_type |= BDE_SWITCH_DEV_TYPE; + ctrl->iLine = 0xa3; + ctrl->be_pio = 0; + ctrl->dev_type |= BDE_SPI_DEV_TYPE; + ctrl->bde_dev.device = spi_devid; + ctrl->bde_dev.rev = spi_revid; + if (debug >= 1) { + gprintk("SPI Slave Mode: force ctrl->bde_dev.device=0x%x\n",ctrl->bde_dev.device); + gprintk("SPI Slave Mode: force ctrl->bde_dev.rev=0x%x\n",ctrl->bde_dev.rev); + gprintk("SPI Slave Mode: force ctrl->dev_type=0x%x\n",ctrl->dev_type); + } +} +#endif /* BCM_ICS */ + + +#ifdef BCM_ROBO_SUPPORT + +#ifdef KEYSTONE +#define DEFAULT_FREQ (SPI_FREQ_DEFAULT) +#define FREQ_20MHZ (SPI_FREQ_20MHZ) +#else /* IPROC_CMICD */ +#define DEFAULT_FREQ (0) +#define FREQ_20MHZ (0) +#endif + + +/* +* The model_info /rev_info for Robo devices is defined like this: +* +* 31 28 27 24 23 20 19 16 15 8 7 0 +* +----+---------+------+-----+---------+--------+ +* | op | reserved| mask |len | page |offset | +* +----+---------+------+-----+---------+--------+ +* +* op: 1:OR phyidl, 2: use PCIE device ID +* mlen: mask len (in bytes) 1:means 0xf,2 means 0xff +* len: Size of model/rev ID register (in bytes) +* page: Page containing model ID and revision registers +* offset: Model/rev ID register offset +*/ +static struct bde_spi_device_id _spi_id_table[] = { + { BCM53242_PHYID_HIGH, BCM53242_PHYID_LOW , 0, 0, DEFAULT_FREQ}, + { BCM53262_PHYID_HIGH, BCM53262_PHYID_LOW , 0, 0, DEFAULT_FREQ}, + { BCM53115_PHYID_HIGH, BCM53115_PHYID_LOW , 0, 0, DEFAULT_FREQ}, + { BCM53118_PHYID_HIGH, BCM53118_PHYID_LOW , 0, 0, DEFAULT_FREQ}, + { BCM53280_PHYID_HIGH, BCM53280_PHYID_LOW , 0x101800e8, 0, FREQ_20MHZ}, + { BCM53101_PHYID_HIGH, BCM53101_PHYID_LOW , 0, 0x110240, FREQ_20MHZ}, + { BCM53125_PHYID_HIGH, BCM53125_PHYID_LOW , 0, 0x110240, FREQ_20MHZ}, + { BCM53128_PHYID_HIGH, BCM53128_PHYID_LOW , 0, 0x110240, FREQ_20MHZ}, + { BCM53600_PHYID_HIGH, BCM53600_PHYID_LOW , 0x101800e8, 0, FREQ_20MHZ}, + { BCM89500_PHYID_HIGH, BCM89500_PHYID_LOW ,0x240230, 0x110240, FREQ_20MHZ}, + { BCM53010_PHYID_HIGH, BCM53010_PHYID_LOW ,0x240230, 0x110240, 0}, + { BCM53018_PHYID_HIGH, BCM53018_PHYID_LOW ,0x240230, 0x110240, 0}, + { BCM5389_PHYID_HIGH, BCM5389_PHYID_LOW, 0x110230, 0x110240, DEFAULT_FREQ}, + { BCM53020_PHYID_HIGH, BCM53020_PHYID_LOW ,0x20240230, 0x110240, 0}, + { BCM5396_PHYID_HIGH , BCM5396_PHYID_LOW, 0x110230, 0x110240, DEFAULT_FREQ}, + { BCM53134_PHYID_HIGH, BCM53134_PHYID_LOW , 0, 0x110240, DEFAULT_FREQ}, + { 0, 0, 0, 0, 0 }, +}; +#endif + +#ifdef BCM_ROBO_SUPPORT + +static int +_spi_device_valid_check(unsigned short phyidh,unsigned short phyidl, uint8 check_flag) +{ + struct bde_spi_device_id *_ids; + int idx, match_idx; + + match_idx = -1; + idx = 0; + + if (check_flag == 0){ + /* check_flag == 0 check phyidh only*/ + for (_ids = _spi_id_table; + _ids->phyid_high && _ids->phyid_low; _ids++){ + if (_ids->phyid_high == phyidh) { + return 0; + } + } + /* No valid SPI devices found */ + return 1; + } else { + while(_spi_id_table[idx].phyid_high){ + if (phyidh == _spi_id_table[idx].phyid_high && + phyidl == _spi_id_table[idx].phyid_low) { + /* Found a match */ + match_idx = idx; + break; + } + idx++; + } + return match_idx; + } +} + +#if defined(IPROC_CMICD) || defined(KEYSTONE) +#define ROBO_ATTACH_AVAIL +#endif + +#ifdef ROBO_ATTACH_AVAIL + +#define SOC_ATTACH(_sc)\ + ai_soc_kattach(_sc) + +#if defined(IPROC_CMICD) +#ifdef BCM_STARFIGHTER3_SUPPORT +#define ROBO_ATTACH_SPI(_sih, _ss)\ + robo_attach_spi(_sih) +#define ROBO_DETACH_SPI(robo)\ + robo_detach_spi(robo) +#define ROBO_SPI_RREG(_robo, _dev, _page, _reg, _buf, _len) \ + robo_spi_rreg(_robo, _dev, _page, _reg, _buf, _len) +#define ROBO_SPI_WREG(_robo, _dev, _page, _reg, _buf, _len) \ + robo_spi_wreg(_robo, _dev, _page, _reg, _buf, _len) +#endif +#define ROBO_ATTACH(_sih, _ss)\ + robo_attach(_sih) +#define MAX_BUSTYPE 1 +#define ROBO_SWITCH_BUS(_robo, _bustype) +#define ROBO_SELECT_DEVICE(_robo, _phyidh, _phyidl) +#else /* KEYSTONE */ +#define ROBO_ATTACH(_sih, _ss)\ + robo_attach(_sih, _ss) +/* bustype 2: ROBO_MDCMDIO_BUS, 1: ROBO_SPI_BUS */ +#define MAX_BUSTYPE 2 +#define ROBO_SWITCH_BUS(_robo, _bustype)\ + robo_switch_bus(_robo, _bustype) + +#define ROBO_SELECT_DEVICE(_robo, _phyidh, _phyidl) \ + robo_select_device(_robo, _phyidh, _phyidl) +#endif + +#else + +#define SOC_ATTACH(_sc) (NULL) +#define ROBO_ATTACH(_sih, _ss) (NULL) +#define MAX_BUSTYPE (0) +#define ROBO_SWITCH_BUS(_robo, _bustype) +#define ROBO_SELECT_DEVICE(_robo, _phyidh, _phyidl) +#endif + + +#if defined(IPROC_CMICD) && defined(BCM_STARFIGHTER3_SUPPORT) +static int +probe_robo_switch_iproc_spi(void) +{ + int dev; + int max_devices, max_bustype; + uint8 buf[8]; + unsigned short phyidh = 0, phyidl = 0; + + + /* Get Robo device handle */ + if (robo == NULL) { + robo = (void *)ROBO_ATTACH_SPI(sbh, 0); + } + if (robo == NULL) { + return -ENODEV; + } + + max_bustype = MAX_BUSTYPE + 1; + + while(_spi_device_valid_check(phyidh, 0, 0)) { + max_bustype --; + if(!max_bustype) + return -ENODEV; + buf[0] = buf[1] = 0; + ROBO_SPI_RREG(robo, 0, 0x10, 0x04, buf, (uint)2); + phyidh = buf[0] | (buf[1] << 8); + /* re-try */ + if ((phyidh == 0x0) || (phyidh == 0xffff)) { + ROBO_SPI_RREG(robo, 0, 0x10, 0x04, buf, (uint)2); + phyidh = buf[0] | (buf[1] << 8); + } + } + + /* For psedo_phy access, only support one robo switch*/ + /* For Northstar, only one switch on SRAB interface */ + max_devices = (max_bustype == MAX_BUSTYPE) ? 1 : LINUX_BDE_MAX_SWITCH_DEVICES; + + for (dev = 0; dev < max_devices; dev++) { + bde_ctrl_t *ctrl; + int match_idx, i; + unsigned short phyidl_nr; /* phyidl with revision stripped */ + uint16 model_id; + uint8 rev_id; + uint32 addr, len; + uint32 mlen; + + if (_switch_ndevices >= LINUX_BDE_MAX_SWITCH_DEVICES) { + break; + } + buf[0] = buf[1] = 0; + ROBO_SPI_RREG(robo, dev, 0x10, 0x04, buf, (uint)2); + phyidh = buf[0] | (buf[1] << 8); + + buf[0] = buf[1] = 0; + ROBO_SPI_RREG(robo, dev, 0x10, 0x06, buf, (uint)2); + phyidl = buf[0] | (buf[1] << 8); + + /* Strip revision */ + phyidl_nr = phyidl & 0xfff0; + + match_idx = _spi_device_valid_check(phyidh, phyidl_nr, 1); + if (match_idx == -1) { + if (debug >= 1) gprintk("found %d robo device(s).\n", robo_switch); + break; + } + + model_id = phyidl_nr; + + if(_spi_id_table[match_idx].rev_info){ + addr = _spi_id_table[match_idx].rev_info & 0xffff; + len = (_spi_id_table[match_idx].rev_info >> 16) & 0xf; + ROBO_SPI_RREG(robo, dev, (addr >> 8), (addr & 0xff), buf, (uint)len); + mlen = (_spi_id_table[match_idx].rev_info >> 20) & 0xf; + rev_id = 0; + for (i = 0; i < mlen; i++) + rev_id |= buf[i] << (i << 3); + } else { + rev_id = phyidl & 0xf; + } + + gprintk("found robo device with %d:%04x:%04x:%04x:%02x\n", + dev, phyidh, phyidl, model_id, rev_id); + + ROBO_SELECT_DEVICE(robo, phyidh, phyidl); + + /* Match supported chips */ + ctrl = _devices + _ndevices++; + _switch_ndevices++; + + if (NULL == (ctrl->spi_device = (struct spi_dev *) + KMALLOC(sizeof(struct spi_dev), GFP_KERNEL))) { + gprintk("no memory available"); + return -ENOMEM; + } + ctrl->dev_type = (BDE_SPI_DEV_TYPE | BDE_SWITCH_DEV_TYPE); + ctrl->spi_device->cid = dev; + ctrl->spi_device->part = model_id; + ctrl->spi_device->rev = rev_id; + ctrl->spi_device->robo = robo; + ctrl->spi_device->phyid_high = phyidh; + ctrl->spi_device->phyid_low = phyidl; + ctrl->bde_dev.device = model_id; + ctrl->bde_dev.rev = rev_id; + ctrl->bde_dev.base_address = (sal_vaddr_t)NULL; + ctrl->isr = NULL; + ctrl->isr_data = NULL; + robo_switch++; + + } + + return robo_switch; + +} + +int spi_device_found = 0; + +#endif /* IPROC_CMICD || SF3 */ + + +static int +probe_robo_switch(void) +{ + int dev; + int max_devices, max_bustype; + uint8 buf[8]; + unsigned short phyidh = 0, phyidl = 0; +#if defined(KEYSTONE) + uint32 spi_freq = 0; +#endif +#if defined(IPROC_CMICD) + sal_vaddr_t addr_base; + uint32 data_reg; +#endif /* IPROC_CMICD */ + + + spin_lock_init(&bus_lock); + + if (_switch_ndevices) { + /* + * Currently skip probe robo if esw chips were found + * FIX this while combined plateform support. + */ + return robo_switch; + } + + /* Get Robo device handle */ + if (robo == NULL) { + sbh = (void *)SOC_ATTACH(NULL); + if (sbh == NULL) { + return -ENODEV; + } + } + +#if defined(IPROC_CMICD) && defined(BCM_STARFIGHTER3_SUPPORT) + robo_switch = probe_robo_switch_iproc_spi(); + + if (robo_switch > 0) { + /* Robo switch found by SPI probe */ + spi_device_found = 1; + gprintk("SPI device found, Skipping SRAB probe\n"); + return robo_switch; + } else { + gprintk("SPI device NOT found, Probe SRAB probe\n"); + ROBO_DETACH_SPI(robo); + } +#endif + + if (robo == NULL) { + robo = (void *)ROBO_ATTACH(sbh, 0); + } + if (robo == NULL) { + return -ENODEV; + } + + max_bustype = MAX_BUSTYPE + 1; + + while(_spi_device_valid_check(phyidh, 0, 0)) { + max_bustype --; + if(!max_bustype) + return -ENODEV; + ROBO_SWITCH_BUS(robo, max_bustype); + buf[0] = buf[1] = 0; + ROBO_RREG(robo, 0, 0x10, 0x04, buf, (uint)2); + phyidh = buf[0] | (buf[1] << 8); + /* re-try */ + if ((phyidh == 0x0) || (phyidh == 0xffff)) { + ROBO_RREG(robo, 0, 0x10, 0x04, buf, (uint)2); + phyidh = buf[0] | (buf[1] << 8); + } + } + + /* For psedo_phy access, only support one robo switch*/ + /* For Northstar, only one switch on SRAB interface */ + max_devices = (max_bustype == MAX_BUSTYPE) ? 1 : LINUX_BDE_MAX_SWITCH_DEVICES; + + for (dev = 0; dev < max_devices; dev++) { + bde_ctrl_t *ctrl; + int match_idx, i; + unsigned short phyidl_nr; /* phyidl with revision stripped */ + uint16 model_id; + uint8 rev_id; +#if defined(KEYSTONE) || defined(IPROC_CMICD) + uint32 addr, len; +#endif + uint32 mlen, op; + + if (_switch_ndevices >= LINUX_BDE_MAX_SWITCH_DEVICES) { + break; + } + buf[0] = buf[1] = 0; + ROBO_RREG(robo, dev, 0x10, 0x04, buf, (uint)2); + phyidh = buf[0] | (buf[1] << 8); + + buf[0] = buf[1] = 0; + ROBO_RREG(robo, dev, 0x10, 0x06, buf, (uint)2); + phyidl = buf[0] | (buf[1] << 8); + + /* Strip revision */ + phyidl_nr = phyidl & 0xfff0; + + match_idx = _spi_device_valid_check(phyidh, phyidl_nr, 1); + if (match_idx == -1) { + if (debug >= 1) gprintk("found %d robo device(s).\n", robo_switch); + break; + } + + if(_spi_id_table[match_idx].model_info){ +#if defined(KEYSTONE) || defined(IPROC_CMICD) + addr = _spi_id_table[match_idx].model_info & 0xffff; + len = (_spi_id_table[match_idx].model_info >> 16) & 0xf; +#endif + ROBO_RREG(robo, dev, (addr >> 8), (addr & 0xff), buf, (uint)len); + mlen = (_spi_id_table[match_idx].model_info >> 20) & 0xf; + model_id = 0; + for (i = 0; i < mlen; i++) + model_id |= buf[i] << (i << 3); + op = (_spi_id_table[match_idx].model_info >> 28) & 0xf; + if(op == 1) { + model_id |= phyidl_nr; +#if defined(IPROC_CMICD) + } else if (op == 2) { + /* The package id of NS+ is determined by : + * Write 0 to 0x18012120 (PAXB_0_CONFIG_IND_ADDR) + * Read 0x18012124 (PAX_B_CONFIG_IND_DATA), + * bits 31:16 will be the device id from OTP space + */ +#define PAXB_ENUM_BASE (0x18012000) +#define PAXB_CONFIG_IND_ADDR_OFFSET (0x120) +#define PAXB_CONFIG_IND_DATA_OFFSET (0x124) + + addr_base = (sal_vaddr_t)IOREMAP(PAXB_ENUM_BASE, 0x1000); + if (!addr_base) { + gprintk("ioremap of PAXB registers failed\n"); + } else { + writel(0x0, (uint32 *)(addr_base + + PAXB_CONFIG_IND_ADDR_OFFSET)); + data_reg = readl((uint32 *)(addr_base + + PAXB_CONFIG_IND_DATA_OFFSET)); + model_id = (data_reg >> 16); + iounmap((void *)addr_base); + + /* + * Some model ID can't be determined by PCIE device ID + * It needs to refer some OTP values. + */ + robo_model_id_adjust_from_otp(robo, &model_id); + } + +#undef PAXB_ENUM_BASE +#undef PAXB_CONFIG_IND_ADDR_OFFSET +#undef PAXB_CONFIG_IND_DATA_OFFSET +#endif /* IPROC_CMICD */ + } + } else { + model_id = phyidl_nr; + } + if(_spi_id_table[match_idx].rev_info){ +#if defined(KEYSTONE) || defined(IPROC_CMICD) + addr = _spi_id_table[match_idx].rev_info & 0xffff; + len = (_spi_id_table[match_idx].rev_info >> 16) & 0xf; +#endif + ROBO_RREG(robo, dev, (addr >> 8), (addr & 0xff), buf, (uint)len); + mlen = (_spi_id_table[match_idx].rev_info >> 20) & 0xf; + rev_id = 0; + for (i = 0; i < mlen; i++) + rev_id |= buf[i] << (i << 3); + } else { + rev_id = phyidl & 0xf; + } + gprintk("found robo device with %d:%04x:%04x:%04x:%02x\n", + dev, phyidh, phyidl, model_id, rev_id); + + ROBO_SELECT_DEVICE(robo, phyidh, phyidl); + + /* Match supported chips */ + ctrl = _devices + _ndevices++; + _switch_ndevices++; + + if (NULL == (ctrl->spi_device = (struct spi_dev *) + KMALLOC(sizeof(struct spi_dev), GFP_KERNEL))) { + gprintk("no memory available"); + return -ENOMEM; + } + ctrl->dev_type = (BDE_SPI_DEV_TYPE | BDE_SWITCH_DEV_TYPE); + ctrl->spi_device->cid = dev; + ctrl->spi_device->part = model_id; + ctrl->spi_device->rev = rev_id; + ctrl->spi_device->robo = robo; + ctrl->spi_device->phyid_high = phyidh; + ctrl->spi_device->phyid_low = phyidl; + ctrl->bde_dev.device = model_id; + ctrl->bde_dev.rev = rev_id; + ctrl->bde_dev.base_address = (sal_vaddr_t)NULL; + ctrl->isr = NULL; + ctrl->isr_data = NULL; + robo_switch++; + +#if defined(KEYSTONE) + spi_freq = _spi_id_table[match_idx].spifreq; +#endif + } + +#if defined(KEYSTONE) + /* Override the SPI frequency from user configuration */ + if (spifreq != 0) { + spi_freq = spifreq; + } + if (spi_freq != 0) { + /* + * The underlying chip can support the SPI frequency + * higher than default (2MHz). + */ + if (spi_freq != SPI_FREQ_DEFAULT) { + chipc_spi_set_freq(robo, 0, spi_freq); + } + } +#endif + return robo_switch; + +} + +#endif + +#if defined(BCM_METROCORE_LOCAL_BUS) +static bde_ctrl_t* +map_local_bus(uint64_t addr, uint32_t size) +{ + bde_ctrl_t *ctrl; + + ctrl = _devices + _ndevices++; + _switch_ndevices++; + + /* + * For now: use EB type as `local bus' + * (memory mapped, no DMA, no interrupts) + * metrocore local bus supports interrupts, but we don't use them. + */ + ctrl->dev_type |= BDE_EB_DEV_TYPE | BDE_SWITCH_DEV_TYPE + | (size > 64 * 1024 ? BDE_128K_REG_SPACE : 0); + ctrl->pci_device = NULL; /* No PCI bus */ + + /* Map in the device */ + ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(addr, size); + ctrl->phys_address = addr; + + return(ctrl); +} + +#define BME_REVISION_OFFSET (0x0) + +#endif + + +#ifdef BCM_METROCORE_LOCAL_BUS + /* + * SBX platform has both PCI- and local bus-attached devices + * The local bus devices have fixed address ranges (and don't + * support or require DMA), but are otherwise the same as PCI devices + */ +#define FPGA_IRQ 37 +#define FPGA_PHYS 0x100E0000 +#define BME_PHYS 0x100C0000 +#define SE_PHYS 0x100D0000 +#define FPGA_SIZE 0x00004000 +#define BME_SIZE 0x00004000 +#define MAC0_PHYS 0x100B0000 +#define MAC1_PHYS 0x100B8000 +#define MAC_SIZE 0x800 + + +/* + * Please refer to "Supervisor Fabric Module (SFM) Specification" + * page 23 for the following registers. + */ +#define FPGA_LC_POWER_DISABLE_OFFSET 0x4 +#define FPGA_LC_POWER_DISABLE_ENABLE_ALL_MASK 0x1e + +#define FPGA_LC_POWER_RESET_OFFSET 0x5 +#define FPGA_LC_POWER_RESET_ENABLE_ALL_MASK 0x1e + +#define FPGA_SW_SFM_MASTER_MODE_OFFSET 0x14 +#define FPGA_SW_SFM_MASTER_MODE_ENABLE_MASK 0x10 + + +static int +probe_metrocore_local_bus(void) { + bde_ctrl_t *ctrl; + uint32_t dev_rev_id; + VOL uint8_t *fpga; + + /* + * Write the FPGA on the fabric card, to let metrocore + * line cards out of reset. We actually don't bother to determine whether + * the card is a line card or a fabric card because when we do + * this on the line cards, it has no effect. + */ + fpga = (uint8_t *) IOREMAP(FPGA_PHYS, FPGA_SIZE); + fpga[FPGA_SW_SFM_MASTER_MODE_OFFSET] + |= FPGA_SW_SFM_MASTER_MODE_ENABLE_MASK; + fpga[FPGA_LC_POWER_DISABLE_OFFSET] + |= FPGA_LC_POWER_DISABLE_ENABLE_ALL_MASK; + fpga[FPGA_LC_POWER_RESET_OFFSET] + |= FPGA_LC_POWER_RESET_ENABLE_ALL_MASK; + + ctrl = map_local_bus(BME_PHYS, BME_SIZE); + + dev_rev_id = + *((uint32_t *) + (((uint8_t *) ctrl->bde_dev.base_address) + BME_REVISION_OFFSET)); + ctrl->bde_dev.device = dev_rev_id >> 16; + ctrl->bde_dev.rev = (dev_rev_id & 0xFF); + + if ((ctrl->bde_dev.device != BME3200_DEVICE_ID) && + (ctrl->bde_dev.device != BCM88130_DEVICE_ID)) { + gprintk("probe_metrocore_local_bus: wrong BME type: " + "0x%x (vs 0x%x or 0x%x)\n", + ctrl->bde_dev.device, BME3200_DEVICE_ID, BCM88130_DEVICE_ID); + return -1; + } + + ctrl->iLine = FPGA_IRQ; + ctrl->isr = NULL; + ctrl->isr_data = NULL; + + /* + * + * We start from SE & include the FPGA, which is 128k + */ + ctrl = map_local_bus(SE_PHYS, 128 * 1024); + + dev_rev_id = + *((uint32_t *) + (((uint8_t *) ctrl->bde_dev.base_address) + BME_REVISION_OFFSET)); + ctrl->bde_dev.device = dev_rev_id >> 16; + ctrl->bde_dev.rev = (dev_rev_id & 0xFF); + + if ((ctrl->bde_dev.device != BME3200_DEVICE_ID) && + (ctrl->bde_dev.device != BCM88130_DEVICE_ID)) { + gprintk("probe_metrocore_local_bus: wrong SE (BME) type: " + "0x%x (vs 0x%x)\n", + ctrl->bde_dev.device, BME3200_DEVICE_ID); + return -1; + } + + ctrl->iLine = FPGA_IRQ; + ctrl->isr = NULL; + ctrl->isr_data = NULL; + + return 0; +} +#endif + +#ifdef BCM_PLX9656_LOCAL_BUS + +#if 1 +#define DEV_REG_BASE_OFFSET PL0_OFFSET /* Polaris register base */ +#define DEV_REG_DEVID 0 /* Device ID is first register */ +#endif + +/* + * The difference at map_local_bus2: + * + * The PLX9656 PCI-to-LOCAL bridge chip already has been iomapped the + * whole address space. So the devices off local bus don't need to be + * mapped again. They only need to claim their own sub-space. + */ +static bde_ctrl_t * +map_local_bus2(bde_ctrl_t *plx_ctrl, uint32_t dev_base, uint32_t size) +{ + uint32_t dev_rev_id; + uint8_t *addr; + bde_ctrl_t *ctrl; + + ctrl = _devices + _ndevices++; + _switch_ndevices++; + + /* + * For now: use EB type as `local bus' + * (memory mapped, no DMA, no interrupts) + * metrocore local bus supports interrupts, but we don't use them. + */ + ctrl->dev_type |= BDE_EB_DEV_TYPE | BDE_SWITCH_DEV_TYPE; + ctrl->dev_type |= BDE_320K_REG_SPACE; /* Polaris 18 bits address + FPGA */ + ctrl->pci_device = NULL; /* No PCI bus */ + + /* Map in the device */ + ctrl->bde_dev.base_address = plx_ctrl->bde_dev.base_address + dev_base; + ctrl->phys_address = plx_ctrl->phys_address + (resource_size_t)dev_base; + +#if 1 + addr = (uint8_t *)ctrl->bde_dev.base_address + PL0_REVISION_REG; +#endif + dev_rev_id = readl(addr); + ctrl->bde_dev.device = dev_rev_id >> 16; + ctrl->bde_dev.rev = (dev_rev_id & 0xFF); + + switch (ctrl->bde_dev.device) { + case BCM88130_DEVICE_ID: + case BME3200_DEVICE_ID: + break; + default: + gprintk("wrong BME type: 0x%x (vs 0x%x or 0x%x)\n", + ctrl->bde_dev.device, BME3200_DEVICE_ID, BCM88130_DEVICE_ID); + return 0; + } + return(ctrl); +} + +static int +probe_plx_local_bus(void) +{ + bde_ctrl_t *ctrl; + uint32_t val; + uint8_t *addr; + char addr_hi_str[16]; + + if (num_plx > 1) { + printk(KERN_ERR "There's more than one PLX 9656/9056 chip\n"); + return -1; + } + addr_hi_str[0] = 0; +#ifdef PHYS_ADDR_IS_64BIT + sprintf(addr_hi_str, "%08x", (uint32_t)(plx_ctrl.phys_address >> 32)); +#endif + printk(KERN_ERR "Found PLX %04x:%04x vir: 0x%08x phy: 0x%s%08x\n", + plx_ctrl.bde_dev.device, plx_ctrl.bde_dev.rev, + plx_ctrl.bde_dev.base_address, addr_hi_str, + (uint32_t)(plx_ctrl.phys_address)); + + addr = (uint8_t *)plx_ctrl.bde_dev.base_address + CPLD_OFFSET + CPLD_REVISION_REG; + val = readl(addr); + printk(KERN_ERR "plx: CPLD revision %d\n", val & CPLD_REVISION_MASK); +#if 000 + addr = (uint8_t *)plx_ctrl.bde_dev.base_address + CPLD_OFFSET + CPLD_RESET_REG; + writel(CPLD_RESET_NONE, addr); +#endif +#if 1 + ctrl = map_local_bus2(&plx_ctrl, PL0_OFFSET, PL0_SIZE); +#endif + if (ctrl == 0) + return -1; + + /* Uses PLX IRQ for Polaris LC */ + ctrl->iLine = 48; + ctrl->isr = NULL; + ctrl->isr_data = NULL; + + return 0; +} + +#endif /* BCM_PLX9656_LOCAL_BUS */ + +#if defined(BCM_EA_SUPPORT) +#if defined(BCM_TK371X_SUPPORT) +static void +probe_tk371x_dev(void) +{ + bde_ctrl_t *ctrl; + int ea_uid=0; + + /* eadevices is from the argument of insmod */ + for (ea_uid = 0; ea_uid < eadevices; ea_uid++) { + ctrl = _devices + _ndevices++; + _switch_ndevices++; + ctrl->dev_type = (BDE_MII_DEV_TYPE | BDE_SWITCH_DEV_TYPE); + ctrl->bde_dev.device = TK371X_DEVICE_ID; + ctrl->bde_dev.rev = 0x0; + ctrl->bde_dev.base_address = (sal_vaddr_t)NULL; + ctrl->iLine = 0; + } +} +#endif /* BCM_TK371X_SUPPORT*/ +#endif /* BCM_EA_SUPPORT */ + + +#if defined(BCM_ROBO_SUPPORT) +#if defined(IPROC_CMICD) +struct chip_device_info { + uint32 cc_base; /* Chip-common register base */ + uint32 cc_size; /* Chip-common register limit */ + uint32 cid_reg_off; /* Chip id register offset */ +}; + +static struct chip_device_info _chip_table = { +#if defined(IPROC_CMICD) + 0x18000000, 0x00000300, 0x00000000 +#else + 0,0,0 +#endif +}; + +struct gmac_device_info { + uint32 cid; /* chip id */ + uint32 rid; /* revision id */ + uint32 pid; /* package id */ + + uint32 gmac_dev_id; /* gmac core device id */ + uint32 gmac_base_addr; /* gmac core base address */ + int gmac_irq; /* gmac irq number */ +}; + +static struct gmac_device_info _gmac_table[] = { +#if defined(IPROC_CMICD) + {BCM53010_CHIP_ID, 0, 0, BCM53010_GMAC_ID, 0x18026000, 181}, /* BCM53012 */ + {BCM53010_CHIP_ID, 0, 2, BCM53010_GMAC_ID, 0x18026000, 181}, /* BCM53011 */ + {BCM53010_CHIP_ID, 0, 1, BCM53010_GMAC_ID, 0x18026000, 181}, /* BCM53010 */ + {BCM53018_CHIP_ID, 0, 0, BCM53010_GMAC_ID, 0x18026000, 181}, /* BCM53018 */ + {BCM53018_CHIP_ID, 0, 2, BCM53010_GMAC_ID, 0x18026000, 181}, /* BCM53017 */ + {BCM53018_CHIP_ID, 0, 1, BCM53010_GMAC_ID, 0x18026000, 181}, /* BCM53019 */ + {BCM53020_CHIP_ID, 0, 0, BCM53010_GMAC_ID, 0x18024000, 181}, /* BCM53022 */ + {BCM53020_CHIP_ID, 4, 0, BCM53010_GMAC_ID, 0x18023000, 180}, /* BCM53022 */ +#endif + {0,0,0,0,0,0} +}; + +static sal_vaddr_t _cca_base = 0; + +static int +_gmac_dev_create(void) +{ + bde_ctrl_t *ctrl; + uint32 gmac_base = 0; + uint32 offset = 0; + uint32 cca_cid; + uint32 cid, rid, pid; + int i = 0, found; + + if (_chip_table.cc_base == 0) { + gprintk("Create GMAC device failed. Unable to identify CPU.\n"); + return -1; + } + + /* 1. Determine which CPU/GMAC configuration is now */ + _cca_base = (sal_vaddr_t)IOREMAP(_chip_table.cc_base, _chip_table.cc_size); + cca_cid = readl((uint32 *)(_cca_base + _chip_table.cid_reg_off)); + + cid = cca_cid & CID_ID_MASK; + rid = (cca_cid & CID_REV_MASK) >> CID_REV_SHIFT; + pid = (cca_cid & CID_PKG_MASK) >> CID_PKG_SHIFT; + + found = 0; + for (i = 0; ; i++) { + if (_gmac_table[i].cid == 0) { + /* End of table */ + break; + } + if ((_gmac_table[i].cid == cid) && + (_gmac_table[i].rid == rid) && + (_gmac_table[i].pid == pid)) { + /* found */ + found = 1; + break; + } + } + if (!found) { + gprintk("Create GMAC device failed. Unable to identify GMAC device.\n"); + } + + /* 2. Create GMAC device */ + /* fill-in necessary information depends on the CPU/GMAC configuration */ + if ((cid == BCM53010_CHIP_ID) || (cid == BCM53018_CHIP_ID) || + (cid == BCM53020_CHIP_ID)) { + ctrl = _devices + _ndevices++; + _ether_ndevices++; + + ctrl->dev_type |= BDE_ETHER_DEV_TYPE; + ctrl->dev_type |= BDE_PCI_DEV_TYPE; + + ctrl->iLine = _gmac_table[i].gmac_irq; + + ctrl->be_pio = 0; + + ctrl->bde_dev.rev = _gmac_table[i].rid; + ctrl->bde_dev.device = _gmac_table[i].gmac_dev_id; + + gmac_base = 0x18000000; + offset = _gmac_table[i].gmac_base_addr - gmac_base; + ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(gmac_base, 0x300000); + ctrl->alt_base_addr = ctrl->bde_dev.base_address + offset; + ctrl->phys_address = gmac_base; + + ctrl->isr = NULL; + ctrl->isr_data = NULL; + } + + return 0; +} +#endif +#endif + +/* + * Generic module functions + */ + +/* + * Function: _init + * + * Purpose: + * Module initialization. + * Attaches to kernel BDE. + * Parameters: + * None + * Returns: + * 0 on success, < 0 on error. + */ +static int +_init(void) +{ + +#ifdef IPROC_CMICD + if (iproc_has_cmicd()) { + iproc_cmicd_get_memregion(&iproc_cmicd_resources[IPROC_CMICD_RES_MEM]); + iproc_platform_driver_register(&iproc_cmicd_driver); +#ifdef CONFIG_OF + if (!of_find_compatible_node(NULL, NULL, IPROC_CMICD_COMPATIBLE)) +#endif + { + /* Register platform device if no device node in dtb */ + iproc_platform_device_register(&iproc_cmicd_pdev); + } + } +#endif /* IPROC_CMICD */ + +#ifdef BCM_ICS + _ics_bde_create(); +#else /* PCI */ + /* Register our goodies */ + _device_driver.name = LINUX_KERNEL_BDE_NAME; + +#if defined(BCM_ROBO_SUPPORT) +#if defined(IPROC_CMICD) + if (_gmac_dev_create()) { + return -ENODEV; + } +#endif +#endif /* defined (BCM_ROBO_SUPPORT) */ + + /* Configure MSI interrupt support */ + use_msi = usemsi; + +#ifdef CONFIG_PCI_MSI + if (use_msi == PCI_USE_INT_NONE) { + /* Compilation flag determines default value */ +#ifdef BDE_LINUX_USE_MSIX_INTERRUPT +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) + use_msi = PCI_USE_INT_MSIX; +#else + use_msi = PCI_USE_INT_MSI; +#endif +#elif defined(BDE_LINUX_USE_MSI_INTERRUPT) + use_msi = PCI_USE_INT_MSI; +#else + use_msi = PCI_USE_INT_INTX; +#endif + } +#else + if (use_msi > PCI_USE_INT_INTX) { + /* Warn if invalid configuration */ + gprintk("MSI interrupts not supported by kernel\n"); + } + use_msi = PCI_USE_INT_INTX; +#endif /* CONFIG_PCI_MSI */ + + if (unlikely(debug >= 1)) + gprintk("%s(%d):use_mse = %d\n", __func__, __LINE__, use_msi); + if (spi_devid) { + _spi_device_setup(); + } else { + if (pci_register_driver(&_device_driver) < 0) { + return -ENODEV; + } + } + + /* Note: PCI-PCI bridge uses results from pci_register_driver */ + p2p_bridge(); + +#ifdef BCM_METROCORE_LOCAL_BUS + if (probe_metrocore_local_bus()) { + return -1; + } +#endif +#ifdef BCM_PLX9656_LOCAL_BUS + if (num_plx > 0) { + probe_plx_local_bus(); + } +#endif +#endif /* BCM_ICS */ + +#ifdef BCM_ROBO_SUPPORT + probe_robo_switch(); +#endif + +#if defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT) + sand_device_create(); +#endif + +#if defined(BCM_TK371X_SUPPORT) + probe_tk371x_dev(); +#endif + /* + * Probe for EB Bus devices. + */ + if (eb_bus) { + char *tok; + uint irq = -1, eb_rd16bit=0, eb_wr16bit =0; + unsigned int eb_ba = 0x0; + + gprintk("EB bus info: %s\n", eb_bus); + tok = strtok(eb_bus,","); + while (tok) { + _parse_eb_args(tok, "BA=%x IRQ=%d RD16=%d WR16=%d", + &eb_ba, &irq, &eb_rd16bit, &eb_wr16bit); + _eb_device_create(eb_ba, irq, eb_rd16bit, eb_wr16bit); + tok = strtok(NULL,","); + } + } + + _dma_init(robo_switch); + + /* + * In order to be backward compatible with the user mode BDE + * (specifically the interrupt IOCTLs) and the CM, switch devices + * *must* come first. If this is not the case (due to the probing + * order), we let the non-switch device(s) drop down to the end of + * the device array. + */ + if (_switch_ndevices > 0) { + bde_ctrl_t tmp_dev; + int i, s = 0; + + while (s < _switch_ndevices) { + if (_devices[s].dev_type & BDE_SWITCH_DEV_TYPE) { + s++; + continue; + } + tmp_dev = _devices[s]; + for (i = s; i < _ndevices - 1; i++) { + _devices[i] = _devices[i+1]; + } + _devices[i] = tmp_dev; + } + } + + /* Initialize device locks */ + if (_ndevices > 0) { + int i; + + for (i = 0; i < _ndevices; i++) { + spin_lock_init(&_devices[i].lock); + } + } + + return 0; +} + +/* + * Function: _cleanup + * + * Purpose: + * Module cleanup function. + * Parameters: + * None + * Returns: + * Always 0 + */ +static int +_cleanup(void) +{ + int i; + + _dma_cleanup(); + +#ifdef IPROC_CMICD + if (iproc_has_cmicd()) { +#ifdef CONFIG_OF + if (!of_find_compatible_node(NULL, NULL, IPROC_CMICD_COMPATIBLE)) +#endif + { + iproc_platform_device_unregister(&iproc_cmicd_pdev); + } + iproc_platform_driver_unregister(&iproc_cmicd_driver); + } +#endif + +#if defined(BCM_ROBO_SUPPORT) +#if defined(IPROC_CMICD) + if (_cca_base) { + iounmap((void *)_cca_base); + } +#endif + + if (robo) { +#if defined(KEYSTONE) || defined(IPROC_CMICD) + robo_detach(robo); +#endif /* KEYSTONE || IPROC_CMICD */ + } + if (sbh) { +#if defined(KEYSTONE) || defined(IPROC_CMICD) + ai_soc_detach(sbh); +#endif /* KEYSTONE || IPROC_CMICD */ + } +#endif + for (i = 0; i < _ndevices; i++) { + bde_ctrl_t *ctrl = _devices + i; + + /* free allocated kernel space memory */ + if (ctrl->dev_type & BDE_SPI_DEV_TYPE) { + if (ctrl->spi_device) { + kfree(ctrl->spi_device); + } + } + } +#if (defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT)) && (defined(__DUNE_WRX_BCM_CPU__) || defined(__DUNE_GTO_BCM_CPU__)) + if (cpu_address) { /* unmap CPU card MMIO */ + iounmap(cpu_address); + cpu_address = NULL; + } +#endif + +#ifdef BCM_ICS +#else + pci_unregister_driver(&_device_driver); +#endif /* BCM_ICS */ + return 0; +} + +/* + * Function: _pprint + * + * Purpose: + * Print proc filesystem information. + * Parameters: + * None + * Returns: + * Always 0 + */ +static int +_pprint(void) +{ + int i = 0; + + pprintf("Broadcom Device Enumerator (%s)\n", LINUX_KERNEL_BDE_NAME); + + _dma_pprint(); + + if (_ndevices == 0) { + pprintf("No devices found\n"); + } else { + pprintf("Devices:\n"); + } + for (i = 0; i < _ndevices; i++) { + bde_ctrl_t *ctrl = _devices + i; + + if (ctrl->dev_type & BDE_SWITCH_DEV_TYPE) { + pprintf("\t%d (swi) : ", i); + } else if (ctrl->dev_type & BDE_ETHER_DEV_TYPE) { + pprintf("\t%d (eth) : ", i); + } else if (ctrl->dev_type & BDE_CPU_DEV_TYPE) { + pprintf("\t%d (cpu) : ", i); + } else { + pprintf("\t%d (?) : ", i); + } + + if (ctrl->dev_state == BDE_DEV_STATE_REMOVED) { + pprintf("PCI device 0x%x:0x%x:%d REMOVED\n", + ctrl->pci_device->vendor, + ctrl->pci_device->device, + ctrl->bde_dev.rev); + continue; + } + if (ctrl->dev_type & BDE_PCI_DEV_TYPE) { + pprintf("PCI device 0x%x:0x%x:%d:0x%.8lx:0x%.8lx:%d%s\n", + ctrl->pci_device->vendor, + ctrl->pci_device->device, + ctrl->bde_dev.rev, + (unsigned long)pci_resource_start(ctrl->pci_device, 0), + (unsigned long)pci_resource_start(ctrl->pci_device, 2), + ctrl->pci_device->irq, + ctrl->use_msi ? " (MSI)" : ""); + } else if (ctrl->dev_type & BDE_SPI_DEV_TYPE) { + pprintf("SPI Device %d:%x:%x:0x%x:0x%x:%d\n", + ctrl->spi_device->cid, + ctrl->spi_device->part, + ctrl->spi_device->rev, + ctrl->spi_device->phyid_high, + ctrl->spi_device->phyid_low, + ctrl->bde_dev.rev); + } else if (ctrl->dev_type & BDE_ICS_DEV_TYPE) { + pprintf("ICS Device 0x%x:0x%x\n", + ctrl->bde_dev.device, + ctrl->bde_dev.rev); + } else if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + pprintf("AXI Device 0x%x:0x%x:0x%.8lx:%d\n", + ctrl->bde_dev.device, + ctrl->bde_dev.rev, + (unsigned long)ctrl->phys_address, + ctrl->iLine); + } else if (ctrl->dev_type & BDE_EB_DEV_TYPE) { + pprintf("EB Bus Device 0x%x:0x%x\n", + ctrl->bde_dev.device, + ctrl->bde_dev.rev); + } + if (debug >= 1) { + pprintf("\t\timask:imask2:fmask 0x%x:0x%x:0x%x\n", + ctrl->imask, + ctrl->imask2, + ctrl->fmask); + } + } + return 0; +} + +#if USE_LINUX_BDE_MMAP +/* + * Some kernels (mainly x86) prevent mapping of kernel RAM memory to + * user space via the /dev/mem device. The function below provides a + * backdoor to mapping the DMA pool to user space via the + * /dev/linux-kernel-bde device. + */ +static int _mmap(struct file *filp, struct vm_area_struct *vma) +{ + unsigned long phys_addr = vma->vm_pgoff << PAGE_SHIFT; + unsigned long size = vma->vm_end - vma->vm_start; + + if(!_dma_range_valid(phys_addr, size)) { + return -EINVAL; + } + +#ifdef REMAP_DMA_NONCACHED + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); +#endif + + if (remap_pfn_range(vma, + vma->vm_start, + vma->vm_pgoff, + size, + vma->vm_page_prot)) { + gprintk("Failed to mmap phys range 0x%lx-0x%lx to 0x%lx-0x%lx\n", + phys_addr, phys_addr + size, vma->vm_start,vma->vm_end); + return -EAGAIN; + } + + return 0; +} +#endif /* USE_LINUX_BDE_MMAP */ + +/* Workaround for broken Busybox/PPC insmod */ +static char _modname[] = LINUX_KERNEL_BDE_NAME; + +static gmodule_t _gmodule = { + name: LINUX_KERNEL_BDE_NAME, + major: LINUX_KERNEL_BDE_MAJOR, + init: _init, + cleanup: _cleanup, + pprint: _pprint, +#if USE_LINUX_BDE_MMAP + mmap: _mmap, +#endif +}; + +gmodule_t * +gmodule_get(void) +{ + _gmodule.name = _modname; + return &_gmodule; +} + + +/* + * BDE Interface + */ + +static const char * +_name(void) +{ + return LINUX_KERNEL_BDE_NAME; +} + +static int +_num_devices(int type) +{ + switch (type) { + case BDE_ALL_DEVICES: + return _ndevices; + case BDE_SWITCH_DEVICES: + return _switch_ndevices; + case BDE_ETHER_DEVICES: + return _ether_ndevices; + case BDE_CPU_DEVICES: + return _cpu_ndevices; + } + + return 0; +} + +static const ibde_dev_t * +_get_dev(int d) +{ + if (!VALID_DEVICE(d)) { + gprintk("_get_dev: Invalid device index %d\n", d); + return NULL; + } + + return &_devices[d].bde_dev; +} + +static uint32 +_get_dev_type(int d) +{ + if (!VALID_DEVICE(d)) { + gprintk("_get_dev: Invalid device index %d\n", d); + return 0; + } + + return _devices[d].dev_type; +} + +static uint32 +_pci_conf_read(int d, uint32 addr) +{ +#ifdef BCM_ICS + return 0xFFFFFFFF; +#else + uint32 rc = 0; + + if (!VALID_DEVICE(d)) { + gprintk("_pci_conf_read: Invalid device index %d\n", d); + return 0xFFFFFFFF; + } + + if (!(_devices[d].dev_type & BDE_PCI_DEV_TYPE)) { + gprintk("_pci_conf_read: Not PCI device %d, type %x\n", + d, _devices[d].dev_type); + return 0xFFFFFFFF; + } + + pci_read_config_dword(_devices[d].pci_device, addr, &rc); + return rc; +#endif /* BCM_ICS */ +} + +static int +_pci_conf_write(int d, uint32 addr, uint32 data) +{ +#ifdef BCM_ICS + return -1; +#else + if (!VALID_DEVICE(d)) { + gprintk("_pci_conf_write: Invalid device index %d\n", d); + return -1; + } + + if (!(_devices[d].dev_type & BDE_PCI_DEV_TYPE)) { + gprintk("_pci_conf_write: Not PCI device %d, type %x\n", + d, _devices[d].dev_type); + return -1; + } + + pci_write_config_dword(_devices[d].pci_device, addr, data); + return 0; +#endif /* BCM_ICS */ +} + +/* Initialized when the bde is created */ +static linux_bde_bus_t _bus; + +static void +_pci_bus_features(int unit, int *be_pio, int *be_packet, int *be_other) +{ + if ((_devices[unit].bde_dev.device & 0xFF00) != 0x5600 && + (_devices[unit].bde_dev.device & 0xF000) != 0xc000 && + (_devices[unit].bde_dev.device & 0xF000) != 0xb000 && + (_devices[unit].bde_dev.device & 0xF000) != 0x8000 && + (_devices[unit].bde_dev.device & 0xFFF0) != 0x0230 && + (_devices[unit].bde_dev.device & 0xFFF0) != 0xa440) { + if (be_pio) *be_pio = 0; + if (be_packet) *be_packet = 0; + if (be_other) *be_other = 0; + } else { + if (be_pio) *be_pio = _bus.be_pio; + if (be_packet) *be_packet = _bus.be_packet; + if (be_other) *be_other = _bus.be_other; + } +#if defined(BCM_METROCORE_LOCAL_BUS) + if (_devices[unit].dev_type & BDE_EB_DEV_TYPE && be_pio) { + *be_pio = 1; + } +#endif + +} + +static uint32_t +_read(int d, uint32_t addr) +{ + unsigned long flags; + volatile uint16 msb, lsb; + uint32 sl_addr, data; + + if (!VALID_DEVICE(d)) { + return -1; + } + + if (!(BDE_DEV_MEM_MAPPED(_devices[d].dev_type))) { + return -1; + } + + if (_devices[d].dev_type & BDE_DEV_BUS_RD_16BIT) { + /* + * Adjust the address presented to Eb slave. Move A15:A0 to A16:A1. + */ + sl_addr = (addr & 0xffff0000) | ((addr & 0xffff) << 1); + /* Disable interrupts */ + spin_lock_irqsave(&bus_lock, flags); + + lsb = *((uint16 *)(_devices[d].bde_dev.base_address + sl_addr)); + msb = *((uint16 *)(_devices[d].bde_dev.base_address + sl_addr)); + spin_unlock_irqrestore(&bus_lock, flags); + + return (msb << 16) | lsb; + } else { + data = ((VOL uint32_t *)_devices[d].bde_dev.base_address)[addr / 4]; +#if defined(CMIC_SOFT_BYTE_SWAP) + data = CMIC_SWAP32(data); +#endif + return data; + } +} + +static int +_write(int d, uint32_t addr, uint32_t data) +{ + unsigned long flags; + uint32 sl_addr; + + if (!VALID_DEVICE(d)) { + return -1; + } + + if (!(BDE_DEV_MEM_MAPPED(_devices[d].dev_type))) { + return -1; + } + + if (_devices[d].dev_type & BDE_DEV_BUS_WR_16BIT) { + /* + * Adjust the address presented to Eb slave. Move A15:A0 to A16:A1. + */ + sl_addr = (addr & 0xffff0000) | ((addr & 0xffff) << 1); + + /* Disable interrupts */ + spin_lock_irqsave(&bus_lock, flags); + + *((VOL uint16 *)(_devices[d].bde_dev.base_address + sl_addr)) = + data & 0xffff; + *((VOL uint16 *)(_devices[d].bde_dev.base_address + sl_addr)) = + (data >> 16) & 0xffff; + spin_unlock_irqrestore(&bus_lock, flags); + } else { +#if defined(CMIC_SOFT_BYTE_SWAP) + data = CMIC_SWAP32(data); +#endif + ((VOL uint32_t *)_devices[d].bde_dev.base_address)[addr / 4] = data; +#ifdef KEYSTONE + /* Enforce PCIe transaction ordering. Commit the write transaction */ + __asm__ __volatile__("sync"); +#endif + } + return 0; + +} + +static _ISR_RET +_isr(_ISR_PARAMS(irq, dev_id, iregs)) +{ + bde_ctrl_t *ctrl = (bde_ctrl_t *) dev_id; + + if (ctrl && ctrl->isr) { + ctrl->isr(ctrl->isr_data); + } + if (ctrl && ctrl->isr2) { + ctrl->isr2(ctrl->isr2_data); + } + return IRQ_HANDLED; +} + +static int +_interrupt_connect(int d, + void (*isr)(void *), + void *isr_data) +{ + bde_ctrl_t *ctrl; + unsigned long irq_flags; + int isr2_dev; + int isr_active; + int ret = 0; + + isr2_dev = d & LKBDE_ISR2_DEV; + d &= ~LKBDE_ISR2_DEV; + + if (!VALID_DEVICE(d)) { + gprintk("_interrupt_connect: Invalid device index %d\n", d); + return -1; + } + if (debug >= 1) { + gprintk("_interrupt_connect d %d\n", d); + } + if (!(BDE_DEV_MEM_MAPPED(_devices[d].dev_type))) { + gprintk("_interrupt_connect: Not PCI device %d, type %x\n", + d, _devices[d].dev_type); + return -1; + } + + ctrl = _devices + d; + + isr_active = (ctrl->isr || ctrl->isr2) ? 1 : 0; + + if (unlikely(debug > 1)) + gprintk("%s:isr_active = %d\n", __func__, isr_active); + + if (isr2_dev) { + if (debug >= 1) { + gprintk("connect secondary isr\n"); + } + ctrl->isr2_data = isr_data; + ctrl->isr2 = isr; + if (isr_active) { + /* Main handler (_isr) already installed */ + return 0; + } + } else { + if (debug >= 1) { + gprintk("connect primary isr\n"); + } + ctrl->isr = isr; + ctrl->isr_data = isr_data; + if (isr_active) { + /* Main handler (_isr) already installed */ + return 0; + } + } + + if (ctrl->iLine != -1) { + irq_flags = IRQF_SHARED; +#ifdef CONFIG_PCI_MSI + if (ctrl->use_msi >= PCI_USE_INT_MSI) { + ret = _msi_connect(ctrl); + if(ret != 0) + goto msi_exit; + } +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) + if (ctrl->use_msi == PCI_USE_INT_MSIX) { + int i; + for (i = 0; i < ctrl->msix_cnt; i++) { + ret = request_irq(ctrl->entries[i].vector, _isr, + irq_flags, LINUX_KERNEL_BDE_NAME, ctrl); + if (ret < 0) + break; + } + if (ret < 0) { + while (i >= 0) + free_irq(ctrl->entries[i--].vector, ctrl->pci_device); + + goto err_disable_msi; + } + } + else +#endif + { + ret = request_irq(ctrl->iLine, _isr, irq_flags, + LINUX_KERNEL_BDE_NAME, ctrl); + if (ret < 0) + goto err_disable_msi; + + if (unlikely(debug >= 1)) + gprintk("%s(%d):device# = %d, \ + irq_flags = %lu, irq = %d\n", + __func__, __LINE__, d, + irq_flags, ctrl->pci_device ? ctrl->pci_device->irq : ctrl->iLine); + } + } + return 0; + +err_disable_msi: +#ifdef CONFIG_PCI_MSI + _msi_disconnect(ctrl); + +msi_exit: +#endif + gprintk("could not request IRQ\n"); + ctrl->isr = NULL; + ctrl->isr_data = NULL; + ctrl->isr2 = NULL; + ctrl->isr2_data = NULL; + + return -1; +} + +static int +_interrupt_disconnect(int d) +{ + bde_ctrl_t *ctrl; + int isr2_dev; + int isr_active; + + isr2_dev = d & LKBDE_ISR2_DEV; + d &= ~LKBDE_ISR2_DEV; + + if (!VALID_DEVICE(d)) { + return -1; + } + + if (debug >= 1) { + gprintk("_interrupt_disconnect d %d\n", d); + } + if (!(BDE_DEV_MEM_MAPPED(_devices[d].dev_type))) { + gprintk("_interrupt_disconnect: Not PCI device %d, type %x\n", + d, _devices[d].dev_type); + return -1; + } + + ctrl = _devices + d; + + isr_active = (ctrl->isr || ctrl->isr2) ? 1 : 0; + + if (unlikely(debug > 1)) + gprintk("%s: isr_active = %d\n", __func__, isr_active); + + if (isr2_dev) { + if (debug >= 1) { + gprintk("disconnect secondary isr\n"); + } + ctrl->isr2 = NULL; + ctrl->isr2_data = NULL; + ctrl->fmask = 0; + if (ctrl->isr) { + /* Primary handler still active */ + SYNC_IRQ(ctrl->iLine); + return 0; + } + } else { + if (debug >= 1) { + gprintk("disconnect primary isr\n"); + } + ctrl->isr = NULL; + ctrl->isr_data = NULL; + if (ctrl->isr2) { + /* Secondary handler still active */ + SYNC_IRQ(ctrl->iLine); + return 0; + } + } + + if (isr_active) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) + if (ctrl->use_msi >= PCI_USE_INT_MSIX) { + int i; + for (i = 0; i < ctrl->msix_cnt; i++) + free_irq(ctrl->entries[i].vector, ctrl->pci_device); + } + else +#endif + { + free_irq(ctrl->iLine, ctrl); + } +#ifdef CONFIG_PCI_MSI + if (ctrl->use_msi >= PCI_USE_INT_MSI) { + _msi_disconnect(ctrl); + } +#endif + } + + return 0; +} + +static uint32_t +_iproc_ihost_read(int d, uint32_t addr) +{ + uint32_t *mapaddr; + uint32_t reg_val; + mapaddr = IOREMAP(addr, sizeof(uint32_t)); + if (mapaddr == NULL) { + return -1; + } + reg_val = readl(mapaddr); + iounmap(mapaddr); + return reg_val; +} + +static int +_iproc_ihost_write(int d, uint32_t addr, uint32_t data) +{ + uint32_t *mapaddr; + mapaddr = IOREMAP(addr, sizeof(uint32_t)); + if (mapaddr == NULL) { + return -1; + } + writel(data, mapaddr); + iounmap(mapaddr); + return 0; +} + +static uint32_t +_iproc_read(int d, uint32_t addr) +{ + if (!VALID_DEVICE(d)) { + return -1; + } + + if (!(BDE_DEV_MEM_MAPPED(_devices[d].dev_type))) { + return -1; + } + + if (_devices[d].dev_type & BDE_AXI_DEV_TYPE) { + return _iproc_ihost_read(d, addr); + } + + return shbde_iproc_pci_read(&_devices[d].shbde, + (void *)_devices[d].bde_dev.base_address1, + addr); +} + +static int +_iproc_write(int d, uint32_t addr, uint32_t data) +{ + if (!VALID_DEVICE(d)) { + return -1; + } + + if (!(BDE_DEV_MEM_MAPPED(_devices[d].dev_type))) { + return -1; + } + + if (_devices[d].dev_type & BDE_AXI_DEV_TYPE) { + return _iproc_ihost_write(d, addr, data); + } + + shbde_iproc_pci_write(&_devices[d].shbde, + (void *)_devices[d].bde_dev.base_address1, + addr, data); + + return 0; +} + +static int +_get_cmic_ver(int d , uint32_t *ver) +{ + + unsigned int cap_base; + uint32_t rval = 0; + + if (!VALID_DEVICE(d)) { + gprintk("%s: Invalid device index %d\n", __func__, d); + return -1; + } + + if (!(_devices[d].dev_type & BDE_PCI_DEV_TYPE)) { + gprintk("%s: Not PCI device %d, type %x\n", __func__, + d, _devices[d].dev_type); + return -1; + } + + /* Look for PCIe vendor-specific extended capability (VSEC) */ + cap_base = PCI_EXT_CAP_START; + while (cap_base) { + pci_read_config_dword(_devices[d].pci_device, cap_base, &rval); + if (rval == 0xffffffff) { + /* Assume PCI HW read error */ + gprintk("%s: PCI HW read error\n", __func__); + return -1; + } + + if (PCI_EXT_CAP_ID(rval) == PCI_EXT_CAP_ID_VNDR) { + break; + } + cap_base = PCI_EXT_CAP_NEXT(rval); + } + if (cap_base) { + /* + * VSEC layout: + * + * 0x00: PCI Express Extended Capability Header + * 0x04: Vendor-Specific Header + * 0x08: Vendor-Specific Register 1 + * 0x0c: Vendor-Specific Register 2 + * ... + * 0x24: Vendor-Specific Register 8 + */ + pci_read_config_dword(_devices[d].pci_device, cap_base + 8, &rval); + if (unlikely(debug > 1)) + gprintk("%s:Found VSEC = %u\n", __func__, rval); + + /* Determine if CMICX */ + rval = ((rval >> 12) & 0xf); + *ver = rval; + + return 0; + } else { + gprintk("%s:VSEC not found\n", __func__); + } + + return -1; +} + +#ifdef BCM_ROBO_SUPPORT +#define SOC_ROBO_PAGE_BP 8 /* for Robo Chip only */ + +#if defined(IPROC_CMICD) +extern int ccb_mii_read(int dev_type, int phy_addr, int reg_off, uint16 *data); +extern int ccb_mii_write(int dev_type, int phy_addr, int reg_off, uint16 data); + +/* device type */ +#define MII_DEV_LOCAL 0 +#define MII_DEV_EXT 1 +#endif + +static int +_spi_read(int d, uint32 addr, uint8 *buf, int len) +{ +#if defined(KEYSTONE) || defined(IPROC_CMICD) + bde_ctrl_t *ctrl; + uint8 page, offset; +#endif +#if defined(IPROC_CMICD) + int rv = 0; + uint16 value = 0; +#endif + + if (!VALID_DEVICE(d)) { + return -1; + } + + if (!(_devices[d].dev_type & BDE_SPI_DEV_TYPE)) { + gprintk("_spi_read: Not SPI device %d, type %x\n", + d, _devices[d].dev_type); + return -1; + } + +#if defined(KEYSTONE) || defined(IPROC_CMICD) + ctrl = _devices + d; +#endif + +#if defined(IPROC_CMICD) + if (addr & SOC_EXTERNAL_PHY_BUS_CPUMDIO) { + rv = ccb_mii_read(MII_DEV_EXT, (addr >> 8) & 0xff, addr & 0xff, &value); + memcpy(buf, &value, 2); + return rv; + } +#endif + +#if defined(KEYSTONE) || defined(IPROC_CMICD) + page = (addr >> SOC_ROBO_PAGE_BP) & 0xFF; + offset = addr & 0xFF; +#endif + +#if defined(IPROC_CMICD) && defined(BCM_STARFIGHTER3_SUPPORT) + if (spi_device_found) { + ROBO_SPI_RREG(ctrl->spi_device->robo, ctrl->spi_device->cid, + page, offset, buf, (uint)len); + } else +#endif + { + ROBO_RREG(ctrl->spi_device->robo, ctrl->spi_device->cid, + page, offset, buf, (uint)len); + } + + return 0; +} + +static int +_spi_write(int d, uint32 addr, uint8 *buf, int len) +{ +#if defined(KEYSTONE) || defined(IPROC_CMICD) + bde_ctrl_t *ctrl; + uint8 page, offset; +#endif +#if defined(IPROC_CMICD) + int rv = 0; + uint16 value = 0; +#endif + if (!VALID_DEVICE(d)) { + return -1; + } + + if (!(_devices[d].dev_type & BDE_SPI_DEV_TYPE)) { + gprintk("_spi_write: Not SPI device %d, type %x\n", + d, _devices[d].dev_type); + return -1; + } + +#if defined(KEYSTONE) || defined(IPROC_CMICD) + ctrl = _devices + d; +#endif + +#if defined(IPROC_CMICD) + if (addr & SOC_EXTERNAL_PHY_BUS_CPUMDIO) { + memcpy(&value, buf, 2); + rv = ccb_mii_write(MII_DEV_EXT, (addr >> 8) & 0xff, addr & 0xff, value); + return rv; + } +#endif + +#if defined(KEYSTONE) || defined(IPROC_CMICD) + page = (addr >> SOC_ROBO_PAGE_BP) & 0xFF; + offset = addr & 0xFF; +#endif + +#if defined(IPROC_CMICD) && defined(BCM_STARFIGHTER3_SUPPORT) + if (spi_device_found) { + ROBO_SPI_WREG(ctrl->spi_device->robo, ctrl->spi_device->cid, + page, offset, buf, (uint)len); + } else +#endif + { + ROBO_WREG(ctrl->spi_device->robo, ctrl->spi_device->cid, + page, offset, buf, (uint)len); + } + + return 0; +} + +#endif + +#if defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT) +int +lkbde_cpu_write(int d, uint32 addr, uint32 *buf) +{ +#if defined(__DUNE_WRX_BCM_CPU__) || defined(__DUNE_GTO_BCM_CPU__) + *((uint32_t*)((uint8_t*)cpu_address + addr)) = *buf; +#endif + + return 0; +} + +int +lkbde_cpu_read(int d, uint32 addr, uint32 *buf) +{ +#if defined(__DUNE_WRX_BCM_CPU__) || defined(__DUNE_GTO_BCM_CPU__) + *buf = *((uint32_t*)((uint8_t*)cpu_address + addr)); +#else + *buf = (uint32_t)(-1); +#endif + + return 0; +} + +int +lkbde_cpu_pci_register(int d) +{ + bde_ctrl_t* ctrl; + uint16 cmd = 0; + + if (!VALID_DEVICE(d)) { + return -1; + } + + ctrl = &_devices[d]; + + /* enable device */ + if (pci_enable_device(ctrl->pci_device)) { + gprintk("Cannot enable pci device : vendor_id = %x, device_id = %x\n", + ctrl->pci_device->vendor, ctrl->pci_device->device); + } + + /* Add PCI_COMMAND_MEMORY and PCI_COMMAND_MASTER */ + pci_read_config_word(ctrl->pci_device, PCI_COMMAND, &cmd); + if (!(cmd & PCI_COMMAND_MEMORY) || !(cmd & PCI_COMMAND_MASTER)) { + cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; + pci_write_config_word(ctrl->pci_device, PCI_COMMAND, cmd); + } + + switch (ctrl->bde_dev.device) { + case GEDI_DEVICE_ID: + /* Fix bar 0 address */ /* FIXME: write full phy address */ + pci_write_config_byte(ctrl->pci_device, 0x13, 0x60); + + /* Fix Max payload size */ + pci_write_config_byte(ctrl->pci_device, 0x88, 0x2f); + pci_write_config_byte(ctrl->pci_device, 0x89, 0x10); + break; + case BCM88750_DEVICE_ID: + case BCM88753_DEVICE_ID: + case BCM88755_DEVICE_ID: + case BCM88770_DEVICE_ID: + case BCM88773_DEVICE_ID: + case BCM88774_DEVICE_ID: + case BCM88775_DEVICE_ID: + case BCM88776_DEVICE_ID: + case BCM88777_DEVICE_ID: + case BCM88950_DEVICE_ID: + case BCM88953_DEVICE_ID: + case BCM88954_DEVICE_ID: + case BCM88955_DEVICE_ID: + case BCM88956_DEVICE_ID: + case BCM88752_DEVICE_ID: + case BCM88772_DEVICE_ID: + case BCM88952_DEVICE_ID: + case ACP_PCI_DEVICE_ID: + case BCM88650_DEVICE_ID: + + case BCM88670_DEVICE_ID: + case BCM88671_DEVICE_ID: + case BCM88671M_DEVICE_ID: + case BCM88672_DEVICE_ID: + case BCM88673_DEVICE_ID: + case BCM88674_DEVICE_ID: + case BCM88675_DEVICE_ID: + case BCM88675M_DEVICE_ID: + case BCM88676_DEVICE_ID: + case BCM88676M_DEVICE_ID: + case BCM88677_DEVICE_ID: + case BCM88678_DEVICE_ID: + case BCM88679_DEVICE_ID: + + case BCM88370_DEVICE_ID: + case BCM88371_DEVICE_ID: + case BCM88371M_DEVICE_ID: + case BCM88375_DEVICE_ID: + case BCM88376_DEVICE_ID: + case BCM88376M_DEVICE_ID: + case BCM88377_DEVICE_ID: + case BCM88378_DEVICE_ID: + case BCM88379_DEVICE_ID: + case BCM88681_DEVICE_ID: + case BCM88682_DEVICE_ID: + case BCM88683_DEVICE_ID: + case BCM88684_DEVICE_ID: + case BCM88685_DEVICE_ID: + case BCM88380_DEVICE_ID: + case BCM88381_DEVICE_ID: + case BCM88680_DEVICE_ID: + case BCM88690_DEVICE_ID: + case BCM88470_DEVICE_ID: + case BCM88470P_DEVICE_ID: + case BCM88471_DEVICE_ID: + case BCM88473_DEVICE_ID: + case BCM88474_DEVICE_ID: + case BCM88474H_DEVICE_ID: + case BCM88476_DEVICE_ID: + case BCM88477_DEVICE_ID: + case BCM88270_DEVICE_ID: + case BCM88272_DEVICE_ID: + case BCM88273_DEVICE_ID: + case BCM88278_DEVICE_ID: + case BCM8206_DEVICE_ID: + case BCM88350_DEVICE_ID: + case BCM88351_DEVICE_ID: + case BCM88450_DEVICE_ID: + case BCM88451_DEVICE_ID: + case BCM88550_DEVICE_ID: + case BCM88551_DEVICE_ID: + case BCM88552_DEVICE_ID: + case BCM88651_DEVICE_ID: + case BCM88654_DEVICE_ID: + case BCM88660_DEVICE_ID: + case BCM88360_DEVICE_ID: + case BCM88361_DEVICE_ID: + case BCM88363_DEVICE_ID: + case BCM88460_DEVICE_ID: + case BCM88461_DEVICE_ID: + case BCM88560_DEVICE_ID: + case BCM88561_DEVICE_ID: + case BCM88562_DEVICE_ID: + case BCM88661_DEVICE_ID: + case BCM88664_DEVICE_ID: + /* Fix bar 0 address */ /* FIXME: write full phy address */ + pci_write_config_byte(ctrl->pci_device, 0x12, 0x10); + pci_write_config_byte(ctrl->pci_device, 0x13, 0x60); + + /* + * For DMA transactions - set Max_Payload_Size and + * Max_Read_Request_Size to 128 bytes. + */ + pci_write_config_byte(ctrl->pci_device, 0xb5, 0x0c); + pci_write_config_byte(ctrl->pci_device, 0xb4, 0x0); + break; + default: + break; + } + + /* Redo ioremap */ + if (ctrl->bde_dev.base_address) { + iounmap((void *)ctrl->bde_dev.base_address); + } + ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(ctrl->phys_address, 0x1000000); + + if (debug >= 1) { + gprintk("%s, %s(): info:\n", __FILE__, __FUNCTION__); + gprintk("_ndevices=%d, _switch_ndevices=%d\n", + _ndevices, _switch_ndevices); + gprintk("ctrl->dev_type=0x%x, ctrl->phys_address=0x%lx\n", + ctrl->dev_type, (unsigned long)ctrl->phys_address); + gprintk("ctrl->bde_dev.device=0x%x, ctrl->bde_dev.rev=0x%x, " + "ctrl->bde_dev.base_address=0x%lx\n", + ctrl->bde_dev.device, ctrl->bde_dev.rev, + (unsigned long)ctrl->bde_dev.base_address); + } + + return 0; +} + +/* + * Export Low level access function - currently for PCP DMA Kernel module. + */ +int +lkbde_mem_write(int d, uint32 addr, uint32 *buf) +{ + bde_ctrl_t* ctrl; + void *full_addr; + + if (!VALID_DEVICE(d)) return -1; + ctrl = &_devices[d]; + + full_addr = (void *)ctrl->bde_dev.base_address + addr; + *((uint32_t*)full_addr) = *buf; + return 0; +} +LKM_EXPORT_SYM(lkbde_mem_write); + +int +lkbde_mem_read(int d, uint32 addr, uint32 *buf) +{ + bde_ctrl_t* ctrl; + void *full_addr; + + if (!VALID_DEVICE(d)) return -1; + ctrl = &_devices[d]; + + full_addr = (void *)ctrl->bde_dev.base_address + addr; + *buf = *((uint32_t*)full_addr); + return 0; +} +LKM_EXPORT_SYM(lkbde_mem_read); +#endif /* defined(BCM_PETRA_SUPPORT) */ + +static ibde_t _ibde = { + name: _name, + num_devices: _num_devices, + get_dev: _get_dev, + get_dev_type: _get_dev_type, + pci_conf_read: _pci_conf_read, + pci_conf_write: _pci_conf_write, + pci_bus_features: _pci_bus_features, + read: _read, + write: _write, + salloc: _salloc, + sfree: _sfree, + sinval: _sinval, + sflush: _sflush, + interrupt_connect: _interrupt_connect, + interrupt_disconnect: _interrupt_disconnect, + l2p: _l2p, + p2l: _p2l, +#if defined(BCM_ROBO_SUPPORT) + spi_read: _spi_read, + spi_write: _spi_write, +#else + NULL, + NULL, +#endif /* defined(BCM_ROBO_SUPPORT) */ + iproc_read: _iproc_read, + iproc_write: _iproc_write, + get_cmic_ver: _get_cmic_ver, +}; + +/* + * Function: linux_bde_create + * + * Purpose: + * Creator function for this BDE interface. + * Parameters: + * bus - pointer to the bus features structure you want this + * bde to export. Depends on the system. + * ibde - pointer to a location to recieve the bde interface pointer. + * Returns: + * 0 on success + * -1 on failure. + * Notes: + * This is the main BDE create function for this interface. + * Used by the external system initialization code. + */ +int +linux_bde_create(linux_bde_bus_t *bus, ibde_t **ibde) +{ + + memset(&_bus, 0, sizeof(_bus)); + + if (bus) { + _bus = *bus; + } +#ifdef NONCOHERENT_DMA_MEMORY +#ifdef REMAP_DMA_NONCACHED + /* + * If we have a non-cached DMA memory pool + * there is no need to flush and invalidate. + */ + if (_dma_pool_allocated()) { + _ibde.sinval = NULL; + _ibde.sflush = NULL; + } +#endif +#else + _ibde.sinval = NULL; + _ibde.sflush = NULL; +#endif + *ibde = &_ibde; + return 0; +} + +/* + * Function: linux_bde_destroy + * + * Purpose: + * destroy this bde + * Parameters: + * BDE interface pointer + * Returns: + * 0 on success, < 0 on error. + */ +int +linux_bde_destroy(ibde_t *ibde) +{ + /* nothing */ + return 0; +} + +/* + * Backdoors provided by the kernel bde + */ + +uint32_t +lkbde_get_dev_phys(int d) +{ + if (!VALID_DEVICE(d)) { + return -1; + } + + if (!(BDE_DEV_MEM_MAPPED(_devices[d].dev_type))) { + gprintk("lkbde_get_dev_phys: Not PCI device %d, type %x\n", + d, _devices[d].dev_type); + return 0; + } + return _devices[d].phys_address; +} + +uint32_t +lkbde_get_dev_phys_hi(int d) +{ + if (!VALID_DEVICE(d)) { + return -1; + } + + if (!(BDE_DEV_MEM_MAPPED(_devices[d].dev_type))) { + gprintk("lkbde_get_dev_phys: Not PCI device %d, type %x\n", + d, _devices[d].dev_type); + return 0; + } +#ifdef PHYS_ADDR_IS_64BIT + return (uint32_t)(_devices[d].phys_address >> 32); +#else + return 0; +#endif +} + +void * +lkbde_get_dev_virt(int d) +{ + if (!VALID_DEVICE(d)) { + return NULL; + } + + if (!(BDE_DEV_MEM_MAPPED(_devices[d].dev_type))) { + gprintk("lkbde_get_dev_virt: Not PCI device %d, type %x\n", + d, _devices[d].dev_type); + return 0; + } + + if (_devices[d].alt_base_addr) { + return (void *)_devices[d].alt_base_addr; + } + + return (void *)_devices[d].bde_dev.base_address; +} + +int +lkbde_get_dev_resource(int d, int rsrc, uint32_t *flags, + uint32_t *phys_lo, uint32_t *phys_hi) +{ + if (!VALID_DEVICE(d)) { + return -1; + } + + *flags = 0; + *phys_lo = 0; + *phys_hi = 0; + + if (!(BDE_DEV_MEM_MAPPED(_devices[d].dev_type))) { + gprintk("lkbde_get_dev_phys: Not PCI device %d, type %x\n", + d, _devices[d].dev_type); + return 0; + } + + switch (rsrc) { + case 0: + *phys_lo = (uint32_t)(_devices[d].phys_address); +#ifdef PHYS_ADDR_IS_64BIT + *phys_hi = (uint32_t)(_devices[d].phys_address >> 32); +#endif + break; + case 1: + *phys_lo = (uint32_t)(_devices[d].phys_address1); +#ifdef PHYS_ADDR_IS_64BIT + *phys_hi = (uint32_t)(_devices[d].phys_address1 >> 32); +#endif + break; + default: + break; + } + + return 0; +} + +void * +lkbde_get_dma_dev(int d) +{ + if (!VALID_DEVICE(d)) { + return NULL; + } + +#ifdef LINUX_BDE_DMA_DEVICE_SUPPORT + return (void *)_devices[d].dma_dev; +#else + return (void *)_devices[d].pci_device; +#endif +} + +void * +lkbde_get_hw_dev(int d) +{ + if (!VALID_DEVICE(d)) { + return NULL; + } + + return (void *)_devices[d].pci_device; +} + +int +lkbde_dev_state_set(int d, uint32 state) +{ + bde_ctrl_t *ctrl; + + if (!VALID_DEVICE(d)) { + return -1; + } + ctrl = _devices + d; + ctrl->dev_state = state; + return 0; +} + +int +lkbde_dev_state_get(int d, uint32 *state) +{ + bde_ctrl_t *ctrl; + if (!VALID_DEVICE(d)) { + gprintk("_get_dev: Invalid device index %d\n", d); + return -1; + } + ctrl = _devices + d; + + *state = ctrl->dev_state; + return 0; +} + +int +lkbde_dev_instid_set(int d, uint32 instid) +{ + bde_ctrl_t *ctrl; + + if (!VALID_DEVICE(d)) { + return -1; + } + ctrl = _devices + d; + ctrl->inst_id = instid; + + return 0; +} + +int +lkbde_dev_instid_get(int d, uint32 *instid) +{ + bde_ctrl_t *ctrl; + + if (!VALID_DEVICE(d)) { + return -1; + } + ctrl = _devices + d; + *instid = ctrl->inst_id; + + return 0; +} +/* + * When a secondary interrupt handler is installed this function + * is used for synchronizing hardware access to the IRQ mask + * register. The secondary driver will supply a non-zero fmask + * (filter mask) to indicate which interrupt bits it controls. + * The fmask is ignored for the primary driver. + */ +int +lkbde_irq_mask_set(int d, uint32_t addr, uint32_t mask, uint32_t fmask) +{ + bde_ctrl_t *ctrl; + int isr2_dev; + unsigned long flags; + + isr2_dev = d & LKBDE_ISR2_DEV; + d &= ~LKBDE_ISR2_DEV; + + if (!VALID_DEVICE(d)) { + return -1; + } + + ctrl = _devices + d; + + /* Lock is required to synchronize access from user space */ + spin_lock_irqsave(&ctrl->lock, flags); + + if (isr2_dev) { + /* This is the secondary interrupt handler */ + ctrl->fmask = fmask; + ctrl->imask2 = mask & ctrl->fmask; + } else { + /* This is the primary interrupt handler */ + ctrl->imask = mask & ~ctrl->fmask; + } + _write(d, addr, ctrl->imask | ctrl->imask2); + + spin_unlock_irqrestore(&ctrl->lock, flags); + + return 0; +} + +/* + * When a secondary interrupt handler is installed, this function + * is used to avoid activating the user mode interrupt handler + * thread if all pending interrupts are handled in kernel space. + * + * The mask returned is the mask of all interrupts, it can be used + * to do a logical AND with fmask, the result will tell you if + * the user mode interrupt handler needs to be invoked. + * + * Note that if no secondary handler is installed, the value of + * "mask & fmask" will be zero, and hence there will be no need to read the + * current interrupt status from hardware (from kernel space). + */ +int +lkbde_irq_mask_get(int d, uint32_t *mask, uint32_t *fmask) +{ + bde_ctrl_t *ctrl; + + d &= ~LKBDE_ISR2_DEV; + + if (!VALID_DEVICE(d)) { + return -1; + } + + if (mask == NULL) { + return -1; + } + + ctrl = _devices + d; + + *fmask = ctrl->fmask; + *mask = ctrl->imask | ctrl->imask2; + + return 0; +} + + +/* + * Export functions + */ +LKM_EXPORT_SYM(linux_bde_create); +LKM_EXPORT_SYM(linux_bde_destroy); +LKM_EXPORT_SYM(lkbde_get_dev_phys); +LKM_EXPORT_SYM(lkbde_get_dev_virt); +LKM_EXPORT_SYM(lkbde_get_dev_resource); +LKM_EXPORT_SYM(lkbde_get_hw_dev); +LKM_EXPORT_SYM(lkbde_get_dma_dev); +LKM_EXPORT_SYM(lkbde_irq_mask_set); +LKM_EXPORT_SYM(lkbde_irq_mask_get); +LKM_EXPORT_SYM(lkbde_get_dev_phys_hi); +LKM_EXPORT_SYM(lkbde_dev_state_set); +LKM_EXPORT_SYM(lkbde_dev_state_get); +LKM_EXPORT_SYM(lkbde_dev_instid_set); +LKM_EXPORT_SYM(lkbde_dev_instid_get); +#if (defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT)) +LKM_EXPORT_SYM(lkbde_cpu_write); +LKM_EXPORT_SYM(lkbde_cpu_read); +LKM_EXPORT_SYM(lkbde_cpu_pci_register); +#endif diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c new file mode 100644 index 000000000000..bd7eab6032e8 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c @@ -0,0 +1,906 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: linux_dma.c,v 1.414 Broadcom SDK $ + * $Copyright: (c) 2016 Broadcom Corp. + * All Rights Reserved.$ + * + * Linux Kernel BDE DMA memory allocation + * + * + * DMA memory allocation modes + * =========================== + * + * 1. Using private pool in kernel memory + * -------------------------------------- + * In this mode the BDE module will try to assemble a physically contiguous + * of memory using the kernel page allocator. This memory block is then + * administered by the mpool allocation functions. Note that once a system + * has been running for a while, the memory fragmentation may prevent the + * allocator from assembling a contiguous memory block, however, if the + * module is loaded shortly after system startup, it is very unlikely to + * fail. + * + * This allocation method is used by default. + * + * 2. Using private pool in high memory + * ------------------------------------ + * In this mode the BDE module will assume that unused physical memory is + * present at the high_memory address, i.e. memory not managed by the Linux + * memory manager. This memory block is mapped into kernel space and + * administered by the mpool allocation functions. High memory must be + * reserved using either the mem=xxx kernel parameter (recommended), or by + * hardcoding the memory limit in the kernel image. + * + * The module parameter himem=1 enables this allocation mode. + * + * 3. Using kernel allocators (kmalloc, __get_free_pages) + * ------------------------------------------------------ + * In this mode all DMA memory is allocated from the kernel on the fly, i.e. + * no private DMA memory pool will be created. If large memory blocks are + * only allocated at system startup (or not at all), this allocation method + * is the most flexible and memory-efficient, however, it is not recommended + * for non-coherent memory platforms due to an overall system performance + * degradation arising from the use of cache flush/invalidate instructions. + * + * The module parameter dmasize=0M enables this allocation mode, however if + * DMA memory is requested from a user mode application, a private memory + * pool will be created and used irrespectively. + */ + +#include +#include +#include +#include +#include + +#ifdef BCM_PLX9656_LOCAL_BUS +#include +#endif + +/* allocation types/methods for the DMA memory pool */ +#define ALLOC_TYPE_CHUNK 0 /* use small allocations and join them */ +#define ALLOC_TYPE_API 1 /* use one allocation */ +#if _SIMPLE_MEMORY_ALLOCATION_ +#include +#if defined(IPROC_CMICD) && defined(CONFIG_CMA) && defined(CONFIG_CMA_SIZE_MBYTES) +#define DMA_MAX_ALLOC_SIZE (CONFIG_CMA_SIZE_MBYTES * 1024 * 1024) +#else +#define DMA_MAX_ALLOC_SIZE (1 << (MAX_ORDER - 1 + PAGE_SHIFT)) /* Maximum size the kernel can allocate in one allocation */ +#endif +#endif /* _SIMPLE_MEMORY_ALLOCATION_ */ + +#if _SIMPLE_MEMORY_ALLOCATION_ == 1 +#define ALLOC_METHOD_DEFAULT ALLOC_TYPE_API +#else +#define ALLOC_METHOD_DEFAULT ALLOC_TYPE_CHUNK +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) +#include +#define virt_to_bus virt_to_phys +#define bus_to_virt phys_to_virt +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) +#define VIRT_TO_PAGE(p) virt_to_page((void*)(p)) +#else +#define VIRT_TO_PAGE(p) virt_to_page((p)) +#endif + +/* Compatibility */ +#ifdef LKM_2_4 +#define MEM_MAP_RESERVE mem_map_reserve +#define MEM_MAP_UNRESERVE mem_map_unreserve +#else /* LKM_2_6 */ +#define MEM_MAP_RESERVE SetPageReserved +#define MEM_MAP_UNRESERVE ClearPageReserved +#endif /* LKM_2_x */ + +#ifndef GFP_DMA32 +#define GFP_DMA32 0 +#endif + +/* Flags for memory allocations */ +#ifdef SAL_BDE_XLP +static int mem_flags = GFP_ATOMIC | GFP_KERNEL | GFP_DMA; +#else +#if defined(CONFIG_ZONE_DMA32) +static int mem_flags = GFP_ATOMIC | GFP_DMA32; +#else +static int mem_flags = GFP_ATOMIC | GFP_DMA; +#endif +#endif + +/* Debug output */ +static int dma_debug = 0; +module_param(dma_debug, int, 0); +MODULE_PARM_DESC(dma_debug, +"DMA debug output enable (default 0)."); + +/* DMA memory pool size */ +static char *dmasize; +LKM_MOD_PARAM(dmasize, "s", charp, 0); +MODULE_PARM_DESC(dmasize, +"Specify DMA memory size (default 4MB)"); + +/* Select DMA memory pool allocation method */ +static int dmaalloc = ALLOC_METHOD_DEFAULT; +LKM_MOD_PARAM(dmaalloc, "i", int, 0); +MODULE_PARM_DESC(dmaalloc, "Select DMA memory allocation method"); + +/* Use high memory for DMA */ +static char *himem; +LKM_MOD_PARAM(himem, "s", charp, 0); +MODULE_PARM_DESC(himem, +"Use high memory for DMA (default no)"); + +/* DMA memory allocation */ + +#define ONE_KB 1024 +#define ONE_MB (1024*1024) + +/* Default DMA memory size */ +#ifdef SAL_BDE_DMA_MEM_DEFAULT +#define DMA_MEM_DEFAULT (SAL_BDE_DMA_MEM_DEFAULT * ONE_MB) +#else +#define DMA_MEM_DEFAULT (8 * ONE_MB) +#endif +#define DMA_MEM_DEFAULT_ROBO (4 * ONE_MB) + +/* We try to assemble a contiguous segment from chunks of this size */ +#define DMA_BLOCK_SIZE (512 * ONE_KB) + +typedef struct _dma_segment { + struct list_head list; + unsigned long req_size; /* Requested DMA segment size */ + unsigned long blk_size; /* DMA block size */ + unsigned long blk_order; /* DMA block size in alternate format */ + unsigned long seg_size; /* Current DMA segment size */ + unsigned long seg_begin; /* Logical address of segment */ + unsigned long seg_end; /* Logical end address of segment */ + unsigned long *blk_ptr; /* Array of logical DMA block addresses */ + int blk_cnt_max; /* Maximum number of block to allocate */ + int blk_cnt; /* Current number of blocks allocated */ +} dma_segment_t; + +static unsigned int _dma_mem_size = DMA_MEM_DEFAULT; +static mpool_handle_t _dma_pool = NULL; +static void __iomem *_dma_vbase = NULL; +/* cpu physical address for mmap */ +static phys_addr_t _cpu_pbase = 0; +/* + * DMA bus address, it is either identical to cpu physical address + * or another address(IOVA) translated by IOMMU. + */ +static phys_addr_t _dma_pbase = 0; +static int _use_himem = 0; +static int _use_dma_mapping = 0; +static LIST_HEAD(_dma_seg); + +#define DMA_DEV(n) lkbde_get_dma_dev(n) + +/* + * Function: _find_largest_segment + * + * Purpose: + * Find largest contiguous segment from a pool of DMA blocks. + * Parameters: + * dseg - DMA segment descriptor + * Returns: + * 0 on success, < 0 on error. + * Notes: + * Assembly stops if a segment of the requested segment size + * has been obtained. + * + * Lower address bits of the DMA blocks are used as follows: + * 0: Untagged + * 1: Discarded block + * 2: Part of largest contiguous segment + * 3: Part of current contiguous segment + */ +static int +_find_largest_segment(dma_segment_t *dseg) +{ + int i, j, blks, found; + unsigned long b, e, a; + + blks = dseg->blk_cnt; + /* Clear all block tags */ + for (i = 0; i < blks; i++) { + dseg->blk_ptr[i] &= ~3; + } + for (i = 0; i < blks && dseg->seg_size < dseg->req_size; i++) { + /* First block must be an untagged block */ + if ((dseg->blk_ptr[i] & 3) == 0) { + /* Initial segment size is the block size */ + b = dseg->blk_ptr[i]; + e = b + dseg->blk_size; + dseg->blk_ptr[i] |= 3; + /* Loop looking for adjacent blocks */ + do { + found = 0; + for (j = i + 1; j < blks && (e - b) < dseg->req_size; j++) { + a = dseg->blk_ptr[j]; + /* Check untagged blocks only */ + if ((a & 3) == 0) { + if (a == (b - dseg->blk_size)) { + /* Found adjacent block below current segment */ + dseg->blk_ptr[j] |= 3; + b = a; + found = 1; + } else if (a == e) { + /* Found adjacent block above current segment */ + dseg->blk_ptr[j] |= 3; + e += dseg->blk_size; + found = 1; + } + } + } + } while (found); + if ((e - b) > dseg->seg_size) { + /* The current block is largest so far */ + dseg->seg_begin = b; + dseg->seg_end = e; + dseg->seg_size = e - b; + /* Re-tag current and previous largest segment */ + for (j = 0; j < blks; j++) { + if ((dseg->blk_ptr[j] & 3) == 3) { + /* Tag current segment as the largest */ + dseg->blk_ptr[j] &= ~1; + } else if ((dseg->blk_ptr[j] & 3) == 2) { + /* Discard previous largest segment */ + dseg->blk_ptr[j] ^= 3; + } + } + } else { + /* Discard all blocks in current segment */ + for (j = 0; j < blks; j++) { + if ((dseg->blk_ptr[j] & 3) == 3) { + dseg->blk_ptr[j] &= ~2; + } + } + } + } + } + return 0; +} + +/* + * Function: _alloc_dma_blocks + * + * Purpose: + * Allocate DMA blocks and add them to the pool. + * Parameters: + * dseg - DMA segment descriptor + * blks - number of DMA blocks to allocate + * Returns: + * 0 on success, < 0 on error. + * Notes: + * DMA blocks are allocated using the page allocator. + */ +static int +_alloc_dma_blocks(dma_segment_t *dseg, int blks) +{ + int i, start; + unsigned long addr; + + if (dseg->blk_cnt + blks > dseg->blk_cnt_max) { + gprintk("No more DMA blocks\n"); + return -1; + } + start = dseg->blk_cnt; + dseg->blk_cnt += blks; + for (i = start; i < dseg->blk_cnt; i++) { + /* + * Note that we cannot use pci_alloc_consistent when we + * want to be able to map DMA memory to user space. + * + * The GFP_DMA flag is omitted as this imposes the ISA + * addressing limitations on x86 platforms. As long as + * we have less than 1GB of memory, we can do PCI DMA + * to all physical RAM locations. + */ + addr = __get_free_pages(mem_flags, dseg->blk_order); + if (addr) { + dseg->blk_ptr[i] = addr; + } else { + gprintk("DMA allocation failed\n"); + return -1; + } + } + return 0; +} + +/* + * Function: _dma_segment_alloc + * + * Purpose: + * Allocate large physically contiguous DMA segment. + * Parameters: + * size - requested DMA segment size + * blk_size - assemble segment from blocks of this size + * Returns: + * DMA segment descriptor. + * Notes: + * Since we cannot allocate large blocks of contiguous + * memory from the kernel, we simply keep allocating + * smaller chunks until we can assemble a contiguous + * block of the desired size. + * + * When system allowed maximum bytes of memory has been allocated + * without a successful assembly of a contiguous DMA + * segment, the allocation function will return the + * largest contiguous segment found so far. It is up + * to the calling function to decide whether this + * amount is sufficient to proceed. + */ +static dma_segment_t * +_dma_segment_alloc(size_t size, size_t blk_size) +{ + dma_segment_t *dseg; + int i, blk_ptr_size; + unsigned long page_addr; + struct sysinfo si; + + /* Sanity check */ + if (size == 0 || blk_size == 0) { + return NULL; + } + /* Allocate an initialize DMA segment descriptor */ + if ((dseg = kmalloc(sizeof(dma_segment_t), GFP_KERNEL)) == NULL) { + return NULL; + } + memset(dseg, 0, sizeof(dma_segment_t)); + dseg->req_size = size; + dseg->blk_size = PAGE_ALIGN(blk_size); + while ((PAGE_SIZE << dseg->blk_order) < dseg->blk_size) { + dseg->blk_order++; + } + + si_meminfo(&si); + dseg->blk_cnt_max = (si.totalram << PAGE_SHIFT) / dseg->blk_size; + blk_ptr_size = dseg->blk_cnt_max * sizeof(unsigned long); + /* Allocate an initialize DMA block pool */ + dseg->blk_ptr = KMALLOC(blk_ptr_size, GFP_KERNEL); + if (dseg->blk_ptr == NULL) { + kfree(dseg); + return NULL; + } + memset(dseg->blk_ptr, 0, blk_ptr_size); + /* Allocate minimum number of blocks */ + _alloc_dma_blocks(dseg, dseg->req_size / dseg->blk_size); + /* Allocate more blocks until we have a complete segment */ + do { + _find_largest_segment(dseg); + if (dseg->seg_size >= dseg->req_size) { + break; + } + } while (_alloc_dma_blocks(dseg, 8) == 0); + /* Reserve all pages in the DMA segment and free unused blocks */ + for (i = 0; i < dseg->blk_cnt; i++) { + if ((dseg->blk_ptr[i] & 3) == 2) { + dseg->blk_ptr[i] &= ~3; + for (page_addr = dseg->blk_ptr[i]; + page_addr < dseg->blk_ptr[i] + dseg->blk_size; + page_addr += PAGE_SIZE) { + MEM_MAP_RESERVE(VIRT_TO_PAGE(page_addr)); + } + } else if (dseg->blk_ptr[i]) { + dseg->blk_ptr[i] &= ~3; + free_pages(dseg->blk_ptr[i], dseg->blk_order); + dseg->blk_ptr[i] = 0; + } + } + return dseg; +} + +/* + * Function: _dma_segment_free + * + * Purpose: + * Release resources used by DMA segment. + * Parameters: + * dseg - DMA segment descriptor + * Returns: + * Nothing. + */ +static void +_dma_segment_free(dma_segment_t *dseg) +{ + int i; + unsigned long page_addr; + + if (dseg->blk_ptr) { + for (i = 0; i < dseg->blk_cnt; i++) { + if (dseg->blk_ptr[i]) { + for (page_addr = dseg->blk_ptr[i]; + page_addr < dseg->blk_ptr[i] + dseg->blk_size; + page_addr += PAGE_SIZE) { + MEM_MAP_UNRESERVE(VIRT_TO_PAGE(page_addr)); + } + free_pages(dseg->blk_ptr[i], dseg->blk_order); + } + } + kfree(dseg->blk_ptr); + kfree(dseg); + } +} + +/* + * Function: _pgalloc + * + * Purpose: + * Allocate DMA memory using page allocator + * Parameters: + * size - number of bytes to allocate + * Returns: + * Pointer to allocated DMA memory or NULL if failure. + * Notes: + * For any sizes less than DMA_BLOCK_SIZE, we ask the page + * allocator for the entire memory block, otherwise we try + * to assemble a contiguous segment ourselves. + */ +static void * +_pgalloc(size_t size) +{ + dma_segment_t *dseg; + size_t blk_size; + + blk_size = (size < DMA_BLOCK_SIZE) ? size : DMA_BLOCK_SIZE; + if ((dseg = _dma_segment_alloc(size, blk_size)) == NULL) { + return NULL; + } + if (dseg->seg_size < size) { + /* If we didn't get the full size then forget it */ + _dma_segment_free(dseg); + return NULL; + } + list_add(&dseg->list, &_dma_seg); + return (void *)dseg->seg_begin; +} + +/* + * Function: _pgfree + * + * Purpose: + * Free memory allocated by _pgalloc + * Parameters: + * ptr - pointer returned by _pgalloc + * Returns: + * 0 if succesfully freed, otherwise -1. + */ +static int +_pgfree(void *ptr) +{ + struct list_head *pos; + list_for_each(pos, &_dma_seg) { + dma_segment_t *dseg = list_entry(pos, dma_segment_t, list); + if (ptr == (void *)dseg->seg_begin) { + list_del(&dseg->list); + _dma_segment_free(dseg); + return 0; + } + } + return -1; +} + +/* + * Function: _pgcleanup + * + * Purpose: + * Free all memory allocated by _pgalloc + * Parameters: + * None + * Returns: + * Nothing. + */ +static void +_pgcleanup(void) +{ + switch (dmaalloc) { +#if _SIMPLE_MEMORY_ALLOCATION_ + case ALLOC_TYPE_API: + if (_dma_vbase) { + if (dma_debug >= 1) gprintk("freeing v=%p p=0x%lx size=0x%lx\n", _dma_vbase,(unsigned long) _dma_pbase, (unsigned long)_dma_mem_size); + dma_free_coherent(DMA_DEV(0), _dma_mem_size, _dma_vbase, _dma_pbase); + } + break; +#endif /* _SIMPLE_MEMORY_ALLOCATION_ */ + + case ALLOC_TYPE_CHUNK: { + struct list_head *pos, *tmp; + if (_use_dma_mapping) { + dma_unmap_single(DMA_DEV(0), (dma_addr_t)_dma_pbase, _dma_mem_size, DMA_BIDIRECTIONAL); + _use_dma_mapping = 0; + } + list_for_each_safe(pos, tmp, &_dma_seg) { + dma_segment_t *dseg = list_entry(pos, dma_segment_t, list); + list_del(&dseg->list); + _dma_segment_free(dseg); + } + break; + } + + default: + gprintk("DMA memory allocation method dmaalloc=%d is not supported\n", dmaalloc); + } +} + +/* + * Function: _alloc_mpool + * + * Purpose: + * Allocate DMA memory pool + * Parameters: + * size - size of DMA memory pool + * Returns: + * Nothing. + * Notes: + * If set up to use high memory, we simply map the memory into + * kernel space. + * It is assumed there is only one pool. + */ +static void +_alloc_mpool(size_t size) +{ + unsigned long pbase = 0; + +#if defined(__arm__) && !defined(CONFIG_HIGHMEM) + if (_use_himem) { + gprintk("DMA in high memory requires CONFIG_HIGHMEM on ARM CPUs.\n"); + return; + } +#endif + + if (_use_himem) { + /* Use high memory for DMA */ + pbase = virt_to_bus(high_memory); + if (((pbase + (size - 1)) >> 16) > DMA_BIT_MASK(16)) { + gprintk("DMA in high memory at 0x%lx size 0x%lx is beyond the 4GB limit and not supported.\n", pbase, (unsigned long)size); + return; + } + _cpu_pbase = _dma_pbase = pbase; + _dma_vbase = IOREMAP(_dma_pbase, size); + } else { + /* Get DMA memory from kernel */ + switch (dmaalloc) { +#if _SIMPLE_MEMORY_ALLOCATION_ + case ALLOC_TYPE_API: { + size_t alloc_size = size; /* size of memory allocated in current iteration */ + if (alloc_size > DMA_MAX_ALLOC_SIZE) { + alloc_size = DMA_MAX_ALLOC_SIZE; + } + /* get a memory allocation from the kernel */ + { + dma_addr_t dma_handle; + if (!(_dma_vbase = dma_alloc_coherent(DMA_DEV(0), alloc_size, &dma_handle, GFP_KERNEL)) || !dma_handle) { + gprintk("_alloc_mpool: Kernel failed to allocate the memory pool of size 0x%lx\n", (unsigned long)alloc_size); + return; + } + pbase = dma_handle; + } + + if (alloc_size != size) { + gprintk("_alloc_mpool: allocated 0x%lx bytes instead of 0x%lx bytes.\n", + (unsigned long)alloc_size, (unsigned long)size); + } + size = _dma_mem_size = alloc_size; + break; + } +#endif /* _SIMPLE_MEMORY_ALLOCATION_ */ + + case ALLOC_TYPE_CHUNK: + _dma_vbase = _pgalloc(size); + if (DMA_DEV(0)) { + /* + * Use dma_map_single to obtain dma bus address or IOVA if iommu is present. + */ + pbase = dma_map_single(DMA_DEV(0), _dma_vbase, size, DMA_BIDIRECTIONAL); + _use_dma_mapping = 1; + } else { + pbase = virt_to_bus(_dma_vbase); + } + break; + default: + _dma_vbase = NULL; + pbase = 0; + gprintk("DMA memory allocation method dmaalloc=%d is not supported\n", dmaalloc); + } + + _dma_pbase = pbase; + + if (dma_debug >= 1) { + gprintk("_alloc_mpool:%s _dma_vbase:%p pbase:%lx allocated:%lx dmaalloc:%d\n", + DMA_DEV(0)?"dma_dev":"", _dma_vbase, pbase, (unsigned long)size, dmaalloc); + } + + if (((pbase + (size - 1)) >> 16) > DMA_BIT_MASK(16)) { + gprintk("DMA memory allocated at 0x%lx size 0x%lx is beyond the 4GB limit and not supported.\n", pbase, (unsigned long)size); + _pgcleanup(); + _dma_vbase = NULL; + _dma_pbase = 0; + return; + } + + if (_dma_vbase) { + _cpu_pbase = virt_to_bus(_dma_vbase); + if (dma_debug >= 1) gprintk("_cpu_pbase at %lx\n", (unsigned long)_cpu_pbase); + } +#ifdef REMAP_DMA_NONCACHED + _dma_vbase = IOREMAP(_dma_pbase, size); +#endif + + } +} + +/* + * Function: _dma_cleanup + * + * Purpose: + * DMA cleanup function. + * Parameters: + * None + * Returns: + * Always 0 + */ +int +_dma_cleanup(void) +{ + if (_dma_vbase) { + mpool_destroy(_dma_pool); + if (_use_himem) { + iounmap(_dma_vbase); + } else { +#ifdef REMAP_DMA_NONCACHED + iounmap(_dma_vbase); +#endif + _pgcleanup(); + } + _dma_vbase = NULL; + _dma_pbase = 0; + _cpu_pbase = 0; + } + return 0; +} + +void _dma_init(int robo_switch) +{ + /* DMA Setup */ + if (dmasize) { + if ((dmasize[strlen(dmasize)-1] & ~0x20) == 'M') { + _dma_mem_size = simple_strtoul(dmasize, NULL, 0); + _dma_mem_size *= ONE_MB; + } else { + gprintk("DMA memory size must be specified as e.g. dmasize=8M\n"); + } + if (_dma_mem_size & (_dma_mem_size-1)) { + gprintk("dmasize must be a power of 2 (1M, 2M, 4M, 8M etc.)\n"); + _dma_mem_size = 0; + } + } else { + if(robo_switch){ + _dma_mem_size = DMA_MEM_DEFAULT_ROBO; + } + } + + if (himem) { + if ((himem[0] & ~0x20) == 'Y' || himem[0] == '1') { + _use_himem = 1; + } else if ((himem[0] & ~0x20) == 'N' || himem[0] == '0') { + _use_himem = 0; + } + } + + if (_dma_mem_size) { + _alloc_mpool(_dma_mem_size); + if (_dma_vbase == NULL) { + gprintk("no DMA memory available\n"); + } + else { + mpool_init(); + _dma_pool = mpool_create(_dma_vbase, _dma_mem_size); + } + } +} + +#if USE_LINUX_BDE_MMAP +/* + * Function: _dma_range_valid + * + * Purpose: + * Check if DMA address range is valid. + * Parameters: + * phys_addr - start physical address + * size - range size + * Returns: + * 0 : not valid + * 1 : valid + */ +int +_dma_range_valid(unsigned long phys_addr, unsigned long size) +{ + unsigned long pool_start = _cpu_pbase; + unsigned long pool_end = pool_start + _dma_mem_size; + + if (phys_addr < pool_start || (phys_addr + size) > pool_end) { + gprintk("range 0x%lx-0x%lx outside DMA pool 0x%lx-0x%lx\n", + phys_addr, phys_addr + size, pool_start, pool_end); + return 0; + } + return 1; +} +#endif + +/* + * Function: _dma_pool_allocated + * + * Purpose: + * Check if DMA pool has been allocated. + * Parameters: + * None + * Returns: + * 0 : not allocated + * 1 : allocated + */ +int +_dma_pool_allocated(void) +{ + return (_dma_vbase) ? 1 : 0; +} + +sal_paddr_t +_l2p(int d, void *vaddr) +{ + if (_dma_mem_size) { + /* dma memory is a contiguous block */ + if (vaddr) { + return _dma_pbase + (PTR_TO_UINTPTR(vaddr) - PTR_TO_UINTPTR(_dma_vbase)); + } + return 0; + } + return ((sal_paddr_t)virt_to_bus(vaddr)); +} + +void * +_p2l(int d, sal_paddr_t paddr) +{ + sal_vaddr_t vaddr = (sal_vaddr_t)_dma_vbase; + + if (_dma_mem_size) { + /* DMA memory is a contiguous block */ + if (paddr == 0) { + return NULL; + } + return (void *)(vaddr + (sal_vaddr_t)(paddr - _dma_pbase)); + } + return bus_to_virt(paddr); +} + +/* + * Some of the driver malloc's are too large for + * kmalloc(), so 'sal_alloc' and 'sal_free' in the + * linux kernel sal cannot be implemented with kmalloc(). + * + * Instead, they expect someone to provide an allocator + * that can handle the gimongous size of some of the + * allocations, and we provide it here, by allocating + * this memory out of the boot-time dma pool. + * + * These are the functions in question: + */ + +void* kmalloc_giant(int sz) +{ + return mpool_alloc(_dma_pool, sz); +} + +void kfree_giant(void* ptr) +{ + return mpool_free(_dma_pool, ptr); +} + +uint32_t * +_salloc(int d, int size, const char *name) +{ + void *ptr; + + if (_dma_mem_size) { + return mpool_alloc(_dma_pool, size); + } + if ((ptr = kmalloc(size, mem_flags)) == NULL) { + ptr = _pgalloc(size); + } + return ptr; +} + +void +_sfree(int d, void *ptr) +{ + if (_dma_mem_size) { + return mpool_free(_dma_pool, ptr); + } + if (_pgfree(ptr) < 0) { + kfree(ptr); + } +} + +int +_sinval(int d, void *ptr, int length) +{ +#if defined(dma_cache_wback_inv) + dma_cache_wback_inv((unsigned long)ptr, length); +#else +#if defined(IPROC_CMICD) || defined(BCM958525) + /* FIXME: need proper function to replace dma_cache_sync */ + dma_sync_single_for_cpu(NULL, (unsigned long)ptr, length, DMA_BIDIRECTIONAL); +#else + dma_cache_sync(NULL, ptr, length, DMA_BIDIRECTIONAL); +#endif +#endif + return 0; +} + +int +_sflush(int d, void *ptr, int length) +{ +#if defined(dma_cache_wback_inv) + dma_cache_wback_inv((unsigned long)ptr, length); +#else +#if defined(IPROC_CMICD) || defined(BCM958525) + /* FIXME: need proper function to replace dma_cache_sync */ + dma_sync_single_for_cpu(NULL, (unsigned long)ptr, length, DMA_BIDIRECTIONAL); +#else + dma_cache_sync(NULL, ptr, length, DMA_BIDIRECTIONAL); +#endif +#endif + + return 0; +} + +int +lkbde_get_dma_info(phys_addr_t* cpu_pbase, phys_addr_t* dma_pbase, ssize_t* size) +{ + if (_dma_vbase == NULL) { + if (_dma_mem_size == 0) { + _dma_mem_size = DMA_MEM_DEFAULT; + } + _alloc_mpool(_dma_mem_size); + } + *cpu_pbase = _cpu_pbase; + *dma_pbase = _dma_pbase; + *size = (_dma_vbase) ? _dma_mem_size : 0; + return 0; +} + +void +_dma_pprint(void) +{ + pprintf("DMA Memory (%s): %d bytes, %d used, %d free%s\n", + (_use_himem) ? "high" : "kernel", + (_dma_vbase) ? _dma_mem_size : 0, + (_dma_vbase) ? mpool_usage(_dma_pool) : 0, + (_dma_vbase) ? _dma_mem_size - mpool_usage(_dma_pool) : 0, + USE_LINUX_BDE_MMAP ? ", local mmap" : ""); +} + +/* + * Export functions + */ +LKM_EXPORT_SYM(kmalloc_giant); +LKM_EXPORT_SYM(kfree_giant); +LKM_EXPORT_SYM(lkbde_get_dma_info); diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_shbde.c b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_shbde.c new file mode 100644 index 000000000000..312062b8464c --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_shbde.c @@ -0,0 +1,121 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: $ + * $Copyright: (c) 2014 Broadcom Corp. + * All Rights Reserved.$ + * + */ + +#include +#include +#include +#include "linux_shbde.h" + +/* Hardware abstractions for shared BDE functions */ + +static unsigned short +linux_pcic16_read(void *pci_dev, unsigned int addr) +{ + u16 data = 0; + + pci_read_config_word((struct pci_dev *)pci_dev, addr, &data); + + return data; +} + +static void +linux_pcic16_write(void *pci_dev, unsigned int addr, unsigned short data) +{ + pci_write_config_word((struct pci_dev *)pci_dev, addr, (u16)data); +} + +static unsigned int +linux_pcic32_read(void *pci_dev, unsigned int addr) +{ + u32 data = 0; + + pci_read_config_dword((struct pci_dev *)pci_dev, addr, &data); + + return data; +} + +static void +linux_pcic32_write(void *pci_dev, unsigned int addr, unsigned int data) +{ + pci_write_config_dword((struct pci_dev *)pci_dev, addr, (u32)data); +} + +static unsigned int +linux_io32_read(void *addr) +{ + return *((volatile u32 *)addr); +} + +static void +linux_io32_write(void *addr, unsigned int data) +{ + *((volatile u32 *)addr) = data; +} + +static void +linux_usleep(int usec) +{ + udelay(usec); +} + + +/* To get the PCI parent device under linux, from only the device pointer */ +static void * +linux_pci_parent_device_get(void *pci_dev) +{ + return (void *)(((struct pci_dev *)pci_dev)->bus->self); +} + + +/* + * Function: + * linux_shbde_hal_init + * Purpose: + * Initialize hardware abstraction module for Linux kernel. + * Parameters: + * shbde - pointer to uninitialized hardware abstraction module + * log_func - optional log output function + * Returns: + * Always 0 + */ +int +linux_shbde_hal_init(shbde_hal_t *shbde, shbde_log_func_t log_func) +{ + memset(shbde, 0, sizeof(*shbde)); + + shbde->log_func = log_func; + + shbde->pcic16_read = linux_pcic16_read; + shbde->pcic16_write = linux_pcic16_write; + shbde->pcic32_read = linux_pcic32_read; + shbde->pcic32_write = linux_pcic32_write; + + shbde->io32_read = linux_io32_read; + shbde->io32_write = linux_io32_write; + + shbde->usleep = linux_usleep; + + shbde->pci_parent_device_get = linux_pci_parent_device_get; + + return 0; +} diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_shbde.h b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_shbde.h new file mode 100644 index 000000000000..73d497925ed4 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_shbde.h @@ -0,0 +1,34 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: $ + * $Copyright: (c) 2014 Broadcom Corp. + * All Rights Reserved.$ + * + */ + +#ifndef __LINUX_SHBDE_H__ +#define __LINUX_SHBDE_H__ + +#include +#include +#include + +extern int +linux_shbde_hal_init(shbde_hal_t *shbde, shbde_log_func_t log_func); + +#endif /* __LINUX_SHBDE_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/shared/mpool.c b/platform/broadcom/saibcm-modules/systems/bde/linux/shared/mpool.c new file mode 100644 index 000000000000..7f7332b3a7a4 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/shared/mpool.c @@ -0,0 +1,295 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: mpool.c,v 1.18 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ + +#include + +#ifdef __KERNEL__ + +/* + * Abstractions used when compiling for Linux kernel mode. + */ + +#include + +/* + * We cannot use the linux kernel SAL for MALLOC/FREE because + * the current implementation of sal_alloc() allocates memory + * out of an mpool created by this module... + */ +#define MALLOC(x) kmalloc(x, GFP_ATOMIC) +#define FREE(x) kfree(x) + +static spinlock_t _mpool_lock; +#define MPOOL_LOCK_INIT() spin_lock_init(&_mpool_lock) +#define MPOOL_LOCK() unsigned long flags; spin_lock_irqsave(&_mpool_lock, flags) +#define MPOOL_UNLOCK() spin_unlock_irqrestore(&_mpool_lock, flags) + +#else /* !__KERNEL__*/ + +/* + * Abstractions used when compiling for Linux user mode. + */ + +#include +#include + +#define MALLOC(x) malloc(x) +#define FREE(x) free(x) + +static sal_sem_t _mpool_lock; +#define MPOOL_LOCK_INIT() _mpool_lock = sal_sem_create("mpool_lock", 1, 1) +#define MPOOL_LOCK() sal_sem_take(_mpool_lock, sal_sem_FOREVER) +#define MPOOL_UNLOCK() sal_sem_give(_mpool_lock) + +#endif /* __KERNEL__ */ + +/* Allow external override for system cache line size */ +#ifndef BCM_CACHE_LINE_BYTES +#ifdef L1_CACHE_BYTES +#define BCM_CACHE_LINE_BYTES L1_CACHE_BYTES +#else +#define BCM_CACHE_LINE_BYTES 128 /* Should be fine on most platforms */ +#endif +#endif + +typedef struct mpool_mem_s { + unsigned char *address; + int size; + struct mpool_mem_s *next; +} mpool_mem_t; + +/* + * Function: mpool_init + * + * Purpose: + * Initialize mpool lock. + * Parameters: + * None + * Returns: + * Always 0 + */ +int +mpool_init(void) +{ + MPOOL_LOCK_INIT(); + return 0; +} + +#ifdef TRACK_DMA_USAGE +static int _dma_mem_used = 0; +#endif + +/* + * Function: mpool_alloc + * + * Purpose: + * Allocate memory block from mpool. + * Parameters: + * pool - mpool handle (from mpool_create) + * size - size of memory block to allocate + * Returns: + * Pointer to allocated memory block or NULL if allocation fails. + */ +void * +mpool_alloc(mpool_handle_t pool, int size) +{ + mpool_mem_t *ptr = pool, *newptr = NULL; + int mod; + + MPOOL_LOCK(); + + mod = size & (BCM_CACHE_LINE_BYTES - 1); + if (mod != 0 ) { + size += (BCM_CACHE_LINE_BYTES - mod); + } + while (ptr && ptr->next) { + if (ptr->next->address - (ptr->address + ptr->size) >= size) { + break; + } + ptr = ptr->next; + } + + if (!(ptr && ptr->next)) { + MPOOL_UNLOCK(); + return NULL; + } + newptr = MALLOC(sizeof(mpool_mem_t)); + if (!newptr) { + MPOOL_UNLOCK(); + return NULL; + } + + newptr->address = ptr->address + ptr->size; + newptr->size = size; + newptr->next = ptr->next; + ptr->next = newptr; +#ifdef TRACK_DMA_USAGE + _dma_mem_used += size; +#endif + MPOOL_UNLOCK(); + + return newptr->address; +} + + +/* + * Function: mpool_free + * + * Purpose: + * Free memory block allocated from mpool.. + * Parameters: + * pool - mpool handle (from mpool_create) + * addr - address of memory block to free + * Returns: + * Nothing + */ +void +mpool_free(mpool_handle_t pool, void *addr) +{ + unsigned char *address = (unsigned char *)addr; + mpool_mem_t *ptr = pool, *prev = NULL; + + MPOOL_LOCK(); + + while (ptr && ptr->next) { + if (ptr->next->address == address) { +#ifdef TRACK_DMA_USAGE + _dma_mem_used -= ptr->next->size; +#endif + break; + } + ptr = ptr->next; + } + + if (ptr && ptr->next) { + prev = ptr; + ptr = ptr->next; + prev->next = ptr->next; + FREE(ptr); + } + + MPOOL_UNLOCK(); +} + +/* + * Function: mpool_create + * + * Purpose: + * Create and initialize mpool control structures. + * Parameters: + * base_ptr - pointer to mpool memory block + * size - total size of mpool memory block + * Returns: + * mpool handle + * Notes + * The mpool handle returned must be used for subsequent + * memory allocations from the mpool. + */ +mpool_handle_t +mpool_create(void *base_ptr, int size) +{ + mpool_mem_t *head, *tail; + int mod = (int)(((unsigned long)base_ptr) & (BCM_CACHE_LINE_BYTES - 1)); + + MPOOL_LOCK(); + + if (mod) { + base_ptr = (char*)base_ptr + (BCM_CACHE_LINE_BYTES - mod); + size -= (BCM_CACHE_LINE_BYTES - mod); + } + size &= ~(BCM_CACHE_LINE_BYTES - 1); + + + head = (mpool_mem_t *)MALLOC(sizeof(mpool_mem_t)); + if (head == NULL) { + return NULL; + } + tail = (mpool_mem_t *)MALLOC(sizeof(mpool_mem_t)); + if (tail == NULL) { + FREE(head); + return NULL; + } + + head->size = tail->size = 0; + head->address = base_ptr; + tail->address = head->address + size; + head->next = tail; + tail->next = NULL; + + MPOOL_UNLOCK(); + + return head; +} + +/* + * Function: mpool_destroy + * + * Purpose: + * Free mpool control structures. + * Parameters: + * pool - mpool handle (from mpool_create) + * Returns: + * Always 0 + */ +int +mpool_destroy(mpool_handle_t pool) +{ + mpool_mem_t *ptr, *next; + + MPOOL_LOCK(); + + for (ptr = pool; ptr; ptr = next) { + next = ptr->next; + FREE(ptr); + } + + MPOOL_UNLOCK(); + + return 0; +} + +/* + * Function: mpool_usage + * + * Purpose: + * Report total sum of allocated mpool memory. + * Parameters: + * pool - mpool handle (from mpool_create) + * Returns: + * Number of bytes currently allocated using mpool_alloc. + */ +int +mpool_usage(mpool_handle_t pool) +{ + int usage = 0; + mpool_mem_t *ptr; + + MPOOL_LOCK(); + + for (ptr = pool; ptr; ptr = ptr->next) { + usage += ptr->size; + } + + MPOOL_UNLOCK(); + + return usage; +} diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/Makefile b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/Makefile new file mode 100644 index 000000000000..ac8b04ac9bcf --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/Makefile @@ -0,0 +1,71 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.1 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# +LOCALDIR = systems/bde/linux/user/kernel + +# Make sure we build for the kernel if this is a user-mode build +ifneq ($(platform), ) +override-target=linux-$(platform) +endif + +include $(SDK)/make/Make.config + +LIBS = $(LIBDIR)/libkern.a + +ifneq ($(kernel_version),2_4) +KERNEL_MODULE_DIR = kernel_module + +THIS_MOD_NAME := linux-user-bde +MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o +KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko + +build: kernel_libs $(MODULE) $(KMODULE) +else +MODULE = $(LIBDIR)/linux-user-bde.o + +build: kernel_libs $(MODULE) +endif + +KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../../kernel/kernel_module/Module.symvers + +$(MODULE): $(BLDDIR)/.tree $(BOBJS) $(LIBS) + $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ +ifneq ($(kernel_version),2_4) +$(KMODULE): $(MODULE) + rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) + mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) + cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile + cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers + MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko +endif + +kernel_libs: + $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared + +include $(SDK)/make/Make.depend + +# Make.depend is before clean:: so that Make.depend's clean:: runs first. + +clean:: + $(MAKE) -C $(SDK)/systems/linux/kernel/modules/shared $@ + $(RM) $(BOBJS) $(MODULE) + +.PHONY: build kernel_libs diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c new file mode 100644 index 000000000000..c237f9429ef7 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c @@ -0,0 +1,1264 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: linux-user-bde.c,v 1.80 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + * + * Linux User BDE Helper Module + */ +#include +#include +#include + +#include +#include +#include + +#include "linux-user-bde.h" + +#ifdef KEYSTONE +#include +#endif + + +MODULE_AUTHOR("Broadcom Corporation"); +MODULE_DESCRIPTION("User BDE Helper Module"); +MODULE_LICENSE("GPL"); + +/* CMIC/CMICe defines */ +#define CMIC_IRQ_STAT 0x00000144 +#define CMIC_IRQ_MASK 0x00000148 +#define CMIC_IRQ_MASK_1 0x0000006C +#define CMIC_IRQ_MASK_2 0x00000070 + +/* CMICm defines */ +#define CMIC_CMCx_IRQ_STAT0_OFFSET(x) (0x31400 + (0x1000 * x)) +#define CMIC_CMCx_IRQ_STAT1_OFFSET(x) (0x31404 + (0x1000 * x)) +#define CMIC_CMCx_IRQ_STAT2_OFFSET(x) (0x31408 + (0x1000 * x)) +#define CMIC_CMCx_IRQ_STAT3_OFFSET(x) (0x3140c + (0x1000 * x)) +#define CMIC_CMCx_IRQ_STAT4_OFFSET(x) (0x31410 + (0x1000 * x)) + +#define CMIC_CMCx_PCIE_IRQ_MASK0_OFFSET(x) (0x31414 + (0x1000 * x)) +#define CMIC_CMCx_PCIE_IRQ_MASK1_OFFSET(x) (0x31418 + (0x1000 * x)) +#define CMIC_CMCx_PCIE_IRQ_MASK2_OFFSET(x) (0x3141c + (0x1000 * x)) +#define CMIC_CMCx_PCIE_IRQ_MASK3_OFFSET(x) (0x31420 + (0x1000 * x)) +#define CMIC_CMCx_PCIE_IRQ_MASK4_OFFSET(x) (0x31424 + (0x1000 * x)) + +/* CMICd defines */ +#define CMIC_CMCx_IRQ_STAT5_OFFSET(x) (0x314b0 + (0x1000 * x)) +#define CMIC_CMCx_IRQ_STAT6_OFFSET(x) (0x314b4 + (0x1000 * x)) +#define CMIC_CMCx_PCIE_IRQ_MASK5_OFFSET(x) (0x314b8 + (0x1000 * x)) +#define CMIC_CMCx_PCIE_IRQ_MASK6_OFFSET(x) (0x314bc + (0x1000 * x)) + +#define CMIC_CMCx_UC0_IRQ_MASK0_OFFSET(x) (0x31428 + (0x1000 * x)) +#define CMIC_CMCx_UC0_IRQ_MASK1_OFFSET(x) (0x3142c + (0x1000 * x)) +#define CMIC_CMCx_UC0_IRQ_MASK2_OFFSET(x) (0x31430 + (0x1000 * x)) +#define CMIC_CMCx_UC0_IRQ_MASK3_OFFSET(x) (0x31434 + (0x1000 * x)) +#define CMIC_CMCx_UC0_IRQ_MASK4_OFFSET(x) (0x31438 + (0x1000 * x)) + +/* CMICX defines */ +#define INTC_INTR_REG_NUM (8) + +#define INTC_INTR_ENABLE_REG0 (0x180130f0) +#define INTC_INTR_STATUS_REG0 (0x18013190) +#define INTC_INTR_RAW_STATUS_REG0 (0x18013140) + +#define INTC_INTR_ENABLE_BASE (INTC_INTR_ENABLE_REG0) +#define INTC_INTR_STATUS_BASE (INTC_INTR_STATUS_REG0) +#define INTC_INTR_RAW_STATUS_BASE (INTC_INTR_RAW_STATUS_REG0) + + +#define READ_INTC_INTR(d, reg, v) \ + (v = user_bde->iproc_read(d, reg)) +#define WRITE_INTC_INTR(d, reg, v) \ + (user_bde->iproc_write(d, reg, v)) + +/* Allow override of default CMICm CMC */ +#ifndef BDE_CMICM_PCIE_CMC +#define BDE_CMICM_PCIE_CMC 0 +#endif + +/* Allow override of default CMICm CMC */ +#ifndef BDE_CMICD_PCIE_CMC +#define BDE_CMICD_PCIE_CMC 0 +#endif + +/* Defines used to distinguish CMICe from CMICm */ +#define CMICE_DEV_REV_ID (0x178 / sizeof(uint32)) + +static ibde_t *user_bde = NULL; + +typedef void (*isr_f)(void *); + +typedef struct bde_ctrl_s { + uint32 dev_type; + int irq; + int enabled; + int devid; + isr_f isr; + uint32 *ba; + int inst; /* associate to _bde_inst_resource[] */ +} bde_ctrl_t; + +#define VALID_DEVICE(_n) (_n < LINUX_BDE_MAX_DEVICES) + +static bde_ctrl_t _devices[LINUX_BDE_MAX_DEVICES]; + +static wait_queue_head_t _ether_interrupt_wq; +static atomic_t _ether_interrupt_has_taken_place = ATOMIC_INIT(0); + +/* + * Multiple instance resource data structure. + * To keep the DMA resource per instance. + * And track the DMA pool usage. + */ +static int _bde_multi_inst = 0; + +typedef struct { + unsigned int inst_id; + unsigned int dma_offset; + unsigned int dma_size; + wait_queue_head_t intr_wq; + atomic_t intr; +} bde_inst_resource_t; + +static bde_inst_resource_t _bde_inst_resource[LINUX_BDE_MAX_DEVICES]; + +typedef struct { + phys_addr_t cpu_pbase; /* CPU physical base address of the DMA pool */ + phys_addr_t dma_pbase; /* Bus base address of the DMA pool */ + uint32 total_size; /* Total size of the pool in MB */ + uint32 offset; /* Current offset of the pool in MB */ +}_dma_pool_t; + +static _dma_pool_t _dma_pool; + +#define ONE_MB (1024 * 1024) + +#ifdef KEYSTONE +/* + * Enforce PCIE transaction ordering. Commit the write transaction. + */ + +#define SSOC_WRITEL(val, addr) \ + do { \ + writel((val), (addr)); \ + __asm__ __volatile__("sync"); \ + } while(0) + +#else + +#define SSOC_WRITEL(val, addr) \ + writel((val), (addr)) + +#endif +/* + * Function: _interrupt + * + * Purpose: + * Interrupt Handler. + * Mask all interrupts on device and wake up interrupt + * thread. It is assumed that the interrupt thread unmasks + * interrupts again when interrupt handling is complete. + * Parameters: + * ctrl - BDE control structure for this device. + * Returns: + * Nothing + */ +static void +_cmic_interrupt(bde_ctrl_t *ctrl) +{ + int d; + uint32_t mask = 0, stat, imask = 0, fmask = 0; + bde_inst_resource_t *res; + + d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t)); + res = &_bde_inst_resource[ctrl->inst]; + + /* Check for secondary interrupt handler */ + if (lkbde_irq_mask_get(d, &mask, &fmask) < 0) { + fmask = 0; + } + + if (fmask != 0) { + imask = mask & ~fmask; + /* Check for pending user mode interrupts */ + stat = user_bde->read(d, CMIC_IRQ_STAT); + if ((stat & imask) == 0) { + /* All handled in kernel mode */ + lkbde_irq_mask_set(d, CMIC_IRQ_MASK, imask, 0); + return; + } + } + + lkbde_irq_mask_set(d, CMIC_IRQ_MASK, 0, 0); + + atomic_set(&res->intr, 1); + +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} + +static void +_cmicx_interrupt(bde_ctrl_t *ctrl) +{ + int d, i; + bde_inst_resource_t *res; + + d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t)); + res = &_bde_inst_resource[ctrl->inst]; + + /* Disable all interrupts.. Re-enable unserviced interrupts later + * So as to avoid getting new interrupts until the user level driver + * enumerates the interrupts to be serviced + */ + for (i = 0 ; i < INTC_INTR_REG_NUM ; i++) { + WRITE_INTC_INTR(d, (INTC_INTR_ENABLE_BASE + 4*i), 0); + } + + /* Notify */ + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} + +static void +_cmicm_interrupt(bde_ctrl_t *ctrl) +{ + int d; + int cmc = BDE_CMICM_PCIE_CMC; + uint32 stat, mask = 0, fmask = 0, imask = 0; + bde_inst_resource_t *res; + + d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t)); + res = &_bde_inst_resource[ctrl->inst]; + + lkbde_irq_mask_get(d, &mask, &fmask); + + while (fmask) { + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT0_OFFSET(cmc)); + imask = mask & ~fmask; + if (stat & imask) { + break; + } + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT1_OFFSET(cmc)); + if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + mask = user_bde->read(d, CMIC_CMCx_UC0_IRQ_MASK1_OFFSET(cmc)); + } else { + mask = user_bde->read(d, CMIC_CMCx_PCIE_IRQ_MASK1_OFFSET(cmc)); + } + if (stat & mask) { + break; + } + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT2_OFFSET(cmc)); + if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + mask = user_bde->read(d, CMIC_CMCx_UC0_IRQ_MASK2_OFFSET(cmc)); + } else { + mask = user_bde->read(d, CMIC_CMCx_PCIE_IRQ_MASK2_OFFSET(cmc)); + } + if (stat & mask) { + break; + } + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT3_OFFSET(cmc)); + if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + mask = user_bde->read(d, CMIC_CMCx_UC0_IRQ_MASK3_OFFSET(cmc)); + } else { + mask = user_bde->read(d, CMIC_CMCx_PCIE_IRQ_MASK3_OFFSET(cmc)); + } + if (stat & mask) { + break; + } + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT4_OFFSET(cmc)); + if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + mask = user_bde->read(d, CMIC_CMCx_UC0_IRQ_MASK4_OFFSET(cmc)); + } else { + mask = user_bde->read(d, CMIC_CMCx_PCIE_IRQ_MASK4_OFFSET(cmc)); + } + if (stat & mask) { + break; + } + return; + } + + if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + lkbde_irq_mask_set(d, CMIC_CMCx_UC0_IRQ_MASK0_OFFSET(cmc), 0, 0); + user_bde->write(d, CMIC_CMCx_UC0_IRQ_MASK1_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_UC0_IRQ_MASK2_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_UC0_IRQ_MASK3_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_UC0_IRQ_MASK4_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_UC0_IRQ_MASK0_OFFSET(1), 0); + user_bde->write(d, CMIC_CMCx_UC0_IRQ_MASK0_OFFSET(2), 0); + } + else { + lkbde_irq_mask_set(d, CMIC_CMCx_PCIE_IRQ_MASK0_OFFSET(cmc), 0, 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK1_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK2_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK3_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK4_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK0_OFFSET(1), 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK0_OFFSET(2), 0); + } + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} + + +static void +_cmicd_interrupt(bde_ctrl_t *ctrl) +{ + int d; + int cmc = BDE_CMICD_PCIE_CMC; + uint32 stat, mask = 0, fmask = 0, imask = 0; + bde_inst_resource_t *res; + + d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t)); + res = &_bde_inst_resource[ctrl->inst]; + lkbde_irq_mask_get(d, &mask, &fmask); + + while (fmask) { + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT0_OFFSET(cmc)); + imask = mask & ~fmask; + if (stat & imask) { + break; + } + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT1_OFFSET(cmc)); + mask = user_bde->read(d, CMIC_CMCx_PCIE_IRQ_MASK1_OFFSET(cmc)); + if (stat & mask) { + break; + } + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT2_OFFSET(cmc)); + mask = user_bde->read(d, CMIC_CMCx_PCIE_IRQ_MASK2_OFFSET(cmc)); + if (stat & mask) { + break; + } + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT3_OFFSET(cmc)); + mask = user_bde->read(d, CMIC_CMCx_PCIE_IRQ_MASK3_OFFSET(cmc)); + if (stat & mask) { + break; + } + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT4_OFFSET(cmc)); + mask = user_bde->read(d, CMIC_CMCx_PCIE_IRQ_MASK4_OFFSET(cmc)); + if (stat & mask) { + break; + } + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT5_OFFSET(cmc)); + mask = user_bde->read(d, CMIC_CMCx_PCIE_IRQ_MASK5_OFFSET(cmc)); + if (stat & mask) { + break; + } + stat = user_bde->read(d, CMIC_CMCx_IRQ_STAT6_OFFSET(cmc)); + mask = user_bde->read(d, CMIC_CMCx_PCIE_IRQ_MASK6_OFFSET(cmc)); + if (stat & mask) { + break; + } + return; + } + + lkbde_irq_mask_set(d, CMIC_CMCx_PCIE_IRQ_MASK0_OFFSET(cmc), 0, 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK1_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK2_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK3_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK4_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK5_OFFSET(cmc), 0); + user_bde->write(d, CMIC_CMCx_PCIE_IRQ_MASK6_OFFSET(cmc), 0); + + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} + +static void +_bcm88750_interrupt(bde_ctrl_t *ctrl) +{ + int d; + bde_inst_resource_t *res; + + d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t)); + res = &_bde_inst_resource[ctrl->inst]; + lkbde_irq_mask_set(d, CMIC_IRQ_MASK, 0, 0); + + lkbde_irq_mask_set(d, CMIC_IRQ_MASK_1, 0, 0); + lkbde_irq_mask_set(d, CMIC_IRQ_MASK_2, 0, 0); + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} + +static void +_qe2k_interrupt(bde_ctrl_t *ctrl) +{ + bde_inst_resource_t *res; + + res = &_bde_inst_resource[ctrl->inst]; + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x20/sizeof(uint32)); + + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} + +static void +_fe2k_interrupt(bde_ctrl_t *ctrl) +{ + bde_inst_resource_t *res; + + res = &_bde_inst_resource[ctrl->inst]; + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x18/sizeof(uint32)); /* PC_INTERRUPT_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x24/sizeof(uint32)); /* PC_ERROR0_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x2c/sizeof(uint32)); /* PC_ERROR1_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x34/sizeof(uint32)); /* PC_UNIT_MASK */ + + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} + +static void +_fe2kxt_interrupt(bde_ctrl_t *ctrl) +{ + bde_inst_resource_t *res; + + res = &_bde_inst_resource[ctrl->inst]; + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x2c/sizeof(uint32)); /* PC_INTERRUPT_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x38/sizeof(uint32)); /* PC_ERROR0_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x40/sizeof(uint32)); /* PC_ERROR1_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x50/sizeof(uint32)); /* PC_UNIT_MASK */ + + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} + +static void +_bme3200_interrupt(bde_ctrl_t *ctrl) +{ + bde_inst_resource_t *res; + + res = &_bde_inst_resource[ctrl->inst]; + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x54/sizeof(uint32)); /* PI_PT_ERROR0 */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x5c/sizeof(uint32)); /* PI_PT_ERROR1 */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x64/sizeof(uint32)); /* PI_PT_ERROR2 */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x6c/sizeof(uint32)); /* PI_PT_ERROR3 */ + + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} + + +static void +_bm9600_interrupt(bde_ctrl_t *ctrl) +{ + bde_inst_resource_t *res; + + res = &_bde_inst_resource[ctrl->inst]; + + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x5c/sizeof(uint32)); /* PI_INTERRUPT_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0xc/sizeof(uint32)); /* PI_UNIT_INTERRUPT0_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x14/sizeof(uint32)); /* PI_UNIT_INTERRUPT1_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x1c/sizeof(uint32)); /* PI_UNIT_INTERRUPT2_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x24/sizeof(uint32)); /* PI_UNIT_INTERRUPT3_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x2c/sizeof(uint32)); /* PI_UNIT_INTERRUPT4_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x34/sizeof(uint32)); /* PI_UNIT_INTERRUPT5_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x3c/sizeof(uint32)); /* PI_UNIT_INTERRUPT6_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x44/sizeof(uint32)); /* PI_UNIT_INTERRUPT7_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x4c/sizeof(uint32)); /* PI_UNIT_INTERRUPT8_MASK */ + SSOC_WRITEL(0xffffffff, ctrl->ba + 0x54/sizeof(uint32)); /* PI_UNIT_INTERRUPT9_MASK */ + + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} + + + +/* The actual interrupt handler of ethernet devices */ +static void +_ether_interrupt(bde_ctrl_t *ctrl) +{ +#ifdef KEYSTONE + /* + * Since the two GMAC cores are sharing the same IRQ. + * Add the checking to handle the interrupt events. + */ + if ((ctrl->devid == BCM53000_GMAC_ID)) { + if ((readl(ctrl->ba + 0x020/4) & readl(ctrl->ba + 0x024/4)) == 0) { + return; + } + } +#endif + SSOC_WRITEL(0, ctrl->ba + 0x024/4); + + atomic_set(&_ether_interrupt_has_taken_place, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&_ether_interrupt_wq); +#else + wake_up_interruptible(&_ether_interrupt_wq); +#endif +} + + +static struct _intr_mode_s { + isr_f isr; + const char *name; +} _intr_mode[] = { + { (isr_f)_cmic_interrupt, "CMIC/CMICe" }, + { (isr_f)_cmicm_interrupt, "CMICm" }, + { (isr_f)_cmicd_interrupt, "CMICd" }, + { (isr_f)_qe2k_interrupt, "QE2K" }, + { (isr_f)_fe2k_interrupt, "FE2K" }, + { (isr_f)_fe2kxt_interrupt, "FE2KXT" }, + { (isr_f)_bme3200_interrupt, "BME3200" }, + { (isr_f)_bm9600_interrupt, "BM9600" }, + { (isr_f)_bcm88750_interrupt, "BCM88750" }, + { (isr_f)_cmicx_interrupt, "CMICx" }, + { NULL, NULL } +}; + +static const char * +_intr_mode_str(void *isr) +{ + int imx; + + imx = 0; + while (_intr_mode[imx].isr != NULL) { + if (isr == _intr_mode[imx].isr) { + return _intr_mode[imx].name; + } + imx++; + } + return NULL; +} + +static void +_devices_init(int d) +{ + bde_ctrl_t *ctrl; + uint32 ver; + + ctrl = &_devices[d]; + /* Initialize our control info */ + ctrl->dev_type = user_bde->get_dev_type(d); + ctrl->devid = user_bde->get_dev(d)->device; + ctrl->inst = 0; + + if (BDE_DEV_MEM_MAPPED(ctrl->dev_type)) { + ctrl->enabled = 0; + ctrl->ba = lkbde_get_dev_virt(d); + } + if (ctrl->dev_type & BDE_SWITCH_DEV_TYPE) { + switch (user_bde->get_dev(d)->device) { + case QE2000_DEVICE_ID: + ctrl->isr = (isr_f)_qe2k_interrupt; + break; + case BCM88020_DEVICE_ID: + ctrl->isr = (isr_f)_fe2k_interrupt; + break; + case BCM88025_DEVICE_ID: + ctrl->isr = (isr_f)_fe2kxt_interrupt; + break; + case BME3200_DEVICE_ID: + ctrl->isr = (isr_f)_bme3200_interrupt; + break; + case BM9600_DEVICE_ID: + ctrl->isr = (isr_f)_bm9600_interrupt; + break; + case BCM88750_DEVICE_ID: + case BCM88753_DEVICE_ID: + case BCM88754_DEVICE_ID: + case BCM88755_DEVICE_ID: + case BCM88752_DEVICE_ID: + ctrl->isr = (isr_f)_bcm88750_interrupt; + break; + /* FIXME: might use _devices[i].dev_type & BDE_AXI_DEV_TYPE*/ + case BCM88670_DEVICE_ID: + case BCM88671_DEVICE_ID: + case BCM88671M_DEVICE_ID: + case BCM88672_DEVICE_ID: + case BCM88673_DEVICE_ID: + case BCM88674_DEVICE_ID: + case BCM88675_DEVICE_ID: + case BCM88675M_DEVICE_ID: + case BCM88676_DEVICE_ID: + case BCM88676M_DEVICE_ID: + case BCM88677_DEVICE_ID: + case BCM88678_DEVICE_ID: + case BCM88679_DEVICE_ID: + case BCM88370_DEVICE_ID: + case BCM88371_DEVICE_ID: + case BCM88371M_DEVICE_ID: + case BCM88375_DEVICE_ID: + case BCM88376_DEVICE_ID: + case BCM88376M_DEVICE_ID: + case BCM88377_DEVICE_ID: + case BCM88378_DEVICE_ID: + case BCM88379_DEVICE_ID: + case BCM88681_DEVICE_ID: + case BCM88682_DEVICE_ID: + case BCM88683_DEVICE_ID: + case BCM88684_DEVICE_ID: + case BCM88685_DEVICE_ID: + case BCM88380_DEVICE_ID: + case BCM88381_DEVICE_ID: + case BCM88680_DEVICE_ID: + case BCM88690_DEVICE_ID: + case BCM88770_DEVICE_ID: + case BCM88773_DEVICE_ID: + case BCM88774_DEVICE_ID: + case BCM88775_DEVICE_ID: + case BCM88776_DEVICE_ID: + case BCM88777_DEVICE_ID: + case BCM88470_DEVICE_ID: + case BCM88470P_DEVICE_ID: + case BCM88471_DEVICE_ID: + case BCM88473_DEVICE_ID: + case BCM88474_DEVICE_ID: + case BCM88474H_DEVICE_ID: + case BCM88476_DEVICE_ID: + case BCM88477_DEVICE_ID: + + case BCM88270_DEVICE_ID: + case BCM88272_DEVICE_ID: + case BCM88273_DEVICE_ID: + case BCM88278_DEVICE_ID: + case BCM8206_DEVICE_ID: + case BCM88950_DEVICE_ID: + case BCM88953_DEVICE_ID: + case BCM88954_DEVICE_ID: + case BCM88955_DEVICE_ID: + case BCM88956_DEVICE_ID: + case BCM88790_DEVICE_ID: + case BCM88772_DEVICE_ID: + case BCM88952_DEVICE_ID: + ctrl->isr = (isr_f)_cmicd_interrupt; + break; + default: + /* Get CMIC version */ + if (user_bde->get_cmic_ver(d, &ver) != 0) { + ver = -1; + } + /* check if version is CMICX */ + if (ver == 0x04) { + ctrl->isr = (isr_f)_cmicx_interrupt; + } else { + ctrl->isr = (isr_f)_cmic_interrupt; + if ((ctrl->dev_type & BDE_256K_REG_SPACE) && +#ifdef BCM_PETRA_SUPPORT /* FIXME remove code when hardware design is fixed */ + ctrl->devid != 0x1234 && +#endif + readl(ctrl->ba + CMICE_DEV_REV_ID) == 0) { + ctrl->isr = (isr_f)_cmicm_interrupt; + } + } + break; + } + if (_intr_mode_str(ctrl->isr) == NULL) { + gprintk("Warning: Unknown interrupt mode\n"); + } + } +} +/* + * Function: _init + * + * Purpose: + * Module initialization. + * Attaches to kernel BDE. + * Parameters: + * None + * Returns: + * Always 0 + */ +static int +_init(void) +{ + int i; + phys_addr_t cpu_pbase, dma_pbase; + ssize_t dmasize; + bde_inst_resource_t *res; + + /* Connect to the kernel bde */ + if ((linux_bde_create(NULL, &user_bde) < 0) || user_bde == NULL) { + return -ENODEV; + } + + init_waitqueue_head(&_ether_interrupt_wq); + + lkbde_get_dma_info(&cpu_pbase, &dma_pbase, &dmasize); + + memset(&_dma_pool, 0, sizeof(_dma_pool)); + _dma_pool.cpu_pbase = cpu_pbase; + _dma_pool.dma_pbase = dma_pbase; + _dma_pool.total_size = dmasize / ONE_MB; + + memset(_devices, 0, sizeof(_devices)); + + /* Use _bde_inst_resource[0] as the default resource */ + memset(_bde_inst_resource, 0, sizeof(_bde_inst_resource)); + res = &_bde_inst_resource[0]; + res->dma_offset = 0; + res->dma_size = _dma_pool.total_size; + init_waitqueue_head(&res->intr_wq); + atomic_set(&res->intr, 0); + + for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) { + res->inst_id |= (1 << i); + _devices_init(i); + } + return 0; +} + +/* + * Function: _cleanup + * + * Purpose: + * Module cleanup function. + * Parameters: + * None + * Returns: + * Always 0 + */ +static int +_cleanup(void) +{ + int i; + + if (user_bde) { + for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) { + if (_devices[i].enabled && + BDE_DEV_MEM_MAPPED(_devices[i].dev_type)) { + user_bde->interrupt_disconnect(i); + } + lkbde_dev_instid_set(i, 0); + } + linux_bde_destroy(user_bde); + user_bde = NULL; + } + return 0; +} + +/* + * Function: _pprint + * + * Purpose: + * Print proc filesystem information. + * Parameters: + * None + * Returns: + * Always 0 + */ +static int +_pprint(void) +{ + int idx; + const char *name; + bde_inst_resource_t *res; + uint32 state, instid; + + pprintf("Broadcom Device Enumerator (%s)\n", LINUX_USER_BDE_NAME); + for (idx = 0; idx < user_bde->num_devices(BDE_ALL_DEVICES); idx++) { + name = _intr_mode_str(_devices[idx].isr); + if (name == NULL) { + name = "unknown"; + } + pprintf("\t%d: Interrupt mode %s ",idx, name); + (void)lkbde_dev_state_get(idx, &state); + if (state == BDE_DEV_STATE_REMOVED) { + pprintf(" Device REMOVED ! \n"); + } else { + (void)lkbde_dev_instid_get(idx, &instid); + if (instid) { + pprintf("Inst id 0x%x\n",instid); + } else { + pprintf("\n"); + } + } + } + pprintf("Instance resource \n"); + + for (idx = 0; idx < user_bde->num_devices(BDE_ALL_DEVICES); idx++) { + res = &_bde_inst_resource[idx]; + if (res->inst_id) { + pprintf("\tDev mask 0x%x : " + "DMA offset %d size %d MB\n", + res->inst_id, + res->dma_offset, + res->dma_size); + } + } + + return 0; +} + +/* + * Allocate the DMA resource from DMA pool + * Parameter : + * dma_size (IN): allocate dma_size in MB + * dma_offset (OUT): dma offset in MB + */ +static int +_dma_resource_alloc(unsigned int dma_size, unsigned int *dma_offset) +{ + uint32 left; + + left = _dma_pool.total_size - _dma_pool.offset; + if (dma_size > left) { + gprintk("ERROR: Run out the dma resource!\n"); + return -1; + } + *dma_offset = _dma_pool.offset; + _dma_pool.offset += dma_size; + return 0; +} + +static int +_dma_resource_get(int inst_id, phys_addr_t *cpu_pbase, phys_addr_t *dma_pbase, ssize_t* size) +{ + int i; + unsigned int dma_size = 0, dma_offset = 0; + bde_inst_resource_t *res; + + for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) { + res = &_bde_inst_resource[i]; + if (res->inst_id == inst_id) { + dma_size = res->dma_size; + dma_offset = res->dma_offset; + break; + } + } + + *cpu_pbase = _dma_pool.cpu_pbase + dma_offset * ONE_MB; + *dma_pbase = _dma_pool.dma_pbase + dma_offset * ONE_MB; + *size = dma_size * ONE_MB; + + return 0; +} + +static int +_instance_validate(unsigned int inst_id, unsigned int dmasize) +{ + int i; + bde_inst_resource_t *res; + + for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) { + res = &_bde_inst_resource[i]; + if (res->inst_id == inst_id) { + if (res->dma_size != dmasize) { + if(_devices[i].inst == 0){ + /* Skip _instance_validate (not init yet) */ + return LUBDE_SUCCESS; + } + gprintk("ERROR: dma_size mismatch\n"); + return LUBDE_FAIL; + } + return (1); + } + } + return LUBDE_SUCCESS; +} + +static int +_device_reprobe(void) +{ + int i; + for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) { + if (_devices[i].devid == 0) { + _devices_init(i); + } + } + return 0; +} + +static int +_instance_attach(unsigned int inst_id, unsigned int dma_size) +{ + unsigned int dma_offset; + int i, exist; + bde_inst_resource_t *res; + int inst_idx = -1; + uint32 instid; + + /* Reprobe the system for hot-plugged device */ + _device_reprobe(); + + /* Validate the resource with inst_id */ + exist = _instance_validate(inst_id, dma_size); + if (exist < 0) { + return LUBDE_FAIL; + } + if (exist > 0) { + return LUBDE_SUCCESS; + } + if (_dma_resource_alloc(dma_size, &dma_offset) < 0) { + return LUBDE_FAIL; + } + for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) { + res = &_bde_inst_resource[i]; + if ((_bde_multi_inst == 0) || (res->inst_id == 0)) { + res->inst_id = inst_id; + res->dma_offset = dma_offset; + res->dma_size = dma_size; + _bde_multi_inst++; + inst_idx = i; + init_waitqueue_head(&res->intr_wq); + atomic_set(&res->intr, 0); + break; + } + } + + for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) { + if (inst_id & (1 << i)) { + _devices[i].inst = inst_idx; + /* Pass the instid to the kernel BDE */ + if (lkbde_dev_instid_get(i, &instid) == 0) { + if (!instid) { + lkbde_dev_instid_set(i, inst_id); + } + } + } + } + + return LUBDE_SUCCESS; +} + +/* + * Function: _ioctl + * + * Purpose: + * Handle IOCTL commands from user mode. + * Parameters: + * cmd - IOCTL cmd + * arg - IOCTL parameters + * Returns: + * 0 on success, <0 on error + */ +static int +_ioctl(unsigned int cmd, unsigned long arg) +{ + lubde_ioctl_t io; + phys_addr_t cpu_pbase, dma_pbase; + ssize_t size; + const ibde_dev_t *bde_dev; + int inst_id; + bde_inst_resource_t *res; + + if (copy_from_user(&io, (void *)arg, sizeof(io))) { + return -EFAULT; + } + + io.rc = LUBDE_SUCCESS; + + switch(cmd) { + case LUBDE_VERSION: + io.d0 = KBDE_VERSION; + break; + case LUBDE_GET_NUM_DEVICES: + io.d0 = user_bde->num_devices(io.dev); + break; + case LUBDE_GET_DEVICE: + if (!VALID_DEVICE(io.dev)) { + return -EINVAL; + } + bde_dev = user_bde->get_dev(io.dev); + if (bde_dev) { + io.d0 = bde_dev->device; + io.d1 = bde_dev->rev; + if (BDE_DEV_MEM_MAPPED(_devices[io.dev].dev_type)) { + /* Get physical address to map */ + io.d2 = lkbde_get_dev_phys(io.dev); + io.d3 = lkbde_get_dev_phys_hi(io.dev); + } + } else { + io.rc = LUBDE_FAIL; + } + break; + case LUBDE_GET_DEVICE_TYPE: + if (!VALID_DEVICE(io.dev)) { + return -EINVAL; + } + io.d0 = _devices[io.dev].dev_type; + break; + case LUBDE_GET_BUS_FEATURES: + user_bde->pci_bus_features(io.dev, (int *) &io.d0, (int *) &io.d1, + (int *) &io.d2); + break; + case LUBDE_PCI_CONFIG_PUT32: + if (!VALID_DEVICE(io.dev)) { + return -EINVAL; + } + if (_devices[io.dev].dev_type & BDE_PCI_DEV_TYPE) { + user_bde->pci_conf_write(io.dev, io.d0, io.d1); + } else { + io.rc = LUBDE_FAIL; + } + break; + case LUBDE_PCI_CONFIG_GET32: + if (!VALID_DEVICE(io.dev)) { + return -EINVAL; + } + if (_devices[io.dev].dev_type & BDE_PCI_DEV_TYPE) { + io.d0 = user_bde->pci_conf_read(io.dev, io.d0); + } else { + io.rc = LUBDE_FAIL; + } + break; + case LUBDE_GET_DMA_INFO: + inst_id = io.dev; + if (_bde_multi_inst){ + _dma_resource_get(inst_id, &cpu_pbase, &dma_pbase, &size); + } else { + lkbde_get_dma_info(&cpu_pbase, &dma_pbase, &size); + } + io.d0 = dma_pbase; + io.d1 = size; + /* Optionally enable DMA mmap via /dev/linux-kernel-bde */ + io.d2 = USE_LINUX_BDE_MMAP; + /* Get physical address for mmap */ + io.dx.dw[0] = cpu_pbase; +#ifdef PHYS_ADDRS_ARE_64BITS + io.dx.dw[1] = cpu_pbase >> 32; +#else + io.dx.dw[1] = 0; +#endif + break; + case LUBDE_ENABLE_INTERRUPTS: + if (!VALID_DEVICE(io.dev)) { + return -EINVAL; + } + if (_devices[io.dev].dev_type & BDE_SWITCH_DEV_TYPE) { + if (_devices[io.dev].isr && !_devices[io.dev].enabled) { + user_bde->interrupt_connect(io.dev, + _devices[io.dev].isr, + _devices+io.dev); + _devices[io.dev].enabled = 1; + } + } else { + /* Process ethernet device interrupt */ + /* FIXME: for multiple chips */ + if (!_devices[io.dev].enabled) { + user_bde->interrupt_connect(io.dev, + (void(*)(void *))_ether_interrupt, + _devices+io.dev); + _devices[io.dev].enabled = 1; + } + } + break; + case LUBDE_DISABLE_INTERRUPTS: + if (!VALID_DEVICE(io.dev)) { + return -EINVAL; + } + if (_devices[io.dev].enabled) { + user_bde->interrupt_disconnect(io.dev); + _devices[io.dev].enabled = 0; + } + break; + case LUBDE_WAIT_FOR_INTERRUPT: + if (!VALID_DEVICE(io.dev)) { + return -EINVAL; + } + if (_devices[io.dev].dev_type & BDE_SWITCH_DEV_TYPE) { + res = &_bde_inst_resource[_devices[io.dev].inst]; +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wait_event_timeout(res->intr_wq, + atomic_read(&res->intr) != 0, 100); + +#else + wait_event_interruptible(res->intr_wq, + atomic_read(&res->intr) != 0); +#endif + /* + * Even if we get multiple interrupts, we + * only run the interrupt handler once. + */ + atomic_set(&res->intr, 0); + } else { +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wait_event_timeout(_ether_interrupt_wq, + atomic_read(&_ether_interrupt_has_taken_place) != 0, 100); +#else + wait_event_interruptible(_ether_interrupt_wq, + atomic_read(&_ether_interrupt_has_taken_place) != 0); +#endif + /* + * Even if we get multiple interrupts, we + * only run the interrupt handler once. + */ + atomic_set(&_ether_interrupt_has_taken_place, 0); + } + break; + case LUBDE_USLEEP: + sal_usleep(io.d0); + break; + case LUBDE_UDELAY: + sal_udelay(io.d0); + break; + case LUBDE_SEM_OP: + switch (io.d0) { + case LUBDE_SEM_OP_CREATE: + io.p0 = (bde_kernel_addr_t)sal_sem_create("", io.d1, io.d2); + break; + case LUBDE_SEM_OP_DESTROY: + sal_sem_destroy((sal_sem_t)io.p0); + break; + case LUBDE_SEM_OP_TAKE: + io.rc = sal_sem_take((sal_sem_t)io.p0, io.d2); + break; + case LUBDE_SEM_OP_GIVE: + io.rc = sal_sem_give((sal_sem_t)io.p0); + break; + default: + io.rc = LUBDE_FAIL; + break; + } + break; + case LUBDE_WRITE_IRQ_MASK: + io.rc = lkbde_irq_mask_set(io.dev, io.d0, io.d1, 0); + break; + case LUBDE_SPI_READ_REG: + if (user_bde->spi_read(io.dev, io.d0, io.dx.buf, io.d1) == -1) { + io.rc = LUBDE_FAIL; + } + break; + case LUBDE_SPI_WRITE_REG: + if (user_bde->spi_write(io.dev, io.d0, io.dx.buf, io.d1) == -1) { + io.rc = LUBDE_FAIL; + } + break; + case LUBDE_READ_REG_16BIT_BUS: + io.d1 = user_bde->read(io.dev, io.d0); + break; + case LUBDE_WRITE_REG_16BIT_BUS: + io.rc = user_bde->write(io.dev, io.d0, io.d1); + break; +#if (defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT)) + case LUBDE_CPU_WRITE_REG: + { + if (lkbde_cpu_write(io.dev, io.d0, (uint32*)io.dx.buf) == -1) { + io.rc = LUBDE_FAIL; + } + break; + } + case LUBDE_CPU_READ_REG: + { + if (lkbde_cpu_read(io.dev, io.d0, (uint32*)io.dx.buf) == -1) { + io.rc = LUBDE_FAIL; + } + break; + } + case LUBDE_CPU_PCI_REGISTER: + { + if (lkbde_cpu_pci_register(io.dev) == -1) { + io.rc = LUBDE_FAIL; + } + break; + } +#endif + case LUBDE_DEV_RESOURCE: + if (!VALID_DEVICE(io.dev)) { + return -EINVAL; + } + bde_dev = user_bde->get_dev(io.dev); + if (bde_dev) { + if (BDE_DEV_MEM_MAPPED(_devices[io.dev].dev_type)) { + /* Get physical address to map */ + io.rc = lkbde_get_dev_resource(io.dev, io.d0, + &io.d1, &io.d2, &io.d3); + } + } else { + io.rc = LUBDE_FAIL; + } + break; + case LUBDE_IPROC_READ_REG: + io.d1 = user_bde->iproc_read(io.dev, io.d0); + if (io.d1 == -1) { + io.rc = LUBDE_FAIL; + } + break; + case LUBDE_IPROC_WRITE_REG: + if (user_bde->iproc_write(io.dev, io.d0, io.d1) == -1) { + io.rc = LUBDE_FAIL; + } + break; + case LUBDE_ATTACH_INSTANCE: + io.rc = _instance_attach(io.d0, io.d1); + break; + case LUBDE_GET_DEVICE_STATE: + io.rc = lkbde_dev_state_get(io.dev, &io.d0); + break; + default: + gprintk("Error: Invalid ioctl (%08x)\n", cmd); + io.rc = LUBDE_FAIL; + break; + } + + if (copy_to_user((void *)arg, &io, sizeof(io))) { + return -EFAULT; + } + + return 0; +} + +/* Workaround for broken Busybox/PPC insmod */ +static char _modname[] = LINUX_USER_BDE_NAME; + +static gmodule_t _gmodule = +{ + name: LINUX_USER_BDE_NAME, + major: LINUX_USER_BDE_MAJOR, + init: _init, + cleanup: _cleanup, + pprint: _pprint, + ioctl: _ioctl, +}; + +gmodule_t* +gmodule_get(void) +{ + _gmodule.name = _modname; + return &_gmodule; +} diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.h b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.h new file mode 100644 index 000000000000..edf5f63bf54a --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.h @@ -0,0 +1,113 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: linux-user-bde.h,v 1.23 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ + +#ifndef __LINUX_USER_BDE_H__ +#define __LINUX_USER_BDE_H__ + +#include +#include +#include +#ifndef __KERNEL__ +#include +#endif + +#if defined(SAL_BDE_32BIT_USER_64BIT_KERNEL) || defined(PTRS_ARE_64BITS) +typedef uint64_t bde_kernel_addr_t; +#else +typedef uint32_t bde_kernel_addr_t; +#endif + +/* Ioctl control structure */ +typedef struct { + unsigned int dev; /* Device ID */ + unsigned int rc; /* Operation Return Code */ + unsigned int d0; /* Operation specific data */ + unsigned int d1; + unsigned int d2; + unsigned int d3; + bde_kernel_addr_t p0; + union { + unsigned int dw[2]; + unsigned char buf[64]; + } dx; +} lubde_ioctl_t; + + +/* LUBDE ioctls */ +#define LUBDE_MAGIC 'L' + +#define LUBDE_VERSION _IO(LUBDE_MAGIC, 0) +#define LUBDE_GET_NUM_DEVICES _IO(LUBDE_MAGIC, 1) +#define LUBDE_GET_DEVICE _IO(LUBDE_MAGIC, 2) +#define LUBDE_PCI_CONFIG_PUT32 _IO(LUBDE_MAGIC, 3) +#define LUBDE_PCI_CONFIG_GET32 _IO(LUBDE_MAGIC, 4) +#define LUBDE_GET_DMA_INFO _IO(LUBDE_MAGIC, 5) +#define LUBDE_ENABLE_INTERRUPTS _IO(LUBDE_MAGIC, 6) +#define LUBDE_DISABLE_INTERRUPTS _IO(LUBDE_MAGIC, 7) +#define LUBDE_USLEEP _IO(LUBDE_MAGIC, 8) +#define LUBDE_WAIT_FOR_INTERRUPT _IO(LUBDE_MAGIC, 9) +#define LUBDE_SEM_OP _IO(LUBDE_MAGIC, 10) +#define LUBDE_UDELAY _IO(LUBDE_MAGIC, 11) +#define LUBDE_GET_DEVICE_TYPE _IO(LUBDE_MAGIC, 12) +#define LUBDE_SPI_READ_REG _IO(LUBDE_MAGIC, 13) +#define LUBDE_SPI_WRITE_REG _IO(LUBDE_MAGIC, 14) +#define LUBDE_READ_REG_16BIT_BUS _IO(LUBDE_MAGIC, 19) +#define LUBDE_WRITE_REG_16BIT_BUS _IO(LUBDE_MAGIC, 20) +#define LUBDE_GET_BUS_FEATURES _IO(LUBDE_MAGIC, 21) +#define LUBDE_WRITE_IRQ_MASK _IO(LUBDE_MAGIC, 22) +#define LUBDE_CPU_WRITE_REG _IO(LUBDE_MAGIC, 23) +#define LUBDE_CPU_READ_REG _IO(LUBDE_MAGIC, 24) +#define LUBDE_CPU_PCI_REGISTER _IO(LUBDE_MAGIC, 25) +#define LUBDE_DEV_RESOURCE _IO(LUBDE_MAGIC, 26) +#define LUBDE_IPROC_READ_REG _IO(LUBDE_MAGIC, 27) +#define LUBDE_IPROC_WRITE_REG _IO(LUBDE_MAGIC, 28) +#define LUBDE_ATTACH_INSTANCE _IO(LUBDE_MAGIC, 29) +#define LUBDE_GET_DEVICE_STATE _IO(LUBDE_MAGIC, 30) + +#define LUBDE_SEM_OP_CREATE 1 +#define LUBDE_SEM_OP_DESTROY 2 +#define LUBDE_SEM_OP_TAKE 3 +#define LUBDE_SEM_OP_GIVE 4 + +#define LUBDE_SUCCESS 0 +#define LUBDE_FAIL ((unsigned int)-1) + + +/* + * Version history + * 1:add LUBDE_GET_DEVICE_STATE to support PCI hot plug + */ +#define KBDE_VERSION 1 + + +/* This is the signal that will be used + * when an interrupt occurs + */ + +#ifndef __KERNEL__ +#include +#endif + +#define LUBDE_INTERRUPT_SIGNAL SIGUSR1 +#define LUBDE_ETHER_INTERRUPT_SIGNAL SIGUSR2 + +#endif /* __LUBDE_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde.h b/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde.h new file mode 100644 index 000000000000..0a9df3a6e419 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde.h @@ -0,0 +1,77 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: $ + * $Copyright: (c) 2014 Broadcom Corp. + * All Rights Reserved.$ + * + */ + +#ifndef __SHBDE_H__ +#define __SHBDE_H__ + +typedef void (*shbde_log_func_t)(int level, const char *str, int param); + +#define SHBDE_ERR 0 +#define SHBDE_WARN 1 +#define SHBDE_DBG 2 + +/* iProc configuration (primarily used for PCI-AXI bridge) */ +typedef struct shbde_iproc_config_s { + unsigned int dev_id; + unsigned int dev_rev; + unsigned int use_msi; + unsigned int iproc_ver; + unsigned int cmic_ver; + unsigned int cmic_rev; + unsigned int dma_hi_bits; + unsigned int mdio_base_addr; + unsigned int pcie_phy_addr; + unsigned int adjust_pcie_preemphasis; +} shbde_iproc_config_t; + +/* Hardware abstraction functions */ +typedef struct shbde_hal_s { + + /* Optional log output interface */ + shbde_log_func_t log_func; + + /* PCI configuration access */ + unsigned char (*pcic8_read)(void *pci_dev, unsigned int reg); + void (*pcic8_write)(void *pci_dev, unsigned int reg, unsigned char data); + unsigned short (*pcic16_read)(void *pci_dev, unsigned int reg); + void (*pcic16_write)(void *pci_dev, unsigned int reg, unsigned short data); + unsigned int (*pcic32_read)(void *pci_dev, unsigned int reg); + void (*pcic32_write)(void *pci_dev, unsigned int reg, unsigned int data); + + /* iProc register access */ + unsigned int (*io32_read)(void *addr); + void (*io32_write)(void *addr, unsigned int); + + /* usleep function (optional) */ + void (*usleep)(int usec); + + /* PCI parent device access */ + void *(*pci_parent_device_get)(void *pci_dev); + + /* iProc configuration */ + shbde_iproc_config_t icfg; + +} shbde_hal_t; + + +#endif /* __SHBDE_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_iproc.h b/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_iproc.h new file mode 100644 index 000000000000..4841a3167d89 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_iproc.h @@ -0,0 +1,49 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: $ + * $Copyright: (c) 2014 Broadcom Corp. + * All Rights Reserved.$ + * + */ + +#ifndef __SHBDE_IPROC_H__ +#define __SHBDE_IPROC_H__ + +#include + +extern int +shbde_iproc_config_init(shbde_iproc_config_t *icfg, + unsigned int dev_id, unsigned int dev_rev); + +extern int +shbde_iproc_paxb_init(shbde_hal_t *shbde, void *iproc_regs, + shbde_iproc_config_t *icfg); + +extern unsigned int +shbde_iproc_pci_read(shbde_hal_t *shbde, void *iproc_regs, + unsigned int addr); + +extern void +shbde_iproc_pci_write(shbde_hal_t *shbde, void *iproc_regs, + unsigned int addr, unsigned int data); + +extern int +shbde_iproc_pcie_preemphasis_set(shbde_hal_t *shbde, void *iproc_regs, + shbde_iproc_config_t *icfg, void *pci_dev); + +#endif /* __SHBDE_IPROC_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_mdio.h b/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_mdio.h new file mode 100644 index 000000000000..b5a2f8b3f31d --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_mdio.h @@ -0,0 +1,60 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: $ + * $Copyright: (c) 2015 Broadcom Corp. + * All Rights Reserved.$ + * + */ + +#ifndef __SHBDE_MDIO_H__ +#define __SHBDE_MDIO_H__ + +#include + +typedef struct shbde_mdio_ctrl_s { + + /* Primary HAL*/ + shbde_hal_t *shbde; + + /* Context for iProc MDIO register access */ + void *regs; + + /* Base address for MDIO registers */ + unsigned int base_addr; + + /* iProc MDIO register access */ + unsigned int (*io32_read)(shbde_hal_t *shbde, void *iproc_regs, + unsigned int addr); + void (*io32_write)(shbde_hal_t *shbde, void *iproc_regs, + unsigned int addr, unsigned int data); + +} shbde_mdio_ctrl_t; + + +extern int +shbde_iproc_mdio_init(shbde_mdio_ctrl_t *smc); + +extern int +shbde_iproc_mdio_read(shbde_mdio_ctrl_t *smc, unsigned int phy_addr, + unsigned int reg, unsigned int *val); + +extern int +shbde_iproc_mdio_write(shbde_mdio_ctrl_t *smc, unsigned int phy_addr, + unsigned int reg, unsigned int val); + +#endif /* __SHBDE_MDIO_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_pci.h b/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_pci.h new file mode 100644 index 000000000000..06aadfae5b31 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/shared/include/shbde_pci.h @@ -0,0 +1,47 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: $ + * $Copyright: (c) 2014 Broadcom Corp. + * All Rights Reserved.$ + * + */ + +#ifndef __SHBDE_PCI_H__ +#define __SHBDE_PCI_H__ + +#include + +extern unsigned int +shbde_pci_pcie_cap(shbde_hal_t *shbde, void *pci_dev); + +extern int +shbde_pci_is_pcie(shbde_hal_t *shbde, void *pci_dev); + +extern int +shbde_pci_is_iproc(shbde_hal_t *shbde, void *pci_dev, int *cmic_bar); + +extern int +shbde_pci_max_payload_set(shbde_hal_t *shbde, void *pci_dev, int maxpayload); + +extern int +shbde_pci_iproc_version_get(shbde_hal_t *shbde, void *pci_dev, + unsigned int *iproc_ver, + unsigned int *cmic_ver, + unsigned int *cmic_rev); + +#endif /* __SHBDE_PCI_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_iproc.c b/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_iproc.c new file mode 100644 index 000000000000..2db25df585ae --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_iproc.c @@ -0,0 +1,466 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: $ + * $Copyright: (c) 2014 Broadcom Corp. + * All Rights Reserved.$ + * + */ + +#include +#include +#include + +/* PAXB register offsets within PCI BAR0 window */ +#define BAR0_PAXB_ENDIANESS 0x2030 +#define BAR0_PAXB_PCIE_EP_AXI_CONFIG 0x2104 +#define BAR0_PAXB_CONFIG_IND_ADDR 0x2120 +#define BAR0_PAXB_CONFIG_IND_DATA 0x2124 + +#define BAR0_PAXB_IMAP0_0 (0x2c00) +#define BAR0_PAXB_IMAP0_1 (0x2c04) +#define BAR0_PAXB_IMAP0_2 (0x2c08) +#define BAR0_PAXB_IMAP0_7 (0x2c1c) + +#define BAR0_PAXB_OARR_FUNC0_MSI_PAGE 0x2d34 +#define BAR0_PAXB_OARR_2 0x2d60 +#define BAR0_PAXB_OARR_2_UPPER 0x2d64 +#define BAR0_DMU_PCU_PCIE_SLAVE_RESET_MODE 0x7024 + +/* Force byte pointer for offset adjustments */ +#define ROFFS(_ptr, _offset) ((unsigned char*)(_ptr) + (_offset)) + +#define PAXB_CONFIG_IND_ADDRr_PROTOCOL_LAYERf_SHFT 11 +#define PAXB_CONFIG_IND_ADDRr_PROTOCOL_LAYERf_MASK 0x3 +#define PAXB_CONFIG_IND_ADDRr_ADDRESSf_SHFT 0 +#define PAXB_CONFIG_IND_ADDRr_ADDRESSf_MASK 0x7ff + +/* Register value set/get by field */ +#define REG_FIELD_SET(_r, _f, _r_val, _f_val) \ + _r_val = ((_r_val) & ~(_r##_##_f##_MASK << _r##_##_f##_SHFT)) | \ + (((_f_val) & _r##_##_f##_MASK) << _r##_##_f##_SHFT) +#define REG_FIELD_GET(_r, _f, _r_val) \ + (((_r_val) >> _r##_##_f##_SHFT) & _r##_##_f##_MASK) + +/* PCIe capabilities definition */ +#ifndef PCI_EXP_LNKSTA +#define PCI_EXP_LNKSTA 0x12 +#endif +/* Current Link Speed 5.0GT/s */ +#ifndef PCI_EXP_LNKSTA_CLS_5_0GB +#define PCI_EXP_LNKSTA_CLS_5_0GB 2 +#endif +#ifndef PCI_EXP_LNKSTA2 +#define PCI_EXP_LNKSTA2 0x32 +#endif +/* Current Deemphasis Level -3.5 dB */ +#ifndef PCI_EXP_LNKSTA2_CDL_3_5DB +#define PCI_EXP_LNKSTA2_CDL_3_5DB 0x1 +#endif + +static unsigned int +iproc32_read(shbde_hal_t *shbde, void *addr) +{ + if (!shbde || !shbde->io32_read) { + return 0; + } + return shbde->io32_read(addr); +} + +static void +iproc32_write(shbde_hal_t *shbde, void *addr, unsigned int data) +{ + if (!shbde || !shbde->io32_write) { + return; + } + shbde->io32_write(addr, data); +} + +static void +wait_usec(shbde_hal_t *shbde, int usec) +{ + if (shbde && shbde->usleep) { + shbde->usleep(usec); + } else { + int idx; + volatile int count; + for (idx = 0; idx < usec; idx++) { + for (count = 0; count < 100; count++); + } + } +} + +/* + * Function: + * shbde_iproc_config_init + * Purpose: + * Initialize iProc configuration parameters + * Parameters: + * icfg - pointer to empty iProc configuration structure + * Returns: + * -1 if error, otherwise 0 + */ +int +shbde_iproc_config_init(shbde_iproc_config_t *icfg, + unsigned int dev_id, unsigned int dev_rev) +{ + if (!icfg) { + return -1; + } + + /* Save device ID and revision */ + icfg->dev_id = dev_id; + icfg->dev_rev = dev_rev; + + /* Check device families first */ + switch (icfg->dev_id & 0xfff0) { + case 0x8400: /* Greyhound Lite */ + case 0x8410: /* Greyhound */ + case 0x8420: /* Bloodhound */ + case 0x8450: /* Elkhound */ + case 0xb060: /* Ranger2(Greyhound) */ + case 0x8360: /* Greyhound 53365 & 53369 */ + case 0xb260: /* saber2 */ + case 0xb460: /* saber2+ */ + case 0xb170: /* Hurricane3-MG */ + case 0x8570: /* Greyhound2 */ + case 0xb070: /* Greyhound2(emulation) */ + case 0x8580: /* Greyhound2(emulation) */ + case 0xb230: /* Dagger2 */ + icfg->iproc_ver = 7; + icfg->dma_hi_bits = 0x2; + break; + case 0xb560: /* Apache */ + case 0xb760: /* Maverick */ + icfg->iproc_ver = 0xB; + break; + case 0xb160: /* Hurricane3 */ + case 0x8440: /* Wolfhound2 */ + case 0x8430: /* Foxhound2 */ + icfg->iproc_ver = 10; + icfg->dma_hi_bits = 0x2; + break; + default: + break; + } + + /* Check for exceptions */ + switch (icfg->dev_id) { + case 0xb069: + case 0xb068: + icfg->iproc_ver = 0xB; /*Ranger2+ Apache Family */ + icfg->dma_hi_bits = 0; + break; + case 0xb168: /* Ranger3+ */ + case 0xb169: + icfg->iproc_ver = 0; + icfg->dma_hi_bits = 0; + break; + default: + break; + } + /* Check for PCIe PHY address that needs PCIe preemphasis and + * assign the MDIO base address + */ + switch (icfg->dev_id & 0xfff0) { + case 0xb150: /* Hurricane2 */ + case 0x8340: /* Wolfhound */ + case 0x8330: /* Foxhound */ + case 0x8390: /* Dearhound */ + icfg->mdio_base_addr = 0x18032000; + icfg->pcie_phy_addr = 0x2; + break; + case 0xb340: /* Helilx4 */ + case 0xb540: /* FireScout */ + case 0xb040: /* Spiral, Ranger */ + icfg->mdio_base_addr = 0x18032000; + icfg->pcie_phy_addr = 0x5; + icfg->adjust_pcie_preemphasis = 1; + break; + case 0xa450: /* Katana2 */ + case 0xb240: + case 0xb450: + icfg->mdio_base_addr = 0x18032000; + icfg->pcie_phy_addr = 0x5; + icfg->adjust_pcie_preemphasis = 1; + break; + default: + break; + } + + /* Check for exceptions */ + switch (icfg->dev_id) { + default: + break; + } + + return 0; +} + +/* + * Function: + * shbde_iproc_paxb_init + * Purpose: + * Initialize iProc PCI-AXI bridge for CMIC access + * Parameters: + * shbde - pointer to initialized hardware abstraction module + * iproc_regs - memory mapped iProc registers in PCI BAR + * icfg - iProc configuration parameters + * Returns: + * -1 if error, otherwise 0 + */ +int +shbde_iproc_paxb_init(shbde_hal_t *shbde, void *iproc_regs, + shbde_iproc_config_t *icfg) +{ + void *reg; + unsigned int data; + int pci_num; + + if (!iproc_regs || !icfg) { + return -1; + } + + /* + * The following code attempts to auto-detect the correct + * iProc PCI endianess configuration by reading a well-known + * register (the endianess configuration register itself). + * Note that the PCI endianess may be different for different + * big endian host processors. + */ + reg = ROFFS(iproc_regs, BAR0_PAXB_ENDIANESS); + /* Select big endian */ + iproc32_write(shbde, reg, 0x01010101); + /* Check if endianess register itself is correct endian */ + if (iproc32_read(shbde, reg) != 1) { + /* If not, then assume little endian */ + iproc32_write(shbde, reg, 0x0); + } + + /* Select which PCI core to use */ + pci_num = 0; + reg = ROFFS(iproc_regs, BAR0_PAXB_IMAP0_2); + data = iproc32_read(shbde, reg); + if (data & 0x1000) { + /* PAXB_1 is mapped to sub-window 2 */ + pci_num = 1; + } + + /* Default DMA mapping if uninitialized */ + if (icfg->dma_hi_bits == 0) { + icfg->dma_hi_bits = 0x1; + if (pci_num == 1) { + icfg->dma_hi_bits = 0x2; + } + } + + /* Enable iProc DMA to external host memory */ + reg = ROFFS(iproc_regs, BAR0_PAXB_PCIE_EP_AXI_CONFIG); + iproc32_write(shbde, reg, 0x0); + if(icfg->cmic_ver < 4) { /* Non-CMICX */ + reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_2); + iproc32_write(shbde, reg, 0x1); + reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_2_UPPER); + iproc32_write(shbde, reg, icfg->dma_hi_bits); + + /* Configure MSI interrupt page */ + if (icfg->use_msi) { + reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_FUNC0_MSI_PAGE); + data = iproc32_read(shbde, reg); + iproc32_write(shbde, reg, data | 0x1); + } + } + return pci_num; +} + +/* + * Function: + * shbde_iproc_pci_read + * Purpose: + * Read iProc register through PCI BAR 0 + * Parameters: + * shbde - pointer to initialized hardware abstraction module + * iproc_regs - memory mapped iProc registers in PCI BAR + * addr - iProc register address in AXI memory space + * Returns: + * Register value + */ +unsigned int +shbde_iproc_pci_read(shbde_hal_t *shbde, void *iproc_regs, + unsigned int addr) +{ + unsigned int subwin_base; + void *reg; + shbde_iproc_config_t *icfg = &shbde->icfg; + + if (!iproc_regs) { + return -1; + } + + /* Sub-window size is 0x1000 (4K) */ + subwin_base = (addr & ~0xfff); + + if((icfg->cmic_ver >= 4) && (subwin_base == 0x18013000)) { + /* Route the INTC block access through IMAP0_6 */ + reg = ROFFS(iproc_regs, 0x6000 + (addr & 0xfff)); + } else { + /* Update base address for sub-window 7 */ + subwin_base |= 1; /* Valid bit */ + reg = ROFFS(iproc_regs, BAR0_PAXB_IMAP0_7); + iproc32_write(shbde, reg, subwin_base); + /* Read it to make sure the write actually goes through */ + subwin_base = iproc32_read(shbde, reg); + + /* Read register through sub-window 7 */ + reg = ROFFS(iproc_regs, 0x7000 + (addr & 0xfff)); + } + + return iproc32_read(shbde, reg); +} + +/* + * Function: + * shbde_iproc_pci_write + * Purpose: + * Write iProc register through PCI BAR 0 + * Parameters: + * shbde - pointer to initialized hardware abstraction module + * iproc_regs - memory mapped iProc registers in PCI BAR + * addr - iProc register address in AXI memory space + * data - data to write to iProc register + * Returns: + * Register value + */ +void +shbde_iproc_pci_write(shbde_hal_t *shbde, void *iproc_regs, + unsigned int addr, unsigned int data) +{ + unsigned int subwin_base; + void *reg; + shbde_iproc_config_t *icfg = &shbde->icfg; + + if (!iproc_regs) { + return; + } + + /* Sub-window size is 0x1000 (4K) */ + subwin_base = (addr & ~0xfff); + + if((icfg->cmic_ver >= 4) && (subwin_base == 0x18013000)) { + /* Route the INTC block access through IMAP0_6 */ + reg = ROFFS(iproc_regs, 0x6000 + (addr & 0xfff)); + } else { + /* Update base address for sub-window 7 */ + subwin_base |= 1; /* Valid bit */ + reg = ROFFS(iproc_regs, BAR0_PAXB_IMAP0_7); + iproc32_write(shbde, reg, subwin_base); + /* Read it to make sure the write actually goes through */ + subwin_base = iproc32_read(shbde, reg); + + /* Read register through sub-window 7 */ + reg = ROFFS(iproc_regs, 0x7000 + (addr & 0xfff)); + } + + iproc32_write(shbde, reg, data); +} + +int +shbde_iproc_pcie_preemphasis_set(shbde_hal_t *shbde, void *iproc_regs, + shbde_iproc_config_t *icfg, void *pci_dev) +{ + shbde_mdio_ctrl_t mdio_ctrl, *smc = &mdio_ctrl; + unsigned int phy_addr, data; + void *reg; + unsigned int pcie_cap_base; + unsigned short link_stat, link_stat2; + + if (!icfg) { + return -1; + } + + /* PHY address for PCIe link */ + phy_addr = icfg->pcie_phy_addr; + if (phy_addr == 0 || icfg->mdio_base_addr == 0) { + return 0; + } + + /* Initialize MDIO control */ + smc->shbde = shbde; + smc->regs = iproc_regs; + smc->base_addr = icfg->mdio_base_addr; + smc->io32_read = shbde_iproc_pci_read; + smc->io32_write = shbde_iproc_pci_write; + shbde_iproc_mdio_init(smc); + + /* PCIe SerDes Gen1/Gen2 CDR Track Bandwidth Adjustment + * for Better Jitter Tolerance + */ + shbde_iproc_mdio_write(smc, phy_addr, 0x1f, 0x8630); + shbde_iproc_mdio_write(smc, phy_addr, 0x13, 0x190); + shbde_iproc_mdio_write(smc, phy_addr, 0x19, 0x191); + + if (!icfg->adjust_pcie_preemphasis) { + return 0; + } + + /* Check to see if the PCIe SerDes deemphasis needs to be changed + * based on the advertisement from the root complex + */ + /* Find PCIe capability base */ + if (!shbde || !shbde->pcic16_read || !pci_dev) { + return -1; + } + pcie_cap_base = shbde_pci_pcie_cap(shbde, pci_dev); + if (pcie_cap_base) { + link_stat = shbde->pcic16_read(pci_dev, + pcie_cap_base + PCI_EXP_LNKSTA); + link_stat2 = shbde->pcic16_read(pci_dev, + pcie_cap_base + PCI_EXP_LNKSTA2); + if (((link_stat & 0xf) == PCI_EXP_LNKSTA_CLS_5_0GB) && + (link_stat2 & PCI_EXP_LNKSTA2_CDL_3_5DB)) { + /* Device is operating at Gen2 speeds and RC requested -3.5dB */ + /* Change the transmitter setting */ + shbde_iproc_mdio_write(smc, phy_addr, 0x1f, 0x8610); + shbde_iproc_mdio_read(smc, phy_addr, 0x17, &data); + data &= ~0xf00; + data |= 0x700; + shbde_iproc_mdio_write(smc, phy_addr, 0x17, data); + + /* Force the PCIe link to retrain */ + data = 0; + REG_FIELD_SET(PAXB_CONFIG_IND_ADDRr, PROTOCOL_LAYERf, data, 0x2); + REG_FIELD_SET(PAXB_CONFIG_IND_ADDRr, ADDRESSf, data, 0x4); + reg = ROFFS(iproc_regs, BAR0_PAXB_CONFIG_IND_ADDR); + iproc32_write(shbde, reg, data); + + reg = ROFFS(iproc_regs, BAR0_PAXB_CONFIG_IND_DATA); + data = iproc32_read(shbde, reg); + data &= ~0x4000; + iproc32_write(shbde, reg, data); + data |= 0x4000; + iproc32_write(shbde, reg, data); + data &= ~0x4000; + iproc32_write(shbde, reg, data); + + /* Wait a short while for the retraining to complete */ + wait_usec(shbde, 1000); + } + } + + return 0; +} + diff --git a/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_mdio.c b/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_mdio.c new file mode 100644 index 000000000000..434312d5608c --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_mdio.c @@ -0,0 +1,187 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: $ + * $Copyright: (c) 2015 Broadcom Corp. + * All Rights Reserved.$ + * + */ + +#include + +/* iProc MDIO register offset */ +#define MII_MGMT_CTRL 0x0 +#define MII_MGMT_CMD_DATA 0x4 + +/* iProc MII register with fields definition */ +#define MII_MGMT_CTRLr_MDCDIVf_SHFT 0 +#define MII_MGMT_CTRLr_MDCDIVf_MASK 0x7f +#define MII_MGMT_CTRLr_BSYf_SHFT 8 +#define MII_MGMT_CTRLr_BSYf_MASK 0x1 + +#define MII_MGMT_CMD_DATAr_DATAf_SHFT 0 +#define MII_MGMT_CMD_DATAr_DATAf_MASK 0xffff +#define MII_MGMT_CMD_DATAr_TAf_SHFT 16 +#define MII_MGMT_CMD_DATAr_TAf_MASK 0x3 +#define MII_MGMT_CMD_DATAr_RAf_SHFT 18 +#define MII_MGMT_CMD_DATAr_RAf_MASK 0x1f +#define MII_MGMT_CMD_DATAr_PAf_SHFT 23 +#define MII_MGMT_CMD_DATAr_PAf_MASK 0x1f +#define MII_MGMT_CMD_DATAr_OPf_SHFT 28 +#define MII_MGMT_CMD_DATAr_OPf_MASK 0x3 +#define MII_MGMT_CMD_DATAr_SBf_SHFT 30 +#define MII_MGMT_CMD_DATAr_SBf_MASK 0x3 + +/* Register field value set/get */ +#define REG_FIELD_SET(_r, _f, _r_val, _f_val) \ + _r_val = ((_r_val) & ~(_r##_##_f##_MASK << _r##_##_f##_SHFT)) | \ + (((_f_val) & _r##_##_f##_MASK) << _r##_##_f##_SHFT) +#define REG_FIELD_GET(_r, _f, _r_val) \ + (((_r_val) >> _r##_##_f##_SHFT) & _r##_##_f##_MASK) + +#define LOG_OUT(_shbde, _lvl, _str, _prm) \ + if ((_shbde)->log_func) { \ + (_shbde)->log_func(_lvl, _str, _prm); \ + } +#define LOG_ERR(_shbde, _str, _prm) LOG_OUT(_shbde, SHBDE_ERR, _str, _prm) +#define LOG_WARN(_shbde, _str, _prm) LOG_OUT(_shbde, SHBDE_WARN, _str, _prm) +#define LOG_DBG(_shbde, _str, _prm) LOG_OUT(_shbde, SHBDE_DBG, _str, _prm) + +static unsigned int +mdio32_read(shbde_mdio_ctrl_t *smc, unsigned int offset) +{ + if (!smc || !smc->io32_read) { + return 0; + } + return smc->io32_read(smc->shbde, smc->regs, smc->base_addr + offset); +} + +static void +mdio32_write(shbde_mdio_ctrl_t *smc, unsigned int offset, unsigned int data) +{ + if (!smc || !smc->io32_read) { + return; + } + smc->io32_write(smc->shbde, smc->regs, smc->base_addr + offset, data); +} + +static void +wait_usec(shbde_mdio_ctrl_t *smc, int usec) +{ + shbde_hal_t *shbde = smc->shbde; + + if (shbde && shbde->usleep) { + shbde->usleep(usec); + } else { + int idx; + volatile int count; + for (idx = 0; idx < usec; idx++) { + for (count = 0; count < 100; count++); + } + } +} + +static int +iproc_mdio_wait_for_busy(shbde_mdio_ctrl_t *smc) +{ + int mii_busy; + unsigned int reg_val; + int count = 1000; + + /* Wait until MII is not busy */ + do { + reg_val = mdio32_read(smc, MII_MGMT_CTRL); + mii_busy = REG_FIELD_GET(MII_MGMT_CTRLr, BSYf, reg_val); + if (!mii_busy) { + break; + } + wait_usec(smc, 10); + count --; + } while (count > 0); + + return mii_busy; +} + +int +shbde_iproc_mdio_init(shbde_mdio_ctrl_t *smc) +{ + shbde_hal_t *shbde = smc->shbde; + unsigned int reg_val = 0; + + /* Enable the iProc internal MDIO interface */ + REG_FIELD_SET(MII_MGMT_CTRLr, MDCDIVf, reg_val, 0x7f); + mdio32_write(smc, MII_MGMT_CTRL, reg_val); + + if (shbde && !shbde->usleep) { + LOG_DBG(shbde, "shbde_mdio: no registration of usleep vector", 0); + } + + wait_usec(smc, 100); + + return 0; +} + +int +shbde_iproc_mdio_read(shbde_mdio_ctrl_t *smc, unsigned int phy_addr, + unsigned int reg, unsigned int *val) +{ + unsigned int reg_val = 0; + + REG_FIELD_SET(MII_MGMT_CMD_DATAr, SBf, reg_val, 0x1); + REG_FIELD_SET(MII_MGMT_CMD_DATAr, TAf, reg_val, 0x2); + REG_FIELD_SET(MII_MGMT_CMD_DATAr, OPf, reg_val, 0x2); + REG_FIELD_SET(MII_MGMT_CMD_DATAr, PAf, reg_val, phy_addr); + REG_FIELD_SET(MII_MGMT_CMD_DATAr, RAf, reg_val, reg); + mdio32_write(smc, MII_MGMT_CMD_DATA, reg_val); + + if (iproc_mdio_wait_for_busy(smc)) { + *val = 0; + LOG_DBG(smc->shbde, "shbde_iproc_mdio_read busy", reg); + return -1; + } + + reg_val = mdio32_read(smc, MII_MGMT_CMD_DATA); + *val = REG_FIELD_GET(MII_MGMT_CMD_DATAr, DATAf, reg_val); + + return 0; +} + +int +shbde_iproc_mdio_write(shbde_mdio_ctrl_t *smc, unsigned int phy_addr, + unsigned int reg, unsigned int val) +{ + unsigned int reg_val = 0; + + REG_FIELD_SET(MII_MGMT_CMD_DATAr, SBf, reg_val, 0x1); + REG_FIELD_SET(MII_MGMT_CMD_DATAr, TAf, reg_val, 0x2); + REG_FIELD_SET(MII_MGMT_CMD_DATAr, OPf, reg_val, 0x1); + REG_FIELD_SET(MII_MGMT_CMD_DATAr, PAf, reg_val, phy_addr); + REG_FIELD_SET(MII_MGMT_CMD_DATAr, RAf, reg_val, reg); + REG_FIELD_SET(MII_MGMT_CMD_DATAr, DATAf, reg_val, val); + mdio32_write(smc, MII_MGMT_CMD_DATA, reg_val); + + if (iproc_mdio_wait_for_busy(smc)) { + LOG_DBG(smc->shbde, "shbde_iproc_mdio_write busy", reg); + return -1; + } + + /* Wait for some time for the write to take effect */ + wait_usec(smc, 100); + + return 0; +} + diff --git a/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_pci.c b/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_pci.c new file mode 100644 index 000000000000..22408a84c3e6 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_pci.c @@ -0,0 +1,393 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: $ + * $Copyright: (c) 2014 Broadcom Corp. + * All Rights Reserved.$ + * + */ + +#include + +/* PCIe capabilities */ +#ifndef PCI_CAPABILITY_LIST +#define PCI_CAPABILITY_LIST 0x34 +#endif +#ifndef PCI_CAP_ID_EXP +#define PCI_CAP_ID_EXP 0x10 +#endif +#ifndef PCI_EXP_DEVCAP +#define PCI_EXP_DEVCAP 4 +#endif +#ifndef PCI_EXP_DEVCTL +#define PCI_EXP_DEVCTL 8 +#endif +#ifndef PCI_EXT_CAP_START +#define PCI_EXT_CAP_START 0x100 +#endif +#ifndef PCI_EXT_CAP_ID +#define PCI_EXT_CAP_ID(_hdr) (_hdr & 0x0000ffff) +#endif +#ifndef PCI_EXT_CAP_VER +#define PCI_EXT_CAP_VER(_hdr) ((_hdr >> 16) & 0xf) +#endif +#ifndef PCI_EXT_CAP_NEXT +#define PCI_EXT_CAP_NEXT(_hdr) ((_hdr >> 20) & 0xffc) +#endif +#ifndef PCI_EXT_CAP_ID_VNDR +#define PCI_EXT_CAP_ID_VNDR 0x0b +#endif + +#define LOG_OUT(_shbde, _lvl, _str, _prm) \ + if ((_shbde)->log_func) { \ + (_shbde)->log_func(_lvl, _str, _prm); \ + } +#define LOG_ERR(_shbde, _str, _prm) LOG_OUT(_shbde, SHBDE_ERR, _str, _prm) +#define LOG_WARN(_shbde, _str, _prm) LOG_OUT(_shbde, SHBDE_WARN, _str, _prm) +#define LOG_DBG(_shbde, _str, _prm) LOG_OUT(_shbde, SHBDE_DBG, _str, _prm) + +#ifndef NULL +#define NULL (void *)0 +#endif + +/* + * Warpper functions with null-pointer checks. + */ +static unsigned int +pcic16_read(shbde_hal_t *shbde, void *pci_dev, + unsigned int addr) +{ + if (!shbde || !shbde->pcic16_read) { + return 0; + } + return shbde->pcic16_read(pci_dev, addr); +} + +static void +pcic16_write(shbde_hal_t *shbde, void *pci_dev, + unsigned int addr, unsigned int data) +{ + if (!shbde || !shbde->pcic16_write) { + return; + } + shbde->pcic16_write(pci_dev, addr, data); +} + +static unsigned int +pcic32_read(shbde_hal_t *shbde, void *pci_dev, + unsigned int addr) +{ + if (!shbde || !shbde->pcic32_read) { + return 0; + } + return shbde->pcic32_read(pci_dev, addr); +} + +static void * +pci_parent_device_get(shbde_hal_t *shbde, void *pci_dev) +{ + if (!shbde || !shbde->pci_parent_device_get) { + return NULL; + } + return shbde->pci_parent_device_get(pci_dev); +} + +/* + * Function: + * shbde_pci_pcie_cap + * Purpose: + * Return offset of PCIe capabilities in PCI configuration space + * Parameters: + * shbde - pointer to initialized hardware abstraction module + * dev - PCI device handle (passed back to PCI HAL functions) + * Returns: + * PCI_CAP_ID_EXP offset in PCI configuration space if PCIe, otherwise 0 + */ +unsigned int +shbde_pci_pcie_cap(shbde_hal_t *shbde, void *pci_dev) +{ + unsigned int cap_base, rval; + + cap_base = pcic16_read(shbde, pci_dev, PCI_CAPABILITY_LIST); + while (cap_base) { + rval = pcic16_read(shbde, pci_dev, cap_base); + if ((rval & 0xff) == PCI_CAP_ID_EXP) { + break; + } + cap_base = (rval >> 8) & 0xff; + } + + return cap_base; +} + +/* + * Function: + * shbde_pci_is_pcie + * Purpose: + * Check if PCI device is PCIe device + * Parameters: + * shbde - pointer to initialized hardware abstraction module + * dev - PCI device handle (passed back to PCI HAL functions) + * Returns: + * 1 if PCIe, otherwise 0 + */ +int +shbde_pci_is_pcie(shbde_hal_t *shbde, void *pci_dev) +{ + return shbde_pci_pcie_cap(shbde, pci_dev) ? 1 : 0; +} + +/* + * Function: + * shbde_pci_is_iproc + * Purpose: + * Check if PCI device is iProc-based + * Parameters: + * shbde - pointer to initialized hardware abstraction module + * dev - PCI device handle (passed back to PCI HAL functions) + * cmic_bar - (OUT) PCI BAR which contains switch CMIC registers + * Returns: + * 1 if iProc-based, otherwise 0 + */ +int +shbde_pci_is_iproc(shbde_hal_t *shbde, void *pci_dev, int *cmic_bar) +{ + unsigned int cap_base, rval; + + if (!shbde_pci_is_pcie(shbde, pci_dev)) { + return 0; + } + + /* Look for PCIe vendor-specific extended capability (VSEC) */ + cap_base = PCI_EXT_CAP_START; + while (cap_base) { + rval = pcic32_read(shbde, pci_dev, cap_base); + if (rval == 0xffffffff) { + /* Assume PCI HW read error */ + return 0; + } + + if (PCI_EXT_CAP_ID(rval) == PCI_EXT_CAP_ID_VNDR) { + break; + } + cap_base = PCI_EXT_CAP_NEXT(rval); + } + if (cap_base) { + /* + * VSEC layout: + * + * 0x00: PCI Express Extended Capability Header + * 0x04: Vendor-Specific Header + * 0x08: Vendor-Specific Register 1 + * 0x0c: Vendor-Specific Register 2 + * ... + * 0x24: Vendor-Specific Register 8 + */ + /* 32'b // 31:12=0 Reserved; 11:08=CMIC BAR; 07:00=iProc Configuration ID */ + rval = pcic32_read(shbde, pci_dev, cap_base + 8); + LOG_DBG(shbde, "Found VSEC", rval); + + /* Determine PCI BAR of CMIC */ + *cmic_bar = 0; + if ((rval & 0x100) == 0x100) { + *cmic_bar = 2; + } + /* Assume iProc device */ + return 1; + } + + return 0; +} + +/* + * Function: + * shbde_pci_iproc_version_get + * Purpose: + * Get iproc, cmic versions and revisions + * Parameters: + * shbde - pointer to initialized hardware abstraction module + * dev - PCI device handle (passed back to PCI HAL functions) + * iproc_ver - (OUT) iProc version + * cmic_ver - (OUT) CMIC version + * cmic_rev - (OUT) CMIC revision + * Returns: + * 1 for no error, otherwise 0 + */ +int +shbde_pci_iproc_version_get(shbde_hal_t *shbde, void *pci_dev, + unsigned int *iproc_ver, + unsigned int *cmic_ver, + unsigned int *cmic_rev) +{ + unsigned int cap_base, rval; + + if (!shbde_pci_is_pcie(shbde, pci_dev)) { + return 0; + } + + /* Look for PCIe vendor-specific extended capability (VSEC) */ + cap_base = PCI_EXT_CAP_START; + while (cap_base) { + rval = pcic32_read(shbde, pci_dev, cap_base); + if (rval == 0xffffffff) { + /* Assume PCI HW read error */ + return 0; + } + + if (PCI_EXT_CAP_ID(rval) == PCI_EXT_CAP_ID_VNDR) { + break; + } + cap_base = PCI_EXT_CAP_NEXT(rval); + } + if (cap_base) { + /* + * VSEC layout: + * + * 0x00: PCI Express Extended Capability Header + * 0x04: Vendor-Specific Header + * 0x08: Vendor-Specific Register 1 + * 0x0c: Vendor-Specific Register 2 + * ... + * 0x24: Vendor-Specific Register 8 + */ + + /* Read PCIe Vendor Specific Register 1 */ + /* VENODR REG FORMAT + * [7:0] iProc Rev = 8'h0E (for P14) + * [11:8] CMIC BAR = 4'h1 (BAR64-1) + * [15:12] CMIC Version = 4'h4 + * [19:16] CMIC Rev = 4'h1 + * [22:20] SBUS Version = 4'h4 + */ + + rval = pcic32_read(shbde, pci_dev, cap_base + 8); + LOG_DBG(shbde, "Found VSEC", rval); + + /* Determine PCI BAR of CMIC */ + *iproc_ver = rval & 0xff; + *cmic_ver = (rval >> 12) & 0xf; + *cmic_rev = (rval >> 16) & 0xf; + return 1; + } + + return 0; +} + +/* + * Function: + * shbde_pci_max_payload_set + * Purpose: + * Set PCIe maximum payload + * Parameters: + * shbde - pointer to initialized hardware abstraction module + * dev - PCI device handle (passed back to PCI HAL functions) + * maxpayload - maximum payload (in byte) + * Returns: + * -1 if error, otherwise 0 + * Notes: + * If not PCIe device, set the PCI retry count to infinte instead. + */ +int +shbde_pci_max_payload_set(shbde_hal_t *shbde, void *pci_dev, int maxpayload) +{ + unsigned int cap_base, parent_cap_base; + unsigned int devcap, devctl, parent_devctl; + int max_val, max_cap, parent_max_val; + void *parent_pci_dev; + + cap_base = shbde_pci_pcie_cap(shbde, pci_dev); + + if (cap_base == 0) { + /* Not PCIe */ + return 0; + } + + /* Get current device control settings */ + devctl = pcic16_read(shbde, pci_dev, cap_base + PCI_EXP_DEVCTL); + + /* Get current max payload setting */ + max_val = (devctl >> 5) & 0x7; + + if (maxpayload) { + /* Get encoding from byte value */ + max_val = 0; + while ((1 << (max_val + 7)) < maxpayload) { + max_val++; + } + LOG_DBG(shbde, "Set max payload size", maxpayload); + LOG_DBG(shbde, "Set max payload val", max_val); + + /* Get max supported payload size */ + devcap = pcic16_read(shbde, pci_dev, cap_base + PCI_EXP_DEVCAP); + max_cap = (devcap & 0x7); + + /* Do not exceed device capabilities */ + if (max_val > max_cap) { + max_val = max_cap; + LOG_DBG(shbde, + "Payload size exceeds device capability", + maxpayload); + } + + /* Get currently set max payload size for the parent device + * in the PCI tree (if it exists). + */ + parent_pci_dev = pci_parent_device_get(shbde, pci_dev); + if (parent_pci_dev != NULL) { + parent_cap_base = shbde_pci_pcie_cap(shbde, parent_pci_dev); + parent_devctl = pcic16_read(shbde, + parent_pci_dev, + parent_cap_base + PCI_EXP_DEVCTL); + parent_max_val = (parent_devctl >> 5) & 0x7; + + /* Do not exceed current parent max payload setting (our device + * should have an MPS setting <= current parent MPS setting in + * the tree of PCIe devices). + */ + if (max_val > parent_max_val) { + max_val = parent_max_val; + LOG_DBG(shbde, + "Payload size exceeds current parent device setting", + maxpayload); + } + } + + /* Update max payload size */ + devctl &= ~(0x7 << 5); + devctl |= (max_val) << 5; + + /* Update max request size */ + devctl &= ~(0x7 << 12); + devctl |= (max_val << 12); + } + + /* Always disable relaxed ordering */ + devctl &= ~(1 << 4); + + /* Update device control settings */ + pcic16_write(shbde, pci_dev, cap_base + PCI_EXP_DEVCTL, devctl); + + /* Warn if non-default setting is used */ + if (max_val > 0) { + LOG_WARN(shbde, + "Selected payload size may not be supported by all " + "PCIe bridges by default.", + (1 << (max_val + 7))); + } + + return 0; +} diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/Makefile new file mode 100644 index 000000000000..37f35b2e27a5 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/Makefile @@ -0,0 +1,32 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.10 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# +# Makefile for SOC SAL support +# +LOCALDIR = systems/linux/kernel/modules + +include ${SDK}/make/Make.config + +subdirs=shared uk-proxy bcm-diag-full bcm-core bcm-net bcm-diag + +include ${SDK}/make/Make.subdirs + +include ${SDK}/make/Make.depend diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/Makefile new file mode 100644 index 000000000000..5459b399aa4b --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/Makefile @@ -0,0 +1,68 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.3 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# +LOCALDIR = systems/linux/kernel/modules/bcm-knet + +include ${SDK}/make/Make.config + +LIBS = $(LIBDIR)/libkern.a + +ifeq ($(kernel_version),2_4) +MODULE = $(LIBDIR)/linux-bcm-knet.o +else +KERNEL_MODULE_DIR = kernel_module + +THIS_MOD_NAME := linux-bcm-knet +MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o +KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko + +build: $(MODULE) $(KMODULE) +endif + +KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../../../../bde/linux/kernel/kernel_module/Module.symvers +ifeq (,$(findstring -DPROXY_SUPPORT=0,$(CFLAGS))) +KBUILD_EXTRA_SYMBOLS += ${BLDDIR}/../uk-proxy/kernel_module/Module.symvers +endif + +# BCM Network Device + +$(MODULE): $(BLDDIR)/.tree $(BOBJS) $(LIBS) + $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ +ifneq ($(kernel_version),2_4) +$(KMODULE): $(MODULE) + rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) + mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) + cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile + cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers + MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko +endif + +# Make.depend is before clean:: so that Make.depend's clean:: runs first. + +include ${SDK}/make/Make.depend + +clean:: + $(RM) $(BLDDIR)/version.c $(BLDDIR)/version.o + $(RM) $(BOBJS) $(MODULE) + +ifneq ($(kernel_version),2_4) +.PHONY: build +endif diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c new file mode 100644 index 000000000000..fe6fd53850cc --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c @@ -0,0 +1,6874 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: bcm-knet.c,v 1.90 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ + +/* + * This module implements a Linux network driver for Broadcom + * XGS switch devices. The driver simultaneously serves a + * number of vitual Linux network devices and a Tx/Rx API + * implemented in user space. + * + * Packets received from the switch device are sent to either + * a virtual Linux network device or the user mode Rx API + * based on a set of packet filters.susp + * + * Packets from the virtual Linux network devices and the user + * mode Tx API are multiplexed with priority given to the Tx API. + * + * A message-based IOCTL interface is used for managing packet + * filters and virtual Linux network interfaces. + * + * A virtual network interface can be configured to work in RCPU + * mode, which means that packets from the switch device will + * be encasulated with a RCPU header and a block of meta data + * that basically contains the core DCB information. Likewise, + * packets received from the Linux network stack are assumed to + * be RCPU encapsulated when going out on an interface in RCPU + * mode. + * + * The module implements basic Rx DMA rate control. The rate is + * specified in packets per second, and different Rx DMA channels + * can be configured to use different maximum packet rates. + * The packet rate can be configure as a module parameter, and + * it can also be changed dynamically through the proc file + * system (syntax is described in function header comment). + * + * To support multiple instance, each instance has its event queue. + * + * To support pci hot-plug in this module, the resource update + * should be handled when the PCI device is re-plugged. + * NOTE: the KNET detach should be invoked befere removing the + * device. + * + * For a list of supported module parameters, please see below. + */ + +#include /* Must be included first */ +#include +#include +#include + +#include +#include +#include +#include + + +MODULE_AUTHOR("Broadcom Corporation"); +MODULE_DESCRIPTION("Network Device Driver for Broadcom BCM TxRx API"); +MODULE_LICENSE("GPL"); + +static int debug; +LKM_MOD_PARAM(debug, "i", int, 0); +MODULE_PARM_DESC(debug, +"Debug level (default 0)"); + +static char *mac_addr = NULL; +LKM_MOD_PARAM(mac_addr, "s", charp, 0); +MODULE_PARM_DESC(mac_addr, +"Ethernet MAC address (default 02:10:18:xx:xx:xx)"); + +static int rx_buffer_size = 9216; +LKM_MOD_PARAM(rx_buffer_size, "i", int, 0); +MODULE_PARM_DESC(rx_buffer_size, +"Size of RX packet buffers (default 9216)"); + +static int default_mtu = 1500; +LKM_MOD_PARAM(default_mtu, "i", int, 0); +MODULE_PARM_DESC(default_mtu, +"Default MTU for KNET network interfaces (default 1500)"); + +static int rx_sync_retry = 1000; +LKM_MOD_PARAM(rx_sync_retry, "i", int, 0); +MODULE_PARM_DESC(rx_sync_retry, +"Retries if chain is incomplete on interrupt (default 10)"); + +static char *base_dev_name = NULL; +LKM_MOD_PARAM(base_dev_name, "s", charp, 0); +MODULE_PARM_DESC(base_dev_name, +"Base device name (default bcm0, bcm1, etc.)"); + +static int rcpu_mode = 0; +LKM_MOD_PARAM(rcpu_mode, "i", int, 0); +MODULE_PARM_DESC(rcpu_mode, +"Enable RCPU encapsulation (default 0)"); + +static char *rcpu_dmac = NULL; +LKM_MOD_PARAM(rcpu_dmac, "s", charp, 0); +MODULE_PARM_DESC(rcpu_dmac, +"RCPU destination MAC address (by default use L2 destination MAC address)"); + +static char *rcpu_smac = NULL; +LKM_MOD_PARAM(rcpu_smac, "s", charp, 0); +MODULE_PARM_DESC(rcpu_smac, +"RCPU source MAC address (by default use L2 source MAC address)"); + +static int rcpu_ethertype = 0xde08; +LKM_MOD_PARAM(rcpu_ethertype, "i", int, 0); +MODULE_PARM_DESC(rcpu_ethertype, +"RCPU EtherType (default DE08h)"); + +static int rcpu_signature = 0; +LKM_MOD_PARAM(rcpu_signature, "i", int, 0); +MODULE_PARM_DESC(rcpu_signature, +"RCPU Signature (default is PCI device ID)"); + +static int rcpu_vlan = 1; +LKM_MOD_PARAM(rcpu_vlan, "i", int, 0); +MODULE_PARM_DESC(rcpu_vlan, +"RCPU VLAN ID (default 1)"); + +static int use_rx_skb = 0; +LKM_MOD_PARAM(use_rx_skb, "i", int, 0); +MODULE_PARM_DESC(use_rx_skb, +"Use socket buffers for receive operation (default 0)"); + +static int num_rx_prio = 1; +LKM_MOD_PARAM(num_rx_prio, "i", int, 0); +MODULE_PARM_DESC(num_rx_prio, +"Number of filter priorities per Rx DMA channel"); + +static int rx_rate[4] = { 100000, 100000, 100000, 0 }; +LKM_MOD_PARAM_ARRAY(rx_rate, "1-4i", int, NULL, 0); +MODULE_PARM_DESC(rx_rate, +"Rx rate in packets per second (default 100000)"); + +static int rx_burst[4] = { 0, 0, 0, 0 }; +LKM_MOD_PARAM_ARRAY(rx_burst, "1-4i", int, NULL, 0); +MODULE_PARM_DESC(rx_burst, +"Rx rate burst maximum in packets (default rx_rate/10)"); + +static int check_rcpu_signature = 0; +LKM_MOD_PARAM(check_rcpu_signature, "i", int, 0); +MODULE_PARM_DESC(check_rcpu_signature, +"Check RCPU Signature for Tx packets from RCPU interfaces"); + +static int basedev_suspend = 0; +LKM_MOD_PARAM(basedev_suspend, "i", int, 0); +MODULE_PARM_DESC(basedev_suspend, +"Pause traffic till base device is up (enabled by default in NAPI mode)"); + +static int ftmh_lb_key_ext = 0; +LKM_MOD_PARAM(ftmh_lb_key_ext, "i", int, 0); +MODULE_PARM_DESC(ftmh_lb_key_ext, +"FTMH LB-Key Extension header is present (default 0)"); + +static int ftmh_stacking_ext = 0; +LKM_MOD_PARAM(ftmh_stacking_ext, "i", int, 0); +MODULE_PARM_DESC(ftmh_stacking_ext, +"FTMH Stacking Extension header is present (default 0)"); + +/* Debug levels */ +#define DBG_LVL_VERB 0x1 +#define DBG_LVL_DCB 0x2 +#define DBG_LVL_PKT 0x4 +#define DBG_LVL_SKB 0x8 +#define DBG_LVL_CMD 0x10 +#define DBG_LVL_EVT 0x20 +#define DBG_LVL_IRQ 0x40 +#define DBG_LVL_NAPI 0x80 +#define DBG_LVL_PDMP 0x100 +#define DBG_LVL_FLTR 0x200 +#define DBG_LVL_KCOM 0x400 +#define DBG_LVL_RCPU 0x800 +#define DBG_LVL_WARN 0x1000 +#define DBG_LVL_NDEV 0x2000 +#define DBG_LVL_INST 0x4000 +/* Level to output Dune internal headers Parsing */ +#define DBG_LVL_DUNE 0x8000 +#define DBG_LVL_DCB_TX 0x10000 +#define DBG_LVL_DCB_RX 0x20000 +#define DBG_LVL_PDMP_TX 0x40000 +#define DBG_LVL_PDMP_RX 0x80000 + +#define DBG_VERB(_s) do { if (debug & DBG_LVL_VERB) gprintk _s; } while (0) +#define DBG_PKT(_s) do { if (debug & DBG_LVL_PKT) gprintk _s; } while (0) +#define DBG_SKB(_s) do { if (debug & DBG_LVL_SKB) gprintk _s; } while (0) +#define DBG_CMD(_s) do { if (debug & DBG_LVL_CMD) gprintk _s; } while (0) +#define DBG_EVT(_s) do { if (debug & DBG_LVL_EVT) gprintk _s; } while (0) +#define DBG_IRQ(_s) do { if (debug & DBG_LVL_IRQ) gprintk _s; } while (0) +#define DBG_NAPI(_s) do { if (debug & DBG_LVL_NAPI) gprintk _s; } while (0) +#define DBG_PDMP(_s) do { if (debug & DBG_LVL_PDMP) gprintk _s; } while (0) +#define DBG_FLTR(_s) do { if (debug & DBG_LVL_FLTR) gprintk _s; } while (0) +#define DBG_KCOM(_s) do { if (debug & DBG_LVL_KCOM) gprintk _s; } while (0) +#define DBG_RCPU(_s) do { if (debug & DBG_LVL_RCPU) gprintk _s; } while (0) +#define DBG_WARN(_s) do { if (debug & DBG_LVL_WARN) gprintk _s; } while (0) +#define DBG_NDEV(_s) do { if (debug & DBG_LVL_NDEV) gprintk _s; } while (0) +#define DBG_INST(_s) do { if (debug & DBG_LVL_INST) gprintk _s; } while (0) +#define DBG_DUNE(_s) do { if (debug & DBG_LVL_DUNE) gprintk _s; } while (0) +#define DBG_DCB_TX(_s) do { if (debug & (DBG_LVL_DCB|DBG_LVL_DCB_TX)) \ + gprintk _s; } while (0) +#define DBG_DCB_RX(_s) do { if (debug & (DBG_LVL_DCB|DBG_LVL_DCB_RX)) \ + gprintk _s; } while (0) +#define DBG_DCB(_s) do { if (debug & (DBG_LVL_DCB|DBG_LVL_DCB_TX| \ + DBG_LVL_DCB_RX)) \ + gprintk _s; } while (0) + + +/* This flag is used to indicate if debugging packet function is open or closed */ +static int dbg_pkt_enable = 0; + +/* Module Information */ +#define MODULE_MAJOR 122 +#define MODULE_NAME "linux-bcm-knet" + +#ifndef NAPI_SUPPORT +#define NAPI_SUPPORT 1 +#endif + +#if NAPI_SUPPORT + +static int use_napi = 0; +LKM_MOD_PARAM(use_napi, "i", int, 0); +MODULE_PARM_DESC(use_napi, +"Use NAPI interface (default 0)"); + +static int napi_weight = 64; +LKM_MOD_PARAM(napi_weight, "i", int, 0); +MODULE_PARM_DESC(napi_weight, +"Weight of NAPI interfaces (default 64)"); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) +#define bkn_napi_enable(_dev, _napi) netif_poll_enable(_dev) +#define bkn_napi_disable(_dev, _napi) netif_poll_disable(_dev) +#define bkn_napi_schedule(_dev, _napi) netif_rx_schedule(_dev) +#define bkn_napi_schedule_prep(_dev, _napi) netif_rx_schedule_prep(_dev) +#define __bkn_napi_schedule(_dev, _napi) __netif_rx_schedule(_dev) +#define bkn_napi_complete(_dev, _napi) netif_rx_complete(_dev) +#else +#define bkn_napi_enable(_dev, _napi) napi_enable(_napi) +#define bkn_napi_disable(_dev, _napi) napi_disable(_napi) +#define bkn_napi_schedule(_dev, _napi) napi_schedule(_napi) +#define bkn_napi_schedule_prep(_dev, _napi) napi_schedule_prep(_napi) +#define __bkn_napi_schedule(_dev, _napi) __napi_schedule(_napi) +#define bkn_napi_complete(_dev, _napi) napi_complete(_napi) +#endif + +#else + +static int use_napi = 0; +static int napi_weight = 0; + +#define bkn_napi_enable(_dev, _napi) +#define bkn_napi_disable(_dev, _napi) +#define bkn_napi_schedule(_dev, _napi) +#define bkn_napi_schedule_prep(_dev, _napi) (0) +#define __bkn_napi_schedule(_dev, _napi) +#define bkn_napi_complete(_dev, _napi) + +#endif + +/* + * If proxy support is compiled in the module will attempt to use + * the user/kernel message service provided by the linux-uk-proxy + * kernel module, otherwise device IOCTL will be used. + */ +#ifndef PROXY_SUPPORT +#define PROXY_SUPPORT 0 +#endif + +#if PROXY_SUPPORT + +#include + +static int use_proxy = 1; +LKM_MOD_PARAM(use_proxy, "i", int, 0); +MODULE_PARM_DESC(use_proxy, +"Use Linux User/Kernel proxy (default 1)"); + +#define PROXY_SERVICE_CREATE(_s,_q,_f) linux_uk_proxy_service_create(_s,_q,_f) +#define PROXY_SERVICE_DESTROY(_s) linux_uk_proxy_service_destroy(_s); +#define PROXY_SEND(_s,_m,_l) linux_uk_proxy_send(_s,_m,_l) +#define PROXY_RECV(_s,_m,_l) linux_uk_proxy_recv(_s,_m,_l) + +#else + +static int use_proxy = 0; + +#define PROXY_SERVICE_CREATE(_s,_q,_f) +#define PROXY_SERVICE_DESTROY(_s) +#define PROXY_SEND(_s,_m,_l) +#define PROXY_RECV(_s,_m,_l) (-1) + +#endif + +/* Compatibility */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) +#define skb_copy_to_linear_data(_skb, _pkt, _len) \ + eth_copy_and_sum(_skb, _pkt, _len, 0) +struct napi_struct { int not_used; }; +#define netif_napi_add(_dev, _napi, _poll, _weight) do { \ + (_dev)->poll = _poll; \ + (_dev)->weight = _weight; \ +} while(0) +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) +#define SKB_PADTO(_skb,_len) (((_skb = skb_padto(_skb,_len)) == NULL) ? -1 : 0) +#else +#define SKB_PADTO(_skb,_len) skb_padto(_skb,_len) +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)) +#define skb_header_cloned(_skb) \ + skb_cloned(_skb) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27) +static inline void *netdev_priv(struct net_device *dev) +{ + return dev->priv; +} +#endif /* KERNEL_VERSION(2,4,27) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) +/* Special check for MontaVista 2.4.20 MIPS */ +#if !(defined(MAX_USER_RT_PRIO) && defined(CONFIG_MIPS)) +static inline void free_netdev(struct net_device *dev) +{ + kfree(dev); +} +#endif +static inline void netif_poll_disable(struct net_device *dev) +{ + while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) { + /* No hurry. */ + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(1); + } +} +static inline void netif_poll_enable(struct net_device *dev) +{ + clear_bit(__LINK_STATE_RX_SCHED, &dev->state); +} +#endif /* KERNEL_VERSION(2,4,23) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,21) +static struct sk_buff *skb_pad(struct sk_buff *skb, int pad) +{ + struct sk_buff *nskb; + + /* If the skbuff is non linear tailroom is always zero.. */ + if(skb_tailroom(skb) >= pad) + { + memset(skb->data+skb->len, 0, pad); + return skb; + } + + nskb = skb_copy_expand(skb, skb_headroom(skb), skb_tailroom(skb) + pad, GFP_ATOMIC); + kfree_skb(skb); + if(nskb) + memset(nskb->data+nskb->len, 0, pad); + return nskb; +} +static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len) +{ + unsigned int size = skb->len; + if(likely(size >= len)) + return skb; + return skb_pad(skb, len-size); +} +#endif /* KERNEL_VERSION(2,4,21) */ + +#ifdef LINUX_BDE_DMA_DEVICE_SUPPORT +#define DMA_DEV device +#define DMA_FROMDEV DMA_FROM_DEVICE +#define DMA_TODEV DMA_TO_DEVICE +#define DMA_MAP_SINGLE(d,p,s,r) dma_map_single(d,p,s,r) +#define DMA_UNMAP_SINGLE(d,a,s,r) dma_unmap_single(d,a,s,r) +#define DMA_ALLOC_COHERENT(d,s,h) dma_alloc_coherent(d,s,h,GFP_ATOMIC|GFP_DMA32) +#define DMA_FREE_COHERENT(d,s,a,h) dma_free_coherent(d,s,a,h) +#else +#define DMA_DEV pci_dev +#define DMA_FROMDEV PCI_DMA_FROMDEVICE +#define DMA_TODEV PCI_DMA_TODEVICE +#define DMA_MAP_SINGLE(d,p,s,r) pci_map_single(d,p,s,r) +#define DMA_UNMAP_SINGLE(d,a,s,r) pci_unmap_single(d,a,s,r) +#define DMA_ALLOC_COHERENT(d,s,h) pci_alloc_consistent(d,s,h) +#define DMA_FREE_COHERENT(d,s,a,h) pci_free_consistent(d,s,a,h) +#endif + +/* RCPU operations */ +#define RCPU_OPCODE_RX 0x10 +#define RCPU_OPCODE_TX 0x20 + +/* RCPU flags */ +#define RCPU_F_MODHDR 0x4 + +/* RCPU encapsulation */ +#define RCPU_HDR_SIZE 32 +#define RCPU_TX_META_SIZE 32 +#define RCPU_TX_ENCAP_SIZE (RCPU_HDR_SIZE + RCPU_TX_META_SIZE) +#define RCPU_RX_META_SIZE 64 +#define RCPU_RX_ENCAP_SIZE (RCPU_HDR_SIZE + RCPU_RX_META_SIZE) + +static volatile int module_initialized; + +static ibde_t *kernel_bde = NULL; + +/* Descriptor info */ +typedef struct bkn_desc_info_s { + uint32_t *dcb_mem; + dma_addr_t dcb_dma; + struct sk_buff *skb; + dma_addr_t skb_dma; + uint32_t dma_size; +} bkn_desc_info_t; + +/* DCB chain info */ +typedef struct bkn_dcb_chain_s { + struct list_head list; + int dcb_cnt; + int dcb_cur; + uint32_t *dcb_mem; + dma_addr_t dcb_dma; +} bkn_dcb_chain_t; + +#define MAX_TX_DCBS 32 +#define MAX_RX_DCBS 32 + +#define NUM_DMA_CHAN 4 +#define NUM_RX_CHAN 3 +#define API_RX_CHAN 0 + +/* Device control info */ +typedef struct bkn_switch_info_s { + struct list_head list; + struct list_head ndev_list; /* Associated virtual Ethernet interfaces */ + struct net_device **ndevs; /* Indexed array of ndev_list */ + int ndev_max; /* Size of indexed array */ + struct list_head rxpf_list; /* Associated Rx packet filters */ + volatile void *base_addr; /* Base address for PCI register access */ + struct DMA_DEV *dma_dev; /* Required for DMA memory control */ + struct pci_dev *pdev; /* Required for DMA memory control */ + struct net_device *dev; /* Base network device */ + struct napi_struct napi; /* New NAPI */ + struct timer_list timer; /* Retry/resource timer */ + int timer_queued; /* Flag indicating queued timer function */ + uint32_t timer_runs; /* Timer function runs (debug only) */ + struct timer_list rxtick; /* Rx rate control timer */ + uint32_t rxticks_per_sec; /* Rx rate control update frequency */ + uint32_t rxtick_jiffies; /* Time between updates (in jiffies) */ + uint32_t rxticks; /* Rx rate control debug counter */ + uint32_t interrupts; /* Total number of interrupts */ + spinlock_t lock; /* Main lock for device */ + int dev_no; /* Device number (from BDE) */ + int cpu_no; /* Cpu number. 1 for iHost(AXI),0 for others */ + int dcb_type; /* DCB type */ + int dcb_wsize; /* DCB size (in 32-bit words) */ + uint32_t cmic_type; /* CMIC type (CMICe or CMICm) */ + uint32_t irq_mask; /* Active IRQs for DMA control */ + uint32_t napi_poll_mode; /* NAPI is in polling mode */ + uint32_t napi_not_done; /* NAPI poll did not process all packets */ + uint32_t napi_poll_again; /* Used if DCB chain is restarted */ + uint32_t tx_yield; /* Tx schedule for Continuous DMA and Non-NAPI mode */ + void *dcb_mem; /* Logical pointer to DCB memory */ + dma_addr_t dcb_dma; /* Physical bus address for DCB memory */ + int dcb_mem_size; /* Total size of allocated DCB memory */ + uint32_t dma_events; /* DMA events pending for BCM API */ + uint32_t rcpu_sig; /* RCPU signature */ + dma_addr_t halt_addr[NUM_DMA_CHAN]; /* DMA halt address */ + uint32_t cdma_channels; /* Active channels for Continuous DMA mode */ + uint32_t inst_id; /* Instance id of this device */ + int evt_idx; /* Event queue index for this device*/ + int basedev_suspended; /* Base device suspended */ + struct { + bkn_desc_info_t desc[MAX_TX_DCBS+1]; + int free; /* Number of free Tx DCBs */ + int cur; /* Index of current Tx DCB */ + int dirty; /* Index of next Tx DCB to complete */ + int api_active; /* BCM Tx API is in progress */ + int suspends; /* Calls to netif_stop_queue (debug only) */ + struct list_head api_dcb_list; /* Tx DCB chains from BCM Tx API */ + bkn_dcb_chain_t *api_dcb_chain; /* Current Tx DCB chain */ + bkn_dcb_chain_t *api_dcb_chain_end; /* Tx DCB chain end */ + uint32_t pkts; /* Tx packet counter */ + uint32_t pkts_d_no_skb; /* Tx drop - skb allocation failed */ + uint32_t pkts_d_rcpu_encap; /* Tx drop - bad RCPU encapsulation */ + uint32_t pkts_d_rcpu_sig; /* Tx drop - bad RCPU signature */ + uint32_t pkts_d_rcpu_meta; /* Tx drop - bad RCPU meta data */ + uint32_t pkts_d_pad_fail; /* Tx drop - pad to minimum size failed */ + uint32_t pkts_d_dma_resrc; /* Tx drop - no DMA resources */ + uint32_t pkts_d_callback; /* Tx drop - consumed by call-back */ + uint32_t pkts_d_no_link; /* Tx drop - software link down */ + uint32_t pkts_d_over_limit; /* Tx drop - length is out of range */ + } tx; + struct { + bkn_desc_info_t desc[MAX_RX_DCBS+1]; + int free; /* Number of free Rx DCBs */ + int cur; /* Index of current Rx DCB */ + int dirty; /* Index of next Rx DCB to complete */ + int running; /* Rx DMA is active */ + int api_active; /* BCM Rx API is active */ + int chain_complete; /* All DCBs in chain processed */ + int sync_err; /* Chain done with incomplete DCBs (debug) */ + int sync_retry; /* Total retry times for sync error (debug) */ + int sync_maxloop; /* Max loop times once in recovering sync (debug) */ + int use_rx_skb; /* Use SKBs for DMA */ + uint32_t rate_max; /* Rx rate in packets/sec */ + uint32_t burst_max; /* Rx burst size in number of packets */ + uint32_t tokens; /* Tokens for Rx rate control */ + uint32_t rate; /* Current packet rate */ + unsigned long tok_jif; /* Jiffies at last token update */ + unsigned long rate_jif; /* Jiffies at last rate update */ + struct list_head api_dcb_list; /* Rx DCB chains from BCM Rx API */ + bkn_dcb_chain_t *api_dcb_chain; /* Current Rx DCB chain */ + bkn_dcb_chain_t *api_dcb_chain_end; /* Rx DCB chain end */ + uint32_t pkts; /* Rx packet counter */ + uint32_t pkts_ref; /* Rx packet count for rate calculation */ + uint32_t pkts_f_api; /* Rx packets filtered to API */ + uint32_t pkts_f_netif; /* Rx packets filtered to net interface */ + uint32_t pkts_m_api; /* Rx packets mirrored to API */ + uint32_t pkts_m_netif; /* Rx packets mirrored to net interface */ + uint32_t pkts_d_no_skb; /* Rx drop - skb allocation failed */ + uint32_t pkts_d_no_match; /* Rx drop - no matching filters */ + uint32_t pkts_d_unkn_netif; /* Rx drop - unknown net interface ID */ + uint32_t pkts_d_unkn_dest; /* Rx drop - unknown destination type */ + uint32_t pkts_d_callback; /* Rx drop - consumed by call-back */ + uint32_t pkts_d_no_link; /* Rx drop - software link down */ + uint32_t pkts_d_no_api_buf; /* Rx drop - no API buffers */ + } rx[NUM_RX_CHAN]; +} bkn_switch_info_t; + +#define BKN_DNX_HDR_MAX_SIZE 40 +/* FTMH */ +#define BKN_DNX_FTMH_SIZE_BYTE 9 +#define BKN_DNX_FTMH_LB_EXT_SIZE_BYTE 1 +#define BKN_DNX_FTMH_STACKING_SIZE_BYTE 2 +#define BKN_DNX_FTMH_DEST_EXT_SIZE_BYTE 2 +#define BKN_DNX_FTMH_LB_EXT_SIZE_BYTE 1 +#define BKN_DNX_FTMH_PKT_SIZE_MSB 0 +#define BKN_DNX_FTMH_PKT_SIZE_NOF_BITS 14 +#define BKN_DNX_FTMH_TC_MSB 14 +#define BKN_DNX_FTMH_TC_NOF_BITS 3 +#define BKN_DNX_FTMH_SRC_SYS_PORT_MSB 17 +#define BKN_DNX_FTMH_SRC_SYS_PORT_NOF_BITS 16 +#define BKN_DNX_FTMH_EXT_DSP_EXIST_MSB 68 +#define BKN_DNX_FTMH_EXT_DSP_EXIST_NOF_BITS 1 +#define BKN_DNX_FTMH_EXT_MSB 45 +#define BKN_DNX_FTMH_EXT_NOF_BITS 2 +#define BKN_DNX_FTMH_FIRST_EXT_MSB 72 +#define BKN_DNX_FTMH_ACTION_TYPE_MSB 43 +#define BKN_DNX_FTMH_ACTION_TYPE_NOF_BITS 2 +#define BKN_DNX_FTMH_PPH_TYPE_MSB 45 +#define BKN_DNX_FTMH_PPH_TYPE_NOF_BITS 2 +/* PPH */ +#define BKN_DNX_PPH_SIZE_BYTE 7 +#define BKN_DNX_PPH_EEI_EXTENSION_PRESENT_MSB 0 +#define BKN_DNX_PPH_EEI_EXTENSION_PRESENT_NOF_BITS 1 +#define BKN_DNX_PPH_LEARN_EXENSION_PRESENT_MSB 1 +#define BKN_DNX_PPH_LEARN_EXENSION_PRESENT_NOF_BITS 1 +#define BKN_DNX_PPH_FHEI_SIZE_MSB 2 +#define BKN_DNX_PPH_FHEI_SIZE_NOF_BITS 2 +#define BKN_DNX_PPH_FORWARD_CODE_MSB 4 +#define BKN_DNX_PPH_FORWARD_CODE_NOF_BITS 4 +#define BKN_DNX_PPH_VSI_MSB 22 +#define BKN_DNX_PPH_VSI_NOF_BITS 16 +/* FHEI TRAP/SNOOP 3B */ +#define BKN_DNX_PPH_FHEI_3B_SIZE_BYTE 3 +#define BKN_DNX_PPH_FHEI_5B_SIZE_BYTE 5 +#define BKN_DNX_PPH_FHEI_8B_SIZE_BYTE 8 +#define BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_QUALIFIER_MSB 0 +#define BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_QUALIFIER_NOF_BITS 16 +#define BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_MSB 16 +#define BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_NOF_BITS 8 +/* PPH extension */ +#define BKN_DNX_PPH_EXPLICIT_EDITING_INFOMATION_EXTENSION_SIZE_BYTE 3 +#define BKN_DNX_PPH_LEARN_EXTENSION_SIZE_BYTE 5 + + +/* ftmh action type. */ +typedef enum bkn_dnx_ftmh_action_type_e { + BKN_DNX_FTMH_ACTION_TYPE_FORWARD = 0, /* TM action is forward */ + BKN_DNX_FTMH_ACTION_TYPE_SNOOP = 1, /* TM action is snoop */ + BKN_DNX_FTMH_ACTION_TYPE_INBOUND_MIRROR = 2, /* TM action is inbound mirror. */ + BKN_DNX_FTMH_ACTION_TYPE_OUTBOUND_MIRROR = 3 /* TM action is outbound mirror. */ +}bkn_dnx_ftmh_action_type_t; + +/* ftmh dest extension. */ +typedef struct bkn_dnx_ftmh_dest_extension_s { + uint8 valid; /* Set if the extension is present */ + uint32_t dst_sys_port; /* Destination System Port */ +} bkn_dnx_ftmh_dest_extension_t; + +/* dnx packet */ +typedef struct bkn_pkt_dnx_s { + uint32_t ntwrk_header_ptr; + struct { + uint32_t packet_size; /* Packet size in bytes */ + uint32_t action_type; /* Indicates if the copy is one of the Forward Snoop or Mirror packet copies */ + uint32_t pph_type; + uint32_t prio; /* Traffic class */ + uint32_t src_sys_port; /* Source System port*/ + } ftmh; + struct { + uint32_t vsi; + uint32_t trap_qualifier; /* RAW Data */ + uint32_t trap_id; /* RAW Data */ + } internal; +} bkn_dnx_packet_info; + + +#define PREV_IDX(_cur, _max) (((_cur) == 0) ? (_max) - 1 : (_cur) - 1) + +#if defined(CMIC_SOFT_BYTE_SWAP) + +#define CMIC_SWAP32(_x) ((((_x) & 0xff000000) >> 24) \ + | (((_x) & 0x00ff0000) >> 8) \ + | (((_x) & 0x0000ff00) << 8) \ + | (((_x) & 0x000000ff) << 24)) + +#define DEV_READ32(_d, _a, _p) \ + do { \ + uint32_t _data; \ + _data = (((volatile uint32_t *)(_d)->base_addr)[(_a)/4]); \ + *(_p) = CMIC_SWAP32(_data); \ + } while(0) + +#define DEV_WRITE32(_d, _a, _v) \ + do { \ + uint32_t _data = CMIC_SWAP32(_v); \ + ((volatile uint32_t *)(_d)->base_addr)[(_a)/4] = (_data); \ + } while(0) + +#else + +#define DEV_READ32(_d, _a, _p) \ + do { \ + *(_p) = (((volatile uint32_t *)(_d)->base_addr)[(_a)/4]); \ + } while(0) + +#define DEV_WRITE32(_d, _a, _v) \ + do { \ + ((volatile uint32_t *)(_d)->base_addr)[(_a)/4] = (_v); \ + } while(0) + +#endif /* defined(CMIC_SOFT_BYTE_SWAP) */ + +#define MEMORY_BARRIER mb() + +/* Default random MAC address has Broadcom OUI with local admin bit set */ +static u8 bkn_dev_mac[6] = { 0x02, 0x10, 0x18, 0x00, 0x00, 0x00 }; + +static u8 bkn_rcpu_dmac[6]; +static u8 bkn_rcpu_smac[6]; + +/* Driver Proc Entry root */ +static struct proc_dir_entry *bkn_proc_root = NULL; + +typedef struct bkn_priv_s { + struct list_head list; + struct net_device_stats stats; + struct net_device *dev; + bkn_switch_info_t *sinfo; + int id; + int type; + int port; + uint8_t itmh[4]; + int qnum; + uint32_t vlan; + uint32_t flags; + uint32_t cb_user_data; +} bkn_priv_t; + +typedef struct bkn_filter_s { + struct list_head list; + int dev_no; + unsigned long hits; + kcom_filter_t kf; +} bkn_filter_t; + + +/* + * Multiple instance support in KNET + */ +static int _bkn_multi_inst = 0; +typedef struct { + wait_queue_head_t evt_wq; + int evt_wq_put; + int evt_wq_get; + uint32_t inst_id; +} bkn_evt_resource_t; + +static bkn_evt_resource_t _bkn_evt[LINUX_BDE_MAX_DEVICES]; + +static int bkn_knet_dev_init(int d); +static int bkn_knet_dev_reinit(int d); + +/* IOCTL debug counters */ +static int ioctl_cmd; +static int ioctl_evt; + +/* Switch devices */ +LIST_HEAD(_sinfo_list); + +/* Reallocation chunk size for netif array */ +#define NDEVS_CHUNK 64 + +/* User call-backs */ +static knet_skb_cb_f knet_rx_cb = NULL; +static knet_skb_cb_f knet_tx_cb = NULL; +static knet_filter_cb_f knet_filter_cb = NULL; + +/* + * Thread management + */ + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)) +/* + * Old style using kernel_thread() + */ +typedef struct { + const char * name; + volatile int pid; + volatile int run; + struct completion completion; + int state; +} bkn_thread_ctrl_t; + +static int +bkn_thread_start(bkn_thread_ctrl_t *tc, const char *name, + int (*threadfn)(void *)) +{ + if (name == NULL) { + return -1; + } + tc->name = name; + tc->pid = kernel_thread(threadfn, tc, 0); + if (tc->pid < 0) { + tc->pid = 0; + return -1; + } + tc->run = 1; + init_completion(&tc->completion); + return 0; +} + +static int +bkn_thread_stop(bkn_thread_ctrl_t *tc) +{ + if (tc->pid == 0) { + return 0; + } + tc->run = 0; + kill_proc(tc->pid, SIGTERM, 1); + wait_for_completion(&tc->completion); + return 0; +} + +static int +bkn_thread_should_stop(bkn_thread_ctrl_t *tc) +{ + if (tc->run) { + return 0; + } + tc->pid = 0; + return 1; +} + +static void +bkn_thread_boot(bkn_thread_ctrl_t *tc) +{ + siginitsetinv(¤t->blocked, sigmask(SIGTERM) | sigmask(SIGKILL)); +} + +static void +bkn_thread_exit(bkn_thread_ctrl_t *tc) +{ + complete_and_exit(&tc->completion, 0); +} + +static void +bkn_sleep(int clicks) +{ + wait_queue_head_t wq; + + init_waitqueue_head(&wq); + sleep_on_timeout(&wq, clicks); +} +#else +/* + * New style using kthread API + */ +#include +typedef struct { + const char * name; + struct task_struct *task; + int state; +} bkn_thread_ctrl_t; + +static int +bkn_thread_start(bkn_thread_ctrl_t *tc, const char *name, + int (*threadfn)(void *)) +{ + if (name == NULL) { + return -1; + } + tc->name = name; + tc->task = kthread_run(threadfn, tc, name); + if (IS_ERR(tc->task)) { + tc->task = NULL; + return -1; + } + return 0; +} + +static int +bkn_thread_stop(bkn_thread_ctrl_t *tc) +{ + if (tc->task == NULL) { + return 0; + } + send_sig(SIGTERM, tc->task, 0); + return kthread_stop(tc->task); +} + +static int +bkn_thread_should_stop(bkn_thread_ctrl_t *tc) +{ + return kthread_should_stop(); +} + +static void +bkn_thread_boot(bkn_thread_ctrl_t *tc) +{ + allow_signal(SIGTERM); + allow_signal(SIGKILL); +} + +static void +bkn_thread_exit(bkn_thread_ctrl_t *tc) +{ +} + +static void +bkn_sleep(int clicks) +{ + wait_queue_head_t wq; + + init_waitqueue_head(&wq); + wait_event_timeout(wq, 0, clicks); +} +#endif + +static bkn_thread_ctrl_t bkn_cmd_ctrl; +static bkn_thread_ctrl_t bkn_evt_ctrl; + +/* + * On XGS devices bit 15 fo the Transferred Bytes field in + * the DCBs is used to indicate that kernel processing is + * complete. Using this bit reduces the theoretically maximum + * supported packet size from 64K to 32K, but this is still + * adequate for 16K jumbo packets. + */ +#define SOC_DCB_KNET_DONE 0x8000 +#define SOC_DCB_KNET_COUNT_MASK 0x7fff +#define SOC_DCB_META_OFFSET 2 + +/* Default channel configuration */ +#define XGS_DMA_TX_CHAN 0 +#define XGS_DMA_RX_CHAN 1 + +/* CMIC registers */ +#define CMIC_DMA_CTRLr 0x00000100 +#define CMIC_DMA_STATr 0x00000104 +#define CMIC_DMA_DESC0r 0x00000110 +#define CMIC_IRQ_STATr 0x00000144 +#define CMIC_IRQ_MASKr 0x00000148 +#define CMIC_DEV_REV_IDr 0x00000178 + +/* CMIC interrupts reserved for kernel handler */ +#define CMIC_TXRX_IRQ_MASK 0x7f80 + +/* CMICm registers */ +#define CMICM_CMC_BASE 0x00031000 +#define CMICM_DMA_CTRLr (CMICM_CMC_BASE + 0x00000140) +#define CMICM_DMA_STATr (CMICM_CMC_BASE + 0x00000150) +#define CMICM_DMA_STAT_CLRr (CMICM_CMC_BASE + 0x000001a4) +#define CMICM_DMA_DESC0r (CMICM_CMC_BASE + 0x00000158) +#define CMICM_DMA_HALT_ADDRr (CMICM_CMC_BASE + 0x00000120) +#define CMICM_IRQ_STATr (CMICM_CMC_BASE + 0x00000400) +#define CMICM_IRQ_PCI_MASKr (CMICM_CMC_BASE + 0x00000414) +#define CMICM_IRQ_UC0_MASKr (CMICM_CMC_BASE + 0x00000428) +#define CMICM_DEV_REV_IDr 0x00010224 + +/* CMICm interrupts reserved for kernel handler */ +#define CMICM_TXRX_IRQ_MASK 0xff00 + +/* CMICd increased interrupts reserved for kernel handler */ +#define CMICD_CTRLD_IRQ_MASK 0x78000000 + +#define DEV_HAS_CMICM(_sinfo) ((_sinfo)->cmic_type == 'm') +#define CDMA_CH(_d, _ch) ((_d)->cdma_channels & (1 << (_ch))) + +/* + * DMA_STAT: control bits + * + * xxx_SET and xxx_CLR can be WRITTEN to CMIC_DMA_STAT + * xxx_TST can be masked against values read from CMIC_DMA_STAT. + * Argument required: 0 <= ch <= 3 + */ + +#define DS_DMA_ACTIVE(ch) (0x00040000 << (ch)) +#define DS_DMA_EN_SET(ch) (0x80|(ch)) +#define DS_DMA_EN_CLR(ch) (0x00|(ch)) +#define DS_DMA_EN_TST(ch) (0x00000001 << (ch)) + +#define DS_CHAIN_DONE_SET(ch) (0x80|(4+(ch))) +#define DS_CHAIN_DONE_CLR(ch) (0x00|(4+(ch))) +#define DS_CHAIN_DONE_TST(ch) (0x00000010 << (ch)) + +#define DS_DESC_DONE_SET(ch) (0x80|(8+(ch))) +#define DS_DESC_DONE_CLR(ch) (0x00|(8+(ch))) +#define DS_DESC_DONE_TST(ch) (0x00000100 << (ch)) + +#define DC_ABORT_DMA(ch) (0x04 << (8 * (ch))) + +#define DS_CMC_DESCRD_CMPLT_CLR(ch) (0x00000001 << (ch)) +#define DS_CMC_CTRLD_INT_CLR(ch) (0x00000100 << (ch)) +#define DS_CMC_DMA_ACTIVE(ch) (0x00000100 << (ch)) + +/* + * DMA_CTRL: control bits + */ +#define DC_CMC_DIRECTION (0x00000001) +#define DC_CMC_ENABLE (0x00000002) +#define DC_CMC_ABORT (0x00000004) +#define DC_CMC_CTRLD_INT (0x00000100) +#define DC_CMC_CONTINUOUS (0x00000200) + +/* + * Per-channel operations. + * These are the basis for the TX/RX functions + */ + +static inline void +xgs_dma_chain_clear(bkn_switch_info_t *sinfo, int chan) +{ + DBG_IRQ(("Clear chain on device %d chan %d\n", + sinfo->dev_no, chan)); + DEV_WRITE32(sinfo, CMIC_DMA_STATr, DS_DMA_EN_CLR(chan)); + DEV_WRITE32(sinfo, CMIC_DMA_STATr, DS_CHAIN_DONE_CLR(chan)); + + MEMORY_BARRIER; +} + +static inline void +xgs_dma_desc_clear(bkn_switch_info_t *sinfo, int chan) +{ + uint32_t val; + + DBG_IRQ(("Clear desc on device %d chan %d\n", + sinfo->dev_no, chan)); + DEV_WRITE32(sinfo, CMIC_DMA_STATr, DS_DESC_DONE_CLR(chan)); + + MEMORY_BARRIER; + + /* Flush write buffer */ + DEV_READ32(sinfo, CMIC_DMA_STATr, &val); + + MEMORY_BARRIER; +} + +static int +xgs_dma_chan_clear(bkn_switch_info_t *sinfo, int chan) +{ + xgs_dma_chain_clear(sinfo, chan); + xgs_dma_desc_clear(sinfo, chan); + + return 0; +} + +static int +xgs_dma_chan_init(bkn_switch_info_t *sinfo, int chan, int dir) +{ + uint32_t cdc; + + DEV_READ32(sinfo, CMIC_DMA_CTRLr, &cdc); + + cdc &= ~(0x9 << (8 * chan)); + if (dir) { + cdc |= 0x1 << (8 * chan); + } else { + cdc |= 0x8 << (8 * chan); + } + + DEV_WRITE32(sinfo, CMIC_DMA_CTRLr, cdc); + + return 0; +} + +static int +xgs_dma_chan_start(bkn_switch_info_t *sinfo, int chan, dma_addr_t dcb) +{ + /* Write the DCB address to the DESC address for this channel */ + DEV_WRITE32(sinfo, CMIC_DMA_DESC0r + 4 * chan, dcb); + + MEMORY_BARRIER; + + /* Kick it off */ + DEV_WRITE32(sinfo, CMIC_DMA_STATr, DS_DMA_EN_SET(chan)); + + MEMORY_BARRIER; + + return 0; +} + +static int +xgs_dma_chan_abort(bkn_switch_info_t *sinfo, int chan, int polls) +{ + uint32_t ctrl, dma_stat; + int p; + + /* Clear enable */ + DEV_WRITE32(sinfo, CMIC_DMA_STATr, DS_DMA_EN_CLR(chan)); + + MEMORY_BARRIER; + + /* Abort the channel */ + DEV_READ32(sinfo, CMIC_DMA_CTRLr, &ctrl); + DEV_WRITE32(sinfo, CMIC_DMA_CTRLr, ctrl | DC_ABORT_DMA(chan)); + + MEMORY_BARRIER; + + /* Poll for abort completion */ + for (p = 0; p < polls; p++) { + DEV_READ32(sinfo, CMIC_DMA_STATr, &dma_stat); + if (!(dma_stat & DS_DMA_ACTIVE(chan))) { + /* Restore previous control value */ + DEV_WRITE32(sinfo, CMIC_DMA_CTRLr, ctrl); + + MEMORY_BARRIER; + + /* Clear up channel */ + xgs_dma_chan_clear(sinfo, chan); + + return polls; + } + } + DBG_WARN(("DMA channel %d abort failed\n", chan)); + + return -1; +} + +static inline void +xgs_irq_mask_set(bkn_switch_info_t *sinfo, uint32_t mask) +{ + if (sinfo->napi_poll_mode) { + mask = 0; + } + lkbde_irq_mask_set(sinfo->dev_no | LKBDE_ISR2_DEV, CMIC_IRQ_MASKr, + mask, CMIC_TXRX_IRQ_MASK); +} + +static inline void +xgs_irq_mask_enable(bkn_switch_info_t *sinfo, int chan, int update_hw) +{ + uint32_t mask; + + if (chan == XGS_DMA_TX_CHAN) { + mask = 0x100; + } else { + mask = 0x180 << (2 * chan); + } + + sinfo->irq_mask |= mask; + + if (update_hw) { + xgs_irq_mask_set(sinfo, sinfo->irq_mask); + } +} + +static inline void +xgs_irq_mask_disable(bkn_switch_info_t *sinfo, int chan, int update_hw) +{ + uint32_t mask; + + if (chan == XGS_DMA_TX_CHAN) { + mask = 0x100; + } else { + mask = 0x180 << (2 * chan); + } + + sinfo->irq_mask &= ~mask; + + if (update_hw) { + xgs_irq_mask_set(sinfo, sinfo->irq_mask); + } +} + +static inline void +xgsm_dma_chain_clear(bkn_switch_info_t *sinfo, int chan) +{ + uint32_t cdc; + + /* Disabing DMA clears chain done */ + DEV_READ32(sinfo, CMICM_DMA_CTRLr + 4 * chan, &cdc); + cdc &= ~(DC_CMC_ENABLE | DC_CMC_ABORT); + DEV_WRITE32(sinfo, CMICM_DMA_CTRLr + 4 * chan, cdc); + + MEMORY_BARRIER; +} + +static inline void +xgsm_dma_desc_clear(bkn_switch_info_t *sinfo, int chan) +{ + uint32_t val; + + val = DS_CMC_DESCRD_CMPLT_CLR(chan); + if (CDMA_CH(sinfo, chan)) { + val |= DS_CMC_CTRLD_INT_CLR(chan); + } + DEV_WRITE32(sinfo, CMICM_DMA_STAT_CLRr, val); + + MEMORY_BARRIER; + + /* Flush write buffer */ + DEV_READ32(sinfo, CMICM_DMA_STAT_CLRr, &val); + + MEMORY_BARRIER; +} + +static int +xgsm_dma_chan_clear(bkn_switch_info_t *sinfo, int chan) +{ + xgsm_dma_chain_clear(sinfo, chan); + xgsm_dma_desc_clear(sinfo, chan); + + return 0; +} + +static inline void +xgsm_cdma_halt_set(bkn_switch_info_t *sinfo, int chan) +{ + DEV_WRITE32(sinfo, CMICM_DMA_HALT_ADDRr + 4 * chan, + sinfo->halt_addr[chan]); + + MEMORY_BARRIER; +} + +static int +xgsm_dma_chan_init(bkn_switch_info_t *sinfo, int chan, int dir) +{ + uint32_t cdc; + + DEV_READ32(sinfo, CMICM_DMA_CTRLr + 4 * chan, &cdc); + cdc &= ~DC_CMC_DIRECTION; + if (dir) { + cdc |= DC_CMC_DIRECTION; + } + if (CDMA_CH(sinfo, chan)) { + cdc |= DC_CMC_CONTINUOUS | DC_CMC_CTRLD_INT; + xgsm_cdma_halt_set(sinfo, chan); + } + DEV_WRITE32(sinfo, CMICM_DMA_CTRLr + 4 * chan, cdc); + + return 0; +} + +static int +xgsm_dma_chan_start(bkn_switch_info_t *sinfo, int chan, dma_addr_t dcb) +{ + uint32_t cdc; + + /* Write the DCB address to the DESC address for this channel */ + DEV_WRITE32(sinfo, CMICM_DMA_DESC0r + 4 * chan, dcb); + + MEMORY_BARRIER; + + /* Kick it off */ + DEV_READ32(sinfo, CMICM_DMA_CTRLr + 4 * chan, &cdc); + cdc |= DC_CMC_ENABLE; + DEV_WRITE32(sinfo, CMICM_DMA_CTRLr + 4 * chan, cdc); + + MEMORY_BARRIER; + + return 0; +} + +static int +xgsm_dma_chan_abort(bkn_switch_info_t *sinfo, int chan, int polls) +{ + uint32_t ctrl, dma_stat; + int p; + + /* Skip abort sequence if channel is not active */ + DEV_READ32(sinfo, CMICM_DMA_STATr, &dma_stat); + if (!(dma_stat & DS_CMC_DMA_ACTIVE(chan))) { + return 0; + } + + /* Abort the channel */ + DEV_READ32(sinfo, CMICM_DMA_CTRLr + 4 * chan, &ctrl); + ctrl |= (DC_CMC_ENABLE | DC_CMC_ABORT); + DEV_WRITE32(sinfo, CMICM_DMA_CTRLr + 4 * chan, ctrl); + + MEMORY_BARRIER; + + /* Poll for abort completion */ + for (p = 0; p < polls; p++) { + DEV_READ32(sinfo, CMICM_DMA_STATr, &dma_stat); + if (!(dma_stat & DS_CMC_DMA_ACTIVE(chan))) { + /* Clear up channel */ + xgsm_dma_chan_clear(sinfo, chan); + return polls; + } + } + DBG_WARN(("DMA channel %d abort failed\n", chan)); + + return -1; +} + +static inline void +xgsm_irq_mask_set(bkn_switch_info_t *sinfo, uint32_t mask) +{ + uint32_t irq_mask_reg = CMICM_IRQ_PCI_MASKr; + uint32_t ctrld_mask = 0; + + if (sinfo->napi_poll_mode) { + mask = 0; + } + if (sinfo->cpu_no == 1) { + irq_mask_reg = CMICM_IRQ_UC0_MASKr; + } + + /* Get the Controlled Interrupts mask for Continuous DMA mode */ + ctrld_mask |= (sinfo->cdma_channels << 27) & CMICD_CTRLD_IRQ_MASK; + + lkbde_irq_mask_set(sinfo->dev_no | LKBDE_ISR2_DEV, irq_mask_reg, + mask, CMICM_TXRX_IRQ_MASK | ctrld_mask); +} + +static inline void +xgsm_irq_mask_enable(bkn_switch_info_t *sinfo, int chan, int update_hw) +{ + uint32_t mask; + + if (CDMA_CH(sinfo, chan)) { + mask = 0x08000000 << chan; + } else { + if (chan == XGS_DMA_TX_CHAN) { + mask = 0x8000; + } else { + mask = 0xc000 >> (2 * chan); + } + } + + sinfo->irq_mask |= mask; + + if (update_hw) { + xgsm_irq_mask_set(sinfo, sinfo->irq_mask); + } +} + +static inline void +xgsm_irq_mask_disable(bkn_switch_info_t *sinfo, int chan, int update_hw) +{ + uint32_t mask; + + if (CDMA_CH(sinfo, chan)) { + mask = 0x08000000 << chan; + } else { + if (chan == XGS_DMA_TX_CHAN) { + mask = 0x8000; + } else { + mask = 0xc000 >> (2 * chan); + } + } + + sinfo->irq_mask &= ~mask; + + if (update_hw) { + xgsm_irq_mask_set(sinfo, sinfo->irq_mask); + } +} + +static inline void +dev_dma_chain_clear(bkn_switch_info_t *sinfo, int chan) +{ + if (DEV_HAS_CMICM(sinfo)) { + xgsm_dma_chain_clear(sinfo, chan); + } else { + xgs_dma_chain_clear(sinfo, chan); + } +} + +static inline void +dev_dma_desc_clear(bkn_switch_info_t *sinfo, int chan) +{ + if (DEV_HAS_CMICM(sinfo)) { + xgsm_dma_desc_clear(sinfo, chan); + } else { + xgs_dma_desc_clear(sinfo, chan); + } +} + +static int +dev_dma_chan_clear(bkn_switch_info_t *sinfo, int chan) +{ + if (DEV_HAS_CMICM(sinfo)) { + return xgsm_dma_chan_clear(sinfo, chan); + } + return xgs_dma_chan_clear(sinfo, chan); +} + +static void +dev_cdma_halt_set(bkn_switch_info_t *sinfo, int chan) +{ + if (DEV_HAS_CMICM(sinfo)) { + xgsm_cdma_halt_set(sinfo, chan); + } +} + +static int +dev_dma_chan_init(bkn_switch_info_t *sinfo, int chan, int dir) +{ + if (DEV_HAS_CMICM(sinfo)) { + return xgsm_dma_chan_init(sinfo, chan, dir); + } + return xgs_dma_chan_init(sinfo, chan, dir); +} + +static int +dev_dma_chan_start(bkn_switch_info_t *sinfo, int chan, dma_addr_t dcb) +{ + if (DEV_HAS_CMICM(sinfo)) { + return xgsm_dma_chan_start(sinfo, chan, dcb); + } + return xgs_dma_chan_start(sinfo, chan, dcb); +} + +static int +dev_dma_chan_abort(bkn_switch_info_t *sinfo, int chan, int polls) +{ + if (DEV_HAS_CMICM(sinfo)) { + return xgsm_dma_chan_abort(sinfo, chan, polls); + } + return xgs_dma_chan_abort(sinfo, chan, polls); +} + +static inline void +dev_irq_mask_set(bkn_switch_info_t *sinfo, uint32_t mask) +{ + if (DEV_HAS_CMICM(sinfo)) { + xgsm_irq_mask_set(sinfo, mask); + } else { + xgs_irq_mask_set(sinfo, mask); + } +} + +static inline void +dev_irq_mask_enable(bkn_switch_info_t *sinfo, int chan, int update_hw) +{ + if (DEV_HAS_CMICM(sinfo)) { + xgsm_irq_mask_enable(sinfo, chan, update_hw); + } else { + xgs_irq_mask_enable(sinfo, chan, update_hw); + } +} + +static void +dev_irq_mask_disable(bkn_switch_info_t *sinfo, int chan, int update_hw) +{ + if (DEV_HAS_CMICM(sinfo)) { + xgsm_irq_mask_disable(sinfo, chan, update_hw); + } else { + xgs_irq_mask_disable(sinfo, chan, update_hw); + } +} + + +static int +bkn_alloc_dcbs(bkn_switch_info_t *sinfo) +{ + int dcb_size; + int tx_ring_size, rx_ring_size; + + dcb_size = sinfo->dcb_wsize * sizeof(uint32_t); + tx_ring_size = dcb_size * (MAX_TX_DCBS + 1); + rx_ring_size = dcb_size * (MAX_RX_DCBS + 1); + sinfo->dcb_mem_size = tx_ring_size + rx_ring_size * NUM_RX_CHAN; + + sinfo->dcb_mem = DMA_ALLOC_COHERENT(sinfo->dma_dev, + sinfo->dcb_mem_size, + &sinfo->dcb_dma); + if (sinfo->dcb_mem == NULL) { + gprintk("DCB memory allocation (%d bytes) failed.\n", + sinfo->dcb_mem_size); + return -ENOMEM; + } + + return 0; +} + +static void +bkn_free_dcbs(bkn_switch_info_t *sinfo) +{ + if (sinfo->dcb_mem != NULL) { + DMA_FREE_COHERENT(sinfo->dma_dev, sinfo->dcb_mem_size, + sinfo->dcb_mem, sinfo->dcb_dma); + sinfo->dcb_mem = NULL; + } +} + +static void +bkn_clean_tx_dcbs(bkn_switch_info_t *sinfo) +{ + bkn_desc_info_t *desc; + + DBG_DCB_TX(("Cleaning Tx DCBs (%d %d).\n", + sinfo->tx.cur, sinfo->tx.dirty)); + while (sinfo->tx.free < MAX_TX_DCBS) { + desc = &sinfo->tx.desc[sinfo->tx.dirty]; + if (desc->skb != NULL) { + DBG_SKB(("Cleaning Tx SKB from DCB %d.\n", + sinfo->tx.dirty)); + DMA_UNMAP_SINGLE(sinfo->dma_dev, + desc->skb_dma, desc->dma_size, + DMA_TODEV); + desc->skb_dma = 0; + dev_kfree_skb_any(desc->skb); + desc->skb = NULL; + } + if (++sinfo->tx.dirty >= MAX_TX_DCBS) { + sinfo->tx.dirty = 0; + } + sinfo->tx.free++; + } + sinfo->tx.api_active = 0; + DBG_DCB_TX(("Cleaned Tx DCBs (%d %d).\n", + sinfo->tx.cur, sinfo->tx.dirty)); +} + +static void +bkn_clean_rx_dcbs(bkn_switch_info_t *sinfo, int chan) +{ + bkn_desc_info_t *desc; + + DBG_DCB_RX(("Cleaning Rx%d DCBs (%d %d).\n", + chan, sinfo->rx[chan].cur, sinfo->rx[chan].dirty)); + while (sinfo->rx[chan].free) { + desc = &sinfo->rx[chan].desc[sinfo->rx[chan].dirty]; + if (desc->skb != NULL) { + DBG_SKB(("Cleaning Rx%d SKB from DCB %d.\n", + chan, sinfo->rx[chan].dirty)); + DMA_UNMAP_SINGLE(sinfo->dma_dev, + desc->skb_dma, desc->dma_size, + DMA_FROMDEV); + desc->skb_dma = 0; + dev_kfree_skb_any(desc->skb); + desc->skb = NULL; + } + if (++sinfo->rx[chan].dirty >= MAX_RX_DCBS) { + sinfo->rx[chan].dirty = 0; + } + sinfo->rx[chan].free--; + } + sinfo->rx[chan].running = 0; + sinfo->rx[chan].api_active = 0; + DBG_DCB_RX(("Cleaned Rx%d DCBs (%d %d).\n", + chan, sinfo->rx[chan].cur, sinfo->rx[chan].dirty)); +} + +static void +bkn_clean_dcbs(bkn_switch_info_t *sinfo) +{ + int chan; + + bkn_clean_tx_dcbs(sinfo); + + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + bkn_clean_rx_dcbs(sinfo, chan); + } +} + +static void +bkn_init_dcbs(bkn_switch_info_t *sinfo) +{ + int dcb_size; + uint32_t *dcb_mem; + dma_addr_t dcb_dma; + bkn_desc_info_t *desc; + int idx; + int chan; + + memset(sinfo->dcb_mem, 0, sinfo->dcb_mem_size); + + dcb_size = sinfo->dcb_wsize * sizeof(uint32_t); + dcb_mem = sinfo->dcb_mem; + dcb_dma = sinfo->dcb_dma; + + for (idx = 0; idx < (MAX_TX_DCBS + 1); idx++) { + if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) { + dcb_mem[1] |= (1 << 24) | (1 << 16); + if (idx == MAX_TX_DCBS) { + dcb_mem[1] |= 1 << 18; + dcb_mem[0] = sinfo->tx.desc[0].dcb_dma; + } + } + desc = &sinfo->tx.desc[idx]; + desc->dcb_mem = dcb_mem; + desc->dcb_dma = dcb_dma; + dcb_mem += sinfo->dcb_wsize; + dcb_dma += dcb_size; + } + sinfo->halt_addr[XGS_DMA_TX_CHAN] = sinfo->tx.desc[0].dcb_dma; + sinfo->tx.free = MAX_TX_DCBS; + + DBG_DCB_TX(("Tx DCBs @ 0x%08x.\n", + (uint32_t)sinfo->tx.desc[0].dcb_dma)); + + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + for (idx = 0; idx < (MAX_RX_DCBS + 1); idx++) { + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + dcb_mem[1] |= (1 << 24) | (1 << 16); + if (idx == MAX_RX_DCBS) { + dcb_mem[1] |= 1 << 18; + dcb_mem[0] = sinfo->rx[chan].desc[0].dcb_dma; + } + } + desc = &sinfo->rx[chan].desc[idx]; + desc->dcb_mem = dcb_mem; + desc->dcb_dma = dcb_dma; + dcb_mem += sinfo->dcb_wsize; + dcb_dma += dcb_size; + } + sinfo->halt_addr[XGS_DMA_RX_CHAN + chan] = sinfo->rx[chan].desc[MAX_RX_DCBS].dcb_dma; + sinfo->rx[chan].free = 0; + + DBG_DCB_RX(("Rx%d DCBs @ 0x%08x.\n", + chan, (uint32_t)sinfo->rx[chan].desc[0].dcb_dma)); + } +} + +static void +bkn_dump_dcb(char *prefix, uint32_t *dcb, int wsize, int txrx) +{ + if (XGS_DMA_TX_CHAN == txrx) { + DBG_DCB_TX(("%s: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x ... 0x%08x\n", + prefix, dcb[0], dcb[1], dcb[2], dcb[3], dcb[4], dcb[5], + dcb[wsize - 1])); + } else { + DBG_DCB_RX(("%s: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x ... 0x%08x\n", + prefix, dcb[0], dcb[1], dcb[2], dcb[3], dcb[4], dcb[5], + dcb[wsize - 1])); + } +} + +static void +bkn_dump_pkt(uint8_t *data, int size, int txrx) +{ + int idx; + char str[128]; + + if (!(debug & DBG_LVL_PDMP) && + !(txrx == XGS_DMA_TX_CHAN && debug & DBG_LVL_PDMP_TX) && + !(txrx == XGS_DMA_RX_CHAN && debug & DBG_LVL_PDMP_RX)) { + return; + } + size =32; + + for (idx = 0; idx < size; idx++) { + if ((idx & 0xf) == 0) { + sprintf(str, "%04x: ", idx); + } + if ((idx & 0xf) == 8) { + sprintf(&str[strlen(str)], "- "); + } + sprintf(&str[strlen(str)], "%02x ", data[idx]); + if ((idx & 0xf) == 0xf) { + sprintf(&str[strlen(str)], "\n"); + gprintk(str); + } + } + if ((idx & 0xf) != 0) { + sprintf(&str[strlen(str)], "\n"); + gprintk(str); + } +} + +static bkn_switch_info_t * +bkn_sinfo_from_unit(int unit) +{ + struct list_head *list; + bkn_switch_info_t *sinfo; + + list_for_each(list, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)list; + if (sinfo->dev_no == unit || unit == -1) { + return sinfo; + } + } + return NULL; +} + +static void +bkn_api_rx_restart(bkn_switch_info_t *sinfo) +{ + bkn_dcb_chain_t *dcb_chain; + int chan = API_RX_CHAN; + int start_dma; + + if (sinfo->basedev_suspended) { + return; + } + + /* If resume from basedev suspended, there could be a suspended chain */ + if (sinfo->rx[chan].api_dcb_chain) { + return; + } + + /* Assume that driver lock is held */ + if (!list_empty(&sinfo->rx[chan].api_dcb_list)) { + dcb_chain = list_entry(sinfo->rx[chan].api_dcb_list.next, + bkn_dcb_chain_t, list); + start_dma = 0; + if (sinfo->rx[chan].use_rx_skb == 0) { + sinfo->rx[chan].chain_complete = 0; + start_dma = 1; + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan) && + sinfo->rx[chan].api_active) { + /* HW is running already, so we just move to the next chain */ + start_dma = 0; + } + } + sinfo->rx[chan].api_dcb_chain = dcb_chain; + sinfo->rx[chan].api_active = 1; + if (start_dma) { + DBG_DCB_RX(("Start API Rx DMA, first DCB @ 0x%08x (%d DCBs).\n", + (uint32_t)dcb_chain->dcb_dma, dcb_chain->dcb_cnt)); + dev_dma_chan_clear(sinfo, XGS_DMA_RX_CHAN + chan); + dev_irq_mask_enable(sinfo, XGS_DMA_RX_CHAN + chan, 1); + dev_dma_chan_start(sinfo, XGS_DMA_RX_CHAN + chan, + dcb_chain->dcb_dma); + } + + list_del(&dcb_chain->list); + } +} + +static void +bkn_api_rx_chain_done(bkn_switch_info_t *sinfo, int chan) +{ + DBG_DCB_RX(("API Rx DMA chain done\n")); + + if (!CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + sinfo->rx[chan].api_active = 0; + } + if (sinfo->rx[chan].api_dcb_chain) { + kfree(sinfo->rx[chan].api_dcb_chain); + sinfo->rx[chan].api_dcb_chain = NULL; + } + bkn_api_rx_restart(sinfo); + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan) && + sinfo->rx[chan].api_dcb_chain == NULL) { + sinfo->rx[chan].api_active = 0; + } +} + +static int +bkn_api_rx_copy_from_skb(bkn_switch_info_t *sinfo, + int chan, bkn_desc_info_t *desc) +{ + bkn_dcb_chain_t *dcb_chain; + uint32_t *dcb; + uint32_t dcb_stat; + uint8_t *pkt; + int pktlen; + int i; + bkn_evt_resource_t *evt; + + dcb_stat = desc->dcb_mem[sinfo->dcb_wsize-1]; + pktlen = dcb_stat & SOC_DCB_KNET_COUNT_MASK; + + dcb_chain = sinfo->rx[chan].api_dcb_chain; + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan) && dcb_chain == NULL) { + /* Last chain done, try to get a new one */ + bkn_api_rx_chain_done(sinfo, chan); + dcb_chain = sinfo->rx[chan].api_dcb_chain; + } + if (dcb_chain == NULL) { + DBG_WARN(("No Rx API buffers\n")); + sinfo->rx[chan].pkts_d_no_api_buf++; + return -1; + } + dcb = &dcb_chain->dcb_mem[dcb_chain->dcb_cur * sinfo->dcb_wsize]; + if (dcb[1] < pktlen) { + DBG_WARN(("Rx API buffer too small\n")); + return -1; + } + pkt = (uint8_t *)kernel_bde->p2l(sinfo->dev_no, dcb[0]); + if (pkt == NULL) { + DBG_WARN(("Invalid Rx API buffer\n")); + return -1; + } + + /* Copy packet data */ + memcpy(pkt, desc->skb->data, pktlen); + + /* Copy packet metadata and mark as done */ + for (i = SOC_DCB_META_OFFSET; i < sinfo->dcb_wsize; i++) { + dcb[i] = desc->dcb_mem[i]; + } + dcb[sinfo->dcb_wsize-1] = dcb_stat | SOC_DCB_KNET_DONE; + + dcb_chain->dcb_cur++; + + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + dcb = &dcb_chain->dcb_mem[dcb_chain->dcb_cur * sinfo->dcb_wsize]; + if (dcb[1] & (1 << 18)) { + /* Get the next chain if reload done */ + dcb[sinfo->dcb_wsize - 1] |= (1 << 31) | SOC_DCB_KNET_DONE; + bkn_api_rx_chain_done(sinfo, chan); + dcb_chain = sinfo->rx[chan].api_dcb_chain; + if (dcb_chain == NULL) { + sinfo->rx[chan].api_dcb_chain_end = NULL; + } + } + } else { + if ((dcb[1] & (1 << 16)) == 0) { + bkn_api_rx_chain_done(sinfo, chan); + } + } + + sinfo->dma_events |= KCOM_DMA_INFO_F_RX_DONE; + + evt = &_bkn_evt[sinfo->evt_idx]; + evt->evt_wq_put++; + wake_up_interruptible(&evt->evt_wq); + + return 0; +} + +static void +bkn_rx_refill(bkn_switch_info_t *sinfo, int chan) +{ + struct sk_buff *skb; + bkn_desc_info_t *desc; + uint32_t *dcb; + int prev; + + if (sinfo->rx[chan].use_rx_skb == 0) { + /* Rx buffers are provided by BCM Rx API */ + return; + } + + if (!CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan) && + sinfo->rx[chan].tokens < MAX_RX_DCBS) { + /* Pause DMA for now */ + return; + } + + while (sinfo->rx[chan].free < MAX_RX_DCBS) { + desc = &sinfo->rx[chan].desc[sinfo->rx[chan].cur]; + if (desc->skb == NULL) { + skb = dev_alloc_skb(rx_buffer_size + RCPU_RX_ENCAP_SIZE); + if (skb == NULL) { + break; + } + skb_reserve(skb, RCPU_RX_ENCAP_SIZE); + desc->skb = skb; + } else { + DBG_DCB_RX(("Refill Rx%d SKB in DCB %d recycled.\n", + chan, sinfo->rx[chan].cur)); + } + skb = desc->skb; + desc->dma_size = rx_buffer_size; +#ifdef KNET_NO_AXI_DMA_INVAL + /* + * FIXME: Need to retain this code until iProc customers have been + * migrated to updated u-boot. Old u-boot versions are unable to load + * the kernel into non-ACP memory. + */ + /* + * Cache invalidate may corrupt DMA memory on some iProc-based devices + * if the kernel is mapped to ACP memory. + */ + if (sinfo->pdev == NULL) { + desc->dma_size = 0; + } +#endif + desc->skb_dma = DMA_MAP_SINGLE(sinfo->dma_dev, + skb->data, desc->dma_size, + DMA_FROMDEV); + DBG_DCB_RX(("Refill Rx%d DCB %d (0x%08x).\n", + chan, sinfo->rx[chan].cur, (uint32_t)desc->skb_dma)); + dcb = desc->dcb_mem; + memset(dcb, 0, sizeof(uint32_t) * sinfo->dcb_wsize); + dcb[0] = desc->skb_dma; + dcb[1] = rx_buffer_size; + + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + dcb[1] |= (1 << 24) | (1 << 16); + } else { + prev = PREV_IDX(sinfo->rx[chan].cur, MAX_RX_DCBS); + if (prev < (MAX_RX_DCBS - 1)) { + sinfo->rx[chan].desc[prev].dcb_mem[1] |= (1 << 16); + } + } + if (++sinfo->rx[chan].cur >= MAX_RX_DCBS) { + sinfo->rx[chan].cur = 0; + } + sinfo->rx[chan].free++; + sinfo->rx[chan].tokens--; + } +} + +static int +bkn_rx_restart(bkn_switch_info_t *sinfo, int chan) +{ + bkn_desc_info_t *desc; + + if (sinfo->basedev_suspended) { + return 0; + } + + if (sinfo->rx[chan].running) { + return 0; + } + + if (sinfo->rx[chan].free < MAX_RX_DCBS) { + return 1; + } + + desc = &sinfo->rx[chan].desc[sinfo->rx[chan].dirty]; + sinfo->rx[chan].chain_complete = 0; + DBG_DCB_RX(("Restart Rx%d DMA, DCB @ 0x%08x (%d).\n", + chan, (uint32_t)desc->dcb_dma, sinfo->rx[chan].dirty)); + dev_dma_chan_clear(sinfo, XGS_DMA_RX_CHAN + chan); + dev_irq_mask_enable(sinfo, XGS_DMA_RX_CHAN + chan, 1); + dev_dma_chan_start(sinfo, XGS_DMA_RX_CHAN + chan, desc->dcb_dma); + sinfo->rx[chan].running = 1; + + /* Request one extra poll if chain was restarted during poll */ + if (sinfo->napi_poll_mode) { + sinfo->napi_poll_again = 1; + } + + return 0; +} + +static int +bkn_tx_dma_start(bkn_switch_info_t *sinfo) +{ + bkn_desc_info_t *desc; + + desc = &sinfo->tx.desc[sinfo->tx.cur]; + if (sinfo->tx.free == MAX_TX_DCBS) { + if (!sinfo->tx.api_active) { + DBG_DCB_TX(("Start Tx DMA, DCB @ 0x%08x (%d).\n", + (uint32_t)desc->dcb_dma, sinfo->tx.cur)); + dev_dma_chan_clear(sinfo, XGS_DMA_TX_CHAN); + dev_irq_mask_enable(sinfo, XGS_DMA_TX_CHAN, 1); + dev_dma_chan_start(sinfo, XGS_DMA_TX_CHAN, desc->dcb_dma); + } + } + + return 0; +} + +static int +bkn_dma_init(bkn_switch_info_t *sinfo) +{ + int chan; + + dev_dma_chan_init(sinfo, XGS_DMA_TX_CHAN, 1); + if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) { + bkn_tx_dma_start(sinfo); + } + + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + dev_dma_chan_init(sinfo, XGS_DMA_RX_CHAN + chan, 0); + bkn_rx_refill(sinfo, chan); + bkn_rx_restart(sinfo, chan); + } + + return 0; +} + +static void +bkn_cdma_goto(bkn_switch_info_t *sinfo, int chan, dma_addr_t dcb) +{ + if (sinfo->basedev_suspended) { + return; + } + + /* Set the new halt location */ + sinfo->halt_addr[chan] = dcb; + dev_cdma_halt_set(sinfo, chan); +} + +static int +bkn_dma_abort_tx(bkn_switch_info_t *sinfo) +{ + bkn_dcb_chain_t *dcb_chain; + + DBG_VERB(("Aborting Tx DMA.\n")); + + dev_irq_mask_disable(sinfo, XGS_DMA_TX_CHAN, 1); + + dev_dma_chan_abort(sinfo, XGS_DMA_TX_CHAN, 10000); + + if (sinfo->tx.api_dcb_chain) { + DBG_DCB_TX(("Freeing active Tx DCB chain.\n")); + kfree(sinfo->tx.api_dcb_chain); + sinfo->tx.api_dcb_chain = NULL; + } + while (!list_empty(&sinfo->tx.api_dcb_list)) { + dcb_chain = list_entry(sinfo->tx.api_dcb_list.next, + bkn_dcb_chain_t, list); + list_del(&dcb_chain->list); + DBG_DCB_TX(("Freeing Tx DCB chain.\n")); + kfree(dcb_chain); + } + sinfo->tx.api_dcb_chain_end = NULL; + + return 0; +} + +static int +bkn_dma_abort_rx(bkn_switch_info_t *sinfo, int chan) +{ + bkn_dcb_chain_t *dcb_chain; + + DBG_VERB(("Aborting Rx%d DMA.\n", chan)); + + dev_irq_mask_disable(sinfo, XGS_DMA_RX_CHAN + chan, 1); + + dev_dma_chan_abort(sinfo, XGS_DMA_RX_CHAN + chan, 10000); + + if (sinfo->rx[chan].api_dcb_chain) { + DBG_DCB_RX(("Freeing active Rx%d DCB chain.\n", chan)); + kfree(sinfo->rx[chan].api_dcb_chain); + sinfo->rx[chan].api_dcb_chain = NULL; + } + while (!list_empty(&sinfo->rx[chan].api_dcb_list)) { + dcb_chain = list_entry(sinfo->rx[chan].api_dcb_list.next, + bkn_dcb_chain_t, list); + list_del(&dcb_chain->list); + DBG_DCB_RX(("Freeing Rx%d DCB chain.\n", chan)); + kfree(dcb_chain); + } + sinfo->rx[chan].api_dcb_chain_end = NULL; + + return 0; +} + +static int +bkn_dma_abort(bkn_switch_info_t *sinfo) +{ + int chan; + + bkn_dma_abort_tx(sinfo); + + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + bkn_dma_abort_rx(sinfo, chan); + } + + return 0; +} + +static bkn_filter_t * +bkn_match_rx_pkt(bkn_switch_info_t *sinfo, uint32_t *desc, + uint8_t *pkt, int chan, bkn_filter_t *cbf) +{ + struct list_head *list; + bkn_filter_t *filter; + kcom_filter_t scratch, *kf; + uint8_t *oob = (uint8_t *)desc; + int size, wsize; + int idx, match; + + list_for_each(list, &sinfo->rxpf_list) { + filter = (bkn_filter_t *)list; + kf = &filter->kf; + memcpy(&scratch.data.b[0], + &oob[kf->oob_data_offset], kf->oob_data_size); + memcpy(&scratch.data.b[kf->oob_data_size], + &pkt[kf->pkt_data_offset], kf->pkt_data_size); + size = kf->oob_data_size + kf->pkt_data_size; + wsize = BYTES2WORDS(size); + DBG_VERB(("Filter: size = %d (%d), data = 0x%08x, mask = 0x%08x\n", + size, wsize, kf->data.w[0], kf->mask.w[0])); + match = 1; + if (match) { + if (kf->priority < (num_rx_prio * NUM_RX_CHAN)) { + if (kf->priority < (num_rx_prio * chan) || + kf->priority >= (num_rx_prio * (chan + 1))) { + match = 0; + } + } + } + if (match) { + for (idx = 0; idx < wsize; idx++) { + scratch.data.w[idx] &= kf->mask.w[idx]; + if (scratch.data.w[idx] != kf->data.w[idx]) { + match = 0; + break; + } + } + } + if (match) { + if (kf->dest_type == KCOM_DEST_T_CB) { + /* Check for custom filters */ + if (knet_filter_cb != NULL && cbf != NULL) { + size = desc[sinfo->dcb_wsize-1] & SOC_DCB_KNET_COUNT_MASK; + memset(cbf, 0, sizeof(*cbf)); + memcpy(&cbf->kf, kf, sizeof(cbf->kf)); + if (knet_filter_cb(pkt, size, sinfo->dev_no, + desc, chan, &cbf->kf)) { + filter->hits++; + return cbf; + } + } else { + DBG_FLTR(("Match, but not filter callback\n")); + } + } else { + filter->hits++; + return filter; + } + } + } + + return NULL; +} + +static bkn_priv_t * +bkn_netif_lookup(bkn_switch_info_t *sinfo, int id) +{ + struct list_head *list; + bkn_priv_t *priv; + int found; + + /* Fast path */ + if (id < sinfo->ndev_max) { + if (sinfo->ndevs[id] != NULL) { + DBG_NDEV(("Look up netif ID %d successful\n", id)); + return netdev_priv(sinfo->ndevs[id]); + } + } + + /* Slow path - should normally not get here */ + found = 0; + priv = NULL; + list_for_each(list, &sinfo->ndev_list) { + priv = (bkn_priv_t *)list; + if (priv->id == id) { + found = 1; + break; + } + } + if (found && priv != NULL) { + return priv; + } + return NULL; +} + +static int +bkn_add_rcpu_encap(bkn_switch_info_t *sinfo, struct sk_buff *skb, uint32_t *dcb) +{ + int pktlen = skb->len; + uint32_t *metadata; + int idx; + + /* Add and clear RCPU encapsulation */ + skb_push(skb, RCPU_RX_ENCAP_SIZE); + memset(skb->data, 0, RCPU_RX_ENCAP_SIZE); + + /* RCPU Header */ + memcpy(skb->data, &skb->data[RCPU_RX_ENCAP_SIZE], 12); + if (rcpu_dmac != NULL) { + memcpy(skb->data, bkn_rcpu_dmac, 6); + } + if (rcpu_smac != NULL) { + memcpy(&skb->data[6], bkn_rcpu_smac, 6); + } + skb->data[12] = 0x81; + skb->data[14] = rcpu_vlan >> 8; + skb->data[15] = rcpu_vlan & 0xff; + skb->data[16] = rcpu_ethertype >> 8; + skb->data[17] = rcpu_ethertype & 0xff; + skb->data[18] = sinfo->rcpu_sig >> 8; + skb->data[19] = sinfo->rcpu_sig & 0xff; + skb->data[20] = RCPU_OPCODE_RX; + skb->data[21] = RCPU_F_MODHDR; + skb->data[24] = pktlen >> 8; + skb->data[25] = pktlen & 0xff; + + /* Meta data */ + metadata = (uint32_t *)&skb->data[RCPU_HDR_SIZE]; + for (idx = 0; idx < sinfo->dcb_wsize - 3; idx++) { + metadata[idx] = htonl(dcb[idx+2]); + } + + return 0; +} + +static void +bkn_eth_type_update(struct sk_buff *skb, int ethertype) +{ +#if defined(PM_ETH_TYPE) && defined(PM_FC_TYPE) + /* Optionally override standard protocol */ + skb->protocol = PM_ETH_TYPE; + if (ethertype == ETH_P_FCOE) { + skb->protocol = PM_FC_TYPE; + } +#endif +} + + + +#define BKN_DNX_BIT(x) (1<<(x)) +#define BKN_DNX_RBIT(x) (~(1<<(x))) +#ifdef __LITTLE_ENDIAN +#define BKN_DNX_BYTE_SWAP(x) (x) +#else +#define BKN_DNX_BYTE_SWAP(x) ((((x) << 24)) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) >> 24))) +#endif +static int +device_is_dune(bkn_switch_info_t *sinfo) +{ + int is_dune = 0; + + is_dune = (sinfo->dcb_type == 28) ? 1 : 0; + return is_dune; +} +static int +packet_is_untagged(uint16_t tpid) +{ + int is_untagged = 0; + + /* Fixme SDK-111398 */ + /* 0x8100 is used in 802.1Q */ + /* 0x8848 is used in 802.11ad, the dtag tpid can be set to anything besides 0x8848, 0x9100 is a typical value, but couldn't cover all scenarios. */ + is_untagged = ((tpid != 0x8100) && (tpid != 0x8848) && (tpid != 0x9100)); + return is_untagged; +} + +static void +bkn_dnx_bitstream_set_field(uint32_t *input_buffer, uint32_t start_bit, uint32_t nof_bits, uint32_t field) +{ + uint32_t place; + uint32_t field_bit_i; + uint32_t bit_indicator; + + if( nof_bits > 32) + { + return; + } + + for( place=start_bit, field_bit_i = 0; field_bit_i< nof_bits; ++place, ++field_bit_i) + { + bit_indicator = field & BKN_DNX_BIT(nof_bits-field_bit_i-1); + if(bit_indicator) + { + input_buffer[place>>5] |= (0x80000000 >> (place & 0x0000001F)); + } + else + { + input_buffer[place>>5] &= ~(0x80000000 >> (place & 0x0000001F)); + } + } + return; +} + +static void +bkn_dnx_bitstream_get_field(uint8_t *input_buffer, uint32_t start_bit, uint32_t nof_bits, uint32_t *output_value) +{ + uint32_t idx; + uint32_t buf_sizes=0; + uint32_t tmp_output_value[2]={0}; + uint32_t first_byte_ndx; + uint32_t last_byte_ndx; + uint32_t place; + uint32_t field_bit_i; + uint8_t *tmp_output_value_u8_ptr = (uint8_t*)&tmp_output_value; + uint32_t bit_indicator; + + if (nof_bits > 32) + { + return; + } + + first_byte_ndx = start_bit / 8; + last_byte_ndx = ((start_bit + nof_bits - 1) / 8); + *output_value=0; + + /* get 32 bit value, MSB */ + for (idx = first_byte_ndx; idx <= last_byte_ndx; ++idx) + { + tmp_output_value_u8_ptr[last_byte_ndx - idx] = input_buffer[idx]; + buf_sizes += 8; + } + tmp_output_value[0] = BKN_DNX_BYTE_SWAP(tmp_output_value[0]); + if (last_byte_ndx > 4) + { + tmp_output_value[1] = BKN_DNX_BYTE_SWAP(tmp_output_value[1]); + } + + place = buf_sizes - (start_bit % 8 + nof_bits); + for (field_bit_i = 0; field_bit_i< nof_bits; ++place, ++field_bit_i) + { + uint32_t result; + result = tmp_output_value[place>>5] & BKN_DNX_BIT(place & 0x0000001F); + if (result) + { + bit_indicator = 1; + } else { + bit_indicator = 0; + } + *output_value |= bit_indicator << field_bit_i; + } + return; +} + +static void +bkn_dnx_packet_parse_ftmh(uint8_t hdr_buff[], bkn_dnx_packet_info *packet_info) +{ + uint32_t header_ptr = 0; + uint32_t dsp_ext_exist=0; + uint32_t fld_val; + + header_ptr = packet_info->ntwrk_header_ptr; + + /* Packet-size */ + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_FTMH_PKT_SIZE_MSB, + BKN_DNX_FTMH_PKT_SIZE_NOF_BITS, + &fld_val); + packet_info->ftmh.packet_size = fld_val; + /* Traffic-class */ + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_FTMH_TC_MSB, + BKN_DNX_FTMH_TC_NOF_BITS, + &fld_val); + packet_info->ftmh.prio = fld_val; + /* Source-system-port-aggregate */ + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_FTMH_SRC_SYS_PORT_MSB, + BKN_DNX_FTMH_SRC_SYS_PORT_NOF_BITS, + &fld_val); + packet_info->ftmh.src_sys_port = fld_val; + /* TM-action-type */ + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_FTMH_ACTION_TYPE_MSB, + BKN_DNX_FTMH_ACTION_TYPE_NOF_BITS, + &fld_val); + packet_info->ftmh.action_type = fld_val; + /* PPH-type */ + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_FTMH_PPH_TYPE_MSB, + BKN_DNX_FTMH_PPH_TYPE_NOF_BITS, + &fld_val); + packet_info->ftmh.pph_type = fld_val; + + packet_info->ntwrk_header_ptr += BKN_DNX_FTMH_SIZE_BYTE; + DBG_DUNE(("FTMH(%d) Packet-size %d Action-type %d PPH-type %d Source-system-port 0x%x Traffic-class %d\n", + packet_info->ntwrk_header_ptr, packet_info->ftmh.packet_size, packet_info->ftmh.action_type, + packet_info->ftmh.pph_type, packet_info->ftmh.src_sys_port, packet_info->ftmh.prio)); + + /* LB-Key ext */ + if (ftmh_lb_key_ext) + { + packet_info->ntwrk_header_ptr += BKN_DNX_FTMH_LB_EXT_SIZE_BYTE; + DBG_DUNE(("FTMH(%d) FTMH LB-Key Extension is present\n", packet_info->ntwrk_header_ptr)); + } + /* DSP ext*/ + fld_val = 0; + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_FTMH_EXT_DSP_EXIST_MSB, + BKN_DNX_FTMH_EXT_DSP_EXIST_NOF_BITS, + &dsp_ext_exist); + if (dsp_ext_exist) + { + packet_info->ntwrk_header_ptr += BKN_DNX_FTMH_DEST_EXT_SIZE_BYTE; + DBG_DUNE(("FTMH(%d) DSP Extension is present\n", packet_info->ntwrk_header_ptr)); + } + /* stacking ext */ + if (ftmh_stacking_ext) + { + packet_info->ntwrk_header_ptr += BKN_DNX_FTMH_STACKING_SIZE_BYTE; + DBG_DUNE(("FTMH(%d) FTMH Stacking Extension is present\n", packet_info->ntwrk_header_ptr)); + } + return; +} + +static void +bkn_dnx_packet_parse_internal(uint8_t hdr_buff[], bkn_dnx_packet_info *packet_info) +{ + uint32_t header_ptr = 0; + uint32_t fld_val; + uint32_t eei_extension_present = 0; + uint32_t learn_extension_present = 0; + uint32_t fhei_size = 0; + uint32_t forward_code; + uint8_t is_trapped = 0; + + header_ptr = packet_info->ntwrk_header_ptr; + + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_PPH_EEI_EXTENSION_PRESENT_MSB, + BKN_DNX_PPH_EEI_EXTENSION_PRESENT_NOF_BITS, + &eei_extension_present); + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_PPH_LEARN_EXENSION_PRESENT_MSB, + BKN_DNX_PPH_LEARN_EXENSION_PRESENT_NOF_BITS, + &learn_extension_present); + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_PPH_FHEI_SIZE_MSB, + BKN_DNX_PPH_FHEI_SIZE_NOF_BITS, + &fhei_size); + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_PPH_FORWARD_CODE_MSB, + BKN_DNX_PPH_FORWARD_CODE_NOF_BITS, + &forward_code); + /* 7: CPU-Trap */ + is_trapped = (uint8_t)(forward_code == 7); + + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_PPH_VSI_MSB, + BKN_DNX_PPH_VSI_NOF_BITS, + &fld_val); + packet_info->internal.vsi = fld_val; + + /* size of PPH base is 7 */ + packet_info->ntwrk_header_ptr += BKN_DNX_PPH_SIZE_BYTE; + header_ptr = packet_info->ntwrk_header_ptr; + + DBG_DUNE(("PPH(%d) Forward-Code %d EEI-Extension %d Learn-Extension %d VSI %d FHEI-size %d\n", packet_info->ntwrk_header_ptr, + forward_code, eei_extension_present, learn_extension_present, packet_info->internal.vsi, fhei_size)); + + /* PPH extension */ + if (is_trapped && (fhei_size == 1)) + { + /* CPU trap code qualifier */ + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_QUALIFIER_MSB, + BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_QUALIFIER_NOF_BITS, + &fld_val); + packet_info->internal.trap_qualifier = fld_val; + /* CPU trap code */ + bkn_dnx_bitstream_get_field( + &hdr_buff[header_ptr], + BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_MSB, + BKN_DNX_PPH_FHEI_TRAP_SNOOP_3B_CPU_TRAP_CODE_NOF_BITS, + &fld_val); + packet_info->internal.trap_id = fld_val; + } + switch(fhei_size) { + case 1: + packet_info->ntwrk_header_ptr += BKN_DNX_PPH_FHEI_3B_SIZE_BYTE; + break; + case 2: + packet_info->ntwrk_header_ptr += BKN_DNX_PPH_FHEI_5B_SIZE_BYTE; + break; + case 3: + packet_info->ntwrk_header_ptr += BKN_DNX_PPH_FHEI_8B_SIZE_BYTE; + break; + default: + break; + } + if (eei_extension_present) { + packet_info->ntwrk_header_ptr += BKN_DNX_PPH_EXPLICIT_EDITING_INFOMATION_EXTENSION_SIZE_BYTE; + } + if (learn_extension_present) { + packet_info->ntwrk_header_ptr += BKN_DNX_PPH_LEARN_EXTENSION_SIZE_BYTE; + } + + DBG_DUNE(("FHEI(%d) trap_qualifier 0x%x trap_id 0x%x\n", packet_info->ntwrk_header_ptr, packet_info->internal.trap_qualifier, packet_info->internal.trap_id)); + return; +} + +static int +bkn_dnx_packet_header_parse(uint8 *buff, uint32_t buff_len, bkn_dnx_packet_info *packet_info) +{ + uint8_t hdr_buff[BKN_DNX_HDR_MAX_SIZE]; + uint32_t hdr_size; + uint8_t has_internal = 0; + + if ((buff == NULL) || (packet_info == NULL)) { + return -1; + } + hdr_size = buff_len < BKN_DNX_HDR_MAX_SIZE ? buff_len: BKN_DNX_HDR_MAX_SIZE; + memcpy(hdr_buff, buff, hdr_size); + + /* FTMH */ + bkn_dnx_packet_parse_ftmh(hdr_buff, packet_info); + if (packet_info->ftmh.packet_size != (buff_len + 2)) { + DBG_DUNE(("FTMH packet size verfication failed, %d-%d\n", packet_info->ftmh.packet_size, buff_len)); + memset(packet_info, 0, sizeof(bkn_dnx_packet_info)); + return -1; + } + switch (packet_info->ftmh.pph_type) { + case 0: + has_internal = 0; + break; + case 1: + has_internal = 1; + break; + case 2: /* PPH OAM-TS only */ + case 3: /* PPH Base + OAM-TS */ + /* OTSH immediately follows the FTMH when present */ + packet_info->ntwrk_header_ptr += 6; + DBG_DUNE(("FTMH + OAM-TS(%d)\n", packet_info->ntwrk_header_ptr)); + has_internal = 1; + break; + default: + break; + } + + if (has_internal) { + bkn_dnx_packet_parse_internal(&hdr_buff[0], packet_info); + } + + /* FIXME: */ + /* ignore packets with a double set of FTMH,internals */ + /* ignore the user header size */ + return 0; +} + +static int +bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget) +{ + bkn_priv_t *priv; + bkn_dcb_chain_t *dcb_chain; + struct sk_buff *skb; + bkn_filter_t cbf; + bkn_filter_t *filter; + uint32_t *dcb; + uint8_t *pkt; + int ethertype; + int pktlen; + int drop_api; + int idx; + int dcbs_done; + bkn_dnx_packet_info packet_info = {0}; + dcbs_done = 0; + + dcb_chain = sinfo->rx[chan].api_dcb_chain; + if (dcb_chain == NULL) { + /* No active chains */ + return 0; + } + + while (dcb_chain->dcb_cur < dcb_chain->dcb_cnt) { + dcb = &dcb_chain->dcb_mem[dcb_chain->dcb_cur * sinfo->dcb_wsize]; + DBG_VERB(("DCB %2d: 0x%08x\n", + dcb_chain->dcb_cur, dcb[sinfo->dcb_wsize-1])); + if ((dcb[sinfo->dcb_wsize-1] & (1 << 31)) == 0) { + break; + } + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + /* Handle for Continuous DMA mode */ + if (dcbs_done >= budget) { + break; + } + if (dcb[1] & (1 << 18)) { + dcb[sinfo->dcb_wsize - 1] |= SOC_DCB_KNET_DONE; + bkn_api_rx_chain_done(sinfo, chan); + dcb_chain = sinfo->rx[chan].api_dcb_chain; + if (dcb_chain == NULL) { + break; + } + continue; + } + } + if ((dcb[1] & (1 << 16)) == 0) { + sinfo->rx[chan].chain_complete = 1; + } + sinfo->rx[chan].pkts++; + pkt = (uint8_t *)kernel_bde->p2l(sinfo->dev_no, dcb[0]); + pktlen = dcb[sinfo->dcb_wsize-1] & SOC_DCB_KNET_COUNT_MASK; + bkn_dump_pkt(pkt, 32, XGS_DMA_RX_CHAN); + + if (device_is_dune(sinfo)) { + uint16_t tpid = 0; + uint16_t vid = 0; + int res = -1; + + memset(&packet_info, 0, sizeof(bkn_dnx_packet_info)); + res = bkn_dnx_packet_header_parse(pkt, (uint32_t)pktlen, &packet_info); + if (res == 0) { + if (packet_info.ftmh.action_type == 0x2) { + bkn_dnx_bitstream_set_field((uint32_t *)dcb, 192, 32, 0x8); + } else if (packet_info.ftmh.action_type == 0x1) { + bkn_dnx_bitstream_set_field((uint32_t *)dcb, 231, 25, 0x20); + } + bkn_dnx_bitstream_set_field((uint32_t *)dcb, 112, 16, packet_info.ftmh.src_sys_port); + bkn_dnx_bitstream_set_field((uint32_t *)dcb, 296, 12, packet_info.internal.vsi); + bkn_dnx_bitstream_set_field((uint32_t *)dcb, 64, 32, (packet_info.internal.trap_id << 16 | packet_info.internal.trap_qualifier)); + pkt += packet_info.ntwrk_header_ptr; + pktlen -= packet_info.ntwrk_header_ptr; + bkn_dump_pkt(pkt, 32, XGS_DMA_RX_CHAN); + /* check if vlan tag exists */ + tpid = (uint16_t)((pkt[12] << 8) | pkt[13]); + vid = (uint16_t)(packet_info.internal.vsi & 0xfff); + if (packet_is_untagged(tpid)) { + if ((pktlen + 4) < rx_buffer_size) { + DBG_DUNE(("add vlan tag (%d) to untagged packets\n", vid)); + for (idx = (pktlen-1); idx >= 12; idx--) { + pkt[idx+4] = pkt[idx]; + } + pkt[12] = 0x81; + pkt[13] = 0x00; + pkt[14] = (vid >> 8); + pkt[15] = (vid & 0xff); + /* reset packet length in DCB */ + pktlen += 4; + dcb[sinfo->dcb_wsize-1] &= ~SOC_DCB_KNET_COUNT_MASK; + dcb[sinfo->dcb_wsize-1] |= ((pktlen + packet_info.ntwrk_header_ptr) & SOC_DCB_KNET_COUNT_MASK); + bkn_dump_pkt(pkt, 32, XGS_DMA_RX_CHAN); + } + } + } + } + filter = bkn_match_rx_pkt(sinfo, dcb, pkt, chan, &cbf); + if ((dcb[sinfo->dcb_wsize-1] & 0x70000) != 0x30000) { + /* Fragment or error */ + if (filter && filter->kf.mask.w[sinfo->dcb_wsize-1] == 0) { + /* Drop unless DCB status is part of filter */ + filter = NULL; + } + } + drop_api = 1; + if (filter) { + DBG_FLTR(("Match filter ID %d\n", filter->kf.id)); + switch (filter->kf.dest_type) { + case KCOM_DEST_T_API: + DBG_FLTR(("Send to Rx API\n")); + sinfo->rx[chan].pkts_f_api++; + drop_api = 0; + break; + case KCOM_DEST_T_NETIF: + priv = bkn_netif_lookup(sinfo, filter->kf.dest_id); + if (priv) { + /* Check that software link is up */ + if (!netif_carrier_ok(priv->dev)) { + sinfo->rx[chan].pkts_d_no_link++; + break; + } + + /* Add 2 bytes for IP header alignment (see below) */ + skb = dev_alloc_skb(pktlen + RCPU_RX_ENCAP_SIZE + 2); + if (skb == NULL) { + sinfo->rx[chan].pkts_d_no_skb++; + break; + } + skb_reserve(skb, RCPU_RX_ENCAP_SIZE); + + DBG_FLTR(("Send to netif %d (%s)\n", + priv->id, priv->dev->name)); + sinfo->rx[chan].pkts_f_netif++; + skb->dev = priv->dev; + skb_reserve(skb, 2); /* 16 byte align the IP fields. */ + + /* Save for RCPU before stripping tag */ + ethertype = (pkt[16] << 8) | pkt[17]; + if ((priv->flags & KCOM_NETIF_F_KEEP_RX_TAG) == 0) { + if (filter->kf.flags & KCOM_FILTER_F_STRIP_TAG) { + /* Strip the VLAN tag */ + uint16_t vlan_proto = (uint16_t)((pkt[12] << 8) | pkt[13]); + if (vlan_proto == 0x8100 || vlan_proto == 0x88a8) { + DBG_FLTR(("Strip VLAN tag\n")); + for (idx = 11; idx >= 0; idx--) { + pkt[idx+4] = pkt[idx]; + } + pktlen -= 4; + pkt += 4; + } + } + } + + skb_copy_to_linear_data(skb, pkt, pktlen); + if (device_is_dune(sinfo)) { + /* CRC has been stripped */ + skb_put(skb, pktlen); + } else { + skb_put(skb, pktlen - 4); /* Strip CRC */ + } + priv->stats.rx_packets++; + priv->stats.rx_bytes += pktlen; + + /* Optional SKB updates */ + if (knet_rx_cb != NULL) { + KNET_SKB_CB(skb)->netif_user_data = priv->cb_user_data; + KNET_SKB_CB(skb)->filter_user_data = filter->kf.cb_user_data; + KNET_SKB_CB(skb)->dcb_type = sinfo->dcb_type & 0xFFFF; + skb = knet_rx_cb(skb, sinfo->dev_no, dcb); + if (skb == NULL) { + /* Consumed by call-back */ + sinfo->rx[chan].pkts_d_callback++; + break; + } + } + + if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { + bkn_add_rcpu_encap(sinfo, skb, dcb); + } + skb->protocol = eth_type_trans(skb, skb->dev); + if (filter->kf.dest_proto) { + skb->protocol = filter->kf.dest_proto; + } + if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { + bkn_eth_type_update(skb, ethertype); + } + DBG_DUNE(("skb protocol 0x%04x\n",skb->protocol)); + + /* Unlock while calling up network stack */ + spin_unlock(&sinfo->lock); + if (use_napi) { + netif_receive_skb(skb); + } else { + netif_rx(skb); + } + spin_lock(&sinfo->lock); + + if (filter->kf.mirror_type == KCOM_DEST_T_API || + dbg_pkt_enable) { + DBG_FLTR(("Mirror to Rx API\n")); + sinfo->rx[chan].pkts_m_api++; + drop_api = 0; + } + } else { + DBG_FLTR(("Unknown netif %d\n", + filter->kf.dest_id)); + sinfo->rx[chan].pkts_d_unkn_netif++; + } + break; + default: + /* Drop packet */ + DBG_FLTR(("Unknown dest type %d\n", + filter->kf.dest_type)); + sinfo->rx[chan].pkts_d_unkn_dest++; + break; + } + } + if (drop_api) { + /* If count is zero, the DCB will just be recycled */ + dcb[sinfo->dcb_wsize-1] &= ~SOC_DCB_KNET_COUNT_MASK; + } + dcb[sinfo->dcb_wsize-1] |= SOC_DCB_KNET_DONE; + dcb_chain->dcb_cur++; + dcbs_done++; + } + + return dcbs_done; +} + +static int +bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) +{ + bkn_priv_t *priv; + bkn_desc_info_t *desc; + struct sk_buff *skb; + bkn_filter_t cbf; + bkn_filter_t *filter; + uint32_t *dcb; + int ethertype; + int dcbs_done; + int pktlen; + bkn_dnx_packet_info packet_info = {0}; + int idx; + + dcbs_done = 0; + + if (!sinfo->rx[chan].running) { + /* Rx not ready */ + return 0; + } + + while (dcbs_done < budget) { + char str[32]; + sprintf(str, "Rx DCB (%d)", sinfo->rx[chan].dirty); + desc = &sinfo->rx[chan].desc[sinfo->rx[chan].dirty]; + dcb = desc->dcb_mem; + bkn_dump_dcb(str, dcb, sinfo->dcb_wsize, XGS_DMA_RX_CHAN); + if ((dcb[sinfo->dcb_wsize-1] & (1 << 31)) == 0) { + break; + } + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + /* DMA run to the new halt location */ + bkn_cdma_goto(sinfo, XGS_DMA_RX_CHAN + chan, desc->dcb_dma); + } + if ((dcb[1] & (1 << 16)) == 0) { + sinfo->rx[chan].chain_complete = 1; + /* Request one extra poll to check for chain done interrupt */ + if (sinfo->napi_poll_mode) { + sinfo->napi_poll_again = 1; + } + } + sinfo->rx[chan].pkts++; + pktlen = dcb[sinfo->dcb_wsize-1] & 0xffff; + priv = netdev_priv(sinfo->dev); + skb = desc->skb; + DBG_DCB_RX(("Rx%d SKB DMA done (%d).\n", chan, sinfo->rx[chan].dirty)); + DMA_UNMAP_SINGLE(sinfo->dma_dev, + desc->skb_dma, desc->dma_size, + DMA_FROMDEV); + desc->skb_dma = 0; + bkn_dump_pkt(skb->data, 32, XGS_DMA_RX_CHAN); + if (device_is_dune(sinfo)) { + uint16_t tpid = 0; + uint16_t vid = 0; + uint8_t *pkt = skb->data; + int res = 0; + + memset(&packet_info, 0, sizeof(bkn_dnx_packet_info)); + res = bkn_dnx_packet_header_parse(pkt, (uint32_t)pktlen, &packet_info); + if (res == 0) { + if (packet_info.ftmh.action_type == 0x2) { + bkn_dnx_bitstream_set_field((uint32_t *)dcb, 192, 32, 0x8); + } else if (packet_info.ftmh.action_type == 0x1) { + bkn_dnx_bitstream_set_field((uint32_t *)dcb, 231, 25, 0x20); + } + bkn_dnx_bitstream_set_field((uint32_t *)dcb, 112, 16, packet_info.ftmh.src_sys_port); + bkn_dnx_bitstream_set_field((uint32_t *)dcb, 296, 12, packet_info.internal.vsi); + bkn_dnx_bitstream_set_field((uint32_t *)dcb, 64, 32, (packet_info.internal.trap_id << 16 | packet_info.internal.trap_qualifier)); + pkt = skb->data + packet_info.ntwrk_header_ptr; + /* check if vlan tag exists */ + tpid = (uint16_t)((pkt[12] << 8) | pkt[13]); + vid = (uint16_t)(packet_info.internal.vsi & 0xfff); + if (packet_is_untagged(tpid)) { + if ((pktlen + 4) < rx_buffer_size) { + DBG_DUNE(("add vlan tag to untagged packets\n")); + for (idx = (pktlen-packet_info.ntwrk_header_ptr-1); idx >= 12; idx--) { + pkt[idx+4] = pkt[idx]; + } + pkt[12] = 0x81; + pkt[13] = 0x00; + pkt[14] = (vid >> 8); + pkt[15] = (vid & 0xff); + pktlen += 4; + /* reset packet length in DCB */ + dcb[sinfo->dcb_wsize-1] &= ~SOC_DCB_KNET_COUNT_MASK; + dcb[sinfo->dcb_wsize-1] |= (pktlen & SOC_DCB_KNET_COUNT_MASK); + bkn_dump_pkt(pkt, 32, XGS_DMA_RX_CHAN); + } + } + } + } + if (device_is_dune(sinfo)) { + filter = bkn_match_rx_pkt(sinfo, dcb, (skb->data + packet_info.ntwrk_header_ptr), chan, &cbf); + } else { + filter = bkn_match_rx_pkt(sinfo, dcb, skb->data, chan, &cbf); + } + if ((dcb[sinfo->dcb_wsize-1] & 0x70000) == 0x30000) { + DBG_PKT(("Rx packet (%d bytes).\n", pktlen)); + } else { + /* Fragment or error */ + priv->stats.rx_errors++; + if (filter && filter->kf.mask.w[sinfo->dcb_wsize-1] == 0) { + /* Drop unless DCB status is part of filter */ + filter = NULL; + } + } + if (filter) { + DBG_FLTR(("Match filter ID %d\n", filter->kf.id)); + switch (filter->kf.dest_type) { + case KCOM_DEST_T_API: + DBG_FLTR(("Send to Rx API\n")); + sinfo->rx[chan].pkts_f_api++; + bkn_api_rx_copy_from_skb(sinfo, chan, desc); + break; + case KCOM_DEST_T_NETIF: + priv = bkn_netif_lookup(sinfo, filter->kf.dest_id); + if (priv) { + /* Check that software link is up */ + if (!netif_carrier_ok(priv->dev)) { + sinfo->rx[chan].pkts_d_no_link++; + break; + } + DBG_FLTR(("Send to netif %d (%s)\n", + priv->id, priv->dev->name)); + sinfo->rx[chan].pkts_f_netif++; + + if (device_is_dune(sinfo)) { + if (filter->kf.mirror_type == KCOM_DEST_T_API) { + sinfo->rx[chan].pkts_m_api++; + bkn_api_rx_copy_from_skb(sinfo, chan, desc); + } + /* Strip Dune headers */ + skb->data += packet_info.ntwrk_header_ptr; + pktlen -= packet_info.ntwrk_header_ptr; + bkn_dump_pkt(skb->data, 32, XGS_DMA_RX_CHAN); + /* CRC has been stripped on Dune*/ + skb_put(skb, pktlen); + } else { + skb_put(skb, pktlen - 4); /* Strip CRC */ + } + + /* Save for RCPU before stripping tag */ + ethertype = (skb->data[16] << 8) | skb->data[17]; + + if ((priv->flags & KCOM_NETIF_F_KEEP_RX_TAG) == 0) { + if (filter->kf.flags & KCOM_FILTER_F_STRIP_TAG) { + /* Strip VLAN tag */ + uint16_t vlan_proto = (uint16_t)((skb->data[12] << 8) | skb->data[13]); + if (vlan_proto == 0x8100 || vlan_proto == 0x88a8) { + DBG_FLTR(("Strip VLAN tag\n")); + ((u32*)skb->data)[3] = ((u32*)skb->data)[2]; + ((u32*)skb->data)[2] = ((u32*)skb->data)[1]; + ((u32*)skb->data)[1] = ((u32*)skb->data)[0]; + skb_pull(skb, 4); + pktlen -= 4; + } + } + } + priv->stats.rx_packets++; + priv->stats.rx_bytes += pktlen; + skb->dev = priv->dev; + + /* Optional SKB updates */ + if (knet_rx_cb != NULL) { + KNET_SKB_CB(skb)->netif_user_data = priv->cb_user_data; + KNET_SKB_CB(skb)->filter_user_data = filter->kf.cb_user_data; + KNET_SKB_CB(skb)->dcb_type = sinfo->dcb_type & 0xFFFF; + skb = knet_rx_cb(skb, sinfo->dev_no, dcb); + if (skb == NULL) { + /* Consumed by call-back */ + sinfo->rx[chan].pkts_d_callback++; + priv->stats.rx_dropped++; + desc->skb = NULL; + desc->skb_dma = 0; + break; + } + } + + if (((filter->kf.mirror_type == KCOM_DEST_T_API) && + (!device_is_dune(sinfo))) || dbg_pkt_enable) { + sinfo->rx[chan].pkts_m_api++; + bkn_api_rx_copy_from_skb(sinfo, chan, desc); + } + + if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { + bkn_add_rcpu_encap(sinfo, skb, dcb); + } + skb->protocol = eth_type_trans(skb, skb->dev); + if (filter->kf.dest_proto) { + skb->protocol = filter->kf.dest_proto; + } + if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { + bkn_eth_type_update(skb, ethertype); + } + DBG_DUNE(("skb protocol 0x%04x\n",skb->protocol)); + if (filter->kf.mirror_type == KCOM_DEST_T_NETIF) { + bkn_priv_t *mpriv; + struct sk_buff *mskb; + mpriv = bkn_netif_lookup(sinfo, filter->kf.mirror_id); + if (mpriv && netif_carrier_ok(mpriv->dev)) { + mskb = skb_clone(skb, GFP_ATOMIC); + if (mskb == NULL) { + sinfo->rx[chan].pkts_d_no_skb++; + } else { + sinfo->rx[chan].pkts_m_netif++; + mpriv->stats.rx_packets++; + mpriv->stats.rx_bytes += pktlen; + skb->dev = mpriv->dev; + if (filter->kf.mirror_proto) { + skb->protocol = filter->kf.mirror_proto; + } + /* Unlock while calling up network stack */ + spin_unlock(&sinfo->lock); + if (use_napi) { + netif_receive_skb(mskb); + } else { + netif_rx(mskb); + } + spin_lock(&sinfo->lock); + } + } + } + + /* Unlock while calling up network stack */ + spin_unlock(&sinfo->lock); + if (use_napi) { + netif_receive_skb(skb); + } else { + netif_rx(skb); + } + spin_lock(&sinfo->lock); + + /* Ensure that we reallocate SKB for this DCB */ + desc->skb = NULL; + desc->skb_dma = 0; + } else { + DBG_FLTR(("Unknown netif %d\n", + filter->kf.dest_id)); + sinfo->rx[chan].pkts_d_unkn_netif++; + } + } + } else { + DBG_PKT(("Rx packet dropped.\n")); + sinfo->rx[chan].pkts_d_no_match++; + priv->stats.rx_dropped++; + } + dcb[sinfo->dcb_wsize-1] = 0; + if (++sinfo->rx[chan].dirty >= MAX_RX_DCBS) { + sinfo->rx[chan].dirty = 0; + } + sinfo->rx[chan].free--; + dcbs_done++; + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + /* Right now refill for Continuous DMA mode */ + bkn_rx_refill(sinfo, chan); + if (sinfo->rx[chan].tokens < MAX_RX_DCBS) { + break; + } + } + } + + return dcbs_done; +} + +static int +bkn_do_rx(bkn_switch_info_t *sinfo, int chan, int budget) +{ + if (sinfo->rx[chan].use_rx_skb == 0) { + /* Rx buffers are provided by BCM Rx API */ + return bkn_do_api_rx(sinfo, chan, budget); + } else { + /* Rx buffers are provided by Linux kernel */ + return bkn_do_skb_rx(sinfo, chan, budget); + } +} + +static void +bkn_rx_desc_done(bkn_switch_info_t *sinfo, int chan) +{ + bkn_evt_resource_t *evt; + evt = &_bkn_evt[sinfo->evt_idx]; + DBG_IRQ(("Rx%d desc done\n", chan)); + + if (sinfo->rx[chan].use_rx_skb == 0) { + sinfo->dma_events |= KCOM_DMA_INFO_F_RX_DONE; + evt->evt_wq_put++; + wake_up_interruptible(&evt->evt_wq); + } +} + +static void +bkn_rx_chain_done(bkn_switch_info_t *sinfo, int chan) +{ + DBG_IRQ(("Rx%d chain done\n", chan)); + + if (sinfo->rx[chan].chain_complete == 0) { + /* + * In certain environments the DCB memory is updated after + * the corresponding interrupt has been received. + * The following code will ensure that this situation is + * handled properly. + */ + int maxloop = 0; + while (sinfo->rx[chan].chain_complete == 0) { + sinfo->rx[chan].sync_retry++; + if (maxloop == 0) { + sinfo->rx[chan].sync_err++; + } + if (maxloop > sinfo->rx[chan].sync_maxloop) { + sinfo->rx[chan].sync_maxloop = maxloop; + } + if (bkn_do_rx(sinfo, chan, MAX_RX_DCBS) > 0) { + bkn_rx_desc_done(sinfo, chan); + } + if (++maxloop > rx_sync_retry) { + gprintk("Fatal error: Incomplete chain\n"); + sinfo->rx[chan].chain_complete = 1; + break; + } + } + } + + sinfo->rx[chan].running = 0; + + if (sinfo->rx[chan].use_rx_skb == 0) { + bkn_api_rx_chain_done(sinfo, chan); + } else { + bkn_rx_refill(sinfo, chan); + + if (bkn_rx_restart(sinfo, chan) != 0) { + /* Presumably out of resources */ + sinfo->timer.expires = jiffies + 1; + if (!sinfo->timer_queued) { + sinfo->timer_queued = 1; + add_timer(&sinfo->timer); + } + } + } +} + +static void +bkn_suspend_tx(bkn_switch_info_t *sinfo) +{ + struct list_head *list; + bkn_priv_t *priv = netdev_priv(sinfo->dev); + + /* Stop main device */ + netif_stop_queue(priv->dev); + sinfo->tx.suspends++; + /* Stop associated virtual devices */ + list_for_each(list, &sinfo->ndev_list) { + priv = (bkn_priv_t *)list; + netif_stop_queue(priv->dev); + } +} + +static void +bkn_resume_tx(bkn_switch_info_t *sinfo) +{ + struct list_head *list; + bkn_priv_t *priv = netdev_priv(sinfo->dev); + + /* Check main device */ + if (netif_queue_stopped(priv->dev) && sinfo->tx.free > 1) { + netif_wake_queue(priv->dev); + } + /* Check associated virtual devices */ + list_for_each(list, &sinfo->ndev_list) { + priv = (bkn_priv_t *)list; + if (netif_queue_stopped(priv->dev) && sinfo->tx.free > 1) { + netif_wake_queue(priv->dev); + } + } +} + +static int +bkn_do_tx(bkn_switch_info_t *sinfo) +{ + bkn_desc_info_t *desc; + int dcbs_done = 0; + + if (!CDMA_CH(sinfo, XGS_DMA_TX_CHAN) && sinfo->tx.api_active) { + return dcbs_done; + } + + while (dcbs_done < MAX_TX_DCBS) { + char str[32]; + if (sinfo->tx.free == MAX_TX_DCBS) { + break; + } + sprintf(str, "Tx DCB (%d)", sinfo->tx.dirty); + desc = &sinfo->tx.desc[sinfo->tx.dirty]; + bkn_dump_dcb(str, desc->dcb_mem, sinfo->dcb_wsize, XGS_DMA_TX_CHAN); + if ((desc->dcb_mem[sinfo->dcb_wsize-1] & (1 << 31)) == 0) { + break; + } + if (desc->skb) { + DBG_DCB_TX(("Tx SKB DMA done (%d).\n", sinfo->tx.dirty)); + DMA_UNMAP_SINGLE(sinfo->dma_dev, + desc->skb_dma, desc->dma_size, + DMA_TODEV); + dev_kfree_skb_any(desc->skb); + desc->skb = NULL; + desc->skb_dma = 0; + } + desc->dcb_mem[sinfo->dcb_wsize-1] = 0; + if (++sinfo->tx.dirty >= MAX_TX_DCBS) { + sinfo->tx.dirty = 0; + } + if (++sinfo->tx.free > MAX_TX_DCBS) { + gprintk("Too many free Tx DCBs(%d).\n", sinfo->tx.free); + } + dcbs_done++; + } + + return dcbs_done; +} + +static void +bkn_tx_cdma_chain_switch(bkn_switch_info_t *sinfo) +{ + bkn_dcb_chain_t *dcb_chain = sinfo->tx.api_dcb_chain; + uint32_t *dcb_mem; + dma_addr_t dcb_dma; + int woffset; + + /* Switch between SKB Tx and API Tx for Continuous DMA mode */ + if (!sinfo->tx.api_active) { + /* + * Set the current SKB DCB as reload DCB and the last DCB of + * the pending API chain as the new halt location. + */ + sinfo->tx.api_active = 1; + dcb_mem = sinfo->tx.desc[sinfo->tx.cur].dcb_mem; + memset(dcb_mem, 0, sinfo->dcb_wsize * sizeof(uint32_t)); + dcb_mem[0] = dcb_chain->dcb_dma; + dcb_mem[1] |= (1 << 24) | (1 << 18) | (1 << 16); + if (++sinfo->tx.cur >= MAX_TX_DCBS) { + sinfo->tx.cur = 0; + } + sinfo->tx.free--; + woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize; + dcb_dma = dcb_chain->dcb_dma + woffset * sizeof(uint32_t); + /* DMA run to the new halt location */ + bkn_cdma_goto(sinfo, XGS_DMA_TX_CHAN, dcb_dma); + } else { + /* Only need to set the current SKB DCB as the new halt location */ + sinfo->tx.api_active = 0; + woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize; + dcb_mem = &dcb_chain->dcb_mem[woffset]; + dcb_mem[0] = sinfo->tx.desc[sinfo->tx.dirty].dcb_dma; + dcb_dma = sinfo->tx.desc[sinfo->tx.cur].dcb_dma; + /* DMA run to the new halt location */ + bkn_cdma_goto(sinfo, XGS_DMA_TX_CHAN, dcb_dma); + } +} + +static void +bkn_skb_tx(bkn_switch_info_t *sinfo) +{ + if (sinfo->tx.api_active) { + /* Switch from API Tx to SKB Tx */ + bkn_tx_cdma_chain_switch(sinfo); + } +} + +static void +bkn_api_tx(bkn_switch_info_t *sinfo) +{ + bkn_dcb_chain_t *dcb_chain; + + /* Assume that driver lock is held */ + if (list_empty(&sinfo->tx.api_dcb_list)) { + sinfo->tx.api_active = 0; + } else { + sinfo->tx.pkts++; + dcb_chain = list_entry(sinfo->tx.api_dcb_list.next, + bkn_dcb_chain_t, list); + DBG_DCB_TX(("Start API Tx DMA, first DCB @ 0x%08x (%d DCBs).\n", + (uint32_t)dcb_chain->dcb_dma, dcb_chain->dcb_cnt)); + + if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) { + sinfo->tx.api_dcb_chain = dcb_chain; + if (!sinfo->tx.api_active) { + /* Switch from SKB Tx to API Tx */ + bkn_tx_cdma_chain_switch(sinfo); + } + list_del(&dcb_chain->list); + } else { + sinfo->tx.api_active = 1; + dev_dma_chan_clear(sinfo, XGS_DMA_TX_CHAN); + dev_irq_mask_enable(sinfo, XGS_DMA_TX_CHAN, 1); + dev_dma_chan_start(sinfo, XGS_DMA_TX_CHAN, + dcb_chain->dcb_dma); + list_del(&dcb_chain->list); + kfree(dcb_chain); + } + } +} + +static void +bkn_tx_cdma_chain_done(bkn_switch_info_t *sinfo, int done) +{ + int woffset; + int dcbs_done = 0; + bkn_evt_resource_t *evt; + + evt = &_bkn_evt[sinfo->evt_idx]; + if (sinfo->tx.api_active) { + sinfo->dma_events |= KCOM_DMA_INFO_F_TX_DONE; + evt->evt_wq_put++; + wake_up_interruptible(&evt->evt_wq); + /* Drain API Tx chains */ + while (sinfo->tx.api_dcb_chain != sinfo->tx.api_dcb_chain_end) { + woffset = sinfo->tx.api_dcb_chain->dcb_cnt * sinfo->dcb_wsize - 1; + if (!(sinfo->tx.api_dcb_chain->dcb_mem[woffset] & (1 << 31))) { + return; + } + kfree(sinfo->tx.api_dcb_chain); + bkn_api_tx(sinfo); + if ((++dcbs_done + done) >= MAX_TX_DCBS) { + if (sinfo->napi_poll_mode) { + /* Request one extra poll to reschedule Tx */ + sinfo->napi_poll_again = 1; + } else { + /* Request to yield for Continuous DMA mode */ + sinfo->tx_yield = 1; + } + return; + } + } + woffset = (sinfo->tx.api_dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize - 1; + if (!(sinfo->tx.api_dcb_chain->dcb_mem[woffset] & (1 << 31))) { + return; + } + /* Try and park at SKB Tx if API Tx done */ + bkn_skb_tx(sinfo); + kfree(sinfo->tx.api_dcb_chain); + sinfo->tx.api_dcb_chain = NULL; + sinfo->tx.api_dcb_chain_end = NULL; + if (!sinfo->napi_poll_mode) { + /* Not need to yield for Continuous DMA mode */ + sinfo->tx_yield = 0; + } + } else { + if (sinfo->tx.free == MAX_TX_DCBS) { + /* Try API Tx if SKB Tx done */ + bkn_api_tx(sinfo); + if (sinfo->tx.api_active) { + return; + } + } + } + + /* Resume if netif Tx resources available and API Tx not active */ + bkn_resume_tx(sinfo); +} + +static void +bkn_tx_chain_done(bkn_switch_info_t *sinfo, int done) +{ + bkn_desc_info_t *desc; + int idx, pending; + bkn_evt_resource_t *evt; + + evt = &_bkn_evt[sinfo->evt_idx]; + + DBG_IRQ(("Tx chain done (%d/%d)\n", sinfo->tx.cur, sinfo->tx.dirty)); + + if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) { + return bkn_tx_cdma_chain_done(sinfo, done); + } + + dev_irq_mask_disable(sinfo, XGS_DMA_TX_CHAN, 0); + + if (sinfo->tx.api_active) { + sinfo->dma_events |= KCOM_DMA_INFO_F_TX_DONE; + evt->evt_wq_put++; + wake_up_interruptible(&evt->evt_wq); + /* Check if BCM API has more to send */ + bkn_api_tx(sinfo); + if (sinfo->tx.api_active) { + return; + } + } + + if (sinfo->tx.free == MAX_TX_DCBS) { + /* If netif Tx is idle then allow BCM API to send */ + bkn_api_tx(sinfo); + if (sinfo->tx.api_active) { + return; + } + } else { + /* If two or more DCBs are pending, chain them */ + pending = MAX_TX_DCBS - sinfo->tx.free; + idx = sinfo->tx.dirty; + while (--pending && idx < (MAX_TX_DCBS - 1)) { + sinfo->tx.desc[idx++].dcb_mem[1] |= (1 << 16); + DBG_DCB_TX(("Chain Tx DCB %d (%d)\n", idx, pending)); + } + /* Restart DMA from where we stopped */ + desc = &sinfo->tx.desc[sinfo->tx.dirty]; + DBG_DCB_TX(("Restart Tx DMA, DCB @ 0x%08x (%d).\n", + (uint32_t)desc->dcb_dma, sinfo->tx.dirty)); + dev_dma_chan_clear(sinfo, XGS_DMA_TX_CHAN); + dev_irq_mask_enable(sinfo, XGS_DMA_TX_CHAN, 0); + dev_dma_chan_start(sinfo, XGS_DMA_TX_CHAN, desc->dcb_dma); + } + + /* Resume if netif Tx resources available and API Tx not active */ + bkn_resume_tx(sinfo); +} + +static void +bkn_schedule_napi_poll(bkn_switch_info_t *sinfo) +{ + /* Schedule NAPI poll */ + DBG_NAPI(("Schedule NAPI poll on %s.\n", sinfo->dev->name)); + /* Disable interrupts until poll job is complete */ + sinfo->napi_poll_mode = 1; + /* Unlock while calling up network stack */ + spin_unlock(&sinfo->lock); + if (bkn_napi_schedule_prep(sinfo->dev, &sinfo->napi)) { + __bkn_napi_schedule(sinfo->dev, &sinfo->napi); + DBG_NAPI(("Schedule prep OK on %s.\n", sinfo->dev->name)); + } else { + /* Most likely the base device is has not been opened */ + gprintk("Warning: Unable to schedule NAPI - base device not up?\n"); + } + spin_lock(&sinfo->lock); +} + +static void +bkn_napi_poll_complete(bkn_switch_info_t *sinfo) +{ + /* Unlock while calling up network stack */ + spin_unlock(&sinfo->lock); + bkn_napi_complete(sinfo->dev, &sinfo->napi); + spin_lock(&sinfo->lock); + /* Re-enable interrupts */ + sinfo->napi_poll_mode = 0; + dev_irq_mask_set(sinfo, sinfo->irq_mask); +} + +static int +xgs_do_dma(bkn_switch_info_t *sinfo, int budget) +{ + int rx_dcbs_done = 0, tx_dcbs_done = 0; + uint32_t dma_stat; + int chan; + + DEV_READ32(sinfo, CMIC_DMA_STATr, &dma_stat); + + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + if (dma_stat & DS_DESC_DONE_TST(XGS_DMA_RX_CHAN + chan)) { + xgs_dma_desc_clear(sinfo, XGS_DMA_RX_CHAN + chan); + rx_dcbs_done += bkn_do_rx(sinfo, chan, budget - rx_dcbs_done); + bkn_rx_desc_done(sinfo, chan); + } + + if (dma_stat & DS_CHAIN_DONE_TST(XGS_DMA_RX_CHAN + chan)) { + xgs_dma_chain_clear(sinfo, XGS_DMA_RX_CHAN + chan); + bkn_rx_chain_done(sinfo, chan); + } + } + + if (dma_stat & DS_CHAIN_DONE_TST(XGS_DMA_TX_CHAN)) { + xgs_dma_chain_clear(sinfo, XGS_DMA_TX_CHAN); + tx_dcbs_done = bkn_do_tx(sinfo); + bkn_tx_chain_done(sinfo, tx_dcbs_done); + } + + return rx_dcbs_done; +} + +static int +xgsm_do_dma(bkn_switch_info_t *sinfo, int budget) +{ + int rx_dcbs_done = 0, tx_dcbs_done = 0; + uint32_t dma_stat, irq_stat = 0; + int chan; + + /* Get Controlled interrupt states for Continuous DMA mode */ + if (sinfo->cdma_channels) { + DEV_READ32(sinfo, CMICM_IRQ_STATr, &irq_stat); + } + + DEV_READ32(sinfo, CMICM_DMA_STATr, &dma_stat); + + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + if (dma_stat & (0x10 << (XGS_DMA_RX_CHAN + chan)) || + irq_stat & (0x08000000 << (XGS_DMA_RX_CHAN + chan))) { + xgsm_dma_desc_clear(sinfo, XGS_DMA_RX_CHAN + chan); + rx_dcbs_done += bkn_do_rx(sinfo, chan, budget - rx_dcbs_done); + bkn_rx_desc_done(sinfo, chan); + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } + } + + if (dma_stat & (0x1 << (XGS_DMA_RX_CHAN + chan))) { + xgsm_dma_chain_clear(sinfo, XGS_DMA_RX_CHAN + chan); + bkn_rx_chain_done(sinfo, chan); + } + } + + if (dma_stat & (0x1 << XGS_DMA_TX_CHAN) || + irq_stat & (0x08000000 << XGS_DMA_TX_CHAN)) { + if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) { + xgsm_dma_desc_clear(sinfo, XGS_DMA_TX_CHAN); + } else { + xgsm_dma_chain_clear(sinfo, XGS_DMA_TX_CHAN); + } + tx_dcbs_done = bkn_do_tx(sinfo); + bkn_tx_chain_done(sinfo, tx_dcbs_done); + } + + return rx_dcbs_done; +} + +static int +dev_do_dma(bkn_switch_info_t *sinfo, int budget) +{ + if (DEV_HAS_CMICM(sinfo)) { + return xgsm_do_dma(sinfo, budget); + } else { + return xgs_do_dma(sinfo, budget); + } +} + +static void +xgs_isr(bkn_switch_info_t *sinfo) +{ + uint32_t irq_stat; + int rx_dcbs_done; + + DEV_READ32(sinfo, CMIC_IRQ_STATr, &irq_stat); + if ((irq_stat & sinfo->irq_mask) == 0) { + /* Not ours */ + return; + } + sinfo->interrupts++; + + DBG_IRQ(("Got interrupt on device %d (0x%08x)\n", + sinfo->dev_no, irq_stat)); + + if (use_napi) { + bkn_schedule_napi_poll(sinfo); + } else { + xgs_irq_mask_set(sinfo, 0); + do { + rx_dcbs_done = xgs_do_dma(sinfo, MAX_RX_DCBS); + } while (rx_dcbs_done); + } + + xgs_irq_mask_set(sinfo, sinfo->irq_mask); +} + +static void +xgsm_isr(bkn_switch_info_t *sinfo) +{ + uint32_t irq_stat; + int rx_dcbs_done; + + DEV_READ32(sinfo, CMICM_IRQ_STATr, &irq_stat); + if ((irq_stat & sinfo->irq_mask) == 0) { + /* Not ours */ + return; + } + sinfo->interrupts++; + + DBG_IRQ(("Got interrupt on device %d (0x%08x)\n", + sinfo->dev_no, irq_stat)); + + if (use_napi) { + bkn_schedule_napi_poll(sinfo); + } else { + xgsm_irq_mask_set(sinfo, 0); + do { + rx_dcbs_done = xgsm_do_dma(sinfo, MAX_RX_DCBS); + if (sinfo->cdma_channels) { + if (rx_dcbs_done >= MAX_RX_DCBS || sinfo->tx_yield) { + /* Continuous DMA mode requires to yield timely */ + break; + } + } + } while (rx_dcbs_done); + } + + xgsm_irq_mask_set(sinfo, sinfo->irq_mask); +} + +static void +bkn_isr(void *isr_data) +{ + bkn_switch_info_t *sinfo = isr_data; + + /* Safe exit on SMP systems */ + if (!module_initialized) { + return; + } + + /* Ensure that we do not touch registers during device reset */ + if (sinfo->irq_mask == 0) { + /* Not ours */ + return; + } + + spin_lock(&sinfo->lock); + + if (sinfo->napi_poll_mode) { + /* Not ours */ + spin_unlock(&sinfo->lock); + return; + } + + if (DEV_HAS_CMICM(sinfo)) { + xgsm_isr(sinfo); + } else { + xgs_isr(sinfo); + } + + spin_unlock(&sinfo->lock); +} + +#ifdef CONFIG_NET_POLL_CONTROLLER +static void +bkn_poll_controller(struct net_device *dev) +{ + bkn_priv_t *priv = netdev_priv(dev); + + disable_irq(dev->irq); + bkn_isr(priv->sinfo); + enable_irq(dev->irq); +} +#endif + +static void +bkn_resume_rx(bkn_switch_info_t *sinfo) +{ + bkn_desc_info_t *desc; + bkn_dcb_chain_t *dcb_chain; + dma_addr_t cur_halt, last_dcb, dcb_dma; + int woffset, chan, cdma_running; + + /* Resume Rx DMA on all channels */ + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + if (sinfo->rx[chan].use_rx_skb) { + cdma_running = 0; + bkn_api_rx_restart(sinfo); + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + cur_halt = sinfo->halt_addr[XGS_DMA_RX_CHAN + chan]; + last_dcb = sinfo->rx[chan].desc[MAX_RX_DCBS].dcb_dma; + if (cur_halt != last_dcb) { + desc = &sinfo->rx[chan].desc[sinfo->rx[chan].dirty + 1]; + bkn_cdma_goto(sinfo, XGS_DMA_RX_CHAN + chan, + desc->dcb_dma); + cdma_running = 1; + } + } + if (!cdma_running) { + bkn_rx_restart(sinfo, chan); + } + } else { + cdma_running = 0; + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + if (sinfo->rx[chan].api_active) { + dcb_chain = sinfo->rx[chan].api_dcb_chain_end; + woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize; + dcb_dma = dcb_chain->dcb_dma + woffset * sizeof(uint32_t); + bkn_cdma_goto(sinfo, XGS_DMA_RX_CHAN + chan, dcb_dma); + cdma_running = 1; + } + } + if (!cdma_running) { + bkn_api_rx_restart(sinfo); + } + } + } +} + +static int +bkn_open(struct net_device *dev) +{ + bkn_priv_t *priv = netdev_priv(dev); + bkn_switch_info_t *sinfo = priv->sinfo; + unsigned long flags; + + /* Check if base device */ + if (priv->id <= 0) { + /* NAPI used only on base device */ + if (use_napi) { + bkn_napi_enable(dev, &sinfo->napi); + } + + /* Start DMA when base device is started */ + if (sinfo->basedev_suspended) { + spin_lock_irqsave(&sinfo->lock, flags); + dev_do_dma(sinfo, MAX_RX_DCBS); + sinfo->basedev_suspended = 0; + bkn_api_tx(sinfo); + if (!sinfo->tx.api_active) { + bkn_resume_tx(sinfo); + } + bkn_resume_rx(sinfo); + spin_unlock_irqrestore(&sinfo->lock, flags); + } + } + + if (!sinfo->basedev_suspended) { + netif_start_queue(dev); + } + + return 0; +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) +static int +bkn_set_mac_address(struct net_device *dev, void *addr) +{ + if (!is_valid_ether_addr(((struct sockaddr *)addr)->sa_data)) { + return -EINVAL; + } + memcpy(dev->dev_addr, ((struct sockaddr *)addr)->sa_data, dev->addr_len); + return 0; +} +#endif + +static int +bkn_change_mtu(struct net_device *dev, int new_mtu) +{ + if (new_mtu < 68 || new_mtu > rx_buffer_size) { + return -EINVAL; + } + dev->mtu = new_mtu; + return 0; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) +static int +bkn_poll(struct net_device *dev, int *budget) +{ + bkn_priv_t *priv = netdev_priv(dev); + bkn_switch_info_t *sinfo = priv->sinfo; + int cur_budget = *budget; + int poll_again = 0; + int rx_dcbs_done; + unsigned long flags; + + spin_lock_irqsave(&sinfo->lock, flags); + + DBG_NAPI(("NAPI poll on %s.\n", dev->name)); + + sinfo->napi_poll_again = 0; + + if (cur_budget > dev->quota) { + cur_budget = dev->quota; + } + + rx_dcbs_done = dev_do_dma(sinfo, cur_budget); + + *budget -= rx_dcbs_done; + cur_budget -= rx_dcbs_done; + dev->quota -= rx_dcbs_done; + + if (sinfo->napi_poll_again || cur_budget <= 0) { + poll_again = 1; + sinfo->napi_not_done++; + } else { + bkn_napi_poll_complete(sinfo); + } + + spin_unlock_irqrestore(&sinfo->lock, flags); + + return poll_again; +} +#else +static int +bkn_poll(struct napi_struct *napi, int budget) +{ + bkn_switch_info_t *sinfo = container_of(napi, bkn_switch_info_t, napi); + int rx_dcbs_done; + unsigned long flags; + + spin_lock_irqsave(&sinfo->lock, flags); + + DBG_NAPI(("NAPI poll on %s.\n", sinfo->dev->name)); + + sinfo->napi_poll_again = 0; + + rx_dcbs_done = dev_do_dma(sinfo, budget); + + if (sinfo->napi_poll_again || rx_dcbs_done >= budget) { + /* Force poll again */ + rx_dcbs_done = budget; + sinfo->napi_not_done++; + } else { + bkn_napi_poll_complete(sinfo); + } + + spin_unlock_irqrestore(&sinfo->lock, flags); + + return rx_dcbs_done; +} +#endif + +static int +bkn_stop(struct net_device *dev) +{ + bkn_priv_t *priv = netdev_priv(dev); + bkn_switch_info_t *sinfo = priv->sinfo; + unsigned long flags; + + netif_stop_queue(dev); + + /* Check if base device */ + if (priv->id <= 0) { + /* NAPI used only on base device */ + if (use_napi) { + bkn_napi_disable(dev, &sinfo->napi); + } + /* Suspend all devices if base device is stopped */ + if (basedev_suspend) { + spin_lock_irqsave(&sinfo->lock, flags); + bkn_suspend_tx(sinfo); + sinfo->basedev_suspended = 1; + spin_unlock_irqrestore(&sinfo->lock, flags); + } + } + + return 0; +} + +/* + * Network Device Statistics. + * Cleared at init time. + */ +static struct net_device_stats * +bkn_get_stats(struct net_device *dev) +{ + bkn_priv_t *priv = netdev_priv(dev); + + return &priv->stats; +} + +/* Fake multicast ability */ +static void +bkn_set_multicast_list(struct net_device *dev) +{ +} + +static int +bkn_tx(struct sk_buff *skb, struct net_device *dev) +{ + bkn_priv_t *priv = netdev_priv(dev); + bkn_switch_info_t *sinfo = priv->sinfo; + struct sk_buff *new_skb; + unsigned char *pktdata; + int pktlen; + int taglen; + int rcpulen; + int metalen; + int sop; + int idx; + uint16_t tpid; + uint32_t *metadata; + unsigned long flags; + + DBG_VERB(("Netif Tx: Len=%d\n", skb->len)); + + if (priv->id <= 0) { + /* Do not transmit on base device */ + priv->stats.tx_dropped++; + dev_kfree_skb_any(skb); + return 0; + } + + if (!netif_carrier_ok(dev)) { + DBG_WARN(("Tx drop: Invalid RCPU encapsulation\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_no_link++; + dev_kfree_skb_any(skb); + return 0; + } + + spin_lock_irqsave(&sinfo->lock, flags); + + if (sinfo->tx.free > 1) { + bkn_desc_info_t *desc = &sinfo->tx.desc[sinfo->tx.cur]; + uint32_t *dcb; + + pktdata = skb->data; + pktlen = skb->len + 4; + rcpulen = 0; + sop = 0; + + if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { + rcpulen = RCPU_HDR_SIZE; + if (skb->len < (rcpulen + 14)) { + DBG_WARN(("Tx drop: Invalid RCPU encapsulation\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_rcpu_encap++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + if (check_rcpu_signature && + ((skb->data[18] << 8) | skb->data[19]) != sinfo->rcpu_sig) { + DBG_WARN(("Tx drop: Invalid RCPU signature\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_rcpu_sig++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + if (skb->data[21] & RCPU_F_MODHDR) { + rcpulen += RCPU_TX_META_SIZE; + sop = skb->data[RCPU_HDR_SIZE]; + switch (sop) { + case 0xff: + case 0x81: + case 0xfb: + case 0xfc: + break; + default: + DBG_WARN(("Tx drop: Invalid RCPU meta data\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_rcpu_meta++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + } + /* Skip over RCPU encapsulation */ + pktdata = &skb->data[rcpulen]; + pktlen -= rcpulen; + + /* CPU packets require tag */ + if (sop == 0) { + tpid = (pktdata[12] << 8) | pktdata[13]; + if (tpid != 0x8100) { + if (skb_header_cloned(skb)) { + /* Current SKB cannot be modified */ + DBG_SKB(("Realloc Tx SKB\n")); + new_skb = dev_alloc_skb(pktlen + 4); + if (new_skb == NULL) { + DBG_WARN(("Tx drop: No SKB memory\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_no_skb++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + memcpy(new_skb->data, pktdata, 12); + memcpy(&new_skb->data[16], &pktdata[12], pktlen - 12); + skb_put(new_skb, pktlen + 4); + dev_kfree_skb_any(skb); + skb = new_skb; + pktdata = skb->data; + } else { + /* Add tag to existing buffer */ + DBG_SKB(("Expand into unused RCPU header\n")); + pktdata = &skb->data[rcpulen-4]; + for (idx = 0; idx < 12; idx++) { + pktdata[idx] = pktdata[idx+4]; + } + } + pktdata[12] = 0x81; + pktdata[13] = 0x00; + pktdata[14] = (priv->vlan >> 8) & 0xf; + pktdata[15] = priv->vlan & 0xff; + pktlen += 4; + } + } + } else if (priv->port < 0 || (priv->flags & KCOM_NETIF_F_ADD_TAG)) { + /* Need to add VLAN tag if packet is untagged */ + tpid = (skb->data[12] << 8) | skb->data[13]; + if (tpid != 0x8100) { + if (skb_header_cloned(skb) || skb_headroom(skb) < 4) { + /* Current SKB cannot be modified */ + DBG_SKB(("Realloc Tx SKB\n")); + new_skb = dev_alloc_skb(pktlen + 4); + if (new_skb == NULL) { + DBG_WARN(("Tx drop: No SKB memory\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_no_skb++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + memcpy(new_skb->data, skb->data, 12); + memcpy(&new_skb->data[16], &skb->data[12], pktlen - 12); + skb_put(new_skb, pktlen + 4); + dev_kfree_skb_any(skb); + skb = new_skb; + } else { + /* Add tag to existing buffer */ + DBG_SKB(("Expand Tx SKB\n")); + skb_push(skb, 4); + for (idx = 0; idx < 12; idx++) { + skb->data[idx] = skb->data[idx+4]; + } + } + pktdata = skb->data; + pktdata[12] = 0x81; + pktdata[13] = 0x00; + pktdata[14] = (priv->vlan >> 8) & 0xf; + pktdata[15] = priv->vlan & 0xff; + pktlen += 4; + } + } + + /* Pad packet if needed */ + taglen = 0; + tpid = (pktdata[12] << 8) | pktdata[13]; + if (tpid == 0x8100) { + taglen = 4; + } + if (pktlen < (64 + taglen)) { + pktlen = (64 + taglen); + /* Pad runt packets accounting for skipped RCPU header if needed */ + if (SKB_PADTO(skb, pktlen + rcpulen) != 0) { + DBG_WARN(("Tx drop: skb_padto failed\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_pad_fail++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + /* skb_padto may update the skb->data pointer */ + pktdata = &skb->data[rcpulen]; + DBG_SKB(("Packet padded to %d bytes\n", pktlen)); + } + + if (pktlen > SOC_DCB_KNET_COUNT_MASK) { + DBG_WARN(("Tx drop: size of pkt (%d) is out of range(%d)\n", + pktlen, SOC_DCB_KNET_COUNT_MASK)); + sinfo->tx.pkts_d_over_limit++; + priv->stats.tx_dropped++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + + dcb = desc->dcb_mem; + memset(dcb, 0, sizeof(uint32_t) * sinfo->dcb_wsize); + dcb[1] = pktlen; + if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { + /* If module header SOP is non-zero, use RCPU meta data */ + if (sop != 0) { + metalen = (sinfo->dcb_wsize - 3) * sizeof(uint32_t); + if (metalen > RCPU_TX_META_SIZE) { + metalen = RCPU_TX_META_SIZE; + } + metadata = (uint32_t *)&skb->data[RCPU_HDR_SIZE]; + for (idx = 0; idx < BYTES2WORDS(metalen); idx++) { + dcb[idx+2] = ntohl(metadata[idx]); + } + dcb[1] |= (1 << 19); + } + bkn_dump_dcb("Tx RCPU", dcb, sinfo->dcb_wsize, XGS_DMA_TX_CHAN); + } else if (priv->port >= 0) { + /* Send to physical port */ + dcb[1] |= (1 << 19); + switch (sinfo->dcb_type) { + case 23: + case 26: + case 30: + case 31: + case 34: + case 37: + dcb[2] = 0x81000000; + dcb[3] = priv->port; + dcb[3] |= (priv->qnum & 0xc00) << 20; + dcb[4] = 0x00040000; + dcb[4] |= (priv->qnum & 0x3ff) << 8; + break; + case 32: + dcb[2] = 0x81000000; + dcb[3] = priv->port; + dcb[4] = 0x4000; + /* according to format of register SOBMH in bcm56960_a0 */ + dcb[4] |= (priv->qnum & 0x3f) << 8; + break; + case 33: + dcb[2] = 0x81000000; + dcb[3] = (priv->port) << 2; + dcb[4] = 0x00100000; + dcb[4] |= (priv->qnum & 0xfff) << 8; + break; + case 35: + dcb[2] = 0x81000000; + dcb[3] = (priv->port) << 4; + dcb[4] = 0x00400000; + dcb[4] |= (priv->qnum & 0x3fff) << 8; + break; + case 24: + dcb[2] = 0xff000000; + dcb[3] = 0x00000100; + dcb[4] = priv->port; + dcb[4] |= (priv->qnum & 0xfff) << 14; + break; + case 28: + { + if (priv->type == KCOM_NETIF_T_PORT) { + /* add PTCH ITMH header */ + if (skb_header_cloned(skb) || skb_headroom(skb) < 4) { + /* Current SKB cannot be modified */ + DBG_SKB(("Realloc Tx SKB for DNX ITMH header\n")); + new_skb = dev_alloc_skb(pktlen + 4 + 2); + if (new_skb == NULL) { + DBG_WARN(("Tx drop: No SKB memory for DNX ITMH header\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_no_skb++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + memcpy(&new_skb->data[6], skb->data, pktlen); + skb_put(new_skb, pktlen + 6); + dev_kfree_skb_any(skb); + skb = new_skb; + } else { + /* Add tag to existing buffer */ + DBG_SKB(("Expand Tx SKB for DNX ITMH header\n")); + skb_push(skb, 6); + } + pktdata = skb->data; + pktdata[0] = 0x50; + pktdata[1] = 0x00; + memcpy(&pktdata[2], priv->itmh, 4); + pktlen += 6; + } + else if (priv->type == KCOM_NETIF_T_VLAN) { + /* add PTCH header */ + if (skb_header_cloned(skb) || skb_headroom(skb) < 4) { + /* Current SKB cannot be modified */ + DBG_SKB(("Realloc Tx SKB for DNX header\n")); + new_skb = dev_alloc_skb(pktlen + 2); + if (new_skb == NULL) { + DBG_WARN(("Tx drop: No SKB memory for DNX header\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_no_skb++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + memcpy(&new_skb->data[2], skb->data, pktlen); + skb_put(new_skb, pktlen + 2); + dev_kfree_skb_any(skb); + skb = new_skb; + } else { + /* Add tag to existing buffer */ + DBG_SKB(("Expand Tx SKB for DNX header\n")); + skb_push(skb, 2); + } + pktdata = skb->data; + pktdata[0] = 0xd0; + pktdata[1] = priv->port; + pktlen += 2; + } + dcb[1] = pktlen; + break; + } + case 29: + dcb[2] = 0x81000000; + dcb[3] = priv->port; + dcb[4] = 0x00100000; + dcb[4] |= (priv->qnum & 0xfff) << 8; + break; + default: + dcb[2] = 0xff000000; + dcb[3] = 0x00000100; + dcb[4] = priv->port; + break; + } + } + + /* Optional SKB updates */ + if (knet_tx_cb != NULL) { + skb = knet_tx_cb(skb, sinfo->dev_no, dcb); + if (skb == NULL) { + /* Consumed by call-back */ + DBG_WARN(("Tx drop: Consumed by call-back\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_callback++; + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + /* Restore (possibly) altered packet variables + * bit0 -bit15 of dcb[1] is used to save requested byte count + */ + if ((skb->len + 4) <= SOC_DCB_KNET_COUNT_MASK) { + pktdata = skb->data; + pktlen = skb->len + 4; + if (pktlen < (64 + taglen)) { + pktlen = (64 + taglen); + if (SKB_PADTO(skb, pktlen) != 0) { + DBG_WARN(("Tx drop: skb_padto failed\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_pad_fail++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + DBG_SKB(("Packet padded to %d bytes after tx callback\n", pktlen)); + } + } else { + DBG_WARN(("Tx drop: size of pkt (%d) is out of range(%d)\n", + pktlen, SOC_DCB_KNET_COUNT_MASK)); + sinfo->tx.pkts_d_over_limit++; + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_callback++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } + } + /* Prepare for DMA */ + desc->skb = skb; + desc->dma_size = pktlen; + desc->skb_dma = DMA_MAP_SINGLE(sinfo->dma_dev, + pktdata, desc->dma_size, + DMA_TODEV); + dcb[0] = desc->skb_dma; + dcb[1] &= ~SOC_DCB_KNET_COUNT_MASK; + dcb[1] |= pktlen; + + DBG_DCB_TX(("Add Tx DCB @ 0x%08x (%d) [%d free] (%d bytes).\n", + (uint32_t)desc->dcb_dma, sinfo->tx.cur, + sinfo->tx.free, pktlen)); + bkn_dump_pkt(pktdata, skb->len - rcpulen, XGS_DMA_TX_CHAN); + + if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) { + dcb[1] |= (1 << 24) | (1 << 16); + } else { + bkn_tx_dma_start(sinfo); + } + if (++sinfo->tx.cur >= MAX_TX_DCBS) { + sinfo->tx.cur = 0; + } + sinfo->tx.free--; + + if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN) && !sinfo->tx.api_active) { + /* DMA run to the new halt location */ + bkn_cdma_goto(sinfo, XGS_DMA_TX_CHAN, + sinfo->tx.desc[sinfo->tx.cur].dcb_dma); + } + + priv->stats.tx_packets++; + priv->stats.tx_bytes += pktlen; + sinfo->tx.pkts++; + } + else { + DBG_WARN(("Tx drop: No DMA resources\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_dma_resrc++; + dev_kfree_skb_any(skb); + } + + /* Check our Tx resources */ + if (sinfo->tx.free <= 1) { + bkn_suspend_tx(sinfo); + } + + netif_trans_update(dev); + + spin_unlock_irqrestore(&sinfo->lock, flags); + + return 0; +} + +static void +bkn_timer(unsigned long context) +{ + bkn_switch_info_t *sinfo = (bkn_switch_info_t *)context; + unsigned long flags; + int chan; + int restart_timer; + + spin_lock_irqsave(&sinfo->lock, flags); + + sinfo->timer_runs++; + + restart_timer = 0; + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + /* Restart channel if not running */ + if (sinfo->rx[chan].running == 0) { + bkn_rx_refill(sinfo, chan); + if (bkn_rx_restart(sinfo, chan) != 0) { + restart_timer = 1; + } + } + } + + if (restart_timer) { + /* Presumably still out of memory */ + sinfo->timer.expires = jiffies + 1; + add_timer(&sinfo->timer); + } else { + sinfo->timer_queued = 0; + } + + spin_unlock_irqrestore(&sinfo->lock, flags); +} + +static void +bkn_rx_add_tokens(bkn_switch_info_t *sinfo, int chan) +{ + unsigned long cur_jif, ticks; + uint32_t tokens_per_tick; + + tokens_per_tick = sinfo->rx[chan].rate_max / HZ; + cur_jif = jiffies; + ticks = cur_jif - sinfo->rx[chan].tok_jif; + sinfo->rx[chan].tokens += ticks * tokens_per_tick; + sinfo->rx[chan].tok_jif = cur_jif; + if (sinfo->rx[chan].tokens > sinfo->rx[chan].burst_max) { + sinfo->rx[chan].tokens = sinfo->rx[chan].burst_max; + } + + /* Restart channel if not running */ + if (sinfo->rx[chan].running == 0) { + bkn_rx_refill(sinfo, chan); + bkn_rx_restart(sinfo, chan); + } +} + +static void +bkn_rxtick(unsigned long context) +{ + bkn_switch_info_t *sinfo = (bkn_switch_info_t *)context; + unsigned long flags; + unsigned long cur_jif, ticks; + uint32_t pkt_diff; + int chan; + + spin_lock_irqsave(&sinfo->lock, flags); + + sinfo->rxtick.expires = jiffies + sinfo->rxtick_jiffies; + + /* For debug purposes we maintain a rough actual packet rate */ + if (++sinfo->rxticks >= sinfo->rxticks_per_sec) { + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + pkt_diff = sinfo->rx[chan].pkts - sinfo->rx[chan].pkts_ref; + cur_jif = jiffies; + ticks = cur_jif - sinfo->rx[chan].rate_jif; + sinfo->rx[chan].rate = (pkt_diff * HZ) / ticks; + sinfo->rx[chan].rate_jif = cur_jif; + sinfo->rx[chan].pkts_ref = sinfo->rx[chan].pkts; + } + sinfo->rxticks = 0; + } + + /* Update tokens for Rx rate control */ + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + if (sinfo->rx[chan].tokens < sinfo->rx[chan].burst_max) { + bkn_rx_add_tokens(sinfo, chan); + } + } + + spin_unlock_irqrestore(&sinfo->lock, flags); + + add_timer(&sinfo->rxtick); +} + +static void +bkn_rx_rate_config(bkn_switch_info_t *sinfo) +{ + unsigned long flags; + int chan; + uint32_t rxticks_per_sec, rps; + uint32_t jiffies_per_rxtick; + uint32_t tokens_per_rxtick; + + spin_lock_irqsave(&sinfo->lock, flags); + + /* Calculate the minimum update frequency across all channels */ + rxticks_per_sec = 1; + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + if (sinfo->rx[chan].burst_max == 0) { + sinfo->rx[chan].burst_max = sinfo->rx[chan].rate_max / 10; + } + rps = sinfo->rx[chan].rate_max / sinfo->rx[chan].burst_max; + if (rxticks_per_sec < rps) { + rxticks_per_sec = rps; + } + } + + /* Convert update frequency to system ticks */ + jiffies_per_rxtick = HZ / rxticks_per_sec; + if (jiffies_per_rxtick == 0) { + jiffies_per_rxtick = 1; + } + rxticks_per_sec = HZ / jiffies_per_rxtick; + + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + /* Ensure that burst size satifies overall rate */ + tokens_per_rxtick = sinfo->rx[chan].rate_max / rxticks_per_sec; + if (sinfo->rx[chan].burst_max < tokens_per_rxtick) { + sinfo->rx[chan].burst_max = tokens_per_rxtick; + } + /* Ensure that rate has a sane value */ + if (sinfo->rx[chan].rate_max != 0) { + if (sinfo->rx[chan].rate_max < rxticks_per_sec) { + sinfo->rx[chan].rate_max = rxticks_per_sec; + } + } + sinfo->rx[chan].tokens = sinfo->rx[chan].burst_max; + } + + /* Update timer controls */ + sinfo->rxticks_per_sec = rxticks_per_sec; + sinfo->rxtick_jiffies = jiffies_per_rxtick; + + spin_unlock_irqrestore(&sinfo->lock, flags); +} + +static void +bkn_destroy_sinfo(bkn_switch_info_t *sinfo) +{ + list_del(&sinfo->list); + bkn_free_dcbs(sinfo); + kfree(sinfo); +} + +static bkn_switch_info_t * +bkn_create_sinfo(int dev_no) +{ + bkn_switch_info_t *sinfo; + uint32_t val; + int chan; + + if ((sinfo = kmalloc(sizeof(*sinfo), GFP_KERNEL)) == NULL) { + return NULL; + } + memset(sinfo, 0, sizeof(*sinfo)); + INIT_LIST_HEAD(&sinfo->ndev_list); + INIT_LIST_HEAD(&sinfo->rxpf_list); + sinfo->base_addr = lkbde_get_dev_virt(dev_no); + sinfo->dma_dev = lkbde_get_dma_dev(dev_no); + sinfo->pdev = lkbde_get_hw_dev(dev_no); + sinfo->dev_no = dev_no; + sinfo->evt_idx = -1; + + spin_lock_init(&sinfo->lock); + + init_timer(&sinfo->timer); + sinfo->timer.expires = jiffies + 1; + sinfo->timer.data = (unsigned long)sinfo; + sinfo->timer.function = bkn_timer; + + INIT_LIST_HEAD(&sinfo->tx.api_dcb_list); + + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + INIT_LIST_HEAD(&sinfo->rx[chan].api_dcb_list); + sinfo->rx[chan].use_rx_skb = use_rx_skb; + } + + /* + * Check for dual DMA mode where Rx DMA channel 0 uses DMA buffers + * provided by the BCM API, and the remaining Rx DMA channel(s) + * use socket buffers (SKB) provided by the Linux kernel. + */ + if (use_rx_skb == 2) { + sinfo->rx[0].use_rx_skb = 0; + } + + init_timer(&sinfo->rxtick); + sinfo->rxtick.expires = jiffies + 1; + sinfo->rxtick.data = (unsigned long)sinfo; + sinfo->rxtick.function = bkn_rxtick; + + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + sinfo->rx[chan].rate_max = rx_rate[chan]; + sinfo->rx[chan].burst_max = rx_burst[chan]; + } + bkn_rx_rate_config(sinfo); + + add_timer(&sinfo->rxtick); + + list_add_tail(&sinfo->list, &_sinfo_list); + + sinfo->cmic_type = 'e'; + DEV_READ32(sinfo, CMIC_DEV_REV_IDr, &val); + if (val == 0) { + sinfo->cmic_type = 'm'; + DEV_READ32(sinfo, CMICM_DEV_REV_IDr, &val); + } + + DBG_VERB(("Check dev/rev: 0x%08x\n", val)); + + return sinfo; +} + + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) +static const struct net_device_ops bkn_netdev_ops = { + .ndo_open = bkn_open, + .ndo_stop = bkn_stop, + .ndo_start_xmit = bkn_tx, + .ndo_get_stats = bkn_get_stats, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_rx_mode = bkn_set_multicast_list, + .ndo_set_mac_address = bkn_set_mac_address, + .ndo_do_ioctl = NULL, + .ndo_tx_timeout = NULL, + .ndo_change_mtu = bkn_change_mtu, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = bkn_poll_controller, +#endif +}; +#endif + +static struct net_device * +bkn_init_ndev(u8 *mac, char *name) +{ + struct net_device *dev; + + /* Create Ethernet device */ + dev = alloc_etherdev(sizeof(bkn_priv_t)); + + if (dev == NULL) { + DBG_WARN(("Error allocating Ethernet device.\n")); + return NULL; + } +#ifdef SET_MODULE_OWNER + SET_MODULE_OWNER(dev); +#endif + + /* Set the device MAC address */ + memcpy(dev->dev_addr, mac, 6); + + /* Device information -- not available right now */ + dev->irq = 0; + dev->base_addr = 0; + + /* Default MTU should not exceed MTU of switch front-panel ports */ + dev->mtu = default_mtu; + if (dev->mtu == 0) { + dev->mtu = rx_buffer_size; + } + + /* Device vectors */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + dev->netdev_ops = &bkn_netdev_ops; +#else + dev->open = bkn_open; + dev->hard_start_xmit = bkn_tx; + dev->stop = bkn_stop; + dev->set_multicast_list = bkn_set_multicast_list; + dev->do_ioctl = NULL; + dev->get_stats = bkn_get_stats; + dev->change_mtu = bkn_change_mtu; +#ifdef CONFIG_NET_POLL_CONTROLLER + dev->poll_controller = bkn_poll_controller; +#endif +#endif + if (name && *name) { + strncpy(dev->name, name, IFNAMSIZ-1); + } + + /* Register the kernel Ethernet device */ + if (register_netdev(dev)) { + DBG_WARN(("Error registering Ethernet device.\n")); + free_netdev(dev); + return NULL; + } + DBG_VERB(("Created Ethernet device %s.\n", dev->name)); + + return dev; +} + +/* + * Device Link Control Proc Read Entry + */ +static int +bkn_proc_link_show(struct seq_file *m, void *v) +{ + struct list_head *slist, *dlist; + struct net_device *dev; + bkn_priv_t *priv; + bkn_switch_info_t *sinfo; + unsigned long flags; + + seq_printf(m, "Software link status:\n"); + list_for_each(slist, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)slist; + spin_lock_irqsave(&sinfo->lock, flags); + list_for_each(dlist, &sinfo->ndev_list) { + priv = (bkn_priv_t *)dlist; + dev = priv->dev; + if (dev) { + seq_printf(m, " %-14s %s\n", dev->name, + netif_carrier_ok(dev) ? "up" : "down"); + } + } + spin_unlock_irqrestore(&sinfo->lock, flags); + } + return 0; +} + +static int +bkn_proc_link_open(struct inode * inode, struct file * file) +{ + return single_open(file, bkn_proc_link_show, NULL); +} + +/* + * Device Link Control Proc Write Entry + * + * Syntax: + * =up|down + * + * Where is a virtual network interface name. + * + * Examples: + * eth4=up + * eth4=down + */ +static ssize_t +bkn_proc_link_write(struct file *file, const char *buf, + size_t count, loff_t *loff) +{ + struct list_head *slist, *dlist; + struct net_device *dev; + bkn_priv_t *priv; + bkn_switch_info_t *sinfo; + unsigned long flags; + char link_str[40]; + char *ptr; + char *newline; + + if (count >= sizeof(link_str)) { + count = sizeof(link_str) - 1; + } + if (copy_from_user(link_str, buf, count)) { + return -EFAULT; + } + link_str[count] = 0; + newline = strchr(link_str, '\n'); + if (newline) { + /* Chop off the trailing newline */ + *newline = '\0'; + } + + if ((ptr = strchr(link_str, '=')) == NULL && + (ptr = strchr(link_str, ':')) == NULL) { + gprintk("Error: link syntax not recognized: '%s'\n", link_str); + return count; + } + *ptr++ = 0; + + dev = NULL; + list_for_each(slist, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)slist; + spin_lock_irqsave(&sinfo->lock, flags); + list_for_each(dlist, &sinfo->ndev_list) { + priv = (bkn_priv_t *)dlist; + if (priv->dev) { + if (strcmp(priv->dev->name, link_str) == 0) { + dev = priv->dev; + break; + } + } + } + if (dev) { + if (strcmp(ptr, "up") == 0) { + netif_carrier_on(dev); + } else if (strcmp(ptr, "down") == 0) { + netif_carrier_off(dev); + } else { + gprintk("Warning: unknown link state setting: '%s'\n", ptr); + } + spin_unlock_irqrestore(&sinfo->lock, flags); + return count; + } + spin_unlock_irqrestore(&sinfo->lock, flags); + } + + gprintk("Warning: unknown network interface: '%s'\n", link_str); + + return count; +} + +struct file_operations bkn_proc_link_file_ops = { + owner: THIS_MODULE, + open: bkn_proc_link_open, + read: seq_read, + llseek: seq_lseek, + write: bkn_proc_link_write, + release: single_release, +}; + +/* + * Device Rate Control Proc Read Entry + */ +static int +bkn_proc_rate_show(struct seq_file *m, void *v){ + int unit = 0; + struct list_head *list; + bkn_switch_info_t *sinfo; + int chan; + + list_for_each(list, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)list; + + seq_printf(m, "Rate control (unit %d):\n", unit); + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + seq_printf(m, " Rx%d max rate %8u\n", + chan, sinfo->rx[chan].rate_max); + seq_printf(m, " Rx%d max burst %8u\n", + chan, sinfo->rx[chan].burst_max); + seq_printf(m, " Rx%d rate %8u\n", + chan, sinfo->rx[chan].rate); + seq_printf(m, " Rx%d tokens %8u\n", + chan, sinfo->rx[chan].tokens); + } + + unit++; + } + return 0; +} + +static int +bkn_proc_rate_open(struct inode * inode, struct file * file) { + return single_open(file, bkn_proc_rate_show, NULL); +} + +/* + * Device Rate Control Proc Write Entry + * + * Syntax: + * [:]rx_rate=[,[, is packets/sec for the first Rx DMA channel, + * is packets/sec for the second Rx DMA channel, etc. + * + * Examples: + * rx_rate=5000 + * 0:rx_rate=10000,10000 + * 1:rx_rate=10000,5000 + */ +static ssize_t +bkn_proc_rate_write(struct file *file, const char *buf, + size_t count, loff_t *loff) +{ + bkn_switch_info_t *sinfo; + char rate_str[40]; + char *ptr; + int unit, chan; + + if (count >= sizeof(rate_str)) { + count = sizeof(rate_str) - 1; + } + if (copy_from_user(rate_str, buf, count)) { + return -EFAULT; + } + + unit = simple_strtol(rate_str, NULL, 10); + sinfo = bkn_sinfo_from_unit(unit); + if (sinfo == NULL) { + gprintk("Warning: unknown unit\n"); + return count; + } + + + if ((ptr = strstr(rate_str, "rx_rate=")) != NULL) { + ptr += 7; + chan = 0; + do { + ptr++; + sinfo->rx[chan].rate_max = simple_strtol(ptr, NULL, 10); + } + while ((ptr = strchr(ptr, ',')) != NULL && ++chan < NUM_RX_CHAN); + bkn_rx_rate_config(sinfo); + } else if ((ptr = strstr(rate_str, "rx_burst=")) != NULL) { + ptr += 8; + chan = 0; + do { + ptr++; + sinfo->rx[chan].burst_max = simple_strtol(ptr, NULL, 10); + } + while ((ptr = strchr(ptr, ',')) != NULL && ++chan < NUM_RX_CHAN); + bkn_rx_rate_config(sinfo); + } else { + gprintk("Warning: unknown configuration setting\n"); + } + + return count; +} + +struct file_operations bkn_proc_rate_file_ops = { + owner: THIS_MODULE, + open: bkn_proc_rate_open, + read: seq_read, + llseek: seq_lseek, + write: bkn_proc_rate_write, + release: single_release, +}; + +/* + * Driver DMA Proc Entry + * + * This output can be rather large (> PAGE_SIZE) so we use the + * seq_file interface to do the output. Special header records + * are indicated by a negative DCB index. + */ +typedef struct { + int dev_no; /* Current unit */ + int rx_dma; /* 0: Tx DMA, 1: Rx DMA*/ + int ch_no; /* DMA channel no. (Rx only) */ + int idx; /* DCB index */ +} bkn_seq_dma_iter_t; + +/* From current record, move forward 'pos' records */ +static int +bkn_seq_dma_next_pos(bkn_seq_dma_iter_t *iter, loff_t pos) +{ + while (pos) { + if (iter->rx_dma) { + if (++iter->idx >= MAX_RX_DCBS) { + iter->idx = -1; + if (++iter->ch_no >= NUM_RX_CHAN) { + iter->rx_dma = 0; + iter->ch_no = 0; + iter->dev_no++; + if (bkn_sinfo_from_unit(iter->dev_no) == NULL) { + return -1; + } + } + } + } else { + if (++iter->idx >= MAX_TX_DCBS) { + iter->idx = -1; + iter->rx_dma = 1; + } + } + pos--; + } + return 0; +} + +/* Initialize private data and move to requested start record */ +static void * +bkn_seq_dma_start(struct seq_file *s, loff_t *pos) +{ + bkn_seq_dma_iter_t *iter; + + iter = kmalloc(sizeof(bkn_seq_dma_iter_t), GFP_KERNEL); + if (!iter) { + return NULL; + } + memset(iter, 0, sizeof(*iter)); + iter->idx = -2; + if (bkn_seq_dma_next_pos(iter, *pos) < 0) { + kfree(iter); + return NULL; + } + return iter; +} + +/* Move to next record */ +static void * +bkn_seq_dma_next(struct seq_file *s, void *v, loff_t *pos) +{ + bkn_seq_dma_iter_t *iter = (bkn_seq_dma_iter_t *)v; + void *rv = iter; + + if (bkn_seq_dma_next_pos(iter, 1) < 0) { + return NULL; + } + (*pos)++; + return rv; +} + +/* Release private data */ +static void +bkn_seq_dma_stop(struct seq_file *s, void *v) +{ + if (v) { + kfree(v); + } +} + +/* Print current record */ +static int +bkn_seq_dma_show(struct seq_file *s, void *v) +{ + bkn_seq_dma_iter_t *iter = (bkn_seq_dma_iter_t *)v; + bkn_switch_info_t *sinfo; + uint32_t *dcb = NULL; + int chan; + + sinfo = bkn_sinfo_from_unit(iter->dev_no); + if (sinfo == NULL) { + /* Should not happen */ + return 0; + } + + if (iter->rx_dma == 0) { + if (iter->idx == -2) { + seq_printf(s, "Pending events: 0x%x\n", sinfo->dma_events); + } else if (iter->idx == -1) { + seq_printf(s, + "Tx DCB info (unit %d):\n" + " api: %d\n" + " dirty: %d\n" + " cur: %d\n" + " free: %d\n" + " pause: %s\n", + iter->dev_no, + sinfo->tx.api_active, + sinfo->tx.dirty, + sinfo->tx.cur, + sinfo->tx.free, + netif_queue_stopped(sinfo->dev) ? "yes" : "no"); + } else { + dcb = sinfo->tx.desc[iter->idx].dcb_mem; + } + } else { + if (iter->idx == -1) { + chan = iter->ch_no; + seq_printf(s, + "Rx%d DCB info (unit %d):\n" + " api: %d\n" + " dirty: %d\n" + " cur: %d\n" + " free: %d\n" + " run: %d\n", + chan, iter->dev_no, + sinfo->rx[chan].api_active, + sinfo->rx[chan].dirty, + sinfo->rx[chan].cur, + sinfo->rx[chan].free, + sinfo->rx[chan].running); + } else if (sinfo->rx[iter->ch_no].use_rx_skb) { + dcb = sinfo->rx[iter->ch_no].desc[iter->idx].dcb_mem; + } + } + if (dcb) { + seq_printf(s, " DCB %2d: 0x%08x 0x%08x ... 0x%08x\n", iter->idx, + dcb[0], dcb[1], dcb[sinfo->dcb_wsize - 1]); + } + return 0; +} + +static struct seq_operations bkn_seq_dma_ops = { + .start = bkn_seq_dma_start, + .next = bkn_seq_dma_next, + .stop = bkn_seq_dma_stop, + .show = bkn_seq_dma_show +}; + +static int +bkn_seq_dma_open(struct inode *inode, struct file *file) +{ + return seq_open(file, &bkn_seq_dma_ops); +}; + +static struct file_operations bkn_seq_dma_file_ops = { + .owner = THIS_MODULE, + .open = bkn_seq_dma_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release +}; + +/* + * Device Debug Control Proc Write Entry + * + * Syntax: + * [:]debug= + * + * Where corresponds to the debug module parameter. + * + * Examples: + * debug=0xffff + * 0:debug-0x2000 + */ +static ssize_t +bkn_proc_debug_write(struct file *file, const char *buf, + size_t count, loff_t *loff) +{ + bkn_switch_info_t *sinfo; + char debug_str[40]; + char *ptr; + int unit; + + if (count >= sizeof(debug_str)) { + count = sizeof(debug_str) - 1; + } + if (copy_from_user(debug_str, buf, count)) { + return -EFAULT; + } + + unit = simple_strtol(debug_str, NULL, 10); + sinfo = bkn_sinfo_from_unit(unit); + if (sinfo == NULL) { + gprintk("Warning: unknown unit\n"); + return count; + } + + if ((ptr = strstr(debug_str, "debug=")) != NULL) { + ptr += 6; + debug = simple_strtol(ptr, NULL, 0); + } else { + gprintk("Warning: unknown configuration setting\n"); + } + + return count; +} + +/* + * Driver Debug Proc Entry + */ +static int +bkn_proc_debug_show(struct seq_file *m, void *v){ + int unit = 0; + struct list_head *list; + bkn_switch_info_t *sinfo; + + seq_printf(m, "Configuration:\n"); + seq_printf(m, " debug: 0x%x\n", debug); + seq_printf(m, " mac_addr: %02x:%02x:%02x:%02x:%02x:%02x\n", + bkn_dev_mac[0], bkn_dev_mac[1], bkn_dev_mac[2], + bkn_dev_mac[3], bkn_dev_mac[4], bkn_dev_mac[5]); + seq_printf(m, " rx_buffer_size: %d (0x%x)\n", + rx_buffer_size, rx_buffer_size); + seq_printf(m, " rcpu_mode: %d\n", rcpu_mode); + seq_printf(m, " rcpu_dmac: %02x:%02x:%02x:%02x:%02x:%02x\n", + bkn_rcpu_dmac[0], bkn_rcpu_dmac[1], bkn_rcpu_dmac[2], + bkn_rcpu_dmac[3], bkn_rcpu_dmac[4], bkn_rcpu_dmac[5]); + seq_printf(m, " rcpu_smac: %02x:%02x:%02x:%02x:%02x:%02x\n", + bkn_rcpu_smac[0], bkn_rcpu_smac[1], bkn_rcpu_smac[2], + bkn_rcpu_smac[3], bkn_rcpu_smac[4], bkn_rcpu_smac[5]); + seq_printf(m, " rcpu_ethertype: 0x%x\n", rcpu_ethertype); + seq_printf(m, " rcpu_signature: 0x%x\n", rcpu_signature); + seq_printf(m, " rcpu_vlan: %d\n", rcpu_vlan); + seq_printf(m, " use_rx_skb: %d\n", use_rx_skb); + seq_printf(m, " num_rx_prio: %d\n", num_rx_prio); + seq_printf(m, " check_rcpu_sig: %d\n", check_rcpu_signature); + seq_printf(m, " default_mtu: %d\n", default_mtu); + seq_printf(m, " rx_sync_retry: %d\n", rx_sync_retry); + seq_printf(m, " use_napi: %d\n", use_napi); + seq_printf(m, " napi_weight: %d\n", napi_weight); + seq_printf(m, " basedev_susp: %d\n", basedev_suspend); + seq_printf(m, "Thread states:\n"); + seq_printf(m, " Command thread: %d\n", bkn_cmd_ctrl.state); + seq_printf(m, " Event thread: %d\n", bkn_evt_ctrl.state); + seq_printf(m, "Active IOCTLs:\n"); + seq_printf(m, " Command: %d\n", ioctl_cmd); + seq_printf(m, " Event: %d\n", ioctl_evt); + + list_for_each(list, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)list; + + seq_printf(m, "Device %d:\n", unit); + seq_printf(m, " base_addr: 0x%p\n", sinfo->base_addr); + seq_printf(m, " dev_no: %d\n", sinfo->dev_no); + seq_printf(m, " dcb_type: %d\n", sinfo->dcb_type); + seq_printf(m, " dcb_wsize: %d\n", sinfo->dcb_wsize); + seq_printf(m, " cmic_type: %c\n", sinfo->cmic_type); + seq_printf(m, " irq_mask: 0x%x\n", sinfo->irq_mask); + seq_printf(m, " dma_events: 0x%x\n", sinfo->dma_events); + seq_printf(m, " dcb_dma: 0x%p\n", (void *)sinfo->dcb_dma); + seq_printf(m, " dcb_mem_size: 0x%x\n", sinfo->dcb_mem_size); + seq_printf(m, " rcpu_sig: 0x%x\n", sinfo->rcpu_sig); + seq_printf(m, " napi_poll_mode: %d\n", sinfo->napi_poll_mode); + seq_printf(m, " inst_id: 0x%x\n", sinfo->inst_id); + seq_printf(m, " evt_queue: %d\n", sinfo->evt_idx); + + unit++; + } + + return 0; +} + +static int bkn_proc_debug_open(struct inode * inode, struct file * file) { + return single_open(file, bkn_proc_debug_show, NULL); +} + +struct file_operations bkn_proc_debug_file_ops = { + owner: THIS_MODULE, + open: bkn_proc_debug_open, + read: seq_read, + llseek: seq_lseek, + write: bkn_proc_debug_write, + release: single_release, +}; + +/* + * Device Statistics Proc Entry + */ +static int +bkn_proc_stats_show(struct seq_file *m, void *v){ + int unit = 0; + struct list_head *list, *flist; + bkn_switch_info_t *sinfo; + bkn_filter_t *filter; + int chan; + + + list_for_each(list, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)list; + + seq_printf(m, "Device stats (unit %d):\n", unit); + seq_printf(m, " Interrupts %10u\n", sinfo->interrupts); + seq_printf(m, " Tx packets %10u\n", sinfo->tx.pkts); + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + seq_printf(m, " Rx%d packets %10u\n", + chan, sinfo->rx[chan].pkts); + } + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + if (sinfo->interrupts == 0) { + /* Avoid divide-by-zero */ + seq_printf(m, " Rx%d pkts/intr -\n", chan); + } else { + seq_printf(m, " Rx%d pkts/intr %8u\n", + chan, sinfo->rx[chan].pkts / sinfo->interrupts); + } + } + seq_printf(m, " Timer runs %10u\n", sinfo->timer_runs); + seq_printf(m, " NAPI reruns %10u\n", sinfo->napi_not_done); + + list_for_each(flist, &sinfo->rxpf_list) { + filter = (bkn_filter_t *)flist; + + seq_printf(m, " Filter %d stats:\n", filter->kf.id); + seq_printf(m, " Hits %10lu\n", filter->hits); + } + + unit++; + } + return 0; +} + +static int bkn_proc_stats_open(struct inode * inode, struct file * file) { + return single_open(file, bkn_proc_stats_show, NULL); +} + +/* + * Device Statistics Proc Write Entry + * + * Syntax: + * [:]clear[=all] + * + * Where corresponds to the debug module parameter. + * + * Examples: + * clear + * 0:clear=all + */ +static ssize_t +bkn_proc_stats_write(struct file *file, const char *buf, + size_t count, loff_t *loff) +{ + bkn_switch_info_t *sinfo; + struct list_head *flist; + bkn_filter_t *filter; + char debug_str[40]; + char *ptr; + int unit; + int clear_mask; + int chan; + + if (count >= sizeof(debug_str)) { + count = sizeof(debug_str) - 1; + } + if (copy_from_user(debug_str, buf, count)) { + return -EFAULT; + } + + unit = simple_strtol(debug_str, NULL, 10); + sinfo = bkn_sinfo_from_unit(unit); + if (sinfo == NULL) { + gprintk("Warning: unknown unit\n"); + return count; + } + + clear_mask = 0; + if ((ptr = strstr(debug_str, "clear=")) != NULL) { + ptr += 6; + if (strncmp(ptr, "all", 3) == 0) { + clear_mask = ~0; + } + } else if ((ptr = strstr(debug_str, "clear")) != NULL) { + clear_mask = ~0; + } else { + gprintk("Warning: unknown configuration setting\n"); + } + + if (clear_mask) { + sinfo->tx.pkts = 0; + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + sinfo->rx[chan].pkts = 0; + } + sinfo->interrupts = 0; + sinfo->timer_runs = 0; + sinfo->napi_not_done = 0; + list_for_each(flist, &sinfo->rxpf_list) { + filter = (bkn_filter_t *)flist; + filter->hits = 0; + } + } + + return count; +} + +struct file_operations bkn_proc_stats_file_ops = { + owner: THIS_MODULE, + open: bkn_proc_stats_open, + read: seq_read, + llseek: seq_lseek, + write: bkn_proc_stats_write, + release: single_release, +}; + +/* + * Device Debug Statistics Proc Entry + */ +static int +bkn_proc_dstats_show(struct seq_file *m, void *v){ + int unit = 0; + struct list_head *list; + bkn_switch_info_t *sinfo; + int chan; + + list_for_each(list, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)list; + + seq_printf(m, "Device debug stats (unit %d):\n", unit); + seq_printf(m, " Tx drop no skb %10u\n", + sinfo->tx.pkts_d_no_skb); + seq_printf(m, " Tx drop rcpu encap %10u\n", + sinfo->tx.pkts_d_rcpu_encap); + seq_printf(m, " Tx drop rcpu sig %10u\n", + sinfo->tx.pkts_d_rcpu_sig); + seq_printf(m, " Tx drop rcpu meta %10u\n", + sinfo->tx.pkts_d_rcpu_meta); + seq_printf(m, " Tx drop pad failed %10u\n", + sinfo->tx.pkts_d_pad_fail); + seq_printf(m, " Tx drop no resource %10u\n", + sinfo->tx.pkts_d_dma_resrc); + seq_printf(m, " Tx drop callback %10u\n", + sinfo->tx.pkts_d_callback); + seq_printf(m, " Tx drop no link %10u\n", + sinfo->tx.pkts_d_no_link); + seq_printf(m, " Tx drop oversized %10u\n", + sinfo->tx.pkts_d_over_limit); + seq_printf(m, " Tx suspends %10u\n", + sinfo->tx.suspends); + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + seq_printf(m, " Rx%d filter to api %10u\n", + chan, sinfo->rx[chan].pkts_f_api); + seq_printf(m, " Rx%d filter to netif %10u\n", + chan, sinfo->rx[chan].pkts_f_netif); + seq_printf(m, " Rx%d mirror to api %10u\n", + chan, sinfo->rx[chan].pkts_m_api); + seq_printf(m, " Rx%d mirror to netif %10u\n", + chan, sinfo->rx[chan].pkts_m_netif); + seq_printf(m, " Rx%d drop no skb %10u\n", + chan, sinfo->rx[chan].pkts_d_no_skb); + seq_printf(m, " Rx%d drop no match %10u\n", + chan, sinfo->rx[chan].pkts_d_no_match); + seq_printf(m, " Rx%d drop unkn netif %10u\n", + chan, sinfo->rx[chan].pkts_d_unkn_netif); + seq_printf(m, " Rx%d drop unkn dest %10u\n", + chan, sinfo->rx[chan].pkts_d_unkn_dest); + seq_printf(m, " Rx%d drop callback %10u\n", + chan, sinfo->rx[chan].pkts_d_callback); + seq_printf(m, " Rx%d drop no link %10u\n", + chan, sinfo->rx[chan].pkts_d_no_link); + seq_printf(m, " Rx%d sync error %10u\n", + chan, sinfo->rx[chan].sync_err); + seq_printf(m, " Rx%d sync retry %10u\n", + chan, sinfo->rx[chan].sync_retry); + seq_printf(m, " Rx%d sync maxloop %10u\n", + chan, sinfo->rx[chan].sync_maxloop); + seq_printf(m, " Rx%d drop no buffer %10u\n", + chan, sinfo->rx[chan].pkts_d_no_api_buf); + } + unit++; + } + return 0; +} + +static int bkn_proc_dstats_open(struct inode * inode, struct file * file) { + return single_open(file, bkn_proc_dstats_show, NULL); +} + +/* + * Device Debug Statistics Proc Write Entry + * + * Syntax: + * [:]clear[=all|tx|rx[]] + * + * Where corresponds to the debug module parameter. + * + * Examples: + * clear + * 0:clear=rx1 + */ +static ssize_t +bkn_proc_dstats_write(struct file *file, const char *buf, + size_t count, loff_t *loff) +{ + bkn_switch_info_t *sinfo; + char debug_str[40]; + char *ptr; + int unit; + int clear_mask; + int chan; + + if (count >= sizeof(debug_str)) { + count = sizeof(debug_str) - 1; + } + if (copy_from_user(debug_str, buf, count)) { + return -EFAULT; + } + + unit = simple_strtol(debug_str, NULL, 10); + sinfo = bkn_sinfo_from_unit(unit); + if (sinfo == NULL) { + gprintk("Warning: unknown unit\n"); + return count; + } + + clear_mask = 0; + if ((ptr = strstr(debug_str, "clear=")) != NULL) { + ptr += 6; + if (strncmp(ptr, "all", 3) == 0) { + clear_mask = ~0; + } else if (strncmp(ptr, "dev", 3) == 0) { + clear_mask = 0x20; + } else if (strncmp(ptr, "tx", 2) == 0) { + clear_mask = 0x10; + } else if (strncmp(ptr, "rx0", 3) == 0) { + clear_mask = (1 << 0); + } else if (strncmp(ptr, "rx1", 3) == 0) { + clear_mask = (1 << 1); + } else if (strncmp(ptr, "rx", 2) == 0) { + clear_mask = 0xf; + } + } else if ((ptr = strstr(debug_str, "clear")) != NULL) { + clear_mask = ~0; + } else { + gprintk("Warning: unknown configuration setting\n"); + } + + /* Tx counters */ + if (clear_mask & 0x10) { + sinfo->tx.pkts_d_no_skb = 0; + sinfo->tx.pkts_d_rcpu_encap = 0; + sinfo->tx.pkts_d_rcpu_sig = 0; + sinfo->tx.pkts_d_rcpu_meta = 0; + sinfo->tx.pkts_d_pad_fail = 0; + sinfo->tx.pkts_d_over_limit = 0; + sinfo->tx.pkts_d_dma_resrc = 0; + sinfo->tx.suspends = 0; + } + /* Rx counters */ + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + if (clear_mask & (1 << chan)) { + sinfo->rx[chan].pkts_f_api = 0; + sinfo->rx[chan].pkts_f_netif = 0; + sinfo->rx[chan].pkts_m_api = 0; + sinfo->rx[chan].pkts_m_netif = 0; + sinfo->rx[chan].pkts_d_no_skb = 0; + sinfo->rx[chan].pkts_d_no_match = 0; + sinfo->rx[chan].pkts_d_unkn_netif = 0; + sinfo->rx[chan].pkts_d_unkn_dest = 0; + sinfo->rx[chan].pkts_d_no_api_buf = 0; + sinfo->rx[chan].sync_err = 0; + sinfo->rx[chan].sync_retry = 0; + sinfo->rx[chan].sync_maxloop = 0; + } + } + + return count; +} + +struct file_operations bkn_proc_dstats_file_ops = { + owner: THIS_MODULE, + open: bkn_proc_dstats_open, + read: seq_read, + llseek: seq_lseek, + write: bkn_proc_dstats_write, + release: single_release, +}; + +static int +bkn_proc_init(void) +{ + struct proc_dir_entry *entry; + + PROC_CREATE(entry, "link", 0666, bkn_proc_root, &bkn_proc_link_file_ops); + if (entry == NULL) { + return -1; + } + PROC_CREATE(entry, "rate", 0666, bkn_proc_root, &bkn_proc_rate_file_ops); + if (entry == NULL) { + return -1; + } + PROC_CREATE(entry, "dma", 0, bkn_proc_root, &bkn_seq_dma_file_ops); + if (entry == NULL) { + return -1; + } + PROC_CREATE(entry, "debug", 0666, bkn_proc_root, &bkn_proc_debug_file_ops); + if (entry == NULL) { + return -1; + } + PROC_CREATE(entry, "stats", 0666, bkn_proc_root, &bkn_proc_stats_file_ops); + if (entry == NULL) { + return -1; + } + PROC_CREATE(entry, "dstats", 0666, bkn_proc_root, &bkn_proc_dstats_file_ops); + if (entry == NULL) { + return -1; + } + + return 0; +} + +static int +bkn_proc_cleanup(void) +{ + remove_proc_entry("link", bkn_proc_root); + remove_proc_entry("rate", bkn_proc_root); + remove_proc_entry("dma", bkn_proc_root); + remove_proc_entry("debug", bkn_proc_root); + remove_proc_entry("stats", bkn_proc_root); + remove_proc_entry("dstats", bkn_proc_root); + return 0; +} + +/* + * Generic module functions + */ + +static int +_pprint(void) +{ + pprintf("Broadcom BCM KNET Linux Network Driver\n"); + + return 0; +} + +static int +bkn_knet_dma_info(kcom_msg_dma_info_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + bkn_dcb_chain_t *dcb_chain, *dcb_chain_end; + unsigned long flags; + int chan = API_RX_CHAN; + dma_addr_t dcb_dma; + int woffset; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + dcb_chain = kmalloc(sizeof(*dcb_chain), GFP_KERNEL); + if (dcb_chain == NULL) { + gprintk("Fatal error: No memory for dcb_chain\n"); + kmsg->hdr.status = KCOM_E_RESOURCE; + return sizeof(kcom_msg_hdr_t); + } + memset(dcb_chain, 0, sizeof(*dcb_chain)); + dcb_chain->dcb_cnt = kmsg->dma_info.cnt; + dcb_chain->dcb_dma = kmsg->dma_info.data.dcb_start; + dcb_chain->dcb_mem = kernel_bde->p2l(sinfo->dev_no, + dcb_chain->dcb_dma); + + if (kmsg->dma_info.type == KCOM_DMA_INFO_T_TX_DCB) { + + spin_lock_irqsave(&sinfo->lock, flags); + + /* Hold back packets from kernel */ + bkn_suspend_tx(sinfo); + + list_add_tail(&dcb_chain->list, &sinfo->tx.api_dcb_list); + + /* Handle for Continuous DMA mode */ + if (CDMA_CH(sinfo, XGS_DMA_TX_CHAN)) { + woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize + 1; + if ((dcb_chain->dcb_mem[woffset] & ((1 << 18) | (1 << 16))) != 0x50000) { + gprintk("No suitable API DCB chain for Continuous DMA mode\n"); + kfree(dcb_chain); + kmsg->hdr.status = KCOM_E_PARAM; + spin_unlock_irqrestore(&sinfo->lock, flags); + return sizeof(kcom_msg_hdr_t); + } + dcb_chain_end = sinfo->tx.api_dcb_chain_end; + if (dcb_chain_end != NULL) { + /* Stitch this chain */ + woffset = (dcb_chain_end->dcb_cnt - 1) * sinfo->dcb_wsize; + dcb_chain_end->dcb_mem[woffset] = dcb_chain->dcb_dma; + } + sinfo->tx.api_dcb_chain_end = dcb_chain; + if (sinfo->tx.api_active) { + /* Set new halt location */ + woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize; + dcb_dma = dcb_chain->dcb_dma + woffset * sizeof(uint32_t); + /* DMA run to the new halt location */ + bkn_cdma_goto(sinfo, XGS_DMA_TX_CHAN, dcb_dma); + } + } + + if (sinfo->tx.free == MAX_TX_DCBS && + !sinfo->tx.api_active && + !sinfo->basedev_suspended) { + bkn_api_tx(sinfo); + } + + spin_unlock_irqrestore(&sinfo->lock, flags); + + } else if (kmsg->dma_info.type == KCOM_DMA_INFO_T_RX_DCB) { + + spin_lock_irqsave(&sinfo->lock, flags); + + list_add_tail(&dcb_chain->list, &sinfo->rx[chan].api_dcb_list); + + /* Handle for Continuous DMA mode */ + if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize + 1; + if ((dcb_chain->dcb_mem[woffset] & ((1 << 18) | (1 << 16))) != 0x50000) { + gprintk("No suitable API DCB chain for Continuous DMA mode\n"); + kfree(dcb_chain); + kmsg->hdr.status = KCOM_E_PARAM; + spin_unlock_irqrestore(&sinfo->lock, flags); + return sizeof(kcom_msg_hdr_t); + } + dcb_chain_end = sinfo->rx[chan].api_dcb_chain_end; + if (dcb_chain_end != NULL) { + /* Stitch this chain */ + woffset = (dcb_chain_end->dcb_cnt - 1) * sinfo->dcb_wsize; + dcb_chain_end->dcb_mem[woffset] = dcb_chain->dcb_dma; + } + sinfo->rx[chan].api_dcb_chain_end = dcb_chain; + if (!sinfo->rx[chan].use_rx_skb) { + /* Set new halt location */ + woffset = (dcb_chain->dcb_cnt - 1) * sinfo->dcb_wsize; + dcb_dma = dcb_chain->dcb_dma + woffset * sizeof(uint32_t); + /* DMA run to the new halt location */ + bkn_cdma_goto(sinfo, XGS_DMA_RX_CHAN + chan, dcb_dma); + } + } + + if (sinfo->rx[chan].api_active == 0) { + bkn_api_rx_restart(sinfo); + } + + spin_unlock_irqrestore(&sinfo->lock, flags); + + } else { + DBG_DCB(("Unknown DCB_INFO type (%d).\n", kmsg->dma_info.type)); + kfree(dcb_chain); + kmsg->hdr.status = KCOM_E_PARAM; + } + + return sizeof(kcom_msg_hdr_t); +} + +static int +bkn_create_inst(uint32 inst_id) +{ + bkn_switch_info_t *sinfo; + bkn_evt_resource_t *evt; + unsigned long flags; + int i, evt_idx = -1; + + /* multiple instance mode */ + for (i = 0; i < kernel_bde->num_devices(BDE_ALL_DEVICES); i ++) { + evt = &_bkn_evt[i]; + if (evt->inst_id == inst_id) { + evt_idx = i; + DBG_INST(("%s evt_idx %d inst_id 0x%x\n",__FUNCTION__, i, inst_id)); + break; + } + if ((_bkn_multi_inst == 0) || (evt->inst_id == 0)) { + _bkn_multi_inst ++; + evt_idx = i; + init_waitqueue_head(&evt->evt_wq); + evt->inst_id = inst_id; + DBG_INST(("%s evt_idx %d inst_id 0x%x\n",__FUNCTION__, i, inst_id)); + break; + } + } + + if (evt_idx == -1) { + DBG_WARN(("Run out the event queue resource !\n")); + return -1; + } + for (i = 0; i < kernel_bde->num_devices(BDE_ALL_DEVICES); i ++) { + if (inst_id & (1 << i)) { + sinfo = bkn_sinfo_from_unit(i); + spin_lock_irqsave(&sinfo->lock, flags); + sinfo->evt_idx = evt_idx; + spin_unlock_irqrestore(&sinfo->lock, flags); + DBG_INST(("%s d(%d) evt_idx %d \n",__FUNCTION__, i, evt_idx)); + } + } + return 0; +} + +/* + * Device reprobe driven by application to check if new device is probed or + * existed device is changed after inserting KNET module. + */ +static int +bkn_knet_dev_reprobe(void) +{ + bkn_switch_info_t *sinfo; + int i; + for (i = 0; i < kernel_bde->num_devices(BDE_ALL_DEVICES); i++) { + sinfo = bkn_sinfo_from_unit(i); + if (sinfo == NULL ) { + /* New device found after re-probe. */ + if (bkn_knet_dev_init(i) < 0) { + return -1; + } + } else { + /* Existed device reinit after re-probe. */ + if (bkn_knet_dev_reinit(i) < 0) { + return -1; + } + } + } + return 0; +} + +/* Assign the inst_id and evt_idx */ +static int +bkn_knet_dev_inst_set(kcom_msg_version_t *kmsg) +{ + bkn_switch_info_t *sinfo; + int d = kmsg->hdr.unit; + uint32 inst = 0; + unsigned long flags; + struct list_head *list; + + sinfo = bkn_sinfo_from_unit(d); + lkbde_dev_instid_get(d, &inst); + + spin_lock_irqsave(&sinfo->lock, flags); + if (sinfo->inst_id != inst) { + /* Instance database changed, reinit the inst_id */ + sinfo->inst_id = 0; + sinfo->evt_idx = -1; + } + spin_unlock_irqrestore(&sinfo->lock, flags); + + if (inst) { + if (sinfo->inst_id == 0){ + if (bkn_create_inst(inst) != 0) { + return -1; + } + } + spin_lock_irqsave(&sinfo->lock, flags); + sinfo->inst_id = inst; + spin_unlock_irqrestore(&sinfo->lock, flags); + } else { + /* legacy mode */ + list_for_each(list, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)list; + spin_lock_irqsave(&sinfo->lock, flags); + sinfo->evt_idx = 0; + sinfo->inst_id = 0; + spin_unlock_irqrestore(&sinfo->lock, flags); + } + } + return 0; +} + +static int +bkn_knet_version(kcom_msg_version_t *kmsg, int len) +{ + /* Support pci hot plug and multiple instance */ + if ((bkn_knet_dev_reprobe() < 0) || + (bkn_knet_dev_inst_set(kmsg) < 0)){ + kmsg->hdr.status = KCOM_E_RESOURCE; + return sizeof(kcom_msg_version_t); + } + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + kmsg->version = KCOM_VERSION; + kmsg->netif_max = KCOM_NETIF_MAX; + kmsg->filter_max = KCOM_FILTER_MAX; + + return sizeof(kcom_msg_version_t); +} + +static int +bkn_knet_hw_reset(kcom_msg_hw_reset_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + unsigned long flags; + int chan; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + spin_lock_irqsave(&sinfo->lock, flags); + + if (kmsg->channels == 0) { + /* Clean all if no channels specified */ + bkn_dma_abort(sinfo); + bkn_clean_dcbs(sinfo); + } else { + if (kmsg->channels & (1 << XGS_DMA_TX_CHAN)) { + bkn_dma_abort_tx(sinfo); + bkn_clean_tx_dcbs(sinfo); + } + for (chan = 0; chan < NUM_RX_CHAN; chan++) { + if (kmsg->channels & (1 << (XGS_DMA_RX_CHAN + chan))) { + bkn_dma_abort_rx(sinfo, chan); + bkn_clean_rx_dcbs(sinfo, chan); + } + } + } + + spin_unlock_irqrestore(&sinfo->lock, flags); + + return sizeof(kcom_msg_hdr_t); +} + +static int +bkn_knet_hw_init(kcom_msg_hw_init_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + unsigned long flags; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + DBG_DCB(("DCB size %d, type %d\n", kmsg->dcb_size, kmsg->dcb_type)); + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + spin_lock_irqsave(&sinfo->lock, flags); + + /* Config Continuous DMA mode */ + sinfo->cdma_channels = kmsg->cdma_channels; + + /* First time called we need to allocate DCBs */ + sinfo->dcb_type = kmsg->dcb_type; + sinfo->dcb_wsize = BYTES2WORDS(kmsg->dcb_size); + if (sinfo->dcb_mem == NULL) { + if (bkn_alloc_dcbs(sinfo) < 0) { + kmsg->hdr.status = KCOM_E_RESOURCE; + return sizeof(kcom_msg_hdr_t); + } + bkn_init_dcbs(sinfo); + } + + /* Ensure that we restart properly */ + bkn_dma_abort(sinfo); + bkn_clean_dcbs(sinfo); + + if (basedev_suspend) { + if (!netif_running(sinfo->dev)) { + sinfo->basedev_suspended = 1; + } + } + + bkn_dma_init(sinfo); + + spin_unlock_irqrestore(&sinfo->lock, flags); + + return sizeof(kcom_msg_hdr_t); +} + +static int +bkn_knet_detach(kcom_msg_detach_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + unsigned long flags; + bkn_evt_resource_t *evt; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + spin_lock_irqsave(&sinfo->lock, flags); + + /* Create dummy event to unblock pending IOCTL */ + sinfo->dma_events |= KCOM_DMA_INFO_F_TX_DONE; + evt = &_bkn_evt[sinfo->evt_idx]; + evt->evt_wq_put++; + wake_up_interruptible(&evt->evt_wq); + + spin_unlock_irqrestore(&sinfo->lock, flags); + + /* Ensure that we return a valid unit number */ + kmsg->hdr.unit = sinfo->dev_no; + + return sizeof(kcom_msg_detach_t); +} + +static int +bkn_knet_netif_create(kcom_msg_netif_create_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + struct net_device *dev; + struct list_head *list; + bkn_priv_t *priv, *lpriv; + unsigned long flags; + int found, id; + uint8 *ma; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + switch (kmsg->netif.type) { + case KCOM_NETIF_T_VLAN: + case KCOM_NETIF_T_PORT: + case KCOM_NETIF_T_META: + break; + default: + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + ma = kmsg->netif.macaddr; + if ((ma[0] | ma[1] | ma[2] | ma[3] | ma[4] | ma[5]) == 0) { + bkn_dev_mac[5]++; + ma = bkn_dev_mac; + } + if ((dev = bkn_init_ndev(ma, kmsg->netif.name)) == NULL) { + kmsg->hdr.status = KCOM_E_RESOURCE; + return sizeof(kcom_msg_hdr_t); + } + priv = netdev_priv(dev); + priv->dev = dev; + priv->sinfo = sinfo; + priv->type = kmsg->netif.type; + priv->vlan = kmsg->netif.vlan; + if (priv->type == KCOM_NETIF_T_PORT) { + priv->port = kmsg->netif.port; + memcpy(priv->itmh, kmsg->netif.itmh, 4); + priv->qnum = kmsg->netif.qnum; + } else { + if ((device_is_dune(sinfo)) && (priv->type == KCOM_NETIF_T_VLAN)) { + /* set port as SSP to PTCH */ + priv->port = kmsg->netif.port; + priv->qnum = kmsg->netif.qnum; + } + else { + priv->port = -1; + } + } + priv->flags = kmsg->netif.flags; + priv->cb_user_data = kmsg->netif.cb_user_data; + + /* Force RCPU encapsulation if rcpu_mode */ + if (rcpu_mode) { + priv->flags |= KCOM_NETIF_F_RCPU_ENCAP; + DBG_RCPU(("RCPU auto-enabled\n")); + } + + /* Prevent (incorrect) compiler warning */ + lpriv = NULL; + + spin_lock_irqsave(&sinfo->lock, flags); + + /* + * We insert network interfaces sorted by ID. + * In case an interface is destroyed, we reuse the ID + * the next time an interface is created. + */ + found = 0; + id = 1; + list_for_each(list, &sinfo->ndev_list) { + lpriv = (bkn_priv_t *)list; + if (id < lpriv->id) { + found = 1; + break; + } + id = lpriv->id + 1; + } + priv->id = id; + if (found) { + /* Replace previously removed interface */ + list_add_tail(&priv->list, &lpriv->list); + } else { + /* No holes - add to end of list */ + list_add_tail(&priv->list, &sinfo->ndev_list); + } + + if (id < sinfo->ndev_max) { + DBG_NDEV(("Add netif ID %d to table\n", id)); + sinfo->ndevs[id] = dev; + } else { + int ndev_max = sinfo->ndev_max + NDEVS_CHUNK; + int size = ndev_max * sizeof(struct net_device *); + void *ndevs = kmalloc(size, GFP_ATOMIC); + if (ndevs != NULL) { + DBG_NDEV(("Reallocate netif table for ID %d\n", id)); + memset(ndevs, 0, size); + if (sinfo->ndevs != NULL) { + size = sinfo->ndev_max * sizeof(struct net_device *); + memcpy(ndevs, sinfo->ndevs, size); + kfree(sinfo->ndevs); + } + sinfo->ndevs = ndevs; + sinfo->ndev_max = ndev_max; + sinfo->ndevs[id] = dev; + } + } + + spin_unlock_irqrestore(&sinfo->lock, flags); + + DBG_VERB(("Assigned ID %d to Ethernet device %s\n", + priv->id, dev->name)); + + kmsg->netif.id = priv->id; + memcpy(kmsg->netif.macaddr, dev->dev_addr, 6); + memcpy(kmsg->netif.name, dev->name, KCOM_NETIF_NAME_MAX - 1); + + return sizeof(*kmsg); +} + +static int +bkn_knet_netif_destroy(kcom_msg_netif_destroy_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + struct net_device *dev; + bkn_priv_t *priv; + struct list_head *list; + unsigned long flags; + int found; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + spin_lock_irqsave(&sinfo->lock, flags); + + found = 0; + list_for_each(list, &sinfo->ndev_list) { + priv = (bkn_priv_t *)list; + if (kmsg->hdr.id == priv->id) { + found = 1; + break; + } + } + + if (!found) { + spin_unlock_irqrestore(&sinfo->lock, flags); + kmsg->hdr.status = KCOM_E_NOT_FOUND; + return sizeof(kcom_msg_hdr_t); + } + + list_del(&priv->list); + + if (priv->id < sinfo->ndev_max) { + sinfo->ndevs[priv->id] = NULL; + } + + spin_unlock_irqrestore(&sinfo->lock, flags); + + dev = priv->dev; + DBG_VERB(("Removing virtual Ethernet device %s (%d).\n", + dev->name, priv->id)); + unregister_netdev(dev); + free_netdev(dev); + + return sizeof(kcom_msg_hdr_t); +} + +static int +bkn_knet_netif_list(kcom_msg_netif_list_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + bkn_priv_t *priv; + struct list_head *list; + unsigned long flags; + int idx; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + spin_lock_irqsave(&sinfo->lock, flags); + + idx = 0; + list_for_each(list, &sinfo->ndev_list) { + if (idx >= KCOM_NETIF_MAX) { + DBG_WARN(("Too many network interfaces to list (max %d).\n", + KCOM_NETIF_MAX)); + break; + } + priv = (bkn_priv_t *)list; + kmsg->id[idx] = priv->id; + idx++; + } + kmsg->ifcnt = idx; + + spin_unlock_irqrestore(&sinfo->lock, flags); + + return sizeof(*kmsg) - sizeof(kmsg->id) + (idx * sizeof(kmsg->id[0])); +} + +static int +bkn_knet_netif_get(kcom_msg_netif_get_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + bkn_priv_t *priv; + unsigned long flags; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + spin_lock_irqsave(&sinfo->lock, flags); + + priv = bkn_netif_lookup(sinfo, kmsg->hdr.id); + + if (priv == NULL) { + spin_unlock_irqrestore(&sinfo->lock, flags); + kmsg->hdr.status = KCOM_E_NOT_FOUND; + return sizeof(kcom_msg_hdr_t); + } + + memcpy(kmsg->netif.macaddr, priv->dev->dev_addr, 6); + memcpy(kmsg->netif.name, priv->dev->name, KCOM_NETIF_NAME_MAX - 1); + kmsg->netif.vlan = priv->vlan; + kmsg->netif.type = priv->type; + kmsg->netif.id = priv->id; + kmsg->netif.flags = priv->flags; + + if (priv->port < 0) { + kmsg->netif.port = 0; + } else { + kmsg->netif.port = priv->port; + } + kmsg->netif.qnum = priv->qnum; + + spin_unlock_irqrestore(&sinfo->lock, flags); + + return sizeof(*kmsg); +} + +static int +bkn_knet_filter_create(kcom_msg_filter_create_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + struct list_head *list; + bkn_filter_t *filter, *lfilter; + unsigned long flags; + int found, id; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + switch (kmsg->filter.type) { + case KCOM_FILTER_T_RX_PKT: + break; + default: + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + spin_lock_irqsave(&sinfo->lock, flags); + + /* + * Find available ID + */ + found = 1; + id = 0; + while (found && ++id < KCOM_FILTER_MAX) { + found = 0; + list_for_each(list, &sinfo->rxpf_list) { + lfilter = (bkn_filter_t *)list; + if (id == lfilter->kf.id) { + found = 1; + break; + } + } + } + if (found) { + /* Too many filters */ + spin_unlock_irqrestore(&sinfo->lock, flags); + kmsg->hdr.status = KCOM_E_RESOURCE; + return sizeof(kcom_msg_hdr_t); + } + + filter = kmalloc(sizeof(*filter), GFP_ATOMIC); + if (filter == NULL) { + spin_unlock_irqrestore(&sinfo->lock, flags); + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + memset(filter, 0, sizeof(*filter)); + memcpy(&filter->kf, &kmsg->filter, sizeof(filter->kf)); + filter->kf.id = id; + + /* Add according to priority */ + found = 0; + list_for_each(list, &sinfo->rxpf_list) { + lfilter = (bkn_filter_t *)list; + if (filter->kf.priority < lfilter->kf.priority) { + list_add_tail(&filter->list, &lfilter->list); + found = 1; + break; + } + } + if (!found) { + list_add_tail(&filter->list, &sinfo->rxpf_list); + } + + kmsg->filter.id = filter->kf.id; + + spin_unlock_irqrestore(&sinfo->lock, flags); + + DBG_VERB(("Created filter ID %d (%s).\n", + filter->kf.id, filter->kf.desc)); + + return len; +} + +static int +bkn_knet_filter_destroy(kcom_msg_filter_destroy_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + bkn_filter_t *filter; + struct list_head *list; + unsigned long flags; + int found; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + spin_lock_irqsave(&sinfo->lock, flags); + + found = 0; + list_for_each(list, &sinfo->rxpf_list) { + filter = (bkn_filter_t *)list; + if (kmsg->hdr.id == filter->kf.id) { + found = 1; + break; + } + } + + if (!found) { + spin_unlock_irqrestore(&sinfo->lock, flags); + kmsg->hdr.status = KCOM_E_NOT_FOUND; + return sizeof(kcom_msg_hdr_t); + } + + list_del(&filter->list); + + spin_unlock_irqrestore(&sinfo->lock, flags); + + DBG_VERB(("Removing filter ID %d.\n", filter->kf.id)); + kfree(filter); + + return sizeof(kcom_msg_hdr_t); +} + +static int +bkn_knet_filter_list(kcom_msg_filter_list_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + bkn_filter_t *filter; + struct list_head *list; + unsigned long flags; + int idx; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + spin_lock_irqsave(&sinfo->lock, flags); + + idx = 0; + list_for_each(list, &sinfo->rxpf_list) { + if (idx >= KCOM_FILTER_MAX) { + DBG_WARN(("Too many filters to list (max %d).\n", + KCOM_FILTER_MAX)); + break; + } + filter = (bkn_filter_t *)list; + kmsg->id[idx] = filter->kf.id; + idx++; + } + kmsg->fcnt = idx; + + spin_unlock_irqrestore(&sinfo->lock, flags); + + return sizeof(*kmsg) - sizeof(kmsg->id) + (idx * sizeof(kmsg->id[0])); +} + +static int +bkn_knet_filter_get(kcom_msg_filter_get_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + bkn_filter_t *filter; + struct list_head *list; + unsigned long flags; + int found; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + spin_lock_irqsave(&sinfo->lock, flags); + + found = 0; + list_for_each(list, &sinfo->rxpf_list) { + filter = (bkn_filter_t *)list; + if (kmsg->hdr.id == filter->kf.id) { + found = 1; + break; + } + } + + if (!found) { + spin_unlock_irqrestore(&sinfo->lock, flags); + kmsg->hdr.status = KCOM_E_NOT_FOUND; + return sizeof(kcom_msg_hdr_t); + } + + memcpy(&kmsg->filter, &filter->kf, sizeof(kmsg->filter)); + + spin_unlock_irqrestore(&sinfo->lock, flags); + + return sizeof(*kmsg); +} + +static int +bkn_knet_dbg_pkt_set(kcom_msg_dbg_pkt_set_t *kmsg, int len) +{ + dbg_pkt_enable = kmsg->enable; + return sizeof(kcom_msg_dbg_pkt_set_t); +} + +static int +bkn_knet_dbg_pkt_get(kcom_msg_dbg_pkt_get_t *kmsg, int len) +{ + kmsg->value = dbg_pkt_enable; + return sizeof(kcom_msg_dbg_pkt_get_t); +} + +static int +bkn_handle_cmd_req(kcom_msg_t *kmsg, int len) +{ + /* Silently drop events and unrecognized message types */ + if (kmsg->hdr.type != KCOM_MSG_TYPE_CMD) { + if (kmsg->hdr.opcode == KCOM_M_STRING) { + DBG_VERB(("Debug string: '%s'\n", kmsg->string.val)); + return 0; + } + DBG_WARN(("Unsupported message (type=%d, opcode=%d)\n", + kmsg->hdr.type, kmsg->hdr.opcode)); + return 0; + } + + switch (kmsg->hdr.opcode) { + case KCOM_M_DMA_INFO: + DBG_CMD(("KCOM_M_DMA_INFO\n")); + /* Packet buffer */ + len = bkn_knet_dma_info(&kmsg->dma_info, len); + break; + case KCOM_M_VERSION: + DBG_CMD(("KCOM_M_VERSION\n")); + /* Return procotol version */ + len = bkn_knet_version(&kmsg->version, len); + break; + case KCOM_M_HW_RESET: + DBG_CMD(("KCOM_M_HW_RESET\n")); + /* Shut down DMA and release buffers */ + len = bkn_knet_hw_reset(&kmsg->hw_reset, len); + break; + case KCOM_M_HW_INIT: + DBG_CMD(("KCOM_M_HW_INIT\n")); + /* Initialize DMA */ + len = bkn_knet_hw_init(&kmsg->hw_init, len); + break; + case KCOM_M_DETACH: + DBG_CMD(("KCOM_M_DETACH\n")); + /* Detach kernel module */ + len = bkn_knet_detach(&kmsg->detach, len); + break; + case KCOM_M_NETIF_CREATE: + DBG_CMD(("KCOM_M_NETIF_CREATE\n")); + /* Create network interface */ + len = bkn_knet_netif_create(&kmsg->netif_create, len); + break; + case KCOM_M_NETIF_DESTROY: + DBG_CMD(("KCOM_M_NETIF_DESTROY\n")); + /* Destroy network interface */ + len = bkn_knet_netif_destroy(&kmsg->netif_destroy, len); + break; + case KCOM_M_NETIF_LIST: + DBG_CMD(("KCOM_M_NETIF_LIST\n")); + /* Return list of IDs of installed network interfaces */ + len = bkn_knet_netif_list(&kmsg->netif_list, len); + break; + case KCOM_M_NETIF_GET: + DBG_CMD(("KCOM_M_NETIF_GET\n")); + /* Return network interface info */ + len = bkn_knet_netif_get(&kmsg->netif_get, len); + break; + case KCOM_M_FILTER_CREATE: + DBG_CMD(("KCOM_M_FILTER_CREATE\n")); + /* Create packet filter */ + len = bkn_knet_filter_create(&kmsg->filter_create, len); + break; + case KCOM_M_FILTER_DESTROY: + DBG_CMD(("KCOM_M_FILTER_DESTROY\n")); + /* Destroy packet filter */ + len = bkn_knet_filter_destroy(&kmsg->filter_destroy, len); + break; + case KCOM_M_FILTER_LIST: + DBG_CMD(("KCOM_M_FILTER_LIST\n")); + /* Return list of IDs of installed packet filters */ + len = bkn_knet_filter_list(&kmsg->filter_list, len); + break; + case KCOM_M_FILTER_GET: + DBG_CMD(("KCOM_M_FILTER_GET\n")); + /* Return packet filter info */ + len = bkn_knet_filter_get(&kmsg->filter_get, len); + break; + case KCOM_M_DBGPKT_SET: + DBG_CMD(("KCOM_M_DBGPKT_SET\n")); + /* Set debugging packet function */ + len = bkn_knet_dbg_pkt_set(&kmsg->dbg_pkt_set, len); + break; + case KCOM_M_DBGPKT_GET: + DBG_CMD(("KCOM_M_DBGPKT_GET\n")); + /* Get debugging packet function info */ + len = bkn_knet_dbg_pkt_get(&kmsg->dbg_pkt_get, len); + break; + default: + DBG_WARN(("Unsupported command (type=%d, opcode=%d)\n", + kmsg->hdr.type, kmsg->hdr.opcode)); + kmsg->hdr.opcode = 0; + len = sizeof(kcom_msg_hdr_t); + break; + } + return len; +} + +static int +bkn_cmd_thread(void *context) +{ + bkn_thread_ctrl_t *tc = (bkn_thread_ctrl_t *)context; + kcom_msg_t kmsg; + unsigned int len, rlen; + + bkn_thread_boot(tc); + + DBG_VERB(("Command thread starting\n")); + tc->state = 1; + while (!bkn_thread_should_stop(tc)) { + len = sizeof(kmsg); + tc->state = 2; + if (PROXY_RECV(KCOM_CHAN_KNET, &kmsg, &len) >= 0) { + DBG_VERB(("Received %d bytes from KCOM_CHAN_CMD\n", len)); + tc->state = 3; + rlen = bkn_handle_cmd_req(&kmsg, len); + tc->state = 4; + if (rlen > 0) { + PROXY_SEND(KCOM_CHAN_KNET, &kmsg, rlen); + } + } else { + /* Thread interrupted */ + bkn_sleep(1); + } + } + DBG_VERB(("Command thread done\n")); + + bkn_thread_exit(tc); + return 0; +} + +static int +bkn_get_next_dma_event(kcom_msg_dma_info_t *kmsg) +{ + static int last_dev_no = 0; + bkn_switch_info_t *sinfo; + unsigned long flags; + int dev_no, dev_evt; + bkn_evt_resource_t *evt; + + dev_evt = kmsg->hdr.unit; + sinfo = bkn_sinfo_from_unit(dev_evt); + if (sinfo == NULL) { + /* The device is not probed or initialized yet.*/ + return 0; + } + if (sinfo->evt_idx == -1) { + /* Event queue is not ready yet */ + return 0; + } + + DBG_INST(("%s dev %d evt_idx %d\n",__FUNCTION__, dev_evt, sinfo->evt_idx)); + evt = &_bkn_evt[sinfo->evt_idx]; + dev_no = last_dev_no = dev_evt; + while (1) { + dev_no++; + sinfo = bkn_sinfo_from_unit(dev_no); + if (sinfo == NULL) { + dev_no = 0; + sinfo = bkn_sinfo_from_unit(dev_no); + } + + if (sinfo && (sinfo->inst_id != 0) && + ((sinfo->inst_id & (1 << dev_evt)) == 0)) { + DBG_INST((" %s skip dev(%d)\n",__FUNCTION__,dev_evt)); + continue; + } + + if (sinfo && sinfo->dma_events) { + DBG_EVT(("Next DMA events (0x%08x)\n", sinfo->dma_events)); + kmsg->hdr.unit = sinfo->dev_no; + + spin_lock_irqsave(&sinfo->lock, flags); + kmsg->dma_info.flags = sinfo->dma_events; + sinfo->dma_events = 0; + spin_unlock_irqrestore(&sinfo->lock, flags); + + last_dev_no = dev_no; + break; + } + + if (dev_no == last_dev_no) { + DBG_INST(("wait queue index %d\n",sinfo->evt_idx)); + wait_event_interruptible(evt->evt_wq, + evt->evt_wq_get != evt->evt_wq_put); + DBG_VERB(("Event thread wakeup\n")); + + /* Thread interrupted */ + if (signal_pending(current)) { + return 0; + } + + evt->evt_wq_get = evt->evt_wq_put; + } + } + return sizeof(*kmsg); +} + +static int +bkn_evt_thread(void *context) +{ + bkn_thread_ctrl_t *tc = (bkn_thread_ctrl_t *)context; + kcom_msg_dma_info_t kmsg; + int len; + + bkn_thread_boot(tc); + + memset(&kmsg, 0, sizeof(kmsg)); + kmsg.hdr.type = KCOM_MSG_TYPE_EVT; + kmsg.hdr.opcode = KCOM_M_DMA_INFO; + + DBG_VERB(("Event thread starting\n")); + tc->state = 1; + while (!bkn_thread_should_stop(tc)) { + tc->state = 2; + len = bkn_get_next_dma_event(&kmsg); + tc->state = 3; + if (len) { + PROXY_SEND(KCOM_CHAN_KNET, &kmsg, len); + } else { + /* Thread interrupted */ + bkn_sleep(1); + } + } + DBG_VERB(("Event thread done\n")); + + bkn_thread_exit(tc); + return 0; +} + +static int +_cleanup(void) +{ + struct list_head *list; + struct net_device *dev; + bkn_filter_t *filter; + bkn_priv_t *priv; + bkn_switch_info_t *sinfo; + unsigned long flags; + + /* Inidicate that we are shutting down */ + module_initialized = 0; + + /* Shut down event thread */ + bkn_thread_stop(&bkn_evt_ctrl); + + /* Shut down command thread */ + bkn_thread_stop(&bkn_cmd_ctrl); + + /* Remove KCOM channel */ + PROXY_SERVICE_DESTROY(KCOM_CHAN_KNET); + + bkn_proc_cleanup(); + remove_proc_entry("bcm/knet", NULL); + remove_proc_entry("bcm", NULL); + + list_for_each(list, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)list; + + del_timer_sync(&sinfo->timer); + del_timer_sync(&sinfo->rxtick); + + spin_lock_irqsave(&sinfo->lock, flags); + bkn_dma_abort(sinfo); + dev_irq_mask_set(sinfo, 0); + spin_unlock_irqrestore(&sinfo->lock, flags); + + DBG_IRQ(("Unregister ISR.\n")); + kernel_bde->interrupt_disconnect(sinfo->dev_no | LKBDE_ISR2_DEV); + + if (use_napi) { + while (sinfo->napi_poll_mode) { + bkn_sleep(1); + } + } + + spin_lock_irqsave(&sinfo->lock, flags); + bkn_clean_dcbs(sinfo); + spin_unlock_irqrestore(&sinfo->lock, flags); + } + + /* Destroy all switch devices */ + while (!list_empty(&_sinfo_list)) { + sinfo = list_entry(_sinfo_list.next, bkn_switch_info_t, list); + + /* Destroy all associated Rx packet filters */ + while (!list_empty(&sinfo->rxpf_list)) { + filter = list_entry(sinfo->rxpf_list.next, bkn_filter_t, list); + list_del(&filter->list); + DBG_VERB(("Removing filter ID %d.\n", filter->kf.id)); + kfree(filter); + } + + /* Destroy all associated virtual net devices */ + while (!list_empty(&sinfo->ndev_list)) { + priv = list_entry(sinfo->ndev_list.next, bkn_priv_t, list); + list_del(&priv->list); + dev = priv->dev; + DBG_VERB(("Removing virtual Ethernet device %s.\n", dev->name)); + unregister_netdev(dev); + free_netdev(dev); + } + if (sinfo->ndevs != NULL) { + kfree(sinfo->ndevs); + } + + /* Destroy base net device */ + if (sinfo->dev) { + DBG_VERB(("Removing Ethernet device %s.\n", sinfo->dev->name)); + unregister_netdev(sinfo->dev); + free_netdev(sinfo->dev); + } + + DBG_VERB(("Removing switch device.\n")); + bkn_destroy_sinfo(sinfo); + } + + return 0; +} + +static int +bkn_knet_dev_reinit(int d) +{ + bkn_switch_info_t *sinfo; + uint32 dev_state; + uint32_t dev_type; + unsigned long flags; + + if (lkbde_dev_state_get(d, &dev_state) < 0) { + return -1; + } + DBG_VERB(("%s dev %d dev_state %d\n",__FUNCTION__, d, dev_state)); + if (dev_state == BDE_DEV_STATE_CHANGED) { + sinfo = bkn_sinfo_from_unit(d); + spin_lock_irqsave(&sinfo->lock, flags); + sinfo->base_addr = lkbde_get_dev_virt(d); + sinfo->dma_dev = lkbde_get_dma_dev(d); + sinfo->pdev = lkbde_get_hw_dev(d); + + dev_type = kernel_bde->get_dev_type(d); + /* Ensure 32-bit PCI DMA is mapped properly on 64-bit platforms */ + if (dev_type & BDE_PCI_DEV_TYPE) { + if (pci_set_dma_mask(sinfo->pdev, 0xffffffff)) { + gprintk("No suitable DMA available for SKBs\n"); + _cleanup(); + return -1; + } + } + dev_irq_mask_set(sinfo, 0); + spin_unlock_irqrestore(&sinfo->lock, flags); + + gprintk("Unregister ISR.\n"); + kernel_bde->interrupt_disconnect(sinfo->dev_no | LKBDE_ISR2_DEV); + + /* Register interrupt handler */ + kernel_bde->interrupt_connect(sinfo->dev_no | LKBDE_ISR2_DEV, + bkn_isr, sinfo); + + dev_state = 0; + lkbde_dev_state_set(d, dev_state); + } + return 0; +} + +static int +bkn_knet_dev_init(int d) +{ + uint32_t dev_type; + struct net_device *dev; + bkn_switch_info_t *sinfo; + bkn_priv_t *priv; + char *bdev_name; + const ibde_dev_t *bde_dev; + + DBG_VERB(("%s dev %d\n",__FUNCTION__, d)); + /* Base network device name */ + bdev_name = "bcm%d"; + if (base_dev_name) { + if (strlen(base_dev_name) < IFNAMSIZ) { + bdev_name = base_dev_name; + } else { + DBG_WARN(("Base device name too long\n")); + } + } + + dev_type = kernel_bde->get_dev_type(d); + DBG_VERB(("Found device type 0x%x\n", dev_type)); + if ((dev_type & BDE_SWITCH_DEV_TYPE) == 0) { + DBG_WARN(("Not switch device - skipping\n")); + return 0; + } + switch (dev_type & BDE_DEV_BUS_TYPE_MASK) { + case BDE_PCI_DEV_TYPE: + case BDE_ICS_DEV_TYPE: + case BDE_AXI_DEV_TYPE: + break; + default: + DBG_WARN(("Not PCI/ICS/AXI device - skipping\n")); + return 0; + } + + if ((sinfo = bkn_create_sinfo(d)) == NULL) { + _cleanup(); + return -ENOMEM; + } + /* Ensure 32-bit PCI DMA is mapped properly on 64-bit platforms */ + if (dev_type & BDE_PCI_DEV_TYPE) { + if (pci_set_dma_mask(sinfo->pdev, 0xffffffff)) { + gprintk("No suitable DMA available for SKBs\n"); + _cleanup(); + return -EIO; + } + } + /* Initialize the cpu_no.*/ + if (dev_type & BDE_AXI_DEV_TYPE) { + /* AXI device type implies the activated iProc iHost */ + sinfo->cpu_no = 1; + } + /* Initialize default RCPU signature */ + if ((bde_dev = kernel_bde->get_dev(d)) != NULL) { + sinfo->rcpu_sig = bde_dev->device & ~0xf; + } + /* Check for override */ + if (rcpu_signature) { + sinfo->rcpu_sig = rcpu_signature; + } + + /* Ensure all interrupts are disabled, e.g. if warmbooting */ + dev_irq_mask_set(sinfo, 0); + + /* Register interrupt handler */ + kernel_bde->interrupt_connect(sinfo->dev_no | LKBDE_ISR2_DEV, + bkn_isr, sinfo); + + /* Create base virtual net device */ + bkn_dev_mac[5]++; + if ((dev = bkn_init_ndev(bkn_dev_mac, bdev_name)) == NULL) { + _cleanup(); + return -ENOMEM; + } else { + sinfo->dev = dev; + priv = netdev_priv(dev); + priv->dev = dev; + priv->sinfo = sinfo; + priv->vlan = 1; + priv->port = -1; + memset(priv->itmh, 0, sizeof(priv->itmh)); + priv->id = -1; + } + + if (use_napi) { + netif_napi_add(dev, &sinfo->napi, bkn_poll, napi_weight); + } + return 0; +} + +static int +_init(void) +{ + int idx; + int num_dev; + int rv; + bkn_evt_resource_t *evt; + + /* Connect to the kernel bde */ + if ((linux_bde_create(NULL, &kernel_bde) < 0) || kernel_bde == NULL) { + return -ENODEV; + } + + /* Randomize Lower 3 bytes of the MAC address (TESTING ONLY) */ + get_random_bytes(&bkn_dev_mac[3], 3); + + /* Check for user-supplied MAC address (recommended) */ + if (mac_addr != NULL && strlen(mac_addr) == 17) { + for (idx = 0; idx < 6; idx++) { + bkn_dev_mac[idx] = simple_strtoul(&mac_addr[idx*3], NULL, 16); + } + /* Do not allow multicast address */ + bkn_dev_mac[0] &= ~0x01; + } + + /* Optional RCPU MAC addresses */ + if (rcpu_dmac != NULL && strlen(rcpu_dmac) == 17) { + for (idx = 0; idx < 6; idx++) { + bkn_rcpu_dmac[idx] = simple_strtoul(&rcpu_dmac[idx*3], NULL, 16); + } + } + if (rcpu_smac != NULL && strlen(rcpu_smac) == 17) { + for (idx = 0; idx < 6; idx++) { + bkn_rcpu_smac[idx] = simple_strtoul(&rcpu_smac[idx*3], NULL, 16); + } + } + + /* NAPI implies that base device must be up before we can pass traffic */ + if (use_napi) { + basedev_suspend = 1; + } + + num_dev = kernel_bde->num_devices(BDE_ALL_DEVICES); + for (idx = 0; idx < num_dev; idx++) { + rv = bkn_knet_dev_init(idx); + if (rv) { + return rv; + } + } + + /* Initialize proc files */ + proc_mkdir("bcm", NULL); + bkn_proc_root = proc_mkdir("bcm/knet", NULL); + + bkn_proc_init(); + + /* Initialize event queue */ + for (idx = 0; idx < LINUX_BDE_MAX_DEVICES; idx++) { + memset(&_bkn_evt[idx], 0, sizeof(bkn_evt_resource_t)); + } + evt = &_bkn_evt[0]; + init_waitqueue_head(&evt->evt_wq); + + if (use_proxy) { + PROXY_SERVICE_CREATE(KCOM_CHAN_KNET, 1, 0); + + DBG_VERB(("Starting command thread\n")); + bkn_thread_start(&bkn_cmd_ctrl, "bkncmd", bkn_cmd_thread); + + DBG_VERB(("Starting event thread\n")); + bkn_thread_start(&bkn_evt_ctrl, "bknevt", bkn_evt_thread); + } + + module_initialized = 1; + + return 0; +} + +static int +_ioctl(unsigned int cmd, unsigned long arg) +{ + bkn_ioctl_t io; + kcom_msg_t kmsg; + + if (!module_initialized) { + return -EFAULT; + } + + if (copy_from_user(&io, (void*)arg, sizeof(io))) { + return -EFAULT; + } + + if (io.len > sizeof(kmsg)) { + return -EINVAL; + } + + io.rc = 0; + + switch(cmd) { + case 0: + if (io.len > 0) { + if (copy_from_user(&kmsg, (void *)(unsigned long)io.buf, io.len)) { + return -EFAULT; + } + ioctl_cmd++; + io.len = bkn_handle_cmd_req(&kmsg, io.len); + ioctl_cmd--; + } else { + memset(&kmsg, 0, sizeof(kcom_msg_dma_info_t)); + /* + * Retrive the kmsg.hdr.unit from user space. The dma event queue + * selection is based the instance derived from unit. + */ + if (copy_from_user(&kmsg, (void *)(unsigned long)io.buf, sizeof(kmsg))) { + return -EFAULT; + } + kmsg.hdr.type = KCOM_MSG_TYPE_EVT; + kmsg.hdr.opcode = KCOM_M_DMA_INFO; + ioctl_evt++; + io.len = bkn_get_next_dma_event((kcom_msg_dma_info_t *)&kmsg); + ioctl_evt--; + } + if (io.len > 0) { + if (copy_to_user((void *)(unsigned long)io.buf, &kmsg, io.len)) { + return -EFAULT; + } + } + break; + default: + gprintk("Invalid IOCTL"); + io.rc = -1; + break; + } + + if (copy_to_user((void*)arg, &io, sizeof(io))) { + return -EFAULT; + } + + return 0; +} + +static gmodule_t _gmodule = { + name: MODULE_NAME, + major: MODULE_MAJOR, + init: _init, + cleanup: _cleanup, + pprint: _pprint, + ioctl: _ioctl, + open: NULL, + close: NULL, +}; + +gmodule_t* +gmodule_get(void) +{ + EXPORT_NO_SYMBOLS; + return &_gmodule; +} + +/* + * Call-back interfaces for other Linux kernel drivers. + * + * The Rx call-back allows an external module to modify SKB contents + * before it is handed off to the Linux network stack. + * + * The Tx call-back allows an external module to modify SKB contents + * before it is injected inot the switch. + */ + +int +bkn_rx_skb_cb_register(knet_skb_cb_f rx_cb) +{ + if (knet_rx_cb != NULL) { + return -1; + } + knet_rx_cb = rx_cb; + return 0; +} + +int +bkn_rx_skb_cb_unregister(knet_skb_cb_f rx_cb) +{ + if (rx_cb != NULL && knet_rx_cb != rx_cb) { + return -1; + } + knet_rx_cb = NULL; + return 0; +} + +int +bkn_tx_skb_cb_register(knet_skb_cb_f tx_cb) +{ + if (knet_tx_cb != NULL) { + return -1; + } + knet_tx_cb = tx_cb; + return 0; +} + +int +bkn_tx_skb_cb_unregister(knet_skb_cb_f tx_cb) +{ + if (tx_cb != NULL && knet_tx_cb != tx_cb) { + return -1; + } + knet_tx_cb = NULL; + return 0; +} + +int +bkn_filter_cb_register(knet_filter_cb_f filter_cb) +{ + if (knet_filter_cb != NULL) { + return -1; + } + knet_filter_cb = filter_cb; + return 0; +} + +int +bkn_filter_cb_unregister(knet_filter_cb_f filter_cb) +{ + if (filter_cb != NULL && knet_filter_cb != filter_cb) { + return -1; + } + knet_filter_cb = NULL; + return 0; +} + +LKM_EXPORT_SYM(bkn_rx_skb_cb_register); +LKM_EXPORT_SYM(bkn_rx_skb_cb_unregister); +LKM_EXPORT_SYM(bkn_tx_skb_cb_register); +LKM_EXPORT_SYM(bkn_tx_skb_cb_unregister); +LKM_EXPORT_SYM(bkn_filter_cb_register); +LKM_EXPORT_SYM(bkn_filter_cb_unregister); diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/bcm-knet.h b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/bcm-knet.h new file mode 100644 index 000000000000..277ea741525a --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/bcm-knet.h @@ -0,0 +1,79 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: bcm-knet.h,v 1.4 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ +#ifndef __LINUX_BCM_KNET_H__ +#define __LINUX_BCM_KNET_H__ + +#ifndef __KERNEL__ +#include +#endif + +typedef struct { + int rc; + int len; + int bufsz; + int reserved; + uint64_t buf; +} bkn_ioctl_t; + +#ifdef __KERNEL__ + +/* + * Call-back interfaces for other Linux kernel drivers. + */ +#include + +typedef struct { + uint32 netif_user_data; + uint32 filter_user_data; + uint16 dcb_type; +} knet_skb_cb_t; + +#define KNET_SKB_CB(__skb) ((knet_skb_cb_t *)&((__skb)->cb[0])) + +typedef struct sk_buff * +(*knet_skb_cb_f)(struct sk_buff *skb, int dev_no, void *meta); + +typedef int +(*knet_filter_cb_f)(uint8_t *pkt, int size, int dev_no, void *meta, + int chan, kcom_filter_t *filter); + +extern int +bkn_rx_skb_cb_register(knet_skb_cb_f rx_cb); + +extern int +bkn_rx_skb_cb_unregister(knet_skb_cb_f rx_cb); + +extern int +bkn_tx_skb_cb_register(knet_skb_cb_f tx_cb); + +extern int +bkn_tx_skb_cb_unregister(knet_skb_cb_f tx_cb); + +extern int +bkn_filter_cb_register(knet_filter_cb_f filter_cb); + +extern int +bkn_filter_cb_unregister(knet_filter_cb_f filter_cb); + +#endif + +#endif /* __LINUX_BCM_KNET_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/gmodule.h b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/gmodule.h new file mode 100644 index 000000000000..a0deac1bae08 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/gmodule.h @@ -0,0 +1,66 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: gmodule.h,v 1.9 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ + +#ifndef __COMMON_LINUX_KRN_GMODULE_H__ +#define __COMMON_LINUX_KRN_GMODULE_H__ + +#include + +typedef struct gmodule_s { + + const char* name; + int major; + int minor; + + int (*init)(void); + int (*cleanup)(void); + + int (*pprint)(void); + + int (*open)(void); + int (*ioctl)(unsigned int cmd, unsigned long arg); + int (*close)(void); + int (*mmap) (struct file *filp, struct vm_area_struct *vma); + +} gmodule_t; + + +/* The framework will ask for your module definition */ +extern gmodule_t* gmodule_get(void); + + +/* Proc Filesystem information */ +extern int pprintf(const char* fmt, ...) + __attribute__ ((format (printf, 1, 2))); +extern int gmodule_vpprintf(char** page, const char* fmt, va_list args) + __attribute__ ((format (printf, 2, 0))); +extern int gmodule_pprintf(char** page, const char* fmt, ...) + __attribute__ ((format (printf, 2, 3))); + +extern int gprintk(const char* fmt, ...) + __attribute__ ((format (printf, 1, 2))); + +extern int gdbg(const char* fmt, ...) + __attribute__ ((format (printf, 1, 2))); +#define GDBG gdbg + +#endif /* __COMMON_LINUX_KRN_GMODULE_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h new file mode 100644 index 000000000000..eb0077f2573b --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h @@ -0,0 +1,180 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: lkm.h,v 1.22 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ + +#ifndef __COMMON_LINUX_KRN_LKM_H__ +#define __COMMON_LINUX_KRN_LKM_H__ + +#ifndef __KERNEL__ +# define __KERNEL__ +#endif +#ifndef MODULE +# define MODULE +#endif + +#include +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#include +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0) +#include +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) +#include +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) +#include +#endif +#include + +/* Helper defines for multi-version kernel support */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#define LKM_2_4 +#else +#define LKM_2_6 +#endif + +#include /* printk() */ +#include /* everything... */ +#include /* error codes */ +#include /* size_t */ +#include +#include /* O_ACCMODE */ +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef CONFIG_DEVFS_FS +#include +#endif + +#define PROC_INTERFACE_KERN_VER_3_10 (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) + +/* Compatibility Macros */ + +#ifdef LKM_2_4 + +#include +#include +#define LKM_MOD_PARAM(n,ot,nt,d) MODULE_PARM(n,ot) +#define LKM_MOD_PARAM_ARRAY(n,ot,nt,c,d) MODULE_PARM(n,ot) +#define LKM_EXPORT_SYM(s) +#define _free_netdev kfree + +#else /* LKM_2_6 */ + +#define LKM_MOD_PARAM(n,ot,nt,d) module_param(n,nt,d) +#define LKM_MOD_PARAM_ARRAY(n,ot,nt,c,d) module_param_array(n,nt,c,d) +#define LKM_EXPORT_SYM(s) EXPORT_SYMBOL(s) +#define _free_netdev free_netdev + +#endif /* LKM_2_x */ + +#ifndef list_for_each_safe +#define list_for_each_safe(l,t,i) t = 0; list_for_each((l),(i)) +#endif + +#ifndef reparent_to_init +#define reparent_to_init() +#endif + +#ifndef MODULE_LICENSE +#define MODULE_LICENSE(str) +#endif + +#ifndef EXPORT_NO_SYMBOLS +#define EXPORT_NO_SYMBOLS +#endif + +#ifndef DEFINE_SPINLOCK +#define DEFINE_SPINLOCK(_lock) spinlock_t _lock = SPIN_LOCK_UNLOCKED +#endif + +#ifndef __SPIN_LOCK_UNLOCKED +#define __SPIN_LOCK_UNLOCKED(_lock) SPIN_LOCK_UNLOCKED +#endif + +#ifndef lock_kernel +#ifdef preempt_disable +#define lock_kernel() preempt_disable() +#else +#define lock_kernel() +#endif +#endif + +#ifndef unlock_kernel +#ifdef preempt_enable +#define unlock_kernel() preempt_enable() +#else +#define unlock_kernel() +#endif +#endif + +#ifndef init_MUTEX_LOCKED +#define init_MUTEX_LOCKED(_sem) sema_init(_sem, 0) +#endif + +#ifdef CONFIG_BCM98245 +#define CONFIG_BMW +#endif + +#if PROC_INTERFACE_KERN_VER_3_10 +#define PROC_CREATE(_entry, _name, _acc, _path, _fops) \ + do { \ + _entry = proc_create(_name, _acc, _path, _fops); \ + } while (0) + +#define PROC_CREATE_DATA(_entry, _name, _acc, _path, _fops, _data) \ + do { \ + _entry = proc_create_data(_name, _acc, _path, _fops, _data); \ + } while (0) + +#define PROC_PDE_DATA(_node) PDE_DATA(_node) + +#else +#define PROC_CREATE(_entry, _name, _acc, _path, _fops) \ + do { \ + _entry = create_proc_entry(_name, _acc, _path); \ + if (_entry) { \ + _entry->proc_fops = _fops; \ + } \ + } while (0) + +#define PROC_CREATE_DATA(_entry, _name, _acc, _path, _fops, _data) \ + do { \ + _entry = create_proc_entry(_name, _acc, _path); \ + if (_entry) { \ + _entry->proc_fops = _fops; \ + _entry->data=_data; \ + } \ + } while (0) + +#define PROC_PDE_DATA(_node) PROC_I(_node)->pde->data +#endif + +#endif /* __COMMON_LINUX_KRN_LKM_H__ */ diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile new file mode 100644 index 000000000000..ecabf0ae8e26 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile @@ -0,0 +1,65 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: +# $Copyright: (c) 2017 Broadcom Corp. +# All Rights Reserved.$ +# +LOCALDIR = systems/linux/kernel/modules/knet-cb + +include ${SDK}/make/Make.config + +LIBS = $(LIBDIR)/libkern.a + +ifeq ($(kernel_version),2_4) +MODULE = $(LIBDIR)/linux-knet-cb.o +else +KERNEL_MODULE_DIR = kernel_module + +THIS_MOD_NAME := linux-knet-cb +MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o +KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko + +build: $(MODULE) $(KMODULE) +endif + +KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../bcm-knet/kernel_module/Module.symvers + +# BCM Network Device + +$(MODULE): $(BLDDIR)/.tree $(BOBJS) $(LIBS) + $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ +ifneq ($(kernel_version),2_4) +$(KMODULE): $(MODULE) + rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) + mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) + cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile + cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers + MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko +endif + +# Make.depend is before clean:: so that Make.depend's clean:: runs first. + +include ${SDK}/make/Make.depend + +clean:: + $(RM) $(BLDDIR)/version.c $(BLDDIR)/version.o + $(RM) $(BOBJS) $(MODULE) + +ifneq ($(kernel_version),2_4) +.PHONY: build +endif diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/knet-cb.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/knet-cb.c new file mode 100644 index 000000000000..30fba8750ed3 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/knet-cb.c @@ -0,0 +1,276 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: + * $Copyright: (c) 2017 Broadcom Corp. + * All Rights Reserved.$ + */ + +/* + * Driver for call-back functions for Linux KNET driver. + * + * This is sample code that demonstrates how to selectively strip VLAN tags + * from an incoming packet based on tag information in the DMA control block + * (DCB). The switch will automatically add a VLAN tag to packets that ingress + * without an outer VLAN tag. Outer tagged and double tagged packets are + * not modified. The call back defined here determines which packets have + * had tags added by those and strips only those tags from the packet. + * + * This is sample code, the customer is responsible for maintaining and + * modifying this code as necessary. + * + * The module can be built from the standard Linux user mode target + * directories using the following command (assuming bash), e.g. + * + * cd $SDK/systems/linux/user/ + * make BUILD_KNET_CB=1 + * + */ + +#include /* Must be included first */ +#include +#include +#include + +MODULE_AUTHOR("Broadcom Corporation"); +MODULE_DESCRIPTION("Broadcom Linux KNET Call-Back Driver"); +MODULE_LICENSE("GPL"); + +/* Module Information */ +#define MODULE_MAJOR 121 +#define MODULE_NAME "linux-knet-cb" + +/* set KNET_CB_DEBUG for debug info */ +#define KNET_CB_DEBUG + +/* Maintain tag strip statistics */ +struct strip_stats_s { + unsigned long stripped; /* Number of packets that have been stripped */ + unsigned long checked; + unsigned long skipped; +}; + +static struct strip_stats_s strip_stats; + +/* Local function prototypes */ +static void strip_vlan_tag(struct sk_buff *skb); +static int get_tag_status(int dcb_type, void *meta); +static struct sk_buff *strip_tag_rx_cb(struct sk_buff *skb, int dev_no, void *meta); +static struct sk_buff *strip_tag_tx_cb(struct sk_buff *skb, int dev_no, void *meta); +static int strip_tag_filter_cb(uint8_t * pkt, int size, int dev_no, void *meta, + int chan, kcom_filter_t * kf); +static int _pprint(void); +static int _cleanup(void); +static int _init(void); + +/* Remove VLAN tag for select TPIDs */ +static void +strip_vlan_tag(struct sk_buff *skb) +{ + uint16_t vlan_proto = (uint16_t) ((skb->data[12] << 8) | skb->data[13]); + if ((vlan_proto == 0x8100) || (vlan_proto == 0x88a8) || (vlan_proto == 0x9100)) { + /* Move first 12 bytes of packet back by 4 */ + ((u32 *) skb->data)[3] = ((u32 *) skb->data)[2]; + ((u32 *) skb->data)[2] = ((u32 *) skb->data)[1]; + ((u32 *) skb->data)[1] = ((u32 *) skb->data)[0]; + skb_pull(skb, 4); /* Remove 4 bytes from start of buffer */ + } +} + +/* + * Location of tagging status in select DCB types found below: + * + * DCB type 14: word 12, bits 10.11 + * DCB type 19, 20, 21, 22, 30: word 12, bits 10..11 + * DCB type 23, 29: word 13, bits 0..1 + * DCB type 31, 34, 37: word 13, bits 0..1 + * DCB type 26, 32, 33, 35: word 13, bits 0..1 + * + * The function get_tag_status() returns the tag status for known DCB types. + * 0 = Untagged + * 1 = Single inner-tag + * 2 = Single outer-tag + * 3 = Double tagged. + * -1 = Unsupported DCB type + */ +static int +get_tag_status(int dcb_type, void *meta) +{ + uint32 *dcb = (uint32 *) meta; + int tag_status; + switch (dcb_type) { + case 14: + case 19: + case 20: + case 21: + case 22: + case 30: + tag_status = (dcb[12] > 10) & 0x3; + break; + case 23: + case 29: + case 31: + case 34: + case 37: + case 26: + case 32: + case 33: + case 35: + tag_status = dcb[13] & 0x3; + break; + default: + tag_status = -1; + break; + } + return tag_status; +} + +/* + * SDK-134189 added the ability to pass two 4 byte unsigned values to the + * KNET callback function, one from the matching filter and one from the + * network interface. The usage of this data is completely defined by the + * user. In this case, if bit 0 of the interface value is set, tag stripping + * is enabled for that interface. When creating the interface and filter, + * something like the following is necessary: "netif.cb_user_data = uflags". + */ +#define NETIF_UNTAGGED_STRIP (1 << 0) + +/* Rx packet callback function */ +static struct sk_buff * +strip_tag_rx_cb(struct sk_buff *skb, int dev_no, void *meta) +{ + unsigned netif_flags = KNET_SKB_CB(skb)->netif_user_data; + unsigned dcb_type; + int tag_status; + /* Currently not using filter flags: + * unsigned filter_flags = KNET_SKB_CB(skb)->filter_user_data; + */ + +#ifdef KNET_CB_DEBUG + gprintk("%s Enter; Flags: %08X\n", __func__, netif_flags); +#endif + + if ((netif_flags & NETIF_UNTAGGED_STRIP) == 0) { + /* Untagged stripping not enabled on this netif */ + strip_stats.skipped++; + return skb; + } + + /* Get DCB type for this packet, passed by KNET driver */ + dcb_type = KNET_SKB_CB(skb)->dcb_type; + + /* Get tag status from DCB */ + tag_status = get_tag_status(dcb_type, meta); + +#ifdef KNET_CB_DEBUG + gprintk("%s; DCB Type: %d; tag status: %d\n", __func__, dcb_type, tag_status); +#endif + + if (tag_status < 0) { + /* Unsupported DCB type */ + return skb; + } + + strip_stats.checked++; + /* + * Untagged and inner tagged packet will get a new tag from the switch + * device, we need to strip this off. + */ + if (tag_status < 2) { +#ifdef KNET_CB_DEBUG + gprintk("%s; Stripping VLAN\n", __func__); +#endif + strip_stats.stripped++; + strip_vlan_tag(skb); + } +#ifdef KNET_CB_DEBUG + else { + gprintk("%s; Preserve VLAN\n", __func__); + } +#endif + return skb; +} + +/* Tx callback not used */ +static struct sk_buff * +strip_tag_tx_cb(struct sk_buff *skb, int dev_no, void *meta) +{ + /* Pass through for now */ + return skb; +} + +/* Filter callback not used */ +static int +strip_tag_filter_cb(uint8_t * pkt, int size, int dev_no, void *meta, + int chan, kcom_filter_t *kf) +{ + /* Pass through for now */ + return 0; +} + +/* + * Get statistics. + * % cat /proc/linux-knet-cb + */ +static int +_pprint(void) +{ + pprintf("Broadcom Linux KNET Call-Back: Untagged VLAN Stripper\n"); + pprintf(" %lu stripped packets\n", strip_stats.stripped); + pprintf(" %lu packets checked\n", strip_stats.checked); + pprintf(" %lu packets skipped\n", strip_stats.skipped); + + return 0; +} + +static int +_cleanup(void) +{ + bkn_rx_skb_cb_unregister(strip_tag_rx_cb); + bkn_tx_skb_cb_unregister(strip_tag_tx_cb); + bkn_filter_cb_unregister(strip_tag_filter_cb); + + return 0; +} + +static int +_init(void) +{ + bkn_rx_skb_cb_register(strip_tag_rx_cb); + bkn_tx_skb_cb_register(strip_tag_tx_cb); + bkn_filter_cb_register(strip_tag_filter_cb); + + return 0; +} + +static gmodule_t _gmodule = { + name: MODULE_NAME, + major: MODULE_MAJOR, + init: _init, + cleanup: _cleanup, + pprint: _pprint, + ioctl: NULL, + open: NULL, + close: NULL, +}; + +gmodule_t* +gmodule_get(void) +{ + EXPORT_NO_SYMBOLS; + return &_gmodule; +} diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/Makefile new file mode 100644 index 000000000000..4c420c07ecdd --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/Makefile @@ -0,0 +1,30 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.2 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# +LOCALDIR = systems/linux/kernel/modules/shared + +include ${SDK}/make/Make.config + +lib = libkern + +include ${SDK}/make/Make.kernlib + +include ${SDK}/make/Make.depend diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c new file mode 100644 index 000000000000..a72a54ef1c69 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c @@ -0,0 +1,428 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: gmodule.c,v 1.20 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + * + * Generic Linux Module Framework + * + * Hooks up your driver to the kernel + */ + +#include +#include +#include +#include + +/* Module Vector Table */ +static gmodule_t* _gmodule = NULL; + + +/* Allow DEVFS Support on 2.4 Kernels */ +#if defined(LKM_2_4) && defined(CONFIG_DEVFS_FS) +#define GMODULE_CONFIG_DEVFS_FS +#endif + + +#ifdef GMODULE_CONFIG_DEVFS_FS +devfs_handle_t devfs_handle = NULL; +#endif + +/* FIXME: support dynamic debugging */ + +static int _dbg_enable = 0; + +static int +gvprintk(const char* fmt, va_list args) + __attribute__ ((format (printf, 1, 0))); + +static int +gvprintk(const char* fmt, va_list args) +{ + static char _buf[256]; + + strcpy(_buf, ""); + sprintf(_buf, "%s (%d): ", _gmodule->name, current->pid); + vsprintf(_buf+strlen(_buf), fmt, args); + printk("%s",_buf); + + return 0; +} + +int +gprintk(const char* fmt, ...) +{ + int rv; + + va_list args; + va_start(args, fmt); + rv = gvprintk(fmt, args); + va_end(args); + return rv; +} + +int +gdbg(const char* fmt, ...) +{ + int rv = 0; + + va_list args; + va_start(args, fmt); + if(_dbg_enable) { + rv = gvprintk(fmt, args); + } + va_end(args); + return rv; +} + + +/* + * Proc FS Utilities + */ +#if PROC_INTERFACE_KERN_VER_3_10 +static struct seq_file* _proc_buf = NULL; + +int +pprintf(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + seq_vprintf(_proc_buf, fmt, args); + va_end(args); + return 0; +} + +static int _gmodule_proc_show(struct seq_file *m, void *v){ + _proc_buf = m; + _gmodule->pprint(); + return 0; +} + +static int +_gmodule_proc_open(struct inode * inode, struct file * file) { + if(_gmodule->open) { + _gmodule->open(); + } + + return single_open(file, _gmodule_proc_show, NULL); +} + +static ssize_t +_gmodule_proc_write(struct file *file, const char *buffer, + size_t count, loff_t *loff) +{ + /* Workaround to toggle debugging */ + if(count > 2) { + if(buffer[0] == 'd') { + _dbg_enable = buffer[1] - '0'; + GDBG("Debugging Enabled"); + } + } + return count; +} + +static int _gmodule_proc_release(struct inode * inode, struct file * file) { + if(_gmodule->close) { + _gmodule->close(); + } + + return single_release(inode, file); +} + +struct file_operations _gmodule_proc_fops = { + owner: THIS_MODULE, + open: _gmodule_proc_open, + read: seq_read, + llseek: seq_lseek, + write: _gmodule_proc_write, + release: _gmodule_proc_release, +}; +#else +int +gmodule_vpprintf(char** page_ptr, const char* fmt, va_list args) +{ + *page_ptr += vsprintf(*page_ptr, fmt, args); + return 0; +} + +int +gmodule_pprintf(char** page_ptr, const char* fmt, ...) +{ + int rv; + + va_list args; + va_start(args, fmt); + rv = gmodule_vpprintf(page_ptr, fmt, args); + va_end(args); + return rv; +} + +static char* _proc_buf = NULL; + +int +pprintf(const char* fmt, ...) +{ + int rv; + + va_list args; + va_start(args, fmt); + rv = gmodule_vpprintf(&_proc_buf, fmt, args); + va_end(args); + return rv; +} + +#define PSTART(b) _proc_buf = b +#define PPRINT proc_print +#define PEND(b) (_proc_buf-b) + +static int +_gmodule_pprint(char* buf) +{ + PSTART(buf); + _gmodule->pprint(); + return PEND(buf); +} + +static int +_gmodule_read_proc(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + *eof = 1; + return _gmodule_pprint(page); +} + +static int +_gmodule_write_proc(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + /* Workaround to toggle debugging */ + if(count > 2) { + if(buffer[0] == 'd') { + _dbg_enable = buffer[1] - '0'; + GDBG("Debugging Enabled"); + } + } + return count; +} +#endif + +static int +_gmodule_create_proc(void) +{ + struct proc_dir_entry* ent; +#if PROC_INTERFACE_KERN_VER_3_10 + if((ent = proc_create(_gmodule->name, + S_IRUGO | S_IWUGO, + NULL, + &_gmodule_proc_fops)) != NULL) { + return 0; + } +#else + if((ent = create_proc_entry(_gmodule->name, S_IRUGO | S_IWUGO, NULL)) != NULL) { + ent->read_proc = _gmodule_read_proc; + ent->write_proc = _gmodule_write_proc; + return 0; + } +#endif + return -1; +} + +static void +_gmodule_remove_proc(void) +{ + remove_proc_entry(_gmodule->name, NULL); +} + +static int +_gmodule_open(struct inode *inode, struct file *filp) +{ + if(_gmodule->open) { + _gmodule->open(); + } + return 0; +} + +static int +_gmodule_release(struct inode *inode, struct file *filp) +{ + if(_gmodule->close) { + _gmodule->close(); + } + return 0; +} + +#ifdef HAVE_UNLOCKED_IOCTL +static long +_gmodule_unlocked_ioctl(struct file *filp, + unsigned int cmd, unsigned long arg) +{ + if(_gmodule->ioctl) { + return _gmodule->ioctl(cmd, arg); + } else { + return -1; + } +} +#else +static int +_gmodule_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + if(_gmodule->ioctl) { + return _gmodule->ioctl(cmd, arg); + } else { + return -1; + } +} +#endif + +#ifdef HAVE_COMPAT_IOCTL +static long +_gmodule_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + if(_gmodule->ioctl) { + return _gmodule->ioctl(cmd, arg); + } else { + return -1; + } +} +#endif + + +static int +_gmodule_mmap(struct file *filp, struct vm_area_struct *vma) +{ + if (_gmodule->mmap) { + return _gmodule->mmap(filp, vma); + } +#ifdef BCM_PLX9656_LOCAL_BUS + vma->vm_flags |= VM_RESERVED | VM_IO; + pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE | _PAGE_GUARDED; + + if (io_remap_pfn_range( vma, + vma->vm_start, + vma->vm_pgoff, + vma->vm_end - vma->vm_start, + vma->vm_page_prot)) { + return (-EAGAIN); + } + return (0); +#else/* BCM_PLX9656_LOCAL_BUS */ + return -EPERM; +#endif/* BCM_PLX9656_LOCAL_BUS */ +} + +/* FILE OPERATIONS */ + +struct file_operations _gmodule_fops = { +#ifdef HAVE_UNLOCKED_IOCTL + unlocked_ioctl: _gmodule_unlocked_ioctl, +#else + ioctl: _gmodule_ioctl, +#endif + open: _gmodule_open, + release: _gmodule_release, + mmap: _gmodule_mmap, +#ifdef HAVE_COMPAT_IOCTL + compat_ioctl: _gmodule_compat_ioctl, +#endif +}; + + +void __exit +cleanup_module(void) +{ + if(!_gmodule) return; + + /* Specific Cleanup */ + if(_gmodule->cleanup) { + _gmodule->cleanup(); + } + + /* Remove any proc entries */ + if(_gmodule->pprint) { + _gmodule_remove_proc(); + } + + /* Finally, remove ourselves from the universe */ +#ifdef GMODULE_CONFIG_DEVFS_FS + if(devfs_handle) devfs_unregister(devfs_handle); +#else + unregister_chrdev(_gmodule->major, _gmodule->name); +#endif +} + +int __init +init_module(void) +{ + int rc; + + /* Get our definition */ + _gmodule = gmodule_get(); + if(!_gmodule) return -ENODEV; + + + /* Register ourselves */ +#ifdef GMODULE_CONFIG_DEVFS_FS + devfs_handle = devfs_register(NULL, + _gmodule->name, + DEVFS_FL_NONE, + _gmodule->major, + _gmodule->minor, + S_IFCHR | S_IRUGO | S_IWUGO, + &_gmodule_fops, + NULL); + if(!devfs_handle) { + printk(KERN_WARNING "%s: can't register device with devfs", + _gmodule->name); + } + rc = 0; +#else + rc = register_chrdev(_gmodule->major, + _gmodule->name, + &_gmodule_fops); + if (rc < 0) { + printk(KERN_WARNING "%s: can't get major %d", + _gmodule->name, _gmodule->major); + return rc; + } + + if(_gmodule->major == 0) { + _gmodule->major = rc; + } +#endif + + /* Specific module Initialization */ + if(_gmodule->init) { + int rc; + if((rc = _gmodule->init()) < 0) { +#ifdef GMODULE_CONFIG_DEVFS_FS + if(devfs_handle) devfs_unregister(devfs_handle); +#else + unregister_chrdev(_gmodule->major, _gmodule->name); +#endif + return rc; + } + } + + /* Add a /proc entry, if valid */ + if(_gmodule->pprint) { + _gmodule_create_proc(); + } + + return 0; /* succeed */ +} diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c new file mode 100644 index 000000000000..1ed0416f02c9 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c @@ -0,0 +1,250 @@ +/* + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to + * you under the terms of the GNU General Public License version 2 (the + * "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, + * with the following added to such license: + * + * As a special exception, the copyright holders of this software give + * you permission to link this software with independent modules, and to + * copy and distribute the resulting executable under terms of your + * choice, provided that you also meet, for each linked independent + * module, the terms and conditions of the license of that module. An + * independent module is a module which is not derived from this + * software. The special exception does not apply to any modifications + * of the software. + */ +/* + * $Id: ksal.c,v 1.1 Broadcom SDK $ + * $Copyright: (c) 2005 Broadcom Corp. + * All Rights Reserved.$ + */ + +#include +#include + +#include "lkm.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) +#include +#else +#include +#endif +#include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) +#include +#endif +#include + +#ifdef MAX_USER_RT_PRIO +/* Assume 2.6 scheduler */ +#define SAL_YIELD(task) \ + yield() +#else +/* Assume 2.4 scheduler */ +#define SAL_YIELD(task) \ +do { \ + task->policy |= SCHED_YIELD; \ + schedule(); \ +} while (0) +#endif + +#define SECOND_USEC (1000000) +#define USECS_PER_JIFFY (SECOND_USEC / HZ) +#define USEC_TO_JIFFIES(usec) ((usec + (USECS_PER_JIFFY - 1)) / USECS_PER_JIFFY) + +#define sal_alloc(size, desc) kmalloc(size, GFP_KERNEL) +#define sal_free(ptr) kfree(ptr) + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) +#define WQ_SLEEP(a, b) wait_event_interruptible_timeout(a, NULL, b) +#else +#define WQ_SLEEP(a, b) interruptible_sleep_on_timeout(&(a), b) +#endif +/* + * sem_ctrl_t + * + * The semaphore control type uses the binary property to implement + * timed semaphores with improved performance using wait queues. + */ + +typedef struct sem_ctrl_s { + struct semaphore sem; + int binary; + int cnt; + wait_queue_head_t wq; +} sem_ctrl_t; + +sal_sem_t +sal_sem_create(char *desc, int binary, int initial_count) +{ + sem_ctrl_t *s; + + if ((s = sal_alloc(sizeof(*s), desc)) != 0) { + sema_init(&s->sem, initial_count); + s->binary = binary; + if (s->binary) { + init_waitqueue_head(&s->wq); + } + } + + return (sal_sem_t) s; +} + +void +sal_sem_destroy(sal_sem_t b) +{ + sem_ctrl_t *s = (sem_ctrl_t *) b; + + if (s == NULL) { + return; + } + + /* + * the linux kernel does not have a sema_destroy(s) + */ + sal_free(s); +} + +int +sal_sem_take(sal_sem_t b, int usec) +{ + sem_ctrl_t *s = (sem_ctrl_t *) b; + int err; + + if (usec == sal_sem_FOREVER && !in_interrupt()) { + err = down_interruptible(&s->sem); + } else { + int time_wait = 1; + int cnt = s->cnt; + + for (;;) { + if (down_trylock(&s->sem) == 0) { + err = 0; + break; + } + + if (s->binary) { + + /* Wait for event or timeout */ + + if (time_wait > 1) { + err = 1; + break; + } + err = wait_event_interruptible_timeout(s->wq, cnt != s->cnt, + USEC_TO_JIFFIES(usec)); + if (err < 0) { + break; + } + time_wait++; + + } else { + + /* Retry algorithm with exponential backoff */ + + if (time_wait > usec) { + time_wait = usec; + } + + sal_usleep(time_wait); + + usec -= time_wait; + + if (usec == 0) { + err = ETIMEDOUT; + break; + } + + if ((time_wait *= 2) > 100000) { + time_wait = 100000; + } + } + } + } + return err ? -1 : 0; +} + +int +sal_sem_give(sal_sem_t b) +{ + sem_ctrl_t *s = (sem_ctrl_t *) b; + + up(&s->sem); + if (s->binary) { + s->cnt++; + wake_up_interruptible(&s->wq); + } + return 0; +} + +uint32 +sal_time_usecs(void) +{ + struct timeval ltv; + do_gettimeofday(<v); + return (ltv.tv_sec * SECOND_USEC + ltv.tv_usec); +} + +void +sal_usleep(uint32 usec) +{ + uint32 start_usec; + wait_queue_head_t queue; + + if (usec <= SECOND_USEC / HZ) { + start_usec = sal_time_usecs(); + do { + SAL_YIELD(current); + } while ((sal_time_usecs() - start_usec) < usec); + } else { + init_waitqueue_head(&queue); + WQ_SLEEP(queue, USEC_TO_JIFFIES(usec)); + } +} + +void +sal_udelay(uint32 usec) +{ + static volatile int _sal_udelay_counter; + static int loops = 0; + int ix, iy; + + if (loops == 0 || usec == 0) { /* Need calibration? */ + int max_loops; + int start = 0, stop = 0; + int mpt = USECS_PER_JIFFY; /* usec/tick */ + + for (loops = 1; loops < 0x1000 && stop == start; loops <<= 1) { + /* Wait for clock turn over */ + for (stop = start = jiffies; start == stop; start = jiffies) { + /* Empty */ + } + sal_udelay(mpt); /* Single recursion */ + stop = jiffies; + } + + max_loops = loops / 2; /* Loop above overshoots */ + + start = stop = 0; + + if (loops < 4) { + loops = 4; + } + + for (loops /= 4; loops < max_loops && stop == start; loops++) { + /* Wait for clock turn over */ + for (stop = start = jiffies; start == stop; start = jiffies) { + /* Empty */ + } + sal_udelay(mpt); /* Single recursion */ + stop = jiffies; + } + } + + for (iy = 0; iy < usec; iy++) { + for (ix = 0; ix < loops; ix++) { + _sal_udelay_counter++; /* Prevent optimizations */ + } + } +} diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile new file mode 100644 index 000000000000..f78ed606aa63 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile @@ -0,0 +1,242 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.4 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ +# + +SDK :=$(shell if [ -n "$$SDK" ] ; then\ + echo $$SDK;\ + else\ + cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) + +ifeq ($(SDK),) +$(error Please run this in a tree) +endif + +export SDK + +override-target=linux-$(platform) + +ifeq ($(LINUX_MAKE_SHARED_LIB),1) +libext = so.$(SHAREDLIBVER) +else +libext = a +endif + +ifeq (,$(platform)) +$(error Internal error: platform variable is not set) +endif + +include $(SDK)/make/Make.config +LOCALDIR=systems/linux/user/common +include $(SDK)/make/Make.depend +kernel-override=linux-$(platform) +ifdef BLDCONFIG +KERN_BLDROOT=${SDK}/${SDKBUILD}/${BLDCONFIG}/$(kernel-override)$(bldroot_suffix) +else +KERN_BLDROOT=${SDK}/${SDKBUILD}/$(kernel-override)$(bldroot_suffix) +endif + +ifeq (,$(kernel_version)) +kernel_version=2_4 +endif + +ifeq ($(kernel_version),2_6) +KOBJ=ko +else +KOBJ=o +endif + +ifneq (,$(TOOLS_DIR)) +override PATH := $(TOOLS_DIR):$(PATH) +endif + +ifeq ($(DEST_DIR),) +DEST_DIR=${BLDDIR} +endif + +KERNEL_BDE_LOCAL :=linux-kernel-bde.$(KOBJ) +KERNEL_BDE :=$(DEST_DIR)/$(KERNEL_BDE_LOCAL) + +USER_BDE_LOCAL :=linux-user-bde.$(KOBJ) +USER_BDE=$(DEST_DIR)/$(USER_BDE_LOCAL) + +BCM_KNET_LOCAL :=linux-bcm-knet.$(KOBJ) +BCM_KNET=$(DEST_DIR)/$(BCM_KNET_LOCAL) + +KNET_CB_LOCAL := linux-knet-cb.$(KOBJ) +KNET_CB := $(DEST_DIR)/$(KNET_CB_LOCAL) + +ifeq (,$(findstring DELIVER,$(MAKECMDGOALS))) +.DEFAULT_GOAL := all +all_targets := kernel_modules $(KERNEL_BDE) $(USER_BDE) + +LOCAL_TARGETS := + +ifeq ($(NO_LOCAL_TARGETS),) +LOCAL_TARGETS +=$(patsubst %,$(realpath ..)/$(platform)/%,$(KERNEL_BDE_LOCAL) $(USER_BDE_LOCAL)) + +all_targets +=$(LOCAL_TARGETS) +endif + +# Build all by default +ifndef BUILD_KNET +BUILD_KNET = 1 +endif + +ifeq ($(BUILD_KNET),1) +# Kernel network support +all_targets += $(BCM_KNET) + +ifeq ($(NO_LOCAL_TARGETS),) +LOCAL_TARGETS +=$(patsubst %,../$(platform)/%,$(BCM_KNET_LOCAL)) +all_targets +=$(LOCAL_TARGETS) +endif + +ADD_TO_CFLAGS += -I$(SDK)/systems/linux/kernel/modules/include +COND_KNET_LIBS = libuser.$(libext) + +ifeq ($(BUILD_KNET_CB),1) +# KNET callback module support +all_targets += $(KNET_CB) + +ifeq ($(NO_LOCAL_TARGETS),) +LOCAL_TARGETS +=$(patsubst %,../$(platform)/%,$(KNET_CB_LOCAL)) +all_targets +=$(LOCAL_TARGETS) +endif +endif + +endif + +#OPENNSL_FIXUP +.NOTPARALLEL: + +all: $(BLDDIR)/.tree $(all_targets) + +ifeq ($(NO_LOCAL_TARGETS),) +define LOCAL_TARGET_DEF +$(1) : $(DEST_DIR)/$(notdir $(1)) + cp $$? $$@ +endef +endif + +# User BDE libraries +ADD_TO_CFLAGS += -I$(SDK)/systems/bde/linux/include + +# Use raw IOCTL for KNET +ADD_TO_CFLAGS += -DPROXY_SUPPORT=0 + +CFLAGS += $(ADD_TO_CFLAGS) + +# Kernel network support +ifdef BUILD_KNET + +knet_subdirs = shared bcm-knet + +ifdef BUILD_KNET_CB +knet_subdirs += knet-cb +endif + +endif # BUILD_KNET + +kernel_modules: + $(MAKE) -C $(SDK)/systems/bde/linux/kernel kernel_version=$(kernel_version) + $(MAKE) -C $(SDK)/systems/bde/linux/user/kernel kernel_version=$(kernel_version) +ifeq ($(BUILD_KNET),1) + $(MAKE) -j1 -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \ + subdirs="$(knet_subdirs)" override-target=linux-$(platform) CFLAGS="$(CFLAGS)" +endif + +$(KERNEL_BDE): $(KERN_BLDROOT)/linux-kernel-bde.$(KOBJ) + mkdir -p $(@D) + $(OBJCOPY) --strip-debug $< $@ + +$(USER_BDE): $(KERN_BLDROOT)/linux-user-bde.$(KOBJ) + $(OBJCOPY) --strip-debug $< $@ + +$(BCM_KNET): $(KERN_BLDROOT)/linux-bcm-knet.$(KOBJ) + $(OBJCOPY) --strip-debug $< $@ + +$(KNET_CB): $(KERN_BLDROOT)/linux-knet-cb.$(KOBJ) + $(OBJCOPY) --strip-debug $< $@ + +ifeq ($(NO_LOCAL_TARGETS),) +$(foreach targ,$(LOCAL_TARGETS),$(eval $(call LOCAL_TARGET_DEF,$(targ)))) +endif + +clean:: + $(MAKE) -C $(SDK)/systems/bde/linux/kernel $@ + $(MAKE) -C $(SDK)/systems/bde/linux/user/kernel $@ + $(MAKE) -C $(SDK)/systems/linux/kernel/modules \ + subdirs="$(knet_subdirs)" \ + override-target=linux-$(platform) $@ + $(RM) $(KERNEL_BDE) $(USER_BDE) + $(RM) $(BCM_KNET) + $(RM) $(KNET_CB) + $(RM) $(KERN_BLDROOT)/linux-kernel-bde.$(KOBJ) + $(RM) $(KERN_BLDROOT)/linux-user-bde.$(KOBJ) + $(RM) $(KERN_BLDROOT)/linux-bcm-knet.$(KOBJ) + $(RM) $(LOCAL_TARGETS) + +distclean:: clean + +.PHONY: variable + +# +# Echo variable values used for configuration +# usage: make VAR=CC variable +# +variable:: + @echo $($(VAR)) + +else +ifndef DELIVERY +$(error DELIVERY required) +endif + +DELIVERABLES := $(KERNEL_BDE) $(USER_BDE) +# 1= source +define DELIVERY_RULE +_DEL_TARG += $(DELIVERY)/$(notdir $(1)) +$(DELIVERY)/$(notdir $(1)) : $(1) + @mkdir -p $(DELIVERY) +ifeq ($(filter $(notdir $(BCM)) $(notdir $(BCM).dbg),$(notdir $1)),) + $(OBJCOPY) --strip-debug $$< $$@ +else + $(CP) -p $$< $$@ +endif +endef + +$(foreach f,$(DELIVERABLES),$(eval $(call DELIVERY_RULE,$(f)))) + +DELIVER: $(_DEL_TARG) +endif + +# Make.config defines remaining phony targets +.PHONY: build kernel_modules DELIVER + diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/gto-2_6/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/gto-2_6/Makefile new file mode 100644 index 000000000000..08f37e51c637 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/user/gto-2_6/Makefile @@ -0,0 +1,85 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.9 Broadcom SDK $ +# $Copyright: (c) 2007 Broadcom Corp. +# All Rights Reserved.$ + +# +# This make job requires the following environment variables to be set: +# +# SDK - path to StrataXGS SDK root directory +# +# Optionally the following environment variables can be set to +# override the default build server configuration: +# +# PPC_TOOLS_DIR - path to build tools (if not in PATH already) +# PPC_CROSS_COMPILE - cross compile tools prefix +# LINUX_INCLUDE - path to Linux kernel include directory +# + +SDK :=$(shell if [ -n "$$SDK" ] ; then\ + echo $$SDK;\ + else\ + cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) + +ifeq ($(SDK),) +$(error Please run this in a tree) +endif + +export SDK + +override kernel_version=2_6 +platform=gto-$(kernel_version) +LINUX_MAKE_USER=1 +export LINKER_RELAX=1 + +# Select the build environment +#BUILD_PLATFORM=ELDK +#BUILD_PLATFORM=WR_LINUX + +#Select the LINUX KERNEL VERSION +#KERN_VER = 2.6.21.7 +#KERN_VER = 2.6.24.4 +#KERN_VER = 2.6.25 + + +# Select the ELDK version +#ELDK_VERSION=4.1 +#ELDK_VERSION=4.0 + +#Select WRS Linux version +#WRS_LINUX_VERSION=2.0 +#WRS_LINUX_VERSION=3.0 + + +export KERN_VER +export ELDK_VERSION +export BUILD_PLATFORM +export WRS_LINUX_VERSION + +include ${SDK}/make/Make.linux + diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/gto/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/gto/Makefile new file mode 100644 index 000000000000..8e3422cd18d8 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/user/gto/Makefile @@ -0,0 +1,61 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.9 Broadcom SDK $ +# $Copyright: (c) 2015 Broadcom Corp. +# All Rights Reserved.$ + +# +# This make job requires the following environment variables to be set: +# +# SDK - path to StrataXGS SDK root directory +# +# Optionally the following environment variables can be set to +# override the default build server configuration: +# +# PPC_TOOLS_DIR - path to build tools (if not in PATH already) +# PPC_CROSS_COMPILE - cross compile tools prefix +# LINUX_INCLUDE - path to Linux kernel include directory +# + +SDK :=$(shell if [ -n "$$SDK" ] ; then\ + echo $$SDK;\ + else\ + cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) + +ifeq ($(SDK),) +$(error Please run this in a tree) +endif + +export SDK + +override kernel_version=4_4 +platform=gto +LINUX_MAKE_USER=1 +export LINKER_RELAX=1 + +include ${SDK}/make/Make.linux + diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/iproc-3_14/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/iproc-3_14/Makefile new file mode 100644 index 000000000000..c2081e42dc33 --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/user/iproc-3_14/Makefile @@ -0,0 +1,66 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.7 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ + +# +# This make job requires the following environment variables to be set: +# +# SDK - path to StrataXGS SDK root directory +# +# Optionally the following environment variables can be set to +# override the default build server configuration: +# +# MIPS_TOOLS_DIR - path to build tools (if not in PATH already) +# MIPS_CROSS_COMPILE - cross compile tools prefix +# LINUX_INCLUDE - path to Linux kernel include directory +# + +SDK :=$(shell if [ -n "$$SDK" ] ; then\ + echo $$SDK;\ + else\ + cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) + +ifeq ($(SDK),) +$(error Please run this in a tree) +endif + +export SDK + +override kernel_version=3_14 +platform=iproc-$(kernel_version) + +IPROC_BUILD=1 +export IPROC_BUILD +export BUILD_PLATFORM +export ARM_LINUX_VERSION + +LINUX_MAKE_USER=1 +export ADD_TO_CFLAGS + +include ${SDK}/make/Make.linux diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/iproc/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/iproc/Makefile new file mode 100644 index 000000000000..7eef55d448fd --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/user/iproc/Makefile @@ -0,0 +1,60 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.7 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ + +# +# This make job requires the following environment variables to be set: +# +# SDK - path to StrataXGS SDK root directory +# + +SDK :=$(shell if [ -n "$$SDK" ] ; then\ + echo $$SDK;\ + else\ + cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) + +ifeq ($(SDK),) +$(error Please run this in a tree) +endif + +export SDK + +override kernel_version=4_4 +platform=iproc + +IPROC_BUILD=1 +export IPROC_BUILD +export BUILD_PLATFORM +export ARM_LINUX_VERSION + +LINUX_MAKE_USER=1 +export ADD_TO_CFLAGS +export BR_NO_CCACHE + +include ${SDK}/make/Make.linux diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile new file mode 100644 index 000000000000..bb5408536a3d --- /dev/null +++ b/platform/broadcom/saibcm-modules/systems/linux/user/x86-smp_generic_64-2_6/Makefile @@ -0,0 +1,46 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# -*- Makefile -*- +# $Id: Makefile,v 1.2 Broadcom SDK $ +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved.$ + +SDK :=$(shell if [ -n "$$SDK" ] ; then\ + echo $$SDK;\ + else\ + cd $(dir $(lastword $(MAKEFILE_LIST))); while /usr/bin/test ! -e RELEASE ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find SDK in $(lastword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) + +ifeq ($(SDK),) +$(error Please run this in a tree) +endif + +export SDK + +override kernel_version=2_6 +platform=x86-smp_generic_64-$(kernel_version) + +LINUX_MAKE_USER=1 +include ${SDK}/make/Make.linux diff --git a/platform/broadcom/saibcm-modules/tools/mktool.pl b/platform/broadcom/saibcm-modules/tools/mktool.pl new file mode 100644 index 000000000000..96bff14ecdc8 --- /dev/null +++ b/platform/broadcom/saibcm-modules/tools/mktool.pl @@ -0,0 +1,293 @@ +# +# Unless you and Broadcom execute a separate written software license +# agreement governing use of this software, this software is licensed to +# you under the terms of the GNU General Public License version 2 (the +# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, +# with the following added to such license: +# +# As a special exception, the copyright holders of this software give +# you permission to link this software with independent modules, and to +# copy and distribute the resulting executable under terms of your +# choice, provided that you also meet, for each linked independent +# module, the terms and conditions of the license of that module. An +# independent module is a module which is not derived from this +# software. The special exception does not apply to any modifications +# of the software. +# +# +# mktool.pl +# +# $Id: mktool.pl,v 1.5 Broadcom SDK $ +# +# $Copyright: (c) 2005 Broadcom Corp. +# All Rights Reserved. $ + +use File::Path; +use File::Find; +use File::Copy; +use Cwd; + +($prog = $0) =~ s/.*\///; + +SWITCH: +{ + $op = shift; + + if ($op eq "-rm") { mktool_rm(@ARGV); last SWITCH; } + if ($op eq "-cp") { mktool_cp(@ARGV); last SWITCH; } + if ($op eq "-md") { mktool_md(@ARGV); last SWITCH; } + if ($op eq "-ln") { mktool_ln(@ARGV); last SWITCH; } + if ($op eq "-foreach") { mktool_foreach(@ARGV); last SWITCH; } + if ($op eq "-dep") { mktool_makedep(@ARGV); last SWITCH; } + if ($op eq "-echo") { mktool_echo(@ARGV); last SWITCH; } + if ($op eq "-beep") { mktool_beep(@ARGV); last SWITCH; } + die("$prog: unknown option '$op'\n"); +} + +exit 0; + + + + +# +# mktool_execute +# +# Executes a command, returns exist status. +# Performs token special translation before execution. +# + +sub mktool_execute +{ + my $token = shift; + my @cmds = @_; + +# printf("mktool_execute: token = '$token'\n"); + foreach $cmd (@cmds) + { + #printf("mktool_execute: cmd = '$cmd'\n"); + $cmd =~ s/\#\#/$token/g; + if($cmd =~ /^-p/) + { + $cmd =~ s/^-p//; + printf("$cmd\n"); + } + else + { + system($cmd); + my $excode = ($? >> 8); + exit $excode if $excode; + } + } +} + + +$find_regexp = ""; +@find_cmd; + +# +# mktool_foreach +# +sub mktool_foreach +{ + if($_[0] eq "-find") + { + shift; + $find_dir = shift; + $find_regexp = shift; + @find_cmds = @_; + + if(!($find_dir =~ /^\//)) + { + $find_dir = cwd() . "/" . $find_dir; + } + find(\&_mktool_foreach_find_wanted, $find_dir); + } + else + { + my $subdir = 0; + if($_[0] eq "-subdir") + { + $subdir = 1; + shift; + } + + my @thingies = split(' ', shift); + + foreach $thingy (@thingies) + { + chdir $thingy unless $subdir == 0; + mktool_execute($thingy, @_); + chdir ".." unless $subdir == 0; + } + } +} + + + +sub _mktool_foreach_find_wanted +{ + my $expr = "\$File::Find::name =~ /\^$find_regexp\$/"; + + if(eval($expr)) + { + mktool_execute($File::Find::name, @find_cmds); + exit $excode if $excode; + } +} + + +# +# rm +# +# Removes a list of objects +# +sub mktool_rm +{ + my($f); + + foreach $f (@_) { + eval { rmtree($f) }; + if ($@) { + die "$prog $op: failed to remove $f: $@\n"; + } + } +} + +# +# md +# +# Makes a list of directories +# +sub mktool_md +{ + my($dir); + + foreach $dir (@_) { + $dir =~ s!/+$!!; + eval { mkpath($dir) }; + if ($@) { + die "$prog $op: failed to make directory $dir: $@\n"; + } + } +} + + +sub mktool_cp +{ + my($from, $to) = @_; + + if (@_ != 2) { + die "$prog $op: must have two arguments\n"; + } + copy($from, $to) || + die "$prog $op: failed to copy $from to $to: $!\n"; +} + +sub mktool_ln +{ + my($old, $new) = @_; + + if (@_ != 2) { + die "$prog $op: must have two arguments\n"; + } + link ($old, $new) || + die "$prog $op: failed to link $new to $old: $!\n"; +} + + +# @echo "$@ \\" > ${BLDDIR}/$(notdir $@) +# @if ($(DEPEND)) >> $(BLDDIR)/$(notdir $@); then \ +# exit 0; \ +# else \ +# rm -f ${BLDDIR}/$(notdir $@); \ +# exit 1; \ +# fi + +# $(MAKEDEP) "$@" "$(BLDDIR)/$(notdir $@)" "$(DEPEND)" + +sub mktool_makedep +{ + my ($source, $target, $cmd, $curdir) = @_; + my @result = `$cmd`; + my $sdk = $ENV{'SDK'}; + my $count; + my $tmp; + local $resultant; + +## Comman $cmd +#Command $cmd +print <-1) & ($count < 20) ) + { + $line=~s/\/\w+\/\.\.//; + # if we hit a major recursion, revert the line, report + # this to the output and drop out of the loop, but do + # continue, this should not halt generation + if($count++>19) + { + print "mktool.pl: could not process $line \n\n"; + print ":: curdir $curdir\n"; + print ":: target $target\n"; + print ":: cmd $cmd\n"; + $line=$tmp; + } + } + + # set all the paths to use the $SDK variable + $line =~ s/$ENV{'SDK'}/\$\{SDK\}/g; + $resultant=$resultant . $line; + } + + # some compilers return extra newlines + $resultant=~s/\n//g; + + # now clean up the result + $resultant=~s/\\/\\\n/g; + + mktool_md($dirName) unless (-d $dirName); + open (TARGET, ">$target") || + die("$prog $op: cannot open '$target' for writing: $!\n"); + print TARGET "$resultant\n"; + close(TARGET); + } +} + +sub mktool_echo +{ + print "@_\n"; +} + +sub mktool_beep +{ + -t STDOUT && defined $ENV{MAKEBEEP} && print "\007"; +} diff --git a/platform/broadcom/sdk.mk b/platform/broadcom/sdk.mk deleted file mode 100644 index a74db331aba7..000000000000 --- a/platform/broadcom/sdk.mk +++ /dev/null @@ -1,4 +0,0 @@ -BRCM_OPENNSL_KERNEL = opennsl-modules-4.9.0-5-amd64_3.4.1.11-1_amd64.deb -$(BRCM_OPENNSL_KERNEL)_URL = "https://sonicstorage.blob.core.windows.net/packages/opennsl-modules-4.9.0-5-amd64_3.4.1.11-1_amd64.deb?sv=2015-04-05&sr=b&sig=vdIqSXaJhvN7Blk08WyxWhfMxky0XBx37JYAmNozx3k%3D&se=2155-01-24T09%3A08%3A25Z&sp=r" - -SONIC_ONLINE_DEBS += $(BRCM_OPENNSL_KERNEL) From 5d46e050d6dc0945741779139f12602b9eabd478 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 8 Aug 2018 07:43:00 +0000 Subject: [PATCH 1522/1833] [devices]: move platform modules of accton, ingrasys, mitac, quanta into buildimage repo Signed-off-by: Guohan Lu --- .gitmodules | 12 - .../broadcom/sonic-platform-modules-accton | 1 - .../sonic-platform-modules-accton/.gitignore | 33 + .../sonic-platform-modules-accton/LICENSE | 16 + .../sonic-platform-modules-accton/README.md | 1 + .../as5712-54x/classes/__init__.py | 0 .../as5712-54x/classes/fanutil.py | 238 ++ .../as5712-54x/classes/thermalutil.py | 121 + .../as5712-54x/modules/Makefile | 17 + .../modules/accton_as5712_54x_fan.c | 437 ++++ .../modules/accton_as5712_54x_psu.c | 371 ++++ .../modules/accton_as5712_54x_sfp.c | 825 +++++++ .../as5712-54x/modules/cpr_4011_4mxx.c | 400 ++++ .../modules/i2c-mux-accton_as5712_54x_cpld.c | 1517 +++++++++++++ .../modules/leds-accton_as5712_54x.c | 594 +++++ .../as5712-54x/modules/ym2651y.c | 683 ++++++ .../service/as5712-platform-monitor.service | 17 + .../as5712-54x/setup.py | 16 + .../as5712-54x/utils/README | 117 + .../as5712-54x/utils/accton_as5712_monitor.py | 195 ++ .../as5712-54x/utils/accton_as5712_util.py | 602 +++++ .../as5812-54t/modules/Makefile | 4 + .../as5812-54t/modules/accton_i2c_cpld.c | 330 +++ .../modules/x86-64-accton-as5812-54t-fan.c | 442 ++++ .../modules/x86-64-accton-as5812-54t-leds.c | 601 +++++ .../modules/x86-64-accton-as5812-54t-psu.c | 372 ++++ .../modules/x86-64-accton-as5812-54t-sfp.c | 318 +++ .../as5812-54t/modules/ym2651y.c | 680 ++++++ .../service/as5812-platform-init.service | 13 + .../as5812-54t/utils/README | 60 + .../utils/accton_as5812_54t_util.py | 565 +++++ .../as7312-54x/classes/__init__.py | 0 .../as7312-54x/classes/fanutil.py | 255 +++ .../as7312-54x/classes/thermalutil.py | 124 ++ .../as7312-54x/modules/Makefile | 17 + .../modules/accton_as7312_54x_fan.c | 815 +++++++ .../modules/accton_as7312_54x_leds.c | 438 ++++ .../modules/accton_as7312_54x_psu.c | 277 +++ .../modules/accton_as7312_54x_sfp.c | 1972 ++++++++++++++++ .../as7312-54x/modules/accton_i2c_cpld.c | 1219 ++++++++++ .../as7312-54x/modules/ym2651y.c | 1 + .../service/as7312-platform-monitor.service | 17 + .../as7312-54x/setup.py | 16 + .../as7312-54x/utils/README | 117 + .../as7312-54x/utils/accton_as7312_monitor.py | 208 ++ .../as7312-54x/utils/accton_as7312_util.py | 588 +++++ .../as7326-56x/classes/__init__.py | 0 .../as7326-56x/classes/fanutil.py | 254 +++ .../as7326-56x/classes/thermalutil.py | 124 ++ .../as7326-56x/modules/Makefile | 17 + .../modules/accton_as7326_56x_fan.c | 815 +++++++ .../modules/accton_as7326_56x_leds.c | 438 ++++ .../modules/accton_as7326_56x_psu.c | 277 +++ .../as7326-56x/modules/accton_i2c_cpld.c | 1080 +++++++++ .../as7326-56x/modules/ym2651y.c | 1 + .../service/as7326-platform-monitor.service | 17 + .../as7326-56x/setup.py | 16 + .../as7326-56x/utils/README | 74 + .../as7326-56x/utils/accton_as7326_monitor.py | 208 ++ .../as7326-56x/utils/accton_as7326_util.py | 577 +++++ .../as7712-32x/classes/__init__.py | 0 .../as7712-32x/modules/Makefile | 2 + .../modules/accton_as7712_32x_fan.c | 776 +++++++ .../modules/accton_as7712_32x_psu.c | 288 +++ .../modules/accton_as7712_32x_sfp.c | 1171 ++++++++++ .../as7712-32x/modules/accton_i2c_cpld.c | 1 + .../as7712-32x/modules/accton_pmbus_3y.c | 1 + .../modules/leds-accton_as7712_32x.c | 690 ++++++ .../as7712-32x/modules/pmbus.h | 1 + .../as7712-32x/modules/ym2651y.c | 1 + .../service/as7712-platform-init.service | 13 + .../as7712-32x/setup.py | 16 + .../as7712-32x/utils/README | 60 + .../as7712-32x/utils/accton_as7712_util.py | 569 +++++ .../as7716-32x/classes/__init__.py | 0 .../as7716-32x/classes/fanutil.py | 254 +++ .../as7716-32x/classes/thermalutil.py | 123 + .../as7716-32x/modules/Makefile | 21 + .../modules/accton_as7716_32x_cpld1.c | 781 +++++++ .../modules/accton_as7716_32x_fan.c | 794 +++++++ .../modules/accton_as7716_32x_leds.c | 442 ++++ .../modules/accton_as7716_32x_psu.c | 381 ++++ .../modules/accton_as7716_32x_sfp.c | 365 +++ .../as7716-32x/modules/accton_i2c_cpld.c | 259 +++ .../as7716-32x/modules/cpr_4011_4mxx.c | 400 ++++ .../as7716-32x/modules/optoe.c | 1148 ++++++++++ .../as7716-32x/modules/ym2651y.c | 603 +++++ .../service/as7716-platform-monitor.service | 17 + .../as7716-32x/setup.py | 16 + .../as7716-32x/utils/README | 117 + .../as7716-32x/utils/accton_as7716_monitor.py | 207 ++ .../as7716-32x/utils/accton_as7716_util.py | 595 +++++ .../as7716-32xb/classes/__init__.py | 0 .../as7716-32xb/classes/fanutil.py | 263 +++ .../as7716-32xb/classes/thermalutil.py | 124 ++ .../as7716-32xb/modules/Makefile | 17 + .../modules/accton_as7716_32xb_cpld1.c | 1021 +++++++++ .../modules/accton_as7716_32xb_fan.c | 969 ++++++++ .../modules/accton_as7716_32xb_leds.c | 443 ++++ .../modules/accton_as7716_32xb_oom.c | 267 +++ .../modules/accton_as7716_32xb_pmbus.c | 444 ++++ .../modules/accton_as7716_32xb_psu.c | 355 +++ .../modules/accton_as7716_32xb_sfp.c | 365 +++ .../modules/accton_as7716_32xb_sys.c | 243 ++ .../modules/accton_as7716_32xb_thermal.c | 214 ++ .../as7716-32xb/modules/accton_i2c_cpld.c | 259 +++ .../as7716_32xb-platform-monitor.service | 17 + .../as7716-32xb/setup.py | 16 + .../as7716-32xb/utils/README | 117 + .../utils/accton_as7716_32xb_drv_handler.py | 443 ++++ .../utils/accton_as7716_32xb_monitor.py | 227 ++ .../utils/accton_as7716_32xb_util.py | 616 +++++ .../as7816-64x/classes/__init__.py | 0 .../as7816-64x/classes/fanutil.py | 0 .../as7816-64x/classes/thermalutil.py | 0 .../as7816-64x/modules/Makefile | 2 + .../as7816-64x/modules/accton_i2c_cpld.c | 1 + .../modules/x86-64-accton-as7816-64x-fan.c | 466 ++++ .../modules/x86-64-accton-as7816-64x-leds.c | 460 ++++ .../modules/x86-64-accton-as7816-64x-psu.c | 239 ++ .../modules/x86-64-accton-as7816-64x-sfp.c | 1576 +++++++++++++ .../as7816-64x/modules/ym2651y.c | 1 + .../service/as7816-platform-init.service | 13 + .../as7816-64x/setup.py | 16 + .../as7816-64x/utils/README | 60 + .../as7816-64x/utils/accton_as7816_util.py | 523 +++++ .../common/modules/accton_i2c_cpld.c | 887 ++++++++ .../common/modules/accton_pmbus_3y.c | 1978 +++++++++++++++++ .../common/modules/cpr_4011_4mxx.c | 402 ++++ .../common/modules/pmbus.h | 389 ++++ .../common/modules/ym2651y.c | 619 ++++++ .../debian/changelog | 18 + .../debian/compat | 1 + .../debian/control | 41 + .../debian/rules | 86 + .../broadcom/sonic-platform-modules-ingrasys | 1 - .../.gitignore | 33 + .../sonic-platform-modules-ingrasys/LICENSE | 674 ++++++ .../debian/changelog | 22 + .../debian/compat | 1 + .../debian/control | 26 + .../debian/rules | 80 + .../sonic-platform-ingrasys-s8810-32q.dirs | 3 + .../sonic-platform-ingrasys-s8810-32q.install | 3 + ...sonic-platform-ingrasys-s8810-32q.postinst | 43 + .../sonic-platform-ingrasys-s8810-32q.postrm | 38 + .../sonic-platform-ingrasys-s8810-32q.prerm | 17 + .../sonic-platform-ingrasys-s8810-32q.upstart | 6 + .../sonic-platform-ingrasys-s8900-54xc.dirs | 3 + ...sonic-platform-ingrasys-s8900-54xc.install | 3 + ...onic-platform-ingrasys-s8900-54xc.postinst | 43 + .../sonic-platform-ingrasys-s8900-54xc.postrm | 38 + .../sonic-platform-ingrasys-s8900-54xc.prerm | 17 + ...sonic-platform-ingrasys-s8900-54xc.upstart | 6 + .../sonic-platform-ingrasys-s8900-64xc.dirs | 3 + ...sonic-platform-ingrasys-s8900-64xc.install | 3 + ...onic-platform-ingrasys-s8900-64xc.postinst | 42 + .../sonic-platform-ingrasys-s8900-64xc.postrm | 38 + .../sonic-platform-ingrasys-s8900-64xc.prerm | 15 + ...sonic-platform-ingrasys-s8900-64xc.upstart | 6 + .../debian/sonic-platform-ingrasys-s9100.dirs | 3 + .../sonic-platform-ingrasys-s9100.install | 3 + .../sonic-platform-ingrasys-s9100.postinst | 43 + .../sonic-platform-ingrasys-s9100.postrm | 38 + .../sonic-platform-ingrasys-s9100.prerm | 17 + .../sonic-platform-ingrasys-s9100.upstart | 6 + .../sonic-platform-ingrasys-s9200-64x.dirs | 3 + .../sonic-platform-ingrasys-s9200-64x.install | 3 + ...sonic-platform-ingrasys-s9200-64x.postinst | 43 + .../sonic-platform-ingrasys-s9200-64x.postrm | 38 + .../sonic-platform-ingrasys-s9200-64x.prerm | 17 + .../sonic-platform-ingrasys-s9200-64x.upstart | 6 + .../s8810-32q/README.md | 185 ++ .../s8810-32q/modules/Makefile | 2 + .../s8810-32q/modules/eeprom_mb.c | 212 ++ .../modules/ingrasys_s8810_32q_platform.h | 148 ++ .../modules/ingrasys_s8810_32q_psu.c | 393 ++++ .../s8810-32q/service/qsfp-monitor.service | 15 + .../service/s8810-32q-monitor.service | 19 + .../s8810-32q/utils/i2c_utils.sh | 1452 ++++++++++++ .../s8810-32q/utils/qsfp_monitor.sh | 104 + .../s8810-32q/utils/s8810_32q_monitor.sh | 39 + .../s8900-54xc/README.md | 185 ++ .../s8900-54xc/modules/Makefile | 2 + .../s8900-54xc/modules/eeprom_mb.c | 212 ++ .../s8900-54xc/modules/i2c_cpld.c | 448 ++++ .../s8900-54xc/modules/i2c_cpld.h | 197 ++ .../s8900-54xc/service/qsfp-monitor.service | 15 + .../service/s8900-54xc-monitor.service | 18 + .../s8900-54xc/utils/i2c_utils.sh | 1485 +++++++++++++ .../s8900-54xc/utils/qsfp_monitor.sh | 106 + .../s8900-54xc/utils/qsfp_si_cfg.sh | 331 +++ .../s8900-54xc/utils/s8900_54xc_monitor.sh | 39 + .../s8900-64xc/README.md | 185 ++ .../s8900-64xc/modules/Makefile | 4 + .../s8900-64xc/modules/eeprom_mb.c | 212 ++ .../s8900-64xc/modules/i2c_cpld.c | 448 ++++ .../s8900-64xc/modules/i2c_cpld.h | 197 ++ .../s8900-64xc/modules/qsfp_cpld.c | 1771 +++++++++++++++ .../s8900-64xc/service/qsfp-monitor.service | 15 + .../service/s8900-64xc-monitor.service | 18 + .../s8900-64xc/utils/i2c_utils.sh | 1157 ++++++++++ .../s8900-64xc/utils/qsfp_monitor.sh | 106 + .../s8900-64xc/utils/qsfp_si_cfg.sh | 409 ++++ .../s8900-64xc/utils/s8900_64xc_monitor.sh | 39 + .../s9100/README.md | 185 ++ .../s9100/modules/Makefile | 2 + .../s9100/modules/eeprom_mb.c | 212 ++ .../s9100/modules/i2c_cpld.c | 448 ++++ .../s9100/modules/i2c_cpld.h | 197 ++ .../s9100/service/qsfp-monitor.service | 15 + .../s9100/service/s9100-monitor.service | 19 + .../s9100/utils/i2c_utils.sh | 1518 +++++++++++++ .../s9100/utils/qsfp_monitor.sh | 104 + .../s9100/utils/qsfp_si_cfg.sh | 339 +++ .../s9100/utils/s9100_monitor.sh | 39 + .../s9200-64x/README.md | 184 ++ .../s9200-64x/modules/Makefile | 3 + .../s9200-64x/modules/cpld.c | 498 +++++ .../s9200-64x/modules/eeprom_mb.c | 267 +++ .../modules/ingrasys_s9200_64x_platform.h | 148 ++ .../modules/ingrasys_s9200_64x_psu.c | 389 ++++ .../s9200-64x/service/qsfp-monitor.service | 15 + .../service/s9200-64x-monitor.service | 19 + .../s9200-64x/utils/i2c_utils.sh | 1942 ++++++++++++++++ .../s9200-64x/utils/qsfp_monitor.sh | 104 + .../s9200-64x/utils/qsfp_si_cfg.sh | 230 ++ .../s9200-64x/utils/s9200_64x_monitor.sh | 39 + .../broadcom/sonic-platform-modules-mitac | 1 - .../sonic-platform-modules-mitac/.gitignore | 17 + .../sonic-platform-modules-mitac/LICENSE | 16 + .../sonic-platform-modules-mitac/README.md | 1 + .../debian/changelog | 5 + .../debian/compat | 1 + .../debian/control | 12 + .../sonic-platform-modules-mitac/debian/rules | 41 + .../sonic-platform-mitac-ly1200-32x.init | 51 + .../sonic-platform-mitac-ly1200-32x.upstart | 5 + .../ly1200-32x/etc/init.d/fan-ctrld | 35 + .../ly1200-32x/etc/init.d/gpe | 39 + .../ly1200-32x/etc/init.d/i2c_init | 214 ++ .../ly1200-32x/etc/init.d/sys_polld | 48 + .../ly1200-32x/etc/init.d/sys_servd | 28 + .../ly1200-32x/etc/init.d/xcvr_servd | 28 + .../ly1200-32x/etc/rc0.d/K02xcvr_servd | 1 + .../ly1200-32x/etc/rc1.d/K02xcvr_servd | 1 + .../ly1200-32x/etc/rc6.d/K02xcvr_servd | 1 + .../ly1200-32x/modules/Makefile | 5 + .../ly1200-32x/modules/bms_i2c.h | 26 + .../ly1200-32x/modules/master_cpld_reg.h | 275 +++ .../ly1200-32x/modules/master_cpld_sysfs.h | 226 ++ .../modules/mitac_ly1200_32x_cb_i2c.c | 163 ++ .../modules/mitac_ly1200_32x_fb_i2c.c | 153 ++ .../modules/mitac_ly1200_32x_fb_module_i2c.c | 138 ++ .../modules/mitac_ly1200_32x_fse000.c | 1787 +++++++++++++++ .../ly1200-32x/modules/mitac_ly1200_32x_gpe.c | 93 + .../modules/mitac_ly1200_32x_master_cpld.c | 503 +++++ .../modules/mitac_ly1200_32x_pb_i2c.c | 137 ++ .../modules/mitac_ly1200_32x_sb_i2c.c | 514 +++++ .../modules/mitac_ly1200_32x_slave_cpld.c | 427 ++++ .../modules/mitac_ly1200_32x_system_cpld.c | 541 +++++ .../ly1200-32x/modules/pmbus.h | 366 +++ .../ly1200-32x/modules/slave_cpld_reg.h | 192 ++ .../ly1200-32x/modules/slave_cpld_sysfs.h | 155 ++ .../ly1200-32x/modules/system_cpld_reg.h | 107 + .../ly1200-32x/modules/system_cpld_sysfs.h | 76 + .../ly1200-32x/opt/fan-ctrl/fan-ctrl | 679 ++++++ .../opt/fan-ctrl/fan-zone-thermal_B2F.conf | 12 + .../opt/fan-ctrl/fan-zone-thermal_F2B.conf | 12 + .../ly1200-32x/opt/fan-ctrl/fan-zone_B2F.conf | 38 + .../ly1200-32x/opt/fan-ctrl/fan-zone_F2B.conf | 38 + .../ly1200-32x/opt/fan-ctrl/funcs.sh | 22 + .../ly1200-32x/opt/fan-ctrl/init.sh | 26 + .../ly1200-32x/opt/script/funcs.sh | 23 + .../ly1200-32x/opt/script/start_service.sh | 99 + .../ly1200-32x/opt/script/start_watchdog.sh | 32 + .../ly1200-32x/opt/sys-serv/sys-servd | Bin 0 -> 56280 bytes .../opt/system-check/system-check.sh | 55 + .../ly1200-32x/opt/watchdog/watchdog.conf | 45 + .../ly1200-32x/opt/xcvr-serv/xcvr-servd | Bin 0 -> 31456 bytes .../broadcom/sonic-platform-modules-quanta | 1 - .../sonic-platform-modules-quanta/.gitignore | 37 + .../sonic-platform-modules-quanta/LICENSE | 16 + .../sonic-platform-modules-quanta/README.md | 2 + .../debian/changelog | 6 + .../debian/compat | 1 + .../debian/control | 12 + .../debian/rules | 86 + .../ix1b-32x/classes/__init__.py | 0 .../ix1b-32x/modules/Makefile | 3 + .../ix1b-32x/modules/pmbus.h | 387 ++++ .../ix1b-32x/modules/qci_cpld_qsfp28.c | 409 ++++ .../ix1b-32x/modules/qci_platform.h | 64 + .../ix1b-32x/modules/qci_platform_ix1b.c | 491 ++++ .../ix1b-32x/modules/qci_pmbus.c | 487 ++++ .../service/ix1b-platform-init.service | 13 + .../ix1b-32x/setup.py | 16 + .../ix1b-32x/utils/quanta_ix1b_util.py | 203 ++ 298 files changed, 72066 insertions(+), 16 deletions(-) delete mode 160000 platform/broadcom/sonic-platform-modules-accton create mode 100644 platform/broadcom/sonic-platform-modules-accton/.gitignore create mode 100644 platform/broadcom/sonic-platform-modules-accton/LICENSE create mode 100644 platform/broadcom/sonic-platform-modules-accton/README.md create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/fanutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/thermalutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_fan.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_psu.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_sfp.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/cpr_4011_4mxx.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/i2c-mux-accton_as5712_54x_cpld.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/leds-accton_as5712_54x.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/ym2651y.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/service/as5712-platform-monitor.service create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/README create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/accton_i2c_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-fan.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-leds.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-psu.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-sfp.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/ym2651y.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5812-54t/service/as5812-platform-init.service create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/README create mode 100755 platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_54t_util.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/fanutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/thermalutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_fan.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_leds.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_psu.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_sfp.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_i2c_cpld.c create mode 120000 platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/ym2651y.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7312-54x/service/as7312-platform-monitor.service create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7312-54x/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/README create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_fan.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_i2c_cpld.c create mode 120000 platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/ym2651y.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-monitor.service create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/README create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7712-32x/classes/__init__.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c create mode 120000 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c create mode 120000 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_pmbus_3y.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c create mode 120000 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/pmbus.h create mode 120000 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-platform-init.service create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7712-32x/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/README create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/fanutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/thermalutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_cpld1.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_fan.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_leds.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_sfp.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_i2c_cpld.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/cpr_4011_4mxx.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/optoe.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/ym2651y.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/service/as7716-platform-monitor.service create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/README create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/fanutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/thermalutil.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_cpld1.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_fan.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_leds.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_oom.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_pmbus.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_psu.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_sfp.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_sys.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_thermal.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_i2c_cpld.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/service/as7716_32xb-platform-monitor.service create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/README create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/__init__.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/Makefile create mode 120000 platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/accton_i2c_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-fan.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-leds.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-psu.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-sfp.c create mode 120000 platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/ym2651y.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7816-64x/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/README create mode 100755 platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/common/modules/accton_i2c_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/common/modules/accton_pmbus_3y.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/common/modules/cpr_4011_4mxx.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/common/modules/pmbus.h create mode 100644 platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c create mode 100755 platform/broadcom/sonic-platform-modules-accton/debian/changelog create mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/compat create mode 100755 platform/broadcom/sonic-platform-modules-accton/debian/control create mode 100755 platform/broadcom/sonic-platform-modules-accton/debian/rules delete mode 160000 platform/broadcom/sonic-platform-modules-ingrasys create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/.gitignore create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/LICENSE create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/changelog create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/compat create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/control create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/rules create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.dirs create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.install create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.postinst create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.postrm create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.prerm create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.upstart create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.dirs create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.install create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.postinst create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.postrm create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.prerm create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.upstart create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.dirs create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.install create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.postinst create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.postrm create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.prerm create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.upstart create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.dirs create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.install create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.postinst create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.postrm create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.prerm create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.upstart create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.dirs create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.install create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.postinst create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.postrm create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.prerm create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.upstart create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/README.md create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/eeprom_mb.c create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/ingrasys_s8810_32q_platform.h create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/ingrasys_s8810_32q_psu.c create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/service/qsfp-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/service/s8810-32q-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/i2c_utils.sh create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/qsfp_monitor.sh create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/s8810_32q_monitor.sh create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/README.md create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/eeprom_mb.c create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/i2c_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/i2c_cpld.h create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/service/qsfp-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/service/s8900-54xc-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/i2c_utils.sh create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/qsfp_monitor.sh create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/qsfp_si_cfg.sh create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/s8900_54xc_monitor.sh create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/README.md create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/eeprom_mb.c create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/i2c_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/i2c_cpld.h create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/qsfp_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/service/qsfp-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/service/s8900-64xc-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/i2c_utils.sh create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/qsfp_monitor.sh create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/qsfp_si_cfg.sh create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/s8900_64xc_monitor.sh create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s9100/README.md create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/eeprom_mb.c create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/i2c_cpld.c create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/i2c_cpld.h create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s9100/service/qsfp-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s9100/service/s9100-monitor.service create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/i2c_utils.sh create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/qsfp_monitor.sh create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/qsfp_si_cfg.sh create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/s9100_monitor.sh create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/README.md create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/cpld.c create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/eeprom_mb.c create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/ingrasys_s9200_64x_platform.h create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/ingrasys_s9200_64x_psu.c create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/service/qsfp-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/service/s9200-64x-monitor.service create mode 100644 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/i2c_utils.sh create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/qsfp_monitor.sh create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/qsfp_si_cfg.sh create mode 100755 platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/s9200_64x_monitor.sh delete mode 160000 platform/broadcom/sonic-platform-modules-mitac create mode 100644 platform/broadcom/sonic-platform-modules-mitac/.gitignore create mode 100644 platform/broadcom/sonic-platform-modules-mitac/LICENSE create mode 100644 platform/broadcom/sonic-platform-modules-mitac/README.md create mode 100644 platform/broadcom/sonic-platform-modules-mitac/debian/changelog create mode 100644 platform/broadcom/sonic-platform-modules-mitac/debian/compat create mode 100644 platform/broadcom/sonic-platform-modules-mitac/debian/control create mode 100755 platform/broadcom/sonic-platform-modules-mitac/debian/rules create mode 100644 platform/broadcom/sonic-platform-modules-mitac/debian/sonic-platform-mitac-ly1200-32x.init create mode 100644 platform/broadcom/sonic-platform-modules-mitac/debian/sonic-platform-mitac-ly1200-32x.upstart create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/fan-ctrld create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/gpe create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/i2c_init create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/sys_polld create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/sys_servd create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/xcvr_servd create mode 120000 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc0.d/K02xcvr_servd create mode 120000 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc1.d/K02xcvr_servd create mode 120000 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc6.d/K02xcvr_servd create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/bms_i2c.h create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/master_cpld_reg.h create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/master_cpld_sysfs.h create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_cb_i2c.c create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fb_i2c.c create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fb_module_i2c.c create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fse000.c create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_gpe.c create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_master_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_pb_i2c.c create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_sb_i2c.c create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_slave_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_system_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/pmbus.h create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/slave_cpld_reg.h create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/slave_cpld_sysfs.h create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/system_cpld_reg.h create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/system_cpld_sysfs.h create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-ctrl create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone-thermal_B2F.conf create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone-thermal_F2B.conf create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone_B2F.conf create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone_F2B.conf create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/funcs.sh create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/init.sh create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/funcs.sh create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/start_service.sh create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/start_watchdog.sh create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/sys-serv/sys-servd create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/system-check/system-check.sh create mode 100644 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/watchdog/watchdog.conf create mode 100755 platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/xcvr-serv/xcvr-servd delete mode 160000 platform/broadcom/sonic-platform-modules-quanta create mode 100755 platform/broadcom/sonic-platform-modules-quanta/.gitignore create mode 100755 platform/broadcom/sonic-platform-modules-quanta/LICENSE create mode 100644 platform/broadcom/sonic-platform-modules-quanta/README.md create mode 100755 platform/broadcom/sonic-platform-modules-quanta/debian/changelog create mode 100755 platform/broadcom/sonic-platform-modules-quanta/debian/compat create mode 100755 platform/broadcom/sonic-platform-modules-quanta/debian/control create mode 100755 platform/broadcom/sonic-platform-modules-quanta/debian/rules create mode 100755 platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/classes/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/pmbus.h create mode 100755 platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_cpld_qsfp28.c create mode 100755 platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_platform.h create mode 100755 platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_platform_ix1b.c create mode 100755 platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_pmbus.c create mode 100755 platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/service/ix1b-platform-init.service create mode 100755 platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/utils/quanta_ix1b_util.py diff --git a/.gitmodules b/.gitmodules index f0cbe5c2a38c..73ab4bf8ba13 100755 --- a/.gitmodules +++ b/.gitmodules @@ -47,18 +47,12 @@ path = platform/broadcom/sonic-platform-modules-dell url = https://github.com/lguohan/sonic-platform-modules-dell branch = stretch -[submodule "platform/broadcom/sonic-platform-modules-ingrasys"] - path = platform/broadcom/sonic-platform-modules-ingrasys - url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys [submodule "src/sonic-platform-common"] path = src/sonic-platform-common url = https://github.com/Azure/sonic-platform-common [submodule "src/sonic-platform-daemons"] path = src/sonic-platform-daemons url = https://github.com/Azure/sonic-platform-daemons -[submodule "platform/broadcom/sonic-platform-modules-accton"] - path = platform/broadcom/sonic-platform-modules-accton - url = https://github.com/edge-core/sonic-platform-modules-accton.git [submodule "src/sonic-frr/frr"] path = src/sonic-frr/frr url = https://github.com/FRRouting/frr.git @@ -71,12 +65,6 @@ [submodule "platform/nephos/sonic-platform-modules-ingrasys"] path = platform/nephos/sonic-platform-modules-ingrasys url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys-nephos.git -[submodule "platform/broadcom/sonic-platform-modules-quanta"] - path = platform/broadcom/sonic-platform-modules-quanta - url = https://github.com/QuantaSwitchONIE/sonic-platform-modules-quanta.git -[submodule "platform/broadcom/sonic-platform-modules-mitac"] - path = platform/broadcom/sonic-platform-modules-mitac - url = https://github.com/MiTAC-EBU/sonic-platform-modules-mitac.git [submodule "platform/barefoot/sonic-platform-modules-arista"] path = platform/barefoot/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic diff --git a/platform/broadcom/sonic-platform-modules-accton b/platform/broadcom/sonic-platform-modules-accton deleted file mode 160000 index 406c4e675ea7..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 406c4e675ea73d52827b520958c9956551a94e8e diff --git a/platform/broadcom/sonic-platform-modules-accton/.gitignore b/platform/broadcom/sonic-platform-modules-accton/.gitignore new file mode 100644 index 000000000000..f805e810e5c6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/.gitignore @@ -0,0 +1,33 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# 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 diff --git a/platform/broadcom/sonic-platform-modules-accton/LICENSE b/platform/broadcom/sonic-platform-modules-accton/LICENSE new file mode 100644 index 000000000000..bc693f7a4c40 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2017 Accton Technology Corporation + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 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-accton/README.md b/platform/broadcom/sonic-platform-modules-accton/README.md new file mode 100644 index 000000000000..0ff20bb2d21b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/README.md @@ -0,0 +1 @@ +platform drivers of Accton products for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/fanutil.py new file mode 100755 index 000000000000..c16771e214e4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/fanutil.py @@ -0,0 +1,238 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# +# ------------------------------------------------------------------ + +try: + import time + import logging + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class FanUtil(object): + """Platform-specific FanUtil class""" + + FAN_NUM_ON_MAIN_BROAD = 5 + FAN_NUM_1_IDX = 1 + FAN_NUM_2_IDX = 2 + FAN_NUM_3_IDX = 3 + FAN_NUM_4_IDX = 4 + FAN_NUM_5_IDX = 5 + + FAN_NODE_NUM_OF_MAP = 6 + FAN_NODE_FAULT_IDX_OF_MAP = 1 + FAN_NODE_SPEED_IDX_OF_MAP = 2 + FAN_NODE_DIR_IDX_OF_MAP = 3 + FAN_NODE_DUTY_IDX_OF_MAP = 4 + FANR_NODE_FAULT_IDX_OF_MAP = 5 + FANR_NODE_SPEED_IDX_OF_MAP = 6 + + BASE_VAL_PATH = '/sys/devices/platform/as5712_54x_fan/{0}' + + #logfile = '' + #loglevel = logging.INFO + + """ Dictionary where + key1 = fan id index (integer) starting from 1 + key2 = fan node index (interger) starting from 1 + value = path to fan device file (string) """ + _fan_to_device_path_mapping = {} + + _fan_to_device_node_mapping = { + (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault', + (FAN_NUM_1_IDX, FAN_NODE_SPEED_IDX_OF_MAP): 'fan1_speed_rpm', + (FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction', + (FAN_NUM_1_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan1_duty_cycle_percentage', + (FAN_NUM_1_IDX, FANR_NODE_FAULT_IDX_OF_MAP): 'fanr1_fault', + (FAN_NUM_1_IDX, FANR_NODE_SPEED_IDX_OF_MAP): 'fanr1_speed_rpm', + + (FAN_NUM_2_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan2_fault', + (FAN_NUM_2_IDX, FAN_NODE_SPEED_IDX_OF_MAP): 'fan2_speed_rpm', + (FAN_NUM_2_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan2_direction', + (FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage', + (FAN_NUM_2_IDX, FANR_NODE_FAULT_IDX_OF_MAP): 'fanr2_fault', + (FAN_NUM_2_IDX, FANR_NODE_SPEED_IDX_OF_MAP): 'fanr2_speed_rpm', + + (FAN_NUM_3_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan3_fault', + (FAN_NUM_3_IDX, FAN_NODE_SPEED_IDX_OF_MAP): 'fan3_speed_rpm', + (FAN_NUM_3_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan3_direction', + (FAN_NUM_3_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan3_duty_cycle_percentage', + (FAN_NUM_3_IDX, FANR_NODE_FAULT_IDX_OF_MAP): 'fanr3_fault', + (FAN_NUM_3_IDX, FANR_NODE_SPEED_IDX_OF_MAP): 'fanr3_speed_rpm', + + (FAN_NUM_4_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan4_fault', + (FAN_NUM_4_IDX, FAN_NODE_SPEED_IDX_OF_MAP): 'fan4_speed_rpm', + (FAN_NUM_4_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan4_direction', + (FAN_NUM_4_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan4_duty_cycle_percentage', + (FAN_NUM_4_IDX, FANR_NODE_FAULT_IDX_OF_MAP): 'fanr4_fault', + (FAN_NUM_4_IDX, FANR_NODE_SPEED_IDX_OF_MAP): 'fanr4_speed_rpm', + + (FAN_NUM_5_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan5_fault', + (FAN_NUM_5_IDX, FAN_NODE_SPEED_IDX_OF_MAP): 'fan5_speed_rpm', + (FAN_NUM_5_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan5_direction', + (FAN_NUM_5_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan5_duty_cycle_percentage', + (FAN_NUM_5_IDX, FANR_NODE_FAULT_IDX_OF_MAP): 'fanr5_fault', + (FAN_NUM_5_IDX, FANR_NODE_SPEED_IDX_OF_MAP): 'fanr5_speed_rpm', + } + + def _get_fan_to_device_node(self, fan_num, node_num): + return self._fan_to_device_node_mapping[(fan_num, node_num)] + + def _get_fan_node_val(self, fan_num, node_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + def _set_fan_node_val(self, fan_num, node_num, val): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + content = str(val) + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'w') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + val_file.write(content) + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return True + + def __init__(self): + fan_path = self.BASE_VAL_PATH + + for fan_num in range(self.FAN_NUM_1_IDX, self.FAN_NUM_ON_MAIN_BROAD+1): + for node_num in range(self.FAN_NODE_FAULT_IDX_OF_MAP, self.FAN_NODE_NUM_OF_MAP+1): + self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path.format( + self._fan_to_device_node_mapping[(fan_num, node_num)]) + + def get_num_fans(self): + return self.FAN_NUM_ON_MAIN_BROAD + + def get_idx_fan_start(self): + return self.FAN_NUM_1_IDX + + def get_num_nodes(self): + return self.FAN_NODE_NUM_OF_MAP + + def get_idx_node_start(self): + return self.FAN_NODE_FAULT_IDX_OF_MAP + + def get_size_node_map(self): + return len(self._fan_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._fan_to_device_path_mapping) + + def get_fan_to_device_path(self, fan_num, node_num): + return self._fan_to_device_path_mapping[(fan_num, node_num)] + + def get_fan_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP) + + def get_fan_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP) + + def get_fan_dir(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP) + + def get_fan_duty_cycle(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP) + + def set_fan_duty_cycle(self, fan_num, val): + return self._set_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP, val) + + def get_fanr_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP) + + def get_fanr_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP) + + def get_fan_status(self, fan_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num, %d', fan_num) + return None + + if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0: + logging.debug('GET. FAN fault. fan_num, %d', fan_num) + return False + + if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0: + logging.debug('GET. FANR fault. fan_num, %d', fan_num) + return False + + return True + +#def main(): +# fan = FanUtil() +# +# print 'get_size_node_map : %d' % fan.get_size_node_map() +# print 'get_size_path_map : %d' % fan.get_size_path_map() +# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): +# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1): +# print fan.get_fan_to_device_path(x, y) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/thermalutil.py new file mode 100755 index 000000000000..5b8f890e8819 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/classes/thermalutil.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# +# ------------------------------------------------------------------ + +try: + import time + import logging + import glob + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class ThermalUtil(object): + """Platform-specific ThermalUtil class""" + + THERMAL_NUM_ON_MAIN_BROAD = 3 + THERMAL_NUM_1_IDX = 1 # 1_ON_MAIN_BROAD + THERMAL_NUM_2_IDX = 2 # 2_ON_MAIN_BROAD + THERMAL_NUM_3_IDX = 3 # 3_ON_MAIN_BROAD + + BASE_VAL_PATH = '/sys/bus/i2c/devices/{0}-00{1}/hwmon/hwmon*/temp1_input' + + """ Dictionary where + key1 = thermal id index (integer) starting from 1 + value = path to fan device file (string) """ + _thermal_to_device_path_mapping = {} + + _thermal_to_device_node_mapping = { + THERMAL_NUM_1_IDX: ['61', '48'], + THERMAL_NUM_2_IDX: ['62', '49'], + THERMAL_NUM_3_IDX: ['63', '4a'], + } + + def __init__(self): + thermal_path = self.BASE_VAL_PATH + + for x in range(self.THERMAL_NUM_1_IDX, self.THERMAL_NUM_ON_MAIN_BROAD+1): + self._thermal_to_device_path_mapping[x] = thermal_path.format( + self._thermal_to_device_node_mapping[x][0], + self._thermal_to_device_node_mapping[x][1]) + + def _get_thermal_node_val(self, thermal_num): + if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. thermal_num, %d', thermal_num) + return None + + device_path = self.get_thermal_to_device_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + + def get_num_thermals(self): + return self.THERMAL_NUM_ON_MAIN_BROAD + + def get_idx_thermal_start(self): + return self.THERMAL_NUM_1_IDX + + def get_size_node_map(self): + return len(self._thermal_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._thermal_to_device_path_mapping) + + def get_thermal_to_device_path(self, thermal_num): + return self._thermal_to_device_path_mapping[thermal_num] + + def get_thermal_1_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + + def get_thermal_2_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) + +#def main(): +# thermal = ThermalUtil() +# +# print 'get_size_node_map : %d' % thermal.get_size_node_map() +# print 'get_size_path_map : %d' % thermal.get_size_path_map() +# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): +# print thermal.get_thermal_to_device_path(x) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/Makefile new file mode 100755 index 000000000000..39fe78bf8cae --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/Makefile @@ -0,0 +1,17 @@ +ifneq ($(KERNELRELEASE),) +obj-m:= i2c-mux-accton_as5712_54x_cpld.o \ + accton_as5712_54x_fan.o leds-accton_as5712_54x.o accton_as5712_54x_psu.o \ + cpr_4011_4mxx.o ym2651y.o + +else +ifeq (,$(KERNEL_SRC)) +$(error KERNEL_SRC is not defined) +else +KERNELDIR:=$(KERNEL_SRC) +endif +PWD:=$(shell pwd) +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + rm -rf *.o *.mod.o *.mod.o *.ko .*cmd .tmp_versions Module.markers Module.symvers modules.order +endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_fan.c new file mode 100755 index 000000000000..db81a1a8ca97 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_fan.c @@ -0,0 +1,437 @@ +/* + * A hwmon driver for the Accton as5710 54x fan contrl + * + * Copyright (C) 2013 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FAN_MAX_NUMBER 5 +#define FAN_SPEED_CPLD_TO_RPM_STEP 150 +#define FAN_SPEED_PRECENT_TO_CPLD_STEP 5 +#define FAN_DUTY_CYCLE_MIN 0 /* 10% ??*/ +#define FAN_DUTY_CYCLE_MAX 100 /* 100% */ + +#define CPLD_REG_FAN_STATUS_OFFSET 0xC +#define CPLD_REG_FANR_STATUS_OFFSET 0x1F +#define CPLD_REG_FAN_DIRECTION_OFFSET 0x1E + +#define CPLD_FAN1_REG_SPEED_OFFSET 0x10 +#define CPLD_FAN2_REG_SPEED_OFFSET 0x11 +#define CPLD_FAN3_REG_SPEED_OFFSET 0x12 +#define CPLD_FAN4_REG_SPEED_OFFSET 0x13 +#define CPLD_FAN5_REG_SPEED_OFFSET 0x14 + +#define CPLD_FANR1_REG_SPEED_OFFSET 0x18 +#define CPLD_FANR2_REG_SPEED_OFFSET 0x19 +#define CPLD_FANR3_REG_SPEED_OFFSET 0x1A +#define CPLD_FANR4_REG_SPEED_OFFSET 0x1B +#define CPLD_FANR5_REG_SPEED_OFFSET 0x1C + +#define CPLD_REG_FAN_PWM_CYCLE_OFFSET 0xD + +#define CPLD_FAN1_INFO_BIT_MASK 0x1 +#define CPLD_FAN2_INFO_BIT_MASK 0x2 +#define CPLD_FAN3_INFO_BIT_MASK 0x4 +#define CPLD_FAN4_INFO_BIT_MASK 0x8 +#define CPLD_FAN5_INFO_BIT_MASK 0x10 + +#define PROJECT_NAME + +#define LOCAL_DEBUG 0 + +static struct accton_as5712_54x_fan *fan_data = NULL; + +struct accton_as5712_54x_fan { + struct platform_device *pdev; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[FAN_MAX_NUMBER]; /* inner first fan status */ + u32 speed[FAN_MAX_NUMBER]; /* inner first fan speed */ + u8 direction[FAN_MAX_NUMBER]; /* reconrd the direction of inner first and second fans */ + u32 duty_cycle[FAN_MAX_NUMBER]; /* control the speed of inner first and second fans */ + u8 r_status[FAN_MAX_NUMBER]; /* inner second fan status */ + u32 r_speed[FAN_MAX_NUMBER]; /* inner second fan speed */ +}; + +/*******************/ +#define MAKE_FAN_MASK_OR_REG(name,type) \ + CPLD_FAN##type##1_##name, \ + CPLD_FAN##type##2_##name, \ + CPLD_FAN##type##3_##name, \ + CPLD_FAN##type##4_##name, \ + CPLD_FAN##type##5_##name, + +/* fan related data + */ +static const u8 fan_info_mask[] = { + MAKE_FAN_MASK_OR_REG(INFO_BIT_MASK,) +}; + +static const u8 fan_speed_reg[] = { + MAKE_FAN_MASK_OR_REG(REG_SPEED_OFFSET,) +}; + +static const u8 fanr_speed_reg[] = { + MAKE_FAN_MASK_OR_REG(REG_SPEED_OFFSET,R) +}; + +/*******************/ +#define DEF_FAN_SET(id) \ + FAN##id##_FAULT, \ + FAN##id##_SPEED, \ + FAN##id##_DUTY_CYCLE, \ + FAN##id##_DIRECTION, \ + FANR##id##_FAULT, \ + FANR##id##_SPEED, + +enum sysfs_fan_attributes { + DEF_FAN_SET(1) + DEF_FAN_SET(2) + DEF_FAN_SET(3) + DEF_FAN_SET(4) + DEF_FAN_SET(5) +}; +/*******************/ +static void accton_as5712_54x_fan_update_device(struct device *dev); +static int accton_as5712_54x_fan_read_value(u8 reg); +static int accton_as5712_54x_fan_write_value(u8 reg, u8 value); + +static ssize_t fan_set_duty_cycle(struct device *dev, + struct device_attribute *da,const char *buf, size_t count); +static ssize_t fan_show_value(struct device *dev, + struct device_attribute *da, char *buf); + +extern int as5712_54x_cpld_read(unsigned short cpld_addr, u8 reg); +extern int as5712_54x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + + +/*******************/ +#define _MAKE_SENSOR_DEVICE_ATTR(prj, id) \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_fault, S_IRUGO, fan_show_value, NULL, FAN##id##_FAULT); \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##id##_SPEED); \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, \ + fan_set_duty_cycle, FAN##id##_DUTY_CYCLE); \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_direction, S_IRUGO, fan_show_value, NULL, FAN##id##_DIRECTION); \ + static SENSOR_DEVICE_ATTR(prj##fanr##id##_fault, S_IRUGO, fan_show_value, NULL, FANR##id##_FAULT); \ + static SENSOR_DEVICE_ATTR(prj##fanr##id##_speed_rpm, S_IRUGO, fan_show_value, NULL, FANR##id##_SPEED); + +#define MAKE_SENSOR_DEVICE_ATTR(prj,id) _MAKE_SENSOR_DEVICE_ATTR(prj,id) + +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME, 1) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME, 2) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME, 3) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME, 4) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME, 5) +/*******************/ + +#define _MAKE_FAN_ATTR(prj, id) \ + &sensor_dev_attr_##prj##fan##id##_fault.dev_attr.attr, \ + &sensor_dev_attr_##prj##fan##id##_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_##prj##fan##id##_duty_cycle_percentage.dev_attr.attr,\ + &sensor_dev_attr_##prj##fan##id##_direction.dev_attr.attr, \ + &sensor_dev_attr_##prj##fanr##id##_fault.dev_attr.attr, \ + &sensor_dev_attr_##prj##fanr##id##_speed_rpm.dev_attr.attr, + +#define MAKE_FAN_ATTR(prj, id) _MAKE_FAN_ATTR(prj, id) + +static struct attribute *accton_as5712_54x_fan_attributes[] = { + /* fan related attributes */ + MAKE_FAN_ATTR(PROJECT_NAME,1) + MAKE_FAN_ATTR(PROJECT_NAME,2) + MAKE_FAN_ATTR(PROJECT_NAME,3) + MAKE_FAN_ATTR(PROJECT_NAME,4) + MAKE_FAN_ATTR(PROJECT_NAME,5) + NULL +}; +/*******************/ + +/* fan related functions + */ +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + ssize_t ret = 0; + int data_index, type_index; + + accton_as5712_54x_fan_update_device(dev); + + if (fan_data->valid == 0) { + return ret; + } + + type_index = attr->index%FAN2_FAULT; + data_index = attr->index/FAN2_FAULT; + + switch (type_index) { + case FAN1_FAULT: + ret = sprintf(buf, "%d\n", fan_data->status[data_index]); + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FAN1_SPEED: + ret = sprintf(buf, "%d\n", fan_data->speed[data_index]); + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FAN1_DUTY_CYCLE: + ret = sprintf(buf, "%d\n", fan_data->duty_cycle[data_index]); + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FAN1_DIRECTION: + ret = sprintf(buf, "%d\n", fan_data->direction[data_index]); /* presnet, need to modify*/ + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FANR1_FAULT: + ret = sprintf(buf, "%d\n", fan_data->r_status[data_index]); + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FANR1_SPEED: + ret = sprintf(buf, "%d\n", fan_data->r_speed[data_index]); + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + default: + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d] \n", __FUNCTION__, __LINE__); + break; + } + + return ret; +} +/*******************/ +static ssize_t fan_set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) { + + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < FAN_DUTY_CYCLE_MIN || value > FAN_DUTY_CYCLE_MAX) + return -EINVAL; + + accton_as5712_54x_fan_write_value(CPLD_REG_FAN_PWM_CYCLE_OFFSET, value/FAN_SPEED_PRECENT_TO_CPLD_STEP); + + fan_data->valid = 0; + + return count; +} + +static const struct attribute_group accton_as5712_54x_fan_group = { + .attrs = accton_as5712_54x_fan_attributes, +}; + +static int accton_as5712_54x_fan_read_value(u8 reg) +{ + return as5712_54x_cpld_read(0x60, reg); +} + +static int accton_as5712_54x_fan_write_value(u8 reg, u8 value) +{ + return as5712_54x_cpld_write(0x60, reg, value); +} + +static void accton_as5712_54x_fan_update_device(struct device *dev) +{ + int speed, r_speed, fault, r_fault, ctrl_speed, direction; + int i; + + mutex_lock(&fan_data->update_lock); + + if (LOCAL_DEBUG) + printk ("Starting accton_as5712_54x_fan update \n"); + + if (!(time_after(jiffies, fan_data->last_updated + HZ + HZ / 2) || !fan_data->valid)) { + /* do nothing */ + goto _exit; + } + + fan_data->valid = 0; + + if (LOCAL_DEBUG) + printk ("Starting accton_as5712_54x_fan update 2 \n"); + + fault = accton_as5712_54x_fan_read_value(CPLD_REG_FAN_STATUS_OFFSET); + r_fault = accton_as5712_54x_fan_read_value(CPLD_REG_FANR_STATUS_OFFSET); + direction = accton_as5712_54x_fan_read_value(CPLD_REG_FAN_DIRECTION_OFFSET); + ctrl_speed = accton_as5712_54x_fan_read_value(CPLD_REG_FAN_PWM_CYCLE_OFFSET); + + if ( (fault < 0) || (r_fault < 0) || (direction < 0) || (ctrl_speed < 0) ) + { + if (LOCAL_DEBUG) + printk ("[Error!!][%s][%d] \n", __FUNCTION__, __LINE__); + goto _exit; /* error */ + } + + if (LOCAL_DEBUG) + printk ("[fan:] fault:%d, r_fault=%d, direction=%d, ctrl_speed=%d \n",fault, r_fault, direction, ctrl_speed); + + for (i=0; istatus[i] = (fault & fan_info_mask[i]) >> i; + if (LOCAL_DEBUG) + printk ("[fan%d:] fail=%d \n",i, fan_data->status[i]); + + fan_data->r_status[i] = (r_fault & fan_info_mask[i]) >> i; + fan_data->direction[i] = (direction & fan_info_mask[i]) >> i; + fan_data->duty_cycle[i] = ctrl_speed * FAN_SPEED_PRECENT_TO_CPLD_STEP; + + /* fan speed + */ + speed = accton_as5712_54x_fan_read_value(fan_speed_reg[i]); + r_speed = accton_as5712_54x_fan_read_value(fanr_speed_reg[i]); + if ( (speed < 0) || (r_speed < 0) ) + { + if (LOCAL_DEBUG) + printk ("[Error!!][%s][%d] \n", __FUNCTION__, __LINE__); + goto _exit; /* error */ + } + + if (LOCAL_DEBUG) + printk ("[fan%d:] speed:%d, r_speed=%d \n", i, speed, r_speed); + + fan_data->speed[i] = speed * FAN_SPEED_CPLD_TO_RPM_STEP; + fan_data->r_speed[i] = r_speed * FAN_SPEED_CPLD_TO_RPM_STEP; + } + + /* finish to update */ + fan_data->last_updated = jiffies; + fan_data->valid = 1; + +_exit: + mutex_unlock(&fan_data->update_lock); +} + +static int accton_as5712_54x_fan_probe(struct platform_device *pdev) +{ + int status = -1; + + /* Register sysfs hooks */ + status = sysfs_create_group(&pdev->dev.kobj, &accton_as5712_54x_fan_group); + if (status) { + goto exit; + + } + + fan_data->hwmon_dev = hwmon_device_register(&pdev->dev); + if (IS_ERR(fan_data->hwmon_dev)) { + status = PTR_ERR(fan_data->hwmon_dev); + goto exit_remove; + } + + dev_info(&pdev->dev, "accton_as5712_54x_fan\n"); + + return 0; + +exit_remove: + sysfs_remove_group(&pdev->dev.kobj, &accton_as5712_54x_fan_group); +exit: + return status; +} + +static int accton_as5712_54x_fan_remove(struct platform_device *pdev) +{ + hwmon_device_unregister(fan_data->hwmon_dev); + sysfs_remove_group(&fan_data->pdev->dev.kobj, &accton_as5712_54x_fan_group); + + return 0; +} + +#define DRVNAME "as5712_54x_fan" + +static struct platform_driver accton_as5712_54x_fan_driver = { + .probe = accton_as5712_54x_fan_probe, + .remove = accton_as5712_54x_fan_remove, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as5712_54x_fan_init(void) +{ + int ret; + + ret = platform_driver_register(&accton_as5712_54x_fan_driver); + if (ret < 0) { + goto exit; + } + + fan_data = kzalloc(sizeof(struct accton_as5712_54x_fan), GFP_KERNEL); + if (!fan_data) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as5712_54x_fan_driver); + goto exit; + } + + mutex_init(&fan_data->update_lock); + fan_data->valid = 0; + + fan_data->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(fan_data->pdev)) { + ret = PTR_ERR(fan_data->pdev); + platform_driver_unregister(&accton_as5712_54x_fan_driver); + kfree(fan_data); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as5712_54x_fan_exit(void) +{ + platform_device_unregister(fan_data->pdev); + platform_driver_unregister(&accton_as5712_54x_fan_driver); + kfree(fan_data); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as5712_54x_fan driver"); +MODULE_LICENSE("GPL"); + +module_init(accton_as5712_54x_fan_init); +module_exit(accton_as5712_54x_fan_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_psu.c new file mode 100755 index 000000000000..9a0d1dae58ba --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_psu.c @@ -0,0 +1,371 @@ +/* + * An hwmon driver for accton as5712_54x Power Module + * + * Copyright (C) 2015 Accton Technology Corporation. + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#if 0 +#define DEBUG +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define PSU_STATUS_I2C_ADDR 0x60 +#define PSU_STATUS_I2C_REG_OFFSET 0x2 + +#define IS_POWER_GOOD(id, value) (!!(value & BIT(id*4 + 1))) +#define IS_PRESENT(id, value) (!(value & BIT(id*4))) + +static ssize_t show_index(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static int as5712_54x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as5712_54x_cpld_read(unsigned short cpld_addr, u8 reg); +static int as5712_54x_psu_model_name_get(struct device *dev); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as5712_54x_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[14]; /* Model name, read from eeprom */ +}; + +static struct as5712_54x_psu_data *as5712_54x_psu_update_device(struct device *dev); + +enum as5712_54x_psu_sysfs_attributes { + PSU_INDEX, + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_index, S_IRUGO, show_index, NULL, PSU_INDEX); +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); + +static struct attribute *as5712_54x_psu_attributes[] = { + &sensor_dev_attr_psu_index.dev_attr.attr, + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static ssize_t show_index(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_psu_data *data = i2c_get_clientdata(client); + + return sprintf(buf, "%d\n", data->index); +} + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as5712_54x_psu_data *data = as5712_54x_psu_update_device(dev); + u8 status = 0; + + if (!data->valid) { + return sprintf(buf, "0\n"); + } + + if (attr->index == PSU_PRESENT) { + status = IS_PRESENT(data->index, data->status); + } + else { /* PSU_POWER_GOOD */ + status = IS_POWER_GOOD(data->index, data->status); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as5712_54x_psu_data *data = as5712_54x_psu_update_device(dev); + + if (!data->valid) { + return 0; + } + + if (!IS_PRESENT(data->index, data->status)) { + return 0; + } + + if (as5712_54x_psu_model_name_get(dev) < 0) { + return -ENXIO; + } + + return sprintf(buf, "%s\n", data->model_name); +} + +static const struct attribute_group as5712_54x_psu_group = { + .attrs = as5712_54x_psu_attributes, +}; + +static int as5712_54x_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as5712_54x_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as5712_54x_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as5712_54x_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as5712_54x_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as5712_54x_psu_remove(struct i2c_client *client) +{ + struct as5712_54x_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as5712_54x_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as5712_54x_psu1, + as5712_54x_psu2 +}; + +static const struct i2c_device_id as5712_54x_psu_id[] = { + { "as5712_54x_psu1", as5712_54x_psu1 }, + { "as5712_54x_psu2", as5712_54x_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as5712_54x_psu_id); + +static struct i2c_driver as5712_54x_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as5712_54x_psu", + }, + .probe = as5712_54x_psu_probe, + .remove = as5712_54x_psu_remove, + .id_table = as5712_54x_psu_id, + .address_list = normal_i2c, +}; + +static int as5712_54x_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; + +abort: + return result; +} + +enum psu_type { + PSU_YM_2401_JCR, /* AC110V - F2B */ + PSU_YM_2401_JDR, /* AC110V - B2F */ + PSU_CPR_4011_4M11, /* AC110V - F2B */ + PSU_CPR_4011_4M21, /* AC110V - B2F */ + PSU_CPR_6011_2M11, /* AC110V - F2B */ + PSU_CPR_6011_2M21, /* AC110V - B2F */ + PSU_UM400D_01G, /* DC48V - F2B */ + PSU_UM400D01_01G /* DC48V - B2F */ +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + char* model_name; +}; + +struct model_name_info models[] = { +{PSU_YM_2401_JCR, 0x20, 11, "YM-2401JCR"}, +{PSU_YM_2401_JDR, 0x20, 11, "YM-2401JDR"}, +{PSU_CPR_4011_4M11, 0x26, 13, "CPR-4011-4M11"}, +{PSU_CPR_4011_4M21, 0x26, 13, "CPR-4011-4M21"}, +{PSU_CPR_6011_2M11, 0x26, 13, "CPR-6011-2M11"}, +{PSU_CPR_6011_2M21, 0x26, 13, "CPR-6011-2M21"}, +{PSU_UM400D_01G, 0x50, 9, "um400d01G"}, +{PSU_UM400D01_01G, 0x50, 12, "um400d01-01G"}, +}; + +static int as5712_54x_psu_model_name_get(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_psu_data *data = i2c_get_clientdata(client); + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->model_name, 0, sizeof(data->model_name)); + + status = as5712_54x_psu_read_block(client, models[i].offset, + data->model_name, models[i].length); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data->model_name[models[i].length] = '\0'; + } + + if (i == PSU_YM_2401_JCR || i == PSU_YM_2401_JDR) { + /* Skip the meaningless data byte 8*/ + data->model_name[8] = data->model_name[9]; + data->model_name[9] = data->model_name[10]; + data->model_name[10] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, models[i].length) == 0) { + return 0; + } + else { + data->model_name[0] = '\0'; + } + } + + return -ENODATA; +} + +static struct as5712_54x_psu_data *as5712_54x_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status = -1; + + dev_dbg(&client->dev, "Starting as5712_54x update\n"); + data->valid = 0; + + + /* Read psu status */ + status = as5712_54x_cpld_read(PSU_STATUS_I2C_ADDR, PSU_STATUS_I2C_REG_OFFSET); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg (0x%x) err %d\n", PSU_STATUS_I2C_ADDR, status); + goto exit; + } + else { + data->status = status; + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init as5712_54x_psu_init(void) +{ + return i2c_add_driver(&as5712_54x_psu_driver); +} + +static void __exit as5712_54x_psu_exit(void) +{ + i2c_del_driver(&as5712_54x_psu_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as5712_54x_psu driver"); +MODULE_LICENSE("GPL"); + +module_init(as5712_54x_psu_init); +module_exit(as5712_54x_psu_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_sfp.c b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_sfp.c new file mode 100755 index 000000000000..d236057c4e59 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/accton_as5712_54x_sfp.c @@ -0,0 +1,825 @@ +/* + * An hwmon driver for accton as5712_54x sfp + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#if 0 +#define DEBUG +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define NUM_OF_SFF_PORT 54 +#define SFP_PORT_MAX 48 +#define I2C_ADDR_CPLD1 0x60 +#define I2C_ADDR_CPLD2 0x61 +#define I2C_ADDR_CPLD3 0x62 +#define CPLD3_OFFSET_QSFP_MOD_RST 0x15 +#define CPLD3_OFFSET_QSFP_LPMODE 0x16 + + +#define BIT_INDEX(i) (1ULL << (i)) + +#if 0 +static ssize_t show_status(struct device *dev, struct device_attribute *da,char *buf); +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_eeprom(struct device *dev, struct device_attribute *da, char *buf); +static int as5712_54x_sfp_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as5712_54x_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int as5712_54x_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); +#endif + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as5712_54x_sfp_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + int port; /* Front port index */ + char eeprom[256]; /* eeprom data */ + u64 status[4]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => is_present + 1 => tx_fail + 2 => tx_disable + 3 => rx_loss */ +}; + +/* The table maps active port to cpld port. + * Array index 0 is for active port 1, + * index 1 for active port 2, and so on. + * The array content implies cpld port index. + */ +static const u8 cpld_to_front_port_table[] = +{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 52, 50, 53, 51, 54}; + +#define CPLD_PORT_TO_FRONT_PORT(port) (cpld_to_front_port_table[port]) + +static struct as5712_54x_sfp_data *as5712_54x_sfp_update_device(struct device *dev, int update_eeprom); +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_eeprom(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_lp_mode(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_lp_mode(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +extern int as5712_54x_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int as5712_54x_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +enum as5712_54x_sfp_sysfs_attributes { + SFP_IS_PRESENT, + SFP_TX_FAULT, + SFP_TX_DISABLE, + SFP_RX_LOSS, + SFP_PORT_NUMBER, + SFP_EEPROM, + SFP_RX_LOS_ALL, + SFP_IS_PRESENT_ALL, + SFP_LP_MODE, + SFP_MOD_RST, +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_status, NULL, SFP_IS_PRESENT); +static SENSOR_DEVICE_ATTR(sfp_tx_fault, S_IRUGO, show_status, NULL, SFP_TX_FAULT); +static SENSOR_DEVICE_ATTR(sfp_tx_disable, S_IWUSR | S_IRUGO, show_status, set_tx_disable, SFP_TX_DISABLE); +static SENSOR_DEVICE_ATTR(sfp_rx_loss, S_IRUGO, show_status,NULL, SFP_RX_LOSS); +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, SFP_PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_eeprom, S_IRUGO, show_eeprom, NULL, SFP_EEPROM); +static SENSOR_DEVICE_ATTR(sfp_rx_los_all, S_IRUGO, show_status,NULL, SFP_RX_LOS_ALL); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_status,NULL, SFP_IS_PRESENT_ALL); +static SENSOR_DEVICE_ATTR(sfp_lp_mode, S_IWUSR | S_IRUGO, get_lp_mode, set_lp_mode, SFP_LP_MODE); +static SENSOR_DEVICE_ATTR(sfp_mod_rst, S_IWUSR | S_IRUGO, get_mode_reset, set_mode_reset, SFP_MOD_RST); + +static struct attribute *as5712_54x_sfp_attributes[] = { + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_rx_loss.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + &sensor_dev_attr_sfp_eeprom.dev_attr.attr, + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los_all.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_lp_mode.dev_attr.attr, + &sensor_dev_attr_sfp_mod_rst.dev_attr.attr, + NULL +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_sfp_data *data = i2c_get_clientdata(client); + + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port)); +} + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as5712_54x_sfp_data *data; + u8 val; + int values[7]; + + /* Error-check the CPLD read results. */ +#define VALIDATED_READ(_buf, _rv, _read_expr, _invert) \ + do { \ + _rv = (_read_expr); \ + if(_rv < 0) { \ + return sprintf(_buf, "READ ERROR\n"); \ + } \ + if(_invert) { \ + _rv = ~_rv; \ + } \ + _rv &= 0xFF; \ + } while(0) + + if(attr->index == SFP_RX_LOS_ALL) { + /* + * Report the RX_LOS status for all ports. + * This does not depend on the currently active SFP selector. + */ + + /* RX_LOS Ports 1-8 */ + VALIDATED_READ(buf, values[0], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD2, 0x0F), 0); + /* RX_LOS Ports 9-16 */ + VALIDATED_READ(buf, values[1], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD2, 0x10), 0); + /* RX_LOS Ports 17-24 */ + VALIDATED_READ(buf, values[2], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD2, 0x11), 0); + /* RX_LOS Ports 25-32 */ + VALIDATED_READ(buf, values[3], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, 0x0F), 0); + /* RX_LOS Ports 33-40 */ + VALIDATED_READ(buf, values[4], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, 0x10), 0); + /* RX_LOS Ports 41-48 */ + VALIDATED_READ(buf, values[5], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, 0x11), 0); + + /** Return values 1 -> 48 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3], values[4], values[5]); + } + + if(attr->index == SFP_IS_PRESENT_ALL) { + /* + * Report the SFP_PRESENCE status for all ports. + * This does not depend on the currently active SFP selector. + */ + + /* SFP_PRESENT Ports 1-8 */ + VALIDATED_READ(buf, values[0], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD2, 0x6), 1); + /* SFP_PRESENT Ports 9-16 */ + VALIDATED_READ(buf, values[1], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD2, 0x7), 1); + /* SFP_PRESENT Ports 17-24 */ + VALIDATED_READ(buf, values[2], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD2, 0x8), 1); + /* SFP_PRESENT Ports 25-32 */ + VALIDATED_READ(buf, values[3], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, 0x6), 1); + /* SFP_PRESENT Ports 33-40 */ + VALIDATED_READ(buf, values[4], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, 0x7), 1); + /* SFP_PRESENT Ports 41-48 */ + VALIDATED_READ(buf, values[5], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, 0x8), 1); + /* QSFP_PRESENT Ports 49-54 */ + VALIDATED_READ(buf, values[6], as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, 0x14), 1); + + /* Return values 1 -> 54 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3], values[4], values[5], + values[6] & 0x3F); + } + /* + * The remaining attributes are gathered on a per-selected-sfp basis. + */ + data = as5712_54x_sfp_update_device(dev, 0); + if (attr->index == SFP_IS_PRESENT) { + val = (data->status[attr->index] & BIT_INDEX(data->port)) ? 0 : 1; + } + else { + val = (data->status[attr->index] & BIT_INDEX(data->port)) ? 1 : 0; + } + + return sprintf(buf, "%d", val); +} + +static ssize_t get_lp_mode(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_sfp_data *data = i2c_get_clientdata(client); + u8 cpld_val = 0; + int port_bit; + int status = -EINVAL; + + /* Low power mode is not supported for SFP ports(1-48) */ + if (data->port < SFP_PORT_MAX) { + return -EINVAL; + } + mutex_lock(&data->update_lock); + + port_bit = data->port - SFP_PORT_MAX; + cpld_val = as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, CPLD3_OFFSET_QSFP_LPMODE); + cpld_val = cpld_val & 0x3F; + cpld_val = cpld_val & BIT_INDEX(port_bit); + status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", cpld_val>>port_bit); + + mutex_unlock(&data->update_lock); + + return status; +} + +static ssize_t set_lp_mode(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_sfp_data *data = i2c_get_clientdata(client); + u8 cpld_val = 0; + long mode; + int error, port_bit; + + /* Tx disable is not supported for QSFP ports(49-54) */ + if (data->port < SFP_PORT_MAX) { + return -EINVAL; + } + port_bit = data->port - SFP_PORT_MAX; + error = kstrtol(buf, 10, &mode); + if (error) { + return error; + } + mutex_lock(&data->update_lock); + + cpld_val = as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, CPLD3_OFFSET_QSFP_LPMODE); + /* Update lp_mode status */ + if (mode) + { + cpld_val |= BIT_INDEX(port_bit); + } + else + { + cpld_val &=~BIT_INDEX(port_bit); + } + as5712_54x_i2c_cpld_write(I2C_ADDR_CPLD3, CPLD3_OFFSET_QSFP_LPMODE, cpld_val); + + mutex_unlock(&data->update_lock); + + return count; +} + + +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_sfp_data *data = i2c_get_clientdata(client); + u8 cpld_val = 0; + int port_bit; + int status = -EINVAL; + + /* Low power mode is not supported for SFP ports(1-48) */ + if (data->port < SFP_PORT_MAX) { + return -EINVAL; + } + mutex_lock(&data->update_lock); + + port_bit = data->port - SFP_PORT_MAX; + cpld_val = as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, CPLD3_OFFSET_QSFP_MOD_RST); + cpld_val = cpld_val & 0x3F; + cpld_val = cpld_val & BIT_INDEX(port_bit); + status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", cpld_val>>port_bit); + + mutex_unlock(&data->update_lock); + + return status; +} + +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_sfp_data *data = i2c_get_clientdata(client); + u8 cpld_val = 0; + long reset; + int error, port_bit; + + /* Tx disable is not supported for QSFP ports(49-54) */ + if (data->port < SFP_PORT_MAX) { + return -EINVAL; + } + port_bit = data->port - SFP_PORT_MAX; + error = kstrtol(buf, 10, &reset); + if (error) { + return error; + } + mutex_lock(&data->update_lock); + + cpld_val = as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, CPLD3_OFFSET_QSFP_MOD_RST); + /* Update lp_mode status */ + if (reset) + { + cpld_val |= BIT_INDEX(port_bit); + } + else + { + cpld_val &=~BIT_INDEX(port_bit); + } + as5712_54x_i2c_cpld_write(I2C_ADDR_CPLD3, CPLD3_OFFSET_QSFP_MOD_RST, cpld_val); + + mutex_unlock(&data->update_lock); + + return count; +} + + +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_sfp_data *data = i2c_get_clientdata(client); + unsigned short cpld_addr = 0; + u8 cpld_reg = 0, cpld_val = 0, cpld_bit = 0; + long disable; + int error; + + /* Tx disable is not supported for QSFP ports(49-54) */ + if (data->port >= SFP_PORT_MAX) { + return -EINVAL; + } + + error = kstrtol(buf, 10, &disable); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + if(data->port < 24) { + cpld_addr = I2C_ADDR_CPLD2; + cpld_reg = 0xC + data->port / 8; + cpld_bit = 1 << (data->port % 8); + } + else { + cpld_addr = I2C_ADDR_CPLD3; + cpld_reg = 0xC + (data->port - 24) / 8; + cpld_bit = 1 << (data->port % 8); + } + + cpld_val = as5712_54x_i2c_cpld_read(cpld_addr, cpld_reg); + + /* Update tx_disable status */ + if (disable) { + data->status[SFP_TX_DISABLE] |= BIT_INDEX(data->port); + cpld_val |= cpld_bit; + } + else { + data->status[SFP_TX_DISABLE] &= ~BIT_INDEX(data->port); + cpld_val &= ~cpld_bit; + } + + as5712_54x_i2c_cpld_write(cpld_addr, cpld_reg, cpld_val); + + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_eeprom(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as5712_54x_sfp_data *data = as5712_54x_sfp_update_device(dev, 1); + + if (!data->valid) { + return 0; + } + + if ((data->status[SFP_IS_PRESENT] & BIT_INDEX(data->port)) != 0) { + return 0; + } + + memcpy(buf, data->eeprom, sizeof(data->eeprom)); + + return sizeof(data->eeprom); +} + +static const struct attribute_group as5712_54x_sfp_group = { + .attrs = as5712_54x_sfp_attributes, +}; + +static int as5712_54x_sfp_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as5712_54x_sfp_data *data; + int status; + + extern int platform_accton_as5712_54x(void); + if(!platform_accton_as5712_54x()) { + return -ENODEV; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as5712_54x_sfp_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + i2c_set_clientdata(client, data); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as5712_54x_sfp_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sfp '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as5712_54x_sfp_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as5712_54x_sfp_remove(struct i2c_client *client) +{ + struct as5712_54x_sfp_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as5712_54x_sfp_group); + kfree(data); + + return 0; +} + +enum port_numbers { +as5712_54x_sfp1, as5712_54x_sfp2, as5712_54x_sfp3, as5712_54x_sfp4, +as5712_54x_sfp5, as5712_54x_sfp6, as5712_54x_sfp7, as5712_54x_sfp8, +as5712_54x_sfp9, as5712_54x_sfp10, as5712_54x_sfp11,as5712_54x_sfp12, +as5712_54x_sfp13, as5712_54x_sfp14, as5712_54x_sfp15,as5712_54x_sfp16, +as5712_54x_sfp17, as5712_54x_sfp18, as5712_54x_sfp19,as5712_54x_sfp20, +as5712_54x_sfp21, as5712_54x_sfp22, as5712_54x_sfp23,as5712_54x_sfp24, +as5712_54x_sfp25, as5712_54x_sfp26, as5712_54x_sfp27,as5712_54x_sfp28, +as5712_54x_sfp29, as5712_54x_sfp30, as5712_54x_sfp31,as5712_54x_sfp32, +as5712_54x_sfp33, as5712_54x_sfp34, as5712_54x_sfp35,as5712_54x_sfp36, +as5712_54x_sfp37, as5712_54x_sfp38, as5712_54x_sfp39,as5712_54x_sfp40, +as5712_54x_sfp41, as5712_54x_sfp42, as5712_54x_sfp43,as5712_54x_sfp44, +as5712_54x_sfp45, as5712_54x_sfp46, as5712_54x_sfp47,as5712_54x_sfp48, +as5712_54x_sfp49, as5712_54x_sfp52, as5712_54x_sfp50,as5712_54x_sfp53, +as5712_54x_sfp51, as5712_54x_sfp54 +}; + +static const struct i2c_device_id as5712_54x_sfp_id[] = { +{ "as5712_54x_sfp1", as5712_54x_sfp1 }, { "as5712_54x_sfp2", as5712_54x_sfp2 }, +{ "as5712_54x_sfp3", as5712_54x_sfp3 }, { "as5712_54x_sfp4", as5712_54x_sfp4 }, +{ "as5712_54x_sfp5", as5712_54x_sfp5 }, { "as5712_54x_sfp6", as5712_54x_sfp6 }, +{ "as5712_54x_sfp7", as5712_54x_sfp7 }, { "as5712_54x_sfp8", as5712_54x_sfp8 }, +{ "as5712_54x_sfp9", as5712_54x_sfp9 }, { "as5712_54x_sfp10", as5712_54x_sfp10 }, +{ "as5712_54x_sfp11", as5712_54x_sfp11 }, { "as5712_54x_sfp12", as5712_54x_sfp12 }, +{ "as5712_54x_sfp13", as5712_54x_sfp13 }, { "as5712_54x_sfp14", as5712_54x_sfp14 }, +{ "as5712_54x_sfp15", as5712_54x_sfp15 }, { "as5712_54x_sfp16", as5712_54x_sfp16 }, +{ "as5712_54x_sfp17", as5712_54x_sfp17 }, { "as5712_54x_sfp18", as5712_54x_sfp18 }, +{ "as5712_54x_sfp19", as5712_54x_sfp19 }, { "as5712_54x_sfp20", as5712_54x_sfp20 }, +{ "as5712_54x_sfp21", as5712_54x_sfp21 }, { "as5712_54x_sfp22", as5712_54x_sfp22 }, +{ "as5712_54x_sfp23", as5712_54x_sfp23 }, { "as5712_54x_sfp24", as5712_54x_sfp24 }, +{ "as5712_54x_sfp25", as5712_54x_sfp25 }, { "as5712_54x_sfp26", as5712_54x_sfp26 }, +{ "as5712_54x_sfp27", as5712_54x_sfp27 }, { "as5712_54x_sfp28", as5712_54x_sfp28 }, +{ "as5712_54x_sfp29", as5712_54x_sfp29 }, { "as5712_54x_sfp30", as5712_54x_sfp30 }, +{ "as5712_54x_sfp31", as5712_54x_sfp31 }, { "as5712_54x_sfp32", as5712_54x_sfp32 }, +{ "as5712_54x_sfp33", as5712_54x_sfp33 }, { "as5712_54x_sfp34", as5712_54x_sfp34 }, +{ "as5712_54x_sfp35", as5712_54x_sfp35 }, { "as5712_54x_sfp36", as5712_54x_sfp36 }, +{ "as5712_54x_sfp37", as5712_54x_sfp37 }, { "as5712_54x_sfp38", as5712_54x_sfp38 }, +{ "as5712_54x_sfp39", as5712_54x_sfp39 }, { "as5712_54x_sfp40", as5712_54x_sfp40 }, +{ "as5712_54x_sfp41", as5712_54x_sfp41 }, { "as5712_54x_sfp42", as5712_54x_sfp42 }, +{ "as5712_54x_sfp43", as5712_54x_sfp43 }, { "as5712_54x_sfp44", as5712_54x_sfp44 }, +{ "as5712_54x_sfp45", as5712_54x_sfp45 }, { "as5712_54x_sfp46", as5712_54x_sfp46 }, +{ "as5712_54x_sfp47", as5712_54x_sfp47 }, { "as5712_54x_sfp48", as5712_54x_sfp48 }, +{ "as5712_54x_sfp49", as5712_54x_sfp49 }, { "as5712_54x_sfp50", as5712_54x_sfp50 }, +{ "as5712_54x_sfp51", as5712_54x_sfp51 }, { "as5712_54x_sfp52", as5712_54x_sfp52 }, +{ "as5712_54x_sfp53", as5712_54x_sfp53 }, { "as5712_54x_sfp54", as5712_54x_sfp54 }, + +{} +}; +MODULE_DEVICE_TABLE(i2c, as5712_54x_sfp_id); + +static struct i2c_driver as5712_54x_sfp_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as5712_54x_sfp", + }, + .probe = as5712_54x_sfp_probe, + .remove = as5712_54x_sfp_remove, + .id_table = as5712_54x_sfp_id, + .address_list = normal_i2c, +}; + +static int as5712_54x_sfp_read_byte(struct i2c_client *client, u8 command, u8 *data) +{ + int result = i2c_smbus_read_byte_data(client, command); + + if (unlikely(result < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, result); + goto abort; + } + + *data = (u8)result; + result = 0; + +abort: + return result; +} + +#define ALWAYS_UPDATE_DEVICE 1 + +static struct as5712_54x_sfp_data *as5712_54x_sfp_update_device(struct device *dev, int update_eeprom) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_sfp_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (ALWAYS_UPDATE_DEVICE || time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status = -1; + int i = 0, j = 0; + + data->valid = 0; + //dev_dbg(&client->dev, "Starting as5712_54x sfp status update\n"); + memset(data->status, 0, sizeof(data->status)); + + /* Read status of port 1~48(SFP port) */ + for (i = 0; i < 2; i++) { + for (j = 0; j < 12; j++) { + status = as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD2+i, 0x6+j); + + if (status < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", I2C_ADDR_CPLD2+i, 0x6+j, status); + goto exit; + } + + data->status[j/3] |= (u64)status << ((i*24) + (j%3)*8); + } + } + + /* + * Bring QSFPs out of reset, + * This is a temporary fix until the QSFP+_MOD_RST register + * can be exposed through the driver. + */ + as5712_54x_i2c_cpld_write(I2C_ADDR_CPLD3, 0x15, 0x3F); + + /* Read present status of port 49-54(QSFP port) */ + status = as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, 0x14); + + if (status < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", I2C_ADDR_CPLD2+i, 0x6+j, status); + } + else { + data->status[SFP_IS_PRESENT] |= (u64)status << 48; + } + + if (update_eeprom) { + /* Read eeprom data based on port number */ + memset(data->eeprom, 0, sizeof(data->eeprom)); + + /* Check if the port is present */ + if ((data->status[SFP_IS_PRESENT] & BIT_INDEX(data->port)) == 0) { + /* read eeprom */ + for (i = 0; i < sizeof(data->eeprom); i++) { + status = as5712_54x_sfp_read_byte(client, i, data->eeprom + i); + + if (status < 0) { + dev_dbg(&client->dev, "unable to read eeprom from port(%d)\n", + CPLD_PORT_TO_FRONT_PORT(data->port)); + goto exit; + } + } + } + } + + data->valid = 1; + data->last_updated = jiffies; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(as5712_54x_sfp_driver); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as5712_54x_sfp driver"); +MODULE_LICENSE("GPL"); + +#if 0 + int i = 0, j = 0; + + data->valid = 0; + //dev_dbg(&client->dev, "Starting as5712_54x sfp update\n"); + memset(data->status, 0, sizeof(data->status)); + + /* Read status of port 1~48(SFP port) */ + for (i = 0; i < 2; i++) { + for (j = 0; j < 12; j++) { + status = as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD2+i, 0x6+j); + + if (status < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", I2C_ADDR_CPLD2+i, 0x6+j, status); + continue; + } + + data->status[j/3] |= (u64)status << ((i*24) + (j%3)*8); + } + } + + /* Read present status of port 49-54(QSFP port) */ + status = as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, 0x14); + + if (status < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", I2C_ADDR_CPLD2+i, 0x6+j, status); + } + else { + data->status[SFP_IS_PRESENT] |= (u64)status << 48; + } +#endif + +/* Reserver to prevent from CPLD port mapping is changed + */ +#if 0 +BIT_INDEX(port_present_index[data->port]) +/* The bit index of is_present field read from CPLD + * Array index 0 is for as5712_54x_sfp1, + * index 1 is for as5712_54x_sfp2, and so on. + */ +static const int port_present_index[] = { + 4, 5, 6, 7, 9, 8, 11, 10, + 0, 1, 2, 3, 12, 13, 14, 15, +16, 17, 18, 19, 28, 29, 30, 31, +20, 21, 22, 23, 24, 25, 26, 27 +}; +#endif + +#if 0 +static struct as5712_54x_sfp_data *as5712_54x_sfp_update_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_sfp_data *data = i2c_get_clientdata(client); + int status = -1; + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->status_last_updated + HZ + HZ / 2) + || !data->status_valid) { + int status = -1; + int i = 0, j = 0; + + data->status_valid = 0; + //dev_dbg(&client->dev, "Starting as5712_54x sfp status update\n"); + memset(data->status, 0, sizeof(data->status)); + + /* Read status of port 1~48(SFP port) */ + for (i = 0; i < 2; i++) { + for (j = 0; j < 12; j++) { + status = as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD2+i, 0x6+j); + + if (status < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", I2C_ADDR_CPLD2+i, 0x6+j, status); + goto exit; + } + + data->status[j/3] |= (u64)status << ((i*24) + (j%3)*8); + } + } + + /* + * Bring QSFPs out of reset, + * This is a temporary fix until the QSFP+_MOD_RST register + * can be exposed through the driver. + */ + as5712_54x_i2c_cpld_write(I2C_ADDR_CPLD3, 0x15, 0x3F); + + /* Read present status of port 49-54(QSFP port) */ + status = as5712_54x_i2c_cpld_read(I2C_ADDR_CPLD3, 0x14); + + if (status < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", I2C_ADDR_CPLD2+i, 0x6+j, status); + } + else { + data->status[SFP_IS_PRESENT] |= (u64)status << 48; + } + + data->status_valid = 1; + data->status_last_updated = jiffies; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static struct as5712_54x_sfp_data *as5712_54x_sfp_update_eeprom(struct device *dev) +{ + struct as5712_54x_sfp_data *data = NULL; + + data = as5712_54x_sfp_update_status(dev); + + if (data == NULL || data->status_valid == 0) { + data->eeprom_valid = 0; + return data; + } + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->eeprom_last_updated + HZ + HZ / 2) + || !data->eeprom_valid) { + int status = -1; + int i = 0; + + /* Read eeprom data based on port number */ + memset(data->eeprom, 0, sizeof(data->eeprom)); + + /* Check if the port is present */ + if ((data->status[SFP_IS_PRESENT] & BIT_INDEX(data->port)) == 0) { + /* read eeprom */ + for (i = 0; i < sizeof(data->eeprom)/I2C_SMBUS_BLOCK_MAX; i++) { + status = as5712_54x_sfp_read_block(client, i*I2C_SMBUS_BLOCK_MAX, + data->eeprom+(i*I2C_SMBUS_BLOCK_MAX), + I2C_SMBUS_BLOCK_MAX); + if (status < 0) { + dev_dbg(&client->dev, "unable to read eeprom from port(%d)\n", + CPLD_PORT_TO_FRONT_PORT(data->port)); + goto exit; + } + } + } + + data->eeprom_last_updated = jiffies; + data->eeprom_valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} +#endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/cpr_4011_4mxx.c b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/cpr_4011_4mxx.c new file mode 100755 index 000000000000..30bea914d589 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/cpr_4011_4mxx.c @@ -0,0 +1,400 @@ +/* + * An hwmon driver for the CPR-4011-4Mxx Redundant Power Module + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#if 0 +#define DEBUG +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x3c, 0x3d, 0x3e, 0x3f, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct cpr_4011_4mxx_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 vout_mode; /* Register value */ + u16 v_in; /* Register value */ + u16 v_out; /* Register value */ + u16 i_in; /* Register value */ + u16 i_out; /* Register value */ + u16 p_in; /* Register value */ + u16 p_out; /* Register value */ + u16 temp_input[2]; /* Register value */ + u8 fan_fault; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u16 fan_speed[2]; /* Register value */ +}; + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_vout(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static int cpr_4011_4mxx_write_word(struct i2c_client *client, u8 reg, u16 value); +static struct cpr_4011_4mxx_data *cpr_4011_4mxx_update_device(struct device *dev); + +enum cpr_4011_4mxx_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_FAULT, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_v_in, S_IRUGO, show_linear, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_in, S_IRUGO, show_linear, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_in, S_IRUGO, show_linear, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); + +static struct attribute *cpr_4011_4mxx_attributes[] = { + &sensor_dev_attr_psu_v_in.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_in.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_in.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + NULL +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + cpr_4011_4mxx_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_IN: + value = data->v_in; + break; + case PSU_I_IN: + value = data->i_in; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_IN: + value = data->p_in; + break; + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp_input[0]; + break; + case PSU_FAN1_DUTY_CYCLE: + multiplier = 1; + value = data->fan_duty_cycle[0]; + break; + case PSU_FAN1_SPEED: + multiplier = 1; + value = data->fan_speed[0]; + break; + default: + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_vout(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->v_out; + + return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static const struct attribute_group cpr_4011_4mxx_group = { + .attrs = cpr_4011_4mxx_attributes, +}; + +static int cpr_4011_4mxx_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct cpr_4011_4mxx_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct cpr_4011_4mxx_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cpr_4011_4mxx_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int cpr_4011_4mxx_remove(struct i2c_client *client) +{ + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id cpr_4011_4mxx_id[] = { + { "cpr_4011_4mxx", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, cpr_4011_4mxx_id); + +static struct i2c_driver cpr_4011_4mxx_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "cpr_4011_4mxx", + }, + .probe = cpr_4011_4mxx_probe, + .remove = cpr_4011_4mxx_remove, + .id_table = cpr_4011_4mxx_id, + .address_list = normal_i2c, +}; + +static int cpr_4011_4mxx_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int cpr_4011_4mxx_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int cpr_4011_4mxx_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct cpr_4011_4mxx_data *cpr_4011_4mxx_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int i, status; + struct reg_data_byte regs_byte[] = { {0x20, &data->vout_mode}, + {0x81, &data->fan_fault}}; + struct reg_data_word regs_word[] = { {0x88, &data->v_in}, + {0x8b, &data->v_out}, + {0x89, &data->i_in}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x97, &data->p_in}, + {0x8d, &(data->temp_input[0])}, + {0x8e, &(data->temp_input[1])}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x3c, &(data->fan_duty_cycle[1])}, + {0x90, &(data->fan_speed[0])}, + {0x91, &(data->fan_speed[1])}}; + + dev_dbg(&client->dev, "Starting cpr_4011_4mxx update\n"); + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = cpr_4011_4mxx_read_byte(client, regs_byte[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + } + else { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = cpr_4011_4mxx_read_word(client, regs_word[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + } + else { + *(regs_word[i].value) = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init cpr_4011_4mxx_init(void) +{ + return i2c_add_driver(&cpr_4011_4mxx_driver); +} + +static void __exit cpr_4011_4mxx_exit(void) +{ + i2c_del_driver(&cpr_4011_4mxx_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("CPR_4011_4MXX driver"); +MODULE_LICENSE("GPL"); + +module_init(cpr_4011_4mxx_init); +module_exit(cpr_4011_4mxx_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/i2c-mux-accton_as5712_54x_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/i2c-mux-accton_as5712_54x_cpld.c new file mode 100755 index 000000000000..d63cb14b5a67 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/i2c-mux-accton_as5712_54x_cpld.c @@ -0,0 +1,1517 @@ +/* + * I2C multiplexer + * + * Copyright (C) Brandon Chuang + * + * This module supports the accton cpld that hold the channel select + * mechanism for other i2c slave devices, such as SFP. + * This includes the: + * Accton as5712_54x CPLD1/CPLD2/CPLD3 + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ +#if 0 +#define DEBUG +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +#define NUM_OF_CPLD1_CHANS 0x0 +#define NUM_OF_CPLD2_CHANS 0x18 +#define NUM_OF_CPLD3_CHANS 0x1E +#define CPLD_CHANNEL_SELECT_REG 0x2 +#define CPLD_DESELECT_CHANNEL 0xFF + +#if 0 +#define NUM_OF_ALL_CPLD_CHANS (NUM_OF_CPLD2_CHANS + NUM_OF_CPLD3_CHANS) +#endif + +#define ACCTON_I2C_CPLD_MUX_MAX_NCHANS NUM_OF_CPLD3_CHANS + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +enum cpld_mux_type { + as5712_54x_cpld2, + as5712_54x_cpld3, + as5712_54x_cpld1 +}; + +struct as5712_54x_cpld_data { + enum cpld_mux_type type; + struct i2c_adapter *virt_adaps[ACCTON_I2C_CPLD_MUX_MAX_NCHANS]; + u8 last_chan; /* last register value */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + struct i2c_client *client; + struct i2c_mux_core *muxc; +#endif + struct device *hwmon_dev; + struct mutex update_lock; +}; + +#if 0 +/* The mapping table between mux index and adapter index + array index : the mux index + the content : adapter index + */ +static int mux_adap_map[NUM_OF_ALL_CPLD_CHANS]; +#endif + +struct chip_desc { + u8 nchans; + u8 deselectChan; +}; + +/* Provide specs for the PCA954x types we know about */ +static const struct chip_desc chips[] = { + [as5712_54x_cpld1] = { + .nchans = NUM_OF_CPLD1_CHANS, + .deselectChan = CPLD_DESELECT_CHANNEL, + }, + [as5712_54x_cpld2] = { + .nchans = NUM_OF_CPLD2_CHANS, + .deselectChan = CPLD_DESELECT_CHANNEL, + }, + [as5712_54x_cpld3] = { + .nchans = NUM_OF_CPLD3_CHANS, + .deselectChan = CPLD_DESELECT_CHANNEL, + } +}; + +static const struct i2c_device_id as5712_54x_cpld_mux_id[] = { + { "as5712_54x_cpld1", as5712_54x_cpld1 }, + { "as5712_54x_cpld2", as5712_54x_cpld2 }, + { "as5712_54x_cpld3", as5712_54x_cpld3 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, as5712_54x_cpld_mux_id); + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_TXDISABLE_ATTR_ID(index) MODULE_TXDISABLE_##index +#define TRANSCEIVER_RXLOS_ATTR_ID(index) MODULE_RXLOS_##index +#define TRANSCEIVER_TXFAULT_ATTR_ID(index) MODULE_TXFAULT_##index +#define TRANSCEIVER_LPMODE_ATTR_ID(index) MODULE_LPMODE_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index + +enum as5712_54x_cpld1_sysfs_attributes { + CPLD_VERSION, + ACCESS, + MODULE_PRESENT_ALL, + MODULE_RXLOS_ALL, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + TRANSCEIVER_PRESENT_ATTR_ID(33), + TRANSCEIVER_PRESENT_ATTR_ID(34), + TRANSCEIVER_PRESENT_ATTR_ID(35), + TRANSCEIVER_PRESENT_ATTR_ID(36), + TRANSCEIVER_PRESENT_ATTR_ID(37), + TRANSCEIVER_PRESENT_ATTR_ID(38), + TRANSCEIVER_PRESENT_ATTR_ID(39), + TRANSCEIVER_PRESENT_ATTR_ID(40), + TRANSCEIVER_PRESENT_ATTR_ID(41), + TRANSCEIVER_PRESENT_ATTR_ID(42), + TRANSCEIVER_PRESENT_ATTR_ID(43), + TRANSCEIVER_PRESENT_ATTR_ID(44), + TRANSCEIVER_PRESENT_ATTR_ID(45), + TRANSCEIVER_PRESENT_ATTR_ID(46), + TRANSCEIVER_PRESENT_ATTR_ID(47), + TRANSCEIVER_PRESENT_ATTR_ID(48), + TRANSCEIVER_PRESENT_ATTR_ID(49), + TRANSCEIVER_PRESENT_ATTR_ID(50), + TRANSCEIVER_PRESENT_ATTR_ID(51), + TRANSCEIVER_PRESENT_ATTR_ID(52), + TRANSCEIVER_PRESENT_ATTR_ID(53), + TRANSCEIVER_PRESENT_ATTR_ID(54), + TRANSCEIVER_TXDISABLE_ATTR_ID(1), + TRANSCEIVER_TXDISABLE_ATTR_ID(2), + TRANSCEIVER_TXDISABLE_ATTR_ID(3), + TRANSCEIVER_TXDISABLE_ATTR_ID(4), + TRANSCEIVER_TXDISABLE_ATTR_ID(5), + TRANSCEIVER_TXDISABLE_ATTR_ID(6), + TRANSCEIVER_TXDISABLE_ATTR_ID(7), + TRANSCEIVER_TXDISABLE_ATTR_ID(8), + TRANSCEIVER_TXDISABLE_ATTR_ID(9), + TRANSCEIVER_TXDISABLE_ATTR_ID(10), + TRANSCEIVER_TXDISABLE_ATTR_ID(11), + TRANSCEIVER_TXDISABLE_ATTR_ID(12), + TRANSCEIVER_TXDISABLE_ATTR_ID(13), + TRANSCEIVER_TXDISABLE_ATTR_ID(14), + TRANSCEIVER_TXDISABLE_ATTR_ID(15), + TRANSCEIVER_TXDISABLE_ATTR_ID(16), + TRANSCEIVER_TXDISABLE_ATTR_ID(17), + TRANSCEIVER_TXDISABLE_ATTR_ID(18), + TRANSCEIVER_TXDISABLE_ATTR_ID(19), + TRANSCEIVER_TXDISABLE_ATTR_ID(20), + TRANSCEIVER_TXDISABLE_ATTR_ID(21), + TRANSCEIVER_TXDISABLE_ATTR_ID(22), + TRANSCEIVER_TXDISABLE_ATTR_ID(23), + TRANSCEIVER_TXDISABLE_ATTR_ID(24), + TRANSCEIVER_TXDISABLE_ATTR_ID(25), + TRANSCEIVER_TXDISABLE_ATTR_ID(26), + TRANSCEIVER_TXDISABLE_ATTR_ID(27), + TRANSCEIVER_TXDISABLE_ATTR_ID(28), + TRANSCEIVER_TXDISABLE_ATTR_ID(29), + TRANSCEIVER_TXDISABLE_ATTR_ID(30), + TRANSCEIVER_TXDISABLE_ATTR_ID(31), + TRANSCEIVER_TXDISABLE_ATTR_ID(32), + TRANSCEIVER_TXDISABLE_ATTR_ID(33), + TRANSCEIVER_TXDISABLE_ATTR_ID(34), + TRANSCEIVER_TXDISABLE_ATTR_ID(35), + TRANSCEIVER_TXDISABLE_ATTR_ID(36), + TRANSCEIVER_TXDISABLE_ATTR_ID(37), + TRANSCEIVER_TXDISABLE_ATTR_ID(38), + TRANSCEIVER_TXDISABLE_ATTR_ID(39), + TRANSCEIVER_TXDISABLE_ATTR_ID(40), + TRANSCEIVER_TXDISABLE_ATTR_ID(41), + TRANSCEIVER_TXDISABLE_ATTR_ID(42), + TRANSCEIVER_TXDISABLE_ATTR_ID(43), + TRANSCEIVER_TXDISABLE_ATTR_ID(44), + TRANSCEIVER_TXDISABLE_ATTR_ID(45), + TRANSCEIVER_TXDISABLE_ATTR_ID(46), + TRANSCEIVER_TXDISABLE_ATTR_ID(47), + TRANSCEIVER_TXDISABLE_ATTR_ID(48), + TRANSCEIVER_RXLOS_ATTR_ID(1), + TRANSCEIVER_RXLOS_ATTR_ID(2), + TRANSCEIVER_RXLOS_ATTR_ID(3), + TRANSCEIVER_RXLOS_ATTR_ID(4), + TRANSCEIVER_RXLOS_ATTR_ID(5), + TRANSCEIVER_RXLOS_ATTR_ID(6), + TRANSCEIVER_RXLOS_ATTR_ID(7), + TRANSCEIVER_RXLOS_ATTR_ID(8), + TRANSCEIVER_RXLOS_ATTR_ID(9), + TRANSCEIVER_RXLOS_ATTR_ID(10), + TRANSCEIVER_RXLOS_ATTR_ID(11), + TRANSCEIVER_RXLOS_ATTR_ID(12), + TRANSCEIVER_RXLOS_ATTR_ID(13), + TRANSCEIVER_RXLOS_ATTR_ID(14), + TRANSCEIVER_RXLOS_ATTR_ID(15), + TRANSCEIVER_RXLOS_ATTR_ID(16), + TRANSCEIVER_RXLOS_ATTR_ID(17), + TRANSCEIVER_RXLOS_ATTR_ID(18), + TRANSCEIVER_RXLOS_ATTR_ID(19), + TRANSCEIVER_RXLOS_ATTR_ID(20), + TRANSCEIVER_RXLOS_ATTR_ID(21), + TRANSCEIVER_RXLOS_ATTR_ID(22), + TRANSCEIVER_RXLOS_ATTR_ID(23), + TRANSCEIVER_RXLOS_ATTR_ID(24), + TRANSCEIVER_RXLOS_ATTR_ID(25), + TRANSCEIVER_RXLOS_ATTR_ID(26), + TRANSCEIVER_RXLOS_ATTR_ID(27), + TRANSCEIVER_RXLOS_ATTR_ID(28), + TRANSCEIVER_RXLOS_ATTR_ID(29), + TRANSCEIVER_RXLOS_ATTR_ID(30), + TRANSCEIVER_RXLOS_ATTR_ID(31), + TRANSCEIVER_RXLOS_ATTR_ID(32), + TRANSCEIVER_RXLOS_ATTR_ID(33), + TRANSCEIVER_RXLOS_ATTR_ID(34), + TRANSCEIVER_RXLOS_ATTR_ID(35), + TRANSCEIVER_RXLOS_ATTR_ID(36), + TRANSCEIVER_RXLOS_ATTR_ID(37), + TRANSCEIVER_RXLOS_ATTR_ID(38), + TRANSCEIVER_RXLOS_ATTR_ID(39), + TRANSCEIVER_RXLOS_ATTR_ID(40), + TRANSCEIVER_RXLOS_ATTR_ID(41), + TRANSCEIVER_RXLOS_ATTR_ID(42), + TRANSCEIVER_RXLOS_ATTR_ID(43), + TRANSCEIVER_RXLOS_ATTR_ID(44), + TRANSCEIVER_RXLOS_ATTR_ID(45), + TRANSCEIVER_RXLOS_ATTR_ID(46), + TRANSCEIVER_RXLOS_ATTR_ID(47), + TRANSCEIVER_RXLOS_ATTR_ID(48), + TRANSCEIVER_TXFAULT_ATTR_ID(1), + TRANSCEIVER_TXFAULT_ATTR_ID(2), + TRANSCEIVER_TXFAULT_ATTR_ID(3), + TRANSCEIVER_TXFAULT_ATTR_ID(4), + TRANSCEIVER_TXFAULT_ATTR_ID(5), + TRANSCEIVER_TXFAULT_ATTR_ID(6), + TRANSCEIVER_TXFAULT_ATTR_ID(7), + TRANSCEIVER_TXFAULT_ATTR_ID(8), + TRANSCEIVER_TXFAULT_ATTR_ID(9), + TRANSCEIVER_TXFAULT_ATTR_ID(10), + TRANSCEIVER_TXFAULT_ATTR_ID(11), + TRANSCEIVER_TXFAULT_ATTR_ID(12), + TRANSCEIVER_TXFAULT_ATTR_ID(13), + TRANSCEIVER_TXFAULT_ATTR_ID(14), + TRANSCEIVER_TXFAULT_ATTR_ID(15), + TRANSCEIVER_TXFAULT_ATTR_ID(16), + TRANSCEIVER_TXFAULT_ATTR_ID(17), + TRANSCEIVER_TXFAULT_ATTR_ID(18), + TRANSCEIVER_TXFAULT_ATTR_ID(19), + TRANSCEIVER_TXFAULT_ATTR_ID(20), + TRANSCEIVER_TXFAULT_ATTR_ID(21), + TRANSCEIVER_TXFAULT_ATTR_ID(22), + TRANSCEIVER_TXFAULT_ATTR_ID(23), + TRANSCEIVER_TXFAULT_ATTR_ID(24), + TRANSCEIVER_TXFAULT_ATTR_ID(25), + TRANSCEIVER_TXFAULT_ATTR_ID(26), + TRANSCEIVER_TXFAULT_ATTR_ID(27), + TRANSCEIVER_TXFAULT_ATTR_ID(28), + TRANSCEIVER_TXFAULT_ATTR_ID(29), + TRANSCEIVER_TXFAULT_ATTR_ID(30), + TRANSCEIVER_TXFAULT_ATTR_ID(31), + TRANSCEIVER_TXFAULT_ATTR_ID(32), + TRANSCEIVER_TXFAULT_ATTR_ID(33), + TRANSCEIVER_TXFAULT_ATTR_ID(34), + TRANSCEIVER_TXFAULT_ATTR_ID(35), + TRANSCEIVER_TXFAULT_ATTR_ID(36), + TRANSCEIVER_TXFAULT_ATTR_ID(37), + TRANSCEIVER_TXFAULT_ATTR_ID(38), + TRANSCEIVER_TXFAULT_ATTR_ID(39), + TRANSCEIVER_TXFAULT_ATTR_ID(40), + TRANSCEIVER_TXFAULT_ATTR_ID(41), + TRANSCEIVER_TXFAULT_ATTR_ID(42), + TRANSCEIVER_TXFAULT_ATTR_ID(43), + TRANSCEIVER_TXFAULT_ATTR_ID(44), + TRANSCEIVER_TXFAULT_ATTR_ID(45), + TRANSCEIVER_TXFAULT_ATTR_ID(46), + TRANSCEIVER_TXFAULT_ATTR_ID(47), + TRANSCEIVER_TXFAULT_ATTR_ID(48), + TRANSCEIVER_LPMODE_ATTR_ID(49), + TRANSCEIVER_LPMODE_ATTR_ID(50), + TRANSCEIVER_LPMODE_ATTR_ID(51), + TRANSCEIVER_LPMODE_ATTR_ID(52), + TRANSCEIVER_LPMODE_ATTR_ID(53), + TRANSCEIVER_LPMODE_ATTR_ID(54), + TRANSCEIVER_RESET_ATTR_ID(49), + TRANSCEIVER_RESET_ATTR_ID(50), + TRANSCEIVER_RESET_ATTR_ID(51), + TRANSCEIVER_RESET_ATTR_ID(52), + TRANSCEIVER_RESET_ATTR_ID(53), + TRANSCEIVER_RESET_ATTR_ID(54), +}; + +/* sysfs attributes for hwmon + */ +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_rxlos_all(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_lp_mode(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf); +static int as5712_54x_cpld_read_internal(struct i2c_client *client, u8 reg); +static int as5712_54x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value); + +/* transceiver attributes */ +#define DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index) +#define DECLARE_TRANSCEIVER_PRESENT_ATTR(index) &sensor_dev_attr_module_present_##index.dev_attr.attr + +#define DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_tx_disable_##index, S_IRUGO | S_IWUSR, show_status, set_tx_disable, MODULE_TXDISABLE_##index); \ + static SENSOR_DEVICE_ATTR(module_rx_los_##index, S_IRUGO, show_status, NULL, MODULE_RXLOS_##index); \ + static SENSOR_DEVICE_ATTR(module_tx_fault_##index, S_IRUGO, show_status, NULL, MODULE_TXFAULT_##index) + +#define DECLARE_SFP_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_tx_disable_##index.dev_attr.attr, \ + &sensor_dev_attr_module_rx_los_##index.dev_attr.attr, \ + &sensor_dev_attr_module_tx_fault_##index.dev_attr.attr + +#define DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_lp_mode_##index, S_IRUGO | S_IWUSR, show_status, set_lp_mode, MODULE_LPMODE_##index); \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IWUSR | S_IRUGO, show_status, set_mode_reset, MODULE_RESET_##index) + +#define DECLARE_QSFP_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_lp_mode_##index.dev_attr.attr, \ + &sensor_dev_attr_module_reset_##index.dev_attr.attr + + +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); +/* transceiver attributes */ +static SENSOR_DEVICE_ATTR(module_present_all, S_IRUGO, show_present_all, NULL, MODULE_PRESENT_ALL); +static SENSOR_DEVICE_ATTR(module_rx_los_all, S_IRUGO, show_rxlos_all, NULL, MODULE_RXLOS_ALL); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(32); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(33); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(34); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(35); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(36); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(37); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(38); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(39); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(40); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(41); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(42); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(43); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(44); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(45); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(46); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(47); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(48); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(49); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(50); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(51); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(52); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(53); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(54); + +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(1); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(2); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(3); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(4); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(5); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(6); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(7); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(8); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(9); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(10); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(11); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(12); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(13); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(14); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(15); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(16); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(17); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(18); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(19); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(20); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(21); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(22); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(23); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(24); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(25); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(26); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(27); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(28); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(29); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(30); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(31); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(32); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(33); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(34); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(35); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(36); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(37); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(38); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(39); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(40); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(41); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(42); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(43); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(44); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(45); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(46); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(47); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(48); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(49); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(50); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(51); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(52); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(53); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(54); + +static struct attribute *as5712_54x_cpld1_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + NULL +}; + +static const struct attribute_group as5712_54x_cpld1_group = { + .attrs = as5712_54x_cpld1_attributes, +}; + +static struct attribute *as5712_54x_cpld2_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + &sensor_dev_attr_module_rx_los_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(1), + DECLARE_TRANSCEIVER_PRESENT_ATTR(2), + DECLARE_TRANSCEIVER_PRESENT_ATTR(3), + DECLARE_TRANSCEIVER_PRESENT_ATTR(4), + DECLARE_TRANSCEIVER_PRESENT_ATTR(5), + DECLARE_TRANSCEIVER_PRESENT_ATTR(6), + DECLARE_TRANSCEIVER_PRESENT_ATTR(7), + DECLARE_TRANSCEIVER_PRESENT_ATTR(8), + DECLARE_TRANSCEIVER_PRESENT_ATTR(9), + DECLARE_TRANSCEIVER_PRESENT_ATTR(10), + DECLARE_TRANSCEIVER_PRESENT_ATTR(11), + DECLARE_TRANSCEIVER_PRESENT_ATTR(12), + DECLARE_TRANSCEIVER_PRESENT_ATTR(13), + DECLARE_TRANSCEIVER_PRESENT_ATTR(14), + DECLARE_TRANSCEIVER_PRESENT_ATTR(15), + DECLARE_TRANSCEIVER_PRESENT_ATTR(16), + DECLARE_TRANSCEIVER_PRESENT_ATTR(17), + DECLARE_TRANSCEIVER_PRESENT_ATTR(18), + DECLARE_TRANSCEIVER_PRESENT_ATTR(19), + DECLARE_TRANSCEIVER_PRESENT_ATTR(20), + DECLARE_TRANSCEIVER_PRESENT_ATTR(21), + DECLARE_TRANSCEIVER_PRESENT_ATTR(22), + DECLARE_TRANSCEIVER_PRESENT_ATTR(23), + DECLARE_TRANSCEIVER_PRESENT_ATTR(24), + DECLARE_SFP_TRANSCEIVER_ATTR(1), + DECLARE_SFP_TRANSCEIVER_ATTR(2), + DECLARE_SFP_TRANSCEIVER_ATTR(3), + DECLARE_SFP_TRANSCEIVER_ATTR(4), + DECLARE_SFP_TRANSCEIVER_ATTR(5), + DECLARE_SFP_TRANSCEIVER_ATTR(6), + DECLARE_SFP_TRANSCEIVER_ATTR(7), + DECLARE_SFP_TRANSCEIVER_ATTR(8), + DECLARE_SFP_TRANSCEIVER_ATTR(9), + DECLARE_SFP_TRANSCEIVER_ATTR(10), + DECLARE_SFP_TRANSCEIVER_ATTR(11), + DECLARE_SFP_TRANSCEIVER_ATTR(12), + DECLARE_SFP_TRANSCEIVER_ATTR(13), + DECLARE_SFP_TRANSCEIVER_ATTR(14), + DECLARE_SFP_TRANSCEIVER_ATTR(15), + DECLARE_SFP_TRANSCEIVER_ATTR(16), + DECLARE_SFP_TRANSCEIVER_ATTR(17), + DECLARE_SFP_TRANSCEIVER_ATTR(18), + DECLARE_SFP_TRANSCEIVER_ATTR(19), + DECLARE_SFP_TRANSCEIVER_ATTR(20), + DECLARE_SFP_TRANSCEIVER_ATTR(21), + DECLARE_SFP_TRANSCEIVER_ATTR(22), + DECLARE_SFP_TRANSCEIVER_ATTR(23), + DECLARE_SFP_TRANSCEIVER_ATTR(24), + NULL +}; + +static const struct attribute_group as5712_54x_cpld2_group = { + .attrs = as5712_54x_cpld2_attributes, +}; + +static struct attribute *as5712_54x_cpld3_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + &sensor_dev_attr_module_rx_los_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(25), + DECLARE_TRANSCEIVER_PRESENT_ATTR(26), + DECLARE_TRANSCEIVER_PRESENT_ATTR(27), + DECLARE_TRANSCEIVER_PRESENT_ATTR(28), + DECLARE_TRANSCEIVER_PRESENT_ATTR(29), + DECLARE_TRANSCEIVER_PRESENT_ATTR(30), + DECLARE_TRANSCEIVER_PRESENT_ATTR(31), + DECLARE_TRANSCEIVER_PRESENT_ATTR(32), + DECLARE_TRANSCEIVER_PRESENT_ATTR(33), + DECLARE_TRANSCEIVER_PRESENT_ATTR(34), + DECLARE_TRANSCEIVER_PRESENT_ATTR(35), + DECLARE_TRANSCEIVER_PRESENT_ATTR(36), + DECLARE_TRANSCEIVER_PRESENT_ATTR(37), + DECLARE_TRANSCEIVER_PRESENT_ATTR(38), + DECLARE_TRANSCEIVER_PRESENT_ATTR(39), + DECLARE_TRANSCEIVER_PRESENT_ATTR(40), + DECLARE_TRANSCEIVER_PRESENT_ATTR(41), + DECLARE_TRANSCEIVER_PRESENT_ATTR(42), + DECLARE_TRANSCEIVER_PRESENT_ATTR(43), + DECLARE_TRANSCEIVER_PRESENT_ATTR(44), + DECLARE_TRANSCEIVER_PRESENT_ATTR(45), + DECLARE_TRANSCEIVER_PRESENT_ATTR(46), + DECLARE_TRANSCEIVER_PRESENT_ATTR(47), + DECLARE_TRANSCEIVER_PRESENT_ATTR(48), + DECLARE_TRANSCEIVER_PRESENT_ATTR(49), + DECLARE_TRANSCEIVER_PRESENT_ATTR(50), + DECLARE_TRANSCEIVER_PRESENT_ATTR(51), + DECLARE_TRANSCEIVER_PRESENT_ATTR(52), + DECLARE_TRANSCEIVER_PRESENT_ATTR(53), + DECLARE_TRANSCEIVER_PRESENT_ATTR(54), + DECLARE_SFP_TRANSCEIVER_ATTR(25), + DECLARE_SFP_TRANSCEIVER_ATTR(26), + DECLARE_SFP_TRANSCEIVER_ATTR(27), + DECLARE_SFP_TRANSCEIVER_ATTR(28), + DECLARE_SFP_TRANSCEIVER_ATTR(29), + DECLARE_SFP_TRANSCEIVER_ATTR(30), + DECLARE_SFP_TRANSCEIVER_ATTR(31), + DECLARE_SFP_TRANSCEIVER_ATTR(32), + DECLARE_SFP_TRANSCEIVER_ATTR(33), + DECLARE_SFP_TRANSCEIVER_ATTR(34), + DECLARE_SFP_TRANSCEIVER_ATTR(35), + DECLARE_SFP_TRANSCEIVER_ATTR(36), + DECLARE_SFP_TRANSCEIVER_ATTR(37), + DECLARE_SFP_TRANSCEIVER_ATTR(38), + DECLARE_SFP_TRANSCEIVER_ATTR(39), + DECLARE_SFP_TRANSCEIVER_ATTR(40), + DECLARE_SFP_TRANSCEIVER_ATTR(41), + DECLARE_SFP_TRANSCEIVER_ATTR(42), + DECLARE_SFP_TRANSCEIVER_ATTR(43), + DECLARE_SFP_TRANSCEIVER_ATTR(44), + DECLARE_SFP_TRANSCEIVER_ATTR(45), + DECLARE_SFP_TRANSCEIVER_ATTR(46), + DECLARE_SFP_TRANSCEIVER_ATTR(47), + DECLARE_SFP_TRANSCEIVER_ATTR(48), + DECLARE_QSFP_TRANSCEIVER_ATTR(49), + DECLARE_QSFP_TRANSCEIVER_ATTR(50), + DECLARE_QSFP_TRANSCEIVER_ATTR(51), + DECLARE_QSFP_TRANSCEIVER_ATTR(52), + DECLARE_QSFP_TRANSCEIVER_ATTR(53), + DECLARE_QSFP_TRANSCEIVER_ATTR(54), + NULL +}; + +static const struct attribute_group as5712_54x_cpld3_group = { + .attrs = as5712_54x_cpld3_attributes, +}; + +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i, status, num_regs = 0; + u8 values[4] = {0}; + u8 regs[] = {0x6, 0x7, 0x8, 0x14}; + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + num_regs = (data->type == as5712_54x_cpld2) ? 3 : 4; + + for (i = 0; i < num_regs; i++) { + status = as5712_54x_cpld_read_internal(client, regs[i]); + + if (status < 0) { + goto exit; + } + + values[i] = ~(u8)status; + } + + mutex_unlock(&data->update_lock); + + /* Return values 1 -> 54 in order */ + if (data->type == as5712_54x_cpld2) { + status = sprintf(buf, "%.2x %.2x %.2x\n", + values[0], values[1], values[2]); + } + else { /* as5712_54x_cpld3 */ + values[3] &= 0x3F; + status = sprintf(buf, "%.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], values[3]); + } + + return status; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_rxlos_all(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i, status; + u8 values[3] = {0}; + u8 regs[] = {0xF, 0x10, 0x11}; + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = as5712_54x_cpld_read_internal(client, regs[i]); + + if (status < 0) { + goto exit; + } + + values[i] = (u8)status; + } + + mutex_unlock(&data->update_lock); + + /* Return values 1 -> 24 in order */ + return sprintf(buf, "%.2x %.2x %.2x\n", values[0], values[1], values[2]); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0, revert = 0; + + switch (attr->index) { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + reg = 0x6; + mask = 0x1 << (attr->index - MODULE_PRESENT_1); + break; + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + reg = 0x7; + mask = 0x1 << (attr->index - MODULE_PRESENT_9); + break; + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + reg = 0x8; + mask = 0x1 << (attr->index - MODULE_PRESENT_17); + break; + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + reg = 0x6; + mask = 0x1 << (attr->index - MODULE_PRESENT_25); + break; + case MODULE_PRESENT_33 ... MODULE_PRESENT_40: + reg = 0x7; + mask = 0x1 << (attr->index - MODULE_PRESENT_33); + break; + case MODULE_PRESENT_41 ... MODULE_PRESENT_48: + reg = 0x8; + mask = 0x1 << (attr->index - MODULE_PRESENT_41); + break; + case MODULE_PRESENT_49: + reg = 0x14; + mask = 0x1; + break; + case MODULE_PRESENT_50: + reg = 0x14; + mask = 0x4; + break; + case MODULE_PRESENT_51: + reg = 0x14; + mask = 0x10; + break; + case MODULE_PRESENT_52: + reg = 0x14; + mask = 0x2; + break; + case MODULE_PRESENT_53: + reg = 0x14; + mask = 0x8; + break; + case MODULE_PRESENT_54: + reg = 0x14; + mask = 0x20; + break; + case MODULE_TXFAULT_1 ... MODULE_TXFAULT_8: + reg = 0x9; + mask = 0x1 << (attr->index - MODULE_TXFAULT_1); + break; + case MODULE_TXFAULT_9 ... MODULE_TXFAULT_16: + reg = 0xA; + mask = 0x1 << (attr->index - MODULE_TXFAULT_9); + break; + case MODULE_TXFAULT_17 ... MODULE_TXFAULT_24: + reg = 0xB; + mask = 0x1 << (attr->index - MODULE_TXFAULT_17); + break; + case MODULE_TXFAULT_25 ... MODULE_TXFAULT_32: + reg = 0x9; + mask = 0x1 << (attr->index - MODULE_TXFAULT_25); + break; + case MODULE_TXFAULT_33 ... MODULE_TXFAULT_40: + reg = 0xA; + mask = 0x1 << (attr->index - MODULE_TXFAULT_33); + break; + case MODULE_TXFAULT_41 ... MODULE_TXFAULT_48: + reg = 0xB; + mask = 0x1 << (attr->index - MODULE_TXFAULT_41); + break; + case MODULE_TXDISABLE_1 ... MODULE_TXDISABLE_8: + reg = 0xC; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_1); + break; + case MODULE_TXDISABLE_9 ... MODULE_TXDISABLE_16: + reg = 0xD; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_9); + break; + case MODULE_TXDISABLE_17 ... MODULE_TXDISABLE_24: + reg = 0xE; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_17); + break; + case MODULE_TXDISABLE_25 ... MODULE_TXDISABLE_32: + reg = 0xC; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_25); + break; + case MODULE_TXDISABLE_33 ... MODULE_TXDISABLE_40: + reg = 0xD; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_33); + break; + case MODULE_TXDISABLE_41 ... MODULE_TXDISABLE_48: + reg = 0xE; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_41); + break; + case MODULE_RXLOS_1 ... MODULE_RXLOS_8: + reg = 0xF; + mask = 0x1 << (attr->index - MODULE_RXLOS_1); + break; + case MODULE_RXLOS_9 ... MODULE_RXLOS_16: + reg = 0x10; + mask = 0x1 << (attr->index - MODULE_RXLOS_9); + break; + case MODULE_RXLOS_17 ... MODULE_RXLOS_24: + reg = 0x11; + mask = 0x1 << (attr->index - MODULE_RXLOS_17); + break; + case MODULE_RXLOS_25 ... MODULE_RXLOS_32: + reg = 0xF; + mask = 0x1 << (attr->index - MODULE_RXLOS_25); + break; + case MODULE_RXLOS_33 ... MODULE_RXLOS_40: + reg = 0x10; + mask = 0x1 << (attr->index - MODULE_RXLOS_33); + break; + case MODULE_RXLOS_41 ... MODULE_RXLOS_48: + reg = 0x11; + mask = 0x1 << (attr->index - MODULE_RXLOS_41); + break; + case MODULE_LPMODE_49 ... MODULE_LPMODE_54: + reg = 0x16; + mask = 0x1 << (attr->index - MODULE_LPMODE_49); + break; + case MODULE_RESET_49 ... MODULE_RESET_54: + reg = 0x15; + mask = 0x1 << (attr->index - MODULE_RESET_49); + break; + default: + return 0; + } + + if (attr->index >= MODULE_PRESENT_1 && attr->index <= MODULE_PRESENT_54) { + revert = 1; + } + + mutex_lock(&data->update_lock); + status = as5712_54x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", revert ? !(status & mask) : !!(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + long disable; + int status; + u8 reg = 0, mask = 0; + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + + switch (attr->index) { + case MODULE_TXDISABLE_1 ... MODULE_TXDISABLE_8: + reg = 0xC; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_1); + break; + case MODULE_TXDISABLE_9 ... MODULE_TXDISABLE_16: + reg = 0xD; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_9); + break; + case MODULE_TXDISABLE_17 ... MODULE_TXDISABLE_24: + reg = 0xE; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_17); + break; + case MODULE_TXDISABLE_25 ... MODULE_TXDISABLE_32: + reg = 0xC; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_25); + break; + case MODULE_TXDISABLE_33 ... MODULE_TXDISABLE_40: + reg = 0xD; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_33); + break; + case MODULE_TXDISABLE_41 ... MODULE_TXDISABLE_48: + reg = 0xE; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_41); + break; + default: + return 0; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = as5712_54x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update tx_disable status */ + if (disable) { + status |= mask; + } + else { + status &= ~mask; + } + + status = as5712_54x_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_lp_mode(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + long on; + int status= -ENOENT; + u8 reg = 0x16, mask = 0; + + if(attr->index < MODULE_LPMODE_49 || attr->index > MODULE_LPMODE_54) + return status; + + status = kstrtol(buf, 10, &on); + if (status) { + return status; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = as5712_54x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + mask = 0x1 << (attr->index - MODULE_LPMODE_49); + + /* Update lp_mode status */ + if (on) { + status |= mask; + } + else { + status &= ~mask; + } + + status = as5712_54x_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; + +} + +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + long on; + int status= -ENOENT; + u8 reg = 0x15, mask = 0; + + if(attr->index < MODULE_RESET_49 || attr->index > MODULE_RESET_54) + return status; + + status = kstrtol(buf, 10, &on); + if (status) { + return status; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = as5712_54x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + mask = 0x1 << (attr->index - MODULE_RESET_49); + + /* Update tx_disable status */ + if (on) { + status |= mask; + } + else { + status &= ~mask; + } + + status = as5712_54x_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; + +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = as5712_54x_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() + for this as they will try to lock adapter a second time */ +static int as5712_54x_cpld_mux_reg_write(struct i2c_adapter *adap, + struct i2c_client *client, u8 val) +{ + unsigned long orig_jiffies; + unsigned short flags; + union i2c_smbus_data data; + int try; + s32 res = -EIO; + + data.byte = val; + flags = client->flags; + flags &= I2C_M_TEN | I2C_CLIENT_PEC; + + if (adap->algo->smbus_xfer) { + /* Retry automatically on arbitration loss */ + orig_jiffies = jiffies; + for (res = 0, try = 0; try <= adap->retries; try++) { + res = adap->algo->smbus_xfer(adap, client->addr, flags, + I2C_SMBUS_WRITE, CPLD_CHANNEL_SELECT_REG, + I2C_SMBUS_BYTE_DATA, &data); + if (res != -EAGAIN) + break; + if (time_after(jiffies, + orig_jiffies + adap->timeout)) + break; + } + } + + return res; + +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int as5712_54x_cpld_mux_select_chan(struct i2c_mux_core *muxc, + u32 chan) +{ + struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + u8 regval; + int ret = 0; + regval = chan; + + /* Only select the channel if its different from the last channel */ + if (data->last_chan != regval) { + ret = as5712_54x_cpld_mux_reg_write(muxc->parent, client, regval); + data->last_chan = regval; + } + + return ret; +} + +static int as5712_54x_cpld_mux_deselect_mux(struct i2c_mux_core *muxc, + u32 chan) +{ + struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + + /* Deselect active channel */ + data->last_chan = chips[data->type].deselectChan; + + return as5712_54x_cpld_mux_reg_write(muxc->parent, client, data->last_chan); +} +#else + +static int as5712_54x_cpld_mux_select_chan(struct i2c_adapter *adap, + void *client, u32 chan) +{ + struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + u8 regval; + int ret = 0; + regval = chan; + + /* Only select the channel if its different from the last channel */ + if (data->last_chan != regval) { + ret = as5712_54x_cpld_mux_reg_write(adap, client, regval); + data->last_chan = regval; + } + + return ret; +} + +static int as5712_54x_cpld_mux_deselect_mux(struct i2c_adapter *adap, + void *client, u32 chan) +{ + struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + + /* Deselect active channel */ + data->last_chan = chips[data->type].deselectChan; + + return as5712_54x_cpld_mux_reg_write(adap, client, data->last_chan); +} + +#endif /*#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)*/ + +static void as5712_54x_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void as5712_54x_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static ssize_t show_version(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, 0x1); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); +} + + return sprintf(buf, "%d", val); +} + +/* + * I2C init/probing/exit functions + */ +static int as5712_54x_cpld_mux_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + int force, class; + struct i2c_mux_core *muxc; +#endif + + int chan=0; + struct as5712_54x_cpld_data *data; + int ret = -ENODEV; + const struct attribute_group *group = NULL; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + goto exit; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + muxc = i2c_mux_alloc(adap, &client->dev, + chips[id->driver_data].nchans, + sizeof(*data), 0, + accton_i2c_cpld_mux_select_chan, + accton_i2c_cpld_mux_deselect_mux); + if (!muxc) + return -ENOMEM; + + data = i2c_mux_priv(muxc); + i2c_set_clientdata(client, data); + data->muxc = muxc; + data->client = client; +#else + + data = kzalloc(sizeof(struct as5712_54x_cpld_data), GFP_KERNEL); + if (!data) { + ret = -ENOMEM; + goto exit; + } + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); +#endif + data->type = id->driver_data; + if (data->type == as5712_54x_cpld2 || data->type == as5712_54x_cpld3) { + data->last_chan = chips[data->type].deselectChan; /* force the first selection */ + + /* Now create an adapter for each channel */ + for (chan = 0; chan < chips[data->type].nchans; chan++) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + force = 0; /* dynamic adap number */ + class = 0; /* no class by default */ + ret = i2c_mux_add_adapter(muxc, force, chan, class); + if (ret) +#else + data->virt_adaps[chan] = i2c_add_mux_adapter(adap, &client->dev, client, 0, chan, + 0, + as5712_54x_cpld_mux_select_chan, + as5712_54x_cpld_mux_deselect_mux); + if (data->virt_adaps[chan] == NULL) +#endif + { + ret = -ENODEV; + dev_err(&client->dev, "failed to register multiplexed adapter %d\n", chan); + goto exit_mux_register; + } + } + + dev_info(&client->dev, "registered %d multiplexed busses for I2C mux %s\n", + chan, client->name); + } + /* Register sysfs hooks */ + switch (data->type) + { + case as5712_54x_cpld1: + group = &as5712_54x_cpld1_group; + break; + case as5712_54x_cpld2: + group = &as5712_54x_cpld2_group; + break; + case as5712_54x_cpld3: + group = &as5712_54x_cpld3_group; + break; + default: + break; + } + + + if (group) { + ret = sysfs_create_group(&client->dev.kobj, group); + if (ret) { + goto exit_mux_register; + } + } + + as5712_54x_cpld_add_client(client); + return 0; + +exit_mux_register: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + i2c_mux_del_adapters(muxc); +#else + for (chan--; chan >= 0; chan--) { + i2c_del_mux_adapter(data->virt_adaps[chan]); + } +#endif + kfree(data); +exit: + return ret; +} + +static int as5712_54x_cpld_mux_remove(struct i2c_client *client) +{ + struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + struct i2c_mux_core *muxc = data->muxc; + + i2c_mux_del_adapters(muxc); +#else + const struct chip_desc *chip = &chips[data->type]; + int chan; + const struct attribute_group *group = NULL; + + as5712_54x_cpld_remove_client(client); + + /* Remove sysfs hooks */ + switch (data->type) { + case as5712_54x_cpld1: + group = &as5712_54x_cpld1_group; + break; + case as5712_54x_cpld2: + group = &as5712_54x_cpld2_group; + break; + case as5712_54x_cpld3: + group = &as5712_54x_cpld3_group; + break; + default: + break; + } + + if (group) { + sysfs_remove_group(&client->dev.kobj, group); + } + + for (chan = 0; chan < chip->nchans; ++chan) { + if (data->virt_adaps[chan]) { + i2c_del_mux_adapter(data->virt_adaps[chan]); + data->virt_adaps[chan] = NULL; + } + } +#endif + kfree(data); + + return 0; +} + +static int as5712_54x_cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static int as5712_54x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +int as5712_54x_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as5712_54x_cpld_read_internal(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as5712_54x_cpld_read); + +int as5712_54x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as5712_54x_cpld_write_internal(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as5712_54x_cpld_write); + +#if 0 +int accton_i2c_cpld_mux_get_index(int adap_index) +{ + int i; + + for (i = 0; i < NUM_OF_ALL_CPLD_CHANS; i++) { + if (mux_adap_map[i] == adap_index) { + return i; + } + } + + return -EINVAL; +} +EXPORT_SYMBOL(accton_i2c_cpld_mux_get_index); +#endif + +static struct i2c_driver as5712_54x_cpld_mux_driver = { + .driver = { + .name = "as5712_54x_cpld", + .owner = THIS_MODULE, + }, + .probe = as5712_54x_cpld_mux_probe, + .remove = as5712_54x_cpld_mux_remove, + .id_table = as5712_54x_cpld_mux_id, +}; + +static int __init as5712_54x_cpld_mux_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as5712_54x_cpld_mux_driver); +} + +static void __exit as5712_54x_cpld_mux_exit(void) +{ + i2c_del_driver(&as5712_54x_cpld_mux_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("Accton I2C CPLD mux driver"); +MODULE_LICENSE("GPL"); + +module_init(as5712_54x_cpld_mux_init); +module_exit(as5712_54x_cpld_mux_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/leds-accton_as5712_54x.c b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/leds-accton_as5712_54x.c new file mode 100755 index 000000000000..cdea927368ae --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/leds-accton_as5712_54x.c @@ -0,0 +1,594 @@ +/* + * A LED driver for the accton_as5712_54x_led + * + * Copyright (C) 2013 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#if 0 +#define DEBUG +#endif + +#include +#include +#include +#include +#include +#include +#include + +extern int as5712_54x_cpld_read (unsigned short cpld_addr, u8 reg); +extern int as5712_54x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "as5712_54x_led" + +struct accton_as5712_54x_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[4]; /* Register value, 0 = LOC/DIAG/FAN LED + 1 = PSU1/PSU2 LED + 2 = FAN1-4 LED + 3 = FAN5-6 LED */ +}; + +static struct accton_as5712_54x_led_data *ledctl = NULL; + +/* LED related data + */ +#define LED_TYPE_PSU1_REG_MASK 0x03 +#define LED_MODE_PSU1_GREEN_MASK 0x02 +#define LED_MODE_PSU1_AMBER_MASK 0x01 +#define LED_MODE_PSU1_OFF_MASK 0x03 +#define LED_MODE_PSU1_AUTO_MASK 0x00 + +#define LED_TYPE_PSU2_REG_MASK 0x0C +#define LED_MODE_PSU2_GREEN_MASK 0x08 +#define LED_MODE_PSU2_AMBER_MASK 0x04 +#define LED_MODE_PSU2_OFF_MASK 0x0C +#define LED_MODE_PSU2_AUTO_MASK 0x00 + +#define LED_TYPE_DIAG_REG_MASK 0x0C +#define LED_MODE_DIAG_GREEN_MASK 0x08 +#define LED_MODE_DIAG_AMBER_MASK 0x04 +#define LED_MODE_DIAG_OFF_MASK 0x0C + +#define LED_TYPE_FAN_REG_MASK 0x03 +#define LED_MODE_FAN_GREEN_MASK 0x02 +#define LED_MODE_FAN_AMBER_MASK 0x01 +#define LED_MODE_FAN_OFF_MASK 0x03 +#define LED_MODE_FAN_AUTO_MASK 0x00 + +#define LED_TYPE_FAN1_REG_MASK 0x03 +#define LED_TYPE_FAN2_REG_MASK 0x0C +#define LED_TYPE_FAN3_REG_MASK 0x30 +#define LED_TYPE_FAN4_REG_MASK 0xC0 +#define LED_TYPE_FAN5_REG_MASK 0x03 +#define LED_TYPE_FAN6_REG_MASK 0x0C + +#define LED_MODE_FANX_GREEN_MASK 0x01 +#define LED_MODE_FANX_RED_MASK 0x02 +#define LED_MODE_FANX_OFF_MASK 0x00 + +#define LED_TYPE_LOC_REG_MASK 0x30 +#define LED_MODE_LOC_ON_MASK 0x00 +#define LED_MODE_LOC_OFF_MASK 0x10 +#define LED_MODE_LOC_BLINK_MASK 0x20 + +static const u8 led_reg[] = { + 0xA, /* LOC/DIAG/FAN LED*/ + 0xB, /* PSU1/PSU2 LED */ + 0x16, /* FAN1-4 LED */ + 0x17, /* FAN4-6 LED */ +}; + +enum led_type { + LED_TYPE_PSU1, + LED_TYPE_PSU2, + LED_TYPE_DIAG, + LED_TYPE_FAN, + LED_TYPE_FAN1, + LED_TYPE_FAN2, + LED_TYPE_FAN3, + LED_TYPE_FAN4, + LED_TYPE_FAN5, + LED_TYPE_LOC +}; + +enum led_light_mode { + LED_MODE_OFF = 0, + LED_MODE_GREEN, + LED_MODE_AMBER, + LED_MODE_RED, + LED_MODE_GREEN_BLINK, + LED_MODE_AMBER_BLINK, + LED_MODE_RED_BLINK, + LED_MODE_AUTO, +}; + +struct led_type_mode { + enum led_type type; + int type_mask; + enum led_light_mode mode; + int mode_mask; +}; + +static struct led_type_mode led_type_mode_data[] = { +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_GREEN, LED_MODE_PSU1_GREEN_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_AMBER, LED_MODE_PSU1_AMBER_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_AUTO, LED_MODE_PSU1_AUTO_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_OFF, LED_MODE_PSU1_OFF_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_GREEN, LED_MODE_PSU2_GREEN_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_AMBER, LED_MODE_PSU2_AMBER_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_AUTO, LED_MODE_PSU2_AUTO_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_OFF, LED_MODE_PSU2_OFF_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_GREEN, LED_MODE_FAN_GREEN_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_AMBER, LED_MODE_FAN_AMBER_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_AUTO, LED_MODE_FAN_AUTO_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_OFF, LED_MODE_FAN_OFF_MASK}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 0}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 2}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 2}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 2}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 4}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 6}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 6}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 6}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 0}, +{LED_TYPE_DIAG, LED_TYPE_DIAG_REG_MASK, LED_MODE_GREEN, LED_MODE_DIAG_GREEN_MASK}, +{LED_TYPE_DIAG, LED_TYPE_DIAG_REG_MASK, LED_MODE_AMBER, LED_MODE_DIAG_AMBER_MASK}, +{LED_TYPE_DIAG, LED_TYPE_DIAG_REG_MASK, LED_MODE_OFF, LED_MODE_DIAG_OFF_MASK}, +{LED_TYPE_LOC, LED_TYPE_LOC_REG_MASK, LED_MODE_AMBER, LED_MODE_LOC_ON_MASK}, +{LED_TYPE_LOC, LED_TYPE_LOC_REG_MASK, LED_MODE_OFF, LED_MODE_LOC_OFF_MASK}, +{LED_TYPE_LOC, LED_TYPE_LOC_REG_MASK, LED_MODE_AMBER_BLINK, LED_MODE_LOC_BLINK_MASK} +}; + + +struct fanx_info_s { + u8 cname; /* device name */ + enum led_type type; + u8 reg_id; /* map to led_reg & reg_val */ +}; + +static struct fanx_info_s fanx_info[] = { + {'1', LED_TYPE_FAN1, 2}, + {'2', LED_TYPE_FAN2, 2}, + {'3', LED_TYPE_FAN3, 2}, + {'4', LED_TYPE_FAN4, 2}, + {'5', LED_TYPE_FAN5, 3} +}; + +static int led_reg_val_to_light_mode(enum led_type type, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + + if (type != led_type_mode_data[i].type) + continue; + + if ((led_type_mode_data[i].type_mask & reg_val) == + led_type_mode_data[i].mode_mask) + { + return led_type_mode_data[i].mode; + } + } + + return 0; +} + +static u8 led_light_mode_to_reg_val(enum led_type type, + enum led_light_mode mode, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + if (type != led_type_mode_data[i].type) + continue; + + if (mode != led_type_mode_data[i].mode) + continue; + + reg_val = led_type_mode_data[i].mode_mask | + (reg_val & (~led_type_mode_data[i].type_mask)); + } + + return reg_val; +} + +static int accton_as5712_54x_led_read_value(u8 reg) +{ + return as5712_54x_cpld_read(0x60, reg); +} + +static int accton_as5712_54x_led_write_value(u8 reg, u8 value) +{ + return as5712_54x_cpld_write(0x60, reg, value); +} + +static void accton_as5712_54x_led_update(void) +{ + mutex_lock(&ledctl->update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting accton_as5712_54x_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = accton_as5712_54x_led_read_value(led_reg[i]); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg[i], status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as5712_54x_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + u8 reg, enum led_type type) +{ + int reg_val; + + mutex_lock(&ledctl->update_lock); + + reg_val = accton_as5712_54x_led_read_value(reg); + + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + accton_as5712_54x_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as5712_54x_led_psu_1_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as5712_54x_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU1); +} + +static enum led_brightness accton_as5712_54x_led_psu_1_get(struct led_classdev *cdev) +{ + accton_as5712_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU1, ledctl->reg_val[1]); +} + +static void accton_as5712_54x_led_psu_2_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as5712_54x_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU2); +} + +static enum led_brightness accton_as5712_54x_led_psu_2_get(struct led_classdev *cdev) +{ + accton_as5712_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[1]); +} + +static void accton_as5712_54x_led_fan_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as5712_54x_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_FAN); +} + +static enum led_brightness accton_as5712_54x_led_fan_get(struct led_classdev *cdev) +{ + accton_as5712_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[0]); +} + + +static void accton_as5712_54x_led_fanx_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + enum led_type led_type1; + int reg_id; + int i, nsize; + int ncount = sizeof(fanx_info)/sizeof(struct fanx_info_s); + + for(i=0;iname); + + if (led_cdev->name[nsize-1] == fanx_info[i].cname) + { + led_type1 = fanx_info[i].type; + reg_id = fanx_info[i].reg_id; + accton_as5712_54x_led_set(led_cdev, led_light_mode, led_reg[reg_id], led_type1); + return; + } + } +} + + +static enum led_brightness accton_as5712_54x_led_fanx_get(struct led_classdev *cdev) +{ + enum led_type led_type1; + int reg_id; + int i, nsize; + int ncount = sizeof(fanx_info)/sizeof(struct fanx_info_s); + + for(i=0;iname); + + if (cdev->name[nsize-1] == fanx_info[i].cname) + { + led_type1 = fanx_info[i].type; + reg_id = fanx_info[i].reg_id; + accton_as5712_54x_led_update(); + return led_reg_val_to_light_mode(led_type1, ledctl->reg_val[reg_id]); + } + } + + + return led_reg_val_to_light_mode(LED_TYPE_FAN1, ledctl->reg_val[2]); +} + + +static void accton_as5712_54x_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as5712_54x_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_DIAG); +} + +static enum led_brightness accton_as5712_54x_led_diag_get(struct led_classdev *cdev) +{ + accton_as5712_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void accton_as5712_54x_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as5712_54x_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_LOC); +} + +static enum led_brightness accton_as5712_54x_led_loc_get(struct led_classdev *cdev) +{ + accton_as5712_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static struct led_classdev accton_as5712_54x_leds[] = { + [LED_TYPE_PSU1] = { + .name = "accton_as5712_54x_led::psu1", + .default_trigger = "unused", + .brightness_set = accton_as5712_54x_led_psu_1_set, + .brightness_get = accton_as5712_54x_led_psu_1_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "accton_as5712_54x_led::psu2", + .default_trigger = "unused", + .brightness_set = accton_as5712_54x_led_psu_2_set, + .brightness_get = accton_as5712_54x_led_psu_2_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN] = { + .name = "accton_as5712_54x_led::fan", + .default_trigger = "unused", + .brightness_set = accton_as5712_54x_led_fan_set, + .brightness_get = accton_as5712_54x_led_fan_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN1] = { + .name = "accton_as5712_54x_led::fan1", + .default_trigger = "unused", + .brightness_set = accton_as5712_54x_led_fanx_set, + .brightness_get = accton_as5712_54x_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN2] = { + .name = "accton_as5712_54x_led::fan2", + .default_trigger = "unused", + .brightness_set = accton_as5712_54x_led_fanx_set, + .brightness_get = accton_as5712_54x_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN3] = { + .name = "accton_as5712_54x_led::fan3", + .default_trigger = "unused", + .brightness_set = accton_as5712_54x_led_fanx_set, + .brightness_get = accton_as5712_54x_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN4] = { + .name = "accton_as5712_54x_led::fan4", + .default_trigger = "unused", + .brightness_set = accton_as5712_54x_led_fanx_set, + .brightness_get = accton_as5712_54x_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN5] = { + .name = "accton_as5712_54x_led::fan5", + .default_trigger = "unused", + .brightness_set = accton_as5712_54x_led_fanx_set, + .brightness_get = accton_as5712_54x_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_DIAG] = { + .name = "accton_as5712_54x_led::diag", + .default_trigger = "unused", + .brightness_set = accton_as5712_54x_led_diag_set, + .brightness_get = accton_as5712_54x_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_LOC] = { + .name = "accton_as5712_54x_led::loc", + .default_trigger = "unused", + .brightness_set = accton_as5712_54x_led_loc_set, + .brightness_get = accton_as5712_54x_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +}; + +static int accton_as5712_54x_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as5712_54x_leds); i++) { + led_classdev_suspend(&accton_as5712_54x_leds[i]); + } + + return 0; +} + +static int accton_as5712_54x_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as5712_54x_leds); i++) { + led_classdev_resume(&accton_as5712_54x_leds[i]); + } + + return 0; +} + +static int accton_as5712_54x_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(accton_as5712_54x_leds); i++) { + ret = led_classdev_register(&pdev->dev, &accton_as5712_54x_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(accton_as5712_54x_leds)){ + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&accton_as5712_54x_leds[i]); + } + } + + return ret; +} + +static int accton_as5712_54x_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(accton_as5712_54x_leds); i++) { + led_classdev_unregister(&accton_as5712_54x_leds[i]); + } + + return 0; +} + +static struct platform_driver accton_as5712_54x_led_driver = { + .probe = accton_as5712_54x_led_probe, + .remove = accton_as5712_54x_led_remove, + .suspend = accton_as5712_54x_led_suspend, + .resume = accton_as5712_54x_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as5712_54x_led_init(void) +{ + int ret; + + ret = platform_driver_register(&accton_as5712_54x_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct accton_as5712_54x_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as5712_54x_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&accton_as5712_54x_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as5712_54x_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&accton_as5712_54x_led_driver); + kfree(ledctl); +} + +module_init(accton_as5712_54x_led_init); +module_exit(accton_as5712_54x_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as5712_54x_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/ym2651y.c new file mode 100755 index 000000000000..519530387e29 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/ym2651y.c @@ -0,0 +1,683 @@ +/* + * An hwmon driver for the 3Y Power YM-2651Y Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#if 0 +#define DEBUG +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +enum chips { + YM2651, + YM2401, +}; + +/* Each client has this additional data + */ +struct ym2651y_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 chip; /* chip id */ + u8 capability; /* Register value */ + u16 status_word; /* Register value */ + u8 fan_fault; /* Register value */ + u8 over_temp; /* Register value */ + u16 v_out; /* Register value */ + u16 i_out; /* Register value */ + u16 p_out; /* Register value */ + u8 vout_mode; /* Register value */ + u16 temp; /* Register value */ + u16 fan_speed; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u8 fan_dir[5]; /* Register value */ + u8 pmbus_revision; /* Register value */ + u8 mfr_id[10]; /* Register value */ + u8 mfr_model[16]; /* Register value */ + u8 mfr_revsion[3]; /* Register value */ + u16 mfr_vin_min; /* Register value */ + u16 mfr_vin_max; /* Register value */ + u16 mfr_iin_max; /* Register value */ + u16 mfr_iout_max; /* Register value */ + u16 mfr_pin_max; /* Register value */ + u16 mfr_pout_max; /* Register value */ + u16 mfr_vout_min; /* Register value */ + u16 mfr_vout_max; /* Register value */ +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_vout(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf); +static struct ym2651y_data *ym2651y_update_device(struct device *dev); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value); + +enum ym2651y_sysfs_attributes { + PSU_POWER_ON = 0, + PSU_TEMP_FAULT, + PSU_POWER_GOOD, + PSU_FAN1_FAULT, + PSU_FAN_DIRECTION, + PSU_OVER_TEMP, + PSU_V_OUT, + PSU_I_OUT, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_SPEED, + PSU_FAN1_DUTY_CYCLE, + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_REVISION, + PSU_MFR_VIN_MIN, + PSU_MFR_VIN_MAX, + PSU_MFR_VOUT_MIN, + PSU_MFR_VOUT_MAX, + PSU_MFR_IIN_MAX, + PSU_MFR_IOUT_MAX, + PSU_MFR_PIN_MAX, + PSU_MFR_POUT_MAX +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_power_on, S_IRUGO, show_word, NULL, PSU_POWER_ON); +static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_word, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, show_over_temp, NULL, PSU_OVER_TEMP); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_ascii, NULL, PSU_FAN_DIRECTION); +static SENSOR_DEVICE_ATTR(psu_pmbus_revision,S_IRUGO, show_byte, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, show_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IRUGO, show_ascii, NULL, PSU_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_min, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_max, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_min, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_max, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iin_max, S_IRUGO, show_linear, NULL, PSU_MFR_IIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX); + +static struct attribute *ym2651y_attributes[] = { + &sensor_dev_attr_psu_power_on.dev_attr.attr, + &sensor_dev_attr_psu_temp_fault.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_over_temp.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr, + NULL +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + if (!data->valid) { + return 0; + } + + return (attr->index == PSU_PMBUS_REVISION) ? sprintf(buf, "%d\n", data->pmbus_revision) : + sprintf(buf, "0\n"); +} + +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u16 status = 0; + + if (!data->valid) { + return 0; + } + + switch (attr->index) { + case PSU_POWER_ON: /* psu_power_on, low byte bit 6 of status_word, 0=>ON, 1=>OFF */ + status = (data->status_word & 0x40) ? 0 : 1; + break; + case PSU_TEMP_FAULT: /* psu_temp_fault, low byte bit 2 of status_word, 0=>Normal, 1=>temp fault */ + status = (data->status_word & 0x4) >> 2; + break; + case PSU_POWER_GOOD: /* psu_power_good, high byte bit 3 of status_word, 0=>OK, 1=>FAIL */ + status = (data->status_word & 0x800) ? 0 : 1; + break; + } + + return sprintf(buf, "%d\n", status); +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + ym2651y_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + if (!data->valid) { + return 0; + } + + switch (attr->index) { + case PSU_V_OUT: + value = data->v_out; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp; + break; + case PSU_FAN1_SPEED: + value = data->fan_speed; + multiplier = 1; + break; + case PSU_FAN1_DUTY_CYCLE: + value = data->fan_duty_cycle[0]; + multiplier = 1; + break; + case PSU_MFR_VIN_MIN: + value = data->mfr_vin_min; + break; + case PSU_MFR_VIN_MAX: + value = data->mfr_vin_max; + break; + case PSU_MFR_VOUT_MIN: + value = data->mfr_vout_min; + break; + case PSU_MFR_VOUT_MAX: + value = data->mfr_vout_max; + break; + case PSU_MFR_PIN_MAX: + value = data->mfr_pin_max; + break; + case PSU_MFR_POUT_MAX: + value = data->mfr_pout_max; + break; + case PSU_MFR_IOUT_MAX: + value = data->mfr_iout_max; + break; + case PSU_MFR_IIN_MAX: + value = data->mfr_iin_max; + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u8 shift; + + if (!data->valid) { + return 0; + } + + shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct ym2651y_data *data = ym2651y_update_device(dev); + + if (!data->valid) { + return 0; + } + + return sprintf(buf, "%d\n", data->over_temp >> 7); +} + +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u8 *ptr = NULL; + + if (!data->valid) { + return 0; + } + + switch (attr->index) { + case PSU_FAN_DIRECTION: /* psu_fan_dir */ + ptr = data->fan_dir + 1; /* Skip the first byte since it is the length of string. */ + break; + case PSU_MFR_ID: /* psu_mfr_id */ + ptr = data->mfr_id + 1; /* The first byte is the count byte of string. */; + break; + case PSU_MFR_MODEL: /* psu_mfr_model */ + ptr = data->mfr_model + 1; /* The first byte is the count byte of string. */ + break; + case PSU_MFR_REVISION: /* psu_mfr_revision */ + ptr = data->mfr_revsion + 1; /* The first byte is the count byte of string. */ + break; + default: + return 0; + } + + return sprintf(buf, "%s\n", ptr); +} + +static ssize_t show_vout_by_mode(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct ym2651y_data *data = ym2651y_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + if (!data->valid) { + return 0; + } + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->v_out; + + return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_vout(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + + if (data->chip == YM2401) { + return show_vout_by_mode(dev, da, buf); + } + + return show_linear(dev, da, buf); +} + +static const struct attribute_group ym2651y_group = { + .attrs = ym2651y_attributes, +}; + +static int ym2651y_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct ym2651y_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct ym2651y_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->chip = dev_id->driver_data; + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &ym2651y_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int ym2651y_remove(struct i2c_client *client) +{ + struct ym2651y_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id ym2651y_id[] = { + { "ym2651", YM2651 }, + { "ym2401", YM2401 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, ym2651y_id); + +static struct i2c_driver ym2651y_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "ym2651", + }, + .probe = ym2651y_probe, + .remove = ym2651y_remove, + .id_table = ym2651y_id, + .address_list = normal_i2c, +}; + +static int ym2651y_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int ym2651y_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +static int ym2651y_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; + +abort: + return result; +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct ym2651y_data *ym2651y_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int i, status, length; + u8 command, buf; + struct reg_data_byte regs_byte[] = { {0x19, &data->capability}, + {0x20, &data->vout_mode}, + {0x7d, &data->over_temp}, + {0x81, &data->fan_fault}, + {0x98, &data->pmbus_revision}}; + struct reg_data_word regs_word[] = { {0x79, &data->status_word}, + {0x8b, &data->v_out}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x8d, &data->temp}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x3c, &(data->fan_duty_cycle[1])}, + {0x90, &data->fan_speed}, + {0xa0, &data->mfr_vin_min}, + {0xa1, &data->mfr_vin_max}, + {0xa2, &data->mfr_iin_max}, + {0xa3, &data->mfr_pin_max}, + {0xa4, &data->mfr_vout_min}, + {0xa5, &data->mfr_vout_max}, + {0xa6, &data->mfr_iout_max}, + {0xa7, &data->mfr_pout_max}}; + + dev_dbg(&client->dev, "Starting ym2651 update\n"); + data->valid = 0; + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = ym2651y_read_byte(client, regs_byte[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + goto exit; + } + else { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = ym2651y_read_word(client, regs_word[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + goto exit; + } + else { + *(regs_word[i].value) = status; + } + } + + /* Read fan_direction */ + command = 0xC3; + status = ym2651y_read_block(client, command, data->fan_dir, + ARRAY_SIZE(data->fan_dir)-1); + data->fan_dir[ARRAY_SIZE(data->fan_dir)-1] = '\0'; + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + /* Read mfr_id */ + command = 0x99; + status = ym2651y_read_block(client, command, data->mfr_id, + ARRAY_SIZE(data->mfr_id)-1); + data->mfr_id[ARRAY_SIZE(data->mfr_id)-1] = '\0'; + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + /* Read mfr_model */ + command = 0x9a; + length = 1; + + /* Read first byte to determine the length of data */ + status = ym2651y_read_block(client, command, &buf, length); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + status = ym2651y_read_block(client, command, data->mfr_model, buf+1); + data->mfr_model[buf+1] = '\0'; + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + /* Read mfr_revsion */ + command = 0x9b; + status = ym2651y_read_block(client, command, data->mfr_revsion, + ARRAY_SIZE(data->mfr_revsion)-1); + data->mfr_revsion[ARRAY_SIZE(data->mfr_revsion)-1] = '\0'; + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init ym2651y_init(void) +{ + return i2c_add_driver(&ym2651y_driver); +} + +static void __exit ym2651y_exit(void) +{ + i2c_del_driver(&ym2651y_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("3Y Power YM-2651Y driver"); +MODULE_LICENSE("GPL"); + +module_init(ym2651y_init); +module_exit(ym2651y_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/service/as5712-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/service/as5712-platform-monitor.service new file mode 100755 index 000000000000..da5d283a6d61 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/service/as5712-platform-monitor.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS5712-54X Platform Monitoring service +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/local/bin/accton_as5712_util.py install +ExecStart=/usr/local/bin/accton_as5712_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/setup.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/setup.py new file mode 100755 index 000000000000..f4cb5f960a4d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='as5712_54x', + version='1.0', + description='Module to initialize Accton AS5712-54X platforms', + + packages=['as5712_54x'], + package_dir={'as5712_54x': 'as5712-54x/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/README b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/README new file mode 100755 index 000000000000..44e03cab5f52 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/README @@ -0,0 +1,117 @@ +Copyright (C) 2016 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Contents of this package: + patch - files under patch/ is for kernel and ONIE installer + for the kernel: + config-accton-as5712_54x.patch + for kernel configuration. + driver-i2c-muxes-pca954x-always-deselect.patch + for i2c_mux deselects after transaction. + driver-patches-for-accton-as5712-fan-psu-cpld.patch + for as5712's fan/psu/cpld/led/sfp drivers. + for ONIE: + onie_installer-accton-AS5712-54X.patch + for console port setting and copy util script o rootfs. + module - Contains source code of as5712 kernel driver modules. + +The late Sonic building scripts, pushed @Dec 5 2016, will automatically +create a docker container and run building process under it. +User is not necessary to handle docker environment creation. + +1. Download sonic-buildimage environment. + - Run "git clone https://github.com/Azure/sonic-buildimage". + - cd to sonic-buildimage and run "git submodule update --init --recursive". +2. Build kernel + - cd ./src/sonic-linux-kernel + - Copy patches and series from patch/kernel of this release to + sonic-linux-kernel/patch. + - Build kernel by "make". + - The built kernel package, linux-image-3.16.0-5-amd64_3.16.51-3+deb8u1_amd64.deb + , is generated. +3. Build installer + - Change directory back to sonic-buildimage/. + - Get onie_installer-accton-AS5712-54X.patch" from patch/installer. + - Change setting for AS5712-54X by patching build_image.sh. + "patch -p1 < onie_installer-accton-AS5712-54X.patch" + !!NOTICE, patching onie_installer-accton-AS5712-54X.patch comments out the + "git status" checking at build_image.sh. + - The account and password of installed OS can be given at rules/config. + The default user and password are "admin" & "YourPaSsWoRd" respectively. + - Run "make configure PLATFORM=broadcom" + - Copy the built kernel debian package to target/debs/. + The file is linux-image-3.16.0-5-amd64_*_amd64.deb under directory + src/sonic-linux-kernel/. + - Run "make target/sonic-generic.bin" + - Get the installer, target/sonic-generic.bin, to target machine and install. + +All Linux kernel code is licensed under the GPLv1. All other code is +licensed under the GPLv3. Please see the LICENSE file for copies of +both licenses. + +The code for integacting with Accton AS5712-54X has 2 parts, +kernel drivers and operational script. +The kernel drivers of peripherals are under module/ directory. +1. These drivers are patched into kernel by + driver-patches-for-accton-as5712-fan-psu-cpld.patch + Or you can build the driver under module/ by setting environment variable, + KERNEL_SRC, to proper linux built directory and run make. + It may be sonic-linux-kernel/linux-3.*/debian/build/build_amd64_none_amd64/. +2. A operational script, accton_as5712_util.py, for device initializatian and + peripheral accessing should be installed at /usr/bin. + This script is generated by onie_installer-accton-AS5712-54X.patch. + It's done by patching onie_installer-accton-AS5712-54X.patch at build-image. + Run "accton_as5712_util.py install" to install drivers. + +To initialize the system, run "accton_as5712_util.py install". +To clean up the drivers & devices, run "accton_as5712_util.py clean". +To dump information of sensors, run "accton_as5712_util.py show". +To dump SFP EEPROM, run "accton_as5712_util.py sff". +To set fan speed, run "accton_as5712_util.py set fan". +To enable/disable SFP emission, run "accton_as5712_util.py set sfp". +To set system LEDs' color, run "accton_as5712_util.py set led" +For more information, run "accton_as5712_util.py --help". + +==================================================================== +Besides applying accton_as5712_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +System LED: + There are 5 system LEDs at the lower-left corner of front panel. + They are loc, diag, fan, ps1, and ps2. + The sysfs interface color mappings are as follows: + Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + But not all colors are available for each LED. + +Fan Control: + There are 10 fans inside 5 fan modules. + All fans share 1 duty setting, ranged from 0~100. + +Thermal sensers: + 3 temperature sensors are controlled by the lm75 kernel modules. + +PSUs: + There 2 power supplies slot at the left/right side of the back. + Once if a PSU is not plugged, the status of it is shown failed. + +There are 48 SFP+ and 6 QSFP modules are equipped. +Before operating on PSU and QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py new file mode 100755 index 000000000000..84ab2d83bab4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# +# ------------------------------------------------------------------ + +try: + import os + import sys, getopt + import subprocess + import click + import imp + import logging + import logging.config + import types + import time # this is only being used as part of the example + import traceback + from tabulate import tabulate + from as5712_54x.fanutil import FanUtil + from as5712_54x.thermalutil import ThermalUtil +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = 'accton_as5712_monitor' + +global log_file +global log_level + +# Make a class we can use to capture stdout and sterr in the log +class accton_as5712_monitor(object): + # static temp var + _ori_temp = 0 + _new_perc = 0 + _ori_perc = 0 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_fans(self): + FAN_LEV1_UP_TEMP = 57500 # temperature + FAN_LEV1_DOWN_TEMP = 0 # unused + FAN_LEV1_SPEED_PERC = 100 # percentage*/ + + FAN_LEV2_UP_TEMP = 53000 + FAN_LEV2_DOWN_TEMP = 52700 + FAN_LEV2_SPEED_PERC = 80 + + FAN_LEV3_UP_TEMP = 49500 + FAN_LEV3_DOWN_TEMP = 47700 + FAN_LEV3_SPEED_PERC = 65 + + FAN_LEV4_UP_TEMP = 0 # unused + FAN_LEV4_DOWN_TEMP = 42700 + FAN_LEV4_SPEED_PERC = 40 + + + thermal = ThermalUtil() + fan = FanUtil() + + temp1 = thermal.get_thermal_1_val() + if temp1 is None: + return False + + temp2 = thermal.get_thermal_2_val() + if temp2 is None: + return False + + new_temp = (temp1 + temp2) / 2 + + for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): + fan_stat = fan.get_fan_status(x) + if fan_stat is None: + return False + if fan_stat is False: + self._new_perc = FAN_LEV1_SPEED_PERC + logging.debug('INFO. SET new_perc to %d (FAN fault. fan_num:%d)', self._new_perc, x) + break + logging.debug('INFO. fan_stat is True (fan_num:%d)', x) + + if fan_stat is not None and fan_stat is not False: + diff = new_temp - self._ori_temp + if diff == 0: + logging.debug('INFO. RETURN. THERMAL temp not changed. %d / %d (new_temp / ori_temp)', new_temp, self._ori_temp) + return True + else: + if diff >= 0: + is_up = True + logging.debug('INFO. THERMAL temp UP %d / %d (new_temp / ori_temp)', new_temp, self._ori_temp) + else: + is_up = False + logging.debug('INFO. THERMAL temp DOWN %d / %d (new_temp / ori_temp)', new_temp, self._ori_temp) + + if is_up is True: + if new_temp >= FAN_LEV1_UP_TEMP: + self._new_perc = FAN_LEV1_SPEED_PERC + elif new_temp >= FAN_LEV2_UP_TEMP: + self._new_perc = FAN_LEV2_SPEED_PERC + elif new_temp >= FAN_LEV3_UP_TEMP: + self._new_perc = FAN_LEV3_SPEED_PERC + else: + self._new_perc = FAN_LEV4_SPEED_PERC + logging.debug('INFO. SET. FAN_SPEED as %d (new THERMAL temp:%d)', self._new_perc, new_temp) + else: + if new_temp <= FAN_LEV4_DOWN_TEMP: + self._new_perc = FAN_LEV4_SPEED_PERC + elif new_temp <= FAN_LEV3_DOWN_TEMP: + self._new_perc = FAN_LEV3_SPEED_PERC + elif new_temp <= FAN_LEV2_DOWN_TEMP: + self._new_perc = FAN_LEV2_SPEED_PERC + else: + self._new_perc = FAN_LEV1_SPEED_PERC + logging.debug('INFO. SET. FAN_SPEED as %d (new THERMAL temp:%d)', self._new_perc, new_temp) + + if self._ori_perc == self._new_perc: + logging.debug('INFO. RETURN. FAN speed not changed. %d / %d (new_perc / ori_perc)', self._new_perc, self._ori_perc) + return True + + set_stat = fan.set_fan_duty_cycle(fan.get_idx_fan_start(), self._new_perc) + if set_stat is True: + logging.debug('INFO: PASS. set_fan_duty_cycle (%d)', self._new_perc) + else: + logging.debug('INFO: FAIL. set_fan_duty_cycle (%d)', self._new_perc) + + logging.debug('INFO: GET. ori_perc is %d. ori_temp is %d', self._ori_perc, self._ori_temp) + self._ori_perc = self._new_perc + self._ori_temp = new_temp + logging.debug('INFO: UPDATE. ori_perc to %d. ori_temp to %d', self._ori_perc, self._ori_temp) + + return True + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['lfile=']) + except getopt.GetoptError: + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + monitor = accton_as5712_monitor(log_file, log_level) + + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(1) + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py new file mode 100755 index 000000000000..e958cb596862 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py @@ -0,0 +1,602 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +PROJECT_NAME = 'as5712_54x' +version = '0.2.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan1':1, 'fan2':1,'fan3':1,'fan4':1,'fan5':1,'thermal':3, 'psu':2, 'sfp':54} + + +led_prefix ='/sys/devices/platform/as5712_54x_led/leds/accton_'+PROJECT_NAME+'_led::' +fan_prefix ='/sys/devices/platform/as5712_54x_' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2'], + 'fan1': ['fan'], + 'fan2': ['fan'], + 'fan3': ['fan'], + 'fan4': ['fan'], + 'fan5': ['fan'], + } +hwmon_nodes = {'led': ['brightness'] , + 'fan1': ['fan1_duty_cycle_percentage', 'fan1_fault', 'fan1_speed_rpm', 'fan1_direction', 'fanr1_fault', 'fanr1_speed_rpm'], + 'fan2': ['fan2_duty_cycle_percentage','fan2_fault', 'fan2_speed_rpm', 'fan2_direction', 'fanr2_fault', 'fanr2_speed_rpm'], + 'fan3': ['fan3_duty_cycle_percentage','fan3_fault', 'fan3_speed_rpm', 'fan3_direction', 'fanr3_fault', 'fanr3_speed_rpm'], + 'fan4': ['fan4_duty_cycle_percentage','fan4_fault', 'fan4_speed_rpm', 'fan4_direction', 'fanr4_fault', 'fanr4_speed_rpm'], + 'fan5': ['fan5_duty_cycle_percentage','fan5_fault', 'fan5_speed_rpm', 'fan5_direction', 'fanr5_fault', 'fanr5_speed_rpm'], + } +hwmon_prefix ={'led': led_prefix, + 'fan1': fan_prefix, + 'fan2': fan_prefix, + 'fan3': fan_prefix, + 'fan4': fan_prefix, + 'fan5': fan_prefix, + } + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'thermal': ['61-0048','62-0049', '63-004a'] , + 'psu': ['57-0050','58-0053'], + 'sfp': ['-0050']} +i2c_nodes = { + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['sfp_is_present ', 'sfp_tx_disable']} + +sfp_map = [2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 52, 54, 51, 53, 55] +mknod =[ +'echo as5712_54x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo as5712_54x_cpld2 0x61 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo as5712_54x_cpld3 0x62 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device', + +# PSU-1 +'echo as5712_54x_psu1 0x38 > /sys/bus/i2c/devices/i2c-57/new_device', +'echo cpr_4011_4mxx 0x3c > /sys/bus/i2c/devices/i2c-57/new_device', +'echo as5712_54x_psu1 0x50 > /sys/bus/i2c/devices/i2c-57/new_device', + +# PSU-2 +'echo as5712_54x_psu2 0x3b > /sys/bus/i2c/devices/i2c-58/new_device', +'echo cpr_4011_4mxx 0x3f > /sys/bus/i2c/devices/i2c-58/new_device', +'echo as5712_54x_psu2 0x53 > /sys/bus/i2c/devices/i2c-58/new_device', + +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-61/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-62/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-63/new_device', + +#EERPOM +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', +] + +mknod2 =[ +'echo as5712_54x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo as5712_54x_cpld2 0x61 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo as5712_54x_cpld3 0x62 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device', + +# PSU-1 +'echo as5712_54x_psu1 0x38 > /sys/bus/i2c/devices/i2c-57/new_device', +'echo cpr_4011_4mxx 0x3c > /sys/bus/i2c/devices/i2c-57/new_device', +'echo as5712_54x_psu1 0x50 > /sys/bus/i2c/devices/i2c-57/new_device', + +# PSU-2 +'echo as5712_54x_psu2 0x3b > /sys/bus/i2c/devices/i2c-58/new_device', +'echo cpr_4011_4mxx 0x3f > /sys/bus/i2c/devices/i2c-58/new_device', +'echo as5712_54x_psu2 0x53 > /sys/bus/i2c/devices/i2c-58/new_device', + +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-61/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-62/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-63/new_device', + +#EERPOM +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', +] + +FORCE = 0 +logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +logging.basicConfig(level=logging.INFO) + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-54 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-54 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ACCTON DBG]: "+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status = 1 + output = "" + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log ("cmd:" + cmd) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_inserted(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + + + +kos = [ +'depmod -ae', +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x', +'modprobe optoe', +'modprobe i2c-mux-accton_as5712_54x_cpld', +'modprobe cpr_4011_4mxx', +'modprobe ym2651y', +'modprobe accton_as5712_54x_fan', +'modprobe leds-accton_as5712_54x', +'modprobe accton_as5712_54x_psu'] + +def driver_install(): + global FORCE + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + + + +def i2c_order_check(): + # i2c bus 0 and 1 might be installed in different order. + # Here check if 0x70 is exist @ i2c-0 + tmp = "echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device" + status, output = log_os_system(tmp, 0) + if not device_exist(): + order = 1 + else: + order = 0 + tmp = "echo 0x70 > /sys/bus/i2c/devices/i2c-1/delete_device" + status, output = log_os_system(tmp, 0) + return order + +def device_install(): + global FORCE + + order = i2c_order_check() + # if 0x76 is not exist @i2c-0, use reversed bus order + if order: + for i in range(0,len(mknod2)): + #for pca954x need times to built new i2c buses + if mknod2[i].find('pca954') != -1: + time.sleep(2) + + status, output = log_os_system(mknod2[i], 1) + if status: + print output + if FORCE == 0: + return status + else: + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(2) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0,len(sfp_map)): + status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + status, output =log_os_system("echo port"+str(i)+" > /sys/bus/i2c/devices/"+str(sfp_map[i])+"-0050/port_name", 1) + if status: + print output + if FORCE == 0: + return status + + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/0-0070", 0) + if status==0: + I2C_ORDER=1 + else: + I2C_ORDER=0 + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + if I2C_ORDER==0: + nodelist = mknod + else: + nodelist = mknod2 + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_inserted() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_inserted() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_inserted()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'sfp_eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan1'] ['fan11'][0] + node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0070", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/Makefile new file mode 100644 index 000000000000..697dcff656c3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/Makefile @@ -0,0 +1,4 @@ +obj-m:=accton_i2c_cpld.o x86-64-accton-as5812-54t-fan.o \ + x86-64-accton-as5812-54t-leds.o x86-64-accton-as5812-54t-psu.o \ + x86-64-accton-as5812-54t-sfp.o ym2651y.o + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/accton_i2c_cpld.c new file mode 100644 index 000000000000..c01d6bcca228 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/accton_i2c_cpld.c @@ -0,0 +1,330 @@ +/* + * A hwmon driver for the accton_i2c_cpld + * + * Copyright (C) 2013 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for accton_i2c_cpld + */ +static const unsigned short normal_i2c[] = { 0x31, 0x35, 0x60, 0x61, 0x62, 0x64, I2C_CLIENT_END }; + +static ssize_t show_cpld_version(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, 0x1); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d", val); +} + +static struct device_attribute ver = __ATTR(version, 0600, show_cpld_version, NULL); + +static void accton_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void accton_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int accton_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + status = sysfs_create_file(&client->dev.kobj, &ver.attr); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + accton_i2c_cpld_add_client(client); + + return 0; + +exit: + return status; +} + +static int accton_i2c_cpld_remove(struct i2c_client *client) +{ + sysfs_remove_file(&client->dev.kobj, &ver.attr); + accton_i2c_cpld_remove_client(client); + + return 0; +} + +static const struct i2c_device_id accton_i2c_cpld_id[] = { + { "accton_i2c_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, accton_i2c_cpld_id); + +static struct i2c_driver accton_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "accton_i2c_cpld", + }, + .probe = accton_i2c_cpld_probe, + .remove = accton_i2c_cpld_remove, + .id_table = accton_i2c_cpld_id, + .address_list = normal_i2c, +}; + +int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_read); + +int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_write); + +static int __init accton_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&accton_i2c_cpld_driver); +} + +static void __exit accton_i2c_cpld_exit(void) +{ + i2c_del_driver(&accton_i2c_cpld_driver); +} + +static struct dmi_system_id as7512_dmi_table[] = { + { + .ident = "Accton AS7512", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS7512"), + }, + }, + { + .ident = "Accton AS7512", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS7512"), + }, + }, +}; + +int platform_accton_as7512_32x(void) +{ + return dmi_check_system(as7512_dmi_table); +} +EXPORT_SYMBOL(platform_accton_as7512_32x); + +static struct dmi_system_id as7712_dmi_table[] = { + { + .ident = "Accton AS7712", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS7712"), + }, + }, + { + .ident = "Accton AS7712", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS7712"), + }, + }, +}; + +int platform_accton_as7712_32x(void) +{ + return dmi_check_system(as7712_dmi_table); +} +EXPORT_SYMBOL(platform_accton_as7712_32x); + +static struct dmi_system_id as5812_54t_dmi_table[] = { + { + .ident = "Accton AS5812 54t", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS5812-54T"), + }, + }, + { + .ident = "Accton AS5812 54t", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS5812-54T"), + }, + }, +}; + +int platform_accton_as5812_54t(void) +{ + return dmi_check_system(as5812_54t_dmi_table); +} +EXPORT_SYMBOL(platform_accton_as5812_54t); + +static struct dmi_system_id as5512_54x_dmi_table[] = { + { + .ident = "Accton AS5512", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS5512"), + }, + }, + { + .ident = "Accton AS5512", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS5512"), + }, + }, +}; + +int platform_accton_as5512_54x(void) +{ + return dmi_check_system(as5512_54x_dmi_table); +} +EXPORT_SYMBOL(platform_accton_as5512_54x); + +static struct dmi_system_id as7716_dmi_table[] = { + { + .ident = "Accton AS7716", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS7716"), + }, + }, + { + .ident = "Accton AS7716", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS7716"), + }, + }, +}; + +int platform_accton_as7716_32x(void) +{ + return dmi_check_system(as7716_dmi_table); +} +EXPORT_SYMBOL(platform_accton_as7716_32x); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_i2c_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(accton_i2c_cpld_init); +module_exit(accton_i2c_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-fan.c b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-fan.c new file mode 100644 index 000000000000..bad9245e93ac --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-fan.c @@ -0,0 +1,442 @@ +/* + * A hwmon driver for the Accton as5812 54t fan + * + * Copyright (C) 2015 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FAN_MAX_NUMBER 5 +#define FAN_SPEED_CPLD_TO_RPM_STEP 150 +#define FAN_SPEED_PRECENT_TO_CPLD_STEP 5 +#define FAN_DUTY_CYCLE_MIN 0 +#define FAN_DUTY_CYCLE_MAX 100 /* 100% */ + +#define CPLD_REG_FAN_STATUS_OFFSET 0xC +#define CPLD_REG_FANR_STATUS_OFFSET 0x1F +#define CPLD_REG_FAN_DIRECTION_OFFSET 0x1E + +#define CPLD_FAN1_REG_SPEED_OFFSET 0x10 +#define CPLD_FAN2_REG_SPEED_OFFSET 0x11 +#define CPLD_FAN3_REG_SPEED_OFFSET 0x12 +#define CPLD_FAN4_REG_SPEED_OFFSET 0x13 +#define CPLD_FAN5_REG_SPEED_OFFSET 0x14 + +#define CPLD_FANR1_REG_SPEED_OFFSET 0x18 +#define CPLD_FANR2_REG_SPEED_OFFSET 0x19 +#define CPLD_FANR3_REG_SPEED_OFFSET 0x1A +#define CPLD_FANR4_REG_SPEED_OFFSET 0x1B +#define CPLD_FANR5_REG_SPEED_OFFSET 0x1C + +#define CPLD_REG_FAN_PWM_CYCLE_OFFSET 0xD + +#define CPLD_FAN1_INFO_BIT_MASK 0x1 +#define CPLD_FAN2_INFO_BIT_MASK 0x2 +#define CPLD_FAN3_INFO_BIT_MASK 0x4 +#define CPLD_FAN4_INFO_BIT_MASK 0x8 +#define CPLD_FAN5_INFO_BIT_MASK 0x10 + +#define PROJECT_NAME + +#define LOCAL_DEBUG 0 + +static struct accton_as5812_54t_fan *fan_data = NULL; + +struct accton_as5812_54t_fan { + struct platform_device *pdev; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[FAN_MAX_NUMBER]; /* inner first fan status */ + u32 speed[FAN_MAX_NUMBER]; /* inner first fan speed */ + u8 direction[FAN_MAX_NUMBER]; /* reconrd the direction of inner first and second fans */ + u32 duty_cycle[FAN_MAX_NUMBER]; /* control the speed of inner first and second fans */ + u8 r_status[FAN_MAX_NUMBER]; /* inner second fan status */ + u32 r_speed[FAN_MAX_NUMBER]; /* inner second fan speed */ +}; + +/*******************/ +#define MAKE_FAN_MASK_OR_REG(name,type) \ + CPLD_FAN##type##1_##name, \ + CPLD_FAN##type##2_##name, \ + CPLD_FAN##type##3_##name, \ + CPLD_FAN##type##4_##name, \ + CPLD_FAN##type##5_##name, + +/* fan related data + */ +static const u8 fan_info_mask[] = { + MAKE_FAN_MASK_OR_REG(INFO_BIT_MASK,) +}; + +static const u8 fan_speed_reg[] = { + MAKE_FAN_MASK_OR_REG(REG_SPEED_OFFSET,) +}; + +static const u8 fanr_speed_reg[] = { + MAKE_FAN_MASK_OR_REG(REG_SPEED_OFFSET,R) +}; + +/*******************/ +#define DEF_FAN_SET(id) \ + FAN##id##_FAULT, \ + FAN##id##_SPEED, \ + FAN##id##_DUTY_CYCLE, \ + FAN##id##_DIRECTION, \ + FANR##id##_FAULT, \ + FANR##id##_SPEED, + +enum sysfs_fan_attributes { + DEF_FAN_SET(1) + DEF_FAN_SET(2) + DEF_FAN_SET(3) + DEF_FAN_SET(4) + DEF_FAN_SET(5) +}; +/*******************/ +static void accton_as5812_54t_fan_update_device(struct device *dev); +static int accton_as5812_54t_fan_read_value(u8 reg); +static int accton_as5812_54t_fan_write_value(u8 reg, u8 value); + +static ssize_t fan_set_duty_cycle(struct device *dev, + struct device_attribute *da,const char *buf, size_t count); +static ssize_t fan_show_value(struct device *dev, + struct device_attribute *da, char *buf); + +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + + +/*******************/ +#define _MAKE_SENSOR_DEVICE_ATTR(prj, id) \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_fault, S_IRUGO, fan_show_value, NULL, FAN##id##_FAULT); \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##id##_SPEED); \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, \ + fan_set_duty_cycle, FAN##id##_DUTY_CYCLE); \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_direction, S_IRUGO, fan_show_value, NULL, FAN##id##_DIRECTION); \ + static SENSOR_DEVICE_ATTR(prj##fanr##id##_fault, S_IRUGO, fan_show_value, NULL, FANR##id##_FAULT); \ + static SENSOR_DEVICE_ATTR(prj##fanr##id##_speed_rpm, S_IRUGO, fan_show_value, NULL, FANR##id##_SPEED); + +#define MAKE_SENSOR_DEVICE_ATTR(prj,id) _MAKE_SENSOR_DEVICE_ATTR(prj,id) + +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME, 1) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME, 2) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME, 3) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME, 4) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME, 5) +/*******************/ + +#define _MAKE_FAN_ATTR(prj, id) \ + &sensor_dev_attr_##prj##fan##id##_fault.dev_attr.attr, \ + &sensor_dev_attr_##prj##fan##id##_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_##prj##fan##id##_duty_cycle_percentage.dev_attr.attr,\ + &sensor_dev_attr_##prj##fan##id##_direction.dev_attr.attr, \ + &sensor_dev_attr_##prj##fanr##id##_fault.dev_attr.attr, \ + &sensor_dev_attr_##prj##fanr##id##_speed_rpm.dev_attr.attr, + +#define MAKE_FAN_ATTR(prj, id) _MAKE_FAN_ATTR(prj, id) + +static struct attribute *accton_as5812_54t_fan_attributes[] = { + /* fan related attributes */ + MAKE_FAN_ATTR(PROJECT_NAME,1) + MAKE_FAN_ATTR(PROJECT_NAME,2) + MAKE_FAN_ATTR(PROJECT_NAME,3) + MAKE_FAN_ATTR(PROJECT_NAME,4) + MAKE_FAN_ATTR(PROJECT_NAME,5) + NULL +}; +/*******************/ + +/* fan related functions + */ +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + ssize_t ret = 0; + int data_index, type_index; + + accton_as5812_54t_fan_update_device(dev); + + if (fan_data->valid == 0) { + return ret; + } + + type_index = attr->index%FAN2_FAULT; + data_index = attr->index/FAN2_FAULT; + + switch (type_index) { + case FAN1_FAULT: + ret = sprintf(buf, "%d\n", fan_data->status[data_index]); + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FAN1_SPEED: + ret = sprintf(buf, "%d\n", fan_data->speed[data_index]); + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FAN1_DUTY_CYCLE: + ret = sprintf(buf, "%d\n", fan_data->duty_cycle[data_index]); + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FAN1_DIRECTION: + ret = sprintf(buf, "%d\n", fan_data->direction[data_index]); /* presnet, need to modify*/ + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FANR1_FAULT: + ret = sprintf(buf, "%d\n", fan_data->r_status[data_index]); + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FANR1_SPEED: + ret = sprintf(buf, "%d\n", fan_data->r_speed[data_index]); + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + default: + if (LOCAL_DEBUG) + printk ("[Check !!][%s][%d] \n", __FUNCTION__, __LINE__); + break; + } + + return ret; +} +/*******************/ +static ssize_t fan_set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) { + + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < FAN_DUTY_CYCLE_MIN || value > FAN_DUTY_CYCLE_MAX) + return -EINVAL; + + accton_as5812_54t_fan_write_value(CPLD_REG_FAN_PWM_CYCLE_OFFSET, value/FAN_SPEED_PRECENT_TO_CPLD_STEP); + + fan_data->valid = 0; + + return count; +} + +static const struct attribute_group accton_as5812_54t_fan_group = { + .attrs = accton_as5812_54t_fan_attributes, +}; + +static int accton_as5812_54t_fan_read_value(u8 reg) +{ + return accton_i2c_cpld_read(0x60, reg); +} + +static int accton_as5812_54t_fan_write_value(u8 reg, u8 value) +{ + return accton_i2c_cpld_write(0x60, reg, value); +} + +static void accton_as5812_54t_fan_update_device(struct device *dev) +{ + int speed, r_speed, fault, r_fault, ctrl_speed, direction; + int i; + + mutex_lock(&fan_data->update_lock); + + if (LOCAL_DEBUG) + printk ("Starting accton_as5812_54t_fan update \n"); + + if (!(time_after(jiffies, fan_data->last_updated + HZ + HZ / 2) || !fan_data->valid)) { + /* do nothing */ + goto _exit; + } + + fan_data->valid = 0; + + if (LOCAL_DEBUG) + printk ("Starting accton_as5812_54t_fan update 2 \n"); + + fault = accton_as5812_54t_fan_read_value(CPLD_REG_FAN_STATUS_OFFSET); + r_fault = accton_as5812_54t_fan_read_value(CPLD_REG_FANR_STATUS_OFFSET); + direction = accton_as5812_54t_fan_read_value(CPLD_REG_FAN_DIRECTION_OFFSET); + ctrl_speed = accton_as5812_54t_fan_read_value(CPLD_REG_FAN_PWM_CYCLE_OFFSET); + + if ( (fault < 0) || (r_fault < 0) || (direction < 0) || (ctrl_speed < 0) ) + { + if (LOCAL_DEBUG) + printk ("[Error!!][%s][%d] \n", __FUNCTION__, __LINE__); + goto _exit; /* error */ + } + + if (LOCAL_DEBUG) + printk ("[fan:] fault:%d, r_fault=%d, direction=%d, ctrl_speed=%d \n",fault, r_fault, direction, ctrl_speed); + + for (i=0; istatus[i] = (fault & fan_info_mask[i]) >> i; + if (LOCAL_DEBUG) + printk ("[fan%d:] fail=%d \n",i, fan_data->status[i]); + + fan_data->r_status[i] = (r_fault & fan_info_mask[i]) >> i; + fan_data->direction[i] = (direction & fan_info_mask[i]) >> i; + fan_data->duty_cycle[i] = ctrl_speed * FAN_SPEED_PRECENT_TO_CPLD_STEP; + + /* fan speed + */ + speed = accton_as5812_54t_fan_read_value(fan_speed_reg[i]); + r_speed = accton_as5812_54t_fan_read_value(fanr_speed_reg[i]); + if ( (speed < 0) || (r_speed < 0) ) + { + if (LOCAL_DEBUG) + printk ("[Error!!][%s][%d] \n", __FUNCTION__, __LINE__); + goto _exit; /* error */ + } + + if (LOCAL_DEBUG) + printk ("[fan%d:] speed:%d, r_speed=%d \n", i, speed, r_speed); + + fan_data->speed[i] = speed * FAN_SPEED_CPLD_TO_RPM_STEP; + fan_data->r_speed[i] = r_speed * FAN_SPEED_CPLD_TO_RPM_STEP; + } + + /* finish to update */ + fan_data->last_updated = jiffies; + fan_data->valid = 1; + +_exit: + mutex_unlock(&fan_data->update_lock); +} + +static int accton_as5812_54t_fan_probe(struct platform_device *pdev) +{ + int status = -1; + + /* Register sysfs hooks */ + status = sysfs_create_group(&pdev->dev.kobj, &accton_as5812_54t_fan_group); + if (status) { + goto exit; + + } + + fan_data->hwmon_dev = hwmon_device_register(&pdev->dev); + if (IS_ERR(fan_data->hwmon_dev)) { + status = PTR_ERR(fan_data->hwmon_dev); + goto exit_remove; + } + + dev_info(&pdev->dev, "accton_as5812_54t_fan\n"); + + return 0; + +exit_remove: + sysfs_remove_group(&pdev->dev.kobj, &accton_as5812_54t_fan_group); +exit: + return status; +} + +static int accton_as5812_54t_fan_remove(struct platform_device *pdev) +{ + hwmon_device_unregister(fan_data->hwmon_dev); + sysfs_remove_group(&fan_data->pdev->dev.kobj, &accton_as5812_54t_fan_group); + + return 0; +} + +#define DRVNAME "as5812_54t_fan" + +static struct platform_driver accton_as5812_54t_fan_driver = { + .probe = accton_as5812_54t_fan_probe, + .remove = accton_as5812_54t_fan_remove, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as5812_54t_fan_init(void) +{ + int ret; + + extern int platform_accton_as5812_54t(void); + if (!platform_accton_as5812_54t()) { + return -ENODEV; + } + + ret = platform_driver_register(&accton_as5812_54t_fan_driver); + if (ret < 0) { + goto exit; + } + + fan_data = kzalloc(sizeof(struct accton_as5812_54t_fan), GFP_KERNEL); + if (!fan_data) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as5812_54t_fan_driver); + goto exit; + } + + mutex_init(&fan_data->update_lock); + fan_data->valid = 0; + + fan_data->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(fan_data->pdev)) { + ret = PTR_ERR(fan_data->pdev); + platform_driver_unregister(&accton_as5812_54t_fan_driver); + kfree(fan_data); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as5812_54t_fan_exit(void) +{ + platform_device_unregister(fan_data->pdev); + platform_driver_unregister(&accton_as5812_54t_fan_driver); + kfree(fan_data); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as5812_54t_fan driver"); +MODULE_LICENSE("GPL"); + +module_init(accton_as5812_54t_fan_init); +module_exit(accton_as5812_54t_fan_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-leds.c b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-leds.c new file mode 100644 index 000000000000..011f62e76c06 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-leds.c @@ -0,0 +1,601 @@ +/* + * A LED driver for the accton_as5812_54t_led + * + * Copyright (C) 2015 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include + +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "as5812_54t_led" + +struct accton_as5812_54t_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[4]; /* Register value, 0 = LOC/DIAG/FAN LED + 1 = PSU1/PSU2 LED + 2 = FAN1-4 LED + 3 = FAN5-6 LED */ +}; + +static struct accton_as5812_54t_led_data *ledctl = NULL; + +/* LED related data + */ +#define LED_TYPE_PSU1_REG_MASK 0x03 +#define LED_MODE_PSU1_GREEN_MASK 0x02 +#define LED_MODE_PSU1_AMBER_MASK 0x01 +#define LED_MODE_PSU1_OFF_MASK 0x03 +#define LED_MODE_PSU1_AUTO_MASK 0x00 + +#define LED_TYPE_PSU2_REG_MASK 0x0C +#define LED_MODE_PSU2_GREEN_MASK 0x08 +#define LED_MODE_PSU2_AMBER_MASK 0x04 +#define LED_MODE_PSU2_OFF_MASK 0x0C +#define LED_MODE_PSU2_AUTO_MASK 0x00 + +#define LED_TYPE_DIAG_REG_MASK 0x0C +#define LED_MODE_DIAG_GREEN_MASK 0x08 +#define LED_MODE_DIAG_AMBER_MASK 0x04 +#define LED_MODE_DIAG_OFF_MASK 0x0C + +#define LED_TYPE_FAN_REG_MASK 0x03 +#define LED_MODE_FAN_GREEN_MASK 0x02 +#define LED_MODE_FAN_AMBER_MASK 0x01 +#define LED_MODE_FAN_OFF_MASK 0x03 +#define LED_MODE_FAN_AUTO_MASK 0x00 + +#define LED_TYPE_FAN1_REG_MASK 0x03 +#define LED_TYPE_FAN2_REG_MASK 0x0C +#define LED_TYPE_FAN3_REG_MASK 0x30 +#define LED_TYPE_FAN4_REG_MASK 0xC0 +#define LED_TYPE_FAN5_REG_MASK 0x03 +#define LED_TYPE_FAN6_REG_MASK 0x0C + +#define LED_MODE_FANX_GREEN_MASK 0x01 +#define LED_MODE_FANX_RED_MASK 0x02 +#define LED_MODE_FANX_OFF_MASK 0x00 + +#define LED_TYPE_LOC_REG_MASK 0x30 +#define LED_MODE_LOC_ON_MASK 0x00 +#define LED_MODE_LOC_OFF_MASK 0x10 +#define LED_MODE_LOC_BLINK_MASK 0x20 + +static const u8 led_reg[] = { + 0xA, /* LOC/DIAG/FAN LED*/ + 0xB, /* PSU1/PSU2 LED */ + 0x16, /* FAN1-4 LED */ + 0x17, /* FAN4-6 LED */ +}; + +enum led_type { + LED_TYPE_PSU1, + LED_TYPE_PSU2, + LED_TYPE_DIAG, + LED_TYPE_FAN, + LED_TYPE_FAN1, + LED_TYPE_FAN2, + LED_TYPE_FAN3, + LED_TYPE_FAN4, + LED_TYPE_FAN5, + LED_TYPE_LOC +}; + +enum led_light_mode { + LED_MODE_OFF = 0, + LED_MODE_GREEN, + LED_MODE_GREEN_BLINK, + LED_MODE_AMBER, + LED_MODE_AMBER_BLINK, + LED_MODE_RED, + LED_MODE_RED_BLINK, + LED_MODE_BLUE, + LED_MODE_BLUE_BLINK, + LED_MODE_AUTO, + LED_MODE_UNKNOWN +}; + +struct led_type_mode { + enum led_type type; + int type_mask; + enum led_light_mode mode; + int mode_mask; +}; + +static struct led_type_mode led_type_mode_data[] = { +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_GREEN, LED_MODE_PSU1_GREEN_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_AMBER, LED_MODE_PSU1_AMBER_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_AUTO, LED_MODE_PSU1_AUTO_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_OFF, LED_MODE_PSU1_OFF_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_GREEN, LED_MODE_PSU2_GREEN_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_AMBER, LED_MODE_PSU2_AMBER_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_AUTO, LED_MODE_PSU2_AUTO_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_OFF, LED_MODE_PSU2_OFF_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_GREEN, LED_MODE_FAN_GREEN_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_AMBER, LED_MODE_FAN_AMBER_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_AUTO, LED_MODE_FAN_AUTO_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_OFF, LED_MODE_FAN_OFF_MASK}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 0}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 2}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 2}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 2}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 4}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 6}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 6}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 6}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 0}, +{LED_TYPE_DIAG, LED_TYPE_DIAG_REG_MASK, LED_MODE_GREEN, LED_MODE_DIAG_GREEN_MASK}, +{LED_TYPE_DIAG, LED_TYPE_DIAG_REG_MASK, LED_MODE_AMBER, LED_MODE_DIAG_AMBER_MASK}, +{LED_TYPE_DIAG, LED_TYPE_DIAG_REG_MASK, LED_MODE_OFF, LED_MODE_DIAG_OFF_MASK}, +{LED_TYPE_LOC, LED_TYPE_LOC_REG_MASK, LED_MODE_AMBER, LED_MODE_LOC_ON_MASK}, +{LED_TYPE_LOC, LED_TYPE_LOC_REG_MASK, LED_MODE_OFF, LED_MODE_LOC_OFF_MASK}, +{LED_TYPE_LOC, LED_TYPE_LOC_REG_MASK, LED_MODE_AMBER_BLINK, LED_MODE_LOC_BLINK_MASK} +}; + + +struct fanx_info_s { + u8 cname; /* device name */ + enum led_type type; + u8 reg_id; /* map to led_reg & reg_val */ +}; + +static struct fanx_info_s fanx_info[] = { + {'1', LED_TYPE_FAN1, 2}, + {'2', LED_TYPE_FAN2, 2}, + {'3', LED_TYPE_FAN3, 2}, + {'4', LED_TYPE_FAN4, 2}, + {'5', LED_TYPE_FAN5, 3} +}; + +static int led_reg_val_to_light_mode(enum led_type type, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + + if (type != led_type_mode_data[i].type) + continue; + + if ((led_type_mode_data[i].type_mask & reg_val) == + led_type_mode_data[i].mode_mask) + { + return led_type_mode_data[i].mode; + } + } + + return LED_MODE_UNKNOWN; +} + +static u8 led_light_mode_to_reg_val(enum led_type type, + enum led_light_mode mode, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + if (type != led_type_mode_data[i].type) + continue; + + if (mode != led_type_mode_data[i].mode) + continue; + + reg_val = led_type_mode_data[i].mode_mask | + (reg_val & (~led_type_mode_data[i].type_mask)); + } + + return reg_val; +} + +static int accton_as5812_54t_led_read_value(u8 reg) +{ + return accton_i2c_cpld_read(0x60, reg); +} + +static int accton_as5812_54t_led_write_value(u8 reg, u8 value) +{ + return accton_i2c_cpld_write(0x60, reg, value); +} + +static void accton_as5812_54t_led_update(void) +{ + mutex_lock(&ledctl->update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting accton_as5812_54t_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = accton_as5812_54t_led_read_value(led_reg[i]); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg[i], status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as5812_54t_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + u8 reg, enum led_type type) +{ + int reg_val; + + mutex_lock(&ledctl->update_lock); + + reg_val = accton_as5812_54t_led_read_value(reg); + + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + accton_as5812_54t_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as5812_54t_led_psu_1_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as5812_54t_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU1); +} + +static enum led_brightness accton_as5812_54t_led_psu_1_get(struct led_classdev *cdev) +{ + accton_as5812_54t_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU1, ledctl->reg_val[1]); +} + +static void accton_as5812_54t_led_psu_2_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as5812_54t_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU2); +} + +static enum led_brightness accton_as5812_54t_led_psu_2_get(struct led_classdev *cdev) +{ + accton_as5812_54t_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[1]); +} + +static void accton_as5812_54t_led_fan_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as5812_54t_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_FAN); +} + +static enum led_brightness accton_as5812_54t_led_fan_get(struct led_classdev *cdev) +{ + accton_as5812_54t_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[0]); +} + + +static void accton_as5812_54t_led_fanx_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + enum led_type led_type1; + int reg_id; + int i, nsize; + int ncount = sizeof(fanx_info)/sizeof(struct fanx_info_s); + + for(i=0;iname); + + if (led_cdev->name[nsize-1] == fanx_info[i].cname) + { + led_type1 = fanx_info[i].type; + reg_id = fanx_info[i].reg_id; + accton_as5812_54t_led_set(led_cdev, led_light_mode, led_reg[reg_id], led_type1); + return; + } + } +} + + +static enum led_brightness accton_as5812_54t_led_fanx_get(struct led_classdev *cdev) +{ + enum led_type led_type1; + int reg_id; + int i, nsize; + int ncount = sizeof(fanx_info)/sizeof(struct fanx_info_s); + + for(i=0;iname); + + if (cdev->name[nsize-1] == fanx_info[i].cname) + { + led_type1 = fanx_info[i].type; + reg_id = fanx_info[i].reg_id; + accton_as5812_54t_led_update(); + return led_reg_val_to_light_mode(led_type1, ledctl->reg_val[reg_id]); + } + } + + + return led_reg_val_to_light_mode(LED_TYPE_FAN1, ledctl->reg_val[2]); +} + + +static void accton_as5812_54t_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as5812_54t_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_DIAG); +} + +static enum led_brightness accton_as5812_54t_led_diag_get(struct led_classdev *cdev) +{ + accton_as5812_54t_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void accton_as5812_54t_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as5812_54t_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_LOC); +} + +static enum led_brightness accton_as5812_54t_led_loc_get(struct led_classdev *cdev) +{ + accton_as5812_54t_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static struct led_classdev accton_as5812_54t_leds[] = { + [LED_TYPE_PSU1] = { + .name = "accton_as5812_54t_led::psu1", + .default_trigger = "unused", + .brightness_set = accton_as5812_54t_led_psu_1_set, + .brightness_get = accton_as5812_54t_led_psu_1_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "accton_as5812_54t_led::psu2", + .default_trigger = "unused", + .brightness_set = accton_as5812_54t_led_psu_2_set, + .brightness_get = accton_as5812_54t_led_psu_2_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN] = { + .name = "accton_as5812_54t_led::fan", + .default_trigger = "unused", + .brightness_set = accton_as5812_54t_led_fan_set, + .brightness_get = accton_as5812_54t_led_fan_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN1] = { + .name = "accton_as5812_54t_led::fan1", + .default_trigger = "unused", + .brightness_set = accton_as5812_54t_led_fanx_set, + .brightness_get = accton_as5812_54t_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN2] = { + .name = "accton_as5812_54t_led::fan2", + .default_trigger = "unused", + .brightness_set = accton_as5812_54t_led_fanx_set, + .brightness_get = accton_as5812_54t_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN3] = { + .name = "accton_as5812_54t_led::fan3", + .default_trigger = "unused", + .brightness_set = accton_as5812_54t_led_fanx_set, + .brightness_get = accton_as5812_54t_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN4] = { + .name = "accton_as5812_54t_led::fan4", + .default_trigger = "unused", + .brightness_set = accton_as5812_54t_led_fanx_set, + .brightness_get = accton_as5812_54t_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN5] = { + .name = "accton_as5812_54t_led::fan5", + .default_trigger = "unused", + .brightness_set = accton_as5812_54t_led_fanx_set, + .brightness_get = accton_as5812_54t_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_DIAG] = { + .name = "accton_as5812_54t_led::diag", + .default_trigger = "unused", + .brightness_set = accton_as5812_54t_led_diag_set, + .brightness_get = accton_as5812_54t_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_LOC] = { + .name = "accton_as5812_54t_led::loc", + .default_trigger = "unused", + .brightness_set = accton_as5812_54t_led_loc_set, + .brightness_get = accton_as5812_54t_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +}; + +static int accton_as5812_54t_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as5812_54t_leds); i++) { + led_classdev_suspend(&accton_as5812_54t_leds[i]); + } + + return 0; +} + +static int accton_as5812_54t_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as5812_54t_leds); i++) { + led_classdev_resume(&accton_as5812_54t_leds[i]); + } + + return 0; +} + +static int accton_as5812_54t_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(accton_as5812_54t_leds); i++) { + ret = led_classdev_register(&pdev->dev, &accton_as5812_54t_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(accton_as5812_54t_leds)){ + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&accton_as5812_54t_leds[i]); + } + } + + return ret; +} + +static int accton_as5812_54t_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(accton_as5812_54t_leds); i++) { + led_classdev_unregister(&accton_as5812_54t_leds[i]); + } + + return 0; +} + +static struct platform_driver accton_as5812_54t_led_driver = { + .probe = accton_as5812_54t_led_probe, + .remove = accton_as5812_54t_led_remove, + .suspend = accton_as5812_54t_led_suspend, + .resume = accton_as5812_54t_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as5812_54t_led_init(void) +{ + int ret; + + extern int platform_accton_as5812_54t(void); + if (!platform_accton_as5812_54t()) { + return -ENODEV; + } + + ret = platform_driver_register(&accton_as5812_54t_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct accton_as5812_54t_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as5812_54t_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&accton_as5812_54t_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as5812_54t_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&accton_as5812_54t_led_driver); + kfree(ledctl); +} + +module_init(accton_as5812_54t_led_init); +module_exit(accton_as5812_54t_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as5812_54t_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-psu.c b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-psu.c new file mode 100644 index 000000000000..a77014e877ca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-psu.c @@ -0,0 +1,372 @@ +/* + * An hwmon driver for accton as5812_54t Power Module + * + * Copyright (C) 2015 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define PSU_STATUS_I2C_ADDR 0x60 +#define PSU_STATUS_I2C_REG_OFFSET 0x2 + +#define IS_POWER_GOOD(id, value) (!!(value & BIT(id*4 + 1))) +#define IS_PRESENT(id, value) (!(value & BIT(id*4))) + +static ssize_t show_index(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static int as5812_54t_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +static int as5812_54t_psu_model_name_get(struct device *dev); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as5812_54t_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[14]; /* Model name, read from eeprom */ +}; + +static struct as5812_54t_psu_data *as5812_54t_psu_update_device(struct device *dev); + +enum as5812_54t_psu_sysfs_attributes { + PSU_INDEX, + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_index, S_IRUGO, show_index, NULL, PSU_INDEX); +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); + +static struct attribute *as5812_54t_psu_attributes[] = { + &sensor_dev_attr_psu_index.dev_attr.attr, + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static ssize_t show_index(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5812_54t_psu_data *data = i2c_get_clientdata(client); + + return sprintf(buf, "%d\n", data->index); +} + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as5812_54t_psu_data *data = as5812_54t_psu_update_device(dev); + u8 status = 0; + + if (!data->valid) { + return sprintf(buf, "0\n"); + } + + if (attr->index == PSU_PRESENT) { + status = IS_PRESENT(data->index, data->status); + } + else { /* PSU_POWER_GOOD */ + status = IS_POWER_GOOD(data->index, data->status); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as5812_54t_psu_data *data = as5812_54t_psu_update_device(dev); + + if (!data->valid) { + return 0; + } + + if (!IS_PRESENT(data->index, data->status)) { + return 0; + } + + if (as5812_54t_psu_model_name_get(dev) < 0) { + return -ENXIO; + } + + return sprintf(buf, "%s\n", data->model_name); +} + +static const struct attribute_group as5812_54t_psu_group = { + .attrs = as5812_54t_psu_attributes, +}; + +static int as5812_54t_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as5812_54t_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as5812_54t_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as5812_54t_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as5812_54t_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as5812_54t_psu_remove(struct i2c_client *client) +{ + struct as5812_54t_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as5812_54t_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as5812_54t_psu1, + as5812_54t_psu2 +}; + +static const struct i2c_device_id as5812_54t_psu_id[] = { + { "as5812_54t_psu1", as5812_54t_psu1 }, + { "as5812_54t_psu2", as5812_54t_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as5812_54t_psu_id); + +static struct i2c_driver as5812_54t_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as5812_54t_psu", + }, + .probe = as5812_54t_psu_probe, + .remove = as5812_54t_psu_remove, + .id_table = as5812_54t_psu_id, + .address_list = normal_i2c, +}; + +static int as5812_54t_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; + +abort: + return result; +} + +enum psu_type { + PSU_YM_2401_JCR, /* AC110V - F2B */ + PSU_YM_2401_JDR, /* AC110V - B2F */ + PSU_CPR_4011_4M11, /* AC110V - F2B */ + PSU_CPR_4011_4M21, /* AC110V - B2F */ + PSU_CPR_6011_2M11, /* AC110V - F2B */ + PSU_CPR_6011_2M21, /* AC110V - B2F */ + PSU_UM400D_01G, /* DC48V - F2B */ + PSU_UM400D01_01G /* DC48V - B2F */ +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + char* model_name; +}; + +struct model_name_info models[] = { +{PSU_YM_2401_JCR, 0x20, 11, "YM-2401JCR"}, +{PSU_YM_2401_JDR, 0x20, 11, "YM-2401JDR"}, +{PSU_CPR_4011_4M11, 0x26, 13, "CPR-4011-4M11"}, +{PSU_CPR_4011_4M21, 0x26, 13, "CPR-4011-4M21"}, +{PSU_CPR_6011_2M11, 0x26, 13, "CPR-6011-2M11"}, +{PSU_CPR_6011_2M21, 0x26, 13, "CPR-6011-2M21"}, +{PSU_UM400D_01G, 0x50, 9, "um400d01G"}, +{PSU_UM400D01_01G, 0x50, 12, "um400d01-01G"}, +}; + +static int as5812_54t_psu_model_name_get(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5812_54t_psu_data *data = i2c_get_clientdata(client); + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->model_name, 0, sizeof(data->model_name)); + + status = as5812_54t_psu_read_block(client, models[i].offset, + data->model_name, models[i].length); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data->model_name[models[i].length] = '\0'; + } + + if (i == PSU_YM_2401_JCR || i == PSU_YM_2401_JDR) { + /* Skip the meaningless data byte 8*/ + data->model_name[8] = data->model_name[9]; + data->model_name[9] = data->model_name[10]; + data->model_name[10] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, models[i].length) == 0) { + return 0; + } + else { + data->model_name[0] = '\0'; + } + } + + return -ENODATA; +} + +static struct as5812_54t_psu_data *as5812_54t_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5812_54t_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status = -1; + + dev_dbg(&client->dev, "Starting as5812_54t update\n"); + data->valid = 0; + + /* Read psu status */ + status = accton_i2c_cpld_read(PSU_STATUS_I2C_ADDR, PSU_STATUS_I2C_REG_OFFSET); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg (0x%x) err %d\n", PSU_STATUS_I2C_ADDR, status); + goto exit; + } + else { + data->status = status; + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init as5812_54t_psu_init(void) +{ + extern int platform_accton_as5812_54t(void); + if (!platform_accton_as5812_54t()) { + return -ENODEV; + } + + return i2c_add_driver(&as5812_54t_psu_driver); +} + +static void __exit as5812_54t_psu_exit(void) +{ + i2c_del_driver(&as5812_54t_psu_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as5812_54t_psu driver"); +MODULE_LICENSE("GPL"); + +module_init(as5812_54t_psu_init); +module_exit(as5812_54t_psu_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-sfp.c b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-sfp.c new file mode 100644 index 000000000000..88bf552de0f0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/x86-64-accton-as5812-54t-sfp.c @@ -0,0 +1,318 @@ +/* + * An hwmon driver for accton as5812_54t sfp + * + * Copyright (C) 2015 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define QSFP_PORT_START_INDEX 49 +#define BIT_INDEX(i) (1ULL << (i)) + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as5812_54t_sfp_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + int port; /* Front port index */ + char eeprom[256]; /* eeprom data */ + u8 status; /* bit0:port49, bit1:port50 and so on */ +}; + +static struct as5812_54t_sfp_data *as5812_54t_sfp_update_device(struct device *dev, int update_eeprom); +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_eeprom(struct device *dev, struct device_attribute *da, char *buf); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +enum as5812_54t_sfp_sysfs_attributes { + SFP_IS_PRESENT, + SFP_PORT_NUMBER, + SFP_EEPROM, + SFP_IS_PRESENT_ALL, +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_status, NULL, SFP_IS_PRESENT); +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, SFP_PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_eeprom, S_IRUGO, show_eeprom, NULL, SFP_EEPROM); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_status,NULL, SFP_IS_PRESENT_ALL); + +static struct attribute *as5812_54t_sfp_attributes[] = { + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_eeprom.dev_attr.attr, + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + NULL +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5812_54t_sfp_data *data = i2c_get_clientdata(client); + + return sprintf(buf, "%d\n",data->port); +} + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as5812_54t_sfp_data *data = as5812_54t_sfp_update_device(dev, 0); + + if (attr->index == SFP_IS_PRESENT) { + u8 val; + + val = (data->status & BIT_INDEX(data->port - QSFP_PORT_START_INDEX)) ? 0 : 1; + return sprintf(buf, "%d", val); + } + else { /* SFP_IS_PRESENT_ALL */ + return sprintf(buf, "%.2x\n", ~data->status); + } +} + +static ssize_t show_eeprom(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as5812_54t_sfp_data *data = as5812_54t_sfp_update_device(dev, 1); + + if (!data->valid) { + return 0; + } + + if ((data->status & BIT_INDEX(data->port - QSFP_PORT_START_INDEX)) != 0) { + return 0; + } + + memcpy(buf, data->eeprom, sizeof(data->eeprom)); + + return sizeof(data->eeprom); +} + +static const struct attribute_group as5812_54t_sfp_group = { + .attrs = as5812_54t_sfp_attributes, +}; + +static int as5812_54t_sfp_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as5812_54t_sfp_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as5812_54t_sfp_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + i2c_set_clientdata(client, data); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as5812_54t_sfp_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sfp '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as5812_54t_sfp_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as5812_54t_sfp_remove(struct i2c_client *client) +{ + struct as5812_54t_sfp_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as5812_54t_sfp_group); + kfree(data); + + return 0; +} + +enum port_numbers { +as5812_54t_qsfp49 = 49, +as5812_54t_qsfp50, +as5812_54t_qsfp51, +as5812_54t_qsfp52, +as5812_54t_qsfp53, +as5812_54t_qsfp54 +}; + +static const struct i2c_device_id as5812_54t_sfp_id[] = { +{ "as5812_54t_qsfp49", as5812_54t_qsfp49 }, { "as5812_54t_qsfp50", as5812_54t_qsfp50 }, +{ "as5812_54t_qsfp51", as5812_54t_qsfp51 }, { "as5812_54t_qsfp52", as5812_54t_qsfp52 }, +{ "as5812_54t_qsfp53", as5812_54t_qsfp53 }, { "as5812_54t_qsfp54", as5812_54t_qsfp54 }, +{} +}; +MODULE_DEVICE_TABLE(i2c, as5812_54t_sfp_id); + +static struct i2c_driver as5812_54t_sfp_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as5812_54t_sfp", + }, + .probe = as5812_54t_sfp_probe, + .remove = as5812_54t_sfp_remove, + .id_table = as5812_54t_sfp_id, + .address_list = normal_i2c, +}; + +static int as5812_54t_sfp_read_byte(struct i2c_client *client, u8 command, u8 *data) +{ + int result = i2c_smbus_read_byte_data(client, command); + + if (unlikely(result < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, result); + goto abort; + } + + *data = (u8)result; + result = 0; + +abort: + return result; +} + +static struct as5812_54t_sfp_data *as5812_54t_sfp_update_device(struct device *dev, int update_eeprom) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as5812_54t_sfp_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid || update_eeprom) { + int status = -1; + int i = 0; + + data->valid = 0; + //dev_dbg(&client->dev, "Starting as5812_54t sfp status update\n"); + data->status = 0xFF; + + /* + * Bring QSFPs out of reset, + * This is a temporary fix until the QSFP+_MOD_RST register + * can be exposed through the driver. + */ + accton_i2c_cpld_write(0x60, 0x23, 0x3F); + + /* Read present status of port 49-54(QSFP port) */ + status = accton_i2c_cpld_read(0x60, 0x22); + + if (status < 0) { + dev_dbg(&client->dev, "cpld(0x60) reg(0x22) err %d\n", status); + } + else { + data->status = status & 0x3F; /* (u32)status */ + } + + if (update_eeprom) { + /* Read eeprom data based on port number */ + memset(data->eeprom, 0, sizeof(data->eeprom)); + + /* Check if the port is present */ + if ((data->status & BIT_INDEX(data->port - QSFP_PORT_START_INDEX)) == 0) { + /* read eeprom */ + for (i = 0; i < sizeof(data->eeprom); i++) { + status = as5812_54t_sfp_read_byte(client, i, data->eeprom + i); + + if (status < 0) { + dev_dbg(&client->dev, "unable to read eeprom from port(%d)\n", + data->port); + goto exit; + } + } + } + } + + data->valid = 1; + data->last_updated = jiffies; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init as5812_54t_sfp_init(void) +{ + extern int platform_accton_as5812_54t(void); + if (!platform_accton_as5812_54t()) { + return -ENODEV; + } + + return i2c_add_driver(&as5812_54t_sfp_driver); +} + +static void __exit as5812_54t_sfp_exit(void) +{ + i2c_del_driver(&as5812_54t_sfp_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as5812_54t_sfp driver"); +MODULE_LICENSE("GPL"); + +module_init(as5812_54t_sfp_init); +module_exit(as5812_54t_sfp_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/ym2651y.c new file mode 100644 index 000000000000..7101aa411f72 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/modules/ym2651y.c @@ -0,0 +1,680 @@ +/* + * An hwmon driver for the 3Y Power YM-2651Y Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +enum chips { + YM2651, + YM2401, +}; + +/* Each client has this additional data + */ +struct ym2651y_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 chip; /* chip id */ + u8 capability; /* Register value */ + u16 status_word; /* Register value */ + u8 fan_fault; /* Register value */ + u8 over_temp; /* Register value */ + u16 v_out; /* Register value */ + u16 i_out; /* Register value */ + u16 p_out; /* Register value */ + u8 vout_mode; /* Register value */ + u16 temp; /* Register value */ + u16 fan_speed; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u8 fan_dir[5]; /* Register value */ + u8 pmbus_revision; /* Register value */ + u8 mfr_id[10]; /* Register value */ + u8 mfr_model[16]; /* Register value */ + u8 mfr_revsion[3]; /* Register value */ + u16 mfr_vin_min; /* Register value */ + u16 mfr_vin_max; /* Register value */ + u16 mfr_iin_max; /* Register value */ + u16 mfr_iout_max; /* Register value */ + u16 mfr_pin_max; /* Register value */ + u16 mfr_pout_max; /* Register value */ + u16 mfr_vout_min; /* Register value */ + u16 mfr_vout_max; /* Register value */ +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_vout(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf); +static struct ym2651y_data *ym2651y_update_device(struct device *dev); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value); + +enum ym2651y_sysfs_attributes { + PSU_POWER_ON = 0, + PSU_TEMP_FAULT, + PSU_POWER_GOOD, + PSU_FAN1_FAULT, + PSU_FAN_DIRECTION, + PSU_OVER_TEMP, + PSU_V_OUT, + PSU_I_OUT, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_SPEED, + PSU_FAN1_DUTY_CYCLE, + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_REVISION, + PSU_MFR_VIN_MIN, + PSU_MFR_VIN_MAX, + PSU_MFR_VOUT_MIN, + PSU_MFR_VOUT_MAX, + PSU_MFR_IIN_MAX, + PSU_MFR_IOUT_MAX, + PSU_MFR_PIN_MAX, + PSU_MFR_POUT_MAX +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_power_on, S_IRUGO, show_word, NULL, PSU_POWER_ON); +static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_word, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, show_over_temp, NULL, PSU_OVER_TEMP); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_ascii, NULL, PSU_FAN_DIRECTION); +static SENSOR_DEVICE_ATTR(psu_pmbus_revision,S_IRUGO, show_byte, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, show_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IRUGO, show_ascii, NULL, PSU_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_min, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_max, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_min, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_max, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iin_max, S_IRUGO, show_linear, NULL, PSU_MFR_IIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX); + +static struct attribute *ym2651y_attributes[] = { + &sensor_dev_attr_psu_power_on.dev_attr.attr, + &sensor_dev_attr_psu_temp_fault.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_over_temp.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr, + NULL +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + if (!data->valid) { + return 0; + } + + return (attr->index == PSU_PMBUS_REVISION) ? sprintf(buf, "%d\n", data->pmbus_revision) : + sprintf(buf, "0\n"); +} + +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u16 status = 0; + + if (!data->valid) { + return 0; + } + + switch (attr->index) { + case PSU_POWER_ON: /* psu_power_on, low byte bit 6 of status_word, 0=>ON, 1=>OFF */ + status = (data->status_word & 0x40) ? 0 : 1; + break; + case PSU_TEMP_FAULT: /* psu_temp_fault, low byte bit 2 of status_word, 0=>Normal, 1=>temp fault */ + status = (data->status_word & 0x4) >> 2; + break; + case PSU_POWER_GOOD: /* psu_power_good, high byte bit 3 of status_word, 0=>OK, 1=>FAIL */ + status = (data->status_word & 0x800) ? 0 : 1; + break; + } + + return sprintf(buf, "%d\n", status); +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + ym2651y_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + if (!data->valid) { + return 0; + } + + switch (attr->index) { + case PSU_V_OUT: + value = data->v_out; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp; + break; + case PSU_FAN1_SPEED: + value = data->fan_speed; + multiplier = 1; + break; + case PSU_FAN1_DUTY_CYCLE: + value = data->fan_duty_cycle[0]; + multiplier = 1; + break; + case PSU_MFR_VIN_MIN: + value = data->mfr_vin_min; + break; + case PSU_MFR_VIN_MAX: + value = data->mfr_vin_max; + break; + case PSU_MFR_VOUT_MIN: + value = data->mfr_vout_min; + break; + case PSU_MFR_VOUT_MAX: + value = data->mfr_vout_max; + break; + case PSU_MFR_PIN_MAX: + value = data->mfr_pin_max; + break; + case PSU_MFR_POUT_MAX: + value = data->mfr_pout_max; + break; + case PSU_MFR_IOUT_MAX: + value = data->mfr_iout_max; + break; + case PSU_MFR_IIN_MAX: + value = data->mfr_iin_max; + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u8 shift; + + if (!data->valid) { + return 0; + } + + shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct ym2651y_data *data = ym2651y_update_device(dev); + + if (!data->valid) { + return 0; + } + + return sprintf(buf, "%d\n", data->over_temp >> 7); +} + +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u8 *ptr = NULL; + + if (!data->valid) { + return 0; + } + + switch (attr->index) { + case PSU_FAN_DIRECTION: /* psu_fan_dir */ + ptr = data->fan_dir + 1; /* Skip the first byte since it is the length of string. */ + break; + case PSU_MFR_ID: /* psu_mfr_id */ + ptr = data->mfr_id + 1; /* The first byte is the count byte of string. */; + break; + case PSU_MFR_MODEL: /* psu_mfr_model */ + ptr = data->mfr_model + 1; /* The first byte is the count byte of string. */ + break; + case PSU_MFR_REVISION: /* psu_mfr_revision */ + ptr = data->mfr_revsion + 1; /* The first byte is the count byte of string. */ + break; + default: + return 0; + } + + return sprintf(buf, "%s\n", ptr); +} + +static ssize_t show_vout_by_mode(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct ym2651y_data *data = ym2651y_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + if (!data->valid) { + return 0; + } + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->v_out; + + return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_vout(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + + if (data->chip == YM2401) { + return show_vout_by_mode(dev, da, buf); + } + + return show_linear(dev, da, buf); +} + +static const struct attribute_group ym2651y_group = { + .attrs = ym2651y_attributes, +}; + +static int ym2651y_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct ym2651y_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct ym2651y_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->chip = dev_id->driver_data; + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &ym2651y_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int ym2651y_remove(struct i2c_client *client) +{ + struct ym2651y_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id ym2651y_id[] = { + { "ym2651", YM2651 }, + { "ym2401", YM2401 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, ym2651y_id); + +static struct i2c_driver ym2651y_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "ym2651", + }, + .probe = ym2651y_probe, + .remove = ym2651y_remove, + .id_table = ym2651y_id, + .address_list = normal_i2c, +}; + +static int ym2651y_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int ym2651y_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +static int ym2651y_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; + +abort: + return result; +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct ym2651y_data *ym2651y_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int i, status, length; + u8 command, buf; + struct reg_data_byte regs_byte[] = { {0x19, &data->capability}, + {0x20, &data->vout_mode}, + {0x7d, &data->over_temp}, + {0x81, &data->fan_fault}, + {0x98, &data->pmbus_revision}}; + struct reg_data_word regs_word[] = { {0x79, &data->status_word}, + {0x8b, &data->v_out}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x8d, &data->temp}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x3c, &(data->fan_duty_cycle[1])}, + {0x90, &data->fan_speed}, + {0xa0, &data->mfr_vin_min}, + {0xa1, &data->mfr_vin_max}, + {0xa2, &data->mfr_iin_max}, + {0xa3, &data->mfr_pin_max}, + {0xa4, &data->mfr_vout_min}, + {0xa5, &data->mfr_vout_max}, + {0xa6, &data->mfr_iout_max}, + {0xa7, &data->mfr_pout_max}}; + + dev_dbg(&client->dev, "Starting ym2651 update\n"); + data->valid = 0; + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = ym2651y_read_byte(client, regs_byte[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + goto exit; + } + else { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = ym2651y_read_word(client, regs_word[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + goto exit; + } + else { + *(regs_word[i].value) = status; + } + } + + /* Read fan_direction */ + command = 0xC3; + status = ym2651y_read_block(client, command, data->fan_dir, + ARRAY_SIZE(data->fan_dir)-1); + data->fan_dir[ARRAY_SIZE(data->fan_dir)-1] = '\0'; + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + /* Read mfr_id */ + command = 0x99; + status = ym2651y_read_block(client, command, data->mfr_id, + ARRAY_SIZE(data->mfr_id)-1); + data->mfr_id[ARRAY_SIZE(data->mfr_id)-1] = '\0'; + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + /* Read mfr_model */ + command = 0x9a; + length = 1; + + /* Read first byte to determine the length of data */ + status = ym2651y_read_block(client, command, &buf, length); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + status = ym2651y_read_block(client, command, data->mfr_model, buf+1); + data->mfr_model[buf+1] = '\0'; + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + /* Read mfr_revsion */ + command = 0x9b; + status = ym2651y_read_block(client, command, data->mfr_revsion, + ARRAY_SIZE(data->mfr_revsion)-1); + data->mfr_revsion[ARRAY_SIZE(data->mfr_revsion)-1] = '\0'; + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init ym2651y_init(void) +{ + return i2c_add_driver(&ym2651y_driver); +} + +static void __exit ym2651y_exit(void) +{ + i2c_del_driver(&ym2651y_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("3Y Power YM-2651Y driver"); +MODULE_LICENSE("GPL"); + +module_init(ym2651y_init); +module_exit(ym2651y_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/service/as5812-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/service/as5812-platform-init.service new file mode 100755 index 000000000000..30c1703dc40f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/service/as5812-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Accton AS5712-54T Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/accton_as5812_54t_util.py install +ExecStop=/usr/local/bin/accton_as5812_54t_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/README b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/README new file mode 100755 index 000000000000..2284eb091fcb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/README @@ -0,0 +1,60 @@ +Copyright (C) 2016 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +To initialize the system, run "accton_as5812_54t_util.py install". +To clean up the drivers & devices, run "accton_as5812_54t_util.py clean". +To dump information of sensors, run "accton_as5812_54t_util.py show". +To dump SFP EEPROM, run "accton_as5812_54t_util.py sff". +To set fan speed, run "accton_as5812_54t_util.py set fan". +To enable/disable SFP emission, run "accton_as5812_54t_util.py set sfp". +To set system LEDs' color, run "accton_as5812_54t_util.py set led" +For more information, run "accton_as5812_54t_util.py --help". + +==================================================================== +Besides applying accton_as5812_54t_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +LED controls can be found under /sys/class/leds. The sysfs interface +color mappings are as follows: +Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + +There are 5 system LEDs, loc, diag, fan, ps1, and ps2. +They are lit automatically by CPLD, but the loc and diag. +The loc led has only 1 color, blue. +The diag one has 3 colors: red, amber, and green. + +Fan controls can be found in /sys/bus/i2c/devices/2-0066. +There are 12 fans inside 6 fan modules. +All fans share 1 duty setting, ranged from 0~100. + +Three temperature sensors are controlled by the lm75 kernel modules. +They should already be visible under /sys/bus/i2c/drivers/lm75/. + +Two power supplies are controlled by the CPLD. +Here provide their status under +/sys/bus/i2c/devices/10-0050 and /sys/bus/i2c/devices/11-0053. + +There are 32 QSFP+ modules are equipped. +Apply "accton_as5812_54t_util.py show" to get their status. +Apply "accton_as5812_54t_util.py set sfp" to turn on/off light transmission. +Apply "accton_as5812_54t_util.py sff" to dump EEPROM information. +Before operating on that QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_54t_util.py b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_54t_util.py new file mode 100755 index 000000000000..4e9b0795081d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_54t_util.py @@ -0,0 +1,565 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'as5812_54t' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan':5,'thermal':3, 'psu':2, 'sfp':6} +FORCE = 0 +logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +logging.basicConfig(level=logging.INFO) + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-6 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + self.insmod("accton_i2c_cpld") + self.insmod("cpr_4011_4mxx") + self.insmod("ym2651y") + for m in [ "sfp", "psu", "fan", "leds" ]: + self.insmod("x86-64-accton-as5812-54t-%s" % m) + +kos = [ +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x force_deselect_on_exit=1', +'modprobe accton_i2c_cpld' , +'modprobe cpr_4011_4mxx' , +'modprobe ym2651y' , +'modprobe x86-64-accton-as5812-54t-sfp' , +'modprobe x86-64-accton-as5812-54t-psu' , +'modprobe x86-64-accton-as5812-54t-fan' , +'modprobe x86-64-accton-as5812-54t-leds' ] + +def driver_install(): + global FORCE + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +led_prefix ='/sys/class/leds/accton_'+PROJECT_NAME+'_led::' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2']} +hwmon_nodes = {'led': ['brightness'] } +hwmon_prefix ={'led': led_prefix} + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'fan': ['2-0066'] , + 'thermal': ['15-0048','16-0049', '17-004a'] , + 'psu': ['11-0050','12-0053'], + 'sfp': ['-0050']} +i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'] , + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['sfp_is_present ', 'sfp_tx_disable_all']} + +sfp_map = [4,6,3,5,7,2] + +sfp_1st_index = 48 + +mknod =[ +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device' , +'echo accton_i2c_cpld 0x60 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-15/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-16/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-17/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo as5812_54t_psu1 0x38 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo cpr_4011_4mxx 0x3c > /sys/bus/i2c/devices/i2c-11/new_device', +'echo as5812_54t_psu1 0x50 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo ym2401 0x58 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo as5812_54t_psu2 0x3b > /sys/bus/i2c/devices/i2c-12/new_device', +'echo cpr_4011_4mxx 0x3f > /sys/bus/i2c/devices/i2c-12/new_device', +'echo as5812_54t_psu2 0x53 > /sys/bus/i2c/devices/i2c-12/new_device', +'echo ym2401 0x5b > /sys/bus/i2c/devices/i2c-12/new_device'] + +mknod2 =[ +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device' , +'echo accton_i2c_cpld 0x60 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-15/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-16/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-17/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo as5812_54t_psu1 0x38 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo cpr_4011_4mxx 0x3c > /sys/bus/i2c/devices/i2c-11/new_device', +'echo as5812_54t_psu1 0x50 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo ym2401 0x58 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo as5812_54t_psu2 0x3b > /sys/bus/i2c/devices/i2c-12/new_device', +'echo cpr_4011_4mxx 0x3f > /sys/bus/i2c/devices/i2c-12/new_device', +'echo as5812_54t_psu2 0x53 > /sys/bus/i2c/devices/i2c-12/new_device', +'echo ym2401 0x5b > /sys/bus/i2c/devices/i2c-12/new_device'] + + + +def i2c_order_check(): + # i2c bus 0 and 1 might be installed in different order. + # Here check if 0x71 is exist @ i2c-0 + tmp = "echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-0/new_device" + status, output = log_os_system(tmp, 0) + if not device_exist(): + order = 1 + else: + order = 0 + tmp = "echo 0x71 > /sys/bus/i2c/devices/i2c-0/delete_device" + status, output = log_os_system(tmp, 0) + return order + +def device_install(): + global FORCE + + order = i2c_order_check() + + # if 0x71 is not exist @i2c-0, use reversed bus order + if order: + for i in range(0,len(mknod2)): + #for pca954x need times to built new i2c buses + if mknod2[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod2[i], 1) + if status: + print output + if FORCE == 0: + return status + else: + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + for i in range(sfp_1st_index,len(sfp_map)): + status, output =log_os_system("echo sfp"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/1-0071", 0) + if status==0: + I2C_ORDER=1 + else: + I2C_ORDER=0 + + for i in range(sfp_1st_index,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + if I2C_ORDER==0: + nodelist = mknod + else: + nodelist = mknod2 + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(sfp_1st_index,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'sfp_eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan'] ['fan1'][0] + node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0071", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/fanutil.py new file mode 100755 index 000000000000..207436c1fc96 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/fanutil.py @@ -0,0 +1,255 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# 2/27/2018: Roy Lee modify for as7312_54x +# ------------------------------------------------------------------ + +try: + import time + import logging + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class FanUtil(object): + """Platform-specific FanUtil class""" + + FAN_NUM_ON_MAIN_BROAD = 6 + FAN_NUM_1_IDX = 1 + FAN_NUM_2_IDX = 2 + FAN_NUM_3_IDX = 3 + FAN_NUM_4_IDX = 4 + FAN_NUM_5_IDX = 5 + FAN_NUM_6_IDX = 6 + + FAN_NODE_NUM_OF_MAP = 2 + FAN_NODE_FAULT_IDX_OF_MAP = 1 + #FAN_NODE_SPEED_IDX_OF_MAP = 2 + FAN_NODE_DIR_IDX_OF_MAP = 2 + #FAN_NODE_DUTY_IDX_OF_MAP = 4 + #FANR_NODE_FAULT_IDX_OF_MAP = 5 + + #BASE_VAL_PATH = '/sys/devices/platform/as5712_54x_fan/{0}' + BASE_VAL_PATH = '/sys/bus/i2c/devices/2-0066/{0}' + FAN_DUTY_PATH = '/sys/bus/i2c/devices/2-0066/fan_duty_cycle_percentage' + + #logfile = '' + #loglevel = logging.INFO + + """ Dictionary where + key1 = fan id index (integer) starting from 1 + key2 = fan node index (interger) starting from 1 + value = path to fan device file (string) """ + _fan_to_device_path_mapping = {} + +#fan1_direction +#fan1_fault +#fan1_present + + #(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage', + _fan_to_device_node_mapping = { + (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault', + (FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction', + + (FAN_NUM_2_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan2_fault', + (FAN_NUM_2_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan2_direction', + + (FAN_NUM_3_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan3_fault', + (FAN_NUM_3_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan3_direction', + + (FAN_NUM_4_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan4_fault', + (FAN_NUM_4_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan4_direction', + + (FAN_NUM_5_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan5_fault', + (FAN_NUM_5_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan5_direction', + + (FAN_NUM_6_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan6_fault', + (FAN_NUM_6_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan6_direction', + } + + def _get_fan_to_device_node(self, fan_num, node_num): + return self._fan_to_device_node_mapping[(fan_num, node_num)] + + def _get_fan_node_val(self, fan_num, node_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + + try: + val_file = open(device_path, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + def _set_fan_node_val(self, fan_num, node_num, val): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + content = str(val) + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'w') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + val_file.write(content) + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return True + + def __init__(self): + fan_path = self.BASE_VAL_PATH + + for fan_num in range(self.FAN_NUM_1_IDX, self.FAN_NUM_ON_MAIN_BROAD+1): + for node_num in range(self.FAN_NODE_FAULT_IDX_OF_MAP, self.FAN_NODE_NUM_OF_MAP+1): + self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path.format( + self._fan_to_device_node_mapping[(fan_num, node_num)]) + + def get_num_fans(self): + return self.FAN_NUM_ON_MAIN_BROAD + + def get_idx_fan_start(self): + return self.FAN_NUM_1_IDX + + def get_num_nodes(self): + return self.FAN_NODE_NUM_OF_MAP + + def get_idx_node_start(self): + return self.FAN_NODE_FAULT_IDX_OF_MAP + + def get_size_node_map(self): + return len(self._fan_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._fan_to_device_path_mapping) + + def get_fan_to_device_path(self, fan_num, node_num): + return self._fan_to_device_path_mapping[(fan_num, node_num)] + + def get_fan_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP) + + #def get_fan_speed(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP) + + def get_fan_dir(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP) + + def get_fan_duty_cycle(self): + #duty_path = self.FAN_DUTY_PATH + try: + val_file = open(self.FAN_DUTY_PATH) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + return int(content) + #self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP) +#static u32 reg_val_to_duty_cycle(u8 reg_val) +#{ +# reg_val &= FAN_DUTY_CYCLE_REG_MASK; +# return ((u32)(reg_val+1) * 625 + 75)/ 100; +#} +# + def set_fan_duty_cycle(self, val): + + try: + fan_file = open(self.FAN_DUTY_PATH, 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + #val = ((val + 1 ) * 625 +75 ) / 100 + fan_file.write(str(val)) + fan_file.close() + return True + + #def get_fanr_fault(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP) + + def get_fanr_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP) + + def get_fan_status(self, fan_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num, %d', fan_num) + return None + + if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0: + logging.debug('GET. FAN fault. fan_num, %d', fan_num) + return False + + #if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0: + # logging.debug('GET. FANR fault. fan_num, %d', fan_num) + # return False + + return True + +#def main(): +# fan = FanUtil() +# +# print 'get_size_node_map : %d' % fan.get_size_node_map() +# print 'get_size_path_map : %d' % fan.get_size_path_map() +# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): +# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1): +# print fan.get_fan_to_device_path(x, y) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/thermalutil.py new file mode 100755 index 000000000000..68f0ef900df6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/thermalutil.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018:Jostar modify for as7716_32x +# 2/27/2018: Roy Lee modify for as7312_54x +# ------------------------------------------------------------------ + +try: + import time + import logging + import glob + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class ThermalUtil(object): + """Platform-specific ThermalUtil class""" + + THERMAL_NUM_ON_MAIN_BROAD = 3 + THERMAL_NUM_1_IDX = 1 # 1_ON_MAIN_BROAD + THERMAL_NUM_2_IDX = 2 # 2_ON_MAIN_BROAD + THERMAL_NUM_3_IDX = 3 # 3_ON_MAIN_BROAD + + BASE_VAL_PATH = '/sys/bus/i2c/devices/{0}-00{1}/hwmon/hwmon*/temp1_input' + + """ Dictionary where + key1 = thermal id index (integer) starting from 1 + value = path to fan device file (string) """ + _thermal_to_device_path_mapping = {} + + _thermal_to_device_node_mapping = { + THERMAL_NUM_1_IDX: ['3', '48'], + THERMAL_NUM_2_IDX: ['3', '49'], + THERMAL_NUM_3_IDX: ['3', '4a'], + } + + def __init__(self): + thermal_path = self.BASE_VAL_PATH + + for x in range(self.THERMAL_NUM_1_IDX, self.THERMAL_NUM_ON_MAIN_BROAD+1): + self._thermal_to_device_path_mapping[x] = thermal_path.format( + self._thermal_to_device_node_mapping[x][0], + self._thermal_to_device_node_mapping[x][1]) + + def _get_thermal_node_val(self, thermal_num): + if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. thermal_num, %d', thermal_num) + return None + + device_path = self.get_thermal_to_device_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + + def get_num_thermals(self): + return self.THERMAL_NUM_ON_MAIN_BROAD + + def get_idx_thermal_start(self): + return self.THERMAL_NUM_1_IDX + + def get_size_node_map(self): + return len(self._thermal_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._thermal_to_device_path_mapping) + + def get_thermal_to_device_path(self, thermal_num): + return self._thermal_to_device_path_mapping[thermal_num] + + def get_thermal_1_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + + def get_thermal_2_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) + def get_thermal_temp(self): + return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX)) + +#def main(): +# thermal = ThermalUtil() +# +# print 'get_size_node_map : %d' % thermal.get_size_node_map() +# print 'get_size_path_map : %d' % thermal.get_size_path_map() +# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): +# print thermal.get_thermal_to_device_path(x) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/Makefile new file mode 100755 index 000000000000..488fdb321cac --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/Makefile @@ -0,0 +1,17 @@ +ifneq ($(KERNELRELEASE),) +obj-m:= accton_i2c_cpld.o \ + accton_as7312_54x_fan.o accton_as7312_54x_leds.o \ + accton_as7312_54x_psu.o ym2651y.o + +else +ifeq (,$(KERNEL_SRC)) +$(error KERNEL_SRC is not defined) +else +KERNELDIR:=$(KERNEL_SRC) +endif +PWD:=$(shell pwd) +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + rm -rf *.o *.mod.o *.mod.o *.ko .*cmd .tmp_versions Module.markers Module.symvers modules.order +endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_fan.c new file mode 100755 index 000000000000..8764ec8a3176 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_fan.c @@ -0,0 +1,815 @@ +/* + * A hwmon driver for the Accton as7312 54x fan + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as7312_54x_fan" + +#define NUM_THERMAL_SENSORS (3) /* Get sum of this number of sensors.*/ +#define THERMAL_SENSORS_DRIVER "lm75" +#define THERMAL_SENSORS_ADDRS {0x48, 0x49, 0x4a} + +#define IN +#define OUT + +static struct as7312_54x_fan_data *as7312_54x_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x0F, /* fan 1-6 present status */ + 0x10, /* fan 1-6 direction(0:F2B 1:B2F) */ + 0x11, /* fan PWM(for all fan) */ + 0x12, /* front fan 1 speed(rpm) */ + 0x13, /* front fan 2 speed(rpm) */ + 0x14, /* front fan 3 speed(rpm) */ + 0x15, /* front fan 4 speed(rpm) */ + 0x16, /* front fan 5 speed(rpm) */ + 0x17, /* front fan 6 speed(rpm) */ + 0x22, /* rear fan 1 speed(rpm) */ + 0x23, /* rear fan 2 speed(rpm) */ + 0x24, /* rear fan 3 speed(rpm) */ + 0x25, /* rear fan 4 speed(rpm) */ + 0x26, /* rear fan 5 speed(rpm) */ + 0x27, /* rear fan 6 speed(rpm) */ +}; + +/* Each client has this additional data */ +struct as7312_54x_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ + u8 enable; + int system_temp; /*In unit of mini-Celsius*/ + int sensors_found; +}; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID, + FAN6_ID +}; + +enum sysfs_fan_attributes { + FAN_PRESENT_REG, + FAN_DIRECTION_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN6_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN6_REAR_SPEED_RPM, + FAN1_DIRECTION, + FAN2_DIRECTION, + FAN3_DIRECTION, + FAN4_DIRECTION, + FAN5_DIRECTION, + FAN6_DIRECTION, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN6_PRESENT, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, + FAN6_FAULT +}; + +/* Define attributes + */ +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT);\ + static SENSOR_DEVICE_ATTR(fan##index2##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index, index2) &sensor_dev_attr_fan##index##_fault.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_fault.dev_attr.attr + +#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO, fan_show_value, NULL, FAN##index##_DIRECTION) +#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index##_enable, S_IWUSR | S_IRUGO, get_enable, set_enable, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan_duty_cycle_percentage.dev_attr.attr, \ + &sensor_dev_attr_pwm##index.dev_attr.attr, \ + &sensor_dev_attr_pwm##index##_enable.dev_attr.attr + +#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ + static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr + + +#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) +#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index2##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index, index2) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_input.dev_attr.attr + +/* 6 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(6,16); +/* 6 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(6,16); +/* 6 fan present attributes in this platform */ +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(5); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(6); +/* 6 fan direction attribute in this platform */ +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(1); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(2); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(3); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(4); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); +/* System temperature for fancontrol */ +DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); + +static struct attribute *as7312_54x_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_FAULT_ATTR(1,11), + DECLARE_FAN_FAULT_ATTR(2,12), + DECLARE_FAN_FAULT_ATTR(3,13), + DECLARE_FAN_FAULT_ATTR(4,14), + DECLARE_FAN_FAULT_ATTR(5,15), + DECLARE_FAN_FAULT_ATTR(6,16), + DECLARE_FAN_SPEED_RPM_ATTR(1,11), + DECLARE_FAN_SPEED_RPM_ATTR(2,12), + DECLARE_FAN_SPEED_RPM_ATTR(3,13), + DECLARE_FAN_SPEED_RPM_ATTR(4,14), + DECLARE_FAN_SPEED_RPM_ATTR(5,15), + DECLARE_FAN_SPEED_RPM_ATTR(6,16), + DECLARE_FAN_PRESENT_ATTR(1), + DECLARE_FAN_PRESENT_ATTR(2), + DECLARE_FAN_PRESENT_ATTR(3), + DECLARE_FAN_PRESENT_ATTR(4), + DECLARE_FAN_PRESENT_ATTR(5), + DECLARE_FAN_PRESENT_ATTR(6), + DECLARE_FAN_DIRECTION_ATTR(1), + DECLARE_FAN_DIRECTION_ATTR(2), + DECLARE_FAN_DIRECTION_ATTR(3), + DECLARE_FAN_DIRECTION_ATTR(4), + DECLARE_FAN_DIRECTION_ATTR(5), + DECLARE_FAN_DIRECTION_ATTR(6), + DECLARE_FAN_DUTY_CYCLE_ATTR(1), + DECLARE_FAN_SYSTEM_TEMP_ATTR(), + NULL +}; + +#define FAN_DUTY_CYCLE_REG_MASK 0xF +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100 + +static int as7312_54x_fan_read_value(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int as7312_54x_fan_write_value(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + reg_val &= FAN_DUTY_CYCLE_REG_MASK; + return ((u32)(reg_val+1) * 625 + 75)/ 100; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + return ((u32)duty_cycle * 100 / 625) - 1; +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_direction(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 1 : 0; +} +static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 0 : 1; +} + +static u8 is_fan_fault(struct as7312_54x_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = FAN1_FRONT_SPEED_RPM + id; + int rear_fan_index = FAN1_REAR_SPEED_RPM + id; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + ret = 0; + } + + return ret; +} + +static ssize_t set_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct as7312_54x_fan_data *data = as7312_54x_fan_update_device(dev); + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 1) + return -EINVAL; + + data->enable = value; + if (value == 0) + { + return set_duty_cycle(dev, da, buf, FAN_MAX_DUTY_CYCLE); + } + return count; +} + + +static ssize_t get_enable(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7312_54x_fan_data *data = as7312_54x_fan_update_device(dev); + + return sprintf(buf, "%u\n", data->enable); +} +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0) + return -EINVAL; + + value = (value > FAN_MAX_DUTY_CYCLE)? FAN_MAX_DUTY_CYCLE : value; + + as7312_54x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ + as7312_54x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + return count; +} + +/* Due to this struct is declared at lm75.c, it cannot be include + * under Sonic environment. I duplicate it from lm75.c. + */ +struct lm75_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct thermal_zone_device *tz; + struct mutex update_lock; + u8 orig_conf; + u8 resolution; /* In bits, between 9 and 12 */ + u8 resolution_limits; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + unsigned long sample_time; /* In jiffies */ + s16 temp[3]; /* Register values, + 0 = input + 1 = max + 2 = hyst */ +}; + +/*Copied from lm75.c*/ +static inline long lm75_reg_to_mc(s16 temp, u8 resolution) +{ + return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); +} + +/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ +static struct device * get_hwmon_dev( + struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if(data) + { + if( data->valid == 1 && data->hwmon_dev) + { + return data->hwmon_dev; + } + + } + return NULL; +} + +/* To find hwmon index by opening hwmon under that i2c address. + */ +static int find_hwmon_index_by_FileOpen( + int bus_nr, + unsigned short addr, + OUT int *index) +{ +#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ + struct file *sfd; + char client_name[96]; + int i=0; + + do { + snprintf(client_name, sizeof(client_name), + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + + sfd = filp_open(client_name, O_RDONLY, 0); + i++; + } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); + + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); + return -ENOENT; + } + filp_close(sfd, 0); + *index = i - 1; + return 0; + +#undef MAX_HWMON_DEVICE +} + +static int get_temp_file_path( + int bus_nr, unsigned short addr, + struct device *hwmon_dev + ,char *path, int max_len) +{ + + if(hwmon_dev && strlen(dev_name(hwmon_dev))) + { + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", + bus_nr, addr, dev_name(hwmon_dev)); + } + else + { + int i=0; + if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) + { + return -EIO; + } + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + } + return 0; +} + +/*File read the dev file at user space.*/ +static int read_devfile_temp1_input( + struct device *dev, + int bus_nr, + unsigned short addr, + struct device *hwmon_dev, + int *miniCelsius) +{ + struct file *sfd; + char buffer[96]; + char devfile[96]; + int rc, status; + int rdlen, value; + mm_segment_t old_fs; + + rc = 0; + get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); + sfd = filp_open(devfile, O_RDONLY, 0); + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); + return -ENOENT; + } + dev_dbg(dev, "Found device:%s\n",devfile); + + if(!(sfd->f_op) || !(sfd->f_op->read) ) { + pr_err("file %s cann't readable ?\n",devfile); + return -ENOENT; + } + + old_fs = get_fs(); + set_fs(KERNEL_DS); + rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); + if (rdlen == 0) { + pr_err( "File(%s) empty!\n", devfile); + rc = -EIO; + goto exit; + } + status = sscanf(buffer, "%d", &value); + if (status != 1) { + rc = -EIO; + goto exit; + } + *miniCelsius = value; + dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); + +exit: + set_fs(old_fs); + filp_close(sfd, 0); + return rc; +} + +static u8 is_lm75_data_due(struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if (time_after(jiffies, data->last_updated + data->sample_time)) + { + return 1; + } + return 0; +} +static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); + + return 0; +} + +static bool lm75_addr_mached(unsigned short addr) +{ + int i; + unsigned short addrs[] = THERMAL_SENSORS_ADDRS; + + for (i = 0; i < ARRAY_SIZE(addrs); i++) + { + if( addr == addrs[i]) + return 1; + } + return 0; +} + +static int _find_lm75_device(struct device *dev, void *data) +{ + struct device_driver *driver; + struct as7312_54x_fan_data *prv = data; + char *driver_name = THERMAL_SENSORS_DRIVER; + + driver = dev->driver; + if (driver && driver->name && + strcmp(driver->name, driver_name) == 0) + { + struct i2c_client *client; + client = to_i2c_client(dev); + if (client) + { + /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ + struct i2c_adapter *adap = client->adapter; + int miniCelsius = 0; + + if (! lm75_addr_mached(client->addr)) + { + return 0; + } + + if (!adap) { + return -ENXIO; + } + + /* If the data is not updated, read them from devfile + to drive them updateing data from chip.*/ + if (is_lm75_data_due(client)) + { + struct device *hwmon_dev; + + hwmon_dev = get_hwmon_dev(client); + if(0 == read_devfile_temp1_input(dev, adap->nr, + client->addr, hwmon_dev, &miniCelsius)) + { + prv->system_temp += miniCelsius; + prv->sensors_found++; + } + + } + else + { + get_lm75_temp(client, &miniCelsius); + prv->system_temp += miniCelsius; + prv->sensors_found++; + + } + } + } + return 0; +} + +/*Find all lm75 devices and return sum of temperatures.*/ +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + ssize_t ret = 0; + struct as7312_54x_fan_data *data = as7312_54x_fan_update_device(dev); + + data->system_temp=0; + data->sensors_found=0; + i2c_for_each_dev(data, _find_lm75_device); + if (NUM_THERMAL_SENSORS != data->sensors_found) + { + dev_dbg(dev,"only %d of %d temps are found\n", + data->sensors_found, NUM_THERMAL_SENSORS); + data->system_temp = INT_MAX; + } + ret = sprintf(buf, "%d\n",data->system_temp); + return ret; +} + +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7312_54x_fan_data *data = as7312_54x_fan_update_device(dev); + ssize_t ret = 0; + + if (data->valid) { + switch (attr->index) { + case FAN_DUTY_CYCLE_PERCENTAGE: + { + u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + ret = sprintf(buf, "%d\n", + reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], + attr->index - FAN1_PRESENT)); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + case FAN6_DIRECTION: + ret = sprintf(buf, "%d\n", + reg_val_to_direction(data->reg_val[FAN_DIRECTION_REG], + attr->index - FAN1_DIRECTION)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group as7312_54x_fan_group = { + .attrs = as7312_54x_fan_attributes, +}; + +static struct as7312_54x_fan_data *as7312_54x_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7312_54x_fan_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + dev_dbg(&client->dev, "Starting as7312_54x_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + int status = as7312_54x_fan_read_value(client, fan_reg[i]); + + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int as7312_54x_fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7312_54x_fan_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7312_54x_fan_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->enable = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7312_54x_fan_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: fan '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7312_54x_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7312_54x_fan_remove(struct i2c_client *client) +{ + struct as7312_54x_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7312_54x_fan_group); + + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; + +static const struct i2c_device_id as7312_54x_fan_id[] = { + { "as7312_54x_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7312_54x_fan_id); + +static struct i2c_driver as7312_54x_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = as7312_54x_fan_probe, + .remove = as7312_54x_fan_remove, + .id_table = as7312_54x_fan_id, + .address_list = normal_i2c, +}; + +static int __init as7312_54x_fan_init(void) +{ + return i2c_add_driver(&as7312_54x_fan_driver); +} + +static void __exit as7312_54x_fan_exit(void) +{ + i2c_del_driver(&as7312_54x_fan_driver); +} + +module_init(as7312_54x_fan_init); +module_exit(as7312_54x_fan_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7312_54x_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_leds.c b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_leds.c new file mode 100644 index 000000000000..1d54517c6243 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_leds.c @@ -0,0 +1,438 @@ +/* + * A LED driver for the accton_as7312_54x_led + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern int as7312_54x_cpld_read (unsigned short cpld_addr, u8 reg); +extern int as7312_54x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "accton_as7312_54x_led" + +struct accton_as7312_54x_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[1]; /* only 1 register*/ +}; + +static struct accton_as7312_54x_led_data *ledctl = NULL; + +/* LED related data + */ + +#define LED_CNTRLER_I2C_ADDRESS (0x60) + +#define LED_TYPE_DIAG_REG_MASK (0x3) +#define LED_MODE_DIAG_GREEN_VALUE (0x02) +#define LED_MODE_DIAG_RED_VALUE (0x01) +#define LED_MODE_DIAG_AMBER_VALUE (0x00) /*It's yellow actually. Green+Red=Yellow*/ +#define LED_MODE_DIAG_OFF_VALUE (0x03) + + +#define LED_TYPE_LOC_REG_MASK (0x80) +#define LED_MODE_LOC_ON_VALUE (0) +#define LED_MODE_LOC_OFF_VALUE (0x80) + +enum led_type { + LED_TYPE_DIAG, + LED_TYPE_LOC, + LED_TYPE_FAN, + LED_TYPE_PSU1, + LED_TYPE_PSU2 +}; + +struct led_reg { + u32 types; + u8 reg_addr; +}; + +static const struct led_reg led_reg_map[] = { + {(1<update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting accton_as7312_54x_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = accton_as7312_54x_led_read_value(led_reg_map[i].reg_addr); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg_map[i].reg_addr, status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as7312_54x_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + enum led_type type) +{ + int reg_val; + u8 reg ; + mutex_lock(&ledctl->update_lock); + + if( !accton_getLedReg(type, ®)) + { + dev_dbg(&ledctl->pdev->dev, "Not match item for %d.\n", type); + } + + reg_val = accton_as7312_54x_led_read_value(reg); + + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + accton_as7312_54x_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + + +static void accton_as7312_54x_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as7312_54x_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG); +} + +static enum led_brightness accton_as7312_54x_led_diag_get(struct led_classdev *cdev) +{ + accton_as7312_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void accton_as7312_54x_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as7312_54x_led_set(led_cdev, led_light_mode, LED_TYPE_LOC); +} + +static enum led_brightness accton_as7312_54x_led_loc_get(struct led_classdev *cdev) +{ + accton_as7312_54x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static void accton_as7312_54x_led_auto_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ +} + +static enum led_brightness accton_as7312_54x_led_auto_get(struct led_classdev *cdev) +{ + return LED_MODE_AUTO; +} + +static struct led_classdev accton_as7312_54x_leds[] = { + [LED_TYPE_DIAG] = { + .name = "accton_as7312_54x_led::diag", + .default_trigger = "unused", + .brightness_set = accton_as7312_54x_led_diag_set, + .brightness_get = accton_as7312_54x_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_RED, + }, + [LED_TYPE_LOC] = { + .name = "accton_as7312_54x_led::loc", + .default_trigger = "unused", + .brightness_set = accton_as7312_54x_led_loc_set, + .brightness_get = accton_as7312_54x_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_BLUE, + }, + [LED_TYPE_FAN] = { + .name = "accton_as7312_54x_led::fan", + .default_trigger = "unused", + .brightness_set = accton_as7312_54x_led_auto_set, + .brightness_get = accton_as7312_54x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU1] = { + .name = "accton_as7312_54x_led::psu1", + .default_trigger = "unused", + .brightness_set = accton_as7312_54x_led_auto_set, + .brightness_get = accton_as7312_54x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "accton_as7312_54x_led::psu2", + .default_trigger = "unused", + .brightness_set = accton_as7312_54x_led_auto_set, + .brightness_get = accton_as7312_54x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +}; + +static int accton_as7312_54x_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as7312_54x_leds); i++) { + led_classdev_suspend(&accton_as7312_54x_leds[i]); + } + + return 0; +} + +static int accton_as7312_54x_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as7312_54x_leds); i++) { + led_classdev_resume(&accton_as7312_54x_leds[i]); + } + + return 0; +} + +static int accton_as7312_54x_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(accton_as7312_54x_leds); i++) { + ret = led_classdev_register(&pdev->dev, &accton_as7312_54x_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(accton_as7312_54x_leds)) { + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&accton_as7312_54x_leds[i]); + } + } + + return ret; +} + +static int accton_as7312_54x_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(accton_as7312_54x_leds); i++) { + led_classdev_unregister(&accton_as7312_54x_leds[i]); + } + + return 0; +} + +static struct platform_driver accton_as7312_54x_led_driver = { + .probe = accton_as7312_54x_led_probe, + .remove = accton_as7312_54x_led_remove, + .suspend = accton_as7312_54x_led_suspend, + .resume = accton_as7312_54x_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as7312_54x_led_init(void) +{ + int ret; + + ret = platform_driver_register(&accton_as7312_54x_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct accton_as7312_54x_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as7312_54x_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&accton_as7312_54x_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as7312_54x_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&accton_as7312_54x_led_driver); + kfree(ledctl); +} + +module_init(accton_as7312_54x_led_init); +module_exit(accton_as7312_54x_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as7312_54x_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_psu.c new file mode 100644 index 000000000000..4646224ef903 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_psu.c @@ -0,0 +1,277 @@ +/* + * An hwmon driver for accton as7312_54x Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static int as7312_54x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as7312_54x_cpld_read(unsigned short cpld_addr, u8 reg); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, 0x53, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7312_54x_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[9]; /* Model name, read from eeprom */ +}; + +static struct as7312_54x_psu_data *as7312_54x_psu_update_device(struct device *dev); + +enum as7312_54x_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); + +static struct attribute *as7312_54x_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7312_54x_psu_data *data = as7312_54x_psu_update_device(dev); + u8 status = 0; + + if (attr->index == PSU_PRESENT) { + status = !(data->status >> (1-data->index) & 0x1); + } + else { /* PSU_POWER_GOOD */ + status = (data->status >> (3-data->index) & 0x1); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7312_54x_psu_data *data = as7312_54x_psu_update_device(dev); + + return sprintf(buf, "%s\n", data->model_name); +} + +static const struct attribute_group as7312_54x_psu_group = { + .attrs = as7312_54x_psu_attributes, +}; + +static int as7312_54x_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7312_54x_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7312_54x_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7312_54x_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7312_54x_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7312_54x_psu_remove(struct i2c_client *client) +{ + struct as7312_54x_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7312_54x_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as7312_54x_psu1, + as7312_54x_psu2 +}; + +static const struct i2c_device_id as7312_54x_psu_id[] = { + { "as7312_54x_psu1", as7312_54x_psu1 }, + { "as7312_54x_psu2", as7312_54x_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7312_54x_psu_id); + +static struct i2c_driver as7312_54x_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7312_54x_psu", + }, + .probe = as7312_54x_psu_probe, + .remove = as7312_54x_psu_remove, + .id_table = as7312_54x_psu_id, + .address_list = normal_i2c, +}; + +static int as7312_54x_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +static struct as7312_54x_psu_data *as7312_54x_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7312_54x_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; + int power_good = 0; + + dev_dbg(&client->dev, "Starting as7312_54x update\n"); + + /* Read psu status */ + status = as7312_54x_cpld_read(0x60, 0x2); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + } + else { + data->status = status; + } + + /* Read model name */ + memset(data->model_name, 0, sizeof(data->model_name)); + power_good = (data->status >> (3-data->index) & 0x1); + + if (power_good) { + status = as7312_54x_psu_read_block(client, 0x20, data->model_name, + ARRAY_SIZE(data->model_name)-1); + + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); + } + else { + data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(as7312_54x_psu_driver); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7312_54x_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_sfp.c b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_sfp.c new file mode 100644 index 000000000000..921d9f892cac --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_sfp.c @@ -0,0 +1,1972 @@ +/* + * SFP driver for accton as7312_54x sfp + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "as7312_54x_sfp" /* Platform dependent */ + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) +#define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) +#else +#define DEBUG_PRINT(fmt, args...) +#endif + +#define NUM_OF_PORT 54 +#define SFP_PORT_MAX 48 +#define EEPROM_NAME "sfp_eeprom" +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define BIT_INDEX(i) (1ULL << (i)) +#define USE_I2C_BLOCK_READ 1 /* Platform dependent */ +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +#define SFP_EEPROM_A0_I2C_ADDR (0xA0 >> 1) + +#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 +#define SFF8024_DEVICE_ID_SFP 0x3 +#define SFF8024_DEVICE_ID_QSFP 0xC +#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD +#define SFF8024_DEVICE_ID_QSFP28 0x11 + +#define SFF8472_DIAG_MON_TYPE_ADDR 92 +#define SFF8472_DIAG_MON_TYPE_DDM_MASK 0x40 +#define SFF8436_RX_LOS_ADDR 3 +#define SFF8436_TX_FAULT_ADDR 4 +#define SFF8436_TX_DISABLE_ADDR 86 + +#define MULTIPAGE_SUPPORT 1 + +#if (MULTIPAGE_SUPPORT == 1) +/* fundamental unit of addressing for SFF_8472/SFF_8436 */ +#define SFF_8436_PAGE_SIZE 128 +/* + * The current 8436 (QSFP) spec provides for only 4 supported + * pages (pages 0-3). + * This driver is prepared to support more, but needs a register in the + * EEPROM to indicate how many pages are supported before it is safe + * to implement more pages in the driver. + */ +#define SFF_8436_SPECED_PAGES 4 +#define SFF_8436_EEPROM_SIZE ((1 + SFF_8436_SPECED_PAGES) * SFF_8436_PAGE_SIZE) +#define SFF_8436_EEPROM_UNPAGED_SIZE (2 * SFF_8436_PAGE_SIZE) +/* + * The current 8472 (SFP) spec provides for only 3 supported + * pages (pages 0-2). + * This driver is prepared to support more, but needs a register in the + * EEPROM to indicate how many pages are supported before it is safe + * to implement more pages in the driver. + */ +#define SFF_8472_SPECED_PAGES 3 +#define SFF_8472_EEPROM_SIZE ((3 + SFF_8472_SPECED_PAGES) * SFF_8436_PAGE_SIZE) +#define SFF_8472_EEPROM_UNPAGED_SIZE (4 * SFF_8436_PAGE_SIZE) + +/* a few constants to find our way around the EEPROM */ +#define SFF_8436_PAGE_SELECT_REG 0x7F +#define SFF_8436_PAGEABLE_REG 0x02 +#define SFF_8436_NOT_PAGEABLE (1<<2) +#define SFF_8472_PAGEABLE_REG 0x40 +#define SFF_8472_PAGEABLE (1<<4) + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = SFF_8436_PAGE_SIZE; + +/* + * specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; + +typedef enum qsfp_opcode { + QSFP_READ_OP = 0, + QSFP_WRITE_OP = 1 +} qsfp_opcode_e; +#endif + +/* Platform dependent +++ */ +#define I2C_ADDR_CPLD1 0x60 +#define I2C_ADDR_CPLD2 0x62 +#define I2C_ADDR_CPLD3 0x64 + +#define CPLD3_OFFSET_QSFP_MOD_RST 0x17 +/* Platform dependent --- */ +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_present(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count);; +static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); +enum sfp_sysfs_attributes { + PRESENT, + PRESENT_ALL, + PORT_NUMBER, + PORT_TYPE, + DDM_IMPLEMENTED, + TX_FAULT, + TX_FAULT1, + TX_FAULT2, + TX_FAULT3, + TX_FAULT4, + TX_DISABLE, + TX_DISABLE1, + TX_DISABLE2, + TX_DISABLE3, + TX_DISABLE4, + RX_LOS, + RX_LOS1, + RX_LOS2, + RX_LOS3, + RX_LOS4, + RX_LOS_ALL, + SFP_MOD_RST +}; + +/* SFP/QSFP common attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_present, NULL, PRESENT); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_present, NULL, PRESENT_ALL); +static SENSOR_DEVICE_ATTR(sfp_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS); +static SENSOR_DEVICE_ATTR(sfp_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, TX_DISABLE); +static SENSOR_DEVICE_ATTR(sfp_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, TX_FAULT); + +/* QSFP attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_rx_los1, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS1); +static SENSOR_DEVICE_ATTR(sfp_rx_los2, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS2); +static SENSOR_DEVICE_ATTR(sfp_rx_los3, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS3); +static SENSOR_DEVICE_ATTR(sfp_rx_los4, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS4); +static SENSOR_DEVICE_ATTR(sfp_tx_disable1, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE1); +static SENSOR_DEVICE_ATTR(sfp_tx_disable2, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE2); +static SENSOR_DEVICE_ATTR(sfp_tx_disable3, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE3); +static SENSOR_DEVICE_ATTR(sfp_tx_disable4, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE4); +static SENSOR_DEVICE_ATTR(sfp_tx_fault1, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT1); +static SENSOR_DEVICE_ATTR(sfp_tx_fault2, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT2); +static SENSOR_DEVICE_ATTR(sfp_tx_fault3, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT3); +static SENSOR_DEVICE_ATTR(sfp_tx_fault4, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT4); +static SENSOR_DEVICE_ATTR(sfp_mod_rst, S_IWUSR | S_IRUGO, get_mode_reset, set_mode_reset, SFP_MOD_RST); + +static struct attribute *qsfp_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los1.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los2.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los3.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault4.dev_attr.attr, + &sensor_dev_attr_sfp_mod_rst.dev_attr.attr, + NULL +}; + +/* SFP msa attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_rx_los_all, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS_ALL); +static struct attribute *sfp_msa_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los_all.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + NULL +}; + +/* Platform dependent +++ */ +#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) + +enum port_numbers { + as7312_54x_port1, as7312_54x_port2, as7312_54x_port3, as7312_54x_port4, + as7312_54x_port5, as7312_54x_port6, as7312_54x_port7, as7312_54x_port8, + as7312_54x_port9, as7312_54x_port10, as7312_54x_port11, as7312_54x_port12, + as7312_54x_port13, as7312_54x_port14, as7312_54x_port15, as7312_54x_port16, + as7312_54x_port17, as7312_54x_port18, as7312_54x_port19, as7312_54x_port20, + as7312_54x_port21, as7312_54x_port22, as7312_54x_port23, as7312_54x_port24, + as7312_54x_port25, as7312_54x_port26, as7312_54x_port27, as7312_54x_port28, + as7312_54x_port29, as7312_54x_port30, as7312_54x_port31, as7312_54x_port32, + as7312_54x_port33, as7312_54x_port34, as7312_54x_port35, as7312_54x_port36, + as7312_54x_port37, as7312_54x_port38, as7312_54x_port39, as7312_54x_port40, + as7312_54x_port41, as7312_54x_port42, as7312_54x_port43, as7312_54x_port44, + as7312_54x_port45, as7312_54x_port46, as7312_54x_port47, as7312_54x_port48, + as7312_54x_port49, as7312_54x_port52, as7312_54x_port50, as7312_54x_port53, + as7312_54x_port51, as7312_54x_port54 +}; + +#define I2C_DEV_ID(x) { #x, x} + +static const struct i2c_device_id sfp_device_id[] = { + I2C_DEV_ID(as7312_54x_port1), + I2C_DEV_ID(as7312_54x_port2), + I2C_DEV_ID(as7312_54x_port3), + I2C_DEV_ID(as7312_54x_port4), + I2C_DEV_ID(as7312_54x_port5), + I2C_DEV_ID(as7312_54x_port6), + I2C_DEV_ID(as7312_54x_port7), + I2C_DEV_ID(as7312_54x_port8), + I2C_DEV_ID(as7312_54x_port9), + I2C_DEV_ID(as7312_54x_port10), + I2C_DEV_ID(as7312_54x_port11), + I2C_DEV_ID(as7312_54x_port12), + I2C_DEV_ID(as7312_54x_port13), + I2C_DEV_ID(as7312_54x_port14), + I2C_DEV_ID(as7312_54x_port15), + I2C_DEV_ID(as7312_54x_port16), + I2C_DEV_ID(as7312_54x_port17), + I2C_DEV_ID(as7312_54x_port18), + I2C_DEV_ID(as7312_54x_port19), + I2C_DEV_ID(as7312_54x_port20), + I2C_DEV_ID(as7312_54x_port21), + I2C_DEV_ID(as7312_54x_port22), + I2C_DEV_ID(as7312_54x_port23), + I2C_DEV_ID(as7312_54x_port24), + I2C_DEV_ID(as7312_54x_port25), + I2C_DEV_ID(as7312_54x_port26), + I2C_DEV_ID(as7312_54x_port27), + I2C_DEV_ID(as7312_54x_port28), + I2C_DEV_ID(as7312_54x_port29), + I2C_DEV_ID(as7312_54x_port30), + I2C_DEV_ID(as7312_54x_port31), + I2C_DEV_ID(as7312_54x_port32), + I2C_DEV_ID(as7312_54x_port33), + I2C_DEV_ID(as7312_54x_port34), + I2C_DEV_ID(as7312_54x_port35), + I2C_DEV_ID(as7312_54x_port36), + I2C_DEV_ID(as7312_54x_port37), + I2C_DEV_ID(as7312_54x_port38), + I2C_DEV_ID(as7312_54x_port39), + I2C_DEV_ID(as7312_54x_port40), + I2C_DEV_ID(as7312_54x_port41), + I2C_DEV_ID(as7312_54x_port42), + I2C_DEV_ID(as7312_54x_port43), + I2C_DEV_ID(as7312_54x_port44), + I2C_DEV_ID(as7312_54x_port45), + I2C_DEV_ID(as7312_54x_port46), + I2C_DEV_ID(as7312_54x_port47), + I2C_DEV_ID(as7312_54x_port48), + I2C_DEV_ID(as7312_54x_port49), + I2C_DEV_ID(as7312_54x_port50), + I2C_DEV_ID(as7312_54x_port51), + I2C_DEV_ID(as7312_54x_port52), + I2C_DEV_ID(as7312_54x_port53), + I2C_DEV_ID(as7312_54x_port54), + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, sfp_device_id); +/* Platform dependent --- */ + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_QSFP +}; + +/* Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct sfp_msa_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[6]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss + 3 => device id + 4 => 10G Ethernet Compliance Codes + to distinguish SFP or SFP+ + 5 => DIAGNOSTIC MONITORING TYPE */ + struct eeprom_data eeprom; +#if (MULTIPAGE_SUPPORT == 1) + struct i2c_client *ddm_client; /* dummy client instance for 0xA2 */ +#endif +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + + struct sfp_msa_data *msa; + struct qsfp_data *qsfp; + + struct i2c_client *client; +#if (MULTIPAGE_SUPPORT == 1) + int use_smbus; + u8 *writebuf; + unsigned write_max; +#endif +}; + +#if (MULTIPAGE_SUPPORT == 1) +static ssize_t sfp_port_read_write(struct sfp_port_data *port_data, + char *buf, loff_t off, size_t len, qsfp_opcode_e opcode); +#endif +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port)); +} + +/* Platform dependent +++ */ +static struct sfp_port_data *sfp_update_present(struct i2c_client *client) +{ + int i = 0, j = 0, status = -1; + u8 reg; + unsigned short cpld_addr; + struct sfp_port_data *data = i2c_get_clientdata(client); + + DEBUG_PRINT("Starting sfp present status update"); + mutex_lock(&data->update_lock); + data->present = 0; + + /* Read present status of port 1~48(SFP port) */ + for (i = 0; i < 2; i++) { + for (j = 0; j < 3; j++) { + cpld_addr = I2C_ADDR_CPLD2 + i*2; + reg = 0x9+j; + status = accton_i2c_cpld_read(cpld_addr, reg); + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_addr, reg, status); + goto exit; + } + + DEBUG_PRINT("Present status = 0x%lx\r\n", data->present); + data->present |= (u64)status << ((i*24) + (j%3)*8); + } + } + + /* Read present status of port 49-52(QSFP port) */ + cpld_addr = I2C_ADDR_CPLD2; + reg = 0x18; + status = accton_i2c_cpld_read(cpld_addr, reg); + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_addr, reg, status); + goto exit; + } + else { + data->present |= (u64)(status & 0xF) << SFP_PORT_MAX; + } + + /* Read present status of port 53-54(QSFP port) */ + cpld_addr = I2C_ADDR_CPLD3; + reg = 0x18; + status = accton_i2c_cpld_read(cpld_addr, reg); + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_addr, reg, status); + goto exit; + } + else { + data->present |= (u64)(status & 0x3) << 52; + } + + DEBUG_PRINT("Present status = 0x%lx", data->present); +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static struct sfp_port_data* sfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0, j = 0; + int status = -1; + + if (time_before(jiffies, data->msa->last_updated + HZ + HZ / 2) && data->msa->valid) { + return data; + } + + DEBUG_PRINT("Starting as7312_54x sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->msa->valid = 0; + memset(data->msa->status, 0, sizeof(data->msa->status)); + + /* Read status of port 1~48(SFP port) */ + for (i = 0; i < 2; i++) { + for (j = 0; j < 9; j++) { + u8 reg; + unsigned short cpld_addr; + reg = 0xc+j; + cpld_addr = I2C_ADDR_CPLD2 + i*2; + + status = accton_i2c_cpld_read(cpld_addr, reg); + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_addr, reg, status); + goto exit; + } + + data->msa->status[j/3] |= (u64)status << ((i*24) + (j%3)*8); + } + } + + data->msa->valid = 1; + data->msa->last_updated = jiffies; + +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + unsigned short cpld_addr = 0; + u8 cpld_reg = 0, cpld_val = 0, cpld_bit = 0; + long disable; + int error; + + if (data->driver_type == DRIVER_TYPE_QSFP) { + return qsfp_set_tx_disable(dev, da, buf, count); + } + + error = kstrtol(buf, 10, &disable); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + if(data->port < 24) { + cpld_addr = I2C_ADDR_CPLD2; + cpld_reg = 0xF + data->port / 8; + cpld_bit = 1 << (data->port % 8); + } + else { /* port 24 ~ 48 */ + cpld_addr = I2C_ADDR_CPLD3; + cpld_reg = 0xF + (data->port - 24) / 8; + cpld_bit = 1 << (data->port % 8); + } + + /* Read current status */ + cpld_val = accton_i2c_cpld_read(cpld_addr, cpld_reg); + + /* Update tx_disable status */ + if (disable) { + data->msa->status[1] |= BIT_INDEX(data->port); + cpld_val |= cpld_bit; + } + else { + data->msa->status[1] &= ~BIT_INDEX(data->port); + cpld_val &= ~cpld_bit; + } + + accton_i2c_cpld_write(cpld_addr, cpld_reg, cpld_val); + mutex_unlock(&data->update_lock); + return count; +} + +static int sfp_is_port_present(struct i2c_client *client, int port) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + data = sfp_update_present(client); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + return (data->present & BIT_INDEX(data->port)) ? 0 : 1; /* Platform dependent */ +} + +/* Platform dependent +++ */ +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + + if (PRESENT_ALL == attr->index) { + int i; + u8 values[7] = {0}; + struct sfp_port_data *data = sfp_update_present(client); + + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + for (i = 0; i < ARRAY_SIZE(values); i++) { + values[i] = ~(u8)(data->present >> (i * 8)); + } + + /* Return values 1 -> 54 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3], values[4], values[5], + values[6] & 0x3F); + } + else { + struct sfp_port_data *data = i2c_get_clientdata(client); + int present = sfp_is_port_present(client, data->port); + + if (IS_ERR_VALUE(present)) { + return present; + } + + /* PRESENT */ + return sprintf(buf, "%d\n", present); + } +} +/* Platform dependent --- */ + +static struct sfp_port_data *qsfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i, status = -1; + u8 buf = 0; + u8 reg[] = {SFF8436_TX_FAULT_ADDR, SFF8436_TX_DISABLE_ADDR, SFF8436_RX_LOS_ADDR}; + + if (time_before(jiffies, data->qsfp->last_updated + HZ + HZ / 2) && data->qsfp->valid) { + return data; + } + + DEBUG_PRINT("Starting sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->qsfp->valid = 0; + memset(data->qsfp->status, 0, sizeof(data->qsfp->status)); + + /* Notify device to update tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf)); + if (unlikely(status < 0)) { + goto exit; + } + } + msleep(200); + + /* Read actual tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf)); + if (unlikely(status < 0)) { + goto exit; + } + + DEBUG_PRINT("qsfp reg(0x%x) status = (0x%x)", reg[i], data->qsfp->status[i]); + data->qsfp->status[i] = (buf & 0xF); + } + + data->qsfp->valid = 1; + data->qsfp->last_updated = jiffies; + +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 cpld_val = 0; + int port_bit; + int status = -EINVAL; + u8 cpld_addr[] = {I2C_ADDR_CPLD2, I2C_ADDR_CPLD3}; + + /* Low power mode is not supported for SFP ports(1-48) */ + if (data->port < SFP_PORT_MAX) { + return -EINVAL; + } + mutex_lock(&data->update_lock); + + port_bit = data->port - SFP_PORT_MAX; + cpld_val = accton_i2c_cpld_read(cpld_addr[port_bit/4], CPLD3_OFFSET_QSFP_MOD_RST); + + pr_err("[ROY]%s#%d, %x from %x\n", __func__, __LINE__, cpld_val, cpld_addr[port_bit/4]); + + cpld_val = cpld_val & 0x0F; + cpld_val = cpld_val & BIT_INDEX(port_bit%4); + + pr_err("[ROY]%s#%d, %x of bit %d\n", __func__, __LINE__, cpld_val, port_bit); + + status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", cpld_val>>(port_bit%4)); + + mutex_unlock(&data->update_lock); + + return status; +} + +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 cpld_val = 0; + long reset; + int error, port_bit; + u8 cpld_addr[] = {I2C_ADDR_CPLD2, I2C_ADDR_CPLD3}; + + pr_err("[ROY]%s#%d, port:%d\n", __func__, __LINE__, data->port); + + /* Tx disable is not supported for QSFP ports(49-54) */ + if (data->port < SFP_PORT_MAX) { + return -EINVAL; + } + port_bit = data->port - SFP_PORT_MAX; + error = kstrtol(buf, 10, &reset); + + pr_err("[ROY]%s#%d, %s == %d\n", __func__, __LINE__, buf, error); + if (error) { + return error; + } + mutex_lock(&data->update_lock); + + cpld_val = accton_i2c_cpld_read(cpld_addr[port_bit/4], CPLD3_OFFSET_QSFP_MOD_RST); + pr_err("[ROY]%s#%d, %x\n", __func__, __LINE__, cpld_val); + /* Update lp_mode status */ + if (reset) + { + cpld_val |= BIT_INDEX(port_bit%4); + } + else + { + cpld_val &= ~BIT_INDEX(port_bit%4); + } + pr_err("[ROY]%s#%d, %x to %x\n", __func__, __LINE__, cpld_val, cpld_addr[port_bit/4]); + + accton_i2c_cpld_write(cpld_addr[port_bit/4], CPLD3_OFFSET_QSFP_MOD_RST, cpld_val); + + mutex_unlock(&data->update_lock); + + return count; +} +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + int present; + u8 val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + present = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENXIO; + } + + data = qsfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + switch (attr->index) { + case TX_FAULT: + val = !!(data->qsfp->status[2] & 0xF); + break; + case TX_FAULT1: + case TX_FAULT2: + case TX_FAULT3: + case TX_FAULT4: + val = !!(data->qsfp->status[2] & BIT_INDEX(attr->index - TX_FAULT1)); + break; + case TX_DISABLE: + val = data->qsfp->status[1] & 0xF; + break; + case TX_DISABLE1: + case TX_DISABLE2: + case TX_DISABLE3: + case TX_DISABLE4: + val = !!(data->qsfp->status[1] & BIT_INDEX(attr->index - TX_DISABLE1)); + break; + case RX_LOS: + val = !!(data->qsfp->status[0] & 0xF); + break; + case RX_LOS1: + case RX_LOS2: + case RX_LOS3: + case RX_LOS4: + val = !!(data->qsfp->status[0] & BIT_INDEX(attr->index - RX_LOS1)); + break; + default: + break; + } + + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + long disable; + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + status = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(status)) { + return status; + } + + if (!status) { + /* port is not present */ + return -ENXIO; + } + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + + data = qsfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + mutex_lock(&data->update_lock); + + if (attr->index == TX_DISABLE) { + if (disable) { + data->qsfp->status[1] |= 0xF; + } + else { + data->qsfp->status[1] &= ~0xF; + } + } + else {/* TX_DISABLE1 ~ TX_DISABLE4*/ + if (disable) { + data->qsfp->status[1] |= (1 << (attr->index - TX_DISABLE1)); + } + else { + data->qsfp->status[1] &= ~(1 << (attr->index - TX_DISABLE1)); + } + } + + DEBUG_PRINT("index = (%d), status = (0x%x)", attr->index, data->qsfp->status[1]); + status = sfp_eeprom_write(data->client, SFF8436_TX_DISABLE_ADDR, &data->qsfp->status[1], sizeof(data->qsfp->status[1])); + if (unlikely(status < 0)) { + count = status; + } + + mutex_unlock(&data->update_lock); + return count; +} + +/* Platform dependent +++ */ +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0, index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (data->driver_type == DRIVER_TYPE_QSFP) { + return qsfp_show_tx_rx_status(dev, da, buf); + } + + data = sfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + if(attr->index == RX_LOS_ALL) { + int i = 0; + u8 values[6] = {0}; + + for (i = 0; i < ARRAY_SIZE(values); i++) { + values[i] = (u8)(data->msa->status[2] >> (i * 8)); + } + + /** Return values 1 -> 48 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3], values[4], values[5]); + } + + switch (attr->index) { + case TX_FAULT: + index = 0; + break; + case TX_DISABLE: + index = 1; + break; + case RX_LOS: + index = 2; + break; + default: + return 0; + } + + val = (data->msa->status[index] & BIT_INDEX(data->port)) ? 1 : 0; + return sprintf(buf, "%d\n", val); +} +/* Platform dependent --- */ +static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int status, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + status = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + return status; + } + + return data_len; +#else + int status, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, command, *data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + return status; + } + + return 1; +#endif + + +} + +#if (MULTIPAGE_SUPPORT == 0) +static ssize_t sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; +} +#endif + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + struct sfp_port_data *data; + DEBUG_PRINT("%s(%d) offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + present = sfp_is_port_present(data->client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + +#if (MULTIPAGE_SUPPORT == 1) + return sfp_port_read_write(data, buf, off, count, QSFP_WRITE_OP); +#else + return sfp_port_write(data, buf, off, count); +#endif +} + +static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int status, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + status = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + goto abort; + } + if (unlikely(status != data_len)) { + status = -EIO; + goto abort; + } + + //result = data_len; + +abort: + return status; +#else + int status, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, command); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, status); + goto abort; + } + + *data = (u8)status; + status = 1; + +abort: + return status; +#endif +} + +#if (MULTIPAGE_SUPPORT == 1) +/*-------------------------------------------------------------------------*/ +/* + * This routine computes the addressing information to be used for + * a given r/w request. + * + * Task is to calculate the client (0 = i2c addr 50, 1 = i2c addr 51), + * the page, and the offset. + * + * Handles both SFP and QSFP. + * For SFP, offset 0-255 are on client[0], >255 is on client[1] + * Offset 256-383 are on the lower half of client[1] + * Pages are accessible on the upper half of client[1]. + * Offset >383 are in 128 byte pages mapped into the upper half + * + * For QSFP, all offsets are on client[0] + * offset 0-127 are on the lower half of client[0] (no paging) + * Pages are accessible on the upper half of client[1]. + * Offset >127 are in 128 byte pages mapped into the upper half + * + * Callers must not read/write beyond the end of a client or a page + * without recomputing the client/page. Hence offset (within page) + * plus length must be less than or equal to 128. (Note that this + * routine does not have access to the length of the call, hence + * cannot do the validity check.) + * + * Offset within Lower Page 00h and Upper Page 00h are not recomputed + */ +static uint8_t sff_8436_translate_offset(struct sfp_port_data *port_data, + loff_t *offset, struct i2c_client **client) +{ + unsigned page = 0; + + *client = port_data->client; + + /* if SFP style, offset > 255, shift to i2c addr 0x51 */ + if (port_data->driver_type == DRIVER_TYPE_SFP_MSA) { + if (*offset > 255) { + /* like QSFP, but shifted to client[1] */ + *client = port_data->msa->ddm_client; + *offset -= 256; + } + } + + /* + * if offset is in the range 0-128... + * page doesn't matter (using lower half), return 0. + * offset is already correct (don't add 128 to get to paged area) + */ + if (*offset < SFF_8436_PAGE_SIZE) + return page; + + /* note, page will always be positive since *offset >= 128 */ + page = (*offset >> 7)-1; + /* 0x80 places the offset in the top half, offset is last 7 bits */ + *offset = SFF_8436_PAGE_SIZE + (*offset & 0x7f); + + return page; /* note also returning client and offset */ +} + +static ssize_t sff_8436_eeprom_read(struct sfp_port_data *port_data, + struct i2c_client *client, + char *buf, unsigned offset, size_t count) +{ + struct i2c_msg msg[2]; + u8 msgbuf[2]; + unsigned long timeout, read_time; + int status, i; + + memset(msg, 0, sizeof(msg)); + + switch (port_data->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + /*smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + break; + case I2C_SMBUS_WORD_DATA: + /* Check for odd length transaction */ + count = (count == 1) ? 1 : 2; + break; + case I2C_SMBUS_BYTE_DATA: + count = 1; + break; + default: + /* + * When we have a better choice than SMBus calls, use a + * combined I2C message. Write address; then read up to + * io_limit data bytes. msgbuf is u8 and will cast to our + * needs. + */ + i = 0; + msgbuf[i++] = offset; + + msg[0].addr = client->addr; + msg[0].buf = msgbuf; + msg[0].len = i; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + } + + /* + * Reads fail if the previous write didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + read_time = jiffies; + + switch (port_data->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + status = i2c_smbus_read_i2c_block_data(client, offset, + count, buf); + break; + case I2C_SMBUS_WORD_DATA: + status = i2c_smbus_read_word_data(client, offset); + if (status >= 0) { + buf[0] = status & 0xff; + if (count == 2) + buf[1] = status >> 8; + status = count; + } + break; + case I2C_SMBUS_BYTE_DATA: + status = i2c_smbus_read_byte_data(client, offset); + if (status >= 0) { + buf[0] = status; + status = count; + } + break; + default: + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + status = count; + } + + dev_dbg(&client->dev, "eeprom read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) /* happy path */ + return count; + + if (status == -ENXIO) /* no module present */ + return status; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(read_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t sff_8436_eeprom_write(struct sfp_port_data *port_data, + struct i2c_client *client, + const char *buf, + unsigned offset, size_t count) +{ + struct i2c_msg msg; + ssize_t status; + unsigned long timeout, write_time; + unsigned next_page_start; + int i = 0; + + /* write max is at most a page + * (In this driver, write_max is actually one byte!) + */ + if (count > port_data->write_max) + count = port_data->write_max; + + /* shorten count if necessary to avoid crossing page boundary */ + next_page_start = roundup(offset + 1, SFF_8436_PAGE_SIZE); + if (offset + count > next_page_start) + count = next_page_start - offset; + + switch (port_data->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + /*smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + break; + case I2C_SMBUS_WORD_DATA: + /* Check for odd length transaction */ + count = (count == 1) ? 1 : 2; + break; + case I2C_SMBUS_BYTE_DATA: + count = 1; + break; + default: + /* If we'll use I2C calls for I/O, set up the message */ + msg.addr = client->addr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = port_data->writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + break; + } + + /* + * Reads fail if the previous write didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + write_time = jiffies; + + switch (port_data->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + status = i2c_smbus_write_i2c_block_data(client, + offset, count, buf); + if (status == 0) + status = count; + break; + case I2C_SMBUS_WORD_DATA: + if (count == 2) { + status = i2c_smbus_write_word_data(client, + offset, (u16)((buf[0])|(buf[1] << 8))); + } else { + /* count = 1 */ + status = i2c_smbus_write_byte_data(client, + offset, buf[0]); + } + if (status == 0) + status = count; + break; + case I2C_SMBUS_BYTE_DATA: + status = i2c_smbus_write_byte_data(client, offset, + buf[0]); + if (status == 0) + status = count; + break; + default: + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + break; + } + + dev_dbg(&client->dev, "eeprom write %zu@%d --> %ld (%lu)\n", + count, offset, (long int) status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(write_time, timeout)); + + return -ETIMEDOUT; +} + + +static ssize_t sff_8436_eeprom_update_client(struct sfp_port_data *port_data, + char *buf, loff_t off, + size_t count, qsfp_opcode_e opcode) +{ + struct i2c_client *client; + ssize_t retval = 0; + u8 page = 0; + loff_t phy_offset = off; + int ret = 0; + + page = sff_8436_translate_offset(port_data, &phy_offset, &client); + + dev_dbg(&client->dev, + "sff_8436_eeprom_update_client off %lld page:%d phy_offset:%lld, count:%ld, opcode:%d\n", + off, page, phy_offset, (long int) count, opcode); + if (page > 0) { + ret = sff_8436_eeprom_write(port_data, client, &page, + SFF_8436_PAGE_SELECT_REG, 1); + if (ret < 0) { + dev_dbg(&client->dev, + "Write page register for page %d failed ret:%d!\n", + page, ret); + return ret; + } + } + + while (count) { + ssize_t status; + + if (opcode == QSFP_READ_OP) { + status = sff_8436_eeprom_read(port_data, client, + buf, phy_offset, count); + } else { + status = sff_8436_eeprom_write(port_data, client, + buf, phy_offset, count); + } + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + phy_offset += status; + count -= status; + retval += status; + } + + + if (page > 0) { + /* return the page register to page 0 (why?) */ + page = 0; + ret = sff_8436_eeprom_write(port_data, client, &page, + SFF_8436_PAGE_SELECT_REG, 1); + if (ret < 0) { + dev_err(&client->dev, + "Restore page register to page %d failed ret:%d!\n", + page, ret); + return ret; + } + } + return retval; +} + + +/* + * Figure out if this access is within the range of supported pages. + * Note this is called on every access because we don't know if the + * module has been replaced since the last call. + * If/when modules support more pages, this is the routine to update + * to validate and allow access to additional pages. + * + * Returns updated len for this access: + * - entire access is legal, original len is returned. + * - access begins legal but is too long, len is truncated to fit. + * - initial offset exceeds supported pages, return -EINVAL + */ +static ssize_t sff_8436_page_legal(struct sfp_port_data *port_data, + loff_t off, size_t len) +{ + struct i2c_client *client = port_data->client; + u8 regval; + int status; + size_t maxlen; + + if (off < 0) return -EINVAL; + if (port_data->driver_type == DRIVER_TYPE_SFP_MSA) { + /* SFP case */ + if ((off + len) <= 256) return len; + /* if no pages needed, we're good */ + //if ((off + len) <= SFF_8472_EEPROM_UNPAGED_SIZE) return len; + /* if offset exceeds possible pages, we're not good */ + if (off >= SFF_8472_EEPROM_SIZE) return -EINVAL; + + /* Check if ddm is supported */ + status = sff_8436_eeprom_read(port_data, client, ®val, + SFF8472_DIAG_MON_TYPE_ADDR, 1); + if (status < 0) return status; /* error out (no module?) */ + if (!(regval & SFF8472_DIAG_MON_TYPE_DDM_MASK)) { + if (off >= 256) return -EINVAL; + maxlen = 256 - off; + } + else { + /* in between, are pages supported? */ + status = sff_8436_eeprom_read(port_data, client, ®val, + SFF_8472_PAGEABLE_REG, 1); + if (status < 0) return status; /* error out (no module?) */ + if (regval & SFF_8472_PAGEABLE) { + /* Pages supported, trim len to the end of pages */ + maxlen = SFF_8472_EEPROM_SIZE - off; + } else { + /* pages not supported, trim len to unpaged size */ + if (off >= SFF_8472_EEPROM_UNPAGED_SIZE) return -EINVAL; + maxlen = SFF_8472_EEPROM_UNPAGED_SIZE - off; + } + } + len = (len > maxlen) ? maxlen : len; + dev_dbg(&client->dev, + "page_legal, SFP, off %lld len %ld\n", + off, (long int) len); + } + else if (port_data->driver_type == DRIVER_TYPE_QSFP) { + /* QSFP case */ + /* if no pages needed, we're good */ + if ((off + len) <= SFF_8436_EEPROM_UNPAGED_SIZE) return len; + /* if offset exceeds possible pages, we're not good */ + if (off >= SFF_8436_EEPROM_SIZE) return -EINVAL; + /* in between, are pages supported? */ + status = sff_8436_eeprom_read(port_data, client, ®val, + SFF_8436_PAGEABLE_REG, 1); + if (status < 0) return status; /* error out (no module?) */ + if (regval & SFF_8436_NOT_PAGEABLE) { + /* pages not supported, trim len to unpaged size */ + if (off >= SFF_8436_EEPROM_UNPAGED_SIZE) return -EINVAL; + maxlen = SFF_8436_EEPROM_UNPAGED_SIZE - off; + } else { + /* Pages supported, trim len to the end of pages */ + maxlen = SFF_8436_EEPROM_SIZE - off; + } + len = (len > maxlen) ? maxlen : len; + dev_dbg(&client->dev, + "page_legal, QSFP, off %lld len %ld\n", + off, (long int) len); + } + else { + return -EINVAL; + } + return len; +} + + +static ssize_t sfp_port_read_write(struct sfp_port_data *port_data, + char *buf, loff_t off, size_t len, qsfp_opcode_e opcode) +{ + struct i2c_client *client = port_data->client; + int chunk; + int status = 0; + ssize_t retval; + size_t pending_len = 0, chunk_len = 0; + loff_t chunk_offset = 0, chunk_start_offset = 0; + + if (unlikely(!len)) + return len; + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&port_data->update_lock); + + /* + * Confirm this access fits within the device suppored addr range + */ + len = sff_8436_page_legal(port_data, off, len); + if (len < 0) { + status = len; + goto err; + } + + /* + * For each (128 byte) chunk involved in this request, issue a + * separate call to sff_eeprom_update_client(), to + * ensure that each access recalculates the client/page + * and writes the page register as needed. + * Note that chunk to page mapping is confusing, is different for + * QSFP and SFP, and never needs to be done. Don't try! + */ + pending_len = len; /* amount remaining to transfer */ + retval = 0; /* amount transferred */ + for (chunk = off >> 7; chunk <= (off + len - 1) >> 7; chunk++) { + + /* + * Compute the offset and number of bytes to be read/write + * + * 1. start at offset 0 (within the chunk), and read/write + * the entire chunk + * 2. start at offset 0 (within the chunk) and read/write less + * than entire chunk + * 3. start at an offset not equal to 0 and read/write the rest + * of the chunk + * 4. start at an offset not equal to 0 and read/write less than + * (end of chunk - offset) + */ + chunk_start_offset = chunk * SFF_8436_PAGE_SIZE; + + if (chunk_start_offset < off) { + chunk_offset = off; + if ((off + pending_len) < (chunk_start_offset + + SFF_8436_PAGE_SIZE)) + chunk_len = pending_len; + else + chunk_len = (chunk+1)*SFF_8436_PAGE_SIZE - off;/*SFF_8436_PAGE_SIZE - off;*/ + } else { + chunk_offset = chunk_start_offset; + if (pending_len > SFF_8436_PAGE_SIZE) + chunk_len = SFF_8436_PAGE_SIZE; + else + chunk_len = pending_len; + } + + dev_dbg(&client->dev, + "sff_r/w: off %lld, len %ld, chunk_start_offset %lld, chunk_offset %lld, chunk_len %ld, pending_len %ld\n", + off, (long int) len, chunk_start_offset, chunk_offset, + (long int) chunk_len, (long int) pending_len); + + /* + * note: chunk_offset is from the start of the EEPROM, + * not the start of the chunk + */ + status = sff_8436_eeprom_update_client(port_data, buf, + chunk_offset, chunk_len, opcode); + if (status != chunk_len) { + /* This is another 'no device present' path */ + dev_dbg(&client->dev, + "sff_8436_update_client for chunk %d chunk_offset %lld chunk_len %ld failed %d!\n", + chunk, chunk_offset, (long int) chunk_len, status); + goto err; + } + buf += status; + pending_len -= status; + retval += status; + } + mutex_unlock(&port_data->update_lock); + + return retval; + +err: + mutex_unlock(&port_data->update_lock); + + return status; +} + +#else +static ssize_t sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; + +} +#endif + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + present = sfp_is_port_present(data->client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + +#if (MULTIPAGE_SUPPORT == 1) + return sfp_port_read_write(data, buf, off, count, QSFP_READ_OP); +#else + return sfp_port_read(data, buf, off, count); +#endif +} + +#if (MULTIPAGE_SUPPORT == 1) +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom, size_t size) +#else +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +#endif +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; +#if (MULTIPAGE_SUPPORT == 1) + eeprom->size = size; +#else + eeprom->size = EEPROM_SIZE; +#endif + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + return 0; +} + + +#if (MULTIPAGE_SUPPORT == 0) +static int sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} +#endif + +static const struct attribute_group sfp_msa_group = { + .attrs = sfp_msa_attributes, +}; + +static int sfp_msa_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_msa_data **data) +{ + int status; + struct sfp_msa_data *msa; + +#if (MULTIPAGE_SUPPORT == 0) + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } +#endif + + msa = kzalloc(sizeof(struct sfp_msa_data), GFP_KERNEL); + if (!msa) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_msa_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ +#if (MULTIPAGE_SUPPORT == 1) + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &msa->eeprom.bin, SFF_8436_EEPROM_SIZE); +#else + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &msa->eeprom.bin); +#endif + if (status) { + goto exit_remove; + } + +#if (MULTIPAGE_SUPPORT == 1) + msa->ddm_client = i2c_new_dummy(client->adapter, client->addr + 1); + if (!msa->ddm_client) { + dev_err(&client->dev, "address 0x%02x unavailable\n", client->addr + 1); + status = -EADDRINUSE; + goto exit_eeprom; + } +#endif + + *data = msa; + dev_info(&client->dev, "sfp msa '%s'\n", client->name); + + return 0; + +exit_eeprom: + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &msa->eeprom.bin); +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); +exit_free: + kfree(msa); +exit: + + return status; +} + +static const struct attribute_group qsfp_group = { + .attrs = qsfp_attributes, +}; + +static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + +#if (MULTIPAGE_SUPPORT == 0) + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } +#endif + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ +#if (MULTIPAGE_SUPPORT == 1) + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin, SFF_8436_EEPROM_SIZE); +#else + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); +#endif + if (status) { + goto exit_remove; + } + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &qsfp_group); +exit_free: + kfree(qsfp); +exit: + + return status; +} + +/* Platform dependent +++ */ +static int sfp_device_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int ret = 0; + struct sfp_port_data *data = NULL; + + if (client->addr != SFP_EEPROM_A0_I2C_ADDR) { + return -ENODEV; + } + + if (dev_id->driver_data < as7312_54x_port1 || dev_id->driver_data > as7312_54x_port54) { + return -ENXIO; + } + + data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + +#if (MULTIPAGE_SUPPORT == 1) + data->use_smbus = 0; + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + data->use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + data->use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + data->use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + ret = -EPFNOSUPPORT; + goto exit_kfree; + } + } + + if (!data->use_smbus || + (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) || + i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_WORD_DATA) || + i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + /* + * NOTE: AN-2079 + * Finisar recommends that the host implement 1 byte writes + * only since this module only supports 32 byte page boundaries. + * 2 byte writes are acceptable for PE and Vout changes per + * Application Note AN-2071. + */ + unsigned write_max = 1; + + if (write_max > io_limit) + write_max = io_limit; + if (data->use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + data->write_max = write_max; + + /* buffer (data + address at the beginning) */ + data->writebuf = kmalloc(write_max + 2, GFP_KERNEL); + if (!data->writebuf) { + ret = -ENOMEM; + goto exit_kfree; + } + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + + if (data->use_smbus == I2C_SMBUS_WORD_DATA || + data->use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", data->use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } +#endif + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + data->client = client; + + if (dev_id->driver_data >= as7312_54x_port1 && dev_id->driver_data <= as7312_54x_port48) { + data->driver_type = DRIVER_TYPE_SFP_MSA; + ret = sfp_msa_probe(client, dev_id, &data->msa); + } + else { /* as7312_54x_portsfp49 ~ as7312_54x_portsfp54 */ + data->driver_type = DRIVER_TYPE_QSFP; + ret = qsfp_probe(client, dev_id, &data->qsfp); + } + + if (ret < 0) { + goto exit_kfree_buf; + } + + + return ret; + +exit_kfree_buf: +#if (MULTIPAGE_SUPPORT == 1) + if (data->writebuf) kfree(data->writebuf); +#endif + +exit_kfree: + kfree(data); + return ret; +} +/* Platform dependent --- */ + +static int sfp_msa_remove(struct i2c_client *client, struct sfp_msa_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); +#if (MULTIPAGE_SUPPORT == 1) + i2c_unregister_device(data->ddm_client); +#endif + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); + kfree(data); + return 0; +} + +static int qfp_remove(struct i2c_client *client, struct qsfp_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + return 0; +} + +static int sfp_device_remove(struct i2c_client *client) +{ + int ret = 0; + struct sfp_port_data *data = i2c_get_clientdata(client); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + return sfp_msa_remove(client, data->msa); + case DRIVER_TYPE_QSFP: + return qfp_remove(client, data->qsfp); + } + +#if (MULTIPAGE_SUPPORT == 1) + if (data->writebuf) + kfree(data->writebuf); +#endif + kfree(data); + return ret; +} + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +static struct i2c_driver sfp_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = sfp_device_probe, + .remove = sfp_device_remove, + .id_table = sfp_device_id, + .address_list = normal_i2c, +}; + +static int __init sfp_init(void) +{ + return i2c_add_driver(&sfp_driver); +} + +static void __exit sfp_exit(void) +{ + i2c_del_driver(&sfp_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as7312_54x_sfp driver"); +MODULE_LICENSE("GPL"); + +module_init(sfp_init); +module_exit(sfp_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_i2c_cpld.c new file mode 100644 index 000000000000..67ecd8e036a9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_i2c_cpld.c @@ -0,0 +1,1219 @@ +/* + * Copyright (C) Brandon Chuang + * + * This module supports the accton cpld that hold the channel select + * mechanism for other i2c slave devices, such as SFP. + * This includes the: + * Accton as7312_54x CPLD1/CPLD2/CPLD3 + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +enum cpld_type { + as7312_54x_cpld1, + as7312_54x_cpld2, + as7312_54x_cpld3 +}; + +struct as7312_54x_cpld_data { + enum cpld_type type; + struct device *hwmon_dev; + struct mutex update_lock; +}; + +static const struct i2c_device_id as7312_54x_cpld_id[] = { + { "as7312_54x_cpld1", as7312_54x_cpld1 }, + { "as7312_54x_cpld2", as7312_54x_cpld2 }, + { "as7312_54x_cpld3", as7312_54x_cpld3 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, as7312_54x_cpld_id); + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_TXDISABLE_ATTR_ID(index) MODULE_TXDISABLE_##index +#define TRANSCEIVER_RXLOS_ATTR_ID(index) MODULE_RXLOS_##index +#define TRANSCEIVER_TXFAULT_ATTR_ID(index) MODULE_TXFAULT_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index + +enum as7312_54x_cpld1_sysfs_attributes { + CPLD_VERSION, + ACCESS, + MODULE_PRESENT_ALL, + MODULE_RXLOS_ALL, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + TRANSCEIVER_PRESENT_ATTR_ID(33), + TRANSCEIVER_PRESENT_ATTR_ID(34), + TRANSCEIVER_PRESENT_ATTR_ID(35), + TRANSCEIVER_PRESENT_ATTR_ID(36), + TRANSCEIVER_PRESENT_ATTR_ID(37), + TRANSCEIVER_PRESENT_ATTR_ID(38), + TRANSCEIVER_PRESENT_ATTR_ID(39), + TRANSCEIVER_PRESENT_ATTR_ID(40), + TRANSCEIVER_PRESENT_ATTR_ID(41), + TRANSCEIVER_PRESENT_ATTR_ID(42), + TRANSCEIVER_PRESENT_ATTR_ID(43), + TRANSCEIVER_PRESENT_ATTR_ID(44), + TRANSCEIVER_PRESENT_ATTR_ID(45), + TRANSCEIVER_PRESENT_ATTR_ID(46), + TRANSCEIVER_PRESENT_ATTR_ID(47), + TRANSCEIVER_PRESENT_ATTR_ID(48), + TRANSCEIVER_PRESENT_ATTR_ID(49), + TRANSCEIVER_PRESENT_ATTR_ID(50), + TRANSCEIVER_PRESENT_ATTR_ID(51), + TRANSCEIVER_PRESENT_ATTR_ID(52), + TRANSCEIVER_PRESENT_ATTR_ID(53), + TRANSCEIVER_PRESENT_ATTR_ID(54), + TRANSCEIVER_RESET_ATTR_ID(49), + TRANSCEIVER_RESET_ATTR_ID(50), + TRANSCEIVER_RESET_ATTR_ID(51), + TRANSCEIVER_RESET_ATTR_ID(52), + TRANSCEIVER_RESET_ATTR_ID(53), + TRANSCEIVER_RESET_ATTR_ID(54), + TRANSCEIVER_TXDISABLE_ATTR_ID(1), + TRANSCEIVER_TXDISABLE_ATTR_ID(2), + TRANSCEIVER_TXDISABLE_ATTR_ID(3), + TRANSCEIVER_TXDISABLE_ATTR_ID(4), + TRANSCEIVER_TXDISABLE_ATTR_ID(5), + TRANSCEIVER_TXDISABLE_ATTR_ID(6), + TRANSCEIVER_TXDISABLE_ATTR_ID(7), + TRANSCEIVER_TXDISABLE_ATTR_ID(8), + TRANSCEIVER_TXDISABLE_ATTR_ID(9), + TRANSCEIVER_TXDISABLE_ATTR_ID(10), + TRANSCEIVER_TXDISABLE_ATTR_ID(11), + TRANSCEIVER_TXDISABLE_ATTR_ID(12), + TRANSCEIVER_TXDISABLE_ATTR_ID(13), + TRANSCEIVER_TXDISABLE_ATTR_ID(14), + TRANSCEIVER_TXDISABLE_ATTR_ID(15), + TRANSCEIVER_TXDISABLE_ATTR_ID(16), + TRANSCEIVER_TXDISABLE_ATTR_ID(17), + TRANSCEIVER_TXDISABLE_ATTR_ID(18), + TRANSCEIVER_TXDISABLE_ATTR_ID(19), + TRANSCEIVER_TXDISABLE_ATTR_ID(20), + TRANSCEIVER_TXDISABLE_ATTR_ID(21), + TRANSCEIVER_TXDISABLE_ATTR_ID(22), + TRANSCEIVER_TXDISABLE_ATTR_ID(23), + TRANSCEIVER_TXDISABLE_ATTR_ID(24), + TRANSCEIVER_TXDISABLE_ATTR_ID(25), + TRANSCEIVER_TXDISABLE_ATTR_ID(26), + TRANSCEIVER_TXDISABLE_ATTR_ID(27), + TRANSCEIVER_TXDISABLE_ATTR_ID(28), + TRANSCEIVER_TXDISABLE_ATTR_ID(29), + TRANSCEIVER_TXDISABLE_ATTR_ID(30), + TRANSCEIVER_TXDISABLE_ATTR_ID(31), + TRANSCEIVER_TXDISABLE_ATTR_ID(32), + TRANSCEIVER_TXDISABLE_ATTR_ID(33), + TRANSCEIVER_TXDISABLE_ATTR_ID(34), + TRANSCEIVER_TXDISABLE_ATTR_ID(35), + TRANSCEIVER_TXDISABLE_ATTR_ID(36), + TRANSCEIVER_TXDISABLE_ATTR_ID(37), + TRANSCEIVER_TXDISABLE_ATTR_ID(38), + TRANSCEIVER_TXDISABLE_ATTR_ID(39), + TRANSCEIVER_TXDISABLE_ATTR_ID(40), + TRANSCEIVER_TXDISABLE_ATTR_ID(41), + TRANSCEIVER_TXDISABLE_ATTR_ID(42), + TRANSCEIVER_TXDISABLE_ATTR_ID(43), + TRANSCEIVER_TXDISABLE_ATTR_ID(44), + TRANSCEIVER_TXDISABLE_ATTR_ID(45), + TRANSCEIVER_TXDISABLE_ATTR_ID(46), + TRANSCEIVER_TXDISABLE_ATTR_ID(47), + TRANSCEIVER_TXDISABLE_ATTR_ID(48), + TRANSCEIVER_RXLOS_ATTR_ID(1), + TRANSCEIVER_RXLOS_ATTR_ID(2), + TRANSCEIVER_RXLOS_ATTR_ID(3), + TRANSCEIVER_RXLOS_ATTR_ID(4), + TRANSCEIVER_RXLOS_ATTR_ID(5), + TRANSCEIVER_RXLOS_ATTR_ID(6), + TRANSCEIVER_RXLOS_ATTR_ID(7), + TRANSCEIVER_RXLOS_ATTR_ID(8), + TRANSCEIVER_RXLOS_ATTR_ID(9), + TRANSCEIVER_RXLOS_ATTR_ID(10), + TRANSCEIVER_RXLOS_ATTR_ID(11), + TRANSCEIVER_RXLOS_ATTR_ID(12), + TRANSCEIVER_RXLOS_ATTR_ID(13), + TRANSCEIVER_RXLOS_ATTR_ID(14), + TRANSCEIVER_RXLOS_ATTR_ID(15), + TRANSCEIVER_RXLOS_ATTR_ID(16), + TRANSCEIVER_RXLOS_ATTR_ID(17), + TRANSCEIVER_RXLOS_ATTR_ID(18), + TRANSCEIVER_RXLOS_ATTR_ID(19), + TRANSCEIVER_RXLOS_ATTR_ID(20), + TRANSCEIVER_RXLOS_ATTR_ID(21), + TRANSCEIVER_RXLOS_ATTR_ID(22), + TRANSCEIVER_RXLOS_ATTR_ID(23), + TRANSCEIVER_RXLOS_ATTR_ID(24), + TRANSCEIVER_RXLOS_ATTR_ID(25), + TRANSCEIVER_RXLOS_ATTR_ID(26), + TRANSCEIVER_RXLOS_ATTR_ID(27), + TRANSCEIVER_RXLOS_ATTR_ID(28), + TRANSCEIVER_RXLOS_ATTR_ID(29), + TRANSCEIVER_RXLOS_ATTR_ID(30), + TRANSCEIVER_RXLOS_ATTR_ID(31), + TRANSCEIVER_RXLOS_ATTR_ID(32), + TRANSCEIVER_RXLOS_ATTR_ID(33), + TRANSCEIVER_RXLOS_ATTR_ID(34), + TRANSCEIVER_RXLOS_ATTR_ID(35), + TRANSCEIVER_RXLOS_ATTR_ID(36), + TRANSCEIVER_RXLOS_ATTR_ID(37), + TRANSCEIVER_RXLOS_ATTR_ID(38), + TRANSCEIVER_RXLOS_ATTR_ID(39), + TRANSCEIVER_RXLOS_ATTR_ID(40), + TRANSCEIVER_RXLOS_ATTR_ID(41), + TRANSCEIVER_RXLOS_ATTR_ID(42), + TRANSCEIVER_RXLOS_ATTR_ID(43), + TRANSCEIVER_RXLOS_ATTR_ID(44), + TRANSCEIVER_RXLOS_ATTR_ID(45), + TRANSCEIVER_RXLOS_ATTR_ID(46), + TRANSCEIVER_RXLOS_ATTR_ID(47), + TRANSCEIVER_RXLOS_ATTR_ID(48), + TRANSCEIVER_TXFAULT_ATTR_ID(1), + TRANSCEIVER_TXFAULT_ATTR_ID(2), + TRANSCEIVER_TXFAULT_ATTR_ID(3), + TRANSCEIVER_TXFAULT_ATTR_ID(4), + TRANSCEIVER_TXFAULT_ATTR_ID(5), + TRANSCEIVER_TXFAULT_ATTR_ID(6), + TRANSCEIVER_TXFAULT_ATTR_ID(7), + TRANSCEIVER_TXFAULT_ATTR_ID(8), + TRANSCEIVER_TXFAULT_ATTR_ID(9), + TRANSCEIVER_TXFAULT_ATTR_ID(10), + TRANSCEIVER_TXFAULT_ATTR_ID(11), + TRANSCEIVER_TXFAULT_ATTR_ID(12), + TRANSCEIVER_TXFAULT_ATTR_ID(13), + TRANSCEIVER_TXFAULT_ATTR_ID(14), + TRANSCEIVER_TXFAULT_ATTR_ID(15), + TRANSCEIVER_TXFAULT_ATTR_ID(16), + TRANSCEIVER_TXFAULT_ATTR_ID(17), + TRANSCEIVER_TXFAULT_ATTR_ID(18), + TRANSCEIVER_TXFAULT_ATTR_ID(19), + TRANSCEIVER_TXFAULT_ATTR_ID(20), + TRANSCEIVER_TXFAULT_ATTR_ID(21), + TRANSCEIVER_TXFAULT_ATTR_ID(22), + TRANSCEIVER_TXFAULT_ATTR_ID(23), + TRANSCEIVER_TXFAULT_ATTR_ID(24), + TRANSCEIVER_TXFAULT_ATTR_ID(25), + TRANSCEIVER_TXFAULT_ATTR_ID(26), + TRANSCEIVER_TXFAULT_ATTR_ID(27), + TRANSCEIVER_TXFAULT_ATTR_ID(28), + TRANSCEIVER_TXFAULT_ATTR_ID(29), + TRANSCEIVER_TXFAULT_ATTR_ID(30), + TRANSCEIVER_TXFAULT_ATTR_ID(31), + TRANSCEIVER_TXFAULT_ATTR_ID(32), + TRANSCEIVER_TXFAULT_ATTR_ID(33), + TRANSCEIVER_TXFAULT_ATTR_ID(34), + TRANSCEIVER_TXFAULT_ATTR_ID(35), + TRANSCEIVER_TXFAULT_ATTR_ID(36), + TRANSCEIVER_TXFAULT_ATTR_ID(37), + TRANSCEIVER_TXFAULT_ATTR_ID(38), + TRANSCEIVER_TXFAULT_ATTR_ID(39), + TRANSCEIVER_TXFAULT_ATTR_ID(40), + TRANSCEIVER_TXFAULT_ATTR_ID(41), + TRANSCEIVER_TXFAULT_ATTR_ID(42), + TRANSCEIVER_TXFAULT_ATTR_ID(43), + TRANSCEIVER_TXFAULT_ATTR_ID(44), + TRANSCEIVER_TXFAULT_ATTR_ID(45), + TRANSCEIVER_TXFAULT_ATTR_ID(46), + TRANSCEIVER_TXFAULT_ATTR_ID(47), + TRANSCEIVER_TXFAULT_ATTR_ID(48), +}; + +/* sysfs attributes for hwmon + */ +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_rxlos_all(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf); +static int as7312_54x_cpld_read_internal(struct i2c_client *client, u8 reg); +static int as7312_54x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value); + +/* transceiver attributes */ +#define DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index) +#define DECLARE_TRANSCEIVER_PRESENT_ATTR(index) &sensor_dev_attr_module_present_##index.dev_attr.attr + +#define DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IRUGO | S_IWUSR, show_status, set_reset, MODULE_RESET_##index) +#define DECLARE_TRANSCEIVER_RESET_ATTR(index) &sensor_dev_attr_module_reset_##index.dev_attr.attr + +#define DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_tx_disable_##index, S_IRUGO | S_IWUSR, show_status, set_tx_disable, MODULE_TXDISABLE_##index); \ + static SENSOR_DEVICE_ATTR(module_rx_los_##index, S_IRUGO, show_status, NULL, MODULE_RXLOS_##index); \ + static SENSOR_DEVICE_ATTR(module_tx_fault_##index, S_IRUGO, show_status, NULL, MODULE_TXFAULT_##index) +#define DECLARE_SFP_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_tx_disable_##index.dev_attr.attr, \ + &sensor_dev_attr_module_rx_los_##index.dev_attr.attr, \ + &sensor_dev_attr_module_tx_fault_##index.dev_attr.attr + +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); +/* transceiver attributes */ +static SENSOR_DEVICE_ATTR(module_present_all, S_IRUGO, show_present_all, NULL, MODULE_PRESENT_ALL); +static SENSOR_DEVICE_ATTR(module_rx_los_all, S_IRUGO, show_rxlos_all, NULL, MODULE_RXLOS_ALL); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(32); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(33); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(34); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(35); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(36); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(37); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(38); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(39); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(40); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(41); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(42); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(43); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(44); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(45); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(46); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(47); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(48); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(49); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(50); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(51); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(52); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(53); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(54); + +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(49); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(50); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(51); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(52); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(53); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(54); + +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(1); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(2); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(3); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(4); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(5); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(6); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(7); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(8); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(9); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(10); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(11); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(12); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(13); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(14); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(15); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(16); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(17); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(18); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(19); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(20); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(21); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(22); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(23); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(24); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(25); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(26); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(27); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(28); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(29); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(30); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(31); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(32); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(33); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(34); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(35); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(36); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(37); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(38); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(39); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(40); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(41); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(42); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(43); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(44); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(45); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(46); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(47); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(48); + +static struct attribute *as7312_54x_cpld1_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + NULL +}; + +static const struct attribute_group as7312_54x_cpld1_group = { + .attrs = as7312_54x_cpld1_attributes, +}; + +static struct attribute *as7312_54x_cpld2_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + &sensor_dev_attr_module_rx_los_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(1), + DECLARE_TRANSCEIVER_PRESENT_ATTR(2), + DECLARE_TRANSCEIVER_PRESENT_ATTR(3), + DECLARE_TRANSCEIVER_PRESENT_ATTR(4), + DECLARE_TRANSCEIVER_PRESENT_ATTR(5), + DECLARE_TRANSCEIVER_PRESENT_ATTR(6), + DECLARE_TRANSCEIVER_PRESENT_ATTR(7), + DECLARE_TRANSCEIVER_PRESENT_ATTR(8), + DECLARE_TRANSCEIVER_PRESENT_ATTR(9), + DECLARE_TRANSCEIVER_PRESENT_ATTR(10), + DECLARE_TRANSCEIVER_PRESENT_ATTR(11), + DECLARE_TRANSCEIVER_PRESENT_ATTR(12), + DECLARE_TRANSCEIVER_PRESENT_ATTR(13), + DECLARE_TRANSCEIVER_PRESENT_ATTR(14), + DECLARE_TRANSCEIVER_PRESENT_ATTR(15), + DECLARE_TRANSCEIVER_PRESENT_ATTR(16), + DECLARE_TRANSCEIVER_PRESENT_ATTR(17), + DECLARE_TRANSCEIVER_PRESENT_ATTR(18), + DECLARE_TRANSCEIVER_PRESENT_ATTR(19), + DECLARE_TRANSCEIVER_PRESENT_ATTR(20), + DECLARE_TRANSCEIVER_PRESENT_ATTR(21), + DECLARE_TRANSCEIVER_PRESENT_ATTR(22), + DECLARE_TRANSCEIVER_PRESENT_ATTR(23), + DECLARE_TRANSCEIVER_PRESENT_ATTR(24), + DECLARE_TRANSCEIVER_PRESENT_ATTR(49), + DECLARE_TRANSCEIVER_PRESENT_ATTR(50), + DECLARE_TRANSCEIVER_PRESENT_ATTR(51), + DECLARE_TRANSCEIVER_PRESENT_ATTR(52), + DECLARE_TRANSCEIVER_RESET_ATTR(49), + DECLARE_TRANSCEIVER_RESET_ATTR(50), + DECLARE_TRANSCEIVER_RESET_ATTR(51), + DECLARE_TRANSCEIVER_RESET_ATTR(52), + DECLARE_SFP_TRANSCEIVER_ATTR(1), + DECLARE_SFP_TRANSCEIVER_ATTR(2), + DECLARE_SFP_TRANSCEIVER_ATTR(3), + DECLARE_SFP_TRANSCEIVER_ATTR(4), + DECLARE_SFP_TRANSCEIVER_ATTR(5), + DECLARE_SFP_TRANSCEIVER_ATTR(6), + DECLARE_SFP_TRANSCEIVER_ATTR(7), + DECLARE_SFP_TRANSCEIVER_ATTR(8), + DECLARE_SFP_TRANSCEIVER_ATTR(9), + DECLARE_SFP_TRANSCEIVER_ATTR(10), + DECLARE_SFP_TRANSCEIVER_ATTR(11), + DECLARE_SFP_TRANSCEIVER_ATTR(12), + DECLARE_SFP_TRANSCEIVER_ATTR(13), + DECLARE_SFP_TRANSCEIVER_ATTR(14), + DECLARE_SFP_TRANSCEIVER_ATTR(15), + DECLARE_SFP_TRANSCEIVER_ATTR(16), + DECLARE_SFP_TRANSCEIVER_ATTR(17), + DECLARE_SFP_TRANSCEIVER_ATTR(18), + DECLARE_SFP_TRANSCEIVER_ATTR(19), + DECLARE_SFP_TRANSCEIVER_ATTR(20), + DECLARE_SFP_TRANSCEIVER_ATTR(21), + DECLARE_SFP_TRANSCEIVER_ATTR(22), + DECLARE_SFP_TRANSCEIVER_ATTR(23), + DECLARE_SFP_TRANSCEIVER_ATTR(24), + NULL +}; + +static const struct attribute_group as7312_54x_cpld2_group = { + .attrs = as7312_54x_cpld2_attributes, +}; + +static struct attribute *as7312_54x_cpld3_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + &sensor_dev_attr_module_rx_los_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(25), + DECLARE_TRANSCEIVER_PRESENT_ATTR(26), + DECLARE_TRANSCEIVER_PRESENT_ATTR(27), + DECLARE_TRANSCEIVER_PRESENT_ATTR(28), + DECLARE_TRANSCEIVER_PRESENT_ATTR(29), + DECLARE_TRANSCEIVER_PRESENT_ATTR(30), + DECLARE_TRANSCEIVER_PRESENT_ATTR(31), + DECLARE_TRANSCEIVER_PRESENT_ATTR(32), + DECLARE_TRANSCEIVER_PRESENT_ATTR(33), + DECLARE_TRANSCEIVER_PRESENT_ATTR(34), + DECLARE_TRANSCEIVER_PRESENT_ATTR(35), + DECLARE_TRANSCEIVER_PRESENT_ATTR(36), + DECLARE_TRANSCEIVER_PRESENT_ATTR(37), + DECLARE_TRANSCEIVER_PRESENT_ATTR(38), + DECLARE_TRANSCEIVER_PRESENT_ATTR(39), + DECLARE_TRANSCEIVER_PRESENT_ATTR(40), + DECLARE_TRANSCEIVER_PRESENT_ATTR(41), + DECLARE_TRANSCEIVER_PRESENT_ATTR(42), + DECLARE_TRANSCEIVER_PRESENT_ATTR(43), + DECLARE_TRANSCEIVER_PRESENT_ATTR(44), + DECLARE_TRANSCEIVER_PRESENT_ATTR(45), + DECLARE_TRANSCEIVER_PRESENT_ATTR(46), + DECLARE_TRANSCEIVER_PRESENT_ATTR(47), + DECLARE_TRANSCEIVER_PRESENT_ATTR(48), + DECLARE_TRANSCEIVER_PRESENT_ATTR(53), + DECLARE_TRANSCEIVER_PRESENT_ATTR(54), + DECLARE_TRANSCEIVER_RESET_ATTR(53), + DECLARE_TRANSCEIVER_RESET_ATTR(54), + DECLARE_SFP_TRANSCEIVER_ATTR(25), + DECLARE_SFP_TRANSCEIVER_ATTR(26), + DECLARE_SFP_TRANSCEIVER_ATTR(27), + DECLARE_SFP_TRANSCEIVER_ATTR(28), + DECLARE_SFP_TRANSCEIVER_ATTR(29), + DECLARE_SFP_TRANSCEIVER_ATTR(30), + DECLARE_SFP_TRANSCEIVER_ATTR(31), + DECLARE_SFP_TRANSCEIVER_ATTR(32), + DECLARE_SFP_TRANSCEIVER_ATTR(33), + DECLARE_SFP_TRANSCEIVER_ATTR(34), + DECLARE_SFP_TRANSCEIVER_ATTR(35), + DECLARE_SFP_TRANSCEIVER_ATTR(36), + DECLARE_SFP_TRANSCEIVER_ATTR(37), + DECLARE_SFP_TRANSCEIVER_ATTR(38), + DECLARE_SFP_TRANSCEIVER_ATTR(39), + DECLARE_SFP_TRANSCEIVER_ATTR(40), + DECLARE_SFP_TRANSCEIVER_ATTR(41), + DECLARE_SFP_TRANSCEIVER_ATTR(42), + DECLARE_SFP_TRANSCEIVER_ATTR(43), + DECLARE_SFP_TRANSCEIVER_ATTR(44), + DECLARE_SFP_TRANSCEIVER_ATTR(45), + DECLARE_SFP_TRANSCEIVER_ATTR(46), + DECLARE_SFP_TRANSCEIVER_ATTR(47), + DECLARE_SFP_TRANSCEIVER_ATTR(48), + NULL +}; + +static const struct attribute_group as7312_54x_cpld3_group = { + .attrs = as7312_54x_cpld3_attributes, +}; + +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i, status; + u8 values[4] = {0}; + u8 regs[] = {0x9, 0xA, 0xB, 0x18}; + struct i2c_client *client = to_i2c_client(dev); + struct as7312_54x_cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = as7312_54x_cpld_read_internal(client, regs[i]); + + if (status < 0) { + goto exit; + } + + values[i] = ~(u8)status; + } + + mutex_unlock(&data->update_lock); + + /* Return values 1 -> 54 in order */ + if (data->type == as7312_54x_cpld2) { + values[3] &= 0xF; + } + else { /* as7312_54x_cpld3 */ + values[3] &= 0x3; + } + + return sprintf(buf, "%.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], values[3]); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_rxlos_all(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i, status; + u8 values[3] = {0}; + u8 regs[] = {0x12, 0x13, 0x14}; + struct i2c_client *client = to_i2c_client(dev); + struct as7312_54x_cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = as7312_54x_cpld_read_internal(client, regs[i]); + + if (status < 0) { + goto exit; + } + + values[i] = (u8)status; + } + + mutex_unlock(&data->update_lock); + + /* Return values 1 -> 24 in order */ + return sprintf(buf, "%.2x %.2x %.2x\n", values[0], values[1], values[2]); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7312_54x_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0, revert = 0; + + switch (attr->index) { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + reg = 0x9; + mask = 0x1 << (attr->index - MODULE_PRESENT_1); + break; + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + reg = 0xA; + mask = 0x1 << (attr->index - MODULE_PRESENT_9); + break; + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + reg = 0xB; + mask = 0x1 << (attr->index - MODULE_PRESENT_17); + break; + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + reg = 0x9; + mask = 0x1 << (attr->index - MODULE_PRESENT_25); + break; + case MODULE_PRESENT_33 ... MODULE_PRESENT_40: + reg = 0xA; + mask = 0x1 << (attr->index - MODULE_PRESENT_33); + break; + case MODULE_PRESENT_41 ... MODULE_PRESENT_48: + reg = 0xB; + mask = 0x1 << (attr->index - MODULE_PRESENT_41); + break; + case MODULE_PRESENT_49: + reg = 0x18; + mask = 0x1; + break; + case MODULE_PRESENT_50: + reg = 0x18; + mask = 0x2; + break; + case MODULE_PRESENT_51: + reg = 0x18; + mask = 0x4; + break; + case MODULE_PRESENT_52: + reg = 0x18; + mask = 0x8; + break; + case MODULE_PRESENT_53: + reg = 0x18; + mask = 0x1; + break; + case MODULE_PRESENT_54: + reg = 0x18; + mask = 0x2; + break; + + case MODULE_RESET_49 ... MODULE_RESET_54: + reg = 0x17; + mask = 1 << ((attr->index - MODULE_PRESENT_49)%4); + break; + + case MODULE_TXFAULT_1 ... MODULE_TXFAULT_8: + reg = 0xC; + mask = 0x1 << (attr->index - MODULE_TXFAULT_1); + break; + case MODULE_TXFAULT_9 ... MODULE_TXFAULT_16: + reg = 0xD; + mask = 0x1 << (attr->index - MODULE_TXFAULT_9); + break; + case MODULE_TXFAULT_17 ... MODULE_TXFAULT_24: + reg = 0xE; + mask = 0x1 << (attr->index - MODULE_TXFAULT_17); + break; + case MODULE_TXFAULT_25 ... MODULE_TXFAULT_32: + reg = 0xC; + mask = 0x1 << (attr->index - MODULE_TXFAULT_25); + break; + case MODULE_TXFAULT_33 ... MODULE_TXFAULT_40: + reg = 0xD; + mask = 0x1 << (attr->index - MODULE_TXFAULT_33); + break; + case MODULE_TXFAULT_41 ... MODULE_TXFAULT_48: + reg = 0xE; + mask = 0x1 << (attr->index - MODULE_TXFAULT_41); + break; + case MODULE_TXDISABLE_1 ... MODULE_TXDISABLE_8: + reg = 0xF; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_1); + break; + case MODULE_TXDISABLE_9 ... MODULE_TXDISABLE_16: + reg = 0x10; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_9); + break; + case MODULE_TXDISABLE_17 ... MODULE_TXDISABLE_24: + reg = 0x11; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_17); + break; + case MODULE_TXDISABLE_25 ... MODULE_TXDISABLE_32: + reg = 0xF; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_25); + break; + case MODULE_TXDISABLE_33 ... MODULE_TXDISABLE_40: + reg = 0x10; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_33); + break; + case MODULE_TXDISABLE_41 ... MODULE_TXDISABLE_48: + reg = 0x11; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_41); + break; + case MODULE_RXLOS_1 ... MODULE_RXLOS_8: + reg = 0x12; + mask = 0x1 << (attr->index - MODULE_RXLOS_1); + break; + case MODULE_RXLOS_9 ... MODULE_RXLOS_16: + reg = 0x13; + mask = 0x1 << (attr->index - MODULE_RXLOS_9); + break; + case MODULE_RXLOS_17 ... MODULE_RXLOS_24: + reg = 0x14; + mask = 0x1 << (attr->index - MODULE_RXLOS_17); + break; + case MODULE_RXLOS_25 ... MODULE_RXLOS_32: + reg = 0x12; + mask = 0x1 << (attr->index - MODULE_RXLOS_25); + break; + case MODULE_RXLOS_33 ... MODULE_RXLOS_40: + reg = 0x13; + mask = 0x1 << (attr->index - MODULE_RXLOS_33); + break; + case MODULE_RXLOS_41 ... MODULE_RXLOS_48: + reg = 0x14; + mask = 0x1 << (attr->index - MODULE_RXLOS_41); + break; + default: + return 0; + } + + if (attr->index >= MODULE_PRESENT_1 && attr->index <= MODULE_PRESENT_54) { + revert = 1; + } + + mutex_lock(&data->update_lock); + status = as7312_54x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", revert ? !(status & mask) : !!(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7312_54x_cpld_data *data = i2c_get_clientdata(client); + long reset; + int status; + u8 reg = 0, mask = 0; + + status = kstrtol(buf, 10, &reset); + if (status) { + return status; + } + + switch (attr->index) { + case MODULE_RESET_49 ... MODULE_RESET_54: + reg = 0x17; + mask = 1 << ((attr->index - MODULE_RESET_49)%4); + break; + default: + return 0; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = as7312_54x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update reset status */ + if (reset) { + status |= mask; + } + else { + status &= ~mask; + } + status = as7312_54x_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + + + + +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7312_54x_cpld_data *data = i2c_get_clientdata(client); + long disable; + int status; + u8 reg = 0, mask = 0; + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + + switch (attr->index) { + case MODULE_TXDISABLE_1 ... MODULE_TXDISABLE_8: + reg = 0xF; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_1); + break; + case MODULE_TXDISABLE_9 ... MODULE_TXDISABLE_16: + reg = 0x10; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_9); + break; + case MODULE_TXDISABLE_17 ... MODULE_TXDISABLE_24: + reg = 0x11; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_17); + break; + case MODULE_TXDISABLE_25 ... MODULE_TXDISABLE_32: + reg = 0xF; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_25); + break; + case MODULE_TXDISABLE_33 ... MODULE_TXDISABLE_40: + reg = 0x10; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_33); + break; + case MODULE_TXDISABLE_41 ... MODULE_TXDISABLE_48: + reg = 0x11; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_41); + break; + default: + return 0; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = as7312_54x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update tx_disable status */ + if (disable) { + status |= mask; + } + else { + status &= ~mask; + } + + status = as7312_54x_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct as7312_54x_cpld_data *data = i2c_get_clientdata(client); + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = as7312_54x_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static void as7312_54x_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void as7312_54x_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static ssize_t show_version(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, 0x1); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d", val); +} + +/* + * I2C init/probing/exit functions + */ +static int as7312_54x_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + struct as7312_54x_cpld_data *data; + int ret = -ENODEV; + const struct attribute_group *group = NULL; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + goto exit; + + data = kzalloc(sizeof(struct as7312_54x_cpld_data), GFP_KERNEL); + if (!data) { + ret = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->type = id->driver_data; + + /* Register sysfs hooks */ + switch (data->type) { + case as7312_54x_cpld1: + group = &as7312_54x_cpld1_group; + break; + case as7312_54x_cpld2: + group = &as7312_54x_cpld2_group; + break; + case as7312_54x_cpld3: + group = &as7312_54x_cpld3_group; + break; + default: + break; + } + + if (group) { + ret = sysfs_create_group(&client->dev.kobj, group); + if (ret) { + goto exit_free; + } + } + + as7312_54x_cpld_add_client(client); + return 0; + +exit_free: + kfree(data); +exit: + return ret; +} + +static int as7312_54x_cpld_remove(struct i2c_client *client) +{ + struct as7312_54x_cpld_data *data = i2c_get_clientdata(client); + const struct attribute_group *group = NULL; + + as7312_54x_cpld_remove_client(client); + + /* Remove sysfs hooks */ + switch (data->type) { + case as7312_54x_cpld1: + group = &as7312_54x_cpld1_group; + break; + case as7312_54x_cpld2: + group = &as7312_54x_cpld2_group; + break; + case as7312_54x_cpld3: + group = &as7312_54x_cpld3_group; + break; + default: + break; + } + + if (group) { + sysfs_remove_group(&client->dev.kobj, group); + } + + kfree(data); + + return 0; +} + +static int as7312_54x_cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static int as7312_54x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +int as7312_54x_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as7312_54x_cpld_read_internal(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as7312_54x_cpld_read); + +int as7312_54x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as7312_54x_cpld_write_internal(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as7312_54x_cpld_write); + +static struct i2c_driver as7312_54x_cpld_driver = { + .driver = { + .name = "as7312_54x_cpld", + .owner = THIS_MODULE, + }, + .probe = as7312_54x_cpld_probe, + .remove = as7312_54x_cpld_remove, + .id_table = as7312_54x_cpld_id, +}; + +static int __init as7312_54x_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as7312_54x_cpld_driver); +} + +static void __exit as7312_54x_cpld_exit(void) +{ + i2c_del_driver(&as7312_54x_cpld_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("Accton I2C CPLD driver"); +MODULE_LICENSE("GPL"); + +module_init(as7312_54x_cpld_init); +module_exit(as7312_54x_cpld_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/ym2651y.c new file mode 120000 index 000000000000..f4d67640ccc3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/ym2651y.c @@ -0,0 +1 @@ +../../common/modules/ym2651y.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/service/as7312-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/service/as7312-platform-monitor.service new file mode 100755 index 000000000000..b79357665bed --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/service/as7312-platform-monitor.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS7312-54X Platform Monitoring service +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/local/bin/accton_as7312_util.py install +ExecStart=/usr/local/bin/accton_as7312_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/setup.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/setup.py new file mode 100755 index 000000000000..f0518d07689d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env pytho + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='as7312_54x', + version='1.0', + description='Module to initialize Accton AS7312-54X platforms', + + packages=['as7312_54x'], + package_dir={'as7312_54x': 'as7312-54x/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/README b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/README new file mode 100755 index 000000000000..66f31a030423 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/README @@ -0,0 +1,117 @@ +Copyright (C) 2016 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Contents of this package: + patch - files under patch/ is for kernel and ONIE installer + for the kernel: + config-accton-as7312_54x.patch + for kernel configuration. + driver-i2c-muxes-pca954x-always-deselect.patch + for i2c_mux deselects after transaction. + driver-patches-for-accton-as7312-fan-psu-cpld.patch + for as7312's fan/psu/cpld/led/sfp drivers. + for ONIE: + onie_installer-accton-AS7312-54X.patch + for console port setting and copy util script o rootfs. + module - Contains source code of as7312 kernel driver modules. + +The late Sonic building scripts, pushed @Dec 5 2016, will automatically +create a docker container and run building process under it. +User is not necessary to handle docker environment creation. + +1. Download sonic-buildimage environment. + - Run "git clone https://github.com/Azure/sonic-buildimage". + - cd to sonic-buildimage and run "git submodule update --init --recursive". +2. Build kernel + - cd ./src/sonic-linux-kernel + - Copy patches and series from patch/kernel of this release to + sonic-linux-kernel/patch. + - Build kernel by "make". + - The built kernel package, linux-image-3.16.0-5-amd64_3.16.51-3+deb8u1_amd64.deb + , is generated. +3. Build installer + - Change directory back to sonic-buildimage/. + - Get onie_installer-accton-AS7312-54X.patch" from patch/installer. + - Change setting for AS7312-54X by patching build_image.sh. + "patch -p1 < onie_installer-accton-AS7312-54X.patch" + !!NOTICE, patching onie_installer-accton-AS7312-54X.patch comments out the + "git status" checking at build_image.sh. + - The account and password of installed OS can be given at rules/config. + The default user and password are "admin" & "YourPaSsWoRd" respectively. + - Run "make configure PLATFORM=broadcom" + - Copy the built kernel debian package to target/debs/. + The file is linux-image-3.16.0-5-amd64_*_amd64.deb under directory + src/sonic-linux-kernel/. + - Run "make target/sonic-generic.bin" + - Get the installer, target/sonic-generic.bin, to target machine and install. + +All Linux kernel code is licensed under the GPLv1. All other code is +licensed under the GPLv3. Please see the LICENSE file for copies of +both licenses. + +The code for integacting with Accton AS7312-54X has 2 parts, +kernel drivers and operational script. +The kernel drivers of peripherals are under module/ directory. +1. These drivers are patched into kernel by + driver-patches-for-accton-as7312-fan-psu-cpld.patch + Or you can build the driver under module/ by setting environment variable, + KERNEL_SRC, to proper linux built directory and run make. + It may be sonic-linux-kernel/linux-3.*/debian/build/build_amd64_none_amd64/. +2. A operational script, accton_as7312_util.py, for device initializatian and + peripheral accessing should be installed at /usr/bin. + This script is generated by onie_installer-accton-AS7312-54X.patch. + It's done by patching onie_installer-accton-AS7312-54X.patch at build-image. + Run "accton_as7312_util.py install" to install drivers. + +To initialize the system, run "accton_as7312_util.py install". +To clean up the drivers & devices, run "accton_as7312_util.py clean". +To dump information of sensors, run "accton_as7312_util.py show". +To dump SFP EEPROM, run "accton_as7312_util.py sff". +To set fan speed, run "accton_as7312_util.py set fan". +To enable/disable SFP emission, run "accton_as7312_util.py set sfp". +To set system LEDs' color, run "accton_as7312_util.py set led" +For more information, run "accton_as7312_util.py --help". + +==================================================================== +Besides applying accton_as7312_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +System LED: + There are 5 system LEDs at the lower-left corner of front panel. + They are loc, diag, fan, ps1, and ps2. + The sysfs interface color mappings are as follows: + Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + But not all colors are available for each LED. + +Fan Control: + There are 10 fans inside 5 fan modules. + All fans share 1 duty setting, ranged from 0~100. + +Thermal sensers: + 3 temperature sensors are controlled by the lm75 kernel modules. + +PSUs: + There 2 power supplies slot at the left/right side of the back. + Once if a PSU is not plugged, the status of it is shown failed. + +There are 48 SFP+ and 6 QSFP modules are equipped. +Before operating on PSU and QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py new file mode 100755 index 000000000000..bdab0d4b8bff --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py @@ -0,0 +1,208 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# 2/27/2018: Roy Lee modify for as7312_54x +# ------------------------------------------------------------------ + +try: + import os + import sys, getopt + import subprocess + import click + import imp + import logging + import logging.config + import types + import time # this is only being used as part of the example + import traceback + from tabulate import tabulate + from as7312_54x.fanutil import FanUtil + from as7312_54x.thermalutil import ThermalUtil +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = 'accton_as7312_monitor' + +global log_file +global log_level + +# (LM75_1+ LM75_2+ LM75_3) is LM75 at i2c addresses 0x48, 0x49, and 0x4A. +# TMP = (LM75_1+ LM75_2+ LM75_3)/3 +#1. If TMP < 35, All fans run with duty 31.25%. +#2. If TMP>=35 or the temperature of any one of fan is higher than 40, +# All fans run with duty 50% +#3. If TMP >= 40 or the temperature of any one of fan is higher than 45, +# All fans run with duty 62.5%. +#4. If TMP >= 45 or the temperature of any one of fan is higher than 50, +# All fans run with duty 100%. +#5. Any one of 6 fans is fault, set duty = 100%. +#6. Direction factor. If it is B2F direction, duty + 12%. + + # MISC: + # 1.Check single LM75 before applied average. + # 2.If no matched fan speed is found from the policy, + # use FAN_DUTY_CYCLE_MIN as default speed + # Get current temperature + # 4.Decision 3: Decide new fan speed depend on fan direction/current fan speed/temperature + + + + +# Make a class we can use to capture stdout and sterr in the log +class accton_as7312_monitor(object): + # static temp var + _ori_temp = 0 + _new_perc = 0 + _ori_perc = 0 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_fans(self): + max_duty = 100 + fan_policy_f2b = { + 0: [32, 0, 105000], + 1: [50, 105000, 120000], + 2: [63, 120000, 135000], + 3: [max_duty, 135000, sys.maxsize], + } + fan_policy_b2f = { + 0: [44, 0, 105000], + 1: [63, 105000, 120000], + 2: [75, 120000, 135000], + 3: [max_duty, 135000, sys.maxsize], + } + fan_policy_single = { + 0: 40000, + 1: 45000, + 2: 50000, + } + + thermal = ThermalUtil() + fan = FanUtil() + for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): + fan_status = fan.get_fan_status(x) + if fan_status is None: + logging.debug('INFO. SET new_perc to %d (FAN stauts is None. fan_num:%d)', max_duty, x) + return False + if fan_status is False: + logging.debug('INFO. SET new_perc to %d (FAN fault. fan_num:%d)', max_duty, x) + fan.set_fan_duty_cycle(max_duty) + return True + #logging.debug('INFO. fan_status is True (fan_num:%d)', x) + + fan_dir=fan.get_fan_dir(1) + if fan_dir == 1: + fan_policy = fan_policy_f2b + else: + fan_policy = fan_policy_b2f + + #Decide fan duty by if any of sensors > fan_policy_single. + new_duty_cycle = fan_policy[0][0] + for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): + single_thm = thermal._get_thermal_node_val(x) + for y in range(0, len(fan_policy_single)): + if single_thm > fan_policy_single[y]: + if fan_policy[y+1][0] > new_duty_cycle: + new_duty_cycle = fan_policy[y+1][0] + logging.debug('INFO. Single thermal sensor %d with temp %d > %d , new_duty_cycle=%d', + x, single_thm, fan_policy_single[y], new_duty_cycle) + single_result = new_duty_cycle + + + #Find if current duty matched any of define duty. + #If not, set it to highest one. + cur_duty_cycle = fan.get_fan_duty_cycle() + for x in range(0, len(fan_policy)): + if cur_duty_cycle == fan_policy[x][0]: + break + if x == len(fan_policy) : + fan.set_fan_duty_cycle(fan_policy[0][0]) + cur_duty_cycle = max_duty + + #Decide fan duty by if sum of sensors falls into any of fan_policy{} + get_temp = thermal.get_thermal_temp() + new_duty_cycle = cur_duty_cycle + for x in range(0, len(fan_policy)): + y = len(fan_policy) - x -1 #checked from highest + if get_temp > fan_policy[y][1] and get_temp < fan_policy[y][2] : + new_duty_cycle= fan_policy[y][0] + logging.debug('INFO. Sum of temp %d > %d , new_duty_cycle=%d', get_temp, fan_policy[y][1], new_duty_cycle) + + sum_result = new_duty_cycle + if (sum_result>single_result): + new_duty_cycle = sum_result; + else: + new_duty_cycle = single_result + + logging.debug('INFO. Final duty_cycle=%d', new_duty_cycle) + if(new_duty_cycle != cur_duty_cycle): + fan.set_fan_duty_cycle(new_duty_cycle) + return True + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['lfile=']) + except getopt.GetoptError: + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + monitor = accton_as7312_monitor(log_file, log_level) + + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(10) + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py new file mode 100755 index 000000000000..b8107c47afea --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py @@ -0,0 +1,588 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'as7312_54x' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan':6,'thermal':4, 'psu':2, 'sfp':54} +FORCE = 0 +#logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +#logging.basicConfig(level=logging.INFO) + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-54 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-54 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + +kos = [ +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x force_deselect_on_exit=1', +'modprobe accton_i2c_cpld' , +'modprobe ym2651y' , +'modprobe accton_as7312_54x_fan' , +'modprobe optoe' , +'modprobe accton_as7312_54x_leds' , +'modprobe accton_as7312_54x_psu' ] + +def driver_install(): + global FORCE + status, output = log_os_system("depmod", 1) + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + lst = rm.split(" ") + if len(lst) > 3: + del(lst[3]) + rm = " ".join(lst) + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +led_prefix ='/sys/class/leds/accton_'+PROJECT_NAME+'_led::' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2']} +hwmon_nodes = {'led': ['brightness'] } +hwmon_prefix ={'led': led_prefix} + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'fan': ['2-0066'] , + 'thermal': ['3-0048','3-0049', '3-004a', '3-004b'] , + 'psu': ['10-0051','11-0053'], + 'sfp': ['-0050']} +i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'] , + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['sfp_is_present', 'sfp_tx_disable']} + +sfp_map = [18,19,20,21,22,23,24,25,26,27, + 28,29,30,31,32,33,34,35,36,37, + 38,39,40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55,56,57, + 58,59,60,61,62,63,64,65,66,67, + 68,69,70,71] + +qsfp_start = 48 + +mknod =[ +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-0/new_device' , +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-1/new_device' , +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-1/new_device' , +'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', + +'echo as7312_54x_fan 0x66 > /sys/bus/i2c/devices/i2c-2/new_device ', +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-3/new_device', +'echo as7312_54x_psu1 0x53 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo ym2651 0x5b > /sys/bus/i2c/devices/i2c-11/new_device', +'echo as7312_54x_psu2 0x50 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo ym2651 0x58 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo as7312_54x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-4/new_device', +'echo as7312_54x_cpld2 0x62 > /sys/bus/i2c/devices/i2c-5/new_device', +'echo as7312_54x_cpld3 0x64 > /sys/bus/i2c/devices/i2c-6/new_device'] + +mknod2 =[ +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-1/new_device' , +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-0/new_device' , +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-0/new_device' , +'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-0/new_device', + +'echo as7312_54x_fan 0x66 > /sys/bus/i2c/devices/i2c-2/new_device ', +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-3/new_device', +'echo as7312_54x_psu1 0x53 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo ym2651 0x5b > /sys/bus/i2c/devices/i2c-11/new_device', +'echo as7312_54x_psu2 0x50 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo ym2651 0x58 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo as7312_54x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-4/new_device', +'echo as7312_54x_cpld2 0x62 > /sys/bus/i2c/devices/i2c-5/new_device', +'echo as7312_54x_cpld3 0x64 > /sys/bus/i2c/devices/i2c-6/new_device'] + + + +def i2c_order_check(): + # i2c bus 0 and 1 might be installed in different order. + # Here check if 0x70 is exist @ i2c-1 + tmp = "echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device" + status, output = log_os_system(tmp, 0) + if not device_exist(): + order = 1 + else: + order = 0 + tmp = "echo 0x70 > /sys/bus/i2c/devices/i2c-1/delete_device" + status, output = log_os_system(tmp, 0) + return order + +def device_install(): + global FORCE + + order = i2c_order_check() + + # if 0x70 is not exist @i2c-1, use reversed bus order + if order: + for i in range(0,len(mknod2)): + #for pca954x need times to built new i2c buses + if mknod2[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod2[i], 1) + if status: + print output + if FORCE == 0: + return status + else: + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + for i in range(0,len(sfp_map)): + if i < qsfp_start: + status, output =log_os_system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + else: + status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/1-0076", 0) + if status==0: + I2C_ORDER=1 + else: + I2C_ORDER=0 + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + if I2C_ORDER==0: + nodelist = mknod + else: + nodelist = mknod2 + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'sfp_eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan'] ['fan1'][0] + node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0070", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py new file mode 100755 index 000000000000..06ebbb777920 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# 3/32/2018: Roy Lee modify for as7326_56x +# ------------------------------------------------------------------ + +try: + import time + import logging + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class FanUtil(object): + """Platform-specific FanUtil class""" + + FAN_NUM_ON_MAIN_BROAD = 6 + FAN_NUM_1_IDX = 1 + FAN_NUM_2_IDX = 2 + FAN_NUM_3_IDX = 3 + FAN_NUM_4_IDX = 4 + FAN_NUM_5_IDX = 5 + FAN_NUM_6_IDX = 6 + + FAN_NODE_NUM_OF_MAP = 2 + FAN_NODE_FAULT_IDX_OF_MAP = 1 + #FAN_NODE_SPEED_IDX_OF_MAP = 2 + FAN_NODE_DIR_IDX_OF_MAP = 2 + #FAN_NODE_DUTY_IDX_OF_MAP = 4 + #FANR_NODE_FAULT_IDX_OF_MAP = 5 + + BASE_VAL_PATH = '/sys/bus/i2c/devices/11-0066/{0}' + FAN_DUTY_PATH = '/sys/bus/i2c/devices/11-0066/fan_duty_cycle_percentage' + + #logfile = '' + #loglevel = logging.INFO + + """ Dictionary where + key1 = fan id index (integer) starting from 1 + key2 = fan node index (interger) starting from 1 + value = path to fan device file (string) """ + _fan_to_device_path_mapping = {} + +#fan1_direction +#fan1_fault +#fan1_present + + #(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage', + _fan_to_device_node_mapping = { + (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault', + (FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction', + + (FAN_NUM_2_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan2_fault', + (FAN_NUM_2_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan2_direction', + + (FAN_NUM_3_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan3_fault', + (FAN_NUM_3_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan3_direction', + + (FAN_NUM_4_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan4_fault', + (FAN_NUM_4_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan4_direction', + + (FAN_NUM_5_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan5_fault', + (FAN_NUM_5_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan5_direction', + + (FAN_NUM_6_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan6_fault', + (FAN_NUM_6_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan6_direction', + } + + def _get_fan_to_device_node(self, fan_num, node_num): + return self._fan_to_device_node_mapping[(fan_num, node_num)] + + def _get_fan_node_val(self, fan_num, node_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + + try: + val_file = open(device_path, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + def _set_fan_node_val(self, fan_num, node_num, val): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + content = str(val) + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'w') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + val_file.write(content) + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return True + + def __init__(self): + fan_path = self.BASE_VAL_PATH + + for fan_num in range(self.FAN_NUM_1_IDX, self.FAN_NUM_ON_MAIN_BROAD+1): + for node_num in range(self.FAN_NODE_FAULT_IDX_OF_MAP, self.FAN_NODE_NUM_OF_MAP+1): + self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path.format( + self._fan_to_device_node_mapping[(fan_num, node_num)]) + + def get_num_fans(self): + return self.FAN_NUM_ON_MAIN_BROAD + + def get_idx_fan_start(self): + return self.FAN_NUM_1_IDX + + def get_num_nodes(self): + return self.FAN_NODE_NUM_OF_MAP + + def get_idx_node_start(self): + return self.FAN_NODE_FAULT_IDX_OF_MAP + + def get_size_node_map(self): + return len(self._fan_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._fan_to_device_path_mapping) + + def get_fan_to_device_path(self, fan_num, node_num): + return self._fan_to_device_path_mapping[(fan_num, node_num)] + + def get_fan_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP) + + #def get_fan_speed(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP) + + def get_fan_dir(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP) + + def get_fan_duty_cycle(self): + #duty_path = self.FAN_DUTY_PATH + try: + val_file = open(self.FAN_DUTY_PATH) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + return int(content) + #self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP) +#static u32 reg_val_to_duty_cycle(u8 reg_val) +#{ +# reg_val &= FAN_DUTY_CYCLE_REG_MASK; +# return ((u32)(reg_val+1) * 625 + 75)/ 100; +#} +# + def set_fan_duty_cycle(self, val): + + try: + fan_file = open(self.FAN_DUTY_PATH, 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + #val = ((val + 1 ) * 625 +75 ) / 100 + fan_file.write(str(val)) + fan_file.close() + return True + + #def get_fanr_fault(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP) + + def get_fanr_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP) + + def get_fan_status(self, fan_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num, %d', fan_num) + return None + + if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0: + logging.debug('GET. FAN fault. fan_num, %d', fan_num) + return False + + #if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0: + # logging.debug('GET. FANR fault. fan_num, %d', fan_num) + # return False + + return True + +#def main(): +# fan = FanUtil() +# +# print 'get_size_node_map : %d' % fan.get_size_node_map() +# print 'get_size_path_map : %d' % fan.get_size_path_map() +# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): +# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1): +# print fan.get_fan_to_device_path(x, y) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py new file mode 100755 index 000000000000..e4329b8b9783 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018:Jostar modify for as7716_32x +# 3/23/2018: Roy Lee modify for as7326_56x +# ------------------------------------------------------------------ + +try: + import time + import logging + import glob + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class ThermalUtil(object): + """Platform-specific ThermalUtil class""" + + THERMAL_NUM_ON_MAIN_BROAD = 3 + THERMAL_NUM_1_IDX = 1 # 1_ON_MAIN_BROAD + THERMAL_NUM_2_IDX = 2 # 2_ON_MAIN_BROAD + THERMAL_NUM_3_IDX = 3 # 3_ON_MAIN_BROAD + + BASE_VAL_PATH = '/sys/bus/i2c/devices/{0}-00{1}/hwmon/hwmon*/temp1_input' + + """ Dictionary where + key1 = thermal id index (integer) starting from 1 + value = path to fan device file (string) """ + _thermal_to_device_path_mapping = {} + + _thermal_to_device_node_mapping = { + THERMAL_NUM_1_IDX: ['15', '48'], + THERMAL_NUM_2_IDX: ['15', '49'], + THERMAL_NUM_3_IDX: ['15', '4a'], + } + + def __init__(self): + thermal_path = self.BASE_VAL_PATH + + for x in range(self.THERMAL_NUM_1_IDX, self.THERMAL_NUM_ON_MAIN_BROAD+1): + self._thermal_to_device_path_mapping[x] = thermal_path.format( + self._thermal_to_device_node_mapping[x][0], + self._thermal_to_device_node_mapping[x][1]) + + def _get_thermal_node_val(self, thermal_num): + if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. thermal_num, %d', thermal_num) + return None + + device_path = self.get_thermal_to_device_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + + def get_num_thermals(self): + return self.THERMAL_NUM_ON_MAIN_BROAD + + def get_idx_thermal_start(self): + return self.THERMAL_NUM_1_IDX + + def get_size_node_map(self): + return len(self._thermal_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._thermal_to_device_path_mapping) + + def get_thermal_to_device_path(self, thermal_num): + return self._thermal_to_device_path_mapping[thermal_num] + + def get_thermal_1_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + + def get_thermal_2_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) + def get_thermal_temp(self): + return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX)) + +#def main(): +# thermal = ThermalUtil() +# +# print 'get_size_node_map : %d' % thermal.get_size_node_map() +# print 'get_size_path_map : %d' % thermal.get_size_path_map() +# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): +# print thermal.get_thermal_to_device_path(x) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/Makefile new file mode 100755 index 000000000000..85c066571c2f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/Makefile @@ -0,0 +1,17 @@ +ifneq ($(KERNELRELEASE),) +obj-m:= accton_i2c_cpld.o \ + accton_as7326_56x_fan.o accton_as7326_56x_leds.o \ + accton_as7326_56x_psu.o ym2651y.o + +else +ifeq (,$(KERNEL_SRC)) +$(error KERNEL_SRC is not defined) +else +KERNELDIR:=$(KERNEL_SRC) +endif +PWD:=$(shell pwd) +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + rm -rf *.o *.mod.o *.mod.o *.ko .*cmd .tmp_versions Module.markers Module.symvers modules.order +endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_fan.c new file mode 100755 index 000000000000..606019f3ea44 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_fan.c @@ -0,0 +1,815 @@ +/* + * A hwmon driver for the Accton as7326 56x fan + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as7326_56x_fan" + +#define NUM_THERMAL_SENSORS (3) /* Get sum of this number of sensors.*/ +#define THERMAL_SENSORS_DRIVER "lm75" +#define THERMAL_SENSORS_ADDRS {0x48, 0x49, 0x4a} + +#define IN +#define OUT + +static struct as7326_56x_fan_data *as7326_56x_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x0F, /* fan 1-6 present status */ + 0x10, /* fan 1-6 direction(0:F2B 1:B2F) */ + 0x11, /* fan PWM(for all fan) */ + 0x12, /* front fan 1 speed(rpm) */ + 0x13, /* front fan 2 speed(rpm) */ + 0x14, /* front fan 3 speed(rpm) */ + 0x15, /* front fan 4 speed(rpm) */ + 0x16, /* front fan 5 speed(rpm) */ + 0x17, /* front fan 6 speed(rpm) */ + 0x22, /* rear fan 1 speed(rpm) */ + 0x23, /* rear fan 2 speed(rpm) */ + 0x24, /* rear fan 3 speed(rpm) */ + 0x25, /* rear fan 4 speed(rpm) */ + 0x26, /* rear fan 5 speed(rpm) */ + 0x27, /* rear fan 6 speed(rpm) */ +}; + +/* Each client has this additional data */ +struct as7326_56x_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ + u8 enable; + int system_temp; /*In unit of mini-Celsius*/ + int sensors_found; +}; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID, + FAN6_ID +}; + +enum sysfs_fan_attributes { + FAN_PRESENT_REG, + FAN_DIRECTION_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN6_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN6_REAR_SPEED_RPM, + FAN1_DIRECTION, + FAN2_DIRECTION, + FAN3_DIRECTION, + FAN4_DIRECTION, + FAN5_DIRECTION, + FAN6_DIRECTION, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN6_PRESENT, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, + FAN6_FAULT +}; + +/* Define attributes + */ +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT);\ + static SENSOR_DEVICE_ATTR(fan##index2##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index, index2) &sensor_dev_attr_fan##index##_fault.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_fault.dev_attr.attr + +#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO, fan_show_value, NULL, FAN##index##_DIRECTION) +#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index##_enable, S_IWUSR | S_IRUGO, get_enable, set_enable, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan_duty_cycle_percentage.dev_attr.attr, \ + &sensor_dev_attr_pwm##index.dev_attr.attr, \ + &sensor_dev_attr_pwm##index##_enable.dev_attr.attr + +#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ + static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr + + +#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) +#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index2##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index, index2) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_input.dev_attr.attr + +/* 6 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(6,16); +/* 6 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(6,16); +/* 6 fan present attributes in this platform */ +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(5); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(6); +/* 6 fan direction attribute in this platform */ +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(1); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(2); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(3); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(4); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); +/* System temperature for fancontrol */ +DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); + +static struct attribute *as7326_56x_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_FAULT_ATTR(1,11), + DECLARE_FAN_FAULT_ATTR(2,12), + DECLARE_FAN_FAULT_ATTR(3,13), + DECLARE_FAN_FAULT_ATTR(4,14), + DECLARE_FAN_FAULT_ATTR(5,15), + DECLARE_FAN_FAULT_ATTR(6,16), + DECLARE_FAN_SPEED_RPM_ATTR(1,11), + DECLARE_FAN_SPEED_RPM_ATTR(2,12), + DECLARE_FAN_SPEED_RPM_ATTR(3,13), + DECLARE_FAN_SPEED_RPM_ATTR(4,14), + DECLARE_FAN_SPEED_RPM_ATTR(5,15), + DECLARE_FAN_SPEED_RPM_ATTR(6,16), + DECLARE_FAN_PRESENT_ATTR(1), + DECLARE_FAN_PRESENT_ATTR(2), + DECLARE_FAN_PRESENT_ATTR(3), + DECLARE_FAN_PRESENT_ATTR(4), + DECLARE_FAN_PRESENT_ATTR(5), + DECLARE_FAN_PRESENT_ATTR(6), + DECLARE_FAN_DIRECTION_ATTR(1), + DECLARE_FAN_DIRECTION_ATTR(2), + DECLARE_FAN_DIRECTION_ATTR(3), + DECLARE_FAN_DIRECTION_ATTR(4), + DECLARE_FAN_DIRECTION_ATTR(5), + DECLARE_FAN_DIRECTION_ATTR(6), + DECLARE_FAN_DUTY_CYCLE_ATTR(1), + DECLARE_FAN_SYSTEM_TEMP_ATTR(), + NULL +}; + +#define FAN_DUTY_CYCLE_REG_MASK 0xF +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100 + +static int as7326_56x_fan_read_value(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int as7326_56x_fan_write_value(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + reg_val &= FAN_DUTY_CYCLE_REG_MASK; + return ((u32)(reg_val+1) * 625 + 75)/ 100; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + return ((u32)duty_cycle * 100 / 625) - 1; +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_direction(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 1 : 0; +} +static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 0 : 1; +} + +static u8 is_fan_fault(struct as7326_56x_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = FAN1_FRONT_SPEED_RPM + id; + int rear_fan_index = FAN1_REAR_SPEED_RPM + id; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + ret = 0; + } + + return ret; +} + +static ssize_t set_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct as7326_56x_fan_data *data = as7326_56x_fan_update_device(dev); + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 1) + return -EINVAL; + + data->enable = value; + if (value == 0) + { + return set_duty_cycle(dev, da, buf, FAN_MAX_DUTY_CYCLE); + } + return count; +} + + +static ssize_t get_enable(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7326_56x_fan_data *data = as7326_56x_fan_update_device(dev); + + return sprintf(buf, "%u\n", data->enable); +} +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0) + return -EINVAL; + + value = (value > FAN_MAX_DUTY_CYCLE)? FAN_MAX_DUTY_CYCLE : value; + + as7326_56x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ + as7326_56x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + return count; +} + +/* Due to this struct is declared at lm75.c, it cannot be include + * under Sonic environment. I duplicate it from lm75.c. + */ +struct lm75_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct thermal_zone_device *tz; + struct mutex update_lock; + u8 orig_conf; + u8 resolution; /* In bits, between 9 and 12 */ + u8 resolution_limits; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + unsigned long sample_time; /* In jiffies */ + s16 temp[3]; /* Register values, + 0 = input + 1 = max + 2 = hyst */ +}; + +/*Copied from lm75.c*/ +static inline long lm75_reg_to_mc(s16 temp, u8 resolution) +{ + return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); +} + +/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ +static struct device * get_hwmon_dev( + struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if(data) + { + if( data->valid == 1 && data->hwmon_dev) + { + return data->hwmon_dev; + } + + } + return NULL; +} + +/* To find hwmon index by opening hwmon under that i2c address. + */ +static int find_hwmon_index_by_FileOpen( + int bus_nr, + unsigned short addr, + OUT int *index) +{ +#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ + struct file *sfd; + char client_name[96]; + int i=0; + + do { + snprintf(client_name, sizeof(client_name), + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + + sfd = filp_open(client_name, O_RDONLY, 0); + i++; + } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); + + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); + return -ENOENT; + } + filp_close(sfd, 0); + *index = i - 1; + return 0; + +#undef MAX_HWMON_DEVICE +} + +static int get_temp_file_path( + int bus_nr, unsigned short addr, + struct device *hwmon_dev + ,char *path, int max_len) +{ + + if(hwmon_dev && strlen(dev_name(hwmon_dev))) + { + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", + bus_nr, addr, dev_name(hwmon_dev)); + } + else + { + int i=0; + if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) + { + return -EIO; + } + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + } + return 0; +} + +/*File read the dev file at user space.*/ +static int read_devfile_temp1_input( + struct device *dev, + int bus_nr, + unsigned short addr, + struct device *hwmon_dev, + int *miniCelsius) +{ + struct file *sfd; + char buffer[96]; + char devfile[96]; + int rc, status; + int rdlen, value; + mm_segment_t old_fs; + + rc = 0; + get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); + sfd = filp_open(devfile, O_RDONLY, 0); + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); + return -ENOENT; + } + dev_dbg(dev, "Found device:%s\n",devfile); + + if(!(sfd->f_op) || !(sfd->f_op->read) ) { + pr_err("file %s cann't readable ?\n",devfile); + return -ENOENT; + } + + old_fs = get_fs(); + set_fs(KERNEL_DS); + rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); + if (rdlen == 0) { + pr_err( "File(%s) empty!\n", devfile); + rc = -EIO; + goto exit; + } + status = sscanf(buffer, "%d", &value); + if (status != 1) { + rc = -EIO; + goto exit; + } + *miniCelsius = value; + dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); + +exit: + set_fs(old_fs); + filp_close(sfd, 0); + return rc; +} + +static u8 is_lm75_data_due(struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if (time_after(jiffies, data->last_updated + data->sample_time)) + { + return 1; + } + return 0; +} +static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); + + return 0; +} + +static bool lm75_addr_mached(unsigned short addr) +{ + int i; + unsigned short addrs[] = THERMAL_SENSORS_ADDRS; + + for (i = 0; i < ARRAY_SIZE(addrs); i++) + { + if( addr == addrs[i]) + return 1; + } + return 0; +} + +static int _find_lm75_device(struct device *dev, void *data) +{ + struct device_driver *driver; + struct as7326_56x_fan_data *prv = data; + char *driver_name = THERMAL_SENSORS_DRIVER; + + driver = dev->driver; + if (driver && driver->name && + strcmp(driver->name, driver_name) == 0) + { + struct i2c_client *client; + client = to_i2c_client(dev); + if (client) + { + /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ + struct i2c_adapter *adap = client->adapter; + int miniCelsius = 0; + + if (! lm75_addr_mached(client->addr)) + { + return 0; + } + + if (!adap) { + return -ENXIO; + } + + /* If the data is not updated, read them from devfile + to drive them updateing data from chip.*/ + if (is_lm75_data_due(client)) + { + struct device *hwmon_dev; + + hwmon_dev = get_hwmon_dev(client); + if(0 == read_devfile_temp1_input(dev, adap->nr, + client->addr, hwmon_dev, &miniCelsius)) + { + prv->system_temp += miniCelsius; + prv->sensors_found++; + } + + } + else + { + get_lm75_temp(client, &miniCelsius); + prv->system_temp += miniCelsius; + prv->sensors_found++; + + } + } + } + return 0; +} + +/*Find all lm75 devices and return sum of temperatures.*/ +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + ssize_t ret = 0; + struct as7326_56x_fan_data *data = as7326_56x_fan_update_device(dev); + + data->system_temp=0; + data->sensors_found=0; + i2c_for_each_dev(data, _find_lm75_device); + if (NUM_THERMAL_SENSORS != data->sensors_found) + { + dev_dbg(dev,"only %d of %d temps are found\n", + data->sensors_found, NUM_THERMAL_SENSORS); + data->system_temp = INT_MAX; + } + ret = sprintf(buf, "%d\n",data->system_temp); + return ret; +} + +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7326_56x_fan_data *data = as7326_56x_fan_update_device(dev); + ssize_t ret = 0; + + if (data->valid) { + switch (attr->index) { + case FAN_DUTY_CYCLE_PERCENTAGE: + { + u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + ret = sprintf(buf, "%d\n", + reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], + attr->index - FAN1_PRESENT)); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + case FAN6_DIRECTION: + ret = sprintf(buf, "%d\n", + reg_val_to_direction(data->reg_val[FAN_DIRECTION_REG], + attr->index - FAN1_DIRECTION)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group as7326_56x_fan_group = { + .attrs = as7326_56x_fan_attributes, +}; + +static struct as7326_56x_fan_data *as7326_56x_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7326_56x_fan_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + dev_dbg(&client->dev, "Starting as7326_56x_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + int status = as7326_56x_fan_read_value(client, fan_reg[i]); + + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int as7326_56x_fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7326_56x_fan_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7326_56x_fan_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->enable = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7326_56x_fan_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: fan '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7326_56x_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7326_56x_fan_remove(struct i2c_client *client) +{ + struct as7326_56x_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7326_56x_fan_group); + + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; + +static const struct i2c_device_id as7326_56x_fan_id[] = { + { "as7326_56x_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7326_56x_fan_id); + +static struct i2c_driver as7326_56x_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = as7326_56x_fan_probe, + .remove = as7326_56x_fan_remove, + .id_table = as7326_56x_fan_id, + .address_list = normal_i2c, +}; + +static int __init as7326_56x_fan_init(void) +{ + return i2c_add_driver(&as7326_56x_fan_driver); +} + +static void __exit as7326_56x_fan_exit(void) +{ + i2c_del_driver(&as7326_56x_fan_driver); +} + +module_init(as7326_56x_fan_init); +module_exit(as7326_56x_fan_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7326_56x_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c new file mode 100644 index 000000000000..4cb7f1fa25a5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c @@ -0,0 +1,438 @@ +/* + * A LED driver for the accton_as7326_56x_led + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern int as7326_56x_cpld_read (unsigned short cpld_addr, u8 reg); +extern int as7326_56x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "accton_as7326_56x_led" + +struct accton_as7326_56x_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[1]; /* only 1 register*/ +}; + +static struct accton_as7326_56x_led_data *ledctl = NULL; + +/* LED related data + */ + +#define LED_CNTRLER_I2C_ADDRESS (0x60) + +#define LED_TYPE_DIAG_REG_MASK (0x3) +#define LED_MODE_DIAG_GREEN_VALUE (0x02) +#define LED_MODE_DIAG_RED_VALUE (0x01) +#define LED_MODE_DIAG_AMBER_VALUE (0x00) /*It's yellow actually. Green+Red=Yellow*/ +#define LED_MODE_DIAG_OFF_VALUE (0x03) + + +#define LED_TYPE_LOC_REG_MASK (0x80) +#define LED_MODE_LOC_ON_VALUE (0) +#define LED_MODE_LOC_OFF_VALUE (0x80) + +enum led_type { + LED_TYPE_DIAG, + LED_TYPE_LOC, + LED_TYPE_FAN, + LED_TYPE_PSU1, + LED_TYPE_PSU2 +}; + +struct led_reg { + u32 types; + u8 reg_addr; +}; + +static const struct led_reg led_reg_map[] = { + {(1<update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting accton_as7326_56x_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = accton_as7326_56x_led_read_value(led_reg_map[i].reg_addr); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg_map[i].reg_addr, status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as7326_56x_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + enum led_type type) +{ + int reg_val; + u8 reg ; + mutex_lock(&ledctl->update_lock); + + if( !accton_getLedReg(type, ®)) + { + dev_dbg(&ledctl->pdev->dev, "Not match item for %d.\n", type); + } + + reg_val = accton_as7326_56x_led_read_value(reg); + + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + accton_as7326_56x_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + + +static void accton_as7326_56x_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as7326_56x_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG); +} + +static enum led_brightness accton_as7326_56x_led_diag_get(struct led_classdev *cdev) +{ + accton_as7326_56x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void accton_as7326_56x_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as7326_56x_led_set(led_cdev, led_light_mode, LED_TYPE_LOC); +} + +static enum led_brightness accton_as7326_56x_led_loc_get(struct led_classdev *cdev) +{ + accton_as7326_56x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static void accton_as7326_56x_led_auto_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ +} + +static enum led_brightness accton_as7326_56x_led_auto_get(struct led_classdev *cdev) +{ + return LED_MODE_AUTO; +} + +static struct led_classdev accton_as7326_56x_leds[] = { + [LED_TYPE_DIAG] = { + .name = "accton_as7326_56x_led::diag", + .default_trigger = "unused", + .brightness_set = accton_as7326_56x_led_diag_set, + .brightness_get = accton_as7326_56x_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_RED, + }, + [LED_TYPE_LOC] = { + .name = "accton_as7326_56x_led::loc", + .default_trigger = "unused", + .brightness_set = accton_as7326_56x_led_loc_set, + .brightness_get = accton_as7326_56x_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_BLUE, + }, + [LED_TYPE_FAN] = { + .name = "accton_as7326_56x_led::fan", + .default_trigger = "unused", + .brightness_set = accton_as7326_56x_led_auto_set, + .brightness_get = accton_as7326_56x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU1] = { + .name = "accton_as7326_56x_led::psu1", + .default_trigger = "unused", + .brightness_set = accton_as7326_56x_led_auto_set, + .brightness_get = accton_as7326_56x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "accton_as7326_56x_led::psu2", + .default_trigger = "unused", + .brightness_set = accton_as7326_56x_led_auto_set, + .brightness_get = accton_as7326_56x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +}; + +static int accton_as7326_56x_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as7326_56x_leds); i++) { + led_classdev_suspend(&accton_as7326_56x_leds[i]); + } + + return 0; +} + +static int accton_as7326_56x_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as7326_56x_leds); i++) { + led_classdev_resume(&accton_as7326_56x_leds[i]); + } + + return 0; +} + +static int accton_as7326_56x_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(accton_as7326_56x_leds); i++) { + ret = led_classdev_register(&pdev->dev, &accton_as7326_56x_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(accton_as7326_56x_leds)) { + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&accton_as7326_56x_leds[i]); + } + } + + return ret; +} + +static int accton_as7326_56x_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(accton_as7326_56x_leds); i++) { + led_classdev_unregister(&accton_as7326_56x_leds[i]); + } + + return 0; +} + +static struct platform_driver accton_as7326_56x_led_driver = { + .probe = accton_as7326_56x_led_probe, + .remove = accton_as7326_56x_led_remove, + .suspend = accton_as7326_56x_led_suspend, + .resume = accton_as7326_56x_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as7326_56x_led_init(void) +{ + int ret; + + ret = platform_driver_register(&accton_as7326_56x_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct accton_as7326_56x_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as7326_56x_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&accton_as7326_56x_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as7326_56x_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&accton_as7326_56x_led_driver); + kfree(ledctl); +} + +module_init(accton_as7326_56x_led_init); +module_exit(accton_as7326_56x_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as7326_56x_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c new file mode 100644 index 000000000000..8c2ece6200fe --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c @@ -0,0 +1,277 @@ +/* + * An hwmon driver for accton as7326_56x Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static int as7326_56x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as7326_56x_cpld_read(unsigned short cpld_addr, u8 reg); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, 0x53, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7326_56x_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[9]; /* Model name, read from eeprom */ +}; + +static struct as7326_56x_psu_data *as7326_56x_psu_update_device(struct device *dev); + +enum as7326_56x_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); + +static struct attribute *as7326_56x_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7326_56x_psu_data *data = as7326_56x_psu_update_device(dev); + u8 status = 0; + + if (attr->index == PSU_PRESENT) { + status = !(data->status >> (1-data->index) & 0x1); + } + else { /* PSU_POWER_GOOD */ + status = (data->status >> (3-data->index) & 0x1); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7326_56x_psu_data *data = as7326_56x_psu_update_device(dev); + + return sprintf(buf, "%s\n", data->model_name); +} + +static const struct attribute_group as7326_56x_psu_group = { + .attrs = as7326_56x_psu_attributes, +}; + +static int as7326_56x_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7326_56x_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7326_56x_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7326_56x_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7326_56x_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7326_56x_psu_remove(struct i2c_client *client) +{ + struct as7326_56x_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7326_56x_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as7326_56x_psu1, + as7326_56x_psu2 +}; + +static const struct i2c_device_id as7326_56x_psu_id[] = { + { "as7326_56x_psu1", as7326_56x_psu1 }, + { "as7326_56x_psu2", as7326_56x_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7326_56x_psu_id); + +static struct i2c_driver as7326_56x_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7326_56x_psu", + }, + .probe = as7326_56x_psu_probe, + .remove = as7326_56x_psu_remove, + .id_table = as7326_56x_psu_id, + .address_list = normal_i2c, +}; + +static int as7326_56x_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +static struct as7326_56x_psu_data *as7326_56x_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7326_56x_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; + int power_good = 0; + + dev_dbg(&client->dev, "Starting as7326_56x update\n"); + + /* Read psu status */ + status = as7326_56x_cpld_read(0x60, 0x2); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + } + else { + data->status = status; + } + + /* Read model name */ + memset(data->model_name, 0, sizeof(data->model_name)); + power_good = (data->status >> (3-data->index) & 0x1); + + if (power_good) { + status = as7326_56x_psu_read_block(client, 0x20, data->model_name, + ARRAY_SIZE(data->model_name)-1); + + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); + } + else { + data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(as7326_56x_psu_driver); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7326_56x_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_i2c_cpld.c new file mode 100644 index 000000000000..2274c4a934c0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_i2c_cpld.c @@ -0,0 +1,1080 @@ +/* + * Copyright (C) Brandon Chuang + * + * This module supports the accton cpld that hold the channel select + * mechanism for other i2c slave devices, such as SFP. + * This includes the: + * Accton as7326_56x CPLD1/CPLD2/CPLD3 + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +enum cpld_type { + as7326_56x_cpld1, + as7326_56x_cpld2, + as7326_56x_cpld3 +}; + +struct as7326_56x_cpld_data { + enum cpld_type type; + struct device *hwmon_dev; + struct mutex update_lock; +}; + +static const struct i2c_device_id as7326_56x_cpld_id[] = { + { "as7326_56x_cpld1", as7326_56x_cpld1 }, + { "as7326_56x_cpld2", as7326_56x_cpld2 }, + { "as7326_56x_cpld3", as7326_56x_cpld3 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, as7326_56x_cpld_id); + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_TXDISABLE_ATTR_ID(index) MODULE_TXDISABLE_##index +#define TRANSCEIVER_RXLOS_ATTR_ID(index) MODULE_RXLOS_##index +#define TRANSCEIVER_TXFAULT_ATTR_ID(index) MODULE_TXFAULT_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index + +enum as7326_56x_cpld_sysfs_attributes { + CPLD_VERSION, + ACCESS, + MODULE_PRESENT_ALL, + MODULE_RXLOS_ALL, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + TRANSCEIVER_PRESENT_ATTR_ID(33), + TRANSCEIVER_PRESENT_ATTR_ID(34), + TRANSCEIVER_PRESENT_ATTR_ID(35), + TRANSCEIVER_PRESENT_ATTR_ID(36), + TRANSCEIVER_PRESENT_ATTR_ID(37), + TRANSCEIVER_PRESENT_ATTR_ID(38), + TRANSCEIVER_PRESENT_ATTR_ID(39), + TRANSCEIVER_PRESENT_ATTR_ID(40), + TRANSCEIVER_PRESENT_ATTR_ID(41), + TRANSCEIVER_PRESENT_ATTR_ID(42), + TRANSCEIVER_PRESENT_ATTR_ID(43), + TRANSCEIVER_PRESENT_ATTR_ID(44), + TRANSCEIVER_PRESENT_ATTR_ID(45), + TRANSCEIVER_PRESENT_ATTR_ID(46), + TRANSCEIVER_PRESENT_ATTR_ID(47), + TRANSCEIVER_PRESENT_ATTR_ID(48), + TRANSCEIVER_PRESENT_ATTR_ID(49), + TRANSCEIVER_PRESENT_ATTR_ID(50), + TRANSCEIVER_PRESENT_ATTR_ID(51), + TRANSCEIVER_PRESENT_ATTR_ID(52), + TRANSCEIVER_PRESENT_ATTR_ID(53), + TRANSCEIVER_PRESENT_ATTR_ID(54), + TRANSCEIVER_PRESENT_ATTR_ID(55), + TRANSCEIVER_PRESENT_ATTR_ID(56), + TRANSCEIVER_PRESENT_ATTR_ID(57), + TRANSCEIVER_PRESENT_ATTR_ID(58), + TRANSCEIVER_TXDISABLE_ATTR_ID(1), + TRANSCEIVER_TXDISABLE_ATTR_ID(2), + TRANSCEIVER_TXDISABLE_ATTR_ID(3), + TRANSCEIVER_TXDISABLE_ATTR_ID(4), + TRANSCEIVER_TXDISABLE_ATTR_ID(5), + TRANSCEIVER_TXDISABLE_ATTR_ID(6), + TRANSCEIVER_TXDISABLE_ATTR_ID(7), + TRANSCEIVER_TXDISABLE_ATTR_ID(8), + TRANSCEIVER_TXDISABLE_ATTR_ID(9), + TRANSCEIVER_TXDISABLE_ATTR_ID(10), + TRANSCEIVER_TXDISABLE_ATTR_ID(11), + TRANSCEIVER_TXDISABLE_ATTR_ID(12), + TRANSCEIVER_TXDISABLE_ATTR_ID(13), + TRANSCEIVER_TXDISABLE_ATTR_ID(14), + TRANSCEIVER_TXDISABLE_ATTR_ID(15), + TRANSCEIVER_TXDISABLE_ATTR_ID(16), + TRANSCEIVER_TXDISABLE_ATTR_ID(17), + TRANSCEIVER_TXDISABLE_ATTR_ID(18), + TRANSCEIVER_TXDISABLE_ATTR_ID(19), + TRANSCEIVER_TXDISABLE_ATTR_ID(20), + TRANSCEIVER_TXDISABLE_ATTR_ID(21), + TRANSCEIVER_TXDISABLE_ATTR_ID(22), + TRANSCEIVER_TXDISABLE_ATTR_ID(23), + TRANSCEIVER_TXDISABLE_ATTR_ID(24), + TRANSCEIVER_TXDISABLE_ATTR_ID(25), + TRANSCEIVER_TXDISABLE_ATTR_ID(26), + TRANSCEIVER_TXDISABLE_ATTR_ID(27), + TRANSCEIVER_TXDISABLE_ATTR_ID(28), + TRANSCEIVER_TXDISABLE_ATTR_ID(29), + TRANSCEIVER_TXDISABLE_ATTR_ID(30), + TRANSCEIVER_TXDISABLE_ATTR_ID(31), + TRANSCEIVER_TXDISABLE_ATTR_ID(32), + TRANSCEIVER_TXDISABLE_ATTR_ID(33), + TRANSCEIVER_TXDISABLE_ATTR_ID(34), + TRANSCEIVER_TXDISABLE_ATTR_ID(35), + TRANSCEIVER_TXDISABLE_ATTR_ID(36), + TRANSCEIVER_TXDISABLE_ATTR_ID(37), + TRANSCEIVER_TXDISABLE_ATTR_ID(38), + TRANSCEIVER_TXDISABLE_ATTR_ID(39), + TRANSCEIVER_TXDISABLE_ATTR_ID(40), + TRANSCEIVER_TXDISABLE_ATTR_ID(41), + TRANSCEIVER_TXDISABLE_ATTR_ID(42), + TRANSCEIVER_TXDISABLE_ATTR_ID(43), + TRANSCEIVER_TXDISABLE_ATTR_ID(44), + TRANSCEIVER_TXDISABLE_ATTR_ID(45), + TRANSCEIVER_TXDISABLE_ATTR_ID(46), + TRANSCEIVER_TXDISABLE_ATTR_ID(47), + TRANSCEIVER_TXDISABLE_ATTR_ID(48), + TRANSCEIVER_TXDISABLE_ATTR_ID(57), + TRANSCEIVER_TXDISABLE_ATTR_ID(58), + TRANSCEIVER_RXLOS_ATTR_ID(1), + TRANSCEIVER_RXLOS_ATTR_ID(2), + TRANSCEIVER_RXLOS_ATTR_ID(3), + TRANSCEIVER_RXLOS_ATTR_ID(4), + TRANSCEIVER_RXLOS_ATTR_ID(5), + TRANSCEIVER_RXLOS_ATTR_ID(6), + TRANSCEIVER_RXLOS_ATTR_ID(7), + TRANSCEIVER_RXLOS_ATTR_ID(8), + TRANSCEIVER_RXLOS_ATTR_ID(9), + TRANSCEIVER_RXLOS_ATTR_ID(10), + TRANSCEIVER_RXLOS_ATTR_ID(11), + TRANSCEIVER_RXLOS_ATTR_ID(12), + TRANSCEIVER_RXLOS_ATTR_ID(13), + TRANSCEIVER_RXLOS_ATTR_ID(14), + TRANSCEIVER_RXLOS_ATTR_ID(15), + TRANSCEIVER_RXLOS_ATTR_ID(16), + TRANSCEIVER_RXLOS_ATTR_ID(17), + TRANSCEIVER_RXLOS_ATTR_ID(18), + TRANSCEIVER_RXLOS_ATTR_ID(19), + TRANSCEIVER_RXLOS_ATTR_ID(20), + TRANSCEIVER_RXLOS_ATTR_ID(21), + TRANSCEIVER_RXLOS_ATTR_ID(22), + TRANSCEIVER_RXLOS_ATTR_ID(23), + TRANSCEIVER_RXLOS_ATTR_ID(24), + TRANSCEIVER_RXLOS_ATTR_ID(25), + TRANSCEIVER_RXLOS_ATTR_ID(26), + TRANSCEIVER_RXLOS_ATTR_ID(27), + TRANSCEIVER_RXLOS_ATTR_ID(28), + TRANSCEIVER_RXLOS_ATTR_ID(29), + TRANSCEIVER_RXLOS_ATTR_ID(30), + TRANSCEIVER_RXLOS_ATTR_ID(31), + TRANSCEIVER_RXLOS_ATTR_ID(32), + TRANSCEIVER_RXLOS_ATTR_ID(33), + TRANSCEIVER_RXLOS_ATTR_ID(34), + TRANSCEIVER_RXLOS_ATTR_ID(35), + TRANSCEIVER_RXLOS_ATTR_ID(36), + TRANSCEIVER_RXLOS_ATTR_ID(37), + TRANSCEIVER_RXLOS_ATTR_ID(38), + TRANSCEIVER_RXLOS_ATTR_ID(39), + TRANSCEIVER_RXLOS_ATTR_ID(40), + TRANSCEIVER_RXLOS_ATTR_ID(41), + TRANSCEIVER_RXLOS_ATTR_ID(42), + TRANSCEIVER_RXLOS_ATTR_ID(43), + TRANSCEIVER_RXLOS_ATTR_ID(44), + TRANSCEIVER_RXLOS_ATTR_ID(45), + TRANSCEIVER_RXLOS_ATTR_ID(46), + TRANSCEIVER_RXLOS_ATTR_ID(47), + TRANSCEIVER_RXLOS_ATTR_ID(48), + TRANSCEIVER_RXLOS_ATTR_ID(57), + TRANSCEIVER_RXLOS_ATTR_ID(58), + TRANSCEIVER_TXFAULT_ATTR_ID(1), + TRANSCEIVER_TXFAULT_ATTR_ID(2), + TRANSCEIVER_TXFAULT_ATTR_ID(3), + TRANSCEIVER_TXFAULT_ATTR_ID(4), + TRANSCEIVER_TXFAULT_ATTR_ID(5), + TRANSCEIVER_TXFAULT_ATTR_ID(6), + TRANSCEIVER_TXFAULT_ATTR_ID(7), + TRANSCEIVER_TXFAULT_ATTR_ID(8), + TRANSCEIVER_TXFAULT_ATTR_ID(9), + TRANSCEIVER_TXFAULT_ATTR_ID(10), + TRANSCEIVER_TXFAULT_ATTR_ID(11), + TRANSCEIVER_TXFAULT_ATTR_ID(12), + TRANSCEIVER_TXFAULT_ATTR_ID(13), + TRANSCEIVER_TXFAULT_ATTR_ID(14), + TRANSCEIVER_TXFAULT_ATTR_ID(15), + TRANSCEIVER_TXFAULT_ATTR_ID(16), + TRANSCEIVER_TXFAULT_ATTR_ID(17), + TRANSCEIVER_TXFAULT_ATTR_ID(18), + TRANSCEIVER_TXFAULT_ATTR_ID(19), + TRANSCEIVER_TXFAULT_ATTR_ID(20), + TRANSCEIVER_TXFAULT_ATTR_ID(21), + TRANSCEIVER_TXFAULT_ATTR_ID(22), + TRANSCEIVER_TXFAULT_ATTR_ID(23), + TRANSCEIVER_TXFAULT_ATTR_ID(24), + TRANSCEIVER_TXFAULT_ATTR_ID(25), + TRANSCEIVER_TXFAULT_ATTR_ID(26), + TRANSCEIVER_TXFAULT_ATTR_ID(27), + TRANSCEIVER_TXFAULT_ATTR_ID(28), + TRANSCEIVER_TXFAULT_ATTR_ID(29), + TRANSCEIVER_TXFAULT_ATTR_ID(30), + TRANSCEIVER_TXFAULT_ATTR_ID(31), + TRANSCEIVER_TXFAULT_ATTR_ID(32), + TRANSCEIVER_TXFAULT_ATTR_ID(33), + TRANSCEIVER_TXFAULT_ATTR_ID(34), + TRANSCEIVER_TXFAULT_ATTR_ID(35), + TRANSCEIVER_TXFAULT_ATTR_ID(36), + TRANSCEIVER_TXFAULT_ATTR_ID(37), + TRANSCEIVER_TXFAULT_ATTR_ID(38), + TRANSCEIVER_TXFAULT_ATTR_ID(39), + TRANSCEIVER_TXFAULT_ATTR_ID(40), + TRANSCEIVER_TXFAULT_ATTR_ID(41), + TRANSCEIVER_TXFAULT_ATTR_ID(42), + TRANSCEIVER_TXFAULT_ATTR_ID(43), + TRANSCEIVER_TXFAULT_ATTR_ID(44), + TRANSCEIVER_TXFAULT_ATTR_ID(45), + TRANSCEIVER_TXFAULT_ATTR_ID(46), + TRANSCEIVER_TXFAULT_ATTR_ID(47), + TRANSCEIVER_TXFAULT_ATTR_ID(48), + TRANSCEIVER_TXFAULT_ATTR_ID(57), + TRANSCEIVER_TXFAULT_ATTR_ID(58), +}; + +/* sysfs attributes for hwmon + */ +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_rxlos_all(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf); +static int as7326_56x_cpld_read_internal(struct i2c_client *client, u8 reg); +static int as7326_56x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value); + +/* transceiver attributes */ +#define DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index) +#define DECLARE_TRANSCEIVER_PRESENT_ATTR(index) &sensor_dev_attr_module_present_##index.dev_attr.attr + +#define DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IRUGO | S_IWUSR, show_status, set_reset, MODULE_RESET_##index) +#define DECLARE_TRANSCEIVER_RESET_ATTR(index) &sensor_dev_attr_module_reset_##index.dev_attr.attr + +#define DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_tx_disable_##index, S_IRUGO | S_IWUSR, show_status, set_tx_disable, MODULE_TXDISABLE_##index); \ + static SENSOR_DEVICE_ATTR(module_rx_los_##index, S_IRUGO, show_status, NULL, MODULE_RXLOS_##index); \ + static SENSOR_DEVICE_ATTR(module_tx_fault_##index, S_IRUGO, show_status, NULL, MODULE_TXFAULT_##index) +#define DECLARE_SFP_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_tx_disable_##index.dev_attr.attr, \ + &sensor_dev_attr_module_rx_los_##index.dev_attr.attr, \ + &sensor_dev_attr_module_tx_fault_##index.dev_attr.attr + +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); +/* transceiver attributes */ +static SENSOR_DEVICE_ATTR(module_present_all, S_IRUGO, show_present_all, NULL, MODULE_PRESENT_ALL); +static SENSOR_DEVICE_ATTR(module_rx_los_all, S_IRUGO, show_rxlos_all, NULL, MODULE_RXLOS_ALL); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(32); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(33); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(34); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(35); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(36); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(37); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(38); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(39); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(40); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(41); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(42); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(43); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(44); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(45); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(46); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(47); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(48); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(49); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(50); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(51); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(52); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(53); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(54); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(55); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(56); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(57); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(58); + +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(1); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(2); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(3); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(4); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(5); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(6); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(7); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(8); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(9); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(10); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(11); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(12); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(13); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(14); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(15); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(16); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(17); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(18); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(19); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(20); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(21); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(22); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(23); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(24); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(25); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(26); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(27); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(28); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(29); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(30); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(31); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(32); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(33); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(34); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(35); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(36); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(37); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(38); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(39); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(40); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(41); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(42); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(43); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(44); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(45); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(46); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(47); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(48); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(57); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(58); + +static struct attribute *as7326_56x_cpld3_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + NULL +}; + +static const struct attribute_group as7326_56x_cpld3_group = { + .attrs = as7326_56x_cpld3_attributes, +}; + +static struct attribute *as7326_56x_cpld2_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + &sensor_dev_attr_module_rx_los_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(1), + DECLARE_TRANSCEIVER_PRESENT_ATTR(2), + DECLARE_TRANSCEIVER_PRESENT_ATTR(3), + DECLARE_TRANSCEIVER_PRESENT_ATTR(4), + DECLARE_TRANSCEIVER_PRESENT_ATTR(5), + DECLARE_TRANSCEIVER_PRESENT_ATTR(6), + DECLARE_TRANSCEIVER_PRESENT_ATTR(7), + DECLARE_TRANSCEIVER_PRESENT_ATTR(8), + DECLARE_TRANSCEIVER_PRESENT_ATTR(9), + DECLARE_TRANSCEIVER_PRESENT_ATTR(10), + DECLARE_TRANSCEIVER_PRESENT_ATTR(11), + DECLARE_TRANSCEIVER_PRESENT_ATTR(12), + DECLARE_TRANSCEIVER_PRESENT_ATTR(13), + DECLARE_TRANSCEIVER_PRESENT_ATTR(14), + DECLARE_TRANSCEIVER_PRESENT_ATTR(15), + DECLARE_TRANSCEIVER_PRESENT_ATTR(16), + DECLARE_TRANSCEIVER_PRESENT_ATTR(17), + DECLARE_TRANSCEIVER_PRESENT_ATTR(18), + DECLARE_TRANSCEIVER_PRESENT_ATTR(19), + DECLARE_TRANSCEIVER_PRESENT_ATTR(20), + DECLARE_TRANSCEIVER_PRESENT_ATTR(21), + DECLARE_TRANSCEIVER_PRESENT_ATTR(22), + DECLARE_TRANSCEIVER_PRESENT_ATTR(23), + DECLARE_TRANSCEIVER_PRESENT_ATTR(24), + DECLARE_TRANSCEIVER_PRESENT_ATTR(25), + DECLARE_TRANSCEIVER_PRESENT_ATTR(26), + DECLARE_TRANSCEIVER_PRESENT_ATTR(27), + DECLARE_TRANSCEIVER_PRESENT_ATTR(28), + DECLARE_TRANSCEIVER_PRESENT_ATTR(29), + DECLARE_TRANSCEIVER_PRESENT_ATTR(30), + DECLARE_SFP_TRANSCEIVER_ATTR(1), + DECLARE_SFP_TRANSCEIVER_ATTR(2), + DECLARE_SFP_TRANSCEIVER_ATTR(3), + DECLARE_SFP_TRANSCEIVER_ATTR(4), + DECLARE_SFP_TRANSCEIVER_ATTR(5), + DECLARE_SFP_TRANSCEIVER_ATTR(6), + DECLARE_SFP_TRANSCEIVER_ATTR(7), + DECLARE_SFP_TRANSCEIVER_ATTR(8), + DECLARE_SFP_TRANSCEIVER_ATTR(9), + DECLARE_SFP_TRANSCEIVER_ATTR(10), + DECLARE_SFP_TRANSCEIVER_ATTR(11), + DECLARE_SFP_TRANSCEIVER_ATTR(12), + DECLARE_SFP_TRANSCEIVER_ATTR(13), + DECLARE_SFP_TRANSCEIVER_ATTR(14), + DECLARE_SFP_TRANSCEIVER_ATTR(15), + DECLARE_SFP_TRANSCEIVER_ATTR(16), + DECLARE_SFP_TRANSCEIVER_ATTR(17), + DECLARE_SFP_TRANSCEIVER_ATTR(18), + DECLARE_SFP_TRANSCEIVER_ATTR(19), + DECLARE_SFP_TRANSCEIVER_ATTR(20), + DECLARE_SFP_TRANSCEIVER_ATTR(21), + DECLARE_SFP_TRANSCEIVER_ATTR(22), + DECLARE_SFP_TRANSCEIVER_ATTR(23), + DECLARE_SFP_TRANSCEIVER_ATTR(24), + DECLARE_SFP_TRANSCEIVER_ATTR(25), + DECLARE_SFP_TRANSCEIVER_ATTR(26), + DECLARE_SFP_TRANSCEIVER_ATTR(27), + DECLARE_SFP_TRANSCEIVER_ATTR(28), + DECLARE_SFP_TRANSCEIVER_ATTR(29), + DECLARE_SFP_TRANSCEIVER_ATTR(30), + NULL +}; + +static const struct attribute_group as7326_56x_cpld2_group = { + .attrs = as7326_56x_cpld2_attributes, +}; + +static struct attribute *as7326_56x_cpld1_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + &sensor_dev_attr_module_rx_los_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(31), + DECLARE_TRANSCEIVER_PRESENT_ATTR(32), + DECLARE_TRANSCEIVER_PRESENT_ATTR(33), + DECLARE_TRANSCEIVER_PRESENT_ATTR(34), + DECLARE_TRANSCEIVER_PRESENT_ATTR(35), + DECLARE_TRANSCEIVER_PRESENT_ATTR(36), + DECLARE_TRANSCEIVER_PRESENT_ATTR(37), + DECLARE_TRANSCEIVER_PRESENT_ATTR(38), + DECLARE_TRANSCEIVER_PRESENT_ATTR(39), + DECLARE_TRANSCEIVER_PRESENT_ATTR(40), + DECLARE_TRANSCEIVER_PRESENT_ATTR(41), + DECLARE_TRANSCEIVER_PRESENT_ATTR(42), + DECLARE_TRANSCEIVER_PRESENT_ATTR(43), + DECLARE_TRANSCEIVER_PRESENT_ATTR(44), + DECLARE_TRANSCEIVER_PRESENT_ATTR(45), + DECLARE_TRANSCEIVER_PRESENT_ATTR(46), + DECLARE_TRANSCEIVER_PRESENT_ATTR(47), + DECLARE_TRANSCEIVER_PRESENT_ATTR(48), + DECLARE_TRANSCEIVER_PRESENT_ATTR(49), + DECLARE_TRANSCEIVER_PRESENT_ATTR(50), + DECLARE_TRANSCEIVER_PRESENT_ATTR(51), + DECLARE_TRANSCEIVER_PRESENT_ATTR(52), + DECLARE_TRANSCEIVER_PRESENT_ATTR(53), + DECLARE_TRANSCEIVER_PRESENT_ATTR(54), + DECLARE_TRANSCEIVER_PRESENT_ATTR(55), + DECLARE_TRANSCEIVER_PRESENT_ATTR(56), + DECLARE_TRANSCEIVER_PRESENT_ATTR(57), + DECLARE_TRANSCEIVER_PRESENT_ATTR(58), + DECLARE_SFP_TRANSCEIVER_ATTR(31), + DECLARE_SFP_TRANSCEIVER_ATTR(32), + DECLARE_SFP_TRANSCEIVER_ATTR(33), + DECLARE_SFP_TRANSCEIVER_ATTR(34), + DECLARE_SFP_TRANSCEIVER_ATTR(35), + DECLARE_SFP_TRANSCEIVER_ATTR(36), + DECLARE_SFP_TRANSCEIVER_ATTR(37), + DECLARE_SFP_TRANSCEIVER_ATTR(38), + DECLARE_SFP_TRANSCEIVER_ATTR(39), + DECLARE_SFP_TRANSCEIVER_ATTR(40), + DECLARE_SFP_TRANSCEIVER_ATTR(41), + DECLARE_SFP_TRANSCEIVER_ATTR(42), + DECLARE_SFP_TRANSCEIVER_ATTR(43), + DECLARE_SFP_TRANSCEIVER_ATTR(44), + DECLARE_SFP_TRANSCEIVER_ATTR(45), + DECLARE_SFP_TRANSCEIVER_ATTR(46), + DECLARE_SFP_TRANSCEIVER_ATTR(47), + DECLARE_SFP_TRANSCEIVER_ATTR(48), + DECLARE_SFP_TRANSCEIVER_ATTR(57), + DECLARE_SFP_TRANSCEIVER_ATTR(58), + NULL +}; + +static const struct attribute_group as7326_56x_cpld1_group = { + .attrs = as7326_56x_cpld1_attributes, +}; + +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i, status; + u8 values[4] = {0}; + u8 regs[] = {0x9, 0xA, 0xB, 0x18}; + struct i2c_client *client = to_i2c_client(dev); + struct as7326_56x_cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = as7326_56x_cpld_read_internal(client, regs[i]); + + if (status < 0) { + goto exit; + } + + values[i] = ~(u8)status; + } + + mutex_unlock(&data->update_lock); + + /* Return values 1 -> 56 in order */ + if (data->type == as7326_56x_cpld2) { + values[3] &= 0xF; + } + else { /* as7326_56x_cpld3 */ + values[3] &= 0x3; + } + + return sprintf(buf, "%.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], values[3]); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_rxlos_all(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i, status; + u8 values[3] = {0}; + u8 regs[] = {0x12, 0x13, 0x14}; + struct i2c_client *client = to_i2c_client(dev); + struct as7326_56x_cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = as7326_56x_cpld_read_internal(client, regs[i]); + + if (status < 0) { + goto exit; + } + + values[i] = (u8)status; + } + + mutex_unlock(&data->update_lock); + + /* Return values 1 -> 24 in order */ + return sprintf(buf, "%.2x %.2x %.2x\n", values[0], values[1], values[2]); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7326_56x_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0, revert = 0; + + switch (attr->index) { + case MODULE_PRESENT_1 ... MODULE_PRESENT_30: + reg = 0x0f + (attr->index-MODULE_PRESENT_1)/8; + mask = 0x1 << ((attr->index - MODULE_PRESENT_1)%8); + break; + case MODULE_PRESENT_31 ... MODULE_PRESENT_48: + reg = 0x10 + (attr->index-MODULE_PRESENT_31)/8; + mask = 0x1 << ((attr->index - MODULE_PRESENT_31)%8); + break; + case MODULE_PRESENT_57 ... MODULE_PRESENT_58: + reg = 0x12; + mask = 0x1 << (( MODULE_PRESENT_58 - attr->index)+2); + break; + case MODULE_PRESENT_49 ... MODULE_PRESENT_56: /*QSFP*/ + reg = 0x13 ; + mask = 0x1 << ((attr->index - MODULE_PRESENT_49)%8); + break; + case MODULE_TXFAULT_1 ... MODULE_TXFAULT_30: + reg = 0x03 + (attr->index - MODULE_TXFAULT_1)/8; + mask = 0x1 << ((attr->index - MODULE_TXFAULT_1)%8); + break; + case MODULE_TXFAULT_31 ... MODULE_TXFAULT_48: + reg = 0x1a + (attr->index-MODULE_TXFAULT_31)/8; + mask = 0x1 << ((attr->index - MODULE_TXFAULT_31)%8); + break; + case MODULE_TXFAULT_57 ... MODULE_TXFAULT_58: + reg = 0x1c; + mask = 0x1 << (( attr->index - MODULE_TXFAULT_57)+2); + break; + case MODULE_TXDISABLE_1 ... MODULE_TXDISABLE_30: + reg = 0x07 + (attr->index - MODULE_TXDISABLE_1)/8; + mask = 0x1 << ((attr->index - MODULE_TXDISABLE_1)%8); + break; + case MODULE_TXDISABLE_31 ... MODULE_TXDISABLE_48: + reg = 0x14 + (attr->index-MODULE_TXDISABLE_31)/8; + mask = 0x1 << ((attr->index - MODULE_TXDISABLE_31)%8); + break; + case MODULE_TXDISABLE_57 ... MODULE_TXDISABLE_58: + reg = 0x16; + mask = 0x1 << ((attr->index - MODULE_TXDISABLE_57)+2); + break; + case MODULE_RXLOS_1 ... MODULE_RXLOS_30: + reg = 0x0b + (attr->index - MODULE_RXLOS_1)/8; + mask = 0x1 << ((attr->index - MODULE_RXLOS_1)%8); + break; + case MODULE_RXLOS_31 ... MODULE_RXLOS_48: + reg = 0x17 + (attr->index-MODULE_RXLOS_31)/8; + mask = 0x1 << ((attr->index - MODULE_RXLOS_31)%8); + break; + case MODULE_RXLOS_57 ... MODULE_RXLOS_58: + reg = 0x19; + mask = 0x1 << (( attr->index - MODULE_RXLOS_57)+2); + break; + default: + return 0; + } + + if (attr->index >= MODULE_PRESENT_1 && attr->index <= MODULE_PRESENT_56) { + revert = 1; + } + + mutex_lock(&data->update_lock); + status = as7326_56x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", revert ? !(status & mask) : !!(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7326_56x_cpld_data *data = i2c_get_clientdata(client); + long disable; + int status; + u8 reg = 0, mask = 0; + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + + switch (attr->index) { + case MODULE_TXDISABLE_1 ... MODULE_TXDISABLE_30: + reg = 0x07 + (attr->index - MODULE_TXDISABLE_1)/8; + mask = 0x1 << ((attr->index - MODULE_TXDISABLE_1)%8); + break; + case MODULE_TXDISABLE_31 ... MODULE_TXDISABLE_48: + reg = 0x14 + (attr->index - MODULE_TXDISABLE_31)/8; + mask = 0x1 << ((attr->index - MODULE_TXDISABLE_31)%8); + break; + case MODULE_TXDISABLE_57 ... MODULE_TXDISABLE_58: + reg = 0x16; + mask = 0x1 << ((attr->index - MODULE_TXDISABLE_57)+2); + break; + default: + return 0; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = as7326_56x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update tx_disable status */ + if (disable) { + status |= mask; + } + else { + status &= ~mask; + } + + status = as7326_56x_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct as7326_56x_cpld_data *data = i2c_get_clientdata(client); + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = as7326_56x_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static void as7326_56x_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void as7326_56x_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static ssize_t show_version(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, 0x1); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d", val); +} + +/* + * I2C init/probing/exit functions + */ +static int as7326_56x_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + struct as7326_56x_cpld_data *data; + int ret = -ENODEV; + const struct attribute_group *group = NULL; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + goto exit; + + data = kzalloc(sizeof(struct as7326_56x_cpld_data), GFP_KERNEL); + if (!data) { + ret = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->type = id->driver_data; + + /* Register sysfs hooks */ + switch (data->type) { + case as7326_56x_cpld1: + group = &as7326_56x_cpld1_group; + break; + case as7326_56x_cpld2: + group = &as7326_56x_cpld2_group; + break; + case as7326_56x_cpld3: + group = &as7326_56x_cpld3_group; + break; + default: + break; + } + + if (group) { + ret = sysfs_create_group(&client->dev.kobj, group); + if (ret) { + goto exit_free; + } + } + + as7326_56x_cpld_add_client(client); + return 0; + +exit_free: + kfree(data); +exit: + return ret; +} + +static int as7326_56x_cpld_remove(struct i2c_client *client) +{ + struct as7326_56x_cpld_data *data = i2c_get_clientdata(client); + const struct attribute_group *group = NULL; + + as7326_56x_cpld_remove_client(client); + + /* Remove sysfs hooks */ + switch (data->type) { + case as7326_56x_cpld1: + group = &as7326_56x_cpld1_group; + break; + case as7326_56x_cpld2: + group = &as7326_56x_cpld2_group; + break; + case as7326_56x_cpld3: + group = &as7326_56x_cpld3_group; + break; + default: + break; + } + + if (group) { + sysfs_remove_group(&client->dev.kobj, group); + } + + kfree(data); + + return 0; +} + +static int as7326_56x_cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static int as7326_56x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +int as7326_56x_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as7326_56x_cpld_read_internal(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as7326_56x_cpld_read); + +int as7326_56x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as7326_56x_cpld_write_internal(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as7326_56x_cpld_write); + +static struct i2c_driver as7326_56x_cpld_driver = { + .driver = { + .name = "as7326_56x_cpld", + .owner = THIS_MODULE, + }, + .probe = as7326_56x_cpld_probe, + .remove = as7326_56x_cpld_remove, + .id_table = as7326_56x_cpld_id, +}; + +static int __init as7326_56x_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as7326_56x_cpld_driver); +} + +static void __exit as7326_56x_cpld_exit(void) +{ + i2c_del_driver(&as7326_56x_cpld_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("Accton I2C CPLD driver"); +MODULE_LICENSE("GPL"); + +module_init(as7326_56x_cpld_init); +module_exit(as7326_56x_cpld_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/ym2651y.c new file mode 120000 index 000000000000..f4d67640ccc3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/ym2651y.c @@ -0,0 +1 @@ +../../common/modules/ym2651y.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-monitor.service new file mode 100755 index 000000000000..3af4405fb493 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-monitor.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS7326-56X Platform Monitoring service +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/local/bin/accton_as7326_util.py install +ExecStart=/usr/local/bin/accton_as7326_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/setup.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/setup.py new file mode 100755 index 000000000000..77114c71285b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env pytho + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='as7326_56x', + version='1.0', + description='Module to initialize Accton AS7326-56X platforms', + + packages=['as7326_56x'], + package_dir={'as7326_56x': 'as7326-56x/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/README b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/README new file mode 100755 index 000000000000..ef0d03cf5e45 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/README @@ -0,0 +1,74 @@ +Copyright (C) 2016 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Contents of this package: + module - Contains source code of as7326 kernel driver modules. + util - operational scripts. + +Sonic creates a docker container and run building process under it. +If user tries to built new drivers, please get into that docker and +dpkg-buildpackage for them. + +All Linux kernel code is licensed under the GPLv1. All other code is +licensed under the GPLv3. Please see the LICENSE file for copies of +both licenses. + +The code for integacting with Accton AS7326-56X has 2 parts, +kernel drivers and operational script. +The kernel drivers of peripherals are under module/ directory. +1. These drivers can be built to individual ko during dpkg-buildpackage. +2. A operational script, accton_as7326_util.py, for device initializatian. + Run "accton_as7326_util.py install" to install drivers. + +To initialize the system, run "accton_as7326_util.py install". +To clean up the drivers & devices, run "accton_as7326_util.py clean". +To dump information of sensors, run "accton_as7326_util.py show". +To dump SFP EEPROM, run "accton_as7326_util.py sff". +To set fan speed, run "accton_as7326_util.py set fan". +To enable/disable SFP emission, run "accton_as7326_util.py set sfp". +To set system LEDs' color, run "accton_as7326_util.py set led" +For more information, run "accton_as7326_util.py --help". + +==================================================================== +Besides applying accton_as7326_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +System LED: + There are 5 system LEDs at the lower-left corner of front panel. + They are loc, diag, fan, ps1, and ps2. + The sysfs interface color mappings are as follows: + Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + But not all colors are available for each LED. + +Fan Control: + There are 10 fans inside 6 fan modules. + All fans share 1 duty setting, ranged from 0~100. + +Thermal sensers: + 3 temperature sensors are controlled by the lm75 kernel modules. + +PSUs: + There 2 power supplies slot at the left/right side of the back. + Once if a PSU is not plugged, the status of it is shown failed. + +There are 48 SFP+ and 8 QSFP modules are equipped. +Before operating on PSU and QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py new file mode 100755 index 000000000000..856f194c5e53 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py @@ -0,0 +1,208 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# 3/23/2018: Roy Lee modify for as7326_56x +# ------------------------------------------------------------------ + +try: + import os + import sys, getopt + import subprocess + import click + import imp + import logging + import logging.config + import types + import time # this is only being used as part of the example + import traceback + from tabulate import tabulate + from as7326_56x.fanutil import FanUtil + from as7326_56x.thermalutil import ThermalUtil +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = 'accton_as7326_monitor' + +global log_file +global log_level + +# (LM75_1+ LM75_2+ LM75_3) is LM75 at i2c addresses 0x48, 0x49, and 0x4A. +# TMP = (LM75_1+ LM75_2+ LM75_3)/3 +#1. If TMP < 35, All fans run with duty 31.25%. +#2. If TMP>=35 or the temperature of any one of fan is higher than 40, +# All fans run with duty 50% +#3. If TMP >= 40 or the temperature of any one of fan is higher than 45, +# All fans run with duty 62.5%. +#4. If TMP >= 45 or the temperature of any one of fan is higher than 50, +# All fans run with duty 100%. +#5. Any one of 6 fans is fault, set duty = 100%. +#6. Direction factor. If it is B2F direction, duty + 12%. + + # MISC: + # 1.Check single LM75 before applied average. + # 2.If no matched fan speed is found from the policy, + # use FAN_DUTY_CYCLE_MIN as default speed + # Get current temperature + # 4.Decision 3: Decide new fan speed depend on fan direction/current fan speed/temperature + + + + +# Make a class we can use to capture stdout and sterr in the log +class accton_as7326_monitor(object): + # static temp var + _ori_temp = 0 + _new_perc = 0 + _ori_perc = 0 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_fans(self): + max_duty = 100 + fan_policy_f2b = { + 0: [32, 0, 105000], + 1: [50, 105000, 120000], + 2: [63, 120000, 135000], + 3: [max_duty, 135000, sys.maxsize], + } + fan_policy_b2f = { + 0: [44, 0, 105000], + 1: [63, 105000, 120000], + 2: [75, 120000, 135000], + 3: [max_duty, 135000, sys.maxsize], + } + fan_policy_single = { + 0: 40000, + 1: 45000, + 2: 50000, + } + + thermal = ThermalUtil() + fan = FanUtil() + for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): + fan_status = fan.get_fan_status(x) + if fan_status is None: + logging.debug('INFO. SET new_perc to %d (FAN stauts is None. fan_num:%d)', max_duty, x) + return False + if fan_status is False: + logging.debug('INFO. SET new_perc to %d (FAN fault. fan_num:%d)', max_duty, x) + fan.set_fan_duty_cycle(max_duty) + return True + #logging.debug('INFO. fan_status is True (fan_num:%d)', x) + + fan_dir=fan.get_fan_dir(1) + if fan_dir == 1: + fan_policy = fan_policy_f2b + else: + fan_policy = fan_policy_b2f + + #Decide fan duty by if any of sensors > fan_policy_single. + new_duty_cycle = fan_policy[0][0] + for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): + single_thm = thermal._get_thermal_node_val(x) + for y in range(0, len(fan_policy_single)): + if single_thm > fan_policy_single[y]: + if fan_policy[y+1][0] > new_duty_cycle: + new_duty_cycle = fan_policy[y+1][0] + logging.debug('INFO. Single thermal sensor %d with temp %d > %d , new_duty_cycle=%d', + x, single_thm, fan_policy_single[y], new_duty_cycle) + single_result = new_duty_cycle + + + #Find if current duty matched any of define duty. + #If not, set it to highest one. + cur_duty_cycle = fan.get_fan_duty_cycle() + for x in range(0, len(fan_policy)): + if cur_duty_cycle == fan_policy[x][0]: + break + if x == len(fan_policy) : + fan.set_fan_duty_cycle(fan_policy[0][0]) + cur_duty_cycle = max_duty + + #Decide fan duty by if sum of sensors falls into any of fan_policy{} + get_temp = thermal.get_thermal_temp() + new_duty_cycle = cur_duty_cycle + for x in range(0, len(fan_policy)): + y = len(fan_policy) - x -1 #checked from highest + if get_temp > fan_policy[y][1] and get_temp < fan_policy[y][2] : + new_duty_cycle= fan_policy[y][0] + logging.debug('INFO. Sum of temp %d > %d , new_duty_cycle=%d', get_temp, fan_policy[y][1], new_duty_cycle) + + sum_result = new_duty_cycle + if (sum_result>single_result): + new_duty_cycle = sum_result; + else: + new_duty_cycle = single_result + + logging.debug('INFO. Final duty_cycle=%d', new_duty_cycle) + if(new_duty_cycle != cur_duty_cycle): + fan.set_fan_duty_cycle(new_duty_cycle) + return True + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['lfile=']) + except getopt.GetoptError: + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + monitor = accton_as7326_monitor(log_file, log_level) + + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(10) + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py new file mode 100755 index 000000000000..900bfa805a21 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py @@ -0,0 +1,577 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# +# Description: +# Due to adoption of optoe drivers, sideband signals of SFPs are moved +# into cpld drivers. Add a new dict, cpld_of_module, for mapping this +# attributes to corresponding cpld nodes. +# + + + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'as7326_56x' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan':6,'thermal':4, 'psu':2, 'sfp':58} +FORCE = 0 +#logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +#logging.basicConfig(level=logging.INFO) + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-56 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-56 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + +kos = [ +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x force_deselect_on_exit=1', +'modprobe accton_i2c_cpld' , +'modprobe ym2651y' , +'modprobe accton_as7326_56x_fan' , +'modprobe optoe' , +'modprobe accton_as7326_56x_leds' , +'modprobe accton_as7326_56x_psu' ] + +def driver_install(): + global FORCE + status, output = log_os_system("depmod", 1) + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + lst = rm.split(" ") + if len(lst) > 3: + del(lst[3]) + rm = " ".join(lst) + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +led_prefix ='/sys/class/leds/accton_'+PROJECT_NAME+'_led::' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2']} +hwmon_nodes = {'led': ['brightness'] } +hwmon_prefix ={'led': led_prefix} + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'fan': ['11-0066'] , + 'thermal': ['15-0048','15-0049', '15-004a', '15-004b'] , + 'psu': ['17-0051','13-0053'], + 'sfp': ['-0050']} +i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'] , + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['module_present_', 'module_tx_disable_']} + +sfp_map = [ + 42,41,44,43,47,45,46,50, + 48,49,51,52,53,56,55,54, + 58,57,59,60,61,63,62,64, + 66,68,65,67,69,71,72,70, + 74,73,76,75,77,79,78,80, + 81,82,84,85,83,87,88,86, #port 41~48 + 25,26,27,28,29,30,31,32, #port 49~56 QSFP + 22,23] #port 57~58 SFP+ from CPU NIF. +qsfp_start = 48 +qsfp_end = 56 + +#For sideband signals of SFP/QSFP modules. +cpld_of_module = {'12-0062': list(range(0,30)), + '18-0060': list(range(30,58)) } + + +mknod =[ +'echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device' , +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-1/new_device' , +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-24/new_device' , +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-2/new_device' , +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-33/new_device', +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-34/new_device', +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-35/new_device', +'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-36/new_device', +'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-37/new_device', +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-38/new_device', +'echo 24c04 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', + +'echo as7326_56x_fan 0x66 > /sys/bus/i2c/devices/i2c-11/new_device ', +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-15/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-15/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-15/new_device', +'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-15/new_device', +'echo as7326_56x_psu1 0x51 > /sys/bus/i2c/devices/i2c-17/new_device', +'echo ym2651 0x59 > /sys/bus/i2c/devices/i2c-17/new_device', +'echo as7326_56x_psu2 0x53 > /sys/bus/i2c/devices/i2c-13/new_device', +'echo ym2651 0x5b > /sys/bus/i2c/devices/i2c-13/new_device', +'echo as7326_56x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-18/new_device', +'echo as7326_56x_cpld2 0x62 > /sys/bus/i2c/devices/i2c-12/new_device', +'echo as7326_56x_cpld3 0x64 > /sys/bus/i2c/devices/i2c-19/new_device'] + +mknod2 =[ +] + + + +def i2c_order_check(): + # This project has only 1 i2c bus. + return 0 + +def device_install(): + global FORCE + + order = i2c_order_check() + + # if 0x70 is not exist @i2c-1, use reversed bus order + if order: + for i in range(0,len(mknod2)): + #for pca954x need times to built new i2c buses + if mknod2[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod2[i], 1) + if status: + print output + if FORCE == 0: + return status + else: + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + for i in range(0,len(sfp_map)): + if i < qsfp_start or i >= qsfp_end: + status, output =log_os_system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + else: + status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/1-0076", 0) + if status==0: + I2C_ORDER=1 + else: + I2C_ORDER=0 + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + if I2C_ORDER==0: + nodelist = mknod + else: + nodelist = mknod2 + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + for lk in cpld_of_module: + if k in cpld_of_module[lk]: + cpld_str = lk + node = key+str(k+1) + path = i2c_prefix+ lk + "/"+ nodes[j] + str(k+1) + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan'] ['fan1'][0] + node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0070", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile new file mode 100644 index 000000000000..d9566355b849 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/Makefile @@ -0,0 +1,2 @@ +obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \ + accton_as7712_32x_psu.o accton_i2c_cpld.o ym2651y.o diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c new file mode 100644 index 000000000000..3eae51cbcea7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c @@ -0,0 +1,776 @@ +/* + * A hwmon driver for the Accton as7712 32x fan + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as7712_32x_fan" + +#define NUM_THERMAL_SENSORS (3) /* Get sum of this number of sensors.*/ +#define THERMAL_SENSORS_DRIVER "lm75" +#define THERMAL_SENSORS_ADDRS {0x48, 0x49, 0x4a} + +#define IN +#define OUT + +static struct as7712_32x_fan_data *as7712_32x_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x0F, /* fan 1-6 present status */ + 0x11, /* fan PWM(for all fan) */ + 0x12, /* front fan 1 speed(rpm) */ + 0x13, /* front fan 2 speed(rpm) */ + 0x14, /* front fan 3 speed(rpm) */ + 0x15, /* front fan 4 speed(rpm) */ + 0x16, /* front fan 5 speed(rpm) */ + 0x17, /* front fan 6 speed(rpm) */ + 0x22, /* rear fan 1 speed(rpm) */ + 0x23, /* rear fan 2 speed(rpm) */ + 0x24, /* rear fan 3 speed(rpm) */ + 0x25, /* rear fan 4 speed(rpm) */ + 0x26, /* rear fan 5 speed(rpm) */ + 0x27, /* rear fan 6 speed(rpm) */ +}; + +/* Each client has this additional data */ +struct as7712_32x_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ + u8 enable; + int system_temp; /*In unit of mini-Celsius*/ + int sensors_found; +}; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID, + FAN6_ID +}; + +enum sysfs_fan_attributes { + FAN_PRESENT_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN6_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN6_REAR_SPEED_RPM, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN6_PRESENT, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, + FAN6_FAULT +}; + +/* Define attributes + */ +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT);\ + static SENSOR_DEVICE_ATTR(fan##index2##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index, index2) &sensor_dev_attr_fan##index##_fault.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_fault.dev_attr.attr + +#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO, fan_show_value, NULL, FAN##index##_DIRECTION) +#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index##_enable, S_IWUSR | S_IRUGO, get_enable, set_enable, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan_duty_cycle_percentage.dev_attr.attr, \ + &sensor_dev_attr_pwm##index.dev_attr.attr, \ + &sensor_dev_attr_pwm##index##_enable.dev_attr.attr + +#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ + static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr + + +#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) +#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index2##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index, index2) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_input.dev_attr.attr + +/* 6 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(6,16); +/* 6 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(6,16); +/* 6 fan present attributes in this platform */ +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(5); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(6); +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); +/* System temperature for fancontrol */ +DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); + +static struct attribute *as7712_32x_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_FAULT_ATTR(1,11), + DECLARE_FAN_FAULT_ATTR(2,12), + DECLARE_FAN_FAULT_ATTR(3,13), + DECLARE_FAN_FAULT_ATTR(4,14), + DECLARE_FAN_FAULT_ATTR(5,15), + DECLARE_FAN_FAULT_ATTR(6,16), + DECLARE_FAN_SPEED_RPM_ATTR(1,11), + DECLARE_FAN_SPEED_RPM_ATTR(2,12), + DECLARE_FAN_SPEED_RPM_ATTR(3,13), + DECLARE_FAN_SPEED_RPM_ATTR(4,14), + DECLARE_FAN_SPEED_RPM_ATTR(5,15), + DECLARE_FAN_SPEED_RPM_ATTR(6,16), + DECLARE_FAN_PRESENT_ATTR(1), + DECLARE_FAN_PRESENT_ATTR(2), + DECLARE_FAN_PRESENT_ATTR(3), + DECLARE_FAN_PRESENT_ATTR(4), + DECLARE_FAN_PRESENT_ATTR(5), + DECLARE_FAN_PRESENT_ATTR(6), + DECLARE_FAN_DUTY_CYCLE_ATTR(1), + DECLARE_FAN_SYSTEM_TEMP_ATTR(), + NULL +}; + +#define FAN_DUTY_CYCLE_REG_MASK 0xF +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100 + +static int as7712_32x_fan_read_value(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int as7712_32x_fan_write_value(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + reg_val &= FAN_DUTY_CYCLE_REG_MASK; + return ((u32)(reg_val+1) * 625 + 75)/ 100; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + return ((u32)duty_cycle * 100 / 625) - 1; +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 0 : 1; +} + +static u8 is_fan_fault(struct as7712_32x_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = FAN1_FRONT_SPEED_RPM + id; + int rear_fan_index = FAN1_REAR_SPEED_RPM + id; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + ret = 0; + } + + return ret; +} + +static ssize_t set_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev); + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 1) + return -EINVAL; + + data->enable = value; + if (value == 0) + { + return set_duty_cycle(dev, da, buf, FAN_MAX_DUTY_CYCLE); + } + return count; +} + + +static ssize_t get_enable(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev); + + return sprintf(buf, "%u\n", data->enable); +} +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0) + return -EINVAL; + + value = (value > FAN_MAX_DUTY_CYCLE)? FAN_MAX_DUTY_CYCLE : value; + + as7712_32x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ + as7712_32x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + return count; +} + +/* Due to this struct is declared at lm75.c, it cannot be include + * under Sonic environment. I duplicate it from lm75.c. + */ +struct lm75_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct thermal_zone_device *tz; + struct mutex update_lock; + u8 orig_conf; + u8 resolution; /* In bits, between 9 and 12 */ + u8 resolution_limits; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + unsigned long sample_time; /* In jiffies */ + s16 temp[3]; /* Register values, + 0 = input + 1 = max + 2 = hyst */ +}; + +/*Copied from lm75.c*/ +static inline long lm75_reg_to_mc(s16 temp, u8 resolution) +{ + return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); +} + +/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ +static struct device * get_hwmon_dev( + struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if(data) + { + if( data->valid == 1 && data->hwmon_dev) + { + return data->hwmon_dev; + } + + } + return NULL; +} + +/* To find hwmon index by opening hwmon under that i2c address. + */ +static int find_hwmon_index_by_FileOpen( + int bus_nr, + unsigned short addr, + OUT int *index) +{ +#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ + struct file *sfd; + char client_name[96]; + int i=0; + + do { + snprintf(client_name, sizeof(client_name), + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + + sfd = filp_open(client_name, O_RDONLY, 0); + i++; + } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); + + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); + return -ENOENT; + } + filp_close(sfd, 0); + *index = i - 1; + return 0; + +#undef MAX_HWMON_DEVICE +} + +static int get_temp_file_path( + int bus_nr, unsigned short addr, + struct device *hwmon_dev + ,char *path, int max_len) +{ + + if(hwmon_dev && strlen(dev_name(hwmon_dev))) + { + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", + bus_nr, addr, dev_name(hwmon_dev)); + } + else + { + int i=0; + if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) + { + return -EIO; + } + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + } + return 0; +} + +/*File read the dev file at user space.*/ +static int read_devfile_temp1_input( + struct device *dev, + int bus_nr, + unsigned short addr, + struct device *hwmon_dev, + int *miniCelsius) +{ + struct file *sfd; + char buffer[96]; + char devfile[96]; + int rc, status; + int rdlen, value; + mm_segment_t old_fs; + + rc = 0; + get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); + sfd = filp_open(devfile, O_RDONLY, 0); + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); + return -ENOENT; + } + dev_dbg(dev, "Found device:%s\n",devfile); + + if(!(sfd->f_op) || !(sfd->f_op->read) ) { + pr_err("file %s cann't readable ?\n",devfile); + return -ENOENT; + } + + old_fs = get_fs(); + set_fs(KERNEL_DS); + rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); + if (rdlen == 0) { + pr_err( "File(%s) empty!\n", devfile); + rc = -EIO; + goto exit; + } + status = sscanf(buffer, "%d", &value); + if (status != 1) { + rc = -EIO; + goto exit; + } + *miniCelsius = value; + dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); + +exit: + set_fs(old_fs); + filp_close(sfd, 0); + return rc; +} + +static u8 is_lm75_data_due(struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if (time_after(jiffies, data->last_updated + data->sample_time)) + { + return 1; + } + return 0; +} +static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); + + return 0; +} + +static bool lm75_addr_mached(unsigned short addr) +{ + int i; + unsigned short addrs[] = THERMAL_SENSORS_ADDRS; + + for (i = 0; i < ARRAY_SIZE(addrs); i++) + { + if( addr == addrs[i]) + return 1; + } + return 0; +} + +static int _find_lm75_device(struct device *dev, void *data) +{ + struct device_driver *driver; + struct as7712_32x_fan_data *prv = data; + char *driver_name = THERMAL_SENSORS_DRIVER; + + driver = dev->driver; + if (driver && driver->name && + strcmp(driver->name, driver_name) == 0) + { + struct i2c_client *client; + client = to_i2c_client(dev); + if (client) + { + /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ + struct i2c_adapter *adap = client->adapter; + int miniCelsius = 0; + + if (! lm75_addr_mached(client->addr)) + { + return 0; + } + + if (!adap) { + return -ENXIO; + } + + /* If the data is not updated, read them from devfile + to drive them updateing data from chip.*/ + if (is_lm75_data_due(client)) + { + struct device *hwmon_dev; + + hwmon_dev = get_hwmon_dev(client); + if(0 == read_devfile_temp1_input(dev, adap->nr, + client->addr, hwmon_dev, &miniCelsius)) + { + prv->system_temp += miniCelsius; + prv->sensors_found++; + } + + } + else + { + get_lm75_temp(client, &miniCelsius); + prv->system_temp += miniCelsius; + prv->sensors_found++; + + } + } + } + return 0; +} + +/*Find all lm75 devices and return sum of temperatures.*/ +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + ssize_t ret = 0; + struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev); + + data->system_temp=0; + data->sensors_found=0; + i2c_for_each_dev(data, _find_lm75_device); + if (NUM_THERMAL_SENSORS != data->sensors_found) + { + dev_dbg(dev,"only %d of %d temps are found\n", + data->sensors_found, NUM_THERMAL_SENSORS); + data->system_temp = INT_MAX; + } + ret = sprintf(buf, "%d\n",data->system_temp); + return ret; +} + +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev); + ssize_t ret = 0; + + if (data->valid) { + switch (attr->index) { + case FAN_DUTY_CYCLE_PERCENTAGE: + { + u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + ret = sprintf(buf, "%d\n", + reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], + attr->index - FAN1_PRESENT)); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group as7712_32x_fan_group = { + .attrs = as7712_32x_fan_attributes, +}; + +static struct as7712_32x_fan_data *as7712_32x_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7712_32x_fan_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + dev_dbg(&client->dev, "Starting as7712_32x_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + int status = as7712_32x_fan_read_value(client, fan_reg[i]); + + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int as7712_32x_fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7712_32x_fan_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7712_32x_fan_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->enable = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7712_32x_fan_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: fan '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7712_32x_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7712_32x_fan_remove(struct i2c_client *client) +{ + struct as7712_32x_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7712_32x_fan_group); + + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; + +static const struct i2c_device_id as7712_32x_fan_id[] = { + { "as7712_32x_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7712_32x_fan_id); + +static struct i2c_driver as7712_32x_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = as7712_32x_fan_probe, + .remove = as7712_32x_fan_remove, + .id_table = as7712_32x_fan_id, + .address_list = normal_i2c, +}; + +static int __init as7712_32x_fan_init(void) +{ + return i2c_add_driver(&as7712_32x_fan_driver); +} + +static void __exit as7712_32x_fan_exit(void) +{ + i2c_del_driver(&as7712_32x_fan_driver); +} + +module_init(as7712_32x_fan_init); +module_exit(as7712_32x_fan_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7712_32x_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c new file mode 100644 index 000000000000..233aef78e09f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c @@ -0,0 +1,288 @@ +/* + * An hwmon driver for accton as7712_32x Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static int as7712_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, 0x53, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7712_32x_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[9]; /* Model name, read from eeprom */ +}; + +static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *dev); + +enum as7712_32x_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); + +static struct attribute *as7712_32x_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7712_32x_psu_data *data = as7712_32x_psu_update_device(dev); + u8 status = 0; + + if (attr->index == PSU_PRESENT) { + status = !(data->status >> (1-data->index) & 0x1); + } + else { /* PSU_POWER_GOOD */ + status = (data->status >> (3-data->index) & 0x1); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7712_32x_psu_data *data = as7712_32x_psu_update_device(dev); + + return sprintf(buf, "%s\n", data->model_name); +} + +static const struct attribute_group as7712_32x_psu_group = { + .attrs = as7712_32x_psu_attributes, +}; + +static int as7712_32x_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7712_32x_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7712_32x_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7712_32x_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7712_32x_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7712_32x_psu_remove(struct i2c_client *client) +{ + struct as7712_32x_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7712_32x_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as7712_32x_psu1, + as7712_32x_psu2 +}; + +static const struct i2c_device_id as7712_32x_psu_id[] = { + { "as7712_32x_psu1", as7712_32x_psu1 }, + { "as7712_32x_psu2", as7712_32x_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7712_32x_psu_id); + +static struct i2c_driver as7712_32x_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7712_32x_psu", + }, + .probe = as7712_32x_psu_probe, + .remove = as7712_32x_psu_remove, + .id_table = as7712_32x_psu_id, + .address_list = normal_i2c, +}; + +static int as7712_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7712_32x_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; + int power_good = 0; + + dev_dbg(&client->dev, "Starting as7712_32x update\n"); + + /* Read psu status */ + status = accton_i2c_cpld_read(0x60, 0x2); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + } + else { + data->status = status; + } + + /* Read model name */ + memset(data->model_name, 0, sizeof(data->model_name)); + power_good = (data->status >> (3-data->index) & 0x1); + + if (power_good) { + status = as7712_32x_psu_read_block(client, 0x20, data->model_name, + ARRAY_SIZE(data->model_name)-1); + + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); + } + else { + data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init as7712_32x_psu_init(void) +{ + return i2c_add_driver(&as7712_32x_psu_driver); +} + +static void __exit as7712_32x_psu_exit(void) +{ + i2c_del_driver(&as7712_32x_psu_driver); +} + +module_init(as7712_32x_psu_init); +module_exit(as7712_32x_psu_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7712_32x_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c new file mode 100644 index 000000000000..4668f5a7f050 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_sfp.c @@ -0,0 +1,1171 @@ +/* + * SFP driver for accton as7712_32x sfp + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "as7712_32x_sfp" + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define NUM_OF_SFP_PORT 32 +#define EEPROM_NAME "sfp_eeprom" +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define BIT_INDEX(i) (1ULL << (i)) +#define USE_I2C_BLOCK_READ 1 +#define I2C_RW_RETRY_COUNT 3 +#define I2C_RW_RETRY_INTERVAL 100 /* ms */ + +#define SFP_EEPROM_A0_I2C_ADDR (0xA0 >> 1) +#define SFP_EEPROM_A2_I2C_ADDR (0xA2 >> 1) + +#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 +#define SFF8024_DEVICE_ID_SFP 0x3 +#define SFF8024_DEVICE_ID_QSFP 0xC +#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD +#define SFF8024_DEVICE_ID_QSFP28 0x11 + +#define SFF8472_DIAG_MON_TYPE_ADDR 92 +#define SFF8472_DIAG_MON_TYPE_DDM_MASK 0x40 +#define SFF8472_10G_ETH_COMPLIANCE_ADDR 0x3 +#define SFF8472_10G_BASE_MASK 0xF0 + +#define SFF8436_RX_LOS_ADDR 3 +#define SFF8436_TX_FAULT_ADDR 4 +#define SFF8436_TX_DISABLE_ADDR 86 + +static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { SFP_EEPROM_A0_I2C_ADDR, SFP_EEPROM_A2_I2C_ADDR, I2C_CLIENT_END }; + +#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) + +enum port_numbers { +sfp1, sfp2, sfp3, sfp4, sfp5, sfp6, sfp7, sfp8, +sfp9, sfp10, sfp11, sfp12, sfp13, sfp14, sfp15, sfp16, +sfp17, sfp18, sfp19, sfp20, sfp21, sfp22, sfp23, sfp24, +sfp25, sfp26, sfp27, sfp28, sfp29, sfp30, sfp31, sfp32 +}; + +static const struct i2c_device_id sfp_device_id[] = { +{ "sfp1", sfp1 }, { "sfp2", sfp2 }, { "sfp3", sfp3 }, { "sfp4", sfp4 }, +{ "sfp5", sfp5 }, { "sfp6", sfp6 }, { "sfp7", sfp7 }, { "sfp8", sfp8 }, +{ "sfp9", sfp9 }, { "sfp10", sfp10 }, { "sfp11", sfp11 }, { "sfp12", sfp12 }, +{ "sfp13", sfp13 }, { "sfp14", sfp14 }, { "sfp15", sfp15 }, { "sfp16", sfp16 }, +{ "sfp17", sfp17 }, { "sfp18", sfp18 }, { "sfp19", sfp19 }, { "sfp20", sfp20 }, +{ "sfp21", sfp21 }, { "sfp22", sfp22 }, { "sfp23", sfp23 }, { "sfp24", sfp24 }, +{ "sfp25", sfp25 }, { "sfp26", sfp26 }, { "sfp27", sfp27 }, { "sfp28", sfp28 }, +{ "sfp29", sfp29 }, { "sfp30", sfp30 }, { "sfp31", sfp31 }, { "sfp32", sfp32 }, +{} +}; +MODULE_DEVICE_TABLE(i2c, sfp_device_id); + +/* + * list of valid port types + * note OOM_PORT_TYPE_NOT_PRESENT to indicate no + * module is present in this port + */ +typedef enum oom_driver_port_type_e { + OOM_DRIVER_PORT_TYPE_INVALID, + OOM_DRIVER_PORT_TYPE_NOT_PRESENT, + OOM_DRIVER_PORT_TYPE_SFP, + OOM_DRIVER_PORT_TYPE_SFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP, + OOM_DRIVER_PORT_TYPE_QSFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP28 +} oom_driver_port_type_t; + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_SFP_DDM, + DRIVER_TYPE_QSFP +}; + +/* Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct sfp_msa_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[2]; /* index 0 => device id + 1 => 10G Ethernet Compliance Codes + to distinguish SFP or SFP+ + 2 => DIAGNOSTIC MONITORING TYPE */ + struct eeprom_data eeprom; +}; + +struct sfp_ddm_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + struct eeprom_data eeprom; +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + oom_driver_port_type_t port_type; + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + u64 port_reset; /* reset status, bit0:port0, bit1:port1 and so on */ + + struct sfp_msa_data *msa; + struct sfp_ddm_data *ddm; + struct qsfp_data *qsfp; + + struct i2c_client *client; +}; + +enum sfp_sysfs_attributes { + PRESENT, + PRESENT_ALL, + PORT_NUMBER, + PORT_TYPE, + DDM_IMPLEMENTED, + TX_FAULT, + TX_FAULT1, + TX_FAULT2, + TX_FAULT3, + TX_FAULT4, + TX_DISABLE, + TX_DISABLE1, + TX_DISABLE2, + TX_DISABLE3, + TX_DISABLE4, + TX_DISABLE_ALL, + RX_LOS, + RX_LOS1, + RX_LOS2, + RX_LOS3, + RX_LOS4, + RX_LOS_ALL, + PORT_RESET +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port)); +} + +static struct sfp_port_data *sfp_update_present(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {0x30, 0x31, 0x32, 0x33}; + + DEBUG_PRINT("Starting sfp present status update"); + mutex_lock(&data->update_lock); + + /* Read present status of port 1~32 */ + data->present = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = accton_i2c_cpld_read(0x60, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld(0x60) reg(0x%x) err %d", regs[i], status); + goto exit; + } + + DEBUG_PRINT("Present status = 0x%llx", data->present); + data->present |= (u64)status << (i*8); + } + + DEBUG_PRINT("Present status = 0x%llx", data->present); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static struct sfp_port_data *sfp_update_tx_rx_status(struct device *dev) +{ + return NULL; +} + +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + return 0; +} + +static int sfp_is_port_present(struct i2c_client *client, int port) +{ + struct sfp_port_data *data = sfp_update_present(client); + return (data->present & BIT_INDEX(data->port)) ? 0 : 1; +} + +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (PRESENT_ALL == attr->index) { + + } + + /* PRESENT */ + return sprintf(buf, "%d\n", sfp_is_port_present(client, data->port)); +} + +static struct sfp_port_data *sfp_update_port_type(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 buf = 0; + int status; + + mutex_lock(&data->update_lock); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + { + status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + if (buf != SFF8024_DEVICE_ID_SFP) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + status = sfp_eeprom_read(data->client, SFF8472_10G_ETH_COMPLIANCE_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("sfp port type (0x3) data = (0x%x)", buf); + data->port_type = buf & SFF8472_10G_BASE_MASK ? OOM_DRIVER_PORT_TYPE_SFP_PLUS : OOM_DRIVER_PORT_TYPE_SFP; + break; + } + case DRIVER_TYPE_QSFP: + { + status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("qsfp port type (0x0) buf = (0x%x)", buf); + switch (buf) { + case SFF8024_DEVICE_ID_QSFP: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP; + break; + case SFF8024_DEVICE_ID_QSFP_PLUS: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + case SFF8024_DEVICE_ID_QSFP28: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + default: + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + break; + } + default: + break; + } + + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_type(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (!sfp_is_port_present(client, data->port)) { + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_type(dev); + return sprintf(buf, "%d\n", data->port_type); +} + + +static struct sfp_port_data *sfp_update_port_reset(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {0x4, 0x5, 0x6, 0x7}; + + mutex_lock(&data->update_lock); + + /* Read reset status of port 1~32 */ + data->port_reset = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = accton_i2c_cpld_read(0x60, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld(0x60) reg(0x%x) err %d", regs[i], status); + goto exit; + } + + DEBUG_PRINT("reset status = 0x%x", status); + data->port_reset |= (u64)status << (i*8); + } + + DEBUG_PRINT("reset status = 0x%llx", data->port_reset); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_reset(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int is_reset = 0; + + if (!sfp_is_port_present(client, data->port)) { + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_reset(client); + is_reset = (data->port_reset & BIT_INDEX(data->port))? 0 : 1; + + return sprintf(buf, "%d\n", is_reset); +} + +static ssize_t sfp_set_port_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 cpld_reg = 0, cpld_val = 0, cpld_bit = 0; + long is_reset; + int error; + + error = kstrtol(buf, 10, &is_reset); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + cpld_reg = 0x4 + data->port / 8; + cpld_bit = 1 << (data->port % 8); + + cpld_val = accton_i2c_cpld_read(0x60, cpld_reg); + DEBUG_PRINT("current cpld reg = 0x%x value = 0x%x", cpld_reg, cpld_val); + + /* Update reset status. CPLD defined 0 is reset state, 1 is normal state. + * is_reset: 0 is not reset. 1 is reset. + */ + if (is_reset == 0) { + data->port_reset |= BIT_INDEX(data->port); + cpld_val |= cpld_bit; + } + else { + data->port_reset &= ~BIT_INDEX(data->port); + cpld_val &= ~cpld_bit; + } + + accton_i2c_cpld_write(0x60, cpld_reg, cpld_val); + DEBUG_PRINT("write cpld reg = 0x%x value = 0x%x cpld_bit = 0x%x", cpld_reg, cpld_val,cpld_bit); + + mutex_unlock(&data->update_lock); + + return count; +} + +static struct sfp_port_data *qsfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i, status = -1; + u8 buf = 0; + u8 reg[] = {SFF8436_TX_FAULT_ADDR, SFF8436_TX_DISABLE_ADDR, SFF8436_RX_LOS_ADDR}; + + if (time_before(jiffies, data->qsfp->last_updated + HZ + HZ / 2) && data->qsfp->valid) { + return data; + } + + dev_dbg(dev, "Starting sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->qsfp->valid = 0; + memset(data->qsfp->status, 0, sizeof(data->qsfp->status)); + + /* Notify device to update tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(data->client, reg[i], &buf, sizeof(buf)); + if (status < 0) { + goto exit; + } + } + msleep(200); + + /* Read actual tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(data->client, reg[i], &buf, sizeof(buf)); + if (status < 0) { + goto exit; + } + + DEBUG_PRINT("qsfp reg(0x%x) status = (0x%x)", reg[i], data->qsfp->status[i]); + data->qsfp->status[i] = (buf & 0xF); + } + + data->qsfp->valid = 1; + data->qsfp->last_updated = jiffies; + mutex_unlock(&data->update_lock); + return data; + +exit: + mutex_unlock(&data->update_lock); + return NULL; +} + +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (!sfp_is_port_present(client, data->port)) { + return -ENODEV; + } + + data = qsfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + + switch (attr->index) { + case TX_FAULT1: + case TX_FAULT2: + case TX_FAULT3: + case TX_FAULT4: + val = (data->qsfp->status[2] & BIT_INDEX(attr->index - TX_FAULT1)) ? 1 : 0; + break; + case TX_DISABLE1: + case TX_DISABLE2: + case TX_DISABLE3: + case TX_DISABLE4: + val = (data->qsfp->status[1] & BIT_INDEX(attr->index - TX_DISABLE1)) ? 1 : 0; + break; + case TX_DISABLE_ALL: + val = ((data->qsfp->status[1] & 0xF) == 0xF) ? 1 : 0; + break; + + case RX_LOS1: + case RX_LOS2: + case RX_LOS3: + case RX_LOS4: + val = (data->qsfp->status[0] & BIT_INDEX(attr->index - RX_LOS1)) ? 1 : 0; + break; + default: + break; + } + + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + long disable; + int result; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data; + + result = kstrtol(buf, 10, &disable); + if (result) { + return result; + } + + data = qsfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + + mutex_lock(&data->update_lock); + + DEBUG_PRINT ("disable:%ld %d==%d %u\r\n", disable, attr->index, TX_DISABLE_ALL, data->qsfp->status[1]); + + if (attr->index == TX_DISABLE_ALL) + { + data->qsfp->status[1] = disable? 0xF:0; + } + else + { + if (disable) { + data->qsfp->status[1] |= (1 << (attr->index - TX_DISABLE1)); + } + else { + data->qsfp->status[1] &= ~(1 << (attr->index - TX_DISABLE1)); + } + } + DEBUG_PRINT("index = (%d), status = (0x%x)", attr->index, data->qsfp->status[1]); + result = sfp_eeprom_write(client, SFF8436_TX_DISABLE_ADDR, &data->qsfp->status[1], sizeof(data->qsfp->status[1])); + mutex_unlock(&data->update_lock); + return count; +} + +static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + char ddm; + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (!sfp_is_port_present(client, data->port)) { + return -ENODEV; + } + + status = sfp_eeprom_read(data->client, SFF8472_DIAG_MON_TYPE_ADDR, &ddm, sizeof(ddm)); + if (status < 0) { + return -EIO; + } + + return sprintf(buf, "%d\n", (ddm & SFF8472_DIAG_MON_TYPE_DDM_MASK) ? 1 : 0); +} + +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0, index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data; + + data = sfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + + switch (attr->index) { + case TX_FAULT: + index = 0; + break; + case TX_DISABLE: + index = 1; + break; + case RX_LOS: + index = 2; + break; + default: + break; + } + + val = (data->ddm->status[index] & BIT_INDEX(data->port)) ? 1 : 0; + return sprintf(buf, "%d\n", val); +} + +/* SFP/QSFP common attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_present, NULL, PRESENT); +static SENSOR_DEVICE_ATTR(sfp_port_type, S_IRUGO, show_port_type, NULL, PORT_TYPE); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_present, NULL, PRESENT); +static SENSOR_DEVICE_ATTR(sfp_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT_RESET); + +/* QSFP attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_rx_los1, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS1); +static SENSOR_DEVICE_ATTR(sfp_rx_los2, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS2); +static SENSOR_DEVICE_ATTR(sfp_rx_los3, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS3); +static SENSOR_DEVICE_ATTR(sfp_rx_los4, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS4); +static SENSOR_DEVICE_ATTR(sfp_tx_disable1, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE1); +static SENSOR_DEVICE_ATTR(sfp_tx_disable2, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE2); +static SENSOR_DEVICE_ATTR(sfp_tx_disable3, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE3); +static SENSOR_DEVICE_ATTR(sfp_tx_disable4, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE4); +static SENSOR_DEVICE_ATTR(sfp_tx_disable_all, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE_ALL); +static SENSOR_DEVICE_ATTR(sfp_tx_fault1, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT1); +static SENSOR_DEVICE_ATTR(sfp_tx_fault2, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT2); +static SENSOR_DEVICE_ATTR(sfp_tx_fault3, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT3); +static SENSOR_DEVICE_ATTR(sfp_tx_fault4, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT4); +static struct attribute *qsfp_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_port_type.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_port_reset.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los1.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los2.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los3.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable_all.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault4.dev_attr.attr, + NULL +}; + +/* SFP msa attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_ddm_implemented, S_IRUGO, sfp_show_ddm_implemented, NULL, DDM_IMPLEMENTED); +static struct attribute *sfp_msa_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_port_type.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_ddm_implemented.dev_attr.attr, + NULL +}; + +/* SFP ddm attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS); +static SENSOR_DEVICE_ATTR(sfp_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, TX_DISABLE); +static SENSOR_DEVICE_ATTR(sfp_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, TX_FAULT); +static struct attribute *sfp_ddm_attributes[] = { + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + NULL +}; + +static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return data_len; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_write_byte_data(client, command, *data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return 1; +#endif + + +} + + +static ssize_t sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; +} + + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return sfp_port_write(data, buf, off, count); +} + +static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + //result = data_len; + +abort: + return result; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_read_byte_data(client, command); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, result); + goto abort; + } + + *data = (u8)result; + result = 1; + +abort: + return result; +#endif +} + +static ssize_t sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; + +} + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return sfp_port_read(data, buf, off, count); +} + +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; + eeprom->size = EEPROM_SIZE; + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + return 0; +} + +static const struct attribute_group sfp_msa_group = { + .attrs = sfp_msa_attributes, +}; + +static int sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} + +static int sfp_msa_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_msa_data **data) +{ + int status; + struct sfp_msa_data *msa; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + msa = kzalloc(sizeof(struct sfp_msa_data), GFP_KERNEL); + if (!msa) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_msa_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &msa->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = msa; + dev_info(&client->dev, "sfp msa '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); +exit_free: + kfree(msa); +exit: + + return status; +} + +static const struct attribute_group sfp_ddm_group = { + .attrs = sfp_ddm_attributes, +}; + +static int sfp_ddm_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_ddm_data **data) +{ + int status; + struct sfp_ddm_data *ddm; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + ddm = kzalloc(sizeof(struct sfp_ddm_data), GFP_KERNEL); + if (!ddm) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_ddm_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &ddm->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = ddm; + dev_info(&client->dev, "sfp ddm '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); +exit_free: + kfree(ddm); +exit: + + return status; +} + +static const struct attribute_group qsfp_group = { + .attrs = qsfp_attributes, +}; + +static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); + if (status) { + goto exit_remove; + } + + /* Bring QSFPs out of reset + as6712_32x_i2c_cpld_write(0x62, 0x4, 0xFF); + as6712_32x_i2c_cpld_write(0x62, 0x5, 0xFF); + as6712_32x_i2c_cpld_write(0x64, 0x4, 0xFF); + as6712_32x_i2c_cpld_write(0x64, 0x5, 0xFF);*/ + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &qsfp_group); +exit_free: + kfree(qsfp); +exit: + + return status; +} + +static int sfp_device_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct sfp_port_data *data = NULL; + + data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + data->client = client; + + if (client->addr != SFP_EEPROM_A0_I2C_ADDR) { + return -ENODEV; + } + + data->driver_type = DRIVER_TYPE_QSFP; + return qsfp_probe(client, dev_id, &data->qsfp); +} + +static int sfp_msa_remove(struct i2c_client *client, struct sfp_msa_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); + kfree(data); + return 0; +} + +static int sfp_ddm_remove(struct i2c_client *client, struct sfp_ddm_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); + kfree(data); + return 0; +} + +static int qfp_remove(struct i2c_client *client, struct qsfp_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + return 0; +} + +static int sfp_device_remove(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + return sfp_msa_remove(client, data->msa); + case DRIVER_TYPE_SFP_DDM: + return sfp_ddm_remove(client, data->ddm); + case DRIVER_TYPE_QSFP: + return qfp_remove(client, data->qsfp); + } + + return 0; +} + +static struct i2c_driver sfp_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = sfp_device_probe, + .remove = sfp_device_remove, + .id_table = sfp_device_id, + .address_list = normal_i2c, +}; + +static int __init sfp_init(void) +{ + return i2c_add_driver(&sfp_driver); +} + +static void __exit sfp_exit(void) +{ + i2c_del_driver(&sfp_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as7712_32x_sfp driver"); +MODULE_LICENSE("GPL"); + +module_init(sfp_init); +module_exit(sfp_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c new file mode 120000 index 000000000000..39c0826d16fd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_i2c_cpld.c @@ -0,0 +1 @@ +../../common/modules/accton_i2c_cpld.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_pmbus_3y.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_pmbus_3y.c new file mode 120000 index 000000000000..7504a0556e18 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_pmbus_3y.c @@ -0,0 +1 @@ +../../common/modules/accton_pmbus_3y.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c new file mode 100644 index 000000000000..5e1a9282db0e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/leds-accton_as7712_32x.c @@ -0,0 +1,690 @@ +/* + * A LED driver for the accton_as7712_32x_led + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern int accton_i2c_cpld_read (unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "accton_as7712_32x_led" +#define ENABLE_PORT_LED 1 + +struct accton_as7712_32x_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[1]; /* only 1 register*/ +}; + +static struct accton_as7712_32x_led_data *ledctl = NULL; + +/* LED related data + */ + +#define LED_CNTRLER_I2C_ADDRESS (0x60) + +#define LED_TYPE_DIAG_REG_MASK (0x3) +#define LED_MODE_DIAG_GREEN_VALUE (0x02) +#define LED_MODE_DIAG_RED_VALUE (0x01) +#define LED_MODE_DIAG_AMBER_VALUE (0x00) /*It's yellow actually. Green+Red=Yellow*/ +#define LED_MODE_DIAG_OFF_VALUE (0x03) + +#define LED_TYPE_LOC_REG_MASK (0x80) +#define LED_MODE_LOC_ON_VALUE (0) +#define LED_MODE_LOC_OFF_VALUE (0x80) + +#if (ENABLE_PORT_LED == 1) +#define LED_TYPE_PORT_LED(port) \ + LED_TYPE_PORT##port##_LED0, \ + LED_TYPE_PORT##port##_LED1, \ + LED_TYPE_PORT##port##_LED2, \ + LED_TYPE_PORT##port##_LED3 +#endif + +enum led_type { + LED_TYPE_DIAG, + LED_TYPE_LOC, + LED_TYPE_FAN, + LED_TYPE_PSU1, + LED_TYPE_PSU2, +#if (ENABLE_PORT_LED == 1) + LED_TYPE_PORT_LED(0), + LED_TYPE_PORT_LED(1), + LED_TYPE_PORT_LED(2), + LED_TYPE_PORT_LED(3), + LED_TYPE_PORT_LED(4), + LED_TYPE_PORT_LED(5), + LED_TYPE_PORT_LED(6), + LED_TYPE_PORT_LED(7), + LED_TYPE_PORT_LED(8), + LED_TYPE_PORT_LED(9), + LED_TYPE_PORT_LED(10), + LED_TYPE_PORT_LED(11), + LED_TYPE_PORT_LED(12), + LED_TYPE_PORT_LED(13), + LED_TYPE_PORT_LED(14), + LED_TYPE_PORT_LED(15), + LED_TYPE_PORT_LED(16), + LED_TYPE_PORT_LED(17), + LED_TYPE_PORT_LED(18), + LED_TYPE_PORT_LED(19), + LED_TYPE_PORT_LED(20), + LED_TYPE_PORT_LED(21), + LED_TYPE_PORT_LED(22), + LED_TYPE_PORT_LED(23), + LED_TYPE_PORT_LED(24), + LED_TYPE_PORT_LED(25), + LED_TYPE_PORT_LED(26), + LED_TYPE_PORT_LED(27), + LED_TYPE_PORT_LED(28), + LED_TYPE_PORT_LED(29), + LED_TYPE_PORT_LED(30), + LED_TYPE_PORT_LED(31), +#endif +}; + +struct led_reg { + u32 types; + u8 reg_addr; +}; + +static const struct led_reg led_reg_map[] = { + {(1<update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting accton_as7712_32x_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = accton_as7712_32x_led_read_value(led_reg_map[i].reg_addr); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg_map[i].reg_addr, status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as7712_32x_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + enum led_type type) +{ + int reg_val; + u8 reg ; + mutex_lock(&ledctl->update_lock); + + if( !accton_getLedReg(type, ®)) + { + dev_dbg(&ledctl->pdev->dev, "Not match item for %d.\n", type); + } + + reg_val = accton_as7712_32x_led_read_value(reg); + + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + accton_as7712_32x_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + + +static void accton_as7712_32x_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as7712_32x_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG); +} + +static enum led_brightness accton_as7712_32x_led_diag_get(struct led_classdev *cdev) +{ + accton_as7712_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void accton_as7712_32x_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as7712_32x_led_set(led_cdev, led_light_mode, LED_TYPE_LOC); +} + +static enum led_brightness accton_as7712_32x_led_loc_get(struct led_classdev *cdev) +{ + accton_as7712_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static void accton_as7712_32x_led_auto_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ +} + +static enum led_brightness accton_as7712_32x_led_auto_get(struct led_classdev *cdev) +{ + return LED_MODE_AUTO; +} + +#if (ENABLE_PORT_LED == 1) +#define PORT_LED_COLOR_MASK (0x7 << 2) +#define PORT_LED_COLOR1_REG_VAL (0x0 << 2) +#define PORT_LED_COLOR2_REG_VAL (0x1 << 2) +#define PORT_LED_COLOR3_REG_VAL (0x2 << 2) +#define PORT_LED_COLOR4_REG_VAL (0x3 << 2) +#define PORT_LED_COLOR5_REG_VAL (0x4 << 2) +#define PORT_LED_COLOR6_REG_VAL (0x5 << 2) +#define PORT_LED_COLOR7_REG_VAL (0x6 << 2) +#define PORT_LED_COLOR8_REG_VAL (0x7 << 2) + +static int accton_as7712_32x_port_led_read_value(unsigned short cpld_addr, u8 reg) +{ + return accton_i2c_cpld_read(cpld_addr, reg); +} + +static int accton_as7712_32x_port_led_write_value(unsigned short cpld_addr, u8 reg, u8 value) +{ + return accton_i2c_cpld_write(cpld_addr, reg, value); +} + +static int port_led_mode_to_cpld_val(int mode) +{ + u8 color = 0; + u8 blinking = 0; + u8 on = 1 << 0; + + switch (mode) { + case LED_MODE_WHITE_BLINKING: blinking = 1 << 1; /* fall through */ + case LED_MODE_WHITE: color = 0x0 << 2; + break; + case LED_MODE_YELLOW_BLINKING: blinking = 1 << 1; /* fall through */ + case LED_MODE_YELLOW: color = 0x1 << 2; + break; + case LED_MODE_ORANGE_BLINKING: blinking = 1 << 1; /* fall through */ + case LED_MODE_ORANGE: color = 0x2 << 2; + break; + case LED_MODE_PURPLE_BLINKING: blinking = 1 << 1; /* fall through */ + case LED_MODE_PURPLE: color = 0x3 << 2; + break; + case LED_MODE_CYAN_BLINKING: blinking = 1 << 1; /* fall through */ + case LED_MODE_CYAN: color = 0x4 << 2; + break; + case LED_MODE_RED_BLINKING: blinking = 1 << 1; /* fall through */ + case LED_MODE_RED: color = 0x5 << 2; + break; + case LED_MODE_GREEN_BLINKING: blinking = 1 << 1; /* fall through */ + case LED_MODE_GREEN: color = 0x6 << 2; + break; + case LED_MODE_BLUE_BLINKING: blinking = 1 << 1; /* fall through */ + case LED_MODE_BLUE: color = 0x7 << 2; + break; + case LED_MODE_OFF: on = 0 << 0; + break; + default: + return -EINVAL; + } + + return (color | blinking | on); +} + +static int cpld_val_to_port_led_mode(uint8_t value) +{ + int on = (value & 0x1); + int blinking = (value & 0x2); + int color = (value & PORT_LED_COLOR_MASK) ; + + if (!on) { + return LED_MODE_OFF; + } + + switch (color) { + case PORT_LED_COLOR1_REG_VAL: + return blinking ? LED_MODE_WHITE_BLINKING : LED_MODE_WHITE; + case PORT_LED_COLOR2_REG_VAL: + return blinking ? LED_MODE_YELLOW_BLINKING : LED_MODE_YELLOW; + case PORT_LED_COLOR3_REG_VAL: + return blinking ? LED_MODE_ORANGE_BLINKING : LED_MODE_ORANGE; + case PORT_LED_COLOR4_REG_VAL: + return blinking ? LED_MODE_PURPLE_BLINKING : LED_MODE_PURPLE; + case PORT_LED_COLOR5_REG_VAL: + return blinking ? LED_MODE_CYAN_BLINKING : LED_MODE_CYAN; + case PORT_LED_COLOR6_REG_VAL: + return blinking ? LED_MODE_RED_BLINKING : LED_MODE_RED; + case PORT_LED_COLOR7_REG_VAL: + return blinking ? LED_MODE_GREEN_BLINKING : LED_MODE_GREEN; + case PORT_LED_COLOR8_REG_VAL: + return blinking ? LED_MODE_BLUE_BLINKING : LED_MODE_BLUE; + default: + return -EINVAL;; + } +} + + +static void accton_as7712_32x_port_led_set(struct led_classdev *cdev, + enum led_brightness led_light_mode) +{ + unsigned int port, lid; + unsigned short cpld_addr; + u8 reg, value; + sscanf(cdev->name, "accton_as7712_32x_led::port%u_led%u", &port, &lid); + + if (port > 32 || lid > 4) { + dev_dbg(&ledctl->pdev->dev, "Port(%u), Led_id(%u) not match\n", port, lid); + return; + } + + cpld_addr = (port < 16) ? 0x64 : 0x62; + reg = (0x50 + (port % 16) * 4 + lid); + value = port_led_mode_to_cpld_val(led_light_mode); + + if (value < 0) { + dev_dbg(&ledctl->pdev->dev, "Unknow port led mode(%d)\n", led_light_mode); + return; + } + + accton_as7712_32x_port_led_write_value(cpld_addr, reg, value); +} + +static enum led_brightness accton_as7712_32x_port_led_get(struct led_classdev *cdev) +{ + unsigned int port, lid; + unsigned short cpld_addr; + u8 reg, value; + sscanf(cdev->name, "accton_as7712_32x_led::port%u_led%u", &port, &lid); + + if (port > 32 || lid > 4) { + dev_dbg(&ledctl->pdev->dev, "Port(%u), Led_id(%u) not match\n", port, lid); + return -EINVAL; + } + + cpld_addr = (port < 16) ? 0x64 : 0x62; + reg = (0x50 + (port % 16) * 4 + lid); + value = accton_as7712_32x_port_led_read_value(cpld_addr, reg); + + if (value < 0) { + dev_dbg(&ledctl->pdev->dev, "Unable to read reg value from cpld(0x%x), reg(0x%x)\n", cpld_addr, reg); + return value; + } + + return cpld_val_to_port_led_mode(value); +} + +#define _PORT_LED_CLASSDEV(port, lid) \ + [LED_TYPE_PORT##port##_LED##lid] = { \ + .name = "accton_as7712_32x_led::port"#port"_led"#lid,\ + .default_trigger = "unused", \ + .brightness_set = accton_as7712_32x_port_led_set, \ + .brightness_get = accton_as7712_32x_port_led_get, \ + .max_brightness = LED_MODE_CYAN_BLINKING, \ + } + +#define PORT_LED_CLASSDEV(port) \ + _PORT_LED_CLASSDEV(port, 0),\ + _PORT_LED_CLASSDEV(port, 1),\ + _PORT_LED_CLASSDEV(port, 2),\ + _PORT_LED_CLASSDEV(port, 3) +#endif + +static struct led_classdev accton_as7712_32x_leds[] = { + [LED_TYPE_DIAG] = { + .name = "accton_as7712_32x_led::diag", + .default_trigger = "unused", + .brightness_set = accton_as7712_32x_led_diag_set, + .brightness_get = accton_as7712_32x_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_RED, + }, + [LED_TYPE_LOC] = { + .name = "accton_as7712_32x_led::loc", + .default_trigger = "unused", + .brightness_set = accton_as7712_32x_led_loc_set, + .brightness_get = accton_as7712_32x_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_BLUE, + }, + [LED_TYPE_FAN] = { + .name = "accton_as7712_32x_led::fan", + .default_trigger = "unused", + .brightness_set = accton_as7712_32x_led_auto_set, + .brightness_get = accton_as7712_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU1] = { + .name = "accton_as7712_32x_led::psu1", + .default_trigger = "unused", + .brightness_set = accton_as7712_32x_led_auto_set, + .brightness_get = accton_as7712_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "accton_as7712_32x_led::psu2", + .default_trigger = "unused", + .brightness_set = accton_as7712_32x_led_auto_set, + .brightness_get = accton_as7712_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +#if (ENABLE_PORT_LED == 1) + PORT_LED_CLASSDEV(0), + PORT_LED_CLASSDEV(1), + PORT_LED_CLASSDEV(2), + PORT_LED_CLASSDEV(3), + PORT_LED_CLASSDEV(4), + PORT_LED_CLASSDEV(5), + PORT_LED_CLASSDEV(6), + PORT_LED_CLASSDEV(7), + PORT_LED_CLASSDEV(8), + PORT_LED_CLASSDEV(9), + PORT_LED_CLASSDEV(10), + PORT_LED_CLASSDEV(11), + PORT_LED_CLASSDEV(12), + PORT_LED_CLASSDEV(13), + PORT_LED_CLASSDEV(14), + PORT_LED_CLASSDEV(15), + PORT_LED_CLASSDEV(16), + PORT_LED_CLASSDEV(17), + PORT_LED_CLASSDEV(18), + PORT_LED_CLASSDEV(19), + PORT_LED_CLASSDEV(20), + PORT_LED_CLASSDEV(21), + PORT_LED_CLASSDEV(22), + PORT_LED_CLASSDEV(23), + PORT_LED_CLASSDEV(24), + PORT_LED_CLASSDEV(25), + PORT_LED_CLASSDEV(26), + PORT_LED_CLASSDEV(27), + PORT_LED_CLASSDEV(28), + PORT_LED_CLASSDEV(29), + PORT_LED_CLASSDEV(30), + PORT_LED_CLASSDEV(31), +#endif +}; + +static int accton_as7712_32x_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { + led_classdev_suspend(&accton_as7712_32x_leds[i]); + } + + return 0; +} + +static int accton_as7712_32x_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { + led_classdev_resume(&accton_as7712_32x_leds[i]); + } + + return 0; +} + +static int accton_as7712_32x_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { + ret = led_classdev_register(&pdev->dev, &accton_as7712_32x_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(accton_as7712_32x_leds)){ + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&accton_as7712_32x_leds[i]); + } + } + + return ret; +} + +static int accton_as7712_32x_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(accton_as7712_32x_leds); i++) { + led_classdev_unregister(&accton_as7712_32x_leds[i]); + } + + return 0; +} + +static struct platform_driver accton_as7712_32x_led_driver = { + .probe = accton_as7712_32x_led_probe, + .remove = accton_as7712_32x_led_remove, + .suspend = accton_as7712_32x_led_suspend, + .resume = accton_as7712_32x_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as7712_32x_led_init(void) +{ + int ret; + + ret = platform_driver_register(&accton_as7712_32x_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct accton_as7712_32x_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as7712_32x_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&accton_as7712_32x_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as7712_32x_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&accton_as7712_32x_led_driver); + kfree(ledctl); +} + +module_init(accton_as7712_32x_led_init); +module_exit(accton_as7712_32x_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as7712_32x_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/pmbus.h b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/pmbus.h new file mode 120000 index 000000000000..b0e1a57107fd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/pmbus.h @@ -0,0 +1 @@ +../../common/modules/pmbus.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c new file mode 120000 index 000000000000..f4d67640ccc3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/ym2651y.c @@ -0,0 +1 @@ +../../common/modules/ym2651y.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-platform-init.service new file mode 100755 index 000000000000..d5d25b6cde04 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Accton AS7712-32X Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/accton_as7712_util.py install +ExecStop=/usr/local/bin/accton_as7712_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/setup.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/setup.py new file mode 100755 index 000000000000..09c763c84f01 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='as7712_32x', + version='1.0', + description='Module to initialize Accton AS7712-32X platforms', + + packages=['as7712_32x'], + package_dir={'as7712_32x': 'as7712-32x/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/README b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/README new file mode 100755 index 000000000000..0b9fc1633999 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/README @@ -0,0 +1,60 @@ +Copyright (C) 2016 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +To initialize the system, run "accton_as7712_util.py install". +To clean up the drivers & devices, run "accton_as7712_util.py clean". +To dump information of sensors, run "accton_as7712_util.py show". +To dump SFP EEPROM, run "accton_as7712_util.py sff". +To set fan speed, run "accton_as7712_util.py set fan". +To enable/disable SFP emission, run "accton_as7712_util.py set sfp". +To set system LEDs' color, run "accton_as7712_util.py set led" +For more information, run "accton_as7712_util.py --help". + +==================================================================== +Besides applying accton_as7712_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +LED controls can be found under /sys/class/leds. The sysfs interface +color mappings are as follows: +Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + +There are 5 system LEDs, loc, diag, fan, ps1, and ps2. +They are lit automatically by CPLD, but the loc and diag. +The loc led has only 1 color, blue. +The diag one has 3 colors: red, amber, and green. + +Fan controls can be found in /sys/bus/i2c/devices/2-0066. +There are 12 fans inside 6 fan modules. +All fans share 1 duty setting, ranged from 0~100. + +Three temperature sensors are controlled by the lm75 kernel modules. +They should already be visible under /sys/bus/i2c/drivers/lm75/. + +Two power supplies are controlled by the CPLD. +Here provide their status under +/sys/bus/i2c/devices/10-0050 and /sys/bus/i2c/devices/11-0053. + +There are 32 QSFP+ modules are equipped. +Apply "accton_as7712_util.py show" to get their status. +Apply "accton_as7712_util.py set sfp" to turn on/off light transmission. +Apply "accton_as7712_util.py sff" to dump EEPROM information. +Before operating on that QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py new file mode 100755 index 000000000000..c8b755b85b69 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py @@ -0,0 +1,569 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'as7712_32x' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan':6,'thermal':4, 'psu':2, 'sfp':32} +FORCE = 0 +#logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +#logging.basicConfig(level=logging.INFO) + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + +kos = [ +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x force_deselect_on_exit=1', +'modprobe accton_i2c_cpld' , +'modprobe ym2651y' , +'modprobe accton_as7712_32x_fan' , +'modprobe optoe' , +'modprobe leds-accton_as7712_32x' , +'modprobe accton_as7712_32x_psu' ] + +def driver_install(): + global FORCE + status, output = log_os_system("depmod", 1) + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +led_prefix ='/sys/class/leds/accton_'+PROJECT_NAME+'_led::' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2']} +hwmon_nodes = {'led': ['brightness'] } +hwmon_prefix ={'led': led_prefix} + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'fan': ['2-0066'] , + 'thermal': ['3-0048','3-0049', '3-004a', '3-004b'] , + 'psu': ['10-0050','11-0053'], + 'sfp': ['-0050']} +i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'] , + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['module_present', 'sfp_tx_disable_all']} + +sfp_map = [22,23,24,25,27,26,29,28, + 18,19,20,21,30,31,32,33, + 34,35,36,37,46,47,48,49, + 38,39,40,41,42,43,44,45] +mknod =[ +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-1/new_device' , +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-1/new_device' , +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-1/new_device' , +'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', + +'echo as7712_32x_fan 0x66 > /sys/bus/i2c/devices/i2c-2/new_device ', +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-3/new_device', +'echo as7712_32x_psu1 0x53 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo ym2651 0x5b > /sys/bus/i2c/devices/i2c-11/new_device', +'echo as7712_32x_psu2 0x50 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo ym2651 0x58 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo cpld_as7712 0x60 > /sys/bus/i2c/devices/i2c-4/new_device', +'echo cpld_plain 0x62 > /sys/bus/i2c/devices/i2c-5/new_device', +'echo cpld_plain 0x64 > /sys/bus/i2c/devices/i2c-6/new_device'] + +mknod2 =[ +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-0/new_device' , +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-0/new_device' , +'echo pca9548 0X73 > /sys/bus/i2c/devices/i2c-0/new_device' , +'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-0/new_device', + +'echo as7712_32x_fan 0x66 > /sys/bus/i2c/devices/i2c-2/new_device ', +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-3/new_device', +'echo as7712_32x_psu1 0x53 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo ym2651 0x5b > /sys/bus/i2c/devices/i2c-11/new_device', +'echo as7712_32x_psu2 0x50 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo ym2651 0x58 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo cpld_as7712 0x60 > /sys/bus/i2c/devices/i2c-4/new_device', +'echo cpld_plain 0x62 > /sys/bus/i2c/devices/i2c-5/new_device', +'echo cpld_plain 0x64 > /sys/bus/i2c/devices/i2c-6/new_device'] + + +def i2c_order_check(): + # i2c bus 0 and 1 might be installed in different order. + # Here check if 0x76 is exist @ i2c-0 + tmp = "echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-0/new_device" + status, output = log_os_system(tmp, 0) + if not device_exist(): + order = 1 + else: + order = 0 + tmp = "echo 0x76 > /sys/bus/i2c/devices/i2c-0/delete_device" + status, output = log_os_system(tmp, 0) + return order + +def device_install(): + global FORCE + + order = i2c_order_check() + + # if 0x76 is not exist @i2c-0, use reversed bus order + if order: + for i in range(0,len(mknod2)): + #for pca954x need times to built new i2c buses + if mknod2[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod2[i], 1) + if status: + print output + if FORCE == 0: + return status + else: + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + for i in range(0,len(sfp_map)): + status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/1-0076", 0) + if status==0: + I2C_ORDER=1 + else: + I2C_ORDER=0 + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + if I2C_ORDER==0: + nodelist = mknod + else: + nodelist = mknod2 + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'sfp_eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan'] ['fan1'][0] + node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0076", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/fanutil.py new file mode 100755 index 000000000000..9a69f6e1d537 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/fanutil.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# ------------------------------------------------------------------ + +try: + import time + import logging + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class FanUtil(object): + """Platform-specific FanUtil class""" + + FAN_NUM_ON_MAIN_BROAD = 6 + FAN_NUM_1_IDX = 1 + FAN_NUM_2_IDX = 2 + FAN_NUM_3_IDX = 3 + FAN_NUM_4_IDX = 4 + FAN_NUM_5_IDX = 5 + FAN_NUM_6_IDX = 6 + + FAN_NODE_NUM_OF_MAP = 2 + FAN_NODE_FAULT_IDX_OF_MAP = 1 + #FAN_NODE_SPEED_IDX_OF_MAP = 2 + FAN_NODE_DIR_IDX_OF_MAP = 2 + #FAN_NODE_DUTY_IDX_OF_MAP = 4 + #FANR_NODE_FAULT_IDX_OF_MAP = 5 + + #BASE_VAL_PATH = '/sys/devices/platform/as5712_54x_fan/{0}' + BASE_VAL_PATH = '/sys/bus/i2c/devices/9-0066/{0}' + FAN_DUTY_PATH = '/sys/bus/i2c/devices/9-0066/fan_duty_cycle_percentage' + + #logfile = '' + #loglevel = logging.INFO + + """ Dictionary where + key1 = fan id index (integer) starting from 1 + key2 = fan node index (interger) starting from 1 + value = path to fan device file (string) """ + _fan_to_device_path_mapping = {} + +#fan1_direction +#fan1_fault +#fan1_present + + #(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage', + _fan_to_device_node_mapping = { + (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault', + (FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction', + + (FAN_NUM_2_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan2_fault', + (FAN_NUM_2_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan2_direction', + + (FAN_NUM_3_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan3_fault', + (FAN_NUM_3_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan3_direction', + + (FAN_NUM_4_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan4_fault', + (FAN_NUM_4_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan4_direction', + + (FAN_NUM_5_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan5_fault', + (FAN_NUM_5_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan5_direction', + + (FAN_NUM_6_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan6_fault', + (FAN_NUM_6_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan6_direction', + } + + def _get_fan_to_device_node(self, fan_num, node_num): + return self._fan_to_device_node_mapping[(fan_num, node_num)] + + def _get_fan_node_val(self, fan_num, node_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + + try: + val_file = open(device_path, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + def _set_fan_node_val(self, fan_num, node_num, val): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + content = str(val) + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'w') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + val_file.write(content) + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return True + + def __init__(self): + fan_path = self.BASE_VAL_PATH + + for fan_num in range(self.FAN_NUM_1_IDX, self.FAN_NUM_ON_MAIN_BROAD+1): + for node_num in range(self.FAN_NODE_FAULT_IDX_OF_MAP, self.FAN_NODE_NUM_OF_MAP+1): + self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path.format( + self._fan_to_device_node_mapping[(fan_num, node_num)]) + + def get_num_fans(self): + return self.FAN_NUM_ON_MAIN_BROAD + + def get_idx_fan_start(self): + return self.FAN_NUM_1_IDX + + def get_num_nodes(self): + return self.FAN_NODE_NUM_OF_MAP + + def get_idx_node_start(self): + return self.FAN_NODE_FAULT_IDX_OF_MAP + + def get_size_node_map(self): + return len(self._fan_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._fan_to_device_path_mapping) + + def get_fan_to_device_path(self, fan_num, node_num): + return self._fan_to_device_path_mapping[(fan_num, node_num)] + + def get_fan_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP) + + #def get_fan_speed(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP) + + def get_fan_dir(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP) + + def get_fan_duty_cycle(self): + #duty_path = self.FAN_DUTY_PATH + try: + val_file = open(self.FAN_DUTY_PATH) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + return int(content) + #self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP) +#static u32 reg_val_to_duty_cycle(u8 reg_val) +#{ +# reg_val &= FAN_DUTY_CYCLE_REG_MASK; +# return ((u32)(reg_val+1) * 625 + 75)/ 100; +#} +# + def set_fan_duty_cycle(self, val): + + try: + fan_file = open(self.FAN_DUTY_PATH, 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + #val = ((val + 1 ) * 625 +75 ) / 100 + fan_file.write(str(val)) + fan_file.close() + return True + + #def get_fanr_fault(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP) + + def get_fanr_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP) + + def get_fan_status(self, fan_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num, %d', fan_num) + return None + + if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0: + logging.debug('GET. FAN fault. fan_num, %d', fan_num) + return False + + #if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0: + # logging.debug('GET. FANR fault. fan_num, %d', fan_num) + # return False + + return True + +#def main(): +# fan = FanUtil() +# +# print 'get_size_node_map : %d' % fan.get_size_node_map() +# print 'get_size_path_map : %d' % fan.get_size_path_map() +# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): +# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1): +# print fan.get_fan_to_device_path(x, y) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/thermalutil.py new file mode 100755 index 000000000000..50d8c85d94ca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/thermalutil.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018:Jostar modify for as7716_32x +# ------------------------------------------------------------------ + +try: + import time + import logging + import glob + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class ThermalUtil(object): + """Platform-specific ThermalUtil class""" + + THERMAL_NUM_ON_MAIN_BROAD = 3 + THERMAL_NUM_1_IDX = 1 # 1_ON_MAIN_BROAD + THERMAL_NUM_2_IDX = 2 # 2_ON_MAIN_BROAD + THERMAL_NUM_3_IDX = 3 # 3_ON_MAIN_BROAD + + BASE_VAL_PATH = '/sys/bus/i2c/devices/{0}-00{1}/hwmon/hwmon*/temp1_input' + + """ Dictionary where + key1 = thermal id index (integer) starting from 1 + value = path to fan device file (string) """ + _thermal_to_device_path_mapping = {} + + _thermal_to_device_node_mapping = { + THERMAL_NUM_1_IDX: ['10', '48'], + THERMAL_NUM_2_IDX: ['10', '49'], + THERMAL_NUM_3_IDX: ['10', '4a'], + } + + def __init__(self): + thermal_path = self.BASE_VAL_PATH + + for x in range(self.THERMAL_NUM_1_IDX, self.THERMAL_NUM_ON_MAIN_BROAD+1): + self._thermal_to_device_path_mapping[x] = thermal_path.format( + self._thermal_to_device_node_mapping[x][0], + self._thermal_to_device_node_mapping[x][1]) + + def _get_thermal_node_val(self, thermal_num): + if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. thermal_num, %d', thermal_num) + return None + + device_path = self.get_thermal_to_device_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + + def get_num_thermals(self): + return self.THERMAL_NUM_ON_MAIN_BROAD + + def get_idx_thermal_start(self): + return self.THERMAL_NUM_1_IDX + + def get_size_node_map(self): + return len(self._thermal_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._thermal_to_device_path_mapping) + + def get_thermal_to_device_path(self, thermal_num): + return self._thermal_to_device_path_mapping[thermal_num] + + def get_thermal_1_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + + def get_thermal_2_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) + def get_thermal_temp(self): + return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX)) + +#def main(): +# thermal = ThermalUtil() +# +# print 'get_size_node_map : %d' % thermal.get_size_node_map() +# print 'get_size_path_map : %d' % thermal.get_size_path_map() +# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): +# print thermal.get_thermal_to_device_path(x) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/Makefile new file mode 100755 index 000000000000..4c0942afb97e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/Makefile @@ -0,0 +1,21 @@ +ifneq ($(KERNELRELEASE),) +obj-m:= accton_as7716_32x_cpld1.o accton_as7716_32x_fan.o \ + accton_as7716_32x_leds.o accton_as7716_32x_psu.o cpr_4011_4mxx.o ym2651y.o \ + optoe.o accton_i2c_cpld.o + +else +ifeq (,$(KERNEL_SRC)) +#$(error KERNEL_SRC is not defined) +KVERSION := $(shell uname -r) +KERNEL_DIR = /usr/src/linux-headers-$(KVERSION)/ +KERNELDIR:=$(KERNEL_DIR) +#export KERNELDIR:=${PWD}/../../../../../src/sonic-linux-kernel/linux-3.16.43/ +else +KERNELDIR:=$(KERNEL_SRC) +endif +PWD:=$(shell pwd) +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + rm -rf *.o *.mod.o *.mod.o *.ko .*cmd .tmp_versions Module.markers Module.symvers modules.order +endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_cpld1.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_cpld1.c new file mode 100755 index 000000000000..cbab013f5860 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_cpld1.c @@ -0,0 +1,781 @@ +/* + * A hwmon driver for the as7716_32x_cpld + * + * Copyright (C) 2013 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +static int as7716_32x_cpld_read_internal(struct i2c_client *client, u8 reg); +static int as7716_32x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value); + +struct as7716_32x_cpld_data { + struct device *hwmon_dev; + struct mutex update_lock; +}; + +/* Addresses scanned for as7716_32x_cpld + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index + +enum as7716_32x_cpld_sysfs_attributes { + CPLD_VERSION, + ACCESS, + MODULE_PRESENT_ALL, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + TRANSCEIVER_RESET_ATTR_ID(1), + TRANSCEIVER_RESET_ATTR_ID(2), + TRANSCEIVER_RESET_ATTR_ID(3), + TRANSCEIVER_RESET_ATTR_ID(4), + TRANSCEIVER_RESET_ATTR_ID(5), + TRANSCEIVER_RESET_ATTR_ID(6), + TRANSCEIVER_RESET_ATTR_ID(7), + TRANSCEIVER_RESET_ATTR_ID(8), + TRANSCEIVER_RESET_ATTR_ID(9), + TRANSCEIVER_RESET_ATTR_ID(10), + TRANSCEIVER_RESET_ATTR_ID(11), + TRANSCEIVER_RESET_ATTR_ID(12), + TRANSCEIVER_RESET_ATTR_ID(13), + TRANSCEIVER_RESET_ATTR_ID(14), + TRANSCEIVER_RESET_ATTR_ID(15), + TRANSCEIVER_RESET_ATTR_ID(16), + TRANSCEIVER_RESET_ATTR_ID(17), + TRANSCEIVER_RESET_ATTR_ID(18), + TRANSCEIVER_RESET_ATTR_ID(19), + TRANSCEIVER_RESET_ATTR_ID(20), + TRANSCEIVER_RESET_ATTR_ID(21), + TRANSCEIVER_RESET_ATTR_ID(22), + TRANSCEIVER_RESET_ATTR_ID(23), + TRANSCEIVER_RESET_ATTR_ID(24), + TRANSCEIVER_RESET_ATTR_ID(25), + TRANSCEIVER_RESET_ATTR_ID(26), + TRANSCEIVER_RESET_ATTR_ID(27), + TRANSCEIVER_RESET_ATTR_ID(28), + TRANSCEIVER_RESET_ATTR_ID(29), + TRANSCEIVER_RESET_ATTR_ID(30), + TRANSCEIVER_RESET_ATTR_ID(31), + TRANSCEIVER_RESET_ATTR_ID(32), +}; + +/* sysfs attributes for hwmon + */ + +/* transceiver attributes */ +/*present*/ +#define DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_present, NULL, MODULE_PRESENT_##index) +#define DECLARE_TRANSCEIVER_ATTR(index) &sensor_dev_attr_module_present_##index.dev_attr.attr + +/*reset*/ +#define DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IWUSR | S_IRUGO, get_mode_reset, set_mode_reset, MODULE_RESET_##index) +#define DECLARE_TRANSCEIVER_RESET_ATTR(index) &sensor_dev_attr_module_reset_##index.dev_attr.attr + +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); +/* transceiver attributes */ +static SENSOR_DEVICE_ATTR(module_present_all, S_IRUGO, show_present_all, NULL, MODULE_PRESENT_ALL); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(32); + +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(1); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(2); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(3); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(4); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(5); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(6); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(7); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(8); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(9); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(10); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(11); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(12); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(13); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(14); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(15); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(16); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(17); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(18); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(19); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(20); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(21); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(22); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(23); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(24); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(25); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(26); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(27); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(28); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(29); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(30); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(31); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(32); + + +static struct attribute *as7716_32x_cpld_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + DECLARE_TRANSCEIVER_ATTR(1), + DECLARE_TRANSCEIVER_ATTR(2), + DECLARE_TRANSCEIVER_ATTR(3), + DECLARE_TRANSCEIVER_ATTR(4), + DECLARE_TRANSCEIVER_ATTR(5), + DECLARE_TRANSCEIVER_ATTR(6), + DECLARE_TRANSCEIVER_ATTR(7), + DECLARE_TRANSCEIVER_ATTR(8), + DECLARE_TRANSCEIVER_ATTR(9), + DECLARE_TRANSCEIVER_ATTR(10), + DECLARE_TRANSCEIVER_ATTR(11), + DECLARE_TRANSCEIVER_ATTR(12), + DECLARE_TRANSCEIVER_ATTR(13), + DECLARE_TRANSCEIVER_ATTR(14), + DECLARE_TRANSCEIVER_ATTR(15), + DECLARE_TRANSCEIVER_ATTR(16), + DECLARE_TRANSCEIVER_ATTR(17), + DECLARE_TRANSCEIVER_ATTR(18), + DECLARE_TRANSCEIVER_ATTR(19), + DECLARE_TRANSCEIVER_ATTR(20), + DECLARE_TRANSCEIVER_ATTR(21), + DECLARE_TRANSCEIVER_ATTR(22), + DECLARE_TRANSCEIVER_ATTR(23), + DECLARE_TRANSCEIVER_ATTR(24), + DECLARE_TRANSCEIVER_ATTR(25), + DECLARE_TRANSCEIVER_ATTR(26), + DECLARE_TRANSCEIVER_ATTR(27), + DECLARE_TRANSCEIVER_ATTR(28), + DECLARE_TRANSCEIVER_ATTR(29), + DECLARE_TRANSCEIVER_ATTR(30), + DECLARE_TRANSCEIVER_ATTR(31), + DECLARE_TRANSCEIVER_ATTR(32), + DECLARE_TRANSCEIVER_RESET_ATTR(1), + DECLARE_TRANSCEIVER_RESET_ATTR(2), + DECLARE_TRANSCEIVER_RESET_ATTR(3), + DECLARE_TRANSCEIVER_RESET_ATTR(4), + DECLARE_TRANSCEIVER_RESET_ATTR(5), + DECLARE_TRANSCEIVER_RESET_ATTR(6), + DECLARE_TRANSCEIVER_RESET_ATTR(7), + DECLARE_TRANSCEIVER_RESET_ATTR(8), + DECLARE_TRANSCEIVER_RESET_ATTR(9), + DECLARE_TRANSCEIVER_RESET_ATTR(10), + DECLARE_TRANSCEIVER_RESET_ATTR(11), + DECLARE_TRANSCEIVER_RESET_ATTR(12), + DECLARE_TRANSCEIVER_RESET_ATTR(13), + DECLARE_TRANSCEIVER_RESET_ATTR(14), + DECLARE_TRANSCEIVER_RESET_ATTR(15), + DECLARE_TRANSCEIVER_RESET_ATTR(16), + DECLARE_TRANSCEIVER_RESET_ATTR(17), + DECLARE_TRANSCEIVER_RESET_ATTR(18), + DECLARE_TRANSCEIVER_RESET_ATTR(19), + DECLARE_TRANSCEIVER_RESET_ATTR(20), + DECLARE_TRANSCEIVER_RESET_ATTR(21), + DECLARE_TRANSCEIVER_RESET_ATTR(22), + DECLARE_TRANSCEIVER_RESET_ATTR(23), + DECLARE_TRANSCEIVER_RESET_ATTR(24), + DECLARE_TRANSCEIVER_RESET_ATTR(25), + DECLARE_TRANSCEIVER_RESET_ATTR(26), + DECLARE_TRANSCEIVER_RESET_ATTR(27), + DECLARE_TRANSCEIVER_RESET_ATTR(28), + DECLARE_TRANSCEIVER_RESET_ATTR(29), + DECLARE_TRANSCEIVER_RESET_ATTR(30), + DECLARE_TRANSCEIVER_RESET_ATTR(31), + DECLARE_TRANSCEIVER_RESET_ATTR(32), + NULL +}; + +static const struct attribute_group as7716_32x_cpld_group = { + .attrs = as7716_32x_cpld_attributes, +}; + +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i, status; + u8 values[4] = {0}; + u8 regs[] = {0x30, 0x31, 0x32, 0x33}; + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = as7716_32x_cpld_read_internal(client, regs[i]); + + if (status < 0) { + goto exit; + } + + values[i] = ~(u8)status; + } + + mutex_unlock(&data->update_lock); + + /* Return values 1 -> 32 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3]); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0; + + switch (attr->index) { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + reg = 0x30; + mask = 0x1 << (attr->index - MODULE_PRESENT_1); + break; + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + reg = 0x31; + mask = 0x1 << (attr->index - MODULE_PRESENT_9); + break; + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + reg = 0x32; + mask = 0x1 << (attr->index - MODULE_PRESENT_17); + break; + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + reg = 0x33; + mask = 0x1 << (attr->index - MODULE_PRESENT_25); + break; + default: + return 0; + } + + + mutex_lock(&data->update_lock); + status = as7716_32x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", !(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 reg = 0, mask = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + + switch (attr->index) { + case CPLD_VERSION: + reg = 0x1; + mask = 0xFF; + break; + default: + break; + } + + mutex_lock(&data->update_lock); + status = as7716_32x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%d\n", (status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_cpld_data *data = i2c_get_clientdata(client); + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = as7716_32x_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static int as7716_32x_cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static int as7716_32x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static void as7716_32x_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void as7716_32x_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int as7716_32x_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct as7716_32x_cpld_data *data = NULL; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7716_32x_cpld_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32x_cpld_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + as7716_32x_cpld_add_client(client); + + dev_info(&client->dev, "%s: cpld '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32x_cpld_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32x_cpld_remove(struct i2c_client *client) +{ + struct as7716_32x_cpld_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32x_cpld_group); + kfree(data); + as7716_32x_cpld_remove_client(client); + + return 0; +} + +int as7716_32x_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as7716_32x_cpld_read); + +int as7716_32x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as7716_32x_cpld_write); + +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0; + + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = 0x04; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = 0x05; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = 0x06; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = 0x07; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + + + mutex_lock(&data->update_lock); + status = as7716_32x_cpld_read_internal(client, reg); + + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\r\n", !(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_cpld_data *data = i2c_get_clientdata(client); + long reset; + int status=0, val, error; + u8 reg = 0, mask = 0; + + + error = kstrtol(buf, 10, &reset); + if (error) { + return error; + } + + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = 0x04; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = 0x05; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = 0x06; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = 0x07; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + mutex_lock(&data->update_lock); + + status = as7716_32x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update lp_mode status */ + if (reset) + { + val = status&(~mask); + } + else + { + val =status | (mask); + } + + status = as7716_32x_cpld_write_internal(client, reg, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + + + +static const struct i2c_device_id as7716_32x_cpld_id[] = { + { "as7716_32x_cpld1", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32x_cpld_id); + +static struct i2c_driver as7716_32x_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7716_32x_cpld1", + }, + .probe = as7716_32x_cpld_probe, + .remove = as7716_32x_cpld_remove, + .id_table = as7716_32x_cpld_id, + .address_list = normal_i2c, +}; + +static int __init as7716_32x_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as7716_32x_cpld_driver); +} + +static void __exit as7716_32x_cpld_exit(void) +{ + i2c_del_driver(&as7716_32x_cpld_driver); +} + +module_init(as7716_32x_cpld_init); +module_exit(as7716_32x_cpld_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7716_32x_cpld driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_fan.c new file mode 100755 index 000000000000..83b7bceeb99e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_fan.c @@ -0,0 +1,794 @@ +/* + * A hwmon driver for the Accton as7716 32x fan + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as7716_32x_fan" + +#define NUM_THERMAL_SENSORS (3) /* Get sum of this number of sensors.*/ +#define THERMAL_SENSORS_DRIVER "lm75" + +#define IN +#define OUT + +static struct as7716_32x_fan_data *as7716_32x_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); +extern int as7716_32x_cpld_read(unsigned short cpld_addr, u8 reg); +extern int as7716_32x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x0F, /* fan 1-6 present status */ + 0x10, /* fan 1-6 direction(0:B2F 1:F2B) */ + 0x11, /* fan PWM(for all fan) */ + 0x12, /* front fan 1 speed(rpm) */ + 0x13, /* front fan 2 speed(rpm) */ + 0x14, /* front fan 3 speed(rpm) */ + 0x15, /* front fan 4 speed(rpm) */ + 0x16, /* front fan 5 speed(rpm) */ + 0x17, /* front fan 6 speed(rpm) */ + 0x22, /* rear fan 1 speed(rpm) */ + 0x23, /* rear fan 2 speed(rpm) */ + 0x24, /* rear fan 3 speed(rpm) */ + 0x25, /* rear fan 4 speed(rpm) */ + 0x26, /* rear fan 5 speed(rpm) */ + 0x27, /* rear fan 6 speed(rpm) */ +}; + +/* Each client has this additional data */ +struct as7716_32x_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ + u8 enable; + int system_temp; /*In unit of mini-Celsius*/ + int sensors_found; +}; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID, + FAN6_ID +}; + +enum sysfs_fan_attributes { + FAN_PRESENT_REG, + FAN_DIRECTION_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN6_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN6_REAR_SPEED_RPM, + FAN1_DIRECTION, + FAN2_DIRECTION, + FAN3_DIRECTION, + FAN4_DIRECTION, + FAN5_DIRECTION, + FAN6_DIRECTION, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN6_PRESENT, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, + FAN6_FAULT +}; + +/* Define attributes + */ +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT);\ + static SENSOR_DEVICE_ATTR(fan##index2##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index, index2) &sensor_dev_attr_fan##index##_fault.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_fault.dev_attr.attr + +#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO, fan_show_value, NULL, FAN##index##_DIRECTION) +#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index##_enable, S_IWUSR | S_IRUGO, get_enable, set_enable, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan_duty_cycle_percentage.dev_attr.attr, \ + &sensor_dev_attr_pwm##index.dev_attr.attr, \ + &sensor_dev_attr_pwm##index##_enable.dev_attr.attr + +#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ + static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr + + +#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) +#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index2##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index, index2) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_input.dev_attr.attr + +/* 6 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(6,16); +/* 6 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(6,16); +/* 6 fan present attributes in this platform */ +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(5); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(6); + +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(1); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(2); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(3); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(4); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); + +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); +/* System temperature for fancontrol */ +DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); + +static struct attribute *as7716_32x_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_FAULT_ATTR(1,11), + DECLARE_FAN_FAULT_ATTR(2,12), + DECLARE_FAN_FAULT_ATTR(3,13), + DECLARE_FAN_FAULT_ATTR(4,14), + DECLARE_FAN_FAULT_ATTR(5,15), + DECLARE_FAN_FAULT_ATTR(6,16), + DECLARE_FAN_SPEED_RPM_ATTR(1,11), + DECLARE_FAN_SPEED_RPM_ATTR(2,12), + DECLARE_FAN_SPEED_RPM_ATTR(3,13), + DECLARE_FAN_SPEED_RPM_ATTR(4,14), + DECLARE_FAN_SPEED_RPM_ATTR(5,15), + DECLARE_FAN_SPEED_RPM_ATTR(6,16), + DECLARE_FAN_PRESENT_ATTR(1), + DECLARE_FAN_PRESENT_ATTR(2), + DECLARE_FAN_PRESENT_ATTR(3), + DECLARE_FAN_PRESENT_ATTR(4), + DECLARE_FAN_PRESENT_ATTR(5), + DECLARE_FAN_PRESENT_ATTR(6), + DECLARE_FAN_DIRECTION_ATTR(1), + DECLARE_FAN_DIRECTION_ATTR(2), + DECLARE_FAN_DIRECTION_ATTR(3), + DECLARE_FAN_DIRECTION_ATTR(4), + DECLARE_FAN_DIRECTION_ATTR(5), + DECLARE_FAN_DIRECTION_ATTR(6), + DECLARE_FAN_DUTY_CYCLE_ATTR(1), + DECLARE_FAN_SYSTEM_TEMP_ATTR(), + NULL +}; + +#define FAN_DUTY_CYCLE_REG_MASK 0xF +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100 + +static int as7716_32x_fan_read_value(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int as7716_32x_fan_write_value(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + reg_val &= FAN_DUTY_CYCLE_REG_MASK; + return ((u32)(reg_val+1) * 625 + 75)/ 100; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + return ((u32)duty_cycle * 100 / 625) - 1; +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_direction(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 1 : 0; +} +static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 0 : 1; +} + +static u8 is_fan_fault(struct as7716_32x_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = FAN1_FRONT_SPEED_RPM + id; + int rear_fan_index = FAN1_REAR_SPEED_RPM + id; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + ret = 0; + } + + return ret; +} + +static ssize_t set_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct as7716_32x_fan_data *data = as7716_32x_fan_update_device(dev); + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 1) + return -EINVAL; + + data->enable = value; + if (value == 0) + { + return set_duty_cycle(dev, da, buf, FAN_MAX_DUTY_CYCLE); + } + return count; +} + + +static ssize_t get_enable(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7716_32x_fan_data *data = as7716_32x_fan_update_device(dev); + + return sprintf(buf, "%u\n", data->enable); +} +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > FAN_MAX_DUTY_CYCLE) + return -EINVAL; + + as7716_32x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ + as7716_32x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + return count; +} + +/* Due to this struct is declared at lm75.c, it cannot be include + * under Sonic environment. I duplicate it from lm75.c. + */ +struct lm75_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct thermal_zone_device *tz; + struct mutex update_lock; + u8 orig_conf; + u8 resolution; /* In bits, between 9 and 12 */ + u8 resolution_limits; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + unsigned long sample_time; /* In jiffies */ + s16 temp[3]; /* Register values, + 0 = input + 1 = max + 2 = hyst */ +}; + +/*Copied from lm75.c*/ +static inline long lm75_reg_to_mc(s16 temp, u8 resolution) +{ + return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); +} + +/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ +static struct device * get_hwmon_dev( + struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if(data) + { + if( data->valid == 1 && data->hwmon_dev) + { + return data->hwmon_dev; + } + + } + return NULL; +} + +/* To find hwmon index by opening hwmon under that i2c address. + */ +static int find_hwmon_index_by_FileOpen( + int bus_nr, + unsigned short addr, + OUT int *index) +{ +#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ + struct file *sfd; + char client_name[96]; + int i=0; + + do { + snprintf(client_name, sizeof(client_name), + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + + sfd = filp_open(client_name, O_RDONLY, 0); + i++; + } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); + + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); + return -ENOENT; + } + filp_close(sfd, 0); + *index = i - 1; + return 0; + +#undef MAX_HWMON_DEVICE +} + +static int get_temp_file_path( + int bus_nr, unsigned short addr, + struct device *hwmon_dev + ,char *path, int max_len) +{ + + if(hwmon_dev && strlen(dev_name(hwmon_dev))) + { + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", + bus_nr, addr, dev_name(hwmon_dev)); + } + else + { + int i=0; + if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) + { + return -EIO; + } + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + } + return 0; +} + +/*File read the dev file at user space.*/ +static int read_devfile_temp1_input( + struct device *dev, + int bus_nr, + unsigned short addr, + struct device *hwmon_dev, + int *miniCelsius) +{ + struct file *sfd; + char buffer[96]; + char devfile[96]; + int rc, status; + int rdlen, value; + mm_segment_t old_fs; + + rc = 0; + get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); + sfd = filp_open(devfile, O_RDONLY, 0); + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); + return -ENOENT; + } + dev_dbg(dev, "Found device:%s\n",devfile); + + if(!(sfd->f_op) || !(sfd->f_op->read) ) { + pr_err("file %s cann't readable ?\n",devfile); + return -ENOENT; + } + + old_fs = get_fs(); + set_fs(KERNEL_DS); + rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); + if (rdlen == 0) { + pr_err( "File(%s) empty!\n", devfile); + rc = -EIO; + goto exit; + } + status = sscanf(buffer, "%d", &value); + if (status != 1) { + rc = -EIO; + goto exit; + } + *miniCelsius = value; + dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); + +exit: + set_fs(old_fs); + filp_close(sfd, 0); + return rc; +} + +static u8 is_lm75_data_due(struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if (time_after(jiffies, data->last_updated + data->sample_time)) + { + return 1; + } + return 0; +} +static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); + + return 0; +} + +static int _find_lm75_device(struct device *dev, void *data) +{ + struct device_driver *driver; + struct as7716_32x_fan_data *prv = data; + char *driver_name = THERMAL_SENSORS_DRIVER; + + driver = dev->driver; + if (driver && driver->name && + strcmp(driver->name, driver_name) == 0) + { + struct i2c_client *client; + client = to_i2c_client(dev); + if (client) + { + /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ + struct i2c_adapter *adap = client->adapter; + int miniCelsius = 0; + + + if (!adap) { + return -ENXIO; + } + + /* If the data is not updated, read them from devfile + to drive them updateing data from chip.*/ + if (is_lm75_data_due(client)) + { + struct device *hwmon_dev; + + hwmon_dev = get_hwmon_dev(client); + if(0 == read_devfile_temp1_input(dev, adap->nr, + client->addr, hwmon_dev, &miniCelsius)) + { + prv->system_temp += miniCelsius; + prv->sensors_found++; + } + + } + else + { + get_lm75_temp(client, &miniCelsius); + prv->system_temp += miniCelsius; + prv->sensors_found++; + + } + } + } + return 0; +} + +/*Find all lm75 devices and return sum of temperatures.*/ +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + ssize_t ret = 0; + struct as7716_32x_fan_data *data = as7716_32x_fan_update_device(dev); + + data->system_temp=0; + data->sensors_found=0; + i2c_for_each_dev(data, _find_lm75_device); + if (NUM_THERMAL_SENSORS != data->sensors_found) + { + dev_dbg(dev,"only %d of %d temps are found\n", + data->sensors_found, NUM_THERMAL_SENSORS); + data->system_temp = 0; + } + ret = sprintf(buf, "%d\n",data->system_temp); + return ret; +} +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7716_32x_fan_data *data = as7716_32x_fan_update_device(dev); + ssize_t ret = 0; + + if (data->valid) { + switch (attr->index) { + case FAN_DUTY_CYCLE_PERCENTAGE: + { + u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + ret = sprintf(buf, "%d\n", + reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], + attr->index - FAN1_PRESENT)); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + case FAN6_DIRECTION: + ret = sprintf(buf, "%d\n", + reg_val_to_direction(data->reg_val[FAN_DIRECTION_REG], + attr->index - FAN1_DIRECTION)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group as7716_32x_fan_group = { + .attrs = as7716_32x_fan_attributes, +}; + +static struct as7716_32x_fan_data *as7716_32x_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_fan_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + dev_dbg(&client->dev, "Starting as7716_32x_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + int status = as7716_32x_fan_read_value(client, fan_reg[i]); + + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int as7716_32x_fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7716_32x_fan_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7716_32x_fan_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32x_fan_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: fan '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32x_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32x_fan_remove(struct i2c_client *client) +{ + struct as7716_32x_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32x_fan_group); + + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; + +static const struct i2c_device_id as7716_32x_fan_id[] = { + { "as7716_32x_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32x_fan_id); + +static struct i2c_driver as7716_32x_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = as7716_32x_fan_probe, + .remove = as7716_32x_fan_remove, + .id_table = as7716_32x_fan_id, + .address_list = normal_i2c, +}; + +static int __init as7716_32x_fan_init(void) +{ + return i2c_add_driver(&as7716_32x_fan_driver); +} + +static void __exit as7716_32x_fan_exit(void) +{ + i2c_del_driver(&as7716_32x_fan_driver); +} + +module_init(as7716_32x_fan_init); +module_exit(as7716_32x_fan_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7716_32x_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_leds.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_leds.c new file mode 100755 index 000000000000..da3d9442035f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_leds.c @@ -0,0 +1,442 @@ +/* + * A LED driver for the as7716_32x_led + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern int as7716_32x_cpld_read (unsigned short cpld_addr, u8 reg); +extern int as7716_32x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "as7716_32x_led" + +struct as7716_32x_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[1]; /* only 1 register*/ +}; + +static struct as7716_32x_led_data *ledctl = NULL; + +/* LED related data + */ + +#define LED_CNTRLER_I2C_ADDRESS (0x60) + +#define LED_TYPE_DIAG_REG_MASK (0x3) +#define LED_MODE_DIAG_GREEN_VALUE (0x02) +#define LED_MODE_DIAG_RED_VALUE (0x01) +#define LED_MODE_DIAG_AMBER_VALUE (0x00) /*It's yellow actually. Green+Red=Yellow*/ +#define LED_MODE_DIAG_OFF_VALUE (0x03) + + +#define LED_TYPE_LOC_REG_MASK (0x80) +#define LED_MODE_LOC_ON_VALUE (0) +#define LED_MODE_LOC_OFF_VALUE (0x80) + +enum led_type { + LED_TYPE_DIAG, + LED_TYPE_LOC, + LED_TYPE_FAN, + LED_TYPE_PSU1, + LED_TYPE_PSU2 +}; + +struct led_reg { + u32 types; + u8 reg_addr; +}; + +static const struct led_reg led_reg_map[] = { + {(1<update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting as7716_32x_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = as7716_32x_led_read_value(led_reg_map[i].reg_addr); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg_map[i].reg_addr, status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void as7716_32x_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + enum led_type type) +{ + int reg_val; + u8 reg ; + mutex_lock(&ledctl->update_lock); + + if( !getLedReg(type, ®)) + { + dev_dbg(&ledctl->pdev->dev, "Not match item for %d.\n", type); + } + + reg_val = as7716_32x_led_read_value(reg); + + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + as7716_32x_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + + +static void as7716_32x_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7716_32x_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG); +} + +static enum led_brightness as7716_32x_led_diag_get(struct led_classdev *cdev) +{ + as7716_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void as7716_32x_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7716_32x_led_set(led_cdev, led_light_mode, LED_TYPE_LOC); +} + +static enum led_brightness as7716_32x_led_loc_get(struct led_classdev *cdev) +{ + as7716_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static void as7716_32x_led_auto_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ +} + +static enum led_brightness as7716_32x_led_auto_get(struct led_classdev *cdev) +{ + return LED_MODE_AUTO; +} + +static struct led_classdev as7716_32x_leds[] = { + [LED_TYPE_DIAG] = { + .name = "as7716_32x_led::diag", + .default_trigger = "unused", + .brightness_set = as7716_32x_led_diag_set, + .brightness_get = as7716_32x_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_RED, + }, + [LED_TYPE_LOC] = { + .name = "as7716_32x_led::loc", + .default_trigger = "unused", + .brightness_set = as7716_32x_led_loc_set, + .brightness_get = as7716_32x_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_BLUE, + }, + [LED_TYPE_FAN] = { + .name = "as7716_32x_led::fan", + .default_trigger = "unused", + .brightness_set = as7716_32x_led_auto_set, + .brightness_get = as7716_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU1] = { + .name = "as7716_32x_led::psu1", + .default_trigger = "unused", + .brightness_set = as7716_32x_led_auto_set, + .brightness_get = as7716_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "as7716_32x_led::psu2", + .default_trigger = "unused", + .brightness_set = as7716_32x_led_auto_set, + .brightness_get = as7716_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +}; + +static int as7716_32x_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(as7716_32x_leds); i++) { + led_classdev_suspend(&as7716_32x_leds[i]); + } + + return 0; +} + +static int as7716_32x_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(as7716_32x_leds); i++) { + led_classdev_resume(&as7716_32x_leds[i]); + } + + return 0; +} + +static int as7716_32x_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(as7716_32x_leds); i++) { + ret = led_classdev_register(&pdev->dev, &as7716_32x_leds[i]); + + if (ret < 0) + { + break; + } + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(as7716_32x_leds)){ + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&as7716_32x_leds[i]); + } + } + + return 0; +} + +static int as7716_32x_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(as7716_32x_leds); i++) { + led_classdev_unregister(&as7716_32x_leds[i]); + } + + return 0; +} + +static struct platform_driver as7716_32x_led_driver = { + .probe = as7716_32x_led_probe, + .remove = as7716_32x_led_remove, + .suspend = as7716_32x_led_suspend, + .resume = as7716_32x_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init as7716_32x_led_init(void) +{ + int ret; + + + ret = platform_driver_register(&as7716_32x_led_driver); + if (ret < 0) { + + goto exit; + } + + ledctl = kzalloc(sizeof(struct as7716_32x_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&as7716_32x_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&as7716_32x_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return 0; +} + +static void __exit as7716_32x_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&as7716_32x_led_driver); + kfree(ledctl); +} + +module_init(as7716_32x_led_init); +module_exit(as7716_32x_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7716_32x_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c new file mode 100755 index 000000000000..78a58b820b2a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c @@ -0,0 +1,381 @@ +/* + * An hwmon driver for accton as7716_32x Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_MODEL_NAME 16 + +#define DC12V_FAN_DIR_OFFSET 0x34 +#define DC12V_FAN_DIR_LEN 3 + +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); +static int as7716_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as7716_32x_cpld_read (unsigned short cpld_addr, u8 reg); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7716_32x_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[MAX_MODEL_NAME+1]; /* Model name, read from eeprom */ + char fan_dir[DC12V_FAN_DIR_LEN+1]; /* DC12V fan direction */ +}; + +static struct as7716_32x_psu_data *as7716_32x_psu_update_device(struct device *dev); + +enum as7716_32x_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD, + PSU_FAN_DIR /* For DC12V only */ +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_string, NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_string, NULL, PSU_FAN_DIR); + +static struct attribute *as7716_32x_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, + NULL +}; + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7716_32x_psu_data *data = as7716_32x_psu_update_device(dev); + u8 status = 0; + + if (!data->valid) { + return -EIO; + } + + if (attr->index == PSU_PRESENT) { + status = !(data->status >> (1-data->index) & 0x1); + } + else { /* PSU_POWER_GOOD */ + status = (data->status >> (3-data->index) & 0x1); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_string(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7716_32x_psu_data *data = as7716_32x_psu_update_device(dev); + char *ptr = NULL; + + if (!data->valid) { + return -EIO; + } + + if (attr->index == PSU_MODEL_NAME) { + ptr = data->model_name; + } + else { /* PSU_FAN_DIR */ + ptr = data->fan_dir; + } + + return sprintf(buf, "%s\n", ptr); +} + +static const struct attribute_group as7716_32x_psu_group = { + .attrs = as7716_32x_psu_attributes, +}; + +static int as7716_32x_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7716_32x_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7716_32x_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32x_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32x_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32x_psu_remove(struct i2c_client *client) +{ + struct as7716_32x_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32x_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as7716_32x_psu1, + as7716_32x_psu2 +}; + +static const struct i2c_device_id as7716_32x_psu_id[] = { + { "as7716_32x_psu1", as7716_32x_psu1 }, + { "as7716_32x_psu2", as7716_32x_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32x_psu_id); + +static struct i2c_driver as7716_32x_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7716_32x_psu", + }, + .probe = as7716_32x_psu_probe, + .remove = as7716_32x_psu_remove, + .id_table = as7716_32x_psu_id, + .address_list = normal_i2c, +}; + +static int as7716_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +enum psu_type { + PSU_TYPE_AC_110V, + PSU_TYPE_DC_48V, + PSU_TYPE_DC_12V +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + char* model_name; +}; + +struct model_name_info models[] = { +{PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, +{PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, +{PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, +}; + +static int as7716_32x_psu_model_name_get(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_psu_data *data = i2c_get_clientdata(client); + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->model_name, 0, sizeof(data->model_name)); + + status = as7716_32x_psu_read_block(client, models[i].offset, + data->model_name, models[i].length); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data->model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, models[i].length) == 0) { + return 0; + } + else { + data->model_name[0] = '\0'; + } + } + + return -ENODATA; +} + +static struct as7716_32x_psu_data *as7716_32x_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; + int power_good = 0; + + data->valid = 0; + dev_dbg(&client->dev, "Starting as7716_32x update\n"); + + /* Read psu status */ + status = as7716_32x_cpld_read(0x60, 0x2); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + goto exit; + } + else { + data->status = status; + } + + /* Read model name */ + memset(data->model_name, 0, sizeof(data->model_name)); + memset(data->fan_dir, 0, sizeof(data->fan_dir)); + power_good = (data->status >> (3-data->index) & 0x1); + + if (power_good) { + if (as7716_32x_psu_model_name_get(dev) < 0) { + goto exit; + } + + if (strncmp(data->model_name, + models[PSU_TYPE_DC_12V].model_name, + models[PSU_TYPE_DC_12V].length) == 0) + { + /* Read fan direction */ + + status = as7716_32x_psu_read_block(client, DC12V_FAN_DIR_OFFSET, + data->fan_dir, DC12V_FAN_DIR_LEN); + + if (status < 0) { + data->fan_dir[0] = '\0'; + dev_dbg(&client->dev, "unable to read fan direction from (0x%x) offset(0x%x)\n", + client->addr, DC12V_FAN_DIR_OFFSET); + goto exit; + } + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init as7716_32x_psu_init(void) +{ + return i2c_add_driver(&as7716_32x_psu_driver); +} + +static void __exit as7716_32x_psu_exit(void) +{ + i2c_del_driver(&as7716_32x_psu_driver); +} + +module_init(as7716_32x_psu_init); +module_exit(as7716_32x_psu_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7716_32x_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_sfp.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_sfp.c new file mode 100755 index 000000000000..9c7a05632154 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_sfp.c @@ -0,0 +1,365 @@ +/* + * An hwmon driver for accton as7716_32x sfp + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BIT_INDEX(i) (1UL << (i)) +#define I2C_ADDR_CPLD1 0x60 +#define I2C_ADDR_CPLD2 0x62 +#define I2C_ADDR_CPLD3 0x64 +#define CPLD1_OFFSET_QSFP_PRESET1 0x30 +#define CPLD1_OFFSET_QSFP_PRESET2 0x31 +#define CPLD1_OFFSET_QSFP_PRESET3 0x32 +#define CPLD1_OFFSET_QSFP_PRESET4 0x33 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7716_32x_sfp_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + int port; /* Front port index */ + char eeprom[256]; /* eeprom data */ + u32 is_present; /* present status */ +}; + +static struct as7716_32x_sfp_data *as7716_32x_sfp_update_device(struct device *dev); +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_present(struct device *dev, struct device_attribute *da,char *buf); +static ssize_t show_eeprom(struct device *dev, struct device_attribute *da, char *buf); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +enum as7716_32x_sfp_sysfs_attributes { + SFP_PORT_NUMBER, + SFP_IS_PRESENT, + SFP_IS_PRESENT_ALL, + SFP_EEPROM +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, SFP_PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_present, NULL, SFP_IS_PRESENT); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_present, NULL, SFP_IS_PRESENT_ALL); +static SENSOR_DEVICE_ATTR(sfp_eeprom, S_IRUGO, show_eeprom, NULL, SFP_EEPROM); + +static struct attribute *as7716_32x_sfp_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_eeprom.dev_attr.attr, + NULL +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_sfp_data *data = i2c_get_clientdata(client); + + return sprintf(buf, "%d\n", data->port+1); +} + +/* Error-check the CPLD read results. */ +#define VALIDATED_READ(_buf, _rv, _read_expr, _invert) \ +do { \ + _rv = (_read_expr); \ + if(_rv < 0) { \ + return sprintf(_buf, "READ ERROR\n"); \ + } \ + if(_invert) { \ + _rv = ~_rv; \ + } \ + _rv &= 0xFF; \ +} while(0) + +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if(attr->index == SFP_IS_PRESENT_ALL) { + int values[4]; + /* + * Report the SFP_PRESENCE status for all ports. + */ + + /* QSFP_PRESENT Ports 1-8 */ + //VALIDATED_READ(buf, values[0], accton_i2c_cpld_read(0x62, 0x9), 1); + VALIDATED_READ(buf, values[0], accton_i2c_cpld_read(I2C_ADDR_CPLD1, CPLD1_OFFSET_QSFP_PRESET1), 1); + /* QSFP_PRESENT Ports 9-16 */ + VALIDATED_READ(buf, values[1], accton_i2c_cpld_read(I2C_ADDR_CPLD1, CPLD1_OFFSET_QSFP_PRESET2), 1); + /* QSFP_PRESENT Ports 17-24 */ + VALIDATED_READ(buf, values[2], accton_i2c_cpld_read(I2C_ADDR_CPLD1, CPLD1_OFFSET_QSFP_PRESET3), 1); + /* QSFP_PRESENT Ports 25-32 */ + VALIDATED_READ(buf, values[3], accton_i2c_cpld_read(I2C_ADDR_CPLD1, CPLD1_OFFSET_QSFP_PRESET4), 1); + + /* Return values 1 -> 32 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], values[3]); + } + else { /* SFP_IS_PRESENT */ + struct as7716_32x_sfp_data *data = as7716_32x_sfp_update_device(dev); + + if (!data->valid) { + printk("return -EIO\n"); + return -EIO; + } + + return sprintf(buf, "%d\n", data->is_present); + } +} + +static ssize_t show_eeprom(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7716_32x_sfp_data *data = as7716_32x_sfp_update_device(dev); + + if (!data->valid) { + return 0; + } + + if (!data->is_present) { + return 0; + } + + memcpy(buf, data->eeprom, sizeof(data->eeprom)); + + return sizeof(data->eeprom); +} + +static const struct attribute_group as7716_32x_sfp_group = { + .attrs = as7716_32x_sfp_attributes, +}; + +static int as7716_32x_sfp_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7716_32x_sfp_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7716_32x_sfp_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + i2c_set_clientdata(client, data); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32x_sfp_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sfp '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32x_sfp_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32x_sfp_remove(struct i2c_client *client) +{ + struct as7716_32x_sfp_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32x_sfp_group); + kfree(data); + + return 0; +} + +enum port_numbers { +as7716_32x_sfp1, as7716_32x_sfp2, as7716_32x_sfp3, as7716_32x_sfp4, +as7716_32x_sfp5, as7716_32x_sfp6, as7716_32x_sfp7, as7716_32x_sfp8, +as7716_32x_sfp9, as7716_32x_sfp10,as7716_32x_sfp11,as7716_32x_sfp12, +as7716_32x_sfp13,as7716_32x_sfp14,as7716_32x_sfp15,as7716_32x_sfp16, +as7716_32x_sfp17,as7716_32x_sfp18,as7716_32x_sfp19,as7716_32x_sfp20, +as7716_32x_sfp21,as7716_32x_sfp22,as7716_32x_sfp23,as7716_32x_sfp24, +as7716_32x_sfp25,as7716_32x_sfp26,as7716_32x_sfp27,as7716_32x_sfp28, +as7716_32x_sfp29,as7716_32x_sfp30,as7716_32x_sfp31,as7716_32x_sfp32 +}; + +static const struct i2c_device_id as7716_32x_sfp_id[] = { +{ "as7716_32x_sfp1", as7716_32x_sfp1 }, { "as7716_32x_sfp2", as7716_32x_sfp2 }, +{ "as7716_32x_sfp3", as7716_32x_sfp3 }, { "as7716_32x_sfp4", as7716_32x_sfp4 }, +{ "as7716_32x_sfp5", as7716_32x_sfp5 }, { "as7716_32x_sfp6", as7716_32x_sfp6 }, +{ "as7716_32x_sfp7", as7716_32x_sfp7 }, { "as7716_32x_sfp8", as7716_32x_sfp8 }, +{ "as7716_32x_sfp9", as7716_32x_sfp9 }, { "as7716_32x_sfp10", as7716_32x_sfp10 }, +{ "as7716_32x_sfp11", as7716_32x_sfp11 }, { "as7716_32x_sfp12", as7716_32x_sfp12 }, +{ "as7716_32x_sfp13", as7716_32x_sfp13 }, { "as7716_32x_sfp14", as7716_32x_sfp14 }, +{ "as7716_32x_sfp15", as7716_32x_sfp15 }, { "as7716_32x_sfp16", as7716_32x_sfp16 }, +{ "as7716_32x_sfp17", as7716_32x_sfp17 }, { "as7716_32x_sfp18", as7716_32x_sfp18 }, +{ "as7716_32x_sfp19", as7716_32x_sfp19 }, { "as7716_32x_sfp20", as7716_32x_sfp20 }, +{ "as7716_32x_sfp21", as7716_32x_sfp21 }, { "as7716_32x_sfp22", as7716_32x_sfp22 }, +{ "as7716_32x_sfp23", as7716_32x_sfp23 }, { "as7716_32x_sfp24", as7716_32x_sfp24 }, +{ "as7716_32x_sfp25", as7716_32x_sfp25 }, { "as7716_32x_sfp26", as7716_32x_sfp26 }, +{ "as7716_32x_sfp27", as7716_32x_sfp27 }, { "as7716_32x_sfp28", as7716_32x_sfp28 }, +{ "as7716_32x_sfp29", as7716_32x_sfp29 }, { "as7716_32x_sfp30", as7716_32x_sfp30 }, +{ "as7716_32x_sfp31", as7716_32x_sfp31 }, { "as7716_32x_sfp32", as7716_32x_sfp32 }, +{} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32x_sfp_id); + +static struct i2c_driver as7716_32x_sfp_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7716_32x_sfp", + }, + .probe = as7716_32x_sfp_probe, + .remove = as7716_32x_sfp_remove, + .id_table = as7716_32x_sfp_id, + .address_list = normal_i2c, +}; + +static int as7716_32x_sfp_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; + +abort: + return result; +} + +static struct as7716_32x_sfp_data *as7716_32x_sfp_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_sfp_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status = -1; + int i = 0; + u8 cpld_reg = 0x30 + (data->port/8); + + data->valid = 0; + + /* Read present status of the specified port number */ + data->is_present = 0; + status = accton_i2c_cpld_read(I2C_ADDR_CPLD1, cpld_reg); + + if (status < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", I2C_ADDR_CPLD1, cpld_reg, status); + goto exit; + } + + data->is_present = (status & (1 << (data->port % 8))) ? 0 : 1; + printk("data->is_present=%d, data->port=%d, status=0x%x\n",data->is_present, data->port, status); + /* Read eeprom data based on port number */ + memset(data->eeprom, 0, sizeof(data->eeprom)); + + /* Check if the port is present */ + if (data->is_present) { + /* read eeprom */ + for (i = 0; i < sizeof(data->eeprom)/I2C_SMBUS_BLOCK_MAX; i++) { + status = as7716_32x_sfp_read_block(client, i*I2C_SMBUS_BLOCK_MAX, + data->eeprom+(i*I2C_SMBUS_BLOCK_MAX), + I2C_SMBUS_BLOCK_MAX); + if (status < 0) { + printk("unable to read eeprom from port(%d)\n", data->port); + dev_dbg(&client->dev, "unable to read eeprom from port(%d)\n", data->port); + goto exit; + } + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init as7716_32x_sfp_init(void) +{ + //extern int platform_accton_as7716_32x(void); + //if (!platform_accton_as7716_32x()) { +// return -ENODEV; + //} + + return i2c_add_driver(&as7716_32x_sfp_driver); +} + +static void __exit as7716_32x_sfp_exit(void) +{ + i2c_del_driver(&as7716_32x_sfp_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as7716_32x_sfp driver"); +MODULE_LICENSE("GPL"); + +module_init(as7716_32x_sfp_init); +module_exit(as7716_32x_sfp_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_i2c_cpld.c new file mode 100755 index 000000000000..46d1e2773287 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_i2c_cpld.c @@ -0,0 +1,259 @@ +/* + * A hwmon driver for the accton_i2c_cpld + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CPLD_VERSION_REG 0x1 + +enum as5712_54x_cpld_sysfs_attributes { + CPLD_READ_VERSION, + CPLD_BYTE_ACCESS, + CPLD_DUMP_ALL, +}; + +static ssize_t read_cpld_version(struct device *dev, struct device_attribute *da, + char *buf); +int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); + + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for accton_i2c_cpld + */ +static const unsigned short normal_i2c[] = { 0x31, 0x35, 0x60, 0x61, 0x62, I2C_CLIENT_END }; + +static SENSOR_DEVICE_ATTR(cpld_get_version, S_IRUGO, read_cpld_version, NULL, CPLD_READ_VERSION); + +static struct attribute *as5712_54x_cpld_attributes[] = { + &sensor_dev_attr_cpld_get_version.dev_attr.attr, + NULL +}; + +static const struct attribute_group as5712_54x_cpld_group = { + .attrs = as5712_54x_cpld_attributes, +}; + +static ssize_t read_cpld_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + unsigned short cpld_reg = CPLD_VERSION_REG; + u8 reg; + + if(attr->index == CPLD_READ_VERSION) { + reg = accton_i2c_cpld_read(client->addr, cpld_reg); + return sprintf(buf, "%02x\n",reg); + } + return -1 ; +} + + +static void accton_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void accton_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int accton_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as5712_54x_cpld_group); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + accton_i2c_cpld_add_client(client); + + return 0; +exit: + return status; +} + +static int accton_i2c_cpld_remove(struct i2c_client *client) +{ + sysfs_remove_group(&client->dev.kobj, &as5712_54x_cpld_group); + + accton_i2c_cpld_remove_client(client); + return 0; +} + +static const struct i2c_device_id accton_i2c_cpld_id[] = { + { "accton_i2c_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, accton_i2c_cpld_id); + +static struct i2c_driver accton_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "accton_i2c_cpld", + }, + .probe = accton_i2c_cpld_probe, + .remove = accton_i2c_cpld_remove, + .id_table = accton_i2c_cpld_id, + .address_list = normal_i2c, +}; + +int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_read); + +int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_write); + +static int __init accton_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&accton_i2c_cpld_driver); +} + +static void __exit accton_i2c_cpld_exit(void) +{ + i2c_del_driver(&accton_i2c_cpld_driver); +} +/* +static struct dmi_system_id as7712_dmi_table[] = { + { + .ident = "Accton AS7712", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS7712"), + }, + } +}; + +int platform_accton_as7712_32x(void) +{ + return dmi_check_system(as7712_dmi_table); +} +EXPORT_SYMBOL(platform_accton_as7712_32x); +*/ +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_i2c_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(accton_i2c_cpld_init); +module_exit(accton_i2c_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/cpr_4011_4mxx.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/cpr_4011_4mxx.c new file mode 100755 index 000000000000..30bea914d589 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/cpr_4011_4mxx.c @@ -0,0 +1,400 @@ +/* + * An hwmon driver for the CPR-4011-4Mxx Redundant Power Module + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#if 0 +#define DEBUG +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x3c, 0x3d, 0x3e, 0x3f, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct cpr_4011_4mxx_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 vout_mode; /* Register value */ + u16 v_in; /* Register value */ + u16 v_out; /* Register value */ + u16 i_in; /* Register value */ + u16 i_out; /* Register value */ + u16 p_in; /* Register value */ + u16 p_out; /* Register value */ + u16 temp_input[2]; /* Register value */ + u8 fan_fault; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u16 fan_speed[2]; /* Register value */ +}; + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_vout(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static int cpr_4011_4mxx_write_word(struct i2c_client *client, u8 reg, u16 value); +static struct cpr_4011_4mxx_data *cpr_4011_4mxx_update_device(struct device *dev); + +enum cpr_4011_4mxx_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_FAULT, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_v_in, S_IRUGO, show_linear, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_in, S_IRUGO, show_linear, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_in, S_IRUGO, show_linear, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); + +static struct attribute *cpr_4011_4mxx_attributes[] = { + &sensor_dev_attr_psu_v_in.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_in.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_in.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + NULL +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + cpr_4011_4mxx_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_IN: + value = data->v_in; + break; + case PSU_I_IN: + value = data->i_in; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_IN: + value = data->p_in; + break; + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp_input[0]; + break; + case PSU_FAN1_DUTY_CYCLE: + multiplier = 1; + value = data->fan_duty_cycle[0]; + break; + case PSU_FAN1_SPEED: + multiplier = 1; + value = data->fan_speed[0]; + break; + default: + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_vout(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->v_out; + + return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static const struct attribute_group cpr_4011_4mxx_group = { + .attrs = cpr_4011_4mxx_attributes, +}; + +static int cpr_4011_4mxx_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct cpr_4011_4mxx_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct cpr_4011_4mxx_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cpr_4011_4mxx_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int cpr_4011_4mxx_remove(struct i2c_client *client) +{ + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id cpr_4011_4mxx_id[] = { + { "cpr_4011_4mxx", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, cpr_4011_4mxx_id); + +static struct i2c_driver cpr_4011_4mxx_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "cpr_4011_4mxx", + }, + .probe = cpr_4011_4mxx_probe, + .remove = cpr_4011_4mxx_remove, + .id_table = cpr_4011_4mxx_id, + .address_list = normal_i2c, +}; + +static int cpr_4011_4mxx_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int cpr_4011_4mxx_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int cpr_4011_4mxx_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct cpr_4011_4mxx_data *cpr_4011_4mxx_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int i, status; + struct reg_data_byte regs_byte[] = { {0x20, &data->vout_mode}, + {0x81, &data->fan_fault}}; + struct reg_data_word regs_word[] = { {0x88, &data->v_in}, + {0x8b, &data->v_out}, + {0x89, &data->i_in}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x97, &data->p_in}, + {0x8d, &(data->temp_input[0])}, + {0x8e, &(data->temp_input[1])}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x3c, &(data->fan_duty_cycle[1])}, + {0x90, &(data->fan_speed[0])}, + {0x91, &(data->fan_speed[1])}}; + + dev_dbg(&client->dev, "Starting cpr_4011_4mxx update\n"); + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = cpr_4011_4mxx_read_byte(client, regs_byte[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + } + else { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = cpr_4011_4mxx_read_word(client, regs_word[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + } + else { + *(regs_word[i].value) = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init cpr_4011_4mxx_init(void) +{ + return i2c_add_driver(&cpr_4011_4mxx_driver); +} + +static void __exit cpr_4011_4mxx_exit(void) +{ + i2c_del_driver(&cpr_4011_4mxx_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("CPR_4011_4MXX driver"); +MODULE_LICENSE("GPL"); + +module_init(cpr_4011_4mxx_init); +module_exit(cpr_4011_4mxx_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/optoe.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/optoe.c new file mode 100755 index 000000000000..16be2fef89b1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/optoe.c @@ -0,0 +1,1148 @@ +/* + * optoe.c - A driver to read and write the EEPROM on optical transceivers + * (SFP, QSFP and similar I2C based devices) + * + * Copyright (C) 2014 Cumulus networks Inc. + * Copyright (C) 2017 Finisar 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 Freeoftware Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* + * Description: + * a) Optical transceiver EEPROM read/write transactions are just like + * the at24 eeproms managed by the at24.c i2c driver + * b) The register/memory layout is up to 256 128 byte pages defined by + * a "pages valid" register and switched via a "page select" + * register as explained in below diagram. + * c) 256 bytes are mapped at a time. 'Lower page 00h' is the first 128 + * bytes of address space, and always references the same + * location, independent of the page select register. + * All mapped pages are mapped into the upper 128 bytes + * (offset 128-255) of the i2c address. + * d) Devices with one I2C address (eg QSFP) use I2C address 0x50 + * (A0h in the spec), and map all pages in the upper 128 bytes + * of that address. + * e) Devices with two I2C addresses (eg SFP) have 256 bytes of data + * at I2C address 0x50, and 256 bytes of data at I2C address + * 0x51 (A2h in the spec). Page selection and paged access + * only apply to this second I2C address (0x51). + * e) The address space is presented, by the driver, as a linear + * address space. For devices with one I2C client at address + * 0x50 (eg QSFP), offset 0-127 are in the lower + * half of address 50/A0h/client[0]. Offset 128-255 are in + * page 0, 256-383 are page 1, etc. More generally, offset + * 'n' resides in page (n/128)-1. ('page -1' is the lower + * half, offset 0-127). + * f) For devices with two I2C clients at address 0x50 and 0x51 (eg SFP), + * the address space places offset 0-127 in the lower + * half of 50/A0/client[0], offset 128-255 in the upper + * half. Offset 256-383 is in the lower half of 51/A2/client[1]. + * Offset 384-511 is in page 0, in the upper half of 51/A2/... + * Offset 512-639 is in page 1, in the upper half of 51/A2/... + * Offset 'n' is in page (n/128)-3 (for n > 383) + * + * One I2c addressed (eg QSFP) Memory Map + * + * 2-Wire Serial Address: 1010000x + * + * Lower Page 00h (128 bytes) + * ===================== + * | | + * | | + * | | + * | | + * | | + * | | + * | | + * | | + * | | + * | | + * |Page Select Byte(127)| + * ===================== + * | + * | + * | + * | + * V + * ------------------------------------------------------------ + * | | | | + * | | | | + * | | | | + * | | | | + * | | | | + * | | | | + * | | | | + * | | | | + * | | | | + * V V V V + * ------------ -------------- --------------- -------------- + * | | | | | | | | + * | Upper | | Upper | | Upper | | Upper | + * | Page 00h | | Page 01h | | Page 02h | | Page 03h | + * | | | (Optional) | | (Optional) | | (Optional | + * | | | | | | | for Cable | + * | | | | | | | Assemblies) | + * | ID | | AST | | User | | | + * | Fields | | Table | | EEPROM Data | | | + * | | | | | | | | + * | | | | | | | | + * | | | | | | | | + * ------------ -------------- --------------- -------------- + * + * The SFF 8436 (QSFP) spec only defines the 4 pages described above. + * In anticipation of future applications and devices, this driver + * supports access to the full architected range, 256 pages. + * + **/ + +/* #define DEBUG 1 */ + +#undef EEPROM_CLASS +#ifdef CONFIG_EEPROM_CLASS +#define EEPROM_CLASS +#endif +#ifdef CONFIG_EEPROM_CLASS_MODULE +#define EEPROM_CLASS +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * The optoe driver is for read/write access to the EEPROM on standard + * I2C based optical transceivers (SFP, QSFP, etc) + * + * While based on the at24 driver, it eliminates code that supports other + * types of I2C EEPROMs, and adds support for pages accessed through the + * page-select register at offset 127. + */ + +struct optoe_platform_data { + u32 byte_len; /* size (sum of all addr) */ + u16 page_size; /* for writes */ + u8 flags; + + void (*setup)(struct memory_accessor *, void *context); + void *context; +#ifdef EEPROM_CLASS + struct eeprom_platform_data *eeprom_data; /* extra data for the eeprom_class */ +#endif +}; + +#ifdef EEPROM_CLASS +#include +#endif + +#include + +/* fundamental unit of addressing for EEPROM */ +#define OPTOE_PAGE_SIZE 128 +/* + * Single address devices (eg QSFP) have 256 pages, plus the unpaged + * low 128 bytes. If the device does not support paging, it is + * only 2 'pages' long. + */ +#define OPTOE_ARCH_PAGES 256 +#define ONE_ADDR_EEPROM_SIZE ((1 + OPTOE_ARCH_PAGES) * OPTOE_PAGE_SIZE) +#define ONE_ADDR_EEPROM_UNPAGED_SIZE (2 * OPTOE_PAGE_SIZE) +/* + * Dual address devices (eg SFP) have 256 pages, plus the unpaged + * low 128 bytes, plus 256 bytes at 0x50. If the device does not + * support paging, it is 4 'pages' long. + */ +#define TWO_ADDR_EEPROM_SIZE ((3 + OPTOE_ARCH_PAGES) * OPTOE_PAGE_SIZE) +#define TWO_ADDR_EEPROM_UNPAGED_SIZE (4 * OPTOE_PAGE_SIZE) + +/* a few constants to find our way around the EEPROM */ +#define OPTOE_PAGE_SELECT_REG 0x7F +#define ONE_ADDR_PAGEABLE_REG 0x02 +#define ONE_ADDR_NOT_PAGEABLE (1<<2) +#define TWO_ADDR_PAGEABLE_REG 0x40 +#define TWO_ADDR_PAGEABLE (1<<4) +#define OPTOE_ID_REG 0 + +/* The maximum length of a port name */ +#define MAX_PORT_NAME_LEN 20 +struct optoe_data { + struct optoe_platform_data chip; + struct memory_accessor macc; + int use_smbus; + char port_name[MAX_PORT_NAME_LEN]; + + /* + * Lock protects against activities from other Linux tasks, + * but not from changes by other I2C masters. + */ + struct mutex lock; + struct bin_attribute bin; + struct attribute_group attr_group; + + u8 *writebuf; + unsigned write_max; + + unsigned num_addresses; + +#ifdef EEPROM_CLASS + struct eeprom_device *eeprom_dev; +#endif + + /* dev_class: ONE_ADDR (QSFP) or TWO_ADDR (SFP) */ + int dev_class; + + struct i2c_client *client[]; +}; + +typedef enum optoe_opcode { + OPTOE_READ_OP = 0, + OPTOE_WRITE_OP = 1 +} optoe_opcode_e; + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = OPTOE_PAGE_SIZE; + +/* + * specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; + +/* + * flags to distinguish one-address (QSFP family) from two-address (SFP family) + * If the family is not known, figure it out when the device is accessed + */ +#define ONE_ADDR 1 +#define TWO_ADDR 2 + +static const struct i2c_device_id optoe_ids[] = { + { "optoe1", ONE_ADDR }, + { "optoe2", TWO_ADDR }, + { "sff8436", ONE_ADDR }, + { "24c04", TWO_ADDR }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, optoe_ids); + +/*-------------------------------------------------------------------------*/ +/* + * This routine computes the addressing information to be used for + * a given r/w request. + * + * Task is to calculate the client (0 = i2c addr 50, 1 = i2c addr 51), + * the page, and the offset. + * + * Handles both single address (eg QSFP) and two address (eg SFP). + * For SFP, offset 0-255 are on client[0], >255 is on client[1] + * Offset 256-383 are on the lower half of client[1] + * Pages are accessible on the upper half of client[1]. + * Offset >383 are in 128 byte pages mapped into the upper half + * + * For QSFP, all offsets are on client[0] + * offset 0-127 are on the lower half of client[0] (no paging) + * Pages are accessible on the upper half of client[1]. + * Offset >127 are in 128 byte pages mapped into the upper half + * + * Callers must not read/write beyond the end of a client or a page + * without recomputing the client/page. Hence offset (within page) + * plus length must be less than or equal to 128. (Note that this + * routine does not have access to the length of the call, hence + * cannot do the validity check.) + * + * Offset within Lower Page 00h and Upper Page 00h are not recomputed + */ + +static uint8_t optoe_translate_offset(struct optoe_data *optoe, + loff_t *offset, struct i2c_client **client) +{ + unsigned page = 0; + + *client = optoe->client[0]; + + /* if SFP style, offset > 255, shift to i2c addr 0x51 */ + if (optoe->dev_class == TWO_ADDR) { + if (*offset > 255) { + /* like QSFP, but shifted to client[1] */ + *client = optoe->client[1]; + *offset -= 256; + } + } + + /* + * if offset is in the range 0-128... + * page doesn't matter (using lower half), return 0. + * offset is already correct (don't add 128 to get to paged area) + */ + if (*offset < OPTOE_PAGE_SIZE) + return page; + + /* note, page will always be positive since *offset >= 128 */ + page = (*offset >> 7)-1; + /* 0x80 places the offset in the top half, offset is last 7 bits */ + *offset = OPTOE_PAGE_SIZE + (*offset & 0x7f); + + return page; /* note also returning client and offset */ +} + +static ssize_t optoe_eeprom_read(struct optoe_data *optoe, + struct i2c_client *client, + char *buf, unsigned offset, size_t count) +{ + struct i2c_msg msg[2]; + u8 msgbuf[2]; + unsigned long timeout, read_time; + int status, i; + + memset(msg, 0, sizeof(msg)); + + switch (optoe->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + /*smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + break; + case I2C_SMBUS_WORD_DATA: + /* Check for odd length transaction */ + count = (count == 1) ? 1 : 2; + break; + case I2C_SMBUS_BYTE_DATA: + count = 1; + break; + default: + /* + * When we have a better choice than SMBus calls, use a + * combined I2C message. Write address; then read up to + * io_limit data bytes. msgbuf is u8 and will cast to our + * needs. + */ + i = 0; + msgbuf[i++] = offset; + + msg[0].addr = client->addr; + msg[0].buf = msgbuf; + msg[0].len = i; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + } + + /* + * Reads fail if the previous write didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + read_time = jiffies; + + switch (optoe->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + status = i2c_smbus_read_i2c_block_data(client, offset, + count, buf); + break; + case I2C_SMBUS_WORD_DATA: + status = i2c_smbus_read_word_data(client, offset); + if (status >= 0) { + buf[0] = status & 0xff; + if (count == 2) + buf[1] = status >> 8; + status = count; + } + break; + case I2C_SMBUS_BYTE_DATA: + status = i2c_smbus_read_byte_data(client, offset); + if (status >= 0) { + buf[0] = status; + status = count; + } + break; + default: + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + status = count; + } + + dev_dbg(&client->dev, "eeprom read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) /* happy path */ + return count; + + if (status == -ENXIO) /* no module present */ + return status; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(read_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t optoe_eeprom_write(struct optoe_data *optoe, + struct i2c_client *client, + const char *buf, + unsigned offset, size_t count) +{ + struct i2c_msg msg; + ssize_t status; + unsigned long timeout, write_time; + unsigned next_page_start; + int i = 0; + + /* write max is at most a page + * (In this driver, write_max is actually one byte!) + */ + if (count > optoe->write_max) + count = optoe->write_max; + + /* shorten count if necessary to avoid crossing page boundary */ + next_page_start = roundup(offset + 1, OPTOE_PAGE_SIZE); + if (offset + count > next_page_start) + count = next_page_start - offset; + + switch (optoe->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + /*smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + break; + case I2C_SMBUS_WORD_DATA: + /* Check for odd length transaction */ + count = (count == 1) ? 1 : 2; + break; + case I2C_SMBUS_BYTE_DATA: + count = 1; + break; + default: + /* If we'll use I2C calls for I/O, set up the message */ + msg.addr = client->addr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = optoe->writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + break; + } + + /* + * Reads fail if the previous write didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + write_time = jiffies; + + switch (optoe->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + status = i2c_smbus_write_i2c_block_data(client, + offset, count, buf); + if (status == 0) + status = count; + break; + case I2C_SMBUS_WORD_DATA: + if (count == 2) { + status = i2c_smbus_write_word_data(client, + offset, (u16)((buf[0])|(buf[1] << 8))); + } else { + /* count = 1 */ + status = i2c_smbus_write_byte_data(client, + offset, buf[0]); + } + if (status == 0) + status = count; + break; + case I2C_SMBUS_BYTE_DATA: + status = i2c_smbus_write_byte_data(client, offset, + buf[0]); + if (status == 0) + status = count; + break; + default: + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + break; + } + + dev_dbg(&client->dev, "eeprom write %zu@%d --> %ld (%lu)\n", + count, offset, (long int) status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(write_time, timeout)); + + return -ETIMEDOUT; +} + + +static ssize_t optoe_eeprom_update_client(struct optoe_data *optoe, + char *buf, loff_t off, + size_t count, optoe_opcode_e opcode) +{ + struct i2c_client *client; + ssize_t retval = 0; + uint8_t page = 0; + loff_t phy_offset = off; + int ret = 0; + + page = optoe_translate_offset(optoe, &phy_offset, &client); + dev_dbg(&client->dev, + "optoe_eeprom_update_client off %lld page:%d phy_offset:%lld, count:%ld, opcode:%d\n", + off, page, phy_offset, (long int) count, opcode); + if (page > 0) { + ret = optoe_eeprom_write(optoe, client, &page, + OPTOE_PAGE_SELECT_REG, 1); + if (ret < 0) { + dev_dbg(&client->dev, + "Write page register for page %d failed ret:%d!\n", + page, ret); + return ret; + } + } + + while (count) { + ssize_t status; + + if (opcode == OPTOE_READ_OP) { + status = optoe_eeprom_read(optoe, client, + buf, phy_offset, count); + } else { + status = optoe_eeprom_write(optoe, client, + buf, phy_offset, count); + } + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + phy_offset += status; + count -= status; + retval += status; + } + + + if (page > 0) { + /* return the page register to page 0 (why?) */ + page = 0; + ret = optoe_eeprom_write(optoe, client, &page, + OPTOE_PAGE_SELECT_REG, 1); + if (ret < 0) { + dev_err(&client->dev, + "Restore page register to 0 failed:%d!\n", ret); + /* error only if nothing has been transferred */ + if (retval == 0) retval = ret; + } + } + return retval; +} + +/* + * Figure out if this access is within the range of supported pages. + * Note this is called on every access because we don't know if the + * module has been replaced since the last call. + * If/when modules support more pages, this is the routine to update + * to validate and allow access to additional pages. + * + * Returns updated len for this access: + * - entire access is legal, original len is returned. + * - access begins legal but is too long, len is truncated to fit. + * - initial offset exceeds supported pages, return -EINVAL + */ +static ssize_t optoe_page_legal(struct optoe_data *optoe, + loff_t off, size_t len) +{ + struct i2c_client *client = optoe->client[0]; + u8 regval; + int status; + size_t maxlen; + + if (off < 0) return -EINVAL; + if (optoe->dev_class == TWO_ADDR) { + /* SFP case */ + /* if no pages needed, we're good */ + if ((off + len) <= TWO_ADDR_EEPROM_UNPAGED_SIZE) return len; + /* if offset exceeds possible pages, we're not good */ + if (off >= TWO_ADDR_EEPROM_SIZE) return -EINVAL; + /* in between, are pages supported? */ + status = optoe_eeprom_read(optoe, client, ®val, + TWO_ADDR_PAGEABLE_REG, 1); + if (status < 0) return status; /* error out (no module?) */ + if (regval & TWO_ADDR_PAGEABLE) { + /* Pages supported, trim len to the end of pages */ + maxlen = TWO_ADDR_EEPROM_SIZE - off; + } else { + /* pages not supported, trim len to unpaged size */ + if (off >= TWO_ADDR_EEPROM_UNPAGED_SIZE) return -EINVAL; + maxlen = TWO_ADDR_EEPROM_UNPAGED_SIZE - off; + } + len = (len > maxlen) ? maxlen : len; + dev_dbg(&client->dev, + "page_legal, SFP, off %lld len %ld\n", + off, (long int) len); + } else { + /* QSFP case */ + /* if no pages needed, we're good */ + if ((off + len) <= ONE_ADDR_EEPROM_UNPAGED_SIZE) return len; + /* if offset exceeds possible pages, we're not good */ + if (off >= ONE_ADDR_EEPROM_SIZE) return -EINVAL; + /* in between, are pages supported? */ + status = optoe_eeprom_read(optoe, client, ®val, + ONE_ADDR_PAGEABLE_REG, 1); + if (status < 0) return status; /* error out (no module?) */ + if (regval & ONE_ADDR_NOT_PAGEABLE) { + /* pages not supported, trim len to unpaged size */ + if (off >= ONE_ADDR_EEPROM_UNPAGED_SIZE) return -EINVAL; + maxlen = ONE_ADDR_EEPROM_UNPAGED_SIZE - off; + } else { + /* Pages supported, trim len to the end of pages */ + maxlen = ONE_ADDR_EEPROM_SIZE - off; + } + len = (len > maxlen) ? maxlen : len; + dev_dbg(&client->dev, + "page_legal, QSFP, off %lld len %ld\n", + off, (long int) len); + } + return len; +} + +static ssize_t optoe_read_write(struct optoe_data *optoe, + char *buf, loff_t off, size_t len, optoe_opcode_e opcode) +{ + struct i2c_client *client = optoe->client[0]; + int chunk; + int status = 0; + ssize_t retval; + size_t pending_len = 0, chunk_len = 0; + loff_t chunk_offset = 0, chunk_start_offset = 0; + + dev_dbg(&client->dev, + "optoe_read_write: off %lld len:%ld, opcode:%s\n", + off, (long int) len, (opcode == OPTOE_READ_OP) ? "r": "w"); + if (unlikely(!len)) + return len; + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&optoe->lock); + + /* + * Confirm this access fits within the device suppored addr range + */ + status = optoe_page_legal(optoe, off, len); + if (status < 0) { + goto err; + } + len = status; + + /* + * For each (128 byte) chunk involved in this request, issue a + * separate call to sff_eeprom_update_client(), to + * ensure that each access recalculates the client/page + * and writes the page register as needed. + * Note that chunk to page mapping is confusing, is different for + * QSFP and SFP, and never needs to be done. Don't try! + */ + pending_len = len; /* amount remaining to transfer */ + retval = 0; /* amount transferred */ + for (chunk = off >> 7; chunk <= (off + len - 1) >> 7; chunk++) { + + /* + * Compute the offset and number of bytes to be read/write + * + * 1. start at offset 0 (within the chunk), and read/write + * the entire chunk + * 2. start at offset 0 (within the chunk) and read/write less + * than entire chunk + * 3. start at an offset not equal to 0 and read/write the rest + * of the chunk + * 4. start at an offset not equal to 0 and read/write less than + * (end of chunk - offset) + */ + chunk_start_offset = chunk * OPTOE_PAGE_SIZE; + + if (chunk_start_offset < off) { + chunk_offset = off; + if ((off + pending_len) < (chunk_start_offset + + OPTOE_PAGE_SIZE)) + chunk_len = pending_len; + else + chunk_len = OPTOE_PAGE_SIZE - off; + } else { + chunk_offset = chunk_start_offset; + if (pending_len > OPTOE_PAGE_SIZE) + chunk_len = OPTOE_PAGE_SIZE; + else + chunk_len = pending_len; + } + + dev_dbg(&client->dev, + "sff_r/w: off %lld, len %ld, chunk_start_offset %lld, chunk_offset %lld, chunk_len %ld, pending_len %ld\n", + off, (long int) len, chunk_start_offset, chunk_offset, + (long int) chunk_len, (long int) pending_len); + + /* + * note: chunk_offset is from the start of the EEPROM, + * not the start of the chunk + */ + status = optoe_eeprom_update_client(optoe, buf, + chunk_offset, chunk_len, opcode); + if (status != chunk_len) { + /* This is another 'no device present' path */ + dev_dbg(&client->dev, + "optoe_update_client for chunk %d chunk_offset %lld chunk_len %ld failed %d!\n", + chunk, chunk_offset, (long int) chunk_len, status); + goto err; + } + buf += status; + pending_len -= status; + retval += status; + } + mutex_unlock(&optoe->lock); + + return retval; + +err: + mutex_unlock(&optoe->lock); + + return status; +} + +static ssize_t optoe_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, + struct device, kobj)); + struct optoe_data *optoe = i2c_get_clientdata(client); + + return optoe_read_write(optoe, buf, off, count, OPTOE_READ_OP); +} + + +static ssize_t optoe_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, + struct device, kobj)); + struct optoe_data *optoe = i2c_get_clientdata(client); + + return optoe_read_write(optoe, buf, off, count, OPTOE_WRITE_OP); +} +/*-------------------------------------------------------------------------*/ + +/* + * This lets other kernel code access the eeprom data. For example, it + * might hold a board's Ethernet address, or board-specific calibration + * data generated on the manufacturing floor. + */ + +static ssize_t optoe_macc_read(struct memory_accessor *macc, + char *buf, off_t offset, size_t count) +{ + struct optoe_data *optoe = container_of(macc, + struct optoe_data, macc); + + return optoe_read_write(optoe, buf, offset, count, OPTOE_READ_OP); +} + +static ssize_t optoe_macc_write(struct memory_accessor *macc, + const char *buf, off_t offset, size_t count) +{ + struct optoe_data *optoe = container_of(macc, + struct optoe_data, macc); + + return optoe_read_write(optoe, (char *) buf, offset, + count, OPTOE_WRITE_OP); +} + +/*-------------------------------------------------------------------------*/ + +static int optoe_remove(struct i2c_client *client) +{ + struct optoe_data *optoe; + int i; + + optoe = i2c_get_clientdata(client); + sysfs_remove_group(&client->dev.kobj, &optoe->attr_group); + sysfs_remove_bin_file(&client->dev.kobj, &optoe->bin); + + for (i = 1; i < optoe->num_addresses; i++) + i2c_unregister_device(optoe->client[i]); + +#ifdef EEPROM_CLASS + eeprom_device_unregister(optoe->eeprom_dev); +#endif + + kfree(optoe->writebuf); + kfree(optoe); + return 0; +} + +static ssize_t show_port_name(struct device *dev, + struct device_attribute *dattr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct optoe_data *optoe = i2c_get_clientdata(client); + ssize_t count; + + mutex_lock(&optoe->lock); + count = sprintf(buf, "%s\n", optoe->port_name); + mutex_unlock(&optoe->lock); + + return count; +} + +static ssize_t set_port_name(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct optoe_data *optoe = i2c_get_clientdata(client); + char port_name[MAX_PORT_NAME_LEN]; + + /* no checking, this value is not used except by show_port_name */ + + if (sscanf(buf, "%19s", port_name) != 1) + return -EINVAL; + + mutex_lock(&optoe->lock); + strcpy(optoe->port_name, port_name); + mutex_unlock(&optoe->lock); + + return count; +} + +static DEVICE_ATTR(port_name, S_IRUGO | S_IWUSR, + show_port_name, set_port_name); + +static ssize_t show_dev_class(struct device *dev, + struct device_attribute *dattr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct optoe_data *optoe = i2c_get_clientdata(client); + ssize_t count; + + mutex_lock(&optoe->lock); + count = sprintf(buf, "%d\n", optoe->dev_class); + mutex_unlock(&optoe->lock); + + return count; +} + +static ssize_t set_dev_class(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct optoe_data *optoe = i2c_get_clientdata(client); + int dev_class; + + /* + * dev_class is actually the number of sfp ports used, thus + * legal values are "1" (QSFP class) and "2" (SFP class) + */ + if (sscanf(buf, "%d", &dev_class) != 1 || + dev_class < 1 || dev_class > 2) + return -EINVAL; + + mutex_lock(&optoe->lock); + optoe->dev_class = dev_class; + mutex_unlock(&optoe->lock); + + return count; +} + +static DEVICE_ATTR(dev_class, S_IRUGO | S_IWUSR, + show_dev_class, set_dev_class); + +static struct attribute *optoe_attrs[] = { + &dev_attr_port_name.attr, + &dev_attr_dev_class.attr, + NULL, +}; + +static struct attribute_group optoe_attr_group = { + .attrs = optoe_attrs, +}; + +static int optoe_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + int err; + int use_smbus = 0; + struct optoe_platform_data chip; + struct optoe_data *optoe; + int num_addresses = 0; + int i = 0; + + if (client->addr != 0x50) { + dev_dbg(&client->dev, "probe, bad i2c addr: 0x%x\n", + client->addr); + err = -EINVAL; + goto exit; + } + + if (client->dev.platform_data) { + chip = *(struct optoe_platform_data *)client->dev.platform_data; + dev_dbg(&client->dev, "probe, chip provided, flags:0x%x; name: %s\n", chip.flags, client->name); + } else { + if (!id->driver_data) { + err = -ENODEV; + goto exit; + } + dev_dbg(&client->dev, "probe, building chip\n"); + chip.flags = 0; + chip.setup = NULL; + chip.context = NULL; +#ifdef EEPROM_CLASS + chip.eeprom_data = NULL; +#endif + } + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + err = -EPFNOSUPPORT; + goto exit; + } + } + + + /* + * Make room for two i2c clients + */ + num_addresses = 2; + + optoe = kzalloc(sizeof(struct optoe_data) + + num_addresses * sizeof(struct i2c_client *), + GFP_KERNEL); + if (!optoe) { + err = -ENOMEM; + goto exit; + } + + mutex_init(&optoe->lock); + + /* determine whether this is a one-address or two-address module */ + if ((strcmp(client->name, "optoe1") == 0) || + (strcmp(client->name, "sff8436") == 0)) { + /* one-address (eg QSFP) family */ + optoe->dev_class = ONE_ADDR; + chip.byte_len = ONE_ADDR_EEPROM_SIZE; + num_addresses = 1; + } else if ((strcmp(client->name, "optoe2") == 0) || + (strcmp(client->name, "24c04") == 0)) { + /* SFP family */ + optoe->dev_class = TWO_ADDR; + chip.byte_len = TWO_ADDR_EEPROM_SIZE; + } else { /* those were the only two choices */ + err = -EINVAL; + goto exit; + } + + dev_dbg(&client->dev, "dev_class: %d\n", optoe->dev_class); + optoe->use_smbus = use_smbus; + optoe->chip = chip; + optoe->num_addresses = num_addresses; + strcpy(optoe->port_name, "unitialized"); + + /* + * Export the EEPROM bytes through sysfs, since that's convenient. + * By default, only root should see the data (maybe passwords etc) + */ + sysfs_bin_attr_init(&optoe->bin); + optoe->bin.attr.name = "eeprom"; + optoe->bin.attr.mode = S_IRUGO; + optoe->bin.read = optoe_bin_read; + optoe->bin.size = chip.byte_len; + + optoe->macc.read = optoe_macc_read; + + if (!use_smbus || + (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) || + i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_WORD_DATA) || + i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + /* + * NOTE: AN-2079 + * Finisar recommends that the host implement 1 byte writes + * only since this module only supports 32 byte page boundaries. + * 2 byte writes are acceptable for PE and Vout changes per + * Application Note AN-2071. + */ + unsigned write_max = 1; + + optoe->macc.write = optoe_macc_write; + + optoe->bin.write = optoe_bin_write; + optoe->bin.attr.mode |= S_IWUSR; + + if (write_max > io_limit) + write_max = io_limit; + if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + optoe->write_max = write_max; + + /* buffer (data + address at the beginning) */ + optoe->writebuf = kmalloc(write_max + 2, GFP_KERNEL); + if (!optoe->writebuf) { + err = -ENOMEM; + goto exit_kfree; + } + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + + optoe->client[0] = client; + + /* use a dummy I2C device for two-address chips */ + for (i = 1; i < num_addresses; i++) { + optoe->client[i] = i2c_new_dummy(client->adapter, + client->addr + i); + if (!optoe->client[i]) { + dev_err(&client->dev, "address 0x%02x unavailable\n", + client->addr + i); + err = -EADDRINUSE; + goto err_struct; + } + } + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &optoe->bin); + if (err) + goto err_struct; + + optoe->attr_group = optoe_attr_group; + + err = sysfs_create_group(&client->dev.kobj, &optoe->attr_group); + if (err) { + dev_err(&client->dev, "failed to create sysfs attribute group.\n"); + goto err_struct; + } +#ifdef EEPROM_CLASS + optoe->eeprom_dev = eeprom_device_register(&client->dev, + chip.eeprom_data); + if (IS_ERR(optoe->eeprom_dev)) { + dev_err(&client->dev, "error registering eeprom device.\n"); + err = PTR_ERR(optoe->eeprom_dev); + goto err_sysfs_cleanup; + } +#endif + + i2c_set_clientdata(client, optoe); + + dev_info(&client->dev, "%zu byte %s EEPROM, %s\n", + optoe->bin.size, client->name, + optoe->bin.write ? "read/write" : "read-only"); + + if (use_smbus == I2C_SMBUS_WORD_DATA || + use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } + + if (chip.setup) + chip.setup(&optoe->macc, chip.context); + + return 0; + +#ifdef EEPROM_CLASS +err_sysfs_cleanup: + sysfs_remove_group(&client->dev.kobj, &optoe->attr_group); + sysfs_remove_bin_file(&client->dev.kobj, &optoe->bin); +#endif + +err_struct: + for (i = 1; i < num_addresses; i++) { + if (optoe->client[i]) + i2c_unregister_device(optoe->client[i]); + } + + kfree(optoe->writebuf); +exit_kfree: + kfree(optoe); +exit: + dev_dbg(&client->dev, "probe error %d\n", err); + + return err; +} + +/*-------------------------------------------------------------------------*/ + +static struct i2c_driver optoe_driver = { + .driver = { + .name = "optoe", + .owner = THIS_MODULE, + }, + .probe = optoe_probe, + .remove = optoe_remove, + .id_table = optoe_ids, +}; + +static int __init optoe_init(void) +{ + + if (!io_limit) { + pr_err("optoe: io_limit must not be 0!\n"); + return -EINVAL; + } + + io_limit = rounddown_pow_of_two(io_limit); + return i2c_add_driver(&optoe_driver); +} +module_init(optoe_init); + +static void __exit optoe_exit(void) +{ + i2c_del_driver(&optoe_driver); +} +module_exit(optoe_exit); + +MODULE_DESCRIPTION("Driver for optical transceiver (SFP, QSFP, ...) EEPROMs"); +MODULE_AUTHOR("DON BOLLINGER "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/ym2651y.c new file mode 100755 index 000000000000..8e76c56b54fc --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/ym2651y.c @@ -0,0 +1,603 @@ +/* + * An hwmon driver for the 3Y Power YM-2651Y Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x58, 0x5b, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct ym2651y_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 capability; /* Register value */ + u16 status_word; /* Register value */ + u8 fan_fault; /* Register value */ + u8 over_temp; /* Register value */ + u16 v_out; /* Register value */ + u16 i_out; /* Register value */ + u16 p_out; /* Register value */ + u16 temp; /* Register value */ + u16 fan_speed; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u8 fan_dir[4]; /* Register value */ + u8 pmbus_revision; /* Register value */ + u8 mfr_id[10]; /* Register value */ + u8 mfr_model[10]; /* Register value */ + u8 mfr_revsion[3]; /* Register value */ + u16 mfr_vin_min; /* Register value */ + u16 mfr_vin_max; /* Register value */ + u16 mfr_iin_max; /* Register value */ + u16 mfr_iout_max; /* Register value */ + u16 mfr_pin_max; /* Register value */ + u16 mfr_pout_max; /* Register value */ + u16 mfr_vout_min; /* Register value */ + u16 mfr_vout_max; /* Register value */ +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf); +static struct ym2651y_data *ym2651y_update_device(struct device *dev); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value); + +enum ym2651y_sysfs_attributes { + PSU_POWER_ON = 0, + PSU_TEMP_FAULT, + PSU_POWER_GOOD, + PSU_FAN1_FAULT, + PSU_FAN_DIRECTION, + PSU_OVER_TEMP, + PSU_V_OUT, + PSU_I_OUT, + PSU_P_OUT, + PSU_P_OUT_UV, /*In Unit of microVolt, instead of mini.*/ + PSU_TEMP1_INPUT, + PSU_FAN1_SPEED, + PSU_FAN1_DUTY_CYCLE, + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_REVISION, + PSU_MFR_VIN_MIN, + PSU_MFR_VIN_MAX, + PSU_MFR_VOUT_MIN, + PSU_MFR_VOUT_MAX, + PSU_MFR_IIN_MAX, + PSU_MFR_IOUT_MAX, + PSU_MFR_PIN_MAX, + PSU_MFR_POUT_MAX +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_power_on, S_IRUGO, show_word, NULL, PSU_POWER_ON); +static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_word, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, show_over_temp, NULL, PSU_OVER_TEMP); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_linear, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_ascii, NULL, PSU_FAN_DIRECTION); +static SENSOR_DEVICE_ATTR(psu_pmbus_revision, S_IRUGO, show_byte, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, show_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IRUGO, show_ascii, NULL, PSU_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_min, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_max, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_min, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_max, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iin_max, S_IRUGO, show_linear, NULL, PSU_MFR_IIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX); + +/*Duplicate nodes for lm-sensors.*/ +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_linear, NULL, PSU_P_OUT_UV); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); + +static struct attribute *ym2651y_attributes[] = { + &sensor_dev_attr_psu_power_on.dev_attr.attr, + &sensor_dev_attr_psu_temp_fault.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_over_temp.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr, + /*Duplicate nodes for lm-sensors.*/ + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_temp1_fault.dev_attr.attr, + NULL +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + return (attr->index == PSU_PMBUS_REVISION) ? sprintf(buf, "%d\n", data->pmbus_revision) : + sprintf(buf, "0\n"); +} + +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u16 status = 0; + + switch (attr->index) { + case PSU_POWER_ON: /* psu_power_on, low byte bit 6 of status_word, 0=>ON, 1=>OFF */ + status = (data->status_word & 0x40) ? 0 : 1; + break; + case PSU_TEMP_FAULT: /* psu_temp_fault, low byte bit 2 of status_word, 0=>Normal, 1=>temp fault */ + status = (data->status_word & 0x4) >> 2; + break; + case PSU_POWER_GOOD: /* psu_power_good, high byte bit 3 of status_word, 0=>OK, 1=>FAIL */ + status = (data->status_word & 0x800) ? 0 : 1; + break; + } + + return sprintf(buf, "%d\n", status); +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + ym2651y_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_OUT: + value = data->v_out; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_OUT_UV: + multiplier = 1000000; /*For lm-sensors, unit is micro-Volt.*/ + /*Passing through*/ + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp; + break; + case PSU_FAN1_SPEED: + value = data->fan_speed; + multiplier = 1; + break; + case PSU_FAN1_DUTY_CYCLE: + value = data->fan_duty_cycle[0]; + multiplier = 1; + break; + case PSU_MFR_VIN_MIN: + value = data->mfr_vin_min; + break; + case PSU_MFR_VIN_MAX: + value = data->mfr_vin_max; + break; + case PSU_MFR_VOUT_MIN: + value = data->mfr_vout_min; + break; + case PSU_MFR_VOUT_MAX: + value = data->mfr_vout_max; + break; + case PSU_MFR_PIN_MAX: + value = data->mfr_pin_max; + break; + case PSU_MFR_POUT_MAX: + value = data->mfr_pout_max; + break; + case PSU_MFR_IOUT_MAX: + value = data->mfr_iout_max; + break; + case PSU_MFR_IIN_MAX: + value = data->mfr_iin_max; + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct ym2651y_data *data = ym2651y_update_device(dev); + + return sprintf(buf, "%d\n", data->over_temp >> 7); +} + +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u8 *ptr = NULL; + + switch (attr->index) { + case PSU_FAN_DIRECTION: /* psu_fan_dir */ + ptr = data->fan_dir; + break; + case PSU_MFR_ID: /* psu_mfr_id */ + ptr = data->mfr_id; + break; + case PSU_MFR_MODEL: /* psu_mfr_model */ + ptr = data->mfr_model; + break; + case PSU_MFR_REVISION: /* psu_mfr_revision */ + ptr = data->mfr_revsion; + break; + default: + return 0; + } + + return sprintf(buf, "%s\n", ptr); +} + +static const struct attribute_group ym2651y_group = { + .attrs = ym2651y_attributes, +}; + +static int ym2651y_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct ym2651y_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct ym2651y_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &ym2651y_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int ym2651y_remove(struct i2c_client *client) +{ + struct ym2651y_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id ym2651y_id[] = { + { "ym2651", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, ym2651y_id); + +static struct i2c_driver ym2651y_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "ym2651", + }, + .probe = ym2651y_probe, + .remove = ym2651y_remove, + .id_table = ym2651y_id, + .address_list = normal_i2c, +}; + +static int ym2651y_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int ym2651y_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +static int ym2651y_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; + +abort: + return result; +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct ym2651y_data *ym2651y_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int i, status; + u8 command; + u8 fan_dir[5] = {0}; + struct reg_data_byte regs_byte[] = { {0x19, &data->capability}, + {0x7d, &data->over_temp}, + {0x81, &data->fan_fault}, + {0x98, &data->pmbus_revision}}; + struct reg_data_word regs_word[] = { {0x79, &data->status_word}, + {0x8b, &data->v_out}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x8d, &data->temp}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x3c, &(data->fan_duty_cycle[1])}, + {0x90, &data->fan_speed}, + {0xa0, &data->mfr_vin_min}, + {0xa1, &data->mfr_vin_max}, + {0xa2, &data->mfr_iin_max}, + {0xa3, &data->mfr_pin_max}, + {0xa4, &data->mfr_vout_min}, + {0xa5, &data->mfr_vout_max}, + {0xa6, &data->mfr_iout_max}, + {0xa7, &data->mfr_pout_max}}; + + dev_dbg(&client->dev, "Starting ym2651 update\n"); + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = ym2651y_read_byte(client, regs_byte[i].reg); + + if (status < 0) + { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + } + else { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = ym2651y_read_word(client, regs_word[i].reg); + + if (status < 0) + { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + } + else { + *(regs_word[i].value) = status; + } + } + + /* Read fan_direction */ + command = 0xC3; + status = ym2651y_read_block(client, command, fan_dir, ARRAY_SIZE(fan_dir)-1); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + } + + strncpy(data->fan_dir, fan_dir+1, ARRAY_SIZE(data->fan_dir)-1); + data->fan_dir[ARRAY_SIZE(data->fan_dir)-1] = '\0'; + + /* Read mfr_id */ + command = 0x99; + status = ym2651y_read_block(client, command, data->mfr_id, + ARRAY_SIZE(data->mfr_id)-1); + data->mfr_id[ARRAY_SIZE(data->mfr_id)-1] = '\0'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + /* Read mfr_model */ + command = 0x9a; + status = ym2651y_read_block(client, command, data->mfr_model, + ARRAY_SIZE(data->mfr_model)-1); + data->mfr_model[ARRAY_SIZE(data->mfr_model)-1] = '\0'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + /* Read mfr_revsion */ + command = 0x9b; + status = ym2651y_read_block(client, command, data->mfr_revsion, + ARRAY_SIZE(data->mfr_revsion)-1); + data->mfr_revsion[ARRAY_SIZE(data->mfr_revsion)-1] = '\0'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(ym2651y_driver); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("3Y Power YM-2651Y driver"); +MODULE_LICENSE("GPL"); + + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/service/as7716-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/service/as7716-platform-monitor.service new file mode 100755 index 000000000000..b1428d7844f8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/service/as7716-platform-monitor.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS7716-32X Platform Monitoring service +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/local/bin/accton_as7716_util.py install +ExecStart=/usr/local/bin/accton_as7716_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/setup.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/setup.py new file mode 100755 index 000000000000..7a3d784d326e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='as7716_32x', + version='1.0', + description='Module to initialize Accton AS7716-32X platforms', + + packages=['as7716_32x'], + package_dir={'as7716_32x': 'as7716-32x/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/README b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/README new file mode 100755 index 000000000000..44e03cab5f52 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/README @@ -0,0 +1,117 @@ +Copyright (C) 2016 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Contents of this package: + patch - files under patch/ is for kernel and ONIE installer + for the kernel: + config-accton-as5712_54x.patch + for kernel configuration. + driver-i2c-muxes-pca954x-always-deselect.patch + for i2c_mux deselects after transaction. + driver-patches-for-accton-as5712-fan-psu-cpld.patch + for as5712's fan/psu/cpld/led/sfp drivers. + for ONIE: + onie_installer-accton-AS5712-54X.patch + for console port setting and copy util script o rootfs. + module - Contains source code of as5712 kernel driver modules. + +The late Sonic building scripts, pushed @Dec 5 2016, will automatically +create a docker container and run building process under it. +User is not necessary to handle docker environment creation. + +1. Download sonic-buildimage environment. + - Run "git clone https://github.com/Azure/sonic-buildimage". + - cd to sonic-buildimage and run "git submodule update --init --recursive". +2. Build kernel + - cd ./src/sonic-linux-kernel + - Copy patches and series from patch/kernel of this release to + sonic-linux-kernel/patch. + - Build kernel by "make". + - The built kernel package, linux-image-3.16.0-5-amd64_3.16.51-3+deb8u1_amd64.deb + , is generated. +3. Build installer + - Change directory back to sonic-buildimage/. + - Get onie_installer-accton-AS5712-54X.patch" from patch/installer. + - Change setting for AS5712-54X by patching build_image.sh. + "patch -p1 < onie_installer-accton-AS5712-54X.patch" + !!NOTICE, patching onie_installer-accton-AS5712-54X.patch comments out the + "git status" checking at build_image.sh. + - The account and password of installed OS can be given at rules/config. + The default user and password are "admin" & "YourPaSsWoRd" respectively. + - Run "make configure PLATFORM=broadcom" + - Copy the built kernel debian package to target/debs/. + The file is linux-image-3.16.0-5-amd64_*_amd64.deb under directory + src/sonic-linux-kernel/. + - Run "make target/sonic-generic.bin" + - Get the installer, target/sonic-generic.bin, to target machine and install. + +All Linux kernel code is licensed under the GPLv1. All other code is +licensed under the GPLv3. Please see the LICENSE file for copies of +both licenses. + +The code for integacting with Accton AS5712-54X has 2 parts, +kernel drivers and operational script. +The kernel drivers of peripherals are under module/ directory. +1. These drivers are patched into kernel by + driver-patches-for-accton-as5712-fan-psu-cpld.patch + Or you can build the driver under module/ by setting environment variable, + KERNEL_SRC, to proper linux built directory and run make. + It may be sonic-linux-kernel/linux-3.*/debian/build/build_amd64_none_amd64/. +2. A operational script, accton_as5712_util.py, for device initializatian and + peripheral accessing should be installed at /usr/bin. + This script is generated by onie_installer-accton-AS5712-54X.patch. + It's done by patching onie_installer-accton-AS5712-54X.patch at build-image. + Run "accton_as5712_util.py install" to install drivers. + +To initialize the system, run "accton_as5712_util.py install". +To clean up the drivers & devices, run "accton_as5712_util.py clean". +To dump information of sensors, run "accton_as5712_util.py show". +To dump SFP EEPROM, run "accton_as5712_util.py sff". +To set fan speed, run "accton_as5712_util.py set fan". +To enable/disable SFP emission, run "accton_as5712_util.py set sfp". +To set system LEDs' color, run "accton_as5712_util.py set led" +For more information, run "accton_as5712_util.py --help". + +==================================================================== +Besides applying accton_as5712_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +System LED: + There are 5 system LEDs at the lower-left corner of front panel. + They are loc, diag, fan, ps1, and ps2. + The sysfs interface color mappings are as follows: + Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + But not all colors are available for each LED. + +Fan Control: + There are 10 fans inside 5 fan modules. + All fans share 1 duty setting, ranged from 0~100. + +Thermal sensers: + 3 temperature sensors are controlled by the lm75 kernel modules. + +PSUs: + There 2 power supplies slot at the left/right side of the back. + Once if a PSU is not plugged, the status of it is shown failed. + +There are 48 SFP+ and 6 QSFP modules are equipped. +Before operating on PSU and QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py new file mode 100755 index 000000000000..63f26d5d2ef6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py @@ -0,0 +1,207 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# ------------------------------------------------------------------ + +try: + import os + import sys, getopt + import subprocess + import click + import imp + import logging + import logging.config + import types + import time # this is only being used as part of the example + import traceback + from tabulate import tabulate + from as7716_32x.fanutil import FanUtil + from as7716_32x.thermalutil import ThermalUtil +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = 'accton_as7716_monitor' + +global log_file +global log_level + + # For AC power Front to Back : + # If any fan fail, please fan speed register to 15 + # The max value of Fan speed register is 9 + # [LM75(48) + LM75(49) + LM75(4A)] > 174 => set Fan speed value from 4 to 5 + # [LM75(48) + LM75(49) + LM75(4A)] > 182 => set Fan speed value from 5 to 7 + # [LM75(48) + LM75(49) + LM75(4A)] > 190 => set Fan speed value from 7 to 9 + # + # [LM75(48) + LM75(49) + LM75(4A)] < 170 => set Fan speed value from 5 to 4 + # [LM75(48) + LM75(49) + LM75(4A)] < 178 => set Fan speed value from 7 to 5 + # [LM75(48) + LM75(49) + LM75(4A)] < 186 => set Fan speed value from 9 to 7 + # + # + # For AC power Back to Front : + # If any fan fail, please fan speed register to 15 + # The max value of Fan speed register is 10 + # [LM75(48) + LM75(49) + LM75(4A)] > 140 => set Fan speed value from 4 to 5 + # [LM75(48) + LM75(49) + LM75(4A)] > 150 => set Fan speed value from 5 to 7 + # [LM75(48) + LM75(49) + LM75(4A)] > 160 => set Fan speed value from 7 to 10 + # + # [LM75(48) + LM75(49) + LM75(4A)] < 135 => set Fan speed value from 5 to 4 + # [LM75(48) + LM75(49) + LM75(4A)] < 145 => set Fan speed value from 7 to 5 + # [LM75(48) + LM75(49) + LM75(4A)] < 155 => set Fan speed value from 10 to 7 + # + + + # 2.If no matched fan speed is found from the policy, + # use FAN_DUTY_CYCLE_MIN as default speed + # Get current temperature + # 4.Decision 3: Decide new fan speed depend on fan direction/current fan speed/temperature + + + + +# Make a class we can use to capture stdout and sterr in the log +class accton_as7716_monitor(object): + # static temp var + _ori_temp = 0 + _new_perc = 0 + _ori_perc = 0 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_fans(self): + + fan_policy_f2b = { + 0: [32, 0, 174000], + 1: [38, 170000, 182000], + 2: [50, 178000, 190000], + 3: [63, 186000, 0], + } + fan_policy_b2f = { + 0: [32, 0, 140000], + 1: [38, 135000, 150000], + 2: [50, 145000, 160000], + 3: [69, 15500, 0], + } + + thermal = ThermalUtil() + fan = FanUtil() + get_temp = thermal.get_thermal_temp() + + cur_duty_cycle = fan.get_fan_duty_cycle() + + for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): + fan_status = fan.get_fan_status(x) + if fan_status is None: + logging.debug('INFO. SET new_perc to %d (FAN stauts is None. fan_num:%d)', 100, x) + return False + if fan_status is False: + logging.debug('INFO. SET new_perc to %d (FAN fault. fan_num:%d)', 100, x) + fan.set_fan_duty_cycle(45) + return True + logging.debug('INFO. fan_status is True (fan_num:%d)', x) + + if fan_status is not None and fan_status is not False: + fan_dir=fan.get_fan_dir(1) + for x in range(0, 4): + if cur_duty_cycle == fan_policy_f2b[x][0]: + break + + if fan_dir == 1: + if x == 4 : + fan.set_fan_duty_cycle(fan_policy_f2b[0][0]) + new_duty_cycle=cur_duty_cycle + # if temp > up_levle, else if temp < down_level + if get_temp > fan_policy_f2b[x][2] and x != 3 : + new_duty_cycle= fan_policy_f2b[x+1][0] + logging.debug('INFO. THERMAL temp UP, temp %d > %d , new_duty_cycle=%d', get_temp, fan_policy_f2b[x][2], new_duty_cycle) + elif get_temp < fan_policy_f2b[x][1] : + new_duty_cycle= fan_policy_f2b[x-1][0] + logging.debug('INFO. THERMAL temp down, temp %d < %d , new_duty_cycle=%d', get_temp, fan_policy_f2b[x][1], new_duty_cycle) + if new_duty_cycle == cur_duty_cycle : + return True + else: + if x == 4 : + fan.set_fan_duty_cycle(fan_policy_b2f[0][0]) + new_duty_cycle=cur_duty_cycle + # if temp > up_levle, else if temp < down_level + if get_temp > fan_policy_b2f[x][1] and x != 3 : + new_duty_cycle= fan_policy_b2f[x+1][0] + logging.debug('INFO. THERMAL temp UP, temp %d > %d , new_duty_cycle=%d', get_temp, fan_policy_b2f[x][2], new_duty_cycle) + elif get_temp < fan_policy_b2f[x][0] and x != 0 : + new_duty_cycle= fan_policy_b2f[x-1][0] + logging.debug('INFO. THERMAL temp down, temp %d < %d , new_duty_cycle=%d', get_temp, fan_policy_b2f[x][1], new_duty_cycle) + if new_duty_cycle == cur_duty_cycle : + return True + + fan.set_fan_duty_cycle(new_duty_cycle) + + return True + + + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['lfile=']) + except getopt.GetoptError: + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + monitor = accton_as7716_monitor(log_file, log_level) + + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(1) + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py new file mode 100755 index 000000000000..cd35b50d200e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py @@ -0,0 +1,595 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +PROJECT_NAME = 'as7716_32x' +version = '0.0.1' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan1':1, 'fan2':1,'fan3':1,'fan4':1,'fan5':1,'thermal':3, 'psu':2, 'sfp':54} + + +led_prefix ='/sys/devices/platform/as7716_32x_led/leds/accton_'+PROJECT_NAME+'_led::' +fan_prefix ='/sys/devices/platform/as7716_32x_' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2'], + 'fan1': ['fan'], + 'fan2': ['fan'], + 'fan3': ['fan'], + 'fan4': ['fan'], + 'fan5': ['fan'], + 'fan5': ['fan'], + } +hwmon_nodes = {'led': ['brightness'] , + 'fan1': ['fan_duty_cycle_percentage', 'fan1_fault', 'fan1_speed_rpm', 'fan1_direction', 'fanr1_fault', 'fanr1_speed_rpm'], + 'fan2': ['fan_duty_cycle_percentage','fan2_fault', 'fan2_speed_rpm', 'fan2_direction', 'fanr2_fault', 'fanr2_speed_rpm'], + 'fan3': ['fan_duty_cycle_percentage','fan3_fault', 'fan3_speed_rpm', 'fan3_direction', 'fanr3_fault', 'fanr3_speed_rpm'], + 'fan4': ['fan4_duty_cycle_percentage','fan4_fault', 'fan4_speed_rpm', 'fan4_direction', 'fanr4_fault', 'fanr4_speed_rpm'], + 'fan5': ['fan_duty_cycle_percentage','fan5_fault', 'fan5_speed_rpm', 'fan5_direction', 'fanr5_fault', 'fanr5_speed_rpm'], + } +hwmon_prefix ={'led': led_prefix, + 'fan1': fan_prefix, + 'fan2': fan_prefix, + 'fan3': fan_prefix, + 'fan4': fan_prefix, + 'fan5': fan_prefix, + } + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'thermal': ['10-0048','10-0049', '10-004a'] , + 'psu': ['17-0050','18-0053'], + 'sfp': ['-0050']} +i2c_nodes = { + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['sfp_is_present ', 'sfp_tx_disable']} + +sfp_map = [29, 30, 31, 32, 34, 33, 36, 35, + 25, 26, 27, 28, 37, 38, 39, 40, + 41, 42, 43, 44, 53, 54, 55, 56, + 45, 46, 47, 48, 49, 50, 51, 52] + +mknod =[ +'echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo as7716_32x_fan 0x66 > /sys/bus/i2c/devices/i2c-9/new_device', + +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-10/new_device', + +'echo as7716_32x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo accton_i2c_cpld 0x62 > /sys/bus/i2c/devices/i2c-12/new_device', +'echo accton_i2c_cpld 0x64 > /sys/bus/i2c/devices/i2c-13/new_device', + +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-2/new_device', + +# PSU-1 +'echo as7716_32x_psu1 0x53 > /sys/bus/i2c/devices/i2c-18/new_device', +'echo ym2651 0x5b > /sys/bus/i2c/devices/i2c-18/new_device', + +# PSU-2 +'echo as7716_32x_psu2 0x50> /sys/bus/i2c/devices/i2c-17/new_device', +'echo ym2651 0x58 > /sys/bus/i2c/devices/i2c-17/new_device', + + + +#EERPOM +'echo 24c02 0x56 > /sys/bus/i2c/devices/i2c-1/new_device', +] + +mknod2 =[ +'echo as7716_32x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo accton_i2c_cpld 0x61 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo accton_i2c_cpld 0x62 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device', + +# PSU-1 +'echo as7716_32x_psu1 0x38 > /sys/bus/i2c/devices/i2c-57/new_device', +'echo cpr_4011_4mxx 0x3c > /sys/bus/i2c/devices/i2c-57/new_device', +'echo as7716_32x_psu1 0x50 > /sys/bus/i2c/devices/i2c-57/new_device', +'echo ym2401 0x58 > /sys/bus/i2c/devices/i2c-57/new_device', + +# PSU-2 +'echo as7716_32x_psu2 0x3b > /sys/bus/i2c/devices/i2c-58/new_device', +'echo cpr_4011_4mxx 0x3f > /sys/bus/i2c/devices/i2c-58/new_device', +'echo as7716_32x_psu2 0x53 > /sys/bus/i2c/devices/i2c-58/new_device', +'echo ym2401 0x5b > /sys/bus/i2c/devices/i2c-58/new_device', + +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-61/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-62/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-63/new_device', + +#EERPOM +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', +] + +FORCE = 0 +logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +logging.basicConfig(level=logging.INFO) + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ACCTON DBG]: "+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status = 1 + output = "" + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log ("cmd:" + cmd) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_inserted(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + +#'modprobe cpr_4011_4mxx', + +kos = [ +'depmod -ae', +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x', +'modprobe accton_i2c_cpld', +'modprobe cpr_4011_4mxx', +'modprobe ym2651y', +'modprobe accton_as7716_32x_cpld1', +'modprobe accton_as7716_32x_fan', +'modprobe accton_as7716_32x_leds', +'modprobe accton_as7716_32x_psu'] + +def driver_install(): + global FORCE + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + + + +def i2c_order_check(): + # i2c bus 0 and 1 might be installed in different order. + # Here check if 0x76 is exist @ i2c-0 + tmp = "echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device" + status, output = log_os_system(tmp, 0) + if not device_exist(): + order = 1 + else: + order = 0 + tmp = "echo 0x70 > /sys/bus/i2c/devices/i2c-1/delete_device" + status, output = log_os_system(tmp, 0) + return order + +def device_install(): + global FORCE + + for i in range(0,len(mknod)): + #for pca932x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(2) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0,len(sfp_map)): + status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + status, output =log_os_system("echo port"+str(i)+" > /sys/bus/i2c/devices/"+str(sfp_map[i])+"-0050/port_name", 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/0-0070", 0) + if status==0: + I2C_ORDER=1 + else: + I2C_ORDER=0 + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + if I2C_ORDER==0: + nodelist = mknod + else: + nodelist = mknod2 + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_inserted() == False: + return False + if not device_exist(): + print "not device_exist()" + return False + return True + +def do_install(): + if driver_inserted() == False: + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_inserted()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'sfp_eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan1'] ['fan11'][0] + node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0077", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/fanutil.py new file mode 100755 index 000000000000..e001e94092c7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/fanutil.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# ------------------------------------------------------------------ + +try: + import time + import logging + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class FanUtil(object): + """Platform-specific FanUtil class""" + + FAN_NUM_ON_MAIN_BROAD = 6 + FAN_NUM_1_IDX = 1 + FAN_NUM_2_IDX = 2 + FAN_NUM_3_IDX = 3 + FAN_NUM_4_IDX = 4 + FAN_NUM_5_IDX = 5 + FAN_NUM_6_IDX = 6 + + FAN_NODE_NUM_OF_MAP = 2 + FAN_NODE_FAULT_IDX_OF_MAP = 1 + #FAN_NODE_SPEED_IDX_OF_MAP = 2 + FAN_NODE_DIR_IDX_OF_MAP = 2 + #FAN_NODE_DUTY_IDX_OF_MAP = 4 + #FANR_NODE_FAULT_IDX_OF_MAP = 5 + + #BASE_VAL_PATH = '/sys/devices/platform/as5712_54x_fan/{0}' + BASE_VAL_PATH = '/sys/bus/i2c/devices/9-0066/{0}' + FAN_DUTY_PATH = '/sys/bus/i2c/devices/9-0066/fan_duty_cycle_percentage' + + #logfile = '' + #loglevel = logging.INFO + + """ Dictionary where + key1 = fan id index (integer) starting from 1 + key2 = fan node index (interger) starting from 1 + value = path to fan device file (string) """ + _fan_to_device_path_mapping = {} + +#fan1_direction +#fan1_fault +#fan1_present + + #(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage', + _fan_to_device_node_mapping = { + (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault', + (FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction', + + (FAN_NUM_2_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan2_fault', + (FAN_NUM_2_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan2_direction', + + (FAN_NUM_3_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan3_fault', + (FAN_NUM_3_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan3_direction', + + (FAN_NUM_4_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan4_fault', + (FAN_NUM_4_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan4_direction', + + (FAN_NUM_5_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan5_fault', + (FAN_NUM_5_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan5_direction', + + (FAN_NUM_6_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan6_fault', + (FAN_NUM_6_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan6_direction', + } + + def _get_fan_to_device_node(self, fan_num, node_num): + return self._fan_to_device_node_mapping[(fan_num, node_num)] + + def _get_fan_node_val(self, fan_num, node_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + + try: + val_file = open(device_path, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + #print "fan_num=%d" %fan_num + #print "node_num=%d" %node_num + #print "device_path=%s" %device_path + #print "content=%s" %content + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + def _set_fan_node_val(self, fan_num, node_num, val): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + content = str(val) + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'w') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + val_file.write(content) + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return True + + def __init__(self): + fan_path = self.BASE_VAL_PATH + + for fan_num in range(self.FAN_NUM_1_IDX, self.FAN_NUM_ON_MAIN_BROAD+1): + for node_num in range(self.FAN_NODE_FAULT_IDX_OF_MAP, self.FAN_NODE_NUM_OF_MAP+1): + self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path.format( + self._fan_to_device_node_mapping[(fan_num, node_num)]) + #self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path + self._fan_to_device_node_mapping[(fan_num, node_num)]) + #print "fan_num=%d" %fan_num + #print "node_num=%d" %node_num + #print "self._fan_to_device_path_mapping[(fan_num, node_num)]=%s" %self._fan_to_device_path_mapping[(fan_num, node_num)] + + def get_num_fans(self): + return self.FAN_NUM_ON_MAIN_BROAD + + def get_idx_fan_start(self): + return self.FAN_NUM_1_IDX + + def get_num_nodes(self): + return self.FAN_NODE_NUM_OF_MAP + + def get_idx_node_start(self): + return self.FAN_NODE_FAULT_IDX_OF_MAP + + def get_size_node_map(self): + return len(self._fan_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._fan_to_device_path_mapping) + + def get_fan_to_device_path(self, fan_num, node_num): + return self._fan_to_device_path_mapping[(fan_num, node_num)] + + def get_fan_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP) + + #def get_fan_speed(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP) + + def get_fan_dir(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP) + + def get_fan_duty_cycle(self): + #duty_path = self.FAN_DUTY_PATH + try: + val_file = open(self.FAN_DUTY_PATH) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + return int(content) + #self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP) +#static u32 reg_val_to_duty_cycle(u8 reg_val) +#{ +# reg_val &= FAN_DUTY_CYCLE_REG_MASK; +# return ((u32)(reg_val+1) * 625 + 75)/ 100; +#} +# + def set_fan_duty_cycle(self, val): + + try: + fan_file = open(self.FAN_DUTY_PATH, 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + #val = ((val + 1 ) * 625 +75 ) / 100 + fan_file.write(str(val)) + fan_file.close() + return True + + #def get_fanr_fault(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP) + + def get_fanr_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP) + + def get_fan_status(self, fan_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num, %d', fan_num) + print "fan %d return none" %fan_num + return None + + if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0: + logging.debug('GET. FAN fault. fan_num, %d', fan_num) + return False + + #if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0: + # logging.debug('GET. FANR fault. fan_num, %d', fan_num) + # return False + + return True + +#def main(): +# fan = FanUtil() +# +# print 'get_size_node_map : %d' % fan.get_size_node_map() +# print 'get_size_path_map : %d' % fan.get_size_path_map() +# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): +# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1): +# print fan.get_fan_to_device_path(x, y) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/thermalutil.py new file mode 100755 index 000000000000..d3feda8faad9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/thermalutil.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018:Jostar modify for as7716_32x +# ------------------------------------------------------------------ + +try: + import time + import logging + import glob + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class ThermalUtil(object): + """Platform-specific ThermalUtil class""" + + THERMAL_NUM_ON_MAIN_BROAD = 3 + THERMAL_NUM_1_IDX = 1 # 1_ON_MAIN_BROAD + THERMAL_NUM_2_IDX = 2 # 2_ON_MAIN_BROAD + THERMAL_NUM_3_IDX = 3 # 3_ON_MAIN_BROAD + + BASE_VAL_PATH = '/sys/bus/i2c/devices/{0}-00{1}/hwmon/hwmon*/temp1_input' + + """ Dictionary where + key1 = thermal id index (integer) starting from 1 + value = path to fan device file (string) """ + _thermal_to_device_path_mapping = {} + + _thermal_to_device_node_mapping = { + THERMAL_NUM_1_IDX: ['10', '48'], + THERMAL_NUM_2_IDX: ['10', '49'], + THERMAL_NUM_3_IDX: ['10', '4a'], + } + + def __init__(self): + thermal_path = self.BASE_VAL_PATH + + for x in range(self.THERMAL_NUM_1_IDX, self.THERMAL_NUM_ON_MAIN_BROAD+1): + self._thermal_to_device_path_mapping[x] = thermal_path.format( + self._thermal_to_device_node_mapping[x][0], + self._thermal_to_device_node_mapping[x][1]) + #print "self._thermal_to_device_path_mapping[x]=%s" %self._thermal_to_device_path_mapping[x] + + def _get_thermal_node_val(self, thermal_num): + if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. thermal_num, %d', thermal_num) + return None + + device_path = self.get_thermal_to_device_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + + def get_num_thermals(self): + return self.THERMAL_NUM_ON_MAIN_BROAD + + def get_idx_thermal_start(self): + return self.THERMAL_NUM_1_IDX + + def get_size_node_map(self): + return len(self._thermal_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._thermal_to_device_path_mapping) + + def get_thermal_to_device_path(self, thermal_num): + return self._thermal_to_device_path_mapping[thermal_num] + + def get_thermal_1_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + + def get_thermal_2_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) + def get_thermal_temp(self): + return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX)) + +#def main(): +# thermal = ThermalUtil() +# +# print 'get_size_node_map : %d' % thermal.get_size_node_map() +# print 'get_size_path_map : %d' % thermal.get_size_path_map() +# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): +# print thermal.get_thermal_to_device_path(x) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/Makefile new file mode 100755 index 000000000000..3dfb021a7aaf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/Makefile @@ -0,0 +1,17 @@ +ifneq ($(KERNELRELEASE),) +obj-m:= accton_as7716_32xb_cpld1.o accton_as7716_32xb_fan.o \ + accton_as7716_32xb_leds.o accton_as7716_32xb_psu.o \ + accton_as7716_32xb_thermal.o accton_as7716_32xb_oom.o accton_as7716_32xb_pmbus.o\ + accton_as7716_32xb_sys.o accton_i2c_cpld.o +else +ifeq (,$(KERNEL_SRC)) +$(error KERNEL_SRC is not defined) +else +KERNELDIR:=$(KERNEL_SRC) +endif +PWD:=$(shell pwd) +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + rm -rf *.o *.mod.o *.mod.o *.ko .*cmd .tmp_versions Module.markers Module.symvers modules.order +endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_cpld1.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_cpld1.c new file mode 100755 index 000000000000..d2db4fb1f484 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_cpld1.c @@ -0,0 +1,1021 @@ +/* + * A hwmon driver for the as7716_32xbb_cpld + * + * Copyright (C) 2013 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ +#define STRING_TO_DEC_VALUE 10 + +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +static int as7716_32xb_cpld_read_internal(struct i2c_client *client, u8 reg); +static int as7716_32xb_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value); + +static ssize_t sfp_value_show(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t sfp_value_store(struct device *dev, struct device_attribute *da, + char *buf, size_t size); + + +#define PORT_NUM_MAX 32 + +struct as7716_32xb_cpld_data { + struct device *hwmon_dev; + struct mutex update_lock; + unsigned int present[PORT_NUM_MAX]; + unsigned int reset[PORT_NUM_MAX]; +}; +enum port_id { + PORT1_ID, + PORT2_ID, + PORT3_ID, + PORT4_ID, + PORT5_ID, + PORT6_ID, + PORT7_ID, + PORT8_ID, + PORT9_ID, + PORT10_ID, + PORT11_ID, + PORT12_ID, + PORT13_ID, + PORT14_ID, + PORT15_ID, + PORT16_ID, + PORT17_ID, + PORT18_ID, + PORT19_ID, + PORT20_ID, + PORT21_ID, + PORT22_ID, + PORT23_ID, + PORT24_ID, + PORT25_ID, + PORT26_ID, + PORT27_ID, + PORT28_ID, + PORT29_ID, + PORT30_ID, + PORT31_ID, + PORT32_ID +}; + +/* Addresses scanned for as7716_32xbb_cpld + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index + +enum as7716_32xb_cpld_sysfs_attributes { + CPLD_VERSION, + ACCESS, + MODULE_PRESENT_ALL, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + TRANSCEIVER_RESET_ATTR_ID(1), + TRANSCEIVER_RESET_ATTR_ID(2), + TRANSCEIVER_RESET_ATTR_ID(3), + TRANSCEIVER_RESET_ATTR_ID(4), + TRANSCEIVER_RESET_ATTR_ID(5), + TRANSCEIVER_RESET_ATTR_ID(6), + TRANSCEIVER_RESET_ATTR_ID(7), + TRANSCEIVER_RESET_ATTR_ID(8), + TRANSCEIVER_RESET_ATTR_ID(9), + TRANSCEIVER_RESET_ATTR_ID(10), + TRANSCEIVER_RESET_ATTR_ID(11), + TRANSCEIVER_RESET_ATTR_ID(12), + TRANSCEIVER_RESET_ATTR_ID(13), + TRANSCEIVER_RESET_ATTR_ID(14), + TRANSCEIVER_RESET_ATTR_ID(15), + TRANSCEIVER_RESET_ATTR_ID(16), + TRANSCEIVER_RESET_ATTR_ID(17), + TRANSCEIVER_RESET_ATTR_ID(18), + TRANSCEIVER_RESET_ATTR_ID(19), + TRANSCEIVER_RESET_ATTR_ID(20), + TRANSCEIVER_RESET_ATTR_ID(21), + TRANSCEIVER_RESET_ATTR_ID(22), + TRANSCEIVER_RESET_ATTR_ID(23), + TRANSCEIVER_RESET_ATTR_ID(24), + TRANSCEIVER_RESET_ATTR_ID(25), + TRANSCEIVER_RESET_ATTR_ID(26), + TRANSCEIVER_RESET_ATTR_ID(27), + TRANSCEIVER_RESET_ATTR_ID(28), + TRANSCEIVER_RESET_ATTR_ID(29), + TRANSCEIVER_RESET_ATTR_ID(30), + TRANSCEIVER_RESET_ATTR_ID(31), + TRANSCEIVER_RESET_ATTR_ID(32), +}; + +/* sysfs attributes for hwmon + */ + +/* transceiver attributes */ +/*present*/ +#define DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IWUSR|S_IRUGO, sfp_value_show, sfp_value_store, MODULE_PRESENT_##index) +#define DECLARE_TRANSCEIVER_ATTR(index) &sensor_dev_attr_module_present_##index.dev_attr.attr + +/*reset*/ +//#define DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(index) \ +// static SENSOR_DEVICE_ATTR(module_reset_##index, S_IWUSR | S_IRUGO, get_mode_reset, set_mode_reset, MODULE_RESET_##index) +//#define DECLARE_TRANSCEIVER_RESET_ATTR(index) &sensor_dev_attr_module_reset_##index.dev_attr.attr +#define DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IWUSR | S_IRUGO, sfp_value_show, sfp_value_store, MODULE_RESET_##index) +#define DECLARE_TRANSCEIVER_RESET_ATTR(index) &sensor_dev_attr_module_reset_##index.dev_attr.attr + + + + +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); +/* transceiver attributes */ +static SENSOR_DEVICE_ATTR(module_present_all, S_IRUGO, show_present_all, NULL, MODULE_PRESENT_ALL); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(32); + +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(1); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(2); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(3); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(4); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(5); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(6); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(7); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(8); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(9); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(10); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(11); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(12); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(13); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(14); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(15); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(16); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(17); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(18); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(19); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(20); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(21); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(22); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(23); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(24); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(25); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(26); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(27); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(28); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(29); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(30); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(31); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(32); + + +static struct attribute *as7716_32xb_cpld_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + DECLARE_TRANSCEIVER_ATTR(1), + DECLARE_TRANSCEIVER_ATTR(2), + DECLARE_TRANSCEIVER_ATTR(3), + DECLARE_TRANSCEIVER_ATTR(4), + DECLARE_TRANSCEIVER_ATTR(5), + DECLARE_TRANSCEIVER_ATTR(6), + DECLARE_TRANSCEIVER_ATTR(7), + DECLARE_TRANSCEIVER_ATTR(8), + DECLARE_TRANSCEIVER_ATTR(9), + DECLARE_TRANSCEIVER_ATTR(10), + DECLARE_TRANSCEIVER_ATTR(11), + DECLARE_TRANSCEIVER_ATTR(12), + DECLARE_TRANSCEIVER_ATTR(13), + DECLARE_TRANSCEIVER_ATTR(14), + DECLARE_TRANSCEIVER_ATTR(15), + DECLARE_TRANSCEIVER_ATTR(16), + DECLARE_TRANSCEIVER_ATTR(17), + DECLARE_TRANSCEIVER_ATTR(18), + DECLARE_TRANSCEIVER_ATTR(19), + DECLARE_TRANSCEIVER_ATTR(20), + DECLARE_TRANSCEIVER_ATTR(21), + DECLARE_TRANSCEIVER_ATTR(22), + DECLARE_TRANSCEIVER_ATTR(23), + DECLARE_TRANSCEIVER_ATTR(24), + DECLARE_TRANSCEIVER_ATTR(25), + DECLARE_TRANSCEIVER_ATTR(26), + DECLARE_TRANSCEIVER_ATTR(27), + DECLARE_TRANSCEIVER_ATTR(28), + DECLARE_TRANSCEIVER_ATTR(29), + DECLARE_TRANSCEIVER_ATTR(30), + DECLARE_TRANSCEIVER_ATTR(31), + DECLARE_TRANSCEIVER_ATTR(32), + DECLARE_TRANSCEIVER_RESET_ATTR(1), + DECLARE_TRANSCEIVER_RESET_ATTR(2), + DECLARE_TRANSCEIVER_RESET_ATTR(3), + DECLARE_TRANSCEIVER_RESET_ATTR(4), + DECLARE_TRANSCEIVER_RESET_ATTR(5), + DECLARE_TRANSCEIVER_RESET_ATTR(6), + DECLARE_TRANSCEIVER_RESET_ATTR(7), + DECLARE_TRANSCEIVER_RESET_ATTR(8), + DECLARE_TRANSCEIVER_RESET_ATTR(9), + DECLARE_TRANSCEIVER_RESET_ATTR(10), + DECLARE_TRANSCEIVER_RESET_ATTR(11), + DECLARE_TRANSCEIVER_RESET_ATTR(12), + DECLARE_TRANSCEIVER_RESET_ATTR(13), + DECLARE_TRANSCEIVER_RESET_ATTR(14), + DECLARE_TRANSCEIVER_RESET_ATTR(15), + DECLARE_TRANSCEIVER_RESET_ATTR(16), + DECLARE_TRANSCEIVER_RESET_ATTR(17), + DECLARE_TRANSCEIVER_RESET_ATTR(18), + DECLARE_TRANSCEIVER_RESET_ATTR(19), + DECLARE_TRANSCEIVER_RESET_ATTR(20), + DECLARE_TRANSCEIVER_RESET_ATTR(21), + DECLARE_TRANSCEIVER_RESET_ATTR(22), + DECLARE_TRANSCEIVER_RESET_ATTR(23), + DECLARE_TRANSCEIVER_RESET_ATTR(24), + DECLARE_TRANSCEIVER_RESET_ATTR(25), + DECLARE_TRANSCEIVER_RESET_ATTR(26), + DECLARE_TRANSCEIVER_RESET_ATTR(27), + DECLARE_TRANSCEIVER_RESET_ATTR(28), + DECLARE_TRANSCEIVER_RESET_ATTR(29), + DECLARE_TRANSCEIVER_RESET_ATTR(30), + DECLARE_TRANSCEIVER_RESET_ATTR(31), + DECLARE_TRANSCEIVER_RESET_ATTR(32), + NULL +}; + +static const struct attribute_group as7716_32xb_cpld_group = { + .attrs = as7716_32xb_cpld_attributes, +}; + +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i, status; + u8 values[4] = {0}; + u8 regs[] = {0x30, 0x31, 0x32, 0x33}; + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = as7716_32xb_cpld_read_internal(client, regs[i]); + + if (status < 0) { + goto exit; + } + + values[i] = ~(u8)status; + } + + mutex_unlock(&data->update_lock); + + /* Return values 1 -> 32 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3]); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static int sfp_array_index_get(int attr_idx) +{ + switch(attr_idx) + { + case TRANSCEIVER_PRESENT_ATTR_ID(1): + case TRANSCEIVER_RESET_ATTR_ID(1): + return PORT1_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(2): + case TRANSCEIVER_RESET_ATTR_ID(2): + return PORT2_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(3): + case TRANSCEIVER_RESET_ATTR_ID(3): + return PORT3_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(4): + case TRANSCEIVER_RESET_ATTR_ID(4): + return PORT4_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(5): + case TRANSCEIVER_RESET_ATTR_ID(5): + return PORT5_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(6): + case TRANSCEIVER_RESET_ATTR_ID(6): + return PORT6_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(7): + case TRANSCEIVER_RESET_ATTR_ID(7): + return PORT7_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(8): + case TRANSCEIVER_RESET_ATTR_ID(8): + return PORT8_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(9): + case TRANSCEIVER_RESET_ATTR_ID(9): + return PORT9_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(10): + case TRANSCEIVER_RESET_ATTR_ID(10): + return PORT10_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(11): + case TRANSCEIVER_RESET_ATTR_ID(11): + return PORT11_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(12): + case TRANSCEIVER_RESET_ATTR_ID(12): + return PORT12_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(13): + case TRANSCEIVER_RESET_ATTR_ID(13): + return PORT13_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(14): + case TRANSCEIVER_RESET_ATTR_ID(14): + return PORT14_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(15): + case TRANSCEIVER_RESET_ATTR_ID(15): + return PORT15_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(16): + case TRANSCEIVER_RESET_ATTR_ID(16): + return PORT16_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(17): + case TRANSCEIVER_RESET_ATTR_ID(17): + return PORT17_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(18): + case TRANSCEIVER_RESET_ATTR_ID(18): + return PORT18_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(19): + case TRANSCEIVER_RESET_ATTR_ID(19): + return PORT19_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(20): + case TRANSCEIVER_RESET_ATTR_ID(20): + return PORT20_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(21): + case TRANSCEIVER_RESET_ATTR_ID(21): + return PORT21_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(22): + case TRANSCEIVER_RESET_ATTR_ID(22): + return PORT22_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(23): + case TRANSCEIVER_RESET_ATTR_ID(23): + return PORT23_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(24): + case TRANSCEIVER_RESET_ATTR_ID(24): + return PORT24_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(25): + case TRANSCEIVER_RESET_ATTR_ID(25): + return PORT25_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(26): + case TRANSCEIVER_RESET_ATTR_ID(26): + return PORT26_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(27): + case TRANSCEIVER_RESET_ATTR_ID(27): + return PORT27_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(28): + case TRANSCEIVER_RESET_ATTR_ID(28): + return PORT28_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(29): + case TRANSCEIVER_RESET_ATTR_ID(29): + return PORT29_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(30): + case TRANSCEIVER_RESET_ATTR_ID(30): + return PORT30_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(31): + case TRANSCEIVER_RESET_ATTR_ID(31): + return PORT31_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(32): + case TRANSCEIVER_RESET_ATTR_ID(32): + return PORT32_ID; + default : + return -1; + } +} + + +static ssize_t sfp_value_store(struct device *dev, struct device_attribute *da, + char *buf, size_t size) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); + int status = -EINVAL; + int index; + long keyin = 0; + + //printk("sfp_value_store\n"); + //printk("attr->index=%d\n", attr->index); + mutex_lock(&data->update_lock); + switch (attr->index) + { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + index=sfp_array_index_get(attr->index); + if(index < 0 || index > PORT_NUM_MAX -1) + break; + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if(keyin < 0 || keyin > 1) + break; + data->present[index]=keyin; + break; + case MODULE_RESET_1 ... MODULE_RESET_8: + case MODULE_RESET_9 ... MODULE_RESET_16: + case MODULE_RESET_17 ... MODULE_RESET_24: + case MODULE_RESET_25 ... MODULE_RESET_32: + index=sfp_array_index_get(attr->index); + if(index < 0 || index > PORT_NUM_MAX -1) + break; + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if(keyin < 0 || keyin > 1) + break; + data->reset[index]=keyin; + break; + default : + break; + } + mutex_unlock(&data->update_lock); + return size; +} +static ssize_t sfp_value_show(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); + ssize_t ret = 0; + int index; + int status = -EINVAL; + + //printk("sfp_value_show, attr->index=%d\n", attr->index); + //printk("TRANSCEIVER_PRESENT_ATTR_ID(1)=%d, TRANSCEIVER_RESET_ATTR_ID(1)=%d\n", TRANSCEIVER_PRESENT_ATTR_ID(1), TRANSCEIVER_RESET_ATTR_ID(1)); + mutex_lock(&data->update_lock); + switch (attr->index) + { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + index=sfp_array_index_get(attr->index); + if(index < 0 || index > PORT_NUM_MAX -1) + break; + status = sprintf(buf, "%u\n", data->present[index]); + break; + case MODULE_RESET_1 ... MODULE_RESET_8: + case MODULE_RESET_9 ... MODULE_RESET_16: + case MODULE_RESET_17 ... MODULE_RESET_24: + case MODULE_RESET_25 ... MODULE_RESET_32: + index=sfp_array_index_get(attr->index); + //printk("rst:attr->index=%d, index=%d\n",attr->index, index); + if(index < 0 || index > PORT_NUM_MAX -1) + break; + status = sprintf(buf, "%u\n", data->reset[index]); + break; + default : + break; + } + + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0; + + switch (attr->index) { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + reg = 0x30; + mask = 0x1 << (attr->index - MODULE_PRESENT_1); + break; + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + reg = 0x31; + mask = 0x1 << (attr->index - MODULE_PRESENT_9); + break; + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + reg = 0x32; + mask = 0x1 << (attr->index - MODULE_PRESENT_17); + break; + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + reg = 0x33; + mask = 0x1 << (attr->index - MODULE_PRESENT_25); + break; + default: + return 0; + } + + + mutex_lock(&data->update_lock); + status = as7716_32xb_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", !(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 reg = 0, mask = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + + switch (attr->index) { + case CPLD_VERSION: + reg = 0x1; + mask = 0xFF; + break; + default: + break; + } + + mutex_lock(&data->update_lock); + status = as7716_32xb_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%d\n", (status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = as7716_32xb_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static int as7716_32xb_cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static int as7716_32xb_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static void as7716_32xb_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void as7716_32xb_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int as7716_32xb_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct as7716_32xb_cpld_data *data = NULL; + + data = kzalloc(sizeof(struct as7716_32xb_cpld_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32xb_cpld_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + as7716_32xb_cpld_add_client(client); + + dev_info(&client->dev, "%s: cpld '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_cpld_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32xb_cpld_remove(struct i2c_client *client) +{ + struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_cpld_group); + kfree(data); + as7716_32xb_cpld_remove_client(client); + + return 0; +} + +int as7716_32xb_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as7716_32xb_cpld_read); + +int as7716_32xb_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as7716_32xb_cpld_write); + +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0; + + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = 0x04; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = 0x05; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = 0x06; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = 0x07; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + + + mutex_lock(&data->update_lock); + status = as7716_32xb_cpld_read_internal(client, reg); + + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\r\n", !(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); + long reset; + int status=0, val, error; + u8 reg = 0, mask = 0; + + + error = kstrtol(buf, 10, &reset); + if (error) { + return error; + } + //printk("set_mode_reset:attr->index=%d\n",attr->index); + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = 0x04; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = 0x05; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = 0x06; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = 0x07; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + mutex_lock(&data->update_lock); + + status = as7716_32xb_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + //printk("set_mode_reset:reset=%d, reg=0x%x, mask=0x%x, ori_val=0x%x\n", reset, reg, mask, status); + /* Update lp_mode status */ + if (reset) + { + val = status&(~mask); + //printk("1:new val=0x%x\n", val); + } + else + { + val =status | (mask); + //printk("0:new val=0x%x\n", val); + } + + status = as7716_32xb_cpld_write_internal(client, reg, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + + + +static const struct i2c_device_id as7716_32xb_cpld_id[] = { + { "as7716_32xb_cpld1", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32xb_cpld_id); + +static struct i2c_driver as7716_32xb_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7716_32xb_cpld1", + }, + .probe = as7716_32xb_cpld_probe, + .remove = as7716_32xb_cpld_remove, + .id_table = as7716_32xb_cpld_id, + .address_list = normal_i2c, +}; + +static int __init as7716_32xb_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as7716_32xb_cpld_driver); +} + +static void __exit as7716_32xb_cpld_exit(void) +{ + i2c_del_driver(&as7716_32xb_cpld_driver); +} + +module_init(as7716_32xb_cpld_init); +module_exit(as7716_32xb_cpld_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7716_32xb_cpld driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_fan.c new file mode 100755 index 000000000000..5c1c3016c3a1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_fan.c @@ -0,0 +1,969 @@ +/* + * A hwmon driver for the Accton as7716 32x fan + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as7716_32xb_fan" + +#define NUM_THERMAL_SENSORS (3) /* Get sum of this number of sensors.*/ +#define THERMAL_SENSORS_DRIVER "lm75" +#define STRING_TO_DEC_VALUE 10 + +#define IN +#define OUT + +static struct as7716_32xb_fan_data *as7716_32xb_fan_update_device(struct device *dev); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); + + +static ssize_t fan_value_show(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t fan_value_store(struct device *dev, struct device_attribute *da, + char *buf, size_t size); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x0F, /* fan 1-6 present status */ + 0x10, /* fan 1-6 direction(0:B2F 1:F2B) */ + 0x11, /* fan PWM(for all fan) */ + 0x12, /* front fan 1 speed(rpm) */ + 0x13, /* front fan 2 speed(rpm) */ + 0x14, /* front fan 3 speed(rpm) */ + 0x15, /* front fan 4 speed(rpm) */ + 0x16, /* front fan 5 speed(rpm) */ + 0x17, /* front fan 6 speed(rpm) */ + 0x22, /* rear fan 1 speed(rpm) */ + 0x23, /* rear fan 2 speed(rpm) */ + 0x24, /* rear fan 3 speed(rpm) */ + 0x25, /* rear fan 4 speed(rpm) */ + 0x26, /* rear fan 5 speed(rpm) */ + 0x27, /* rear fan 6 speed(rpm) */ +}; + +#define FAN_NUM_MAX 6 +/* Each client has this additional data */ +struct as7716_32xb_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ + u8 enable; + u8 duty_cycle; + int system_temp; /*In unit of mini-Celsius*/ + int sensors_found; + unsigned int present[FAN_NUM_MAX]; + unsigned int front_speed_rpm[FAN_NUM_MAX]; + unsigned int rear_speed_rpm[FAN_NUM_MAX]; + unsigned int direction[FAN_NUM_MAX]; + unsigned int fault[FAN_NUM_MAX]; + unsigned int input[FAN_NUM_MAX]; +}; + +enum FAN_ID { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID, + FAN6_ID +}; + +enum sysfs_fan_attributes { + FAN_PRESENT_REG, + FAN_DIRECTION_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN6_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN6_REAR_SPEED_RPM, + FAN1_DIRECTION, + FAN2_DIRECTION, + FAN3_DIRECTION, + FAN4_DIRECTION, + FAN5_DIRECTION, + FAN6_DIRECTION, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN6_PRESENT, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, + FAN6_FAULT +}; + +/* Define attributes + */ +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO|S_IWUSR, fan_value_show, fan_value_store, FAN##index##_FAULT);\ + static SENSOR_DEVICE_ATTR(fan##index2##_fault, S_IRUGO|S_IWUSR, fan_value_show, fan_value_store, FAN##index##_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index, index2) &sensor_dev_attr_fan##index##_fault.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_fault.dev_attr.attr + +#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO|S_IWUSR, fan_value_show, fan_value_store, FAN##index##_DIRECTION) +#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr + + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_value_show, fan_value_store, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index, S_IWUSR | S_IRUGO, fan_value_show, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index##_enable, S_IWUSR | S_IRUGO, get_enable, set_enable, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan_duty_cycle_percentage.dev_attr.attr, \ + &sensor_dev_attr_pwm##index.dev_attr.attr, \ + &sensor_dev_attr_pwm##index##_enable.dev_attr.attr + +#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ + static SENSOR_DEVICE_ATTR(sys_temp, S_IWUSR|S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr + + + +#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_present, S_IWUSR|S_IRUGO, fan_value_show, fan_value_store, FAN##index##_PRESENT) +#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr + + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IWUSR|S_IRUGO, fan_value_show, fan_value_store, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IWUSR|S_IRUGO, fan_value_show, fan_value_store, FAN##index##_REAR_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IWUSR|S_IRUGO, fan_value_show, fan_value_store, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index2##_input, S_IWUSR|S_IRUGO, fan_value_show, fan_value_store, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index, index2) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_input.dev_attr.attr + +/* 6 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(6,16); +/* 6 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4,14); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5,15); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(6,16); +/* 6 fan present attributes in this platform */ +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(5); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(6); + +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(1); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(2); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(3); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(4); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); + +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); +/* System temperature for fancontrol */ +DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); + +static struct attribute *as7716_32xb_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_FAULT_ATTR(1,11), + DECLARE_FAN_FAULT_ATTR(2,12), + DECLARE_FAN_FAULT_ATTR(3,13), + DECLARE_FAN_FAULT_ATTR(4,14), + DECLARE_FAN_FAULT_ATTR(5,15), + DECLARE_FAN_FAULT_ATTR(6,16), + DECLARE_FAN_SPEED_RPM_ATTR(1,11), + DECLARE_FAN_SPEED_RPM_ATTR(2,12), + DECLARE_FAN_SPEED_RPM_ATTR(3,13), + DECLARE_FAN_SPEED_RPM_ATTR(4,14), + DECLARE_FAN_SPEED_RPM_ATTR(5,15), + DECLARE_FAN_SPEED_RPM_ATTR(6,16), + DECLARE_FAN_PRESENT_ATTR(1), + DECLARE_FAN_PRESENT_ATTR(2), + DECLARE_FAN_PRESENT_ATTR(3), + DECLARE_FAN_PRESENT_ATTR(4), + DECLARE_FAN_PRESENT_ATTR(5), + DECLARE_FAN_PRESENT_ATTR(6), + DECLARE_FAN_DIRECTION_ATTR(1), + DECLARE_FAN_DIRECTION_ATTR(2), + DECLARE_FAN_DIRECTION_ATTR(3), + DECLARE_FAN_DIRECTION_ATTR(4), + DECLARE_FAN_DIRECTION_ATTR(5), + DECLARE_FAN_DIRECTION_ATTR(6), + DECLARE_FAN_DUTY_CYCLE_ATTR(1), + DECLARE_FAN_SYSTEM_TEMP_ATTR(), + NULL +}; + +#define FAN_DUTY_CYCLE_REG_MASK 0xF +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100 + +static int as7716_32xb_fan_read_value(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int as7716_32xb_fan_write_value(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + reg_val &= FAN_DUTY_CYCLE_REG_MASK; + return ((u32)(reg_val+1) * 625 + 75)/ 100; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + return ((u32)duty_cycle * 100 / 625) - 1; +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_direction(u8 reg_val, enum FAN_ID id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 1 : 0; +} +static u8 reg_val_to_is_present(u8 reg_val, enum FAN_ID id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 0 : 1; +} + +static u8 is_fan_fault(struct as7716_32xb_fan_data *data, enum FAN_ID id) +{ + u8 ret = 0; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (!data->front_speed_rpm[id] && + !data->rear_speed_rpm[id] ) + { + ret = 1; + } + + return ret; +} + + +static ssize_t set_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct as7716_32xb_fan_data *data = as7716_32xb_fan_update_device(dev); + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 1) + return -EINVAL; + + data->enable = value; + if (value == 0) + { + return set_duty_cycle(dev, da, buf, FAN_MAX_DUTY_CYCLE); + } + return count; +} + + + +static ssize_t get_enable(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7716_32xb_fan_data *data = as7716_32xb_fan_update_device(dev); + + return sprintf(buf, "%u\n", data->enable); +} + +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > FAN_MAX_DUTY_CYCLE) + return -EINVAL; + + as7716_32xb_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ + as7716_32xb_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + return count; +} + +/* Due to this struct is declared at lm75.c, it cannot be include + * under Sonic environment. I duplicate it from lm75.c. + */ +struct lm75_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct thermal_zone_device *tz; + struct mutex update_lock; + u8 orig_conf; + u8 resolution; /* In bits, between 9 and 12 */ + u8 resolution_limits; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + unsigned long sample_time; /* In jiffies */ + s16 temp[3]; /* Register values, + 0 = input + 1 = max + 2 = hyst */ +}; + +/*Copied from lm75.c*/ +static inline long lm75_reg_to_mc(s16 temp, u8 resolution) +{ + return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); +} + +/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ +static struct device * get_hwmon_dev( + struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if(data) + { + if( data->valid == 1 && data->hwmon_dev) + { + return data->hwmon_dev; + } + + } + return NULL; +} + +/* To find hwmon index by opening hwmon under that i2c address. + */ +static int find_hwmon_index_by_FileOpen( + int bus_nr, + unsigned short addr, + OUT int *index) +{ +#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ + struct file *sfd; + char client_name[96]; + int i=0; + + do { + snprintf(client_name, sizeof(client_name), + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + + sfd = filp_open(client_name, O_RDONLY, 0); + i++; + } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); + + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); + return -ENOENT; + } + filp_close(sfd, 0); + *index = i - 1; + return 0; + +#undef MAX_HWMON_DEVICE +} + +static int get_temp_file_path( + int bus_nr, unsigned short addr, + struct device *hwmon_dev + ,char *path, int max_len) +{ + + if(hwmon_dev && strlen(dev_name(hwmon_dev))) + { + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", + bus_nr, addr, dev_name(hwmon_dev)); + } + else + { + int i=0; + if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) + { + return -EIO; + } + snprintf(path, max_len, + "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", + bus_nr, addr, i); + } + return 0; +} + +/*File read the dev file at user space.*/ +static int read_devfile_temp1_input( + struct device *dev, + int bus_nr, + unsigned short addr, + struct device *hwmon_dev, + int *miniCelsius) +{ + struct file *sfd; + char buffer[96]; + char devfile[96]; + int rc, status; + int rdlen, value; + mm_segment_t old_fs; + + rc = 0; + get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); + sfd = filp_open(devfile, O_RDONLY, 0); + if (IS_ERR(sfd)) { + pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); + return -ENOENT; + } + dev_dbg(dev, "Found device:%s\n",devfile); + + if(!(sfd->f_op) || !(sfd->f_op->read) ) { + pr_err("file %s cann't readable ?\n",devfile); + return -ENOENT; + } + + old_fs = get_fs(); + set_fs(KERNEL_DS); + rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); + if (rdlen == 0) { + pr_err( "File(%s) empty!\n", devfile); + rc = -EIO; + goto exit; + } + status = sscanf(buffer, "%d", &value); + if (status != 1) { + rc = -EIO; + goto exit; + } + *miniCelsius = value; + dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); + +exit: + set_fs(old_fs); + filp_close(sfd, 0); + return rc; +} + +static u8 is_lm75_data_due(struct i2c_client *client) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + if (time_after(jiffies, data->last_updated + data->sample_time)) + { + return 1; + } + return 0; +} +static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) +{ + struct lm75_data *data = NULL; + + data = i2c_get_clientdata(client); + *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); + + return 0; +} + +static int _find_lm75_device(struct device *dev, void *data) +{ + struct device_driver *driver; + struct as7716_32xb_fan_data *prv = data; + char *driver_name = THERMAL_SENSORS_DRIVER; + + driver = dev->driver; + if (driver && driver->name && + strcmp(driver->name, driver_name) == 0) + { + struct i2c_client *client; + client = to_i2c_client(dev); + if (client) + { + /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ + struct i2c_adapter *adap = client->adapter; + int miniCelsius = 0; + + + if (!adap) { + return -ENXIO; + } + + /* If the data is not updated, read them from devfile + to drive them updateing data from chip.*/ + if (is_lm75_data_due(client)) + { + struct device *hwmon_dev; + + hwmon_dev = get_hwmon_dev(client); + if(0 == read_devfile_temp1_input(dev, adap->nr, + client->addr, hwmon_dev, &miniCelsius)) + { + prv->system_temp += miniCelsius; + prv->sensors_found++; + } + + } + else + { + get_lm75_temp(client, &miniCelsius); + prv->system_temp += miniCelsius; + prv->sensors_found++; + + } + } + } + return 0; +} + +/*Find all lm75 devices and return sum of temperatures.*/ +static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + ssize_t ret = 0; + struct as7716_32xb_fan_data *data = as7716_32xb_fan_update_device(dev); + + data->system_temp=0; + data->sensors_found=0; + i2c_for_each_dev(data, _find_lm75_device); + if (NUM_THERMAL_SENSORS != data->sensors_found) + { + dev_dbg(dev,"only %d of %d temps are found\n", + data->sensors_found, NUM_THERMAL_SENSORS); + data->system_temp = 0; + } + ret = sprintf(buf, "%d\n",data->system_temp); + return ret; +} + + +static int fan_array_index_get(int attr_idx) +{ + switch(attr_idx) + { + case FAN1_PRESENT: + case FAN1_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN1_FAULT: + case FAN1_DIRECTION: + return FAN1_ID; + case FAN2_PRESENT: + case FAN2_FRONT_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN2_FAULT: + case FAN2_DIRECTION: + return FAN2_ID; + case FAN3_PRESENT: + case FAN3_FRONT_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN3_FAULT: + case FAN3_DIRECTION: + return FAN3_ID; + case FAN4_PRESENT: + case FAN4_FRONT_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN4_FAULT: + case FAN4_DIRECTION: + return FAN4_ID; + case FAN5_PRESENT: + case FAN5_FRONT_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN5_FAULT: + case FAN5_DIRECTION: + return FAN5_ID; + case FAN6_PRESENT: + case FAN6_FRONT_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + case FAN6_FAULT: + case FAN6_DIRECTION: + return FAN6_ID; + default : + return -1; + } +} + +static ssize_t fan_value_store(struct device *dev, struct device_attribute *da, + char *buf, size_t size) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_fan_data *data = i2c_get_clientdata(client); + int status = -EINVAL; + int index; + long keyin = 0; + //printk("fan_value_store\n"); + //printk("attr->index=%d\n", attr->index); + mutex_lock(&data->update_lock); + switch (attr->index) + { + case FAN_DUTY_CYCLE_PERCENTAGE: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + break; + if (keyin > 1 || keyin < 0) + break; + data->duty_cycle=keyin; + break; + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + break; + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + data->front_speed_rpm[index]=keyin; + break; + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + break; + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + data->rear_speed_rpm[index]=keyin; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + break; + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + if(keyin < 0 || keyin > 1) + break; + data->present[index]=keyin; + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + break; + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + if(keyin < 0 || keyin > 1) + break; + data->fault[index]=keyin; + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + case FAN6_DIRECTION: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + break; + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + if(keyin < 0 || keyin > 1) + break; + data->direction[index]=keyin; + break; + default: + break; + } + mutex_unlock(&data->update_lock); + return size; +} +static ssize_t fan_value_show(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_fan_data *data = i2c_get_clientdata(client); + int status = -EINVAL; + int index=0; + //printk("ffan_value_show\n"); + //printk("attr->index=%d\n", attr->index); + mutex_lock(&data->update_lock); + switch (attr->index) + { + case FAN_DUTY_CYCLE_PERCENTAGE: + status = sprintf(buf, "%u\n", data->duty_cycle); + break; + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + status = sprintf(buf, "%u\n", data->front_speed_rpm[index]); + break; + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + status = sprintf(buf, "%u\n", data->rear_speed_rpm[index]); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + status = sprintf(buf, "%d\n", data->present[index]); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + status = sprintf(buf, "%d\n", is_fan_fault(data, index)); + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + case FAN6_DIRECTION: + index=fan_array_index_get(attr->index);; + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + status = sprintf(buf, "%d\n", data->direction[index]); + break; + default: + break; + } + mutex_unlock(&data->update_lock); + return status; +} + +static const struct attribute_group as7716_32xb_fan_group = { + .attrs = as7716_32xb_fan_attributes, +}; + +static struct as7716_32xb_fan_data *as7716_32xb_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_fan_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + dev_dbg(&client->dev, "Starting as7716_32xb_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + int status = as7716_32xb_fan_read_value(client, fan_reg[i]); + + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int as7716_32xb_fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7716_32xb_fan_data *data; + int status; + + data = kzalloc(sizeof(struct as7716_32xb_fan_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32xb_fan_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: fan '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32xb_fan_remove(struct i2c_client *client) +{ + struct as7716_32xb_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_fan_group); + + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; + +static const struct i2c_device_id as7716_32xb_fan_id[] = { + { "as7716_32xb_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32xb_fan_id); + +static struct i2c_driver as7716_32xb_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = as7716_32xb_fan_probe, + .remove = as7716_32xb_fan_remove, + .id_table = as7716_32xb_fan_id, + .address_list = normal_i2c, +}; + +static int __init as7716_32xb_fan_init(void) +{ + return i2c_add_driver(&as7716_32xb_fan_driver); +} + +static void __exit as7716_32xb_fan_exit(void) +{ + i2c_del_driver(&as7716_32xb_fan_driver); +} + +module_init(as7716_32xb_fan_init); +module_exit(as7716_32xb_fan_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7716_32xb_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_leds.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_leds.c new file mode 100755 index 000000000000..2fa3fd722cb1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_leds.c @@ -0,0 +1,443 @@ +/* + * A LED driver for the as7716_32xb_led + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "as7716_32x_led" + +struct as7716_32x_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[1]; /* only 1 register*/ +}; + +static struct as7716_32x_led_data *ledctl = NULL; + +/* LED related data + */ + +#define LED_CNTRLER_I2C_ADDRESS (0x60) + +#define LED_TYPE_DIAG_REG_MASK (0x3) +#define LED_MODE_DIAG_GREEN_VALUE (0x02) +#define LED_MODE_DIAG_RED_VALUE (0x01) +#define LED_MODE_DIAG_AMBER_VALUE (0x00) /*It's yellow actually. Green+Red=Yellow*/ +#define LED_MODE_DIAG_OFF_VALUE (0x03) + + +#define LED_TYPE_LOC_REG_MASK (0x80) +#define LED_MODE_LOC_ON_VALUE (0) +#define LED_MODE_LOC_OFF_VALUE (0x80) + +enum led_type { + LED_TYPE_DIAG, + LED_TYPE_LOC, + LED_TYPE_FAN, + LED_TYPE_PSU1, + LED_TYPE_PSU2 +}; + +struct led_reg { + u32 types; + u8 reg_addr; +}; + +static const struct led_reg led_reg_map[] = { + {(1<update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting as7716_32x_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = as7716_32x_led_read_value(led_reg_map[i].reg_addr); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg_map[i].reg_addr, status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void as7716_32x_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + enum led_type type) +{ + int reg_val; + u8 reg ; + mutex_lock(&ledctl->update_lock); + + if( !getLedReg(type, ®)) + { + dev_dbg(&ledctl->pdev->dev, "Not match item for %d.\n", type); + } + + reg_val = as7716_32x_led_read_value(reg); + + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + as7716_32x_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + + +static void as7716_32x_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7716_32x_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG); +} + +static enum led_brightness as7716_32x_led_diag_get(struct led_classdev *cdev) +{ + as7716_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void as7716_32x_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7716_32x_led_set(led_cdev, led_light_mode, LED_TYPE_LOC); +} + +static enum led_brightness as7716_32x_led_loc_get(struct led_classdev *cdev) +{ + as7716_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static void as7716_32x_led_auto_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ +} + +static enum led_brightness as7716_32x_led_auto_get(struct led_classdev *cdev) +{ + return LED_MODE_AUTO; +} + +static struct led_classdev as7716_32x_leds[] = { + [LED_TYPE_DIAG] = { + .name = "as7716_32x_led::diag", + .default_trigger = "unused", + .brightness_set = as7716_32x_led_diag_set, + .brightness_get = as7716_32x_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_RED, + }, + [LED_TYPE_LOC] = { + .name = "as7716_32x_led::loc", + .default_trigger = "unused", + .brightness_set = as7716_32x_led_loc_set, + .brightness_get = as7716_32x_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_BLUE, + }, + [LED_TYPE_FAN] = { + .name = "as7716_32x_led::fan", + .default_trigger = "unused", + .brightness_set = as7716_32x_led_auto_set, + .brightness_get = as7716_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU1] = { + .name = "as7716_32x_led::psu1", + .default_trigger = "unused", + .brightness_set = as7716_32x_led_auto_set, + .brightness_get = as7716_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "as7716_32x_led::psu2", + .default_trigger = "unused", + .brightness_set = as7716_32x_led_auto_set, + .brightness_get = as7716_32x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +}; + +static int as7716_32x_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(as7716_32x_leds); i++) { + led_classdev_suspend(&as7716_32x_leds[i]); + } + + return 0; +} + +static int as7716_32x_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(as7716_32x_leds); i++) { + led_classdev_resume(&as7716_32x_leds[i]); + } + + return 0; +} + +static int as7716_32x_led_probe(struct platform_device *pdev) +{ + int ret, i; + + printk("as7716_32x_led_probe 1\n"); + for (i = 0; i < ARRAY_SIZE(as7716_32x_leds); i++) { + ret = led_classdev_register(&pdev->dev, &as7716_32x_leds[i]); + + if (ret < 0) + { + printk("ret < 0, i=%d\n", i); + break; + } + } + printk("as7716_32x_led_probe 2\n"); + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(as7716_32x_leds)){ + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&as7716_32x_leds[i]); + } + } + + printk("as7716_32x_led_probe 3\n"); + return 0; +} + +static int as7716_32x_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(as7716_32x_leds); i++) { + led_classdev_unregister(&as7716_32x_leds[i]); + } + + return 0; +} + +static struct platform_driver as7716_32x_led_driver = { + .probe = as7716_32x_led_probe, + .remove = as7716_32x_led_remove, + .suspend = as7716_32x_led_suspend, + .resume = as7716_32x_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init as7716_32x_led_init(void) +{ + int ret; + + printk("leds:1\n"); + ret = platform_driver_register(&as7716_32x_led_driver); + if (ret < 0) { + printk("leds:fail platform_driver_register\n"); + goto exit; + } + printk("leds:2\n"); + ledctl = kzalloc(sizeof(struct as7716_32x_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&as7716_32x_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + printk("leds:3\n"); + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + printk("leds:fail platform_device_register_simple\n"); + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&as7716_32x_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return 0; +} + +static void __exit as7716_32x_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&as7716_32x_led_driver); + kfree(ledctl); +} + +module_init(as7716_32x_led_init); +module_exit(as7716_32x_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7716_32x_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_oom.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_oom.c new file mode 100755 index 000000000000..5e88d9efad5d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_oom.c @@ -0,0 +1,267 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define STRING_TO_DEC_VALUE 10 +#define EEPROM_DATA_SIZE 512 + + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; +#define MAX_PORT_NAME_LEN 20 +/* Each client has this additional data + */ +struct as7716_32xb_oom_data { + struct device *hwmon_dev; + struct mutex lock; + u8 index; + unsigned char eeprom[EEPROM_DATA_SIZE]; + char port_name[MAX_PORT_NAME_LEN]; + +}; + + + +enum as7716_32xb_oom_sysfs_attributes { + TEMP1_INPUT, + TEMP1_MAX_HYST, + TEMP1_MAX +}; + +/* sysfs attributes for hwmon + */ + +static ssize_t oom_info_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t oom_info_show(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_port_name(struct device *dev, + struct device_attribute *dattr, char *buf); +static ssize_t set_port_name(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count); +static SENSOR_DEVICE_ATTR(eeprom, S_IWUSR|S_IRUGO, oom_info_show, oom_info_store, 0); +static SENSOR_DEVICE_ATTR(port_name, S_IRUGO | S_IWUSR, show_port_name, set_port_name, 1); + + +static struct attribute *as7716_32xb_oom_attributes[] = { + &sensor_dev_attr_eeprom.dev_attr.attr, + &sensor_dev_attr_port_name.dev_attr.attr, + NULL +}; + + +static ssize_t oom_info_show(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_oom_data *data = i2c_get_clientdata(client); + int i; + + mutex_lock(&data->lock); + memcpy(buf, data->eeprom, EEPROM_DATA_SIZE); + //for(i=0; i < EEPROM_DATA_SIZE ; i++) + //{ + // buf[i]=data->eeprom[i]; + // printk("buf[%d]=0x%x ",i, buf[i]); + //} + //status = EEPROM_DATA_SIZE+1; + + + memcpy(buf, data->eeprom, 256); + mutex_unlock(&data->lock); + + return 256; +} + +static ssize_t oom_info_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t size) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_oom_data *data = i2c_get_clientdata(client); + int i=0, j=0, k=0; + unsigned char str[3]; + unsigned int val; + + // printk("strlen(buf)=%d\n",strlen(buf)); + k=0; + mutex_lock(&data->lock); + memset(data->eeprom, 0xFF, EEPROM_DATA_SIZE); + memset(str, 0x0, 3); + if(strlen(buf) >= 256 ) + { + for(i=0; i < strlen(buf) ; i++) + { + // printk("i=%d ", i); + for(j=0;j<2; j++) + { + str[j]=buf[i+j]; + } + sscanf(str, "%x", &val); + //printk("str=%s val=0x%x ", str, val); + i=j+i-1; + if(k>=EEPROM_DATA_SIZE) + { + break; + } + data->eeprom[k]=(unsigned char)val; + //printk("data->eeprom[%d]=0x%x\n",k, data->eeprom[k]); + k++; + } + } + //printk("buf=\n"); + //for(i=0; i < strlen(buf) ; i++) + //{ + // printk("%c%c ", buf[i], buf[i+1]); + // if((i % 31)==0) + // printk("\n"); + //} + //printk("\n"); + + + mutex_unlock(&data->lock); + return size; + +} + +static ssize_t show_port_name(struct device *dev, + struct device_attribute *dattr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_oom_data *data = i2c_get_clientdata(client); + ssize_t count; + + mutex_lock(&data->lock); + count = sprintf(buf, "%s\n", data->port_name); + mutex_unlock(&data->lock); + + return count; +} + +static ssize_t set_port_name(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_oom_data *data = i2c_get_clientdata(client); + char port_name[MAX_PORT_NAME_LEN]; + + /* no checking, this value is not used except by show_port_name */ + + if (sscanf(buf, "%19s", port_name) != 1) + return -EINVAL; + + mutex_lock(&data->lock); + strcpy(data->port_name, port_name); + mutex_unlock(&data->lock); + + return count; +} + + +static const struct attribute_group as7716_32xb_oom_group = { + .attrs = as7716_32xb_oom_attributes, +}; + +static int as7716_32xb_oom_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7716_32xb_oom_data *data; + int status; + + data = kzalloc(sizeof(struct as7716_32xb_oom_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + i2c_set_clientdata(client, data); + data->index = dev_id->driver_data; + mutex_init(&data->lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32xb_oom_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: oom '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_oom_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32xb_oom_remove(struct i2c_client *client) +{ + struct as7716_32xb_oom_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_oom_group); + kfree(data); + + return 0; +} + + +static const struct i2c_device_id as7716_32xb_oom_id[] = { + { "as7716_32xb_oom", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32xb_oom_id); + +static struct i2c_driver as7716_32xb_oom_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7716_32xb_oom", + }, + .probe = as7716_32xb_oom_probe, + .remove = as7716_32xb_oom_remove, + .id_table = as7716_32xb_oom_id, + .address_list = normal_i2c, +}; + + + + + + +static int __init as7716_32xb_oom_init(void) +{ + return i2c_add_driver(&as7716_32xb_oom_driver); +} + +static void __exit as7716_32xb_oom_exit(void) +{ + i2c_del_driver(&as7716_32xb_oom_driver); +} + +module_init(as7716_32xb_oom_init); +module_exit(as7716_32xb_oom_exit); + +MODULE_AUTHOR("Jostar yang "); +MODULE_DESCRIPTION("as7716_32xb_oom driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_pmbus.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_pmbus.c new file mode 100755 index 000000000000..3f4dba90d1aa --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_pmbus.c @@ -0,0 +1,444 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define STRING_TO_DEC_VALUE 10 + + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7716_32xb_pmbus_data { + struct device *hwmon_dev; + struct mutex update_lock; + u8 index; + u8 capability; + u16 status_word; + u8 fan_fault; + u8 over_temp; + u16 v_out; + u16 i_out; + u16 p_out; + u16 temp; + u16 fan_speed; + u16 fan_duty_cycle; + u8 fan_dir[4]; + u8 pmbus_revision; + u8 mfr_id[10]; + u8 mfr_model[10]; + u8 mfr_revision[3]; + u16 mfr_vin_min; + u16 mfr_vin_max; + u16 mfr_iin_max; + u16 mfr_iout_max; + u16 mfr_pin_max; + u16 mfr_pout_max; + u16 mfr_vout_min; + u16 mfr_vout_max; + u16 power_on; + u16 temp_fault; + u16 power_good; +}; + + + +enum as7716_32xb_pmbus_sysfs_attributes { + PSU_POWER_ON = 0, + PSU_TEMP_FAULT, + PSU_POWER_GOOD, + PSU_FAN1_FAULT, + PSU_FAN_DIRECTION, + PSU_OVER_TEMP, + PSU_V_OUT, + PSU_I_OUT, + PSU_P_OUT, + PSU_P_OUT_UV, /*In Unit of microVolt, instead of mini.*/ + PSU_TEMP1_INPUT, + PSU_FAN1_SPEED, + PSU_FAN1_DUTY_CYCLE, + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_REVISION, + PSU_MFR_VIN_MIN, + PSU_MFR_VIN_MAX, + PSU_MFR_VOUT_MIN, + PSU_MFR_VOUT_MAX, + PSU_MFR_IIN_MAX, + PSU_MFR_IOUT_MAX, + PSU_MFR_PIN_MAX, + PSU_MFR_POUT_MAX +}; + +/* sysfs attributes for hwmon + */ +static ssize_t pmbus_info_show(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t pmbus_info_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static SENSOR_DEVICE_ATTR(psu_power_on, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_POWER_ON); +static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_over_temp, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_OVER_TEMP); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input,S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm,S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_FAN_DIRECTION); +static SENSOR_DEVICE_ATTR(psu_pmbus_revision,S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IWUSR| S_IRUGO, pmbus_info_show,pmbus_info_store, PSU_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_min, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_MFR_VIN_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_max, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_MFR_VIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_min, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_MFR_VOUT_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_max, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_MFR_VOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iin_max, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_MFR_IIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IWUSR|S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_MFR_PIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IWUSR| S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_MFR_POUT_MAX); + +/*Duplicate nodes for lm-sensors.*/ +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_P_OUT_UV); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, pmbus_info_show, pmbus_info_store, PSU_TEMP_FAULT); + + +static struct attribute *as7716_32xb_pmbus_attributes[] = { + &sensor_dev_attr_psu_power_on.dev_attr.attr, + &sensor_dev_attr_psu_temp_fault.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_over_temp.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr, + /*Duplicate nodes for lm-sensors.*/ + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_temp1_fault.dev_attr.attr, + NULL +}; + + +static ssize_t pmbus_info_show(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_pmbus_data *data = i2c_get_clientdata(client); + int status = -EINVAL; + //printk("pmbus_info_show\n"); + printk("attr->index=%d\n", attr->index); + mutex_lock(&data->update_lock); + switch (attr->index) + { + case PSU_POWER_ON: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->power_on); + break; + case PSU_TEMP_FAULT: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->temp_fault); + break; + case PSU_POWER_GOOD: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->power_good); + break; + case PSU_FAN1_FAULT: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->fan_fault); + break; + case PSU_FAN_DIRECTION: + status=snprintf(buf, PAGE_SIZE-1, "%s\r\n", data->fan_dir); + break; + case PSU_OVER_TEMP: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->over_temp); + break; + case PSU_V_OUT: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->v_out); + break; + case PSU_I_OUT: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->i_out); + break; + case PSU_P_OUT: + printk("read PSU_P_OUT\n"); + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->p_out); + break; + case PSU_P_OUT_UV: + printk("read PSU_P_OUT_UV\n"); + status=snprintf(buf, PAGE_SIZE-1, "%ld\r\n", data->p_out * 1000000); + break; + case PSU_TEMP1_INPUT: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->temp); + break; + case PSU_FAN1_SPEED: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->fan_speed); + break; + case PSU_FAN1_DUTY_CYCLE: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->fan_duty_cycle); + break; + case PSU_PMBUS_REVISION: + break; + case PSU_MFR_ID: + status=snprintf(buf, PAGE_SIZE-1, "%s\r\n", data->mfr_id); + break; + case PSU_MFR_MODEL: + status=snprintf(buf, PAGE_SIZE-1, "%s\r\n", data->mfr_model); + break; + case PSU_MFR_REVISION: + status=snprintf(buf, PAGE_SIZE-1, "%s\r\n", data->mfr_revision); + break; + case PSU_MFR_VIN_MIN: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->mfr_vin_min); + break; + case PSU_MFR_VIN_MAX: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->mfr_vin_max); + break; + case PSU_MFR_VOUT_MIN: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->mfr_vin_max); + break; + case PSU_MFR_VOUT_MAX: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->mfr_vout_max); + break; + case PSU_MFR_IIN_MAX: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->mfr_iin_max); + break; + case PSU_MFR_IOUT_MAX: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->mfr_iout_max); + break; + case PSU_MFR_PIN_MAX: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->mfr_pin_max); + break; + case PSU_MFR_POUT_MAX: + status=snprintf(buf, PAGE_SIZE-1, "%d\r\n", data->mfr_pout_max); + break; + default : + break; + } + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t pmbus_info_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_pmbus_data *data = i2c_get_clientdata(client); + long keyin = 0; + int status = -EINVAL; + //printk("pmbus_info_store\n"); + //printk("attr->index=%d\n", attr->index); + mutex_lock(&data->update_lock); + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + switch (attr->index) + { + case PSU_POWER_ON: + data->power_on=keyin; + break; + case PSU_TEMP_FAULT: + data->temp_fault=keyin; + break; + case PSU_POWER_GOOD: + data->power_good=keyin; + break; + case PSU_FAN1_FAULT: + break; + case PSU_FAN_DIRECTION: + memcpy(data->fan_dir, buf, sizeof(data->fan_dir)); + break; + case PSU_OVER_TEMP: + data->over_temp=keyin; + break; + case PSU_V_OUT: + data->v_out=keyin; + break; + case PSU_I_OUT: + data->i_out=keyin; + break; + case PSU_P_OUT: + printk("data->p_out=%d\n", data->p_out); + data->p_out=keyin; + break; + case PSU_P_OUT_UV: + //multiplier = 1000000; /*For lm-sensors, unit is micro-Volt.*/ + + break; + case PSU_TEMP1_INPUT: + data->temp=keyin; + break; + case PSU_FAN1_SPEED: + data->fan_speed=keyin; + break; + case PSU_FAN1_DUTY_CYCLE: + break; + case PSU_PMBUS_REVISION: + data->pmbus_revision=keyin; + break; + case PSU_MFR_ID: + memcpy(data->mfr_id, buf, sizeof(data->mfr_id)); + break; + case PSU_MFR_MODEL: + memcpy(data->mfr_model, buf, sizeof(data->mfr_model)); + break; + case PSU_MFR_REVISION: + memcpy(data->mfr_revision, buf, sizeof(data->mfr_revision)); + break; + case PSU_MFR_VIN_MIN: + data->mfr_vin_min=keyin; + break; + case PSU_MFR_VIN_MAX: + data->mfr_vin_max=keyin; + break; + case PSU_MFR_VOUT_MIN: + data->mfr_vout_min=keyin; + break; + case PSU_MFR_VOUT_MAX: + data->mfr_vout_max=keyin; + break; + case PSU_MFR_IIN_MAX: + data->mfr_iin_max=keyin; + break; + case PSU_MFR_IOUT_MAX: + data->mfr_iout_max=keyin; + break; + case PSU_MFR_PIN_MAX: + data->mfr_pin_max=keyin; + break; + case PSU_MFR_POUT_MAX: + data->mfr_pout_max=keyin; + break; + default : + break; + } + mutex_unlock(&data->update_lock); + return count; +} + + +static const struct attribute_group as7716_32xb_pmbus_group = { + .attrs = as7716_32xb_pmbus_attributes, +}; + +static int as7716_32xb_pmbus_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7716_32xb_pmbus_data *data; + int status; + + data = kzalloc(sizeof(struct as7716_32xb_pmbus_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + i2c_set_clientdata(client, data); + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32xb_pmbus_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: pmbus '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_pmbus_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32xb_pmbus_remove(struct i2c_client *client) +{ + struct as7716_32xb_pmbus_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_pmbus_group); + kfree(data); + + return 0; +} + + +static const struct i2c_device_id as7716_32xb_pmbus_id[] = { + { "as7716_32xb_pmbus", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32xb_pmbus_id); + +static struct i2c_driver as7716_32xb_pmbus_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7716_32xb_pmbus", + }, + .probe = as7716_32xb_pmbus_probe, + .remove = as7716_32xb_pmbus_remove, + .id_table = as7716_32xb_pmbus_id, + .address_list = normal_i2c, +}; + + + + + + +static int __init as7716_32xb_pmbus_init(void) +{ + return i2c_add_driver(&as7716_32xb_pmbus_driver); +} + +static void __exit as7716_32xb_pmbus_exit(void) +{ + i2c_del_driver(&as7716_32xb_pmbus_driver); +} + +module_init(as7716_32xb_pmbus_init); +module_exit(as7716_32xb_pmbus_exit); + +MODULE_AUTHOR("Jostar yang "); +MODULE_DESCRIPTION("as7716_32xb_pmbus driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_psu.c new file mode 100755 index 000000000000..01756e8596eb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_psu.c @@ -0,0 +1,355 @@ +/* + * An hwmon driver for accton as7716_32xbb Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_MODEL_NAME 16 +#define DC12V_FAN_DIR_OFFSET 0x34 +#define DC12V_FAN_DIR_LEN 3 +#define STRING_TO_DEC_VALUE 10 + +//static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); +static int as7716_32xb_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as7716_32xb_cpld_read (unsigned short cpld_addr, u8 reg); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7716_32xb_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + u8 present; + u8 power_good; + char model_name[MAX_MODEL_NAME+1]; /* Model name, read from eeprom */ + char fan_dir[DC12V_FAN_DIR_LEN+1]; /* DC12V fan direction */ +}; + +enum as7716_32xb_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD, + PSU_FAN_DIR /* For DC12V only */ +}; + +/* sysfs attributes for hwmon + */ +static ssize_t psu_info_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t psu_info_show(struct device *dev, struct device_attribute *da, + char *buf); +static SENSOR_DEVICE_ATTR(psu_present, S_IWUSR|S_IRUGO, psu_info_show, psu_info_store, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IWUSR|S_IRUGO, psu_info_show, psu_info_store, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IWUSR|S_IRUGO, psu_info_show, psu_info_store, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IWUSR|S_IRUGO, psu_info_show, psu_info_store, PSU_FAN_DIR); + + +static struct attribute *as7716_32xb_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, + NULL +}; + +static ssize_t psu_info_show(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_psu_data *data = i2c_get_clientdata(client); + int status = -EINVAL; + //printk("psu_info_show\n"); + // printk("attr->index=%d\n", attr->index); + mutex_lock(&data->update_lock); + switch (attr->index) + { + case PSU_PRESENT: + //printk("data->present=%d\n",data->present); + status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", data->present); + break; + case PSU_MODEL_NAME: + //printk("data->model_name=%s\n",data->model_name); + status = snprintf(buf, PAGE_SIZE - 1, "%s\r\n", data->model_name); + break; + case PSU_POWER_GOOD: + // printk("data->present=%d\n",data->power_good); + status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", data->power_good); + break; + case PSU_FAN_DIR: + //printk("data->fan_dir=%s\n",data->fan_dir); + status = snprintf(buf, PAGE_SIZE - 1, "%s\r\n", data->fan_dir); + break; + default : + break; + } + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t psu_info_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_psu_data *data = i2c_get_clientdata(client); + long keyin = 0; + int status = -EINVAL; + //printk("psu_info_store\n"); + //printk("attr->index=%d\n", attr->index); + mutex_lock(&data->update_lock); + switch (attr->index) + { + case PSU_PRESENT: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + goto fail_exit; + if (keyin > 1 || keyin < 0) + goto fail_exit; + data->present=keyin; + break; + case PSU_MODEL_NAME: + memcpy(data->model_name, buf, MAX_MODEL_NAME); + break; + case PSU_POWER_GOOD: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + goto fail_exit; + if (keyin > 1 || keyin < 0) + goto fail_exit; + data->power_good=keyin; + break; + case PSU_FAN_DIR: + memcpy(data->fan_dir, buf, DC12V_FAN_DIR_LEN); + break; + default : + goto fail_exit; + } + mutex_unlock(&data->update_lock); + return count; + +fail_exit: + mutex_unlock(&data->update_lock); + return -EINVAL; +} + +static const struct attribute_group as7716_32xb_psu_group = { + .attrs = as7716_32xb_psu_attributes, +}; + +static int as7716_32xb_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7716_32xb_psu_data *data; + int status; + + data = kzalloc(sizeof(struct as7716_32xb_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32xb_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32xb_psu_remove(struct i2c_client *client) +{ + struct as7716_32xb_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as7716_32xb_psu1, + as7716_32xb_psu2 +}; + +static const struct i2c_device_id as7716_32xb_psu_id[] = { + { "as7716_32xb_psu1", as7716_32xb_psu1 }, + { "as7716_32xb_psu2", as7716_32xb_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32xb_psu_id); + +static struct i2c_driver as7716_32xb_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7716_32xb_psu", + }, + .probe = as7716_32xb_psu_probe, + .remove = as7716_32xb_psu_remove, + .id_table = as7716_32xb_psu_id, + .address_list = normal_i2c, +}; + +static int as7716_32xb_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +enum psu_type { + PSU_TYPE_AC_110V, + PSU_TYPE_DC_48V, + PSU_TYPE_DC_12V +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + char* model_name; +}; + +struct model_name_info models[] = { +{PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, +{PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, +{PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, +}; + +static int as7716_32xb_psu_model_name_get(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_psu_data *data = i2c_get_clientdata(client); + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->model_name, 0, sizeof(data->model_name)); + + status = as7716_32xb_psu_read_block(client, models[i].offset, + data->model_name, models[i].length); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data->model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, models[i].length) == 0) { + return 0; + } + else { + data->model_name[0] = '\0'; + } + } + + return -ENODATA; +} + +static int __init as7716_32xb_psu_init(void) +{ + return i2c_add_driver(&as7716_32xb_psu_driver); +} + +static void __exit as7716_32xb_psu_exit(void) +{ + i2c_del_driver(&as7716_32xb_psu_driver); +} + +module_init(as7716_32xb_psu_init); +module_exit(as7716_32xb_psu_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7716_32xb_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_sfp.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_sfp.c new file mode 100755 index 000000000000..9c7a05632154 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_sfp.c @@ -0,0 +1,365 @@ +/* + * An hwmon driver for accton as7716_32x sfp + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BIT_INDEX(i) (1UL << (i)) +#define I2C_ADDR_CPLD1 0x60 +#define I2C_ADDR_CPLD2 0x62 +#define I2C_ADDR_CPLD3 0x64 +#define CPLD1_OFFSET_QSFP_PRESET1 0x30 +#define CPLD1_OFFSET_QSFP_PRESET2 0x31 +#define CPLD1_OFFSET_QSFP_PRESET3 0x32 +#define CPLD1_OFFSET_QSFP_PRESET4 0x33 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7716_32x_sfp_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + int port; /* Front port index */ + char eeprom[256]; /* eeprom data */ + u32 is_present; /* present status */ +}; + +static struct as7716_32x_sfp_data *as7716_32x_sfp_update_device(struct device *dev); +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_present(struct device *dev, struct device_attribute *da,char *buf); +static ssize_t show_eeprom(struct device *dev, struct device_attribute *da, char *buf); +extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +enum as7716_32x_sfp_sysfs_attributes { + SFP_PORT_NUMBER, + SFP_IS_PRESENT, + SFP_IS_PRESENT_ALL, + SFP_EEPROM +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, SFP_PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_present, NULL, SFP_IS_PRESENT); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_present, NULL, SFP_IS_PRESENT_ALL); +static SENSOR_DEVICE_ATTR(sfp_eeprom, S_IRUGO, show_eeprom, NULL, SFP_EEPROM); + +static struct attribute *as7716_32x_sfp_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_eeprom.dev_attr.attr, + NULL +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_sfp_data *data = i2c_get_clientdata(client); + + return sprintf(buf, "%d\n", data->port+1); +} + +/* Error-check the CPLD read results. */ +#define VALIDATED_READ(_buf, _rv, _read_expr, _invert) \ +do { \ + _rv = (_read_expr); \ + if(_rv < 0) { \ + return sprintf(_buf, "READ ERROR\n"); \ + } \ + if(_invert) { \ + _rv = ~_rv; \ + } \ + _rv &= 0xFF; \ +} while(0) + +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if(attr->index == SFP_IS_PRESENT_ALL) { + int values[4]; + /* + * Report the SFP_PRESENCE status for all ports. + */ + + /* QSFP_PRESENT Ports 1-8 */ + //VALIDATED_READ(buf, values[0], accton_i2c_cpld_read(0x62, 0x9), 1); + VALIDATED_READ(buf, values[0], accton_i2c_cpld_read(I2C_ADDR_CPLD1, CPLD1_OFFSET_QSFP_PRESET1), 1); + /* QSFP_PRESENT Ports 9-16 */ + VALIDATED_READ(buf, values[1], accton_i2c_cpld_read(I2C_ADDR_CPLD1, CPLD1_OFFSET_QSFP_PRESET2), 1); + /* QSFP_PRESENT Ports 17-24 */ + VALIDATED_READ(buf, values[2], accton_i2c_cpld_read(I2C_ADDR_CPLD1, CPLD1_OFFSET_QSFP_PRESET3), 1); + /* QSFP_PRESENT Ports 25-32 */ + VALIDATED_READ(buf, values[3], accton_i2c_cpld_read(I2C_ADDR_CPLD1, CPLD1_OFFSET_QSFP_PRESET4), 1); + + /* Return values 1 -> 32 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], values[3]); + } + else { /* SFP_IS_PRESENT */ + struct as7716_32x_sfp_data *data = as7716_32x_sfp_update_device(dev); + + if (!data->valid) { + printk("return -EIO\n"); + return -EIO; + } + + return sprintf(buf, "%d\n", data->is_present); + } +} + +static ssize_t show_eeprom(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7716_32x_sfp_data *data = as7716_32x_sfp_update_device(dev); + + if (!data->valid) { + return 0; + } + + if (!data->is_present) { + return 0; + } + + memcpy(buf, data->eeprom, sizeof(data->eeprom)); + + return sizeof(data->eeprom); +} + +static const struct attribute_group as7716_32x_sfp_group = { + .attrs = as7716_32x_sfp_attributes, +}; + +static int as7716_32x_sfp_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7716_32x_sfp_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7716_32x_sfp_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + i2c_set_clientdata(client, data); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32x_sfp_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sfp '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32x_sfp_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32x_sfp_remove(struct i2c_client *client) +{ + struct as7716_32x_sfp_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32x_sfp_group); + kfree(data); + + return 0; +} + +enum port_numbers { +as7716_32x_sfp1, as7716_32x_sfp2, as7716_32x_sfp3, as7716_32x_sfp4, +as7716_32x_sfp5, as7716_32x_sfp6, as7716_32x_sfp7, as7716_32x_sfp8, +as7716_32x_sfp9, as7716_32x_sfp10,as7716_32x_sfp11,as7716_32x_sfp12, +as7716_32x_sfp13,as7716_32x_sfp14,as7716_32x_sfp15,as7716_32x_sfp16, +as7716_32x_sfp17,as7716_32x_sfp18,as7716_32x_sfp19,as7716_32x_sfp20, +as7716_32x_sfp21,as7716_32x_sfp22,as7716_32x_sfp23,as7716_32x_sfp24, +as7716_32x_sfp25,as7716_32x_sfp26,as7716_32x_sfp27,as7716_32x_sfp28, +as7716_32x_sfp29,as7716_32x_sfp30,as7716_32x_sfp31,as7716_32x_sfp32 +}; + +static const struct i2c_device_id as7716_32x_sfp_id[] = { +{ "as7716_32x_sfp1", as7716_32x_sfp1 }, { "as7716_32x_sfp2", as7716_32x_sfp2 }, +{ "as7716_32x_sfp3", as7716_32x_sfp3 }, { "as7716_32x_sfp4", as7716_32x_sfp4 }, +{ "as7716_32x_sfp5", as7716_32x_sfp5 }, { "as7716_32x_sfp6", as7716_32x_sfp6 }, +{ "as7716_32x_sfp7", as7716_32x_sfp7 }, { "as7716_32x_sfp8", as7716_32x_sfp8 }, +{ "as7716_32x_sfp9", as7716_32x_sfp9 }, { "as7716_32x_sfp10", as7716_32x_sfp10 }, +{ "as7716_32x_sfp11", as7716_32x_sfp11 }, { "as7716_32x_sfp12", as7716_32x_sfp12 }, +{ "as7716_32x_sfp13", as7716_32x_sfp13 }, { "as7716_32x_sfp14", as7716_32x_sfp14 }, +{ "as7716_32x_sfp15", as7716_32x_sfp15 }, { "as7716_32x_sfp16", as7716_32x_sfp16 }, +{ "as7716_32x_sfp17", as7716_32x_sfp17 }, { "as7716_32x_sfp18", as7716_32x_sfp18 }, +{ "as7716_32x_sfp19", as7716_32x_sfp19 }, { "as7716_32x_sfp20", as7716_32x_sfp20 }, +{ "as7716_32x_sfp21", as7716_32x_sfp21 }, { "as7716_32x_sfp22", as7716_32x_sfp22 }, +{ "as7716_32x_sfp23", as7716_32x_sfp23 }, { "as7716_32x_sfp24", as7716_32x_sfp24 }, +{ "as7716_32x_sfp25", as7716_32x_sfp25 }, { "as7716_32x_sfp26", as7716_32x_sfp26 }, +{ "as7716_32x_sfp27", as7716_32x_sfp27 }, { "as7716_32x_sfp28", as7716_32x_sfp28 }, +{ "as7716_32x_sfp29", as7716_32x_sfp29 }, { "as7716_32x_sfp30", as7716_32x_sfp30 }, +{ "as7716_32x_sfp31", as7716_32x_sfp31 }, { "as7716_32x_sfp32", as7716_32x_sfp32 }, +{} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32x_sfp_id); + +static struct i2c_driver as7716_32x_sfp_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7716_32x_sfp", + }, + .probe = as7716_32x_sfp_probe, + .remove = as7716_32x_sfp_remove, + .id_table = as7716_32x_sfp_id, + .address_list = normal_i2c, +}; + +static int as7716_32x_sfp_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; + +abort: + return result; +} + +static struct as7716_32x_sfp_data *as7716_32x_sfp_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32x_sfp_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status = -1; + int i = 0; + u8 cpld_reg = 0x30 + (data->port/8); + + data->valid = 0; + + /* Read present status of the specified port number */ + data->is_present = 0; + status = accton_i2c_cpld_read(I2C_ADDR_CPLD1, cpld_reg); + + if (status < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", I2C_ADDR_CPLD1, cpld_reg, status); + goto exit; + } + + data->is_present = (status & (1 << (data->port % 8))) ? 0 : 1; + printk("data->is_present=%d, data->port=%d, status=0x%x\n",data->is_present, data->port, status); + /* Read eeprom data based on port number */ + memset(data->eeprom, 0, sizeof(data->eeprom)); + + /* Check if the port is present */ + if (data->is_present) { + /* read eeprom */ + for (i = 0; i < sizeof(data->eeprom)/I2C_SMBUS_BLOCK_MAX; i++) { + status = as7716_32x_sfp_read_block(client, i*I2C_SMBUS_BLOCK_MAX, + data->eeprom+(i*I2C_SMBUS_BLOCK_MAX), + I2C_SMBUS_BLOCK_MAX); + if (status < 0) { + printk("unable to read eeprom from port(%d)\n", data->port); + dev_dbg(&client->dev, "unable to read eeprom from port(%d)\n", data->port); + goto exit; + } + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init as7716_32x_sfp_init(void) +{ + //extern int platform_accton_as7716_32x(void); + //if (!platform_accton_as7716_32x()) { +// return -ENODEV; + //} + + return i2c_add_driver(&as7716_32x_sfp_driver); +} + +static void __exit as7716_32x_sfp_exit(void) +{ + i2c_del_driver(&as7716_32x_sfp_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as7716_32x_sfp driver"); +MODULE_LICENSE("GPL"); + +module_init(as7716_32x_sfp_init); +module_exit(as7716_32x_sfp_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_sys.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_sys.c new file mode 100755 index 000000000000..f0a8125139cc --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_sys.c @@ -0,0 +1,243 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define STRING_TO_DEC_VALUE 10 +#define EEPROM_DATA_SIZE 256 + + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; +#define MAX_PORT_NAME_LEN 20 +/* Each client has this additional data + */ +struct as7716_32xb_sys_data { + struct device *hwmon_dev; + struct mutex lock; + u8 index; + unsigned char eeprom[EEPROM_DATA_SIZE]; +}; + + +/* sysfs attributes for hwmon + */ + +static ssize_t sys_info_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t sys_info_show(struct device *dev, struct device_attribute *da, + char *buf); + +static SENSOR_DEVICE_ATTR(eeprom, S_IWUSR|S_IRUGO, sys_info_show, sys_info_store, 0); + + + +static struct attribute *as7716_32xb_sys_attributes[] = { + &sensor_dev_attr_eeprom.dev_attr.attr, + NULL +}; + + +static ssize_t sys_info_show(struct device *dev, struct device_attribute *da, + char *buf) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_sys_data *data = i2c_get_clientdata(client); +// int status = -EINVAL; + int i; + + //printk("sys_info_show\n"); + // printk("attr->index=%d\n", attr->index); + mutex_lock(&data->lock); + //for(i=0; i<8; i++) + // printk("data->eeprom[%d]=0x%x ",i, data->eeprom[i]); + //printk("\n"); + memcpy(buf, data->eeprom, EEPROM_DATA_SIZE); + //for(i=0; i < EEPROM_DATA_SIZE ; i++) + //{ + // buf[i]=data->eeprom[i]; + // printk("buf[%d]=0x%x ",i, buf[i]); + //} + //status = EEPROM_DATA_SIZE+1; + + //printk("\n"); + //status = sprintf(buf, "%x", 0xA); + //data->eeprom[0]=0x0d; + //data->eeprom[1]=0x0; + //data->eeprom[2]=0x06; + // buf[3]=0xFF; + + // for(i=0; i< 16; i++) + // printk("buf[%d]=0x%x ",i, buf[i]); + //printk("\n"); + + memcpy(buf, data->eeprom, 256); + + + mutex_unlock(&data->lock); + + return 256; +} + +static ssize_t sys_info_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t size) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_sys_data *data = i2c_get_clientdata(client); + int i=0, j=0, k=0; + unsigned char str[3]; + unsigned int val; + + //printk("sys_info_store\n"); + //printk("attr->index=%d\n", attr->index); + //printk("buf[0]=0x%x, buf[1]=0x%x, buf[2]=0x%x, buf[3]=0x%x\n", buf[0], buf[1], buf[2], buf[3]); + + // printk("strlen(buf)=%d\n",strlen(buf)); + k=0; + mutex_lock(&data->lock); + memset(data->eeprom, 0xFF, EEPROM_DATA_SIZE); + memset(str, 0x0, 3); + if(strlen(buf) >= 256 ) + { + for(i=0; i < strlen(buf) ; i++) + { + // printk("i=%d ", i); + for(j=0;j<2; j++) + { + str[j]=buf[i+j]; + } + sscanf(str, "%x", &val); + // printk("str=%s val=0x%x ", str, val); + i=j+i-1; + if(k>=EEPROM_DATA_SIZE) + { + break; + } + data->eeprom[k]=(unsigned char)val; + // printk("data->eeprom[%d]=0x%x\n",k, data->eeprom[k]); + k++; + } + } + //printk("buf=\n"); + //for(i=0; i < strlen(buf) ; i++) + //{ + // printk("%c%c ", buf[i], buf[i+1]); + // if((i % 31)==0) + // printk("\n"); + //} + //printk("\n"); + + //printk("eeprom[0]=0x%x, eeprom[1]=0x%x, eeprom[2]=0x%x, eeprom[3]=0x%x\n", + // data->eeprom[0], data->eeprom[1], data->eeprom[2], data->eeprom[3]); + + mutex_unlock(&data->lock); + return size; + +} + +static const struct attribute_group as7716_32xb_sys_group = { + .attrs = as7716_32xb_sys_attributes, +}; + +static int as7716_32xb_sys_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7716_32xb_sys_data *data; + int status; + + data = kzalloc(sizeof(struct as7716_32xb_sys_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + i2c_set_clientdata(client, data); + data->index = dev_id->driver_data; + mutex_init(&data->lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32xb_sys_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sys '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_sys_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32xb_sys_remove(struct i2c_client *client) +{ + struct as7716_32xb_sys_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_sys_group); + kfree(data); + + return 0; +} + + +static const struct i2c_device_id as7716_32xb_sys_id[] = { + { "as7716_32xb_sys", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32xb_sys_id); + +static struct i2c_driver as7716_32xb_sys_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7716_32xb_sys", + }, + .probe = as7716_32xb_sys_probe, + .remove = as7716_32xb_sys_remove, + .id_table = as7716_32xb_sys_id, + .address_list = normal_i2c, +}; + + + + + + +static int __init as7716_32xb_sys_init(void) +{ + return i2c_add_driver(&as7716_32xb_sys_driver); +} + +static void __exit as7716_32xb_sys_exit(void) +{ + i2c_del_driver(&as7716_32xb_sys_driver); +} + +module_init(as7716_32xb_sys_init); +module_exit(as7716_32xb_sys_exit); + +MODULE_AUTHOR("Jostar yang "); +MODULE_DESCRIPTION("as7716_32xb_sys driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_thermal.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_thermal.c new file mode 100755 index 000000000000..d42341bb181a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_thermal.c @@ -0,0 +1,214 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define STRING_TO_DEC_VALUE 10 +#define STRING_TO_HEX_VALUE 16 + +#define TEMP1_MAX_HYST_DEFAULT 75000 +#define TEMP1_MAX_DEFAULT 80000 +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7716_32xb_thermal_data { + struct device *hwmon_dev; + struct mutex update_lock; + u8 index; + unsigned int temp1_input; + unsigned int temp1_max_hyst; + unsigned int temp1_max; +}; + + + +enum as7716_32xb_thermal_sysfs_attributes { + TEMP1_INPUT, + TEMP1_MAX_HYST, + TEMP1_MAX +}; + +/* sysfs attributes for hwmon + */ + +static ssize_t temp_info_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t temp_info_show(struct device *dev, struct device_attribute *da, + char *buf); +static SENSOR_DEVICE_ATTR(temp1_input, S_IWUSR|S_IRUGO, temp_info_show, temp_info_store, TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR|S_IRUGO, temp_info_show, temp_info_store, TEMP1_MAX_HYST); +static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR|S_IRUGO, temp_info_show, temp_info_store, TEMP1_MAX); + + +static struct attribute *as7716_32xb_thermal_attributes[] = { + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, + &sensor_dev_attr_temp1_max.dev_attr.attr, + NULL +}; + + +static ssize_t temp_info_show(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_thermal_data *data = i2c_get_clientdata(client); + int status = -EINVAL; + + mutex_lock(&data->update_lock); + switch (attr->index) + { + case TEMP1_INPUT: + status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", data->temp1_input); + break; + case TEMP1_MAX_HYST: + status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", TEMP1_MAX_HYST_DEFAULT); + break; + case TEMP1_MAX: + status = snprintf(buf, PAGE_SIZE - 1, "%d\r\n", TEMP1_MAX_DEFAULT); + break; + default : + break; + } + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t temp_info_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t size) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_thermal_data *data = i2c_get_clientdata(client); + long keyin = 0; + int status = -EINVAL; + + mutex_lock(&data->update_lock); + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + switch (attr->index) + { + case TEMP1_INPUT: + data->temp1_input=keyin; + break; + case TEMP1_MAX_HYST: + data->temp1_max_hyst=keyin; + break; + case TEMP1_MAX: + data->temp1_max=keyin; + break; + default : + break; + } + mutex_unlock(&data->update_lock); + return size; + +} + +static const struct attribute_group as7716_32xb_thermal_group = { + .attrs = as7716_32xb_thermal_attributes, +}; + +static int as7716_32xb_thermal_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7716_32xb_thermal_data *data; + int status; + + data = kzalloc(sizeof(struct as7716_32xb_thermal_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + i2c_set_clientdata(client, data); + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32xb_thermal_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: thermal '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_thermal_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7716_32xb_thermal_remove(struct i2c_client *client) +{ + struct as7716_32xb_thermal_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7716_32xb_thermal_group); + kfree(data); + + return 0; +} + + +static const struct i2c_device_id as7716_32xb_thermal_id[] = { + { "as7716_32xb_thermal", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7716_32xb_thermal_id); + +static struct i2c_driver as7716_32xb_thermal_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7716_32xb_thermal", + }, + .probe = as7716_32xb_thermal_probe, + .remove = as7716_32xb_thermal_remove, + .id_table = as7716_32xb_thermal_id, + .address_list = normal_i2c, +}; + + + + + + +static int __init as7716_32xb_thermal_init(void) +{ + return i2c_add_driver(&as7716_32xb_thermal_driver); +} + +static void __exit as7716_32xb_thermal_exit(void) +{ + i2c_del_driver(&as7716_32xb_thermal_driver); +} + +module_init(as7716_32xb_thermal_init); +module_exit(as7716_32xb_thermal_exit); + +MODULE_AUTHOR("Jostar yang "); +MODULE_DESCRIPTION("as7716_32xb_thermal driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_i2c_cpld.c new file mode 100755 index 000000000000..46d1e2773287 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_i2c_cpld.c @@ -0,0 +1,259 @@ +/* + * A hwmon driver for the accton_i2c_cpld + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CPLD_VERSION_REG 0x1 + +enum as5712_54x_cpld_sysfs_attributes { + CPLD_READ_VERSION, + CPLD_BYTE_ACCESS, + CPLD_DUMP_ALL, +}; + +static ssize_t read_cpld_version(struct device *dev, struct device_attribute *da, + char *buf); +int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); + + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for accton_i2c_cpld + */ +static const unsigned short normal_i2c[] = { 0x31, 0x35, 0x60, 0x61, 0x62, I2C_CLIENT_END }; + +static SENSOR_DEVICE_ATTR(cpld_get_version, S_IRUGO, read_cpld_version, NULL, CPLD_READ_VERSION); + +static struct attribute *as5712_54x_cpld_attributes[] = { + &sensor_dev_attr_cpld_get_version.dev_attr.attr, + NULL +}; + +static const struct attribute_group as5712_54x_cpld_group = { + .attrs = as5712_54x_cpld_attributes, +}; + +static ssize_t read_cpld_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + unsigned short cpld_reg = CPLD_VERSION_REG; + u8 reg; + + if(attr->index == CPLD_READ_VERSION) { + reg = accton_i2c_cpld_read(client->addr, cpld_reg); + return sprintf(buf, "%02x\n",reg); + } + return -1 ; +} + + +static void accton_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void accton_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int accton_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as5712_54x_cpld_group); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + accton_i2c_cpld_add_client(client); + + return 0; +exit: + return status; +} + +static int accton_i2c_cpld_remove(struct i2c_client *client) +{ + sysfs_remove_group(&client->dev.kobj, &as5712_54x_cpld_group); + + accton_i2c_cpld_remove_client(client); + return 0; +} + +static const struct i2c_device_id accton_i2c_cpld_id[] = { + { "accton_i2c_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, accton_i2c_cpld_id); + +static struct i2c_driver accton_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "accton_i2c_cpld", + }, + .probe = accton_i2c_cpld_probe, + .remove = accton_i2c_cpld_remove, + .id_table = accton_i2c_cpld_id, + .address_list = normal_i2c, +}; + +int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_read); + +int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_write); + +static int __init accton_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&accton_i2c_cpld_driver); +} + +static void __exit accton_i2c_cpld_exit(void) +{ + i2c_del_driver(&accton_i2c_cpld_driver); +} +/* +static struct dmi_system_id as7712_dmi_table[] = { + { + .ident = "Accton AS7712", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Accton"), + DMI_MATCH(DMI_PRODUCT_NAME, "AS7712"), + }, + } +}; + +int platform_accton_as7712_32x(void) +{ + return dmi_check_system(as7712_dmi_table); +} +EXPORT_SYMBOL(platform_accton_as7712_32x); +*/ +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_i2c_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(accton_i2c_cpld_init); +module_exit(accton_i2c_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/service/as7716_32xb-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/service/as7716_32xb-platform-monitor.service new file mode 100755 index 000000000000..05a5d93c48b9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/service/as7716_32xb-platform-monitor.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS7716-32XB Platform Monitoring service +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/local/bin/accton_as7716_32xb_util.py install +ExecStart=/usr/local/bin/accton_as7716_32xb_drv_handler.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/setup.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/setup.py new file mode 100755 index 000000000000..3edfc29b3817 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='as7716_32xb', + version='1.0', + description='Module to initialize Accton AS7716-32XB platforms', + + packages=['as7716_32xb'], + package_dir={'as7716_32xb': 'as7716-32xb/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/README b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/README new file mode 100755 index 000000000000..c602d753301e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/README @@ -0,0 +1,117 @@ +Copyright (C) 2016 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Contents of this package: + patch - files under patch/ is for kernel and ONIE installer + for the kernel: + config-accton-as5712_54x.patch + for kernel configuration. + driver-i2c-muxes-pca954x-always-deselect.patch + for i2c_mux deselects after transaction. + driver-patches-for-accton-as5712-fan-psu-cpld.patch + for as5712's fan/psu/cpld/led/sfp drivers. + for ONIE: + onie_installer-accton-AS5712-54X.patch + for console port setting and copy util script o rootfs. + module - Contains source code of as5712 kernel driver modules. + +The late Sonic building scripts, pushed @Dec 5 2016, will automatically +create a docker container and run building process under it. +User is not necessary to handle docker environment creation. + +1. Download sonic-buildimage environment. + - Run "git clone https://github.com/Azure/sonic-buildimage". + - cd to sonic-buildimage and run "git submodule update --init --recursive". +2. Build kernel + - cd ./src/sonic-linux-kernel + - Copy patches and series from patch/kernel of this release to + sonic-linux-kernel/patch. + - Build kernel by "make". + - The built kernel package, linux-image-3.16.0-4-amd64_3.16.36-1+deb8u2_amd64.deb + , is generated. +3. Build installer + - Change directory back to sonic-buildimage/. + - Get onie_installer-accton-AS5712-54X.patch" from patch/installer. + - Change setting for AS5712-54X by patching build_image.sh. + "patch -p1 < onie_installer-accton-AS5712-54X.patch" + !!NOTICE, patching onie_installer-accton-AS5712-54X.patch comments out the + "git status" checking at build_image.sh. + - The account and password of installed OS can be given at rules/config. + The default user and password are "admin" & "YourPaSsWoRd" respectively. + - Run "make configure PLATFORM=broadcom" + - Copy the built kernel debian package to target/debs/. + The file is linux-image-3.16.0-4-amd64_*_amd64.deb under directory + src/sonic-linux-kernel/. + - Run "make target/sonic-generic.bin" + - Get the installer, target/sonic-generic.bin, to target machine and install. + +All Linux kernel code is licensed under the GPLv1. All other code is +licensed under the GPLv3. Please see the LICENSE file for copies of +both licenses. + +The code for integacting with Accton AS5712-54X has 2 parts, +kernel drivers and operational script. +The kernel drivers of peripherals are under module/ directory. +1. These drivers are patched into kernel by + driver-patches-for-accton-as5712-fan-psu-cpld.patch + Or you can build the driver under module/ by setting environment variable, + KERNEL_SRC, to proper linux built directory and run make. + It may be sonic-linux-kernel/linux-3.*/debian/build/build_amd64_none_amd64/. +2. A operational script, accton_as5712_util.py, for device initializatian and + peripheral accessing should be installed at /usr/bin. + This script is generated by onie_installer-accton-AS5712-54X.patch. + It's done by patching onie_installer-accton-AS5712-54X.patch at build-image. + Run "accton_as5712_util.py install" to install drivers. + +To initialize the system, run "accton_as5712_util.py install". +To clean up the drivers & devices, run "accton_as5712_util.py clean". +To dump information of sensors, run "accton_as5712_util.py show". +To dump SFP EEPROM, run "accton_as5712_util.py sff". +To set fan speed, run "accton_as5712_util.py set fan". +To enable/disable SFP emission, run "accton_as5712_util.py set sfp". +To set system LEDs' color, run "accton_as5712_util.py set led" +For more information, run "accton_as5712_util.py --help". + +==================================================================== +Besides applying accton_as5712_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +System LED: + There are 5 system LEDs at the lower-left corner of front panel. + They are loc, diag, fan, ps1, and ps2. + The sysfs interface color mappings are as follows: + Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + But not all colors are available for each LED. + +Fan Control: + There are 10 fans inside 5 fan modules. + All fans share 1 duty setting, ranged from 0~100. + +Thermal sensers: + 3 temperature sensors are controlled by the lm75 kernel modules. + +PSUs: + There 2 power supplies slot at the left/right side of the back. + Once if a PSU is not plugged, the status of it is shown failed. + +There are 48 SFP+ and 6 QSFP modules are equipped. +Before operating on PSU and QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py new file mode 100755 index 000000000000..c08a82c7dc45 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py @@ -0,0 +1,443 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 1/18/2018: Jostar create for as7716_32xb +# ------------------------------------------------------------------ + +try: + import os + import sys, getopt + import subprocess + import click + import imp + import logging + import logging.config + import types + import time # this is only being used as part of the example + import traceback + import commands + from tabulate import tabulate +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = 'as7716_32xb_drv_handler' +DEBUG = False + +global log_file +global log_level + +def my_log(txt): + if DEBUG == True: + print "[ACCTON DBG]: "+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status = 1 + output = "" + status, output = commands.getstatusoutput(cmd) + if DEBUG == True: + my_log (cmd +" , result:" + str(status)) + else: + if show: + print "ACC: " + str(cmd) + " , result:"+ str(status) + #my_log ("cmd:" + cmd) + #my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + + +# Make a class we can use to capture stdout and sterr in the log +class accton_as7716xb_drv_handler(object): + + QSFP_PORT_START = 1 + QSFP_PORT_END = 32 + BASE_PATH = "/usr/local/bin/" + BASE_I2C_PATH="/sys/bus/i2c/devices/" + QSFP_PRESENT_PATH = "/sys/bus/i2c/devices/0-0060/module_present_" + QSFP_RESET_PATH = "/sys/bus/i2c/devices/0-0060/module_reset_" + QSFP_PRESENT_FILE = "/tmp/ipmi_qsfp_pres" + QSFP_EEPROM_FILE = "/tmp/ipmi_qsfp_ee_" + THERMAL_FILE = "/tmp/ipmi_thermal" + IPMI_CMD_QSFP = "ipmitool raw 0x34 0x10 " + IPMI_CMD_THERMAL = "ipmitool raw 0x34 0x12 " + IPMI_CMD_FAN = "ipmitool raw 0x34 0x14 " + IPMI_CMD_PSU ="ipmitool raw 0x34 0x16 " + IPMI_CMD_SYS_EEPROM_1 ="ipmitool raw 0x34 0x18 0x0 0x80" + IPMI_CMD_SYS_EEPROM_2 ="ipmitool raw 0x34 0x18 0x80 0x80" + FAN_ID_START = 1 + FAN_ID_END = 6 + FAN_FILE = "/tmp/ipmi_fan" + FAN_PATH = "/sys/bus/i2c/devices/0-0066/fan" + PSU_ID_START = 1 + PSU_ID_END = 2 + PSU1_PATH = "/sys/bus/i2c/devices/0-0053/" + PSU2_PATH = "/sys/bus/i2c/devices/0-0050/" + PSU1_PMBUS_PATH = "/sys/bus/i2c/devices/0-005b/" + PSU2_PMBUS_PATH = "/sys/bus/i2c/devices/0-0058/" + PSU_FILE = "/tmp/ipmi_psu_" + SYS_EEPROM_FILE_1 = "/tmp/ipmi_sys_eeprom_1" + SYS_EEPROM_FILE_2 = "/tmp/ipmi_sys_eeprom_2" + SYS_EEPROM_PATH = "/sys/bus/i2c/devices/0-0056/eeprom" + + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_ipmi_qsfp(self): + logging.debug ("drv hanlder-manage_ipmi_qsfp") + print "drv hanlder" + #Handle QSFP case + ipmi_cmd = self.IPMI_CMD_QSFP + " 0x10 > " +self.QSFP_PRESENT_FILE + log_os_system(ipmi_cmd, 0) + file_path = self.QSFP_PRESENT_FILE + check_file = open(file_path) + try: + check_file = open(file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + line = check_file.readline() + pres_line= line.rstrip().replace(" ","") + while line: + line = check_file.readline() + pres_line+=line.rstrip().replace(" ","") + check_file.close() + + + for i in range(self.QSFP_PORT_START, self.QSFP_PORT_END+1, 1): + if i>1: + k=(i-1)*2 +1 + else: + k=1; + if pres_line[k] == '1': + #Set QSFP present + #print "port-%d present" %i + set_drv_cmd = "echo 1 > " + self.QSFP_PRESENT_PATH + str(i) + log_os_system(set_drv_cmd, 0) + #Read QSFP EEPROM + ipmi_cmd = self.IPMI_CMD_QSFP +str(i)+ " 0x00 > " +self.QSFP_EEPROM_FILE + str(i) + "_1" + log_os_system(ipmi_cmd, 0) + ipmi_cmd = self.IPMI_CMD_QSFP +str(i)+ " 0x01 > " +self.QSFP_EEPROM_FILE + str(i) + "_2" + log_os_system(ipmi_cmd, 0) + file_path = self.QSFP_EEPROM_FILE + str(i) + "_1" + check_file = open(file_path) + try: + check_file = open(file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + line = check_file.readline() + str_line= line.rstrip().replace(" ","") + while line: + line = check_file.readline() + str_line+=line.rstrip().replace(" ","") + check_file.close() + file_path = self.QSFP_EEPROM_FILE + str(i) + "_2" + check_file = open(file_path) + try: + check_file = open(file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + line = check_file.readline() + str_line+= line.rstrip().replace(" ","") + + while line: + line = check_file.readline() + str_line+=line.rstrip().replace(" ","") + check_file.close() + #Set QSFP EEPROM + if(i < 10): + set_drv_cmd = "echo " + str_line+ " > " + self.BASE_I2C_PATH + "0-000"+str(i) +"/eeprom" + else: + set_drv_cmd = "echo " + str_line+ " > " + self.BASE_I2C_PATH + "0-00"+str(i) +"/eeprom" + #print(set_drv_cmd) + log_os_system(set_drv_cmd, 0) + else: + ipmi_cmd = "echo 0 > " + self.QSFP_PRESENT_PATH + str(i) + log_os_system(ipmi_cmd, 0) + if(i < 10): + set_drv_cmd = "echo 0 > " + self.BASE_I2C_PATH + "0-000"+str(i) +"/eeprom" + else: + set_drv_cmd = "echo 0 > " + self.BASE_I2C_PATH + "0-00"+str(i) +"/eeprom" + #print(set_drv_cmd) + log_os_system(set_drv_cmd, 0) + + time.sleep(0.01) + return True + + def manage_ipmi_thermal(self): + logging.debug ("drv hanlder-manage_ipmi_thermal") + #Handle thermal case + #ipmitool raw 0x34 0x12 + ipmi_cmd = self.IPMI_CMD_THERMAL + " > " +self.THERMAL_FILE + log_os_system(ipmi_cmd, 0) + file_path = self.THERMAL_FILE + check_file = open(file_path) + try: + check_file = open(file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + line = check_file.readline() + str_line= line.rstrip().replace(" ","") + while line: + line = check_file.readline() + str_line+=line.rstrip().replace(" ","") + check_file.close() + val_str= "0x" + str(str_line[4])+str(str_line[5]) + val_int=int(val_str, 16)*1000 + check_file.close() + set_drv_cmd = "echo "+str(val_int) + " > " + self.BASE_I2C_PATH + "0-0048/temp1_input" + log_os_system(set_drv_cmd,0) + val_str= "0x" + str(str_line[10])+str(str_line[11]) + val_int=int(val_str, 16) * 1000 + set_drv_cmd = "echo "+str(val_int) + " > " + self.BASE_I2C_PATH + "0-0049/temp1_input" + log_os_system(set_drv_cmd,0) + val_str= "0x" + str(str_line[16])+str(str_line[17]) + val_int=int(val_str, 16) * 1000 + set_drv_cmd = "echo "+str(val_int) + " > " + self.BASE_I2C_PATH + "0-004a/temp1_input" + log_os_system(set_drv_cmd, 0) + + return True + + def manage_ipmi_fan(self): + logging.debug ("drv hanlder-manage_ipmi_fan") + #Handle fan case + #ipmitool raw 0x34 0x14 + ipmi_cmd = self.IPMI_CMD_FAN + " > " +self.FAN_FILE + log_os_system(ipmi_cmd, 0) + file_path = self.FAN_FILE + #print(file_path) + check_file = open(file_path) + try: + check_file = open(file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + line = check_file.readline() + str_line= line.rstrip().replace(" ","") + while line: + line = check_file.readline() + str_line+=line.rstrip().replace(" ","") + check_file.close() + #print (str_line) + k=0 + for i in range(self.FAN_ID_START, self.FAN_ID_END+1, 1): + #print "k=%d"%k + if str_line[k+1]=='0': + set_drv_cmd = "echo 1 > " + self.FAN_PATH + str(i) + "_present" + else: + set_drv_cmd = "echo 0 > " + self.FAN_PATH + str(i) + "_present" + log_os_system(set_drv_cmd, 0) + + val_str= "0x" + str(str_line[k+6])+str(str_line[k+7]) + str(str_line[k+4])+str(str_line[k+5]) + val_int=int(val_str, 16) + set_drv_cmd = "echo " + str(val_int) + " > " + self.FAN_PATH + str(i) + "_front_speed_rpm" + log_os_system(set_drv_cmd, 0) + val_str= "0x" + str(str_line[k+54])+str(str_line[k+55]) + str(str_line[k+52])+str(str_line[k+53]) + val_int=int(val_str, 16) + set_drv_cmd = "echo " + str(val_int) + " > " + self.FAN_PATH + str(i) + "_rear_speed_rpm" + log_os_system(set_drv_cmd, 0) + k+=8; + return True + + + def manage_ipmi_psu(self): + logging.debug ("drv hanlder-manage_ipmi_psu") + #Handle psu case + #present: ipmitool raw 0x34 0x16 '0x1' . Param-1 is psu id(id_1:0x1, id_2:0x2) + + #cpld access psu + for i in range(self.PSU_ID_START, self.PSU_ID_END+1, 1): + #present case + ipmi_cmd = self.IPMI_CMD_PSU + str(i) + " > " +self.PSU_FILE + str(i) + log_os_system(ipmi_cmd, 0) + if i==1: + psu_sysfs_path = self.PSU1_PATH + else: + psu_sysfs_path = self.PSU2_PATH + file_path = self.PSU_FILE + str(i) + #print(file_path) + check_file = open(file_path) + try: + check_file = open(file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + line = check_file.readline() + str_line= line.rstrip().replace(" ","") + while line: + line = check_file.readline() + str_line+=line.rstrip().replace(" ","") + check_file.close() + #print (line) + if str_line[1]=='0': + int_val=1 #psu insert + #print "psu_%d present"%i + set_drv_cmd = "echo " +str(int_val) + " > " + psu_sysfs_path + "psu_present" + log_os_system(set_drv_cmd, 0) + set_drv_cmd = "echo " + str(str_line[5]) + " > " + psu_sysfs_path + "psu_power_good" + log_os_system(set_drv_cmd, 0) + else: + int_val=0 + set_drv_cmd = "echo " +str(int_val) + " > " + psu_sysfs_path + "psu_present" + log_os_system(set_drv_cmd, 0) + set_drv_cmd = "echo " + str(int_val) + " > " + psu_sysfs_path + "psu_power_good" + log_os_system(set_drv_cmd, 0) + + #pmbus + if i==1: + psu_sysfs_path = self.PSU1_PMBUS_PATH + else: + psu_sysfs_path = self.PSU2_PMBUS_PATH + + if str_line[5]=='1': #power_on + val_str= "0x" + str(str_line[28])+str(str_line[29]) + str(str_line[26])+str(str_line[27]) + val_int=int(val_str, 16) * 1000 + set_drv_cmd = "echo " + str(val_int) + " > " + psu_sysfs_path + "psu_temp1_input" + log_os_system(set_drv_cmd, 0) + #print "val_int=%d"%val_int + val_str= "0x" + str(str_line[32])+str(str_line[33]) + str(str_line[30])+str(str_line[31]) + val_int=int(val_str, 16) + #print "fan:val_int=%d"%val_int + set_drv_cmd = "echo " + str(val_int) + " > " + psu_sysfs_path + "psu_fan1_speed_rpm" + log_os_system(set_drv_cmd, 0) + val_str= "0x" + str(str_line[36])+str(str_line[37]) + str(str_line[34])+str(str_line[35]) + val_int=int(val_str, 16) + #print "pout val_int=%d"%val_int + set_drv_cmd = "echo " + str(val_int) + " > " + psu_sysfs_path + "psu_p_out" + log_os_system(set_drv_cmd, 0) + else: #power_off + val_int=0 + set_drv_cmd = "echo " + str(val_int) + " > " + psu_sysfs_path + "psu_temp1_input" + log_os_system(set_drv_cmd, 0) + set_drv_cmd = "echo " + str(val_int) + " > " + psu_sysfs_path + "psu_fan1_speed_rpm" + log_os_system(set_drv_cmd, 0) + set_drv_cmd = "echo " + str(val_int) + " > " + psu_sysfs_path + "psu_p_out" + log_os_system(set_drv_cmd, 0) + + time.sleep(2) + return True + + def manage_ipmi_sys(self): + logging.debug ("drv hanlder-manage_ipmi_sys") + #Handle sys case + #ipmitool -raw 0x34 0x18 0x00 0x80 + #ipmitool -raw 0x34 0x18 0x80 0x80 + + ipmi_cmd = self.IPMI_CMD_SYS_EEPROM_1 + " > " + self.SYS_EEPROM_FILE_1 + log_os_system(ipmi_cmd, 0) + ipmi_cmd = self.IPMI_CMD_SYS_EEPROM_2 + " > " + self.SYS_EEPROM_FILE_2 + log_os_system(ipmi_cmd, 0) + + #Read SYS EEPROM + file_path = self.SYS_EEPROM_FILE_1 + check_file = open(file_path) + try: + check_file = open(file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + line = check_file.readline() + str_line= line.rstrip().replace(" ","") + while line: + line = check_file.readline() + str_line+=line.rstrip().replace(" ","") + check_file.close() + + file_path = self.SYS_EEPROM_FILE_2 + check_file = open(file_path) + try: + check_file = open(file_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + line = check_file.readline() + str_line+= line.rstrip().replace(" ","") + while line: + line = check_file.readline() + str_line+=line.rstrip().replace(" ","") + check_file.close() + #print(len(str_line)) + #print(str_line) + set_drv_cmd = "echo " + str_line+ " > " + self.SYS_EEPROM_PATH + #print(set_drv_cmd) + log_os_system(set_drv_cmd, 0) + + return True + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.WARNING + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['lfile=']) + except getopt.GetoptError: + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + set_drv_cmd = "echo 100 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us" + log_os_system(set_drv_cmd, 0) + monitor = accton_as7716xb_drv_handler(log_file, log_level) + + set_sys_eeprom=0 + thermal_chk_time=0 + psu_chk_time=0 + # Loop forever, doing something useful hopefully: + while True: + logging.debug ("monitor.manage_ipmi") + if set_sys_eeprom==0: + monitor.manage_ipmi_sys() + set_sys_eeprom=1 + monitor.manage_ipmi_qsfp() + time.sleep(0.1) + monitor.manage_ipmi_thermal() + monitor.manage_ipmi_psu() + time.sleep(0.1) + monitor.manage_ipmi_fan() + time.sleep(0.05) + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py new file mode 100755 index 000000000000..2568312b0955 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py @@ -0,0 +1,227 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# ------------------------------------------------------------------ + +try: + import os + import sys, getopt + import subprocess + import click + import imp + import logging + import logging.config + import types + import time # this is only being used as part of the example + import traceback + from tabulate import tabulate + from as7716_32x.fanutil import FanUtil + from as7716_32x.thermalutil import ThermalUtil +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = 'accton_as7716_monitor' + +global log_file +global log_level + + # For AC power Front to Back : + # If any fan fail, please fan speed register to 15 + # The max value of Fan speed register is 9 + # [LM75(48) + LM75(49) + LM75(4A)] > 174 => set Fan speed value from 4 to 5 + # [LM75(48) + LM75(49) + LM75(4A)] > 182 => set Fan speed value from 5 to 7 + # [LM75(48) + LM75(49) + LM75(4A)] > 190 => set Fan speed value from 7 to 9 + # + # [LM75(48) + LM75(49) + LM75(4A)] < 170 => set Fan speed value from 5 to 4 + # [LM75(48) + LM75(49) + LM75(4A)] < 178 => set Fan speed value from 7 to 5 + # [LM75(48) + LM75(49) + LM75(4A)] < 186 => set Fan speed value from 9 to 7 + # + # + # For AC power Back to Front : + # If any fan fail, please fan speed register to 15 + # The max value of Fan speed register is 10 + # [LM75(48) + LM75(49) + LM75(4A)] > 140 => set Fan speed value from 4 to 5 + # [LM75(48) + LM75(49) + LM75(4A)] > 150 => set Fan speed value from 5 to 7 + # [LM75(48) + LM75(49) + LM75(4A)] > 160 => set Fan speed value from 7 to 10 + # + # [LM75(48) + LM75(49) + LM75(4A)] < 135 => set Fan speed value from 5 to 4 + # [LM75(48) + LM75(49) + LM75(4A)] < 145 => set Fan speed value from 7 to 5 + # [LM75(48) + LM75(49) + LM75(4A)] < 155 => set Fan speed value from 10 to 7 + # + + + # 2.If no matched fan speed is found from the policy, + # use FAN_DUTY_CYCLE_MIN as default speed + # Get current temperature + # 4.Decision 3: Decide new fan speed depend on fan direction/current fan speed/temperature + + + + +# Make a class we can use to capture stdout and sterr in the log +class accton_as7716_monitor(object): + # static temp var + _ori_temp = 0 + _new_perc = 0 + _ori_perc = 0 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_fans(self): + + fan_policy_f2b = { + 0: [32, 0, 174000], + 1: [38, 170000, 182000], + 2: [50, 178000, 190000], + 3: [63, 186000, 0], + } + fan_policy_b2f = { + 0: [32, 0, 140000], + 1: [38, 135000, 150000], + 2: [50, 145000, 160000], + 3: [69, 15500, 0], + } + + thermal = ThermalUtil() + fan = FanUtil() + get_temp = thermal.get_thermal_temp() + # 1. Get each fan status, one not presented, set speed to full + # Get fan direction (Only get the first one since all fan direction are the same) + # Get current fan duty cycle + cur_duty_cycle = fan.get_fan_duty_cycle() + #print "cur_duty_cycle=%d" %cur_duty_cycle + #print "get_temp=%d" %get_temp + + for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): + fan_status = fan.get_fan_status(x) + if fan_status is None: + #print "fan_status is None" + logging.debug('INFO. SET new_perc to %d (FAN stauts is None. fan_num:%d)', 100, x) + return False + if fan_status is False: + #self._new_perc = FAN_LEV1_SPEED_PERC + #print "fan_%d status=false, set 45 duty_cycle" %x + logging.debug('INFO. SET new_perc to %d (FAN fault. fan_num:%d)', 100, x) + fan.set_fan_duty_cycle(45) + return True + logging.debug('INFO. fan_status is True (fan_num:%d)', x) + + if fan_status is not None and fan_status is not False: + fan_dir=fan.get_fan_dir(1) + for x in range(0, 4): + if cur_duty_cycle == fan_policy_f2b[x][0]: + break + #print "x=%d" %x + #print "fan_dir=%d" %fan_dir + #print "fan_policy_f2b[x][0]=%d" %fan_policy_f2b[x][0] + #print "cur_duty_cycle=%d" %cur_duty_cycle + + if fan_dir == 1: + if x == 4 : + fan.set_fan_duty_cycle(fan_policy_f2b[0][0]) + new_duty_cycle=cur_duty_cycle + # if temp > up_levle, else if temp < down_level + if get_temp > fan_policy_f2b[x][2] and x != 3 : + new_duty_cycle= fan_policy_f2b[x+1][0] + #print "new_duty_cycle= fan_policy_f2b[x+1][0]=%d" %new_duty_cycle + #print "Becasue get_temp > fan_policy_f2b[x][2]=%d" %fan_policy_f2b[x][2] + logging.debug('INFO. THERMAL temp UP, temp %d > %d , new_duty_cycle=%d', get_temp, fan_policy_f2b[x][2], new_duty_cycle) + #else get_temp < fan_policy_f2b[x][1] and x != 0 : + elif get_temp < fan_policy_f2b[x][1] : + new_duty_cycle= fan_policy_f2b[x-1][0] + #print "new_duty_cycle= fan_policy_f2b[x-1][0]=%d" %new_duty_cycle + #print "Becasue get_temp < fan_policy_f2b[x][1]=%d" %fan_policy_f2b[x][1] + logging.debug('INFO. THERMAL temp down, temp %d < %d , new_duty_cycle=%d', get_temp, fan_policy_f2b[x][1], new_duty_cycle) + if new_duty_cycle == cur_duty_cycle : + #print "new_duty_cycle == cur_duty_cycle case, so return True" + return True + else: + if x == 4 : + fan.set_fan_duty_cycle(fan_policy_b2f[0][0]) + new_duty_cycle=cur_duty_cycle + # if temp > up_levle, else if temp < down_level + if get_temp > fan_policy_b2f[x][1] and x != 3 : + new_duty_cycle= fan_policy_b2f[x+1][0] + logging.debug('INFO. THERMAL temp UP, temp %d > %d , new_duty_cycle=%d', get_temp, fan_policy_b2f[x][2], new_duty_cycle) + elif get_temp < fan_policy_b2f[x][0] and x != 0 : + #elif get_temp < fan_policy_b2f[x][0] + new_duty_cycle= fan_policy_b2f[x-1][0] + logging.debug('INFO. THERMAL temp down, temp %d < %d , new_duty_cycle=%d', get_temp, fan_policy_b2f[x][1], new_duty_cycle) + if new_duty_cycle == cur_duty_cycle : + return True + + fan.set_fan_duty_cycle(new_duty_cycle) + #print "set new_duty_cycle=%d" %new_duty_cycle + #print "old_duty_cycle=%d" %cur_duty_cycle + + return True + + + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['lfile=']) + except getopt.GetoptError: + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + monitor = accton_as7716_monitor(log_file, log_level) + + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(1) + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py new file mode 100755 index 000000000000..ffddfb338506 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py @@ -0,0 +1,616 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +PROJECT_NAME = 'as7716_32xb' +version = '0.0.1' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan1':1, 'fan2':1,'fan3':1,'fan4':1,'fan5':1,'thermal':3, 'psu':2, 'sfp':54} + + +led_prefix ='/sys/devices/platform/as7716_32xb_led/leds/accton_'+PROJECT_NAME+'_led::' +fan_prefix ='/sys/devices/platform/as7716_32xb_' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2'], + 'fan1': ['fan'], + 'fan2': ['fan'], + 'fan3': ['fan'], + 'fan4': ['fan'], + 'fan5': ['fan'], + 'fan5': ['fan'], + } +hwmon_nodes = {'led': ['brightness'] , + 'fan1': ['fan_duty_cycle_percentage', 'fan1_fault', 'fan1_speed_rpm', 'fan1_direction', 'fanr1_fault', 'fanr1_speed_rpm'], + 'fan2': ['fan_duty_cycle_percentage','fan2_fault', 'fan2_speed_rpm', 'fan2_direction', 'fanr2_fault', 'fanr2_speed_rpm'], + 'fan3': ['fan_duty_cycle_percentage','fan3_fault', 'fan3_speed_rpm', 'fan3_direction', 'fanr3_fault', 'fanr3_speed_rpm'], + 'fan4': ['fan4_duty_cycle_percentage','fan4_fault', 'fan4_speed_rpm', 'fan4_direction', 'fanr4_fault', 'fanr4_speed_rpm'], + 'fan5': ['fan_duty_cycle_percentage','fan5_fault', 'fan5_speed_rpm', 'fan5_direction', 'fanr5_fault', 'fanr5_speed_rpm'], + } +hwmon_prefix ={'led': led_prefix, + 'fan1': fan_prefix, + 'fan2': fan_prefix, + 'fan3': fan_prefix, + 'fan4': fan_prefix, + 'fan5': fan_prefix, + } + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_drv_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'thermal': ['10-0048','10-0049', '10-004a'] , + 'psu': ['17-0050','18-0053'], + 'sfp': ['-0050']} +i2c_nodes = { + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['sfp_is_present ', 'sfp_tx_disable']} + +sfp_map = [1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32] + +mknod =[ +'echo as7716_32xb_cpld1 0x60 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo accton_i2c_cpld 0x62 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo accton_i2c_cpld 0x64 > /sys/bus/i2c/devices/i2c-0/new_device', + +] + +mknod_xb =[ +'echo as7716_32xb_cpld1 0x60 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo accton_i2c_cpld 0x62 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo accton_i2c_cpld 0x64 > /sys/bus/i2c/devices/i2c-0/new_device', +#Thermal +'echo as7716_32xb_thermal 0x48 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo as7716_32xb_thermal 0x49 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo as7716_32xb_thermal 0x4a > /sys/bus/i2c/devices/i2c-0/new_device', +#Fan +'echo as7716_32xb_fan 0x66 > /sys/bus/i2c/devices/i2c-0/new_device', +# PSU-1 +'echo as7716_32xb_psu1 0x53 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo as7716_32xb_psu2 0x50> /sys/bus/i2c/devices/i2c-0/new_device', +# PSU-2 +'echo as7716_32xb_pmbus 0x5b > /sys/bus/i2c/devices/i2c-0/new_device', +'echo as7716_32xb_pmbus 0x58 > /sys/bus/i2c/devices/i2c-0/new_device', +#EERPOM +'echo as7716_32xb_sys 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', +] + + + +mknod2 =[ +'echo as7716_32xb_cpld1 0x60 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo accton_i2c_cpld 0x61 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo accton_i2c_cpld 0x62 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device', + +# PSU-1 +'echo as7716_32xb_psu1 0x38 > /sys/bus/i2c/devices/i2c-57/new_device', +'echo cpr_4011_4mxx 0x3c > /sys/bus/i2c/devices/i2c-57/new_device', +'echo as7716_32xb_psu1 0x50 > /sys/bus/i2c/devices/i2c-57/new_device', +'echo ym2401 0x58 > /sys/bus/i2c/devices/i2c-57/new_device', + +# PSU-2 +'echo as7716_32xb_psu2 0x3b > /sys/bus/i2c/devices/i2c-58/new_device', +'echo cpr_4011_4mxx 0x3f > /sys/bus/i2c/devices/i2c-58/new_device', +'echo as7716_32xb_psu2 0x53 > /sys/bus/i2c/devices/i2c-58/new_device', +'echo ym2401 0x5b > /sys/bus/i2c/devices/i2c-58/new_device', + +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-61/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-62/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-63/new_device', + +#EERPOM +#'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', +] + +FORCE = 0 +logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +logging.basicConfig(level=logging.INFO) + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ACCTON DBG]: "+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status = 1 + output = "" + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log ("cmd:" + cmd) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_inserted(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + + +kos = [ +'depmod -ae', +'modprobe ipmi_msghandler', +'modprobe ipmi_si', +'modprobe ipmi_devintf', +'modprobe i2c_dev', +'modprobe accton_i2c_cpld', +'modprobe accton_as7716_32xb_cpld1', +'modprobe accton_as7716_32xb_fan', +'modprobe accton_as7716_32xb_leds', +'modprobe accton_as7716_32xb_psu', +'modprobe accton_as7716_32xb_oom', +'modprobe accton_as7716_32xb_thermal', +'modprobe accton_as7716_32xb_pmbus', +'modprobe accton_as7716_32xb_sys'] + +def driver_install(): + global FORCE + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + + + +def i2c_order_check(): + # i2c bus 0 and 1 might be installed in different order. + # Here check if 0x76 is exist @ i2c-0 + tmp = "echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device" + status, output = log_os_system(tmp, 0) + if not device_exist(): + order = 1 + else: + order = 0 + tmp = "echo 0x70 > /sys/bus/i2c/devices/i2c-1/delete_device" + status, output = log_os_system(tmp, 0) + return order + +def device_install(): + global FORCE + + #order = i2c_order_check() + # if 0x76 is not exist @i2c-0, use reversed bus order + #if order: + # for i in range(0,len(mknod2)): + # #for pca932x need times to built new i2c buses + # if mknod2[i].find('pca954') != -1: + # time.sleep(2) + + # status, output = log_os_system(mknod2[i], 1) + # if status: + # print output + # if FORCE == 0: + # return status + #else: + print "Prepar to create instance.............." + for i in range(0,len(mknod_xb)): + print "Beginn to create instance.............." + status, output = log_os_system(mknod_xb[i], 1) + print "status=%s" %status + print "output=%s" %output + if status: + print output + if FORCE == 0: + return status + #time.sleep (50.0 / 1000.0) + print "Create sfp instance.............." + for i in range(0,len(sfp_map)): + status, output =log_os_system("echo as7716_32xb_oom 0x"+str(sfp_map[i])+ " > /sys/bus/i2c/devices/i2c-0/new_device", 1) + if status: + print output + if FORCE == 0: + return status + #status, output =log_os_system("echo port"+str(i)+" > /sys/bus/i2c/devices/0-000"+str(sfp_map[i])+"/port_name", 1) + #if status: + # print output + # if FORCE == 0: + # return status + return + +def device_uninstall(): + global FORCE + + for i in range(0,len(sfp_map)): + target = "echo 0x"+str(sfp_map[i])+ " > /sys/bus/i2c/devices/i2c-0/delete_device" + print(target) + status, output =log_os_system(target, 1) + if status: + print output + if FORCE == 0: + return status + + nodelist = mknod_xb + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_inserted() == False: + print "driver_inserted() == False" + return False + if not device_exist(): + print "not device_exist()" + return False + return True + +def do_install(): + print "Checking system...." + if driver_inserted() == False: + print "No driver, installing.1..." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing..2.." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking systemm...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_inserted()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] + print "path= %s" %path + print "i=%d" %i + print "k=%d" %k + print "j= %d" %j + print "sfp_map[k]=%s" %sfp_map[k] + print " buses[i]=%s" %buses[i] + print "nodes[j]=%s" %nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'sfp_eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan1'] ['fan11'][0] + node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0060", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-0", 0) + print(ret1) + print(ret2) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/Makefile new file mode 100644 index 000000000000..1b3477b0b771 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/Makefile @@ -0,0 +1,2 @@ +obj-m:=x86-64-accton-as7816-64x-fan.o x86-64-accton-as7816-64x-sfp.o x86-64-accton-as7816-64x-leds.o \ + x86-64-accton-as7816-64x-psu.o accton_i2c_cpld.o ym2651y.o diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/accton_i2c_cpld.c new file mode 120000 index 000000000000..39c0826d16fd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/accton_i2c_cpld.c @@ -0,0 +1 @@ +../../common/modules/accton_i2c_cpld.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-fan.c b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-fan.c new file mode 100644 index 000000000000..3de2c200e1e1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-fan.c @@ -0,0 +1,466 @@ +/* + * A hwmon driver for the Accton as7816-64x fan + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as7816_64x_fan" + +static struct as7816_64x_fan_data *as7816_64x_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x80, /* fan 1-4 present status */ + 0x81, /* fan 1-4 direction(0:F2B 1:B2F) */ + 0x87, /* fan PWM(for all fan) */ + 0x90, /* front fan 1 speed(rpm) */ + 0x91, /* front fan 2 speed(rpm) */ + 0x92, /* front fan 3 speed(rpm) */ + 0x93, /* front fan 4 speed(rpm) */ + 0x98, /* rear fan 1 speed(rpm) */ + 0x99, /* rear fan 2 speed(rpm) */ + 0x9A, /* rear fan 3 speed(rpm) */ + 0x9B, /* rear fan 4 speed(rpm) */ +}; + +/* Each client has this additional data */ +struct as7816_64x_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ +}; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID +}; + +enum sysfs_fan_attributes { + FAN_PRESENT_REG, + FAN_DIRECTION_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN1_DIRECTION, + FAN2_DIRECTION, + FAN3_DIRECTION, + FAN4_DIRECTION, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT +}; + +/* Define attributes + */ +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT);\ + static SENSOR_DEVICE_ATTR(fan##index2##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index, index2) &sensor_dev_attr_fan##index##_fault.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_fault.dev_attr.attr + +#define DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_direction, S_IRUGO, fan_show_value, NULL, FAN##index##_DIRECTION) +#define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ + static SENSOR_DEVICE_ATTR(pwm##index, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE) + +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan_duty_cycle_percentage.dev_attr.attr, \ + &sensor_dev_attr_pwm##index.dev_attr.attr + + +#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) +#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index2##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index, index2) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_input.dev_attr.attr + +/* 6 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4,14); +/* 6 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4,14); +/* 6 fan present attributes in this platform */ +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); +/* 6 fan direction attribute in this platform */ +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(1); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(2); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(3); +DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(4); +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); + +static struct attribute *as7816_64x_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_FAULT_ATTR(1,11), + DECLARE_FAN_FAULT_ATTR(2,12), + DECLARE_FAN_FAULT_ATTR(3,13), + DECLARE_FAN_FAULT_ATTR(4,14), + DECLARE_FAN_SPEED_RPM_ATTR(1,11), + DECLARE_FAN_SPEED_RPM_ATTR(2,12), + DECLARE_FAN_SPEED_RPM_ATTR(3,13), + DECLARE_FAN_SPEED_RPM_ATTR(4,14), + DECLARE_FAN_PRESENT_ATTR(1), + DECLARE_FAN_PRESENT_ATTR(2), + DECLARE_FAN_PRESENT_ATTR(3), + DECLARE_FAN_PRESENT_ATTR(4), + DECLARE_FAN_DIRECTION_ATTR(1), + DECLARE_FAN_DIRECTION_ATTR(2), + DECLARE_FAN_DIRECTION_ATTR(3), + DECLARE_FAN_DIRECTION_ATTR(4), + DECLARE_FAN_DUTY_CYCLE_ATTR(1), + NULL +}; + +#define FAN_DUTY_CYCLE_REG_MASK 0xF +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100 + +static int as7816_64x_fan_read_value(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int as7816_64x_fan_write_value(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + reg_val &= FAN_DUTY_CYCLE_REG_MASK; + + if (!reg_val) { + return 0; + } + + if (reg_val == 0xF) { + return FAN_MAX_DUTY_CYCLE; + } + + return (reg_val * 6) + 10; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + if (duty_cycle < 16) { + return 0; + } + + if (duty_cycle >= 100) { + return 0xF; + } + + return (duty_cycle - 10) / 6; +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_direction(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + return !!(reg_val & mask); +} + +static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + return !(reg_val & mask); +} + +static u8 is_fan_fault(struct as7816_64x_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = FAN1_FRONT_SPEED_RPM + id; + int rear_fan_index = FAN1_REAR_SPEED_RPM + id; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + ret = 0; + } + + return ret; +} + +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > FAN_MAX_DUTY_CYCLE) + return -EINVAL; + + as7816_64x_fan_write_value(client, 0x28, 0); /* Disable fan speed watch dog */ + as7816_64x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + return count; +} + +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7816_64x_fan_data *data = as7816_64x_fan_update_device(dev); + ssize_t ret = 0; + + if (data->valid) { + switch (attr->index) { + case FAN_DUTY_CYCLE_PERCENTAGE: + { + u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + { + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + } + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + ret = sprintf(buf, "%d\n", + reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], + attr->index - FAN1_PRESENT)); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + ret = sprintf(buf, "%d\n", + reg_val_to_direction(data->reg_val[FAN_DIRECTION_REG], + attr->index - FAN1_DIRECTION)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group as7816_64x_fan_group = { + .attrs = as7816_64x_fan_attributes, +}; + +static struct as7816_64x_fan_data *as7816_64x_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7816_64x_fan_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + dev_dbg(&client->dev, "Starting as7816_64x_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + int status = as7816_64x_fan_read_value(client, fan_reg[i]); + + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int as7816_64x_fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7816_64x_fan_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7816_64x_fan_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7816_64x_fan_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: fan '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7816_64x_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7816_64x_fan_remove(struct i2c_client *client) +{ + struct as7816_64x_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7816_64x_fan_group); + + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +static const struct i2c_device_id as7816_64x_fan_id[] = { + { "as7816_64x_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7816_64x_fan_id); + +static struct i2c_driver as7816_64x_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = as7816_64x_fan_probe, + .remove = as7816_64x_fan_remove, + .id_table = as7816_64x_fan_id, + .address_list = normal_i2c, +}; + +static int __init as7816_64x_fan_init(void) +{ + return i2c_add_driver(&as7816_64x_fan_driver); +} + +static void __exit as7816_64x_fan_exit(void) +{ + i2c_del_driver(&as7816_64x_fan_driver); +} + +module_init(as7816_64x_fan_init); +module_exit(as7816_64x_fan_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7816_64x_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-leds.c b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-leds.c new file mode 100644 index 000000000000..025f87d692a3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-leds.c @@ -0,0 +1,460 @@ +/* + * A LED driver for the as7816_64x_led + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern int accton_i2c_cpld_read (u8 cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "as7816_64x_led" + +struct as7816_64x_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[1]; /* only 1 register*/ +}; + +static struct as7816_64x_led_data *ledctl = NULL; + +/* LED related data + */ + +#define LED_CNTRLER_I2C_ADDRESS (0x60) + +#define LED_TYPE_DIAG_REG_MASK (0x03) +#define LED_MODE_DIAG_YELLOW_VALUE (0x00) +#define LED_MODE_DIAG_RED_VALUE (0x01) +#define LED_MODE_DIAG_GREEN_VALUE (0x02) +#define LED_MODE_DIAG_OFF_VALUE (0x03) + +#define LED_TYPE_LOC_REG_MASK (0x10) +#define LED_MODE_LOC_ORANGE_VALUE (0x00) +#define LED_MODE_LOC_OFF_VALUE (0x10) + +#define LED_TYPE_FAN_REG_MASK (0x0C) +#define LED_MODE_FAN_ORANGE_VALUE (0x04) +#define LED_MODE_FAN_GREEN_VALUE_1 (0x00) +#define LED_MODE_FAN_GREEN_VALUE_2 (0x08) +#define LED_MODE_FAN_OFF_VALUE (0x0C) + +enum led_type { + LED_TYPE_DIAG, + LED_TYPE_LOC, + LED_TYPE_FAN, + LED_TYPE_PSU1, + LED_TYPE_PSU2 +}; + +struct led_reg { + u32 types; + u8 reg_addr; +}; + +static const struct led_reg led_reg_map[] = { + {(1 << LED_TYPE_LOC) | (1 << LED_TYPE_DIAG) | (1 << LED_TYPE_FAN), 0x30}, +}; + +enum led_light_mode { + LED_MODE_OFF, + LED_MODE_RED = 10, + LED_MODE_RED_BLINKING = 11, + LED_MODE_ORANGE = 12, + LED_MODE_ORANGE_BLINKING = 13, + LED_MODE_YELLOW = 14, + LED_MODE_YELLOW_BLINKING = 15, + LED_MODE_GREEN = 16, + LED_MODE_GREEN_BLINKING = 17, + LED_MODE_BLUE = 18, + LED_MODE_BLUE_BLINKING = 19, + LED_MODE_PURPLE = 20, + LED_MODE_PURPLE_BLINKING = 21, + LED_MODE_AUTO = 22, + LED_MODE_AUTO_BLINKING = 23, + LED_MODE_WHITE = 24, + LED_MODE_WHITE_BLINKING = 25, + LED_MODE_CYAN = 26, + LED_MODE_CYAN_BLINKING = 27, + LED_MODE_UNKNOWN = 99 +}; + +struct led_type_mode { + enum led_type type; + enum led_light_mode mode; + int reg_bit_mask; + int mode_value; +}; + +static struct led_type_mode led_type_mode_data[] = { +{LED_TYPE_LOC, LED_MODE_OFF, LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_OFF_VALUE}, +{LED_TYPE_LOC, LED_MODE_ORANGE,LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_ORANGE_VALUE}, +{LED_TYPE_DIAG, LED_MODE_OFF, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_OFF_VALUE}, +{LED_TYPE_DIAG, LED_MODE_GREEN, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_GREEN_VALUE}, +{LED_TYPE_DIAG, LED_MODE_RED, LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_RED_VALUE}, +{LED_TYPE_DIAG, LED_MODE_YELLOW,LED_TYPE_DIAG_REG_MASK, LED_MODE_DIAG_YELLOW_VALUE}, +{LED_TYPE_FAN, LED_MODE_OFF, LED_TYPE_FAN_REG_MASK, LED_MODE_FAN_OFF_VALUE}, +{LED_TYPE_FAN, LED_MODE_GREEN, LED_TYPE_FAN_REG_MASK, LED_MODE_FAN_GREEN_VALUE_1}, +{LED_TYPE_FAN, LED_MODE_GREEN, LED_TYPE_FAN_REG_MASK, LED_MODE_FAN_GREEN_VALUE_2}, +{LED_TYPE_FAN, LED_MODE_ORANGE,LED_TYPE_FAN_REG_MASK, LED_MODE_FAN_ORANGE_VALUE} +}; + +static int get_led_reg(enum led_type type, u8 *reg) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(led_reg_map); i++) { + if(led_reg_map[i].types & (1 << type)) { + *reg = led_reg_map[i].reg_addr; + return 0; + } + } + + return 1; +} + +static int led_reg_val_to_light_mode(enum led_type type, u8 reg_val) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + + if (type != led_type_mode_data[i].type) + continue; + + if ((led_type_mode_data[i].reg_bit_mask & reg_val) == + led_type_mode_data[i].mode_value) + { + return led_type_mode_data[i].mode; + } + } + + return 0; +} + +static u8 led_light_mode_to_reg_val(enum led_type type, + enum led_light_mode mode, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + if (type != led_type_mode_data[i].type) + continue; + + if (mode != led_type_mode_data[i].mode) + continue; + + reg_val = led_type_mode_data[i].mode_value | + (reg_val & (~led_type_mode_data[i].reg_bit_mask)); + break; + } + + return reg_val; +} + +static int as7816_64x_led_read_value(u8 reg) +{ + return accton_i2c_cpld_read(LED_CNTRLER_I2C_ADDRESS, reg); +} + +static int as7816_64x_led_write_value(u8 reg, u8 value) +{ + return accton_i2c_cpld_write(LED_CNTRLER_I2C_ADDRESS, reg, value); +} + +static void as7816_64x_led_update(void) +{ + mutex_lock(&ledctl->update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting as7816_64x_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = as7816_64x_led_read_value(led_reg_map[i].reg_addr); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg_map[i].reg_addr, status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void as7816_64x_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + enum led_type type) +{ + int reg_val; + u8 reg ; + mutex_lock(&ledctl->update_lock); + + if( !get_led_reg(type, ®)) { + dev_dbg(&ledctl->pdev->dev, "Not match register for %d.\n", type); + } + + reg_val = as7816_64x_led_read_value(reg); + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + as7816_64x_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + + +static void as7816_64x_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7816_64x_led_set(led_cdev, led_light_mode, LED_TYPE_DIAG); +} + +static enum led_brightness as7816_64x_led_diag_get(struct led_classdev *cdev) +{ + as7816_64x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void as7816_64x_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7816_64x_led_set(led_cdev, led_light_mode, LED_TYPE_LOC); +} + +static enum led_brightness as7816_64x_led_loc_get(struct led_classdev *cdev) +{ + as7816_64x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static void as7816_64x_led_fan_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + as7816_64x_led_set(led_cdev, led_light_mode, LED_TYPE_FAN); +} + +static enum led_brightness as7816_64x_led_fan_get(struct led_classdev *cdev) +{ + as7816_64x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[0]); +} + +static void as7816_64x_led_auto_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ +} + +static enum led_brightness as7816_64x_led_auto_get(struct led_classdev *cdev) +{ + return LED_MODE_AUTO; +} + +static struct led_classdev as7816_64x_leds[] = { + [LED_TYPE_DIAG] = { + .name = "as7816_64x_led::diag", + .default_trigger = "unused", + .brightness_set = as7816_64x_led_diag_set, + .brightness_get = as7816_64x_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_GREEN, + }, + [LED_TYPE_LOC] = { + .name = "as7816_64x_led::loc", + .default_trigger = "unused", + .brightness_set = as7816_64x_led_loc_set, + .brightness_get = as7816_64x_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_ORANGE, + }, + [LED_TYPE_FAN] = { + .name = "as7816_64x_led::fan", + .default_trigger = "unused", + .brightness_set = as7816_64x_led_fan_set, + .brightness_get = as7816_64x_led_fan_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_GREEN, + }, + [LED_TYPE_PSU1] = { + .name = "as7816_64x_led::psu1", + .default_trigger = "unused", + .brightness_set = as7816_64x_led_auto_set, + .brightness_get = as7816_64x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "as7816_64x_led::psu2", + .default_trigger = "unused", + .brightness_set = as7816_64x_led_auto_set, + .brightness_get = as7816_64x_led_auto_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +}; + +static int as7816_64x_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(as7816_64x_leds); i++) { + led_classdev_suspend(&as7816_64x_leds[i]); + } + + return 0; +} + +static int as7816_64x_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(as7816_64x_leds); i++) { + led_classdev_resume(&as7816_64x_leds[i]); + } + + return 0; +} + +static int as7816_64x_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(as7816_64x_leds); i++) { + ret = led_classdev_register(&pdev->dev, &as7816_64x_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(as7816_64x_leds)){ + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&as7816_64x_leds[i]); + } + } + + return ret; +} + +static int as7816_64x_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(as7816_64x_leds); i++) { + led_classdev_unregister(&as7816_64x_leds[i]); + } + + return 0; +} + +static struct platform_driver as7816_64x_led_driver = { + .probe = as7816_64x_led_probe, + .remove = as7816_64x_led_remove, + .suspend = as7816_64x_led_suspend, + .resume = as7816_64x_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init as7816_64x_led_init(void) +{ + int ret; + + ret = platform_driver_register(&as7816_64x_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct as7816_64x_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&as7816_64x_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&as7816_64x_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit as7816_64x_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&as7816_64x_led_driver); + kfree(ledctl); +} + +module_init(as7816_64x_led_init); +module_exit(as7816_64x_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7816_64x_led driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-psu.c b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-psu.c new file mode 100644 index 000000000000..cdc535347dc0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-psu.c @@ -0,0 +1,239 @@ +/* + * An hwmon driver for accton as7816_64x Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PSU_STATUS_I2C_ADDR 0x60 +#define PSU_STATUS_I2C_REG_OFFSET 0x03 + +#define IS_POWER_GOOD(id, value) (!!(value & BIT(2+id))) +#define IS_PRESENT(id, value) (!(value & BIT(id))) + +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static struct as7816_64x_psu_data *as7816_64x_psu_update_device(struct device *dev); +extern int accton_i2c_cpld_read (u8 cpld_addr, u8 reg); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7816_64x_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ +}; + +enum as7816_64x_psu_sysfs_attributes { + PSU_PRESENT, + PSU_POWER_GOOD +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); + +static struct attribute *as7816_64x_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7816_64x_psu_data *data = as7816_64x_psu_update_device(dev); + u8 status = 0; + + if (!data->valid) { + return -EIO; + } + + if (attr->index == PSU_PRESENT) { + status = IS_PRESENT(data->index, data->status); + } + else { /* PSU_POWER_GOOD */ + status = IS_POWER_GOOD(data->index, data->status); + } + + return sprintf(buf, "%d\n", status); +} + +static const struct attribute_group as7816_64x_psu_group = { + .attrs = as7816_64x_psu_attributes, +}; + +static int as7816_64x_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7816_64x_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7816_64x_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7816_64x_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7816_64x_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7816_64x_psu_remove(struct i2c_client *client) +{ + struct as7816_64x_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7816_64x_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as7816_64x_psu1, + as7816_64x_psu2 +}; + +static const struct i2c_device_id as7816_64x_psu_id[] = { + { "as7816_64x_psu1", as7816_64x_psu1 }, + { "as7816_64x_psu2", as7816_64x_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7816_64x_psu_id); + +static struct i2c_driver as7816_64x_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as7816_64x_psu", + }, + .probe = as7816_64x_psu_probe, + .remove = as7816_64x_psu_remove, + .id_table = as7816_64x_psu_id, + .address_list = normal_i2c, +}; + +static struct as7816_64x_psu_data *as7816_64x_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7816_64x_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; + + data->valid = 0; + dev_dbg(&client->dev, "Starting as7816_64x update\n"); + + /* Read psu status */ + status = accton_i2c_cpld_read(PSU_STATUS_I2C_ADDR, PSU_STATUS_I2C_REG_OFFSET); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg (0x%x) err %d\n", PSU_STATUS_I2C_ADDR, status); + goto exit; + } + else { + data->status = status; + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init as7816_64x_psu_init(void) +{ + return i2c_add_driver(&as7816_64x_psu_driver); +} + +static void __exit as7816_64x_psu_exit(void) +{ + i2c_del_driver(&as7816_64x_psu_driver); +} + +module_init(as7816_64x_psu_init); +module_exit(as7816_64x_psu_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as7816_64x_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-sfp.c b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-sfp.c new file mode 100644 index 000000000000..76444ebbafcb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/x86-64-accton-as7816-64x-sfp.c @@ -0,0 +1,1576 @@ +/* + * SFP driver for accton as7816_64x sfp + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "as7816_64x_sfp" /* Platform dependent */ + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define NUM_OF_SFP_PORT 24 +#define EEPROM_NAME "sfp_eeprom" +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define BIT_INDEX(i) (1ULL << (i)) +#define USE_I2C_BLOCK_READ 1 /* Platform dependent */ +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +#define SFP_EEPROM_A0_I2C_ADDR (0xA0 >> 1) + +#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 +#define SFF8024_DEVICE_ID_SFP 0x3 +#define SFF8024_DEVICE_ID_QSFP 0xC +#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD +#define SFF8024_DEVICE_ID_QSFP28 0x11 + +#define SFF8436_RX_LOS_ADDR 3 +#define SFF8436_TX_FAULT_ADDR 4 +#define SFF8436_TX_DISABLE_ADDR 86 + +#define MULTIPAGE_SUPPORT 1 + +#if (MULTIPAGE_SUPPORT == 1) +/* fundamental unit of addressing for SFF_8472/SFF_8436 */ +#define SFF_8436_PAGE_SIZE 128 +/* + * The current 8436 (QSFP) spec provides for only 4 supported + * pages (pages 0-3). + * This driver is prepared to support more, but needs a register in the + * EEPROM to indicate how many pages are supported before it is safe + * to implement more pages in the driver. + */ +#define SFF_8436_SPECED_PAGES 4 +#define SFF_8436_EEPROM_SIZE ((1 + SFF_8436_SPECED_PAGES) * SFF_8436_PAGE_SIZE) +#define SFF_8436_EEPROM_UNPAGED_SIZE (2 * SFF_8436_PAGE_SIZE) +/* + * The current 8472 (SFP) spec provides for only 3 supported + * pages (pages 0-2). + * This driver is prepared to support more, but needs a register in the + * EEPROM to indicate how many pages are supported before it is safe + * to implement more pages in the driver. + */ +#define SFF_8472_SPECED_PAGES 3 +#define SFF_8472_EEPROM_SIZE ((3 + SFF_8472_SPECED_PAGES) * SFF_8436_PAGE_SIZE) +#define SFF_8472_EEPROM_UNPAGED_SIZE (4 * SFF_8436_PAGE_SIZE) + +/* a few constants to find our way around the EEPROM */ +#define SFF_8436_PAGE_SELECT_REG 0x7F +#define SFF_8436_PAGEABLE_REG 0x02 +#define SFF_8436_NOT_PAGEABLE (1<<2) +#define SFF_8472_PAGEABLE_REG 0x40 +#define SFF_8472_PAGEABLE (1<<4) + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = SFF_8436_PAGE_SIZE; + +/* + * specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; + +typedef enum qsfp_opcode { + QSFP_READ_OP = 0, + QSFP_WRITE_OP = 1 +} qsfp_opcode_e; +#endif + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_present(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count);; +static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); +extern int accton_i2c_cpld_read (u8 cpld_addr, u8 reg); + +enum sfp_sysfs_attributes { + PRESENT, + PRESENT_ALL, + PORT_NUMBER, + PORT_TYPE, + DDM_IMPLEMENTED, + TX_FAULT, + TX_FAULT1, + TX_FAULT2, + TX_FAULT3, + TX_FAULT4, + TX_DISABLE, + TX_DISABLE1, + TX_DISABLE2, + TX_DISABLE3, + TX_DISABLE4, + RX_LOS, + RX_LOS1, + RX_LOS2, + RX_LOS3, + RX_LOS4, + RX_LOS_ALL +}; + +/* SFP/QSFP common attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_present, NULL, PRESENT); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_present, NULL, PRESENT_ALL); +static SENSOR_DEVICE_ATTR(sfp_tx_disable, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE); +static SENSOR_DEVICE_ATTR(sfp_tx_fault, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT); + +/* QSFP attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_rx_los, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS); +static SENSOR_DEVICE_ATTR(sfp_rx_los1, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS1); +static SENSOR_DEVICE_ATTR(sfp_rx_los2, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS2); +static SENSOR_DEVICE_ATTR(sfp_rx_los3, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS3); +static SENSOR_DEVICE_ATTR(sfp_rx_los4, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS4); +static SENSOR_DEVICE_ATTR(sfp_tx_disable1, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE1); +static SENSOR_DEVICE_ATTR(sfp_tx_disable2, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE2); +static SENSOR_DEVICE_ATTR(sfp_tx_disable3, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE3); +static SENSOR_DEVICE_ATTR(sfp_tx_disable4, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE4); +static SENSOR_DEVICE_ATTR(sfp_tx_fault1, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT1); +static SENSOR_DEVICE_ATTR(sfp_tx_fault2, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT2); +static SENSOR_DEVICE_ATTR(sfp_tx_fault3, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT3); +static SENSOR_DEVICE_ATTR(sfp_tx_fault4, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT4); +static struct attribute *qsfp_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los1.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los2.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los3.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault4.dev_attr.attr, + NULL +}; + +/* Platform dependent +++ */ +#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) + +enum port_numbers { +as7816_64x_port1, as7816_64x_port2, as7816_64x_port3, as7816_64x_port4, +as7816_64x_port5, as7816_64x_port6, as7816_64x_port7, as7816_64x_port8, +as7816_64x_port9, as7816_64x_port10, as7816_64x_port11, as7816_64x_port12, +as7816_64x_port13, as7816_64x_port14, as7816_64x_port15, as7816_64x_port16, +as7816_64x_port17, as7816_64x_port18, as7816_64x_port19, as7816_64x_port20, +as7816_64x_port21, as7816_64x_port22, as7816_64x_port23, as7816_64x_port24, +as7816_64x_port25, as7816_64x_port26, as7816_64x_port27, as7816_64x_port28, +as7816_64x_port29, as7816_64x_port30, as7816_64x_port31, as7816_64x_port32, +as7816_64x_port33, as7816_64x_port34, as7816_64x_port35, as7816_64x_port36, +as7816_64x_port37, as7816_64x_port38, as7816_64x_port39, as7816_64x_port40, +as7816_64x_port41, as7816_64x_port42, as7816_64x_port43, as7816_64x_port44, +as7816_64x_port45, as7816_64x_port46, as7816_64x_port47, as7816_64x_port48, +as7816_64x_port49, as7816_64x_port50, as7816_64x_port51, as7816_64x_port52, +as7816_64x_port53, as7816_64x_port54, as7816_64x_port55, as7816_64x_port56, +as7816_64x_port57, as7816_64x_port58, as7816_64x_port59, as7816_64x_port60, +as7816_64x_port61, as7816_64x_port62, as7816_64x_port63, as7816_64x_port64 +}; + +#define I2C_DEV_ID(x) { #x, x} + +static const struct i2c_device_id sfp_device_id[] = { +I2C_DEV_ID(as7816_64x_port1), +I2C_DEV_ID(as7816_64x_port2), +I2C_DEV_ID(as7816_64x_port3), +I2C_DEV_ID(as7816_64x_port4), +I2C_DEV_ID(as7816_64x_port5), +I2C_DEV_ID(as7816_64x_port6), +I2C_DEV_ID(as7816_64x_port7), +I2C_DEV_ID(as7816_64x_port8), +I2C_DEV_ID(as7816_64x_port9), +I2C_DEV_ID(as7816_64x_port10), +I2C_DEV_ID(as7816_64x_port11), +I2C_DEV_ID(as7816_64x_port12), +I2C_DEV_ID(as7816_64x_port13), +I2C_DEV_ID(as7816_64x_port14), +I2C_DEV_ID(as7816_64x_port15), +I2C_DEV_ID(as7816_64x_port16), +I2C_DEV_ID(as7816_64x_port17), +I2C_DEV_ID(as7816_64x_port18), +I2C_DEV_ID(as7816_64x_port19), +I2C_DEV_ID(as7816_64x_port20), +I2C_DEV_ID(as7816_64x_port21), +I2C_DEV_ID(as7816_64x_port22), +I2C_DEV_ID(as7816_64x_port23), +I2C_DEV_ID(as7816_64x_port24), +I2C_DEV_ID(as7816_64x_port25), +I2C_DEV_ID(as7816_64x_port26), +I2C_DEV_ID(as7816_64x_port27), +I2C_DEV_ID(as7816_64x_port28), +I2C_DEV_ID(as7816_64x_port29), +I2C_DEV_ID(as7816_64x_port30), +I2C_DEV_ID(as7816_64x_port31), +I2C_DEV_ID(as7816_64x_port32), +I2C_DEV_ID(as7816_64x_port33), +I2C_DEV_ID(as7816_64x_port34), +I2C_DEV_ID(as7816_64x_port35), +I2C_DEV_ID(as7816_64x_port36), +I2C_DEV_ID(as7816_64x_port37), +I2C_DEV_ID(as7816_64x_port38), +I2C_DEV_ID(as7816_64x_port39), +I2C_DEV_ID(as7816_64x_port40), +I2C_DEV_ID(as7816_64x_port41), +I2C_DEV_ID(as7816_64x_port42), +I2C_DEV_ID(as7816_64x_port43), +I2C_DEV_ID(as7816_64x_port44), +I2C_DEV_ID(as7816_64x_port45), +I2C_DEV_ID(as7816_64x_port46), +I2C_DEV_ID(as7816_64x_port47), +I2C_DEV_ID(as7816_64x_port48), +I2C_DEV_ID(as7816_64x_port49), +I2C_DEV_ID(as7816_64x_port50), +I2C_DEV_ID(as7816_64x_port51), +I2C_DEV_ID(as7816_64x_port52), +I2C_DEV_ID(as7816_64x_port53), +I2C_DEV_ID(as7816_64x_port54), +I2C_DEV_ID(as7816_64x_port55), +I2C_DEV_ID(as7816_64x_port56), +I2C_DEV_ID(as7816_64x_port57), +I2C_DEV_ID(as7816_64x_port58), +I2C_DEV_ID(as7816_64x_port59), +I2C_DEV_ID(as7816_64x_port60), +I2C_DEV_ID(as7816_64x_port61), +I2C_DEV_ID(as7816_64x_port62), +I2C_DEV_ID(as7816_64x_port63), +I2C_DEV_ID(as7816_64x_port64), +{ /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, sfp_device_id); +/* Platform dependent --- */ + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_SFP_DDM, + DRIVER_TYPE_QSFP, + DRIVER_TYPE_XFP +}; + +/* Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + + struct qsfp_data *qsfp; + + struct i2c_client *client; +#if (MULTIPAGE_SUPPORT == 1) + int use_smbus; + u8 *writebuf; + unsigned write_max; +#endif +}; + +#if (MULTIPAGE_SUPPORT == 1) +static ssize_t sfp_port_read_write(struct sfp_port_data *port_data, + char *buf, loff_t off, size_t len, qsfp_opcode_e opcode); +#endif +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port)); +} + +/* Platform dependent +++ */ +static struct sfp_port_data *sfp_update_present(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77}; + + DEBUG_PRINT("Starting sfp present status update"); + mutex_lock(&data->update_lock); + + /* Read present status of port 1~64 */ + data->present = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = accton_i2c_cpld_read(0x60, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld(0x60) reg(0x%x) err %d", regs[i], status); + goto exit; + } + + DEBUG_PRINT("Present status = 0x%lx", data->present); + data->present |= (u64)status << (i*8); + } + + DEBUG_PRINT("Present status = 0x%lx", data->present); +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +/* Platform dependent --- */ + +static int sfp_is_port_present(struct i2c_client *client, int port) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + data = sfp_update_present(client); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + return (data->present & BIT_INDEX(data->port)) ? 0 : 1; /* Platform dependent */ +} + +/* Platform dependent +++ */ +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + + if (PRESENT_ALL == attr->index) { + int i; + u8 values[8] = {0}; + struct sfp_port_data *data = sfp_update_present(client); + + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + for (i = 0; i < ARRAY_SIZE(values); i++) { + values[i] = ~(u8)(data->present >> (i * 8)); + } + + /* Return values 1 -> 64 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], values[3], + values[4], values[5], values[6], values[7]); + } + else { + struct sfp_port_data *data = i2c_get_clientdata(client); + int present = sfp_is_port_present(client, data->port); + + if (IS_ERR_VALUE(present)) { + return present; + } + + /* PRESENT */ + return sprintf(buf, "%d\n", present); + } +} +/* Platform dependent --- */ + +static struct sfp_port_data *qsfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i, status = -1; + u8 buf = 0; + u8 reg[] = {SFF8436_TX_FAULT_ADDR, SFF8436_TX_DISABLE_ADDR, SFF8436_RX_LOS_ADDR}; + + if (time_before(jiffies, data->qsfp->last_updated + HZ + HZ / 2) && data->qsfp->valid) { + return data; + } + + DEBUG_PRINT("Starting sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->qsfp->valid = 0; + memset(data->qsfp->status, 0, sizeof(data->qsfp->status)); + + /* Notify device to update tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf)); + if (unlikely(status < 0)) { + goto exit; + } + } + msleep(200); + + /* Read actual tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf)); + if (unlikely(status < 0)) { + goto exit; + } + + DEBUG_PRINT("qsfp reg(0x%x) status = (0x%x)", reg[i], data->qsfp->status[i]); + data->qsfp->status[i] = (buf & 0xF); + } + + data->qsfp->valid = 1; + data->qsfp->last_updated = jiffies; + +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + int present; + u8 val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + present = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENXIO; + } + + data = qsfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + switch (attr->index) { + case TX_FAULT: + val = !!(data->qsfp->status[2] & 0xF); + break; + case TX_FAULT1: + case TX_FAULT2: + case TX_FAULT3: + case TX_FAULT4: + val = !!(data->qsfp->status[2] & BIT_INDEX(attr->index - TX_FAULT1)); + break; + case TX_DISABLE: + val = data->qsfp->status[1] & 0xF; + break; + case TX_DISABLE1: + case TX_DISABLE2: + case TX_DISABLE3: + case TX_DISABLE4: + val = !!(data->qsfp->status[1] & BIT_INDEX(attr->index - TX_DISABLE1)); + break; + case RX_LOS: + val = !!(data->qsfp->status[0] & 0xF); + break; + case RX_LOS1: + case RX_LOS2: + case RX_LOS3: + case RX_LOS4: + val = !!(data->qsfp->status[0] & BIT_INDEX(attr->index - RX_LOS1)); + break; + default: + break; + } + + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + long disable; + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + status = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(status)) { + return status; + } + + if (!status) { + /* port is not present */ + return -ENXIO; + } + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + + data = qsfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + mutex_lock(&data->update_lock); + + if (attr->index == TX_DISABLE) { + if (disable) { + data->qsfp->status[1] |= 0xF; + } + else { + data->qsfp->status[1] &= ~0xF; + } + } + else {/* TX_DISABLE1 ~ TX_DISABLE4*/ + if (disable) { + data->qsfp->status[1] |= (1 << (attr->index - TX_DISABLE1)); + } + else { + data->qsfp->status[1] &= ~(1 << (attr->index - TX_DISABLE1)); + } + } + + DEBUG_PRINT("index = (%d), status = (0x%x)", attr->index, data->qsfp->status[1]); + status = sfp_eeprom_write(data->client, SFF8436_TX_DISABLE_ADDR, &data->qsfp->status[1], sizeof(data->qsfp->status[1])); + if (unlikely(status < 0)) { + count = status; + } + + mutex_unlock(&data->update_lock); + return count; +} + +static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int status, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + status = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + return status; + } + + return data_len; +#else + int status, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, command, *data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + return status; + } + + return 1; +#endif + + +} + +#if (MULTIPAGE_SUPPORT == 0) +static ssize_t sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; +} +#endif + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + struct sfp_port_data *data; + DEBUG_PRINT("%s(%d) offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + present = sfp_is_port_present(data->client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + +#if (MULTIPAGE_SUPPORT == 1) + return sfp_port_read_write(data, buf, off, count, QSFP_WRITE_OP); +#else + return sfp_port_write(data, buf, off, count); +#endif +} + +static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int status, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + status = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + goto abort; + } + if (unlikely(status != data_len)) { + status = -EIO; + goto abort; + } + + //result = data_len; + +abort: + return status; +#else + int status, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, command); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, status); + goto abort; + } + + *data = (u8)status; + status = 1; + +abort: + return status; +#endif +} + +#if (MULTIPAGE_SUPPORT == 1) +/*-------------------------------------------------------------------------*/ +/* + * This routine computes the addressing information to be used for + * a given r/w request. + * + * Task is to calculate the client (0 = i2c addr 50, 1 = i2c addr 51), + * the page, and the offset. + * + * Handles both SFP and QSFP. + * For SFP, offset 0-255 are on client[0], >255 is on client[1] + * Offset 256-383 are on the lower half of client[1] + * Pages are accessible on the upper half of client[1]. + * Offset >383 are in 128 byte pages mapped into the upper half + * + * For QSFP, all offsets are on client[0] + * offset 0-127 are on the lower half of client[0] (no paging) + * Pages are accessible on the upper half of client[1]. + * Offset >127 are in 128 byte pages mapped into the upper half + * + * Callers must not read/write beyond the end of a client or a page + * without recomputing the client/page. Hence offset (within page) + * plus length must be less than or equal to 128. (Note that this + * routine does not have access to the length of the call, hence + * cannot do the validity check.) + * + * Offset within Lower Page 00h and Upper Page 00h are not recomputed + */ +static uint8_t sff_8436_translate_offset(struct sfp_port_data *port_data, + loff_t *offset, struct i2c_client **client) +{ + unsigned page = 0; + + *client = port_data->client; + + /* + * if offset is in the range 0-128... + * page doesn't matter (using lower half), return 0. + * offset is already correct (don't add 128 to get to paged area) + */ + if (*offset < SFF_8436_PAGE_SIZE) + return page; + + /* note, page will always be positive since *offset >= 128 */ + page = (*offset >> 7)-1; + /* 0x80 places the offset in the top half, offset is last 7 bits */ + *offset = SFF_8436_PAGE_SIZE + (*offset & 0x7f); + + return page; /* note also returning client and offset */ +} + +static ssize_t sff_8436_eeprom_read(struct sfp_port_data *port_data, + struct i2c_client *client, + char *buf, unsigned offset, size_t count) +{ + struct i2c_msg msg[2]; + u8 msgbuf[2]; + unsigned long timeout, read_time; + int status, i; + + memset(msg, 0, sizeof(msg)); + + switch (port_data->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + /*smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + break; + case I2C_SMBUS_WORD_DATA: + /* Check for odd length transaction */ + count = (count == 1) ? 1 : 2; + break; + case I2C_SMBUS_BYTE_DATA: + count = 1; + break; + default: + /* + * When we have a better choice than SMBus calls, use a + * combined I2C message. Write address; then read up to + * io_limit data bytes. msgbuf is u8 and will cast to our + * needs. + */ + i = 0; + msgbuf[i++] = offset; + + msg[0].addr = client->addr; + msg[0].buf = msgbuf; + msg[0].len = i; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + } + + /* + * Reads fail if the previous write didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + read_time = jiffies; + + switch (port_data->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + status = i2c_smbus_read_i2c_block_data(client, offset, + count, buf); + break; + case I2C_SMBUS_WORD_DATA: + status = i2c_smbus_read_word_data(client, offset); + if (status >= 0) { + buf[0] = status & 0xff; + if (count == 2) + buf[1] = status >> 8; + status = count; + } + break; + case I2C_SMBUS_BYTE_DATA: + status = i2c_smbus_read_byte_data(client, offset); + if (status >= 0) { + buf[0] = status; + status = count; + } + break; + default: + status = i2c_transfer(client->adapter, msg, 2); + if (status == 2) + status = count; + } + + dev_dbg(&client->dev, "eeprom read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) /* happy path */ + return count; + + if (status == -ENXIO) /* no module present */ + return status; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(read_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t sff_8436_eeprom_write(struct sfp_port_data *port_data, + struct i2c_client *client, + const char *buf, + unsigned offset, size_t count) +{ + struct i2c_msg msg; + ssize_t status; + unsigned long timeout, write_time; + unsigned next_page_start; + int i = 0; + + /* write max is at most a page + * (In this driver, write_max is actually one byte!) + */ + if (count > port_data->write_max) + count = port_data->write_max; + + /* shorten count if necessary to avoid crossing page boundary */ + next_page_start = roundup(offset + 1, SFF_8436_PAGE_SIZE); + if (offset + count > next_page_start) + count = next_page_start - offset; + + switch (port_data->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + /*smaller eeproms can work given some SMBus extension calls */ + if (count > I2C_SMBUS_BLOCK_MAX) + count = I2C_SMBUS_BLOCK_MAX; + break; + case I2C_SMBUS_WORD_DATA: + /* Check for odd length transaction */ + count = (count == 1) ? 1 : 2; + break; + case I2C_SMBUS_BYTE_DATA: + count = 1; + break; + default: + /* If we'll use I2C calls for I/O, set up the message */ + msg.addr = client->addr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = port_data->writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + break; + } + + /* + * Reads fail if the previous write didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + write_time = jiffies; + + switch (port_data->use_smbus) { + case I2C_SMBUS_I2C_BLOCK_DATA: + status = i2c_smbus_write_i2c_block_data(client, + offset, count, buf); + if (status == 0) + status = count; + break; + case I2C_SMBUS_WORD_DATA: + if (count == 2) { + status = i2c_smbus_write_word_data(client, + offset, (u16)((buf[0])|(buf[1] << 8))); + } else { + /* count = 1 */ + status = i2c_smbus_write_byte_data(client, + offset, buf[0]); + } + if (status == 0) + status = count; + break; + case I2C_SMBUS_BYTE_DATA: + status = i2c_smbus_write_byte_data(client, offset, + buf[0]); + if (status == 0) + status = count; + break; + default: + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + break; + } + + dev_dbg(&client->dev, "eeprom write %zu@%d --> %ld (%lu)\n", + count, offset, (long int) status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(write_time, timeout)); + + return -ETIMEDOUT; +} + + +static ssize_t sff_8436_eeprom_update_client(struct sfp_port_data *port_data, + char *buf, loff_t off, + size_t count, qsfp_opcode_e opcode) +{ + struct i2c_client *client; + ssize_t retval = 0; + u8 page = 0; + loff_t phy_offset = off; + int ret = 0; + + page = sff_8436_translate_offset(port_data, &phy_offset, &client); + + dev_dbg(&client->dev, + "sff_8436_eeprom_update_client off %lld page:%d phy_offset:%lld, count:%ld, opcode:%d\n", + off, page, phy_offset, (long int) count, opcode); + if (page > 0) { + ret = sff_8436_eeprom_write(port_data, client, &page, + SFF_8436_PAGE_SELECT_REG, 1); + if (ret < 0) { + dev_dbg(&client->dev, + "Write page register for page %d failed ret:%d!\n", + page, ret); + return ret; + } + } + + while (count) { + ssize_t status; + + if (opcode == QSFP_READ_OP) { + status = sff_8436_eeprom_read(port_data, client, + buf, phy_offset, count); + } else { + status = sff_8436_eeprom_write(port_data, client, + buf, phy_offset, count); + } + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + phy_offset += status; + count -= status; + retval += status; + } + + + if (page > 0) { + /* return the page register to page 0 (why?) */ + page = 0; + ret = sff_8436_eeprom_write(port_data, client, &page, + SFF_8436_PAGE_SELECT_REG, 1); + if (ret < 0) { + dev_err(&client->dev, + "Restore page register to page %d failed ret:%d!\n", + page, ret); + return ret; + } + } + return retval; +} + + +/* + * Figure out if this access is within the range of supported pages. + * Note this is called on every access because we don't know if the + * module has been replaced since the last call. + * If/when modules support more pages, this is the routine to update + * to validate and allow access to additional pages. + * + * Returns updated len for this access: + * - entire access is legal, original len is returned. + * - access begins legal but is too long, len is truncated to fit. + * - initial offset exceeds supported pages, return -EINVAL + */ +static ssize_t sff_8436_page_legal(struct sfp_port_data *port_data, + loff_t off, size_t len) +{ + struct i2c_client *client = port_data->client; + u8 regval; + int status; + size_t maxlen; + + if (off < 0) return -EINVAL; + if (port_data->driver_type == DRIVER_TYPE_SFP_MSA) { + /* SFP case */ + /* if no pages needed, we're good */ + if ((off + len) <= SFF_8472_EEPROM_UNPAGED_SIZE) return len; + /* if offset exceeds possible pages, we're not good */ + if (off >= SFF_8472_EEPROM_SIZE) return -EINVAL; + /* in between, are pages supported? */ + status = sff_8436_eeprom_read(port_data, client, ®val, + SFF_8472_PAGEABLE_REG, 1); + if (status < 0) return status; /* error out (no module?) */ + if (regval & SFF_8472_PAGEABLE) { + /* Pages supported, trim len to the end of pages */ + maxlen = SFF_8472_EEPROM_SIZE - off; + } else { + /* pages not supported, trim len to unpaged size */ + maxlen = SFF_8472_EEPROM_UNPAGED_SIZE - off; + } + len = (len > maxlen) ? maxlen : len; + dev_dbg(&client->dev, + "page_legal, SFP, off %lld len %ld\n", + off, (long int) len); + } + else if (port_data->driver_type == DRIVER_TYPE_QSFP || + port_data->driver_type == DRIVER_TYPE_XFP) { + /* QSFP case */ + /* if no pages needed, we're good */ + if ((off + len) <= SFF_8436_EEPROM_UNPAGED_SIZE) return len; + /* if offset exceeds possible pages, we're not good */ + if (off >= SFF_8436_EEPROM_SIZE) return -EINVAL; + /* in between, are pages supported? */ + status = sff_8436_eeprom_read(port_data, client, ®val, + SFF_8436_PAGEABLE_REG, 1); + if (status < 0) return status; /* error out (no module?) */ + if (regval & SFF_8436_NOT_PAGEABLE) { + /* pages not supported, trim len to unpaged size */ + maxlen = SFF_8436_EEPROM_UNPAGED_SIZE - off; + } else { + /* Pages supported, trim len to the end of pages */ + maxlen = SFF_8436_EEPROM_SIZE - off; + } + len = (len > maxlen) ? maxlen : len; + dev_dbg(&client->dev, + "page_legal, QSFP, off %lld len %ld\n", + off, (long int) len); + } + else { + return -EINVAL; + } + return len; +} + + +static ssize_t sfp_port_read_write(struct sfp_port_data *port_data, + char *buf, loff_t off, size_t len, qsfp_opcode_e opcode) +{ + struct i2c_client *client = port_data->client; + int chunk; + int status = 0; + ssize_t retval; + size_t pending_len = 0, chunk_len = 0; + loff_t chunk_offset = 0, chunk_start_offset = 0; + + if (unlikely(!len)) + return len; + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&port_data->update_lock); + + /* + * Confirm this access fits within the device suppored addr range + */ + len = sff_8436_page_legal(port_data, off, len); + if (len < 0) { + status = len; + goto err; + } + + /* + * For each (128 byte) chunk involved in this request, issue a + * separate call to sff_eeprom_update_client(), to + * ensure that each access recalculates the client/page + * and writes the page register as needed. + * Note that chunk to page mapping is confusing, is different for + * QSFP and SFP, and never needs to be done. Don't try! + */ + pending_len = len; /* amount remaining to transfer */ + retval = 0; /* amount transferred */ + for (chunk = off >> 7; chunk <= (off + len - 1) >> 7; chunk++) { + + /* + * Compute the offset and number of bytes to be read/write + * + * 1. start at offset 0 (within the chunk), and read/write + * the entire chunk + * 2. start at offset 0 (within the chunk) and read/write less + * than entire chunk + * 3. start at an offset not equal to 0 and read/write the rest + * of the chunk + * 4. start at an offset not equal to 0 and read/write less than + * (end of chunk - offset) + */ + chunk_start_offset = chunk * SFF_8436_PAGE_SIZE; + + if (chunk_start_offset < off) { + chunk_offset = off; + if ((off + pending_len) < (chunk_start_offset + + SFF_8436_PAGE_SIZE)) + chunk_len = pending_len; + else + chunk_len = (chunk+1)*SFF_8436_PAGE_SIZE - off;/*SFF_8436_PAGE_SIZE - off;*/ + } else { + chunk_offset = chunk_start_offset; + if (pending_len > SFF_8436_PAGE_SIZE) + chunk_len = SFF_8436_PAGE_SIZE; + else + chunk_len = pending_len; + } + + dev_dbg(&client->dev, + "sff_r/w: off %lld, len %ld, chunk_start_offset %lld, chunk_offset %lld, chunk_len %ld, pending_len %ld\n", + off, (long int) len, chunk_start_offset, chunk_offset, + (long int) chunk_len, (long int) pending_len); + + /* + * note: chunk_offset is from the start of the EEPROM, + * not the start of the chunk + */ + status = sff_8436_eeprom_update_client(port_data, buf, + chunk_offset, chunk_len, opcode); + if (status != chunk_len) { + /* This is another 'no device present' path */ + dev_dbg(&client->dev, + "sff_8436_update_client for chunk %d chunk_offset %lld chunk_len %ld failed %d!\n", + chunk, chunk_offset, (long int) chunk_len, status); + goto err; + } + buf += status; + pending_len -= status; + retval += status; + } + mutex_unlock(&port_data->update_lock); + + return retval; + +err: + mutex_unlock(&port_data->update_lock); + + return status; +} + +#else +static ssize_t sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; + +} +#endif + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", off, count); + + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + present = sfp_is_port_present(data->client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + +#if (MULTIPAGE_SUPPORT == 1) + return sfp_port_read_write(data, buf, off, count, QSFP_READ_OP); +#else + return sfp_port_read(data, buf, off, count); +#endif +} + +#if (MULTIPAGE_SUPPORT == 1) +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom, size_t size) +#else +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +#endif +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; +#if (MULTIPAGE_SUPPORT == 1) + eeprom->size = size; +#else + eeprom->size = EEPROM_SIZE; +#endif + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + return 0; +} + + +#if (MULTIPAGE_SUPPORT == 0) +static int sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} +#endif + + +static const struct attribute_group qsfp_group = { + .attrs = qsfp_attributes, +}; + +static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + +#if (MULTIPAGE_SUPPORT == 0) + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } +#endif + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ +#if (MULTIPAGE_SUPPORT == 1) + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin, SFF_8436_EEPROM_SIZE); +#else + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); +#endif + if (status) { + goto exit_remove; + } + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &qsfp_group); +exit_free: + kfree(qsfp); +exit: + + return status; +} + +/* Platform dependent +++ */ +static int sfp_device_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int ret = 0; + struct sfp_port_data *data = NULL; + + if (client->addr != SFP_EEPROM_A0_I2C_ADDR) { + return -ENODEV; + } + + if (dev_id->driver_data < as7816_64x_port1 || dev_id->driver_data > as7816_64x_port64) { + return -ENXIO; + } + + data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + +#if (MULTIPAGE_SUPPORT == 1) + data->use_smbus = 0; + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + data->use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + data->use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + data->use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + ret = -EPFNOSUPPORT; + goto exit_kfree; + } + } + + if (!data->use_smbus || + (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) || + i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_WORD_DATA) || + i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + /* + * NOTE: AN-2079 + * Finisar recommends that the host implement 1 byte writes + * only since this module only supports 32 byte page boundaries. + * 2 byte writes are acceptable for PE and Vout changes per + * Application Note AN-2071. + */ + unsigned write_max = 1; + + if (write_max > io_limit) + write_max = io_limit; + if (data->use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + data->write_max = write_max; + + /* buffer (data + address at the beginning) */ + data->writebuf = kmalloc(write_max + 2, GFP_KERNEL); + if (!data->writebuf) { + ret = -ENOMEM; + goto exit_kfree; + } + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + + if (data->use_smbus == I2C_SMBUS_WORD_DATA || + data->use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", data->use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } +#endif + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + data->client = client; + data->driver_type = DRIVER_TYPE_QSFP; + + ret = qsfp_probe(client, dev_id, &data->qsfp); + if (ret < 0) { + goto exit_kfree_buf; + } + + return ret; + +exit_kfree_buf: +#if (MULTIPAGE_SUPPORT == 1) + if (data->writebuf) kfree(data->writebuf); +#endif + +exit_kfree: + kfree(data); + return ret; +} +/* Platform dependent --- */ + +static int qsfp_remove(struct i2c_client *client, struct qsfp_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + return 0; +} + +static int sfp_device_remove(struct i2c_client *client) +{ + int ret = 0; + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (data->driver_type == DRIVER_TYPE_QSFP) { + ret = qsfp_remove(client, data->qsfp); + } + + kfree(data); + return ret; +} + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +static struct i2c_driver sfp_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = sfp_device_probe, + .remove = sfp_device_remove, + .id_table = sfp_device_id, + .address_list = normal_i2c, +}; + +static int __init sfp_init(void) +{ + return i2c_add_driver(&sfp_driver); +} + +static void __exit sfp_exit(void) +{ + i2c_del_driver(&sfp_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as7816_64x_sfp driver"); +MODULE_LICENSE("GPL"); + +module_init(sfp_init); +module_exit(sfp_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/ym2651y.c new file mode 120000 index 000000000000..f4d67640ccc3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/ym2651y.c @@ -0,0 +1 @@ +../../common/modules/ym2651y.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service new file mode 100755 index 000000000000..c1ba30092f1d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Accton AS7816-64X Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/accton_as7816_util.py install +ExecStop=/usr/local/bin/accton_as7816_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/setup.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/setup.py new file mode 100755 index 000000000000..6633b9438b86 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='as7816_64x', + version='1.0', + description='Module to initialize Accton AS7816-64X platforms', + + packages=['as7816_64x'], + package_dir={'as7816_64x': 'as7816-64x/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/README b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/README new file mode 100755 index 000000000000..0b9fc1633999 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/README @@ -0,0 +1,60 @@ +Copyright (C) 2016 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +To initialize the system, run "accton_as7712_util.py install". +To clean up the drivers & devices, run "accton_as7712_util.py clean". +To dump information of sensors, run "accton_as7712_util.py show". +To dump SFP EEPROM, run "accton_as7712_util.py sff". +To set fan speed, run "accton_as7712_util.py set fan". +To enable/disable SFP emission, run "accton_as7712_util.py set sfp". +To set system LEDs' color, run "accton_as7712_util.py set led" +For more information, run "accton_as7712_util.py --help". + +==================================================================== +Besides applying accton_as7712_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +LED controls can be found under /sys/class/leds. The sysfs interface +color mappings are as follows: +Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + +There are 5 system LEDs, loc, diag, fan, ps1, and ps2. +They are lit automatically by CPLD, but the loc and diag. +The loc led has only 1 color, blue. +The diag one has 3 colors: red, amber, and green. + +Fan controls can be found in /sys/bus/i2c/devices/2-0066. +There are 12 fans inside 6 fan modules. +All fans share 1 duty setting, ranged from 0~100. + +Three temperature sensors are controlled by the lm75 kernel modules. +They should already be visible under /sys/bus/i2c/drivers/lm75/. + +Two power supplies are controlled by the CPLD. +Here provide their status under +/sys/bus/i2c/devices/10-0050 and /sys/bus/i2c/devices/11-0053. + +There are 32 QSFP+ modules are equipped. +Apply "accton_as7712_util.py show" to get their status. +Apply "accton_as7712_util.py set sfp" to turn on/off light transmission. +Apply "accton_as7712_util.py sff" to dump EEPROM information. +Before operating on that QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py new file mode 100755 index 000000000000..44c4486a2d59 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py @@ -0,0 +1,523 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'as7816_64x' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan':4,'thermal':6, 'psu':2, 'sfp':64} +FORCE = 0 +#logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +#logging.basicConfig(level=logging.INFO) + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + +kos = [ +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x', +'modprobe accton_i2c_cpld' , +'modprobe ym2651y' , +'modprobe x86-64-accton-as7816-64x-fan' , +'modprobe x86-64-accton-as7816-64x-sfp' , +'modprobe x86-64-accton-as7816-64x-leds' , +'modprobe x86-64-accton-as7816-64x-psu' ] + +def driver_install(): + global FORCE + status, output = log_os_system("depmod", 1) + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +led_prefix ='/sys/class/leds/'+PROJECT_NAME+'_led::' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2']} +hwmon_nodes = {'led': ['brightness'] } +hwmon_prefix ={'led': led_prefix} + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'fan': ['17-0068'] , + 'thermal': ['18-0048','18-0049', '18-004a' , '18-004b', '17-004d', '17-004e'] , + 'psu': ['10-0053','9-0050'], + 'sfp': ['-0050']} +i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'] , + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['sfp_is_present ', 'sfp_tx_disable']} + +sfp_map = [37,38,39,40,42,41,44,43,33,34,35,36,45,46,47,48,49,50,51,52, + 61,62,63,64,53,54,55,56,57,58,59,60,69,70,71,72,77,78,79,80,65, + 66,67,68,73,74,75,76,85,86,87,88,31,32,29,30,81,82,83,84,25,26, + 27,28] + +mknod =[ +'echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-2/new_device', +'echo 24c02 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo as7816_64x_psu1 0x53 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo ym2851 0x5b > /sys/bus/i2c/devices/i2c-10/new_device', +'echo as7816_64x_psu2 0x50 > /sys/bus/i2c/devices/i2c-9/new_device', +'echo ym2851 0x58 > /sys/bus/i2c/devices/i2c-9/new_device', +'echo as7816_64x_fan 0x68 > /sys/bus/i2c/devices/i2c-17/new_device', +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-18/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-18/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-18/new_device', +'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-18/new_device', +'echo lm75 0x4d > /sys/bus/i2c/devices/i2c-17/new_device', +'echo lm75 0x4e > /sys/bus/i2c/devices/i2c-17/new_device', +'echo cpld_as7816 0x60 > /sys/bus/i2c/devices/i2c-19/new_device', +'echo cpld_plain 0x62 > /sys/bus/i2c/devices/i2c-20/new_device', +'echo cpld_plain 0x64 > /sys/bus/i2c/devices/i2c-21/new_device', +'echo cpld_plain 0x66 > /sys/bus/i2c/devices/i2c-22/new_device'] + +def i2c_order_check(): + return 0 + +def device_install(): + global FORCE + + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0,len(sfp_map)): + status, output =log_os_system("echo as7816_64x_port"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/1-0076", 0) + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + nodelist = mknod + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'sfp_eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan'] ['fan1'][0] + node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0076", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_i2c_cpld.c new file mode 100644 index 000000000000..aae4e5538b63 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_i2c_cpld.c @@ -0,0 +1,887 @@ +/* + * A hwmon driver for the accton_i2c_cpld + * + * Copyright (C) 2013 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define MAX_PORT_NUM 64 +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +#define I2C_ADDR_CPLD1 0x60 +#define I2C_ADDR_CPLD2 0x62 +#define I2C_ADDR_CPLD3 0x64 +#define CPLD_ADDRS {I2C_ADDR_CPLD1, I2C_ADDR_CPLD2, I2C_ADDR_CPLD3} + + +/* + * Number of additional attribute pointers to allocate + * with each call to krealloc + */ +#define ATTR_ALLOC_SIZE 1 /*For last attribute which is NUll.*/ + +#define NAME_SIZE 24 +#define MAX_RESP_LENGTH 48 + +typedef ssize_t (*show_func)( struct device *dev, + struct device_attribute *attr, + char *buf); +typedef ssize_t (*store_func)(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count); + +enum models { + AS7712_32X, + AS7716_32X, + AS7816_64X, + AS7312_54X, + PLAIN_CPLD, /*No attribute but add i2c addr to the list.*/ + NUM_MODEL +}; + +enum sfp_func { + HAS_SFP = 1<<0 , + HAS_QSFP = 1<<1 , +}; + +enum common_attrs { + CMN_VERSION, + CMN_ACCESS, + CMN_PRESENT_ALL, + NUM_COMMON_ATTR +}; + +enum sfp_attrs { + SFP_PRESENT, + SFP_RESET, + SFP_LP_MODE, + NUM_SFP_ATTR +}; + +struct cpld_sensor { + struct cpld_sensor *next; + char name[NAME_SIZE+1]; /* sysfs sensor name */ + struct device_attribute attribute; + bool update; /* runtime sensor update needed */ + int data; /* Sensor data. Negative if there was a read error */ + + u8 reg; /* register */ + u8 mask; /* bit mask */ + bool invert; /* inverted value*/ + +}; + +#define to_cpld_sensor(_attr) \ + container_of(_attr, struct cpld_sensor, attribute) + +struct cpld_data { + struct device *dev; + struct device *hwmon_dev; + + int num_attributes; + struct attribute_group group; + + enum models model; + struct cpld_sensor *sensors; + struct mutex update_lock; + bool valid; + unsigned long last_updated; /* in jiffies */ + + int attr_index; + u16 sfp_num; + u8 sfp_types; + struct model_attrs *cmn_attr; +}; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + + +struct base_attrs { + const char *name; + umode_t mode; + show_func get; + store_func set; +}; + +struct attrs { + int reg; + bool invert; + struct base_attrs *base; +}; + +struct model_attrs { + struct attrs **cmn; + struct attrs **portly; +}; + + +static ssize_t show_bit(struct device *dev, + struct device_attribute *devattr, char *buf); +static ssize_t show_presnet_all(struct device *dev, + struct device_attribute *devattr, char *buf); +static ssize_t set_1bit(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_byte(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +int accton_i2c_cpld_read(u8 cpld_addr, u8 reg); +int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + + +struct base_attrs common_attrs[NUM_COMMON_ATTR] = +{ + [CMN_VERSION] = {"version", S_IRUGO, show_bit, NULL}, + [CMN_ACCESS] = {"access", S_IWUSR, NULL, set_byte}, + [CMN_PRESENT_ALL] = {"module_present_all", S_IRUGO, show_presnet_all, NULL}, +}; + +struct attrs as7712_common[] = { + [CMN_VERSION] = {0x01, false, &common_attrs[CMN_VERSION]}, + [CMN_ACCESS] = {0x00, false, &common_attrs[CMN_ACCESS]}, + [CMN_PRESENT_ALL] = {0x30, false, &common_attrs[CMN_PRESENT_ALL]}, +}; +struct attrs as7816_common[] = { + [CMN_VERSION] = {0x01, false, &common_attrs[CMN_VERSION]}, + [CMN_ACCESS] = {0x00, false, &common_attrs[CMN_ACCESS]}, + [CMN_PRESENT_ALL] = {0x30, false, &common_attrs[CMN_PRESENT_ALL]}, +}; +struct attrs as7312_common[] = { + [CMN_VERSION] = {0x01, false, &common_attrs[CMN_VERSION]}, + [CMN_ACCESS] = {0x00, false, &common_attrs[CMN_ACCESS]}, + [CMN_PRESENT_ALL] = {-1, false, &common_attrs[CMN_PRESENT_ALL]}, +}; +struct attrs plain_common[] = { + [CMN_VERSION] = {0x01, false, &common_attrs[CMN_VERSION]}, +}; + +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}, +}; + +struct attrs as7712_port[] = { + {0x30, true, &portly_attrs[SFP_PRESENT]}, + {0x04, true, &portly_attrs[SFP_RESET]}, +}; + +struct attrs as7816_port[] = { + {0x70, true, &portly_attrs[SFP_PRESENT]}, + {0x40, true, &portly_attrs[SFP_RESET]}, +}; + +struct attrs *as7712_cmn_list[] = { + &as7712_common[CMN_VERSION], + &as7712_common[CMN_ACCESS], + &as7712_common[CMN_PRESENT_ALL], + NULL +}; + +struct attrs *as7816_cmn_list[] = { + &as7816_common[CMN_VERSION], + &as7816_common[CMN_ACCESS], + &as7816_common[CMN_PRESENT_ALL], + NULL +}; + +struct attrs *as7312_cmn_list[] = { + &as7312_common[CMN_VERSION], + &as7312_common[CMN_ACCESS], + &as7312_common[CMN_PRESENT_ALL], + NULL +}; + +struct attrs *plain_cmn_list[] = { + &plain_common[CMN_VERSION], + NULL +}; + +struct attrs *as7712_port_list[] = { + &as7712_port[SFP_PRESENT], + &as7712_port[SFP_RESET], + NULL +}; +struct attrs *as7816_port_list[] = { + &as7816_port[SFP_PRESENT], + &as7816_port[SFP_RESET], + NULL +}; + +struct model_attrs models_attr[NUM_MODEL] = { + {.cmn = as7712_cmn_list, .portly=as7712_port_list}, + {.cmn = as7712_cmn_list, .portly=as7712_port_list}, /*7716's as 7712*/ + {.cmn = as7816_cmn_list, .portly=as7816_port_list}, + {.cmn = as7312_cmn_list, .portly=as7816_port_list}, + {.cmn = plain_cmn_list, .portly=NULL}, +}; + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; +/* Addresses scanned for accton_i2c_cpld + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +static int get_sfp_spec(int model, u16 *num, u8 *types) +{ + switch (model) { + case AS7712_32X: + case AS7716_32X: + *num = 32; + *types = HAS_QSFP; + break; + case AS7816_64X: + *num = 64; + *types = HAS_QSFP; + break; + case AS7312_54X: + *num = 54; + *types = HAS_QSFP|HAS_SFP; + default: + *types = 0; + *num = 0; + break; + } + + return 0; +} + +static int get_present_reg(int model, u8 port, u8 *cpld_addr, u8 *reg, u8 *num) +{ + u8 cpld_address[] = CPLD_ADDRS; + + switch (model) { + case AS7312_54X: + if (port < 48) { + *cpld_addr = cpld_address[1 + port/24]; + *reg = 0x09 + (port%24)/8; + *num = 8; + } + else + { + *reg = 0x18; + *num = 4; + *cpld_addr = ( port < 52)? cpld_address[1]: cpld_address[2]; + } + break; + default: + return -EINVAL; + } +} + + +/*Assume the bits for ports are listed in-a-row.*/ +static int get_reg_bit(u8 reg_start, int port, + u8 *reg ,u8 *mask) +{ + *reg = reg_start + ((port)/8); + *mask = 1 << ((port)%8); + + return 0; +} + +static int cpld_write_internal( + struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static int cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + + +/*Turn a numberic array into string with " " between each element. + * e.g., {0x11, 0x33, 0xff, 0xf1} => "11 33 ff f1" + */ +static ssize_t array_stringify(char *buf, u8 *input, size_t size) { + + int i; + char t[MAX_RESP_LENGTH+1]; + + buf[0] = '\0'; + for (i = 0; i < size; i++) { + snprintf(t, MAX_RESP_LENGTH, "%x ", input[i]); + strncat(buf, t, MAX_RESP_LENGTH); + } + + if (strlen(buf) > 0) + buf[strlen(buf)-1] = '\0'; /*Remove tailing blank*/ + + return snprintf(buf, MAX_RESP_LENGTH, "%s\n", buf); +} + +static ssize_t show_presnet_all_distinct(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 i, value, reg; + u8 cpld_addr, num; + u8 _value[8]; + u64 *values = (u64 *)_value; + + values = 0; + mutex_lock(&data->update_lock); + while(i < data->sfp_num) + { + get_present_reg(data->model, i, &cpld_addr, ®, &num); + if(cpld_addr == client->addr) + value = cpld_read_internal(client, reg); + else + value = accton_i2c_cpld_read(cpld_addr, reg); + + if (unlikely(value < 0)) { + goto exit; + } + + *values |= (value&((1<<(num))-1)) << i; + i += num; + } + mutex_unlock(&data->update_lock); + + *values = cpu_to_le64(*values); + return array_stringify(buf, _value, i); +exit: + mutex_unlock(&data->update_lock); + return value; +} + +static ssize_t show_presnet_all(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + struct cpld_sensor *sensor = to_cpld_sensor(devattr); + u8 i, values[MAX_RESP_LENGTH/8]; + + if (sensor->reg < 0) { + return show_presnet_all_distinct(dev, devattr, buf); + } + + mutex_lock(&data->update_lock); + for (i = 0; i < ((data->sfp_num+7)/8); i++) { + values[i] = cpld_read_internal(client, sensor->reg + i); + if (unlikely(values[i] < 0)) { + goto exit; + } + } + mutex_unlock(&data->update_lock); + return array_stringify(buf, values, i); + +exit: + mutex_unlock(&data->update_lock); + return values[i]; +} + +static ssize_t show_bit(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int value; + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + struct cpld_sensor *sensor = to_cpld_sensor(devattr); + + mutex_lock(&data->update_lock); + value = cpld_read_internal(client, sensor->reg); + value = value & sensor->mask; + if (sensor->invert) + value = !value; + mutex_unlock(&data->update_lock); + + return snprintf(buf, PAGE_SIZE, "%x\n", value); +} + +static ssize_t set_1bit(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + long is_reset; + int value, status; + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + struct cpld_sensor *sensor = to_cpld_sensor(devattr); + u8 cpld_bit, reg; + + status = kstrtol(buf, 10, &is_reset); + if (status) { + return status; + } + reg = sensor->reg; + cpld_bit = sensor->mask; + mutex_lock(&data->update_lock); + value = cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + if (sensor->invert) + is_reset = !is_reset; + + if (is_reset) { + value |= cpld_bit; + } + else { + value &= ~cpld_bit; + } + + status = cpld_write_internal(client, reg, value); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_byte(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + return access(dev, da, buf, count); +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static void accton_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = + kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", + client->addr); + return; + } + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void accton_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int cpld_add_attribute(struct cpld_data *data, struct attribute *attr) +{ + int new_max_attrs = ++data->num_attributes + ATTR_ALLOC_SIZE; + void *new_attrs = krealloc(data->group.attrs, + new_max_attrs * sizeof(void *), + GFP_KERNEL); + if (!new_attrs) + return -ENOMEM; + data->group.attrs = new_attrs; + + + data->group.attrs[data->num_attributes-1] = attr; + data->group.attrs[data->num_attributes] = NULL; + + return 0; +} + +static void cpld_dev_attr_init(struct device_attribute *dev_attr, + const char *name, umode_t mode, + show_func show, store_func store) +{ + sysfs_attr_init(&dev_attr->attr); + dev_attr->attr.name = name; + dev_attr->attr.mode = mode; + dev_attr->show = show; + dev_attr->store = store; +} + +static struct cpld_sensor * add_sensor(struct cpld_data *data, + const char *name, + u8 reg, u8 mask, bool invert, + bool update, umode_t mode, + show_func get, store_func set) +{ + struct cpld_sensor *sensor; + struct device_attribute *a; + + sensor = devm_kzalloc(data->dev, sizeof(*sensor), GFP_KERNEL); + if (!sensor) + return NULL; + a = &sensor->attribute; + + snprintf(sensor->name, sizeof(sensor->name), name); + sensor->reg = reg; + sensor->mask = mask; + sensor->update = update; + sensor->invert = invert; + cpld_dev_attr_init(a, sensor->name, + mode, + get, set); + + if (cpld_add_attribute(data, &a->attr)) + return NULL; + + sensor->next = data->sensors; + data->sensors = sensor; + + return sensor; +} + +static int add_attributes_cmn(struct cpld_data *data, struct attrs **cmn) +{ + u8 reg, i ; + bool invert; + struct attrs *a; + struct base_attrs *b; + + if (NULL == cmn) + return -1; + + for (i = 0; cmn[i]; i++) + { + a = cmn[i]; + + reg = a->reg; + invert = a->invert; + + b = a->base; + if (NULL == b) + break; + + if (add_sensor(data, b->name, + reg, 0xff, invert, + true, b->mode, + b->get, b->set) == NULL) + { + return -ENOMEM; + } + } + return 0; +} + +static int add_attributes_portly(struct cpld_data *data, struct attrs **pa) +{ + char name[NAME_SIZE+1]; + int i, j; + u8 reg, mask, invert; + struct attrs *a; + struct base_attrs *b; + + if (NULL == pa) + return -1; + + + for (i = 0; pa[i]; i++) { + a = pa[i]; + + invert = a->invert; + b = a->base; + if (b == NULL) + break; + + for (j = 0; j < data->sfp_num; j++) + { + snprintf(name, NAME_SIZE, "%s_%d", b->name, j+1); + get_reg_bit(a->reg, j, ®, &mask); + + if (add_sensor(data, name, reg, mask, invert, + true, b->mode, b->get, b->set) == NULL) + { + return -ENOMEM; + } + } + } + return 0; +} + +static int add_attributes(struct i2c_client *client, + struct cpld_data *data) +{ + struct model_attrs *m = data->cmn_attr; + + if (m == NULL) + return -EINVAL; + + /* Common attributes.*/ + add_attributes_cmn(data, m->cmn); + + /* Port-wise attributes.*/ + add_attributes_portly(data, m->portly); + + return 0; +} + +static int accton_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct cpld_data *data = NULL; + struct device *dev = &client->dev; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + return -EIO; + } + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + data->model = dev_id->driver_data; + data->cmn_attr = &models_attr[data->model]; + get_sfp_spec(data->model, &data->sfp_num, &data->sfp_types); + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->dev = dev; + dev_info(dev, "chip found\n"); + + status = add_attributes(client, data); + if (status) + goto out_kfree; + + /* + * If there are no attributes, something is wrong. + * Bail out instead of trying to register nothing. + */ + if (!data->num_attributes) { + dev_err(dev, "No attributes found\n"); + status = -ENODEV; + goto out_kfree; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &data->group); + if (status) { + goto out_kfree; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + accton_i2c_cpld_add_client(client); + dev_info(dev, "%s: cpld '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; +exit_remove: + sysfs_remove_group(&client->dev.kobj, &data->group); +out_kfree: + kfree(data->group.attrs); + return status; + +} + +static int accton_i2c_cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &data->group); + kfree(data->group.attrs); + accton_i2c_cpld_remove_client(client); + return 0; +} + +int accton_i2c_cpld_read(u8 cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_read); + +int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_write); + + +static const struct i2c_device_id accton_i2c_cpld_id[] = { + { "cpld_as7712", AS7712_32X}, + { "cpld_as7716", AS7716_32X}, + { "cpld_as7816", AS7816_64X}, + { "cpld_as7312", AS7312_54X}, + { "cpld_plain", PLAIN_CPLD}, + { }, +}; +MODULE_DEVICE_TABLE(i2c, accton_i2c_cpld_id); + +static struct i2c_driver accton_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "accton_i2c_cpld", + }, + .probe = accton_i2c_cpld_probe, + .remove = accton_i2c_cpld_remove, + .id_table = accton_i2c_cpld_id, + .address_list = normal_i2c, +}; + + +static int __init accton_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&accton_i2c_cpld_driver); +} + +static void __exit accton_i2c_cpld_exit(void) +{ + i2c_del_driver(&accton_i2c_cpld_driver); +} + +module_init(accton_i2c_cpld_init); +module_exit(accton_i2c_cpld_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_i2c_cpld driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_pmbus_3y.c b/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_pmbus_3y.c new file mode 100644 index 000000000000..ed176189cdcd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_pmbus_3y.c @@ -0,0 +1,1978 @@ +/* + * Hardware monitoring driver for 3Y power devices. + * + * Copyright (C) 2018 Accton Technology Corporation. + * Roy Lee + * + * Based on pmbus.c, pmbus.h and pmbus_core.c. + * Copyright 2012 Guenter Roeck/Ericsson AB. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pmbus.h" + + +enum chips { + YM2651, + YM2401, + YM2851, + LIMITED_CHIPS, +}; + + +/* + * Number of additional attribute pointers to allocate + * with each call to krealloc + */ +#define PMBUS_ATTR_ALLOC_SIZE 32 + +/* + * Index into status register array, per status register group + */ +#define PB_STATUS_BASE 0 +#define PB_STATUS_VOUT_BASE (PB_STATUS_BASE + PMBUS_PAGES) +#define PB_STATUS_IOUT_BASE (PB_STATUS_VOUT_BASE + PMBUS_PAGES) +#define PB_STATUS_FAN_BASE (PB_STATUS_IOUT_BASE + PMBUS_PAGES) +#define PB_STATUS_FAN34_BASE (PB_STATUS_FAN_BASE + PMBUS_PAGES) +#define PB_STATUS_TEMP_BASE (PB_STATUS_FAN34_BASE + PMBUS_PAGES) +#define PB_STATUS_INPUT_BASE (PB_STATUS_TEMP_BASE + PMBUS_PAGES) +#define PB_STATUS_VMON_BASE (PB_STATUS_INPUT_BASE + 1) + +#define PB_NUM_STATUS_REG (PB_STATUS_VMON_BASE + 1) + +#define PMBUS_NAME_SIZE 24 + +struct pmbus_sensor { + struct pmbus_sensor *next; + char name[PMBUS_NAME_SIZE]; /* sysfs sensor name */ + struct device_attribute attribute; + u8 page; /* page number */ + u16 reg; /* register */ + enum pmbus_sensor_classes class; /* sensor class */ + bool update; /* runtime sensor update needed */ + int data; /* Sensor data. + Negative if there was a read error */ +}; +#define to_pmbus_sensor(_attr) \ + container_of(_attr, struct pmbus_sensor, attribute) + +struct pmbus_boolean { + char name[PMBUS_NAME_SIZE]; /* sysfs boolean name */ + struct sensor_device_attribute attribute; + struct pmbus_sensor *s1; + struct pmbus_sensor *s2; +}; +#define to_pmbus_boolean(_attr) \ + container_of(_attr, struct pmbus_boolean, attribute) + +struct pmbus_label { + char name[PMBUS_NAME_SIZE]; /* sysfs label name */ + struct device_attribute attribute; + char label[PMBUS_NAME_SIZE]; /* label */ +}; +#define to_pmbus_label(_attr) \ + container_of(_attr, struct pmbus_label, attribute) + +struct pmbus_data { + struct device *dev; + struct device *hwmon_dev; + + u32 flags; /* from platform data */ + + int exponent[PMBUS_PAGES]; + /* linear mode: exponent for output voltages */ + + const struct pmbus_driver_info *info; + + int max_attributes; + int num_attributes; + struct attribute_group group; + const struct attribute_group *groups[2]; + + struct pmbus_sensor *sensors; + + struct mutex update_lock; + bool valid; + unsigned long last_updated; /* in jiffies */ + + /* + * A single status register covers multiple attributes, + * so we keep them all together. + */ + u8 status[PB_NUM_STATUS_REG]; + u8 status_register; + + u8 currpage; + bool linear_16; +}; + + +static int limited_models(const struct i2c_device_id *id); + +int _pmbus_set_page(struct i2c_client *client, u8 page) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + int rv = 0; + int newpage; + + if (page != data->currpage) { + rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE, page); + newpage = i2c_smbus_read_byte_data(client, PMBUS_PAGE); + if (newpage != page) + rv = -EIO; + else + data->currpage = page; + } + return 0; +} + +/* + * _pmbus_write_byte() is similar to pmbus_write_byte(), but checks if + * a device specific mapping function exists and calls it if necessary. + */ +static int _pmbus_write_byte(struct i2c_client *client, int page, u8 value) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + const struct pmbus_driver_info *info = data->info; + int status; + + if (info->write_byte) { + status = info->write_byte(client, page, value); + if (status != -ENODATA) + return status; + } + /*Ignore page*/ + return i2c_smbus_write_byte(client, value);; +} + +/* + * _pmbus_write_word_data() is similar to pmbus_write_word_data(), but checks if + * a device specific mapping function exists and calls it if necessary. + */ +static int _pmbus_write_word_data(struct i2c_client *client, int page, int reg, + u16 word) +{ + if (reg >= PMBUS_VIRT_BASE) + return -ENXIO; + /*Ignore page*/ + return i2c_smbus_write_word_data(client, reg, word); +} + +/* + * _pmbus_read_word_data() is similar to pmbus_read_word_data(), but checks if + * a device specific mapping function exists and calls it if necessary. + */ +static int _pmbus_read_word_data(struct i2c_client *client, int page, int reg) +{ + /*Ignore page*/ + return i2c_smbus_read_word_data(client, reg);; +} + +/* + * _pmbus_read_byte_data() is similar to pmbus_read_byte_data(), but checks if + * a device specific mapping function exists and calls it if necessary. + */ +static int _pmbus_read_byte_data(struct i2c_client *client, int page, int reg) +{ + if (reg >= PMBUS_VIRT_BASE) + return -ENXIO; + + /*Ignore page*/ + return i2c_smbus_read_byte_data(client, reg); +} + +static void pmbus_clear_fault_page(struct i2c_client *client, int page) +{ + _pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS); +} + + +static int pmbus_check_status_cml(struct i2c_client *client) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + int status, status2; + + status = _pmbus_read_byte_data(client, -1, data->status_register); + if (status < 0 || (status & PB_STATUS_CML)) { + status2 = _pmbus_read_byte_data(client, -1, PMBUS_STATUS_CML); + if (status2 < 0 || (status2 & PB_CML_FAULT_INVALID_COMMAND)) + return -EIO; + } + return 0; +} + +static bool pmbus_check_register(struct i2c_client *client, + int (*func)(struct i2c_client *client, + int page, int reg), + int page, int reg) +{ + int rv; + struct pmbus_data *data = i2c_get_clientdata(client); + + if((data->flags & PMBUS_SKIP_STATUS_CHECK)) + return 1; + + rv = func(client, page, reg); + if (rv >= 0) + rv = pmbus_check_status_cml(client); + pmbus_clear_fault_page(client, -1); + return rv >= 0; +} + +static struct _pmbus_status { + u32 func; + u16 base; + u16 reg; +} pmbus_status[] = { + { PMBUS_HAVE_STATUS_VOUT, PB_STATUS_VOUT_BASE, PMBUS_STATUS_VOUT }, + { PMBUS_HAVE_STATUS_IOUT, PB_STATUS_IOUT_BASE, PMBUS_STATUS_IOUT }, + { PMBUS_HAVE_STATUS_TEMP, PB_STATUS_TEMP_BASE, + PMBUS_STATUS_TEMPERATURE + }, + { PMBUS_HAVE_STATUS_FAN12, PB_STATUS_FAN_BASE, PMBUS_STATUS_FAN_12 }, + { PMBUS_HAVE_STATUS_FAN34, PB_STATUS_FAN34_BASE, PMBUS_STATUS_FAN_34 }, +}; + +void _pmbus_clear_faults(struct i2c_client *client) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + int i; + + for (i = 0; i < data->info->pages; i++) + pmbus_clear_fault_page(client, i); +} +static struct pmbus_data *pmbus_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev->parent); + struct pmbus_data *data = i2c_get_clientdata(client); + const struct pmbus_driver_info *info = data->info; + struct pmbus_sensor *sensor; + + mutex_lock(&data->update_lock); + if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { + int i, j; + + for (i = 0; i < info->pages; i++) { + data->status[PB_STATUS_BASE + i] + = _pmbus_read_byte_data(client, i, + data->status_register); + for (j = 0; j < ARRAY_SIZE(pmbus_status); j++) { + struct _pmbus_status *s = &pmbus_status[j]; + + if (!(info->func[i] & s->func)) + continue; + data->status[s->base + i] + = _pmbus_read_byte_data(client, i, + s->reg); + } + } + + if (info->func[0] & PMBUS_HAVE_STATUS_INPUT) + data->status[PB_STATUS_INPUT_BASE] + = _pmbus_read_byte_data(client, 0, + PMBUS_STATUS_INPUT); + + if (info->func[0] & PMBUS_HAVE_STATUS_VMON) + data->status[PB_STATUS_VMON_BASE] + = _pmbus_read_byte_data(client, 0, + PMBUS_VIRT_STATUS_VMON); + + for (sensor = data->sensors; sensor; sensor = sensor->next) { + if (!data->valid || sensor->update) + sensor->data + = _pmbus_read_word_data(client, + sensor->page, + sensor->reg); + } + _pmbus_clear_faults(client); + data->last_updated = jiffies; + data->valid = 1; + } + mutex_unlock(&data->update_lock); + return data; +} + +/* + * Convert linear sensor values to milli- or micro-units + * depending on sensor type. + */ +static long pmbus_reg2data_linear(struct pmbus_data *data, + struct pmbus_sensor *sensor) +{ + s16 exponent; + s32 mantissa; + long val; + + /* LINEAR16 */ + if ( data->linear_16 && + sensor->class == PSC_VOLTAGE_OUT) { + exponent = data->exponent[sensor->page]; + mantissa = (u16) sensor->data; + } else + { /* LINEAR11 */ + exponent = ((s16)sensor->data) >> 11; + mantissa = ((s16)((sensor->data & 0x7ff) << 5)) >> 5; + } + + val = mantissa; + + /* scale result to milli-units for all sensors except fans */ + if (sensor->class != PSC_FAN) + val = val * 1000L; + + /* scale result to micro-units for power sensors */ + if (sensor->class == PSC_POWER) + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val; +} + +/* + * Convert direct sensor values to milli- or micro-units + * depending on sensor type. + */ +static long pmbus_reg2data_direct(struct pmbus_data *data, + struct pmbus_sensor *sensor) +{ + long val = (s16) sensor->data; + long m, b, R; + + m = data->info->m[sensor->class]; + b = data->info->b[sensor->class]; + R = data->info->R[sensor->class]; + + if (m == 0) + return 0; + + /* X = 1/m * (Y * 10^-R - b) */ + R = -R; + /* scale result to milli-units for everything but fans */ + if (sensor->class != PSC_FAN) { + R += 3; + b *= 1000; + } + + /* scale result to micro-units for power sensors */ + if (sensor->class == PSC_POWER) { + R += 3; + b *= 1000; + } + + while (R > 0) { + val *= 10; + R--; + } + while (R < 0) { + val = DIV_ROUND_CLOSEST(val, 10); + R++; + } + + return (val - b) / m; +} + +/* + * Convert VID sensor values to milli- or micro-units + * depending on sensor type. + * We currently only support VR11. + */ +static long pmbus_reg2data_vid(struct pmbus_data *data, + struct pmbus_sensor *sensor) +{ + long val = sensor->data; + + if (val < 0x02 || val > 0xb2) + return 0; + return DIV_ROUND_CLOSEST(160000 - (val - 2) * 625, 100); +} + +static long pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor) +{ + long val; + + switch (data->info->format[sensor->class]) { + case direct: + val = pmbus_reg2data_direct(data, sensor); + break; + case vid: + val = pmbus_reg2data_vid(data, sensor); + break; + case linear: + default: + val = pmbus_reg2data_linear(data, sensor); + break; + } + return val; +} + +#define MAX_MANTISSA (1023 * 1000) +#define MIN_MANTISSA (511 * 1000) + +static u16 pmbus_data2reg_linear(struct pmbus_data *data, + struct pmbus_sensor *sensor, long val) +{ + s16 exponent = 0, mantissa; + bool negative = false; + + /* simple case */ + if (val == 0) + return 0; + + if (data->linear_16 && + sensor->class == PSC_VOLTAGE_OUT) { + /* LINEAR16 does not support negative voltages */ + if (val < 0) + return 0; + + /* + * For a static exponents, we don't have a choice + * but to adjust the value to it. + */ + if (data->exponent[sensor->page] < 0) + val <<= -data->exponent[sensor->page]; + else + val >>= data->exponent[sensor->page]; + val = DIV_ROUND_CLOSEST(val, 1000); + return val & 0xffff; + } + + if (val < 0) { + negative = true; + val = -val; + } + + /* Power is in uW. Convert to mW before converting. */ + if (sensor->class == PSC_POWER) + val = DIV_ROUND_CLOSEST(val, 1000L); + + /* + * For simplicity, convert fan data to milli-units + * before calculating the exponent. + */ + if (sensor->class == PSC_FAN) + val = val * 1000; + + /* Reduce large mantissa until it fits into 10 bit */ + while (val >= MAX_MANTISSA && exponent < 15) { + exponent++; + val >>= 1; + } + /* Increase small mantissa to improve precision */ + while (val < MIN_MANTISSA && exponent > -15) { + exponent--; + val <<= 1; + } + + /* Convert mantissa from milli-units to units */ + mantissa = DIV_ROUND_CLOSEST(val, 1000); + + /* Ensure that resulting number is within range */ + if (mantissa > 0x3ff) + mantissa = 0x3ff; + + /* restore sign */ + if (negative) + mantissa = -mantissa; + + /* Convert to 5 bit exponent, 11 bit mantissa */ + return (mantissa & 0x7ff) | ((exponent << 11) & 0xf800); +} + +static u16 pmbus_data2reg_direct(struct pmbus_data *data, + struct pmbus_sensor *sensor, long val) +{ + long m, b, R; + + m = data->info->m[sensor->class]; + b = data->info->b[sensor->class]; + R = data->info->R[sensor->class]; + + /* Power is in uW. Adjust R and b. */ + if (sensor->class == PSC_POWER) { + R -= 3; + b *= 1000; + } + + /* Calculate Y = (m * X + b) * 10^R */ + if (sensor->class != PSC_FAN) { + R -= 3; /* Adjust R and b for data in milli-units */ + b *= 1000; + } + val = val * m + b; + + while (R > 0) { + val *= 10; + R--; + } + while (R < 0) { + val = DIV_ROUND_CLOSEST(val, 10); + R++; + } + + return val; +} + +static u16 pmbus_data2reg_vid(struct pmbus_data *data, + struct pmbus_sensor *sensor, long val) +{ + val = clamp_val(val, 500, 1600); + + return 2 + DIV_ROUND_CLOSEST((1600 - val) * 100, 625); +} + +static u16 pmbus_data2reg(struct pmbus_data *data, + struct pmbus_sensor *sensor, long val) +{ + u16 regval; + + switch (data->info->format[sensor->class]) { + case direct: + regval = pmbus_data2reg_direct(data, sensor, val); + break; + case vid: + regval = pmbus_data2reg_vid(data, sensor, val); + break; + case linear: + default: + regval = pmbus_data2reg_linear(data, sensor, val); + break; + } + return regval; +} + +/* + * Return boolean calculated from converted data. + * defines a status register index and mask. + * The mask is in the lower 8 bits, the register index is in bits 8..23. + * + * The associated pmbus_boolean structure contains optional pointers to two + * sensor attributes. If specified, those attributes are compared against each + * other to determine if a limit has been exceeded. + * + * If the sensor attribute pointers are NULL, the function returns true if + * (status[reg] & mask) is true. + * + * If sensor attribute pointers are provided, a comparison against a specified + * limit has to be performed to determine the boolean result. + * In this case, the function returns true if v1 >= v2 (where v1 and v2 are + * sensor values referenced by sensor attribute pointers s1 and s2). + * + * To determine if an object exceeds upper limits, specify = . + * To determine if an object exceeds lower limits, specify = . + * + * If a negative value is stored in any of the referenced registers, this value + * reflects an error code which will be returned. + */ +static int pmbus_get_boolean(struct pmbus_data *data, struct pmbus_boolean *b, + int index) +{ + struct pmbus_sensor *s1 = b->s1; + struct pmbus_sensor *s2 = b->s2; + u16 reg = (index >> 8) & 0xffff; + u8 mask = index & 0xff; + int ret, status; + u8 regval; + + status = data->status[reg]; + if (status < 0) + return status; + + regval = status & mask; + if (!s1 && !s2) { + ret = !!regval; + } else if (!s1 || !s2) { + WARN(1, "Bad boolean descriptor %p: s1=%p, s2=%p\n", b, s1, s2); + return 0; + } else { + long v1, v2; + + if (s1->data < 0) + return s1->data; + if (s2->data < 0) + return s2->data; + + v1 = pmbus_reg2data(data, s1); + v2 = pmbus_reg2data(data, s2); + ret = !!(regval && v1 >= v2); + } + return ret; +} + +static ssize_t pmbus_show_boolean(struct device *dev, + struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct pmbus_boolean *boolean = to_pmbus_boolean(attr); + struct pmbus_data *data = pmbus_update_device(dev); + int val; + + val = pmbus_get_boolean(data, boolean, attr->index); + if (val < 0) { + return snprintf(buf, PAGE_SIZE, "%d\n", 1); + } + return snprintf(buf, PAGE_SIZE, "%d\n", val); +} + +static ssize_t pmbus_show_sensor(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct pmbus_data *data = pmbus_update_device(dev); + struct pmbus_sensor *sensor = to_pmbus_sensor(devattr); + + + if (sensor->data < 0) { + return snprintf(buf, PAGE_SIZE, "%d\n", 0); + } + + + return snprintf(buf, PAGE_SIZE, "%ld\n", pmbus_reg2data(data, sensor)); +} + +static ssize_t pmbus_set_sensor(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev->parent); + struct pmbus_data *data = i2c_get_clientdata(client); + struct pmbus_sensor *sensor = to_pmbus_sensor(devattr); + ssize_t rv = count; + long val = 0; + int ret; + u16 regval; + + if (kstrtol(buf, 10, &val) < 0) + return -EINVAL; + + mutex_lock(&data->update_lock); + regval = pmbus_data2reg(data, sensor, val); + ret = _pmbus_write_word_data(client, sensor->page, sensor->reg, regval); + if (ret < 0) + rv = ret; + else + sensor->data = regval; + mutex_unlock(&data->update_lock); + return rv; +} + +static ssize_t pmbus_show_label(struct device *dev, + struct device_attribute *da, char *buf) +{ + struct pmbus_label *label = to_pmbus_label(da); + + return snprintf(buf, PAGE_SIZE, "%s\n", label->label); +} + +static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr) +{ + if (data->num_attributes >= data->max_attributes - 1) { + int new_max_attrs = data->max_attributes + PMBUS_ATTR_ALLOC_SIZE; + void *new_attrs = krealloc(data->group.attrs, + new_max_attrs * sizeof(void *), + GFP_KERNEL); + if (!new_attrs) + return -ENOMEM; + data->group.attrs = new_attrs; + data->max_attributes = new_max_attrs; + } + + + + data->group.attrs[data->num_attributes++] = attr; + data->group.attrs[data->num_attributes] = NULL; + return 0; +} + +static void pmbus_dev_attr_init(struct device_attribute *dev_attr, + const char *name, + umode_t mode, + ssize_t (*show)(struct device *dev, + struct device_attribute *attr, + char *buf), + ssize_t (*store)(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count)) +{ + sysfs_attr_init(&dev_attr->attr); + dev_attr->attr.name = name; + dev_attr->attr.mode = mode; + dev_attr->show = show; + dev_attr->store = store; +} + +static void pmbus_attr_init(struct sensor_device_attribute *a, + const char *name, + umode_t mode, + ssize_t (*show)(struct device *dev, + struct device_attribute *attr, + char *buf), + ssize_t (*store)(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count), + int idx) +{ + pmbus_dev_attr_init(&a->dev_attr, name, mode, show, store); + a->index = idx; +} + +static int pmbus_add_boolean(struct pmbus_data *data, + const char *name, const char *type, int seq, + struct pmbus_sensor *s1, + struct pmbus_sensor *s2, + u16 reg, u8 mask) +{ + struct pmbus_boolean *boolean; + struct sensor_device_attribute *a; + + boolean = devm_kzalloc(data->dev, sizeof(*boolean), GFP_KERNEL); + if (!boolean) + return -ENOMEM; + + a = &boolean->attribute; + + snprintf(boolean->name, sizeof(boolean->name), "%s%d_%s", + name, seq, type); + boolean->s1 = s1; + boolean->s2 = s2; + pmbus_attr_init(a, boolean->name, S_IRUGO, pmbus_show_boolean, NULL, + (reg << 8) | mask); + + return pmbus_add_attribute(data, &a->dev_attr.attr); +} + +static struct pmbus_sensor *pmbus_add_sensor(struct pmbus_data *data, + const char *name, const char *type, + int seq, int page, int reg, + enum pmbus_sensor_classes class, + bool update, bool readonly) +{ + struct pmbus_sensor *sensor; + struct device_attribute *a; + + sensor = devm_kzalloc(data->dev, sizeof(*sensor), GFP_KERNEL); + if (!sensor) + return NULL; + a = &sensor->attribute; + + snprintf(sensor->name, sizeof(sensor->name), "%s%d_%s", + name, seq, type); + sensor->page = page; + sensor->reg = reg; + sensor->class = class; + sensor->update = update; + pmbus_dev_attr_init(a, sensor->name, + readonly ? S_IRUGO : S_IRUGO | S_IWUSR, + pmbus_show_sensor, pmbus_set_sensor); + + if (pmbus_add_attribute(data, &a->attr)) + return NULL; + + sensor->next = data->sensors; + data->sensors = sensor; + + return sensor; +} + +static int pmbus_add_label(struct pmbus_data *data, + const char *name, int seq, + const char *lstring, int index) +{ + struct pmbus_label *label; + struct device_attribute *a; + + label = devm_kzalloc(data->dev, sizeof(*label), GFP_KERNEL); + if (!label) + return -ENOMEM; + + a = &label->attribute; + + snprintf(label->name, sizeof(label->name), "%s%d_label", name, seq); + if (!index) + strncpy(label->label, lstring, sizeof(label->label) - 1); + else + snprintf(label->label, sizeof(label->label), "%s%d", lstring, + index); + + pmbus_dev_attr_init(a, label->name, S_IRUGO, pmbus_show_label, NULL); + return pmbus_add_attribute(data, &a->attr); +} + +/* + * Search for attributes. Allocate sensors, booleans, and labels as needed. + */ + +/* + * The pmbus_limit_attr structure describes a single limit attribute + * and its associated alarm attribute. + */ +struct pmbus_limit_attr { + u16 reg; /* Limit register */ + u16 sbit; /* Alarm attribute status bit */ + bool update; /* True if register needs updates */ + bool low; /* True if low limit; for limits with compare + functions only */ + const char *attr; /* Attribute name */ + const char *alarm; /* Alarm attribute name */ +}; + +/* + * The pmbus_sensor_attr structure describes one sensor attribute. This + * description includes a reference to the associated limit attributes. + */ +struct pmbus_sensor_attr { + u16 reg; /* sensor register */ + u8 gbit; /* generic status bit */ + u8 nlimit; /* # of limit registers */ + enum pmbus_sensor_classes class;/* sensor class */ + const char *label; /* sensor label */ + bool paged; /* true if paged sensor */ + bool update; /* true if update needed */ + bool compare; /* true if compare function needed */ + u32 func; /* sensor mask */ + u32 sfunc; /* sensor status mask */ + int sbase; /* status base register */ + const struct pmbus_limit_attr *limit;/* limit registers */ +}; + +/* + * Add a set of limit attributes and, if supported, the associated + * alarm attributes. + * returns 0 if no alarm register found, 1 if an alarm register was found, + * < 0 on errors. + */ +static int pmbus_add_limit_attrs(struct i2c_client *client, + struct pmbus_data *data, + const struct pmbus_driver_info *info, + const char *name, int index, int page, + struct pmbus_sensor *base, + const struct pmbus_sensor_attr *attr) +{ + const struct pmbus_limit_attr *l = attr->limit; + int nlimit = attr->nlimit; + int have_alarm = 0; + int i, ret; + struct pmbus_sensor *curr; + + for (i = 0; i < nlimit; i++) { + if (_pmbus_check_word_register(client, page, l->reg)) + { + curr = pmbus_add_sensor(data, name, l->attr, index, + page, l->reg, attr->class, + attr->update || l->update, + false); + if (!curr) + return -ENOMEM; + if (l->sbit && (info->func[page] & attr->sfunc)) { + ret = pmbus_add_boolean(data, name, + l->alarm, index, + attr->compare ? l->low ? curr : base + : NULL, + attr->compare ? l->low ? base : curr + : NULL, + attr->sbase + page, l->sbit); + if (ret) + return ret; + have_alarm = 1; + } + } + l++; + } + return have_alarm; +} + +bool _pmbus_check_byte_register(struct i2c_client *client, int page, int reg) +{ + return pmbus_check_register(client, _pmbus_read_byte_data, page, reg); +} + + +bool _pmbus_check_word_register(struct i2c_client *client, int page, int reg) +{ + return pmbus_check_register(client, _pmbus_read_word_data, page, reg); +} + +static int pmbus_add_sensor_attrs_one(struct i2c_client *client, + struct pmbus_data *data, + const struct pmbus_driver_info *info, + const char *name, + int index, int page, + const struct pmbus_sensor_attr *attr) +{ + struct pmbus_sensor *base; + int ret; + + if (attr->label) { + ret = pmbus_add_label(data, name, index, attr->label, + attr->paged ? page + 1 : 0); + if (ret) + return ret; + } + base = pmbus_add_sensor(data, name, "input", index, page, attr->reg, + attr->class, true, true); + + + if (!base) + return -ENOMEM; + + if (attr->sfunc) { + ret = pmbus_add_limit_attrs(client, data, info, name, + index, page, base, attr); + if (ret < 0) + return ret; + /* + * Add generic alarm attribute only if there are no individual + * alarm attributes, if there is a global alarm bit, and if + * the generic status register for this page is accessible. + */ + if (!ret && attr->gbit && + _pmbus_check_byte_register(client, page, + data->status_register)) { + ret = pmbus_add_boolean(data, name, "alarm", index, + NULL, NULL, + PB_STATUS_BASE + page, + attr->gbit); + if (ret) + return ret; + } + } + return 0; +} + +static int pmbus_add_sensor_attrs(struct i2c_client *client, + struct pmbus_data *data, + const char *name, + const struct pmbus_sensor_attr *attrs, + int nattrs) +{ + const struct pmbus_driver_info *info = data->info; + int index, i; + int ret; + + index = 1; + for (i = 0; i < nattrs; i++) { + int page, pages; + + pages = attrs->paged ? info->pages : 1; + for (page = 0; page < pages; page++) { + if (!(info->func[page] & attrs->func)) + continue; + ret = pmbus_add_sensor_attrs_one(client, data, info, + name, index, page, + attrs); + if (ret) + return ret; + index++; + } + attrs++; + } + return 0; +} + +static const struct pmbus_limit_attr vin_limit_attrs[] = { + { + .reg = PMBUS_VIN_UV_WARN_LIMIT, + .attr = "min", + .alarm = "min_alarm", + .sbit = PB_VOLTAGE_UV_WARNING, + }, { + .reg = PMBUS_VIN_UV_FAULT_LIMIT, + .attr = "lcrit", + .alarm = "lcrit_alarm", + .sbit = PB_VOLTAGE_UV_FAULT, + }, { + .reg = PMBUS_VIN_OV_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_VOLTAGE_OV_WARNING, + }, { + .reg = PMBUS_VIN_OV_FAULT_LIMIT, + .attr = "crit", + .alarm = "crit_alarm", + .sbit = PB_VOLTAGE_OV_FAULT, + }, { + .reg = PMBUS_VIRT_READ_VIN_AVG, + .update = true, + .attr = "average", + }, { + .reg = PMBUS_VIRT_READ_VIN_MIN, + .update = true, + .attr = "lowest", + }, { + .reg = PMBUS_VIRT_READ_VIN_MAX, + .update = true, + .attr = "highest", + }, { + .reg = PMBUS_VIRT_RESET_VIN_HISTORY, + .attr = "reset_history", + }, +}; + +static const struct pmbus_limit_attr vmon_limit_attrs[] = { + { + .reg = PMBUS_VIRT_VMON_UV_WARN_LIMIT, + .attr = "min", + .alarm = "min_alarm", + .sbit = PB_VOLTAGE_UV_WARNING, + }, { + .reg = PMBUS_VIRT_VMON_UV_FAULT_LIMIT, + .attr = "lcrit", + .alarm = "lcrit_alarm", + .sbit = PB_VOLTAGE_UV_FAULT, + }, { + .reg = PMBUS_VIRT_VMON_OV_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_VOLTAGE_OV_WARNING, + }, { + .reg = PMBUS_VIRT_VMON_OV_FAULT_LIMIT, + .attr = "crit", + .alarm = "crit_alarm", + .sbit = PB_VOLTAGE_OV_FAULT, + } +}; + +static const struct pmbus_limit_attr vout_limit_attrs[] = { + { + .reg = PMBUS_VOUT_UV_WARN_LIMIT, + .attr = "min", + .alarm = "min_alarm", + .sbit = PB_VOLTAGE_UV_WARNING, + }, { + .reg = PMBUS_VOUT_UV_FAULT_LIMIT, + .attr = "lcrit", + .alarm = "lcrit_alarm", + .sbit = PB_VOLTAGE_UV_FAULT, + }, { + .reg = PMBUS_VOUT_OV_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_VOLTAGE_OV_WARNING, + }, { + .reg = PMBUS_VOUT_OV_FAULT_LIMIT, + .attr = "crit", + .alarm = "crit_alarm", + .sbit = PB_VOLTAGE_OV_FAULT, + }, { + .reg = PMBUS_VIRT_READ_VOUT_AVG, + .update = true, + .attr = "average", + }, { + .reg = PMBUS_VIRT_READ_VOUT_MIN, + .update = true, + .attr = "lowest", + }, { + .reg = PMBUS_VIRT_READ_VOUT_MAX, + .update = true, + .attr = "highest", + }, { + .reg = PMBUS_VIRT_RESET_VOUT_HISTORY, + .attr = "reset_history", + } +}; + +static const struct pmbus_sensor_attr voltage_attributes[] = { + { + .reg = PMBUS_READ_VIN, + .class = PSC_VOLTAGE_IN, + .label = "vin", + .func = PMBUS_HAVE_VIN, + .sfunc = PMBUS_HAVE_STATUS_INPUT, + .sbase = PB_STATUS_INPUT_BASE, + .gbit = PB_STATUS_VIN_UV, + .limit = vin_limit_attrs, + .nlimit = ARRAY_SIZE(vin_limit_attrs), + }, { + .reg = PMBUS_VIRT_READ_VMON, + .class = PSC_VOLTAGE_IN, + .label = "vmon", + .func = PMBUS_HAVE_VMON, + .sfunc = PMBUS_HAVE_STATUS_VMON, + .sbase = PB_STATUS_VMON_BASE, + .limit = vmon_limit_attrs, + .nlimit = ARRAY_SIZE(vmon_limit_attrs), + }, { + .reg = PMBUS_READ_VCAP, + .class = PSC_VOLTAGE_IN, + .label = "vcap", + .func = PMBUS_HAVE_VCAP, + }, { + .reg = PMBUS_READ_VOUT, + .class = PSC_VOLTAGE_OUT, + .label = "vout", + .paged = true, + .func = PMBUS_HAVE_VOUT, + .sfunc = PMBUS_HAVE_STATUS_VOUT, + .sbase = PB_STATUS_VOUT_BASE, + .gbit = PB_STATUS_VOUT_OV, + .limit = vout_limit_attrs, + .nlimit = ARRAY_SIZE(vout_limit_attrs), + } +}; + +/* Current attributes */ + +static const struct pmbus_limit_attr iin_limit_attrs[] = { + { + .reg = PMBUS_IIN_OC_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_IIN_OC_WARNING, + }, { + .reg = PMBUS_IIN_OC_FAULT_LIMIT, + .attr = "crit", + .alarm = "crit_alarm", + .sbit = PB_IIN_OC_FAULT, + }, { + .reg = PMBUS_VIRT_READ_IIN_AVG, + .update = true, + .attr = "average", + }, { + .reg = PMBUS_VIRT_READ_IIN_MIN, + .update = true, + .attr = "lowest", + }, { + .reg = PMBUS_VIRT_READ_IIN_MAX, + .update = true, + .attr = "highest", + }, { + .reg = PMBUS_VIRT_RESET_IIN_HISTORY, + .attr = "reset_history", + } +}; + +static const struct pmbus_limit_attr iout_limit_attrs[] = { + { + .reg = PMBUS_IOUT_OC_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_IOUT_OC_WARNING, + }, { + .reg = PMBUS_IOUT_UC_FAULT_LIMIT, + .attr = "lcrit", + .alarm = "lcrit_alarm", + .sbit = PB_IOUT_UC_FAULT, + }, { + .reg = PMBUS_IOUT_OC_FAULT_LIMIT, + .attr = "crit", + .alarm = "crit_alarm", + .sbit = PB_IOUT_OC_FAULT, + }, { + .reg = PMBUS_VIRT_READ_IOUT_AVG, + .update = true, + .attr = "average", + }, { + .reg = PMBUS_VIRT_READ_IOUT_MIN, + .update = true, + .attr = "lowest", + }, { + .reg = PMBUS_VIRT_READ_IOUT_MAX, + .update = true, + .attr = "highest", + }, { + .reg = PMBUS_VIRT_RESET_IOUT_HISTORY, + .attr = "reset_history", + } +}; + +static const struct pmbus_sensor_attr current_attributes[] = { + { + .reg = PMBUS_READ_IIN, + .class = PSC_CURRENT_IN, + .label = "iin", + .func = PMBUS_HAVE_IIN, + .sfunc = PMBUS_HAVE_STATUS_INPUT, + .sbase = PB_STATUS_INPUT_BASE, + .limit = iin_limit_attrs, + .nlimit = ARRAY_SIZE(iin_limit_attrs), + }, { + .reg = PMBUS_READ_IOUT, + .class = PSC_CURRENT_OUT, + .label = "iout", + .paged = true, + .func = PMBUS_HAVE_IOUT, + .sfunc = PMBUS_HAVE_STATUS_IOUT, + .sbase = PB_STATUS_IOUT_BASE, + .gbit = PB_STATUS_IOUT_OC, + .limit = iout_limit_attrs, + .nlimit = ARRAY_SIZE(iout_limit_attrs), + } +}; + +/* Power attributes */ + +static const struct pmbus_limit_attr pin_limit_attrs[] = { + { + .reg = PMBUS_PIN_OP_WARN_LIMIT, + .attr = "max", + .alarm = "alarm", + .sbit = PB_PIN_OP_WARNING, + }, { + .reg = PMBUS_VIRT_READ_PIN_AVG, + .update = true, + .attr = "average", + }, { + .reg = PMBUS_VIRT_READ_PIN_MAX, + .update = true, + .attr = "input_highest", + }, { + .reg = PMBUS_VIRT_RESET_PIN_HISTORY, + .attr = "reset_history", + } +}; + +static const struct pmbus_limit_attr pout_limit_attrs[] = { + { + .reg = PMBUS_POUT_MAX, + .attr = "cap", + .alarm = "cap_alarm", + .sbit = PB_POWER_LIMITING, + }, { + .reg = PMBUS_POUT_OP_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_POUT_OP_WARNING, + }, { + .reg = PMBUS_POUT_OP_FAULT_LIMIT, + .attr = "crit", + .alarm = "crit_alarm", + .sbit = PB_POUT_OP_FAULT, + }, { + .reg = PMBUS_VIRT_READ_POUT_AVG, + .update = true, + .attr = "average", + }, { + .reg = PMBUS_VIRT_READ_POUT_MAX, + .update = true, + .attr = "input_highest", + }, { + .reg = PMBUS_VIRT_RESET_POUT_HISTORY, + .attr = "reset_history", + } +}; + +static const struct pmbus_sensor_attr power_attributes[] = { + { + .reg = PMBUS_READ_PIN, + .class = PSC_POWER, + .label = "pin", + .func = PMBUS_HAVE_PIN, + .sfunc = PMBUS_HAVE_STATUS_INPUT, + .sbase = PB_STATUS_INPUT_BASE, + .limit = pin_limit_attrs, + .nlimit = ARRAY_SIZE(pin_limit_attrs), + }, { + .reg = PMBUS_READ_POUT, + .class = PSC_POWER, + .label = "pout", + .paged = true, + .func = PMBUS_HAVE_POUT, + .sfunc = PMBUS_HAVE_STATUS_IOUT, + .sbase = PB_STATUS_IOUT_BASE, + .limit = pout_limit_attrs, + .nlimit = ARRAY_SIZE(pout_limit_attrs), + } +}; + +/* Temperature atributes */ + +static const struct pmbus_limit_attr temp_limit_attrs[] = { + { + .reg = PMBUS_UT_WARN_LIMIT, + .low = true, + .attr = "min", + .alarm = "min_alarm", + .sbit = PB_TEMP_UT_WARNING, + }, { + .reg = PMBUS_UT_FAULT_LIMIT, + .low = true, + .attr = "lcrit", + .alarm = "lcrit_alarm", + .sbit = PB_TEMP_UT_FAULT, + }, { + .reg = PMBUS_OT_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_TEMP_OT_WARNING, + }, { + .reg = PMBUS_OT_FAULT_LIMIT, + .attr = "crit", + .alarm = "crit_alarm", + .sbit = PB_TEMP_OT_FAULT, + }, { + .reg = PMBUS_VIRT_READ_TEMP_MIN, + .attr = "lowest", + }, { + .reg = PMBUS_VIRT_READ_TEMP_AVG, + .attr = "average", + }, { + .reg = PMBUS_VIRT_READ_TEMP_MAX, + .attr = "highest", + }, { + .reg = PMBUS_VIRT_RESET_TEMP_HISTORY, + .attr = "reset_history", + } +}; + +static const struct pmbus_limit_attr temp_limit_attrs2[] = { + { + .reg = PMBUS_UT_WARN_LIMIT, + .low = true, + .attr = "min", + .alarm = "min_alarm", + .sbit = PB_TEMP_UT_WARNING, + }, { + .reg = PMBUS_UT_FAULT_LIMIT, + .low = true, + .attr = "lcrit", + .alarm = "lcrit_alarm", + .sbit = PB_TEMP_UT_FAULT, + }, { + .reg = PMBUS_OT_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_TEMP_OT_WARNING, + }, { + .reg = PMBUS_OT_FAULT_LIMIT, + .attr = "crit", + .alarm = "crit_alarm", + .sbit = PB_TEMP_OT_FAULT, + }, { + .reg = PMBUS_VIRT_READ_TEMP2_MIN, + .attr = "lowest", + }, { + .reg = PMBUS_VIRT_READ_TEMP2_AVG, + .attr = "average", + }, { + .reg = PMBUS_VIRT_READ_TEMP2_MAX, + .attr = "highest", + }, { + .reg = PMBUS_VIRT_RESET_TEMP2_HISTORY, + .attr = "reset_history", + } +}; + +static const struct pmbus_limit_attr temp_limit_attrs3[] = { + { + .reg = PMBUS_UT_WARN_LIMIT, + .low = true, + .attr = "min", + .alarm = "min_alarm", + .sbit = PB_TEMP_UT_WARNING, + }, { + .reg = PMBUS_UT_FAULT_LIMIT, + .low = true, + .attr = "lcrit", + .alarm = "lcrit_alarm", + .sbit = PB_TEMP_UT_FAULT, + }, { + .reg = PMBUS_OT_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_TEMP_OT_WARNING, + }, { + .reg = PMBUS_OT_FAULT_LIMIT, + .attr = "crit", + .alarm = "crit_alarm", + .sbit = PB_TEMP_OT_FAULT, + } +}; + +static const struct pmbus_sensor_attr temp_attributes[] = { + { + .reg = PMBUS_READ_TEMPERATURE_1, + .class = PSC_TEMPERATURE, + .paged = true, + .update = true, + .compare = true, + .func = PMBUS_HAVE_TEMP, + .sfunc = PMBUS_HAVE_STATUS_TEMP, + .sbase = PB_STATUS_TEMP_BASE, + .gbit = PB_STATUS_TEMPERATURE, + .limit = temp_limit_attrs, + .nlimit = ARRAY_SIZE(temp_limit_attrs), + }, { + .reg = PMBUS_READ_TEMPERATURE_2, + .class = PSC_TEMPERATURE, + .paged = true, + .update = true, + .compare = true, + .func = PMBUS_HAVE_TEMP2, + .sfunc = PMBUS_HAVE_STATUS_TEMP, + .sbase = PB_STATUS_TEMP_BASE, + .gbit = PB_STATUS_TEMPERATURE, + .limit = temp_limit_attrs2, + .nlimit = ARRAY_SIZE(temp_limit_attrs2), + }, { + .reg = PMBUS_READ_TEMPERATURE_3, + .class = PSC_TEMPERATURE, + .paged = true, + .update = true, + .compare = true, + .func = PMBUS_HAVE_TEMP3, + .sfunc = PMBUS_HAVE_STATUS_TEMP, + .sbase = PB_STATUS_TEMP_BASE, + .gbit = PB_STATUS_TEMPERATURE, + .limit = temp_limit_attrs3, + .nlimit = ARRAY_SIZE(temp_limit_attrs3), + } +}; + +static const int pmbus_fan_registers[] = { + PMBUS_READ_FAN_SPEED_1, + PMBUS_READ_FAN_SPEED_2, + PMBUS_READ_FAN_SPEED_3, + PMBUS_READ_FAN_SPEED_4 +}; + +static const int pmbus_fan_config_registers[] = { + PMBUS_FAN_CONFIG_12, + PMBUS_FAN_CONFIG_12, + PMBUS_FAN_CONFIG_34, + PMBUS_FAN_CONFIG_34 +}; + +static const int pmbus_fan_status_registers[] = { + PMBUS_STATUS_FAN_12, + PMBUS_STATUS_FAN_12, + PMBUS_STATUS_FAN_34, + PMBUS_STATUS_FAN_34 +}; + +static const u32 pmbus_fan_flags[] = { + PMBUS_HAVE_FAN12, + PMBUS_HAVE_FAN12, + PMBUS_HAVE_FAN34, + PMBUS_HAVE_FAN34 +}; + +static const u32 pmbus_fan_status_flags[] = { + PMBUS_HAVE_STATUS_FAN12, + PMBUS_HAVE_STATUS_FAN12, + PMBUS_HAVE_STATUS_FAN34, + PMBUS_HAVE_STATUS_FAN34 +}; + +/* Fans */ +static int pmbus_add_fan_attributes(struct i2c_client *client, + struct pmbus_data *data) +{ + const struct pmbus_driver_info *info = data->info; + int index = 1; + int page; + int ret; + + for (page = 0; page < info->pages; page++) { + int f; + + for (f = 0; f < ARRAY_SIZE(pmbus_fan_registers); f++) { + int regval; + + if (f >= info->fan_num) + break; + + if (!(info->func[page] & pmbus_fan_flags[f])) + break; + + if (!_pmbus_check_word_register(client, page, + pmbus_fan_registers[f])) + break; + + /* + * Skip fan if not installed. + * Each fan configuration register covers multiple fans, + * so we have to do some magic. + */ + regval = _pmbus_read_byte_data(client, page, + pmbus_fan_config_registers[f]); + if (regval < 0 || + (!(regval & (PB_FAN_1_INSTALLED >> ((f & 1) * 4))))) + continue; + + if (pmbus_add_sensor(data, "fan", "input", index, + page, pmbus_fan_registers[f], + PSC_FAN, true, true) == NULL) + return -ENOMEM; + + /* + * Each fan status register covers multiple fans, + * so we have to do some magic. + */ + if ((info->func[page] & pmbus_fan_status_flags[f]) && + _pmbus_check_byte_register(client, + page, pmbus_fan_status_registers[f])) { + int base; + + if (f > 1) /* fan 3, 4 */ + base = PB_STATUS_FAN34_BASE + page; + else + base = PB_STATUS_FAN_BASE + page; + ret = pmbus_add_boolean(data, "fan", + "alarm", index, NULL, NULL, base, + PB_FAN_FAN1_WARNING >> (f & 1)); + if (ret) + return ret; + ret = pmbus_add_boolean(data, "fan", + "fault", index, NULL, NULL, base, + PB_FAN_FAN1_FAULT >> (f & 1)); + if (ret) + return ret; + } + index++; + } + } + return 0; +} + +static int pmbus_find_attributes(struct i2c_client *client, + struct pmbus_data *data) +{ + int ret; + + /* Voltage sensors */ + ret = pmbus_add_sensor_attrs(client, data, "in", voltage_attributes, + ARRAY_SIZE(voltage_attributes)); + if (ret) + return ret; + + /* Current sensors */ + ret = pmbus_add_sensor_attrs(client, data, "curr", current_attributes, + ARRAY_SIZE(current_attributes)); + if (ret) + return ret; + + /* Power sensors */ + ret = pmbus_add_sensor_attrs(client, data, "power", power_attributes, + ARRAY_SIZE(power_attributes)); + if (ret) + return ret; + + /* Temperature sensors */ + ret = pmbus_add_sensor_attrs(client, data, "temp", temp_attributes, + ARRAY_SIZE(temp_attributes)); + if (ret) + return ret; + + /* Fans */ + ret = pmbus_add_fan_attributes(client, data); + return ret; +} + +/* + * Identify chip parameters. + * This function is called for all chips. + */ +static int pmbus_identify_common(struct i2c_client *client, + struct pmbus_data *data, int page) +{ + int vout_mode = -1; + + if (_pmbus_check_byte_register(client, page, PMBUS_VOUT_MODE)) + { + vout_mode = _pmbus_read_byte_data(client, page, + PMBUS_VOUT_MODE); + } + + if (vout_mode >= 0 && vout_mode != 0xff) { + /* + * Not all chips support the VOUT_MODE command, + * so a failure to read it is not an error. + */ + switch (vout_mode >> 5) { + case 0: /* linear mode */ + if (data->info->format[PSC_VOLTAGE_OUT] != linear) + return -ENODEV; + + data->exponent[page] = ((s8)(vout_mode << 3)) >> 3; + break; + case 1: /* VID mode */ + if (data->info->format[PSC_VOLTAGE_OUT] != vid) + return -ENODEV; + break; + case 2: /* direct mode */ + if (data->info->format[PSC_VOLTAGE_OUT] != direct) + return -ENODEV; + break; + default: + return -ENODEV; + } + } + + pmbus_clear_fault_page(client, page); + return 0; +} + +static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data, + struct pmbus_driver_info *info) +{ + struct device *dev = &client->dev; + int page, ret; + + /* + * Some PMBus chips don't support PMBUS_STATUS_BYTE, so try + * to use PMBUS_STATUS_WORD instead if that is the case. + * Bail out if both registers are not supported. + */ + if(0) { /*Skip this for the i2c access may fail if PSU is not powered.*/ + data->status_register = PMBUS_STATUS_BYTE; + ret = i2c_smbus_read_byte_data(client, PMBUS_STATUS_BYTE); + if (ret < 0 || ret == 0xff) { + data->status_register = PMBUS_STATUS_WORD; + ret = i2c_smbus_read_word_data(client, PMBUS_STATUS_WORD); + if (ret < 0 || ret == 0xffff) { + dev_err(dev, "PMBus status register not found\n"); + return -ENODEV; + } + } + } + _pmbus_clear_faults(client); + + if (info->identify) { + ret = (*info->identify)(client, info); + if (ret < 0) { + dev_err(dev, "Chip identification failed\n"); + return ret; + } + } + + if (info->pages <= 0 || info->pages > PMBUS_PAGES) { + dev_err(dev, "Bad number of PMBus pages: %d\n", info->pages); + return -ENODEV; + } + + for (page = 0; page < info->pages; page++) { + ret = pmbus_identify_common(client, data, page); + if (ret < 0) { + dev_err(dev, "Failed to identify chip capabilities\n"); + return ret; + } + } + return 0; +} + +int _pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, + struct pmbus_driver_info *info) +{ + struct device *dev = &client->dev; + struct pmbus_data *data; + int ret; + + if (!info) + return -ENODEV; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_BYTE + | I2C_FUNC_SMBUS_BYTE_DATA + | I2C_FUNC_SMBUS_WORD_DATA)) + return -ENODEV; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->dev = dev; + + if (limited_models(id)) + { + data->flags |= PMBUS_SKIP_STATUS_CHECK; + info->pages = 1; + info->fan_num = 1; + data->linear_16 = 0; + } + else + { + info->pages = id->driver_data; + info->fan_num = 4; + data->linear_16 = 1; + + } + + data->info = info; + + ret = pmbus_init_common(client, data, info); + if (ret < 0) + return ret; + + ret = pmbus_find_attributes(client, data); + if (ret) + goto out_kfree; + + /* + * If there are no attributes, something is wrong. + * Bail out instead of trying to register nothing. + */ + if (!data->num_attributes) { + dev_err(dev, "No attributes found\n"); + ret = -ENODEV; + goto out_kfree; + } + + data->groups[0] = &data->group; + data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name, + data, data->groups); + if (IS_ERR(data->hwmon_dev)) { + ret = PTR_ERR(data->hwmon_dev); + dev_err(dev, "Failed to register hwmon device\n"); + goto out_kfree; + } + return 0; + +out_kfree: + kfree(data->group.attrs); + return ret; +} + +/* + * Find sensor groups and status registers on each page. + */ +static void pmbus_find_sensor_groups(struct i2c_client *client, + struct pmbus_driver_info *info) +{ + int page; + + /* For i2c might not available when this driver installing, + turn on all attributes but VMON and FAN34.*/ + info->func[0] |= 0x1feff; + return ; + + + /* Sensors detected on page 0 only */ + if (_pmbus_check_word_register(client, 0, PMBUS_READ_VIN)) + info->func[0] |= PMBUS_HAVE_VIN; + if (_pmbus_check_word_register(client, 0, PMBUS_READ_VCAP)) + info->func[0] |= PMBUS_HAVE_VCAP; + if (_pmbus_check_word_register(client, 0, PMBUS_READ_IIN)) + info->func[0] |= PMBUS_HAVE_IIN; + if (_pmbus_check_word_register(client, 0, PMBUS_READ_PIN)) + info->func[0] |= PMBUS_HAVE_PIN; + if (info->func[0] + && _pmbus_check_byte_register(client, 0, PMBUS_STATUS_INPUT)) + info->func[0] |= PMBUS_HAVE_STATUS_INPUT; + if (info->fan_num > 0) + { + if (_pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_12) && + _pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_1)) { + info->func[0] |= PMBUS_HAVE_FAN12; + if (_pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_12)) + info->func[0] |= PMBUS_HAVE_STATUS_FAN12; + } + } + if (info->fan_num > 2) + { + if (_pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_34) && + _pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_3)) { + info->func[0] |= PMBUS_HAVE_FAN34; + if (_pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34)) + info->func[0] |= PMBUS_HAVE_STATUS_FAN34; + } + } + + if (_pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) + info->func[0] |= PMBUS_HAVE_TEMP; + if (_pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2)) + info->func[0] |= PMBUS_HAVE_TEMP2; + if (_pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3)) + info->func[0] |= PMBUS_HAVE_TEMP3; + + if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 + | PMBUS_HAVE_TEMP3) + && _pmbus_check_byte_register(client, 0, + PMBUS_STATUS_TEMPERATURE)) + info->func[0] |= PMBUS_HAVE_STATUS_TEMP; + + /* Sensors detected on all pages */ + for (page = 0; page < info->pages; page++) { + if (_pmbus_check_word_register(client, page, PMBUS_READ_VOUT)) { + info->func[page] |= PMBUS_HAVE_VOUT; + if (_pmbus_check_byte_register(client, page, + PMBUS_STATUS_VOUT)) + info->func[page] |= PMBUS_HAVE_STATUS_VOUT; + } + if (_pmbus_check_word_register(client, page, PMBUS_READ_IOUT)) { + info->func[page] |= PMBUS_HAVE_IOUT; + if (_pmbus_check_byte_register(client, 0, + PMBUS_STATUS_IOUT)) + info->func[page] |= PMBUS_HAVE_STATUS_IOUT; + } + if (_pmbus_check_word_register(client, page, PMBUS_READ_POUT)) + info->func[page] |= PMBUS_HAVE_POUT; + } +} + +/* + * Identify chip parameters. + */ +static int pmbus_identify(struct i2c_client *client, + struct pmbus_driver_info *info) +{ + int ret = 0; + + if (!info->pages) { + /* + * Check if the PAGE command is supported. If it is, + * keep setting the page number until it fails or until the + * maximum number of pages has been reached. Assume that + * this is the number of pages supported by the chip. + */ + if (_pmbus_check_byte_register(client, 0, PMBUS_PAGE)) { + int page; + + for (page = 1; page < PMBUS_PAGES; page++) { + if (_pmbus_set_page(client, page) < 0) + break; + } + _pmbus_set_page(client, 0); + info->pages = page; + } else { + info->pages = 1; + } + } + + if (_pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) { + int vout_mode; + + vout_mode = _pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE); + if (vout_mode >= 0 && vout_mode != 0xff) { + switch (vout_mode >> 5) { + case 0: + break; + case 1: + info->format[PSC_VOLTAGE_OUT] = vid; + break; + case 2: + info->format[PSC_VOLTAGE_OUT] = direct; + break; + default: + ret = -ENODEV; + goto abort; + } + } + } + + + /* + * We should check if the COEFFICIENTS register is supported. + * If it is, and the chip is configured for direct mode, we can read + * the coefficients from the chip, one set per group of sensor + * registers. + * + * To do this, we will need access to a chip which actually supports the + * COEFFICIENTS command, since the command is too complex to implement + * without testing it. Until then, abort if a chip configured for direct + * mode was detected. + */ + if (info->format[PSC_VOLTAGE_OUT] == direct) { + ret = -ENODEV; + goto abort; + } + + /* Try to find sensor groups */ + pmbus_find_sensor_groups(client, info); +abort: + return ret; +} + +/* + * Use driver_data to set the number of pages supported by the chip. + */ +static const struct i2c_device_id pmbus_id[] = { + { "accton_ym2651", YM2651 }, + { "accton_ym2401", YM2401 }, + { "accton_ym2851", YM2851 }, + {} +}; + +static int limited_models(const struct i2c_device_id *id) +{ + int j; + + if (!id->name) + return 0; + + for (j = 0; j < ARRAY_SIZE(pmbus_id); j++) { + if (!pmbus_id[j].name) + continue; + + if (!strcmp(id->name, pmbus_id[j].name)) + { + if(id->driver_data < LIMITED_CHIPS) + { + return 1; + } + else + { + return 0; + } + } + + } + + return 0; +} + +static int pmbus_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct pmbus_driver_info *info; + + info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), + GFP_KERNEL); + if (!info) + return -ENOMEM; + + info->identify = pmbus_identify; + + return _pmbus_do_probe(client, id, info); +} + +int _pmbus_do_remove(struct i2c_client *client) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + kfree(data->group.attrs); + return 0; +} + +MODULE_DEVICE_TABLE(i2c, pmbus_id); + +/* This is the driver that will be inserted */ +static struct i2c_driver pmbus_driver = { + .driver = { + .name = "accton_pmbus_3y", + }, + .probe = pmbus_probe, + .remove = _pmbus_do_remove, + .id_table = pmbus_id, +}; + +module_i2c_driver(pmbus_driver); + +MODULE_AUTHOR("Roy Lee"); +MODULE_DESCRIPTION("Accton PMBus driver for 3Y Power YM-2651Y."); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/cpr_4011_4mxx.c b/platform/broadcom/sonic-platform-modules-accton/common/modules/cpr_4011_4mxx.c new file mode 100644 index 000000000000..2cea5f5e39f9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/cpr_4011_4mxx.c @@ -0,0 +1,402 @@ +/* + * An hwmon driver for the CPR-4011-4Mxx Redundant Power Module + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#if 0 +#define DEBUG +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x3c, 0x3d, 0x3e, 0x3f, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct cpr_4011_4mxx_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 vout_mode; /* Register value */ + u16 v_in; /* Register value */ + u16 v_out; /* Register value */ + u16 i_in; /* Register value */ + u16 i_out; /* Register value */ + u16 p_in; /* Register value */ + u16 p_out; /* Register value */ + u16 temp_input[2]; /* Register value */ + u8 fan_fault; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u16 fan_speed[2]; /* Register value */ +}; + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_vout(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static int cpr_4011_4mxx_write_word(struct i2c_client *client, u8 reg, u16 value); +static struct cpr_4011_4mxx_data *cpr_4011_4mxx_update_device(struct device *dev); + +enum cpr_4011_4mxx_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_FAULT, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_v_in, S_IRUGO, show_linear, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_in, S_IRUGO, show_linear, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_in, S_IRUGO, show_linear, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); + +static struct attribute *cpr_4011_4mxx_attributes[] = { + &sensor_dev_attr_psu_v_in.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_in.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_in.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + NULL +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + cpr_4011_4mxx_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_IN: + value = data->v_in; + break; + case PSU_I_IN: + value = data->i_in; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_IN: + value = data->p_in; + break; + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp_input[0]; + break; + case PSU_FAN1_DUTY_CYCLE: + multiplier = 1; + value = data->fan_duty_cycle[0]; + break; + case PSU_FAN1_SPEED: + multiplier = 1; + value = data->fan_speed[0]; + break; + default: + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_vout(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->v_out; + + return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static const struct attribute_group cpr_4011_4mxx_group = { + .attrs = cpr_4011_4mxx_attributes, +}; + +static int cpr_4011_4mxx_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct cpr_4011_4mxx_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct cpr_4011_4mxx_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cpr_4011_4mxx_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int cpr_4011_4mxx_remove(struct i2c_client *client) +{ + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id cpr_4011_4mxx_id[] = { + { "cpr_4011_4mxx", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, cpr_4011_4mxx_id); + +static struct i2c_driver cpr_4011_4mxx_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "cpr_4011_4mxx", + }, + .probe = cpr_4011_4mxx_probe, + .remove = cpr_4011_4mxx_remove, + .id_table = cpr_4011_4mxx_id, + .address_list = normal_i2c, +}; + +static int cpr_4011_4mxx_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int cpr_4011_4mxx_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int cpr_4011_4mxx_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct cpr_4011_4mxx_data *cpr_4011_4mxx_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int i, status; + struct reg_data_byte regs_byte[] = { {0x20, &data->vout_mode}, + {0x81, &data->fan_fault} + }; + struct reg_data_word regs_word[] = { {0x88, &data->v_in}, + {0x8b, &data->v_out}, + {0x89, &data->i_in}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x97, &data->p_in}, + {0x8d, &(data->temp_input[0])}, + {0x8e, &(data->temp_input[1])}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x3c, &(data->fan_duty_cycle[1])}, + {0x90, &(data->fan_speed[0])}, + {0x91, &(data->fan_speed[1])} + }; + + dev_dbg(&client->dev, "Starting cpr_4011_4mxx update\n"); + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = cpr_4011_4mxx_read_byte(client, regs_byte[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + } + else { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = cpr_4011_4mxx_read_word(client, regs_word[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + } + else { + *(regs_word[i].value) = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init cpr_4011_4mxx_init(void) +{ + return i2c_add_driver(&cpr_4011_4mxx_driver); +} + +static void __exit cpr_4011_4mxx_exit(void) +{ + i2c_del_driver(&cpr_4011_4mxx_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("CPR_4011_4MXX driver"); +MODULE_LICENSE("GPL"); + +module_init(cpr_4011_4mxx_init); +module_exit(cpr_4011_4mxx_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/pmbus.h b/platform/broadcom/sonic-platform-modules-accton/common/modules/pmbus.h new file mode 100644 index 000000000000..cb6dbc34d87c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/pmbus.h @@ -0,0 +1,389 @@ +/* + * pmbus.h - Common defines and structures for PMBus devices + * + * Copyright (c) 2010, 2011 Ericsson AB. + * Copyright (c) 2012 Guenter Roeck + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef PMBUS_H +#define PMBUS_H + +/* + * Registers + */ +#define PMBUS_PAGE 0x00 +#define PMBUS_OPERATION 0x01 +#define PMBUS_ON_OFF_CONFIG 0x02 +#define PMBUS_CLEAR_FAULTS 0x03 +#define PMBUS_PHASE 0x04 + +#define PMBUS_CAPABILITY 0x19 +#define PMBUS_QUERY 0x1A + +#define PMBUS_VOUT_MODE 0x20 +#define PMBUS_VOUT_COMMAND 0x21 +#define PMBUS_VOUT_TRIM 0x22 +#define PMBUS_VOUT_CAL_OFFSET 0x23 +#define PMBUS_VOUT_MAX 0x24 +#define PMBUS_VOUT_MARGIN_HIGH 0x25 +#define PMBUS_VOUT_MARGIN_LOW 0x26 +#define PMBUS_VOUT_TRANSITION_RATE 0x27 +#define PMBUS_VOUT_DROOP 0x28 +#define PMBUS_VOUT_SCALE_LOOP 0x29 +#define PMBUS_VOUT_SCALE_MONITOR 0x2A + +#define PMBUS_COEFFICIENTS 0x30 +#define PMBUS_POUT_MAX 0x31 + +#define PMBUS_FAN_CONFIG_12 0x3A +#define PMBUS_FAN_COMMAND_1 0x3B +#define PMBUS_FAN_COMMAND_2 0x3C +#define PMBUS_FAN_CONFIG_34 0x3D +#define PMBUS_FAN_COMMAND_3 0x3E +#define PMBUS_FAN_COMMAND_4 0x3F + +#define PMBUS_VOUT_OV_FAULT_LIMIT 0x40 +#define PMBUS_VOUT_OV_FAULT_RESPONSE 0x41 +#define PMBUS_VOUT_OV_WARN_LIMIT 0x42 +#define PMBUS_VOUT_UV_WARN_LIMIT 0x43 +#define PMBUS_VOUT_UV_FAULT_LIMIT 0x44 +#define PMBUS_VOUT_UV_FAULT_RESPONSE 0x45 +#define PMBUS_IOUT_OC_FAULT_LIMIT 0x46 +#define PMBUS_IOUT_OC_FAULT_RESPONSE 0x47 +#define PMBUS_IOUT_OC_LV_FAULT_LIMIT 0x48 +#define PMBUS_IOUT_OC_LV_FAULT_RESPONSE 0x49 +#define PMBUS_IOUT_OC_WARN_LIMIT 0x4A +#define PMBUS_IOUT_UC_FAULT_LIMIT 0x4B +#define PMBUS_IOUT_UC_FAULT_RESPONSE 0x4C + +#define PMBUS_OT_FAULT_LIMIT 0x4F +#define PMBUS_OT_FAULT_RESPONSE 0x50 +#define PMBUS_OT_WARN_LIMIT 0x51 +#define PMBUS_UT_WARN_LIMIT 0x52 +#define PMBUS_UT_FAULT_LIMIT 0x53 +#define PMBUS_UT_FAULT_RESPONSE 0x54 +#define PMBUS_VIN_OV_FAULT_LIMIT 0x55 +#define PMBUS_VIN_OV_FAULT_RESPONSE 0x56 +#define PMBUS_VIN_OV_WARN_LIMIT 0x57 +#define PMBUS_VIN_UV_WARN_LIMIT 0x58 +#define PMBUS_VIN_UV_FAULT_LIMIT 0x59 + +#define PMBUS_IIN_OC_FAULT_LIMIT 0x5B +#define PMBUS_IIN_OC_WARN_LIMIT 0x5D + +#define PMBUS_POUT_OP_FAULT_LIMIT 0x68 +#define PMBUS_POUT_OP_WARN_LIMIT 0x6A +#define PMBUS_PIN_OP_WARN_LIMIT 0x6B + +#define PMBUS_STATUS_BYTE 0x78 +#define PMBUS_STATUS_WORD 0x79 +#define PMBUS_STATUS_VOUT 0x7A +#define PMBUS_STATUS_IOUT 0x7B +#define PMBUS_STATUS_INPUT 0x7C +#define PMBUS_STATUS_TEMPERATURE 0x7D +#define PMBUS_STATUS_CML 0x7E +#define PMBUS_STATUS_OTHER 0x7F +#define PMBUS_STATUS_MFR_SPECIFIC 0x80 +#define PMBUS_STATUS_FAN_12 0x81 +#define PMBUS_STATUS_FAN_34 0x82 + +#define PMBUS_READ_VIN 0x88 +#define PMBUS_READ_IIN 0x89 +#define PMBUS_READ_VCAP 0x8A +#define PMBUS_READ_VOUT 0x8B +#define PMBUS_READ_IOUT 0x8C +#define PMBUS_READ_TEMPERATURE_1 0x8D +#define PMBUS_READ_TEMPERATURE_2 0x8E +#define PMBUS_READ_TEMPERATURE_3 0x8F +#define PMBUS_READ_FAN_SPEED_1 0x90 +#define PMBUS_READ_FAN_SPEED_2 0x91 +#define PMBUS_READ_FAN_SPEED_3 0x92 +#define PMBUS_READ_FAN_SPEED_4 0x93 +#define PMBUS_READ_DUTY_CYCLE 0x94 +#define PMBUS_READ_FREQUENCY 0x95 +#define PMBUS_READ_POUT 0x96 +#define PMBUS_READ_PIN 0x97 + +#define PMBUS_REVISION 0x98 +#define PMBUS_MFR_ID 0x99 +#define PMBUS_MFR_MODEL 0x9A +#define PMBUS_MFR_REVISION 0x9B +#define PMBUS_MFR_LOCATION 0x9C +#define PMBUS_MFR_DATE 0x9D +#define PMBUS_MFR_SERIAL 0x9E + +/* + * Virtual registers. + * Useful to support attributes which are not supported by standard PMBus + * registers but exist as manufacturer specific registers on individual chips. + * Must be mapped to real registers in device specific code. + * + * Semantics: + * Virtual registers are all word size. + * READ registers are read-only; writes are either ignored or return an error. + * RESET registers are read/write. Reading reset registers returns zero + * (used for detection), writing any value causes the associated history to be + * reset. + * Virtual registers have to be handled in device specific driver code. Chip + * driver code returns non-negative register values if a virtual register is + * supported, or a negative error code if not. The chip driver may return + * -ENODATA or any other error code in this case, though an error code other + * than -ENODATA is handled more efficiently and thus preferred. Either case, + * the calling PMBus core code will abort if the chip driver returns an error + * code when reading or writing virtual registers. + */ +#define PMBUS_VIRT_BASE 0x100 +#define PMBUS_VIRT_READ_TEMP_AVG (PMBUS_VIRT_BASE + 0) +#define PMBUS_VIRT_READ_TEMP_MIN (PMBUS_VIRT_BASE + 1) +#define PMBUS_VIRT_READ_TEMP_MAX (PMBUS_VIRT_BASE + 2) +#define PMBUS_VIRT_RESET_TEMP_HISTORY (PMBUS_VIRT_BASE + 3) +#define PMBUS_VIRT_READ_VIN_AVG (PMBUS_VIRT_BASE + 4) +#define PMBUS_VIRT_READ_VIN_MIN (PMBUS_VIRT_BASE + 5) +#define PMBUS_VIRT_READ_VIN_MAX (PMBUS_VIRT_BASE + 6) +#define PMBUS_VIRT_RESET_VIN_HISTORY (PMBUS_VIRT_BASE + 7) +#define PMBUS_VIRT_READ_IIN_AVG (PMBUS_VIRT_BASE + 8) +#define PMBUS_VIRT_READ_IIN_MIN (PMBUS_VIRT_BASE + 9) +#define PMBUS_VIRT_READ_IIN_MAX (PMBUS_VIRT_BASE + 10) +#define PMBUS_VIRT_RESET_IIN_HISTORY (PMBUS_VIRT_BASE + 11) +#define PMBUS_VIRT_READ_PIN_AVG (PMBUS_VIRT_BASE + 12) +#define PMBUS_VIRT_READ_PIN_MAX (PMBUS_VIRT_BASE + 13) +#define PMBUS_VIRT_RESET_PIN_HISTORY (PMBUS_VIRT_BASE + 14) +#define PMBUS_VIRT_READ_POUT_AVG (PMBUS_VIRT_BASE + 15) +#define PMBUS_VIRT_READ_POUT_MAX (PMBUS_VIRT_BASE + 16) +#define PMBUS_VIRT_RESET_POUT_HISTORY (PMBUS_VIRT_BASE + 17) +#define PMBUS_VIRT_READ_VOUT_AVG (PMBUS_VIRT_BASE + 18) +#define PMBUS_VIRT_READ_VOUT_MIN (PMBUS_VIRT_BASE + 19) +#define PMBUS_VIRT_READ_VOUT_MAX (PMBUS_VIRT_BASE + 20) +#define PMBUS_VIRT_RESET_VOUT_HISTORY (PMBUS_VIRT_BASE + 21) +#define PMBUS_VIRT_READ_IOUT_AVG (PMBUS_VIRT_BASE + 22) +#define PMBUS_VIRT_READ_IOUT_MIN (PMBUS_VIRT_BASE + 23) +#define PMBUS_VIRT_READ_IOUT_MAX (PMBUS_VIRT_BASE + 24) +#define PMBUS_VIRT_RESET_IOUT_HISTORY (PMBUS_VIRT_BASE + 25) +#define PMBUS_VIRT_READ_TEMP2_AVG (PMBUS_VIRT_BASE + 26) +#define PMBUS_VIRT_READ_TEMP2_MIN (PMBUS_VIRT_BASE + 27) +#define PMBUS_VIRT_READ_TEMP2_MAX (PMBUS_VIRT_BASE + 28) +#define PMBUS_VIRT_RESET_TEMP2_HISTORY (PMBUS_VIRT_BASE + 29) + +#define PMBUS_VIRT_READ_VMON (PMBUS_VIRT_BASE + 30) +#define PMBUS_VIRT_VMON_UV_WARN_LIMIT (PMBUS_VIRT_BASE + 31) +#define PMBUS_VIRT_VMON_OV_WARN_LIMIT (PMBUS_VIRT_BASE + 32) +#define PMBUS_VIRT_VMON_UV_FAULT_LIMIT (PMBUS_VIRT_BASE + 33) +#define PMBUS_VIRT_VMON_OV_FAULT_LIMIT (PMBUS_VIRT_BASE + 34) +#define PMBUS_VIRT_STATUS_VMON (PMBUS_VIRT_BASE + 35) + +/* + * CAPABILITY + */ +#define PB_CAPABILITY_SMBALERT (1<<4) +#define PB_CAPABILITY_ERROR_CHECK (1<<7) + +/* + * VOUT_MODE + */ +#define PB_VOUT_MODE_MODE_MASK 0xe0 +#define PB_VOUT_MODE_PARAM_MASK 0x1f + +#define PB_VOUT_MODE_LINEAR 0x00 +#define PB_VOUT_MODE_VID 0x20 +#define PB_VOUT_MODE_DIRECT 0x40 + +/* + * Fan configuration + */ +#define PB_FAN_2_PULSE_MASK ((1 << 0) | (1 << 1)) +#define PB_FAN_2_RPM (1 << 2) +#define PB_FAN_2_INSTALLED (1 << 3) +#define PB_FAN_1_PULSE_MASK ((1 << 4) | (1 << 5)) +#define PB_FAN_1_RPM (1 << 6) +#define PB_FAN_1_INSTALLED (1 << 7) + +/* + * STATUS_BYTE, STATUS_WORD (lower) + */ +#define PB_STATUS_NONE_ABOVE (1<<0) +#define PB_STATUS_CML (1<<1) +#define PB_STATUS_TEMPERATURE (1<<2) +#define PB_STATUS_VIN_UV (1<<3) +#define PB_STATUS_IOUT_OC (1<<4) +#define PB_STATUS_VOUT_OV (1<<5) +#define PB_STATUS_OFF (1<<6) +#define PB_STATUS_BUSY (1<<7) + +/* + * STATUS_WORD (upper) + */ +#define PB_STATUS_UNKNOWN (1<<8) +#define PB_STATUS_OTHER (1<<9) +#define PB_STATUS_FANS (1<<10) +#define PB_STATUS_POWER_GOOD_N (1<<11) +#define PB_STATUS_WORD_MFR (1<<12) +#define PB_STATUS_INPUT (1<<13) +#define PB_STATUS_IOUT_POUT (1<<14) +#define PB_STATUS_VOUT (1<<15) + +/* + * STATUS_IOUT + */ +#define PB_POUT_OP_WARNING (1<<0) +#define PB_POUT_OP_FAULT (1<<1) +#define PB_POWER_LIMITING (1<<2) +#define PB_CURRENT_SHARE_FAULT (1<<3) +#define PB_IOUT_UC_FAULT (1<<4) +#define PB_IOUT_OC_WARNING (1<<5) +#define PB_IOUT_OC_LV_FAULT (1<<6) +#define PB_IOUT_OC_FAULT (1<<7) + +/* + * STATUS_VOUT, STATUS_INPUT + */ +#define PB_VOLTAGE_UV_FAULT (1<<4) +#define PB_VOLTAGE_UV_WARNING (1<<5) +#define PB_VOLTAGE_OV_WARNING (1<<6) +#define PB_VOLTAGE_OV_FAULT (1<<7) + +/* + * STATUS_INPUT + */ +#define PB_PIN_OP_WARNING (1<<0) +#define PB_IIN_OC_WARNING (1<<1) +#define PB_IIN_OC_FAULT (1<<2) + +/* + * STATUS_TEMPERATURE + */ +#define PB_TEMP_UT_FAULT (1<<4) +#define PB_TEMP_UT_WARNING (1<<5) +#define PB_TEMP_OT_WARNING (1<<6) +#define PB_TEMP_OT_FAULT (1<<7) + +/* + * STATUS_FAN + */ +#define PB_FAN_AIRFLOW_WARNING (1<<0) +#define PB_FAN_AIRFLOW_FAULT (1<<1) +#define PB_FAN_FAN2_SPEED_OVERRIDE (1<<2) +#define PB_FAN_FAN1_SPEED_OVERRIDE (1<<3) +#define PB_FAN_FAN2_WARNING (1<<4) +#define PB_FAN_FAN1_WARNING (1<<5) +#define PB_FAN_FAN2_FAULT (1<<6) +#define PB_FAN_FAN1_FAULT (1<<7) + +/* + * CML_FAULT_STATUS + */ +#define PB_CML_FAULT_OTHER_MEM_LOGIC (1<<0) +#define PB_CML_FAULT_OTHER_COMM (1<<1) +#define PB_CML_FAULT_PROCESSOR (1<<3) +#define PB_CML_FAULT_MEMORY (1<<4) +#define PB_CML_FAULT_PACKET_ERROR (1<<5) +#define PB_CML_FAULT_INVALID_DATA (1<<6) +#define PB_CML_FAULT_INVALID_COMMAND (1<<7) + +enum pmbus_sensor_classes { + PSC_VOLTAGE_IN = 0, + PSC_VOLTAGE_OUT, + PSC_CURRENT_IN, + PSC_CURRENT_OUT, + PSC_POWER, + PSC_TEMPERATURE, + PSC_FAN, + PSC_NUM_CLASSES /* Number of power sensor classes */ +}; + +#define PMBUS_PAGES 32 /* Per PMBus specification */ + +/* Functionality bit mask */ +#define PMBUS_HAVE_VIN (1 << 0) +#define PMBUS_HAVE_VCAP (1 << 1) +#define PMBUS_HAVE_VOUT (1 << 2) +#define PMBUS_HAVE_IIN (1 << 3) +#define PMBUS_HAVE_IOUT (1 << 4) +#define PMBUS_HAVE_PIN (1 << 5) +#define PMBUS_HAVE_POUT (1 << 6) +#define PMBUS_HAVE_FAN12 (1 << 7) +#define PMBUS_HAVE_FAN34 (1 << 8) +#define PMBUS_HAVE_TEMP (1 << 9) +#define PMBUS_HAVE_TEMP2 (1 << 10) +#define PMBUS_HAVE_TEMP3 (1 << 11) +#define PMBUS_HAVE_STATUS_VOUT (1 << 12) +#define PMBUS_HAVE_STATUS_IOUT (1 << 13) +#define PMBUS_HAVE_STATUS_INPUT (1 << 14) +#define PMBUS_HAVE_STATUS_TEMP (1 << 15) +#define PMBUS_HAVE_STATUS_FAN12 (1 << 16) +#define PMBUS_HAVE_STATUS_FAN34 (1 << 17) +#define PMBUS_HAVE_VMON (1 << 18) +#define PMBUS_HAVE_STATUS_VMON (1 << 19) + +enum pmbus_data_format { linear = 0, direct, vid }; + +struct pmbus_driver_info { + int pages; /* Total number of pages */ + enum pmbus_data_format format[PSC_NUM_CLASSES]; + /* + * Support one set of coefficients for each sensor type + * Used for chips providing data in direct mode. + */ + int m[PSC_NUM_CLASSES]; /* mantissa for direct data format */ + int b[PSC_NUM_CLASSES]; /* offset */ + int R[PSC_NUM_CLASSES]; /* exponent */ + + u32 func[PMBUS_PAGES]; /* Functionality, per page */ + /* + * The following functions map manufacturing specific register values + * to PMBus standard register values. Specify only if mapping is + * necessary. + * Functions return the register value (read) or zero (write) if + * successful. A return value of -ENODATA indicates that there is no + * manufacturer specific register, but that a standard PMBus register + * may exist. Any other negative return value indicates that the + * register does not exist, and that no attempt should be made to read + * the standard register. + */ + int (*read_byte_data)(struct i2c_client *client, int page, int reg); + int (*read_word_data)(struct i2c_client *client, int page, int reg); + int (*write_word_data)(struct i2c_client *client, int page, int reg, + u16 word); + int (*write_byte)(struct i2c_client *client, int page, u8 value); + /* + * The identify function determines supported PMBus functionality. + * This function is only necessary if a chip driver supports multiple + * chips, and the chip functionality is not pre-determined. + */ + int (*identify)(struct i2c_client *client, + struct pmbus_driver_info *info); + + int fan_num; +}; + +/* Function declarations */ + +void pmbus_clear_cache(struct i2c_client *client); +int pmbus_set_page(struct i2c_client *client, u8 page); +int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 reg); +int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word); +int pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg); +int pmbus_write_byte(struct i2c_client *client, int page, u8 value); +void _pmbus_clear_faults(struct i2c_client *client); +bool _pmbus_check_byte_register(struct i2c_client *client, int page, int reg); +bool _pmbus_check_word_register(struct i2c_client *client, int page, int reg); +int _pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, + struct pmbus_driver_info *info); +int pmbus_do_remove(struct i2c_client *client); +const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client + *client); + +#endif /* PMBUS_H */ diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c new file mode 100644 index 000000000000..47e6a1d06bc5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c @@ -0,0 +1,619 @@ +/* + * An hwmon driver for the 3Y Power YM-2651Y Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x58, 0x5b, I2C_CLIENT_END }; + +enum chips { + YM2651, + YM2401, + YM2851, +}; + +/* Each client has this additional data + */ +struct ym2651y_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 capability; /* Register value */ + u16 status_word; /* Register value */ + u8 fan_fault; /* Register value */ + u8 over_temp; /* Register value */ + u16 v_out; /* Register value */ + u16 i_out; /* Register value */ + u16 p_out; /* Register value */ + u16 temp; /* Register value */ + u16 fan_speed; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u8 fan_dir[4]; /* Register value */ + u8 pmbus_revision; /* Register value */ + u8 mfr_id[10]; /* Register value */ + u8 mfr_model[10]; /* Register value */ + u8 mfr_revsion[3]; /* Register value */ + u16 mfr_vin_min; /* Register value */ + u16 mfr_vin_max; /* Register value */ + u16 mfr_iin_max; /* Register value */ + u16 mfr_iout_max; /* Register value */ + u16 mfr_pin_max; /* Register value */ + u16 mfr_pout_max; /* Register value */ + u16 mfr_vout_min; /* Register value */ + u16 mfr_vout_max; /* Register value */ +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf); +static struct ym2651y_data *ym2651y_update_device(struct device *dev); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value); + +enum ym2651y_sysfs_attributes { + PSU_POWER_ON = 0, + PSU_TEMP_FAULT, + PSU_POWER_GOOD, + PSU_FAN1_FAULT, + PSU_FAN_DIRECTION, + PSU_OVER_TEMP, + PSU_V_OUT, + PSU_I_OUT, + PSU_P_OUT, + PSU_P_OUT_UV, /*In Unit of microVolt, instead of mini.*/ + PSU_TEMP1_INPUT, + PSU_FAN1_SPEED, + PSU_FAN1_DUTY_CYCLE, + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_REVISION, + PSU_MFR_VIN_MIN, + PSU_MFR_VIN_MAX, + PSU_MFR_VOUT_MIN, + PSU_MFR_VOUT_MAX, + PSU_MFR_IIN_MAX, + PSU_MFR_IOUT_MAX, + PSU_MFR_PIN_MAX, + PSU_MFR_POUT_MAX +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_power_on, S_IRUGO, show_word, NULL, PSU_POWER_ON); +static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_word, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_over_temp, S_IRUGO, show_over_temp, NULL, PSU_OVER_TEMP); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_linear, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_ascii, NULL, PSU_FAN_DIRECTION); +static SENSOR_DEVICE_ATTR(psu_pmbus_revision, S_IRUGO, show_byte, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, show_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IRUGO, show_ascii, NULL, PSU_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_min, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_max, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_min, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_max, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iin_max, S_IRUGO, show_linear, NULL, PSU_MFR_IIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX); + +/*Duplicate nodes for lm-sensors.*/ +static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_linear, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_linear, NULL, PSU_P_OUT_UV); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); + +static struct attribute *ym2651y_attributes[] = { + &sensor_dev_attr_psu_power_on.dev_attr.attr, + &sensor_dev_attr_psu_temp_fault.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_over_temp.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr, + /*Duplicate nodes for lm-sensors.*/ + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_temp1_fault.dev_attr.attr, + NULL +}; + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + return (attr->index == PSU_PMBUS_REVISION) ? sprintf(buf, "%d\n", data->pmbus_revision) : + sprintf(buf, "0\n"); +} + +static ssize_t show_word(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u16 status = 0; + + switch (attr->index) { + case PSU_POWER_ON: /* psu_power_on, low byte bit 6 of status_word, 0=>ON, 1=>OFF */ + status = (data->status_word & 0x40) ? 0 : 1; + break; + case PSU_TEMP_FAULT: /* psu_temp_fault, low byte bit 2 of status_word, 0=>Normal, 1=>temp fault */ + status = (data->status_word & 0x4) >> 2; + break; + case PSU_POWER_GOOD: /* psu_power_good, high byte bit 3 of status_word, 0=>OK, 1=>FAIL */ + status = (data->status_word & 0x800) ? 0 : 1; + break; + } + + return sprintf(buf, "%d\n", status); +} + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + ym2651y_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_OUT: + value = data->v_out; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_OUT_UV: + multiplier = 1000000; /*For lm-sensors, unit is micro-Volt.*/ + /*Passing through*/ + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp; + break; + case PSU_FAN1_SPEED: + value = data->fan_speed; + multiplier = 1; + break; + case PSU_FAN1_DUTY_CYCLE: + value = data->fan_duty_cycle[0]; + multiplier = 1; + break; + case PSU_MFR_VIN_MIN: + value = data->mfr_vin_min; + break; + case PSU_MFR_VIN_MAX: + value = data->mfr_vin_max; + break; + case PSU_MFR_VOUT_MIN: + value = data->mfr_vout_min; + break; + case PSU_MFR_VOUT_MAX: + value = data->mfr_vout_max; + break; + case PSU_MFR_PIN_MAX: + value = data->mfr_pin_max; + break; + case PSU_MFR_POUT_MAX: + value = data->mfr_pout_max; + break; + case PSU_MFR_IOUT_MAX: + value = data->mfr_iout_max; + break; + case PSU_MFR_IIN_MAX: + value = data->mfr_iin_max; + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct ym2651y_data *data = ym2651y_update_device(dev); + + return sprintf(buf, "%d\n", data->over_temp >> 7); +} + +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct ym2651y_data *data = ym2651y_update_device(dev); + u8 *ptr = NULL; + + switch (attr->index) { + case PSU_FAN_DIRECTION: /* psu_fan_dir */ + ptr = data->fan_dir; + break; + case PSU_MFR_ID: /* psu_mfr_id */ + ptr = data->mfr_id; + break; + case PSU_MFR_MODEL: /* psu_mfr_model */ + ptr = data->mfr_model; + break; + case PSU_MFR_REVISION: /* psu_mfr_revision */ + ptr = data->mfr_revsion; + break; + default: + return 0; + } + + return sprintf(buf, "%s\n", ptr); +} + +static const struct attribute_group ym2651y_group = { + .attrs = ym2651y_attributes, +}; + +static int ym2651y_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct ym2651y_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct ym2651y_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &ym2651y_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int ym2651y_remove(struct i2c_client *client) +{ + struct ym2651y_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &ym2651y_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id ym2651y_id[] = { + { "ym2651", YM2651 }, + { "ym2401", YM2401 }, + { "ym2851", YM2851 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, ym2651y_id); + +static struct i2c_driver ym2651y_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "ym2651", + }, + .probe = ym2651y_probe, + .remove = ym2651y_remove, + .id_table = ym2651y_id, + .address_list = normal_i2c, +}; + +static int ym2651y_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int ym2651y_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +static int ym2651y_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; + +abort: + return result; +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct ym2651y_data *ym2651y_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int i, status; + u8 command; + u8 fan_dir[5] = {0}; + struct reg_data_byte regs_byte[] = { {0x19, &data->capability}, + {0x7d, &data->over_temp}, + {0x81, &data->fan_fault}, + {0x98, &data->pmbus_revision} + }; + struct reg_data_word regs_word[] = { {0x79, &data->status_word}, + {0x8b, &data->v_out}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x8d, &data->temp}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x3c, &(data->fan_duty_cycle[1])}, + {0x90, &data->fan_speed}, + {0xa0, &data->mfr_vin_min}, + {0xa1, &data->mfr_vin_max}, + {0xa2, &data->mfr_iin_max}, + {0xa3, &data->mfr_pin_max}, + {0xa4, &data->mfr_vout_min}, + {0xa5, &data->mfr_vout_max}, + {0xa6, &data->mfr_iout_max}, + {0xa7, &data->mfr_pout_max} + }; + + dev_dbg(&client->dev, "Starting ym2651 update\n"); + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = ym2651y_read_byte(client, regs_byte[i].reg); + + if (status < 0) + { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + *(regs_byte[i].value) = 0; + } + else { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = ym2651y_read_word(client, regs_word[i].reg); + + if (status < 0) + { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + *(regs_word[i].value) = 0; + } + else { + *(regs_word[i].value) = status; + } + } + + /* Read fan_direction */ + command = 0xC3; + status = ym2651y_read_block(client, command, fan_dir, ARRAY_SIZE(fan_dir)-1); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + } + + strncpy(data->fan_dir, fan_dir+1, ARRAY_SIZE(data->fan_dir)-1); + data->fan_dir[ARRAY_SIZE(data->fan_dir)-1] = '\0'; + + /* Read mfr_id */ + command = 0x99; + status = ym2651y_read_block(client, command, data->mfr_id, + ARRAY_SIZE(data->mfr_id)-1); + data->mfr_id[ARRAY_SIZE(data->mfr_id)-1] = '\0'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + /* Read mfr_model */ + command = 0x9a; + status = ym2651y_read_block(client, command, data->mfr_model, + ARRAY_SIZE(data->mfr_model)-1); + data->mfr_model[ARRAY_SIZE(data->mfr_model)-1] = '\0'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + /* Read mfr_revsion */ + command = 0x9b; + status = ym2651y_read_block(client, command, data->mfr_revsion, + ARRAY_SIZE(data->mfr_revsion)-1); + data->mfr_revsion[ARRAY_SIZE(data->mfr_revsion)-1] = '\0'; + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(ym2651y_driver); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("3Y Power YM-2651Y driver"); +MODULE_LICENSE("GPL"); + + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/changelog b/platform/broadcom/sonic-platform-modules-accton/debian/changelog new file mode 100755 index 000000000000..2b08b12c206a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/changelog @@ -0,0 +1,18 @@ +sonic-accton-platform-modules (1.1) unstable; urgency=low + + * Add support for AS7816-64X. + + -- Accton Network Tue, 19 Dec 2017 09:35:58 +0800 + +sonic-accton-platform-modules (1.1) unstable; urgency=low + + * Add support for Accton AS5712-54X + + -- Accton Network Wed, 11 Oct 2017 14:21:45 +0800 + +sonic-accton-platform-modules (1.0) unstable; urgency=low + + * Add support for Accton AS7712-32X + * Initial release + + -- Accton Network Thu, 01 Jun 2017 14:06:38 +0800 diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/compat b/platform/broadcom/sonic-platform-modules-accton/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/control b/platform/broadcom/sonic-platform-modules-accton/debian/control new file mode 100755 index 000000000000..22faf6d202b8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/control @@ -0,0 +1,41 @@ +Source: sonic-accton-platform-modules +Section: main +Priority: extra +Maintainer: Accton network , Accton Network +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: sonic-platform-accton-as7712-32x +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: sonic-platform-accton-as5712-54x +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: sonic-platform-accton-as7816-64x +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: sonic-platform-accton-as7716-32x +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: sonic-platform-accton-as7716-32xb +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: sonic-platform-accton-as7312-54x +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: sonic-platform-accton-as7326-56x +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules new file mode 100755 index 000000000000..8274607f27b5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +include /usr/share/dpkg/pkg-info.mk + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +PYTHON ?= python2 + +PACKAGE_PRE_NAME := sonic-platform-accton +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= as7712-32x as5712-54x as7816-64x as7716-32x as7716-32xb as7312-54x as7326-56x +MODULE_DIR := modules +UTILS_DIR := utils +SERVICE_DIR := service +CLASSES_DIR := classes +CONF_DIR := conf + +%: + dh $@ --with systemd,python2,python3 --buildsystem=pybuild + +clean: + dh_testdir + dh_testroot + dh_clean + +build: + #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + $(PYTHON) $${mod}/setup.py build; \ + done) + +binary: binary-arch binary-indep + # Nothing to do + +binary-arch: + # Nothing to do + +#install: build + #dh_testdir + #dh_testroot + #dh_clean -k + #dh_installdirs + +binary-indep: + dh_testdir + dh_installdirs + + # Custom package commands + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + $(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + done) + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +.PHONY: build binary binary-arch binary-indep clean diff --git a/platform/broadcom/sonic-platform-modules-ingrasys b/platform/broadcom/sonic-platform-modules-ingrasys deleted file mode 160000 index f6e0fa9860c6..000000000000 --- a/platform/broadcom/sonic-platform-modules-ingrasys +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f6e0fa9860c6d1bd9274b091147d4fc06a0597c3 diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/.gitignore b/platform/broadcom/sonic-platform-modules-ingrasys/.gitignore new file mode 100644 index 000000000000..f805e810e5c6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/.gitignore @@ -0,0 +1,33 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# 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 diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/LICENSE b/platform/broadcom/sonic-platform-modules-ingrasys/LICENSE new file mode 100644 index 000000000000..9cecc1d4669e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/changelog b/platform/broadcom/sonic-platform-modules-ingrasys/debian/changelog new file mode 100644 index 000000000000..338234f97c45 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/changelog @@ -0,0 +1,22 @@ +platform-driver (1.1.0) unstable; urgency=low + + * Add support for s9200-64x + + -- developer Fri, 26 May 2017 11:00:00 +0800 + +platform-driver (1.1.0) unstable; urgency=low + + * Add support for s8810-32q + + -- developer Fri, 26 May 2017 11:00:00 +0800 +platform-driver (1.1.0) unstable; urgency=low + + * Add support for s8900 series + + -- developer Wed, 29 Mar 2017 11:00:00 +0800 + +platform-driver (1.0.0) unstable; urgency=low + + * Initial release (Closes: #nnnn) + + -- developer Wed, 05 Oct 2016 16:30:45 +0800 diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/compat b/platform/broadcom/sonic-platform-modules-ingrasys/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/control b/platform/broadcom/sonic-platform-modules-ingrasys/debian/control new file mode 100644 index 000000000000..99c87f772ed5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/control @@ -0,0 +1,26 @@ +Source: platform-driver +Section: unknown +Priority: optional +Maintainer: Wade He +Build-Depends: debhelper (>= 9), dh-systemd +Standards-Version: 1.0.0 + +Package: sonic-platform-ingrasys-s9100 +Architecture: amd64 +Description: This package contains S9100 platform driver utility for SONiC project. + +Package: sonic-platform-ingrasys-s8900-64xc +Architecture: amd64 +Description: This package contains S8900-64XC platform driver utility for SONiC project. + +Package: sonic-platform-ingrasys-s8900-54xc +Architecture: amd64 +Description: This package contains S8900-54XC platform driver utility for SONiC project. + +Package: sonic-platform-ingrasys-s8810-32q +Architecture: amd64 +Description: This package contains S8810-32Q platform driver utility for SONiC project. + +Package: sonic-platform-ingrasys-s9200-64x +Architecture: amd64 +Description: This package contains S9200-64X platform driver utility for SONiC project. diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/rules b/platform/broadcom/sonic-platform-modules-ingrasys/debian/rules new file mode 100644 index 000000000000..352dd55afbd7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/rules @@ -0,0 +1,80 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +PACKAGE_PRE_NAME := sonic-platform-ingrasys +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= s9100 s8900-64xc s8900-54xc s8810-32q s9200-64x +MODULE_DIR := modules +UTILS_DIR := utils +SERVICE_DIR := service +CONF_DIR := conf + +%: + dh $@ --with systemd + +clean: + dh_testdir + dh_testroot + dh_clean + +build: + #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + done) + +binary: binary-arch binary-indep + # Nothing to do + +binary-arch: + # Nothing to do + +#install: build + #dh_testdir + #dh_testroot + #dh_clean -k + #dh_installdirs + +binary-indep: + dh_testdir + dh_installdirs + + # Custom package commands + (for mod in $(MODULE_DIRS); do \ + mkdir debian/tmp/usr/sbin -p; \ + mkdir debian/tmp/lib/systemd/system -p; \ + mkdir debian/tmp/etc -p; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.sh debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/sbin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + done) + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +.PHONY: build binary binary-arch binary-indep clean diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.dirs b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.dirs new file mode 100644 index 000000000000..bec29f195770 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.dirs @@ -0,0 +1,3 @@ +usr/sbin +lib/systemd/system +etc/ \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.install b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.install new file mode 100644 index 000000000000..38efbef5d864 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.install @@ -0,0 +1,3 @@ +lib/systemd/ +usr/sbin/ +etc/ \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.postinst b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.postinst new file mode 100644 index 000000000000..6a94f8327559 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.postinst @@ -0,0 +1,43 @@ +# Automatically added by dh_systemd_enable +# This will only remove masks created by d-s-h on package removal. +deb-systemd-helper unmask s8810-32q-monitor.service >/dev/null || true +deb-systemd-helper unmask qsfp-monitor.service >/dev/null || true +# Generate kernel modules.dep and map files for add eeprom_mb. +depmod -a || true +# was-enabled defaults to true, so new installations run enable. +if deb-systemd-helper --quiet was-enabled s8810-32q-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable s8810-32q-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state s8810-32q-monitor.service >/dev/null || true +fi +if deb-systemd-helper --quiet was-enabled qsfp-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable qsfp-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state qsfp-monitor.service >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s8810-32q-monitor" ]; then + update-rc.d s8810-32q-monitor defaults >/dev/null + invoke-rc.d s8810-32q-monitor start || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + update-rc.d qsfp-monitor defaults >/dev/null + invoke-rc.d qsfp-monitor start || exit $? +fi +# End automatically added section +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + deb-systemd-invoke start s8810-32q-monitor.service >/dev/null || true + deb-systemd-invoke start qsfp-monitor.service >/dev/null || true +fi +# End automatically added section diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.postrm b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.postrm new file mode 100644 index 000000000000..a1049b153eef --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.postrm @@ -0,0 +1,38 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + fi +# End automatically added section +# Automatically added by dh_installinit +if [ "$1" = "purge" ] ; then + update-rc.d s8810-32q-monitor remove >/dev/null + update-rc.d qsfp-monitor remove >/dev/null +fi + + +# In case this system is running systemd, we make systemd reload the unit files +# to pick up changes. +if [ -d /run/systemd/system ] ; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_systemd_enable +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask s8810-32q-monitor.service >/dev/null + deb-systemd-helper mask qsfp-monitor.service >/dev/null + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge s8810-32q-monitor.service >/dev/null + deb-systemd-helper unmask s8810-32q-monitor.service >/dev/null + deb-systemd-helper purge qsfp-monitor.service >/dev/null + deb-systemd-helper unmask qsfp-monitor.service >/dev/null + fi +fi +# Generate kernel modules.dep and map files for remove eeprom_mb. +depmod -a || true +# End automatically added section + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.prerm b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.prerm new file mode 100644 index 000000000000..5a6581e5f410 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.prerm @@ -0,0 +1,17 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + deb-systemd-invoke stop s8810-32q-monitor.service >/dev/null + deb-systemd-invoke stop qsfp-monitor.service >/dev/null +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s8810-32q-monitor" ]; then + invoke-rc.d s8810-32q-monitor stop || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + invoke-rc.d qsfp-monitor stop || exit $? +fi +# Driver deinit +/usr/sbin/i2c_utils.sh i2c_deinit +# End automatically added section + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.upstart b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.upstart new file mode 100644 index 000000000000..f907d1bb51e5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8810-32q.upstart @@ -0,0 +1,6 @@ +description "SONiC platform service" + +respawn + +exec /usr/sbin/s8810_32q_monitor.sh +exec /usr/sbin/qsfp_monitor.sh diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.dirs b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.dirs new file mode 100644 index 000000000000..bec29f195770 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.dirs @@ -0,0 +1,3 @@ +usr/sbin +lib/systemd/system +etc/ \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.install b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.install new file mode 100644 index 000000000000..38efbef5d864 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.install @@ -0,0 +1,3 @@ +lib/systemd/ +usr/sbin/ +etc/ \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.postinst b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.postinst new file mode 100644 index 000000000000..d2dc4ea518fb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.postinst @@ -0,0 +1,43 @@ +# Automatically added by dh_systemd_enable +# This will only remove masks created by d-s-h on package removal. +deb-systemd-helper unmask s8900-54xc-monitor.service >/dev/null || true +# Generate kernel modules.dep and map files for add eeprom_mb. +depmod -a || true +# was-enabled defaults to true, so new installations run enable. +if deb-systemd-helper --quiet was-enabled s8900-54xc-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable s8900-54xc-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state s8900-54xc-monitor.service >/dev/null || true +fi +if deb-systemd-helper --quiet was-enabled qsfp-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable qsfp-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state qsfp-monitor.service >/dev/null || true +fi + +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s8900-54xc-monitor" ]; then + update-rc.d s8900-54xc-monitor defaults >/dev/null + invoke-rc.d s8900-54xc-monitor start || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + update-rc.d qsfp-monitor defaults >/dev/null + invoke-rc.d qsfp-monitor start || exit $? +fi +# End automatically added section +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + deb-systemd-invoke start s8900-54xc-monitor.service >/dev/null || true + deb-systemd-invoke start qsfp-monitor.service >/dev/null || true +fi +# End automatically added section diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.postrm b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.postrm new file mode 100644 index 000000000000..b4e4ede5d88d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.postrm @@ -0,0 +1,38 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + fi +# End automatically added section +# Automatically added by dh_installinit +if [ "$1" = "purge" ] ; then + update-rc.d s8900-54xc-monitor remove >/dev/null + update-rc.d qsfp-monitor remove >/dev/null +fi + + +# In case this system is running systemd, we make systemd reload the unit files +# to pick up changes. +if [ -d /run/systemd/system ] ; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_systemd_enable +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask s8900-54xc-monitor.service >/dev/null + deb-systemd-helper mask qsfp-monitor.service >/dev/null + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge s8900-54xc-monitor.service >/dev/null + deb-systemd-helper unmask s8900-54xc-monitor.service >/dev/null + deb-systemd-helper purge qsfp-monitor.service >/dev/null + deb-systemd-helper unmask qsfp-monitor.service >/dev/null + fi +fi +# Generate kernel modules.dep and map files for remove eeprom_mb. +depmod -a || true +# End automatically added section + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.prerm b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.prerm new file mode 100644 index 000000000000..b35262b16cf8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.prerm @@ -0,0 +1,17 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + deb-systemd-invoke stop s8900-54xc-monitor.service >/dev/null + deb-systemd-invoke stop qsfp-monitor.service >/dev/null +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s8900-54xc-monitor" ]; then + invoke-rc.d s8900-54xc-monitor stop || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + invoke-rc.d qsfp-monitor stop || exit $? +fi +# Driver deinit +/usr/sbin/i2c_utils.sh i2c_deinit +# End automatically added section + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.upstart b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.upstart new file mode 100644 index 000000000000..cfdfc490fcc7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-54xc.upstart @@ -0,0 +1,6 @@ +description "SONiC platform service" + +respawn + +exec /usr/sbin/s8900_54xc_monitor.sh +exec /usr/sbin/qsfp_monitor.sh diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.dirs b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.dirs new file mode 100644 index 000000000000..be337bc5ea1f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.dirs @@ -0,0 +1,3 @@ +usr/sbin +lib/systemd/system +etc/ diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.install b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.install new file mode 100644 index 000000000000..1cf6f97b306f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.install @@ -0,0 +1,3 @@ +lib/systemd/ +usr/sbin/ +etc/ diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.postinst b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.postinst new file mode 100644 index 000000000000..dfc789e964bd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.postinst @@ -0,0 +1,42 @@ +# Automatically added by dh_systemd_enable +# This will only remove masks created by d-s-h on package removal. +deb-systemd-helper unmask s8900-64xc-monitor.service >/dev/null || true +# Generate kernel modules.dep and map files for add eeprom_mb. +depmod -a || true +# was-enabled defaults to true, so new installations run enable. +if deb-systemd-helper --quiet was-enabled s8900-64xc-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable s8900-64xc-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state s8900-64xc-monitor.service >/dev/null || true +fi +if deb-systemd-helper --quiet was-enabled qsfp-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable qsfp-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state qsfp-monitor.service >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s8900-64xc-monitor" ]; then + update-rc.d s8900-64xc-monitor defaults >/dev/null + invoke-rc.d s8900-64xc-monitor start || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + update-rc.d qsfp-monitor defaults >/dev/null + invoke-rc.d qsfp-monitor start || exit $? +fi +# End automatically added section +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + deb-systemd-invoke start s8900-64xc-monitor.service >/dev/null || true + deb-systemd-invoke start qsfp-monitor.service >/dev/null || true +fi +# End automatically added section diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.postrm b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.postrm new file mode 100644 index 000000000000..e3dddecc088b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.postrm @@ -0,0 +1,38 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + fi +# End automatically added section +# Automatically added by dh_installinit +if [ "$1" = "purge" ] ; then + update-rc.d s8900-64xc-monitor remove >/dev/null + update-rc.d qsfp-monitor remove >/dev/null +fi + + +# In case this system is running systemd, we make systemd reload the unit files +# to pick up changes. +if [ -d /run/systemd/system ] ; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_systemd_enable +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask s8900-64xc-monitor.service >/dev/null + deb-systemd-helper mask qsfp-monitor.service >/dev/null + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge s8900-64xc-monitor.service >/dev/null + deb-systemd-helper unmask s8900-64xc-monitor.service >/dev/null + deb-systemd-helper purge qsfp-monitor.service >/dev/null + deb-systemd-helper unmask qsfp-monitor.service >/dev/null + fi +fi +# Generate kernel modules.dep and map files for remove eeprom_mb. +depmod -a || true +# End automatically added section + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.prerm b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.prerm new file mode 100644 index 000000000000..2168a6c76245 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.prerm @@ -0,0 +1,15 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + deb-systemd-invoke stop s8900-64xc-monitor.service >/dev/null + deb-systemd-invoke stop qsfp-monitor.service >/dev/null +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s8900-64xc-monitor" ]; then + invoke-rc.d s8900-64xc-monitor stop || exit $? + invoke-rc.d qsfp-monitor stop || exit $? +fi +# Driver deinit +/usr/sbin/i2c_utils.sh i2c_deinit +# End automatically added section + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.upstart b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.upstart new file mode 100644 index 000000000000..25510457ecd8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s8900-64xc.upstart @@ -0,0 +1,6 @@ +description "SONiC platform service" + +respawn + +exec /usr/sbin/s8900_64xc_monitor.sh +exec /usr/sbin/qsfp-monitor.sh diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.dirs b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.dirs new file mode 100644 index 000000000000..bec29f195770 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.dirs @@ -0,0 +1,3 @@ +usr/sbin +lib/systemd/system +etc/ \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.install b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.install new file mode 100644 index 000000000000..38efbef5d864 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.install @@ -0,0 +1,3 @@ +lib/systemd/ +usr/sbin/ +etc/ \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.postinst b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.postinst new file mode 100644 index 000000000000..a9bc64e26c05 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.postinst @@ -0,0 +1,43 @@ +# Automatically added by dh_systemd_enable +# This will only remove masks created by d-s-h on package removal. +deb-systemd-helper unmask s9100-monitor.service >/dev/null || true +deb-systemd-helper unmask qsfp-monitor.service >/dev/null || true +# Generate kernel modules.dep and map files for add eeprom_mb. +depmod -a || true +# was-enabled defaults to true, so new installations run enable. +if deb-systemd-helper --quiet was-enabled s9100-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable s9100-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state s9100-monitor.service >/dev/null || true +fi +if deb-systemd-helper --quiet was-enabled qsfp-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable qsfp-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state qsfp-monitor.service >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s9100-monitor" ]; then + update-rc.d s9100-monitor defaults >/dev/null + invoke-rc.d s9100-monitor start || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + update-rc.d qsfp-monitor defaults >/dev/null + invoke-rc.d qsfp-monitor start || exit $? +fi +# End automatically added section +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + deb-systemd-invoke start s9100-monitor.service >/dev/null || true + deb-systemd-invoke start qsfp-monitor.service >/dev/null || true +fi +# End automatically added section diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.postrm b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.postrm new file mode 100644 index 000000000000..669179b11e50 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.postrm @@ -0,0 +1,38 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + fi +# End automatically added section +# Automatically added by dh_installinit +if [ "$1" = "purge" ] ; then + update-rc.d s9100-monitor remove >/dev/null + update-rc.d qsfp-monitor remove >/dev/null +fi + + +# In case this system is running systemd, we make systemd reload the unit files +# to pick up changes. +if [ -d /run/systemd/system ] ; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_systemd_enable +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask s9100-monitor.service >/dev/null + deb-systemd-helper mask qsfp-monitor.service >/dev/null + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge s9100-monitor.service >/dev/null + deb-systemd-helper unmask s9100-monitor.service >/dev/null + deb-systemd-helper purge qsfp-monitor.service >/dev/null + deb-systemd-helper unmask qsfp-monitor.service >/dev/null + fi +fi +# Generate kernel modules.dep and map files for remove eeprom_mb. +depmod -a || true +# End automatically added section + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.prerm b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.prerm new file mode 100644 index 000000000000..2ca8a83b273f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.prerm @@ -0,0 +1,17 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + deb-systemd-invoke stop s9100-monitor.service >/dev/null + deb-systemd-invoke stop qsfp-monitor.service >/dev/null +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s9100-monitor" ]; then + invoke-rc.d s9100-monitor stop || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + invoke-rc.d qsfp-monitor stop || exit $? +fi +# Driver deinit +/usr/sbin/i2c_utils.sh i2c_deinit +# End automatically added section + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.upstart b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.upstart new file mode 100644 index 000000000000..5d0ba7080129 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9100.upstart @@ -0,0 +1,6 @@ +description "SONiC platform service" + +respawn + +exec /usr/sbin/s9100_monitor.sh +exec /usr/sbin/qsfp_monitor.sh diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.dirs b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.dirs new file mode 100644 index 000000000000..bec29f195770 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.dirs @@ -0,0 +1,3 @@ +usr/sbin +lib/systemd/system +etc/ \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.install b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.install new file mode 100644 index 000000000000..38efbef5d864 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.install @@ -0,0 +1,3 @@ +lib/systemd/ +usr/sbin/ +etc/ \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.postinst b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.postinst new file mode 100644 index 000000000000..0605612a1190 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.postinst @@ -0,0 +1,43 @@ +# Automatically added by dh_systemd_enable +# This will only remove masks created by d-s-h on package removal. +deb-systemd-helper unmask s9200-64x-monitor.service >/dev/null || true +deb-systemd-helper unmask qsfp-monitor.service >/dev/null || true +# Generate kernel modules.dep and map files for add eeprom_mb. +depmod -a || true +# was-enabled defaults to true, so new installations run enable. +if deb-systemd-helper --quiet was-enabled s9200-64x-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable s9200-64x-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state s9200-64x-monitor.service >/dev/null || true +fi +if deb-systemd-helper --quiet was-enabled qsfp-monitor.service; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable qsfp-monitor.service >/dev/null || true +else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state qsfp-monitor.service >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s9200-64x-monitor" ]; then + update-rc.d s9200-64x-monitor defaults >/dev/null + invoke-rc.d s9200-64x-monitor start || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + update-rc.d qsfp-monitor defaults >/dev/null + invoke-rc.d qsfp-monitor start || exit $? +fi +# End automatically added section +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + deb-systemd-invoke start s9200-64x-monitor.service >/dev/null || true + deb-systemd-invoke start qsfp-monitor.service >/dev/null || true +fi +# End automatically added section diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.postrm b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.postrm new file mode 100644 index 000000000000..3e9494097556 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.postrm @@ -0,0 +1,38 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + fi +# End automatically added section +# Automatically added by dh_installinit +if [ "$1" = "purge" ] ; then + update-rc.d s9200-64x-monitor remove >/dev/null + update-rc.d qsfp-monitor remove >/dev/null +fi + + +# In case this system is running systemd, we make systemd reload the unit files +# to pick up changes. +if [ -d /run/systemd/system ] ; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_systemd_enable +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask s9200-64x-monitor.service >/dev/null + deb-systemd-helper mask qsfp-monitor.service >/dev/null + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge s9200-64x-monitor.service >/dev/null + deb-systemd-helper unmask s9200-64x-monitor.service >/dev/null + deb-systemd-helper purge qsfp-monitor.service >/dev/null + deb-systemd-helper unmask qsfp-monitor.service >/dev/null + fi +fi +# Generate kernel modules.dep and map files for remove eeprom_mb. +depmod -a || true +# End automatically added section + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.prerm b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.prerm new file mode 100644 index 000000000000..6238dcad7886 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.prerm @@ -0,0 +1,17 @@ +# Automatically added by dh_systemd_start +if [ -d /run/systemd/system ]; then + deb-systemd-invoke stop s9200-64x-monitor.service >/dev/null + deb-systemd-invoke stop qsfp-monitor.service >/dev/null +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/s9200-64x-monitor" ]; then + invoke-rc.d s9200-64x-monitor stop || exit $? +fi +if [ -x "/etc/init.d/qsfp-monitor" ]; then + invoke-rc.d qsfp-monitor stop || exit $? +fi +# Driver deinit +/usr/sbin/i2c_utils.sh i2c_deinit +# End automatically added section + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.upstart b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.upstart new file mode 100644 index 000000000000..00803ff5e3b9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/debian/sonic-platform-ingrasys-s9200-64x.upstart @@ -0,0 +1,6 @@ +description "SONiC platform service" + +respawn + +exec /usr/sbin/s9200_64x_monitor.sh +exec /usr/sbin/qsfp_monitor.sh diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/README.md b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/README.md new file mode 100644 index 000000000000..dec38cb33393 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/README.md @@ -0,0 +1,185 @@ +# Ingrasys S8810-32Q Platform Driver for SONiC + +Copyright (C) 2016 Ingrasys, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +## Licensing terms + +The Licensing terms of the files within this project is split 2 parts. +The Linux kernel is released under the GNU General Public License version 2. +All other code is released under the GNU General Public License version 3. +Please see the LICENSE file for copies of both licenses. + +## Contents of this package + + - service/ + > Service config files for platform initialization and monitoring + - utils/ + > Scripts useful during platform bringup and sysfs function + - conf/ + > Platform configure files. + +## Kernel modules and drivers + +The driver for interacting with Ingrasys S8810-32Q is contained in the I2C +kernel module and initialization script. The initialization script loads +the modules in the correct order. It has been built and tested against +the Linux 3.16 kernel. + +The initialization script will modprobe the needed modules, navigate to the +module's device directory in sysfs, and write configuration data to +the kernel module. + +### IGB + +This is OOB Ports on front panel for management plane. + +The IGB module must be loaded first on Ingrasys S8810-32Q platform. + +### I2C i801 + +The I2C i801 on Ingrasys S8810-32Q can be found in +`/sys/bus/i2c/devices/i2c-0/` + +This is I2C bus for Clock Gen, DIMM channel and digital potentiometers. + +The i801 module must be loaded second on Ingrasys S8810-32Q. + +### I2C iSMT + +The I2C iSMT module on S8810-32Q can be found in +`/sys/bus/i2c/devices/i2c-1/` + +This is I2C bus for CPLD, HWM, power controller and I2C Switches. + +The i801 module must be loaded third on Ingrasys S8810-32Q. + +### I2C PCA9548 +The PCA9548 module on S8810-32Q can be found in +`/sys/bus/i2c/devices/i2c-2/` , `/sys/bus/i2c/devices/i2c-3/`, +`/sys/bus/i2c/devices/i2c-4/`, `/sys/bus/i2c/devices/i2c-5/`, +`/sys/bus/i2c/devices/i2c-6/`, `/sys/bus/i2c/devices/i2c-7/`, +`/sys/bus/i2c/devices/i2c-8/`, `/sys/bus/i2c/devices/i2c-9/`. + +The pca9548 module for zQSFP module get/set functions, PSU information, +fan status and EEPROM. + +## Hardware components + +The hardware components are initialized in the init script on S8810-32Q. +The following describes manual initialization as well as interaction. +The examples below are just for Ingrasys S8810-32Q platform. + +### Hardware initialization + +When the sonic-platform-ingrasys-s8810-32q package is installed on the S8810-32Q, +it is automatically initialized. If you want to manual initialization, the +utility command usage as follows: +``` + i2c_utils.sh i2c_init +``` + +### EEPROM + +The EEPROM is including the board SKU, model name, vendor name, serial number, +and other information can be accessed with the specific eeprom kernel module. +After using `modprobe eeprom_mb` to detect the eeprom, it will show up in sysfs. + +The hexdump utility can be used to decode the raw output of the EEPROM. +For example, +``` + bash# echo "mb_eeprom 0x54" > /sys/bus/i2c/devices/i2c-9/new_device + bash# cat /sys/bus/i2c/drivers/mb_eeprom/9-0054/eeprom | hexdump -C +``` + +### Front panel LEDs + +LEDs can be setup on/off by using i2c utility `/usr/sbin/i2c_utils.sh`. +Utility function command usage as follows: + +``` +Status LED: + i2c_utils.sh i2c_sys_led green|amber on|off + +Fan status LED: + i2c_utils.sh i2c_fan_led green|amber on|off + +PSU1 status LED: + i2c_utils.sh i2c_psu1_led green|amber on|off + +PSU2 status LED: + i2c_utils.sh i2c_psu2_led green|amber on|off + +``` +QSFP Module Port LEDs control by ASIC library. + + +### Fan speed + +Fan speed are controlled by the w83795 kernel module. +It can be found in `/sys/class/hwmon/hwmon1/device/`. +If they were compiled as modules, you will need to modprobe w83795 for +their sysfs entries to show up. Each fan has an `fan_input` file +for reading the fan speed. And `pwm1` setting fan1 to fan4, +`pwm2` setting fan5 to fan8. + +There is docker-platform-monitor container installed fancontrol package that can +automatic control platform fan speed. + + +### Temperature sensors + +Temperature sensors are controlled by the w83795 kernel +module. It can be found in `/sys/class/hwmon/hwmon1/device/`. +If they were compiled as modules, then you will need to modprobe w83795 for +their sysfs entries to show up. +`temp1_input` is front MAC temperature sensor. `temp2_input` is rear MAC +temperature sensor. + +There is docker-platform-monitor container installed lm-sensors package that can +monitor platform temperature. And `sensors` command can show each +temperature sensors status. + +### Power supplies + +Power supplies status and its EEPROM info can be used i2c utility +`/usr/sbin/i2c_utils.sh` to get. +The usage as follows: +``` +PSU EEPROM: + i2c_utils.sh i2c_psu_eeprom_get + hexdump -C psu0.rom + hexdump -C psu1.rom + +PSU Status: + i2c_utils.sh i2c_psu_status +``` + +### QSFPs +QSFP modules are managed by the pca9548 kernel driver. +The i2c utility `/usr/sbin/i2c_utils.sh` can be used to get status and +module EEPROM informations. +The usage as follows: +``` +QSFP EEPROM: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + +QSFP Insert Event: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + 0 => not insert + 1 => inserted +``` + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/Makefile b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/Makefile new file mode 100755 index 000000000000..7c782163f402 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := eeprom_mb.o +obj-m += ingrasys_s8810_32q_psu.o diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/eeprom_mb.c b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/eeprom_mb.c new file mode 100755 index 000000000000..2040e3cfc5db --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/eeprom_mb.c @@ -0,0 +1,212 @@ +/* + * Copyright (C) 1998, 1999 Frodo Looijaard and + * Philip Edelbrock + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003 IBM Corp. + * Copyright (C) 2004 Jean Delvare + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, + 0x55, 0x56, 0x57, I2C_CLIENT_END }; + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void mb_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, (u8)((addr >> 8) & 0xFF), (u8)(addr & 0xFF)); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t mb_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + mb_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static struct bin_attribute mb_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = mb_eeprom_read, +}; + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int mb_eeprom_detect(struct i2c_client *client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + + /* EDID EEPROMs are often 24C00 EEPROMs, which answer to all + addresses 0x50-0x57, but we only care about 0x50. So decline + attaching to addresses >= 0x51 on DDC buses */ + if (!(adapter->class & I2C_CLASS_SPD) && client->addr >= 0x56) { + return -ENODEV; + } + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE) + && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + return -ENODEV; + } + + strlcpy(info->type, "eeprom", I2C_NAME_SIZE); + + return 0; +} + +static int mb_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &mb_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int mb_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &mb_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id mb_eeprom_id[] = { + { "mb_eeprom", 0 }, + { } +}; + +static struct i2c_driver mb_eeprom_driver = { + .driver = { + .name = "mb_eeprom", + }, + .probe = mb_eeprom_probe, + .remove = mb_eeprom_remove, + .id_table = mb_eeprom_id, + + .class = I2C_CLASS_DDC | I2C_CLASS_SPD, + .detect = mb_eeprom_detect, + .address_list = normal_i2c, +}; + +module_i2c_driver(mb_eeprom_driver); + +MODULE_AUTHOR("Wade "); +MODULE_DESCRIPTION("Ingrasys S8810-32Q Mother Board EEPROM driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/ingrasys_s8810_32q_platform.h b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/ingrasys_s8810_32q_platform.h new file mode 100644 index 000000000000..a88755946e9a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/ingrasys_s8810_32q_platform.h @@ -0,0 +1,148 @@ +#ifndef _S8810_32Q_PLATFORM_H +#define _S8810_32Q_PLATFORM_H + +#include + +// remove debug before release +#define DEBUG + +enum bus_order { + I2C_BUS_MAIN, + MUX_9548_0_CH0, + MUX_9548_0_CH1, + MUX_9548_0_CH2, + MUX_9548_0_CH3, + MUX_9548_0_CH4, + MUX_9548_0_CH5, + MUX_9548_0_CH6, + MUX_9548_0_CH7, + MUX_9548_1_CH0, + MUX_9548_1_CH1, + MUX_9548_1_CH2, + MUX_9548_1_CH3, + MUX_9548_1_CH4, + MUX_9548_1_CH5, + MUX_9548_1_CH6, + MUX_9548_1_CH7, + MUX_9546_0_CH0, + MUX_9546_0_CH1, + MUX_9546_0_CH2, + MUX_9546_0_CH3, + MUX_9546_1_CH0, + MUX_9546_1_CH1, + MUX_9546_1_CH2, + MUX_9546_1_CH3, + MUX_9548_2_CH0, + MUX_9548_2_CH1, + MUX_9548_2_CH2, + MUX_9548_2_CH3, + MUX_9548_2_CH4, + MUX_9548_2_CH5, + MUX_9548_2_CH6, + MUX_9548_2_CH7, + MUX_9548_3_CH0, + MUX_9548_3_CH1, + MUX_9548_3_CH2, + MUX_9548_3_CH3, + MUX_9548_3_CH4, + MUX_9548_3_CH5, + MUX_9548_3_CH6, + MUX_9548_3_CH7, + MUX_9548_4_CH0, + MUX_9548_4_CH1, + MUX_9548_4_CH2, + MUX_9548_4_CH3, + MUX_9548_4_CH4, + MUX_9548_4_CH5, + MUX_9548_4_CH6, + MUX_9548_4_CH7, + MUX_9548_5_CH0, + MUX_9548_5_CH1, + MUX_9548_5_CH2, + MUX_9548_5_CH3, + MUX_9548_5_CH4, + MUX_9548_5_CH5, + MUX_9548_5_CH6, + MUX_9548_5_CH7, + MUX_9548_6_CH0, + MUX_9548_6_CH1, + MUX_9548_6_CH2, + MUX_9548_6_CH3, + MUX_9548_6_CH4, + MUX_9548_6_CH5, + MUX_9548_6_CH6, + MUX_9548_6_CH7, + MUX_9548_7_CH0, + MUX_9548_7_CH1, + MUX_9548_7_CH2, + MUX_9548_7_CH3, + MUX_9548_7_CH4, + MUX_9548_7_CH5, + MUX_9548_7_CH6, + MUX_9548_7_CH7, + MUX_9548_8_CH0, + MUX_9548_8_CH1, + MUX_9548_8_CH2, + MUX_9548_8_CH3, + MUX_9548_8_CH4, + MUX_9548_8_CH5, + MUX_9548_8_CH6, + MUX_9548_8_CH7, + MUX_9548_9_CH0, + MUX_9548_9_CH1, + MUX_9548_9_CH2, + MUX_9548_9_CH3, + MUX_9548_9_CH4, + MUX_9548_9_CH5, + MUX_9548_9_CH6, + MUX_9548_9_CH7, + MUX_9548_10_CH0, + MUX_9548_10_CH1, + MUX_9548_10_CH2, + MUX_9548_10_CH3, + MUX_9548_10_CH4, + MUX_9548_10_CH5, + MUX_9548_10_CH6, + MUX_9548_10_CH7, +}; + +#define I2C_ADDR_MUX_9555_0 (0x20) +#define I2C_ADDR_MUX_9555_1 (0x24) +#define I2C_ADDR_MUX_9555_2 (0x25) +#define I2C_ADDR_MUX_9555_3 (0x26) +#define I2C_ADDR_MUX_9539_0 (0x76) +#define I2C_ADDR_MUX_9539_1 (0x76) +#define I2C_BUS_FAN_STATUS (I2C_BUS_MAIN) +#define I2C_BUS_SYS_LED (MUX_9548_1_CH1) + +#define NUM_OF_I2C_MUX (11) +#define NUM_OF_CPLD (5) +#define NUM_OF_QSFP_PORT (64) +#define NUM_OF_SFP_PORT (2) +#define QSFP_EEPROM_I2C_ADDR (0x50) + +enum gpio_reg { + REG_PORT0_IN, + REG_PORT1_IN, + REG_PORT0_OUT, + REG_PORT1_OUT, + REG_PORT0_POL, + REG_PORT1_POL, + REG_PORT0_DIR, + REG_PORT1_DIR, +}; + +struct ing_i2c_board_info { + int ch; + int size; + struct i2c_board_info *board_info; +}; + +struct i2c_init_data { + __u16 ch; + __u16 addr; + __u8 reg; + __u8 value; +}; + +#endif diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/ingrasys_s8810_32q_psu.c b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/ingrasys_s8810_32q_psu.c new file mode 100644 index 000000000000..ae34c8eb33ed --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/modules/ingrasys_s8810_32q_psu.c @@ -0,0 +1,393 @@ +/* + * S8810-32Q PSU driver + * + * Copyright (C) 2017 Ingrasys, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ingrasys_s8810_32q_platform.h" + +static ssize_t show_psu_eeprom(struct device *dev, + struct device_attribute *da, + char *buf); +static struct s8810_psu_data *s8810_psu_update_status(struct device *dev); +static struct s8810_psu_data *s8810_psu_update_eeprom(struct device *dev); +static int s8810_psu_read_block(struct i2c_client *client, + u8 command, + u8 *data, + int data_len); + + +#define DRIVER_NAME "psu" + +// Addresses scanned +static const unsigned short normal_i2c[] = { 0x51, I2C_CLIENT_END }; + +/* PSU EEPROM SIZE */ +#define EEPROM_SZ 256 +#define READ_EEPROM 1 +#define NREAD_EEPROM 0 + +static struct i2c_client cpld_client; + +/* CPLD Registers */ +#define REG_PSU_PG 0x02 +#define REG_PSU_PRSNT 0x03 + +/* CPLD Pins */ +#define PSU1_PRSNT_L 0 +#define PSU2_PRSNT_L 1 +#define PSU1_PWROK 3 +#define PSU2_PWROK 4 + + +/* Driver Private Data */ +struct s8810_psu_data { + struct mutex lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + char eeprom[EEPROM_SZ]; /* psu eeprom data */ + char psuABS; /* PSU absent */ + char psuPG; /* PSU power good */ +}; + +enum psu_index +{ + s8810_psu1, + s8810_psu2 +}; + +/* + * display power good attribute + */ +static ssize_t +show_psu_pg(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct s8810_psu_data *data = s8810_psu_update_status(dev); + unsigned int value; + + mutex_lock(&data->lock); + value = data->psuPG; + mutex_unlock(&data->lock); + + return sprintf(buf, "%d\n", value); +} + +/* + * display power absent attribute + */ +static ssize_t +show_psu_abs(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct s8810_psu_data *data = s8810_psu_update_status(dev); + unsigned int value; + + mutex_lock(&data->lock); + value = data->psuABS; + mutex_unlock(&data->lock); + + return sprintf(buf, "%d\n", value); +} + + +/* + * sysfs attributes for psu + */ +static DEVICE_ATTR(psu_pg, S_IRUGO, show_psu_pg, NULL); +static DEVICE_ATTR(psu_abs, S_IRUGO, show_psu_abs, NULL); +static DEVICE_ATTR(psu_eeprom, S_IRUGO, show_psu_eeprom, NULL); + +static struct attribute *s8810_psu_attributes[] = { + &dev_attr_psu_pg.attr, + &dev_attr_psu_abs.attr, + &dev_attr_psu_eeprom.attr, + NULL +}; + +/* + * display psu eeprom content + */ +static ssize_t +show_psu_eeprom(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct s8810_psu_data *data = s8810_psu_update_eeprom(dev); + + memcpy(buf, (char *)data->eeprom, EEPROM_SZ); + return EEPROM_SZ; +} + +static const struct attribute_group s8810_psu_group = { + .attrs = s8810_psu_attributes, +}; + +/* + * check gpio expander is accessible + */ +static int +cpld_detect(struct i2c_client *client) +{ + if (i2c_smbus_read_byte_data(client, REG_PSU_PG) < 0) { + return -ENODEV; + } + + return 0; +} + +/* + * client address init + */ +static void +i2c_devices_client_address_init(struct i2c_client *client) +{ + cpld_client = *client; + cpld_client.addr = 0x33; +} + +static int +s8810_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct s8810_psu_data *data; + int status, err; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct s8810_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + memset(data, 0, sizeof(struct s8810_psu_data)); + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->lock); + + i2c_devices_client_address_init(client); + + err = cpld_detect(&cpld_client); + if (err) { + dev_info(&client->dev, "cpld detect failure\n"); + return err; + } + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &s8810_psu_group); + if (status) { + goto exit_free; + } + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &s8810_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int +s8810_psu_remove(struct i2c_client *client) +{ + struct s8810_psu_data *data = i2c_get_clientdata(client); + + sysfs_remove_group(&client->dev.kobj, &s8810_psu_group); + kfree(data); + + return 0; +} + + +/* + * psu eeprom read utility + */ +static int +s8810_psu_read_block(struct i2c_client *client, + u8 command, + u8 *data, + int data_len) +{ + int i=0, ret=0; + int blk_max = 32; //max block read size + + /* read eeprom, 32 * 8 = 256 bytes */ + for (i=0; i < EEPROM_SZ/blk_max; i++) { + ret = i2c_smbus_read_i2c_block_data(client, (i*blk_max), blk_max, + data + (i*blk_max)); + if (ret < 0) { + return ret; + } + } + return ret; +} + +/* + * update eeprom content + */ +static struct s8810_psu_data +*s8810_psu_update_eeprom(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct s8810_psu_data *data = i2c_get_clientdata(client); + s32 status = 0; + char psu_pg = 0; + char psu_prsnt = 0; + int psu_pwrok = 0; + int psu_prsnt_l = 0; + + mutex_lock(&data->lock); + + if (time_after(jiffies, data->last_updated + 300 * HZ) + || !data->valid) { + + /* Read psu status */ + + psu_pg = i2c_smbus_read_byte_data(&(cpld_client), REG_PSU_PG); + psu_prsnt = i2c_smbus_read_byte_data(&(cpld_client), REG_PSU_PRSNT); + + /*read psu status from io expander*/ + + if (data->index == s8810_psu1) { + psu_pwrok = PSU1_PWROK; + psu_prsnt_l = PSU1_PRSNT_L; + } else { + psu_pwrok = PSU2_PWROK; + psu_prsnt_l = PSU2_PRSNT_L; + } + data->psuPG = (psu_pg >> psu_pwrok) & 0x1; + data->psuABS = (psu_prsnt >> psu_prsnt_l) & 0x1; + + /* Read eeprom */ + if (!data->psuABS) { + //clear local eeprom data + memset(data->eeprom, 0, EEPROM_SZ); + + //read eeprom + status = s8810_psu_read_block(client, 0, data->eeprom, + ARRAY_SIZE(data->eeprom)); + + if (status < 0) { + memset(data->eeprom, 0, EEPROM_SZ); + dev_err(&client->dev, "Read eeprom failed, status=(%d)\n", status); + } else { + data->valid = 1; + } + } else { + memset(data->eeprom, 0, EEPROM_SZ); + } + data->last_updated = jiffies; + } + + mutex_unlock(&data->lock); + + return data; +} + +/* + * update psu status + */ +static struct s8810_psu_data +*s8810_psu_update_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct s8810_psu_data *data = i2c_get_clientdata(client); + char psu_pg = 0; + char psu_prsnt = 0; + int psu_pwrok = 0; + int psu_prsnt_l = 0; + + mutex_lock(&data->lock); + + /* Read psu status */ + + psu_pg = i2c_smbus_read_byte_data(&(cpld_client), REG_PSU_PG); + psu_prsnt = i2c_smbus_read_byte_data(&(cpld_client), REG_PSU_PRSNT); + + /*read psu status from io expander*/ + + if (data->index == s8810_psu1) { + psu_pwrok = PSU1_PWROK; + psu_prsnt_l = PSU1_PRSNT_L; + } else { + psu_pwrok = PSU2_PWROK; + psu_prsnt_l = PSU2_PRSNT_L; + } + data->psuPG = (psu_pg >> psu_pwrok) & 0x1; + data->psuABS = (psu_prsnt >> psu_prsnt_l) & 0x1; + + mutex_unlock(&data->lock); + + return data; +} + +static const struct i2c_device_id s8810_psu_id[] = { + { "psu1", s8810_psu1 }, + { "psu2", s8810_psu2 }, + {} +}; + +MODULE_DEVICE_TABLE(i2c, s8810_psu_id); + +static struct i2c_driver s8810_psu_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = s8810_psu_probe, + .remove = s8810_psu_remove, + .id_table = s8810_psu_id, + .address_list = normal_i2c, +}; + +static int __init s8810_psu_init(void) +{ + return i2c_add_driver(&s8810_psu_driver); +} + +static void __exit s8810_psu_exit(void) +{ + i2c_del_driver(&s8810_psu_driver); +} + +module_init(s8810_psu_init); +module_exit(s8810_psu_exit); + +MODULE_AUTHOR("Jason Tsai "); +MODULE_DESCRIPTION("S8810-32Q psu driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/service/qsfp-monitor.service b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/service/qsfp-monitor.service new file mode 100644 index 000000000000..3d69fdae0f87 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/service/qsfp-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description= This QSFP Monitor service is to setup QSFP SI. +Requires=s8810-32q-monitor.service +After=s8810-32q-monitor.service + +[Service] +ExecStart=/usr/sbin/qsfp_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/service/s8810-32q-monitor.service b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/service/s8810-32q-monitor.service new file mode 100644 index 000000000000..644efe443256 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/service/s8810-32q-monitor.service @@ -0,0 +1,19 @@ +[Unit] +Description= This Platform Monitor service is to initialize platform and monitor platform. +Before=platform-monitor.service +After=sysinit.target +Wants=fancontrol.service +Wants=qsfp-monitor.service +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/sbin/i2c_utils.sh i2c_init +ExecStart=/usr/sbin/s8810_32q_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/i2c_utils.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/i2c_utils.sh new file mode 100644 index 000000000000..98ffb9d8d2f4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/i2c_utils.sh @@ -0,0 +1,1452 @@ +#!/bin/bash + +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +VERSION="1.0.0" +TRUE=200 +FALSE=404 + +EXEC_FUNC=${1} +COLOR_LED=${2} +QSFP_PORT=${2} +QSFP_ACTION=${2} +MB_EEPROM_ACTION=${2} +ONOFF_LED=${3} +FAN_TRAY=${4} + +############################################################ +# Distributor ID: Debian +# Description: Debian GNU/Linux 8.6 (jessie) +# Release: 8.6 +# Codename: jessie +# Linux debian 3.16.0-4-amd64 #1 +# SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux +############################################################ + +# Color Definition +COLOR_TITLE="\e[1;32m" ### Green ### +COLOR_WARNING="\e[1;33m" ### Yellow ### +COLOR_ERROR="\e[1;31m" ### Red ### +COLOR_END="\e[0m" ### END ### + +NUM_I801_DEVICE=0 +NUM_ISMT_DEVICE=$(( ${NUM_I801_DEVICE} + 1 )) + +#MUX PCA9548#0 +NUM_MUX_9548_0_CHAN0=$(( ${NUM_I801_DEVICE} + 2 )) +NUM_MUX_9548_0_CHAN1=$(( ${NUM_I801_DEVICE} + 3 )) +NUM_MUX_9548_0_CHAN2=$(( ${NUM_I801_DEVICE} + 4 )) +#NUM_MUX_9548_0_CHAN3=$(( ${NUM_I801_DEVICE} + 5 )) +#NUM_MUX_9548_0_CHAN4=$(( ${NUM_I801_DEVICE} + 6 )) +#NUM_MUX_9548_0_CHAN5=$(( ${NUM_I801_DEVICE} + 7 )) +#NUM_MUX_9548_0_CHAN6=$(( ${NUM_I801_DEVICE} + 8 )) +#NUM_MUX_9548_0_CHAN7=$(( ${NUM_I801_DEVICE} + 9 )) + +#MUX PCA9548#1 +NUM_MUX_9548_1_CHAN0=$(( ${NUM_I801_DEVICE} + 10 )) +NUM_MUX_9548_1_CHAN1=$(( ${NUM_I801_DEVICE} + 11 )) +NUM_MUX_9548_1_CHAN2=$(( ${NUM_I801_DEVICE} + 12 )) +NUM_MUX_9548_1_CHAN3=$(( ${NUM_I801_DEVICE} + 13 )) +NUM_MUX_9548_1_CHAN4=$(( ${NUM_I801_DEVICE} + 14 )) +NUM_MUX_9548_1_CHAN5=$(( ${NUM_I801_DEVICE} + 15 )) +NUM_MUX_9548_1_CHAN6=$(( ${NUM_I801_DEVICE} + 16 )) +NUM_MUX_9548_1_CHAN7=$(( ${NUM_I801_DEVICE} + 17 )) + +NUM_MUX_9548_2_CHAN0=$(( ${NUM_I801_DEVICE} + 18 )) +NUM_MUX_9548_3_CHAN0=$(( ${NUM_I801_DEVICE} + 26 )) +NUM_MUX_9548_4_CHAN0=$(( ${NUM_I801_DEVICE} + 34 )) +NUM_MUX_9548_5_CHAN0=$(( ${NUM_I801_DEVICE} + 42 )) + +#MUX Alias +I2C_BUS_PSU1_EEPROM=${NUM_MUX_9548_0_CHAN1} +I2C_BUS_PSU2_EEPROM=${NUM_MUX_9548_0_CHAN2} +I2C_BUS_FAN_STATUS=${NUM_MUX_9548_1_CHAN0} +I2C_BUS_LED_BOARD=${NUM_MUX_9548_1_CHAN0} +I2C_BUS_MB_EEPROM=${NUM_MUX_9548_1_CHAN2} + +PATH_SYS_I2C_DEVICES="/sys/bus/i2c/devices" +PATH_SYS_GPIO="/sys/class/gpio" +PATH_HWMON_ROOT_DEVICES="/sys/class/hwmon" +PATH_HWMON_W83795_DEVICE="${PATH_HWMON_ROOT_DEVICES}/hwmon1" +PATH_I801_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}" +PATH_ISMT_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_ISMT_DEVICE}" +#PATH for MUX PCA9548#0 +PATH_MUX_9548_0_CHAN0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CHAN0}" +PATH_MUX_9548_0_CHAN1="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CHAN1}" +PATH_MUX_9548_0_CHAN2="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CHAN2}" +#PATH for MUX PCA9548#1 +PATH_MUX_9548_1_CHAN0="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN0}" +PATH_MUX_9548_1_CHAN1="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN1}" +PATH_MUX_9548_1_CHAN2="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN2}" +PATH_MUX_9548_1_CHAN3="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN3}" +PATH_MUX_9548_1_CHAN4="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN4}" +PATH_MUX_9548_1_CHAN5="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN5}" +PATH_MUX_9548_1_CHAN6="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN6}" +PATH_MUX_9548_1_CHAN7="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN7}" + +#i2cmap and gpiomap path +PATH_GPIOMAP=/tmp/gpiomap +PATH_I2CMAP=/tmp/i2cmap + +I2C_ADDR_MUX_9548_0=0x70 +I2C_ADDR_MUX_9548_1=0x70 +I2C_ADDR_MUX_9548_2=0x71 +I2C_ADDR_MUX_9548_3=0x71 +I2C_ADDR_MUX_9548_4=0x71 +I2C_ADDR_MUX_9548_5=0x71 +I2C_ADDR_DDR3=0x50 +I2C_ADDR_RTC=0x68 +I2C_ADDR_CPLD=0x33 +I2C_ADDR_HWM=0x2F +I2C_ADDR_MUX_9535_FAN=0x20 +I2C_ADDR_MUX_9535_LED=0x22 +I2C_ADDR_MUX_9535_0=0x20 +I2C_ADDR_MUX_9535_1=0x21 +I2C_ADDR_MUX_9535_2=0x22 +I2C_ADDR_MUX_9535_3=0x23 +I2C_ADDR_MUX_9535_4=0x20 +I2C_ADDR_MUX_9535_5=0x21 +I2C_ADDR_MUX_9535_6=0x22 +I2C_ADDR_MUX_9535_7=0x23 +I2C_ADDR_MUX_9535_8=0x20 +I2C_ADDR_MUX_9535_9=0x21 +I2C_ADDR_MUX_9535_10=0x22 +I2C_ADDR_MB_EEPROM=0x56 +I2C_ADDR_QSFP_EEPROM=0x50 +I2C_ADDR_PSU_EEPROM=0x51 + +#sysfs +PATH_SYSFS_PSU1="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_PSU1_EEPROM}-$(printf "%04x" $I2C_ADDR_PSU_EEPROM)" +PATH_SYSFS_PSU2="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_PSU2_EEPROM}-$(printf "%04x" $I2C_ADDR_PSU_EEPROM)" + +#Active High/Low +ACTIVE_LOW=1 +ACTIVE_HIGH=0 +#GPIO Direction In/Out +DIR_IN=in +DIR_OUT=out + +#Power Supply Status +PSU_DC_ON=1 +PSU_DC_OFF=0 +PSU_EXIST=1 +PSU_NOT_EXIST=0 + +#W83795 Registers +REG_BANK_SEL=0x00 +REG_VOLT_CTRL1=0x02 +REG_VOLT_CTRL2=0x03 +REG_TEMP_CTRL1=0x04 +REG_TEMP_CTRL2=0x05 + +#PCA9535 Registers +REG_IN_0=0 +REG_IN_1=1 +REG_OUT_0=2 +REG_OUT_1=3 +REG_POLARITY_0=4 +REG_POLARITY_1=5 +REG_CFG_0=6 +REG_CFG_1=7 + +#Bit Mask +BIT_MASK=(1 2 4 8 16 32 64 128) + + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} i2c_init" + echo " : ${0} i2c_deinit" + echo " : ${0} i2c_temp_init" + echo " : ${0} i2c_fan_init" + echo " : ${0} i2c_volmon_init" + echo " : ${0} i2c_io_exp_init" + echo " : ${0} i2c_gpio_init" + echo " : ${0} i2c_gpio_deinit" + echo " : ${0} i2c_psu_eeprom_get" + echo " : ${0} i2c_mb_eeprom_get" + echo " : ${0} i2c_qsfp_eeprom_get [1-32]" + echo " : ${0} i2c_qsfp_eeprom_init new|delete" + echo " : ${0} i2c_mb_eeprom_init new|delete" + echo " : ${0} i2c_qsfp_status_get [1-32]" + echo " : ${0} i2c_qsfp_type_get [1-32]" + echo " : ${0} i2c_board_type_get" + echo " : ${0} i2c_psu_status" + echo " : ${0} i2c_led_psu_status_set" + echo " : ${0} i2c_led_fan_status_set" + echo " : ${0} i2c_led_fan_tray_status_set" + echo " : ${0} i2c_led_fan_tray_test" + echo " : ${0} i2c_cpld_version" + echo " : ${0} i2c_test_all" + echo " : ${0} i2c_led_test" + echo " : ${0} i2c_sys_led green|amber on|off" + echo " : ${0} i2c_fan_led green|amber on|off" + echo " : ${0} i2c_psu1_led green|amber on|off" + echo " : ${0} i2c_psu2_led green|amber on|off" + echo " : ${0} i2c_fan_tray_led green|amber on|off [1-4]" + echo "----------------------------------------------------" +} + +#Pause function +function _pause { + read -p "$*" +} + +#Retry command function +function _retry { + local i + for i in {1..5}; + do + eval "${*}" && break || echo "retry"; sleep 1; + done +} + +#set i2cmap +function _set_i2cmap { + local i2c_n=$1 + local alias=$2 + + #create i2cmap dir if not exist + mkdir -p $PATH_I2CMAP + + #check i2c_n exists in sysfs + if [ ! -L ${PATH_SYS_I2C_DEVICES}/i2c-${i2c_n} ]; then + echo "${PATH_SYS_I2C_DEVICES}/i2c-${i2c_n} does not exist." + return + fi + + #create or update link + ln -sf ${PATH_SYS_I2C_DEVICES}/i2c-${i2c_n} ${PATH_I2CMAP}/${alias} +} + +#clear i2cmap +function _clear_i2cmap { + #delete i2cmap dir + rm -rf ${PATH_I2CMAP}/ +} + + +#I2C Init +function _i2c_init { + echo "=========================================================" + echo "# Description: I2C Init" + echo "=========================================================" + + rmmod i2c_ismt + rmmod i2c_i801 + modprobe i2c_i801 + modprobe i2c_ismt + modprobe i2c_dev + modprobe i2c_mux_pca954x force_deselect_on_exit=1 + + #add MUX PCA9548#0 on I801 + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_0_CHAN0}" ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_0}' > ${PATH_I801_DEVICE}/new_device" + _set_i2cmap ${NUM_MUX_9548_0_CHAN0} "PCA9548_0" + else + echo "pca9548#0 ${I2C_ADDR_MUX_9548_0} already init." + fi + #add MUX PCA9548#1 on ISMT + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN0}" ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_1}' > ${PATH_ISMT_DEVICE}/new_device" + _set_i2cmap ${NUM_MUX_9548_1_CHAN0} "PCA9548_1" + else + echo "pca9548#1 ${I2C_ADDR_MUX_9548_1} already init." + fi + #add MUX PCA9548#2 on PCA9548#1 + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_2_CHAN0}" ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_2}' > ${PATH_MUX_9548_1_CHAN4}/new_device" + _set_i2cmap ${NUM_MUX_9548_2_CHAN0} "PCA9548_2" + else + echo "pca9548#2 ${I2C_ADDR_MUX_9548_2} already init." + fi + #add MUX PCA9548#3 on PCA9548#1 + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_3_CHAN0}" ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_3}' > ${PATH_MUX_9548_1_CHAN5}/new_device" + _set_i2cmap ${NUM_MUX_9548_3_CHAN0} "PCA9548_3" + else + echo "pca9548#3 ${I2C_ADDR_MUX_9548_3} already init." + fi + #add MUX PCA9548#4 on PCA9548#1 + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_4_CHAN0}" ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_4}' > ${PATH_MUX_9548_1_CHAN6}/new_device" + _set_i2cmap ${NUM_MUX_9548_4_CHAN0} "PCA9548_4" + else + echo "pca9548#4 ${I2C_ADDR_MUX_9548_4} already init." + fi + #add MUX PCA9548#5 on PCA9548#1 + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_5_CHAN0}" ]; then + _retry "echo 'pca9548 ${I2C_ADDR_MUX_9548_5}' > ${PATH_MUX_9548_1_CHAN7}/new_device" + _set_i2cmap ${NUM_MUX_9548_5_CHAN0} "PCA9548_5" + else + echo "pca9548#5 ${I2C_ADDR_MUX_9548_5} already init." + fi + #Init CPLD LED_CLR Register (Front Port LED) + i2cset -y ${NUM_I801_DEVICE} ${I2C_ADDR_CPLD} 0x34 0x10 + + rmmod coretemp + rmmod jc42 + rmmod w83795 + _i2c_temp_init + _i2c_volmon_init + modprobe coretemp + modprobe w83795 + modprobe jc42 + modprobe eeprom + modprobe eeprom_mb + modprobe gpio-pca953x + _i2c_fan_init + _i2c_io_exp_init + _i2c_gpio_init + _i2c_psu_init + _i2c_qsfp_eeprom_init "new" + _i2c_mb_eeprom_init "new" + _i2c_led_psu_status_set + _i2c_led_fan_status_set + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_sys_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_sys_led + _config_rmem +} + +#I2C Deinit +function _i2c_deinit { + _i2c_gpio_deinit + for mod in coretemp jc42 w83795 eeprom_mb gpio-pca953x i2c_mux_pca954x i2c_ismt i2c_i801 ingrasys_s8810_32q_psu; + do + [ "$(lsmod | grep "^$mod ")" != "" ] && rmmod $mod + done + _clear_i2cmap +} + +#Temperature sensor Init +function _i2c_temp_init { + echo -n "TEMP INIT..." + #select bank0 + i2cset -y -r ${NUM_I801_DEVICE} ${I2C_ADDR_HWM} ${REG_BANK_SEL} 0x80 + #enable TR1, TR2, TR3 temperature monitoring + i2cset -y -r ${NUM_I801_DEVICE} ${I2C_ADDR_HWM} ${REG_TEMP_CTRL2} 0x7F + + # CLKIN clock frequency set as 48Mhz + i2cset -y -r ${NUM_I801_DEVICE} ${I2C_ADDR_HWM} 0x01 0x1C +} + +#FAN Init +function _i2c_fan_init { + + local init_fan_speed=120 + echo -n "FAN INIT..." + if [ -e "${PATH_HWMON_W83795_DEVICE}" ]; then + #Init Fan Speed + echo $init_fan_speed > ${PATH_HWMON_W83795_DEVICE}/device/pwm1 + echo $init_fan_speed > ${PATH_HWMON_W83795_DEVICE}/device/pwm2 + echo "SUCCESS" + else + echo "FAIL, W83795 not found in path ${PATH_HWMON_W83795_DEVICE}" + fi +} + +#VOLMON Init +function _i2c_volmon_init { + #3.3V 3VDD + #VSEN1 ROV + #VSEN4 1V + #VSEN5 1.8V + #VSEN7 5V + echo -n "VOLMON INIT..." + #select bank0 + i2cset -y -r ${NUM_I801_DEVICE} ${I2C_ADDR_HWM} ${REG_BANK_SEL} 0x80 + #enable voltage monitoring VSEN1-8 + i2cset -y -r ${NUM_I801_DEVICE} ${I2C_ADDR_HWM} ${REG_VOLT_CTRL1} 0xFF + #enable voltage monitoring 3VDD and 3VBAT + i2cset -y -r ${NUM_I801_DEVICE} ${I2C_ADDR_HWM} ${REG_VOLT_CTRL2} 0x50 + #disable voltage monitoring VSEN12 and VSEN13 + i2cset -y -r ${NUM_I801_DEVICE} ${I2C_ADDR_HWM} ${REG_TEMP_CTRL1} 0x00 + echo "Done" +} + +#IO Expander Init +function _i2c_io_exp_init { + echo "=========================================================" + echo "# Description: I2C IO Expander Init" + echo "=========================================================" + + #SMBUS1 + + echo "Init FAN Status IO Expander" + #PCA9535_FAN FAN_STATUS + #command byte 2/3, output logic level is 0 + #command byte 4/5, polarity is not inverted + #command byte 6/7, direction is input + i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9535_FAN} ${REG_OUT_0} 0x11 + i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9535_FAN} ${REG_OUT_1} 0x11 + i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9535_FAN} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9535_FAN} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9535_FAN} ${REG_CFG_0} 0xCC + i2cset -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9535_FAN} ${REG_CFG_1} 0xCC + + echo "Init LED Status IO Expander" + #PCA9535_LED LED_BOARD + #command byte 2/3, output logic level is 0 + #command byte 4/5, polarity is not inverted + #command byte 6/7, direction is output + i2cset -y -r ${I2C_BUS_LED_BOARD} ${I2C_ADDR_MUX_9535_LED} ${REG_OUT_0} 0xFF #active low + i2cset -y -r ${I2C_BUS_LED_BOARD} ${I2C_ADDR_MUX_9535_LED} ${REG_OUT_1} 0xFF #active low + i2cset -y -r ${I2C_BUS_LED_BOARD} ${I2C_ADDR_MUX_9535_LED} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${I2C_BUS_LED_BOARD} ${I2C_ADDR_MUX_9535_LED} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${I2C_BUS_LED_BOARD} ${I2C_ADDR_MUX_9535_LED} ${REG_CFG_0} 0x00 + i2cset -y -r ${I2C_BUS_LED_BOARD} ${I2C_ADDR_MUX_9535_LED} ${REG_CFG_1} 0x00 + + #PCA9535#0-10 zQSFP + + echo "Init ZQSFP IO Expander" + + echo "set ZQSFP ABS" + #zQSFP 0-31 ABS + #command byte 4/5, polarity is not inverted + #command byte 6/7, direction is input + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_0} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_0} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_0} ${REG_CFG_0} 0xFF + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_0} ${REG_CFG_1} 0xFF + + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_1} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_1} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_1} ${REG_CFG_0} 0xFF + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_1} ${REG_CFG_1} 0xFF + + echo "set ZQSFP INT" + #zQSFP 0-31 INT + #command byte 4/5, polarity is not inverted + #command byte 6/7, direction is input + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_2} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_2} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_2} ${REG_CFG_0} 0xFF + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_2} ${REG_CFG_1} 0xFF + + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_3} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_3} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_3} ${REG_CFG_0} 0xFF + i2cset -y -r ${NUM_MUX_9548_1_CHAN1} ${I2C_ADDR_MUX_9535_3} ${REG_CFG_1} 0xFF + + echo "set ZQSFP LP_MODE" + #zQSFP 0-31 LP_MODE + #command byte 2/3, output logic level is 0 + #command byte 4/5, polarity is not inverted + #command byte 6/7, direction is output + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_4} ${REG_OUT_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_4} ${REG_OUT_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_4} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_4} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_4} ${REG_CFG_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_4} ${REG_CFG_1} 0x00 + + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_5} ${REG_OUT_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_5} ${REG_OUT_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_5} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_5} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_5} ${REG_CFG_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_5} ${REG_CFG_1} 0x00 + + echo "set ZQSFP RST" + #zQSFP 0-31 RST + #command byte 2/3, output logic level is 0 + #command byte 4/5, polarity is not inverted + #command byte 6/7, direction is output + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_6} ${REG_OUT_0} 0xFF + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_6} ${REG_OUT_1} 0xFF + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_6} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_6} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_6} ${REG_CFG_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_6} ${REG_CFG_1} 0x00 + + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_7} ${REG_OUT_0} 0xFF + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_7} ${REG_OUT_1} 0xFF + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_7} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_7} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_7} ${REG_CFG_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN2} ${I2C_ADDR_MUX_9535_7} ${REG_CFG_1} 0x00 + + echo "set ZQSFP Mode Select" + #zQSFP 0-31 Mode Select + #command byte 2/3, output logic level is 0 + #command byte 4/5, polarity is not inverted + #command byte 6/7, direction is output + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_8} ${REG_OUT_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_8} ${REG_OUT_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_8} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_8} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_8} ${REG_CFG_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_8} ${REG_CFG_1} 0x00 + + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_9} ${REG_OUT_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_9} ${REG_OUT_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_9} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_9} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_9} ${REG_CFG_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_9} ${REG_CFG_1} 0x00 + + #ZQSFP ABS0_15, ABS16_31, INT0_15, INT16_31, PSU1_PWROFF, PSU2_PWROFF + #command byte 2/3, output logic level is 0 + #command byte 4/5, polarity is not inverted + #command byte 6/7, I/O 1.0 and I/O 1.1 are output, others are input + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_10} ${REG_OUT_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_10} ${REG_OUT_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_10} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_10} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_10} ${REG_CFG_0} 0xFF + i2cset -y -r ${NUM_MUX_9548_1_CHAN3} ${I2C_ADDR_MUX_9535_10} ${REG_CFG_1} 0xFC +} + +#GPIO Init Utility Function +function _gpio_export { + local gpio_n=$1 + local direction=$2 + local active_low=$3 + local value=$4 + + if [ -z "${gpio_n}" ]; then + echo "[_gpio_init] gpio_n(${gpio_n}) is not provided" + return + fi + if [ "${gpio_n}" -lt "0" ] || [ "${gpio_n}" -gt "255" ]; then + echo "[_gpio_init] gpio_n(${gpio_n}) is invalid value" + return + fi + + #export gpio + echo ${gpio_n} > ${PATH_SYS_GPIO}/export + + #set gpio direction + echo ${direction} > ${PATH_SYS_GPIO}/gpio${gpio_n}/direction + + #set gpio active_low + echo ${active_low} > ${PATH_SYS_GPIO}/gpio${gpio_n}/active_low + + #set value + if [ ! -z "${value}" ]; then + echo ${value} > ${PATH_SYS_GPIO}/gpio${gpio_n}/value + fi +} + +#set gpiomap +function _set_gpiomap { + local gpio_n=$1 + local alias=$2 + + #create gpiomap dir if not exist + mkdir -p $PATH_GPIOMAP + + #check gpio_n exists in sysfs + if [ ! -L ${PATH_SYS_GPIO}/gpio${gpio_n} ]; then + echo "${PATH_SYS_GPIO}/gpio${gpio_n} does not exist." + return + fi + + #create or update link + ln -sf ${PATH_SYS_GPIO}/gpio${gpio_n} ${PATH_GPIOMAP}/${alias} +} + +#clear gpiomap +function _clear_gpiomap { + #delete gpiomap dir + rm -rf ${PATH_GPIOMAP} +} + +#GPIO Init +function _i2c_gpio_init { + local i=0 + + #ABS Port 0-31 + echo "pca9535 ${I2C_ADDR_MUX_9535_1}" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN1}/new_device + echo "pca9535 ${I2C_ADDR_MUX_9535_0}" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN1}/new_device + for i in {224..255} + do + _gpio_export ${i} ${DIR_IN} ${ACTIVE_LOW} + _set_gpiomap ${i} "QSFP$(( i - 223 ))_ABS" + done + + #INT Port 0-31 + echo "pca9535 ${I2C_ADDR_MUX_9535_3}" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN1}/new_device + echo "pca9535 ${I2C_ADDR_MUX_9535_2}" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN1}/new_device + for i in {192..223} + do + _gpio_export ${i} ${DIR_IN} ${ACTIVE_LOW} + _set_gpiomap ${i} "QSFP$(( i - 191 ))_INT" + done + + #LP Mode Port 0-31 + echo "pca9535 ${I2C_ADDR_MUX_9535_5}" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN2}/new_device + echo "pca9535 ${I2C_ADDR_MUX_9535_4}" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN2}/new_device + for i in {160..191} + do + _gpio_export ${i} ${DIR_OUT} ${ACTIVE_HIGH} + _set_gpiomap ${i} "QSFP$(( i - 159 ))_LPMODE" + done + + #RST Port 0-31 + echo "pca9535 ${I2C_ADDR_MUX_9535_7}" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN2}/new_device + echo "pca9535 ${I2C_ADDR_MUX_9535_6}" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN2}/new_device + for i in {128..159} + do + _gpio_export ${i} ${DIR_OUT} ${ACTIVE_LOW} + _set_gpiomap ${i} "QSFP$(( i - 127 ))_RST" + #Reset QSFP + echo "${ACTIVE_LOW}" > ${PATH_SYS_GPIO}/gpio${i}/value + echo "${ACTIVE_HIGH}" > ${PATH_SYS_GPIO}/gpio${i}/value + done + + #MODSEL Port 0-31 + echo "pca9535 ${I2C_ADDR_MUX_9535_9}" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN3}/new_device + echo "pca9535 ${I2C_ADDR_MUX_9535_8}" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN3}/new_device + for i in {96..127} + do + _gpio_export ${i} ${DIR_OUT} ${ACTIVE_LOW} + _set_gpiomap ${i} "QSFP$(( i - 95 ))_MODSEL" + done +} + +#GPIO DeInit +function _i2c_gpio_deinit { + echo ${I2C_ADDR_MUX_9535_0} > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN1}/delete_device + echo ${I2C_ADDR_MUX_9535_1} > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN1}/delete_device + echo ${I2C_ADDR_MUX_9535_2} > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN1}/delete_device + echo ${I2C_ADDR_MUX_9535_3} > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN1}/delete_device + echo ${I2C_ADDR_MUX_9535_4} > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN2}/delete_device + echo ${I2C_ADDR_MUX_9535_5} > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_1_CHAN2}/delete_device + _clear_gpiomap +} + +#Set FAN Tray LED +function _i2c_led_fan_tray_status_set { + echo "FAN Tray Status Setup" + + #check W83795 exists in hwmon2 + if [ ! -e "${PATH_HWMON_W83795_DEVICE}" ]; then + echo "FAIL, W83795 not found in path ${PATH_HWMON_W83795_DEVICE}" + return + fi + #FAN Status get + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan2_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan4_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN6_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan6_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + FAN8_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan8_alarm` + + FAN_TRAY=1 + if [ "${FAN1_ALARM}" == "0" ] && [ "${FAN2_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + FAN_TRAY=2 + if [ "${FAN3_ALARM}" == "0" ] && [ "${FAN4_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + FAN_TRAY=3 + if [ "${FAN5_ALARM}" == "0" ] && [ "${FAN6_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + FAN_TRAY=4 + if [ "${FAN7_ALARM}" == "0" ] && [ "${FAN8_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi +} + +#Test FAN Tray LED +function _i2c_led_fan_tray_test { + echo "FAN Tray LED Test" + + for i in {1..4} + do + FAN_TRAY=$i + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + _pause 'Check Fan Tray ${FAN_TRAY} LED green light and Press [Enter] key to continue...' + + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + _pause 'Check Fan Tray ${FAN_TRAY} LED amber light and Press [Enter] key to continue...' + done +} +#Set FAN LED +function _i2c_led_fan_status_set { + echo "FAN Status Setup" + + #check W83795 exists in hwmon2 + if [ ! -e "${PATH_HWMON_W83795_DEVICE}" ]; then + echo "FAIL, W83795 not found in path ${PATH_HWMON_W83795_DEVICE}" + return + fi + + #PSU Status set + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan2_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan4_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN6_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan6_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + FAN8_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan8_alarm` + + if [ "${FAN1_ALARM}" == "0" ] && [ "${FAN2_ALARM}" == "0" ] \ + && [ "${FAN3_ALARM}" == "0" ] && [ "${FAN4_ALARM}" == "0" ] \ + && [ "${FAN5_ALARM}" == "0" ] && [ "${FAN6_ALARM}" == "0" ] \ + && [ "${FAN7_ALARM}" == "0" ] && [ "${FAN8_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + fi +} + +#Set Power Supply LED +function _i2c_led_psu_status_set { + echo "PSU LED Status Setup" + + #PSU Status set + _i2c_psu_status + + #PSU1 Status + if [ "${psu1Exist}" == ${PSU_EXIST} ]; then + if [ "${psu1PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + fi + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + fi + + #PSU2 Status + if [ "${psu2Exist}" == ${PSU_EXIST} ]; then + if [ "${psu2PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + fi + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + fi +} + +#LED Test +function _i2c_led_test { + echo "=========================================================" + echo "# Description: I2C LED TEST..." + echo "=========================================================" + #sys led (green) + _i2c_reset_led + COLOR_LED="green" + ONOFF_LED="on" + _i2c_sys_led + _pause 'Check SYS LED green light and Press [Enter] key to continue...' + #sys led (amber) + _i2c_reset_led + COLOR_LED="amber" + ONOFF_LED="on" + _i2c_sys_led + _pause 'Check SYS LED amber light and Press [Enter] key to continue...' + + #FAN led (green) + _i2c_reset_led + COLOR_LED="green" + ONOFF_LED="on" + _i2c_fan_led + _pause 'Check FAN LED green light and Press [Enter] key to continue...' + #FAN led (amber) + _i2c_reset_led + COLOR_LED="amber" + ONOFF_LED="on" + _i2c_fan_led + _pause 'Check FAN LED amber light and Press [Enter] key to continue...' + + #PSU2 led (green) + _i2c_reset_led + COLOR_LED="green" + ONOFF_LED="on" + _i2c_psu2_led + _pause 'Check PSU2 LED green light and Press [Enter] key to continue...' + #PSU2 led (amber) + _i2c_reset_led + COLOR_LED="amber" + ONOFF_LED="on" + _i2c_psu2_led + _pause 'Check PSU2 LED amber light and Press [Enter] key to continue...' + + #PSU1 led (green) + _i2c_reset_led + COLOR_LED="green" + ONOFF_LED="on" + _i2c_psu1_led + _pause 'Check PSU1 LED green light and Press [Enter] key to continue...' + #PSU1 led (amber) + _i2c_reset_led + COLOR_LED="amber" + ONOFF_LED="on" + _i2c_psu1_led + _pause 'Check PSU1 LED amber light and Press [Enter] key to continue...' + + #Turn OFF All LED + _i2c_reset_led + _pause 'Check turn off all LEDs and Press [Enter] key to continue...' + echo "done..." + + #sys led (green) + COLOR_LED="green" + ONOFF_LED="on" + _i2c_sys_led +} + +#Set QSFP Port variable +function _qsfp_port_i2c_var_set { + local port=$1 + case ${port} in + 1|2|3|4|5|6|7|8) + i2cbus=${NUM_MUX_9548_1_CHAN1} + regAddr=0x20 + dataAddr=0 + eeprombusbase=${NUM_MUX_9548_2_CHAN0} + gpioBase=224 + ;; + 9|10|11|12|13|14|15|16) + i2cbus=${NUM_MUX_9548_1_CHAN1} + regAddr=0x20 + dataAddr=1 + eeprombusbase=${NUM_MUX_9548_3_CHAN0} + gpioBase=224 + ;; + 17|18|19|20|21|22|23|24) + i2cbus=${NUM_MUX_9548_1_CHAN1} + regAddr=0x21 + dataAddr=0 + eeprombusbase=${NUM_MUX_9548_4_CHAN0} + gpioBase=240 + ;; + 25|26|27|28|29|30|31|32) + i2cbus=${NUM_MUX_9548_1_CHAN1} + regAddr=0x21 + dataAddr=1 + eeprombusbase=${NUM_MUX_9548_5_CHAN0} + gpioBase=240 + ;; + *) + echo "Please input 1~32" + ;; + esac +} + +#Set QSFP Port variable +function _qsfp_eeprom_var_set { + local port=$1 + eeprombusidx=$(( ${port} % 8)) + case $eeprombusidx in + 1) + eeprombus=$(( $eeprombusbase + 0 )) + ;; + 2) + eeprombus=$(( $eeprombusbase + 1 )) + ;; + 3) + eeprombus=$(( $eeprombusbase + 2 )) + ;; + 4) + eeprombus=$(( $eeprombusbase + 3 )) + ;; + 5) + eeprombus=$(( $eeprombusbase + 4 )) + ;; + 6) + eeprombus=$(( $eeprombusbase + 5 )) + ;; + 7) + eeprombus=$(( $eeprombusbase + 6 )) + ;; + 0) + eeprombus=$(( $eeprombusbase + 7 )) + ;; + esac + eepromAddr=${I2C_ADDR_QSFP_EEPROM} +} + +#Get QSFP EEPROM Information +function _i2c_qsfp_eeprom_get { + + _qsfp_port_i2c_var_set ${QSFP_PORT} + + #status: 0 -> Down, 1 -> Up + status=`cat ${PATH_SYS_GPIO}/gpio$(( gpioBase + (QSFP_PORT-1)%16 ))/value` + echo $status + + if [ $status = 0 ]; then + exit + fi + + _qsfp_eeprom_var_set ${QSFP_PORT} + + cat ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom | hexdump -C +} + +#Init QSFP EEPROM +function _i2c_qsfp_eeprom_init { + echo -n "QSFP EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init 1-32 ports EEPROM + local i + for i in {1..32}; + do + _qsfp_port_i2c_var_set ${i} + + _qsfp_eeprom_var_set ${i} + + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr) ]; then + echo "sff8436 $eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr) ]; then + echo "$eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/delete_device + fi + done + echo "DONE" +} + +#Init Main Board EEPROM +function _i2c_mb_eeprom_init { + echo -n "Main Board EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init MB EEPROM + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/${I2C_BUS_MB_EEPROM}-$(printf "%04x" $I2C_ADDR_MB_EEPROM) ]; then + echo "mb_eeprom ${I2C_ADDR_MB_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_MB_EEPROM}/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/${I2C_BUS_MB_EEPROM}-$(printf "%04x" $I2C_ADDR_MB_EEPROM) ]; then + echo "${I2C_ADDR_MB_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_MB_EEPROM}/delete_device + fi + echo "DONE" +} + +#get QSFP Status +function _i2c_qsfp_status_get { + + _qsfp_port_i2c_var_set ${QSFP_PORT} + + #status: 0 -> Down, 1 -> Up + + status=`cat ${PATH_SYS_GPIO}/gpio$(( gpioBase + (QSFP_PORT-1)%16 ))/value` + echo "status=$status" +} + +#get QSFP Type +function _i2c_qsfp_type_get { + + _qsfp_port_i2c_var_set ${QSFP_PORT} + + _qsfp_eeprom_var_set ${QSFP_PORT} + + #Get QSFP EEPROM info + qsfp_info=$(base64 ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom) + + identifier=$(echo $qsfp_info | base64 -d -i | hexdump -s 128 -n 1 -e '"%x"') + connector=$(echo $qsfp_info | base64 -d -i | hexdump -s 130 -n 1 -e '"%x"') + transceiver=$(echo $qsfp_info | base64 -d -i | hexdump -s 131 -n 1 -e '"%x"') + + echo "identifier=$identifier" + echo "connector=$connector" + echo "transceiver=$transceiver" +} + +#Init PSU Kernel Module +function _i2c_psu_init { + echo "=========================================================" + echo "# Description: I2C PSU Init" + echo "=========================================================" + modprobe ingrasys_s8810_32q_psu + + echo "psu1 ${I2C_ADDR_PSU_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_PSU1_EEPROM}/new_device + echo "psu2 ${I2C_ADDR_PSU_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_PSU2_EEPROM}/new_device +} + +#Get PSU EEPROM Information +function _i2c_psu_eeprom_get { + local eeprom_psu1="" + local eeprom_psu2="" + + echo "=========================================================" + echo "# Description: I2C PSU EEPROM Get..." + echo "=========================================================" + + eeprom_psu1="${PATH_SYSFS_PSU1}/psu_eeprom" + cat ${eeprom_psu1} | hexdump -C + + eeprom_psu2="${PATH_SYSFS_PSU2}/psu_eeprom" + cat ${eeprom_psu2} | hexdump -C +} + +#Get MotherBoard EEPROM Information +function _i2c_mb_eeprom_get { + echo "=========================================================" + echo "# Description: I2C MB EEPROM Get..." + echo "=========================================================" + + ## MB EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${I2C_BUS_MB_EEPROM}-$(printf "%04x" $I2C_ADDR_MB_EEPROM)/eeprom | hexdump -C + echo "done..." +} + +#Set FAN Tray LED +function _i2c_fan_tray_led { + local value=0 + case ${FAN_TRAY} in + 1) + ioPort=$REG_OUT_0 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 2) + ioPort=$REG_OUT_0 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + 3) + ioPort=$REG_OUT_1 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 4) + ioPort=$REG_OUT_1 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + *) + echo "Please input 1~4" + exit + ;; + esac + + if [ "${ONOFF_LED}" == "on" ]; then + value=0xFF + elif [ "${ONOFF_LED}" == "off" ]; then + value=0x00 + else + echo "Invalid Parameters ${ONOFF_LED}, Exit!!!" + _help + exit ${FALSE} + fi + i2cset -m $mask -y -r ${I2C_BUS_FAN_STATUS} ${I2C_ADDR_MUX_9535_FAN} $ioPort $value + + #echo "done..." +} + +#Set System Status LED +function _i2c_sys_led { + local green_mask=${BIT_MASK[7]} + local amber_mask=${BIT_MASK[6]} + + _i2c_set_led $green_mask $amber_mask +} + +#Set FAN LED +function _i2c_fan_led { + local green_mask=${BIT_MASK[3]} + local amber_mask=${BIT_MASK[2]} + + _i2c_set_led $green_mask $amber_mask +} + +#Set PSU1 LED +function _i2c_psu1_led { + local green_mask=${BIT_MASK[1]} + local amber_mask=${BIT_MASK[0]} + + _i2c_set_led $green_mask $amber_mask +} + +#Set PSU2 LED +function _i2c_psu2_led { + local green_mask=${BIT_MASK[5]} + local amber_mask=${BIT_MASK[4]} + + _i2c_set_led $green_mask $amber_mask +} + +#Set LEDs in LED Board +function _i2c_set_led { + local green_mask=$1 + local amber_mask=$2 + local mask=0 + local value=0 + + + if [ "${COLOR_LED}" == "green" ]; then + mask=$green_mask + elif [ "${COLOR_LED}" == "amber" ]; then + mask=$amber_mask + else + echo "Invalid Parameters ${COLOR_LED}, Exit!!!" + _help + exit ${FALSE} + fi + + # Singals are active_low + if [ "${ONOFF_LED}" == "on" ]; then + value=0x00 + elif [ "${ONOFF_LED}" == "off" ]; then + value=0xFF + else + echo "Invalid Parameters ${ONOFF_LED}, Exit!!!" + _help + exit ${FALSE} + fi + + i2cset -m $mask -y -r ${I2C_BUS_LED_BOARD} ${I2C_ADDR_MUX_9535_LED} ${REG_OUT_0} $value +} + +#Reset all system leds +function _i2c_reset_led { + i2cset -y ${I2C_BUS_LED_BOARD} ${I2C_ADDR_MUX_9535_LED} ${REG_OUT_0} 0xFF +} + +#Get Board Version and Type +function _i2c_board_type_get { + local reg_board=0x00 + local reg_ext_board=0x07 + local boardType=0 + local boardBuildRev=0 + local boardHwRev=0 + local boardId=0 + local extBoardType=0 + + boardType=`i2cget -y ${NUM_I801_DEVICE} ${I2C_ADDR_CPLD} ${reg_board}` + #Bit 0-1 + boardBuildRev=$((($boardType) & 0x03)) + #Bit 2-3 + boardHwRev=$((($boardType) >> 2 & 0x03)) + #Bit 4-7 + boardId=$((($boardType) >> 4)) + + extBoardType=`i2cget -y ${NUM_I801_DEVICE} ${I2C_ADDR_CPLD} ${reg_ext_board}` + #Bit 0-3 + extBoardType=$((($extBoardType) & 0x0F)) + + printf "BOARD_ID=0x%02x, HW Rev=%d, Build Rev=%d, Ext_BOARD_ID=0x%02x\n" $boardId $boardHwRev $boardBuildRev $extBoardType + +} + +#Get CPLD Version +function _i2c_cpld_version { + local reg_cpld_rev=0x01 + cpldRev=`i2cget -y ${NUM_I801_DEVICE} ${I2C_ADDR_CPLD} ${reg_cpld_rev}` + cpldRelease=$((($cpldRev) >> 6 & 0x01)) + cpldVersion=$((($cpldRev) & 0x3F)) + printf "CPLD is %s version(0:RD 1:Release), Revision is 0x%02x\n" $cpldRelease $cpldVersion + +} + +#Get PSU Status +function _i2c_psu_status { + local psu_abs="" + + psu1PwGood=`cat ${PATH_SYSFS_PSU1}/psu_pg` + psu_abs=`cat ${PATH_SYSFS_PSU1}/psu_abs` + if [ "$psu_abs" == "0" ]; then + psu1Exist=1 + else + psu1Exist=0 + fi + + psu2PwGood=`cat ${PATH_SYSFS_PSU2}/psu_pg` + psu_abs=`cat ${PATH_SYSFS_PSU2}/psu_abs` + if [ "$psu_abs" == "0" ]; then + psu2Exist=1 + else + psu2Exist=0 + fi + + printf "PSU1 Exist:%x PSU1 PW Good:%d\n" $psu1Exist $psu1PwGood + printf "PSU2 Exist:%d PSU2 PW Good:%d\n" $psu2Exist $psu2PwGood +} + +#Increase read socket buffer for CoPP Test +function _config_rmem { + echo "109430400" > /proc/sys/net/core/rmem_max +} + +#Main Function +function _main { + start_time_str=`date` + start_time_sec=$(date +%s) + + if [ "${EXEC_FUNC}" == "help" ]; then + _help + elif [ "${EXEC_FUNC}" == "i2c_init" ]; then + _i2c_init + elif [ "${EXEC_FUNC}" == "i2c_deinit" ]; then + _i2c_deinit + elif [ "${EXEC_FUNC}" == "i2c_temp_init" ]; then + _i2c_temp_init + elif [ "${EXEC_FUNC}" == "i2c_fan_init" ]; then + _i2c_fan_init + elif [ "${EXEC_FUNC}" == "i2c_volmon_init" ]; then + _i2c_volmon_init + elif [ "${EXEC_FUNC}" == "i2c_io_exp_init" ]; then + _i2c_io_exp_init + elif [ "${EXEC_FUNC}" == "i2c_gpio_init" ]; then + _i2c_gpio_init + elif [ "${EXEC_FUNC}" == "i2c_gpio_deinit" ]; then + _i2c_gpio_deinit + elif [ "${EXEC_FUNC}" == "i2c_led_test" ]; then + _i2c_led_test + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_get" ]; then + _i2c_mb_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_psu_eeprom_get" ]; then + _i2c_psu_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_get" ]; then + _i2c_qsfp_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_init" ]; then + _i2c_qsfp_eeprom_init ${QSFP_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_init" ]; then + _i2c_mb_eeprom_init ${MB_EEPROM_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_qsfp_status_get" ]; then + _i2c_qsfp_status_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_type_get" ]; then + _i2c_qsfp_type_get + elif [ "${EXEC_FUNC}" == "i2c_led_psu_status_set" ]; then + _i2c_led_psu_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_status_set" ]; then + _i2c_led_fan_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_tray_status_set" ]; then + _i2c_led_fan_tray_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_tray_test" ]; then + _i2c_led_fan_tray_test + elif [ "${EXEC_FUNC}" == "i2c_sys_led" ]; then + _i2c_sys_led + elif [ "${EXEC_FUNC}" == "i2c_fan_led" ]; then + _i2c_fan_led + elif [ "${EXEC_FUNC}" == "i2c_fan_tray_led" ]; then + _i2c_fan_tray_led + elif [ "${EXEC_FUNC}" == "i2c_psu1_led" ]; then + _i2c_psu1_led + elif [ "${EXEC_FUNC}" == "i2c_psu2_led" ]; then + _i2c_psu2_led + elif [ "${EXEC_FUNC}" == "i2c_board_type_get" ]; then + _i2c_board_type_get + elif [ "${EXEC_FUNC}" == "i2c_cpld_version" ]; then + _i2c_cpld_version + elif [ "${EXEC_FUNC}" == "i2c_psu_status" ]; then + _i2c_psu_status + elif [ "${EXEC_FUNC}" == "i2c_test_all" ]; then + _i2c_deinit + _i2c_init + _i2c_led_test + _i2c_psu_eeprom_get + _i2c_mb_eeprom_get + _i2c_board_type_get + _i2c_cpld_version + _i2c_psu_status + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + end_time_str=`date` + end_time_sec=$(date +%s) + diff_time=$[ ${end_time_sec} - ${start_time_sec} ] + echo "Start Time: ${start_time_str} (${start_time_sec})" + echo "End Time : ${end_time_str} (${end_time_sec})" + echo "Total Execution Time: ${diff_time} sec" + + echo "done!!!" +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/qsfp_monitor.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/qsfp_monitor.sh new file mode 100755 index 000000000000..249f179216a6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/qsfp_monitor.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=3 +I2C_UTILS="/usr/sbin/i2c_utils.sh" +QSFP_SI_SCRIPT="/usr/sbin/qsfp_si_cfg.sh" +QSFP_ARRAY=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + +#QSFP SI monitor +function _qsfp_si_monitor { + local i + local status + for i in {0..31}; + do + status=`${I2C_UTILS} i2c_qsfp_status_get $(expr $i + 1) | egrep '^status=.*$' | sed -e 's/status=//g'` + if [ "${status}" == "1" ]; then + _qsfp_type_check $i + fi + done +} + +#QSFP type +function _qsfp_type_check { + local port=$1 + local qsfp_type=`${I2C_UTILS} i2c_qsfp_type_get $(expr $port + 1)` + local identifier=`echo "$qsfp_type" | grep '^identifier=.*$' | sed -e 's/identifier=//g'` + if [ "${identifier}" == "11" ]; then + connector=`echo "$qsfp_type" | grep '^connector=.*$' | sed -e 's/connector=//g'` + case ${connector} in + 21|23) + #DAC + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to DAC" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} dac $port >/dev/null + fi + ;; + *) + #Optical + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to Optical" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} optical $port >/dev/null + fi + ;; + esac + fi +} + +#Docker exist check +function _docker_swss_check { + while true + do + # Check if syncd starts + result=`docker exec -i swss bash -c "echo -en \"SELECT 1\\nHLEN HIDDEN\" | redis-cli | sed -n 2p"` #TBD FIX ME + if [ "$result" == "3" ]; then + return + fi + sleep $INTERVAL + done +} + +#Docker exist check +function _qsfp_si_cfg_script_check { + + if [ -f ${QSFP_SI_SCRIPT} ] && [ -x ${QSFP_SI_SCRIPT} ]; then + echo "SI Script exists. Start monitor." + return + else + echo "SI Script not exist. Exit monitor." + exit + fi +} + +# main function +function _main { + #Check SI Script + _qsfp_si_cfg_script_check + #Check docker swss is running + _docker_swss_check + while true + do + _qsfp_si_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/s8810_32q_monitor.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/s8810_32q_monitor.sh new file mode 100755 index 000000000000..974da6d5001f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8810-32q/utils/s8810_32q_monitor.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=5 +I2C_UTILS="/usr/sbin/i2c_utils.sh" + + +# LED status monitor +function _led_monitor { + ${I2C_UTILS} i2c_led_fan_status_set >/dev/null + ${I2C_UTILS} i2c_led_psu_status_set >/dev/null + ${I2C_UTILS} i2c_led_fan_tray_status_set >/dev/null +} + +# main function +function _main { + while true + do + _led_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/README.md b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/README.md new file mode 100644 index 000000000000..2042625f631c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/README.md @@ -0,0 +1,185 @@ +# Ingrasys S8900-54XC Platform Driver for SONiC + +Copyright (C) 2016 Ingrasys, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +## Licensing terms + +The Licensing terms of the files within this project is split 2 parts. +The Linux kernel is released under the GNU General Public License version 2. +All other code is released under the GNU General Public License version 3. +Please see the LICENSE file for copies of both licenses. + +## Contents of this package + + - service/ + > Service config files for platform initialization and monitoring + - utils/ + > Scripts useful during platform bringup and sysfs function + - conf/ + > Platform configure files. + +## Kernel modules and drivers + +The driver for interacting with Ingrasys S8900-54XC is contained in the I2C +kernel module and initialization script. The initialization script loads +the modules in the correct order. It has been built and tested against +the Linux 3.16 kernel. + +The initialization script will modprobe the needed modules, navigate to the +module's device directory in sysfs, and write configuration data to +the kernel module. + +### IGB + +This is OOB Ports on front panel for management plane. + +The IGB module must be loaded first on Ingrasys S8900-54XC platform. + +### I2C i801 + +The I2C i801 on Ingrasys S8900-54XC can be found in +`/sys/bus/i2c/devices/i2c-0/` + +This is I2C bus for Clock Gen, DIMM channel and digital potentiometers. + +The i801 module must be loaded second on Ingrasys S8900-54XC. + +### I2C iSMT + +The I2C iSMT module on S8900-54XC can be found in +`/sys/bus/i2c/devices/i2c-1/` + +This is I2C bus for CPLD, HWM, power controller and I2C Switches. + +The i801 module must be loaded third on Ingrasys S8900-54XC. + +### I2C PCA9548 +The PCA9548 module on S8900-54XC can be found in +`/sys/bus/i2c/devices/i2c-2/` , `/sys/bus/i2c/devices/i2c-3/`, +`/sys/bus/i2c/devices/i2c-4/`, `/sys/bus/i2c/devices/i2c-5/`, +`/sys/bus/i2c/devices/i2c-6/`, `/sys/bus/i2c/devices/i2c-7/`, +`/sys/bus/i2c/devices/i2c-8/`, `/sys/bus/i2c/devices/i2c-9/`. + +The pca9548 module for zQSFP module get/set functions, PSU information, +fan status and EEPROM. + +## Hardware components + +The hardware components are initialized in the init script on S8900-54XC. +The following describes manual initialization as well as interaction. +The examples below are just for Ingrasys S8900-54XC platform. + +### Hardware initialization + +When the sonic-platform-ingrasys-s8900-54xc package is installed on the S8900-54XC, +it is automatically initialized. If you want to manual initialization, the +utility command usage as follows: +``` + i2c_utils.sh i2c_init +``` + +### EEPROM + +The EEPROM is including the board SKU, model name, vendor name, serial number, +and other information can be accessed with the specific eeprom kernel module. +After using `modprobe eeprom_mb` to detect the eeprom, it will show up in sysfs. + +The hexdump utility can be used to decode the raw output of the EEPROM. +For example, +``` + bash# echo "mb_eeprom 0x54" > /sys/bus/i2c/devices/i2c-9/new_device + bash# cat /sys/bus/i2c/drivers/mb_eeprom/9-0054/eeprom | hexdump -C +``` + +### Front panel LEDs + +LEDs can be setup on/off by using i2c utility `/usr/sbin/i2c_utils.sh`. +Utility function command usage as follows: + +``` +Status LED: + i2c_utils.sh i2c_sys_led green|amber on|off + +Fan status LED: + i2c_utils.sh i2c_fan_led green|amber on|off + +PSU1 status LED: + i2c_utils.sh i2c_psu1_led green|amber on|off + +PSU2 status LED: + i2c_utils.sh i2c_psu2_led green|amber on|off + +``` +QSFP Module Port LEDs control by ASIC library. + + +### Fan speed + +Fan speed are controlled by the w83795 kernel module. +It can be found in `/sys/class/hwmon/hwmon1/device/`. +If they were compiled as modules, you will need to modprobe w83795 for +their sysfs entries to show up. Each fan has an `fan_input` file +for reading the fan speed. And `pwm1` setting fan1 to fan4, +`pwm2` setting fan5 to fan8. + +There is docker-platform-monitor container installed fancontrol package that can +automatic control platform fan speed. + + +### Temperature sensors + +Temperature sensors are controlled by the w83795 kernel +module. It can be found in `/sys/class/hwmon/hwmon1/device/`. +If they were compiled as modules, then you will need to modprobe w83795 for +their sysfs entries to show up. +`temp1_input` is front MAC temperature sensor. `temp2_input` is rear MAC +temperature sensor. + +There is docker-platform-monitor container installed lm-sensors package that can +monitor platform temperature. And `sensors` command can show each +temperature sensors status. + +### Power supplies + +Power supplies status and its EEPROM info can be used i2c utility +`/usr/sbin/i2c_utils.sh` to get. +The usage as follows: +``` +PSU EEPROM: + i2c_utils.sh i2c_psu_eeprom_get + hexdump -C psu0.rom + hexdump -C psu1.rom + +PSU Status: + i2c_utils.sh i2c_psu_status +``` + +### QSFPs +QSFP modules are managed by the pca9548 kernel driver. +The i2c utility `/usr/sbin/i2c_utils.sh` can be used to get status and +module EEPROM informations. +The usage as follows: +``` +QSFP EEPROM: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + +QSFP Insert Event: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + 0 => not insert + 1 => inserted +``` + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/Makefile b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/Makefile new file mode 100644 index 000000000000..a0042543dff5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := eeprom_mb.o +obj-m+= i2c_cpld.o diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/eeprom_mb.c b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/eeprom_mb.c new file mode 100644 index 000000000000..0886cad58eb3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/eeprom_mb.c @@ -0,0 +1,212 @@ +/* + * Copyright (C) 1998, 1999 Frodo Looijaard and + * Philip Edelbrock + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003 IBM Corp. + * Copyright (C) 2004 Jean Delvare + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, + 0x55, 0x56, 0x57, I2C_CLIENT_END }; + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void mb_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, ((u8)addr >> 8) & 0xFF, (u8)addr & 0xFF); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t mb_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + mb_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static struct bin_attribute mb_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = mb_eeprom_read, +}; + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int mb_eeprom_detect(struct i2c_client *client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + + /* EDID EEPROMs are often 24C00 EEPROMs, which answer to all + addresses 0x50-0x57, but we only care about 0x50. So decline + attaching to addresses >= 0x51 on DDC buses */ + if (!(adapter->class & I2C_CLASS_SPD) && client->addr >= 0x51) { + return -ENODEV; + } + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE) + && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + return -ENODEV; + } + + strlcpy(info->type, "eeprom", I2C_NAME_SIZE); + + return 0; +} + +static int mb_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &mb_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int mb_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &mb_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id mb_eeprom_id[] = { + { "mb_eeprom", 0 }, + { } +}; + +static struct i2c_driver mb_eeprom_driver = { + .driver = { + .name = "mb_eeprom", + }, + .probe = mb_eeprom_probe, + .remove = mb_eeprom_remove, + .id_table = mb_eeprom_id, + + .class = I2C_CLASS_DDC | I2C_CLASS_SPD, + .detect = mb_eeprom_detect, + .address_list = normal_i2c, +}; + +module_i2c_driver(mb_eeprom_driver); + +MODULE_AUTHOR("Wade "); +MODULE_DESCRIPTION("Ingrasys S8900 Mother Borad EEPROM driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/i2c_cpld.c b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/i2c_cpld.c new file mode 100644 index 000000000000..626c63177b50 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/i2c_cpld.c @@ -0,0 +1,448 @@ +/* + * S9100-32X I2C CPLD driver + * + * Copyright (C) 2017 Ingrasys, Inc. + * Wade He + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "i2c_cpld.h" + +#ifdef DEBUG + #define DEBUG_PRINT(fmt, args...) \ + printk(KERN_INFO "%s[%d]: " fmt "\r\n", \ + __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define I2C_READ_BYTE_DATA(ret, lock, i2c_client, reg) \ +{ \ + mutex_lock(lock); \ + ret = i2c_smbus_read_byte_data(i2c_client, reg); \ + mutex_unlock(lock); \ +} +#define I2C_WRITE_BYTE_DATA(ret, lock, i2c_client, reg, val) \ +{ \ + mutex_lock(lock); \ + ret = i2c_smbus_write_byte_data(i2c_client, reg, val); \ + mutex_unlock(lock); \ +} + +/* CPLD sysfs attributes index */ +enum i2c_cpld_sysfs_attributes { + CPLD_ACCESS_REG, + CPLD_REGISTER_VAL, + CPLD_PORT_START, + CPLD_PORTS, + CPLD_VERSION, + CPLD_ID, + CPLD_BOARD_TYPE, + CPLD_EXT_BOARD_TYPE, + CPLD_PW_GOOD, + CPLD_PW_ABS, +}; + +/* CPLD sysfs attributes hook functions */ +static ssize_t read_access_register(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_access_register(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_register_value(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_register_value(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_cpld_version(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_board_type(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_ext_board_type(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_pw_good(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_pw_abs(struct device *dev, + struct device_attribute *da, char *buf); + +static LIST_HEAD(cpld_client_list); /* client list for cpld */ +static struct mutex list_lock; /* mutex for client list */ + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +struct cpld_data { + int index; /* CPLD index */ + struct mutex access_lock; /* mutex for cpld access */ + u8 access_reg; /* register to access */ +}; + +/* CPLD device id and data */ +static const struct i2c_device_id i2c_cpld_id[] = { + { "i2c_cpld", i2c_cpld }, + {} +}; + +/* Addresses scanned for i2c_cpld */ +static const unsigned short cpld_i2c_addr[] = { 0x33, I2C_CLIENT_END }; +/* platform sysfs object */ +extern struct kobject *s9230_64x_kobj; + + +/* define all support register access of cpld in attribute */ +static SENSOR_DEVICE_ATTR(cpld_access_register, S_IWUSR | S_IRUGO, + read_access_register, write_access_register, CPLD_ACCESS_REG); +static SENSOR_DEVICE_ATTR(cpld_register_value, S_IWUSR | S_IRUGO, + read_register_value, write_register_value, CPLD_REGISTER_VAL); +static SENSOR_DEVICE_ATTR(cpld_version, S_IRUGO, + read_cpld_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(cpld_board_type, S_IRUGO, + read_board_type, NULL, CPLD_BOARD_TYPE); +static SENSOR_DEVICE_ATTR(cpld_ext_board_type, S_IRUGO, + read_ext_board_type, NULL, CPLD_EXT_BOARD_TYPE); +static SENSOR_DEVICE_ATTR(cpld_pw_good, S_IRUGO, + read_pw_good, NULL, CPLD_PW_GOOD); +static SENSOR_DEVICE_ATTR(cpld_pw_abs, S_IRUGO, + read_pw_abs, NULL, CPLD_PW_ABS); + + +/* define support attributes of cpldx , total 5 */ +/* cpld 1 */ +static struct attribute *i2c_cpld_attributes[] = { + &sensor_dev_attr_cpld_access_register.dev_attr.attr, + &sensor_dev_attr_cpld_register_value.dev_attr.attr, + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_cpld_board_type.dev_attr.attr, + &sensor_dev_attr_cpld_ext_board_type.dev_attr.attr, + &sensor_dev_attr_cpld_pw_good.dev_attr.attr, + &sensor_dev_attr_cpld_pw_abs.dev_attr.attr, + NULL +}; + +/* cpld 1 attributes group */ +static const struct attribute_group i2c_cpld_group = { + .attrs = i2c_cpld_attributes, +}; + +/* read access register from cpld data */ +static ssize_t read_access_register(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg = data->access_reg; + + return sprintf(buf, "0x%x\n", reg); +} + +/* write access register to cpld data */ +static ssize_t write_access_register(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + + if (kstrtou8(buf, 0, ®) < 0) + return -EINVAL; + + data->access_reg = reg; + return count; +} + +/* read the value of access register in cpld data */ +static ssize_t read_register_value(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg = data->access_reg; + int reg_val; + + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + + if (reg_val < 0) + return -1; + + return sprintf(buf, "0x%x\n", reg_val); +} + +/* wrtie the value to access register in cpld data */ +static ssize_t write_register_value(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + int ret = -EIO; + u8 reg = data->access_reg; + u8 reg_val; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, client, reg, reg_val); + + return count; +} + +/* get cpdl version register value */ +static ssize_t read_cpld_version(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_VERSION) { + reg = CPLD_VERSION_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get board type register value */ +static ssize_t read_board_type(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_BOARD_TYPE) { + reg = CPLD_BOARD_TYPE_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get extend board type register value */ +static ssize_t read_ext_board_type(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_EXT_BOARD_TYPE) { + reg = CPLD_EXT_BOARD_TYPE_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get extend board type register value */ +static ssize_t read_pw_good(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_PW_GOOD) { + reg = CPLD_PW_GOOD_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get extend board type register value */ +static ssize_t read_pw_abs(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_PW_ABS) { + reg = CPLD_PW_ABS_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* add valid cpld client to list */ +static void i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = NULL; + + node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + if (!node) { + dev_info(&client->dev, + "Can't allocate cpld_client_node for index %d\n", + client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +/* remove exist cpld client in list */ +static void i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + list_for_each(list_node, &cpld_client_list) { + cpld_node = list_entry(list_node, + struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + mutex_unlock(&list_lock); +} + +/* cpld drvier probe */ +static int i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct cpld_data *data = NULL; + + data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + /* init cpld data for client */ + i2c_set_clientdata(client, data); + mutex_init(&data->access_lock); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_info(&client->dev, + "i2c_check_functionality failed (0x%x)\n", + client->addr); + status = -EIO; + goto exit; + } + + + status = sysfs_create_group(&client->dev.kobj,&i2c_cpld_group); + + if (status) + goto exit; + + dev_info(&client->dev, "chip found\n"); + + /* add probe chip to client list */ + i2c_cpld_add_client(client); + + return 0; +exit: + sysfs_remove_group(&client->dev.kobj, &i2c_cpld_group); + return status; +} + +/* cpld drvier remove */ +static int i2c_cpld_remove(struct i2c_client *client) +{ + + sysfs_remove_group(&client->dev.kobj, &i2c_cpld_group); + + i2c_cpld_remove_client(client); + return 0; +} + +MODULE_DEVICE_TABLE(i2c, i2c_cpld_id); + +static struct i2c_driver i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "i2c_cpld", + }, + .probe = i2c_cpld_probe, + .remove = i2c_cpld_remove, + .id_table = i2c_cpld_id, + .address_list = cpld_i2c_addr, +}; + +static int __init i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&i2c_cpld_driver); +} + +static void __exit i2c_cpld_exit(void) +{ + i2c_del_driver(&i2c_cpld_driver); +} + +MODULE_AUTHOR("Wade He "); +MODULE_DESCRIPTION("Ingrasys S9100-32X Platform i2c cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(i2c_cpld_init); +module_exit(i2c_cpld_exit); + + + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/i2c_cpld.h b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/i2c_cpld.h new file mode 100644 index 000000000000..e103b05c717a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/modules/i2c_cpld.h @@ -0,0 +1,197 @@ +/* + * + * S9100-32X I2C CPLD driver header file + * + * Copyright (C) 2017 Ingrasys, Inc. + * Wade He + * + * 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, see . + */ + +#ifndef I2C_CPLD_H +#define I2C_CPLD_H + +// remove debug before release +#define DEBUG + +/* CPLD device index value */ +enum cpld_id { + i2c_cpld +}; + +/* port number on CPLD */ +#define CPLD_1_PORT_NUM 12 +#define CPLD_2_PORT_NUM 13 + +/* QSFP port number */ +#define QSFP_MAX_PORT_NUM 64 +#define QSFP_MIN_PORT_NUM 1 + +/* SFP+ port number */ +#define SFP_MAX_PORT_NUM 2 +#define SFP_MIN_PORT_NUM 1 + + +/* CPLD registers */ +#define CPLD_BOARD_TYPE_REG 0x0 +#define CPLD_EXT_BOARD_TYPE_REG 0x7 +#define CPLD_VERSION_REG 0x1 +#define CPLD_PW_GOOD_REG 0x2 +#define CPLD_PW_ABS_REG 0x3 + + +/* bit definition for register value */ + +enum CPLD_RESET_CONTROL_BITS { + CPLD_RESET_CONTROL_SWRST_BIT, + CPLD_RESET_CONTROL_CP2104RST_BIT, + CPLD_RESET_CONTROL_82P33814RST_BIT, + CPLD_RESET_CONTROL_BMCRST_BIT, +}; + +/* bit field structure for register value */ +struct cpld_reg_board_type_t { + u8 build_rev:2; + u8 hw_rev:2; + u8 board_id:4; +}; + +struct cpld_reg_version_t { + u8 revision:6; + u8 release:1; + u8 reserve:1; +}; + +struct cpld_reg_pw_good_t { + u8 reserve1:3; + u8 psu1:1; + u8 psu2:1; + u8 reserve2:3; +}; + +struct cpld_reg_pw_abs_t { + u8 psu1:1; + u8 psu2:1; + u8 reserve:6; +}; + +/* common manipulation */ +#define INVALID(i, min, max) ((i < min) || (i > max) ? 1u : 0u) +#define READ_BIT(val, bit) ((0u == (val & (1<bf_name) +#define READ_BF_1(bf_struct, val, bf_name, bf_value) \ + bf_struct bf; \ + bf.data = val; \ + bf_value = bf.bf_name +#define BOARD_TYPE_BUILD_REV_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, build_rev, res) +#define BOARD_TYPE_HW_REV_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, hw_rev, res) +#define BOARD_TYPE_BOARD_ID_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, board_id, res) +#define CPLD_VERSION_REV_GET(val, res) \ + READ_BF(cpld_reg_version_t, val, revision, res) +#define CPLD_VERSION_REL_GET(val, res) \ + READ_BF(cpld_reg_version_t, val, release, res) +#define CPLD_PSU1_PW_GOOD_GET(val, res) \ + READ_BF(cpld_reg_pw_good_t, val, psu1, res) +#define CPLD_PSU2_PW_GOOD_GET(val, res) \ + READ_BF(cpld_reg_pw_good_t, val, psu2, res) +#define CPLD_PSU1_PW_ABS_GET(val, res) \ + READ_BF(cpld_reg_pw_abs_t, val, psu1, res) +#define CPLD_PSU2_PW_ABS_GET(val, res) \ + READ_BF(cpld_reg_pw_abs_t, val, psu2, res) +/* QSFP/SFP registers manipulation */ +#define QSFP_TO_CPLD_IDX(qsfp_port, cpld_index, cpld_port) \ +{ \ + if (QSFP_MIN_PORT_NUM <= qsfp_port && qsfp_port <= CPLD_1_PORT_NUM) { \ + cpld_index = cpld1; \ + cpld_port = qsfp_port - 1; \ + } else if (CPLD_1_PORT_NUM < qsfp_port \ + && qsfp_port <= QSFP_MAX_PORT_NUM) { \ + cpld_index = cpld2 + (qsfp_port - 1 - CPLD_1_PORT_NUM) \ + / CPLD_2_PORT_NUM; \ + cpld_port = (qsfp_port - 1 - CPLD_1_PORT_NUM) % \ + CPLD_2_PORT_NUM; \ + } else { \ + cpld_index = 0; \ + cpld_port = 0; \ + } \ +} +#define SFP_TO_CPLD_IDX(sfp_port, cpld_index) \ + (cpld_index = sfp_port - SFP_MIN_PORT_NUM) +#define QSFP_PORT_STATUS_REG(cpld_port) \ + (CPLD_QSFP_PORT_STATUS_BASE_REG + cpld_port) +#define QSFP_PORT_CONFIG_REG(cpld_port) \ + (CPLD_QSFP_PORT_CONFIG_BASE_REG + cpld_port) +#define QSFP_PORT_INT_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_QSFP_PORT_STATUS_INT_BIT) +#define QSFP_PORT_ABS_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_QSFP_PORT_STATUS_ABS_BIT) +#define QSFP_PORT_RESET_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_LPMODE_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define QSFP_PORT_RESET_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_RESET_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_LPMODE_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define QSFP_PORT_LPMODE_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define SFP_PORT_PRESENT_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_STATUS_PRESENT_BIT) + + #define SFP_PORT_TXFAULT_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_STATUS_TXFAULT_BIT) + #define SFP_PORT_RXLOS_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_STATUS_RXLOS_BIT) + #define SFP_PORT_TXDIS_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_CONFIG_TXDIS_BIT) +#define SFP_PORT_RS_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_RS_BIT) +#define SFP_PORT_TS_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TS_BIT) +#define SFP_PORT_TXDIS_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TXDIS_BIT) +#define SFP_PORT_TXDIS_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TXDIS_BIT) +#define SFP_PORT_RS_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_RS_BIT) +#define SFP_PORT_RS_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_RS_BIT) +#define SFP_PORT_TS_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TS_BIT) +#define SFP_PORT_TS_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TS_BIT) + +/* CPLD access functions */ +extern int i2c_cpld_get_qsfp_port_status_val(u8 port_num); +extern int i2c_cpld_get_qsfp_port_config_val(u8 port_num); +extern int i2c_cpld_set_qsfp_port_config_val(u8 port_num, u8 reg_val); +extern int i2c_cpld_get_sfp_port_status_val(u8 port_num); +extern int i2c_cpld_get_sfp_port_config_val(u8 port_num); +extern int i2c_cpld_set_sfp_port_config_val(u8 port_num, u8 reg_val); +extern u8 fp_port_to_phy_port(u8 fp_port); +#endif + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/service/qsfp-monitor.service b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/service/qsfp-monitor.service new file mode 100644 index 000000000000..e33c2fdae122 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/service/qsfp-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description= This QSFP Monitor service is to setup QSFP SI. +Requires=s8900-54xc-monitor.service +After=s8900-54xc-monitor.service + +[Service] +ExecStart=/usr/sbin/qsfp_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/service/s8900-54xc-monitor.service b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/service/s8900-54xc-monitor.service new file mode 100644 index 000000000000..e43fddc9b857 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/service/s8900-54xc-monitor.service @@ -0,0 +1,18 @@ +[Unit] +Description= This Platform Monitor service is to initialize platform and monitor platform. +Before=platform-monitor.service +After=sysinit.target +Wants=fancontrol.service +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/sbin/i2c_utils.sh i2c_init +ExecStart=/usr/sbin/s8900_54xc_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/i2c_utils.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/i2c_utils.sh new file mode 100644 index 000000000000..eea7b9ba8fe9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/i2c_utils.sh @@ -0,0 +1,1485 @@ +#!/bin/bash + +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +VERSION="1.0.0" +TRUE=200 +FALSE=404 +PORT_START=1 +PORT_END=54 + +EXEC_FUNC=${1} +COLOR_LED=${2} +QSFP_PORT=${2} +ONOFF_LED=${3} +FAN_TRAY=${4} + +############################################################ +# Distributor ID: Debian +# Description: Debian GNU/Linux 8.6 (jessie) +# Release: 8.6 +# Codename: jessie +# Linux debian 3.16.0-4-amd64 #1 +# SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux +############################################################ + +# Color Definition +COLOR_TITLE="\e[1;32m" ### Green ### +COLOR_WARNING="\e[1;33m" ### Yellow ### +COLOR_ERROR="\e[1;31m" ### Red ### +COLOR_END="\e[0m" ### END ### + +NUM_IGB_DEVICE=0 +NUM_I801_DEVICE=0 +NUM_ISMT_DEVICE=$(( ${NUM_I801_DEVICE} + 1 )) +NUM_MUX1_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 2 )) +NUM_MUX1_CHAN1_DEVICE=$(( ${NUM_I801_DEVICE} + 3 )) +NUM_MUX1_CHAN2_DEVICE=$(( ${NUM_I801_DEVICE} + 4 )) +NUM_MUX1_CHAN3_DEVICE=$(( ${NUM_I801_DEVICE} + 5 )) +NUM_MUX1_CHAN4_DEVICE=$(( ${NUM_I801_DEVICE} + 6 )) +NUM_MUX1_CHAN5_DEVICE=$(( ${NUM_I801_DEVICE} + 7 )) +NUM_MUX1_CHAN6_DEVICE=$(( ${NUM_I801_DEVICE} + 8 )) +NUM_MUX1_CHAN7_DEVICE=$(( ${NUM_I801_DEVICE} + 9 )) +NUM_MUX2_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 10 )) +NUM_MUX2_CHAN1_DEVICE=$(( ${NUM_I801_DEVICE} + 11 )) +NUM_MUX2_CHAN2_DEVICE=$(( ${NUM_I801_DEVICE} + 12 )) +NUM_MUX2_CHAN3_DEVICE=$(( ${NUM_I801_DEVICE} + 13 )) +NUM_MUX2_CHAN4_DEVICE=$(( ${NUM_I801_DEVICE} + 14 )) +NUM_MUX2_CHAN5_DEVICE=$(( ${NUM_I801_DEVICE} + 15 )) +NUM_MUX2_CHAN6_DEVICE=$(( ${NUM_I801_DEVICE} + 16 )) +NUM_MUX2_CHAN7_DEVICE=$(( ${NUM_I801_DEVICE} + 17 )) +NUM_MUX3_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 18 )) +NUM_MUX4_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 26 )) +NUM_MUX5_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 34 )) +NUM_MUX6_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 42 )) +NUM_MUX7_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 50 )) +NUM_MUX8_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 58 )) +NUM_MUX9_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 66 )) + +PATH_SYS_I2C_DEVICES="/sys/bus/i2c/devices" +PATH_HWMON_ROOT_DEVICES="/sys/class/hwmon" +PATH_HWMON_W83795_DEVICE="${PATH_HWMON_ROOT_DEVICES}/hwmon1" +PATH_I801_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}" +PATH_ISMT_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_ISMT_DEVICE}" +PATH_MUX_CHAN0_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN0_DEVICE}" +PATH_MUX_CHAN1_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN1_DEVICE}" +PATH_MUX_CHAN2_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN2_DEVICE}" +PATH_MUX_CHAN3_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN3_DEVICE}" +PATH_MUX_CHAN4_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN4_DEVICE}" +PATH_MUX_CHAN5_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN5_DEVICE}" +PATH_MUX_CHAN6_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN6_DEVICE}" +PATH_MUX_CHAN7_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN7_DEVICE}" + +#SFP/QSFP EEPROM i2c bus index +SFP_EEPROM_BUS_IDX=0 + +#Power Supply Status +PSU_DC_ON=1 +PSU_DC_OFF=0 +PSU_EXIST=1 +PSU_NOT_EXIST=0 + +#GPIO Index for QSFP +ZQSFP_PORT0_15_ABS_GPIO_IDX=192 +ZQSFP_PORT16_31_ABS_GPIO_IDX=176 +ZQSFP_PORT32_47_ABS_GPIO_IDX=160 + + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} i2c_init" + echo " : ${0} i2c_deinit" + echo " : ${0} i2c_temp_init" + echo " : ${0} i2c_fan_init" + echo " : ${0} i2c_volmon_init" + echo " : ${0} i2c_io_exp_init" + echo " : ${0} i2c_gpio_init" + echo " : ${0} i2c_gpio_deinit" + echo " : ${0} i2c_led_test" + echo " : ${0} i2c_psu_eeprom_get" + echo " : ${0} i2c_mb_eeprom_get" + echo " : ${0} i2c_qsfp_eeprom_get [1-54]" + echo " : ${0} i2c_qsfp_status_get [1-54]" + echo " : ${0} i2c_qsfp_type_get [1-54]" + echo " : ${0} i2c_board_type_get" + echo " : ${0} i2c_psu_status" + echo " : ${0} i2c_led_psu_status_set" + echo " : ${0} i2c_led_fan_status_set" + echo " : ${0} i2c_led_fan_tray_status_set" + echo " : ${0} i2c_cpld_version" + echo " : ${0} i2c_front_temp" + echo " : ${0} i2c_rear_temp" + echo " : ${0} i2c_test_all" + echo " : ${0} i2c_sys_led green|amber on|off" + echo " : ${0} i2c_fan_led green|amber on|off" + echo " : ${0} i2c_psu1_led green|amber on|off" + echo " : ${0} i2c_psu2_led green|amber on|off" + echo " : ${0} i2c_fan_tray_led green|amber on|off [1-4]" + echo "----------------------------------------------------" +} + +#Pause function +function _pause { + read -p "$*" +} + +#Retry command function +function _retry { + for i in {1..5}; + do + eval "${*}" && break || echo "retry"; sleep 1; + done +} + + +#I2C Init +function _i2c_init { + echo "=========================================================" + echo "# Description: I2C Init" + echo "=========================================================" + + rmmod i2c_ismt + rmmod i2c_i801 + modprobe i2c_i801 + modprobe i2c_ismt + modprobe i2c_dev + modprobe i2c_mux_pca954x force_deselect_on_exit=1 + + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x70' > ${PATH_ISMT_DEVICE}/new_device" + else + echo "pca9548 0x70 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX2_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x72' > ${PATH_ISMT_DEVICE}/new_device" + else + echo "pca9548 0x72 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX3_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN0_DEVICE}/new_device" + else + echo "pca9548 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX4_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN1_DEVICE}/new_device" + else + echo "pca9548 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX5_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN2_DEVICE}/new_device" + else + echo "pca9548 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX6_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN3_DEVICE}/new_device" + else + echo "pca9548 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX7_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN4_DEVICE}/new_device" + else + echo "pca9548 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX8_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN5_DEVICE}/new_device" + else + echo "pca9548 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX9_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN6_DEVICE}/new_device" + else + echo "pca9548 0x71 already init." + fi + + #Init CPLD LED_CLR Register (Front Port LED) + i2cset -y ${NUM_I801_DEVICE} 0x33 0x34 0x10 + + rmmod coretemp + rmmod jc42 + rmmod w83795 + _i2c_temp_init + _i2c_volmon_init + _i2c_hwmon_init + modprobe coretemp + modprobe w83795 + modprobe jc42 + modprobe sff_8436_eeprom + modprobe eeprom + modprobe eeprom_mb + _i2c_fan_init + _i2c_io_exp_init + _i2c_gpio_init + _i2c_cpld_init + _i2c_psu_eeprom_init + _i2c_led_psu_status_set + _i2c_led_fan_status_set + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_sys_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_sys_led + echo "Mount Main Board EEPROM" + echo "mb_eeprom 0x54" > /sys/bus/i2c/devices/i2c-17/new_device + for (( i=$PORT_START; i<=$PORT_END; i++ )) + do + _i2c_mount_sfp_eeprom $i + done + _config_rmem +} + +#I2C Deinit +function _i2c_deinit { + _i2c_gpio_deinit + for mod in coretemp jc42 w83795 eeprom_mb gpio-pca953x i2c_mux_pca954x i2c_ismt i2c_i801; + do + [ "$(lsmod | grep "^$mod ")" != "" ] && rmmod $mod + done +} + +#Temperature sensor Init +function _i2c_temp_init { + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x00 0x80 + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x05 0x7F + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x04 0x0A + echo "TEMP INIT Done" +} + +#FAN Init +function _i2c_fan_init { + echo -n "FAN INIT..." + if [ -e "${PATH_HWMON_W83795_DEVICE}" ]; then + echo 120 > ${PATH_HWMON_W83795_DEVICE}/device/pwm1 + echo 120 > ${PATH_HWMON_W83795_DEVICE}/device/pwm2 + echo "SUCCESS" + else + echo "FAIL" + fi + +} + +#VOLMON Init +function _i2c_volmon_init { + echo -n "VOLMON INIT..." + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x00 0x80 + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x02 0xFF + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x03 0x50 + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x04 0x0A + echo "Done" +} + +#HWMON Init +function _i2c_hwmon_init { + echo -n "HWMON INIT..." + i2cset -y ${NUM_I801_DEVICE} 0x2F 0x00 0x80 + i2cset -y ${NUM_I801_DEVICE} 0x2F 0x06 0xFF + echo "Done" +} + +#IO Expander Init +function _i2c_io_exp_init { + echo "=========================================================" + echo "# Description: I2C IO Expender Init" + echo "=========================================================" + #SMBUS0 IO_EXPENDER + i2cset -y -r ${NUM_I801_DEVICE} 0x27 4 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x27 5 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x27 6 0xFF + i2cset -y -r ${NUM_I801_DEVICE} 0x27 7 0xFF + + #SMBUS1 + #SFP+ ABS + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x22 5 0x00 + + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x20 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x20 7 0xFF + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x21 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x21 7 0xFF + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x22 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x22 7 0xFF + + #QSFP/ZQSFP ABS + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x23 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x23 6 0xFF + + #QSFP/ZQSFP INT + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x23 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN0_DEVICE} 0x23 7 0xFF + + #SFP+ RX_LOS + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x22 5 0x00 + + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x20 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x20 7 0xFF + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x21 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x21 7 0xFF + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x22 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN1_DEVICE} 0x22 7 0xFF + + #SFP+ TX_FAULT + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x22 5 0x00 + + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x20 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x20 7 0xFF + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x21 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x21 7 0xFF + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x22 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN2_DEVICE} 0x22 7 0xFF + + #SFP+ TX_RS + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x22 5 0x00 + + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x20 2 0xFF + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x20 3 0xFF + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x21 2 0xFF + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x21 3 0xFF + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x22 2 0xFF + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x22 3 0xFF + + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x20 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x20 7 0xFF + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x21 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x21 7 0xFF + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x22 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x22 7 0xFF + + #QSFP/zQSFP LPMODE + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x23 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x23 2 0x00 + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x23 6 0x00 + + #QSFP/zQSFP MODSEL + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x23 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x23 3 0x00 + i2cset -y -r ${NUM_MUX2_CHAN3_DEVICE} 0x23 7 0x00 + + #SFP+ RX_RS + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x22 5 0x00 + + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x20 2 0xFF + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x20 3 0xFF + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x21 2 0xFF + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x21 3 0xFF + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x22 2 0xFF + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x22 3 0xFF + + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x20 6 0x00 + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x20 7 0x00 + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x21 6 0x00 + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x21 7 0x00 + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x22 6 0x00 + i2cset -y -r ${NUM_MUX2_CHAN4_DEVICE} 0x22 7 0x00 + + #SFP+ TX_DIS + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x22 5 0x00 + + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x20 2 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x20 3 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x21 2 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x21 3 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x22 2 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x22 3 0x00 + + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x20 6 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x20 7 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x21 6 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x21 7 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x22 6 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x22 7 0x00 + + #QSFP/zQSFP RST + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x23 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x23 2 0xFF + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x23 6 0x00 + + #SFP/QSFP/zQSFP I/O + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x24 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x24 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x24 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN5_DEVICE} 0x24 7 0xFF + + #ZQSFP/SFP+/E-Card General + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x21 2 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x21 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x21 6 0xF4 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x21 7 0xF4 + + #LED board after PVT (S8900_IO_EXP_LED_ID) + echo "Init LED IO Expender" + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 7 0x00 + + #PSU I/O (S8900_IO_EXP_PSU_ID) + echo "Init PSU IO Expender" + i2cset -y -r ${NUM_MUX2_CHAN6_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN6_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN6_DEVICE} 0x20 2 0x00 + i2cset -y -r ${NUM_MUX2_CHAN6_DEVICE} 0x20 3 0x00 + i2cset -y -r ${NUM_MUX2_CHAN6_DEVICE} 0x20 6 0xFF + i2cset -y -r ${NUM_MUX2_CHAN6_DEVICE} 0x20 7 0xFF + + #FAN I/O (S8900_IO_EXP_FAN_ID) + echo "Init FAN IO Expender" + i2cset -y -r ${NUM_MUX2_CHAN7_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX2_CHAN7_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX2_CHAN7_DEVICE} 0x20 2 0x11 + i2cset -y -r ${NUM_MUX2_CHAN7_DEVICE} 0x20 3 0x11 + i2cset -y -r ${NUM_MUX2_CHAN7_DEVICE} 0x20 6 0xCC + i2cset -y -r ${NUM_MUX2_CHAN7_DEVICE} 0x20 7 0xCC +} + +function _get_sfp_eeprom_bus_idx { + case $1 in + 1|2|3|4|5|6|7|8) + SFP_EEPROM_BUS_IDX=$(( (${NUM_MUX3_CHAN0_DEVICE} + $1 - 1) )) + ;; + 9|10|11|12|13|14|15|16) + SFP_EEPROM_BUS_IDX=$(( (${NUM_MUX4_CHAN0_DEVICE} + $1 - 9) )) + ;; + 17|18|19|20|21|22|23|24) + SFP_EEPROM_BUS_IDX=$(( (${NUM_MUX5_CHAN0_DEVICE} + $1 - 17) )) + ;; + 25|26|27|28|29|30|31|32) + SFP_EEPROM_BUS_IDX=$(( (${NUM_MUX6_CHAN0_DEVICE} + $1 - 25) )) + ;; + 33|34|35|36|37|38|39|40) + SFP_EEPROM_BUS_IDX=$(( (${NUM_MUX7_CHAN0_DEVICE} + $1 - 33) )) + ;; + 41|42|43|44|45|46|47|48) + SFP_EEPROM_BUS_IDX=$(( (${NUM_MUX8_CHAN0_DEVICE} + $1 - 41) )) + ;; + 49|50|51|52|53|54) + SFP_EEPROM_BUS_IDX=$(( (${NUM_MUX9_CHAN0_DEVICE} + $1 - 49) )) + ;; + *) + SFP_EEPROM_BUS_IDX=-1 + ;; + esac +} + +#Mount SFP/QSFP EEPROM +function _i2c_mount_sfp_eeprom { + _get_sfp_eeprom_bus_idx $1 + eeprombus=${SFP_EEPROM_BUS_IDX} + eepromAddr=0x50 + echo "sff8436 $eepromAddr" > /sys/bus/i2c/devices/i2c-$eeprombus/new_device + echo "Mount Port $1 EEPROM" +} + +#Unmount SFP/QSFP EEPROM +function _i2c_unmount_sfp_eeprom { + _get_sfp_eeprom_bus_idx $1 + eeprombus=${SFP_EEPROM_BUS_IDX} + eepromAddr=0x50 + echo "$eepromAddr" > /sys/bus/i2c/devices/i2c-$eeprombus/new_device + echo "Unmount Port $1 EEPROM" +} + +#GPIO Init +function _i2c_gpio_init { + + #QSFP/ZQSFP ABS+INT + echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN0_DEVICE}/new_device + + _retry "echo 240 > /sys/class/gpio/export" + echo 241 > /sys/class/gpio/export + echo 242 > /sys/class/gpio/export + echo 243 > /sys/class/gpio/export + echo 244 > /sys/class/gpio/export + echo 245 > /sys/class/gpio/export + echo 246 > /sys/class/gpio/export + echo 247 > /sys/class/gpio/export + echo 248 > /sys/class/gpio/export + echo 249 > /sys/class/gpio/export + echo 250 > /sys/class/gpio/export + echo 251 > /sys/class/gpio/export + echo 252 > /sys/class/gpio/export + echo 253 > /sys/class/gpio/export + echo 254 > /sys/class/gpio/export + echo 255 > /sys/class/gpio/export + + echo 1 > /sys/class/gpio/gpio241/active_low #QSFP49 ABS + echo 1 > /sys/class/gpio/gpio240/active_low #QSFP48 ABS + echo 1 > /sys/class/gpio/gpio243/active_low #QSFP51 ABS + echo 1 > /sys/class/gpio/gpio242/active_low #QSFP50 ABS + echo 1 > /sys/class/gpio/gpio245/active_low #QSFP53 ABS + echo 1 > /sys/class/gpio/gpio244/active_low #QSFP52 ABS + echo 1 > /sys/class/gpio/gpio247/active_low #NA + echo 1 > /sys/class/gpio/gpio246/active_low #NA + echo 1 > /sys/class/gpio/gpio249/active_low #QSFP49 INT + echo 1 > /sys/class/gpio/gpio248/active_low #QSFP48 INT + echo 1 > /sys/class/gpio/gpio251/active_low #QSFP51 INT + echo 1 > /sys/class/gpio/gpio250/active_low #QSFP50 INT + echo 1 > /sys/class/gpio/gpio253/active_low #QSFP53 INT + echo 1 > /sys/class/gpio/gpio252/active_low #QSFP52 INT + echo 1 > /sys/class/gpio/gpio255/active_low #NA + echo 1 > /sys/class/gpio/gpio254/active_low #NA + + #QSFP/zQSFP LPMODE+MODSEL + echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN3_DEVICE}/new_device + echo 224 > /sys/class/gpio/export #QSFP0 LPMODE + echo 225 > /sys/class/gpio/export #QSFP1 LPMODE + echo 226 > /sys/class/gpio/export #QSFP2 LPMODE + echo 227 > /sys/class/gpio/export #QSFP3 LPMODE + echo 228 > /sys/class/gpio/export #QSFP4 LPMODE + echo 229 > /sys/class/gpio/export #QSFP5 LPMODE + echo 230 > /sys/class/gpio/export #NA + echo 231 > /sys/class/gpio/export #NA + echo 232 > /sys/class/gpio/export #QSFP0 MODSEL + echo 233 > /sys/class/gpio/export #QSFP1 MODSEL + echo 234 > /sys/class/gpio/export #QSFP2 MODSEL + echo 235 > /sys/class/gpio/export #QSFP3 MODSEL + echo 236 > /sys/class/gpio/export #QSFP4 MODSEL + echo 237 > /sys/class/gpio/export #QSFP5 MODSEL + echo 238 > /sys/class/gpio/export #NA + echo 239 > /sys/class/gpio/export #NA + echo out > /sys/class/gpio/gpio224/direction + echo out > /sys/class/gpio/gpio225/direction + echo out > /sys/class/gpio/gpio226/direction + echo out > /sys/class/gpio/gpio227/direction + echo out > /sys/class/gpio/gpio228/direction + echo out > /sys/class/gpio/gpio229/direction + echo out > /sys/class/gpio/gpio230/direction + echo out > /sys/class/gpio/gpio231/direction + echo out > /sys/class/gpio/gpio232/direction + echo out > /sys/class/gpio/gpio233/direction + echo out > /sys/class/gpio/gpio234/direction + echo out > /sys/class/gpio/gpio235/direction + echo out > /sys/class/gpio/gpio236/direction + echo out > /sys/class/gpio/gpio237/direction + echo out > /sys/class/gpio/gpio238/direction + echo out > /sys/class/gpio/gpio239/direction + + #QSFP RST + echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN5_DEVICE}/new_device + echo 208 > /sys/class/gpio/export #QSFP0 RST + echo 209 > /sys/class/gpio/export #QSFP1 RST + echo 210 > /sys/class/gpio/export #QSFP2 RST + echo 211 > /sys/class/gpio/export #QSFP3 RST + echo 212 > /sys/class/gpio/export #QSFP4 RST + echo 213 > /sys/class/gpio/export #QSFP5 RST + echo 214 > /sys/class/gpio/export #NA + echo 215 > /sys/class/gpio/export #NA + echo 216 > /sys/class/gpio/export #NA + echo 217 > /sys/class/gpio/export #NA + echo 218 > /sys/class/gpio/export #NA + echo 219 > /sys/class/gpio/export #NA + echo 220 > /sys/class/gpio/export #NA + echo 221 > /sys/class/gpio/export #NA + echo 222 > /sys/class/gpio/export #NA + echo 223 > /sys/class/gpio/export #NA + echo out > /sys/class/gpio/gpio208/direction + echo out > /sys/class/gpio/gpio209/direction + echo out > /sys/class/gpio/gpio210/direction + echo out > /sys/class/gpio/gpio211/direction + echo out > /sys/class/gpio/gpio212/direction + echo out > /sys/class/gpio/gpio213/direction + echo 1 > /sys/class/gpio/gpio208/active_low + echo 1 > /sys/class/gpio/gpio209/active_low + echo 1 > /sys/class/gpio/gpio210/active_low + echo 1 > /sys/class/gpio/gpio211/active_low + echo 1 > /sys/class/gpio/gpio212/active_low + echo 1 > /sys/class/gpio/gpio213/active_low + echo 0 > /sys/class/gpio/gpio208/value + echo 0 > /sys/class/gpio/gpio209/value + echo 0 > /sys/class/gpio/gpio210/value + echo 0 > /sys/class/gpio/gpio211/value + echo 0 > /sys/class/gpio/gpio212/value + echo 0 > /sys/class/gpio/gpio213/value + + #SFP+ ABS 0-15 + echo "pca9535 0x20" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN0_DEVICE}/new_device + echo 192 > /sys/class/gpio/export + echo 193 > /sys/class/gpio/export + echo 194 > /sys/class/gpio/export + echo 195 > /sys/class/gpio/export + echo 196 > /sys/class/gpio/export + echo 197 > /sys/class/gpio/export + echo 198 > /sys/class/gpio/export + echo 199 > /sys/class/gpio/export + echo 200 > /sys/class/gpio/export + echo 201 > /sys/class/gpio/export + echo 202 > /sys/class/gpio/export + echo 203 > /sys/class/gpio/export + echo 204 > /sys/class/gpio/export + echo 205 > /sys/class/gpio/export + echo 206 > /sys/class/gpio/export + echo 207 > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio192/active_low #SFP+00 + echo 1 > /sys/class/gpio/gpio193/active_low #SFP+01 + echo 1 > /sys/class/gpio/gpio194/active_low #SFP+02 + echo 1 > /sys/class/gpio/gpio195/active_low #SFP+03 + echo 1 > /sys/class/gpio/gpio196/active_low #SFP+04 + echo 1 > /sys/class/gpio/gpio197/active_low #SFP+05 + echo 1 > /sys/class/gpio/gpio198/active_low #SFP+06 + echo 1 > /sys/class/gpio/gpio199/active_low #SFP+07 + echo 1 > /sys/class/gpio/gpio200/active_low #SFP+08 + echo 1 > /sys/class/gpio/gpio201/active_low #SFP+09 + echo 1 > /sys/class/gpio/gpio202/active_low #SFP+10 + echo 1 > /sys/class/gpio/gpio203/active_low #SFP+11 + echo 1 > /sys/class/gpio/gpio204/active_low #SFP+12 + echo 1 > /sys/class/gpio/gpio205/active_low #SFP+13 + echo 1 > /sys/class/gpio/gpio206/active_low #SFP+14 + echo 1 > /sys/class/gpio/gpio207/active_low #SFP+15 + + #SFP+ ABS 16-31 + echo "pca9535 0x21" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN0_DEVICE}/new_device + echo 176 > /sys/class/gpio/export + echo 177 > /sys/class/gpio/export + echo 178 > /sys/class/gpio/export + echo 179 > /sys/class/gpio/export + echo 180 > /sys/class/gpio/export + echo 181 > /sys/class/gpio/export + echo 182 > /sys/class/gpio/export + echo 183 > /sys/class/gpio/export + echo 184 > /sys/class/gpio/export + echo 185 > /sys/class/gpio/export + echo 186 > /sys/class/gpio/export + echo 187 > /sys/class/gpio/export + echo 188 > /sys/class/gpio/export + echo 189 > /sys/class/gpio/export + echo 190 > /sys/class/gpio/export + echo 191 > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio176/active_low #SFP+16 + echo 1 > /sys/class/gpio/gpio177/active_low #SFP+17 + echo 1 > /sys/class/gpio/gpio178/active_low #SFP+18 + echo 1 > /sys/class/gpio/gpio179/active_low #SFP+19 + echo 1 > /sys/class/gpio/gpio180/active_low #SFP+20 + echo 1 > /sys/class/gpio/gpio181/active_low #SFP+21 + echo 1 > /sys/class/gpio/gpio182/active_low #SFP+22 + echo 1 > /sys/class/gpio/gpio183/active_low #SFP+23 + echo 1 > /sys/class/gpio/gpio184/active_low #SFP+24 + echo 1 > /sys/class/gpio/gpio185/active_low #SFP+25 + echo 1 > /sys/class/gpio/gpio186/active_low #SFP+26 + echo 1 > /sys/class/gpio/gpio187/active_low #SFP+27 + echo 1 > /sys/class/gpio/gpio188/active_low #SFP+28 + echo 1 > /sys/class/gpio/gpio189/active_low #SFP+29 + echo 1 > /sys/class/gpio/gpio190/active_low #SFP+30 + echo 1 > /sys/class/gpio/gpio191/active_low #SFP+31 + + #SFP+ ABS 32-47 + echo "pca9535 0x22" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN0_DEVICE}/new_device + echo 160 > /sys/class/gpio/export + echo 161 > /sys/class/gpio/export + echo 162 > /sys/class/gpio/export + echo 163 > /sys/class/gpio/export + echo 164 > /sys/class/gpio/export + echo 165 > /sys/class/gpio/export + echo 166 > /sys/class/gpio/export + echo 167 > /sys/class/gpio/export + echo 168 > /sys/class/gpio/export + echo 169 > /sys/class/gpio/export + echo 170 > /sys/class/gpio/export + echo 171 > /sys/class/gpio/export + echo 172 > /sys/class/gpio/export + echo 173 > /sys/class/gpio/export + echo 174 > /sys/class/gpio/export + echo 175 > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio160/active_low #SFP+32 + echo 1 > /sys/class/gpio/gpio161/active_low #SFP+33 + echo 1 > /sys/class/gpio/gpio162/active_low #SFP+34 + echo 1 > /sys/class/gpio/gpio163/active_low #SFP+35 + echo 1 > /sys/class/gpio/gpio164/active_low #SFP+36 + echo 1 > /sys/class/gpio/gpio165/active_low #SFP+37 + echo 1 > /sys/class/gpio/gpio166/active_low #SFP+38 + echo 1 > /sys/class/gpio/gpio167/active_low #SFP+39 + echo 1 > /sys/class/gpio/gpio168/active_low #SFP+40 + echo 1 > /sys/class/gpio/gpio169/active_low #SFP+41 + echo 1 > /sys/class/gpio/gpio170/active_low #SFP+42 + echo 1 > /sys/class/gpio/gpio171/active_low #SFP+43 + echo 1 > /sys/class/gpio/gpio172/active_low #SFP+44 + echo 1 > /sys/class/gpio/gpio173/active_low #SFP+45 + echo 1 > /sys/class/gpio/gpio174/active_low #SFP+46 + echo 1 > /sys/class/gpio/gpio175/active_low #SFP+47 + +} + +#GPIO DeInit +function _i2c_gpio_deinit { + echo "0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN0_DEVICE}/delete_device + echo "0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN3_DEVICE}/delete_device + echo "0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN5_DEVICE}/delete_device + echo "0x20" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN0_DEVICE}/delete_device + echo "0x21" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN0_DEVICE}/delete_device + echo "0x22" > /sys/bus/i2c/devices/i2c-${NUM_MUX2_CHAN0_DEVICE}/delete_device +} + +#I2C CPLD init +function _i2c_cpld_init { + echo "=========================================================" + echo "# Description: I2C CPLD Init..." + echo "=========================================================" + + ## modprobe i2c_cpld + modprobe i2c_cpld + ## Add CPLD device + echo "i2c_cpld 0x33" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}/new_device + + echo "done..." +} + +#Set FAN Tray LED +function _i2c_led_fan_tray_status_set { + echo "FAN Tray Status Setup" + #FAN Status get + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan2_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan4_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN6_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan6_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + FAN8_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan8_alarm` + + if [ "${FAN1_ALARM}" == "0" ] && [ "${FAN2_ALARM}" == "0" ]; then + FAN_TRAY=1 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=1 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + if [ "${FAN3_ALARM}" == "0" ] && [ "${FAN4_ALARM}" == "0" ]; then + FAN_TRAY=2 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=2 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + if [ "${FAN5_ALARM}" == "0" ] && [ "${FAN6_ALARM}" == "0" ]; then + FAN_TRAY=3 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=3 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + if [ "${FAN7_ALARM}" == "0" ] && [ "${FAN8_ALARM}" == "0" ]; then + FAN_TRAY=4 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=4 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi +} + +#Set FAN LED +function _i2c_led_fan_status_set { + echo "FAN Status Setup" + #PSU Status set + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan2_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan4_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN6_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan6_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + FAN8_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan8_alarm` + + if [ "${FAN1_ALARM}" == "0" ] && [ "${FAN2_ALARM}" == "0" ] \ + && [ "${FAN3_ALARM}" == "0" ] && [ "${FAN4_ALARM}" == "0" ] \ + && [ "${FAN5_ALARM}" == "0" ] && [ "${FAN6_ALARM}" == "0" ] \ + && [ "${FAN7_ALARM}" == "0" ] && [ "${FAN8_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + fi +} + +#Set Power Supply LED +function _i2c_led_psu_status_set { + echo "PSU LED Status Setup" + + #PSU Status set + _i2c_psu_status + + #PSU1 Status + if [ "${psu1Exist}" == ${PSU_EXIST} ]; then + if [ "${psu1PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + fi + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + fi + + #PSU2 Status + if [ "${psu2Exist}" == ${PSU_EXIST} ]; then + if [ "${psu2PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + fi + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + fi +} + +#LED Test +function _i2c_led_test { + echo "=========================================================" + echo "# Description: I2C LED TEST..." + echo "=========================================================" + #sys led (green) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x7F + _pause 'Check SYS LED green light and Press [Enter] key to continue...' + #sys led (amber) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xBF + _pause 'Check SYS LED amber light and Press [Enter] key to continue...' + + #FAN led (green) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xF7 + _pause 'Check FAN LED green light and Press [Enter] key to continue...' + #FAN led (amber) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFB + _pause 'Check FAN LED amber light and Press [Enter] key to continue...' + + #PSU2 led (green) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xDF + _pause 'Check PSU2 LED green light and Press [Enter] key to continue...' + #PSU2 led (amber) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xEF + _pause 'Check PSU2 LED amber light and Press [Enter] key to continue...' + + #PSU1 led (green) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFD + _pause 'Check PSU1 LED green light and Press [Enter] key to continue...' + #PSU1 led (amber) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFE + _pause 'Check PSU1 LED amber light and Press [Enter] key to continue...' + + #Turn OFF All LED + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + _pause 'Check turn off all LEDs and Press [Enter] key to continue...' + echo "done..." +} + +#Set QSFP Port variable +function _qsfp_port_i2c_var_set { + local port=$1 + case ${port} in + 1|2|3|4|5|6|7|8) + i2cbus=${NUM_MUX2_CHAN0_DEVICE} + regAddr=0x20 + dataAddr=0 + gpioBase=${ZQSFP_PORT0_15_ABS_GPIO_IDX} + ;; + 9|10|11|12|13|14|15|16) + i2cbus=${NUM_MUX2_CHAN0_DEVICE} + regAddr=0x20 + dataAddr=1 + gpioBase=${ZQSFP_PORT0_15_ABS_GPIO_IDX} + ;; + 17|18|19|20|21|22|23|24) + i2cbus=${NUM_MUX2_CHAN0_DEVICE} + regAddr=0x21 + dataAddr=0 + gpioBase=${ZQSFP_PORT16_31_ABS_GPIO_IDX} + ;; + 25|26|27|28|29|30|31|32) + i2cbus=${NUM_MUX2_CHAN0_DEVICE} + regAddr=0x21 + dataAddr=1 + gpioBase=${ZQSFP_PORT16_31_ABS_GPIO_IDX} + ;; + 33|34|35|36|37|38|39|40) + i2cbus=${NUM_MUX2_CHAN0_DEVICE} + regAddr=0x22 + dataAddr=0 + gpioBase=${ZQSFP_PORT32_47_ABS_GPIO_IDX} + ;; + 41|42|43|44|45|46|47|48) + i2cbus=${NUM_MUX2_CHAN0_DEVICE} + regAddr=0x22 + dataAddr=1 + gpioBase=${ZQSFP_PORT32_47_ABS_GPIO_IDX} + ;; + 49|50|51|52|53|54) + i2cbus=${NUM_MUX2_CHAN0_DEVICE} + regAddr=0x23 + dataAddr=0 + gpioBase=$((240 - 48)) + ;; + *) + echo "Please input 1~54" + exit ${FALSE} + ;; + esac +} + +#Get QSFP present +function _i2c_qsfp_status_get { + local status + _qsfp_port_i2c_var_set ${QSFP_PORT} + if [ ${QSFP_PORT} -lt 49 ] && [ ${QSFP_PORT} -gt 0 ]; then + status=`cat /sys/class/gpio/gpio$(( $(($gpioBase + (${QSFP_PORT} - 1) % 16 )) ))/value` + elif [ ${QSFP_PORT} -ge 49 ] && [ ${QSFP_PORT} -le 54 ]; then + status=`cat /sys/class/gpio/gpio$(( $(($gpioBase + (${QSFP_PORT} - 1))) ))/value` + fi + + echo "status=$status" +} + +#Get QSFP type +function _i2c_qsfp_type_get { + _get_sfp_eeprom_bus_idx ${QSFP_PORT} + eeprombus=${SFP_EEPROM_BUS_IDX} + eepromAddr=0x50 + qsfp_info=$(base64 ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom) + + if [ ${QSFP_PORT} -ge 1 ] && [ ${QSFP_PORT} -le 48 ]; then + echo "sfp" + # 1~48 port is sfp port + identifier=$(echo $qsfp_info | base64 -d -i | hexdump -s 0 -n 1 -e '"%x"') + connector=$(echo $qsfp_info | base64 -d -i | hexdump -s 2 -n 1 -e '"%x"') + transceiver=$(echo $qsfp_info | base64 -d -i | hexdump -s 3 -n 1 -e '"%x"') + else + echo "qsfp" + # 49~54 port is qsfp port + identifier=$(echo $qsfp_info | base64 -d -i | hexdump -s 128 -n 1 -e '"%x"') + connector=$(echo $qsfp_info | base64 -d -i | hexdump -s 130 -n 1 -e '"%x"') + transceiver=$(echo $qsfp_info | base64 -d -i | hexdump -s 131 -n 1 -e '"%x"') + fi + + echo "identifier=$identifier" + echo "connector=$connector" + echo "transceiver=$transceiver" +} + +#Get QSFP EEPROM Information +function _i2c_qsfp_eeprom_get { + + _qsfp_port_i2c_var_set ${QSFP_PORT} + + if [ ${QSFP_PORT} -lt 49 ] && [ ${QSFP_PORT} -gt 0 ]; then + + #status: 0 -> Down, 1 -> Up + status=`cat /sys/class/gpio/gpio$(( $(($gpioBase + (${QSFP_PORT} - 1) % 16 )) ))/value` + echo $status + + if [ $status = 0 ]; then + exit + fi + + _get_sfp_eeprom_bus_idx ${QSFP_PORT} + eeprombus=${SFP_EEPROM_BUS_IDX} + eepromAddr=0x50 + cat ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom | hexdump -C + elif [ ${QSFP_PORT} -ge 49 ] && [ ${QSFP_PORT} -le 54 ]; then + #status: 0 -> Down, 1 -> Up + status=`cat /sys/class/gpio/gpio$(( $(($gpioBase + (${QSFP_PORT} - 1))) ))/value` + echo $status + + if [ $status = 0 ]; then + exit + fi + _get_sfp_eeprom_bus_idx ${QSFP_PORT} + eeprombus=${SFP_EEPROM_BUS_IDX} + eepromAddr=0x50 + cat ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom | hexdump -C + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi +} + +#PSU EEPROM init +function _i2c_psu_eeprom_init { + echo "=========================================================" + echo "# Description: I2C PSU EEPROM Init..." + echo "=========================================================" + + ## modprobe eeprom + modprobe eeprom + ## PUS(0) EEPROM + echo "eeprom 0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX2_CHAN6_DEVICE}/new_device + + ## PUS(1) EEPROM + echo "eeprom 0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX2_CHAN7_DEVICE}/new_device + + echo "done..." +} + +#Get PSU EEPROM Information +function _i2c_psu_eeprom_get { + echo "=========================================================" + echo "# Description: I2C PSU EEPROM Get..." + echo "=========================================================" + + ## modprobe eeprom + modprobe eeprom + ## PUS(0) EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_MUX2_CHAN6_DEVICE}-0050/eeprom | hexdump -C + + ## PUS(1) EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_MUX2_CHAN7_DEVICE}-0050/eeprom | hexdump -C + + echo "done..." +} + +#Get MotherBoard EEPROM Information +function _i2c_mb_eeprom_get { + echo "=========================================================" + echo "# Description: I2C MB EEPROM Get..." + echo "=========================================================" + + ## modprobe eeprom + modprobe eeprom_mb + + ## MB EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_MUX2_CHAN7_DEVICE}-0054/eeprom | hexdump -C + echo "done..." +} + +#Set System Status LED +function _i2c_sys_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x80 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x80 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x40 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x40 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set PSU2 LED +function _i2c_psu2_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x20 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x20 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x10 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x10 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set FAN Tray LED +function _i2c_fan_tray_led { + case ${FAN_TRAY} in + 1) + i2cAddr=0x20 + ioPort=2 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 2) + i2cAddr=0x20 + ioPort=2 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + 3) + i2cAddr=0x20 + ioPort=3 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 4) + i2cAddr=0x20 + ioPort=3 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + *) + echo "Please input 1~4" + exit + ;; + esac + + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m $mask -y -r ${NUM_MUX2_CHAN7_DEVICE} $i2cAddr $ioPort 0x33 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m $mask -y -r ${NUM_MUX2_CHAN7_DEVICE} $i2cAddr $ioPort 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m $mask -y -r ${NUM_MUX2_CHAN7_DEVICE} $i2cAddr $ioPort 0x33 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m $mask -y -r ${NUM_MUX2_CHAN7_DEVICE} $i2cAddr $ioPort 0x00 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set FAN LED +function _i2c_fan_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x08 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x08 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x04 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x04 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set PSU1 LED +function _i2c_psu1_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x02 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x02 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x01 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x01 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Get Board Version and Type +function _i2c_board_type_get { + boardType=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_board_type` + boardBuildRev=$((($boardType) & 0x03)) + boardHwRev=$((($boardType) >> 2 & 0x03)) + boardId=$((($boardType) >> 4)) + printf "BOARD_ID is 0x%02x, HW Rev %d, Build Rev %d\n" $boardId $boardHwRev $boardBuildRev + +} + +#Get CPLD Version +function _i2c_cpld_version { + cpldRev=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_version` + cpldRelease=$((($cpldRev) >> 6 & 0x01)) + cpldVersion=$((($cpldRev) & 0x3F)) + printf "CPLD is %s version(0:RD 1:Release), Revision is 0x%02x\n" $cpldRelease $cpldVersion + +} + +#Get PSU Status +function _i2c_psu_status { + psuPresent=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_pw_abs` + psu1Exist=$(($((($psuPresent) & 0x01))?0:1)) + psu2Exist=$(($((($psuPresent) & 0x02))?0:1)) + psuPwGood=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_pw_good` + psu1PwGood=$(($((($psuPwGood) >> 3 & 0x01))?1:0)) + psu2PwGood=$(($((($psuPwGood) >> 3 & 0x02))?1:0)) + printf "PSU1 Exist:%d PSU1 PW Good:%d\n" $psu1Exist $psu1PwGood + printf "PSU2 Exist:%d PSU2 PW Good:%d\n" $psu2Exist $psu2PwGood +} + +#Get Front Sensor Temperature +function _i2c_front_temp { + #Front MAC + sensors | grep 'Front MAC Temp' -A 1 +} + +#Get Rear Sensor Temperature +function _i2c_rear_temp { + #Rear MAC + sensors | grep 'Rear MAC Temp' -A 1 +} + +#Increase read socket buffer for CoPP Test +function _config_rmem { + echo "109430400" > /proc/sys/net/core/rmem_max +} + +#Main Function +function _main { + tart_time_str=`date` + start_time_sec=$(date +%s) + + if [ "${EXEC_FUNC}" == "help" ]; then + _help + elif [ "${EXEC_FUNC}" == "i2c_init" ]; then + _i2c_init + elif [ "${EXEC_FUNC}" == "i2c_deinit" ]; then + _i2c_deinit + elif [ "${EXEC_FUNC}" == "i2c_temp_init" ]; then + _i2c_temp_init + elif [ "${EXEC_FUNC}" == "i2c_fan_init" ]; then + _i2c_fan_init + elif [ "${EXEC_FUNC}" == "i2c_volmon_init" ]; then + _i2c_volmon_init + elif [ "${EXEC_FUNC}" == "i2c_io_exp_init" ]; then + _i2c_io_exp_init + elif [ "${EXEC_FUNC}" == "i2c_gpio_init" ]; then + _i2c_gpio_init + elif [ "${EXEC_FUNC}" == "i2c_gpio_deinit" ]; then + _i2c_gpio_deinit + elif [ "${EXEC_FUNC}" == "i2c_led_test" ]; then + _i2c_led_test + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_get" ]; then + _i2c_mb_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_psu_eeprom_get" ]; then + _i2c_psu_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_get" ]; then + _i2c_qsfp_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_status_get" ]; then + _i2c_qsfp_status_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_type_get" ]; then + _i2c_qsfp_type_get + elif [ "${EXEC_FUNC}" == "i2c_led_psu_status_set" ]; then + _i2c_led_psu_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_status_set" ]; then + _i2c_led_fan_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_tray_status_set" ]; then + _i2c_led_fan_tray_status_set + elif [ "${EXEC_FUNC}" == "i2c_sys_led" ]; then + _i2c_sys_led + elif [ "${EXEC_FUNC}" == "i2c_fan_led" ]; then + _i2c_fan_led + elif [ "${EXEC_FUNC}" == "i2c_fan_tray_led" ]; then + _i2c_fan_tray_led + elif [ "${EXEC_FUNC}" == "i2c_psu1_led" ]; then + _i2c_psu1_led + elif [ "${EXEC_FUNC}" == "i2c_psu2_led" ]; then + _i2c_psu2_led + elif [ "${EXEC_FUNC}" == "i2c_board_type_get" ]; then + _i2c_board_type_get + elif [ "${EXEC_FUNC}" == "i2c_cpld_version" ]; then + _i2c_cpld_version + elif [ "${EXEC_FUNC}" == "i2c_psu_status" ]; then + _i2c_psu_status + elif [ "${EXEC_FUNC}" == "i2c_front_temp" ]; then + _i2c_front_temp + elif [ "${EXEC_FUNC}" == "i2c_rear_temp" ]; then + _i2c_rear_temp + elif [ "${EXEC_FUNC}" == "i2c_test_all" ]; then + _i2c_init + _i2c_temp_init + _i2c_fan_init + _i2c_io_exp_init + _i2c_led_test + _i2c_psu_eeprom_get + _i2c_mb_eeprom_get + _i2c_board_type_get + _i2c_cpld_version + _i2c_psu_status + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + end_time_str=`date` + end_time_sec=$(date +%s) + diff_time=$[ ${end_time_sec} - ${start_time_sec} ] + echo "Start Time: ${start_time_str} (${start_time_sec})" + echo "End Time : ${end_time_str} (${end_time_sec})" + echo "Total Execution Time: ${diff_time} sec" + + echo "done!!!" +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/qsfp_monitor.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/qsfp_monitor.sh new file mode 100644 index 000000000000..7f50d137bcb7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/qsfp_monitor.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=3 +I2C_UTILS="/usr/sbin/i2c_utils.sh" +QSFP_SI_SCRIPT="/usr/sbin/qsfp_si_cfg.sh" +QSFP_ARRAY=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) + +#QSFP SI monitor +function _qsfp_si_monitor { + local i + local status + for i in {0..53}; + do + status=`${I2C_UTILS} i2c_qsfp_status_get $(expr $i + 1) | egrep '^status=.*$' | sed -e 's/status=//g'` + if [ "${status}" == "1" ]; then + _qsfp_type_check $i + fi + done +} + +#QSFP type +function _qsfp_type_check { + local port=$1 + local qsfp_type=`${I2C_UTILS} i2c_qsfp_type_get $(expr $port + 1)` + local identifier=`echo "$qsfp_type" | grep '^identifier=.*$' | sed -e 's/identifier=//g'` + # identifier 11 for qsfp, 3 for sfp + if [ "${identifier}" == "11" ] || [ "${identifier}" == "3" ]; then + connector=`echo "$qsfp_type" | grep '^connector=.*$' | sed -e 's/connector=//g'` + case ${connector} in + 21|23) + #DAC + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to DAC" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} dac $port >/dev/null + fi + ;; + *) + #AOC + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to AOC" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} aoc $port >/dev/null + fi + ;; + esac + fi +} + +#Docker exist check +function _docker_swss_check { + while true + do + # Check if syncd starts + result=`docker exec -i swss bash -c "echo -en \"SELECT 1\\nHLEN HIDDEN\" | redis-cli | sed -n 2p"` #TBD FIX ME + if [ "$result" == "3" ]; then + return + fi + sleep $INTERVAL + done +} + +#Docker exist check +function _qsfp_si_cfg_script_check { + + if [ -f ${QSFP_SI_SCRIPT} ] && [ -x ${QSFP_SI_SCRIPT} ]; then + echo "SI Script exists. Start monitor." + return + else + echo "SI Script not exist. Exit monitor." + exit + fi +} + +# main function +function _main { + #Check SI Script + _qsfp_si_cfg_script_check + #Check docker swss is running + _docker_swss_check + while true + do + _qsfp_si_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/qsfp_si_cfg.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/qsfp_si_cfg.sh new file mode 100644 index 000000000000..6ded3e522bce --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/qsfp_si_cfg.sh @@ -0,0 +1,331 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +VERSION="1.0.0" +TRUE=200 +FALSE=404 + +TYPE=${1} +PORT=${2} + +# port number +MIN_PORT=0 +MAX_PORT=53 + +# INDEX of value field in array +SI_PRE_IDX=1 +SI_POST_IDX=2 +SI_MAIN_IDX=3 +SI_AMP_IDX=4 +SI_DRI_IDX=5 + +# type string +AOC_TYPE="aoc" +DAC_TYPE="dac" + +# si value for bcm command +SI_VAL="" + +# "PRE POST MAIN AMP DRIVERMODE" for each port in array +# TODO: need to change aoc si value when available +xe_aoc_si_value=( + "0x00 0x3e 0x32 0xf 0x0" #port 0 + "0x00 0x3a 0x36 0xf 0x0" #port 1 + "0x00 0x3a 0x36 0xf 0x0" #port 2 + "0x00 0x38 0x38 0xf 0x0" #port 3 + "0x00 0x37 0x39 0xf 0x0" #port 4 + "0x00 0x2e 0x42 0xf 0x0" #port 5 + "0x00 0x33 0x3d 0xf 0x0" #port 6 + "0x00 0x30 0x40 0xc 0x0" #port 7 + "0x00 0x2f 0x43 0xe 0x0" #port 8 + "0x00 0x2d 0x43 0xc 0x0" #port 9 + "0x00 0x2c 0x44 0xc 0x0" #port 10 + "0x00 0x2d 0x43 0xc 0x0" #port 11 + "0x00 0x29 0x47 0xc 0x0" #port 12 + "0x00 0x28 0x48 0xc 0x0" #port 13 + "0x00 0x29 0x47 0xa 0x0" #port 14 + "0x00 0x29 0x47 0xf 0x0" #port 15 + "0x00 0x18 0x58 0x9 0x0" #port 16 + "0x00 0x1d 0x53 0x9 0x0" #port 17 + "0x00 0x1c 0x54 0x9 0x0" #port 18 + "0x00 0x1c 0x54 0x9 0x0" #port 19 + "0x00 0x1c 0x54 0x9 0x0" #port 20 + "0x00 0x1c 0x54 0x9 0x0" #port 21 + "0x00 0x1c 0x54 0x9 0x0" #port 22 + "0x00 0x1c 0x54 0x9 0x0" #port 23 + "0x00 0x1c 0x54 0x8 0x0" #port 24 + "0x00 0x1c 0x54 0x8 0x0" #port 25 + "0x00 0x18 0x58 0x8 0x0" #port 26 + "0x00 0x18 0x58 0x8 0x0" #port 27 + "0x00 0x14 0x5c 0x8 0x0" #port 28 + "0x00 0x19 0x57 0x8 0x0" #port 29 + "0x00 0x19 0x57 0x8 0x0" #port 30 + "0x00 0x19 0x57 0x8 0x0" #port 31 + "0x00 0x19 0x57 0xc 0x0" #port 32 + "0x00 0x20 0x50 0x9 0x0" #port 33 + "0x00 0x21 0x4f 0xc 0x0" #port 34 + "0x00 0x24 0x4c 0xc 0x0" #port 35 + "0x00 0x24 0x4c 0xc 0x0" #port 36 + "0x00 0x24 0x4c 0xc 0x0" #port 37 + "0x00 0x24 0x4c 0xc 0x0" #port 38 + "0x00 0x24 0x4c 0xc 0x0" #port 39 + "0x00 0x28 0x48 0xd 0x0" #port 40 + "0x00 0x28 0x48 0xc 0x0" #port 41 + "0x00 0x29 0x47 0xe 0x0" #port 42 + "0x00 0x29 0x47 0xe 0x0" #port 43 + "0x00 0x29 0x47 0xe 0x0" #port 44 + "0x00 0x28 0x48 0xf 0x0" #port 45 + "0x00 0x28 0x48 0xf 0x0" #port 46 + "0x00 0x30 0x40 0xf 0x0" #port 47 +) + +# TODO: need to change aoc si value when available +ce_aoc_si_value=( + "0x00 0x28 0x48 0xc 0x0" #port 0 lane 0 + "0x00 0x29 0x41 0xc 0x0" #port 0 lane 1 + "0x00 0x29 0x41 0xf 0x0" #port 0 lane 2 + "0x00 0x29 0x41 0xc 0x0" #port 0 lane 3 + "0x00 0x28 0x42 0xc 0x0" #port 1 lane 0 + "0x00 0x3a 0x36 0xf 0x0" #port 1 lane 1 + "0x00 0x2c 0x44 0xc 0x0" #port 1 lane 2 + "0x00 0x2c 0x44 0xc 0x0" #port 1 lane 3 + "0x00 0x2f 0x41 0xc 0x0" #port 2 lane 0 + "0x00 0x38 0x38 0xc 0x0" #port 2 lane 1 + "0x00 0x2f 0x41 0xc 0x0" #port 2 lane 2 + "0x00 0x30 0x40 0xc 0x0" #port 2 lane 3 + "0x00 0x30 0x40 0xc 0x0" #port 3 lane 0 + "0x00 0x3f 0x31 0xf 0x0" #port 3 lane 1 + "0x00 0x31 0x3f 0xc 0x0" #port 3 lane 2 + "0x00 0x30 0x40 0xa 0x0" #port 3 lane 3 + "0x00 0x30 0x40 0xc 0x0" #port 4 lane 0 + "0x00 0x31 0x3f 0xf 0x0" #port 4 lane 1 + "0x00 0x2f 0x41 0xc 0x0" #port 4 lane 2 + "0x00 0x2e 0x42 0xc 0x0" #port 4 lane 3 + "0x00 0x30 0x40 0xe 0x0" #port 5 lane 0 + "0x00 0x3f 0x31 0xf 0x0" #port 5 lane 1 + "0x00 0x38 0x38 0xf 0x0" #port 5 lane 2 + "0x00 0x3f 0x31 0xf 0x0" #port 5 lane 3 +) + +xe_dac_si_value=( + "0x00 0x3e 0x32 0xf 0x0" #port 0 + "0x00 0x3a 0x36 0xf 0x0" #port 1 + "0x00 0x3a 0x36 0xf 0x0" #port 2 + "0x00 0x38 0x38 0xf 0x0" #port 3 + "0x00 0x37 0x39 0xf 0x0" #port 4 + "0x00 0x2e 0x42 0xf 0x0" #port 5 + "0x00 0x33 0x3d 0xf 0x0" #port 6 + "0x00 0x30 0x40 0xc 0x0" #port 7 + "0x00 0x2f 0x43 0xe 0x0" #port 8 + "0x00 0x2d 0x43 0xc 0x0" #port 9 + "0x00 0x2c 0x44 0xc 0x0" #port 10 + "0x00 0x2d 0x43 0xc 0x0" #port 11 + "0x00 0x29 0x47 0xc 0x0" #port 12 + "0x00 0x28 0x48 0xc 0x0" #port 13 + "0x00 0x29 0x47 0xa 0x0" #port 14 + "0x00 0x29 0x47 0xf 0x0" #port 15 + "0x00 0x18 0x58 0x9 0x0" #port 16 + "0x00 0x1d 0x53 0x9 0x0" #port 17 + "0x00 0x1c 0x54 0x9 0x0" #port 18 + "0x00 0x1c 0x54 0x9 0x0" #port 19 + "0x00 0x1c 0x54 0x9 0x0" #port 20 + "0x00 0x1c 0x54 0x9 0x0" #port 21 + "0x00 0x1c 0x54 0x9 0x0" #port 22 + "0x00 0x1c 0x54 0x9 0x0" #port 23 + "0x00 0x1c 0x54 0x8 0x0" #port 24 + "0x00 0x1c 0x54 0x8 0x0" #port 25 + "0x00 0x18 0x58 0x8 0x0" #port 26 + "0x00 0x18 0x58 0x8 0x0" #port 27 + "0x00 0x14 0x5c 0x8 0x0" #port 28 + "0x00 0x19 0x57 0x8 0x0" #port 29 + "0x00 0x19 0x57 0x8 0x0" #port 30 + "0x00 0x19 0x57 0x8 0x0" #port 31 + "0x00 0x19 0x57 0xc 0x0" #port 32 + "0x00 0x20 0x50 0x9 0x0" #port 33 + "0x00 0x21 0x4f 0xc 0x0" #port 34 + "0x00 0x24 0x4c 0xc 0x0" #port 35 + "0x00 0x24 0x4c 0xc 0x0" #port 36 + "0x00 0x24 0x4c 0xc 0x0" #port 37 + "0x00 0x24 0x4c 0xc 0x0" #port 38 + "0x00 0x24 0x4c 0xc 0x0" #port 39 + "0x00 0x28 0x48 0xd 0x0" #port 40 + "0x00 0x28 0x48 0xc 0x0" #port 41 + "0x00 0x29 0x47 0xe 0x0" #port 42 + "0x00 0x29 0x47 0xe 0x0" #port 43 + "0x00 0x29 0x47 0xe 0x0" #port 44 + "0x00 0x28 0x48 0xf 0x0" #port 45 + "0x00 0x28 0x48 0xf 0x0" #port 46 + "0x00 0x30 0x40 0xf 0x0" #port 47 +) + +ce_dac_si_value=( + "0x00 0x28 0x48 0xc 0x0" #port 0 lane 0 + "0x00 0x29 0x41 0xc 0x0" #port 0 lane 1 + "0x00 0x29 0x41 0xf 0x0" #port 0 lane 2 + "0x00 0x29 0x41 0xc 0x0" #port 0 lane 3 + "0x00 0x28 0x42 0xc 0x0" #port 1 lane 0 + "0x00 0x3a 0x36 0xf 0x0" #port 1 lane 1 + "0x00 0x2c 0x44 0xc 0x0" #port 1 lane 2 + "0x00 0x2c 0x44 0xc 0x0" #port 1 lane 3 + "0x00 0x2f 0x41 0xc 0x0" #port 2 lane 0 + "0x00 0x38 0x38 0xc 0x0" #port 2 lane 1 + "0x00 0x2f 0x41 0xc 0x0" #port 2 lane 2 + "0x00 0x30 0x40 0xc 0x0" #port 2 lane 3 + "0x00 0x30 0x40 0xc 0x0" #port 3 lane 0 + "0x00 0x3f 0x31 0xf 0x0" #port 3 lane 1 + "0x00 0x31 0x3f 0xc 0x0" #port 3 lane 2 + "0x00 0x30 0x40 0xa 0x0" #port 3 lane 3 + "0x00 0x30 0x40 0xc 0x0" #port 4 lane 0 + "0x00 0x31 0x3f 0xf 0x0" #port 4 lane 1 + "0x00 0x2f 0x41 0xc 0x0" #port 4 lane 2 + "0x00 0x2e 0x42 0xc 0x0" #port 4 lane 3 + "0x00 0x30 0x40 0xe 0x0" #port 5 lane 0 + "0x00 0x3f 0x31 0xf 0x0" #port 5 lane 1 + "0x00 0x38 0x38 0xf 0x0" #port 5 lane 2 + "0x00 0x3f 0x31 0xf 0x0" #port 5 lane 3 +) + +#get field value in si value array for xe port +function get_xe_si { + local port=$1 + local field=$2 + local type=$3 + local index=$port + if [ "$type" == "${AOC_TYPE}" ]; then + SI_VAL=$(echo "${xe_aoc_si_value[$index]}" | awk '{print $'$field'}') + else + SI_VAL=$(echo "${xe_dac_si_value[$index]}" | awk '{print $'$field'}') + fi +} + +#get field value in si value array for ce port +function get_ce_si { + local port=$1 + local lane=$2 + local field=$3 + local type=$4 + index=$(( (${port}-1)*4+${lane} )) + if [ "$type" == "${AOC_TYPE}" ]; then + SI_VAL=$(echo "${ce_aoc_si_value[$index]}" | awk '{print $'$field'}') + else + SI_VAL=$(echo "${ce_dac_si_value[$index]}" | awk '{print $'$field'}') + fi +} + +# set si value for xe port +function _qsfp_xe_si_set { + # convert PORT to xe port index + local xe_port=$PORT + # generate command for SI PRE value + get_xe_si $xe_port $SI_PRE_IDX $TYPE + local pre_cmd="phy xe${xe_port} CL93N72_UT_CTL2r CL93N72_TXFIR_PRE=${SI_VAL}" + # generate command for SI POST value + get_xe_si $xe_port $SI_POST_IDX $TYPE + local post_cmd="phy xe${xe_port} CL93N72_UT_CTL2r CL93N72_TXFIR_POST=${SI_VAL}" + # generate command for SI MAIN value + get_xe_si $xe_port $SI_MAIN_IDX $TYPE + local main_cmd="phy xe${xe_port} CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=${SI_VAL}" + # generate command for SI AMP CONTROL value + get_xe_si $xe_port $SI_AMP_IDX $TYPE + local amp_val=$SI_VAL + get_xe_si $xe_port $SI_DRI_IDX $TYPE + local dri_val=$SI_VAL + local amp_cmd="phy xe${xe_port} AMS_TX_CTL2r AMS_TX_AMP_CTL=${amp_val} AMS_TX_DRIVERMODE=${dri_val}" + # apply bcmcmd + bcmcmd "${pre_cmd};${post_cmd};${main_cmd};${amp_cmd}" +} + +# set aoc si value for ce port +function _qsfp_ce_si_set { + # convert PORT to ce port index + local ce_port=$(( $PORT - 48 )) + for lane in {0..3}; + do + # generate command for SI PRE value + get_ce_si $ce_port $lane $SI_PRE_IDX $TYPE + local pre_cmd="phy ce${ce_port} CL93N72_UT_CTL2r.${lane} CL93N72_TXFIR_PRE=${SI_VAL}" + # generate command for SI POST value + get_ce_si $ce_port $lane $SI_POST_IDX $TYPE + local post_cmd="phy ce${ce_port} CL93N72_UT_CTL2r.${lane} CL93N72_TXFIR_POST=${SI_VAL}" + # generate command for SI MAIN value + get_ce_si $ce_port $lane $SI_MAIN_IDX $TYPE + local main_cmd="phy ce${ce_port} CL93N72_UT_CTL3r.${lane} CL93N72_TXFIR_MAIN=${SI_VAL}" + # generate command for SI AMP CONTROL value + get_ce_si $ce_port $lane $SI_AMP_IDX $TYPE + local amp_val=$SI_VAL + get_ce_si $ce_port $lane $SI_AMP_IDX $TYPE + local dri_val=$SI_VAL + local amp_cmd="phy ce${ce_port} AMS_TX_CTL2r.${lane} AMS_TX_AMP_CTL=${amp_val} AMS_TX_DRIVERMODE=${dri_val}" + # apply bcmcmd + bcmcmd "${pre_cmd};${post_cmd};${main_cmd};${amp_cmd}" + done +} + +#QSFP SI value set +function _qsfp_si_set { + if [[ $PORT -le 47 && $PORT -ge 0 ]]; then + # xe port + _qsfp_xe_si_set + else + # ce port + _qsfp_ce_si_set + fi +} + +function _util_input_check { + # input parameter validation + if [[ $1 -lt $2 || $1 -gt $3 ]]; then + echo "Please input number $2~$3" + exit + fi +} + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} ${AOC_TYPE} [${MIN_PORT}-${MAX_PORT}]" + echo " : ${0} ${DAC_TYPE} [${MIN_PORT}-${MAX_PORT}]" + echo "----------------------------------------------------" +} + +#Main Function +function _main { + + # TODO: remove after SI value ready + #exit ${TRUE} + + if [ -z $PORT ]; then + _help + exit ${FALSE} + fi + + if [ "${TYPE}" == "help" ]; then + _help + elif [ "${TYPE}" == "${AOC_TYPE}" ] || [ "${TYPE}" == "${DAC_TYPE}" ]; then + _util_input_check "$PORT" "$MIN_PORT" "$MAX_PORT" + _qsfp_si_set + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/s8900_54xc_monitor.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/s8900_54xc_monitor.sh new file mode 100755 index 000000000000..974da6d5001f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-54xc/utils/s8900_54xc_monitor.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=5 +I2C_UTILS="/usr/sbin/i2c_utils.sh" + + +# LED status monitor +function _led_monitor { + ${I2C_UTILS} i2c_led_fan_status_set >/dev/null + ${I2C_UTILS} i2c_led_psu_status_set >/dev/null + ${I2C_UTILS} i2c_led_fan_tray_status_set >/dev/null +} + +# main function +function _main { + while true + do + _led_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/README.md b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/README.md new file mode 100644 index 000000000000..28f395216e3c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/README.md @@ -0,0 +1,185 @@ +# Ingrasys S8900-64XC Platform Driver for SONiC + +Copyright (C) 2016 Ingrasys, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +## Licensing terms + +The Licensing terms of the files within this project is split 2 parts. +The Linux kernel is released under the GNU General Public License version 2. +All other code is released under the GNU General Public License version 3. +Please see the LICENSE file for copies of both licenses. + +## Contents of this package + + - service/ + > Service config files for platform initialization and monitoring + - utils/ + > Scripts useful during platform bringup and sysfs function + - conf/ + > Platform configure files. + +## Kernel modules and drivers + +The driver for interacting with Ingrasys S8900-64XC is contained in the I2C +kernel module and initialization script. The initialization script loads +the modules in the correct order. It has been built and tested against +the Linux 3.16 kernel. + +The initialization script will modprobe the needed modules, navigate to the +module's device directory in sysfs, and write configuration data to +the kernel module. + +### IGB + +This is OOB Ports on front panel for management plane. + +The IGB module must be loaded first on Ingrasys S8900-64XC platform. + +### I2C i801 + +The I2C i801 on Ingrasys S8900-64XC can be found in +`/sys/bus/i2c/devices/i2c-0/` + +This is I2C bus for Clock Gen, DIMM channel and digital potentiometers. + +The i801 module must be loaded second on Ingrasys S8900-64XC. + +### I2C iSMT + +The I2C iSMT module on S8900-64XC can be found in +`/sys/bus/i2c/devices/i2c-1/` + +This is I2C bus for CPLD, HWM, power controller and I2C Switches. + +The i801 module must be loaded third on Ingrasys S8900-64XC. + +### I2C PCA9548 +The PCA9548 module on S8900-64XC can be found in +`/sys/bus/i2c/devices/i2c-2/` , `/sys/bus/i2c/devices/i2c-3/`, +`/sys/bus/i2c/devices/i2c-4/`, `/sys/bus/i2c/devices/i2c-5/`, +`/sys/bus/i2c/devices/i2c-6/`, `/sys/bus/i2c/devices/i2c-7/`, +`/sys/bus/i2c/devices/i2c-8/`, `/sys/bus/i2c/devices/i2c-9/`. + +The pca9548 module for zQSFP module get/set functions, PSU information, +fan status and EEPROM. + +## Hardware components + +The hardware components are initialized in the init script on S8900-64XC. +The following describes manual initialization as well as interaction. +The examples below are just for Ingrasys S8900-64XC platform. + +### Hardware initialization + +When the sonic-platform-ingrasys-s8900-64xc package is installed on the S8900-64XC, +it is automatically initialized. If you want to manual initialization, the +utility command usage as follows: +``` + i2c_utils.sh i2c_init +``` + +### EEPROM + +The EEPROM is including the board SKU, model name, vendor name, serial number, +and other information can be accessed with the specific eeprom kernel module. +After using `modprobe eeprom_mb` to detect the eeprom, it will show up in sysfs. + +The hexdump utility can be used to decode the raw output of the EEPROM. +For example, +``` + bash# echo "mb_eeprom 0x54" > /sys/bus/i2c/devices/i2c-9/new_device + bash# cat /sys/bus/i2c/drivers/mb_eeprom/9-0054/eeprom | hexdump -C +``` + +### Front panel LEDs + +LEDs can be setup on/off by using i2c utility `/usr/sbin/i2c_utils.sh`. +Utility function command usage as follows: + +``` +Status LED: + i2c_utils.sh i2c_sys_led green|amber on|off + +Fan status LED: + i2c_utils.sh i2c_fan_led green|amber on|off + +PSU1 status LED: + i2c_utils.sh i2c_psu1_led green|amber on|off + +PSU2 status LED: + i2c_utils.sh i2c_psu2_led green|amber on|off + +``` +QSFP Module Port LEDs control by ASIC library. + + +### Fan speed + +Fan speed are controlled by the w83795 kernel module. +It can be found in `/sys/class/hwmon/hwmon1/device/`. +If they were compiled as modules, you will need to modprobe w83795 for +their sysfs entries to show up. Each fan has an `fan_input` file +for reading the fan speed. And `pwm1` setting fan1 to fan4, +`pwm2` setting fan5 to fan8. + +There is docker-platform-monitor container installed fancontrol package that can +automatic control platform fan speed. + + +### Temperature sensors + +Temperature sensors are controlled by the w83795 kernel +module. It can be found in `/sys/class/hwmon/hwmon1/device/`. +If they were compiled as modules, then you will need to modprobe w83795 for +their sysfs entries to show up. +`temp1_input` is front MAC temperature sensor. `temp2_input` is rear MAC +temperature sensor. + +There is docker-platform-monitor container installed lm-sensors package that can +monitor platform temperature. And `sensors` command can show each +temperature sensors status. + +### Power supplies + +Power supplies status and its EEPROM info can be used i2c utility +`/usr/sbin/i2c_utils.sh` to get. +The usage as follows: +``` +PSU EEPROM: + i2c_utils.sh i2c_psu_eeprom_get + hexdump -C psu0.rom + hexdump -C psu1.rom + +PSU Status: + i2c_utils.sh i2c_psu_status +``` + +### QSFPs +QSFP modules are managed by the pca9548 kernel driver. +The i2c utility `/usr/sbin/i2c_utils.sh` can be used to get status and +module EEPROM informations. +The usage as follows: +``` +QSFP EEPROM: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + +QSFP Insert Event: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + 0 => not insert + 1 => inserted +``` + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/Makefile b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/Makefile new file mode 100644 index 000000000000..bf7d4baed71b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/Makefile @@ -0,0 +1,4 @@ +#ccflags-y += -DDEBUG +obj-m := eeprom_mb.o +obj-m+= qsfp_cpld.o +obj-m+= i2c_cpld.o diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/eeprom_mb.c b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/eeprom_mb.c new file mode 100644 index 000000000000..0886cad58eb3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/eeprom_mb.c @@ -0,0 +1,212 @@ +/* + * Copyright (C) 1998, 1999 Frodo Looijaard and + * Philip Edelbrock + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003 IBM Corp. + * Copyright (C) 2004 Jean Delvare + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, + 0x55, 0x56, 0x57, I2C_CLIENT_END }; + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void mb_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, ((u8)addr >> 8) & 0xFF, (u8)addr & 0xFF); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t mb_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + mb_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static struct bin_attribute mb_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = mb_eeprom_read, +}; + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int mb_eeprom_detect(struct i2c_client *client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + + /* EDID EEPROMs are often 24C00 EEPROMs, which answer to all + addresses 0x50-0x57, but we only care about 0x50. So decline + attaching to addresses >= 0x51 on DDC buses */ + if (!(adapter->class & I2C_CLASS_SPD) && client->addr >= 0x51) { + return -ENODEV; + } + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE) + && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + return -ENODEV; + } + + strlcpy(info->type, "eeprom", I2C_NAME_SIZE); + + return 0; +} + +static int mb_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &mb_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int mb_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &mb_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id mb_eeprom_id[] = { + { "mb_eeprom", 0 }, + { } +}; + +static struct i2c_driver mb_eeprom_driver = { + .driver = { + .name = "mb_eeprom", + }, + .probe = mb_eeprom_probe, + .remove = mb_eeprom_remove, + .id_table = mb_eeprom_id, + + .class = I2C_CLASS_DDC | I2C_CLASS_SPD, + .detect = mb_eeprom_detect, + .address_list = normal_i2c, +}; + +module_i2c_driver(mb_eeprom_driver); + +MODULE_AUTHOR("Wade "); +MODULE_DESCRIPTION("Ingrasys S8900 Mother Borad EEPROM driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/i2c_cpld.c b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/i2c_cpld.c new file mode 100644 index 000000000000..626c63177b50 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/i2c_cpld.c @@ -0,0 +1,448 @@ +/* + * S9100-32X I2C CPLD driver + * + * Copyright (C) 2017 Ingrasys, Inc. + * Wade He + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "i2c_cpld.h" + +#ifdef DEBUG + #define DEBUG_PRINT(fmt, args...) \ + printk(KERN_INFO "%s[%d]: " fmt "\r\n", \ + __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define I2C_READ_BYTE_DATA(ret, lock, i2c_client, reg) \ +{ \ + mutex_lock(lock); \ + ret = i2c_smbus_read_byte_data(i2c_client, reg); \ + mutex_unlock(lock); \ +} +#define I2C_WRITE_BYTE_DATA(ret, lock, i2c_client, reg, val) \ +{ \ + mutex_lock(lock); \ + ret = i2c_smbus_write_byte_data(i2c_client, reg, val); \ + mutex_unlock(lock); \ +} + +/* CPLD sysfs attributes index */ +enum i2c_cpld_sysfs_attributes { + CPLD_ACCESS_REG, + CPLD_REGISTER_VAL, + CPLD_PORT_START, + CPLD_PORTS, + CPLD_VERSION, + CPLD_ID, + CPLD_BOARD_TYPE, + CPLD_EXT_BOARD_TYPE, + CPLD_PW_GOOD, + CPLD_PW_ABS, +}; + +/* CPLD sysfs attributes hook functions */ +static ssize_t read_access_register(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_access_register(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_register_value(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_register_value(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_cpld_version(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_board_type(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_ext_board_type(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_pw_good(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_pw_abs(struct device *dev, + struct device_attribute *da, char *buf); + +static LIST_HEAD(cpld_client_list); /* client list for cpld */ +static struct mutex list_lock; /* mutex for client list */ + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +struct cpld_data { + int index; /* CPLD index */ + struct mutex access_lock; /* mutex for cpld access */ + u8 access_reg; /* register to access */ +}; + +/* CPLD device id and data */ +static const struct i2c_device_id i2c_cpld_id[] = { + { "i2c_cpld", i2c_cpld }, + {} +}; + +/* Addresses scanned for i2c_cpld */ +static const unsigned short cpld_i2c_addr[] = { 0x33, I2C_CLIENT_END }; +/* platform sysfs object */ +extern struct kobject *s9230_64x_kobj; + + +/* define all support register access of cpld in attribute */ +static SENSOR_DEVICE_ATTR(cpld_access_register, S_IWUSR | S_IRUGO, + read_access_register, write_access_register, CPLD_ACCESS_REG); +static SENSOR_DEVICE_ATTR(cpld_register_value, S_IWUSR | S_IRUGO, + read_register_value, write_register_value, CPLD_REGISTER_VAL); +static SENSOR_DEVICE_ATTR(cpld_version, S_IRUGO, + read_cpld_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(cpld_board_type, S_IRUGO, + read_board_type, NULL, CPLD_BOARD_TYPE); +static SENSOR_DEVICE_ATTR(cpld_ext_board_type, S_IRUGO, + read_ext_board_type, NULL, CPLD_EXT_BOARD_TYPE); +static SENSOR_DEVICE_ATTR(cpld_pw_good, S_IRUGO, + read_pw_good, NULL, CPLD_PW_GOOD); +static SENSOR_DEVICE_ATTR(cpld_pw_abs, S_IRUGO, + read_pw_abs, NULL, CPLD_PW_ABS); + + +/* define support attributes of cpldx , total 5 */ +/* cpld 1 */ +static struct attribute *i2c_cpld_attributes[] = { + &sensor_dev_attr_cpld_access_register.dev_attr.attr, + &sensor_dev_attr_cpld_register_value.dev_attr.attr, + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_cpld_board_type.dev_attr.attr, + &sensor_dev_attr_cpld_ext_board_type.dev_attr.attr, + &sensor_dev_attr_cpld_pw_good.dev_attr.attr, + &sensor_dev_attr_cpld_pw_abs.dev_attr.attr, + NULL +}; + +/* cpld 1 attributes group */ +static const struct attribute_group i2c_cpld_group = { + .attrs = i2c_cpld_attributes, +}; + +/* read access register from cpld data */ +static ssize_t read_access_register(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg = data->access_reg; + + return sprintf(buf, "0x%x\n", reg); +} + +/* write access register to cpld data */ +static ssize_t write_access_register(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + + if (kstrtou8(buf, 0, ®) < 0) + return -EINVAL; + + data->access_reg = reg; + return count; +} + +/* read the value of access register in cpld data */ +static ssize_t read_register_value(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg = data->access_reg; + int reg_val; + + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + + if (reg_val < 0) + return -1; + + return sprintf(buf, "0x%x\n", reg_val); +} + +/* wrtie the value to access register in cpld data */ +static ssize_t write_register_value(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + int ret = -EIO; + u8 reg = data->access_reg; + u8 reg_val; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, client, reg, reg_val); + + return count; +} + +/* get cpdl version register value */ +static ssize_t read_cpld_version(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_VERSION) { + reg = CPLD_VERSION_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get board type register value */ +static ssize_t read_board_type(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_BOARD_TYPE) { + reg = CPLD_BOARD_TYPE_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get extend board type register value */ +static ssize_t read_ext_board_type(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_EXT_BOARD_TYPE) { + reg = CPLD_EXT_BOARD_TYPE_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get extend board type register value */ +static ssize_t read_pw_good(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_PW_GOOD) { + reg = CPLD_PW_GOOD_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get extend board type register value */ +static ssize_t read_pw_abs(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_PW_ABS) { + reg = CPLD_PW_ABS_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* add valid cpld client to list */ +static void i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = NULL; + + node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + if (!node) { + dev_info(&client->dev, + "Can't allocate cpld_client_node for index %d\n", + client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +/* remove exist cpld client in list */ +static void i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + list_for_each(list_node, &cpld_client_list) { + cpld_node = list_entry(list_node, + struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + mutex_unlock(&list_lock); +} + +/* cpld drvier probe */ +static int i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct cpld_data *data = NULL; + + data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + /* init cpld data for client */ + i2c_set_clientdata(client, data); + mutex_init(&data->access_lock); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_info(&client->dev, + "i2c_check_functionality failed (0x%x)\n", + client->addr); + status = -EIO; + goto exit; + } + + + status = sysfs_create_group(&client->dev.kobj,&i2c_cpld_group); + + if (status) + goto exit; + + dev_info(&client->dev, "chip found\n"); + + /* add probe chip to client list */ + i2c_cpld_add_client(client); + + return 0; +exit: + sysfs_remove_group(&client->dev.kobj, &i2c_cpld_group); + return status; +} + +/* cpld drvier remove */ +static int i2c_cpld_remove(struct i2c_client *client) +{ + + sysfs_remove_group(&client->dev.kobj, &i2c_cpld_group); + + i2c_cpld_remove_client(client); + return 0; +} + +MODULE_DEVICE_TABLE(i2c, i2c_cpld_id); + +static struct i2c_driver i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "i2c_cpld", + }, + .probe = i2c_cpld_probe, + .remove = i2c_cpld_remove, + .id_table = i2c_cpld_id, + .address_list = cpld_i2c_addr, +}; + +static int __init i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&i2c_cpld_driver); +} + +static void __exit i2c_cpld_exit(void) +{ + i2c_del_driver(&i2c_cpld_driver); +} + +MODULE_AUTHOR("Wade He "); +MODULE_DESCRIPTION("Ingrasys S9100-32X Platform i2c cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(i2c_cpld_init); +module_exit(i2c_cpld_exit); + + + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/i2c_cpld.h b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/i2c_cpld.h new file mode 100644 index 000000000000..e103b05c717a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/i2c_cpld.h @@ -0,0 +1,197 @@ +/* + * + * S9100-32X I2C CPLD driver header file + * + * Copyright (C) 2017 Ingrasys, Inc. + * Wade He + * + * 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, see . + */ + +#ifndef I2C_CPLD_H +#define I2C_CPLD_H + +// remove debug before release +#define DEBUG + +/* CPLD device index value */ +enum cpld_id { + i2c_cpld +}; + +/* port number on CPLD */ +#define CPLD_1_PORT_NUM 12 +#define CPLD_2_PORT_NUM 13 + +/* QSFP port number */ +#define QSFP_MAX_PORT_NUM 64 +#define QSFP_MIN_PORT_NUM 1 + +/* SFP+ port number */ +#define SFP_MAX_PORT_NUM 2 +#define SFP_MIN_PORT_NUM 1 + + +/* CPLD registers */ +#define CPLD_BOARD_TYPE_REG 0x0 +#define CPLD_EXT_BOARD_TYPE_REG 0x7 +#define CPLD_VERSION_REG 0x1 +#define CPLD_PW_GOOD_REG 0x2 +#define CPLD_PW_ABS_REG 0x3 + + +/* bit definition for register value */ + +enum CPLD_RESET_CONTROL_BITS { + CPLD_RESET_CONTROL_SWRST_BIT, + CPLD_RESET_CONTROL_CP2104RST_BIT, + CPLD_RESET_CONTROL_82P33814RST_BIT, + CPLD_RESET_CONTROL_BMCRST_BIT, +}; + +/* bit field structure for register value */ +struct cpld_reg_board_type_t { + u8 build_rev:2; + u8 hw_rev:2; + u8 board_id:4; +}; + +struct cpld_reg_version_t { + u8 revision:6; + u8 release:1; + u8 reserve:1; +}; + +struct cpld_reg_pw_good_t { + u8 reserve1:3; + u8 psu1:1; + u8 psu2:1; + u8 reserve2:3; +}; + +struct cpld_reg_pw_abs_t { + u8 psu1:1; + u8 psu2:1; + u8 reserve:6; +}; + +/* common manipulation */ +#define INVALID(i, min, max) ((i < min) || (i > max) ? 1u : 0u) +#define READ_BIT(val, bit) ((0u == (val & (1<bf_name) +#define READ_BF_1(bf_struct, val, bf_name, bf_value) \ + bf_struct bf; \ + bf.data = val; \ + bf_value = bf.bf_name +#define BOARD_TYPE_BUILD_REV_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, build_rev, res) +#define BOARD_TYPE_HW_REV_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, hw_rev, res) +#define BOARD_TYPE_BOARD_ID_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, board_id, res) +#define CPLD_VERSION_REV_GET(val, res) \ + READ_BF(cpld_reg_version_t, val, revision, res) +#define CPLD_VERSION_REL_GET(val, res) \ + READ_BF(cpld_reg_version_t, val, release, res) +#define CPLD_PSU1_PW_GOOD_GET(val, res) \ + READ_BF(cpld_reg_pw_good_t, val, psu1, res) +#define CPLD_PSU2_PW_GOOD_GET(val, res) \ + READ_BF(cpld_reg_pw_good_t, val, psu2, res) +#define CPLD_PSU1_PW_ABS_GET(val, res) \ + READ_BF(cpld_reg_pw_abs_t, val, psu1, res) +#define CPLD_PSU2_PW_ABS_GET(val, res) \ + READ_BF(cpld_reg_pw_abs_t, val, psu2, res) +/* QSFP/SFP registers manipulation */ +#define QSFP_TO_CPLD_IDX(qsfp_port, cpld_index, cpld_port) \ +{ \ + if (QSFP_MIN_PORT_NUM <= qsfp_port && qsfp_port <= CPLD_1_PORT_NUM) { \ + cpld_index = cpld1; \ + cpld_port = qsfp_port - 1; \ + } else if (CPLD_1_PORT_NUM < qsfp_port \ + && qsfp_port <= QSFP_MAX_PORT_NUM) { \ + cpld_index = cpld2 + (qsfp_port - 1 - CPLD_1_PORT_NUM) \ + / CPLD_2_PORT_NUM; \ + cpld_port = (qsfp_port - 1 - CPLD_1_PORT_NUM) % \ + CPLD_2_PORT_NUM; \ + } else { \ + cpld_index = 0; \ + cpld_port = 0; \ + } \ +} +#define SFP_TO_CPLD_IDX(sfp_port, cpld_index) \ + (cpld_index = sfp_port - SFP_MIN_PORT_NUM) +#define QSFP_PORT_STATUS_REG(cpld_port) \ + (CPLD_QSFP_PORT_STATUS_BASE_REG + cpld_port) +#define QSFP_PORT_CONFIG_REG(cpld_port) \ + (CPLD_QSFP_PORT_CONFIG_BASE_REG + cpld_port) +#define QSFP_PORT_INT_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_QSFP_PORT_STATUS_INT_BIT) +#define QSFP_PORT_ABS_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_QSFP_PORT_STATUS_ABS_BIT) +#define QSFP_PORT_RESET_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_LPMODE_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define QSFP_PORT_RESET_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_RESET_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_LPMODE_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define QSFP_PORT_LPMODE_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define SFP_PORT_PRESENT_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_STATUS_PRESENT_BIT) + + #define SFP_PORT_TXFAULT_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_STATUS_TXFAULT_BIT) + #define SFP_PORT_RXLOS_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_STATUS_RXLOS_BIT) + #define SFP_PORT_TXDIS_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_CONFIG_TXDIS_BIT) +#define SFP_PORT_RS_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_RS_BIT) +#define SFP_PORT_TS_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TS_BIT) +#define SFP_PORT_TXDIS_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TXDIS_BIT) +#define SFP_PORT_TXDIS_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TXDIS_BIT) +#define SFP_PORT_RS_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_RS_BIT) +#define SFP_PORT_RS_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_RS_BIT) +#define SFP_PORT_TS_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TS_BIT) +#define SFP_PORT_TS_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TS_BIT) + +/* CPLD access functions */ +extern int i2c_cpld_get_qsfp_port_status_val(u8 port_num); +extern int i2c_cpld_get_qsfp_port_config_val(u8 port_num); +extern int i2c_cpld_set_qsfp_port_config_val(u8 port_num, u8 reg_val); +extern int i2c_cpld_get_sfp_port_status_val(u8 port_num); +extern int i2c_cpld_get_sfp_port_config_val(u8 port_num); +extern int i2c_cpld_set_sfp_port_config_val(u8 port_num, u8 reg_val); +extern u8 fp_port_to_phy_port(u8 fp_port); +#endif + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/qsfp_cpld.c b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/qsfp_cpld.c new file mode 100644 index 000000000000..8ec03ecea340 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/modules/qsfp_cpld.c @@ -0,0 +1,1771 @@ +/* + * S8900-64XC QSFP CPLD driver + * + * Copyright (C) 2017 Ingrasys, 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef DEBUG + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s[%d]: " fmt "\r\n", \ + __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define ERROR_MSG(fmt, args...) \ + printk(KERN_ERR "%s[%d]: " fmt "\r\n", \ + __FUNCTION__, __LINE__, ##args) + + + + +#define SFF_8436_MMAP_SIZE (256) +#define EEPROM_SIZE (5 * 128) /* 640 byte eeprom */ +#define EEPROM_PAGE_SIZE (128) +#define EEPROM_DEFAULT_PAGE (0) +#define I2C_RW_RETRY_COUNT (3) +#define I2C_RW_RETRY_INTERVAL (100) /* ms */ +#define USE_I2C_BLOCK_READ (1) + +#define SFP_EEPROM_A0_I2C_ADDR (0xA0 >> 1) + +#define SFF_8436_PAGE_PROV_ADDR (0xC3) /* Memory Page 01/02 Provided */ +#define SFF_8436_PAGE_01_PRESENT (1 << 6) /* Memory Page 01 present */ +#define SFF_8436_PAGE_02_PRESENT (1 << 7) /* Memory Page 02 present */ +#define SFF_8436_PAGE_SELECT_ADDR (0x7F) +#define SFF_8436_STATUS_ADDR (0x02) +#define SFF_8436_STATUS_PAGE_03_PRESENT_L (1 << 2) /* Flat Memory:0-Paging, 1-Page 0 only */ + +#define S8900_64XC_MUX_BASE_NR 1 +#define S8900_64XC_SFP_EEPROM_BASE_NR 2 +#define CPLD_DEVICE_NUM 3 +#define SFP_CPLD_DEVICE_NUM 2 +#define QSFP_EEPROM_DEVICE_NUM 3 +#define TOTAL_PORT_NUM 64 +#define CPLD_MUX_OFFSET 24 +#define SFP_EEPROM_DEV_NUM 3 +#define SFP_EEPROM_NAME_LEN 16 +/* CPLD registers */ +#define CPLD_REG_REV 0x01 +#define CPLD_REG_ID 0x02 +#define CPLD_MUX_REG 0x4a + +/* QSFP signal bit in register */ +#define BIT_RST 0 +#define BIT_LPM 2 +#define BIT_INT 0 +#define BIT_ABS 1 +#define BIT_ABS_2 5 + +static ssize_t sfp_eeprom_read(struct i2c_client *, loff_t, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, loff_t, const char *,int); + + +enum port_numbers { + sfp1, sfp2, sfp3, sfp4, sfp5, sfp6, sfp7, sfp8, + sfp9, sfp10, sfp11, sfp12, sfp13, sfp14, sfp15, sfp16, + sfp17, sfp18, sfp19, sfp20, sfp21, sfp22, sfp23, sfp24, + sfp25, sfp26, sfp27, sfp28, sfp29, sfp30, sfp31, sfp32, + sfp33, sfp34, sfp35, sfp36, sfp37, sfp38, sfp39, sfp40, + sfp41, sfp42, sfp43, sfp44, sfp45, sfp46, sfp47, sfp48, + qsfp49, qsfp50, qsfp51, qsfp52, qsfp53, qsfp54, qsfp55, qsfp56, + qsfp57, qsfp58, qsfp59, qsfp60, qsfp61, qsfp62, qsfp63, qsfp64 +}; + +static const struct platform_device_id qsfp_device_id[] = { + {"sfp1", sfp1}, {"sfp2", sfp2}, {"sfp3", sfp3}, {"sfp4", sfp4}, + {"sfp5", sfp5}, {"sfp6", sfp6}, {"sfp7", sfp7}, {"sfp8", sfp8}, + {"sfp9", sfp9}, {"sfp10", sfp10}, {"sfp11", sfp11}, {"sfp12", sfp12}, + {"sfp13", sfp13}, {"sfp14", sfp14}, {"sfp15", sfp15}, {"sfp16", sfp16}, + {"sfp17", sfp17}, {"sfp18", sfp18}, {"sfp19", sfp19}, {"sfp20", sfp20}, + {"sfp21", sfp21}, {"sfp22", sfp22}, {"sfp23", sfp23}, {"sfp24", sfp24}, + {"sfp25", sfp25}, {"sfp26", sfp26}, {"sfp27", sfp27}, {"sfp28", sfp28}, + {"sfp29", sfp29}, {"sfp30", sfp30}, {"sfp31", sfp31}, {"sfp32", sfp32}, + {"sfp33", sfp33}, {"sfp34", sfp34}, {"sfp35", sfp35}, {"sfp36", sfp36}, + {"sfp37", sfp37}, {"sfp38", sfp38}, {"sfp39", sfp39}, {"sfp40", sfp40}, + {"sfp41", sfp41}, {"sfp42", sfp42}, {"sfp43", sfp43}, {"sfp44", sfp44}, + {"sfp45", sfp45}, {"sfp46", sfp46}, {"sfp47", sfp47}, {"sfp48", sfp48}, + {"qsfp49", qsfp49}, {"qsfp50", qsfp50}, {"qsfp51", qsfp51}, {"qsfp52", qsfp52}, + {"qsfp53", qsfp53}, {"qsfp54", qsfp54}, {"qsfp55", qsfp55}, {"qsfp56", qsfp56}, + {"qsfp57", qsfp57}, {"qsfp58", qsfp58}, {"qsfp59", qsfp59}, {"qsfp60", qsfp60}, + {"qsfp61", qsfp61}, {"qsfp62", qsfp62}, {"qsfp63", qsfp63}, {"qsfp64", qsfp64}, + {} +}; +MODULE_DEVICE_TABLE(platform, qsfp_device_id); + +/* + * list of valid port types + * note OOM_PORT_TYPE_NOT_PRESENT to indicate no + * module is present in this port + */ +typedef enum oom_driver_port_type_e { + OOM_DRIVER_PORT_TYPE_INVALID, + OOM_DRIVER_PORT_TYPE_NOT_PRESENT, + OOM_DRIVER_PORT_TYPE_SFP, + OOM_DRIVER_PORT_TYPE_SFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP, + OOM_DRIVER_PORT_TYPE_QSFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP28 +} oom_driver_port_type_t; + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_SFP_DDM, + DRIVER_TYPE_QSFP +}; + +typedef enum eeprom_operation_e { + EEPROM_READ, + EEPROM_WRITE +} eeprom_operation_t; + +/* + * Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss + */ + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + oom_driver_port_type_t port_type; + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + + struct qsfp_data *qsfp; + + struct i2c_client *client; +}; + +enum sfp_sysfs_attributes { + PRESENT, + PRESENT_ALL, + PORT_NUMBER, + PORT_TYPE, + DDM_IMPLEMENTED, + TX_FAULT, + TX_FAULT1, + TX_FAULT2, + TX_FAULT3, + TX_FAULT4, + TX_DISABLE, + TX_DISABLE1, + TX_DISABLE2, + TX_DISABLE3, + TX_DISABLE4, + TX_DISABLE_ALL, + RX_LOS, + RX_LOS1, + RX_LOS2, + RX_LOS3, + RX_LOS4, + RX_LOS_ALL, +}; + +static void device_release(struct device *dev) +{ + return; +} + +/* + * S8900-64XC CPLD register addresses + */ +static const int int_abs_reg[CPLD_DEVICE_NUM][2]= { + {0x20, 0x31}, + {0x20, 0x31}, + {0x20, 0x2F}, +}; + +static const int rst_lp_reg[CPLD_DEVICE_NUM][2]= { + {0xFF, 0xFF}, /*dummy*/ + {0xFF, 0xFF}, /*dummy*/ + {0x30, 0x3F}, +}; + +/* + * S8900-64XC CPLD + */ + +enum cpld_type { + cpld_1, + cpld_2, + cpld_3, +}; + +enum qsfp_signal { + sig_int, + sig_abs, + sig_rst, + sig_lpm +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +struct sfp_platform_data { + int reg_addr; + int parent; + int cpld_reg; + struct i2c_client *client; +}; + +static struct cpld_platform_data s8900_64xc_cpld_platform_data[] = { + [cpld_1] = { + .reg_addr = 0x33, + }, + + [cpld_2] = { + .reg_addr = 0x33, + }, + + [cpld_3] = { + .reg_addr = 0x33, + } +}; + +static struct sfp_platform_data s8900_64xc_sfp_platform_data[] = { + [sfp1] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x01, + }, + + [sfp2] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x02, + }, + + [sfp3] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x03, + }, + [sfp4] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x04, + }, + + [sfp5] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x05, + }, + + [sfp6] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x06, + }, + [sfp7] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x07, + }, + + [sfp8] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x08, + }, + + [sfp9] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x09, + }, + [sfp10] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x0A, + }, + + [sfp11] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x0B, + }, + + [sfp12] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x0C, + }, + [sfp13] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x0D, + }, + + [sfp14] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x0E, + }, + + [sfp15] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x0F, + }, + [sfp16] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x10, + }, + + [sfp17] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x11, + }, + + [sfp18] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x12, + }, + [sfp19] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x13, + }, + + [sfp20] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x14, + }, + + [sfp21] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x15, + }, + [sfp22] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x16, + }, + + [sfp23] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x17, + }, + + [sfp24] = { + .reg_addr = 0x50, + .parent = 2, + .cpld_reg = 0x18, + }, + [sfp25] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x01, + }, + + [sfp26] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x02, + }, + [sfp27] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x03, + }, + + [sfp28] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x04, + }, + + [sfp29] = { + .reg_addr = 0x50, + + .parent = 3, + .cpld_reg = 0x05, + }, + [sfp30] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x06, + }, + [sfp31] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x07, + }, + [sfp32] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x08, + }, + [sfp33] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x09, + }, + [sfp34] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x0A, + }, + [sfp35] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x0B, + }, + [sfp36] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x0C, + }, + [sfp37] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x0D, + }, + [sfp38] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x0E, + }, + [sfp39] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x0F, + }, + [sfp40] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x10, + }, + [sfp41] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x11, + }, + [sfp42] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x12, + }, + [sfp43] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x13, + }, + [sfp44] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x14, + }, + [sfp45] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x15, + }, + [sfp46] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x16, + }, + [sfp47] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x17, + }, + [sfp48] = { + .reg_addr = 0x50, + .parent = 3, + .cpld_reg = 0x18, + }, + [qsfp49] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x01, + }, + [qsfp50] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x02, + }, + [qsfp51] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x03, + }, + [qsfp52] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x04, + }, + [qsfp53] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x05, + }, + [qsfp54] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x06, + }, + [qsfp55] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x07, + }, + [qsfp56] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x08, + }, + [qsfp57] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x09, + }, + [qsfp58] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x0A, + }, + [qsfp59] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x0B, + }, + [qsfp60] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x0C, + }, + [qsfp61] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x0D, + }, + [qsfp62] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x0E, + }, + [qsfp63] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x0F, + }, + [qsfp64] = { + .reg_addr = 0x50, + .parent = 4, + .cpld_reg = 0x10, + } +}; + +static struct platform_device s8900_64xc_cpld = { + .name = "ingrasys-s8900-64xc-cpld", + .id = 0, + .dev = { + .platform_data = s8900_64xc_cpld_platform_data, + .release = device_release + }, +}; + +static struct platform_device s8900_64xc_sfp = { + .name = "ingrasys-s8900-64xc-sfp", + .id = 0, + .dev = { + .platform_data = s8900_64xc_sfp_platform_data, + .release = device_release + }, +}; + +/* + * S8900-64XC I2C DEVICES + */ + +struct i2c_device_platform_data { + int parent; + struct i2c_board_info info; + struct i2c_client *client; +}; + +/* module_platform_driver */ +static ssize_t +get_prs_cpld_reg(struct device *dev, + struct device_attribute *devattr, + char *buf, int signal) +{ + int ret; + u64 data = 0; + u64 shift = 0; + int i = 0; + int j = 0; + int port = 0; + int bit = 0; + int bit_mask = 0; + int bit_mask_2 = 0; + int (*reg)[CPLD_DEVICE_NUM][2]; + struct cpld_platform_data *pdata = NULL; + + pdata = dev->platform_data; + + switch(signal) { + case sig_int: + bit = BIT_INT; + reg = (typeof(reg)) &int_abs_reg; + break; + case sig_abs: + bit = BIT_ABS; + reg = (typeof(reg)) &int_abs_reg; + break; + default: + return sprintf(buf, "signal/na"); + } + bit_mask = 0x1 << bit; + bit_mask_2 = 0x1 << BIT_ABS_2; + + for (i=0; i= 0x2a && j <= 0x2f && i < SFP_CPLD_DEVICE_NUM) { + continue; + } + ret = i2c_smbus_read_byte_data(pdata[i].client, j); + if (ret < 0) { + return sprintf((char *)buf, "i2c_smbus_read_byte_data/na"); + } + shift = ((u64) ((ret & bit_mask) >> bit)) << port; + data |= shift; + DEBUG_PRINT("port=%d, shift=0x%016llx, ret=%x, bit_mask=%08x, bit=%08x, data=0x%016llx\n", port, shift, ret, bit_mask, bit, data); + /* CPLD2 and CPLD3 have BIT 1 and BIT 5 for present */ + if (i < SFP_CPLD_DEVICE_NUM) { + port++; + shift = ((u64) ((ret & bit_mask_2) >> BIT_ABS_2)) << port; + data |= shift; + DEBUG_PRINT("port=%d, shift=0x%016llx, ret=%x, bit_mask_2=0x%x, bit=%x, data=0x%016llx\n", port, shift, ret, bit_mask_2, bit, data); + } + + port++; + } + } + + return sprintf((char *)buf, "0x%016llx\n", data); +} + +/* module_platform_driver */ +static ssize_t +get_rst_lp_cpld_reg(struct device *dev, + struct device_attribute *devattr, + char *buf, int signal) +{ + int ret; + u64 data = 0; + u64 shift = 0; + int i = 0; + int j = 0; + int port = 0; + int bit = 0; + int bit_mask = 0; + int (*reg)[CPLD_DEVICE_NUM][2]; + struct cpld_platform_data *pdata = NULL; + + pdata = dev->platform_data; + + switch(signal) { + case sig_rst: + bit = BIT_RST; + reg = (typeof(reg)) &rst_lp_reg; + break; + case sig_lpm: + bit = BIT_LPM; + reg = (typeof(reg)) &rst_lp_reg; + break; + default: + return sprintf(buf, "na"); + } + bit_mask = 0x1 << bit; + + for (i=2; i> bit)) << port; + data |= shift; + port++; + } + } + + return sprintf(buf, "0x%04llx\n", data); +} + +static ssize_t +set_rst_lp_cpld_reg(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count, int signal) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + u8 current_reg_val = 0; + u8 new_reg_val = 0; + int value; + int i = 0; + int j = 0; + int port = 0; + int ret = 0; + int bit = 0; + int (*reg)[CPLD_DEVICE_NUM][2]; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + switch(signal) { + case sig_rst: + bit = BIT_RST; + reg = (typeof(reg)) &rst_lp_reg; + break; + case sig_lpm: + bit = BIT_LPM; + reg = (typeof(reg)) &rst_lp_reg; + break; + default: + return sprintf((char *)buf, "signal/na"); + } + + for (i=2; i> port) & 0x1; + + //set value on bit N of new_reg_val + if (value > 0) { + new_reg_val = current_reg_val | (u8) (0x1 << bit); + } else { + new_reg_val = current_reg_val & (u8) ~(0x1 << bit); + } + //write reg value if changed + if (current_reg_val != new_reg_val) { + ret = i2c_smbus_write_byte_data(pdata[i].client, j, + (u8)(new_reg_val)); + if (ret < 0){ + return ret; + } + } + port++; + } + } + + return count; +} + +static ssize_t +get_lpmode(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + return get_rst_lp_cpld_reg(dev, devattr, buf, sig_lpm); +} + +static ssize_t +set_lpmode(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + return set_rst_lp_cpld_reg(dev, devattr, buf, count, sig_lpm); +} + +static ssize_t +get_reset(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + return get_rst_lp_cpld_reg(dev, devattr, buf, sig_rst); +} + +static ssize_t +set_reset(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + return set_rst_lp_cpld_reg(dev, devattr, buf, count, sig_rst); +} + +static ssize_t +get_modprs(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + return get_prs_cpld_reg(dev, devattr, buf, sig_abs); +} + +static DEVICE_ATTR(qsfp_modprs, S_IRUGO, get_modprs, NULL); +static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR, get_lpmode, set_lpmode); +static DEVICE_ATTR(qsfp_reset, S_IRUGO | S_IWUSR, get_reset, set_reset); + +static struct attribute *s8900_64xc_cpld_attrs[] = { + &dev_attr_qsfp_lpmode.attr, + &dev_attr_qsfp_reset.attr, + &dev_attr_qsfp_modprs.attr, + NULL, +}; + +static struct attribute_group s8900_64xc_cpld_attr_grp = { + .attrs = s8900_64xc_cpld_attrs, +}; + +/* + * Assumes that sanity checks for offset happened at sysfs-layer. + * Offset within Lower Page 00h and Upper Page 00h are not recomputed + */ +static uint8_t +sff_8436_translate_offset(loff_t *offset) +{ + unsigned page = 0; + + if (*offset < SFF_8436_MMAP_SIZE) { + return 0; + } + + page = (*offset >> 7)-1; + + if (page > 0 ) { + *offset = 0x80 + (*offset & 0x7f); + } else { + *offset &= 0xff; + } + + return page; +} + +static ssize_t +eeprom_read(struct i2c_client *client, + u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_read_i2c_block_data(client, command, + data_len, (u8 *)data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + goto abort; + } + + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + +abort: + return result; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_read_byte_data(client, command); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, " \\ + "command(0x%2x), data(0x%2x)\r\n", + command, result); + goto abort; + } + + *data = (u8)result; + result = 1; + +abort: + return result; +#endif +} + +static ssize_t +eeprom_write(struct i2c_client *client, + u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return data_len; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_write_byte_data(client, command, *data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return 1; +#endif +} + +static ssize_t +sfp_eeprom_read_write(struct i2c_client *client, + eeprom_operation_t op, + loff_t off, + const char *data, + int data_len) +{ + u8 page, phy_page; + u8 val, refresh_page = 0; + int ret; + ssize_t retval = 0; + size_t pending_len = 0, page_len = 0; + loff_t page_offset = 0, page_start_offset = 0; + loff_t phy_offset; + + + if (off > EEPROM_SIZE) { + return 0; + } + + if (off + data_len > EEPROM_SIZE) { + data_len = EEPROM_SIZE - off; + } + + /* + * Refresh pages which covers the requested data + * from offset to off + len + * Only refresh pages which contain requested bytes + * + */ + + pending_len = data_len; + + for (page = off >> 7; page <= (off + data_len - 1) >> 7; page++) { + refresh_page = 0; + switch (page) { + case 0: + /* Lower page 00h */ + refresh_page = 1; + break; + case 1: + /* Upper page 00h */ + refresh_page = 1; + break; + case 2: + /* Upper page 01h */ + ret = eeprom_read(client, SFF_8436_PAGE_PROV_ADDR, &val, sizeof(val)); + if (ret < 0) { + DEBUG_PRINT("Can't read EEPROM offset %d.\n", + SFF_8436_PAGE_PROV_ADDR); + goto error; + } + if (val & SFF_8436_PAGE_01_PRESENT) { + DEBUG_PRINT("Offset:%d Value:(0x%02x & 0x%02x)", + SFF_8436_PAGE_PROV_ADDR, val, + SFF_8436_PAGE_01_PRESENT); + refresh_page = 1; + } + break; + case 3: + /* Upper page 02h */ + ret = eeprom_read(client, SFF_8436_PAGE_PROV_ADDR, &val, sizeof(val)); + if (ret < 0) { + ERROR_MSG("Can't read EEPROM offset %d.\n", + SFF_8436_PAGE_PROV_ADDR); + goto error; + } + if (val & SFF_8436_PAGE_02_PRESENT) { + DEBUG_PRINT("Offset:%d Value:(0x%02x & 0x%02x)", + SFF_8436_PAGE_PROV_ADDR, val, + SFF_8436_PAGE_02_PRESENT); + refresh_page = 1; + } + break; + case 4: + /* Upper page 03h */ + ret = eeprom_read(client, SFF_8436_STATUS_ADDR, &val, sizeof(val)); + if (ret < 0) { + ERROR_MSG("Can't read EEPROM offset %d.\n", + SFF_8436_STATUS_ADDR); + goto error; + } + if (!(val & SFF_8436_STATUS_PAGE_03_PRESENT_L)) { + DEBUG_PRINT("Offset:%d Value:(0x%02x & 0x%02x)", + SFF_8436_STATUS_ADDR, val, + SFF_8436_STATUS_PAGE_03_PRESENT_L); + refresh_page = 1; + } + break; + default: + DEBUG_PRINT("Invalid Page %d\n", page); + ret = retval; + goto error; + break; + } + + if (!refresh_page) { + /* if page is not valid or already refreshed */ + continue; + } + + /* + * Compute the offset and number of bytes to be read/write + * w.r.t requested page + * + * 1. start at offset 0 (within the page), and read/write the entire page + * 2. start at offset 0 (within the page) and read/write less than entire page + * 3. start at an offset not equal to 0 and read/write the rest of the page + * 4. start at an offset not equal to 0 and read/write less than (end of page - offset) + * + */ + page_start_offset = page * EEPROM_PAGE_SIZE; + + if (page_start_offset < off) { + page_offset = off; + if (off + pending_len < page_start_offset + EEPROM_PAGE_SIZE) { + page_len = pending_len; + } else { + page_len = EEPROM_PAGE_SIZE - off; + } + } else { + page_offset = page_start_offset; + if (pending_len > EEPROM_PAGE_SIZE) { + page_len = EEPROM_PAGE_SIZE; + } else { + page_len = pending_len; + } + } + + pending_len = pending_len - page_len; + + /* Change current EEPROM page */ + phy_offset = page_offset; + phy_page = sff_8436_translate_offset(&phy_offset); + if (phy_page > 0) { + ret = eeprom_write(client, SFF_8436_PAGE_SELECT_ADDR, + &phy_page, sizeof(phy_page)); + if (ret < 0) { + ERROR_MSG("Can't write EEPROM offset %d.\n", + SFF_8436_PAGE_SELECT_ADDR); + goto error; + } + } + + /* + * If page_len > 32, I2C client continue read or write EEPROM. + */ + while (page_len) { + if (op == EEPROM_READ) { + ret = eeprom_read(client, phy_offset, data, page_len); + } else if (op == EEPROM_WRITE) { + ret = eeprom_write(client, phy_offset, data, page_len); + } else { + ERROR_MSG("Bad EEPROM operation %d.\n", op); + break; + } + + if (ret <= 0) { + if (retval == 0) { + retval = ret; + } + break; + } + phy_offset += ret; + off += ret; + data += ret; + page_len -= ret; + retval += ret; + } + + /* Restore EEPROM page to default */ + if (phy_page > 0) { + phy_page = EEPROM_DEFAULT_PAGE; + ret = eeprom_write(client, SFF_8436_PAGE_SELECT_ADDR, + &phy_page, sizeof(phy_page)); + if (ret < 0) { + ERROR_MSG("Can't write EEPROM offset %d.\n", + SFF_8436_PAGE_SELECT_ADDR); + goto error; + } + } + } + + return retval; + +error: + return ret; +} + + +static inline ssize_t +sfp_eeprom_read(struct i2c_client *client, + loff_t off, u8 *data, + int data_len) +{ + return sfp_eeprom_read_write(client, EEPROM_READ, + off, data, data_len); +} + + +static inline ssize_t +sfp_eeprom_write(struct i2c_client *client, + loff_t off, const char *data, + int data_len) +{ + return sfp_eeprom_read_write(client, EEPROM_WRITE, + off, data, data_len); +} + +static struct i2c_client * +cpld_sfp_port_client(int port, + int *data_reg) +{ + *data_reg = s8900_64xc_sfp_platform_data[port].cpld_reg; + if (port >= sfp1 && port <= sfp24) { + return s8900_64xc_cpld_platform_data[cpld_1].client; + } else if (port >= sfp25 && port <= sfp48) { + return s8900_64xc_cpld_platform_data[cpld_2].client; + } else if (port >= qsfp49 && port <= qsfp64) { + return s8900_64xc_cpld_platform_data[cpld_3].client; + } else { + ERROR_MSG("Unknown port: %d", port); + return NULL; + } +} + +static ssize_t +sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, + size_t count, int port) +{ + ssize_t retval = 0; + int data_reg = 0; + struct i2c_client *cpld_client = NULL; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + //CPLD MUX select + cpld_client = cpld_sfp_port_client(port, &data_reg); + DEBUG_PRINT("data_reg=%d, port=%d", data_reg, port); + if (!cpld_client) { + ERROR_MSG("Error i2c client for port %d", port); + return 0; + } + i2c_smbus_write_byte_data(cpld_client, CPLD_MUX_REG ,data_reg); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + //CPLD MUX deselect + i2c_smbus_write_byte_data(cpld_client, CPLD_MUX_REG ,0x0); + + mutex_unlock(&data->update_lock); + return retval; +} + +static ssize_t +sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + struct platform_device_id *dev_id = NULL; + + dev_id = (struct platform_device_id *)attr->private; + + DEBUG_PRINT("offset = (%lld), count = (%ld) dev_port=%d", off, count, (int)dev_id->driver_data); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + return sfp_port_read(data, buf, off, count, (int)dev_id->driver_data); +} + +static ssize_t +sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, + size_t count, int port) +{ + ssize_t retval = 0; + int data_reg = 0; + struct i2c_client *cpld_client = NULL; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + //CPLD MUX select + cpld_client = cpld_sfp_port_client(port, &data_reg); + DEBUG_PRINT("data_reg=%d, port=%d", data_reg, port); + if (!cpld_client) { + ERROR_MSG("Error i2c client for port %d", port); + } + i2c_smbus_write_byte_data(cpld_client, CPLD_MUX_REG ,data_reg); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + //CPLD MUX deselect + i2c_smbus_write_byte_data(cpld_client, CPLD_MUX_REG ,0x0); + + mutex_unlock(&data->update_lock); + return retval; +} + + +static ssize_t +sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + struct platform_device_id *dev_id = NULL; + + dev_id = (struct platform_device_id *)attr->private; + + DEBUG_PRINT("offset = (%lld), count = (%ld) dev_port=%d", + off, count, (int)dev_id->driver_data); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + return sfp_port_write(data, buf, off, count, (int)dev_id->driver_data); +} + +static int +sfp_sysfs_eeprom_init(struct kobject *kobj, + struct bin_attribute *eeprom, + const struct platform_device_id *dev_id) +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = dev_id->name; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; + eeprom->private = (void *)dev_id; + eeprom->size = EEPROM_SIZE; + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + DEBUG_PRINT("err=%d", err); + return err; + } + + return 0; +} + +static int +sfp_sysfs_eeprom_cleanup(struct kobject *kobj, + struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + + return 0; +} + +static int +sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} + +static int +qsfp_probe(struct i2c_client *client, + const struct platform_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + DEBUG_PRINT("No memory."); + goto exit; + } + + /* Register sysfs hooks */ //TBD: must remove + /* status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } */ + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin, dev_id); + if (status) { + DEBUG_PRINT("sfp_sysfs_eeprom_init error"); + goto exit_free; + } + + //TBD: Must remove + /*if (s9130_32x_kobj) { + status = sysfs_create_link(s9130_32x_kobj, &client->dev.kobj, client->name); + if (status) { + goto exit_remove; + } + }*/ + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_free: + kfree(qsfp); +exit: + + return status; +} + +static int +qsfp_device_probe(struct platform_device *pdev) +{ + struct sfp_platform_data *pdata; + struct sfp_port_data *data[TOTAL_PORT_NUM]; + struct i2c_adapter *parent[SFP_EEPROM_DEV_NUM]; + struct i2c_client *sfp_client[SFP_EEPROM_DEV_NUM]; + int i; + int ret=0; + + DEBUG_PRINT("Start"); + + pdata = pdev->dev.platform_data; + if (!pdata) { + ERROR_MSG("Missing platform data\n"); + return -ENODEV; + } + + //New eeprom device + for (i=0; i < SFP_EEPROM_DEV_NUM; i++) { + parent[i] = i2c_get_adapter(i+S8900_64XC_SFP_EEPROM_BASE_NR); + if (!parent[i]) { + ERROR_MSG("Parent adapter (%d) not found\n", i+S8900_64XC_SFP_EEPROM_BASE_NR); + ret=-ENODEV; + goto error; + } + sfp_client[i] = i2c_new_dummy(parent[i], SFP_EEPROM_A0_I2C_ADDR); + if (!sfp_client[i]) { + ERROR_MSG("[%d]: Fail to create dummy i2c client for parent %d addr 0x%x\n", i, i+S8900_64XC_SFP_EEPROM_BASE_NR, SFP_EEPROM_A0_I2C_ADDR); + ret=-ENODEV; + goto error; + } + } + + //Assign client to dummy device + for (i = 0; i < TOTAL_PORT_NUM; i++) { + switch (pdata[i].parent) { + case 2: + pdata[i].client = sfp_client[0]; + break; + case 3: + pdata[i].client = sfp_client[1]; + break; + case 4: + pdata[i].client = sfp_client[2]; + break; + default: + ERROR_MSG("Error parent number: %d, ", i); + break; + } + + if (!pdata[i].client) { + ERROR_MSG("[%d]: Fail to create dummy i2c client for parent %d addr 0x%x\n", i, pdata[i].parent, pdata[i].reg_addr); + ret=-ENODEV; + goto error; + } + } + + + for (i = 0; i < TOTAL_PORT_NUM; i++) { + data[i] = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data[i]) { + ret=-ENOMEM; + ERROR_MSG("No memory"); + goto error; + } + + i2c_set_clientdata(pdata[i].client, data[i]); + mutex_init(&data[i]->update_lock); + data[i]->port = qsfp_device_id[i].driver_data; + data[i]->client = pdata[i].client; + + DEBUG_PRINT("data[%d]->port=%d", i, data[i]->port); + + if (pdata[i].client->addr != SFP_EEPROM_A0_I2C_ADDR) { + ret=-ENODEV; + ERROR_MSG("Not approve device address"); + goto error; + } + + data[i]->driver_type = DRIVER_TYPE_QSFP; + + ret |= qsfp_probe(pdata[i].client, &qsfp_device_id[i], &data[i]->qsfp); + } + + if (ret) { + ERROR_MSG("qsfp_probe failed someone."); + //goto error; + } + return 0; +error: + DEBUG_PRINT("error start"); + i2c_put_adapter(parent[i]); + i--; + for (; i >= 0; i--) { + if (pdata[i].client) { + i2c_unregister_device(pdata[i].client); + i2c_put_adapter(parent[i]); + } + } + + return ret; +} + +static int +qsfp_remove(struct i2c_client *client, + struct qsfp_data *data) +{ + //TBD: Must remove + /*if (s9130_32x_kobj) { + sysfs_remove_link(s9130_32x_kobj, client->name); + }*/ + + //TBD: Must remove all ports EEPROM BIN + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + //TBD: Must remove sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + + return 0; +} + +static int __exit +qsfp_device_remove(struct platform_device *pdev) +{ + struct sfp_port_data *data = NULL; + struct sfp_platform_data *pdata = pdev->dev.platform_data; + struct i2c_adapter *parent = NULL; + int i; + + + + if (!pdata) { + ERROR_MSG("Missing platform data\n"); + return -ENOENT; + } + + for (i = 0; i < TOTAL_PORT_NUM; i+=CPLD_MUX_OFFSET) { + data = i2c_get_clientdata(pdata[i].client); + if (!data) { + ERROR_MSG("Empty data. skip. i=%d", i); + continue; + } + qsfp_remove(pdata[i].client, data->qsfp); + if (pdata[i].client) { + parent = (pdata[i].client)->adapter; + i2c_unregister_device(pdata[i].client); + i2c_put_adapter(parent); + } + kfree(data); + } + + + return 0; +} + +static int +cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent[CPLD_DEVICE_NUM]; + int i; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + ERROR_MSG("Missing platform data\n"); + return -ENODEV; + } + + for (i = 0; i < CPLD_DEVICE_NUM; i++) { + parent[i] = i2c_get_adapter(S8900_64XC_MUX_BASE_NR + i + 1); + if (!parent[i]) { + ERROR_MSG("Parent adapter (%d) not found\n", + S8900_64XC_MUX_BASE_NR + i + 1); + return -ENODEV; + } + pdata[i].client = i2c_new_dummy(parent[i], pdata[i].reg_addr); + if (!pdata[i].client) { + ERROR_MSG("Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr); + goto error; + } + } + + ret = sysfs_create_group(&pdev->dev.kobj, &s8900_64xc_cpld_attr_grp); + if (ret) + goto error; + + return 0; + +error: + if (i < CPLD_DEVICE_NUM) { + i2c_put_adapter(parent[i]); + } + i--; + for (; i >= 0; i--) { + if (pdata[i].client) { + i2c_unregister_device(pdata[i].client); + i2c_put_adapter(parent[i]); + } + } + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + int i; + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + + sysfs_remove_group(&pdev->dev.kobj, &s8900_64xc_cpld_attr_grp); + + if (!pdata) { + ERROR_MSG("Missing platform data\n"); + } else { + for (i = 0; i < CPLD_DEVICE_NUM; i++) { + if (pdata[i].client) { + parent = (pdata[i].client)->adapter; + i2c_unregister_device(pdata[i].client); + i2c_put_adapter(parent); + } + } + } + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "ingrasys-s8900-64xc-cpld", + }, +}; + +static struct platform_driver qsfp_driver = { + .probe = qsfp_device_probe, + .remove = __exit_p(qsfp_device_remove), + //.id_table = qsfp_device_id, + .driver = { + .owner = THIS_MODULE, + .name = "ingrasys-s8900-64xc-sfp", + }, +}; + + +static int __init ingrasys_s8900_64xc_platform_init(void) +{ + int ret = 0; + + DEBUG_PRINT("ingrasysl_s8900_64xc_platform module initialization\n"); + + //mdelay(10000); + + ret = platform_driver_register(&cpld_driver); + if (ret) { + ERROR_MSG("Fail to register cpld driver\n"); + goto error_cpld_driver; + } + ret = platform_device_register(&s8900_64xc_cpld); + if (ret) { + ERROR_MSG("Fail to create cpld device\n"); + goto error_cpld; + } + + ret = platform_driver_register(&qsfp_driver); + if (ret) { + ERROR_MSG("Fail to register sfp driver\n"); + goto error_cpld_driver; + } + + ret = platform_device_register(&s8900_64xc_sfp); + if (ret) { + ERROR_MSG("Fail to create sfp device\n"); + goto error_cpld; + } + + return 0; + +error_cpld: + platform_driver_unregister(&cpld_driver); + platform_driver_unregister(&qsfp_driver); +error_cpld_driver: + return ret; +} + +static void __exit ingrasys_s8900_64xc_platform_exit(void) +{ + platform_device_unregister(&s8900_64xc_sfp); + platform_device_unregister(&s8900_64xc_cpld); + platform_driver_unregister(&qsfp_driver); + platform_driver_unregister(&cpld_driver); +} + +module_init(ingrasys_s8900_64xc_platform_init); +module_exit(ingrasys_s8900_64xc_platform_exit); + +MODULE_DESCRIPTION("Ingrasys S8900-64XC Platform Support"); +MODULE_AUTHOR("Wade He "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/service/qsfp-monitor.service b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/service/qsfp-monitor.service new file mode 100644 index 000000000000..99c91b98ab52 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/service/qsfp-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description= This QSFP Monitor service is to setup QSFP SI. +Requires=s8900-64xc-monitor.service +After=s8900-64xc-monitor.service + +[Service] +ExecStart=/usr/sbin/qsfp_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/service/s8900-64xc-monitor.service b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/service/s8900-64xc-monitor.service new file mode 100644 index 000000000000..decb0f943a9d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/service/s8900-64xc-monitor.service @@ -0,0 +1,18 @@ +[Unit] +Description= This Platform Monitor service is to initialize platform and monitor platform. +Before=platform-monitor.service +After=sysinit.target +Wants=fancontrol.service +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/sbin/i2c_utils.sh i2c_init +ExecStart=/usr/sbin/s8900_64xc_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/i2c_utils.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/i2c_utils.sh new file mode 100644 index 000000000000..cd33df48bd4f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/i2c_utils.sh @@ -0,0 +1,1157 @@ +#!/bin/bash + +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +VERSION="1.0.0" +TRUE=200 +FALSE=404 + +EXEC_FUNC=${1} +COLOR_LED=${2} +QSFP_PORT=${2} +ONOFF_LED=${3} +FAN_TRAY=${4} + +############################################################ +# Distributor ID: Debian +# Description: Debian GNU/Linux 8.6 (jessie) +# Release: 8.6 +# Codename: jessie +# Linux debian 3.16.0-4-amd64 #1 +# SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux +############################################################ + +# Color Definition +COLOR_TITLE="\e[1;32m" ### Green ### +COLOR_WARNING="\e[1;33m" ### Yellow ### +COLOR_ERROR="\e[1;31m" ### Red ### +COLOR_END="\e[0m" ### END ### + +NUM_IGB_DEVICE=0 +NUM_I801_DEVICE=0 +NUM_ISMT_DEVICE=$(( ${NUM_I801_DEVICE} + 1 )) +NUM_MUX1_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 2 )) +NUM_MUX1_CHAN1_DEVICE=$(( ${NUM_I801_DEVICE} + 3 )) +NUM_MUX1_CHAN2_DEVICE=$(( ${NUM_I801_DEVICE} + 4 )) +NUM_MUX1_CHAN3_DEVICE=$(( ${NUM_I801_DEVICE} + 5 )) +NUM_MUX1_CHAN4_DEVICE=$(( ${NUM_I801_DEVICE} + 6 )) +NUM_MUX1_CHAN5_DEVICE=$(( ${NUM_I801_DEVICE} + 7 )) +NUM_MUX1_CHAN6_DEVICE=$(( ${NUM_I801_DEVICE} + 8 )) +NUM_MUX1_CHAN7_DEVICE=$(( ${NUM_I801_DEVICE} + 9 )) + +PATH_SYS_I2C_DEVICES="/sys/bus/i2c/devices" +PATH_HWMON_ROOT_DEVICES="/sys/class/hwmon" +PATH_HWMON_W83795_DEVICE="${PATH_HWMON_ROOT_DEVICES}/hwmon1" +PATH_I801_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}" +PATH_ISMT_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_ISMT_DEVICE}" +PATH_MUX_CHAN0_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN0_DEVICE}" +PATH_MUX_CHAN1_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN1_DEVICE}" +PATH_MUX_CHAN2_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN2_DEVICE}" +PATH_MUX_CHAN3_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN3_DEVICE}" +PATH_MUX_CHAN4_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN4_DEVICE}" +PATH_MUX_CHAN5_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN5_DEVICE}" +PATH_MUX_CHAN6_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN6_DEVICE}" +PATH_MUX_CHAN7_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN7_DEVICE}" + +#Power Supply Status +PSU_DC_ON=1 +PSU_DC_OFF=0 +PSU_EXIST=1 +PSU_NOT_EXIST=0 + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} i2c_init" + echo " : ${0} i2c_temp_init" + echo " : ${0} i2c_fan_init" + echo " : ${0} i2c_volmon_init" + echo " : ${0} i2c_io_exp_init" + echo " : ${0} i2c_led_test" + echo " : ${0} i2c_psu_eeprom_get" + echo " : ${0} i2c_mb_eeprom_get" + echo " : ${0} i2c_qsfp_eeprom_get [1-64]" + echo " : ${0} i2c_qsfp_status_get [1-64]" + echo " : ${0} i2c_qsfp_type_get [1-64]" + echo " : ${0} i2c_qsfp_abs_get [1-64]" + echo " : ${0} i2c_qsfp_rst_get [49-64]" + echo " : ${0} i2c_qsfp_lpmode_get [49-64]" + echo " : ${0} i2c_board_type_get" + echo " : ${0} i2c_psu_status" + echo " : ${0} i2c_led_psu_status_set" + echo " : ${0} i2c_led_fan_status_set" + echo " : ${0} i2c_led_fan_tray_status_set" + echo " : ${0} i2c_cpld_version" + echo " : ${0} i2c_front_temp" + echo " : ${0} i2c_rear_temp" + echo " : ${0} i2c_test_all" + echo " : ${0} i2c_sys_led green|amber on|off" + echo " : ${0} i2c_fan_led green|amber on|off" + echo " : ${0} i2c_psu1_led green|amber on|off" + echo " : ${0} i2c_psu2_led green|amber on|off" + echo " : ${0} i2c_fan_tray_led green|amber on|off [1-5]" + echo "----------------------------------------------------" +} + +#Pause function +function _pause { + read -p "$*" +} + +#Retry command function +function _retry { + for i in {1..5}; + do + eval "${*}" && break || echo "retry"; sleep 1; + done +} + + +#I2C Init +function _i2c_init { + echo "=========================================================" + echo "# Description: I2C Init" + echo "=========================================================" + + rmmod i2c_ismt + rmmod i2c_i801 + modprobe i2c_i801 + modprobe i2c_ismt + modprobe i2c_dev + modprobe i2c_mux_pca954x force_deselect_on_exit=1 + + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x72' > ${PATH_ISMT_DEVICE}/new_device" + else + echo "pca9548 0x72 already init." + fi + #Init CPLD LED_CLR Register (Front Port LED) + i2cset -y ${NUM_I801_DEVICE} 0x33 0x34 0x10 + + rmmod coretemp + rmmod jc42 + rmmod w83795 + rmmod lm75 + _i2c_temp_init + _i2c_volmon_init + _i2c_hwmon_init + modprobe coretemp + modprobe w83795 + modprobe lm75 + modprobe jc42 + modprobe sff_8436_eeprom + modprobe eeprom + modprobe eeprom_mb + modprobe qsfp_cpld + _i2c_fan_init + _i2c_io_exp_init + _i2c_cpld_init + _i2c_psu_eeprom_init + _i2c_led_psu_status_set + _i2c_led_fan_status_set + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_sys_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_sys_led + + echo "tmp75 0x48" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN3_DEVICE}/new_device + echo "tmp75 0x49" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN3_DEVICE}/new_device + echo "Mount Main Board EEPROM" + echo "mb_eeprom 0x54" > /sys/bus/i2c/devices/i2c-7/new_device + + _config_rmem +} + +#I2C Deinit +function _i2c_deinit { + for mod in coretemp jc42 w83795 lm75 eeprom_mb i2c_mux_pca954x i2c_ismt i2c_i801; + do + [ "$(lsmod | grep "^$mod ")" != "" ] && rmmod $mod + done +} + +#Temperature sensor Init +function _i2c_temp_init { + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x00 0x80 + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x05 0xFF + echo "TEMP INIT Done" +} + +#FAN Init +function _i2c_fan_init { + echo -n "FAN INIT..." + if [ -e "${PATH_HWMON_W83795_DEVICE}" ]; then + echo 120 > ${PATH_HWMON_W83795_DEVICE}/device/pwm1 + echo 120 > ${PATH_HWMON_W83795_DEVICE}/device/pwm2 + echo "SUCCESS" + else + echo "FAIL" + fi + +} + +#VOLMON Init +function _i2c_volmon_init { + echo -n "VOLMON INIT..." + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x00 0x80 + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x02 0xFF + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x03 0x50 + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x04 0x0A + echo "Done" +} + +#HWMON Init +function _i2c_hwmon_init { + echo -n "HWMON INIT..." + i2cset -y ${NUM_I801_DEVICE} 0x2f 0x00 0x80 + i2cset -y ${NUM_I801_DEVICE} 0x2f 0x06 0xFF + i2cset -y ${NUM_I801_DEVICE} 0x2f 0x07 0x03 + echo "Done" +} + +#IO Expander Init +function _i2c_io_exp_init { + echo "=========================================================" + echo "# Description: I2C IO Expender Init" + echo "=========================================================" + #SMBUS0 IO_EXPENDER + i2cset -y -r ${NUM_I801_DEVICE} 0x27 4 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x27 5 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x27 2 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x27 3 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x27 6 0xFF + i2cset -y -r ${NUM_I801_DEVICE} 0x27 7 0xFF + + #LED board after PVT (S8900_IO_EXP_LED_ID) + echo "Init LED IO Expender" + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 7 0xFF + + #PSU I/O (S8900_IO_EXP_PSU_ID) + echo "Init PSU IO Expender" + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 2 0x44 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 6 0xBB + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 7 0xFF + + #FAN I/O (S8900_IO_EXP_FAN_ID) + echo "Init FAN1 IO Expender" + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x20 2 0x11 + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x20 3 0x11 + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x20 6 0xCC + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x20 7 0xCC + + #FAN I/O (S8900_IO_EXP_FAN_ID) + echo "Init FAN2 IO Expender" + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x21 2 0x10 + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x21 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x21 6 0xCC + i2cset -y -r ${NUM_MUX1_CHAN3_DEVICE} 0x21 7 0xFF +} + +#I2C CPLD init +function _i2c_cpld_init { + echo "=========================================================" + echo "# Description: I2C CPLD Init..." + echo "=========================================================" + + ## modprobe i2c_cpld + modprobe i2c_cpld + ## Add CPLD device + echo "i2c_cpld 0x33" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}/new_device + + echo "done..." +} +#Set FAN Tray LED +function _i2c_led_fan_tray_status_set { + echo "FAN Tray Status Setup" + #FAN Status set + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan2_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan4_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN6_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan6_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + FAN8_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan8_alarm` + FAN9_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan9_alarm` + FAN10_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan10_alarm` + + if [ "${FAN1_ALARM}" == "0" ] && [ "${FAN2_ALARM}" == "0" ]; then + FAN_TRAY=1 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=1 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + if [ "${FAN3_ALARM}" == "0" ] && [ "${FAN4_ALARM}" == "0" ]; then + FAN_TRAY=2 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=2 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + if [ "${FAN5_ALARM}" == "0" ] && [ "${FAN6_ALARM}" == "0" ]; then + FAN_TRAY=3 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=3 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + if [ "${FAN7_ALARM}" == "0" ] && [ "${FAN8_ALARM}" == "0" ]; then + FAN_TRAY=4 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=4 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + if [ "${FAN9_ALARM}" == "0" ] && [ "${FAN10_ALARM}" == "0" ]; then + FAN_TRAY=5 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=5 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi +} + +#Set FAN LED +function _i2c_led_fan_status_set { + echo "FAN Status Setup" + #PSU Status set + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan2_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan4_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN6_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan6_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + FAN8_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan8_alarm` + FAN9_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan9_alarm` + FAN10_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan10_alarm` + + if [ "${FAN1_ALARM}" == "0" ] && [ "${FAN2_ALARM}" == "0" ] \ + && [ "${FAN3_ALARM}" == "0" ] && [ "${FAN4_ALARM}" == "0" ] \ + && [ "${FAN5_ALARM}" == "0" ] && [ "${FAN6_ALARM}" == "0" ] \ + && [ "${FAN7_ALARM}" == "0" ] && [ "${FAN8_ALARM}" == "0" ] \ + && [ "${FAN9_ALARM}" == "0" ] && [ "${FAN10_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + fi +} + +#Set Power Supply LED +function _i2c_led_psu_status_set { + echo "PSU LED Status Setup" + + #PSU Status set + _i2c_psu_status + + #PSU1 Status + if [ "${psu1Exist}" == ${PSU_EXIST} ]; then + if [ "${psu1PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + fi + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + fi + + #PSU2 Status + if [ "${psu2Exist}" == ${PSU_EXIST} ]; then + if [ "${psu2PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + fi + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + fi +} + +#LED Test +function _i2c_led_test { + echo "=========================================================" + echo "# Description: I2C LED TEST..." + echo "=========================================================" + #sys led (green) + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xBF + _pause 'Check SYS LED green light and Press [Enter] key to continue...' + #sys led (amber) + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0x7F + _pause 'Check SYS LED amber light and Press [Enter] key to continue...' + + #FAN led (green) + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xEF + _pause 'Check FAN LED green light and Press [Enter] key to continue...' + #FAN led (amber) + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xDF + _pause 'Check FAN LED amber light and Press [Enter] key to continue...' + + #PSU2 led (green) + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFB + _pause 'Check PSU2 LED green light and Press [Enter] key to continue...' + #PSU2 led (amber) + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xF7 + _pause 'Check PSU2 LED amber light and Press [Enter] key to continue...' + + #PSU1 led (green) + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFE + _pause 'Check PSU1 LED green light and Press [Enter] key to continue...' + #PSU1 led (amber) + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFD + _pause 'Check PSU1 LED amber light and Press [Enter] key to continue...' + + #Turn OFF All LED + i2cset -y ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + _pause 'Check turn off all LEDs and Press [Enter] key to continue...' + echo "done..." +} + +#Set QSFP Port variable +function _qsfp_port_i2c_var_set { + local port=$1 + case ${port} in + 1|2|3|4|5|6|7|8) + i2cbus=${NUM_MUX1_CHAN0_DEVICE} + regAddr=0x33 + idx=$(( ((${port} - 1) / 2) )) + dataAddr=$(( (32 + $idx) )) + presentChan=$(( $((${port} % 2)) == 1 ? 0x1 : 0x5 )) + eeprombus=${NUM_MUX1_CHAN0_DEVICE} + eepromidx=${port} + eepromAddr=0x50 + ;; + 9|10|11|12|13|14|15|16) + i2cbus=${NUM_MUX1_CHAN0_DEVICE} + regAddr=0x33 + idx=$(( ((${port} - 1) / 2) )) + dataAddr=$(( (32 + $idx) )) + presentChan=$(( $((${port} % 2)) == 1 ? 0x1 : 0x5 )) + eeprombus=${NUM_MUX1_CHAN0_DEVICE} + eepromidx=${port} + eepromAddr=0x50 + ;; + 17|18|19|20) + i2cbus=${NUM_MUX1_CHAN0_DEVICE} + regAddr=0x33 + idx=$(( ((${port} - 1) / 2) )) + dataAddr=$(( (32 + $idx) )) + presentChan=$(( $((${port} % 2)) == 1 ? 0x1 : 0x5 )) + eeprombus=${NUM_MUX1_CHAN0_DEVICE} + eepromidx=${port} + eepromAddr=0x50 + ;; + 21|22|23|24) + i2cbus=${NUM_MUX1_CHAN0_DEVICE} + regAddr=0x33 + idx=$(( ((${port} - 1) / 2) )) + dataAddr=$(( (38 + $idx) )) + presentChan=$(( $((${port} % 2)) == 1 ? 0x1 : 0x5 )) + eeprombus=${NUM_MUX1_CHAN0_DEVICE} + eepromidx=${port} + eepromAddr=0x50 + ;; + 25|26|27|28|29|30|31|32) + i2cbus=${NUM_MUX1_CHAN1_DEVICE} + regAddr=0x33 + idx=$(( ((${port} - 25) / 2) )) + dataAddr=$(( (32 + $idx) )) + presentChan=$(( $((${port} % 2)) == 1 ? 0x1 : 0x5 )) + eeprombus=${NUM_MUX1_CHAN1_DEVICE} + eepromidx=$(( (${port} - 24) )) + eepromAddr=0x50 + ;; + 33|34|35|36|37|38|39|40) + i2cbus=${NUM_MUX1_CHAN1_DEVICE} + regAddr=0x33 + idx=$(( ((${port} - 25) / 2) )) + dataAddr=$(( (32 + $idx) )) + presentChan=$(( $((${port} % 2)) == 1 ? 0x1 : 0x5 )) + eeprombus=${NUM_MUX1_CHAN1_DEVICE} + eepromidx=$(( (${port} - 24) )) + eepromAddr=0x50 + ;; + 41|42|43|44) + i2cbus=${NUM_MUX1_CHAN1_DEVICE} + regAddr=0x33 + idx=$(( ((${port} - 25) / 2) )) + dataAddr=$(( (32 + $idx) )) + presentChan=$(( $((${port} % 2)) == 1 ? 0x1 : 0x5 )) + eeprombus=${NUM_MUX1_CHAN1_DEVICE} + eepromidx=$(( (${port} - 24) )) + eepromAddr=0x50 + ;; + 45|46|47|48) + i2cbus=${NUM_MUX1_CHAN1_DEVICE} + regAddr=0x33 + idx=$(( ((${port} - 25) / 2) )) + dataAddr=$(( (38 + $idx) )) + presentChan=$(( $((${port} % 2)) == 1 ? 0x1 : 0x5 )) + eeprombus=${NUM_MUX1_CHAN1_DEVICE} + eepromidx=$(( (${port} - 24) )) + eepromAddr=0x50 + ;; + 49|50|51|52|53|54|55|56) + i2cbus=${NUM_MUX1_CHAN2_DEVICE} + regAddr=0x33 + idx=$(( (${port} - 49) )) + dataAddr=$(( (32 + $idx) )) + rstsellpdataAddr=$(( (48 + $idx) )) + intChan=0x0 + rstChan=0x0 + presentChan=0x1 + modselChan=0x1 + lpmodeChan=0x2 + eeprombus=${NUM_MUX1_CHAN2_DEVICE} + eepromidx=$(( (${port} - 48) )) + intabsidx=$(( (${port} - 28) )) + rstsellpidx=$(( (${port} - 18) )) + eepromAddr=0x50 + ;; + 57|58|59|60|61|62|63|64) + i2cbus=${NUM_MUX1_CHAN2_DEVICE} + regAddr=0x33 + idx=$(( (${port} - 49) )) + dataAddr=$(( (32 + $idx) )) + rstsellpdataAddr=$(( (48 + $idx) )) + intChan=0x0 + rstChan=0x0 + presentChan=0x1 + modselChan=0x1 + lpmodeChan=0x2 + eeprombus=${NUM_MUX1_CHAN2_DEVICE} + eepromidx=$(( (${port} - 48) )) + intabsidx=$(( (${port} - 28) )) + rstsellpidx=$(( (${port} - 18) )) + eepromAddr=0x50 + ;; + *) + echo "Please input 1~64" + exit + ;; + esac +} + +#Get SFP/QSFP EEPROM Information +function _i2c_qsfp_eeprom_get { + _qsfp_port_i2c_var_set ${QSFP_PORT} + + regData=`cat /sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_modprs` + port_num=$(( ${QSFP_PORT} - 1 )) + + #status: 0 -> Down, 1 -> Up + status=$(( $(($regData & ( 1 << $port_num))) != 0 ? 0 : 1 )) + + + if [ $status = 0 ]; then + echo "Module not present." + exit + fi + + #Read SFP/QSFP EEPROM + if [ ${QSFP_PORT} -lt 49 ]; then + cat ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/sfp${QSFP_PORT} | hexdump -C + elif [ ${QSFP_PORT} -ge 49 ]; then + cat ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/qsfp${QSFP_PORT} | hexdump -C + fi +} + +#Get QSFP Status for QSFP monitor service +function _i2c_qsfp_status_get { + _i2c_qsfp_abs_get + echo "status=$status" +} + +#Get QSFP type for QSFP monitor server +function _i2c_qsfp_type_get { + _qsfp_port_i2c_var_set ${QSFP_PORT} + + regData=`cat /sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_modprs` + port_num=$(( ${QSFP_PORT} - 1 )) + + #status: 0 -> Down, 1 -> Up + status=$(( $(($regData & ( 1 << $port_num))) != 0 ? 0 : 1 )) + + if [ $status = 0 ]; then + echo "Module not present." + exit + fi + + #Read SFP/QSFP EEPROM + if [ ${QSFP_PORT} -lt 49 ]; then + qsfp_info=$(base64 ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/sfp${QSFP_PORT}) + elif [ ${QSFP_PORT} -ge 49 ]; then + qsfp_info=$(base64 ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/qsfp${QSFP_PORT}) + fi + + if [ ${QSFP_PORT} -ge 1 ] && [ ${QSFP_PORT} -le 48 ]; then + echo "sfp" + # 1~48 port is sfp port + identifier=$(echo $qsfp_info | base64 -d -i | hexdump -s 0 -n 1 -e '"%x"') + connector=$(echo $qsfp_info | base64 -d -i | hexdump -s 2 -n 1 -e '"%x"') + transceiver=$(echo $qsfp_info | base64 -d -i | hexdump -s 3 -n 1 -e '"%x"') + else + echo "qsfp" + # 49~64 port is qsfp port + identifier=$(echo $qsfp_info | base64 -d -i | hexdump -s 128 -n 1 -e '"%x"') + connector=$(echo $qsfp_info | base64 -d -i | hexdump -s 130 -n 1 -e '"%x"') + transceiver=$(echo $qsfp_info | base64 -d -i | hexdump -s 131 -n 1 -e '"%x"') + fi + + echo "identifier=$identifier" + echo "connector=$connector" + echo "transceiver=$transceiver" +} + +#Get QSFP ABS +function _i2c_qsfp_abs_get { + _qsfp_port_i2c_var_set ${QSFP_PORT} + + regData=`cat /sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_modprs` + port_num=$(( ${QSFP_PORT} - 1 )) + + #status: 0 -> Down, 1 -> Up + status=$(( $(($regData & ( 1 << $port_num))) != 0 ? 0 : 1 )) + echo "ABS=$status regData=$regData" + + +} + +#Get QSFP RST +function _i2c_qsfp_rst_get { + + if [ ${QSFP_PORT} -lt 49 ] || [ ${QSFP_PORT} -gt 64 ]; then + echo "Please input 49~64" + exit + fi + _qsfp_port_i2c_var_set ${QSFP_PORT} + + + regData=`cat /sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_reset` + port_num=$(( ${QSFP_PORT} - 49 )) + + #status: 0 -> Down, 1 -> Up + status=$(( $(($regData & ( 1 << $port_num))) != 0 ? 0 : 1 )) + echo "RST=$status regData=$regData" + +} + +#Get QSFP LPMODE +function _i2c_qsfp_lpmode_get { + + if [ ${QSFP_PORT} -lt 49 ] || [ ${QSFP_PORT} -gt 64 ]; then + echo "Please input 49~64" + exit + fi + _qsfp_port_i2c_var_set ${QSFP_PORT} + + + regData=`cat /sys/devices/platform/ingrasys-s8900-64xc-cpld.0/qsfp_lpmode` + port_num=$(( ${QSFP_PORT} - 49 )) + + #status: 0 -> Down, 1 -> Up + status=$(( $(($regData & ( 1 << $port_num))) != 0 ? 1 : 0 )) + echo "LPMODE=$status regData=$regData" + +} +#PSU EEPROM init +function _i2c_psu_eeprom_init { + echo "=========================================================" + echo "# Description: I2C PSU EEPROM Init..." + echo "=========================================================" + + ## modprobe eeprom + modprobe eeprom + ## PUS(0) EEPROM + echo "eeprom 0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN6_DEVICE}/new_device + + ## PUS(1) EEPROM + echo "eeprom 0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN7_DEVICE}/new_device + + echo "done..." +} + +#Get PSU EEPROM Information +function _i2c_psu_eeprom_get { + echo "=========================================================" + echo "# Description: I2C PSU EEPROM Get..." + echo "=========================================================" + + ## modprobe eeprom + modprobe eeprom + ## PUS(0) EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_MUX1_CHAN6_DEVICE}-0050/eeprom | hexdump -C + + ## PUS(1) EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_MUX1_CHAN7_DEVICE}-0050/eeprom | hexdump -C + echo "done..." +} + +#Get MotherBoard EEPROM Information +function _i2c_mb_eeprom_get { + echo "=========================================================" + echo "# Description: I2C MB EEPROM Get..." + echo "=========================================================" + + ## modprobe eeprom + modprobe eeprom_mb + + ## MB EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_MUX1_CHAN5_DEVICE}-0054/eeprom | hexdump -C + echo "done..." +} + +#Set System Status LED +function _i2c_sys_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x40 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x40 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x80 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x80 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set PSU2 LED +function _i2c_psu2_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x04 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x04 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x08 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x08 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set FAN Tray LED +function _i2c_fan_tray_led { + + case ${FAN_TRAY} in + 1) + i2cAddr=0x20 + ioPort=2 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 2) + i2cAddr=0x20 + ioPort=2 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + 3) + i2cAddr=0x20 + ioPort=3 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 4) + i2cAddr=0x20 + ioPort=3 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + 5) + i2cAddr=0x21 + ioPort=2 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + *) + echo "Please input 1~5" + exit + ;; + esac + + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m $mask -y -r ${NUM_MUX1_CHAN3_DEVICE} $i2cAddr $ioPort 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m $mask -y -r ${NUM_MUX1_CHAN3_DEVICE} $i2cAddr $ioPort 0x33 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m $mask -y -r ${NUM_MUX1_CHAN3_DEVICE} $i2cAddr $ioPort 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m $mask -y -r ${NUM_MUX1_CHAN3_DEVICE} $i2cAddr $ioPort 0x33 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set FAN LED +function _i2c_fan_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x10 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x10 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x20 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x20 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set PSU1 LED +function _i2c_psu1_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x01 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x01 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x02 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x02 -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Get Board Version and Type +function _i2c_board_type_get { + boardType=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_board_type` + boardBuildRev=$((($boardType) & 0x03)) + boardHwRev=$((($boardType) >> 2 & 0x03)) + boardId=$((($boardType) >> 4)) + printf "BOARD_ID is 0x%02x, HW Rev %d, Build Rev %d\n" $boardId $boardHwRev $boardBuildRev + +} + +#Get CPLD Version +function _i2c_cpld_version { + cpldRev=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_version` + cpldRelease=$((($cpldRev) >> 6 & 0x01)) + cpldVersion=$((($cpldRev) & 0x3F)) + printf "CPLD is %s version(0:RD 1:Release), Revision is 0x%02x\n" $cpldRelease $cpldVersion + +} + +#Get PSU Status +function _i2c_psu_status { + psuPresent=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_pw_abs` + psu1Exist=$(($((($psuPresent) & 0x01))?0:1)) + psu2Exist=$(($((($psuPresent) & 0x02))?0:1)) + psuPwGood=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_pw_good` + psu1PwGood=$(($((($psuPwGood) >> 2 & 0x01))?1:0)) + psu2PwGood=$(($((($psuPwGood) >> 2 & 0x02))?1:0)) + printf "PSU1 Exist:%d PSU1 PW Good:%d\n" $psu1Exist $psu1PwGood + printf "PSU2 Exist:%d PSU2 PW Good:%d\n" $psu2Exist $psu2PwGood +} + +#Get Front Sensor Temperature +function _i2c_front_temp { + #Front MAC + sensors | grep 'Front MAC Temp' -A 1 +} + +#Get Rear Sensor Temperature +function _i2c_rear_temp { + #Rear MAC + sensors | grep 'Rear MAC Temp' -A 1 +} + +#Increase read socket buffer for CoPP Test +function _config_rmem { + echo "109430400" > /proc/sys/net/core/rmem_max +} + +#Main Function +function _main { + tart_time_str=`date` + start_time_sec=$(date +%s) + + if [ "${EXEC_FUNC}" == "help" ]; then + _help + elif [ "${EXEC_FUNC}" == "i2c_init" ]; then + _i2c_init + elif [ "${EXEC_FUNC}" == "i2c_deinit" ]; then + _i2c_deinit + elif [ "${EXEC_FUNC}" == "i2c_temp_init" ]; then + _i2c_temp_init + elif [ "${EXEC_FUNC}" == "i2c_fan_init" ]; then + _i2c_fan_init + elif [ "${EXEC_FUNC}" == "i2c_volmon_init" ]; then + _i2c_volmon_init + elif [ "${EXEC_FUNC}" == "i2c_io_exp_init" ]; then + _i2c_io_exp_init + elif [ "${EXEC_FUNC}" == "i2c_led_test" ]; then + _i2c_led_test + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_get" ]; then + _i2c_mb_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_psu_eeprom_get" ]; then + _i2c_psu_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_get" ]; then + _i2c_qsfp_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_status_get" ]; then + _i2c_qsfp_status_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_type_get" ]; then + _i2c_qsfp_type_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_abs_get" ]; then + _i2c_qsfp_abs_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_rst_get" ]; then + _i2c_qsfp_rst_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_lpmode_get" ]; then + _i2c_qsfp_lpmode_get + elif [ "${EXEC_FUNC}" == "i2c_led_psu_status_set" ]; then + _i2c_led_psu_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_status_set" ]; then + _i2c_led_fan_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_tray_status_set" ]; then + _i2c_led_fan_tray_status_set + elif [ "${EXEC_FUNC}" == "i2c_sys_led" ]; then + _i2c_sys_led + elif [ "${EXEC_FUNC}" == "i2c_fan_led" ]; then + _i2c_fan_led + elif [ "${EXEC_FUNC}" == "i2c_fan_tray_led" ]; then + _i2c_fan_tray_led + elif [ "${EXEC_FUNC}" == "i2c_psu1_led" ]; then + _i2c_psu1_led + elif [ "${EXEC_FUNC}" == "i2c_psu2_led" ]; then + _i2c_psu2_led + elif [ "${EXEC_FUNC}" == "i2c_board_type_get" ]; then + _i2c_board_type_get + elif [ "${EXEC_FUNC}" == "i2c_cpld_version" ]; then + _i2c_cpld_version + elif [ "${EXEC_FUNC}" == "i2c_psu_status" ]; then + _i2c_psu_status + elif [ "${EXEC_FUNC}" == "i2c_front_temp" ]; then + _i2c_front_temp + elif [ "${EXEC_FUNC}" == "i2c_rear_temp" ]; then + _i2c_rear_temp + elif [ "${EXEC_FUNC}" == "i2c_test_all" ]; then + _i2c_init + _i2c_temp_init + _i2c_fan_init + _i2c_io_exp_init + _i2c_led_test + _i2c_psu_eeprom_get + _i2c_mb_eeprom_get + _i2c_board_type_get + _i2c_cpld_version + _i2c_psu_status + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + end_time_str=`date` + end_time_sec=$(date +%s) + diff_time=$[ ${end_time_sec} - ${start_time_sec} ] + echo "Start Time: ${start_time_str} (${start_time_sec})" + echo "End Time : ${end_time_str} (${end_time_sec})" + echo "Total Execution Time: ${diff_time} sec" + + echo "done!!!" +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/qsfp_monitor.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/qsfp_monitor.sh new file mode 100644 index 000000000000..36f9e53ef108 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/qsfp_monitor.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=3 +I2C_UTILS="/usr/sbin/i2c_utils.sh" +QSFP_SI_SCRIPT="/usr/sbin/qsfp_si_cfg.sh" +QSFP_ARRAY=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + +#QSFP SI monitor +function _qsfp_si_monitor { + local i + local status + for i in {0..63}; + do + status=`${I2C_UTILS} i2c_qsfp_status_get $(expr $i + 1) | egrep '^status=.*$' | sed -e 's/status=//g'` + if [ "${status}" == "1" ]; then + _qsfp_type_check $i + fi + done +} + +#QSFP type +function _qsfp_type_check { + local port=$1 + local qsfp_type=`${I2C_UTILS} i2c_qsfp_type_get $(expr $port + 1)` + local identifier=`echo "$qsfp_type" | grep '^identifier=.*$' | sed -e 's/identifier=//g'` + # identifier 11 for qsfp, 3 for sfp + if [ "${identifier}" == "11" ] || [ "${identifier}" == "3" ]; then + connector=`echo "$qsfp_type" | grep '^connector=.*$' | sed -e 's/connector=//g'` + case ${connector} in + 21|23) + #DAC + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to DAC" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} dac $port >/dev/null + fi + ;; + *) + #AOC + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to AOC" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} aoc $port >/dev/null + fi + ;; + esac + fi +} + +#Docker exist check +function _docker_swss_check { + while true + do + # Check if syncd starts + result=`docker exec -i swss bash -c "echo -en \"SELECT 1\\nHLEN HIDDEN\" | redis-cli | sed -n 2p"` #TBD FIX ME + if [ "$result" == "3" ]; then + return + fi + sleep $INTERVAL + done +} + +#Docker exist check +function _qsfp_si_cfg_script_check { + + if [ -f ${QSFP_SI_SCRIPT} ] && [ -x ${QSFP_SI_SCRIPT} ]; then + echo "SI Script exists. Start monitor." + return + else + echo "SI Script not exist. Exit monitor." + exit + fi +} + +# main function +function _main { + #Check SI Script + _qsfp_si_cfg_script_check + #Check docker swss is running + _docker_swss_check + while true + do + _qsfp_si_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/qsfp_si_cfg.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/qsfp_si_cfg.sh new file mode 100644 index 000000000000..3d132641f516 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/qsfp_si_cfg.sh @@ -0,0 +1,409 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +VERSION="1.0.0" +TRUE=200 +FALSE=404 + +TYPE=${1} +PORT=${2} + +# port number +MIN_PORT=0 +MAX_PORT=63 + +# INDEX of value field in array +SI_PRE_IDX=1 +SI_POST_IDX=2 +SI_MAIN_IDX=3 +SI_AMP_IDX=4 +SI_DRI_IDX=5 + +# type string +AOC_TYPE="aoc" +DAC_TYPE="dac" + +# si value for bcm command +SI_VAL="" + +# "PRE POST MAIN AMP DRIVERMODE" for each port in array +xe_aoc_si_value=( + "0x00 0x30 0x40 0x9 0x0" #port 0 + "0x00 0x30 0x40 0x9 0x0" #port 1 + "0x00 0x30 0x40 0x9 0x0" #port 2 + "0x00 0x2c 0x44 0x9 0x0" #port 3 + "0x00 0x30 0x40 0x9 0x0" #port 4 + "0x00 0x30 0x40 0x9 0x0" #port 5 + "0x00 0x2c 0x44 0x9 0x0" #port 6 + "0x00 0x2c 0x44 0x9 0x0" #port 7 + "0x00 0x2c 0x44 0x9 0x0" #port 8 + "0x00 0x28 0x48 0x9 0x0" #port 9 + "0x00 0x2c 0x44 0x9 0x0" #port 10 + "0x00 0x2c 0x44 0x9 0x0" #port 11 + "0x00 0x2c 0x44 0x9 0x0" #port 12 + "0x00 0x2c 0x44 0x9 0x0" #port 13 + "0x00 0x2c 0x44 0x9 0x0" #port 14 + "0x00 0x2c 0x44 0x9 0x0" #port 15 + "0x00 0x2c 0x44 0xb 0x0" #port 16 + "0x00 0x30 0x40 0xb 0x0" #port 17 + "0x00 0x2c 0x44 0xa 0x0" #port 18 + "0x00 0x2c 0x44 0x9 0x0" #port 19 + "0x00 0x30 0x40 0xa 0x0" #port 20 + "0x00 0x2c 0x44 0x9 0x0" #port 21 + "0x00 0x2c 0x44 0x9 0x0" #port 22 + "0x00 0x30 0x40 0xc 0x0" #port 23 + "0x00 0x30 0x40 0xc 0x0" #port 24 + "0x00 0x2c 0x44 0x9 0x0" #port 25 + "0x00 0x30 0x40 0x9 0x0" #port 26 + "0x00 0x30 0x40 0x9 0x0" #port 27 + "0x00 0x30 0x40 0xa 0x0" #port 28 + "0x00 0x28 0x48 0x9 0x0" #port 29 + "0x00 0x2c 0x44 0x9 0x0" #port 30 + "0x00 0x2c 0x44 0xa 0x0" #port 31 + "0x00 0x28 0x48 0x9 0x0" #port 32 + "0x00 0x28 0x48 0x7 0x0" #port 33 + "0x00 0x28 0x48 0x9 0x0" #port 34 + "0x00 0x28 0x48 0x9 0x0" #port 35 + "0x00 0x28 0x48 0x9 0x0" #port 36 + "0x00 0x2c 0x44 0x9 0x0" #port 37 + "0x00 0x28 0x48 0x9 0x0" #port 38 + "0x00 0x28 0x48 0x9 0x0" #port 39 + "0x00 0x28 0x48 0xa 0x0" #port 40 + "0x00 0x2c 0x44 0x9 0x0" #port 41 + "0x00 0x2c 0x44 0x9 0x0" #port 42 + "0x00 0x2e 0x42 0xa 0x0" #port 43 + "0x00 0x2e 0x42 0xa 0x0" #port 44 + "0x00 0x2c 0x44 0xa 0x0" #port 45 + "0x00 0x2c 0x44 0x9 0x0" #port 46 + "0x00 0x2c 0x44 0x9 0x0" #port 47 +) + +ce_aoc_si_value=( + "0x00 0x2c 0x44 0x9 0x0" #port 0 lane 0 + "0x00 0x34 0x3c 0xf 0x0" #port 0 lane 1 + "0x00 0x2c 0x44 0x9 0x0" #port 0 lane 2 + "0x00 0x2c 0x44 0x9 0x0" #port 0 lane 3 + "0x00 0x28 0x48 0x9 0x0" #port 1 lane 0 + "0x00 0x28 0x48 0x9 0x0" #port 1 lane 1 + "0x00 0x2c 0x44 0x9 0x0" #port 1 lane 2 + "0x00 0x2c 0x44 0xe 0x0" #port 1 lane 3 + "0x00 0x28 0x48 0x9 0x0" #port 2 lane 0 + "0x00 0x34 0x3c 0xf 0x0" #port 2 lane 1 + "0x00 0x28 0x48 0x9 0x0" #port 2 lane 2 + "0x00 0x30 0x40 0xd 0x0" #port 2 lane 3 + "0x00 0x2c 0x44 0x9 0x0" #port 3 lane 0 + "0x00 0x30 0x40 0xd 0x0" #port 3 lane 1 + "0x00 0x2c 0x44 0x9 0x0" #port 3 lane 2 + "0x00 0x30 0x40 0xd 0x0" #port 3 lane 3 + "0x00 0x2c 0x44 0x9 0x0" #port 4 lane 0 + "0x00 0x2c 0x44 0x9 0x0" #port 4 lane 1 + "0x00 0x2c 0x44 0x9 0x0" #port 4 lane 2 + "0x00 0x30 0x40 0xd 0x0" #port 4 lane 3 + "0x00 0x2c 0x44 0x9 0x0" #port 5 lane 0 + "0x00 0x38 0x38 0xf 0x0" #port 5 lane 1 + "0x00 0x2c 0x44 0x9 0x0" #port 5 lane 2 + "0x00 0x2c 0x44 0x9 0x0" #port 5 lane 3 + "0x00 0x2c 0x44 0x9 0x0" #port 6 lane 0 + "0x00 0x2c 0x44 0x9 0x0" #port 6 lane 1 + "0x00 0x2c 0x44 0x9 0x0" #port 6 lane 2 + "0x00 0x30 0x40 0xe 0x0" #port 6 lane 3 + "0x00 0x28 0x48 0x9 0x0" #port 7 lane 0 + "0x00 0x30 0x40 0xa 0x0" #port 7 lane 1 + "0x00 0x2c 0x44 0x9 0x0" #port 7 lane 2 + "0x00 0x34 0x3c 0xe 0x0" #port 7 lane 3 + "0x00 0x2c 0x44 0x9 0x0" #port 8 lane 0 + "0x00 0x30 0x40 0xe 0x0" #port 8 lane 1 + "0x00 0x34 0x3c 0xf 0x0" #port 8 lane 2 + "0x00 0x30 0x40 0xe 0x0" #port 8 lane 3 + "0x00 0x2c 0x44 0x9 0x0" #port 9 lane 0 + "0x00 0x34 0x3c 0xd 0x0" #port 9 lane 1 + "0x00 0x34 0x3c 0xd 0x0" #port 9 lane 2 + "0x00 0x34 0x3c 0xf 0x0" #port 9 lane 3 + "0x00 0x34 0x3c 0xd 0x0" #port 10 lane 0 + "0x00 0x34 0x3c 0xe 0x0" #port 10 lane 1 + "0x00 0x34 0x3c 0xd 0x0" #port 10 lane 2 + "0x00 0x34 0x3c 0xd 0x0" #port 10 lane 3 + "0x00 0x34 0x3c 0xd 0x0" #port 11 lane 0 + "0x00 0x34 0x3c 0xd 0x0" #port 11 lane 1 + "0x00 0x30 0x40 0xd 0x0" #port 11 lane 2 + "0x00 0x30 0x40 0xd 0x0" #port 11 lane 3 + "0x00 0x34 0x3c 0xd 0x0" #port 12 lane 0 + "0x00 0x34 0x3c 0xd 0x0" #port 12 lane 1 + "0x00 0x34 0x3c 0xd 0x0" #port 12 lane 2 + "0x00 0x34 0x3c 0xd 0x0" #port 12 lane 3 + "0x00 0x34 0x3c 0xd 0x0" #port 13 lane 0 + "0x00 0x34 0x3c 0xd 0x0" #port 13 lane 1 + "0x00 0x34 0x3c 0xd 0x0" #port 13 lane 2 + "0x00 0x34 0x3c 0xf 0x0" #port 13 lane 3 + "0x00 0x38 0x38 0xe 0x0" #port 14 lane 0 + "0x00 0x34 0x3c 0xd 0x0" #port 14 lane 1 + "0x00 0x34 0x3c 0xd 0x0" #port 14 lane 2 + "0x00 0x38 0x38 0xe 0x0" #port 14 lane 3 + "0x00 0x34 0x3c 0xd 0x0" #port 15 lane 0 + "0x00 0x30 0x40 0xc 0x0" #port 15 lane 1 + "0x00 0x30 0x40 0xc 0x0" #port 15 lane 2 + "0x00 0x34 0x3c 0xd 0x0" #port 15 lane 3 +) + +xe_dac_si_value=( + "0x14 0x00 0x3c 0xf 0x0" #port 0 + "0x1c 0x00 0x3c 0xf 0x0" #port 1 + "0x08 0x00 0x3c 0xf 0x0" #port 2 + "0x08 0x00 0x3c 0xf 0x0" #port 3 + "0x08 0x00 0x3c 0xf 0x0" #port 4 + "0x10 0x00 0x3c 0xf 0x0" #port 5 + "0x08 0x08 0x3c 0xf 0x0" #port 6 + "0x10 0x04 0x3c 0xf 0x0" #port 7 + "0x08 0x00 0x3c 0x9 0x0" #port 8 + "0x08 0x00 0x3c 0x9 0x0" #port 9 + "0x08 0x00 0x3c 0x9 0x0" #port 10 + "0x08 0x00 0x3c 0x9 0x0" #port 11 + "0x08 0x00 0x3c 0x9 0x0" #port 12 + "0x08 0x00 0x3c 0x9 0x0" #port 13 + "0x08 0x00 0x3c 0x9 0x0" #port 14 + "0x08 0x00 0x3c 0x9 0x0" #port 15 + "0x08 0x0c 0x3c 0xb 0x0" #port 16 + "0x10 0x0c 0x3c 0xb 0x0" #port 17 + "0x08 0x08 0x3c 0xa 0x0" #port 18 + "0x10 0x0c 0x3c 0x9 0x0" #port 19 + "0x08 0x04 0x3c 0xc 0x0" #port 20 + "0x08 0x08 0x3c 0x9 0x0" #port 21 + "0x08 0x08 0x3c 0xc 0x0" #port 22 + "0x10 0x08 0x3c 0xa 0x0" #port 23 + "0x08 0x08 0x3c 0x9 0x0" #port 24 + "0x08 0x04 0x3c 0x9 0x0" #port 25 + "0x08 0x00 0x3c 0x9 0x0" #port 26 + "0x08 0x08 0x3c 0xc 0x0" #port 27 + "0x10 0x00 0x3c 0xa 0x0" #port 28 + "0x10 0x04 0x3c 0x9 0x0" #port 29 + "0x14 0x00 0x3c 0x9 0x0" #port 30 + "0x14 0x00 0x3c 0xa 0x0" #port 31 + "0x08 0x00 0x3c 0x9 0x0" #port 32 + "0x08 0x00 0x3c 0x7 0x0" #port 33 + "0x08 0x00 0x3c 0x9 0x0" #port 34 + "0x08 0x00 0x3c 0x9 0x0" #port 35 + "0x08 0x00 0x3c 0x9 0x0" #port 36 + "0x0c 0x00 0x3c 0x9 0x0" #port 37 + "0x08 0x00 0x3c 0x9 0x0" #port 38 + "0x08 0x00 0x3c 0x9 0x0" #port 39 + "0x10 0x00 0x3c 0xa 0x0" #port 40 + "0x10 0x00 0x3c 0x9 0x0" #port 41 + "0x08 0x08 0x3c 0xc 0x0" #port 42 + "0x10 0x00 0x3c 0xa 0x0" #port 43 + "0x08 0x00 0x3c 0xa 0x0" #port 44 + "0x10 0x00 0x3c 0x9 0x0" #port 45 + "0x08 0x04 0x3c 0x9 0x0" #port 46 + "0x08 0x00 0x3c 0xa 0x0" #port 47 +) + +ce_dac_si_value=( + "0x08 0x00 0x3c 0x9 0x0" #port 0 lane 0 + "0x08 0x00 0x3c 0xf 0x0" #port 0 lane 1 + "0x08 0x00 0x3c 0x9 0x0" #port 0 lane 2 + "0x08 0x00 0x3c 0x9 0x0" #port 0 lane 3 + "0x08 0x00 0x3c 0x9 0x0" #port 1 lane 0 + "0x08 0x00 0x3c 0x9 0x0" #port 1 lane 1 + "0x08 0x00 0x3c 0x9 0x0" #port 1 lane 2 + "0x08 0x00 0x3c 0xe 0x0" #port 1 lane 3 + "0x08 0x00 0x3c 0x9 0x0" #port 2 lane 0 + "0x08 0x00 0x3c 0xf 0x0" #port 2 lane 1 + "0x08 0x00 0x3c 0x9 0x0" #port 2 lane 2 + "0x08 0x00 0x3c 0xd 0x0" #port 2 lane 3 + "0x08 0x00 0x3c 0x9 0x0" #port 3 lane 0 + "0x08 0x00 0x3c 0xd 0x0" #port 3 lane 1 + "0x08 0x00 0x3c 0x9 0x0" #port 3 lane 2 + "0x08 0x00 0x3c 0xd 0x0" #port 3 lane 3 + "0x08 0x00 0x3c 0x9 0x0" #port 4 lane 0 + "0x08 0x00 0x3c 0x9 0x0" #port 4 lane 1 + "0x08 0x00 0x3c 0x9 0x0" #port 4 lane 2 + "0x08 0x00 0x3c 0xd 0x0" #port 4 lane 3 + "0x08 0x00 0x3c 0x9 0x0" #port 5 lane 0 + "0x08 0x00 0x3c 0xf 0x0" #port 5 lane 1 + "0x08 0x00 0x3c 0x9 0x0" #port 5 lane 2 + "0x08 0x00 0x3c 0x9 0x0" #port 5 lane 3 + "0x08 0x00 0x3c 0x9 0x0" #port 6 lane 0 + "0x08 0x00 0x3c 0x9 0x0" #port 6 lane 1 + "0x08 0x00 0x3c 0x9 0x0" #port 6 lane 2 + "0x08 0x00 0x3c 0xe 0x0" #port 6 lane 3 + "0x08 0x00 0x3c 0x9 0x0" #port 7 lane 0 + "0x08 0x00 0x3c 0xa 0x0" #port 7 lane 1 + "0x08 0x00 0x3c 0x9 0x0" #port 7 lane 2 + "0x08 0x00 0x3c 0xe 0x0" #port 7 lane 3 + "0x08 0x04 0x3c 0xf 0x0" #port 8 lane 0 + "0x08 0x00 0x3c 0xf 0x0" #port 8 lane 1 + "0x08 0x04 0x3c 0xf 0x0" #port 8 lane 2 + "0x08 0x00 0x3c 0xf 0x0" #port 8 lane 3 + "0x08 0x04 0x3c 0xf 0x0" #port 9 lane 0 + "0x08 0x04 0x3c 0xf 0x0" #port 9 lane 1 + "0x08 0x04 0x3c 0xf 0x0" #port 9 lane 2 + "0x08 0x04 0x3c 0xf 0x0" #port 9 lane 3 + "0x08 0x04 0x3c 0xf 0x0" #port 10 lane 0 + "0x10 0x08 0x3c 0xf 0x0" #port 10 lane 1 + "0x08 0x04 0x3c 0xf 0x0" #port 10 lane 2 + "0x08 0x04 0x3c 0xf 0x0" #port 10 lane 3 + "0x08 0x08 0x3c 0xf 0x0" #port 11 lane 0 + "0x08 0x04 0x3c 0xf 0x0" #port 11 lane 1 + "0x08 0x04 0x3c 0xf 0x0" #port 11 lane 2 + "0x08 0x04 0x3c 0xf 0x0" #port 11 lane 3 + "0x08 0x0c 0x3c 0xf 0x0" #port 12 lane 0 + "0x08 0x08 0x3c 0xf 0x0" #port 12 lane 1 + "0x08 0x0c 0x3c 0xf 0x0" #port 12 lane 2 + "0x08 0x08 0x3c 0xf 0x0" #port 12 lane 3 + "0x08 0x08 0x3c 0xf 0x0" #port 13 lane 0 + "0x08 0x0c 0x3c 0xf 0x0" #port 13 lane 1 + "0x08 0x08 0x3c 0xf 0x0" #port 13 lane 2 + "0x08 0x0c 0x3c 0xf 0x0" #port 13 lane 3 + "0x10 0x10 0x3c 0xf 0x0" #port 14 lane 0 + "0x08 0x0c 0x3c 0xf 0x0" #port 14 lane 1 + "0x08 0x0c 0x3c 0xf 0x0" #port 14 lane 2 + "0x08 0x0c 0x3c 0xf 0x0" #port 14 lane 3 + "0x08 0x14 0x3c 0xf 0x0" #port 15 lane 0 + "0x08 0x10 0x3c 0xf 0x0" #port 15 lane 1 + "0x08 0x10 0x3c 0xf 0x0" #port 15 lane 2 + "0x08 0x10 0x3c 0xf 0x0" #port 15 lane 3 +) + +#get field value in si value array for xe port +function get_xe_si { + local port=$1 + local field=$2 + local type=$3 + local index=$port + if [ "$type" == "${AOC_TYPE}" ]; then + SI_VAL=$(echo "${xe_aoc_si_value[$index]}" | awk '{print $'$field'}') + else + SI_VAL=$(echo "${xe_dac_si_value[$index]}" | awk '{print $'$field'}') + fi +} + +#get field value in si value array for ce port +function get_ce_si { + local port=$1 + local lane=$2 + local field=$3 + local type=$4 + index=$(( (${port}-1)*4+${lane} )) + if [ "$type" == "${AOC_TYPE}" ]; then + SI_VAL=$(echo "${ce_aoc_si_value[$index]}" | awk '{print $'$field'}') + else + SI_VAL=$(echo "${ce_dac_si_value[$index]}" | awk '{print $'$field'}') + fi +} + +# set si value for xe port +function _qsfp_xe_si_set { + # convert PORT to xe port index + local xe_port=$PORT + # generate command for SI PRE value + get_xe_si $xe_port $SI_PRE_IDX $TYPE + local pre_cmd="phy xe${xe_port} CL93N72_UT_CTL2r CL93N72_TXFIR_PRE=${SI_VAL}" + # generate command for SI POST value + get_xe_si $xe_port $SI_POST_IDX $TYPE + local post_cmd="phy xe${xe_port} CL93N72_UT_CTL2r CL93N72_TXFIR_POST=${SI_VAL}" + # generate command for SI MAIN value + get_xe_si $xe_port $SI_MAIN_IDX $TYPE + local main_cmd="phy xe${xe_port} CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=${SI_VAL}" + # generate command for SI AMP CONTROL value + get_xe_si $xe_port $SI_AMP_IDX $TYPE + local amp_val=$SI_VAL + get_xe_si $xe_port $SI_DRI_IDX $TYPE + local dri_val=$SI_VAL + local amp_cmd="phy xe${xe_port} AMS_TX_CTL2r AMS_TX_AMP_CTL=${amp_val} AMS_TX_DRIVERMODE=${dri_val}" + # apply bcmcmd + bcmcmd "${pre_cmd};${post_cmd};${main_cmd};${amp_cmd}" +} + +# set aoc si value for ce port +function _qsfp_ce_si_set { + # convert PORT to ce port index + local ce_port=$(( $PORT - 48 )) + for lane in {0..3}; + do + # generate command for SI PRE value + get_ce_si $ce_port $lane $SI_PRE_IDX $TYPE + local pre_cmd="phy ce${ce_port} CL93N72_UT_CTL2r.${lane} CL93N72_TXFIR_PRE=${SI_VAL}" + # generate command for SI POST value + get_ce_si $ce_port $lane $SI_POST_IDX $TYPE + local post_cmd="phy ce${ce_port} CL93N72_UT_CTL2r.${lane} CL93N72_TXFIR_POST=${SI_VAL}" + # generate command for SI MAIN value + get_ce_si $ce_port $lane $SI_MAIN_IDX $TYPE + local main_cmd="phy ce${ce_port} CL93N72_UT_CTL3r.${lane} CL93N72_TXFIR_MAIN=${SI_VAL}" + # generate command for SI AMP CONTROL value + get_ce_si $ce_port $lane $SI_AMP_IDX $TYPE + local amp_val=$SI_VAL + get_ce_si $ce_port $lane $SI_AMP_IDX $TYPE + local dri_val=$SI_VAL + local amp_cmd="phy ce${ce_port} AMS_TX_CTL2r.${lane} AMS_TX_AMP_CTL=${amp_val} AMS_TX_DRIVERMODE=${dri_val}" + # apply bcmcmd + bcmcmd "${pre_cmd};${post_cmd};${main_cmd};${amp_cmd}" + done +} + +#QSFP SI value set +function _qsfp_si_set { + if [[ $PORT -le 47 && $PORT -ge 0 ]]; then + # xe port + _qsfp_xe_si_set + else + # ce port + _qsfp_ce_si_set + fi +} + +function _util_input_check { + # input parameter validation + if [[ $1 -lt $2 || $1 -gt $3 ]]; then + echo "Please input number $2~$3" + exit + fi +} + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} ${AOC_TYPE} [${MIN_PORT}-${MAX_PORT}]" + echo " : ${0} ${DAC_TYPE} [${MIN_PORT}-${MAX_PORT}]" + echo "----------------------------------------------------" +} + +#Main Function +function _main { + + # TODO: remove after SI value ready + #exit ${TRUE} + + if [ -z $PORT ]; then + _help + exit ${FALSE} + fi + + if [ "${TYPE}" == "help" ]; then + _help + elif [ "${TYPE}" == "${AOC_TYPE}" ] || [ "${TYPE}" == "${DAC_TYPE}" ]; then + _util_input_check "$PORT" "$MIN_PORT" "$MAX_PORT" + _qsfp_si_set + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/s8900_64xc_monitor.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/s8900_64xc_monitor.sh new file mode 100755 index 000000000000..8bfb22328003 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s8900-64xc/utils/s8900_64xc_monitor.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=5 +I2C_UTILS="/usr/sbin/i2c_utils.sh" + + +# LED status monitor +function _led_monitor { + ${I2C_UTILS} i2c_led_fan_status_set >/dev/null + ${I2C_UTILS} i2c_led_psu_status_set >/dev/null + ${I2C_UTILS} i2c_led_fan_tray_status_set >/dev/null +} + +# main function +function _main { + while true + do + _led_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/README.md b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/README.md new file mode 100644 index 000000000000..78f828e25310 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/README.md @@ -0,0 +1,185 @@ +# Ingrasys S9100-32X Platform Driver for SONiC + +Copyright (C) 2016 Ingrasys, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +## Licensing terms + +The Licensing terms of the files within this project is split 2 parts. +The Linux kernel is released under the GNU General Public License version 2. +All other code is released under the GNU General Public License version 3. +Please see the LICENSE file for copies of both licenses. + +## Contents of this package + + - service/ + > Service config files for platform initialization and monitoring + - utils/ + > Scripts useful during platform bringup and sysfs function + - conf/ + > Platform configure files. + +## Kernel modules and drivers + +The driver for interacting with Ingrasys S9100-32X is contained in the I2C +kernel module and initialization script. The initialization script loads +the modules in the correct order. It has been built and tested against +the Linux 3.16 kernel. + +The initialization script will modprobe the needed modules, navigate to the +module's device directory in sysfs, and write configuration data to +the kernel module. + +### IGB + +This is OOB Ports on front panel for management plane. + +The IGB module must be loaded first on Ingrasys S9100-32X platform. + +### I2C i801 + +The I2C i801 on Ingrasys S9100-32X can be found in +`/sys/bus/i2c/devices/i2c-0/` + +This is I2C bus for Clock Gen, DIMM channel and digital potentiometers. + +The i801 module must be loaded second on Ingrasys S9100-32X. + +### I2C iSMT + +The I2C iSMT module on S9100-32X can be found in +`/sys/bus/i2c/devices/i2c-1/` + +This is I2C bus for CPLD, HWM, power controller and I2C Switches. + +The i801 module must be loaded third on Ingrasys S9100-32X. + +### I2C PCA9548 +The PCA9548 module on S9100-32X can be found in +`/sys/bus/i2c/devices/i2c-2/` , `/sys/bus/i2c/devices/i2c-3/`, +`/sys/bus/i2c/devices/i2c-4/`, `/sys/bus/i2c/devices/i2c-5/`, +`/sys/bus/i2c/devices/i2c-6/`, `/sys/bus/i2c/devices/i2c-7/`, +`/sys/bus/i2c/devices/i2c-8/`, `/sys/bus/i2c/devices/i2c-9/`. + +The pca9548 module for zQSFP module get/set functions, PSU information, +fan status and EEPROM. + +## Hardware components + +The hardware components are initialized in the init script on S9100-32X. +The following describes manual initialization as well as interaction. +The examples below are just for Ingrasys S9100-32X platform. + +### Hardware initialization + +When the sonic-platform-ingrasys-s9100 package is installed on the S9100-32X, +it is automatically initialized. If you want to manual initialization, the +utility command usage as follows: +``` + i2c_utils.sh i2c_init +``` + +### EEPROM + +The EEPROM is including the board SKU, model name, vendor name, serial number, +and other information can be accessed with the specific eeprom kernel module. +After using `modprobe eeprom_mb` to detect the eeprom, it will show up in sysfs. + +The hexdump utility can be used to decode the raw output of the EEPROM. +For example, +``` + bash# echo "mb_eeprom 0x54" > /sys/bus/i2c/devices/i2c-9/new_device + bash# cat /sys/bus/i2c/drivers/mb_eeprom/9-0054/eeprom | hexdump -C +``` + +### Front panel LEDs + +LEDs can be setup on/off by using i2c utility `/usr/sbin/i2c_utils.sh`. +Utility function command usage as follows: + +``` +Status LED: + i2c_utils.sh i2c_sys_led green|amber on|off + +Fan status LED: + i2c_utils.sh i2c_fan_led green|amber on|off + +PSU1 status LED: + i2c_utils.sh i2c_psu1_led green|amber on|off + +PSU2 status LED: + i2c_utils.sh i2c_psu2_led green|amber on|off + +``` +QSFP Module Port LEDs control by ASIC library. + + +### Fan speed + +Fan speed are controlled by the w83795 kernel module. +It can be found in `/sys/class/hwmon/hwmon1/device/`. +If they were compiled as modules, you will need to modprobe w83795 for +their sysfs entries to show up. Each fan has an `fan_input` file +for reading the fan speed. And `pwm1` setting fan1 to fan4, +`pwm2` setting fan5 to fan8. + +There is docker-platform-monitor container installed fancontrol package that can +automatic control platform fan speed. + + +### Temperature sensors + +Temperature sensors are controlled by the w83795 kernel +module. It can be found in `/sys/class/hwmon/hwmon1/device/`. +If they were compiled as modules, then you will need to modprobe w83795 for +their sysfs entries to show up. +`temp1_input` is front MAC temperature sensor. `temp2_input` is rear MAC +temperature sensor. + +There is docker-platform-monitor container installed lm-sensors package that can +monitor platform temperature. And `sensors` command can show each +temperature sensors status. + +### Power supplies + +Power supplies status and its EEPROM info can be used i2c utility +`/usr/sbin/i2c_utils.sh` to get. +The usage as follows: +``` +PSU EEPROM: + i2c_utils.sh i2c_psu_eeprom_get + hexdump -C psu0.rom + hexdump -C psu1.rom + +PSU Status: + i2c_utils.sh i2c_psu_status +``` + +### QSFPs +QSFP modules are managed by the pca9548 kernel driver. +The i2c utility `/usr/sbin/i2c_utils.sh` can be used to get status and +module EEPROM informations. +The usage as follows: +``` +QSFP EEPROM: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + +QSFP Insert Event: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + 0 => not insert + 1 => inserted +``` + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/Makefile b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/Makefile new file mode 100755 index 000000000000..0247bd586f63 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := eeprom_mb.o +obj-m+= i2c_cpld.o \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/eeprom_mb.c b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/eeprom_mb.c new file mode 100755 index 000000000000..01ce44ad3fee --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/eeprom_mb.c @@ -0,0 +1,212 @@ +/* + * Copyright (C) 1998, 1999 Frodo Looijaard and + * Philip Edelbrock + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003 IBM Corp. + * Copyright (C) 2004 Jean Delvare + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, + 0x55, 0x56, 0x57, I2C_CLIENT_END }; + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void mb_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, ((u8)addr >> 8) & 0xFF, (u8)addr & 0xFF); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t mb_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + mb_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static struct bin_attribute mb_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = mb_eeprom_read, +}; + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int mb_eeprom_detect(struct i2c_client *client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + + /* EDID EEPROMs are often 24C00 EEPROMs, which answer to all + addresses 0x50-0x57, but we only care about 0x50. So decline + attaching to addresses >= 0x51 on DDC buses */ + if (!(adapter->class & I2C_CLASS_SPD) && client->addr >= 0x51) { + return -ENODEV; + } + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE) + && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + return -ENODEV; + } + + strlcpy(info->type, "eeprom", I2C_NAME_SIZE); + + return 0; +} + +static int mb_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &mb_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int mb_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &mb_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id mb_eeprom_id[] = { + { "mb_eeprom", 0 }, + { } +}; + +static struct i2c_driver mb_eeprom_driver = { + .driver = { + .name = "mb_eeprom", + }, + .probe = mb_eeprom_probe, + .remove = mb_eeprom_remove, + .id_table = mb_eeprom_id, + + .class = I2C_CLASS_DDC | I2C_CLASS_SPD, + .detect = mb_eeprom_detect, + .address_list = normal_i2c, +}; + +module_i2c_driver(mb_eeprom_driver); + +MODULE_AUTHOR("Wade "); +MODULE_DESCRIPTION("Ingrasys S9100 Mother Borad EEPROM driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/i2c_cpld.c b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/i2c_cpld.c new file mode 100755 index 000000000000..626c63177b50 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/i2c_cpld.c @@ -0,0 +1,448 @@ +/* + * S9100-32X I2C CPLD driver + * + * Copyright (C) 2017 Ingrasys, Inc. + * Wade He + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "i2c_cpld.h" + +#ifdef DEBUG + #define DEBUG_PRINT(fmt, args...) \ + printk(KERN_INFO "%s[%d]: " fmt "\r\n", \ + __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define I2C_READ_BYTE_DATA(ret, lock, i2c_client, reg) \ +{ \ + mutex_lock(lock); \ + ret = i2c_smbus_read_byte_data(i2c_client, reg); \ + mutex_unlock(lock); \ +} +#define I2C_WRITE_BYTE_DATA(ret, lock, i2c_client, reg, val) \ +{ \ + mutex_lock(lock); \ + ret = i2c_smbus_write_byte_data(i2c_client, reg, val); \ + mutex_unlock(lock); \ +} + +/* CPLD sysfs attributes index */ +enum i2c_cpld_sysfs_attributes { + CPLD_ACCESS_REG, + CPLD_REGISTER_VAL, + CPLD_PORT_START, + CPLD_PORTS, + CPLD_VERSION, + CPLD_ID, + CPLD_BOARD_TYPE, + CPLD_EXT_BOARD_TYPE, + CPLD_PW_GOOD, + CPLD_PW_ABS, +}; + +/* CPLD sysfs attributes hook functions */ +static ssize_t read_access_register(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_access_register(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_register_value(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t write_register_value(struct device *dev, + struct device_attribute *da, const char *buf, size_t count); +static ssize_t read_cpld_version(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_board_type(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_ext_board_type(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_pw_good(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t read_pw_abs(struct device *dev, + struct device_attribute *da, char *buf); + +static LIST_HEAD(cpld_client_list); /* client list for cpld */ +static struct mutex list_lock; /* mutex for client list */ + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +struct cpld_data { + int index; /* CPLD index */ + struct mutex access_lock; /* mutex for cpld access */ + u8 access_reg; /* register to access */ +}; + +/* CPLD device id and data */ +static const struct i2c_device_id i2c_cpld_id[] = { + { "i2c_cpld", i2c_cpld }, + {} +}; + +/* Addresses scanned for i2c_cpld */ +static const unsigned short cpld_i2c_addr[] = { 0x33, I2C_CLIENT_END }; +/* platform sysfs object */ +extern struct kobject *s9230_64x_kobj; + + +/* define all support register access of cpld in attribute */ +static SENSOR_DEVICE_ATTR(cpld_access_register, S_IWUSR | S_IRUGO, + read_access_register, write_access_register, CPLD_ACCESS_REG); +static SENSOR_DEVICE_ATTR(cpld_register_value, S_IWUSR | S_IRUGO, + read_register_value, write_register_value, CPLD_REGISTER_VAL); +static SENSOR_DEVICE_ATTR(cpld_version, S_IRUGO, + read_cpld_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(cpld_board_type, S_IRUGO, + read_board_type, NULL, CPLD_BOARD_TYPE); +static SENSOR_DEVICE_ATTR(cpld_ext_board_type, S_IRUGO, + read_ext_board_type, NULL, CPLD_EXT_BOARD_TYPE); +static SENSOR_DEVICE_ATTR(cpld_pw_good, S_IRUGO, + read_pw_good, NULL, CPLD_PW_GOOD); +static SENSOR_DEVICE_ATTR(cpld_pw_abs, S_IRUGO, + read_pw_abs, NULL, CPLD_PW_ABS); + + +/* define support attributes of cpldx , total 5 */ +/* cpld 1 */ +static struct attribute *i2c_cpld_attributes[] = { + &sensor_dev_attr_cpld_access_register.dev_attr.attr, + &sensor_dev_attr_cpld_register_value.dev_attr.attr, + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_cpld_board_type.dev_attr.attr, + &sensor_dev_attr_cpld_ext_board_type.dev_attr.attr, + &sensor_dev_attr_cpld_pw_good.dev_attr.attr, + &sensor_dev_attr_cpld_pw_abs.dev_attr.attr, + NULL +}; + +/* cpld 1 attributes group */ +static const struct attribute_group i2c_cpld_group = { + .attrs = i2c_cpld_attributes, +}; + +/* read access register from cpld data */ +static ssize_t read_access_register(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg = data->access_reg; + + return sprintf(buf, "0x%x\n", reg); +} + +/* write access register to cpld data */ +static ssize_t write_access_register(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + + if (kstrtou8(buf, 0, ®) < 0) + return -EINVAL; + + data->access_reg = reg; + return count; +} + +/* read the value of access register in cpld data */ +static ssize_t read_register_value(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg = data->access_reg; + int reg_val; + + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + + if (reg_val < 0) + return -1; + + return sprintf(buf, "0x%x\n", reg_val); +} + +/* wrtie the value to access register in cpld data */ +static ssize_t write_register_value(struct device *dev, + struct device_attribute *da, + const char *buf, + size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + int ret = -EIO; + u8 reg = data->access_reg; + u8 reg_val; + + if (kstrtou8(buf, 0, ®_val) < 0) + return -EINVAL; + + I2C_WRITE_BYTE_DATA(ret, &data->access_lock, client, reg, reg_val); + + return count; +} + +/* get cpdl version register value */ +static ssize_t read_cpld_version(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_VERSION) { + reg = CPLD_VERSION_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get board type register value */ +static ssize_t read_board_type(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_BOARD_TYPE) { + reg = CPLD_BOARD_TYPE_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get extend board type register value */ +static ssize_t read_ext_board_type(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_EXT_BOARD_TYPE) { + reg = CPLD_EXT_BOARD_TYPE_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get extend board type register value */ +static ssize_t read_pw_good(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_PW_GOOD) { + reg = CPLD_PW_GOOD_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* get extend board type register value */ +static ssize_t read_pw_abs(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 reg; + int reg_val; + + if (attr->index == CPLD_PW_ABS) { + reg = CPLD_PW_ABS_REG; + I2C_READ_BYTE_DATA(reg_val, &data->access_lock, client, reg); + if (reg_val < 0) + return -1; + return sprintf(buf, "0x%02x\n", reg_val); + } + return -1; +} + +/* add valid cpld client to list */ +static void i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = NULL; + + node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + if (!node) { + dev_info(&client->dev, + "Can't allocate cpld_client_node for index %d\n", + client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +/* remove exist cpld client in list */ +static void i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + list_for_each(list_node, &cpld_client_list) { + cpld_node = list_entry(list_node, + struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + mutex_unlock(&list_lock); +} + +/* cpld drvier probe */ +static int i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct cpld_data *data = NULL; + + data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + /* init cpld data for client */ + i2c_set_clientdata(client, data); + mutex_init(&data->access_lock); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_info(&client->dev, + "i2c_check_functionality failed (0x%x)\n", + client->addr); + status = -EIO; + goto exit; + } + + + status = sysfs_create_group(&client->dev.kobj,&i2c_cpld_group); + + if (status) + goto exit; + + dev_info(&client->dev, "chip found\n"); + + /* add probe chip to client list */ + i2c_cpld_add_client(client); + + return 0; +exit: + sysfs_remove_group(&client->dev.kobj, &i2c_cpld_group); + return status; +} + +/* cpld drvier remove */ +static int i2c_cpld_remove(struct i2c_client *client) +{ + + sysfs_remove_group(&client->dev.kobj, &i2c_cpld_group); + + i2c_cpld_remove_client(client); + return 0; +} + +MODULE_DEVICE_TABLE(i2c, i2c_cpld_id); + +static struct i2c_driver i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "i2c_cpld", + }, + .probe = i2c_cpld_probe, + .remove = i2c_cpld_remove, + .id_table = i2c_cpld_id, + .address_list = cpld_i2c_addr, +}; + +static int __init i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&i2c_cpld_driver); +} + +static void __exit i2c_cpld_exit(void) +{ + i2c_del_driver(&i2c_cpld_driver); +} + +MODULE_AUTHOR("Wade He "); +MODULE_DESCRIPTION("Ingrasys S9100-32X Platform i2c cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(i2c_cpld_init); +module_exit(i2c_cpld_exit); + + + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/i2c_cpld.h b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/i2c_cpld.h new file mode 100755 index 000000000000..e103b05c717a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/modules/i2c_cpld.h @@ -0,0 +1,197 @@ +/* + * + * S9100-32X I2C CPLD driver header file + * + * Copyright (C) 2017 Ingrasys, Inc. + * Wade He + * + * 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, see . + */ + +#ifndef I2C_CPLD_H +#define I2C_CPLD_H + +// remove debug before release +#define DEBUG + +/* CPLD device index value */ +enum cpld_id { + i2c_cpld +}; + +/* port number on CPLD */ +#define CPLD_1_PORT_NUM 12 +#define CPLD_2_PORT_NUM 13 + +/* QSFP port number */ +#define QSFP_MAX_PORT_NUM 64 +#define QSFP_MIN_PORT_NUM 1 + +/* SFP+ port number */ +#define SFP_MAX_PORT_NUM 2 +#define SFP_MIN_PORT_NUM 1 + + +/* CPLD registers */ +#define CPLD_BOARD_TYPE_REG 0x0 +#define CPLD_EXT_BOARD_TYPE_REG 0x7 +#define CPLD_VERSION_REG 0x1 +#define CPLD_PW_GOOD_REG 0x2 +#define CPLD_PW_ABS_REG 0x3 + + +/* bit definition for register value */ + +enum CPLD_RESET_CONTROL_BITS { + CPLD_RESET_CONTROL_SWRST_BIT, + CPLD_RESET_CONTROL_CP2104RST_BIT, + CPLD_RESET_CONTROL_82P33814RST_BIT, + CPLD_RESET_CONTROL_BMCRST_BIT, +}; + +/* bit field structure for register value */ +struct cpld_reg_board_type_t { + u8 build_rev:2; + u8 hw_rev:2; + u8 board_id:4; +}; + +struct cpld_reg_version_t { + u8 revision:6; + u8 release:1; + u8 reserve:1; +}; + +struct cpld_reg_pw_good_t { + u8 reserve1:3; + u8 psu1:1; + u8 psu2:1; + u8 reserve2:3; +}; + +struct cpld_reg_pw_abs_t { + u8 psu1:1; + u8 psu2:1; + u8 reserve:6; +}; + +/* common manipulation */ +#define INVALID(i, min, max) ((i < min) || (i > max) ? 1u : 0u) +#define READ_BIT(val, bit) ((0u == (val & (1<bf_name) +#define READ_BF_1(bf_struct, val, bf_name, bf_value) \ + bf_struct bf; \ + bf.data = val; \ + bf_value = bf.bf_name +#define BOARD_TYPE_BUILD_REV_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, build_rev, res) +#define BOARD_TYPE_HW_REV_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, hw_rev, res) +#define BOARD_TYPE_BOARD_ID_GET(val, res) \ + READ_BF(cpld_reg_board_type_t, val, board_id, res) +#define CPLD_VERSION_REV_GET(val, res) \ + READ_BF(cpld_reg_version_t, val, revision, res) +#define CPLD_VERSION_REL_GET(val, res) \ + READ_BF(cpld_reg_version_t, val, release, res) +#define CPLD_PSU1_PW_GOOD_GET(val, res) \ + READ_BF(cpld_reg_pw_good_t, val, psu1, res) +#define CPLD_PSU2_PW_GOOD_GET(val, res) \ + READ_BF(cpld_reg_pw_good_t, val, psu2, res) +#define CPLD_PSU1_PW_ABS_GET(val, res) \ + READ_BF(cpld_reg_pw_abs_t, val, psu1, res) +#define CPLD_PSU2_PW_ABS_GET(val, res) \ + READ_BF(cpld_reg_pw_abs_t, val, psu2, res) +/* QSFP/SFP registers manipulation */ +#define QSFP_TO_CPLD_IDX(qsfp_port, cpld_index, cpld_port) \ +{ \ + if (QSFP_MIN_PORT_NUM <= qsfp_port && qsfp_port <= CPLD_1_PORT_NUM) { \ + cpld_index = cpld1; \ + cpld_port = qsfp_port - 1; \ + } else if (CPLD_1_PORT_NUM < qsfp_port \ + && qsfp_port <= QSFP_MAX_PORT_NUM) { \ + cpld_index = cpld2 + (qsfp_port - 1 - CPLD_1_PORT_NUM) \ + / CPLD_2_PORT_NUM; \ + cpld_port = (qsfp_port - 1 - CPLD_1_PORT_NUM) % \ + CPLD_2_PORT_NUM; \ + } else { \ + cpld_index = 0; \ + cpld_port = 0; \ + } \ +} +#define SFP_TO_CPLD_IDX(sfp_port, cpld_index) \ + (cpld_index = sfp_port - SFP_MIN_PORT_NUM) +#define QSFP_PORT_STATUS_REG(cpld_port) \ + (CPLD_QSFP_PORT_STATUS_BASE_REG + cpld_port) +#define QSFP_PORT_CONFIG_REG(cpld_port) \ + (CPLD_QSFP_PORT_CONFIG_BASE_REG + cpld_port) +#define QSFP_PORT_INT_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_QSFP_PORT_STATUS_INT_BIT) +#define QSFP_PORT_ABS_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_QSFP_PORT_STATUS_ABS_BIT) +#define QSFP_PORT_RESET_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_LPMODE_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define QSFP_PORT_RESET_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_RESET_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT) +#define QSFP_PORT_LPMODE_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define QSFP_PORT_LPMODE_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) +#define SFP_PORT_PRESENT_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_STATUS_PRESENT_BIT) + + #define SFP_PORT_TXFAULT_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_STATUS_TXFAULT_BIT) + #define SFP_PORT_RXLOS_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_STATUS_RXLOS_BIT) + #define SFP_PORT_TXDIS_BIT_GET(port_status_value) \ + READ_BIT(port_status_value, CPLD_SFP_PORT_CONFIG_TXDIS_BIT) +#define SFP_PORT_RS_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_RS_BIT) +#define SFP_PORT_TS_BIT_GET(port_config_value) \ + READ_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TS_BIT) +#define SFP_PORT_TXDIS_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TXDIS_BIT) +#define SFP_PORT_TXDIS_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TXDIS_BIT) +#define SFP_PORT_RS_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_RS_BIT) +#define SFP_PORT_RS_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_RS_BIT) +#define SFP_PORT_TS_BIT_SET(port_config_value) \ + SET_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TS_BIT) +#define SFP_PORT_TS_BIT_CLEAR(port_config_value) \ + CLEAR_BIT(port_config_value, CPLD_SFP_PORT_CONFIG_TS_BIT) + +/* CPLD access functions */ +extern int i2c_cpld_get_qsfp_port_status_val(u8 port_num); +extern int i2c_cpld_get_qsfp_port_config_val(u8 port_num); +extern int i2c_cpld_set_qsfp_port_config_val(u8 port_num, u8 reg_val); +extern int i2c_cpld_get_sfp_port_status_val(u8 port_num); +extern int i2c_cpld_get_sfp_port_config_val(u8 port_num); +extern int i2c_cpld_set_sfp_port_config_val(u8 port_num, u8 reg_val); +extern u8 fp_port_to_phy_port(u8 fp_port); +#endif + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/service/qsfp-monitor.service b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/service/qsfp-monitor.service new file mode 100644 index 000000000000..584d6fcae895 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/service/qsfp-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description= This QSFP Monitor service is to setup QSFP SI. +Requires=s9100-monitor.service +After=s9100-monitor.service + +[Service] +ExecStart=/usr/sbin/qsfp_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/service/s9100-monitor.service b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/service/s9100-monitor.service new file mode 100644 index 000000000000..5e074782a852 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/service/s9100-monitor.service @@ -0,0 +1,19 @@ +[Unit] +Description= This Platform Monitor service is to initialize platform and monitor platform. +Before=platform-monitor.service +After=sysinit.target +Wants=fancontrol.service +Wants=qsfp-monitor.service +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/sbin/i2c_utils.sh i2c_init +ExecStart=/usr/sbin/s9100_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/i2c_utils.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/i2c_utils.sh new file mode 100755 index 000000000000..bdcd4f1d7f9e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/i2c_utils.sh @@ -0,0 +1,1518 @@ +#!/bin/bash + +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +VERSION="1.0.0" +TRUE=200 +FALSE=404 + +EXEC_FUNC=${1} +COLOR_LED=${2} +QSFP_PORT=${2} +QSFP_ACTION=${2} +MB_EEPROM_ACTION=${2} +ONOFF_LED=${3} +FAN_TRAY=${4} + +############################################################ +# Distributor ID: Debian +# Description: Debian GNU/Linux 8.6 (jessie) +# Release: 8.6 +# Codename: jessie +# Linux debian 3.16.0-4-amd64 #1 +# SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux +############################################################ + +# Color Definition +COLOR_TITLE="\e[1;32m" ### Green ### +COLOR_WARNING="\e[1;33m" ### Yellow ### +COLOR_ERROR="\e[1;31m" ### Red ### +COLOR_END="\e[0m" ### END ### + +NUM_IGB_DEVICE=0 +NUM_I801_DEVICE=0 +NUM_ISMT_DEVICE=$(( ${NUM_I801_DEVICE} + 1 )) +NUM_MUX1_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 2 )) +NUM_MUX1_CHAN1_DEVICE=$(( ${NUM_I801_DEVICE} + 3 )) +NUM_MUX1_CHAN2_DEVICE=$(( ${NUM_I801_DEVICE} + 4 )) +NUM_MUX1_CHAN3_DEVICE=$(( ${NUM_I801_DEVICE} + 5 )) +NUM_MUX1_CHAN4_DEVICE=$(( ${NUM_I801_DEVICE} + 6 )) +NUM_MUX1_CHAN5_DEVICE=$(( ${NUM_I801_DEVICE} + 7 )) +NUM_MUX1_CHAN6_DEVICE=$(( ${NUM_I801_DEVICE} + 8 )) +NUM_MUX1_CHAN7_DEVICE=$(( ${NUM_I801_DEVICE} + 9 )) +NUM_MUX3_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 10 )) +NUM_MUX4_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 18 )) +NUM_MUX5_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 26 )) +NUM_MUX6_CHAN0_DEVICE=$(( ${NUM_I801_DEVICE} + 34 )) + +PATH_SYS_I2C_DEVICES="/sys/bus/i2c/devices" +PATH_HWMON_ROOT_DEVICES="/sys/class/hwmon" +PATH_HWMON_W83795_DEVICE="${PATH_HWMON_ROOT_DEVICES}/hwmon1" +PATH_I801_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}" +PATH_ISMT_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_ISMT_DEVICE}" +PATH_MUX_CHAN0_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN0_DEVICE}" +PATH_MUX_CHAN1_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN1_DEVICE}" +PATH_MUX_CHAN2_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN2_DEVICE}" +PATH_MUX_CHAN3_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN3_DEVICE}" +PATH_MUX_CHAN4_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN4_DEVICE}" +PATH_MUX_CHAN5_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN5_DEVICE}" +PATH_MUX_CHAN6_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN6_DEVICE}" +PATH_MUX_CHAN7_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN7_DEVICE}" + +#Power Supply Status +PSU_DC_ON=1 +PSU_DC_OFF=0 +PSU_EXIST=1 +PSU_NOT_EXIST=0 + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} i2c_init" + echo " : ${0} i2c_deinit" + echo " : ${0} i2c_temp_init" + echo " : ${0} i2c_fan_init" + echo " : ${0} i2c_volmon_init" + echo " : ${0} i2c_io_exp_init" + echo " : ${0} i2c_gpio_init" + echo " : ${0} i2c_gpio_deinit" + echo " : ${0} i2c_led_test" + echo " : ${0} i2c_psu_eeprom_get" + echo " : ${0} i2c_mb_eeprom_get" + echo " : ${0} i2c_qsfp_eeprom_get [1-32]" + echo " : ${0} i2c_qsfp_eeprom_init new|delete" + echo " : ${0} i2c_mb_eeprom_init new|delete" + echo " : ${0} i2c_qsfp_status_get [1-32]" + echo " : ${0} i2c_qsfp_type_get [1-32]" + echo " : ${0} i2c_board_type_get" + echo " : ${0} i2c_psu_status" + echo " : ${0} i2c_led_psu_status_set" + echo " : ${0} i2c_led_fan_status_set" + echo " : ${0} i2c_led_fan_tray_status_set" + echo " : ${0} i2c_cpld_version" + echo " : ${0} i2c_front_temp" + echo " : ${0} i2c_rear_temp" + echo " : ${0} i2c_test_all" + echo " : ${0} i2c_sys_led green|amber on|off" + echo " : ${0} i2c_fan_led green|amber on|off" + echo " : ${0} i2c_psu1_led green|amber on|off" + echo " : ${0} i2c_psu2_led green|amber on|off" + echo " : ${0} i2c_fan_tray_led green|amber on|off [1-4]" + echo "----------------------------------------------------" +} + +#Pause function +function _pause { + read -p "$*" +} + +#Retry command function +function _retry { + local i + for i in {1..5}; + do + eval "${*}" && break || echo "retry"; sleep 1; + done +} + +#I2C Init +function _i2c_init { + echo "=========================================================" + echo "# Description: I2C Init" + echo "=========================================================" + + rmmod i2c_ismt + rmmod i2c_i801 + modprobe i2c_i801 + modprobe i2c_ismt + modprobe i2c_dev + modprobe i2c_mux_pca954x force_deselect_on_exit=1 + + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x70' > ${PATH_ISMT_DEVICE}/new_device" + else + echo "pca9548 0x70 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX3_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x71' > ${PATH_MUX_CHAN0_DEVICE}/new_device" + else + echo "pca9548 0x71 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX4_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x72' > ${PATH_MUX_CHAN1_DEVICE}/new_device" + else + echo "pca9548 0x72 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX5_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x73' > ${PATH_MUX_CHAN2_DEVICE}/new_device" + else + echo "pca9548 0x73 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX6_CHAN0_DEVICE}" ]; then + _retry "echo 'pca9548 0x74' > ${PATH_MUX_CHAN3_DEVICE}/new_device" + else + echo "pca9548 0x74 already init." + fi + if [ ! -e "${PATH_SYS_I2C_DEVICES}/${NUM_MUX1_CHAN6_DEVICE}-0075" ]; then + _retry "echo 'pca9546 0x75' > ${PATH_MUX_CHAN6_DEVICE}/new_device" + else + echo "pca9548 0x75 already init." + fi + #Init CPLD LED_CLR Register (Front Port LED) + i2cset -y ${NUM_I801_DEVICE} 0x33 0x34 0x10 + + rmmod coretemp + rmmod jc42 + rmmod w83795 + _i2c_temp_init + _i2c_volmon_init + modprobe coretemp + modprobe w83795 + modprobe jc42 + modprobe eeprom + modprobe eeprom_mb + modprobe gpio-pca953x + _i2c_fan_init + _i2c_io_exp_init + _i2c_gpio_init + _i2c_cpld_init + _i2c_qsfp_eeprom_init "new" + _i2c_mb_eeprom_init "new" + _i2c_psu_eeprom_init + _i2c_led_psu_status_set + _i2c_led_fan_status_set + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_sys_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_sys_led + _config_rmem +} + +#I2C Deinit +function _i2c_deinit { + _i2c_gpio_deinit + for mod in i2c_cpld coretemp jc42 w83795 eeprom_mb gpio-pca953x i2c_mux_pca954x i2c_ismt i2c_i801; + do + [ "$(lsmod | grep "^$mod ")" != "" ] && rmmod $mod + done +} + +#Temperature sensor Init +function _i2c_temp_init { + echo -n "TEMP INIT..." + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x00 0x80 + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x05 0x7F + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x04 0x0A + echo "Done" +} + +#FAN Init +function _i2c_fan_init { + echo -n "FAN INIT..." + if [ -e "${PATH_HWMON_W83795_DEVICE}" ]; then + echo 120 > ${PATH_HWMON_W83795_DEVICE}/device/pwm1 + echo 120 > ${PATH_HWMON_W83795_DEVICE}/device/pwm2 + echo "SUCCESS" + else + echo "FAIL" + fi + +} + +#VOLMON Init +function _i2c_volmon_init { + echo -n "VOLMON INIT..." + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x00 0x80 + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x02 0xFF + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x03 0x50 + i2cset -y -r ${NUM_I801_DEVICE} 0x2F 0x04 0x0A + echo "Done" +} + +#IO Expander Init +function _i2c_io_exp_init { + echo "=========================================================" + echo "# Description: I2C IO Expender Init" + echo "=========================================================" + #SMBUS0 IO_EXPENDER + i2cset -y -r ${NUM_I801_DEVICE} 0x27 4 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x27 5 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x27 2 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x27 3 0x00 + i2cset -y -r ${NUM_I801_DEVICE} 0x27 6 0xFF + i2cset -y -r ${NUM_I801_DEVICE} 0x27 7 0xFF + + #SMBUS1 + #ABS + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x20 6 0xFF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x20 7 0xFF + + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x21 6 0xFF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x21 7 0xFF + + #Transcevior INT + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 6 0xFF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x22 7 0xFF + + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x23 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x23 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x23 6 0xFF + i2cset -y -r ${NUM_MUX1_CHAN4_DEVICE} 0x23 7 0xFF + + echo "Init ZQSFP IO Expender" + echo "set ZQSFP LP_MODE = 0" + #set ZQSFP LP_MODE = 0 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 2 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x20 7 0x00 + + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 2 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x21 7 0x00 + + echo "set ZQSFP RST = 1" + #set ZQSFP RST = 1 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 2 0xFF + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 3 0xFF + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x22 7 0x00 + + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 2 0xFF + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 3 0xFF + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x23 7 0x00 + + echo "set ZQSFP mode" + #ZQSFP mode + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x24 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x24 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x24 2 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x24 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x24 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x24 7 0x00 + + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x25 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x25 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x25 2 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x25 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x25 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN5_DEVICE} 0x25 7 0x00 + + #ZQSFP/SFP+/E-Card General + i2cset -y -r ${NUM_MUX1_CHAN6_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN6_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN6_DEVICE} 0x20 6 0xFF + i2cset -y -r ${NUM_MUX1_CHAN6_DEVICE} 0x20 7 0xFF + + #LED board after PVT (S9100_IO_EXP_LED_ID) + echo "Init LED IO Expender" + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 6 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 7 0x00 + + #PSU I/O (S9100_IO_EXP_PSU_ID) + echo "Init PSU IO Expender" + i2cset -y -r ${NUM_MUX1_CHAN6_DEVICE} 0x23 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN6_DEVICE} 0x23 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN6_DEVICE} 0x23 2 0x00 + i2cset -y -r ${NUM_MUX1_CHAN6_DEVICE} 0x23 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN6_DEVICE} 0x23 6 0xBB + i2cset -y -r ${NUM_MUX1_CHAN6_DEVICE} 0x23 7 0xFF + + #FAN I/O (S9100_IO_EXP_FAN_ID) + echo "Init FAN IO Expender" + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x20 4 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x20 5 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x20 2 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x20 3 0x00 + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x20 6 0xCC + i2cset -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x20 7 0xCC +} + +#GPIO Init +function _i2c_gpio_init { + #ABS Port 0-15 + echo "pca9535 0x20" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/new_device + echo 240 > /sys/class/gpio/export + echo 241 > /sys/class/gpio/export + echo 242 > /sys/class/gpio/export + echo 243 > /sys/class/gpio/export + echo 244 > /sys/class/gpio/export + echo 245 > /sys/class/gpio/export + echo 246 > /sys/class/gpio/export + echo 247 > /sys/class/gpio/export + echo 248 > /sys/class/gpio/export + echo 249 > /sys/class/gpio/export + echo 250 > /sys/class/gpio/export + echo 251 > /sys/class/gpio/export + echo 252 > /sys/class/gpio/export + echo 253 > /sys/class/gpio/export + echo 254 > /sys/class/gpio/export + echo 255 > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio241/active_low #zQSFP00 + echo 1 > /sys/class/gpio/gpio240/active_low #zQSFP01 + echo 1 > /sys/class/gpio/gpio243/active_low #zQSFP02 + echo 1 > /sys/class/gpio/gpio242/active_low #zQSFP03 + echo 1 > /sys/class/gpio/gpio245/active_low #zQSFP04 + echo 1 > /sys/class/gpio/gpio244/active_low #zQSFP05 + echo 1 > /sys/class/gpio/gpio247/active_low #zQSFP06 + echo 1 > /sys/class/gpio/gpio246/active_low #zQSFP07 + echo 1 > /sys/class/gpio/gpio249/active_low #zQSFP08 + echo 1 > /sys/class/gpio/gpio248/active_low #zQSFP09 + echo 1 > /sys/class/gpio/gpio251/active_low #zQSFP10 + echo 1 > /sys/class/gpio/gpio250/active_low #zQSFP11 + echo 1 > /sys/class/gpio/gpio253/active_low #zQSFP12 + echo 1 > /sys/class/gpio/gpio252/active_low #zQSFP13 + echo 1 > /sys/class/gpio/gpio255/active_low #zQSFP14 + echo 1 > /sys/class/gpio/gpio254/active_low #zQSFP15 + + #ABS Port 16-31 + echo "pca9535 0x21" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/new_device + echo 224 > /sys/class/gpio/export + echo 225 > /sys/class/gpio/export + echo 226 > /sys/class/gpio/export + echo 227 > /sys/class/gpio/export + echo 228 > /sys/class/gpio/export + echo 229 > /sys/class/gpio/export + echo 230 > /sys/class/gpio/export + echo 231 > /sys/class/gpio/export + echo 232 > /sys/class/gpio/export + echo 233 > /sys/class/gpio/export + echo 234 > /sys/class/gpio/export + echo 235 > /sys/class/gpio/export + echo 236 > /sys/class/gpio/export + echo 237 > /sys/class/gpio/export + echo 238 > /sys/class/gpio/export + echo 239 > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio225/active_low #zQSFP16 + echo 1 > /sys/class/gpio/gpio224/active_low #zQSFP17 + echo 1 > /sys/class/gpio/gpio227/active_low #zQSFP18 + echo 1 > /sys/class/gpio/gpio226/active_low #zQSFP19 + echo 1 > /sys/class/gpio/gpio229/active_low #zQSFP20 + echo 1 > /sys/class/gpio/gpio228/active_low #zQSFP21 + echo 1 > /sys/class/gpio/gpio231/active_low #zQSFP22 + echo 1 > /sys/class/gpio/gpio230/active_low #zQSFP23 + echo 1 > /sys/class/gpio/gpio233/active_low #zQSFP24 + echo 1 > /sys/class/gpio/gpio232/active_low #zQSFP25 + echo 1 > /sys/class/gpio/gpio235/active_low #zQSFP26 + echo 1 > /sys/class/gpio/gpio234/active_low #zQSFP27 + echo 1 > /sys/class/gpio/gpio237/active_low #zQSFP28 + echo 1 > /sys/class/gpio/gpio236/active_low #zQSFP29 + echo 1 > /sys/class/gpio/gpio239/active_low #zQSFP30 + echo 1 > /sys/class/gpio/gpio238/active_low #zQSFP31 + + #INT Port 0-15 + echo "pca9535 0x22" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/new_device + echo 208 > /sys/class/gpio/export + echo 209 > /sys/class/gpio/export + echo 210 > /sys/class/gpio/export + echo 211 > /sys/class/gpio/export + echo 212 > /sys/class/gpio/export + echo 213 > /sys/class/gpio/export + echo 214 > /sys/class/gpio/export + echo 215 > /sys/class/gpio/export + echo 216 > /sys/class/gpio/export + echo 217 > /sys/class/gpio/export + echo 218 > /sys/class/gpio/export + echo 219 > /sys/class/gpio/export + echo 220 > /sys/class/gpio/export + echo 221 > /sys/class/gpio/export + echo 222 > /sys/class/gpio/export + echo 223 > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio208/active_low + echo 1 > /sys/class/gpio/gpio209/active_low + echo 1 > /sys/class/gpio/gpio210/active_low + echo 1 > /sys/class/gpio/gpio211/active_low + echo 1 > /sys/class/gpio/gpio212/active_low + echo 1 > /sys/class/gpio/gpio213/active_low + echo 1 > /sys/class/gpio/gpio214/active_low + echo 1 > /sys/class/gpio/gpio215/active_low + echo 1 > /sys/class/gpio/gpio216/active_low + echo 1 > /sys/class/gpio/gpio217/active_low + echo 1 > /sys/class/gpio/gpio218/active_low + echo 1 > /sys/class/gpio/gpio219/active_low + echo 1 > /sys/class/gpio/gpio220/active_low + echo 1 > /sys/class/gpio/gpio221/active_low + echo 1 > /sys/class/gpio/gpio222/active_low + echo 1 > /sys/class/gpio/gpio223/active_low + + #INT Port 16-31 + echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/new_device + echo 192 > /sys/class/gpio/export + echo 193 > /sys/class/gpio/export + echo 194 > /sys/class/gpio/export + echo 195 > /sys/class/gpio/export + echo 196 > /sys/class/gpio/export + echo 197 > /sys/class/gpio/export + echo 198 > /sys/class/gpio/export + echo 199 > /sys/class/gpio/export + echo 200 > /sys/class/gpio/export + echo 201 > /sys/class/gpio/export + echo 202 > /sys/class/gpio/export + echo 203 > /sys/class/gpio/export + echo 204 > /sys/class/gpio/export + echo 205 > /sys/class/gpio/export + echo 206 > /sys/class/gpio/export + echo 207 > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio192/active_low + echo 1 > /sys/class/gpio/gpio193/active_low + echo 1 > /sys/class/gpio/gpio194/active_low + echo 1 > /sys/class/gpio/gpio195/active_low + echo 1 > /sys/class/gpio/gpio196/active_low + echo 1 > /sys/class/gpio/gpio197/active_low + echo 1 > /sys/class/gpio/gpio198/active_low + echo 1 > /sys/class/gpio/gpio199/active_low + echo 1 > /sys/class/gpio/gpio200/active_low + echo 1 > /sys/class/gpio/gpio201/active_low + echo 1 > /sys/class/gpio/gpio202/active_low + echo 1 > /sys/class/gpio/gpio203/active_low + echo 1 > /sys/class/gpio/gpio204/active_low + echo 1 > /sys/class/gpio/gpio205/active_low + echo 1 > /sys/class/gpio/gpio206/active_low + echo 1 > /sys/class/gpio/gpio207/active_low + + #LP Mode Port 0-15 + echo "pca9535 0x20" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/new_device + echo 176 > /sys/class/gpio/export + echo 177 > /sys/class/gpio/export + echo 178 > /sys/class/gpio/export + echo 179 > /sys/class/gpio/export + echo 180 > /sys/class/gpio/export + echo 181 > /sys/class/gpio/export + echo 182 > /sys/class/gpio/export + echo 183 > /sys/class/gpio/export + echo 184 > /sys/class/gpio/export + echo 185 > /sys/class/gpio/export + echo 186 > /sys/class/gpio/export + echo 187 > /sys/class/gpio/export + echo 188 > /sys/class/gpio/export + echo 189 > /sys/class/gpio/export + echo 190 > /sys/class/gpio/export + echo 191 > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio176/direction + echo out > /sys/class/gpio/gpio177/direction + echo out > /sys/class/gpio/gpio178/direction + echo out > /sys/class/gpio/gpio179/direction + echo out > /sys/class/gpio/gpio180/direction + echo out > /sys/class/gpio/gpio181/direction + echo out > /sys/class/gpio/gpio182/direction + echo out > /sys/class/gpio/gpio183/direction + echo out > /sys/class/gpio/gpio184/direction + echo out > /sys/class/gpio/gpio185/direction + echo out > /sys/class/gpio/gpio186/direction + echo out > /sys/class/gpio/gpio187/direction + echo out > /sys/class/gpio/gpio188/direction + echo out > /sys/class/gpio/gpio189/direction + echo out > /sys/class/gpio/gpio190/direction + echo out > /sys/class/gpio/gpio191/direction + + #LP Mode Port 16-31 + echo "pca9535 0x21" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/new_device + echo 160 > /sys/class/gpio/export + echo 161 > /sys/class/gpio/export + echo 162 > /sys/class/gpio/export + echo 163 > /sys/class/gpio/export + echo 164 > /sys/class/gpio/export + echo 165 > /sys/class/gpio/export + echo 166 > /sys/class/gpio/export + echo 167 > /sys/class/gpio/export + echo 168 > /sys/class/gpio/export + echo 169 > /sys/class/gpio/export + echo 170 > /sys/class/gpio/export + echo 171 > /sys/class/gpio/export + echo 172 > /sys/class/gpio/export + echo 173 > /sys/class/gpio/export + echo 174 > /sys/class/gpio/export + echo 175 > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio160/direction + echo out > /sys/class/gpio/gpio161/direction + echo out > /sys/class/gpio/gpio162/direction + echo out > /sys/class/gpio/gpio163/direction + echo out > /sys/class/gpio/gpio164/direction + echo out > /sys/class/gpio/gpio165/direction + echo out > /sys/class/gpio/gpio166/direction + echo out > /sys/class/gpio/gpio167/direction + echo out > /sys/class/gpio/gpio168/direction + echo out > /sys/class/gpio/gpio169/direction + echo out > /sys/class/gpio/gpio170/direction + echo out > /sys/class/gpio/gpio171/direction + echo out > /sys/class/gpio/gpio172/direction + echo out > /sys/class/gpio/gpio173/direction + echo out > /sys/class/gpio/gpio174/direction + echo out > /sys/class/gpio/gpio175/direction + + #RST Port 0-15 + echo "pca9535 0x22" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/new_device + echo 144 > /sys/class/gpio/export + echo 145 > /sys/class/gpio/export + echo 146 > /sys/class/gpio/export + echo 147 > /sys/class/gpio/export + echo 148 > /sys/class/gpio/export + echo 149 > /sys/class/gpio/export + echo 150 > /sys/class/gpio/export + echo 151 > /sys/class/gpio/export + echo 152 > /sys/class/gpio/export + echo 153 > /sys/class/gpio/export + echo 154 > /sys/class/gpio/export + echo 155 > /sys/class/gpio/export + echo 156 > /sys/class/gpio/export + echo 157 > /sys/class/gpio/export + echo 158 > /sys/class/gpio/export + echo 159 > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio144/direction + echo out > /sys/class/gpio/gpio145/direction + echo out > /sys/class/gpio/gpio146/direction + echo out > /sys/class/gpio/gpio147/direction + echo out > /sys/class/gpio/gpio148/direction + echo out > /sys/class/gpio/gpio149/direction + echo out > /sys/class/gpio/gpio150/direction + echo out > /sys/class/gpio/gpio151/direction + echo out > /sys/class/gpio/gpio152/direction + echo out > /sys/class/gpio/gpio153/direction + echo out > /sys/class/gpio/gpio154/direction + echo out > /sys/class/gpio/gpio155/direction + echo out > /sys/class/gpio/gpio156/direction + echo out > /sys/class/gpio/gpio157/direction + echo out > /sys/class/gpio/gpio158/direction + echo out > /sys/class/gpio/gpio159/direction + echo 1 > /sys/class/gpio/gpio144/active_low + echo 1 > /sys/class/gpio/gpio145/active_low + echo 1 > /sys/class/gpio/gpio146/active_low + echo 1 > /sys/class/gpio/gpio147/active_low + echo 1 > /sys/class/gpio/gpio148/active_low + echo 1 > /sys/class/gpio/gpio149/active_low + echo 1 > /sys/class/gpio/gpio150/active_low + echo 1 > /sys/class/gpio/gpio151/active_low + echo 1 > /sys/class/gpio/gpio152/active_low + echo 1 > /sys/class/gpio/gpio153/active_low + echo 1 > /sys/class/gpio/gpio154/active_low + echo 1 > /sys/class/gpio/gpio155/active_low + echo 1 > /sys/class/gpio/gpio156/active_low + echo 1 > /sys/class/gpio/gpio157/active_low + echo 1 > /sys/class/gpio/gpio158/active_low + echo 1 > /sys/class/gpio/gpio159/active_low + echo 0 > /sys/class/gpio/gpio144/value + echo 0 > /sys/class/gpio/gpio145/value + echo 0 > /sys/class/gpio/gpio146/value + echo 0 > /sys/class/gpio/gpio147/value + echo 0 > /sys/class/gpio/gpio148/value + echo 0 > /sys/class/gpio/gpio149/value + echo 0 > /sys/class/gpio/gpio150/value + echo 0 > /sys/class/gpio/gpio151/value + echo 0 > /sys/class/gpio/gpio152/value + echo 0 > /sys/class/gpio/gpio153/value + echo 0 > /sys/class/gpio/gpio154/value + echo 0 > /sys/class/gpio/gpio155/value + echo 0 > /sys/class/gpio/gpio156/value + echo 0 > /sys/class/gpio/gpio157/value + echo 0 > /sys/class/gpio/gpio158/value + echo 0 > /sys/class/gpio/gpio159/value + + #RST Port 16-31 + echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/new_device + echo 128 > /sys/class/gpio/export + echo 129 > /sys/class/gpio/export + echo 130 > /sys/class/gpio/export + echo 131 > /sys/class/gpio/export + echo 132 > /sys/class/gpio/export + echo 133 > /sys/class/gpio/export + echo 134 > /sys/class/gpio/export + echo 135 > /sys/class/gpio/export + echo 136 > /sys/class/gpio/export + echo 137 > /sys/class/gpio/export + echo 138 > /sys/class/gpio/export + echo 139 > /sys/class/gpio/export + echo 140 > /sys/class/gpio/export + echo 141 > /sys/class/gpio/export + echo 142 > /sys/class/gpio/export + echo 143 > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio128/direction + echo out > /sys/class/gpio/gpio129/direction + echo out > /sys/class/gpio/gpio130/direction + echo out > /sys/class/gpio/gpio131/direction + echo out > /sys/class/gpio/gpio132/direction + echo out > /sys/class/gpio/gpio133/direction + echo out > /sys/class/gpio/gpio134/direction + echo out > /sys/class/gpio/gpio135/direction + echo out > /sys/class/gpio/gpio136/direction + echo out > /sys/class/gpio/gpio137/direction + echo out > /sys/class/gpio/gpio138/direction + echo out > /sys/class/gpio/gpio139/direction + echo out > /sys/class/gpio/gpio140/direction + echo out > /sys/class/gpio/gpio141/direction + echo out > /sys/class/gpio/gpio142/direction + echo out > /sys/class/gpio/gpio143/direction + echo 1 > /sys/class/gpio/gpio128/active_low + echo 1 > /sys/class/gpio/gpio129/active_low + echo 1 > /sys/class/gpio/gpio130/active_low + echo 1 > /sys/class/gpio/gpio131/active_low + echo 1 > /sys/class/gpio/gpio132/active_low + echo 1 > /sys/class/gpio/gpio133/active_low + echo 1 > /sys/class/gpio/gpio134/active_low + echo 1 > /sys/class/gpio/gpio135/active_low + echo 1 > /sys/class/gpio/gpio136/active_low + echo 1 > /sys/class/gpio/gpio137/active_low + echo 1 > /sys/class/gpio/gpio138/active_low + echo 1 > /sys/class/gpio/gpio139/active_low + echo 1 > /sys/class/gpio/gpio140/active_low + echo 1 > /sys/class/gpio/gpio141/active_low + echo 1 > /sys/class/gpio/gpio142/active_low + echo 1 > /sys/class/gpio/gpio143/active_low + echo 0 > /sys/class/gpio/gpio128/value + echo 0 > /sys/class/gpio/gpio129/value + echo 0 > /sys/class/gpio/gpio130/value + echo 0 > /sys/class/gpio/gpio131/value + echo 0 > /sys/class/gpio/gpio132/value + echo 0 > /sys/class/gpio/gpio133/value + echo 0 > /sys/class/gpio/gpio134/value + echo 0 > /sys/class/gpio/gpio135/value + echo 0 > /sys/class/gpio/gpio136/value + echo 0 > /sys/class/gpio/gpio137/value + echo 0 > /sys/class/gpio/gpio138/value + echo 0 > /sys/class/gpio/gpio139/value + echo 0 > /sys/class/gpio/gpio140/value + echo 0 > /sys/class/gpio/gpio141/value + echo 0 > /sys/class/gpio/gpio142/value + echo 0 > /sys/class/gpio/gpio143/value + +} + +#GPIO DeInit +function _i2c_gpio_deinit { + echo "0x20" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/delete_device + echo "0x21" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/delete_device + echo "0x22" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/delete_device + echo "0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN4_DEVICE}/delete_device + echo "0x20" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/delete_device + echo "0x21" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/delete_device + echo "0x22" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/delete_device + echo "0x23" > /sys/bus/i2c/devices/i2c-${NUM_MUX1_CHAN5_DEVICE}/delete_device +} + +#I2C CPLD init +function _i2c_cpld_init { + echo "=========================================================" + echo "# Description: I2C CPLD Init..." + echo "=========================================================" + + ## modprobe i2c_cpld + modprobe i2c_cpld + ## Add CPLD device + echo "i2c_cpld 0x33" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}/new_device + + echo "done..." +} + +#Set FAN Tray LED +function _i2c_led_fan_tray_status_set { + echo "FAN Tray Status Setup" + #FAN Status get + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan2_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan4_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN6_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan6_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + FAN8_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan8_alarm` + + if [ "${FAN1_ALARM}" == "0" ] && [ "${FAN2_ALARM}" == "0" ]; then + FAN_TRAY=1 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=1 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + if [ "${FAN3_ALARM}" == "0" ] && [ "${FAN4_ALARM}" == "0" ]; then + FAN_TRAY=2 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=2 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + if [ "${FAN5_ALARM}" == "0" ] && [ "${FAN6_ALARM}" == "0" ]; then + FAN_TRAY=3 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=3 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi + + if [ "${FAN7_ALARM}" == "0" ] && [ "${FAN8_ALARM}" == "0" ]; then + FAN_TRAY=4 + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + else + FAN_TRAY=4 + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_tray_led + fi +} + +#Set FAN LED +function _i2c_led_fan_status_set { + echo "FAN Status Setup" + #PSU Status set + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN2_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan2_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN4_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan4_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN6_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan6_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + FAN8_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan8_alarm` + + if [ "${FAN1_ALARM}" == "0" ] && [ "${FAN2_ALARM}" == "0" ] \ + && [ "${FAN3_ALARM}" == "0" ] && [ "${FAN4_ALARM}" == "0" ] \ + && [ "${FAN5_ALARM}" == "0" ] && [ "${FAN6_ALARM}" == "0" ] \ + && [ "${FAN7_ALARM}" == "0" ] && [ "${FAN8_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_fan_led + fi +} + +#Set Power Supply LED +function _i2c_led_psu_status_set { + echo "PSU LED Status Setup" + + #PSU Status set + _i2c_psu_status + + #PSU1 Status + if [ "${psu1Exist}" == ${PSU_EXIST} ]; then + if [ "${psu1PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + fi + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu1_led + fi + + #PSU2 Status + if [ "${psu2Exist}" == ${PSU_EXIST} ]; then + if [ "${psu2PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + fi + else + COLOR_LED="green" + ONOFF_LED="off" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + COLOR_LED="amber" + ONOFF_LED="on" + echo "${COLOR_LED} ${ONOFF_LED}" + _i2c_psu2_led + fi +} + +#LED Test +function _i2c_led_test { + echo "=========================================================" + echo "# Description: I2C LED TEST..." + echo "=========================================================" + #sys led (green) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x7F + _pause 'Check SYS LED green light and Press [Enter] key to continue...' + #sys led (amber) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xBF + _pause 'Check SYS LED amber light and Press [Enter] key to continue...' + + #FAN led (green) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xF7 + _pause 'Check FAN LED green light and Press [Enter] key to continue...' + #FAN led (amber) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFB + _pause 'Check FAN LED amber light and Press [Enter] key to continue...' + + #PSU2 led (green) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xDF + _pause 'Check PSU2 LED green light and Press [Enter] key to continue...' + #PSU2 led (amber) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xEF + _pause 'Check PSU2 LED amber light and Press [Enter] key to continue...' + + #PSU1 led (green) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFD + _pause 'Check PSU1 LED green light and Press [Enter] key to continue...' + #PSU1 led (amber) + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFE + _pause 'Check PSU1 LED amber light and Press [Enter] key to continue...' + + #Turn OFF All LED + i2cset -y ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + _pause 'Check turn off all LEDs and Press [Enter] key to continue...' + echo "done..." +} + +#Set QSFP Port variable +function _qsfp_port_i2c_var_set { + local port=$1 + case ${port} in + 1|2|3|4|5|6|7|8) + i2cbus=${NUM_MUX1_CHAN4_DEVICE} + regAddr=0x20 + dataAddr=0 + eeprombusbase=${NUM_MUX3_CHAN0_DEVICE} + gpioBase=240 + ;; + 9|10|11|12|13|14|15|16) + i2cbus=${NUM_MUX1_CHAN4_DEVICE} + regAddr=0x20 + dataAddr=1 + eeprombusbase=${NUM_MUX4_CHAN0_DEVICE} + gpioBase=240 + ;; + 17|18|19|20|21|22|23|24) + i2cbus=${NUM_MUX1_CHAN4_DEVICE} + regAddr=0x21 + dataAddr=0 + eeprombusbase=${NUM_MUX5_CHAN0_DEVICE} + gpioBase=$((224 - 16)) + ;; + 25|26|27|28|29|30|31|32) + i2cbus=${NUM_MUX1_CHAN4_DEVICE} + regAddr=0x21 + dataAddr=1 + eeprombusbase=${NUM_MUX6_CHAN0_DEVICE} + gpioBase=$((224 - 16)) + ;; + 33) + i2cbus=${NUM_MUX1_CHAN7_DEVICE} + regAddr=0x22 + dataAddr=0 + ;; + 34) + i2cbus=${NUM_MUX1_CHAN7_DEVICE} + regAddr=0x22 + dataAddr=1 + ;; + *) + echo "Please input 1~32" + ;; + esac +} + +#Set QSFP Port variable +function _qsfp_eeprom_var_set { + local port=$1 + eeprombusidx=$(( ${port} % 8)) + case $eeprombusidx in + 1) + eeprombus=$(( $eeprombusbase + 1 )) + eepromAddr=0x50 + ;; + 2) + eeprombus=$(( $eeprombusbase + 0 )) + eepromAddr=0x50 + ;; + 3) + eeprombus=$(( $eeprombusbase + 3 )) + eepromAddr=0x50 + ;; + 4) + eeprombus=$(( $eeprombusbase + 2 )) + eepromAddr=0x50 + ;; + 5) + eeprombus=$(( $eeprombusbase + 5 )) + eepromAddr=0x50 + ;; + 6) + eeprombus=$(( $eeprombusbase + 4 )) + eepromAddr=0x50 + ;; + 7) + eeprombus=$(( $eeprombusbase + 7 )) + eepromAddr=0x50 + ;; + 0) + eeprombus=$(( $eeprombusbase + 6 )) + eepromAddr=0x50 + ;; + esac +} + +#Get QSFP EEPROM Information +function _i2c_qsfp_eeprom_get { + + _qsfp_port_i2c_var_set ${QSFP_PORT} + + #status: 0 -> Down, 1 -> Up + status=`cat /sys/class/gpio/gpio$(( $(($gpioBase + (${QSFP_PORT} - 1) ^ 1)) ))/value` + echo $status + + if [ $status = 0 ]; then + exit + fi + + _qsfp_eeprom_var_set ${QSFP_PORT} + + cat ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom | hexdump -C +} + +#Init QSFP EEPROM +function _i2c_qsfp_eeprom_init { + echo -n "QSFP EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init 1-32 ports EEPROM + local i + for i in {1..32}; + do + _qsfp_port_i2c_var_set ${i} + + _qsfp_eeprom_var_set ${i} + + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr) ]; then + echo "sff8436 $eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr) ]; then + echo "$eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/delete_device + fi + done + echo "DONE" +} + +#Init Main Board EEPROM +function _i2c_mb_eeprom_init { + echo -n "Main Board EEPROM INIT..." + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init 1-32 ports EEPROM + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_MUX1_CHAN7_DEVICE}-0054 ]; then + echo "mb_eeprom 0x54" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN7_DEVICE}/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/${NUM_MUX1_CHAN7_DEVICE}-0054 ]; then + echo "0x54" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN7_DEVICE}/delete_device + fi + echo "DONE" +} + +#PSU EEPROM init +function _i2c_psu_eeprom_init { + echo "=========================================================" + echo "# Description: I2C PSU EEPROM Init..." + echo "=========================================================" + + ## modprobe eeprom + modprobe eeprom + ## PUS(0) EEPROM + echo "eeprom 0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN6_DEVICE}/new_device + + ## PUS(1) EEPROM + echo "eeprom 0x50" > ${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX1_CHAN7_DEVICE}/new_device + + echo "done..." +} + +#get QSFP Status +function _i2c_qsfp_status_get { + + _qsfp_port_i2c_var_set ${QSFP_PORT} + + #status: 0 -> Down, 1 -> Up + status=`cat /sys/class/gpio/gpio$(( $(($gpioBase + (${QSFP_PORT} - 1) ^ 1)) ))/value` + echo "status=$status" +} + +#get QSFP Type +function _i2c_qsfp_type_get { + + _qsfp_port_i2c_var_set ${QSFP_PORT} + + _qsfp_eeprom_var_set ${QSFP_PORT} + + #Get QSFP EEPROM info + qsfp_info=$(base64 ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom) + + identifier=$(echo $qsfp_info | base64 -d -i | hexdump -s 128 -n 1 -e '"%x"') + connector=$(echo $qsfp_info | base64 -d -i | hexdump -s 130 -n 1 -e '"%x"') + transceiver=$(echo $qsfp_info | base64 -d -i | hexdump -s 131 -n 1 -e '"%x"') + + echo "identifier=$identifier" + echo "connector=$connector" + echo "transceiver=$transceiver" +} + +#Get PSU EEPROM Information +function _i2c_psu_eeprom_get { + echo "=========================================================" + echo "# Description: I2C PSU EEPROM Get..." + echo "=========================================================" + + ## modprobe eeprom + modprobe eeprom + ## PUS(0) EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_MUX1_CHAN6_DEVICE}-0050/eeprom | hexdump -C + + ## PUS(1) EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_MUX1_CHAN7_DEVICE}-0050/eeprom | hexdump -C + + echo "done..." +} + +#Get MotherBoard EEPROM Information +function _i2c_mb_eeprom_get { + echo "=========================================================" + echo "# Description: I2C MB EEPROM Get..." + echo "=========================================================" + + ## MB EEPROM + cat ${PATH_SYS_I2C_DEVICES}/${NUM_MUX1_CHAN7_DEVICE}-0054/eeprom | hexdump -C + echo "done..." +} + +#Set System Status LED +function _i2c_sys_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x80 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x80 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x40 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x40 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set PSU2 LED +function _i2c_psu2_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x20 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x20 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x10 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x10 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set FAN Tray LED +function _i2c_fan_tray_led { + case ${FAN_TRAY} in + 1) + i2cAddr=0x20 + ioPort=2 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 2) + i2cAddr=0x20 + ioPort=2 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + 3) + i2cAddr=0x20 + ioPort=3 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x01 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x02 + fi + ;; + 4) + i2cAddr=0x20 + ioPort=3 + if [ "${COLOR_LED}" == "green" ]; then + mask=0x10 + elif [ "${COLOR_LED}" == "amber" ]; then + mask=0x20 + fi + ;; + *) + echo "Please input 1~4" + exit + ;; + esac + + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m $mask -y -r ${NUM_MUX1_CHAN7_DEVICE} $i2cAddr $ioPort 0x33 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m $mask -y -r ${NUM_MUX1_CHAN7_DEVICE} $i2cAddr $ioPort 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m $mask -y -r ${NUM_MUX1_CHAN7_DEVICE} $i2cAddr $ioPort 0x33 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m $mask -y -r ${NUM_MUX1_CHAN7_DEVICE} $i2cAddr $ioPort 0x00 + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set FAN LED +function _i2c_fan_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x08 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x08 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x04 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x04 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Set PSU1 LED +function _i2c_psu1_led { + if [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x02 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "green" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x02 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "on" ]; then + i2cset -m 0x01 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0x00 + elif [ "${COLOR_LED}" == "amber" ] && [ "${ONOFF_LED}" == "off" ]; then + i2cset -m 0x01 -y -r ${NUM_MUX1_CHAN7_DEVICE} 0x22 2 0xFF + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + echo "done..." +} + +#Get Board Version and Type +function _i2c_board_type_get { + boardType=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_board_type` + boardBuildRev=$((($boardType) & 0x03)) + boardHwRev=$((($boardType) >> 2 & 0x03)) + boardId=$((($boardType) >> 4)) + printf "BOARD_ID is 0x%02x, HW Rev %d, Build Rev %d\n" $boardId $boardHwRev $boardBuildRev + +} + +#Get CPLD Version +function _i2c_cpld_version { + cpldRev=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_version` + cpldRelease=$((($cpldRev) >> 6 & 0x01)) + cpldVersion=$((($cpldRev) & 0x3F)) + printf "CPLD is %s version(0:RD 1:Release), Revision is 0x%02x\n" $cpldRelease $cpldVersion + +} + +#Get PSU Status +function _i2c_psu_status { + psuPresent=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_pw_abs` + psu1Exist=$(($((($psuPresent) & 0x01))?0:1)) + psu2Exist=$(($((($psuPresent) & 0x02))?0:1)) + psuPwGood=`cat ${PATH_SYS_I2C_DEVICES}/0-0033/cpld_pw_good` + psu1PwGood=$(($((($psuPwGood) >> 3 & 0x01))?1:0)) + psu2PwGood=$(($((($psuPwGood) >> 3 & 0x02))?1:0)) + printf "PSU1 Exist:%d PSU1 PW Good:%d\n" $psu1Exist $psu1PwGood + printf "PSU2 Exist:%d PSU2 PW Good:%d\n" $psu2Exist $psu2PwGood +} + +#Get Front Sensor Temperature +function _i2c_front_temp { + #Front MAC + sensors | grep 'Front MAC Temp' -A 1 +} + +#Get Rear Sensor Temperature +function _i2c_rear_temp { + #Rear MAC + sensors | grep 'Rear MAC Temp' -A 1 +} + +#Increase read socket buffer for CoPP Test +function _config_rmem { + echo "109430400" > /proc/sys/net/core/rmem_max +} + +#Main Function +function _main { + tart_time_str=`date` + start_time_sec=$(date +%s) + + if [ "${EXEC_FUNC}" == "help" ]; then + _help + elif [ "${EXEC_FUNC}" == "i2c_init" ]; then + _i2c_init + elif [ "${EXEC_FUNC}" == "i2c_deinit" ]; then + _i2c_deinit + elif [ "${EXEC_FUNC}" == "i2c_temp_init" ]; then + _i2c_temp_init + elif [ "${EXEC_FUNC}" == "i2c_fan_init" ]; then + _i2c_fan_init + elif [ "${EXEC_FUNC}" == "i2c_volmon_init" ]; then + _i2c_volmon_init + elif [ "${EXEC_FUNC}" == "i2c_io_exp_init" ]; then + _i2c_io_exp_init + elif [ "${EXEC_FUNC}" == "i2c_gpio_init" ]; then + _i2c_gpio_init + elif [ "${EXEC_FUNC}" == "i2c_gpio_deinit" ]; then + _i2c_gpio_deinit + elif [ "${EXEC_FUNC}" == "i2c_led_test" ]; then + _i2c_led_test + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_get" ]; then + _i2c_mb_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_psu_eeprom_get" ]; then + _i2c_psu_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_get" ]; then + _i2c_qsfp_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_init" ]; then + _i2c_qsfp_eeprom_init ${QSFP_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_init" ]; then + _i2c_mb_eeprom_init ${MB_EEPROM_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_qsfp_status_get" ]; then + _i2c_qsfp_status_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_type_get" ]; then + _i2c_qsfp_type_get + elif [ "${EXEC_FUNC}" == "i2c_led_psu_status_set" ]; then + _i2c_led_psu_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_status_set" ]; then + _i2c_led_fan_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_tray_status_set" ]; then + _i2c_led_fan_tray_status_set + elif [ "${EXEC_FUNC}" == "i2c_sys_led" ]; then + _i2c_sys_led + elif [ "${EXEC_FUNC}" == "i2c_fan_led" ]; then + _i2c_fan_led + elif [ "${EXEC_FUNC}" == "i2c_fan_tray_led" ]; then + _i2c_fan_tray_led + elif [ "${EXEC_FUNC}" == "i2c_psu1_led" ]; then + _i2c_psu1_led + elif [ "${EXEC_FUNC}" == "i2c_psu2_led" ]; then + _i2c_psu2_led + elif [ "${EXEC_FUNC}" == "i2c_board_type_get" ]; then + _i2c_board_type_get + elif [ "${EXEC_FUNC}" == "i2c_cpld_version" ]; then + _i2c_cpld_version + elif [ "${EXEC_FUNC}" == "i2c_psu_status" ]; then + _i2c_psu_status + elif [ "${EXEC_FUNC}" == "i2c_front_temp" ]; then + _i2c_front_temp + elif [ "${EXEC_FUNC}" == "i2c_rear_temp" ]; then + _i2c_rear_temp + elif [ "${EXEC_FUNC}" == "i2c_test_all" ]; then + _i2c_init + _i2c_temp_init + _i2c_fan_init + _i2c_io_exp_init + _i2c_led_test + _i2c_psu_eeprom_get + _i2c_mb_eeprom_get + _i2c_board_type_get + _i2c_cpld_version + _i2c_psu_status + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + end_time_str=`date` + end_time_sec=$(date +%s) + diff_time=$[ ${end_time_sec} - ${start_time_sec} ] + echo "Start Time: ${start_time_str} (${start_time_sec})" + echo "End Time : ${end_time_str} (${end_time_sec})" + echo "Total Execution Time: ${diff_time} sec" + + echo "done!!!" +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/qsfp_monitor.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/qsfp_monitor.sh new file mode 100755 index 000000000000..249f179216a6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/qsfp_monitor.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=3 +I2C_UTILS="/usr/sbin/i2c_utils.sh" +QSFP_SI_SCRIPT="/usr/sbin/qsfp_si_cfg.sh" +QSFP_ARRAY=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + +#QSFP SI monitor +function _qsfp_si_monitor { + local i + local status + for i in {0..31}; + do + status=`${I2C_UTILS} i2c_qsfp_status_get $(expr $i + 1) | egrep '^status=.*$' | sed -e 's/status=//g'` + if [ "${status}" == "1" ]; then + _qsfp_type_check $i + fi + done +} + +#QSFP type +function _qsfp_type_check { + local port=$1 + local qsfp_type=`${I2C_UTILS} i2c_qsfp_type_get $(expr $port + 1)` + local identifier=`echo "$qsfp_type" | grep '^identifier=.*$' | sed -e 's/identifier=//g'` + if [ "${identifier}" == "11" ]; then + connector=`echo "$qsfp_type" | grep '^connector=.*$' | sed -e 's/connector=//g'` + case ${connector} in + 21|23) + #DAC + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to DAC" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} dac $port >/dev/null + fi + ;; + *) + #Optical + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to Optical" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} optical $port >/dev/null + fi + ;; + esac + fi +} + +#Docker exist check +function _docker_swss_check { + while true + do + # Check if syncd starts + result=`docker exec -i swss bash -c "echo -en \"SELECT 1\\nHLEN HIDDEN\" | redis-cli | sed -n 2p"` #TBD FIX ME + if [ "$result" == "3" ]; then + return + fi + sleep $INTERVAL + done +} + +#Docker exist check +function _qsfp_si_cfg_script_check { + + if [ -f ${QSFP_SI_SCRIPT} ] && [ -x ${QSFP_SI_SCRIPT} ]; then + echo "SI Script exists. Start monitor." + return + else + echo "SI Script not exist. Exit monitor." + exit + fi +} + +# main function +function _main { + #Check SI Script + _qsfp_si_cfg_script_check + #Check docker swss is running + _docker_swss_check + while true + do + _qsfp_si_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/qsfp_si_cfg.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/qsfp_si_cfg.sh new file mode 100755 index 000000000000..f2bf35bc7715 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/qsfp_si_cfg.sh @@ -0,0 +1,339 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +VERSION="1.0.0" +TRUE=200 +FALSE=404 + +TYPE=${1} +PORT=${2} + +#QSFP Optical +function _qsfp_optical_si_set { + case ${PORT} in + 0) + bcmcmd "phy ce0 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x39;phy ce0 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x37;phy ce0 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0;phy ce0 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x39" + bcmcmd "phy ce0 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x37;phy ce0 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce0 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x35;phy ce0 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x37" + bcmcmd "phy ce0 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0;phy ce0 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce0 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce0 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + ;; + 1) + bcmcmd "phy ce1 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x3E;phy ce1 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x32;phy ce1 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0;phy ce1 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x38" + bcmcmd "phy ce1 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x38;phy ce1 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xE AMS_TX_DRIVERMODE=0x0;phy ce1 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x33;phy ce1 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3D" + bcmcmd "phy ce1 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0;phy ce1 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x35;phy ce1 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x3B;phy ce1 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xE AMS_TX_DRIVERMODE=0x0" + ;; + 2) + bcmcmd "phy ce2 CL93N72_UT_CTL2r CL93N72_TXFIR_POST=0x35;phy ce2 CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=0x3B;phy ce2 AMS_TX_CTL2r AMS_TX_AMP_CTL=0xB AMS_TX_DRIVERMODE=0x0" + ;; + 3) + bcmcmd "phy ce3 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x3B;phy ce3 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x35;phy ce3 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0;phy ce3 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x35" + bcmcmd "phy ce3 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x37;phy ce3 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0;phy ce3 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x35;phy ce3 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x37" + bcmcmd "phy ce3 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xB AMS_TX_DRIVERMODE=0x0;phy ce3 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x35;phy ce3 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x37;phy ce3 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xB AMS_TX_DRIVERMODE=0x0" + ;; + 4) + bcmcmd "phy ce4 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x30;phy ce4 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x40;phy ce4 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce4 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x33" + bcmcmd "phy ce4 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x3D;phy ce4 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce4 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce4 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40" + bcmcmd "phy ce4 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce4 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce4 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce4 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0" + ;; + 5) + bcmcmd "phy ce5 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x30;phy ce5 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x40;phy ce5 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce5 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x35" + bcmcmd "phy ce5 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x3B;phy ce5 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0;phy ce5 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce5 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40" + bcmcmd "phy ce5 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce5 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce5 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce5 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0" + ;; + 6) + bcmcmd "phy ce6 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x30;phy ce6 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x40;phy ce6 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce6 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x36" + bcmcmd "phy ce6 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x3A;phy ce6 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0;phy ce6 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce6 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40" + bcmcmd "phy ce6 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce6 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce6 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce6 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0" + ;; + 7) + bcmcmd "phy ce7 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x30;phy ce7 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x40;phy ce7 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce7 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x30" + bcmcmd "phy ce7 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x40;phy ce7 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce7 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce7 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40" + bcmcmd "phy ce7 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce7 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce7 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce7 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + ;; + 8) + bcmcmd "phy ce8 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x25;phy ce8 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x4B;phy ce8 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce8 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x2C" + bcmcmd "phy ce8 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x44;phy ce8 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0;phy ce8 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x25;phy ce8 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x4B" + bcmcmd "phy ce8 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce8 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x25;phy ce8 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x4B;phy ce8 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + ;; + 9) + bcmcmd "phy ce9 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x25;phy ce9 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x4B;phy ce9 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce9 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x2B" + bcmcmd "phy ce9 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x45;phy ce9 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0;phy ce9 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x25;phy ce9 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x4B" + bcmcmd "phy ce9 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce9 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x25;phy ce9 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x4B;phy ce9 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + ;; + 10) + bcmcmd "phy ce10 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x25;phy ce10 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x4B;phy ce10 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce10 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x2B" + bcmcmd "phy ce10 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x45;phy ce10 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x7 AMS_TX_DRIVERMODE=0x0;phy ce10 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x25;phy ce10 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x4B" + bcmcmd "phy ce10 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce10 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x25;phy ce10 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x4B;phy ce10 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + ;; + 11) + bcmcmd "phy ce11 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x25;phy ce11 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x4B;phy ce11 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce11 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x2C" + bcmcmd "phy ce11 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x44;phy ce11 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce11 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x25;phy ce11 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x4B" + bcmcmd "phy ce11 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce11 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x25;phy ce11 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x4B;phy ce11 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + ;; + 12) + bcmcmd "phy ce12 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x25;phy ce12 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x4B;phy ce12 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce12 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x25" + bcmcmd "phy ce12 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x4B;phy ce12 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x5 AMS_TX_DRIVERMODE=0x0;phy ce12 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x25;phy ce12 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x4B" + bcmcmd "phy ce12 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce12 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x25;phy ce12 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x4B;phy ce12 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + ;; + 13) + bcmcmd "phy ce13 CL93N72_UT_CTL2r CL93N72_TXFIR_POST=0x25;phy ce13 CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=0x4B;phy ce13 AMS_TX_CTL2r AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + ;; + 14) + bcmcmd "phy ce14 CL93N72_UT_CTL2r CL93N72_TXFIR_POST=0x25;phy ce14 CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=0x4B;phy ce14 AMS_TX_CTL2r AMS_TX_AMP_CTL=0x7 AMS_TX_DRIVERMODE=0x0" + ;; + 15) + bcmcmd "phy ce15 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x25;phy ce15 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x4B;phy ce15 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x7 AMS_TX_DRIVERMODE=0x0;phy ce15 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x25" + bcmcmd "phy ce15 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x4B;phy ce15 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x5 AMS_TX_DRIVERMODE=0x0;phy ce15 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x25;phy ce15 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x4B" + bcmcmd "phy ce15 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x7 AMS_TX_DRIVERMODE=0x0;phy ce15 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x25;phy ce15 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x4B;phy ce15 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x7 AMS_TX_DRIVERMODE=0x0" + ;; + 16) + bcmcmd "phy ce16 CL93N72_UT_CTL2r CL93N72_TXFIR_POST=0x27;phy ce16 CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=0x49;phy ce16 AMS_TX_CTL2r AMS_TX_AMP_CTL=0x4 AMS_TX_DRIVERMODE=0x0" + ;; + 17) + bcmcmd "phy ce17 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x25;phy ce17 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x4B;phy ce17 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce17 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x30" + bcmcmd "phy ce17 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x40;phy ce17 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0;phy ce17 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce17 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40" + bcmcmd "phy ce17 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0;phy ce17 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce17 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40;phy ce17 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + ;; + 18) + bcmcmd "phy ce18 CL93N72_UT_CTL2r CL93N72_TXFIR_POST=0x20;phy ce18 CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=0x50;phy ce18 AMS_TX_CTL2r AMS_TX_AMP_CTL=0x2 AMS_TX_DRIVERMODE=0x0" + ;; + 19) + bcmcmd "phy ce19 CL93N72_UT_CTL2r CL93N72_TXFIR_POST=0x20;phy ce19 CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=0x50;phy ce19 AMS_TX_CTL2r AMS_TX_AMP_CTL=0x2 AMS_TX_DRIVERMODE=0x0" + ;; + 20) + bcmcmd "phy ce20 CL93N72_UT_CTL2r CL93N72_TXFIR_POST=0x20;phy ce20 CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=0x50;phy ce20 AMS_TX_CTL2r AMS_TX_AMP_CTL=0x2 AMS_TX_DRIVERMODE=0x0" + ;; + 21) + bcmcmd "phy ce21 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x17;phy ce21 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x59;phy ce21 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x4 AMS_TX_DRIVERMODE=0x0;phy ce21 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x17" + bcmcmd "phy ce21 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x59;phy ce21 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x2 AMS_TX_DRIVERMODE=0x0;phy ce21 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x20;phy ce21 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x50" + bcmcmd "phy ce21 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x2 AMS_TX_DRIVERMODE=0x0;phy ce21 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x20;phy ce21 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x50;phy ce21 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x2 AMS_TX_DRIVERMODE=0x0" + ;; + 22) + bcmcmd "phy ce22 CL93N72_UT_CTL2r CL93N72_TXFIR_POST=0x25;phy ce22 CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=0x4B;phy ce22 AMS_TX_CTL2r AMS_TX_AMP_CTL=0x7 AMS_TX_DRIVERMODE=0x0" + ;; + 23) + bcmcmd "phy ce23 CL93N72_UT_CTL2r CL93N72_TXFIR_POST=0x25;phy ce23 CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=0x4B;phy ce23 AMS_TX_CTL2r AMS_TX_AMP_CTL=0x7 AMS_TX_DRIVERMODE=0x0" + ;; + 24) + bcmcmd "phy ce24 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x23;phy ce24 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x4D;phy ce24 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce24 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x29" + bcmcmd "phy ce24 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x47;phy ce24 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce24 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x29;phy ce24 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x47" + bcmcmd "phy ce24 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x4 AMS_TX_DRIVERMODE=0x0;phy ce24 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x29;phy ce24 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x47;phy ce24 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x4 AMS_TX_DRIVERMODE=0x0" + ;; + 25) + bcmcmd "phy ce25 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x29;phy ce25 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x47;phy ce25 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce25 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x29" + bcmcmd "phy ce25 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x47;phy ce25 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce25 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x29;phy ce25 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x47" + bcmcmd "phy ce25 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x4 AMS_TX_DRIVERMODE=0x0;phy ce25 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x29;phy ce25 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x47;phy ce25 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x4 AMS_TX_DRIVERMODE=0x0" + ;; + 26) + bcmcmd "phy ce26 CL93N72_UT_CTL2r CL93N72_TXFIR_POST=0x30;phy ce26 CL93N72_UT_CTL3r CL93N72_TXFIR_MAIN=0x40;phy ce26 AMS_TX_CTL2r AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0" + ;; + 27) + bcmcmd "phy ce27 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x30;phy ce27 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x40;phy ce27 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0;phy ce27 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x30" + bcmcmd "phy ce27 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x40;phy ce27 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0;phy ce27 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce27 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40" + bcmcmd "phy ce27 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xB AMS_TX_DRIVERMODE=0x0;phy ce27 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce27 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce27 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0" + ;; + 28) + bcmcmd "phy ce28 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x30;phy ce28 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x40;phy ce28 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce28 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x30" + bcmcmd "phy ce28 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x40;phy ce28 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce28 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce28 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40" + bcmcmd "phy ce28 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0;phy ce28 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce28 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce28 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0" + ;; + 29) + bcmcmd "phy ce29 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x30;phy ce29 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x40;phy ce29 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce29 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x30" + bcmcmd "phy ce29 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x40;phy ce29 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0;phy ce29 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce29 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40" + bcmcmd "phy ce29 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0;phy ce29 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce29 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce29 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0" + ;; + 30) + bcmcmd "phy ce30 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x30;phy ce30 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x40;phy ce30 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce30 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x30" + bcmcmd "phy ce30 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x40;phy ce30 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0;phy ce30 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce30 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40" + bcmcmd "phy ce30 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0;phy ce30 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce30 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce30 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0" + ;; + 31) + bcmcmd "phy ce31 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x39;phy ce31 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x37;phy ce31 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0;phy ce31 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x39" + bcmcmd "phy ce31 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x37;phy ce31 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0;phy ce31 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x30;phy ce31 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x40" + bcmcmd "phy ce31 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0;phy ce31 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce31 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce31 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + ;; + *) + echo "Unknown Port" + return + ;; + esac +} + +function _qsfp_dac_si_set { + case ${PORT} in + 0) + bcmcmd "phy ce0 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce0 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce0 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce0 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce0 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x1C;phy ce0 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x20;phy ce0 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x34;phy ce0 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce0 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce0 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce0 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce0 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce0 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x18;phy ce0 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x24;phy ce0 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x34;phy ce0 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + ;; + 1) + bcmcmd "phy ce1 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce1 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce1 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce1 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce1 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x1C;phy ce1 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x20;phy ce1 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x34;phy ce1 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce1 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce1 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce1 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce1 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce1 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x1C;phy ce1 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x20;phy ce1 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x34;phy ce1 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + ;; + 2) + bcmcmd "phy ce2 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce2 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce2 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce2 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce2 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x18;phy ce2 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x24;phy ce2 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x34;phy ce2 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xD AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce2 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce2 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce2 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce2 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce2 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x14;phy ce2 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x20;phy ce2 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x3C;phy ce2 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xD AMS_TX_DRIVERMODE=0x0" + ;; + 3) + bcmcmd "phy ce3 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce3 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce3 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce3 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce3 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x14;phy ce3 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x20;phy ce3 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x3C;phy ce3 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xD AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce3 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce3 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce3 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce3 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce3 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x18;phy ce3 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x24;phy ce3 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x34;phy ce3 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xD AMS_TX_DRIVERMODE=0x0" + ;; + 4) + bcmcmd "phy ce4 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce4 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce4 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce4 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce4 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x0;phy ce4 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x33;phy ce4 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x3D;phy ce4 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xB AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce4 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce4 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce4 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce4 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce4 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x0;phy ce4 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce4 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce4 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0" + ;; + 5) + bcmcmd "phy ce5 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce5 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce5 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce5 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce5 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x0;phy ce5 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x30;phy ce5 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x40;phy ce5 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xB AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce5 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce5 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce5 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce5 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce5 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x0;phy ce5 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce5 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce5 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0" + ;; + 6) + bcmcmd "phy ce6 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce6 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce6 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce6 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce6 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x0;phy ce6 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x36;phy ce6 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x3A;phy ce6 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce6 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce6 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce6 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce6 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce6 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x0;phy ce6 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce6 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce6 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0" + ;; + 7) + bcmcmd "phy ce7 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce7 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce7 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce7 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce7 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x0;phy ce7 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x30;phy ce7 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x40;phy ce7 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce7 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce7 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce7 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce7 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce7 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x0;phy ce7 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce7 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce7 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + ;; + 8) + ;; + 9) + ;; + 10) + ;; + 11) + ;; + 12) + ;; + 13) + ;; + 14) + ;; + 15) + ;; + 16) + ;; + 17) + ;; + 18) + ;; + 19) + ;; + 20) + ;; + 21) + ;; + 22) + ;; + 23) + ;; + 24) + bcmcmd "phy ce24 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce24 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce24 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce24 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce24 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x0;phy ce24 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x29;phy ce24 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x47;phy ce24 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce24 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0X1F;phy ce24 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce24 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce24 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce24 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x0;phy ce24 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x29;phy ce24 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x47;phy ce24 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x4 AMS_TX_DRIVERMODE=0x0" + ;; + 25) + bcmcmd "phy ce25 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce25 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce25 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce25 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce25 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x0;phy ce25 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x29;phy ce25 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x47;phy ce25 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x8 AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce25 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce25 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce25 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce25 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce25 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x0;phy ce25 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x29;phy ce25 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x47;phy ce25 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x4 AMS_TX_DRIVERMODE=0x0" + ;; + 26) + bcmcmd "phy ce26 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce26 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce26 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce26 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce26 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x0;phy ce26 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x30;phy ce26 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x40;phy ce26 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xA AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce26 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce26 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce26 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce26 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce26 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x0;phy ce26 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce26 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce26 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0" + ;; + 27) + bcmcmd "phy ce27 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce27 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce27 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce27 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce27 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x0;phy ce27 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x30;phy ce27 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x40;phy ce27 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce27 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce27 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce27 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce27 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce27 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x0;phy ce27 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x30;phy ce27 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x40;phy ce27 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0x9 AMS_TX_DRIVERMODE=0x0" + ;; + 28) + bcmcmd "phy ce28 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce28 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce28 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce28 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce28 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x10;phy ce28 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x18;phy ce28 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x3C;phy ce28 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce28 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce28 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce28 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce28 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce28 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x10;phy ce28 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x1C;phy ce28 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x3C;phy ce28 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0" + ;; + 29) + bcmcmd "phy ce29 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce29 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce29 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce29 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce29 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x10;phy ce29 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x20;phy ce29 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x3C;phy ce29 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce29 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce29 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce29 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce29 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce29 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x10;phy ce29 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x20;phy ce29 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x3C;phy ce29 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0" + ;; + 30) + bcmcmd "phy ce30 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce30 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce30 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce30 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce30 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x10;phy ce30 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x24;phy ce30 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x3C;phy ce30 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce30 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce30 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce30 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce30 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce30 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x8;phy ce30 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x24;phy ce30 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x3C;phy ce30 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0" + ;; + 31) + bcmcmd "phy ce31 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_PRE=0x1F;phy ce31 CL93N72_UT_CTL2r.0 CL93N72_TXFIR_POST=0x15;phy ce31 CL93N72_UT_CTL3r.0 CL93N72_TXFIR_MAIN=0x3C;phy ce31 AMS_TX_CTL2r.0 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce31 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_PRE=0x10;phy ce31 CL93N72_UT_CTL2r.1 CL93N72_TXFIR_POST=0x24;phy ce31 CL93N72_UT_CTL3r.1 CL93N72_TXFIR_MAIN=0x3C;phy ce31 AMS_TX_CTL2r.1 AMS_TX_AMP_CTL=0xC AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce31 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_PRE=0x1F;phy ce31 CL93N72_UT_CTL2r.2 CL93N72_TXFIR_POST=0x15;phy ce31 CL93N72_UT_CTL3r.2 CL93N72_TXFIR_MAIN=0x3C;phy ce31 AMS_TX_CTL2r.2 AMS_TX_AMP_CTL=0xF AMS_TX_DRIVERMODE=0x0" + bcmcmd "phy ce31 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_PRE=0x14;phy ce31 CL93N72_UT_CTL2r.3 CL93N72_TXFIR_POST=0x20;phy ce31 CL93N72_UT_CTL3r.3 CL93N72_TXFIR_MAIN=0x3C;phy ce31 AMS_TX_CTL2r.3 AMS_TX_AMP_CTL=0xE AMS_TX_DRIVERMODE=0x0" + ;; + *) + echo "Unknown Port" + return + ;; + esac +} + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} optical [0-31]" + echo " : ${0} dac [0-31]" + echo "----------------------------------------------------" +} + +#Main Function +function _main { + + if [ "${TYPE}" == "help" ]; then + _help + elif [ "${TYPE}" == "optical" ]; then + _qsfp_optical_si_set + elif [ "${TYPE}" == "dac" ]; then + _qsfp_dac_si_set + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/s9100_monitor.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/s9100_monitor.sh new file mode 100755 index 000000000000..974da6d5001f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9100/utils/s9100_monitor.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=5 +I2C_UTILS="/usr/sbin/i2c_utils.sh" + + +# LED status monitor +function _led_monitor { + ${I2C_UTILS} i2c_led_fan_status_set >/dev/null + ${I2C_UTILS} i2c_led_psu_status_set >/dev/null + ${I2C_UTILS} i2c_led_fan_tray_status_set >/dev/null +} + +# main function +function _main { + while true + do + _led_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/README.md b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/README.md new file mode 100644 index 000000000000..940d15f497c9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/README.md @@ -0,0 +1,184 @@ +# Ingrasys S9200-64X Platform Driver for SONiC + +Copyright (C) 2016 Ingrasys, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +## Licensing terms + +The Licensing terms of the files within this project is split 2 parts. +The Linux kernel is released under the GNU General Public License version 2. +All other code is released under the GNU General Public License version 3. +Please see the LICENSE file for copies of both licenses. + +## Contents of this package + + - service/ + > Service config files for platform initialization and monitoring + - utils/ + > Scripts useful during platform bringup and sysfs function + - conf/ + > Platform configure files. + +## Kernel modules and drivers + +The driver for interacting with Ingrasys S9200-64X is contained in the I2C +kernel module and initialization script. The initialization script loads +the modules in the correct order. It has been built and tested against +the Linux 3.16 kernel. + +The initialization script will modprobe the needed modules, navigate to the +module's device directory in sysfs, and write configuration data to +the kernel module. + +### IGB + +This is OOB Ports on front panel for management plane. + +The IGB module must be loaded first on Ingrasys S9200-64X platform. + +### I2C i801 + +The I2C i801 on Ingrasys S9200-64X can be found in +`/sys/bus/i2c/devices/i2c-0/` + +This is I2C bus for Clock Gen, DIMM channel and digital potentiometers. + +The i801 module must be loaded second on Ingrasys S9200-64X. + +### I2C iSMT + +The I2C iSMT module on S9200-64X can be found in +`/sys/bus/i2c/devices/i2c-1/` + +This is I2C bus for CPLD, HWM, power controller and I2C Switches. + +The i801 module must be loaded third on Ingrasys S9200-64X. + +### I2C PCA9548 +The PCA9548 module on S9200-64X can be found in +`/sys/bus/i2c/devices/i2c-2/` , `/sys/bus/i2c/devices/i2c-3/`, +`/sys/bus/i2c/devices/i2c-4/`, `/sys/bus/i2c/devices/i2c-5/`, +`/sys/bus/i2c/devices/i2c-6/`, `/sys/bus/i2c/devices/i2c-7/`, +`/sys/bus/i2c/devices/i2c-8/`, `/sys/bus/i2c/devices/i2c-9/`. + +The pca9548 module for zQSFP module get/set functions, PSU information, +fan status and EEPROM. + +## Hardware components + +The hardware components are initialized in the init script on S9200-64X. +The following describes manual initialization as well as interaction. +The examples below are just for Ingrasys S9200-64X platform. + +### Hardware initialization + +When the sonic-platform-ingrasys-s9200-64x package is installed on the S9200-64X, +it is automatically initialized. If you want to manual initialization, the +utility command usage as follows: +``` + i2c_utils.sh i2c_init +``` + +### EEPROM + +The EEPROM is including the board SKU, model name, vendor name, serial number, +and other information can be accessed with the specific eeprom kernel module. +After using `modprobe eeprom_mb` to detect the eeprom, it will show up in sysfs. + +The hexdump utility can be used to decode the raw output of the EEPROM. +For example, +``` + bash# echo "mb_eeprom 0x54" > /sys/bus/i2c/devices/i2c-9/new_device + bash# cat /sys/bus/i2c/drivers/mb_eeprom/9-0054/eeprom | hexdump -C +``` + +### Front panel LEDs + +LEDs can be setup on/off by using i2c utility `/usr/sbin/i2c_utils.sh`. +Utility function command usage as follows: + +``` +Status LED: + i2c_utils.sh i2c_sys_led green|amber + +Fan status LED: + i2c_utils.sh i2c_fan_led green|amber + +PSU1 status LED: + i2c_utils.sh i2c_psu1_led green|amber + +PSU2 status LED: + i2c_utils.sh i2c_psu2_led green|amber + +``` +QSFP Module Port LEDs control by ASIC library. + + +### Fan speed + +Fan speed are controlled by the w83795 kernel module. +It can be found in `/sys/class/hwmon/hwmon5/device/`. +If they were compiled as modules, you will need to modprobe w83795 for +their sysfs entries to show up. Each fan has an `fan_input` file +for reading the fan speed. And `pwm2` setting fan1/fan3/fan5/fan7. + +There is docker-platform-monitor container installed fancontrol package that can +automatic control platform fan speed. + + +### Temperature sensors + +Temperature sensors are controlled by the w83795 kernel +module. It can be found in `/sys/class/hwmon/hwmon5/device/`. +If they were compiled as modules, then you will need to modprobe w83795 for +their sysfs entries to show up. +`temp1_input` is front MAC temperature sensor. `temp2_input` is rear MAC +temperature sensor. + +There is docker-platform-monitor container installed lm-sensors package that can +monitor platform temperature. And `sensors` command can show each +temperature sensors status. + +### Power supplies + +Power supplies status and its EEPROM info can be used i2c utility +`/usr/sbin/i2c_utils.sh` to get. +The usage as follows: +``` +PSU EEPROM: + i2c_utils.sh i2c_psu_eeprom_get + hexdump -C psu0.rom + hexdump -C psu1.rom + +PSU Status: + i2c_utils.sh i2c_psu_status +``` + +### QSFPs +QSFP modules are managed by the pca9548 kernel driver. +The i2c utility `/usr/sbin/i2c_utils.sh` can be used to get status and +module EEPROM informations. +The usage as follows: +``` +QSFP EEPROM: + i2c_utils.sh i2c_qsfp_eeprom_get [1-64] + +QSFP Insert Event: + i2c_utils.sh i2c_qsfp_eeprom_get [1-64] + 0 => not insert + 1 => inserted +``` + diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/Makefile b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/Makefile new file mode 100755 index 000000000000..1a9e4e314e8e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/Makefile @@ -0,0 +1,3 @@ +obj-m := eeprom_mb.o +obj-m += cpld.o +obj-m += ingrasys_s9200_64x_psu.o diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/cpld.c b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/cpld.c new file mode 100755 index 000000000000..7b16f5d3e321 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/cpld.c @@ -0,0 +1,498 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define S9200_MUX_BASE_NR 0 +#define CPLD_DEVICE_NUM 5 + +/* CPLD registers */ +#define CPLD_REG_REV 0x01 +#define CPLD_REG_ID 0x02 +#define CPLD_REG_10G_MUX 0x41 + +/* QSFP signal bit in register */ +#define BIT_RST 0 +#define BIT_LPM 2 +#define BIT_INT 0 +#define BIT_ABS 1 + +static void device_release(struct device *dev) +{ + return; +} + +/* + * S9200 CPLD register addresses + */ +static const int int_abs_reg[CPLD_DEVICE_NUM][2]= { + {0x20, 0x2B}, + {0x20, 0x2C}, + {0x20, 0x2C}, + {0x20, 0x2C}, + {0x20, 0x2C} +}; + +static const int rst_lp_reg[CPLD_DEVICE_NUM][2]= { + {0x30, 0x3B}, + {0x30, 0x3C}, + {0x30, 0x3C}, + {0x30, 0x3C}, + {0x30, 0x3C} +}; + +/* + * S9200 CPLD + */ + +enum cpld_type { + cpld_1, + cpld_2, + cpld_3, + cpld_4, + cpld_5, +}; + +enum qsfp_signal { + sig_int, + sig_abs, + sig_rst, + sig_lpm +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data s9200_cpld_platform_data[] = { + [cpld_1] = { + .reg_addr = 0x33, + }, + + [cpld_2] = { + .reg_addr = 0x33, + }, + + [cpld_3] = { + .reg_addr = 0x33, + }, + + [cpld_4] = { + .reg_addr = 0x33, + }, + + [cpld_5] = { + .reg_addr = 0x33, + }, +}; + +static struct platform_device s9200_cpld = { + .name = "ingrasys-s9200-cpld", + .id = 0, + .dev = { + .platform_data = s9200_cpld_platform_data, + .release = device_release + }, +}; + +/* + * S9200 I2C DEVICES + */ + +struct i2c_device_platform_data { + int parent; + struct i2c_board_info info; + struct i2c_client *client; +}; + +/* module_platform_driver */ +static ssize_t get_cpld_reg(struct device *dev, struct device_attribute *devattr, char *buf, int signal) +{ + int ret; + u64 data = 0; + u64 shift = 0; + int i = 0; + int j = 0; + int port = 0; + int bit = 0; + int bit_mask = 0; + int (*reg)[CPLD_DEVICE_NUM][2]; + struct cpld_platform_data *pdata = NULL; + + pdata = dev->platform_data; + + switch(signal) { + case sig_int: + bit = BIT_INT; + reg = (typeof(reg)) &int_abs_reg; + break; + case sig_abs: + bit = BIT_ABS; + reg = (typeof(reg)) &int_abs_reg; + break; + case sig_rst: + bit = BIT_RST; + reg = (typeof(reg)) &rst_lp_reg; + break; + case sig_lpm: + bit = BIT_LPM; + reg = (typeof(reg)) &rst_lp_reg; + break; + default: + return sprintf(buf, "na"); + } + bit_mask = 0x1 << bit; + + for (i=0; i> bit)) << port; + data |= shift; + port++; + } + } + + return sprintf(buf, "0x%016llx\n", data); +} + +static ssize_t set_cpld_reg(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count, int signal) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + u8 current_reg_val = 0; + u8 new_reg_val = 0; + int value; + int i = 0; + int j = 0; + int port = 0; + int ret = 0; + int bit = 0; + int (*reg)[CPLD_DEVICE_NUM][2]; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + switch(signal) { + case sig_int: + bit = BIT_INT; + reg = (typeof(reg)) &int_abs_reg; + break; + case sig_abs: + bit = BIT_ABS; + reg = (typeof(reg)) &int_abs_reg; + break; + case sig_rst: + bit = BIT_RST; + reg = (typeof(reg)) &rst_lp_reg; + break; + case sig_lpm: + bit = BIT_LPM; + reg = (typeof(reg)) &rst_lp_reg; + break; + default: + return sprintf(buf, "na"); + } + + for (i=0; i> port) & 0x1; + + //set value on bit N of new_reg_val + if (value > 0) { + new_reg_val = current_reg_val | (u8) (0x1 << bit); + } else { + new_reg_val = current_reg_val & (u8) ~(0x1 << bit); + } + //write reg value if changed + if (current_reg_val != new_reg_val) { + ret = i2c_smbus_write_byte_data(pdata[i].client, j, + (u8)(new_reg_val)); + if (ret < 0){ + return ret; + } + } + port++; + } + } + + return count; +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) +{ + return get_cpld_reg(dev, devattr, buf, sig_lpm); +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + return set_cpld_reg(dev, devattr, buf, count, sig_lpm); +} + +static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) +{ + return get_cpld_reg(dev, devattr, buf, sig_rst); +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + return set_cpld_reg(dev, devattr, buf, count, sig_rst); +} + +static ssize_t get_modprs(struct device *dev, struct device_attribute *devattr, char *buf) +{ + return get_cpld_reg(dev, devattr, buf, sig_abs); +} + +static ssize_t get_int(struct device *dev, struct device_attribute *devattr, char *buf) +{ + return get_cpld_reg(dev, devattr, buf, sig_int); +} + +static ssize_t get_cpld_version(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int i = 0; + int cnt = 0; + u8 reg_val_rev[CPLD_DEVICE_NUM]; + u8 reg_val_id[CPLD_DEVICE_NUM]; + + struct cpld_platform_data *pdata = dev->platform_data; + + //get reg value + for (i=0; i> 6 & 0x1, + reg_val_id[i] & 0x7); + } + + return cnt; +} + +static ssize_t set_10g_mux(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + u8 data; + u8 current_reg_val = 0; + u8 new_reg_val = 0; + int cpld_dev_num=cpld_1; + int reg_offset=CPLD_REG_10G_MUX; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + int value; + int i = 0; + int port = 0; + int ret = 0; + int bit = 0; + + err = kstrtou8(buf, 16, &new_reg_val); + if (err) + return err; + + //read reg value + current_reg_val = i2c_smbus_read_byte_data(pdata[cpld_dev_num].client, reg_offset); + if (current_reg_val < 0) { + return current_reg_val; + } + + //write reg value if changed + if (current_reg_val != new_reg_val) { + ret = i2c_smbus_write_byte_data(pdata[cpld_dev_num].client, reg_offset, + (u8)(new_reg_val)); + if (ret < 0){ + return ret; + } + } + + return count; +} + +static ssize_t get_10g_mux(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int cpld_dev_num=cpld_1; + int reg_offset=CPLD_REG_10G_MUX; + u8 reg_val=0; + struct cpld_platform_data *pdata = dev->platform_data; + + //read 10G mux register + reg_val = i2c_smbus_read_byte_data(pdata[cpld_dev_num].client, reg_offset); + if (reg_val < 0) { + return sprintf(buf, "na"); + } + + return sprintf(buf, "0x%x\n", reg_val); +} + +static DEVICE_ATTR(qsfp_int, S_IRUGO, get_int, NULL); +static DEVICE_ATTR(qsfp_modprs, S_IRUGO, get_modprs, NULL); +static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR, get_lpmode, set_lpmode); +static DEVICE_ATTR(qsfp_reset, S_IRUGO | S_IWUSR, get_reset, set_reset); +static DEVICE_ATTR(cpld_version, S_IRUGO, get_cpld_version, NULL); +static DEVICE_ATTR(cpld_10g_mux, S_IRUGO | S_IWUSR, get_10g_mux, set_10g_mux); + +static struct attribute *s9200_cpld_attrs[] = { + &dev_attr_qsfp_int.attr, + &dev_attr_qsfp_lpmode.attr, + &dev_attr_qsfp_reset.attr, + &dev_attr_qsfp_modprs.attr, + &dev_attr_cpld_version.attr, + &dev_attr_cpld_10g_mux.attr, + NULL, +}; + +static struct attribute_group s9200_cpld_attr_grp = { + .attrs = s9200_cpld_attrs, +}; + +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent[CPLD_DEVICE_NUM]; + int i; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + for (i = 0; i < CPLD_DEVICE_NUM; i++) { + parent[i] = i2c_get_adapter(S9200_MUX_BASE_NR + i + 1); + if (!parent[i]) { + printk(KERN_WARNING "Parent adapter (%d) not found\n", + S9200_MUX_BASE_NR + i + 1); + return -ENODEV; + } + pdata[i].client = i2c_new_dummy(parent[i], pdata[i].reg_addr); + if (!pdata[i].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr); + goto error; + } + } + + ret = sysfs_create_group(&pdev->dev.kobj, &s9200_cpld_attr_grp); + if (ret) + goto error; + + return 0; + +error: + i2c_put_adapter(parent[i]); + i--; + for (; i >= 0; i--) { + if (pdata[i].client) { + i2c_unregister_device(pdata[i].client); + i2c_put_adapter(parent[i]); + } + } + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + int i; + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + + sysfs_remove_group(&pdev->dev.kobj, &s9200_cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } else { + for (i = 0; i < CPLD_DEVICE_NUM; i++) { + if (pdata[i].client) { + parent = (pdata[i].client)->adapter; + i2c_unregister_device(pdata[i].client); + i2c_put_adapter(parent); + } + } + } + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "ingrasys-s9200-cpld", + }, +}; + +static int __init ingrasys_s9200_platform_init(void) +{ + int ret = 0; + + printk("ingrasysl_s9200_platform module initialization\n"); + + mdelay(10000); + + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpld driver\n"); + goto error_cpld_driver; + } + ret = platform_device_register(&s9200_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpld device\n"); + goto error_cpld; + } + + return 0; + +error_cpld: + platform_driver_unregister(&cpld_driver); +error_cpld_driver: + return ret; +} + +static void __exit ingrasys_s9200_platform_exit(void) +{ + platform_device_unregister(&s9200_cpld); + platform_driver_unregister(&cpld_driver); +} + +module_init(ingrasys_s9200_platform_init); +module_exit(ingrasys_s9200_platform_exit); + +MODULE_DESCRIPTION("Ingrasys S9200 Platform Support"); +MODULE_AUTHOR("Jason Tsai "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/eeprom_mb.c b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/eeprom_mb.c new file mode 100755 index 000000000000..1cdb26658f5a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/eeprom_mb.c @@ -0,0 +1,267 @@ +/* + * Copyright (C) 1998, 1999 Frodo Looijaard and + * Philip Edelbrock + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003 IBM Corp. + * Copyright (C) 2004 Jean Delvare + * + * 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. + */ + +/* enable dev_dbg print out */ +//#define DEBUG + +#include +#include +#include +#include +#include +#include +#include + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { /*0x50, 0x51, 0x52, 0x53, 0x54, + 0x55, 0x56, 0x57,*/ I2C_CLIENT_END }; + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 512 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void mb_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, (u8)((addr >> 8) & 0xFF), (u8)(addr & 0xFF)); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t mb_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + mb_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static ssize_t mb_eeprom_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + int ret; + int i; + u8 cmd; + u16 value16; + + dev_dbg(&client->dev, "mb_eeprom_write off=%d, count=%d\n", (int)off, (int)count); + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + mutex_lock(&data->update_lock); + + for(i=0; i < count; i++) { + /* write command */ + cmd = (off >> 8) & 0xff; + value16 = off & 0xff; + value16 |= buf[i] << 8; + ret = i2c_smbus_write_word_data(client, cmd, value16); + + if (ret < 0) { + dev_err(&client->dev, "write address failed at %d \n", (int)off); + goto exit; + } + + off++; + + /* need to wait for write complete */ + udelay(10000); + } +exit: + mutex_unlock(&data->update_lock); + /* force to update client when reading */ + for(i=0; i < SLICE_NUM; i++) { + data->last_updated[i] = 0; + } + + return count; +} + +static struct bin_attribute mb_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO | S_IWUSR, + }, + .size = EEPROM_SIZE, + .read = mb_eeprom_read, + .write = mb_eeprom_write, +}; + +/* Return 0 if detection is successful, -ENODEV otherwise */ +static int mb_eeprom_detect(struct i2c_client *client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + + /* EDID EEPROMs are often 24C00 EEPROMs, which answer to all + addresses 0x50-0x57, but we only care about 0x51 and 0x55. So decline + attaching to addresses >= 0x56 on DDC buses */ + if (!(adapter->class & I2C_CLASS_SPD) && client->addr >= 0x56) { + return -ENODEV; + } + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE) + && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + return -ENODEV; + } + + strlcpy(info->type, "eeprom", I2C_NAME_SIZE); + + return 0; +} + +static int mb_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &mb_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int mb_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &mb_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id mb_eeprom_id[] = { + { "mb_eeprom", 0 }, + { } +}; + +static struct i2c_driver mb_eeprom_driver = { + .driver = { + .name = "mb_eeprom", + }, + .probe = mb_eeprom_probe, + .remove = mb_eeprom_remove, + .id_table = mb_eeprom_id, + + .class = I2C_CLASS_DDC | I2C_CLASS_SPD, + .detect = mb_eeprom_detect, + .address_list = normal_i2c, +}; + +module_i2c_driver(mb_eeprom_driver); + +MODULE_AUTHOR("Wade "); +MODULE_DESCRIPTION("Ingrasys Mother Board EEPROM driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/ingrasys_s9200_64x_platform.h b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/ingrasys_s9200_64x_platform.h new file mode 100644 index 000000000000..8a38965e7932 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/ingrasys_s9200_64x_platform.h @@ -0,0 +1,148 @@ +#ifndef _S9200_64X_PLATFORM_H +#define _S9200_64X_PLATFORM_H + +#include + +// remove debug before release +#define DEBUG + +enum bus_order { + I2C_BUS_MAIN, + MUX_9548_0_CH0, + MUX_9548_0_CH1, + MUX_9548_0_CH2, + MUX_9548_0_CH3, + MUX_9548_0_CH4, + MUX_9548_0_CH5, + MUX_9548_0_CH6, + MUX_9548_0_CH7, + MUX_9548_1_CH0, + MUX_9548_1_CH1, + MUX_9548_1_CH2, + MUX_9548_1_CH3, + MUX_9548_1_CH4, + MUX_9548_1_CH5, + MUX_9548_1_CH6, + MUX_9548_1_CH7, + MUX_9546_0_CH0, + MUX_9546_0_CH1, + MUX_9546_0_CH2, + MUX_9546_0_CH3, + MUX_9546_1_CH0, + MUX_9546_1_CH1, + MUX_9546_1_CH2, + MUX_9546_1_CH3, + MUX_9548_2_CH0, + MUX_9548_2_CH1, + MUX_9548_2_CH2, + MUX_9548_2_CH3, + MUX_9548_2_CH4, + MUX_9548_2_CH5, + MUX_9548_2_CH6, + MUX_9548_2_CH7, + MUX_9548_3_CH0, + MUX_9548_3_CH1, + MUX_9548_3_CH2, + MUX_9548_3_CH3, + MUX_9548_3_CH4, + MUX_9548_3_CH5, + MUX_9548_3_CH6, + MUX_9548_3_CH7, + MUX_9548_4_CH0, + MUX_9548_4_CH1, + MUX_9548_4_CH2, + MUX_9548_4_CH3, + MUX_9548_4_CH4, + MUX_9548_4_CH5, + MUX_9548_4_CH6, + MUX_9548_4_CH7, + MUX_9548_5_CH0, + MUX_9548_5_CH1, + MUX_9548_5_CH2, + MUX_9548_5_CH3, + MUX_9548_5_CH4, + MUX_9548_5_CH5, + MUX_9548_5_CH6, + MUX_9548_5_CH7, + MUX_9548_6_CH0, + MUX_9548_6_CH1, + MUX_9548_6_CH2, + MUX_9548_6_CH3, + MUX_9548_6_CH4, + MUX_9548_6_CH5, + MUX_9548_6_CH6, + MUX_9548_6_CH7, + MUX_9548_7_CH0, + MUX_9548_7_CH1, + MUX_9548_7_CH2, + MUX_9548_7_CH3, + MUX_9548_7_CH4, + MUX_9548_7_CH5, + MUX_9548_7_CH6, + MUX_9548_7_CH7, + MUX_9548_8_CH0, + MUX_9548_8_CH1, + MUX_9548_8_CH2, + MUX_9548_8_CH3, + MUX_9548_8_CH4, + MUX_9548_8_CH5, + MUX_9548_8_CH6, + MUX_9548_8_CH7, + MUX_9548_9_CH0, + MUX_9548_9_CH1, + MUX_9548_9_CH2, + MUX_9548_9_CH3, + MUX_9548_9_CH4, + MUX_9548_9_CH5, + MUX_9548_9_CH6, + MUX_9548_9_CH7, + MUX_9548_10_CH0, + MUX_9548_10_CH1, + MUX_9548_10_CH2, + MUX_9548_10_CH3, + MUX_9548_10_CH4, + MUX_9548_10_CH5, + MUX_9548_10_CH6, + MUX_9548_10_CH7, +}; + +#define I2C_ADDR_MUX_9555_0 (0x20) +#define I2C_ADDR_MUX_9555_1 (0x24) +#define I2C_ADDR_MUX_9555_2 (0x25) +#define I2C_ADDR_MUX_9555_3 (0x26) +#define I2C_ADDR_MUX_9539_0 (0x76) +#define I2C_ADDR_MUX_9539_1 (0x76) +#define I2C_BUS_FAN_STATUS (I2C_BUS_MAIN) +#define I2C_BUS_SYS_LED (MUX_9548_1_CH1) + +#define NUM_OF_I2C_MUX (11) +#define NUM_OF_CPLD (5) +#define NUM_OF_QSFP_PORT (64) +#define NUM_OF_SFP_PORT (2) +#define QSFP_EEPROM_I2C_ADDR (0x50) + +enum gpio_reg { + REG_PORT0_IN, + REG_PORT1_IN, + REG_PORT0_OUT, + REG_PORT1_OUT, + REG_PORT0_POL, + REG_PORT1_POL, + REG_PORT0_DIR, + REG_PORT1_DIR, +}; + +struct ing_i2c_board_info { + int ch; + int size; + struct i2c_board_info *board_info; +}; + +struct i2c_init_data { + __u16 ch; + __u16 addr; + __u8 reg; + __u8 value; +}; + +#endif diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/ingrasys_s9200_64x_psu.c b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/ingrasys_s9200_64x_psu.c new file mode 100644 index 000000000000..46642f1271ca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/modules/ingrasys_s9200_64x_psu.c @@ -0,0 +1,389 @@ +/* + * S9200-64X PSU driver + * + * Copyright (C) 2017 Ingrasys, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ingrasys_s9200_64x_platform.h" + +static ssize_t show_psu_eeprom(struct device *dev, + struct device_attribute *da, + char *buf); +static struct s9200_psu_data *s9200_psu_update_status(struct device *dev); +static struct s9200_psu_data *s9200_psu_update_eeprom(struct device *dev); +static int s9200_psu_read_block(struct i2c_client *client, + u8 command, + u8 *data, + int data_len); + + +#define DRIVER_NAME "psu" + +// Addresses scanned +static const unsigned short normal_i2c[] = { 0x50, I2C_CLIENT_END }; + +/* PSU EEPROM SIZE */ +#define EEPROM_SZ 256 +#define READ_EEPROM 1 +#define NREAD_EEPROM 0 + +static struct i2c_client pca9555_client; + +/* pca9555 gpio pin mapping */ +#define PSU2_PWROK 0 +#define PSU2_PRSNT_L 1 +#define PSU2_PWRON_L 2 +#define PSU1_PWROK 3 +#define PSU1_PRSNT_L 4 +#define PSU1_PWRON_L 5 +#define TMP_75_INT_L 6 + +/* Driver Private Data */ +struct s9200_psu_data { + struct mutex lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + s32 status; /* IO expander value */ + char eeprom[EEPROM_SZ]; /* psu eeprom data */ + char psuABS; /* PSU absent */ + char psuPG; /* PSU power good */ +}; + +enum psu_index +{ + s9200_psu1, + s9200_psu2 +}; + +/* + * display power good attribute + */ +static ssize_t +show_psu_pg(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct s9200_psu_data *data = s9200_psu_update_status(dev); + unsigned int value; + + mutex_lock(&data->lock); + value = data->psuPG; + mutex_unlock(&data->lock); + + return sprintf(buf, "%d\n", value); +} + +/* + * display power absent attribute + */ +static ssize_t +show_psu_abs(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct s9200_psu_data *data = s9200_psu_update_status(dev); + unsigned int value; + + mutex_lock(&data->lock); + value = data->psuABS; + mutex_unlock(&data->lock); + + return sprintf(buf, "%d\n", value); +} + + +/* + * sysfs attributes for psu + */ +static DEVICE_ATTR(psu_pg, S_IRUGO, show_psu_pg, NULL); +static DEVICE_ATTR(psu_abs, S_IRUGO, show_psu_abs, NULL); +static DEVICE_ATTR(psu_eeprom, S_IRUGO, show_psu_eeprom, NULL); + +static struct attribute *s9200_psu_attributes[] = { + &dev_attr_psu_pg.attr, + &dev_attr_psu_abs.attr, + &dev_attr_psu_eeprom.attr, + NULL +}; + +/* + * display psu eeprom content + */ +static ssize_t +show_psu_eeprom(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct s9200_psu_data *data = s9200_psu_update_eeprom(dev); + + memcpy(buf, (char *)data->eeprom, EEPROM_SZ); + return EEPROM_SZ; +} + +static const struct attribute_group s9200_psu_group = { + .attrs = s9200_psu_attributes, +}; + +/* + * check gpio expander is accessible + */ +static int +pca9555_detect(struct i2c_client *client) +{ + if (i2c_smbus_read_byte_data(client, REG_PORT0_DIR) < 0) { + return -ENODEV; + } + + return 0; +} + +/* + * client address init + */ +static void +i2c_devices_client_address_init(struct i2c_client *client) +{ + pca9555_client = *client; + pca9555_client.addr = 0x25; +} + +static int +s9200_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct s9200_psu_data *data; + int status, err; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct s9200_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + memset(data, 0, sizeof(struct s9200_psu_data)); + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->lock); + + i2c_devices_client_address_init(client); + + err = pca9555_detect(&pca9555_client); + if (err) { + dev_info(&client->dev, "pca9555_detect failed\n"); + return err; + } + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &s9200_psu_group); + if (status) { + goto exit_free; + } + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &s9200_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int +s9200_psu_remove(struct i2c_client *client) +{ + struct s9200_psu_data *data = i2c_get_clientdata(client); + + sysfs_remove_group(&client->dev.kobj, &s9200_psu_group); + kfree(data); + + return 0; +} + + +/* + * psu eeprom read utility + */ +static int +s9200_psu_read_block(struct i2c_client *client, + u8 command, + u8 *data, + int data_len) +{ + int i=0, ret=0; + int blk_max = 32; //max block read size + + /* read eeprom, 32 * 8 = 256 bytes */ + for (i=0; i < EEPROM_SZ/blk_max; i++) { + ret = i2c_smbus_read_i2c_block_data(client, (i*blk_max), blk_max, + data + (i*blk_max)); + if (ret < 0) { + return ret; + } + } + return ret; +} + +/* + * update eeprom content + */ +static struct s9200_psu_data +*s9200_psu_update_eeprom(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct s9200_psu_data *data = i2c_get_clientdata(client); + s32 status = 0; + int psu_pwrok = 0; + int psu_prsnt_l = 0; + + mutex_lock(&data->lock); + + if (time_after(jiffies, data->last_updated + 300 * HZ) + || !data->valid) { + + /* Read psu status */ + + status = i2c_smbus_read_word_data(&(pca9555_client), REG_PORT0_IN); + data->status = status; + + /*read psu status from io expander*/ + + if (data->index == s9200_psu1) { + psu_pwrok = PSU1_PWROK; + psu_prsnt_l = PSU1_PRSNT_L; + } else { + psu_pwrok = PSU2_PWROK; + psu_prsnt_l = PSU2_PRSNT_L; + } + data->psuPG = (status >> psu_pwrok) & 0x1; + data->psuABS = (status >> psu_prsnt_l) & 0x1; + + /* Read eeprom */ + if (!data->psuABS) { + //clear local eeprom data + memset(data->eeprom, 0, EEPROM_SZ); + + //read eeprom + status = s9200_psu_read_block(client, 0, data->eeprom, + ARRAY_SIZE(data->eeprom)); + + if (status < 0) { + memset(data->eeprom, 0, EEPROM_SZ); + dev_err(&client->dev, "Read eeprom failed, status=(%d)\n", status); + } else { + data->valid = 1; + } + } else { + memset(data->eeprom, 0, EEPROM_SZ); + } + data->last_updated = jiffies; + } + + mutex_unlock(&data->lock); + + return data; +} + +/* + * update psu status + */ +static struct s9200_psu_data +*s9200_psu_update_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct s9200_psu_data *data = i2c_get_clientdata(client); + s32 status = 0; + int psu_pwrok = 0; + int psu_prsnt_l = 0; + + mutex_lock(&data->lock); + + /* Read psu status */ + + status = i2c_smbus_read_word_data(&(pca9555_client), REG_PORT0_IN); + data->status = status; + + /*read psu status from io expander*/ + + if (data->index == s9200_psu1) { + psu_pwrok = PSU1_PWROK; + psu_prsnt_l = PSU1_PRSNT_L; + } else { + psu_pwrok = PSU2_PWROK; + psu_prsnt_l = PSU2_PRSNT_L; + } + data->psuPG = (status >> psu_pwrok) & 0x1; + data->psuABS = (status >> psu_prsnt_l) & 0x1; + + mutex_unlock(&data->lock); + + return data; +} + +static const struct i2c_device_id s9200_psu_id[] = { + { "psu1", s9200_psu1 }, + { "psu2", s9200_psu2 }, + {} +}; + +MODULE_DEVICE_TABLE(i2c, s9200_psu_id); + +static struct i2c_driver s9200_psu_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = s9200_psu_probe, + .remove = s9200_psu_remove, + .id_table = s9200_psu_id, + .address_list = normal_i2c, +}; + +static int __init s9200_psu_init(void) +{ + return i2c_add_driver(&s9200_psu_driver); +} + +static void __exit s9200_psu_exit(void) +{ + i2c_del_driver(&s9200_psu_driver); +} + +module_init(s9200_psu_init); +module_exit(s9200_psu_exit); + +MODULE_AUTHOR("Jason Tsai "); +MODULE_DESCRIPTION("S9200-64X psu driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/service/qsfp-monitor.service b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/service/qsfp-monitor.service new file mode 100644 index 000000000000..bcb9beb6a999 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/service/qsfp-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description= This QSFP Monitor service is to setup QSFP SI. +Requires=s9200-64x-monitor.service +After=s9200-64x-monitor.service + +[Service] +ExecStart=/usr/sbin/qsfp_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/service/s9200-64x-monitor.service b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/service/s9200-64x-monitor.service new file mode 100644 index 000000000000..bd92628a6c3f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/service/s9200-64x-monitor.service @@ -0,0 +1,19 @@ +[Unit] +Description= This Platform Monitor service is to initialize platform and monitor platform. +Before=platform-monitor.service +After=sysinit.target +Wants=fancontrol.service +Wants=qsfp-monitor.service +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/sbin/i2c_utils.sh i2c_init +ExecStart=/usr/sbin/s9200_64x_monitor.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/i2c_utils.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/i2c_utils.sh new file mode 100644 index 000000000000..d0ca56f4d1b0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/i2c_utils.sh @@ -0,0 +1,1942 @@ +#!/bin/bash + +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +VERSION="1.0.0" +TRUE=200 +FALSE=404 + +EXEC_FUNC=${1} +COLOR_LED=${2} +QSFP_PORT=${2} +QSFP_INIT_ACTION=${2} +MB_EEPROM_ACTION=${2} +TARGET_10G_MUX=${2} +QSFP_ACTION=${3} +QSFP_VALUE=${4} +ONOFF_LED=${3} +FAN_TRAY=${4} + +############################################################ +# Distributor ID: Debian +# Description: Debian GNU/Linux 8.6 (jessie) +# Release: 8.6 +# Codename: jessie +# Linux debian 3.16.0-4-amd64 #1 +# SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux +############################################################ + +# Color Definition +COLOR_TITLE="\e[1;32m" ### Green ### +COLOR_WARNING="\e[1;33m" ### Yellow ### +COLOR_ERROR="\e[1;31m" ### Red ### +COLOR_END="\e[0m" ### END ### + +I2C_NUM=0 +NUM_I801_DEVICE=$((I2C_NUM++)) #0 + +#MUX PCA9548#0 CPLD (I2C_NUM 1~8) +NUM_MUX_9548_CPLD_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_CPLD_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548#1 UCD (I2C_NUM 9~16) +NUM_MUX_9548_UCD_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_UCD_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9545 PSU (I2C_NUM 17~20) +NUM_MUX_9545_PSU_CHAN=() +for (( i=0; i<4; ++i )) +do + NUM_MUX_9545_PSU_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548 QSFP ROOT (I2C_NUM 21~28) +NUM_MUX_9548_QSFP_ROOT_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_QSFP_ROOT_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548 QSFP Port 0~7 (I2C_NUM 29~36) +NUM_MUX_9548_QSFP_0_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_QSFP_0_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548 QSFP Port 8~15 (I2C_NUM 37~44) +NUM_MUX_9548_QSFP_1_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_QSFP_1_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548 QSFP Port 16~23 (I2C_NUM 45~52) +NUM_MUX_9548_QSFP_2_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_QSFP_2_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548 QSFP Port 24~31 (I2C_NUM 53~60) +NUM_MUX_9548_QSFP_3_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_QSFP_3_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548 QSFP Port 32~39 (I2C_NUM 61~68) +NUM_MUX_9548_QSFP_4_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_QSFP_4_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548 QSFP Port 40~47 (I2C_NUM 69~76) +NUM_MUX_9548_QSFP_5_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_QSFP_5_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548 QSFP Port 48~55 (I2C_NUM 77~84) +NUM_MUX_9548_QSFP_6_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_QSFP_6_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548 QSFP Port 56~63 (I2C_NUM 85~92) +NUM_MUX_9548_QSFP_7_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_QSFP_7_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9545 SFP (I2C_NUM 93~96) +NUM_MUX_9545_SFP_CHAN=() +for (( i=0; i<4; ++i )) +do + NUM_MUX_9545_SFP_CHAN[i]=$((I2C_NUM++)) +done + +#MUX PCA9548 CPLD SW Upgrade (I2C_NUM 97~104) +NUM_MUX_9548_CPLD_SW_CHAN=() +for (( i=0; i<8; ++i )) +do + NUM_MUX_9548_CPLD_SW_CHAN[i]=$((I2C_NUM++)) +done + +#MUX Alias +I2C_BUS_PSU1_EEPROM=${NUM_MUX_9545_PSU_CHAN[1]} +I2C_BUS_PSU2_EEPROM=${NUM_MUX_9545_PSU_CHAN[0]} +I2C_BUS_LED_BOARD=${NUM_MUX_9548_UCD_CHAN[1]} +I2C_BUS_ID_GPIO=${NUM_MUX_9548_UCD_CHAN[2]} +I2C_BUS_10GMUX=${NUM_MUX_9548_UCD_CHAN[4]} +I2C_BUS_HWM=${NUM_MUX_9548_UCD_CHAN[7]} +I2C_BUS_FAN_BOARD=${NUM_I801_DEVICE} +I2C_BUS_MB_EEPROM=${NUM_I801_DEVICE} +I2C_BUS_TH_RESET=${NUM_I801_DEVICE} +I2C_BUS_BOARD_TYPE=${NUM_I801_DEVICE} +I2C_BUS_BMC_BOARD_TYPE=${NUM_I801_DEVICE} +I2C_BUS_LM75_MAC=${NUM_MUX_9548_CPLD_CHAN[5]} +I2C_BUS_LM75_FRONT=${NUM_MUX_9548_CPLD_CHAN[6]} +I2C_BUS_LM75_REAR=${NUM_MUX_9548_CPLD_CHAN[5]} +I2C_BUS_PSU_INT=${NUM_I801_DEVICE} +I2C_BUS_PSU_STATUS=${NUM_I801_DEVICE} +I2C_BUS_MUX_RST=${NUM_I801_DEVICE} +#CPU Board +I2C_BUS_CPU_EEPROM=${NUM_I801_DEVICE} +I2C_BUS_CPU_TMP75=${NUM_I801_DEVICE} +I2C_BUS_MUX_CPU_CPLD=${NUM_I801_DEVICE} + +PATH_SYS_I2C_DEVICES="/sys/bus/i2c/devices" +PATH_SYS_CPLD="/sys/devices/platform/ingrasys-s9200-cpld.0" +PATH_HWMON_ROOT_DEVICES="/sys/class/hwmon" +PATH_HWMON_W83795_DEVICE="${PATH_HWMON_ROOT_DEVICES}/hwmon5" +PATH_I801_DEVICE="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}" +PATH_LM75_MAC="${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_LM75_MAC}" +PATH_LM75_FRONT="${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_LM75_FRONT}" +PATH_LM75_REAR="${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_LM75_REAR}" +PATH_CPU_TMP75="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_I801_DEVICE}" +PATH_BMC_TMP75="${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_HWM}" +PATH_PSU1_EERPOM=${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_PSU1_EEPROM} +PATH_PSU2_EEPROM=${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_PSU2_EEPROM} +PATH_10GMUX=${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_10GMUX} +#PATH for MUX PCA9548_QSFP_ROOT +PATH_MUX_9548_QSFP_ROOT="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9545_PSU_CHAN[2]}" +PATH_MUX_9548_QSFP_ROOT_CHAN=() +for (( i=0; i<8; ++i )) +do + PATH_MUX_9548_QSFP_ROOT_CHAN[i]="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9548_QSFP_ROOT_CHAN[i]}" +done +PATH_MUX_9545_SFP="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9545_PSU_CHAN[3]}" +PATH_MUX_9545_SFP_CHAN=() +for (( i=0; i<4; ++i )) +do + PATH_MUX_9545_SFP_CHAN[i]="${PATH_SYS_I2C_DEVICES}/i2c-${NUM_MUX_9545_SFP_CHAN[i]}" +done + +#i2cmap and gpiomap path +PATH_I2CMAP=/tmp/i2cmap + +#Mother Board +I2C_ADDR_MUX_9539_TH_RST=0x74 +I2C_ADDR_LED_BOARD=0x75 +I2C_ADDR_FAN_BOARD=0x20 +I2C_ADDR_ID_GPIO=0x27 +I2C_ADDR_MUX_9548_CPLD=0x70 +I2C_ADDR_MUX_9548_UCD=0x76 +I2C_ADDR_MUX_9545_PSU=0x72 +I2C_ADDR_MUX_9548_QSFP_ROOT=0x71 +I2C_ADDR_MUX_9548_QSFP=0x73 +I2C_ADDR_MUX_9545_SFP=0x73 +I2C_ADDR_CPLD=0x33 +I2C_ADDR_MB_EEPROM=0x55 +I2C_ADDR_QSFP_EEPROM=0x50 +I2C_ADDR_PSU_EEPROM=0x50 +I2C_ADDR_LM75_MAC=0x4E +I2C_ADDR_LM75_FRONT=0x4D +I2C_ADDR_LM75_REAR=0x4D +I2C_ADDR_10GMUX=0x67 +#Dummy BMC Board +I2C_ADDR_HWM=0x2F +I2C_ADDR_PSU_INT=0x24 #PSU Interrup on Dummy BMC Board +I2C_ADDR_BMC_BOARD_TYPE=0x24 #PSU Status on Dummy BMC Board +I2C_ADDR_PSU_STATUS=0x25 #PSU Status on Dummy BMC Board +I2C_ADDR_MUX_RST=0x26 #MUX RST on Dummy BMC Board +I2C_ADDR_TMP75_BB=0x4A +#CPU Board +I2C_ADDR_CPU_EEPROM=0x51 +I2C_ADDR_CPU_TMP75=0x4F +I2C_ADDR_MUX_CPU_CPLD=0x77 + +#sysfs +PATH_SYSFS_PSU1="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_PSU1_EEPROM}-$(printf "%04x" $I2C_ADDR_PSU_EEPROM)" +PATH_SYSFS_PSU2="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_PSU2_EEPROM}-$(printf "%04x" $I2C_ADDR_PSU_EEPROM)" + +#Active High/Low +ACTIVE_LOW=1 +ACTIVE_HIGH=0 +#GPIO Direction In/Out +DIR_IN=in +DIR_OUT=out + +#Power Supply Status +PSU_DC_ON=1 +PSU_DC_OFF=0 +PSU_EXIST=1 +PSU_NOT_EXIST=0 + +#W83795 Registers +REG_BANK_SEL=0x00 +REG_VOLT_CTRL1=0x02 +REG_VOLT_CTRL2=0x03 +REG_TEMP_CTRL1=0x04 +REG_TEMP_CTRL2=0x05 + +#PCA9535 Registers +REG_IN_0=0 +REG_IN_1=1 +REG_OUT_0=2 +REG_OUT_1=3 +REG_POLARITY_0=4 +REG_POLARITY_1=5 +REG_CFG_0=6 +REG_CFG_1=7 + +#LM75 Registers +LM75_REG_TEMP=0x00 +LM75_REG_CONF=0x01 +LM75_REG_HYST=0x02 +LM75_REG_TOS=0x03 + +#Bit Mask +BIT_MASK=(1 2 4 8 16 32 64 128) + +#MUX Type +PCA9545="pca9545" +PCA9548="pca9548" + +#PLATFORM Variables +PORT_NUM=64 + +#CPLD Variables +CPLD_QSFP_GROUP=(12 25 38 51 64) +CPLD_QSFP_STATUS_REG_BASE=0x20 +CPLD_QSFP_MODE_SELECT_REG_BASE=0x30 +CPLD_QSFP_ABS="abs" +CPLD_QSFP_INT="int" +CPLD_QSFP_RST="rst" +CPLD_QSFP_LP="lp" + + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} i2c_init" + echo " : ${0} i2c_deinit" + echo " : ${0} i2c_temp_init" + echo " : ${0} i2c_fan_init" + echo " : ${0} i2c_volmon_init" + echo " : ${0} i2c_io_exp_init" + echo " : ${0} i2c_psu_eeprom_get" + echo " : ${0} i2c_mb_eeprom_get" + echo " : ${0} i2c_cpu_eeprom_get" + echo " : ${0} i2c_qsfp_eeprom_get [1-${PORT_NUM}]" + echo " : ${0} i2c_qsfp_eeprom_init new|delete" + echo " : ${0} i2c_mb_eeprom_init new|delete" + echo " : ${0} i2c_cpu_eeprom_init new|delete" + echo " : ${0} i2c_qsfp_status_get [1-${PORT_NUM}]" + echo " : ${0} i2c_qsfp_type_get [1-${PORT_NUM}]" + echo " : ${0} i2c_qsfp_signal_get [1-${PORT_NUM}] [abs|int|rst|lp]" + echo " : ${0} i2c_qsfp_signal_set [1-${PORT_NUM}] [rst|lp] [0|1] (low_active)" + echo " : ${0} i2c_board_type_get" + echo " : ${0} i2c_bmc_board_type_get" + echo " : ${0} i2c_psu_status" + echo " : ${0} i2c_led_psu_status_set" + echo " : ${0} i2c_led_fan_status_set" + echo " : ${0} i2c_led_fan_tray_status_set" + echo " : ${0} i2c_led_fan_tray_test" + echo " : ${0} i2c_cpld_version" + echo " : ${0} i2c_test_all" + echo " : ${0} i2c_led_test" + echo " : ${0} i2c_sys_led green|amber" + echo " : ${0} i2c_fan_led green|amber" + echo " : ${0} i2c_psu1_led green|amber" + echo " : ${0} i2c_psu2_led green|amber" + echo " : ${0} i2c_fan_tray_led green|amber on|off [1-4]" + echo " : ${0} i2c_10g_mux cpu|fp" + echo "----------------------------------------------------" +} + +#Pause function +function _pause { + read -p "$*" +} + +#Retry command function +function _retry { + local i + for i in {1..5}; + do + eval "${*}" && break || echo "retry"; sleep 1; + done +} + +#logical(front panel) to physical (falcon core) port mapping +function _port_logic2phy { + + local logic_port=$1 + local phy_port=0 + + if (( $logic_port >=1 && $logic_port <= 32 )) ; then + phy_port=$(( (logic_port-1)/2*4 + (logic_port-1)%2 + 1)) + elif (( $logic_port >=33 && $logic_port <= 64 )) ; then + phy_port=$(( (((logic_port-1)%32))/2*4 + (logic_port-1)%2 + 3)) + fi + + echo $phy_port +} + +#set i2cmap +function _set_i2cmap { + local i2c_n=$1 + local alias=$2 + + #create i2cmap dir if not exist + mkdir -p $PATH_I2CMAP + + #check i2c_n exists in sysfs + if [ ! -L ${PATH_SYS_I2C_DEVICES}/i2c-${i2c_n} ]; then + echo "${PATH_SYS_I2C_DEVICES}/i2c-${i2c_n} does not exist." + return + fi + + #create or update link + ln -sf ${PATH_SYS_I2C_DEVICES}/i2c-${i2c_n} ${PATH_I2CMAP}/${alias} +} + +#clear i2cmap +function _clear_i2cmap { + #delete i2cmap dir + rm -rf ${PATH_I2CMAP}/ +} + +#remove kernel module if exists +function _util_rmmod { + local mod=$1 + [ "$(lsmod | grep "^$mod ")" != "" ] && rmmod $mod +} + +function _create_i2c_mux_device { + local mux_type=$1 + local mux_addr=$2 + local mux_parent_chan=$3 + local mux_chan0=$4 + local mux_desc=$5 + + if [ ! -e "${PATH_SYS_I2C_DEVICES}/i2c-${mux_chan0}" ]; then + _retry "echo '$mux_type ${mux_addr}' > ${mux_parent_chan}/new_device" + _set_i2cmap ${mux_chan0} "${mux_desc}" + else + echo "${mux_desc} ${mux_addr} already init." + fi +} + +#I2C Init +function _i2c_init { + echo "=========================================================" + echo "# Description: I2C Init" + echo "=========================================================" + + _util_rmmod i2c_i801 + modprobe i2c_i801 #disable_features=0x10 + modprobe i2c_dev + modprobe i2c_mux_pca954x force_deselect_on_exit=1 + + #add MUX_9548_CPLD on I801 + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_CPLD ${PATH_I801_DEVICE} ${NUM_MUX_9548_CPLD_CHAN[0]} "PCA9548_CPLD" + + #add MUX_9548_UCD on I801 + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_UCD ${PATH_I801_DEVICE} ${NUM_MUX_9548_UCD_CHAN[0]} "PCA9548_UCD" + + #add MUX_9545_PSU on I801 + _create_i2c_mux_device $PCA9545 $I2C_ADDR_MUX_9545_PSU ${PATH_I801_DEVICE} ${NUM_MUX_9545_PSU_CHAN[0]} "PCA9545_PSU" + + #add MUX_9548_QSFP_ROOT on MUX_9545_PSU_CHAN[2] + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_QSFP_ROOT ${PATH_MUX_9548_QSFP_ROOT} ${NUM_MUX_9548_QSFP_ROOT_CHAN[0]} "PCA9548_QSPF_ROOT" + + #add MUX_9548_QSFP_0 on MUX_9548_QSFP_ROOT_CHAN[0] + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_QSFP ${PATH_MUX_9548_QSFP_ROOT_CHAN[0]} ${NUM_MUX_9548_QSFP_0_CHAN[0]} "PCA9548_QSPF_0" + + #add MUX_9548_QSFP_1 on MUX_9548_QSFP_ROOT_CHAN[1] + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_QSFP ${PATH_MUX_9548_QSFP_ROOT_CHAN[1]} ${NUM_MUX_9548_QSFP_1_CHAN[0]} "PCA9548_QSPF_1" + + #add MUX_9548_QSFP_2 on MUX_9548_QSFP_ROOT_CHAN[2] + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_QSFP ${PATH_MUX_9548_QSFP_ROOT_CHAN[2]} ${NUM_MUX_9548_QSFP_2_CHAN[0]} "PCA9548_QSPF_2" + + #add MUX_9548_QSFP_3 on MUX_9548_QSFP_ROOT_CHAN[3] + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_QSFP ${PATH_MUX_9548_QSFP_ROOT_CHAN[3]} ${NUM_MUX_9548_QSFP_3_CHAN[0]} "PCA9548_QSPF_3" + + #add MUX_9548_QSFP_4 on MUX_9548_QSFP_ROOT_CHAN[4] + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_QSFP ${PATH_MUX_9548_QSFP_ROOT_CHAN[4]} ${NUM_MUX_9548_QSFP_4_CHAN[0]} "PCA9548_QSPF_4" + + #add MUX_9548_QSFP_5 on MUX_9548_QSFP_ROOT_CHAN[5] + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_QSFP ${PATH_MUX_9548_QSFP_ROOT_CHAN[5]} ${NUM_MUX_9548_QSFP_5_CHAN[0]} "PCA9548_QSPF_5" + + #add MUX_9548_QSFP_6 on MUX_9548_QSFP_ROOT_CHAN[6] + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_QSFP ${PATH_MUX_9548_QSFP_ROOT_CHAN[6]} ${NUM_MUX_9548_QSFP_6_CHAN[0]} "PCA9548_QSPF_6" + + #add MUX_9548_QSFP_7 on MUX_9548_QSFP_ROOT_CHAN[7] + _create_i2c_mux_device $PCA9548 $I2C_ADDR_MUX_9548_QSFP ${PATH_MUX_9548_QSFP_ROOT_CHAN[7]} ${NUM_MUX_9548_QSFP_7_CHAN[0]} "PCA9548_QSPF_7" + + #add MUX_9545_SFP on QSFP_ROOT + _create_i2c_mux_device $PCA9545 $I2C_ADDR_MUX_9545_SFP ${PATH_MUX_9545_SFP} ${NUM_MUX_9545_SFP_CHAN[0]} "PCA9545_SPF" + + #Init CPLD LED_CLR Register (QSFP LED) + i2cset -y -m ${BIT_MASK[2]} ${NUM_I801_DEVICE} ${I2C_ADDR_MUX_9539_TH_RST} ${REG_OUT_0} 0xFF + + _util_rmmod coretemp + _util_rmmod jc42 + _util_rmmod w83795 + _util_rmmod lm75 + + _i2c_temp_init + _i2c_volmon_init + modprobe coretemp + modprobe lm75 + modprobe jc42 + modprobe eeprom_mb + _i2c_mb_eeprom_init "new" + _i2c_cpu_eeprom_init "new" + modprobe eeprom + modprobe gpio-pca953x + _i2c_sensors_init + _i2c_fan_init + _i2c_io_exp_init + _i2c_psu_init + _i2c_qsfp_eeprom_init "new" + _i2c_led_psu_status_set + _i2c_led_fan_status_set + COLOR_LED="green" + echo "${COLOR_LED}" + _i2c_sys_led + modprobe cpld + _config_rmem +} + +#I2C Deinit +function _i2c_deinit { + for mod in cpld coretemp jc42 w83795 lm75 eeprom eeprom_mb gpio-pca953x i2c_mux_pca954x i2c_i801 ingrasys_s9200_64x_psu; + do + _util_rmmod $mod + done + _clear_i2cmap +} + +#Temperature sensor Init +function _i2c_temp_init { + local lm="lm75" + local tmp="tmp75" + local i2c_bus=${I2C_BUS_HWM} + local i2c_addr=${I2C_ADDR_HWM} + + echo "=========================================================" + echo "# Description: TEMP INIT" + echo "=========================================================" + + # select bank0 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_BANK_SEL} 0x80 + echo "enable VDSEN14, VDSEN15, VDSEN16, and TR4 temperature monitoring" + i2cset -y -r ${i2c_bus=} ${i2c_addr} ${REG_TEMP_CTRL2} 0x6A + + echo "export CPU sensor TMP75 to sysfs" + echo "${tmp} ${I2C_ADDR_CPU_TMP75}" > ${PATH_CPU_TMP75}/new_device + + echo "Add Dummy Board LM75 to sysfs" + echo "${lm} ${I2C_ADDR_LM75_MAC}" > ${PATH_LM75_MAC}/new_device + echo "${lm} ${I2C_ADDR_LM75_FRONT}" > ${PATH_LM75_FRONT}/new_device + echo "${lm} ${I2C_ADDR_LM75_REAR}" > ${PATH_LM75_REAR}/new_device + + echo "CLKIN clock frequency set as 48Mhz" + i2cset -y -r ${i2c_bus} ${i2c_addr} 0x01 0x1C + + # select bank 2 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_BANK_SEL} 0x82 + echo "set PWM mode in FOMC" + i2cset -y -r ${i2c_bus} ${i2c_addr} 0x0F 0x00 +} + +#FAN Init +function _i2c_fan_init { + local init_fan_speed=120 + + echo "=========================================================" + echo "# Description: FAN INIT" + echo "=========================================================" + + if [ -e "${PATH_HWMON_W83795_DEVICE}" ]; then + echo "Init Fan Speed to ${init_fan_speed} (MAX is 255)" + echo $init_fan_speed > ${PATH_HWMON_W83795_DEVICE}/device/pwm1 + echo $init_fan_speed > ${PATH_HWMON_W83795_DEVICE}/device/pwm2 + else + echo "FAIL, W83795 not found in path ${PATH_HWMON_W83795_DEVICE}" + fi +} + +#VOLMON Init +function _i2c_volmon_init { + echo -n "VOLMON INIT" + local i2c_bus=${I2C_BUS_HWM} + local i2c_addr=${I2C_ADDR_HWM} + + #select bank0 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_BANK_SEL} 0x80 + #enable voltage monitoring VSEN 1~8 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_VOLT_CTRL1} 0xFF + #enable voltage monitoring 3VDD and 3VBAT + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_VOLT_CTRL2} 0x50 + #eable voltage monitoring VSEN12 and VSEN13 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_TEMP_CTRL1} 0x0A + + echo "Done" +} + +#IO Expander Init +function _i2c_io_exp_init { + local i2c_bus=0 + local i2c_addr=0 + + echo "=========================================================" + echo "# Description: I2C IO Expander Init" + echo "=========================================================" + + echo "Init PCA9539 TH RESET IO Expander" + #PCA9539 TH RESET + #0.0 TH_RST_L OUT 1 + #0.1 TH_PCIE_RST_L OUT 1 + #0.2 LED_CLR OUT 1 + #0.3 HOST_TO_BMC_I2C_GPIO OUT 0 + #0.4 USB_MUX_SEL OUT 0 + #0.5 UART_MUX_SEL OUT 0 + #0.6 FIN0 OUT 0 + #0.7 FIN7 OUT 0 + #1.0 TH_INT_L IN + #1.1 CPLD4_TO_CPU_INT_L IN + #1.2 CPLD3_TO_CPU_INT_L IN + #1.3 CPLD2_TO_CPU_INT_L IN + #1.4 CPLD1_TO_CPU_INT_L IN + #1.5 REF_SEL OUT 0 + #1.6 I210_PE_RST_L OUT 1 + #1.7 I210_RST_L OUT 1 + i2c_bus=${I2C_BUS_TH_RESET} + i2c_addr=${I2C_ADDR_MUX_9539_TH_RST} + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_OUT_0} $((2#00000111)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_OUT_1} $((2#11000000)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_0} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_1} $((2#00011111)) + + echo "Init PCA9539 LED BOARD IO Expander" + #PCA9539 LED BOARD + #0.0 SYS_LED_G OUT 1 + #0.1 FAN_LED_EN OUT 1 + #0.2 FAN_LED_Y OUT 0 + #0.3 PSU1_LED_Y OUT 0 + #0.4 PSU0_LED_Y OUT 0 + #0.5~0.7 X + #1.0 PSU1_PWROK OUT 1 + #1.1 PSU0_PWROK OUT 1 + i2c_bus=${I2C_BUS_LED_BOARD} + i2c_addr=${I2C_ADDR_LED_BOARD} + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_OUT_0} $((2#00000011)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_OUT_1} $((2#00000011)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_0} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_1} 0x00 + + echo "Init PCA9535 ID_GPIO IO Expander" + #PCA9535 ID_GPIO + #0.0 ~ 0.7 X + #1.0 Build_REV_0 IN + #1.1 Build_REV_1 IN + #1.2 HW_REV_0 IN + #1.3 HW_REV_1 IN + #1.4 Board_ID_0 IN + #1.5 Board_ID_1 IN + #1.6 Board_ID_2 IN + #1.7 Board_ID_3 IN + i2c_bus=${I2C_BUS_ID_GPIO} + i2c_addr=${I2C_ADDR_ID_GPIO} + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_0} 0xFF + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_1} 0xFF + + #I2C_ADDR_FAN_BOARD + echo "Init PCA9535 FAN_BOARD IO Expander" + #PCA9535 FAN_BOARD + #0.0 EN_FAN1_LED_G_H OUT 1 + #0.1 EN_FAN1_LED_Y_H OUT 0 + #0.2 FAN1_ABS# IN 0 + #0.3 FAN1_DIR# IN 0 + #0.4 EN_FAN2_LED_G_H OUT 1 + #0.5 EN_FAN2_LED_Y_H OUT 0 + #0.6 FAN2_ABS# IN 0 + #0.7 FAN2_DIR# IN 0 + #1.0 EN_FAN3_LED_G_H OUT 1 + #1.1 EN_FAN3_LED_Y_H OUT 0 + #1.2 FAN3_ABS# IN 0 + #1.3 FAN3_DIR# IN 0 + #1.4 EN_FAN4_LED_G_H OUT 1 + #1.5 EN_FAN4_LED_Y_H OUT 0 + #1.6 FAN4_ABS# IN 0 + #1.7 FAN4_DIR# IN 0 + i2c_bus=${I2C_BUS_FAN_BOARD} + i2c_addr=${I2C_ADDR_FAN_BOARD} + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_OUT_0} $((2#00010001)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_OUT_1} $((2#00010001)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_0} $((2#11001100)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_1} $((2#11001100)) + + #PCA9555 on BMC Dummy Board + echo "Init PCA9555 Interrupt IO Expander" + #PCA9555 Interrupt Expander + #0.0 HWM_INT_L IN + #0.1 UCD9090_INT_L IN + #0.2 ETHX_INT_L IN + #0.3 HOST_TO_BMC_INT_L IN + #0.4 THERMAL_ALT1# IN + #0.5 FAN_STATUS_INT_L IN + #0.6 PSU0_INT_L IN + #0.7 PSU1_INT_L IN + #1.0 Build_REV_0 IN + #1.1 Build_REV_1 IN + #1.2 HW_REV_0 IN + #1.3 HW_REV_1 IN + #1.4 Board_ID_0 IN + #1.5 Board_ID_1 IN + #1.6 Board_ID_2 IN + #1.7 Board_ID_3 IN + i2c_bus=${I2C_BUS_PSU_INT} + i2c_addr=${I2C_ADDR_PSU_INT} + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_0} 0xFF + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_1} 0xFF + + #PCA9555 on BMC Dummy Board + echo "Init PCA9555 PSU0_PWROK IO Expander" + #PCA9555 PSU0_PWROK Expander + #0.0 PSU0_PWROK IN + #0.1 PSU0_PRSNT_L IN + #0.2 PSU0_PWRON_L OUT 0 + #0.3 PSU1_PWROK IN + #0.4 PSU1_PRSNT_L IN + #0.5 PSU1_PWRON_L OUT 0 + #0.6 TMP75_INT_L IN + #0.7 GPIOF7 IN + #1.0 ALL_PWR_GOOD IN + #1.1 CPU_PRSNT_L IN + #1.2 FP_BTN_UARTSEL_EN_L OUT 0 + #1.3 HOST_TO_BMC_I2C_GPIO OUT 0 + #1.4 HOST_CPU_PWRBTN_L OUT 1 + #1.5 N/A + #1.6 N/A + #1.7 N/A + i2c_bus=${I2C_BUS_PSU_STATUS} + i2c_addr=${I2C_ADDR_PSU_STATUS} + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_OUT_0} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_OUT_1} $((2#00010000)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_0} $((2#11011011)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_1} $((2#11100011)) + + #PCA9555 on BMC Dummy Board + echo "Init PCA9555 MUX RST IO Expander" + #PCA9555 MUX RST Expander + #0.0 FRU_I2C_MUX_RST_L OUT 1 + #0.1 MAIN_I2C_MUX_RST_L OUT 1 + #0.2 SYSTEM_LED_RST_L OUT 1 + #0.3 BMC_TO_UCD_RST_L OUT 1 + #0.4 BMC_TO_HOST_RST_L OUT 1 + #0.5 ETHX_RST_L OUT 1 + #0.6 GPIOF4 IN + #0.7 N/A + #1.0 CPU_to_FRU_I2C_EN OUT 1 + #1.1 CPU_to_MAIN_I2C_EN OUT 1 + #1.2 P3V3_FAN_EN OUT 1 + #1.3 P3V3_I2C_EN OUT 1 + #1.4 UCD9090_CNTRL OUT 1 + #1.5 UART_MUX_SEL OUT 0 + #1.6 USB_MUX_SEL OUT 0 + #1.7 ETHX_CPU_EEPROM_SEL OUT 0 + i2c_bus=${I2C_BUS_MUX_RST} + i2c_addr=${I2C_ADDR_MUX_RST} + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_OUT_0} $((2#00111111)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_OUT_1} $((2#00011111)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_0} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_POLARITY_1} 0x00 + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_0} $((2#01000000)) + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_1} 0x00 + + #PCA9539 on CPU Board + echo "Init PCA9539 CPLD IO Expander on CPU" + i2c_bus=${I2C_BUS_MUX_CPU_CPLD} + i2c_addr=${I2C_ADDR_MUX_CPU_CPLD} + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_0} 0xFF + i2cset -y -r ${i2c_bus} ${i2c_addr} ${REG_CFG_1} 0xFF +} + +function _i2c_sensors_init { + echo "SENSORS init" + local dev_path + + # add w83795 to sysfs + dev_path="${PATH_SYS_I2C_DEVICES}/${I2C_BUS_HWM}-$(printf "%04x" ${I2C_ADDR_HWM})" + if ! [ -L ${dev_path} ]; then + echo "w83795adg ${I2C_ADDR_HWM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_HWM}/new_device + while [ ! -e "${PATH_HWMON_W83795_DEVICE}" ]; do + sleep 1 + done + else + echo "${dev_path} already exist (w83795)" + fi + + # BMC board thermal + dev_path="${PATH_SYS_I2C_DEVICES}/${NUM_I801_DEVICE}-$(printf "%04x" ${I2C_ADDR_TMP75_BB})" + if ! [ -L ${dev_path} ]; then + echo "tmp75 ${I2C_ADDR_TMP75_BB}" > ${PATH_BMC_TMP75}/new_device + else + echo "${dev_path} already exist" + fi + + echo "Done" +} + +#Set FAN Tray LED +function _i2c_led_fan_tray_status_set { + echo "=========================================================" + echo "# Description: FAN Tray Status Setup" + echo "=========================================================" + + #check W83795 exists + if [ ! -e "${PATH_HWMON_W83795_DEVICE}" ]; then + echo "FAIL, W83795 not found in path ${PATH_HWMON_W83795_DEVICE}" + return + fi + #FAN Status get + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + + FAN_TRAY=1 + if [ "${FAN1_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + _i2c_fan_tray_led + + COLOR_LED="amber" + ONOFF_LED="off" + _i2c_fan_tray_led + + echo "set [FAN TRAY 1] [Green]=on [Amber]=off" + else + COLOR_LED="green" + ONOFF_LED="off" + _i2c_fan_tray_led + + COLOR_LED="amber" + ONOFF_LED="on" + _i2c_fan_tray_led + + echo "set [FAN TRAY 1] [Green]=off [Amber]=on" + fi + + FAN_TRAY=2 + if [ "${FAN3_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + _i2c_fan_tray_led + + COLOR_LED="amber" + ONOFF_LED="off" + _i2c_fan_tray_led + + echo "set [FAN TRAY 2] [Green]=on [Amber]=off" + else + COLOR_LED="green" + ONOFF_LED="off" + _i2c_fan_tray_led + + COLOR_LED="amber" + ONOFF_LED="on" + _i2c_fan_tray_led + + echo "set [FAN TRAY 2] [Green]=off [Amber]=on" + fi + + FAN_TRAY=3 + if [ "${FAN5_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + _i2c_fan_tray_led + + COLOR_LED="amber" + ONOFF_LED="off" + _i2c_fan_tray_led + + echo "set [FAN TRAY 3] [Green]=on [Amber]=off" + else + COLOR_LED="green" + ONOFF_LED="off" + _i2c_fan_tray_led + + COLOR_LED="amber" + ONOFF_LED="on" + _i2c_fan_tray_led + + echo "set [FAN TRAY 3] [Green]=off [Amber]=on" + fi + + FAN_TRAY=4 + if [ "${FAN7_ALARM}" == "0" ]; then + COLOR_LED="green" + ONOFF_LED="on" + _i2c_fan_tray_led + + COLOR_LED="amber" + ONOFF_LED="off" + _i2c_fan_tray_led + + echo "set [FAN TRAY 4] [Green]=on [Amber]=off" + else + COLOR_LED="green" + ONOFF_LED="off" + _i2c_fan_tray_led + + COLOR_LED="amber" + ONOFF_LED="on" + _i2c_fan_tray_led + + echo "set [FAN TRAY 4] [Green]=off [Amber]=on" + fi +} + +#Test FAN Tray LED +function _i2c_led_fan_tray_test { + echo "=========================================================" + echo "# Description: FAN Tray LED Test" + echo "=========================================================" + + for i in {1..4} + do + FAN_TRAY=$i + COLOR_LED="green" + ONOFF_LED="on" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="off" + _i2c_fan_tray_led + _pause "Check [Fan Tray ${i} LED] = Green and Press [Enter] key to continue..." + + COLOR_LED="green" + ONOFF_LED="off" + _i2c_fan_tray_led + COLOR_LED="amber" + ONOFF_LED="on" + _i2c_fan_tray_led + _pause "Check [Fan Tray ${i} LED] = Amber and Press [Enter] key to continue..." + done +} +#Set FAN LED +function _i2c_led_fan_status_set { + echo "=========================================================" + echo "# Description: FAN Status Setup" + echo "=========================================================" + + #check W83795 exists in hwmon2 + if [ ! -e "${PATH_HWMON_W83795_DEVICE}" ]; then + echo "FAIL, W83795 not found in path ${PATH_HWMON_W83795_DEVICE}" + return + fi + + #PSU Status set + FAN1_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan1_alarm` + FAN3_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan3_alarm` + FAN5_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan5_alarm` + FAN7_ALARM=`cat ${PATH_HWMON_W83795_DEVICE}/device/fan7_alarm` + + if [ "${FAN1_ALARM}" == "0" ] \ + && [ "${FAN3_ALARM}" == "0" ] \ + && [ "${FAN5_ALARM}" == "0" ] \ + && [ "${FAN7_ALARM}" == "0" ] ; then + COLOR_LED="green" + _i2c_fan_led + else + COLOR_LED="amber" + _i2c_fan_led + fi + echo "set [FAN LED] = ${COLOR_LED}" +} + +#Set PSU LED on LED Board +function _i2c_led_psu_status_set { + + echo "=========================================================" + echo "# Description: PSU LED Status Setup" + echo "=========================================================" + + #Get PSU Status + _i2c_psu_status + + #PSU1 Status + echo "------------------------------" + if [ "${psu1Exist}" == ${PSU_EXIST} ]; then + if [ "${psu1PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + _i2c_psu1_led + else + COLOR_LED="amber" + _i2c_psu1_led + fi + else + COLOR_LED="amber" + _i2c_psu1_led + fi + echo "set [PSU1 LED] = ${COLOR_LED}" + + #PSU2 Status + echo "------------------------------" + if [ "${psu2Exist}" == ${PSU_EXIST} ]; then + if [ "${psu2PwGood}" == ${PSU_DC_ON} ]; then + COLOR_LED="green" + _i2c_psu2_led + else + COLOR_LED="amber" + #ONOFF_LED="on" + _i2c_psu2_led + fi + else + COLOR_LED="amber" + _i2c_psu2_led + fi + echo "set [PSU2 LED] = ${COLOR_LED}" +} + +#LED Test +function _i2c_led_test { + echo "=========================================================" + echo "# Description: I2C LED TEST" + echo "=========================================================" + #sys led (green) + _i2c_reset_led + COLOR_LED="green" + _i2c_sys_led + _pause 'Check [SYS LED] = Green and Press [Enter] key to continue...' + #sys led (amber) + _i2c_reset_led + COLOR_LED="amber" + _i2c_sys_led + _pause 'Check [SYS LED] = Amber and Press [Enter] key to continue...' + + #FAN led (green) + _i2c_reset_led + COLOR_LED="green" + _i2c_fan_led + _pause 'Check [FAN LED] Green and Press [Enter] key to continue...' + #FAN led (amber) + _i2c_reset_led + COLOR_LED="amber" + _i2c_fan_led + _pause 'Check [FAN LED] = Amber and Press [Enter] key to continue...' + + #PSU2 led (green) + _i2c_reset_led + COLOR_LED="green" + _i2c_psu2_led + _pause 'Check [PSU2 LED] = Green and Press [Enter] key to continue...' + #PSU2 led (amber) + _i2c_reset_led + COLOR_LED="amber" + _i2c_psu2_led + _pause 'Check [PSU2 LED] = Amber and Press [Enter] key to continue...' + + #PSU1 led (green) + _i2c_reset_led + COLOR_LED="green" + _i2c_psu1_led + _pause 'Check [PSU1 LED] = Green and Press [Enter] key to continue...' + #PSU2 led (amber) + _i2c_reset_led + COLOR_LED="amber" + _i2c_psu1_led + _pause 'Check [PSU1 LED] = Amber and Press [Enter] key to continue...' + + #Turn OFF All LED + _i2c_reset_led + _pause 'Check turn off all LEDs and Press [Enter] key to continue...' +} + +#Set QSFP Port variable +function _qsfp_port_i2c_var_set { + #global variables + cpld_group=0 + cpld_i2c_bus=0 + cpld_i2c_addr=$I2C_ADDR_CPLD + cpld_qsfp_status_reg_offset=0 + cpld_qsfp_mode_reg_offset=0 + + #local variables + local i=0 + local port=$1 + local port_group=$(( (port - 1)/8 )) + + case ${port_group} in + 0) + #the i2c expander base bus num to read qsfp eeprom + eeprombusbase=${NUM_MUX_9548_QSFP_0_CHAN[0]} + ;; + 1) + eeprombusbase=${NUM_MUX_9548_QSFP_1_CHAN[0]} + ;; + 2) + eeprombusbase=${NUM_MUX_9548_QSFP_2_CHAN[0]} + ;; + 3) + eeprombusbase=${NUM_MUX_9548_QSFP_3_CHAN[0]} + ;; + 4) + eeprombusbase=${NUM_MUX_9548_QSFP_4_CHAN[0]} + ;; + 5) + eeprombusbase=${NUM_MUX_9548_QSFP_5_CHAN[0]} + ;; + 6) + eeprombusbase=${NUM_MUX_9548_QSFP_6_CHAN[0]} + ;; + 7) + eeprombusbase=${NUM_MUX_9548_QSFP_7_CHAN[0]} + ;; + *) + echo "Please input 1~${PORT_NUM}" + ;; + esac + + #set cpld_group and cpld_i2c_bus according to port + for ((i=0; i<5; ++i)) + do + if (("${port}" <= "${CPLD_QSFP_GROUP[i]}")); + then + local port_offset=0 + cpld_group=$i + cpld_i2c_bus=${NUM_MUX_9548_CPLD_CHAN[i]} + + if ((i>0)) + then + port_offset=$(( port - CPLD_QSFP_GROUP[i-1] )) + else + port_offset=$port + fi + cpld_qsfp_status_reg_offset=$((CPLD_QSFP_STATUS_REG_BASE + port_offset)) + cpld_qsfp_mode_reg_offset=$((CPLD_QSFP_MODE_SELECT_REG_BASE + port_offset)) + + break + fi + done +} + +function _i2c_get { + local i2c_bus=$1 + local i2c_addr=$2 + local reg=$3 + echo `i2cget -y ${i2c_bus} ${i2c_addr} ${reg}` +} + +function _i2c_set { + local i2c_bus=$1 + local i2c_addr=$2 + local reg=$3 + local mask=$4 + local value=$5 + + echo `i2cset -m $mask -y -r ${i2c_bus} ${i2c_addr} ${reg} ${value}` +} + +#Set QSFP Port variable +function _qsfp_eeprom_var_set { + #local variables + local port=$1 + + #global variables + eeprombusidx=$(( (port - 1)%8 )) + + case $eeprombusidx in + 0) + eeprombus=$(( $eeprombusbase + 0 )) + ;; + 1) + eeprombus=$(( $eeprombusbase + 1 )) + ;; + 2) + eeprombus=$(( $eeprombusbase + 2 )) + ;; + 3) + eeprombus=$(( $eeprombusbase + 3 )) + ;; + 4) + eeprombus=$(( $eeprombusbase + 4 )) + ;; + 5) + eeprombus=$(( $eeprombusbase + 5 )) + ;; + 6) + eeprombus=$(( $eeprombusbase + 6 )) + ;; + 7) + eeprombus=$(( $eeprombusbase + 7 )) + ;; + esac + eepromAddr=${I2C_ADDR_QSFP_EEPROM} +} + +#Get QSFP EEPROM Information +function _i2c_qsfp_eeprom_get { + local value=0 + local status=0 + + echo "=========================================================" + echo "# Description: QSFP EEPROM GET" + echo "=========================================================" + + #status: 0 -> Down, 1 -> Up + _i2c_qsfp_signal_get ${QSFP_PORT} ${CPLD_QSFP_ABS} + + value=$qsfp_signal + status=$(( value?0:1 )) + + if [ $status = 0 ]; then + echo "[Fail] QSFP ${QSFP_PORT} is not present" + exit + fi + + echo "------------------------------" + cat ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom | hexdump -C +} + +#Init QSFP EEPROM +function _i2c_qsfp_eeprom_init { + echo "=========================================================" + echo "# Description: QSFP EEPROM INIT" + echo "=========================================================" + + #Action check + action=$1 + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init EEPROM + local i + for (( i=1; i<=${PORT_NUM}; i++ )) + do + _qsfp_port_i2c_var_set ${i} + + _qsfp_eeprom_var_set ${i} + + if [ "${action}" == "new" ] && \ + ! [ -L ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr) ]; then + echo "sff8436 $eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr) ]; then + echo "$eepromAddr" > ${PATH_SYS_I2C_DEVICES}/i2c-$eeprombus/delete_device + fi + done +} + +#get qsfp singals (ABS, INT, RST, LP) from CPLD +function _i2c_qsfp_signal_get { + local port=$1 #port start from 1 + local signal=$2 + local attr_file="" + local phy_port=0 + local active="low_active" + + #global + qsfp_signal=0 + qsfp_signals=0 + + #verify port + if [ -z "${port}" ]; then + echo "No port, skip" + return + fi + + #verify port + if (( $port < 1 || $port > $PORT_NUM )) ; then + echo "invalid port, skip" + fi + + #get physical port + phy_port=$(_port_logic2phy $port) + + _qsfp_port_i2c_var_set ${phy_port} + _qsfp_eeprom_var_set ${phy_port} + + #verify signal + if [ -z "${signal}" ]; then + echo "No signal, skip" + return + elif [ "${signal}" == "${CPLD_QSFP_ABS}" ]; then + attr_file="qsfp_modprs" + elif [ "${signal}" == "${CPLD_QSFP_INT}" ]; then + attr_file="qsfp_int" + elif [ "${signal}" == "${CPLD_QSFP_RST}" ]; then + attr_file="qsfp_reset" + elif [ "${signal}" == "${CPLD_QSFP_LP}" ]; then + attr_file="qsfp_lpmode" + active="high_active" + else + echo "invalid signal ${signal}, skip" + return + fi + + mask=${BIT_MASK[bit_shift]} + + #signals of all ports + qsfp_signals=`cat ${PATH_SYS_CPLD}/${attr_file}` + #signal of single port + qsfp_signal=$(( (qsfp_signals >> (phy_port-1)) & 0x1)) + #print signals + printf "[port]=%d, [signal]=%s, [value]=%d (${active}), [qsfp_signals]=%016x\n" $port $signal $qsfp_signal $qsfp_signals +} + +#set qsfp singals (RST, LP) via CPLD +function _i2c_qsfp_signal_set { + local port=$1 #port start from 1 + local signal=$2 + local value=$3 + local values_ori=0 + local value_ori=0 + local values=0 + local attr_file="" + + #verify port + if [ -z "${port}" ]; then + echo "No port, skip" + return + fi + + #verify port + if (( $port < 1 || $port > $PORT_NUM )) ; then + echo "invalid port, skip" + fi + + #verify signal + if [ -z "${signal}" ]; then + echo "No signal, skip" + return + elif [ "${signal}" == "${CPLD_QSFP_RST}" ]; then + attr_file="qsfp_reset" + elif [ "${signal}" == "${CPLD_QSFP_LP}" ]; then + attr_file="qsfp_lpmode" + else + echo "invalid signal ${signal}, skip" + return + fi + + #get current signal values + _i2c_qsfp_signal_get $port $signal + value_ori=$qsfp_signal + values_ori=$qsfp_signals + + #if signal value is not changed, return + if [ "${value}" == "${value_ori}" ]; then + echo "value not changed, skip set operation" + return + fi + + #toggle the bit for update + values=$(( values_ori ^ (1 << (port-1)))) + + #set value to register + echo "$(printf "%016x" $values)" > ${PATH_SYS_CPLD}/${attr_file} + + #get updated signal values + _i2c_qsfp_signal_get $port $signal + values=$qsfp_signals + + #result + printf "Before: %016x\n" $values_ori + printf "After: %016x\n" $values +} + +#Init EEPROM +function _i2c_eeprom_init { + local i2c_bus=$1 + local i2c_addr=$2 + local action=$3 + local desc=$4 + local sys_i2c_dev=$PATH_SYS_I2C_DEVICES + + echo -n "${desc} EEPROM INIT" + + #Action check + if [ -z "${action}" ]; then + echo "No action, skip" + return + elif [ "${action}" != "new" ] && [ "${action}" != "delete" ]; then + echo "Error action, skip" + return + fi + + #Init EEPROM + if [ "${action}" == "new" ] && \ + ! [ -L ${sys_i2c_dev}/${i2c_bus}-$(printf "%04x" $i2c_addr) ]; then + echo "mb_eeprom ${i2c_addr}" > ${sys_i2c_dev}/i2c-${i2c_bus}/new_device + elif [ "${action}" == "delete" ] && \ + [ -L ${sys_i2c_dev}/${i2c_bus}-$(printf "%04x" $i2c_addr) ]; then + echo "${i2c_addr}" > ${sys_i2c_dev}/i2c-${i2c_bus}/delete_device + fi + echo "DONE" +} + +#Init Main Board EEPROM +function _i2c_mb_eeprom_init { + local action=$1 + local i2c_bus=$I2C_BUS_MB_EEPROM + local i2c_addr=$I2C_ADDR_MB_EEPROM + local desc="Main Board" + + _i2c_eeprom_init $i2c_bus $i2c_addr $action $desc +} + +#Init CPU EEPROM +function _i2c_cpu_eeprom_init { + local action=$1 + local i2c_bus=$I2C_BUS_CPU_EEPROM + local i2c_addr=$I2C_ADDR_CPU_EEPROM + local desc="CPU Board" + + _i2c_eeprom_init $i2c_bus $i2c_addr $action $desc +} + +#get QSFP Status +function _i2c_qsfp_status_get { + local value=0 + local status=0 + + #status: 0 -> Down, 1 -> Up + _i2c_qsfp_signal_get ${QSFP_PORT} ${CPLD_QSFP_ABS} + value=$qsfp_signal + status=$(( value?0:1 )) + echo "status=$status" +} + +#get QSFP Type +function _i2c_qsfp_type_get { + local phy_port=0 + local value=0 + local status=0 + + echo "=========================================================" + echo "# Description: QSFP TYPE Get" + echo "=========================================================" + + phy_port=$(_port_logic2phy ${QSFP_PORT}) + _qsfp_port_i2c_var_set ${phy_port} + _qsfp_eeprom_var_set ${phy_port} + + #get abs signal + _i2c_qsfp_signal_get ${QSFP_PORT} ${CPLD_QSFP_ABS} + value=$qsfp_signal + status=$(( value?0:1 )) + + #check qsfp is present + if [ $status = 0 ]; then + echo "[Fail] QSFP ${QSFP_PORT} is not present" + exit + fi + + #Get QSFP EEPROM info + if [ ! -e "${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf '%04x' $eepromAddr)/eeprom" ]; then + echo "FAIL, qsfp eeprom file does not exist. " + echo "qsfp eeprom file path: ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf '%04x' $eepromAddr)/eeprom" + return + fi + + qsfp_info=$(base64 ${PATH_SYS_I2C_DEVICES}/$eeprombus-$(printf "%04x" $eepromAddr)/eeprom) + + identifier=$(echo $qsfp_info | base64 -d -i | hexdump -s 128 -n 1 -e '"%x"') + connector=$(echo $qsfp_info | base64 -d -i | hexdump -s 130 -n 1 -e '"%x"') + transceiver=$(echo $qsfp_info | base64 -d -i | hexdump -s 131 -n 1 -e '"%x"') + + echo "------------------------------" + echo "identifier = $identifier" + echo "connector = $connector" + echo "transceiver = $transceiver" +} + +#Init PSU Kernel Module +function _i2c_psu_init { + echo "=========================================================" + echo "# Description: I2C PSU Init" + echo "=========================================================" + modprobe ingrasys_s9200_64x_psu + + echo "psu1 ${I2C_ADDR_PSU_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_PSU1_EEPROM}/new_device + echo "psu2 ${I2C_ADDR_PSU_EEPROM}" > ${PATH_SYS_I2C_DEVICES}/i2c-${I2C_BUS_PSU2_EEPROM}/new_device +} + +#Get PSU EEPROM Information +function _i2c_psu_eeprom_get { + local eeprom_psu1="" + local eeprom_psu2="" + + echo "=========================================================" + echo "# Description: I2C PSU EEPROM Get..." + echo "=========================================================" + + echo "PUS1 EEPROM" + eeprom_psu1="${PATH_SYSFS_PSU1}/psu_eeprom" + cat ${eeprom_psu1} | hexdump -C + + echo "------------------------------" + echo "PUS2 EEPROM" + eeprom_psu2="${PATH_SYSFS_PSU2}/psu_eeprom" + cat ${eeprom_psu2} | hexdump -C +} + +#Get MotherBoard EEPROM Information +function _i2c_mb_eeprom_get { + local path_i2c_dev=${PATH_SYS_I2C_DEVICES} + local i2c_bus=${I2C_BUS_MB_EEPROM} + local i2c_addr=${I2C_ADDR_MB_EEPROM} + echo "=========================================================" + echo "# Description: I2C MB EEPROM Get" + echo "=========================================================" + + ## MB EEPROM + cat ${path_i2c_dev}/${i2c_bus}-$(printf "%04x" ${i2c_addr})/eeprom | hexdump -v -C +} + +#Get CPU EEPROM Information +function _i2c_cpu_eeprom_get { + local path_i2c_dev=${PATH_SYS_I2C_DEVICES} + local i2c_bus=${I2C_BUS_CPU_EEPROM} + local i2c_addr=${I2C_ADDR_CPU_EEPROM} + echo "=========================================================" + echo "# Description: I2C CPU EEPROM Get" + echo "=========================================================" + + ## CPU EEPROM + cat ${path_i2c_dev}/${i2c_bus}-$(printf "%04x" ${i2c_addr})/eeprom | hexdump -v -C +} + +#Set FAN Tray LED +function _i2c_fan_tray_led { + local value=0 + + echo "=========================================================" + echo "# Description: Set Fan Tray LED" + echo "=========================================================" + + case ${FAN_TRAY} in + 1) + ioPort=$REG_OUT_0 + if [ "${COLOR_LED}" == "green" ]; then + mask=${BIT_MASK[0]} + elif [ "${COLOR_LED}" == "amber" ]; then + mask=${BIT_MASK[1]} + fi + ;; + 2) + ioPort=$REG_OUT_0 + if [ "${COLOR_LED}" == "green" ]; then + mask=${BIT_MASK[4]} + elif [ "${COLOR_LED}" == "amber" ]; then + mask=${BIT_MASK[5]} + fi + ;; + 3) + ioPort=$REG_OUT_1 + if [ "${COLOR_LED}" == "green" ]; then + mask=${BIT_MASK[0]} + elif [ "${COLOR_LED}" == "amber" ]; then + mask=${BIT_MASK[1]} + fi + ;; + 4) + ioPort=$REG_OUT_1 + if [ "${COLOR_LED}" == "green" ]; then + mask=${BIT_MASK[4]} + elif [ "${COLOR_LED}" == "amber" ]; then + mask=${BIT_MASK[5]} + fi + ;; + *) + echo "Please input 1~4" + exit + ;; + esac + + if [ "${ONOFF_LED}" == "on" ]; then + value=0xFF + elif [ "${ONOFF_LED}" == "off" ]; then + value=0x00 + else + echo "Invalid Parameters ${ONOFF_LED}, Exit!!!" + _help + exit ${FALSE} + fi + i2cset -m $mask -y -r ${I2C_BUS_FAN_BOARD} ${I2C_ADDR_FAN_BOARD} $ioPort $value + +} + +#Set System Status LED +function _i2c_sys_led { + local value=0 + local mask=${BIT_MASK[0]} + + if [ "${COLOR_LED}" == "green" ]; then + value=0xFF + elif [ "${COLOR_LED}" == "amber" ]; then + value=0x00 + else + echo "Invalid Parameters ${COLOR_LED}, Exit!!!" + _help + exit ${FALSE} + fi + + _i2c_set_led $value $mask +} + +#Set FAN LED +function _i2c_fan_led { + local value=0 + local mask=${BIT_MASK[2]} + + if [ "${COLOR_LED}" == "green" ]; then + value=0x00 + elif [ "${COLOR_LED}" == "amber" ]; then + value=0xFF + else + echo "Invalid Parameters ${COLOR_LED}, Exit!!!" + _help + exit ${FALSE} + fi + + _i2c_set_led $value $mask +} + +#Set PSU1 LED +function _i2c_psu1_led { + local value=0 + local mask=${BIT_MASK[3]} + + if [ "${COLOR_LED}" == "green" ]; then + value=0x00 + elif [ "${COLOR_LED}" == "amber" ]; then + value=0xFF + else + echo "Invalid Parameters ${COLOR_LED}, Exit!!!" + _help + exit ${FALSE} + fi + + _i2c_set_led $value $mask +} + +#Set PSU2 LED +function _i2c_psu2_led { + local reg=${REG_OUT_0} + local value=0 + local mask=${BIT_MASK[4]} + + if [ "${COLOR_LED}" == "green" ]; then + value=0x00 + elif [ "${COLOR_LED}" == "amber" ]; then + value=0xFF + else + echo "Invalid Parameters ${COLOR_LED}, Exit!!!" + _help + exit ${FALSE} + fi + + _i2c_set_led $value $mask +} + +#Set LEDs in LED Board +function _i2c_set_led { + local value=$1 + local mask=$2 + local reg=${REG_OUT_0} + local i2c_bus=$I2C_BUS_LED_BOARD + local i2c_addr=$I2C_ADDR_LED_BOARD + + _i2c_set $i2c_bus $i2c_addr $reg $mask $value +} + +#Reset all system leds +function _i2c_reset_led { + local mask=0xFF + local value=$((2#00000011)) + local reg=${REG_OUT_0} + local i2c_bus=$I2C_BUS_LED_BOARD + local i2c_addr=$I2C_ADDR_LED_BOARD + + _i2c_set $i2c_bus $i2c_addr $reg $mask $value +} + +#Get Mother Board Version and Type +function _i2c_board_type_get { + echo "=========================================================" + echo "# Description: I2C MB Board Type Get" + echo "=========================================================" + local i2c_bus=${I2C_BUS_ID_GPIO} + local i2c_addr=${I2C_ADDR_ID_GPIO} + local reg=${REG_IN_1} + local value=0 + + value=$(_i2c_get $i2c_bus $i2c_addr $reg) + + #Bit 0-1 + boardBuildRev=$((value & 0x03)) + #Bit 2-3 + boardHwRev=$((value >> 2 & 0x03)) + #Bit 4-7 + boardId=$((value>>4)) + printf "[MB BOARD_ID] = 0x%02x, [HW Rev] = %d, [Build Rev] = %d\n" $boardId $boardHwRev $boardBuildRev +} + +#Get Board Version and Type from Dummy BMC Board +function _i2c_bmc_board_type_get { + echo "=========================================================" + echo "# Description: I2C BMC Board Type Get" + echo "=========================================================" + + local i2c_bus=${I2C_BUS_BMC_BOARD_TYPE} + local i2c_addr=${I2C_ADDR_BMC_BOARD_TYPE} + local reg=${REG_IN_1} + local value=0 + + value=$(_i2c_get $i2c_bus $i2c_addr $reg) + + #Bit 0-1 + boardBuildRev=$((($value) & 0x03)) + #Bit 2-3 + boardHwRev=$((($value) >> 2 & 0x03)) + #Bit 4-7 + boardId=$((($value) >> 4)) + printf "[BMC BOARD_ID] = 0x%02x, [HW Rev] = %d, [Build Rev] = %d\n" $boardId $boardHwRev $boardBuildRev +} + +#Get CPLD Version +function _i2c_cpld_version { + echo "=========================================================" + echo "# Description: CPLD Version" + echo "=========================================================" + cat ${PATH_SYS_CPLD}/cpld_version +} + +#Get PSU Status +function _i2c_psu_status { + local psu_abs="" + + psu1PwGood=`cat ${PATH_SYSFS_PSU1}/psu_pg` + psu_abs=`cat ${PATH_SYSFS_PSU1}/psu_abs` + if [ "$psu_abs" == "0" ]; then + psu1Exist=1 + else + psu1Exist=0 + fi + + psu2PwGood=`cat ${PATH_SYSFS_PSU2}/psu_pg` + psu_abs=`cat ${PATH_SYSFS_PSU2}/psu_abs` + if [ "$psu_abs" == "0" ]; then + psu2Exist=1 + else + psu2Exist=0 + fi + + printf "PSU1 Exist:%x PSU1 PW Good:%d\n" $psu1Exist $psu1PwGood + printf "PSU2 Exist:%d PSU2 PW Good:%d\n" $psu2Exist $psu2PwGood +} + +#Set 10G Mux to CPU or Front Panel +function _i2c_10g_mux { + + echo "=========================================================" + echo "# Description: 10G Mux" + echo "=========================================================" + + local target=${TARGET_10G_MUX} + local i2c_bus=${I2C_BUS_10GMUX} + local i2c_addr=${I2C_ADDR_10GMUX} + local reg=0 + local mask=0xff + local value=0 + local file_10g_mux="${PATH_SYS_CPLD}/cpld_10g_mux" + + #get current 10g mux register value on CPLD + value=`cat ${file_10g_mux}` + + if [ "${target}" == "cpu" ]; then + #Set XE0: slave address access + _i2c_set $i2c_bus $i2c_addr 0x06 $mask 0x18 + #Set XE0: CH4 D_IN0-S_OUTA0 EQ + _i2c_set $i2c_bus $i2c_addr 0x2c $mask 0x00 + #Set XE0: CH5 NC-S_OUTB0 DEM + _i2c_set $i2c_bus $i2c_addr 0x35 $mask 0x80 + #Set XE0: CH5 NC-S_OUTB0 VOD + _i2c_set $i2c_bus $i2c_addr 0x34 $mask 0xab + #Set XE0: CH1 D_OUT0-S_INB0 EQ + _i2c_set $i2c_bus $i2c_addr 0x16 $mask 0x01 + #Set XE0: CH1 D_OUT0-S_INB0 DEM + _i2c_set $i2c_bus $i2c_addr 0x18 $mask 0x80 + #Set XE0: CH1 D_OUT0-S_INB0 VOD + _i2c_set $i2c_bus $i2c_addr 0x17 $mask 0xab + #Set XE1: CH6 D_IN1-S_OUTA1 EQ + _i2c_set $i2c_bus $i2c_addr 0x3a $mask 0x00 + #Set XE1: CH7 NC-S_OUTB1 EQ + _i2c_set $i2c_bus $i2c_addr 0x41 $mask 0x00 + #Set XE1: CH7 NC-S_OUTB1 DEM + _i2c_set $i2c_bus $i2c_addr 0x43 $mask 0x80 + #Set XE1: CH7 NC-S_OUTB1 VOD + _i2c_set $i2c_bus $i2c_addr 0x42 $mask 0xab + #Set XE1: CH3 D_OUT1-S_INB1 EQ + _i2c_set $i2c_bus $i2c_addr 0x24 $mask 0x01 + #Set XE1: CH3 D_OUT1-S_INB1 DEM + _i2c_set $i2c_bus $i2c_addr 0x26 $mask 0x80 + #Set XE1: CH3 D_OUT1-S_INB1 VOD + _i2c_set $i2c_bus $i2c_addr 0x25 $mask 0xab + #Enable auto negotiation of XE ports + eval "bcmcmd 'port xe0,xe1 an=1 if=kr en=1'" + #delay 1 sec + sleep 1 + + #switch 10G MUX to cpu on CPLD + value=$(( value & 0xf3 )) + echo "$(printf "%x" ${value})" > ${file_10g_mux} + + echo "Switch 10G Mux to [CPU]" + + elif [ "${COLOR_LED}" == "fp" ]; then + #Set XE0: slave address access + _i2c_set $i2c_bus $i2c_addr 0x06 $mask 0x18 + #Set XE0: CH4 D_IN0-S_OUTA0 EQ + _i2c_set $i2c_bus $i2c_addr 0x2c $mask 0x00 + #Set XE0: CH4 D_IN0-S_OUTA0 DEM + _i2c_set $i2c_bus $i2c_addr 0x2e $mask 0x80 + #Set XE0: CH4 D_IN0-S_OUTA0 VOD + _i2c_set $i2c_bus $i2c_addr 0x2d $mask 0xab + #Set XE0: CH0 NC-S_INA0 EQ + _i2c_set $i2c_bus $i2c_addr 0x0f $mask 0x00 + #Set XE0: CH1 D_OUT0-S_INB0 DEM + _i2c_set $i2c_bus $i2c_addr 0x18 $mask 0x80 + #Set XE0: CH1 D_OUT0-S_INB0 VOD + _i2c_set $i2c_bus $i2c_addr 0x17 $mask 0xab + #Set XE1: CH6 D_IN1-S_OUTA1 EQ + _i2c_set $i2c_bus $i2c_addr 0x3a $mask 0x00 + #Set XE1: CH6 D_IN1-S_OUTA1 DEM + _i2c_set $i2c_bus $i2c_addr 0x3c $mask 0x80 + #Set XE1: CH6 D_IN1-S_OUTA1 VOD + _i2c_set $i2c_bus $i2c_addr 0x3b $mask 0xab + #Set XE1: CH2 NC-S_INA1 EQ + _i2c_set $i2c_bus $i2c_addr 0x1d $mask 0x00 + #Set XE1: CH3 D_OUT1-S_INB1 DEM + _i2c_set $i2c_bus $i2c_addr 0x26 $mask 0x80 + #Set XE1: CH3 D_OUT1-S_INB1 VOD + _i2c_set $i2c_bus $i2c_addr 0x25 $mask 0xab + #Enable auto negotiation of XE ports + eval "bcmcmd 'port xe0,xe1 an=0 if=kr en=1'" + #delay 1 sec + sleep 1 + + #switch 10G MUX to front panel on CPLD + value=$(( value | 0x0c )) + echo "$(printf "%x" ${value})" > ${file_10g_mux} + + echo "Switch 10G Mux to [Front Panel]" + else + echo "invalid target, please set target to cpu/fp" + fi +} + +#Increase read socket buffer for CoPP Test +function _config_rmem { + echo "109430400" > /proc/sys/net/core/rmem_max +} + +#Main Function +function _main { + start_time_str=`date` + start_time_sec=$(date +%s) + + if [ "${EXEC_FUNC}" == "help" ]; then + _help + elif [ "${EXEC_FUNC}" == "i2c_init" ]; then + _i2c_init + elif [ "${EXEC_FUNC}" == "i2c_deinit" ]; then + _i2c_deinit + elif [ "${EXEC_FUNC}" == "i2c_temp_init" ]; then + _i2c_temp_init + elif [ "${EXEC_FUNC}" == "i2c_fan_init" ]; then + _i2c_fan_init + elif [ "${EXEC_FUNC}" == "i2c_volmon_init" ]; then + _i2c_volmon_init + elif [ "${EXEC_FUNC}" == "i2c_io_exp_init" ]; then + _i2c_io_exp_init + elif [ "${EXEC_FUNC}" == "i2c_led_test" ]; then + _i2c_led_test + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_get" ]; then + _i2c_mb_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_cpu_eeprom_get" ]; then + _i2c_cpu_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_psu_eeprom_get" ]; then + _i2c_psu_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_get" ]; then + _i2c_qsfp_eeprom_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_eeprom_init" ]; then + _i2c_qsfp_eeprom_init ${QSFP_INIT_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_mb_eeprom_init" ]; then + _i2c_mb_eeprom_init ${MB_EEPROM_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_cpu_eeprom_init" ]; then + _i2c_cpu_eeprom_init ${MB_EEPROM_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_qsfp_status_get" ]; then + _i2c_qsfp_status_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_type_get" ]; then + _i2c_qsfp_type_get + elif [ "${EXEC_FUNC}" == "i2c_qsfp_signal_get" ]; then + _i2c_qsfp_signal_get ${QSFP_PORT} ${QSFP_ACTION} + elif [ "${EXEC_FUNC}" == "i2c_qsfp_signal_set" ]; then + _i2c_qsfp_signal_set ${QSFP_PORT} ${QSFP_ACTION} ${QSFP_VALUE} + elif [ "${EXEC_FUNC}" == "i2c_led_psu_status_set" ]; then + _i2c_led_psu_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_status_set" ]; then + _i2c_led_fan_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_tray_status_set" ]; then + _i2c_led_fan_tray_status_set + elif [ "${EXEC_FUNC}" == "i2c_led_fan_tray_test" ]; then + _i2c_led_fan_tray_test + elif [ "${EXEC_FUNC}" == "i2c_sys_led" ]; then + _i2c_sys_led + elif [ "${EXEC_FUNC}" == "i2c_fan_led" ]; then + _i2c_fan_led + elif [ "${EXEC_FUNC}" == "i2c_fan_tray_led" ]; then + _i2c_fan_tray_led + elif [ "${EXEC_FUNC}" == "i2c_psu1_led" ]; then + _i2c_psu1_led + elif [ "${EXEC_FUNC}" == "i2c_psu2_led" ]; then + _i2c_psu2_led + elif [ "${EXEC_FUNC}" == "i2c_board_type_get" ]; then + _i2c_board_type_get + elif [ "${EXEC_FUNC}" == "i2c_bmc_board_type_get" ]; then + _i2c_bmc_board_type_get + elif [ "${EXEC_FUNC}" == "i2c_cpld_version" ]; then + _i2c_cpld_version + elif [ "${EXEC_FUNC}" == "i2c_psu_status" ]; then + _i2c_psu_status + elif [ "${EXEC_FUNC}" == "i2c_test_all" ]; then + _i2c_deinit + _i2c_init + _i2c_led_test + _i2c_psu_eeprom_get + _i2c_mb_eeprom_get + _i2c_cpu_eeprom_get + _i2c_board_type_get + _i2c_bmc_board_type_get + _i2c_cpld_version + _i2c_psu_status + elif [ "${EXEC_FUNC}" == "i2c_10g_mux" ]; then + _i2c_10g_mux + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi + + end_time_str=`date` + end_time_sec=$(date +%s) + diff_time=$[ ${end_time_sec} - ${start_time_sec} ] + echo "------------------------------" + echo "Total Execution Time: ${diff_time} sec" + + echo "DONE" +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/qsfp_monitor.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/qsfp_monitor.sh new file mode 100755 index 000000000000..51c49c1152f5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/qsfp_monitor.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=3 +I2C_UTILS="/usr/sbin/i2c_utils.sh" +QSFP_SI_SCRIPT="/usr/sbin/qsfp_si_cfg.sh" +QSFP_ARRAY=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + +#QSFP SI monitor +function _qsfp_si_monitor { + local i + local status + for i in {0..63}; + do + status=`${I2C_UTILS} i2c_qsfp_status_get $(expr $i + 1) | egrep '^status=.*$' | sed -e 's/status=//g'` + if [ "${status}" == "1" ]; then + _qsfp_type_check $i + fi + done +} + +#QSFP type +function _qsfp_type_check { + local port=$1 + local qsfp_type=`${I2C_UTILS} i2c_qsfp_type_get $(expr $port + 1) ` + local identifier=`echo "$qsfp_type" | egrep -o 'identifier = .*$' | sed -e 's/identifier = //g'` + if [ "${identifier}" == "11" ]; then + connector=`echo "$qsfp_type" | egrep -o 'connector = .*$' | sed -e 's/connector = //g'` + case ${connector} in + 21|23) + #DAC + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to DAC" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} dac $port >/dev/null + fi + ;; + *) + #Optical + if [ "${QSFP_ARRAY[$port]}" != "${connector}" ]; then + echo "Change Port $(expr $port + 1) to Optical" + QSFP_ARRAY[$port]=${connector} + ${QSFP_SI_SCRIPT} optical $port >/dev/null + fi + ;; + esac + fi +} + +#Docker exist check +function _docker_swss_check { + while true + do + # Check if syncd starts + result=`docker exec -i swss bash -c "echo -en \"SELECT 1\\nHLEN HIDDEN\" | redis-cli | sed -n 2p"` #TBD FIX ME + if [ "$result" == "3" ]; then + return + fi + sleep $INTERVAL + done +} + +#Docker exist check +function _qsfp_si_cfg_script_check { + + if [ -f ${QSFP_SI_SCRIPT} ] && [ -x ${QSFP_SI_SCRIPT} ]; then + echo "SI Script exists. Start monitor." + return + else + echo "SI Script not exist. Exit monitor." + exit + fi +} + +# main function +function _main { + #Check SI Script + _qsfp_si_cfg_script_check + #Check docker swss is running + _docker_swss_check + while true + do + _qsfp_si_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/qsfp_si_cfg.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/qsfp_si_cfg.sh new file mode 100755 index 000000000000..ba59c50ca7bf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/qsfp_si_cfg.sh @@ -0,0 +1,230 @@ +#!/bin/bash +# Copyright (C) 2017 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +VERSION="1.0.0" +TRUE=200 +FALSE=404 + +TYPE=${1} +PORT=${2} + +#FIXME update SI values +#QSFP Optical +function _qsfp_optical_si_set { + local idx=0 + #FIXME + local si=(11 68 13 15 68 15 11 68 9 11 68 13 + 11 68 17 11 68 13 13 68 11 11 68 15 + 11 68 13 11 68 17 11 68 17 13 68 13 + 11 68 15 11 68 9 11 68 9 11 68 7 + 9 68 13 13 68 7 11 68 7 11 68 11 + 11 68 13 11 68 13 9 68 7 11 68 11 + 11 68 9 11 68 15 11 68 9 11 68 9 + 11 68 9 11 68 7 11 68 9 11 68 9 + 13 68 9 13 68 13 13 68 7 13 68 11 + 13 68 5 13 68 11 13 68 5 13 68 11 + + 11 68 3 11 68 9 11 68 5 11 68 13 + 11 68 9 11 68 9 11 68 11 13 68 5 + 13 68 3 11 68 7 11 68 5 11 68 9 + 11 68 9 13 68 9 13 68 1 11 68 11 + 5 68 1 11 68 7 11 68 1 13 68 3 + 11 68 5 11 68 3 11 68 7 11 68 3 + 11 68 3 13 68 11 13 68 1 13 68 3 + 11 68 1 13 68 1 13 68 1 11 68 7 + 11 68 1 11 68 5 11 68 1 9 68 5 + 5 68 1 13 68 1 11 68 5 11 68 3 + + 11 68 1 11 68 11 11 68 1 13 68 7 + 13 68 1 15 68 1 11 68 1 13 68 7 + 13 68 1 11 68 5 11 68 1 11 68 1 + 11 68 5 13 68 3 11 68 5 9 68 1 + 11 68 5 13 68 5 13 68 1 11 68 9 + 13 68 1 11 68 13 13 68 1 11 68 7 + 11 68 1 11 68 1 9 68 1 11 68 1 + 11 68 1 11 68 1 11 68 5 11 68 1 + 13 68 1 11 68 11 11 68 1 11 68 1 + 11 68 1 11 68 15 11 68 1 13 68 5 + + 11 68 1 11 68 1 9 68 1 13 68 1 + 11 68 1 11 68 1 9 68 1 11 68 1 + 11 68 1 13 68 3 11 68 1 13 68 1 + 11 68 1 13 68 1 11 68 1 11 68 13 + 11 68 1 11 68 1 11 68 1 11 68 1 + 11 68 11 11 68 1 13 68 1 11 68 1 + 11 68 1 11 68 9 11 68 1 11 68 7 + 11 68 1 13 68 1 13 68 1 11 68 1 + 11 68 1 11 68 5 11 68 1 13 68 3 + 11 68 3 9 68 1 11 68 3 11 68 1 + + 11 68 7 11 68 9 11 68 1 11 68 9 + 11 68 3 11 68 15 11 68 3 9 68 9 + 9 68 1 11 68 3 11 68 1 11 68 5 + 11 68 5 5 68 5 11 68 5 11 68 1 + 13 68 5 13 68 5 11 68 1 11 68 9 + 11 68 1 11 68 1 11 68 1 13 68 7 + 11 68 1 11 68 5 11 68 1 11 68 3 + 11 68 5 11 68 1 11 68 5 11 68 1 + 11 68 3 11 68 7 11 68 3 11 68 9 + 11 68 1 13 68 7 11 68 1 9 68 9 + + 13 68 1 11 68 5 11 68 3 13 68 5 + 11 68 7 11 68 11 13 68 5 9 68 5 + 11 68 5 11 68 13 13 68 7 11 68 13 + 11 68 7 11 68 11 11 68 5 11 68 11 + 11 68 11 11 68 11 11 68 7 11 68 11 + 11 68 13 11 68 11 11 68 9 15 68 9 + 11 68 11 11 68 5 11 68 7 13 68 11 + 11 68 9 13 68 17 11 68 7 11 68 13 + 11 68 11 11 68 17 11 68 13 11 68 15 + 13 68 9 13 68 11 11 68 11 13 68 7 + + 11 68 13 13 68 9 11 68 9 11 68 9 + 11 68 19 11 68 15 11 68 9 11 68 11 + 13 68 13 13 68 17 13 68 11 11 68 11 + 13 68 9 13 68 13 11 68 11 11 68 9) + + idx=$(( PORT * 12 )) + #FIXEME + #for j in {0..3} + #do + # bcmcmd "phy ce${PORT} CL93N72_UT_CTL2r.${j} CL93N72_TXFIR_POST=${si[idx++]}; phy ce${PORT} CL93N72_UT_CTL3r.${j} CL93N72_TXFIR_MAIN=${si[idx++]}; phy ce${PORT} CL93N72_UT_CTL2r.${j} CL93N72_TXFIR_PRE=${si[idx++]};" + #done +} + +function _qsfp_dac_si_set { + local idx=0 + # each port has 4 lanes, each lane has 3 SI values (post,main,pre), total 4*3=12 + local port_si=12 + + #si[0]: txfir_post for port0 lane0 + #si[1]: txfir_main for port0 lane0 + #si[2]: txfir_pre for port0 lane0 + + #si[3]: txfir_post for port0 lane1 + #si[4]: txfir_main for port0 lane1 + #si[5]: txfir_pre for port0 lane1 + + local si=(11 68 13 15 68 15 11 68 9 11 68 13 + 11 68 17 11 68 13 13 68 11 11 68 15 + 11 68 13 11 68 17 11 68 17 13 68 13 + 11 68 15 11 68 9 11 68 9 11 68 7 + 9 68 13 13 68 7 11 68 7 11 68 11 + 11 68 13 11 68 13 9 68 7 11 68 11 + 11 68 9 11 68 15 11 68 9 11 68 9 + 11 68 9 11 68 7 11 68 9 11 68 9 + 13 68 9 13 68 13 13 68 7 13 68 11 + 13 68 5 13 68 11 13 68 5 13 68 11 + + 11 68 3 11 68 9 11 68 5 11 68 13 + 11 68 9 11 68 9 11 68 11 13 68 5 + 13 68 3 11 68 7 11 68 5 11 68 9 + 11 68 9 13 68 9 13 68 1 11 68 11 + 5 68 1 11 68 7 11 68 1 13 68 3 + 11 68 5 11 68 3 11 68 7 11 68 3 + 11 68 3 13 68 11 13 68 1 13 68 3 + 11 68 1 13 68 1 13 68 1 11 68 7 + 11 68 1 11 68 5 11 68 1 9 68 5 + 5 68 1 13 68 1 11 68 5 11 68 3 + + 11 68 1 11 68 11 11 68 1 13 68 7 + 13 68 1 15 68 1 11 68 1 13 68 7 + 13 68 1 11 68 5 11 68 1 11 68 1 + 11 68 5 13 68 3 11 68 5 9 68 1 + 11 68 5 13 68 5 13 68 1 11 68 9 + 13 68 1 11 68 13 13 68 1 11 68 7 + 11 68 1 11 68 1 9 68 1 11 68 1 + 11 68 1 11 68 1 11 68 5 11 68 1 + 13 68 1 11 68 11 11 68 1 11 68 1 + 11 68 1 11 68 15 11 68 1 13 68 5 + + 11 68 1 11 68 1 9 68 1 13 68 1 + 11 68 1 11 68 1 9 68 1 11 68 1 + 11 68 1 13 68 3 11 68 1 13 68 1 + 11 68 1 13 68 1 11 68 1 11 68 13 + 11 68 1 11 68 1 11 68 1 11 68 1 + 11 68 11 11 68 1 13 68 1 11 68 1 + 11 68 1 11 68 9 11 68 1 11 68 7 + 11 68 1 13 68 1 13 68 1 11 68 1 + 11 68 1 11 68 5 11 68 1 13 68 3 + 11 68 3 9 68 1 11 68 3 11 68 1 + + 11 68 7 11 68 9 11 68 1 11 68 9 + 11 68 3 11 68 15 11 68 3 9 68 9 + 9 68 1 11 68 3 11 68 1 11 68 5 + 11 68 5 5 68 5 11 68 5 11 68 1 + 13 68 5 13 68 5 11 68 1 11 68 9 + 11 68 1 11 68 1 11 68 1 13 68 7 + 11 68 1 11 68 5 11 68 1 11 68 3 + 11 68 5 11 68 1 11 68 5 11 68 1 + 11 68 3 11 68 7 11 68 3 11 68 9 + 11 68 1 13 68 7 11 68 1 9 68 9 + + 13 68 1 11 68 5 11 68 3 13 68 5 + 11 68 7 11 68 11 13 68 5 9 68 5 + 11 68 5 11 68 13 13 68 7 11 68 13 + 11 68 7 11 68 11 11 68 5 11 68 11 + 11 68 11 11 68 11 11 68 7 11 68 11 + 11 68 13 11 68 11 11 68 9 15 68 9 + 11 68 11 11 68 5 11 68 7 13 68 11 + 11 68 9 13 68 17 11 68 7 11 68 13 + 11 68 11 11 68 17 11 68 13 11 68 15 + 13 68 9 13 68 11 11 68 11 13 68 7 + + 11 68 13 13 68 9 11 68 9 11 68 9 + 11 68 19 11 68 15 11 68 9 11 68 11 + 13 68 13 13 68 17 13 68 11 11 68 11 + 13 68 9 13 68 13 11 68 11 11 68 9) + + # get first si index for this port + idx=$(( PORT * port_si )) + + # loop for 4 lanes + for j in {0..3} + do + bcmcmd "phy ce${PORT} CL93N72_UT_CTL2r.${j} CL93N72_TXFIR_POST=${si[idx++]}; phy ce${PORT} CL93N72_UT_CTL3r.${j} CL93N72_TXFIR_MAIN=${si[idx++]}; phy ce${PORT} CL93N72_UT_CTL2r.${j} CL93N72_TXFIR_PRE=${si[idx++]};" + done +} + +# Help usage function +function _help { + echo "=========================================================" + echo "# Description: Help Function" + echo "=========================================================" + echo "----------------------------------------------------" + echo "EX : ${0} help" + echo " : ${0} optical [0-63]" + echo " : ${0} dac [0-63]" + echo "----------------------------------------------------" +} + +#Main Function +function _main { + + if [ "${TYPE}" == "help" ]; then + _help + elif [ "${TYPE}" == "optical" ]; then + _qsfp_optical_si_set + elif [ "${TYPE}" == "dac" ]; then + _qsfp_dac_si_set + else + echo "Invalid Parameters, Exit!!!" + _help + exit ${FALSE} + fi +} + +_main diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/s9200_64x_monitor.sh b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/s9200_64x_monitor.sh new file mode 100755 index 000000000000..974da6d5001f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ingrasys/s9200-64x/utils/s9200_64x_monitor.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Copyright (C) 2016 Ingrasys, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +INTERVAL=5 +I2C_UTILS="/usr/sbin/i2c_utils.sh" + + +# LED status monitor +function _led_monitor { + ${I2C_UTILS} i2c_led_fan_status_set >/dev/null + ${I2C_UTILS} i2c_led_psu_status_set >/dev/null + ${I2C_UTILS} i2c_led_fan_tray_status_set >/dev/null +} + +# main function +function _main { + while true + do + _led_monitor + # Sleep while still handling signals + sleep $INTERVAL & + wait $! + done +} + +_main \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-mitac b/platform/broadcom/sonic-platform-modules-mitac deleted file mode 160000 index ed807feb6f8e..000000000000 --- a/platform/broadcom/sonic-platform-modules-mitac +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ed807feb6f8efc612ae57dea3123256d972506c5 diff --git a/platform/broadcom/sonic-platform-modules-mitac/.gitignore b/platform/broadcom/sonic-platform-modules-mitac/.gitignore new file mode 100644 index 000000000000..38e72f05332d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/.gitignore @@ -0,0 +1,17 @@ +# Build file +ly1200-32x/modules/*.mod.c +ly1200-32x/modules/*.mod.o +ly1200-32x/modules/*.o +ly1200-32x/modules/*.ko +ly1200-32x/modules/*.cmd +ly1200-32x/modules/Module.symvers +ly1200-32x/modules/modules.order +ly1200-32x/modules/.tmp_versions + +debian/sonic-platform-mitac-ly1200-32x/ +debian/sonic-platform-mitac-ly1200-32x.debhelper.log +debian/sonic-platform-mitac-ly1200-32x.postinst.debhelper +debian/sonic-platform-mitac-ly1200-32x.postrm.debhelper +debian/sonic-platform-mitac-ly1200-32x.prerm.debhelper +debian/sonic-platform-mitac-ly1200-32x.substvars +debian/files diff --git a/platform/broadcom/sonic-platform-modules-mitac/LICENSE b/platform/broadcom/sonic-platform-modules-mitac/LICENSE new file mode 100644 index 000000000000..c07c63913aeb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2018 MiTAC Technology Corporation + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 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-mitac/README.md b/platform/broadcom/sonic-platform-modules-mitac/README.md new file mode 100644 index 000000000000..d7d47a58debf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/README.md @@ -0,0 +1 @@ +platform drivers of MiTAC products for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-mitac/debian/changelog b/platform/broadcom/sonic-platform-modules-mitac/debian/changelog new file mode 100644 index 000000000000..592bb3a71134 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/debian/changelog @@ -0,0 +1,5 @@ +sonic-mitac-platform-modules (1.0) unstable; urgency=low + + * Initial release + + -- MiTAC Network Thu, 01 Sep 2017 11:26:38 +0800 diff --git a/platform/broadcom/sonic-platform-modules-mitac/debian/compat b/platform/broadcom/sonic-platform-modules-mitac/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-mitac/debian/control b/platform/broadcom/sonic-platform-modules-mitac/debian/control new file mode 100644 index 000000000000..8e20f8524d74 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/debian/control @@ -0,0 +1,12 @@ +Source: sonic-mitac-platform-modules +Section: main +Priority: extra +Maintainer: MiTAC network +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: sonic-platform-mitac-ly1200-32x +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/broadcom/sonic-platform-modules-mitac/debian/rules b/platform/broadcom/sonic-platform-modules-mitac/debian/rules new file mode 100755 index 000000000000..7f9f99827d21 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/debian/rules @@ -0,0 +1,41 @@ +#!/usr/bin/make -f + +export INSTALL_MOD_DIR:=extra + +PACKAGE_PRE_NAME := sonic-platform-mitac +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= ly1200-32x + +%: + 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 -p$(PACKAGE_PRE_NAME)-$${mod}\ + $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin;\ + cp $(MOD_SRC_DIR)/$${mod}/modules/*.ko \ + debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + mkdir -p debian/$(PACKAGE_PRE_NAME)-$${mod}/opt; \ + cp -rfL $(MOD_SRC_DIR)/$${mod}/opt/* \ + debian/$(PACKAGE_PRE_NAME)-$${mod}/opt; \ + mkdir -p debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/init.d; \ + cp -rfL $(MOD_SRC_DIR)/$${mod}/etc/* \ + debian/$(PACKAGE_PRE_NAME)-$${mod}/etc; \ + 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-mitac/debian/sonic-platform-mitac-ly1200-32x.init b/platform/broadcom/sonic-platform-modules-mitac/debian/sonic-platform-mitac-ly1200-32x.init new file mode 100644 index 000000000000..d2f7dbf610ab --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/debian/sonic-platform-mitac-ly1200-32x.init @@ -0,0 +1,51 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup ly1200-32x board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + echo 0 > /proc/sys/kernel/perf_cpu_time_max_percent + + /etc/init.d/gpe start + /etc/init.d/i2c_init start + /etc/init.d/sys_polld start + /opt/script/start_watchdog.sh & + /opt/script/start_service.sh & + echo "done." + ;; + +stop) + echo -n "cleaning... " + + /etc/init.d/gpe stop + /etc/init.d/i2c_init stop + /etc/init.d/xcvr_servd stop + /etc/init.d/sys_servd stop + /etc/init.d/sys_polld stop + + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/sonic-platform-mitac-ly1200-32x.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-mitac/debian/sonic-platform-mitac-ly1200-32x.upstart b/platform/broadcom/sonic-platform-modules-mitac/debian/sonic-platform-mitac-ly1200-32x.upstart new file mode 100644 index 000000000000..39533b8226af --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/debian/sonic-platform-mitac-ly1200-32x.upstart @@ -0,0 +1,5 @@ +description "SONiC platform service" + +respawn + +exec /etc/init.d/sonic-platform-mitac-ly1200-32x start diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/fan-ctrld b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/fan-ctrld new file mode 100755 index 000000000000..936f01e8b640 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/fan-ctrld @@ -0,0 +1,35 @@ +#!/bin/bash +### BEGIN INIT INFO +# Provides: fan-ctrld +# Required-Start: +# Required-Stop: +# Default-Start: rc.local +# Default-Stop: +# Short-Description: Daemon fan-ctrld +### END INIT INFO + +N=/etc/init.d/fan-ctrld +D_PATH=/opt/fan-ctrl/fan-ctrl + +set -e + +stop_fan_ctrld () { + pkill -f $D_PATH +} + +case "$1" in + start) + $D_PATH & + ;; + stop) + stop_fan_ctrld + ;; + reload|restart|force-reload) + ;; + *) + echo "Usage: $N {start}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/gpe b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/gpe new file mode 100755 index 000000000000..c326442db047 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/gpe @@ -0,0 +1,39 @@ +#! /bin/bash +### BEGIN INIT INFO +# Provides: gpe +# Required-Start: +# Required-Stop: +# Default-Start: rc.local +# Default-Stop: +# Short-Description: Daemon gpe +### END INIT INFO + +# Load kernel modules +load_module () { + if [ `lsmod | grep -c "gpe "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/extra/mitac_ly1200_32x_gpe.ko + fi +} + +remove_module () { + rmmod mitac-ly1200-32x_gpe +} + +case "$1" in + start) + load_module + ;; + stop) + remove_module + ;; + reload|restart|force-reload) + remove_module + load_module + ;; + *) + echo "Usage: $N {start|stop|reload|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/i2c_init b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/i2c_init new file mode 100755 index 000000000000..caddfce3325d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/i2c_init @@ -0,0 +1,214 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup ly1200-32x board. +### END INIT INFO + +I2C_I801_RM_PRINT=0 +I2C_ISMT_RM_PRINT=0 +I2C_I801_INS_PRINT=0 +I2C_ISMT_INS_PRINT=0 +I2C_I801_RM_RETRY=0 +I2C_ISMT_RM_RETRY=0 +I2C_I801_INS_RETRY=0 +I2C_ISMT_INS_RETRY=0 +RETRY=3 + +# process name/id +DAEMON_NAME=`basename $0` +DAEMON_PID="$$" + +# default log file +DEF_LOG_FILE="/var/log/syslog" + +#/* +#* FEATURE: +#* log_msg +#* PURPOSE: +#* log message +#* PARAMETERS: +#* msg (IN) message +#* RETURNS: +#* +#*/ +function log_msg() { + local msg=$1 + + echo -e "`date +"%b %_d %T"` `hostname` $DAEMON_NAME[$DAEMON_PID]: ${msg}" >> ${DEF_LOG_FILE} +} + + +# Load kernel modules +load_modules () { + #----------remove i801 start--------------------- + if [ `lsmod | grep -c "i2c_i801 "` -eq 1 ]; then + rmmod i2c_i801 + while [ `lsmod | grep -c "i2c_i801 "` -eq 1 ] + do + if [ $I2C_I801_RM_PRINT -eq 0 ]; then + I2C_I801_RM_PRINT=1 + log_msg "Wait for i2c_i801 remove." + fi + if [ $I2C_I801_RM_RETRY -lt $RETRY ];then + I2C_I801_RM_RETRY=$((I2C_I801_RM_RETRY + 1)) + else + break + fi + sleep 1 + done + if [ $I2C_I801_RM_PRINT -eq 1 ]; then + log_msg "i2c_i801 remove success." + fi + fi + #----------remove i801 end------------------------ + + + #----------remove ismt start---------------------- + if [ `lsmod | grep -c "i2c_ismt "` -eq 1 ]; then + rmmod i2c_ismt + while [ `lsmod | grep -c "i2c_ismt "` -eq 1 ] + do + if [ $I2C_ISMT_RM_PRINT -eq 0 ]; then + I2C_ISMT_RM_PRINT=1 + log_msg "Wait for i2c_ismt remove." + fi + if [ $I2C_ISMT_RM_RETRY -lt $RETRY ];then + I2C_ISMT_RM_RETRY=$((I2C_ISMT_RM_RETRY + 1)) + else + break + fi + sleep 1 + done + if [ $I2C_ISMT_RM_PRINT -eq 1 ]; then + log_msg "i2c_ismt remove success." + fi + fi + #----------remove ismt end------------------------ + + #----------insert i801 start---------------------- + insmod /lib/modules/`uname -r`/kernel/drivers/i2c/busses/i2c-i801.ko + while [ `lsmod | grep -c "i2c_i801 "` -eq 0 ] + do + if [ $I2C_I801_INS_PRINT -eq 0 ]; then + I2C_I801_INS_PRINT=1 + log_msg "Wait for i2c_i801 insert." + fi + if [ $I2C_I801_INS_RETRY -lt $RETRY ];then + I2C_I801_INS_RETRY=$((I2C_I801_INS_RETRY + 1)) + else + break + fi + sleep 1 + done + if [ $I2C_I801_INS_PRINT -eq 1 ]; then + log_msg "i2c_i801 insert success." + fi + #----------insert i801 end------------------------ + + #----------insert ismt start---------------------- + insmod /lib/modules/`uname -r`/kernel/drivers/i2c/busses/i2c-ismt.ko + while [ `lsmod | grep -c "i2c_ismt "` -eq 0 ] + do + if [ $I2C_ISMT_INS_PRINT -eq 0 ]; then + I2C_ISMT_INS_PRINT=1 + log_msg "Wait for i2c_ismt insert." + fi + if [ $I2C_ISMT_INS_RETRY -lt $RETRY ];then + I2C_ISMT_INS_RETRY=$((I2C_ISMT_INS_RETRY + 1)) + else + break + fi + sleep 1 + done + if [ $I2C_ISMT_INS_PRINT -eq 1 ]; then + log_msg "i2c_ismt insert success." + fi + #----------insert ismt start------------------------ + if [ `lsmod | grep -c "at24 "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/kernel/drivers/misc/eeprom/at24.ko + fi + if [ `lsmod | grep -c "i2c_mux "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/kernel/drivers/i2c/i2c-mux.ko + fi + if [ `lsmod | grep -c "i2c_mux_pca954x "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/kernel/drivers/i2c/muxes/i2c-mux-pca954x.ko + fi + if [ `lsmod | grep -c "lm75 "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/kernel/drivers/hwmon/lm75.ko + fi + if [ `lsmod | grep -c "max31790 "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/kernel/drivers/hwmon/max31790.ko + fi + if [ `lsmod | grep -c "sff_8436_eeprom "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/kernel/drivers/misc/eeprom/sff_8436_eeprom.ko + fi + if [ `lsmod | grep -c "mitac_ly1200_32x_fse000 "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/extra/mitac_ly1200_32x_fse000.ko + fi + if [ `lsmod | grep -c "mitac_ly1200_32x_system_cpld "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/extra/mitac_ly1200_32x_system_cpld.ko + fi + if [ `lsmod | grep -c "mitac_ly1200_32x_master_cpld "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/extra/mitac_ly1200_32x_master_cpld.ko + fi + if [ `lsmod | grep -c "mitac_ly1200_32x_slave_cpld "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/extra/mitac_ly1200_32x_slave_cpld.ko + fi + if [ `lsmod | grep -c "mitac_ly1200_32x_cb_i2c "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/extra/mitac_ly1200_32x_cb_i2c.ko + fi + if [ `lsmod | grep -c "mitac_ly1200_32x_sb_i2c "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/extra/mitac_ly1200_32x_sb_i2c.ko + fi + if [ `lsmod | grep -c "mitac_ly1200_32x_pb_i2c "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/extra/mitac_ly1200_32x_pb_i2c.ko + fi + if [ `lsmod | grep -c "mitac_ly1200_32x_fb_i2c "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/extra/mitac_ly1200_32x_fb_i2c.ko + fi + if [ `lsmod | grep -c "mitac_ly1200_32x_fb_module_i2c "` -eq 0 ]; then + insmod /lib/modules/`uname -r`/extra/mitac_ly1200_32x_fb_module_i2c.ko + fi +} + +# Load i2c_dev modules +load_i2c_dev_modules () { + if [ `lsmod | grep -c "i2c_dev "` -eq 0 ]; then + modprobe i2c_dev + fi +} + +case "$1" in +start) + echo -n "Setting up board... " + load_i2c_dev_modules + load_modules + echo "done." + ;; + +stop) + echo -n "cleaning... " + + + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/i2c_init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/sys_polld b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/sys_polld new file mode 100755 index 000000000000..1df43346f257 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/sys_polld @@ -0,0 +1,48 @@ +#!/bin/bash +### BEGIN INIT INFO +# Provides: sys-polld +# Required-Start: +# Required-Stop: +# Default-Start: rc.local +# Default-Stop: +# Short-Description: Daemon sys-polld +### END INIT INFO + +N=/etc/init.d/sys-polld +D_PATH=/opt/system-check/system-check.sh + +set -e + +stop_syspolld () { + local GCOUNT=`ps aux | grep -c "$D_PATH"` + local KILL_COUNT=0 + + while [ $GCOUNT -gt 1 ] + do + local ID=`ps aux | grep "$D_PATH" | head -n 1 | awk -F' ' '{print $2}'` + kill -15 $ID + GCOUNT=`ps aux | grep -c "$D_PATH"` + KILL_COUNT=`expr $KILL_COUNT + 1` + if [ $KILL_COUNT -eq 100 ]; then + echo "Error: kill sys-polld $KILL_COUNT times. stop kill process." + GCOUNT=0 + fi + done +} + +case "$1" in + start) + $D_PATH & + ;; + stop) + stop_syspolld + ;; + reload|restart|force-reload) + ;; + *) + echo "Usage: $N {start}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/sys_servd b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/sys_servd new file mode 100755 index 000000000000..09ee087d5db0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/sys_servd @@ -0,0 +1,28 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: sys-servd +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: rc.local +# Default-Stop: 0 1 6 +# Short-Description: Daemon sys-servd +### END INIT INFO + +# Author: Eddy Weng + +DESC="Service script for /opt/sys-serv/sys-servd" +DAEMON=/opt/sys-serv/sys-servd + +case "$1" in + start) + start-stop-daemon --start --exec $DAEMON + ;; + stop) + start-stop-daemon --stop --name sys-servd + ;; + *) + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/xcvr_servd b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/xcvr_servd new file mode 100755 index 000000000000..1558614fd43c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/init.d/xcvr_servd @@ -0,0 +1,28 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: xcvr-servd +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: rc.local +# Default-Stop: 0 1 6 +# Short-Description: Daemon xcvr-servd +### END INIT INFO + +# Author: Yencheng Lin + +DESC="Service script for /opt/xcvr-serv/xcvr-servd" +DAEMON=/opt/xcvr-serv/xcvr-servd + +case "$1" in + start) + start-stop-daemon --start --exec $DAEMON + ;; + stop) + start-stop-daemon --stop --name xcvr-servd + ;; + *) + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc0.d/K02xcvr_servd b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc0.d/K02xcvr_servd new file mode 120000 index 000000000000..d71f756d3deb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc0.d/K02xcvr_servd @@ -0,0 +1 @@ +../init.d/xcvr_servd \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc1.d/K02xcvr_servd b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc1.d/K02xcvr_servd new file mode 120000 index 000000000000..d71f756d3deb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc1.d/K02xcvr_servd @@ -0,0 +1 @@ +../init.d/xcvr_servd \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc6.d/K02xcvr_servd b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc6.d/K02xcvr_servd new file mode 120000 index 000000000000..d71f756d3deb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/etc/rc6.d/K02xcvr_servd @@ -0,0 +1 @@ +../init.d/xcvr_servd \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/Makefile b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/Makefile new file mode 100644 index 000000000000..fc3f88de8eb3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/Makefile @@ -0,0 +1,5 @@ +obj-m:=mitac_ly1200_32x_fb_i2c.o mitac_ly1200_32x_fse000.o \ +mitac_ly1200_32x_master_cpld.o mitac_ly1200_32x_sb_i2c.o \ +mitac_ly1200_32x_system_cpld.o mitac_ly1200_32x_cb_i2c.o \ +mitac_ly1200_32x_fb_module_i2c.o mitac_ly1200_32x_gpe.o \ +mitac_ly1200_32x_pb_i2c.o mitac_ly1200_32x_slave_cpld.o diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/bms_i2c.h b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/bms_i2c.h new file mode 100644 index 000000000000..dd63607f39c7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/bms_i2c.h @@ -0,0 +1,26 @@ +#ifndef _BMS_I2C_H_ +#define _BMS_I2C_H_ + +const char *bms_i2c_adapter_names[] = { + "SMBus I801 adapter", + "SMBus iSMT adapter", +}; + +enum i2c_adapter_type { + I2C_ADAPTER_I801 = 0, + I2C_ADAPTER_ISMT, +}; + +enum bms_module_switch_bus { + I2C_STAGE1_MUX_CHAN0 = 0, + I2C_STAGE1_MUX_CHAN1, + I2C_STAGE1_MUX_CHAN2, + I2C_STAGE1_MUX_CHAN3, + I2C_STAGE1_MUX_CHAN4, + I2C_STAGE1_MUX_CHAN5, + I2C_STAGE1_MUX_CHAN6, + I2C_STAGE1_MUX_CHAN7, +}; + +#endif /* _BMS_I2C_H_ */ + diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/master_cpld_reg.h b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/master_cpld_reg.h new file mode 100644 index 000000000000..dfdc89dbe57d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/master_cpld_reg.h @@ -0,0 +1,275 @@ +#ifndef __MASTER_CPLD_REG +#define __MASTER_CPLD_REG + +static int master_cpld_raw_read(struct device *dev, struct device_attribute *attr, char *buf, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name); +static int master_cpld_raw_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name); + +/* generic CPLD read function */ +#define FLD_RAW_RD_FUNC(_reg, _fld, _wdh) static ssize_t \ +master_cpld_##_fld##_raw_read(struct device *dev, struct device_attribute *attr, char *buf) { \ + return master_cpld_raw_read(dev, attr, buf, _reg##_offset, _reg##_width, _fld##_shift, _fld##_width, _fld##_mask, #_reg); \ +} + +/* generic CPLD write function */ +#define FLD_RAW_WR_FUNC(_reg, _fld, _wdh) static ssize_t \ +master_cpld_##_fld##_raw_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { \ + return master_cpld_raw_write(dev, attr, buf, count, _reg##_offset, _reg##_width, _fld##_shift, _fld##_width, _fld##_mask, #_reg); \ +} + +/* CPLD register definition macros */ +#define REG_DEF(_reg, _off, _wdh) \ +static unsigned int _reg##_offset = (unsigned int)(_off); \ +static unsigned int _reg##_width = (unsigned int)(_wdh); + +/* CPLD register field definition macros, with generic read/write function */ +#define FLD_RAW_RO_DEF(_reg, _fld, _sft, _wdh) \ +static unsigned int _fld##_shift = (unsigned int)(_sft); \ +static unsigned int _fld##_width = (unsigned int)(_wdh); \ +static unsigned int _fld##_mask = ((((unsigned int)1) << (_wdh)) - 1); \ +FLD_RAW_RD_FUNC(_reg, _fld, _wdh) + +#define FLD_RAW_RW_DEF(_reg, _fld, _sft, _wdh) \ +static unsigned int _fld##_shift = (unsigned int)(_sft); \ +static unsigned int _fld##_width = (unsigned int)(_wdh); \ +static unsigned int _fld##_mask = ((((unsigned int)1) << (_wdh)) - 1); \ +FLD_RAW_RD_FUNC(_reg, _fld, _wdh) FLD_RAW_WR_FUNC(_reg, _fld, _wdh) + +/* declare master CPLD registers */ +/* register name offset width */ +/* --------------------------------------- ------- ----- */ +REG_DEF( mstr_cpld_rev, 0x00, 8) +REG_DEF( mstr_cpld_gpr, 0x01, 8) +REG_DEF( mb_brd_rev_type, 0x02, 8) +REG_DEF( mstr_srr, 0x03, 8) +REG_DEF( eeprom_wp, 0x04, 8) +REG_DEF( mstr_irq, 0x05, 8) +REG_DEF( system_led, 0x06, 8) +REG_DEF( fan_tray_3_1_led, 0x07, 8) +REG_DEF( fan_tray_6_4_led, 0x08, 8) +REG_DEF( fan_tray_status, 0x09, 8) +REG_DEF( fan_type_status, 0x0A, 8) +REG_DEF( psu_en_status, 0x0B, 8) +REG_DEF( mb_pwr_en_status, 0x0C, 8) +REG_DEF( mb_pwr_status, 0x0D, 8) + +REG_DEF( zqsfp28_present_8_1_status, 0x10, 8) +REG_DEF( zqsfp28_present_16_9_status, 0x11, 8) +REG_DEF( zqsfp28_rst_8_1, 0x12, 8) +REG_DEF( zqsfp28_rst_16_9, 0x13, 8) +REG_DEF( zqsfp28_modsel_8_1, 0x14, 8) +REG_DEF( zqsfp28_modsel_16_9, 0x15, 8) +REG_DEF( zqsfp28_lpmode_8_1, 0x16, 8) +REG_DEF( zqsfp28_lpmode_16_9, 0x17, 8) +REG_DEF( zqsfp28_irq_8_1_status, 0x18, 8) +REG_DEF( zqsfp28_irq_16_9_status, 0x19, 8) +REG_DEF( zqsfp28_irq_msk_8_1_status, 0x1A, 8) +REG_DEF( zqsfp28_irq_msk_16_9_status, 0x1B, 8) + + +/* declare master CPLD register's fields */ +/* register name field name shift width */ +/* ---------------------- ---------------- ------ ----- */ +FLD_RAW_RO_DEF( mstr_cpld_rev, mjr_rev, 4, 4) +FLD_RAW_RO_DEF( mstr_cpld_rev, mnr_rev, 0, 4) + +FLD_RAW_RW_DEF( mstr_cpld_gpr, scrtch_reg, 0, 8) + +FLD_RAW_RO_DEF( mb_brd_rev_type, brd_rev, 4, 4) +FLD_RAW_RO_DEF( mb_brd_rev_type, brd_type, 0, 4) + +FLD_RAW_RW_DEF( mstr_srr, mb_rst, 2, 1) +FLD_RAW_RW_DEF( mstr_srr, npu_rst, 1, 1) +FLD_RAW_RW_DEF( mstr_srr, mgmt_phy_rst, 0, 1) + +FLD_RAW_RW_DEF( eeprom_wp, mb_eeprom_wp, 2, 1) +FLD_RAW_RW_DEF( eeprom_wp, cpld_spi_wp, 1, 1) +FLD_RAW_RW_DEF( eeprom_wp, fan_eeprom_wp, 0, 1) + +FLD_RAW_RW_DEF( mstr_irq, ps2_int_msk, 7, 1) +FLD_RAW_RW_DEF( mstr_irq, ps1_int_msk, 6, 1) +FLD_RAW_RW_DEF( mstr_irq, usb_fault_msk, 5, 1) +FLD_RAW_RW_DEF( mstr_irq, pcie_int_msk, 4, 1) +FLD_RAW_RW_DEF( mstr_irq, fan_alert_int_msk, 3, 1) +FLD_RAW_RO_DEF( mstr_irq, usb_fault, 2, 1) +FLD_RAW_RO_DEF( mstr_irq, pcie_int, 1, 1) +FLD_RAW_RO_DEF( mstr_irq, fan_alert_int, 0, 1) + +FLD_RAW_RW_DEF( system_led, system_led_fld, 6, 2) +FLD_RAW_RW_DEF( system_led, power_led, 4, 2) +FLD_RAW_RW_DEF( system_led, fan_led, 2, 2) +FLD_RAW_RW_DEF( system_led, locate_led, 1, 1) + +FLD_RAW_RW_DEF( fan_tray_3_1_led, led_test, 6, 2) +FLD_RAW_RW_DEF( fan_tray_3_1_led, fan_tray3_led, 4, 2) +FLD_RAW_RW_DEF( fan_tray_3_1_led, fan_tray2_led, 2, 2) +FLD_RAW_RW_DEF( fan_tray_3_1_led, fan_tray1_led, 0, 2) + +FLD_RAW_RW_DEF( fan_tray_6_4_led, fan_tray6_led, 4, 2) +FLD_RAW_RW_DEF( fan_tray_6_4_led, fan_tray5_led, 2, 2) +FLD_RAW_RW_DEF( fan_tray_6_4_led, fan_tray4_led, 0, 2) + +FLD_RAW_RO_DEF( fan_tray_status, fan_tray6_present, 5, 1) +FLD_RAW_RO_DEF( fan_tray_status, fan_tray5_present, 4, 1) +FLD_RAW_RO_DEF( fan_tray_status, fan_tray4_present, 3, 1) +FLD_RAW_RO_DEF( fan_tray_status, fan_tray3_present, 2, 1) +FLD_RAW_RO_DEF( fan_tray_status, fan_tray2_present, 1, 1) +FLD_RAW_RO_DEF( fan_tray_status, fan_tray1_present, 0, 1) + +FLD_RAW_RO_DEF( fan_type_status, fan_type6, 5, 1) +FLD_RAW_RO_DEF( fan_type_status, fan_type5, 4, 1) +FLD_RAW_RO_DEF( fan_type_status, fan_type4, 3, 1) +FLD_RAW_RO_DEF( fan_type_status, fan_type3, 2, 1) +FLD_RAW_RO_DEF( fan_type_status, fan_type2, 1, 1) +FLD_RAW_RO_DEF( fan_type_status, fan_type1, 0, 1) + +FLD_RAW_RO_DEF( psu_en_status, ps1_ps, 7, 1) +FLD_RAW_RO_DEF( psu_en_status, ps1_pg, 6, 1) +FLD_RAW_RO_DEF( psu_en_status, ps1_int, 5, 1) +FLD_RAW_RW_DEF( psu_en_status, ps1_on, 4, 1) +FLD_RAW_RO_DEF( psu_en_status, ps2_ps, 3, 1) +FLD_RAW_RO_DEF( psu_en_status, ps2_pg, 2, 1) +FLD_RAW_RO_DEF( psu_en_status, ps2_int, 1, 1) +FLD_RAW_RW_DEF( psu_en_status, ps2_on, 0, 1) + +FLD_RAW_RW_DEF( mb_pwr_en_status, usb1_vbus_en, 7, 1) +FLD_RAW_RO_DEF( mb_pwr_en_status, v5p0_en, 5, 1) +FLD_RAW_RO_DEF( mb_pwr_en_status, v3p3_en, 4, 1) +FLD_RAW_RO_DEF( mb_pwr_en_status, vcc_1v8_en, 3, 1) +FLD_RAW_RO_DEF( mb_pwr_en_status, mac_avs1v_en, 2, 1) +FLD_RAW_RO_DEF( mb_pwr_en_status, mac1v_en, 1, 1) +FLD_RAW_RO_DEF( mb_pwr_en_status, vcc_1v25_en, 0, 1) + +FLD_RAW_RO_DEF( mb_pwr_status, vcc_3p3_cpld, 6, 1) +FLD_RAW_RO_DEF( mb_pwr_status, vcc5v_pg, 5, 1) +FLD_RAW_RO_DEF( mb_pwr_status, vcc3v3_pg, 4, 1) +FLD_RAW_RO_DEF( mb_pwr_status, vcc_1v8_pg, 3, 1) +FLD_RAW_RO_DEF( mb_pwr_status, mac_avs1v_pg, 2, 1) +FLD_RAW_RO_DEF( mb_pwr_status, mac1v_pg, 1, 1) +FLD_RAW_RO_DEF( mb_pwr_status, vcc_1v25_pg, 0, 1) + +FLD_RAW_RO_DEF( zqsfp28_present_8_1_status, port8_present, 7, 1) +FLD_RAW_RO_DEF( zqsfp28_present_8_1_status, port7_present, 6, 1) +FLD_RAW_RO_DEF( zqsfp28_present_8_1_status, port6_present, 5, 1) +FLD_RAW_RO_DEF( zqsfp28_present_8_1_status, port5_present, 4, 1) +FLD_RAW_RO_DEF( zqsfp28_present_8_1_status, port4_present, 3, 1) +FLD_RAW_RO_DEF( zqsfp28_present_8_1_status, port3_present, 2, 1) +FLD_RAW_RO_DEF( zqsfp28_present_8_1_status, port2_present, 1, 1) +FLD_RAW_RO_DEF( zqsfp28_present_8_1_status, port1_present, 0, 1) + +FLD_RAW_RO_DEF( zqsfp28_present_16_9_status,port16_present, 7, 1) +FLD_RAW_RO_DEF( zqsfp28_present_16_9_status,port15_present, 6, 1) +FLD_RAW_RO_DEF( zqsfp28_present_16_9_status,port14_present, 5, 1) +FLD_RAW_RO_DEF( zqsfp28_present_16_9_status,port13_present, 4, 1) +FLD_RAW_RO_DEF( zqsfp28_present_16_9_status,port12_present, 3, 1) +FLD_RAW_RO_DEF( zqsfp28_present_16_9_status,port11_present, 2, 1) +FLD_RAW_RO_DEF( zqsfp28_present_16_9_status,port10_present, 1, 1) +FLD_RAW_RO_DEF( zqsfp28_present_16_9_status,port9_present, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_rst_8_1, port8_rst, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_8_1, port7_rst, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_8_1, port6_rst, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_8_1, port5_rst, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_8_1, port4_rst, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_8_1, port3_rst, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_8_1, port2_rst, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_8_1, port1_rst, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_rst_16_9, port16_rst, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_16_9, port15_rst, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_16_9, port14_rst, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_16_9, port13_rst, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_16_9, port12_rst, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_16_9, port11_rst, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_16_9, port10_rst, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_16_9, port9_rst, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_modsel_8_1, port8_modsel, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_8_1, port7_modsel, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_8_1, port6_modsel, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_8_1, port5_modsel, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_8_1, port4_modsel, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_8_1, port3_modsel, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_8_1, port2_modsel, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_8_1, port1_modsel, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_modsel_16_9, port16_modsel, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_16_9, port15_modsel, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_16_9, port14_modsel, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_16_9, port13_modsel, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_16_9, port12_modsel, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_16_9, port11_modsel, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_16_9, port10_modsel, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_16_9, port9_modsel, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_lpmode_8_1, port8_lpmode, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_8_1, port7_lpmode, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_8_1, port6_lpmode, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_8_1, port5_lpmode, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_8_1, port4_lpmode, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_8_1, port3_lpmode, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_8_1, port2_lpmode, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_8_1, port1_lpmode, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_lpmode_16_9, port16_lpmode, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_16_9, port15_lpmode, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_16_9, port14_lpmode, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_16_9, port13_lpmode, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_16_9, port12_lpmode, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_16_9, port11_lpmode, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_16_9, port10_lpmode, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_16_9, port9_lpmode, 0, 1) + +FLD_RAW_RO_DEF( zqsfp28_irq_8_1_status, port8_irq_status, 7, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_8_1_status, port7_irq_status, 6, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_8_1_status, port6_irq_status, 5, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_8_1_status, port5_irq_status, 4, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_8_1_status, port4_irq_status, 3, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_8_1_status, port3_irq_status, 2, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_8_1_status, port2_irq_status, 1, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_8_1_status, port1_irq_status, 0, 1) + +FLD_RAW_RO_DEF( zqsfp28_irq_16_9_status, port16_irq_status, 7, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_16_9_status, port15_irq_status, 6, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_16_9_status, port14_irq_status, 5, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_16_9_status, port13_irq_status, 4, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_16_9_status, port12_irq_status, 3, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_16_9_status, port11_irq_status, 2, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_16_9_status, port10_irq_status, 1, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_16_9_status, port9_irq_status, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_irq_msk_8_1_status, port8_irq_msk, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_8_1_status, port7_irq_msk, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_8_1_status, port6_irq_msk, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_8_1_status, port5_irq_msk, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_8_1_status, port4_irq_msk, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_8_1_status, port3_irq_msk, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_8_1_status, port2_irq_msk, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_8_1_status, port1_irq_msk, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_irq_msk_16_9_status,port16_irq_msk, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_16_9_status,port15_irq_msk, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_16_9_status,port14_irq_msk, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_16_9_status,port13_irq_msk, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_16_9_status,port12_irq_msk, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_16_9_status,port11_irq_msk, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_16_9_status,port10_irq_msk, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_16_9_status,port9_irq_msk, 0, 1) + +FLD_RAW_RO_DEF( zqsfp28_present_8_1_status, port_1_8_present, 0, 8) +FLD_RAW_RO_DEF( zqsfp28_present_16_9_status,port_9_16_present, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_rst_8_1, port_1_8_rst, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_rst_16_9, port_9_16_rst, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_modsel_8_1, port_1_8_modsel, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_modsel_16_9, port_9_16_modsel, 0, 8) +FLD_RAW_RO_DEF( zqsfp28_irq_8_1_status, port_1_8_irq_status, 0, 8) +FLD_RAW_RO_DEF( zqsfp28_irq_16_9_status, port_9_16_irq_status,0, 8) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_8_1_status, port_1_8_irq_msk, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_16_9_status,port_9_16_irq_msk, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_lpmode_8_1, port_1_8_lpmode, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_lpmode_16_9, port_9_16_lpmode, 0, 8) + +FLD_RAW_RO_DEF( fan_tray_status, fan_tray1_6_present, 0, 8) +FLD_RAW_RO_DEF( psu_en_status, psu_en_status_fld, 0, 8) +#endif /* __MASTER_CPLD_REG */ diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/master_cpld_sysfs.h b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/master_cpld_sysfs.h new file mode 100644 index 000000000000..e851ca5fb487 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/master_cpld_sysfs.h @@ -0,0 +1,226 @@ +#ifndef __MASTER_CPLD_SYSFS +#define __MASTER_CPLD_SYSFS + +/* generic CPLD sysfs file definition macros */ +#define SYSFS_RAW_RO_ATTR_DEF(field) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO, master_cpld_##field##_raw_read, NULL); + +#define SYSFS_RAW_RW_ATTR_DEF(field) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO | S_IWUGO, master_cpld_##field##_raw_read, master_cpld_##field##_raw_write); + +#define SYSFS_MISC_RO_ATTR_DEF(field, _read) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO, _read, NULL); + +#define SYSFS_MISC_RW_ATTR_DEF(field, _read, _write) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO | S_IWUGO, _read, _write); + +#define SYSFS_ATTR_PTR(field) \ +&field.attr + +/* declare master CPLD file system */ +SYSFS_RAW_RO_ATTR_DEF(mjr_rev) +SYSFS_RAW_RO_ATTR_DEF(mnr_rev) + +SYSFS_RAW_RW_ATTR_DEF(scrtch_reg) + +SYSFS_RAW_RO_ATTR_DEF(brd_rev) +SYSFS_RAW_RO_ATTR_DEF(brd_type) + +SYSFS_RAW_RW_ATTR_DEF(mb_rst) +SYSFS_RAW_RW_ATTR_DEF(npu_rst) +SYSFS_RAW_RW_ATTR_DEF(mgmt_phy_rst) + +SYSFS_RAW_RW_ATTR_DEF(mb_eeprom_wp) +SYSFS_RAW_RW_ATTR_DEF(cpld_spi_wp) +SYSFS_RAW_RW_ATTR_DEF(fan_eeprom_wp) + +SYSFS_RAW_RW_ATTR_DEF(ps2_int_msk) +SYSFS_RAW_RW_ATTR_DEF(ps1_int_msk) +SYSFS_RAW_RW_ATTR_DEF(usb_fault_msk) +SYSFS_RAW_RW_ATTR_DEF(pcie_int_msk) +SYSFS_RAW_RW_ATTR_DEF(fan_alert_int_msk) +SYSFS_RAW_RO_ATTR_DEF(usb_fault) +SYSFS_RAW_RO_ATTR_DEF(pcie_int) +SYSFS_RAW_RO_ATTR_DEF(fan_alert_int) + +SYSFS_RAW_RW_ATTR_DEF(system_led_fld) +SYSFS_RAW_RW_ATTR_DEF(power_led) +SYSFS_RAW_RW_ATTR_DEF(fan_led) +SYSFS_RAW_RW_ATTR_DEF(locate_led) + +SYSFS_RAW_RW_ATTR_DEF(led_test) +SYSFS_RAW_RW_ATTR_DEF(fan_tray3_led) +SYSFS_RAW_RW_ATTR_DEF(fan_tray2_led) +SYSFS_RAW_RW_ATTR_DEF(fan_tray1_led) + +SYSFS_RAW_RW_ATTR_DEF(fan_tray6_led) +SYSFS_RAW_RW_ATTR_DEF(fan_tray5_led) +SYSFS_RAW_RW_ATTR_DEF(fan_tray4_led) + +SYSFS_RAW_RO_ATTR_DEF(fan_tray6_present) +SYSFS_RAW_RO_ATTR_DEF(fan_tray5_present) +SYSFS_RAW_RO_ATTR_DEF(fan_tray4_present) +SYSFS_RAW_RO_ATTR_DEF(fan_tray3_present) +SYSFS_RAW_RO_ATTR_DEF(fan_tray2_present) +SYSFS_RAW_RO_ATTR_DEF(fan_tray1_present) + +SYSFS_RAW_RO_ATTR_DEF(fan_type6) +SYSFS_RAW_RO_ATTR_DEF(fan_type5) +SYSFS_RAW_RO_ATTR_DEF(fan_type4) +SYSFS_RAW_RO_ATTR_DEF(fan_type3) +SYSFS_RAW_RO_ATTR_DEF(fan_type2) +SYSFS_RAW_RO_ATTR_DEF(fan_type1) + +SYSFS_RAW_RO_ATTR_DEF(ps1_ps) +SYSFS_RAW_RO_ATTR_DEF(ps1_pg) +SYSFS_RAW_RO_ATTR_DEF(ps1_int) +SYSFS_RAW_RW_ATTR_DEF(ps1_on) +SYSFS_RAW_RO_ATTR_DEF(ps2_ps) +SYSFS_RAW_RO_ATTR_DEF(ps2_pg) +SYSFS_RAW_RO_ATTR_DEF(ps2_int) +SYSFS_RAW_RW_ATTR_DEF(ps2_on) + +SYSFS_RAW_RW_ATTR_DEF(usb1_vbus_en) +SYSFS_RAW_RO_ATTR_DEF(v5p0_en) +SYSFS_RAW_RO_ATTR_DEF(v3p3_en) +SYSFS_RAW_RO_ATTR_DEF(vcc_1v8_en) +SYSFS_RAW_RO_ATTR_DEF(mac_avs1v_en) +SYSFS_RAW_RO_ATTR_DEF(mac1v_en) +SYSFS_RAW_RO_ATTR_DEF(vcc_1v25_en) + +SYSFS_RAW_RO_ATTR_DEF(vcc_3p3_cpld) +SYSFS_RAW_RO_ATTR_DEF(vcc5v_pg) +SYSFS_RAW_RO_ATTR_DEF(vcc3v3_pg) +SYSFS_RAW_RO_ATTR_DEF(vcc_1v8_pg) +SYSFS_RAW_RO_ATTR_DEF(mac_avs1v_pg) +SYSFS_RAW_RO_ATTR_DEF(mac1v_pg) +SYSFS_RAW_RO_ATTR_DEF(vcc_1v25_pg) + +SYSFS_RAW_RO_ATTR_DEF(port8_present) +SYSFS_RAW_RO_ATTR_DEF(port7_present) +SYSFS_RAW_RO_ATTR_DEF(port6_present) +SYSFS_RAW_RO_ATTR_DEF(port5_present) +SYSFS_RAW_RO_ATTR_DEF(port4_present) +SYSFS_RAW_RO_ATTR_DEF(port3_present) +SYSFS_RAW_RO_ATTR_DEF(port2_present) +SYSFS_RAW_RO_ATTR_DEF(port1_present) + +SYSFS_RAW_RO_ATTR_DEF(port16_present) +SYSFS_RAW_RO_ATTR_DEF(port15_present) +SYSFS_RAW_RO_ATTR_DEF(port14_present) +SYSFS_RAW_RO_ATTR_DEF(port13_present) +SYSFS_RAW_RO_ATTR_DEF(port12_present) +SYSFS_RAW_RO_ATTR_DEF(port11_present) +SYSFS_RAW_RO_ATTR_DEF(port10_present) +SYSFS_RAW_RO_ATTR_DEF(port9_present) + +SYSFS_RAW_RW_ATTR_DEF(port8_rst) +SYSFS_RAW_RW_ATTR_DEF(port7_rst) +SYSFS_RAW_RW_ATTR_DEF(port6_rst) +SYSFS_RAW_RW_ATTR_DEF(port5_rst) +SYSFS_RAW_RW_ATTR_DEF(port4_rst) +SYSFS_RAW_RW_ATTR_DEF(port3_rst) +SYSFS_RAW_RW_ATTR_DEF(port2_rst) +SYSFS_RAW_RW_ATTR_DEF(port1_rst) + +SYSFS_RAW_RW_ATTR_DEF(port16_rst) +SYSFS_RAW_RW_ATTR_DEF(port15_rst) +SYSFS_RAW_RW_ATTR_DEF(port14_rst) +SYSFS_RAW_RW_ATTR_DEF(port13_rst) +SYSFS_RAW_RW_ATTR_DEF(port12_rst) +SYSFS_RAW_RW_ATTR_DEF(port11_rst) +SYSFS_RAW_RW_ATTR_DEF(port10_rst) +SYSFS_RAW_RW_ATTR_DEF(port9_rst) + +SYSFS_RAW_RW_ATTR_DEF(port8_modsel) +SYSFS_RAW_RW_ATTR_DEF(port7_modsel) +SYSFS_RAW_RW_ATTR_DEF(port6_modsel) +SYSFS_RAW_RW_ATTR_DEF(port5_modsel) +SYSFS_RAW_RW_ATTR_DEF(port4_modsel) +SYSFS_RAW_RW_ATTR_DEF(port3_modsel) +SYSFS_RAW_RW_ATTR_DEF(port2_modsel) +SYSFS_RAW_RW_ATTR_DEF(port1_modsel) + +SYSFS_RAW_RW_ATTR_DEF(port16_modsel) +SYSFS_RAW_RW_ATTR_DEF(port15_modsel) +SYSFS_RAW_RW_ATTR_DEF(port14_modsel) +SYSFS_RAW_RW_ATTR_DEF(port13_modsel) +SYSFS_RAW_RW_ATTR_DEF(port12_modsel) +SYSFS_RAW_RW_ATTR_DEF(port11_modsel) +SYSFS_RAW_RW_ATTR_DEF(port10_modsel) +SYSFS_RAW_RW_ATTR_DEF(port9_modsel) + +SYSFS_RAW_RW_ATTR_DEF(port8_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port7_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port6_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port5_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port4_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port3_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port2_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port1_lpmode) + +SYSFS_RAW_RW_ATTR_DEF(port16_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port15_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port14_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port13_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port12_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port11_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port10_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port9_lpmode) + +SYSFS_RAW_RO_ATTR_DEF(port8_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port7_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port6_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port5_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port4_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port3_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port2_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port1_irq_status) + +SYSFS_RAW_RO_ATTR_DEF(port16_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port15_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port14_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port13_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port12_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port11_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port10_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port9_irq_status) + +SYSFS_RAW_RW_ATTR_DEF(port8_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port7_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port6_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port5_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port4_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port3_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port2_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port1_irq_msk) + +SYSFS_RAW_RW_ATTR_DEF(port16_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port15_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port14_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port13_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port12_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port11_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port10_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port9_irq_msk) + +SYSFS_RAW_RO_ATTR_DEF(port_1_8_present) +SYSFS_RAW_RO_ATTR_DEF(port_9_16_present) +SYSFS_RAW_RW_ATTR_DEF(port_1_8_rst) +SYSFS_RAW_RW_ATTR_DEF(port_9_16_rst) +SYSFS_RAW_RW_ATTR_DEF(port_1_8_modsel) +SYSFS_RAW_RW_ATTR_DEF(port_9_16_modsel) +SYSFS_RAW_RO_ATTR_DEF(port_1_8_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port_9_16_irq_status) +SYSFS_RAW_RW_ATTR_DEF(port_1_8_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port_9_16_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port_1_8_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port_9_16_lpmode) + +SYSFS_RAW_RO_ATTR_DEF(fan_tray1_6_present) +SYSFS_RAW_RO_ATTR_DEF(psu_en_status_fld) +#endif /* __MASTER_CPLD_SYSFS */ diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_cb_i2c.c b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_cb_i2c.c new file mode 100644 index 000000000000..11fffe251785 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_cb_i2c.c @@ -0,0 +1,163 @@ +#include +#include +#include +#include "bms_i2c.h" + +#define BMS_CB_I2C_CLIENT_NUM 5 +#define BMS_CB_ADAPTER_BASE 0 + +static struct i2c_client *bms_cb_clients[BMS_CB_I2C_CLIENT_NUM] = {NULL}; +static int bms_cb_client_index = 0; + +static int __init __find_i2c_adap(struct device *dev, void *data) +{ + const char *name = data; + static const char *prefix = "i2c-"; + struct i2c_adapter *adapter; + + if (strncmp(dev_name(dev), prefix, strlen(prefix)) != 0) + { + return 0; + } + adapter = to_i2c_adapter(dev); + + return (strncmp(adapter->name, name, strlen(name)) == 0); +} + +static int __init find_i2c_adapter_num(enum i2c_adapter_type type) +{ + struct device *dev = NULL; + struct i2c_adapter *adapter; + const char *name = bms_i2c_adapter_names[type]; + + /* find the adapter by name */ + dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, + __find_i2c_adap); + if (!dev) { + pr_err("%s: i2c adapter %s not found on system.\n", + __func__, name); + return -ENODEV; + } + adapter = to_i2c_adapter(dev); + + return adapter->nr; +} + + +static __init struct i2c_client *bms_cb_setup_spd( + struct i2c_adapter *adap, int addr) +{ + struct i2c_board_info info_spd = { + I2C_BOARD_INFO("spd", addr), + }; + + return i2c_new_device(adap, &info_spd); +} + + +static __init struct i2c_client *bms_cb_setup_eeprom_24c02( + struct i2c_adapter *adap, int addr) +{ + struct i2c_board_info info_spd = { + I2C_BOARD_INFO("24c02", addr), + }; + + return i2c_new_device(adap, &info_spd); +} + +static __init struct i2c_client *bms_cb_setup_tmp75( + struct i2c_adapter *adap, int addr) +{ + struct i2c_board_info info_spd = { + I2C_BOARD_INFO("tmp75", addr), + }; + + return i2c_new_device(adap, &info_spd); +} + +static __init struct i2c_client *bms_cb_setup_system_cpld(struct i2c_adapter *adap) +{ + struct i2c_board_info info = { + I2C_BOARD_INFO("system_cpld", 0x31), + }; + + return i2c_new_device(adap, &info); +} + +static int __init bms_cb_setup_devices_i801(void) +{ + struct i2c_adapter *adap; + int adap_num = find_i2c_adapter_num(I2C_ADAPTER_I801); + + if (adap_num < 0) + return adap_num; + + adap = i2c_get_adapter(adap_num); + if (!adap) { + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + goto exit; + } + + bms_cb_clients[bms_cb_client_index++] = bms_cb_setup_spd(adap, 0x50); + bms_cb_clients[bms_cb_client_index++] = bms_cb_setup_spd(adap, 0x52); + bms_cb_clients[bms_cb_client_index++] = bms_cb_setup_tmp75(adap, 0x4e); + +exit: + return 0; +} + +static int __init bms_cb_setup_devices_ismt(void) +{ + struct i2c_adapter *adap; + int adap_num = find_i2c_adapter_num(I2C_ADAPTER_ISMT); + + if (adap_num < 0) + return adap_num; + + adap = i2c_get_adapter(adap_num); + if (!adap) { + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + return 0; + } + + bms_cb_clients[bms_cb_client_index++] = bms_cb_setup_system_cpld(adap); + bms_cb_clients[bms_cb_client_index++] = bms_cb_setup_eeprom_24c02(adap, 0x56); + return 0; +} + +static int __init bms_cb_i2c_init(void) +{ + /* Initial bms_cb_slients array. */ + memset(bms_cb_clients, 0x0, BMS_CB_I2C_CLIENT_NUM); + + bms_cb_setup_devices_i801(); + mdelay(200); + bms_cb_setup_devices_ismt(); + + return 0; +} + + +static void __exit bms_cb_i2c_exit(void){ + int i; + + for (i=(bms_cb_client_index-1); i>=0; i--) { + if (bms_cb_clients[i]) { + i2c_unregister_device(bms_cb_clients[i]); + bms_cb_clients[i] = NULL; + } + } + + bms_cb_client_index = 0; + +} + + +module_init(bms_cb_i2c_init); +module_exit(bms_cb_i2c_exit); + + +MODULE_DESCRIPTION("mitac_ly1200_32x_cb_i2c driver"); +MODULE_AUTHOR("Eddy Weng "); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fb_i2c.c b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fb_i2c.c new file mode 100644 index 000000000000..d228bc481279 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fb_i2c.c @@ -0,0 +1,153 @@ +#include +#include +#include "bms_i2c.h" + +#define BMS_FB_I2C_CLIENT_NUM 3 + + +static struct i2c_client *bms_fb_clients[BMS_FB_I2C_CLIENT_NUM] = {NULL}; +static int bms_fb_client_index = 0; + +static int __init __find_i2c_adap(struct device *dev, void *data) +{ + const char *name = data; + static const char *prefix = "i2c-"; + struct i2c_adapter *adapter; + + if (strncmp(dev_name(dev), prefix, strlen(prefix)) != 0) + { + return 0; + } + adapter = to_i2c_adapter(dev); + + return (strncmp(adapter->name, name, strlen(name)) == 0); +} + +static int __init find_i2c_adapter_num(enum i2c_adapter_type type) +{ + struct device *dev = NULL; + struct i2c_adapter *adapter; + const char *name = bms_i2c_adapter_names[type]; + + /* find the adapter by name */ + dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, + __find_i2c_adap); + if (!dev) { + pr_err("%s: i2c adapter %s not found on system.\n", + __func__, name); + return -ENODEV; + } + adapter = to_i2c_adapter(dev); + + return adapter->nr; +} + +static int __init find_i2c_mux_adapter_num(int parent_num, int num) +{ + struct device *dev = NULL; + struct i2c_adapter *adapter; + char name[48]; + + snprintf(name, sizeof(name), "i2c-%d-mux (chan_id %d)", + parent_num, num); + /* find the adapter by name */ + dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, + __find_i2c_adap); + if (!dev) { + pr_err("%s: i2c adapter %s not found on system.\n", + __func__, name); + return -ENODEV; + } + adapter = to_i2c_adapter(dev); + + return adapter->nr; +} + +static __init struct i2c_client *bms_fb_setup_tmp75( + struct i2c_adapter *adap, int addr) +{ + struct i2c_board_info info_spd = { + I2C_BOARD_INFO("tmp75", addr), + }; + + return i2c_new_device(adap, &info_spd); +} + +static __init struct i2c_client *bms_fb_setup_max31790( + struct i2c_adapter *adap, int addr) +{ + struct i2c_board_info info_spd = { + I2C_BOARD_INFO("max31790", addr), + }; + + return i2c_new_device(adap, &info_spd); +} + +static int __init bms_fb_setup_devices(void) +{ + struct i2c_adapter *adap; + int adap_num; + int parent_num; + + parent_num = find_i2c_adapter_num(I2C_ADAPTER_ISMT); + if (parent_num < 0) + return parent_num; + + /* Mux chan1 steup */ + adap_num = find_i2c_mux_adapter_num(parent_num, I2C_STAGE1_MUX_CHAN1); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_fb_clients[bms_fb_client_index++] = bms_fb_setup_max31790(adap, 0x20); + bms_fb_clients[bms_fb_client_index++] = bms_fb_setup_max31790(adap, 0x23); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN1); + } + + adap_num = find_i2c_mux_adapter_num(parent_num, I2C_STAGE1_MUX_CHAN2); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_fb_clients[bms_fb_client_index++] = bms_fb_setup_tmp75(adap, 0x4d); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN2); + } + + return 0; +} + +static int __init bms_fb_i2c_init(void) +{ + bms_fb_setup_devices(); + + return 0; +} + +static void __exit bms_fb_i2c_exit(void){ + int i; + + for (i=(bms_fb_client_index-1); i>=0; i--) { + if (bms_fb_clients[i]) { + i2c_unregister_device(bms_fb_clients[i]); + bms_fb_clients[i] = NULL; + } + } + + bms_fb_client_index = 0; + +} + +module_init(bms_fb_i2c_init); +module_exit(bms_fb_i2c_exit); + + +MODULE_DESCRIPTION("mitac_ly1200_32x_fb_i2c driver"); +MODULE_AUTHOR("Eddy Weng "); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fb_module_i2c.c b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fb_module_i2c.c new file mode 100644 index 000000000000..174dba197217 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fb_module_i2c.c @@ -0,0 +1,138 @@ +#include +#include +#include "bms_i2c.h" + +#define BMS_FB_MODULE_I2C_CLIENT_NUM 6 + +static struct i2c_client *bms_fb_module_clients[BMS_FB_MODULE_I2C_CLIENT_NUM] = {NULL}; +static int bms_fb_module_client_index = 0; + +static int __init __find_i2c_adap(struct device *dev, void *data) +{ + const char *name = data; + static const char *prefix = "i2c-"; + struct i2c_adapter *adapter; + + if (strncmp(dev_name(dev), prefix, strlen(prefix)) != 0) + { + return 0; + } + adapter = to_i2c_adapter(dev); + + return (strncmp(adapter->name, name, strlen(name)) == 0); +} + +static int __init find_i2c_adapter_num(enum i2c_adapter_type type) +{ + struct device *dev = NULL; + struct i2c_adapter *adapter; + const char *name = bms_i2c_adapter_names[type]; + + /* find the adapter by name */ + dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, + __find_i2c_adap); + if (!dev) { + pr_err("%s: i2c adapter %s not found on system.\n", + __func__, name); + return -ENODEV; + } + adapter = to_i2c_adapter(dev); + + return adapter->nr; +} + +static int __init find_i2c_mux_adapter_num(int parent_num, int num) +{ + struct device *dev = NULL; + struct i2c_adapter *adapter; + char name[48]; + + snprintf(name, sizeof(name), "i2c-%d-mux (chan_id %d)", + parent_num, num); + /* find the adapter by name */ + dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, + __find_i2c_adap); + if (!dev) { + pr_err("%s: i2c adapter %s not found on system.\n", + __func__, name); + return -ENODEV; + } + adapter = to_i2c_adapter(dev); + + return adapter->nr; +} + + +static __init struct i2c_client *bms_fb_module_setup_eeprom_24c02( + struct i2c_adapter *adap, int addr) +{ + struct i2c_board_info info_spd = { + I2C_BOARD_INFO("24c02", addr), + }; + + return i2c_new_device(adap, &info_spd); +} + +static int __init bms_fb_module_setup_devices(void) +{ + struct i2c_adapter *adap; + int adap_num; + int parent_num; + + parent_num = find_i2c_adapter_num(I2C_ADAPTER_ISMT); + if (parent_num < 0) + return parent_num; + + adap_num = find_i2c_mux_adapter_num(parent_num, I2C_STAGE1_MUX_CHAN1); + if (adap_num < 0) + return adap_num; + + adap = i2c_get_adapter(adap_num); + if (!adap) { + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + goto exit; + } + + bms_fb_module_clients[bms_fb_module_client_index++] = bms_fb_module_setup_eeprom_24c02(adap, 0x50); + bms_fb_module_clients[bms_fb_module_client_index++] = bms_fb_module_setup_eeprom_24c02(adap, 0x51); + bms_fb_module_clients[bms_fb_module_client_index++] = bms_fb_module_setup_eeprom_24c02(adap, 0x52); + bms_fb_module_clients[bms_fb_module_client_index++] = bms_fb_module_setup_eeprom_24c02(adap, 0x53); + bms_fb_module_clients[bms_fb_module_client_index++] = bms_fb_module_setup_eeprom_24c02(adap, 0x54); + bms_fb_module_clients[bms_fb_module_client_index++] = bms_fb_module_setup_eeprom_24c02(adap, 0x55); + +exit: + return 0; +} + +static int __init bms_fb_module_i2c_init(void) +{ + /* Initial bms_sb_slients array. */ + memset(bms_fb_module_clients, 0x0, BMS_FB_MODULE_I2C_CLIENT_NUM); + + bms_fb_module_setup_devices(); + + return 0; +} + +static void __exit bms_fb_module_i2c_exit(void){ + int i; + + for (i=(bms_fb_module_client_index-1); i>=0; i--) { + if (bms_fb_module_clients[i]) { + i2c_unregister_device(bms_fb_module_clients[i]); + bms_fb_module_clients[i] = NULL; + } + } + + bms_fb_module_client_index = 0; + +} + +module_init(bms_fb_module_i2c_init); +module_exit(bms_fb_module_i2c_exit); + + +MODULE_DESCRIPTION("mitac_ly1200_32x_fb_module_i2c driver"); +MODULE_AUTHOR("Eddy Weng "); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fse000.c b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fse000.c new file mode 100644 index 000000000000..362821706857 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_fse000.c @@ -0,0 +1,1787 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pmbus.h" +#include + +/* + * Number of additional attribute pointers to allocate + * with each call to krealloc + */ +#define PMBUS_ATTR_ALLOC_SIZE 32 + +/* + * Index into status register array, per status register group + */ +#define PB_STATUS_BASE 0 +#define PB_STATUS_VOUT_BASE (PB_STATUS_BASE + PMBUS_PAGES) +#define PB_STATUS_IOUT_BASE (PB_STATUS_VOUT_BASE + PMBUS_PAGES) +#define PB_STATUS_FAN_BASE (PB_STATUS_IOUT_BASE + PMBUS_PAGES) +#define PB_STATUS_FAN34_BASE (PB_STATUS_FAN_BASE + PMBUS_PAGES) +#define PB_STATUS_TEMP_BASE (PB_STATUS_FAN34_BASE + PMBUS_PAGES) +#define PB_STATUS_INPUT_BASE (PB_STATUS_TEMP_BASE + PMBUS_PAGES) +#define PB_STATUS_VMON_BASE (PB_STATUS_INPUT_BASE + 1) + +#define PB_NUM_STATUS_REG (PB_STATUS_VMON_BASE + 1) + +#define PMBUS_NAME_SIZE 24 +#define PMBUS_BLOCK_READ_SIZE 32 + +struct pmbus_sensor { + struct pmbus_sensor *next; + char name[PMBUS_NAME_SIZE]; /* sysfs sensor name */ + struct device_attribute attribute; + u8 page; /* page number */ + u16 reg; /* register */ + enum pmbus_sensor_classes class; /* sensor class */ + bool update; /* runtime sensor update needed */ + int data; /* Sensor data. + Negative if there was a read error */ +}; +#define to_pmbus_sensor(_attr) \ + container_of(_attr, struct pmbus_sensor, attribute) + +struct pmbus_st { + char name[PMBUS_NAME_SIZE]; /* sysfs boolean name */ + struct sensor_device_attribute attribute; + u16 base; +}; +#define to_pmbus_status(_attr) \ + container_of(_attr, struct pmbus_st, attribute) + +struct pmbus_mfr { + struct pmbus_mfr *next; + char name[PMBUS_NAME_SIZE]; /* sysfs sensor name */ + struct device_attribute attribute; + u8 page; /* page number */ + u16 reg; /* register */ + int data; /* Sensor data. + Negative if there was a read error */ + char data_buf[PMBUS_BLOCK_READ_SIZE]; +}; +#define to_pmbus_mfr(_attr) \ + container_of(_attr, struct pmbus_mfr, attribute) + +struct pmbus_boolean { + char name[PMBUS_NAME_SIZE]; /* sysfs boolean name */ + struct sensor_device_attribute attribute; + struct pmbus_sensor *s1; + struct pmbus_sensor *s2; +}; +#define to_pmbus_boolean(_attr) \ + container_of(_attr, struct pmbus_boolean, attribute) + +struct pmbus_label { + char name[PMBUS_NAME_SIZE]; /* sysfs label name */ + struct device_attribute attribute; + char label[PMBUS_NAME_SIZE]; /* label */ +}; +#define to_pmbus_label(_attr) \ + container_of(_attr, struct pmbus_label, attribute) + +struct pmbus_data { + struct device *dev; + struct device *hwmon_dev; + + u32 flags; /* from platform data */ + + int exponent[PMBUS_PAGES]; + /* linear mode: exponent for output voltages */ + + const struct pmbus_driver_info *info; + + int max_attributes; + int num_attributes; + struct attribute_group group; + const struct attribute_group *groups[2]; + + struct pmbus_sensor *sensors; + struct pmbus_mfr *mfr; + + struct mutex update_lock; + bool valid; + unsigned long last_updated; /* in jiffies */ + + /* + * A single status register covers multiple attributes, + * so we keep them all together. + */ + u8 status[PB_NUM_STATUS_REG]; + u8 status_register; + + u8 currpage; +}; + +void pmbus_clear_cache(struct i2c_client *client) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + + data->valid = false; +} + +int pmbus_set_page(struct i2c_client *client, u8 page) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + int rv = 0; + int newpage; + + if (page != data->currpage) { + rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE, page); + newpage = i2c_smbus_read_byte_data(client, PMBUS_PAGE); + if (newpage != page) + rv = -EIO; + else + data->currpage = page; + } + return rv; +} + +int pmbus_write_byte(struct i2c_client *client, int page, u8 value) +{ + int rv; + + if (page >= 0) { + rv = pmbus_set_page(client, page); + if (rv < 0) + return rv; + } + + return i2c_smbus_write_byte(client, value); +} + +/* + * _pmbus_write_byte() is similar to pmbus_write_byte(), but checks if + * a device specific mapping function exists and calls it if necessary. + */ +static int _pmbus_write_byte(struct i2c_client *client, int page, u8 value) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + const struct pmbus_driver_info *info = data->info; + int status; + + if (info->write_byte) { + status = info->write_byte(client, page, value); + if (status != -ENODATA) + return status; + } + return pmbus_write_byte(client, page, value); +} + +int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word) +{ + int rv; + + rv = pmbus_set_page(client, page); + if (rv < 0) + return rv; + + return i2c_smbus_write_word_data(client, reg, word); +} + +/* + * _pmbus_write_word_data() is similar to pmbus_write_word_data(), but checks if + * a device specific mapping function exists and calls it if necessary. + */ +static int _pmbus_write_word_data(struct i2c_client *client, int page, int reg, + u16 word) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + const struct pmbus_driver_info *info = data->info; + int status; + + if (info->write_word_data) { + status = info->write_word_data(client, page, reg, word); + if (status != -ENODATA) + return status; + } + if (reg >= PMBUS_VIRT_BASE) + return -ENXIO; + return pmbus_write_word_data(client, page, reg, word); +} + +int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 reg) +{ + int rv; + + rv = pmbus_set_page(client, page); + if (rv < 0) + return rv; + + return i2c_smbus_read_word_data(client, reg); +} + +int pmbus_read_block_data(struct i2c_client *client, u8 reg, u8* value) +{ + return i2c_smbus_read_block_data(client, reg, value); +} + +static int _pmbus_read_block_data(struct i2c_client *client, int page, int reg, u8* value) +{ + int rv; + + rv = pmbus_set_page(client, page); + if (rv < 0) + return rv; + return pmbus_read_block_data(client, reg, value); +} + +/* + * _pmbus_read_word_data() is similar to pmbus_read_word_data(), but checks if + * a device specific mapping function exists and calls it if necessary. + */ +static int _pmbus_read_word_data(struct i2c_client *client, int page, int reg) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + const struct pmbus_driver_info *info = data->info; + int status; + + if (info->read_word_data) { + status = info->read_word_data(client, page, reg); + if (status != -ENODATA) + return status; + } + if (reg >= PMBUS_VIRT_BASE) + return -ENXIO; + return pmbus_read_word_data(client, page, reg); +} + +int pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg) +{ + int rv; + + if (page >= 0) { + rv = pmbus_set_page(client, page); + if (rv < 0) + return rv; + } + + return i2c_smbus_read_byte_data(client, reg); +} + +/* + * _pmbus_read_byte_data() is similar to pmbus_read_byte_data(), but checks if + * a device specific mapping function exists and calls it if necessary. + */ +static int _pmbus_read_byte_data(struct i2c_client *client, int page, int reg) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + const struct pmbus_driver_info *info = data->info; + int status; + + if (info->read_byte_data) { + status = info->read_byte_data(client, page, reg); + if (status != -ENODATA) + return status; + } + return pmbus_read_byte_data(client, page, reg); +} + +static void pmbus_clear_fault_page(struct i2c_client *client, int page) +{ + _pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS); +} + +void pmbus_clear_faults(struct i2c_client *client) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + int i; + + for (i = 0; i < data->info->pages; i++) + pmbus_clear_fault_page(client, i); +} + +static int pmbus_check_status_cml(struct i2c_client *client) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + int status, status2; + + status = _pmbus_read_byte_data(client, -1, data->status_register); + if (status < 0 || (status & PB_STATUS_CML)) { + status2 = _pmbus_read_byte_data(client, -1, PMBUS_STATUS_CML); + if (status2 < 0 || (status2 & PB_CML_FAULT_INVALID_COMMAND)) + return -EIO; + } + return 0; +} + +static bool pmbus_check_register(struct i2c_client *client, + int (*func)(struct i2c_client *client, + int page, int reg), + int page, int reg) +{ + int rv; + struct pmbus_data *data = i2c_get_clientdata(client); + + rv = func(client, page, reg); + if (rv >= 0 && !(data->flags & PMBUS_SKIP_STATUS_CHECK)) + rv = pmbus_check_status_cml(client); + pmbus_clear_fault_page(client, -1); + return rv >= 0; +} + +bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg) +{ + return pmbus_check_register(client, _pmbus_read_byte_data, page, reg); +} + +bool pmbus_check_word_register(struct i2c_client *client, int page, int reg) +{ + return pmbus_check_register(client, _pmbus_read_word_data, page, reg); +} + +const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client *client) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + + return data->info; +} + +static struct _pmbus_status { + u32 func; + u16 base; + u16 reg; +} pmbus_status[] = { + { PMBUS_HAVE_STATUS_VOUT, PB_STATUS_VOUT_BASE, PMBUS_STATUS_VOUT }, + { PMBUS_HAVE_STATUS_IOUT, PB_STATUS_IOUT_BASE, PMBUS_STATUS_IOUT }, + { PMBUS_HAVE_STATUS_TEMP, PB_STATUS_TEMP_BASE, + PMBUS_STATUS_TEMPERATURE }, + { PMBUS_HAVE_STATUS_FAN12, PB_STATUS_FAN_BASE, PMBUS_STATUS_FAN_12 }, + { PMBUS_HAVE_STATUS_FAN34, PB_STATUS_FAN34_BASE, PMBUS_STATUS_FAN_34 }, +}; + +static struct _pmbus_status_reg { + char name[PMBUS_NAME_SIZE]; + u16 base; + u8 offset; +} pmbus_status_reg[] = { + { "vout_ov_fault", PB_STATUS_VOUT_BASE, PB_VOLTAGE_UV_FAULT}, + { "vout_uv_fault", PB_STATUS_VOUT_BASE, PB_VOLTAGE_OV_FAULT}, + { "ot_fault", PB_STATUS_TEMP_BASE, PB_TEMP_OT_FAULT}, + { "ot_warning", PB_STATUS_TEMP_BASE, PB_TEMP_OT_WARNING}, + { "vin_uv_warning", PB_STATUS_INPUT_BASE, PB_VOLTAGE_UV_WARNING}, + { "vin_uv_fault", PB_STATUS_INPUT_BASE, PB_VOLTAGE_UV_FAULT}, +}; + +static struct _pmbus_mfr_reg { + char name[PMBUS_NAME_SIZE]; + u16 reg; +} pmbus_mfr_reg[] = { + { "mfr_id", PMBUS_MFR_ID}, + { "mfr_model", PMBUS_MFR_MODEL}, + { "mfr_revision", PMBUS_MFR_REVISION}, + { "mfr_location", PMBUS_MFR_LOCATION}, + { "mfr_date", PMBUS_MFR_DATE}, + { "mfr_serial", PMBUS_MFR_SERIAL}, +}; + +static struct pmbus_data *pmbus_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev->parent); + struct pmbus_data *data = i2c_get_clientdata(client); + const struct pmbus_driver_info *info = data->info; + struct pmbus_sensor *sensor; + struct pmbus_mfr *mfr; + + mutex_lock(&data->update_lock); + if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { + int i, j; + + for (i = 0; i < info->pages; i++) { + data->status[PB_STATUS_BASE + i] + = _pmbus_read_byte_data(client, i, + data->status_register); + for (j = 0; j < ARRAY_SIZE(pmbus_status); j++) { + struct _pmbus_status *s = &pmbus_status[j]; + + if (!(info->func[i] & s->func)) + continue; + data->status[s->base + i] + = _pmbus_read_byte_data(client, i, + s->reg); + } + } + + if (info->func[0] & PMBUS_HAVE_STATUS_INPUT) + data->status[PB_STATUS_INPUT_BASE] + = _pmbus_read_byte_data(client, 0, + PMBUS_STATUS_INPUT); + + if (info->func[0] & PMBUS_HAVE_STATUS_VMON) + data->status[PB_STATUS_VMON_BASE] + = _pmbus_read_byte_data(client, 0, + PMBUS_VIRT_STATUS_VMON); + + for (sensor = data->sensors; sensor; sensor = sensor->next) { + if (!data->valid || sensor->update) + sensor->data + = _pmbus_read_word_data(client, + sensor->page, + sensor->reg); + } + + /* read mfg data */ + for (mfr = data->mfr; mfr; mfr = mfr->next) { + mfr->data = _pmbus_read_block_data(client, mfr->page, mfr->reg, mfr->data_buf); + } + + pmbus_clear_faults(client); + data->last_updated = jiffies; + data->valid = 1; + } + mutex_unlock(&data->update_lock); + return data; +} + +/* + * Convert linear sensor values to milli- or micro-units + * depending on sensor type. + */ +static long pmbus_reg2data_linear(struct pmbus_data *data, + struct pmbus_sensor *sensor) +{ + s16 exponent; + s32 mantissa; + long val; + + if (sensor->class == PSC_VOLTAGE_OUT) { /* LINEAR16 */ + exponent = data->exponent[sensor->page]; + mantissa = (u16) sensor->data; + } else { /* LINEAR11 */ + exponent = ((s16)sensor->data) >> 11; + mantissa = ((s16)((sensor->data & 0x7ff) << 5)) >> 5; + } + + val = mantissa; + + /* scale result to milli-units for all sensors except fans */ + if (sensor->class != PSC_FAN) + val = val * 1000L; + + /* scale result to micro-units for power sensors */ + if (sensor->class == PSC_POWER) + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val; +} + +/* + * Convert direct sensor values to milli- or micro-units + * depending on sensor type. + */ +static long pmbus_reg2data_direct(struct pmbus_data *data, + struct pmbus_sensor *sensor) +{ + long val = (s16) sensor->data; + long m, b, R; + + m = data->info->m[sensor->class]; + b = data->info->b[sensor->class]; + R = data->info->R[sensor->class]; + + if (m == 0) + return 0; + + /* X = 1/m * (Y * 10^-R - b) */ + R = -R; + /* scale result to milli-units for everything but fans */ + if (sensor->class != PSC_FAN) { + R += 3; + b *= 1000; + } + + /* scale result to micro-units for power sensors */ + if (sensor->class == PSC_POWER) { + R += 3; + b *= 1000; + } + + while (R > 0) { + val *= 10; + R--; + } + while (R < 0) { + val = DIV_ROUND_CLOSEST(val, 10); + R++; + } + + return (val - b) / m; +} + +/* + * Convert VID sensor values to milli- or micro-units + * depending on sensor type. + * We currently only support VR11. + */ +static long pmbus_reg2data_vid(struct pmbus_data *data, + struct pmbus_sensor *sensor) +{ + long val = sensor->data; + + if (val < 0x02 || val > 0xb2) + return 0; + return DIV_ROUND_CLOSEST(160000 - (val - 2) * 625, 100); +} + +static long pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor) +{ + long val; + + switch (data->info->format[sensor->class]) { + case direct: + val = pmbus_reg2data_direct(data, sensor); + break; + case vid: + val = pmbus_reg2data_vid(data, sensor); + break; + case linear: + default: + val = pmbus_reg2data_linear(data, sensor); + break; + } + return val; +} + +#define MAX_MANTISSA (1023 * 1000) +#define MIN_MANTISSA (511 * 1000) + +static u16 pmbus_data2reg_linear(struct pmbus_data *data, + struct pmbus_sensor *sensor, long val) +{ + s16 exponent = 0, mantissa; + bool negative = false; + + /* simple case */ + if (val == 0) + return 0; + + if (sensor->class == PSC_VOLTAGE_OUT) { + /* LINEAR16 does not support negative voltages */ + if (val < 0) + return 0; + + /* + * For a static exponents, we don't have a choice + * but to adjust the value to it. + */ + if (data->exponent[sensor->page] < 0) + val <<= -data->exponent[sensor->page]; + else + val >>= data->exponent[sensor->page]; + val = DIV_ROUND_CLOSEST(val, 1000); + return val & 0xffff; + } + + if (val < 0) { + negative = true; + val = -val; + } + + /* Power is in uW. Convert to mW before converting. */ + if (sensor->class == PSC_POWER) + val = DIV_ROUND_CLOSEST(val, 1000L); + + /* + * For simplicity, convert fan data to milli-units + * before calculating the exponent. + */ + if (sensor->class == PSC_FAN) + val = val * 1000; + + /* Reduce large mantissa until it fits into 10 bit */ + while (val >= MAX_MANTISSA && exponent < 15) { + exponent++; + val >>= 1; + } + /* Increase small mantissa to improve precision */ + while (val < MIN_MANTISSA && exponent > -15) { + exponent--; + val <<= 1; + } + + /* Convert mantissa from milli-units to units */ + mantissa = DIV_ROUND_CLOSEST(val, 1000); + + /* Ensure that resulting number is within range */ + if (mantissa > 0x3ff) + mantissa = 0x3ff; + + /* restore sign */ + if (negative) + mantissa = -mantissa; + + /* Convert to 5 bit exponent, 11 bit mantissa */ + return (mantissa & 0x7ff) | ((exponent << 11) & 0xf800); +} + +static u16 pmbus_data2reg_direct(struct pmbus_data *data, + struct pmbus_sensor *sensor, long val) +{ + long m, b, R; + + m = data->info->m[sensor->class]; + b = data->info->b[sensor->class]; + R = data->info->R[sensor->class]; + + /* Power is in uW. Adjust R and b. */ + if (sensor->class == PSC_POWER) { + R -= 3; + b *= 1000; + } + + /* Calculate Y = (m * X + b) * 10^R */ + if (sensor->class != PSC_FAN) { + R -= 3; /* Adjust R and b for data in milli-units */ + b *= 1000; + } + val = val * m + b; + + while (R > 0) { + val *= 10; + R--; + } + while (R < 0) { + val = DIV_ROUND_CLOSEST(val, 10); + R++; + } + + return val; +} + +static u16 pmbus_data2reg_vid(struct pmbus_data *data, + struct pmbus_sensor *sensor, long val) +{ + val = clamp_val(val, 500, 1600); + + return 2 + DIV_ROUND_CLOSEST((1600 - val) * 100, 625); +} + +static u16 pmbus_data2reg(struct pmbus_data *data, + struct pmbus_sensor *sensor, long val) +{ + u16 regval; + + switch (data->info->format[sensor->class]) { + case direct: + regval = pmbus_data2reg_direct(data, sensor, val); + break; + case vid: + regval = pmbus_data2reg_vid(data, sensor, val); + break; + case linear: + default: + regval = pmbus_data2reg_linear(data, sensor, val); + break; + } + return regval; +} + +/* + * Return boolean calculated from converted data. + * defines a status register index and mask. + * The mask is in the lower 8 bits, the register index is in bits 8..23. + * + * The associated pmbus_boolean structure contains optional pointers to two + * sensor attributes. If specified, those attributes are compared against each + * other to determine if a limit has been exceeded. + * + * If the sensor attribute pointers are NULL, the function returns true if + * (status[reg] & mask) is true. + * + * If sensor attribute pointers are provided, a comparison against a specified + * limit has to be performed to determine the boolean result. + * In this case, the function returns true if v1 >= v2 (where v1 and v2 are + * sensor values referenced by sensor attribute pointers s1 and s2). + * + * To determine if an object exceeds upper limits, specify = . + * To determine if an object exceeds lower limits, specify = . + * + * If a negative value is stored in any of the referenced registers, this value + * reflects an error code which will be returned. + */ +static int pmbus_get_boolean(struct pmbus_data *data, struct pmbus_boolean *b, + int index) +{ + struct pmbus_sensor *s1 = b->s1; + struct pmbus_sensor *s2 = b->s2; + u16 reg = (index >> 8) & 0xffff; + u8 mask = index & 0xff; + int ret, status; + u8 regval; + + status = data->status[reg]; + if (status < 0) + return status; + + regval = status & mask; + if (!s1 && !s2) { + ret = !!regval; + } else if (!s1 || !s2) { + WARN(1, "Bad boolean descriptor %p: s1=%p, s2=%p\n", b, s1, s2); + return 0; + } else { + long v1, v2; + + if (s1->data < 0) + return s1->data; + if (s2->data < 0) + return s2->data; + + v1 = pmbus_reg2data(data, s1); + v2 = pmbus_reg2data(data, s2); + ret = !!(regval && v1 >= v2); + } + return ret; +} + +static ssize_t pmbus_show_boolean(struct device *dev, + struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct pmbus_boolean *boolean = to_pmbus_boolean(attr); + struct pmbus_data *data = pmbus_update_device(dev); + int val; + + val = pmbus_get_boolean(data, boolean, attr->index); + if (val < 0) + return val; + return snprintf(buf, PAGE_SIZE, "%d\n", val); +} + +static ssize_t pmbus_show_sensor(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct pmbus_data *data = pmbus_update_device(dev); + struct pmbus_sensor *sensor = to_pmbus_sensor(devattr); + + if (sensor->data < 0) + return sensor->data; + + return snprintf(buf, PAGE_SIZE, "%ld\n", pmbus_reg2data(data, sensor)); +} + +static ssize_t pmbus_show_status(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct pmbus_st *status = to_pmbus_status(attr); + struct pmbus_data *data = pmbus_update_device(dev); + + return snprintf(buf, PAGE_SIZE, "%u\n", !!(data->status[status->base] & attr->index)); +} + +static ssize_t pmbus_show_mfr(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct pmbus_mfr *mfr; + + pmbus_update_device(dev); + mfr = to_pmbus_mfr(devattr); + + if (mfr->data < 0) + return mfr->data; + +#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,16,49) + /* mfr->data[0] is data length, we don't want show data length when show command */ + return snprintf(buf, PAGE_SIZE, "%s\n", &mfr->data_buf[1]); +#else + return snprintf(buf, PAGE_SIZE, "%s\n", &mfr->data_buf); +#endif +} + +static ssize_t pmbus_set_sensor(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev->parent); + struct pmbus_data *data = i2c_get_clientdata(client); + struct pmbus_sensor *sensor = to_pmbus_sensor(devattr); + ssize_t rv = count; + long val = 0; + int ret; + u16 regval; + + if (kstrtol(buf, 10, &val) < 0) + return -EINVAL; + + mutex_lock(&data->update_lock); + regval = pmbus_data2reg(data, sensor, val); + ret = _pmbus_write_word_data(client, sensor->page, sensor->reg, regval); + if (ret < 0) + rv = ret; + else + sensor->data = regval; + mutex_unlock(&data->update_lock); + return rv; +} + +static ssize_t pmbus_show_label(struct device *dev, + struct device_attribute *da, char *buf) +{ + struct pmbus_label *label = to_pmbus_label(da); + + return snprintf(buf, PAGE_SIZE, "%s\n", label->label); +} + +static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr) +{ + if (data->num_attributes >= data->max_attributes - 1) { + int new_max_attrs = data->max_attributes + PMBUS_ATTR_ALLOC_SIZE; + void *new_attrs = krealloc(data->group.attrs, + new_max_attrs * sizeof(void *), + GFP_KERNEL); + if (!new_attrs) + return -ENOMEM; + data->group.attrs = new_attrs; + data->max_attributes = new_max_attrs; + } + + data->group.attrs[data->num_attributes++] = attr; + data->group.attrs[data->num_attributes] = NULL; + return 0; +} + +static void pmbus_dev_attr_init(struct device_attribute *dev_attr, + const char *name, + umode_t mode, + ssize_t (*show)(struct device *dev, + struct device_attribute *attr, + char *buf), + ssize_t (*store)(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count)) +{ + sysfs_attr_init(&dev_attr->attr); + dev_attr->attr.name = name; + dev_attr->attr.mode = mode; + dev_attr->show = show; + dev_attr->store = store; +} + +static void pmbus_attr_init(struct sensor_device_attribute *a, + const char *name, + umode_t mode, + ssize_t (*show)(struct device *dev, + struct device_attribute *attr, + char *buf), + ssize_t (*store)(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count), + int idx) +{ + pmbus_dev_attr_init(&a->dev_attr, name, mode, show, store); + a->index = idx; +} + +static int pmbus_add_boolean(struct pmbus_data *data, + const char *name, const char *type, int seq, + struct pmbus_sensor *s1, + struct pmbus_sensor *s2, + u16 reg, u8 mask) +{ + struct pmbus_boolean *boolean; + struct sensor_device_attribute *a; + + boolean = devm_kzalloc(data->dev, sizeof(*boolean), GFP_KERNEL); + if (!boolean) + return -ENOMEM; + + a = &boolean->attribute; + + snprintf(boolean->name, sizeof(boolean->name), "%s%d_%s", + name, seq, type); + boolean->s1 = s1; + boolean->s2 = s2; + pmbus_attr_init(a, boolean->name, S_IRUGO, pmbus_show_boolean, NULL, + (reg << 8) | mask); + + return pmbus_add_attribute(data, &a->dev_attr.attr); +} + +static struct pmbus_sensor *pmbus_add_sensor(struct pmbus_data *data, + const char *name, const char *type, + int seq, int page, int reg, + enum pmbus_sensor_classes class, + bool update, bool readonly) +{ + struct pmbus_sensor *sensor; + struct device_attribute *a; + + sensor = devm_kzalloc(data->dev, sizeof(*sensor), GFP_KERNEL); + if (!sensor) + return NULL; + a = &sensor->attribute; + + snprintf(sensor->name, sizeof(sensor->name), "%s%d_%s", + name, seq, type); + sensor->page = page; + sensor->reg = reg; + sensor->class = class; + sensor->update = update; + pmbus_dev_attr_init(a, sensor->name, + readonly ? S_IRUGO : S_IRUGO | S_IWUSR, + pmbus_show_sensor, pmbus_set_sensor); + + if (pmbus_add_attribute(data, &a->attr)) + return NULL; + + sensor->next = data->sensors; + data->sensors = sensor; + + return sensor; +} + +static int pmbus_add_status(struct pmbus_data *data, + const char *name, u16 base, + u8 offset) +{ + struct pmbus_st *status; + struct sensor_device_attribute *a; + + status = devm_kzalloc(data->dev, sizeof(*status), GFP_KERNEL); + if (!status) + return -ENOMEM; + + a = &status->attribute; + + snprintf(status->name, sizeof(status->name), "%s", name); + + status->base = base; + + pmbus_attr_init(a, status->name, S_IRUGO, + pmbus_show_status, NULL, offset); + + return pmbus_add_attribute(data, &a->dev_attr.attr); +} + +static struct pmbus_mfr *pmbus_add_mfr(struct pmbus_data *data, + const char *name, + int page, int reg) +{ + struct pmbus_mfr *mfr; + struct device_attribute *a; + + mfr = devm_kzalloc(data->dev, sizeof(*mfr), GFP_KERNEL); + if (!mfr) + return NULL; + a = &mfr->attribute; + + snprintf(mfr->name, sizeof(mfr->name), "%s", name); + mfr->page = page; + mfr->reg = reg; + pmbus_dev_attr_init(a, mfr->name, S_IRUGO, + pmbus_show_mfr, NULL); + + if (pmbus_add_attribute(data, &a->attr)) + return NULL; + + mfr->next = data->mfr; + data->mfr = mfr; + + return mfr; +} + +static int pmbus_add_label(struct pmbus_data *data, + const char *name, int seq, + const char *lstring, int index) +{ + struct pmbus_label *label; + struct device_attribute *a; + + label = devm_kzalloc(data->dev, sizeof(*label), GFP_KERNEL); + if (!label) + return -ENOMEM; + + a = &label->attribute; + + snprintf(label->name, sizeof(label->name), "%s%d_label", name, seq); + if (!index) + strncpy(label->label, lstring, sizeof(label->label) - 1); + else + snprintf(label->label, sizeof(label->label), "%s%d", lstring, + index); + + pmbus_dev_attr_init(a, label->name, S_IRUGO, pmbus_show_label, NULL); + return pmbus_add_attribute(data, &a->attr); +} + +/* + * Search for attributes. Allocate sensors, booleans, and labels as needed. + */ + +/* + * The pmbus_limit_attr structure describes a single limit attribute + * and its associated alarm attribute. + */ +struct pmbus_limit_attr { + u16 reg; /* Limit register */ + u16 sbit; /* Alarm attribute status bit */ + bool update; /* True if register needs updates */ + bool low; /* True if low limit; for limits with compare + functions only */ + const char *attr; /* Attribute name */ + const char *alarm; /* Alarm attribute name */ +}; + +/* + * The pmbus_sensor_attr structure describes one sensor attribute. This + * description includes a reference to the associated limit attributes. + */ +struct pmbus_sensor_attr { + u16 reg; /* sensor register */ + u8 gbit; /* generic status bit */ + u8 nlimit; /* # of limit registers */ + enum pmbus_sensor_classes class;/* sensor class */ + const char *label; /* sensor label */ + bool paged; /* true if paged sensor */ + bool update; /* true if update needed */ + bool compare; /* true if compare function needed */ + u32 func; /* sensor mask */ + u32 sfunc; /* sensor status mask */ + int sbase; /* status base register */ + const struct pmbus_limit_attr *limit;/* limit registers */ +}; + +/* + * Add a set of limit attributes and, if supported, the associated + * alarm attributes. + * returns 0 if no alarm register found, 1 if an alarm register was found, + * < 0 on errors. + */ +static int pmbus_add_limit_attrs(struct i2c_client *client, + struct pmbus_data *data, + const struct pmbus_driver_info *info, + const char *name, int index, int page, + struct pmbus_sensor *base, + const struct pmbus_sensor_attr *attr) +{ + const struct pmbus_limit_attr *l = attr->limit; + int nlimit = attr->nlimit; + int have_alarm = 0; + int i, ret; + struct pmbus_sensor *curr; + + for (i = 0; i < nlimit; i++) { + if (pmbus_check_word_register(client, page, l->reg)) { + curr = pmbus_add_sensor(data, name, l->attr, index, + page, l->reg, attr->class, + attr->update || l->update, + false); + if (!curr) + return -ENOMEM; + if (l->sbit && (info->func[page] & attr->sfunc)) { + ret = pmbus_add_boolean(data, name, + l->alarm, index, + attr->compare ? l->low ? curr : base + : NULL, + attr->compare ? l->low ? base : curr + : NULL, + attr->sbase + page, l->sbit); + if (ret) + return ret; + have_alarm = 1; + } + } + l++; + } + return have_alarm; +} + +static int pmbus_add_sensor_attrs_one(struct i2c_client *client, + struct pmbus_data *data, + const struct pmbus_driver_info *info, + const char *name, + int index, int page, + const struct pmbus_sensor_attr *attr) +{ + struct pmbus_sensor *base; + int ret; + + if (attr->label) { + ret = pmbus_add_label(data, name, index, attr->label, + attr->paged ? page + 1 : 0); + if (ret) + return ret; + } + base = pmbus_add_sensor(data, name, "input", index, page, attr->reg, + attr->class, true, true); + if (!base) + return -ENOMEM; + if (attr->sfunc) { + ret = pmbus_add_limit_attrs(client, data, info, name, + index, page, base, attr); + if (ret < 0) + return ret; + /* + * Add generic alarm attribute only if there are no individual + * alarm attributes, if there is a global alarm bit, and if + * the generic status register for this page is accessible. + */ + if (!ret && attr->gbit && + pmbus_check_byte_register(client, page, + data->status_register)) { + ret = pmbus_add_boolean(data, name, "alarm", index, + NULL, NULL, + PB_STATUS_BASE + page, + attr->gbit); + if (ret) + return ret; + } + } + return 0; +} + +static int pmbus_add_sensor_attrs(struct i2c_client *client, + struct pmbus_data *data, + const char *name, + const struct pmbus_sensor_attr *attrs, + int nattrs) +{ + const struct pmbus_driver_info *info = data->info; + int index, i; + int ret; + + index = 1; + for (i = 0; i < nattrs; i++) { + int page, pages; + + pages = attrs->paged ? info->pages : 1; + for (page = 0; page < pages; page++) { + if (!(info->func[page] & attrs->func)) + continue; + ret = pmbus_add_sensor_attrs_one(client, data, info, + name, index, page, + attrs); + if (ret) + return ret; + index++; + } + attrs++; + } + return 0; +} + +static const struct pmbus_sensor_attr voltage_attributes[] = { + { + .reg = PMBUS_READ_VOUT, + .class = PSC_VOLTAGE_OUT, + .label = "vout", + .paged = true, + .func = PMBUS_HAVE_VOUT, + .sfunc = PMBUS_HAVE_STATUS_VOUT, + .sbase = PB_STATUS_VOUT_BASE, + .gbit = PB_STATUS_VOUT_OV, + } +}; + +static const struct pmbus_limit_attr iout_limit_attrs[] = { + { + .reg = PMBUS_IOUT_OC_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_IOUT_OC_WARNING, + }, { + .reg = PMBUS_IOUT_OC_FAULT_LIMIT, + .attr = "crit", + .alarm = "crit_alarm", + .sbit = PB_IOUT_OC_FAULT, + } +}; + +static const struct pmbus_sensor_attr current_attributes[] = { + { + .reg = PMBUS_READ_IIN, + .class = PSC_CURRENT_IN, + .label = "iin", + .func = PMBUS_HAVE_IIN, + .sfunc = PMBUS_HAVE_STATUS_INPUT, + .sbase = PB_STATUS_INPUT_BASE, + }, { + .reg = PMBUS_READ_IOUT, + .class = PSC_CURRENT_OUT, + .label = "iout", + .paged = true, + .func = PMBUS_HAVE_IOUT, + .sfunc = PMBUS_HAVE_STATUS_IOUT, + .sbase = PB_STATUS_IOUT_BASE, + .gbit = PB_STATUS_IOUT_OC, + .limit = iout_limit_attrs, + .nlimit = ARRAY_SIZE(iout_limit_attrs), + } +}; + +/* Temperature atributes */ +static const struct pmbus_limit_attr temp_limit_attrs[] = { + { + .reg = PMBUS_OT_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_TEMP_OT_WARNING, + } +}; + +static const struct pmbus_limit_attr temp_limit_attrs2[] = { + { + .reg = PMBUS_OT_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_TEMP_OT_WARNING, + } +}; + +static const struct pmbus_limit_attr temp_limit_attrs3[] = { + { + .reg = PMBUS_OT_WARN_LIMIT, + .attr = "max", + .alarm = "max_alarm", + .sbit = PB_TEMP_OT_WARNING, + } +}; + +static const struct pmbus_sensor_attr temp_attributes[] = { + { + .reg = PMBUS_READ_TEMPERATURE_1, + .class = PSC_TEMPERATURE, + .paged = true, + .update = true, + .compare = true, + .func = PMBUS_HAVE_TEMP, + .sfunc = PMBUS_HAVE_STATUS_TEMP, + .sbase = PB_STATUS_TEMP_BASE, + .gbit = PB_STATUS_TEMPERATURE, + .limit = temp_limit_attrs, + .nlimit = ARRAY_SIZE(temp_limit_attrs), + }, { + .reg = PMBUS_READ_TEMPERATURE_2, + .class = PSC_TEMPERATURE, + .paged = true, + .update = true, + .compare = true, + .func = PMBUS_HAVE_TEMP2, + .sfunc = PMBUS_HAVE_STATUS_TEMP, + .sbase = PB_STATUS_TEMP_BASE, + .gbit = PB_STATUS_TEMPERATURE, + .limit = temp_limit_attrs2, + .nlimit = ARRAY_SIZE(temp_limit_attrs2), + }, { + .reg = PMBUS_READ_TEMPERATURE_3, + .class = PSC_TEMPERATURE, + .paged = true, + .update = true, + .compare = true, + .func = PMBUS_HAVE_TEMP3, + .sfunc = PMBUS_HAVE_STATUS_TEMP, + .sbase = PB_STATUS_TEMP_BASE, + .gbit = PB_STATUS_TEMPERATURE, + .limit = temp_limit_attrs3, + .nlimit = ARRAY_SIZE(temp_limit_attrs3), + } +}; + +static const int pmbus_fan_registers[] = { + PMBUS_READ_FAN_SPEED_1, +}; + +static const int pmbus_fan_config_registers[] = { + PMBUS_FAN_CONFIG_12, +}; + +static const int pmbus_fan_status_registers[] = { + PMBUS_STATUS_FAN_12, +}; + +static const u32 pmbus_fan_flags[] = { + PMBUS_HAVE_FAN12, +}; + +static const u32 pmbus_fan_status_flags[] = { + PMBUS_HAVE_STATUS_FAN12, +}; + +/* Fans */ +static int pmbus_add_fan_attributes(struct i2c_client *client, + struct pmbus_data *data) +{ + const struct pmbus_driver_info *info = data->info; + int index = 1; + int page; + int ret; + + for (page = 0; page < info->pages; page++) { + int f; + + for (f = 0; f < ARRAY_SIZE(pmbus_fan_registers); f++) { + int regval; + + if (!(info->func[page] & pmbus_fan_flags[f])) + break; + + if (!pmbus_check_word_register(client, page, + pmbus_fan_registers[f])) + break; + + /* + * Skip fan if not installed. + * Each fan configuration register covers multiple fans, + * so we have to do some magic. + */ + regval = _pmbus_read_byte_data(client, page, + pmbus_fan_config_registers[f]); + if (regval < 0 || + (!(regval & (PB_FAN_1_INSTALLED >> ((f & 1) * 4))))) + continue; + + if (pmbus_add_sensor(data, "fan", "input", index, + page, pmbus_fan_registers[f], + PSC_FAN, true, true) == NULL) + return -ENOMEM; + + /* + * Each fan status register covers multiple fans, + * so we have to do some magic. + */ + if ((info->func[page] & pmbus_fan_status_flags[f]) && + pmbus_check_byte_register(client, + page, pmbus_fan_status_registers[f])) { + int base; + + if (f > 1) /* fan 3, 4 */ + base = PB_STATUS_FAN34_BASE + page; + else + base = PB_STATUS_FAN_BASE + page; + ret = pmbus_add_boolean(data, "fan", + "alarm", index, NULL, NULL, base, + PB_FAN_FAN1_WARNING >> (f & 1)); + if (ret) + return ret; + ret = pmbus_add_boolean(data, "fan", + "fault", index, NULL, NULL, base, + PB_FAN_FAN1_FAULT >> (f & 1)); + if (ret) + return ret; + } + index++; + } + } + return 0; +} + +/* mfr items */ +static int pmbus_add_mfr_attributes(struct i2c_client *client, + struct pmbus_data *data) +{ + int page = 0; + int i; + + for(i = 0; i < ARRAY_SIZE(pmbus_mfr_reg);i++){ + + if (pmbus_add_mfr(data, pmbus_mfr_reg[i].name, page, pmbus_mfr_reg[i].reg) == NULL){ + return -ENOMEM; + } + } + + return 0; +} + +/* status items */ +static int pmbus_add_status_attributes(struct i2c_client *client, + struct pmbus_data *data) +{ + int i; + + for(i = 0; i < ARRAY_SIZE(pmbus_status_reg);i++){ + if (pmbus_add_status(data, pmbus_status_reg[i].name, pmbus_status_reg[i].base, pmbus_status_reg[i].offset)){ + return -ENOMEM; + } + } + + return 0; +} + +static int pmbus_find_attributes(struct i2c_client *client, + struct pmbus_data *data) +{ + int ret; + + /* Voltage sensors */ + ret = pmbus_add_sensor_attrs(client, data, "in", voltage_attributes, + ARRAY_SIZE(voltage_attributes)); + if (ret) + return ret; + + /* Current sensors */ + ret = pmbus_add_sensor_attrs(client, data, "curr", current_attributes, + ARRAY_SIZE(current_attributes)); + if (ret) + return ret; + + /* Temperature sensors */ + ret = pmbus_add_sensor_attrs(client, data, "temp", temp_attributes, + ARRAY_SIZE(temp_attributes)); + if (ret) + return ret; + + /* Fans */ + ret = pmbus_add_fan_attributes(client, data); + if (ret) + return ret; + + /* mfr data */ + ret = pmbus_add_mfr_attributes(client, data); + if (ret) + return ret; + + /* status data */ + ret = pmbus_add_status_attributes(client, data); + return ret; +} + +/* + * Identify chip parameters. + * This function is called for all chips. + */ +static int pmbus_identify_common(struct i2c_client *client, + struct pmbus_data *data, int page) +{ + int vout_mode = -1; + + if (pmbus_check_byte_register(client, page, PMBUS_VOUT_MODE)) + vout_mode = _pmbus_read_byte_data(client, page, + PMBUS_VOUT_MODE); + if (vout_mode >= 0 && vout_mode != 0xff) { + /* + * Not all chips support the VOUT_MODE command, + * so a failure to read it is not an error. + */ + switch (vout_mode >> 5) { + case 0: /* linear mode */ + if (data->info->format[PSC_VOLTAGE_OUT] != linear) + return -ENODEV; + + data->exponent[page] = ((s8)(vout_mode << 3)) >> 3; + break; + case 1: /* VID mode */ + if (data->info->format[PSC_VOLTAGE_OUT] != vid) + return -ENODEV; + break; + case 2: /* direct mode */ + if (data->info->format[PSC_VOLTAGE_OUT] != direct) + return -ENODEV; + break; + default: + return -ENODEV; + } + } + + pmbus_clear_fault_page(client, page); + return 0; +} + +static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data, + struct pmbus_driver_info *info) +{ + struct device *dev = &client->dev; + int page, ret; + + /* + * Some PMBus chips don't support PMBUS_STATUS_BYTE, so try + * to use PMBUS_STATUS_WORD instead if that is the case. + * Bail out if both registers are not supported. + */ + data->status_register = PMBUS_STATUS_BYTE; + ret = i2c_smbus_read_byte_data(client, PMBUS_STATUS_BYTE); + if (ret < 0 || ret == 0xff) { + data->status_register = PMBUS_STATUS_WORD; + ret = i2c_smbus_read_word_data(client, PMBUS_STATUS_WORD); + if (ret < 0 || ret == 0xffff) { + dev_err(dev, "PMBus status register not found\n"); + return -ENODEV; + } + } + + pmbus_clear_faults(client); + + if (info->identify) { + ret = (*info->identify)(client, info); + if (ret < 0) { + dev_err(dev, "Chip identification failed\n"); + return ret; + } + } + + if (info->pages <= 0 || info->pages > PMBUS_PAGES) { + dev_err(dev, "Bad number of PMBus pages: %d\n", info->pages); + return -ENODEV; + } + + /* Current only using page 1 in BMS project */ + info->pages = 1; + + for (page = 0; page < info->pages; page++) { + ret = pmbus_identify_common(client, data, page); + if (ret < 0) { + dev_err(dev, "Failed to identify chip capabilities\n"); + return ret; + } + } + return 0; +} + +int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, + struct pmbus_driver_info *info) +{ + struct device *dev = &client->dev; + const struct pmbus_platform_data *pdata = dev_get_platdata(dev); + struct pmbus_data *data; + int ret; + + if (!info) + return -ENODEV; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_BYTE + | I2C_FUNC_SMBUS_BYTE_DATA + | I2C_FUNC_SMBUS_WORD_DATA)) + return -ENODEV; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->dev = dev; + + if (pdata) + data->flags = pdata->flags; + data->info = info; + + ret = pmbus_init_common(client, data, info); + if (ret < 0) + return ret; + + ret = pmbus_find_attributes(client, data); + if (ret) + goto out_kfree; + + /* + * If there are no attributes, something is wrong. + * Bail out instead of trying to register nothing. + */ + if (!data->num_attributes) { + dev_err(dev, "No attributes found\n"); + ret = -ENODEV; + goto out_kfree; + } + + data->groups[0] = &data->group; + data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name, + data, data->groups); + if (IS_ERR(data->hwmon_dev)) { + ret = PTR_ERR(data->hwmon_dev); + dev_err(dev, "Failed to register hwmon device\n"); + goto out_kfree; + } + return 0; + +out_kfree: + kfree(data->group.attrs); + return ret; +} + +int pmbus_do_remove(struct i2c_client *client) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + kfree(data->group.attrs); + return 0; +} + + +/* + * Find sensor groups and status registers on each page. + */ +static void pmbus_find_sensor_groups(struct i2c_client *client, + struct pmbus_driver_info *info) +{ + int page; + + /* Sensors detected on page 0 only */ + if (pmbus_check_word_register(client, 0, PMBUS_READ_VIN)) + info->func[0] |= PMBUS_HAVE_VIN; + if (pmbus_check_word_register(client, 0, PMBUS_READ_VCAP)) + info->func[0] |= PMBUS_HAVE_VCAP; + if (pmbus_check_word_register(client, 0, PMBUS_READ_IIN)) + info->func[0] |= PMBUS_HAVE_IIN; + if (pmbus_check_word_register(client, 0, PMBUS_READ_PIN)) + info->func[0] |= PMBUS_HAVE_PIN; + if (info->func[0] + && pmbus_check_byte_register(client, 0, PMBUS_STATUS_INPUT)) + info->func[0] |= PMBUS_HAVE_STATUS_INPUT; + if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_12) && + pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_1)) { + info->func[0] |= PMBUS_HAVE_FAN12; + if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_12)) + info->func[0] |= PMBUS_HAVE_STATUS_FAN12; + } + if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_34) && + pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_3)) { + info->func[0] |= PMBUS_HAVE_FAN34; + if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34)) + info->func[0] |= PMBUS_HAVE_STATUS_FAN34; + } + if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) + info->func[0] |= PMBUS_HAVE_TEMP; + if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2)) + info->func[0] |= PMBUS_HAVE_TEMP2; + if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3)) + info->func[0] |= PMBUS_HAVE_TEMP3; + if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 + | PMBUS_HAVE_TEMP3) + && pmbus_check_byte_register(client, 0, + PMBUS_STATUS_TEMPERATURE)) + info->func[0] |= PMBUS_HAVE_STATUS_TEMP; + + /* Sensors detected on all pages */ + for (page = 0; page < info->pages; page++) { + if (pmbus_check_word_register(client, page, PMBUS_READ_VOUT)) { + info->func[page] |= PMBUS_HAVE_VOUT; + if (pmbus_check_byte_register(client, page, + PMBUS_STATUS_VOUT)) + info->func[page] |= PMBUS_HAVE_STATUS_VOUT; + } + if (pmbus_check_word_register(client, page, PMBUS_READ_IOUT)) { + info->func[page] |= PMBUS_HAVE_IOUT; + if (pmbus_check_byte_register(client, 0, + PMBUS_STATUS_IOUT)) + info->func[page] |= PMBUS_HAVE_STATUS_IOUT; + } + if (pmbus_check_word_register(client, page, PMBUS_READ_POUT)) + info->func[page] |= PMBUS_HAVE_POUT; + } +} + +/* + * Identify chip parameters. + */ +static int pmbus_identify(struct i2c_client *client, + struct pmbus_driver_info *info) +{ + int ret = 0; + + if (!info->pages) { + /* + * Check if the PAGE command is supported. If it is, + * keep setting the page number until it fails or until the + * maximum number of pages has been reached. Assume that + * this is the number of pages supported by the chip. + */ + if (pmbus_check_byte_register(client, 0, PMBUS_PAGE)) { + int page; + + for (page = 1; page < PMBUS_PAGES; page++) { + if (pmbus_set_page(client, page) < 0) + break; + } + pmbus_set_page(client, 0); + info->pages = page; + } else { + info->pages = 1; + } + } + + if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) { + int vout_mode; + + vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE); + if (vout_mode >= 0 && vout_mode != 0xff) { + switch (vout_mode >> 5) { + case 0: + break; + case 1: + info->format[PSC_VOLTAGE_OUT] = vid; + break; + case 2: + info->format[PSC_VOLTAGE_OUT] = direct; + break; + default: + ret = -ENODEV; + goto abort; + } + } + } + + /* + * We should check if the COEFFICIENTS register is supported. + * If it is, and the chip is configured for direct mode, we can read + * the coefficients from the chip, one set per group of sensor + * registers. + * + * To do this, we will need access to a chip which actually supports the + * COEFFICIENTS command, since the command is too complex to implement + * without testing it. Until then, abort if a chip configured for direct + * mode was detected. + */ + if (info->format[PSC_VOLTAGE_OUT] == direct) { + ret = -ENODEV; + goto abort; + } + + /* Try to find sensor groups */ + pmbus_find_sensor_groups(client, info); +abort: + return ret; +} + +static int pmbus_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct pmbus_driver_info *info; + + info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), + GFP_KERNEL); + if (!info) + return -ENOMEM; + + info->pages = id->driver_data; + info->identify = pmbus_identify; + + return pmbus_do_probe(client, id, info); +} + +/* + * Use driver_data to set the number of pages supported by the chip. + */ +static const struct i2c_device_id pmbus_id[] = { + {"fse000", 0}, + {} +}; + +MODULE_DEVICE_TABLE(i2c, pmbus_id); + +/* This is the driver that will be inserted */ +static struct i2c_driver pmbus_driver = { + .driver = { + .name = "fse000", + }, + .probe = pmbus_probe, + .remove = pmbus_do_remove, + .id_table = pmbus_id, +}; + +module_i2c_driver(pmbus_driver); + +MODULE_DESCRIPTION("mitac_ly1200_32x_fse000 driver"); +MODULE_AUTHOR("Eddy Weng "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_gpe.c b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_gpe.c new file mode 100644 index 000000000000..3ced2b0a399b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_gpe.c @@ -0,0 +1,93 @@ +#include +#include + +#define BMS_GPE_CLASS "bms_acpi" +#define BMS_GPE_DRIVER_NAME "bms_gpe" +#define BMS_GPE_DEVICE_NAME "bms_acpi_gpe" + +static int bms_gpe[] = {0x01, 0x02, 0x47}; +static int bms_gpe_num = sizeof(bms_gpe) / sizeof(bms_gpe[0]); + +static u32 bms_gpe_handler(acpi_handle handle, u32 gpe_num, void *context) +{ + struct acpi_device *device = context; + + acpi_bus_generate_netlink_event(device->pnp.device_class,dev_name(&device->dev), + gpe_num, 0); + return ACPI_INTERRUPT_HANDLED; /* GPE will be disable afterward */ +} + +static int bms_gpe_add(struct acpi_device *device) +{ + acpi_status status; + int i = 0; + char info_str[60] = { 0 }; + char temp[6] = { 0 }; + + if (!device) { + printk("No device of BMS GPE\n"); + return -EINVAL; + } + + strcpy(acpi_device_name(device), BMS_GPE_DEVICE_NAME); + strcpy(acpi_device_class(device), BMS_GPE_CLASS); + + strncat(info_str, "Initialized GPE list = ", 23); + for (i = 0; i < bms_gpe_num; i++) { + status = acpi_install_gpe_handler(NULL, bms_gpe[i], + ACPI_GPE_LEVEL_TRIGGERED, + &bms_gpe_handler, device); + if (status != AE_OK) { + printk("Fail to claim BMS GPE%X (code:0x%X)\n",bms_gpe[i],status); + return -EINVAL; + } + snprintf(temp, sizeof(temp), "0x%.2X ", bms_gpe[i]); + strncat(info_str, temp, 6); + } + + dev_info(&device->dev, "%s.\n", info_str); + + return 0; +} + +static int bms_gpe_remove(struct acpi_device *device) +{ + int i = 0; + for (i = 0; i < bms_gpe_num; i++) { + acpi_remove_gpe_handler(NULL, bms_gpe[i], &bms_gpe_handler); + } + return 0; +} + +static const struct acpi_device_id bms_acpi_device_ids[] = { + { "PNP0C01", 0 }, + { /* END OF LIST */ } +}; + +static struct acpi_driver bms_gpe_driver = { + .name = BMS_GPE_DRIVER_NAME, + .class = BMS_GPE_CLASS, + .ids = bms_acpi_device_ids, + .ops = { + .add = bms_gpe_add, + .remove = bms_gpe_remove, + }, +}; + +static int __init bms_gpe_init(void) +{ + printk(KERN_INFO "%s: init.\n", __FUNCTION__); + return acpi_bus_register_driver(&bms_gpe_driver); +} + +static void __exit bms_gpe_exit(void) +{ + printk(KERN_INFO "%s: exit.\n", __FUNCTION__); + acpi_bus_unregister_driver(&bms_gpe_driver); +} + +module_init(bms_gpe_init); +module_exit(bms_gpe_exit); +MODULE_AUTHOR("Yencheng Lin "); +MODULE_DESCRIPTION("mitac_ly1200_32x_gpe driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_master_cpld.c b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_master_cpld.c new file mode 100644 index 000000000000..921a2ea424a3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_master_cpld.c @@ -0,0 +1,503 @@ +#include +#include + +#include "master_cpld_reg.h" +#include "master_cpld_sysfs.h" + +static int debug_flag = 0; + +struct master_cpld_data { + struct mutex lock; + + struct i2c_client *client; + struct device_attribute bin; +}; + + +static const struct i2c_device_id master_cpld_ids[] = { + { "master_cpld", 0 }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, master_cpld_ids); + +static int master_cpld_raw_read(struct device *dev, struct device_attribute *attr, char *buf, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name){ + unsigned int reg_val = 0, fld_val; + static int debug_flag; + struct master_cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int err; + + if (reg_width != 8){ + printk("%s: Register table width setting failed.\n", reg_name); + return -EINVAL; + } + mutex_lock(&data->lock); + if ((err = i2c_smbus_read_byte_data(client, (u8)reg_offset)) < 0) { + /* CPLD read error condition */; + mutex_unlock(&data->lock); + printk("%s: i2c read failed, error code = %d.\n", reg_name, err); + return err; + } + reg_val = err; + if (debug_flag) { + printk("%s: reg_offset = %d, width = %d, cur value = 0x%x.\n", reg_name, reg_offset, reg_width, reg_val); + } + mutex_unlock(&data->lock); + if (fld_width == reg_width) {fld_val = reg_val & fld_mask;} + else {fld_val = (reg_val >> fld_shift) & fld_mask;} + return sprintf(buf, "0x%x\n", fld_val); +} + +static int master_cpld_raw_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name){ + int ret_code; + unsigned int reg_val, fld_val; + unsigned long val; + static int debug_flag; + struct master_cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + if (reg_width != 8){ + printk("%s: Register table width setting failed.\n", reg_name); + return -EINVAL; + } + /* Parse buf and store to fld_val */ + if ((ret_code = kstrtoul(buf, 16, &val))){ + printk("%s: Conversion value = %s failed, errno = %d.\n", reg_name, buf, ret_code); + return ret_code; + } + fld_val = (unsigned int)val; + mutex_lock(&data->lock); + if ((ret_code = i2c_smbus_read_byte_data(client, (u8)reg_offset)) < 0) { + /* Handle CPLD read error condition */; + mutex_unlock(&data->lock); + printk("%s: i2c read failed, error code = %d.\n", reg_name, ret_code); + return ret_code; + } + reg_val = ret_code; + if (debug_flag) { + printk("%s: offset = %d, width = %d, cur value = 0x%x.\n", reg_name, reg_offset, reg_width, reg_val); + } + if (fld_width == reg_width) {reg_val = fld_val & fld_mask;} + else {reg_val = (reg_val & ~(fld_mask << fld_shift)) | + ((fld_val & (fld_mask)) << fld_shift);} + if ((ret_code = i2c_smbus_write_byte_data(client, (u8)reg_offset, (u8)reg_val)) != 0) { + /* Handle CPLD write error condition */; + mutex_unlock(&data->lock); + printk("%s: i2c write failed, error code = %d.\n", reg_name, ret_code); + return ret_code; + } + else if (debug_flag) { + printk("%s: offset = %d, width = %d, new value = 0x%x.\n", reg_name, reg_offset, reg_width, reg_val); + } + mutex_unlock(&data->lock); + return count; +} + +/*--------------------special file for debug---------------------- */ +static ssize_t master_cpld_debug_read(struct device *dev, struct device_attribute *attr, + char *buf){ + + return sprintf(buf, "%d\n", debug_flag); +} + + +static ssize_t master_cpld_debug_write(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + int temp; + int error; + + error = kstrtoint(buf, 10, &temp); + if (error){ + printk(KERN_INFO "%s: Conversion value = %s failed.\n", __FUNCTION__, buf); + return count; + } + debug_flag = temp; + + if(debug_flag) + printk("%s, debug_flag = %d\n", __FUNCTION__, debug_flag); + + return count; +} +SYSFS_MISC_RW_ATTR_DEF(debug, master_cpld_debug_read, master_cpld_debug_write) + + + + +/* ----------------define port group---------------------------- */ +static struct attribute *port1_attributes[] = { + SYSFS_ATTR_PTR(port1_present), /* register: zqsfp28_present_8_1_status */ + SYSFS_ATTR_PTR(port1_rst), /* register: zqsfp28_rst_8_1 */ + SYSFS_ATTR_PTR(port1_modsel), /* register: zqsfp28_modsel_8_1 */ + SYSFS_ATTR_PTR(port1_lpmode), /* register: zqsfp28_lpmode_8_1 */ + SYSFS_ATTR_PTR(port1_irq_status), /* register: zqsfp28_irq_8_1_status */ + SYSFS_ATTR_PTR(port1_irq_msk), /* register: zqsfp28_irq_msk_8_1_status */ + NULL +}; + + +static struct attribute *port2_attributes[] = { + SYSFS_ATTR_PTR(port2_present), /* register: zqsfp28_present_8_1_status */ + SYSFS_ATTR_PTR(port2_rst), /* register: zqsfp28_rst_8_1 */ + SYSFS_ATTR_PTR(port2_modsel), /* register: zqsfp28_modsel_8_1 */ + SYSFS_ATTR_PTR(port2_lpmode), /* register: zqsfp28_lpmode_8_1 */ + SYSFS_ATTR_PTR(port2_irq_status), /* register: zqsfp28_irq_8_1_status */ + SYSFS_ATTR_PTR(port2_irq_msk), /* register: zqsfp28_irq_msk_8_1_status */ + NULL +}; + + +static struct attribute *port3_attributes[] = { + SYSFS_ATTR_PTR(port3_present), /* register: zqsfp28_present_8_1_status */ + SYSFS_ATTR_PTR(port3_rst), /* register: zqsfp28_rst_8_1 */ + SYSFS_ATTR_PTR(port3_modsel), /* register: zqsfp28_modsel_8_1 */ + SYSFS_ATTR_PTR(port3_lpmode), /* register: zqsfp28_lpmode_8_1 */ + SYSFS_ATTR_PTR(port3_irq_status), /* register: zqsfp28_irq_8_1_status */ + SYSFS_ATTR_PTR(port3_irq_msk), /* register: zqsfp28_irq_msk_8_1_status */ + NULL +}; + +static struct attribute *port4_attributes[] = { + SYSFS_ATTR_PTR(port4_present), /* register: zqsfp28_present_8_1_status */ + SYSFS_ATTR_PTR(port4_rst), /* register: zqsfp28_rst_8_1 */ + SYSFS_ATTR_PTR(port4_modsel), /* register: zqsfp28_modsel_8_1 */ + SYSFS_ATTR_PTR(port4_lpmode), /* register: zqsfp28_lpmode_8_1 */ + SYSFS_ATTR_PTR(port4_irq_status), /* register: zqsfp28_irq_8_1_status */ + SYSFS_ATTR_PTR(port4_irq_msk), /* register: zqsfp28_irq_msk_8_1_status */ + NULL +}; + +static struct attribute *port5_attributes[] = { + SYSFS_ATTR_PTR(port5_present), /* register: zqsfp28_present_8_1_status */ + SYSFS_ATTR_PTR(port5_rst), /* register: zqsfp28_rst_8_1 */ + SYSFS_ATTR_PTR(port5_modsel), /* register: zqsfp28_modsel_8_1 */ + SYSFS_ATTR_PTR(port5_lpmode), /* register: zqsfp28_lpmode_8_1 */ + SYSFS_ATTR_PTR(port5_irq_status), /* register: zqsfp28_irq_8_1_status */ + SYSFS_ATTR_PTR(port5_irq_msk), /* register: zqsfp28_irq_msk_8_1_status */ + NULL +}; + +static struct attribute *port6_attributes[] = { + SYSFS_ATTR_PTR(port6_present), /* register: zqsfp28_present_8_1_status */ + SYSFS_ATTR_PTR(port6_rst), /* register: zqsfp28_rst_8_1 */ + SYSFS_ATTR_PTR(port6_modsel), /* register: zqsfp28_modsel_8_1 */ + SYSFS_ATTR_PTR(port6_lpmode), /* register: zqsfp28_lpmode_8_1 */ + SYSFS_ATTR_PTR(port6_irq_status), /* register: zqsfp28_irq_8_1_status */ + SYSFS_ATTR_PTR(port6_irq_msk), /* register: zqsfp28_irq_msk_8_1_status */ + NULL +}; + +static struct attribute *port7_attributes[] = { + SYSFS_ATTR_PTR(port7_present), /* register: zqsfp28_present_8_1_status */ + SYSFS_ATTR_PTR(port7_rst), /* register: zqsfp28_rst_8_1 */ + SYSFS_ATTR_PTR(port7_modsel), /* register: zqsfp28_modsel_8_1 */ + SYSFS_ATTR_PTR(port7_lpmode), /* register: zqsfp28_lpmode_8_1 */ + SYSFS_ATTR_PTR(port7_irq_status), /* register: zqsfp28_irq_8_1_status */ + SYSFS_ATTR_PTR(port7_irq_msk), /* register: zqsfp28_irq_msk_8_1_status */ + NULL +}; + +static struct attribute *port8_attributes[] = { + SYSFS_ATTR_PTR(port8_present), /* register: zqsfp28_present_8_1_status */ + SYSFS_ATTR_PTR(port8_rst), /* register: zqsfp28_rst_8_1 */ + SYSFS_ATTR_PTR(port8_modsel), /* register: zqsfp28_modsel_8_1 */ + SYSFS_ATTR_PTR(port8_lpmode), /* register: zqsfp28_lpmode_8_1 */ + SYSFS_ATTR_PTR(port8_irq_status), /* register: zqsfp28_irq_8_1_status */ + SYSFS_ATTR_PTR(port8_irq_msk), /* register: zqsfp28_irq_msk_8_1_status */ + NULL +}; + +static struct attribute *port9_attributes[] = { + SYSFS_ATTR_PTR(port9_present), /* register: zqsfp28_present_16_9_status */ + SYSFS_ATTR_PTR(port9_rst), /* register: zqsfp28_rst_16_9 */ + SYSFS_ATTR_PTR(port9_modsel), /* register: zqsfp28_modsel_16_9 */ + SYSFS_ATTR_PTR(port9_lpmode), /* register: zqsfp28_lpmode_16_9 */ + SYSFS_ATTR_PTR(port9_irq_status), /* register: zqsfp28_irq_16_9_status */ + SYSFS_ATTR_PTR(port9_irq_msk), /* register: zqsfp28_irq_msk_16_9_status */ + NULL +}; + +static struct attribute *port10_attributes[] = { + SYSFS_ATTR_PTR(port10_present), /* register: zqsfp28_present_16_9_status */ + SYSFS_ATTR_PTR(port10_rst), /* register: zqsfp28_rst_16_9 */ + SYSFS_ATTR_PTR(port10_modsel), /* register: zqsfp28_modsel_16_9 */ + SYSFS_ATTR_PTR(port10_lpmode), /* register: zqsfp28_lpmode_16_9 */ + SYSFS_ATTR_PTR(port10_irq_status), /* register: zqsfp28_irq_16_9_status */ + SYSFS_ATTR_PTR(port10_irq_msk), /* register: zqsfp28_irq_msk_16_9_status */ + NULL +}; + +static struct attribute *port11_attributes[] = { + SYSFS_ATTR_PTR(port11_present), /* register: zqsfp28_present_16_9_status */ + SYSFS_ATTR_PTR(port11_rst), /* register: zqsfp28_rst_16_9 */ + SYSFS_ATTR_PTR(port11_modsel), /* register: zqsfp28_modsel_16_9 */ + SYSFS_ATTR_PTR(port11_lpmode), /* register: zqsfp28_lpmode_16_9 */ + SYSFS_ATTR_PTR(port11_irq_status), /* register: zqsfp28_irq_16_9_status */ + SYSFS_ATTR_PTR(port11_irq_msk), /* register: zqsfp28_irq_msk_16_9_status */ + NULL +}; + +static struct attribute *port12_attributes[] = { + SYSFS_ATTR_PTR(port12_present), /* register: zqsfp28_present_16_9_status */ + SYSFS_ATTR_PTR(port12_rst), /* register: zqsfp28_rst_16_9 */ + SYSFS_ATTR_PTR(port12_modsel), /* register: zqsfp28_modsel_16_9 */ + SYSFS_ATTR_PTR(port12_lpmode), /* register: zqsfp28_lpmode_16_9 */ + SYSFS_ATTR_PTR(port12_irq_status), /* register: zqsfp28_irq_16_9_status */ + SYSFS_ATTR_PTR(port12_irq_msk), /* register: zqsfp28_irq_msk_16_9_status */ + NULL +}; + +static struct attribute *port13_attributes[] = { + SYSFS_ATTR_PTR(port13_present), /* register: zqsfp28_present_16_9_status */ + SYSFS_ATTR_PTR(port13_rst), /* register: zqsfp28_rst_16_9 */ + SYSFS_ATTR_PTR(port13_modsel), /* register: zqsfp28_modsel_16_9 */ + SYSFS_ATTR_PTR(port13_lpmode), /* register: zqsfp28_lpmode_16_9 */ + SYSFS_ATTR_PTR(port13_irq_status), /* register: zqsfp28_irq_16_9_status */ + SYSFS_ATTR_PTR(port13_irq_msk), /* register: zqsfp28_irq_msk_16_9_status */ + NULL +}; + +static struct attribute *port14_attributes[] = { + SYSFS_ATTR_PTR(port14_present), /* register: zqsfp28_present_16_9_status */ + SYSFS_ATTR_PTR(port14_rst), /* register: zqsfp28_rst_16_9 */ + SYSFS_ATTR_PTR(port14_modsel), /* register: zqsfp28_modsel_16_9 */ + SYSFS_ATTR_PTR(port14_lpmode), /* register: zqsfp28_lpmode_16_9 */ + SYSFS_ATTR_PTR(port14_irq_status), /* register: zqsfp28_irq_16_9_status */ + SYSFS_ATTR_PTR(port14_irq_msk), /* register: zqsfp28_irq_msk_16_9_status */ + NULL +}; + +static struct attribute *port15_attributes[] = { + SYSFS_ATTR_PTR(port15_present), /* register: zqsfp28_present_16_9_status */ + SYSFS_ATTR_PTR(port15_rst), /* register: zqsfp28_rst_16_9 */ + SYSFS_ATTR_PTR(port15_modsel), /* register: zqsfp28_modsel_16_9 */ + SYSFS_ATTR_PTR(port15_lpmode), /* register: zqsfp28_lpmode_16_9 */ + SYSFS_ATTR_PTR(port15_irq_status), /* register: zqsfp28_irq_16_9_status */ + SYSFS_ATTR_PTR(port15_irq_msk), /* register: zqsfp28_irq_msk_16_9_status */ + NULL +}; + +static struct attribute *port16_attributes[] = { + SYSFS_ATTR_PTR(port16_present), /* register: zqsfp28_present_16_9_status */ + SYSFS_ATTR_PTR(port16_rst), /* register: zqsfp28_rst_16_9 */ + SYSFS_ATTR_PTR(port16_modsel), /* register: zqsfp28_modsel_16_9 */ + SYSFS_ATTR_PTR(port16_lpmode), /* register: zqsfp28_lpmode_16_9 */ + SYSFS_ATTR_PTR(port16_irq_status), /* register: zqsfp28_irq_16_9_status */ + SYSFS_ATTR_PTR(port16_irq_msk), /* register: zqsfp28_irq_msk_16_9_status */ + NULL +}; + + +static const struct attribute_group master_cpld_port_group[] = { + {.attrs = port1_attributes, + .name = "port1",}, + {.attrs = port2_attributes, + .name = "port2",}, + {.attrs = port3_attributes, + .name = "port3",}, + {.attrs = port4_attributes, + .name = "port4",}, + {.attrs = port5_attributes, + .name = "port5",}, + {.attrs = port6_attributes, + .name = "port6",}, + {.attrs = port7_attributes, + .name = "port7",}, + {.attrs = port8_attributes, + .name = "port8",}, + {.attrs = port9_attributes, + .name = "port9",}, + {.attrs = port10_attributes, + .name = "port10",}, + {.attrs = port11_attributes, + .name = "port11",}, + {.attrs = port12_attributes, + .name = "port12",}, + {.attrs = port13_attributes, + .name = "port13",}, + {.attrs = port14_attributes, + .name = "port14",}, + {.attrs = port15_attributes, + .name = "port15",}, + {.attrs = port16_attributes, + .name = "port16",} +}; + +/* ----------------define misc group---------------------------- */ +static struct attribute *misc_attributes[] = { + SYSFS_ATTR_PTR(mjr_rev), /* register: mstr_cpld_rev */ + SYSFS_ATTR_PTR(mnr_rev), /* register: mstr_cpld_rev */ + + SYSFS_ATTR_PTR(scrtch_reg), /* register: mstr_cpld_gpr */ + + SYSFS_ATTR_PTR(brd_rev), /* register: mb_brd_rev_type */ + SYSFS_ATTR_PTR(brd_type), /* register: mb_brd_rev_type */ + + SYSFS_ATTR_PTR(mb_rst), /* register: mstr_srr */ + SYSFS_ATTR_PTR(npu_rst), /* register: mstr_srr */ + SYSFS_ATTR_PTR(mgmt_phy_rst), /* register: mstr_srr */ + + SYSFS_ATTR_PTR(mb_eeprom_wp), /* register: eeprom_wp */ + SYSFS_ATTR_PTR(cpld_spi_wp), /* register: eeprom_wp */ + SYSFS_ATTR_PTR(fan_eeprom_wp), /* register: eeprom_wp */ + + SYSFS_ATTR_PTR(ps2_int_msk), /* register: mstr_irq */ + SYSFS_ATTR_PTR(ps1_int_msk), /* register: mstr_irq */ + SYSFS_ATTR_PTR(usb_fault_msk), /* register: mstr_irq */ + SYSFS_ATTR_PTR(pcie_int_msk), /* register: mstr_irq */ + SYSFS_ATTR_PTR(fan_alert_int_msk), /* register: mstr_irq */ + SYSFS_ATTR_PTR(usb_fault), /* register: mstr_irq */ + SYSFS_ATTR_PTR(pcie_int), /* register: mstr_irq */ + SYSFS_ATTR_PTR(fan_alert_int), /* register: mstr_irq */ + SYSFS_ATTR_PTR(system_led_fld), /* register: mstr_irq */ + SYSFS_ATTR_PTR(power_led), /* register: mstr_irq */ + SYSFS_ATTR_PTR(fan_led), /* register: mstr_irq */ + SYSFS_ATTR_PTR(locate_led), /* register: mstr_irq */ + + SYSFS_ATTR_PTR(led_test), /* register: fan_tray_3_1_led */ + SYSFS_ATTR_PTR(fan_tray3_led), /* register: fan_tray_3_1_led */ + SYSFS_ATTR_PTR(fan_tray2_led), /* register: fan_tray_3_1_led */ + SYSFS_ATTR_PTR(fan_tray1_led), /* register: fan_tray_3_1_led */ + SYSFS_ATTR_PTR(fan_tray6_led), /* register: fan_tray_6_4_led */ + SYSFS_ATTR_PTR(fan_tray5_led), /* register: fan_tray_6_4_led */ + SYSFS_ATTR_PTR(fan_tray4_led), /* register: fan_tray_6_4_led */ + + SYSFS_ATTR_PTR(fan_tray6_present), /* register: fan_tray_status */ + SYSFS_ATTR_PTR(fan_tray5_present), /* register: fan_tray_status */ + SYSFS_ATTR_PTR(fan_tray4_present), /* register: fan_tray_status */ + SYSFS_ATTR_PTR(fan_tray3_present), /* register: fan_tray_status */ + SYSFS_ATTR_PTR(fan_tray2_present), /* register: fan_tray_status */ + SYSFS_ATTR_PTR(fan_tray1_present), /* register: fan_tray_status */ + + SYSFS_ATTR_PTR(fan_type6), /* register: fan_type_status */ + SYSFS_ATTR_PTR(fan_type5), /* register: fan_type_status */ + SYSFS_ATTR_PTR(fan_type4), /* register: fan_type_status */ + SYSFS_ATTR_PTR(fan_type3), /* register: fan_type_status */ + SYSFS_ATTR_PTR(fan_type2), /* register: fan_type_status */ + SYSFS_ATTR_PTR(fan_type1), /* register: fan_type_status */ + + SYSFS_ATTR_PTR(ps1_ps), /* register: psu_en_status */ + SYSFS_ATTR_PTR(ps1_pg), /* register: psu_en_status */ + SYSFS_ATTR_PTR(ps1_int), /* register: psu_en_status */ + SYSFS_ATTR_PTR(ps1_on), /* register: psu_en_status */ + SYSFS_ATTR_PTR(ps2_ps), /* register: psu_en_status */ + SYSFS_ATTR_PTR(ps2_pg), /* register: psu_en_status */ + SYSFS_ATTR_PTR(ps2_int), /* register: psu_en_status */ + SYSFS_ATTR_PTR(ps2_on), /* register: psu_en_status */ + + SYSFS_ATTR_PTR(usb1_vbus_en), /* register: mb_pwr_en_status */ + SYSFS_ATTR_PTR(v5p0_en), /* register: mb_pwr_en_status */ + SYSFS_ATTR_PTR(v3p3_en), /* register: mb_pwr_en_status */ + SYSFS_ATTR_PTR(vcc_1v8_en), /* register: mb_pwr_en_status */ + SYSFS_ATTR_PTR(mac_avs1v_en), /* register: mb_pwr_en_status */ + SYSFS_ATTR_PTR(mac1v_en), /* register: mb_pwr_en_status */ + SYSFS_ATTR_PTR(vcc_1v25_en), /* register: mb_pwr_en_status */ + + SYSFS_ATTR_PTR(vcc_3p3_cpld), /* register: mb_pwr_status */ + SYSFS_ATTR_PTR(vcc5v_pg), /* register: mb_pwr_status */ + SYSFS_ATTR_PTR(vcc3v3_pg), /* register: mb_pwr_status */ + SYSFS_ATTR_PTR(vcc_1v8_pg), /* register: mb_pwr_status */ + SYSFS_ATTR_PTR(mac_avs1v_pg), /* register: mb_pwr_status */ + SYSFS_ATTR_PTR(mac1v_pg), /* register: mb_pwr_status */ + SYSFS_ATTR_PTR(vcc_1v25_pg), /* register: mb_pwr_status */ + + SYSFS_ATTR_PTR(port_1_8_present), /* register: zqsfp28_present_8_1_status */ + SYSFS_ATTR_PTR(port_9_16_present), /* register: zqsfp28_present_16_9_status */ + SYSFS_ATTR_PTR(port_1_8_rst), /* register: zqsfp28_rst_8_1 */ + SYSFS_ATTR_PTR(port_9_16_rst), /* register: zqsfp28_rst_16_9 */ + SYSFS_ATTR_PTR(port_1_8_modsel), /* register: zqsfp28_modsel_8_1 */ + SYSFS_ATTR_PTR(port_9_16_modsel), /* register: zqsfp28_modsel_16_9 */ + SYSFS_ATTR_PTR(port_1_8_irq_status), /* register: zqsfp28_irq_8_1_status */ + SYSFS_ATTR_PTR(port_9_16_irq_status),/* register: zqsfp28_irq_16_9_status */ + SYSFS_ATTR_PTR(port_1_8_irq_msk), /* register: zqsfp28_irq_msk_8_1_status */ + SYSFS_ATTR_PTR(port_9_16_irq_msk), /* register: zqsfp28_irq_msk_16_9_status */ + SYSFS_ATTR_PTR(port_1_8_lpmode), /* register: zqsfp28_lpmode_8_1 */ + SYSFS_ATTR_PTR(port_9_16_lpmode), /* register: zqsfp28_lpmode_16_9 */ + + SYSFS_ATTR_PTR(fan_tray1_6_present), /* register: fan_tray_status */ + SYSFS_ATTR_PTR(psu_en_status_fld), /* register: psu_en_status*/ + + SYSFS_ATTR_PTR(debug), /* debug flag for print more messages */ + NULL +}; +static const struct attribute_group master_cpld_group_misc = { + .attrs = misc_attributes, +}; + +static int master_cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct master_cpld_data *master_cpld; + int err, i; + int grp_number = (int)( sizeof(master_cpld_port_group) / sizeof(master_cpld_port_group[0])); + + /* allocate memory to master_cpld */ + master_cpld = devm_kzalloc(&client->dev, sizeof(struct master_cpld_data) , GFP_KERNEL); + + if (!master_cpld) + return -ENOMEM; + + mutex_init(&master_cpld->lock); + + for(i = 0 ; i < grp_number ; i++){ + err = sysfs_create_group(&client->dev.kobj, &master_cpld_port_group[i]); + if (err){ + printk("%s: Error creeat port group %d.\n", __FUNCTION__, i+1); + } + } + err = sysfs_create_group(&client->dev.kobj, &master_cpld_group_misc); + if (err){ + printk("%s: Error creeat misc group.\n", __FUNCTION__); + } + + master_cpld->client = client; + i2c_set_clientdata(client, master_cpld); + + printk(KERN_INFO "%s: Master CPLD LCMXO3LF created.\n", __FUNCTION__); + + return 0; + +} + +static int master_cpld_remove(struct i2c_client *client) +{ + int i; + int grp_number = (int)( sizeof(master_cpld_port_group) / sizeof(master_cpld_port_group[0])); + + for(i = 0 ; i < grp_number ; i++){ + sysfs_remove_group(&client->dev.kobj, &master_cpld_port_group[i]); + } + sysfs_remove_group(&client->dev.kobj, &master_cpld_group_misc); + + printk(KERN_INFO "%s: Master CPLD removed.\n", __FUNCTION__); + return 0; +} + +static struct i2c_driver master_cpld_driver = { + .driver = { + .name = "master_cpld", + .owner = THIS_MODULE, + }, + .probe = master_cpld_probe, + .remove = master_cpld_remove, + .id_table = master_cpld_ids, +}; + +static int __init master_cpld_init(void) +{ + printk(KERN_INFO "%s: init.\n", __FUNCTION__); + return i2c_add_driver(&master_cpld_driver); +} +module_init(master_cpld_init); + +static void __exit master_cpld_exit(void) +{ + printk(KERN_INFO "%s: exit.\n", __FUNCTION__); + i2c_del_driver(&master_cpld_driver); +} +module_exit(master_cpld_exit); + +MODULE_DESCRIPTION("mitac_ly1200_32x_master_cpld driver"); +MODULE_AUTHOR("Eddy Weng "); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_pb_i2c.c b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_pb_i2c.c new file mode 100644 index 000000000000..bad9260ab4ca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_pb_i2c.c @@ -0,0 +1,137 @@ +#include +#include +#include "bms_i2c.h" + +#define BMS_PB_I2C_CLIENT_NUM 6 + +static struct i2c_client *bms_pb_clients[BMS_PB_I2C_CLIENT_NUM] = {NULL}; +static int bms_pb_client_index = 0; + +static int __init __find_i2c_adap(struct device *dev, void *data) +{ + const char *name = data; + static const char *prefix = "i2c-"; + struct i2c_adapter *adapter; + + if (strncmp(dev_name(dev), prefix, strlen(prefix)) != 0) + { + return 0; + } + adapter = to_i2c_adapter(dev); + + return (strncmp(adapter->name, name, strlen(name)) == 0); +} + +static int __init find_i2c_adapter_num(enum i2c_adapter_type type) +{ + struct device *dev = NULL; + struct i2c_adapter *adapter; + const char *name = bms_i2c_adapter_names[type]; + + /* find the adapter by name */ + dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, + __find_i2c_adap); + if (!dev) { + pr_err("%s: i2c adapter %s not found on system.\n", + __func__, name); + return -ENODEV; + } + adapter = to_i2c_adapter(dev); + + return adapter->nr; +} + + +static int __init find_i2c_mux_adapter_num(int parent_num, int num) +{ + struct device *dev = NULL; + struct i2c_adapter *adapter; + char name[48]; + + snprintf(name, sizeof(name), "i2c-%d-mux (chan_id %d)", + parent_num, num); + /* find the adapter by name */ + dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, + __find_i2c_adap); + if (!dev) { + pr_err("%s: i2c adapter %s not found on system.\n", + __func__, name); + return -ENODEV; + } + adapter = to_i2c_adapter(dev); + + return adapter->nr; +} + +static __init struct i2c_client *bms_pb_setup_eeprom_24c01( + struct i2c_adapter *adap, int addr) +{ + struct i2c_board_info info_spd = { + I2C_BOARD_INFO("24c01", addr), + }; + + return i2c_new_device(adap, &info_spd); +} + + +static int __init bms_pb_setup_devices(void) +{ + struct i2c_adapter *adap; + int adap_num; + int parent_num; + + parent_num = find_i2c_adapter_num(I2C_ADAPTER_ISMT); + if (parent_num < 0) + return parent_num; + + adap_num = find_i2c_mux_adapter_num(parent_num, I2C_STAGE1_MUX_CHAN3); + if (adap_num < 0) + return adap_num; + + adap = i2c_get_adapter(adap_num); + if (!adap) { + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + goto exit; + } + + bms_pb_clients[bms_pb_client_index++] = bms_pb_setup_eeprom_24c01(adap, 0x50); + bms_pb_clients[bms_pb_client_index++] = bms_pb_setup_eeprom_24c01(adap, 0x51); + +exit: + return 0; +} + +static int __init bms_pb_i2c_init(void) +{ + /* Initial bms_sb_slients array. */ + memset(bms_pb_clients, 0x0, BMS_PB_I2C_CLIENT_NUM); + + bms_pb_setup_devices(); + return 0; +} + + +static void __exit bms_pb_i2c_exit(void){ + int i; + + for (i=(bms_pb_client_index-1); i>=0; i--) { + if (bms_pb_clients[i]) { + i2c_unregister_device(bms_pb_clients[i]); + bms_pb_clients[i] = NULL; + } + } + + bms_pb_client_index = 0; + + +} + + +module_init(bms_pb_i2c_init); +module_exit(bms_pb_i2c_exit); + + +MODULE_DESCRIPTION("mitac_ly1200_32x_pb_i2c driver"); +MODULE_AUTHOR("Eddy Weng "); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_sb_i2c.c b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_sb_i2c.c new file mode 100644 index 000000000000..e2a9718863ff --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_sb_i2c.c @@ -0,0 +1,514 @@ +#include +#include +#include +#include +#include +#include +#include "bms_i2c.h" + +/* Don't include MAC_AVS_1V */ +#define BMS_SB_I2C_CLIENT_NUM 35 +#define BMS_SB_ADAPTER_BASE 2 +#define BMS_SB_STAGE2_MUX_BUS_BASE 6 + + +static struct i2c_client *bms_sb_clients[BMS_SB_I2C_CLIENT_NUM] = {NULL}; +static int bms_sb_client_index = 0; + +enum bms_sb_switch_stage2_mux0_bus { + I2C_STAGE2_MUX0_CHAN0 = 0, + I2C_STAGE2_MUX0_CHAN1, + I2C_STAGE2_MUX0_CHAN2, + I2C_STAGE2_MUX0_CHAN3, + I2C_STAGE2_MUX0_CHAN4, + I2C_STAGE2_MUX0_CHAN5, + I2C_STAGE2_MUX0_CHAN6, + I2C_STAGE2_MUX0_CHAN7, +}; + +enum bms_sb_switch_stage2_mux1_bus { + I2C_STAGE2_MUX1_CHAN8 = 0, + I2C_STAGE2_MUX1_CHAN9, + I2C_STAGE2_MUX1_CHAN10, + I2C_STAGE2_MUX1_CHAN11, + I2C_STAGE2_MUX1_CHAN12, + I2C_STAGE2_MUX1_CHAN13, + I2C_STAGE2_MUX1_CHAN14, + I2C_STAGE2_MUX1_CHAN15, +}; + +enum bms_sb_switch_stage2_mux2_bus { + I2C_STAGE2_MUX2_CHAN16 = 0, + I2C_STAGE2_MUX2_CHAN17, + I2C_STAGE2_MUX2_CHAN18, + I2C_STAGE2_MUX2_CHAN19, + I2C_STAGE2_MUX2_CHAN20, + I2C_STAGE2_MUX2_CHAN21, + I2C_STAGE2_MUX2_CHAN22, + I2C_STAGE2_MUX2_CHAN23, +}; + +enum bms_sb_switch_stage2_mux3_bus { + I2C_STAGE2_MUX3_CHAN24 = 0, + I2C_STAGE2_MUX3_CHAN25, + I2C_STAGE2_MUX3_CHAN26, + I2C_STAGE2_MUX3_CHAN27, + I2C_STAGE2_MUX3_CHAN28, + I2C_STAGE2_MUX3_CHAN29, + I2C_STAGE2_MUX3_CHAN30, + I2C_STAGE2_MUX3_CHAN31, +}; + +static struct pca954x_platform_mode pmode_pca9548_mux[] = { + { .adap_id = BMS_SB_ADAPTER_BASE + 0, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 1, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 2, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 3, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 4, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 5, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 6, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 7, }, +}; + +static struct pca954x_platform_data platdata_pca9548_mux = { + .modes = pmode_pca9548_mux, + .num_modes = ARRAY_SIZE(pmode_pca9548_mux), +}; + +static struct pca954x_platform_mode pmode_stage1_pca9548_mux0[] = { + { .adap_id = BMS_SB_ADAPTER_BASE + 8, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 9, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 10, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 11, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 12, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 13, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 14, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 15, }, +}; + +static struct pca954x_platform_data platdata_stage1_pca9548_mux0 = { + .modes = pmode_stage1_pca9548_mux0, + .num_modes = ARRAY_SIZE(pmode_stage1_pca9548_mux0), +}; + +static struct pca954x_platform_mode pmode_stage1_pca9548_mux1[] = { + { .adap_id = BMS_SB_ADAPTER_BASE + 16, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 17, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 18, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 19, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 20, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 21, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 22, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 23, }, +}; + +static struct pca954x_platform_data platdata_stage1_pca9548_mux1 = { + .modes = pmode_stage1_pca9548_mux1, + .num_modes = ARRAY_SIZE(pmode_stage1_pca9548_mux1), +}; + +static struct pca954x_platform_mode pmode_stage1_pca9548_mux2[] = { + { .adap_id = BMS_SB_ADAPTER_BASE + 24, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 25, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 26, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 27, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 28, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 29, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 30, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 31, }, +}; + +static struct pca954x_platform_data platdata_stage1_pca9548_mux2 = { + .modes = pmode_stage1_pca9548_mux2, + .num_modes = ARRAY_SIZE(pmode_stage1_pca9548_mux2), +}; + +static struct pca954x_platform_mode pmode_stage1_pca9548_mux3[] = { + { .adap_id = BMS_SB_ADAPTER_BASE + 32, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 33, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 34, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 35, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 36, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 37, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 38, }, + { .adap_id = BMS_SB_ADAPTER_BASE + 39, }, +}; + +static struct pca954x_platform_data platdata_stage1_pca9548_mux3 = { + .modes = pmode_stage1_pca9548_mux3, + .num_modes = ARRAY_SIZE(pmode_stage1_pca9548_mux3), +}; + +static int __init __find_i2c_adap(struct device *dev, void *data) +{ + const char *name = data; + static const char *prefix = "i2c-"; + struct i2c_adapter *adapter; + + if (strncmp(dev_name(dev), prefix, strlen(prefix)) != 0) + { + return 0; + } + adapter = to_i2c_adapter(dev); + + return (strncmp(adapter->name, name, strlen(name)) == 0); +} + +static int __init find_i2c_adapter_num(enum i2c_adapter_type type) +{ + struct device *dev = NULL; + struct i2c_adapter *adapter; + const char *name = bms_i2c_adapter_names[type]; + + /* find the adapter by name */ + dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, + __find_i2c_adap); + if (!dev) { + pr_err("%s: i2c adapter %s not found on system.\n", + __func__, name); + return -ENODEV; + } + adapter = to_i2c_adapter(dev); + + return adapter->nr; +} + +static int __init find_i2c_mux_adapter_num(int parent_num, int num) +{ + struct device *dev = NULL; + struct i2c_adapter *adapter; + char name[48]; + + snprintf(name, sizeof(name), "i2c-%d-mux (chan_id %d)", + parent_num, num); + /* find the adapter by name */ + dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, + __find_i2c_adap); + if (!dev) { + pr_err("%s: i2c adapter %s not found on system.\n", + __func__, name); + return -ENODEV; + } + adapter = to_i2c_adapter(dev); + + return adapter->nr; +} + +static __init struct i2c_client *bms_sb_setup_eeprom_24c04( + struct i2c_adapter *adap) +{ + struct i2c_board_info info_spd = { + I2C_BOARD_INFO("24c04", 0x50), + }; + + return i2c_new_device(adap, &info_spd); +} + +static __init struct i2c_client *bms_sb_setup_tmp75( + struct i2c_adapter *adap, int addr) +{ + struct i2c_board_info info_spd = { + I2C_BOARD_INFO("tmp75", addr), + }; + + return i2c_new_device(adap, &info_spd); +} + +static __init struct i2c_client *bms_sb_setup_switch(struct i2c_adapter *adap) +{ + struct i2c_board_info info = { + I2C_BOARD_INFO("pca9548", 0x70), + .platform_data = &platdata_pca9548_mux, + }; + + return i2c_new_device(adap, &info); +} + +static __init struct i2c_client *bms_sb_setup_stage1_mux0(struct i2c_adapter *adap) +{ + struct i2c_board_info info = { + I2C_BOARD_INFO("pca9548", 0x71), + .platform_data = &platdata_stage1_pca9548_mux0, + }; + + return i2c_new_device(adap, &info); +} + +static __init struct i2c_client *bms_sb_setup_stage1_mux1(struct i2c_adapter *adap) +{ + struct i2c_board_info info = { + I2C_BOARD_INFO("pca9548", 0x72), + .platform_data = &platdata_stage1_pca9548_mux1, + }; + + return i2c_new_device(adap, &info); +} + +static __init struct i2c_client *bms_sb_setup_stage1_mux2(struct i2c_adapter *adap) +{ + struct i2c_board_info info = { + I2C_BOARD_INFO("pca9548", 0x73), + .platform_data = &platdata_stage1_pca9548_mux2, + }; + + return i2c_new_device(adap, &info); +} + +static __init struct i2c_client *bms_sb_setup_stage1_mux3(struct i2c_adapter *adap) +{ + struct i2c_board_info info = { + I2C_BOARD_INFO("pca9548", 0x74), + .platform_data = &platdata_stage1_pca9548_mux3, + }; + + return i2c_new_device(adap, &info); +} + +static __init struct i2c_client *bms_sb_setup_slave_cpld(struct i2c_adapter *adap) +{ + struct i2c_board_info info = { + I2C_BOARD_INFO("slave_cpld", 0x33), + }; + + return i2c_new_device(adap, &info); +} + +static __init struct i2c_client *bms_sb_setup_master_cpld(struct i2c_adapter *adap) +{ + struct i2c_board_info info = { + I2C_BOARD_INFO("master_cpld", 0x32), + }; + + return i2c_new_device(adap, &info); +} + +static __init struct i2c_client *bms_sb_setup_sff8436(struct i2c_adapter *adap) +{ + struct i2c_board_info info = { + I2C_BOARD_INFO("sff8436", 0x50), + }; + + return i2c_new_device(adap, &info); +} + +static int __init bms_sb_setup_devices_ismt(void) +{ + struct i2c_adapter *adap; + int adap_num = find_i2c_adapter_num(I2C_ADAPTER_ISMT); + + if (adap_num < 0) + return adap_num; + + adap = i2c_get_adapter(adap_num); + if (!adap) { + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + return 0; + } + + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_switch(adap); + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_master_cpld(adap); + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_slave_cpld(adap); + + return 0; +} + +static int __init bms_sb_setup_devices_stage1(void) +{ + struct i2c_adapter *adap; + int adap_num; + int parent_num; + + parent_num = find_i2c_adapter_num(I2C_ADAPTER_ISMT); + if (parent_num < 0) + return parent_num; + + /* Mux chan0 steup */ + adap_num = find_i2c_mux_adapter_num(parent_num, I2C_STAGE1_MUX_CHAN0); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_eeprom_24c04(adap); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN0); + } + + /* Mux chan1 connect to fan board */ + + /* Mux chan2 steup */ + adap_num = find_i2c_mux_adapter_num(parent_num, I2C_STAGE1_MUX_CHAN2); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_tmp75(adap, 0x4a); + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_tmp75(adap, 0x4b); + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_tmp75(adap, 0x4c); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN2); + } + + /* Mux chan3 connect to power board */ + + /* Mux chan4 setup for i2c mux0 */ + adap_num = find_i2c_mux_adapter_num(parent_num, I2C_STAGE1_MUX_CHAN4); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_stage1_mux0(adap); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN4); + } + + /* Mux chan5 setup for i2c mux1 */ + adap_num = find_i2c_mux_adapter_num(parent_num, I2C_STAGE1_MUX_CHAN5); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_stage1_mux1(adap); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN5); + } + + /* Mux chan6 setup for i2c mux2 */ + adap_num = find_i2c_mux_adapter_num(parent_num, I2C_STAGE1_MUX_CHAN6); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_stage1_mux2(adap); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN6); + } + + /* Mux chan7 setup for i2c mux3 */ + adap_num = find_i2c_mux_adapter_num(parent_num, I2C_STAGE1_MUX_CHAN7); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_stage1_mux3(adap); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN7); + } + + return 0; +} + +static int __init bms_sb_setup_devices_stage2(void) +{ + struct i2c_adapter *adap; + int adap_num; + int i2c_base = sizeof(bms_i2c_adapter_names) / sizeof(bms_i2c_adapter_names[0]); + int i; + + /* stage2 mux0 chan0~7 install sff8436 */ + for(i = I2C_STAGE2_MUX0_CHAN0; i <= I2C_STAGE2_MUX0_CHAN7; i++){ + adap_num = find_i2c_mux_adapter_num(I2C_STAGE1_MUX_CHAN4 + i2c_base, I2C_STAGE2_MUX0_CHAN0 + i); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_sff8436(adap); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN4 + i2c_base); + } + } + + /* stage2 mux1 chan0~7 install sff8436 */ + for(i = I2C_STAGE2_MUX1_CHAN8; i <= I2C_STAGE2_MUX1_CHAN15; i++){ + adap_num = find_i2c_mux_adapter_num(I2C_STAGE1_MUX_CHAN5 + i2c_base, I2C_STAGE2_MUX1_CHAN8 + i); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_sff8436(adap); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN5 + i2c_base); + } + } + + /* stage2 mux2 chan0~7 install sff8436 */ + for(i = I2C_STAGE2_MUX2_CHAN16; i <= I2C_STAGE2_MUX2_CHAN23; i++){ + adap_num = find_i2c_mux_adapter_num(I2C_STAGE1_MUX_CHAN6 + i2c_base, I2C_STAGE2_MUX2_CHAN16 + i); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_sff8436(adap); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN6 + i2c_base); + } + } + + /* stage2 mux3 chan0~7 install sff8436 */ + for(i = I2C_STAGE2_MUX3_CHAN24; i <= I2C_STAGE2_MUX3_CHAN31; i++){ + adap_num = find_i2c_mux_adapter_num(I2C_STAGE1_MUX_CHAN7 + i2c_base, I2C_STAGE2_MUX3_CHAN24 + i); + if (adap_num >= 0){ + adap = i2c_get_adapter(adap_num); + if(adap) { + bms_sb_clients[bms_sb_client_index++] = bms_sb_setup_sff8436(adap); + }else{ + pr_err("%s failed to get i2c adap %d.\n", __func__, adap_num); + } + }else{ + pr_err("%s failed to find i2c mux adap number %d.\n", __func__, I2C_STAGE1_MUX_CHAN7 + i2c_base); + } + } +} + +static int __init bms_sb_i2c_init(void) +{ + /* Initial bms_sb_slients array. */ + memset(bms_sb_clients, 0x0, BMS_SB_I2C_CLIENT_NUM); + + bms_sb_setup_devices_ismt(); + mdelay(200); + bms_sb_setup_devices_stage1(); + mdelay(200); + bms_sb_setup_devices_stage2(); + + return 0; +} + +static void __exit bms_sb_i2c_exit(void){ + int i; + + for (i=(bms_sb_client_index-1); i>=0; i--) { + if (bms_sb_clients[i]) { + i2c_unregister_device(bms_sb_clients[i]); + bms_sb_clients[i] = NULL; + } + } + + bms_sb_client_index = 0; + +} + +module_init(bms_sb_i2c_init); +module_exit(bms_sb_i2c_exit); + +MODULE_DESCRIPTION("mitac_ly1200_32x_sb_i2c driver"); +MODULE_AUTHOR("Eddy Weng "); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_slave_cpld.c b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_slave_cpld.c new file mode 100644 index 000000000000..8809573fa4ad --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_slave_cpld.c @@ -0,0 +1,427 @@ +#include +#include + +#include "slave_cpld_reg.h" +#include "slave_cpld_sysfs.h" + +static int debug_flag = 0; + +struct slave_cpld_data { + struct mutex lock; + + struct i2c_client *client; + struct device_attribute bin; +}; + + +static const struct i2c_device_id slave_cpld_ids[] = { + { "slave_cpld", 0 }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, slave_cpld_ids); + +static int slave_cpld_raw_read(struct device *dev, struct device_attribute *attr, char *buf, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name){ + unsigned int reg_val = 0, fld_val; + static int debug_flag; + struct slave_cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int err; + + if (reg_width != 8){ + printk("%s: Register table width setting failed.\n", reg_name); + return -EINVAL; + } + mutex_lock(&data->lock); + if ((err = i2c_smbus_read_byte_data(client, (u8)reg_offset)) < 0) { + /* CPLD read error condition */; + mutex_unlock(&data->lock); + printk("%s: i2c read failed, error code = %d.\n", reg_name, err); + return err; + } + reg_val = err; + if (debug_flag) { + printk("%s: reg_offset = %d, width = %d, cur value = 0x%x.\n", reg_name, reg_offset, reg_width, reg_val); + } + mutex_unlock(&data->lock); + if (fld_width == reg_width) {fld_val = reg_val & fld_mask;} + else {fld_val = (reg_val >> fld_shift) & fld_mask;} + return sprintf(buf, "0x%x\n", fld_val); +} + +static int slave_cpld_raw_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name){ + int ret_code; + unsigned int reg_val, fld_val; + unsigned long val; + static int debug_flag; + struct slave_cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + if (reg_width != 8){ + printk("%s: Register table width setting failed.\n", reg_name); + return -EINVAL; + } + /* Parse buf and store to fld_val */ + if ((ret_code = kstrtoul(buf, 16, &val))){ + printk("%s: Conversion value = %s failed, errno = %d.\n", reg_name, buf, ret_code); + return ret_code; + } + fld_val = (unsigned int)val; + mutex_lock(&data->lock); + if ((ret_code = i2c_smbus_read_byte_data(client, (u8)reg_offset)) < 0) { + /* Handle CPLD read error condition */; + mutex_unlock(&data->lock); + printk("%s: i2c read failed, error code = %d.\n", reg_name, ret_code); + return ret_code; + } + reg_val = ret_code; + if (debug_flag) { + printk("%s: offset = %d, width = %d, cur value = 0x%x.\n", reg_name, reg_offset, reg_width, reg_val); + } + if (fld_width == reg_width) {reg_val = fld_val & fld_mask;} + else {reg_val = (reg_val & ~(fld_mask << fld_shift)) | + ((fld_val & (fld_mask)) << fld_shift);} + if ((ret_code = i2c_smbus_write_byte_data(client, (u8)reg_offset, (u8)reg_val)) != 0) { + /* Handle CPLD write error condition */; + mutex_unlock(&data->lock); + printk("%s: i2c write failed, error code = %d.\n", reg_name, ret_code); + return ret_code; + } + else if (debug_flag) { + printk("%s: offset = %d, width = %d, new value = 0x%x.\n", reg_name, reg_offset, reg_width, reg_val); + } + mutex_unlock(&data->lock); + return count; +} + +/*--------------------special file for debug---------------------- */ +static ssize_t slave_cpld_debug_read(struct device *dev, struct device_attribute *attr, + char *buf){ + + return sprintf(buf, "%d\n", debug_flag); +} + + +static ssize_t slave_cpld_debug_write(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + int temp; + int error; + + error = kstrtoint(buf, 10, &temp); + if (error){ + printk(KERN_INFO "%s: Conversion value = %s failed.\n", __FUNCTION__, buf); + return count; + } + debug_flag = temp; + + if(debug_flag) + printk("%s, debug_flag = %d\n", __FUNCTION__, debug_flag); + + return count; +} +SYSFS_MISC_RW_ATTR_DEF(debug, slave_cpld_debug_read, slave_cpld_debug_write) + + + + +/* ----------------define port group---------------------------- */ +static struct attribute *port17_attributes[] = { + SYSFS_ATTR_PTR(port17_present), /* register: zqsfp28_present_24_17_status */ + SYSFS_ATTR_PTR(port17_rst), /* register: zqsfp28_rst_24_17 */ + SYSFS_ATTR_PTR(port17_modsel), /* register: zqsfp28_modsel_24_17 */ + SYSFS_ATTR_PTR(port17_lpmode), /* register: zqsfp28_lpmode_24_17 */ + SYSFS_ATTR_PTR(port17_irq_status), /* register: zqsfp28_irq_24_17_status */ + SYSFS_ATTR_PTR(port17_irq_msk), /* register: zqsfp28_irq_msk_24_17_status */ + NULL +}; + +static struct attribute *port18_attributes[] = { + SYSFS_ATTR_PTR(port18_present), /* register: zqsfp28_present_24_17_status */ + SYSFS_ATTR_PTR(port18_rst), /* register: zqsfp28_rst_24_17 */ + SYSFS_ATTR_PTR(port18_modsel), /* register: zqsfp28_modsel_24_17 */ + SYSFS_ATTR_PTR(port18_lpmode), /* register: zqsfp28_lpmode_24_17 */ + SYSFS_ATTR_PTR(port18_irq_status), /* register: zqsfp28_irq_24_17_status */ + SYSFS_ATTR_PTR(port18_irq_msk), /* register: zqsfp28_irq_msk_24_17_status */ + NULL +}; + +static struct attribute *port19_attributes[] = { + SYSFS_ATTR_PTR(port19_present), /* register: zqsfp28_present_24_17_status */ + SYSFS_ATTR_PTR(port19_rst), /* register: zqsfp28_rst_24_17 */ + SYSFS_ATTR_PTR(port19_modsel), /* register: zqsfp28_modsel_24_17 */ + SYSFS_ATTR_PTR(port19_lpmode), /* register: zqsfp28_lpmode_24_17 */ + SYSFS_ATTR_PTR(port19_irq_status), /* register: zqsfp28_irq_24_17_status */ + SYSFS_ATTR_PTR(port19_irq_msk), /* register: zqsfp28_irq_msk_24_17_status */ + NULL +}; + +static struct attribute *port20_attributes[] = { + SYSFS_ATTR_PTR(port20_present), /* register: zqsfp28_present_24_17_status */ + SYSFS_ATTR_PTR(port20_rst), /* register: zqsfp28_rst_24_17 */ + SYSFS_ATTR_PTR(port20_modsel), /* register: zqsfp28_modsel_24_17 */ + SYSFS_ATTR_PTR(port20_lpmode), /* register: zqsfp28_lpmode_24_17 */ + SYSFS_ATTR_PTR(port20_irq_status), /* register: zqsfp28_irq_24_17_status */ + SYSFS_ATTR_PTR(port20_irq_msk), /* register: zqsfp28_irq_msk_24_17_status */ + NULL +}; + +static struct attribute *port21_attributes[] = { + SYSFS_ATTR_PTR(port21_present), /* register: zqsfp28_present_24_17_status */ + SYSFS_ATTR_PTR(port21_rst), /* register: zqsfp28_rst_24_17 */ + SYSFS_ATTR_PTR(port21_modsel), /* register: zqsfp28_modsel_24_17 */ + SYSFS_ATTR_PTR(port21_lpmode), /* register: zqsfp28_lpmode_24_17 */ + SYSFS_ATTR_PTR(port21_irq_status), /* register: zqsfp28_irq_24_17_status */ + SYSFS_ATTR_PTR(port21_irq_msk), /* register: zqsfp28_irq_msk_24_17_status */ + NULL +}; + +static struct attribute *port22_attributes[] = { + SYSFS_ATTR_PTR(port22_present), /* register: zqsfp28_present_24_17_status */ + SYSFS_ATTR_PTR(port22_rst), /* register: zqsfp28_rst_24_17 */ + SYSFS_ATTR_PTR(port22_modsel), /* register: zqsfp28_modsel_24_17 */ + SYSFS_ATTR_PTR(port22_lpmode), /* register: zqsfp28_lpmode_24_17 */ + SYSFS_ATTR_PTR(port22_irq_status), /* register: zqsfp28_irq_24_17_status */ + SYSFS_ATTR_PTR(port22_irq_msk), /* register: zqsfp28_irq_msk_24_17_status */ + NULL +}; + +static struct attribute *port23_attributes[] = { + SYSFS_ATTR_PTR(port23_present), /* register: zqsfp28_present_24_17_status */ + SYSFS_ATTR_PTR(port23_rst), /* register: zqsfp28_rst_24_17 */ + SYSFS_ATTR_PTR(port23_modsel), /* register: zqsfp28_modsel_24_17 */ + SYSFS_ATTR_PTR(port23_lpmode), /* register: zqsfp28_lpmode_24_17 */ + SYSFS_ATTR_PTR(port23_irq_status), /* register: zqsfp28_irq_24_17_status */ + SYSFS_ATTR_PTR(port23_irq_msk), /* register: zqsfp28_irq_msk_24_17_status */ + NULL +}; + +static struct attribute *port24_attributes[] = { + SYSFS_ATTR_PTR(port24_present), /* register: zqsfp28_present_24_17_status */ + SYSFS_ATTR_PTR(port24_rst), /* register: zqsfp28_rst_24_17 */ + SYSFS_ATTR_PTR(port24_modsel), /* register: zqsfp28_modsel_24_17 */ + SYSFS_ATTR_PTR(port24_lpmode), /* register: zqsfp28_lpmode_24_17 */ + SYSFS_ATTR_PTR(port24_irq_status), /* register: zqsfp28_irq_24_17_status */ + SYSFS_ATTR_PTR(port24_irq_msk), /* register: zqsfp28_irq_msk_24_17_status */ + NULL +}; + +static struct attribute *port25_attributes[] = { + SYSFS_ATTR_PTR(port25_present), /* register: zqsfp28_present_32_25_status */ + SYSFS_ATTR_PTR(port25_rst), /* register: zqsfp28_rst_32_25 */ + SYSFS_ATTR_PTR(port25_modsel), /* register: zqsfp28_modsel_32_25 */ + SYSFS_ATTR_PTR(port25_lpmode), /* register: zqsfp28_lpmode_32_25 */ + SYSFS_ATTR_PTR(port25_irq_status), /* register: zqsfp28_irq_32_25_status */ + SYSFS_ATTR_PTR(port25_irq_msk), /* register: zqsfp28_irq_msk_32_25_status */ + NULL +}; + +static struct attribute *port26_attributes[] = { + SYSFS_ATTR_PTR(port26_present), /* register: zqsfp28_present_32_25_status */ + SYSFS_ATTR_PTR(port26_rst), /* register: zqsfp28_rst_32_25 */ + SYSFS_ATTR_PTR(port26_modsel), /* register: zqsfp28_modsel_32_25 */ + SYSFS_ATTR_PTR(port26_lpmode), /* register: zqsfp28_lpmode_32_25 */ + SYSFS_ATTR_PTR(port26_irq_status), /* register: zqsfp28_irq_32_25_status */ + SYSFS_ATTR_PTR(port26_irq_msk), /* register: zqsfp28_irq_msk_32_25_status */ + NULL +}; + +static struct attribute *port27_attributes[] = { + SYSFS_ATTR_PTR(port27_present), /* register: zqsfp28_present_32_25_status */ + SYSFS_ATTR_PTR(port27_rst), /* register: zqsfp28_rst_32_25 */ + SYSFS_ATTR_PTR(port27_modsel), /* register: zqsfp28_modsel_32_25 */ + SYSFS_ATTR_PTR(port27_lpmode), /* register: zqsfp28_lpmode_32_25 */ + SYSFS_ATTR_PTR(port27_irq_status), /* register: zqsfp28_irq_32_25_status */ + SYSFS_ATTR_PTR(port27_irq_msk), /* register: zqsfp28_irq_msk_32_25_status */ + NULL +}; + +static struct attribute *port28_attributes[] = { + SYSFS_ATTR_PTR(port28_present), /* register: zqsfp28_present_32_25_status */ + SYSFS_ATTR_PTR(port28_rst), /* register: zqsfp28_rst_32_25 */ + SYSFS_ATTR_PTR(port28_modsel), /* register: zqsfp28_modsel_32_25 */ + SYSFS_ATTR_PTR(port28_lpmode), /* register: zqsfp28_lpmode_32_25 */ + SYSFS_ATTR_PTR(port28_irq_status), /* register: zqsfp28_irq_32_25_status */ + SYSFS_ATTR_PTR(port28_irq_msk), /* register: zqsfp28_irq_msk_32_25_status */ + NULL +}; + +static struct attribute *port29_attributes[] = { + SYSFS_ATTR_PTR(port29_present), /* register: zqsfp28_present_32_25_status */ + SYSFS_ATTR_PTR(port29_rst), /* register: zqsfp28_rst_32_25 */ + SYSFS_ATTR_PTR(port29_modsel), /* register: zqsfp28_modsel_32_25 */ + SYSFS_ATTR_PTR(port29_lpmode), /* register: zqsfp28_lpmode_32_25 */ + SYSFS_ATTR_PTR(port29_irq_status), /* register: zqsfp28_irq_32_25_status */ + SYSFS_ATTR_PTR(port29_irq_msk), /* register: zqsfp28_irq_msk_32_25_status */ + NULL +}; + +static struct attribute *port30_attributes[] = { + SYSFS_ATTR_PTR(port30_present), /* register: zqsfp28_present_32_25_status */ + SYSFS_ATTR_PTR(port30_rst), /* register: zqsfp28_rst_32_25 */ + SYSFS_ATTR_PTR(port30_modsel), /* register: zqsfp28_modsel_32_25 */ + SYSFS_ATTR_PTR(port30_lpmode), /* register: zqsfp28_lpmode_32_25 */ + SYSFS_ATTR_PTR(port30_irq_status), /* register: zqsfp28_irq_32_25_status */ + SYSFS_ATTR_PTR(port30_irq_msk), /* register: zqsfp28_irq_msk_32_25_status */ + NULL +}; + +static struct attribute *port31_attributes[] = { + SYSFS_ATTR_PTR(port31_present), /* register: zqsfp28_present_32_25_status */ + SYSFS_ATTR_PTR(port31_rst), /* register: zqsfp28_rst_32_25 */ + SYSFS_ATTR_PTR(port31_modsel), /* register: zqsfp28_modsel_32_25 */ + SYSFS_ATTR_PTR(port31_lpmode), /* register: zqsfp28_lpmode_32_25 */ + SYSFS_ATTR_PTR(port31_irq_status), /* register: zqsfp28_irq_32_25_status */ + SYSFS_ATTR_PTR(port31_irq_msk), /* register: zqsfp28_irq_msk_32_25_status */ + NULL +}; + +static struct attribute *port32_attributes[] = { + SYSFS_ATTR_PTR(port32_present), /* register: zqsfp28_present_32_25_status */ + SYSFS_ATTR_PTR(port32_rst), /* register: zqsfp28_rst_32_25 */ + SYSFS_ATTR_PTR(port32_modsel), /* register: zqsfp28_modsel_32_25 */ + SYSFS_ATTR_PTR(port32_lpmode), /* register: zqsfp28_lpmode_32_25 */ + SYSFS_ATTR_PTR(port32_irq_status), /* register: zqsfp28_irq_32_25_status */ + SYSFS_ATTR_PTR(port32_irq_msk), /* register: zqsfp28_irq_msk_32_25_status */ + NULL +}; + +static const struct attribute_group slave_cpld_port_group[] = { + {.attrs = port17_attributes, + .name = "port17",}, + {.attrs = port18_attributes, + .name = "port18",}, + {.attrs = port19_attributes, + .name = "port19",}, + {.attrs = port20_attributes, + .name = "port20",}, + {.attrs = port21_attributes, + .name = "port21",}, + {.attrs = port22_attributes, + .name = "port22",}, + {.attrs = port23_attributes, + .name = "port23",}, + {.attrs = port24_attributes, + .name = "port24",}, + {.attrs = port25_attributes, + .name = "port25",}, + {.attrs = port26_attributes, + .name = "port26",}, + {.attrs = port27_attributes, + .name = "port27",}, + {.attrs = port28_attributes, + .name = "port28",}, + {.attrs = port29_attributes, + .name = "port29",}, + {.attrs = port30_attributes, + .name = "port30",}, + {.attrs = port31_attributes, + .name = "port31",}, + {.attrs = port32_attributes, + .name = "port32",} +}; + +/* ----------------define misc group---------------------------- */ +static struct attribute *misc_attributes[] = { + SYSFS_ATTR_PTR(mjr_rev), /* register: slv_cpld_rev */ + SYSFS_ATTR_PTR(mnr_rev), /* register: slv_cpld_rev */ + SYSFS_ATTR_PTR(scrtch_reg), /* register: slv_cpld_gpr */ + SYSFS_ATTR_PTR(brd_rev), /* register: mb_brd_rev_type */ + SYSFS_ATTR_PTR(brd_type), /* register: mb_brd_rev_type */ + + SYSFS_ATTR_PTR(port_17_24_present), /* register: zqsfp28_present_24_17_status */ + SYSFS_ATTR_PTR(port_25_32_present), /* register: zqsfp28_present_32_25_status */ + SYSFS_ATTR_PTR(port_17_24_rst), /* register: zqsfp28_rst_24_17 */ + SYSFS_ATTR_PTR(port_25_32_rst), /* register: zqsfp28_rst_32_25 */ + SYSFS_ATTR_PTR(port_17_24_modsel), /* register: zqsfp28_modsel_24_17 */ + SYSFS_ATTR_PTR(port_25_32_modsel), /* register: zqsfp28_modsel_32_25 */ + SYSFS_ATTR_PTR(port_17_24_irq_status),/* register: zqsfp28_irq_24_17_status */ + SYSFS_ATTR_PTR(port_25_32_irq_status),/* register: zqsfp28_irq_32_25_status */ + SYSFS_ATTR_PTR(port_17_24_irq_msk), /* register: zqsfp28_irq_msk_24_17_status */ + SYSFS_ATTR_PTR(port_25_32_irq_msk), /* register: zqsfp28_irq_msk_32_25_status */ + SYSFS_ATTR_PTR(port_17_24_lpmode), /* register: zqsfp28_lpmode_24_17 */ + SYSFS_ATTR_PTR(port_25_32_lpmode), /* register: zqsfp28_lpmode_32_25 */ + + SYSFS_ATTR_PTR(debug), /* debug flag for print more messages */ + NULL +}; +static const struct attribute_group slave_cpld_group_misc = { + .attrs = misc_attributes, +}; + +static int slave_cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct slave_cpld_data *slave_cpld; + int err, i; + int grp_number = (int)( sizeof(slave_cpld_port_group) / sizeof(slave_cpld_port_group[0])); + + /* allocate memory to slave_cpld */ + slave_cpld = devm_kzalloc(&client->dev, sizeof(struct slave_cpld_data) , GFP_KERNEL); + + if (!slave_cpld) + return -ENOMEM; + + mutex_init(&slave_cpld->lock); + + for(i = 0 ; i < grp_number ; i++){ + err = sysfs_create_group(&client->dev.kobj, &slave_cpld_port_group[i]); + if (err){ + printk("%s: Error creeat port group %d.\n", __FUNCTION__, i+1); + } + } + err = sysfs_create_group(&client->dev.kobj, &slave_cpld_group_misc); + if (err){ + printk("%s: Error creeat misc group.\n", __FUNCTION__); + } + + slave_cpld->client = client; + i2c_set_clientdata(client, slave_cpld); + + printk(KERN_INFO "%s: Slave CPLD LCMXO3LF created.\n", __FUNCTION__); + + return 0; + +} + +static int slave_cpld_remove(struct i2c_client *client) +{ + int i; + int grp_number = (int)( sizeof(slave_cpld_port_group) / sizeof(slave_cpld_port_group[0])); + + for(i = 0 ; i < grp_number ; i++){ + sysfs_remove_group(&client->dev.kobj, &slave_cpld_port_group[i]); + } + sysfs_remove_group(&client->dev.kobj, &slave_cpld_group_misc); + + printk(KERN_INFO "%s: Slave CPLD removed.\n", __FUNCTION__); + return 0; +} + +static struct i2c_driver slave_cpld_driver = { + .driver = { + .name = "slave_cpld", + .owner = THIS_MODULE, + }, + .probe = slave_cpld_probe, + .remove = slave_cpld_remove, + .id_table = slave_cpld_ids, +}; + +static int __init slave_cpld_init(void) +{ + printk(KERN_INFO "%s: init.\n", __FUNCTION__); + return i2c_add_driver(&slave_cpld_driver); +} +module_init(slave_cpld_init); + +static void __exit slave_cpld_exit(void) +{ + printk(KERN_INFO "%s: exit.\n", __FUNCTION__); + i2c_del_driver(&slave_cpld_driver); +} +module_exit(slave_cpld_exit); + +MODULE_DESCRIPTION("mitac_ly1200_32x_slave_cpld driver"); +MODULE_AUTHOR("Eddy Weng "); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_system_cpld.c b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_system_cpld.c new file mode 100644 index 000000000000..e5af8b70bf9a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/mitac_ly1200_32x_system_cpld.c @@ -0,0 +1,541 @@ +#define CONFIG_DRV_SYSCPLD_WDT 1 + +#include +#include + +#include "system_cpld_reg.h" +#include "system_cpld_sysfs.h" +#ifdef CONFIG_DRV_SYSCPLD_WDT +#include +#include +#include +#include +#include +#include +#endif + +static int debug_flag = 0; + +struct system_cpld_data { + struct mutex lock; + + struct i2c_client *client; + struct device_attribute bin; +}; +struct system_cpld_data *system_cpld; + +static const struct i2c_device_id system_cpld_ids[] = { + { "system_cpld", 0 }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, system_cpld_ids); + +static int system_cpld_raw_read(struct device *dev, struct device_attribute *attr, char *buf, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name){ + unsigned int reg_val = 0, fld_val; + static int debug_flag; + struct system_cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int err; + + if (reg_width != 8){ + printk("%s: Register table width setting failed.\n", reg_name); + return -EINVAL; + } + mutex_lock(&data->lock); + if ((err = i2c_smbus_read_byte_data(client, (u8)reg_offset)) < 0) { + /* CPLD read error condition */; + mutex_unlock(&data->lock); + printk("%s: i2c read failed, error code = %d.\n", reg_name, err); + return err; + } + reg_val = err; + if (debug_flag) { + printk("%s: reg_offset = %d, width = %d, cur value = 0x%x.\n", reg_name, reg_offset, reg_width, reg_val); + } + mutex_unlock(&data->lock); + if (fld_width == reg_width) {fld_val = reg_val & fld_mask;} + else {fld_val = (reg_val >> fld_shift) & fld_mask;} + return sprintf(buf, "0x%x\n", fld_val); +} + +static int system_cpld_raw_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name){ + int ret_code; + unsigned int reg_val, fld_val; + unsigned long val; + static int debug_flag; + struct system_cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + if (reg_width != 8){ + printk("%s: Register table width setting failed.\n", reg_name); + return -EINVAL; + } + /* Parse buf and store to fld_val */ + if ((ret_code = kstrtoul(buf, 16, &val))){ + printk("%s: Conversion value = %s failed, errno = %d.\n", reg_name, buf, ret_code); + return ret_code; + } + fld_val = (unsigned int)val; + mutex_lock(&data->lock); + if ((ret_code = i2c_smbus_read_byte_data(client, (u8)reg_offset)) < 0) { + /* Handle CPLD read error condition */; + mutex_unlock(&data->lock); + printk("%s: i2c read failed, error code = %d.\n", reg_name, ret_code); + return ret_code; + } + reg_val = ret_code; + if (debug_flag) { + printk("%s: offset = %d, width = %d, cur value = 0x%x.\n", reg_name, reg_offset, reg_width, reg_val); + } + if (fld_width == reg_width) {reg_val = fld_val & fld_mask;} + else {reg_val = (reg_val & ~(fld_mask << fld_shift)) | + ((fld_val & (fld_mask)) << fld_shift);} + if ((ret_code = i2c_smbus_write_byte_data(client, (u8)reg_offset, (u8)reg_val)) != 0) { + /* Handle CPLD write error condition */; + mutex_unlock(&data->lock); + printk("%s: i2c write failed, error code = %d.\n", reg_name, ret_code); + return ret_code; + } + else if (debug_flag) { + printk("%s: offset = %d, width = %d, new value = 0x%x.\n", reg_name, reg_offset, reg_width, reg_val); + } + mutex_unlock(&data->lock); + return count; +} + +/*--------------------special file for debug---------------------- */ +static ssize_t system_cpld_debug_read(struct device *dev, struct device_attribute *attr, + char *buf){ + + return sprintf(buf, "%d\n", debug_flag); +} + + +static ssize_t system_cpld_debug_write(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + int temp; + int error; + + error = kstrtoint(buf, 10, &temp); + if (error){ + printk(KERN_INFO "%s: Conversion value = %s failed.\n", __FUNCTION__, buf); + return count; + } + debug_flag = temp; + + if(debug_flag) + printk("%s, debug_flag = %d\n", __FUNCTION__, debug_flag); + + return count; +} +SYSFS_MISC_RW_ATTR_DEF(debug, system_cpld_debug_read, system_cpld_debug_write) + + +/* ----------------define misc group---------------------------- */ +static struct attribute *misc_attributes[] = { + SYSFS_ATTR_PTR(mjr_rev), /* register: sys_cpld_rev */ + SYSFS_ATTR_PTR(mnr_rev), /* register: sys_cpld_rev */ + + SYSFS_ATTR_PTR(scrtch_reg), /* register: sys_cpld_gpr */ + + SYSFS_ATTR_PTR(brd_rev), /* register: cpu_brd_rev_type */ + SYSFS_ATTR_PTR(brd_type), /* register: cpu_brd_rev_type */ + + SYSFS_ATTR_PTR(ssd_present), /* register: sys_srr */ + SYSFS_ATTR_PTR(spi_cs_sel), /* register: sys_srr */ + SYSFS_ATTR_PTR(rst_bios_switch), /* register: sys_srr */ + SYSFS_ATTR_PTR(cpld_upgrade_rst), /* register: sys_srr */ + + SYSFS_ATTR_PTR(cpld_spi_wp), /* register: sys_eeprom_wp */ + SYSFS_ATTR_PTR(system_id_eeprom_wp), /* register: sys_eeprom_wp */ + SYSFS_ATTR_PTR(spi_me_wp), /* register: sys_eeprom_wp */ + SYSFS_ATTR_PTR(spi_bios_wp), /* register: sys_eeprom_wp */ + SYSFS_ATTR_PTR(spi_bak_bios_wp), /* register: sys_eeprom_wp */ + + SYSFS_ATTR_PTR(vrhot_irq_en), /* register: sys_irq */ + SYSFS_ATTR_PTR(cpu_thermtrip_irq_en), /* register: sys_irq */ + SYSFS_ATTR_PTR(temp_alert_irq_en), /* register: sys_irq */ + SYSFS_ATTR_PTR(vrhot_irq), /* register: sys_irq */ + SYSFS_ATTR_PTR(cpu_thermtrip_irq), /* register: sys_irq */ + SYSFS_ATTR_PTR(temp_alert_irq), /* register: sys_irq */ + + SYSFS_ATTR_PTR(wd_timer), /* register: sys_wd */ + SYSFS_ATTR_PTR(wd_en), /* register: sys_wd */ + SYSFS_ATTR_PTR(wd_punch), /* register: sys_wd */ + + SYSFS_ATTR_PTR(mb_rst_en), /* register: sys_mb_rst_en */ + + SYSFS_ATTR_PTR(pwr_v3p3_en), /* register: cpu_pwr_en_status */ + SYSFS_ATTR_PTR(pwr_vcc_vnn_en), /* register: cpu_pwr_en_status */ + SYSFS_ATTR_PTR(pwr_vccsram_en), /* register: cpu_pwr_en_status */ + SYSFS_ATTR_PTR(pwr_vddq_en), /* register: cpu_pwr_en_status */ + SYSFS_ATTR_PTR(pwr_vcc_ref_en), /* register: cpu_pwr_en_status */ + SYSFS_ATTR_PTR(pwr_v1p05_en), /* register: cpu_pwr_en_status */ + SYSFS_ATTR_PTR(pwr_v1p8_en), /* register: cpu_pwr_en_status */ + SYSFS_ATTR_PTR(pwr_v2p5_en), /* register: cpu_pwr_en_status */ + + SYSFS_ATTR_PTR(pg_v3p3), /* register: cpu_pwr_status */ + SYSFS_ATTR_PTR(pg_vcc_vnn), /* register: cpu_pwr_status */ + SYSFS_ATTR_PTR(pg_vccsram), /* register: cpu_pwr_status */ + SYSFS_ATTR_PTR(pg_vddq), /* register: cpu_pwr_status */ + SYSFS_ATTR_PTR(pg_vcc_ref), /* register: cpu_pwr_status */ + SYSFS_ATTR_PTR(pg_v1p05), /* register: cpu_pwr_status */ + SYSFS_ATTR_PTR(pg_v1p8), /* register: cpu_pwr_status */ + SYSFS_ATTR_PTR(pg_v2p5), /* register: cpu_pwr_status */ + + SYSFS_ATTR_PTR(debug), /* debug flag for print more messages */ + NULL +}; +static const struct attribute_group system_cpld_group_misc = { + .attrs = misc_attributes, +}; + +#ifdef CONFIG_DRV_SYSCPLD_WDT +/* + ***************************************************************************** + * + * Watchdog Driver + * + ***************************************************************************** + */ +/* wdt_timeout[] are defined by CPLD spec , -1 means researved + 300 sec is not supported */ +int wdt_timeout[]={15,30,60,90,120,180,240,300,-1,-1,-1,-1,-1,-1,-1,-1}; +#define WD_TIMO_MAX_NUM 16 +/* Default margin */ +#define WD_TIMO 30 + +static int wdt_margin = WD_TIMO; +module_param(wdt_margin, int, 0); +MODULE_PARM_DESC(wdt_margin, "Watchdog timeout in seconds (default " + __MODULE_STRING(WD_TIMO) "s)"); + +static unsigned long wdt_is_open; +static int boot_flag; + +/** + * wdt_ping: + * + * Reload counter one with the watchdog timeout. We don't bother reloading + * the cascade counter. + */ +static void wdt_ping(void) +{ + struct device *dev = &system_cpld->client->dev; + struct device_attribute *fake_attr=NULL; + char *buf="0";/* 0: punch is defined by CPLD spec */ + int err; + err = system_cpld_wd_punch_raw_write(dev, fake_attr, buf, (size_t)0); + if(err < 0){ + system_cpld_wd_punch_raw_write(dev, fake_attr, buf, (size_t)0); + } +} + +/** + * wdt_disable: + * + * disables watchdog. + */ +static void wdt_disable(void) +{ + struct device *dev = &system_cpld->client->dev; + struct device_attribute *fake_attr=NULL; + char *buf="0";/* 0: disable is defined by CPLD spec */ + int err; + err = system_cpld_wd_en_raw_write(dev, fake_attr, buf, (size_t)0); + if(err < 0){ + system_cpld_wd_en_raw_write(dev, fake_attr, buf, (size_t)0); + } +} + +/** + * wdt_enable: + * + * enables watchdog. + */ +static void wdt_enable(void) +{ + struct device *dev = &system_cpld->client->dev; + struct device_attribute *fake_attr=NULL; + char *buf="1";/* 1: enable is defined by CPLD spec */ + int err; + err = system_cpld_wd_en_raw_write(dev, fake_attr, buf, (size_t)0); + if(err < 0){ + system_cpld_wd_en_raw_write(dev, fake_attr, buf, (size_t)0); + } +} + +/** + * wdt_set_timeout: + * + * set watchdog timeout. + */ +static void wdt_set_timeout(int index) +{ + struct device *dev = &system_cpld->client->dev; + struct device_attribute *fake_attr=NULL; + char buf[1]; + if ( WD_TIMO_MAX_NUM == 16 ) { + sprintf(buf,"%x",index); + system_cpld_wd_timer_raw_write(dev, fake_attr, buf, (size_t)0); + } + else + printk(KERN_INFO "%s: It is out of spec.\n", __FUNCTION__); +} + +/** + * wdt_write: + * @file: file handle to the watchdog + * @buf: buffer to write (unused as data does not matter here + * @count: count of bytes + * @ppos: pointer to the position to write. No seeks allowed + * + * A write to a watchdog device is defined as a keepalive signal. Any + * write of data will do, as we we don't define content meaning. + */ +static ssize_t wdt_write(struct file *file, const char __user *buf, + size_t count, loff_t *ppos) +{ + if (count) { + wdt_ping(); + return 1; + } + return 0; +} + +/** + * wdt_ioctl: + * @inode: inode of the device + * @file: file handle to the device + * @cmd: watchdog command + * @arg: argument pointer + * + * The watchdog API defines a common set of functions for all watchdogs + * according to their available features. We only actually usefully support + * querying capabilities and current status. + */ +static int wdt_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + int new_margin, rv, i; + static struct watchdog_info ident = { + .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, + .firmware_version = 1, + .identity = "SYS_CPLD WTD" + }; + + switch (cmd) { + case WDIOC_GETSUPPORT: + return copy_to_user((struct watchdog_info __user *)arg, &ident, + sizeof(ident)) ? -EFAULT : 0; + + case WDIOC_GETSTATUS: + case WDIOC_GETBOOTSTATUS: + return put_user(boot_flag, (int __user *)arg); + case WDIOC_KEEPALIVE: + wdt_ping(); + return 0; + case WDIOC_SETTIMEOUT: + if (get_user(new_margin, (int __user *)arg)) + return -EFAULT; + /* Arbitrary, can't find the card's limits */ + if (new_margin <= 1) + return -EINVAL; + for( i=0; i= WD_TIMO_MAX_NUM || i < 0 ) + return -EINVAL; + wdt_set_timeout(i); + case WDIOC_GETTIMEOUT: + return put_user(wdt_margin, (int __user *)arg); + + case WDIOC_SETOPTIONS: + if (copy_from_user(&rv, (int __user *)arg, sizeof(int))) + return -EFAULT; + + if (rv & WDIOS_DISABLECARD) { + pr_info("System CPLD: disable watchdog\n"); + wdt_disable(); + } + + if (rv & WDIOS_ENABLECARD) { + pr_info("System CPLD: enable watchdog\n"); + wdt_enable(); + } + return -EINVAL; + } + return -ENOTTY; +} + +static long wdt_unlocked_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + int ret; + + ret = wdt_ioctl(file, cmd, arg); + + return ret; +} + +/** + * wdt_open: + * @inode: inode of device + * @file: file handle to device + * + */ +static int wdt_open(struct inode *inode, struct file *file) +{ + if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) { + if (test_and_set_bit(0, &wdt_is_open)) { + return -EBUSY; + } + /* + * Activate + */ + + wdt_enable(); + return nonseekable_open(inode, file); + } + return -ENODEV; +} + +/** + * wdt_close: + * @inode: inode to board + * @file: file handle to board + * + */ +static int wdt_release(struct inode *inode, struct file *file) +{ + if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) + clear_bit(0, &wdt_is_open); + return 0; +} + +/** + * notify_sys: + * @this: our notifier block + * @code: the event being reported + * @unused: unused + * + * Our notifier is called on system shutdowns. We want to turn the card + * off at reboot otherwise the machine will reboot again during memory + * test or worse yet during the following fsck. This would suck, in fact + * trust me - if it happens it does suck. + */ +static int wdt_notify_sys(struct notifier_block *this, unsigned long code, + void *unused) +{ + if (code == SYS_DOWN || code == SYS_HALT) + /* Disable Watchdog */ + wdt_disable(); + return NOTIFY_DONE; +} + +static const struct file_operations wdt_fops = { + .owner = THIS_MODULE, + .llseek = no_llseek, + .write = wdt_write, + .unlocked_ioctl = wdt_unlocked_ioctl, + .open = wdt_open, + .release = wdt_release, +}; + +static struct miscdevice wdt_dev = { + .minor = WATCHDOG_MINOR, + .name = "watchdog", + .fops = &wdt_fops, +}; + +/* + * The WDT card needs to learn about soft shutdowns in order to + * turn the timebomb registers off. + */ +static struct notifier_block wdt_notifier = { + .notifier_call = wdt_notify_sys, +}; +#endif /* CONFIG_DRV_SYSCPLD_WDT */ + +static int system_cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + int err; + + /* allocate memory to system_cpld */ + system_cpld = devm_kzalloc(&client->dev, sizeof(struct system_cpld_data) , GFP_KERNEL); + + if (!system_cpld) + return -ENOMEM; + + mutex_init(&system_cpld->lock); + + err = sysfs_create_group(&client->dev.kobj, &system_cpld_group_misc); + if (err){ + printk("%s: Error creeat misc group.\n", __FUNCTION__); + } + + system_cpld->client = client; + i2c_set_clientdata(client, system_cpld); + + printk(KERN_INFO "%s: System CPLD LCMXO3LF created.\n", __FUNCTION__); + +#ifdef CONFIG_DRV_SYSCPLD_WDT + err = misc_register(&wdt_dev); + if (err) + return err; + err = register_reboot_notifier(&wdt_notifier); + if (err) { + misc_deregister(&wdt_dev); + return err; + } + printk(KERN_INFO "%s: System CPLD watchdog created.\n", __FUNCTION__); +#endif + + return 0; + +} + +static int system_cpld_remove(struct i2c_client *client) +{ +#ifdef CONFIG_DRV_SYSCPLD_WDT + misc_deregister(&wdt_dev); + unregister_reboot_notifier(&wdt_notifier); +#endif + sysfs_remove_group(&client->dev.kobj, &system_cpld_group_misc); + + printk(KERN_INFO "%s: System CPLD removed.\n", __FUNCTION__); + return 0; +} + +static struct i2c_driver system_cpld_driver = { + .driver = { + .name = "system_cpld", + .owner = THIS_MODULE, + }, + .probe = system_cpld_probe, + .remove = system_cpld_remove, + .id_table = system_cpld_ids, +}; + +static int __init system_cpld_init(void) +{ + printk(KERN_INFO "%s: init.\n", __FUNCTION__); + return i2c_add_driver(&system_cpld_driver); +} +module_init(system_cpld_init); + +static void __exit system_cpld_exit(void) +{ + printk(KERN_INFO "%s: exit.\n", __FUNCTION__); + i2c_del_driver(&system_cpld_driver); +} +module_exit(system_cpld_exit); + +MODULE_DESCRIPTION("mitac_ly1200_32x_system_cpld driver"); +MODULE_AUTHOR("Eddy Weng "); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/pmbus.h b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/pmbus.h new file mode 100644 index 000000000000..55cb8663e6e9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/pmbus.h @@ -0,0 +1,366 @@ +#ifndef PMBUS_H +#define PMBUS_H + +/* + * Registers + */ +#define PMBUS_PAGE 0x00 +#define PMBUS_OPERATION 0x01 +#define PMBUS_ON_OFF_CONFIG 0x02 +#define PMBUS_CLEAR_FAULTS 0x03 +#define PMBUS_PHASE 0x04 + +#define PMBUS_CAPABILITY 0x19 +#define PMBUS_QUERY 0x1A + +#define PMBUS_VOUT_MODE 0x20 +#define PMBUS_VOUT_COMMAND 0x21 +#define PMBUS_VOUT_TRIM 0x22 +#define PMBUS_VOUT_CAL_OFFSET 0x23 +#define PMBUS_VOUT_MAX 0x24 +#define PMBUS_VOUT_MARGIN_HIGH 0x25 +#define PMBUS_VOUT_MARGIN_LOW 0x26 +#define PMBUS_VOUT_TRANSITION_RATE 0x27 +#define PMBUS_VOUT_DROOP 0x28 +#define PMBUS_VOUT_SCALE_LOOP 0x29 +#define PMBUS_VOUT_SCALE_MONITOR 0x2A + +#define PMBUS_COEFFICIENTS 0x30 +#define PMBUS_POUT_MAX 0x31 + +#define PMBUS_FAN_CONFIG_12 0x3A +#define PMBUS_FAN_COMMAND_1 0x3B +#define PMBUS_FAN_COMMAND_2 0x3C +#define PMBUS_FAN_CONFIG_34 0x3D +#define PMBUS_FAN_COMMAND_3 0x3E +#define PMBUS_FAN_COMMAND_4 0x3F + +#define PMBUS_VOUT_OV_FAULT_LIMIT 0x40 +#define PMBUS_VOUT_OV_FAULT_RESPONSE 0x41 +#define PMBUS_VOUT_OV_WARN_LIMIT 0x42 +#define PMBUS_VOUT_UV_WARN_LIMIT 0x43 +#define PMBUS_VOUT_UV_FAULT_LIMIT 0x44 +#define PMBUS_VOUT_UV_FAULT_RESPONSE 0x45 +#define PMBUS_IOUT_OC_FAULT_LIMIT 0x46 +#define PMBUS_IOUT_OC_FAULT_RESPONSE 0x47 +#define PMBUS_IOUT_OC_LV_FAULT_LIMIT 0x48 +#define PMBUS_IOUT_OC_LV_FAULT_RESPONSE 0x49 +#define PMBUS_IOUT_OC_WARN_LIMIT 0x4A +#define PMBUS_IOUT_UC_FAULT_LIMIT 0x4B +#define PMBUS_IOUT_UC_FAULT_RESPONSE 0x4C + +#define PMBUS_OT_FAULT_LIMIT 0x4F +#define PMBUS_OT_FAULT_RESPONSE 0x50 +#define PMBUS_OT_WARN_LIMIT 0x51 +#define PMBUS_UT_WARN_LIMIT 0x52 +#define PMBUS_UT_FAULT_LIMIT 0x53 +#define PMBUS_UT_FAULT_RESPONSE 0x54 +#define PMBUS_VIN_OV_FAULT_LIMIT 0x55 +#define PMBUS_VIN_OV_FAULT_RESPONSE 0x56 +#define PMBUS_VIN_OV_WARN_LIMIT 0x57 +#define PMBUS_VIN_UV_WARN_LIMIT 0x58 +#define PMBUS_VIN_UV_FAULT_LIMIT 0x59 + +#define PMBUS_IIN_OC_FAULT_LIMIT 0x5B +#define PMBUS_IIN_OC_WARN_LIMIT 0x5D + +#define PMBUS_POUT_OP_FAULT_LIMIT 0x68 +#define PMBUS_POUT_OP_WARN_LIMIT 0x6A +#define PMBUS_PIN_OP_WARN_LIMIT 0x6B + +#define PMBUS_STATUS_BYTE 0x78 +#define PMBUS_STATUS_WORD 0x79 +#define PMBUS_STATUS_VOUT 0x7A +#define PMBUS_STATUS_IOUT 0x7B +#define PMBUS_STATUS_INPUT 0x7C +#define PMBUS_STATUS_TEMPERATURE 0x7D +#define PMBUS_STATUS_CML 0x7E +#define PMBUS_STATUS_OTHER 0x7F +#define PMBUS_STATUS_MFR_SPECIFIC 0x80 +#define PMBUS_STATUS_FAN_12 0x81 +#define PMBUS_STATUS_FAN_34 0x82 + +#define PMBUS_READ_VIN 0x88 +#define PMBUS_READ_IIN 0x89 +#define PMBUS_READ_VCAP 0x8A +#define PMBUS_READ_VOUT 0x8B +#define PMBUS_READ_IOUT 0x8C +#define PMBUS_READ_TEMPERATURE_1 0x8D +#define PMBUS_READ_TEMPERATURE_2 0x8E +#define PMBUS_READ_TEMPERATURE_3 0x8F +#define PMBUS_READ_FAN_SPEED_1 0x90 +#define PMBUS_READ_FAN_SPEED_2 0x91 +#define PMBUS_READ_FAN_SPEED_3 0x92 +#define PMBUS_READ_FAN_SPEED_4 0x93 +#define PMBUS_READ_DUTY_CYCLE 0x94 +#define PMBUS_READ_FREQUENCY 0x95 +#define PMBUS_READ_POUT 0x96 +#define PMBUS_READ_PIN 0x97 + +#define PMBUS_REVISION 0x98 +#define PMBUS_MFR_ID 0x99 +#define PMBUS_MFR_MODEL 0x9A +#define PMBUS_MFR_REVISION 0x9B +#define PMBUS_MFR_LOCATION 0x9C +#define PMBUS_MFR_DATE 0x9D +#define PMBUS_MFR_SERIAL 0x9E + +/* + * Virtual registers. + * Useful to support attributes which are not supported by standard PMBus + * registers but exist as manufacturer specific registers on individual chips. + * Must be mapped to real registers in device specific code. + * + * Semantics: + * Virtual registers are all word size. + * READ registers are read-only; writes are either ignored or return an error. + * RESET registers are read/write. Reading reset registers returns zero + * (used for detection), writing any value causes the associated history to be + * reset. + * Virtual registers have to be handled in device specific driver code. Chip + * driver code returns non-negative register values if a virtual register is + * supported, or a negative error code if not. The chip driver may return + * -ENODATA or any other error code in this case, though an error code other + * than -ENODATA is handled more efficiently and thus preferred. Either case, + * the calling PMBus core code will abort if the chip driver returns an error + * code when reading or writing virtual registers. + */ +#define PMBUS_VIRT_BASE 0x100 +#define PMBUS_VIRT_READ_TEMP_AVG (PMBUS_VIRT_BASE + 0) +#define PMBUS_VIRT_READ_TEMP_MIN (PMBUS_VIRT_BASE + 1) +#define PMBUS_VIRT_READ_TEMP_MAX (PMBUS_VIRT_BASE + 2) +#define PMBUS_VIRT_RESET_TEMP_HISTORY (PMBUS_VIRT_BASE + 3) +#define PMBUS_VIRT_READ_VIN_AVG (PMBUS_VIRT_BASE + 4) +#define PMBUS_VIRT_READ_VIN_MIN (PMBUS_VIRT_BASE + 5) +#define PMBUS_VIRT_READ_VIN_MAX (PMBUS_VIRT_BASE + 6) +#define PMBUS_VIRT_RESET_VIN_HISTORY (PMBUS_VIRT_BASE + 7) +#define PMBUS_VIRT_READ_IIN_AVG (PMBUS_VIRT_BASE + 8) +#define PMBUS_VIRT_READ_IIN_MIN (PMBUS_VIRT_BASE + 9) +#define PMBUS_VIRT_READ_IIN_MAX (PMBUS_VIRT_BASE + 10) +#define PMBUS_VIRT_RESET_IIN_HISTORY (PMBUS_VIRT_BASE + 11) +#define PMBUS_VIRT_READ_PIN_AVG (PMBUS_VIRT_BASE + 12) +#define PMBUS_VIRT_READ_PIN_MAX (PMBUS_VIRT_BASE + 13) +#define PMBUS_VIRT_RESET_PIN_HISTORY (PMBUS_VIRT_BASE + 14) +#define PMBUS_VIRT_READ_POUT_AVG (PMBUS_VIRT_BASE + 15) +#define PMBUS_VIRT_READ_POUT_MAX (PMBUS_VIRT_BASE + 16) +#define PMBUS_VIRT_RESET_POUT_HISTORY (PMBUS_VIRT_BASE + 17) +#define PMBUS_VIRT_READ_VOUT_AVG (PMBUS_VIRT_BASE + 18) +#define PMBUS_VIRT_READ_VOUT_MIN (PMBUS_VIRT_BASE + 19) +#define PMBUS_VIRT_READ_VOUT_MAX (PMBUS_VIRT_BASE + 20) +#define PMBUS_VIRT_RESET_VOUT_HISTORY (PMBUS_VIRT_BASE + 21) +#define PMBUS_VIRT_READ_IOUT_AVG (PMBUS_VIRT_BASE + 22) +#define PMBUS_VIRT_READ_IOUT_MIN (PMBUS_VIRT_BASE + 23) +#define PMBUS_VIRT_READ_IOUT_MAX (PMBUS_VIRT_BASE + 24) +#define PMBUS_VIRT_RESET_IOUT_HISTORY (PMBUS_VIRT_BASE + 25) +#define PMBUS_VIRT_READ_TEMP2_AVG (PMBUS_VIRT_BASE + 26) +#define PMBUS_VIRT_READ_TEMP2_MIN (PMBUS_VIRT_BASE + 27) +#define PMBUS_VIRT_READ_TEMP2_MAX (PMBUS_VIRT_BASE + 28) +#define PMBUS_VIRT_RESET_TEMP2_HISTORY (PMBUS_VIRT_BASE + 29) + +#define PMBUS_VIRT_READ_VMON (PMBUS_VIRT_BASE + 30) +#define PMBUS_VIRT_VMON_UV_WARN_LIMIT (PMBUS_VIRT_BASE + 31) +#define PMBUS_VIRT_VMON_OV_WARN_LIMIT (PMBUS_VIRT_BASE + 32) +#define PMBUS_VIRT_VMON_UV_FAULT_LIMIT (PMBUS_VIRT_BASE + 33) +#define PMBUS_VIRT_VMON_OV_FAULT_LIMIT (PMBUS_VIRT_BASE + 34) +#define PMBUS_VIRT_STATUS_VMON (PMBUS_VIRT_BASE + 35) + +/* + * CAPABILITY + */ +#define PB_CAPABILITY_SMBALERT (1<<4) +#define PB_CAPABILITY_ERROR_CHECK (1<<7) + +/* + * VOUT_MODE + */ +#define PB_VOUT_MODE_MODE_MASK 0xe0 +#define PB_VOUT_MODE_PARAM_MASK 0x1f + +#define PB_VOUT_MODE_LINEAR 0x00 +#define PB_VOUT_MODE_VID 0x20 +#define PB_VOUT_MODE_DIRECT 0x40 + +/* + * Fan configuration + */ +#define PB_FAN_2_PULSE_MASK ((1 << 0) | (1 << 1)) +#define PB_FAN_2_RPM (1 << 2) +#define PB_FAN_2_INSTALLED (1 << 3) +#define PB_FAN_1_PULSE_MASK ((1 << 4) | (1 << 5)) +#define PB_FAN_1_RPM (1 << 6) +#define PB_FAN_1_INSTALLED (1 << 7) + +/* + * STATUS_BYTE, STATUS_WORD (lower) + */ +#define PB_STATUS_NONE_ABOVE (1<<0) +#define PB_STATUS_CML (1<<1) +#define PB_STATUS_TEMPERATURE (1<<2) +#define PB_STATUS_VIN_UV (1<<3) +#define PB_STATUS_IOUT_OC (1<<4) +#define PB_STATUS_VOUT_OV (1<<5) +#define PB_STATUS_OFF (1<<6) +#define PB_STATUS_BUSY (1<<7) + +/* + * STATUS_WORD (upper) + */ +#define PB_STATUS_UNKNOWN (1<<8) +#define PB_STATUS_OTHER (1<<9) +#define PB_STATUS_FANS (1<<10) +#define PB_STATUS_POWER_GOOD_N (1<<11) +#define PB_STATUS_WORD_MFR (1<<12) +#define PB_STATUS_INPUT (1<<13) +#define PB_STATUS_IOUT_POUT (1<<14) +#define PB_STATUS_VOUT (1<<15) + +/* + * STATUS_IOUT + */ +#define PB_POUT_OP_WARNING (1<<0) +#define PB_POUT_OP_FAULT (1<<1) +#define PB_POWER_LIMITING (1<<2) +#define PB_CURRENT_SHARE_FAULT (1<<3) +#define PB_IOUT_UC_FAULT (1<<4) +#define PB_IOUT_OC_WARNING (1<<5) +#define PB_IOUT_OC_LV_FAULT (1<<6) +#define PB_IOUT_OC_FAULT (1<<7) + +/* + * STATUS_VOUT, STATUS_INPUT + */ +#define PB_VOLTAGE_UV_FAULT (1<<4) +#define PB_VOLTAGE_UV_WARNING (1<<5) +#define PB_VOLTAGE_OV_WARNING (1<<6) +#define PB_VOLTAGE_OV_FAULT (1<<7) + +/* + * STATUS_INPUT + */ +#define PB_PIN_OP_WARNING (1<<0) +#define PB_IIN_OC_WARNING (1<<1) +#define PB_IIN_OC_FAULT (1<<2) + +/* + * STATUS_TEMPERATURE + */ +#define PB_TEMP_UT_FAULT (1<<4) +#define PB_TEMP_UT_WARNING (1<<5) +#define PB_TEMP_OT_WARNING (1<<6) +#define PB_TEMP_OT_FAULT (1<<7) + +/* + * STATUS_FAN + */ +#define PB_FAN_AIRFLOW_WARNING (1<<0) +#define PB_FAN_AIRFLOW_FAULT (1<<1) +#define PB_FAN_FAN2_SPEED_OVERRIDE (1<<2) +#define PB_FAN_FAN1_SPEED_OVERRIDE (1<<3) +#define PB_FAN_FAN2_WARNING (1<<4) +#define PB_FAN_FAN1_WARNING (1<<5) +#define PB_FAN_FAN2_FAULT (1<<6) +#define PB_FAN_FAN1_FAULT (1<<7) + +/* + * CML_FAULT_STATUS + */ +#define PB_CML_FAULT_OTHER_MEM_LOGIC (1<<0) +#define PB_CML_FAULT_OTHER_COMM (1<<1) +#define PB_CML_FAULT_PROCESSOR (1<<3) +#define PB_CML_FAULT_MEMORY (1<<4) +#define PB_CML_FAULT_PACKET_ERROR (1<<5) +#define PB_CML_FAULT_INVALID_DATA (1<<6) +#define PB_CML_FAULT_INVALID_COMMAND (1<<7) + +enum pmbus_sensor_classes { + PSC_VOLTAGE_IN = 0, + PSC_VOLTAGE_OUT, + PSC_CURRENT_IN, + PSC_CURRENT_OUT, + PSC_POWER, + PSC_TEMPERATURE, + PSC_FAN, + PSC_NUM_CLASSES /* Number of power sensor classes */ +}; + +#define PMBUS_PAGES 32 /* Per PMBus specification */ + +/* Functionality bit mask */ +#define PMBUS_HAVE_VIN (1 << 0) +#define PMBUS_HAVE_VCAP (1 << 1) +#define PMBUS_HAVE_VOUT (1 << 2) +#define PMBUS_HAVE_IIN (1 << 3) +#define PMBUS_HAVE_IOUT (1 << 4) +#define PMBUS_HAVE_PIN (1 << 5) +#define PMBUS_HAVE_POUT (1 << 6) +#define PMBUS_HAVE_FAN12 (1 << 7) +#define PMBUS_HAVE_FAN34 (1 << 8) +#define PMBUS_HAVE_TEMP (1 << 9) +#define PMBUS_HAVE_TEMP2 (1 << 10) +#define PMBUS_HAVE_TEMP3 (1 << 11) +#define PMBUS_HAVE_STATUS_VOUT (1 << 12) +#define PMBUS_HAVE_STATUS_IOUT (1 << 13) +#define PMBUS_HAVE_STATUS_INPUT (1 << 14) +#define PMBUS_HAVE_STATUS_TEMP (1 << 15) +#define PMBUS_HAVE_STATUS_FAN12 (1 << 16) +#define PMBUS_HAVE_STATUS_FAN34 (1 << 17) +#define PMBUS_HAVE_VMON (1 << 18) +#define PMBUS_HAVE_STATUS_VMON (1 << 19) + +enum pmbus_data_format { linear = 0, direct, vid }; + +struct pmbus_driver_info { + int pages; /* Total number of pages */ + enum pmbus_data_format format[PSC_NUM_CLASSES]; + /* + * Support one set of coefficients for each sensor type + * Used for chips providing data in direct mode. + */ + int m[PSC_NUM_CLASSES]; /* mantissa for direct data format */ + int b[PSC_NUM_CLASSES]; /* offset */ + int R[PSC_NUM_CLASSES]; /* exponent */ + + u32 func[PMBUS_PAGES]; /* Functionality, per page */ + /* + * The following functions map manufacturing specific register values + * to PMBus standard register values. Specify only if mapping is + * necessary. + * Functions return the register value (read) or zero (write) if + * successful. A return value of -ENODATA indicates that there is no + * manufacturer specific register, but that a standard PMBus register + * may exist. Any other negative return value indicates that the + * register does not exist, and that no attempt should be made to read + * the standard register. + */ + int (*read_byte_data)(struct i2c_client *client, int page, int reg); + int (*read_word_data)(struct i2c_client *client, int page, int reg); + int (*write_word_data)(struct i2c_client *client, int page, int reg, + u16 word); + int (*write_byte)(struct i2c_client *client, int page, u8 value); + /* + * The identify function determines supported PMBus functionality. + * This function is only necessary if a chip driver supports multiple + * chips, and the chip functionality is not pre-determined. + */ + int (*identify)(struct i2c_client *client, + struct pmbus_driver_info *info); +}; + +/* Function declarations */ + +void pmbus_clear_cache(struct i2c_client *client); +int pmbus_set_page(struct i2c_client *client, u8 page); +int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 reg); +int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word); +int pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg); +int pmbus_write_byte(struct i2c_client *client, int page, u8 value); +void pmbus_clear_faults(struct i2c_client *client); +bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg); +bool pmbus_check_word_register(struct i2c_client *client, int page, int reg); +int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, + struct pmbus_driver_info *info); +int pmbus_do_remove(struct i2c_client *client); +const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client + *client); + +#endif /* PMBUS_H */ diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/slave_cpld_reg.h b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/slave_cpld_reg.h new file mode 100644 index 000000000000..a8169bdb88ee --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/slave_cpld_reg.h @@ -0,0 +1,192 @@ +#ifndef __SLAVE_CPLD_REG +#define __SLAVE_CPLD_REG + +static int slave_cpld_raw_read(struct device *dev, struct device_attribute *attr, char *buf, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name); +static int slave_cpld_raw_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name); + +/* generic CPLD read function */ +#define FLD_RAW_RD_FUNC(_reg, _fld, _wdh) static ssize_t \ +slave_cpld_##_fld##_raw_read(struct device *dev, struct device_attribute *attr, char *buf) { \ + return slave_cpld_raw_read(dev, attr, buf, _reg##_offset, _reg##_width, _fld##_shift, _fld##_width, _fld##_mask, #_reg); \ +} + +/* generic CPLD write function */ +#define FLD_RAW_WR_FUNC(_reg, _fld, _wdh) static ssize_t \ +slave_cpld_##_fld##_raw_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { \ + return slave_cpld_raw_write(dev, attr, buf, count, _reg##_offset, _reg##_width, _fld##_shift, _fld##_width, _fld##_mask, #_reg); \ +} + +/* CPLD register definition macros */ +#define REG_DEF(_reg, _off, _wdh) \ +static unsigned int _reg##_offset = (unsigned int)(_off); \ +static unsigned int _reg##_width = (unsigned int)(_wdh); + +/* CPLD register field definition macros, with generic read/write function */ +#define FLD_RAW_RO_DEF(_reg, _fld, _sft, _wdh) \ +static unsigned int _fld##_shift = (unsigned int)(_sft); \ +static unsigned int _fld##_width = (unsigned int)(_wdh); \ +static unsigned int _fld##_mask = ((((unsigned int)1) << (_wdh)) - 1); \ +FLD_RAW_RD_FUNC(_reg, _fld, _wdh) + +#define FLD_RAW_RW_DEF(_reg, _fld, _sft, _wdh) \ +static unsigned int _fld##_shift = (unsigned int)(_sft); \ +static unsigned int _fld##_width = (unsigned int)(_wdh); \ +static unsigned int _fld##_mask = ((((unsigned int)1) << (_wdh)) - 1); \ +FLD_RAW_RD_FUNC(_reg, _fld, _wdh) FLD_RAW_WR_FUNC(_reg, _fld, _wdh) + +/* declare slave CPLD registers */ +/* register name offset width */ +/* --------------------------------------- ------- ----- */ +REG_DEF( slv_cpld_rev, 0x00, 8) +REG_DEF( slv_cpld_gpr, 0x01, 8) +REG_DEF( mb_brd_rev_type, 0x02, 8) + +REG_DEF( zqsfp28_present_24_17_status, 0x10, 8) +REG_DEF( zqsfp28_present_32_25_status, 0x11, 8) +REG_DEF( zqsfp28_rst_24_17, 0x12, 8) +REG_DEF( zqsfp28_rst_32_25, 0x13, 8) +REG_DEF( zqsfp28_modsel_24_17, 0x14, 8) +REG_DEF( zqsfp28_modsel_32_25, 0x15, 8) +REG_DEF( zqsfp28_lpmode_24_17, 0x16, 8) +REG_DEF( zqsfp28_lpmode_32_25, 0x17, 8) +REG_DEF( zqsfp28_irq_24_17_status, 0x18, 8) +REG_DEF( zqsfp28_irq_32_25_status, 0x19, 8) +REG_DEF( zqsfp28_irq_msk_24_17_status, 0x1A, 8) +REG_DEF( zqsfp28_irq_msk_32_25_status, 0x1B, 8) + + +/* declare slave CPLD register's fields */ +/* register name field name shift width */ +/* ---------------------- ---------------- ------ ----- */ +FLD_RAW_RO_DEF( slv_cpld_rev, mjr_rev, 4, 4) +FLD_RAW_RO_DEF( slv_cpld_rev, mnr_rev, 0, 4) + +FLD_RAW_RW_DEF( slv_cpld_gpr, scrtch_reg, 0, 8) + +FLD_RAW_RO_DEF( mb_brd_rev_type, brd_rev, 4, 4) +FLD_RAW_RO_DEF( mb_brd_rev_type, brd_type, 0, 4) + +FLD_RAW_RO_DEF( zqsfp28_present_24_17_status, port24_present, 7, 1) +FLD_RAW_RO_DEF( zqsfp28_present_24_17_status, port23_present, 6, 1) +FLD_RAW_RO_DEF( zqsfp28_present_24_17_status, port22_present, 5, 1) +FLD_RAW_RO_DEF( zqsfp28_present_24_17_status, port21_present, 4, 1) +FLD_RAW_RO_DEF( zqsfp28_present_24_17_status, port20_present, 3, 1) +FLD_RAW_RO_DEF( zqsfp28_present_24_17_status, port19_present, 2, 1) +FLD_RAW_RO_DEF( zqsfp28_present_24_17_status, port18_present, 1, 1) +FLD_RAW_RO_DEF( zqsfp28_present_24_17_status, port17_present, 0, 1) + +FLD_RAW_RO_DEF( zqsfp28_present_32_25_status, port32_present, 7, 1) +FLD_RAW_RO_DEF( zqsfp28_present_32_25_status, port31_present, 6, 1) +FLD_RAW_RO_DEF( zqsfp28_present_32_25_status, port30_present, 5, 1) +FLD_RAW_RO_DEF( zqsfp28_present_32_25_status, port29_present, 4, 1) +FLD_RAW_RO_DEF( zqsfp28_present_32_25_status, port28_present, 3, 1) +FLD_RAW_RO_DEF( zqsfp28_present_32_25_status, port27_present, 2, 1) +FLD_RAW_RO_DEF( zqsfp28_present_32_25_status, port26_present, 1, 1) +FLD_RAW_RO_DEF( zqsfp28_present_32_25_status, port25_present, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_rst_24_17, port24_rst, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_24_17, port23_rst, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_24_17, port22_rst, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_24_17, port21_rst, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_24_17, port20_rst, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_24_17, port19_rst, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_24_17, port18_rst, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_24_17, port17_rst, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_rst_32_25, port32_rst, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_32_25, port31_rst, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_32_25, port30_rst, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_32_25, port29_rst, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_32_25, port28_rst, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_32_25, port27_rst, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_32_25, port26_rst, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_rst_32_25, port25_rst, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_modsel_24_17, port24_modsel, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_24_17, port23_modsel, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_24_17, port22_modsel, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_24_17, port21_modsel, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_24_17, port20_modsel, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_24_17, port19_modsel, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_24_17, port18_modsel, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_24_17, port17_modsel, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_modsel_32_25, port32_modsel, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_32_25, port31_modsel, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_32_25, port30_modsel, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_32_25, port29_modsel, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_32_25, port28_modsel, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_32_25, port27_modsel, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_32_25, port26_modsel, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_modsel_32_25, port25_modsel, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_lpmode_24_17, port24_lpmode, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_24_17, port23_lpmode, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_24_17, port22_lpmode, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_24_17, port21_lpmode, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_24_17, port20_lpmode, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_24_17, port19_lpmode, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_24_17, port18_lpmode, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_24_17, port17_lpmode, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_lpmode_32_25, port32_lpmode, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_32_25, port31_lpmode, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_32_25, port30_lpmode, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_32_25, port29_lpmode, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_32_25, port28_lpmode, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_32_25, port27_lpmode, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_32_25, port26_lpmode, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_lpmode_32_25, port25_lpmode, 0, 1) + +FLD_RAW_RO_DEF( zqsfp28_irq_24_17_status, port24_irq_status, 7, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_24_17_status, port23_irq_status, 6, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_24_17_status, port22_irq_status, 5, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_24_17_status, port21_irq_status, 4, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_24_17_status, port20_irq_status, 3, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_24_17_status, port19_irq_status, 2, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_24_17_status, port18_irq_status, 1, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_24_17_status, port17_irq_status, 0, 1) + +FLD_RAW_RO_DEF( zqsfp28_irq_32_25_status, port32_irq_status, 7, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_32_25_status, port31_irq_status, 6, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_32_25_status, port30_irq_status, 5, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_32_25_status, port29_irq_status, 4, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_32_25_status, port28_irq_status, 3, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_32_25_status, port27_irq_status, 2, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_32_25_status, port26_irq_status, 1, 1) +FLD_RAW_RO_DEF( zqsfp28_irq_32_25_status, port25_irq_status, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_irq_msk_24_17_status, port24_irq_msk, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_24_17_status, port23_irq_msk, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_24_17_status, port22_irq_msk, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_24_17_status, port21_irq_msk, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_24_17_status, port20_irq_msk, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_24_17_status, port19_irq_msk, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_24_17_status, port18_irq_msk, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_24_17_status, port17_irq_msk, 0, 1) + +FLD_RAW_RW_DEF( zqsfp28_irq_msk_32_25_status, port32_irq_msk, 7, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_32_25_status, port31_irq_msk, 6, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_32_25_status, port30_irq_msk, 5, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_32_25_status, port29_irq_msk, 4, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_32_25_status, port28_irq_msk, 3, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_32_25_status, port27_irq_msk, 2, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_32_25_status, port26_irq_msk, 1, 1) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_32_25_status, port25_irq_msk, 0, 1) + +FLD_RAW_RO_DEF( zqsfp28_present_24_17_status, port_17_24_present, 0, 8) +FLD_RAW_RO_DEF( zqsfp28_present_32_25_status, port_25_32_present, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_rst_24_17, port_17_24_rst, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_rst_32_25, port_25_32_rst, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_modsel_24_17, port_17_24_modsel, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_modsel_32_25, port_25_32_modsel, 0, 8) +FLD_RAW_RO_DEF( zqsfp28_irq_24_17_status, port_17_24_irq_status,0, 8) +FLD_RAW_RO_DEF( zqsfp28_irq_32_25_status, port_25_32_irq_status,0, 8) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_24_17_status, port_17_24_irq_msk, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_irq_msk_32_25_status, port_25_32_irq_msk, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_lpmode_24_17, port_17_24_lpmode, 0, 8) +FLD_RAW_RW_DEF( zqsfp28_lpmode_32_25, port_25_32_lpmode, 0, 8) + +#endif /* __SLAVE_CPLD_REG */ diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/slave_cpld_sysfs.h b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/slave_cpld_sysfs.h new file mode 100644 index 000000000000..92d00d29d493 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/slave_cpld_sysfs.h @@ -0,0 +1,155 @@ +#ifndef __SLAVE_CPLD_SYSFS +#define __SLAVE_CPLD_SYSFS + +/* generic CPLD sysfs file definition macros */ +#define SYSFS_RAW_RO_ATTR_DEF(field) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO, slave_cpld_##field##_raw_read, NULL); + +#define SYSFS_RAW_RW_ATTR_DEF(field) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO | S_IWUGO, slave_cpld_##field##_raw_read, slave_cpld_##field##_raw_write); + +#define SYSFS_MISC_RO_ATTR_DEF(field, _read) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO, _read, NULL); + +#define SYSFS_MISC_RW_ATTR_DEF(field, _read, _write) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO | S_IWUGO, _read, _write); + +#define SYSFS_ATTR_PTR(field) \ +&field.attr + + +/* declare slave CPLD file system */ +SYSFS_RAW_RO_ATTR_DEF(mjr_rev) +SYSFS_RAW_RO_ATTR_DEF(mnr_rev) + +SYSFS_RAW_RW_ATTR_DEF(scrtch_reg) + +SYSFS_RAW_RO_ATTR_DEF(brd_rev) +SYSFS_RAW_RO_ATTR_DEF(brd_type) + +SYSFS_RAW_RO_ATTR_DEF(port24_present) +SYSFS_RAW_RO_ATTR_DEF(port23_present) +SYSFS_RAW_RO_ATTR_DEF(port22_present) +SYSFS_RAW_RO_ATTR_DEF(port21_present) +SYSFS_RAW_RO_ATTR_DEF(port20_present) +SYSFS_RAW_RO_ATTR_DEF(port19_present) +SYSFS_RAW_RO_ATTR_DEF(port18_present) +SYSFS_RAW_RO_ATTR_DEF(port17_present) + +SYSFS_RAW_RO_ATTR_DEF(port32_present) +SYSFS_RAW_RO_ATTR_DEF(port31_present) +SYSFS_RAW_RO_ATTR_DEF(port30_present) +SYSFS_RAW_RO_ATTR_DEF(port29_present) +SYSFS_RAW_RO_ATTR_DEF(port28_present) +SYSFS_RAW_RO_ATTR_DEF(port27_present) +SYSFS_RAW_RO_ATTR_DEF(port26_present) +SYSFS_RAW_RO_ATTR_DEF(port25_present) + +SYSFS_RAW_RW_ATTR_DEF(port24_rst) +SYSFS_RAW_RW_ATTR_DEF(port23_rst) +SYSFS_RAW_RW_ATTR_DEF(port22_rst) +SYSFS_RAW_RW_ATTR_DEF(port21_rst) +SYSFS_RAW_RW_ATTR_DEF(port20_rst) +SYSFS_RAW_RW_ATTR_DEF(port19_rst) +SYSFS_RAW_RW_ATTR_DEF(port18_rst) +SYSFS_RAW_RW_ATTR_DEF(port17_rst) + +SYSFS_RAW_RW_ATTR_DEF(port32_rst) +SYSFS_RAW_RW_ATTR_DEF(port31_rst) +SYSFS_RAW_RW_ATTR_DEF(port30_rst) +SYSFS_RAW_RW_ATTR_DEF(port29_rst) +SYSFS_RAW_RW_ATTR_DEF(port28_rst) +SYSFS_RAW_RW_ATTR_DEF(port27_rst) +SYSFS_RAW_RW_ATTR_DEF(port26_rst) +SYSFS_RAW_RW_ATTR_DEF(port25_rst) + +SYSFS_RAW_RW_ATTR_DEF(port24_modsel) +SYSFS_RAW_RW_ATTR_DEF(port23_modsel) +SYSFS_RAW_RW_ATTR_DEF(port22_modsel) +SYSFS_RAW_RW_ATTR_DEF(port21_modsel) +SYSFS_RAW_RW_ATTR_DEF(port20_modsel) +SYSFS_RAW_RW_ATTR_DEF(port19_modsel) +SYSFS_RAW_RW_ATTR_DEF(port18_modsel) +SYSFS_RAW_RW_ATTR_DEF(port17_modsel) + +SYSFS_RAW_RW_ATTR_DEF(port32_modsel) +SYSFS_RAW_RW_ATTR_DEF(port31_modsel) +SYSFS_RAW_RW_ATTR_DEF(port30_modsel) +SYSFS_RAW_RW_ATTR_DEF(port29_modsel) +SYSFS_RAW_RW_ATTR_DEF(port28_modsel) +SYSFS_RAW_RW_ATTR_DEF(port27_modsel) +SYSFS_RAW_RW_ATTR_DEF(port26_modsel) +SYSFS_RAW_RW_ATTR_DEF(port25_modsel) + +SYSFS_RAW_RW_ATTR_DEF(port24_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port23_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port22_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port21_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port20_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port19_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port18_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port17_lpmode) + +SYSFS_RAW_RW_ATTR_DEF(port32_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port31_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port30_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port29_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port28_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port27_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port26_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port25_lpmode) + +SYSFS_RAW_RO_ATTR_DEF(port24_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port23_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port22_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port21_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port20_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port19_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port18_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port17_irq_status) + +SYSFS_RAW_RO_ATTR_DEF(port32_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port31_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port30_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port29_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port28_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port27_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port26_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port25_irq_status) + +SYSFS_RAW_RW_ATTR_DEF(port24_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port23_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port22_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port21_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port20_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port19_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port18_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port17_irq_msk) + +SYSFS_RAW_RW_ATTR_DEF(port32_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port31_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port30_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port29_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port28_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port27_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port26_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port25_irq_msk) + +SYSFS_RAW_RO_ATTR_DEF(port_17_24_present) +SYSFS_RAW_RO_ATTR_DEF(port_25_32_present) +SYSFS_RAW_RW_ATTR_DEF(port_17_24_rst) +SYSFS_RAW_RW_ATTR_DEF(port_25_32_rst) +SYSFS_RAW_RW_ATTR_DEF(port_17_24_modsel) +SYSFS_RAW_RW_ATTR_DEF(port_25_32_modsel) +SYSFS_RAW_RO_ATTR_DEF(port_17_24_irq_status) +SYSFS_RAW_RO_ATTR_DEF(port_25_32_irq_status) +SYSFS_RAW_RW_ATTR_DEF(port_17_24_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port_25_32_irq_msk) +SYSFS_RAW_RW_ATTR_DEF(port_17_24_lpmode) +SYSFS_RAW_RW_ATTR_DEF(port_25_32_lpmode) + +#endif /* __SLAVE_CPLD_SYSFS */ diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/system_cpld_reg.h b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/system_cpld_reg.h new file mode 100644 index 000000000000..ba66519efe8a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/system_cpld_reg.h @@ -0,0 +1,107 @@ +#ifndef __SYSTEM_CPLD_REG +#define __SYSTEM_CPLD_REG + +static int system_cpld_raw_read(struct device *dev, struct device_attribute *attr, char *buf, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name); +static int system_cpld_raw_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count, + int reg_offset, int reg_width, int fld_shift, int fld_width, int fld_mask, char* reg_name); + +/* generic CPLD read function */ +#define FLD_RAW_RD_FUNC(_reg, _fld, _wdh) static ssize_t \ +system_cpld_##_fld##_raw_read(struct device *dev, struct device_attribute *attr, char *buf) { \ + return system_cpld_raw_read(dev, attr, buf, _reg##_offset, _reg##_width, _fld##_shift, _fld##_width, _fld##_mask, #_reg); \ +} + +/* generic CPLD write function */ +#define FLD_RAW_WR_FUNC(_reg, _fld, _wdh) static ssize_t \ +system_cpld_##_fld##_raw_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { \ + return system_cpld_raw_write(dev, attr, buf, count, _reg##_offset, _reg##_width, _fld##_shift, _fld##_width, _fld##_mask, #_reg); \ +} + +/* CPLD register definition macros */ +#define REG_DEF(_reg, _off, _wdh) \ +static unsigned int _reg##_offset = (unsigned int)(_off); \ +static unsigned int _reg##_width = (unsigned int)(_wdh); + +/* CPLD register field definition macros, with generic read/write function */ +#define FLD_RAW_RO_DEF(_reg, _fld, _sft, _wdh) \ +static unsigned int _fld##_shift = (unsigned int)(_sft); \ +static unsigned int _fld##_width = (unsigned int)(_wdh); \ +static unsigned int _fld##_mask = ((((unsigned int)1) << (_wdh)) - 1); \ +FLD_RAW_RD_FUNC(_reg, _fld, _wdh) + +#define FLD_RAW_RW_DEF(_reg, _fld, _sft, _wdh) \ +static unsigned int _fld##_shift = (unsigned int)(_sft); \ +static unsigned int _fld##_width = (unsigned int)(_wdh); \ +static unsigned int _fld##_mask = ((((unsigned int)1) << (_wdh)) - 1); \ +FLD_RAW_RD_FUNC(_reg, _fld, _wdh) FLD_RAW_WR_FUNC(_reg, _fld, _wdh) + +/* declare system CPLD registers */ +/* register name offset width */ +/* --------------------------------------- ------- ----- */ +REG_DEF( sys_cpld_rev, 0x00, 8) +REG_DEF( sys_cpld_gpr, 0x01, 8) +REG_DEF( cpu_brd_rev_type, 0x02, 8) +REG_DEF( sys_srr, 0x03, 8) +REG_DEF( sys_eeprom_wp, 0x04, 8) +REG_DEF( sys_irq, 0x05, 8) +REG_DEF( sys_wd, 0x06, 8) +REG_DEF( sys_mb_rst_en, 0x07, 8) +REG_DEF( cpu_pwr_en_status, 0x08, 8) +REG_DEF( cpu_pwr_status, 0x09, 8) + + +/* declare system CPLD register's fields */ +/* register name field name shift width */ +/* ---------------------- ---------------- ------ ----- */ +FLD_RAW_RO_DEF( sys_cpld_rev, mjr_rev, 4, 4) +FLD_RAW_RO_DEF( sys_cpld_rev, mnr_rev, 0, 4) + +FLD_RAW_RW_DEF( sys_cpld_gpr, scrtch_reg, 0, 8) + +FLD_RAW_RO_DEF( cpu_brd_rev_type, brd_rev, 4, 4) +FLD_RAW_RO_DEF( cpu_brd_rev_type, brd_type, 0, 4) + +FLD_RAW_RO_DEF( sys_srr, ssd_present, 3, 1) +FLD_RAW_RW_DEF( sys_srr, spi_cs_sel, 2, 1) +FLD_RAW_RW_DEF( sys_srr, rst_bios_switch, 1, 1) +FLD_RAW_RW_DEF( sys_srr, cpld_upgrade_rst, 0, 1) + +FLD_RAW_RW_DEF( sys_eeprom_wp, cpld_spi_wp, 4, 1) +FLD_RAW_RW_DEF( sys_eeprom_wp, system_id_eeprom_wp, 3, 1) +FLD_RAW_RW_DEF( sys_eeprom_wp, spi_me_wp, 2, 1) +FLD_RAW_RW_DEF( sys_eeprom_wp, spi_bios_wp, 1, 1) +FLD_RAW_RW_DEF( sys_eeprom_wp, spi_bak_bios_wp, 0, 1) + +FLD_RAW_RW_DEF( sys_irq, vrhot_irq_en, 6, 1) +FLD_RAW_RW_DEF( sys_irq, cpu_thermtrip_irq_en,5, 1) +FLD_RAW_RW_DEF( sys_irq, temp_alert_irq_en, 4, 1) +FLD_RAW_RO_DEF( sys_irq, vrhot_irq, 2, 1) +FLD_RAW_RO_DEF( sys_irq, cpu_thermtrip_irq, 1, 1) +FLD_RAW_RO_DEF( sys_irq, temp_alert_irq, 0, 1) + +FLD_RAW_RW_DEF( sys_wd, wd_timer, 4, 4) +FLD_RAW_RW_DEF( sys_wd, wd_en, 1, 1) +FLD_RAW_RW_DEF( sys_wd, wd_punch, 0, 1) + +FLD_RAW_RW_DEF( sys_mb_rst_en, mb_rst_en, 0, 1) + +FLD_RAW_RO_DEF( cpu_pwr_en_status, pwr_v3p3_en, 7, 1) +FLD_RAW_RO_DEF( cpu_pwr_en_status, pwr_vcc_vnn_en, 6, 1) +FLD_RAW_RO_DEF( cpu_pwr_en_status, pwr_vccsram_en, 5, 1) +FLD_RAW_RO_DEF( cpu_pwr_en_status, pwr_vddq_en, 4, 1) +FLD_RAW_RO_DEF( cpu_pwr_en_status, pwr_vcc_ref_en, 3, 1) +FLD_RAW_RO_DEF( cpu_pwr_en_status, pwr_v1p05_en, 2, 1) +FLD_RAW_RO_DEF( cpu_pwr_en_status, pwr_v1p8_en, 1, 1) +FLD_RAW_RO_DEF( cpu_pwr_en_status, pwr_v2p5_en, 0, 1) + +FLD_RAW_RO_DEF( cpu_pwr_status, pg_v3p3, 7, 1) +FLD_RAW_RO_DEF( cpu_pwr_status, pg_vcc_vnn, 6, 1) +FLD_RAW_RO_DEF( cpu_pwr_status, pg_vccsram, 5, 1) +FLD_RAW_RO_DEF( cpu_pwr_status, pg_vddq, 4, 1) +FLD_RAW_RO_DEF( cpu_pwr_status, pg_vcc_ref, 3, 1) +FLD_RAW_RO_DEF( cpu_pwr_status, pg_v1p05, 2, 1) +FLD_RAW_RO_DEF( cpu_pwr_status, pg_v1p8, 1, 1) +FLD_RAW_RO_DEF( cpu_pwr_status, pg_v2p5, 0, 1) + +#endif /* __SYSTEM_CPLD_REG */ diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/system_cpld_sysfs.h b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/system_cpld_sysfs.h new file mode 100644 index 000000000000..e6b03bd1bd0d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/modules/system_cpld_sysfs.h @@ -0,0 +1,76 @@ +#ifndef __SYSTEM_CPLD_SYSFS +#define __SYSTEM_CPLD_SYSFS + +/* generic CPLD sysfs file definition macros */ +#define SYSFS_RAW_RO_ATTR_DEF(field) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO, system_cpld_##field##_raw_read, NULL); + +#define SYSFS_RAW_RW_ATTR_DEF(field) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO | S_IWUGO, system_cpld_##field##_raw_read, system_cpld_##field##_raw_write); + +#define SYSFS_MISC_RO_ATTR_DEF(field, _read) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO, _read, NULL); + +#define SYSFS_MISC_RW_ATTR_DEF(field, _read, _write) \ +struct device_attribute field \ + = __ATTR(field, S_IRUGO | S_IWUGO, _read, _write); + +#define SYSFS_ATTR_PTR(field) \ +&field.attr + + +/* declare system CPLD file system */ +SYSFS_RAW_RO_ATTR_DEF(mjr_rev) +SYSFS_RAW_RO_ATTR_DEF(mnr_rev) + +SYSFS_RAW_RW_ATTR_DEF(scrtch_reg) + +SYSFS_RAW_RO_ATTR_DEF(brd_rev) +SYSFS_RAW_RO_ATTR_DEF(brd_type) + +SYSFS_RAW_RO_ATTR_DEF(ssd_present) +SYSFS_RAW_RW_ATTR_DEF(spi_cs_sel) +SYSFS_RAW_RW_ATTR_DEF(rst_bios_switch) +SYSFS_RAW_RW_ATTR_DEF(cpld_upgrade_rst) + +SYSFS_RAW_RW_ATTR_DEF(cpld_spi_wp) +SYSFS_RAW_RW_ATTR_DEF(system_id_eeprom_wp) +SYSFS_RAW_RW_ATTR_DEF(spi_me_wp) +SYSFS_RAW_RW_ATTR_DEF(spi_bios_wp) +SYSFS_RAW_RW_ATTR_DEF(spi_bak_bios_wp) + +SYSFS_RAW_RW_ATTR_DEF(vrhot_irq_en) +SYSFS_RAW_RW_ATTR_DEF(cpu_thermtrip_irq_en) +SYSFS_RAW_RW_ATTR_DEF(temp_alert_irq_en) +SYSFS_RAW_RO_ATTR_DEF(vrhot_irq) +SYSFS_RAW_RO_ATTR_DEF(cpu_thermtrip_irq) +SYSFS_RAW_RO_ATTR_DEF(temp_alert_irq) + +SYSFS_RAW_RW_ATTR_DEF(wd_timer) +SYSFS_RAW_RW_ATTR_DEF(wd_en) +SYSFS_RAW_RW_ATTR_DEF(wd_punch) + +SYSFS_RAW_RW_ATTR_DEF(mb_rst_en) + +SYSFS_RAW_RO_ATTR_DEF(pwr_v3p3_en) +SYSFS_RAW_RO_ATTR_DEF(pwr_vcc_vnn_en) +SYSFS_RAW_RO_ATTR_DEF(pwr_vccsram_en) +SYSFS_RAW_RO_ATTR_DEF(pwr_vddq_en) +SYSFS_RAW_RO_ATTR_DEF(pwr_vcc_ref_en) +SYSFS_RAW_RO_ATTR_DEF(pwr_v1p05_en) +SYSFS_RAW_RO_ATTR_DEF(pwr_v1p8_en) +SYSFS_RAW_RO_ATTR_DEF(pwr_v2p5_en) + +SYSFS_RAW_RO_ATTR_DEF(pg_v3p3) +SYSFS_RAW_RO_ATTR_DEF(pg_vcc_vnn) +SYSFS_RAW_RO_ATTR_DEF(pg_vccsram) +SYSFS_RAW_RO_ATTR_DEF(pg_vddq) +SYSFS_RAW_RO_ATTR_DEF(pg_vcc_ref) +SYSFS_RAW_RO_ATTR_DEF(pg_v1p05) +SYSFS_RAW_RO_ATTR_DEF(pg_v1p8) +SYSFS_RAW_RO_ATTR_DEF(pg_v2p5) + +#endif /* __SYSTEM_CPLD_SYSFS */ diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-ctrl b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-ctrl new file mode 100755 index 000000000000..73ff759b6f45 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-ctrl @@ -0,0 +1,679 @@ +#!/bin/bash +#/* +#********************************************************************** +#* +#* @filename fan-ctrl +#* +#* @purpose system daemon for controlling system fan pwm +#* +#* @create 2017/06/21 +#* +#* @author nixon.chu +#* +#* @history 2017/06/21: init version +#* +#********************************************************************** +#*/ + +DIR=$(dirname $0) + +# include files +source ${DIR}/funcs.sh + +#/* +#********************************************************************** +#* +#* CONSTANT VARIABLES +#* +#********************************************************************** +#*/ + +# process name/id +DAEMON_NAME=`basename $0` +DAEMON_PID="$$" + +# define symbol for fan/temperature type sensor +SYMBOL_TEMP="TEMP_" +SYMBOL_FAN="FAN_" + +# describe the structure of temperature sensor by id +STRUCT_TEMP_NAME=0 +STRUCT_TEMP_CMD=1 +STRUCT_TEMP_MAX=2 +STRUCT_TEMP_SIZE=$(( ${STRUCT_TEMP_MAX} + 1 )) + +# describe the structure of fan sensor by id +STRUCT_FAN_CMD=0 +STRUCT_FAN_SIZE=$(( ${STRUCT_FAN_CMD} + 1 )) + +# default fan zone configuration file +DEF_ZONE_CONF="${DIR}/fan-zone.conf" + +# default fan zone thermal configuration file +DEF_TEMP_CONF="${DIR}/fan-zone-thermal.conf" + +# default interval (sec) +DEF_INTERVAL=10 + +# default hysteresis (deg C) +DEF_HYSIS=3 + +# default debug mode (0: OFF, 1: ON) +DEF_DEBUG_MODE=0 + +# default log file +DEF_LOG_FILE="/var/log/syslog" + +# default fan level +DEF_FAN_LEVEL=0 + +# default minimum pwm (38.25=255x15%) +DEF_MIN_PWM=39 + +# default zone id +DEF_ZONE_ID=0 + +# error codes +E_STATUS_GOOD=0 +E_STATUS_FAULT=1 +E_INVALID_ARGS=11 +E_INVALID_CONF=12 + +# message levels +MSG_EMERG=0 +MSG_ALERT=1 +MSG_CRIT=2 +MSG_ERR=3 +MSG_WARNING=4 +MSG_NOTICE=5 +MSG_INFO=6 +MSG_DEBUG=7 + +# default message level +DEF_MSG_LEVEL=$MSG_WARNING + +#/* +#********************************************************************** +#* +#* GLOBAL VARIABLES +#* +#********************************************************************** +#*/ + +# temperature sensor group +GBL_TEMP_GRP=() +GBL_TEMP_NUM=${#GBL_TEMP_GRP[@]} + +# fan sensor group +GBL_FAN_GRP=() +GBL_FAN_NUM=${#GBL_FAN_GRP[@]} + +# fan level table +GBL_FAN_LEVEL=() +GBL_LEVEL_NUM=${#GBL_FAN_LEVEL[@]} + +# load defaults +GBL_ZONE_CONF=$DEF_ZONE_CONF +GBL_TEMP_CONF=$DEF_TEMP_CONF +GBL_INTERVAL=$DEF_INTERVAL +GBL_HYSIS=$DEF_HYSIS +GBL_DEBUG_MODE=$DEF_DEBUG_MODE +GBL_LOG_FILE=$DEF_LOG_FILE +GBL_CUR_LEVEL=$DEF_FAN_LEVEL +GBL_MIN_PWM=$DEF_MIN_PWM +GBL_ZONE_ID=$DEF_ZONE_ID +GBL_MSG_LEVEL=$DEF_MSG_LEVEL + +# temperature sensors' readings/statuses/properties (properties list have to be converted with fan level table) +GBL_TEMP_READINGS=() +GBL_TEMP_STATUSES=() +GBL_TEMP_PROPERTY=() + +#/* +#********************************************************************** +#* +#* FUNCTIONS +#* +#********************************************************************** +#*/ + +#/* +#* FEATURE: +#* usage +#* PURPOSE: +#* show the usage of this daemon +#* PARAMETERS: +#* +#* RETURNS: +#* success, this function returns @E_INVALID_ARGS. +#*/ +function usage() { + local dbg_mode + + [ $GBL_DEBUG_MODE -eq 0 ] && dbg_mode="off" || dbg_mode="on" + + echo -e "Usage: $0 [-z zone_file] [-t thermal_file] [-o log_file] [-d]" >&2 + echo -e "" >&2 + echo -e "Arguments:" >&2 + echo -e " -z, --zone-config Fan zone configuration file (default: $DEF_ZONE_CONF)" >&2 + echo -e " -t, --temp-config Fan zone thermal configuration file (default: $DEF_TEMP_CONF)" >&2 + echo -e " -o, --log-file Log file (default: $DEF_LOG_FILE)" >&2 + echo -e " -d, --debug Debug mode (default: $dbg_mode)" >&2 + exit ${E_INVALID_ARGS} +} + +#/* +#* FEATURE: +#* print_msg +#* PURPOSE: +#* print message by message level +#* PARAMETERS: +#* msg_lvl (IN) message level +#* msg (IN) message +#* RETURNS: +#* +#*/ +function print_msg() { + local msg_lvl=$1 + local msg=$2 + + [ $msg_lvl -le $GBL_MSG_LEVEL ] && echo "${msg}" >&2 +} + +#/* +#* FEATURE: +#* err_msg +#* PURPOSE: +#* log error message +#* PARAMETERS: +#* msg (IN) message +#* err_no (IN) error code +#* RETURNS: +#* success, this function returns non-zero error code. +#*/ +function err_msg() { + local msg=$1 + local err_no=$2 + + log_msg $MSG_ERROR "${msg}" + exit ${err_no} +} + +#/* +#* FEATURE: +#* log_msg +#* PURPOSE: +#* log message +#* PARAMETERS: +#* msg_lvl (IN) message level +#* msg (IN) message +#* RETURNS: +#* +#*/ +function log_msg() { + local msg_lvl=$1 + local msg=$2 + + if [ $GBL_LOG_FILE == $DEF_LOG_FILE ]; then + `logger -t $DAEMON_NAME -p $msg_lvl $msg` + else + echo -e "`date +"%b %_d %T"` `hostname` $DAEMON_NAME[$DAEMON_PID]: ${msg}" >> ${GBL_LOG_FILE} + fi + + print_msg $msg_lvl "${msg}" +} + +#/* +#* FEATURE: +#* debug_temp_grp +#* PURPOSE: +#* debug function for showing the temperature sensor group configs +#* @GBL_TEMP_GRP[]: store sensor group configs (sensor name, command, and max_temp) +#* PARAMETERS: +#* +#* RETURNS: +#* +#*/ +function debug_temp_grp() { + if [ $GBL_DEBUG_MODE -ne 0 ]; then + echo "********* Sensor Group *********" + for ((i=0; i<$GBL_TEMP_NUM; i++)) + do + echo -en "`fetch_temp_struct $i $STRUCT_TEMP_NAME`\t" + echo -en "`fetch_temp_struct $i $STRUCT_TEMP_CMD`\t" + echo "`fetch_temp_struct $i $STRUCT_TEMP_MAX`" + done + fi +} + +#/* +#* FEATURE: +#* debug_temp_readings +#* PURPOSE: +#* debug function for showing the temperature sensors' readings +#* @GBL_TEMP_READINGS[]: store current reading for temperature sensors +#* PARAMETERS: +#* +#* RETURNS: +#* +#*/ +function debug_temp_readings() { + if [ $GBL_DEBUG_MODE -ne 0 ]; then + echo "********* Sensor Reading *********" + for ((i=0; i<$GBL_TEMP_NUM; i++)) + do + echo -e "`fetch_temp_struct $i $STRUCT_TEMP_NAME`\t${GBL_TEMP_READINGS[$i]}" + done + fi +} + +#/* +#* FEATURE: +#* debug_temp_property +#* PURPOSE: +#* debug function for showing the temperature sensors' properties +#* @GBL_TEMP_PROPERTY[]: store temperature sensors' properties (asserted temperature for each fan levels) +#* PARAMETERS: +#* +#* RETURNS: +#* +#*/ +function debug_temp_property() { + local size base start_idx level + if [ $GBL_DEBUG_MODE -ne 0 ]; then + echo "********* Sensor Table *********" + for ((i=0; i<${GBL_TEMP_NUM}; i++)) + do + # show array @GBL_TEMP_PROPERTY[]: format name(1) + fan levels(2-?) + size=$(( ${GBL_LEVEL_NUM}+1 )) + base=$i*${size} + start_idx=$(( $base+1 )) + level=${GBL_LEVEL_NUM} + echo -e "${GBL_TEMP_PROPERTY[$base]}\t\t${GBL_TEMP_PROPERTY[@]:$start_idx:$level}" + done + fi +} + +#/* +#* FEATURE: +#* fetch_temp_struct +#* PURPOSE: +#* fetch the member value of specific temperature sensor +#* PARAMETERS: +#* id (IN) sensor id +#* member_id (IN) member id +#* RETURNS: +#* success, returns member value +#*/ +function fetch_temp_struct() { + local id member_id index_base data + + id=$1 + member_id=$2 + + index_base=$(( $id * $STRUCT_TEMP_SIZE )) + data=${GBL_TEMP_GRP[$(($index_base+$member_id))]} + # remove unuseful characters, such as double quotes('"') and the start/end space(' ') of a string. + data=`echo $data | sed 's/^ *\| *$//g' | sed 's/^"\|\"$//g'` + echo $data +} + +#/* +#* FEATURE: +#* fetch_temp_property +#* PURPOSE: +#* fetch the properties of specific temperature sensor +#* PARAMETERS: +#* name (IN) sensor name +#* RETURNS: +#* success, returns an asserted temperature list +#*/ +function fetch_temp_property() { + local name size base start_idx length + + name=$1 + + size=$(( $GBL_LEVEL_NUM+1 )) + for ((i=0; i<${GBL_TEMP_NUM}; i++)) + do + base=$i*${size} + # find sensor by name + if [ ${GBL_TEMP_PROPERTY[${base}]} == "${name}" ]; then + start_idx=$(( $base+1 )) + length=$GBL_LEVEL_NUM + echo ${GBL_TEMP_PROPERTY[@]:$start_idx:$length} + break + fi + done +} + +#/* +#* FEATURE: +#* debug_fan_speed +#* PURPOSE: +#* debug function for showing system current fan level and PWM +#* @GBL_CUR_LEVEL: system current/output fan level +#* PARAMETERS: +#* +#* RETURNS: +#* +#*/ +function debug_fan_speed() { + if [ $GBL_DEBUG_MODE -ne 0 ]; then + # For human readable, the representation of fan level will start from 1. + echo "Current Level: $(( $GBL_CUR_LEVEL+1 )), PWM: ${GBL_FAN_LEVEL[$GBL_CUR_LEVEL]}" + fi +} + +#/* +#* FEATURE: +#* arg_parse +#* PURPOSE: +#* parser for input arguments +#* PARAMETERS: +#* arg_lists[] (IN) argument list +#* RETURNS: +#* +#*/ +function arg_parse() { + while [[ $# -ge 1 ]] + do + key="$1" + case $key in + -z|--zone-config) + [ $# -lt 2 ] && usage + GBL_ZONE_CONF=$2 + [ ! -e $GBL_ZONE_CONF ] && usage + shift # past argument + ;; + -t|--temp-config) + [ $# -lt 2 ] && usage + GBL_TEMP_CONF=$2 + [ ! -e $GBL_TEMP_CONF ] && usage + shift # past argument + ;; + -o|--log-file) + [ $# -lt 2 ] && usage + GBL_LOG_FILE=$2 + shift # past argument + ;; + -d|--debug) + GBL_DEBUG_MODE=1 + ;; + *) + usage # unknown option + ;; + esac + shift # past argument or value + done +} + +#/* +#* FEATURE: +#* valid_conf +#* PURPOSE: +#* check if configuration files are valid +#* PARAMETERS: +#* +#* RETURNS: +#* success, this function returns nothing +#* fail, returns @E_INVALID_CONF +#*/ +function valid_conf() { + local list_1 list_2 match_num + + list_1=("${!1}") + list_2=("${!2}") + + # validate zone config + [ ${GBL_TEMP_NUM} -eq 0 ] && err_msg "config: status=invalid. reason=no TEMPERATURE SENSORS defined." "${E_INVALID_CONF}" + [ ${GBL_FAN_NUM} -eq 0 ] && err_msg "config: status=invalid. reason=no FAN defined." "${E_INVALID_CONF}" + + # validate thermal config + [ ${GBL_LEVEL_NUM} -eq 0 ] && err_msg "config: status=invalid. reason=no FAN LEVELS defined." "${E_INVALID_CONF}" + [ ${#list_2[@]} -ne ${GBL_TEMP_NUM} ] && err_msg "config: status=invalid. reason=the number of temperature sensors is inconsistent." "${E_INVALID_CONF}" + + # compare temperature sensor name between configuration files + match_num=0 + for i in ${!list_1[@]} + do + for j in ${!list_2[@]} + do + [ "${list_1[$i]}" == "${list_2[$j]}" ] && match_num=$(( $match_num+1 )) + done + done + [ $match_num -ne ${GBL_TEMP_NUM} ] && err_msg "config: status=invalid. reason=the name of temperature sensors is inconsistent." "${E_INVALID_CONF}" + + # validate pwm values + for pwm in ${GBL_FAN_LEVEL[@]} + do + expr $pwm + $GBL_MIN_PWM >/dev/null 2>&1 + [ $? -ne 0 ] && err_msg "config: status=invalid. reason=the value of pwm is not integer." "$E_INVALID_CONF" + [ $pwm -lt $GBL_MIN_PWM ] && err_msg "config: status=invalid. reason=the value of fan level is less than MIN_PWM($GBL_MIN_PWM)." "$E_INVALID_CONF" + done +} + +#/* +#* FEATURE: +#* initialize +#* PURPOSE: +#* load zone config and thermal config +#* PARAMETERS: +#* +#* RETURNS: +#* +#*/ +function initialize() { + local data conf_interval conf_hysis conf_min_pwm conf_zone_id conf_msg_level temp_list_1 temp_list_2 + + log_msg $MSG_INFO "Initializing fan control service..." + + # fetch temperature sensor name from configuration files + temp_list_1=(`cat ${GBL_ZONE_CONF} | grep "^${SYMBOL_TEMP}" | awk -F "," {'print $1'}`) + temp_list_2=(`cat ${GBL_TEMP_CONF} | grep "^${SYMBOL_TEMP}" | awk {'print $1'}`) + + # calculate the number of temperature/fan sensors + GBL_TEMP_NUM=${#temp_list_1[@]} + GBL_FAN_NUM=(`cat ${GBL_ZONE_CONF} | grep "^${SYMBOL_FAN}" | awk {'print $2'} | wc -l`) + + # calculate the number of fan levels + GBL_FAN_LEVEL=(`cat ${GBL_TEMP_CONF} | grep "^PWM" | awk -F "PWM" {'print $2'}`) + GBL_LEVEL_NUM=${#GBL_FAN_LEVEL[@]} + + # check if the interval/hyteresis should be updated. + conf_interval=`cat ${GBL_ZONE_CONF} | grep "^INTERVAL=" | awk -F "=" {'print $2'} | tail` + [ ! -z ${conf_interval} ] && GBL_INTERVAL=${conf_interval} + conf_hysis=`cat ${GBL_ZONE_CONF} | grep "^HYTERESIS=" | awk -F "=" {'print $2'} | tail` + [ ! -z ${conf_hysis} ] && GBL_HYSIS=${conf_hysis} + conf_min_pwm=`cat ${GBL_ZONE_CONF} | grep "^MIN_PWM=" | awk -F "=" {'print $2'} | tail` + [ ! -z ${conf_min_pwm} ] && GBL_MIN_PWM=${conf_min_pwm} + conf_zone_id=`cat ${GBL_ZONE_CONF} | grep "^ZONE_ID=" | awk -F "=" {'print $2'} | tail` + [ ! -z ${conf_zone_id} ] && GBL_ZONE_ID=${conf_zone_id} + conf_msg_level=`cat ${GBL_ZONE_CONF} | grep "^MSG_LEVEL=" | awk -F "=" {'print $2'} | tail` + [ ! -z ${conf_msg_level} ] && GBL_MSG_LEVEL=${conf_msg_level} + + # load zone config + for ((i=1; i<=${GBL_TEMP_NUM}; i++)) + do + GBL_TEMP_STATUSES+=($E_STATUS_GOOD) + data=`cat ${GBL_ZONE_CONF} | grep "^${SYMBOL_TEMP}" | awk NR==$i` + # FIXME + GBL_TEMP_GRP+=("`echo $data | awk -F ", " {'print $1'}`") + GBL_TEMP_GRP+=("`echo $data | awk -F ", " {'print $2'}`") + GBL_TEMP_GRP+=("`echo $data | awk -F ", " {'print $3'}`") + done + debug_temp_grp + + for ((i=1; i<=${GBL_FAN_NUM}; i++)) + do + data=`cat ${GBL_ZONE_CONF} | grep "^${SYMBOL_FAN}" | awk NR==$i{'print $2'}` + GBL_FAN_GRP+=("`echo $data`") + done + + # load thermal config + for ((i=0; i<${GBL_TEMP_NUM}; i++)) + do + index=$(( $i * ${STRUCT_TEMP_SIZE} + ${STRUCT_TEMP_NAME} )) + sensor_name=${GBL_TEMP_GRP[$index]} + GBL_TEMP_PROPERTY+=(`cat ${GBL_TEMP_CONF} | grep "^${sensor_name}" | tail`) + done + debug_temp_property + + # check if the config files is valid + valid_conf temp_list_1[@] temp_list_2[@] +} + +#/* +#* FEATURE: +#* temperature_collection +#* PURPOSE: +#* collect all temperature sensor readlings +#* PARAMETERS: +#* +#* RETURNS: +#* success, returns a series of reading @GBL_TEMP_READINGS[] +#*/ +function temperature_collection() { + local name cmd max_temp reading status pre_status + + GBL_TEMP_READINGS=() + for ((i=0; i<${GBL_TEMP_NUM}; i++)) + do + # read temperature sensor value & record sensor status + name=`fetch_temp_struct $i ${STRUCT_TEMP_NAME}` + cmd=`fetch_temp_struct $i ${STRUCT_TEMP_CMD}` + max_temp=`fetch_temp_struct $i ${STRUCT_TEMP_MAX}` + reading=`eval ${cmd} 2>/dev/null` + if [ $? -eq 0 ]; then + GBL_TEMP_READINGS+=($reading) + status=$E_STATUS_GOOD + else + GBL_TEMP_READINGS+=($max_temp) + status=$E_STATUS_FAULT + fi + + # Compare previous status of temperature sensor, then update it. + pre_status=${GBL_TEMP_STATUSES[$i]} + if [ $pre_status -eq $E_STATUS_GOOD ] && [ $status -eq $E_STATUS_FAULT ]; then + # Good -> Fault + log_msg $MSG_WARN "[ZONE_${GBL_ZONE_ID}] Sensor $name: status=ERROR. reason=read sensor failed." + elif [ $pre_status -eq $E_STATUS_FAULT ] && [ $status -eq $E_STATUS_GOOD ]; then + # Fault -> Good + log_msg $MSG_WARN "[ZONE_${GBL_ZONE_ID}] Sensor $name: status=RECOVER. reason=reading is $reading deg C" + fi + GBL_TEMP_STATUSES[$i]=$status + done + debug_temp_readings +} + +#/* +#* FEATURE: +#* fan_level_selection +#* PURPOSE: +#* select proper fan level by temperature sensor reading +#* PARAMETERS: +#* reading_list (IN) sensor reading list +#* RETURNS: +#* success, returns a fan level value +#*/ +function fan_level_selection() { + local reading_list name reading temp_list highest_level pre_level next_level hysis_temp res res1 + + reading_list=("${!1}") + highest_level=0 + pre_level=${GBL_CUR_LEVEL} + next_level=0 + + # search fan table by each temperature sensor reading + for ((i=0; i<${GBL_TEMP_NUM}; i++)) + do + name=`fetch_temp_struct $i $STRUCT_TEMP_NAME` + reading=${reading_list[$i]} + temp_list=(`fetch_temp_property ${name}`) + for j in ${!temp_list[@]} + do + res=`echo $reading \<= ${temp_list[$j]} | bc -l` + if [ $res -eq 1 ] || [ $j -eq $((${#temp_list[@]}-1)) ]; then + if [ $j -gt $highest_level ]; then + highest_level=$j + fi + break + fi + done + done + + if [ $highest_level -lt $pre_level ]; then + # Determine if require decreasing current fan level @assert_level + local pass_num + pass_num=0 + for ((i=0; i<${GBL_TEMP_NUM}; i++)) + do + name=`fetch_temp_struct $i $STRUCT_TEMP_NAME` + reading=${reading_list[$i]} + temp_list=(`fetch_temp_property ${name}`) + assert_level=$(( $pre_level-1 )) + hysis_temp=`echo ${temp_list[$assert_level]} - $GBL_HYSIS | bc` + res=`echo $reading \<= $hysis_temp | bc -l` + if [ $res -eq 1 ]; then + pass_num=$(( $pass_num+1 )) + else + break + fi + done + if [ $pass_num -eq ${GBL_TEMP_NUM} ]; then + # Decrease fan pwm: All sensor reading should less than its own hysteresis temperature + next_level=${highest_level} + else + # Keep current fan pwm + next_level=${pre_level} + fi + else + # Increase fan pwm + next_level=${highest_level} + fi + GBL_CUR_LEVEL=${next_level} +} + +#/* +#* FEATURE: +#* apply_fan_level +#* PURPOSE: +#* convert given fan level to PWM, then output to fans +#* PARAMETERS: +#* fan_list (IN) fan devices list +#* fan_level (IN) fan level +#* RETURNS: +#* success, returns a pwm value +#*/ +function apply_fan_level() { + local fan_level fan_list + + fan_list=("${!1}") + fan_level=$2 + + for fan in ${fan_list[@]} + do + echo ${GBL_FAN_LEVEL[$fan_level]} > $fan + done + debug_fan_speed +} + +#/* +#********************************************************************** +#* +#* MAIN +#* +#********************************************************************** +#*/ +Platform_init +arg_parse $@ +initialize +log_msg $MSG_INFO "Starting fan control service..." +while [ true ]; do + temperature_collection + fan_level_selection GBL_TEMP_READINGS[@] + apply_fan_level GBL_FAN_GRP[@] ${GBL_CUR_LEVEL} + sleep $GBL_INTERVAL +done + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone-thermal_B2F.conf b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone-thermal_B2F.conf new file mode 100644 index 000000000000..56409f5c3e30 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone-thermal_B2F.conf @@ -0,0 +1,12 @@ +##### Temperature vs Fan table ##### +## FORMAT: "PWM" fan speed(range from 0 to 255) +# Duty Cycle 25% 30% 35% 40% 45% 50% 55% 60% 65% 70% 75% 80% 85% 90% 95% 100% +PWM 64 77 89 102 115 128 140 153 166 179 191 204 217 230 242 255 +## FORMAT: sensor name(TEMP_XXX) with asserted temperature by each levels +TEMP_CPU 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 +TEMP_SWITCH 75 78 81 84 87 90 93 96 99 102 105 108 111 114 117 120 +#TEMP_HDD 25 +#TEMP_TMP75_CPU 25 +#TEMP_TMP75_CENTER 25 +#TEMP_TMP75_RIGHT 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93 +TEMP_TMP75_FAN 26.5 31.5 36.5 41.5 46.5 51.5 56.5 61.5 66.5 71.5 76.5 81.5 86.5 91.5 96.5 101.5 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone-thermal_F2B.conf b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone-thermal_F2B.conf new file mode 100644 index 000000000000..6c459d874feb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone-thermal_F2B.conf @@ -0,0 +1,12 @@ +##### Temperature vs Fan table ##### +## FORMAT: "PWM" fan speed(range from 0 to 255) +# Duty Cycle 25% 30% 35% 40% 45% 50% 55% 60% 65% 70% 75% 80% 85% 90% 95% 100% +PWM 64 77 89 102 115 128 140 153 166 179 191 204 217 230 242 255 +## FORMAT: sensor name(TEMP_XXX) with asserted temperature by each levels +TEMP_CPU 60 65 70 73 76 79 82 85 88 91 94 97 100 103 106 109 +TEMP_SWITCH 73 76 79 82 85 88 91 94 97 100 103 106 109 112 115 118 +#TEMP_HDD 25 +#TEMP_TMP75_CPU 25 +#TEMP_TMP75_CENTER 25 +TEMP_TMP75_RIGHT 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93 +#TEMP_TMP75_FAN 25 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone_B2F.conf b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone_B2F.conf new file mode 100644 index 000000000000..b51f3b7aa67d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone_B2F.conf @@ -0,0 +1,38 @@ +##### ZONE ID ##### +ZONE_ID=0 + +##### SENSOR GROUP START ##### +## FORMAT: name(TEMP_XXX), command, max_temp(deg C) +TEMP_CPU, "data=`sensors | grep coretemp -A2`; [ $? -ne 0 ] && exit 1; echo "$data" | tail -n1 | awk {'print $4'} | sed 's/^+\|°C//g'", 110 +TEMP_SWITCH, "[ `file /var/run/docker-syncd/sswsyncd.socket | grep -c " socket"` -ne 1 ] && exit 1; [ `ss -a | grep "/var/run/sswsyncd/sswsyncd.socket" |grep -c "LISTEN"` -ne 1 ] && exit 1; data=`bcmcmd -c "show temp" | grep "temperature monitor"`; [ $? -ne 0 ] && exit 1; switch_temps=(`echo "$data" | awk {'print $5'} | sed 's/,//g'`); high_temp=0; for reading in ${switch_temps[@]}; do res=`echo "$reading > $high_temp" | bc -l`; [ $res -eq 1 ] && high_temp=$reading; done; echo $high_temp", 120 +#TEMP_HDD, "data=`hddtemp /dev/sdb | grep -v "not available"`; [ $? -ne 0 ] && exit 1; echo "$data" | awk -F ": " {'print $3'} | sed 's/°C//g'", 85 +#TEMP_TMP75_CPU, "data=`sensors | grep tmp75-i2c-0-4e -A2`; [ $? -ne 0 ] && exit 1; echo "$data" | tail -n1 | awk {'print $2'} | sed 's/^+\|°C//g'", 125 +#TEMP_TMP75_CENTER, "data=`sensors | grep tmp75-i2c-4-4a -A2`; [ $? -ne 0 ] && exit 1; echo "$data" | tail -n1 | awk {'print $2'} | sed 's/^+\|°C//g'", 125 +#TEMP_TMP75_RIGHT, "data=`sensors | grep tmp75-i2c-4-4c -A2`; [ $? -ne 0 ] && exit 1; echo "$data" | tail -n1 | awk {'print $2'} | sed 's/^+\|°C//g'", 125 +TEMP_TMP75_FAN, "data=`sensors | grep tmp75-i2c-4-4d -A2`; [ $? -ne 0 ] && exit 1; echo "$data" | tail -n1 | awk {'print $2'} | sed 's/^+\|°C//g'", 125 +##### SENSOR GROUP END ##### + +##### FAN GROUP START ##### +## FORMAT: name(FAN_YYY) input_files +FAN_1 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm1 +FAN_2 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm2 +FAN_3 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm3 +FAN_4 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm4 +FAN_5 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm5 +FAN_6 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm6 +FAN_7 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm1 +FAN_8 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm2 +FAN_9 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm3 +FAN_10 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm4 +FAN_11 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm5 +FAN_12 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm6 +##### FAN GROUP END ##### + +##### INTERVAL (sec) ##### +INTERVAL=10 + +##### HYTERESIS (deg C) ##### +HYTERESIS=2 + +##### MINIMUM PWM (38.25=255x15%) ##### +MIN_PWM=39 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone_F2B.conf b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone_F2B.conf new file mode 100644 index 000000000000..2d5987c5c66b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/fan-zone_F2B.conf @@ -0,0 +1,38 @@ +##### ZONE ID ##### +ZONE_ID=0 + +##### SENSOR GROUP START ##### +## FORMAT: name(TEMP_XXX), command, max_temp(deg C) +TEMP_CPU, "data=`sensors | grep coretemp -A2`; [ $? -ne 0 ] && exit 1; echo "$data" | tail -n1 | awk {'print $4'} | sed 's/^+\|°C//g'", 110 +TEMP_SWITCH, "[ `file /var/run/docker-syncd/sswsyncd.socket | grep -c " socket"` -ne 1 ] && exit 1; [ `ss -a | grep "/var/run/sswsyncd/sswsyncd.socket" |grep -c "LISTEN"` -ne 1 ] && exit 1; data=`bcmcmd -c "show temp" | grep "temperature monitor"`; [ $? -ne 0 ] && exit 1; switch_temps=(`echo "$data" | awk {'print $5'} | sed 's/,//g'`); high_temp=0; for reading in ${switch_temps[@]}; do res=`echo "$reading > $high_temp" | bc -l`; [ $res -eq 1 ] && high_temp=$reading; done; echo $high_temp", 120 +#TEMP_HDD, "data=`hddtemp /dev/sdb | grep -v "not available"`; [ $? -ne 0 ] && exit 1; echo "$data" | awk -F ": " {'print $3'} | sed 's/°C//g'", 85 +#TEMP_TMP75_CPU, "data=`sensors | grep tmp75-i2c-0-4e -A2`; [ $? -ne 0 ] && exit 1; echo "$data" | tail -n1 | awk {'print $2'} | sed 's/^+\|°C//g'", 125 +#TEMP_TMP75_CENTER, "data=`sensors | grep tmp75-i2c-4-4a -A2`; [ $? -ne 0 ] && exit 1; echo "$data" | tail -n1 | awk {'print $2'} | sed 's/^+\|°C//g'", 125 +TEMP_TMP75_RIGHT, "data=`sensors | grep tmp75-i2c-4-4c -A2`; [ $? -ne 0 ] && exit 1; echo "$data" | tail -n1 | awk {'print $2'} | sed 's/^+\|°C//g'", 125 +#TEMP_TMP75_FAN, "data=`sensors | grep tmp75-i2c-4-4d -A2`; [ $? -ne 0 ] && exit 1; echo "$data" | tail -n1 | awk {'print $2'} | sed 's/^+\|°C//g'", 125 +##### SENSOR GROUP END ##### + +##### FAN GROUP START ##### +## FORMAT: name(FAN_YYY) input_files +FAN_1 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm1 +FAN_2 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm2 +FAN_3 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm3 +FAN_4 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm4 +FAN_5 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm5 +FAN_6 /sys/bus/i2c/devices/3-0020/hwmon/hwmon*/pwm6 +FAN_7 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm1 +FAN_8 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm2 +FAN_9 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm3 +FAN_10 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm4 +FAN_11 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm5 +FAN_12 /sys/bus/i2c/devices/3-0023/hwmon/hwmon*/pwm6 +##### FAN GROUP END ##### + +##### INTERVAL (sec) ##### +INTERVAL=10 + +##### HYTERESIS (deg C) ##### +HYTERESIS=2 + +##### MINIMUM PWM (38.25=255x15%) ##### +MIN_PWM=39 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/funcs.sh b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/funcs.sh new file mode 100755 index 000000000000..3e417f699543 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/funcs.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#/* +#********************************************************************** +#* +#* @filename funcs.sh +#* +#* @purpose api functions script for fan-ctrl +#* +#* @create 2017/08/09 +#* +#* @author nixon.chu +#* +#* @history 2017/08/09: init version +#* +#********************************************************************** +#*/ + +DIR=$(dirname $0) + +function Platform_init() { + ${DIR}/init.sh +} diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/init.sh b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/init.sh new file mode 100755 index 000000000000..06df071fa147 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/fan-ctrl/init.sh @@ -0,0 +1,26 @@ +#!/bin/bash +DIR=$(dirname $0) + +# board type +BOARD_TYPE=`cat /sys/bus/i2c/devices/1-0032/brd_type` + +# fan tables +FORWARD_SENSOR_CONF=${DIR}/fan-zone_F2B.conf +FORWARD_PWM_CONF=${DIR}/fan-zone-thermal_F2B.conf +REVERSE_SENSOR_CONF=${DIR}/fan-zone_B2F.conf +REVERSE_PWM_CONF=${DIR}/fan-zone-thermal_B2F.conf + +# Nixon: Please refer to "BMS CPLD Design Spec." +# board type : BRD_TYPE[3:0] +# 0x0 (0000b): BMS_AC_PSU_NORMAL_FAN, 0x2 (0010b): BMS_DC_PSU_NORMAL_FAN +# 0x1 (0001b): BMS_AC_PSU_REVERSE_FAN, 0x3 (0011b): BMS_DC_PSU_REVERSE_FAN +case $BOARD_TYPE in + 0x0|0x2) + ln -sf $FORWARD_SENSOR_CONF ${DIR}/fan-zone.conf + ln -sf $FORWARD_PWM_CONF ${DIR}/fan-zone-thermal.conf + ;; + 0x1|0x3) + ln -sf $REVERSE_SENSOR_CONF ${DIR}/fan-zone.conf + ln -sf $REVERSE_PWM_CONF ${DIR}/fan-zone-thermal.conf + ;; +esac diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/funcs.sh b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/funcs.sh new file mode 100755 index 000000000000..4b0c4c35471f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/funcs.sh @@ -0,0 +1,23 @@ +#/bin/bash + +# process name/id +DAEMON_NAME=`basename $0` +DAEMON_PID="$$" + +DEF_SEVERITY="INFO" + +#/* +#* FEATURE: +#* log_msg +#* PURPOSE: +#* log message +#* PARAMETERS: +#* msg (IN) message +#* RETURNS: +#* +#*/ +function log_msg() { + local msg=$1 + + `logger -t $DAEMON_NAME -p $DEF_SEVERITY $msg` +} diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/start_service.sh b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/start_service.sh new file mode 100755 index 000000000000..2bc9589738d0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/start_service.sh @@ -0,0 +1,99 @@ +#/bin/bash + +DIR=$(dirname $0) + +# include files +source ${DIR}/funcs.sh + +ACPI_INSTALL_PRINT=0 +ACPID_INSTALL_PRINT=0 +BC_INSTALL_PRINT=0 +ACPID_SOCKET_PRINT=0 +ACPI_PRINT=0 + + +while [ 1 ] +do + if [ `dpkg -l |grep -c "acpi "` -eq "0" ]; then + dpkg -i /opt/debs/acpi_1.7-1_amd64.deb + if [ "$?" -ne "0" ]; then + if [ $ACPI_INSTALL_PRINT -eq 0 ]; then + ACPI_INSTALL_PRINT=1 + log_msg "Wait for acpi package install." + fi + sleep 1 + continue + else + log_msg "Install acpi package success." + fi + fi + break +done + +while [ 1 ] +do + if [ `dpkg -l |grep -c "acpid "` -eq "0" ]; then + dpkg -i /opt/debs/acpid_2.0.23-2_amd64.deb + if [ "$?" -ne "0" ]; then + if [ $ACPID_INSTALL_PRINT -eq 0 ]; then + ACPID_INSTALL_PRINT=1 + log_msg "Wait for acpid package install." + fi + sleep 1 + continue + else + log_msg "Install acpid package success." + fi + fi + break +done + +while [ 1 ] +do + if [ `dpkg -l |grep -c " bc "` -eq "0" ]; then + dpkg -i /opt/debs/bc_1.06.95-9_amd64.deb + if [ "$?" -ne "0" ]; then + if [ $BC_INSTALL_PRINT -eq 0 ]; then + BC_INSTALL_PRINT=1 + log_msg "Wait for bc package install." + fi + sleep 1 + continue + else + log_msg "Install bc package success." + fi + fi + break +done + +while [ 1 ] +do + if [ ! -e "/sys/firmware/acpi/interrupts/gpe01" ]; then + if [ $ACPI_PRINT -eq 0 ]; then + ACPI_PRINT=1 + log_msg "Wait for acpi daemon start." + fi + sleep 1 + continue + fi + log_msg "The acpi daemon start." + break +done + +while [ 1 ] +do + if [ ! -e "/var/run/acpid.socket" ]; then + if [ $ACPID_SOCKET_PRINT -eq 0 ]; then + ACPID_SOCKET_PRINT=1 + log_msg "Wait for acipd daemon start." + fi + sleep 1 + continue + fi + log_msg "The acpid daemon start." + break +done + +/etc/init.d/xcvr_servd start +/etc/init.d/sys_servd start +exit 0; diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/start_watchdog.sh b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/start_watchdog.sh new file mode 100755 index 000000000000..2268e5e0d16e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/script/start_watchdog.sh @@ -0,0 +1,32 @@ +#/bin/bash + +DIR=$(dirname $0) + +# include files +source ${DIR}/funcs.sh + +WATCHDOG_PRINT=0 + +while [ 1 ] +do + if [ `dpkg -l |grep -c "watchdog "` -eq "0" ]; then + dpkg -i /opt/debs/watchdog_5.14-3_amd64.deb + if [ "$?" -ne "0" ]; then + if [ $WATCHDOG_PRINT -eq 0 ]; then + WATCHDOG_PRINT=1 + log_msg "Wait for watchdog package install." + fi + sleep 1 + continue + else + log_msg "Install watchdog package success." + fi + fi + break +done + +ln -sf /opt/watchdog/watchdog.conf /etc/watchdog.conf + +/usr/sbin/watchdog -c /etc/watchdog.conf + +exit 0; diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/sys-serv/sys-servd b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/sys-serv/sys-servd new file mode 100755 index 0000000000000000000000000000000000000000..a1b4f177897c42c8a94085c9ff05092e187a83d5 GIT binary patch literal 56280 zcmeHw3t&{$(f>_CG@_6QSnQ2L`h}JMq_;LWd(S5ccvc2j?;F&6AX{a?MNaZ<~S8f&Dy;3DLv@8!JC?Dy% zN9cQ2mM~t!d1rIdn&weZ=OgtfUx(!DkbE{2#X1D)`cd8J-5W#Dhm!2etZ{LeDr0~zGskpZ8V z!EP6W--Cb2*N6<|K9m9fHUy-z&qW#duK~X&xlp9PltItz4ESxxldjy(4EQw}^yw6Q zG~bJy#)UW-3{l)0YWXM4oZ>GJ1Osy`>qCLy%qiolYHI>BOXpMtEWdwlb#0BmK2#bE z`Tdsv>IMGk!Z)s}w7x!2ud=7jTz$L0K2TF`0fuW3Z|BopZC#*-U@%Y?s9X@Rph#V4 zUNBHvPTCY%3xk!RfF&q@bvP7Q1m)^O!P*9kxUBjHXjz@aQCU+NvQdFWNI?Dqs2>Oh zYij*fwPmHD%Gw&6MaczvzKtq_bfe_bP$=kUv1PS2HGwimJX7ieq586Uf%3Z2V5y^w zn^ap>S=L~cRn^ufR|w{yqEYuUs`V(V9?3w+s;>)H)`Ti7RJW$Ay3VSvoLf^`WtEo( z&^C%IX>{)(KWu%7v=}L93>+EC76IO?hR|Dy^!US6W{i zL{U|NK%G@uRu-tQCs|xvCusviLvCqH)`U zf1%SVPoUDS5(c7w19(jjpHB1~>l&M$ZQX-DqUQ(qf9pX^D{`&tK_{Hz&$jv7R+j*) z=16_{PX2tegl~?=Ux>4>JOi(FCSrksmnjbC>1*KiT!#oA18>d;2N`%OTVF*6-kE_| z)@TC{L)e$sz<0N?mgO_>CmQ%^2L2=ie}jSVVc<&)d`|;E&%oy!_&Nix+lI)C4E)Ik z|55{Q#?2K5p5|ZrT4UgQYb4-W15a~3eKi~SQ#2BAy@CIdf!|=@Pc`tH47}+-Q3HRP z!N0@6pKjn=4g47fevg6IYY8H^8Thjd{+NN6B>_`A417O>ztg~b47|0bgj3{$=NR}r z1Anf8FEH@u8Th^iet?1Z82Et(evpAb-@q3cc$zEeYqWvCP$L1o2L8(i-e=%1GVs$3 z{9prrgMlwJ@V>_VdA_FHTbFt)-|}cEH+CPQgs*XX-U|j3ZWAM~21{bVWc3iAOm-jM5ZR;u|=9A*Csl#G5&NE~P1i#Mf~8bV}1w zD!!D{y(mr17_Z}WcS=(TiI;FXo6;0I;?p?&*L0AO`HDG=+e88>hEXn!0|xmD8IkOl+*W8n!0Sfj?>?uGQeCyoW79K{VCnd>2oPfT`RtZ)2CCKx>S5A zr+ZPFx>CH3)7>deT_|3{>1;}0K?jNDuw%q{yzX_#*H5 z8uxZgn>nc^+Fb6nd@Wmx7_`j4)N92iqT&ZC^81aqtW6UiFR^C%273W~jh#Jxk@pvz zu?f<++njvs^F&Crfq5Arty^EHpsP@)w-9}n@9qy-z}C-mAix*t@NJD<<;!}}x9juJ zDYmo|wY2hLg*h*6DDl44ZejoDL z!akx5iPl@=cOVblqsM!Ek;O4zB;3|g+)2u|6dxqeG^^9sR2+-E?u)c={@8+pi9}=@ zkZq9y`rBkRb|%6jV}-ysS&`y{O~nTzEipgrP0!$3@3xL(}EahTQn0q*QT-Z&kSU8B%bw2Y*mrKZrxL zYPdM|qkk$z4m1@X0O55aup*GfigdUY832a%8TlKFTk|(Y8#}YYXQA9Zq;cN>G^XyY zG(LzLwhs_SA6X`{3tXd#%c?vfVpb)a9w)?ES@6#ep`TKt(TNBm7K z#RsUk_KA?Pst=s^KvpXncUAF9U*yHe8?j}hlX8C*xtoetk}Kv@$!lB2FQ+xL)!w}k znHv`$$XfEGtwpo0$2{h38o#`?u`?%hhLOq&^{`XRqv6Yt*i7;wTVH)I0$tFb&S?eV zTwl|2GGkK#IJOAKzDUOj=0}bW=mTv5z-Yq z&5)h#Dk&>mq-kr&h9sWcA+2~K7~&su9IJ7EL1Zxnvn>fSRZHxvBQ490Rdt9}YvH16 z5vw{{iuZ#B4)vS@94=alpQ03a;3J4>t7f4C(LIIISPp_tq_eC`BT|2JXA6qS@_VZ7N>h7|n_luWy>Q9vL~$_mHRkT%vSlFFZXR$715R z>c!${Ipsm;o4>j*c>`G_ zG)b!7eknvI)q4}wJ9L&R5oHIGWIkrdToPr|hRU_PS*h}#VtJ#L?qaT5?EOi_v)i4b zvXY9r$}H+f%0qg7nn=X|3^z(MxS*+YqoxkvPalAjphqVU;MKqz1NbAKBo8h-++qB$ ze}2}NV5nJ83!ZJbjo8joDjQ;m1@u3M9UL<)>Db1)rhQhJFdbtJJ`f>NaF8E zKzj2X$~-?L^=$Jz{Wq6+_JQbDA;~-=RaHLSlgT_Yp;@wdXwhVw=RPp72ifMyQk8Mc z<6)(e&2x2%Zb|0(Hp?ON{G0?Foq3j#dbW8U{K#dV77)8M&zDqHU>Lk$1t1DJW7HZe-o57I7-vbelZZCfP2-Qj|)v%iXrbhm=HP+FXQQwTr0-M-U2c4xHcLm-EW}xakzJe5hL_s~ts~L8 z*R|QbZVJ%0-NG|~4K8h)NsCNf&b7)jGr***b4g$Z48_%6F=e zGYtY!`3}^&Bf*vLpeXW>57Sltyp-aSDj($HI#JgZq$qV0syrbUDui8mFDkzSm5(|# z$Dr5}dj%!?R!z%-mQgfftGMnC(sNaqmR>uap$9RWQ6FmBSWi&&B=_=|mld}SbUPGM z20~eEpiAA&6}9!e17mRZU4x)BgkGZZZMnhCeJ{8-Va!XkPlh5LjnxOUnr0nT6Z9Nk z7EEjTR{46w`xrkyK$-^Ui4vAa6BymC5Yw0ui3Gr4co7T^?aCqcKdboLF9rVEz}SV z;Kr|-qMP;m`)OGh&Tc=6We%?gG+o9k-4)|PL~b&XU#(ZZWPpf)&(Y!4Ij zSZLSRwjowA&#y<`*e95gIAlzoBjL`-tOL(`o+zmE^EoVo2LQG&G~%vag;X|HFl(^ znLHG2B}HF=YdJKPiIv=mqQ%EU$D=58t8*2(gzE5kD%n_xVh<&<7*loGH`yO)-P)F& z)tVJWScyN$P2Rcrw=ci^@~2pIZH?tbqD|eFFNLl=C134kczx@KIaq=+e`Lp}?`{1c z$Ch`&*2vCCt8Z)DacFVu7l|98TQo*Xe7VYzd~lki;xwbfg>IxqtXJ6E)CyZF9;T&U zQ}KSp2)kr>P5#$M^6YuPC{HUatZer?!nHHIkXkP)k^9cAsU^B>SrS?N1Z?SrS!AWz zRQv>d-tIG|#Fp53Sox4D^OCpDSzHazJDAqEe+Ks$8My}9`{a79VRla+yi3|fNN{4ANJOC z&tkDXT5_A0VXKl&XXt~TiYVIQi_D6ta4-Qeh@ymw8i+$36o)8HAp_}Hq(E_Agx0ew z#^LFC?zY_^0eqb*L{M~~CVeM{9Xh5Tz@3xNiCau;fl&B@-32JdcG3n8%{96`K+=?y zpP5pONT8@oAx2Ex-oI&<5gaIHLtYfVM8fEjsCL4V*Hz{jF449VaiHPtt2TRdlL*`oF72Mv5{v2oOa^)CEJ610ni4JTeSXD#_74clQE9=$s2 zMJ{e^Gf>`{%iEfAzuxGvF4>0hlv=nw-cO%%RubCaPW;aFtWUJ)5Pg&nZ7Y1ZDR zDKW$lR{T-)zt}(7r)gUkaVX4Qywr@}Uiyrn|;mByv_G^vErlM_A9@QLEJ`T%hgH~Twl>TmQ%kkw} z50Rh3>3DH4a32rFtp1f`mZscSF|D|y_~4z7rV2)`ZCgC^Tq=ejfk)bjZuV4(H5&36_XxJ?$RlCp{cd2=pD(y=juZiEyZGknF5L``Nx=( z>GouExk|2!EPfazuR$ztb_Rdy*)#W|zXMD6A7Yr%&RWtREvsB!q}H zEjVrgckLtYdcuO26&A=8pGDlJAp!>7uX@)dC=0s-S>ZciV{|1rMJGB@_#AN1rq{MD zQ>h{IA&Y03vB#lkya?XOjM)a`JU8Rli1B!46iI8`E>TJh`yiNhC&G88$lK(WH;mYS z33g`8G75gz&3FPa%G3l^$zS$0&Xit>xBiUDVmUO(37>6O`BS%|n~28?o@|4sN2SXw z_Y=>VwuGdrE&$bbeA=SLEEB7?6Y{@)jj|+7i>>*19Nh-5Q+6++0-Q%Q!yzJm1#=5S ziJPGpF`Q{KtZ_4Z^d1=g$+i#)o7@bo#PFuc5OXv9oEYfQi>+ke+gwVnCWf^pgU`)S z4Tg5OnkcZyO`S^ATWso&+|;2&rB#Ho&$Di7Z=!lY#oP}b64|jnL+1xP};9jZjeK(&0j4a5aM0&2R!S zxEf)Rn<3WbYJ?4L>Q16MjSzEFpCGE!2n8^gVV~7Rbv43hH$ycTq!DO&lY7dY9_zB= zgL;h4d-YzM{$Jmo_l)86YA-3y}a<}JY#aXrG|dfvZSHES>KJ0wJJ z#C|6~md!%k#LhcbHK>NrKaMb!a=7-LdOyXgIO!mu!`!QSXB2_R0JR2v5TXsXAbMwlE}&Ell0CFXh)12S zpfm%y5tD9+-SG!8FBUf^^0|*F&9_^FuEM*KidgVd3#`DssyH}R#of$rkfB^HKoiwS zcrEt-no%Fx2V5_3gFvG?m3hMc;ZXRt5ou{;N!PIkYFDdn5ZE zD4;hEuZpeR<8q*vKqU2%OVqy-Vhuz0)#}H;jPBdGc&!ya4`YVfGiiNhHn=zY@yAx; zmnfip0T{DfjB`>LR}vTtx{abe%i1C^wg&fzaUGx%uIa4%I%x2`l+YgjhXBl?Gr zBm*A6%OHL~Y=S+=(k{#LsFfj~_6m(UEY&V6r%yOnOH#>b`|B6U;vfQVLo zB??h!U{;9!s#9y1#}>JZ_zAlY@#!Kqxr^w8p4`3LJ&I}DmNw#W0@~}E!}bVs?_eG> zAI|cd2Y4E(PsIxC@bbV3z~8c4ZSgeaF7~Tkg;ksX0S&k0g(B_k+%>Qt ziu_Iq?J?PI(}snMBkvrMN5@~5Y*Fpf7yb}?#>MtoF10OhE5=9hl(!3CEmHO5LxB{0 zVx$L;D=o2Mud+|rBU9}Azb6ECc9?bm z->T)Um}6rSQv!o-8AzU@Cov1Dfa3l7kll_?5{b>ATPl`Nn2F6qp?Gx8PtHfjUVO!+ z(WhiU+KtC198JzwxSPyJnw<;HDq5Bop$})lNBIWN%CddW3|UYb91;xI_#$~ol$O<1 z;>|u^#Fy9NEugpDDq6gKLddd;@?zP$xrTM8wPOt=)5+)Iu@P>K0!bQea%;2^6_x-> z^`;s^TI=7<{(3t)AM~_P=w`B(-K`r?lyBA3M1VGGQcDbwu=;l(Esx$cA+`>8G`@Ai z^WJA-4|2+O?G_Yo+AHSPt}n>4gk42#rnMNL>P?|)76f9tfYWOGSudb^8QOP`KZ!cU zuYig=mV|)l!lRwNUpgbH_I@A3gv*Ivr7R$Z=${)uuWMn(tjICj@3CBQr1kDvg5Ciq zKkplM4Vs^kExU?E9^Lm3(KUsyX>^y;?2g`L2iE#VK11sycFDs<)e{@8m!7y7ZAr)J zLVdOrQJtKiHV}1+&qqg9(}Z$&jq|w16ccN3ccjbOt6zrQ(=2PVfj5@5!yy{h_R$%0 zHL+Xd*70ka{6;Av%i70Kj#5M~Yn$DQ`~x}DFKc(W?bb?+smt1! zTij#dGMBY?Af3j>UA`-@Z)bWNKLWgA<5wWsZDY>@mmi!B26&@kV^7kv;iPB1Gtk2^ zH^-bJ-Kl&JIvGyo=Ya{Q@+n~9RDLH#l*p2s0&MaX-gdi5h@VkV2?u z0xkJkVmEQuR$Ami|9C#eXT5^@Aw?}Z%%60+zb*ag{zaG#(aOd?Wgt)5PfGWsop-{p z@C18g=JIH|d}*K1yYp?(kLB}MlRc%nRIw3IM%ROP&u|)KE?ytPX^;=LewH2Cv9+_` z1>3MNq$js+2#tg2yhvsadYqff&vL}rhEZ0HC`gw%^2P-%>F`vnoNb}AD8907au~%| z)}l8NU8hkRqr5ihgK59^7;dXFjB{du-ubIfhXHhr@8uW`+fwDQ8Vp~;21Y81vFChW z6AzAQkMxtTMGE4RAt64|Eha0B1L#U9i5a028<4mKGRa%h$|M40cEX=@o+v#uBt^)n z(`F(9GQEIIaT+OgPHHUs)d*BBCtR;dEVTcjg|=U1=YZvcc(U?p`KciKy~ zVFD7&XXAqp9Ipx(j$yAHTSk^7hlEEj;ZliIx5u8EM~@HwImAKi%mLn}2x`fnMHqn2+o_#^QXAjAd)x z88#w=8E5a_Pj%9vQu!b~X*r6QO2&Ui{mcDQ$@!$8yj1c>Dmr&?X_qgRqzS}1u!ck? zcZB|6I}v_G5gK!3YCPJ4$CfKzOeubDQUs%DORW7Lj#hYJz&#Q#rF8l31;29=I_t&a z=uX%QZ+t*5PFdUUb6kY>mS^-?`rV7J-sMp5UXZ*UY303z`Hv~@Fy9SoNyr4IjkoqlMb(-w)6$vbT|b$ zw$OSvMyKIGFm35TA*FHwB-u95IdJ|2<3F6iec;Gk0@+4<1uI9F0P@=xpI_5}U7#nE zX>0*oYG`S9S?Z%9P79K->66&K`%z=~Umyv?O`aAdXYdjcQ?9<#Ar{Tdc10!uBBlUHWliUL5UF>I|0}z{1z3ap! zZ<*dz;1(cfY!DrA46xv*C2%LTWTte-6OzvT{Vg22Pi)HFfjgQO_2Q5Mre-i9v|8=s znsOg!Vpa%z&3v2V<^!A6e#Vx!Q7vO3cve)Od^=fs1YVV!$0MlIE41G2Sh>pNq9wMI zcTd$EJR8RwK}nzp#Qupc3VNEnI!lKho%T>0l2Ozk=7SP4Mbsy-U8la#E8+BVK9q9| zL=H&9c~G(&d5k_EN+v;?&WAGRNza>3Ac7R>U67OzGPV+;C~s^@%7o)aitQRHI~~hr?P%R$ zbb4heRX#$=QOe(pewrlz(q#F$&1h&HVzEte#FdzpTF7e<$!@KUl-qWUg>)cz=$hbo zJ1o_XDYwxKu3&XE)mWWcg6>5p=C3{hApynO9`8w7Sw9~m-@p5xw(mFOLA^LV&x`#g z8G8?5AI4a!mr{H-vOZR7FfytnX~F&~rg5%3SH%XRf2KK{Jup_9o`6%^L2M~epn-yR zeM(TD_2`z(7>|i&d;I|1 z(H}np9vtGt_~Y=*bIW;!cu+r)u);0jKS8y<$DV2NlPB?=_6zist}_dx1!it|DQYL4 z4!Atneyd^0F4G?|O0lf=D}c@PxK;0)Zuup2qgGqFi8r>n?+m6P5YPX{s>g4eHWSm9 zsJj;J$lyMRtqYFT!#`Y_4umEML1;I<GOSq znsQ%YJdg96_%?@GEX|U11W@ekoV7=HLYFd5FhA7EaSCPSFDC<1r)Y`YhPq&vp$133 zx`hYPwm-IQXmlTfBUrkU=mQ7ieLx_167B2IIbh}{zXEqwGWR|;n8e=!q!YpU%byj@ z%L?PpzxCs!(ta%5k0|bLVb+1Zl%b?mGkq_LUXS>T8enE(KX9pcq~%A(iKLkVY3~Rv zMO$XQ0nrEX=>#OR@|XVrl_Bxruh54ET4Ga_Xs#%7QAPVYqE#IK7w}}3zcaMW*YUTc z3cV(LzXe1YZewpt=6+PTzo)o!RQ11wRQm$fwi`EDc6g-H^oJNSUxW=0P^*xsKN<;2UXt-#netKj7K&Rv=HwDmSWm7tf(+ z{+9GsAWh-av}!73*%8Al{abf)`h-g~`5hQ+@}loM0}SSk^xW=AJgd_4TN+?gpy-Rb zsLe*0NZxX}#%6m@vkkV{s6Y16sVL-*$G`zRa^eN!*M-sJG_Y^Q}dVb zrrZZtdT10pNFU|v9-8|6?DrSQ}s@BSC4vA?3#~~ z6b(VWYYg?yOi^!uq253K)80~UPiqfZr+n|fl8Vs-OYRcd;L+9NH#}XhE4g1&x{o*D zj7K70iCxVTwWQaXK7_Bt=#yhOsD~J9zs@v-UuWtaYc*zf2FVtR)*Wh@@=* zh&-5VIP5ETT+xQM3nz&@)e))6qCv#8Z3#~z`Q#NGmv*$sfz=k!cDM$#%#9D{5e8d< zN$1QxXlQz*cWLa$KZi$R>sHR0zd?iu&E)hWy+QC8W7#_p4Dq+1u$=R4>?{vWYU~W; zFS{5>j``})H8$F)v9{1e5T5@ihHoS>UBb~O!O^$I_&EI6kv0A`{NXdt$hMo_{g)5+ zAeRb7gFYe=IQpFxLMWj#fR?(LY#V-{lpVW5%N-4?`DI5Dl5wURt%5mGc z#I48<k(t{)RgjF~+t^2wN4lOnH;nK^mY zfHi|W_{8L@!31YazTo|#fAnqrR}OvQHFnBlRH?s)&eq?foE-UJa^#cokdf%~map-J zEZ-&V;ScD;uQ%U1=9V$Hj`_+MKR#h;f4}nM7ceQHZ^fp58kRZ|b_pn`Sk{En%Bn!Q zCsga9@2PvL@e%LRxdG4Z;XpXx8Bp&TG@$+hI_vK6$@kW6){0FR6kp3)jmxMqG$?Lw!_0p%W%1!kwbuJoFctZrq!ry^Wc)!oQX zUyiqxMLms5L7&4bCyC1z;o#|u@{Z^M<%VGX5WPcl^2oQ;9g<6*ic08RQCo!%>U-ub z#An;3Ee6yN;s42+nXhRxhB9#oKJq?fPPl$Z<*>3L<$(qGhI{>xp@WNxh7TK3S0DBV z_?!HpaJ|2xsvJ4e@{a`n$k9Vs3n?-!AIca!a!5^JAwINEC0P~qfuf=!Yub!qTGO=o zSpFpcqQ&>4o%@kR&i#l>)cwr^>TmVntMuoGJZ!R1LtVgAUK%Pr zWc}v^%l*VnjA`}KcB)+%2>Ri~78)K+%Oy^#S%9un?xDZvK$SJn0pIc0em>4oh`I!R zXaFqbfknhPr@G#cX2I9>gA4qmX?JVpynqMI;TaJ2EJUZNsrA%Rp@qqWx?lkQ9JR-?Miw`Jvi#H>8TnOBD{GQ0 zp0C$JfK{0jv4G_1I-cGC~%#?UkltP@c2T-KS1C( zfu#ZsrPBC>2R;CGh|-|SH~7=}L`nvO-{lkHie1Tf^Xn!}%8@MJXz8>?bj6>c2)4J8 zFHM^xcqoTX($3Yc>GCN@GIDvuA&l}WFlMLlrSTi$I~+YS_?Nq(UljlNi@>}g%8xD( zc(uU!0#^!rOyCZI`ve;G;empp?ZRMf&0L98&giVw(^De%JZHMhV>qssdnR2wbGmKeHXB#R?8$(k~U{T0}pTNOzs{^B!bEx?cjTscsdCVZq{d4hSEtxMDKaWg) z4&gM6`NMS>b$Hk_rYT*`v&?x?*LI=7?u(fJ&7SU?Iuq5)JT4C%vLHCGHsr4i-hQ}z znC-AYzsgyCyESgwEdR{nDburjQ56ue%t3$!cy2B_hh2Ji>vOef{Q=!9*8)qmT zs5QH)FU1spDSnDaSNe$fZ6ypbC|xFsnaibl;!ym6k@B{~;PY44&sSz9hvg!Mbx|*p zKkP8&Gat*JHDfH9t4q1z`Z<0MScl8!Xl`d^{l`rz=E4pkr>?9rpexd)orKRRj&s6N z6UJOC1$C7l0am+#v`W`@aPd2ZI%t%fc_pP3a^hmw>nYZ|qB2;G5g@=X?F_NwLH&@q zb%6ne!){29I`(?1yt1BtEv!2x+E$=OZo61ZnQ=*e+e-)E)Fmue#Hok+nXXLiCs zQmEZ63akh@G=VQKEVE`JEL7GYnqn14G5t{OMym+AQuL4?D$@&YDu!Np@=UvSTG6NX#egh0^$Dn88v|{Gh%XoudevQo2brwgyj{9Bn zyW)RoFj%>uw2BOqW}LJALM{7YP(&sfJuvI-Ze16y3}GclKUpT$HSP9))_BE@YW#8R z*0r9zmYgL!Av{jY1c8=l!NWwWnXp5?Yf`p`9WQ6RTWn2A^a|#zq+;@KlDaF z)`kg+)FrJy566DMu%bin2gv%F0!=7b+Ax&Y&`NMxxh6lRIJARtNIsT3$}eWJh6F-o zh&Yv@!tx;~cW@bg+%Dt3hFKou3_C*oXj9{G^c#MJa))P<%XS}r#C9KXgyoOORDP1Z zMjoNuk%uXF)Dg-Zbr^DW-0iBp?EN6Mc~e=AO@qpc2G5+@QrRies~yXd{heAYrm!fg zF($qBwc%h{z+68OUG*(zf5+G%p(RNw3r}3sVm+1U?5?EQ_W`@J@8imgZBaeJIKurY ztC)Vy5w)c4i1Nyc3jE4v4L00p@0X(%EQ8R`Kkun-YU|J{X1vzpNBZ?tsu9vI&(e(} zTHsOaA0NJcu5s3zg}5qxy?{UYP9jkP_-nwWfY<*A@&mpJ7zI4-d&mzsx*7R% zk?;G+4|w|zkRPz-hsY1uxDNRNp9E|Md;>5F*zzOf2iylpKQcb}$H)&@59kH_CSVER zn}ACJ2d+ncz|R1qfUACj{D5cSA&Yf9UOxx)06qff1>6f*0(cdkCoKi+fd@IwfKLNP z0cYUBQXAlJ0qJMCC*p~h2XHH(7jW_h%664e)M2>m{|)Kj0OBQNViu+W?;hw0c<9en1ak z4nFYW1$-5-1hC-`$Pak(o5&AX1{ei=3$P7vAinox^#mWF2k_wA$PYN~9pnf69B?V% z+kZlSz~|bKA8;n#-fRQxi|=|^`S6#$$Pd`-edGuH7_bCz!9L^%Ecpxa1GWOj0O{(Z zfR%N}bSrC7LDm^39iO)*>-Yk~pNW6dzLiK^C_Dtx^IKMb(3pR9BGF2Zz3$7Le;w#y&>sYJ_*nt%AIm`h6X^X+`b|#$ zb)dfk`b3kSJ=V^@9rRqp>rcwbP~pvpWS5B*MWWt#-2$o`gohZ z9rPnXLRD^x2?ivQM{emUSoSH=FshXWR1ogZ@j5s5-bMeR zO)m%iub@BTqJP__F9Ur(#>_ih^sr4|2l}tOpl=7gAI8*7`S*g}0D6Bff42eFDb#cTGCo$n}a@GF> zr~aT{|DTCOFZ3fje@+iOevSuy(vykAW2St%$3^9rgZ?V$=VLsu^Aiyl(U*b#=ChgW zw+{3xFxSXbzwMxZ4tgg0>;=6PbCgWuLpRKsmVo{M{KVETXH7RU5b4(+^pCe@9)HGz zUb!ui_}H`$^3lch2mSJ2ClVRkAN1LvS5gMMeah|jSqJ*}x}a|dJq9`-X3+Vo9sk=4 z`e&ezG3DRs(7T~s&cK|FbhXPj$3M_d1)bK(HoeZtKOXdpK+jaaa?mGqk$)NJH-mnq zDZjyyzYg>U(EFQoV|>{T`eM*CjURhKzZ3L~^~ap`KS1Xrd)j{4PqG5s{-BS<+;yf| ze)d$GJ|6T+&@VFSa~=K5K@WpI$)smH@p~EQkAR-ZzUx4L5_CQ}qxGwDfA%HJ<6Pzc#@4?Z=G^mlCKB{+gx$V5-*@^y=pW%t*0rwu_u2W!gI$pkD`iqpSW)oce?Q z)GL|i58be4_#^1gy5w)P<@X1D0oEjca?#(k>El5kiM2>3dO7F^K+j~qWuRAKjk4V( z|9M;fI?xMVO(YhY^&?(fLc$N74WZajWUPj6Mv(PMfRjp;dP zY){YFo_)bTwr3u%Lsmjg8{|+mlP_;CFQYsHHJx0Ru4MQPg|_kc2m^}XYf(=xLoC<$ zT37C6c$!LDdsde4-5HWb2;u8=fo($Pma+9FA98J;68z$2s|#|%UQo9 zaG=0Z0w)NZEwDo10)h7kd{E$z1#T4hqQKV$?i2Wlz~c&}e1QW6juJRQ;B0{v0v8Cp zN8p13e=KmLz!wF+E^wc~PXr!!vXn1ypukZACkUJ^utFdk?Z5F)bA{52`U&~!4N}&6 z!B3L9~O7KSt_K2JXINay2U0^?lKT2%Hh9%>UBu)8`(cW}O7RNM> zq|{Viz3$W$*lYMP+FSA;oxL}RAG8V7dcj`9_5IO6%72XZ9{xqxTecPKD!|?&j?vzd z|LE*(E0S~rdyPm!9Z{0KN@U`H#-tT90H1d(m;iqrNErG1`077h!L`|5zga1bZL* zI{X;sCo4pcO{xCJC_Wt+$ zB*`Y?hhND2Wa7ASmwE<`56r2=%Ml|AFDV>0cxcfD>ds0cjxHQAcqq|uV_Aju4b`F2 zIe?*{g7fqpzfo3a71q>-0)=D7P8y8wNl0pLO}KDQ7$58yTv=`vQVNIo=UIj24K`D||*e71FFT6~Umd0Koo`#HNQEC)~BSES`X&VCN>=0Dy__xw5sPxbY4Z#Vx5 zmVSQj#&@^$b9OiWL`$DHaN|$1n&o-48{fmKJK1ZZ_&&$#Y3XwcCNam#x1w@>!HqAl zTJbHYG)5xypN~DpKfO7d)g1}W_`qa{w9&)Y8FmQB7F8FWJ*RRvp6g}AM1{646a2pfKSA&_ z1n)o3%b05fKVR@W2Pph~f~Pa`B>&cd3cp714+=hikizpBWzgu?w}}63!LJv7`ff1k z-z@s~7kr2CFTX&^;j_x1(V170^Q|u{Jf9&3{sO@dl;?EP2El(<@Sg~NhTu18IX5VNJ}U^?8-joNCWY62`;p*#->mS@f|ssSupvtI z`kmnU%pdSx!T?=MySjU)`$3mN!#3;zpqyx?;B zJKQ;~{C(ihLi}%C=_PjiI>7kUct{NC^i&7idZmmDCu0LMD^2`Aoi{d9iBpI z%jsc#(%;MMyCu^?!JjH|><+;{Ao#xyRQ!_!|AgQlJxAd?1iwx2p0gF6-#G&9HNorW z>faas_XV$?SHCOxPQm}VkCLP9*&Q2%>Fje3<9k>$u2uYJiX3kS{#n9*-i3-^*S8LM z@*nz0I9+}DFV2r=kh2E(0&peIHy#rCJ9~Rsg7%-E3Vzi23O`!pzr^^|`P(au7bXMz zIRpMv;K{G(*I(%JVk$@133=)5b`j%yShZp|y(pfLf&UiZ*>BgBuw3$Ex@t1;KP2+U zo#$mf-7ddiIj33Cq<;GA407Jjfd5AZe9sfo*Y_O8_psJUef9Wzx!@lYJ^5WOXnd34 zpOW^vnQLKLiv+Kq&-1%~pxq<*htBmfXFvXHSwCRBWkvH9UeMMvz>~i%eY}KGs19Gh z6@E$D;7=LwpJ%|Ig$*!@lQp9M1d(*P;D0#N%NRb}kGmUzXa9Mqgz-@ctn+~iv<5D@FyGVGOhnc<`*Ud{7&RNalMzZR}1Y!!B3Gm`JmwG%s$ntQOfNv_;Uq+ zrN_${ey0<6R|)<w6O4`%^Sc8-dFPUBpbHIMlvVSsOloT73iCm^)%WZ-`)1O7#k z({QSiqvOUt!Rzx_?~43SfG0im@0#hj-K~eRLs;gYxH{he@6g@C7J$&`(PQqdI z*9s|D$FZ5h?>R;B^E=j%zW{i$n^*h_D89ZX{PQpMa+==>#NF2g-+QXU^SfZcuLGXS z)xU42+xH{9_{XyNpjQ;02bC`RBJw zn5gCdf$^tVYo1Ve-H!DA0E#E)pYCOTJ)ikp_zQ$z%PA;O{Q5i_zng@dXEUBfxc&^! zfG^H~ze(gjCi?KZ^N?5vJjMBBzq%86kE=wLcu?eACw|pmc%Bq|RL+6&yRV?N3SOUk z)dul7x$q(jyT^4^_}W)_;iyrg zhC*^0CO_?Ct6gcFWC#TtEVYka92!7d z?SA?a8YA#93tuCxs?rSh$FOO0yS7HM>Cc@Km)}2O*0tkiPMUhH-(NUlXwfj1qdD-o zBYb*Wf7Vog+KfMyswlim@4{Dyv1iZfyCs$5i*+zklhsv>D&FCg zFRvz5=aP%vx#&CQ&ey@A3_cw0=HTyo`>Sf_y3x*;s{GW_ZX$m*R%hX_kka==&4#j( zuGTWXc1U%j#^O(inmKKxD<`#&Zf94OhmRaKf|VmrFy-hpAL?;h!A2)Fr;W#B_B7l{ zjcjwT=Io9clHOWXTQ(oDEfDZ}Cr+L;cAS4$;jqGy z2&QEV+!&pcKbB~FxO}k_FP8=I{m(9P*zRV>D?F$S`cV#l(A?FHo%fIYetgfrrWVw) z(hwd;x(mP~&ziF8IycfkY33As%u$a9GpCHB;bA5p-lj*0^l8UnQiPI#S63CDTdAV6 zttH*4BVY8n=(41Y%2QGzp8aiVGMXLO`8P1wDJ7ct@hN0Z+mVC4#P(Y@H5;z_c7M30 zsN^)+=t zBq~z*Z8NwEDGfn)n4=!UX*udxS=P`+R%ci9Bv}S5Yoo&;o z&r$mI$1LqW=Xe+|n+&6zD)CSAC^x4$i#w|w4z%AmUT=Gv3NHw>7!w`cIr2HfD92;% zn=n9I@wa~Muwj&%h^uAZGsM#aT*4d*9KoSJIS zx7UMiag8n%(j17+}*Qe_o;{X%VvDdW`({L^Kz zJg%y=z8))O%1j0!SH|MECTXTjI__?W zsK_o~=U)vR`5);=mp+fV2>btZovwiWSH#)r2=2`M`rIaczn3olMy|T$zt}Ez!TXUi z^Xun8b=YU6YuF40^1_i@D#ODf;1(DvU1?uezx#;6;e|B@uU7N;R~GhMdH+92iUX+|L?CAn /sys/bus/i2c/devices/1-0032/system_led_fld + CURRENTR_LED=1 + fi + else + if [ $SYSTEM_READY -eq 0 ]; then + # set SYSTEM LED to Amber + if [ "$CURRENTR_LED" -ne "2" ]; then + echo 0x02 > /sys/bus/i2c/devices/1-0032/system_led_fld + CURRENTR_LED=2 + fi + else + # set SYS LED to Green + if [ "$CURRENTR_LED" -ne "1" ]; then + echo 0x01 > /sys/bus/i2c/devices/1-0032/system_led_fld + CURRENTR_LED=1 + fi + fi + fi + sleep 10 +done + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/watchdog/watchdog.conf b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/watchdog/watchdog.conf new file mode 100644 index 000000000000..81f0b7b819bf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/watchdog/watchdog.conf @@ -0,0 +1,45 @@ +#ping = 172.31.14.1 +#ping = 172.26.1.255 +#interface = eth0 +#file = /var/log/messages +#change = 1407 + +# Uncomment to enable test. Setting one of these values to '0' disables it. +# These values will hopefully never reboot your machine during normal use +# (if your machine is really hung, the loadavg will go much higher than 25) +#max-load-1 = 24 +#max-load-5 = 18 +#max-load-15 = 12 + +# Note that this is the number of pages! +# To get the real size, check how large the pagesize is on your machine. +#min-memory = 1 +#allocatable-memory = 1 + +#repair-binary = /usr/sbin/repair +#repair-timeout = +#test-binary = +#test-timeout = + +watchdog-device = /dev/watchdog + +# Defaults compiled into the binary +#temperature-device = +#max-temperature = 120 + +# Defaults compiled into the binary +#admin = root +#interval = 1 +#logtick = 1 +#log-dir = /var/log/watchdog + +# This greatly decreases the chance that watchdog won't be scheduled before +# your machine is really loaded +realtime = yes +priority = 99 + +# Check if rsyslogd is still running by enabling the following line +#pidfile = /var/run/rsyslogd.pid + +# timeout : 15 , 30 , 60 , 90 , 120 , 180 , 240 sec +watchdog-timeout = 120 diff --git a/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/xcvr-serv/xcvr-servd b/platform/broadcom/sonic-platform-modules-mitac/ly1200-32x/opt/xcvr-serv/xcvr-servd new file mode 100755 index 0000000000000000000000000000000000000000..c882ff8e335af0e1f1722c990166b8711f407307 GIT binary patch literal 31456 zcmchA3w%`7wfD{o0!R`R6cBY(f}j$T@GvOq1Q?ts(MXA{aQrscOfVx*iwy^+O*P|*65uvsSS#nTI$^YT6^y^=S*fu zVt@TkemU#x_1?IPRH6c>1k;~AL-&2L8+cxJEP=Th$=rP6|O{N3%j^nTq-62 zlZAgfQwYi{4ZDey zISx4%z*W2v@UX06$Xsn_P7S9kdm3uFyCFw@j`dL46^rU>H!WMTsLr#nuC^h#W8sdH zWeb-rDeyNI6tn-tM<#E(vyxToc-W94+tcw+Wl8jPm+WcuPW{&Zy!W?BZ4bYC#kAY+ zDW6ZW`X85LK3)Z(BK zcc$?3xfJ;SmjeH43j7~Z;5{ku2U7U|mlXULrNDQlz|V(%8~ziIe^0@`6O75?_FxMB z7gF%Ql7jyyDezCGzaUXN zc`F6}zaW#0|4a&eG=-i}3cNr+&smpug|-=)*tZt)|aoUYi#hYcWwuiHc36pHP>+JILml&d}%@a}+f{(!HsSrAtOskWguV4%D^kbvTC z@Z0P2H8i^F8mrxb+QtThMJfb(tAVP9T9Zk4AmDSc+UmxJ25)s-JyZPNfWLZ+*VE+o zx$6xbR#IbKZFRG#u50us<^*vd)5vr+Wp|nIBk2tYf0M7aAy6Zb&xY#yCgHE$+~BSg z9=8|aCv2dxPWYSsb&Z=vy|*4t2=)R2mhJ@Wygt!TTkRFKjnx70k|K9N1pRehFZ2a` z2uPz3fg#(fKDE^Q8W0T z#wJZC8eNk#UDK6>GL0mTH2xEU#yuPU1G8!;(MUI)*l`ejC+e`K2WJyKL)c98FMv;v zuacf_(D&X^MQV6XF@vw<>7c?-L=x(aqsxR>CYW}@gr_*@qsN5Ta|5FFn(*d%LZ1mw zw)GJ);j=XoaL9y5#*Jgxgr96+aj~|FQ>1$eU&&Lp2~T6OKJrZXsTv75(}d44;cX^- zt_eTigx6(3YzTJe^b8I5-G2t&W@$WU^FE`;kO?aCLzt4of(uCh{ z!e3>=A2i{wHsQNW_-gzquouQB0!P5AjHe4h!wz=V&O@YkB~&bGm9XEF9n=7gL&=a_1u zGNq~MMk_d-PHAegQ9GwUycua~s?kDDze8ziqEQ>C-=Z`%&1fE{|43i4 z(nB8sk^f6dQxlB#ar$SJrluF|;q(gmN>h`G+By9YrKzbz3pwqh z^c+gtIQ<}{scA&>IK7F|)Fh&U)Av&P3Q7ar$;jQ1!!XO(D96(^pZNnn1J_>7qZCgPz>JqT@Fy{BzF zLWEc!n0FCUY<#YUjsl%NO!P|U=iX)oM?cDd0%vH*c{FmXGwrzZrH=wL3~f`iw%jX7 z58H3OdHL-&A%fE?AsA^uz&0Mwng>+cyU$VkInr51j@>GPSp)wEa)z=qBoOP_7<~vb zbd8o-oZ ze9${!llq@MTtXbw{-mWTn&bKBRFrI?mO*r358Y%#5FEpY!77eWhZ8x0W^)+fj2)r= zDe?>@nM&PLd}=ynW|N)$Iae8_{7 zbXbrth44jHf#~N!LZHHxgQ24@zZL3f>q|rTy|t}nSOl&Ip`#+r+2I%py>zIFoX-S1 zGA2WK@I%rw43rqS+QRD}!TTt9Nzoyx;rJ2u&=r7l1wxUW~u%=2DJ;dBboYO*`($*^!6r!9wep3T=*s>s5?YOeRu~| z`*2NHjYCdq0d0;v`I1QdqM-cgjLFHQU2aK*tdvjLw2>Lx! zqd#ULe%By!2l1qZxZ5Cdhwudpk)|9nz{|-Q@?E-`1~yZ#@(zZ6llj+;BpW%Gp);+*5f?dmo7nuv#qPpnPo4pLfGxu zG>5A>FSFg*(N5gwWio4&&E!F3Iv(TuFdtLxf2C^w_aY#=bGn!s$@x64uy~xi>kr5x zDnTnX)~DX*3en27fe^D8QQ0LKULn*Pgy%d4#*jn9gC^9+^Tf8o*>RAA%ig_%jwdqd zJswL7BYC)>!3|x;Fq}F=exeq4T3gJ$Ku51d`O1KOvs4A_RdhT$&j+B1u8lnBGs2SR zbutXcq|8f)G7IczV#kl{qfRz>R{8WvS4t zVD}c_jQ-n!_U!D~y+Pr)Q4|3uCH_p7Ss=8VCi`J#yxMU((?Qc6^NnToi!JUU%fXv)J?81G|Z^t1EYR1N2jmyW<+jE=ej& z-6zVrM#?htY%ot`<{mN>dIj{)&NiZw+fD|-^ZG5xoS{w*0y8Ymp!0{nG#7TVx+<(j z*p?685_&~ia1K=NVU=;Sbu-!Qz#W<`bNiKGt7Wzmp~X6>0@KLCBU@zOJF(b6rL1gI96cefbu2Pui0rY7 z1WDwo1hu_Zp1Z*#`+#rUtonf0crtqy?)@2!1FbD9O8aP<3wA_2?!jJ)YJn-VuiW_evGV8G}D7ecgF*^<5Q|yp(J^t8N4&>I5EjFh+x0E zBAE_Vv8F=atT7iMB;_x!rsQYksoHPsi{FluK{>hVcp_rt-E<7`{YSDl#LbeNs6Q;EN{S;DJ<7f7_nCAj(nQ!(pq?`L{v$H zQQS6c4@9s%&`0Y<4BM(aG5L3f9gz^tlw?7D1Fpa(Mr>Z4_sP}y(#T!xqTySi@(seO z$b{YE+n2OQaTjRq4G%(<5oP_jV@f^d8V*A%(o3S}%!@=&pyq5mGHnO1l=0Wt|sd#RL- zMawCfqMiiEehG#o;C>e+nikA6n#um*}=Ys1{8 z@-zlLnzP;p^W0+{KrexHyR&0AZ7`y}Z9zT`&x5p4U>8$#9D|3c0z>pN>@aXIC|5|x zm597dW$K`U9_0dIeqo$juNNF?&qq!0m z6Y0)p7HxC;7Wsk=&QLZI?&_vm+&XlIoY~#>Ji41!(`}y~fJg_=$*?!jz`oNc`#Wf+ zou87(yHSfrRNiKfx~v{8C6E3Y5u{vG{-Em`-Z=wD>vqAgb|Wi#6H=Hse}Fj_b!2i*ItdGN$5}MmzMC9pbH7vvFKL#PyX!T0 zCx@an9AgI-plXckK;@C7J1CZzBsorn%ZJf(pE3>CZ=xDXt}Lpbm9TkAYbeHwDDK#I zIS>Z%hlcvW2&t##)vusT4)3;7^h)vR+FyvJ@?46=v0X>do*hP83@=@GjZMJS(2KF2 zfdy!u;ZYv@Ulx^0-f=( z_mMXd0_sg=SGgHP*;T?8FVPNKy*v)zxT}nQ2ilFnt&8dx4{ljtFb224LX>OQA?oI| z6Okog2vKLeKa@u`sXOv4`QSJ=uuczvXWk&E5(mJavu2XizV%pryOw<;jZIRc(V@2u z79xDTq2MW_D;~~}(do6$OfDwxjG4(6cEpHInc)E%NwVnd({`gz=;#cEE3ux$`1#VI z2;4O~>UvU5lNOpA^cmq>2DA~rpfM$Qtv^{ro`E@8TH2ohYeZ(UKNOJ%*qmufP%aU2 z#0#~c5d<+LoSU%SjiPXdGk==B68G%-!ZYR<*{Bu`VHf)D@Qlmjsa4?_*B2YKrQsP@ z#Z%XWXUvSJW`$?u#8Xp9TQ}l^d#rK~8|Fhn?D4_+UCO#$T1WfMda}?a21=+YXLZu$ zLcaVDI6~_tV4tGPOZf78ba??^ev2;Clm*-pq0RnKFk)1Iv*dv8PJhPT8<$41oig(- zS?;dKBy+ejB6ra9d9bBQGdLmlpSCg;_Z2dKx&wwupuR=vX((hP zm0(+!P4`Z;sVrruDcLi~*w|#LXH&wbFjFAIKORlk7+6fg-;lxs51rSnAsKi10VP;^ zUcthVdCgaX*(lHNVBFb5cL|!)2QF&Ej5eIrSU?NH;oL{Bp{bkco`I?bq00W`72(bE z$K5C}Ob&8)(W7#hHZ68UXvQ=wYXergL>qG@*+2eDGGE>p`B;@?kY^X?q93c0{74CZ ztV-gO!sD+b%a!1`D~V8oDJseB*Q-i0C83h=SgYy>4L3AE4jYqx?l=Zo&QoK}wIon6 zCdQ7+9yRZ}09%b{h+LnuqCcc6M$;dvUDyVkgl>jwc*k|h`2cFaoGSgc55qx+qo3wl zXvHFOCGrmh))DHqRGvhfGImj8*qjH)NkZ_R!rMSdZ9jO8S`PL}F*srCv6n0QS-Eh) z6pwFbInI87jmaUpJ?0p?n(mWDc=yH8cL-joeUI6%Ls5Bz20_ydFO#uY%Q$*X*th?v zd3#M7dI{@@e9%M9?Btc0GMlI7ZQ$fd9iuWMM(w{xv{>~m@Fe;hIn%>%dj*nCO!TI#!bC5E7H*n# zwviB*&!=#urgylPIf$uYdEZ)u+TI?Fv^)B-PYFP~w*BpnGvpp7S;!9N2beEc4$+#y zhWjacv3~FGOglREP|L~CP`d-Wos}o#_QOfcQJ=wTMCf%=Ym62j0d;3@A`D@A-(@V( zS;d)9PkZ@^cE>SLkF^uSNOhDMWV#6I4B^7iFs2ke?GAm57J_tlwePSEF)^k=$Kf+$ z$u9%D2iOqJ^m=&Pp(iY`{wm>D>1F5jqG{ITf9~N3!FuMBB()!Czwj07Y@SHX^}-H zPht7t+^4BH(Tp+LLfeLqNE_ePY`#5`Zej-U_0ya!5<#|*s~*bL25YWv0TXHKj_e|7 z&fiSxB`9jW?Rk>6MbeByv4u{=GhB&U)o0{+mGB zV}FYftrB6%C#o&ww7r}fQaqEiL*0sP0o3_4T&g7o3jclBen0mBd1{$+;ihR;)xA|B z_i1~2?$fCK!3YHjHvd&d$2z(A5KXRfu$^{_^eT)@)^t1Gp9me}G_hu+iNeqj<}SMC z#tor&PT{ve?mkRSwx@$WoRWUPp4smB;5_84cFL6FebcR~wn$pLoV~5}X{h!EvI%{|?w*D>Aybm=)x3BbpRk=@B4(nK>^P+mb+S0S*b`B{+fjB}BHN6LSNE@toS{r(Q zHFU(LpLVuAm*!kP5PXXsV7+f+>HVb}OCKn8;SoRM`M!6b!vICkysAfB)A+f0Ar|4; z|3#aE{zbLL)r&mdZFtb%zo=+oVd3K9MNN%(H>1c^;%f4F@xDa>kr*3)tq(6~1l)n3 zf9(AA{;gxyU*G8Qd+UgOZ2EnE_I=F!bxp9~6^nLMZ^IiKexIxU(`;-k_LjSfmYD)J zYJ8dB6fk9I>~b=2W8;qpZfyMVz>SSx1@63YTCD2T4X)xP@j#{4Z{Z&isBy?~pvK5= z1Zs@@Mxe&XZv<*o{^F&s#l_=@ljI+NoZ@n0i<9IZdz>Wy*yAMmjX14w*VcJGwm_pz zy|ZPj_xk#MJAzzbclHCg0)#P#?W>wWG9KfiG1v(@@-)KLbmw^7eYE)}HqN4>a{zaRcy!i#i8$`TR>FvdMDR^rA z^p+&5nO}Gt)TPJ7&Mz~@`GtwZno=~5^29cSDq9n*L#f3*p*Jgy%7NNxZCTVT=+3CE z;?9b~RfR=278cqH`JfD`%fdpFKK7?{RYjRizLLl>yRE{({6?FN+gC3~+RiT$=hyZ5 z{QPA)_(t1w`+T+A+;x80M%T%=Ms2}{tqqOa8*D~l*|>c)p;_d6YztW$7lz+lALMJM zl9MV$u%VjX4Ykcr5JUH5bSs!vp!-OSlM!rl{@k8;A>{8ciHxWPLR`GS4y{7WRj^n= zyMhlYc&CE*EBI9fzpda?3jRdFR}}10@aGDC>RM^r3O=mi^^*Ry zg6}F=xKQFBRPeNd-&64X@#Yc02r+ew6k|GQZcB6Ah512F-|r_@68i_^2O5A0l69wiWKk-yqo%`DDo?V`S^XR1b=)<*Unzkc>`N ztz@gbe6?AmU7B$dJ^FDac-KB3i`|dwlRuBet_OVfBp!|gjQk=Ndjin^LM(O+@JE3C zfS-9W7R$sg){}s90XM%Ci>(HH2YVA9z(1UZJfH{rQBMG-{~q#yU&ZETKj6#Q5Y5C* z$+NiCHy6;48+5Aye+B3Pd=)nzcL56A5PyQ`xT}2(@EBk};6yy-l9`F$(Eywa*blfG z@Hcoi#{+m2PfhItEWvYMPXK-s@EG7rco?l8F!No=V=emwz`1~P@VHtX;B*zYw1?J- zv>kbAmtHV2dr#WLJi^bx|K6X)V%I7j0?GN&oFA#6bS72L3LzgM16!X3#yrugAS@znM<9aFF~i;Ge{! z40jX4@NcbQ{|V50L0@I2%kZ-NG0^`C`pstg4i;y6Kj<^@_)4dlp8ickejr%_==5OIb_?BS&^@3(3VOAL{(wQ>1^SDiFSC?ikx_n6fc^&h zjl~vvfk8h8`Y`&B$1M84%KBFW*AIFt`V}wHSLWn>DczAX^NSgd99u`GBWM1jS4|)*J5l3g9opG%SY6fzd zjzstci8k;%6~hGzUpUpySM8VBA^5<9(|oi~vNP29CY9EHYkSm1(V^4WbLRZyDSq7e;I#Gw!v?2+oNZ^h|6eEl zJ5!1FYNkp*wki0Cf?rqg`wAXV@VJ7nDEOv=?<+VVN9wy+!FdWUQ*e!f_b6DS;5G#x zQSj>ueqX@@3LaPR6$Rf^@O=d*7KN5L8ew<-9Df?rqg`wAXV@VJ7B zar}GJx;>VtcC|&py$YUCa9F|l%Vj>-D~NhV&(YwGaEYgDIwo9YCt$Q2UH=*RF;1!M zXjQsB>iVwna`alcTij{_f)%8_iCxQmp&6f0Ug( zrC9fu|0p}tlw#cvZ&B@GuYx@aiW}|BS*T!@g4(aq;&!28)Z>qq8!sHq&P7V0Zb#$Q zulYx_qsKknjT&CX?tQMV&4H(ofJoy(O%-HyhqU-OS<=L*HB+mV(VFC5K| zO)1pvXuSG0|7douRE)YE9aQZiqM&VsojEELY*lc-f@8IFm15NGNXv~Ej+URRl|tQ) z#;afRk7j4CV$|(O%Z(R~W+z`M)a_`z`ZfP(cIGL@%eBDAgrnKHM(Ne<=wq6p_ocXZG9}|vdXMxEM@zO!4iV^m(a={{LCvP2KmW=Dq@%2Xj;b5Ad-?nPijkfu# zy_;&?4Ynl(%L|GZ78Nd#SBb=uf+Y)!h=vOx3jEFW0rw_A{2(R6E&7UY#59Ql?9zJ+ zN>`RG47fL|)aHg@!KPp>e)G82BMK;m`*vGIfv33v`XmhaBxRe|=ck|RWHyy>f#&np zxk*4>HPr<~0sls40e&A8*EL9h*66`~Pf_6A;;O-~b9!A{Jdo8XDdEBmC3mxw(AN)E zgALl<^|jS7-3Wy^6|fblag*OK3aT6H>(%o$Bf@S%WKhu4?Iw)8q~E}tlN6sJRwTt| z8v8wFWf}NI?$)II6NKImvhq(9$@Wn)u)C!9U#$F-gx<%o;wKBe-($s35qjUtioZZq zsQnHreyZ_%=T>}9Ctoe4T+`)YbcMW@3i8$k=zY z;-?GxIkdzhL(IVMlPAMpEcUAXGqX&FxJ2lEH7g#YZh102vqaau$?zjbHPkfxTIw0@ z3(UG{y^@CA&qV)e{7n~FWhCr(7AU+u0bi={tqJ%~vi`WAl#CUOP6BT0u|4^4(# zGX6_}Cw_X=o({dPS&)LC-ee_zwiinNyIBhN`xO3!!mm0 zD*Ts$Cx7T!bUH5Nvk>1_{1L^^_Xa@w55-SUdDEf!k0}1%6-#`CsY3ix@zW#Hbm(;g z&`IOd$NbYodzqcsjpJ>`kF1BpkSxw0k^y+9_rWPe2mOwFT9S4re>qy5dZvnBUt?!ZzITSJGr&(1vjqL}2OWA|l9@sHnS!1!r$f)XE&)E7p9LxKt5V?a zQTpvlzusrutnkhR{O5tsgFm|zo}I!e#QI0}|6gMKRPmbyc4p;!dANE~>0h0o|2gJo zR?F$l6!>#WKmA%29el43a0)V#EIvz8;Mb?X(=W+V{96Fp9N-b|rqI0gO^Oc;~-vkZ8uZ(CG-gE$|bVE(CM#S%NG zt0h{{J$@?p#PP0~^~@9%Dn8u&A@fg4KmB?b9oc*q;>$|^ua?>w!}k_(^#tP;lL^qT zn^1hVtNOD^(M|$yGx6!mS5xTuGw{>WXNv5E@%o(7|813Dz84B*lQH$4hW=U4TXcM8 zF@Bb)ONiSIz>}YPABgX%Lyv>;+PgU1sPr@?=-H8i|8b?CewLOFFQ0{YDh2;67<+OzHQw9B~CmmrvT4EqP3#HQ*Ed7Nl;Y1_SXhmR^YmlY210&7 zgV){$jvw1KJ?n;NCONuw-fRk~ozg_p^|f6fKUE-PL%t#Sc230(AN7@y-h# zWF?ddK@ZxwHZ=#lE?%9-Ir#}Y6UFe5Sm@zF%C~fCaq$f|#H|vYAKx?4OG>PC`S_lR zVR;GEtyx!E?r=HoTuq-x;S$!@6eA<39^qR3sXI%{%T|HQMBy*12-j_E?^;>9)^*pK zHJ@;-cdaj7xz<7I_*)&-{vem7pbWU`{hvlXsorL{o4?Va9y52zr|7M;#BZTksr;dk z`X(##e4m7&kjw9f#KY56+u)MnF(S@v{IQb+6h1N&{~}D>EPZuEeICY&WW8||eUXG7 z;igw7*hWLJKJJKo(ZN;i#wS`_o9f+7!sX>UA|q(HLJku-(QEZMzFC0|t>sfRR)6#- zRIJ#zF@C^R>q+vd7^~dK54%|D^7}7VoMB6b9Wi!MT=-isR!%N&cfg9|Pt{maR*l>? z3{<^)hpVY^yVr+~3vU6SKDs?t=@Flqv63yZpw?g|8-}o}h_|}@Tg~NR5b>Ia#S8R; zNvfvXgFQg*b6f%JKN`|fwcEc{$ZzeW@PJk7mT&nM67768)>*~ig1^xvUrC6Yk{wIg zU1&8P_#E_mEq1LcN?Y< ziJc`6`>AW)$aXD1tEJ-;{}k6qoBT=_9`NT^x$xO4`57xKpL|cnic{0Hj}7R49!<@$ zog$BPyMhwTk-#{sX}poX8dsQ#8}f6~?MUHyVWrT2@ZqQ1Wv* z6+b1)uLcP})!V53uS&NAL(h#e;OC0z3d>eLFkQABcOo?f|60B^-Hw#N{RRdiTN%W% zj^m`|XG*fT2M}8-hP=KX(M|$5^z*1PC3Wa)f)C&yx3&!b^?i#UD?_B84(-48Q^T#G z(X*vGt?zH-VSY|W6`$qzz{pSSze0*r}n{sR0b%6}0!s#7Xl#(Jett^X450I1@Cggin3W_f-8r9#Q;a@72J>O#Y>Cdljc zc8}WdUN>J$N~q;D_VEOH{rvOX63L;$pxHUrMgkX|_&2vdy?;`u=~eB2y#Ny&zEjwYX?Yx{pG2Ps{83T>5*w^rP@}==!Ps*X8gg zXlDERe%RhSSj?#JG8Ok<>lsLp*Z0jjm3)P=pGy90g1oWcSS}@Ysdk{{?fOE&4*|&+ zoqv5FZr8n%VMy_5VAmH4(v3KBu`mIz<(DVmb#^qI2D-LwX8mtvKU*^@VnWhV_s#Mr n?vttcR5@{6hJU)pq~ospFKVC3><`s~fJ66#G9~k>uL=GyV(dpR literal 0 HcmV?d00001 diff --git a/platform/broadcom/sonic-platform-modules-quanta b/platform/broadcom/sonic-platform-modules-quanta deleted file mode 160000 index 2a300312a084..000000000000 --- a/platform/broadcom/sonic-platform-modules-quanta +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2a300312a084cd96cdd3657020b5e207adc04559 diff --git a/platform/broadcom/sonic-platform-modules-quanta/.gitignore b/platform/broadcom/sonic-platform-modules-quanta/.gitignore new file mode 100755 index 000000000000..2615f7f89bbb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/.gitignore @@ -0,0 +1,37 @@ +# Object files +*.o +*.ko +*.cmd +*.mod.c +*.symvers +*.order +*.obj +*.elf + +# 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 diff --git a/platform/broadcom/sonic-platform-modules-quanta/LICENSE b/platform/broadcom/sonic-platform-modules-quanta/LICENSE new file mode 100755 index 000000000000..609b3082d11c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2018 Quanta Computer 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-quanta/README.md b/platform/broadcom/sonic-platform-modules-quanta/README.md new file mode 100644 index 000000000000..bcc06271904a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/README.md @@ -0,0 +1,2 @@ +# sonic-platform-modules-quanta +SONiC platform folder which contain drivers for Quanta Switch diff --git a/platform/broadcom/sonic-platform-modules-quanta/debian/changelog b/platform/broadcom/sonic-platform-modules-quanta/debian/changelog new file mode 100755 index 000000000000..77d3407ec943 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/debian/changelog @@ -0,0 +1,6 @@ +sonic-quanta-platform-modules (1.0) unstable; urgency=low + + * Add support for Quanta IX1B-32X + * Initial release + + -- Chih-Pei Chang Jonathan Tsai Wed, 20 Dec 2017 09:26:01 +0800 diff --git a/platform/broadcom/sonic-platform-modules-quanta/debian/compat b/platform/broadcom/sonic-platform-modules-quanta/debian/compat new file mode 100755 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-quanta/debian/control b/platform/broadcom/sonic-platform-modules-quanta/debian/control new file mode 100755 index 000000000000..af058ee98f2d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/debian/control @@ -0,0 +1,12 @@ +Source: sonic-quanta-platform-modules +Section: main +Priority: extra +Maintainer: Chih-Pei Chang , Jonathan Tsai +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: sonic-platform-quanta-ix1b-32x +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as psu, led, sfp + diff --git a/platform/broadcom/sonic-platform-modules-quanta/debian/rules b/platform/broadcom/sonic-platform-modules-quanta/debian/rules new file mode 100755 index 000000000000..45bb29742a1c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/debian/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +include /usr/share/dpkg/pkg-info.mk + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +PYTHON ?= python2 + +PACKAGE_PRE_NAME := sonic-platform-quanta +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= ix1b-32x +MODULE_DIR := modules +UTILS_DIR := utils +SERVICE_DIR := service +CLASSES_DIR := classes +CONF_DIR := conf + +%: + dh $@ --with systemd,python2,python3 --buildsystem=pybuild + +clean: + dh_testdir + dh_testroot + dh_clean + +build: + #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + $(PYTHON) $${mod}/setup.py build; \ + done) + +binary: binary-arch binary-indep + # Nothing to do + +binary-arch: + # Nothing to do + +#install: build + #dh_testdir + #dh_testroot + #dh_clean -k + #dh_installdirs + +binary-indep: + dh_testdir + dh_installdirs + + # Custom package commands + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + $(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + done) + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +.PHONY: build binary binary-arch binary-indep clean diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/classes/__init__.py b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/Makefile b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/Makefile new file mode 100755 index 000000000000..fd73f274ef53 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/Makefile @@ -0,0 +1,3 @@ +obj-m:=qci_pmbus.o qci_cpld_qsfp28.o qci_platform_ix1b.o + + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/pmbus.h b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/pmbus.h new file mode 100755 index 000000000000..fa9beb3eb60c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/pmbus.h @@ -0,0 +1,387 @@ +/* + * pmbus.h - Common defines and structures for PMBus devices + * + * Copyright (c) 2010, 2011 Ericsson AB. + * Copyright (c) 2012 Guenter Roeck + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef PMBUS_H +#define PMBUS_H + +/* + * Registers + */ +#define PMBUS_PAGE 0x00 +#define PMBUS_OPERATION 0x01 +#define PMBUS_ON_OFF_CONFIG 0x02 +#define PMBUS_CLEAR_FAULTS 0x03 +#define PMBUS_PHASE 0x04 + +#define PMBUS_CAPABILITY 0x19 +#define PMBUS_QUERY 0x1A + +#define PMBUS_VOUT_MODE 0x20 +#define PMBUS_VOUT_COMMAND 0x21 +#define PMBUS_VOUT_TRIM 0x22 +#define PMBUS_VOUT_CAL_OFFSET 0x23 +#define PMBUS_VOUT_MAX 0x24 +#define PMBUS_VOUT_MARGIN_HIGH 0x25 +#define PMBUS_VOUT_MARGIN_LOW 0x26 +#define PMBUS_VOUT_TRANSITION_RATE 0x27 +#define PMBUS_VOUT_DROOP 0x28 +#define PMBUS_VOUT_SCALE_LOOP 0x29 +#define PMBUS_VOUT_SCALE_MONITOR 0x2A + +#define PMBUS_COEFFICIENTS 0x30 +#define PMBUS_POUT_MAX 0x31 + +#define PMBUS_FAN_CONFIG_12 0x3A +#define PMBUS_FAN_COMMAND_1 0x3B +#define PMBUS_FAN_COMMAND_2 0x3C +#define PMBUS_FAN_CONFIG_34 0x3D +#define PMBUS_FAN_COMMAND_3 0x3E +#define PMBUS_FAN_COMMAND_4 0x3F + +#define PMBUS_VOUT_OV_FAULT_LIMIT 0x40 +#define PMBUS_VOUT_OV_FAULT_RESPONSE 0x41 +#define PMBUS_VOUT_OV_WARN_LIMIT 0x42 +#define PMBUS_VOUT_UV_WARN_LIMIT 0x43 +#define PMBUS_VOUT_UV_FAULT_LIMIT 0x44 +#define PMBUS_VOUT_UV_FAULT_RESPONSE 0x45 +#define PMBUS_IOUT_OC_FAULT_LIMIT 0x46 +#define PMBUS_IOUT_OC_FAULT_RESPONSE 0x47 +#define PMBUS_IOUT_OC_LV_FAULT_LIMIT 0x48 +#define PMBUS_IOUT_OC_LV_FAULT_RESPONSE 0x49 +#define PMBUS_IOUT_OC_WARN_LIMIT 0x4A +#define PMBUS_IOUT_UC_FAULT_LIMIT 0x4B +#define PMBUS_IOUT_UC_FAULT_RESPONSE 0x4C + +#define PMBUS_OT_FAULT_LIMIT 0x4F +#define PMBUS_OT_FAULT_RESPONSE 0x50 +#define PMBUS_OT_WARN_LIMIT 0x51 +#define PMBUS_UT_WARN_LIMIT 0x52 +#define PMBUS_UT_FAULT_LIMIT 0x53 +#define PMBUS_UT_FAULT_RESPONSE 0x54 +#define PMBUS_VIN_OV_FAULT_LIMIT 0x55 +#define PMBUS_VIN_OV_FAULT_RESPONSE 0x56 +#define PMBUS_VIN_OV_WARN_LIMIT 0x57 +#define PMBUS_VIN_UV_WARN_LIMIT 0x58 +#define PMBUS_VIN_UV_FAULT_LIMIT 0x59 + +#define PMBUS_IIN_OC_FAULT_LIMIT 0x5B +#define PMBUS_IIN_OC_WARN_LIMIT 0x5D + +#define PMBUS_POUT_OP_FAULT_LIMIT 0x68 +#define PMBUS_POUT_OP_WARN_LIMIT 0x6A +#define PMBUS_PIN_OP_WARN_LIMIT 0x6B + +#define PMBUS_STATUS_BYTE 0x78 +#define PMBUS_STATUS_WORD 0x79 +#define PMBUS_STATUS_VOUT 0x7A +#define PMBUS_STATUS_IOUT 0x7B +#define PMBUS_STATUS_INPUT 0x7C +#define PMBUS_STATUS_TEMPERATURE 0x7D +#define PMBUS_STATUS_CML 0x7E +#define PMBUS_STATUS_OTHER 0x7F +#define PMBUS_STATUS_MFR_SPECIFIC 0x80 +#define PMBUS_STATUS_FAN_12 0x81 +#define PMBUS_STATUS_FAN_34 0x82 + +#define PMBUS_READ_VIN 0x88 +#define PMBUS_READ_IIN 0x89 +#define PMBUS_READ_VCAP 0x8A +#define PMBUS_READ_VOUT 0x8B +#define PMBUS_READ_IOUT 0x8C +#define PMBUS_READ_TEMPERATURE_1 0x8D +#define PMBUS_READ_TEMPERATURE_2 0x8E +#define PMBUS_READ_TEMPERATURE_3 0x8F +#define PMBUS_READ_FAN_SPEED_1 0x90 +#define PMBUS_READ_FAN_SPEED_2 0x91 +#define PMBUS_READ_FAN_SPEED_3 0x92 +#define PMBUS_READ_FAN_SPEED_4 0x93 +#define PMBUS_READ_DUTY_CYCLE 0x94 +#define PMBUS_READ_FREQUENCY 0x95 +#define PMBUS_READ_POUT 0x96 +#define PMBUS_READ_PIN 0x97 + +#define PMBUS_REVISION 0x98 +#define PMBUS_MFR_ID 0x99 +#define PMBUS_MFR_MODEL 0x9A +#define PMBUS_MFR_REVISION 0x9B +#define PMBUS_MFR_LOCATION 0x9C +#define PMBUS_MFR_DATE 0x9D +#define PMBUS_MFR_SERIAL 0x9E + +/* + * Virtual registers. + * Useful to support attributes which are not supported by standard PMBus + * registers but exist as manufacturer specific registers on individual chips. + * Must be mapped to real registers in device specific code. + * + * Semantics: + * Virtual registers are all word size. + * READ registers are read-only; writes are either ignored or return an error. + * RESET registers are read/write. Reading reset registers returns zero + * (used for detection), writing any value causes the associated history to be + * reset. + * Virtual registers have to be handled in device specific driver code. Chip + * driver code returns non-negative register values if a virtual register is + * supported, or a negative error code if not. The chip driver may return + * -ENODATA or any other error code in this case, though an error code other + * than -ENODATA is handled more efficiently and thus preferred. Either case, + * the calling PMBus core code will abort if the chip driver returns an error + * code when reading or writing virtual registers. + */ +#define PMBUS_VIRT_BASE 0x100 +#define PMBUS_VIRT_READ_TEMP_AVG (PMBUS_VIRT_BASE + 0) +#define PMBUS_VIRT_READ_TEMP_MIN (PMBUS_VIRT_BASE + 1) +#define PMBUS_VIRT_READ_TEMP_MAX (PMBUS_VIRT_BASE + 2) +#define PMBUS_VIRT_RESET_TEMP_HISTORY (PMBUS_VIRT_BASE + 3) +#define PMBUS_VIRT_READ_VIN_AVG (PMBUS_VIRT_BASE + 4) +#define PMBUS_VIRT_READ_VIN_MIN (PMBUS_VIRT_BASE + 5) +#define PMBUS_VIRT_READ_VIN_MAX (PMBUS_VIRT_BASE + 6) +#define PMBUS_VIRT_RESET_VIN_HISTORY (PMBUS_VIRT_BASE + 7) +#define PMBUS_VIRT_READ_IIN_AVG (PMBUS_VIRT_BASE + 8) +#define PMBUS_VIRT_READ_IIN_MIN (PMBUS_VIRT_BASE + 9) +#define PMBUS_VIRT_READ_IIN_MAX (PMBUS_VIRT_BASE + 10) +#define PMBUS_VIRT_RESET_IIN_HISTORY (PMBUS_VIRT_BASE + 11) +#define PMBUS_VIRT_READ_PIN_AVG (PMBUS_VIRT_BASE + 12) +#define PMBUS_VIRT_READ_PIN_MAX (PMBUS_VIRT_BASE + 13) +#define PMBUS_VIRT_RESET_PIN_HISTORY (PMBUS_VIRT_BASE + 14) +#define PMBUS_VIRT_READ_POUT_AVG (PMBUS_VIRT_BASE + 15) +#define PMBUS_VIRT_READ_POUT_MAX (PMBUS_VIRT_BASE + 16) +#define PMBUS_VIRT_RESET_POUT_HISTORY (PMBUS_VIRT_BASE + 17) +#define PMBUS_VIRT_READ_VOUT_AVG (PMBUS_VIRT_BASE + 18) +#define PMBUS_VIRT_READ_VOUT_MIN (PMBUS_VIRT_BASE + 19) +#define PMBUS_VIRT_READ_VOUT_MAX (PMBUS_VIRT_BASE + 20) +#define PMBUS_VIRT_RESET_VOUT_HISTORY (PMBUS_VIRT_BASE + 21) +#define PMBUS_VIRT_READ_IOUT_AVG (PMBUS_VIRT_BASE + 22) +#define PMBUS_VIRT_READ_IOUT_MIN (PMBUS_VIRT_BASE + 23) +#define PMBUS_VIRT_READ_IOUT_MAX (PMBUS_VIRT_BASE + 24) +#define PMBUS_VIRT_RESET_IOUT_HISTORY (PMBUS_VIRT_BASE + 25) +#define PMBUS_VIRT_READ_TEMP2_AVG (PMBUS_VIRT_BASE + 26) +#define PMBUS_VIRT_READ_TEMP2_MIN (PMBUS_VIRT_BASE + 27) +#define PMBUS_VIRT_READ_TEMP2_MAX (PMBUS_VIRT_BASE + 28) +#define PMBUS_VIRT_RESET_TEMP2_HISTORY (PMBUS_VIRT_BASE + 29) + +#define PMBUS_VIRT_READ_VMON (PMBUS_VIRT_BASE + 30) +#define PMBUS_VIRT_VMON_UV_WARN_LIMIT (PMBUS_VIRT_BASE + 31) +#define PMBUS_VIRT_VMON_OV_WARN_LIMIT (PMBUS_VIRT_BASE + 32) +#define PMBUS_VIRT_VMON_UV_FAULT_LIMIT (PMBUS_VIRT_BASE + 33) +#define PMBUS_VIRT_VMON_OV_FAULT_LIMIT (PMBUS_VIRT_BASE + 34) +#define PMBUS_VIRT_STATUS_VMON (PMBUS_VIRT_BASE + 35) + +/* + * CAPABILITY + */ +#define PB_CAPABILITY_SMBALERT (1<<4) +#define PB_CAPABILITY_ERROR_CHECK (1<<7) + +/* + * VOUT_MODE + */ +#define PB_VOUT_MODE_MODE_MASK 0xe0 +#define PB_VOUT_MODE_PARAM_MASK 0x1f + +#define PB_VOUT_MODE_LINEAR 0x00 +#define PB_VOUT_MODE_VID 0x20 +#define PB_VOUT_MODE_DIRECT 0x40 + +/* + * Fan configuration + */ +#define PB_FAN_2_PULSE_MASK ((1 << 0) | (1 << 1)) +#define PB_FAN_2_RPM (1 << 2) +#define PB_FAN_2_INSTALLED (1 << 3) +#define PB_FAN_1_PULSE_MASK ((1 << 4) | (1 << 5)) +#define PB_FAN_1_RPM (1 << 6) +#define PB_FAN_1_INSTALLED (1 << 7) + +/* + * STATUS_BYTE, STATUS_WORD (lower) + */ +#define PB_STATUS_NONE_ABOVE (1<<0) +#define PB_STATUS_CML (1<<1) +#define PB_STATUS_TEMPERATURE (1<<2) +#define PB_STATUS_VIN_UV (1<<3) +#define PB_STATUS_IOUT_OC (1<<4) +#define PB_STATUS_VOUT_OV (1<<5) +#define PB_STATUS_OFF (1<<6) +#define PB_STATUS_BUSY (1<<7) + +/* + * STATUS_WORD (upper) + */ +#define PB_STATUS_UNKNOWN (1<<8) +#define PB_STATUS_OTHER (1<<9) +#define PB_STATUS_FANS (1<<10) +#define PB_STATUS_POWER_GOOD_N (1<<11) +#define PB_STATUS_WORD_MFR (1<<12) +#define PB_STATUS_INPUT (1<<13) +#define PB_STATUS_IOUT_POUT (1<<14) +#define PB_STATUS_VOUT (1<<15) + +/* + * STATUS_IOUT + */ +#define PB_POUT_OP_WARNING (1<<0) +#define PB_POUT_OP_FAULT (1<<1) +#define PB_POWER_LIMITING (1<<2) +#define PB_CURRENT_SHARE_FAULT (1<<3) +#define PB_IOUT_UC_FAULT (1<<4) +#define PB_IOUT_OC_WARNING (1<<5) +#define PB_IOUT_OC_LV_FAULT (1<<6) +#define PB_IOUT_OC_FAULT (1<<7) + +/* + * STATUS_VOUT, STATUS_INPUT + */ +#define PB_VOLTAGE_UV_FAULT (1<<4) +#define PB_VOLTAGE_UV_WARNING (1<<5) +#define PB_VOLTAGE_OV_WARNING (1<<6) +#define PB_VOLTAGE_OV_FAULT (1<<7) + +/* + * STATUS_INPUT + */ +#define PB_PIN_OP_WARNING (1<<0) +#define PB_IIN_OC_WARNING (1<<1) +#define PB_IIN_OC_FAULT (1<<2) + +/* + * STATUS_TEMPERATURE + */ +#define PB_TEMP_UT_FAULT (1<<4) +#define PB_TEMP_UT_WARNING (1<<5) +#define PB_TEMP_OT_WARNING (1<<6) +#define PB_TEMP_OT_FAULT (1<<7) + +/* + * STATUS_FAN + */ +#define PB_FAN_AIRFLOW_WARNING (1<<0) +#define PB_FAN_AIRFLOW_FAULT (1<<1) +#define PB_FAN_FAN2_SPEED_OVERRIDE (1<<2) +#define PB_FAN_FAN1_SPEED_OVERRIDE (1<<3) +#define PB_FAN_FAN2_WARNING (1<<4) +#define PB_FAN_FAN1_WARNING (1<<5) +#define PB_FAN_FAN2_FAULT (1<<6) +#define PB_FAN_FAN1_FAULT (1<<7) + +/* + * CML_FAULT_STATUS + */ +#define PB_CML_FAULT_OTHER_MEM_LOGIC (1<<0) +#define PB_CML_FAULT_OTHER_COMM (1<<1) +#define PB_CML_FAULT_PROCESSOR (1<<3) +#define PB_CML_FAULT_MEMORY (1<<4) +#define PB_CML_FAULT_PACKET_ERROR (1<<5) +#define PB_CML_FAULT_INVALID_DATA (1<<6) +#define PB_CML_FAULT_INVALID_COMMAND (1<<7) + +enum pmbus_sensor_classes { + PSC_VOLTAGE_IN = 0, + PSC_VOLTAGE_OUT, + PSC_CURRENT_IN, + PSC_CURRENT_OUT, + PSC_POWER, + PSC_TEMPERATURE, + PSC_FAN, + PSC_NUM_CLASSES /* Number of power sensor classes */ +}; + +#define PMBUS_PAGES 32 /* Per PMBus specification */ + +/* Functionality bit mask */ +#define PMBUS_HAVE_VIN (1 << 0) +#define PMBUS_HAVE_VCAP (1 << 1) +#define PMBUS_HAVE_VOUT (1 << 2) +#define PMBUS_HAVE_IIN (1 << 3) +#define PMBUS_HAVE_IOUT (1 << 4) +#define PMBUS_HAVE_PIN (1 << 5) +#define PMBUS_HAVE_POUT (1 << 6) +#define PMBUS_HAVE_FAN12 (1 << 7) +#define PMBUS_HAVE_FAN34 (1 << 8) +#define PMBUS_HAVE_TEMP (1 << 9) +#define PMBUS_HAVE_TEMP2 (1 << 10) +#define PMBUS_HAVE_TEMP3 (1 << 11) +#define PMBUS_HAVE_STATUS_VOUT (1 << 12) +#define PMBUS_HAVE_STATUS_IOUT (1 << 13) +#define PMBUS_HAVE_STATUS_INPUT (1 << 14) +#define PMBUS_HAVE_STATUS_TEMP (1 << 15) +#define PMBUS_HAVE_STATUS_FAN12 (1 << 16) +#define PMBUS_HAVE_STATUS_FAN34 (1 << 17) +#define PMBUS_HAVE_VMON (1 << 18) +#define PMBUS_HAVE_STATUS_VMON (1 << 19) + +enum pmbus_data_format { linear = 0, direct, vid }; + +struct pmbus_driver_info { + int pages; /* Total number of pages */ + enum pmbus_data_format format[PSC_NUM_CLASSES]; + /* + * Support one set of coefficients for each sensor type + * Used for chips providing data in direct mode. + */ + int m[PSC_NUM_CLASSES]; /* mantissa for direct data format */ + int b[PSC_NUM_CLASSES]; /* offset */ + int R[PSC_NUM_CLASSES]; /* exponent */ + + u32 func[PMBUS_PAGES]; /* Functionality, per page */ + /* + * The following functions map manufacturing specific register values + * to PMBus standard register values. Specify only if mapping is + * necessary. + * Functions return the register value (read) or zero (write) if + * successful. A return value of -ENODATA indicates that there is no + * manufacturer specific register, but that a standard PMBus register + * may exist. Any other negative return value indicates that the + * register does not exist, and that no attempt should be made to read + * the standard register. + */ + int (*read_byte_data)(struct i2c_client *client, int page, int reg); + int (*read_word_data)(struct i2c_client *client, int page, int reg); + int (*write_word_data)(struct i2c_client *client, int page, int reg, + u16 word); + int (*write_byte)(struct i2c_client *client, int page, u8 value); + /* + * The identify function determines supported PMBus functionality. + * This function is only necessary if a chip driver supports multiple + * chips, and the chip functionality is not pre-determined. + */ + int (*identify)(struct i2c_client *client, + struct pmbus_driver_info *info); +}; + +/* Function declarations */ + +void pmbus_clear_cache(struct i2c_client *client); +int pmbus_set_page(struct i2c_client *client, u8 page); +int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 reg); +int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word); +int pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg); +int pmbus_write_byte(struct i2c_client *client, int page, u8 value); +void pmbus_clear_faults(struct i2c_client *client); +bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg); +bool pmbus_check_word_register(struct i2c_client *client, int page, int reg); +int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, + struct pmbus_driver_info *info); +int pmbus_do_remove(struct i2c_client *client); +const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client + *client); + +#endif /* PMBUS_H */ diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_cpld_qsfp28.c b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_cpld_qsfp28.c new file mode 100755 index 000000000000..15c5369fd219 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_cpld_qsfp28.c @@ -0,0 +1,409 @@ +/* + * A CPLD driver for monitor QSFP28 module I/O + * + * The CPLD is customize by Quanta for controlling QSFP28 module signals, + * they are RESET , INTERREPT , Module_Present, LPMODE + * Each CPLD control 16 modules, each module use 4 bits in register. + * + * Copyright (C) 2015 Quanta Inc. + * + * Author: Luffy Cheng + * + * 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 + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static DEFINE_IDA(cpld_ida); + +enum platform_type { + QSFP28 = 0, + NONE +}; + +static struct class *cpld_class = NULL; + +struct sfp_data { + struct i2c_client *cpld_client; + char name[8]; + u8 port_id; + u8 cpld_port; +}; + +struct cpld_data { + struct mutex lock; + struct device *port_dev[16]; + struct sfp_data *port_data[16]; +}; + +static int cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id); +static int cpld_remove(struct i2c_client *client); + +static const struct i2c_device_id cpld_id[] = { + { "CPLD-QSFP28", QSFP28 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, cpld_id); + +static struct i2c_driver cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "qci_cpld_qsfp28", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_id, +// .address_list = normal_i2c, +}; + +#define CPLD_ID_PREFIX "port-" +#define CPLD_ID_FORMAT CPLD_ID_PREFIX "%d" + +#define RESET_MASK 0x08 +#define INTERRUPT_MASK 0x04 +#define MODULE_PRESENT_MASK 0x02 +#define LPMODE_MASK 0x01 + +static inline u8 get_group_cmd(u8 group) +{ + //FIXME: if group cmd change + return (group + 1); +} + +static inline u8 port_remapping(u8 phy_port) +{ + /* FIXME: implement by hardware design */ + /* The CPLD register port mapping is weird : + * MSB -------- LSB (word data) + * P3 P4 P1 P2 (per port 4 bits) + * For easy coding bit shift, we treat it as hw port swap + */ + return (phy_port % 2) ? (phy_port - 1) : (phy_port + 1); +} + +static ssize_t get_reset(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= RESET_MASK; + + return sprintf(buf, "%d\n", value ? 1 : 0); +} + +static ssize_t get_interrupt(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= INTERRUPT_MASK; + + return sprintf(buf, "%d\n", value ? 1 : 0); +} + +static ssize_t get_module_present(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= MODULE_PRESENT_MASK; + + //FIXME: if present is not low active + return sprintf(buf, "%d\n", value ? 0 : 1); +} + +static ssize_t get_lpmode(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= LPMODE_MASK; + + return sprintf(buf, "%d\n", value ? 1 : 0); +} + +static ssize_t set_reset(struct device *dev, + struct device_attribute *devattr, + const char *buf, + size_t count) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + long disable; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + if (kstrtol(buf, 0, &disable)) + return -EINVAL; + + if ((disable != 1) && (disable != 0)) + return -EINVAL; + +// mutex_lock(&data->lock); + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value &= ~(RESET_MASK << (group_port * 4)); + if (disable) + value |= (RESET_MASK << (group_port * 4)); + + dev_dbg(&client->dev, "write group%d value= %x\n", group + 1, value); + + i2c_smbus_write_word_data(client, get_group_cmd(group), (u16)value); +// mutex_unlock(&data->lock); + + return count; +} + +static ssize_t set_lpmode(struct device *dev, + struct device_attribute *devattr, + const char *buf, + size_t count) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + long disable; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + if (kstrtol(buf, 0, &disable)) + return -EINVAL; + + if ((disable != 1) && (disable != 0)) + return -EINVAL; + +// mutex_lock(&data->lock); + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value &= ~(LPMODE_MASK << (group_port * 4)); + if (disable) + value |= (LPMODE_MASK << (group_port * 4)); + + dev_dbg(&client->dev, "write group%d value= %x\n", group + 1, value); + + i2c_smbus_write_word_data(client, get_group_cmd(group), (u16)value); +// mutex_unlock(&data->lock); + + return count; +} + +static DEVICE_ATTR(reset, S_IWUSR | S_IRUGO, get_reset, set_reset); +static DEVICE_ATTR(lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode); +static DEVICE_ATTR(module_present, S_IRUGO, get_module_present, NULL); +static DEVICE_ATTR(interrupt, S_IRUGO, get_interrupt, NULL); + +static const struct attribute *sfp_attrs[] = { + &dev_attr_reset.attr, + &dev_attr_lpmode.attr, + &dev_attr_module_present.attr, + &dev_attr_interrupt.attr, + NULL, +}; + +static const struct attribute_group sfp_attr_group = { + .attrs = (struct attribute **) sfp_attrs, +}; + +static int cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct cpld_data *data; + struct sfp_data *port_data; + struct device *port_dev; + int port_nr, i, err; + + if (!cpld_class) + { + cpld_class = class_create(THIS_MODULE, "cpld-qsfp28"); + if (IS_ERR(cpld_class)) { + pr_err("couldn't create sysfs class\n"); + return PTR_ERR(cpld_class); + } + } + + data = devm_kzalloc(&client->dev, sizeof(struct cpld_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; + + /* register sfp port data to sysfs */ + for (i = 0; i < 16; i++) + { + port_nr = ida_simple_get(&cpld_ida, 1, 99, GFP_KERNEL); + if (port_nr < 0) + return ERR_PTR(port_nr); + + port_data = kzalloc(sizeof(struct sfp_data), GFP_KERNEL); + + port_dev = device_create(cpld_class, &client->dev, MKDEV(0,0), port_data, CPLD_ID_FORMAT, port_nr); + if (IS_ERR(port_dev)) { + err = PTR_ERR(port_dev); + // printk("err_status\n"); + } + + data->port_dev[i] = port_dev; + data->port_data[i] = port_data; + + dev_info(&client->dev, "Register qsfp28 port-%d\n", port_nr); + + /* FIXME: implement Logical/Physical port remapping */ + //port_data->cpld_port = i; + port_data->cpld_port = port_remapping(i); + sprintf(port_data->name, "port-%d", port_nr); + port_data->port_id = port_nr; + dev_set_drvdata(port_dev, port_data); + port_dev->init_name = port_data->name; + port_data->cpld_client = client; + + err = sysfs_create_group(&port_dev->kobj, &sfp_attr_group); + // if (status) printk("err status\n"); + } + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + + dev_info(&client->dev, "%s device found\n", client->name); + + + return 0; + +//FIXME: implement error check +exit_remove: +// sysfs_remove_group(&client->dev.kobj, &data->attrs); + return err; +} + +/* FIXME: for older kernel doesn't with idr_is_empty function, implement here */ +static int idr_has_entry(int id, void *p, void *data) +{ + return 1; +} + +static bool cpld_idr_is_empty(struct idr *idp) +{ + return !idr_for_each(idp, idr_has_entry, NULL); +} + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + int i, id; + + for (i = 15; i >= 0; i--) + { + dev_info(data->port_dev[i], "Remove qsfp28 port-%d\n", data->port_data[i]->port_id); + device_unregister(data->port_dev[i]); + ida_simple_remove(&cpld_ida, data->port_data[i]->port_id); + kfree(data->port_data[i]); + } + + if (cpld_idr_is_empty(&cpld_ida.idr)) + class_destroy(cpld_class); + + return 0; +} + +module_i2c_driver(cpld_driver); + +MODULE_AUTHOR("Luffy Cheng "); +MODULE_DESCRIPTION("Quanta Switch SFP CPLD driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_platform.h b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_platform.h new file mode 100755 index 000000000000..0737c8ce8170 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_platform.h @@ -0,0 +1,64 @@ +/* + * Driver model definations for Quanta Platform drivers + * + * Copyright (C) 2015-2016 Quanta QCT + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ +#ifndef __QCI_PLATFORM_H_INCLUDED +#define __QCI_PLATFORM_H_INCLUDED + +#define MUX_INFO(bus, deselect) \ + {.adap_id = bus, .deselect_on_exit = deselect} + +#define GPIO_INFO(id, gpio_nr) \ + {.gpio_id = id, .system_gpio_nr = gpio_nr} + +struct platform_gpio { + int gpio_id; + int system_gpio_nr; +}; + +/* FIXME: Please add important GPIO which need to be request */ +enum PLATFORM_GPIO_ID { + GPIO_PSU1_PRSNT, + GPIO_PSU1_PWRGD, + GPIO_PSU2_PRSNT, + GPIO_PSU2_PWRGD, +}; + +#define LED_ON LED_FULL + +#define LED_INFO(id) \ + {.led_id = id, .cdev = NULL} + +struct platform_led { + int led_id; + struct led_classdev *cdev; +}; + +enum PLATFORM_LED_ID { + SYSLED_AMBER, + SYSLED_GREEN, + FRONT_PSU1_GREEN, + FRONT_PSU1_RED, + FRONT_PSU2_GREEN, + FRONT_PSU2_RED, + FRONT_FAN_GREEN, + FRONT_FAN_RED, + REAR_FAN1_RED, + REAR_FAN2_RED, + REAR_FAN3_RED, + REAR_FAN4_RED, + REAR_FAN5_RED, + REAR_FAN6_RED, + TOTAL_LED_NR +}; + +extern int qci_platform_get_gpio(int platform_gpio); +extern int qci_platform_set_led(int led_id, bool led_on); + +#endif /* __QCI_PLATFORM_H_INCLUDED */ diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_platform_ix1b.c b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_platform_ix1b.c new file mode 100755 index 000000000000..f783c88fb9a1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_platform_ix1b.c @@ -0,0 +1,491 @@ +/* + * Quanta IX1B platform driver + * + * + * Copyright (C) 2014 Quanta Computer 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) +#include +#else +#include +#endif +#include "qci_platform.h" + +#define QUANTA_CPU_RGL + +static struct pca954x_platform_mode pca9548sfp1_modes[] = { + MUX_INFO(0x20, 1), + MUX_INFO(0x21, 1), + MUX_INFO(0x22, 1), + MUX_INFO(0x23, 1), + MUX_INFO(0x24, 1), + MUX_INFO(0x25, 1), + MUX_INFO(0x26, 1), + MUX_INFO(0x27, 1), +}; + +static struct pca954x_platform_data pca9548sfp1_data = { + .modes = pca9548sfp1_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9548sfp2_modes[] = { + MUX_INFO(0x28, 1), + MUX_INFO(0x29, 1), + MUX_INFO(0x2a, 1), + MUX_INFO(0x2b, 1), + MUX_INFO(0x2c, 1), + MUX_INFO(0x2d, 1), + MUX_INFO(0x2e, 1), + MUX_INFO(0x2f, 1), +}; + +static struct pca954x_platform_data pca9548sfp2_data = { + .modes = pca9548sfp2_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9548sfp3_modes[] = { + MUX_INFO(0x30, 1), + MUX_INFO(0x31, 1), + MUX_INFO(0x32, 1), + MUX_INFO(0x33, 1), + MUX_INFO(0x34, 1), + MUX_INFO(0x35, 1), + MUX_INFO(0x36, 1), + MUX_INFO(0x37, 1), +}; + +static struct pca954x_platform_data pca9548sfp3_data = { + .modes = pca9548sfp3_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9548sfp4_modes[] = { + MUX_INFO(0x38, 1), + MUX_INFO(0x39, 1), + MUX_INFO(0x3a, 1), + MUX_INFO(0x3b, 1), + MUX_INFO(0x3c, 1), + MUX_INFO(0x3d, 1), + MUX_INFO(0x3e, 1), + MUX_INFO(0x3f, 1), +}; + +static struct pca954x_platform_data pca9548sfp4_data = { + .modes = pca9548sfp4_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9546_1_modes[] = { + MUX_INFO(0x10, 1), + MUX_INFO(0x11, 1), + MUX_INFO(0x12, 1), + MUX_INFO(0x13, 1), +}; + +static struct pca954x_platform_data pca9546_1_data = { + .modes = pca9546_1_modes, + .num_modes = 4, +}; + +static struct pca954x_platform_mode pca9546_2_modes[] = { + MUX_INFO(0x14, 1), + MUX_INFO(0x15, 1), + MUX_INFO(0x16, 1), + MUX_INFO(0x17, 1), +}; + +static struct pca954x_platform_data pca9546_2_data = { + .modes = pca9546_2_modes, + .num_modes = 4, +}; + +/* CPU gpio base defined in devicetree + * default is ARCH_NR_GPIOS - 32, (256-32=224) + * It must match devicetree default gpio base + * */ +#define PCA9555_PSU_GPIO_BASE 0x10 +#define PCA9555_FAN_GPIO_BASE 0x20 +#define PCA9555_ID_GPIO_BASE 0x30 + +#if defined(QUANTA_CPU_RGL) +#define PCA9555_CPU_LED_GPIO_BASE 0x80 + +static struct pca954x_platform_mode pca9546_cpu1_modes[] = { + MUX_INFO(0x18, 1), + MUX_INFO(0x19, 1), + MUX_INFO(0x1a, 1), + MUX_INFO(0x1b, 1), +}; + +static struct pca954x_platform_data pca9546_cpu1_data = { + .modes = pca9546_cpu1_modes, + .num_modes = 4, +}; + +static struct pca953x_platform_data pca9555_cpuled_data = { + .gpio_base = PCA9555_CPU_LED_GPIO_BASE, +}; +#endif + +static struct pca953x_platform_data pca9555psu1_data = { + .gpio_base = PCA9555_PSU_GPIO_BASE, +}; + +static struct pca953x_platform_data pca9555fan_data = { + .gpio_base = PCA9555_FAN_GPIO_BASE, +}; + +static struct pca953x_platform_data pca9555ID_data = { + .gpio_base = PCA9555_ID_GPIO_BASE, +}; + +static struct i2c_board_info ix1b_i2c_devices[] = { + { + I2C_BOARD_INFO("pca9546", 0x77), + .platform_data = &pca9546_1_data, + }, + { + I2C_BOARD_INFO("pca9546", 0x72), + .platform_data = &pca9546_2_data, + }, + { + I2C_BOARD_INFO("pca9555", 0x26), + .platform_data = &pca9555psu1_data, + }, + { + I2C_BOARD_INFO("24c02", 0x54), + }, + { + I2C_BOARD_INFO("pca9548", 0x73), + .platform_data = &pca9548sfp1_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x74), + .platform_data = &pca9548sfp2_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x75), + .platform_data = &pca9548sfp3_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x76), + .platform_data = &pca9548sfp4_data, + }, + { + I2C_BOARD_INFO("CPLD-QSFP28", 0x38), + }, + { + I2C_BOARD_INFO("CPLD-QSFP28", 0x39), + }, + { + I2C_BOARD_INFO("pca9555", 0x23), + .platform_data = &pca9555ID_data, + }, + { + I2C_BOARD_INFO("pca9555", 0x25), + .platform_data = &pca9555fan_data, + }, + { + I2C_BOARD_INFO("qci_pmbus_ix1b", 0x5f), + }, + { + I2C_BOARD_INFO("qci_pmbus_ix1b", 0x59), + }, +#if defined(QUANTA_CPU_RGL) + { + I2C_BOARD_INFO("pca9546", 0x71), + .platform_data = &pca9546_cpu1_data, + }, + { + I2C_BOARD_INFO("pca9555", 0x20), + .platform_data = &pca9555_cpuled_data, + }, + { + I2C_BOARD_INFO("24c02", 0x50), + }, +#endif +}; + +static struct platform_driver ix1b_platform_driver = { + .driver = { + .name = "qci-ix1b", + .owner = THIS_MODULE, + }, +}; + +static struct platform_led ix1b_leds[] = { +#if defined(QUANTA_CPU_RGL) + LED_INFO(SYSLED_AMBER), + LED_INFO(SYSLED_GREEN), +#endif + LED_INFO(FRONT_PSU1_GREEN), + LED_INFO(FRONT_PSU1_RED), + LED_INFO(FRONT_PSU2_GREEN), + LED_INFO(FRONT_PSU2_RED), + LED_INFO(FRONT_FAN_GREEN), + LED_INFO(FRONT_FAN_RED), + LED_INFO(REAR_FAN1_RED), + LED_INFO(REAR_FAN2_RED), + LED_INFO(REAR_FAN3_RED), + LED_INFO(REAR_FAN4_RED), +}; + +static struct gpio_led system_led[] = { +#if defined(QUANTA_CPU_RGL) + { + .name = "sysled_amber", + .default_trigger = "timer", + .gpio = (PCA9555_CPU_LED_GPIO_BASE + 10), + .active_low = 0, + }, + { + .name = "sysled_green", + .gpio = (PCA9555_CPU_LED_GPIO_BASE + 11), + .active_low = 0, + }, +#endif + { + .name = "front_led_psu1_green", + .gpio = (PCA9555_PSU_GPIO_BASE + 10), + .active_low = 0, + }, + { + .name = "front_led_psu1_red", + .gpio = (PCA9555_PSU_GPIO_BASE + 11), + .active_low = 0, + }, + { + .name = "front_led_psu2_green", + .gpio = (PCA9555_PSU_GPIO_BASE + 12), + .active_low = 0, + }, + { + .name = "front_led_psu2_red", + .gpio = (PCA9555_PSU_GPIO_BASE + 13), + .active_low = 0, + }, + { + .name = "front_led_fan_green", + .gpio = (PCA9555_PSU_GPIO_BASE + 14), + .active_low = 0, + }, + { + .name = "front_led_fan_red", + .gpio = (PCA9555_PSU_GPIO_BASE + 15), + .active_low = 0, + }, + { + .name = "rear_led_fan1_red", + .gpio = (PCA9555_FAN_GPIO_BASE + 12), + .active_low = 0, + }, + { + .name = "rear_led_fan2_red", + .gpio = (PCA9555_FAN_GPIO_BASE + 13), + .active_low = 0, + }, + { + .name = "rear_led_fan3_red", + .gpio = (PCA9555_FAN_GPIO_BASE + 14), + .active_low = 0, + }, + { + .name = "rear_led_fan4_red", + .gpio = (PCA9555_FAN_GPIO_BASE + 15), + .active_low = 0, + }, +}; + +static struct gpio_led_platform_data system_led_data = { + .num_leds = ARRAY_SIZE(system_led), + .leds = system_led +}; + +static struct platform_device system_led_dev = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &system_led_data, + }, +}; + +static struct platform_device *ix1b_device; + +struct gpio_led_data { + struct led_classdev cdev; + unsigned gpio; + struct work_struct work; + u8 new_level; + u8 can_sleep; + u8 active_low; + u8 blinking; + int (*platform_gpio_blink_set)(unsigned gpio, int state, + unsigned long *delay_on, unsigned long *delay_off); +}; + +struct gpio_leds_priv { + int num_leds; + struct gpio_led_data leds[]; +}; + +static int __init ix1b_platform_init(void) +{ + struct i2c_client *client; + struct i2c_adapter *adapter; + struct gpio_leds_priv *priv; + int i; + int ret; + + ret = platform_driver_register(&ix1b_platform_driver); + if (ret < 0) + return ret; + + /* Register platform stuff */ + ix1b_device = platform_device_alloc("qci-ix1b", -1); + if (!ix1b_device) { + ret = -ENOMEM; + goto fail_platform_driver; + } + + ret = platform_device_add(ix1b_device); + if (ret) + goto fail_platform_device; + + adapter = i2c_get_adapter(0); + client = i2c_new_device(adapter, &ix1b_i2c_devices[0]); // pca9546_1 + printk("[CC] NEW device pca9546_1\n"); + client = i2c_new_device(adapter, &ix1b_i2c_devices[1]); // pca9546_2 + printk("[CC] NEW device pca9546_2\n"); +#if defined(QUANTA_CPU_RGL) + client = i2c_new_device(adapter, &ix1b_i2c_devices[14]); // cpu pca9546_1 + printk("[CC] NEW device cpu pca9546_1\n"); +#endif + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x14); + client = i2c_new_device(adapter, &ix1b_i2c_devices[12]); // pmbus_psu1 + printk("[CC] NEW device pmbus_psu1\n"); + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x15); + client = i2c_new_device(adapter, &ix1b_i2c_devices[13]); // pmbus_psu2 + printk("[CC] NEW device pmbus_psu2\n"); + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x16); + client = i2c_new_device(adapter, &ix1b_i2c_devices[2]); // pca9555-PSU1 + printk("[CC] NEW device pca9555-PSU1\n"); + client = i2c_new_device(adapter, &ix1b_i2c_devices[3]); // MB_BOARDINFO_EEPROM + printk("[CC] NEW device MB_BOARDINFO_EEPROM\n"); + client = i2c_new_device(adapter, &ix1b_i2c_devices[10]); // pca9555-ID + printk("[CC] NEW device pca9555-ID\n"); + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x17); + client = i2c_new_device(adapter, &ix1b_i2c_devices[11]); // pca9555-fan + printk("[CC] NEW device pca9555-fan\n"); + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x10); + client = i2c_new_device(adapter, &ix1b_i2c_devices[4]); // pca9548_2 SFP + printk("[CC] NEW device pca9548_2 SFP\n"); + client = i2c_new_device(adapter, &ix1b_i2c_devices[5]); // pca9548_3 SFP + printk("[CC] NEW device pca9548_3 SFP\n"); + client = i2c_new_device(adapter, &ix1b_i2c_devices[6]); // pca9548_4 SFP + printk("[CC] NEW device pca9548_4 SFP\n"); + client = i2c_new_device(adapter, &ix1b_i2c_devices[8]); // CPLD2 + printk("[CC] NEW device CPLD2\n"); + client = i2c_new_device(adapter, &ix1b_i2c_devices[9]); // CPLD3 + printk("[CC] NEW device CPLD3\n"); + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x11); + client = i2c_new_device(adapter, &ix1b_i2c_devices[7]); // pca9548_5 SFP + printk("[CC] NEW device pca9548_5 SFP\n"); + i2c_put_adapter(adapter); + +#if defined(QUANTA_CPU_RGL) + adapter = i2c_get_adapter(0x18); + client = i2c_new_device(adapter, &ix1b_i2c_devices[15]); // cpu pca9555_1 + printk("[CC] NEW device cpu pca9555_1\n"); + i2c_put_adapter(adapter); + + for(i = 0x20; i < 0x40; i++) + { + adapter = i2c_get_adapter(i); + client = i2c_new_device(adapter, &ix1b_i2c_devices[16]); // eeprom for loopback module + i2c_put_adapter(adapter); + } + printk("[CC] NEW device eeprom\n"); +#endif + + /* Register LED devices */ + platform_device_register(&system_led_dev); + priv = platform_get_drvdata(&system_led_dev); + for (i = 0; i < priv->num_leds; i++) { + printk("leds-gpio gpio-%d: Register led %s\n", priv->leds[i].gpio, priv->leds[i].cdev.name); + ix1b_leds[i].cdev = &(priv->leds[i].cdev); + } + printk("[CC] NEW device led\n"); + + return 0; + +fail_platform_device: + platform_device_put(ix1b_device); + +fail_platform_driver: + platform_driver_unregister(&ix1b_platform_driver); + return ret; +} + +static void __exit ix1b_platform_exit(void) +{ + platform_device_unregister(ix1b_device); + platform_driver_unregister(&ix1b_platform_driver); +} + +module_init(ix1b_platform_init); +module_exit(ix1b_platform_exit); + + +MODULE_AUTHOR("Quanta Computer Inc."); +MODULE_DESCRIPTION("Quanta IX1B Platform Driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_pmbus.c b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_pmbus.c new file mode 100755 index 000000000000..f54a0f204d67 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/modules/qci_pmbus.c @@ -0,0 +1,487 @@ +/* + * QUANTA Generic PMBUS driver + * + * + * Based on generic pmbus driver and ltc2978 driver + * + * Author: Chih-Pei Chang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +//#include <../drivers/hwmon/pmbus/pmbus.h> +#include "pmbus.h" +#include + +enum projects { ly8, ix1, ix2, ix1b }; + +#define DELAY_TIME 1000 /* uS */ + +/* Needed to access the mutex. Copied from pmbus_core.c */ +#define PB_STATUS_BASE 0 +#define PB_STATUS_VOUT_BASE (PB_STATUS_BASE + PMBUS_PAGES) +#define PB_STATUS_IOUT_BASE (PB_STATUS_VOUT_BASE + PMBUS_PAGES) +#define PB_STATUS_FAN_BASE (PB_STATUS_IOUT_BASE + PMBUS_PAGES) +#define PB_STATUS_FAN34_BASE (PB_STATUS_FAN_BASE + PMBUS_PAGES) +#define PB_STATUS_TEMP_BASE (PB_STATUS_FAN34_BASE + PMBUS_PAGES) +#define PB_STATUS_INPUT_BASE (PB_STATUS_TEMP_BASE + PMBUS_PAGES) +#define PB_STATUS_VMON_BASE (PB_STATUS_INPUT_BASE + 1) +#define PB_NUM_STATUS_REG (PB_STATUS_VMON_BASE + 1) +struct pmbus_data { + struct device *dev; + struct device *hwmon_dev; + + u32 flags; /* from platform data */ + + int exponent[PMBUS_PAGES]; + /* linear mode: exponent for output voltages */ + + const struct pmbus_driver_info *info; + + int max_attributes; + int num_attributes; + struct attribute_group group; + const struct attribute_group *groups[2]; + + struct pmbus_sensor *sensors; + + struct mutex update_lock; + bool valid; + unsigned long last_updated; /* in jiffies */ + + /* + * A single status register covers multiple attributes, + * so we keep them all together. + */ + u8 status[PB_NUM_STATUS_REG]; + u8 status_register; + + u8 currpage; +}; + +static int qci_pmbus_read_block(struct i2c_client *client, u8 command, int data_len, u8 *data) +{ + int result = 0; + int retry_count = 3; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (result < 0) { + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +static ssize_t qci_pmbus_show_mfr_id(struct device *dev, + struct device_attribute *da, char *buf) +{ + int ret, len; + u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1], *str; + struct i2c_client *client = container_of(dev, struct i2c_client, dev); + + ret = qci_pmbus_read_block(client, PMBUS_MFR_ID, I2C_SMBUS_BLOCK_MAX, block_buffer); + if (ret < 0) { + dev_err(&client->dev, "Failed to read Manufacturer ID\n"); + return ret; + } + len = block_buffer[0]; + block_buffer[(len+1)] = '\0'; + str = &(block_buffer[1]); + + return snprintf(buf, PAGE_SIZE, "%s\n", str); +} + +static ssize_t qci_pmbus_show_mfr_model(struct device *dev, + struct device_attribute *da, char *buf) +{ + int ret, len; + u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1], *str; + struct i2c_client *client = container_of(dev, struct i2c_client, dev); + + ret = qci_pmbus_read_block(client, PMBUS_MFR_MODEL, I2C_SMBUS_BLOCK_MAX, block_buffer); + if (ret < 0) { + dev_err(&client->dev, "Failed to read Manufacturer Model\n"); + return ret; + } + len = block_buffer[0]; + block_buffer[(len+1)] = '\0'; + str = &(block_buffer[1]); + + return snprintf(buf, PAGE_SIZE, "%s\n", str); +} + +static ssize_t qci_pmbus_show_mfr_revision(struct device *dev, + struct device_attribute *da, char *buf) +{ + int ret, len; + u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1], *str; + struct i2c_client *client = container_of(dev, struct i2c_client, dev); + + ret = qci_pmbus_read_block(client, PMBUS_MFR_REVISION, I2C_SMBUS_BLOCK_MAX, block_buffer); + if (ret < 0) { + dev_err(&client->dev, "Failed to read Manufacturer Revision\n"); + return ret; + } + len = block_buffer[0]; + block_buffer[(len+1)] = '\0'; + str = &(block_buffer[1]); + + return snprintf(buf, PAGE_SIZE, "%s\n", str); +} + +static ssize_t qci_pmbus_show_mfr_location(struct device *dev, + struct device_attribute *da, char *buf) +{ + int ret, len; + u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1], *str; + struct i2c_client *client = container_of(dev, struct i2c_client, dev); + + ret = qci_pmbus_read_block(client, PMBUS_MFR_LOCATION, I2C_SMBUS_BLOCK_MAX, block_buffer); + if (ret < 0) { + dev_err(&client->dev, "Failed to read Manufacture Location\n"); + return ret; + } + len = block_buffer[0]; + block_buffer[(len+1)] = '\0'; + str = &(block_buffer[1]); + + return snprintf(buf, PAGE_SIZE, "%s\n", str); +} + +static ssize_t qci_pmbus_show_mfr_serial(struct device *dev, + struct device_attribute *da, char *buf) +{ + int ret, len; + u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1], *str; + struct i2c_client *client = container_of(dev, struct i2c_client, dev); + + ret = qci_pmbus_read_block(client, PMBUS_MFR_SERIAL, I2C_SMBUS_BLOCK_MAX, block_buffer); + if (ret < 0) { + dev_err(&client->dev, "Failed to read Manufacturer Serial\n"); + return ret; + } + len = block_buffer[0]; + block_buffer[(len+1)] = '\0'; + str = &(block_buffer[1]); + + return snprintf(buf, PAGE_SIZE, "%s\n", str); +} + + +static DEVICE_ATTR(mfr_id, S_IRUGO, qci_pmbus_show_mfr_id, NULL); +static DEVICE_ATTR(mfr_model, S_IRUGO, qci_pmbus_show_mfr_model, NULL); +static DEVICE_ATTR(mfr_revision, S_IRUGO, qci_pmbus_show_mfr_revision, NULL); +static DEVICE_ATTR(mfr_location, S_IRUGO, qci_pmbus_show_mfr_location, NULL); +static DEVICE_ATTR(mfr_serial, S_IRUGO, qci_pmbus_show_mfr_serial, NULL); + + +static struct attribute *qci_pmbus_inventory_attrs[] = { + &dev_attr_mfr_id.attr, + &dev_attr_mfr_model.attr, + &dev_attr_mfr_revision.attr, + &dev_attr_mfr_location.attr, + &dev_attr_mfr_serial.attr, + NULL +}; + +static struct attribute_group qci_pmbus_inventory_attr_grp = { + .attrs = qci_pmbus_inventory_attrs +}; + +/* FIXME: add project specific id here */ +static const struct i2c_device_id qci_pmbus_id[] = { + {"qci_pmbus_ly8", ly8}, + {"qci_pmbus_ix1", ix1}, + {"qci_pmbus_ix2", ix2}, + {"qci_pmbus_ix1b", ix1b}, + {} +}; +MODULE_DEVICE_TABLE(i2c, qci_pmbus_id); + +/* + * Find sensor groups and status registers on each page. + */ +static void qci_pmbus_find_sensor_groups(struct i2c_client *client, + struct pmbus_driver_info *info) +{ + int page; + + /* Sensors detected on page 0 only */ + if (pmbus_check_word_register(client, 0, PMBUS_READ_VIN)) + info->func[0] |= PMBUS_HAVE_VIN; + if (pmbus_check_word_register(client, 0, PMBUS_READ_VCAP)) + info->func[0] |= PMBUS_HAVE_VCAP; + if (pmbus_check_word_register(client, 0, PMBUS_READ_IIN)) + info->func[0] |= PMBUS_HAVE_IIN; + if (pmbus_check_word_register(client, 0, PMBUS_READ_PIN)) + info->func[0] |= PMBUS_HAVE_PIN; + if (info->func[0] + && pmbus_check_byte_register(client, 0, PMBUS_STATUS_INPUT)) + info->func[0] |= PMBUS_HAVE_STATUS_INPUT; + if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_12) && + pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_1)) { + info->func[0] |= PMBUS_HAVE_FAN12; + if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_12)) + info->func[0] |= PMBUS_HAVE_STATUS_FAN12; + } + if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_34) && + pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_3)) { + info->func[0] |= PMBUS_HAVE_FAN34; + if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34)) + info->func[0] |= PMBUS_HAVE_STATUS_FAN34; + } + if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) + info->func[0] |= PMBUS_HAVE_TEMP; + if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2)) + info->func[0] |= PMBUS_HAVE_TEMP2; + if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3)) + info->func[0] |= PMBUS_HAVE_TEMP3; + if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 + | PMBUS_HAVE_TEMP3) + && pmbus_check_byte_register(client, 0, + PMBUS_STATUS_TEMPERATURE)) + info->func[0] |= PMBUS_HAVE_STATUS_TEMP; + + /* Sensors detected on all pages */ + for (page = 0; page < info->pages; page++) { + if (pmbus_check_word_register(client, page, PMBUS_READ_VOUT)) { + info->func[page] |= PMBUS_HAVE_VOUT; + if (pmbus_check_byte_register(client, page, + PMBUS_STATUS_VOUT)) + info->func[page] |= PMBUS_HAVE_STATUS_VOUT; + } + if (pmbus_check_word_register(client, page, PMBUS_READ_IOUT)) { + info->func[page] |= PMBUS_HAVE_IOUT; + if (pmbus_check_byte_register(client, 0, + PMBUS_STATUS_IOUT)) + info->func[page] |= PMBUS_HAVE_STATUS_IOUT; + } + if (pmbus_check_word_register(client, page, PMBUS_READ_POUT)) + info->func[page] |= PMBUS_HAVE_POUT; + } +} + +/* + * Identify chip parameters. + */ +static int qci_pmbus_identify(struct i2c_client *client, + struct pmbus_driver_info *info) +{ + int ret = 0; + + if (!info->pages) { + /* + * Check if the PAGE command is supported. If it is, + * keep setting the page number until it fails or until the + * maximum number of pages has been reached. Assume that + * this is the number of pages supported by the chip. + */ + if (pmbus_check_byte_register(client, 0, PMBUS_PAGE)) { + int page; + + for (page = 1; page < PMBUS_PAGES; page++) { + if (pmbus_set_page(client, page) < 0) + break; + } + pmbus_set_page(client, 0); + info->pages = page; + } else { + info->pages = 1; + } + } + + if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) { + int vout_mode; + + vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE); + if (vout_mode >= 0 && vout_mode != 0xff) { + switch (vout_mode >> 5) { + case 0: + break; + case 1: + info->format[PSC_VOLTAGE_OUT] = vid; + break; + case 2: + info->format[PSC_VOLTAGE_OUT] = direct; + break; + default: + ret = -ENODEV; + goto abort; + } + } + } + + /* + * We should check if the COEFFICIENTS register is supported. + * If it is, and the chip is configured for direct mode, we can read + * the coefficients from the chip, one set per group of sensor + * registers. + * + * To do this, we will need access to a chip which actually supports the + * COEFFICIENTS command, since the command is too complex to implement + * without testing it. Until then, abort if a chip configured for direct + * mode was detected. + */ + if (info->format[PSC_VOLTAGE_OUT] == direct) { + ret = -ENODEV; + goto abort; + } + + /* if no function pre-defined, try to find sensor groups */ + if (info->func[0] == 0) qci_pmbus_find_sensor_groups(client, info); +abort: + return ret; +} + +int qci_pmbus_set_page(struct i2c_client *client, u8 page) +{ + struct pmbus_data *data = i2c_get_clientdata(client); + int rv = 0; + int newpage; + + if (page != data->currpage) { + rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE, page); + udelay(DELAY_TIME); + newpage = i2c_smbus_read_byte_data(client, PMBUS_PAGE); + if (newpage != page) + rv = -EIO; + else + data->currpage = page; + } + return rv; +} + +int qci_write_byte(struct i2c_client *client, int page, u8 value) +{ + int rv; + + if (page >= 0) { + rv = qci_pmbus_set_page(client, page); + if (rv < 0) + return rv; + } + + rv = i2c_smbus_write_byte(client, value); + udelay(DELAY_TIME); + return rv; +} + +int qci_write_word_data(struct i2c_client *client, int page, int reg, u16 word) +{ + int rv; + + rv = qci_pmbus_set_page(client, page); + if (rv < 0) + return rv; + + rv = i2c_smbus_write_word_data(client, reg, word); + udelay(DELAY_TIME); + return rv; +} + +static int qci_pmbus_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct device *dev = &client->dev; + struct pmbus_driver_info *info; + int ret, i; + + dev_info(dev, "qci_pmbus_probe\n"); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) + return -ENODEV; + + info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), + GFP_KERNEL); + + if (!info) + return -ENOMEM; + + info->func[0] = 0; + + /* FIXME: add project specific function table here */ + switch (id->driver_data) { + case ly8: + info->pages = 1; + info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT + | PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12 + | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT + | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT + ; + break; + case ix1: + case ix2: + case ix1b: + info->pages = 1; + info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN + | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT + | PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12 + | PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 + | PMBUS_HAVE_TEMP3 | PMBUS_HAVE_STATUS_TEMP + | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT + | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT + | PMBUS_HAVE_POUT + ; + break; + default: + break; + } + info->write_word_data = qci_write_word_data; + info->write_byte = qci_write_byte; + info->identify = qci_pmbus_identify; /* FIXME: reserve for future use */ + + /* Register sysfs hooks */ + ret = sysfs_create_group(&dev->kobj, &qci_pmbus_inventory_attr_grp); + if (ret) { + dev_err(dev, "Failed to create sysfs entries\n"); + return -1; + } + + return pmbus_do_probe(client, id, info); +} + +/* This is the driver that will be inserted */ +static struct i2c_driver qci_pmbus_driver = { + .driver = { + .name = "qci-pmbus", + }, + .probe = qci_pmbus_probe, + .remove = pmbus_do_remove, + .id_table = qci_pmbus_id, +}; + +module_i2c_driver(qci_pmbus_driver); + + +MODULE_AUTHOR("Quanta Computer Inc."); +MODULE_VERSION("1.0"); +MODULE_DESCRIPTION("QUANTA generic PMBus driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/service/ix1b-platform-init.service b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/service/ix1b-platform-init.service new file mode 100755 index 000000000000..a51c0cca6914 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/service/ix1b-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Quanta IX1B-32X Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/quanta_ix1b_util.py install +ExecStop=/usr/local/bin/quanta_ix1b_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/setup.py b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/setup.py new file mode 100755 index 000000000000..e37687db7eca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='ix1b_32x', + version='1.0', + description='Module to initialize Quanta IX1B-32X platforms', + + packages=['ix1b_32x'], + package_dir={'ix1b_32x': 'ix1b-32x/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/utils/quanta_ix1b_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/utils/quanta_ix1b_util.py new file mode 100755 index 000000000000..f530cf3dbb7b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix1b-32x/utils/quanta_ix1b_util.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Quanta Computer Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +DEBUG = False +args = [] +FORCE = 0 +i2c_prefix = '/sys/bus/i2c/devices/' + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + install() + elif arg == 'clean': + uninstall() + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print "[IX1B-32X]"+txt + return + +def exec_cmd(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + show_log (cmd +"with result:" + str(status)) + show_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +instantiate =[ +#turn on module power +'echo 53 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio53/direction', +'echo 1 >/sys/class/gpio/gpio53/value', +#turn on 100G led by default +'i2cset -y 0x13 0x38 0x00 0xff', +'i2cset -y 0x13 0x38 0x01 0xff', +'i2cset -y 0x13 0x39 0x00 0xff', +'i2cset -y 0x13 0x39 0x01 0xff' +] + +drivers =[ +'lpc_ich', +'i2c-i801', +'i2c-dev', +'i2c-mux-pca954x', +'gpio-pca953x', +'qci_pmbus', +'leds-gpio', +'qci_cpld_qsfp28', +'qci_platform_ix1b' +] + + + +def system_install(): + global FORCE + + #remove default drivers to avoid modprobe order conflicts + status, output = exec_cmd("rmmod i2c_ismt ", 1) + status, output = exec_cmd("rmmod i2c-i801 ", 1) + #setup driver dependency + status, output = exec_cmd("depmod -a ", 1) + #install drivers + for i in range(0,len(drivers)): + status, output = exec_cmd("modprobe "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + + #instantiate devices + for i in range(0,len(instantiate)): + time.sleep(1) + status, output = exec_cmd(instantiate[i], 1) + if status: + print output + if FORCE == 0: + return status + + #for i in range(22,30): + # status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-4/i2c-"+str(i)+"/new_device", 1) + # if status: + # print output + # if FORCE == 0: + # return status + + return + + +def system_ready(): + if not device_found(): + return False + return True + +def install(): + if not device_found(): + print "No device, installing...." + status = system_install() + if status: + if FORCE == 0: + return status + else: + print " ix1b driver already installed...." + return + +def uninstall(): + global FORCE + #uninstall drivers + for i in range(len(drivers)-1,-1,-1): + status, output = exec_cmd("rmmod "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_found(): + ret1, log = exec_cmd("ls "+i2c_prefix+"i2c-0", 0) + return ret1 + +if __name__ == "__main__": + main() + + + From 0338379ca61aa097b4d9e4a48d91fefafba277ce Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 8 Aug 2018 08:05:22 +0000 Subject: [PATCH 1523/1833] [devices]: enable ingress and ariata devices on barefoot platform --- platform/barefoot/platform-modules-arista.mk | 2 ++ platform/barefoot/platform-modules-bfn-montara.mk | 2 ++ platform/barefoot/platform-modules-ingrasys.mk | 2 ++ platform/barefoot/platform-modules-wnc-osw1800.mk | 2 ++ 4 files changed, 8 insertions(+) diff --git a/platform/barefoot/platform-modules-arista.mk b/platform/barefoot/platform-modules-arista.mk index 633435c0550a..480aa0cf8396 100644 --- a/platform/barefoot/platform-modules-arista.mk +++ b/platform/barefoot/platform-modules-arista.mk @@ -21,3 +21,5 @@ $(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODU export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MODULE_PYTHON3 ARISTA_PLATFORM_MODULE_DRIVERS export ARISTA_SCD_DRIVER_CONFIG=m + +SONIC_STRETCH_DEBS += $(ARISTA_PLATFORM_MODULE) diff --git a/platform/barefoot/platform-modules-bfn-montara.mk b/platform/barefoot/platform-modules-bfn-montara.mk index 113faf201e41..853c3c636ac3 100644 --- a/platform/barefoot/platform-modules-bfn-montara.mk +++ b/platform/barefoot/platform-modules-bfn-montara.mk @@ -9,3 +9,5 @@ $(BFN_MONTARA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-module $(BFN_MONTARA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(BFN_MONTARA_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_32x-r0 SONIC_DPKG_DEBS += $(BFN_MONTARA_PLATFORM_MODULE) + +# SONIC_STRETCH_DEBS += $(BFN_MONTARA_PLATFORM_MODULE) diff --git a/platform/barefoot/platform-modules-ingrasys.mk b/platform/barefoot/platform-modules-ingrasys.mk index 5145dcbc5ffa..ea8f68c003fc 100644 --- a/platform/barefoot/platform-modules-ingrasys.mk +++ b/platform/barefoot/platform-modules-ingrasys.mk @@ -16,3 +16,5 @@ INGRASYS_S9280_64X_PLATFORM_MODULE = sonic-platform-ingrasys-s9280-64x_$(INGRASY $(INGRASYS_S9280_64X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9280_64x-r0 $(eval $(call add_extra_package,$(INGRASYS_S9180_32X_PLATFORM_MODULE),$(INGRASYS_S9280_64X_PLATFORM_MODULE))) + +SONIC_STRETCH_DEBS += $(INGRASYS_S9180_32X_PLATFORM_MODULE) diff --git a/platform/barefoot/platform-modules-wnc-osw1800.mk b/platform/barefoot/platform-modules-wnc-osw1800.mk index a85ba6b19326..aabcb8cdf0ba 100644 --- a/platform/barefoot/platform-modules-wnc-osw1800.mk +++ b/platform/barefoot/platform-modules-wnc-osw1800.mk @@ -9,3 +9,5 @@ $(WNC_OSW1800_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-module $(WNC_OSW1800_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(WNC_OSW1800_PLATFORM_MODULE)_PLATFORM = x86_64-wnc_osw1800-r0 SONIC_DPKG_DEBS += $(WNC_OSW1800_PLATFORM_MODULE) + +# SONIC_STRETCH_DEBS += $(WNC_OSW1800_PLATFORM_MODULE) From 678d4d4a0cce53764184b7cd84db2307b9420cc4 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Fri, 10 Aug 2018 10:01:32 +0300 Subject: [PATCH 1524/1833] [mellanox]: Update SDK pointer (#41) Signed-off-by: Volodymyr Samotiy --- platform/mellanox/sdk.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 88bfe76d0f0d..d3bb61517339 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,4 +1,4 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/5be04c71508e0688ae004ed838b998dba521f693/sdk +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/87823de172a593e070ff7e9f3e17d442c7cf1eac/sdk MLNX_SDK_VERSION = 4.2.8103 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ From 6a3c05f49835aa3f869ce807518465ac91f2d022 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Fri, 10 Aug 2018 10:02:09 +0300 Subject: [PATCH 1525/1833] [mellanox]: Update recipe for hw-mgmt according to latest changes (#40) Signed-off-by: Volodymyr Samotiy --- .gitmodules | 4 +- files/build_templates/swss.service.j2 | 4 +- platform/mellanox/hw-management.mk | 2 +- .../Add-systemd-service-config.patch | 58 +++++++++++++++++++ platform/mellanox/hw-management/Makefile | 14 +++++ .../{hw-management => hw-management/hw-mgmt} | 0 6 files changed, 77 insertions(+), 5 deletions(-) mode change 100755 => 100644 .gitmodules create mode 100644 platform/mellanox/hw-management/Add-systemd-service-config.patch create mode 100644 platform/mellanox/hw-management/Makefile rename platform/mellanox/{hw-management => hw-management/hw-mgmt} (100%) diff --git a/.gitmodules b/.gitmodules old mode 100755 new mode 100644 index 73ab4bf8ba13..c89dfe45fced --- a/.gitmodules +++ b/.gitmodules @@ -68,6 +68,6 @@ [submodule "platform/barefoot/sonic-platform-modules-arista"] path = platform/barefoot/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic -[submodule "platform/mellanox/hw-management"] - path = platform/mellanox/hw-management +[submodule "platform/mellanox/hw-management/hw-mgmt"] + path = platform/mellanox/hw-management/hw-mgmt url = https://github.com/Mellanox/hw-mgmt/ diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 1ceb706a175d..289a840d3517 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -31,7 +31,7 @@ ExecStartPre=/usr/bin/mst start ExecStartPre=/usr/bin/mlnx-fw-upgrade.sh ExecStartPre=/etc/init.d/sxdkernel start ExecStartPre=/sbin/modprobe i2c-dev -ExecStartPre=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)/hw-management start" +ExecStartPre=/bin/bash -c "/etc/mlnx/mlnx-hw-management start" {% elif sonic_asic_platform == 'cavium' %} ExecStartPre=/etc/init.d/xpnet.sh start {% endif %} @@ -44,7 +44,7 @@ ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStopPost=/usr/bin/syncd.sh stop {% if sonic_asic_platform == 'mellanox' %} -ExecStopPost=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)/hw-management stop" +ExecStartPre=/bin/bash -c "/etc/mlnx/mlnx-hw-management stop" ExecStopPost=/etc/init.d/sxdkernel stop ExecStopPost=/usr/bin/mst stop {% elif sonic_asic_platform == 'cavium' %} diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index ee5f923058e5..cd457181268f 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -7,6 +7,6 @@ export MLNX_HW_MANAGEMENT_VERSION MLNX_HW_MANAGEMENT = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb $(MLNX_HW_MANAGEMENT)_SRC_PATH = $(PLATFORM_PATH)/hw-management $(MLNX_HW_MANAGEMENT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -SONIC_DPKG_DEBS += $(MLNX_HW_MANAGEMENT) +SONIC_MAKE_DEBS += $(MLNX_HW_MANAGEMENT) SONIC_STRETCH_DEBS += $(MLNX_HW_MANAGEMENT) diff --git a/platform/mellanox/hw-management/Add-systemd-service-config.patch b/platform/mellanox/hw-management/Add-systemd-service-config.patch new file mode 100644 index 000000000000..ce16bb712ee1 --- /dev/null +++ b/platform/mellanox/hw-management/Add-systemd-service-config.patch @@ -0,0 +1,58 @@ +From 22fef644b1150677353ab0559828ea45a982d901 Mon Sep 17 00:00:00 2001 +From: Andriy Moroz +Date: Wed, 11 Jul 2018 16:51:07 +0300 +Subject: [PATCH] Add systemd service config + +Signed-off-by: Andriy Moroz +--- + debian/control | 2 +- + debian/hw-management.service | 10 ++++++++++ + debian/rules | 2 +- + 3 files changed, 12 insertions(+), 2 deletions(-) + create mode 100644 debian/hw-management.service + +diff --git a/debian/control b/debian/control +index 048cd61..7e3a545 100644 +--- a/debian/control ++++ b/debian/control +@@ -1,7 +1,7 @@ + Source: hw-management + Priority: extra + Maintainer: MellanoxBSP +-Build-Depends: ++Build-Depends: dh-systemd + Standards-Version: + Section: libs + Homepage: http://www.mellanox.com +diff --git a/debian/hw-management.service b/debian/hw-management.service +new file mode 100644 +index 0000000..d18916d +--- /dev/null ++++ b/debian/hw-management.service +@@ -0,0 +1,10 @@ ++[Unit] ++Description=Mellanox Hardware Management ++ ++[Service] ++Type=oneshot ++EnvironmentFile=/host/machine.conf ++ExecStart=/bin/bash -c "/etc/mlnx/mlnx-hw-management start" ++ ++[Install] ++WantedBy=multi-user.target +diff --git a/debian/rules b/debian/rules +index fc38817..fba4150 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -8,7 +8,7 @@ K_SRC ?= "/lib/modules/$(KVERSION)/build" + pwd=$(shell pwd) + + %: +- dh $@ ++ dh $@ --with systemd + + override_dh_auto_configure: + +-- +1.9.1 + diff --git a/platform/mellanox/hw-management/Makefile b/platform/mellanox/hw-management/Makefile new file mode 100644 index 000000000000..608c94e6b02a --- /dev/null +++ b/platform/mellanox/hw-management/Makefile @@ -0,0 +1,14 @@ +.ONESHELL: +SHELL = /bin/bash + +MAIN_TARGET = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + + pushd hw-mgmt + git am ../*.patch + chmod +x ./debian/rules + sudo ./debian/rules binary KVERSION=$(KVERSION) + popd + + mv $* $(DEST)/ diff --git a/platform/mellanox/hw-management b/platform/mellanox/hw-management/hw-mgmt similarity index 100% rename from platform/mellanox/hw-management rename to platform/mellanox/hw-management/hw-mgmt From be0328a59ab60fa81480d1fc798e5e532e55d213 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 10 Aug 2018 16:47:33 -0700 Subject: [PATCH 1526/1833] Update arista-drivers submodules (#42) --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 8f65ad92c5b5..a4d1d8d2737c 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 8f65ad92c5b5dfec24e8faf068cc9d2374244edf +Subproject commit a4d1d8d2737cf49bd6cc802dbc6c8c0ff682fa87 diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index a7edec0e19e6..a4d1d8d2737c 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a7edec0e19e63b4ec437d32928a5362a6d0a9bc9 +Subproject commit a4d1d8d2737cf49bd6cc802dbc6c8c0ff682fa87 From 002bff4e4518e22a232cb1cab3ec941bbcde65bd Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 11 Aug 2018 17:58:30 +0000 Subject: [PATCH 1527/1833] [baseimage]: use rsyslog in baseimage from stretch repo Signed-off-by: Guohan Lu --- build_debian.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index c5368c4a2229..e274b19adadc 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -221,6 +221,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in gdisk \ sysfsutils \ grub2-common \ + rsyslog \ ethtool \ screen \ hping3 \ @@ -228,10 +229,6 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in tcptraceroute \ mtr-tiny -# Install a newer version of rsyslog from jessie-backports in hopes of -# eliminating memory leaks -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y -t jessie-backports install rsyslog - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ grub-pc-bin From 400597596a5c7ff36edf9cf5d8ce69bc855fbb40 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 11 Aug 2018 21:09:47 +0000 Subject: [PATCH 1528/1833] [submodules]: update submodule for platform modules dell, s6000 and kernel Signed-off-by: Guohan Lu --- .gitmodules | 6 +++--- platform/broadcom/sonic-platform-modules-dell | 2 +- platform/broadcom/sonic-platform-modules-s6000 | 2 +- src/sonic-linux-kernel | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index c89dfe45fced..728c417cdba9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,7 +3,7 @@ url = https://github.com/Azure/sonic-swss-common [submodule "sonic-linux-kernel"] path = src/sonic-linux-kernel - url = https://github.com/lguohan/sonic-linux-kernel + url = https://github.com/Azure/sonic-linux-kernel branch = stretch [submodule "sonic-sairedis"] path = src/sonic-sairedis @@ -38,14 +38,14 @@ url = https://github.com/Azure/sonic-utilities [submodule "platform/broadcom/sonic-platform-modules-s6000"] path = platform/broadcom/sonic-platform-modules-s6000 - url = https://github.com/lguohan/sonic-platform-modules-s6000 + url = https://github.com/Azure/sonic-platform-modules-s6000 branch = stretch [submodule "platform/broadcom/sonic-platform-modules-arista"] path = platform/broadcom/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic [submodule "platform/broadcom/sonic-platform-modules-dell"] path = platform/broadcom/sonic-platform-modules-dell - url = https://github.com/lguohan/sonic-platform-modules-dell + url = https://github.com/Azure/sonic-platform-modules-dell branch = stretch [submodule "src/sonic-platform-common"] path = src/sonic-platform-common diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell index 6cfea2267688..ae36817bbabc 160000 --- a/platform/broadcom/sonic-platform-modules-dell +++ b/platform/broadcom/sonic-platform-modules-dell @@ -1 +1 @@ -Subproject commit 6cfea2267688b7fb5cd11a867057ed264a01502c +Subproject commit ae36817bbabc2825f184b5e7cdad5422b4f1d9db diff --git a/platform/broadcom/sonic-platform-modules-s6000 b/platform/broadcom/sonic-platform-modules-s6000 index 168674d34148..6c4da534410c 160000 --- a/platform/broadcom/sonic-platform-modules-s6000 +++ b/platform/broadcom/sonic-platform-modules-s6000 @@ -1 +1 @@ -Subproject commit 168674d34148fbf7e8a989edae6a341272a9cffa +Subproject commit 6c4da534410c037892ad0338d1c930b5b9b1493b diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 70fdaa224c13..9ce82be61202 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 70fdaa224c1373682be871c084bf0f590bfafd8f +Subproject commit 9ce82be612023bf73093b231e98c69c7c4bb1ea0 From 88ea503e63892f998f438439300b50d2bdaef6c5 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 11 Aug 2018 21:26:12 +0000 Subject: [PATCH 1529/1833] [doc]: update build instruction for debian stretch build Signed-off-by: Guohan Lu --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0c9ded3441d8..20c7b9a80bc4 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,10 @@ To build SONiC installer image and docker images, run the following commands: # Execute make configure once to configure ASIC make configure PLATFORM=[ASIC_VENDOR] + # build debian stretch required targets + BLDENV=stretch make stretch + + # build SONiC image make **NOTE**: @@ -79,11 +83,6 @@ The SONiC installer contains all docker images needed. SONiC uses one image for For Broadcom ASIC, we build ONIE and EOS image. EOS image is used for Arista devices, ONIE image is used for all other Broadcom ASIC based devices. - make configure PLATFORM=broadcom - BLDENV=stretch make stretch - # build ONIE image - make target/sonic-broadcom.bin - You may find the rules/config file useful. It contains configuration options for the build process, like adding more verbosity or showing dependencies, username and password for base image etc. Every docker image is built and saved to target/ directory. From 7f7a2a019ec68087d40f9897ae32ca58848329a8 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 11 Aug 2018 21:38:33 +0000 Subject: [PATCH 1530/1833] [sshd]: regenerate ssh key if ssh_host_rsa_key is not present ssh_host_key is removed in debian stretch. Use ssh_host_rsa_key to decide if the host keys are present. Signed-off-by: Guohan Lu --- files/sshd/host-ssh-keygen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/sshd/host-ssh-keygen.sh b/files/sshd/host-ssh-keygen.sh index 476dd00a2800..ade24e6383de 100755 --- a/files/sshd/host-ssh-keygen.sh +++ b/files/sshd/host-ssh-keygen.sh @@ -1,6 +1,6 @@ #!/bin/bash -[ -r /etc/ssh/ssh_host_key ] || { +[ -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 From 66ffca2832856cf05af0f8443640e838aacc522b Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 11 Aug 2018 23:46:13 +0000 Subject: [PATCH 1531/1833] [kernel]: set default option to build kernel Signed-off-by: Guohan Lu --- platform/broadcom/sonic-platform-modules-ingrasys/debian/rules | 0 slave.mk | 2 +- src/sonic-linux-kernel | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 platform/broadcom/sonic-platform-modules-ingrasys/debian/rules diff --git a/platform/broadcom/sonic-platform-modules-ingrasys/debian/rules b/platform/broadcom/sonic-platform-modules-ingrasys/debian/rules old mode 100644 new mode 100755 diff --git a/slave.mk b/slave.mk index d6ce78e6f19c..4f1998680b29 100644 --- a/slave.mk +++ b/slave.mk @@ -139,7 +139,7 @@ $(info ) ## All rules must go after includes for propper targets expansion ############################################################################### -export kernel_procure_method="$(KERNEL_PROCURE_METHOD)" +export kernel_procure_method=$(KERNEL_PROCURE_METHOD) ############################################################################### ## Local targets diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 9ce82be61202..28e99c0e7618 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 9ce82be612023bf73093b231e98c69c7c4bb1ea0 +Subproject commit 28e99c0e76189e8ec5c46535cbd87145668262d8 From 1533bc5875d1a9e431dab8006bee122f8dc93a48 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 12 Aug 2018 06:38:47 +0000 Subject: [PATCH 1532/1833] [dockerbase]: use libwrarp0 7.6.q-26 in docker base Signed-off-by: Guohan Lu --- src/libwrap/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libwrap/Makefile b/src/libwrap/Makefile index 4cb2e88a0c46..512b1d51fb18 100644 --- a/src/libwrap/Makefile +++ b/src/libwrap/Makefile @@ -10,7 +10,12 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./tcp-wrappers-7.6.q* # Get source package - apt-get source libwrap0 + wget -NO tcp-wrappers_$(LIBWRAP_VERSION).dsc "https://sonicstorage.blob.core.windows.net/packages/debian/tcp-wrappers_7.6.q-26.dsc?sv=2015-04-05&sr=b&sig=5dxVp8RsLfnuMDm99g4JpgG6Q3zzTaoTkPNVoo0d8YE%3D&se=2155-07-05T06%3A34%3A45Z&sp=r" + wget -NO tcp-wrappers_$(LIBWRAP_VERSION).debian.tar.xz "https://sonicstorage.blob.core.windows.net/packages/debian/tcp-wrappers_7.6.q-26.debian.tar.xz?sv=2015-04-05&sr=b&sig=6%2FquqekmGloVz%2FaDc%2BCOCLL%2FKqEfIWrr%2BdmnZhJ8k8Q%3D&se=2155-07-05T06%3A32%3A43Z&sp=r" + wget -NO tcp-wrappers_7.6.q.orig.tar.gz "https://sonicstorage.blob.core.windows.net/packages/debian/tcp-wrappers_7.6.q.orig.tar.gz?sv=2015-04-05&sr=b&sig=%2B%2BQbllR9xfwmYvgLiz1jtyn6ZP4oLgbTENTL5Fj8M4w%3D&se=2155-07-05T06%3A35%3A24Z&sp=r" + + dpkg-source -x tcp-wrappers_$(LIBWRAP_VERSION).dsc + cp tcp_wrappers-7.6-allowlist.patch tcp-wrappers-7.6.q/debian/patches/tcp_wrappers-7.6-allowlist.patch echo tcp_wrappers-7.6-allowlist.patch >> tcp-wrappers-7.6.q/debian/patches/series From 8910c7e18c269c5ae63ebf89f5f677b7c9992120 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 12 Aug 2018 07:58:59 +0000 Subject: [PATCH 1533/1833] update .gitignore Signed-off-by: Guohan Lu --- .gitignore | 1 + .../sonic-platform-modules-accton/.gitignore | 17 +++++++++++++++ .../.gitignore | 17 +++++++++++++++ .../sonic-platform-modules-quanta/.gitignore | 21 +++++++++++++++---- 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 4eb7ab7e9ab7..0103ab241bc1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ fs.* target/ *.deb *.changes +*.buildinfo # Subdirectories in src src/hiredis/* diff --git a/platform/broadcom/sonic-platform-modules-accton/.gitignore b/platform/broadcom/sonic-platform-modules-accton/.gitignore index f805e810e5c6..7f287d538227 100644 --- a/platform/broadcom/sonic-platform-modules-accton/.gitignore +++ b/platform/broadcom/sonic-platform-modules-accton/.gitignore @@ -31,3 +31,20 @@ # Debug files *.dSYM/ *.su + +# Kernel Module Compile Results +*.mod* +*.cmd +*.o.d +.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-ingrasys/.gitignore b/platform/broadcom/sonic-platform-modules-ingrasys/.gitignore index f805e810e5c6..7f287d538227 100644 --- a/platform/broadcom/sonic-platform-modules-ingrasys/.gitignore +++ b/platform/broadcom/sonic-platform-modules-ingrasys/.gitignore @@ -31,3 +31,20 @@ # Debug files *.dSYM/ *.su + +# Kernel Module Compile Results +*.mod* +*.cmd +*.o.d +.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-quanta/.gitignore b/platform/broadcom/sonic-platform-modules-quanta/.gitignore index 2615f7f89bbb..7f287d538227 100755 --- a/platform/broadcom/sonic-platform-modules-quanta/.gitignore +++ b/platform/broadcom/sonic-platform-modules-quanta/.gitignore @@ -1,10 +1,6 @@ # Object files *.o *.ko -*.cmd -*.mod.c -*.symvers -*.order *.obj *.elf @@ -35,3 +31,20 @@ # Debug files *.dSYM/ *.su + +# Kernel Module Compile Results +*.mod* +*.cmd +*.o.d +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf + +# Debian packaging +*.debhelper.log +*.postinst.debhelper +*.postrm.debhelper +*.prerm.debhelper +*.substvars From 6246b161d558b103ecbb86ce435f4f515e03726a Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 12 Aug 2018 08:20:10 +0000 Subject: [PATCH 1534/1833] [doc]: update build instruction for debian stretch Signed-off-by: Guohan Lu --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 20c7b9a80bc4..e09c4e2c2801 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ To build SONiC installer image and docker images, run the following commands: BLDENV=stretch make stretch # build SONiC image - make + make all **NOTE**: @@ -83,6 +83,14 @@ The SONiC installer contains all docker images needed. SONiC uses one image for For Broadcom ASIC, we build ONIE and EOS image. EOS image is used for Arista devices, ONIE image is used for all other Broadcom ASIC based devices. + make configure PLATFORM=broadcom + # build debian stretch required targets + BLDENV=stretch make stretch + # build ONIE image + make target/sonic-broadcom.bin + # build EOS image + make target/sonic-aboot-broadcom.swi + You may find the rules/config file useful. It contains configuration options for the build process, like adding more verbosity or showing dependencies, username and password for base image etc. Every docker image is built and saved to target/ directory. From d761630f738925060d57ec7739ab04e60d0f294f Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Sun, 12 Aug 2018 03:14:55 -0700 Subject: [PATCH 1535/1833] Fix potential blackholing/looping traffic when link-local was used and refresh ipv6 neighbor to avoid CPU hit (#1904) * Fix potential blackholing/looping traffic and refresh ipv6 neighbor to avoid CPU hit In case ipv6 global addresses were configured on L3 interfaces and used for peering, and routing protocol was using link-local addresses on the same interfaces as prefered nexthops, the link-local addresses could be aged out after a while due to no activities towards the link-local addresses themselves. And when we receive new routes with the link-local nexthops, SONiC won't insert them to the HW, and thus cause looping or blackholing traffic. Global ipv6 addresses on L3 interfaces between switches are refreshed by BGP keeplive and other messages. On server facing side, traffic may hit fowarding plane only, and no refresh for the ipv6 neighbor entries regularly. This could age-out the linux kernel ipv6 neighbor entries, and HW neighbor table entries could be removed, and thus traffic going to those neighbors would hit CPU, and cause traffic drop and temperary CPU high load. Also, if link-local addresses were not learned, we may not get them at all later. It is intended to fix all above issues. Changes: Add ndisc6 package in swss docker and use it for ipv6 ndp ping to update the neighbors' state on Vlan interfaces Change the default ipv6 neighbor reachable timer to 30mins Add periodical ipv6 multicast ping to ff02::11 to get/refresh link-local neighbor info. * Fix review comments: Add PORTCHANNEL_INTERFACE interface for ipv6 multicast ping format issue * Combine regular L3 interface and portchannel interface for looping * Add ndisc6 package to vs docker --- build_debian.sh | 1 + dockers/docker-orchagent/Dockerfile.j2 | 1 + files/scripts/arp_update | 34 +++++++++++++++++++++-- platform/vs/docker-sonic-vs/Dockerfile.j2 | 1 + 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index e274b19adadc..03425ffe5bcf 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -303,6 +303,7 @@ set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_notify 1 set /files/etc/sysctl.conf/net.ipv4.conf.all.arp_ignore 2 set /files/etc/sysctl.conf/net.ipv4.neigh.default.base_reachable_time_ms 1800000 +set /files/etc/sysctl.conf/net.ipv6.neigh.default.base_reachable_time_ms 1800000 set /files/etc/sysctl.conf/net.ipv6.conf.default.forwarding 1 set /files/etc/sysctl.conf/net.ipv6.conf.all.forwarding 1 diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index eceb82a06c76..2d204df9078f 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -10,6 +10,7 @@ RUN apt-get update RUN apt-get install -f -y ifupdown arping libdbus-1-3 libdaemon0 libjansson4 +RUN apt-get install -f -y ndisc6 ## Install redis-tools dependencies ## TODO: implicitly install dependencies RUN apt-get -y install libjemalloc1 diff --git a/files/scripts/arp_update b/files/scripts/arp_update index ab44ca6a4580..f7c5ec8bb856 100755 --- a/files/scripts/arp_update +++ b/files/scripts/arp_update @@ -1,10 +1,28 @@ #!/bin/bash # # usage: -# arp_update: Send gratuitous ARP requests to VLAN member neighbors to refresh -# the neighbors state. +# arp_update: +# Send ipv6 multicast pings to all "UP" L3 interfaces including vlan interfaces to +# refresh link-local addresses from neighbors. +# Send gratuitous ARP/NDP requests to VLAN member neighbors to refresh +# the ipv4/ipv6 neighbors state. while /bin/true; do + # find L3 interfaces which are UP, send ipv6 multicast pings + echo "{% for (name, prefix) in INTERFACE %} {{name}} {% endfor %}" > /tmp/intf_tmp.j2 + INTERFACE=`sonic-cfggen -d -t /tmp/intf_tmp.j2` + echo "{% for (name, prefix) in PORTCHANNEL_INTERFACE %} {{name}} {% endfor %}" > /tmp/pc_intf_tmp.j2 + PC_INTERFACE=`sonic-cfggen -d -t /tmp/pc_intf_tmp.j2` + + ALL_INTERFACE="$INTERFACE $PC_INTERFACE" + for intf in $ALL_INTERFACE; do + ping6cmd="ping6 -I $intf -n -q -i 0 -c 1 -W 0 ff02::1 >/dev/null" + intf_up=$(ip link show $intf | grep "state UP") + if [[ -n "$intf_up" ]]; then + eval $ping6cmd + fi + done + VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` for vlan in $VLAN; do # generate a list of arping commands: @@ -15,6 +33,18 @@ while /bin/true; do ipcmd="ip -4 neigh show | grep $vlan | cut -d ' ' -f 1,3 | $arpingcmd" eval `eval $ipcmd` + + # send ipv6 multicast pings to Vlan interfaces to get/refresh link-local addrs + ping6cmd="ping6 -I $vlan -n -q -i 0 -c 1 -W 0 ff02::1 >/dev/null" + eval $ping6cmd + + # generate a list of ndisc6 commands (exclude link-local addrs since it is done above): + # ndisc6 -q -w 0 -1 ; + # ndisc6 -q -w 0 -1 ; + # ... + ndisc6cmd="sed -e 's/^/ndisc6 -q -w 0 -1 /' -e 's/$/;/'" + ip6cmd="ip -6 neigh show | grep -v fe80 | grep $vlan | cut -d ' ' -f 1,3 | $ndisc6cmd" + eval `eval $ip6cmd` done sleep 300 done diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 2d9b72aa3298..ded75caff524 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -13,6 +13,7 @@ RUN apt-get update RUN apt-get install -y net-tools \ arping \ + ndisc6 \ ethtool \ tcpdump \ ifupdown \ From 58db7f17a733732d6714da318087c535f1a842a6 Mon Sep 17 00:00:00 2001 From: klhaung <38268572+klhaung@users.noreply.github.com> Date: Mon, 13 Aug 2018 03:39:20 +0800 Subject: [PATCH 1536/1833] [device & platform] led and transceiver deamon for inventec switch d7032 and d7054 (#1678) * [device]: Modify SFPUtil for inventec-d7032 [device]: Add front panel led support for Inventec-d7032 [platform]: Add transceiver monitor daemon for Inventec-d7032 and Inventec-d7054 * [device] follow new porting guide to have broadcom config under device folder * remove license --- .../INVENTEC-D7032Q28B-C32/sai.profile | 2 +- .../th-d7032q28b-32x100g.config.bcm | 290 +++++++++++ .../th-d7032q28b-32x40g.config.bcm | 427 ++++++++++++++++ .../led_proc_init.soc | 136 +++++ .../plugins/sfputil.py | 10 + .../INVENTEC-D7054Q28B-S48-Q6/sai.profile | 2 +- .../th-d7054q28b-48x10g-6x100g.config.bcm | 465 ++++++++++++++++++ .../th-d7054q28b-48x25g-6x100g.config.bcm | 414 ++++++++++++++++ .../common/utils/led_proc.py | 314 ++++++++++++ .../common/utils/transceiver_monitor.py | 305 ++++++++++++ .../debian/platform-modules-d7032q28b.init | 22 + .../debian/platform-modules-d7032q28b.install | 2 + .../debian/platform-modules-d7032q28b.upstart | 5 - .../debian/platform-modules-d7054q28b.init | 22 + .../debian/platform-modules-d7054q28b.install | 3 + .../debian/platform-modules-d7054q28b.upstart | 5 - 16 files changed, 2412 insertions(+), 12 deletions(-) create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/th-d7032q28b-32x100g.config.bcm create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/th-d7032q28b-32x40g.config.bcm create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/led_proc_init.soc create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/th-d7054q28b-48x10g-6x100g.config.bcm create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/th-d7054q28b-48x25g-6x100g.config.bcm create mode 100755 platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py create mode 100755 platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py delete mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.upstart delete mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.upstart diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/sai.profile b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/sai.profile index 5312a779bbc3..acd7f9034862 100644 --- a/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/sai.profile +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/sai.profile @@ -1,2 +1,2 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-d7032q28b-32x100g.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-d7032q28b-32x100g.config.bcm SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/th-d7032q28b-32x100g.config.bcm b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/th-d7032q28b-32x100g.config.bcm new file mode 100644 index 000000000000..613158431634 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/th-d7032q28b-32x100g.config.bcm @@ -0,0 +1,290 @@ +# Redwood BCM Shell config / all 100G 32 ports + +# Define default OS / SAL +os=unix + +l2_mem_entries=8192 +l3_mem_entries=8192 +l3_alpm_enable=2 +#ipv6_lpm_128b_enable=1 +l2xmsg_mode=1 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 +# per Broadcom feedback, no more pbmp_oversubscribe +# pbmp_oversubscribe=0x00003fc000000ff0000003fc000001fe +oversubscribe_mode=1 +pbmp_xport_xe=0x3fd000000ff4000003fc000001fe + +# EagleCore ports +portmap_66=129:10 +portmap_100=131:10 + +# Loopback ports +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 + +portmap_68=65:100 +portmap_69=69:100 +portmap_70=73:100 +portmap_71=77:100 +portmap_72=81:100 +portmap_73=85:100 +portmap_74=89:100 +portmap_75=93:100 + +portmap_102=97:100 +portmap_103=101:100 +portmap_104=105:100 +portmap_105=109:100 +portmap_106=113:100 +portmap_107=117:100 +portmap_108=121:100 +portmap_109=125:100 + +portmap_1=1:100 +portmap_2=5:100 +portmap_3=9:100 +portmap_4=13:100 +portmap_5=17:100 +portmap_6=21:100 +portmap_7=25:100 +portmap_8=29:100 + +portmap_34=33:100 +portmap_35=37:100 +portmap_36=41:100 +portmap_37=45:100 +portmap_38=49:100 +portmap_39=53:100 +portmap_40=57:100 +portmap_41=61:100 + +phy_xaui_tx_polarity_flip_ce0=0x8 +phy_xaui_tx_polarity_flip_ce1=0x6 +phy_xaui_tx_polarity_flip_ce2=0x6 +phy_xaui_tx_polarity_flip_ce3=0x6 +phy_xaui_tx_polarity_flip_ce4=0x3 +phy_xaui_tx_polarity_flip_ce5=0x4 +phy_xaui_tx_polarity_flip_ce6=0xc +phy_xaui_tx_polarity_flip_ce7=0x6 +phy_xaui_tx_polarity_flip_ce8=0xc +phy_xaui_tx_polarity_flip_ce9=0x3 +phy_xaui_tx_polarity_flip_ce10=0x3 +phy_xaui_tx_polarity_flip_ce11=0x3 +phy_xaui_tx_polarity_flip_ce12=0x4 +phy_xaui_tx_polarity_flip_ce13=0x1 +phy_xaui_tx_polarity_flip_ce14=0x2 +phy_xaui_tx_polarity_flip_ce15=0x3 +phy_xaui_tx_polarity_flip_ce16=0x2 +phy_xaui_tx_polarity_flip_ce17=0x3 +phy_xaui_tx_polarity_flip_ce18=0x2 +phy_xaui_tx_polarity_flip_ce19=0x8 +phy_xaui_tx_polarity_flip_ce20=0x2 +phy_xaui_tx_polarity_flip_ce21=0x9 +phy_xaui_tx_polarity_flip_ce22=0x8 +phy_xaui_tx_polarity_flip_ce23=0x9 +phy_xaui_tx_polarity_flip_ce24=0x2 +phy_xaui_tx_polarity_flip_ce25=0x4 +phy_xaui_tx_polarity_flip_ce26=0xd +phy_xaui_tx_polarity_flip_ce27=0xc +phy_xaui_tx_polarity_flip_ce28=0x3 +phy_xaui_tx_polarity_flip_ce29=0xc +phy_xaui_tx_polarity_flip_ce30=0xc +phy_xaui_tx_polarity_flip_ce31=0x2 + +phy_xaui_rx_polarity_flip_ce0=0xb +phy_xaui_rx_polarity_flip_ce1=0xc +phy_xaui_rx_polarity_flip_ce2=0xc +phy_xaui_rx_polarity_flip_ce3=0xc +phy_xaui_rx_polarity_flip_ce4=0x1 +phy_xaui_rx_polarity_flip_ce5=0xc +phy_xaui_rx_polarity_flip_ce6=0x4 +phy_xaui_rx_polarity_flip_ce7=0xc +phy_xaui_rx_polarity_flip_ce8=0xb +phy_xaui_rx_polarity_flip_ce9=0x6 +phy_xaui_rx_polarity_flip_ce10=0x1 +phy_xaui_rx_polarity_flip_ce11=0x8 +phy_xaui_rx_polarity_flip_ce12=0xc +phy_xaui_rx_polarity_flip_ce13=0x6 +phy_xaui_rx_polarity_flip_ce14=0x4 +phy_xaui_rx_polarity_flip_ce15=0xe +phy_xaui_rx_polarity_flip_ce16=0xe +phy_xaui_rx_polarity_flip_ce17=0x2 +phy_xaui_rx_polarity_flip_ce18=0x4 +phy_xaui_rx_polarity_flip_ce19=0x6 +phy_xaui_rx_polarity_flip_ce20=0xe +phy_xaui_rx_polarity_flip_ce21=0x3 +phy_xaui_rx_polarity_flip_ce22=0x3 +phy_xaui_rx_polarity_flip_ce23=0x3 +phy_xaui_rx_polarity_flip_ce24=0xb +phy_xaui_rx_polarity_flip_ce25=0xc +phy_xaui_rx_polarity_flip_ce26=0xe +phy_xaui_rx_polarity_flip_ce27=0xc +phy_xaui_rx_polarity_flip_ce28=0xb +phy_xaui_rx_polarity_flip_ce29=0x9 +phy_xaui_rx_polarity_flip_ce30=0x6 +phy_xaui_rx_polarity_flip_ce31=0x9 + +# EQ/iDriver +serdes_preemphasis_1=0x323E00 +serdes_preemphasis_2=0x323E00 +serdes_preemphasis_3=0x323E00 +serdes_preemphasis_4=0x323E00 + +serdes_preemphasis_5=0x323E00 +serdes_preemphasis_6=0x323E00 +serdes_preemphasis_7=0x323E00 +serdes_preemphasis_8=0x323E00 + +serdes_preemphasis_9=0x343C00 +serdes_preemphasis_10=0x343C00 +serdes_preemphasis_11=0x343C00 +serdes_preemphasis_12=0x343C00 + +serdes_preemphasis_13=0x343C00 +serdes_preemphasis_14=0x343C00 +serdes_preemphasis_15=0x343C00 +serdes_preemphasis_16=0x343C00 + +serdes_preemphasis_17=0x323E00 +serdes_preemphasis_18=0x323E00 +serdes_preemphasis_19=0x323E00 +serdes_preemphasis_20=0x323E00 + +serdes_preemphasis_21=0x323E00 +serdes_preemphasis_22=0x323E00 +serdes_preemphasis_23=0x323E00 +serdes_preemphasis_24=0x323E00 + +serdes_preemphasis_25=0x304000 +serdes_preemphasis_26=0x304000 +serdes_preemphasis_27=0x304000 +serdes_preemphasis_28=0x304000 + +serdes_preemphasis_29=0x304000 +serdes_preemphasis_30=0x304000 +serdes_preemphasis_31=0x304000 +serdes_preemphasis_32=0x304000 + +serdes_preemphasis_34=0x2D4300 +serdes_preemphasis_35=0x2D4300 +serdes_preemphasis_36=0x2D4300 +serdes_preemphasis_37=0x2D4300 + +serdes_preemphasis_38=0x2D4300 +serdes_preemphasis_39=0x2D4300 +serdes_preemphasis_40=0x2D4300 +serdes_preemphasis_41=0x2D4300 + +serdes_preemphasis_42=0x2B4500 +serdes_preemphasis_43=0x2B4500 +serdes_preemphasis_44=0x2B4500 +serdes_preemphasis_45=0x2B4500 + +serdes_preemphasis_46=0x2B4500 +serdes_preemphasis_47=0x2B4500 +serdes_preemphasis_48=0x2B4500 +serdes_preemphasis_49=0x2B4500 + +serdes_preemphasis_50=0x2B4500 +serdes_preemphasis_51=0x2B4500 +serdes_preemphasis_52=0x2B4500 +serdes_preemphasis_53=0x2B4500 + +serdes_preemphasis_54=0x284800 +serdes_preemphasis_55=0x284800 +serdes_preemphasis_56=0x284800 +serdes_preemphasis_57=0x284800 + +serdes_preemphasis_58=0x2B4500 +serdes_preemphasis_59=0x2B4500 +serdes_preemphasis_60=0x2B4500 +serdes_preemphasis_61=0x2B4500 + +serdes_preemphasis_62=0x2B4500 +serdes_preemphasis_63=0x2B4500 +serdes_preemphasis_64=0x2B4500 +serdes_preemphasis_65=0x2B4500 + +serdes_preemphasis_68=0x284800 +serdes_preemphasis_69=0x284800 +serdes_preemphasis_70=0x284800 +serdes_preemphasis_71=0x284800 + +serdes_preemphasis_72=0x284800 +serdes_preemphasis_73=0x284800 +serdes_preemphasis_74=0x284800 +serdes_preemphasis_75=0x284800 + +serdes_preemphasis_76=0x284800 +serdes_preemphasis_77=0x284800 +serdes_preemphasis_78=0x284800 +serdes_preemphasis_79=0x284800 + +serdes_preemphasis_80=0x2A4600 +serdes_preemphasis_81=0x2A4600 +serdes_preemphasis_82=0x2A4600 +serdes_preemphasis_83=0x2A4600 + +serdes_preemphasis_84=0x2B4500 +serdes_preemphasis_85=0x2B4500 +serdes_preemphasis_86=0x2B4500 +serdes_preemphasis_87=0x2B4500 + +serdes_preemphasis_88=0x2A4600 +serdes_preemphasis_89=0x2A4600 +serdes_preemphasis_90=0x2A4600 +serdes_preemphasis_91=0x2A4600 + +serdes_preemphasis_92=0x2B4500 +serdes_preemphasis_93=0x2B4500 +serdes_preemphasis_94=0x2B4500 +serdes_preemphasis_95=0x2B4500 + +serdes_preemphasis_96=0x2B4500 +serdes_preemphasis_97=0x2B4500 +serdes_preemphasis_98=0x2B4500 +serdes_preemphasis_99=0x2B4500 + +serdes_preemphasis_102=0x2B4500 +serdes_preemphasis_103=0x2B4500 +serdes_preemphasis_104=0x2B4500 +serdes_preemphasis_105=0x2B4500 + +serdes_preemphasis_106=0x2B4500 +serdes_preemphasis_107=0x2B4500 +serdes_preemphasis_108=0x2B4500 +serdes_preemphasis_109=0x2B4500 + +serdes_preemphasis_110=0x2D4300 +serdes_preemphasis_111=0x2D4300 +serdes_preemphasis_112=0x2D4300 +serdes_preemphasis_113=0x2D4300 + +serdes_preemphasis_114=0x304000 +serdes_preemphasis_115=0x304000 +serdes_preemphasis_116=0x304000 +serdes_preemphasis_117=0x304000 + +serdes_preemphasis_118=0x304000 +serdes_preemphasis_119=0x304000 +serdes_preemphasis_120=0x304000 +serdes_preemphasis_121=0x304000 + +serdes_preemphasis_122=0x304000 +serdes_preemphasis_123=0x304000 +serdes_preemphasis_124=0x304000 +serdes_preemphasis_125=0x304000 + +serdes_preemphasis_126=0x343C00 +serdes_preemphasis_127=0x343C00 +serdes_preemphasis_128=0x343C00 +serdes_preemphasis_129=0x343C00 + +serdes_preemphasis_130=0x343C00 +serdes_preemphasis_131=0x343C00 +serdes_preemphasis_132=0x343C00 +serdes_preemphasis_133=0x343C00 diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/th-d7032q28b-32x40g.config.bcm b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/th-d7032q28b-32x40g.config.bcm new file mode 100644 index 000000000000..03d0bb06cb06 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/th-d7032q28b-32x40g.config.bcm @@ -0,0 +1,427 @@ +# Redwood BCM Shell config / all 100G 32 ports + +# Define default OS / SAL +os=unix + +l2_mem_entries=8192 +l3_mem_entries=8192 +l3_alpm_enable=2 +#ipv6_lpm_128b_enable=1 +l2xmsg_mode=1 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 +# per Broadcom feedback, no more pbmp_oversubscribe +# pbmp_oversubscribe=0x00003fc000000ff0000003fc000001fe +oversubscribe_mode=1 +pbmp_xport_xe=0x3fd000000ff4000003fc000001fe + +# EagleCore ports +portmap_66=129:10 +portmap_100=131:10 + +# Loopback ports +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 + +portmap_68=65:40 +portmap_69=69:40 +portmap_70=73:40 +portmap_71=77:40 +portmap_72=81:40 +portmap_73=85:40 +portmap_74=89:40 +portmap_75=93:40 + +portmap_102=97:40 +portmap_103=101:40 +portmap_104=105:40 +portmap_105=109:40 +portmap_106=113:40 +portmap_107=117:40 +portmap_108=121:40 +portmap_109=125:40 + +portmap_1=1:40 +portmap_2=5:40 +portmap_3=9:40 +portmap_4=13:40 +portmap_5=17:40 +portmap_6=21:40 +portmap_7=25:40 +portmap_8=29:40 + +portmap_34=33:40 +portmap_35=37:40 +portmap_36=41:40 +portmap_37=45:40 +portmap_38=49:40 +portmap_39=53:40 +portmap_40=57:40 +portmap_41=61:40 + +phy_xaui_tx_polarity_flip_xe0=0x8 +phy_xaui_tx_polarity_flip_xe1=0x6 +phy_xaui_tx_polarity_flip_xe2=0x6 +phy_xaui_tx_polarity_flip_xe3=0x6 +phy_xaui_tx_polarity_flip_xe4=0x3 +phy_xaui_tx_polarity_flip_xe5=0x4 +phy_xaui_tx_polarity_flip_xe6=0xc +phy_xaui_tx_polarity_flip_xe7=0x6 +phy_xaui_tx_polarity_flip_xe8=0xc +phy_xaui_tx_polarity_flip_xe9=0x3 +phy_xaui_tx_polarity_flip_xe10=0x3 +phy_xaui_tx_polarity_flip_xe11=0x3 +phy_xaui_tx_polarity_flip_xe12=0x4 +phy_xaui_tx_polarity_flip_xe13=0x1 +phy_xaui_tx_polarity_flip_xe14=0x2 +phy_xaui_tx_polarity_flip_xe15=0x3 +phy_xaui_tx_polarity_flip_xe16=0x2 +phy_xaui_tx_polarity_flip_xe17=0x3 +phy_xaui_tx_polarity_flip_xe18=0x2 +phy_xaui_tx_polarity_flip_xe19=0x8 +phy_xaui_tx_polarity_flip_xe20=0x2 +phy_xaui_tx_polarity_flip_xe21=0x9 +phy_xaui_tx_polarity_flip_xe22=0x8 +phy_xaui_tx_polarity_flip_xe23=0x9 +phy_xaui_tx_polarity_flip_xe24=0x2 +phy_xaui_tx_polarity_flip_xe25=0x4 +phy_xaui_tx_polarity_flip_xe26=0xd +phy_xaui_tx_polarity_flip_xe27=0xc +phy_xaui_tx_polarity_flip_xe28=0x3 +phy_xaui_tx_polarity_flip_xe29=0xc +phy_xaui_tx_polarity_flip_xe30=0xc +phy_xaui_tx_polarity_flip_xe31=0x2 + +phy_xaui_rx_polarity_flip_xe0=0xb +phy_xaui_rx_polarity_flip_xe1=0xc +phy_xaui_rx_polarity_flip_xe2=0xc +phy_xaui_rx_polarity_flip_xe3=0xc +phy_xaui_rx_polarity_flip_xe4=0x1 +phy_xaui_rx_polarity_flip_xe5=0xc +phy_xaui_rx_polarity_flip_xe6=0x4 +phy_xaui_rx_polarity_flip_xe7=0xc +phy_xaui_rx_polarity_flip_xe8=0xb +phy_xaui_rx_polarity_flip_xe9=0x6 +phy_xaui_rx_polarity_flip_xe10=0x1 +phy_xaui_rx_polarity_flip_xe11=0x8 +phy_xaui_rx_polarity_flip_xe12=0xc +phy_xaui_rx_polarity_flip_xe13=0x6 +phy_xaui_rx_polarity_flip_xe14=0x4 +phy_xaui_rx_polarity_flip_xe15=0xe +phy_xaui_rx_polarity_flip_xe16=0xe +phy_xaui_rx_polarity_flip_xe17=0x2 +phy_xaui_rx_polarity_flip_xe18=0x4 +phy_xaui_rx_polarity_flip_xe19=0x6 +phy_xaui_rx_polarity_flip_xe20=0xe +phy_xaui_rx_polarity_flip_xe21=0x3 +phy_xaui_rx_polarity_flip_xe22=0x3 +phy_xaui_rx_polarity_flip_xe23=0x3 +phy_xaui_rx_polarity_flip_xe24=0xb +phy_xaui_rx_polarity_flip_xe25=0xc +phy_xaui_rx_polarity_flip_xe26=0xe +phy_xaui_rx_polarity_flip_xe27=0xc +phy_xaui_rx_polarity_flip_xe28=0xb +phy_xaui_rx_polarity_flip_xe29=0x9 +phy_xaui_rx_polarity_flip_xe30=0x6 +phy_xaui_rx_polarity_flip_xe31=0x9 + +# EQ/iDriver +# 0 ~ 5 +serdes_preemphasis_1=0x1E5200 +serdes_preemphasis_2=0x1E5200 +serdes_preemphasis_3=0x1E5200 +serdes_preemphasis_4=0x1E5200 +serdes_driver_current_1=0x000001 +serdes_driver_current_2=0x000001 +serdes_driver_current_3=0x000001 +serdes_driver_current_4=0x000001 + +serdes_preemphasis_5=0x1E5200 +serdes_preemphasis_6=0x1E5200 +serdes_preemphasis_7=0x1E5200 +serdes_preemphasis_8=0x1E5200 +serdes_driver_current_5=0x000001 +serdes_driver_current_6=0x000001 +serdes_driver_current_7=0x000001 +serdes_driver_current_8=0x000001 + +serdes_preemphasis_9=0x1E5200 +serdes_preemphasis_10=0x1E5200 +serdes_preemphasis_11=0x1E5200 +serdes_preemphasis_12=0x1E5200 +serdes_driver_current_9=0x000001 +serdes_driver_current_10=0x000001 +serdes_driver_current_11=0x000001 +serdes_driver_current_12=0x000001 + +serdes_preemphasis_13=0x1E5200 +serdes_preemphasis_14=0x1E5200 +serdes_preemphasis_15=0x1E5200 +serdes_preemphasis_16=0x1E5200 +serdes_driver_current_13=0x000001 +serdes_driver_current_14=0x000001 +serdes_driver_current_15=0x000001 +serdes_driver_current_16=0x000001 + +serdes_preemphasis_17=0x1E5200 +serdes_preemphasis_18=0x1E5200 +serdes_preemphasis_19=0x1E5200 +serdes_preemphasis_20=0x1E5200 +serdes_driver_current_17=0x000001 +serdes_driver_current_18=0x000001 +serdes_driver_current_19=0x000001 +serdes_driver_current_20=0x000001 + +serdes_preemphasis_21=0x1E5200 +serdes_preemphasis_22=0x1E5200 +serdes_preemphasis_23=0x1E5200 +serdes_preemphasis_24=0x1E5200 +serdes_driver_current_21=0x000001 +serdes_driver_current_22=0x000001 +serdes_driver_current_23=0x000001 +serdes_driver_current_24=0x000001 + +# 6 ~ 11 +serdes_preemphasis_25=0x1A5600 +serdes_preemphasis_26=0x1A5600 +serdes_preemphasis_27=0x1A5600 +serdes_preemphasis_28=0x1A5600 +serdes_driver_current_25=0x000001 +serdes_driver_current_26=0x000001 +serdes_driver_current_27=0x000001 +serdes_driver_current_28=0x000001 + +serdes_preemphasis_29=0x1A5600 +serdes_preemphasis_30=0x1A5600 +serdes_preemphasis_31=0x1A5600 +serdes_preemphasis_32=0x1A5600 +serdes_driver_current_29=0x000001 +serdes_driver_current_30=0x000001 +serdes_driver_current_31=0x000001 +serdes_driver_current_32=0x000001 + +serdes_preemphasis_34=0x1A5600 +serdes_preemphasis_35=0x1A5600 +serdes_preemphasis_36=0x1A5600 +serdes_preemphasis_37=0x1A5600 +serdes_driver_current_34=0x000001 +serdes_driver_current_35=0x000001 +serdes_driver_current_36=0x000001 +serdes_driver_current_37=0x000001 + +serdes_preemphasis_38=0x1A5600 +serdes_preemphasis_39=0x1A5600 +serdes_preemphasis_40=0x1A5600 +serdes_preemphasis_41=0x1A5600 +serdes_driver_current_38=0x000001 +serdes_driver_current_39=0x000001 +serdes_driver_current_40=0x000001 +serdes_driver_current_41=0x000001 + +serdes_preemphasis_42=0x1A5600 +serdes_preemphasis_43=0x1A5600 +serdes_preemphasis_44=0x1A5600 +serdes_preemphasis_45=0x1A5600 +serdes_driver_current_42=0x000001 +serdes_driver_current_43=0x000001 +serdes_driver_current_44=0x000001 +serdes_driver_current_45=0x000001 + +serdes_preemphasis_46=0x1A5600 +serdes_preemphasis_47=0x1A5600 +serdes_preemphasis_48=0x1A5600 +serdes_preemphasis_49=0x1A5600 +serdes_driver_current_46=0x000001 +serdes_driver_current_47=0x000001 +serdes_driver_current_48=0x000001 +serdes_driver_current_49=0x000001 + +# 12 ~ 13 +serdes_preemphasis_50=0x165A00 +serdes_preemphasis_51=0x165A00 +serdes_preemphasis_52=0x165A00 +serdes_preemphasis_53=0x165A00 +serdes_driver_current_50=0x000000 +serdes_driver_current_51=0x000000 +serdes_driver_current_52=0x000000 +serdes_driver_current_53=0x000000 + +serdes_preemphasis_54=0x165A00 +serdes_preemphasis_55=0x165A00 +serdes_preemphasis_56=0x165A00 +serdes_preemphasis_57=0x165A00 +serdes_driver_current_54=0x000000 +serdes_driver_current_55=0x000000 +serdes_driver_current_56=0x000000 +serdes_driver_current_57=0x000000 + +# 14 ~ 16 +serdes_preemphasis_58=0x125E00 +serdes_preemphasis_59=0x125E00 +serdes_preemphasis_60=0x125E00 +serdes_preemphasis_61=0x125E00 +serdes_driver_current_58=0x000100 +serdes_driver_current_59=0x000100 +serdes_driver_current_60=0x000100 +serdes_driver_current_61=0x000100 + +serdes_preemphasis_62=0x125E00 +serdes_preemphasis_63=0x125E00 +serdes_preemphasis_64=0x125E00 +serdes_preemphasis_65=0x125E00 +serdes_driver_current_62=0x000100 +serdes_driver_current_63=0x000100 +serdes_driver_current_64=0x000100 +serdes_driver_current_65=0x000100 + +serdes_preemphasis_68=0x125E00 +serdes_preemphasis_69=0x125E00 +serdes_preemphasis_70=0x125E00 +serdes_preemphasis_71=0x125E00 +serdes_driver_current_68=0x000100 +serdes_driver_current_69=0x000100 +serdes_driver_current_70=0x000100 +serdes_driver_current_71=0x000100 + +# 17 ~ 21 +serdes_preemphasis_72=0x106000 +serdes_preemphasis_73=0x106000 +serdes_preemphasis_74=0x106000 +serdes_preemphasis_75=0x106000 +serdes_driver_current_72=0x000100 +serdes_driver_current_73=0x000100 +serdes_driver_current_74=0x000100 +serdes_driver_current_75=0x000100 + +serdes_preemphasis_76=0x106000 +serdes_preemphasis_77=0x106000 +serdes_preemphasis_78=0x106000 +serdes_preemphasis_79=0x106000 +serdes_driver_current_76=0x000100 +serdes_driver_current_77=0x000100 +serdes_driver_current_78=0x000100 +serdes_driver_current_79=0x000100 + +serdes_preemphasis_80=0x106000 +serdes_preemphasis_81=0x106000 +serdes_preemphasis_82=0x106000 +serdes_preemphasis_83=0x106000 +serdes_driver_current_80=0x000100 +serdes_driver_current_81=0x000100 +serdes_driver_current_82=0x000100 +serdes_driver_current_83=0x000100 + +serdes_preemphasis_84=0x106000 +serdes_preemphasis_85=0x106000 +serdes_preemphasis_86=0x106000 +serdes_preemphasis_87=0x106000 +serdes_driver_current_84=0x000100 +serdes_driver_current_85=0x000100 +serdes_driver_current_86=0x000100 +serdes_driver_current_87=0x000100 + +serdes_preemphasis_88=0x106000 +serdes_preemphasis_89=0x106000 +serdes_preemphasis_90=0x106000 +serdes_preemphasis_91=0x106000 +serdes_driver_current_88=0x000100 +serdes_driver_current_89=0x000100 +serdes_driver_current_90=0x000100 +serdes_driver_current_91=0x000100 + +# 22 ~ 23 +serdes_preemphasis_92=0x125E00 +serdes_preemphasis_93=0x125E00 +serdes_preemphasis_94=0x125E00 +serdes_preemphasis_95=0x125E00 +serdes_driver_current_92=0x000100 +serdes_driver_current_93=0x000100 +serdes_driver_current_94=0x000100 +serdes_driver_current_95=0x000100 + +serdes_preemphasis_96=0x125E00 +serdes_preemphasis_97=0x125E00 +serdes_preemphasis_98=0x125E00 +serdes_preemphasis_99=0x125E00 +serdes_driver_current_96=0x000100 +serdes_driver_current_97=0x000100 +serdes_driver_current_98=0x000100 +serdes_driver_current_99=0x000100 + +# 24 ~ 25 +serdes_preemphasis_102=0x165A00 +serdes_preemphasis_103=0x165A00 +serdes_preemphasis_104=0x165A00 +serdes_preemphasis_105=0x165A00 +serdes_driver_current_102=0x000000 +serdes_driver_current_103=0x000000 +serdes_driver_current_104=0x000000 +serdes_driver_current_105=0x000000 + +serdes_preemphasis_106=0x165A00 +serdes_preemphasis_107=0x165A00 +serdes_preemphasis_108=0x165A00 +serdes_preemphasis_109=0x165A00 +serdes_driver_current_106=0x000000 +serdes_driver_current_107=0x000000 +serdes_driver_current_108=0x000000 +serdes_driver_current_109=0x000000 + +# 26 ~ 29 +serdes_preemphasis_110=0x1A5600 +serdes_preemphasis_111=0x1A5600 +serdes_preemphasis_112=0x1A5600 +serdes_preemphasis_113=0x1A5600 +serdes_driver_current_110=0x000001 +serdes_driver_current_111=0x000001 +serdes_driver_current_112=0x000001 +serdes_driver_current_113=0x000001 + +serdes_preemphasis_114=0x1A5600 +serdes_preemphasis_115=0x1A5600 +serdes_preemphasis_116=0x1A5600 +serdes_preemphasis_117=0x1A5600 +serdes_driver_current_114=0x000001 +serdes_driver_current_115=0x000001 +serdes_driver_current_116=0x000001 +serdes_driver_current_117=0x000001 + +serdes_preemphasis_118=0x1A5600 +serdes_preemphasis_119=0x1A5600 +serdes_preemphasis_120=0x1A5600 +serdes_preemphasis_121=0x1A5600 +serdes_driver_current_118=0x000001 +serdes_driver_current_119=0x000001 +serdes_driver_current_120=0x000001 +serdes_driver_current_121=0x000001 + +serdes_preemphasis_122=0x1A5600 +serdes_preemphasis_123=0x1A5600 +serdes_preemphasis_124=0x1A5600 +serdes_preemphasis_125=0x1A5600 +serdes_driver_current_122=0x000001 +serdes_driver_current_123=0x000001 +serdes_driver_current_124=0x000001 +serdes_driver_current_125=0x000001 + +# 30 ~ 31 +serdes_preemphasis_126=0x1E5200 +serdes_preemphasis_127=0x1E5200 +serdes_preemphasis_128=0x1E5200 +serdes_preemphasis_129=0x1E5200 +serdes_driver_current_126=0x000001 +serdes_driver_current_127=0x000001 +serdes_driver_current_128=0x000001 +serdes_driver_current_129=0x000001 + +serdes_preemphasis_130=0x1E5200 +serdes_preemphasis_131=0x1E5200 +serdes_preemphasis_132=0x1E5200 +serdes_preemphasis_133=0x1E5200 +serdes_driver_current_130=0x000001 +serdes_driver_current_131=0x000001 +serdes_driver_current_132=0x000001 +serdes_driver_current_133=0x000001 diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/led_proc_init.soc b/device/inventec/x86_64-inventec_d7032q28b-r0/led_proc_init.soc new file mode 100644 index 000000000000..39ae1f247929 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/led_proc_init.soc @@ -0,0 +1,136 @@ +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=31 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=30 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=29 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=27 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=26 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=25 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=23 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=22 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=21 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=19 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=18 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=17 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=15 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=14 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=13 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=10 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=9 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=7 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=6 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=5 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=3 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=2 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=1 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=62 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=61 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=59 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=58 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=57 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=55 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=54 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=53 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=51 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=50 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=49 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=46 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=45 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=43 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=42 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=41 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=39 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=38 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=37 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=35 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=34 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=33 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=3 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=2 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=1 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=7 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=6 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=5 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=11 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=10 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=9 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=15 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=14 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=13 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=19 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=18 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=17 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=23 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=22 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=21 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=27 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=26 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=25 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=31 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=30 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=29 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=35 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=34 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=33 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=39 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=38 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=37 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=43 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=42 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=41 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=47 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=46 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=45 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=50 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=49 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=54 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=53 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=58 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=57 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=62 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=61 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=60 + +led 0 stop +led 0 prog 02 00 60 F1 12 00 DE F6 70 10 67 47 67 42 77 06 06 F2 60 F0 12 00 06 F0 4A 04 27 67 42 4A 03 27 67 42 4A 07 27 67 42 4A 00 27 67 42 DE F4 70 34 86 F0 77 16 12 00 DE F8 70 40 67 4A 67 42 77 36 3E F1 87 86 F1 81 57 17 27 57 07 27 57 00 00 00 +led 0 start + +led 1 stop +led 1 prog 02 00 60 F1 12 00 DE F6 70 10 67 47 67 42 77 06 06 F2 60 F0 12 00 06 F0 4A 04 27 67 42 4A 03 27 67 42 4A 07 27 67 42 4A 00 27 67 42 DE F4 70 34 86 F0 77 16 12 00 DE F8 70 40 67 4A 67 42 77 36 3E F1 87 86 F1 81 57 17 27 57 07 27 57 00 00 00 +led 1 start diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py index 645c76b9f0db..599c8dbd959c 100644 --- a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py @@ -16,6 +16,8 @@ class SfpUtil(SfpUtilBase): PORT_START = 0 PORT_END = 31 PORTS_IN_BLOCK = 32 + QSFP_PORT_START = 0 + QSFP_PORT_END = 31 _port_to_eeprom_mapping = {} port_to_i2c_mapping = { @@ -61,6 +63,14 @@ def port_start(self): def port_end(self): return self.PORT_END + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + @property def qsfp_ports(self): return range(0, self.PORTS_IN_BLOCK + 1) diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile index 7e019adbbb94..73cbea239694 100644 --- a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/sai.profile @@ -1,2 +1,2 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-d7054q28b-48x25g-6x100g.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-d7054q28b-48x25g-6x100g.config.bcm SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/th-d7054q28b-48x10g-6x100g.config.bcm b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/th-d7054q28b-48x10g-6x100g.config.bcm new file mode 100644 index 000000000000..b90ba92a97bc --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/th-d7054q28b-48x10g-6x100g.config.bcm @@ -0,0 +1,465 @@ +# Cypress BCM Shell config / 10G * 48 ports; 100G * 6 ports + +# Define default OS / SAL +os=unix + +l2_mem_entries=40960 +l3_mem_entries=40960 +fpem_mem_entries=32768 +l2xmsg_mode=1 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 + +## update the hex string based on case ID: 925941 +## 1. type "phy info" then get each hg ports' number +## 2. Set these number as 1 in pbmp_xport_xe and pbmp_oversubscribe +## 130 xe ports, 4 * 32 + 2 +## no more pbmp_oversubscribe +oversubscribe_mode=1 +pbmp_xport_xe=0x3fffffffdffffffff7fffffffdfffffffe + + +# EagleCore ports: 36 & 49 +portmap_66=129:10 +portmap_100=131:10 + +# Loopback ports +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 + +# First 12*4 48 ports config for 10G +# Second 6 ports config for 100G +# For Tomahawk FalconCore: +# Physical ports in FalconCore[0 - 7] must map to logical port[1 - 32] at any order +# Physical ports in FalconCore[8 - 15] must map to logical port[34 - 65] at any order +# Physical ports in FalconCore[16 - 23] must map to logical port[68 - 99] at any order +# Physical ports in FalconCore[24 - 31] must map to logical port[102 - 133] at any order + +## FalconCore[0,1,2,5] +portmap_1=2:10 +portmap_2=1:10 +portmap_3=4:10 +portmap_4=3:10 +portmap_5=6:10 +portmap_6=5:10 +portmap_7=8:10 +portmap_8=7:10 +portmap_9=10:10 +portmap_10=9:10 +portmap_11=12:10 +portmap_12=11:10 +# FC-05 +portmap_13=22:10 +portmap_14=21:10 +portmap_15=24:10 +portmap_16=23:10 + +## FalconCore[8, 9, 10, 12, 13] +portmap_34=34:10 +portmap_35=33:10 +portmap_36=36:10 +portmap_37=35:10 +portmap_38=38:10 +portmap_39=37:10 +portmap_40=40:10 +portmap_41=39:10 +portmap_42=42:10 +portmap_43=41:10 +portmap_44=44:10 +portmap_45=43:10 +# FC-12 & FC-13 +portmap_46=50:10 +portmap_47=49:10 +portmap_48=52:10 +portmap_49=51:10 +portmap_50=54:10 +portmap_51=53:10 +portmap_52=56:10 +portmap_53=55:10 + +## FalconCore[16, 17, 20] +portmap_68=66:10 +portmap_69=65:10 +portmap_70=68:10 +portmap_71=67:10 +portmap_72=70:10 +portmap_73=69:10 +portmap_74=72:10 +portmap_75=71:10 +# FC-20 +portmap_76=82:10 +portmap_77=81:10 +portmap_78=84:10 +portmap_79=83:10 + +# FC-21 (100G) +portmap_80=85:100 + +## FalconCore[24, 25, 26, 27, 29] (100G) +portmap_102=97:100 +portmap_103=105:100 +portmap_104=101:100 +portmap_105=117:100 +portmap_107=109:100 + + + +# FalconCore[0,1,2,5] ports TX polarity flip for 25G +# no polarity reversal + +# FalconCore[8, 9, 10, 12, 13] ports TX polarity flip for 25G +# For Baidu xe20 & xe22; for GA xe21 & xe23 +phy_xaui_tx_polarity_flip_xe20=1 +phy_xaui_tx_polarity_flip_xe22=1 + +# FalconCore[16, 17, 20] ports TX polarity flip for 25G +# no polarity reversal + +# FC-21 for 100G + +# FalconCore[24, 25, 26, 27, 29] ports TX polarity flip for 100G +phy_xaui_tx_polarity_flip_ce1=0xf +phy_xaui_tx_polarity_flip_ce2=0xf + + +# FalconCore[0,1,2,5] ports RX polarity flip for 25G +# no polarity reversal + +# FalconCore[8, 9, 10, 12, 13] ports RX polarity flip for 25G +# no polarity reversal + +# FalconCore[16, 17, 20] ports RX polarity flip for 25G +# no polarity reversal + +# FC-21 for 100G + +# FalconCore[24, 25, 26, 27, 29] ports RX polarity flip for 100G +phy_xaui_rx_polarity_flip_ce2=0xf + + +## Lane swapping +## The HEX value is connection of red line within Falconcore in "Fig 3-4 SFP28 port connection" +# TX - Config A. (FC 0/1/2/16) +# 0x3210 - port 0-11, 36-39 +xgxs_tx_lane_map_xe0=0x3210 +xgxs_tx_lane_map_xe1=0x3210 +xgxs_tx_lane_map_xe2=0x3210 +xgxs_tx_lane_map_xe3=0x3210 +xgxs_tx_lane_map_xe4=0x3210 +xgxs_tx_lane_map_xe5=0x3210 +xgxs_tx_lane_map_xe6=0x3210 +xgxs_tx_lane_map_xe7=0x3210 +xgxs_tx_lane_map_xe8=0x3210 +xgxs_tx_lane_map_xe9=0x3210 +xgxs_tx_lane_map_xe10=0x3210 +xgxs_tx_lane_map_xe11=0x3210 +xgxs_tx_lane_map_xe37=0x3210 +xgxs_tx_lane_map_xe38=0x3210 +xgxs_tx_lane_map_xe39=0x3210 +xgxs_tx_lane_map_xe40=0x3210 + + +# TX - Config B. (FC 5/9/20) +# 0x0123 - port 12-13, 20-23, 44-47 +xgxs_tx_lane_map_xe12=0x0123 +xgxs_tx_lane_map_xe13=0x0123 +xgxs_tx_lane_map_xe14=0x0123 +xgxs_tx_lane_map_xe15=0x0123 +xgxs_tx_lane_map_xe20=0x0123 +xgxs_tx_lane_map_xe21=0x0123 +xgxs_tx_lane_map_xe22=0x0123 +xgxs_tx_lane_map_xe23=0x0123 +xgxs_tx_lane_map_xe45=0x0123 +xgxs_tx_lane_map_xe46=0x0123 +xgxs_tx_lane_map_xe47=0x0123 +xgxs_tx_lane_map_xe48=0x0123 + + +# TX - Config C. (FC 8/10) +# 0x3210 - port 16-19, 24-27 +xgxs_tx_lane_map_xe16=0x3210 +xgxs_tx_lane_map_xe17=0x3210 +xgxs_tx_lane_map_xe18=0x3210 +xgxs_tx_lane_map_xe19=0x3210 +xgxs_tx_lane_map_xe24=0x3210 +xgxs_tx_lane_map_xe25=0x3210 +xgxs_tx_lane_map_xe26=0x3210 +xgxs_tx_lane_map_xe27=0x3210 + + +# TX - Config D. (FC 12/13/17) +# 0x0123 - port 28-35, 40-43 +xgxs_tx_lane_map_xe28=0x0123 +xgxs_tx_lane_map_xe29=0x0123 +xgxs_tx_lane_map_xe30=0x0123 +xgxs_tx_lane_map_xe31=0x0123 +xgxs_tx_lane_map_xe32=0x0123 +xgxs_tx_lane_map_xe33=0x0123 +xgxs_tx_lane_map_xe34=0x0123 +xgxs_tx_lane_map_xe35=0x0123 +xgxs_tx_lane_map_xe41=0x0123 +xgxs_tx_lane_map_xe42=0x0123 +xgxs_tx_lane_map_xe43=0x0123 +xgxs_tx_lane_map_xe44=0x0123 + + + + +# RX - Config A. (FC 0/1/2/16) +# 0x1032 - port 0-11, 36-39 +xgxs_rx_lane_map_xe0=0x1032 +xgxs_rx_lane_map_xe1=0x1032 +xgxs_rx_lane_map_xe2=0x1032 +xgxs_rx_lane_map_xe3=0x1032 +xgxs_rx_lane_map_xe4=0x1032 +xgxs_rx_lane_map_xe5=0x1032 +xgxs_rx_lane_map_xe6=0x1032 +xgxs_rx_lane_map_xe7=0x1032 +xgxs_rx_lane_map_xe8=0x1032 +xgxs_rx_lane_map_xe9=0x1032 +xgxs_rx_lane_map_xe10=0x1032 +xgxs_rx_lane_map_xe11=0x1032 +xgxs_rx_lane_map_xe37=0x1032 +xgxs_rx_lane_map_xe38=0x1032 +xgxs_rx_lane_map_xe39=0x1032 +xgxs_rx_lane_map_xe40=0x1032 + + + +# RX - Config B. (FC 5/9/20) +# 0x1032 - port 12-13, 20-23, 44-47 +xgxs_rx_lane_map_xe12=0x1032 +xgxs_rx_lane_map_xe13=0x1032 +xgxs_rx_lane_map_xe14=0x1032 +xgxs_rx_lane_map_xe15=0x1032 +xgxs_rx_lane_map_xe20=0x1032 +xgxs_rx_lane_map_xe21=0x1032 +xgxs_rx_lane_map_xe22=0x1032 +xgxs_rx_lane_map_xe23=0x1032 +xgxs_rx_lane_map_xe45=0x1032 +xgxs_rx_lane_map_xe46=0x1032 +xgxs_rx_lane_map_xe47=0x1032 +xgxs_rx_lane_map_xe48=0x1032 + + +# RX - Config C. (FC 8/10) +# 0x3210 - port 16-19, 24-27 +xgxs_rx_lane_map_xe16=0x3210 +xgxs_rx_lane_map_xe17=0x3210 +xgxs_rx_lane_map_xe18=0x3210 +xgxs_rx_lane_map_xe19=0x3210 +xgxs_rx_lane_map_xe24=0x3210 +xgxs_rx_lane_map_xe25=0x3210 +xgxs_rx_lane_map_xe26=0x3210 +xgxs_rx_lane_map_xe27=0x3210 + + +# RX - Config D. (FC 12/13/17) +# 0x3210 - port 28-35, 40-43 +xgxs_rx_lane_map_xe28=0x3210 +xgxs_rx_lane_map_xe29=0x3210 +xgxs_rx_lane_map_xe30=0x3210 +xgxs_rx_lane_map_xe31=0x3210 +xgxs_rx_lane_map_xe32=0x3210 +xgxs_rx_lane_map_xe33=0x3210 +xgxs_rx_lane_map_xe34=0x3210 +xgxs_rx_lane_map_xe35=0x3210 +xgxs_rx_lane_map_xe41=0x3210 +xgxs_rx_lane_map_xe42=0x3210 +xgxs_rx_lane_map_xe43=0x3210 +xgxs_rx_lane_map_xe44=0x3210 + + +## Lane swapping for QSFP28 (100G) +## The HEX value is connection of red line within Falconcore in "Fig 3-4 SFP28 port connection" +# TX - Config A. (FC 21/25) +# 0x3210 - port ce0, ce3 +xgxs_tx_lane_map_ce0=0x3210 +xgxs_tx_lane_map_ce3=0x3210 + + +# TX - Config B. (FC 24) +# 0x3210 - port ce1 +xgxs_tx_lane_map_ce1=0x3210 + + +# TX - Config C. (FC 26) +# 0x3210 - port ce2 +xgxs_tx_lane_map_ce2=0x3210 + + +# TX - Config D. (FC 27) +# 0x3210 - ce5 +xgxs_tx_lane_map_ce5=0x3210 + + +# TX - Config E. (FC 29) +# 0x3210 - ce4 +xgxs_tx_lane_map_ce4=0x3210 + + +# RX - Config A. (FC 21/25) +# 0x1032 - port ce0, ce3 +xgxs_rx_lane_map_ce0=0x1032 +xgxs_rx_lane_map_ce3=0x1032 + + +# RX - Config B. (FC 24) +# 0x1032 - port ce1 +xgxs_rx_lane_map_ce1=0x1032 + + +# RX - Config C. (FC 26) +# 0x2301 - port ce2 +xgxs_rx_lane_map_ce2=0x2301 + + +# RX - Config D. (FC 27) +# 0x2301 - ce5 +xgxs_rx_lane_map_ce5=0x2301 + + +# TX - Config E. (FC 29) +# 0x3210 - ce4 +xgxs_rx_lane_map_ce4=0x3210 + +# EQ/iDriver + +# The 1st 16 ports, xe0-xe15 +serdes_preemphasis_1=0x1A5600 +serdes_preemphasis_2=0x1A5600 +serdes_preemphasis_3=0x1A5600 +serdes_preemphasis_4=0x1A5600 +serdes_preemphasis_5=0x1A5600 +serdes_preemphasis_6=0x1A5600 +serdes_preemphasis_7=0x185800 +serdes_preemphasis_8=0x1A5600 +serdes_preemphasis_9=0x185800 +serdes_preemphasis_10=0x185800 +serdes_preemphasis_11=0x165A00 +serdes_preemphasis_12=0x185800 +serdes_preemphasis_13=0x105F01 +serdes_preemphasis_14=0x165A00 +serdes_preemphasis_15=0x105F01 +serdes_preemphasis_16=0x105F01 + +serdes_driver_current_1=0x000001 +serdes_driver_current_2=0x000001 +serdes_driver_current_3=0x000001 +serdes_driver_current_4=0x000001 +serdes_driver_current_5=0x000001 +serdes_driver_current_6=0x000001 +serdes_driver_current_7=0x000001 +serdes_driver_current_8=0x000001 +serdes_driver_current_9=0x000000 +serdes_driver_current_10=0x000001 +serdes_driver_current_11=0x000000 +serdes_driver_current_12=0x000000 +serdes_driver_current_13=0x000000 +serdes_driver_current_14=0x000000 +serdes_driver_current_15=0x000000 +serdes_driver_current_16=0x000000 + +# The 2nd 20 ports, xe16-xe35 +serdes_preemphasis_34=0x105F01 +serdes_preemphasis_35=0x105F01 +serdes_preemphasis_36=0x0E6002 +serdes_preemphasis_37=0x0E6002 +serdes_preemphasis_38=0x0E6002 +serdes_preemphasis_39=0x0E6002 +serdes_preemphasis_40=0x125B03 +serdes_preemphasis_41=0x0E6002 +serdes_preemphasis_42=0x125B03 +serdes_preemphasis_43=0x125B03 +serdes_preemphasis_44=0x125B03 +serdes_preemphasis_45=0x125B03 +serdes_preemphasis_46=0x125B03 +serdes_preemphasis_47=0x125B03 +serdes_preemphasis_48=0x125B03 +serdes_preemphasis_49=0x125B03 +serdes_preemphasis_50=0x125B03 +serdes_preemphasis_51=0x125B03 +serdes_preemphasis_52=0x125B03 +serdes_preemphasis_53=0x125B03 + +serdes_driver_current_34=0x000000 +serdes_driver_current_35=0x000000 +serdes_driver_current_36=0x000000 +serdes_driver_current_37=0x000000 +serdes_driver_current_38=0x000000 +serdes_driver_current_39=0x000000 +serdes_driver_current_40=0x000000 +serdes_driver_current_41=0x000000 +serdes_driver_current_42=0x000000 +serdes_driver_current_43=0x000000 +serdes_driver_current_44=0x000000 +serdes_driver_current_45=0x000000 +serdes_driver_current_46=0x000000 +serdes_driver_current_47=0x000000 +serdes_driver_current_48=0x000000 +serdes_driver_current_49=0x000000 +serdes_driver_current_50=0x000000 +serdes_driver_current_51=0x000000 +serdes_driver_current_52=0x000000 +serdes_driver_current_53=0x000000 + +# The 3rd 12 ports, xe36-xe47 +serdes_preemphasis_68=0x125B03 +serdes_preemphasis_69=0x125B03 +serdes_preemphasis_70=0x125B03 +serdes_preemphasis_71=0x125B03 +serdes_preemphasis_72=0x125B03 +serdes_preemphasis_73=0x125B03 +serdes_preemphasis_74=0x125B03 +serdes_preemphasis_75=0x125B03 +serdes_preemphasis_76=0x105F01 +serdes_preemphasis_77=0x105F01 +serdes_preemphasis_78=0x105F01 +serdes_preemphasis_79=0x105F01 + +serdes_driver_current_68=0x000000 +serdes_driver_current_69=0x000000 +serdes_driver_current_70=0x000000 +serdes_driver_current_71=0x000000 +serdes_driver_current_72=0x000000 +serdes_driver_current_73=0x000000 +serdes_driver_current_74=0x000000 +serdes_driver_current_75=0x000000 +serdes_driver_current_76=0x000000 +serdes_driver_current_77=0x000000 +serdes_driver_current_78=0x000000 +serdes_driver_current_79=0x000000 + +# 6 x 100G ports, expandable to 24 x 25G ports +serdes_preemphasis_80=0x2D4300 +serdes_preemphasis_81=0x2D4300 +serdes_preemphasis_82=0x2D4300 +serdes_preemphasis_83=0x2D4300 + +serdes_preemphasis_102=0x304000 +serdes_preemphasis_103=0x304000 +serdes_preemphasis_104=0x304000 +serdes_preemphasis_105=0x304000 + +serdes_preemphasis_106=0x304000 +serdes_preemphasis_107=0x304000 +serdes_preemphasis_108=0x304000 +serdes_preemphasis_109=0x304000 + +serdes_preemphasis_110=0x304000 +serdes_preemphasis_111=0x304000 +serdes_preemphasis_112=0x304000 +serdes_preemphasis_113=0x304000 + +serdes_preemphasis_114=0x2E360C +serdes_preemphasis_115=0x2E360C +serdes_preemphasis_116=0x2E360C +serdes_preemphasis_117=0x2E360C + +serdes_preemphasis_118=0x2E360C +serdes_preemphasis_119=0x2E360C +serdes_preemphasis_120=0x2E360C +serdes_preemphasis_121=0x2E360C diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/th-d7054q28b-48x25g-6x100g.config.bcm b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/th-d7054q28b-48x25g-6x100g.config.bcm new file mode 100644 index 000000000000..ff09305ccbff --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/th-d7054q28b-48x25g-6x100g.config.bcm @@ -0,0 +1,414 @@ +# Cypress BCM Shell config / 25G * 48 ports; 100G * 6 ports + +# Define default OS / SAL +os=unix + +l2_mem_entries=40960 +l3_mem_entries=40960 +fpem_mem_entries=32768 +l2xmsg_mode=1 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 + +## update the hex string based on case ID: 925941 +## 1. type "phy info" then get each hg ports' number +## 2. Set these number as 1 in pbmp_xport_xe and pbmp_oversubscribe +## 130 xe ports, 4 * 32 + 2 +## no more pbmp_oversubscribe +oversubscribe_mode=1 +pbmp_xport_xe=0x3fffffffdffffffff7fffffffdfffffffe + + +# EagleCore ports: 36 & 49 +portmap_66=129:10 +portmap_100=131:10 + +# Loopback ports +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 + +# First 12*4 48 ports config for 25G +# Second 6 ports config for 100G +# For Tomahawk FalconCore: +# Physical ports in FalconCore[0 - 7] must map to logical port[1 - 32] at any order +# Physical ports in FalconCore[8 - 15] must map to logical port[34 - 65] at any order +# Physical ports in FalconCore[16 - 23] must map to logical port[68 - 99] at any order +# Physical ports in FalconCore[24 - 31] must map to logical port[102 - 133] at any order + +## FalconCore[0,1,2,5] +portmap_1=2:25 +portmap_2=1:25 +portmap_3=4:25 +portmap_4=3:25 +portmap_5=6:25 +portmap_6=5:25 +portmap_7=8:25 +portmap_8=7:25 +portmap_9=10:25 +portmap_10=9:25 +portmap_11=12:25 +portmap_12=11:25 +# FC-05 +portmap_13=22:25 +portmap_14=21:25 +portmap_15=24:25 +portmap_16=23:25 + +## FalconCore[8, 9, 10, 12, 13] +portmap_34=34:25 +portmap_35=33:25 +portmap_36=36:25 +portmap_37=35:25 +portmap_38=38:25 +portmap_39=37:25 +portmap_40=40:25 +portmap_41=39:25 +portmap_42=42:25 +portmap_43=41:25 +portmap_44=44:25 +portmap_45=43:25 +# FC-12 & FC-13 +portmap_46=50:25 +portmap_47=49:25 +portmap_48=52:25 +portmap_49=51:25 +portmap_50=54:25 +portmap_51=53:25 +portmap_52=56:25 +portmap_53=55:25 + +## FalconCore[16, 17, 20] +portmap_68=66:25 +portmap_69=65:25 +portmap_70=68:25 +portmap_71=67:25 +portmap_72=70:25 +portmap_73=69:25 +portmap_74=72:25 +portmap_75=71:25 +# FC-20 +portmap_76=82:25 +portmap_77=81:25 +portmap_78=84:25 +portmap_79=83:25 + +# FC-21 (100G) +portmap_80=85:100 + +## FalconCore[24, 25, 26, 27, 29] (100G) +portmap_102=97:100 +portmap_103=105:100 +portmap_104=101:100 +portmap_105=117:100 +portmap_107=109:100 + + + +# FalconCore[0,1,2,5] ports TX polarity flip for 25G +# no polarity reversal + +# FalconCore[8, 9, 10, 12, 13] ports TX polarity flip for 25G +# For Baidu xe20 & xe22; for GA xe21 & xe23 +phy_xaui_tx_polarity_flip_xe20=1 +phy_xaui_tx_polarity_flip_xe22=1 + +# FalconCore[16, 17, 20] ports TX polarity flip for 25G +# no polarity reversal + +# FC-21 for 100G + +# FalconCore[24, 25, 26, 27, 29] ports TX polarity flip for 100G +phy_xaui_tx_polarity_flip_ce1=0xf +phy_xaui_tx_polarity_flip_ce2=0xf + + +# FalconCore[0,1,2,5] ports RX polarity flip for 25G +# no polarity reversal + +# FalconCore[8, 9, 10, 12, 13] ports RX polarity flip for 25G +# no polarity reversal + +# FalconCore[16, 17, 20] ports RX polarity flip for 25G +# no polarity reversal + +# FC-21 for 100G + +# FalconCore[24, 25, 26, 27, 29] ports RX polarity flip for 100G +phy_xaui_rx_polarity_flip_ce2=0xf + + +## Lane swapping +## The HEX value is connection of red line within Falconcore in "Fig 3-4 SFP28 port connection" +# TX - Config A. (FC 0/1/2/16) +# 0x3210 - port 0-11, 36-39 +xgxs_tx_lane_map_xe0=0x3210 +xgxs_tx_lane_map_xe1=0x3210 +xgxs_tx_lane_map_xe2=0x3210 +xgxs_tx_lane_map_xe3=0x3210 +xgxs_tx_lane_map_xe4=0x3210 +xgxs_tx_lane_map_xe5=0x3210 +xgxs_tx_lane_map_xe6=0x3210 +xgxs_tx_lane_map_xe7=0x3210 +xgxs_tx_lane_map_xe8=0x3210 +xgxs_tx_lane_map_xe9=0x3210 +xgxs_tx_lane_map_xe10=0x3210 +xgxs_tx_lane_map_xe11=0x3210 +xgxs_tx_lane_map_xe37=0x3210 +xgxs_tx_lane_map_xe38=0x3210 +xgxs_tx_lane_map_xe39=0x3210 +xgxs_tx_lane_map_xe40=0x3210 + + +# TX - Config B. (FC 5/9/20) +# 0x0123 - port 12-13, 20-23, 44-47 +xgxs_tx_lane_map_xe12=0x0123 +xgxs_tx_lane_map_xe13=0x0123 +xgxs_tx_lane_map_xe14=0x0123 +xgxs_tx_lane_map_xe15=0x0123 +xgxs_tx_lane_map_xe20=0x0123 +xgxs_tx_lane_map_xe21=0x0123 +xgxs_tx_lane_map_xe22=0x0123 +xgxs_tx_lane_map_xe23=0x0123 +xgxs_tx_lane_map_xe45=0x0123 +xgxs_tx_lane_map_xe46=0x0123 +xgxs_tx_lane_map_xe47=0x0123 +xgxs_tx_lane_map_xe48=0x0123 + + +# TX - Config C. (FC 8/10) +# 0x3210 - port 16-19, 24-27 +xgxs_tx_lane_map_xe16=0x3210 +xgxs_tx_lane_map_xe17=0x3210 +xgxs_tx_lane_map_xe18=0x3210 +xgxs_tx_lane_map_xe19=0x3210 +xgxs_tx_lane_map_xe24=0x3210 +xgxs_tx_lane_map_xe25=0x3210 +xgxs_tx_lane_map_xe26=0x3210 +xgxs_tx_lane_map_xe27=0x3210 + + +# TX - Config D. (FC 12/13/17) +# 0x0123 - port 28-35, 40-43 +xgxs_tx_lane_map_xe28=0x0123 +xgxs_tx_lane_map_xe29=0x0123 +xgxs_tx_lane_map_xe30=0x0123 +xgxs_tx_lane_map_xe31=0x0123 +xgxs_tx_lane_map_xe32=0x0123 +xgxs_tx_lane_map_xe33=0x0123 +xgxs_tx_lane_map_xe34=0x0123 +xgxs_tx_lane_map_xe35=0x0123 +xgxs_tx_lane_map_xe41=0x0123 +xgxs_tx_lane_map_xe42=0x0123 +xgxs_tx_lane_map_xe43=0x0123 +xgxs_tx_lane_map_xe44=0x0123 + + + + +# RX - Config A. (FC 0/1/2/16) +# 0x1032 - port 0-11, 36-39 +xgxs_rx_lane_map_xe0=0x1032 +xgxs_rx_lane_map_xe1=0x1032 +xgxs_rx_lane_map_xe2=0x1032 +xgxs_rx_lane_map_xe3=0x1032 +xgxs_rx_lane_map_xe4=0x1032 +xgxs_rx_lane_map_xe5=0x1032 +xgxs_rx_lane_map_xe6=0x1032 +xgxs_rx_lane_map_xe7=0x1032 +xgxs_rx_lane_map_xe8=0x1032 +xgxs_rx_lane_map_xe9=0x1032 +xgxs_rx_lane_map_xe10=0x1032 +xgxs_rx_lane_map_xe11=0x1032 +xgxs_rx_lane_map_xe37=0x1032 +xgxs_rx_lane_map_xe38=0x1032 +xgxs_rx_lane_map_xe39=0x1032 +xgxs_rx_lane_map_xe40=0x1032 + + + +# RX - Config B. (FC 5/9/20) +# 0x1032 - port 12-13, 20-23, 44-47 +xgxs_rx_lane_map_xe12=0x1032 +xgxs_rx_lane_map_xe13=0x1032 +xgxs_rx_lane_map_xe14=0x1032 +xgxs_rx_lane_map_xe15=0x1032 +xgxs_rx_lane_map_xe20=0x1032 +xgxs_rx_lane_map_xe21=0x1032 +xgxs_rx_lane_map_xe22=0x1032 +xgxs_rx_lane_map_xe23=0x1032 +xgxs_rx_lane_map_xe45=0x1032 +xgxs_rx_lane_map_xe46=0x1032 +xgxs_rx_lane_map_xe47=0x1032 +xgxs_rx_lane_map_xe48=0x1032 + + +# RX - Config C. (FC 8/10) +# 0x3210 - port 16-19, 24-27 +xgxs_rx_lane_map_xe16=0x3210 +xgxs_rx_lane_map_xe17=0x3210 +xgxs_rx_lane_map_xe18=0x3210 +xgxs_rx_lane_map_xe19=0x3210 +xgxs_rx_lane_map_xe24=0x3210 +xgxs_rx_lane_map_xe25=0x3210 +xgxs_rx_lane_map_xe26=0x3210 +xgxs_rx_lane_map_xe27=0x3210 + + +# RX - Config D. (FC 12/13/17) +# 0x3210 - port 28-35, 40-43 +xgxs_rx_lane_map_xe28=0x3210 +xgxs_rx_lane_map_xe29=0x3210 +xgxs_rx_lane_map_xe30=0x3210 +xgxs_rx_lane_map_xe31=0x3210 +xgxs_rx_lane_map_xe32=0x3210 +xgxs_rx_lane_map_xe33=0x3210 +xgxs_rx_lane_map_xe34=0x3210 +xgxs_rx_lane_map_xe35=0x3210 +xgxs_rx_lane_map_xe41=0x3210 +xgxs_rx_lane_map_xe42=0x3210 +xgxs_rx_lane_map_xe43=0x3210 +xgxs_rx_lane_map_xe44=0x3210 + + +## Lane swapping for QSFP28 (100G) +## The HEX value is connection of red line within Falconcore in "Fig 3-4 SFP28 port connection" +# TX - Config A. (FC 21/25) +# 0x3210 - port ce0, ce3 +xgxs_tx_lane_map_ce0=0x3210 +xgxs_tx_lane_map_ce3=0x3210 + + +# TX - Config B. (FC 24) +# 0x3210 - port ce1 +xgxs_tx_lane_map_ce1=0x3210 + + +# TX - Config C. (FC 26) +# 0x3210 - port ce2 +xgxs_tx_lane_map_ce2=0x3210 + + +# TX - Config D. (FC 27) +# 0x3210 - ce5 +xgxs_tx_lane_map_ce5=0x3210 + + +# TX - Config E. (FC 29) +# 0x3210 - ce4 +xgxs_tx_lane_map_ce4=0x3210 + + +# RX - Config A. (FC 21/25) +# 0x1032 - port ce0, ce3 +xgxs_rx_lane_map_ce0=0x1032 +xgxs_rx_lane_map_ce3=0x1032 + + +# RX - Config B. (FC 24) +# 0x1032 - port ce1 +xgxs_rx_lane_map_ce1=0x1032 + + +# RX - Config C. (FC 26) +# 0x2301 - port ce2 +xgxs_rx_lane_map_ce2=0x2301 + + +# RX - Config D. (FC 27) +# 0x2301 - ce5 +xgxs_rx_lane_map_ce5=0x2301 + + +# TX - Config E. (FC 29) +# 0x3210 - ce4 +xgxs_rx_lane_map_ce4=0x3210 + +# EQ/iDriver + +# The first 16 ports, xe0-xe15 +serdes_preemphasis_1=0x2E380A +serdes_preemphasis_2=0x2E380A +serdes_preemphasis_3=0x2E380A +serdes_preemphasis_4=0x2E380A +serdes_preemphasis_5=0x2C3A0A +serdes_preemphasis_6=0x2C3A0A +serdes_preemphasis_7=0x2C3A0A +serdes_preemphasis_8=0x2C3A0A +serdes_preemphasis_9=0x323E00 +serdes_preemphasis_10=0x323E00 +serdes_preemphasis_11=0x304000 +serdes_preemphasis_12=0x304000 +serdes_preemphasis_13=0x2D4300 +serdes_preemphasis_14=0x304000 +serdes_preemphasis_15=0x2D4300 +serdes_preemphasis_16=0x2D4300 + +# The 2nd 20 ports, xe16-xe35 +serdes_preemphasis_34=0x2D4300 +serdes_preemphasis_35=0x2D4300 +serdes_preemphasis_36=0x2B4500 +serdes_preemphasis_37=0x2B4500 +serdes_preemphasis_38=0x2B4500 +serdes_preemphasis_39=0x2B4500 +serdes_preemphasis_40=0x2B4500 +serdes_preemphasis_41=0x2B4500 +serdes_preemphasis_42=0x2B4500 +serdes_preemphasis_43=0x2B4500 +serdes_preemphasis_44=0x284800 +serdes_preemphasis_45=0x284800 +serdes_preemphasis_46=0x284800 +serdes_preemphasis_47=0x284800 +serdes_preemphasis_48=0x284800 +serdes_preemphasis_49=0x284800 +serdes_preemphasis_50=0x2B4500 +serdes_preemphasis_51=0x2B4500 +serdes_preemphasis_52=0x284800 +serdes_preemphasis_53=0x284800 + +# The 3rd 12 ports, xe36-xe47 +serdes_preemphasis_68=0x284800 +serdes_preemphasis_69=0x2A4600 +serdes_preemphasis_70=0x2B4500 +serdes_preemphasis_71=0x2A4600 +serdes_preemphasis_72=0x2A4600 +serdes_preemphasis_73=0x2B4500 +serdes_preemphasis_74=0x2B4500 +serdes_preemphasis_75=0x2A4600 +serdes_preemphasis_76=0x2B4500 +serdes_preemphasis_77=0x2B4500 +serdes_preemphasis_78=0x2B4500 +serdes_preemphasis_79=0x2B4500 + +# 6 x 100G ports, expandable to 24 x 25G ports +serdes_preemphasis_80=0x2D4300 +serdes_preemphasis_81=0x2D4300 +serdes_preemphasis_82=0x2D4300 +serdes_preemphasis_83=0x2D4300 + +serdes_preemphasis_102=0x304000 +serdes_preemphasis_103=0x304000 +serdes_preemphasis_104=0x304000 +serdes_preemphasis_105=0x304000 + +serdes_preemphasis_106=0x304000 +serdes_preemphasis_107=0x304000 +serdes_preemphasis_108=0x304000 +serdes_preemphasis_109=0x304000 + +serdes_preemphasis_110=0x304000 +serdes_preemphasis_111=0x304000 +serdes_preemphasis_112=0x304000 +serdes_preemphasis_113=0x304000 + +serdes_preemphasis_114=0x2E360C +serdes_preemphasis_115=0x2E360C +serdes_preemphasis_116=0x2E360C +serdes_preemphasis_117=0x2E360C + +serdes_preemphasis_118=0x2E360C +serdes_preemphasis_119=0x2E360C +serdes_preemphasis_120=0x2E360C +serdes_preemphasis_121=0x2E360C diff --git a/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py b/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py new file mode 100755 index 000000000000..57c5dfc6035f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py @@ -0,0 +1,314 @@ +#!/usr/bin/env python +# + +import os +import time +import syslog +import re +from sonic_sfp.bcmshell import bcmshell + +# ===================================================================== +# global variable init +# ===================================================================== + +# define data ram address +PORT_DATA_OFFSET_ADDR = 0xA0 +PORT_DATA_START_ADDR = 0xF2 +TOTAL_SCAN_BITS_ADDR = 0xF4 +SYNC_START_LEN_ADDR = 0xF6 +SYNC_STOP_LEN_ADDR = 0xF8 +# bit streaming rule for CPLD decode +TOTAL_SCAN_BITS = None +SYNC_S = None +SYNC_P = None +# define port data for bit streaming +BIT_LINK = None +BIT_FAULT = None +BIT_TX = None +BIT_RX = None +BIT_SPEED0 = None +BIT_SPEED1 = None +# define port speed +SPEED_100G = 100 +SPEED_40G = 40 +SPEED_25G = 25 +SPEED_10G = 10 +# the amount of LED processor +AMOUNT_LED_UP = None +# define board type +INV_REDWOOD = "SONiC-Inventec-d7032-100" +INV_CYPRESS = "SONiC-Inventec-d7054" +INV_SEQUOIA = "" +BOARD_TPYE = "" +EAGLE_CORE = [] + +PORT_LIST = [] + +# port status that is auto update by chip in data ram +# there are two byte to indicate each port status +''' +RX equ 0x0 ; received packet +TX equ 0x1 ; transmitted packet +COLL equ 0x2 ; collision indicator +SPEED_C equ 0x3 ; 100 Mbps +SPEED_M equ 0x4 ; 1000 Mbps +DUPLEX equ 0x5 ; half/full duplex +FLOW equ 0x6 ; flow control capable +LINKUP equ 0x7 ; link down/up status +LINKEN equ 0x8 ; link disabled/enabled status +ZERO equ 0xE ; always 0 +ONE equ 0xF ; always 1 +''' +STATUS_ENABLE = 1<<0 +STATUS_RX = 1<<0 +STATUS_TX = 1<<1 + +# object is to execute bcm shell command +BCM_SHELL = None + + + +# ===================================================================== +# class object +# ===================================================================== +class Led(): + + up = None + pfw = None + + def __init__(self, led_number, program_fw): + self.up = led_number + self.pfw = program_fw + + def led_start(self): + BCM_SHELL.cmd("led {0} start".format(self.up)) + syslog.syslog(syslog.LOG_INFO, "Start Led({0})".format(self.up)) + + def led_stop(self): + BCM_SHELL.cmd("led {0} stop".format(self.up)) + syslog.syslog(syslog.LOG_INFO, "Stop Led({0})".format(self.up)) + + def load_prog(self): + BCM_SHELL.cmd("led {0} prog {1}".format(self.up, self.pfw)) + syslog.syslog(syslog.LOG_INFO, "Load Led({0}) program firmware".format(self.up)) + + def write_port_data(self, addr, data): + BCM_SHELL.cmd("setreg CMIC_LEDUP{0}_DATA_RAM({1}) {2}".format(self.up, addr, data)) + #syslog.syslog(syslog.LOG_DEBUG, "Write Led({0}) data_ram({1}): {2}".format(self.up, addr, data)) + + def read_data_ram(self, offset): + return_string = BCM_SHELL.run("getreg CMIC_LEDUP{0}_DATA_RAM({1})".format(self.up, offset)) + for line in return_string.split("\n"): + re_obj = re.search(r"\.+)\>",line) + if re_obj is not None: + #syslog.syslog(syslog.LOG_DEBUG, "Read Led({0}) data_ram({1}): {2}".format(self.up, offset, re_obj.group("data"))) + return int(re_obj.group("data"), 16) + + return None + + +# ===================================================================== +# Function +# ===================================================================== +def _remap_registers(): + + fp = open('/usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/led_proc_init.soc', "r") + content = fp.readlines() + fp.close() + err = False + + for line in content: + try: + BCM_SHELL.cmd(line.rstrip()) + except Exception, e: + err = True + syslog.syslog(syslog.LOG_ERR, "remap register abnormal: {0}".format(str(e))) + + if not err: + pass + #syslog.syslog(syslog.LOG_DEBUG, "remap Led registers successfully") + + + +def _update_port_list(): + + global PORT_LIST + PORT_LIST = [] + number = 0 + count = 0 + + content = BCM_SHELL.run("ps") + for line in content.split("\n"): + re_obj = re.search(r"(?P(xe|ce)\d+)\(\s*(?P\d+)\)\s+(?P(up|down|!ena)).+\s+(?P\d+)G",line) + if re_obj is not None: + if int(re_obj.group("bcm_id")) not in EAGLE_CORE: + PORT_LIST.append({"port_id":number, "name":re_obj.group("port_name"), "bcm_id":int(re_obj.group("bcm_id")), "link":re_obj.group("link"), "speed":int(re_obj.group("speed"))}) + number += 1 + + content = BCM_SHELL.run("led status") + for line in content.split("\n"): + re_obj = re.search(r"(?P\d+).+(?P\d)\:(?P\d+)",line) + if re_obj is not None: + if int(re_obj.group("bcm_id")) not in EAGLE_CORE: + PORT_LIST[count]["led_up"] = int(re_obj.group("led_up")) + PORT_LIST[count]["offset"] = int(re_obj.group("offset")) + count += 1 + + if number is not count: + PORT_LIST = [] + syslog.syslog(syslog.LOG_ERR, "The amount of port is not match") + else: + pass + #syslog.syslog(syslog.LOG_DEBUG, "update port list successfully") + + + +def _lookup_led_index(p): + + index = 0 + for port in PORT_LIST: + if p["bcm_id"] == port["bcm_id"]: + break + if p["led_up"] == port["led_up"]: + index += 1 + return index + PORT_DATA_OFFSET_ADDR + + + +def _led_init(): + + global BOARD_TPYE + global AMOUNT_LED_UP + global BIT_LINK + global BIT_FAULT + global BIT_TX + global BIT_RX + global BIT_SPEED0 + global BIT_SPEED1 + global EAGLE_CORE + global TOTAL_SCAN_BITS + global SYNC_S + global SYNC_P + + cmd = "uname -n" + platform = os.popen(cmd).read() + + if platform.rstrip() == INV_REDWOOD: + BOARD_TPYE = "inventec_d7032q28b" + AMOUNT_LED_UP = 2 + BIT_RX = 1<<0 #0x01 + BIT_TX = 1<<1 #0x02 + BIT_SPEED0 = 1<<3 #0x08 + BIT_SPEED1 = 1<<4 #0x10 + BIT_FAULT = 1<<6 #0x40 + BIT_LINK = 1<<7 #0x80 + TOTAL_SCAN_BITS = 32*1*4 + SYNC_S = 15 + SYNC_P = 3 + EAGLE_CORE = [66, 100] + _remap_registers() + + elif platform.rstrip() == INV_CYPRESS: + BOARD_TPYE = "inventec_d7054q28b" + AMOUNT_LED_UP = 2 + BIT_LINK = 1<<0 #0x01 + BIT_FAULT = 1<<1 #0x02 + BIT_SPEED0 = 1<<2 #0x04 + EAGLE_CORE = [66, 100] + + elif platform.rstrip() == INV_SEQUOIA: + BOARD_TPYE = "inventec_d7264q28b" + AMOUNT_LED_UP = 4 + + else: + BOARD_TPYE = "not found" + + syslog.syslog(syslog.LOG_INFO, "Device: {0}".format(BOARD_TPYE)) + #syslog.syslog(syslog.LOG_DEBUG, "led_amount: {0}".format(AMOUNT_LED_UP)) + + + +if __name__ == "__main__": + + waitSyncd = True + retryCount = 0 + syslog.openlog("led_proc", syslog.LOG_PID, facility=syslog.LOG_DAEMON) + + while waitSyncd: + try: + BCM_SHELL = bcmshell() + waitSyncd = False + except Exception, e: + syslog.syslog(syslog.LOG_WARNING, "{0}, Retry times({1})".format(str(e),retryCount)) + retryCount += 1 + time.sleep(5) + + + _led_init() + led_obj = [] + for idx in range(AMOUNT_LED_UP): + led_obj.append(Led(idx, "")) + #syslog.syslog(syslog.LOG_DEBUG, "create object led({0}) successfully".format(idx)) + + if BOARD_TPYE == "inventec_d7032q28b": + led_obj[idx].write_port_data(PORT_DATA_START_ADDR, PORT_DATA_OFFSET_ADDR) + led_obj[idx].write_port_data(TOTAL_SCAN_BITS_ADDR, TOTAL_SCAN_BITS) + led_obj[idx].write_port_data(SYNC_START_LEN_ADDR, SYNC_S) + led_obj[idx].write_port_data(SYNC_STOP_LEN_ADDR, SYNC_P) + + + reset_sec = 2 + count_down = 0 + queue_active = [] + port_data = None + while True: + if count_down == 0: + queue_active = [] + _update_port_list() + for port in PORT_LIST: + if port["link"] == "up": + queue_active.append(port) + else: + port_data = 0 + # redwood bit streaming for CPLD decode is only use led up0 + led_obj[0].write_port_data(PORT_DATA_OFFSET_ADDR + port["port_id"], port_data) + count_down = reset_sec + else: + for port in queue_active: + port_data = 0 + + if BOARD_TPYE == "inventec_d7032q28b": + port_data |= BIT_LINK + addr = 2*(port["offset"]-1) + byte1 = led_obj[port["led_up"]].read_data_ram(addr) + byte2 = led_obj[port["led_up"]].read_data_ram(addr+1) + if byte1&STATUS_RX: + port_data |= BIT_RX + if byte1&STATUS_TX: + port_data |= BIT_TX + if port["speed"] == SPEED_100G: + port_data |= BIT_SPEED0 + port_data |= BIT_SPEED1 + elif port["speed"] == SPEED_40G: + port_data |= BIT_SPEED1 + elif port["speed"] == SPEED_25G: + port_data |= BIT_SPEED0 + else: + pass + + # redwood bit streaming for CPLD decode is only use led up0 + led_obj[0].write_port_data(PORT_DATA_OFFSET_ADDR + port["port_id"], port_data) + continue + + elif BOARD_TPYE == "inventec_d7054q28b": + if port["speed"] != SPEED_100G and port["speed"] != SPEED_25G: + port_data |= BIT_SPEED0 + + led_index = _lookup_led_index(port) + led_obj[port["led_up"]].write_port_data(led_index, port_data) + + time.sleep(0.5) + count_down -= 1 + + syslog.closelog() + diff --git a/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py b/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py new file mode 100755 index 000000000000..6546a4e44ca0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py @@ -0,0 +1,305 @@ +#!/usr/bin/env python +# + +""" +Usage: %(scriptName)s [options] command object + +Auto detecting the transceiver and set the correct if_type value + +options: + -h | --help : this help message + -d | --debug : run with debug mode + +""" + +try: + import os + import commands + import sys, getopt + import logging + import re + import time + import datetime + import syslog + from sfputil import SfpUtil + from sonic_sfp.bcmshell import bcmshell + +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +DEBUG = False +args = [] +INV_REDWOOD_PLATFORM = "SONiC-Inventec-d7032-100" +INV_CYPRESS_PLATFORM = "SONiC-Inventec-d7054" +INV_SEQUOIA_PLATFORM = "SONiC-Inventec-d7264" + +transceiver_type_dict = { + "FCBG110SD1C03": "SR", + "FCBG110SD1C05": "SR", + "FTLX8571D3BCL": "SR", + "FTLX8574D3BCL": "SR", + "AFBR-709DMZ": "SR", + "AFBR-709SMZ": "SR", + "FTLX8571D3BCV": "SR", + "FTLX1471D3BCL": "SR", + "FTLX1871M3BCL": "SR", + "FTLF8536P4BCL": "SR", + "FCBG125SD1C05": "SR", + "FCBG125SD1C30": "SR", + "FCBG125SD1C03": "SR", + "FCBG410QB1C03-1E": "SR4", + "FCBG4100QB1C030-1E": "SR4", + "885350163": "SR4", + "88535017": "SR4", + "FTL410QE2C": "SR4", + "FTL410QD3C": "SR4", + "FTL410QD2C": "SR4", + "AFBR-79E3PZ": "SR4", + "AFBR-79Q4Z": "SR4", + "FTL4C1QE1C": "SR4", + "FTLC9551REPM": "SR4", + "FTLC1151RDPL": "SR4", + "DAC-010SS-X50" : "KR", + "DAC-010QQ-X50": "KR4", + "DAC-040QS-007": "KR4", + "DAC-040QQ-007": "KR4", + "DAC-040QQ-005": "KR4", + "DAC-040QS-005": "KR4", + "NDAAFF-0001": "KR4", + "L0HQF001-SD-R": "KR4", + "DAC-Q28/Q28-28-01": "KR4", + "NDAAFF-0003": "KR4", + "NDAQGF0001": "KR4", + "L0HQF003-SD-R": "KR4", + "NDAQGJ-0003": "KR4", + "L0HQF004-SD-R": "KR4", + "L0HSF006-SD-R": "KR", + "L0HSF007-SD-R": "KR", + "L0HSF008-SD-R": "KR", + "L0HQF009-SD-R": "KR4" + } + +initial_command = [] + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def log_message( string ): + syslog.openlog("transceiver_monitor", syslog.LOG_PID, facility=syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_NOTICE, string) + +class BCMUtil(bcmshell): + + port_to_bcm_mapping = dict() + sal_config_list = dict() + eagle_list = [] + platform = None + + def get_platform(self): + if self.platform is None: + self.platform = os.popen("uname -n").read().strip() + return self.platform + + def get_port_to_bcm_mapping(self): + if self.port_to_bcm_mapping is None: + return dict() + else: + return self.port_to_bcm_mapping + + def show_port_to_bcm_mapping(self): + print self.port_to_bcm_mapping + + def get_eagle_port(self): + return self.eagle_list + + def parsing_eagle_port(self): + name = self.get_platform() + if name is not None: + if name == INV_REDWOOD_PLATFORM: + self.eagle_list = [66,100] + elif name == INV_CYPRESS_PLATFORM: + self.eagle_list = [66,100] + elif name == INV_SEQUOIA_PLATFORM: + self.eagle_list = [66,100] + else: + self.eagle_list = [] + + def get_sal_config_list(self): + return self.sal_config_list + + def show_sal_config_list(self): + print self.sal_config_list + + def initial_sal_config_list( self ): + content = self.run("config") + for line in content.split("\n"): + ConfigObject = re.search(r"portmap\_(?P\d+)\=(?P\d+)\:\d+",line) + if ConfigObject is not None: + if int(ConfigObject.group("bcm_id")) not in self.get_eagle_port(): + self.get_sal_config_list()[int(ConfigObject.group("bcm_id"))]={"lane": int(ConfigObject.group("lane_id")), "speed": None, "portname": None} + + def parsing_port_list(self): + content = self.run("ps") + count = 0 + for line in content.split("\n"): + PSObject = re.search(r"(?P(xe|ce)\d+)\(\s*(?P\d+)\).+\s+(?P\d+)G",line) + if PSObject is not None: + if int(PSObject.group("bcm_id")) not in self.get_eagle_port(): + if self.get_sal_config_list().has_key(int(PSObject.group("bcm_id"))): + self.get_sal_config_list()[int(PSObject.group("bcm_id"))]["portname"] = PSObject.group("port_name") + self.get_sal_config_list()[int(PSObject.group("bcm_id"))]["speed"] = int(PSObject.group("speed"))*1000 + self.port_to_bcm_mapping[count] = int(PSObject.group("bcm_id")) + count = count +1 + + + def execute_command(self, cmd): + self.cmd(cmd) + +class TransceiverUtil(SfpUtil): + + transceiver_port_mapping = dict() + + def get_transceiver_port_mapping(self): + return self.transceiver_port_mapping + + def show_transceiver_port_mapping(self): + print self.transceiver_port_mapping + + def get_bcm_port_name(self, index): + if self.transceiver_port_mapping.has_key(index) and bcm_obj.get_sal_config_list().has_key(self.transceiver_port_mapping[index]["bcm"]): + return bcm_obj.get_sal_config_list()[self.transceiver_port_mapping[index]["bcm"]]["portname"] + else: + return "" + + def get_port_to_i2c_mapping(self): + if self.port_to_i2c_mapping is None: + return dict() + else: + return self.port_to_i2c_mapping + + def show_port_to_i2c_mapping(self): + print self.port_to_i2c_mapping + + def get_eeprom_partNum(self, portNum): + tempdict = dict() + tempdict = self.get_eeprom_dict(portNum) + self.get_eeprom_partNum_from_parser_eeprom_dict(tempdict) + + def get_eeprom_dict_info(self, portNum): + return self.get_eeprom_dict(portNum) + + def get_eeprom_partNum_from_parser_eeprom_dict(self, tempdict ): + if tempdict is not None: + if tempdict["interface"]["data"].has_key("VendorPN"): + return tempdict["interface"]["data"]["VendorPN"] + elif tempdict["interface"]["data"].has_key("Vendor PN"): + return tempdict["interface"]["data"]["Vendor PN"] + else: + return None + else: + return None + + def get_transceiver_type(self, pn ): + if pn is not None: + if transceiver_type_dict.has_key(pn.upper()): + return transceiver_type_dict[pn.upper()] + else: + return None + + def set_transceiver_type( self, portNum, pn ): + type = self.get_transceiver_type( pn ) + if type is not None: + if bcm_obj.get_platform() == INV_SEQUOIA_PLATFORM: + speed = bcm_obj.get_sal_config_list()[self.transceiver_port_mapping[portNum]["bcm"]]["speed"] + bcm_obj.execute_command( "port %s if=%s speed=%d" % ( self.get_bcm_port_name(portNum), type, speed ) ) + else: + bcm_obj.execute_command( "port %s if=%s" % ( self.get_bcm_port_name(portNum), type ) ) + #print "Detecting port {0} need to change interface type {1} ({2})".format(self.get_bcm_port_name(portNum), type, self.get_transceiver_port_mapping()[portNum]["pn"]) + log_message("Detecting port {0} need to change interface type {1} ({2})".format(self.get_bcm_port_name(portNum), type, self.get_transceiver_port_mapping()[portNum]["pn"]) ) + + def initial_transceiver_port_mapping(self): + for index in self.get_port_to_i2c_mapping().keys(): + if self.transceiver_port_mapping.has_key(index) is False : + i2cValue = self.get_port_to_i2c_mapping()[index] + bcmValue = bcm_obj.get_port_to_bcm_mapping()[index] + self.transceiver_port_mapping[index]={"i2c": i2cValue, "bcm": bcmValue , "pn": None} + + def set_power_mode_for_QSFP(self): + for index in self.get_port_to_i2c_mapping().keys(): + if index >= self.qsfp_port_start and index <= self.qsfp_port_end : + self.set_low_power_mode(index, False) + +def main(): + try: + global DEBUG + global transceiver_obj + global bcm_obj + + initalNotOK = True + retestCount = 0 + while initalNotOK : + try: + transceiver_obj = TransceiverUtil() + bcm_obj = BCMUtil() + initalNotOK = False + except Exception, e: + log_message("Exception. The warning is {0}, Retry again ({1})".format(str(e),retestCount) ) + retestCount = retestCount + 1 + time.sleep(5) + + log_message( "Object initialed successfully" ) + + options, args = getopt.getopt(sys.argv[1:], 'hd', ['help', + 'debug' + ]) + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + else: + logging.info("no option") + + # Before loop, You could execute specific command to initial chip + for cmd_index in initial_command : + bcm_obj.execute_command(cmd_index) + + # Initial the sal config list + bcm_obj.parsing_eagle_port() + bcm_obj.initial_sal_config_list() + bcm_obj.parsing_port_list() + # bcm_obj.show_port_to_bcm_mapping() + # bcm_obj.show_sal_config_list() + + # Initial the transceiver_obj + transceiver_obj.initial_transceiver_port_mapping() + # transceiver_obj.show_transceiver_port_mapping() + + transceiver_obj.set_power_mode_for_QSFP() + + while 1 : + if bcm_obj.get_platform() == INV_SEQUOIA_PLATFORM: + bcm_obj.parsing_port_list() + for index in transceiver_obj.get_port_to_i2c_mapping().keys(): + info = transceiver_obj.get_eeprom_dict_info(index) + value = transceiver_obj.get_eeprom_partNum_from_parser_eeprom_dict(info) + if transceiver_obj.get_transceiver_port_mapping().has_key(index) is not False and transceiver_obj.get_transceiver_port_mapping()[index]["pn"] <> value: + transceiver_obj.get_transceiver_port_mapping()[index]["pn"] = value + transceiver_obj.set_transceiver_type(index,value) + #transceiver_obj.show_transceiver_port_mapping() + time.sleep(1) + + except (Exception, KeyboardInterrupt) as e: + log_message("Terminating this python daemon ({0})".format(e)) + syslog.closelog() + del transceiver_obj + del bcm_obj + +if __name__ == "__main__": + main() + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init index 5df1bb444123..97fee8c3ad57 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init @@ -11,18 +11,40 @@ # Short-Description: Setup Inventec d7032q28b board. ### END INIT INFO +DIR=/usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/plugins +MONITOR_DAEMON=$DIR/transceiver_monitor.py +MONITOR_DAEMON_NAME=transceiver_monitor +LED_DAEMON=$DIR/led_proc.py +LED_DAEMON_NAME=led_proc + +# The process ID of the script when it runs is stored here: +MONITOR_PIDFILE=/var/run/$MONITOR_DAEMON_NAME.pid +LED_PIDFILE=/var/run/$LED_DAEMON_NAME.pid + +do_monitor_start() { + /sbin/start-stop-daemon --quiet --oknodo --pidfile $LED_PIDFILE --make-pidfile --startas $LED_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $MONITOR_PIDFILE --make-pidfile --startas $MONITOR_DAEMON --start --background -- $DAEMON_OPTS +} + +do_monitor_stop() { + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $MONITOR_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $LED_PIDFILE --retry 10 +} + case "$1" in start) echo -n "Setting up board... " depmod -a /usr/local/bin/inventec_d7032_util.py -f install + do_monitor_${1} echo "done." ;; stop) /usr/local/bin/inventec_d7032_util.py -f clean + do_monitor_${1} echo "done." ;; diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install index 0864a728ea79..c716a9d0d8b7 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install @@ -1 +1,3 @@ d7032q28b/utils/inventec_d7032_util.py usr/local/bin +common/utils/transceiver_monitor.py usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/plugins +common/utils/led_proc.py usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/plugins diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.upstart b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.upstart deleted file mode 100644 index cbb96a664f6a..000000000000 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.upstart +++ /dev/null @@ -1,5 +0,0 @@ -description "SONiC platform service" - -respawn - -exec /usr/local/bin/inventec_d7032_util.py -f install diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init index 20341f8527e5..a6e3e88f20d4 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init @@ -11,18 +11,40 @@ # Short-Description: Setup Inventec d7054q28b board. ### END INIT INFO +DIR=/usr/share/sonic/device/x86_64-inventec_d7054q28b-r0/plugins +MONITOR_DAEMON=$DIR/transceiver_monitor.py +MONITOR_DAEMON_NAME=transceiver_monitor +LED_DAEMON=$DIR/led_proc.py +LED_DAEMON_NAME=led_proc + +# The process ID of the script when it runs is stored here: +MONITOR_PIDFILE=/var/run/$MONITOR_DAEMON_NAME.pid +LED_PIDFILE=/var/run/$LED_DAEMON_NAME.pid + +do_monitor_start() { + /sbin/start-stop-daemon --quiet --oknodo --pidfile $LED_PIDFILE --make-pidfile --startas $LED_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $MONITOR_PIDFILE --make-pidfile --startas $MONITOR_DAEMON --start --background -- $DAEMON_OPTS +} + +do_monitor_stop() { + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $MONITOR_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $LED_PIDFILE --retry 10 +} + case "$1" in start) echo -n "Setting up board... " depmod -a /usr/local/bin/inventec_d7054_util.py -f install + do_monitor_${1} echo "done." ;; stop) /usr/local/bin/inventec_d7054_util.py -f clean + do_monitor_${1} echo "done." ;; diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install index 42bf3f23c809..699a5ef41417 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install @@ -1 +1,4 @@ d7054q28b/utils/inventec_d7054_util.py usr/local/bin +common/utils/transceiver_monitor.py usr/share/sonic/device/x86_64-inventec_d7054q28b-r0/plugins +common/utils/led_proc.py usr/share/sonic/device/x86_64-inventec_d7054q28b-r0/plugins + diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.upstart b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.upstart deleted file mode 100644 index 9f185f47b623..000000000000 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.upstart +++ /dev/null @@ -1,5 +0,0 @@ -description "SONiC platform service" - -respawn - -exec /usr/local/bin/inventec_d7054_util.py -f install From eefd3f4ddb8bbfbb345b4bd3cfcedf433a283634 Mon Sep 17 00:00:00 2001 From: yangbashuang <37615000+yangbashuang@users.noreply.github.com> Date: Mon, 13 Aug 2018 08:22:08 +0800 Subject: [PATCH 1537/1833] [platform]: update centec platform drivers and sai (#1702) --- .../E582-48x6q/buffers.json.j2 | 70 + .../E582-48x6q/pg_profile_lookup.ini | 21 + .../E582-48x6q/port_config.ini | 86 +- .../E582-48x6q/qos.json | 133 ++ .../E582-48x6q/sai.profile | 2 + .../x86_64-centec_e582_48x6q-r0/fancontrol | 11 + .../installer.conf | 1 + .../x86_64-centec_e582_48x6q-r0/minigraph.xml | 1049 ---------- .../plugins/eeprom.py | 31 + .../plugins/led_control.py | 153 ++ .../plugins/psuutil.py | 74 + .../plugins/sfputil.py | 160 ++ dockers/docker-orchagent/orchagent.sh | 5 + platform/centec/one-image.mk | 2 +- .../centec/platform-modules-centec-e582.mk | 19 + platform/centec/rules.mk | 2 +- platform/centec/sai.mk | 5 - platform/centec/sdk.mk | 7 +- .../48x2q4z/cfg/48x2q4z-modules.conf | 17 + .../48x2q4z/modules/Makefile | 2 + .../48x2q4z/modules/centec_at24c64.c | 657 ++++++ .../modules/centec_e582_48x2q4z_platform.c | 142 ++ .../48x2q4z/modules/dal_kernel.c | 1814 ++++++++++++++++ .../48x2q4z/modules/dal_kernel.h | 170 ++ .../48x2q4z/modules/dal_mpool.c | 343 ++++ .../48x2q4z/modules/dal_mpool.h | 71 + .../48x2q4z/scripts/48x2q4z_platform.sh | 36 + .../48x6q/cfg/48x6q-modules.conf | 14 + .../48x6q/cfg/config_db.json | 303 +++ .../48x6q/cfg/config_db_l2l3.json | 610 ++++++ .../48x6q/cfg/minigraph.xml | 38 + .../48x6q/modules/Makefile | 2 + .../48x6q/modules/centec_at24c64.c | 658 ++++++ .../modules/centec_e582_48x6q_platform.c | 1380 +++++++++++++ .../48x6q/modules/dal_kernel.c | 1822 +++++++++++++++++ .../48x6q/modules/dal_kernel.h | 170 ++ .../48x6q/modules/dal_mpool.c | 343 ++++ .../48x6q/modules/dal_mpool.h | 71 + .../48x6q/scripts/48x6q_platform.sh | 62 + .../48x6q/scripts/48x6q_platform_monitor.py | 217 ++ .../sonic-platform-modules-e582/LICENSE | 15 + .../sonic-platform-modules-e582/README.md | 1 + .../debian/changelog | 11 + .../sonic-platform-modules-e582/debian/compat | 1 + .../debian/control | 17 + .../debian/platform-modules-e582-48x2q4z.init | 38 + .../platform-modules-e582-48x2q4z.install | 2 + .../debian/platform-modules-e582-48x6q.init | 38 + .../platform-modules-e582-48x6q.install | 6 + .../sonic-platform-modules-e582/debian/rules | 35 + 50 files changed, 9846 insertions(+), 1091 deletions(-) create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/buffers.json.j2 create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/pg_profile_lookup.ini create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/qos.json create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/fancontrol delete mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/plugins/eeprom.py create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/plugins/led_control.py create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/plugins/psuutil.py create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/plugins/sfputil.py create mode 100644 platform/centec/platform-modules-centec-e582.mk delete mode 100644 platform/centec/sai.mk create mode 100644 platform/centec/sonic-platform-modules-e582/48x2q4z/cfg/48x2q4z-modules.conf create mode 100644 platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile create mode 100644 platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_at24c64.c create mode 100644 platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_e582_48x2q4z_platform.c create mode 100644 platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_kernel.c create mode 100644 platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_kernel.h create mode 100644 platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_mpool.c create mode 100644 platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_mpool.h create mode 100755 platform/centec/sonic-platform-modules-e582/48x2q4z/scripts/48x2q4z_platform.sh create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/cfg/48x6q-modules.conf create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/cfg/config_db.json create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/cfg/config_db_l2l3.json create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/cfg/minigraph.xml create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/modules/Makefile create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_at24c64.c create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_e582_48x6q_platform.c create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_kernel.c create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_kernel.h create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_mpool.c create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_mpool.h create mode 100755 platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform.sh create mode 100644 platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform_monitor.py create mode 100644 platform/centec/sonic-platform-modules-e582/LICENSE create mode 100644 platform/centec/sonic-platform-modules-e582/README.md create mode 100644 platform/centec/sonic-platform-modules-e582/debian/changelog create mode 100644 platform/centec/sonic-platform-modules-e582/debian/compat create mode 100644 platform/centec/sonic-platform-modules-e582/debian/control create mode 100755 platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x2q4z.init create mode 100644 platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x2q4z.install create mode 100755 platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x6q.init create mode 100644 platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x6q.install create mode 100755 platform/centec/sonic-platform-modules-e582/debian/rules diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/buffers.json.j2 b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/buffers.json.j2 new file mode 100644 index 000000000000..08e21e428b6c --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/buffers.json.j2 @@ -0,0 +1,70 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} +{% set default_ports_num = 54 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(1,default_ports_num+1) %} + {% if PORT.append("Ethernet%d" % (port_idx)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + } +} + diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/pg_profile_lookup.ini b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/pg_profile_lookup.ini new file mode 100644 index 000000000000..a65244e69b5b --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/pg_profile_lookup.ini @@ -0,0 +1,21 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 1000 5m 34816 18432 16384 0 + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 1000 40m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 1000 300m 49152 18432 30720 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 + diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/port_config.ini b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/port_config.ini index b9a831f22e8d..95190282b25d 100644 --- a/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/port_config.ini +++ b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/port_config.ini @@ -1,33 +1,55 @@ # name lanes -Ethernet0 1 -Ethernet4 2 -Ethernet8 3 -Ethernet12 4 -Ethernet16 5 -Ethernet20 6 -Ethernet24 7 -Ethernet28 8 -Ethernet32 9 -Ethernet36 10 -Ethernet40 11 -Ethernet44 12 -Ethernet48 13 -Ethernet52 14 -Ethernet56 15 -Ethernet60 16 -Ethernet64 17 -Ethernet68 18 -Ethernet72 19 -Ethernet76 20 -Ethernet80 21 -Ethernet84 22 -Ethernet88 23 -Ethernet92 24 -Ethernet96 25 -Ethernet100 26 -Ethernet104 27 -Ethernet108 28 -Ethernet112 29 -Ethernet116 30 -Ethernet120 31 -Ethernet124 32 +Ethernet1 4 +Ethernet2 5 +Ethernet3 6 +Ethernet4 8 +Ethernet5 9 +Ethernet6 10 +Ethernet7 12 +Ethernet8 13 +Ethernet9 14 +Ethernet10 16 +Ethernet11 17 +Ethernet12 18 +Ethernet13 20 +Ethernet14 21 +Ethernet15 22 +Ethernet16 24 +Ethernet17 25 +Ethernet18 26 +Ethernet19 28 +Ethernet20 30 +Ethernet21 31 +Ethernet22 32 +Ethernet23 34 +Ethernet24 35 +Ethernet25 40 +Ethernet26 41 +Ethernet27 43 +Ethernet28 36 +Ethernet29 37 +Ethernet30 39 +Ethernet31 44 +Ethernet32 45 +Ethernet33 46 +Ethernet34 47 +Ethernet35 80 +Ethernet36 81 +Ethernet37 82 +Ethernet38 88 +Ethernet39 89 +Ethernet40 90 +Ethernet41 84 +Ethernet42 85 +Ethernet43 86 +Ethernet44 87 +Ethernet45 92 +Ethernet46 93 +Ethernet47 94 +Ethernet48 95 +Ethernet49 52,53,54,55 +Ethernet50 56,57,58,59 +Ethernet51 60,61,62,63 +Ethernet52 68,69,70,71 +Ethernet53 72,73,74,75 +Ethernet54 76,77,78,79 diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/qos.json b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/qos.json new file mode 100644 index 000000000000..b9dc80abb07f --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/qos.json @@ -0,0 +1,133 @@ +{ + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"1", + "10":"1", + "11":"1", + "12":"1", + "13":"1", + "14":"1", + "15":"1", + "16":"2", + "17":"2", + "18":"2", + "19":"2", + "20":"2", + "21":"2", + "22":"2", + "23":"2", + "24":"3", + "25":"3", + "26":"3", + "27":"3", + "28":"3", + "29":"3", + "30":"3", + "31":"3", + "32":"4", + "33":"4", + "34":"4", + "35":"4", + "36":"4", + "37":"4", + "38":"4", + "39":"4", + "40":"5", + "41":"5", + "42":"5", + "43":"5", + "44":"5", + "45":"5", + "46":"5", + "47":"5", + "48":"6", + "49":"6", + "50":"6", + "51":"6", + "52":"6", + "53":"6", + "54":"6", + "55":"6", + "56":"7", + "57":"7", + "58":"7", + "59":"7", + "60":"7", + "61":"7", + "62":"7", + "63":"7" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1": { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2": { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSY": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "red_max_threshold":"32760", + "red_min_threshold":"4095", + "yellow_max_threshold":"32760", + "yellow_min_threshold":"4095", + "green_max_threshold": "32760", + "green_min_threshold": "4095" + }, + "AZURE_LOSSLESS": { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "red_max_threshold":"32760", + "red_min_threshold":"4095", + "yellow_max_threshold":"32760", + "yellow_min_threshold":"4095", + "green_max_threshold": "32760", + "green_min_threshold": "4095" + } + }, + "QUEUE": { + "Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|0-2": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|5-7": { + "scheduler" : "[SCHEDULER|scheduler.2]" + }, + "Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|0-2": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + + "Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|5-7": { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|3-4": { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + } + } +} + + diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/sai.profile b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/sai.profile index 2eb3ce5f612b..9842dcf57fac 100644 --- a/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/sai.profile +++ b/device/centec/x86_64-centec_e582_48x6q-r0/E582-48x6q/sai.profile @@ -1 +1,3 @@ BOARD_CONFIG_FILE_PATH=/etc/centec/E582-48x6q.json +SAI_INIT_CONFIG_FILE=/etc/centec/E582-48x6q-chip-profile.txt +SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/etc/centec/E582-48x6q-datapath-cfg.txt diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/fancontrol b/device/centec/x86_64-centec_e582_48x6q-r0/fancontrol new file mode 100644 index 000000000000..886a4bc6c030 --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/fancontrol @@ -0,0 +1,11 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon0= hwmon5=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-15/15-002f +DEVNAME=hwmon0=acpitz hwmon5=adt7470 +FCTEMPS=hwmon5/device/pwm4=hwmon0/temp1_input hwmon5/device/pwm3=hwmon0/temp1_input hwmon5/device/pwm2=hwmon0/temp1_input hwmon5/device/pwm1=hwmon0/temp1_input +FCFANS=hwmon5/device/pwm4=hwmon5/device/fan4_input hwmon5/device/pwm3=hwmon5/device/fan3_input hwmon5/device/pwm2=hwmon5/device/fan2_input hwmon5/device/pwm1=hwmon5/device/fan1_input +MINTEMP=hwmon5/device/pwm4=20 hwmon5/device/pwm3=20 hwmon5/device/pwm2=20 hwmon5/device/pwm1=20 +MAXTEMP=hwmon5/device/pwm4=60 hwmon5/device/pwm3=60 hwmon5/device/pwm2=60 hwmon5/device/pwm1=60 +MINSTART=hwmon5/device/pwm4=150 hwmon5/device/pwm3=12 hwmon5/device/pwm2=12 hwmon5/device/pwm1=150 +MINSTOP=hwmon5/device/pwm4=0 hwmon5/device/pwm3=12 hwmon5/device/pwm2=12 hwmon5/device/pwm1=0 +MAXPWM= hwmon5/device/pwm4=150 diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/installer.conf b/device/centec/x86_64-centec_e582_48x6q-r0/installer.conf index 5e62742c11bf..7d60bf73d366 100644 --- a/device/centec/x86_64-centec_e582_48x6q-r0/installer.conf +++ b/device/centec/x86_64-centec_e582_48x6q-r0/installer.conf @@ -1 +1,2 @@ CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=no" diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml b/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml deleted file mode 100644 index 950c52a64134..000000000000 --- a/device/centec/x86_64-centec_e582_48x6q-r0/minigraph.xml +++ /dev/null @@ -1,1049 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - E582-48x6q - - - - sonic - E582-48x6q -
diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/plugins/eeprom.py b/device/centec/x86_64-centec_e582_48x6q-r0/plugins/eeprom.py new file mode 100644 index 000000000000..3fd55c63d8b7 --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/plugins/eeprom.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +############################################################################# +# Centec E582-48X6Q +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + import subprocess + from sonic_eeprom import eeprom_base + 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-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/plugins/led_control.py b/device/centec/x86_64-centec_e582_48x6q-r0/plugins/led_control.py new file mode 100644 index 000000000000..d25bf6f8b473 --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/plugins/led_control.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python +# +# led_control.py +# +# Platform-specific LED control functionality for SONiC +# + +try: + from sonic_led.led_control_base import LedControlBase + import swsssdk + import threading + import os + import logging + import struct + import time + import syslog + from socket import * + from select import * +except ImportError, e: + raise ImportError(str(e) + " - required module not found") + + +def DBG_PRINT(str): + syslog.openlog("centec-led") + syslog.syslog(syslog.LOG_INFO, str) + syslog.closelog() + +class LedControl(LedControlBase): + """Platform specific LED control class""" + SONIC_PORT_NAME_PREFIX = "Ethernet" + LED_MODE_UP = [11, 1] + LED_MODE_DOWN = [7, 2] + + def _initSystemLed(self): + try: + with open(self.f_led.format("system"), 'w') as led_file: + led_file.write("5") + DBG_PRINT("init system led to normal") + with open(self.f_led.format("idn"), 'w') as led_file: + led_file.write("1") + DBG_PRINT("init idn led to off") + except IOError as e: + DBG_PRINT(str(e)) + + def _initPanelLed(self): + with open(self.f_led.format("port1"), 'r') as led_file: + shouldInit = (int(led_file.read()) == 0) + + if shouldInit == True: + for (port, ctlid, defmode) in self.led_mapping[1:59]: + data = struct.pack('=HHHBBH', 0, 7, 4, ctlid, defmode, port) + self.udpClient.sendto(data, ('localhost', 8101)) + + data = struct.pack('=HHHBB34B', 0, 3, 36, 34, 0, *[x[0] for x in self.led_mapping[1:35]]) + self.udpClient.sendto(data, ('localhost', 8101)) + data = struct.pack('=HHHBB24B', 0, 3, 26, 24, 1, *[x[0] for x in self.led_mapping[35:59]]) + self.udpClient.sendto(data, ('localhost', 8101)) + + data = struct.pack('=HHHB', 0, 5, 1, 1) + self.udpClient.sendto(data, ('localhost', 8101)) + + for idx in range(1, 55): + (port, ctlid, defmode) = self.led_mapping[idx] + with open(self.f_led.format("port{}".format(idx)), 'w') as led_file: + led_file.write(str(defmode)) + DBG_PRINT("init port{} led to mode={}".format(idx, defmode)) + + for idx in range(1, 55): + (port, ctlid, defmode) = self.led_mapping[idx] + with open(self.f_led.format("port{}".format(idx)), 'r') as led_file: + defmode = int(led_file.read()) + data = struct.pack('=HHHBBH', 0, 7, 4, ctlid, defmode, port) + self.udpClient.sendto(data, ('localhost', 8101)) + DBG_PRINT("init port{} led to mode={}".format(idx, defmode)) + + def _initDefaultConfig(self): + DBG_PRINT("start init led") + while True: + try: + r_sel = [self.udpClient] + echo_req = struct.pack('=HHH', 0, 1, 0) + self.udpClient.sendto(echo_req, ('localhost', 8101)) + result = select(r_sel, [], [], 1) + if self.udpClient in result[0]: + echo_rsp, srv_addr = self.udpClient.recvfrom(1024) + if echo_rsp: + break + DBG_PRINT("connect to sdk rpc server timeout, try again.") + except IOError as e: + DBG_PRINT(str(e)) + + DBG_PRINT("connect to sdk rpc server success.") + + self._initSystemLed() + self._initPanelLed() + + DBG_PRINT("init led done") + + + # Helper method to map SONiC port name to index + def _port_name_to_index(self, port_name): + # Strip "Ethernet" off port name + if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): + return -1 + + port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) + return port_idx + + def _port_state_to_mode(self, port_idx, state): + if state == "up": + return self.LED_MODE_UP[0] if (port_idx < 49) else self.LED_MODE_UP[1] + else: + return self.LED_MODE_DOWN[0] if (port_idx < 49) else self.LED_MODE_DOWN[1] + + def _port_led_mode_update(self, port_idx, ledMode): + with open(self.f_led.format("port{}".format(port_idx)), 'w') as led_file: + led_file.write(str(ledMode)) + (port, ctlid) = (self.led_mapping[port_idx][0], self.led_mapping[port_idx][1]) + data = struct.pack('=HHHBBH', 0, 7, 4, ctlid, ledMode, port) + self.udpClient.sendto(data, ('localhost', 8101)) + + # Concrete implementation of port_link_state_change() method + def port_link_state_change(self, portname, state): + port_idx = self._port_name_to_index(portname) + ledMode = self._port_state_to_mode(port_idx, state) + with open(self.f_led.format("port{}".format(port_idx)), 'r') as led_file: + saveMode = int(led_file.read()) + + if ledMode == saveMode: + return + + self._port_led_mode_update(port_idx, ledMode) + DBG_PRINT("update {} led mode from {} to {}".format(portname, saveMode, ledMode)) + + # Constructor + def __init__(self): + # [macid, ctlid, defaultmode] + self.led_mapping = [(0, 0, 0)] # resv + self.led_mapping.extend([(4, 0, 7), (5, 0, 7), (6, 0, 7), (8, 0, 7), (9, 0, 7), (10, 0, 7), (12, 0, 7), (13, 0, 7)]) # panel port 1~8 + self.led_mapping.extend([(14, 0, 7), (16, 0, 7), (17, 0, 7), (18, 0, 7), (20, 0, 7), (21, 0, 7), (22, 0, 7), (24, 0, 7)]) # panel port 9~16 + self.led_mapping.extend([(25, 0, 7), (26, 0, 7), (28, 0, 7), (30, 0, 7), (31, 0, 7), (32, 0, 7), (34, 0, 7), (35, 0, 7)]) # panel port 17~24 + self.led_mapping.extend([(48, 0, 7), (49, 0, 7), (51, 0, 7), (36, 0, 7), (37, 0, 7), (39, 0, 7), (55, 0, 7), (54, 0, 7)]) # panel port 25~32 + self.led_mapping.extend([(53, 0, 7), (52, 0, 7), (52, 1, 7), (53, 1, 7), (54, 1, 7), (55, 1, 7), (38, 1, 7), (37, 1, 7)]) # panel port 33~40 + self.led_mapping.extend([(36, 1, 7), (51, 1, 7), (50, 1, 7), (49, 1, 7), (48, 1, 7), (34, 1, 7), (33, 1, 7), (32, 1, 7)]) # panel port 41~48 + self.led_mapping.extend([(28, 1, 2), (24, 1, 2), (20, 1, 2), (12, 1, 2), (8, 1, 2), (4, 1, 2)]) # panel port 49~54 + self.led_mapping.extend([(0, 1, 2), (0, 1, 2), (0, 1, 2), (0, 1, 2), (0, 1, 2), (0, 1, 2)]) + + self.f_led = "/sys/class/leds/{}/brightness" + + self.udpClient = socket(AF_INET, SOCK_DGRAM) + + self._initDefaultConfig() + diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/plugins/psuutil.py b/device/centec/x86_64-centec_e582_48x6q-r0/plugins/psuutil.py new file mode 100644 index 000000000000..5f8ba030c1f0 --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/plugins/psuutil.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/class/psu/psu{}/" + self.psu_presence = "psu_presence" + self.psu_oper_status = "psu_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path.format(index) + self.psu_oper_status, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 0 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + status = 0 + try: + with open(self.psu_path.format(index) + self.psu_presence, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 0 diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/plugins/sfputil.py b/device/centec/x86_64-centec_e582_48x6q-r0/plugins/sfputil.py new file mode 100644 index 000000000000..7bb1ac0d4192 --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/plugins/sfputil.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python + +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + import os + import logging + import struct + import syslog + from socket import * + from select import * + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + + +def DBG_PRINT(str): + print str + "\n" + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + SONIC_PORT_NAME_PREFIX = "Ethernet" + PORT_START = 1 + PORT_END = 54 + PORTS_IN_BLOCK = 54 + + @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(49, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self.eeprom_mapping + + def is_logical_port(self, port_name): + return True + + def get_logical_to_physical(self, port_name): + if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): + return None + + port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) + + return [port_idx] + + def get_eeprom_data(self, port): + (ctlid, devid) = self.fiber_mapping[port] + offset = (128 if port in self.qsfp_ports else 0) + r_sel = [self.udpClient] + req = struct.pack('=HHHBBHIBBBBI', + 0, 9, 16, # lchip/msgtype/msglen + ctlid, # uint8 ctl_id + devid, # uint8 slave_dev_id + 0x50, # uint16 dev_addr + (1< self.port_end: + return False + try: + with open(self.f_sfp_present.format(port_num), 'r') as sfp_file: + return 1 == int(sfp_file.read()) + except IOError as e: + DBG_PRINT(str(e)) + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + return False + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + return False + diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index af9e5b0766ab..7758ceeed590 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -20,6 +20,11 @@ elif [ "$platform" == "cavium" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$platform" == "nephos" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$platform" == "centec" ]; then + last_byte=$(python -c "print '$MAC_ADDRESS'[-2:]") + aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) + 1), '02x')") # put mask and take away the 0x prefix + ALIGNED_MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC + ORCHAGENT_ARGS+="-m $ALIGNED_MAC_ADDRESS" elif [ "$platform" == "barefoot" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" fi diff --git a/platform/centec/one-image.mk b/platform/centec/one-image.mk index 7ad205dce521..42e78ab4df34 100644 --- a/platform/centec/one-image.mk +++ b/platform/centec/one-image.mk @@ -3,6 +3,6 @@ SONIC_ONE_IMAGE = sonic-centec.bin $(SONIC_ONE_IMAGE)_MACHINE = centec $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_INSTALLS += $(CENTEC_SDK_KERNEL) +$(SONIC_ONE_IMAGE)_INSTALLS += $(CENTEC_E582_48X6Q_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/centec/platform-modules-centec-e582.mk b/platform/centec/platform-modules-centec-e582.mk new file mode 100644 index 000000000000..e86c428a7403 --- /dev/null +++ b/platform/centec/platform-modules-centec-e582.mk @@ -0,0 +1,19 @@ +# Centec E582-48X6Q Platform modules + + +CENTEC_E582_48X6Q_PLATFORM_MODULE_VERSION =1.1 +CENTEC_E582_48X2Q4Z_PLATFORM_MODULE_VERSION =1.1 + +export CENTEC_E582_48X6Q_PLATFORM_MODULE_VERSION +export CENTEC_E582_48X2Q4Z_PLATFORM_MODULE_VERSION + +CENTEC_E582_48X6Q_PLATFORM_MODULE = platform-modules-e582-48x6q_$(CENTEC_E582_48X6Q_PLATFORM_MODULE_VERSION)_amd64.deb + +$(CENTEC_E582_48X6Q_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-e582 +$(CENTEC_E582_48X6Q_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(CENTEC_E582_48X6Q_PLATFORM_MODULE)_PLATFORM = x86_64-centec_e582_48x6q-r0 +SONIC_DPKG_DEBS += $(CENTEC_E582_48X6Q_PLATFORM_MODULE) + +CENTEC_E582_48X2Q4Z_PLATFORM_MODULE = platform-modules-e582-48x2q4z_$(CENTEC_E582_48X2Q4Z_PLATFORM_MODULE_VERSION)_amd64.deb +$(CENTEC_E582_48X2Q4Z_PLATFORM_MODULE)_PLATFORM = x86_64-centec_e582_48x2q4z-r0 +$(eval $(call add_extra_package,$(CENTEC_E582_48X6Q_PLATFORM_MODULE),$(CENTEC_E582_48X2Q4Z_PLATFORM_MODULE))) diff --git a/platform/centec/rules.mk b/platform/centec/rules.mk index 8b676f87ece4..823144dc25ce 100644 --- a/platform/centec/rules.mk +++ b/platform/centec/rules.mk @@ -1,5 +1,5 @@ +include $(PLATFORM_PATH)/platform-modules-centec-e582.mk include $(PLATFORM_PATH)/sdk.mk -include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/docker-orchagent-centec.mk include $(PLATFORM_PATH)/docker-syncd-centec.mk include $(PLATFORM_PATH)/docker-syncd-centec-rpc.mk diff --git a/platform/centec/sai.mk b/platform/centec/sai.mk deleted file mode 100644 index 299b36a69ebf..000000000000 --- a/platform/centec/sai.mk +++ /dev/null @@ -1,5 +0,0 @@ -# Centec SAI -CENTEC_SAI = libsai_1.0.0_amd64.deb -$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_1.0/libsai_1.0.0_amd64.deb - -SONIC_ONLINE_DEBS += $(CENTEC_SAI) diff --git a/platform/centec/sdk.mk b/platform/centec/sdk.mk index e3ce05f6b742..ba2d1adbe6a8 100644 --- a/platform/centec/sdk.mk +++ b/platform/centec/sdk.mk @@ -1,4 +1,5 @@ -CENTEC_SDK_KERNEL = centec-gg-sdk3.5-modules-3.16.0-4-amd64.deb -$(CENTEC_SDK_KERNEL)_URL = "https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_1.0/centec-gg-sdk3.5-modules-3.16.0-4-amd64.deb" +# Centec SAI +CENTEC_SAI = libsai_1.2.4_amd64.deb +$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_1.2.4/libsai_1.2.4-1.0_amd64.deb -SONIC_ONLINE_DEBS += $(CENTEC_SDK_KERNEL) +SONIC_ONLINE_DEBS += $(CENTEC_SAI) diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/cfg/48x2q4z-modules.conf b/platform/centec/sonic-platform-modules-e582/48x2q4z/cfg/48x2q4z-modules.conf new file mode 100644 index 000000000000..5becd702a716 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/cfg/48x2q4z-modules.conf @@ -0,0 +1,17 @@ +# /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-dev +i2c-mux +i2c-smbus + +i2c-mux-pca954x +lm77 +adt7470 +tun +centec_e582_48x6q_platform +dal +centec_at24c64 diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile new file mode 100644 index 000000000000..d1ca9824aa9e --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := centec_e582_48x2q4z_platform.o dal.o centec_at24c64.o +dal-y := dal_kernel.o dal_mpool.o diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_at24c64.c b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_at24c64.c new file mode 100644 index 000000000000..52b8d536d0e6 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_at24c64.c @@ -0,0 +1,657 @@ +/* + * at24.c - handle most I2C EEPROMs + * + * Copyright (C) 2005-2007 David Brownell + * Copyright (C) 2008 Wolfram Sang, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. + * Differences between different vendor product lines (like Atmel AT24C or + * MicroChip 24LC, etc) won't much matter for typical read/write access. + * There are also I2C RAM chips, likewise interchangeable. One example + * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). + * + * However, misconfiguration can lose data. "Set 16-bit memory address" + * to a part with 8-bit addressing will overwrite data. Writing with too + * big a page size also loses data. And it's not safe to assume that the + * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC + * uses 0x51, for just one example. + * + * Accordingly, explicit board-specific configuration data should be used + * in almost all cases. (One partial exception is an SMBus used to access + * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) + * + * So this driver uses "new style" I2C driver binding, expecting to be + * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or + * similar kernel-resident tables; or, configuration data coming from + * a bootloader. + * + * Other than binding model, current differences from "eeprom" driver are + * that this one handles write access and isn't restricted to 24c02 devices. + * It also handles larger devices (32 kbit and up) with two-byte addresses, + * which won't work on pure SMBus systems. + */ + +struct at24_data { + struct at24_platform_data chip; + struct memory_accessor macc; + int use_smbus; + + /* + * Lock protects against activities from other Linux tasks, + * but not from changes by other I2C masters. + */ + struct mutex lock; + struct bin_attribute bin; + + u8 *writebuf; + unsigned write_max; + unsigned num_addresses; + + /* + * Some chips tie up multiple I2C addresses; dummy devices reserve + * them for us, and we'll use them with SMBus calls. + */ + struct i2c_client *client[]; +}; + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = 128; +module_param(io_limit, uint, 0); +MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); + +/* + * Specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; +module_param(write_timeout, uint, 0); +MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); + +#define AT24_SIZE_BYTELEN 5 +#define AT24_SIZE_FLAGS 8 + +#define AT24_BITMASK(x) (BIT(x) - 1) + +/* create non-zero magic value for given eeprom parameters */ +#define AT24_DEVICE_MAGIC(_len, _flags) \ + ((1 << AT24_SIZE_FLAGS | (_flags)) \ + << AT24_SIZE_BYTELEN | ilog2(_len)) + +static const struct i2c_device_id at24_ctc_ids[] = { + { "24c64-ctc", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16 | AT24_FLAG_READONLY | AT24_FLAG_IRUGO) }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, at24_ctc_ids); + +/*-------------------------------------------------------------------------*/ + +/* + * This routine supports chips which consume multiple I2C addresses. It + * computes the addressing information to be used for a given r/w request. + * Assumes that sanity checks for offset happened at sysfs-layer. + */ +static struct i2c_client *at24_translate_offset(struct at24_data *at24, + unsigned *offset) +{ + unsigned i; + + if (at24->chip.flags & AT24_FLAG_ADDR16) { + i = *offset >> 16; + *offset &= 0xffff; + } else { + i = *offset >> 8; + *offset &= 0xff; + } + + return at24->client[i]; +} + +static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, + unsigned offset, size_t count) +{ + struct i2c_msg msg[2]; + struct i2c_client *client; + unsigned long timeout, read_time; + int status; + + memset(msg, 0, sizeof(msg)); + + /* + * REVISIT some multi-address chips don't rollover page reads to + * the next slave address, so we may need to truncate the count. + * Those chips might need another quirk flag. + * + * If the real hardware used four adjacent 24c02 chips and that + * were misconfigured as one 24c08, that would be a similar effect: + * one "eeprom" file not four, but larger reads would fail when + * they crossed certain pages. + */ + + /* + * Slave address and byte offset derive from the offset. Always + * set the byte address; on a multi-master board, another master + * may have changed the chip's "current" address pointer. + */ + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + + count = 1; + + /* + * Reads fail if the previous write didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + read_time = jiffies; + + status = i2c_smbus_write_byte_data(client, (offset >> 8) & 0x0ff, offset & 0x0ff ); + status = i2c_smbus_read_byte(client); + if (status >= 0) { + buf[0] = status; + status = count; + } + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(read_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t at24_read(struct at24_data *at24, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) + return count; + + memset(buf, 0, count); + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + ssize_t status; + + status = at24_eeprom_read(at24, buf, off, count); + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + //printk(KERN_ALERT "at24_read buf = %s, retval = %zu\n", buf, retval); + + mutex_unlock(&at24->lock); + + return retval; +} + +static ssize_t at24_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct at24_data *at24; + + at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return at24_read(at24, buf, off, count); +} + + +/* + * Note that if the hardware write-protect pin is pulled high, the whole + * chip is normally write protected. But there are plenty of product + * variants here, including OTP fuses and partial chip protect. + * + * We only use page mode writes; the alternative is sloooow. This routine + * writes at most one page. + */ +static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf, + unsigned offset, size_t count) +{ + struct i2c_client *client; + ssize_t status; + unsigned long timeout, write_time; + unsigned next_page; + + /* Get corresponding I2C address and adjust offset */ + client = at24_translate_offset(at24, &offset); + + /* write_max is at most a page */ + if (count > at24->write_max) + count = at24->write_max; + + /* Never roll over backwards, to the start of this page */ + next_page = roundup(offset + 1, at24->chip.page_size); + if (offset + count > next_page) + count = next_page - offset; + + /* + * Writes fail if the previous one didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + write_time = jiffies; + + status = i2c_smbus_write_word_data(client, + (offset >> 8) & 0x0ff, (offset & 0xFF) | buf[0]); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(write_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, + size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) + return count; + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + ssize_t status; + + status = at24_eeprom_write(at24, buf, off, 1); /* only one-byte to write; TODO page wirte */ + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&at24->lock); + + return retval; +} + +static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct at24_data *at24; + + if (unlikely(off >= attr->size)) + return -EFBIG; + + at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return at24_write(at24, buf, off, count); +} + +/*-------------------------------------------------------------------------*/ + +/* + * This lets other kernel code access the eeprom data. For example, it + * might hold a board's Ethernet address, or board-specific calibration + * data generated on the manufacturing floor. + */ + +static ssize_t at24_macc_read(struct memory_accessor *macc, char *buf, + off_t offset, size_t count) +{ + struct at24_data *at24 = container_of(macc, struct at24_data, macc); + + return at24_read(at24, buf, offset, count); +} + +static ssize_t at24_macc_write(struct memory_accessor *macc, const char *buf, + off_t offset, size_t count) +{ + struct at24_data *at24 = container_of(macc, struct at24_data, macc); + + return at24_write(at24, buf, offset, count); +} + +/*-------------------------------------------------------------------------*/ + +#ifdef CONFIG_OF +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ + const __be32 *val; + struct device_node *node = client->dev.of_node; + + if (node) { + if (of_get_property(node, "read-only", NULL)) + chip->flags |= AT24_FLAG_READONLY; + val = of_get_property(node, "pagesize", NULL); + if (val) + chip->page_size = be32_to_cpup(val); + } +} +#else +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ } +#endif /* CONFIG_OF */ + +static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct at24_platform_data chip; + bool writable; + int use_smbus = 0; + struct at24_data *at24; + int err; + unsigned i, num_addresses; + kernel_ulong_t magic; + + if (client->dev.platform_data) { + chip = *(struct at24_platform_data *)client->dev.platform_data; + } else { + if (!id->driver_data) + return -ENODEV; + + magic = id->driver_data; + chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); + magic >>= AT24_SIZE_BYTELEN; + chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); + + /* + * This is slow, but we can't know all eeproms, so we better + * play safe. Specifying custom eeprom-types via platform_data + * is recommended anyhow. + */ + chip.page_size = 1; + + /* update chipdata if OF is present */ + at24_get_ofdata(client, &chip); + + printk(KERN_ALERT "at24_probe chip.byte_len = 0x%x\n", chip.byte_len); + printk(KERN_ALERT "at24_probe chip.flags = 0x%x\n", chip.flags); + printk(KERN_ALERT "at24_probe chip.magic = 0x%lx\n", id->driver_data); + + chip.setup = NULL; + chip.context = NULL; + } + + if (!is_power_of_2(chip.byte_len)) + dev_warn(&client->dev, + "byte_len looks suspicious (no power of 2)!\n"); + if (!chip.page_size) { + dev_err(&client->dev, "page_size must not be 0!\n"); + return -EINVAL; + } + if (!is_power_of_2(chip.page_size)) + dev_warn(&client->dev, + "page_size looks suspicious (no power of 2)!\n"); + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + return -EPFNOSUPPORT; + } + use_smbus = I2C_SMBUS_BYTE_DATA; + printk(KERN_ALERT "at24_probe use_smbus --> %d\n", + use_smbus); + } + + if (chip.flags & AT24_FLAG_TAKE8ADDR) + num_addresses = 8; + else + num_addresses = DIV_ROUND_UP(chip.byte_len, + (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); + + at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); + if (!at24) + return -ENOMEM; + + mutex_init(&at24->lock); + at24->use_smbus = use_smbus; + at24->chip = chip; + at24->num_addresses = num_addresses; + + /* + * Export the EEPROM bytes through sysfs, since that's convenient. + * By default, only root should see the data (maybe passwords etc) + */ + sysfs_bin_attr_init(&at24->bin); + at24->bin.attr.name = "eeprom"; + at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; + at24->bin.read = at24_bin_read; + at24->bin.size = chip.byte_len; + + at24->macc.read = at24_macc_read; + + writable = !(chip.flags & AT24_FLAG_READONLY); + if (writable) { + if (!use_smbus || i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { + + unsigned write_max = chip.page_size; + + at24->macc.write = at24_macc_write; + + at24->bin.write = at24_bin_write; + at24->bin.attr.mode |= S_IWUSR; + + if (write_max > io_limit) + write_max = io_limit; + if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + at24->write_max = write_max; + + /* buffer (data + address at the beginning) */ + at24->writebuf = devm_kzalloc(&client->dev, + write_max + 2, GFP_KERNEL); + if (!at24->writebuf) + return -ENOMEM; + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + } + + at24->client[0] = client; + + /* use dummy devices for multiple-address chips */ + for (i = 1; i < num_addresses; i++) { + at24->client[i] = i2c_new_dummy(client->adapter, + client->addr + i); + if (!at24->client[i]) { + dev_err(&client->dev, "address 0x%02x unavailable\n", + client->addr + i); + err = -EADDRINUSE; + goto err_clients; + } + } + + err = sysfs_create_bin_file(&client->dev.kobj, &at24->bin); + if (err) + goto err_clients; + + i2c_set_clientdata(client, at24); + + dev_info(&client->dev, "%zu byte %s EEPROM, %s, %u bytes/write\n", + at24->bin.size, client->name, + writable ? "writable" : "read-only", at24->write_max); + if (use_smbus == I2C_SMBUS_WORD_DATA || + use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } + + /* export data to kernel code */ + if (chip.setup) + chip.setup(&at24->macc, chip.context); + + return 0; + +err_clients: + for (i = 1; i < num_addresses; i++) + if (at24->client[i]) + i2c_unregister_device(at24->client[i]); + + return err; +} + +static int at24_remove(struct i2c_client *client) +{ + struct at24_data *at24; + int i; + + at24 = i2c_get_clientdata(client); + sysfs_remove_bin_file(&client->dev.kobj, &at24->bin); + + for (i = 1; i < at24->num_addresses; i++) + i2c_unregister_device(at24->client[i]); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +static struct i2c_board_info i2c_devs = { + I2C_BOARD_INFO("24c64-ctc", 0x57), +}; + +static struct i2c_adapter *adapter = NULL; +static struct i2c_client *client = NULL; + +static int ctc_at24c64_init(void) +{ + printk(KERN_ALERT "ctc_at24c64_init\n"); + + adapter = i2c_get_adapter(0); + if(adapter == NULL){ + printk(KERN_ALERT "i2c_get_adapter == NULL\n"); + return -1; + } + + client = i2c_new_device(adapter, &i2c_devs); + if(client == NULL){ + printk(KERN_ALERT "i2c_new_device == NULL\n"); + i2c_put_adapter(adapter); + adapter = NULL; + return -1; + } + + return 0; +} + +static void ctc_at24c64_exit(void) +{ + printk(KERN_ALERT "ctc_at24c64_exit\n"); + if(client){ + i2c_unregister_device(client); + } + if(adapter){ + i2c_put_adapter(adapter); + } +} + +static struct i2c_driver at24_ctc_driver = { + .driver = { + .name = "at24-ctc", + .owner = THIS_MODULE, + }, + .probe = at24_probe, + .remove = at24_remove, + .id_table = at24_ctc_ids, +}; + +static int __init at24_ctc_init(void) +{ + if (!io_limit) { + pr_err("at24_ctc: io_limit must not be 0!\n"); + return -EINVAL; + } + + io_limit = rounddown_pow_of_two(io_limit); + + ctc_at24c64_init(); + + return i2c_add_driver(&at24_ctc_driver); +} +module_init(at24_ctc_init); + +static void __exit at24_ctc_exit(void) +{ + ctc_at24c64_exit(); + i2c_del_driver(&at24_ctc_driver); +} +module_exit(at24_ctc_exit); + +MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); +MODULE_AUTHOR("David Brownell and Wolfram Sang"); +MODULE_LICENSE("GPL"); diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_e582_48x2q4z_platform.c b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_e582_48x2q4z_platform.c new file mode 100644 index 000000000000..003f9a80caf0 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_e582_48x2q4z_platform.c @@ -0,0 +1,142 @@ +#include +#include +#include +#include + +#define PCA9548_CHANNEL_NUM 8 +#define PCA9548_ADAPT_ID_START 10 + +static struct pca954x_platform_mode i2c_dev_pca9548_platform_mode[PCA9548_CHANNEL_NUM] = { + [0] = { + .adap_id = PCA9548_ADAPT_ID_START, + .deselect_on_exit = 1, + .class = 0, + }, + [1] = { + .adap_id = PCA9548_ADAPT_ID_START + 1, + .deselect_on_exit = 1, + .class = 0, + }, + [2] = { + .adap_id = PCA9548_ADAPT_ID_START + 2, + .deselect_on_exit = 1, + .class = 0, + }, + [3] = { + .adap_id = PCA9548_ADAPT_ID_START + 3, + .deselect_on_exit = 1, + .class = 0, + }, + [4] = { + .adap_id = PCA9548_ADAPT_ID_START + 4, + .deselect_on_exit = 1, + .class = 0, + }, + [5] = { + .adap_id = PCA9548_ADAPT_ID_START + 5, + .deselect_on_exit = 1, + .class = 0, + }, + [6] = { + .adap_id = PCA9548_ADAPT_ID_START + 6, + .deselect_on_exit = 1, + .class = 0, + }, + [7] = { + .adap_id = PCA9548_ADAPT_ID_START + 7, + .deselect_on_exit = 1, + .class = 0, + } +}; + +static struct pca954x_platform_data i2c_dev_pca9548_platform_data = { + .modes = i2c_dev_pca9548_platform_mode, + .num_modes = PCA9548_CHANNEL_NUM, +}; + +static struct i2c_board_info i2c_dev_pca9548 = { + I2C_BOARD_INFO("pca9548", 0x70), + .platform_data = &i2c_dev_pca9548_platform_data, +}; + +static struct i2c_board_info i2c_dev_adt7475 = { + I2C_BOARD_INFO("adt7470", 0x2F), +}; + +struct i2c_adapter *i2c_core_master = NULL; /* i2c-0-cpu */ +struct i2c_adapter *i2c_mux_channel_4 = NULL; /* pca9548x-channel 5 */ +struct i2c_client *i2c_client_pca9548x = NULL; +struct i2c_client *i2c_client_adt7475 = NULL; + +static int e582_48x6q_init(void) +{ + printk(KERN_INFO "install e582_48x6q board dirver...\n"); + + /* find i2c-core master */ + i2c_core_master = i2c_get_adapter(0); + if(i2c_core_master == NULL) + { + printk(KERN_CRIT "can't find i2c-core bus\n"); + goto err_i2c_core_master; + } + + /* install i2c-mux */ + i2c_client_pca9548x = i2c_new_device(i2c_core_master, &i2c_dev_pca9548); + if(i2c_client_pca9548x == NULL) + { + printk(KERN_INFO "install e582_48x6q board pca9548 failed\n"); + goto install_at24c64; + } + + /* install adt7475 */ + /* find i2c-mux-channel 15 */ + i2c_mux_channel_4 = i2c_get_adapter(PCA9548_ADAPT_ID_START + 4); + if(i2c_mux_channel_4 == NULL) + { + printk(KERN_INFO "install e582_48x6q board adt7470 failed\n"); + goto install_at24c64; + } + + i2c_client_adt7475 = i2c_new_device(i2c_mux_channel_4, &i2c_dev_adt7475); + if(i2c_client_adt7475 == NULL){ + printk(KERN_INFO "install e582_48x6q board adt7470 failed\n"); + goto install_at24c64; + } + +install_at24c64: + + printk(KERN_INFO "install e582_48x6q board dirver...ok\n"); + return 0; + +err_i2c_core_master: + return -1; +} + +static void e582_48x6q_exit(void) +{ + printk(KERN_INFO "uninstall e582_48x6q board dirver...\n"); + + /* uninstall adt7475 master */ + if(i2c_client_adt7475) { + i2c_unregister_device(i2c_client_adt7475); + } + if(i2c_mux_channel_4) { + i2c_put_adapter(i2c_mux_channel_4); + } + + /* uninstall i2c-core master */ + if(i2c_client_pca9548x) { + i2c_unregister_device(i2c_client_pca9548x); + } + + /* uninstall i2c-core master */ + if(i2c_core_master) { + i2c_put_adapter(i2c_core_master); + } +} + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("xuwj centecNetworks, Inc"); +MODULE_DESCRIPTION("e582-48x6q board driver"); +module_init(e582_48x6q_init); +module_exit(e582_48x6q_exit); diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_kernel.c b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_kernel.c new file mode 100644 index 000000000000..4c9a3da64e6e --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_kernel.c @@ -0,0 +1,1814 @@ +/** + @file dal_kernal.c + + @date 2012-10-18 + + @version v2.0 + + +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) +#include +#endif +#include "dal_kernel.h" +#include "dal_mpool.h" + +MODULE_AUTHOR("Centec Networks Inc."); +MODULE_DESCRIPTION("DAL kernel module"); +MODULE_LICENSE("GPL"); + +/* DMA memory pool size */ +static char* dma_pool_size; +module_param(dma_pool_size, charp, 0); +MODULE_PARM_DESC(dma_pool_size, + "Specify DMA memory pool size (default 4MB)"); + +/***************************************************************************** + * defines + *****************************************************************************/ +#define MB_SIZE 0x100000 +#define CTC_MAX_INTR_NUM 8 + +#define MEM_MAP_RESERVE SetPageReserved +#define MEM_MAP_UNRESERVE ClearPageReserved + +#define CTC_VENDOR_VID 0xc001 +#define CTC_HUMBER_DEVICE_ID 0x6048 +#define CTC_GOLDENGATE_DEVICE_ID 0xcb10 + +#define MEM_MAP_RESERVE SetPageReserved +#define MEM_MAP_UNRESERVE ClearPageReserved + +#define CTC_GREATBELT_DEVICE_ID 0x03e8 /* TBD */ +#define DAL_MAX_CHIP_NUM 8 /* [GB] used */ +#define VIRT_TO_PAGE(p) virt_to_page((p)) +#define DAL_UNTAG_BLOCK 0 +#define DAL_DISCARD_BLOCK 1 +#define DAL_MATCHED_BLOCK 2 +#define DAL_CUR_MATCH_BLOCk 3 +/***************************************************************************** + * typedef + *****************************************************************************/ +/* Control Data */ +typedef struct dal_isr_s +{ + int irq; + void (* isr)(void*); + void* isr_data; + int trigger; + int count; + wait_queue_head_t wqh; +} dal_isr_t; + +typedef struct dal_kernel_dev_s +{ + struct list_head list; + struct pci_dev* pci_dev; + + /* PCI I/O mapped base address */ + uintptr logic_address; + + /* Physical address */ + uintptr phys_address; +} dal_kern_dev_t; + +typedef struct _dma_segment +{ + struct list_head list; + unsigned long req_size; /* Requested DMA segment size */ + unsigned long blk_size; /* DMA block size */ + unsigned long blk_order; /* DMA block size in alternate format */ + unsigned long seg_size; /* Current DMA segment size */ + unsigned long seg_begin; /* Logical address of segment */ + unsigned long seg_end; /* Logical end address of segment */ + unsigned long* blk_ptr; /* Array of logical DMA block addresses */ + int blk_cnt_max; /* Maximum number of block to allocate */ + int blk_cnt; /* Current number of blocks allocated */ +} dma_segment_t; + +typedef irqreturn_t (*p_func) (int irq, void* dev_id); + +/*************************************************************************** + *declared + ***************************************************************************/ +static unsigned int linux_dal_poll0(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll1(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll2(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll3(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll4(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll5(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll6(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll7(struct file* filp, struct poll_table_struct* p); + +/***************************************************************************** + * global variables + *****************************************************************************/ +static dal_kern_dev_t dal_dev[DAL_MAX_CHIP_NUM]; +static dal_isr_t dal_isr[CTC_MAX_INTR_NUM]; +static int dal_chip_num = 0; +static int dal_version = 0; +static int dal_intr_num = 0; +static int use_high_memory = 0; +static unsigned int* dma_virt_base[DAL_MAX_CHIP_NUM]; +#ifndef DMA_MEM_MODE_PLATFORM +static unsigned int* dma_virt_base_tmp[DAL_MAX_CHIP_NUM]; +#endif +static uintptr dma_phy_base[DAL_MAX_CHIP_NUM]; +static unsigned int dma_mem_size = 0x800000; +static unsigned int msi_irq_base[DAL_MAX_CHIP_NUM]; +static unsigned int msi_irq_num[DAL_MAX_CHIP_NUM]; +static unsigned int msi_used = 0; +static struct class *dal_class; + +static LIST_HEAD(_dma_seg); +static int dal_debug = 0; +module_param(dal_debug, int, 0); +MODULE_PARM_DESC(dal_debug, "Set debug level (default 0)"); + +static struct pci_device_id dal_id_table[] = +{ + {PCI_DEVICE(CTC_VENDOR_VID, CTC_GREATBELT_DEVICE_ID)}, + {PCI_DEVICE(0xcb10, 0xc010)}, + {0, }, +}; + +static wait_queue_head_t poll_intr[CTC_MAX_INTR_NUM]; + +p_func intr_handler_fun[CTC_MAX_INTR_NUM]; + +static int poll_intr_trigger[CTC_MAX_INTR_NUM]; + +static struct file_operations dal_intr_fops[CTC_MAX_INTR_NUM] = +{ + { + .owner = THIS_MODULE, + .poll = linux_dal_poll0, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll1, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll2, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll3, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll4, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll5, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll6, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll7, + }, +}; + +/***************************************************************************** + * macros + *****************************************************************************/ +#define VERIFY_CHIP_INDEX(n) (n < dal_chip_num) + +#define _KERNEL_INTERUPT_PROCESS +static irqreturn_t +intr0_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + + if(poll_intr_trigger[0]) + { + return IRQ_HANDLED; + } + + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[0] = 1; + wake_up(&poll_intr[0]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr1_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[1]) + { + return IRQ_HANDLED; + } + + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[1] = 1; + wake_up(&poll_intr[1]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr2_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[2]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[2] = 1; + wake_up(&poll_intr[2]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr3_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[3]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[3] = 1; + wake_up(&poll_intr[3]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr4_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[4]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[4] = 1; + wake_up(&poll_intr[4]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr5_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[5]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[5] = 1; + wake_up(&poll_intr[5]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr6_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[6]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[6] = 1; + wake_up(&poll_intr[6]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr7_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[7]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[7] = 1; + wake_up(&poll_intr[7]); + } + } + + return IRQ_HANDLED; +} + +int +dal_interrupt_register(unsigned int irq, int prio, void (* isr)(void*), void* data) +{ + int ret; + unsigned char str[16]; + unsigned char* int_name = NULL; + unsigned int intr_num_tmp = 0; + unsigned int intr_num = CTC_MAX_INTR_NUM; + unsigned long irq_flags = 0; + + if (dal_intr_num >= CTC_MAX_INTR_NUM) + { + printk("Interrupt numbers exceeds max.\n"); + return -1; + } + + if (msi_used) + { + int_name = "dal_msi"; + } + else + { + int_name = "dal_intr"; + } + + + for (intr_num_tmp=0;intr_num_tmp < CTC_MAX_INTR_NUM; intr_num_tmp++) + { + if (irq == dal_isr[intr_num_tmp].irq) + { + dal_isr[intr_num_tmp].count++; + printk("Interrupt irq %d register count %d.\n", irq, dal_isr[intr_num_tmp].count); + return 0; + } + if ((0 == dal_isr[intr_num_tmp].irq) && (CTC_MAX_INTR_NUM == intr_num)) + { + intr_num = intr_num_tmp; + dal_isr[intr_num].count = 0; + } + } + dal_isr[intr_num].irq = irq; + dal_isr[intr_num].isr = isr; + dal_isr[intr_num].isr_data = data; + dal_isr[intr_num].count++; + + init_waitqueue_head(&poll_intr[intr_num]); + + /* only user mode */ + if ((NULL == isr) && (NULL == data)) + { + snprintf(str, 16, "%s%d", "dal_intr", intr_num); + ret = register_chrdev(DAL_DEV_INTR_MAJOR_BASE + intr_num, + str, &dal_intr_fops[intr_num]); + if (ret < 0) + { + printk("Register character device for irq %d failed, ret= %d", irq, ret); + return ret; + } + } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) + irq_flags = 0; +#else + irq_flags = IRQF_DISABLED; +#endif + if ((ret = request_irq(irq, + intr_handler_fun[intr_num], + irq_flags, + int_name, + &dal_isr[intr_num])) < 0) + { + printk("Cannot request irq %d, ret %d.\n", irq, ret); + unregister_chrdev(DAL_DEV_INTR_MAJOR_BASE + intr_num, str); + } + + if (0 == ret) + { + dal_intr_num++; + } + + return ret; +} + +int +dal_interrupt_unregister(unsigned int irq) +{ + unsigned char str[16]; + int intr_idx = 0; + int find_flag = 0; + + /* get intr device index */ + for (intr_idx = 0; intr_idx < CTC_MAX_INTR_NUM; intr_idx++) + { + if (dal_isr[intr_idx].irq == irq) + { + find_flag = 1; + break; + } + } + + if (find_flag == 0) + { + printk ("irq%d is not registered! unregister failed \n", irq); + return -1; + } + + dal_isr[intr_idx].count--; + if (0 != dal_isr[intr_idx].count) + { + printk("Interrupt irq %d unregister count %d.\n", irq, dal_isr[intr_idx].count); + return -1; + } + snprintf(str, 16, "%s%d", "dal_intr", intr_idx); + + unregister_chrdev(DAL_DEV_INTR_MAJOR_BASE + intr_idx, str); + + free_irq(irq, &dal_isr[intr_idx]); + + dal_isr[intr_idx].irq = 0; + + dal_intr_num--; + + return 0; +} + +int +dal_interrupt_set_en(unsigned int irq, unsigned int enable) +{ + enable ? enable_irq(irq) : disable_irq_nosync(irq); + return 0; +} + +static int +_dal_set_msi_enabe(unsigned int lchip, unsigned int irq_num) +{ + int ret = 0; + + if (irq_num == 1) + { + ret = pci_enable_msi(dal_dev[lchip].pci_dev); + if (ret) + { + printk ("msi enable failed!!! lchip = %d, irq_num = %d\n", lchip, irq_num); + pci_disable_msi(dal_dev[lchip].pci_dev); + msi_used = 0; + } + + msi_irq_base[lchip] = dal_dev[lchip].pci_dev->irq; + msi_irq_num[lchip] = 1; + } + else + { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 79)) + ret = pci_enable_msi_exact(dal_dev[lchip].pci_dev, irq_num); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 26, 32)) + ret = pci_enable_msi_block(dal_dev[lchip].pci_dev, irq_num); +#else + ret = -1; +#endif + if (ret) + { + printk ("msi enable failed!!! lchip = %d, irq_num = %d\n", lchip, irq_num); + pci_disable_msi(dal_dev[lchip].pci_dev); + msi_used = 0; + } + + msi_irq_base[lchip] = dal_dev[lchip].pci_dev->irq; + msi_irq_num[lchip] = irq_num; + } + + return ret; +} + +static int +_dal_set_msi_disable(unsigned int lchip) +{ + + pci_disable_msi(dal_dev[lchip].pci_dev); + + msi_irq_base[lchip] = 0; + msi_irq_num[lchip] = 0; + + return 0; +} + +int +dal_set_msi_cap(unsigned long arg) +{ + int ret = 0; + dal_msi_info_t msi_info; + + if (copy_from_user(&msi_info, (void*)arg, sizeof(dal_msi_info_t))) + { + return -EFAULT; + } + + printk("####dal_set_msi_cap lchip %d base %d num:%d\n", msi_info.lchip, msi_info.irq_base, msi_info.irq_num); + if (msi_info.irq_num > 0) + { + msi_used = 1; + ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num); + } + else + { + msi_used = 0; + ret = _dal_set_msi_disable(msi_info.lchip); + } + + return ret; +} + +int +dal_user_interrupt_register(unsigned long arg) +{ + int irq = 0; + if (copy_from_user(&irq, (void*)arg, sizeof(int))) + { + return -EFAULT; + } + printk("####register interrupt irq:%d\n", irq); + return dal_interrupt_register(irq, 0, NULL, NULL); +} + +int +dal_user_interrupt_unregister(unsigned long arg) +{ + int irq = 0; + if (copy_from_user(&irq, (void*)arg, sizeof(int))) + { + return -EFAULT; + } + printk("####unregister interrupt irq:%d\n", irq); + return dal_interrupt_unregister(irq); +} + +int +dal_user_interrupt_set_en(unsigned long arg) +{ + dal_intr_parm_t dal_intr_parm; + + if (copy_from_user(&dal_intr_parm, (void*)arg, sizeof(dal_intr_parm_t))) + { + return -EFAULT; + } + + return dal_interrupt_set_en(dal_intr_parm.irq, dal_intr_parm.enable); +} + +/* + * Function: _dal_dma_segment_free + */ + +/* + * Function: _find_largest_segment + * + * Purpose: + * Find largest contiguous segment from a pool of DMA blocks. + * Parameters: + * dseg - DMA segment descriptor + * Returns: + * 0 on success, < 0 on error. + * Notes: + * Assembly stops if a segment of the requested segment size + * has been obtained. + * + * Lower address bits of the DMA blocks are used as follows: + * 0: Untagged + * 1: Discarded block + * 2: Part of largest contiguous segment + * 3: Part of current contiguous segment + */ +#ifndef DMA_MEM_MODE_PLATFORM +static int +_dal_find_largest_segment(dma_segment_t* dseg) +{ + int i, j, blks, found; + unsigned long seg_begin; + unsigned long seg_end; + unsigned long seg_tmp; + + blks = dseg->blk_cnt; + + /* Clear all block tags */ + for (i = 0; i < blks; i++) + { + dseg->blk_ptr[i] &= ~3; + } + + for (i = 0; i < blks && dseg->seg_size < dseg->req_size; i++) + { + /* First block must be an untagged block */ + if ((dseg->blk_ptr[i] & 3) == DAL_UNTAG_BLOCK) + { + /* Initial segment size is the block size */ + seg_begin = dseg->blk_ptr[i]; + seg_end = seg_begin + dseg->blk_size; + dseg->blk_ptr[i] |= DAL_CUR_MATCH_BLOCk; + + /* Loop looking for adjacent blocks */ + do + { + found = 0; + + for (j = i + 1; j < blks && (seg_end - seg_begin) < dseg->req_size; j++) + { + seg_tmp = dseg->blk_ptr[j]; + /* Check untagged blocks only */ + if ((seg_tmp & 3) == DAL_UNTAG_BLOCK) + { + if (seg_tmp == (seg_begin - dseg->blk_size)) + { + /* Found adjacent block below current segment */ + dseg->blk_ptr[j] |= DAL_CUR_MATCH_BLOCk; + seg_begin = seg_tmp; + found = 1; + } + else if (seg_tmp == seg_end) + { + /* Found adjacent block above current segment */ + dseg->blk_ptr[j] |= DAL_CUR_MATCH_BLOCk; + seg_end += dseg->blk_size; + found = 1; + } + } + } + } + while (found); + + if ((seg_end - seg_begin) > dseg->seg_size) + { + /* The current block is largest so far */ + dseg->seg_begin = seg_begin; + dseg->seg_end = seg_end; + dseg->seg_size = seg_end - seg_begin; + + /* Re-tag current and previous largest segment */ + for (j = 0; j < blks; j++) + { + if ((dseg->blk_ptr[j] & 3) == DAL_CUR_MATCH_BLOCk) + { + /* Tag current segment as the largest */ + dseg->blk_ptr[j] &= ~1; + } + else if ((dseg->blk_ptr[j] & 3) == DAL_MATCHED_BLOCK) + { + /* Discard previous largest segment */ + dseg->blk_ptr[j] ^= 3; + } + } + } + else + { + /* Discard all blocks in current segment */ + for (j = 0; j < blks; j++) + { + if ((dseg->blk_ptr[j] & 3) == DAL_CUR_MATCH_BLOCk) + { + dseg->blk_ptr[j] &= ~2; + } + } + } + } + } + + return 0; +} + +/* + * Function: _alloc_dma_blocks + */ +static int +_dal_alloc_dma_blocks(dma_segment_t* dseg, int blks) +{ + int i, start; + unsigned long addr; + + if (dseg->blk_cnt + blks > dseg->blk_cnt_max) + { + printk("No more DMA blocks\n"); + return -1; + } + + start = dseg->blk_cnt; + dseg->blk_cnt += blks; + + for (i = start; i < dseg->blk_cnt; i++) + { + addr = __get_free_pages(GFP_ATOMIC, dseg->blk_order); + if (addr) + { + dseg->blk_ptr[i] = addr; + } + else + { + printk("DMA allocation failed\n"); + return -1; + } + } + + return 0; +} + +/* + * Function: _dal_dma_segment_alloc + */ +static dma_segment_t* +_dal_dma_segment_alloc(unsigned int size, unsigned int blk_size) +{ + dma_segment_t* dseg; + int i, blk_ptr_size; + unsigned long page_addr; + struct sysinfo si; + + /* Sanity check */ + if (size == 0 || blk_size == 0) + { + return NULL; + } + + /* Allocate an initialize DMA segment descriptor */ + if ((dseg = kmalloc(sizeof(dma_segment_t), GFP_ATOMIC)) == NULL) + { + return NULL; + } + + memset(dseg, 0, sizeof(dma_segment_t)); + dseg->req_size = size; + dseg->blk_size = PAGE_ALIGN(blk_size); + + while ((PAGE_SIZE << dseg->blk_order) < dseg->blk_size) + { + dseg->blk_order++; + } + + si_meminfo(&si); + dseg->blk_cnt_max = (si.totalram << PAGE_SHIFT) / dseg->blk_size; + blk_ptr_size = dseg->blk_cnt_max * sizeof(unsigned long); + /* Allocate an initialize DMA block pool */ + dseg->blk_ptr = kmalloc(blk_ptr_size, GFP_KERNEL); + if (dseg->blk_ptr == NULL) + { + kfree(dseg); + return NULL; + } + + memset(dseg->blk_ptr, 0, blk_ptr_size); + /* Allocate minimum number of blocks */ + _dal_alloc_dma_blocks(dseg, dseg->req_size / dseg->blk_size); + + /* Allocate more blocks until we have a complete segment */ + do + { + _dal_find_largest_segment(dseg); + if (dseg->seg_size >= dseg->req_size) + { + break; + } + } + while (_dal_alloc_dma_blocks(dseg, 8) == 0); + + /* Reserve all pages in the DMA segment and free unused blocks */ + for (i = 0; i < dseg->blk_cnt; i++) + { + if ((dseg->blk_ptr[i] & 3) == 2) + { + dseg->blk_ptr[i] &= ~3; + + for (page_addr = dseg->blk_ptr[i]; + page_addr < dseg->blk_ptr[i] + dseg->blk_size; + page_addr += PAGE_SIZE) + { + MEM_MAP_RESERVE(VIRT_TO_PAGE((void*)page_addr)); + } + } + else if (dseg->blk_ptr[i]) + { + dseg->blk_ptr[i] &= ~3; + free_pages(dseg->blk_ptr[i], dseg->blk_order); + dseg->blk_ptr[i] = 0; + } + } + + return dseg; +} + +/* + * Function: _dal_dma_segment_free + */ +static void +_dal_dma_segment_free(dma_segment_t* dseg) +{ + int i; + unsigned long page_addr; + + if (dseg->blk_ptr) + { + for (i = 0; i < dseg->blk_cnt; i++) + { + if (dseg->blk_ptr[i]) + { + for (page_addr = dseg->blk_ptr[i]; + page_addr < dseg->blk_ptr[i] + dseg->blk_size; + page_addr += PAGE_SIZE) + { + MEM_MAP_UNRESERVE(VIRT_TO_PAGE(page_addr)); + } + + free_pages(dseg->blk_ptr[i], dseg->blk_order); + } + } + + kfree(dseg->blk_ptr); + kfree(dseg); + } +} + +/* + * Function: -dal_pgalloc + */ +static void* +_dal_pgalloc(unsigned int size) +{ + dma_segment_t* dseg; + unsigned int blk_size; + + blk_size = (size < DMA_BLOCK_SIZE) ? size : DMA_BLOCK_SIZE; + if ((dseg = _dal_dma_segment_alloc(size, blk_size)) == NULL) + { + return NULL; + } + + if (dseg->seg_size < size) + { + /* If we didn't get the full size then forget it */ + printk("Notice: Can not get enough memory for requset!!\n"); + printk("actual size:0x%lx, request size:0x%x\n", dseg->seg_size, size); + //-_dal_dma_segment_free(dseg); + //-return NULL; + } + + list_add(&dseg->list, &_dma_seg); + return (void*)dseg->seg_begin; +} + +/* + * Function: _dal_pgfree + */ +static int +_dal_pgfree(void* ptr) +{ + struct list_head* pos; + + list_for_each(pos, &_dma_seg) + { + dma_segment_t* dseg = list_entry(pos, dma_segment_t, list); + if (ptr == (void*)dseg->seg_begin) + { + list_del(&dseg->list); + _dal_dma_segment_free(dseg); + return 0; + } + } + return -1; +} +#endif +static void +dal_alloc_dma_pool(int lchip, int size) +{ + if (use_high_memory) + { + dma_phy_base[lchip] = virt_to_bus(high_memory); + dma_virt_base[lchip] = ioremap_nocache(dma_phy_base[lchip], size); + } + else + { +#ifdef DMA_MEM_MODE_PLATFORM + dma_virt_base[lchip] = dma_alloc_coherent(&(dal_dev[lchip].pci_dev->dev), dma_mem_size, + &dma_phy_base[lchip], GFP_KERNEL); + + printk(KERN_WARNING "########Using DMA_MEM_MODE_PLATFORM \n"); +#endif + +#ifndef DMA_MEM_MODE_PLATFORM + /* Get DMA memory from kernel */ + dma_virt_base_tmp[lchip] = _dal_pgalloc(size); + dma_phy_base[lchip] = virt_to_bus(dma_virt_base_tmp[lchip]); + dma_virt_base [lchip]= ioremap_nocache(dma_phy_base[lchip], size); +#endif + } +} + +static void +dal_free_dma_pool(int lchip) +{ + int ret = 0; + ret = ret; + if (use_high_memory) + { + iounmap(dma_virt_base[lchip]); + } + else + { +#ifdef DMA_MEM_MODE_PLATFORM + dma_free_coherent(&(dal_dev[lchip].pci_dev->dev), dma_mem_size, + dma_virt_base[lchip], dma_phy_base[lchip]); +#endif + +#ifndef DMA_MEM_MODE_PLATFORM + iounmap(dma_virt_base[lchip]); + ret = _dal_pgfree(dma_virt_base_tmp[lchip]); + if(ret<0) + { + printk("Dma free memory fail !!!!!! \n"); + } +#endif + } +} + +#define _KERNEL_DAL_IO +static int +_dal_pci_read(unsigned char lchip, unsigned int offset, unsigned int* value) +{ + if (!VERIFY_CHIP_INDEX(lchip)) + { + return -1; + } + + *value = *(volatile unsigned int*)(dal_dev[lchip].logic_address + offset); + return 0; +} + +int +dal_create_irq_mapping(unsigned long arg) +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) + dal_irq_mapping_t irq_map; + + if (copy_from_user(&irq_map, (void*)arg, sizeof(dal_irq_mapping_t))) + { + return -EFAULT; + } + + irq_map.sw_irq = irq_create_mapping(NULL, irq_map.hw_irq); + if (irq_map.sw_irq == NO_IRQ) + { + printk("IRQ mapping fail !!!!!! \n"); + return -1; + } + + if (copy_to_user((dal_irq_mapping_t*)arg, (void*)&irq_map, sizeof(dal_irq_mapping_t))) + { + return -EFAULT; + } +#endif + return 0; +} + +int +dal_pci_read(unsigned long arg) +{ + dal_chip_parm_t cmdpara_chip; + + if (copy_from_user(&cmdpara_chip, (void*)arg, sizeof(dal_chip_parm_t))) + { + return -EFAULT; + } + + _dal_pci_read((unsigned char)cmdpara_chip.chip_id, (unsigned int)cmdpara_chip.reg_addr, + (unsigned int*)(&(cmdpara_chip.value))); + + if (copy_to_user((dal_chip_parm_t*)arg, (void*)&cmdpara_chip, sizeof(dal_chip_parm_t))) + { + return -EFAULT; + } + + return 0; +} + +static int +_dal_pci_write(unsigned char lchip, unsigned int offset, unsigned int value) +{ + if (!VERIFY_CHIP_INDEX(lchip)) + { + return -1; + } + + *(volatile unsigned int*)(dal_dev[lchip].logic_address + offset) = value; + return 0; +} + +int +dal_pci_write(unsigned long arg) +{ + dal_chip_parm_t cmdpara_chip; + + if (copy_from_user(&cmdpara_chip, (void*)arg, sizeof(dal_chip_parm_t))) + { + return -EFAULT; + } + + _dal_pci_write((unsigned char)cmdpara_chip.chip_id, (unsigned int)cmdpara_chip.reg_addr, + (unsigned int)cmdpara_chip.value); + + return 0; +} + +int +dal_pci_conf_read(unsigned char lchip, unsigned int offset, unsigned int* value) +{ + if (!VERIFY_CHIP_INDEX(lchip)) + { + return -1; + } + + pci_read_config_dword(dal_dev[lchip].pci_dev, offset, value); + return 0; +} + +int +dal_pci_conf_write(unsigned char lchip, unsigned int offset, unsigned int value) +{ + if (!VERIFY_CHIP_INDEX(lchip)) + { + return -1; + } + + pci_write_config_dword(dal_dev[lchip].pci_dev, offset, value); + return 0; +} +int +dal_user_read_pci_conf(unsigned long arg) +{ + dal_pci_cfg_ioctl_t dal_cfg; + + if (copy_from_user(&dal_cfg, (void*)arg, sizeof(dal_pci_cfg_ioctl_t))) + { + return -EFAULT; + } + + if (dal_pci_conf_read(dal_cfg.chip_id, dal_cfg.offset, &dal_cfg.value)) + { + printk("dal_pci_conf_read failed.\n"); + return -EFAULT; + } + + if (copy_to_user((dal_pci_cfg_ioctl_t*)arg, (void*)&dal_cfg, sizeof(dal_pci_cfg_ioctl_t))) + { + return -EFAULT; + } + + return 0; +} + +int +dal_user_write_pci_conf(unsigned long arg) +{ + dal_pci_cfg_ioctl_t dal_cfg; + + if (copy_from_user(&dal_cfg, (void*)arg, sizeof(dal_pci_cfg_ioctl_t))) + { + return -EFAULT; + } + + return dal_pci_conf_write(dal_cfg.chip_id, dal_cfg.offset, dal_cfg.value); +} + +static int +linux_get_device(unsigned long arg) +{ + dal_user_dev_t user_dev; + int chip_id = 0; + + if (copy_from_user(&user_dev, (void*)arg, sizeof(user_dev))) + { + return -EFAULT; + } + + user_dev.chip_num = dal_chip_num; + chip_id = user_dev.chip_id; + + if (chip_id < dal_chip_num) + { + user_dev.phy_base0 = (unsigned int)dal_dev[chip_id].phys_address; + #ifdef PHYS_ADDR_IS_64BIT + user_dev.phy_base1 = (unsigned int)(dal_dev[chip_id].phys_address >> 32); + #else + user_dev.phy_base1 = 0; + #endif + + user_dev.bus_no = dal_dev[chip_id].pci_dev->bus->number; + user_dev.dev_no = dal_dev[chip_id].pci_dev->device; + user_dev.fun_no = dal_dev[chip_id].pci_dev->devfn; + } + + if (copy_to_user((dal_user_dev_t*)arg, (void*)&user_dev, sizeof(user_dev))) + { + return -EFAULT; + } + + return 0; +} + +/* set dal version, copy to user */ +static int +linux_get_dal_version(unsigned long arg) +{ + int dal_ver = VERSION_1DOT2; /* set dal version */ + + if (copy_to_user((int*)arg, (void*)&dal_ver, sizeof(dal_ver))) + { + return -EFAULT; + } + + dal_version = dal_ver; /* up sw */ + + return 0; +} + +static int +linux_get_dma_info(unsigned long arg) +{ + dma_info_t dma_para; + + if (copy_from_user(&dma_para, (void*)arg, sizeof(dma_info_t))) + { + return -EFAULT; + } + + dma_para.phy_base = (unsigned int)dma_phy_base[dma_para.lchip]; + #ifdef PHYS_ADDR_IS_64BIT + dma_para.phy_base_hi = dma_phy_base[dma_para.lchip] >> 32; + #else + dma_para.phy_base_hi = 0; + #endif + dma_para.size = dma_mem_size; + + if (copy_to_user((dma_info_t*)arg, (void*)&dma_para, sizeof(dma_info_t))) + { + return -EFAULT; + } + + return 0; +} + +static int +dal_get_msi_info(unsigned long arg) +{ + dal_msi_info_t msi_para; + unsigned int lchip = 0; + + /* get lchip form user mode */ + if (copy_from_user(&msi_para, (void*)arg, sizeof(dal_msi_info_t))) + { + return -EFAULT; + } + lchip = msi_para.lchip; + + msi_para.irq_base = msi_irq_base[lchip]; + msi_para.irq_num = msi_irq_num[lchip]; + + /* send msi info to user mode */ + if (copy_to_user((dal_msi_info_t*)arg, (void*)&msi_para, sizeof(dal_msi_info_t))) + { + return -EFAULT; + } + + return 0; +} + + +static int +dal_get_intr_info(unsigned long arg) +{ + dal_intr_info_t intr_para; + unsigned int intr_num = 0; + + /* get lchip form user mode */ + if (copy_from_user(&intr_para, (void*)arg, sizeof(dal_intr_info_t))) + { + return -EFAULT; + } + + intr_para.irq_idx = CTC_MAX_INTR_NUM; + for (intr_num=0; intr_num< CTC_MAX_INTR_NUM; intr_num++) + { + if (intr_para.irq == dal_isr[intr_num].irq) + { + intr_para.irq_idx = intr_num; + break; + } + } + + if (CTC_MAX_INTR_NUM == intr_para.irq_idx) + { + printk("Interrupt %d cann't find.\n", intr_para.irq); + } + /* send msi info to user mode */ + if (copy_to_user((dal_intr_info_t*)arg, (void*)&intr_para, sizeof(dal_intr_info_t))) + { + return -EFAULT; + } + + return 0; +} + +static int +dal_cache_inval(unsigned long arg) +{ + dal_dma_cache_info_t intr_para; + + if (copy_from_user(&intr_para, (void*)arg, sizeof(dal_dma_cache_info_t))) + { + return -EFAULT; + } + +#if 0 + dma_cache_wback_inv((unsigned long)intr_para.ptr, intr_para.length); +#endif + +#if 0 + dma_sync_single_for_cpu(NULL, intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL); +#endif + + dma_cache_sync(NULL, (void*)intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL); + + return 0; +} + +static int +dal_cache_flush(unsigned long arg) +{ + dal_dma_cache_info_t intr_para; + + if (copy_from_user(&intr_para, (void*)arg, sizeof(dal_dma_cache_info_t))) + { + return -EFAULT; + } + +#if 0 + dma_cache_wback_inv(intr_para.ptr, intr_para.length); +#endif + +#if 0 + dma_sync_single_for_cpu(NULL, intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL); +#endif + + dma_cache_sync(NULL, (void*)intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL); + + return 0; +} + +int +linux_dal_probe(struct pci_dev* pdev, const struct pci_device_id* id) +{ + dal_kern_dev_t* dev = NULL; + int bar = 0; + int ret = 0; + unsigned int temp = 0; + unsigned int lchip = 0; + unsigned int chip_id = 0; + + printk(KERN_WARNING "********found dal device*****\n"); + + for (chip_id = 0; chip_id < DAL_MAX_CHIP_NUM; chip_id ++) + { + if (NULL == dal_dev[chip_id].pci_dev) + { + break; + } + } + + if (chip_id >= DAL_MAX_CHIP_NUM) + { + printk("Exceed max local chip num\n"); + return -1; + } + + dev = &dal_dev[chip_id]; + if (NULL == dev) + { + printk("Cannot obtain PCI resources\n"); + } + + lchip = chip_id; + dal_chip_num += 1; + + dev->pci_dev = pdev; + + if (pci_enable_device(pdev) < 0) + { + printk("Cannot enable PCI device: vendor id = %x, device id = %x\n", + pdev->vendor, pdev->device); + } + + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); + if (ret) + { + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); + if (ret) + { + printk("Could not set PCI DMA Mask\n"); + return ret; + } + } + + if (pci_request_regions(pdev, DAL_NAME) < 0) + { + printk("Cannot obtain PCI resources\n"); + } + + dev->phys_address = pci_resource_start(pdev, bar); + dev->logic_address = (uintptr)ioremap_nocache(dev->phys_address, + pci_resource_len(dev->pci_dev, bar)); + + _dal_pci_read(lchip, 0x48, &temp); + if (((temp >> 8) & 0xffff) == 0x3412) + { + printk("Little endian Cpu detected!!! \n"); + _dal_pci_write(lchip, 0x48, 0xFFFFFFFF); + } + + pci_set_master(pdev); + + /* alloc dma_mem_size for every chip */ + if (dma_mem_size) + { + dal_alloc_dma_pool(lchip, dma_mem_size); + #ifdef PHYS_ADDR_IS_64BIT + + /*add check Dma memory pool cannot cross 4G space*/ + if ((0==(dma_phy_base[lchip]>>32)) && (0!=((dma_phy_base[lchip]+dma_mem_size)>>32))) + { + printk("Dma malloc memory cross 4G space!!!!!! \n"); + return -1; + } + #endif + } + + printk(KERN_WARNING "linux_dal_probe end*****\n"); + + return 0; +} + +void +linux_dal_remove(struct pci_dev* pdev) +{ + unsigned int chip_id = 0; + unsigned int flag = 0; + + for (chip_id = 0; chip_id < DAL_MAX_CHIP_NUM; chip_id ++) + { + if (pdev == dal_dev[chip_id].pci_dev) + { + flag = 1; + break; + } + } + + if (1 == flag) + { + dal_free_dma_pool(chip_id); + pci_release_regions(pdev); + pci_disable_device(pdev); + + dal_dev[chip_id].pci_dev = NULL; + dal_chip_num--; + } + + +} + +#ifdef CONFIG_COMPAT +static long +linux_dal_ioctl(struct file* file, + unsigned int cmd, unsigned long arg) +#else + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 13)) +static int +linux_dal_ioctl(struct file* file, + unsigned int cmd, unsigned long arg) +#else +static int +linux_dal_ioctl(struct inode* inode, struct file* file, + unsigned int cmd, unsigned long arg) +#endif + +#endif +{ + switch (cmd) + { + + case CMD_READ_CHIP: + return dal_pci_read(arg); + + case CMD_WRITE_CHIP: + return dal_pci_write(arg); + + case CMD_GET_DEVICES: + return linux_get_device(arg); + + case CMD_GET_DAL_VERSION: + return linux_get_dal_version(arg); + + case CMD_GET_DMA_INFO: + return linux_get_dma_info(arg); + + case CMD_PCI_CONFIG_READ: + return dal_user_read_pci_conf(arg); + + case CMD_PCI_CONFIG_WRITE: + return dal_user_write_pci_conf(arg); + + case CMD_REG_INTERRUPTS: + return dal_user_interrupt_register(arg); + + case CMD_UNREG_INTERRUPTS: + return dal_user_interrupt_unregister(arg); + + case CMD_EN_INTERRUPTS: + return dal_user_interrupt_set_en(arg); + + case CMD_SET_MSI_CAP: + return dal_set_msi_cap(arg); + + case CMD_GET_MSI_INFO: + return dal_get_msi_info(arg); + + case CMD_IRQ_MAPPING: + return dal_create_irq_mapping(arg); + + case CMD_GET_INTR_INFO: + return dal_get_intr_info(arg); + + case CMD_CACHE_INVAL: + return dal_cache_inval(arg); + + case CMD_CACHE_FLUSH: + return dal_cache_flush(arg); + + default: + break; + } + + return 0; +} + +static unsigned int +linux_dal_poll0(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[0], p); + local_irq_save(flags); + if (poll_intr_trigger[0]) + { + poll_intr_trigger[0] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll1(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[1], p); + local_irq_save(flags); + if (poll_intr_trigger[1]) + { + poll_intr_trigger[1] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll2(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[2], p); + local_irq_save(flags); + if (poll_intr_trigger[2]) + { + poll_intr_trigger[2] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll3(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[3], p); + local_irq_save(flags); + if (poll_intr_trigger[3]) + { + poll_intr_trigger[3] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll4(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[4], p); + local_irq_save(flags); + if (poll_intr_trigger[4]) + { + poll_intr_trigger[4] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll5(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[5], p); + local_irq_save(flags); + if (poll_intr_trigger[5]) + { + poll_intr_trigger[5] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll6(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[6], p); + local_irq_save(flags); + if (poll_intr_trigger[6]) + { + poll_intr_trigger[6] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll7(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[7], p); + local_irq_save(flags); + if (poll_intr_trigger[7]) + { + poll_intr_trigger[7] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static struct pci_driver linux_dal_driver = +{ + .name = DAL_NAME, + .id_table = dal_id_table, + .probe = linux_dal_probe, + .remove = linux_dal_remove, +}; + +static struct file_operations fops = +{ + .owner = THIS_MODULE, +#ifdef CONFIG_COMPAT + .compat_ioctl = linux_dal_ioctl, + .unlocked_ioctl = linux_dal_ioctl, +#else +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) + .unlocked_ioctl = linux_dal_ioctl, +#else + .ioctl = linux_dal_ioctl, +#endif +#endif +}; + + +static int __init +linux_dal_init(void) +{ + int ret = 0; + + /* Get DMA memory pool size form dal.ok input param, or use default dma_mem_size */ + if (dma_pool_size) + { + if ((dma_pool_size[strlen(dma_pool_size) - 1] & ~0x20) == 'M') + { + dma_mem_size = simple_strtoul(dma_pool_size, NULL, 0); + printk("dma_mem_size: 0x%x \n", dma_mem_size); + + dma_mem_size *= MB_SIZE; + } + else + { + printk("DMA memory pool size must be specified as e.g. dma_pool_size=8M\n"); + } + + if (dma_mem_size & (dma_mem_size - 1)) + { + printk("dma_mem_size must be a power of 2 (1M, 2M, 4M, 8M etc.)\n"); + dma_mem_size = 0; + } + } + + ret = register_chrdev(DAL_DEV_MAJOR, DAL_NAME, &fops); + if (ret < 0) + { + printk(KERN_WARNING "Register linux_dal device, ret %d\n", ret); + return ret; + } + + ret = pci_register_driver(&linux_dal_driver); + if (ret < 0) + { + printk(KERN_WARNING "Register ASIC PCI driver failed, ret %d\n", ret); + return ret; + } + + /* alloc /dev/linux_dal node */ + dal_class = class_create(THIS_MODULE, DAL_NAME); + device_create(dal_class, NULL, MKDEV(DAL_DEV_MAJOR, 0), NULL, DAL_NAME); + + /* init interrupt function */ + intr_handler_fun[0] = intr0_handler; + intr_handler_fun[1] = intr1_handler; + intr_handler_fun[2] = intr2_handler; + intr_handler_fun[3] = intr3_handler; + intr_handler_fun[4] = intr4_handler; + intr_handler_fun[5] = intr5_handler; + intr_handler_fun[6] = intr6_handler; + intr_handler_fun[7] = intr7_handler; + + return ret; +} + +static void __exit +linux_dal_exit(void) +{ + device_destroy(dal_class, MKDEV(DAL_DEV_MAJOR, 0)); + class_destroy(dal_class); + unregister_chrdev(DAL_DEV_MAJOR, "linux_dal"); + pci_unregister_driver(&linux_dal_driver); +} + +module_init(linux_dal_init); +module_exit(linux_dal_exit); + diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_kernel.h b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_kernel.h new file mode 100644 index 000000000000..de39af67773b --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_kernel.h @@ -0,0 +1,170 @@ +/** + @file dal_kernel_io.h + + @author Copyright (C) 2012 Centec Networks Inc. All rights reserved. + + @date 2012-4-9 + + @version v2.0 + +*/ +#ifndef _DAL_KERNEL_H_ +#define _DAL_KERNEL_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(CONFIG_RESOURCES_64BIT) || defined(CONFIG_PHYS_ADDR_T_64BIT) +#define PHYS_ADDR_IS_64BIT +#endif + +#ifndef SDK_IN_USERMODE +#ifdef PHYS_ADDR_IS_64BIT +typedef long long intptr; +typedef unsigned long long uintptr; +#else +typedef int intptr; +typedef unsigned int uintptr; +#endif +#endif + +#define DAL_PCI_READ_ADDR 0x0 +#define DAL_PCI_READ_DATA 0xc +#define DAL_PCI_WRITE_ADDR 0x8 +#define DAL_PCI_WRITE_DATA 0x4 +#define DAL_PCI_STATUS 0x10 + +#define DAL_PCI_STATUS_IN_PROCESS 31 +#define DAL_PCI_STATUS_BAD_PARITY 5 +#define DAL_PCI_STATUS_CPU_ACCESS_ERR 4 +#define DAL_PCI_STATUS_READ_CMD 3 +#define DAL_PCI_STATUS_REGISTER_ERR 1 +#define DAL_PCI_STATUS_REGISTER_ACK 0 + +#define DAL_PCI_ACCESS_TIMEOUT 0x64 + +#define DAL_NAME "linux_dal" /* "linux_dal" */ + +#define DAL_DEV_MAJOR 198 + +#define DAL_DEV_INTR_MAJOR_BASE 200 + +#define DAL_DEV_NAME "/dev/" DAL_NAME +#define DAL_ONE_KB 1024 +#define DAL_ONE_MB (1024*1024) +struct dal_chip_parm_s +{ + unsigned int chip_id; /*tmp should be uint8*/ + unsigned int fpga_id; /*tmp add*/ + unsigned int reg_addr; + unsigned int value; +}; +typedef struct dal_chip_parm_s dal_chip_parm_t; + +struct dal_intr_parm_s +{ + unsigned int irq; + unsigned int enable; +}; +typedef struct dal_intr_parm_s dal_intr_parm_t; + +struct dal_irq_mapping_s +{ + unsigned int hw_irq; + unsigned int sw_irq; +}; +typedef struct dal_irq_mapping_s dal_irq_mapping_t; + +struct dal_user_dev_s +{ + unsigned int chip_num; /*output: local chip number*/ + unsigned int chip_id; /*input: local chip id*/ + unsigned int phy_base0; /* low 32bits physical base address */ + unsigned int phy_base1; /* high 32bits physical base address */ + unsigned int bus_no; + unsigned int dev_no; + unsigned int fun_no; + void* virt_base[2]; /* Virtual base address; this must be last member */ +}; +typedef struct dal_user_dev_s dal_user_dev_t; + +struct dma_info_s +{ + unsigned int lchip; + unsigned int phy_base; + unsigned int phy_base_hi; + unsigned int size; + unsigned int* virt_base; +}; +typedef struct dma_info_s dma_info_t; + +struct dal_pci_cfg_ioctl_s +{ + unsigned int chip_id; /* Device ID */ + unsigned int offset; + unsigned int value; +}; +typedef struct dal_pci_cfg_ioctl_s dal_pci_cfg_ioctl_t; + +struct dal_msi_info_s +{ + unsigned int lchip; + unsigned int irq_base; + unsigned int irq_num; +}; +typedef struct dal_msi_info_s dal_msi_info_t; + +struct dal_intr_info_s +{ + unsigned int irq; + unsigned int irq_idx; +}; +typedef struct dal_intr_info_s dal_intr_info_t; + +struct dal_dma_cache_info_s +{ + unsigned long ptr; + unsigned int length; +}; +typedef struct dal_dma_cache_info_s dal_dma_cache_info_t; + +#define CMD_MAGIC 'C' +#define CMD_WRITE_CHIP _IO(CMD_MAGIC, 0) /* for humber ioctrol*/ +#define CMD_READ_CHIP _IO(CMD_MAGIC, 1) /* for humber ioctrol*/ +#define CMD_GET_DEVICES _IO(CMD_MAGIC, 2) +#define CMD_GET_DAL_VERSION _IO(CMD_MAGIC, 3) +#define CMD_PCI_CONFIG_WRITE _IO(CMD_MAGIC, 4) +#define CMD_PCI_CONFIG_READ _IO(CMD_MAGIC, 5) +#define CMD_GET_DMA_INFO _IO(CMD_MAGIC, 6) +#define CMD_REG_INTERRUPTS _IO(CMD_MAGIC, 7) +#define CMD_UNREG_INTERRUPTS _IO(CMD_MAGIC, 8) +#define CMD_EN_INTERRUPTS _IO(CMD_MAGIC, 9) +#define CMD_I2C_READ _IO(CMD_MAGIC, 10) +#define CMD_I2C_WRITE _IO(CMD_MAGIC, 11) +#define CMD_GET_MSI_INFO _IO(CMD_MAGIC, 12) +#define CMD_SET_MSI_CAP _IO(CMD_MAGIC, 13) +#define CMD_IRQ_MAPPING _IO(CMD_MAGIC, 14) +#define CMD_GET_INTR_INFO _IO(CMD_MAGIC, 15) +#define CMD_CACHE_INVAL _IO(CMD_MAGIC, 16) +#define CMD_CACHE_FLUSH _IO(CMD_MAGIC, 17) + +enum dal_version_e +{ + VERSION_MIN, + VERSION_1DOT0, + VERSION_1DOT1, + VERSION_1DOT2, + + VERSION_MAX +}; +typedef enum dal_version_e dal_version_t; + +/* We try to assemble a contiguous segment from chunks of this size */ +#define DMA_BLOCK_SIZE (512 * DAL_ONE_KB) + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_mpool.c b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_mpool.c new file mode 100644 index 000000000000..82d3b7a917a8 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_mpool.c @@ -0,0 +1,343 @@ + +#include "dal_mpool.h" + +#ifdef __KERNEL__ +#include +#include + +#define DAL_MALLOC(x) kmalloc(x, GFP_ATOMIC) +#define DAL_FREE(x) kfree(x) + +static spinlock_t dal_mpool_lock; +#define MPOOL_LOCK_INIT() spin_lock_init(&dal_mpool_lock) +#define MPOOL_LOCK() unsigned long flags; spin_lock_irqsave(&dal_mpool_lock, flags) +#define MPOOL_UNLOCK() spin_unlock_irqrestore(&dal_mpool_lock, flags) +#define DAL_PRINT(fmt,arg...) printk(fmt,##arg) +#else /* !__KERNEL__*/ + +#include +#include "sal.h" +#define DAL_MALLOC(x) malloc(x) +#define DAL_FREE(x) free(x) +static sal_mutex_t* dal_mpool_lock; +#define MPOOL_LOCK_INIT() sal_mutex_create(&dal_mpool_lock) +#define MPOOL_LOCK() sal_mutex_lock(dal_mpool_lock) +#define MPOOL_UNLOCK() sal_mutex_unlock(dal_mpool_lock) +#define DAL_PRINT(fmt,arg...) sal_printf(fmt,##arg) + +#endif /* __KERNEL__ */ + +dal_mpool_mem_t* g_free_block_ptr = NULL; + +/* System cache line size */ +#ifndef DAL_CACHE_LINE_BYTES +#define DAL_CACHE_LINE_BYTES 256 +#endif + +static dal_mpool_mem_t* p_desc_pool = NULL; +static dal_mpool_mem_t* p_data_pool = NULL; + +int +dal_mpool_init(void) +{ + MPOOL_LOCK_INIT(); + return 0; +} + +dal_mpool_mem_t* +_dal_mpool_create(void* base, int size, int type) +{ + dal_mpool_mem_t* head = NULL; + dal_mpool_mem_t* tail = NULL; + + head = (dal_mpool_mem_t*)DAL_MALLOC(sizeof(dal_mpool_mem_t)); + if (head == NULL) + { + return NULL; + } + + tail = (dal_mpool_mem_t*)DAL_MALLOC(sizeof(dal_mpool_mem_t)); + if (tail == NULL) + { + DAL_FREE(head); + return NULL; + } + + head->size = tail->size = 0; + head->type = type; + head->address = base; + tail->address = head->address + size; + head->next = tail; + tail->next = NULL; + + return head; +} + +dal_mpool_mem_t* +dal_mpool_create(void* base, int size) +{ + dal_mpool_mem_t* head = NULL; + int mod = (int)(((unsigned long)base) & (DAL_CACHE_LINE_BYTES - 1)); + + MPOOL_LOCK(); + + if (mod) + { + base = (char*)base + (DAL_CACHE_LINE_BYTES - mod); + size -= (DAL_CACHE_LINE_BYTES - mod); + } + + size &= ~(DAL_CACHE_LINE_BYTES - 1); + + /* init for common linkptr, only used for GB */ + head = _dal_mpool_create(base, size, DAL_MPOOL_TYPE_USELESS); + if (NULL == head) + { + MPOOL_UNLOCK(); + return NULL; + } + + /* init for desc linkptr */ + p_desc_pool = _dal_mpool_create(base, DAL_MPOOL_MAX_DESX_SIZE, DAL_MPOOL_TYPE_DESC); + if (NULL == p_desc_pool) + { + MPOOL_UNLOCK(); + DAL_FREE(head->next); + DAL_FREE(head); + return NULL; + } + + /* init for data linkptr */ + p_data_pool = _dal_mpool_create(((char*)base+DAL_MPOOL_MAX_DESX_SIZE), (size - DAL_MPOOL_MAX_DESX_SIZE), DAL_MPOOL_TYPE_DATA); + if (NULL == p_data_pool) + { + MPOOL_UNLOCK(); + DAL_FREE(head->next); + DAL_FREE(head); + DAL_FREE(p_desc_pool->next); + DAL_FREE(p_desc_pool); + return NULL; + } + + MPOOL_UNLOCK(); + + return head; +} + +dal_mpool_mem_t* +_dal_mpool_alloc_comon(dal_mpool_mem_t* ptr, int size, int type) +{ + dal_mpool_mem_t* new_ptr = NULL; + + while (ptr && ptr->next) + { + if (ptr->next->address - (ptr->address + ptr->size) >= size) + { + break; + } + + ptr = ptr->next; + } + + if (!(ptr && ptr->next)) + { + return NULL; + } + + new_ptr = DAL_MALLOC(sizeof(dal_mpool_mem_t)); + if (!new_ptr) + { + return NULL; + } + + new_ptr->type = type; + new_ptr->address = ptr->address + ptr->size; + new_ptr->size = size; + new_ptr->next = ptr->next; + ptr->next = new_ptr; + + return new_ptr; +} + +void* +dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type) +{ + dal_mpool_mem_t* ptr = NULL; + dal_mpool_mem_t* new_ptr = NULL; + int mod; + + MPOOL_LOCK(); + + mod = size & (DAL_CACHE_LINE_BYTES - 1); + if (mod != 0) + { + size += (DAL_CACHE_LINE_BYTES - mod); + } + + switch(type) + { + case DAL_MPOOL_TYPE_USELESS: + ptr = pool; + new_ptr = _dal_mpool_alloc_comon(ptr, size, type); + if (NULL == new_ptr) + { + MPOOL_UNLOCK(); + return NULL; + } + break; + case DAL_MPOOL_TYPE_DESC: + ptr = p_desc_pool; + new_ptr = _dal_mpool_alloc_comon(ptr, size, type); + if (NULL == new_ptr) + { + MPOOL_UNLOCK(); + return NULL; + } + break; + case DAL_MPOOL_TYPE_DATA: + ptr = p_data_pool; + new_ptr = _dal_mpool_alloc_comon(ptr, size, type); + if (NULL == new_ptr) + { + MPOOL_UNLOCK(); + return NULL; + } + break; + default: + MPOOL_UNLOCK(); + return NULL; + break; + } + + MPOOL_UNLOCK(); + + return new_ptr->address; +} + +void +_dal_mpool_free(dal_mpool_mem_t* ptr, void* addr, int type) +{ + unsigned char* address = (unsigned char*)addr; + dal_mpool_mem_t* prev = NULL; + + while (ptr && ptr->next) + { + if (ptr->next->address == address) + { + break; + } + + ptr = ptr->next; + } + + if (ptr && ptr->next) + { + prev = ptr; + ptr = ptr->next; + prev->next = ptr->next; + DAL_FREE(ptr); + } + + return; +} + +void +dal_mpool_free(dal_mpool_mem_t* pool, void* addr) +{ + dal_mpool_mem_t* ptr = pool; + + MPOOL_LOCK(); + + switch(pool->type) + { + case DAL_MPOOL_TYPE_USELESS: + ptr = pool; + _dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_USELESS); + break; + case DAL_MPOOL_TYPE_DESC: + ptr = p_desc_pool; + _dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_DESC); + break; + case DAL_MPOOL_TYPE_DATA: + ptr = p_data_pool; + _dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_DATA); + break; + default: + break; + } + + MPOOL_UNLOCK(); + return; +} + +int +dal_mpool_destroy(dal_mpool_mem_t* pool) +{ + dal_mpool_mem_t* ptr, * next; + + MPOOL_LOCK(); + + for (ptr = pool; ptr; ptr = next) + { + next = ptr->next; + DAL_FREE(ptr); + } + + for (ptr = p_desc_pool; ptr; ptr = next) + { + next = ptr->next; + DAL_FREE(ptr); + } + + for (ptr = p_data_pool; ptr; ptr = next) + { + next = ptr->next; + DAL_FREE(ptr); + } + + MPOOL_UNLOCK(); + + return 0; +} + +int +dal_mpool_usage(dal_mpool_mem_t* pool, int type) +{ + int usage = 0; + dal_mpool_mem_t* ptr; + + MPOOL_LOCK(); + + for (ptr = pool; ptr; ptr = ptr->next) + { + if (ptr->type == type || ptr->type == -1) + { + usage += ptr->size; + } + } + + MPOOL_UNLOCK(); + + return usage; +} + +int +dal_mpool_debug(dal_mpool_mem_t* pool) +{ + dal_mpool_mem_t* ptr; + int index = 0; + + MPOOL_LOCK(); + + for (ptr = pool; ptr; ptr = ptr->next) + { +// DAL_PRINT("%2dst mpool block: address=0x%8x, size=0x%x \n", index, (unsigned int)ptr->address, ptr->size); + DAL_PRINT("%2dst mpool block: address=%p, size=0x%x \n", index, ptr->address, ptr->size); // note + index++; + } + + MPOOL_UNLOCK(); + + return 0; +} + diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_mpool.h b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_mpool.h new file mode 100644 index 000000000000..a1fa37d05f82 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/dal_mpool.h @@ -0,0 +1,71 @@ +/** + @file dal_mpool.h + + @author Copyright (C) 2011 Centec Networks Inc. All rights reserved. + + @date 2012-5-10 + + @version v2.0 + + This file contains the dma memory init, allocation and free APIs +*/ + +#ifndef _DMA_MPOOL_H +#define _DMA_MPOOL_H +#ifdef __cplusplus +extern "C" { +#endif + +#define DAL_MPOOL_MAX_DESX_SIZE (1024*1024) + +enum dal_mpool_type_e +{ + DAL_MPOOL_TYPE_USELESS, /* just compatible with GB */ + DAL_MPOOL_TYPE_DESC, /* dma mpool op for desc */ + DAL_MPOOL_TYPE_DATA /* dma mpool op for data */ +}; +typedef enum dal_mpool_type_e dal_mpool_type_t; + +struct dal_mpool_mem_s +{ + unsigned char* address; + int size; + int type; + struct dal_mpool_mem_s* next; +}; +typedef struct dal_mpool_mem_s dal_mpool_mem_t; + +/** + @brief This function is to alloc dma memory + + @param[in] size size of memory + + @return NULL + +*/ +extern int +dal_mpool_init(void); + +extern dal_mpool_mem_t* +dal_mpool_create(void* base_ptr, int size); + +extern void* +dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type); + +extern void +dal_mpool_free(dal_mpool_mem_t* pool, void* addr); + +extern int +dal_mpool_destroy(dal_mpool_mem_t* pool); + +extern int +dal_mpool_usage(dal_mpool_mem_t* pool, int type); + +extern int +dal_mpool_debug(dal_mpool_mem_t* pool); +#ifdef __cplusplus +} +#endif + +#endif /* !_DMA_MPOOL_H */ + diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/scripts/48x2q4z_platform.sh b/platform/centec/sonic-platform-modules-e582/48x2q4z/scripts/48x2q4z_platform.sh new file mode 100755 index 000000000000..2caae94f03e7 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/scripts/48x2q4z_platform.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +#platform init script for centec e582-48x2q4z + +init_devnum() { + found=0 + for devnum in 0 1; do + devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name` + # I801 adapter can be at either dffd0000 or dfff0000 + if [[ $devname == 'SMBus I801 adapter at '* ]]; then + found=1 + break + fi + done + + [ $found -eq 0 ] && echo "cannot find I801" && exit 1 +} + +init_devnum + +if [ "$1" == "init" ]; then + depmod -a + modprobe i2c-dev + modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe centec_e582_48x2q4z_platform + modprobe dal + modprobe centec_at24c64 +elif [ "$1" == "deinit" ]; then + modprobe -r centec_at24c64 + modprobe -r dal + modprobe -r centec_e582_48x2q4z_platform + modprobe -r i2c-mux-pca954x + modprobe -r i2c-dev +else + echo "e582-48x2q4z_platform : Invalid option !" +fi diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/cfg/48x6q-modules.conf b/platform/centec/sonic-platform-modules-e582/48x6q/cfg/48x6q-modules.conf new file mode 100644 index 000000000000..7a7881c8c0d3 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/cfg/48x6q-modules.conf @@ -0,0 +1,14 @@ +# /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-dev +i2c-mux +i2c-smbus + +i2c-mux-pca954x +lm77 +adt7470 +tun diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/cfg/config_db.json b/platform/centec/sonic-platform-modules-e582/48x6q/cfg/config_db.json new file mode 100644 index 000000000000..c75eb1284f66 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/cfg/config_db.json @@ -0,0 +1,303 @@ +{ + "DEVICE_METADATA": { + "localhost": { + "bgp_asn": 65100, + "deployment_id": null, + "hostname": "switch1", + "type": "LeafRouter", + "hwsku": "E582-48x6q" + + } + }, + "BGP_PEER_RANGE": {}, + "VLAN": {}, + "PORT": { + "Ethernet1": { + "alias": "Ethernet1", + "lanes": "4", + "speed": "1000" + }, + "Ethernet2": { + "alias": "Ethernet2", + "lanes": "5", + "speed": "1000" + }, + "Ethernet3": { + "alias": "Ethernet3", + "lanes": "6", + "speed": "1000" + }, + "Ethernet4": { + "alias": "Ethernet4", + "lanes": "8", + "speed": "1000" + }, + "Ethernet5": { + "alias": "Ethernet5", + "lanes": "9", + "speed": "1000" + }, + "Ethernet6": { + "alias": "Ethernet6", + "lanes": "10", + "speed": "1000" + }, + "Ethernet7": { + "alias": "Ethernet7", + "lanes": "12", + "speed": "1000" + }, + "Ethernet8": { + "alias": "Ethernet8", + "lanes": "13", + "speed": "1000" + }, + "Ethernet9": { + "alias": "Ethernet9", + "lanes": "14", + "speed": "1000" + }, + "Ethernet10": { + "alias": "Ethernet10", + "lanes": "16", + "speed": "1000" + }, + "Ethernet11": { + "alias": "Ethernet11", + "lanes": "17", + "speed": "1000" + }, + "Ethernet12": { + "alias": "Ethernet12", + "lanes": "18", + "speed": "1000" + }, + "Ethernet13": { + "alias": "Ethernet13", + "lanes": "20", + "speed": "10000" + }, + "Ethernet14": { + "alias": "Ethernet14", + "lanes": "21", + "speed": "10000" + }, + "Ethernet15": { + "alias": "Ethernet15", + "lanes": "22", + "speed": "10000" + }, + "Ethernet16": { + "alias": "Ethernet16", + "lanes": "24", + "speed": "10000" + }, + "Ethernet17": { + "alias": "Ethernet17", + "lanes": "25", + "speed": "10000" + }, + "Ethernet18": { + "alias": "Ethernet18", + "lanes": "26", + "speed": "10000" + }, + "Ethernet19": { + "alias": "Ethernet19", + "lanes": "28", + "speed": "10000" + }, + "Ethernet20": { + "alias": "Ethernet20", + "lanes": "30", + "speed": "10000" + }, + "Ethernet21": { + "alias": "Ethernet21", + "lanes": "31", + "speed": "10000" + }, + "Ethernet22": { + "alias": "Ethernet22", + "lanes": "32", + "speed": "10000" + }, + "Ethernet23": { + "alias": "Ethernet23", + "lanes": "34", + "speed": "10000" + }, + "Ethernet24": { + "alias": "Ethernet24", + "lanes": "35", + "speed": "10000" + }, + "Ethernet25": { + "alias": "Ethernet25", + "lanes": "40", + "speed": "10000" + }, + "Ethernet26": { + "alias": "Ethernet26", + "lanes": "41", + "speed": "10000" + }, + "Ethernet27": { + "alias": "Ethernet27", + "lanes": "43", + "speed": "10000" + }, + "Ethernet28": { + "alias": "Ethernet28", + "lanes": "36", + "speed": "10000" + }, + "Ethernet29": { + "alias": "Ethernet29", + "lanes": "37", + "speed": "10000" + }, + "Ethernet30": { + "alias": "Ethernet30", + "lanes": "39", + "speed": "10000" + }, + "Ethernet31": { + "alias": "Ethernet31", + "lanes": "44", + "speed": "10000" + }, + "Ethernet32": { + "alias": "Ethernet32", + "lanes": "45", + "speed": "10000" + }, + "Ethernet33": { + "alias": "Ethernet33", + "lanes": "46", + "speed": "10000" + }, + "Ethernet34": { + "alias": "Ethernet34", + "lanes": "47", + "speed": "10000" + }, + "Ethernet35": { + "alias": "Ethernet35", + "lanes": "80", + "speed": "10000" + }, + "Ethernet36": { + "alias": "Ethernet36", + "lanes": "81", + "speed": "10000" + }, + "Ethernet37": { + "alias": "Ethernet37", + "lanes": "82", + "speed": "10000" + }, + "Ethernet38": { + "alias": "Ethernet38", + "lanes": "88", + "speed": "10000" + }, + "Ethernet39": { + "alias": "Ethernet39", + "lanes": "89", + "speed": "10000" + }, + "Ethernet40": { + "alias": "Ethernet40", + "lanes": "90", + "speed": "10000" + }, + "Ethernet41": { + "alias": "Ethernet41", + "lanes": "84", + "speed": "10000" + }, + "Ethernet42": { + "alias": "Ethernet42", + "lanes": "85", + "speed": "10000" + }, + "Ethernet43": { + "alias": "Ethernet43", + "lanes": "86", + "speed": "10000" + }, + "Ethernet44": { + "alias": "Ethernet44", + "lanes": "87", + "speed": "10000" + }, + "Ethernet45": { + "alias": "Ethernet45", + "lanes": "92", + "speed": "10000" + }, + "Ethernet46": { + "alias": "Ethernet46", + "lanes": "93", + "speed": "10000" + }, + "Ethernet47": { + "alias": "Ethernet47", + "lanes": "94", + "speed": "10000" + }, + "Ethernet48": { + "alias": "Ethernet48", + "lanes": "95", + "speed": "10000" + }, + "Ethernet49": { + "alias": "Ethernet49", + "lanes": "52,53,54,55", + "speed": "40000" + }, + "Ethernet50": { + "alias": "Ethernet50", + "lanes": "56,57,58,59", + "speed": "40000" + }, + "Ethernet51": { + "alias": "Ethernet51", + "lanes": "60,61,62,63", + "speed": "40000" + }, + "Ethernet52": { + "alias": "Ethernet52", + "lanes": "68,69,70,71", + "speed": "40000" + }, + "Ethernet53": { + "alias": "Ethernet53", + "lanes": "72,73,74,75", + "speed": "40000" + }, + "Ethernet54": { + "alias": "Ethernet54", + "lanes": "76,77,78,79", + "speed": "40000" + } + }, + "SYSLOG_SERVER": {}, + "VLAN_INTERFACE": {}, + "PORTCHANNEL_INTERFACE": {}, + "PORTCHANNEL": {}, + "MGMT_INTERFACE": {}, + "DHCP_SERVER": {}, + "LOOPBACK_INTERFACE": { + "Loopback0|127.0.0.1/8": {} + }, + "ACL_TABLE": {}, + "INTERFACE": { + "Ethernet1|192.168.1.1/24": {}, + "Ethernet2|192.168.2.1/24": {}, + "Ethernet3|192.168.3.1/24": {}, + "Ethernet4|192.168.4.1/24": {} + } +} + diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/cfg/config_db_l2l3.json b/platform/centec/sonic-platform-modules-e582/48x6q/cfg/config_db_l2l3.json new file mode 100644 index 000000000000..e9d9a3bb5e4b --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/cfg/config_db_l2l3.json @@ -0,0 +1,610 @@ +{ + "QUEUE": { + "Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|0-2": { + "wred_profile": "[WRED_PROFILE|AZURE_LOSSY]" + }, + "Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|3-4": { + "wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]", + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|5-7": { + "wred_profile": "[WRED_PROFILE|AZURE_LOSSY]" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS": { + "red_max_threshold": "32760", + "yellow_max_threshold": "32760", + "green_min_threshold": "4095", + "red_min_threshold": "4095", + "yellow_min_threshold": "4095", + "green_max_threshold": "32760", + "wred_yellow_enable": "true", + "wred_green_enable": "true" + }, + "AZURE_LOSSY": { + "red_max_threshold": "32760", + "yellow_max_threshold": "32760", + "green_min_threshold": "4095", + "red_min_threshold": "4095", + "yellow_min_threshold": "4095", + "green_max_threshold": "32760", + "wred_yellow_enable": "true", + "wred_green_enable": "true" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "56": "7", + "54": "6", + "28": "3", + "48": "6", + "29": "3", + "60": "7", + "61": "7", + "62": "7", + "63": "7", + "49": "6", + "34": "4", + "24": "3", + "25": "3", + "26": "3", + "27": "3", + "20": "2", + "21": "2", + "22": "2", + "23": "2", + "46": "5", + "47": "5", + "44": "5", + "45": "5", + "42": "5", + "43": "5", + "40": "5", + "41": "5", + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "5": "0", + "4": "0", + "7": "0", + "6": "0", + "9": "1", + "8": "1", + "35": "4", + "13": "1", + "12": "1", + "15": "1", + "58": "7", + "11": "1", + "10": "1", + "39": "4", + "38": "4", + "59": "7", + "14": "1", + "17": "2", + "16": "2", + "19": "2", + "18": "2", + "31": "3", + "30": "3", + "51": "6", + "36": "4", + "53": "6", + "52": "6", + "33": "4", + "55": "6", + "37": "4", + "32": "4", + "57": "7", + "50": "6" + } + }, + "DEVICE_METADATA": { + "localhost": { + "hwsku": "E582-48x6q", + "hostname": "switch1", + "bgp_asn": "None", + "deployment_id": "None", + "type": "LeafRouter" + } + }, + "PORT": { + "Ethernet1": { + "alias": "Ethernet1", + "lanes": "4", + "speed": "1000" + }, + "Ethernet2": { + "alias": "Ethernet2", + "lanes": "5", + "speed": "1000" + }, + "Ethernet3": { + "alias": "Ethernet3", + "lanes": "6", + "speed": "1000" + }, + "Ethernet4": { + "alias": "Ethernet4", + "lanes": "8", + "speed": "1000" + }, + "Ethernet5": { + "alias": "Ethernet5", + "lanes": "9", + "speed": "1000" + }, + "Ethernet6": { + "alias": "Ethernet6", + "lanes": "10", + "speed": "1000" + }, + "Ethernet7": { + "alias": "Ethernet7", + "lanes": "12", + "speed": "1000" + }, + "Ethernet8": { + "alias": "Ethernet8", + "lanes": "13", + "speed": "1000" + }, + "Ethernet9": { + "alias": "Ethernet9", + "lanes": "14", + "speed": "1000" + }, + "Ethernet10": { + "alias": "Ethernet10", + "lanes": "16", + "speed": "1000" + }, + "Ethernet11": { + "alias": "Ethernet11", + "lanes": "17", + "speed": "1000" + }, + "Ethernet12": { + "alias": "Ethernet12", + "lanes": "18", + "speed": "1000" + }, + "Ethernet13": { + "alias": "Ethernet13", + "lanes": "20", + "speed": "10000" + }, + "Ethernet14": { + "alias": "Ethernet14", + "lanes": "21", + "speed": "10000" + }, + "Ethernet15": { + "alias": "Ethernet15", + "lanes": "22", + "speed": "10000" + }, + "Ethernet16": { + "alias": "Ethernet16", + "lanes": "24", + "speed": "10000" + }, + "Ethernet17": { + "alias": "Ethernet17", + "lanes": "25", + "speed": "10000" + }, + "Ethernet18": { + "alias": "Ethernet18", + "lanes": "26", + "speed": "10000" + }, + "Ethernet19": { + "alias": "Ethernet19", + "lanes": "28", + "speed": "10000" + }, + "Ethernet20": { + "alias": "Ethernet20", + "lanes": "30", + "speed": "10000" + }, + "Ethernet21": { + "alias": "Ethernet21", + "lanes": "31", + "speed": "10000" + }, + "Ethernet22": { + "alias": "Ethernet22", + "lanes": "32", + "speed": "10000" + }, + "Ethernet23": { + "alias": "Ethernet23", + "lanes": "34", + "speed": "10000" + }, + "Ethernet24": { + "alias": "Ethernet24", + "lanes": "35", + "speed": "10000" + }, + "Ethernet25": { + "alias": "Ethernet25", + "lanes": "40", + "speed": "10000" + }, + "Ethernet26": { + "alias": "Ethernet26", + "lanes": "41", + "speed": "10000" + }, + "Ethernet27": { + "alias": "Ethernet27", + "lanes": "43", + "speed": "10000" + }, + "Ethernet28": { + "alias": "Ethernet28", + "lanes": "36", + "speed": "10000" + }, + "Ethernet29": { + "alias": "Ethernet29", + "lanes": "37", + "speed": "10000" + }, + "Ethernet30": { + "alias": "Ethernet30", + "lanes": "39", + "speed": "10000" + }, + "Ethernet31": { + "alias": "Ethernet31", + "lanes": "44", + "speed": "10000" + }, + "Ethernet32": { + "alias": "Ethernet32", + "lanes": "45", + "speed": "10000" + }, + "Ethernet33": { + "alias": "Ethernet33", + "lanes": "46", + "speed": "10000" + }, + "Ethernet34": { + "alias": "Ethernet34", + "lanes": "47", + "speed": "10000" + }, + "Ethernet35": { + "alias": "Ethernet35", + "lanes": "80", + "speed": "10000" + }, + "Ethernet36": { + "alias": "Ethernet36", + "lanes": "81", + "speed": "10000" + }, + "Ethernet37": { + "alias": "Ethernet37", + "lanes": "82", + "speed": "10000" + }, + "Ethernet38": { + "alias": "Ethernet38", + "lanes": "88", + "speed": "10000" + }, + "Ethernet39": { + "alias": "Ethernet39", + "lanes": "89", + "speed": "10000" + }, + "Ethernet40": { + "alias": "Ethernet40", + "lanes": "90", + "speed": "10000" + }, + "Ethernet41": { + "alias": "Ethernet41", + "lanes": "84", + "speed": "10000" + }, + "Ethernet42": { + "alias": "Ethernet42", + "lanes": "85", + "speed": "10000" + }, + "Ethernet43": { + "alias": "Ethernet43", + "lanes": "86", + "speed": "10000" + }, + "Ethernet44": { + "alias": "Ethernet44", + "lanes": "87", + "speed": "10000" + }, + "Ethernet45": { + "alias": "Ethernet45", + "lanes": "92", + "speed": "10000" + }, + "Ethernet46": { + "alias": "Ethernet46", + "lanes": "93", + "speed": "10000" + }, + "Ethernet47": { + "alias": "Ethernet47", + "lanes": "94", + "speed": "10000" + }, + "Ethernet48": { + "alias": "Ethernet48", + "lanes": "95", + "speed": "10000" + }, + "Ethernet49": { + "alias": "Ethernet49", + "lanes": "52,53,54,55", + "speed": "40000" + }, + "Ethernet50": { + "alias": "Ethernet50", + "lanes": "56,57,58,59", + "speed": "40000" + }, + "Ethernet51": { + "alias": "Ethernet51", + "lanes": "60,61,62,63", + "speed": "40000" + }, + "Ethernet52": { + "alias": "Ethernet52", + "lanes": "68,69,70,71", + "speed": "40000" + }, + "Ethernet53": { + "alias": "Ethernet53", + "lanes": "72,73,74,75", + "speed": "40000" + }, + "Ethernet54": { + "alias": "Ethernet54", + "lanes": "76,77,78,79", + "speed": "40000" + } + }, + "PORT_QOS_MAP": { + "Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54": { + "pfc_enable": "3,4", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type": "DWRR", + "weight": "25" + }, + "scheduler.1": { + "type": "DWRR", + "weight": "30" + }, + "scheduler.2": { + "type": "DWRR", + "weight": "20" + } + }, + "VLAN": { + "Vlan500": { + "dhcp_servers": [ + "192.168.5.1", + "192.168.5.2", + "192.168.5.3", + "192.168.5.4" + ], + "members": [ + "Ethernet5", + "Ethernet6", + "Ethernet7", + "Ethernet8" + ], + "vlanid": "500" + }, + "Vlan600": { + "dhcp_servers": [ + "192.168.6.1", + "192.168.6.2", + "192.168.6.3", + "192.168.6.4" + ], + "members": [ + "Ethernet5", + "Ethernet6" + ], + "vlanid": "600" + }, + "Vlan700": { + "dhcp_servers": [ + "192.168.7.1", + "192.168.7.2", + "192.168.7.3", + "192.168.7.4" + ], + "members": [ + "Ethernet5", + "Ethernet7" + ], + "vlanid": "700" + }, + "Vlan800": { + "dhcp_servers": [ + "192.168.8.1", + "192.168.8.2", + "192.168.8.3", + "192.168.8.4" + ], + "members": [ + "Ethernet5", + "Ethernet8" + ], + "vlanid": "800" + } + }, + "VLAN_MEMBER": { + "Vlan500|Ethernet5": { + "tagging_mode": "tagged" + }, + "Vlan500|Ethernet6": { + "tagging_mode": "untagged" + }, + "Vlan500|Ethernet7": { + "tagging_mode": "untagged" + }, + "Vlan500|Ethernet8": { + "tagging_mode": "untagged" + }, + "Vlan600|Ethernet5": { + "tagging_mode": "tagged" + }, + "Vlan600|Ethernet6": { + "tagging_mode": "tagged" + }, + "Vlan700|Ethernet5": { + "tagging_mode": "tagged" + }, + "Vlan700|Ethernet7": { + "tagging_mode": "tagged" + }, + "Vlan800|Ethernet5": { + "tagging_mode": "tagged" + }, + "Vlan800|Ethernet8": { + "tagging_mode": "tagged" + } + }, + "INTERFACE": { + "Ethernet1|192.168.1.1/24": {}, + "Ethernet2|192.168.2.1/24": {}, + "Ethernet3|192.168.3.1/24": {}, + "Ethernet4|192.168.4.1/24": {} + }, + "VLAN_INTERFACE": { + "Vlan500|192.168.5.1/24": {}, + "Vlan600|192.168.6.1/24": {}, + "Vlan700|192.168.7.1/24": {}, + "Vlan800|192.168.8.1/24": {} + }, + "LOOPBACK_INTERFACE": { + "Loopback0|127.0.0.1/8": {} + }, + "CABLE_LENGTH": { + "AZURE": { + "Ethernet8": "40m", + "Ethernet9": "40m", + "Ethernet2": "40m", + "Ethernet3": "40m", + "Ethernet1": "40m", + "Ethernet6": "40m", + "Ethernet7": "40m", + "Ethernet4": "40m", + "Ethernet5": "40m", + "Ethernet22": "40m", + "Ethernet50": "40m", + "Ethernet51": "40m", + "Ethernet52": "40m", + "Ethernet53": "40m", + "Ethernet54": "40m", + "Ethernet38": "40m", + "Ethernet39": "40m", + "Ethernet18": "40m", + "Ethernet19": "40m", + "Ethernet14": "40m", + "Ethernet15": "40m", + "Ethernet16": "40m", + "Ethernet17": "40m", + "Ethernet10": "40m", + "Ethernet11": "40m", + "Ethernet12": "40m", + "Ethernet35": "40m", + "Ethernet37": "40m", + "Ethernet32": "40m", + "Ethernet33": "40m", + "Ethernet30": "40m", + "Ethernet31": "40m", + "Ethernet49": "40m", + "Ethernet48": "40m", + "Ethernet47": "40m", + "Ethernet36": "40m", + "Ethernet45": "40m", + "Ethernet44": "40m", + "Ethernet43": "40m", + "Ethernet42": "40m", + "Ethernet41": "40m", + "Ethernet40": "40m", + "Ethernet29": "40m", + "Ethernet28": "40m", + "Ethernet34": "40m", + "Ethernet46": "40m", + "Ethernet21": "40m", + "Ethernet20": "40m", + "Ethernet23": "40m", + "Ethernet13": "40m", + "Ethernet25": "40m", + "Ethernet24": "40m", + "Ethernet27": "40m", + "Ethernet26": "40m" + } + }, + "CRM": { + "Config": { + "acl_table_threshold_type": "percentage", + "nexthop_group_threshold_type": "percentage", + "fdb_entry_high_threshold": "85", + "acl_entry_threshold_type": "percentage", + "ipv6_neighbor_low_threshold": "70", + "nexthop_group_member_low_threshold": "70", + "acl_group_high_threshold": "85", + "ipv4_route_high_threshold": "85", + "acl_counter_high_threshold": "85", + "ipv4_route_low_threshold": "70", + "ipv4_route_threshold_type": "percentage", + "ipv4_neighbor_low_threshold": "70", + "acl_group_threshold_type": "percentage", + "ipv4_nexthop_high_threshold": "85", + "ipv6_route_threshold_type": "percentage", + "nexthop_group_low_threshold": "70", + "ipv4_neighbor_high_threshold": "85", + "ipv6_route_high_threshold": "85", + "ipv6_nexthop_threshold_type": "percentage", + "polling_interval": "300", + "ipv4_nexthop_threshold_type": "percentage", + "acl_group_low_threshold": "70", + "acl_entry_low_threshold": "70", + "nexthop_group_member_threshold_type": "percentage", + "ipv4_nexthop_low_threshold": "70", + "acl_counter_threshold_type": "percentage", + "ipv6_neighbor_high_threshold": "85", + "nexthop_group_member_high_threshold": "85", + "acl_table_low_threshold": "70", + "fdb_entry_threshold_type": "percentage", + "ipv6_neighbor_threshold_type": "percentage", + "acl_table_high_threshold": "85", + "ipv6_nexthop_low_threshold": "70", + "acl_counter_low_threshold": "70", + "ipv4_neighbor_threshold_type": "percentage", + "nexthop_group_high_threshold": "85", + "ipv6_route_low_threshold": "70", + "acl_entry_high_threshold": "85", + "fdb_entry_low_threshold": "70", + "ipv6_nexthop_high_threshold": "85" + } + } +} diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/cfg/minigraph.xml b/platform/centec/sonic-platform-modules-e582/48x6q/cfg/minigraph.xml new file mode 100644 index 000000000000..fc313eb84635 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/cfg/minigraph.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + switch1 + + + + + + + + + + + + + switch1 + E582-48x6q + + + + switch1 + E582-48x6q + + diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/modules/Makefile b/platform/centec/sonic-platform-modules-e582/48x6q/modules/Makefile new file mode 100644 index 000000000000..25df81bba426 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := centec_e582_48x6q_platform.o dal.o centec_at24c64.o +dal-y := dal_kernel.o dal_mpool.o diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_at24c64.c b/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_at24c64.c new file mode 100644 index 000000000000..7b551e71f79a --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_at24c64.c @@ -0,0 +1,658 @@ +/* + * at24.c - handle most I2C EEPROMs + * + * Copyright (C) 2005-2007 David Brownell + * Copyright (C) 2008 Wolfram Sang, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. + * Differences between different vendor product lines (like Atmel AT24C or + * MicroChip 24LC, etc) won't much matter for typical read/write access. + * There are also I2C RAM chips, likewise interchangeable. One example + * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). + * + * However, misconfiguration can lose data. "Set 16-bit memory address" + * to a part with 8-bit addressing will overwrite data. Writing with too + * big a page size also loses data. And it's not safe to assume that the + * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC + * uses 0x51, for just one example. + * + * Accordingly, explicit board-specific configuration data should be used + * in almost all cases. (One partial exception is an SMBus used to access + * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) + * + * So this driver uses "new style" I2C driver binding, expecting to be + * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or + * similar kernel-resident tables; or, configuration data coming from + * a bootloader. + * + * Other than binding model, current differences from "eeprom" driver are + * that this one handles write access and isn't restricted to 24c02 devices. + * It also handles larger devices (32 kbit and up) with two-byte addresses, + * which won't work on pure SMBus systems. + */ + +struct at24_data { + struct at24_platform_data chip; + struct memory_accessor macc; + int use_smbus; + + /* + * Lock protects against activities from other Linux tasks, + * but not from changes by other I2C masters. + */ + struct mutex lock; + struct bin_attribute bin; + + u8 *writebuf; + unsigned write_max; + unsigned num_addresses; + + /* + * Some chips tie up multiple I2C addresses; dummy devices reserve + * them for us, and we'll use them with SMBus calls. + */ + struct i2c_client *client[]; +}; + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = 128; +module_param(io_limit, uint, 0); +MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); + +/* + * Specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; +module_param(write_timeout, uint, 0); +MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); + +#define AT24_SIZE_BYTELEN 5 +#define AT24_SIZE_FLAGS 8 + +#define AT24_BITMASK(x) (BIT(x) - 1) + +/* create non-zero magic value for given eeprom parameters */ +#define AT24_DEVICE_MAGIC(_len, _flags) \ + ((1 << AT24_SIZE_FLAGS | (_flags)) \ + << AT24_SIZE_BYTELEN | ilog2(_len)) + +static const struct i2c_device_id at24_ctc_ids[] = { + { "24c64-ctc", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16 | AT24_FLAG_READONLY | AT24_FLAG_IRUGO) }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, at24_ctc_ids); + +/*-------------------------------------------------------------------------*/ + +/* + * This routine supports chips which consume multiple I2C addresses. It + * computes the addressing information to be used for a given r/w request. + * Assumes that sanity checks for offset happened at sysfs-layer. + */ +static struct i2c_client *at24_translate_offset(struct at24_data *at24, + unsigned *offset) +{ + unsigned i; + + if (at24->chip.flags & AT24_FLAG_ADDR16) { + i = *offset >> 16; + *offset &= 0xffff; + } else { + i = *offset >> 8; + *offset &= 0xff; + } + + return at24->client[i]; +} + +static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, + unsigned offset, size_t count) +{ + struct i2c_msg msg[2]; + struct i2c_client *client; + unsigned long timeout, read_time; + int status; + + memset(msg, 0, sizeof(msg)); + + /* + * REVISIT some multi-address chips don't rollover page reads to + * the next slave address, so we may need to truncate the count. + * Those chips might need another quirk flag. + * + * If the real hardware used four adjacent 24c02 chips and that + * were misconfigured as one 24c08, that would be a similar effect: + * one "eeprom" file not four, but larger reads would fail when + * they crossed certain pages. + */ + + /* + * Slave address and byte offset derive from the offset. Always + * set the byte address; on a multi-master board, another master + * may have changed the chip's "current" address pointer. + */ + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + + count = 1; + + /* + * Reads fail if the previous write didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + read_time = jiffies; + + status = i2c_smbus_write_byte_data(client, (offset >> 8) & 0x0ff, offset & 0x0ff ); + status = i2c_smbus_read_byte(client); + if (status >= 0) { + buf[0] = status; + status = count; + } + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(read_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t at24_read(struct at24_data *at24, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) + return count; + + memset(buf, 0, count); + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + ssize_t status; + + status = at24_eeprom_read(at24, buf, off, count); + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + //printk(KERN_ALERT "at24_read buf = %s, retval = %zu\n", buf, retval); + + mutex_unlock(&at24->lock); + + return retval; +} + +static ssize_t at24_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct at24_data *at24; + + at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return at24_read(at24, buf, off, count); +} + + +/* + * Note that if the hardware write-protect pin is pulled high, the whole + * chip is normally write protected. But there are plenty of product + * variants here, including OTP fuses and partial chip protect. + * + * We only use page mode writes; the alternative is sloooow. This routine + * writes at most one page. + */ +static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf, + unsigned offset, size_t count) +{ + struct i2c_client *client; + ssize_t status; + unsigned long timeout, write_time; + unsigned next_page; + + /* Get corresponding I2C address and adjust offset */ + client = at24_translate_offset(at24, &offset); + + /* write_max is at most a page */ + if (count > at24->write_max) + count = at24->write_max; + + /* Never roll over backwards, to the start of this page */ + next_page = roundup(offset + 1, at24->chip.page_size); + if (offset + count > next_page) + count = next_page - offset; + + /* + * Writes fail if the previous one didn't complete yet. We may + * loop a few times until this one succeeds, waiting at least + * long enough for one entire page write to work. + */ + timeout = jiffies + msecs_to_jiffies(write_timeout); + do { + write_time = jiffies; + + status = i2c_smbus_write_word_data(client, + (offset >> 8) & 0x0ff, (offset & 0xFF) | buf[0]); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + + /* REVISIT: at HZ=100, this is sloooow */ + msleep(1); + } while (time_before(write_time, timeout)); + + return -ETIMEDOUT; +} + +static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, + size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) + return count; + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + ssize_t status; + + status = at24_eeprom_write(at24, buf, off, 1); /* only one-byte to write; TODO page wirte */ + if (status <= 0) { + if (retval == 0) + retval = status; + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&at24->lock); + + return retval; +} + +static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct at24_data *at24; + + if (unlikely(off >= attr->size)) + return -EFBIG; + + at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return at24_write(at24, buf, off, count); +} + +/*-------------------------------------------------------------------------*/ + +/* + * This lets other kernel code access the eeprom data. For example, it + * might hold a board's Ethernet address, or board-specific calibration + * data generated on the manufacturing floor. + */ + +static ssize_t at24_macc_read(struct memory_accessor *macc, char *buf, + off_t offset, size_t count) +{ + struct at24_data *at24 = container_of(macc, struct at24_data, macc); + + return at24_read(at24, buf, offset, count); +} + +static ssize_t at24_macc_write(struct memory_accessor *macc, const char *buf, + off_t offset, size_t count) +{ + struct at24_data *at24 = container_of(macc, struct at24_data, macc); + + return at24_write(at24, buf, offset, count); +} + +/*-------------------------------------------------------------------------*/ + +#ifdef CONFIG_OF +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ + const __be32 *val; + struct device_node *node = client->dev.of_node; + + if (node) { + if (of_get_property(node, "read-only", NULL)) + chip->flags |= AT24_FLAG_READONLY; + val = of_get_property(node, "pagesize", NULL); + if (val) + chip->page_size = be32_to_cpup(val); + } +} +#else +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ } +#endif /* CONFIG_OF */ + +static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct at24_platform_data chip; + bool writable; + int use_smbus = 0; + struct at24_data *at24; + int err; + unsigned i, num_addresses; + kernel_ulong_t magic; + + if (client->dev.platform_data) { + chip = *(struct at24_platform_data *)client->dev.platform_data; + } else { + if (!id->driver_data) + return -ENODEV; + + magic = id->driver_data; + chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); + magic >>= AT24_SIZE_BYTELEN; + chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); + + /* + * This is slow, but we can't know all eeproms, so we better + * play safe. Specifying custom eeprom-types via platform_data + * is recommended anyhow. + */ + chip.page_size = 1; + + /* update chipdata if OF is present */ + at24_get_ofdata(client, &chip); + + printk(KERN_ALERT "at24_probe chip.byte_len = 0x%x\n", chip.byte_len); + printk(KERN_ALERT "at24_probe chip.flags = 0x%x\n", chip.flags); + printk(KERN_ALERT "at24_probe chip.magic = 0x%lx\n", id->driver_data); + + chip.setup = NULL; + chip.context = NULL; + } + + if (!is_power_of_2(chip.byte_len)) + dev_warn(&client->dev, + "byte_len looks suspicious (no power of 2)!\n"); + if (!chip.page_size) { + dev_err(&client->dev, "page_size must not be 0!\n"); + return -EINVAL; + } + if (!is_power_of_2(chip.page_size)) + dev_warn(&client->dev, + "page_size looks suspicious (no power of 2)!\n"); + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + return -EPFNOSUPPORT; + } + use_smbus = I2C_SMBUS_BYTE_DATA; + printk(KERN_ALERT "at24_probe use_smbus --> %d\n", + use_smbus); + } + + if (chip.flags & AT24_FLAG_TAKE8ADDR) + num_addresses = 8; + else + num_addresses = DIV_ROUND_UP(chip.byte_len, + (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); + + at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); + if (!at24) + return -ENOMEM; + + mutex_init(&at24->lock); + at24->use_smbus = use_smbus; + at24->chip = chip; + at24->num_addresses = num_addresses; + + /* + * Export the EEPROM bytes through sysfs, since that's convenient. + * By default, only root should see the data (maybe passwords etc) + */ + sysfs_bin_attr_init(&at24->bin); + at24->bin.attr.name = "eeprom"; + at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; + at24->bin.read = at24_bin_read; + at24->bin.size = chip.byte_len; + + at24->macc.read = at24_macc_read; + + writable = !(chip.flags & AT24_FLAG_READONLY); + if (writable) { + if (!use_smbus || i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { + + unsigned write_max = chip.page_size; + + at24->macc.write = at24_macc_write; + + at24->bin.write = at24_bin_write; + at24->bin.attr.mode |= S_IWUSR; + + if (write_max > io_limit) + write_max = io_limit; + if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + at24->write_max = write_max; + + /* buffer (data + address at the beginning) */ + at24->writebuf = devm_kzalloc(&client->dev, + write_max + 2, GFP_KERNEL); + if (!at24->writebuf) + return -ENOMEM; + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + } + + at24->client[0] = client; + + /* use dummy devices for multiple-address chips */ + for (i = 1; i < num_addresses; i++) { + at24->client[i] = i2c_new_dummy(client->adapter, + client->addr + i); + if (!at24->client[i]) { + dev_err(&client->dev, "address 0x%02x unavailable\n", + client->addr + i); + err = -EADDRINUSE; + goto err_clients; + } + } + + err = sysfs_create_bin_file(&client->dev.kobj, &at24->bin); + if (err) + goto err_clients; + + i2c_set_clientdata(client, at24); + + dev_info(&client->dev, "%zu byte %s EEPROM, %s, %u bytes/write\n", + at24->bin.size, client->name, + writable ? "writable" : "read-only", at24->write_max); + if (use_smbus == I2C_SMBUS_WORD_DATA || + use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } + + /* export data to kernel code */ + if (chip.setup) + chip.setup(&at24->macc, chip.context); + + return 0; + +err_clients: + for (i = 1; i < num_addresses; i++) + if (at24->client[i]) + i2c_unregister_device(at24->client[i]); + + return err; +} + +static int at24_remove(struct i2c_client *client) +{ + struct at24_data *at24; + int i; + + at24 = i2c_get_clientdata(client); + sysfs_remove_bin_file(&client->dev.kobj, &at24->bin); + + for (i = 1; i < at24->num_addresses; i++) + i2c_unregister_device(at24->client[i]); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +static struct i2c_board_info i2c_devs = { + I2C_BOARD_INFO("24c64-ctc", 0x57), +}; + +static struct i2c_adapter *adapter = NULL; +static struct i2c_client *client = NULL; + +static int ctc_at24c64_init(void) +{ + printk(KERN_ALERT "ctc_at24c64_init\n"); + + adapter = i2c_get_adapter(0); + if(adapter == NULL){ + printk(KERN_ALERT "i2c_get_adapter == NULL\n"); + return -1; + } + + client = i2c_new_device(adapter, &i2c_devs); + if(client == NULL){ + printk(KERN_ALERT "i2c_new_device == NULL\n"); + i2c_put_adapter(adapter); + adapter = NULL; + return -1; + } + + return 0; +} + +static void ctc_at24c64_exit(void) +{ + printk(KERN_ALERT "ctc_at24c64_exit\n"); + if(client){ + i2c_unregister_device(client); + } + if(adapter){ + i2c_put_adapter(adapter); + } +} + +static struct i2c_driver at24_ctc_driver = { + .driver = { + .name = "at24-ctc", + .owner = THIS_MODULE, + }, + .probe = at24_probe, + .remove = at24_remove, + .id_table = at24_ctc_ids, +}; + +static int __init at24_ctc_init(void) +{ + if (!io_limit) { + pr_err("at24_ctc: io_limit must not be 0!\n"); + return -EINVAL; + } + + io_limit = rounddown_pow_of_two(io_limit); + + ctc_at24c64_init(); + + return i2c_add_driver(&at24_ctc_driver); +} +module_init(at24_ctc_init); + +static void __exit at24_ctc_exit(void) +{ + ctc_at24c64_exit(); + i2c_del_driver(&at24_ctc_driver); +} +module_exit(at24_ctc_exit); + +MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); +MODULE_AUTHOR("David Brownell and Wolfram Sang"); +MODULE_LICENSE("GPL"); +/* XXX */ diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_e582_48x6q_platform.c b/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_e582_48x6q_platform.c new file mode 100644 index 000000000000..4837335872e4 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_e582_48x6q_platform.c @@ -0,0 +1,1380 @@ +#include +#include +#include +#include +#include +#include +#include + +#define SEP(XXX) 1 +#define IS_INVALID_PTR(_PTR_) ((_PTR_ == NULL) || IS_ERR(_PTR_)) +#define IS_VALID_PTR(_PTR_) (!IS_INVALID_PTR(_PTR_)) + +#if SEP("defines") +#define PCA9548_CHANNEL_NUM 8 +#define PCA9548_ADAPT_ID_START 10 +#define SFP_NUM 48 +#define QSFP_NUM 6 +#define PORT_NUM (SFP_NUM+QSFP_NUM) +#endif + +#if SEP("i2c:master") +static struct i2c_adapter *i2c_adp_master = NULL; /* i2c-0-cpu */ + +static int e582_48x6q_init_i2c_master(void) +{ + /* find i2c-core master */ + i2c_adp_master = i2c_get_adapter(0); + if(IS_INVALID_PTR(i2c_adp_master)) + { + i2c_adp_master = NULL; + printk(KERN_CRIT "e582_48x6q_init_i2c_master can't find i2c-core bus\n"); + return -1; + } + + return 0; +} + +static int e582_48x6q_exit_i2c_master(void) +{ + /* uninstall i2c-core master */ + if(IS_VALID_PTR(i2c_adp_master)) { + i2c_put_adapter(i2c_adp_master); + i2c_adp_master = NULL; + } + + return 0; +} +#endif + +#if SEP("i2c:pca9548") +static struct pca954x_platform_mode i2c_dev_pca9548_platform_mode[PCA9548_CHANNEL_NUM] = { + [0] = { + .adap_id = PCA9548_ADAPT_ID_START, + .deselect_on_exit = 1, + .class = 0, + }, + [1] = { + .adap_id = PCA9548_ADAPT_ID_START + 1, + .deselect_on_exit = 1, + .class = 0, + }, + [2] = { + .adap_id = PCA9548_ADAPT_ID_START + 2, + .deselect_on_exit = 1, + .class = 0, + }, + [3] = { + .adap_id = PCA9548_ADAPT_ID_START + 3, + .deselect_on_exit = 1, + .class = 0, + }, + [4] = { + .adap_id = PCA9548_ADAPT_ID_START + 4, + .deselect_on_exit = 1, + .class = 0, + }, + [5] = { + .adap_id = PCA9548_ADAPT_ID_START + 5, + .deselect_on_exit = 1, + .class = 0, + }, + [6] = { + .adap_id = PCA9548_ADAPT_ID_START + 6, + .deselect_on_exit = 1, + .class = 0, + }, + [7] = { + .adap_id = PCA9548_ADAPT_ID_START + 7, + .deselect_on_exit = 1, + .class = 0, + } +}; +static struct pca954x_platform_data i2c_dev_pca9548_platform_data = { + .modes = i2c_dev_pca9548_platform_mode, + .num_modes = PCA9548_CHANNEL_NUM, +}; +static struct i2c_board_info i2c_dev_pca9548 = { + I2C_BOARD_INFO("pca9548", 0x70), + .platform_data = &i2c_dev_pca9548_platform_data, +}; +static struct i2c_client *i2c_client_pca9548x = NULL; + +static int e582_48x6q_init_i2c_pca9548(void) +{ + if(IS_INVALID_PTR(i2c_adp_master)) + { + i2c_adp_master = NULL; + printk(KERN_CRIT "e582_48x6q_init_i2c_pca9548 can't find i2c-core bus\n"); + return -1; + } + + /* install i2c-mux */ + i2c_client_pca9548x = i2c_new_device(i2c_adp_master, &i2c_dev_pca9548); + if(IS_INVALID_PTR(i2c_client_pca9548x)) + { + i2c_client_pca9548x = NULL; + printk(KERN_CRIT "install e582_48x6q board pca9548 failed\n"); + return -1; + } + + return 0; +} + +static int e582_48x6q_exit_i2c_pca9548(void) +{ + /* uninstall i2c-core master */ + if(IS_VALID_PTR(i2c_client_pca9548x)) { + i2c_unregister_device(i2c_client_pca9548x); + i2c_client_pca9548x = NULL; + } + + return 0; +} +#endif + +#if SEP("i2c:adt7470") +static struct i2c_board_info i2c_dev_adt7470 = { + I2C_BOARD_INFO("adt7470", 0x2F), +}; +static struct i2c_adapter *i2c_adp_adt7470 = NULL; /* pca9548x-channel 5 */ +static struct i2c_client *i2c_client_adt7470 = NULL; + +static int e582_48x6q_init_i2c_adt7470(void) +{ + i2c_adp_adt7470 = i2c_get_adapter(PCA9548_ADAPT_ID_START + 5); + if(IS_INVALID_PTR(i2c_adp_adt7470)) + { + i2c_adp_adt7470 = NULL; + printk(KERN_CRIT "install e582_48x6q board adt7470 failed\n"); + return -1; + } + + i2c_client_adt7470 = i2c_new_device(i2c_adp_adt7470, &i2c_dev_adt7470); + if(IS_INVALID_PTR(i2c_client_adt7470)){ + i2c_client_adt7470 = NULL; + printk(KERN_CRIT "install e582_48x6q board adt7470 failed\n"); + return -1; + } + + return 0; +} + +static int e582_48x6q_exit_i2c_adt7470(void) +{ + if(IS_VALID_PTR(i2c_client_adt7470)) { + i2c_unregister_device(i2c_client_adt7470); + i2c_client_adt7470 = NULL; + } + + if(IS_VALID_PTR(i2c_adp_adt7470)) { + i2c_put_adapter(i2c_adp_adt7470); + i2c_adp_adt7470 = NULL; + } + + return 0; +} +#endif + +#if SEP("i2c:psu") +static struct i2c_adapter *i2c_adp_psu1 = NULL; /* psu1 channel 3 */ +static struct i2c_adapter *i2c_adp_psu2 = NULL; /* psu2 channel 1 */ +static struct i2c_board_info i2c_dev_psu1 = { + I2C_BOARD_INFO("i2c-psu1", 0x38), +}; +static struct i2c_board_info i2c_dev_psu2 = { + I2C_BOARD_INFO("i2c-psu2", 0x38), +}; +static struct i2c_client *i2c_client_psu1 = NULL; +static struct i2c_client *i2c_client_psu2 = NULL; + +static int e582_48x6q_init_i2c_psu(void) +{ + i2c_adp_psu1 = i2c_get_adapter(PCA9548_ADAPT_ID_START + 3); + if(IS_INVALID_PTR(i2c_adp_psu1)) + { + i2c_adp_psu1 = NULL; + printk(KERN_CRIT "get e582_48x6q psu1 i2c-adp failed\n"); + return -1; + } + + i2c_adp_psu2 = i2c_get_adapter(PCA9548_ADAPT_ID_START + 1); + if(IS_INVALID_PTR(i2c_adp_psu2)) + { + i2c_adp_psu2 = NULL; + printk(KERN_CRIT "get e582_48x6q psu2 i2c-adp failed\n"); + return -1; + } + + i2c_client_psu1 = i2c_new_device(i2c_adp_psu1, &i2c_dev_psu1); + if(IS_INVALID_PTR(i2c_client_psu1)){ + i2c_client_psu1 = NULL; + printk(KERN_CRIT "create e582_48x6q board i2c client psu1 failed\n"); + return -1; + } + + i2c_client_psu2 = i2c_new_device(i2c_adp_psu2, &i2c_dev_psu2); + if(IS_INVALID_PTR(i2c_client_psu2)){ + i2c_client_psu2 = NULL; + printk(KERN_CRIT "create e582_48x6q board i2c client psu2 failed\n"); + return -1; + } + + return 0; +} + +static int e582_48x6q_exit_i2c_psu(void) +{ + if(IS_VALID_PTR(i2c_client_psu1)) { + i2c_unregister_device(i2c_client_psu1); + i2c_client_psu1 = NULL; + } + + if(IS_VALID_PTR(i2c_client_psu2)) { + i2c_unregister_device(i2c_client_psu2); + i2c_client_psu2 = NULL; + } + + if(IS_VALID_PTR(i2c_adp_psu1)) + { + i2c_put_adapter(i2c_adp_psu1); + i2c_adp_psu1 = NULL; + } + + if(IS_VALID_PTR(i2c_adp_psu2)) + { + i2c_put_adapter(i2c_adp_psu2); + i2c_adp_psu2 = NULL; + } + + return 0; +} +#endif + +#if SEP("i2c:epld") +static struct i2c_board_info i2c_dev_epld = { + I2C_BOARD_INFO("i2c-epld", 0x58), +}; +static struct i2c_client *i2c_client_epld = NULL; + +static int e582_48x6q_init_i2c_epld(void) +{ + if (IS_INVALID_PTR(i2c_adp_master)) + { + printk(KERN_CRIT "e582_48x6q_init_i2c_epld can't find i2c-core bus\n"); + return -1; + } + + i2c_client_epld = i2c_new_device(i2c_adp_master, &i2c_dev_epld); + if(IS_INVALID_PTR(i2c_client_epld)) + { + i2c_client_epld = NULL; + printk(KERN_CRIT "create e582_48x6q board i2c client epld failed\n"); + return -1; + } + + return 0; +} + +static int e582_48x6q_exit_i2c_epld(void) +{ + if(IS_VALID_PTR(i2c_client_epld)) { + i2c_unregister_device(i2c_client_epld); + i2c_client_epld = NULL; + } + + return 0; +} +#endif + +#if SEP("i2c:gpio") +static struct i2c_board_info i2c_dev_gpio0 = { + I2C_BOARD_INFO("i2c-gpio0", 0x20), +}; +static struct i2c_board_info i2c_dev_gpio1 = { + I2C_BOARD_INFO("i2c-gpio1", 0x21), +}; +static struct i2c_board_info i2c_dev_gpio2 = { + I2C_BOARD_INFO("i2c-gpio2", 0x22), +}; +static struct i2c_board_info i2c_dev_gpio3 = { + I2C_BOARD_INFO("i2c-gpio3", 0x23), +}; +static struct i2c_board_info i2c_dev_gpio4 = { + I2C_BOARD_INFO("i2c-gpio4", 0x24), +}; +static struct i2c_client *i2c_client_gpio0 = NULL; +static struct i2c_client *i2c_client_gpio1 = NULL; +static struct i2c_client *i2c_client_gpio2 = NULL; +static struct i2c_client *i2c_client_gpio3 = NULL; +static struct i2c_client *i2c_client_gpio4 = NULL; + +static int e582_48x6q_init_i2c_gpio(void) +{ + if (IS_INVALID_PTR(i2c_adp_master)) + { + printk(KERN_CRIT "e582_48x6q_init_i2c_gpio can't find i2c-core bus\n"); + return -1; + } + + i2c_client_gpio0 = i2c_new_device(i2c_adp_master, &i2c_dev_gpio0); + if(IS_INVALID_PTR(i2c_client_gpio0)) + { + i2c_client_gpio0 = NULL; + printk(KERN_CRIT "create e582_48x6q board i2c client gpio0 failed\n"); + return -1; + } + + i2c_client_gpio1 = i2c_new_device(i2c_adp_master, &i2c_dev_gpio1); + if(IS_INVALID_PTR(i2c_client_gpio1)) + { + i2c_client_gpio1 = NULL; + printk(KERN_CRIT "create e582_48x6q board i2c client gpio1 failed\n"); + return -1; + } + + i2c_client_gpio2 = i2c_new_device(i2c_adp_master, &i2c_dev_gpio2); + if(IS_INVALID_PTR(i2c_client_gpio2)) + { + i2c_client_gpio2 = NULL; + printk(KERN_CRIT "create e582_48x6q board i2c client gpio2 failed\n"); + return -1; + } + + i2c_client_gpio3 = i2c_new_device(i2c_adp_master, &i2c_dev_gpio3); + if(IS_INVALID_PTR(i2c_client_gpio3)) + { + i2c_client_gpio3 = NULL; + printk(KERN_CRIT "create e582_48x6q board i2c client gpio3 failed\n"); + return -1; + } + + i2c_client_gpio4 = i2c_new_device(i2c_adp_master, &i2c_dev_gpio4); + if(IS_INVALID_PTR(i2c_client_gpio4)) + { + i2c_client_gpio4 = NULL; + printk(KERN_CRIT "create e582_48x6q board i2c client gpio4 failed\n"); + return -1; + } + + return 0; +} + +static int e582_48x6q_exit_i2c_gpio(void) +{ + if(IS_VALID_PTR(i2c_client_gpio0)) { + i2c_unregister_device(i2c_client_gpio0); + i2c_client_gpio0 = NULL; + } + + if((i2c_client_gpio1)) { + i2c_unregister_device(i2c_client_gpio1); + i2c_client_gpio1 = NULL; + } + + if(IS_VALID_PTR(i2c_client_gpio2)) { + i2c_unregister_device(i2c_client_gpio2); + i2c_client_gpio2 = NULL; + } + + if(IS_VALID_PTR(i2c_client_gpio3)) { + i2c_unregister_device(i2c_client_gpio3); + i2c_client_gpio3 = NULL; + } + + if(IS_VALID_PTR(i2c_client_gpio4)) { + i2c_unregister_device(i2c_client_gpio4); + i2c_client_gpio4 = NULL; + } + + return 0; +} +#endif + +#if SEP("i2c:smbus") +static int e582_48x6q_smbus_read_reg(struct i2c_client *client, unsigned char reg, unsigned char* value) +{ + int ret = 0; + + if (IS_INVALID_PTR(client)) + { + printk(KERN_CRIT "invalid i2c client"); + return -1; + } + + ret = i2c_smbus_read_byte_data(client, reg); + if (ret >= 0) { + *value = (unsigned char)ret; + } + else + { + *value = 0; + printk(KERN_CRIT "i2c_smbus op failed: ret=%d reg=%d\n",ret ,reg); + return ret; + } + + return 0; +} + +static int e582_48x6q_smbus_write_reg(struct i2c_client *client, unsigned char reg, unsigned char value) +{ + int ret = 0; + + if (IS_INVALID_PTR(client)) + { + printk(KERN_CRIT "invalid i2c client"); + return -1; + } + + ret = i2c_smbus_write_byte_data(client, reg, value); + if (ret != 0) + { + printk(KERN_CRIT "i2c_smbus op failed: ret=%d reg=%d\n",ret ,reg); + return ret; + } + + return 0; +} +#endif + +#if SEP("drivers:psu") +static struct class* psu_class = NULL; +static struct device* psu_dev_psu1 = NULL; +static struct device* psu_dev_psu2 = NULL; + +static ssize_t e582_48x6q_psu_read_presence(struct device *dev, struct device_attribute *attr, char *buf) +{ + int ret = 0; + unsigned char present_no = 0; + unsigned char present = 0; + unsigned char value = 0; + struct i2c_client *i2c_psu_client = NULL; + + if (psu_dev_psu1 == dev) + { + i2c_psu_client = i2c_client_gpio0; + present_no = 17; + } + else if (psu_dev_psu2 == dev) + { + i2c_psu_client = i2c_client_gpio0; + present_no = 9; + } + else + { + return sprintf(buf, "Error: unknown psu device\n"); + } + + if (IS_INVALID_PTR(i2c_psu_client)) + { + return sprintf(buf, "Error: psu i2c-adapter invalid\n"); + } + + ret = e582_48x6q_smbus_read_reg(i2c_psu_client, present_no/8, &present); + if (ret != 0) + { + return sprintf(buf, "Error: read psu data:%s failed\n", attr->attr.name); + } + + value = ((present & (1<<(present_no%8))) ? 1 : 0 ); + + return sprintf(buf, "%d\n", value); +} + +static ssize_t e582_48x6q_psu_read_status(struct device *dev, struct device_attribute *attr, char *buf) +{ + int ret = 0; + unsigned char workstate_no = 0; + unsigned char workstate = 0; + unsigned char value = 0; + struct i2c_client *i2c_psu_client = NULL; + + if (psu_dev_psu1 == dev) + { + i2c_psu_client = i2c_client_gpio0; + workstate_no = 21; + } + else if (psu_dev_psu2 == dev) + { + i2c_psu_client = i2c_client_gpio0; + workstate_no = 13; + } + else + { + return sprintf(buf, "Error: unknown psu device\n"); + } + + if (IS_INVALID_PTR(i2c_psu_client)) + { + return sprintf(buf, "Error: psu i2c-adapter invalid\n"); + } + + ret = e582_48x6q_smbus_read_reg(i2c_psu_client, workstate_no/8, &workstate); + if (ret != 0) + { + return sprintf(buf, "Error: read psu data:%s failed\n", attr->attr.name); + } + + if (ret != 0) + { + return sprintf(buf, "Error: read psu data:%s failed\n", attr->attr.name); + } + + value = ((workstate & (1<<(workstate_no%8))) ? 1 : 0 ); + + return sprintf(buf, "%d\n", value); +} + +static DEVICE_ATTR(psu_presence, S_IRUGO, e582_48x6q_psu_read_presence, NULL); +static DEVICE_ATTR(psu_status, S_IRUGO, e582_48x6q_psu_read_status, NULL); + +static int e582_48x6q_init_psu(void) +{ + int ret = 0; + + psu_class = class_create(THIS_MODULE, "psu"); + if (IS_INVALID_PTR(psu_class)) + { + psu_class = NULL; + printk(KERN_CRIT "create e582_48x6q class psu failed\n"); + return -1; + } + + psu_dev_psu1 = device_create(psu_class, NULL, MKDEV(222,0), NULL, "psu1"); + if (IS_INVALID_PTR(psu_dev_psu1)) + { + psu_dev_psu1 = NULL; + printk(KERN_CRIT "create e582_48x6q psu1 device failed\n"); + return -1; + } + + psu_dev_psu2 = device_create(psu_class, NULL, MKDEV(222,1), NULL, "psu2"); + if (IS_INVALID_PTR(psu_dev_psu2)) + { + psu_dev_psu2 = NULL; + printk(KERN_CRIT "create e582_48x6q psu2 device failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu1, &dev_attr_psu_presence); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q psu1 device attr:presence failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu1, &dev_attr_psu_status); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q psu1 device attr:status failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu2, &dev_attr_psu_presence); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q psu2 device attr:presence failed\n"); + return -1; + } + + ret = device_create_file(psu_dev_psu2, &dev_attr_psu_status); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q psu2 device attr:status failed\n"); + return -1; + } + + return 0; +} + +static int e582_48x6q_exit_psu(void) +{ + if (IS_VALID_PTR(psu_dev_psu1)) + { + device_remove_file(psu_dev_psu1, &dev_attr_psu_presence); + device_remove_file(psu_dev_psu1, &dev_attr_psu_status); + device_destroy(psu_class, MKDEV(222,0)); + } + + if (IS_VALID_PTR(psu_dev_psu2)) + { + device_remove_file(psu_dev_psu2, &dev_attr_psu_presence); + device_remove_file(psu_dev_psu2, &dev_attr_psu_status); + device_destroy(psu_class, MKDEV(222,1)); + } + + if (IS_VALID_PTR(psu_class)) + { + class_destroy(psu_class); + psu_class = NULL; + } + + return 0; +} +#endif + +#if SEP("drivers:leds") +extern void e582_48x6q_led_set(struct led_classdev *led_cdev, enum led_brightness set_value); +extern enum led_brightness e582_48x6q_led_get(struct led_classdev *led_cdev); +extern void e582_48x6q_led_port_set(struct led_classdev *led_cdev, enum led_brightness set_value); +extern enum led_brightness e582_48x6q_led_port_get(struct led_classdev *led_cdev); + +static struct led_classdev led_dev_system = { + .name = "system", + .brightness_set = e582_48x6q_led_set, + .brightness_get = e582_48x6q_led_get, +}; +static struct led_classdev led_dev_idn = { + .name = "idn", + .brightness_set = e582_48x6q_led_set, + .brightness_get = e582_48x6q_led_get, +}; +static struct led_classdev led_dev_fan1 = { + .name = "fan1", + .brightness_set = e582_48x6q_led_set, + .brightness_get = e582_48x6q_led_get, +}; +static struct led_classdev led_dev_fan2 = { + .name = "fan2", + .brightness_set = e582_48x6q_led_set, + .brightness_get = e582_48x6q_led_get, +}; +static struct led_classdev led_dev_fan3 = { + .name = "fan3", + .brightness_set = e582_48x6q_led_set, + .brightness_get = e582_48x6q_led_get, +}; +static struct led_classdev led_dev_fan4 = { + .name = "fan4", + .brightness_set = e582_48x6q_led_set, + .brightness_get = e582_48x6q_led_get, +}; +static struct led_classdev led_dev_psu1 = { + .name = "psu1", + .brightness_set = e582_48x6q_led_set, + .brightness_get = e582_48x6q_led_get, +}; +static struct led_classdev led_dev_psu2 = { + .name = "psu2", + .brightness_set = e582_48x6q_led_set, + .brightness_get = e582_48x6q_led_get, +}; +static struct led_classdev led_dev_port[PORT_NUM] = { +{ .name = "port1", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port2", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port3", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port4", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port5", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port6", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port7", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port8", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port9", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port10", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port11", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port12", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port13", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port14", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port15", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port16", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port17", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port18", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port19", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port20", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port21", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port22", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port23", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port24", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port25", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port26", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port27", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port28", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port29", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port30", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port31", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port32", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port33", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port34", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port35", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port36", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port37", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port38", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port39", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port40", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port41", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port42", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port43", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port44", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port45", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port46", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port47", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port48", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port49", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port50", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port51", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port52", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port53", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,}, +{ .name = "port54", .brightness_set = e582_48x6q_led_port_set, .brightness_get = e582_48x6q_led_port_get,} +}; +static unsigned char port_led_mode[PORT_NUM] = {0}; + +void e582_48x6q_led_set(struct led_classdev *led_cdev, enum led_brightness set_value) +{ + int ret = 0; + unsigned char reg = 0; + unsigned char mask = 0; + unsigned char shift = 0; + unsigned char led_value = 0; + struct i2c_client *i2c_led_client = i2c_client_epld; + + if (0 == strcmp(led_dev_system.name, led_cdev->name)) + { + reg = 0x2; + mask = 0x0F; + shift = 4; + } + else if (0 == strcmp(led_dev_idn.name, led_cdev->name)) + { + reg = 0x3; + mask = 0xFE; + shift = 0; + } + else if (0 == strcmp(led_dev_fan1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan2.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan3.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan4.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu2.name, led_cdev->name)) + { + goto not_support; + } + else + { + goto not_support; + } + + ret = e582_48x6q_smbus_read_reg(i2c_led_client, reg, &led_value); + if (ret != 0) + { + printk(KERN_CRIT "Error: read %s led attr failed\n", led_cdev->name); + return; + } + + led_value = ((led_value & mask) | ((set_value << shift) & (~mask))); + + ret = e582_48x6q_smbus_write_reg(i2c_led_client, reg, led_value); + if (ret != 0) + { + printk(KERN_CRIT "Error: write %s led attr failed\n", led_cdev->name); + return; + } + + return; + +not_support: + + printk(KERN_INFO "Error: not support device:%s\n", led_cdev->name); + return; +} + +enum led_brightness e582_48x6q_led_get(struct led_classdev *led_cdev) +{ + int ret = 0; + unsigned char reg = 0; + unsigned char mask = 0; + unsigned char shift = 0; + unsigned char led_value = 0; + struct i2c_client *i2c_led_client = i2c_client_epld; + + if (0 == strcmp(led_dev_system.name, led_cdev->name)) + { + reg = 0x2; + mask = 0xF0; + shift = 4; + } + else if (0 == strcmp(led_dev_idn.name, led_cdev->name)) + { + reg = 0x3; + mask = 0x01; + shift = 0; + } + else if (0 == strcmp(led_dev_fan1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan2.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan3.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_fan4.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu1.name, led_cdev->name)) + { + goto not_support; + } + else if (0 == strcmp(led_dev_psu2.name, led_cdev->name)) + { + goto not_support; + } + else + { + goto not_support; + } + + ret = e582_48x6q_smbus_read_reg(i2c_led_client, reg, &led_value); + if (ret != 0) + { + printk(KERN_CRIT "Error: read %s led attr failed\n", led_cdev->name); + return; + } + + led_value = ((led_value & mask) >> shift); + + return led_value; + +not_support: + + printk(KERN_INFO "Error: not support device:%s\n", led_cdev->name); + return 0; +} + +void e582_48x6q_led_port_set(struct led_classdev *led_cdev, enum led_brightness set_value) +{ + int portNum = 0; + + sscanf(led_cdev->name, "port%d", &portNum); + + port_led_mode[portNum-1] = set_value; + + return; +} + +enum led_brightness e582_48x6q_led_port_get(struct led_classdev *led_cdev) +{ + int portNum = 0; + + sscanf(led_cdev->name, "port%d", &portNum); + + return port_led_mode[portNum-1]; +} + +static int e582_48x6q_init_led(void) +{ + int ret = 0; + int i = 0; + + ret = led_classdev_register(NULL, &led_dev_system); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q led_dev_system device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_idn); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q led_dev_idn device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan1); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q led_dev_fan1 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan2); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q led_dev_fan2 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan3); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q led_dev_fan3 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_fan4); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q led_dev_fan4 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_psu1); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q led_dev_psu1 device failed\n"); + return -1; + } + + ret = led_classdev_register(NULL, &led_dev_psu2); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q led_dev_psu2 device failed\n"); + return -1; + } + + for (i=0; i PORT_NUM)) + { + printk(KERN_CRIT "sfp read presence, invalid port number!\n"); + value = 0; + } + + if ((portNum >= 1) && (portNum <= 8)) + { + reg_no = portNum + 31;/*32-39*/ + i2c_sfp_client = i2c_client_gpio0; + } + else if ((portNum >= 9) && (portNum <= 16)) + { + reg_no = portNum + 7;/*16-23*/ + i2c_sfp_client = i2c_client_gpio1; + } + else if ((portNum >= 17) && (portNum <= 24)) + { + reg_no = portNum - 17;/*0-7*/ + i2c_sfp_client = i2c_client_gpio2; + } + else if ((portNum >= 25) && (portNum <= 32)) + { + reg_no = portNum - 1;/*24-31*/ + i2c_sfp_client = i2c_client_gpio2; + } + else if ((portNum >= 33) && (portNum <= 40)) + { + reg_no = portNum - 25;/*8-15*/ + i2c_sfp_client = i2c_client_gpio3; + } + else if ((portNum >= 41) && (portNum <= 48)) + { + reg_no = portNum - 9;/*32-39*/ + i2c_sfp_client = i2c_client_gpio3; + } + else if ((portNum >= 49) && (portNum <= 54)) + { + reg_no = portNum - 25;/*24-29*/ + i2c_sfp_client = i2c_client_gpio4; + } + + dir_bank = (reg_no/8) + 0x18; + ret = e582_48x6q_smbus_write_reg(i2c_sfp_client, dir_bank, 0xff); + if (ret != 0) + { + return sprintf(buf, "Error: read sfp data:%s set dir-ctl failed\n", attr->attr.name); + } + + input_bank = (reg_no/8) + 0x0; + ret = e582_48x6q_smbus_read_reg(i2c_sfp_client, input_bank, &value); + if (ret != 0) + { + return sprintf(buf, "Error: read sfp data:%s failed\n", attr->attr.name); + } + + value = ((value & (1<<(reg_no%8))) ? 0 : 1 );/*1:PRESENT 0:ABSENT*/ + + return sprintf(buf, "%d\n", value); +} + +static ssize_t e582_48x6q_sfp_read_enable(struct device *dev, struct device_attribute *attr, char *buf) +{ + int ret = 0; + unsigned char value = 0; + unsigned char reg_no = 0; + unsigned char dir_bank = 0; + unsigned char input_bank = 0; + int portNum = 0; + const char *name = dev_name(dev); + struct i2c_client *i2c_sfp_client = NULL; + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 1) || (portNum > PORT_NUM)) + { + printk(KERN_CRIT "sfp read presence, invalid port number!\n"); + value = 0; + } + + if ((portNum >= 1) && (portNum <= 8)) + { + reg_no = portNum + 23;/*24-31*/ + i2c_sfp_client = i2c_client_gpio0; + } + else if ((portNum >= 9) && (portNum <= 16)) + { + reg_no = portNum - 1;/*8-15*/ + i2c_sfp_client = i2c_client_gpio1; + } + else if ((portNum >= 17) && (portNum <= 24)) + { + reg_no = portNum + 15;/*32-39*/ + i2c_sfp_client = i2c_client_gpio1; + } + else if ((portNum >= 25) && (portNum <= 32)) + { + reg_no = portNum - 9;/*16-23*/ + i2c_sfp_client = i2c_client_gpio2; + } + else if ((portNum >= 33) && (portNum <= 40)) + { + reg_no = portNum - 33;/*0-7*/ + i2c_sfp_client = i2c_client_gpio3; + } + else if ((portNum >= 41) && (portNum <= 48)) + { + reg_no = portNum - 17;/*24-31*/ + i2c_sfp_client = i2c_client_gpio3; + } + else if ((portNum >= 49) && (portNum <= 54)) + { + printk(KERN_INFO "%s not supported!\n", name); + return sprintf(buf, "%d\n", 0); + } + + dir_bank = (reg_no/8) + 0x18; + ret = e582_48x6q_smbus_write_reg(i2c_sfp_client, dir_bank, 0xff); + if (ret != 0) + { + return sprintf(buf, "Error: read sfp data:%s set dir-ctl failed\n", attr->attr.name); + } + + input_bank = (reg_no/8) + 0x8; + ret = e582_48x6q_smbus_read_reg(i2c_sfp_client, input_bank, &value); + if (ret != 0) + { + return sprintf(buf, "Error: read sfp data:%s failed\n", attr->attr.name); + } + + value = ((value & (1<<(reg_no%8))) ? 0 : 1 ); + + return sprintf(buf, "%d\n", value); +} + +static ssize_t e582_48x6q_sfp_write_enable(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) +{ + int ret = 0; + unsigned char value = 0; + unsigned char set_value = simple_strtol(buf, NULL, 10); + unsigned char reg_no = 0; + unsigned char dir_bank = 0; + unsigned char input_bank = 0; + unsigned char output_bank = 0; + int portNum = 0; + const char *name = dev_name(dev); + struct i2c_client *i2c_sfp_client = NULL; + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 1) || (portNum > PORT_NUM)) + { + printk(KERN_CRIT "sfp read presence, invalid port number!\n"); + return size; + } + + if ((portNum >= 1) && (portNum <= 8)) + { + reg_no = portNum + 23;/*24-31*/ + i2c_sfp_client = i2c_client_gpio0; + } + else if ((portNum >= 9) && (portNum <= 16)) + { + reg_no = portNum - 1;/*8-15*/ + i2c_sfp_client = i2c_client_gpio1; + } + else if ((portNum >= 17) && (portNum <= 24)) + { + reg_no = portNum + 15;/*32-39*/ + i2c_sfp_client = i2c_client_gpio1; + } + else if ((portNum >= 25) && (portNum <= 32)) + { + reg_no = portNum - 9;/*16-23*/ + i2c_sfp_client = i2c_client_gpio2; + } + else if ((portNum >= 33) && (portNum <= 40)) + { + reg_no = portNum - 33;/*0-7*/ + i2c_sfp_client = i2c_client_gpio3; + } + else if ((portNum >= 41) && (portNum <= 48)) + { + reg_no = portNum - 17;/*24-31*/ + i2c_sfp_client = i2c_client_gpio3; + } + else if ((portNum >= 49) && (portNum <= 54)) + { + printk(KERN_INFO "%s not supported!\n", name); + return size; + } + + set_value = ((set_value > 0) ? 0 : 1 ); + + dir_bank = (reg_no/8) + 0x18; + ret = e582_48x6q_smbus_write_reg(i2c_sfp_client, dir_bank, 0x0); + if (ret != 0) + { + return sprintf(buf, "Error: read sfp data:%s set dir-ctl failed\n", attr->attr.name); + } + + input_bank = (reg_no/8) + 0x8; + ret = e582_48x6q_smbus_read_reg(i2c_sfp_client, input_bank, &value); + if (ret != 0) + { + printk(KERN_CRIT "Error: read %s presence failed\n", name); + return size; + } + + if (set_value) + { + value = (value | (1<<(reg_no % 8))); + } + else + { + value = (value & (~(1<<(reg_no % 8)))); + } + + output_bank = (reg_no/8) + 0x8; + ret = e582_48x6q_smbus_write_reg(i2c_sfp_client, output_bank, value); + if (ret != 0) + { + printk(KERN_CRIT "Error: write %s presence failed\n", name); + return size; + } + + return size; +} + +static DEVICE_ATTR(sfp_presence, S_IRUGO, e582_48x6q_sfp_read_presence, NULL); +static DEVICE_ATTR(sfp_enable, S_IRUGO|S_IWUGO, e582_48x6q_sfp_read_enable, e582_48x6q_sfp_write_enable); +static int e582_48x6q_init_sfp(void) +{ + int ret = 0; + int i = 0; + + sfp_class = class_create(THIS_MODULE, "sfp"); + if (IS_INVALID_PTR(sfp_class)) + { + sfp_class = NULL; + printk(KERN_CRIT "create e582_48x6q class sfp failed\n"); + return -1; + } + + for (i=1; i<=PORT_NUM; i++) + { + sfp_dev[i] = device_create(sfp_class, NULL, MKDEV(223,i), NULL, "sfp%d", i); + if (IS_INVALID_PTR(sfp_dev[i])) + { + sfp_dev[i] = NULL; + printk(KERN_CRIT "create e582_48x6q sfp[%d] device failed\n", i); + continue; + } + + ret = device_create_file(sfp_dev[i], &dev_attr_sfp_presence); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q sfp[%d] device attr:presence failed\n", i); + continue; + } + + ret = device_create_file(sfp_dev[i], &dev_attr_sfp_enable); + if (ret != 0) + { + printk(KERN_CRIT "create e582_48x6q sfp[%d] device attr:enable failed\n", i); + continue; + } + } + + return ret; +} + +static int e582_48x6q_exit_sfp(void) +{ + int i = 0; + + for (i=1; i<=PORT_NUM; i++) + { + if (IS_VALID_PTR(sfp_dev[i])) + { + device_remove_file(sfp_dev[i], &dev_attr_sfp_presence); + device_remove_file(sfp_dev[i], &dev_attr_sfp_enable); + device_destroy(sfp_class, MKDEV(223,i)); + sfp_dev[i] = NULL; + } + } + + if (IS_VALID_PTR(sfp_class)) + { + class_destroy(sfp_class); + sfp_class = NULL; + } + + return 0; +} +#endif + +static int e582_48x6q_init(void) +{ + int ret = 0; + int failed = 0; + + printk(KERN_ALERT "install e582_48x6q board dirver...\n"); + + ret = e582_48x6q_init_i2c_master(); + if (ret != 0) + { + failed = 1; + } + + ret = e582_48x6q_init_i2c_pca9548(); + if (ret != 0) + { + failed = 1; + } + + ret = e582_48x6q_init_i2c_adt7470(); + if (ret != 0) + { + failed = 1; + } + + ret = e582_48x6q_init_i2c_psu(); + if (ret != 0) + { + failed = 1; + } + + ret = e582_48x6q_init_i2c_epld(); + if (ret != 0) + { + failed = 1; + } + + ret = e582_48x6q_init_i2c_gpio(); + if (ret != 0) + { + failed = 1; + } + + ret = e582_48x6q_init_psu(); + if (ret != 0) + { + failed = 1; + } + + ret = e582_48x6q_init_led(); + if (ret != 0) + { + failed = 1; + } + + ret = e582_48x6q_init_sfp(); + if (ret != 0) + { + failed = 1; + } + + if (failed) + printk(KERN_INFO "install e582_48x6q board driver failed\n"); + else + printk(KERN_ALERT "install e582_48x6q board dirver...ok\n"); + + return 0; +} + +static void e582_48x6q_exit(void) +{ + printk(KERN_INFO "uninstall e582_48x6q board dirver...\n"); + + e582_48x6q_exit_sfp(); + e582_48x6q_exit_led(); + e582_48x6q_exit_psu(); + e582_48x6q_exit_i2c_gpio(); + e582_48x6q_exit_i2c_epld(); + e582_48x6q_exit_i2c_psu(); + e582_48x6q_exit_i2c_adt7470(); + e582_48x6q_exit_i2c_pca9548(); + e582_48x6q_exit_i2c_master(); +} + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("yangbs centecNetworks, Inc"); +MODULE_DESCRIPTION("e582-48x6q board driver"); +module_init(e582_48x6q_init); +module_exit(e582_48x6q_exit); + diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_kernel.c b/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_kernel.c new file mode 100644 index 000000000000..a1315a97159b --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_kernel.c @@ -0,0 +1,1822 @@ +/** + @file dal_kernal.c + + @date 2012-10-18 + + @version v2.0 + + +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) +#include +#endif +#include "dal_kernel.h" +#include "dal_mpool.h" + +MODULE_AUTHOR("Centec Networks Inc."); +MODULE_DESCRIPTION("DAL kernel module"); +MODULE_LICENSE("GPL"); + +/* DMA memory pool size */ +static char* dma_pool_size; +module_param(dma_pool_size, charp, 0); +MODULE_PARM_DESC(dma_pool_size, + "Specify DMA memory pool size (default 4MB)"); + +/***************************************************************************** + * defines + *****************************************************************************/ +#define MB_SIZE 0x100000 +#define CTC_MAX_INTR_NUM 8 + +#define MEM_MAP_RESERVE SetPageReserved +#define MEM_MAP_UNRESERVE ClearPageReserved + +#define CTC_VENDOR_VID 0xc001 +#define CTC_HUMBER_DEVICE_ID 0x6048 +#define CTC_GOLDENGATE_DEVICE_ID 0xcb10 + +#define MEM_MAP_RESERVE SetPageReserved +#define MEM_MAP_UNRESERVE ClearPageReserved + +#define CTC_GREATBELT_DEVICE_ID 0x03e8 /* TBD */ +#define DAL_MAX_CHIP_NUM 8 /* [GB] used */ +#define VIRT_TO_PAGE(p) virt_to_page((p)) +#define DAL_UNTAG_BLOCK 0 +#define DAL_DISCARD_BLOCK 1 +#define DAL_MATCHED_BLOCK 2 +#define DAL_CUR_MATCH_BLOCk 3 +/***************************************************************************** + * typedef + *****************************************************************************/ +/* Control Data */ +typedef struct dal_isr_s +{ + int irq; + void (* isr)(void*); + void* isr_data; + int trigger; + int count; + wait_queue_head_t wqh; +} dal_isr_t; + +typedef struct dal_kernel_dev_s +{ + struct list_head list; + struct pci_dev* pci_dev; + + /* PCI I/O mapped base address */ + uintptr logic_address; + + /* Physical address */ + uintptr phys_address; +} dal_kern_dev_t; + +typedef struct _dma_segment +{ + struct list_head list; + unsigned long req_size; /* Requested DMA segment size */ + unsigned long blk_size; /* DMA block size */ + unsigned long blk_order; /* DMA block size in alternate format */ + unsigned long seg_size; /* Current DMA segment size */ + unsigned long seg_begin; /* Logical address of segment */ + unsigned long seg_end; /* Logical end address of segment */ + unsigned long* blk_ptr; /* Array of logical DMA block addresses */ + int blk_cnt_max; /* Maximum number of block to allocate */ + int blk_cnt; /* Current number of blocks allocated */ +} dma_segment_t; + +typedef irqreturn_t (*p_func) (int irq, void* dev_id); + +/*************************************************************************** + *declared + ***************************************************************************/ +static unsigned int linux_dal_poll0(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll1(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll2(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll3(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll4(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll5(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll6(struct file* filp, struct poll_table_struct* p); +static unsigned int linux_dal_poll7(struct file* filp, struct poll_table_struct* p); + +/***************************************************************************** + * global variables + *****************************************************************************/ +static dal_kern_dev_t dal_dev[DAL_MAX_CHIP_NUM]; +static dal_isr_t dal_isr[CTC_MAX_INTR_NUM]; +static int dal_chip_num = 0; +static int dal_version = 0; +static int dal_intr_num = 0; +static int use_high_memory = 0; +static unsigned int* dma_virt_base[DAL_MAX_CHIP_NUM]; +#ifndef DMA_MEM_MODE_PLATFORM +static unsigned int* dma_virt_base_tmp[DAL_MAX_CHIP_NUM]; +#endif +static uintptr dma_phy_base[DAL_MAX_CHIP_NUM]; +static unsigned int dma_mem_size = 0x800000; +static unsigned int msi_irq_base[DAL_MAX_CHIP_NUM]; +static unsigned int msi_irq_num[DAL_MAX_CHIP_NUM]; +static unsigned int msi_used = 0; +static struct class *dal_class; + +static LIST_HEAD(_dma_seg); +static int dal_debug = 0; +module_param(dal_debug, int, 0); +MODULE_PARM_DESC(dal_debug, "Set debug level (default 0)"); + +static struct pci_device_id dal_id_table[] = +{ + {PCI_DEVICE(CTC_VENDOR_VID, CTC_GREATBELT_DEVICE_ID)}, + {PCI_DEVICE(0xcb10, 0xc010)}, + {0, }, +}; + +static wait_queue_head_t poll_intr[CTC_MAX_INTR_NUM]; + +p_func intr_handler_fun[CTC_MAX_INTR_NUM]; + +static int poll_intr_trigger[CTC_MAX_INTR_NUM]; + +static struct file_operations dal_intr_fops[CTC_MAX_INTR_NUM] = +{ + { + .owner = THIS_MODULE, + .poll = linux_dal_poll0, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll1, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll2, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll3, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll4, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll5, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll6, + }, + { + .owner = THIS_MODULE, + .poll = linux_dal_poll7, + }, +}; + +/***************************************************************************** + * macros + *****************************************************************************/ +#define VERIFY_CHIP_INDEX(n) (n < dal_chip_num) + +#define _KERNEL_INTERUPT_PROCESS +static irqreturn_t +intr0_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + + if(poll_intr_trigger[0]) + { + return IRQ_HANDLED; + } + + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[0] = 1; + wake_up(&poll_intr[0]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr1_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[1]) + { + return IRQ_HANDLED; + } + + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[1] = 1; + wake_up(&poll_intr[1]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr2_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[2]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[2] = 1; + wake_up(&poll_intr[2]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr3_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[3]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[3] = 1; + wake_up(&poll_intr[3]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr4_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[4]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[4] = 1; + wake_up(&poll_intr[4]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr5_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[5]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[5] = 1; + wake_up(&poll_intr[5]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr6_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[6]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[6] = 1; + wake_up(&poll_intr[6]); + } + } + + return IRQ_HANDLED; +} + +static irqreturn_t +intr7_handler(int irq, void* dev_id) +{ + dal_isr_t* p_dal_isr = (dal_isr_t*)dev_id; + if(poll_intr_trigger[7]) + { + return IRQ_HANDLED; + } + disable_irq_nosync(irq); + + if (p_dal_isr) + { + if (p_dal_isr->isr) + { + /* kernel mode interrupt handler */ + p_dal_isr->isr(p_dal_isr->isr_data); + } + else if ((NULL == p_dal_isr->isr) && (NULL == p_dal_isr->isr_data)) + { + /* user mode interrupt handler */ + poll_intr_trigger[7] = 1; + wake_up(&poll_intr[7]); + } + } + + return IRQ_HANDLED; +} + +int +dal_interrupt_register(unsigned int irq, int prio, void (* isr)(void*), void* data) +{ + int ret; + unsigned char str[16]; + unsigned char* int_name = NULL; + unsigned int intr_num_tmp = 0; + unsigned int intr_num = CTC_MAX_INTR_NUM; + unsigned long irq_flags = 0; + + if (dal_intr_num >= CTC_MAX_INTR_NUM) + { + printk("Interrupt numbers exceeds max.\n"); + return -1; + } + + if (msi_used) + { + int_name = "dal_msi"; + } + else + { + int_name = "dal_intr"; + } + + + for (intr_num_tmp=0;intr_num_tmp < CTC_MAX_INTR_NUM; intr_num_tmp++) + { + if (irq == dal_isr[intr_num_tmp].irq) + { + dal_isr[intr_num_tmp].count++; + printk("Interrupt irq %d register count %d.\n", irq, dal_isr[intr_num_tmp].count); + return 0; + } + if ((0 == dal_isr[intr_num_tmp].irq) && (CTC_MAX_INTR_NUM == intr_num)) + { + intr_num = intr_num_tmp; + dal_isr[intr_num].count = 0; + } + } + dal_isr[intr_num].irq = irq; + dal_isr[intr_num].isr = isr; + dal_isr[intr_num].isr_data = data; + dal_isr[intr_num].count++; + + init_waitqueue_head(&poll_intr[intr_num]); + + /* only user mode */ + if ((NULL == isr) && (NULL == data)) + { + snprintf(str, 16, "%s%d", "dal_intr", intr_num); + ret = register_chrdev(DAL_DEV_INTR_MAJOR_BASE + intr_num, + str, &dal_intr_fops[intr_num]); + if (ret < 0) + { + printk("Register character device for irq %d failed, ret= %d", irq, ret); + return ret; + } + } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) + irq_flags = 0; +#else + irq_flags = IRQF_DISABLED; +#endif + if ((ret = request_irq(irq, + intr_handler_fun[intr_num], + irq_flags, + int_name, + &dal_isr[intr_num])) < 0) + { + printk("Cannot request irq %d, ret %d.\n", irq, ret); + unregister_chrdev(DAL_DEV_INTR_MAJOR_BASE + intr_num, str); + } + + if (0 == ret) + { + dal_intr_num++; + } + + return ret; +} + +int +dal_interrupt_unregister(unsigned int irq) +{ + unsigned char str[16]; + int intr_idx = 0; + int find_flag = 0; + + /* get intr device index */ + for (intr_idx = 0; intr_idx < CTC_MAX_INTR_NUM; intr_idx++) + { + if (dal_isr[intr_idx].irq == irq) + { + find_flag = 1; + break; + } + } + + if (find_flag == 0) + { + printk ("irq%d is not registered! unregister failed \n", irq); + return -1; + } + + dal_isr[intr_idx].count--; + if (0 != dal_isr[intr_idx].count) + { + printk("Interrupt irq %d unregister count %d.\n", irq, dal_isr[intr_idx].count); + return -1; + } + snprintf(str, 16, "%s%d", "dal_intr", intr_idx); + + unregister_chrdev(DAL_DEV_INTR_MAJOR_BASE + intr_idx, str); + + free_irq(irq, &dal_isr[intr_idx]); + + dal_isr[intr_idx].irq = 0; + + dal_intr_num--; + + return 0; +} + +int +dal_interrupt_set_en(unsigned int irq, unsigned int enable) +{ + enable ? enable_irq(irq) : disable_irq_nosync(irq); + return 0; +} + +static int +_dal_set_msi_enabe(unsigned int lchip, unsigned int irq_num) +{ + int ret = 0; + + if (irq_num == 1) + { + if (msi_irq_base[lchip]) + { + dal_interrupt_unregister(msi_irq_base[lchip]); + pci_disable_msi(dal_dev[lchip].pci_dev); + msi_used = 0; + msi_irq_base[lchip] = 0; + msi_irq_num[lchip] = 0; + } + ret = pci_enable_msi(dal_dev[lchip].pci_dev); + if (ret) + { + printk ("msi enable failed!!! lchip = %d, irq_num = %d\n", lchip, irq_num); + pci_disable_msi(dal_dev[lchip].pci_dev); + msi_used = 0; + } + + msi_irq_base[lchip] = dal_dev[lchip].pci_dev->irq; + msi_irq_num[lchip] = 1; + } + else + { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 79)) + ret = pci_enable_msi_exact(dal_dev[lchip].pci_dev, irq_num); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 26, 32)) + ret = pci_enable_msi_block(dal_dev[lchip].pci_dev, irq_num); +#else + ret = -1; +#endif + if (ret) + { + printk ("msi enable failed!!! lchip = %d, irq_num = %d\n", lchip, irq_num); + pci_disable_msi(dal_dev[lchip].pci_dev); + msi_used = 0; + } + + msi_irq_base[lchip] = dal_dev[lchip].pci_dev->irq; + msi_irq_num[lchip] = irq_num; + } + + return ret; +} + +static int +_dal_set_msi_disable(unsigned int lchip) +{ + + pci_disable_msi(dal_dev[lchip].pci_dev); + + msi_irq_base[lchip] = 0; + msi_irq_num[lchip] = 0; + + return 0; +} + +int +dal_set_msi_cap(unsigned long arg) +{ + int ret = 0; + dal_msi_info_t msi_info; + + if (copy_from_user(&msi_info, (void*)arg, sizeof(dal_msi_info_t))) + { + return -EFAULT; + } + + printk("####dal_set_msi_cap lchip %d base %d num:%d\n", msi_info.lchip, msi_info.irq_base, msi_info.irq_num); + if (msi_info.irq_num > 0) + { + msi_used = 1; + ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num); + } + else + { + msi_used = 0; + ret = _dal_set_msi_disable(msi_info.lchip); + } + + return ret; +} + +int +dal_user_interrupt_register(unsigned long arg) +{ + int irq = 0; + if (copy_from_user(&irq, (void*)arg, sizeof(int))) + { + return -EFAULT; + } + printk("####register interrupt irq:%d\n", irq); + return dal_interrupt_register(irq, 0, NULL, NULL); +} + +int +dal_user_interrupt_unregister(unsigned long arg) +{ + int irq = 0; + if (copy_from_user(&irq, (void*)arg, sizeof(int))) + { + return -EFAULT; + } + printk("####unregister interrupt irq:%d\n", irq); + return dal_interrupt_unregister(irq); +} + +int +dal_user_interrupt_set_en(unsigned long arg) +{ + dal_intr_parm_t dal_intr_parm; + + if (copy_from_user(&dal_intr_parm, (void*)arg, sizeof(dal_intr_parm_t))) + { + return -EFAULT; + } + + return dal_interrupt_set_en(dal_intr_parm.irq, dal_intr_parm.enable); +} + +/* + * Function: _dal_dma_segment_free + */ + +/* + * Function: _find_largest_segment + * + * Purpose: + * Find largest contiguous segment from a pool of DMA blocks. + * Parameters: + * dseg - DMA segment descriptor + * Returns: + * 0 on success, < 0 on error. + * Notes: + * Assembly stops if a segment of the requested segment size + * has been obtained. + * + * Lower address bits of the DMA blocks are used as follows: + * 0: Untagged + * 1: Discarded block + * 2: Part of largest contiguous segment + * 3: Part of current contiguous segment + */ +#ifndef DMA_MEM_MODE_PLATFORM +static int +_dal_find_largest_segment(dma_segment_t* dseg) +{ + int i, j, blks, found; + unsigned long seg_begin; + unsigned long seg_end; + unsigned long seg_tmp; + + blks = dseg->blk_cnt; + + /* Clear all block tags */ + for (i = 0; i < blks; i++) + { + dseg->blk_ptr[i] &= ~3; + } + + for (i = 0; i < blks && dseg->seg_size < dseg->req_size; i++) + { + /* First block must be an untagged block */ + if ((dseg->blk_ptr[i] & 3) == DAL_UNTAG_BLOCK) + { + /* Initial segment size is the block size */ + seg_begin = dseg->blk_ptr[i]; + seg_end = seg_begin + dseg->blk_size; + dseg->blk_ptr[i] |= DAL_CUR_MATCH_BLOCk; + + /* Loop looking for adjacent blocks */ + do + { + found = 0; + + for (j = i + 1; j < blks && (seg_end - seg_begin) < dseg->req_size; j++) + { + seg_tmp = dseg->blk_ptr[j]; + /* Check untagged blocks only */ + if ((seg_tmp & 3) == DAL_UNTAG_BLOCK) + { + if (seg_tmp == (seg_begin - dseg->blk_size)) + { + /* Found adjacent block below current segment */ + dseg->blk_ptr[j] |= DAL_CUR_MATCH_BLOCk; + seg_begin = seg_tmp; + found = 1; + } + else if (seg_tmp == seg_end) + { + /* Found adjacent block above current segment */ + dseg->blk_ptr[j] |= DAL_CUR_MATCH_BLOCk; + seg_end += dseg->blk_size; + found = 1; + } + } + } + } + while (found); + + if ((seg_end - seg_begin) > dseg->seg_size) + { + /* The current block is largest so far */ + dseg->seg_begin = seg_begin; + dseg->seg_end = seg_end; + dseg->seg_size = seg_end - seg_begin; + + /* Re-tag current and previous largest segment */ + for (j = 0; j < blks; j++) + { + if ((dseg->blk_ptr[j] & 3) == DAL_CUR_MATCH_BLOCk) + { + /* Tag current segment as the largest */ + dseg->blk_ptr[j] &= ~1; + } + else if ((dseg->blk_ptr[j] & 3) == DAL_MATCHED_BLOCK) + { + /* Discard previous largest segment */ + dseg->blk_ptr[j] ^= 3; + } + } + } + else + { + /* Discard all blocks in current segment */ + for (j = 0; j < blks; j++) + { + if ((dseg->blk_ptr[j] & 3) == DAL_CUR_MATCH_BLOCk) + { + dseg->blk_ptr[j] &= ~2; + } + } + } + } + } + + return 0; +} + +/* + * Function: _alloc_dma_blocks + */ +static int +_dal_alloc_dma_blocks(dma_segment_t* dseg, int blks) +{ + int i, start; + unsigned long addr; + + if (dseg->blk_cnt + blks > dseg->blk_cnt_max) + { + printk("No more DMA blocks\n"); + return -1; + } + + start = dseg->blk_cnt; + dseg->blk_cnt += blks; + + for (i = start; i < dseg->blk_cnt; i++) + { + addr = __get_free_pages(GFP_ATOMIC, dseg->blk_order); + if (addr) + { + dseg->blk_ptr[i] = addr; + } + else + { + printk("DMA allocation failed\n"); + return -1; + } + } + + return 0; +} + +/* + * Function: _dal_dma_segment_alloc + */ +static dma_segment_t* +_dal_dma_segment_alloc(unsigned int size, unsigned int blk_size) +{ + dma_segment_t* dseg; + int i, blk_ptr_size; + unsigned long page_addr; + struct sysinfo si; + + /* Sanity check */ + if (size == 0 || blk_size == 0) + { + return NULL; + } + + /* Allocate an initialize DMA segment descriptor */ + if ((dseg = kmalloc(sizeof(dma_segment_t), GFP_ATOMIC)) == NULL) + { + return NULL; + } + + memset(dseg, 0, sizeof(dma_segment_t)); + dseg->req_size = size; + dseg->blk_size = PAGE_ALIGN(blk_size); + + while ((PAGE_SIZE << dseg->blk_order) < dseg->blk_size) + { + dseg->blk_order++; + } + + si_meminfo(&si); + dseg->blk_cnt_max = (si.totalram << PAGE_SHIFT) / dseg->blk_size; + blk_ptr_size = dseg->blk_cnt_max * sizeof(unsigned long); + /* Allocate an initialize DMA block pool */ + dseg->blk_ptr = kmalloc(blk_ptr_size, GFP_KERNEL); + if (dseg->blk_ptr == NULL) + { + kfree(dseg); + return NULL; + } + + memset(dseg->blk_ptr, 0, blk_ptr_size); + /* Allocate minimum number of blocks */ + _dal_alloc_dma_blocks(dseg, dseg->req_size / dseg->blk_size); + + /* Allocate more blocks until we have a complete segment */ + do + { + _dal_find_largest_segment(dseg); + if (dseg->seg_size >= dseg->req_size) + { + break; + } + } + while (_dal_alloc_dma_blocks(dseg, 8) == 0); + + /* Reserve all pages in the DMA segment and free unused blocks */ + for (i = 0; i < dseg->blk_cnt; i++) + { + if ((dseg->blk_ptr[i] & 3) == 2) + { + dseg->blk_ptr[i] &= ~3; + + for (page_addr = dseg->blk_ptr[i]; + page_addr < dseg->blk_ptr[i] + dseg->blk_size; + page_addr += PAGE_SIZE) + { + MEM_MAP_RESERVE(VIRT_TO_PAGE((void*)page_addr)); + } + } + else if (dseg->blk_ptr[i]) + { + dseg->blk_ptr[i] &= ~3; + free_pages(dseg->blk_ptr[i], dseg->blk_order); + dseg->blk_ptr[i] = 0; + } + } + + return dseg; +} + +/* + * Function: _dal_dma_segment_free + */ +static void +_dal_dma_segment_free(dma_segment_t* dseg) +{ + int i; + unsigned long page_addr; + + if (dseg->blk_ptr) + { + for (i = 0; i < dseg->blk_cnt; i++) + { + if (dseg->blk_ptr[i]) + { + for (page_addr = dseg->blk_ptr[i]; + page_addr < dseg->blk_ptr[i] + dseg->blk_size; + page_addr += PAGE_SIZE) + { + MEM_MAP_UNRESERVE(VIRT_TO_PAGE(page_addr)); + } + + free_pages(dseg->blk_ptr[i], dseg->blk_order); + } + } + + kfree(dseg->blk_ptr); + kfree(dseg); + } +} + +/* + * Function: -dal_pgalloc + */ +static void* +_dal_pgalloc(unsigned int size) +{ + dma_segment_t* dseg; + unsigned int blk_size; + + blk_size = (size < DMA_BLOCK_SIZE) ? size : DMA_BLOCK_SIZE; + if ((dseg = _dal_dma_segment_alloc(size, blk_size)) == NULL) + { + return NULL; + } + + if (dseg->seg_size < size) + { + /* If we didn't get the full size then forget it */ + printk("Notice: Can not get enough memory for requset!!\n"); + printk("actual size:0x%lx, request size:0x%x\n", dseg->seg_size, size); + //-_dal_dma_segment_free(dseg); + //-return NULL; + } + + list_add(&dseg->list, &_dma_seg); + return (void*)dseg->seg_begin; +} + +/* + * Function: _dal_pgfree + */ +static int +_dal_pgfree(void* ptr) +{ + struct list_head* pos; + + list_for_each(pos, &_dma_seg) + { + dma_segment_t* dseg = list_entry(pos, dma_segment_t, list); + if (ptr == (void*)dseg->seg_begin) + { + list_del(&dseg->list); + _dal_dma_segment_free(dseg); + return 0; + } + } + return -1; +} +#endif +static void +dal_alloc_dma_pool(int lchip, int size) +{ + if (use_high_memory) + { + dma_phy_base[lchip] = virt_to_bus(high_memory); + dma_virt_base[lchip] = ioremap_nocache(dma_phy_base[lchip], size); + } + else + { +#ifdef DMA_MEM_MODE_PLATFORM + dma_virt_base[lchip] = dma_alloc_coherent(&(dal_dev[lchip].pci_dev->dev), dma_mem_size, + &dma_phy_base[lchip], GFP_KERNEL); + + printk(KERN_WARNING "########Using DMA_MEM_MODE_PLATFORM \n"); +#endif + +#ifndef DMA_MEM_MODE_PLATFORM + /* Get DMA memory from kernel */ + dma_virt_base_tmp[lchip] = _dal_pgalloc(size); + dma_phy_base[lchip] = virt_to_bus(dma_virt_base_tmp[lchip]); + dma_virt_base [lchip]= ioremap_nocache(dma_phy_base[lchip], size); +#endif + } +} + +static void +dal_free_dma_pool(int lchip) +{ + int ret = 0; + ret = ret; + if (use_high_memory) + { + iounmap(dma_virt_base[lchip]); + } + else + { +#ifdef DMA_MEM_MODE_PLATFORM + dma_free_coherent(&(dal_dev[lchip].pci_dev->dev), dma_mem_size, + dma_virt_base[lchip], dma_phy_base[lchip]); +#endif + +#ifndef DMA_MEM_MODE_PLATFORM + iounmap(dma_virt_base[lchip]); + ret = _dal_pgfree(dma_virt_base_tmp[lchip]); + if(ret<0) + { + printk("Dma free memory fail !!!!!! \n"); + } +#endif + } +} + +#define _KERNEL_DAL_IO +static int +_dal_pci_read(unsigned char lchip, unsigned int offset, unsigned int* value) +{ + if (!VERIFY_CHIP_INDEX(lchip)) + { + return -1; + } + + *value = *(volatile unsigned int*)(dal_dev[lchip].logic_address + offset); + return 0; +} + +int +dal_create_irq_mapping(unsigned long arg) +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) + dal_irq_mapping_t irq_map; + + if (copy_from_user(&irq_map, (void*)arg, sizeof(dal_irq_mapping_t))) + { + return -EFAULT; + } + + irq_map.sw_irq = irq_create_mapping(NULL, irq_map.hw_irq); + if (irq_map.sw_irq == NO_IRQ) + { + printk("IRQ mapping fail !!!!!! \n"); + return -1; + } + + if (copy_to_user((dal_irq_mapping_t*)arg, (void*)&irq_map, sizeof(dal_irq_mapping_t))) + { + return -EFAULT; + } +#endif + return 0; +} + +int +dal_pci_read(unsigned long arg) +{ + dal_chip_parm_t cmdpara_chip; + + if (copy_from_user(&cmdpara_chip, (void*)arg, sizeof(dal_chip_parm_t))) + { + return -EFAULT; + } + + _dal_pci_read((unsigned char)cmdpara_chip.chip_id, (unsigned int)cmdpara_chip.reg_addr, + (unsigned int*)(&(cmdpara_chip.value))); + + if (copy_to_user((dal_chip_parm_t*)arg, (void*)&cmdpara_chip, sizeof(dal_chip_parm_t))) + { + return -EFAULT; + } + + return 0; +} + +static int +_dal_pci_write(unsigned char lchip, unsigned int offset, unsigned int value) +{ + if (!VERIFY_CHIP_INDEX(lchip)) + { + return -1; + } + + *(volatile unsigned int*)(dal_dev[lchip].logic_address + offset) = value; + return 0; +} + +int +dal_pci_write(unsigned long arg) +{ + dal_chip_parm_t cmdpara_chip; + + if (copy_from_user(&cmdpara_chip, (void*)arg, sizeof(dal_chip_parm_t))) + { + return -EFAULT; + } + + _dal_pci_write((unsigned char)cmdpara_chip.chip_id, (unsigned int)cmdpara_chip.reg_addr, + (unsigned int)cmdpara_chip.value); + + return 0; +} + +int +dal_pci_conf_read(unsigned char lchip, unsigned int offset, unsigned int* value) +{ + if (!VERIFY_CHIP_INDEX(lchip)) + { + return -1; + } + + pci_read_config_dword(dal_dev[lchip].pci_dev, offset, value); + return 0; +} + +int +dal_pci_conf_write(unsigned char lchip, unsigned int offset, unsigned int value) +{ + if (!VERIFY_CHIP_INDEX(lchip)) + { + return -1; + } + + pci_write_config_dword(dal_dev[lchip].pci_dev, offset, value); + return 0; +} +int +dal_user_read_pci_conf(unsigned long arg) +{ + dal_pci_cfg_ioctl_t dal_cfg; + + if (copy_from_user(&dal_cfg, (void*)arg, sizeof(dal_pci_cfg_ioctl_t))) + { + return -EFAULT; + } + + if (dal_pci_conf_read(dal_cfg.chip_id, dal_cfg.offset, &dal_cfg.value)) + { + printk("dal_pci_conf_read failed.\n"); + return -EFAULT; + } + + if (copy_to_user((dal_pci_cfg_ioctl_t*)arg, (void*)&dal_cfg, sizeof(dal_pci_cfg_ioctl_t))) + { + return -EFAULT; + } + + return 0; +} + +int +dal_user_write_pci_conf(unsigned long arg) +{ + dal_pci_cfg_ioctl_t dal_cfg; + + if (copy_from_user(&dal_cfg, (void*)arg, sizeof(dal_pci_cfg_ioctl_t))) + { + return -EFAULT; + } + + return dal_pci_conf_write(dal_cfg.chip_id, dal_cfg.offset, dal_cfg.value); +} + +static int +linux_get_device(unsigned long arg) +{ + dal_user_dev_t user_dev; + int chip_id = 0; + + if (copy_from_user(&user_dev, (void*)arg, sizeof(user_dev))) + { + return -EFAULT; + } + + user_dev.chip_num = dal_chip_num; + chip_id = user_dev.chip_id; + + if (chip_id < dal_chip_num) + { + user_dev.phy_base0 = (unsigned int)dal_dev[chip_id].phys_address; + #ifdef PHYS_ADDR_IS_64BIT + user_dev.phy_base1 = (unsigned int)(dal_dev[chip_id].phys_address >> 32); + #else + user_dev.phy_base1 = 0; + #endif + + user_dev.bus_no = dal_dev[chip_id].pci_dev->bus->number; + user_dev.dev_no = dal_dev[chip_id].pci_dev->device; + user_dev.fun_no = dal_dev[chip_id].pci_dev->devfn; + } + + if (copy_to_user((dal_user_dev_t*)arg, (void*)&user_dev, sizeof(user_dev))) + { + return -EFAULT; + } + + return 0; +} + +/* set dal version, copy to user */ +static int +linux_get_dal_version(unsigned long arg) +{ + int dal_ver = VERSION_1DOT2; /* set dal version */ + + if (copy_to_user((int*)arg, (void*)&dal_ver, sizeof(dal_ver))) + { + return -EFAULT; + } + + dal_version = dal_ver; /* up sw */ + + return 0; +} + +static int +linux_get_dma_info(unsigned long arg) +{ + dma_info_t dma_para; + + if (copy_from_user(&dma_para, (void*)arg, sizeof(dma_info_t))) + { + return -EFAULT; + } + + dma_para.phy_base = (unsigned int)dma_phy_base[dma_para.lchip]; + #ifdef PHYS_ADDR_IS_64BIT + dma_para.phy_base_hi = dma_phy_base[dma_para.lchip] >> 32; + #else + dma_para.phy_base_hi = 0; + #endif + dma_para.size = dma_mem_size; + + if (copy_to_user((dma_info_t*)arg, (void*)&dma_para, sizeof(dma_info_t))) + { + return -EFAULT; + } + + return 0; +} + +static int +dal_get_msi_info(unsigned long arg) +{ + dal_msi_info_t msi_para; + unsigned int lchip = 0; + + /* get lchip form user mode */ + if (copy_from_user(&msi_para, (void*)arg, sizeof(dal_msi_info_t))) + { + return -EFAULT; + } + lchip = msi_para.lchip; + + msi_para.irq_base = msi_irq_base[lchip]; + msi_para.irq_num = msi_irq_num[lchip]; + + /* send msi info to user mode */ + if (copy_to_user((dal_msi_info_t*)arg, (void*)&msi_para, sizeof(dal_msi_info_t))) + { + return -EFAULT; + } + + return 0; +} + + +static int +dal_get_intr_info(unsigned long arg) +{ + dal_intr_info_t intr_para; + unsigned int intr_num = 0; + + /* get lchip form user mode */ + if (copy_from_user(&intr_para, (void*)arg, sizeof(dal_intr_info_t))) + { + return -EFAULT; + } + + intr_para.irq_idx = CTC_MAX_INTR_NUM; + for (intr_num=0; intr_num< CTC_MAX_INTR_NUM; intr_num++) + { + if (intr_para.irq == dal_isr[intr_num].irq) + { + intr_para.irq_idx = intr_num; + break; + } + } + + if (CTC_MAX_INTR_NUM == intr_para.irq_idx) + { + printk("Interrupt %d cann't find.\n", intr_para.irq); + } + /* send msi info to user mode */ + if (copy_to_user((dal_intr_info_t*)arg, (void*)&intr_para, sizeof(dal_intr_info_t))) + { + return -EFAULT; + } + + return 0; +} + +static int +dal_cache_inval(unsigned long arg) +{ + dal_dma_cache_info_t intr_para; + + if (copy_from_user(&intr_para, (void*)arg, sizeof(dal_dma_cache_info_t))) + { + return -EFAULT; + } + +#if 0 + dma_cache_wback_inv((unsigned long)intr_para.ptr, intr_para.length); +#endif + +#if 0 + dma_sync_single_for_cpu(NULL, intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL); +#endif + + dma_cache_sync(NULL, (void*)intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL); + + return 0; +} + +static int +dal_cache_flush(unsigned long arg) +{ + dal_dma_cache_info_t intr_para; + + if (copy_from_user(&intr_para, (void*)arg, sizeof(dal_dma_cache_info_t))) + { + return -EFAULT; + } + +#if 0 + dma_cache_wback_inv(intr_para.ptr, intr_para.length); +#endif + +#if 0 + dma_sync_single_for_cpu(NULL, intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL); +#endif + + dma_cache_sync(NULL, (void*)intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL); + + return 0; +} + +int +linux_dal_probe(struct pci_dev* pdev, const struct pci_device_id* id) +{ + dal_kern_dev_t* dev = NULL; + int bar = 0; + int ret = 0; + unsigned int temp = 0; + unsigned int lchip = 0; + unsigned int chip_id = 0; + + printk(KERN_WARNING "********found dal device*****\n"); + + for (chip_id = 0; chip_id < DAL_MAX_CHIP_NUM; chip_id ++) + { + if (NULL == dal_dev[chip_id].pci_dev) + { + break; + } + } + + if (chip_id >= DAL_MAX_CHIP_NUM) + { + printk("Exceed max local chip num\n"); + return -1; + } + + dev = &dal_dev[chip_id]; + if (NULL == dev) + { + printk("Cannot obtain PCI resources\n"); + } + + lchip = chip_id; + dal_chip_num += 1; + + dev->pci_dev = pdev; + + if (pci_enable_device(pdev) < 0) + { + printk("Cannot enable PCI device: vendor id = %x, device id = %x\n", + pdev->vendor, pdev->device); + } + + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); + if (ret) + { + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); + if (ret) + { + printk("Could not set PCI DMA Mask\n"); + return ret; + } + } + + if (pci_request_regions(pdev, DAL_NAME) < 0) + { + printk("Cannot obtain PCI resources\n"); + } + + dev->phys_address = pci_resource_start(pdev, bar); + dev->logic_address = (uintptr)ioremap_nocache(dev->phys_address, + pci_resource_len(dev->pci_dev, bar)); + + _dal_pci_read(lchip, 0x48, &temp); + if (((temp >> 8) & 0xffff) == 0x3412) + { + printk("Little endian Cpu detected!!! \n"); + _dal_pci_write(lchip, 0x48, 0xFFFFFFFF); + } + + pci_set_master(pdev); + + /* alloc dma_mem_size for every chip */ + if (dma_mem_size) + { + dal_alloc_dma_pool(lchip, dma_mem_size); + #ifdef PHYS_ADDR_IS_64BIT + + /*add check Dma memory pool cannot cross 4G space*/ + if ((0==(dma_phy_base[lchip]>>32)) && (0!=((dma_phy_base[lchip]+dma_mem_size)>>32))) + { + printk("Dma malloc memory cross 4G space!!!!!! \n"); + return -1; + } + #endif + } + + printk(KERN_WARNING "linux_dal_probe end*****\n"); + + return 0; +} + +void +linux_dal_remove(struct pci_dev* pdev) +{ + unsigned int chip_id = 0; + unsigned int flag = 0; + + for (chip_id = 0; chip_id < DAL_MAX_CHIP_NUM; chip_id ++) + { + if (pdev == dal_dev[chip_id].pci_dev) + { + flag = 1; + break; + } + } + + if (1 == flag) + { + dal_free_dma_pool(chip_id); + pci_release_regions(pdev); + pci_disable_device(pdev); + + dal_dev[chip_id].pci_dev = NULL; + dal_chip_num--; + } + + +} + +#ifdef CONFIG_COMPAT +static long +linux_dal_ioctl(struct file* file, + unsigned int cmd, unsigned long arg) +#else + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 13)) +static int +linux_dal_ioctl(struct file* file, + unsigned int cmd, unsigned long arg) +#else +static int +linux_dal_ioctl(struct inode* inode, struct file* file, + unsigned int cmd, unsigned long arg) +#endif + +#endif +{ + switch (cmd) + { + + case CMD_READ_CHIP: + return dal_pci_read(arg); + + case CMD_WRITE_CHIP: + return dal_pci_write(arg); + + case CMD_GET_DEVICES: + return linux_get_device(arg); + + case CMD_GET_DAL_VERSION: + return linux_get_dal_version(arg); + + case CMD_GET_DMA_INFO: + return linux_get_dma_info(arg); + + case CMD_PCI_CONFIG_READ: + return dal_user_read_pci_conf(arg); + + case CMD_PCI_CONFIG_WRITE: + return dal_user_write_pci_conf(arg); + + case CMD_REG_INTERRUPTS: + return dal_user_interrupt_register(arg); + + case CMD_UNREG_INTERRUPTS: + return dal_user_interrupt_unregister(arg); + + case CMD_EN_INTERRUPTS: + return dal_user_interrupt_set_en(arg); + + case CMD_SET_MSI_CAP: + return dal_set_msi_cap(arg); + + case CMD_GET_MSI_INFO: + return dal_get_msi_info(arg); + + case CMD_IRQ_MAPPING: + return dal_create_irq_mapping(arg); + + case CMD_GET_INTR_INFO: + return dal_get_intr_info(arg); + + case CMD_CACHE_INVAL: + return dal_cache_inval(arg); + + case CMD_CACHE_FLUSH: + return dal_cache_flush(arg); + + default: + break; + } + + return 0; +} + +static unsigned int +linux_dal_poll0(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[0], p); + local_irq_save(flags); + if (poll_intr_trigger[0]) + { + poll_intr_trigger[0] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll1(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[1], p); + local_irq_save(flags); + if (poll_intr_trigger[1]) + { + poll_intr_trigger[1] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll2(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[2], p); + local_irq_save(flags); + if (poll_intr_trigger[2]) + { + poll_intr_trigger[2] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll3(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[3], p); + local_irq_save(flags); + if (poll_intr_trigger[3]) + { + poll_intr_trigger[3] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll4(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[4], p); + local_irq_save(flags); + if (poll_intr_trigger[4]) + { + poll_intr_trigger[4] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll5(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[5], p); + local_irq_save(flags); + if (poll_intr_trigger[5]) + { + poll_intr_trigger[5] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll6(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[6], p); + local_irq_save(flags); + if (poll_intr_trigger[6]) + { + poll_intr_trigger[6] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static unsigned int +linux_dal_poll7(struct file* filp, struct poll_table_struct* p) +{ + unsigned int mask = 0; + unsigned long flags; + + poll_wait(filp, &poll_intr[7], p); + local_irq_save(flags); + if (poll_intr_trigger[7]) + { + poll_intr_trigger[7] = 0; + mask |= POLLIN | POLLRDNORM; + } + + local_irq_restore(flags); + + return mask; +} + +static struct pci_driver linux_dal_driver = +{ + .name = DAL_NAME, + .id_table = dal_id_table, + .probe = linux_dal_probe, + .remove = linux_dal_remove, +}; + +static struct file_operations fops = +{ + .owner = THIS_MODULE, +#ifdef CONFIG_COMPAT + .compat_ioctl = linux_dal_ioctl, + .unlocked_ioctl = linux_dal_ioctl, +#else +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) + .unlocked_ioctl = linux_dal_ioctl, +#else + .ioctl = linux_dal_ioctl, +#endif +#endif +}; + + +static int __init +linux_dal_init(void) +{ + int ret = 0; + + /* Get DMA memory pool size form dal.ok input param, or use default dma_mem_size */ + if (dma_pool_size) + { + if ((dma_pool_size[strlen(dma_pool_size) - 1] & ~0x20) == 'M') + { + dma_mem_size = simple_strtoul(dma_pool_size, NULL, 0); + printk("dma_mem_size: 0x%x \n", dma_mem_size); + + dma_mem_size *= MB_SIZE; + } + else + { + printk("DMA memory pool size must be specified as e.g. dma_pool_size=8M\n"); + } + + if (dma_mem_size & (dma_mem_size - 1)) + { + printk("dma_mem_size must be a power of 2 (1M, 2M, 4M, 8M etc.)\n"); + dma_mem_size = 0; + } + } + + ret = register_chrdev(DAL_DEV_MAJOR, DAL_NAME, &fops); + if (ret < 0) + { + printk(KERN_WARNING "Register linux_dal device, ret %d\n", ret); + return ret; + } + + ret = pci_register_driver(&linux_dal_driver); + if (ret < 0) + { + printk(KERN_WARNING "Register ASIC PCI driver failed, ret %d\n", ret); + return ret; + } + + /* alloc /dev/linux_dal node */ + dal_class = class_create(THIS_MODULE, DAL_NAME); + device_create(dal_class, NULL, MKDEV(DAL_DEV_MAJOR, 0), NULL, DAL_NAME); + + /* init interrupt function */ + intr_handler_fun[0] = intr0_handler; + intr_handler_fun[1] = intr1_handler; + intr_handler_fun[2] = intr2_handler; + intr_handler_fun[3] = intr3_handler; + intr_handler_fun[4] = intr4_handler; + intr_handler_fun[5] = intr5_handler; + intr_handler_fun[6] = intr6_handler; + intr_handler_fun[7] = intr7_handler; + + return ret; +} + +static void __exit +linux_dal_exit(void) +{ + device_destroy(dal_class, MKDEV(DAL_DEV_MAJOR, 0)); + class_destroy(dal_class); + unregister_chrdev(DAL_DEV_MAJOR, "linux_dal"); + pci_unregister_driver(&linux_dal_driver); +} + +module_init(linux_dal_init); +module_exit(linux_dal_exit); + diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_kernel.h b/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_kernel.h new file mode 100644 index 000000000000..de39af67773b --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_kernel.h @@ -0,0 +1,170 @@ +/** + @file dal_kernel_io.h + + @author Copyright (C) 2012 Centec Networks Inc. All rights reserved. + + @date 2012-4-9 + + @version v2.0 + +*/ +#ifndef _DAL_KERNEL_H_ +#define _DAL_KERNEL_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(CONFIG_RESOURCES_64BIT) || defined(CONFIG_PHYS_ADDR_T_64BIT) +#define PHYS_ADDR_IS_64BIT +#endif + +#ifndef SDK_IN_USERMODE +#ifdef PHYS_ADDR_IS_64BIT +typedef long long intptr; +typedef unsigned long long uintptr; +#else +typedef int intptr; +typedef unsigned int uintptr; +#endif +#endif + +#define DAL_PCI_READ_ADDR 0x0 +#define DAL_PCI_READ_DATA 0xc +#define DAL_PCI_WRITE_ADDR 0x8 +#define DAL_PCI_WRITE_DATA 0x4 +#define DAL_PCI_STATUS 0x10 + +#define DAL_PCI_STATUS_IN_PROCESS 31 +#define DAL_PCI_STATUS_BAD_PARITY 5 +#define DAL_PCI_STATUS_CPU_ACCESS_ERR 4 +#define DAL_PCI_STATUS_READ_CMD 3 +#define DAL_PCI_STATUS_REGISTER_ERR 1 +#define DAL_PCI_STATUS_REGISTER_ACK 0 + +#define DAL_PCI_ACCESS_TIMEOUT 0x64 + +#define DAL_NAME "linux_dal" /* "linux_dal" */ + +#define DAL_DEV_MAJOR 198 + +#define DAL_DEV_INTR_MAJOR_BASE 200 + +#define DAL_DEV_NAME "/dev/" DAL_NAME +#define DAL_ONE_KB 1024 +#define DAL_ONE_MB (1024*1024) +struct dal_chip_parm_s +{ + unsigned int chip_id; /*tmp should be uint8*/ + unsigned int fpga_id; /*tmp add*/ + unsigned int reg_addr; + unsigned int value; +}; +typedef struct dal_chip_parm_s dal_chip_parm_t; + +struct dal_intr_parm_s +{ + unsigned int irq; + unsigned int enable; +}; +typedef struct dal_intr_parm_s dal_intr_parm_t; + +struct dal_irq_mapping_s +{ + unsigned int hw_irq; + unsigned int sw_irq; +}; +typedef struct dal_irq_mapping_s dal_irq_mapping_t; + +struct dal_user_dev_s +{ + unsigned int chip_num; /*output: local chip number*/ + unsigned int chip_id; /*input: local chip id*/ + unsigned int phy_base0; /* low 32bits physical base address */ + unsigned int phy_base1; /* high 32bits physical base address */ + unsigned int bus_no; + unsigned int dev_no; + unsigned int fun_no; + void* virt_base[2]; /* Virtual base address; this must be last member */ +}; +typedef struct dal_user_dev_s dal_user_dev_t; + +struct dma_info_s +{ + unsigned int lchip; + unsigned int phy_base; + unsigned int phy_base_hi; + unsigned int size; + unsigned int* virt_base; +}; +typedef struct dma_info_s dma_info_t; + +struct dal_pci_cfg_ioctl_s +{ + unsigned int chip_id; /* Device ID */ + unsigned int offset; + unsigned int value; +}; +typedef struct dal_pci_cfg_ioctl_s dal_pci_cfg_ioctl_t; + +struct dal_msi_info_s +{ + unsigned int lchip; + unsigned int irq_base; + unsigned int irq_num; +}; +typedef struct dal_msi_info_s dal_msi_info_t; + +struct dal_intr_info_s +{ + unsigned int irq; + unsigned int irq_idx; +}; +typedef struct dal_intr_info_s dal_intr_info_t; + +struct dal_dma_cache_info_s +{ + unsigned long ptr; + unsigned int length; +}; +typedef struct dal_dma_cache_info_s dal_dma_cache_info_t; + +#define CMD_MAGIC 'C' +#define CMD_WRITE_CHIP _IO(CMD_MAGIC, 0) /* for humber ioctrol*/ +#define CMD_READ_CHIP _IO(CMD_MAGIC, 1) /* for humber ioctrol*/ +#define CMD_GET_DEVICES _IO(CMD_MAGIC, 2) +#define CMD_GET_DAL_VERSION _IO(CMD_MAGIC, 3) +#define CMD_PCI_CONFIG_WRITE _IO(CMD_MAGIC, 4) +#define CMD_PCI_CONFIG_READ _IO(CMD_MAGIC, 5) +#define CMD_GET_DMA_INFO _IO(CMD_MAGIC, 6) +#define CMD_REG_INTERRUPTS _IO(CMD_MAGIC, 7) +#define CMD_UNREG_INTERRUPTS _IO(CMD_MAGIC, 8) +#define CMD_EN_INTERRUPTS _IO(CMD_MAGIC, 9) +#define CMD_I2C_READ _IO(CMD_MAGIC, 10) +#define CMD_I2C_WRITE _IO(CMD_MAGIC, 11) +#define CMD_GET_MSI_INFO _IO(CMD_MAGIC, 12) +#define CMD_SET_MSI_CAP _IO(CMD_MAGIC, 13) +#define CMD_IRQ_MAPPING _IO(CMD_MAGIC, 14) +#define CMD_GET_INTR_INFO _IO(CMD_MAGIC, 15) +#define CMD_CACHE_INVAL _IO(CMD_MAGIC, 16) +#define CMD_CACHE_FLUSH _IO(CMD_MAGIC, 17) + +enum dal_version_e +{ + VERSION_MIN, + VERSION_1DOT0, + VERSION_1DOT1, + VERSION_1DOT2, + + VERSION_MAX +}; +typedef enum dal_version_e dal_version_t; + +/* We try to assemble a contiguous segment from chunks of this size */ +#define DMA_BLOCK_SIZE (512 * DAL_ONE_KB) + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_mpool.c b/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_mpool.c new file mode 100644 index 000000000000..82d3b7a917a8 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_mpool.c @@ -0,0 +1,343 @@ + +#include "dal_mpool.h" + +#ifdef __KERNEL__ +#include +#include + +#define DAL_MALLOC(x) kmalloc(x, GFP_ATOMIC) +#define DAL_FREE(x) kfree(x) + +static spinlock_t dal_mpool_lock; +#define MPOOL_LOCK_INIT() spin_lock_init(&dal_mpool_lock) +#define MPOOL_LOCK() unsigned long flags; spin_lock_irqsave(&dal_mpool_lock, flags) +#define MPOOL_UNLOCK() spin_unlock_irqrestore(&dal_mpool_lock, flags) +#define DAL_PRINT(fmt,arg...) printk(fmt,##arg) +#else /* !__KERNEL__*/ + +#include +#include "sal.h" +#define DAL_MALLOC(x) malloc(x) +#define DAL_FREE(x) free(x) +static sal_mutex_t* dal_mpool_lock; +#define MPOOL_LOCK_INIT() sal_mutex_create(&dal_mpool_lock) +#define MPOOL_LOCK() sal_mutex_lock(dal_mpool_lock) +#define MPOOL_UNLOCK() sal_mutex_unlock(dal_mpool_lock) +#define DAL_PRINT(fmt,arg...) sal_printf(fmt,##arg) + +#endif /* __KERNEL__ */ + +dal_mpool_mem_t* g_free_block_ptr = NULL; + +/* System cache line size */ +#ifndef DAL_CACHE_LINE_BYTES +#define DAL_CACHE_LINE_BYTES 256 +#endif + +static dal_mpool_mem_t* p_desc_pool = NULL; +static dal_mpool_mem_t* p_data_pool = NULL; + +int +dal_mpool_init(void) +{ + MPOOL_LOCK_INIT(); + return 0; +} + +dal_mpool_mem_t* +_dal_mpool_create(void* base, int size, int type) +{ + dal_mpool_mem_t* head = NULL; + dal_mpool_mem_t* tail = NULL; + + head = (dal_mpool_mem_t*)DAL_MALLOC(sizeof(dal_mpool_mem_t)); + if (head == NULL) + { + return NULL; + } + + tail = (dal_mpool_mem_t*)DAL_MALLOC(sizeof(dal_mpool_mem_t)); + if (tail == NULL) + { + DAL_FREE(head); + return NULL; + } + + head->size = tail->size = 0; + head->type = type; + head->address = base; + tail->address = head->address + size; + head->next = tail; + tail->next = NULL; + + return head; +} + +dal_mpool_mem_t* +dal_mpool_create(void* base, int size) +{ + dal_mpool_mem_t* head = NULL; + int mod = (int)(((unsigned long)base) & (DAL_CACHE_LINE_BYTES - 1)); + + MPOOL_LOCK(); + + if (mod) + { + base = (char*)base + (DAL_CACHE_LINE_BYTES - mod); + size -= (DAL_CACHE_LINE_BYTES - mod); + } + + size &= ~(DAL_CACHE_LINE_BYTES - 1); + + /* init for common linkptr, only used for GB */ + head = _dal_mpool_create(base, size, DAL_MPOOL_TYPE_USELESS); + if (NULL == head) + { + MPOOL_UNLOCK(); + return NULL; + } + + /* init for desc linkptr */ + p_desc_pool = _dal_mpool_create(base, DAL_MPOOL_MAX_DESX_SIZE, DAL_MPOOL_TYPE_DESC); + if (NULL == p_desc_pool) + { + MPOOL_UNLOCK(); + DAL_FREE(head->next); + DAL_FREE(head); + return NULL; + } + + /* init for data linkptr */ + p_data_pool = _dal_mpool_create(((char*)base+DAL_MPOOL_MAX_DESX_SIZE), (size - DAL_MPOOL_MAX_DESX_SIZE), DAL_MPOOL_TYPE_DATA); + if (NULL == p_data_pool) + { + MPOOL_UNLOCK(); + DAL_FREE(head->next); + DAL_FREE(head); + DAL_FREE(p_desc_pool->next); + DAL_FREE(p_desc_pool); + return NULL; + } + + MPOOL_UNLOCK(); + + return head; +} + +dal_mpool_mem_t* +_dal_mpool_alloc_comon(dal_mpool_mem_t* ptr, int size, int type) +{ + dal_mpool_mem_t* new_ptr = NULL; + + while (ptr && ptr->next) + { + if (ptr->next->address - (ptr->address + ptr->size) >= size) + { + break; + } + + ptr = ptr->next; + } + + if (!(ptr && ptr->next)) + { + return NULL; + } + + new_ptr = DAL_MALLOC(sizeof(dal_mpool_mem_t)); + if (!new_ptr) + { + return NULL; + } + + new_ptr->type = type; + new_ptr->address = ptr->address + ptr->size; + new_ptr->size = size; + new_ptr->next = ptr->next; + ptr->next = new_ptr; + + return new_ptr; +} + +void* +dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type) +{ + dal_mpool_mem_t* ptr = NULL; + dal_mpool_mem_t* new_ptr = NULL; + int mod; + + MPOOL_LOCK(); + + mod = size & (DAL_CACHE_LINE_BYTES - 1); + if (mod != 0) + { + size += (DAL_CACHE_LINE_BYTES - mod); + } + + switch(type) + { + case DAL_MPOOL_TYPE_USELESS: + ptr = pool; + new_ptr = _dal_mpool_alloc_comon(ptr, size, type); + if (NULL == new_ptr) + { + MPOOL_UNLOCK(); + return NULL; + } + break; + case DAL_MPOOL_TYPE_DESC: + ptr = p_desc_pool; + new_ptr = _dal_mpool_alloc_comon(ptr, size, type); + if (NULL == new_ptr) + { + MPOOL_UNLOCK(); + return NULL; + } + break; + case DAL_MPOOL_TYPE_DATA: + ptr = p_data_pool; + new_ptr = _dal_mpool_alloc_comon(ptr, size, type); + if (NULL == new_ptr) + { + MPOOL_UNLOCK(); + return NULL; + } + break; + default: + MPOOL_UNLOCK(); + return NULL; + break; + } + + MPOOL_UNLOCK(); + + return new_ptr->address; +} + +void +_dal_mpool_free(dal_mpool_mem_t* ptr, void* addr, int type) +{ + unsigned char* address = (unsigned char*)addr; + dal_mpool_mem_t* prev = NULL; + + while (ptr && ptr->next) + { + if (ptr->next->address == address) + { + break; + } + + ptr = ptr->next; + } + + if (ptr && ptr->next) + { + prev = ptr; + ptr = ptr->next; + prev->next = ptr->next; + DAL_FREE(ptr); + } + + return; +} + +void +dal_mpool_free(dal_mpool_mem_t* pool, void* addr) +{ + dal_mpool_mem_t* ptr = pool; + + MPOOL_LOCK(); + + switch(pool->type) + { + case DAL_MPOOL_TYPE_USELESS: + ptr = pool; + _dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_USELESS); + break; + case DAL_MPOOL_TYPE_DESC: + ptr = p_desc_pool; + _dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_DESC); + break; + case DAL_MPOOL_TYPE_DATA: + ptr = p_data_pool; + _dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_DATA); + break; + default: + break; + } + + MPOOL_UNLOCK(); + return; +} + +int +dal_mpool_destroy(dal_mpool_mem_t* pool) +{ + dal_mpool_mem_t* ptr, * next; + + MPOOL_LOCK(); + + for (ptr = pool; ptr; ptr = next) + { + next = ptr->next; + DAL_FREE(ptr); + } + + for (ptr = p_desc_pool; ptr; ptr = next) + { + next = ptr->next; + DAL_FREE(ptr); + } + + for (ptr = p_data_pool; ptr; ptr = next) + { + next = ptr->next; + DAL_FREE(ptr); + } + + MPOOL_UNLOCK(); + + return 0; +} + +int +dal_mpool_usage(dal_mpool_mem_t* pool, int type) +{ + int usage = 0; + dal_mpool_mem_t* ptr; + + MPOOL_LOCK(); + + for (ptr = pool; ptr; ptr = ptr->next) + { + if (ptr->type == type || ptr->type == -1) + { + usage += ptr->size; + } + } + + MPOOL_UNLOCK(); + + return usage; +} + +int +dal_mpool_debug(dal_mpool_mem_t* pool) +{ + dal_mpool_mem_t* ptr; + int index = 0; + + MPOOL_LOCK(); + + for (ptr = pool; ptr; ptr = ptr->next) + { +// DAL_PRINT("%2dst mpool block: address=0x%8x, size=0x%x \n", index, (unsigned int)ptr->address, ptr->size); + DAL_PRINT("%2dst mpool block: address=%p, size=0x%x \n", index, ptr->address, ptr->size); // note + index++; + } + + MPOOL_UNLOCK(); + + return 0; +} + diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_mpool.h b/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_mpool.h new file mode 100644 index 000000000000..a1fa37d05f82 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/modules/dal_mpool.h @@ -0,0 +1,71 @@ +/** + @file dal_mpool.h + + @author Copyright (C) 2011 Centec Networks Inc. All rights reserved. + + @date 2012-5-10 + + @version v2.0 + + This file contains the dma memory init, allocation and free APIs +*/ + +#ifndef _DMA_MPOOL_H +#define _DMA_MPOOL_H +#ifdef __cplusplus +extern "C" { +#endif + +#define DAL_MPOOL_MAX_DESX_SIZE (1024*1024) + +enum dal_mpool_type_e +{ + DAL_MPOOL_TYPE_USELESS, /* just compatible with GB */ + DAL_MPOOL_TYPE_DESC, /* dma mpool op for desc */ + DAL_MPOOL_TYPE_DATA /* dma mpool op for data */ +}; +typedef enum dal_mpool_type_e dal_mpool_type_t; + +struct dal_mpool_mem_s +{ + unsigned char* address; + int size; + int type; + struct dal_mpool_mem_s* next; +}; +typedef struct dal_mpool_mem_s dal_mpool_mem_t; + +/** + @brief This function is to alloc dma memory + + @param[in] size size of memory + + @return NULL + +*/ +extern int +dal_mpool_init(void); + +extern dal_mpool_mem_t* +dal_mpool_create(void* base_ptr, int size); + +extern void* +dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type); + +extern void +dal_mpool_free(dal_mpool_mem_t* pool, void* addr); + +extern int +dal_mpool_destroy(dal_mpool_mem_t* pool); + +extern int +dal_mpool_usage(dal_mpool_mem_t* pool, int type); + +extern int +dal_mpool_debug(dal_mpool_mem_t* pool); +#ifdef __cplusplus +} +#endif + +#endif /* !_DMA_MPOOL_H */ + diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform.sh b/platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform.sh new file mode 100755 index 000000000000..e8f81a20d9d1 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +#platform init script for centec e582-48x6q + +init_devnum() { + found=0 + for devnum in 0 1; do + devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name` + # I801 adapter can be at either dffd0000 or dfff0000 + if [[ $devname == 'SMBus I801 adapter at '* ]]; then + found=1 + break + fi + done + + [ $found -eq 0 ] && echo "cannot find I801" && exit 1 +} + +init_devnum + +if [ "$1" == "init" ]; then + #install drivers and dependencies + depmod -a + modprobe i2c-i801 + modprobe i2c-dev + modprobe i2c-mux + modprobe i2c-smbus + modprobe i2c-mux-pca954x force_deselect_on_exit=1 + i2cset -y 0 0x58 0x8 0x3f + i2cset -y 0 0x20 0x1b 0x0 + i2cset -y 0 0x20 0xb 0x0 + i2cset -y 0 0x21 0x19 0x0 + i2cset -y 0 0x21 0x9 0x0 + i2cset -y 0 0x21 0x1c 0x0 + i2cset -y 0 0x21 0xc 0x0 + i2cset -y 0 0x22 0x1a 0x0 + i2cset -y 0 0x22 0xa 0x0 + i2cset -y 0 0x23 0x18 0x0 + i2cset -y 0 0x23 0x8 0x0 + i2cset -y 0 0x23 0x1b 0x0 + i2cset -y 0 0x23 0xb 0x0 + modprobe lm77 + modprobe tun + modprobe dal + modprobe centec_at24c64 + modprobe centec_e582_48x6q_platform + + #start platform monitor + rm -rf /usr/bin/platform_monitor + ln -s /usr/bin/48x6q_platform_monitor.py /usr/bin/platform_monitor + python /usr/bin/platform_monitor & +elif [ "$1" == "deinit" ]; then + kill -9 $(pidof platform_monitor) > /dev/null 2>&1 + rm -rf /usr/bin/platform_monitor + modprobe -r centec_e582_48x6q_platform + modprobe -r centec_at24c64 + modprobe -r dal + modprobe -r i2c-mux-pca954x + modprobe -r i2c-dev +else + echo "e582-48x6q_platform : Invalid option !" +fi diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform_monitor.py b/platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform_monitor.py new file mode 100644 index 000000000000..d08802a35f3b --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform_monitor.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python + +############################################################################# +# Centec +# +# Module contains an implementation of sfp presence scan logic +# +############################################################################# + +try: + import os + import os.path + import threading + import time + import logging + import struct + import syslog + import swsssdk + from socket import * + from select import * +except ImportError, e: + raise ImportError(str(e) + " - required module not found") + + +def DBG_PRINT(str): + syslog.openlog("centec-pmon") + syslog.syslog(syslog.LOG_INFO, str) + syslog.closelog() + +PORT_NUMBER = (48+6) + +class PlatformMonitor: + + """init board platform default config""" + def __init__(self): + """[ctlid, slavedevid]""" + self.fiber_mapping = [(0, 0)] # res + self.fiber_mapping.extend([(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7)]) # panel port 1~8 + self.fiber_mapping.extend([(0, 14), (0, 13), (0, 15), (0, 12), (0, 8), (0, 11), (0, 9), (0, 10)]) # panel port 9~16 + self.fiber_mapping.extend([(0, 22), (0, 21), (0, 23), (0, 20), (0, 16), (0, 19), (0, 17), (0, 18)]) # panel port 17~24 + self.fiber_mapping.extend([(1, 4), (1, 3), (1, 5), (1, 2), (1, 6), (1, 1), (1, 7), (1, 0)]) # panel port 25~32 + self.fiber_mapping.extend([(1, 8), (1, 15), (1, 9), (1, 14), (1, 10), (1, 13), (1, 11), (1, 12)]) # panel port 33~40 + self.fiber_mapping.extend([(1, 22), (1, 21), (1, 23), (1, 20), (1, 16), (1, 19), (1, 17), (1, 18)]) # panel port 41~48 + self.fiber_mapping.extend([(1, 28), (1, 29), (1, 26), (1, 27), (1, 24), (1, 25)]) # panel port 49~54 + + self.udpClient = socket(AF_INET, SOCK_DGRAM) + self.sfp_present = [0]*(PORT_NUMBER+1) + self.sfp_enable = [0]*(PORT_NUMBER+1) + self.f_sfp_present = "/sys/class/sfp/sfp{}/sfp_presence" + self.f_sfp_enable = "/sys/class/sfp/sfp{}/sfp_enable" + self.sfp_scan_timer = 0 + + def is_qsfp(self, port): + if port <= 48: + return False + else: + return True + + def get_sfp_present(self, port): + with open(self.f_sfp_present.format(port), 'r') as sfp_file: + return int(sfp_file.read()) + + def set_sfp_present(self, port, present): + self.sfp_present[port] = present + + def set_sfp_enable(self, port, enable): + if self.is_qsfp(port): + if enable: + with open(self.f_sfp_enable.format(port), 'w') as sfp_file: + sfp_file.write("1") + self.sfp_enable[port] = 1 + else: + with open(self.f_sfp_enable.format(port), 'w') as sfp_file: + sfp_file.write("0") + self.sfp_enable[port] = 0 + else: + (ctlid, devid) = self.fiber_mapping[port] + req = struct.pack('=HHHBBHIBBBBI', 0, 9, 16, ctlid, devid, 0x50, 0, 0x56, 1, 0xf, 0, 1) + self.udpClient.sendto(req, ('localhost', 8101)) + rsp, addr = self.udpClient.recvfrom(1024) + rsp_data = struct.unpack('=HHHBBHIBBBBIi512B', rsp) + enable_v = rsp_data[13] + if enable: + enable_v &= 0xf0 + else: + enable_v |= 0x0f + data = struct.pack('=HHHBBHBBBB', 0, 11, 8, ctlid, 0x56, 0x50, devid, enable_v, 0xf, 0) + self.udpClient.sendto(data, ('localhost', 8101)) + DBG_PRINT("set sfp{} to {}".format(port, ("enable" if enable else "disable"))) + + def initialize_configdb(self): + try: + f_mac = os.popen('ip link show eth0 | grep ether | awk \'{print $2}\'') + mac_addr = f_mac.read(17) + last_byte = mac_addr[-2:] + aligned_last_byte = format(int(int(str(last_byte), 16) + 1), '02x') + mac_addr = mac_addr[:-2] + aligned_last_byte + DBG_PRINT("start connect swss config-db to set device mac-address") + swss = swsssdk.SonicV2Connector() + swss.connect(swss.CONFIG_DB) + swss.set(swss.CONFIG_DB, "DEVICE_METADATA|localhost", 'mac', mac_addr) + mac_addr = swss.get(swss.CONFIG_DB, "DEVICE_METADATA|localhost", 'mac') + DBG_PRINT("set device mac-address: %s" % mac_addr) + except IOError as e: + DBG_PRINT(str(e)) + + def initialize_rpc(self): + while True: + try: + r_sel = [self.udpClient] + echo_req = struct.pack('=HHH', 0, 1, 0) + self.udpClient.sendto(echo_req, ('localhost', 8101)) + result = select(r_sel, [], [], 1) + if self.udpClient in result[0]: + echo_rsp, srv_addr = self.udpClient.recvfrom(1024) + if echo_rsp: + break + DBG_PRINT("connect to sdk rpc server timeout, try again.") + except IOError as e: + DBG_PRINT(str(e)) + + DBG_PRINT("connect to sdk rpc server success.") + + def initialize_gpio(self): + # set gpio 1,2,3,4,5,6,7,8 output mode + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 1, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 2, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 3, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 4, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 5, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 6, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 7, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 8, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + # set gpio 1,2,3,4,5,6,7,8 output 0 to reset i2c bridge + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 1, 0) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 2, 0) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 3, 0) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 4, 0) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 5, 0) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 6, 0) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 7, 0) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 8, 0) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + # set gpio 1,2,3,4,5,6,7,8 output 1 to release i2c bridge + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 1, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 2, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 3, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 4, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 5, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 6, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 7, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 8, 1) + self.udpClient.sendto(gpio_init, ('localhost', 8101)) + DBG_PRINT("config ctc chip gpio done.") + + def initialize_sfp(self): + try: + for port in range(1, PORT_NUMBER+1): + if self.get_sfp_present(port): + self.set_sfp_present(port, 1) + self.set_sfp_enable(port, 1) + else: + self.set_sfp_present(port, 0) + self.set_sfp_enable(port, 0) + except IOError as e: + DBG_PRINT(str(e)) + + def initialize(self): + DBG_PRINT("start connect to sdk rpc server.") + + self.initialize_configdb() + self.initialize_rpc() + self.initialize_gpio() + self.initialize_sfp() + + def sfp_scan(self): + try: + for port in range(1, PORT_NUMBER+1): + cur_present = self.get_sfp_present(port) + if self.sfp_present[port] != cur_present: + self.set_sfp_present(port, cur_present) + self.set_sfp_enable(port, cur_present) + except IOError as e: + DBG_PRINT(str(e)) + + def start(self): + while True: + self.sfp_scan() + time.sleep(1) + +if __name__ == "__main__": + monitor = PlatformMonitor() + monitor.initialize() + monitor.start() + diff --git a/platform/centec/sonic-platform-modules-e582/LICENSE b/platform/centec/sonic-platform-modules-e582/LICENSE new file mode 100644 index 000000000000..99228517bae7 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2017 Centec, Inc + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/centec/sonic-platform-modules-e582/README.md b/platform/centec/sonic-platform-modules-e582/README.md new file mode 100644 index 000000000000..61b3ef6c87f4 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/README.md @@ -0,0 +1 @@ +platform drivers for Centec E582 for the SONiC project diff --git a/platform/centec/sonic-platform-modules-e582/debian/changelog b/platform/centec/sonic-platform-modules-e582/debian/changelog new file mode 100644 index 000000000000..d6f8d9ed26d4 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/debian/changelog @@ -0,0 +1,11 @@ +sonic-centec-platform-modules (1.1) unstable; urgency=low + + * Add support for centec e582-48x2q4z + + -- xuwj Thus, 25 Jan 2018 13:43:40 +0800 + +sonic-centec-platform-modules (1.0) unstable; urgency=low + + * Initial release + + -- xuwj Mon, 22 Jan 2018 13:43:40 +0800 diff --git a/platform/centec/sonic-platform-modules-e582/debian/compat b/platform/centec/sonic-platform-modules-e582/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/centec/sonic-platform-modules-e582/debian/control b/platform/centec/sonic-platform-modules-e582/debian/control new file mode 100644 index 000000000000..103b6eca242d --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/debian/control @@ -0,0 +1,17 @@ +Source: sonic-centec-platform-modules +Section: main +Priority: extra +Maintainer: yangbs +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-e582-48x2q4z +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-e582-48x6q +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x2q4z.init b/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x2q4z.init new file mode 100755 index 000000000000..3ef5e7e30b6d --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x2q4z.init @@ -0,0 +1,38 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup e582-48x2q4z board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + /usr/bin/48x2q4z_platform.sh init + + echo "done." + ;; + +stop) + /usr/bin/48x2q4z_platform.sh deinit + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: service platform-modules-e582-48x2q4z {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x2q4z.install b/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x2q4z.install new file mode 100644 index 000000000000..86569b323b1a --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x2q4z.install @@ -0,0 +1,2 @@ +48x2q4z/cfg/48x2q4z-modules.conf etc/modules-load.d +48x2q4z/scripts/48x2q4z_platform.sh usr/bin diff --git a/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x6q.init b/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x6q.init new file mode 100755 index 000000000000..1c5b0c1c4978 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x6q.init @@ -0,0 +1,38 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup e582-48x6q board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + /usr/bin/48x6q_platform.sh init + + echo "done." + ;; + +stop) + /usr/bin/48x6q_platform.sh deinit + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: service platform-modules-e582-48x6q {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x6q.install b/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x6q.install new file mode 100644 index 000000000000..7ec21f33784d --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/debian/platform-modules-e582-48x6q.install @@ -0,0 +1,6 @@ +48x6q/cfg/48x6q-modules.conf etc/modules-load.d +48x6q/cfg/minigraph.xml etc/sonic +48x6q/cfg/config_db.json etc/sonic +48x6q/cfg/config_db_l2l3.json etc/sonic +48x6q/scripts/48x6q_platform.sh usr/bin +48x6q/scripts/48x6q_platform_monitor.py usr/bin diff --git a/platform/centec/sonic-platform-modules-e582/debian/rules b/platform/centec/sonic-platform-modules-e582/debian/rules new file mode 100755 index 000000000000..9f5d67b1af5c --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/debian/rules @@ -0,0 +1,35 @@ +#!/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:= 48x6q 48x2q4z + +%: + 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-e582-$${mod} \ + $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp -f $(MOD_SRC_DIR)/$${mod}/modules/*.ko \ + debian/platform-modules-e582-$${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; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/modules/*.ko; \ + rm -rf debian/platform-modules-e582-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR)/*.ko; \ + done) + From add2444cfdedccd01ff809da1233c5579e8a4a44 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 13 Aug 2018 04:29:26 +0000 Subject: [PATCH 1538/1833] [barefoot]: build platform modules for bfn, bfn-montara, wnc-osw1800 Signed-off-by: Guohan Lu --- platform/barefoot/platform-modules-bfn-montara.mk | 2 +- platform/barefoot/platform-modules-bfn.mk | 2 ++ platform/barefoot/platform-modules-wnc-osw1800.mk | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/platform-modules-bfn-montara.mk b/platform/barefoot/platform-modules-bfn-montara.mk index 853c3c636ac3..c1b401ad3fb7 100644 --- a/platform/barefoot/platform-modules-bfn-montara.mk +++ b/platform/barefoot/platform-modules-bfn-montara.mk @@ -10,4 +10,4 @@ $(BFN_MONTARA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMO $(BFN_MONTARA_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_32x-r0 SONIC_DPKG_DEBS += $(BFN_MONTARA_PLATFORM_MODULE) -# SONIC_STRETCH_DEBS += $(BFN_MONTARA_PLATFORM_MODULE) +SONIC_STRETCH_DEBS += $(BFN_MONTARA_PLATFORM_MODULE) diff --git a/platform/barefoot/platform-modules-bfn.mk b/platform/barefoot/platform-modules-bfn.mk index 3f76e94aa0b2..5c3df75c1b88 100644 --- a/platform/barefoot/platform-modules-bfn.mk +++ b/platform/barefoot/platform-modules-bfn.mk @@ -9,3 +9,5 @@ $(BFN_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-bfn $(BFN_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(BFN_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_65x-r0 SONIC_DPKG_DEBS += $(BFN_PLATFORM_MODULE) + +SONIC_STRETCH_DEBS += $(BFN_PLATFORM_MODULE) diff --git a/platform/barefoot/platform-modules-wnc-osw1800.mk b/platform/barefoot/platform-modules-wnc-osw1800.mk index aabcb8cdf0ba..5703d069c97e 100644 --- a/platform/barefoot/platform-modules-wnc-osw1800.mk +++ b/platform/barefoot/platform-modules-wnc-osw1800.mk @@ -10,4 +10,4 @@ $(WNC_OSW1800_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMO $(WNC_OSW1800_PLATFORM_MODULE)_PLATFORM = x86_64-wnc_osw1800-r0 SONIC_DPKG_DEBS += $(WNC_OSW1800_PLATFORM_MODULE) -# SONIC_STRETCH_DEBS += $(WNC_OSW1800_PLATFORM_MODULE) +SONIC_STRETCH_DEBS += $(WNC_OSW1800_PLATFORM_MODULE) From 647af39ff09da5186a848378f89b96cc7382c7f3 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 12 Aug 2018 22:23:43 -0700 Subject: [PATCH 1539/1833] [build]: create empty /var/lib/docker if needed (#1920) stretch docker-engine in base image is not started by default in the build process. Need to create empty /var/lib/docker Signed-off-by: Guohan Lu --- build_debian.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_debian.sh b/build_debian.sh index 03425ffe5bcf..d531a7207367 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -396,6 +396,7 @@ sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS ## Output the file system total size for diag purpose ## Note: -x to skip directories on different file systems, such as /proc sudo du -hsx $FILESYSTEM_ROOT +sudo mkdir -p $FILESYSTEM_ROOT/var/lib/docker sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker -e $PLATFORM_DIR ## Compress docker files From f3ca7c422fc432e36a9c8653195b29fa04061cc6 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 12 Aug 2018 22:23:58 -0700 Subject: [PATCH 1540/1833] [rsyslog]: use # to separate container name and program name in syslog message (#1918) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously use / to separate container name and program name. However, in rsyslogd: Precisely, the programname is terminated by either (whichever occurs first): end of tag nonprintable character ‘:’ ‘[‘ ‘/’ The above definition has been taken from the FreeBSD syslogd sources. Signed-off-by: Guohan Lu --- dockers/docker-database/Dockerfile.j2 | 2 +- dockers/docker-dhcp-relay/Dockerfile.j2 | 2 +- dockers/docker-fpm-frr/Dockerfile.j2 | 2 +- dockers/docker-fpm-quagga/Dockerfile.j2 | 2 +- dockers/docker-lldp-sv2/Dockerfile.j2 | 2 +- dockers/docker-orchagent/Dockerfile.j2 | 2 +- dockers/docker-platform-monitor/Dockerfile.j2 | 2 +- dockers/docker-router-advertiser/Dockerfile.j2 | 2 +- dockers/docker-snmp-sv2/Dockerfile.j2 | 2 +- dockers/docker-sonic-telemetry/Dockerfile.j2 | 2 +- dockers/docker-teamd/Dockerfile.j2 | 2 +- files/image_config/rsyslog/rsyslog.d/00-sonic.conf | 10 +++++----- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 712ada91a904..cc246c1bf949 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-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 7382664c64f3..0a760d301f3a 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/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-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 4796552d20c7..194b91f33499 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/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-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index 39037f3d042d..3981935a84be 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/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/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index fb91af231592..f08a70c01302 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/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-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 2d204df9078f..dc70bbcbdedc 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/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-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index d7cb6a46f5f3..e33ea72f07b1 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/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-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index c6c770bb7677..1385e1ebec63 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/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-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index e463d00441c7..02d0679f8f9c 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/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 # Enable -O for all Python calls ENV PYTHONOPTIMIZE 1 diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index 51d272c2a212..6b77f999e5ee 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/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-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index f405fdde10e2..1c3d9eea462a 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/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/files/image_config/rsyslog/rsyslog.d/00-sonic.conf b/files/image_config/rsyslog/rsyslog.d/00-sonic.conf index 6e4be4bb6022..455fe89fd2bf 100644 --- a/files/image_config/rsyslog/rsyslog.d/00-sonic.conf +++ b/files/image_config/rsyslog/rsyslog.d/00-sonic.conf @@ -1,14 +1,14 @@ ## Quagga rules -if $programname == ["quagga", - "watchquagga", - "zebra"] +if $programname == ["bgp#quagga", + "bgp#watchquagga", + "bgp#zebra"] then { /var/log/quagga/zebra.log stop } -if $programname == "bgpd" then { +if $programname == "bgp#bgpd" then { /var/log/quagga/bgpd.log stop } @@ -24,4 +24,4 @@ if $programname contains "teamd_" then { if $msg startswith " telemetry" or ($msg startswith " dialout" )then { /var/log/telemetry.log stop -} \ No newline at end of file +} From 0cd4ef0c8508f734b7ad8460b37684fb8fc6ddcd Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 13 Aug 2018 01:12:58 -0700 Subject: [PATCH 1541/1833] [socat]: build socat with readline (#1919) support readline in bcmsh Signed-off-by: Guohan Lu --- dockers/docker-base/Dockerfile.j2 | 3 -- .../docker-syncd-brcm/base_image_files/bcmsh | 2 +- platform/broadcom/docker-syncd-brcm/bcmsh | 2 +- rules/docker-base.mk | 1 + rules/socat.mk | 9 ++++++ src/socat/Makefile | 28 +++++++++++++++++++ src/socat/enable_readline.patch | 13 +++++++++ 7 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 rules/socat.mk create mode 100644 src/socat/Makefile create mode 100644 src/socat/enable_readline.patch diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index bd5c91faa9db..2aef59241b13 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -34,9 +34,6 @@ RUN apt-get -y install \ # eliminating memory leaks RUN apt-get -y -t jessie-backports install rsyslog -# Pre-install troubleshooting packages -RUN apt-get -y install socat - COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] COPY ["root/.vimrc", "/root/.vimrc"] diff --git a/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh b/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh index c3a38742575d..3bb78b0da796 100755 --- a/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh +++ b/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh @@ -1,3 +1,3 @@ #!/bin/bash -docker exec -i syncd bcmsh "$@" +docker exec -it syncd bcmsh "$@" diff --git a/platform/broadcom/docker-syncd-brcm/bcmsh b/platform/broadcom/docker-syncd-brcm/bcmsh index 7d2fa2f4d3c3..9dfa7874a038 100755 --- a/platform/broadcom/docker-syncd-brcm/bcmsh +++ b/platform/broadcom/docker-syncd-brcm/bcmsh @@ -31,5 +31,5 @@ if [ "$quiet" = false ]; then echo "$banner" fi -/usr/bin/socat - UNIX-CONNECT:/var/run/sswsyncd/sswsyncd.socket +/usr/bin/socat readline UNIX-CONNECT:/var/run/sswsyncd/sswsyncd.socket diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 5ef06c7fc873..55e44e7f3447 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -5,6 +5,7 @@ $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base $(DOCKER_BASE)_DEPENDS += $(SUPERVISOR) $(DOCKER_BASE)_DEPENDS += $(LIBWRAP) $(DOCKER_BASE)_DEPENDS += $(BASH) +$(DOCKER_BASE)_DEPENDS += $(SOCAT) ifeq ($(SONIC_INSTALL_DEBUG_TOOLS),y) GDB = gdb diff --git a/rules/socat.mk b/rules/socat.mk new file mode 100644 index 000000000000..b93795223624 --- /dev/null +++ b/rules/socat.mk @@ -0,0 +1,9 @@ +# socat packages + +SOCAT_VERSION = 1.7.3.1-2+deb9u1 + +export SOCAT_VERSION + +SOCAT = socat_$(SOCAT_VERSION)_amd64.deb +$(SOCAT)_SRC_PATH = $(SRC_PATH)/socat +SONIC_MAKE_DEBS += $(SOCAT) diff --git a/src/socat/Makefile b/src/socat/Makefile new file mode 100644 index 000000000000..e82208946ac1 --- /dev/null +++ b/src/socat/Makefile @@ -0,0 +1,28 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = socat_$(SOCAT_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./socat-1.7.3.1 + + # Get source package + wget -NO socat_$(SOCAT_VERSION).dsc "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.3.1-2+deb9u1.dsc?sv=2015-04-05&sr=b&sig=Ph7aMqb%2F%2FE%2F8qwxMXoXb5oK1YPkfVt6PV8mBBv5Wi%2F4%3D&se=2155-07-05T11%3A42%3A29Z&sp=r" + wget -NO socat_$(SOCAT_VERSION).debian.tar.xz "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.3.1-2+deb9u1.debian.tar.xz?sv=2015-04-05&sr=b&sig=yv77Fr5RtZgRTPmJK3j0lZ0BzsCiGaSs2i7NqQKEy2Y%3D&se=2155-07-05T11%3A39%3A59Z&sp=r" + wget -NO socat_1.7.3.1.orig.tar.gz "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.3.1.orig.tar.gz?sv=2015-04-05&sr=b&sig=0Ai1FM604aGsF5uBu2yN8w9O1a6zNjIDCdaiTo24DyQ%3D&se=2155-07-05T11%3A40%3A14Z&sp=r" + + dpkg-source -x socat_$(SOCAT_VERSION).dsc + + # Build source and Debian packages + pushd socat-1.7.3.1 + patch -p0 < ../enable_readline.patch + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + # Move the newly-built .deb packages to the destination directory + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) + diff --git a/src/socat/enable_readline.patch b/src/socat/enable_readline.patch new file mode 100644 index 000000000000..f1914d3cb494 --- /dev/null +++ b/src/socat/enable_readline.patch @@ -0,0 +1,13 @@ +--- debian/rules.old 2018-08-12 11:48:42.220230100 +0000 ++++ debian/rules 2018-08-12 11:48:52.072230100 +0000 +@@ -12,9 +12,6 @@ + %: + dh $@ --with=autoreconf + +-override_dh_auto_configure: +- dh_auto_configure -- --disable-readline +- + override_dh_auto_test: + +-.PHONY: override_dh_auto_configure override_dh_auto_test ++.PHONY: override_dh_auto_test From 9047edc38e1fe74d12f37d035387f7f55c30433c Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 13 Aug 2018 10:31:11 +0000 Subject: [PATCH 1542/1833] [platform]: move dell platform modules into buildimage repo Signed-off-by: Guohan Lu --- .gitmodules | 8 - platform/broadcom/sonic-platform-modules-dell | 1 - .../sonic-platform-modules-dell/.gitignore | 50 + .../sonic-platform-modules-dell/LICENSE | 16 + .../sonic-platform-modules-dell/README.md | 1 + .../common/dell_i2c_utils.sh | 62 + .../common/dell_pmc.c | 1919 +++++++++++++++++ .../common/fstrim.service | 6 + .../common/fstrim.timer | 12 + .../debian/changelog | 11 + .../sonic-platform-modules-dell/debian/compat | 1 + .../debian/control | 22 + .../debian/platform-modules-s6100.init | 40 + .../debian/platform-modules-s6100.install | 9 + .../debian/platform-modules-s6100.postinst | 7 + .../debian/platform-modules-z9100.init | 40 + .../debian/platform-modules-z9100.install | 8 + .../debian/platform-modules-z9100.postinst | 7 + .../debian/platform-modules-z9264f.init | 40 + .../debian/platform-modules-z9264f.install | 6 + .../sonic-platform-modules-dell/debian/rules | 45 + .../s6100/modules/Makefile | 2 + .../s6100/modules/dell_s6100_iom_cpld.c | 266 +++ .../s6100/scripts/README | 146 ++ .../s6100/scripts/io_rd_wr.py | 93 + .../s6100/scripts/iom_power_off.sh | 16 + .../s6100/scripts/iom_power_on.sh | 17 + .../s6100/scripts/platform_sensors.py | 322 +++ .../s6100/scripts/s6100_platform.sh | 206 ++ .../s6100/scripts/sensors | 7 + .../z9100/cfg/z9100-modules.conf | 15 + .../z9100/modules/Makefile | 2 + .../z9100/modules/dell_z9100_cpld.c | 273 +++ .../z9100/scripts/check_qsfp.sh | 60 + .../z9100/scripts/platform_sensors.py | 324 +++ .../z9100/scripts/sensors | 7 + .../z9100/scripts/z9100_platform.sh | 170 ++ .../z9264f/cfg/z9264f-modules.conf | 19 + .../z9264f/modules/Makefile | 2 + .../z9264f/modules/dell_z9264f_fpga_ocores.c | 1418 ++++++++++++ .../z9264f/scripts/check_qsfp.sh | 3 + .../z9264f/scripts/pcisysfs.py | 102 + .../z9264f/scripts/platform_sensors.py | 251 +++ .../z9264f/scripts/sensors | 8 + .../z9264f/scripts/z9264f_platform.sh | 125 ++ .../broadcom/sonic-platform-modules-s6000 | 1 - .../sonic-platform-modules-s6000/.gitignore | 50 + .../sonic-platform-modules-s6000/LICENSE | 15 + .../sonic-platform-modules-s6000/MAINTAINERS | 7 + .../sonic-platform-modules-s6000/README.md | 2 + .../debian/changelog | 5 + .../debian/compat | 1 + .../debian/control | 12 + .../debian/copyright | 16 + .../debian/platform-modules-s6000.init | 99 + .../debian/platform-modules-s6000.install | 1 + .../sonic-platform-modules-s6000/debian/rules | 32 + .../modules/Makefile | 1 + .../modules/dell_s6000_platform.c | 1222 +++++++++++ .../scripts/reset-qsfp | 25 + .../scripts/set-fan-speed | 58 + .../systemd/platform-modules-s6000.service | 13 + 62 files changed, 7715 insertions(+), 10 deletions(-) delete mode 160000 platform/broadcom/sonic-platform-modules-dell create mode 100644 platform/broadcom/sonic-platform-modules-dell/.gitignore create mode 100644 platform/broadcom/sonic-platform-modules-dell/LICENSE create mode 100644 platform/broadcom/sonic-platform-modules-dell/README.md create mode 100755 platform/broadcom/sonic-platform-modules-dell/common/dell_i2c_utils.sh create mode 100644 platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c create mode 100644 platform/broadcom/sonic-platform-modules-dell/common/fstrim.service create mode 100644 platform/broadcom/sonic-platform-modules-dell/common/fstrim.timer create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/changelog create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/compat create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/control create mode 100755 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.init create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst create mode 100755 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.init create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst create mode 100755 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.init create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.install create mode 100755 platform/broadcom/sonic-platform-modules-dell/debian/rules create mode 100644 platform/broadcom/sonic-platform-modules-dell/s6100/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_iom_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/README create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/io_rd_wr.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/iom_power_off.sh create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/iom_power_on.sh create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_sensors.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/sensors create mode 100644 platform/broadcom/sonic-platform-modules-dell/z9100/cfg/z9100-modules.conf create mode 100644 platform/broadcom/sonic-platform-modules-dell/z9100/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_z9100_cpld.c create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9100/scripts/check_qsfp.sh create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9100/scripts/platform_sensors.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9100/scripts/sensors create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh create mode 100644 platform/broadcom/sonic-platform-modules-dell/z9264f/cfg/z9264f-modules.conf create mode 100644 platform/broadcom/sonic-platform-modules-dell/z9264f/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/check_qsfp.sh create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/pcisysfs.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/platform_sensors.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/sensors create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh delete mode 160000 platform/broadcom/sonic-platform-modules-s6000 create mode 100644 platform/broadcom/sonic-platform-modules-s6000/.gitignore create mode 100644 platform/broadcom/sonic-platform-modules-s6000/LICENSE create mode 100644 platform/broadcom/sonic-platform-modules-s6000/MAINTAINERS create mode 100644 platform/broadcom/sonic-platform-modules-s6000/README.md create mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/changelog create mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/compat create mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/control create mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/copyright create mode 100755 platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.init create mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install create mode 100755 platform/broadcom/sonic-platform-modules-s6000/debian/rules create mode 100644 platform/broadcom/sonic-platform-modules-s6000/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c create mode 100755 platform/broadcom/sonic-platform-modules-s6000/scripts/reset-qsfp create mode 100755 platform/broadcom/sonic-platform-modules-s6000/scripts/set-fan-speed create mode 100644 platform/broadcom/sonic-platform-modules-s6000/systemd/platform-modules-s6000.service diff --git a/.gitmodules b/.gitmodules index 728c417cdba9..72d743e426f5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,17 +36,9 @@ [submodule "src/sonic-utilities"] path = src/sonic-utilities url = https://github.com/Azure/sonic-utilities -[submodule "platform/broadcom/sonic-platform-modules-s6000"] - path = platform/broadcom/sonic-platform-modules-s6000 - url = https://github.com/Azure/sonic-platform-modules-s6000 - branch = stretch [submodule "platform/broadcom/sonic-platform-modules-arista"] path = platform/broadcom/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic -[submodule "platform/broadcom/sonic-platform-modules-dell"] - path = platform/broadcom/sonic-platform-modules-dell - url = https://github.com/Azure/sonic-platform-modules-dell - branch = stretch [submodule "src/sonic-platform-common"] path = src/sonic-platform-common url = https://github.com/Azure/sonic-platform-common diff --git a/platform/broadcom/sonic-platform-modules-dell b/platform/broadcom/sonic-platform-modules-dell deleted file mode 160000 index ae36817bbabc..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ae36817bbabc2825f184b5e7cdad5422b4f1d9db diff --git a/platform/broadcom/sonic-platform-modules-dell/.gitignore b/platform/broadcom/sonic-platform-modules-dell/.gitignore new file mode 100644 index 000000000000..7f287d538227 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/.gitignore @@ -0,0 +1,50 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# 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 + +# Kernel Module Compile Results +*.mod* +*.cmd +*.o.d +.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-dell/LICENSE b/platform/broadcom/sonic-platform-modules-dell/LICENSE new file mode 100644 index 000000000000..243a846ea80b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2017 Dell, 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-dell/README.md b/platform/broadcom/sonic-platform-modules-dell/README.md new file mode 100644 index 000000000000..a9f5358192ad --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/README.md @@ -0,0 +1 @@ +platform drivers for Dell Z9100 for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-dell/common/dell_i2c_utils.sh b/platform/broadcom/sonic-platform-modules-dell/common/dell_i2c_utils.sh new file mode 100755 index 000000000000..896e0166dc59 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/common/dell_i2c_utils.sh @@ -0,0 +1,62 @@ +# Perform an i2c device configuration : instantiate / delete. +# Input is of the form: +# "echo [driver] > " +# where operation = "new_device" or "delete_device" + +i2c_config() { + local count=0 + local MAX_BUS_RETRY=20 + local MAX_I2C_OP_RETRY=10 + + i2c_bus_op=`echo "$@" | cut -d'>' -f 2` + i2c_bus=$(dirname $i2c_bus_op) + + # check if bus exists + while [[ "$count" -lt "$MAX_BUS_RETRY" ]]; do + [[ -e $i2c_bus ]] && break || sleep .1 + count=$((count+1)) + done + + if [[ "$count" -eq "$MAX_BUS_RETRY" ]]; then + echo "ERROR: $@ : i2c bus not created" + return + fi + + # perform the add/delete + count=0 + while [[ "$count" -lt "$MAX_I2C_OP_RETRY" ]]; do + eval "$@" > /dev/null 2>&1 + [[ $? == 0 ]] && break || sleep .2 + count=$((count+1)) + done + + if [[ "$count" -eq "$MAX_I2C_OP_RETRY" ]]; then + echo "ERROR: $@ : i2c operation failed" + return + fi +} + +# Check if a i2c bus exists. Poll for upto 2 seconds since mux creation may take time.. +# Input: bus to check for existence + +i2c_poll_bus_exists() { + local count=0 + local MAX_BUS_RETRY=20 + local i2c_bus + + i2c_bus=$1 + + # check if bus exists + while [[ "$count" -lt "$MAX_BUS_RETRY" ]]; do + [[ -e $i2c_bus ]] && break || sleep .1 + count=$((count+1)) + done + + if [[ "$count" -eq "$MAX_BUS_RETRY" ]]; then + echo "ERROR: $@ : i2c bus not created" + return 1 + else + return 0 + fi +} + diff --git a/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c b/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c new file mode 100644 index 000000000000..557976457503 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c @@ -0,0 +1,1919 @@ +/* Copyright (c) 2017 Dell Inc.* + * dell_s6100_smf.c - driver for Dell SMF + * + * Author: Per Fremrot + * Author: Paavaanan + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SIO_DRVNAME "SMF" +#define DEBUG 1 +#define LABELS 1 + +#define FANIN_MAX 12 /* Counted from 1 */ +#define VSEN_MAX 48 /* VSEN1.. */ +#define CURR_MAX 6 +#define TCPU_MAX 15 +#define PSU_MAX 4 /* TODO change to actual sensors */ + +/* Where are the sensors address/data + registers relative to the region offset */ + +#define IOREGION_OFFSET 0x10 +#define IOREGION_LENGTH 0x4 +#define SMF_ADDR_REG_OFFSET 0 +#define SMF_READ_DATA_REG_OFFSET 2 +#define SMF_REG_ADDR 0x200 +#define SMF_PROBE_ADDR 0x210 + +#define SIO_REG_DEVID 0x1 +#define SIO_Z9100_ID 0x1 +#define SIO_S6100_ID 0x2 +#define SIO_S4200_ID 0x3 +#define SIO_S5148_ID 0x4 + +/* IOM presence */ +#define IO_MODULE_STATUS 0x0310 +#define IO_MODULE_PRESENCE 0x0311 + +/* FAN Tray */ +#define S6100_MAX_NUM_FAN_TRAYS 4 +#define Z9100_MAX_NUM_FAN_TRAYS 5 + +#define MAX_NUM_FAN_TRAYS 0x00F0 +#define MAX_NUM_FANS_PER_TRAY 0x00F1 +#define FAN_TRAY_PRESENCE 0x0113 +#define FAN_STATUS_GROUP_A 0x0114 +#define FAN_STATUS_GROUP_B 0x0115 +#define FAN_TRAY_AIRFLOW 0x0116 + + +/* FAN Z9100 */ +#define SMF_FAN_SPEED_ADDR 0x00F3 +#define FAN_TRAY_1_SPEED 0x00F3 +#define FAN_TRAY_1_FAN_2_SPEED 0x00F5 +#define FAN_TRAY_2_SPEED 0x00F7 +#define FAN_TRAY_2_FAN_2_SPEED 0x00F9 +#define FAN_TRAY_3_SPEED 0x00FB +#define FAN_TRAY_3_FAN_2_SPEED 0x00FD +#define FAN_TRAY_4_SPEED 0x00FF +#define FAN_TRAY_4_FAN_2_SPEED 0x0101 +#define FAN_TRAY_5_FAN_1_SPEED 0x0103 +#define FAN_TRAY_5_FAN_2_SPEED 0x0105 +#define FAN_TRAY_5 4 +#define FAN_601_FAULT (2 + 1) +#define IN28_INPUT (27 + 1) +#define IN404_INPUT (43 + 1) +#define IOM_PRESENCE (44 + 1) +#define IOM_PRESENCE_MAX (45 + 1) +#define IN602_INPUT (1 + 1) +#define CURR22_INPUT (1 + 1) +#define CURR602_INPUT (3 + 1) +#define TEMP13_INPUT (12 + 1) +#define TEMP601_INPUT (13 + 1) + +/* PSUs */ +#define S6100_MAX_NUM_PSUS 2 +#define MAX_NUM_PSUS 0x0231 +#define CURRENT_TOTAL_POWER 0x0232 + +/* PSU1 */ +#define PSU_1_MAX_POWER 0x0234 +#define PSU_1_FUNCTION_SUPPORT 0x0236 +#define PSU_1_STATUS 0x0237 +#define PSU_1_TEMPERATURE 0x0239 +#define PSU_1_FAN_SPEED 0x023B +#define PSU_1_FAN_STATUS 0x023D +#define PSU_1_INPUT_VOLTAGE 0x023E +#define PSU_1_OUTPUT_VOLTAGE 0x0240 +#define PSU_1_INPUT_CURRENT 0x0242 +#define PSU_1_OUTPUT_CURRENT 0x0244 +#define PSU_1_INPUT_POWER 0x0246 +#define PSU_1_OUTPUT_POWER 0x0248 +#define PSU_1_FAN_SPEED 0x023B + +/* PSU2 */ +#define PSU_2_MAX_POWER 0x026D +#define PSU_2_FUNCTION_SUPPORT 0x026F +#define PSU_2_STATUS 0x0270 +#define PSU_2_TEMPERATURE 0x0272 +#define PSU_2_FAN_SPEED 0x0274 +#define PSU_2_FAN_STATUS 0x0276 +#define PSU_2_INPUT_VOLTAGE 0x0277 +#define PSU_2_OUTPUT_VOLTAGE 0x0279 +#define PSU_2_INPUT_CURRENT 0x027B +#define PSU_2_OUTPUT_CURRENT 0x027D +#define PSU_2_INPUT_POWER 0x027F +#define PSU_2_OUTPUT_POWER 0x0281 + +/* TEMP */ +#define TEMP_SENSOR_1 0x0014 +#define TEMP_SENSOR_1_STATUS 0x00DC +#define TEMP_SENSOR_1_HW_LIMIT 0x003E + +/* VOLTAGE */ +#define CPU_1_VOLTAGE 0x02A8 +#define IO_MODULE_1_VOLTAGE 0x02E8 +#define SWITCH_CURRENT_S6100 0x02E4 +#define SWITCH_CURRENT_Z9100 0x02E2 + +/* VOLTAGE S6100 */ +#define CPU_1_MONITOR_STATUS 0x0308 +#define CPU_2_MONITOR_STATUS 0x0309 +#define CPU_3_MONITOR_STATUS 0x030A +#define CPU_4_MONITOR_STATUS 0x030B + +/* VOLTAGE Z9100 */ +#define CPU_5_MONITOR_STATUS 0x02E6 +#define CPU_6_MONITOR_STATUS 0x02E7 +#define CPU_7_MONITOR_STATUS 0x02E8 +#define CPU_8_MONITOR_STATUS 0x02E9 + + +unsigned long *mmio; +static struct kobject *dell_kobj; +static unsigned short force_id; +module_param(force_id, ushort, 0); +int smf_ver; + + +enum kinds { + z9100smf, s6100smf +}; + + +struct smf_devices { + const char *name; + u64 tcpu_mask; + u64 vsen_mask; + u32 curr_mask; + u64 fanin_mask; + u64 psu_mask; + const char *const *temp_label; + const char *const *vsen_label; + const char *const *curr_label; + const char *const *fan_label; + const char *const *psu_label; +}; + + +static const char *const z9100_temp_label[] = { + "CPU On-board (U2900)", + "BCM Switch On-Board #1 (U44)", + "Front BCM On-Board (U4)", + "Front BCM On-Board (U2)", + "Unused", + "BCM Switch On-Board #1 (U38)", + "Unused", + "Unused", + "Rear (U2900)", + "", + "", + "", + "", + "", + "PSU 1", + "PSU 2" +}; + + +static const char *const s6100_temp_label[] = { + "CPU On-board (U2900)", + "BCM On-Board #1 (U44)", + "Front BCM On-board (U4)", + "Front BCM On-board (U2)", + "IOM #1", + "IOM #2", + "IOM #3", + "IOM #4", + "U2 Switch board?", + "Front GE", + "Front SFP+", + "BCM Internal", + "CPU Internal", + "", + "PSU 1", + "PSU 2" +}; + + +static const char *const z9100_vsen_label[] = { + /* CPU Board */ + "CPU XP3R3V_EARLY", + "CPU XP5R0V_CP", + "CPU XP3R3V_STD", + "CPU XP3R3V_CP ", + "CPU XP0R75V_VTT_A", + "CPU XP0R75V_VTT_B", + "CPU XP1R07V_CPU", + "CPU XP1R0V_CPU", + "CPU XP12R0V", + "CPU VDDR_CPU_2", + "CPU VDDR_CPU_1", + "CPU XP1R5V_CLK", + "CPU XP1R35V_CPU", + "CPU XP1R8V_CPU", + "CPU XP1R0V_CPU_VNN", + "CPU XP1R0V_CPU_VCC", + "CPU XP1R5V_EARLY", + /* Switch Board */ + "SW XP12R0V_MON", + "SW XP3R3V_MON", + "SW XP1R8V_MON", + "SW XP1R25V_MON", + "SW XP1R2V_MON", + "SW XP1R0V_SW_MON", + "SW XP1R0V_ROV_SW_MON", + "SW XP5V_MB_MON", + "SW XP1R8V_FPGA_MON", + "SW XP3R3V_FPGA_MON", + "SW XP3R3V_EARLY_MON", + /* PSU */ + "PSU1 VIN", + "PSU1 VOUT", + "PSU2 VIN", + "PSU2 VOUT", + /* IOM 1 */ + "", + "", + "", + "", + /* IOM 2 */ + "", + "", + "", + "", + /* IOM 3 */ + "", + "", + "", + "", + /* IOM 4 */ + "", + "", + "", + "" +}; + + +static const char *const s6100_vsen_label[] = { + /* CPU Board */ + "CPU XP3R3V_EARLY", + "CPU XP5R0V_CP", + "CPU XP3R3V_STD", + "CPU XP3R3V_CP ", + "CPU XP0R75V_VTT_A", + "CPU XP0R75V_VTT_B", + "CPU XP1R07V_CPU", + "CPU XP1R0V_CPU", + "CPU XP12R0V", + "CPU VDDR_CPU_2", + "CPU VDDR_CPU_1", + "CPU XP1R5V_CLK", + "CPU XP1R35V_CPU", + "CPU XP1R8V_CPU", + "CPU XP1R0V_CPU_VNN", + "CPU XP1R0V_CPU_VCC", + "CPU XP1R5V_EARLY", + /* Switch Board */ + "SW XP12R0V_MON", + "SW XP3R3V_MON", + "SW XP1R8V_MON", + "SW XP1R25V_MON", + "SW XP1R2V_MON", + "SW XP1R0V_SW_MON", + "SW XP1R0V_ROV_SW_MON", + "XR1R0V_BCM84752_MON", + "SW XP5V_MB_MON", + "SW XP1R8V_FPGA_MON", + "SW XP3R3V_FPGA_MON", + + /* PSU */ + "PSU1 VIN", + "PSU1 VOUT", + "PSU2 VIN", + "PSU2 VOUT", + + /* IOM 1 */ + "IOM 1 #1", + "IOM 1 #2", + "IOM 1 #3", + "IOM 1 #4", + /* IOM 2 */ + "IOM 2 #1", + "IOM 2 #2", + "IOM 2 #3", + "IOM 2 #4", + /* IOM 1 */ + "IOM 3 #1", + "IOM 3 #2", + "IOM 3 #3", + "IOM 3 #4", + /* IOM 1 */ + "IOM 4 #1", + "IOM 4 #2", + "IOM 4 #3", + "IOM 4 #4" +}; + + +static const char *const z9100_curr_label[] = { + "XP1R0V", + "XP1R0V_ROV" +}; + + +static const char *const s6100_fan_label[] = { + "Tray1 Fan1", + "", + "Tray2 Fan1", + "", + "Tray3 Fan1", + "", + "Tray4 Fan1", + "", + "", + "", + "Psu1 Fan", + "Psu2 Fan" +}; + +static const char *const z9100_fan_label[] = { + "Tray1 Fan1", + "Tray1 Fan2", + "Tray2 Fan1", + "Tray2 Fan2", + "Tray3 Fan1", + "Tray3 Fan2", + "Tray4 Fan1", + "Tray4 Fan2", + "Tray5 Fan1", + "Tray5 Fan2", + "Psu1 Fan", + "Psu2 Fan" +}; + + +static const char *const s6100_psu_label[] = { + "Psu1 Input", + "Psu1 Output", + "Psu2 Input", + "Psu2 Output", +}; + +static const struct smf_devices smf_devices[] = { + [z9100smf] = { + .name = "SMF_Z9100_ON", + .tcpu_mask=0xe1ff, + .vsen_mask=0xfffdffff, + .curr_mask=0x3f, + .fanin_mask=0xfff, + .psu_mask=0xf, + .temp_label = z9100_temp_label, + .vsen_label = z9100_vsen_label, + .curr_label = z9100_curr_label, + .fan_label = z9100_fan_label, + .psu_label = s6100_psu_label + }, + [s6100smf] = { + .name = "SMF_S6100_ON", + .tcpu_mask=0x7fff, + .vsen_mask=0xfffffefdffff, + .curr_mask=0x3f, + .fanin_mask=0xc55, + .psu_mask=0xf, + .temp_label = s6100_temp_label, + .vsen_label = s6100_vsen_label, + .curr_label = z9100_curr_label, + .fan_label = s6100_fan_label, + .psu_label = s6100_psu_label + + } +}; + + +/* + * For each registered chip, we need to keep some data in memory. + * The structure is dynamically allocated. + */ +struct smf_data { + enum kinds kind; /* Inherited from SuperIO kind */ + unsigned short addr; + struct device *hwmon_dev; + struct mutex lock; + u64 tcpu_mask; + u64 vsen_mask; + u32 curr_mask; + u64 fanin_mask; + u64 psu_mask; + const char * const *temp_label; + const char * const *vsen_label; + const char * const *curr_label; + const char * const *fan_label; + const char * const *psu_label; +}; + + +struct smf_sio_data { + int sioreg; + enum kinds kind; +}; + + +static int smf_read_reg(struct smf_data *data, u16 reg) +{ + int res; + + mutex_lock(&data->lock); + outb_p(reg>> 8, data->addr + SMF_ADDR_REG_OFFSET); + outb_p(reg & 0xff, data->addr + SMF_ADDR_REG_OFFSET + 1); + res = inb_p(data->addr + SMF_READ_DATA_REG_OFFSET); + mutex_unlock(&data->lock); + return res; +} + + +static int smf_read_reg16(struct smf_data *data, u16 reg) +{ + int res; + + mutex_lock(&data->lock); + outb_p(reg>> 8, data->addr + SMF_ADDR_REG_OFFSET); + outb_p(reg & 0xff, data->addr + SMF_ADDR_REG_OFFSET + 1); + + res = inb_p(data->addr + SMF_READ_DATA_REG_OFFSET); + + outb_p((reg + 1)>> 8, data->addr + SMF_ADDR_REG_OFFSET); + outb_p((reg + 1) & 0xff, data->addr + SMF_ADDR_REG_OFFSET + 1); + + res = (res << 8) + inb_p(data->addr + SMF_READ_DATA_REG_OFFSET); + + mutex_unlock(&data->lock); + return res; +} + + +/* FANIN ATTR */ +static ssize_t +show_fan_label(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct smf_data *data = dev_get_drvdata(dev); + int nr = to_sensor_dev_attr(attr)->index; + return sprintf(buf, "%s\n", data->fan_label[nr]); +} + + +static ssize_t show_fan(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int export_hex=0; + unsigned int ret = -1; + unsigned rpm; + + + if (index <10) + ret = smf_read_reg16(data, SMF_FAN_SPEED_ADDR + index * 2); + else switch (index) { + case 10: + ret = smf_read_reg16(data, PSU_1_FAN_SPEED); + break; + case 11: + ret = smf_read_reg16(data, PSU_2_FAN_SPEED); + break; + case 12: + ret = ~smf_read_reg(data, FAN_TRAY_PRESENCE); + export_hex = 1; + break; + + default: + return ret; + } + + + if (ret < 0) + return ret; + + rpm = ret; + + if(export_hex) + return sprintf(buf, "%x\n", rpm); + else + return sprintf(buf, "%u\n", rpm); +} + + +static ssize_t show_fan_fault(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int ret=1, fan_status; + + index = index / 2; + fan_status = ~smf_read_reg(data, FAN_TRAY_PRESENCE); + + if (fan_status & (1 << (index))) + ret=0; + + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", ret); +} + + +static ssize_t show_fan_alarm(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int ret, psu_fan_status=0; + + if(index < 2) + psu_fan_status = smf_read_reg(data, FAN_STATUS_GROUP_B); + + if (psu_fan_status & (1 << (index))) + ret=0; + + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", ret); +} + + +static ssize_t show_fan_airflow(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int ret=1, fan_airflow; + + if (data->kind == s6100smf && index == FAN_TRAY_5) + return 0; + + fan_airflow = smf_read_reg(data, FAN_TRAY_AIRFLOW); + + if (fan_airflow & (1 << (index))) + ret=1; + + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", ret); +} + + +static ssize_t show_psu_fan(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int ret=0, fan_status; + + if (index < FAN_601_FAULT){ + fan_status = smf_read_reg(data, PSU_1_FAN_STATUS); + ret = fan_status & (1 << index); + + } + else{ + fan_status = smf_read_reg(data, PSU_2_FAN_STATUS); + ret = fan_status & (1 << (index - 3)); + } + + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", ret); +} + + + +static umode_t smf_fanin_is_visible(struct kobject *kobj, + struct attribute *a, int n) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct smf_data *data = dev_get_drvdata(dev); + + if (data->fanin_mask & (1 << (n % FANIN_MAX))) + return a->mode; + + return 0; +} + +static umode_t smf_dell_is_visible(struct kobject *kobj, + struct attribute *a, int n) +{ + return a->mode; + +} + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_fan, NULL, 4); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_fan, NULL, 5); +static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_fan, NULL, 6); +static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_fan, NULL, 7); +static SENSOR_DEVICE_ATTR(fan9_input, S_IRUGO, show_fan, NULL, 8); +static SENSOR_DEVICE_ATTR(fan10_input, S_IRUGO, show_fan, NULL,9); +/* PSU1 FAN */ +static SENSOR_DEVICE_ATTR(fan11_input, S_IRUGO, show_fan, NULL, 10); +/* PSU2 FAN */ +static SENSOR_DEVICE_ATTR(fan12_input, S_IRUGO, show_fan, NULL, 11); + +static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0); +static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1); +static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 2); +static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 3); +static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_fan_alarm, NULL, 4); +static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_fan_alarm, NULL, 5); +static SENSOR_DEVICE_ATTR(fan7_alarm, S_IRUGO, show_fan_alarm, NULL, 6); +static SENSOR_DEVICE_ATTR(fan8_alarm, S_IRUGO, show_fan_alarm, NULL, 7); +static SENSOR_DEVICE_ATTR(fan9_alarm, S_IRUGO, show_fan_alarm, NULL, 8); +static SENSOR_DEVICE_ATTR(fan10_alarm, S_IRUGO, show_fan_alarm, NULL, 9); +static SENSOR_DEVICE_ATTR(fan11_alarm, S_IRUGO, show_psu_fan, NULL, 1); +static SENSOR_DEVICE_ATTR(fan12_alarm, S_IRUGO, show_psu_fan, NULL, 4); + +static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0); +static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1); +static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2); +static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3); +static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, show_fan_fault, NULL, 4); +static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, show_fan_fault, NULL, 5); +static SENSOR_DEVICE_ATTR(fan7_fault, S_IRUGO, show_fan_fault, NULL, 6); +static SENSOR_DEVICE_ATTR(fan8_fault, S_IRUGO, show_fan_fault, NULL, 7); +static SENSOR_DEVICE_ATTR(fan9_fault, S_IRUGO, show_fan_fault, NULL, 8); +static SENSOR_DEVICE_ATTR(fan10_fault, S_IRUGO, show_fan_fault, NULL, 9); +static SENSOR_DEVICE_ATTR(fan11_fault, S_IRUGO, show_psu_fan, NULL, 2); +static SENSOR_DEVICE_ATTR(fan12_fault, S_IRUGO, show_psu_fan, NULL, 5); + +static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, show_fan_label, NULL, 0); +static SENSOR_DEVICE_ATTR(fan2_label, S_IRUGO, show_fan_label, NULL, 1); +static SENSOR_DEVICE_ATTR(fan3_label, S_IRUGO, show_fan_label, NULL, 2); +static SENSOR_DEVICE_ATTR(fan4_label, S_IRUGO, show_fan_label, NULL, 3); +static SENSOR_DEVICE_ATTR(fan5_label, S_IRUGO, show_fan_label, NULL, 4); +static SENSOR_DEVICE_ATTR(fan6_label, S_IRUGO, show_fan_label, NULL, 5); +static SENSOR_DEVICE_ATTR(fan7_label, S_IRUGO, show_fan_label, NULL, 6); +static SENSOR_DEVICE_ATTR(fan8_label, S_IRUGO, show_fan_label, NULL, 7); +static SENSOR_DEVICE_ATTR(fan9_label, S_IRUGO, show_fan_label, NULL, 8); +static SENSOR_DEVICE_ATTR(fan10_label, S_IRUGO, show_fan_label, NULL, 9); +static SENSOR_DEVICE_ATTR(fan11_label, S_IRUGO, show_fan_label, NULL, 10); +static SENSOR_DEVICE_ATTR(fan12_label, S_IRUGO, show_fan_label, NULL, 11); + + +static struct attribute *smf_fanin_attrs[] = { + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan6_input.dev_attr.attr, + &sensor_dev_attr_fan7_input.dev_attr.attr, + &sensor_dev_attr_fan8_input.dev_attr.attr, + &sensor_dev_attr_fan9_input.dev_attr.attr, + &sensor_dev_attr_fan10_input.dev_attr.attr, + &sensor_dev_attr_fan11_input.dev_attr.attr, + &sensor_dev_attr_fan12_input.dev_attr.attr, + + &sensor_dev_attr_fan1_label.dev_attr.attr, + &sensor_dev_attr_fan2_label.dev_attr.attr, + &sensor_dev_attr_fan3_label.dev_attr.attr, + &sensor_dev_attr_fan4_label.dev_attr.attr, + &sensor_dev_attr_fan5_label.dev_attr.attr, + &sensor_dev_attr_fan6_label.dev_attr.attr, + &sensor_dev_attr_fan7_label.dev_attr.attr, + &sensor_dev_attr_fan8_label.dev_attr.attr, + &sensor_dev_attr_fan9_label.dev_attr.attr, + &sensor_dev_attr_fan10_label.dev_attr.attr, + &sensor_dev_attr_fan11_label.dev_attr.attr, + &sensor_dev_attr_fan12_label.dev_attr.attr, + + + &sensor_dev_attr_fan1_alarm.dev_attr.attr, + &sensor_dev_attr_fan2_alarm.dev_attr.attr, + &sensor_dev_attr_fan3_alarm.dev_attr.attr, + &sensor_dev_attr_fan4_alarm.dev_attr.attr, + &sensor_dev_attr_fan5_alarm.dev_attr.attr, + &sensor_dev_attr_fan6_alarm.dev_attr.attr, + &sensor_dev_attr_fan7_alarm.dev_attr.attr, + &sensor_dev_attr_fan8_alarm.dev_attr.attr, + &sensor_dev_attr_fan9_alarm.dev_attr.attr, + &sensor_dev_attr_fan10_alarm.dev_attr.attr, + &sensor_dev_attr_fan11_alarm.dev_attr.attr, + &sensor_dev_attr_fan12_alarm.dev_attr.attr, + + &sensor_dev_attr_fan1_fault.dev_attr.attr, + &sensor_dev_attr_fan2_fault.dev_attr.attr, + &sensor_dev_attr_fan3_fault.dev_attr.attr, + &sensor_dev_attr_fan4_fault.dev_attr.attr, + &sensor_dev_attr_fan5_fault.dev_attr.attr, + &sensor_dev_attr_fan6_fault.dev_attr.attr, + &sensor_dev_attr_fan7_fault.dev_attr.attr, + &sensor_dev_attr_fan8_fault.dev_attr.attr, + &sensor_dev_attr_fan9_fault.dev_attr.attr, + &sensor_dev_attr_fan10_fault.dev_attr.attr, + &sensor_dev_attr_fan11_fault.dev_attr.attr, + &sensor_dev_attr_fan12_fault.dev_attr.attr, + + NULL +}; + + + + +/* VSEN ATTR */ +static ssize_t +show_voltage_label(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct smf_data *data = dev_get_drvdata(dev); + int nr = to_sensor_dev_attr(attr)->index; + return sprintf(buf, "%s\n", data->vsen_label[nr]); +} + + +static ssize_t show_voltage(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int volt, ret=0; + int export_hex=0; + + /*0 to 27 */ + if (index < IN28_INPUT) /* Voltage sensors */ + ret = smf_read_reg16(data, CPU_1_VOLTAGE + index * 2); + else if ((data->kind == s6100smf) && (index < IN404_INPUT)) + ret = smf_read_reg16(data, IO_MODULE_1_VOLTAGE + index * 2); + else if ((data->kind == s6100smf) && (index < IOM_PRESENCE)) + ret = smf_read_reg(data, IO_MODULE_STATUS); + else if ((data->kind == s6100smf) && (index < IOM_PRESENCE_MAX)) + ret = smf_read_reg(data, IO_MODULE_PRESENCE); + + if (ret < 0) + return ret; + + if(index < 44) + volt = ret*10; + else + export_hex=1; + + if(export_hex) + return sprintf(buf, "%x\n", ret); + else + return sprintf(buf, "%d\n", volt); +} + + +static ssize_t show_psu_voltage(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int ret; + + if (index < 2) /* PSU1 */ + ret = smf_read_reg16(data, PSU_1_INPUT_VOLTAGE + index * 2); + else /* PSU2 */ + ret = smf_read_reg16(data, PSU_2_INPUT_VOLTAGE + ((index - 2) * 2)); + + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", ret*10); +} + + +static ssize_t show_voltage_alarm(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + unsigned status=0; + int ret; + + if (index < 8) { + + if (data->kind == s6100smf) + status = smf_read_reg16(data, CPU_1_MONITOR_STATUS); + else + status = smf_read_reg16(data, CPU_5_MONITOR_STATUS); + + ret = status & (1 << index); + } + else if (index < 15) { + + if (data->kind == s6100smf) + ret = smf_read_reg16(data, CPU_2_MONITOR_STATUS); + else + ret = smf_read_reg16(data, CPU_6_MONITOR_STATUS); + + ret = status & (1 << index); + } + else if (index < 23) { + + if (data->kind == s6100smf) + ret = smf_read_reg16(data, CPU_3_MONITOR_STATUS); + else + ret = smf_read_reg16(data, CPU_7_MONITOR_STATUS); + + ret = status & (1 << index); + } + else { + + if (data->kind == s6100smf) + ret = smf_read_reg16(data, CPU_4_MONITOR_STATUS); + else + ret = smf_read_reg16(data, CPU_8_MONITOR_STATUS); + + ret = status & (1 << index); + } + + + if (ret < 0) + return ret; + + return sprintf(buf, "%d\n", ret); +} + + +static umode_t smf_vsen_is_visible(struct kobject *kobj, + struct attribute *a, int n) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct smf_data *data = dev_get_drvdata(dev); + + if (data->vsen_mask & (1 << (n % VSEN_MAX))) + return a->mode; + return 0; +} + +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 0); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 1); +static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_voltage, NULL, 2); +static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_voltage, NULL, 3); +static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 4); +static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 5); +static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 6); +static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_voltage, NULL, 7); +static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_voltage, NULL, 8); +static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_voltage, NULL, 9); +static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_voltage, NULL, 10); +static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_voltage, NULL, 11); +static SENSOR_DEVICE_ATTR(in13_input, S_IRUGO, show_voltage, NULL, 12); +static SENSOR_DEVICE_ATTR(in14_input, S_IRUGO, show_voltage, NULL, 13); +static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, show_voltage, NULL, 14); +static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, show_voltage, NULL, 15); +static SENSOR_DEVICE_ATTR(in17_input, S_IRUGO, show_voltage, NULL, 16); +static SENSOR_DEVICE_ATTR(in18_input, S_IRUGO, show_voltage, NULL, 17); +static SENSOR_DEVICE_ATTR(in19_input, S_IRUGO, show_voltage, NULL, 18); +static SENSOR_DEVICE_ATTR(in20_input, S_IRUGO, show_voltage, NULL, 19); +static SENSOR_DEVICE_ATTR(in21_input, S_IRUGO, show_voltage, NULL, 20); +static SENSOR_DEVICE_ATTR(in22_input, S_IRUGO, show_voltage, NULL, 21); +static SENSOR_DEVICE_ATTR(in23_input, S_IRUGO, show_voltage, NULL, 22); +static SENSOR_DEVICE_ATTR(in24_input, S_IRUGO, show_voltage, NULL, 23); +static SENSOR_DEVICE_ATTR(in25_input, S_IRUGO, show_voltage, NULL, 24); +static SENSOR_DEVICE_ATTR(in26_input, S_IRUGO, show_voltage, NULL, 25); +static SENSOR_DEVICE_ATTR(in27_input, S_IRUGO, show_voltage, NULL, 26); +static SENSOR_DEVICE_ATTR(in28_input, S_IRUGO, show_voltage, NULL, 27); + +/* PSU1 Voltage*/ +static SENSOR_DEVICE_ATTR(in29_input, S_IRUGO, show_psu_voltage, NULL, 0); +static SENSOR_DEVICE_ATTR(in30_input, S_IRUGO, show_psu_voltage, NULL, 1); + +/* PSU2 Voltage*/ +static SENSOR_DEVICE_ATTR(in31_input, S_IRUGO, show_psu_voltage, NULL, 2); +static SENSOR_DEVICE_ATTR(in32_input, S_IRUGO, show_psu_voltage, NULL, 3); + +/*IO Modules Voltage*/ +static SENSOR_DEVICE_ATTR(in101_input, S_IRUGO, show_voltage, NULL, 28); +static SENSOR_DEVICE_ATTR(in102_input, S_IRUGO, show_voltage, NULL, 29); +static SENSOR_DEVICE_ATTR(in103_input, S_IRUGO, show_voltage, NULL, 30); +static SENSOR_DEVICE_ATTR(in104_input, S_IRUGO, show_voltage, NULL, 31); +static SENSOR_DEVICE_ATTR(in201_input, S_IRUGO, show_voltage, NULL, 32); +static SENSOR_DEVICE_ATTR(in202_input, S_IRUGO, show_voltage, NULL, 33); +static SENSOR_DEVICE_ATTR(in203_input, S_IRUGO, show_voltage, NULL, 34); +static SENSOR_DEVICE_ATTR(in204_input, S_IRUGO, show_voltage, NULL, 35); +static SENSOR_DEVICE_ATTR(in301_input, S_IRUGO, show_voltage, NULL, 36); +static SENSOR_DEVICE_ATTR(in302_input, S_IRUGO, show_voltage, NULL, 37); +static SENSOR_DEVICE_ATTR(in303_input, S_IRUGO, show_voltage, NULL, 38); +static SENSOR_DEVICE_ATTR(in304_input, S_IRUGO, show_voltage, NULL, 39); +static SENSOR_DEVICE_ATTR(in401_input, S_IRUGO, show_voltage, NULL, 40); +static SENSOR_DEVICE_ATTR(in402_input, S_IRUGO, show_voltage, NULL, 41); +static SENSOR_DEVICE_ATTR(in403_input, S_IRUGO, show_voltage, NULL, 42); +static SENSOR_DEVICE_ATTR(in404_input, S_IRUGO, show_voltage, NULL, 43); + + + +static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_voltage_label, NULL, 0); +static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_voltage_label, NULL, 1); +static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_voltage_label, NULL, 2); +static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_voltage_label, NULL, 3); +static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_voltage_label, NULL, 4); +static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_voltage_label, NULL, 5); +static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_voltage_label, NULL, 6); +static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_voltage_label, NULL, 7); +static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_voltage_label, NULL, 8); +static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, show_voltage_label, NULL, 9); +static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, show_voltage_label, NULL, 10); +static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, show_voltage_label, NULL, 11); +static SENSOR_DEVICE_ATTR(in13_label, S_IRUGO, show_voltage_label, NULL, 12); +static SENSOR_DEVICE_ATTR(in14_label, S_IRUGO, show_voltage_label, NULL, 13); +static SENSOR_DEVICE_ATTR(in15_label, S_IRUGO, show_voltage_label, NULL, 14); +static SENSOR_DEVICE_ATTR(in16_label, S_IRUGO, show_voltage_label, NULL, 15); +static SENSOR_DEVICE_ATTR(in17_label, S_IRUGO, show_voltage_label, NULL, 16); +static SENSOR_DEVICE_ATTR(in18_label, S_IRUGO, show_voltage_label, NULL, 17); +static SENSOR_DEVICE_ATTR(in19_label, S_IRUGO, show_voltage_label, NULL, 18); +static SENSOR_DEVICE_ATTR(in20_label, S_IRUGO, show_voltage_label, NULL, 19); +static SENSOR_DEVICE_ATTR(in21_label, S_IRUGO, show_voltage_label, NULL, 20); +static SENSOR_DEVICE_ATTR(in22_label, S_IRUGO, show_voltage_label, NULL, 21); +static SENSOR_DEVICE_ATTR(in23_label, S_IRUGO, show_voltage_label, NULL, 22); +static SENSOR_DEVICE_ATTR(in24_label, S_IRUGO, show_voltage_label, NULL, 23); +static SENSOR_DEVICE_ATTR(in25_label, S_IRUGO, show_voltage_label, NULL, 24); +static SENSOR_DEVICE_ATTR(in26_label, S_IRUGO, show_voltage_label, NULL, 25); +static SENSOR_DEVICE_ATTR(in27_label, S_IRUGO, show_voltage_label, NULL, 26); +static SENSOR_DEVICE_ATTR(in28_label, S_IRUGO, show_voltage_label, NULL, 27); + +/* PSU1 Voltage Label*/ +static SENSOR_DEVICE_ATTR(in29_label, S_IRUGO, show_voltage_label, NULL, 28); +static SENSOR_DEVICE_ATTR(in30_label, S_IRUGO, show_voltage_label, NULL, 29); + +/* PSU2 Voltage Label*/ +static SENSOR_DEVICE_ATTR(in31_label, S_IRUGO, show_voltage_label, NULL, 30); +static SENSOR_DEVICE_ATTR(in32_label, S_IRUGO, show_voltage_label, NULL, 31); + +/*IO Modules Labels*/ +static SENSOR_DEVICE_ATTR(in101_label, S_IRUGO, show_voltage_label, NULL, 32); +static SENSOR_DEVICE_ATTR(in102_label, S_IRUGO, show_voltage_label, NULL, 33); +static SENSOR_DEVICE_ATTR(in103_label, S_IRUGO, show_voltage_label, NULL, 34); +static SENSOR_DEVICE_ATTR(in104_label, S_IRUGO, show_voltage_label, NULL, 35); +static SENSOR_DEVICE_ATTR(in201_label, S_IRUGO, show_voltage_label, NULL, 36); +static SENSOR_DEVICE_ATTR(in202_label, S_IRUGO, show_voltage_label, NULL, 37); +static SENSOR_DEVICE_ATTR(in203_label, S_IRUGO, show_voltage_label, NULL, 38); +static SENSOR_DEVICE_ATTR(in204_label, S_IRUGO, show_voltage_label, NULL, 39); +static SENSOR_DEVICE_ATTR(in301_label, S_IRUGO, show_voltage_label, NULL, 40); +static SENSOR_DEVICE_ATTR(in302_label, S_IRUGO, show_voltage_label, NULL, 41); +static SENSOR_DEVICE_ATTR(in303_label, S_IRUGO, show_voltage_label, NULL, 42); +static SENSOR_DEVICE_ATTR(in304_label, S_IRUGO, show_voltage_label, NULL, 43); +static SENSOR_DEVICE_ATTR(in401_label, S_IRUGO, show_voltage_label, NULL, 44); +static SENSOR_DEVICE_ATTR(in402_label, S_IRUGO, show_voltage_label, NULL, 45); +static SENSOR_DEVICE_ATTR(in403_label, S_IRUGO, show_voltage_label, NULL, 46); +static SENSOR_DEVICE_ATTR(in404_label, S_IRUGO, show_voltage_label, NULL, 47); + + + +/* CPU Voltage Alarm */ +static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_voltage_alarm, NULL, 0); +static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_voltage_alarm, NULL, 1); +static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_voltage_alarm, NULL, 2); +static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_voltage_alarm, NULL, 3); +static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_voltage_alarm, NULL, 4); +static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_voltage_alarm, NULL, 5); +static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, show_voltage_alarm, NULL, 6); +static SENSOR_DEVICE_ATTR(in8_alarm, S_IRUGO, show_voltage_alarm, NULL, 7); + +static SENSOR_DEVICE_ATTR(in9_alarm, S_IRUGO, show_voltage_alarm, NULL, 8); +static SENSOR_DEVICE_ATTR(in10_alarm, S_IRUGO, show_voltage_alarm, NULL, 9); +static SENSOR_DEVICE_ATTR(in11_alarm, S_IRUGO, show_voltage_alarm, NULL, 10); +static SENSOR_DEVICE_ATTR(in12_alarm, S_IRUGO, show_voltage_alarm, NULL, 11); +static SENSOR_DEVICE_ATTR(in13_alarm, S_IRUGO, show_voltage_alarm, NULL, 12); +static SENSOR_DEVICE_ATTR(in14_alarm, S_IRUGO, show_voltage_alarm, NULL, 13); +static SENSOR_DEVICE_ATTR(in15_alarm, S_IRUGO, show_voltage_alarm, NULL, 14); +static SENSOR_DEVICE_ATTR(in16_alarm, S_IRUGO, show_voltage_alarm, NULL, 15); + +static SENSOR_DEVICE_ATTR(in17_alarm, S_IRUGO, show_voltage_alarm, NULL, 16); +static SENSOR_DEVICE_ATTR(in18_alarm, S_IRUGO, show_voltage_alarm, NULL, 17); +static SENSOR_DEVICE_ATTR(in19_alarm, S_IRUGO, show_voltage_alarm, NULL, 18); +static SENSOR_DEVICE_ATTR(in20_alarm, S_IRUGO, show_voltage_alarm, NULL, 19); +static SENSOR_DEVICE_ATTR(in21_alarm, S_IRUGO, show_voltage_alarm, NULL, 20); +static SENSOR_DEVICE_ATTR(in22_alarm, S_IRUGO, show_voltage_alarm, NULL, 21); +static SENSOR_DEVICE_ATTR(in23_alarm, S_IRUGO, show_voltage_alarm, NULL, 22); +static SENSOR_DEVICE_ATTR(in24_alarm, S_IRUGO, show_voltage_alarm, NULL, 23); + +static SENSOR_DEVICE_ATTR(in25_alarm, S_IRUGO, show_voltage_alarm, NULL, 24); +static SENSOR_DEVICE_ATTR(in26_alarm, S_IRUGO, show_voltage_alarm, NULL, 25); +static SENSOR_DEVICE_ATTR(in27_alarm, S_IRUGO, show_voltage_alarm, NULL, 26); +static SENSOR_DEVICE_ATTR(in28_alarm, S_IRUGO, show_voltage_alarm, NULL, 27); + + + +static struct attribute *smf_vsen_attrs[] = { + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + &sensor_dev_attr_in4_input.dev_attr.attr, + &sensor_dev_attr_in5_input.dev_attr.attr, + &sensor_dev_attr_in6_input.dev_attr.attr, + &sensor_dev_attr_in7_input.dev_attr.attr, + &sensor_dev_attr_in8_input.dev_attr.attr, + &sensor_dev_attr_in9_input.dev_attr.attr, + &sensor_dev_attr_in10_input.dev_attr.attr, + &sensor_dev_attr_in11_input.dev_attr.attr, + &sensor_dev_attr_in12_input.dev_attr.attr, + &sensor_dev_attr_in13_input.dev_attr.attr, + &sensor_dev_attr_in14_input.dev_attr.attr, + &sensor_dev_attr_in15_input.dev_attr.attr, + &sensor_dev_attr_in16_input.dev_attr.attr, + &sensor_dev_attr_in17_input.dev_attr.attr, + &sensor_dev_attr_in18_input.dev_attr.attr, + &sensor_dev_attr_in19_input.dev_attr.attr, + &sensor_dev_attr_in20_input.dev_attr.attr, + &sensor_dev_attr_in21_input.dev_attr.attr, + &sensor_dev_attr_in22_input.dev_attr.attr, + &sensor_dev_attr_in23_input.dev_attr.attr, + &sensor_dev_attr_in24_input.dev_attr.attr, + &sensor_dev_attr_in25_input.dev_attr.attr, + &sensor_dev_attr_in26_input.dev_attr.attr, + &sensor_dev_attr_in27_input.dev_attr.attr, + &sensor_dev_attr_in28_input.dev_attr.attr, + + &sensor_dev_attr_in29_input.dev_attr.attr, + &sensor_dev_attr_in30_input.dev_attr.attr, + &sensor_dev_attr_in31_input.dev_attr.attr, + &sensor_dev_attr_in32_input.dev_attr.attr, + + &sensor_dev_attr_in101_input.dev_attr.attr, + &sensor_dev_attr_in102_input.dev_attr.attr, + &sensor_dev_attr_in103_input.dev_attr.attr, + &sensor_dev_attr_in104_input.dev_attr.attr, + &sensor_dev_attr_in201_input.dev_attr.attr, + &sensor_dev_attr_in202_input.dev_attr.attr, + &sensor_dev_attr_in203_input.dev_attr.attr, + &sensor_dev_attr_in204_input.dev_attr.attr, + &sensor_dev_attr_in301_input.dev_attr.attr, + &sensor_dev_attr_in302_input.dev_attr.attr, + &sensor_dev_attr_in303_input.dev_attr.attr, + &sensor_dev_attr_in304_input.dev_attr.attr, + &sensor_dev_attr_in401_input.dev_attr.attr, + &sensor_dev_attr_in402_input.dev_attr.attr, + &sensor_dev_attr_in403_input.dev_attr.attr, + &sensor_dev_attr_in404_input.dev_attr.attr, + + + &sensor_dev_attr_in1_label.dev_attr.attr, + &sensor_dev_attr_in2_label.dev_attr.attr, + &sensor_dev_attr_in3_label.dev_attr.attr, + &sensor_dev_attr_in4_label.dev_attr.attr, + &sensor_dev_attr_in5_label.dev_attr.attr, + &sensor_dev_attr_in6_label.dev_attr.attr, + &sensor_dev_attr_in7_label.dev_attr.attr, + &sensor_dev_attr_in8_label.dev_attr.attr, + &sensor_dev_attr_in9_label.dev_attr.attr, + &sensor_dev_attr_in10_label.dev_attr.attr, + &sensor_dev_attr_in11_label.dev_attr.attr, + &sensor_dev_attr_in12_label.dev_attr.attr, + &sensor_dev_attr_in13_label.dev_attr.attr, + &sensor_dev_attr_in14_label.dev_attr.attr, + &sensor_dev_attr_in15_label.dev_attr.attr, + &sensor_dev_attr_in16_label.dev_attr.attr, + &sensor_dev_attr_in17_label.dev_attr.attr, + &sensor_dev_attr_in18_label.dev_attr.attr, + &sensor_dev_attr_in19_label.dev_attr.attr, + &sensor_dev_attr_in20_label.dev_attr.attr, + &sensor_dev_attr_in21_label.dev_attr.attr, + &sensor_dev_attr_in22_label.dev_attr.attr, + &sensor_dev_attr_in23_label.dev_attr.attr, + &sensor_dev_attr_in24_label.dev_attr.attr, + &sensor_dev_attr_in25_label.dev_attr.attr, + &sensor_dev_attr_in26_label.dev_attr.attr, + &sensor_dev_attr_in27_label.dev_attr.attr, + &sensor_dev_attr_in28_label.dev_attr.attr, + + &sensor_dev_attr_in29_label.dev_attr.attr, + &sensor_dev_attr_in30_label.dev_attr.attr, + &sensor_dev_attr_in31_label.dev_attr.attr, + &sensor_dev_attr_in32_label.dev_attr.attr, + + &sensor_dev_attr_in101_label.dev_attr.attr, + &sensor_dev_attr_in102_label.dev_attr.attr, + &sensor_dev_attr_in103_label.dev_attr.attr, + &sensor_dev_attr_in104_label.dev_attr.attr, + &sensor_dev_attr_in201_label.dev_attr.attr, + &sensor_dev_attr_in202_label.dev_attr.attr, + &sensor_dev_attr_in203_label.dev_attr.attr, + &sensor_dev_attr_in204_label.dev_attr.attr, + &sensor_dev_attr_in301_label.dev_attr.attr, + &sensor_dev_attr_in302_label.dev_attr.attr, + &sensor_dev_attr_in303_label.dev_attr.attr, + &sensor_dev_attr_in304_label.dev_attr.attr, + &sensor_dev_attr_in401_label.dev_attr.attr, + &sensor_dev_attr_in402_label.dev_attr.attr, + &sensor_dev_attr_in403_label.dev_attr.attr, + &sensor_dev_attr_in404_label.dev_attr.attr, + + + &sensor_dev_attr_in1_alarm.dev_attr.attr, + &sensor_dev_attr_in2_alarm.dev_attr.attr, + &sensor_dev_attr_in3_alarm.dev_attr.attr, + &sensor_dev_attr_in4_alarm.dev_attr.attr, + &sensor_dev_attr_in5_alarm.dev_attr.attr, + &sensor_dev_attr_in6_alarm.dev_attr.attr, + &sensor_dev_attr_in7_alarm.dev_attr.attr, + &sensor_dev_attr_in8_alarm.dev_attr.attr, + &sensor_dev_attr_in9_alarm.dev_attr.attr, + &sensor_dev_attr_in10_alarm.dev_attr.attr, + &sensor_dev_attr_in11_alarm.dev_attr.attr, + &sensor_dev_attr_in12_alarm.dev_attr.attr, + &sensor_dev_attr_in13_alarm.dev_attr.attr, + &sensor_dev_attr_in14_alarm.dev_attr.attr, + &sensor_dev_attr_in15_alarm.dev_attr.attr, + &sensor_dev_attr_in16_alarm.dev_attr.attr, + &sensor_dev_attr_in17_alarm.dev_attr.attr, + &sensor_dev_attr_in18_alarm.dev_attr.attr, + &sensor_dev_attr_in19_alarm.dev_attr.attr, + &sensor_dev_attr_in20_alarm.dev_attr.attr, + &sensor_dev_attr_in21_alarm.dev_attr.attr, + &sensor_dev_attr_in22_alarm.dev_attr.attr, + &sensor_dev_attr_in23_alarm.dev_attr.attr, + &sensor_dev_attr_in24_alarm.dev_attr.attr, + &sensor_dev_attr_in25_alarm.dev_attr.attr, + &sensor_dev_attr_in26_alarm.dev_attr.attr, + &sensor_dev_attr_in27_alarm.dev_attr.attr, + &sensor_dev_attr_in28_alarm.dev_attr.attr, + + + NULL +}; + +static const struct attribute_group smf_vsen_group = { + .attrs = smf_vsen_attrs, + .is_visible = smf_vsen_is_visible, +}; + +/* CURRENT ATTR */ +static ssize_t +show_current_label(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct smf_data *data = dev_get_drvdata(dev); + int nr = to_sensor_dev_attr(attr)->index; + return sprintf(buf, "%s\n", data->curr_label[nr]); +} + +static ssize_t show_current(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int ret=0; + int curr; + + if (index < CURR22_INPUT) + if (data->kind == s6100smf) + ret = smf_read_reg16(data, SWITCH_CURRENT_S6100 + index * 2); + else + ret = smf_read_reg16(data, SWITCH_CURRENT_Z9100 + index * 2); + else if (index < CURR602_INPUT) + curr = smf_read_reg16(data, PSU_1_INPUT_CURRENT + (index % 4) * 2); + else + curr = smf_read_reg16(data, PSU_2_INPUT_CURRENT + (index % 4) * 2); + + + if (ret < 0) + return ret; + + /* TODO: docs say 10mA, value look like A? */ + if(index < 2) + curr = ret*1000; + + return sprintf(buf, "%d\n", curr); +} + + +static umode_t smf_curr_is_visible(struct kobject *kobj, + struct attribute *a, int n) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct smf_data *data = dev_get_drvdata(dev); + + if (data->curr_mask & (1 << (n % CURR_MAX))) + return a->mode; + return 0; +} + + +static SENSOR_DEVICE_ATTR(curr21_input, S_IRUGO, show_current, NULL, 0); +static SENSOR_DEVICE_ATTR(curr22_input, S_IRUGO, show_current, NULL, 1); + +static SENSOR_DEVICE_ATTR(curr601_input, S_IRUGO, show_current, NULL, 2); +static SENSOR_DEVICE_ATTR(curr602_input, S_IRUGO, show_current, NULL, 3); + +static SENSOR_DEVICE_ATTR(curr701_input, S_IRUGO, show_current, NULL, 4); +static SENSOR_DEVICE_ATTR(curr702_input, S_IRUGO, show_current, NULL, 5); + +static SENSOR_DEVICE_ATTR(curr21_label, S_IRUGO, show_current_label, NULL, 0); +static SENSOR_DEVICE_ATTR(curr22_label, S_IRUGO, show_current_label, NULL, 1); + +static SENSOR_DEVICE_ATTR(curr601_label, S_IRUGO, show_current_label, NULL, 2); +static SENSOR_DEVICE_ATTR(curr602_label, S_IRUGO, show_current_label, NULL, 3); + +static SENSOR_DEVICE_ATTR(curr701_label, S_IRUGO, show_current_label, NULL, 4); +static SENSOR_DEVICE_ATTR(curr702_label, S_IRUGO, show_current_label, NULL, 5); + + +static struct attribute *smf_curr_attrs[] = { + &sensor_dev_attr_curr21_input.dev_attr.attr, + &sensor_dev_attr_curr22_input.dev_attr.attr, + + &sensor_dev_attr_curr601_input.dev_attr.attr, + &sensor_dev_attr_curr602_input.dev_attr.attr, + + &sensor_dev_attr_curr701_input.dev_attr.attr, + &sensor_dev_attr_curr702_input.dev_attr.attr, + + &sensor_dev_attr_curr21_label.dev_attr.attr, + &sensor_dev_attr_curr22_label.dev_attr.attr, + + &sensor_dev_attr_curr601_label.dev_attr.attr, + &sensor_dev_attr_curr602_label.dev_attr.attr, + + &sensor_dev_attr_curr701_label.dev_attr.attr, + &sensor_dev_attr_curr702_label.dev_attr.attr, + + NULL +}; + + +static const struct attribute_group smf_curr_group = { + .attrs = smf_curr_attrs, + .is_visible = smf_curr_is_visible, +}; + + +/* CPU_TEMP ATTR */ +static ssize_t +show_temp_label(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct smf_data *data = dev_get_drvdata(dev); + int nr = to_sensor_dev_attr(attr)->index; + return sprintf(buf, "%s\n", data->temp_label[nr]); +} + + +static ssize_t show_tcpu(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int ret; + int temp; + + if (index < TEMP13_INPUT) /* Temp sensors */ + ret = smf_read_reg16(data, TEMP_SENSOR_1 + index * 2); + else if(index < TEMP601_INPUT) + ret = smf_read_reg16(data, PSU_1_TEMPERATURE); + else + ret = smf_read_reg16(data, PSU_2_TEMPERATURE); + + if (ret < 0) + return ret; + + if (ret > 65500) + ret = 0; + + if (ret & 0x8000) + ret = - (ret & 0x7fff); + + temp = ret*100; + + return sprintf(buf, "%d\n", temp); +} + + +static ssize_t show_temp_crit(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int ret; + int temp; + + ret = smf_read_reg16(data, TEMP_SENSOR_1_HW_LIMIT + index * 2); + if (ret < 0) + return ret; + + if (ret == 65535) + ret = 0; + + if (ret & 0x8000) + ret = - (ret & 0x7fff); + + temp = ret*100; + + return sprintf(buf, "%d\n", temp); +} + + +/*static ssize_t show_temp_alarm(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int ret; + int temp; + + ret = smf_read_reg16(data, TEMP_SENSOR_1_STATUS + index * 2); + + if (ret < 0) + return ret; + + temp = ret; + + return sprintf(buf, "%d\n", temp); +}*/ + + +static umode_t smf_tcpu_is_visible(struct kobject *kobj, + struct attribute *a, int n) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct smf_data *data = dev_get_drvdata(dev); + + if (data->tcpu_mask & (1 << (n % TCPU_MAX))) + return a->mode; + + return 0; +} + + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_tcpu, NULL, 0); +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_tcpu, NULL, 1); +static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_tcpu, NULL, 2); +static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_tcpu, NULL, 3); +static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_tcpu, NULL, 4); +static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_tcpu, NULL, 5); +static SENSOR_DEVICE_ATTR(temp7_input, S_IRUGO, show_tcpu, NULL, 6); +static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, show_tcpu, NULL, 7); +static SENSOR_DEVICE_ATTR(temp9_input, S_IRUGO, show_tcpu, NULL, 8); +static SENSOR_DEVICE_ATTR(temp10_input, S_IRUGO, show_tcpu, NULL, 9); +static SENSOR_DEVICE_ATTR(temp11_input, S_IRUGO, show_tcpu, NULL, 10); +static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO, show_tcpu, NULL, 11); +static SENSOR_DEVICE_ATTR(temp13_input, S_IRUGO, show_tcpu, NULL, 12); + +/* PSU1 Fan Temp */ +static SENSOR_DEVICE_ATTR(temp14_input, S_IRUGO, show_tcpu, NULL, 13); + +/* PSU2 Fan Temp */ +static SENSOR_DEVICE_ATTR(temp15_input, S_IRUGO, show_tcpu, NULL, 14); + +static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL, 0); +static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, show_temp_label, NULL, 1); +static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, show_temp_label, NULL, 2); +static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, show_temp_label, NULL, 3); +static SENSOR_DEVICE_ATTR(temp5_label, S_IRUGO, show_temp_label, NULL, 4); +static SENSOR_DEVICE_ATTR(temp6_label, S_IRUGO, show_temp_label, NULL, 5); +static SENSOR_DEVICE_ATTR(temp7_label, S_IRUGO, show_temp_label, NULL, 6); +static SENSOR_DEVICE_ATTR(temp8_label, S_IRUGO, show_temp_label, NULL, 7); +static SENSOR_DEVICE_ATTR(temp9_label, S_IRUGO, show_temp_label, NULL, 8); +static SENSOR_DEVICE_ATTR(temp10_label, S_IRUGO, show_temp_label, NULL, 9); +static SENSOR_DEVICE_ATTR(temp11_label, S_IRUGO, show_temp_label, NULL, 10); +static SENSOR_DEVICE_ATTR(temp12_label, S_IRUGO, show_temp_label, NULL, 11); +static SENSOR_DEVICE_ATTR(temp13_label, S_IRUGO, show_temp_label, NULL, 12); + +static SENSOR_DEVICE_ATTR(temp14_label, S_IRUGO, show_temp_label, NULL, 14); +static SENSOR_DEVICE_ATTR(temp15_label, S_IRUGO, show_temp_label, NULL, 15); + + +static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 1); +static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 5); +static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 9); +static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 13); +static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 17); +static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 21); +static SENSOR_DEVICE_ATTR(temp7_crit, S_IRUGO, show_temp_crit, NULL, 25); +static SENSOR_DEVICE_ATTR(temp8_crit, S_IRUGO, show_temp_crit, NULL, 29); +static SENSOR_DEVICE_ATTR(temp9_crit, S_IRUGO, show_temp_crit, NULL, 33); +static SENSOR_DEVICE_ATTR(temp10_crit, S_IRUGO, show_temp_crit, NULL, 37); +static SENSOR_DEVICE_ATTR(temp11_crit, S_IRUGO, show_temp_crit, NULL, 41); +static SENSOR_DEVICE_ATTR(temp12_crit, S_IRUGO, show_temp_crit, NULL, 45); +static SENSOR_DEVICE_ATTR(temp13_crit, S_IRUGO, show_temp_crit, NULL, 49); + +static SENSOR_DEVICE_ATTR(temp14_crit, S_IRUGO, show_temp_crit, NULL, 11); +static SENSOR_DEVICE_ATTR(temp15_crit, S_IRUGO, show_temp_crit, NULL, 11); + + +static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_crit, NULL, 2); +static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_crit, NULL, 6); +static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_crit, NULL, 10); +static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_crit, NULL, 14); +static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_crit, NULL, 18); +static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_crit, NULL, 22); +static SENSOR_DEVICE_ATTR(temp7_max, S_IRUGO, show_temp_crit, NULL, 26); +static SENSOR_DEVICE_ATTR(temp8_max, S_IRUGO, show_temp_crit, NULL, 30); +static SENSOR_DEVICE_ATTR(temp9_max, S_IRUGO, show_temp_crit, NULL, 34); +static SENSOR_DEVICE_ATTR(temp10_max, S_IRUGO, show_temp_crit, NULL, 38); +static SENSOR_DEVICE_ATTR(temp11_max, S_IRUGO, show_temp_crit, NULL, 42); +static SENSOR_DEVICE_ATTR(temp12_max, S_IRUGO, show_temp_crit, NULL, 46); +static SENSOR_DEVICE_ATTR(temp13_max, S_IRUGO, show_temp_crit, NULL, 50); + +static SENSOR_DEVICE_ATTR(temp14_max, S_IRUGO, show_temp_crit, NULL, 46); +static SENSOR_DEVICE_ATTR(temp15_max, S_IRUGO, show_temp_crit, NULL, 50); + + +static struct attribute *smf_tcpu_attrs[] = { + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp4_input.dev_attr.attr, + &sensor_dev_attr_temp5_input.dev_attr.attr, + &sensor_dev_attr_temp6_input.dev_attr.attr, + &sensor_dev_attr_temp7_input.dev_attr.attr, + &sensor_dev_attr_temp8_input.dev_attr.attr, + &sensor_dev_attr_temp9_input.dev_attr.attr, + &sensor_dev_attr_temp10_input.dev_attr.attr, + &sensor_dev_attr_temp11_input.dev_attr.attr, + &sensor_dev_attr_temp12_input.dev_attr.attr, + &sensor_dev_attr_temp13_input.dev_attr.attr, + &sensor_dev_attr_temp14_input.dev_attr.attr, + &sensor_dev_attr_temp15_input.dev_attr.attr, + + &sensor_dev_attr_temp1_label.dev_attr.attr, + &sensor_dev_attr_temp2_label.dev_attr.attr, + &sensor_dev_attr_temp3_label.dev_attr.attr, + &sensor_dev_attr_temp4_label.dev_attr.attr, + &sensor_dev_attr_temp5_label.dev_attr.attr, + &sensor_dev_attr_temp6_label.dev_attr.attr, + &sensor_dev_attr_temp7_label.dev_attr.attr, + &sensor_dev_attr_temp8_label.dev_attr.attr, + &sensor_dev_attr_temp9_label.dev_attr.attr, + &sensor_dev_attr_temp10_label.dev_attr.attr, + &sensor_dev_attr_temp11_label.dev_attr.attr, + &sensor_dev_attr_temp12_label.dev_attr.attr, + &sensor_dev_attr_temp13_label.dev_attr.attr, + &sensor_dev_attr_temp14_label.dev_attr.attr, + &sensor_dev_attr_temp15_label.dev_attr.attr, + + &sensor_dev_attr_temp1_crit.dev_attr.attr, + &sensor_dev_attr_temp2_crit.dev_attr.attr, + &sensor_dev_attr_temp3_crit.dev_attr.attr, + &sensor_dev_attr_temp4_crit.dev_attr.attr, + &sensor_dev_attr_temp5_crit.dev_attr.attr, + &sensor_dev_attr_temp6_crit.dev_attr.attr, + &sensor_dev_attr_temp7_crit.dev_attr.attr, + &sensor_dev_attr_temp8_crit.dev_attr.attr, + &sensor_dev_attr_temp9_crit.dev_attr.attr, + &sensor_dev_attr_temp10_crit.dev_attr.attr, + &sensor_dev_attr_temp11_crit.dev_attr.attr, + &sensor_dev_attr_temp12_crit.dev_attr.attr, + &sensor_dev_attr_temp13_crit.dev_attr.attr, + &sensor_dev_attr_temp14_crit.dev_attr.attr, + &sensor_dev_attr_temp15_crit.dev_attr.attr, + + &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp2_max.dev_attr.attr, + &sensor_dev_attr_temp3_max.dev_attr.attr, + &sensor_dev_attr_temp4_max.dev_attr.attr, + &sensor_dev_attr_temp5_max.dev_attr.attr, + &sensor_dev_attr_temp6_max.dev_attr.attr, + &sensor_dev_attr_temp7_max.dev_attr.attr, + &sensor_dev_attr_temp8_max.dev_attr.attr, + &sensor_dev_attr_temp9_max.dev_attr.attr, + &sensor_dev_attr_temp10_max.dev_attr.attr, + &sensor_dev_attr_temp11_max.dev_attr.attr, + &sensor_dev_attr_temp12_max.dev_attr.attr, + &sensor_dev_attr_temp13_max.dev_attr.attr, + &sensor_dev_attr_temp14_max.dev_attr.attr, + &sensor_dev_attr_temp15_max.dev_attr.attr, + + NULL +}; + + +static const struct attribute_group smf_tcpu_group = { + .attrs = smf_tcpu_attrs, + .is_visible = smf_tcpu_is_visible, +}; + + +/* PSU ATTR */ +static ssize_t +show_psu_label(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct smf_data *data = dev_get_drvdata(dev); + int nr = to_sensor_dev_attr(attr)->index; + return sprintf(buf, "%s\n", data->psu_label[nr]); +} + + +static ssize_t show_psu(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + struct smf_data *data = dev_get_drvdata(dev); + int ret=0, export_hex=0; + int psu_status=0, pow; + + switch (index) { + + case 0: + pow = smf_read_reg16(data, PSU_1_MAX_POWER); + /* TODO Fix */ + if (data->kind == s6100smf) + ret = 1000000 * 1100; + else + ret = 1000000 * 750; + break; + case 1: + ret = smf_read_reg(data, PSU_1_STATUS); + export_hex=1; + break; + case 2: + ret = 100000 * smf_read_reg16(data, PSU_1_INPUT_POWER); + break; + case 3: + ret = 100000 * smf_read_reg16(data, PSU_1_OUTPUT_POWER); + break; + case 4: + psu_status = smf_read_reg(data, PSU_1_STATUS); + if (psu_status &(1)) + ret=1; + break; + case 5: + pow = smf_read_reg16(data, PSU_2_MAX_POWER); + ret = 1000000 * pow; + /* TODO Fix */ + if (data->kind == s6100smf) + ret = 1000000 * 1100; + else + ret = 1000000 * 750; + break; + case 6: + ret = smf_read_reg(data, PSU_2_STATUS); + export_hex=1; + break; + case 7: + ret = 100000 * smf_read_reg16(data, PSU_2_INPUT_POWER); + break; + case 8: + ret = 100000 * smf_read_reg16(data, PSU_2_OUTPUT_POWER); + break; + case 9: + psu_status = smf_read_reg(data, PSU_2_STATUS); + if (psu_status &(1)) + ret=1; + break; + case 10: + pow = smf_read_reg16(data, CURRENT_TOTAL_POWER); + ret = pow/10; + break; + default: + return ret; + } + + if (ret < 0) + return ret; + + pow = ret; + + if(export_hex) + return sprintf(buf, "%x\n", pow); + else + return sprintf(buf, "%u\n", pow); +} + + +static umode_t smf_psu_is_visible(struct kobject *kobj, + struct attribute *a, int n) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct smf_data *data = dev_get_drvdata(dev); + + if (data->psu_mask & (1 << (n % PSU_MAX))) + return a->mode; + return 0; +} + +/* PSU */ +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_psu, NULL, 2); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_psu, NULL, 3); +static SENSOR_DEVICE_ATTR(power3_input, S_IRUGO, show_psu, NULL, 7); +static SENSOR_DEVICE_ATTR(power4_input, S_IRUGO, show_psu, NULL, 8); + +static SENSOR_DEVICE_ATTR(power1_label, S_IRUGO, show_psu_label, NULL, 0); +static SENSOR_DEVICE_ATTR(power2_label, S_IRUGO, show_psu_label, NULL, 1); +static SENSOR_DEVICE_ATTR(power3_label, S_IRUGO, show_psu_label, NULL, 2); +static SENSOR_DEVICE_ATTR(power4_label, S_IRUGO, show_psu_label, NULL, 3); + +static SENSOR_DEVICE_ATTR(power1_max, S_IRUGO, show_psu, NULL, 0); +static SENSOR_DEVICE_ATTR(power2_max, S_IRUGO, show_psu, NULL, 0); +static SENSOR_DEVICE_ATTR(power3_max, S_IRUGO, show_psu, NULL, 5); +static SENSOR_DEVICE_ATTR(power4_max, S_IRUGO, show_psu, NULL, 5); + + +/* PSU2 */ +//static SENSOR_DEVICE_ATTR(power602_alarm, S_IRUGO, show_psu, NULL, 4); +//static SENSOR_DEVICE_ATTR(power702_alarm, S_IRUGO, show_psu, NULL, 9); + + + +static struct attribute *smf_psu_attrs[] = { + + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_power3_input.dev_attr.attr, + &sensor_dev_attr_power4_input.dev_attr.attr, + + &sensor_dev_attr_power1_label.dev_attr.attr, + &sensor_dev_attr_power2_label.dev_attr.attr, + &sensor_dev_attr_power3_label.dev_attr.attr, + &sensor_dev_attr_power4_label.dev_attr.attr, + + &sensor_dev_attr_power1_max.dev_attr.attr, + &sensor_dev_attr_power2_max.dev_attr.attr, + &sensor_dev_attr_power3_max.dev_attr.attr, + &sensor_dev_attr_power4_max.dev_attr.attr, + + NULL +}; + + +static const struct attribute_group smf_psu_group = { + .attrs = smf_psu_attrs, + .is_visible = smf_psu_is_visible, +}; + + +static const struct attribute_group smf_fanin_group = { + .attrs = smf_fanin_attrs, + .is_visible = smf_fanin_is_visible, +}; + + +static SENSOR_DEVICE_ATTR(fan_tray_presence, S_IRUGO, show_fan, NULL, 12); +static SENSOR_DEVICE_ATTR(fan1_airflow, S_IRUGO, show_fan_airflow, NULL, 0); +static SENSOR_DEVICE_ATTR(fan3_airflow, S_IRUGO, show_fan_airflow, NULL, 1); +static SENSOR_DEVICE_ATTR(fan5_airflow, S_IRUGO, show_fan_airflow, NULL, 2); +static SENSOR_DEVICE_ATTR(fan7_airflow, S_IRUGO, show_fan_airflow, NULL, 3); +static SENSOR_DEVICE_ATTR(fan9_airflow, S_IRUGO, show_fan_airflow, NULL, 4); +static SENSOR_DEVICE_ATTR(fan11_airflow, S_IRUGO, show_psu_fan, NULL, 0); +static SENSOR_DEVICE_ATTR(fan12_airflow, S_IRUGO, show_psu_fan, NULL, 3); +/* IOM status */ +static SENSOR_DEVICE_ATTR(iom_status, S_IRUGO, show_voltage, NULL, 44); +static SENSOR_DEVICE_ATTR(iom_presence, S_IRUGO, show_voltage, NULL, 45); + +static SENSOR_DEVICE_ATTR(psu1_presence, S_IRUGO, show_psu, NULL, 1); +static SENSOR_DEVICE_ATTR(psu2_presence, S_IRUGO, show_psu, NULL, 6); +static SENSOR_DEVICE_ATTR(current_total_power, S_IRUGO, show_psu, NULL, 10); + +static struct attribute *smf_dell_attrs[] = { + &sensor_dev_attr_fan_tray_presence.dev_attr.attr, + &sensor_dev_attr_fan1_airflow.dev_attr.attr, + &sensor_dev_attr_fan3_airflow.dev_attr.attr, + &sensor_dev_attr_fan5_airflow.dev_attr.attr, + &sensor_dev_attr_fan7_airflow.dev_attr.attr, + &sensor_dev_attr_fan9_airflow.dev_attr.attr, + &sensor_dev_attr_fan11_airflow.dev_attr.attr, + &sensor_dev_attr_fan12_airflow.dev_attr.attr, + &sensor_dev_attr_iom_status.dev_attr.attr, + &sensor_dev_attr_iom_presence.dev_attr.attr, + &sensor_dev_attr_psu1_presence.dev_attr.attr, + &sensor_dev_attr_psu2_presence.dev_attr.attr, + &sensor_dev_attr_current_total_power.dev_attr.attr, + NULL +}; + +static const struct attribute_group smf_dell_group = { + .attrs = smf_dell_attrs, + .is_visible = smf_dell_is_visible, +}; + + +static const struct attribute_group *smf_groups[] = { + &smf_psu_group, + &smf_fanin_group, + &smf_vsen_group, + &smf_curr_group, + &smf_tcpu_group, + &smf_dell_group, + NULL +}; + + + +static int smf_probe(struct platform_device *pdev) +{ + struct smf_data *data; + struct device *dev = &pdev->dev; + struct smf_sio_data *sio_data = dev_get_platdata(dev); + struct resource *res; + int err = 0; + + res = platform_get_resource(pdev, IORESOURCE_IO, 0); + if (!request_region(res->start, IOREGION_LENGTH, + smf_devices[sio_data->kind].name)) { + err = -EBUSY; + dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", + (unsigned long)res->start, + (unsigned long)res->start + IOREGION_LENGTH - 1); + return err; + } + + data = devm_kzalloc(dev, sizeof(struct smf_data), GFP_KERNEL); + /* TODO Use probe address value */ + data->addr = SMF_PROBE_ADDR; + data->kind = sio_data->kind; + + if (!data) + return -ENOMEM; + + mutex_init(&data->lock); + + /* PSU attributes */ + data->psu_mask = smf_devices[data->kind].psu_mask; + data->psu_label = smf_devices[data->kind].psu_label; + + /* FANIN attributes */ + data->fanin_mask = smf_devices[data->kind].fanin_mask; + data->fan_label = smf_devices[data->kind].fan_label; + + /* VSEN attributes */ + data->vsen_mask = smf_devices[data->kind].vsen_mask; + data->vsen_label = smf_devices[data->kind].vsen_label; + + /* CURR attributes */ + data->curr_mask = smf_devices[data->kind].curr_mask; + data->curr_label = smf_devices[data->kind].curr_label; + + /* CPU_TEMP attributes */ + data->tcpu_mask = smf_devices[data->kind].tcpu_mask; + data->temp_label = smf_devices[data->kind].temp_label; + + data->hwmon_dev = devm_hwmon_device_register_with_groups(dev, + smf_devices[data->kind].name, + data, smf_groups); + + return PTR_ERR_OR_ZERO(data->hwmon_dev); +} + + +static int smf_remove(struct platform_device *pdev) +{ + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_IO, 0); + release_region(res->start, IOREGION_LENGTH); + return 0; +} + + +static struct platform_driver smf_driver = { + .driver = { + .name = "SMF", + }, + .probe = smf_probe, + .remove = smf_remove +}; + +int __init +smf_find(int sioaddr, unsigned short *addr, struct smf_sio_data *sio_data) +{ + + int val; + + if (force_id) + val = force_id; + else + val = inb(sioaddr + SIO_REG_DEVID); + + switch (val) { + case SIO_Z9100_ID: + sio_data->kind = z9100smf; + break; + case SIO_S6100_ID: + sio_data->kind = s6100smf; + break; + + default: + if (val != 0xffff) + pr_debug("unsupported chip ID: 0x%04x\n", val); + return -ENODEV; + } + + /* TODO Use define, should this be 0x200 or 0x210??? */ + *addr = sioaddr; + + pr_info("Found %s chip at %#x\n", smf_devices[sio_data->kind].name, *addr); + sio_data->sioreg = sioaddr; + + return (0); +} + + +/* + * when Super-I/O functions move to a separate file, the Super-I/O + * bus will manage the lifetime of the device and this module will only keep + * track of the smf driver. But since we platform_device_alloc(), we + * must keep track of the device + */ +static struct platform_device *pdev; + +static int __init sensors_smf_init(void) +{ + int err; + unsigned short address; + struct resource res; + struct smf_sio_data sio_data; + + /* + * initialize sio_data->kind and sio_data->sioreg. + * when Super-I/O functions move to a separate file, the Super-I/O + * driver will probe and auto-detect the presence of a + * smf hardware monitor, and call probe() + */ + + if (smf_find(SMF_REG_ADDR, &address, &sio_data)) + return -ENODEV; + + err = platform_driver_register(&smf_driver); + if (err) + goto exit; + + pdev = platform_device_alloc(SIO_DRVNAME, address); + if (!pdev) { + err = -ENOMEM; + pr_err("Device allocation failed\n"); + goto exit_unregister; + } + + err = platform_device_add_data(pdev, &sio_data, + sizeof(struct smf_sio_data)); + if (err) { + pr_err("Platform data allocation failed\n"); + goto exit_device_put; + } + + memset(&res, 0, sizeof(res)); + res.name = SIO_DRVNAME; + res.start = address + IOREGION_OFFSET; + res.end = address + IOREGION_OFFSET + IOREGION_LENGTH - 1; + res.flags = IORESOURCE_IO; + + err = acpi_check_resource_conflict(&res); + if (err) + goto exit_device_put; + + err = platform_device_add_resources(pdev, &res, 1); + if (err) { + pr_err("Device resource addition failed (%d)\n", err); + goto exit_device_put; + } + + /* platform_device_add calls probe() */ + err = platform_device_add(pdev); + if (err) { + pr_err("Device addition failed (%d)\n", err); + goto exit_device_put; + } + + return 0; + +exit_device_put: + platform_device_put(pdev); +exit_unregister: + platform_driver_unregister(&smf_driver); +exit: + return err; +} + + +static void __exit sensors_smf_exit(void) +{ + platform_device_unregister(pdev); + platform_driver_unregister(&smf_driver); + + /*Remove sysfs dell_kobj*/ + kobject_put(dell_kobj); +} + + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("SMF driver"); +MODULE_PARM_DESC(force_id, "Override the detected device ID"); +MODULE_AUTHOR("Per Fremrot "); +MODULE_AUTHOR("Paavaanan "); + +module_init(sensors_smf_init); +module_exit(sensors_smf_exit); diff --git a/platform/broadcom/sonic-platform-modules-dell/common/fstrim.service b/platform/broadcom/sonic-platform-modules-dell/common/fstrim.service new file mode 100644 index 000000000000..cf740d3af34d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/common/fstrim.service @@ -0,0 +1,6 @@ +[Unit] +Description=Discard unused blocks + +[Service] +Type=oneshot +ExecStart=/sbin/fstrim -av diff --git a/platform/broadcom/sonic-platform-modules-dell/common/fstrim.timer b/platform/broadcom/sonic-platform-modules-dell/common/fstrim.timer new file mode 100644 index 000000000000..c6142dd94826 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/common/fstrim.timer @@ -0,0 +1,12 @@ +[Unit] +Description=Discard unused blocks once a week +Documentation=man:fstrim + +[Timer] +OnCalendar=weekly +OnBootSec=10min +AccuracySec=1h +Persistent=true + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/changelog b/platform/broadcom/sonic-platform-modules-dell/debian/changelog new file mode 100644 index 000000000000..90fed6f6d847 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/changelog @@ -0,0 +1,11 @@ +sonic-dell-platform-modules (1.1) unstable; urgency=low + + * Add support for Dell S6100 + + -- Dell Team Wed, 08 Feb 2017 15:57:40 -0800 + +sonic-dell-platform-modules (1.0) unstable; urgency=low + + * Initial release + + -- Dell Team Mon, 6 Feb 2017 10:10:10 -0800 diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/compat b/platform/broadcom/sonic-platform-modules-dell/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/control b/platform/broadcom/sonic-platform-modules-dell/debian/control new file mode 100644 index 000000000000..557b5b884f93 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/control @@ -0,0 +1,22 @@ +Source: sonic-dell-platform-modules +Section: main +Priority: extra +Maintainer: Dell Team +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-z9264f +Architecture: amd64 +Depends: linux-image-4.9.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-z9100 +Architecture: amd64 +Depends: linux-image-4.9.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-s6100 +Architecture: amd64 +Depends: linux-image-4.9.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.init b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.init new file mode 100755 index 000000000000..c798b24ef235 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.init @@ -0,0 +1,40 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup S6100 board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + /usr/local/bin/iom_power_on.sh + /usr/local/bin/s6100_platform.sh init + + echo "done." + ;; + +stop) + /usr/local/bin/s6100_platform.sh deinit + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-s6100.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install new file mode 100644 index 000000000000..f456acb9d812 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install @@ -0,0 +1,9 @@ +s6100/scripts/io_rd_wr.py usr/local/bin +s6100/scripts/iom_power_*.sh usr/local/bin +s6100/scripts/s6100_platform.sh usr/local/bin +common/dell_i2c_utils.sh usr/local/bin +common/fstrim.timer etc/systemd/system +common/fstrim.service etc/systemd/system +s6100/scripts/platform_sensors.py usr/local/bin +s6100/scripts/sensors usr/bin + diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst new file mode 100644 index 000000000000..aeabe1abd27c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst @@ -0,0 +1,7 @@ +# postinst script for S6100 + +# Enable fstrim +systemctl enable fstrim.timer +systemctl start fstrim.timer + +#DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.init b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.init new file mode 100755 index 000000000000..aefecf1d8158 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.init @@ -0,0 +1,40 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup Z9100 board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + # /usr/local/bin/iom_power_on.sh + /usr/local/bin/z9100_platform.sh init + + echo "done." + ;; + +stop) + /usr/local/bin/z9100_platform.sh deinit + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-z9100.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install new file mode 100644 index 000000000000..66d24e98e89c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install @@ -0,0 +1,8 @@ +z9100/scripts/check_qsfp.sh usr/local/bin +z9100/scripts/z9100_platform.sh usr/local/bin +common/dell_i2c_utils.sh usr/local/bin +common/fstrim.timer etc/systemd/system +common/fstrim.service etc/systemd/system +z9100/scripts/platform_sensors.py usr/local/bin +z9100/scripts/sensors usr/bin +z9100/cfg/z9100-modules.conf etc/modules-load.d diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst new file mode 100644 index 000000000000..b11ae1f274c4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst @@ -0,0 +1,7 @@ +# postinst script for Z9100 + +# Enable fstrim +systemctl enable fstrim.timer +systemctl start fstrim.timer + +#DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.init b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.init new file mode 100755 index 000000000000..cc83662e7746 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.init @@ -0,0 +1,40 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup Z9264f board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + # /usr/local/bin/iom_power_on.sh + /usr/local/bin/z9264f_platform.sh init + + echo "done." + ;; + +stop) + /usr/local/bin/z9100_platform.sh deinit + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-z9264f.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.install new file mode 100644 index 000000000000..7887399e4964 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.install @@ -0,0 +1,6 @@ +z9264f/scripts/z9264f_platform.sh usr/local/bin +z9264f/scripts/check_qsfp.sh usr/local/bin +z9264f/scripts/platform_sensors.py usr/local/bin +z9264f/scripts/sensors usr/bin +z9264f/scripts/pcisysfs.py usr/bin +z9264f/cfg/z9264f-modules.conf etc/modules-load.d diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/rules b/platform/broadcom/sonic-platform-modules-dell/debian/rules new file mode 100755 index 000000000000..3386580a80a4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/rules @@ -0,0 +1,45 @@ +#!/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:= s6100 z9100 z9264f +COMMON_DIR := common + +%: + dh $@ + +override_dh_auto_build: + (for mod in $(MODULE_DIRS); do \ + if [ $$mod = "s6100" ]; then \ + cp $(COMMON_DIR)/*.c $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \ + elif [ $$mod = "z9100" ]; then \ + cp $(COMMON_DIR)/*.c $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \ + fi; \ + echo "making man page alias $$mod -> $$mod APIs";\ + 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 \ + if [ $$mod = "s6100" ]; then \ + rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \ + elif [ $$mod = "z9100" ]; then \ + rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \ + fi; \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ + done) + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/modules/Makefile b/platform/broadcom/sonic-platform-modules-dell/s6100/modules/Makefile new file mode 100644 index 000000000000..0cdfbf5e67b8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := dell_s6100_iom_cpld.o dell_s6100_lpc.o + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_iom_cpld.c b/platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_iom_cpld.c new file mode 100644 index 000000000000..6cc28f707a1f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_iom_cpld.c @@ -0,0 +1,266 @@ + +#include // included for all kernel modules +#include // included for KERN_INFO +#include // included for __init and __exit macros +#include +#include +#include +#include + + +//iom cpld slave address +#define IOM_CPLD_SLAVE_ADD 0x3e + +//iom cpld ver register +#define IOM_CPLD_SLAVE_VER 0x00 + +//qsfp reset cntrl reg on each iom +#define QSFP_RST_CRTL_REG0 0x10 +#define QSFP_RST_CRTL_REG1 0x11 + +//qsfp lp mode reg on each iom +#define QSFP_LPMODE_REG0 0x12 +#define QSFP_LPMODE_REG1 0x13 + +//qsfp mod presence reg on each iom +#define QSFP_MOD_PRS_REG0 0x16 +#define QSFP_MOD_PRS_REG1 0x17 + + +struct cpld_data { + struct i2c_client *client; + struct mutex update_lock; +}; + + +static void dell_s6100_iom_cpld_add_client(struct i2c_client *client) +{ + struct cpld_data *data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + + if (!data) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + data->client = client; + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); +} + +static void dell_s6100_iom_cpld_remove_client(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + kfree(data); + return; +} + +int dell_s6100_iom_cpld_read(struct cpld_data *data,unsigned short cpld_addr, u8 reg) +{ + int ret = -EPERM; + u8 high_reg =0x00; + + mutex_lock(&data->update_lock); + ret = i2c_smbus_write_byte_data(data->client, high_reg,reg); + ret = i2c_smbus_read_byte(data->client); + mutex_unlock(&data->update_lock); + + return ret; +} + +int dell_s6100_iom_cpld_write(struct cpld_data *data,unsigned short cpld_addr, u8 reg, u8 value) +{ + int ret = -EIO; + u16 devdata=0; + u8 high_reg =0x00; + + mutex_lock(&data->update_lock); + devdata = (value << 8) | reg; + i2c_smbus_write_word_data(data->client,high_reg,devdata); + mutex_unlock(&data->update_lock); + + return ret; +} +static ssize_t get_cpldver(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u8 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,IOM_CPLD_SLAVE_VER); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u8)ret & 0xff; + return sprintf(buf,"IOM CPLD Version:0x%02x\n",devdata); +} + +static ssize_t get_modprs(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_MOD_PRS_REG0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_MOD_PRS_REG1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_LPMODE_REG0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_LPMODE_REG1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_RST_CRTL_REG0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_RST_CRTL_REG1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct cpld_data *data = dev_get_drvdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + dell_s6100_iom_cpld_write(data,IOM_CPLD_SLAVE_ADD,QSFP_LPMODE_REG0,(u8)(devdata & 0xff)); + dell_s6100_iom_cpld_write(data,IOM_CPLD_SLAVE_ADD,QSFP_LPMODE_REG1,(u8)((devdata >> 8) & 0xff)); + + return count; +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct cpld_data *data = dev_get_drvdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + dell_s6100_iom_cpld_write(data,IOM_CPLD_SLAVE_ADD,QSFP_RST_CRTL_REG0,(u8)(devdata & 0xff)); + dell_s6100_iom_cpld_write(data,IOM_CPLD_SLAVE_ADD,QSFP_RST_CRTL_REG1,(u8)((devdata >> 8) & 0xff)); + + return count; +} + +static DEVICE_ATTR(iom_cpld_vers,S_IRUGO,get_cpldver, NULL); +static DEVICE_ATTR(qsfp_modprs, S_IRUGO,get_modprs, NULL); +static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR,get_lpmode,set_lpmode); +static DEVICE_ATTR(qsfp_reset, S_IRUGO | S_IWUSR,get_reset, set_reset); + +static struct attribute *i2c_cpld_attrs[] = { + &dev_attr_qsfp_lpmode.attr, + &dev_attr_qsfp_reset.attr, + &dev_attr_qsfp_modprs.attr, + &dev_attr_iom_cpld_vers.attr, + NULL, +}; + +static struct attribute_group i2c_cpld_attr_grp = { + .attrs = i2c_cpld_attrs, +}; + +static int dell_s6100_iom_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + dell_s6100_iom_cpld_add_client(client); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &i2c_cpld_attr_grp); + if (status) { + printk(KERN_INFO "Cannot create sysfs\n"); + } + return 0; + +exit: + return status; +} + +static int dell_s6100_iom_cpld_remove(struct i2c_client *client) +{ + dell_s6100_iom_cpld_remove_client(client); + return 0; +} + + +static const struct i2c_device_id dell_s6100_iom_cpld_id[] = { + { "dell_s6100_iom_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, dell_s6100_iom_cpld_id); + +static struct i2c_driver dell_s6100_iom_cpld_driver = { + .driver = { + .name = "dell_s6100_iom_cpld", + }, + .probe = dell_s6100_iom_cpld_probe, + .remove = dell_s6100_iom_cpld_remove, + .id_table = dell_s6100_iom_cpld_id, +}; + + + +static int __init dell_s6100_iom_cpld_init(void) +{ + return i2c_add_driver(&dell_s6100_iom_cpld_driver); +} + +static void __exit dell_s6100_iom_cpld_exit(void) +{ + i2c_del_driver(&dell_s6100_iom_cpld_driver); +} + +MODULE_AUTHOR("Srideep Devireddy "); +MODULE_DESCRIPTION("dell_s6100_iom_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(dell_s6100_iom_cpld_init); +module_exit(dell_s6100_iom_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/README b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/README new file mode 100644 index 000000000000..b141bb05e2e4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/README @@ -0,0 +1,146 @@ +Dell S6100 64x40G support +------------------------ + +summary:- +S6100 has 64 x 40G port capacity +S6100 supports 4 IO Modules which are pluggable. Below section covers how to power on IO modules +and initialize the device drivers and configure necessary mux to send traffic. + + +Necessary drivers and scripts to package + +1) Users are expected to build necessary drivers for kernel and package to acess it on the target + + a) Mgmt phy driver + This supports BCM 54616 phy driver ( enable CONFIG_IGB in kernel config) + b) driver-support-sff-8436-eeprom.patch + c) driver-support-sff-8436-eeprom-update.patch + This driver supports QSFP EEPROM + d) dell_s6100_iom_cpld.ko + This driver provides support for cpld on 4 x 40Gig-IOM modules + e) i2c_mux_pca954x.ko + This driver provides support for i2c mux/switch (pca954x) + f) dell_s6100_lpc.ko + This driver porivide support for reading all the platform info from SMF. + + +2) Users are also expected to package below scripts for platform initialization and i2c tree creation + + a) iom_power.sh + This script is used to power on IO modules on S6100 + b) io_rd_wr.py +This script is generic LPC/io read/write utility (can also access system cpld) + +steps to platform initialization (Tested with 3.16) + +1) After power up of S6100 + + a) power up the io modules by executing (./iom_power.sh) + b) insert i2c_mux_pca954x.ko,dell_s6100_iom_cpld.ko,dell_s6100_lpc.ko + + Above 2 steps can be called by including them in below 2 step + +2) Build i2c device tree/device initialization by calling below script + + ./s6100_platform_init.sh + +3) IOM cpld devices are created under "/sys/bus/i2c/drivers/dell_s6100_iom_cpld/" + QSFP handles via sysfs i2c bus #( 15,16,17,18-003e) + iom_cpld_vers -- Displays CPLD version(RO) + qsfp_lpmode -- lpmode settings(RW) + qsfp_modprs -- modules presence (RO) + qsfp_reset -- reset settings (RW) + + ls /sys/bus/i2c/drivers/dell_s6100_iom_cpld/15-003e/ + driver/ iom_cpld_vers modalias name power/ qsfp_lpmode qsfp_modprs qsfp_reset subsystem/ uevent + +4) step 2 script also builds/attach sfp device tress in sysfs + + Example for reading EEPROM data + + cat /sys/bus/i2c/devices/19-0050/eeprom | hexdump -C + 00000000 0d 00 00 0f 00 00 00 00 00 00 00 00 00 00 00 00 |................| + 00000010 00 00 00 00 00 00 18 1b 00 00 82 20 00 00 00 00 |........... ....| + 00000020 00 00 00 00 00 00 00 00 00 00 16 4d 16 4d 16 4d |...........M.M.M| + 00000030 16 4d 34 bf 44 bf 54 bf 64 bf 00 00 00 00 00 00 |.M4.D.T.d.......| + 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + * + 00000070 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff 00 |................| + 00000080 0d 00 0c 04 00 00 00 40 40 02 d5 05 69 00 00 32 |.......@@...i..2| + 00000090 00 00 00 00 46 49 4e 49 53 41 52 20 43 4f 52 50 |....FINISAR CORP| + 000000a0 20 20 20 20 07 00 90 65 46 54 4c 34 31 30 51 45 | ...eFTL410QE| + 000000b0 31 43 20 20 20 20 20 20 41 33 42 68 07 d0 46 70 |1C A3Bh..Fp| + 000000c0 00 01 04 d0 4d 4c 54 30 30 51 33 20 20 20 20 20 |....MLT00Q3 | + 000000d0 20 20 20 20 31 32 30 31 31 35 20 20 08 00 00 38 | 120115 ...8| + 000000e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | + 000000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + * + 00000200 4b 00 fb 00 46 00 00 00 00 00 00 00 00 00 00 00 |K...F...........| + 00000210 94 70 6e f0 86 c4 7b 0c 00 00 00 00 00 00 00 00 |.pn...{.........| + 00000220 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + * + 00000260 00 00 11 11 00 00 00 00 00 00 00 00 00 00 22 22 |..............""| + 00000270 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| + 00000280 + +5)SMF driver details/Readme are as below + + S6100 SMF + --------- + + S6100 has one SMF soc on CPU board. This is via LPC interface, provide access to all the below functionality + + a) Read sensors details on the system + b) Read PSU details on the system + c) Read fans/Fan tray details on the system + d) Read/Write to system led + + dell_s6100_lpc create entry for all the above necessary platform components as attributes in below path. + + /sys/devices/platform/dell_s6100_lpc/ + + + LED:- + ---- + + Get /set operations on sys_led + + Get operation + cat /sys/devices/platform/dell_s6100_lpc/sys_led + 0x80 + + Set operation + echo 83 > sys/devices/platform/dell_s6100_lpc/sys_led + + Sensors:- + -------- + + Max no of sensors on the system ( 11 sensors are available on fully loaded system) + + cat /sys/devices/platform/dell_s6100_lpc/max_num_temp_sensors + b + + cat /sys/devices/platform/dell_s6100_lpc/temp_sensor_1 ( temp_sensor_1 <85>.temp_sensor_11) + + Fan tray speed:- + -------------- + + /sys/devices/platform/dell_s6100_lpc/fan_tray_1_speed (fan_tray_1_speed - fan_tray_4_speed) + 13700 + + cat /sys/devices/platform/dell_s6100_lpc/psu1_max_pwr + 110 + cat /sys/devices/platform/dell_s6100_lpc/psu2_max_pwr + 110 + + cat /sys/devices/platform/dell_s6100_lpc/psu_total_pwr + 232 + + + + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/io_rd_wr.py b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/io_rd_wr.py new file mode 100755 index 000000000000..dc9dd09807c2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/io_rd_wr.py @@ -0,0 +1,93 @@ +#!/usr/bin/python +#Script to read/write the io based registers + +import sys +import os +import getopt +import struct + +io_resource='/dev/port' + +def usage(): + ''' This is the Usage Method ''' + + print 'Utility for IO read/write' + print '\t\t io_rd_wr.py --get --offset ' + print '\t\t io_rd_wr.py --set --val --offset ' + sys.exit(1) + +def io_reg_read(io_resource,offset): + fd=os.open(io_resource, os.O_RDONLY) + if(fd<0): + print 'file open failed %s"%io_resource' + return + if(os.lseek(fd, offset, os.SEEK_SET) != offset): + print 'lseek failed on %s'%io_resource + return + buf=os.read(fd,1) + reg_val1=ord(buf) + print 'reg value %x'%reg_val1 + os.close(fd) + +def io_reg_write(io_resource,offset,val): + fd=os.open(io_resource,os.O_RDWR) + if(fd<0): + print 'file open failed %s"%io_resource' + return + if(os.lseek(fd, offset, os.SEEK_SET) != offset): + print 'lseek failed on %s'%io_resource + return + ret=os.write(fd,struct.pack('B',val)) + if(ret != 1): + print 'write failed %d'%ret + return + os.close(fd) + +def main(argv): + + ''' The main function will read the user input from the + command line argument and process the request ''' + + opts = '' + val = '' + choice = '' + resouce = '' + offset = '' + + try: + opts, args = getopt.getopt(argv, "hgs:" , \ + ["val=","offset=","help", "get", "set"]) + + except getopt.GetoptError: + usage() + + for opt,arg in opts: + + if opt in ('-h','--help'): + choice = 'help' + + elif opt in ('-g', '--get'): + choice = 'get' + + elif opt in ('-s', '--set'): + choice = 'set' + + elif opt == '--offset': + offset = int(arg,16) + + elif opt == '--val': + val = int(arg,16) + + if choice == 'get' and offset != '': + io_reg_read(io_resource,offset) + + elif choice == 'set' and offset != '' and val != '': + io_reg_write(io_resource,offset,val) + + else: + usage() + +#Calling the main method +if __name__ == "__main__": + main(sys.argv[1:]) + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/iom_power_off.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/iom_power_off.sh new file mode 100755 index 000000000000..a7671cfe589c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/iom_power_off.sh @@ -0,0 +1,16 @@ +#!/bin/bash +#This script is used to power off IO modules +# IOM can be controlled via SMF using mailbox registers +# write 0x2 to 0x04D9 to power off IOM 1 +./io_rd_wr.py --set --val 0x04 --offset 0x210 +./io_rd_wr.py --set --val 0xd9 --offset 0x211 +./io_rd_wr.py --set --val 0x2 --offset 0x213 +# write 0x2 to 0x04DA to power off IOM 2 +./io_rd_wr.py --set --val 0xda --offset 0x211 +./io_rd_wr.py --set --val 0x2 --offset 0x213 +# write 0x2 to 0x04DB to power off IOM 3 +./io_rd_wr.py --set --val 0xdb --offset 0x211 +./io_rd_wr.py --set --val 0x2 --offset 0x213 +# write 0x2 to 0x04DC to power off IOM 4 +./io_rd_wr.py --set --val 0xdc --offset 0x211 +./io_rd_wr.py --set --val 0x2 --offset 0x213 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/iom_power_on.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/iom_power_on.sh new file mode 100755 index 000000000000..3d31170803e1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/iom_power_on.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# This script is used to power on IO modules +# IOM can be controlled via SMF using mailbox registers + +# write 0x1 to 0x04D9 to power up IOM 1 +/usr/local/bin/io_rd_wr.py --set --val 0x04 --offset 0x210 +/usr/local/bin/io_rd_wr.py --set --val 0xd9 --offset 0x211 +/usr/local/bin/io_rd_wr.py --set --val 0x1 --offset 0x213 +# write 0x1 to 0x04DA to power up IOM 2 +/usr/local/bin/io_rd_wr.py --set --val 0xda --offset 0x211 +/usr/local/bin/io_rd_wr.py --set --val 0x1 --offset 0x213 +# write 0x1 to 0x04DB to power up IOM 3 +/usr/local/bin/io_rd_wr.py --set --val 0xdb --offset 0x211 +/usr/local/bin/io_rd_wr.py --set --val 0x1 --offset 0x213 +# write 0x1 to 0x04DC to power up IOM 4 +/usr/local/bin/io_rd_wr.py --set --val 0xdc --offset 0x211 +/usr/local/bin/io_rd_wr.py --set --val 0x1 --offset 0x213 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_sensors.py new file mode 100755 index 000000000000..fb59df1ee7f3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_sensors.py @@ -0,0 +1,322 @@ +#!/usr/bin/python + +# On S6100, the Platform Management Controller runs the +# thermal algorithm. It provides a mailbox for the Host +# to query relevant thermals. The dell_mailbox module +# provides the sysfs support for the following objects: +# * onboard temperature sensors +# * FAN trays +# * PSU +# +import os +import sys +import logging + +S6100_MAX_FAN_TRAYS = 4 +S6100_MAX_PSUS = 2 +S6100_MAX_IOMS = 4 + +MAILBOX_DIR = "/sys/devices/platform/SMF.512/hwmon/hwmon1" +iom_status_list = [] + +# Get a mailbox register + + +def get_pmc_register(reg_name): + retval = 'ERR' + mb_reg_file = MAILBOX_DIR+'/'+reg_name + + if (not os.path.isfile(mb_reg_file)): + print mb_reg_file, 'not found !' + return retval + + try: + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", mb_reg_file, "file !") + + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + return retval + +logging.basicConfig(level=logging.DEBUG) + +if (os.path.isdir(MAILBOX_DIR)): + print 'dell-s6100-lpc' + print 'Adapter: S6100 Platform Management Controller' +else: + logging.error('S6100 Platform Management Controller module not loaded !') + # sys.exit(0) + +# Print the information for temperature sensors + + +def print_temperature_sensors(): + print("\nOnboard Temperature Sensors:") + print ' CPU: ',\ + int(get_pmc_register('temp1_input'))/1000, 'C' + print ' BCM56960 (PSU side): ',\ + int(get_pmc_register('temp2_input'))/1000, 'C' + print ' System Outlet 1 (switch board): ',\ + int(get_pmc_register('temp3_input'))/1000, 'C' + print ' BCM56960 (IO side): ',\ + int(get_pmc_register('temp4_input'))/1000, 'C' + print ' System Outlet 2 (CPU board): ',\ + int(get_pmc_register('temp9_input'))/1000, 'C' + print ' System Inlet Left (IO side): ',\ + int(get_pmc_register('temp10_input'))/1000, 'C' + print ' System Inlet Right (IO side): ',\ + int(get_pmc_register('temp11_input'))/1000, 'C' + + iom_status = get_pmc_register('iom_presence') + iom_status = int(iom_status, 16) + + iom_presence = get_pmc_register('iom_status') + + if (iom_presence != 'ERR'): + iom_presence = int(iom_presence, 16) + + # IOM presence : 0 => IOM present + # Temperature sensors 5..8 correspond to IOM 1..4 + for iom in range(0, S6100_MAX_IOMS): + if (~iom_presence & (1 << iom)): + iom_sensor_indx = iom + 5 + print ' IOM ' + str(iom + 1) + ':\t\t\t ',\ + int(get_pmc_register('temp'+str(iom_sensor_indx) + + '_input'))/1000, 'C' + + # Save the IOM Status for later use + if (~iom_status & (1 << iom)): + iom_status_list.append('ON') + else: + iom_status_list.append('OFF') + else: + iom_status_list.append('Not present') + print ' IOM ' + str(iom + 1) + ':\t\t\t ', 'Not present' + else: + logging.error('Unable to check IOM presence') + +print_temperature_sensors() + + +# Print the information for voltage sensors + + +def print_voltage_sensors(): + print("\nOnboard Voltage Sensors:") + + print ' CPU XP3R3V_EARLY ',\ + float(get_pmc_register('in1_input'))/1000, 'V' + print ' CPU XP5R0V_CP ',\ + float(get_pmc_register('in2_input'))/1000, 'V' + print ' CPU XP3R3V_STD ',\ + float(get_pmc_register('in3_input'))/1000, 'V' + print ' CPU XP3R3V_CP ',\ + float(get_pmc_register('in4_input'))/1000, 'V' + print ' CPU XP0R75V_VTT_A ',\ + float(get_pmc_register('in5_input'))/1000, 'V' + print ' CPU XPPR75V_VTT_B ',\ + float(get_pmc_register('in6_input'))/1000, 'V' + print ' CPU XP1R07V_CPU ',\ + float(get_pmc_register('in7_input'))/1000, 'V' + print ' CPU XP1R0V_CPU ',\ + float(get_pmc_register('in8_input'))/1000, 'V' + print ' CPU XP12R0V ',\ + float(get_pmc_register('in9_input'))/1000, 'V' + print ' CPU VDDR_CPU_2 ',\ + float(get_pmc_register('in10_input'))/1000, 'V' + print ' CPU VDDR_CPU_1 ',\ + float(get_pmc_register('in11_input'))/1000, 'V' + print ' CPU XP1R5V_CLK ',\ + float(get_pmc_register('in12_input'))/1000, 'V' + print ' CPU XP1R8V_CPU ',\ + float(get_pmc_register('in13_input'))/1000, 'V' + print ' CPU XP1R0V_CPU_VNN ',\ + float(get_pmc_register('in14_input'))/1000, 'V' + print ' CPU XP1R0V_CPU_VCC ',\ + float(get_pmc_register('in15_input'))/1000, 'V' + print ' CPU XP1R5V_EARLY ',\ + float(get_pmc_register('in16_input'))/1000, 'V' + print ' SW XP3R3V_MON ',\ + float(get_pmc_register('in17_input'))/1000, 'V' + print ' SW XP1R25V_MON ',\ + float(get_pmc_register('in19_input'))/1000, 'V' + print ' SW XP1R2V_MON ',\ + float(get_pmc_register('in20_input'))/1000, 'V' + print ' SW XP1R0V_SW_MON ',\ + float(get_pmc_register('in21_input'))/1000, 'V' + print ' SW XP1R0V_ROV_SW_MON ',\ + float(get_pmc_register('in22_input'))/1000, 'V' + print ' SW XR1R0V_BCM84752_MON ',\ + float(get_pmc_register('in23_input'))/1000, 'V' + print ' SW XP5V_MB_MON ',\ + float(get_pmc_register('in24_input'))/1000, 'V' + print ' SW XP3R3V_FPGA_MON ',\ + float(get_pmc_register('in26_input'))/1000, 'V' + print ' SW XP3R3V_EARLY_MON ',\ + float(get_pmc_register('in27_input'))/1000, 'V' + +print_voltage_sensors() + +# Print the information for 1 Fan Tray + + +def print_fan_tray(tray): + + Fan_Status = ['Normal', 'Abnormal'] + Airflow_Direction = ['B2F', 'F2B'] + + print ' Fan Tray ' + str(tray) + ':' + + if (tray == 1): + fan1_speed = get_pmc_register('fan1_input') + air_flow_reg = int(get_pmc_register('fan1_airflow'), 16) + fan1_status = 0 if fan1_speed >= 1000 else 1 + + print ' Fan Speed: ', fan1_speed, 'RPM' + print ' Fan State: ', Fan_Status[fan1_status] + print ' Air Flow: ', Airflow_Direction[air_flow_reg] + elif (tray == 2): + fan1_speed = get_pmc_register('fan3_input') + air_flow_reg = int(get_pmc_register('fan3_airflow'), 16) + fan1_status = 0 if fan1_speed >= 1000 else 1 + + print ' Fan Speed: ', fan1_speed, 'RPM' + print ' Fan State: ', Fan_Status[fan1_status] + print ' Air Flow: ', Airflow_Direction[air_flow_reg] + elif (tray == 3): + fan1_speed = get_pmc_register('fan5_input') + air_flow_reg = int(get_pmc_register('fan5_airflow'), 16) + fan1_status = 0 if fan1_speed >= 1000 else 1 + + print ' Fan Speed: ', fan1_speed, 'RPM' + print ' Fan State: ', Fan_Status[fan1_status] + print ' Air Flow: ', Airflow_Direction[air_flow_reg] + elif (tray == 4): + fan1_speed = get_pmc_register('fan7_input') + air_flow_reg = int(get_pmc_register('fan7_airflow'), 16) + fan1_status = 0 if fan1_speed >= 1000 else 1 + + print ' Fan Speed: ', fan1_speed, 'RPM' + print ' Fan State: ', Fan_Status[fan1_status] + print ' Air Flow: ', Airflow_Direction[air_flow_reg] + +print('\nFan Trays:') +fan_tray_presence = get_pmc_register('fan_tray_presence') + +if (fan_tray_presence != 'ERR'): + fan_tray_presence = int(fan_tray_presence, 16) + + for tray in range(0, S6100_MAX_FAN_TRAYS): + if (fan_tray_presence & (1 << tray)): + print_fan_tray(tray + 1) + else: + print '\n Fan Tray ' + str(tray + 1) + ': Not present' +else: + logging.error('Unable to read FAN presence') + +# Print the information for PSU1, PSU2 + + +def print_psu(psu): + Psu_Type = ['Mismatch', 'Normal'] + Psu_Input_Type = ['AC', 'DC'] + PSU_STATUS_TYPE_BIT = 4 + PSU_STATUS_INPUT_TYPE_BIT = 1 + PSU_FAN_PRESENT_BIT = 2 + PSU_FAN_STATUS_BIT = 1 + PSU_FAN_AIR_FLOW_BIT = 0 + Psu_Fan_Presence = ['Present', 'Absent'] + Psu_Fan_Status = ['Normal', 'Abnormal'] + Psu_Fan_Airflow = ['B2F', 'F2B'] + + print ' PSU ' + str(psu) + ':' + if (psu == 1): + psu_status = int(get_pmc_register('psu1_presence'), 16) + else: + psu_status = int(get_pmc_register('psu2_presence'), 16) + + psu_input_type = (psu_status & (1 << PSU_STATUS_INPUT_TYPE_BIT)) >>\ + PSU_STATUS_INPUT_TYPE_BIT + psu_type = (psu_status & (1 << PSU_STATUS_TYPE_BIT)) >>\ + PSU_STATUS_TYPE_BIT + + print ' Input: ', Psu_Input_Type[psu_input_type] + print ' Type: ', Psu_Type[psu_type] + + # PSU FAN details + if (psu == 1): + print ' FAN Speed: ', get_pmc_register('fan11_input'), 'RPM' + psu_fan_airflow = int(get_pmc_register('fan11_airflow')) + psu_fan_status = int(get_pmc_register('fan11_alarm')) + psu_fan_present = int(get_pmc_register('fan11_fault')) + input_voltage = float(get_pmc_register('in29_input')) / 1000 + output_voltage = float(get_pmc_register('in30_input')) / 1000 + input_current = float(get_pmc_register('curr601_input')) / 100 + output_current = float(get_pmc_register('curr602_input')) / 100 + input_power = float(get_pmc_register('power1_input')) / 1000000 + output_power = float(get_pmc_register('power2_input')) / 1000000 + if (input_power != 0): + psu_fan_temp = int(get_pmc_register('temp14_input'))/1000 + else: + print ' FAN Speed: ', get_pmc_register('fan12_input'), 'RPM' + psu_fan_airflow = int(get_pmc_register('fan12_airflow')) + psu_fan_status = int(get_pmc_register('fan12_alarm')) + psu_fan_present = int(get_pmc_register('fan12_fault')) + input_voltage = float(get_pmc_register('in31_input')) / 1000 + output_voltage = float(get_pmc_register('in32_input')) / 1000 + input_current = float(get_pmc_register('curr701_input')) / 100 + output_current = float(get_pmc_register('curr702_input')) / 100 + input_power = float(get_pmc_register('power3_input')) / 1000000 + output_power = float(get_pmc_register('power4_input')) / 1000000 + if (input_power != 0): + psu_fan_temp = int(get_pmc_register('temp15_input'))/1000 + print ' FAN: ', Psu_Fan_Presence[psu_fan_present] + print ' FAN Status: ', Psu_Fan_Status[psu_fan_status] + print ' FAN AIRFLOW: ', Psu_Fan_Airflow[psu_fan_airflow] + + # PSU input & output monitors + print ' Input Voltage: %6.2f' % (input_voltage), 'V' + + print ' Output Voltage: %6.2f' % (output_voltage), 'V' + + print ' Input Current: %6.2f' % (input_current), 'A' + + print ' Output Current: %6.2f' % (output_current), 'A' + + print ' Input Power: %6.2f' % (input_power), 'W' + + print ' Output Power: %6.2f' % (output_power), 'W' + + # PSU firmware gives spurious temperature reading without input power + if (input_power != 0): + print ' Temperature: ', psu_fan_temp, 'C' + else: + print ' Temperature: ', 'NA' + +print('\nPSUs:') +for psu in range(1, S6100_MAX_PSUS + 1): + + if (psu == 1): + psu_status = get_pmc_register('psu1_presence') + else: + psu_status = get_pmc_register('psu2_presence') + + if (psu_status != 'ERR'): + psu_status = int(psu_status, 16) + if (~psu_status & 0b1): + print_psu(psu) + else: + print '\n PSU ', psu, 'Not present' + else: + logging.error('Unable to check PSU presence') + +print '\n Total Power: ', get_pmc_register('current_total_power'), 'W' + +print('\nIO Modules:') + +for iom in range(1, S6100_MAX_IOMS+1): + print ' IOM ' + str(iom) + ' :' + iom_status_list[iom - 1] + +print '\n' diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh new file mode 100755 index 000000000000..8dd76f2ea6d3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh @@ -0,0 +1,206 @@ +#!/bin/bash + +#platform init script for Dell S6100 + +source dell_i2c_utils.sh + +init_devnum() { + found=0 + for devnum in 0 1; do + devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name` + # iSMT adapter can be at either dffd0000 or dfff0000 + if [[ $devname == 'SMBus iSMT adapter at '* ]]; then + found=1 + break + fi + done + + [[ $found -eq 0 ]] && echo "cannot find iSMT" && exit 1 +} + +# Attach/Detach CPU board mux @ 0x70 +cpu_board_mux() { + case $1 in + "new_device") i2c_config "echo pca9547 0x70 > /sys/bus/i2c/devices/i2c-${devnum}/$1" + ;; + "delete_device") i2c_config "echo 0x70 > /sys/bus/i2c/devices/i2c-${devnum}/$1" + ;; + *) echo "s6100_platform: cpu_board_mux: invalid command !" + ;; + esac +} + +# Attach/Detach Switchboard MUX @ 0x71 +switch_board_mux() { + case $1 in + "new_device") i2c_config "echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-4/$1" + ;; + "delete_device") i2c_config "echo 0x71 > /sys/bus/i2c/devices/i2c-4/$1" + ;; + *) echo "s6100_platform: switch_board_mux : invalid command !" + ;; + esac +} + +# Attach/Detach syseeprom on CPU board +sys_eeprom() { + case $1 in + "new_device") i2c_config "echo 24c02 0x50 > /sys/bus/i2c/devices/i2c-2/$1" + ;; + "delete_device") i2c_config "echo 0x50 > /sys/bus/i2c/devices/i2c-2/$1" + ;; + *) echo "s6100_platform: sys_eeprom : invalid command !" + ;; + esac +} + +#Attach/Detach CPLD devices to drivers for each IOM +switch_board_cpld() { + case $1 in + "new_device") + for ((i=14;i<=17;i++)); + do + i2c_config "echo dell_s6100_iom_cpld 0x3e > /sys/bus/i2c/devices/i2c-$i/$1" + done + ;; + "delete_device") + for ((i=14;i<=17;i++)); + do + i2c_config "echo 0x3e > /sys/bus/i2c/devices/i2c-$i/$1" + done + ;; + *) echo "s6100_platform: switch_board_cpld : invalid command !" + ;; + esac +} + +#Attach/Detach the MUX connecting all QSFPs on each IOM @0x71 and 0x72 +switch_board_qsfp_mux() { + case $1 in + "new_device") + for ((i=9;i>=6;i--)); + do + # 0x71 mux on the IOM 1 + mux_index=$(expr $i - 5) + echo "Attaching PCA9548 $mux_index" + i2c_config "echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-$i/$1" + i2c_config "echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-$i/$1" + done + ;; + "delete_device") + for ((i=9;i>=6;i--)); + do + # 0x71 mux on the IOM 1 + mux_index=$(expr $i - 5) + echo "Detaching PCA9548 $mux_index" + i2c_config "echo 0x71 > /sys/bus/i2c/devices/i2c-$devnum/i2c-$i/$1" + i2c_config "echo 0x72 > /sys/bus/i2c/devices/i2c-$devnum/i2c-$i/$1" + done + ;; + *) echo "s6100_platform: switch_board_qsfp_mux: invalid command !" + ;; + esac +} + +#Attach/Detach the SFP modules on PCA9548_2 +switch_board_sfp() { + case $1 in + "new_device") i2c_config "echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-11/$1" + i2c_config "echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-12/$1" + ;; + "delete_device") i2c_config "echo 0x50 > /sys/bus/i2c/devices/i2c-11/$1" + i2c_config "echo 0x50 > /sys/bus/i2c/devices/i2c-12/$1" + ;; + *) echo "s6100_platform: switch_board_sfp: invalid command !" + ;; + esac +} + +#Add/Delete ($1) a range ($2..$3) of QSFPs +qsfp_device_mod() { + case $1 in + "new_device") for ((i=$2;i<=$3;i++)); + do + i2c_config "echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-$i/$1" + done + ;; + "delete_device") for ((i=$2;i<=$3;i++)); + do + i2c_config "echo 0x50 > /sys/bus/i2c/devices/i2c-$i/$1" + done + ;; + *) echo "s6100_platform: qsfp_device_mod: invalid command $1:$2,$3!" + ;; + esac +} + +# Attach/Detach 16 instances of QSFP ports on each IO modules +# eeprom can dump data using below command +switch_board_qsfp() { + if i2c_poll_bus_exists "/sys/bus/i2c/devices/i2c-18"; then + qsfp_device_mod $1 18 33 + fi + + if i2c_poll_bus_exists "/sys/bus/i2c/devices/i2c-34"; then + qsfp_device_mod $1 34 49 + fi + + if i2c_poll_bus_exists "/sys/bus/i2c/devices/i2c-50"; then + qsfp_device_mod $1 50 65 + fi + + if i2c_poll_bus_exists "/sys/bus/i2c/devices/i2c-66"; then + qsfp_device_mod $1 66 81 + fi +} + +# Enable/Disable low power mode on all QSFP ports +switch_board_qsfp_lpmode() { + case $1 in + "enable") value=0xffff + ;; + "disable") value=0x0 + ;; + *) echo "s6100_platform: switch_board_qsfp_lpmode: invalid command $1!" + return + ;; + esac + echo $value > /sys/class/i2c-adapter/i2c-14/14-003e/qsfp_lpmode + echo $value > /sys/class/i2c-adapter/i2c-15/15-003e/qsfp_lpmode + echo $value > /sys/class/i2c-adapter/i2c-16/16-003e/qsfp_lpmode + echo $value > /sys/class/i2c-adapter/i2c-17/17-003e/qsfp_lpmode +} + +init_devnum + +if [[ "$1" == "init" ]]; then + depmod -a + modprobe i2c-dev + modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe dell_s6100_iom_cpld + modprobe dell_s6100_lpc + + cpu_board_mux "new_device" + switch_board_mux "new_device" + sys_eeprom "new_device" + switch_board_cpld "new_device" + switch_board_qsfp_mux "new_device" + switch_board_sfp "new_device" + switch_board_qsfp "new_device" + switch_board_qsfp_lpmode "disable" +elif [[ "$1" == "deinit" ]]; then + switch_board_sfp "delete_device" + switch_board_cpld "delete_device" + switch_board_mux "delete_device" + sys_eeprom "delete_device" + switch_board_qsfp "delete_device" + switch_board_qsfp_mux "delete_device" + cpu_board_mux "delete_device" + + modprobe -r dell_s6100_lpc + modprobe -r dell_s6100_iom_cpld + modprobe -r i2c-mux-pca954x + modprobe -r i2c-dev +else + echo "s6100_platform : Invalid option !" +fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/sensors b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/sensors new file mode 100755 index 000000000000..030d636a1565 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/sensors @@ -0,0 +1,7 @@ +#!/bin/bash +docker exec -i pmon sensors "$@" + +#To probe sensors not part of lm-sensors +if [ -r /usr/local/bin/platform_sensors.py ]; then + python /usr/local/bin/platform_sensors.py +fi diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/cfg/z9100-modules.conf b/platform/broadcom/sonic-platform-modules-dell/z9100/cfg/z9100-modules.conf new file mode 100644 index 000000000000..66f002a5fc94 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/cfg/z9100-modules.conf @@ -0,0 +1,15 @@ +# /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-dell/z9100/modules/Makefile b/platform/broadcom/sonic-platform-modules-dell/z9100/modules/Makefile new file mode 100644 index 000000000000..46da5beec391 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := dell_mailbox.o dell_z9100_cpld.o + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_z9100_cpld.c b/platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_z9100_cpld.c new file mode 100644 index 000000000000..01c3133354b1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_z9100_cpld.c @@ -0,0 +1,273 @@ + + +/* Includes only 3 things. + * a. QSFP Reset control + * b. LP Mode + * c. Module Presence + */ +#include // included for all kernel modules +#include // included for KERN_INFO +#include // included for __init and __exit macros +#include +#include +#include +#include + + +//iom cpld slave address +#define IOM_CPLD_SLAVE_ADD 0x3e + +//iom cpld ver register +#define IOM_CPLD_SLAVE_VER 0x00 + +//qsfp reset cntrl reg on each iom +#define QSFP_RST_CRTL_REG0 0x10 +#define QSFP_RST_CRTL_REG1 0x11 + +//qsfp lp mode reg on each iom +#define QSFP_LPMODE_REG0 0x12 +#define QSFP_LPMODE_REG1 0x13 + +//qsfp mod presence reg on each iom +#define QSFP_MOD_PRS_REG0 0x16 +#define QSFP_MOD_PRS_REG1 0x17 + + +struct cpld_data { + struct i2c_client *client; + struct mutex update_lock; +}; + + +static void dell_z9100_iom_cpld_add_client(struct i2c_client *client) +{ + struct cpld_data *data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + + if (!data) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + data->client = client; + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); +} + +static void dell_z9100_iom_cpld_remove_client(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + kfree(data); + return ; +} + +int dell_z9100_iom_cpld_read(struct cpld_data *data, u8 reg) +{ + int ret = -EPERM; + u8 high_reg =0x00; + + mutex_lock(&data->update_lock); + + ret = i2c_smbus_write_byte_data(data->client, high_reg,reg); + ret = i2c_smbus_read_byte(data->client); + mutex_unlock(&data->update_lock); + + return ret; +} + +int dell_z9100_iom_cpld_write(struct cpld_data *data,u8 reg, u8 value) +{ + int ret = -EIO; + u16 devdata=0; + u8 high_reg =0x00; + + mutex_lock(&data->update_lock); + devdata = (value << 8) | reg; + i2c_smbus_write_word_data(data->client,high_reg,devdata); + mutex_unlock(&data->update_lock); + + return ret; +} +static ssize_t get_cpldver(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u8 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,IOM_CPLD_SLAVE_VER); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u8)ret & 0xff; + return sprintf(buf,"IOM CPLD Version:0x%02x\n",devdata); +} + +static ssize_t get_modprs(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_MOD_PRS_REG0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_z9100_iom_cpld_read(data,QSFP_MOD_PRS_REG1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_LPMODE_REG0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_z9100_iom_cpld_read(data,QSFP_LPMODE_REG1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_RST_CRTL_REG0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_z9100_iom_cpld_read(data,QSFP_RST_CRTL_REG1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct cpld_data *data = dev_get_drvdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + dell_z9100_iom_cpld_write(data,QSFP_LPMODE_REG0,(u8)(devdata & 0xff)); + dell_z9100_iom_cpld_write(data,QSFP_LPMODE_REG1,(u8)((devdata >> 8) & 0xff)); + + return count; +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct cpld_data *data = dev_get_drvdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + dell_z9100_iom_cpld_write(data,QSFP_RST_CRTL_REG0,(u8)(devdata & 0xff)); + dell_z9100_iom_cpld_write(data,QSFP_RST_CRTL_REG1,(u8)((devdata >> 8) & 0xff)); + + return count; +} + +static DEVICE_ATTR(iom_cpld_vers,S_IRUGO,get_cpldver, NULL); +static DEVICE_ATTR(qsfp_modprs, S_IRUGO,get_modprs, NULL); +static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR,get_lpmode,set_lpmode); +static DEVICE_ATTR(qsfp_reset, S_IRUGO | S_IWUSR,get_reset, set_reset); + +static struct attribute *i2c_cpld_attrs[] = { + &dev_attr_qsfp_lpmode.attr, + &dev_attr_qsfp_reset.attr, + &dev_attr_qsfp_modprs.attr, + &dev_attr_iom_cpld_vers.attr, + NULL, +}; + +static struct attribute_group i2c_cpld_attr_grp = { + .attrs = i2c_cpld_attrs, +}; + +static int dell_z9100_iom_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + dev_info(&client->dev, "chip found- New\n"); + dell_z9100_iom_cpld_add_client(client); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &i2c_cpld_attr_grp); + if (status) { + printk(KERN_INFO "Cannot create sysfs\n"); + } + return 0; + +exit: + return status; +} + +static int dell_z9100_iom_cpld_remove(struct i2c_client *client) +{ + dell_z9100_iom_cpld_remove_client(client); + return 0; +} + + +static const struct i2c_device_id dell_z9100_iom_cpld_id[] = { + { "dell_z9100_iom_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, dell_z9100_iom_cpld_id); + +static struct i2c_driver dell_z9100_iom_cpld_driver = { + .driver = { + .name = "dell_z9100_iom_cpld", + }, + .probe = dell_z9100_iom_cpld_probe, + .remove = dell_z9100_iom_cpld_remove, + .id_table = dell_z9100_iom_cpld_id, +}; + + + +static int __init dell_z9100_iom_cpld_init(void) +{ + return i2c_add_driver(&dell_z9100_iom_cpld_driver); +} + +static void __exit dell_z9100_iom_cpld_exit(void) +{ + i2c_del_driver(&dell_z9100_iom_cpld_driver); +} + +MODULE_AUTHOR("Srideep Devireddy "); +MODULE_DESCRIPTION("dell_z9100_iom_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(dell_z9100_iom_cpld_init); +module_exit(dell_z9100_iom_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/check_qsfp.sh b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/check_qsfp.sh new file mode 100755 index 000000000000..38f62013e46b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/check_qsfp.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +#Usage: +# check_qsfp.sh qsfp10 +# check_qsfp.sh sffp2 + +# There are 34 optics ports. 32 QSFP28, 2 SFP+ +# QSFP28 is orgainized is 3 banks +# CPLD-2 QSFP-1-12 +# CPLD-3 QSFP-13-22 +# CPLD-4 QSFP-23-32 +# SFF+ 2 ports on CPLD-4 + +optics=$1 +cpld_addr="003e" + +if [ `expr match $optics qsfp` -ne 0 ] +then + type=qsfp + id=${optics:4} + + if [ $id -le 0 -o $id -gt 32 ] + then + echo "Invalid QSFP id" + return -1 + fi + if [ $id -le 12 ] + then + #cpld=2 + cpld_bus=15 + elif [ $id -le 22 ] + then + #cpld=3 + cpld_bus=16 + else + #cpld=4 + cpld_bus=17 + fi + + if [ $id -le 8 ] + then + let qsfp_bus=42+$id + elif [ $id -le 16 ] + then + let qsfp_bus=34+${id}-8 + elif [ $id -le 24 ] + then + let qsfp_bus=26+${id}-16 + else + let qsfp_bus=18+${id}-24 + fi +else + type=sff + id=${optics:3} + cpld=4 +fi + +echo "Preence:`cat /sys/class/i2c-dev/i2c-${cpld_bus}/device/${cpld_bus}-${cpld_addr}/qsfp_modprs`" +echo "Hexdump:" +cat /sys/bus/i2c/devices/${qsfp_bus}-0050/eeprom | hexdump -C diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/platform_sensors.py new file mode 100755 index 000000000000..763e65772282 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/platform_sensors.py @@ -0,0 +1,324 @@ +#!/usr/bin/python +# +# On Z9100, the Platform Management Controller runs the +# thermal algorithm. It provides a mailbox for the Host +# to query relevant thermals. The dell_mailbox module +# provides the sysfs support for the following objects: +# * onboard temperature sensors +# * FAN trays +# * PSU + +import os +import sys +import logging + +Z9100_MAX_FAN_TRAYS = 5 +Z9100_MAX_PSUS = 2 +S6100_MAX_IOMS = 4 + +MAILBOX_DIR = "/sys/devices/platform/SMF.512/hwmon/hwmon1" + +# Get a mailbox register + + +def get_pmc_register(reg_name): + retval = 'ERR' + mb_reg_file = MAILBOX_DIR+'/'+reg_name + + if (not os.path.isfile(mb_reg_file)): + print mb_reg_file, 'not found !' + return retval + + try: + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", mb_reg_file, "file !") + + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + return retval + +logging.basicConfig(level=logging.DEBUG) + +if (os.path.isdir(MAILBOX_DIR)): + print 'dell-s6100-lpc' + print 'Adapter: S6100 Platform Management Controller' +else: + logging.error('S6100 Platform Management Controller module not loaded !') + # sys.exit(0) + +# Print the information for temperature sensors + + +def print_temperature_sensors(): + print("\nOnboard Temperature Sensors:") + print ' CPU: ',\ + int(get_pmc_register('temp1_input'))/1000, 'C' + print ' BCM56960 (PSU side): ',\ + int(get_pmc_register('temp2_input'))/1000, 'C' + print ' System Outlet 1 (switch board): ',\ + int(get_pmc_register('temp3_input'))/1000, 'C' + print ' BCM56960 (IO side): ',\ + int(get_pmc_register('temp4_input'))/1000, 'C' + print ' System Outlet 2 (CPU board): ',\ + int(get_pmc_register('temp9_input'))/1000, 'C' + print ' System Inlet Left (IO side): ',\ + int(get_pmc_register('temp6_input'))/1000, 'C' + +print_temperature_sensors() + + +# Print the information for voltage sensors + + +def print_voltage_sensors(): + print("\nOnboard Voltage Sensors:") + + print ' CPU XP3R3V_EARLY ',\ + float(get_pmc_register('in1_input'))/1000, 'V' + print '\n CPU XP5R0V_CP ',\ + float(get_pmc_register('in2_input'))/1000, 'V' + print ' CPU XP3R3V_STD ',\ + float(get_pmc_register('in3_input'))/1000, 'V' + print ' CPU XP3R3V_CP ',\ + float(get_pmc_register('in4_input'))/1000, 'V' + print ' CPU XP0R75V_VTT_A ',\ + float(get_pmc_register('in5_input'))/1000, 'V' + print ' CPU XPPR75V_VTT_B ',\ + float(get_pmc_register('in6_input'))/1000, 'V' + print ' CPU XP1R07V_CPU ',\ + float(get_pmc_register('in7_input'))/1000, 'V' + print ' CPU XP1R0V_CPU ',\ + float(get_pmc_register('in8_input'))/1000, 'V' + print ' CPU XP12R0V ',\ + float(get_pmc_register('in9_input'))/1000, 'V' + print ' CPU VDDR_CPU_2 ',\ + float(get_pmc_register('in10_input'))/1000, 'V' + print ' CPU VDDR_CPU_1 ',\ + float(get_pmc_register('in11_input'))/1000, 'V' + print ' CPU XP1R5V_CLK ',\ + float(get_pmc_register('in12_input'))/1000, 'V' + print ' CPU XP1R8V_CPU ',\ + float(get_pmc_register('in13_input'))/1000, 'V' + print ' CPU XP1R0V_CPU_VNN ',\ + float(get_pmc_register('in14_input'))/1000, 'V' + print ' CPU XP1R0V_CPU_VCC ',\ + float(get_pmc_register('in15_input'))/1000, 'V' + print ' CPU XP1R5V_EARLY ',\ + float(get_pmc_register('in16_input'))/1000, 'V' + print ' SW XP3R3V_MON ',\ + float(get_pmc_register('in17_input'))/1000, 'V' + print ' SW XP1R8V_MON ',\ + float(get_pmc_register('in19_input'))/1000, 'V' + print ' SW XP1R2V_MON ',\ + float(get_pmc_register('in20_input'))/1000, 'V' + print ' SW XP1R0V_SW_MON ',\ + float(get_pmc_register('in21_input'))/1000, 'V' + print ' SW XP1R0V_ROV_SW_MON ',\ + float(get_pmc_register('in22_input'))/1000, 'V' + print ' SW XR1R0V_BCM84752_MON ',\ + float(get_pmc_register('in23_input'))/1000, 'V' + print ' SW XP5V_MB_MON ',\ + float(get_pmc_register('in24_input'))/1000, 'V' + print ' SW XP1R8V_FPGA_MON ',\ + float(get_pmc_register('in25_input'))/1000, 'V' + print ' SW XP3R3V_FPGA_MON ',\ + float(get_pmc_register('in26_input'))/1000, 'V' + print ' SW XP3R3V_EARLY_MON ',\ + float(get_pmc_register('in27_input'))/1000, 'V' + print ' SW XP1R0V_ ',\ + float(get_pmc_register('curr21_input'))/10000, 'A' + print ' SW XP1R0V_ROV ',\ + float(get_pmc_register('curr22_input'))/10000, 'A' + + + +print_voltage_sensors() + +# Print the information for 1 Fan Tray + + +def print_fan_tray(tray): + + Fan_Status = ['Normal', 'Abnormal'] + Airflow_Direction = ['B2F', 'F2B'] + + print ' Fan Tray ' + str(tray) + ':' + + if (tray == 1): + fan1_speed = get_pmc_register('fan1_input') + fan2_speed = get_pmc_register('fan2_input') + air_flow_reg = int(get_pmc_register('fan1_airflow'), 16) + fan1_status = 0 if fan1_speed >= 1000 else 1 + fan2_status = 0 if fan2_speed >= 1000 else 1 + + print ' Fan1 Speed: ', fan1_speed, 'RPM' + print ' Fan2 Speed: ', fan2_speed, 'RPM' + print ' Fan1 State: ', Fan_Status[fan1_status] + print ' Fan2 State: ', Fan_Status[fan2_status] + print ' Air Flow: ', Airflow_Direction[air_flow_reg] + elif (tray == 2): + fan1_speed = get_pmc_register('fan3_input') + fan2_speed = get_pmc_register('fan4_input') + air_flow_reg = int(get_pmc_register('fan3_airflow'), 16) + fan1_status = 0 if fan1_speed >= 1000 else 1 + fan2_status = 0 if fan2_speed >= 1000 else 1 + + print ' Fan1 Speed: ', fan1_speed, 'RPM' + print ' Fan2 Speed: ', fan2_speed, 'RPM' + print ' Fan1 State: ', Fan_Status[fan1_status] + print ' Fan2 State: ', Fan_Status[fan2_status] + print ' Air Flow: ', Airflow_Direction[air_flow_reg] + elif (tray == 3): + fan1_speed = get_pmc_register('fan5_input') + fan2_speed = get_pmc_register('fan6_input') + air_flow_reg = int(get_pmc_register('fan5_airflow'), 16) + fan1_status = 0 if fan1_speed >= 1000 else 1 + fan2_status = 0 if fan2_speed >= 1000 else 1 + + print ' Fan1 Speed: ', fan1_speed, 'RPM' + print ' Fan2 Speed: ', fan2_speed, 'RPM' + print ' Fan1 State: ', Fan_Status[fan1_status] + print ' Fan2 State: ', Fan_Status[fan2_status] + print ' Air Flow: ', Airflow_Direction[air_flow_reg] + elif (tray == 4): + fan1_speed = get_pmc_register('fan7_input') + fan2_speed = get_pmc_register('fan8_input') + air_flow_reg = int(get_pmc_register('fan7_airflow'), 16) + fan1_status = 0 if fan1_speed >= 1000 else 1 + fan2_status = 0 if fan2_speed >= 1000 else 1 + + print ' Fan1 Speed: ', fan1_speed, 'RPM' + print ' Fan2 Speed: ', fan2_speed, 'RPM' + print ' Fan1 State: ', Fan_Status[fan1_status] + print ' Fan2 State: ', Fan_Status[fan2_status] + print ' Air Flow: ', Airflow_Direction[air_flow_reg] + elif (tray == 5): + fan1_speed = get_pmc_register('fan9_input') + fan2_speed = get_pmc_register('fan10_input') + air_flow_reg = int(get_pmc_register('fan9_airflow'), 16) + fan1_status = 0 if fan1_speed >= 1000 else 1 + fan2_status = 0 if fan2_speed >= 1000 else 1 + + print ' Fan1 Speed: ', fan1_speed, 'RPM' + print ' Fan2 Speed: ', fan2_speed, 'RPM' + print ' Fan1 State: ', Fan_Status[fan1_status] + print ' Fan2 State: ', Fan_Status[fan2_status] + print ' Air Flow: ', Airflow_Direction[air_flow_reg] + + +print('\nFan Trays:') +fan_tray_presence = get_pmc_register('fan_tray_presence') + +if (fan_tray_presence != 'ERR'): + fan_tray_presence = int(fan_tray_presence, 16) + + for tray in range(0, Z9100_MAX_FAN_TRAYS): + if (fan_tray_presence & (1 << tray)): + print_fan_tray(tray + 1) + else: + print '\n Fan Tray ' + str(tray + 1) + ': Not present' +else: + logging.error('Unable to read FAN presence') + +# Print the information for PSU1, PSU2 + + +def print_psu(psu): + Psu_Type = ['Normal', 'Mismatch'] + Psu_Input_Type = ['AC', 'DC'] + PSU_STATUS_TYPE_BIT = 4 + PSU_STATUS_INPUT_TYPE_BIT = 1 + PSU_FAN_PRESENT_BIT = 2 + PSU_FAN_STATUS_BIT = 1 + PSU_FAN_AIR_FLOW_BIT = 0 + Psu_Fan_Presence = ['Present', 'Absent'] + Psu_Fan_Status = ['Normal', 'Abnormal'] + Psu_Fan_Airflow = ['B2F', 'F2B'] + + + print ' PSU ' + str(psu) + ':' + if (psu == 1): + psu_status = int(get_pmc_register('psu1_presence'), 16) + else: + psu_status = int(get_pmc_register('psu2_presence'), 16) + + psu_input_type = (psu_status & (1 << PSU_STATUS_INPUT_TYPE_BIT)) >>\ + PSU_STATUS_INPUT_TYPE_BIT + psu_type = (psu_status & (1 << PSU_STATUS_TYPE_BIT)) >>\ + PSU_STATUS_TYPE_BIT + + print ' Input: ', Psu_Input_Type[psu_input_type] + print ' Type: ', Psu_Type[psu_type] + + # PSU FAN details + if (psu == 1): + print ' FAN Speed: ', get_pmc_register('fan11_input'), 'RPM' + psu_fan_airflow = int(get_pmc_register('fan11_airflow')) + psu_fan_status = int(get_pmc_register('fan11_alarm')) + psu_fan_present = int(get_pmc_register('fan11_fault')) + input_voltage = float(get_pmc_register('in29_input')) / 1000 + output_voltage = float(get_pmc_register('in30_input')) / 1000 + input_current = float(get_pmc_register('curr601_input')) / 100 + output_current = float(get_pmc_register('curr602_input')) /100 + input_power = float(get_pmc_register('power1_input')) / 1000000 + output_power = float(get_pmc_register('power2_input')) / 1000000 + if (input_power != 0): + psu_fan_temp = int(get_pmc_register('temp14_input'))/1000 + else: + print ' FAN Speed: ', get_pmc_register('fan12_input'), 'RPM' + psu_fan_airflow = int(get_pmc_register('fan12_airflow')) + psu_fan_status = int(get_pmc_register('fan12_alarm')) + psu_fan_present = int(get_pmc_register('fan12_fault')) + input_voltage = float(get_pmc_register('in31_input')) / 1000 + output_voltage = float(get_pmc_register('in32_input')) / 1000 + input_current = float(get_pmc_register('curr701_input')) / 100 + output_current = float(get_pmc_register('curr702_input')) / 100 + input_power = float(get_pmc_register('power3_input')) / 1000000 + output_power = float(get_pmc_register('power4_input')) / 1000000 + if (input_power != 0): + psu_fan_temp = int(get_pmc_register('temp15_input'))/1000 + + print ' FAN: ', Psu_Fan_Presence[psu_fan_present] + print ' FAN Status: ', Psu_Fan_Status[psu_fan_status] + print ' FAN AIRFLOW: ', Psu_Fan_Airflow[psu_fan_airflow] + + # PSU input & output monitors + print ' Input Voltage: %6.2f' % (input_voltage), 'V' + + print ' Output Voltage: %6.2f' % (output_voltage), 'V' + + print ' Input Current: %6.2f' % (input_current), 'A' + + print ' Output Current: %6.2f' % (output_current), 'A' + + print ' Input Power: %6.2f' % (input_power), 'W' + + print ' Output Power: %6.2f' % (output_power), 'W' + + # PSU firmware gives spurious temperature reading without input power + if (input_power != 0): + print ' Temperature: ', psu_fan_temp, 'C' + else: + print ' Temperature: ', 'NA' + +print('\nPSUs:') +for psu in range(1, Z9100_MAX_PSUS + 1): + + if (psu == 1): + psu_status = get_pmc_register('psu1_presence') + else: + psu_status = get_pmc_register('psu2_presence') + + if (psu_status != 'ERR'): + psu_status = int(psu_status, 16) + + if (~psu_status & 0b1): + print_psu(psu) + else: + print '\n PSU ', psu, 'Not present' + else: + logging.error('Unable to check PSU presence') + +print '\n Total Power: ', get_pmc_register('current_total_power'), 'W' diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/sensors b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/sensors new file mode 100755 index 000000000000..030d636a1565 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/sensors @@ -0,0 +1,7 @@ +#!/bin/bash +docker exec -i pmon sensors "$@" + +#To probe sensors not part of lm-sensors +if [ -r /usr/local/bin/platform_sensors.py ]; then + python /usr/local/bin/platform_sensors.py +fi diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh new file mode 100755 index 000000000000..3c3fe31e9cbd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh @@ -0,0 +1,170 @@ +#!/bin/bash + +#platform init script for Dell Z9100 + +source dell_i2c_utils.sh + +init_devnum() { + found=0 + for devnum in 0 1; do + devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name` + # iSMT adapter can be at either dffd0000 or dfff0000 + if [[ $devname == 'SMBus iSMT adapter at '* ]]; then + found=1 + break + fi + done + + [[ $found -eq 0 ]] && echo "cannot find iSMT" && exit 1 +} + +# Attach/Detach CPU board mux @ 0x70 +cpu_board_mux() { + case $1 in + "new_device") i2c_config "echo pca9547 0x70 > /sys/bus/i2c/devices/i2c-${devnum}/$1" + ;; + "delete_device") i2c_config "echo 0x70 > /sys/bus/i2c/devices/i2c-${devnum}/$1" + ;; + *) echo "z9100_platform: cpu_board_mux: invalid command !" + ;; + esac +} + +# Attach/Detach switch board MUX to IOM CPLDs @ 0x71 +switch_board_mux() { + case $1 in + "new_device") i2c_config "echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-4/$1" + ;; + "delete_device") i2c_config "echo 0x71 > /sys/bus/i2c/devices/i2c-4/$1" + ;; + *) echo "z9100_platform: switch_board_mux : invalid command !" + ;; + esac +} + +# Attach/Detach syseeprom on CPU board +sys_eeprom() { + case $1 in + "new_device") i2c_config "echo 24c02 0x50 > /sys/bus/i2c/devices/i2c-2/$1" + ;; + "delete_device") i2c_config "echo 0x50 > /sys/bus/i2c/devices/i2c-2/$1" + ;; + *) echo "z9100_platform: sys_eeprom : invalid command !" + ;; + esac +} + +#Attach/Detach cpld devices to drivers for each iom +switch_board_cpld() { + case $1 in + "new_device") + for ((i=14;i<=17;i++)); + do + i2c_config "echo dell_z9100_iom_cpld 0x3e > /sys/bus/i2c/devices/i2c-$i/$1" + done + ;; + "delete_device") + for ((i=14;i<=17;i++)); + do + i2c_config "echo 0x3e > /sys/bus/i2c/devices/i2c-$i/$1" + done + ;; + *) echo "z9100_platform: switch_board_cpld : invalid command !" + ;; + esac +} + +#Attach/Detach the MUX connecting all QSFPs +switch_board_qsfp_mux() { + case $1 in + "new_device") + for ((i=9;i>=6;i--)); + do + # 0x71 mux on the IOM 1 + mux_index=$(expr $i - 5) + echo "Attaching PCA9548 $mux_index" + i2c_config "echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-$i/$1" + done + ;; + "delete_device") + for ((i=9;i>=6;i--)); + do + # 0x71 mux on the IOM 1 + mux_index=$(expr $i - 5) + echo "Detaching PCA9548 $mux_index" + i2c_config "echo 0x71 > /sys/bus/i2c/devices/i2c-$devnum/i2c-$i/$1" + done + ;; + *) echo "z9100_platform: switch_board_qsfp_mux: invalid command !" + ;; + esac +} + +#Attach/Detach the SFP modules on PCA9548_2 +switch_board_sfp() { + case $1 in + "new_device") i2c_config "echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-11/$1" + i2c_config "echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-12/$1" + ;; + "delete_device") i2c_config "echo 0x50 > /sys/bus/i2c/devices/i2c-11/$1" + i2c_config "echo 0x50 > /sys/bus/i2c/devices/i2c-12/$1" + ;; + *) echo "z9100_platform: switch_board_sfp: invalid command !" + ;; + esac +} + +# Attach/Detach 32 instances of EEPROM driver QSFP ports on IO module 1 +#eeprom can dump data using below command +switch_board_qsfp() { + case $1 in + "new_device") + for ((i=18;i<=49;i++)); + do + i2c_config "echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-$i/$1" + done + ;; + "delete_device") + for ((i=18;i<=49;i++)); + do + i2c_config "echo 0x50 > /sys/bus/i2c/devices/i2c-$i/$1" + done + ;; + + *) echo "z9100_platform: switch_board_qsfp: invalid command !" + ;; + esac +} + +init_devnum + +if [[ "$1" == "init" ]]; then + depmod -a + modprobe i2c-dev + modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe dell_mailbox + modprobe dell_z9100_cpld + + cpu_board_mux "new_device" + switch_board_mux "new_device" + sys_eeprom "new_device" + switch_board_cpld "new_device" + switch_board_qsfp_mux "new_device" + switch_board_sfp "new_device" + switch_board_qsfp "new_device" +elif [[ "$1" == "deinit" ]]; then + switch_board_sfp "delete_device" + switch_board_cpld "delete_device" + switch_board_mux "delete_device" + sys_eeprom "delete_device" + switch_board_qsfp "delete_device" + switch_board_qsfp_mux "delete_device" + cpu_board_mux "delete_device" + + modprobe -r dell_z9100_cpld + modprobe -r dell_mailbox + modprobe -r i2c-mux-pca954x + modprobe -r i2c-dev +else + echo "z9100_platform : Invalid option !" +fi diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/cfg/z9264f-modules.conf b/platform/broadcom/sonic-platform-modules-dell/z9264f/cfg/z9264f-modules.conf new file mode 100644 index 000000000000..959ac8290642 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/cfg/z9264f-modules.conf @@ -0,0 +1,19 @@ +# /etc/modules: kernel modules to load at boot time. +# +# This file contains the names of kernel modules that should be loaded +# at boot time, one per line. Lines beginning with "#" are ignored. + +i2c-i801 +i2c-isch +i2c-ismt +i2c-dev +i2c-mux +i2c-smbus + +i2c-mux-gpio +i2c-mux-pca954x + +ipmi_devintf +ipmi_si +dell_z9264f_fpga_ocores +i2c_ocores diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/Makefile b/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/Makefile new file mode 100644 index 000000000000..a162f0d34bfc --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := dell_z9264f_fpga_ocores.o + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c b/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c new file mode 100644 index 000000000000..35ea1f812e9e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c @@ -0,0 +1,1418 @@ + /* + * Copyright (C) 2018 Joyce Yu + * + * Licensed under the GNU General Public License Version 2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +/** + * @file fpga_ocores.c + * @brief This is a driver to interface with Linux Open Cores driver for FPGA i2c access + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include //siginfo +#include //rcu_read_lock +#include //kernel_version +#include +#include +#include +#include +#include + + +void __iomem * fpga_base_addr = NULL; + +#define DRIVER_NAME "fpgapci" +#define PCI_NUM_BARS 4 + +/* Maximum size of driver buffer (allocated with kalloc()). + * Needed to copy data from user to kernel space, among other + * things. */ +static const size_t BUF_SIZE = PAGE_SIZE; + +/* Device data used by this driver. */ +struct fpgapci_dev { + /* the kernel pci device data structure */ + struct pci_dev *pci_dev; + + /* upstream root node */ + struct pci_dev *upstream; + + /* kernels virtual addr. for the mapped BARs */ + void * __iomem bar[PCI_NUM_BARS]; + + /* length of each memory region. Used for error checking. */ + size_t bar_length[PCI_NUM_BARS]; + + /* Debug data */ + /* number of hw interrupts handled. */ + int num_handled_interrupts; + int num_undelivered_signals; + int pci_gen; + int pci_num_lanes; + + unsigned int irq_first; + unsigned int irq_length; + unsigned int irq_assigned; + +}; + +static int use_irq = 0; +module_param(use_irq, int, 0644); +MODULE_PARM_DESC(use_irq, "Get an use_irq value from user...\n"); + + +/* Xilinx FPGA PCIE info: */ +/* Non-VGA unclassified device: Xilinx Corporation Device 7021*/ +/* Subsystem: Xilinx Corporation Device 0007 */ +//#define VENDOR 0x10EE +#define DEVICE 0x7021 +static phys_addr_t fpga_phys_addr; + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + + +/* struct to hold data related to the pcie device */ +struct pci_data_struct{ + struct pci_dev* dev; + unsigned long long phy_addr_bar0; + unsigned long long phy_len_bar0; + unsigned long long phy_flags_bar0; + unsigned int irq_first; + unsigned int irq_length; + unsigned int irq_assigned; + void * kvirt_addr_bar0; +}; + + +/* Static function declarations */ +static int fpgapci_probe(struct pci_dev *dev, const struct pci_device_id *id); +static void fpgapci_remove(struct pci_dev *dev); + +static int scan_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev); +static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev); +static void free_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev); + + +//#define kernel_debug + +struct ocores_i2c { + void __iomem *base; + u32 reg_shift; + u32 reg_io_width; + wait_queue_head_t wait; + //struct i2c_adapter adap; + struct i2c_msg *msg; + int pos; + int nmsgs; + int state; /* see STATE_ */ + //struct clk *clk; + int ip_clock_khz; + int bus_clock_khz; + void (*setreg)(struct ocores_i2c *i2c, int reg, u8 value); + u8 (*getreg)(struct ocores_i2c *i2c, int reg); + u32 timeout; + struct mutex lock; +}; +/* registers */ +#define OCI2C_PRELOW 0 +#define OCI2C_PREHIGH 1 +#define OCI2C_CONTROL 2 +#define OCI2C_DATA 3 +#define OCI2C_CMD 4 /* write only */ +#define OCI2C_STATUS 4 /* read only, same address as OCI2C_CMD */ +#define OCI2C_VER 5 + + + +#define OCI2C_CTRL_IEN 0x40 +#define OCI2C_CTRL_EN 0x80 + +#define OCI2C_CMD_START 0x91 +#define OCI2C_CMD_STOP 0x41 +#define OCI2C_CMD_READ 0x21 +#define OCI2C_CMD_WRITE 0x11 +#define OCI2C_CMD_READ_ACK 0x21 +#define OCI2C_CMD_READ_NACK 0x29 +#define OCI2C_CMD_IACK 0x01 + +#define OCI2C_STAT_IF 0x01 +#define OCI2C_STAT_TIP 0x02 +#define OCI2C_STAT_ARBLOST 0x20 +#define OCI2C_STAT_BUSY 0x40 +#define OCI2C_STAT_NACK 0x80 + +/* SR[7:0] - Status register */ +#define OCI2C_SR_RXACK (1 << 7) /* Receive acknowledge from slave ‘1Â’ = No acknowledge received*/ +#define OCI2C_SR_BUSY (1 << 6) /* Busy, I2C bus busy (as defined by start / stop bits) */ +#define OCI2C_SR_AL (1 << 5) /* Arbitration lost - core lost arbitration */ +#define OCI2C_SR_TIP (1 << 1) /* Transfer in progress */ +#define OCI2C_SR_IF (1 << 0) /* Interrupt flag */ + +#if 0 +#define STATE_DONE 0 +#define STATE_START 1 +#define STATE_WRITE 2 +#define STATE_READ 3 +#define STATE_ERROR 4 +#else +enum { + STATE_DONE = 0, + STATE_INIT, + STATE_ADDR, + STATE_ADDR10, + STATE_START, + STATE_WRITE, + STATE_READ, + STATE_ERROR, +}; +#endif + +#define TYPE_OCORES 0 +#define TYPE_GRLIB 1 + +/*I2C_CH1 Offset address from PCIE BAR 0*/ +#define OCORES_I2C_BASE 0x00006000 +#define OCORES_CH_OFFSET 0x10 + +#define i2c_bus_controller_numb 1 +#define I2C_PCI_MAX_BUS (16) +#define CLS_I2C_CLOCK_LEGACY 0 +#define CLS_I2C_CLOCK_PRESERVE (~0U) + +static struct ocores_i2c opencores_i2c[I2C_PCI_MAX_BUS]; +static struct i2c_adapter i2c_pci_adap[I2C_PCI_MAX_BUS]; +static struct mutex i2c_xfer_lock[I2C_PCI_MAX_BUS]; + +static void oc_setreg_8(struct ocores_i2c *i2c, int reg, u8 value) +{ + iowrite8(value, i2c->base + (reg << i2c->reg_shift)); +} + +static void oc_setreg_16(struct ocores_i2c *i2c, int reg, u8 value) +{ + iowrite16(value, i2c->base + (reg << i2c->reg_shift)); +} + +static void oc_setreg_32(struct ocores_i2c *i2c, int reg, u8 value) +{ + iowrite32(value, i2c->base + (reg << i2c->reg_shift)); +} + +static void oc_setreg_16be(struct ocores_i2c *i2c, int reg, u8 value) +{ + iowrite16be(value, i2c->base + (reg << i2c->reg_shift)); +} + +static void oc_setreg_32be(struct ocores_i2c *i2c, int reg, u8 value) +{ + iowrite32be(value, i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 oc_getreg_8(struct ocores_i2c *i2c, int reg) +{ + return ioread8(i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 oc_getreg_16(struct ocores_i2c *i2c, int reg) +{ + return ioread16(i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 oc_getreg_32(struct ocores_i2c *i2c, int reg) +{ + return ioread32(i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 oc_getreg_16be(struct ocores_i2c *i2c, int reg) +{ + return ioread16be(i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 oc_getreg_32be(struct ocores_i2c *i2c, int reg) +{ + return ioread32be(i2c->base + (reg << i2c->reg_shift)); +} + +static inline void oc_setreg(struct ocores_i2c *i2c, int reg, u8 value) +{ + i2c->setreg(i2c, reg, value); +} + +static inline u8 oc_getreg(struct ocores_i2c *i2c, int reg) +{ + return i2c->getreg(i2c, reg); +} + + +static void ocores_dump(struct ocores_i2c *i2c) +//static void __maybe_unused ocores_dump(struct ocores_i2c *i2c) +{ + u8 tmp; + + printk(KERN_DEBUG "Opencores register dump:\n"); + + tmp = oc_getreg(i2c, OCI2C_PRELOW); + printk(KERN_DEBUG "OCI2C_PRELOW (%d) = 0x%x\n",OCI2C_PRELOW,tmp); + + tmp = oc_getreg(i2c, OCI2C_PREHIGH); + printk(KERN_DEBUG "OCI2C_PREHIGH(%d) = 0x%x\n",OCI2C_PREHIGH,tmp); + + tmp = oc_getreg(i2c, OCI2C_CONTROL); + printk(KERN_DEBUG "OCI2C_CONTROL(%d) = 0x%x\n",OCI2C_CONTROL,tmp); + + tmp = oc_getreg(i2c, OCI2C_DATA); + printk(KERN_DEBUG "OCI2C_DATA (%d) = 0x%x\n",OCI2C_DATA,tmp); + + tmp = oc_getreg(i2c, OCI2C_CMD); + printk(KERN_DEBUG "OCI2C_CMD (%d) = 0x%x\n",OCI2C_CMD,tmp); +} + +static void ocores_stop(struct ocores_i2c *i2c) +{ + //unsigned long time_out = jiffies + msecs_to_jiffies(i2c->timeout); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); +} + +/* + * dell_get_mutex must be called prior to calling this function. + */ +static int ocores_poll(struct ocores_i2c *i2c) +{ + u8 stat = oc_getreg(i2c, OCI2C_STATUS); + struct i2c_msg *msg = i2c->msg; + u8 addr; + + /* Ready? */ + if (stat & OCI2C_STAT_TIP) + return -EBUSY; + + if (i2c->state == STATE_DONE || i2c->state == STATE_ERROR) { + /* Stop has been sent */ + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_IACK); + if (i2c->state == STATE_ERROR) + return -EIO; + return 0; + } + + /* Error? */ + if (stat & OCI2C_STAT_ARBLOST) { + i2c->state = STATE_ERROR; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + return -EAGAIN; + } + + if (i2c->state == STATE_INIT) { + if (stat & OCI2C_STAT_BUSY) + return -EBUSY; + + i2c->state = STATE_ADDR; + } + + if (i2c->state == STATE_ADDR) { + /* 10 bit address? */ + if (i2c->msg->flags & I2C_M_TEN) { + addr = 0xf0 | ((i2c->msg->addr >> 7) & 0x6); + i2c->state = STATE_ADDR10; + } else { + addr = (i2c->msg->addr << 1); + i2c->state = STATE_START; + } + + /* Set read bit if necessary */ + addr |= (i2c->msg->flags & I2C_M_RD) ? 1 : 0; + + oc_setreg(i2c, OCI2C_DATA, addr); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_START); + + return 0; + } + + /* Second part of 10 bit addressing */ + if (i2c->state == STATE_ADDR10) { + oc_setreg(i2c, OCI2C_DATA, i2c->msg->addr & 0xff); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_WRITE); + + i2c->state = STATE_START; + return 0; + } + + if (i2c->state == STATE_START || i2c->state == STATE_WRITE) { + i2c->state = (msg->flags & I2C_M_RD) ? STATE_READ : STATE_WRITE; + + if (stat & OCI2C_STAT_NACK) { + i2c->state = STATE_ERROR; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + return -ENXIO; + } + } else { + msg->buf[i2c->pos++] = oc_getreg(i2c, OCI2C_DATA); + } + + if (i2c->pos >= msg->len) { + i2c->nmsgs--; + i2c->msg++; + i2c->pos = 0; + msg = i2c->msg; + + if (i2c->nmsgs) { + if (!(msg->flags & I2C_M_NOSTART)) { + i2c->state = STATE_ADDR; + return 0; + } else { + i2c->state = (msg->flags & I2C_M_RD) + ? STATE_READ : STATE_WRITE; + } + } else { + i2c->state = STATE_DONE; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + return 0; + } + } + + if (i2c->state == STATE_READ) { + oc_setreg(i2c, OCI2C_CMD, i2c->pos == (msg->len - 1) ? + OCI2C_CMD_READ_NACK : OCI2C_CMD_READ_ACK); + } else { + oc_setreg(i2c, OCI2C_DATA, msg->buf[i2c->pos++]); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_WRITE); + } + + return 0; +} + +static void ocores_process(struct ocores_i2c *i2c) +{ + struct i2c_msg *msg = i2c->msg; + u8 stat = oc_getreg(i2c, OCI2C_STATUS); + //unsigned long timeout = jiffies + msecs_to_jiffies(1000); + + printk(KERN_DEBUG "ocores_process in. status reg :0x%x\n", stat); + if ((i2c->state == STATE_DONE) || (i2c->state == STATE_ERROR)) { + /* stop has been sent */ + printk(KERN_DEBUG "ocores_process OCI2C_CMD_IACK stat = 0x%x Set OCI2C_CMD(0%x) OCI2C_CMD_IACK = 0x%x\n",stat, OCI2C_CMD, OCI2C_CMD_IACK); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_IACK); + wake_up(&i2c->wait); + return; + } + + /* error? */ + if (stat & OCI2C_STAT_ARBLOST) { + i2c->state = STATE_ERROR; + printk(KERN_DEBUG "ocores_process OCI2C_STAT_ARBLOST OCI2C_CMD_STOP\n"); + ocores_stop(i2c); + return; + } + + if ((i2c->state == STATE_START) || (i2c->state == STATE_WRITE)) { + i2c->state = + (msg->flags & I2C_M_RD) ? STATE_READ : STATE_WRITE; + printk(KERN_DEBUG "ocores_process i2c->state =%d\n",i2c->state); + + if (stat & OCI2C_STAT_NACK) { + i2c->state = STATE_ERROR; + printk(KERN_DEBUG "ocores_process OCI2C_STAT_NACK OCI2C_CMD_STOP\n"); + ocores_stop(i2c);//oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + return; + } + } else + { + msg->buf[i2c->pos++] = oc_getreg(i2c, OCI2C_DATA); + printk(KERN_DEBUG "ocores_process oc_getreg OCI2C_DATA(0x%x) msg->buf[%d] = 0x%x\n",OCI2C_DATA, i2c->pos, msg->buf[i2c->pos]); + } + + /* end of msg? */ + if (i2c->pos == msg->len) { + i2c->nmsgs--; + i2c->msg++; + i2c->pos = 0; + msg = i2c->msg; + + if (i2c->nmsgs) { /* end? */ + /* send start? */ + if (!(msg->flags & I2C_M_NOSTART)) { + //addr = i2c_8bit_addr_from_msg(msg); + u8 addr = (msg->addr << 1); + + if (msg->flags & I2C_M_RD) + addr |= 1; + + i2c->state = STATE_START; + printk(KERN_DEBUG "Set OCI2C_CMD(0%x) addr = 0x%x\n",OCI2C_CMD, addr); + oc_setreg(i2c, OCI2C_DATA, addr); + printk(KERN_DEBUG "Set OCI2C_CMD(0%x) OCI2C_CMD_START = 0x%x\n",OCI2C_CMD, OCI2C_CMD_START); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_START); + return; + } else + { + i2c->state = (msg->flags & I2C_M_RD) + ? STATE_READ : STATE_WRITE; + printk(KERN_DEBUG "ocores_process end i2c->state =%d\n",i2c->state); + } + } else { + i2c->state = STATE_DONE; + printk(KERN_DEBUG "ocores_process end i2c->state = STATE_DONE ocores_stop\n"); + ocores_stop(i2c);//oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + return; + } + } + + if (i2c->state == STATE_READ) { + printk(KERN_DEBUG "ocores_poll STATE_READ i2c->pos=%d msg->len-1 = 0x%x set OCI2C_CMD = 0x%x\n",i2c->pos, msg->len-1, + i2c->pos == (msg->len-1) ? OCI2C_CMD_READ_NACK : OCI2C_CMD_READ_ACK); + oc_setreg(i2c, OCI2C_CMD, i2c->pos == (msg->len-1) ? + OCI2C_CMD_READ_NACK : OCI2C_CMD_READ_ACK); + } else { + printk(KERN_DEBUG "ocores_process set OCI2C_DATA(0x%x)\n",OCI2C_DATA); + oc_setreg(i2c, OCI2C_DATA, msg->buf[i2c->pos++]); + printk(KERN_DEBUG "ocores_process set OCI2C_CMD(0x%x) OCI2C_CMD_WRITE = 0x%x\n",OCI2C_CMD, OCI2C_CMD_WRITE); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_WRITE); + } +} + +static irqreturn_t ocores_isr(int irq, void *dev_id) +{ + struct ocores_i2c *i2c = dev_id; + ocores_process(i2c); + + return IRQ_HANDLED; +} +void dell_get_mutex(struct ocores_i2c *i2c) +{ + mutex_lock(&i2c->lock); +} + +/** + * dell_release_mutex - release mutex + */ +void dell_release_mutex(struct ocores_i2c *i2c) +{ + mutex_unlock(&i2c->lock); +} + +static int ocores_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) +{ + struct ocores_i2c *i2c = i2c_get_adapdata(adap); + unsigned long orig_jiffies; + int ret; + unsigned long timeout = jiffies + msecs_to_jiffies(1000); + //printk("%s(), line:%d\n", __func__, __LINE__); + + i2c->msg = msgs; + i2c->pos = 0; + i2c->nmsgs = num; + i2c->state = (use_irq == 1) ? STATE_START : STATE_INIT; + + //printk(KERN_DEBUG "i2c->msg->addr = 0x%x i2c->msg->flags = 0x%x\n",i2c->msg->addr,i2c->msg->flags); + //printk(KERN_DEBUG "I2C_M_RD = 0x%x i2c->msg->addr << 1 = 0x%x\n",I2C_M_RD,i2c->msg->addr << 1); + + //ocores_dump(i2c); + if (!use_irq) { + /* Handle the transfer */ + while (time_before(jiffies, timeout)) { + dell_get_mutex(i2c); + ret = ocores_poll(i2c); + dell_release_mutex(i2c); + + if (i2c->state == STATE_DONE || i2c->state == STATE_ERROR) + return (i2c->state == STATE_DONE) ? num : ret; + + if (ret == 0) + timeout = jiffies + HZ; + + usleep_range(5, 15); + } + + i2c->state = STATE_ERROR; + + return -ETIMEDOUT; + + + } else { + printk(KERN_DEBUG "Set OCI2C_DATA(0%x) val = 0x%x\n",OCI2C_DATA, + (i2c->msg->addr << 1) | ((i2c->msg->flags & I2C_M_RD) ? 1:0)); + oc_setreg(i2c, OCI2C_DATA, + (i2c->msg->addr << 1) | + ((i2c->msg->flags & I2C_M_RD) ? 1:0)); + printk(KERN_DEBUG "Set OCI2C_CMD(0%x) val = 0x%x\n",OCI2C_CMD, OCI2C_CMD_START); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_START); + + /* Interrupt mode */ + if (wait_event_timeout(i2c->wait, (i2c->state == STATE_ERROR) || + (i2c->state == STATE_DONE), HZ)) + return (i2c->state == STATE_DONE) ? num : -EIO; + else + return -ETIMEDOUT; + } +} + +static int ocores_init(struct ocores_i2c *i2c) +{ + int prescale; + int diff; + u8 ctrl; + + if (i2c->reg_io_width == 0) + i2c->reg_io_width = 1; /* Set to default value */ + + if (!i2c->setreg || !i2c->getreg) { + bool be = 0; //1:big_endian 0:little_endian + + switch (i2c->reg_io_width) { + case 1: + i2c->setreg = oc_setreg_8; + i2c->getreg = oc_getreg_8; + break; + + case 2: + i2c->setreg = be ? oc_setreg_16be : oc_setreg_16; + i2c->getreg = be ? oc_getreg_16be : oc_getreg_16; + break; + + case 4: + i2c->setreg = be ? oc_setreg_32be : oc_setreg_32; + i2c->getreg = be ? oc_getreg_32be : oc_getreg_32; + break; + + default: + printk(KERN_ERR "Unsupported I/O width (%d)\n", + i2c->reg_io_width); + return -EINVAL; + } + } + + ctrl = oc_getreg(i2c, OCI2C_CONTROL); + printk(KERN_DEBUG "%s(), line:%d\n", __func__, __LINE__); + printk(KERN_DEBUG "i2c->base = 0x%p\n",i2c->base); + + printk(KERN_DEBUG "ctrl = 0x%x\n",ctrl); + printk(KERN_DEBUG "set ctrl = 0x%x\n",ctrl & ~(OCI2C_CTRL_EN|OCI2C_CTRL_IEN)); + + /* make sure the device is disabled */ + oc_setreg(i2c, OCI2C_CONTROL, ctrl & ~(OCI2C_CTRL_EN|OCI2C_CTRL_IEN)); + + /* + * I²C Frequency depends on host clock + * input clock of 100MHz + * prescale to 100MHz / ( 5*100kHz) -1 = 199 = 0x4F 100000/(5*100)-1=199=0xc7 + */ + printk(KERN_DEBUG "calculate prescale\n"); + prescale = (i2c->ip_clock_khz / (5 * i2c->bus_clock_khz)) - 1; + printk(KERN_DEBUG "calculate prescale = 0x%x\n",prescale); + prescale = clamp(prescale, 0, 0xffff); + printk(KERN_DEBUG "calculate clamp prescale = 0x%x\n",prescale); + + diff = i2c->ip_clock_khz / (5 * (prescale + 1)) - i2c->bus_clock_khz; + printk(KERN_DEBUG "calculate diff = 0x%x\n",diff); + if (abs(diff) > i2c->bus_clock_khz / 10) { + printk(KERN_ERR "Unsupported clock settings: core: %d KHz, bus: %d KHz\n", + i2c->ip_clock_khz, i2c->bus_clock_khz); + return -EINVAL; + } + + printk(KERN_DEBUG "OCI2C_PRELOW(%d) set = 0x%x\n",OCI2C_PRELOW,prescale & 0xff); + oc_setreg(i2c, OCI2C_PRELOW, prescale & 0xff); + printk(KERN_DEBUG "OCI2C_PRHIGH(%d) set = 0x%x\n",OCI2C_PREHIGH,prescale >> 8); + oc_setreg(i2c, OCI2C_PREHIGH, prescale >> 8); + + printk(KERN_DEBUG "Init the device\n"); + /* Init the device */ + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_IACK); + printk(KERN_DEBUG "OCI2C_CONTROL(0x%x) set: 0x%x\n", OCI2C_CONTROL, ctrl | OCI2C_CTRL_IEN | OCI2C_CTRL_EN); + if (!use_irq) + oc_setreg(i2c, OCI2C_CONTROL, ctrl | OCI2C_CTRL_EN); + else + oc_setreg(i2c, OCI2C_CONTROL, ctrl | OCI2C_CTRL_IEN | OCI2C_CTRL_EN); + + //ocores_dump(i2c); + + /* Initialize interrupt handlers if not already done */ + init_waitqueue_head(&i2c->wait); + + return 0; +} + + +static u32 ocores_func(struct i2c_adapter *adap) +{ + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; +} + +static const struct i2c_algorithm ocores_algorithm = { + .master_xfer = ocores_xfer, + .functionality = ocores_func, +}; + +static int i2c_pci_add_bus (struct i2c_adapter *adap) +{ + int ret = 0; + /* Register new adapter */ + adap->algo = &ocores_algorithm; + ret = i2c_add_numbered_adapter(adap); + return ret; +} + +static int i2c_init_internal_data(void) +{ + int i; + printk(KERN_DEBUG "%s(), line:%d\n", __func__, __LINE__); + + for( i = 0; i < I2C_PCI_MAX_BUS; i++ ) + { + opencores_i2c[i].reg_shift = 0; /* 8 bit registers */ + opencores_i2c[i].reg_io_width = 1; /* 8 bit read/write */ + opencores_i2c[i].timeout = 1000;//1ms + opencores_i2c[i].ip_clock_khz = 100000;/* input clock of 100MHz */ + opencores_i2c[i].bus_clock_khz = 100; + //opencores_i2c[i].base = fpga_base_addr + OCORES_I2C_BASE + i*OCORES_CH_OFFSET; + opencores_i2c[i].base = fpga_base_addr + i*OCORES_CH_OFFSET; + mutex_init(&opencores_i2c[i].lock); + ocores_init(&opencores_i2c[i]); + } + +#if 0 + printk(KERN_DEBUG "FPGA PCIE access test\n"); + writel(0xdeadbeef, fpga_base_addr + 0x04); + printk(KERN_DEBUG "%s(), fpga_base_addr + 0x8000:0x%x\n", __func__, readl(fpga_base_addr + 0x8000)); + printk(KERN_DEBUG "%s(), SCRTCH_REG:0x%x\n", __func__, readl(fpga_base_addr + 0x04)); +#endif + return 0; +} + + +static int i2c_pci_init (void) +{ + int i; + + memset (&i2c_pci_adap, 0, sizeof(i2c_pci_adap)); + memset (&opencores_i2c, 0, sizeof(opencores_i2c)); + for(i=0; i < i2c_bus_controller_numb; i++) + mutex_init(&i2c_xfer_lock[i]); + + /* Initialize driver's itnernal data structures */ + i2c_init_internal_data(); + + for (i = 0 ; i < I2C_PCI_MAX_BUS ; i ++) { + + i2c_pci_adap[i].owner = THIS_MODULE; + i2c_pci_adap[i].class = I2C_CLASS_HWMON | I2C_CLASS_SPD; + + i2c_pci_adap[i].algo_data = &opencores_i2c[i]; + /* /dev/i2c-600 ~ /dev/i2c-600 for Open core I2C channel controller 1-7 */ + i2c_pci_adap[i].nr = i+600; + sprintf( i2c_pci_adap[ i ].name, "i2c-pci-%d", i ); + /* Add the bus via the algorithm code */ + if( i2c_pci_add_bus( &i2c_pci_adap[ i ] ) != 0 ) + { + printk(KERN_ERR "Cannot add bus %d to algorithm layer\n", i ); + return( -ENODEV ); + } + i2c_set_adapdata(&i2c_pci_adap[i], &opencores_i2c[i]); + printk( KERN_DEBUG "Registered bus id: %s\n", kobject_name(&i2c_pci_adap[ i ].dev.kobj)); + } + + return 0; +} + +static void i2c_pci_deinit(void) +{ + int i; + for( i = 0; i < I2C_PCI_MAX_BUS; i++ ){ + i2c_del_adapter(&i2c_pci_adap[i]); + } + +} + +/* Find upstream PCIe root node. + * Used for re-training and disabling AER. */ +static struct pci_dev* find_upstream_dev (struct pci_dev *dev) +{ + struct pci_bus *bus = 0; + struct pci_dev *bridge = 0; + struct pci_dev *cur = 0; + int found_dev = 0; + + bus = dev->bus; + if (bus == 0) { + printk (KERN_DEBUG "Device doesn't have an associated bus!\n"); + return 0; + } + + bridge = bus->self; + if (bridge == 0) { + printk (KERN_DEBUG "Can't get the bridge for the bus!\n"); + return 0; + } + + printk (KERN_DEBUG "Upstream device %x/%x, bus:slot.func %02x:%02x.%02x\n", + bridge->vendor, bridge->device, + bridge->bus->number, PCI_SLOT(bridge->devfn), PCI_FUNC(bridge->devfn)); + + printk (KERN_DEBUG "List of downstream devices:"); + list_for_each_entry (cur, &bus->devices, bus_list) { + if (cur != 0) { + printk (KERN_DEBUG " %x/%x", cur->vendor, cur->device); + if (cur == dev) { + found_dev = 1; + } + } + } + printk (KERN_DEBUG "\n"); + if (found_dev) { + return bridge; + } else { + printk (KERN_DEBUG "Couldn't find upstream device!\n"); + return 0; + } +} + + +static int scan_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) +{ + int i; + + for (i = 0; i < PCI_NUM_BARS; i++) { + unsigned long bar_start = pci_resource_start(dev, i); + if (bar_start) { + unsigned long bar_end = pci_resource_end(dev, i); + unsigned long bar_flags = pci_resource_flags(dev, i); + printk (KERN_DEBUG "BAR[%d] 0x%08lx-0x%08lx flags 0x%08lx", + i, bar_start, bar_end, bar_flags); + } + } + + return 0; +} + + +/** + * Map the device memory regions into kernel virtual address space + * after verifying their sizes respect the minimum sizes needed, given + * by the bar_min_len[] array. + */ +static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) +{ + int i; + + for (i = 0; i < PCI_NUM_BARS; i++){ + phys_addr_t bar_start = pci_resource_start(dev, i); + phys_addr_t bar_end = pci_resource_end(dev, i); + unsigned long bar_length = bar_end - bar_start + 1; + fpgapci->bar_length[i] = bar_length; + + + if (!bar_start || !bar_end) { + fpgapci->bar_length[i] = 0; + continue; + } + + if (bar_length < 1) { + printk ( "BAR #%d length is less than 1 byte\n", i); + continue; + } + + //printk ( "bar_start=%llx, bar_end=%llx, bar_length=%lx, flag=%lx\n", bar_start, + // bar_end, bar_length, pci_resource_flags(dev, i)); + + /* map the device memory or IO region into kernel virtual + * address space */ + fpgapci->bar[i] = ioremap_nocache (bar_start + OCORES_I2C_BASE, I2C_PCI_MAX_BUS * OCORES_CH_OFFSET); + if (!fpgapci->bar[i]) { + printk ( "Could not map BAR #%d.\n", i); + return -1; + } + + //printk ( "BAR[%d] mapped at 0x%p with length %lu.", i, + // fpgapci->bar[i], bar_length); + + if(i == 0) //FPGA register is in the BAR[0] + { + fpga_phys_addr = bar_start; + fpga_base_addr = fpgapci->bar[i]; + } + + printk (KERN_DEBUG "BAR[%d] mapped at 0x%p with length %lu.\n", i, + fpgapci->bar[i], bar_length); + } + return 0; +} + +static void free_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) +{ + int i; + + for (i = 0; i < PCI_NUM_BARS; i++) { + if (fpgapci->bar[i]) { + pci_iounmap(dev, fpgapci->bar[i]); + fpgapci->bar[i] = NULL; + } + } +} + +#define FPGA_PCI_NAME "FPGA_PCI" + +/** + * @brief Register specific function with msi interrupt line + * @param dev Pointer to pci-device, which should be allocated + * @param int interrupt number relative to global interrupt number + * @return Returns error code or zero if success + * */ +static int register_intr_handler(struct pci_dev *dev, int c) +{ + int err = 0; + struct fpgapci_dev *fpgapci = 0; + + fpgapci = (struct fpgapci_dev*) dev_get_drvdata(&dev->dev); + if (fpgapci == 0) { + printk (KERN_ERR ": fpgapci_dev is 0\n"); + return err; + } + + + /* Request interrupt line for unique function + * alternatively function will be called from free_irq as well with flag IRQF_SHARED */ + switch(c) { + /*Currently we only support test vector 2 for Open core I2C channel controller 1-7 interrupt*/ + case 0: + err = request_irq(dev->irq + c, ocores_isr, IRQF_EARLY_RESUME, FPGA_PCI_NAME, &opencores_i2c[0]); + fpgapci->irq_assigned++; + printk(KERN_DEBUG "Interrupt Line %d assigned with return value %d\n", dev->irq + c, err); + break; + + default: + printk(KERN_DEBUG "No more interrupt handler for number (%d)\n", dev->irq + c); + break; + } + return err; +} +/* Mask for MSI Multi message enable bits */ +#define MSI_MME 0x70 +/** + * These enums define the type of interrupt scheme that the overall + * system uses. + */ +enum fpga_irq_type { + INT_MSI_SINGLE, + INT_MSI_MULTI, + INT_MSIX, + INT_NONE, + INT_FENCE /* Last item to guard from loop run-overs */ +}; +/** + * @def PCI_DEVICE_STATUS + * define the offset for STS register + * from the start of PCI config space as specified in the + * NVME_Comliance 1.0b. offset 06h:STS - Device status. + * This register has error status for NVME PCI Exress + * Card. After reading data from this reagister, the driver + * will identify if any error is set during the operation and + * report as kernel alert message. + */ +#define PCI_DEVICE_STATUS 0x6 +/** + * @def NEXT_MASK + * This indicates the location of the next capability item + * in the list. + */ +#define NEXT_MASK 0xFF00 +/** + * @def MSIXCAP_ID + * This bit indicates if the pointer leading to this position + * is a capability. + */ +#define MSIXCAP_ID 0x11 +/** + * @def MSICAP_ID + * This bit indicates if the pointer leading to this position + * is a capability. + */ +#define MSICAP_ID 0x5 + +/** + * @def CL_MASK + * This bit position indicates Capabilities List of the controller + * The controller should support the PCI Power Management cap as a + * minimum. + */ +#define CL_MASK 0x0010 + +/** + * @def CAP_REG + * Set to offset defined in NVME Spec 1.0b. + */ +#define CAP_REG 0x34 +static void msi_set_enable(struct pci_dev *dev, int enable) +{ + int pos,maxvec; + u16 control; + int request_private_bits = 4; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + printk(KERN_DEBUG "pos = 0x%x\n", pos); + if (pos) { + pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); + maxvec = 1 << ((control & PCI_MSI_FLAGS_QMASK) >> 1); + printk(KERN_DEBUG "control = 0x%x maxvec = 0x%x\n", control, maxvec); + control &= ~PCI_MSI_FLAGS_ENABLE; +#if 0 + if (enable) + control |= PCI_MSI_FLAGS_ENABLE; +#else + /* + * The PCI 2.3 spec mandates that there are at most 32 + * interrupts. If this device asks for more, only give it one. + */ + if (request_private_bits > 5) { + request_private_bits = 0; + } + + /* Update the number of IRQs the device has available to it */ + control &= ~PCI_MSI_FLAGS_QSIZE; + control |= (request_private_bits << 4); +#endif + + pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); + } +} +static void msi_setup_enable(struct pci_dev *dev, int request_private_bits) +{ + int pos,maxvec; + u16 control; + int configured_private_bits = 4; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + + /* + * Read the MSI config to figure out how many IRQs this device + * wants. Most devices only want 1, which will give + * configured_private_bits and request_private_bits equal 0. + */ + pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); + + /* + * If the number of private bits has been configured then use + * that value instead of the requested number. This gives the + * driver the chance to override the number of interrupts + * before calling pci_enable_msi(). + */ + configured_private_bits = (control & PCI_MSI_FLAGS_QSIZE) >> 4; + if (configured_private_bits == 0) { + /* Nothing is configured, so use the hardware requested size */ + request_private_bits = (control & PCI_MSI_FLAGS_QMASK) >> 1; + } + else { + /* + * Use the number of configured bits, assuming the + * driver wanted to override the hardware request + * value. + */ + request_private_bits = configured_private_bits; + } + + /* + * The PCI 2.3 spec mandates that there are at most 32 + * interrupts. If this device asks for more, only give it one. + */ + if (request_private_bits > 5) { + request_private_bits = 0; + } + + /* Update the number of IRQs the device has available to it */ + control &= ~PCI_MSI_FLAGS_QSIZE; + control |= (request_private_bits << 4); + pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); +} +/** + * @brief Enables pcie-device and claims/remaps neccessary bar resources + * @param dev Pointer to pci-device, which should be allocated + * @return Returns error code or zero if success + * */ +static int claim_device(struct fpgapci_dev *fpgapci,struct pci_dev *dev) +{ + int err = 0; + u16 msi_offset; + u16 mc_val; + + /* wake up the pci device */ + err = pci_enable_device(dev); + if(err) { + printk(KERN_ERR "failed to enable pci device %d\n", err); + goto error_pci_en; + } + + /* on platforms with buggy ACPI, pdev->msi_enabled may be set to + * allow pci_enable_device to work. This indicates INTx was not routed + * and only MSI should be used + */ + + //dev->msi_enabled = 0; + pci_set_master(dev); + + /* Setup the BAR memory regions */ + err = pci_request_regions(dev, DRIVER_NAME); + if (err) { + printk(KERN_ERR "failed to enable pci device %d\n", err); + goto error_pci_req; + } + + scan_bars(fpgapci, dev); + + if (map_bars(fpgapci, dev)) { + goto fail_map_bars; + } + + i2c_pci_init(); + + return 0; + /* ERROR HANDLING */ +fail_map_bars: + pci_release_regions(dev); +error_pci_req: + pci_disable_device(dev); +error_pci_en: + return -ENODEV; +} +/** + * @brief Configures pcie-device and bit_mask settings + * @param dev Pointer to pci-device, which should be allocated + * @return Returns error code or zero if success + * */ +static int configure_device(struct pci_dev *dev) +{ + return 0; +} + + +/* + * Check if the controller supports the interrupt type requested. If it + * supports returns the offset, otherwise it will return invalid for the + * caller to indicate that the controller does not support the capability + * type. + */ +int check_cntlr_cap(struct pci_dev *dev, enum fpga_irq_type cap_type, + u16 *offset) +{ + u16 val = 0; + u16 pci_offset = 0; + int ret_val = -EINVAL; + + if (pci_read_config_word(dev, PCI_DEVICE_STATUS, &val) < 0) { + printk(KERN_ERR "pci_read_config failed...\n"); + return -EINVAL; + } + printk(KERN_DEBUG "PCI_DEVICE_STATUS = 0x%X\n", val); + if (!(val & CL_MASK)) { + printk(KERN_ERR "Controller does not support Capability list...\n"); + return -EINVAL; + } else { + if (pci_read_config_word(dev, CAP_REG, &pci_offset) < 0) { + printk(KERN_ERR "pci_read_config failed...\n"); + return -EINVAL; + } + } + printk(KERN_DEBUG "pci_offset = 0x%x\n", pci_offset); + /* Interrupt Type MSI-X*/ + if (cap_type == INT_MSIX) { + /* Loop through Capability list */ + while (pci_offset) {//0x40 + if (pci_read_config_word(dev, pci_offset, &val) < 0) { + printk(KERN_ERR "pci_read_config failed...\n"); + return -EINVAL; + } + /* exit when we find MSIX_capbility offset */ + if ((val & ~NEXT_MASK) == MSIXCAP_ID) { + /* write msix cap offset */ + *offset = pci_offset; + ret_val = 1; + /* break from while loop */ + break; + } + /* Next Capability offset. */ + pci_offset = (val & NEXT_MASK) >> 8; + } /* end of while loop */ + + } else if (cap_type == INT_MSI_SINGLE || cap_type == INT_MSI_MULTI) { + /* Loop through Capability list */ + while (pci_offset) {//0x40 + if (pci_read_config_word(dev, pci_offset, &val) < 0) { + printk(KERN_ERR "pci_read_config failed...\n"); + return -EINVAL; + } + printk(KERN_DEBUG "val = 0x%x ~NEXT_MASK= 0x%x val & ~NEXT_MASK = 0x%x\n", val,~NEXT_MASK, val & ~NEXT_MASK); + /* exit when we find MSIX_capbility offset */ + if ((val & ~NEXT_MASK) == MSICAP_ID) { + /* write the msi offset */ + *offset = pci_offset; + ret_val = 1; + printk(KERN_DEBUG "*offset = 0x%x\n", *offset); + /* break from while loop */ + break; + } + /* Next Capability offset. */ + pci_offset = (val & NEXT_MASK) >> 8; + printk(KERN_DEBUG "Next Capability offset pci_offset = 0x%x\n", pci_offset); + } /* end of while loop */ + + } else { + printk(KERN_DEBUG "Invalid capability type specified...\n"); + ret_val = -EINVAL; + } + + return ret_val; +} + +static int claim_msi(struct fpgapci_dev *fpgapci,struct pci_dev *dev) +{ + int err = 0, i; + int nvec, request_vec; + u16 msi_offset; + u16 mc_val; + + /* set up MSI interrupt vector to max size */ + nvec = pci_msi_vec_count(dev); + printk(KERN_DEBUG "Have %d MSI vectors\n", nvec); +#if 0 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))// || defined(WITH_BACKPORTS) + err = pci_enable_msi_range(dev, nvec, nvec); +#else + err = pci_enable_msi_block(dev, nvec + 1); +#endif +#endif + printk(KERN_DEBUG "Check MSI capability\n"); + /* Check if the card Supports MSI capability */ + if (check_cntlr_cap(dev, INT_MSI_MULTI, &msi_offset) < 0) { + printk(KERN_ERR "Controller does not support for MSI capability!!\n"); + return -EINVAL; + } + /* compute MSI MC offset if MSI is supported */ + printk(KERN_DEBUG "check_cntlr_cap return msi_offset = 0x%x\n", msi_offset); + msi_offset += 2; + printk(KERN_DEBUG "msi_offset = 0x%x\n", msi_offset); + /* Read MSI-MC value */ + pci_read_config_word(dev, msi_offset, &mc_val); + printk(KERN_DEBUG "read msi_offset(0x%x) mc_val = 0x%x\n", msi_offset, mc_val); + printk(KERN_DEBUG "(1 << ((mc_val & MSI_MME) >> 4)) = 0x%x\n",(1 << ((mc_val & MSI_MME) >> 4))); + if (nvec > (1 << ((mc_val & MSI_MME) >> 4))) { // power 2 + printk(KERN_DEBUG "IRQs = %d exceed MSI MME = %d\n", nvec, + (1 << ((mc_val & MSI_MME) >> 4))); + /* does not support the requested irq's*/ + } + msi_set_enable(dev,1); + printk(KERN_DEBUG "Check MSI capability after msi_set_enable\n"); + + /* Check if the card Supports MSI capability */ + if (check_cntlr_cap(dev, INT_MSI_MULTI, &msi_offset) < 0) { + printk(KERN_DEBUG "Controller does not support for MSI capability!!\n"); + return -EINVAL; + } + /* compute MSI MC offset if MSI is supported */ + printk(KERN_DEBUG "check_cntlr_cap return msi_offset = 0x%x\n", msi_offset); + msi_offset += 2; + printk(KERN_DEBUG "msi_offset = 0x%x\n", msi_offset); + /* Read MSI-MC value */ + pci_read_config_word(dev, msi_offset, &mc_val); + printk(KERN_DEBUG "read msi_offset(0x%x) mc_val = 0x%x\n", msi_offset, mc_val); + + printk(KERN_DEBUG "(1 << ((mc_val & MSI_MME) >> 4)) = 0x%x\n",(1 << ((mc_val & MSI_MME) >> 4))); + if (nvec > (1 << ((mc_val & MSI_MME) >> 4))) { // power 2 + printk(KERN_DEBUG "IRQs = %d exceed MSI MME = %d\n", nvec, + (1 << ((mc_val & MSI_MME) >> 4))); + /* does not support the requested irq's*/ + } + + /*Above 4.1.12*/ +#if 1 + request_vec = 1; + err = pci_alloc_irq_vectors(dev, request_vec, pci_msi_vec_count(dev), + PCI_IRQ_MSI);//PCI_IRQ_AFFINITY | PCI_IRQ_MSI); +#endif + + if (err <= 0) { + printk(KERN_ERR "Cannot set MSI vector (%d)\n", err); + goto error_no_msi; + } else { + printk(KERN_ERR "Got %d MSI vectors starting at %d\n", err, dev->irq); + } + fpgapci->irq_first = dev->irq; + fpgapci->irq_length = err; + fpgapci->irq_assigned = 0; + + + for(i = 0; i < fpgapci->irq_length; i++) { + err = register_intr_handler(dev, i); + if (err) { + printk(KERN_ERR "Cannot request Interrupt number %d\n", i); + goto error_pci_req_irq; + } + } + + return 0; + +error_pci_req_irq: + //for(i = i-1; i >= 0; i--) + free_irq(fpgapci->irq_first + 0, &opencores_i2c[0]); + pci_disable_msi(fpgapci->pci_dev); +error_no_msi: + return -ENOSPC; +} + +static int fpgapci_probe(struct pci_dev *dev, const struct pci_device_id *id) +{ + struct fpgapci_dev *fpgapci = 0; + + printk (KERN_DEBUG " vendor = 0x%x, device = 0x%x, class = 0x%x, bus:slot.func = %02x:%02x.%02x\n", + dev->vendor, dev->device, dev->class, + dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); + + fpgapci = kzalloc(sizeof(struct fpgapci_dev), GFP_KERNEL); + + if (!fpgapci) { + printk(KERN_ERR "Couldn't allocate memory!\n"); + goto fail_kzalloc; + } + + fpgapci->pci_dev = dev; + dev_set_drvdata(&dev->dev, (void*)fpgapci); + + fpgapci->upstream = find_upstream_dev (dev); + + if(claim_device(fpgapci,dev)) { + goto error_no_device; + } + + if(configure_device(dev)) { + goto error_cannot_configure; + } + if (use_irq) { + if(claim_msi(fpgapci,dev)) { + goto error_cannot_configure; + } + } + + + return 0; + /* ERROR HANDLING */ +error_cannot_configure: + printk(KERN_ERR "error_cannot_configure\n"); + free_bars (fpgapci, dev); + pci_release_regions(dev); + pci_disable_device(dev); +error_no_device: + i2c_pci_deinit(); + printk(KERN_ERR "error_no_device\n"); +fail_kzalloc: + return -1; +} + +static void fpgapci_remove(struct pci_dev *dev) +{ + struct fpgapci_dev *fpgapci = 0; + //int i; + printk (KERN_DEBUG ": dev is %p\n", dev); + + if (dev == 0) { + printk (KERN_ERR ": dev is 0\n"); + return; + } + + fpgapci = (struct fpgapci_dev*) dev_get_drvdata(&dev->dev); + if (fpgapci == 0) { + printk (KERN_ERR ": fpgapci_dev is 0\n"); + return; + } + i2c_pci_deinit(); + if (use_irq) + free_irq(fpgapci->irq_first + 0, &opencores_i2c[0]); + pci_disable_msi(fpgapci->pci_dev); + free_bars (fpgapci, dev); + pci_disable_device(dev); + pci_release_regions(dev); + + kfree (fpgapci); +} + +static const struct pci_device_id fpgapci_ids[] = { + {PCI_DEVICE(PCI_VENDOR_ID_XILINX, DEVICE)}, + {0, }, +}; + +MODULE_DEVICE_TABLE(pci, fpgapci_ids); + +static struct pci_driver fpgapci_driver = { + .name = DRIVER_NAME, + .id_table = fpgapci_ids, + .probe = fpgapci_probe, + .remove = fpgapci_remove, + /* resume, suspend are optional */ +}; + +/* Initialize the driver module (but not any device) and register + * the module with the kernel PCI subsystem. */ +static int __init fpgapci_init(void) +{ + + if (pci_register_driver(&fpgapci_driver)) { + printk(KERN_DEBUG "pci_unregister_driver\n"); + pci_unregister_driver(&fpgapci_driver); + return -ENODEV; + } + + return 0; +} + +static void __exit fpgapci_exit(void) +{ + printk (KERN_DEBUG "fpgapci_exit"); + /* unregister this driver from the PCI bus driver */ + pci_unregister_driver(&fpgapci_driver); + +} + + +module_init (fpgapci_init); +module_exit (fpgapci_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Joyce_Yu@Dell.com"); +MODULE_DESCRIPTION ("Driver for FPGA Opencores I2C bus"); +MODULE_SUPPORTED_DEVICE ("FPGA Opencores I2C bus"); + + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/check_qsfp.sh b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/check_qsfp.sh new file mode 100755 index 000000000000..7e7f1636a186 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/check_qsfp.sh @@ -0,0 +1,3 @@ +# Temporary dummy file for z9264f. +# Will be updated soon. + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/pcisysfs.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/pcisysfs.py new file mode 100755 index 000000000000..047618e057c8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/pcisysfs.py @@ -0,0 +1,102 @@ +#!/usr/bin/python +# Copyright (c) 2015 Dell Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT +# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS +# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +# +# See the Apache Version 2.0 License for specific language governing +# permissions and limitations under the License. + +import struct +import sys +import getopt +from os import * +from mmap import * + +def usage(): + ''' This is the Usage Method ''' + + print '\t\t pcisysfs.py --get --offset --res ' + print '\t\t pcisysfs.py --set --val --offset --res ' + sys.exit(1) + +def pci_mem_read(mm,offset): + mm.seek(offset) + read_data_stream=mm.read(4) + print "" + reg_val=struct.unpack('I',read_data_stream) + print "reg_val read:%x"%reg_val + return reg_val + +def pci_mem_write(mm,offset,data): + mm.seek(offset) + print "data to write:%x"%data + mm.write(struct.pack('I',data)) + +def pci_set_value(resource,val,offset): + fd=open(resource,O_RDWR) + mm=mmap(fd,0) + pci_mem_write(mm,offset,val) + +def pci_get_value(resource,offset): + fd=open(resource,O_RDWR) + mm=mmap(fd,0) + pci_mem_read(mm,offset) + +def main(argv): + + ''' The main function will read the user input from the + command line argument and process the request ''' + + opts = '' + val = '' + choice = '' + resource = '' + offset = '' + + try: + opts, args = getopt.getopt(argv, "hgsv:" , \ + ["val=","res=","offset=","help", "get", "set"]) + + except getopt.GetoptError: + usage() + + for opt,arg in opts: + + if opt in ('-h','--help'): + choice = 'help' + + elif opt in ('-g', '--get'): + choice = 'get' + + elif opt in ('-s', '--set'): + choice = 'set' + + elif opt == '--res': + resource = arg + + elif opt == '--val': + val = int(arg,16) + + elif opt == '--offset': + offset = int(arg,16) + + if choice == 'set' and val != '' and offset !='' and resource !='': + pci_set_value(resource,val,offset) + + elif choice == 'get' and offset != '' and resource !='': + pci_get_value(resource,offset) + + else: + usage() + +#Calling the main method +if __name__ == "__main__": + main(sys.argv[1:]) + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/platform_sensors.py new file mode 100755 index 000000000000..c16aee1d4b8c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/platform_sensors.py @@ -0,0 +1,251 @@ +#!/usr/bin/python +# On Z9264f, the BaseBoard Management Controller is an +# autonomous subsystem provides monitoring and management +# facility independent of the host CPU. IPMI standard +# protocol is used with ipmitool to fetch sensor details. +# Current script support X00 board only. X01 support will +# be added soon. This provies support for the +# following objects: +# * Onboard temperature sensors +# * FAN trays +# * PSU + + +import os +import sys +import logging +import subprocess +import commands + +Z9264F_MAX_FAN_TRAYS = 4 +Z9264F_MAX_PSUS = 2 +IPMI_SENSOR_DATA = "ipmitool sdr list" +IPMI_SENSOR_DUMP = "/tmp/sdr" + +FAN_PRESENCE = "FAN{0}_prsnt" +PSU_PRESENCE = "PSU{0}_state" +# Use this for older firmware +# PSU_PRESENCE="PSU{0}_prsnt" + +ipmi_sdr_list = "" + +# Dump sensor registers + + +def ipmi_sensor_dump(): + + status = 1 + global ipmi_sdr_list + ipmi_cmd = IPMI_SENSOR_DATA + status, ipmi_sdr_list = commands.getstatusoutput(ipmi_cmd) + + if status: + logging.error('Failed to execute:' + ipmi_sdr_list) + sys.exit(0) + +# Fetch a BMC register + + +def get_pmc_register(reg_name): + + for item in ipmi_sdr_list.split("\n"): + if reg_name in item: + output = item.strip() + + if not output: + print('\nFailed to fetch: ' + reg_name + ' sensor ') + sys.exit(0) + + output = output.split('|')[1] + + logging.basicConfig(level=logging.DEBUG) + return output + + +# Print the information for temperature sensors + + +def print_temperature_sensors(): + + print("\nOnboard Temperature Sensors:") + + print ' PT_Left_temp: ',\ + (get_pmc_register('PT_Left_temp')) + print ' PT_Mid_temp: ',\ + (get_pmc_register('PT_Mid_temp')) + print ' PT_Right_temp: ',\ + (get_pmc_register('PT_Right_temp')) + print ' Broadcom Temp: ',\ + (get_pmc_register('TC_Near_temp')) + print ' Inlet Airflow Temp: ',\ + (get_pmc_register('ILET_AF_temp')) + print ' CPU Temp: ',\ + (get_pmc_register('CPU_Near_temp')) + print ' CPU Near Temp: ',\ + (get_pmc_register('CPU_temp')) + print ' DRAM Temp: ',\ + (get_pmc_register('DRAM1_temp')) + +ipmi_sensor_dump() + +print_temperature_sensors() + +# Print the information for 1 Fan Tray + + +def print_fan_tray(tray): + + Fan_Status = [' Normal', ' Abnormal'] + Airflow_Direction = ['B2F', 'F2B'] + + print ' Fan Tray ' + str(tray) + ':' + + if (tray == 1): + + fan1_status = int(get_pmc_register('Fan1_Front_state'), 16) + fan2_status = int(get_pmc_register('Fan1_Rear_state'), 16) + + print ' Fan1 Speed: ',\ + get_pmc_register('FAN1_Front_rpm') + print ' Fan2 Speed: ',\ + get_pmc_register('FAN1_Rear_rpm') + print ' Fan1 State: ',\ + Fan_Status[fan1_status] + print ' Fan2 State: ',\ + Fan_Status[fan2_status] + + elif (tray == 2): + + fan1_status = int(get_pmc_register('Fan2_Front_state'), 16) + fan2_status = int(get_pmc_register('Fan2_Rear_state'), 16) + + print ' Fan1 Speed: ',\ + get_pmc_register('FAN2_Front_rpm') + print ' Fan2 Speed: ',\ + get_pmc_register('FAN2_Rear_rpm') + print ' Fan1 State: ',\ + Fan_Status[fan1_status] + print ' Fan2 State: ',\ + Fan_Status[fan2_status] + + elif (tray == 3): + + fan1_status = int(get_pmc_register('Fan3_Front_state'), 16) + fan2_status = int(get_pmc_register('Fan3_Rear_state'), 16) + + print ' Fan1 Speed: ',\ + get_pmc_register('FAN3_Front_rpm') + print ' Fan2 Speed: ',\ + get_pmc_register('FAN3_Rear_rpm') + print ' Fan1 State: ',\ + Fan_Status[fan1_status] + print ' Fan2 State: ',\ + Fan_Status[fan2_status] + + elif (tray == 4): + + fan1_status = int(get_pmc_register('Fan4_Front_state'), 16) + fan2_status = int(get_pmc_register('Fan4_Rear_state'), 16) + + print ' Fan1 Speed: ',\ + get_pmc_register('FAN4_Front_rpm') + print ' Fan2 Speed: ',\ + get_pmc_register('FAN4_Rear_rpm') + print ' Fan1 State: ',\ + Fan_Status[fan1_status] + print ' Fan2 State: ',\ + Fan_Status[fan2_status] + + +print('\nFan Trays:') + +for tray in range(1, Z9264F_MAX_FAN_TRAYS + 1): + fan_presence = FAN_PRESENCE.format(tray) + if (get_pmc_register(fan_presence)): + print_fan_tray(tray) + else: + print '\n Fan Tray ' + str(tray + 1) + ': Not present' + + +# Print the information for PSU1, PSU2 +def print_psu(psu): + Psu_Type = ['Normal', 'Mismatch'] + Psu_Input_Type = ['AC', 'DC'] + PSU_STATUS_TYPE_BIT = 4 + PSU_STATUS_INPUT_TYPE_BIT = 1 + PSU_FAN_PRESENT_BIT = 2 + PSU_FAN_STATUS_BIT = 1 + PSU_FAN_AIR_FLOW_BIT = 0 + Psu_Fan_Presence = ['Present', 'Absent'] + Psu_Fan_Status = ['Normal', 'Abnormal'] + Psu_Fan_Airflow = ['B2F', 'F2B'] + + # print ' Input: ', Psu_Input_Type[psu_input_type] + # print ' Type: ', Psu_Type[psu_type] + + # PSU FAN details + if (psu == 1): + + # psu1_fan_status = int(get_pmc_register('PSU1_status'),16) + + print ' PSU1:' + print ' FAN Temperature: ',\ + get_pmc_register('PSU1_temp') + print ' FAN AirFlow Temperature: ',\ + get_pmc_register('PSU1_AF_temp') + print ' FAN RPM: ',\ + get_pmc_register('PSU1_rpm') + # print ' FAN Status: ', Psu_Fan_Status[psu1_fan_status] + + # PSU input & output monitors + print ' Input Voltage: ',\ + get_pmc_register('PSU1_In_volt') + print ' Output Voltage: ',\ + get_pmc_register('PSU1_Out_volt') + print ' Input Power: ',\ + get_pmc_register('PSU1_In_watt') + print ' Output Power: ',\ + get_pmc_register('PSU1_Out_watt') + print ' Input Current: ',\ + get_pmc_register('PSU1_In_amp') + print ' Output Current: ',\ + get_pmc_register('PSU1_Out_amp') + + else: + + # psu2_fan_status = int(get_pmc_register('PSU1_status'),16) + print ' PSU2:' + print ' FAN Temperature: ',\ + get_pmc_register('PSU2_temp') + print ' FAN AirFlow Temperature: ',\ + get_pmc_register('PSU2_AF_temp') + print ' FAN RPM: ',\ + get_pmc_register('PSU2_rpm') + # print ' FAN Status: ', Psu_Fan_Status[psu2_fan_status] + + # PSU input & output monitors + print ' Input Voltage: ',\ + get_pmc_register('PSU2_In_volt') + print ' Output Voltage: ',\ + get_pmc_register('PSU2_Out_volt') + print ' Input Power: ',\ + get_pmc_register('PSU2_In_watt') + print ' Output Power: ',\ + get_pmc_register('PSU2_Out_watt') + print ' Input Current: ',\ + get_pmc_register('PSU2_In_amp') + print ' Output Current: ',\ + get_pmc_register('PSU2_Out_amp') + + +print('\nPSUs:') +for psu in range(1, Z9264F_MAX_PSUS + 1): + psu_presence = PSU_PRESENCE.format(psu) + if (get_pmc_register(psu_presence)): + print_psu(psu) + else: + print '\n PSU ', psu, 'Not present' + +print '\n Total Power: ',\ + get_pmc_register('PSU_Total_watt') + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/sensors b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/sensors new file mode 100755 index 000000000000..ee53f2b0f325 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/sensors @@ -0,0 +1,8 @@ +#!/bin/bash +docker exec -i pmon sensors "$@" +docker exec -i pmon /usr/bin/platform_sensors.py "$@" + +#To probe sensors not part of lm-sensors +#if [ -r /usr/local/bin/platform_sensors.py ]; then +# python /usr/local/bin/platform_sensors.py +#fi diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh new file mode 100755 index 000000000000..a899a53a9ffb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh @@ -0,0 +1,125 @@ +#!/bin/bash + +init_devnum() { + found=0 + for devnum in 0 1; do + devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name` + # iSMT adapter can be at either dffd0000 or dfff0000 + if [[ $devname == 'SMBus iSMT adapter at '* ]]; then + found=1 + break + fi + done + + [ $found -eq 0 ] && echo "cannot find iSMT" && exit 1 +} + +# Attach/Detach syseeprom on CPU board +sys_eeprom() { + case $1 in + "new_device") echo 24c02 0x53 > /sys/bus/i2c/devices/i2c-0/$1 + ;; + "delete_device") echo 0x53 > /sys/bus/i2c/devices/i2c-0/$1 + ;; + *) echo "z9264f_platform: sys_eeprom : invalid command !" + ;; + esac +} + +#Attach/Detach the MUX connecting all QSFPs +switch_board_qsfp_mux() { + case $1 in + "new_device") + for ((i=74;i<=77;i++)); + do + echo "Attaching PCA9548 @ $i" + echo pca9548 0x$i > /sys/bus/i2c/devices/i2c-604/$1 + sleep 2 + done + + for ((i=74;i<=77;i++)); + do + echo "Attaching PCA9548 @ $i" + echo pca9548 0x$i > /sys/bus/i2c/devices/i2c-603/$1 + sleep 2 + done + ;; + "delete_device") + for ((i=74;i<=77;i++)); + do + echo "Detaching PCA9548 @ $i" + echo 0x$i > /sys/bus/i2c/devices/i2c-604/$1 + sleep 2 + done + + for ((i=74;i<=77;i++)); + do + echo "Detaching PCA9548 @ $i" + echo 0x$i > /sys/bus/i2c/devices/i2c-603/$1 + sleep 2 + done + ;; + *) echo "z9264f_platform: switch_board_qsfp_mux: invalid command !" + ;; + esac + sleep 2 +} + +#Attach/Detach 64 instances of EEPROM driver QSFP ports +#eeprom can dump data using below command +switch_board_qsfp() { + case $1 in + "new_device") + for ((i=2;i<=65;i++)); + do + echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-$i/$1 + done + ;; + + "delete_device") + for ((i=2;i<=65;i++)); + do + echo 0x50 > /sys/bus/i2c/devices/i2c-$i/$1 + done + ;; + + *) echo "z9264f_platform: switch_board_qsfp: invalid command !" + ;; + esac +} + +#Modsel 64 ports to applicable QSFP type modules +#This enables the adapter to respond for i2c commands +switch_board_modsel() { + resource="/sys/bus/pci/devices/0000:04:00.0/resource0" + for ((i=1;i<=64;i++)); + do + port_addr=$( 16384 + ((i - 1) * 16)) + hex=$( printf "0x%x" $port_addr ) + python /bin/pcisysfs.py --set --offset $hex --val 0x41 --res $resource > /dev/null 2>&1 + done +} +init_devnum + +if [ "$1" == "init" ]; then + depmod -a + modprobe i2c-dev + modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe i2c_ocores + modprobe dell_z9264f_fpga_ocores + sys_eeprom "new_device" + switch_board_qsfp_mux "new_device" + switch_board_qsfp "new_device" + switch_board_modsel + +elif [ "$1" == "deinit" ]; then + sys_eeprom "delete_device" + switch_board_qsfp "delete_device" + switch_board_qsfp_mux "delete_device" + + modprobe -r i2c-mux-pca954x + modprobe -r i2c-dev +else + echo "z9264f_platform : Invalid option !" +fi + diff --git a/platform/broadcom/sonic-platform-modules-s6000 b/platform/broadcom/sonic-platform-modules-s6000 deleted file mode 160000 index 6c4da534410c..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6c4da534410c037892ad0338d1c930b5b9b1493b diff --git a/platform/broadcom/sonic-platform-modules-s6000/.gitignore b/platform/broadcom/sonic-platform-modules-s6000/.gitignore new file mode 100644 index 000000000000..7f287d538227 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/.gitignore @@ -0,0 +1,50 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# 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 + +# Kernel Module Compile Results +*.mod* +*.cmd +*.o.d +.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-s6000/LICENSE b/platform/broadcom/sonic-platform-modules-s6000/LICENSE new file mode 100644 index 000000000000..676cdeec726b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2016 Microsoft, Inc + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/broadcom/sonic-platform-modules-s6000/MAINTAINERS b/platform/broadcom/sonic-platform-modules-s6000/MAINTAINERS new file mode 100644 index 000000000000..65e3129fcc13 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/MAINTAINERS @@ -0,0 +1,7 @@ +# This file describes the maintainers for sonic-platform-modules-s6000 +# See the SONiC project governance document for more information + +Name = "Shuotian Cheng" +Email = "shuche@microsoft.com" +Github = stcheng +Mailinglist = sonicproject@googlegroups.com diff --git a/platform/broadcom/sonic-platform-modules-s6000/README.md b/platform/broadcom/sonic-platform-modules-s6000/README.md new file mode 100644 index 000000000000..7913d168a30a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/README.md @@ -0,0 +1,2 @@ +# sonic-platform-modules-s6000 +Device drivers for support of Dell S6000 for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/changelog b/platform/broadcom/sonic-platform-modules-s6000/debian/changelog new file mode 100644 index 000000000000..0a6b7820bdeb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/debian/changelog @@ -0,0 +1,5 @@ +platform-modules-s6000 (1.0) unstable; urgency=low + + * Initial release + + -- Shuotian Cheng Mon, 11 Nov 2015 11:11:11 -0800 diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/compat b/platform/broadcom/sonic-platform-modules-s6000/debian/compat new file mode 100644 index 000000000000..45a4fb75db86 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/debian/compat @@ -0,0 +1 @@ +8 diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/control b/platform/broadcom/sonic-platform-modules-s6000/debian/control new file mode 100644 index 000000000000..fbd8529de4e8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/debian/control @@ -0,0 +1,12 @@ +Source: platform-modules-s6000 +Section: main +Priority: extra +Maintainer: Shuotian Cheng +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-s6000 +Architecture: amd64 +Depends: linux-image-4.9.0-5-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/copyright b/platform/broadcom/sonic-platform-modules-s6000/debian/copyright new file mode 100644 index 000000000000..6fbc5a7f6ca0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/debian/copyright @@ -0,0 +1,16 @@ +Provides linux sysfs interface to Dell S6000 platform hardware peripherals +Copyright (C) 2016 Microsoft + +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-s6000/debian/platform-modules-s6000.init b/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.init new file mode 100755 index 000000000000..f16f7e01ef6e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.init @@ -0,0 +1,99 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup S6000 board. +### END INIT INFO + +add_i2c_devices() { + + echo 24c02 0x50 > /sys/class/i2c-adapter/i2c-1/new_device + echo 24c02 0x51 > /sys/class/i2c-adapter/i2c-1/new_device + echo dni_dps460 0x58 > /sys/class/i2c-adapter/i2c-1/new_device + echo dni_dps460 0x59 > /sys/class/i2c-adapter/i2c-1/new_device + echo jc42 0x18 > /sys/class/i2c-adapter/i2c-10/new_device + echo emc1403 0x4d > /sys/class/i2c-adapter/i2c-10/new_device + echo spd 0x50 > /sys/class/i2c-adapter/i2c-10/new_device + echo 24c02 0x53 > /sys/class/i2c-adapter/i2c-10/new_device + echo max6620 0x29 > /sys/class/i2c-adapter/i2c-11/new_device + echo max6620 0x2a > /sys/class/i2c-adapter/i2c-11/new_device + echo ltc4215 0x40 > /sys/class/i2c-adapter/i2c-11/new_device + echo ltc4215 0x42 > /sys/class/i2c-adapter/i2c-11/new_device + echo tmp75 0x4c > /sys/class/i2c-adapter/i2c-11/new_device + echo tmp75 0x4d > /sys/class/i2c-adapter/i2c-11/new_device + echo tmp75 0x4e > /sys/class/i2c-adapter/i2c-11/new_device + echo 24c02 0x51 > /sys/class/i2c-adapter/i2c-11/new_device + echo 24c02 0x52 > /sys/class/i2c-adapter/i2c-11/new_device + echo 24c02 0x53 > /sys/class/i2c-adapter/i2c-11/new_device + for i in `seq 0 31`; do + echo sff8436 0x50 > /sys/class/i2c-adapter/i2c-$((20+i))/new_device + done +} + +remove_i2c_devices() { + echo 0x50 > /sys/class/i2c-adapter/i2c-1/delete_device + echo 0x51 > /sys/class/i2c-adapter/i2c-1/delete_device + echo 0x58 > /sys/class/i2c-adapter/i2c-1/delete_device + echo 0x59 > /sys/class/i2c-adapter/i2c-1/delete_device + echo 0x18 > /sys/class/i2c-adapter/i2c-10/delete_device + echo 0x4d > /sys/class/i2c-adapter/i2c-10/delete_device + echo 0x50 > /sys/class/i2c-adapter/i2c-10/delete_device + echo 0x53 > /sys/class/i2c-adapter/i2c-10/delete_device + echo 0x29 > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x2a > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x40 > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x42 > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x4c > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x4d > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x4e > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x51 > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x52 > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x53 > /sys/class/i2c-adapter/i2c-11/delete_device + for i in `seq 0 31`; do + echo 0x50 > /sys/class/i2c-adapter/i2c-$((20+i))/delete_device + done +} + +case "$1" in +start) + echo -n "Setting up board... " + + depmod -a + modprobe i2c_mux_gpio + modprobe dell_s6000_platform + + add_i2c_devices + + /usr/local/bin/set-fan-speed 15000 + /usr/local/bin/reset-qsfp + + echo "done." + ;; + +stop) + echo "done." + + remove_i2c_devices + + rmmod dell_s6000_platform + rmmod i2c_mux_gpio + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-s6000.init {start|stop}" + exit 1 + ;; +esac + +exit 0 + diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install b/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install new file mode 100644 index 000000000000..a059f39ff3c4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install @@ -0,0 +1 @@ +systemd/platform-modules-s6000.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/rules b/platform/broadcom/sonic-platform-modules-s6000/debian/rules new file mode 100755 index 000000000000..5473743ea38d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/debian/rules @@ -0,0 +1,32 @@ +#!/usr/bin/make -f + +export INSTALL_MOD_DIR:=extra + +PACKAGE_NAME := platform-modules-s6000 +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MODULE_SRC := $(shell pwd)/modules +SCRIPT_SRC := $(shell pwd)/scripts + +%: + dh $@ --with=systemd + +override_dh_auto_build: + make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + +override_dh_auto_install: + dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR) + cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) + dh_installdirs -p$(PACKAGE_NAME) usr/local/bin + cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin + +override_dh_usrlocal: + +override_dh_pysupport: + +override_dh_clean: + dh_clean + rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd + rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order + rm -rf $(MODULE_SRC)/.tmp_versions + diff --git a/platform/broadcom/sonic-platform-modules-s6000/modules/Makefile b/platform/broadcom/sonic-platform-modules-s6000/modules/Makefile new file mode 100644 index 000000000000..12e80d01010c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/modules/Makefile @@ -0,0 +1 @@ +obj-m := dell_s6000_platform.o diff --git a/platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c b/platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c new file mode 100644 index 000000000000..cbd56c579dd2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c @@ -0,0 +1,1222 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define S6000_MUX_BASE_NR 10 +#define QSFP_MODULE_BASE_NR 20 + +/* 74CBTLV3253 Dual 1-of-4 multiplexer/demultiplexer */ +#define MUX_CHANNEL_NUM 2 + +#define CPLD_DEVICE_NUM 3 +#define QSFP_MODULE_NUM 16 +#define QSFP_DEVICE_NUM 2 + + +static void device_release(struct device *dev) +{ + return; +} + +/* + * S6000 74CBTLV3253 MUX + */ +static const unsigned s6000_mux_gpios[] = { + 1, 2 +}; + +static const unsigned s6000_mux_values[] = { + 0, 1, 2, 3 +}; + +static struct i2c_mux_gpio_platform_data s6000_mux_platform_data = { + .parent = 2, + .base_nr = S6000_MUX_BASE_NR, + .values = s6000_mux_values, + .n_values = ARRAY_SIZE(s6000_mux_values), + .gpios = s6000_mux_gpios, + .n_gpios = ARRAY_SIZE(s6000_mux_gpios), + .idle = 0, +}; + +static struct platform_device s6000_mux = { + .name = "i2c-mux-gpio", + .id = 0, + .dev = { + .platform_data = &s6000_mux_platform_data, + .release = device_release + }, +}; + +/* + * S6000 CPLD + */ + +enum cpld_type { + system_cpld, + master_cpld, + slave_cpld, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data s6000_cpld_platform_data[] = { + [system_cpld] = { + .reg_addr = 0x31, + }, + + [master_cpld] = { + .reg_addr = 0x32, + }, + + [slave_cpld] = { + .reg_addr = 0x33, + }, +}; + +static struct platform_device s6000_cpld = { + .name = "dell-s6000-cpld", + .id = 0, + .dev = { + .platform_data = s6000_cpld_platform_data, + .release = device_release + }, +}; + +/* + * S6000 QSFP MUX + */ + +struct qsfp_mux_platform_data { + int parent; + int base_nr; + int reg_addr; + struct i2c_client *cpld; +}; + +struct qsfp_mux { + struct qsfp_mux_platform_data data; +}; + +static struct qsfp_mux_platform_data s6000_qsfp_mux_platform_data[] = { + { + .parent = S6000_MUX_BASE_NR + 2, + .base_nr = QSFP_MODULE_BASE_NR, + .cpld = NULL, + .reg_addr = 0x0, + }, + { + .parent = S6000_MUX_BASE_NR + 3, + .base_nr = QSFP_MODULE_BASE_NR + QSFP_MODULE_NUM, + .cpld = NULL, + .reg_addr = 0xa, + }, +}; + +static struct platform_device s6000_qsfp_mux[] = { + { + .name = "dell-s6000-qsfp-mux", + .id = 0, + .dev = { + .platform_data = &s6000_qsfp_mux_platform_data[0], + .release = device_release, + }, + }, + { + .name = "dell-s6000-qsfp-mux", + .id = 1, + .dev = { + .platform_data = &s6000_qsfp_mux_platform_data[1], + .release = device_release, + }, + }, +}; + +static int cpld_reg_write_byte(struct i2c_client *client, u8 regaddr, u8 val) +{ + union i2c_smbus_data data; + + data.byte = val; + return client->adapter->algo->smbus_xfer(client->adapter, client->addr, + client->flags, + I2C_SMBUS_WRITE, + regaddr, I2C_SMBUS_BYTE_DATA, &data); +} + +static int qsfp_mux_select(struct i2c_mux_core *muxc, u32 chan) +{ + struct qsfp_mux *mux = i2c_mux_priv(muxc); + unsigned short mask = ~(unsigned short)(1 << chan); + + cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(mask & 0xff)); + return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr + 1, (u8)(mask >> 8)); +} + +static int __init qsfp_mux_probe(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc; + struct qsfp_mux *mux; + struct qsfp_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + mux = devm_kzalloc(&pdev->dev, sizeof(*mux), GFP_KERNEL); + if (!mux) { + return -ENOMEM; + } + + mux->data = *pdata; + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -EPROBE_DEFER; + } + + muxc = i2c_mux_alloc(parent, &pdev->dev, QSFP_MODULE_NUM, 0, 0, + qsfp_mux_select, NULL); + if (!muxc) { + ret = -ENOMEM; + goto alloc_failed; + } + muxc->priv = mux; + + platform_set_drvdata(pdev, muxc); + + for (i = 0; i < QSFP_MODULE_NUM; i++) { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + ret = i2c_mux_add_adapter(muxc, nr, i, class); + if (ret) { + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + + dev_info(&pdev->dev, "%d port mux on %s adapter\n", QSFP_MODULE_NUM, parent->name); + + return 0; + +add_adapter_failed: + i2c_mux_del_adapters(muxc); +alloc_failed: + i2c_put_adapter(parent); + + return ret; +} + +static int qsfp_mux_remove(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc = platform_get_drvdata(pdev); + + i2c_mux_del_adapters(muxc); + + i2c_put_adapter(muxc->parent); + + return 0; +} + +static struct platform_driver qsfp_mux_driver = { + .probe = qsfp_mux_probe, + .remove = qsfp_mux_remove, + .driver = { + .owner = THIS_MODULE, + .name = "dell-s6000-qsfp-mux", + }, +}; + +/* TODO */ +/* module_platform_driver */ + +static ssize_t get_modsel(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, 0x0); + if (ret < 0) + return sprintf(buf, "na"); + data = (u32)ret & 0xff; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, 0x1); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0xa); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0xb); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, 0x2); + if (ret < 0) + return sprintf(buf, "na"); + data = (u32)ret & 0xff; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, 0x3); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0xc); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0xd); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[slave_cpld].client, 0x2, (u8)(data & 0xff)); + i2c_smbus_write_byte_data(pdata[slave_cpld].client, 0x3, (u8)((data >> 8) & 0xff)); + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0xc, (u8)((data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0xd, (u8)((data >> 24) & 0xff)); + + return count; +} + +static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, 0x6); + if (ret < 0) + return sprintf(buf, "na"); + data = (u32)ret & 0xff; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, 0x7); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x10); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x11); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[slave_cpld].client, 0x6, (u8)(data & 0xff)); + i2c_smbus_write_byte_data(pdata[slave_cpld].client, 0x7, (u8)((data >> 8)& 0xff)); + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0x10, (u8)((data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0x11, (u8)((data >> 24) & 0xff)); + + return count; +} + +static ssize_t get_modprs(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, 0x4); + if (ret < 0) + return sprintf(buf, "read error"); + data = (u32)ret & 0xff; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, 0x5); + if (ret < 0) + return sprintf(buf, "read error"); + data |= (u32)(ret & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0xe); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0xf); + if (ret < 0) + return sprintf(buf, "na"); + data |= (u32)(ret & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); +} + +static ssize_t set_power_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 10, &data); + if (err) + return err; + + if (data) + { + i2c_smbus_write_byte_data(pdata[system_cpld].client, 0x1, (u8)(0xfd)); + } + + return count; +} + +static ssize_t get_power_reset(struct device *dev, struct device_attribute *devattr, char *buf) +{ + return sprintf(buf, "0\n"); +} + +static ssize_t get_fan_prs(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x8); + if (ret < 0) + return sprintf(buf, "read error"); + data = (u32)((ret & 0xc0) >> 6); + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x9); + if (ret < 0) + return sprintf(buf, "read error"); + data |= (u32)((ret & 0x01) << 2); + data = ~data & 0x7; + + return sprintf(buf, "0x%x\n", data); +} + +static ssize_t get_psu0_prs(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x3); + if (ret < 0) + return sprintf(buf, "read error"); + + if (!(ret & 0x80)) + data = 1; + + return sprintf(buf, "%d\n", data); +} + +static ssize_t get_psu1_prs(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x3); + if (ret < 0) + return sprintf(buf, "read error"); + + if (!(ret & 0x08)) + data = 1; + + return sprintf(buf, "%d\n", data); +} + +static ssize_t get_psu0_status(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x3); + if (ret < 0) + return sprintf(buf, "read error"); + + if (!(ret & 0x40)) + data = 1; + + return sprintf(buf, "%d\n", data); +} + +static ssize_t get_psu1_status(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x3); + if (ret < 0) + return sprintf(buf, "read error"); + + if (!(ret & 0x04)) + data = 1; + + return sprintf(buf, "%d\n", data); +} + +static ssize_t get_system_led(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x7); + if (ret < 0) + return sprintf(buf, "read error"); + + data = (u32)(ret & 0x60) >> 5; + + switch (data) + { + case 0: + ret = sprintf(buf, "blink_green\n"); + break; + case 1: + ret = sprintf(buf, "green\n"); + break; + case 2: + ret = sprintf(buf, "yellow\n"); + break; + default: + ret = sprintf(buf, "blink_yellow\n"); + } + + return ret; +} + +static ssize_t set_system_led(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + if (!strncmp(buf, "blink_green", 11)) + { + data = 0; + } + else if (!strncmp(buf, "green", 5)) + { + data = 1; + } + else if (!strncmp(buf, "yellow", 6)) + { + data = 2; + } + else if (!strncmp(buf, "blink_yellow", 12)) + { + data = 3; + } + else + { + return -1; + } + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x7); + if (ret < 0) + return ret; + + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0x7, (u8)((ret & 0x9F) | (data << 5))); + + return count; +} + +static ssize_t get_locator_led(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x7); + if (ret < 0) + return sprintf(buf, "read error"); + + data = (u32)(ret & 0x18) >> 3; + + switch (data) + { + case 0: + ret = sprintf(buf, "off\n"); + break; + case 1: + ret = sprintf(buf, "blink_blue\n"); + break; + case 2: + ret = sprintf(buf, "blue\n"); + break; + default: + ret = sprintf(buf, "invalid\n"); + } + + return ret; +} + +static ssize_t set_locator_led(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + if (!strncmp(buf, "off", 3)) + { + data = 0; + } + else if (!strncmp(buf, "blink_blue", 10)) + { + data = 1; + } + else if (!strncmp(buf, "blue", 4)) + { + data = 2; + } + else + { + return -1; + } + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x7); + if (ret < 0) + return ret; + + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0x7, (u8)((ret & 0xE7) | (data << 3))); + + return count; +} + +static ssize_t get_power_led(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x7); + if (ret < 0) + return sprintf(buf, "read error"); + + data = (u32)(ret & 0x06) >> 1; + + switch (data) + { + case 0: + ret = sprintf(buf, "off\n"); + break; + case 1: + ret = sprintf(buf, "yellow\n"); + break; + case 2: + ret = sprintf(buf, "green\n"); + break; + default: + ret = sprintf(buf, "blink_yellow\n"); + } + + return ret; +} + +static ssize_t set_power_led(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + if (!strncmp(buf, "off", 3)) + { + data = 0; + } + else if (!strncmp(buf, "yellow", 6)) + { + data = 1; + } + else if (!strncmp(buf, "green", 5)) + { + data = 2; + } + else if (!strncmp(buf, "blink_yellow", 12)) + { + data = 3; + } + else + { + return -1; + } + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x7); + if (ret < 0) + return ret; + + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0x7, (u8)((ret & 0xF9) | (data << 1))); + + return count; +} + +static ssize_t get_master_led(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x7); + if (ret < 0) + return sprintf(buf, "read error"); + + data = (u32)(ret & 0x1); + + switch (data) + { + case 0: + ret = sprintf(buf, "green\n"); + break; + default: + ret = sprintf(buf, "off\n"); + break; + } + + return ret; +} + +static ssize_t set_master_led(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + if (!strncmp(buf, "green", 5)) + { + data = 0; + } + else if (!strncmp(buf, "off", 3)) + { + data = 1; + } + else + { + return -1; + } + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x7); + if (ret < 0) + return ret; + + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0x7, (u8)((ret & 0xFE) | data)); + + return count; +} + +static ssize_t get_fan_led(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x9); + if (ret < 0) + return sprintf(buf, "read error"); + + data = (u32)(ret & 0x18) >> 3; + + switch (data) + { + case 0: + ret = sprintf(buf, "off\n"); + break; + case 1: + ret = sprintf(buf, "yellow\n"); + break; + case 2: + ret = sprintf(buf, "green\n"); + break; + default: + ret = sprintf(buf, "blink_yellow\n"); + } + + return ret; +} + +static ssize_t set_fan_led(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + if (!strncmp(buf, "off", 3)) + { + data = 0; + } + else if (!strncmp(buf, "yellow", 6)) + { + data = 1; + } + else if (!strncmp(buf, "green", 5)) + { + data = 2; + } + else if (!strncmp(buf, "blink_yellow", 12)) + { + data = 3; + } + else + { + return -1; + } + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x9); + if (ret < 0) + return ret; + + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0x9, (u8)((ret & 0xE7) | (data << 3))); + + return count; +} + +static ssize_t get_fan0_led(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x8); + if (ret < 0) + return sprintf(buf, "read error"); + + data = (u32)(ret & 0x3); + + switch (data) + { + case 0: + ret = sprintf(buf, "off\n"); + break; + case 1: + ret = sprintf(buf, "green\n"); + break; + case 2: + ret = sprintf(buf, "yellow\n"); + break; + default: + ret = sprintf(buf, "unknown\n"); + } + + return ret; +} + +static ssize_t set_fan0_led(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + if (!strncmp(buf, "off", 3)) + { + data = 0; + } + else if (!strncmp(buf, "yellow", 6)) + { + data = 2; + } + else if (!strncmp(buf, "green", 5)) + { + data = 1; + } + else + { + return -1; + } + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x8); + if (ret < 0) + return ret; + + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0x8, (u8)((ret & 0xFC) | data)); + + return count; +} + + +static ssize_t get_fan1_led(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x8); + if (ret < 0) + return sprintf(buf, "read error"); + + data = (u32)(ret & 0xc) >> 2; + + switch (data) + { + case 0: + ret = sprintf(buf, "off\n"); + break; + case 1: + ret = sprintf(buf, "green\n"); + break; + case 2: + ret = sprintf(buf, "yellow\n"); + break; + default: + ret = sprintf(buf, "unknown\n"); + } + + return ret; +} + +static ssize_t set_fan1_led(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + if (!strncmp(buf, "off", 3)) + { + data = 0; + } + else if (!strncmp(buf, "yellow", 6)) + { + data = 2; + } + else if (!strncmp(buf, "green", 5)) + { + data = 1; + } + else + { + return -1; + } + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x8); + if (ret < 0) + return ret; + + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0x8, (u8)((ret & 0xF3) | (data << 2))); + + return count; +} + +static ssize_t get_fan2_led(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x8); + if (ret < 0) + return sprintf(buf, "read error"); + + data = (u32)(ret & 0x30) >> 4; + + switch (data) + { + case 0: + ret = sprintf(buf, "off\n"); + break; + case 1: + ret = sprintf(buf, "green\n"); + break; + case 2: + ret = sprintf(buf, "yellow\n"); + break; + default: + ret = sprintf(buf, "unknown\n"); + } + + return ret; +} + +static ssize_t set_fan2_led(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + if (!strncmp(buf, "off", 3)) + { + data = 0; + } + else if (!strncmp(buf, "yellow", 6)) + { + data = 2; + } + else if (!strncmp(buf, "green", 5)) + { + data = 1; + } + else + { + return -1; + } + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x8); + if (ret < 0) + return ret; + + i2c_smbus_write_byte_data(pdata[master_cpld].client, 0x8, (u8)((ret & 0xCF) | (data << 4))); + + return count; +} + +static DEVICE_ATTR(qsfp_modsel, S_IRUGO, get_modsel, NULL); +static DEVICE_ATTR(qsfp_modprs, S_IRUGO, get_modprs, NULL); +static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR, get_lpmode, set_lpmode); +static DEVICE_ATTR(qsfp_reset, S_IRUGO | S_IWUSR, get_reset, set_reset); +static DEVICE_ATTR(power_reset, S_IRUGO | S_IWUSR, get_power_reset, set_power_reset); +static DEVICE_ATTR(fan_prs, S_IRUGO, get_fan_prs, NULL); +static DEVICE_ATTR(psu0_prs, S_IRUGO, get_psu0_prs, NULL); +static DEVICE_ATTR(psu1_prs, S_IRUGO, get_psu1_prs, NULL); +static DEVICE_ATTR(psu0_status, S_IRUGO, get_psu0_status, NULL); +static DEVICE_ATTR(psu1_status, S_IRUGO, get_psu1_status, NULL); +static DEVICE_ATTR(system_led, S_IRUGO | S_IWUSR, get_system_led, set_system_led); +static DEVICE_ATTR(locator_led, S_IRUGO | S_IWUSR, get_locator_led, set_locator_led); +static DEVICE_ATTR(power_led, S_IRUGO | S_IWUSR, get_power_led, set_power_led); +static DEVICE_ATTR(master_led, S_IRUGO | S_IWUSR, get_master_led, set_master_led); +static DEVICE_ATTR(fan_led, S_IRUGO | S_IWUSR, get_fan_led, set_fan_led); +static DEVICE_ATTR(fan0_led, S_IRUGO | S_IWUSR, get_fan0_led, set_fan0_led); +static DEVICE_ATTR(fan1_led, S_IRUGO | S_IWUSR, get_fan1_led, set_fan1_led); +static DEVICE_ATTR(fan2_led, S_IRUGO | S_IWUSR, get_fan2_led, set_fan2_led); + +static struct attribute *s6000_cpld_attrs[] = { + &dev_attr_qsfp_modsel.attr, + &dev_attr_qsfp_lpmode.attr, + &dev_attr_qsfp_reset.attr, + &dev_attr_qsfp_modprs.attr, + &dev_attr_power_reset.attr, + &dev_attr_fan_prs.attr, + &dev_attr_psu0_prs.attr, + &dev_attr_psu1_prs.attr, + &dev_attr_psu0_status.attr, + &dev_attr_psu1_status.attr, + &dev_attr_system_led.attr, + &dev_attr_locator_led.attr, + &dev_attr_power_led.attr, + &dev_attr_master_led.attr, + &dev_attr_fan_led.attr, + &dev_attr_fan0_led.attr, + &dev_attr_fan1_led.attr, + &dev_attr_fan2_led.attr, + NULL, +}; + +static struct attribute_group s6000_cpld_attr_grp = { + .attrs = s6000_cpld_attrs, +}; + +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int i; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(S6000_MUX_BASE_NR); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n", + S6000_MUX_BASE_NR); + return -ENODEV; + } + + for (i = 0; i < CPLD_DEVICE_NUM; i++) { + pdata[i].client = i2c_new_dummy(parent, pdata[i].reg_addr); + if (!pdata[i].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr); + goto error; + } + } + + ret = sysfs_create_group(&pdev->dev.kobj, &s6000_cpld_attr_grp); + if (ret) + goto error; + + return 0; + +error: + i--; + for (; i >= 0; i--) { + if (pdata[i].client) { + i2c_unregister_device(pdata[i].client); + } + } + + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + int i; + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + + sysfs_remove_group(&pdev->dev.kobj, &s6000_cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } else { + for (i = 0; i < CPLD_DEVICE_NUM; i++) { + if (pdata[i].client) { + if (!parent) { + parent = (pdata[i].client)->adapter; + } + i2c_unregister_device(pdata[i].client); + } + } + } + + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "dell-s6000-cpld", + }, +}; + +static int __init dell_s6000_platform_init(void) +{ + int ret = 0; + struct cpld_platform_data *cpld_pdata; + struct qsfp_mux_platform_data *qsfp_pdata; + int i; + + printk("delll_s6000_platform module initialization\n"); + + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpld driver\n"); + goto error_cpld_driver; + } + + ret = platform_driver_register(&qsfp_mux_driver); + if (ret) { + printk(KERN_WARNING "Fail to register qsfp mux driver\n"); + goto error_qsfp_mux_driver; + } + + ret = platform_device_register(&s6000_mux); + if (ret) { + printk(KERN_WARNING "Fail to create gpio mux\n"); + goto error_mux; + } + + ret = platform_device_register(&s6000_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpld device\n"); + goto error_cpld; + } + + cpld_pdata = s6000_cpld.dev.platform_data; + qsfp_pdata = s6000_qsfp_mux[0].dev.platform_data; + qsfp_pdata->cpld = cpld_pdata[slave_cpld].client; + qsfp_pdata = s6000_qsfp_mux[1].dev.platform_data; + qsfp_pdata->cpld = cpld_pdata[master_cpld].client; + + for (i = 0; i < QSFP_DEVICE_NUM; i++) { + ret = platform_device_register(&s6000_qsfp_mux[i]); + if (ret) { + printk(KERN_WARNING "fail to create qsfp mux %d\n", i); + goto error_qsfp_mux; + } + } + + if (ret) + goto error_qsfp_mux; + + return 0; + +error_qsfp_mux: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&s6000_qsfp_mux[i]); + } + platform_device_unregister(&s6000_cpld); +error_cpld: + platform_device_unregister(&s6000_mux); +error_mux: + platform_driver_unregister(&qsfp_mux_driver); +error_qsfp_mux_driver: + platform_driver_unregister(&cpld_driver); +error_cpld_driver: + return ret; +} + +static void __exit dell_s6000_platform_exit(void) +{ + int i; + + for (i = 0; i < MUX_CHANNEL_NUM; i++) + platform_device_unregister(&s6000_qsfp_mux[i]); + platform_device_unregister(&s6000_cpld); + platform_device_unregister(&s6000_mux); + + platform_driver_unregister(&cpld_driver); + platform_driver_unregister(&qsfp_mux_driver); +} + +module_init(dell_s6000_platform_init); +module_exit(dell_s6000_platform_exit); + +MODULE_DESCRIPTION("DELL S6000 Platform Support"); +MODULE_AUTHOR("Guohan Lu "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-s6000/scripts/reset-qsfp b/platform/broadcom/sonic-platform-modules-s6000/scripts/reset-qsfp new file mode 100755 index 000000000000..6b017ed37c26 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/scripts/reset-qsfp @@ -0,0 +1,25 @@ +#!/bin/bash + +# Usage: +# Reset QSFP manually by writing 1/0 to QSFP reset pin + +QSFP_RESET=/sys/bus/platform/devices/dell-s6000-cpld.0/qsfp_reset + +logger -t platform-modules "Reset QSFP modules" + +# Retry three times +for i in `seq 1 3` +do + if [ -w $QSFP_RESET ]; then + echo 0x00000000 > $QSFP_RESET + # Sleep 1 second to reset QSFP + sleep 1 + echo 0xffffffff > $QSFP_RESET + exit 0 + fi + # Sleep for 3 seconds to wait for device tree to be ready + sleep 3 +done + +logger -p user.error -t platform-modules "Failed to reset QSFP modules!" +exit 1 diff --git a/platform/broadcom/sonic-platform-modules-s6000/scripts/set-fan-speed b/platform/broadcom/sonic-platform-modules-s6000/scripts/set-fan-speed new file mode 100755 index 000000000000..00c738f23a8d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/scripts/set-fan-speed @@ -0,0 +1,58 @@ +#!/bin/bash + +# Usage: +# Set all fans speed to $1 + +usage() { + echo "This script must be run with super-user privilege." + echo "Warning! Wrongly set fan speed may result in physical damage to the device." + echo "" + echo "usage: set-fan-speed speed_in_rpm" + echo "example: set-fan-speed 15000" +} + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +PSU_FAN1=/sys/class/i2c-adapter/i2c-1/1-0058/fan1_target +PSU_FAN2=/sys/class/i2c-adapter/i2c-1/1-0059/fan1_target + +# Three fan trays with each contains two separate fans +# fan1-fan4 fan2-fan5 fan3-fan6 +FAN1=/sys/class/i2c-adapter/i2c-11/11-0029/fan1_target +FAN2=/sys/class/i2c-adapter/i2c-11/11-0029/fan2_target +FAN3=/sys/class/i2c-adapter/i2c-11/11-0029/fan3_target +FAN4=/sys/class/i2c-adapter/i2c-11/11-0029/fan4_target +FAN5=/sys/class/i2c-adapter/i2c-11/11-002a/fan1_target +FAN6=/sys/class/i2c-adapter/i2c-11/11-002a/fan2_target + +speed=$1 +logger -t platform-modules "Trying to set fan speed to $speed" + +# Retry three times +for i in `seq 1 3` +do + if [ -w $FAN1 -o -w $FAN2 -o -w $FAN3 ]; then + # set default psu fan speed + echo $speed > $PSU_FAN1 + echo $speed > $PSU_FAN2 + # set default fan speed + echo $speed > $FAN1 + echo $speed > $FAN2 + echo $speed > $FAN3 + echo $speed > $FAN4 + echo $speed > $FAN5 + echo $speed > $FAN6 + + logger -t platform-modules "Fan speed is set to $speed" + + exit 0 + fi + # Sleep for 3 seconds to wait for device tree to be ready + sleep 3 +done + +logger -p user.error -t platform-modules "Failed to set fan speed!" +exit 1 diff --git a/platform/broadcom/sonic-platform-modules-s6000/systemd/platform-modules-s6000.service b/platform/broadcom/sonic-platform-modules-s6000/systemd/platform-modules-s6000.service new file mode 100644 index 000000000000..246dee9b64f3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-s6000/systemd/platform-modules-s6000.service @@ -0,0 +1,13 @@ +[Unit] +Description=Dell S6000 Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-s6000 start +ExecStop=-/etc/init.d/platform-modules-s6000 stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target From 859d0e1e8aa6c678d28e8911bce459089d67215b Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 13 Aug 2018 11:34:04 -0700 Subject: [PATCH 1543/1833] [bcmsh]: add inactivity timeout for bcmsh (default 300 seconds) (#1921) Signed-off-by: Guohan Lu --- platform/broadcom/docker-syncd-brcm/bcmsh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/platform/broadcom/docker-syncd-brcm/bcmsh b/platform/broadcom/docker-syncd-brcm/bcmsh index 9dfa7874a038..7488e63c64fd 100755 --- a/platform/broadcom/docker-syncd-brcm/bcmsh +++ b/platform/broadcom/docker-syncd-brcm/bcmsh @@ -1,24 +1,29 @@ #!/bin/bash -usage="$(basename "$0") [-h] [-q] -- interactive shell for bcm service +usage="$(basename "$0") [-h] [-q] [-t timeout] -- interactive shell for bcm service where: -h show this help text + -t inactivity timeout in seconds (default 300 seconds, 0 for no timeout) -q quite, no banner (default: verbose)" banner="Press Enter to show prompt. Press Ctrl+C to exit. +NOTICE: Only one bcmsh or bcmcmd can connect to the shell at same time. " # Default verbose quiet=false +timeout=300 -while getopts 'hq' option; do +while getopts 'hqt:' option; do case "$option" in h) echo "$usage" exit ;; q) quiet=true ;; + t) timeout=$OPTARG + ;; \?) printf "illegal option: -%s\n" "$OPTARG" >&2 echo "$usage" >&2 exit 1 @@ -31,5 +36,5 @@ if [ "$quiet" = false ]; then echo "$banner" fi -/usr/bin/socat readline UNIX-CONNECT:/var/run/sswsyncd/sswsyncd.socket +/usr/bin/socat -T$timeout readline UNIX-CONNECT:/var/run/sswsyncd/sswsyncd.socket From 40bb27ca1c133e8b5971780ab70f2f88613336d6 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 13 Aug 2018 18:30:00 -0700 Subject: [PATCH 1544/1833] Simplify script to install docker (#1925) Signed-off-by: Qi Luo --- build_debian.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index d531a7207367..fc8a2cb59b2d 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -162,10 +162,10 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install apparmor docker_deb_url=https://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine_${DOCKER_VERSION}.deb docker_deb_temp=`mktemp` trap_push "rm -f $docker_deb_temp" -wget $docker_deb_url -qO $docker_deb_temp && { \ - sudo dpkg --root=$FILESYSTEM_ROOT -i $docker_deb_temp || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f; \ -} +wget $docker_deb_url -qO $docker_deb_temp +sudo dpkg --root=$FILESYSTEM_ROOT -i $docker_deb_temp || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + ## Add docker config drop-in to select aufs, otherwise it may select other storage driver sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/ ## Note: $_ means last argument of last command From e15cf2d66a8301cc7e33b9b205b61111ddbd2f88 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 13 Aug 2018 18:30:22 -0700 Subject: [PATCH 1545/1833] [build]: print error message when use root or sudo to build. (#1923) Signed-off-by: Guohan Lu --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index c5c5d59620c8..2dfab3274869 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,10 @@ SHELL = /bin/bash USER := $(shell id -un) PWD := $(shell pwd) +ifeq ($(USER), root) +$(error Add your user account to docker group and use your user account to make. root or sudo are not supported!) +endif + # Remove lock file in case previous run was forcefully stopped $(shell rm -f .screen) From 4547d9aa2a027a430b36dc1a3aab3d1676dabe04 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Tue, 14 Aug 2018 05:22:29 +0000 Subject: [PATCH 1546/1833] [nephos]: build platform modules in debian stretch docker Signed-off-by: Guohan Lu --- platform/nephos/platform-modules-accton.mk | 2 ++ platform/nephos/platform-modules-ingrasys.mk | 2 ++ 2 files changed, 4 insertions(+) diff --git a/platform/nephos/platform-modules-accton.mk b/platform/nephos/platform-modules-accton.mk index 110d0f3a5a11..1faa38acbfff 100644 --- a/platform/nephos/platform-modules-accton.mk +++ b/platform/nephos/platform-modules-accton.mk @@ -9,3 +9,5 @@ $(ACCTON_AS7116_54X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform- $(ACCTON_AS7116_54X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(ACCTON_AS7116_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7116_54x-r0 SONIC_DPKG_DEBS += $(ACCTON_AS7116_54X_PLATFORM_MODULE) + +SONIC_STRETCH_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) diff --git a/platform/nephos/platform-modules-ingrasys.mk b/platform/nephos/platform-modules-ingrasys.mk index dde33e0b8745..6cbe5dc77be4 100644 --- a/platform/nephos/platform-modules-ingrasys.mk +++ b/platform/nephos/platform-modules-ingrasys.mk @@ -16,3 +16,5 @@ INGRASYS_S9230_64X_PLATFORM_MODULE = sonic-platform-ingrasys-s9230-64x_$(INGRASY $(INGRASYS_S9230_64X_PLATFORM_MODULE)_PLATFORM = x86_64-ingrasys_s9230_64x-r0 $(eval $(call add_extra_package,$(INGRASYS_S9130_32X_PLATFORM_MODULE),$(INGRASYS_S9230_64X_PLATFORM_MODULE))) + +SONIC_STRETCH_DEBS += $(INGRASYS_S9130_32X_PLATFORM_MODULE) From cdc271720d7f1ecacaa67d64d3ad672d6157fc6f Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 14 Aug 2018 00:35:30 -0700 Subject: [PATCH 1547/1833] [submodule update]: sonic-quagga. Add dscp flag settings (#1926) * sonic-quagga update. Don't spam with 'Vtysh connected from' message * Enable counters inside swss container. systemd is not flexible enough to follow our business rules * Update sonic-quagga --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index cde29666c363..a0630b7f1bf6 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit cde29666c363e34ea7f230bb827644457acedcbc +Subproject commit a0630b7f1bf6b30c9a71a59a22b08fad105e69bc From 746ad967a482999f4060c44ae50615331b0d50bd Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Tue, 14 Aug 2018 21:46:01 +0300 Subject: [PATCH 1548/1833] [mellanox]: Fix post stop action in swss service template (#1928) Signed-off-by: Volodymyr Samotiy --- files/build_templates/swss.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 289a840d3517..8a138d46a7ca 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -44,7 +44,7 @@ ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStopPost=/usr/bin/syncd.sh stop {% if sonic_asic_platform == 'mellanox' %} -ExecStartPre=/bin/bash -c "/etc/mlnx/mlnx-hw-management stop" +ExecStopPost=/bin/bash -c "/etc/mlnx/mlnx-hw-management stop" ExecStopPost=/etc/init.d/sxdkernel stop ExecStopPost=/usr/bin/mst stop {% elif sonic_asic_platform == 'cavium' %} From 6918a22959d4295693bd08a584acb1e0c042e732 Mon Sep 17 00:00:00 2001 From: loshihyu Date: Tue, 14 Aug 2018 13:07:03 -0700 Subject: [PATCH 1549/1833] [Inventec] Add D7264 platform support (#1675) * Add Inventec D7264 platform support * Fixed util script file permission * Fixed more scripts file permission --- .../INVENTEC-D7264Q28B/port_config.ini | 65 + .../INVENTEC-D7264Q28B/sai.profile | 2 + .../th2-d7264q28b-64x100g.config.bcm | 841 ++ .../installer.conf | 4 + .../led_proc_init.soc | 273 + .../minigraph.xml | 144 + .../plugins/eeprom.py | 22 + .../plugins/psuutil.py | 93 + .../plugins/sfputil.py | 219 + platform/broadcom/one-image.mk | 1 + .../broadcom/platform-modules-inventec.mk | 10 +- .../d7264q28b/modules/Makefile | 6 + .../d7264q28b/modules/inv_cpld.c | 470 + .../d7264q28b/modules/inv_eeprom.c | 181 + .../d7264q28b/modules/inv_platform.c | 239 + .../d7264q28b/modules/inv_psoc.c | 768 ++ .../d7264q28b/modules/inv_swps.c | 719 ++ .../d7264q28b/modules/inv_swps.h | 184 + .../d7264q28b/modules/io_expander.c | 1786 ++++ .../d7264q28b/modules/io_expander.h | 173 + .../d7264q28b/modules/transceiver.c | 8212 +++++++++++++++++ .../d7264q28b/modules/transceiver.h | 792 ++ .../d7264q28b/utils/inventec_d7264_util.py | 241 + .../debian/changelog | 5 + .../debian/control | 4 + .../debian/platform-modules-d7264q28b.init | 40 + .../debian/platform-modules-d7264q28b.install | 1 + .../debian/platform-modules-d7264q28b.upstart | 5 + .../debian/rules | 2 +- 29 files changed, 15499 insertions(+), 3 deletions(-) create mode 100644 device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/port_config.ini create mode 100644 device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/sai.profile create mode 100644 device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/th2-d7264q28b-64x100g.config.bcm create mode 100644 device/inventec/x86_64-inventec_d7264q28b-r0/installer.conf create mode 100644 device/inventec/x86_64-inventec_d7264q28b-r0/led_proc_init.soc create mode 100644 device/inventec/x86_64-inventec_d7264q28b-r0/minigraph.xml create mode 100644 device/inventec/x86_64-inventec_d7264q28b-r0/plugins/eeprom.py create mode 100755 device/inventec/x86_64-inventec_d7264q28b-r0/plugins/psuutil.py create mode 100755 device/inventec/x86_64-inventec_d7264q28b-r0/plugins/sfputil.py create mode 100755 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_eeprom.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_platform.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_psoc.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_swps.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_swps.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/io_expander.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/io_expander.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/transceiver.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/transceiver.h create mode 100755 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/utils/inventec_d7264_util.py create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.init create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.install create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.upstart diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/port_config.ini b/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/port_config.ini new file mode 100644 index 000000000000..3fc6db4c8198 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/port_config.ini @@ -0,0 +1,65 @@ +# name lanes alias +Ethernet0 9,10,11,12 Ethernet0 +Ethernet4 1,2,3,4 Ethernet4 +Ethernet8 25,26,27,28 Ethernet8 +Ethernet12 17,18,19,20 Ethernet12 +Ethernet16 41,42,43,44 Ethernet16 +Ethernet20 33,34,35,36 Ethernet20 +Ethernet24 57,58,59,60 Ethernet24 +Ethernet28 49,50,51,52 Ethernet28 +Ethernet32 73,74,75,76 Ethernet32 +Ethernet36 65,66,67,68 Ethernet36 +Ethernet40 89,90,91,92 Ethernet40 +Ethernet44 81,82,83,84 Ethernet44 +Ethernet48 105,106,107,108 Ethernet48 +Ethernet52 97,98,99,100 Ethernet52 +Ethernet56 121,122,123,124 Ethernet56 +Ethernet60 113,114,115,116 Ethernet60 +Ethernet64 137,138,139,140 Ethernet64 +Ethernet68 129,130,131,132 Ethernet68 +Ethernet72 153,154,155,156 Ethernet72 +Ethernet76 145,146,147,148 Ethernet76 +Ethernet80 169,170,171,172 Ethernet80 +Ethernet84 161,162,163,164 Ethernet84 +Ethernet88 185,186,187,188 Ethernet88 +Ethernet92 177,178,179,180 Ethernet92 +Ethernet96 201,202,203,204 Ethernet96 +Ethernet100 193,194,195,196 Ethernet100 +Ethernet104 217,218,219,220 Ethernet104 +Ethernet108 209,210,211,212 Ethernet108 +Ethernet112 233,234,235,236 Ethernet112 +Ethernet116 225,226,227,228 Ethernet116 +Ethernet120 249,250,251,252 Ethernet120 +Ethernet124 241,242,243,244 Ethernet124 +Ethernet128 13,14,15,16 Ethernet128 +Ethernet132 5,6,7,8 Ethernet132 +Ethernet136 29,30,31,32 Ethernet136 +Ethernet140 21,22,23,24 Ethernet140 +Ethernet144 45,46,47,48 Ethernet144 +Ethernet148 37,38,39,40 Ethernet148 +Ethernet152 61,62,63,64 Ethernet152 +Ethernet156 53,54,55,56 Ethernet156 +Ethernet160 77,78,79,80 Ethernet160 +Ethernet164 69,70,71,72 Ethernet164 +Ethernet168 93,94,95,96 Ethernet168 +Ethernet172 85,86,87,88 Ethernet172 +Ethernet176 109,110,111,112 Ethernet176 +Ethernet180 101,102,103,104 Ethernet180 +Ethernet184 125,126,127,128 Ethernet184 +Ethernet188 117,118,119,120 Ethernet188 +Ethernet192 141,142,143,144 Ethernet192 +Ethernet196 133,134,135,136 Ethernet196 +Ethernet200 157,158,159,160 Ethernet200 +Ethernet204 149,150,151,152 Ethernet204 +Ethernet208 173,174,175,176 Ethernet208 +Ethernet212 165,166,167,168 Ethernet212 +Ethernet216 189,190,191,192 Ethernet216 +Ethernet220 181,182,183,184 Ethernet220 +Ethernet224 205,206,207,208 Ethernet224 +Ethernet228 197,198,199,200 Ethernet228 +Ethernet232 221,222,223,224 Ethernet232 +Ethernet236 213,214,215,216 Ethernet236 +Ethernet240 237,238,239,240 Ethernet240 +Ethernet244 229,230,231,232 Ethernet244 +Ethernet248 253,254,255,256 Ethernet248 +Ethernet252 245,246,247,248 Ethernet252 diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/sai.profile b/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/sai.profile new file mode 100644 index 000000000000..74c0e88255c0 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-d7264q28b-64x100g.config.bcm +SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/th2-d7264q28b-64x100g.config.bcm b/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/th2-d7264q28b-64x100g.config.bcm new file mode 100644 index 000000000000..8ca378382c93 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/th2-d7264q28b-64x100g.config.bcm @@ -0,0 +1,841 @@ +# Sequoia BCM Shell config / 100G * 64 ports + +core_clock_frequency=1700 +dpp_clock_ratio=2:3 +load_firmware=1 +# EagleCore ports: xe0 & xe1 +portmap_66=257:10 +portmap_100=259:10 + +# Loopback ports +portmap_33=260:10 +portmap_67=261:10 +portmap_101=262:10 +portmap_135=263:10 + +# 64 ports config for 100G +# For Tomahawk FalconCore: +# Physical ports in FalconCore[0 - 15] must map to logical port[1 - 32] at any order +# Physical ports in FalconCore[16 - 31] must map to logical port[34 - 65] at any order +# Physical ports in FalconCore[32 - 47] must map to logical port[68 - 99] at any order +# Physical ports in FalconCore[48 - 63] must map to logical port[102 - 133] at any order + +## FalconCore[0 - 15] +portmap_1=9:100 +portmap_2=1:100 +portmap_3=13:100 +portmap_4=5:100 +portmap_5=25:100 +portmap_6=17:100 +portmap_7=29:100 +portmap_8=21:100 +portmap_9=41:100 +portmap_10=33:100 +portmap_11=45:100 +portmap_12=37:100 +portmap_13=57:100 +portmap_14=49:100 +portmap_15=61:100 +portmap_16=53:100 + +## FalconCore[16 - 31] +portmap_34=73:100 +portmap_35=65:100 +portmap_36=77:100 +portmap_37=69:100 +portmap_38=89:100 +portmap_39=81:100 +portmap_40=93:100 +portmap_41=85:100 +portmap_42=105:100 +portmap_43=97:100 +portmap_44=109:100 +portmap_45=101:100 +portmap_46=121:100 +portmap_47=113:100 +portmap_48=125:100 +portmap_49=117:100 + +## FalconCore[32-47] +portmap_68=137:100 +portmap_69=129:100 +portmap_70=141:100 +portmap_71=133:100 +portmap_72=153:100 +portmap_73=145:100 +portmap_74=157:100 +portmap_75=149:100 +portmap_76=169:100 +portmap_77=161:100 +portmap_78=173:100 +portmap_79=165:100 +portmap_80=185:100 +portmap_81=177:100 +portmap_82=189:100 +portmap_83=181:100 + +## FalconCore[48-63] +portmap_102=201:100 +portmap_103=193:100 +portmap_104=205:100 +portmap_105=197:100 +portmap_106=217:100 +portmap_107=209:100 +portmap_108=221:100 +portmap_109=213:100 +portmap_110=233:100 +portmap_111=225:100 +portmap_112=237:100 +portmap_113=229:100 +portmap_114=249:100 +portmap_115=241:100 +portmap_116=253:100 +portmap_117=245:100 + +pbmp_xport_xe=0x3FFFD0000FFFF40003FFFC0001FFFE +oversubscribe_mode=1 +l2_mem_entries=73728 +l3_mem_entries=73728 +fpem_mem_entries=65536 +l2xmsg_mode=1 + +## FalconCore [0-15] port TX Lane Swapping +phy_chain_tx_lane_map_physical{1.0}=0x3201 +phy_chain_tx_lane_map_physical{5.0}=0x3210 +phy_chain_tx_lane_map_physical{9.0}=0x2301 +phy_chain_tx_lane_map_physical{13.0}=0x3210 +phy_chain_tx_lane_map_physical{17.0}=0x3201 +phy_chain_tx_lane_map_physical{21.0}=0x3201 +phy_chain_tx_lane_map_physical{25.0}=0x3201 +phy_chain_tx_lane_map_physical{29.0}=0x3210 +phy_chain_tx_lane_map_physical{33.0}=0x3201 +phy_chain_tx_lane_map_physical{37.0}=0x3210 +phy_chain_tx_lane_map_physical{41.0}=0x3210 +phy_chain_tx_lane_map_physical{45.0}=0x3210 +phy_chain_tx_lane_map_physical{49.0}=0x3201 +phy_chain_tx_lane_map_physical{53.0}=0x3210 +phy_chain_tx_lane_map_physical{57.0}=0x3210 +phy_chain_tx_lane_map_physical{61.0}=0x3210 + + +## FalconCore [16-31] port TX Lane Swapping +phy_chain_tx_lane_map_physical{65.0}=0x3210 +phy_chain_tx_lane_map_physical{69.0}=0x3201 +phy_chain_tx_lane_map_physical{73.0}=0x3210 +phy_chain_tx_lane_map_physical{77.0}=0x3210 +phy_chain_tx_lane_map_physical{81.0}=0x3210 +phy_chain_tx_lane_map_physical{85.0}=0x3210 +phy_chain_tx_lane_map_physical{89.0}=0x3210 +phy_chain_tx_lane_map_physical{93.0}=0x3210 +phy_chain_tx_lane_map_physical{97.0}=0x3210 +phy_chain_tx_lane_map_physical{101.0}=0x2310 +phy_chain_tx_lane_map_physical{105.0}=0x2310 +phy_chain_tx_lane_map_physical{109.0}=0x3210 +phy_chain_tx_lane_map_physical{113.0}=0x3210 +phy_chain_tx_lane_map_physical{117.0}=0x2310 +phy_chain_tx_lane_map_physical{121.0}=0x2310 +phy_chain_tx_lane_map_physical{125.0}=0x3210 + + +## FalconCore [32-47] port TX Lane Swapping +phy_chain_tx_lane_map_physical{129.0}=0x2301 +phy_chain_tx_lane_map_physical{133.0}=0x3210 +phy_chain_tx_lane_map_physical{137.0}=0x2301 +phy_chain_tx_lane_map_physical{141.0}=0x3210 +phy_chain_tx_lane_map_physical{145.0}=0x2301 +phy_chain_tx_lane_map_physical{149.0}=0x3210 +phy_chain_tx_lane_map_physical{153.0}=0x3210 +phy_chain_tx_lane_map_physical{157.0}=0x3210 +phy_chain_tx_lane_map_physical{161.0}=0x2310 +phy_chain_tx_lane_map_physical{165.0}=0x2310 +phy_chain_tx_lane_map_physical{169.0}=0x2310 +phy_chain_tx_lane_map_physical{173.0}=0x3210 +phy_chain_tx_lane_map_physical{177.0}=0x3210 +phy_chain_tx_lane_map_physical{181.0}=0x2310 +phy_chain_tx_lane_map_physical{185.0}=0x3210 +phy_chain_tx_lane_map_physical{189.0}=0x2310 + + +## FalconCore [48-63] port TX Lane Swapping +phy_chain_tx_lane_map_physical{193.0}=0x2310 +phy_chain_tx_lane_map_physical{197.0}=0x2310 +phy_chain_tx_lane_map_physical{201.0}=0x2310 +phy_chain_tx_lane_map_physical{205.0}=0x2310 +phy_chain_tx_lane_map_physical{209.0}=0x3210 +phy_chain_tx_lane_map_physical{213.0}=0x2310 +phy_chain_tx_lane_map_physical{217.0}=0x3210 +phy_chain_tx_lane_map_physical{221.0}=0x2301 +phy_chain_tx_lane_map_physical{225.0}=0x3210 +phy_chain_tx_lane_map_physical{229.0}=0x2310 +phy_chain_tx_lane_map_physical{233.0}=0x2310 +phy_chain_tx_lane_map_physical{237.0}=0x1023 +phy_chain_tx_lane_map_physical{241.0}=0x3210 +phy_chain_tx_lane_map_physical{245.0}=0x2310 +phy_chain_tx_lane_map_physical{249.0}=0x3210 +phy_chain_tx_lane_map_physical{253.0}=0x2310 + +## FalconCore [0-15] port RX Lane Swapping +phy_chain_rx_lane_map_physical{1.0}=0x3210 +phy_chain_rx_lane_map_physical{5.0}=0x3210 +phy_chain_rx_lane_map_physical{9.0}=0x3210 +phy_chain_rx_lane_map_physical{13.0}=0x3210 +phy_chain_rx_lane_map_physical{17.0}=0x2310 +phy_chain_rx_lane_map_physical{21.0}=0x0213 +phy_chain_rx_lane_map_physical{25.0}=0x2310 +phy_chain_rx_lane_map_physical{29.0}=0x3210 +phy_chain_rx_lane_map_physical{33.0}=0x3210 +phy_chain_rx_lane_map_physical{37.0}=0x3210 +phy_chain_rx_lane_map_physical{41.0}=0x3210 +phy_chain_rx_lane_map_physical{45.0}=0x3210 +phy_chain_rx_lane_map_physical{49.0}=0x3210 +phy_chain_rx_lane_map_physical{53.0}=0x3210 +phy_chain_rx_lane_map_physical{57.0}=0x3210 +phy_chain_rx_lane_map_physical{61.0}=0x3210 + + +## FalconCore [16-31] port RX Lane Swapping +phy_chain_rx_lane_map_physical{65.0}=0x3210 +phy_chain_rx_lane_map_physical{69.0}=0x3210 +phy_chain_rx_lane_map_physical{73.0}=0x3210 +phy_chain_rx_lane_map_physical{77.0}=0x3210 +phy_chain_rx_lane_map_physical{81.0}=0x3210 +phy_chain_rx_lane_map_physical{85.0}=0x3210 +phy_chain_rx_lane_map_physical{89.0}=0x3210 +phy_chain_rx_lane_map_physical{93.0}=0x3210 +phy_chain_rx_lane_map_physical{97.0}=0x3210 +phy_chain_rx_lane_map_physical{101.0}=0x3201 +phy_chain_rx_lane_map_physical{105.0}=0x3210 +phy_chain_rx_lane_map_physical{109.0}=0x3210 +phy_chain_rx_lane_map_physical{113.0}=0x3210 +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}=0x3210 + + +## FalconCore [32-47] port RX Lane Swapping +phy_chain_rx_lane_map_physical{129.0}=0x3210 +phy_chain_rx_lane_map_physical{133.0}=0x2301 +phy_chain_rx_lane_map_physical{137.0}=0x3210 +phy_chain_rx_lane_map_physical{141.0}=0x2310 +phy_chain_rx_lane_map_physical{145.0}=0x3210 +phy_chain_rx_lane_map_physical{149.0}=0x3210 +phy_chain_rx_lane_map_physical{153.0}=0x3210 +phy_chain_rx_lane_map_physical{157.0}=0x3210 +phy_chain_rx_lane_map_physical{161.0}=0x3210 +phy_chain_rx_lane_map_physical{165.0}=0x3210 +phy_chain_rx_lane_map_physical{169.0}=0x3210 +phy_chain_rx_lane_map_physical{173.0}=0x3210 +phy_chain_rx_lane_map_physical{177.0}=0x3210 +phy_chain_rx_lane_map_physical{181.0}=0x3210 +phy_chain_rx_lane_map_physical{185.0}=0x3210 +phy_chain_rx_lane_map_physical{189.0}=0x3210 + + +## FalconCore [48-63] port RX Lan Swapping +phy_chain_rx_lane_map_physical{193.0}=0x3210 +phy_chain_rx_lane_map_physical{197.0}=0x3210 +phy_chain_rx_lane_map_physical{201.0}=0x3210 +phy_chain_rx_lane_map_physical{205.0}=0x3210 +phy_chain_rx_lane_map_physical{209.0}=0x3210 +phy_chain_rx_lane_map_physical{213.0}=0x3210 +phy_chain_rx_lane_map_physical{217.0}=0x3210 +phy_chain_rx_lane_map_physical{221.0}=0x3210 +phy_chain_rx_lane_map_physical{225.0}=0x3210 +phy_chain_rx_lane_map_physical{229.0}=0x2301 +phy_chain_rx_lane_map_physical{233.0}=0x3210 +phy_chain_rx_lane_map_physical{237.0}=0x1023 +phy_chain_rx_lane_map_physical{241.0}=0x3210 +phy_chain_rx_lane_map_physical{245.0}=0x3210 +phy_chain_rx_lane_map_physical{249.0}=0x3210 +phy_chain_rx_lane_map_physical{253.0}=0x3210 + + +## FalconCore[0-15] ports TX polarity flip +phy_chain_tx_polarity_flip_physical{1.0}=0x1 +phy_chain_tx_polarity_flip_physical{2.0}=0x1 +phy_chain_tx_polarity_flip_physical{3.0}=0x0 +phy_chain_tx_polarity_flip_physical{4.0}=0x1 +phy_chain_tx_polarity_flip_physical{5.0}=0x0 +phy_chain_tx_polarity_flip_physical{6.0}=0x0 +phy_chain_tx_polarity_flip_physical{7.0}=0x0 +phy_chain_tx_polarity_flip_physical{8.0}=0x0 +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x1 +phy_chain_tx_polarity_flip_physical{11.0}=0x0 +phy_chain_tx_polarity_flip_physical{12.0}=0x0 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{14.0}=0x0 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x1 +phy_chain_tx_polarity_flip_physical{19.0}=0x1 +phy_chain_tx_polarity_flip_physical{20.0}=0x0 +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_tx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{25.0}=0x0 +phy_chain_tx_polarity_flip_physical{26.0}=0x1 +phy_chain_tx_polarity_flip_physical{27.0}=0x0 +phy_chain_tx_polarity_flip_physical{28.0}=0x0 +phy_chain_tx_polarity_flip_physical{29.0}=0x0 +phy_chain_tx_polarity_flip_physical{30.0}=0x0 +phy_chain_tx_polarity_flip_physical{31.0}=0x0 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +phy_chain_tx_polarity_flip_physical{33.0}=0x1 +phy_chain_tx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x1 +phy_chain_tx_polarity_flip_physical{36.0}=0x0 +phy_chain_tx_polarity_flip_physical{37.0}=0x0 +phy_chain_tx_polarity_flip_physical{38.0}=0x0 +phy_chain_tx_polarity_flip_physical{39.0}=0x0 +phy_chain_tx_polarity_flip_physical{40.0}=0x0 +phy_chain_tx_polarity_flip_physical{41.0}=0x1 +phy_chain_tx_polarity_flip_physical{42.0}=0x0 +phy_chain_tx_polarity_flip_physical{43.0}=0x1 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 +phy_chain_tx_polarity_flip_physical{45.0}=0x0 +phy_chain_tx_polarity_flip_physical{46.0}=0x0 +phy_chain_tx_polarity_flip_physical{47.0}=0x0 +phy_chain_tx_polarity_flip_physical{48.0}=0x0 +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x0 +phy_chain_tx_polarity_flip_physical{53.0}=0x0 +phy_chain_tx_polarity_flip_physical{54.0}=0x0 +phy_chain_tx_polarity_flip_physical{55.0}=0x0 +phy_chain_tx_polarity_flip_physical{56.0}=0x0 +phy_chain_tx_polarity_flip_physical{57.0}=0x1 +phy_chain_tx_polarity_flip_physical{58.0}=0x0 +phy_chain_tx_polarity_flip_physical{59.0}=0x0 +phy_chain_tx_polarity_flip_physical{60.0}=0x0 +phy_chain_tx_polarity_flip_physical{61.0}=0x0 +phy_chain_tx_polarity_flip_physical{62.0}=0x0 +phy_chain_tx_polarity_flip_physical{63.0}=0x0 +phy_chain_tx_polarity_flip_physical{64.0}=0x0 + +## FalconCore[16-31] ports TX polarity flip +phy_chain_tx_polarity_flip_physical{65.0}=0x1 +phy_chain_tx_polarity_flip_physical{66.0}=0x0 +phy_chain_tx_polarity_flip_physical{67.0}=0x0 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 +phy_chain_tx_polarity_flip_physical{69.0}=0x0 +phy_chain_tx_polarity_flip_physical{70.0}=0x1 +phy_chain_tx_polarity_flip_physical{71.0}=0x0 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_tx_polarity_flip_physical{73.0}=0x0 +phy_chain_tx_polarity_flip_physical{74.0}=0x0 +phy_chain_tx_polarity_flip_physical{75.0}=0x0 +phy_chain_tx_polarity_flip_physical{76.0}=0x0 +phy_chain_tx_polarity_flip_physical{77.0}=0x1 +phy_chain_tx_polarity_flip_physical{78.0}=0x0 +phy_chain_tx_polarity_flip_physical{79.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x0 +phy_chain_tx_polarity_flip_physical{81.0}=0x0 +phy_chain_tx_polarity_flip_physical{82.0}=0x0 +phy_chain_tx_polarity_flip_physical{83.0}=0x0 +phy_chain_tx_polarity_flip_physical{84.0}=0x0 +phy_chain_tx_polarity_flip_physical{85.0}=0x0 +phy_chain_tx_polarity_flip_physical{86.0}=0x1 +phy_chain_tx_polarity_flip_physical{87.0}=0x0 +phy_chain_tx_polarity_flip_physical{88.0}=0x0 +phy_chain_tx_polarity_flip_physical{89.0}=0x1 +phy_chain_tx_polarity_flip_physical{90.0}=0x0 +phy_chain_tx_polarity_flip_physical{91.0}=0x0 +phy_chain_tx_polarity_flip_physical{92.0}=0x0 +phy_chain_tx_polarity_flip_physical{93.0}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{98.0}=0x0 +phy_chain_tx_polarity_flip_physical{99.0}=0x0 +phy_chain_tx_polarity_flip_physical{100.0}=0x0 +phy_chain_tx_polarity_flip_physical{101.0}=0x0 +phy_chain_tx_polarity_flip_physical{102.0}=0x0 +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}=0x1 +phy_chain_tx_polarity_flip_physical{106.0}=0x0 +phy_chain_tx_polarity_flip_physical{107.0}=0x0 +phy_chain_tx_polarity_flip_physical{108.0}=0x0 +phy_chain_tx_polarity_flip_physical{109.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{113.0}=0x0 +phy_chain_tx_polarity_flip_physical{114.0}=0x1 +phy_chain_tx_polarity_flip_physical{115.0}=0x0 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 +phy_chain_tx_polarity_flip_physical{117.0}=0x0 +phy_chain_tx_polarity_flip_physical{118.0}=0x0 +phy_chain_tx_polarity_flip_physical{119.0}=0x0 +phy_chain_tx_polarity_flip_physical{120.0}=0x0 +phy_chain_tx_polarity_flip_physical{121.0}=0x1 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_tx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x0 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x0 +phy_chain_tx_polarity_flip_physical{127.0}=0x0 +phy_chain_tx_polarity_flip_physical{128.0}=0x0 + +## FalconCore[32-47] ports TX polarity flip +phy_chain_tx_polarity_flip_physical{129.0}=0x0 +phy_chain_tx_polarity_flip_physical{130.0}=0x0 +phy_chain_tx_polarity_flip_physical{131.0}=0x0 +phy_chain_tx_polarity_flip_physical{132.0}=0x0 +phy_chain_tx_polarity_flip_physical{133.0}=0x0 +phy_chain_tx_polarity_flip_physical{134.0}=0x0 +phy_chain_tx_polarity_flip_physical{135.0}=0x0 +phy_chain_tx_polarity_flip_physical{136.0}=0x0 +phy_chain_tx_polarity_flip_physical{137.0}=0x0 +phy_chain_tx_polarity_flip_physical{138.0}=0x1 +phy_chain_tx_polarity_flip_physical{139.0}=0x0 +phy_chain_tx_polarity_flip_physical{140.0}=0x0 +phy_chain_tx_polarity_flip_physical{141.0}=0x0 +phy_chain_tx_polarity_flip_physical{142.0}=0x0 +phy_chain_tx_polarity_flip_physical{143.0}=0x0 +phy_chain_tx_polarity_flip_physical{144.0}=0x0 +phy_chain_tx_polarity_flip_physical{145.0}=0x1 +phy_chain_tx_polarity_flip_physical{146.0}=0x0 +phy_chain_tx_polarity_flip_physical{147.0}=0x0 +phy_chain_tx_polarity_flip_physical{148.0}=0x0 +phy_chain_tx_polarity_flip_physical{149.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}=0x0 +phy_chain_tx_polarity_flip_physical{154.0}=0x1 +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{160.0}=0x0 +phy_chain_tx_polarity_flip_physical{161.0}=0x1 +phy_chain_tx_polarity_flip_physical{162.0}=0x0 +phy_chain_tx_polarity_flip_physical{163.0}=0x0 +phy_chain_tx_polarity_flip_physical{164.0}=0x0 +phy_chain_tx_polarity_flip_physical{165.0}=0x0 +phy_chain_tx_polarity_flip_physical{166.0}=0x0 +phy_chain_tx_polarity_flip_physical{167.0}=0x0 +phy_chain_tx_polarity_flip_physical{168.0}=0x0 +phy_chain_tx_polarity_flip_physical{169.0}=0x0 +phy_chain_tx_polarity_flip_physical{170.0}=0x1 +phy_chain_tx_polarity_flip_physical{171.0}=0x0 +phy_chain_tx_polarity_flip_physical{172.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{176.0}=0x0 +phy_chain_tx_polarity_flip_physical{177.0}=0x0 +phy_chain_tx_polarity_flip_physical{178.0}=0x1 +phy_chain_tx_polarity_flip_physical{179.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{185.0}=0x0 +phy_chain_tx_polarity_flip_physical{186.0}=0x0 +phy_chain_tx_polarity_flip_physical{187.0}=0x0 +phy_chain_tx_polarity_flip_physical{188.0}=0x0 +phy_chain_tx_polarity_flip_physical{189.0}=0x0 +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 + +## FalconCore[48-63] ports TX polarity flip +phy_chain_tx_polarity_flip_physical{193.0}=0x1 +phy_chain_tx_polarity_flip_physical{194.0}=0x0 +phy_chain_tx_polarity_flip_physical{195.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{199.0}=0x0 +phy_chain_tx_polarity_flip_physical{200.0}=0x0 +phy_chain_tx_polarity_flip_physical{201.0}=0x0 +phy_chain_tx_polarity_flip_physical{202.0}=0x1 +phy_chain_tx_polarity_flip_physical{203.0}=0x0 +phy_chain_tx_polarity_flip_physical{204.0}=0x0 +phy_chain_tx_polarity_flip_physical{205.0}=0x0 +phy_chain_tx_polarity_flip_physical{206.0}=0x0 +phy_chain_tx_polarity_flip_physical{207.0}=0x0 +phy_chain_tx_polarity_flip_physical{208.0}=0x0 +phy_chain_tx_polarity_flip_physical{209.0}=0x0 +phy_chain_tx_polarity_flip_physical{210.0}=0x0 +phy_chain_tx_polarity_flip_physical{211.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{215.0}=0x0 +phy_chain_tx_polarity_flip_physical{216.0}=0x0 +phy_chain_tx_polarity_flip_physical{217.0}=0x1 +phy_chain_tx_polarity_flip_physical{218.0}=0x0 +phy_chain_tx_polarity_flip_physical{219.0}=0x0 +phy_chain_tx_polarity_flip_physical{220.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{225.0}=0x1 +phy_chain_tx_polarity_flip_physical{226.0}=0x0 +phy_chain_tx_polarity_flip_physical{227.0}=0x0 +phy_chain_tx_polarity_flip_physical{228.0}=0x0 +phy_chain_tx_polarity_flip_physical{229.0}=0x0 +phy_chain_tx_polarity_flip_physical{230.0}=0x0 +phy_chain_tx_polarity_flip_physical{231.0}=0x0 +phy_chain_tx_polarity_flip_physical{232.0}=0x0 +phy_chain_tx_polarity_flip_physical{233.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{238.0}=0x0 +phy_chain_tx_polarity_flip_physical{239.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}=0x0 +phy_chain_tx_polarity_flip_physical{243.0}=0x0 +phy_chain_tx_polarity_flip_physical{244.0}=0x0 +phy_chain_tx_polarity_flip_physical{245.0}=0x0 +phy_chain_tx_polarity_flip_physical{246.0}=0x0 +phy_chain_tx_polarity_flip_physical{247.0}=0x0 +phy_chain_tx_polarity_flip_physical{248.0}=0x1 +phy_chain_tx_polarity_flip_physical{249.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}=0x0 +phy_chain_tx_polarity_flip_physical{254.0}=0x0 +phy_chain_tx_polarity_flip_physical{255.0}=0x0 +phy_chain_tx_polarity_flip_physical{256.0}=0x1 + +## FalconCore[0-15] ports RX polarity flip +phy_chain_rx_polarity_flip_physical{1.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x0 +phy_chain_rx_polarity_flip_physical{4.0}=0x0 +phy_chain_rx_polarity_flip_physical{5.0}=0x0 +phy_chain_rx_polarity_flip_physical{6.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x0 +phy_chain_rx_polarity_flip_physical{8.0}=0x0 +phy_chain_rx_polarity_flip_physical{9.0}=0x0 +phy_chain_rx_polarity_flip_physical{10.0}=0x0 +phy_chain_rx_polarity_flip_physical{11.0}=0x0 +phy_chain_rx_polarity_flip_physical{12.0}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x0 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x0 +phy_chain_rx_polarity_flip_physical{16.0}=0x0 +phy_chain_rx_polarity_flip_physical{17.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x0 +phy_chain_rx_polarity_flip_physical{19.0}=0x0 +phy_chain_rx_polarity_flip_physical{20.0}=0x1 +phy_chain_rx_polarity_flip_physical{21.0}=0x0 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x0 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 +phy_chain_rx_polarity_flip_physical{25.0}=0x0 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x0 +phy_chain_rx_polarity_flip_physical{28.0}=0x1 +phy_chain_rx_polarity_flip_physical{29.0}=0x0 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{32.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{36.0}=0x0 +phy_chain_rx_polarity_flip_physical{37.0}=0x0 +phy_chain_rx_polarity_flip_physical{38.0}=0x0 +phy_chain_rx_polarity_flip_physical{39.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x0 +phy_chain_rx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{42.0}=0x0 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_rx_polarity_flip_physical{44.0}=0x0 +phy_chain_rx_polarity_flip_physical{45.0}=0x0 +phy_chain_rx_polarity_flip_physical{46.0}=0x0 +phy_chain_rx_polarity_flip_physical{47.0}=0x0 +phy_chain_rx_polarity_flip_physical{48.0}=0x0 +phy_chain_rx_polarity_flip_physical{49.0}=0x0 +phy_chain_rx_polarity_flip_physical{50.0}=0x0 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=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}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{60.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{64.0}=0x0 + +## FalconCore [16-31] ports RX polarity flip +phy_chain_rx_polarity_flip_physical{65.0}=0x0 +phy_chain_rx_polarity_flip_physical{66.0}=0x0 +phy_chain_rx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x0 +phy_chain_rx_polarity_flip_physical{69.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x1 +phy_chain_rx_polarity_flip_physical{73.0}=0x0 +phy_chain_rx_polarity_flip_physical{74.0}=0x0 +phy_chain_rx_polarity_flip_physical{75.0}=0x0 +phy_chain_rx_polarity_flip_physical{76.0}=0x0 +phy_chain_rx_polarity_flip_physical{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{80.0}=0x0 +phy_chain_rx_polarity_flip_physical{81.0}=0x0 +phy_chain_rx_polarity_flip_physical{82.0}=0x0 +phy_chain_rx_polarity_flip_physical{83.0}=0x0 +phy_chain_rx_polarity_flip_physical{84.0}=0x0 +phy_chain_rx_polarity_flip_physical{85.0}=0x0 +phy_chain_rx_polarity_flip_physical{86.0}=0x0 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x0 +phy_chain_rx_polarity_flip_physical{89.0}=0x0 +phy_chain_rx_polarity_flip_physical{90.0}=0x0 +phy_chain_rx_polarity_flip_physical{91.0}=0x0 +phy_chain_rx_polarity_flip_physical{92.0}=0x0 +phy_chain_rx_polarity_flip_physical{93.0}=0x0 +phy_chain_rx_polarity_flip_physical{94.0}=0x0 +phy_chain_rx_polarity_flip_physical{95.0}=0x0 +phy_chain_rx_polarity_flip_physical{96.0}=0x0 +phy_chain_rx_polarity_flip_physical{97.0}=0x0 +phy_chain_rx_polarity_flip_physical{98.0}=0x0 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x0 +phy_chain_rx_polarity_flip_physical{101.0}=0x0 +phy_chain_rx_polarity_flip_physical{102.0}=0x0 +phy_chain_rx_polarity_flip_physical{103.0}=0x0 +phy_chain_rx_polarity_flip_physical{104.0}=0x0 +phy_chain_rx_polarity_flip_physical{105.0}=0x0 +phy_chain_rx_polarity_flip_physical{106.0}=0x0 +phy_chain_rx_polarity_flip_physical{107.0}=0x0 +phy_chain_rx_polarity_flip_physical{108.0}=0x0 +phy_chain_rx_polarity_flip_physical{109.0}=0x0 +phy_chain_rx_polarity_flip_physical{110.0}=0x0 +phy_chain_rx_polarity_flip_physical{111.0}=0x0 +phy_chain_rx_polarity_flip_physical{112.0}=0x0 +phy_chain_rx_polarity_flip_physical{113.0}=0x0 +phy_chain_rx_polarity_flip_physical{114.0}=0x0 +phy_chain_rx_polarity_flip_physical{115.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{120.0}=0x0 +phy_chain_rx_polarity_flip_physical{121.0}=0x0 +phy_chain_rx_polarity_flip_physical{122.0}=0x0 +phy_chain_rx_polarity_flip_physical{123.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{127.0}=0x0 +phy_chain_rx_polarity_flip_physical{128.0}=0x0 + +## FalconCore [32-47] ports RX polarity flip +phy_chain_rx_polarity_flip_physical{129.0}=0x0 +phy_chain_rx_polarity_flip_physical{130.0}=0x0 +phy_chain_rx_polarity_flip_physical{131.0}=0x0 +phy_chain_rx_polarity_flip_physical{132.0}=0x0 +phy_chain_rx_polarity_flip_physical{133.0}=0x0 +phy_chain_rx_polarity_flip_physical{134.0}=0x0 +phy_chain_rx_polarity_flip_physical{135.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{140.0}=0x0 +phy_chain_rx_polarity_flip_physical{141.0}=0x0 +phy_chain_rx_polarity_flip_physical{142.0}=0x0 +phy_chain_rx_polarity_flip_physical{143.0}=0x0 +phy_chain_rx_polarity_flip_physical{144.0}=0x0 +phy_chain_rx_polarity_flip_physical{145.0}=0x0 +phy_chain_rx_polarity_flip_physical{146.0}=0x0 +phy_chain_rx_polarity_flip_physical{147.0}=0x0 +phy_chain_rx_polarity_flip_physical{148.0}=0x1 +phy_chain_rx_polarity_flip_physical{149.0}=0x0 +phy_chain_rx_polarity_flip_physical{150.0}=0x0 +phy_chain_rx_polarity_flip_physical{151.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{155.0}=0x0 +phy_chain_rx_polarity_flip_physical{156.0}=0x1 +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}=0x0 +phy_chain_rx_polarity_flip_physical{160.0}=0x0 +phy_chain_rx_polarity_flip_physical{161.0}=0x0 +phy_chain_rx_polarity_flip_physical{162.0}=0x0 +phy_chain_rx_polarity_flip_physical{163.0}=0x0 +phy_chain_rx_polarity_flip_physical{164.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{168.0}=0x0 +phy_chain_rx_polarity_flip_physical{169.0}=0x0 +phy_chain_rx_polarity_flip_physical{170.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{176.0}=0x0 +phy_chain_rx_polarity_flip_physical{177.0}=0x0 +phy_chain_rx_polarity_flip_physical{178.0}=0x0 +phy_chain_rx_polarity_flip_physical{179.0}=0x0 +phy_chain_rx_polarity_flip_physical{180.0}=0x0 +phy_chain_rx_polarity_flip_physical{181.0}=0x0 +phy_chain_rx_polarity_flip_physical{182.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{189.0}=0x0 +phy_chain_rx_polarity_flip_physical{190.0}=0x0 +phy_chain_rx_polarity_flip_physical{191.0}=0x0 +phy_chain_rx_polarity_flip_physical{192.0}=0x0 + +## FalconCore [48-63] ports RX polarity flip +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}=0x0 +phy_chain_rx_polarity_flip_physical{196.0}=0x0 +phy_chain_rx_polarity_flip_physical{197.0}=0x0 +phy_chain_rx_polarity_flip_physical{198.0}=0x0 +phy_chain_rx_polarity_flip_physical{199.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}=0x0 +phy_chain_rx_polarity_flip_physical{204.0}=0x0 +phy_chain_rx_polarity_flip_physical{205.0}=0x0 +phy_chain_rx_polarity_flip_physical{206.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{210.0}=0x0 +phy_chain_rx_polarity_flip_physical{211.0}=0x1 +phy_chain_rx_polarity_flip_physical{212.0}=0x1 +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}=0x0 +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{220.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{224.0}=0x0 +phy_chain_rx_polarity_flip_physical{225.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{229.0}=0x0 +phy_chain_rx_polarity_flip_physical{230.0}=0x0 +phy_chain_rx_polarity_flip_physical{231.0}=0x0 +phy_chain_rx_polarity_flip_physical{232.0}=0x0 +phy_chain_rx_polarity_flip_physical{233.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{238.0}=0x0 +phy_chain_rx_polarity_flip_physical{239.0}=0x0 +phy_chain_rx_polarity_flip_physical{240.0}=0x0 +phy_chain_rx_polarity_flip_physical{241.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{246.0}=0x0 +phy_chain_rx_polarity_flip_physical{247.0}=0x0 +phy_chain_rx_polarity_flip_physical{248.0}=0x0 +phy_chain_rx_polarity_flip_physical{249.0}=0x0 +phy_chain_rx_polarity_flip_physical{250.0}=0x0 +phy_chain_rx_polarity_flip_physical{251.0}=0x1 +phy_chain_rx_polarity_flip_physical{252.0}=0x0 +phy_chain_rx_polarity_flip_physical{253.0}=0x0 +phy_chain_rx_polarity_flip_physical{254.0}=0x0 +phy_chain_rx_polarity_flip_physical{255.0}=0x0 +phy_chain_rx_polarity_flip_physical{256.0}=0x0 + +dport_map_enable=1 +dport_map_port_3=68 +dport_map_port_4=69 +dport_map_port_5=3 +dport_map_port_6=4 +dport_map_port_7=70 +dport_map_port_8=71 +dport_map_port_9=5 +dport_map_port_10=6 +dport_map_port_11=72 +dport_map_port_12=73 +dport_map_port_13=7 +dport_map_port_14=8 +dport_map_port_15=74 +dport_map_port_16=75 +dport_map_port_34=9 +dport_map_port_35=10 +dport_map_port_36=76 +dport_map_port_37=77 +dport_map_port_38=11 +dport_map_port_39=12 +dport_map_port_40=78 +dport_map_port_41=79 +dport_map_port_42=13 +dport_map_port_43=14 +dport_map_port_44=80 +dport_map_port_45=81 +dport_map_port_46=15 +dport_map_port_47=16 +dport_map_port_48=82 +dport_map_port_49=83 +dport_map_port_68=34 +dport_map_port_69=35 +dport_map_port_70=102 +dport_map_port_71=103 +dport_map_port_72=36 +dport_map_port_73=37 +dport_map_port_74=104 +dport_map_port_75=105 +dport_map_port_76=38 +dport_map_port_77=39 +dport_map_port_78=106 +dport_map_port_79=107 +dport_map_port_80=40 +dport_map_port_81=41 +dport_map_port_82=108 +dport_map_port_83=109 +dport_map_port_102=42 +dport_map_port_103=43 +dport_map_port_104=110 +dport_map_port_105=111 +dport_map_port_106=44 +dport_map_port_107=45 +dport_map_port_108=112 +dport_map_port_109=113 +dport_map_port_110=46 +dport_map_port_111=47 +dport_map_port_112=114 +dport_map_port_113=115 +dport_map_port_114=48 +dport_map_port_115=49 diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/installer.conf b/device/inventec/x86_64-inventec_d7264q28b-r0/installer.conf new file mode 100644 index 000000000000..1db64ba02c38 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 +VAR_LOG_SIZE=1024 diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/led_proc_init.soc b/device/inventec/x86_64-inventec_d7264q28b-r0/led_proc_init.soc new file mode 100644 index 000000000000..296f8746f101 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/led_proc_init.soc @@ -0,0 +1,273 @@ +#LED processor initialization for Inventec Sequoia platform + +led 0 stop +led 0 prog 02 00 60 F1 12 00 DA 0F 70 10 67 72 67 6D 77 06 02 A0 60 F0 02 00 60 F2 12 00 02 00 60 F4 06 F0 4A 01 71 41 4A 03 27 67 6D 4A 02 27 67 6D 06 F2 28 32 08 67 6D 06 F2 28 32 00 32 01 B7 67 6D 77 4D 67 75 67 6D 67 75 67 6D 67 72 67 6D DA A0 70 5F 86 F0 86 F2 86 F4 06 F4 D2 04 74 2E 77 1A 12 00 DA 00 70 6B 67 75 67 6D 77 61 3E F1 87 86 F1 81 57 17 27 57 07 27 57 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=59 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=57 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=58 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=51 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=49 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=50 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=61 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=62 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=55 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=53 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=54 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=43 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=41 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=42 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=35 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=33 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=34 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=45 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=46 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=39 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=37 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=38 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=27 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=25 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=26 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=19 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=17 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=18 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=31 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=29 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=30 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=23 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=21 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=22 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=11 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=9 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=10 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=3 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=1 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=2 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=15 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=13 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=14 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=7 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=5 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=6 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=4 +led 0 start + +led 1 stop +led 1 prog 02 00 60 F1 12 00 DA 0F 70 10 67 72 67 6D 77 06 02 A0 60 F0 02 00 60 F2 12 00 02 00 60 F4 06 F0 4A 01 71 41 4A 03 27 67 6D 4A 02 27 67 6D 06 F2 28 32 08 67 6D 06 F2 28 32 00 32 01 B7 67 6D 77 4D 67 75 67 6D 67 75 67 6D 67 72 67 6D DA A0 70 5F 86 F0 86 F2 86 F4 06 F4 D2 04 74 2E 77 1A 12 00 DA 00 70 6B 67 75 67 6D 77 61 3E F1 87 86 F1 81 57 17 27 57 07 27 57 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=7 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=5 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=6 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=15 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=13 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=14 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=3 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=1 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=2 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=11 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=9 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=10 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=23 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=21 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=22 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=31 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=29 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=30 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=19 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=17 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=18 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=27 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=25 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=26 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=39 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=37 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=38 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=47 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=45 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=46 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=35 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=33 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=34 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=43 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=41 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=42 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=55 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=53 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=54 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=61 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=62 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=60 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=51 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=49 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=50 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=59 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=57 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=58 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=56 +led 1 start + +led 2 stop +led 2 prog 02 00 60 F1 12 00 DA 0F 70 10 67 72 67 6D 77 06 02 A0 60 F0 02 00 60 F2 12 00 02 00 60 F4 06 F0 4A 01 71 41 4A 03 27 67 6D 4A 02 27 67 6D 06 F2 28 32 08 67 6D 06 F2 28 32 00 32 01 B7 67 6D 77 4D 67 75 67 6D 67 75 67 6D 67 72 67 6D DA A0 70 5F 86 F0 86 F2 86 F4 06 F4 D2 04 74 2E 77 1A 12 00 DA 00 70 6B 67 75 67 6D 77 61 3E F1 87 86 F1 81 57 17 27 57 07 27 57 +m CMIC_LEDUP2_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=59 +m CMIC_LEDUP2_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=57 +m CMIC_LEDUP2_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=58 +m CMIC_LEDUP2_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=56 +m CMIC_LEDUP2_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=51 +m CMIC_LEDUP2_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=49 +m CMIC_LEDUP2_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=50 +m CMIC_LEDUP2_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=48 +m CMIC_LEDUP2_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=63 +m CMIC_LEDUP2_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=61 +m CMIC_LEDUP2_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=62 +m CMIC_LEDUP2_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=60 +m CMIC_LEDUP2_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=55 +m CMIC_LEDUP2_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=53 +m CMIC_LEDUP2_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=54 +m CMIC_LEDUP2_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=52 +m CMIC_LEDUP2_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=43 +m CMIC_LEDUP2_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=41 +m CMIC_LEDUP2_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=42 +m CMIC_LEDUP2_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=40 +m CMIC_LEDUP2_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=35 +m CMIC_LEDUP2_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=33 +m CMIC_LEDUP2_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=34 +m CMIC_LEDUP2_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=32 +m CMIC_LEDUP2_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=47 +m CMIC_LEDUP2_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=45 +m CMIC_LEDUP2_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=46 +m CMIC_LEDUP2_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=44 +m CMIC_LEDUP2_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=39 +m CMIC_LEDUP2_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=37 +m CMIC_LEDUP2_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=38 +m CMIC_LEDUP2_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=36 +m CMIC_LEDUP2_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=27 +m CMIC_LEDUP2_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=25 +m CMIC_LEDUP2_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=26 +m CMIC_LEDUP2_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=24 +m CMIC_LEDUP2_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=19 +m CMIC_LEDUP2_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=17 +m CMIC_LEDUP2_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=18 +m CMIC_LEDUP2_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=16 +m CMIC_LEDUP2_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=31 +m CMIC_LEDUP2_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=29 +m CMIC_LEDUP2_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=30 +m CMIC_LEDUP2_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=28 +m CMIC_LEDUP2_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=23 +m CMIC_LEDUP2_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=21 +m CMIC_LEDUP2_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=22 +m CMIC_LEDUP2_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=20 +m CMIC_LEDUP2_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=11 +m CMIC_LEDUP2_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=9 +m CMIC_LEDUP2_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=10 +m CMIC_LEDUP2_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=8 +m CMIC_LEDUP2_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=3 +m CMIC_LEDUP2_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=1 +m CMIC_LEDUP2_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=2 +m CMIC_LEDUP2_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=0 +m CMIC_LEDUP2_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=15 +m CMIC_LEDUP2_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=13 +m CMIC_LEDUP2_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=14 +m CMIC_LEDUP2_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=12 +m CMIC_LEDUP2_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=7 +m CMIC_LEDUP2_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=5 +m CMIC_LEDUP2_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=6 +m CMIC_LEDUP2_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=4 +led 2 start + +led 3 stop +led 3 prog 02 00 60 F1 12 00 DA 0F 70 10 67 72 67 6D 77 06 02 A0 60 F0 02 00 60 F2 12 00 02 00 60 F4 06 F0 4A 01 71 41 4A 03 27 67 6D 4A 02 27 67 6D 06 F2 28 32 08 67 6D 06 F2 28 32 00 32 01 B7 67 6D 77 4D 67 75 67 6D 67 75 67 6D 67 72 67 6D DA A0 70 5F 86 F0 86 F2 86 F4 06 F4 D2 04 74 2E 77 1A 12 00 DA 00 70 6B 67 75 67 6D 77 61 3E F1 87 86 F1 81 57 17 27 57 07 27 57 +m CMIC_LEDUP3_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=7 +m CMIC_LEDUP3_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=5 +m CMIC_LEDUP3_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=6 +m CMIC_LEDUP3_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=4 +m CMIC_LEDUP3_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=15 +m CMIC_LEDUP3_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=13 +m CMIC_LEDUP3_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=14 +m CMIC_LEDUP3_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=12 +m CMIC_LEDUP3_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=3 +m CMIC_LEDUP3_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=1 +m CMIC_LEDUP3_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=2 +m CMIC_LEDUP3_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=0 +m CMIC_LEDUP3_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=11 +m CMIC_LEDUP3_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=9 +m CMIC_LEDUP3_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=10 +m CMIC_LEDUP3_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=8 +m CMIC_LEDUP3_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=23 +m CMIC_LEDUP3_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=21 +m CMIC_LEDUP3_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=22 +m CMIC_LEDUP3_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=20 +m CMIC_LEDUP3_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=31 +m CMIC_LEDUP3_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=29 +m CMIC_LEDUP3_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=30 +m CMIC_LEDUP3_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=28 +m CMIC_LEDUP3_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=19 +m CMIC_LEDUP3_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=17 +m CMIC_LEDUP3_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=18 +m CMIC_LEDUP3_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=16 +m CMIC_LEDUP3_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=27 +m CMIC_LEDUP3_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=25 +m CMIC_LEDUP3_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=26 +m CMIC_LEDUP3_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=24 +m CMIC_LEDUP3_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=39 +m CMIC_LEDUP3_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=37 +m CMIC_LEDUP3_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=38 +m CMIC_LEDUP3_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=36 +m CMIC_LEDUP3_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=47 +m CMIC_LEDUP3_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=45 +m CMIC_LEDUP3_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=46 +m CMIC_LEDUP3_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=44 +m CMIC_LEDUP3_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=35 +m CMIC_LEDUP3_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=33 +m CMIC_LEDUP3_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=34 +m CMIC_LEDUP3_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=32 +m CMIC_LEDUP3_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=43 +m CMIC_LEDUP3_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=41 +m CMIC_LEDUP3_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=42 +m CMIC_LEDUP3_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=40 +m CMIC_LEDUP3_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=55 +m CMIC_LEDUP3_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=53 +m CMIC_LEDUP3_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=54 +m CMIC_LEDUP3_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=52 +m CMIC_LEDUP3_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=63 +m CMIC_LEDUP3_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=61 +m CMIC_LEDUP3_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=62 +m CMIC_LEDUP3_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=60 +m CMIC_LEDUP3_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=51 +m CMIC_LEDUP3_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=49 +m CMIC_LEDUP3_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=50 +m CMIC_LEDUP3_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=48 +m CMIC_LEDUP3_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=59 +m CMIC_LEDUP3_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=57 +m CMIC_LEDUP3_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=58 +m CMIC_LEDUP3_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=56 +led 3 start diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/minigraph.xml b/device/inventec/x86_64-inventec_d7264q28b-r0/minigraph.xml new file mode 100644 index 000000000000..b68f712b2624 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/minigraph.xml @@ -0,0 +1,144 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + SONiC-Inventec-d7264 + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + SONiC-Inventec-d7264 + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + SONiC-Inventec-d7264 + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + SONiC-Inventec-d7264 + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + SONiC-Inventec-d7264 + Ethernet0 + + + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + SONiC-Inventec-d7264 + Ethernet4 + + + + + SONiC-Inventec-d7264 + INVENTEC-D7264Q28B + + + + + + + SONiC-Inventec-d7264 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + SONiC-Inventec-d7264 + INVENTEC-D7264Q28B +
diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/eeprom.py b/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/eeprom.py new file mode 100644 index 000000000000..de5c24ba0e6d --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Inventec d7032q28b +# +# 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-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/psuutil.py b/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/psuutil.py new file mode 100755 index 000000000000..c2337a97f4ea --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/psuutil.py @@ -0,0 +1,93 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + PSU_DIR1 = "/sys/class/hwmon/hwmon1/device" + PSU_DIR2 = "/sys/class/hwmon/hwmon3/device" + + def __init__(self): + PsuBase.__init__(self) + +# Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip(' \t\n\r') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psoc_psu'+ str(index) + '_iout' + attr_path = self.PSU_DIR1 +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + if (attr_value == 'ERR'): + attr_path = self.PSU_DIR2 +'/' + attr_file + attr_value = self.get_attr_value(attr_path) + # Check for PSU status + if (attr_value != 0): + status = 1 + if (attr_value != 0): + status = 1 + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + ind = index-1 + attr_file ='psu'+ str(ind) + normal_attr_value = '0 : normal' + attr_path = self.PSU_DIR1 +'/' + attr_file + attr_value = self.get_attr_value(attr_path) + if (attr_value == 'ERR'): + attr_path = self.PSU_DIR2 +'/' + attr_file + attr_value = self.get_attr_value(attr_path) + # Check for PSU presence + if (attr_value == normal_attr_value): + status = 1 + if (attr_value == normal_attr_value): + status = 1 + return status diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/sfputil.py new file mode 100755 index 000000000000..aa551932dc78 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/sfputil.py @@ -0,0 +1,219 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 63 + PORTS_IN_BLOCK = 64 + QSFP_PORT_START = 0 + QSFP_PORT_END = 63 + + _port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: 10, + 1: 11, + 2: 12, + 3: 13, + 4: 14, + 5: 15, + 6: 16, + 7: 17, + 8: 18, + 9: 19, + 10: 20, + 11: 21, + 12: 22, + 13: 23, + 14: 24, + 15: 25, + 16: 26, + 17: 27, + 18: 28, + 19: 29, + 20: 30, + 21: 31, + 22: 32, + 23: 33, + 24: 34, + 25: 35, + 26: 36, + 27: 37, + 28: 38, + 29: 39, + 30: 40, + 31: 41, + 32: 45, + 33: 44, + 34: 43, + 35: 42, + 36: 49, + 37: 48, + 38: 47, + 39: 46, + 40: 53, + 41: 52, + 42: 51, + 43: 50, + 44: 57, + 45: 56, + 46: 55, + 47: 54, + 48: 61, + 49: 60, + 50: 59, + 51: 58, + 52: 65, + 53: 64, + 54: 63, + 55: 62, + 56: 69, + 57: 68, + 58: 67, + 59: 66, + 60: 73, + 61: 72, + 62: 71, + 63: 70 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/bus/i2c/devices/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/present") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + print "\nError:SFP's don't support this property" + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = 1 + else: + reg_value = 0 + + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/class/swps/port"+str(port_num)+"/reset" + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + print "\nError:SFP's don't support this property" + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 0 + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 2 second to allow it to settle + time.sleep(2) + + # Flip the value back write back to the register to take port out of reset + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 1 + reg_file.write(hex(reg_value)) + reg_file.close() + + return True diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 8b24216d0a9d..29b0f20ef01b 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -22,6 +22,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(ACCTON_AS7716_32XB_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ + $(INVENTEC_D7264Q28B_PLATFORM_MODULE) \ $(CEL_DX010_PLATFORM_MODULE) \ $(CEL_HALIBURTON_PLATFORM_MODULE) \ $(DELTA_AG9032V1_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-inventec.mk b/platform/broadcom/platform-modules-inventec.mk index 0960c2aefbcc..2a6f32f923c4 100644 --- a/platform/broadcom/platform-modules-inventec.mk +++ b/platform/broadcom/platform-modules-inventec.mk @@ -1,10 +1,12 @@ -# Inventec d7032q28b and d7054q28b Platform modules +# Inventec d7032q28b , d7054q28b and d7264q28b Platform modules INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION = 1.1.0 INVENTEC_D7054Q28B_PLATFORM_MODULE_VERSION = 1.1.0 +INVENTEC_D7264Q28B_PLATFORM_MODULE_VERSION = 1.1.0 export INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION export INVENTEC_D7054Q28B_PLATFORM_MODULE_VERSION +export INVENTEC_D7264Q28B_PLATFORM_MODULE_VERSION INVENTEC_D7032Q28B_PLATFORM_MODULE = platform-modules-d7032q28b_$(INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION)_amd64.deb $(INVENTEC_D7032Q28B_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-inventec @@ -16,4 +18,8 @@ INVENTEC_D7054Q28B_PLATFORM_MODULE = platform-modules-d7054q28b_$(INVENTEC_D7054 $(INVENTEC_D7054Q28B_PLATFORM_MODULE)_PLATFORM = x86_64-inventec_d7054q28b-r0 $(eval $(call add_extra_package,$(INVENTEC_D7032Q28B_PLATFORM_MODULE),$(INVENTEC_D7054Q28B_PLATFORM_MODULE))) -SONIC_STRETCH_DEBS += $(INVENTEC_D7032Q28B_PLATFORM_MODULE) +INVENTEC_D7264Q28B_PLATFORM_MODULE = platform-modules-d7264q28b_$(INVENTEC_D7264Q28B_PLATFORM_MODULE_VERSION)_amd64.deb +$(INVENTEC_D7264Q28B_PLATFORM_MODULE)_PLATFORM = x86_64-inventec_d7264q28b-r0 +$(eval $(call add_extra_package,$(INVENTEC_D7032Q28B_PLATFORM_MODULE),$(INVENTEC_D7264Q28B_PLATFORM_MODULE))) + +SONIC_STRETCH_DEBS += $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/Makefile b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/Makefile new file mode 100755 index 000000000000..aeffa4376588 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/Makefile @@ -0,0 +1,6 @@ +obj-m += inv_cpld.o inv_psoc.o +obj-m += inv_platform.o +obj-m += inv_eeprom.o +obj-m += swps.o +swps-objs := inv_swps.o io_expander.o transceiver.o + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_cpld.c b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_cpld.c new file mode 100644 index 000000000000..42401d626672 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_cpld.c @@ -0,0 +1,470 @@ +/* + * 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 "I2CHostCommunication.h" + +#define USE_SMBUS 1 + +/* definition */ +#define CPLD_INFO_OFFSET 0x00 +#define CPLD_PSU_OFFSET 0x08 +#define CPLD_LED_OFFSET 0x0E +#define CPLD_LED_STATU_OFFSET 0x0D +#define CPLD_CTL_OFFSET 0x0C +#define CPLD_BIOSCS_OFFSET 0x04 + + +/* Each client has this additional data */ +struct cpld_data { + struct device *hwmon_dev; + struct mutex update_lock; +}; + +/*-----------------------------------------------------------------------*/ + +static ssize_t cpld_i2c_read(struct i2c_client *client, u8 *buf, u8 offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg[0].buf = msgbuf; + msg[0].len = 1; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + status = i2c_transfer(client->adapter, msg, 2); + + if(status == 2) + status = count; + + return status; +#endif +} + +static ssize_t cpld_i2c_write(struct i2c_client *client, char *buf, unsigned offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + return status; +#endif +} + +/*-----------------------------------------------------------------------*/ + +/* sysfs attributes for hwmon */ + +static ssize_t show_info(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[4]; + + memset(b, 0, 4); + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, b, CPLD_INFO_OFFSET, 4); + mutex_unlock(&data->update_lock); + + if(status != 4) return sprintf(buf, "read cpld info fail\n"); + + status = sprintf (buf, "The CPLD release date is %02d/%02d/%d.\n", b[2] & 0xf, (b[3] & 0x1f), 2014+(b[2] >> 4)); /* mm/dd/yyyy*/ + status = sprintf (buf, "%sThe PCB version is %X%X\n", buf, b[0]>>4, b[0]&0xf); + status = sprintf (buf, "%sThe CPLD version is %d.%d\n", buf, b[1]>>4, b[1]&0xf); + + return strlen(buf); +} + + +static ssize_t show_ctl(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[1]; + + mutex_lock(&data->update_lock); + + status = cpld_i2c_read(client, b, CPLD_CTL_OFFSET, 1); + + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld ctl fail\n"); + + + status = sprintf (buf, "0x%X\n", b[0]); + + return strlen(buf); +} + +static ssize_t set_ctl(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + + u8 temp = simple_strtol(buf, NULL, 10); + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_CTL_OFFSET, 1); + if(temp) byte |= (1<<0); + else byte &= ~(1<<0); + cpld_i2c_write(client, &byte, CPLD_CTL_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_bios_cs(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[1]; + + mutex_lock(&data->update_lock); + + status = cpld_i2c_read(client, b, CPLD_BIOSCS_OFFSET, 1); + + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld BIOS_CS fail\n"); + + + status = sprintf (buf, "0x%X\n", b[0] & 0x01); + + return strlen(buf); +} + +static ssize_t set_bios_cs(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + + u8 temp = simple_strtol(buf, NULL, 10); + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_BIOSCS_OFFSET, 1); + if(temp) byte |= 0x01; + else byte &= ~(0x01); + cpld_i2c_write(client, &byte, CPLD_BIOSCS_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + + +static char* led_str[] = { + "OFF", //000 + "0.5 Hz", //001 + "1 Hz", //010 + "2 Hz", //011 + "4 Hz", //100 + "NA", //101 + "NA", //110 + "ON", //111 +}; + +static ssize_t show_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 0)?3:0; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_LED_OFFSET, 1); + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld offset 0x%x\n", CPLD_LED_OFFSET); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d: %s\n", byte, led_str[byte]); + + return strlen(buf); +} + +static ssize_t set_led(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + + u8 temp = simple_strtol(buf, NULL, 16); + u8 byte; + int shift = (attr->index == 0)?3:0; + + temp &= 0x7; + //validate temp value: 0,1,2,3,7, TBD + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_LED_OFFSET, 1); + byte &= ~(0x7<update_lock); + + return count; +} + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu0 | psu1 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 1)?0:3; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_PSU_OFFSET, 1); + mutex_unlock(&data->update_lock); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + + +static SENSOR_DEVICE_ATTR(info, S_IRUGO, show_info, 0, 0); +static SENSOR_DEVICE_ATTR(ctl, S_IWUSR|S_IRUGO, show_ctl, set_ctl, 0); + +static SENSOR_DEVICE_ATTR(grn_led, S_IWUSR|S_IRUGO, show_led, set_led, 0); +static SENSOR_DEVICE_ATTR(red_led, S_IWUSR|S_IRUGO, show_led, set_led, 1); + +static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu, 0, 0); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu, 0, 1); + +static SENSOR_DEVICE_ATTR(bios_cs, S_IWUSR|S_IRUGO, show_bios_cs, set_bios_cs, 0); + +static struct attribute *cpld_attributes[] = { + //info + &sensor_dev_attr_info.dev_attr.attr, + &sensor_dev_attr_ctl.dev_attr.attr, + + &sensor_dev_attr_grn_led.dev_attr.attr, + &sensor_dev_attr_red_led.dev_attr.attr, + + &sensor_dev_attr_psu0.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + + &sensor_dev_attr_bios_cs.dev_attr.attr, + NULL +}; + +static const struct attribute_group cpld_group = { + .attrs = cpld_attributes, +}; + +static struct attribute *cpld2_attributes[] = { + //info + &sensor_dev_attr_info.dev_attr.attr, + + NULL +}; + +static const struct attribute_group cpld2_group = { + .attrs = cpld2_attributes, +}; + + +/*-----------------------------------------------------------------------*/ + +/* device probe and removal */ + +static int +cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct cpld_data *data; + int status; + +// printk("+%s \n", __func__); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + return -EIO; + + data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* Register sysfs hooks */ + if(id->driver_data==1) // CPLD2 + status = sysfs_create_group(&client->dev.kobj, &cpld2_group); + else // default CPLD1 + status = sysfs_create_group(&client->dev.kobj, &cpld_group); + + if (status) + goto exit_free; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &cpld_group); +exit_free: + i2c_set_clientdata(client, NULL); + kfree(data); + return status; +} + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cpld_group); + i2c_set_clientdata(client, NULL); + kfree(data); + return 0; +} + +static const struct i2c_device_id cpld_ids[] = { + { "inv_cpld" , 0, }, + { "inv_cpld2", 1, }, + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, cpld_ids); + +static struct i2c_driver cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "inv_cpld", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_ids, +}; + +/*-----------------------------------------------------------------------*/ + +/* module glue */ + +static int __init inv_cpld_init(void) +{ + return i2c_add_driver(&cpld_driver); +} + +static void __exit inv_cpld_exit(void) +{ + i2c_del_driver(&cpld_driver); +} + +MODULE_AUTHOR("eddie.lan "); +MODULE_DESCRIPTION("inv cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_cpld_init); +module_exit(inv_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_eeprom.c b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_eeprom.c new file mode 100644 index 000000000000..3d13f3b04719 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_eeprom.c @@ -0,0 +1,181 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void inv_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, ((u8)addr >> 8) & 0xFF, (u8)addr & 0xFF); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } + +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t inv_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + inv_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static struct bin_attribute inv_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = inv_eeprom_read, +}; + +static int inv_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &inv_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int inv_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &inv_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id inv_eeprom_id[] = { + { "inv_eeprom", 0 }, + { } +}; + +static struct i2c_driver inv_eeprom_driver = { + .driver = { + .name = "inv_eeprom", + }, + .probe = inv_eeprom_probe, + .remove = inv_eeprom_remove, + .id_table = inv_eeprom_id, +}; + +module_i2c_driver(inv_eeprom_driver); + +MODULE_AUTHOR("Inventec"); +MODULE_DESCRIPTION("Inventec D7054 Mother Board EEPROM driver"); +MODULE_LICENSE("GPL"); + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_platform.c b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_platform.c new file mode 100644 index 000000000000..720a4cd2257b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_platform.c @@ -0,0 +1,239 @@ +#include +//#include +#include +#include +#include +#include +#include +#include +#include +//#include +//#include + +//#include +//#define IO_EXPAND_BASE 64 +//#define IO_EXPAND_NGPIO 16 + +struct inv_i2c_board_info { + int ch; + int size; + struct i2c_board_info *board_info; +}; + +#define bus_id(id) (id) +static struct pca954x_platform_mode mux_modes_0[] = { + {.adap_id = bus_id(2),}, {.adap_id = bus_id(3),}, + {.adap_id = bus_id(4),}, {.adap_id = bus_id(5),}, + {.adap_id = bus_id(6),}, {.adap_id = bus_id(7),}, + {.adap_id = bus_id(8),}, {.adap_id = bus_id(9),}, +}; +static struct pca954x_platform_mode mux_modes_0_0[] = { + {.adap_id = bus_id(10),}, {.adap_id = bus_id(11),}, + {.adap_id = bus_id(12),}, {.adap_id = bus_id(13),}, + {.adap_id = bus_id(14),}, {.adap_id = bus_id(15),}, + {.adap_id = bus_id(16),}, {.adap_id = bus_id(17),}, +}; + +static struct pca954x_platform_mode mux_modes_0_1[] = { + {.adap_id = bus_id(18),}, {.adap_id = bus_id(19),}, + {.adap_id = bus_id(20),}, {.adap_id = bus_id(21),}, + {.adap_id = bus_id(22),}, {.adap_id = bus_id(23),}, + {.adap_id = bus_id(24),}, {.adap_id = bus_id(25),}, +}; + +static struct pca954x_platform_mode mux_modes_0_2[] = { + {.adap_id = bus_id(26),}, {.adap_id = bus_id(27),}, + {.adap_id = bus_id(28),}, {.adap_id = bus_id(29),}, + {.adap_id = bus_id(30),}, {.adap_id = bus_id(31),}, + {.adap_id = bus_id(32),}, {.adap_id = bus_id(33),}, +}; + +static struct pca954x_platform_mode mux_modes_0_3[] = { + {.adap_id = bus_id(34),}, {.adap_id = bus_id(35),}, + {.adap_id = bus_id(36),}, {.adap_id = bus_id(37),}, + {.adap_id = bus_id(38),}, {.adap_id = bus_id(39),}, + {.adap_id = bus_id(40),}, {.adap_id = bus_id(41),}, +}; + +static struct pca954x_platform_mode mux_modes_0_4[] = { + {.adap_id = bus_id(42),}, {.adap_id = bus_id(43),}, + {.adap_id = bus_id(44),}, {.adap_id = bus_id(45),}, + {.adap_id = bus_id(46),}, {.adap_id = bus_id(47),}, + {.adap_id = bus_id(48),}, {.adap_id = bus_id(49),}, +}; + +static struct pca954x_platform_mode mux_modes_0_5[] = { + {.adap_id = bus_id(50),}, {.adap_id = bus_id(51),}, + {.adap_id = bus_id(52),}, {.adap_id = bus_id(53),}, + {.adap_id = bus_id(54),}, {.adap_id = bus_id(55),}, + {.adap_id = bus_id(56),}, {.adap_id = bus_id(57),}, +}; + +static struct pca954x_platform_mode mux_modes_0_6[] = { + {.adap_id = bus_id(58),}, {.adap_id = bus_id(59),}, + {.adap_id = bus_id(60),}, {.adap_id = bus_id(61),}, + {.adap_id = bus_id(62),}, {.adap_id = bus_id(63),}, + {.adap_id = bus_id(64),}, {.adap_id = bus_id(65),}, +}; + +static struct pca954x_platform_mode mux_modes_0_7[] = { + {.adap_id = bus_id(66),}, {.adap_id = bus_id(67),}, + {.adap_id = bus_id(68),}, {.adap_id = bus_id(69),}, + {.adap_id = bus_id(70),}, {.adap_id = bus_id(71),}, + {.adap_id = bus_id(72),}, {.adap_id = bus_id(73),}, +}; + +//no i2c device driver attach to mux 7 + + +static struct pca954x_platform_data mux_data_0 = { + .modes = mux_modes_0, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_0 = { + .modes = mux_modes_0_0, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_1 = { + .modes = mux_modes_0_1, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_2 = { + .modes = mux_modes_0_2, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_3 = { + .modes = mux_modes_0_3, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_4 = { + .modes = mux_modes_0_4, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_5 = { + .modes = mux_modes_0_5, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_6 = { + .modes = mux_modes_0_6, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_7 = { + .modes = mux_modes_0_7, + .num_modes = 8, +}; + +static struct i2c_board_info i2c_device_info0[] __initdata = { +// {"inv_psoc", 0, 0x66, 0, 0, 0},//psoc + {"inv_cpld", 0, 0x55, 0, 0, 0},//cpld + {"inv_cpld2", 0, 0x77, 0, 0, 0},//cpld2 + {"pca9548", 0, 0x70, &mux_data_0, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info2[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_0, 0, 0}, +}; +static struct i2c_board_info i2c_device_info3[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_1, 0, 0}, +}; +static struct i2c_board_info i2c_device_info4[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_2, 0, 0}, +}; +static struct i2c_board_info i2c_device_info5[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_3, 0, 0}, +}; +static struct i2c_board_info i2c_device_info6[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_4, 0, 0}, +}; +static struct i2c_board_info i2c_device_info7[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_5, 0, 0}, +}; +static struct i2c_board_info i2c_device_info8[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_6, 0, 0}, +}; +static struct i2c_board_info i2c_device_info9[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_7, 0, 0}, +}; + + +static struct inv_i2c_board_info i2cdev_list[] = { + {0, ARRAY_SIZE(i2c_device_info0), i2c_device_info0 }, //smbus 0 + + {bus_id(2), ARRAY_SIZE(i2c_device_info2), i2c_device_info2 }, //mux 0 + {bus_id(3), ARRAY_SIZE(i2c_device_info3), i2c_device_info3 }, //mux 1 + {bus_id(4), ARRAY_SIZE(i2c_device_info4), i2c_device_info4 }, //mux 2 + {bus_id(5), ARRAY_SIZE(i2c_device_info5), i2c_device_info5 }, //mux 3 + {bus_id(6), ARRAY_SIZE(i2c_device_info6), i2c_device_info6 }, //mux 4 + {bus_id(7), ARRAY_SIZE(i2c_device_info7), i2c_device_info7 }, //mux 5 + {bus_id(8), ARRAY_SIZE(i2c_device_info8), i2c_device_info8 }, //mux 6 + {bus_id(9), ARRAY_SIZE(i2c_device_info9), i2c_device_info9 }, //mux 7 + +}; + +///////////////////////////////////////////////////////////////////////////////////////// +#if 0 +static struct i2c_gpio_platform_data i2c_gpio_platdata0 = { + .scl_pin = 58, + .sda_pin = 75, + + .udelay = 5, //5:100kHz + .sda_is_open_drain = 0, + .scl_is_open_drain = 0, + .scl_is_output_only = 0 +}; + +static struct platform_device device_i2c_gpio0 = { + .name = "i2c-gpio", + .id = 1, // adapter number + .dev.platform_data = &i2c_gpio_platdata0, +}; +#endif +static int __init inv_platform_init(void) +{ + struct i2c_adapter *adap = NULL; + struct i2c_client *e = NULL; + int ret = 0; + int i,j,k; + + printk("%s \n", __func__); + +#if 0 + //use i2c-gpio + //register i2c gpio + //config gpio58,75 to gpio function 58=32+3*8+2 75=32*2+8*1+3 gpio69=32*2+8*0+5 + outl( inl(0x533) | (1<<2), 0x533); + outl( inl(0x541) | (1<<3), 0x541); + outl( inl(0x540) | (1<<5), 0x540); //RST_I2C_MUX_N (GPIO69) + outl( inl(0x500) | (1<<7), 0x500); //SYS_RDY_N (GPIO7) + outl( inl(0x501) | (1<<7), 0x501); //BMC_HEART_BEAT (GPIO15) + outl( inl(0x503) | (1<<2)|(1<<3), 0x503); //PSOC_HEART_BEAT(26),CPLD_HEART_BEAT(27) + + ret = platform_device_register(&device_i2c_gpio0); + if (ret) { + printk(KERN_ERR "i2c-gpio: device_i2c_gpio0 register fail %d\n", ret); + } +#endif + for(i=0; i +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//================================= +#include +#include +#include +#include + +#define IPMI_MAX_INTF (4) +#define NETFN_OEM 0x30 +#define CMD_GETDATA 0x31 +#define CMD_SETDATA 0x32 +#define FAN_NUM 4 +#define PSU_NUM 2 + +#define PSU1 0x5800 +#define PSU2 0x5900 +#define BMC_PMBusNumber 3 +#define PMBus_Vender 0x99 +#define PMBus_Serial 0x9E +#define PMBus_Temp2 0x8E +#define PMBus_Version 0x9B +#define MaxLeng_Result 0x20 + +#define MAX_IPMI_RECV_LENGTH 0xff + +static long pmbus_reg2data_linear(int data, int linear16); +struct ipmi_result{ + char result[MAX_IPMI_RECV_LENGTH]; + int result_length; +}; + +DEFINE_MUTEX(ipmi_mutex); +DEFINE_MUTEX(ipmi2_mutex); +static struct ipmi_result ipmiresult; +static struct device *hwmon_dev; +static struct kobject *device_kobj; +static ipmi_user_t ipmi_mh_user = NULL; +static void msg_handler(struct ipmi_recv_msg *msg,void* handler_data); +static struct ipmi_user_hndl ipmi_hndlrs = { .ipmi_recv_hndl = msg_handler,}; + +static atomic_t dummy_count = ATOMIC_INIT(0); +static void dummy_smi_free(struct ipmi_smi_msg *msg) +{ + atomic_dec(&dummy_count); +} +static void dummy_recv_free(struct ipmi_recv_msg *msg) +{ + atomic_dec(&dummy_count); +} +static struct ipmi_smi_msg halt_smi_msg = { + .done = dummy_smi_free +}; +static struct ipmi_recv_msg halt_recv_msg = { + .done = dummy_recv_free +}; + +struct __attribute__ ((__packed__)) psoc_psu_layout { + u16 psu1_iin; + u16 psu2_iin; + u16 psu1_iout; + u16 psu2_iout; + + u16 psu1_pin; + u16 psu2_pin; + u16 psu1_pout; + u16 psu2_pout; + + u16 psu1_vin; + u16 psu2_vin; + u16 psu1_vout; + u16 psu2_vout; +}; + +struct __attribute__ ((__packed__)) psoc_layout { + u8 ctl; //offset: 0 + u16 switch_temp; //offset: 1 + u8 reserve0; //offset: 3 + + u8 fw_upgrade; //offset: 4 + + //i2c bridge + u8 i2c_st; //offset: 5 + u8 i2c_ctl; //offset: 6 + u8 i2c_addr; //offset: 7 + u8 i2c_data[0x20]; //offset: 8 + + //gpo + u8 led_ctl; //offset: 28 + + u8 gpio; //offset: 29 + + //pwm duty + u8 pwm[FAN_NUM]; //offset: 2a + u8 pwm_psu[PSU_NUM]; //offset: 2e + + //fan rpm + u16 fan[FAN_NUM*2]; //offset: 30 + + u8 reserve1[4]; //offset: 40 + + //gpi + u8 gpi_fan; //offset: 44 + + //psu state + u8 psu_state; //offset: 45 + + //temperature + u16 temp[5]; //offset: 46 + u16 temp_psu[PSU_NUM]; //offset: 50 + + //version + u8 version[2]; //offset: 54 + + u8 reserve2[4]; //offset: 56 + struct psoc_psu_layout psu_info; //offset: 5a +}; + +/* definition */ +/* definition */ +#define PSOC_OFF(m) offsetof(struct psoc_layout, m) +#define PSOC_PSU_OFF(m) offsetof(struct psoc_psu_layout, m) + +#define SWITCH_TMP_OFFSET PSOC_OFF(switch_temp) +#define PWM_OFFSET PSOC_OFF(pwm) +#define THERMAL_OFFSET PSOC_OFF(temp) +#define RPM_OFFSET PSOC_OFF(fan) +#define DIAG_FLAG_OFFSET PSOC_OFF(ctl) +#define FAN_LED_OFFSET PSOC_OFF(led_ctl) +#define FAN_GPI_OFFSET PSOC_OFF(gpi_fan) +#define PSOC_PSU_OFFSET PSOC_OFF(psu_state) +#define VERSION_OFFSET PSOC_OFF(version) +#define PSU_INFO_OFFSET PSOC_OFF(psu_info) + + +static void msg_handler(struct ipmi_recv_msg *recv_msg,void* handler_data) +{ + struct ipmi_result *msg_result = recv_msg->user_msg_data; + + if(recv_msg->msg.data[0]==0 && recv_msg->msg.data_len>0) { + msg_result->result_length=recv_msg->msg.data_len-1; + memcpy(msg_result->result, &recv_msg->msg.data[1], recv_msg->msg.data_len-1); + } + ipmi_free_recv_msg(recv_msg); + mutex_unlock(&ipmi_mutex); + + return; +} + +int start_ipmi_command(char NetFn, char cmd,char *data,int data_length, char* result, int* result_length) +{ + int rv=0,i; + int timeout; + + //wait previous command finish at least 50msec + timeout=50; + while((mutex_is_locked(&ipmi_mutex) == 1 || (mutex_is_locked(&ipmi2_mutex) == 1)) && (--timeout)>0) { usleep_range(1000,1010); } + if(timeout==0) { return -1; } + mutex_lock(&ipmi_mutex); + mutex_lock(&ipmi2_mutex); + + if(ipmi_mh_user == NULL) { + for (i=0,rv=1; i0) { usleep_range(1000,1100);} + if(timeout==0) { + mutex_unlock(&ipmi2_mutex); + return -1; + } + else { + *result_length=ipmiresult.result_length; + memcpy(result,ipmiresult.result,*result_length); + mutex_unlock(&ipmi2_mutex); + return 0; + } + } + return 0; +} +EXPORT_SYMBOL(start_ipmi_command); + +static ssize_t psoc_ipmi_read(u8 *buf, u8 offset, size_t count) +{ + uint8_t data[2]; + int result_len=0; + int rv; + + data[0] = offset; + data[1] = count; + + rv=start_ipmi_command(NETFN_OEM, CMD_GETDATA,data,2, buf, &result_len); + + return result_len; +} + +static ssize_t psoc_ipmi_write(char *buf, unsigned offset, size_t count) +{ + uint8_t data[count+1],result[1]; + int result_len; + + data[0] = offset; + memcpy(&data[1],buf,count); + + start_ipmi_command(NETFN_OEM, CMD_SETDATA,data,count+1, result, &result_len); + return count; +} + + +static u16 psoc_read16(u8 offset) +{ + u16 value = 0; + u8 buf[]={0,0}; + + if(psoc_ipmi_read(buf, offset, 2) == 2) + value = (buf[0]<<8 | buf[1]<<0); + + return value; +} + +static u8 psoc_read8(u8 offset) +{ + u8 value = 0; + u8 buf = 0; + + if(psoc_ipmi_read(&buf, offset, 1) == 1) + value = buf; + + return value; +} + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu1 | psu0 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu_st(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 byte=0; + int shift = (attr->index == 0)?3:0; + + status = psoc_ipmi_read(&byte, PSOC_PSU_OFFSET, 1); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + +static ssize_t show_ipmi_pmbus(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + uint8_t data[4],result[MaxLeng_Result]; + int result_len=0; + + data[0] = BMC_PMBusNumber; + data[1] = (attr->index & 0xFF00 ) >>7; + data[3] = attr->index & 0xff; + if(data[3]==PMBus_Temp2) + {data[2]=2;} + else + {data[2]=MaxLeng_Result;} + + if(start_ipmi_command(0x06, 0x52,data,4, result, &result_len)==0) + { + if(data[3]==PMBus_Temp2) + { + return sprintf(buf, "%ld \n", pmbus_reg2data_linear(result[0] | (result[1]<<8), 0 )); + } + result[result[0]+1]='\0'; + return sprintf(buf, "%s\n",&result[1] ); + } + else + { + return 0; + } +} + +static ssize_t show_thermal(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index * 2 + THERMAL_OFFSET; + + status = psoc_read16(offset); + + return sprintf(buf, "%d\n", + (s8)(status>>8) * 1000 ); +} + +static ssize_t show_pwm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index + PWM_OFFSET; + + status = psoc_read8(offset); + + return sprintf(buf, "%d\n", + status); +} + +static ssize_t set_pwm(struct device *dev, + struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index + PWM_OFFSET; + + u8 pwm = simple_strtol(buf, NULL, 10); + if(pwm > 255) pwm = 255; + + psoc_ipmi_write(&pwm, offset, 1); + + return count; +} + + +static ssize_t show_rpm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index*2 + RPM_OFFSET; + + status = psoc_read16(offset); + + return sprintf(buf, "%d\n", + status); +} + +static ssize_t show_switch_tmp(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status=0; + u16 temp = 0; + + status = psoc_ipmi_read((u8*)&temp, SWITCH_TMP_OFFSET, 2); + + status = sprintf (buf, "%d\n", (s8)(temp>>8) * 1000 ); + + return strlen(buf); +} + +static ssize_t set_switch_tmp(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + long temp = simple_strtol(buf, NULL, 10); + u16 temp2 = ( (temp/1000) <<8 ) & 0xFF00 ; + + //printk("set_switch_tmp temp=%d, temp2=0x%x (%x,%x)\n", temp, temp2, ( ( (temp/1000) <<8 ) & 0xFF00 ), (( (temp%1000) / 10 ) & 0xFF)); + psoc_ipmi_write((u8*)&temp2, SWITCH_TMP_OFFSET, 2); + + + return count; +} + +static ssize_t show_diag(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status=0; + u8 diag_flag = 0; + + status = psoc_ipmi_read((u8*)&diag_flag, DIAG_FLAG_OFFSET, 1); + + status = sprintf (buf, "%d\n", ((diag_flag & 0x80)?1:0)); + + return strlen(buf); +} + +static ssize_t set_diag(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + u8 value = 0; + u8 diag = simple_strtol(buf, NULL, 10); + + diag = diag?1:0; + + psoc_ipmi_read((u8*)&value, DIAG_FLAG_OFFSET, 1); + if(diag) value |= (1<<7); + else value &= ~(1<<7); + psoc_ipmi_write((u8*)&value, DIAG_FLAG_OFFSET, 1); + + return count; +} + +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status=0; + + status = psoc_read16(VERSION_OFFSET); + + return sprintf(buf, "ver: %x.%x\n", (status & 0xFF00)>>8, (status & 0xFF) ); +} + +static ssize_t show_name(struct device *dev, struct device_attribute *da, + char *buf) +{ + return sprintf (buf, "inv_psoc\n"); +} + + +static ssize_t show_fan_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 bit = attr->index; + + status = psoc_read8(FAN_LED_OFFSET); + + return sprintf(buf, "%d\n", + (status & (1<index; + u8 led_state = 0; + + u8 v = simple_strtol(buf, NULL, 10); + + led_state = psoc_read8(FAN_LED_OFFSET); + if(v) led_state |= (1<index; + + status = psoc_read8(offset); + + return sprintf(buf, "0x%02X\n", status ); +} + +static long pmbus_reg2data_linear(int data, int linear16) +{ + s16 exponent; + s32 mantissa; + long val; + + if (linear16) { /* LINEAR16 */ + exponent = -9; + mantissa = (u16) data; + } else { /* LINEAR11 */ + exponent = ((s16)data) >> 11; + exponent = ((s16)( data & 0xF800) ) >> 11; + mantissa = ((s32)((data & 0x7ff) << 5)) >> 5; + } + + //printk("data=%d, m=%d, e=%d\n", data, exponent, mantissa); + val = mantissa; + + /* scale result to micro-units for power sensors */ + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val; +} + +static ssize_t show_psu_psoc(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index + PSU_INFO_OFFSET; + + status = psoc_read16(offset); + + return sprintf(buf, "%ld \n", pmbus_reg2data_linear(status, strstr(attr->dev_attr.attr.name, "vout")? 1:0 )); +} + + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_thermal, 0, 0); +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_thermal, 0, 1); +static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_thermal, 0, 2); +static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_thermal, 0, 3); +static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_thermal, 0, 4); +static SENSOR_DEVICE_ATTR(thermal_psu1, S_IRUGO, show_thermal, 0, 5); +static SENSOR_DEVICE_ATTR(thermal_psu2, S_IRUGO, show_thermal, 0, 6); + +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 0); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 1); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 2); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 3); +static SENSOR_DEVICE_ATTR(pwm_psu1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 4); +static SENSOR_DEVICE_ATTR(pwm_psu2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 5); + +static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu_st, 0, 0); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu_st, 0, 1); + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_rpm, 0, 0); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_rpm, 0, 1); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_rpm, 0, 2); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_rpm, 0, 3); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_rpm, 0, 4); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_rpm, 0, 5); +static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_rpm, 0, 6); +static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_rpm, 0, 7); +static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8); +static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9); + +static SENSOR_DEVICE_ATTR(switch_tmp, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); + +static SENSOR_DEVICE_ATTR(diag, S_IWUSR|S_IRUGO, show_diag, set_diag, 0); +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, 0, 0); +static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); + +static SENSOR_DEVICE_ATTR(fan_led_grn1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 0); +static SENSOR_DEVICE_ATTR(fan_led_grn2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 1); +static SENSOR_DEVICE_ATTR(fan_led_grn3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 2); +static SENSOR_DEVICE_ATTR(fan_led_grn4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 3); +static SENSOR_DEVICE_ATTR(fan_led_red1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 4); +static SENSOR_DEVICE_ATTR(fan_led_red2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 5); +static SENSOR_DEVICE_ATTR(fan_led_red3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 6); +static SENSOR_DEVICE_ATTR(fan_led_red4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 7); + +static SENSOR_DEVICE_ATTR(fan_gpi, S_IRUGO, show_value8, 0, FAN_GPI_OFFSET); +static SENSOR_DEVICE_ATTR(psoc_psu1_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pout)); + + +static SENSOR_DEVICE_ATTR(psoc_psu2_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); + +//IPMI +static SENSOR_DEVICE_ATTR(thermal2_psu1, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Temp2); +static SENSOR_DEVICE_ATTR(psoc_psu1_vender, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Vender); +static SENSOR_DEVICE_ATTR(psoc_psu1_serial, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Serial); +static SENSOR_DEVICE_ATTR(psoc_psu1_version, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Version); + +static SENSOR_DEVICE_ATTR(thermal2_psu2, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Temp2); +static SENSOR_DEVICE_ATTR(psoc_psu2_vender, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Vender); +static SENSOR_DEVICE_ATTR(psoc_psu2_serial, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Serial); +static SENSOR_DEVICE_ATTR(psoc_psu2_version, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Version); + + +static struct attribute *psoc_attributes[] = { + //thermal + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp4_input.dev_attr.attr, + &sensor_dev_attr_temp5_input.dev_attr.attr, + + &sensor_dev_attr_thermal_psu1.dev_attr.attr, + &sensor_dev_attr_thermal_psu2.dev_attr.attr, + + + //pwm + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, + &sensor_dev_attr_pwm_psu1.dev_attr.attr, + &sensor_dev_attr_pwm_psu2.dev_attr.attr, + + //rpm + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan6_input.dev_attr.attr, + &sensor_dev_attr_fan7_input.dev_attr.attr, + &sensor_dev_attr_fan8_input.dev_attr.attr, + + &sensor_dev_attr_rpm_psu1.dev_attr.attr, + &sensor_dev_attr_rpm_psu2.dev_attr.attr, + + //switch temperature + &sensor_dev_attr_switch_tmp.dev_attr.attr, + + //diag flag + &sensor_dev_attr_diag.dev_attr.attr, + + //version + &sensor_dev_attr_version.dev_attr.attr, + + //fan led + &sensor_dev_attr_fan_led_grn1.dev_attr.attr, + &sensor_dev_attr_fan_led_grn2.dev_attr.attr, + &sensor_dev_attr_fan_led_grn3.dev_attr.attr, + &sensor_dev_attr_fan_led_grn4.dev_attr.attr, + &sensor_dev_attr_fan_led_red1.dev_attr.attr, + &sensor_dev_attr_fan_led_red2.dev_attr.attr, + &sensor_dev_attr_fan_led_red3.dev_attr.attr, + &sensor_dev_attr_fan_led_red4.dev_attr.attr, + + //fan GPI + &sensor_dev_attr_fan_gpi.dev_attr.attr, + &sensor_dev_attr_psu0.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + + + //psu_psoc + &sensor_dev_attr_psoc_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pout.dev_attr.attr, + + //ipmi_i2c_command + &sensor_dev_attr_thermal2_psu1.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_vender.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_serial.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_version.dev_attr.attr, + + &sensor_dev_attr_thermal2_psu2.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vender.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_serial.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_version.dev_attr.attr, + + &sensor_dev_attr_name.dev_attr.attr, + + NULL +}; + +static const struct attribute_group psoc_group = { + .attrs = psoc_attributes, +}; + +static int __init inv_psoc_init(void) +{ + int ret; + + printk("+%s\n", __func__); + + hwmon_dev = hwmon_device_register(NULL); + if (IS_ERR(hwmon_dev)) { + goto fail_hwmon_device_register; + } + + device_kobj = kobject_create_and_add("device", &hwmon_dev->kobj); + if(!device_kobj) { + goto fail_hwmon_device_register; + } + + ret = sysfs_create_group(device_kobj, &psoc_group); + if (ret) { + goto fail_create_group_hwmon; + } + + printk(" Enable IPMI PSoC protocol.\n"); + return ret; + +fail_create_group_hwmon: + hwmon_device_unregister(hwmon_dev); +fail_hwmon_device_register: + return -ENOMEM; +} + +static void __exit inv_psoc_exit(void) +{ + if(ipmi_mh_user!=NULL) {ipmi_destroy_user(ipmi_mh_user);} + if(hwmon_dev != NULL) hwmon_device_unregister(hwmon_dev); + sysfs_remove_group(device_kobj, &psoc_group); +} + +MODULE_AUTHOR("Ting.Jack "); +MODULE_DESCRIPTION("inv psoc driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_psoc_init); +module_exit(inv_psoc_exit); + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_swps.c b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_swps.c new file mode 100644 index 000000000000..58c1a0aeb048 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_swps.c @@ -0,0 +1,719 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "inv_swps.h" + +static int port_major; +static int ioexp_total; +static int port_total; +static struct class *swp_class_p = NULL; +static struct inv_platform_s *platform_p = NULL; +static struct inv_ioexp_layout_s *ioexp_layout = NULL; +static struct inv_port_layout_s *port_layout = NULL; + +static int +__swp_match(struct device *dev,const void *data){ + + char *name = (char *)data; + if (strcmp(dev_name(dev), name) == 0) + return 1; + return 0; +} + + +struct device * +get_swpdev_by_name(char *name){ + struct device *dev = class_find_device(swp_class_p, + NULL, + name, + (const void *)__swp_match); + return dev; +} + + +static int +sscanf_2_int(const char *buf) { + + int result = -EBFONT; + char *hex_tag = "0x"; + + if (strcspn(buf, hex_tag) == 0) { + if (sscanf(buf,"%x",&result)) { + return result; + } + } else { + if (sscanf(buf,"%d",&result)) { + return result; + } + if(sscanf(buf,"-%d",&result)) { + return -result; + } + if (sscanf(buf,"%x",&result)) { + return result; + } + } + return -EBFONT; +} + + +static int +sscanf_2_binary(const char *buf) { + + int result = sscanf_2_int(buf); + + if (result < 0){ + return -EBFONT; + } + switch (result) { + case 0: + case 1: + return result; + default: + break; + } + return -EBFONT; +} + +/* ========== Show functions: For I/O Expander attribute ========== + */ +static ssize_t +_show_ioexp_binary_attr(struct transvr_obj_s *tobj_p, + int (*get_func)(struct ioexp_obj_s *ioexp_p, int voffset), + char *buf_p) { + size_t len; + struct ioexp_obj_s *ioexp_p = tobj_p->ioexp_obj_p; + + if (!ioexp_p) { + SWPS_ERR(" %s: data corruption! :%s\n", __func__, tobj_p->swp_name); + return -ENODATA; + } + mutex_lock(&ioexp_p->lock); + len = snprintf(buf_p, 8, "%d\n", get_func(ioexp_p, tobj_p->ioexp_virt_offset)); + mutex_unlock(&ioexp_p->lock); + return len; +} + + +static ssize_t +show_attr_present(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_present, + buf_p); +} + +static ssize_t +show_attr_tx_fault(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_tx_fault, + buf_p); +} + +static ssize_t +show_attr_rxlos(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_rxlos, + buf_p); +} + +static ssize_t +show_attr_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_tx_disable, + buf_p); +} + +static ssize_t +show_attr_reset(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_reset, + buf_p); +} + +static ssize_t +show_attr_lpmod(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_lpmod, + buf_p); +} + + +static ssize_t +show_attr_modsel(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_modsel, + buf_p); +} + +/* ========== Store functions: For I/O Expander (R/W) attribute ========== + */ +static ssize_t +_store_ioexp_binary_attr(struct transvr_obj_s *tobj_p, + int (*set_func)(struct ioexp_obj_s *ioexp_p, + int virt_offset, int input_val), + const char *buf_p, + size_t count) { + + int input, err; + struct ioexp_obj_s *ioexp_p = tobj_p->ioexp_obj_p; + + if (!ioexp_p) { + SWPS_ERR("%s: data corruption! :%s\n", + __func__, tobj_p->swp_name); + return -ENODATA; + } + input = sscanf_2_binary(buf_p); + if (input < 0) { + return -EBFONT; + } + mutex_lock(&ioexp_p->lock); + err = set_func(ioexp_p, tobj_p->ioexp_virt_offset, input); + mutex_unlock(&ioexp_p->lock); + if (err < 0){ + return err; + } + return count; +} + +static ssize_t +store_attr_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_tx_disable, + buf_p, + count); +} + +static ssize_t +store_attr_reset(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_reset, + buf_p, + count); +} + + +static ssize_t +store_attr_lpmod(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_lpmod, + buf_p, + count); +} + + +static ssize_t +store_attr_modsel(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_modsel, + buf_p, + count); +} + +/* ========== IO Expander attribute: from expander ========== + */ +static DEVICE_ATTR(present, S_IRUGO, show_attr_present, NULL); +static DEVICE_ATTR(tx_fault, S_IRUGO, show_attr_tx_fault, NULL); +static DEVICE_ATTR(rxlos, S_IRUGO, show_attr_rxlos, NULL); +static DEVICE_ATTR(tx_disable, S_IRUGO|S_IWUSR, show_attr_tx_disable, store_attr_tx_disable); +static DEVICE_ATTR(reset, S_IRUGO|S_IWUSR, show_attr_reset, store_attr_reset); +static DEVICE_ATTR(lpmod, S_IRUGO|S_IWUSR, show_attr_lpmod, store_attr_lpmod); +static DEVICE_ATTR(modsel, S_IRUGO|S_IWUSR, show_attr_modsel, store_attr_modsel); + +/* ========== Functions for module handling ========== + */ +static void +clean_port_obj(void){ + + dev_t dev_num; + char dev_name[32]; + struct device *device_p; + struct transvr_obj_s *transvr_obj_p; + int minor_curr, port_id; + + for (minor_curr=0; minor_curri2c_client_p); + kfree(transvr_obj_p); + } + dev_num = MKDEV(port_major, minor_curr); + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); + } + SWPS_DEBUG("%s: done.\n", __func__); +} + + +static int +get_platform_type(void){ + + char log_msg[64] = "ERROR"; + + platform_p = kzalloc(sizeof(struct inv_platform_s), GFP_KERNEL); + if (!platform_p){ + snprintf(log_msg, sizeof(log_msg), "kzalloc fail"); + goto err_get_platform_type_1; + } + platform_p->id = PLATFORM_SETTINGS; + memset(platform_p->name, 0, sizeof(platform_p->name)); + snprintf(platform_p->name, (sizeof(platform_p->name) - 1), + "%s", platform_map.name); + snprintf(log_msg, sizeof(log_msg), + "User setup platform: %d (%s)", + platform_p->id, platform_p->name); + SWPS_DEBUG("%s: %s, :%d\n", __func__, log_msg, PLATFORM_SETTINGS); + return 0; + +err_get_platform_type_1: + SWPS_ERR("%s: %s :%d\n", __func__, log_msg, PLATFORM_SETTINGS); + return -1; +} + + +static int +get_layout_info(void){ + ioexp_layout = secquoia_ioexp_layout; + port_layout = secquoia_port_layout; + ioexp_total = ARRAY_SIZE(secquoia_ioexp_layout); + port_total = ARRAY_SIZE(secquoia_port_layout); + + SWPS_INFO("Start to initial platform: %d (%s)\n", + platform_p->id, platform_p->name); + return 0; +} + +/* ========== Functions for register something ========== + */ + +static int +register_ioexp_attr_sfp_1(struct device *device_p){ + /* Support machine type: + * - SFP : Magnolia + */ + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_present) < 0) { + err_attr = "dev_attr_present"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_tx_fault) < 0) { + err_attr = "dev_attr_tx_fault"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_rxlos) < 0) { + err_attr = "dev_attr_rxlos"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_tx_disable) < 0) { + err_attr = "dev_attr_tx_disable"; + goto err_ioexp_sfp1_attr; + } + return 0; + +err_ioexp_sfp1_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + +static int +register_ioexp_attr_sfp_2(struct device *device_p){ + /* Support machine type: + * - SFP28 : Cypress + */ + char *err_attr = NULL; + + if (register_ioexp_attr_sfp_1(device_p) < 0){ + goto err_ioexp_sfp2_attr; + } + return 0; + +err_ioexp_sfp2_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + +static int +register_ioexp_attr_qsfp_1(struct device *device_p){ + /* Support machine type: + * - QSFP : Magnolia, Redwood, Hudson32i + * - QSFP+ : Magnolia, Redwood, Hudson32i + * - QSFP28: Redwood + */ + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_present) < 0) { + err_attr = "dev_attr_present"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_reset) < 0) { + err_attr = "dev_attr_reset"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_lpmod) < 0) { + err_attr = "dev_attr_lpmod"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_modsel) < 0) { + err_attr = "dev_attr_modsel"; + goto err_ioexp_qsfp1_attr; + } + return 0; + +err_ioexp_qsfp1_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + +static int +register_ioexp_attr(struct device *device_p, + struct transvr_obj_s *transvr_obj){ + + char *err_msg = "ERR"; + + switch (transvr_obj->ioexp_obj_p->ioexp_type){ + case IOEXP_TYPE_SEQUOIA_NABC: + if (register_ioexp_attr_qsfp_1(device_p) < 0){ + err_msg = "register_ioexp_attr_qsfp_1 fail"; + goto err_reg_ioexp_attr; + } + + break; + + default: + err_msg = "Unknow type"; + goto err_reg_ioexp_attr; + } + return 0; + +err_reg_ioexp_attr: + SWPS_ERR("%s: %s :%d \n", + __func__, err_msg, transvr_obj->ioexp_obj_p->ioexp_type); + return -1; +} + + +static int +register_port_device(char *dev_name, + dev_t dev_num, + struct transvr_obj_s *transvr_obj){ + + struct device *device_p = NULL; + device_p = device_create(swp_class_p, /* struct class *cls */ + NULL, /* struct device *parent */ + dev_num, /* dev_t devt */ + transvr_obj, /* void *private_data */ + dev_name); /* const char *fmt */ + if (IS_ERR(device_p)){ + goto err_regswp_create_dev; + } + if (register_ioexp_attr(device_p, transvr_obj) < 0){ + goto err_regswp_reg_attr; + } + return 0; + +err_regswp_reg_attr: + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); +err_regswp_create_dev: + SWPS_ERR("%s fail! :%s\n", __func__, dev_name); + return -1; +} + + +static int +register_swp_module(void){ + + dev_t port_devt = 0; + int dev_total = port_total + 1; /* char_dev for module control */ + + if (alloc_chrdev_region(&port_devt, 0, dev_total, SWP_CLS_NAME) < 0){ + SWPS_WARN("Allocate PORT MAJOR failure! \n"); + goto err_register_swp_module_3; + } + port_major = MAJOR(port_devt); + + /* Create class object */ + swp_class_p = class_create(THIS_MODULE, SWP_CLS_NAME); + if (IS_ERR(swp_class_p)) { + SWPS_ERR("Create class failure! \n"); + goto err_register_swp_module_3; + } + return 0; + +err_register_swp_module_3: + unregister_chrdev_region(MKDEV(port_major, 0), port_total); + return -1; +} + + +/* ========== Module initial relate ========== + */ +static int +create_ioexp_objs(void) { + + int i, run_mod; + + /* Clean IOEXP object */ + clean_ioexp_objs(); + /* Get running mode */ + run_mod = IOEXP_MODE_DIRECT; + /* Create IOEXP object */ + for(i=0; i devlen_max) { + snprintf(err_msg, sizeof(err_msg), + "SWP_DEV_PORT too long!"); + goto err_initport_create_tranobj; + } + memset(dev_name, 0, sizeof(dev_name)); + snprintf(dev_name, devlen_max, "%s%d", SWP_DEV_PORT, port_id); + /* Create transceiver object */ + ioexp_obj_p = get_ioexp_obj(ioexp_id); + if (!ioexp_obj_p){ + snprintf(err_msg, sizeof(err_msg), + "IOEXP object:%d not exist", ioexp_id); + goto err_initport_create_tranobj; + } + transvr_obj_p = create_transvr_obj(dev_name, chan_id, ioexp_obj_p, + ioexp_virt_offset, transvr_type, + chipset_type, run_mod); + if (!transvr_obj_p){ + snprintf(err_msg, sizeof(err_msg), + "Create transceiver object fail :%s", dev_name); + goto err_initport_create_tranobj; + } + /* Setup Lane_ID mapping */ + i = ARRAY_SIZE(port_layout[minor_curr].lane_id); + j = ARRAY_SIZE(transvr_obj_p->lane_id); + if (i != j) { + snprintf(err_msg, sizeof(err_msg), + "Lane_id size inconsistent %d/%d", i, j); + goto err_initport_reg_device; + } + memcpy(transvr_obj_p->lane_id, port_layout[minor_curr].lane_id, i*sizeof(int)); + /* Create and register device object */ + if (register_port_device(dev_name, MKDEV(port_major, minor_curr), transvr_obj_p) < 0){ + snprintf(err_msg, sizeof(err_msg), + "register_port_device fail"); + goto err_initport_reg_device; + } + /* Setup device_ptr of transvr_obj */ + dev_p = get_swpdev_by_name(dev_name); + if (!dev_p){ + snprintf(err_msg, sizeof(err_msg), + "get_swpdev_by_name fail"); + goto err_initport_reg_device; + } + transvr_obj_p->transvr_dev_p = dev_p; + /* Success */ + ok_count++; + } + SWPS_INFO("%s: initialed %d port-dev",__func__, ok_count); + return 0; + +err_initport_reg_device: + kfree(transvr_obj_p); +err_initport_create_tranobj: + clean_port_obj(); + SWPS_ERR("%s: %s", __func__, err_msg); + SWPS_ERR("Dump: :%d :%d :%d :%d :%d :%d\n", + port_id, chan_id, ioexp_id, ioexp_virt_offset, transvr_type, run_mod); + return -1; +} + +static int __init +swp_module_init(void){ + + if (get_platform_type() < 0){ + goto err_init_out; + } + if (get_layout_info() < 0){ + goto err_init_out; + } + if (register_swp_module() < 0){ + goto err_init_out; + } + if (create_ioexp_objs() < 0){ + goto err_init_ioexp; + } + if (create_port_objs() < 0){ + goto err_init_portobj; + } + if (init_ioexp_objs() < 0){ + goto err_init_portobj; + } + SWPS_INFO("Inventec switch-port module V.%s initial success.\n", SWP_VERSION); + return 0; + + +err_init_portobj: + clean_ioexp_objs(); +err_init_ioexp: + class_unregister(swp_class_p); + class_destroy(swp_class_p); + unregister_chrdev_region(MKDEV(port_major, 0), port_total); +err_init_out: + SWPS_ERR("Inventec switch-port module V.%s initial failure.\n", SWP_VERSION); + return -1; +} + + +static void __exit +swp_module_exit(void){ + clean_port_obj(); + clean_ioexp_objs(); + class_unregister(swp_class_p); + class_destroy(swp_class_p); + unregister_chrdev_region(MKDEV(port_major, 0), port_total); + SWPS_INFO("Remove Inventec switch-port module success.\n"); +} + + +/* Module information */ +MODULE_AUTHOR(SWP_AUTHOR); +MODULE_DESCRIPTION(SWP_DESC); +MODULE_VERSION(SWP_VERSION); +MODULE_LICENSE(SWP_LICENSE); + +module_init(swp_module_init); +module_exit(swp_module_exit); + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_swps.h b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_swps.h new file mode 100644 index 000000000000..3d462ed3c944 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_swps.h @@ -0,0 +1,184 @@ +#ifndef INV_SWPS_H +#define INV_SWPS_H + +#include "transceiver.h" +#include "io_expander.h" + +/* Module settings */ +#define SWP_CLS_NAME "swps" +#define SWP_DEV_PORT "port" +#define SWP_DEV_MODCTL "module" +#define SWP_RESET_PWD "inventec" +#define SWP_POLLING_PERIOD (300) /* msec */ +#define SWP_POLLING_ENABLE (1) +#define SWP_AUTOCONFIG_ENABLE (1) + +/* Module information */ +#define SWP_AUTHOR "Neil " +#define SWP_DESC "Inventec port and transceiver driver" +#define SWP_VERSION "4.2.5" +#define SWP_LICENSE "GPL" + +/* Module status define */ +#define SWP_STATE_NORMAL (0) +#define SWP_STATE_I2C_DIE (-91) + +/* [Note]: + * Functions and mechanism for auto-detect platform type is ready, + * But HW and BIOS not ready! We need to wait them. + * So, please do not use PLATFORM_TYPE_AUTO until they are ready. + * (2016.06.13) + */ +#define PLATFORM_TYPE_SEQUOIA_GA (171) +/* Current running platfrom */ +#define PLATFORM_SETTINGS PLATFORM_TYPE_SEQUOIA_GA + +/* Define platform flag and kernel version */ +#if (PLATFORM_SETTINGS == PLATFORM_TYPE_SEQUOIA_GA) + #define SWPS_SEQUOIA (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#endif + + +struct inv_platform_s { + int id; + char name[64]; +}; + +struct inv_ioexp_layout_s { + int ioexp_id; + int ioexp_type; + struct ioexp_addr_s addr[4]; +}; + +struct inv_port_layout_s { + int port_id; + int chan_id; + int ioexp_id; + int ioexp_offset; + int transvr_type; + int chipset_type; + int lane_id[8]; +}; + + +/* ========================================== + * Inventec Platform Settings + * ========================================== + */ +struct inv_platform_s platform_map = {PLATFORM_TYPE_SEQUOIA_GA, "Sequoia_GA" }; + +/* ========================================== + * Sequoia Layout configuration + * ========================================== + */ + +struct inv_ioexp_layout_s secquoia_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_SEQUOIA_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 0 A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 0 B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0 C */ + }, + {1, IOEXP_TYPE_SEQUOIA_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 1 A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 1 B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 1 C */ + }, + {2, IOEXP_TYPE_SEQUOIA_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 2 A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 2 B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 2 C */ + }, + {3, IOEXP_TYPE_SEQUOIA_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 3 A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 3 B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 3 C */ + }, + {4, IOEXP_TYPE_SEQUOIA_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 4 A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 4 B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 4 C */ + }, + {5, IOEXP_TYPE_SEQUOIA_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 5 A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 5 B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 C */ + }, + {6, IOEXP_TYPE_SEQUOIA_NABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 6 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 6 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 6 C */ + }, + {7, IOEXP_TYPE_SEQUOIA_NABC, { {9, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 7 A */ + {9, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 7 B */ + {9, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + + +struct inv_port_layout_s secquoia_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 10, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} }, + { 1, 11, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} }, + { 2, 12, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} }, + { 3, 13, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} }, + { 4, 14, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} }, + { 5, 15, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} }, + { 6, 16, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} }, + { 7, 17, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} }, + { 8, 18, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} }, + { 9, 19, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, + {10, 20, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} }, + {11, 21, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, + {12, 22, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105, 106, 107, 108} }, + {13, 23, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99, 100} }, + {14, 24, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121, 122, 123, 124} }, + {15, 25, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113, 114, 115, 116} }, + {16, 26, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {137, 138, 139, 140} }, + {17, 27, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {129, 130, 131, 132} }, + {18, 28, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {153, 154, 155, 156} }, + {19, 29, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {145, 146, 147, 148} }, + {20, 30, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {169, 170, 171, 172} }, + {21, 31, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {161, 162, 163, 164} }, + {22, 32, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {185, 186, 187, 188} }, + {23, 33, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {177, 178, 179, 180} }, + {24, 34, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {201, 202, 203, 204} }, + {25, 35, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {193, 194, 195, 196} }, + {26, 36, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {217, 218, 219, 220} }, + {27, 37, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {209, 210, 211, 212} }, + {28, 38, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {233, 234, 235, 236} }, + {29, 39, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {225, 226, 227, 228} }, + {30, 40, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {249, 250, 251, 252} }, + {31, 41, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {241, 242, 243, 244} }, + {32, 45, 4, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} }, + {33, 44, 4, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} }, + {34, 43, 4, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} }, + {35, 42, 4, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} }, + {36, 49, 4, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} }, + {37, 48, 4, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} }, + {38, 47, 4, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} }, + {39, 46, 4, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, + {40, 53, 5, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} }, + {41, 52, 5, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, + {42, 51, 5, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} }, + {43, 50, 5, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {44, 57, 5, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109, 110, 111, 112} }, + {45, 56, 5, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101, 102, 103, 104} }, + {46, 55, 5, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125, 126, 127, 128} }, + {47, 54, 5, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117, 118, 119, 120} }, + {48, 61, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {141, 142, 143, 144} }, + {49, 60, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {133, 134, 135, 136} }, + {50, 59, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {157, 158, 159, 160} }, + {51, 58, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {149, 150, 151, 152} }, + {52, 65, 6, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {173, 174, 175, 176} }, + {53, 64, 6, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {165, 166, 167, 168} }, + {54, 63, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {189, 190, 191, 192} }, + {55, 62, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {181, 182, 183, 184} }, + {56, 69, 7, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {205, 206, 207, 208} }, + {57, 68, 7, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {197, 198, 199, 200} }, + {58, 67, 7, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {221, 222, 223, 224} }, + {59, 66, 7, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {213, 214, 215, 216} }, + {60, 73, 7, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {237, 238, 239, 240} }, + {61, 72, 7, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {229, 230, 231, 232} }, + {62, 71, 7, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {253, 254, 255, 256} }, + {63, 70, 7, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {245, 246, 247, 248} }, +}; + + +#endif /* INV_SWPS_H */ + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/io_expander.c b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/io_expander.c new file mode 100644 index 000000000000..231884f3e442 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/io_expander.c @@ -0,0 +1,1786 @@ +#include +#include +#include "io_expander.h" + +static struct ioexp_obj_s *ioexp_head_p = NULL; +static struct ioexp_obj_s *ioexp_tail_p = NULL; + + +/* ========== Register IOEXP layout ========== + */ +struct ioexp_map_s ioexp_map_magnolia_nab = { + + .chip_amount = 2, + .data_width = 2, + + .map_present = { {0, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {1, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {1, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_tx_disable = { {0, 1, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 1, 1}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 2}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 3}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + {1, 1, 0}, /* map_tx_disable[4] = TXDISABLE_SFP+_P(X+4) */ + {1, 1, 1}, /* map_tx_disable[5] = TXDISABLE_SFP+_P(X+5) */ + {1, 1, 2}, /* map_tx_disable[6] = TXDISABLE_SFP+_P(X+6) */ + {1, 1, 3}, /* map_tx_disable[7] = TXDISABLE_SFP+_P(X+7) */ + }, + .map_tx_fault = { {0, 0, 0}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 0, 1}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 0, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 0, 3}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + {1, 0, 0}, /* map_tx_fault[4] = TXFAULT_SFP+_P(X+4) */ + {1, 0, 1}, /* map_tx_fault[5] = TXFAULT_SFP+_P(X+5) */ + {1, 0, 2}, /* map_tx_fault[6] = TXFAULT_SFP+_P(X+6) */ + {1, 0, 3}, /* map_tx_fault[7] = TXFAULT_SFP+_P(X+7) */ + }, + .map_rxlos = { {0, 1, 4}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 1, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 1, 6}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 1, 7}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + {1, 1, 4}, /* map_rxlos[4] = OPRXLOS_PORT(X+4) */ + {1, 1, 5}, /* map_rxlos[5] = OPRXLOS_PORT(X+5) */ + {1, 1, 6}, /* map_rxlos[6] = OPRXLOS_PORT(X+6) */ + {1, 1, 7}, /* map_rxlos[7] = OPRXLOS_PORT(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_magnolia_7ab = { + + .chip_amount = 2, + .data_width = 2, + + .map_present = { {1, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {1, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {1, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {1, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP_N_P(X+5) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP_P(X+3) */ + {1, 0, 2}, /* map_lpmod[4] = LPMODE_QSFP_P(X+4) */ + {1, 0, 3}, /* map_lpmod[5] = LPMODE_QSFP_P(X+5) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP_N_P(X+5) */ + }, +}; + + +struct ioexp_map_s ioexp_map_redwood_p01p08_p17p24 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 0, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 0, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_redwood_p09p16_p25p32 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 1, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 1, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 1, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 1, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_hudson32iga_p01p08_p17p24 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MODABS_QSFP(X) */ + {2, 0, 1}, /* map_present[1] = MODABS_QSFP(X+1) */ + {2, 0, 2}, /* map_present[2] = MODABS_QSFP(X+2) */ + {2, 0, 3}, /* map_present[3] = MODABS_QSFP(X+3) */ + {2, 0, 4}, /* map_present[4] = MODABS_QSFP(X+4) */ + {2, 0, 5}, /* map_present[5] = MODABS_QSFP(X+5) */ + {2, 0, 6}, /* map_present[6] = MODABS_QSFP(X+6) */ + {2, 0, 7}, /* map_present[7] = MODABS_QSFP(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_hudson32iga_p09p16_p25p32 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MODABS_QSFP(X) */ + {2, 1, 1}, /* map_present[1] = MODABS_QSFP(X+1) */ + {2, 1, 2}, /* map_present[2] = MODABS_QSFP(X+2) */ + {2, 1, 3}, /* map_present[3] = MODABS_QSFP(X+3) */ + {2, 1, 4}, /* map_present[4] = MODABS_QSFP(X+4) */ + {2, 1, 5}, /* map_present[5] = MODABS_QSFP(X+5) */ + {2, 1, 6}, /* map_present[6] = MODABS_QSFP(X+6) */ + {2, 1, 7}, /* map_present[7] = MODABS_QSFP(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_cypress_nabc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {0, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {1, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {1, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_tx_disable = { {0, 1, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 1, 1}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 2}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 3}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + {1, 1, 0}, /* map_tx_disable[4] = TXDISABLE_SFP+_P(X+4) */ + {1, 1, 1}, /* map_tx_disable[5] = TXDISABLE_SFP+_P(X+5) */ + {1, 1, 2}, /* map_tx_disable[6] = TXDISABLE_SFP+_P(X+6) */ + {1, 1, 3}, /* map_tx_disable[7] = TXDISABLE_SFP+_P(X+7) */ + }, + .map_tx_fault = { {0, 0, 0}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 0, 1}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 0, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 0, 3}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + {1, 0, 0}, /* map_tx_fault[4] = TXFAULT_SFP+_P(X+4) */ + {1, 0, 1}, /* map_tx_fault[5] = TXFAULT_SFP+_P(X+5) */ + {1, 0, 2}, /* map_tx_fault[6] = TXFAULT_SFP+_P(X+6) */ + {1, 0, 3}, /* map_tx_fault[7] = TXFAULT_SFP+_P(X+7) */ + }, + .map_rxlos = { {0, 1, 4}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 1, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 1, 6}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 1, 7}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + {1, 1, 4}, /* map_rxlos[4] = OPRXLOS_PORT(X+4) */ + {1, 1, 5}, /* map_rxlos[5] = OPRXLOS_PORT(X+5) */ + {1, 1, 6}, /* map_rxlos[6] = OPRXLOS_PORT(X+6) */ + {1, 1, 7}, /* map_rxlos[7] = OPRXLOS_PORT(X+7) */ + }, + .map_hard_rs0 = { {2, 0, 0}, /* map_hard_rs0[0] = RS0_SFP28_P(X) */ + {2, 0, 2}, /* map_hard_rs0[1] = RS0_SFP28_P(X+1) */ + {2, 0, 4}, /* map_hard_rs0[2] = RS0_SFP28_P(X+2) */ + {2, 0, 6}, /* map_hard_rs0[3] = RS0_SFP28_P(X+3) */ + {2, 1, 0}, /* map_hard_rs0[4] = RS0_SFP28_P(X+4) */ + {2, 1, 2}, /* map_hard_rs0[5] = RS0_SFP28_P(X+5) */ + {2, 1, 4}, /* map_hard_rs0[6] = RS0_SFP28_P(X+6) */ + {2, 1, 6}, /* map_hard_rs0[7] = RS0_SFP28_P(X+7) */ + }, + .map_hard_rs1 = { {2, 0, 1}, /* map_hard_rs1[0] = RS1_SFP28_P(X) */ + {2, 0, 3}, /* map_hard_rs1[1] = RS1_SFP28_P(X+1) */ + {2, 0, 5}, /* map_hard_rs1[2] = RS1_SFP28_P(X+2) */ + {2, 0, 7}, /* map_hard_rs1[3] = RS1_SFP28_P(X+3) */ + {2, 1, 1}, /* map_hard_rs1[4] = RS1_SFP28_P(X+4) */ + {2, 1, 3}, /* map_hard_rs1[5] = RS1_SFP28_P(X+5) */ + {2, 1, 5}, /* map_hard_rs1[6] = RS1_SFP28_P(X+6) */ + {2, 1, 7}, /* map_hard_rs1[7] = RS1_SFP28_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_cypress_7abc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 0, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 0, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP_N_P(X+3) */ + {0, 0, 4}, /* map_reset[4] = QRESET_QSFP_N_P(X+4) */ + {0, 0, 5}, /* map_reset[5] = QRESET_QSFP_N_P(X+5) */ + }, + .map_lpmod = { {0, 1, 0}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {0, 1, 1}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {0, 1, 2}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + {0, 1, 3}, /* map_lpmod[3] = LPMODE_QSFP_P(X+3) */ + {0, 1, 4}, /* map_lpmod[4] = LPMODE_QSFP_P(X+4) */ + {0, 1, 5}, /* map_lpmod[5] = LPMODE_QSFP_P(X+5) */ + }, + .map_modsel = { {1, 1, 0}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {1, 1, 1}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {1, 1, 2}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + {1, 1, 3}, /* map_modsel[3] = MODSEL_QSFP_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP_N_P(X+5) */ + }, +}; + + +struct ioexp_map_s ioexp_map_tahoe_5a = { + + .chip_amount = 1, + .data_width = 2, + + .map_present = { {0, 0, 3}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 1, 0}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 1, 5}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + }, + .map_reset = { {0, 0, 1}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 0, 6}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 1, 3}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + }, + .map_lpmod = { {0, 0, 2}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {0, 0, 7}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {0, 1, 4}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + }, + .map_modsel = { {0, 0, 0}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {0, 0, 5}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {0, 1, 2}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + }, +}; + + +struct ioexp_map_s ioexp_map_tahoe_6abc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {0, 0, 3}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 1, 0}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 1, 5}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {1, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 1, 0}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 0, 3}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 0}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + {2, 1, 5}, /* map_present[8] = MOD_ABS_PORT(X+8) */ + }, + .map_reset = { {0, 0, 1}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 6}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 1, 3}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {1, 0, 1}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 6}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 1, 3}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {2, 0, 1}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {2, 0, 6}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + {2, 1, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 2}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 7}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 1, 4}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {1, 0, 2}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 7}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 1, 4}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {2, 0, 2}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {2, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + {2, 1, 4}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+8) */ + }, + .map_modsel = { {0, 0, 0}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 0, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 2}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {1, 0, 0}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 0, 5}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 2}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {2, 0, 0}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {2, 0, 5}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + {2, 1, 2}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_sequoia_nabc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 1, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 1, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 1, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 1, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 1, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 1, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 1, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 1, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {0, 1, 4}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {0, 1, 5}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {0, 1, 6}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {0, 1, 7}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {1, 0, 0}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {1, 0, 1}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {1, 0, 2}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {1, 0, 3}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 0, 0}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {0, 0, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {0, 0, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {0, 0, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {0, 0, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +/* ========== Private functions ========== + */ +int check_channel_tier_1(void); + +struct i2c_client * +_get_i2c_client(struct ioexp_obj_s *self, + int chip_id){ + + struct ioexp_i2c_s *i2c_curr_p = self->i2c_head_p; + + if (!(i2c_curr_p)){ + SWPS_ERR("%s: i2c_curr_p is NULL\n", __func__); + return NULL; + } + while (i2c_curr_p){ + if ((i2c_curr_p->chip_id) == chip_id){ + return i2c_curr_p->i2c_client_p; + } + i2c_curr_p = i2c_curr_p->next; + } + SWPS_ERR("%s: not exist! :%d\n", __func__, chip_id); + return NULL; +} + + +static int +_common_ioexp_update_one(struct ioexp_obj_s *self, + struct ioexp_addr_s *ioexp_addr, + int chip_id, + int data_width, + int show_err, + char *caller_name) { + int buf = 0; + int err = 0; + int data_id = 0; + int r_offset = 0; + + for(data_id=0; data_idread_offset[data_id]; + buf = i2c_smbus_read_byte_data(_get_i2c_client(self, chip_id), r_offset); + /* Check error */ + if (buf < 0) { + err = 1; + if (show_err) { + SWPS_INFO("IOEXP-%d read fail! :%d \n", self->ioexp_id, buf); + SWPS_INFO("Dump: :%d :0x%02x :%d, :%s\n", + ioexp_addr->chan_id, ioexp_addr->chip_addr, + ioexp_addr->read_offset[data_id], caller_name); + } + continue; + } + /* Update IOEXP object */ + self->chip_data[chip_id].data[data_id] = (uint8_t)buf; + } + if (err) { + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +static int +common_ioexp_update_all(struct ioexp_obj_s *self, + int show_err, + char *caller_name){ + + int err = 0; + int chip_id = 0; + int chip_amount = self->ioexp_map_p->chip_amount; + + for (chip_id=0; chip_idioexp_map_p->map_addr[chip_id]), + chip_id, + self->ioexp_map_p->data_width, + show_err, + caller_name) < 0) { + err = 1; + } + } + if (err) { + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +static int +_common_check_by_mode(struct ioexp_obj_s *self){ + + switch (self->mode){ + case IOEXP_MODE_DIRECT: + return self->fsm_4_direct(self); + + case IOEXP_MODE_POLLING: + if (self->state >= 0){ + return 0; + } + switch (self->state){ + case STATE_IOEXP_INIT: + return ERR_IOEXP_UNINIT; + case STATE_IOEXP_ABNORMAL: + return ERR_IOEXP_ABNORMAL; + default: + return ERR_IOEXP_NOSTATE; + } + break; + + default: + break; + } + SWPS_ERR("%s: Exception occurs. :%d \n", __func__, self->mode); + return ERR_IOEXP_UNEXCPT; +} + + +static int +_common_get_bit(struct ioexp_obj_s *self, + struct ioexp_bitmap_s *bitmap_obj_p, + char *func_mane){ + uint8_t buf; + int err_code; + + /* Check and get address */ + err_code = _common_check_by_mode(self); + if (err_code < 0){ + return err_code; + } + if (!bitmap_obj_p){ + SWPS_ERR("Layout config incorrect! :%d :%s\n", + self->ioexp_id, func_mane); + return ERR_IOEXP_BADCONF; + } + /* Get data form cache */ + buf = self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset]; + return (int)(buf >> bitmap_obj_p->bit_shift & 0x01); +} + + +static int +_common_set_bit(struct ioexp_obj_s *self, + struct ioexp_bitmap_s *bitmap_obj_p, + int input_val, + char *func_mane){ + int err_code, target_offset; + uint8_t origin_byte; + uint8_t modify_byte; + + /* Check and get address */ + err_code = _common_check_by_mode(self); + if (err_code < 0){ + return err_code; + } + if (!bitmap_obj_p){ + SWPS_ERR("Layout config incorrect! :%d :%s\n", + self->ioexp_id, func_mane); + return ERR_IOEXP_BADCONF; + } + /* Prepare write date */ + origin_byte = self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset]; + switch (input_val) { + case 0: + modify_byte = origin_byte; + SWP_BIT_CLEAR(modify_byte, bitmap_obj_p->bit_shift); + break; + case 1: + modify_byte = origin_byte; + SWP_BIT_SET(modify_byte, bitmap_obj_p->bit_shift); + break; + default: + SWPS_ERR("Input value incorrect! :%d :%d :%s\n", + input_val, self->ioexp_id, func_mane); + return ERR_IOEXP_BADINPUT; + } + /* Setup i2c client */ + target_offset = self->ioexp_map_p->map_addr[bitmap_obj_p->chip_id].write_offset[bitmap_obj_p->ioexp_voffset]; + /* Write byte to chip via I2C */ + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, bitmap_obj_p->chip_id), + target_offset, + modify_byte); + /* Update or bollback object */ + if (err_code < 0){ + self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset] = origin_byte; + SWPS_ERR("I2C write fail! :%d :%d :%s :%d\n", + input_val, self->ioexp_id, func_mane, err_code); + return err_code; + } + self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset] = modify_byte; + return 0; +} + + +/* ========== Object public functions ========== + */ +int +common_get_present(struct ioexp_obj_s *self, + int virt_offset){ + + int UNPLUG = 1; + int retval = ERR_IOEXP_UNEXCPT; + + retval = _common_get_bit(self, + &(self->ioexp_map_p->map_present[virt_offset]), + "common_get_present"); + if (retval < 0) { + /* [Note] + * => Transceiver object does not need to handle IOEXP layer issues. + */ + return UNPLUG; + } + return retval; +} + + +int +common_get_tx_fault(struct ioexp_obj_s *self, + int virt_offset){ + /* [Transmit Fault (Tx_Fault)] + * A catastrophic laser fault will activate the transmitter signal, + * TX_FAULT, and disable the laser. This signal is an open collector + * output (pull-up required on the host board). A low signal indicates + * normal laser operation and a high signal indicates a fault. The + * TX_FAULT will be latched high when a laser fault occurs and is + * cleared by toggling the TX_DISABLE input or power cycling the + * transceiver. The transmitter fault condition can also be monitored + * via the two-wire serial interface. + * (address A2, byte 110, bit 2). + * + * 0: Normal + * 1: Abnormal + */ + return _common_get_bit(self, + &(self->ioexp_map_p->map_tx_fault[virt_offset]), + "common_get_tx_fault"); +} + + +int +common_get_rxlos(struct ioexp_obj_s *self, + int virt_offset){ + /* [Receiver Loss of Signal (Rx_LOS)] + * The post-amplification IC also includes transition detection circuitry + * which monitors the ac level of incoming optical signals and provides a + * TTL/CMOS compatible status signal to the host (pin 8). An adequate optical + * input results in a low Rx_LOS output while a high Rx_LOS output indicates + * an unusable optical input. The Rx_LOS thresholds are factory set so that + * a high output indicates a definite optical fault has occurred. Rx_LOS can + * also be monitored via the two-wire serial interface + * (address A2h, byte 110, bit 1). + * + * 0: Normal + * 1: Abnormal + */ + return _common_get_bit(self, + &(self->ioexp_map_p->map_rxlos[virt_offset]), + "common_get_rxlos"); +} + + +int +common_get_tx_disable(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_tx_disable[virt_offset]), + "common_get_tx_disable"); +} + + +int +common_get_reset(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_reset[virt_offset]), + "common_get_reset"); +} + + +int +common_get_lpmod(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_lpmod[virt_offset]), + "common_get_lpmod"); +} + + +int +common_get_modsel(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_modsel[virt_offset]), + "common_get_modsel"); +} + + +int +common_get_hard_rs0(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_hard_rs0[virt_offset]), + "common_get_hard_rs0"); +} + + +int +common_get_hard_rs1(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_hard_rs1[virt_offset]), + "common_get_hard_rs1"); +} + + +int +common_set_tx_disable(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_tx_disable[virt_offset]), + input_val, + "common_set_tx_disable"); +} + + +int +common_set_reset(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_reset[virt_offset]), + input_val, + "common_set_reset"); +} + + +int +common_set_lpmod(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_lpmod[virt_offset]), + input_val, + "common_set_lpmod"); +} + + +int +common_set_modsel(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_modsel[virt_offset]), + input_val, + "common_set_modsel"); +} + + +int +common_set_hard_rs0(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_hard_rs0[virt_offset]), + input_val, + "common_set_hard_rs0"); +} + + +int +common_set_hard_rs1(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_hard_rs1[virt_offset]), + input_val, + "common_set_hard_rs1"); +} + + +int +ioexp_get_not_support(struct ioexp_obj_s *self, + int virt_offset){ + return ERR_IOEXP_NOTSUPPORT; +} + + +int +ioexp_set_not_support(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + return ERR_IOEXP_NOTSUPPORT; +} + + +int +fake_ioexp_init(struct ioexp_obj_s *self){ + return 1; +} + +int +fake_ioexp_update(struct ioexp_obj_s *self){ + return 1; +} + + +int +fake_update_func(struct ioexp_obj_s *self){ + return 1; +} + +int +fake_get_func(struct ioexp_obj_s *self, + int virt_offset){ + SWPS_WARN("Someone called fake_get_func\n"); + return -1; +} + +int +fake_set_func(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + SWPS_WARN("Someone called fake_set_func\n"); + return -1; +} + + +/* ========== Initial functions for IO Expander ========== + */ +int +common_ioexp_init(struct ioexp_obj_s *self) { + + int chip_id, offset, err_code; + struct ioexp_addr_s *addr_p; + + /* Setup default value to each physical IO Expander */ + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + /* Get address mapping */ + addr_p = &(self->ioexp_map_p->map_addr[chip_id]); + if (!addr_p){ + SWPS_ERR("%s: IOEXP config incorrect! :%d \n", + __func__, chip_id); + return -1; + } + /* Setup default value */ + for (offset=0; offset<(self->ioexp_map_p->data_width); offset++){ + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, chip_id), + addr_p->write_offset[offset], + addr_p->data_default[offset]); + if (err_code < 0){ + SWPS_ERR("%s: set default fail! :%d \n", + __func__, err_code); + return ERR_IOEXP_UNEXCPT; + } + } + } + /* Check and update info to object */ + err_code = self->update_all(self, 1, "common_ioexp_init"); + if (err_code < 0) { + SWPS_ERR("%s: update_all() fail! :%d \n", + __func__, err_code); + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +/* ========== Object functions for Final State Machine ========== + */ +int +_is_channel_ready(struct ioexp_obj_s *self){ + + int buf = 0; + int chip_id = 0; /* Use first chip which be registered */ + int data_id = 0; /* Use first byte which be registered */ + struct ioexp_addr_s *ioexp_addr = NULL; + + ioexp_addr = &(self->ioexp_map_p->map_addr[chip_id]); + if (!ioexp_addr){ + SWPS_ERR("%s: config incorrect!\n", __func__); + return ERR_IOEXP_UNEXCPT; + } + buf = i2c_smbus_read_byte_data(_get_i2c_client(self, chip_id), + ioexp_addr->read_offset[data_id]); + if (buf >= 0){ + return 1; + } + return 0; +} + +int +_ioexp_init_handler(struct ioexp_obj_s *self){ + + int return_val; + + switch (self->mode) { + case IOEXP_MODE_DIRECT: + return_val = self->init(self); + if (return_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + } else { + self->state = STATE_IOEXP_NORMAL; + } + return return_val; + + case IOEXP_MODE_POLLING: + /* Check system and channel is ready */ + if (self->state == STATE_IOEXP_INIT){ + if (!_is_channel_ready(self)){ + self->state = STATE_IOEXP_INIT; + SWPS_WARN("%s: IOEXP:%d channel not ready.\n", + __func__, self->ioexp_id); + return 0; + } + } + /* Execute initial callback */ + return_val = self->init(self); + if (return_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + } else { + self->state = STATE_IOEXP_NORMAL; + } + return return_val; + + default: + break; + } + SWPS_ERR("%s: exception occur :%d\n", __func__, self->mode); + return ERR_IOEXP_UNEXCPT; +} + + +int +common_ioexp_fsm_4_direct(struct ioexp_obj_s *self){ + + int result_val; + int show_err = 1; + char *func_mane = "common_ioexp_fsm_4_direct"; + + switch (self->state){ + case STATE_IOEXP_INIT: + result_val = _ioexp_init_handler(self); + /* Exception case: terminate initial procedure */ + if(result_val < 0){ + /* Initial fail */ + return result_val; + } + if(self->state == STATE_IOEXP_INIT){ + /* Keep in INIT state, and return error */ + return ERR_IOEXP_UNINIT; + } + /* Case: Initial done */ + return 0; + + case STATE_IOEXP_NORMAL: + result_val = self->update_all(self, show_err, func_mane); + if (result_val < 0){ + SWPS_INFO("%s: NORMAL -> ABNORMAL :%d\n", + __func__, result_val); + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + self->state = STATE_IOEXP_NORMAL; + return 0; + + case STATE_IOEXP_ABNORMAL: + result_val = self->update_all(self, show_err, func_mane); + if (result_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + SWPS_DEBUG("%s: ABNORMAL -> NORMAL :%d\n", + __func__, result_val); + self->state = STATE_IOEXP_NORMAL; + return 0; + + default: + break; + } + SWPS_ERR("%s: Exception occurs :%d\n", + __func__, self->state); + return ERR_IOEXP_UNEXCPT; +} + + +int +common_ioexp_fsm_4_polling(struct ioexp_obj_s *self){ + + int result_val, i, show_e; + int fail_retry = 3; + char *func_name = "common_ioexp_fsm_4_polling"; + +#ifdef DEBUG_SWPS + show_e = 1; +#else + show_e = 0; +#endif + + switch (self->state){ + case STATE_IOEXP_INIT: + result_val = _ioexp_init_handler(self); + /* Exception case: terminate initial procedure */ + if(result_val < 0){ + /* Initial fail */ + return result_val; + } + /* Case: System (Channel) not ready */ + if(self->state == STATE_IOEXP_INIT){ + /* Keep in INIT state, wait and retry */ + return 0; + } + /* Case: Initial done */ + SWPS_INFO("IOEXP-%d: initial done. :%d\n", + self->ioexp_id, self->ioexp_type); + return result_val; + + case STATE_IOEXP_NORMAL: + /* Retry mechanism for case of i2c topology not stable */ + for (i=0; iupdate_all(self, show_e, func_name); + if (result_val >= 0) { + self->state = STATE_IOEXP_NORMAL; + return 0; + } + if (check_channel_tier_1() < 0) { + SWPS_INFO("%s: detect I2C crash :%d\n", + __func__, self->ioexp_id); + break; + } + SWPS_DEBUG("IOEXP-%d: unstable :%d\n", + self->ioexp_id, result_val); + } + SWPS_INFO("IOEXP-%d: NORMAL -> ABNORMAL :%d\n", + self->ioexp_id, result_val); + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + + case STATE_IOEXP_ABNORMAL: + result_val = self->update_all(self, show_e, func_name); + if (result_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + SWPS_INFO("IOEXP-%d: ABNORMAL -> NORMAL :%d\n", + self->ioexp_id, result_val); + self->state = STATE_IOEXP_NORMAL; + return 0; + + default: + break; + } + SWPS_ERR("IOEXP-%d: Exception occurs :%d\n", + self->ioexp_id, self->state); + return ERR_IOEXP_UNEXCPT; +} + + +/* ========== Object private functions for check & update ========== + */ +int +common_ioexp_check(struct ioexp_obj_s *self){ + + int result; + + if (self->mode != IOEXP_MODE_POLLING){ + SWPS_ERR("%s: not polling mode :%d\n", + __func__, self->mode); + return ERR_IOEXP_NOTSUPPORT; + } + mutex_lock(&self->lock); + result = self->fsm_4_polling(self); + mutex_unlock(&self->lock); + return result; +} + + +/* ========== Functions for Factory pattern ========== + */ +static struct ioexp_map_s * +get_ioexp_map(int ioexp_type){ + switch (ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + return &ioexp_map_magnolia_nab; + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + return &ioexp_map_magnolia_7ab; + case IOEXP_TYPE_REDWOOD_P01P08: + return &ioexp_map_redwood_p01p08_p17p24; + case IOEXP_TYPE_REDWOOD_P09P16: + return &ioexp_map_redwood_p09p16_p25p32; + case IOEXP_TYPE_HUDSON32IGA_P01P08: + return &ioexp_map_hudson32iga_p01p08_p17p24; + case IOEXP_TYPE_HUDSON32IGA_P09P16: + return &ioexp_map_hudson32iga_p09p16_p25p32; + case IOEXP_TYPE_CYPRESS_NABC: + return &ioexp_map_cypress_nabc; + case IOEXP_TYPE_CYPRESS_7ABC: + return &ioexp_map_cypress_7abc; + case IOEXP_TYPE_TAHOE_5A: + return &ioexp_map_tahoe_5a; + case IOEXP_TYPE_TAHOE_6ABC: + return &ioexp_map_tahoe_6abc; + case IOEXP_TYPE_SEQUOIA_NABC: + return &ioexp_map_sequoia_nabc; + default: + return NULL; + } +} + + +int +setup_ioexp_ssize_attr(struct ioexp_obj_s *self, + struct ioexp_map_s *ioexp_map_p, + int ioexp_id, + int ioexp_type, + int run_mode){ + switch (run_mode){ + case IOEXP_MODE_POLLING: /* Direct access device mode */ + case IOEXP_MODE_DIRECT: /* Polling mode, read from cache */ + self->mode = run_mode; + break; + default: + SWPS_ERR("%s: non-defined run_mode:%d\n", + __func__, run_mode); + self->mode = ERR_IOEXP_UNEXCPT; + return ERR_IOEXP_UNEXCPT; + } + self->ioexp_id = ioexp_id; + self->ioexp_type = ioexp_type; + self->ioexp_map_p = ioexp_map_p; + self->state = STATE_IOEXP_INIT; + mutex_init(&self->lock); + return 0; +} + + +static int +setup_addr_mapping(struct ioexp_obj_s *self, + struct ioexp_addr_s *addr_map_p){ + if (!addr_map_p){ + SWPS_ERR("%s: map is null\n", __func__); + return -1; + } + self->ioexp_map_p->map_addr = addr_map_p; + return 0; +} + + +static int +setup_ioexp_public_cb(struct ioexp_obj_s *self, + int ioexp_type){ + + switch (ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + self->get_present = common_get_present; + self->get_tx_fault = common_get_tx_fault; + self->get_rxlos = common_get_rxlos; + self->get_tx_disable = common_get_tx_disable; + self->get_reset = ioexp_get_not_support; + self->get_lpmod = ioexp_get_not_support; + self->get_modsel = ioexp_get_not_support; + self->get_hard_rs0 = ioexp_get_not_support; + self->get_hard_rs1 = ioexp_get_not_support; + self->set_tx_disable = common_set_tx_disable; + self->set_reset = ioexp_set_not_support; + self->set_lpmod = ioexp_set_not_support; + self->set_modsel = ioexp_set_not_support; + self->set_hard_rs0 = ioexp_set_not_support; + self->set_hard_rs1 = ioexp_set_not_support; + return 0; + case IOEXP_TYPE_CYPRESS_NABC: + self->get_present = common_get_present; + self->get_tx_fault = common_get_tx_fault; + self->get_rxlos = common_get_rxlos; + self->get_tx_disable = common_get_tx_disable; + self->get_reset = ioexp_get_not_support; + self->get_lpmod = ioexp_get_not_support; + self->get_modsel = ioexp_get_not_support; + self->get_hard_rs0 = common_get_hard_rs0; + self->get_hard_rs1 = common_get_hard_rs1; + self->set_tx_disable = common_set_tx_disable; + self->set_reset = ioexp_set_not_support; + self->set_lpmod = ioexp_set_not_support; + self->set_modsel = ioexp_set_not_support; + self->set_hard_rs0 = common_set_hard_rs0; + self->set_hard_rs1 = common_set_hard_rs1; + return 0; + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + case IOEXP_TYPE_HUDSON32IGA_P01P08: + case IOEXP_TYPE_HUDSON32IGA_P09P16: + case IOEXP_TYPE_CYPRESS_7ABC: + case IOEXP_TYPE_TAHOE_5A: + case IOEXP_TYPE_TAHOE_6ABC: + case IOEXP_TYPE_SEQUOIA_NABC: + self->get_present = common_get_present; + self->get_tx_fault = ioexp_get_not_support; + self->get_rxlos = ioexp_get_not_support; + self->get_tx_disable = ioexp_get_not_support; + self->get_reset = common_get_reset; + self->get_lpmod = common_get_lpmod; + self->get_modsel = common_get_modsel; + self->get_hard_rs0 = ioexp_get_not_support; + self->get_hard_rs1 = ioexp_get_not_support; + self->set_tx_disable = ioexp_set_not_support; + self->set_reset = common_set_reset; + self->set_lpmod = common_set_lpmod; + self->set_modsel = common_set_modsel; + self->set_hard_rs0 = ioexp_set_not_support; + self->set_hard_rs1 = ioexp_set_not_support; + return 0; + + default: + SWPS_ERR("%s: type:%d incorrect!\n", __func__, ioexp_type); + break; + } + return ERR_IOEXP_UNEXCPT; +} + + +static int +setup_ioexp_private_cb(struct ioexp_obj_s *self, + int ioexp_type){ + + switch (ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + case IOEXP_TYPE_HUDSON32IGA_P01P08: + case IOEXP_TYPE_HUDSON32IGA_P09P16: + case IOEXP_TYPE_CYPRESS_NABC: + case IOEXP_TYPE_CYPRESS_7ABC: + case IOEXP_TYPE_TAHOE_5A: + case IOEXP_TYPE_TAHOE_6ABC: + case IOEXP_TYPE_SEQUOIA_NABC: + self->init = common_ioexp_init; + self->check = common_ioexp_check; + self->update_all = common_ioexp_update_all; + self->fsm_4_direct = common_ioexp_fsm_4_direct; + self->fsm_4_polling = common_ioexp_fsm_4_polling; + return 0; + + default: + SWPS_ERR("%s: type:%d incorrect!\n", __func__, ioexp_type); + break; + } + return ERR_IOEXP_UNEXCPT; +} + + +static int +setup_i2c_client_one(struct ioexp_obj_s *self, + int chip_id){ + + char *err_msg = "ERROR"; + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + struct ioexp_i2c_s *i2c_obj_p = NULL; + struct ioexp_i2c_s *i2c_curr_p = NULL; + + int chan_id = self->ioexp_map_p->map_addr[chip_id].chan_id; + adap = i2c_get_adapter(chan_id); + if(!adap){ + err_msg = "Can not get adap!"; + goto err_ioexp_setup_i2c_1; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + err_msg = "Can not kzalloc client!"; + goto err_ioexp_setup_i2c_1; + } + i2c_obj_p = kzalloc(sizeof(*i2c_obj_p), GFP_KERNEL); + if (!i2c_obj_p){ + err_msg = "Can not kzalloc i2c_obj_p!"; + goto err_ioexp_setup_i2c_2; + } + client->adapter = adap; + client->addr = self->ioexp_map_p->map_addr[chip_id].chip_addr; + i2c_obj_p->i2c_client_p = client; + i2c_obj_p->chip_id = chip_id; + i2c_obj_p->next = NULL; + if (!self->i2c_head_p){ + self->i2c_head_p = i2c_obj_p; + } else { + i2c_curr_p = self->i2c_head_p; + while (i2c_curr_p->next){ + i2c_curr_p = i2c_curr_p->next; + } + i2c_curr_p->next = i2c_obj_p; + } + return 0; + +err_ioexp_setup_i2c_2: + kfree(client); +err_ioexp_setup_i2c_1: + SWPS_ERR("%s: %s :%d\n", __func__, err_msg, chan_id); + return -1; +} + + +static int +setup_i2c_client(struct ioexp_obj_s* self){ + + int result; + int chip_id = 0; + + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + result = setup_i2c_client_one(self, chip_id); + if (result < 0){ + SWPS_ERR("%s fail! :%d\n", __func__, chip_id); + return -1; + } + } + return 0; +} + + +static int +setup_ioexp_config(struct ioexp_obj_s *self) { + + int chip_id, offset, err_code; + struct ioexp_addr_s *addr_p; + + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + addr_p = &(self->ioexp_map_p->map_addr[chip_id]); + if (!addr_p){ + SWPS_ERR("IOEXP config incorrect! :%d \n",chip_id); + return -1; + } + for (offset=0; offset<(self->ioexp_map_p->data_width); offset++){ + + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, chip_id), + addr_p->conf_offset[offset], + addr_p->conf_default[offset]); + + if (err_code < 0){ + SWPS_INFO("%s: set conf fail! :%d \n", __func__, err_code); + return -2; + } + } + } + return 0; +} + + +struct ioexp_obj_s * +_create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode){ + + struct ioexp_map_s* ioexp_map_p; + struct ioexp_obj_s* result_p; + struct ioexp_i2c_s *i2c_curr_p; + struct ioexp_i2c_s *i2c_next_p; + + /* Get layout */ + ioexp_map_p = get_ioexp_map(ioexp_type); + if (!ioexp_map_p){ + SWPS_ERR("%s: Invalid ioexp_type\n", __func__); + goto err_create_ioexp_fail; + } + /* Prepare IOEXP object */ + result_p = kzalloc(sizeof(*result_p), GFP_KERNEL); + if (!result_p){ + SWPS_ERR("%s: kzalloc failure!\n", __func__); + goto err_create_ioexp_fail; + } + /* Prepare static size attributes */ + if (setup_ioexp_ssize_attr(result_p, + ioexp_map_p, + ioexp_id, + ioexp_type, + run_mode) < 0){ + goto err_create_ioexp_setup_attr_fail; + } + /* Prepare address mapping */ + if (setup_addr_mapping(result_p, addr_map_p) < 0){ + goto err_create_ioexp_setup_attr_fail; + } + if (setup_i2c_client(result_p) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + /* Prepare call back functions of object */ + if (setup_ioexp_public_cb(result_p, ioexp_type) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + if (setup_ioexp_private_cb(result_p, ioexp_type) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + return result_p; + +err_create_ioexp_setup_i2c_fail: + i2c_curr_p = result_p->i2c_head_p; + i2c_next_p = result_p->i2c_head_p; + while (i2c_curr_p){ + i2c_next_p = i2c_curr_p->next; + kfree(i2c_curr_p->i2c_client_p); + kfree(i2c_curr_p); + i2c_curr_p = i2c_next_p; + } +err_create_ioexp_setup_attr_fail: + kfree(result_p); +err_create_ioexp_fail: + SWPS_ERR("%s: fail! :%d :%d \n", + __func__, ioexp_id, ioexp_type); + return NULL; +} + + +int +create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode){ + + struct ioexp_obj_s *ioexp_p = NULL; + + ioexp_p = _create_ioexp_obj(ioexp_id, ioexp_type, + addr_map_p, run_mode); + if (!ioexp_p){ + return -1; + } + if (ioexp_head_p == NULL){ + ioexp_head_p = ioexp_p; + ioexp_tail_p = ioexp_p; + return 0; + } + ioexp_tail_p->next = ioexp_p; + ioexp_tail_p = ioexp_p; + return 0; +} + + +static int +_init_ioexp_obj(struct ioexp_obj_s* self) { + + char *err_msg = "ERR"; + char *func_name = "_init_ioexp_obj"; + + /* Setup IOEXP configure byte */ + if (setup_ioexp_config(self) < 0){ + err_msg = "setup_ioexp_config fail"; + goto err_init_ioexp_obj; + } + /* Setup default data */ + if (_ioexp_init_handler(self) < 0){ + err_msg = "_ioexp_init_handler fail"; + goto err_init_ioexp_obj; + } + /* Update all */ + if (self->state == STATE_IOEXP_NORMAL){ + if (self->update_all(self, 1, func_name) < 0){ + err_msg = "update_all() fail"; + goto err_init_ioexp_obj; + } + } + return 0; + +err_init_ioexp_obj: + SWPS_DEBUG("%s: %s\n", __func__, err_msg); + return -1; +} + + +int +init_ioexp_objs(void){ + /* Return value: + * 0: Success + * -1: Detect topology error + * -2: SWPS internal error + */ + + struct ioexp_obj_s *curr_p = ioexp_head_p; + + if (!curr_p) { + SWPS_ERR("%s: ioexp_head_p is NULL\n", __func__); + return -2; + } + while (curr_p) { + if (_init_ioexp_obj(curr_p) < 0) { + SWPS_DEBUG("%s: _init_ioexp_obj() fail\n", __func__); + return -1; + } + curr_p = curr_p->next; + } + SWPS_DEBUG("%s: done.\n", __func__); + return 0; +} + + +void +clean_ioexp_objs(void){ + + struct ioexp_i2c_s *i2c_curr_p = NULL; + struct ioexp_i2c_s *i2c_next_p = NULL; + struct ioexp_obj_s *ioexp_next_p = NULL; + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + if (ioexp_head_p == NULL){ + ioexp_tail_p = NULL; + return; + } + while(ioexp_curr_p){ + ioexp_next_p = ioexp_curr_p->next; + i2c_curr_p = ioexp_curr_p->i2c_head_p; + while (i2c_curr_p) { + i2c_next_p = i2c_curr_p->next; + kfree(i2c_curr_p->i2c_client_p); + kfree(i2c_curr_p); + i2c_curr_p = i2c_next_p; + } + kfree(ioexp_curr_p); + ioexp_curr_p = ioexp_next_p; + } + ioexp_tail_p = NULL; + SWPS_DEBUG("%s: done.\n", __func__); +} + + +int +check_ioexp_objs(void){ + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while (ioexp_curr_p){ + if ( (ioexp_curr_p->check(ioexp_curr_p)) < 0){ + SWPS_INFO("check IOEXP-%d fail! :%d\n", + ioexp_curr_p->ioexp_id, ioexp_curr_p->ioexp_type); + return -1; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return 0; +} + + +struct ioexp_obj_s * +get_ioexp_obj(int ioexp_id){ + + struct ioexp_obj_s *result_p = NULL; + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + if (ioexp_curr_p->ioexp_id == ioexp_id){ + result_p = ioexp_curr_p; + break; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return result_p; +} + + +void +unlock_ioexp_all(void) { + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + mutex_unlock(&ioexp_curr_p->lock); + ioexp_curr_p = ioexp_curr_p->next; + } +} + + +int +lock_ioexp_all(void) { + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + mutex_lock(&ioexp_curr_p->lock); + ioexp_curr_p = ioexp_curr_p->next; + } + return 0; +} + + +int +check_channel_tier_1(void) { + + if ( (!_is_channel_ready(ioexp_head_p)) && + (!_is_channel_ready(ioexp_tail_p)) ){ + return -1; + } + return 0; +} + + +static int +_scan_channel_tier_1(int force, + int show_err) { + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + int ready = 0; + + if (!ioexp_curr_p) { + goto err_scan_tier_1_channel; + } + while(ioexp_curr_p) { + ready = _is_channel_ready(ioexp_curr_p); + if ((!ready) && (!force)) { + goto err_scan_tier_1_channel; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return 0; + +err_scan_tier_1_channel: + if (show_err) { + if (ioexp_curr_p) { + SWPS_INFO("%s: IOEXP-%d fail\n", __func__, ioexp_curr_p->ioexp_id); + } else { + SWPS_INFO("%s: IOEXP is null.\n", __func__); + } + } + return -1; +} + + +static int +_scan_channel_tier_1_single(void) { + + int ret = 0; + int chan_id = 0; + int fake_cid = 0; + int fake_offs = 0; + int fake_addr = 0; + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + + if (ioexp_head_p->ioexp_id != ioexp_tail_p->ioexp_id) { + return 0; + } + /* Setup i2c_client */ + chan_id = ioexp_head_p->ioexp_map_p->map_addr[fake_cid].chan_id; + fake_addr = ioexp_head_p->ioexp_map_p->map_addr[fake_cid].chip_addr; + adap = i2c_get_adapter((chan_id + 1)); + if(!adap){ + SWPS_INFO("%s: Can not get adap!\n", __func__); + return 0; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + SWPS_INFO("%s: Can not kzalloc client!\n", __func__); + return 0; + } + client->adapter = adap; + client->addr = fake_addr; + /* Fouce move ioexp ptr to next */ + ret = i2c_smbus_read_byte_data(client, fake_offs); + SWPS_DEBUG("%s: move ioexp_ptr done. :%d\n", __func__, ret); + kfree(client); + return 1; +} + + +int +resync_channel_tier_1(void) { + + char *emsg = "ERR"; + + if (!ioexp_head_p) { + emsg = "ioexp_head_p is NULL"; + goto err_resync_ioexp_status_1; + } + /* Run all */ + if (ioexp_head_p->ioexp_id == ioexp_tail_p->ioexp_id) { + _scan_channel_tier_1_single(); + } else { + _scan_channel_tier_1(1, 0); + } + /* Check all */ + if (_scan_channel_tier_1(0, 1) < 0) { + emsg = "resync tier-1 channel fail"; + goto err_resync_ioexp_status_1; + } + return 0; + +err_resync_ioexp_status_1: + SWPS_ERR("%s: %s\n", __func__, emsg); + return -1; +} + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/io_expander.h b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/io_expander.h new file mode 100644 index 000000000000..4e39fcefa620 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/io_expander.h @@ -0,0 +1,173 @@ +#ifndef IO_EXPANDER_H +#define IO_EXPANDER_H + +#include + + +/* IOEXP type define (SFP series) */ +#define IOEXP_TYPE_MAGINOLIA_NAB (10101) +#define IOEXP_TYPE_CYPRESS_NABC (10102) + +/* IOEXP type define (QSFP series) */ +#define IOEXP_TYPE_MAGINOLIA_7AB (10201) +#define IOEXP_TYPE_REDWOOD_P01P08 (10202) +#define IOEXP_TYPE_REDWOOD_P09P16 (10203) +#define IOEXP_TYPE_HUDSON32IGA_P01P08 (10204) +#define IOEXP_TYPE_HUDSON32IGA_P09P16 (10205) +#define IOEXP_TYPE_SPRUCE_7AB (10206) +#define IOEXP_TYPE_CYPRESS_7ABC (10207) +#define IOEXP_TYPE_TAHOE_5A (10208) +#define IOEXP_TYPE_TAHOE_6ABC (10209) +#define IOEXP_TYPE_SEQUOIA_NABC (10210) + +/* IOEXP mode define */ +#define IOEXP_MODE_POLLING (19000) +#define IOEXP_MODE_DIRECT (19001) + +/* IOEXP state define */ +#define STATE_IOEXP_NORMAL (0) +#define STATE_IOEXP_INIT (-1) +#define STATE_IOEXP_ABNORMAL (-2) + +/* IOEXP error code define */ +#define ERR_IOEXP_NOTSUPPORT (-100) +#define ERR_IOEXP_UNINIT (-101) +#define ERR_IOEXP_BADCONF (-102) +#define ERR_IOEXP_ABNORMAL (-103) +#define ERR_IOEXP_NOSTATE (-104) +#define ERR_IOEXP_BADINPUT (-105) +#define ERR_IOEXP_UNEXCPT (-199) + + +#define SWPS_INFO(fmt, args...) printk( KERN_INFO "[SWPS] " fmt, ##args) +#define SWPS_WARN(fmt, args...) printk( KERN_WARNING "[SWPS] " fmt, ##args) +#define SWPS_ERR(fmt, args...) printk( KERN_ERR "[SWPS] " fmt, ##args) + +#ifdef DEBUG_SWPS +# define SWPS_DEBUG(fmt, args...) printk( KERN_DEBUG "[SWPS] " fmt, ##args) +#else +# define SWPS_DEBUG(fmt, args...) +#endif + + +struct ioexp_addr_s { + int chan_id; + int chip_addr; + int read_offset[8]; + int write_offset[8]; + int conf_offset[8]; + uint8_t data_default[8]; + uint8_t conf_default[8]; +}; + +struct ioexp_i2c_s { + int chip_id; + struct i2c_client *i2c_client_p; + struct ioexp_i2c_s *next; +}; + + +struct ioexp_bitmap_s { + int chip_id; /* IOEXP chip id */ + int ioexp_voffset; /* IOEXP virtual offset */ + int bit_shift; +}; + +struct ioexp_map_s { + int chip_amount; /* Number of chips that IOEXP object content */ + int data_width; /* Number of (Read/Write/Config) bytes */ + struct ioexp_addr_s *map_addr; /* Chip address info */ + struct ioexp_bitmap_s map_present[10]; /* IOEXP for SFP / QSFP */ + struct ioexp_bitmap_s map_tx_disable[10]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_tx_fault[10]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_rxlos[10]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_reset[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_lpmod[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_modsel[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_hard_rs0[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_hard_rs1[10]; /* IOEXP for QSFP */ +}; + +struct ioexp_data_s { + uint8_t data[8]; +}; + +struct ioexp_obj_s { + + /* ============================ + * Object public property + * ============================ + */ + int ioexp_id; + int ioexp_type; + + /* ============================ + * Object private property + * ============================ + */ + struct ioexp_data_s chip_data[16]; /* Max: 8-ioexp in one virt-ioexp(ioexp_obj) */ + struct ioexp_map_s *ioexp_map_p; + struct ioexp_obj_s *next; + struct ioexp_i2c_s *i2c_head_p; + struct mutex lock; + int mode; + int state; + + /* =========================================== + * Object public functions + * =========================================== + */ + int (*get_present)(struct ioexp_obj_s *self, int virt_offset); + int (*get_tx_fault)(struct ioexp_obj_s *self, int virt_offset); + int (*get_rxlos)(struct ioexp_obj_s *self, int virt_offset); + int (*get_tx_disable)(struct ioexp_obj_s *self, int virt_offset); + int (*get_reset)(struct ioexp_obj_s *self, int virt_offset); + int (*get_lpmod)(struct ioexp_obj_s *self, int virt_offset); + int (*get_modsel)(struct ioexp_obj_s *self, int virt_offset); + int (*get_hard_rs0)(struct ioexp_obj_s *self, int virt_offset); + int (*get_hard_rs1)(struct ioexp_obj_s *self, int virt_offset); + int (*set_tx_disable)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_reset)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_lpmod)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_modsel)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_hard_rs0)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_hard_rs1)(struct ioexp_obj_s *self, int virt_offset, int input_val); + + /* =========================================== + * Object private functions + * =========================================== + */ + int (*init)(struct ioexp_obj_s *self); + int (*check)(struct ioexp_obj_s *self); + int (*update_all)(struct ioexp_obj_s *self, int show_err, char *caller_name); + int (*fsm_4_direct)(struct ioexp_obj_s* self); + int (*fsm_4_polling)(struct ioexp_obj_s* self); +}; + + +struct ioexp_obj_s* get_ioexp_obj(int ioexp_id); +int create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode); +int init_ioexp_objs(void); +int check_ioexp_objs(void); +void clean_ioexp_objs(void); + +void unlock_ioexp_all(void); +int lock_ioexp_all(void); + +int check_channel_tier_1(void); +int resync_channel_tier_1(void); + +/* Macro for bit control */ +#define SWP_BIT_SET(byte_val,bit_shift) ((byte_val) |= (1<<(bit_shift))) +#define SWP_BIT_CLEAR(byte_val,bit_shift) ((byte_val) &= ~(1<<(bit_shift))) + + +#endif /* IO_EXPANDER_H */ + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/transceiver.c b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/transceiver.c new file mode 100644 index 000000000000..0bbd78935433 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/transceiver.c @@ -0,0 +1,8212 @@ +#include +#include +#include +#include +#include "io_expander.h" +#include "transceiver.h" + + +/* ========== Register EEPROM address mapping ========== + */ +struct eeprom_map_s eeprom_map_sfp = { + .addr_br =0x50, .page_br =-1, .offset_br =12, .length_br =1, + .addr_cdr =-1, .page_cdr =-1, .offset_cdr =-1, .length_cdr =-1, + .addr_comp_rev =0x50, .page_comp_rev =-1, .offset_comp_rev =94, .length_comp_rev =1, + .addr_connector =0x50, .page_connector =-1, .offset_connector =2, .length_connector =1, + .addr_diag_type =0x50, .page_diag_type =-1, .offset_diag_type =92 , .length_diag_type =1, + .addr_extbr =-1, .page_extbr =-1, .offset_extbr =-1, .length_extbr =-1, + .addr_ext_id =0x50, .page_ext_id =-1, .offset_ext_id =1, .length_ext_id =1, + .addr_id =0x50, .page_id =-1, .offset_id =0, .length_id =1, + .addr_len_sm =0x50, .page_len_sm =-1, .offset_len_sm =15, .length_len_sm =1, + .addr_len_smf =0x50, .page_len_smf =-1, .offset_len_smf =14, .length_len_smf =1, + .addr_len_om1 =0x50, .page_len_om1 =-1, .offset_len_om1 =17, .length_len_om1 =1, + .addr_len_om2 =0x50, .page_len_om2 =-1, .offset_len_om2 =16, .length_len_om2 =1, + .addr_len_om3 =0x50, .page_len_om3 =-1, .offset_len_om3 =19, .length_len_om3 =1, + .addr_len_om4 =0x50, .page_len_om4 =-1, .offset_len_om4 =18, .length_len_om4 =1, + .addr_option =0x50, .page_option =-1, .offset_option =64, .length_option =2, + .addr_rate_id =0x50, .page_rate_id =-1, .offset_rate_id =13, .length_rate_id =1, + .addr_rx_am =-1, .page_rx_am =-1, .offset_rx_am =-1, .length_rx_am =-1, + .addr_rx_em =0x51, .page_rx_em =-1, .offset_rx_em =115, .length_rx_em =1, + .addr_rx_los =-1, .page_rx_los =-1, .offset_rx_los =-1, .length_rx_los =-1, + .addr_rx_power =0x51, .page_rx_power =-1, .offset_rx_power =104, .length_rx_power =2, + .addr_soft_rs0 =0x51, .page_soft_rs0 =-1, .offset_soft_rs0 =110, .length_soft_rs0 =1, + .addr_soft_rs1 =0x51, .page_soft_rs1 =-1, .offset_soft_rs1 =118, .length_soft_rs0 =1, + .addr_temp =0x51, .page_temp =-1, .offset_temp =96, .length_temp =2, + .addr_trancomp =0x50, .page_trancomp =-1, .offset_trancomp =3, .length_trancomp =8, + .addr_trancomp_ext =0x50, .page_trancomp_ext =-1, .offset_trancomp_ext =36, .length_trancomp_ext =1, + .addr_tx_bias =0x51, .page_tx_bias =-1, .offset_tx_bias =100, .length_tx_bias =2, + .addr_tx_disable =-1, .page_tx_disable =-1, .offset_tx_disable =-1, .length_tx_disable =-1, + .addr_tx_eq =0x51, .page_tx_eq =-1, .offset_tx_eq =114, .length_tx_eq =1, + .addr_tx_fault =-1, .page_tx_fault =-1, .offset_tx_fault =-1, .length_tx_fault =-1, + .addr_tx_power =0x51, .page_tx_power =-1, .offset_tx_power =102, .length_tx_power =2, + .addr_vendor_name =0x50, .page_vendor_name =-1, .offset_vendor_name =20, .length_vendor_name =16, + .addr_vendor_pn =0x50, .page_vendor_pn =-1, .offset_vendor_pn =40, .length_vendor_pn =16, + .addr_vendor_rev =0x50, .page_vendor_rev =-1, .offset_vendor_rev =56, .length_vendor_rev =4, + .addr_vendor_sn =0x50, .page_vendor_sn =-1, .offset_vendor_sn =68, .length_vendor_sn =16, + .addr_voltage =0x51, .page_voltage =-1, .offset_voltage =98, .length_voltage =2, + .addr_wavelength =0x50, .page_wavelength =-1, .offset_wavelength =60, .length_wavelength =2, +}; + +struct eeprom_map_s eeprom_map_qsfp = { + .addr_br =0x50, .page_br =0, .offset_br =140, .length_br =1, + .addr_cdr =-1, .page_cdr =-1, .offset_cdr =-1, .length_cdr =-1, + .addr_comp_rev =0x50, .page_comp_rev =-1, .offset_comp_rev =1, .length_comp_rev =1, + .addr_connector =0x50, .page_connector =0, .offset_connector =130, .length_connector =1, + .addr_diag_type =0x50, .page_diag_type =0, .offset_diag_type =220, .length_diag_type =1, + .addr_extbr =0x50, .page_extbr =0, .offset_extbr =222, .length_extbr =1, + .addr_ext_id =0x50, .page_ext_id =0, .offset_ext_id =129, .length_ext_id =1, + .addr_id =0x50, .page_id =0, .offset_id =128, .length_id =1, + .addr_len_sm =-1, .page_len_sm =-1, .offset_len_sm =-1, .length_len_sm =-1, + .addr_len_smf =0x50, .page_len_smf =0, .offset_len_smf =142, .length_len_smf =1, + .addr_len_om1 =0x50, .page_len_om1 =0, .offset_len_om1 =145, .length_len_om1 =1, + .addr_len_om2 =0x50, .page_len_om2 =0, .offset_len_om2 =144, .length_len_om2 =1, + .addr_len_om3 =0x50, .page_len_om3 =0, .offset_len_om3 =143, .length_len_om3 =1, + .addr_len_om4 =0x50, .page_len_om4 =0, .offset_len_om4 =146, .length_len_om4 =1, + .addr_option =0x50, .page_option =0, .offset_option =193, .length_option =3, + .addr_rate_id =-1, .page_rate_id =-1, .offset_rate_id =-1, .length_rate_id =-1, + .addr_rx_am =-1, .page_rx_am =-1, .offset_rx_am =-1, .length_rx_am =-1, + .addr_rx_em =-1, .page_rx_em =-1, .offset_rx_em =-1, .length_rx_em =-1, + .addr_rx_los =0x50, .page_rx_los =-1, .offset_rx_los =3, .length_rx_los =1, + .addr_rx_power =0x50, .page_rx_power =-1, .offset_rx_power =34, .length_rx_power =8, + .addr_soft_rs0 =-1, .page_soft_rs0 =-1, .offset_soft_rs0 =-1, .length_soft_rs0 =-1, + .addr_soft_rs1 =-1, .page_soft_rs1 =-1, .offset_soft_rs1 =-1, .length_soft_rs0 =-1, + .addr_temp =0x50, .page_temp =-1, .offset_temp =22, .length_temp =2, + .addr_trancomp =0x50, .page_trancomp =0, .offset_trancomp =131, .length_trancomp =8, + .addr_trancomp_ext =0x50, .page_trancomp_ext =0, .offset_trancomp_ext =192, .length_trancomp_ext =1, + .addr_tx_bias =0x50, .page_tx_bias =-1, .offset_tx_bias =42, .length_tx_bias =8, + .addr_tx_disable =0x50, .page_tx_disable =-1, .offset_tx_disable =86, .length_tx_disable =1, + .addr_tx_eq =-1, .page_tx_eq =-1, .offset_tx_eq =-1, .length_tx_eq =-1, + .addr_tx_fault =0x50, .page_tx_fault =-1, .offset_tx_fault =4, .length_tx_fault =1, + .addr_tx_power =0x50, .page_tx_power =-1, .offset_tx_power =50, .length_tx_power =8, + .addr_vendor_name =0x50, .page_vendor_name =0, .offset_vendor_name =148, .length_vendor_name =16, + .addr_vendor_pn =0x50, .page_vendor_pn =0, .offset_vendor_pn =168, .length_vendor_pn =16, + .addr_vendor_rev =0x50, .page_vendor_rev =0, .offset_vendor_rev =184, .length_vendor_rev =2, + .addr_vendor_sn =0x50, .page_vendor_sn =0, .offset_vendor_sn =196, .length_vendor_sn =16, + .addr_voltage =0x50, .page_voltage =-1, .offset_voltage =26, .length_voltage =2, + .addr_wavelength =0x50, .page_wavelength =0, .offset_wavelength =186, .length_wavelength =2, +}; + +struct eeprom_map_s eeprom_map_qsfp28 = { + .addr_br =0x50, .page_br =0, .offset_br =140, .length_br =1, + .addr_cdr =0x50, .page_cdr =-1, .offset_cdr =98, .length_cdr =1, + .addr_comp_rev =0x50, .page_comp_rev =-1, .offset_comp_rev =1, .length_comp_rev =1, + .addr_connector =0x50, .page_connector =0, .offset_connector =130, .length_connector =1, + .addr_diag_type =0x50, .page_diag_type =0, .offset_diag_type =220, .length_diag_type =1, + .addr_extbr =0x50, .page_extbr =0, .offset_extbr =222, .length_extbr =1, + .addr_ext_id =0x50, .page_ext_id =0, .offset_ext_id =129, .length_ext_id =1, + .addr_id =0x50, .page_id =0, .offset_id =128, .length_id =1, + .addr_len_sm =-1, .page_len_sm =-1, .offset_len_sm =-1, .length_len_sm =-1, + .addr_len_smf =0x50, .page_len_smf =0, .offset_len_smf =142, .length_len_smf =1, + .addr_len_om1 =0x50, .page_len_om1 =0, .offset_len_om1 =145, .length_len_om1 =1, + .addr_len_om2 =0x50, .page_len_om2 =0, .offset_len_om2 =144, .length_len_om2 =1, + .addr_len_om3 =0x50, .page_len_om3 =0, .offset_len_om3 =143, .length_len_om3 =1, + .addr_len_om4 =0x50, .page_len_om4 =0, .offset_len_om4 =146, .length_len_om4 =1, + .addr_option =0x50, .page_option =0, .offset_option =193, .length_option =3, + .addr_rate_id =-1, .page_rate_id =-1, .offset_rate_id =-1, .length_rate_id =-1, + .addr_rx_am =0x50, .page_rx_am =3, .offset_rx_am =238, .length_rx_am =2, + .addr_rx_em =0x50, .page_rx_em =3, .offset_rx_em =236, .length_rx_em =2, + .addr_rx_los =0x50, .page_rx_los =-1, .offset_rx_los =3, .length_rx_los =1, + .addr_rx_power =0x50, .page_rx_power =-1, .offset_rx_power =34, .length_rx_power =8, + .addr_soft_rs0 =-1, .page_soft_rs0 =-1, .offset_soft_rs0 =-1, .length_soft_rs0 =-1, + .addr_soft_rs1 =-1, .page_soft_rs1 =-1, .offset_soft_rs1 =-1, .length_soft_rs0 =-1, + .addr_temp =0x50, .page_temp =-1, .offset_temp =22, .length_temp =2, + .addr_trancomp =0x50, .page_trancomp =0, .offset_trancomp =131, .length_trancomp =8, + .addr_trancomp_ext =0x50, .page_trancomp_ext =0, .offset_trancomp_ext =192, .length_trancomp_ext =1, + .addr_tx_bias =0x50, .page_tx_bias =-1, .offset_tx_bias =42, .length_tx_bias =8, + .addr_tx_disable =0x50, .page_tx_disable =-1, .offset_tx_disable =86, .length_tx_disable =1, + .addr_tx_eq =0x50, .page_tx_eq =3, .offset_tx_eq =234, .length_tx_eq =2, + .addr_tx_fault =0x50, .page_tx_fault =-1, .offset_tx_fault =4, .length_tx_fault =1, + .addr_tx_power =0x50, .page_tx_power =-1, .offset_tx_power =50, .length_tx_power =8, + .addr_vendor_name =0x50, .page_vendor_name =0, .offset_vendor_name =148, .length_vendor_name =16, + .addr_vendor_pn =0x50, .page_vendor_pn =0, .offset_vendor_pn =168, .length_vendor_pn =16, + .addr_vendor_rev =0x50, .page_vendor_rev =0, .offset_vendor_rev =184, .length_vendor_rev =2, + .addr_vendor_sn =0x50, .page_vendor_sn =0, .offset_vendor_sn =196, .length_vendor_sn =16, + .addr_voltage =0x50, .page_voltage =-1, .offset_voltage =26, .length_voltage =2, + .addr_wavelength =0x50, .page_wavelength =0, .offset_wavelength =186, .length_wavelength =2, +}; + + +/* ========== Utility Functions ========== + */ +static int +get_bit(uint8_t origin_byte, int bit_shift) { + return (int)((origin_byte >> bit_shift) & 0x1); +} + +static int +transform_word_to_int(uint8_t hight_byte, + uint8_t low_byte) { + return ((((int)hight_byte) << 8) + (int)low_byte); +} + +void +alarm_msg_2_user(struct transvr_obj_s *self, + char *emsg) { + + SWPS_ERR("%s on %s.\n", emsg, self->swp_name); +} + + +/* ========== Private functions ========== + */ +static int +_reload_transvr_obj(struct transvr_obj_s *self,int new_type); + +static int +reload_transvr_obj(struct transvr_obj_s *self,int new_type); + +static int +_is_transvr_support_ctle(struct transvr_obj_s *self); + +static int +_transvr_init_handler(struct transvr_obj_s *self); + +int +_transvr_clean_handler(struct transvr_obj_s *self); + +int +_sfp_detect_class_by_1g_ethernet(struct transvr_obj_s* self); + + +void +lock_transvr_obj(struct transvr_obj_s *self) { + + mutex_lock(&self->lock); + self->curr_page = VAL_TRANSVR_PAGE_FREE; +} + + +void +unlock_transvr_obj(struct transvr_obj_s *self) { + + self->curr_page = VAL_TRANSVR_PAGE_FREE; + mutex_unlock(&self->lock); +} + + +static int +_check_by_mode(struct transvr_obj_s *self, + int (*attr_update_func)(struct transvr_obj_s *self, int show_err), + char *caller_name){ + + int return_val = ERR_TRANSVR_UNEXCPT; + + switch (self->mode){ + case TRANSVR_MODE_POLLING: + switch (self->state){ + case STATE_TRANSVR_CONNECTED: + goto ok_check_by_mode_1; + case STATE_TRANSVR_NEW: + case STATE_TRANSVR_INIT: + return ERR_TRANSVR_UNINIT; + case STATE_TRANSVR_DISCONNECTED: + return ERR_TRANSVR_UNPLUGGED; + case STATE_TRANSVR_UNEXCEPTED: + return ERR_TRANSVR_ABNORMAL; + case STATE_TRANSVR_ISOLATED: + return ERR_TRNASVR_BE_ISOLATED; + default: + goto err_check_by_mode_1; + } + goto ok_check_by_mode_1; + + case TRANSVR_MODE_DIRECT: + return_val = self->fsm_4_direct(self, caller_name); + if (return_val < 0){ + return return_val; + } + goto ok_check_by_mode_1; + + default: + goto err_check_by_mode_1; + } + goto ok_check_by_mode_1; + +ok_check_by_mode_1: + return attr_update_func(self, 0); + +err_check_by_mode_1: + SWPS_INFO("_check_by_mode: mode:%d state:%d\n", self->mode, self->state); + return ERR_TRANSVR_UNEXCPT; +} + + +static void +_transvr_clean_retry(struct transvr_obj_s *self) { + self->retry = 0; +} + + +static int +_transvr_handle_retry(struct transvr_obj_s *self, int retry) { + /* Return: 0: keep retry + * -1: stop retry + */ + if (self->retry == 0) { + self->retry = retry; + } + self->retry -= 1; + if (self->retry <= 0) { + _transvr_clean_retry(self); + return -1; + } + return 0; +} + + +static int +_common_setup_page(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + int show_e) { + /* return: + * 0 : OK + * -1 : EEPROM settings incorrect + * -2 : I2C R/W failure + * -3 : Undefined case + */ + int retval = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Check */ + if ((addr < 0) || (offset < 0) || (len < 0)) { + emsg = "EEPROM settings incorrect"; + retval = -1; + goto err_common_setup_page; + } + /* Case1: continue access */ + if ((self->i2c_client_p->addr == addr) && + (self->curr_page == page)) { + return 0; + } + self->i2c_client_p->addr = addr; + /* Case2: select lower page */ + if (page == -1) { + self->curr_page = page; + return 0; + } + /* Case3: select upper page */ + if (page >= 0) { + goto upper_common_setup_page; + } + /* Unexpected case */ + show_e = 1; + emsg = "Unexpected case"; + retval = -3; + goto err_common_setup_page; + +upper_common_setup_page: + if (i2c_smbus_write_byte_data(self->i2c_client_p, + VAL_TRANSVR_PAGE_SELECT_OFFSET, + page) < 0) { + emsg = "I2C R/W failure"; + retval = -2; + goto err_common_setup_page; + } + self->curr_page = page; + mdelay(VAL_TRANSVR_PAGE_SELECT_DELAY); + return 0; + +err_common_setup_page: + if (show_e) { + SWPS_INFO("%s: %s", __func__, emsg); + SWPS_INFO("%s: :0x%02x :%d :%d :%d\n", + __func__, addr, page, offset, len); + } + return retval; +} + +/* +static int +_common_setup_password(struct transvr_obj_s *self, + int addr, + int page, + int offs, + uint8_t pwd[4], + int show_e) { + int i = 0; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offs, 4, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_setup_password; + } + for (i=0; i<4; i++) { + err = i2c_smbus_write_byte_data(self->i2c_client_p, + (offs + i), + pwd[i]); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_setup_password; + } + } + return 0; + +err_common_setup_password: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, err); + } + return ERR_TRANSVR_UPDATE_FAIL; +} +*/ + +static int +_common_update_uint8_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + uint8_t *buf, + char *caller, + int show_e){ + + int i; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_update_uint8_attr; + } + for (i=0; ii2c_client_p, (offset + i)); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_update_uint8_attr; + } + buf[i] = err; + } + return 0; + +err_common_update_uint8_attr: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + buf[0] = DEBUG_TRANSVR_HEX_VAL; + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_update_int_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + int *buf, + char *caller, + int show_e){ + + int i; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_update_int_attr; + } + for (i=0; ii2c_client_p, (offset + i)); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_update_int_attr; + } + buf[i] = (int)err; + } + return 0; + +err_common_update_int_attr: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + buf[0] = DEBUG_TRANSVR_INT_VAL; + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_update_string_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + char buf[], + char *caller, + int show_e){ + + int i; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_update_string_attr; + } + for (i=0; ii2c_client_p, (offset + i)); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_update_string_attr; + } + buf[i] = (char)err; + } + return 0; + +err_common_update_string_attr: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + buf[0] = 'e'; + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_set_uint8_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + uint8_t update, + uint8_t *buf, + char *caller, + int show_e){ + int len = 1; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + if ((*buf) == update){ + return 0; + } + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_set_uint8_attr_1; + } + err = i2c_smbus_write_byte_data(self->i2c_client_p, + offset, + update); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_set_uint8_attr_1; + } + (*buf) = update; + return 0; + +err_common_set_uint8_attr_1: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_set_uint8_array(struct transvr_obj_s *self, + int addr, + int page, + int offs, + int len, + uint8_t update[], + uint8_t buf[], + char *caller, + int show_e){ + int i = 0; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offs, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_set_uint8_attr_1; + } + for (i=0; ii2c_client_p, + (offs + i), + update[i]); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_set_uint8_attr_1; + } + buf[i] = update[i]; + } + return 0; + +err_common_set_uint8_attr_1: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + __func__, emsg, caller, err, i); + } + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_update_attr_id(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_id, + self->eeprom_map_p->page_id, + self->eeprom_map_p->offset_id, + self->eeprom_map_p->length_id, + &(self->id), + "_common_update_attr_id", + show_err); +} + + +static int +_common_update_attr_extended_id(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_ext_id, + self->eeprom_map_p->page_ext_id, + self->eeprom_map_p->offset_ext_id, + self->eeprom_map_p->length_ext_id, + &(self->ext_id), + "_common_update_attr_extended_id", + show_err); +} + + +static int +_common_update_attr_connector(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_connector, + self->eeprom_map_p->page_connector, + self->eeprom_map_p->offset_connector, + self->eeprom_map_p->length_connector, + &(self->connector), + "_common_update_attr_connector", + show_err); +} + + +static int +_common_update_attr_transvr_comp(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_trancomp, + self->eeprom_map_p->page_trancomp, + self->eeprom_map_p->offset_trancomp, + self->eeprom_map_p->length_trancomp, + self->transvr_comp, + "_common_update_attr_transvr_comp", + show_err); +} + + +static int +_common_update_attr_transvr_comp_ext(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_trancomp_ext, + self->eeprom_map_p->page_trancomp_ext, + self->eeprom_map_p->offset_trancomp_ext, + self->eeprom_map_p->length_trancomp_ext, + &(self->transvr_comp_ext), + "_common_update_attr_transvr_comp_ext", + show_err); +} + + +static int +_common_update_attr_vendor_name(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_name, + self->eeprom_map_p->page_vendor_name, + self->eeprom_map_p->offset_vendor_name, + self->eeprom_map_p->length_vendor_name, + self->vendor_name, + "_common_update_attr_vendor_name", + show_err); +} + + +static int +_common_update_attr_vendor_pn(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_pn, + self->eeprom_map_p->page_vendor_pn, + self->eeprom_map_p->offset_vendor_pn, + self->eeprom_map_p->length_vendor_pn, + self->vendor_pn, + "_common_update_attr_vendor_pn", + show_err); +} + + +static int +_common_update_attr_vendor_rev(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_rev, + self->eeprom_map_p->page_vendor_rev, + self->eeprom_map_p->offset_vendor_rev, + self->eeprom_map_p->length_vendor_rev, + self->vendor_rev, + "_common_update_attr_vendor_rev", + show_err); +} + + +static int +_common_update_attr_vendor_sn(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_sn, + self->eeprom_map_p->page_vendor_sn, + self->eeprom_map_p->offset_vendor_sn, + self->eeprom_map_p->length_vendor_sn, + self->vendor_sn, + "_common_update_attr_vendor_sn", + show_err); +} + + +static int +_common_update_attr_br(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_br, + self->eeprom_map_p->page_br, + self->eeprom_map_p->offset_br, + self->eeprom_map_p->length_br, + &(self->br), + "_common_update_attr_br", + show_err); +} + + +static int +_common_update_attr_len_smf(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_smf, + self->eeprom_map_p->page_len_smf, + self->eeprom_map_p->offset_len_smf, + self->eeprom_map_p->length_len_smf, + &(self->len_smf), + "_common_update_attr_len_smf", + show_err); +} + + +static int +_common_update_attr_len_om1(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om1, + self->eeprom_map_p->page_len_om1, + self->eeprom_map_p->offset_len_om1, + self->eeprom_map_p->length_len_om1, + &(self->len_om1), + "_common_update_attr_len_om1", + show_err); +} + +static int +_common_update_attr_len_om2(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om2, + self->eeprom_map_p->page_len_om2, + self->eeprom_map_p->offset_len_om2, + self->eeprom_map_p->length_len_om2, + &(self->len_om2), + "_common_update_attr_len_om2", + show_err); +} + +static int +_common_update_attr_len_om3(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om3, + self->eeprom_map_p->page_len_om3, + self->eeprom_map_p->offset_len_om3, + self->eeprom_map_p->length_len_om3, + &(self->len_om3), + "_common_update_attr_len_om3", + show_err); +} + + +static int +_common_update_attr_len_om4(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om4, + self->eeprom_map_p->page_len_om4, + self->eeprom_map_p->offset_len_om4, + self->eeprom_map_p->length_len_om4, + &(self->len_om4), + "_common_update_attr_len_om4", + show_err); +} + + +static int +_common_update_attr_option(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_option, + self->eeprom_map_p->page_option, + self->eeprom_map_p->offset_option, + self->eeprom_map_p->length_option, + self->option, + "_common_update_attr_option", + show_err); +} + + +static int +_common_update_attr_comp_rev(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_comp_rev, + self->eeprom_map_p->page_comp_rev, + self->eeprom_map_p->offset_comp_rev, + self->eeprom_map_p->length_comp_rev, + &(self->comp_rev), + "_common_update_attr_comp_rev", + show_err); +} + + +static int +_common_update_attr_diag_type(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_diag_type, + self->eeprom_map_p->page_diag_type, + self->eeprom_map_p->offset_diag_type, + self->eeprom_map_p->length_diag_type, + &(self->diag_type), + "_common_update_attr_diag_type", + show_err); +} + + +static int +_common_update_attr_wavelength(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_wavelength, + self->eeprom_map_p->page_wavelength, + self->eeprom_map_p->offset_wavelength, + self->eeprom_map_p->length_wavelength, + self->wavelength, + "_common_update_attr_wavelength", + show_err); +} + + +int +_common_get_option_value(struct transvr_obj_s *self, + int offset, + int bit_shift) { + /* SFP: + * - option[0] = A0h / 64 + * - option[1] = A0h / 65 + * QSFP: + * - option[0] = 00h / 193 + * - option[1] = 00h / 194 + * - option[2] = 00h / 195 + */ + return (self->option[offset] & (1 << bit_shift)); +} + + +static int +_sfp_update_attr_len_sm(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_sm, + self->eeprom_map_p->page_len_sm, + self->eeprom_map_p->offset_len_sm, + self->eeprom_map_p->length_len_sm, + &(self->len_sm), + "_common_update_attr_len_sm", + show_err); +} + + +static int +_sfp_update_attr_rate_id(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_rate_id, + self->eeprom_map_p->page_rate_id, + self->eeprom_map_p->offset_rate_id, + self->eeprom_map_p->length_rate_id, + &(self->rate_id), + "_sfp_update_attr_rate_id", + show_err); +} + + +static int +_sfp_update_attr_soft_rs0(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_soft_rs0, + self->eeprom_map_p->page_soft_rs0, + self->eeprom_map_p->offset_soft_rs0, + self->eeprom_map_p->length_soft_rs0, + &(self->soft_rs0), + "_sfp_update_attr_soft_rs0", + show_err); +} + + +static int +_sfp_update_attr_soft_rs1(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_soft_rs1, + self->eeprom_map_p->page_soft_rs1, + self->eeprom_map_p->offset_soft_rs1, + self->eeprom_map_p->length_soft_rs1, + &(self->soft_rs1), + "_sfp_update_attr_soft_rs1", + show_err); +} + + +int +_sfp_is_diag_support(struct transvr_obj_s *self){ + + uint8_t bit_mask = 0xC0; /* 1100 0000 */ + uint8_t en_val = 0x40; /* 0100 0000 */ + uint8_t checkval = (self->diag_type & bit_mask); + + if (checkval == en_val) { + return 1; + } + return 0; +} + + +static int +_sfp_update_attr_curr_temp(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_temp, + self->eeprom_map_p->page_temp, + self->eeprom_map_p->offset_temp, + self->eeprom_map_p->length_temp, + self->curr_temp, + "_sfp_update_attr_curr_temp", + show_err); +} + + +static int +_sfp_update_attr_curr_voltage(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_voltage, + self->eeprom_map_p->page_voltage, + self->eeprom_map_p->offset_voltage, + self->eeprom_map_p->length_voltage, + self->curr_voltage, + "_sfp_update_attr_curr_voltage", + show_err); +} + + +static int +_sfp_update_attr_curr_tx_bias(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_bias, + self->eeprom_map_p->page_tx_bias, + self->eeprom_map_p->offset_tx_bias, + self->eeprom_map_p->length_tx_bias, + self->curr_tx_bias, + "_sfp_update_attr_curr_tx_bias", + show_err); +} + + +static int +_sfp_update_attr_curr_tx_power(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_power, + self->eeprom_map_p->page_tx_power, + self->eeprom_map_p->offset_tx_power, + self->eeprom_map_p->length_tx_power, + self->curr_tx_power, + "_sfp_update_attr_curr_tx_power", + show_err); +} + + +static int +_sfp_update_attr_curr_rx_power(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_power, + self->eeprom_map_p->page_rx_power, + self->eeprom_map_p->offset_rx_power, + self->eeprom_map_p->length_rx_power, + self->curr_rx_power, + "_sfp_update_attr_curr_rx_power", + show_err); +} + + +static int +_sfp_update_attr_rx_em(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + self->eeprom_map_p->length_rx_em, + self->rx_em, + "_sfp_update_attr_rx_em", + show_err); +} + + +static int +_sfp_update_attr_tx_eq(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + self->eeprom_map_p->length_tx_eq, + self->tx_eq, + "_sfp_update_attr_tx_eq", + show_err); +} + + +static int +_qsfp_update_attr_cdr(struct transvr_obj_s *self, + int show_err){ + if (self->type != TRANSVR_TYPE_QSFP_28){ + self->cdr = DEBUG_TRANSVR_HEX_VAL; + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->page_cdr, + self->eeprom_map_p->offset_cdr, + self->eeprom_map_p->length_cdr, + &(self->cdr), + "_common_update_attr_cdr", + show_err); +} + + +static int +_qsfg_update_attr_extbr(struct transvr_obj_s *self, + int show_err) { + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_extbr, + self->eeprom_map_p->page_extbr, + self->eeprom_map_p->offset_extbr, + self->eeprom_map_p->length_extbr, + &(self->extbr), + "_common_update_attr_extbr", + show_err); +} + + +static int +_qsfp_is_diag_support(struct transvr_obj_s *self, + int diag_type) { + /* Input Parm: diag_type + * => 1 : temperature + * => 2 : voltage + * => 3 : tx relate + * => 4 : rx relate + */ + uint8_t mask_b2 = 0x04; /* 0000 0100 */ + uint8_t mask_b3 = 0x08; /* 0000 1000 */ + + switch (diag_type) { + case 1: /* temperature */ + case 2: /* voltage */ + /* Direct access target, because of spec not defined */ + return 1; + case 3: + case 4: + /* [Note] + * Due to lot of transceiver vendor defined it not rigorously and + * consider of general support, we seem it as supported if there + * are bit-2 OR bit-3 defined by transceiver vendor. + */ + if ( ((self->diag_type & mask_b2) == mask_b2 ) || + ((self->diag_type & mask_b3) == mask_b3 ) ){ + return 1; + } + return 0; + default: + SWPS_INFO("%s: undefined diag_type:%d\n", + __func__, diag_type); + break; + } + return 0; +} + + +int +_qsfp_is_implement_tx_disable(struct transvr_obj_s *self) { + /* + * 00h / Byte-195 / Bit-4 + */ + int byte = 2; + int bit = 4; + return _common_get_option_value(self, byte, bit); +} + + +int +_qsfp_is_implement_tx_fault(struct transvr_obj_s *self) { + /* + * 00h / Byte-195 / Bit-3 + */ + int byte = 2; + int bit = 3; + return _common_get_option_value(self, byte, bit); +} + + +static int +_qsfp_update_attr_curr_temp(struct transvr_obj_s *self, + int show_err){ + int diag_type = 1; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_temp, + self->eeprom_map_p->page_temp, + self->eeprom_map_p->offset_temp, + self->eeprom_map_p->length_temp, + self->curr_temp, + "_qsfp_update_attr_curr_temp", + show_err); +} + + +static int +_qsfp_update_attr_curr_voltage(struct transvr_obj_s *self, + int show_err){ + int diag_type = 2; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_voltage, + self->eeprom_map_p->page_voltage, + self->eeprom_map_p->offset_voltage, + self->eeprom_map_p->length_voltage, + self->curr_voltage, + "_qsfp_update_attr_curr_voltage", + show_err); +} + + +static int +_qsfp_update_attr_curr_tx_bias(struct transvr_obj_s *self, + int show_err){ + int diag_type = 3; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_bias, + self->eeprom_map_p->page_tx_bias, + self->eeprom_map_p->offset_tx_bias, + self->eeprom_map_p->length_tx_bias, + self->curr_tx_bias, + "_qsfp_update_attr_curr_tx_bias", + show_err); +} + + +static int +_qsfp_update_attr_curr_tx_power(struct transvr_obj_s *self, + int show_err){ + int diag_type = 3; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_power, + self->eeprom_map_p->page_tx_power, + self->eeprom_map_p->offset_tx_power, + self->eeprom_map_p->length_tx_power, + self->curr_tx_power, + "_qsfp_update_attr_curr_tx_power", + show_err); +} + + +static int +_qsfp_update_attr_curr_rx_power(struct transvr_obj_s *self, + int show_err){ + int diag_type = 4; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_power, + self->eeprom_map_p->page_rx_power, + self->eeprom_map_p->offset_rx_power, + self->eeprom_map_p->length_rx_power, + self->curr_rx_power, + "_qsfp_update_attr_curr_rx_power", + show_err); +} + + +static int +_qsfp_update_attr_soft_rx_los(struct transvr_obj_s *self, + int show_err){ + + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_los, + self->eeprom_map_p->page_rx_los, + self->eeprom_map_p->offset_rx_los, + self->eeprom_map_p->length_rx_los, + &(self->rx_los), + "_qsfp_update_attr_soft_rx_los", + show_err); +} + + +static int +_qsfp_update_attr_soft_tx_disable(struct transvr_obj_s *self, + int show_err){ + + if (!_qsfp_is_implement_tx_disable(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + self->eeprom_map_p->length_tx_disable, + &(self->tx_disable), + "_qsfp_update_attr_soft_tx_disable", + show_err); +} + + +static int +_qsfp_update_attr_soft_tx_fault(struct transvr_obj_s *self, + int show_err){ + + if (!_qsfp_is_implement_tx_fault(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_fault, + self->eeprom_map_p->page_tx_fault, + self->eeprom_map_p->offset_tx_fault, + self->eeprom_map_p->length_tx_fault, + &(self->tx_fault), + "_qsfp_update_attr_soft_tx_fault", + show_err); +} + + +static int +_qsfp_update_attr_tx_eq(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + self->eeprom_map_p->length_tx_eq, + self->tx_eq, + "_qsfp_update_attr_tx_eq", + show_err); +} + + +static int +_qsfp_update_attr_rx_am(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_am, + self->eeprom_map_p->page_rx_am, + self->eeprom_map_p->offset_rx_am, + self->eeprom_map_p->length_rx_am, + self->rx_am, + "_qsfp_update_attr_rx_am", + show_err); +} + + +static int +_qsfp_update_attr_rx_em(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + self->eeprom_map_p->length_rx_em, + self->rx_em, + "_qsfp_update_attr_rx_em", + show_err); +} + + +int +_common_update_attr_all(struct transvr_obj_s *self, + int show_err){ + + char *err_str = "err"; + + if (_common_update_attr_id(self, show_err) < 0) { + err_str = "_common_update_attr_id"; + goto err_common_update_attr_all; + } + if (_common_update_attr_extended_id(self, show_err) < 0) { + err_str = "_common_update_attr_extended_id"; + goto err_common_update_attr_all; + } + if (_common_update_attr_connector(self, show_err) < 0) { + err_str = "_common_update_attr_connector"; + goto err_common_update_attr_all; + } + if (_common_update_attr_transvr_comp(self, show_err) < 0) { + err_str = "_common_update_attr_transvr_comp"; + goto err_common_update_attr_all; + } + if (_common_update_attr_transvr_comp_ext(self, show_err) < 0) { + err_str = "_common_update_attr_transvr_comp_ext"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_name(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_name"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_pn(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_pn"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_rev(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_rev"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_sn(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_sn"; + goto err_common_update_attr_all; + } + if (_common_update_attr_br(self, show_err) < 0) { + err_str = "_common_update_attr_br"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_smf(self, show_err) < 0) { + err_str = "_common_update_attr_len_smf"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om1(self, show_err) < 0) { + err_str = "_common_update_attr_len_om1"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om2(self, show_err) < 0) { + err_str = "_common_update_attr_len_om2"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om3(self, show_err) < 0) { + err_str = "_common_update_attr_len_om3"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om4(self, show_err) < 0) { + err_str = "_common_update_attr_len_om4"; + goto err_common_update_attr_all; + } + if (_common_update_attr_option(self, show_err) < 0) { + err_str = "_common_update_attr_option"; + goto err_common_update_attr_all; + } + if (_common_update_attr_comp_rev(self, show_err) < 0) { + err_str = "_common_update_attr_comp_rev"; + goto err_common_update_attr_all; + } + if (_common_update_attr_diag_type(self, show_err) < 0) { + err_str = "_common_update_attr_diag_type"; + goto err_common_update_attr_all; + } + if (_common_update_attr_wavelength(self, show_err) < 0) { + err_str = "_common_update_attr_wavelength"; + goto err_common_update_attr_all; + } + return 0; + +err_common_update_attr_all: + if (show_err){ + SWPS_INFO("%s: fail at:%s :%s\n", __func__, err_str, self->swp_name); + } + return -1; +} + + +int +_sfp_update_attr_all(struct transvr_obj_s *self, + int show_err){ + + char *err_str = DEBUG_TRANSVR_STR_VAL; + + if (_common_update_attr_all(self, show_err) < 0){ + err_str = "_common_update_attr_all"; + goto err_sfp_update_attr_all; + } + if (_sfp_update_attr_len_sm(self, show_err) < 0) { + err_str = "_sfp_update_attr_len_sm"; + goto err_sfp_update_attr_all; + } + if (_sfp_update_attr_rate_id(self, show_err) < 0) { + err_str = "_sfp_update_attr_rate_id"; + goto err_sfp_update_attr_all; + } + if ((self->rate_id) > 0) { + if (_sfp_update_attr_soft_rs0(self, show_err) < 0) { + err_str = "_sfp_update_attr_soft_rs0"; + goto err_sfp_update_attr_all; + } + if (_sfp_update_attr_soft_rs1(self, show_err) < 0) { + err_str = "_sfp_update_attr_soft_rs1"; + goto err_sfp_update_attr_all; + } + } + return 0; + +err_sfp_update_attr_all: + if (show_err){ + SWPS_INFO("%s: fail at:%s :%s\n", __func__, err_str, self->swp_name); + } + return -1; +} + + +int +_qsfp_update_attr_all(struct transvr_obj_s *self, + int show_err){ + + char *err_str = DEBUG_TRANSVR_STR_VAL; + + if (_common_update_attr_all(self, show_err) < 0){ + err_str = "_common_update_attr_all"; + goto err_qsfp_update_attr_all; + } + if (_qsfg_update_attr_extbr(self, show_err) < 0) { + err_str = "_qsfg_update_attr_extbr"; + goto err_qsfp_update_attr_all; + } + if (self->type == TRANSVR_TYPE_QSFP_28) { + if (_qsfp_update_attr_cdr(self, 1) < 0) { + err_str = "_qsfp_update_attr_cdr"; + goto err_qsfp_update_attr_all; + } + } + return 0; + +err_qsfp_update_attr_all: + if (show_err){ + SWPS_INFO("%s: fail at:%s :%s\n", __func__, err_str, self->swp_name); + } + return -1; +} + + +/* ========== Object functions for common type ========== + */ +int +_common_count_temp(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + int sign = 0; + int high = 0; + int low = 0; + int lmax = 8; + + /* Count high */ + sign = get_bit(high_byte,7); + SWP_BIT_CLEAR(high_byte, 7); + high = (int)high_byte; + if (sign == 1) { + high = 0 - high; + } + /* Count low */ + low = (get_bit(low_byte, 7) * 500); + low += (get_bit(low_byte, 6) * 250); + low += (get_bit(low_byte, 5) * 125); + low += (get_bit(low_byte, 4) * 62); + low = (low / 100); + /* Integrate High and Low */ + return snprintf(buf_p, lmax, "%d.%d\n", high, low); +} + + +int +_common_count_voltage(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note]: + * Internally measured transceiver supply voltage. Represented + * as a 16 bit unsigned integer with the voltage defined as the + * full 16 bit value (0-65535) with LSB equal to 100 uVolt, + * yielding a total range of 0 to +6.55 Volts. Practical + * considerations to be defined by transceiver manufacturer will + * tend to limit the actual bounds of the supply voltage measurement. + * Accuracy is vendor specific but must be better than 3% of the + * manufacturer's nominal value over specified operating temperature + * and voltage. Note that in some transceivers, transmitter supply + * voltage and receiver supply voltage are isolated. In that case, + * only one supply is monitored. Refer to the device specification + * for more detail. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 100 uV (1mV=1000uV) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total/10) / 1000); + val_f = ((total/10) - (val_i*1000)); + /* Return Unit: 1 Volt */ + return snprintf(buf_p, lmax, "%d.%03d\n", val_i, val_f); +} + + +int +_common_count_tx_bias(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note] + * Measured TX bias current in uA. Represented as a 16 bit unsigned + * integer with the current defined as the full 16 bit value (0-65535) + * with LSB equal to 2 uA, yielding a total range of 0 to 131 mA. + * Accuracy is vendor specific but must be better than 10% of the + * manufacturer's nominal value over specified operating temperature + * and voltage. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 2 uA (1mA=1000uA) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total*2) / 1000); + val_f = (((total*2) - (val_i*1000)) / 100); + /* Return Unit: 1 mA */ + return snprintf(buf_p, lmax, "%d.%01d\n", val_i, val_f); +} + + +int +_common_count_tx_power(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note] + * Measured TX output power in mW. Represented as a 16 bit unsigned + * integer with the power defined as the full 16 bit value (0-65535) + * with LSB equal to 0.1 uW, yielding a total range of 0 to 6.5535 mW + * (~ -40 to +8.2 dBm). Data is assumed to be based on measurement of + * laser monitor photodiode current. It is factory calibrated to absolute + * units using the most representative fiber output type. Accuracy is + * vendor specific but must be better than 3dB over specified temperature + * and voltage. Data is not valid when the transmitter is disabled. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 0.1 uW (1mW=1000uW) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total/10) / 1000); + val_f = ((total/10) - (val_i*1000)); + /* Return Unit: 1 mW */ + return snprintf(buf_p, lmax, "%d.%03d\n", val_i, val_f); +} + + +int +_common_count_rx_power(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note] + * Measured RX received optical power in mW. Value can represent either + * average received power or OMA depending upon how bit 3 of byte 92 (A0h) + * is set. Represented as a 16 bit unsigned integer with the power defined + * as the full 16 bit value (0-65535) with LSB equal to 0.1 uW, yielding a + * total range of 0 to 6.5535 mW (~ -40 to +8.2 dBm). Absolute accuracy is + * dependent upon the exact optical wavelength. For the vendor specified + * wavelength, accuracy shall be better than 3dB over specified temperature + * and voltage. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 0.1 uW (1mW=1000uW) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total/10) / 1000); + val_f = ((total/10) - (val_i*1000)); + /* Return Unit: 1 mW */ + return snprintf(buf_p, lmax, "%d.%03d\n", val_i, val_f); +} + + +int +_common_count_wavelength(struct transvr_obj_s *self, + uint8_t high_byte, + uint8_t low_byte) { + /* [Note] + * SFP : uint 1 um. + * QSFP: unit 0.05 um. + */ + int total = 0; + + total = transform_word_to_int(high_byte, low_byte); + switch (self->type) { + case TRANSVR_TYPE_SFP: + return total; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + return (total/20); + + default: + break; + } + return ERR_TRANSVR_UNDEFINED; +} + + +int +common_get_id(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_id, + "common_get_id"); + if (err_code < 0){ + return err_code; + } + /* Transform to INT to show error case */ + return (int)self->id; +} + + +int +common_get_ext_id(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_extended_id, + "common_get_ext_id"); + if (err_code < 0){ + return err_code; + } + /* Transform to INT to show error case */ + return (int)self->ext_id; +} + + +int +common_get_connector(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_connector, + "common_get_connector"); + if (err_code < 0){ + return err_code; + } + /* Transform to INT to show error case */ + return (int)self->connector; +} + + +int +common_get_vendor_name(struct transvr_obj_s *self, char *buf){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_name); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_name, + "common_get_vendor_name"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_name); +} + + +int +common_get_vendor_pn(struct transvr_obj_s *self, char *buf) { + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_pn); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_pn, + "common_get_vendor_pn"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_pn); +} + + +int +common_get_vendor_rev(struct transvr_obj_s *self, char *buf) { + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_rev); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_rev, + "common_get_vendor_rev"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_rev); +} + + +int +common_get_vendor_sn(struct transvr_obj_s *self, char *buf) { + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_sn); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_sn, + "common_get_vendor_sn"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_sn); +} + + +int +common_get_br(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return (int)self->br; + } + err = _check_by_mode(self, + &_common_update_attr_br, + "common_get_br"); + if (err < 0){ + return err; + } + /* Transform to INT to show error case */ + return (int)self->br; +} + + +int +common_get_len_smf(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_smf; + } + err = _check_by_mode(self, + &_common_update_attr_len_smf, + "common_get_len_smf"); + if (err < 0){ + return err; + } + return self->len_smf; +} + + +int +common_get_len_om1(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om1; + } + err = _check_by_mode(self, + &_common_update_attr_len_om1, + "common_get_len_om1"); + if (err < 0){ + return err; + } + return self->len_om1; +} + + +int +common_get_len_om2(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om2; + } + + err = _check_by_mode(self, + &_common_update_attr_len_om2, + "common_get_len_om2"); + if (err < 0){ + return err; + } + return self->len_om2; +} + + +int +common_get_len_om3(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om3; + } + + err = _check_by_mode(self, + &_common_update_attr_len_om3, + "common_get_len_om3"); + if (err < 0){ + return err; + } + return self->len_om3; +} + + +int +common_get_len_om4(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om4; + } + err = _check_by_mode(self, + &_common_update_attr_len_om4, + "common_get_len_om4"); + if (err < 0){ + return err; + } + return self->len_om4; +} + + +int +common_get_comp_extended(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp_ext, + "common_get_comp_extended"); + if (err_code < 0){ + return err_code; + } + return self->transvr_comp_ext; +} + + +int +common_get_comp_rev(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_comp_rev, + "common_get_comp_rev"); + if (err_code < 0){ + return err_code; + } + return self->comp_rev; +} + + +int +common_get_info(struct transvr_obj_s *self){ + + if (self->state != STATE_TRANSVR_CONNECTED) { + return self->state; + } + return self->info; +} + + +int +_common_get_if_lane(struct transvr_obj_s *self, + char *result){ + int i = 0; + int tmp_val = 0; + char tmp_str[LEN_TRANSVR_M_STR] = DEBUG_TRANSVR_STR_VAL; + + memset(result, 0, LEN_TRANSVR_M_STR); + + for (i=0; ilane_id); i++) { + tmp_val = self->lane_id[i]; + if (tmp_val < 1) { + break; + } + memset(tmp_str, 0, LEN_TRANSVR_M_STR); + if (i == 0) { + snprintf(tmp_str, LEN_TRANSVR_M_STR, "%d", tmp_val); + } else { + snprintf(tmp_str, LEN_TRANSVR_M_STR, ",%d", tmp_val); + } + strncat(result, tmp_str, LEN_TRANSVR_M_STR); + } + if (i == 0) { + return EVENT_TRANSVR_TASK_FAIL; + } + return 0; +} + + +int +common_get_if_lane(struct transvr_obj_s *self, + char *buf_p){ + + char tmp_str[LEN_TRANSVR_M_STR] = DEBUG_TRANSVR_STR_VAL; + + if (self->ioexp_obj_p->state != STATE_IOEXP_NORMAL) { + return snprintf(buf_p, LEN_TRANSVR_M_STR, "%d\n", ERR_TRANSVR_ABNORMAL); + } + if (_common_get_if_lane(self, tmp_str) < 0) { + return snprintf(buf_p, LEN_TRANSVR_M_STR, "%d\n" ,ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, LEN_TRANSVR_M_STR, "%s\n" ,tmp_str); +} + + +int +sfp_get_len_sm(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_sfp_update_attr_len_sm, + "sfp_get_len_sm"); + if (err_code < 0){ + return err_code; + } + return self->len_sm; +} + + +int +sfp_get_rate_id(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_sfp_update_attr_rate_id, + "sfp_get_rate_id"); + if (err_code < 0){ + return err_code; + } + return self->rate_id; +} + + +int +sfp_get_soft_rs0(struct transvr_obj_s *self){ + /* Note: + * SFP Soft Rate_Select Select [aka. "RS(0)"] address + * A2h, offset: 110, bit 3 (begin form 0) + */ + int err_code = DEBUG_TRANSVR_INT_VAL; + int bit_shift = 3; + uint8_t result = 0x00; + uint8_t bitmask = (1 << bit_shift); + + /* Check rate identifier is supported */ + err_code = self->get_rate_id(self); + if (err_code <= 0) { + return ERR_TRANSVR_NOTSUPPORT; + } + /* Update and check */ + err_code = _check_by_mode(self, + &_sfp_update_attr_soft_rs0, + "sfp_get_soft_rs0"); + if (err_code <0){ + return err_code; + } + result = (self->soft_rs0 & bitmask); + if (result == bitmask) { + return 1; + } + if (result == 0) { + return 0; + } + return ERR_TRANSVR_UNEXCPT; +} + + +int +sfp_get_soft_rs1(struct transvr_obj_s *self){ + /* Note: + * SFP Soft RS(1) Select address + * A2h, offset: 118, bit 3 (begin form 0) + */ + int err_code = DEBUG_TRANSVR_INT_VAL; + int bit_shift = 3; + uint8_t result = 0x00; + uint8_t bitmask = (1 << bit_shift); + + /* Check rate identifier is supported */ + err_code = self->get_rate_id(self); + if (err_code <= 0) { + return ERR_TRANSVR_NOTSUPPORT; + } + /* Update and check */ + err_code = _check_by_mode(self, + &_sfp_update_attr_soft_rs1, + "sfp_get_soft_rs1"); + if (err_code <0){ + return err_code; + } + result = (self->soft_rs1 & bitmask); + if (result == bitmask) { + return 1; + } + if (result == 0) { + return 0; + } + return ERR_TRANSVR_UNEXCPT; +} + + +int +sfp_get_transvr_temp(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_temp, + "sfp_get_transvr_temp"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_temp[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return _common_count_temp(self->curr_temp[0], + self->curr_temp[1], + buf_p); +} + + +int +sfp_get_transvr_voltage(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_voltage, + "sfp_get_transvr_voltage"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_voltage[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 Volt */ + return _common_count_voltage(self->curr_voltage[0], + self->curr_voltage[1], + buf_p); +} + + +int +sfp_get_transvr_tx_bias(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_tx_bias, + "sfp_get_transvr_tx_bias"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mA */ + return _common_count_tx_bias(self->curr_tx_bias[0], + self->curr_tx_bias[1], + buf_p); +} + + +int +sfp_get_transvr_tx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_tx_power, + "sfp_get_transvr_tx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _common_count_tx_power(self->curr_tx_power[0], + self->curr_tx_power[1], + buf_p); +} + + +int +sfp_get_transvr_rx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_rx_power, + "sfp_get_transvr_rx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _common_count_rx_power(self->curr_rx_power[0], + self->curr_rx_power[0], + buf_p); +} + + +int +sfp_get_transvr_rx_em(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_sfp_update_attr_rx_em, + "sfp_get_transvr_rx_em"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->tx_eq[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x\n", self->rx_em[0]); +} + + +int +sfp_get_transvr_tx_eq(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_sfp_update_attr_tx_eq, + "sfp_get_transvr_tx_eq"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->tx_eq[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x\n", self->tx_eq[0]); +} + + +int +_sfp_get_comp_extended(struct transvr_obj_s *self) { + /* Address: A0h / 36 + * Reference: SFF-8024 TABLE 4-4 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp_ext); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +__sfp_get_comp_attr(struct transvr_obj_s *self, + int array_offset) { + /* SFP Specification Compliance: A0h / 3-10 + * transvr_comp[0-7] = 3 - 10 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp[array_offset]); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +_sfp_get_comp_10g_eth_comp(struct transvr_obj_s *self) { + /* transvr_comp[0] = address A0h / 3 + * + * 3 7: 10G Base-ER + * 3 6: 10GBASE-LRM + * 3 5: 10GBASE-LR + * 3 4: 10GBASE-SR + */ + int bitmask = 0xf0; /* 11110000 */ + return (__sfp_get_comp_attr(self, 0) & bitmask); +} + + +int +_sfp_get_comp_1g_eth_comp(struct transvr_obj_s *self) { + /* transvr_comp[3] = address A0h / 6 + * + * 6 7: BASE-PX *3 + * 6 6: BASE-BX10 *3 + * 6 5: 100BASE-FX + * 6 4: 100BASE-LX/LX10 + * 6 3: 1000BASE-T + * 6 2: 1000BASE-CX + * 6 1: 1000BASE-LX *3 + * 6 0: 1000BASE-SX + */ + return __sfp_get_comp_attr(self, 3); +} + + +int +_sfp_get_cable_tech(struct transvr_obj_s *self) { + /* transvr_comp[5] = address A0h / 8 + * + * 8 3: Active Cable *8 + * 8 2: Passive Cable *8 + */ + int bitmask = 0x0c; /* 00001100 */ + return (__sfp_get_comp_attr(self, 5) & bitmask); +} + + +int +sfp_get_comp_eth_1(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "sfp_get_comp_eth_1"); + if (err_code < 0){ + return err_code; + } + return _sfp_get_comp_1g_eth_comp(self); +} + + +int +sfp_get_comp_eth_10(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "sfp_get_comp_eth_10"); + if (err_code < 0){ + return err_code; + } + return _sfp_get_comp_10g_eth_comp(self); +} + + +int +_sfp_get_connector_type(struct transvr_obj_s *self) { + /* Address: A0h / 2 + * Reference: SFF-8024 TABLE 4-3 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->connector); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +sfp_get_wavelength(struct transvr_obj_s *self, + char *buf_p) { + /* [Note] Optical and Cable Variants Specification Compliance (SFF-8472) + * [Addr] A0h, Bytes 60-61 + * [Note] For optical variants, as defined by having zero's in A0h Byte 8 + * bits 2 and 3, Bytes 60 and 61 denote nominal transmitter output + * wavelength at room temperature. 16 bit value with byte 60 as high + * order byte and byte 61 as low order byte. The laser wavelength is + * equal to the 16 bit integer value in nm. This field allows the user + * to read the laser wavelength directly, so it is not necessary to + * infer it from the Transceiver Codes A0h Bytes 3 to 10 (see Table + * 5-3). This also allows specification of wavelengths not covered + * in the Transceiver Codes, such as those used in coarse WDM systems. + * + * For passive and active cable variants, a value of 00h for both A0h + * Byte 60 and Byte 61 denotes laser wavelength or cable specification + * compliance is unspecified. + */ + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_common_update_attr_wavelength, + "common_get_wavelength"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->wavelength[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* unit: 1 um */ + return snprintf(buf_p, lmax, "%d\n", + _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1])); +} + + +int +__qsfp_get_power_cls(struct transvr_obj_s *self, + int direct_access){ + + int err_code; + uint8_t detect_val; + + /* Detect and Update power class attribute */ + if (direct_access){ + err_code = _check_by_mode(self, + &_common_update_attr_extended_id, + "__qsfp_get_power_cls"); + } else { + err_code = self->ext_id; + } + if (err_code <0){ + return err_code; + } + if (err_code == DEBUG_TRANSVR_HEX_VAL){ + return ERR_TRANSVR_UPDATE_FAIL; + } + /* Clean data */ + detect_val = self->ext_id; + SWP_BIT_CLEAR(detect_val, 2); /* Bit2: CDR RX present */ + SWP_BIT_CLEAR(detect_val, 3); /* Bit3: CDR TX present */ + SWP_BIT_CLEAR(detect_val, 4); /* Bit4: CLEI present */ + SWP_BIT_CLEAR(detect_val, 5); /* Bit5: reserved */ + /* Identify power class */ + switch (detect_val) { + case 0: /* Class_1: 00000000 */ + return 1; + case 64: /* Class_2: 01000000 */ + return 2; + case 128: /* Class_3: 10000000 */ + return 3; + case 192: /* Class_4: 11000000 */ + return 4; + case 1: /* Class_5: 00000001 */ + case 193: /* Class_5: 11000001 */ + return 5; + case 2: /* Class_6: 00000010 */ + case 194: /* Class_6: 11000010 */ + return 6; + case 3: /* Class_7: 00000011 */ + case 195: /* Class_7: 11000011 */ + return 7; + default: + break; + } + SWPS_INFO("%s: Detect undefined power class:%d\n", __func__, detect_val); + return ERR_TRANSVR_UNDEFINED; +} + + +int +qsfp_get_power_cls(struct transvr_obj_s *self) { + return __qsfp_get_power_cls(self, 1); +} + + +int +__qsfp_get_cdr_present(struct transvr_obj_s *self, + int direct_access){ + + int retval; + int BIT_SHIFT = 2; + int BIT_MASK = 0x3; + + /* Detect and Update power class attribute */ + if (direct_access) { + retval = _check_by_mode(self, + &_common_update_attr_extended_id, + "__qsfp_get_cdr_present"); + if (retval < 0){ + return retval; + } + } + retval = self->ext_id; + if (retval == DEBUG_TRANSVR_HEX_VAL){ + return ERR_TRANSVR_UPDATE_FAIL; + } + /* Clean data and return */ + return (int)(retval >> BIT_SHIFT & BIT_MASK); +} + + +int +qsfp_get_cdr_present(struct transvr_obj_s *self) { + return __qsfp_get_cdr_present(self, 1); +} + + +int +qsfp_get_cdr(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_qsfp_update_attr_cdr, + "qsfp_get_cdr"); + if (err_code <0){ + return err_code; + } + + return self->cdr; +} + + +int +__qsfp_get_comp_attr(struct transvr_obj_s *self, + int array_offset) { + /* QSFP Specification Compliance: 00h / 131-138 + * transvr_comp[0-7] = 131 - 138 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp[array_offset]); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +_qsfp_get_comp_10_40_100_ethernet(struct transvr_obj_s *self) { + /* transvr_comp[0] = address 00h / 131 + * + * 131 7: Extended: See section 6.3.23. The Extended Specification Compliance + * Codes are maintained in the Transceiver Management section of SFF- + * 8024. + * 131 6: 10GBASE-LRM + * 131 5: 10GBASE-LR + * 131 4: 10GBASE-SR + * 131 3: 40GBASE-CR4 + * 131 2: 40GBASE-SR4 + * 131 1: 40GBASE-LR4 + * 131 0: 40G Active Cable (XLPPI) + */ + return __qsfp_get_comp_attr(self, 0); +} + + +int +_qsfp_get_comp_sonet(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 132 7-3: Reserved + * 132 2: OC 48, long reach + * 132 1: OC 48, intermediate reach + * 132 0: OC 48 short reach + */ + return __qsfp_get_comp_attr(self, 1); +} + + +int +_qsfp_get_comp_sas_sata(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 133 7: SAS 24.0 Gb/s + * 133 6: SAS 12.0 Gb/s + * 133 5: SAS 6.0 Gb/s + * 133 4: SAS 3.0 Gb/s + * 133 3-0: Reserved + */ + return __qsfp_get_comp_attr(self, 2); +} + + +int +_qsfp_get_comp_ethernet(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 134 7-4: Reserved + * 134 3: 1000BASE-T + * 134 2: 1000BASE-CX + * 134 1: 1000BASE-LX + * 134 0: 1000BASE-SX + */ + return __qsfp_get_comp_attr(self, 3); +} + + +int +_qsfp_get_comp_fc_link_length(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 135 7: Very long distance (V) + * 135 6: Short distance (S) + * 135 5: Intermediate distance (I) + * 135 4: Long distance (L) + * 135 3: Medium (M) + */ + int mask = 0xFC; /* 11111100 */ + return (__qsfp_get_comp_attr(self, 4) & mask); +} + + +int +_qsfp_get_comp_fc_trans_tech(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 135 2: Reserved + * 135 1: Longwave laser (LC) + * 135 0: Electrical inter-enclosure (EL) + * + * 136 7: Electrical intra-enclosure + * 136 6: Shortwave laser w/o OFC (SN) + * 136 5: Shortwave laser w OFC (SL) + * 136 4: Longwave Laser (LL) + * 136 3-0: Reserved + * + * return value = [bit 8-15:addr 135][bit 0-7:addr 136] + */ + int mask_135 = 7; /* 00000111 */ + int val_135 = (__qsfp_get_comp_attr(self, 4) & mask_135); + int val_136 = __qsfp_get_comp_attr(self, 5); + return ((val_135 << 7) + val_136); +} + + +int +_qsfp_get_comp_fc_trans_media(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 137 7: Twin Axial Pair (TW) + * 137 6: Shielded Twisted Pair (TP) + * 137 5: Miniature Coax (MI) + * 137 4: Video Coax (TV) + * 137 3: Multi-mode 62.5 m (M6) + * 137 2: Multi-mode 50 m (M5) + * 137 1: Multi-mode 50 um (OM3) + * 137 0: Single Mode (SM) + */ + return __qsfp_get_comp_attr(self, 6); +} + + +int +_qsfp_get_comp_fc_speed(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 138 7: 1200 MBps (per channel) + * 138 6: 800 MBps + * 138 5: 1600 MBps (per channel) + * 138 4: 400 MBps + * 138 3: 3200 MBps (per channel) + * 138 2: 200 MBps + * 138 1: Extended: See section 6.3.23. The Extended Specification + * Compliance Codes are maintained in the Transceiver Management + * section of SFF-8024. + * 138 0: 100 MBps + */ + return __qsfp_get_comp_attr(self, 7); +} + + +int +_qsfp_get_comp_extended(struct transvr_obj_s *self) { + /* Address: 00h / 192 + * Reference: SFF-8024 TABLE 4-4 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp_ext); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_comp_eth(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "qsfp_get_comp_eth"); + if (err_code < 0){ + return err_code; + } + return _qsfp_get_comp_ethernet(self); +} + + +int +qsfp_get_comp_10_40(struct transvr_obj_s *self) { + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "qsfp_get_comp_10_40"); + if (err_code < 0){ + return err_code; + } + return _qsfp_get_comp_10_40_100_ethernet(self); +} + + +int +_qsfp_get_connector_type(struct transvr_obj_s *self) { + /* Address: 00h / 130 + * Reference: SFF-8024 TABLE 4-3 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->connector); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_transvr_temp(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_temp, + "qsfp_get_transvr_temp"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_temp[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return _common_count_temp(self->curr_temp[0], + self->curr_temp[1], + buf_p); +} + + +int +qsfp_get_transvr_voltage(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_voltage, + "qsfp_get_transvr_voltage"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_voltage[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 Volt */ + return _common_count_voltage(self->curr_voltage[0], + self->curr_voltage[1], + buf_p); +} + + +int +qsfp_get_transvr_tx_eq(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_qsfp_update_attr_tx_eq, + "qsfp_get_transvr_tx_eq"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->tx_eq[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x%02x\n", + self->tx_eq[0], self->tx_eq[1]); +} + + +int +qsfp_get_transvr_rx_am(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_qsfp_update_attr_rx_am, + "qsfp_get_transvr_rx_am"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->rx_am[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x%02x\n", + self->rx_am[0], self->rx_am[1]); +} + + +int +qsfp_get_transvr_rx_em(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_qsfp_update_attr_rx_em, + "qsfp_get_transvr_rx_em"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->rx_em[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x%02x\n", + self->rx_em[0], self->rx_em[1]); +} + + +int +_qsfp_get_channel_diag(uint8_t *data_array, + int (*count_func)(uint8_t high_byte, uint8_t low_byte, char *buf_p), + char *ch_name, + char *result_p) { + int i, high, low; + int len_max = 128; + char ch_buf[4][16] = { DEBUG_TRANSVR_STR_VAL, + DEBUG_TRANSVR_STR_VAL, + DEBUG_TRANSVR_STR_VAL, + DEBUG_TRANSVR_STR_VAL }; + + for (i=0; i<4; i++) { + high = (i*2); + low = ((i*2) + 1); + count_func(data_array[high], data_array[low], ch_buf[i]); + } + return snprintf(result_p, len_max, + "%s-%d:%s%s-%d:%s%s-%d:%s%s-%d:%s", + ch_name, 1, ch_buf[0], + ch_name, 2, ch_buf[1], + ch_name, 3, ch_buf[2], + ch_name, 4, ch_buf[3]); +} + + +int +qsfp_get_soft_rx_los(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int mask = 0x0f; /* Bit 0 ~ Bit 3 */ + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_soft_rx_los, + "qsfp_get_soft_rx_los"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + return snprintf(buf_p, lmax, "0x%02x\n", (self->rx_los & mask)); +} + + +int +qsfp_get_soft_tx_disable(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int mask = 0x0f; /* Bit 0 ~ Bit 3 */ + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_disable, + "qsfp_get_soft_tx_disable"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + return snprintf(buf_p, lmax, "0x%02x\n", (self->tx_disable & mask)); +} + + +int +qsfp_get_soft_tx_fault(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int mask = 0x0f; /* Bit 0 ~ Bit 3 */ + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_fault, + "qsfp_get_soft_tx_fault"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + return snprintf(buf_p, lmax, "0x%02x\n", (self->tx_fault & mask)); +} + + +int +qsfp_get_auto_tx_disable(struct transvr_obj_s *self, + char *buf_p) { + + if (self->auto_tx_disable == VAL_TRANSVR_FUNCTION_DISABLE) { + return snprintf(buf_p, LEN_TRANSVR_S_STR, + "%d\n", ERR_TRANSVR_FUNC_DISABLE); + } + return snprintf(buf_p, LEN_TRANSVR_S_STR, + "0x%02x\n", self->auto_tx_disable); +} + + +int +qsfp_get_transvr_tx_bias(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *ch_name = "TX"; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_tx_bias, + "qsfp_get_transvr_tx_bias"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mA */ + return _qsfp_get_channel_diag(self->curr_tx_bias, + _common_count_tx_bias, + ch_name, + buf_p); +} + + +int +qsfp_get_transvr_tx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *ch_name = "TX"; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_tx_power, + "qsfp_get_transvr_tx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_power[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _qsfp_get_channel_diag(self->curr_tx_power, + _common_count_tx_power, + ch_name, + buf_p); +} + + +int +qsfp_get_transvr_rx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *ch_name = "RX"; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_rx_power, + "qsfp_get_transvr_rx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_power[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _qsfp_get_channel_diag(self->curr_rx_power, + _common_count_rx_power, + ch_name, + buf_p); +} + + +int +qsfp_get_wavelength(struct transvr_obj_s *self, + char *buf_p) { + /* [Desc] Wavelength or Copper Cable Attenuation (SFF-8636) + * [Addr] 00h 186-187 + * [Note] + * For optical free side devices, this parameter identifies the nominal + * transmitter output wavelength at room temperature. This parameter is + * a 16-bit hex value with Byte 186 as high order byte and Byte 187 as + * low order byte. The laser wavelength is equal to the 16-bit integer value + * divided by 20 in nm (units of 0.05 nm). This resolution should be adequate + * to cover all relevant wavelengths yet provide enough resolution for all + * expected DWDM applications. For accurate representation of controlled + * wavelength applications, this value should represent the center of the + * guaranteed wavelength range. + * If the free side device is identified as copper cable these registers will + * be used to define the cable attenuation. An indication of 0 dB attenuation + * refers to the case where the attenuation is not known or is unavailable. + * Byte 186 (00-FFh) is the copper cable attenuation at 2.5 GHz in units of 1 dB. + * Byte 187 (00-FFh) is the copper cable attenuation at 5.0 GHz in units of 1 dB. + */ + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_common_update_attr_wavelength, + "common_get_wavelength"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->wavelength[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* unit: 1 um */ + return snprintf(buf_p, lmax, "%d\n", + _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1])); +} + + +/* Public Function for Setup Features + */ +static int +__sfp_set_soft_rs(struct transvr_obj_s *self, + int input_val, + int address, + int page, + int offset, + int bit_shift, + uint8_t *attr_p, + char *caller, + int show_err) { + + int retval = ERR_TRANSVR_UNEXCPT; + int err_code = ERR_TRANSVR_UNEXCPT; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + uint8_t update_val = (*attr_p); + + switch (input_val) { + case 0: + SWP_BIT_CLEAR(update_val, bit_shift); + break; + case 1: + SWP_BIT_SET(update_val, bit_shift); + break; + default: + retval = ERR_TRANSVR_UNEXCPT; + err_code = ERR_TRANSVR_UNEXCPT; + err_msg = "Exception occurs"; + goto err_private_sfp_set_soft_rs_1; + } + err_code = _common_set_uint8_attr(self, + address, + page, + offset, + update_val, + attr_p, + caller, + show_err); + if (err_code < 0) { + retval = err_code; + err_msg = "Write data via i2c fail!"; + goto err_private_sfp_set_soft_rs_1; + } + (*attr_p) = update_val; + return 0; + +err_private_sfp_set_soft_rs_1: + if (show_err) { + SWPS_INFO("%s: %s :%d :%s\n :%d\n", + __func__, err_msg, err_code, self->swp_name, input_val); + } + return retval; +} + + +static int +_sfp_set_soft_rs(struct transvr_obj_s *self, + int input_val, + int address, + int page, + int offset, + int bit_shift, + int (*attr_update_func)(struct transvr_obj_s *self, int show_err), + uint8_t *attr_p, + char *caller, + int show_err) { + + int retval = ERR_TRANSVR_UNEXCPT; + int err_code = ERR_TRANSVR_UNEXCPT; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + + /* Check input value */ + if ((input_val != 0) && (input_val != 1)){ + retval = ERR_TRANSVR_BADINPUT; + err_code = ERR_TRANSVR_BADINPUT; + err_msg = "Input range incorrect!"; + goto err_common_sfp_set_soft_rs_1; + } + /* Check rate identifier is supported */ + err_code = self->get_rate_id(self); + if (err_code <= 0) { + switch (err_code) { + case 0: + retval = ERR_TRANSVR_NOTSUPPORT; + err_msg = "Not support this feature"; + break; + case ERR_TRANSVR_UNINIT: + retval = ERR_TRANSVR_UNINIT; + err_msg = "Check CDR present fail!"; + break; + case ERR_TRANSVR_UNPLUGGED: + retval = ERR_TRANSVR_UNPLUGGED; + err_msg = "Transceiver unplugged!"; + break; + default: + retval = err_code; + err_msg = "Check Rate_ID fail!"; + break; + } + goto err_common_sfp_set_soft_rs_1; + } + /* Check and update */ + err_code = _check_by_mode(self, + attr_update_func, + caller); + if ( (err_code < 0) || + ((*attr_p) == DEBUG_TRANSVR_HEX_VAL) ){ + retval = err_code; + err_msg = "Get current value fail!"; + goto err_common_sfp_set_soft_rs_1; + } + /* Generate and update value */ + return __sfp_set_soft_rs(self, + input_val, + address, + page, + offset, + bit_shift, + attr_p, + caller, + show_err); + +err_common_sfp_set_soft_rs_1: + if (show_err) { + SWPS_INFO("%s: %s :%d :%s\n :%d\n", + __func__, err_msg, err_code, self->swp_name, input_val); + } + return retval; +} + + +int +sfp_set_soft_rs0(struct transvr_obj_s *self, + int input_val) { + /* Note: + * SFP Soft Rate_Select Select RX ["RS(0)"] address + * A2h, offset: 110, bit 3 + */ + int bit_shift = 3; + int show_err = 1; + return _sfp_set_soft_rs(self, + input_val, + self->eeprom_map_p->addr_soft_rs0, + self->eeprom_map_p->page_soft_rs0, + self->eeprom_map_p->offset_soft_rs0, + bit_shift, + &_sfp_update_attr_soft_rs0, + &(self->soft_rs0), + "sfp_set_soft_rs0", + show_err); +} + + +int +sfp_set_soft_rs1(struct transvr_obj_s *self, + int input_val) { + /* Note: + * SFP Soft Rate_Select Select RX ["RS(1)"] address + * A2h, offset: 118, bit 3 + */ + int bit_shift = 3; + int show_err = 1; + return _sfp_set_soft_rs(self, + input_val, + self->eeprom_map_p->addr_soft_rs1, + self->eeprom_map_p->page_soft_rs1, + self->eeprom_map_p->offset_soft_rs1, + bit_shift, + &_sfp_update_attr_soft_rs1, + &(self->soft_rs1), + "sfp_set_soft_rs1", + show_err); +} + + +int +__sfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv = DEBUG_TRANSVR_HEX_VAL; + + if ((input < 0) || (input > 0xFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_sfp_set_tx_eq; + } + setv = (uint8_t)input; + if (self->tx_eq[0] == setv) { + return 0; + } + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + setv, + &(self->tx_eq[0]), + "_sfp_set_tx_eq", + show_e); + if (err < 0) { + emsg = "set_uint8_attr fail"; + goto err_sfp_set_tx_eq; + } + return 0; + +err_sfp_set_tx_eq: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_sfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + + uint8_t tmp; + int i = 0; + int retry = 3; + + for (i=0; itx_eq[0]; + if (_sfp_update_attr_tx_eq(self, show_e) < 0){ + continue; + } + if (self->tx_eq[0] == tmp){ + return 0; + } + } + return ERR_TRANSVR_UPDATE_FAIL; +} + + +int +sfp_set_tx_eq(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_sfp_update_attr_tx_eq, + "sfp_set_tx_eq"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _sfp_set_tx_eq(self, input, 1); +} + + +int +__sfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv = DEBUG_TRANSVR_HEX_VAL; + + if ((input < 0) || (input > 0xFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_sfp_set_rx_em; + } + setv = (uint8_t)input; + if (self->rx_em[0] == setv) { + return 0; + } + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + setv, + &(self->rx_em[0]), + "_sfp_set_rx_em", + show_e); + if (err < 0) { + emsg = "set_uint8_attr fail"; + goto err_sfp_set_rx_em; + } + return 0; + +err_sfp_set_rx_em: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_sfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + + uint8_t tmp; + int i = 0; + int retry = 3; + + for (i=0; irx_em[0]; + if (_sfp_update_attr_rx_em(self, show_e) < 0){ + continue; + } + if (self->rx_em[0] == tmp){ + return 0; + } + } + return -1; +} + + +int +sfp_set_rx_em(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_sfp_update_attr_rx_em, + "sfp_set_rx_em"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _sfp_set_rx_em(self, input, 1); +} + + +static int +__qsfp_set_cdr(struct transvr_obj_s *self, + int input_val, + int show_err) { + + uint8_t update_val; + int CDR_FEATURE_SUPPORTED = 0x3; + int retval = ERR_TRANSVR_UNEXCPT; + int err_code = ERR_TRANSVR_UNEXCPT; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + char *func_name = "__qsfp_set_cdr"; + + /* Check input value */ + if ((input_val < 0) || (input_val > 0xff)){ + retval = ERR_TRANSVR_BADINPUT; + err_code = ERR_TRANSVR_BADINPUT; + err_msg = "Input range incorrect!"; + goto err_qsfp_set_cdr_1; + } + update_val = (uint8_t)input_val; + /* Check CDR supported by transceiver */ + err_code = qsfp_get_cdr_present(self); + if (err_code < 0) { + retval = err_code; + switch (err_code) { + case ERR_TRANSVR_UNINIT: + err_msg = "Check CDR present fail!"; + break; + case ERR_TRANSVR_UNPLUGGED: + err_msg = "Transceiver unplugged!"; + break; + default: + err_msg = "Check CDR present fail!"; + break; + } + goto err_qsfp_set_cdr_1; + } + if (err_code != CDR_FEATURE_SUPPORTED) { + retval = ERR_TRANSVR_NOTSUPPORT; + err_msg = "This transceiver not support CDR!"; + goto err_qsfp_set_cdr_1; + } + /* Check and update */ + err_code = _check_by_mode(self, + &_qsfp_update_attr_cdr, + func_name); + if ( (err_code < 0) || + (self->cdr == DEBUG_TRANSVR_HEX_VAL) ){ + retval = err_code; + err_msg = "Get current value fail!"; + goto err_qsfp_set_cdr_1; + } + /* Write input value to transceiver */ + return _common_set_uint8_attr(self, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->page_cdr, + self->eeprom_map_p->offset_cdr, + update_val, + &(self->cdr), + func_name, + show_err); + +err_qsfp_set_cdr_1: + if (show_err) { + SWPS_INFO("%s: %s :%d :%s\n :%d\n", + __func__, err_msg, err_code, self->swp_name, input_val); + } + return retval; +} + + +int +qsfp_set_cdr(struct transvr_obj_s *self, + int input_val) { + return __qsfp_set_cdr(self, input_val, 1); +} + + +int +qsfp_set_soft_tx_disable(struct transvr_obj_s *self, + int input_val) { + + int show_err = 1; + int in_max = 0xf; /* 1111 */ + int in_min = 0x0; /* 0000 */ + int retval = DEBUG_TRANSVR_INT_VAL; + int update_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + retval = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_disable, + "qsfp_set_soft_tx_disable"); + if (retval < 0) { + snprintf(err_msg, 63, "Not ready. err:%d", retval); + goto err_qsfp_set_soft_tx_disable; + } + if ((input_val > in_max) || + (input_val < in_min) ){ + retval = ERR_TRANSVR_BADINPUT; + snprintf(err_msg, 63, "Input value:%d incorrect!", input_val); + goto err_qsfp_set_soft_tx_disable; + } + if ((self->tx_disable & 0x0f) == input_val) { + return 0; + } + update_val = ((self->tx_disable & 0xf0) & input_val); + retval = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + input_val, + &(self->tx_disable), + "qsfp_set_tx_disable", + show_err); + if (retval < 0) { + snprintf(err_msg, 63, "_common_set_uint8_attr:%d fail!", retval); + goto err_qsfp_set_soft_tx_disable; + } + return 0; + +err_qsfp_set_soft_tx_disable: + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return retval; +} + + +int +_qsfp_set_auto_tx_disable(struct transvr_obj_s *self, + uint8_t update) { + + uint8_t tx_enable = 0x0; + int show_e = 1; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Handle timing issues */ + if (update != tx_enable) { + /* Note: + * Because there are some txvr has timing issues, + * therefore we need to execute reset cycle first. + * (enable -> other settings) + */ + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + tx_enable, + &(self->tx_disable), + "_qsfp_set_auto_tx_disable", + show_e); + if (err < 0) { + emsg = "I2C set reset value fail"; + goto err_qsfp_set_auto_tx_disable; + } + mdelay(10); + } + /* Setup target value */ + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + self->auto_tx_disable, + &(self->tx_disable), + "_qsfp_set_auto_tx_disable", + show_e); + if (err < 0) { + emsg = "I2C set target value fail"; + goto err_qsfp_set_auto_tx_disable; + } + /* Check and update */ + err = _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + self->eeprom_map_p->length_tx_disable, + &(self->tx_disable), + "_qsfp_set_auto_tx_disable", + show_e); + if (err < 0) { + emsg = "I2C get value fail"; + goto err_qsfp_set_auto_tx_disable; + } + if (self->tx_disable != update) { + emsg = "data not become effective"; + goto err_qsfp_set_auto_tx_disable; + } + return 0; + +err_qsfp_set_auto_tx_disable: + SWPS_DEBUG("%s: %s :%s\n", + __func__, emsg, self->swp_name); + return ERR_TRANSVR_UPDATE_FAIL; +} + + +int +qsfp_set_auto_tx_disable(struct transvr_obj_s *self, + int input_val) { + + int in_max = 0xf; /* 1111 */ + int in_min = 0x0; /* 0000 */ + int retval = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Update settings*/ + if (input_val == VAL_TRANSVR_FUNCTION_DISABLE) { + emsg = "User disable auto tx_disable"; + self->auto_tx_disable = VAL_TRANSVR_FUNCTION_DISABLE; + goto out_qsfp_set_auto_tx_disable; + } + if ((input_val > in_max) || (input_val < in_min) ){ + SWPS_INFO("%s: Input value:%d incorrect! :%s\n", + __func__, input_val, self->swp_name); + return ERR_TRANSVR_BADINPUT; + } + self->auto_tx_disable = input_val; + /* Check current soft tx_disable */ + retval = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_disable, + "qsfp_set_auto_tx_disable"); + switch (retval) { + case 0: + break; + case ERR_TRANSVR_UNPLUGGED: + emsg = "Doesn't need to update"; + goto out_qsfp_set_auto_tx_disable; + default: + SWPS_INFO("%s: setup fail :%d :%s\n", + __func__, retval, self->swp_name); + return retval; + } + return _qsfp_set_auto_tx_disable(self, input_val); + +out_qsfp_set_auto_tx_disable: + SWPS_DEBUG("%s: %s :%s :%d\n :%d", + __func__, emsg, self->swp_name, input_val, retval); + return 0; +} + + +int +__qsfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + /* [Note] + * 0x + */ + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv[2] = {0x00, 0x00}; + + if ((input < 0) || (input > 0xFFFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_qsfp_set_tx_eq; + } + setv[0] = (uint8_t)((input & 0xFF00) >> 8); + setv[1] = (uint8_t)(input & 0xFF); + if ((self->tx_eq[0] == setv[0]) && + (self->tx_eq[1] == setv[1]) ) { + return 0; + } + err = _common_set_uint8_array(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + self->eeprom_map_p->length_tx_eq, + setv, + self->tx_eq, + "_qsfp_set_tx_eq", + show_e); + if (err < 0) { + emsg = "set_uint8_array fail"; + goto err_qsfp_set_tx_eq; + } + return 0; + +err_qsfp_set_tx_eq: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_qsfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + + int i = 0; + int retry = 3; + uint8_t tmp[2]; + + for (i=0; itx_eq[0]; + tmp[1] = self->tx_eq[1]; + if (_qsfp_update_attr_tx_eq(self, show_e) < 0){ + continue; + } + if ((self->tx_eq[0] == tmp[0]) && + (self->tx_eq[1] == tmp[1]) ){ + return 0; + } + } + return -1; +} + + +int +qsfp_set_tx_eq(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_qsfp_update_attr_tx_eq, + "qsfp_set_tx_eq"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _qsfp_set_tx_eq(self, input, 1); +} + + +int +__qsfp_set_rx_am(struct transvr_obj_s *self, + int input, + int show_e) { + /* [Note] + * 0x + */ + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv[2] = {0x00, 0x00}; + + if ((input < 0) || (input > 0xFFFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_qsfp_set_rx_am; + } + setv[0] = (uint8_t)((input & 0xFF00) >> 8); + setv[1] = (uint8_t)(input & 0xFF); + if ((self->rx_am[0] == setv[0]) && + (self->rx_am[1] == setv[1]) ) { + return 0; + } + err = _common_set_uint8_array(self, + self->eeprom_map_p->addr_rx_am, + self->eeprom_map_p->page_rx_am, + self->eeprom_map_p->offset_rx_am, + self->eeprom_map_p->length_rx_am, + setv, + self->rx_am, + "_qsfp_set_rx_am", + show_e); + if (err < 0) { + emsg = "set_uint8_array fail"; + goto err_qsfp_set_rx_am; + } + return 0; + +err_qsfp_set_rx_am: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_qsfp_set_rx_am(struct transvr_obj_s *self, + int input, + int show_e) { + + int i = 0; + int retry = 3; + uint8_t tmp[2]; + + for (i=0; irx_am[0]; + tmp[1] = self->rx_am[1]; + if (_qsfp_update_attr_rx_am(self, show_e) < 0){ + continue; + } + if ((self->rx_am[0] == tmp[0]) && + (self->rx_am[1] == tmp[1]) ){ + return 0; + } + } + return -1; +} + + +int +qsfp_set_rx_am(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_qsfp_update_attr_rx_am, + "qsfp_set_rx_am"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _qsfp_set_rx_am(self, input, 1); +} + + +int +__qsfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + /* [Note] + * 0x + */ + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv[2] = {0x00, 0x00}; + + if ((input < 0) || (input > 0xFFFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_qsfp_set_rx_em; + } + setv[0] = (uint8_t)((input & 0xFF00) >> 8); + setv[1] = (uint8_t)(input & 0xFF); + if ((self->rx_em[0] == setv[0]) && + (self->rx_em[1] == setv[1]) ) { + return 0; + } + err = _common_set_uint8_array(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + self->eeprom_map_p->length_rx_em, + setv, + self->rx_em, + "_qsfp_set_rx_em", + show_e); + if (err < 0) { + emsg = "set_uint8_array fail"; + goto err_qsfp_set_rx_em; + } + return 0; + +err_qsfp_set_rx_em: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_qsfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + + int i = 0; + int retry = 3; + uint8_t tmp[2]; + + for (i=0; irx_em[0]; + tmp[1] = self->rx_em[1]; + if (_qsfp_update_attr_rx_em(self, show_e) < 0){ + continue; + } + if ((self->rx_em[0] == tmp[0]) && + (self->rx_em[1] == tmp[1]) ){ + return 0; + } + } + return -1; +} + + +int +qsfp_set_rx_em(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_qsfp_update_attr_rx_em, + "qsfp_set_rx_em"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _qsfp_set_rx_em(self, input, 1); +} + + +int +common_transvr_dump(struct transvr_obj_s* self){ + + char *type_name = "Undefined"; + + if (TRANSVR_INFO_DUMP_ENABLE != 1) { + return 0; + } + switch (self->type) { + case TRANSVR_TYPE_SFP: + type_name = STR_TRANSVR_SFP; + break; + case TRANSVR_TYPE_QSFP: + type_name = STR_TRANSVR_QSFP; + break; + case TRANSVR_TYPE_QSFP_PLUS: + type_name = STR_TRANSVR_QSFP_PLUS; + break; + case TRANSVR_TYPE_QSFP_28: + type_name = STR_TRANSVR_QSFP28; + break; + case TRANSVR_TYPE_FAKE: + type_name = "FAKE"; + goto ok_common_transvr_dump; + case TRANSVR_TYPE_UNPLUGGED: + type_name = "UNPLUGGED"; + goto err_common_transvr_dump; + case TRANSVR_TYPE_INCONSISTENT: + type_name = "INCONSISTENT"; + goto err_common_transvr_dump; + case TRANSVR_TYPE_ERROR: + type_name = "ERROR"; + goto err_common_transvr_dump; + + default: + type_name = "UNEXPECTED"; + goto err_common_transvr_dump; + } + printk(KERN_INFO "[SWPS] Dump %s information:\n", self->swp_name); + printk(KERN_INFO " |- :%s\n", type_name); + printk(KERN_INFO " |- :%s\n", self->vendor_name); + printk(KERN_INFO " |- :%s\n", self->vendor_pn); + printk(KERN_INFO " |- :%s\n", self->vendor_rev); + printk(KERN_INFO " |- :%s\n", self->vendor_sn); + printk(KERN_INFO " |- :0x%02x\n", self->br); + printk(KERN_INFO " |- :0x%02x\n", self->comp_rev); + printk(KERN_INFO " |- :%d\n", self->len_om1); + printk(KERN_INFO " |- :%d\n", self->len_om2); + printk(KERN_INFO " |- :%d\n", self->len_om3); + printk(KERN_INFO " |- :%d\n", self->len_om4); + return 0; + +ok_common_transvr_dump: + SWPS_INFO("%s: %s is %s\n", __func__, self->swp_name, type_name); + return 0; + +err_common_transvr_dump: + SWPS_INFO("%s: %s is %s\n", __func__, self->swp_name, type_name); + return -1; +} + + +int +sfp_transvr_dump(struct transvr_obj_s* self) { + + if (TRANSVR_INFO_DUMP_ENABLE != 1) { + return 0; + } + if (common_transvr_dump(self) < 0) { + return -1; + } + printk(KERN_INFO " |- :%d\n", self->len_sm); + printk(KERN_INFO " |- :%d\n", self->len_smf); + printk(KERN_INFO " '- :0x%02x\n", self->rate_id); + return 0; +} + + +int +qsfp_transvr_dump(struct transvr_obj_s* self) { + + if (TRANSVR_INFO_DUMP_ENABLE != 1) { + return 0; + } + if (common_transvr_dump(self) < 0) { + return -1; + } + printk(KERN_INFO " |- :%d\n", self->len_smf); + printk(KERN_INFO " '- :Class_%d\n", __qsfp_get_power_cls(self, 0)); + return 0; +} + + +int +fake_transvr_dump(struct transvr_obj_s* self) { + + printk(KERN_INFO "[SWPS] Dump transceiver information: %s\n", self->swp_name); + printk(KERN_INFO " |- :FAKE\n"); + printk(KERN_INFO " |- :FAKE_VENDER_NAME\n"); + printk(KERN_INFO " |- :FAKE_VENDER_PN\n"); + printk(KERN_INFO " |- :FAKE_VENDER_REV\n"); + printk(KERN_INFO " |- :FAKE_VENDER_SN\n"); + printk(KERN_INFO " |- :0x99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " '- :0x99\n"); + return 0; +} + + +/* ========== Object functions for fake type ========== + */ +int +fake_transvr_update(struct transvr_obj_s *self, + int show_err){ + self->state = STATE_TRANSVR_CONNECTED; + return 0; +} + + +int +fake_get_binary(struct transvr_obj_s *self){ + return 1; +} + +int +fake_get_int(struct transvr_obj_s *self){ + return 99; +} + + +int +fake_get_hex(struct transvr_obj_s *self){ + return 0x0f; +} + + +int +fake_get_str(struct transvr_obj_s *self, char *buf) { + return snprintf(buf, 16, "fake_get_str\n"); +} + + +int +fake_set_int(struct transvr_obj_s *self, int input){ + SWPS_INFO("%s: %d\n", __func__, input); + return 0; +} + + +int +fake_set_hex(struct transvr_obj_s *self, int input){ + SWPS_INFO("%s: 0x%02x\n", __func__, input); + return 0; +} + + +/* ========== Object functions for unsupported ========== + */ +int +unsupported_get_func(struct transvr_obj_s *self){ + return ERR_TRANSVR_NOTSUPPORT; +} + + +int +unsupported_get_func2(struct transvr_obj_s *self, + char *buf_p) { + int len = snprintf(buf_p, 8, "%d\n", ERR_TRANSVR_NOTSUPPORT); + return len; +} + + +int +unsupported_set_func(struct transvr_obj_s *self, + int input_val){ + return ERR_TRANSVR_NOTSUPPORT; +} + + + +/* ========== Object functions for long term task ========== + * + * [Note] + * SWPS transceiver worker is likely the green-thread (coroutine). + * Due to resource and performance considerations. SWPS run all + * features in one kthread at the same time, and handle by it self. + */ + +/* For Transceiver Task Handling + */ +static struct transvr_worker_s * +transvr_task_get(struct transvr_obj_s *self, + char *func_name) { + + struct transvr_worker_s *curr_p = self->worker_p; + + while(curr_p != NULL){ + if (strcmp((curr_p->func_name), func_name) == 0 ) { + return curr_p; + } + curr_p = curr_p->next_p; + } + return NULL; +} + + +static struct transvr_worker_s* +transvr_task_creat(struct transvr_obj_s *self, + int (*main_task)(struct transvr_worker_s *task), + int (*post_task)(struct transvr_worker_s *task), + char *caller) { + + struct transvr_worker_s *task_p = NULL; + struct transvr_worker_s *curr_p = NULL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Check task not exist */ + task_p = transvr_task_get(self, caller); + if (task_p) { + snprintf(err_msg, sizeof(err_msg), "Task already created!"); + goto err_transvr_task_creat; + } + /* Create task worker */ + task_p = kzalloc(sizeof(struct transvr_worker_s), GFP_KERNEL); + if (!task_p){ + snprintf(err_msg, sizeof(err_msg), "kzalloc fail"); + goto err_transvr_task_creat; + } + /* Setup task data */ + task_p->transvr_p = self; + task_p->next_p = NULL; + task_p->trigger_time = 0; + task_p->retry = 1; + task_p->state = STATE_T_TASK_INIT; + task_p->main_task = main_task; + task_p->post_task = post_task; + task_p->p_data = NULL; + snprintf(task_p->func_name, sizeof(task_p->func_name), "%s", caller); + /* Setup Link List */ + if (self->worker_p) { + curr_p = self->worker_p; + while(curr_p->next_p != NULL) { + curr_p = curr_p->next_p; + } + curr_p->next_p = task_p; + task_p->pre_p = curr_p; + } else { + self->worker_p = task_p; + task_p->pre_p = NULL; + } + return task_p; + +err_transvr_task_creat: + SWPS_ERR("%s: %s :%s :%s\n", + __func__, err_msg, caller, self->swp_name); + return NULL; +} + + +static void +transvr_task_free_one(struct transvr_worker_s *task_p){ + + struct transvr_worker_s *pre_p = NULL; + struct transvr_worker_s *next_p = NULL; + + if (task_p) { + pre_p = task_p->pre_p; + next_p = task_p->next_p; + + if ((pre_p) && (next_p)) { + pre_p->next_p = next_p; + next_p->pre_p = pre_p; + + } else if ((!pre_p) && (next_p)) { + next_p->pre_p = NULL; + + } else if ((pre_p) && (!next_p)) { + pre_p->next_p = NULL; + + } else if ((!pre_p) && (!next_p)) { + task_p->transvr_p->worker_p = NULL; + } else { + SWPS_ERR("%s: Unexcept case!\n :%s", + __func__, task_p->transvr_p->swp_name); + } + kfree(task_p->p_data); + kfree(task_p); + } +} + + +static void +transvr_task_free_all(struct transvr_obj_s *self) { + + struct transvr_worker_s *curr_p = NULL; + struct transvr_worker_s *next_p = NULL; + + if (self->worker_p) { + curr_p = self->worker_p; + while(curr_p) { + next_p = curr_p->next_p; + transvr_task_free_one(curr_p); + curr_p = next_p; + } + self->worker_p = NULL; + } +} + + +static int +_transvr_task_run_main(struct transvr_worker_s *task_p) { + + int retval = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + if (!task_p){ + snprintf(err_msg, sizeof(err_msg), "main_task is NULL!"); + goto main_transvr_task_err; + } + if ((task_p->trigger_time) == 0){ + goto main_transvr_task_run; + } + if (time_before(jiffies, task_p->trigger_time)){ + goto main_transvr_task_wait; + } + goto main_transvr_task_run; + +main_transvr_task_run: + if (task_p->retry != VAL_TRANSVR_TASK_RETRY_FOREVER) { + task_p->retry -= 1; + } + retval = task_p->main_task(task_p); + if (retval < 0) { + if (task_p->retry > 0) { + task_p->state = STATE_T_TASK_WAIT; + return EVENT_TRANSVR_TASK_WAIT; + } + snprintf(err_msg, sizeof(err_msg), "Run main_task fail!"); + goto main_transvr_task_err; + } + goto main_transvr_task_identify; + +main_transvr_task_identify: + switch (retval) { + case EVENT_TRANSVR_TASK_WAIT: + task_p->state = STATE_T_TASK_WAIT; + return EVENT_TRANSVR_TASK_WAIT; + + case EVENT_TRANSVR_TASK_DONE: + task_p->state = STATE_T_TASK_DONE; + return EVENT_TRANSVR_TASK_DONE; + + default: + break; + } + snprintf(err_msg, sizeof(err_msg), "Run main_task fail!"); + goto main_transvr_task_err; + +main_transvr_task_wait: + task_p->state = STATE_T_TASK_WAIT; + return EVENT_TRANSVR_TASK_WAIT; + +main_transvr_task_err: + task_p->state = STATE_T_TASK_FAIL; + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, retval, task_p->transvr_p->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +static int +_transvr_task_run_post(struct transvr_worker_s *task_p) { + + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + if ((task_p->post_task) == NULL) { + return EVENT_TRANSVR_TASK_DONE; + } + switch (task_p->state) { + case STATE_T_TASK_WAIT: + case STATE_T_TASK_INIT: + goto post_transvr_task_wait; + + case STATE_T_TASK_DONE: + case STATE_T_TASK_FAIL: + goto post_transvr_task_run; + + default: + break; + } + snprintf(err_msg, sizeof(err_msg), "Unexcept task state"); + goto post_transvr_task_err; + +post_transvr_task_run: + task_p->post_task(task_p); + return EVENT_TRANSVR_TASK_DONE; + +post_transvr_task_wait: + return EVENT_TRANSVR_TASK_WAIT; + +post_transvr_task_err: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, task_p->state, task_p->transvr_p->swp_name); + return EVENT_TRANSVR_TASK_FAIL; +} + + +static int +transvr_task_run_one(struct transvr_worker_s *task_p) { + + int retval_main = DEBUG_TRANSVR_INT_VAL; + int retval_post = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + retval_main = _transvr_task_run_main(task_p); + if (retval_main < 0) { + snprintf(err_msg, sizeof(err_msg), "Execute main_task fail!"); + goto err_transvr_task_run_one; + } + retval_post = _transvr_task_run_post(task_p); + if (retval_post < 0) { + snprintf(err_msg, sizeof(err_msg), "Execute post_task fail!"); + goto err_transvr_task_run_one; + } + return retval_main; + +err_transvr_task_run_one: + SWPS_INFO("%s: %s
:%d :%d :%s :%s\n", + __func__, err_msg, retval_main, retval_post, + task_p->func_name, task_p->transvr_p->swp_name); + return EVENT_TRANSVR_TASK_FAIL; +} + + +static int +transvr_task_run_all(struct transvr_obj_s *self) { + + int haserr = 0; + int retval = DEBUG_TRANSVR_INT_VAL; + struct transvr_worker_s *curr_p = NULL; + struct transvr_worker_s *next_p = NULL; + + if ((self->worker_p) == NULL) { + return EVENT_TRANSVR_TASK_DONE; + } + curr_p = self->worker_p; + while (curr_p != NULL) { + next_p = curr_p->next_p; + retval = transvr_task_run_one(curr_p); + if (curr_p->retry == VAL_TRANSVR_TASK_RETRY_FOREVER) { + curr_p = next_p; + continue; + } + switch (retval) { + case EVENT_TRANSVR_TASK_WAIT: + break; + case EVENT_TRANSVR_TASK_DONE: + transvr_task_free_one(curr_p); + break; + case EVENT_TRANSVR_TASK_FAIL: + + default: + haserr = 1; + transvr_task_free_one(curr_p); + break; + } + curr_p = next_p; + } + if (haserr) { + return EVENT_TRANSVR_TASK_FAIL; + } + return EVENT_TRANSVR_TASK_DONE; +} + + +static void +transvr_task_set_delay(struct transvr_worker_s *task_p, + unsigned long delay_msec) { + + task_p->trigger_time = (jiffies + (delay_msec * (HZ/1000))); +} + + +static void +transvr_task_set_retry(struct transvr_worker_s *task_p, + unsigned long retry_times) { + + task_p->retry = retry_times; +} + + +/* For Transceiver Post Task + */ +int +taskfunc_post_do_nothing(struct transvr_worker_s *task_p) { + + return EVENT_TRANSVR_TASK_DONE; +} + + +int +taskfunc_post_handle_task_state(struct transvr_worker_s *task_p) { + + struct transvr_obj_s* tp = task_p->transvr_p; + + switch (task_p->state) { + case STATE_T_TASK_INIT: + case STATE_T_TASK_WAIT: + return EVENT_TRANSVR_TASK_WAIT; + + case STATE_T_TASK_DONE: + tp->state = STATE_TRANSVR_CONNECTED; + tp->send_uevent(tp, KOBJ_ADD); + return EVENT_TRANSVR_TASK_DONE; + + case STATE_T_TASK_FAIL: + tp->state = STATE_TRANSVR_UNEXCEPTED; + return EVENT_TRANSVR_TASK_FAIL; + + default: + break; + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +/* For Transceiver Main Task + */ +int +_taskfunc_sfp_setup_soft_rs(struct transvr_worker_s *task_p, + int input_val, + int address, + int page, + int offset, + int bit_shift, + uint8_t *attr_p, + char *caller) { + + int show_err = 0; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "_taskfunc_sfp_setup_soft_rs"; + + err_code = _sfp_update_attr_soft_rs0(task_p->transvr_p, 0); + if (err_code < 0) { + err_str = "Get current soft_rs0 fail!"; + goto err_taskfunc_sfp_setup_soft_rs_1; + } + err_code = __sfp_set_soft_rs(task_p->transvr_p, + input_val, + address, + page, + offset, + bit_shift, + attr_p, + caller, + show_err); + if (err_code < 0) { + err_str = "Get current soft_rs0 fail!"; + goto err_taskfunc_sfp_setup_soft_rs_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_sfp_setup_soft_rs_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + func_str, err_str, task_p->transvr_p->swp_name, input_val, err_code); + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +__taskfunc_sfp_setup_hard_rs(struct transvr_worker_s *task_p, + int input_val, + int (*get_func)(struct ioexp_obj_s *self, int virt_offset), + int (*set_func)(struct ioexp_obj_s *self, int virt_offset, int input_val)) { + + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_str = DEBUG_TRANSVR_STR_VAL; + + err_val = get_func(task_p->transvr_p->ioexp_obj_p, + task_p->transvr_p->ioexp_virt_offset); + + if (err_val < 0) { + if (err_val == ERR_IOEXP_NOTSUPPORT) { + return EVENT_TRANSVR_TASK_DONE; + } + err_str = "Get current hard_rs fail!"; + goto err_p_taskfunc_sfp_setup_hard_rs_1; + } + if (err_val == input_val) { + return EVENT_TRANSVR_TASK_DONE; + } + err_val = set_func(task_p->transvr_p->ioexp_obj_p, + task_p->transvr_p->ioexp_virt_offset, + input_val); + if (err_val < 0) { + err_str = "Setup hard_rs fail!"; + goto err_p_taskfunc_sfp_setup_hard_rs_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_p_taskfunc_sfp_setup_hard_rs_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + __func__, err_str, task_p->transvr_p->swp_name, input_val, err_val); + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_taskfunc_sfp_setup_hard_rs0(struct transvr_worker_s *task_p, + int input_val) { + + return __taskfunc_sfp_setup_hard_rs(task_p, + input_val, + task_p->transvr_p->ioexp_obj_p->get_hard_rs0, + task_p->transvr_p->ioexp_obj_p->set_hard_rs0); +} + + +int +_taskfunc_sfp_setup_hard_rs1(struct transvr_worker_s *task_p, + int input_val) { + + return __taskfunc_sfp_setup_hard_rs(task_p, + input_val, + task_p->transvr_p->ioexp_obj_p->get_hard_rs1, + task_p->transvr_p->ioexp_obj_p->set_hard_rs1); +} + + +int +_taskfunc_sfp_setup_rs0(struct transvr_worker_s *task_p, + int input_val) { + + int bit_shift = 3; + int old_val = DEBUG_TRANSVR_INT_VAL; + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "_taskfunc_sfp_setup_rs0"; + + err_val = _taskfunc_sfp_setup_hard_rs0(task_p, + input_val); + if (err_val < 0) { + err_str = "Setup hard_rs0 fail!"; + goto err_private_taskfunc_sfp_setup_rs0_1; + } + old_val = err_val; + err_val = _taskfunc_sfp_setup_soft_rs(task_p, + input_val, + task_p->transvr_p->eeprom_map_p->addr_soft_rs0, + task_p->transvr_p->eeprom_map_p->page_soft_rs0, + task_p->transvr_p->eeprom_map_p->offset_soft_rs0, + bit_shift, + &(task_p->transvr_p->soft_rs0), + func_str); + if (err_val < 0) { + err_str = "Setup soft_rs0 fail!"; + goto err_private_taskfunc_sfp_setup_rs0_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_private_taskfunc_sfp_setup_rs0_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + func_str, err_str, task_p->transvr_p->swp_name, input_val, err_val); + } + _taskfunc_sfp_setup_hard_rs0(task_p, old_val); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_taskfunc_sfp_setup_rs1(struct transvr_worker_s *task_p, + int input_val) { + + int bit_shift = 3; + int old_val = DEBUG_TRANSVR_INT_VAL; + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "_taskfunc_sfp_setup_rs1"; + + err_val = _taskfunc_sfp_setup_hard_rs1(task_p, + input_val); + if (err_val < 0) { + err_str = "Setup hard_rs1 fail!"; + goto err_private_taskfunc_sfp_setup_rs1_1; + } + old_val = err_val; + err_val = _taskfunc_sfp_setup_soft_rs(task_p, + input_val, + task_p->transvr_p->eeprom_map_p->addr_soft_rs1, + task_p->transvr_p->eeprom_map_p->page_soft_rs1, + task_p->transvr_p->eeprom_map_p->offset_soft_rs1, + bit_shift, + &(task_p->transvr_p->soft_rs1), + func_str); + if (err_val < 0) { + err_str = "Setup soft_rs1 fail!"; + goto err_private_taskfunc_sfp_setup_rs1_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_private_taskfunc_sfp_setup_rs1_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + func_str, err_str, task_p->transvr_p->swp_name, input_val, err_val); + } + _taskfunc_sfp_setup_hard_rs1(task_p, old_val); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +taskfunc_sfp_setup_SFF8431_case1(struct transvr_worker_s *task_p) { + /* SFF-8431 (8/4/2G Rx Rate_Select only) */ + int update_val = 1; + + return _taskfunc_sfp_setup_rs0(task_p, update_val); +} + + + +int +taskfunc_sfp_setup_SFF8431_case2(struct transvr_worker_s *task_p) { + /* SFF-8431 (8/4/2G Tx Rate_Select only) */ + int update_val = 1; + + return _taskfunc_sfp_setup_rs1(task_p, update_val); +} + + +int +taskfunc_sfp_setup_SFF8431_case3(struct transvr_worker_s *task_p) { + /* SFF-8431 (8/4/2G Independent Rx & Tx Rate_select) */ + int update_rs0 = 1; + int update_rs1 = 1; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _taskfunc_sfp_setup_rs0(task_p, update_rs0); + if (err_code < 0) { + return err_code; + } + return _taskfunc_sfp_setup_rs1(task_p, update_rs1); +} + + +int +taskfunc_sfp_handle_1g_rj45(struct transvr_worker_s *task_p) { + + /* Not all of platform support 0x56 for transceiver + * external PHY, Support list as below: + * => 1. Magnolia-PVT (PS: EVT & DVT not ready) + */ + int ext_phy_addr = 0x56; + int ext_phy_page = -1; + int ext_phy_offs = 0x11; + int ext_phy_len = 1; + int lstate_mask = 0x04; /* 00000100 */ + int show_err = 0; + int fail_retry = 5; + int fail_delay = 1000; /* msec */ + int err_code = DEBUG_TRANSVR_INT_VAL; + uint8_t detect_val = DEBUG_TRANSVR_HEX_VAL; + char err_str[64] = DEBUG_TRANSVR_STR_VAL; + int *tmp_p = NULL; + char *func_name = "taskfunc_sfp_handle_1g_rj45"; + + if (task_p->transvr_p->state != STATE_TRANSVR_CONNECTED) { + return EVENT_TRANSVR_TASK_DONE; + } + if ( (task_p->transvr_p->info != TRANSVR_CLASS_BASE_T_1000) && + (task_p->transvr_p->info != TRANSVR_CLASS_BASE_T_1000_up) ) { + goto err_taskfunc_sfp_handle_1g_rj45_1; + } + err_code = _common_update_uint8_attr(task_p->transvr_p, + ext_phy_addr, + ext_phy_page, + ext_phy_offs, + ext_phy_len, + &detect_val, + func_name, + show_err); + if ( (err_code < 0) || + (detect_val == DEBUG_TRANSVR_HEX_VAL) ) { + snprintf(err_str, sizeof(err_str), "Detect external link status fail"); + goto err_taskfunc_sfp_handle_1g_rj45_2; + } + if ((detect_val & lstate_mask) == lstate_mask) { + goto ok_taskfunc_sfp_handle_1g_rj45_link_up; + } + goto ok_taskfunc_sfp_handle_1g_rj45_link_down; + +ok_taskfunc_sfp_handle_1g_rj45_link_up: + /* Filter out noise */ + if (!(task_p->p_data)) { + tmp_p = kzalloc(sizeof(int), GFP_KERNEL); + if (!tmp_p) { + snprintf(err_str, sizeof(err_str), "kzalloc p_data fail"); + goto err_taskfunc_sfp_handle_1g_rj45_2; + } + *tmp_p = TRANSVR_CLASS_BASE_T_1000_up; + task_p->p_data = tmp_p; + goto ok_taskfunc_sfp_handle_1g_rj45_done; + } + if ((*(int *)(task_p->p_data)) != TRANSVR_CLASS_BASE_T_1000_up) { + kfree(task_p->p_data); + task_p->p_data = NULL; + snprintf(err_str, sizeof(err_str), "Internal error"); + goto err_taskfunc_sfp_handle_1g_rj45_2; + } + task_p->transvr_p->info = TRANSVR_CLASS_BASE_T_1000_up; + kfree(task_p->p_data); + task_p->p_data = NULL; + goto ok_taskfunc_sfp_handle_1g_rj45_done; + +ok_taskfunc_sfp_handle_1g_rj45_link_down: + if (task_p->p_data) { + kfree(task_p->p_data); + task_p->p_data = NULL; + } + task_p->transvr_p->info = TRANSVR_CLASS_BASE_T_1000; + goto ok_taskfunc_sfp_handle_1g_rj45_done; + +ok_taskfunc_sfp_handle_1g_rj45_done: + if (task_p->retry != VAL_TRANSVR_TASK_RETRY_FOREVER) { + transvr_task_set_retry(task_p, VAL_TRANSVR_TASK_RETRY_FOREVER); + } + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_sfp_handle_1g_rj45_1: + snprintf(err_str, sizeof(err_str), "Detect transceiver:%d not Base-T, remove task.", + task_p->transvr_p->info); + SWPS_INFO("%s: %s :%s\n", __func__, err_str, task_p->transvr_p->swp_name); + transvr_task_set_retry(task_p, 0); + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_sfp_handle_1g_rj45_2: + if (task_p->retry == VAL_TRANSVR_TASK_RETRY_FOREVER) { + transvr_task_set_retry(task_p, fail_retry); + } + if ((task_p->retry) == 0) { + /* Error case: + * => In this case, SWPS will stop external Link state monitor features + * and keeps transvr_p->info on TRANSVR_CLASS_BASE_T_1000_up. + * Upper layer will see it always Linkup that because of these type of + * transceiver has external phy, BCM chip see it as Loopback transceiver. + */ + SWPS_WARN("%s can not access external PHY of Base-T SFP transceiver\n", + task_p->transvr_p->swp_name); + task_p->transvr_p->info = TRANSVR_CLASS_BASE_T_1000_up; + return EVENT_TRANSVR_TASK_DONE; + } else { + transvr_task_set_delay(task_p, fail_delay); + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_taskfunc_qsfp_setup_power_mod(struct transvr_obj_s *self, + int setup_val) { + + int curr_val = DEBUG_TRANSVR_INT_VAL; + int err_val = DEBUG_TRANSVR_INT_VAL; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + + curr_val = self->ioexp_obj_p->get_lpmod(self->ioexp_obj_p, + self->ioexp_virt_offset); + if (curr_val < 0){ + err_msg = "Get current value fail!"; + goto err_private_taskfunc_qsfp_setup_power_mod_1; + } + if (curr_val == setup_val){ + return EVENT_TRANSVR_TASK_DONE; + } + err_val = self->ioexp_obj_p->set_lpmod(self->ioexp_obj_p, + self->ioexp_virt_offset, + setup_val); + if (err_val < 0){ + err_msg = "Setup power mode fail!"; + goto err_private_taskfunc_qsfp_setup_power_mod_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_private_taskfunc_qsfp_setup_power_mod_1: + SWPS_INFO("%s: %s :%d :%d :%d\n", + __func__, err_msg, err_val, curr_val, setup_val); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +taskfunc_qsfp_handle_tx_disable(struct transvr_worker_s *task_p) { + + int i = 0; + int retry = 5; + int delay_ms = 100; + + if (task_p->transvr_p->auto_tx_disable == VAL_TRANSVR_FUNCTION_DISABLE) { + return EVENT_TRANSVR_TASK_DONE; + } + if (!_qsfp_is_implement_tx_disable(task_p->transvr_p)) { + return EVENT_TRANSVR_TASK_DONE; + } + for (i=0; itransvr_p, + task_p->transvr_p->auto_tx_disable) + == EVENT_TRANSVR_TASK_DONE) { + goto ok_taskfunc_qsfp_handle_tx_disable; + } + mdelay(delay_ms); + } + SWPS_INFO("%s auto setup tx_disable:0x%02x fail.\n", + task_p->transvr_p->swp_name, + task_p->transvr_p->auto_tx_disable); + return EVENT_TRANSVR_INIT_FAIL; + +ok_taskfunc_qsfp_handle_tx_disable: + SWPS_INFO("%s auto setup tx_disable:0x%02x ok.\n", + task_p->transvr_p->swp_name, + task_p->transvr_p->auto_tx_disable); + return EVENT_TRANSVR_TASK_DONE; +} + + +int +taskfunc_qsfp_set_hpmod(struct transvr_worker_s *task_p) { + + int err = DEBUG_TRANSVR_INT_VAL; + int HIGH_POWER_MODE = 0; + + /* Handle power mode */ + err = _taskfunc_qsfp_setup_power_mod(task_p->transvr_p, + HIGH_POWER_MODE); + if (err < 0) { + SWPS_INFO("%s: setup hpmod fail :%d :%s\n", + __func__, err, task_p->transvr_p->swp_name); + return err; + } + /* Handle auto tx_disable + * [Note] + * => Because there are some transceiver have timing issues or + * setup sequence issues, therefore we handle auto tx_disable + * after handle power mode. + */ + mdelay(100); + return taskfunc_qsfp_handle_tx_disable(task_p); +} + + +int +taskfunc_qsfp_set_lpmod(struct transvr_worker_s *task_p) { + + int LOW_POWER_MODE = 1; + return _taskfunc_qsfp_setup_power_mod(task_p->transvr_p, + LOW_POWER_MODE); +} + + +static int +initfunc_sfp_handle_multi_rate_mode(struct transvr_obj_s *self) { + + int task_retry = 3; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "sfp_handle_multi_rate_mode"; + struct transvr_worker_s *task_p = NULL; + + switch (self->rate_id) { + case 0x00: /* Unspecified */ + case 0x03: /* Unspecified */ + case 0x05: /* Unspecified */ + case 0x07: /* Unspecified */ + case 0x09: /* Unspecified */ + case 0x0B: /* Unspecified */ + case 0x0D: /* Unspecified */ + case 0x0F: /* Unspecified */ + goto sfp_handle_multi_rate_mode_4_unspecified; + + case 0x02: /* SFF-8431 (8/4/2G Rx Rate_Select only) */ + task_p = transvr_task_creat(self, + taskfunc_sfp_setup_SFF8431_case1, + taskfunc_post_handle_task_state, + func_str); + goto sfp_handle_multi_rate_mode_4_sff8431; + + case 0x04: /* SFF-8431 (8/4/2G Tx Rate_Select only) */ + task_p = transvr_task_creat(self, + taskfunc_sfp_setup_SFF8431_case2, + taskfunc_post_handle_task_state, + func_str); + goto sfp_handle_multi_rate_mode_4_sff8431; + + case 0x06: /* SFF-8431 (8/4/2G Independent Rx & Tx Rate_select) */ + task_p = transvr_task_creat(self, + taskfunc_sfp_setup_SFF8431_case3, + taskfunc_post_handle_task_state, + func_str); + goto sfp_handle_multi_rate_mode_4_sff8431; + + case 0x01: /* SFF-8079 (4/2/1G Rate_Select & AS0/AS1) */ + err_str = "SFF-8079 (4/2/1G Rate_Select & AS0/AS1)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x08: /* FC-PI-5 (16/8/4G Rx Rate_select only) + * High=16G only, Low=8G/4G + */ + err_str = "FC-PI-5 (16/8/4G Rx Rate_select only)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x0A: /* FC-PI-5 (16/8/4G Independent Rx, Tx Rate_select) + * High=16G only, Low=8G/4G + */ + err_str = "FC-PI-5 (16/8/4G Independent Rx, Tx Rate_select)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x0C: /* FC-PI-6 (32/16/8G Independent Rx, Tx Rate_Select) + * High=32G only, Low = 16G/8G + */ + err_str = "FC-PI-6 (32/16/8G Independent Rx, Tx Rate_Select)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x0E: /* 10/8G Rx and Tx Rate_Select controlling the operation or + * locking modes of the internal signal conditioner, retimer + * or CDR, according to the logic table defined in Table 10-2, + * High Bit Rate (10G) =9.95-11.3 Gb/s; Low Bit Rate (8G) = + * 8.5 Gb/s. In this mode, the default value of bit 110.3 (Soft + * Rate Select RS(0), Table 9-11) and of bit 118.3 (Soft Rate + * Select RS(1), Table 10-1) is 1. + */ + err_str = "cable type: 0x0E"; + goto sfp_handle_multi_rate_mode_4_not_support; + + default: + err_str = "cable type: UNKNOW"; + goto sfp_handle_multi_rate_mode_4_not_support; + } + +sfp_handle_multi_rate_mode_4_sff8431: + if (!task_p) { + err_str = "Create task fail!"; + goto sfp_handle_multi_rate_mode_4_fail_1; + } + transvr_task_set_retry(task_p, task_retry); + return EVENT_TRANSVR_TASK_WAIT; + +sfp_handle_multi_rate_mode_4_unspecified: + return EVENT_TRANSVR_TASK_DONE; + +sfp_handle_multi_rate_mode_4_not_support: + SWPS_INFO("%s: Does not support %s :%s :0x%02x\n", + func_str, err_str, self->swp_name, self->rate_id); + return EVENT_TRANSVR_TASK_DONE; + +sfp_handle_multi_rate_mode_4_fail_1: + SWPS_INFO("%s: %s :%s :0x%02x, :%d\n", + func_str, err_str, self->swp_name, self->rate_id, err_code); + return EVENT_TRANSVR_INIT_FAIL; +} + + +static int +initfunc_sfp_handle_1g_rj45(struct transvr_obj_s *self) { + + struct transvr_worker_s *task_p = NULL; + int detect_cls = DEBUG_TRANSVR_INT_VAL; + char err_str[64] = DEBUG_TRANSVR_STR_VAL; + char *func_str = "initfunc_sfp_handle_1g_rj45"; + + + if (self->info == TRANSVR_CLASS_BASE_T_1000) { + task_p = transvr_task_creat(self, + taskfunc_sfp_handle_1g_rj45, + taskfunc_post_do_nothing, + func_str); + if (!task_p) { + snprintf(err_str, sizeof(err_str), "Create task fail"); + goto err_initfunc_sfp_handle_1g_rj45; + } + transvr_task_set_retry(task_p, VAL_TRANSVR_TASK_RETRY_FOREVER); + } + return EVENT_TRANSVR_TASK_DONE; + +err_initfunc_sfp_handle_1g_rj45: + SWPS_INFO("%s: %s :%s :%d\n", + __func__, err_str, self->swp_name, detect_cls); + return EVENT_TRANSVR_TASK_FAIL; +} + + +static int +initfunc_qsfp_handle_power_mode(struct transvr_obj_s *self) { + + int err_code = EVENT_TRANSVR_EXCEP_INIT; + int power_class = DEBUG_TRANSVR_INT_VAL; + int hpmod_retry = 3; + int lpower_config = 1; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + unsigned long hpmod_delay = 500; /* msec */ + struct transvr_worker_s *task_p = NULL; + + /* Handle power mode for IOEXP */ + power_class = __qsfp_get_power_cls(self, 0); + switch (power_class) { + case 1: /* Case: Low power mode (Class = 1) */ + err_code = _taskfunc_qsfp_setup_power_mod(self, lpower_config); + if (err_code < 0){ + snprintf(err_msg, sizeof(err_msg), "Setup lpmod fail :%d", err_code); + goto err_initfunc_qsfp_handle_power_mode; + } + return EVENT_TRANSVR_TASK_DONE; + + case 2: /* Case: High power mode (Class > 1) */ + case 3: + case 4: + case 5: + case 6: + case 7: + task_p = transvr_task_creat(self, + taskfunc_qsfp_set_hpmod, + taskfunc_post_handle_task_state, + "transvr_init_qsfp"); + if (!task_p) { + snprintf(err_msg, sizeof(err_msg), "Setup lpmod fail :%d", err_code); + goto err_initfunc_qsfp_handle_power_mode; + } + transvr_task_set_retry(task_p, hpmod_retry); + transvr_task_set_delay(task_p, hpmod_delay); + return EVENT_TRANSVR_TASK_WAIT; + + default: + break; + } + snprintf(err_msg, sizeof(err_msg), "Exception case"); + goto err_initfunc_qsfp_handle_power_mode; + +err_initfunc_qsfp_handle_power_mode: + SWPS_INFO("%s: %s :%s \n", __func__, err_msg, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +int +initfunc_qsfp28_handle_cdr(struct transvr_obj_s *self) { + + uint8_t DEFAULT_VAL_CDR = 0xff; + int CDR_FUNC_EXISTED = 0x3; + int show_err = 1; + int err_val = EVENT_TRANSVR_TASK_FAIL; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + char *func_str = "initfunc_qsfp28_handle_cdr"; + + err_val = __qsfp_get_cdr_present(self, 0); + if ( (err_val < 0) || + (err_val == DEBUG_TRANSVR_HEX_VAL) ) { + err_msg = "detect cdr_present fail!"; + goto err_taskfunc_qsfp_handle_cdr_1; + } + if (err_val == CDR_FUNC_EXISTED) { + err_val = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->offset_cdr, + DEFAULT_VAL_CDR, + &(self->cdr), + func_str, + show_err); + if (err_val < 0) { + err_msg = "set CDR fail!"; + goto err_taskfunc_qsfp_handle_cdr_1; + } + } + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_qsfp_handle_cdr_1: + SWPS_INFO("%s: %s :%d :%s\n", + func_str, err_msg, err_val, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + +/* ========== Object functions for Final State Machine ========== + */ +int +is_plugged(struct transvr_obj_s *self){ + + int limit = 63; + int present = DEBUG_TRANSVR_INT_VAL; + char emsg[64] = DEBUG_TRANSVR_STR_VAL; + struct ioexp_obj_s *ioexp_p = self->ioexp_obj_p; + + if (!ioexp_p) { + snprintf(emsg, limit, "ioexp_p is null!"); + goto err_is_plugged_1; + } + present = ioexp_p->get_present(ioexp_p, self->ioexp_virt_offset); + switch (present){ + case 0: + return 1; + case 1: + return 0; + case ERR_IOEXP_UNINIT: + snprintf(emsg, limit, "ioexp_p not ready!"); + goto err_is_plugged_1; + default: + if (ioexp_p->state == STATE_IOEXP_INIT){ + snprintf(emsg, limit, "ioexp_p not ready!"); + goto err_is_plugged_1; + } + break; + } + SWPS_INFO("%s: Exception case! :%d :%d\n", + __func__, present, ioexp_p->state); + return 0; + +err_is_plugged_1: + SWPS_DEBUG("%s: %s\n", __func__, emsg); + return 0; +} + + +static int +detect_transvr_type(struct transvr_obj_s* self){ + + int type = TRANSVR_TYPE_ERROR; + + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + type = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + + /* Case: 1. Wait transceiver I2C module. + * 2. Transceiver I2C module failure. + * Note: 1. SFF allow maximum transceiver initial time is 2 second. So, there + * are exist some case that we need to wait transceiver. + * For these case, we keeps status on "TRANSVR_TYPE_UNPLUGGED", than + * state machine will keep trace with it. + * 2. There exist some I2C failure case we need to handle. Such as user + * insert the failure transceiver, or any reason cause it abnormal. + */ + if (type < 0){ + switch (type) { + case -EIO: + SWPS_DEBUG("%s: %s smbus return:-5 (I/O error)\n", + __func__, self->swp_name); + return TRANSVR_TYPE_UNPLUGGED; + case -ENXIO: + SWPS_DEBUG("%s: %s smbus return:-6 (No such device or address)\n", + __func__, self->swp_name); + return TRANSVR_TYPE_UNPLUGGED; + default: + break; + } + SWPS_INFO("%s: %s unexpected smbus return:%d \n", + __func__, self->swp_name, type); + return TRANSVR_TYPE_ERROR; + } + /* Identify valid transceiver type */ + switch (type){ + case TRANSVR_TYPE_SFP: + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + break; + case TRANSVR_TYPE_UNKNOW_1: + case TRANSVR_TYPE_UNKNOW_2: + type = TRANSVR_TYPE_UNKNOW_2; + break; + default: + SWPS_DEBUG("%s: unknow type:0x%02x \n", __func__, type); + type = TRANSVR_TYPE_ERROR; + break; + } + return type; +} + + +static int +detect_transvr_state(struct transvr_obj_s *self, + int result[2]){ + /* [return] [result-0] [result-1] + * 0 STATE_TRANSVR_CONNECTED TRANSVR_TYPE_FAKE + * 0 STATE_TRANSVR_DISCONNECTED TRANSVR_TYPE_UNPLUGGED + * 0 STATE_TRANSVR_ISOLATED TRANSVR_TYPE_ERROR + * 0 STATE_TRANSVR_INIT / + * 0 STATE_TRANSVR_SWAPPED + * 0 STATE_TRANSVR_CONNECTED + * ERR_TRNASVR_BE_ISOLATED STATE_TRANSVR_ISOLATED TRANSVR_TYPE_ERROR + * ERR_TRANSVR_I2C_CRASH STATE_TRANSVR_UNEXCEPTED TRANSVR_TYPE_ERROR + * ERR_TRANSVR_UNEXCPT STATE_TRANSVR_UNEXCEPTED TRANSVR_TYPE_UNKNOW_1/2 + */ + result[0] = STATE_TRANSVR_UNEXCEPTED; /* For return state */ + result[1] = TRANSVR_TYPE_ERROR; /* For return type */ + + /* Case1: Fake type */ + if (self->type == TRANSVR_TYPE_FAKE){ + result[0] = STATE_TRANSVR_CONNECTED; + result[1] = TRANSVR_TYPE_FAKE; + return 0; + } + /* Case2: Transceiver unplugged */ + if (!is_plugged(self)){ + result[0] = STATE_TRANSVR_DISCONNECTED; + result[1] = TRANSVR_TYPE_UNPLUGGED; + return 0; + } + /* Case3: Transceiver be isolated */ + if (self->state == STATE_TRANSVR_ISOLATED){ + result[0] = STATE_TRANSVR_ISOLATED; + result[1] = TRANSVR_TYPE_ERROR; + return ERR_TRNASVR_BE_ISOLATED; + } + /* Case4: Transceiver plugged */ + result[1] = detect_transvr_type(self); + /* Case4.1: I2C topology crash + * Note : There are some I2C issues cause by transceiver/cables. + * We need to check topology status when user insert it. + * But in this step, we can't not ensure this is the issues + * port. So, it return the ERR_TRANSVR_I2C_CRASH, then upper + * layer will diagnostic I2C topology. + */ + if (check_channel_tier_1() < 0) { + SWPS_INFO("%s: %s detect I2C crash :%d\n", + __func__, self->swp_name, self->state); + result[0] = STATE_TRANSVR_UNEXCEPTED; + result[1] = TRANSVR_TYPE_ERROR; + return ERR_TRANSVR_I2C_CRASH; + } + /* Case4.2: System initial not ready, + * Note : Sometime i2c channel or transceiver EEPROM will delay that will + * cause system in inconsistent state between EEPROM and IOEXP. + * In this case, SWP transceiver object keep state at LINK_DOWN + * to wait system ready. + * By the way, State Machine will handle these case. + */ + if (result[1] == TRANSVR_TYPE_UNPLUGGED){ + result[0] = STATE_TRANSVR_DISCONNECTED; + return 0; + } + /* Case4.3: Error transceiver type */ + if (result[1] == TRANSVR_TYPE_ERROR){ + result[0] = STATE_TRANSVR_ISOLATED; + SWPS_INFO("%s: %s detect error type\n", __func__, self->swp_name); + alarm_msg_2_user(self, "detected transceiver/cables not meet SFF standard!"); + return ERR_TRNASVR_BE_ISOLATED; + } + /* Case3.3: Unknow transceiver type */ + if ((result[1] == TRANSVR_TYPE_UNKNOW_1) || + (result[1] == TRANSVR_TYPE_UNKNOW_2) ){ + result[0] = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_UNEXCPT; + } + /* Case3.4: During initial process */ + if (self->state == STATE_TRANSVR_INIT){ + result[0] = STATE_TRANSVR_INIT; + return 0; + } + /* Case3.5: Transceiver be swapped */ + if (self->type != result[1]){ + result[0] = STATE_TRANSVR_SWAPPED; + return 0; + } + /* Case3.6: Link up state */ + result[0] = STATE_TRANSVR_CONNECTED; + return 0; +} + + +int +_sfp_detect_class_by_extend_comp(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int detect_val = _sfp_get_comp_extended(self); + + switch(detect_val) { + case 0x00: /* Unspecified */ + return TRANSVR_CLASS_UNSPECIFIED; + + case 0x01: /* 100G AOC (Active Optical Cable) or 25GAUI C2M */ + case 0x18: /* 100G AOC or 25GAUI C2M AOC. */ + return TRANSVR_CLASS_OPTICAL_25G_AOC; + + case 0x02: /* 100GBASE-SR4 or 25GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_25G_SR; + + case 0x03: /* 100GBASE-LR4 or 25GBASE-LR */ + return TRANSVR_CLASS_OPTICAL_25G_LR; + + case 0x04: /* 100GBASE-ER4 or 25GBASE-ER */ + return TRANSVR_CLASS_OPTICAL_25G_ER; + + case 0x08: /* 100G ACC (Active Copper Cable) or 25GAUI C2M ACC. */ + case 0x0b: /* 100GBASE-CR4 or 25GBASE-CR CA-L */ + case 0x0c: /* 25GBASE-CR CA-S */ + case 0x0d: /* 25GBASE-CR CA-N */ + case 0x19: /* 100G ACC or 25GAUI C2M ACC. */ + return TRANSVR_CLASS_COPPER_L1_25G; + + default: + break; + } + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_detect_class_by_10_ethernet(struct transvr_obj_s* self) { + /* Reference: SFF-8472 (v12.2) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + + detect_val = _sfp_get_comp_10g_eth_comp(self); + /* Case: Unspecified */ + if (detect_val == 0x00) { + return TRANSVR_CLASS_UNSPECIFIED; + } + /* Case: 10G Optical (x1) */ + if ((detect_val & 0x10) == 0x10) { /* 00010000 : 10GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_10G_S_SR; + } + if ( ((detect_val & 0x20) == 0x20) || /* 00100000 : 10GBASE-LR */ + ((detect_val & 0x40) == 0x40) ){ /* 01000000 : 10GBASE-LRM */ + return TRANSVR_CLASS_OPTICAL_10G_S_LR; + } + if ((detect_val & 0x80) == 0x80) { /* 10000000 : 10GBASE-ER */ + return TRANSVR_CLASS_OPTICAL_10G_S_ER; + } + /* Case: ERROR */ + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_detect_if_sp_by_br(struct transvr_obj_s* self) { + + int lower_bound_1g = 0x0b; + int upper_bound_1g = 0x1A; + int lower_bound_10g = 0x60; + int upper_bound_10g = 0x75; + int lower_bound_25g = 0xf0; + int upper_bound_25g = 0xff; + int notmal_br = DEBUG_TRANSVR_INT_VAL; + + notmal_br = (int)(self->br); /* updated by update_all() */ + /* Check 25G */ + if ((notmal_br >= lower_bound_25g) && + (notmal_br <= upper_bound_25g) ) { + return TRANSVR_CLASS_25G; + } + /* Check 10G */ + if ((notmal_br >= lower_bound_10g) && + (notmal_br <= upper_bound_10g) ) { + return TRANSVR_CLASS_10G; + } + /* Check 1G */ + if ((notmal_br >= lower_bound_1g) && + (notmal_br <= upper_bound_1g) ) { + return TRANSVR_CLASS_1G; + } + return TRANSVR_CLASS_UNSPECIFIED; +} + + +int +_sfp_detect_class_by_1g_ethernet(struct transvr_obj_s* self) { + /* Reference: SFF-8472 (v12.2) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + int speed_br = DEBUG_TRANSVR_INT_VAL; + int speed_tmp = DEBUG_TRANSVR_INT_VAL; + char err_str[64] = DEBUG_TRANSVR_STR_VAL; + + speed_br = _sfp_detect_if_sp_by_br(self); + detect_val = _sfp_get_comp_1g_eth_comp(self); + + if (detect_val < 0) { + snprintf(err_str, sizeof(err_str), "Detect abnormal value:%d", detect_val); + goto err_p_sfp_detect_class_by_1g_ethernet; + } + /* Case: Unspecified */ + if (detect_val == 0x00) { + return TRANSVR_CLASS_UNSPECIFIED; + } + /* Case: 1G (x1) */ + if ((detect_val & 0x01) == 0x01) { /* 00000001 : 1000BASE-SX */ + speed_tmp = TRANSVR_CLASS_OPTICAL_1G_SX; + goto ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g; + } + if ((detect_val & 0x02) == 0x02) { /* 00000010 : 1000BASE-LX *3 */ + speed_tmp = TRANSVR_CLASS_OPTICAL_1G_LX; + goto ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g; + } + if ((detect_val & 0x04) == 0x04) { /* 00000100 : 1000BASE-CX */ + speed_tmp = TRANSVR_CLASS_COPPER_L1_1G; + goto ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g; + } + /* Case: 1000 Base-T (x1) */ + if ((detect_val & 0x08) == 0x08) { /* 00001000 : 1000BASE-T */ + return TRANSVR_CLASS_BASE_T_1000; + } + /* Case: 100 Base */ + if ( ((detect_val & 0x10) == 0x10) || /* 00010000 : 100BASE-LX/LX10 */ + ((detect_val & 0x20) == 0x20) || /* 00100000 : 100BASE-FX */ + ((detect_val & 0x40) == 0x40) || /* 01000000 : BASE-BX10 *3 */ + ((detect_val & 0x80) == 0x80) ){ /* 10000000 : BASE-PX *3 */ + return TRANSVR_CLASS_OPTICAL_100; + } + /* Case: ERROR */ + snprintf(err_str, sizeof(err_str), "Case:ERROR, value:%d", detect_val); + goto err_p_sfp_detect_class_by_1g_ethernet; + +ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g: + switch (speed_br) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_1G: + return speed_tmp; + case TRANSVR_CLASS_10G: + goto ok_sfp_detect_class_by_1g_ethernet_4_transfer_10G; + } + +ok_sfp_detect_class_by_1g_ethernet_4_transfer_10G: + switch (speed_tmp) { + case TRANSVR_CLASS_OPTICAL_1G_SX: + return TRANSVR_CLASS_OPTICAL_10G_S_SR; + case TRANSVR_CLASS_OPTICAL_1G_LX: + return TRANSVR_CLASS_OPTICAL_10G_S_LR; + case TRANSVR_CLASS_COPPER_L1_1G: + return TRANSVR_CLASS_COPPER_L1_10G; + default: + break; + } + snprintf(err_str, sizeof(err_str), "transfer_1to10 fail, speed:%d", speed_tmp); + goto err_p_sfp_detect_class_by_1g_ethernet; + +err_p_sfp_detect_class_by_1g_ethernet: + SWPS_INFO("%s: %s :%s", __func__, err_str, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_detect_class_by_feature(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int is_active = 0; + int conn_val = DEBUG_TRANSVR_INT_VAL; + int check_val = DEBUG_TRANSVR_INT_VAL; + int wave_len = DEBUG_TRANSVR_INT_VAL; + int speed_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + speed_val = _sfp_detect_if_sp_by_br(self); + conn_val = _sfp_get_connector_type(self); + + switch(conn_val) { + case 0x00: /* Unspecified */ + goto ok_sfp_detect_class_by_feature_4_check_active_passive; + case 0x07: /* LC (Lucent Connector) */ + case 0x0b: /* Optical Pigtail */ + case 0x0c: /* MPO 1x12 */ + case 0x0d: /* MPO 2x16 */ + /* + * ToDo: Need verify Optical Pigtail + */ + goto ok_sfp_detect_class_by_feature_4_optiocal; + case 0x21: /* Copper pigtail */ + /* + * ToDo: Need check ACC use case + */ + goto ok_sfp_detect_class_by_feature_4_check_active_passive; + case 0x23: /* No separable connector */ + /* + * ToDo: Standard not clear, not all transceiver vendor + * have the same defined + */ + goto ok_sfp_detect_class_by_feature_4_check_active_passive; + default: + break; + } + goto ok_sfp_detect_class_by_feature_4_unknow; + +ok_sfp_detect_class_by_feature_4_check_active_passive: + check_val = _sfp_get_cable_tech(self); + switch(check_val) { + case 0x00: /* Unspecified */ + goto ok_sfp_detect_class_by_feature_4_unknow; + case 0x04: /* Passive */ + goto ok_sfp_detect_class_by_feature_4_copper; + case 0x08: /* Active */ + is_active = 1; + goto ok_sfp_detect_class_by_feature_4_aoc; + default: + snprintf(err_msg, sizeof(err_msg), + "_sfp_get_cable_tech return Non define value:%d", + check_val); + break; + } + goto err_sfp_detect_class_by_feature_1; + +ok_sfp_detect_class_by_feature_4_optiocal: + wave_len = _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1]); + switch(speed_val) { + case TRANSVR_CLASS_25G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_25G_SR; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_25G_LR; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_25G_ER; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_25G; + + case TRANSVR_CLASS_10G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_10G_S_SR; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_10G_S_LR; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_10G_S_ER; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_10G; + + case TRANSVR_CLASS_1G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_1G_SX; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_1G_LX; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_1G_EX; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_1G; + + default: + return TRANSVR_CLASS_OPTICAL; + } + +ok_sfp_detect_class_by_feature_4_aoc: + switch(speed_val) { + case TRANSVR_CLASS_25G: + return TRANSVR_CLASS_OPTICAL_25G_AOC; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_OPTICAL_10G_S_AOC; + case TRANSVR_CLASS_1G: + return TRANSVR_CLASS_OPTICAL_1G_AOC; + default: + break; + } + goto ok_sfp_detect_class_by_feature_4_unknow; + +ok_sfp_detect_class_by_feature_4_copper: + switch(speed_val) { + case TRANSVR_CLASS_25G: + return TRANSVR_CLASS_COPPER_L1_25G; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_COPPER_L1_10G; + case TRANSVR_CLASS_1G: + return TRANSVR_CLASS_COPPER_L1_1G; + default: + return TRANSVR_CLASS_COPPER; + } + +ok_sfp_detect_class_by_feature_4_unknow: + return TRANSVR_CLASS_UNSPECIFIED; + +err_sfp_detect_class_by_feature_1: + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +sft_detect_transvr_class(struct transvr_obj_s* self) { + + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Check Extended Compliance */ + detect_val = _sfp_detect_class_by_extend_comp(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_COPPER_L1_25G: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined extend_comp:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Check 10G Compliance */ + detect_val = _sfp_detect_class_by_10_ethernet(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined 10G_eth:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Check 1G Compliance */ + detect_val = _sfp_detect_class_by_1g_ethernet(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_COPPER_L1_1G: + case TRANSVR_CLASS_BASE_T_1000: + case TRANSVR_CLASS_OPTICAL_100: + /* + * ToDo: Need Check 0.1G + */ + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_COPPER_L1_10G: + /* Transfer speed case + * => Example: Raycom 10G DAC + */ + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined 1G_eth:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Check by connector, br, wavelength */ + detect_val = _sfp_detect_class_by_feature(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL: + case TRANSVR_CLASS_OPTICAL_1G: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_25G: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_COPPER: + case TRANSVR_CLASS_COPPER_L1_1G: + case TRANSVR_CLASS_COPPER_L1_10G: + case TRANSVR_CLASS_COPPER_L1_25G: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined get_connector:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sft_detect_transceiver_class_1; + +err_sft_detect_transceiver_class_1: + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_set_trident2_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result){ + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch(transvr_cls) { + case TRANSVR_CLASS_ERROR: + case TRANSVR_CLASS_UNSPECIFIED: + break; + /* 25G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 25G COPPER */ + case TRANSVR_CLASS_COPPER_L1_25G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 10G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 10G COPPER */ + case TRANSVR_CLASS_COPPER_L1_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 1G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G COPPER */ + case TRANSVR_CLASS_COPPER_L1_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G BASE_T */ + case TRANSVR_CLASS_BASE_T_1000: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 100 Base */ + case TRANSVR_CLASS_OPTICAL_100: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_sfp_set_trident2_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sfp_set_trident2_if_type_1; + +err_sfp_set_trident2_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_sfp_set_tomahawk_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result) { + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch(transvr_cls) { + case TRANSVR_CLASS_ERROR: + case TRANSVR_CLASS_UNSPECIFIED: + break; + /* 25G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G: + return snprintf(result, lmax, TRANSVR_IF_SR); + /* 25G COPPER */ + case TRANSVR_CLASS_COPPER_L1_25G: + return snprintf(result, lmax, TRANSVR_IF_KR); + /* 10G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 10G COPPER */ + case TRANSVR_CLASS_COPPER_L1_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 1G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G COPPER */ + case TRANSVR_CLASS_COPPER_L1_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G BASE_T */ + case TRANSVR_CLASS_BASE_T_1000: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 100 Base */ + case TRANSVR_CLASS_OPTICAL_100: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_sfp_set_tomahawk_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sfp_set_tomahawk_if_type_1; + +err_sfp_set_tomahawk_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_sfp_detect_if_type(struct transvr_obj_s* self, + char *result){ + + int lmax = 8; + int detect_cls = DEBUG_TRANSVR_INT_VAL; + + detect_cls = sft_detect_transvr_class(self); + switch (self->chipset_type) { + case BCM_CHIP_TYPE_TRIDENT_2: + return _sfp_set_trident2_if_type(self, detect_cls, result); + + case BCM_CHIP_TYPE_TOMAHAWK: + return _sfp_set_tomahawk_if_type(self, detect_cls, result); + + default: + SWPS_INFO("%s: non-defined chipset_type:%d :%s\n", + __func__, self->chipset_type, self->swp_name); + break; + } + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + return ERR_TRANSVR_ABNORMAL; +} + + +int +sfp_get_if_type(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 16; + char tmp_result[16] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_sfp_detect_if_type(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_sfp_detect_if_speed(struct transvr_obj_s* self, + char *result){ + + int lmax = 16; + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + detect_val = sft_detect_transvr_class(self); + switch(detect_val) { + case TRANSVR_CLASS_ERROR: + case TRANSVR_CLASS_UNSPECIFIED: + break; + /* 25G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G: + return snprintf(result, lmax, TRANSVR_IF_SP_25G); + /* 25G COPPER */ + case TRANSVR_CLASS_COPPER_L1_25G: + return snprintf(result, lmax, TRANSVR_IF_SP_25G); + /* 10G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* 10G COPPER */ + case TRANSVR_CLASS_COPPER_L1_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* 1G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + /* 1G COPPER */ + case TRANSVR_CLASS_COPPER_L1_1G: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + /* 1G BASE_T */ + case TRANSVR_CLASS_BASE_T_1000: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + /* 100 Base */ + case TRANSVR_CLASS_OPTICAL_100: + return snprintf(result, lmax, TRANSVR_IF_SP_100); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + detect_val); + goto err_sfp_detect_if_speed_1; + } + /* Check by BR */ + detect_val = _sfp_detect_if_sp_by_br(self); + switch (detect_val) { + case TRANSVR_CLASS_25G: + return snprintf(result, lmax, TRANSVR_IF_SP_25G); + case TRANSVR_CLASS_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + case TRANSVR_CLASS_1G: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + default: + break; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sfp_detect_if_speed_1; + +err_sfp_detect_if_speed_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +sfp_get_if_speed(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 16; + char tmp_result[16] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_sfp_detect_if_speed(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_qsfp_detect_class_by_extend_comp(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + + detect_val = _qsfp_get_comp_extended(self); + switch(detect_val) { + case 0x00: /* Unspecified */ + return TRANSVR_CLASS_UNSPECIFIED; + + case 0x01: /* 100G AOC (Active Optical Cable) or 25GAUI C2M */ + case 0x18: /* 100G AOC or 25GAUI C2M AOC. */ + return TRANSVR_CLASS_OPTICAL_100G_AOC; + + case 0x06: /* 100G CWDM4 */ + case 0x09: /* Obsolete (assigned before 100G CWDM4 MSA required FEC) */ + case 0x17: /* 100G CLR4 */ + case 0x1A: /* 100GE-DWDM2 */ + return TRANSVR_CLASS_OPTICAL_100G; + + case 0x02: /* 100GBASE-SR4 or 25GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_100G_SR4; + + case 0x03: /* 100GBASE-LR4 or 25GBASE-LR */ + return TRANSVR_CLASS_OPTICAL_100G_LR4; + + case 0x04: /* 100GBASE-ER4 or 25GBASE-ER */ + return TRANSVR_CLASS_OPTICAL_100G_ER4; + + case 0x07: /* 100G PSM4 Parallel SMF */ + return TRANSVR_CLASS_OPTICAL_100G_PSM4; + + case 0x12: /* 40G PSM4 Parallel SMF */ + return TRANSVR_CLASS_OPTICAL_40G; + + case 0x11: /* 4 x 10GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_40G_SR4; + + case 0x10: /* 40GBASE-ER4 */ + return TRANSVR_CLASS_OPTICAL_40G_ER4; + + case 0x08: /* 100G ACC (Active Copper Cable) or 25GAUI C2M ACC. */ + case 0x0b: /* 100GBASE-CR4 or 25GBASE-CR CA-L */ + case 0x19: /* 100G ACC or 25GAUI C2M ACC. */ + return TRANSVR_CLASS_COPPER_L4_100G; + + default: + break; + } + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_qsfp_detect_class_by_10_40_100_ethernet(struct transvr_obj_s* self) { + /* Reference: SFF-8472 (v12.2) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + + detect_val = _qsfp_get_comp_10_40_100_ethernet(self); + /* Case: Unspecified */ + if (detect_val == 0x00) { + return TRANSVR_CLASS_UNSPECIFIED; + } + /* Case: 40G Optical */ + if ((detect_val & 0x01) == 0x01) { /* 00000001 : 40G Active Cable (XLPPI) */ + return TRANSVR_CLASS_OPTICAL_40G_AOC; + } + if ((detect_val & 0x04) == 0x04) { /* 00000100 : 40GBASE-SR4 */ + return TRANSVR_CLASS_OPTICAL_40G_SR4; + } + if ( (detect_val & 0x02) == 0x02) { /* 00000010 : 40GBASE-LR4 */ + return TRANSVR_CLASS_OPTICAL_40G_LR4; + } + if ( (detect_val & 0x08) == 0x08) { /* 00001000 : 40GBASE-CR4 */ + return TRANSVR_CLASS_COPPER_L4_40G; + } + /* Case: 10G Optical */ + if ( (detect_val & 0x10) == 0x10) { /* 00010000 : 10GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_10G_Q_SR; + } + if ( ((detect_val & 0x20) == 0x20) || /* 00100000 : 10GBASE-LR */ + ((detect_val & 0x40) == 0x40) ){ /* 01000000 : 10GBASE-LRM */ + return TRANSVR_CLASS_OPTICAL_10G_Q_LR; + } + /* Case: Extend Compliance */ + if ( ((detect_val & 0x80) == 0x80) ){ /* 10000000 : Use Extend Compliance */ + return TRANSVR_CLASS_EXTEND_COMP; + } + /* Case: ERROR */ + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_qsfp_detect_if_sp_by_br(struct transvr_obj_s* self) { + + int lower_bound_10g = 0x10; + int upper_bound_10g = 0x25; + int lower_bound_40g = 0x60; + int upper_bound_40g = 0x75; + int lower_bound_100g = 0x60; + int upper_bound_100g = 0x75; + int used_extend_br = 0xff; + int notmal_br = DEBUG_TRANSVR_INT_VAL; + int extend_br = DEBUG_TRANSVR_INT_VAL; + + notmal_br = (int)(self->br); /* updated by update_all() */ + /* Check 40G */ + if ((notmal_br >= lower_bound_40g) && + (notmal_br <= upper_bound_40g) ) { + return TRANSVR_CLASS_40G; + } + /* Check 100G */ + if (notmal_br == used_extend_br) { + extend_br = (int)(self->extbr); /* updated by update_all() */ + if ((extend_br >= lower_bound_100g) && + (extend_br <= upper_bound_100g) ) { + return TRANSVR_CLASS_100G; + } + } + /* Check 10G */ + if ((notmal_br >= lower_bound_10g) && + (notmal_br <= upper_bound_10g) ) { + return TRANSVR_CLASS_10G; + } + return TRANSVR_CLASS_UNSPECIFIED; +} + + +int +_qsfp_detect_class_by_feature(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int conn_val = DEBUG_TRANSVR_INT_VAL; + int wave_len = DEBUG_TRANSVR_INT_VAL; + int speed_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + speed_val = _qsfp_detect_if_sp_by_br(self); + conn_val = _qsfp_get_connector_type(self); + + switch(conn_val) { + case 0x00: /* Unspecified */ + return TRANSVR_CLASS_UNSPECIFIED; + case 0x07: /* LC (Lucent Connector) */ + case 0x0b: /* Optical Pigtail */ + case 0x0c: /* MPO 1x12 (Multifiber Parallel Optic) */ + case 0x0d: /* MPO 2x16 */ + goto ok_qsfp_detect_class_by_feature_4_optiocal; + case 0x21: /* Copper pigtail */ + goto ok_qsfp_detect_class_by_feature_4_copper; + case 0x23: /* No separable connector */ + if ((_qsfp_get_comp_fc_link_length(self) > 0) || + (_qsfp_get_comp_fc_trans_tech(self) > 0) || + (_qsfp_get_comp_fc_trans_media(self) > 0) || + (_qsfp_get_comp_fc_speed(self) > 0) ) { + goto ok_qsfp_detect_class_by_feature_4_aoc; + } + goto ok_qsfp_detect_class_by_feature_4_copper; + default: + snprintf(err_msg, sizeof(err_msg), + "_qsfp_get_connector_type return Non define value:%d", + conn_val); + goto err_qsfp_detect_class_by_feature_1; + } + return TRANSVR_CLASS_UNSPECIFIED; + +ok_qsfp_detect_class_by_feature_4_optiocal: + wave_len = _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1]); + switch(speed_val) { + case TRANSVR_CLASS_100G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_100G_SR4; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_100G_LR4; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_100G_ER4; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_100G; + + case TRANSVR_CLASS_40G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_40G_SR4; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_40G_LR4; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_40G_ER4; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_40G; + + case TRANSVR_CLASS_10G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_10G_Q_SR; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_10G_Q_LR; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_10G_Q_ER; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_10G; + + default: + return TRANSVR_CLASS_OPTICAL; + } + +ok_qsfp_detect_class_by_feature_4_aoc: + switch(speed_val) { + case TRANSVR_CLASS_100G: + return TRANSVR_CLASS_OPTICAL_100G_AOC; + case TRANSVR_CLASS_40G: + return TRANSVR_CLASS_OPTICAL_40G_AOC; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_OPTICAL_10G_Q_AOC; + default: + return TRANSVR_CLASS_OPTICAL; + } + +ok_qsfp_detect_class_by_feature_4_copper: + switch(speed_val) { + case TRANSVR_CLASS_100G: + return TRANSVR_CLASS_COPPER_L4_100G; + case TRANSVR_CLASS_40G: + return TRANSVR_CLASS_COPPER_L4_40G; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_COPPER_L4_10G; + default: + return TRANSVR_CLASS_COPPER; + } + +err_qsfp_detect_class_by_feature_1: + SWPS_INFO("%s: %s\n :%s", + __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +qsft_detect_transvr_class(struct transvr_obj_s* self) { + + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Check Extended Compliance */ + detect_val = _qsfp_detect_class_by_extend_comp(self); + switch (detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + case TRANSVR_CLASS_COPPER_L4_100G: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined extend_comp:%d", + detect_val); + goto err_qsft_detect_transvr_class_1; + } + /* Check 10/40G/100G Ethernet Compliance */ + detect_val = _qsfp_detect_class_by_10_40_100_ethernet(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_COPPER_L4_40G: + return detect_val; + case TRANSVR_CLASS_EXTEND_COMP: + /* Format incorrect case (We already checked the Extend + * Compliance is 0 + */ + snprintf(err_msg, sizeof(err_msg), + "Transceiver format incorrect"); + goto err_qsft_detect_transvr_class_1; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined 10/40/100:%d", + detect_val); + goto err_qsft_detect_transvr_class_1; + } + /* Check by Connector type, BR and wavelength */ + detect_val = _qsfp_detect_class_by_feature(self); + switch (detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL: + case TRANSVR_CLASS_COPPER_L4_100G: + case TRANSVR_CLASS_COPPER_L4_40G: + case TRANSVR_CLASS_COPPER_L4_10G: + case TRANSVR_CLASS_COPPER: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined connector:%d", + detect_val); + goto err_qsft_detect_transvr_class_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), + "Can not identify!"); + goto err_qsft_detect_transvr_class_1; + +err_qsft_detect_transvr_class_1: + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_qsfp_set_trident2_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result){ + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch (transvr_cls) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_ERROR: + break; + /* 100G Optical */ + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* 100G Copper */ + case TRANSVR_CLASS_COPPER_L4_100G: + return snprintf(result, lmax, TRANSVR_IF_KR4); + /* 40G Optical */ + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* 40G Copper */ + case TRANSVR_CLASS_COPPER_L4_40G: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* 10G Optical */ + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: LR4 or LR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: /* Need Check: ER4 or ER */ + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* Optical */ + case TRANSVR_CLASS_OPTICAL: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* Copper */ + case TRANSVR_CLASS_COPPER: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_qsfp_set_trident2_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_qsfp_set_trident2_if_type_1; + +err_qsfp_set_trident2_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_qsfp_set_tomahawk_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result){ + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch (transvr_cls) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_ERROR: + break; + /* 100G Optical */ + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* 100G Copper */ + case TRANSVR_CLASS_COPPER_L4_100G: + return snprintf(result, lmax, TRANSVR_IF_KR4); + /* 40G Optical */ + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* 40G Copper */ + case TRANSVR_CLASS_COPPER_L4_40G: + return snprintf(result, lmax, TRANSVR_IF_KR4); + /* 10G Optical */ + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* Optical */ + case TRANSVR_CLASS_OPTICAL: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* Copper */ + case TRANSVR_CLASS_COPPER: + return snprintf(result, lmax, TRANSVR_IF_KR4); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_qsfp_set_trident2_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_qsfp_set_trident2_if_type_1; + +err_qsfp_set_trident2_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_qsfp_detect_if_type(struct transvr_obj_s* self, + char *result){ + + int lmax = 8; + int detect_cls = DEBUG_TRANSVR_INT_VAL; + + detect_cls = qsft_detect_transvr_class(self); + switch (self->chipset_type) { + case BCM_CHIP_TYPE_TRIDENT_2: + return _qsfp_set_trident2_if_type(self, detect_cls, result); + + case BCM_CHIP_TYPE_TOMAHAWK: + return _qsfp_set_tomahawk_if_type(self, detect_cls, result); + + default: + SWPS_INFO("%s: non-defined chipset_type:%d :%s\n", + __func__, self->chipset_type, self->swp_name); + break; + } + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_if_type(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 8; + char tmp_result[8] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_qsfp_detect_if_type(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_qsfp_detect_if_speed(struct transvr_obj_s* self, + char *result){ + int lmax = 16; + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + detect_val = qsft_detect_transvr_class(self); + switch (detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_ERROR: + break; + /* 100G Optical */ + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return snprintf(result, lmax, TRANSVR_IF_SP_100G); + /* 100G Copper */ + case TRANSVR_CLASS_COPPER_L4_100G: + return snprintf(result, lmax, TRANSVR_IF_SP_100G); + /* 40G Optical */ + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + return snprintf(result, lmax, TRANSVR_IF_SP_40G); + /* 40G Copper */ + case TRANSVR_CLASS_COPPER_L4_40G: + return snprintf(result, lmax, TRANSVR_IF_SP_40G); + /* 10G Optical */ + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* 10G Copper */ + case TRANSVR_CLASS_COPPER_L4_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* Optical */ + case TRANSVR_CLASS_OPTICAL: + break; + /* Copper */ + case TRANSVR_CLASS_COPPER: + break; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined class case:%d", + detect_val); + goto err_qsfp_detect_if_speed_1; + } + /* Check br and extbr */ + detect_val = _qsfp_detect_if_sp_by_br(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + case TRANSVR_CLASS_40G: + return snprintf(result, lmax, TRANSVR_IF_SP_40G); + case TRANSVR_CLASS_100G: + return snprintf(result, lmax, TRANSVR_IF_SP_100G); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined BR case:%d", + detect_val); + goto err_qsfp_detect_if_speed_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_qsfp_detect_if_speed_1; + +err_qsfp_detect_if_speed_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_if_speed(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 16; + char tmp_result[16] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_qsfp_detect_if_speed(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_common_set_lane_map_str(struct transvr_obj_s* self, + char *result) { + int i = 0; + int tmp_val = 0; + char tmp_str[LEN_TRANSVR_L_STR] = DEBUG_TRANSVR_STR_VAL; + char err_msg[LEN_TRANSVR_L_STR] = DEBUG_TRANSVR_STR_VAL; + + memset(result, 0, LEN_TRANSVR_L_STR); + snprintf(result, LEN_TRANSVR_L_STR, "%s=", TRANSVR_UEVENT_KEY_LANE); + + for (i=0; ilane_id); i++) { + tmp_val = self->lane_id[i]; + if (tmp_val < 1) { + break; + } + if (tmp_val > 256) { + snprintf(err_msg, sizeof(err_msg), + "detect abnormal value:%d", tmp_val); + goto err_common_set_lane_map_str_1; + } + memset(tmp_str, 0, sizeof(tmp_str)); + if (i == 0) { + snprintf(tmp_str, LEN_TRANSVR_L_STR, "%d", tmp_val); + } else { + snprintf(tmp_str, LEN_TRANSVR_L_STR, ",%d", tmp_val); + } + strncat(result, tmp_str, LEN_TRANSVR_L_STR); + } + if (i == 0) { + goto err_common_set_lane_map_str_2; + } + return 0; + +err_common_set_lane_map_str_1: + SWPS_INFO("%s: %s", __func__, err_msg); +err_common_set_lane_map_str_2: + snprintf(result, LEN_TRANSVR_L_STR, "%s=%s", TRANSVR_UEVENT_KEY_LANE, TRANSVR_UEVENT_UNKNOW); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_common_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action, + int (*detect_if_type)(struct transvr_obj_s *self, char *result), + int (*detect_if_speed)(struct transvr_obj_s *self, char *result), + int send_anyway) { + + char *uevent_envp[4]; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + char tmp_str[32] = DEBUG_TRANSVR_STR_VAL; + char tmp_str_1[32] = DEBUG_TRANSVR_STR_VAL; + char tmp_str_2[32] = DEBUG_TRANSVR_STR_VAL; + char tmp_str_3[64] = DEBUG_TRANSVR_STR_VAL; + + if (TRANSVR_UEVENT_ENABLE != 1) { + return ERR_TRANSVR_NOTSUPPORT; + } + if (_common_get_if_lane(self, tmp_str) < 0) { + snprintf(tmp_str_3, sizeof(tmp_str_3), + "%s=%s", TRANSVR_UEVENT_KEY_LANE, TRANSVR_UEVENT_UNKNOW); + } else { + snprintf(tmp_str_3, sizeof(tmp_str_3), + "%s=%s", TRANSVR_UEVENT_KEY_LANE, tmp_str); + } + switch (u_action) { + case KOBJ_ADD: + /* Detect type */ + if (detect_if_type(self, tmp_str) < 0) { + snprintf(err_msg, sizeof(err_msg), "%s", "Detect interface type fail!"); + snprintf(tmp_str_1, sizeof(tmp_str_1), "%s=%s", TRANSVR_UEVENT_KEY_IF, TRANSVR_UEVENT_UNKNOW); + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, TRANSVR_UEVENT_UNKNOW); + uevent_envp[0] = tmp_str_1; + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_fail; + } + snprintf(tmp_str_1, sizeof(tmp_str_1), "%s=%s", TRANSVR_UEVENT_KEY_IF, tmp_str); + uevent_envp[0] = tmp_str_1; + /* Detect speed */ + if (detect_if_speed(self, tmp_str) < 0) { + snprintf(err_msg, sizeof(err_msg), "%s", "Detect interface speed fail!"); + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, TRANSVR_UEVENT_UNKNOW); + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_fail; + } + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, tmp_str); + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_send; + + case KOBJ_REMOVE: + snprintf(tmp_str_1, sizeof(tmp_str_1), "%s=%s", TRANSVR_UEVENT_KEY_IF, TRANSVR_UEVENT_UNKNOW); + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, TRANSVR_UEVENT_UNKNOW); + uevent_envp[0] = tmp_str_1; + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_send; + + default: + snprintf(err_msg, sizeof(err_msg), "kobject_action:%d not support", u_action); + goto private_common_send_uevent_4_fail; + } + snprintf(err_msg, sizeof(err_msg), "%s", "Exception case"); + goto private_common_send_uevent_4_fail; + +private_common_send_uevent_4_fail: + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + if (send_anyway) { + goto private_common_send_uevent_4_send; + } + return ERR_TRANSVR_UEVENT_FAIL; + +private_common_send_uevent_4_send: + return kobject_uevent_env(&(self->transvr_dev_p->kobj), + u_action, + uevent_envp); +} + +int +sfp_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action) { + int send_anyway = 1; + return _common_send_uevent(self, + u_action, + &_sfp_detect_if_type, + &_sfp_detect_if_speed, + send_anyway); +} + + +int +qsfp_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action) { + int send_anyway = 1; + return _common_send_uevent(self, + u_action, + &_qsfp_detect_if_type, + &_qsfp_detect_if_speed, + send_anyway); +} + + +int +fake_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action) { + return EVENT_TRANSVR_TASK_DONE; +} + + +int +common_fsm_4_direct_mode(struct transvr_obj_s* self, + char *caller_name){ + + int err; + int detect_result[2]; + int current_state = STATE_TRANSVR_UNEXCEPTED; + int current_type = TRANSVR_TYPE_ERROR; + + if (self->state == STATE_TRANSVR_NEW) { + if (_transvr_init_handler(self) < 0){ + return ERR_TRANSVR_INIT_FAIL; + } + } + err = detect_transvr_state(self, detect_result); + if (err < 0) { + return err; + } + /* In Direct mode, driver only detect transceiver when user call driver interface + * which on sysfs. So it only need consider the state of Transceiver. + */ + current_state = detect_result[0]; + current_type = detect_result[1]; + + switch (current_state){ + + case STATE_TRANSVR_DISCONNECTED: /* Transceiver is not plugged */ + self->state = current_state; + self->type = current_type; + return ERR_TRANSVR_UNPLUGGED; + + case STATE_TRANSVR_INIT: /* Transceiver is plugged, system not ready */ + return ERR_TRANSVR_UNINIT; + + case STATE_TRANSVR_ISOLATED: /* Transceiver is plugged, but has some issues */ + return ERR_TRNASVR_BE_ISOLATED; + + case STATE_TRANSVR_CONNECTED: /* Transceiver is plugged, system is ready */ + self->state = current_state; + self->type = current_type; + return 0; + + case STATE_TRANSVR_SWAPPED: /* Transceiver is plugged, system detect user changed */ + self->type = current_type; + if (reload_transvr_obj(self, current_type) < 0){ + self->state = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_UNEXCPT; + } + self->state = current_state; + return 0; + + case STATE_TRANSVR_UNEXCEPTED: /* Transceiver type or state is unexpected case */ + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = TRANSVR_TYPE_ERROR; + return ERR_TRANSVR_UNEXCPT; + + default: + SWPS_INFO("%s: state:%d not in define.\n", __func__, current_state); + break; + } + return ERR_TRANSVR_UNEXCPT; +} + + +static int +_is_except_happened_4_pmode(struct transvr_obj_s* self, + int new_state) { + + int event_chk = 0; + + if (self->temp == 0){ + return 0; + } + switch (new_state) { + case STATE_TRANSVR_INIT: + event_chk = EVENT_TRANSVR_EXCEP_INIT; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_CONNECTED: + event_chk = EVENT_TRANSVR_EXCEP_UP; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_DISCONNECTED: + event_chk = EVENT_TRANSVR_EXCEP_DOWN; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_SWAPPED: + event_chk = EVENT_TRANSVR_EXCEP_SWAP; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_UNEXCEPTED: + event_chk = EVENT_TRANSVR_EXCEP_EXCEP; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_ISOLATED: + event_chk = EVENT_TRANSVR_EXCEP_ISOLATED; + goto check_event_happened_4_pmode; + + default: + SWPS_INFO("%s: unexcepted case:%d\n", __func__, new_state); + break; + } + return 0; + +check_event_happened_4_pmode: + if (self->temp == event_chk){ + return 1; + } + return 0; +} + + +int +common_fsm_4_polling_mode(struct transvr_obj_s* self, + char *caller_name){ + /* [Return Value]: + * ERR_TRANSVR_UNINIT : (1) Initial not ready + * ERR_TRANSVR_UNPLUGGED : (1) Any -> Down + * ERR_TRANSVR_TASK_BUSY : (1) Wait Initial task + * ERR_TRANSVR_UNEXCPT : (1) Initial fail + * (2) Task fail + * (3) Reload fail + * ERR_TRNASVR_BE_ISOLATED : (1) Already be isolated + * OK Case (return 0) : (1) action_4_connected + * (2) action_4_nothing (initial retry) + */ + int curr_state[2]; + int old_state = self->state; + int old_type = self->type; + int new_state = STATE_TRANSVR_UNEXCEPTED; + int new_type = TRANSVR_TYPE_ERROR; + int return_val = ERR_TRANSVR_UNEXCPT; + + /* Never initial */ + if (self->state == STATE_TRANSVR_NEW) { + goto comfsm_action_4_reinit_obj; + } + /* Detect current state */ + switch (detect_transvr_state(self, curr_state)) { + case 0: + new_state = curr_state[0]; + new_type = curr_state[1]; + break; + + case ERR_TRNASVR_BE_ISOLATED: + new_state = STATE_TRANSVR_ISOLATED; + new_type = old_type; + break; + + case ERR_TRANSVR_I2C_CRASH: + goto comfsm_action_4_report_i2c_crash; + + case ERR_TRANSVR_UNEXCPT: + default: + new_state = STATE_TRANSVR_UNEXCEPTED; + new_type = old_type; + } + /* State handling */ + switch (old_state) { + case STATE_TRANSVR_INIT: /* INIT -> */ + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 1-1: UP -> INIT */ + SWPS_INFO("Detect %s is present. :1-1\n",self->swp_name); + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 1-2: UP -> UP */ + return_val = 0; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_DISCONNECTED: /* Case 1-3: UP -> DOWN */ + SWPS_INFO("Detect %s is removed. :1-3\n",self->swp_name); + goto comfsm_action_4_disconnected; + + case STATE_TRANSVR_SWAPPED: /* Case 1-4: UP -> SWAP */ + SWPS_INFO("Detect %s is swapped. :1-4\n",self->swp_name); + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 1-5: UP -> UNEXPET */ + SWPS_INFO("Detect %s has error. :1-5\n",self->swp_name); + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_ISOLATED: /* Case 1-6: UP -> ISOLATE */ + SWPS_INFO("Detect %s be isolated. :1-6\n",self->swp_name); + goto comfsm_action_4_isolate_obj; + + default: + break; + } + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_DISCONNECTED: + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 2-1: DOWN -> INIT */ + SWPS_INFO("Detect %s is present. :2-1\n",self->swp_name); + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 2-2: DOWN -> UP */ + SWPS_INFO("Detect %s is present. :2-2\n",self->swp_name); + goto comfsm_action_4_reinit_obj; + + case STATE_TRANSVR_DISCONNECTED: /* Case 2-3: DOWN -> DOWN */ + return_val = ERR_TRANSVR_UNPLUGGED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_SWAPPED: /* Case 2-4: DOWN -> SWAP */ + SWPS_INFO("Detect %s is swapped. :2-4\n",self->swp_name); + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 2-5: DOWN -> UNEXPET */ + SWPS_INFO("Detect %s has error. :2-5\n",self->swp_name); + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_ISOLATED: /* Case 2-6: DOWN -> ISOLATE */ + SWPS_INFO("Detect %s be isolated. :2-6\n",self->swp_name); + goto comfsm_action_4_isolate_obj; + + default: + break; + } + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_UNEXCEPTED: + /* Filter out re-action */ + if (_is_except_happened_4_pmode(self, new_state)) { + goto comfsm_action_4_keep_state; + } + /* First action */ + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 3-1: UNEXPET -> INIT */ + SWPS_INFO("Detect %s is present. :3-1\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_INIT; + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 3-2: UNEXPET -> UP */ + SWPS_INFO("Detect %s is present. :3-2\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_UP; + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_DISCONNECTED: /* Case 3-3: UNEXPET -> DOWN */ + SWPS_INFO("Detect %s is removed. :3-3\n",self->swp_name); + goto comfsm_action_4_disconnected; + + case STATE_TRANSVR_SWAPPED: /* Case 3-4: UNEXPET -> SWAP */ + SWPS_INFO("Detect %s is swapped. :3-4\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_SWAP; + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 3-5: UNEXPET -> UNEXPET */ + self->temp = EVENT_TRANSVR_EXCEP_EXCEP; + return_val = ERR_TRANSVR_UNEXCPT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_ISOLATED: /* Case 3-6: UNEXPET -> ISOLATE */ + SWPS_INFO("Detect %s be isolated. :3-6\n",self->swp_name); + goto comfsm_action_4_isolate_obj; + + default: + break; + } + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_ISOLATED: + /* Filter out re-action */ + if (_is_except_happened_4_pmode(self, new_state)) { + goto comfsm_action_4_keep_state; + } + /* First action */ + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 4-1: ISOLATE -> INIT */ + SWPS_INFO("Detect %s internal error. :4-1\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_INIT; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 4-2: ISOLATE -> UP */ + SWPS_INFO("Detect %s internal error. :4-2\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_UP; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_DISCONNECTED: /* Case 4-3: ISOLATE -> DOWN */ + SWPS_INFO("Detect %s is removed. :4-3\n",self->swp_name); + goto comfsm_action_4_disconnected; + + case STATE_TRANSVR_SWAPPED: /* Case 4-4: ISOLATE -> SWAP */ + SWPS_INFO("Detect %s internal error. :4-4\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_SWAP; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 4-5: ISOLATE -> UNEXPET */ + SWPS_INFO("Detect %s internal error. :4-5\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_EXCEP; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_ISOLATED: /* Case 4-6: ISOLATE -> ISOLATE */ + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + default: + break; + } + goto comfsm_action_4_unexpected; + + default: + break; + } + goto comfsm_action_4_unexpected; + + +comfsm_action_4_keep_state: + return return_val; + +comfsm_action_4_reinit_obj: + SWPS_DEBUG("FSM action: %s re-initial.\n", self->swp_name); + return_val = _transvr_init_handler(self); + goto comfsm_action_4_identify_event; + +comfsm_action_4_reload_obj: + SWPS_DEBUG("FSM action: %s reload.\n", self->swp_name); + self->type = new_type; + return_val = reload_transvr_obj(self, new_type); + goto comfsm_action_4_identify_event; + +comfsm_action_4_identify_event: + switch (return_val) { + case EVENT_TRANSVR_INIT_UP: + case EVENT_TRANSVR_TASK_DONE: + goto comfsm_action_4_connected; + + case EVENT_TRANSVR_INIT_DOWN: + goto comfsm_action_4_disconnected; + + case EVENT_TRANSVR_INIT_REINIT: + goto comfsm_action_4_nothing; + + case EVENT_TRANSVR_TASK_WAIT: + self->state = STATE_TRANSVR_INIT; + return ERR_TRANSVR_TASK_BUSY; + + case EVENT_TRANSVR_TASK_FAIL: + SWPS_INFO("%s detect EVENT_TRANSVR_TASK_FAIL.\n", self->swp_name); + goto comfsm_action_4_unexpected; + + case EVENT_TRANSVR_INIT_FAIL: + SWPS_INFO("%s detect EVENT_TRANSVR_INIT_FAIL.\n", self->swp_name); + goto comfsm_action_4_unexpected; + + case EVENT_TRANSVR_RELOAD_FAIL: + SWPS_INFO("%s detect EVENT_TRANSVR_RELOAD_FAIL.\n", self->swp_name); + goto comfsm_action_4_unexpected; + + case EVENT_TRANSVR_I2C_CRASH: + goto comfsm_action_4_report_i2c_crash; + + case EVENT_TRANSVR_EXCEP_ISOLATED: + goto comfsm_action_4_isolate_obj; + + default: + SWPS_INFO("%s detect undefined event:%d.\n", self->swp_name, return_val); + goto comfsm_action_4_unexpected; + } + +comfsm_action_4_nothing: + SWPS_DEBUG("FSM action: %s do nothing.\n", self->swp_name); + return 0; + +comfsm_action_4_connected: + SWPS_DEBUG("FSM action: %s Connected.\n", self->swp_name); + self->state = STATE_TRANSVR_CONNECTED; + self->type = new_type; + self->send_uevent(self, KOBJ_ADD); + _transvr_clean_retry(self); + return 0; + +comfsm_action_4_disconnected: + SWPS_DEBUG("FSM action: %s Disconnected. \n", self->swp_name); + self->state = STATE_TRANSVR_DISCONNECTED; + self->temp = EVENT_TRANSVR_TASK_DONE; + self->send_uevent(self, KOBJ_REMOVE); + _transvr_clean_retry(self); + _transvr_clean_handler(self); + return ERR_TRANSVR_UNPLUGGED; + +comfsm_action_4_report_i2c_crash: + SWPS_DEBUG("FSM action: %s report I2C crash.\n", self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_I2C_CRASH; + +comfsm_action_4_isolate_obj: + SWPS_DEBUG("FSM action: %s isolate.\n", self->swp_name); + self->state = STATE_TRANSVR_ISOLATED; + return ERR_TRNASVR_BE_ISOLATED; + +comfsm_action_4_unexpected: + SWPS_INFO("FSM action: %s unexpected.\n", self->swp_name); + SWPS_INFO("Dump: :%d :0x%02x :%d :0x%02x\n", + old_state, old_type, new_state, new_type); + self->state = STATE_TRANSVR_UNEXCEPTED; + self->send_uevent(self, KOBJ_REMOVE); + _transvr_clean_handler(self); + return ERR_TRANSVR_UNEXCPT; +} + + +int +fake_fsm_4_direct_mode(struct transvr_obj_s* self, + char *caller_name){ + self->state = STATE_TRANSVR_CONNECTED; + self->type = TRANSVR_TYPE_FAKE; + return 0; +} + + +int +fake_fsm_4_polling_mode(struct transvr_obj_s* self, + char *caller_name){ + self->state = STATE_TRANSVR_CONNECTED; + self->type = TRANSVR_TYPE_FAKE; + return 0; +} + + +/* ========== Object functions for Initial procedure ========== + */ +int +transvr_init_common(struct transvr_obj_s *self){ + /* Nothing to update */ + return EVENT_TRANSVR_TASK_DONE; +} + + +int +transvr_init_fake(struct transvr_obj_s *self){ + return EVENT_TRANSVR_TASK_DONE; +} + + +int +transvr_init_sfp(struct transvr_obj_s *self){ + + int tmp_val = DEBUG_TRANSVR_INT_VAL; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *err_msg = "ERR"; + + self->info = sft_detect_transvr_class(self); + /* Disable auto_config */ + if (!self->auto_config) { + return EVENT_TRANSVR_TASK_DONE; + } + /* Handle multi-rate */ + err_code = initfunc_sfp_handle_multi_rate_mode(self); + if (err_code < 0) { + err_msg = "initfunc_sfp_handle_multi_rate_mode fail!"; + goto err_transvr_init_sfp_1; + } + /* Handle 1G- RJ45 */ + tmp_val = err_code; + err_code = initfunc_sfp_handle_1g_rj45(self); + if (err_code < 0) { + err_msg = "initfunc_sfp_handle_1g_rj45 fail!"; + goto err_transvr_init_sfp_1; + } + tmp_val = (tmp_val > err_code ? tmp_val : err_code); + if (tmp_val > EVENT_TRANSVR_TASK_DONE) { + return tmp_val; + } + return EVENT_TRANSVR_TASK_DONE; + +err_transvr_init_sfp_1: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, err_code, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +int +transvr_init_qsfp(struct transvr_obj_s *self){ + + int err = EVENT_TRANSVR_EXCEP_EXCEP; + char *emsg = "ERR"; + + self->info = qsft_detect_transvr_class(self); + if (!self->auto_config) { + return EVENT_TRANSVR_TASK_DONE; + } + err = initfunc_qsfp_handle_power_mode(self); + if (err < 0){ + emsg = "initfunc_qsfp_handle_tx_disable fail!"; + goto err_transvr_init_qsfp; + } + return EVENT_TRANSVR_TASK_DONE; + +err_transvr_init_qsfp: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, emsg, err, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +int +transvr_init_qsfp28(struct transvr_obj_s *self){ + + int tmp_val = EVENT_TRANSVR_EXCEP_EXCEP; + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_msg = "ERR"; + + /* Handle QSFP common */ + err_val = transvr_init_qsfp(self); + if (err_val < 0){ + err_msg = "transvr_init_qsfp fail!"; + goto err_transvr_init_qsfp28_1; + } + /* Disable auto_config */ + if (!self->auto_config) { + return err_val; + } + /* Handle CDR */ + tmp_val = err_val; + err_val = initfunc_qsfp28_handle_cdr(self); + if (err_val < 0){ + err_msg = "Handle CDR fail!"; + goto err_transvr_init_qsfp28_1; + } + tmp_val = (tmp_val > err_val ? tmp_val : err_val); + if (tmp_val > EVENT_TRANSVR_TASK_DONE) { + return tmp_val; + } + return EVENT_TRANSVR_TASK_DONE; + +err_transvr_init_qsfp28_1: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, err_val, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +/* ========== Object Initial handler ========== + */ +static int +_is_transvr_valid(struct transvr_obj_s *self, + int type, + int state) { + /* [Return] + * 0 : OK, inserted + * EVENT_TRANSVR_INIT_DOWN : OK, removed + * EVENT_TRANSVR_INIT_FAIL : Outside error, type doesn't supported + * EVENT_TRANSVR_EXCEP_INIT : Internal error, state undefined + */ + switch (type) { + case TRANSVR_TYPE_SFP: + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + case TRANSVR_TYPE_UNPLUGGED: + case TRANSVR_TYPE_FAKE: + break; + default: + SWPS_INFO("detect undefined type:0x%02x on %s\n", + type, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; + } + switch (state) { + case STATE_TRANSVR_DISCONNECTED: + return EVENT_TRANSVR_INIT_DOWN; + case STATE_TRANSVR_INIT: + case STATE_TRANSVR_CONNECTED: + case STATE_TRANSVR_SWAPPED: + break; + default: + SWPS_INFO("detect undefined state:%d on %s\n", + state, self->swp_name); + return EVENT_TRANSVR_EXCEP_INIT; + } + return 0; +} + + +static int +_is_transvr_hw_ready(struct transvr_obj_s *self, + int type){ + /* [Return] + * EVENT_TRANSVR_TASK_DONE : Ready + * EVENT_TRANSVR_TASK_WAIT : Not ready + * EVENT_TRANSVR_INIT_FAIL : Error + */ + int addr = DEBUG_TRANSVR_INT_VAL; + int page = DEBUG_TRANSVR_INT_VAL; + int offs = DEBUG_TRANSVR_INT_VAL; + int bit = DEBUG_TRANSVR_INT_VAL; + int ready = DEBUG_TRANSVR_INT_VAL; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t ab_val = DEBUG_TRANSVR_HEX_VAL; + + switch (type) { + case TRANSVR_TYPE_SFP: + addr = VAL_TRANSVR_8472_READY_ADDR; + page = VAL_TRANSVR_8472_READY_PAGE; + offs = VAL_TRANSVR_8472_READY_OFFSET; + bit = VAL_TRANSVR_8472_READY_BIT; + ready = VAL_TRANSVR_8472_READY_VALUE; + ab_val = VAL_TRANSVR_8472_READY_ABNORMAL; + break; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + addr = VAL_TRANSVR_8436_READY_ADDR; + page = VAL_TRANSVR_8436_READY_PAGE; + offs = VAL_TRANSVR_8436_READY_OFFSET; + bit = VAL_TRANSVR_8436_READY_BIT; + ready = VAL_TRANSVR_8436_READY_VALUE; + ab_val = VAL_TRANSVR_8436_READY_ABNORMAL; + break; + + case TRANSVR_TYPE_UNPLUGGED: + case TRANSVR_TYPE_FAKE: + return EVENT_TRANSVR_TASK_DONE; + + default: + emsg = "unexpected case"; + goto err_is_transvr_hw_ready; + } + /* Select target page */ + err = _common_setup_page(self, addr, page, offs, 1, 0); + if (err < 0) { + emsg = "setup page fail"; + goto err_is_transvr_hw_ready; + } + /* Check feature supported + * [Note] + * Some of transceiver/cables doesn't support "Status Indicators" + * (ex:DAC, RJ45 copper SFP ...etc). In these case, we bypass the + * step of checking Status Indicators, then state machine will take + * the following handle procedure. + */ + err = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + if (err < 0) { + emsg = "doesn't support Status Indicators"; + goto bypass_is_transvr_hw_ready; + } + /* Filter abnormal case */ + if (err == ab_val) { + emsg = "detect using unusual definition."; + goto bypass_is_transvr_hw_ready; + } + /* Get Status Indicators */ + err = i2c_smbus_read_byte_data(self->i2c_client_p, offs); + if (err < 0) { + emsg = "detect current value fail"; + goto err_is_transvr_hw_ready; + } + if ((err & (1<:%d\n", __func__, emsg, type); + return EVENT_TRANSVR_TASK_DONE; + +err_is_transvr_hw_ready: + SWPS_DEBUG("%s: %s :%d\n", __func__, emsg, type); + return EVENT_TRANSVR_INIT_FAIL; +} + + +static int +_is_transvr_support_ctle(struct transvr_obj_s *self) { + + switch (self->info) { + case TRANSVR_CLASS_OPTICAL_25G: + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return 1; + default: + break; + } + return 0; +} + + +static int +_transvr_init_handler(struct transvr_obj_s *self){ + + int detect[2]; + int d_state = STATE_TRANSVR_UNEXCEPTED; + int d_type = TRANSVR_TYPE_ERROR; + int result = ERR_TRANSVR_UNINIT; + int retry = 6; /* (6+1) x 0.3 = 2.1s > spec:2.0s */ + int elimit = 63; + char emsg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Clean and check callback */ + self->state = STATE_TRANSVR_INIT; + if (self->init == NULL) { + snprintf(emsg, elimit, "init() is null"); + goto initer_err_case_unexcept_0; + } + if (self->clean == NULL) { + snprintf(emsg, elimit, "clean() is null"); + goto initer_err_case_unexcept_0; + } + self->clean(self); + + /* Detect transceiver information */ + result = detect_transvr_state(self, detect); + if (result < 0) { + snprintf(emsg, elimit, "detect_transvr_state() fail"); + switch (result) { + case ERR_TRANSVR_I2C_CRASH: + goto initer_err_case_i2c_ceash; + case ERR_TRNASVR_BE_ISOLATED: + goto initer_err_case_be_isolated; + + case ERR_TRANSVR_UNEXCPT: + default: + break; + } + goto initer_err_case_retry_1; + } + d_state = detect[0]; + d_type = detect[1]; + + /* Verify transceiver type and state */ + switch (_is_transvr_valid(self, d_type, d_state)) { + case 0: + break; + case EVENT_TRANSVR_INIT_DOWN: + goto initer_ok_case_down;; + case EVENT_TRANSVR_INIT_FAIL: + snprintf(emsg, elimit, "transceiver type doesn't support"); + goto initer_err_case_alarm_to_user; + case EVENT_TRANSVR_EXCEP_INIT: + default: + goto initer_err_case_unexcept_1; + } + + /* Handle reload case */ + if (self->type != d_type){ + /* This is the protect mechanism. Normally, This case will not happen. + * When State machine detect swap event during initial, It will trigger + * reload function to ensure type correct. */ + if (_reload_transvr_obj(self, d_type) < 0){ + snprintf(emsg, elimit, "reload object fail"); + goto initer_err_case_unexcept_1; + } + } + + /* Check transceiver HW initial ready */ + switch (_is_transvr_hw_ready(self, d_type)) { + case EVENT_TRANSVR_TASK_DONE: + break; + case EVENT_TRANSVR_TASK_WAIT: + goto initer_err_case_retry_1; + case EVENT_TRANSVR_INIT_FAIL: + default: + goto initer_err_case_unexcept_1; + } + + /* Try to update all and check */ + if (self->update_all(self, 1) < 0){ + /* For some transceiver, EEPROME has lag issues during initial stage. + * In this case, we set status back to STATE_TRANSVR_NEW, than it will + * be checked in next polling cycle. */ + goto initer_err_case_retry_1; + } + + /* Execute init() call back */ + result = self->init(self); + switch (result) { + case EVENT_TRANSVR_TASK_DONE: + break; + case EVENT_TRANSVR_TASK_WAIT: + goto initer_ok_case_wait; + + default: + snprintf(emsg, elimit, "undefined init() return:%d\n", result); + goto initer_err_case_unexcept_1; + } + goto initer_ok_case_up; + + +initer_ok_case_wait: + self->dump_all(self); + return EVENT_TRANSVR_TASK_WAIT; + +initer_ok_case_up: + self->state = STATE_TRANSVR_CONNECTED; + self->temp = 0; + self->dump_all(self); + return EVENT_TRANSVR_INIT_UP; + +initer_ok_case_down: + self->temp = 0; + self->state = STATE_TRANSVR_DISCONNECTED; + return EVENT_TRANSVR_INIT_DOWN; + +initer_err_case_i2c_ceash: + SWPS_DEBUG("%s: %s :%s :I2C crash\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + return EVENT_TRANSVR_I2C_CRASH; + +initer_err_case_be_isolated: + SWPS_DEBUG("%s: %s :%s :isolated\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_ISOLATED; + return EVENT_TRANSVR_EXCEP_ISOLATED; + +initer_err_case_retry_1: + SWPS_DEBUG("%s: %s :%s :retry\n", + __func__, emsg, self->swp_name); + if (_transvr_handle_retry(self, retry) == 0) { + self->state = STATE_TRANSVR_NEW; + return EVENT_TRANSVR_INIT_REINIT; + } + goto initer_err_case_alarm_to_user; + +initer_err_case_unexcept_1: + self->clean(self); +initer_err_case_unexcept_0: + self->state = STATE_TRANSVR_UNEXCEPTED; + if (_is_except_happened_4_pmode(self, d_state) && + (self->mode == TRANSVR_MODE_POLLING) ){ + SWPS_INFO("%s: %s :%s\n", __func__, emsg, self->swp_name); + SWPS_INFO("Dump: :%d :%d :%d :%d\n", + self->state, self->type, d_state, d_type); + } + return EVENT_TRANSVR_INIT_FAIL; + +initer_err_case_alarm_to_user: + SWPS_DEBUG("%s: %s :%s :alarm_to_user\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + alarm_msg_2_user(self, "detected transceiver/cables not meet SFF standard"); + return EVENT_TRANSVR_INIT_FAIL; +} + + +/* ========== Object functions for Clean procedure ========== + */ +int +_transvr_clean_handler(struct transvr_obj_s *self){ + + int retval = DEBUG_TRANSVR_INT_VAL; + + if (!self->clean) { + SWPS_ERR("%s: %s clean() is NULL.\n", + __func__, self->swp_name); + return EVENT_TRANSVR_TASK_FAIL; + } + retval = self->clean(self); + if (retval != EVENT_TRANSVR_TASK_DONE){ + SWPS_ERR("%s: %s clean() fail. [ERR]:%d\n", + __func__, self->swp_name, retval); + return retval; + } + return EVENT_TRANSVR_TASK_DONE; +} + + +int +common_transvr_clean(struct transvr_obj_s *self){ + + transvr_task_free_all(self); + return EVENT_TRANSVR_TASK_DONE; +} + + +int +qsfp_transvr_clean(struct transvr_obj_s *self){ + + int retval; + int lpower_config = 1; + + retval = _taskfunc_qsfp_setup_power_mod(self, lpower_config); + if (retval < 0){ + SWPS_ERR("%s: Set lpmod fail! :%d\n", + __func__, retval); + return retval; + } + retval = common_transvr_clean(self); + if (retval < 0){ + SWPS_ERR("%s: common_transvr_clean fail! :%d\n", + __func__, retval); + return retval; + } + return EVENT_TRANSVR_TASK_DONE; +} + + +int +fake_transvr_clean(struct transvr_obj_s *self){ + + return EVENT_TRANSVR_TASK_DONE; +} + + +/* ========== Object functions for check and update ========== + */ +int +common_transvr_check(struct transvr_obj_s *self){ + + char fun_str[32] = "common_transvr_check"; + + if (self->mode != TRANSVR_MODE_POLLING) { + SWPS_ERR("%s: mode:%d is not TRANSVR_MODE_POLLING\n", + fun_str, self->mode); + return ERR_TRANSVR_UNEXCPT; + } + /* Trigger delay task */ + transvr_task_run_all(self); + /* Trigger state machine to check and update */ + return self->fsm_4_polling(self, fun_str); +} + + +int +fake_transvr_check(struct transvr_obj_s *self){ + return 0; +} + + +/* ========== Functions for Factory pattern ========== + */ +static int +setup_transvr_public_cb(struct transvr_obj_s *self, + int transvr_type){ + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + self->get_id = common_get_id; + self->get_ext_id = common_get_ext_id; + self->get_connector = common_get_connector; + self->get_vendor_name = common_get_vendor_name; + self->get_vendor_pn = common_get_vendor_pn; + self->get_vendor_rev = common_get_vendor_rev; + self->get_vendor_sn = common_get_vendor_sn; + self->get_power_cls = unsupported_get_func; + self->get_br = common_get_br; + self->get_len_sm = sfp_get_len_sm; + self->get_len_smf = common_get_len_smf; + self->get_len_om1 = common_get_len_om1; + self->get_len_om2 = common_get_len_om2; + self->get_len_om3 = common_get_len_om3; + self->get_len_om4 = common_get_len_om4; + self->get_comp_rev = common_get_comp_rev; + self->get_comp_eth_1 = sfp_get_comp_eth_1; + self->get_comp_eth_10 = sfp_get_comp_eth_10; + self->get_comp_eth_10_40 = unsupported_get_func; + self->get_comp_extend = common_get_comp_extended; + self->get_cdr = unsupported_get_func; + self->get_rate_id = sfp_get_rate_id; + self->get_soft_rs0 = sfp_get_soft_rs0; + self->get_soft_rs1 = sfp_get_soft_rs1; + self->get_info = common_get_info; + self->get_if_type = sfp_get_if_type; + self->get_if_speed = sfp_get_if_speed; + self->get_if_lane = common_get_if_lane; + self->get_curr_temp = sfp_get_transvr_temp; + self->get_curr_vol = sfp_get_transvr_voltage; + self->get_soft_rx_los = unsupported_get_func2; + self->get_soft_tx_disable = unsupported_get_func2; + self->get_soft_tx_fault = unsupported_get_func2; + self->get_auto_tx_disable = unsupported_get_func2; + self->get_tx_bias = sfp_get_transvr_tx_bias; + self->get_tx_power = sfp_get_transvr_tx_power; + self->get_rx_power = sfp_get_transvr_rx_power; + self->get_tx_eq = sfp_get_transvr_tx_eq; + self->get_rx_am = unsupported_get_func2; + self->get_rx_em = sfp_get_transvr_rx_em; + self->get_wavelength = sfp_get_wavelength; + self->set_cdr = unsupported_set_func; + self->set_soft_rs0 = sfp_set_soft_rs0; + self->set_soft_rs1 = sfp_set_soft_rs1; + self->set_soft_tx_disable = unsupported_set_func; + self->set_auto_tx_disable = unsupported_set_func; + self->set_tx_eq = sfp_set_tx_eq; + self->set_rx_am = unsupported_set_func; + self->set_rx_em = sfp_set_rx_em; + return 0; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + self->get_id = common_get_id; + self->get_ext_id = common_get_ext_id; + self->get_connector = common_get_connector; + self->get_vendor_name = common_get_vendor_name; + self->get_vendor_pn = common_get_vendor_pn; + self->get_vendor_rev = common_get_vendor_rev; + self->get_vendor_sn = common_get_vendor_sn; + self->get_power_cls = qsfp_get_power_cls; + self->get_br = common_get_br; + self->get_len_sm = unsupported_get_func; + self->get_len_smf = common_get_len_smf; + self->get_len_om1 = common_get_len_om1; + self->get_len_om2 = common_get_len_om2; + self->get_len_om3 = common_get_len_om3; + self->get_len_om4 = common_get_len_om4; + self->get_comp_rev = common_get_comp_rev; + self->get_comp_eth_1 = qsfp_get_comp_eth; + self->get_comp_eth_10 = unsupported_get_func; + self->get_comp_eth_10_40 = qsfp_get_comp_10_40; + self->get_comp_extend = common_get_comp_extended; + self->get_cdr = unsupported_get_func; + self->get_rate_id = unsupported_get_func; + self->get_soft_rs0 = unsupported_get_func; /* TBD */ + self->get_soft_rs1 = unsupported_get_func; /* TBD */ + self->get_info = common_get_info; + self->get_if_type = qsfp_get_if_type; + self->get_if_speed = qsfp_get_if_speed; + self->get_if_lane = common_get_if_lane; + self->get_curr_temp = qsfp_get_transvr_temp; + self->get_curr_vol = qsfp_get_transvr_voltage; + self->get_soft_rx_los = qsfp_get_soft_rx_los; + self->get_soft_tx_disable = qsfp_get_soft_tx_disable; + self->get_soft_tx_fault = qsfp_get_soft_tx_fault; + self->get_auto_tx_disable = qsfp_get_auto_tx_disable; + self->get_tx_bias = qsfp_get_transvr_tx_bias; + self->get_tx_power = qsfp_get_transvr_tx_power; + self->get_rx_power = qsfp_get_transvr_rx_power; + self->get_tx_eq = unsupported_get_func2; + self->get_rx_am = unsupported_get_func2; + self->get_rx_em = unsupported_get_func2; + self->get_wavelength = qsfp_get_wavelength; + self->set_cdr = unsupported_set_func; + self->set_soft_rs0 = unsupported_set_func; /* TBD */ + self->set_soft_rs1 = unsupported_set_func; /* TBD */ + self->set_soft_tx_disable = qsfp_set_soft_tx_disable; + self->set_auto_tx_disable = qsfp_set_auto_tx_disable; + self->set_tx_eq = unsupported_set_func; + self->set_rx_am = unsupported_set_func; + self->set_rx_em = unsupported_set_func; + return 0; + + case TRANSVR_TYPE_QSFP_28: + self->get_id = common_get_id; + self->get_ext_id = common_get_ext_id; + self->get_connector = common_get_connector; + self->get_vendor_name = common_get_vendor_name; + self->get_vendor_pn = common_get_vendor_pn; + self->get_vendor_rev = common_get_vendor_rev; + self->get_vendor_sn = common_get_vendor_sn; + self->get_power_cls = qsfp_get_power_cls; + self->get_br = common_get_br; + self->get_len_sm = unsupported_get_func; + self->get_len_smf = common_get_len_smf; + self->get_len_om1 = common_get_len_om1; + self->get_len_om2 = common_get_len_om2; + self->get_len_om3 = common_get_len_om3; + self->get_len_om4 = common_get_len_om4; + self->get_comp_rev = common_get_comp_rev; + self->get_comp_eth_1 = qsfp_get_comp_eth; + self->get_comp_eth_10 = unsupported_get_func; + self->get_comp_eth_10_40 = qsfp_get_comp_10_40; + self->get_comp_extend = common_get_comp_extended; + self->get_cdr = qsfp_get_cdr; + self->get_rate_id = unsupported_get_func; + self->get_soft_rs0 = unsupported_get_func; /* TBD */ + self->get_soft_rs1 = unsupported_get_func; /* TBD */ + self->get_info = common_get_info; + self->get_if_type = qsfp_get_if_type; + self->get_if_speed = qsfp_get_if_speed; + self->get_if_lane = common_get_if_lane; + self->get_curr_temp = qsfp_get_transvr_temp; + self->get_curr_vol = qsfp_get_transvr_voltage; + self->get_soft_rx_los = qsfp_get_soft_rx_los; + self->get_soft_tx_disable = qsfp_get_soft_tx_disable; + self->get_soft_tx_fault = qsfp_get_soft_tx_fault; + self->get_auto_tx_disable = qsfp_get_auto_tx_disable; + self->get_tx_bias = qsfp_get_transvr_tx_bias; + self->get_tx_power = qsfp_get_transvr_tx_power; + self->get_rx_power = qsfp_get_transvr_rx_power; + self->get_tx_eq = qsfp_get_transvr_tx_eq; + self->get_rx_am = qsfp_get_transvr_rx_am; + self->get_rx_em = qsfp_get_transvr_rx_em; + self->get_wavelength = qsfp_get_wavelength; + self->set_cdr = qsfp_set_cdr; + self->set_soft_rs0 = unsupported_set_func; /* TBD */ + self->set_soft_rs1 = unsupported_set_func; /* TBD */ + self->set_soft_tx_disable = qsfp_set_soft_tx_disable; + self->set_auto_tx_disable = qsfp_set_auto_tx_disable; + self->set_tx_eq = qsfp_set_tx_eq; + self->set_rx_am = qsfp_set_rx_am; + self->set_rx_em = qsfp_set_rx_em; + return 0; + + case TRANSVR_TYPE_FAKE: + self->get_id = fake_get_hex; + self->get_ext_id = fake_get_hex; + self->get_connector = fake_get_hex; + self->get_vendor_name = fake_get_str; + self->get_vendor_pn = fake_get_str; + self->get_vendor_rev = fake_get_str; + self->get_vendor_sn = fake_get_str; + self->get_power_cls = fake_get_int; + self->get_br = fake_get_hex; + self->get_len_sm = fake_get_int; + self->get_len_smf = fake_get_int; + self->get_len_om1 = fake_get_int; + self->get_len_om2 = fake_get_int; + self->get_len_om3 = fake_get_int; + self->get_len_om4 = fake_get_int; + self->get_comp_rev = fake_get_hex; + self->get_comp_eth_1 = fake_get_hex; + self->get_comp_eth_10 = fake_get_hex; + self->get_comp_eth_10_40 = fake_get_hex; + self->get_comp_extend = fake_get_hex; + self->get_cdr = fake_get_hex; + self->get_rate_id = fake_get_hex; + self->get_soft_rs0 = fake_get_binary; + self->get_soft_rs1 = fake_get_binary; + self->get_info = fake_get_int; + self->get_if_type = fake_get_str; + self->get_if_speed = fake_get_str; + self->get_if_lane = fake_get_str; + self->get_curr_temp = fake_get_str; + self->get_curr_vol = fake_get_str; + self->get_soft_rx_los = fake_get_str; + self->get_soft_tx_disable = fake_get_str; + self->get_soft_tx_fault = fake_get_str; + self->get_auto_tx_disable = fake_get_str; + self->get_tx_bias = fake_get_str; + self->get_tx_power = fake_get_str; + self->get_rx_power = fake_get_str; + self->get_tx_eq = fake_get_str; + self->get_rx_am = fake_get_str; + self->get_rx_em = fake_get_str; + self->get_wavelength = fake_get_str; + self->set_cdr = fake_set_hex; + self->set_soft_rs0 = fake_set_int; + self->set_soft_rs1 = fake_set_int; + self->set_soft_tx_disable = fake_set_int; + self->set_auto_tx_disable = fake_set_int; + self->set_tx_eq = fake_set_int; + self->set_rx_am = fake_set_int; + self->set_rx_em = fake_set_int; + return 0; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return ERR_TRANSVR_UNEXCPT; +} + + +static int +setup_transvr_private_cb(struct transvr_obj_s *self, + int transvr_type){ + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + self->init = transvr_init_sfp; + self->clean = common_transvr_clean; + self->check = common_transvr_check; + self->update_all = _sfp_update_attr_all; + self->fsm_4_direct = common_fsm_4_direct_mode; + self->fsm_4_polling = common_fsm_4_polling_mode; + self->send_uevent = sfp_send_uevent; + self->dump_all = sfp_transvr_dump; + return 0; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + self->init = transvr_init_qsfp; + self->clean = qsfp_transvr_clean; + self->check = common_transvr_check; + self->update_all = _qsfp_update_attr_all; + self->fsm_4_direct = common_fsm_4_direct_mode; + self->fsm_4_polling = common_fsm_4_polling_mode; + self->send_uevent = qsfp_send_uevent; + self->dump_all = qsfp_transvr_dump; + return 0; + + case TRANSVR_TYPE_QSFP_28: + self->init = transvr_init_qsfp28; + self->clean = qsfp_transvr_clean; + self->check = common_transvr_check; + self->update_all = _qsfp_update_attr_all; + self->fsm_4_direct = common_fsm_4_direct_mode; + self->fsm_4_polling = common_fsm_4_polling_mode; + self->send_uevent = qsfp_send_uevent; + self->dump_all = qsfp_transvr_dump; + return 0; + + case TRANSVR_TYPE_FAKE: + self->init = transvr_init_fake; + self->clean = fake_transvr_clean; + self->check = fake_transvr_check; + self->update_all = fake_transvr_update; + self->fsm_4_direct = fake_fsm_4_direct_mode; + self->fsm_4_polling = fake_fsm_4_polling_mode; + self->send_uevent = fake_send_uevent; + self->dump_all = fake_transvr_dump; + return 0; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return ERR_TRANSVR_UNEXCPT; +} + + +static struct eeprom_map_s * +get_eeprom_map(int transvr_type){ + + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + return &eeprom_map_sfp; + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + return &eeprom_map_qsfp; + case TRANSVR_TYPE_QSFP_28: + return &eeprom_map_qsfp28; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return NULL; +} + + +static int +setup_transvr_ssize_attr(char *swp_name, + struct transvr_obj_s *self, + struct eeprom_map_s *map_p, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int chan_id, + int run_mode){ + switch (run_mode){ + case TRANSVR_MODE_DIRECT: /* Direct access device mode */ + case TRANSVR_MODE_POLLING: /* Polling mode, read from cache */ + self->mode = run_mode; + break; + default: + SWPS_ERR("%s: non-defined run_mode:%d\n", + __func__, run_mode); + self->mode = DEBUG_TRANSVR_INT_VAL; + return -1; + } + self->eeprom_map_p = map_p; + self->ioexp_obj_p = ioexp_obj_p; + self->ioexp_virt_offset = ioexp_virt_offset; + self->chan_id = chan_id; + self->layout = transvr_type; + self->type = transvr_type; + self->chipset_type = chipset_type; + self->state = STATE_TRANSVR_NEW; + self->info = STATE_TRANSVR_NEW; + self->auto_tx_disable = VAL_TRANSVR_FUNCTION_DISABLE; + strncpy(self->swp_name, swp_name, 32); + mutex_init(&self->lock); + return 0; +} + + +static int +setup_transvr_dsize_attr(struct transvr_obj_s *self){ + + char *emsg = DEBUG_TRANSVR_STR_VAL; + + self->vendor_name = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_name){ + emsg = "vendor_name"; + goto err_setup_d_attr; + } + self->vendor_pn = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_pn){ + emsg = "vendor_pn"; + goto err_setup_d_attr; + } + self->vendor_rev = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_rev){ + emsg = "vendor_rev"; + goto err_setup_d_attr; + } + self->vendor_sn = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_sn){ + emsg = "vendor_sn"; + goto err_setup_d_attr; + } + self->worker_p = NULL; + return 0; + +err_setup_d_attr: + SWPS_ERR("%s: %s kzalloc fail!", __func__, emsg); + return ERR_TRANSVR_UNEXCPT; +} + + +static int +setup_i2c_client(struct transvr_obj_s *self){ + + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + adap = i2c_get_adapter(self->chan_id); + if(!adap){ + snprintf(err_msg, sizeof(err_msg), + "can not get adap:%d", self->chan_id); + goto err_setup_i2c_client; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + snprintf(err_msg, sizeof(err_msg), + "can not kzalloc client:%d", self->chan_id); + goto err_setup_i2c_client; + } + client->adapter = adap; + self->i2c_client_p = client; + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + return 0; + +err_setup_i2c_client: + SWPS_ERR("%s: %s\n", __func__, err_msg); + return ERR_TRANSVR_UNEXCPT; +} + + +struct transvr_obj_s * +create_transvr_obj(char *swp_name, + int chan_id, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int run_mode){ + + struct transvr_obj_s *result_p; + struct eeprom_map_s *map_p; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Allocate transceiver object */ + map_p = get_eeprom_map(transvr_type); + if (!map_p){ + snprintf(err_msg, sizeof(err_msg), + "Invalid transvr_type:%d", transvr_type); + goto err_create_transvr_fail; + } + result_p = kzalloc(sizeof(*result_p), GFP_KERNEL); + if (!result_p){ + snprintf(err_msg, sizeof(err_msg), "kzalloc fail"); + goto err_create_transvr_fail; + } + /* Prepare static size attributes */ + if (setup_transvr_ssize_attr(swp_name, + result_p, + map_p, + ioexp_obj_p, + ioexp_virt_offset, + transvr_type, + chipset_type, + chan_id, + run_mode) < 0){ + goto err_create_transvr_sattr_fail; + } + /* Prepare dynamic size attributes */ + if (setup_transvr_dsize_attr(result_p) < 0){ + goto err_create_transvr_dattr_fail; + } + /* Prepare call back functions of object */ + if (setup_transvr_public_cb(result_p, transvr_type) < 0){ + goto err_create_transvr_dattr_fail; + } + /* Prepare call back functions of object */ + if (setup_transvr_private_cb(result_p, transvr_type) < 0){ + goto err_create_transvr_dattr_fail; + } + /* Prepare i2c client object */ + if (setup_i2c_client(result_p) < 0){ + goto err_create_transvr_dattr_fail; + } + return result_p; + +err_create_transvr_dattr_fail: + kfree(result_p->vendor_sn); + kfree(result_p->vendor_rev); + kfree(result_p->vendor_pn); + kfree(result_p->vendor_name); +err_create_transvr_sattr_fail: + kfree(result_p); +err_create_transvr_fail: + SWPS_ERR("%s: %s :%d :%d :%d\n", + __func__, err_msg, chan_id, ioexp_virt_offset, transvr_type); + return NULL; +} + + +static int +_reload_transvr_obj(struct transvr_obj_s *self, + int new_type){ + + struct eeprom_map_s *new_map_p; + struct eeprom_map_s *old_map_p = self->eeprom_map_p; + struct i2c_client *old_i2c_p = self->i2c_client_p; + int old_type = self->type; + + /* Change state to STATE_TRANSVR_INIT */ + self->state = STATE_TRANSVR_INIT; + self->type = new_type; + /* Replace EEPROME map */ + new_map_p = get_eeprom_map(new_type); + if (!new_map_p){ + goto err_private_reload_func_1; + } + self->eeprom_map_p = new_map_p; + /* Reload i2c client */ + if (setup_i2c_client(self) < 0){ + goto err_private_reload_func_2; + } + /* Replace call back functions */ + if (setup_transvr_public_cb(self, new_type) < 0){ + goto err_private_reload_func_3; + } + if (setup_transvr_private_cb(self, new_type) < 0){ + goto err_private_reload_func_3; + } + kfree(old_i2c_p); + return 0; + +err_private_reload_func_3: + SWPS_INFO("%s: init() fail!\n", __func__); + kfree(old_i2c_p); + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = TRANSVR_TYPE_ERROR; + return -2; + +err_private_reload_func_2: + self->eeprom_map_p = old_map_p; + self->i2c_client_p = old_i2c_p; +err_private_reload_func_1: + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = old_type; + SWPS_INFO("%s fail! :0x%02x\n", __func__, new_type); + return -1; +} + + +static int +reload_transvr_obj(struct transvr_obj_s *self, + int new_type){ + + int result_val = ERR_TRANSVR_UNEXCPT; + + /* Reload phase */ + result_val = _reload_transvr_obj(self, new_type); + if (result_val < 0){ + SWPS_INFO("%s: reload phase fail! :%d\n", + __func__, result_val); + return EVENT_TRANSVR_RELOAD_FAIL; + } + /* Initial phase */ + result_val = _transvr_init_handler(self); + if (result_val < 0){ + SWPS_INFO("%s: initial phase fail! :%d\n", + __func__, result_val); + } + return result_val; +} + + +int +isolate_transvr_obj(struct transvr_obj_s *self) { + + self->state = STATE_TRANSVR_ISOLATED; + SWPS_INFO("%s: %s be isolated\n", __func__, self->swp_name); + return 0; +} + + +int +resync_channel_tier_2(struct transvr_obj_s *self) { + + int val = TRANSVR_TYPE_ERROR; + + if (self->state == STATE_TRANSVR_ISOLATED) { + return 0; + } + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + val = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + if (val < 0) { + return -1; + } + return 0; +} + + +/* ----------------------------------------- + * ToDo List + * ----------------------------------------- + * 1. _sfp_detect_class_by_feature() + * => Need check ACC use case. + * 2. _sfp_detect_class_by_1g_ethernet() + * => Need check 0.1G use case. + * 3. Loopback transceiver use case. + * => Less much data + * 4. _qsfp_detect_class_by_extend_comp() + * => Verify 100G CWDM4 + * => Verify Obsolete (assigned before 100G CWDM4 MSA required FEC) + * => Verify 100G CLR4 + * => Verify 100GE-DWDM2 + * => Verify 40G PSM4 Parallel SMF + * => Verify 100G ACC (Active Copper Cable) or 25GAUI C2M ACC. + * => Verify 100G ACC or 25GAUI C2M ACC. + * => Verify 25GBASE-LR + * => Verify 40G Active Cable (XLPPI) + */ + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/transceiver.h b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/transceiver.h new file mode 100644 index 000000000000..ddd22c38caf0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/transceiver.h @@ -0,0 +1,792 @@ +#ifndef TRANSCEIVER_H +#define TRANSCEIVER_H + +#include + +/* advanced features control */ +#define TRANSVR_INFO_DUMP_ENABLE (1) +#define TRANSVR_INFO_CACHE_ENABLE (1) +#define TRANSVR_UEVENT_ENABLE (1) + +/* Transceiver type define */ +#define TRANSVR_TYPE_UNKNOW_1 (0x00) +#define TRANSVR_TYPE_UNKNOW_2 (0xff) +#define TRANSVR_TYPE_SFP (0x03) /* Define for SFP, SFP+, SFP28 */ +#define TRANSVR_TYPE_QSFP (0x0c) +#define TRANSVR_TYPE_QSFP_PLUS (0x0d) +#define TRANSVR_TYPE_QSFP_28 (0x11) +#define TRANSVR_TYPE_UNPLUGGED (0xfa) /* Define for ERROR handle */ +#define TRANSVR_TYPE_FAKE (0xfc) /* Define for ERROR handle */ +#define TRANSVR_TYPE_INCONSISTENT (0xfd) /* Define for ERROR handle */ +#define TRANSVR_TYPE_ERROR (0xfe) /* Define for ERROR handle */ + +/* Transceiver class for base info */ +#define TRANSVR_CLASS_UNSPECIFIED (0) +#define TRANSVR_CLASS_ERROR (-26001) +#define TRANSVR_CLASS_1G (26001) +#define TRANSVR_CLASS_10G (26011) +#define TRANSVR_CLASS_25G (26021) +#define TRANSVR_CLASS_40G (26041) +#define TRANSVR_CLASS_100G (26101) +#define TRANSVR_CLASS_NO_SPERARABLE (26901) +#define TRANSVR_CLASS_EXTEND_COMP (26902) +/* Transceiver class for Optical 1G */ +#define TRANSVR_CLASS_OPTICAL (27000) +#define TRANSVR_CLASS_OPTICAL_100 (27001) +#define TRANSVR_CLASS_OPTICAL_1G (27002) +#define TRANSVR_CLASS_OPTICAL_1G_AOC (27003) +#define TRANSVR_CLASS_OPTICAL_1G_SX (27004) +#define TRANSVR_CLASS_OPTICAL_1G_LX (27005) +#define TRANSVR_CLASS_OPTICAL_1G_EX (27006) +/* Transceiver class for Optical 10G */ +#define TRANSVR_CLASS_OPTICAL_10G (27010) +#define TRANSVR_CLASS_OPTICAL_10G_S_AOC (27011) +#define TRANSVR_CLASS_OPTICAL_10G_S_SR (27012) +#define TRANSVR_CLASS_OPTICAL_10G_S_LR (27013) +#define TRANSVR_CLASS_OPTICAL_10G_S_ER (27014) +#define TRANSVR_CLASS_OPTICAL_10G_Q_AOC (27015) +#define TRANSVR_CLASS_OPTICAL_10G_Q_SR (27016) +#define TRANSVR_CLASS_OPTICAL_10G_Q_LR (27017) +#define TRANSVR_CLASS_OPTICAL_10G_Q_ER (27018) +/* Transceiver class for Optical 25G */ +#define TRANSVR_CLASS_OPTICAL_25G (27020) +#define TRANSVR_CLASS_OPTICAL_25G_AOC (27021) +#define TRANSVR_CLASS_OPTICAL_25G_SR (27022) +#define TRANSVR_CLASS_OPTICAL_25G_LR (27023) +#define TRANSVR_CLASS_OPTICAL_25G_ER (27024) +/* Transceiver class for Optical 40G */ +#define TRANSVR_CLASS_OPTICAL_40G (27040) +#define TRANSVR_CLASS_OPTICAL_40G_AOC (27041) +#define TRANSVR_CLASS_OPTICAL_40G_SR4 (27042) +#define TRANSVR_CLASS_OPTICAL_40G_LR4 (27043) +#define TRANSVR_CLASS_OPTICAL_40G_ER4 (27044) +/* Transceiver class for Optical 100G */ +#define TRANSVR_CLASS_OPTICAL_100G (27100) +#define TRANSVR_CLASS_OPTICAL_100G_AOC (27101) +#define TRANSVR_CLASS_OPTICAL_100G_SR4 (27102) +#define TRANSVR_CLASS_OPTICAL_100G_LR4 (27103) +#define TRANSVR_CLASS_OPTICAL_100G_ER4 (27104) +#define TRANSVR_CLASS_OPTICAL_100G_PSM4 (27105) +/* Transceiver class for Copper */ +#define TRANSVR_CLASS_COPPER (28000) +#define TRANSVR_CLASS_COPPER_L1_1G (28001) +#define TRANSVR_CLASS_COPPER_L1_10G (28011) +#define TRANSVR_CLASS_COPPER_L4_10G (28012) +#define TRANSVR_CLASS_COPPER_L1_25G (28021) +#define TRANSVR_CLASS_COPPER_L4_40G (28041) +#define TRANSVR_CLASS_COPPER_L4_100G (28101) +/* Transceiver class for Base-T */ +#define TRANSVR_CLASS_BASE_T_1000 (29001) +#define TRANSVR_CLASS_BASE_T_1000_up (29002) +/* For uevent message */ +#define TRANSVR_UEVENT_KEY_IF "IF_TYPE" +#define TRANSVR_UEVENT_KEY_SP "IF_SPEED" +#define TRANSVR_UEVENT_KEY_LANE "IF_LANE" +#define TRANSVR_UEVENT_UNKNOW "UNKNOW" +#define TRANSVR_IF_KR "KR" +#define TRANSVR_IF_KR4 "KR4" +#define TRANSVR_IF_SR "SR" +#define TRANSVR_IF_SR4 "SR4" +#define TRANSVR_IF_SFI "SFI" +#define TRANSVR_IF_IF_GMII "GMII" +#define TRANSVR_IF_IF_XGMII "XGMII" +#define TRANSVR_IF_SP_100 "100" +#define TRANSVR_IF_SP_1G "1000" +#define TRANSVR_IF_SP_10G "10000" +#define TRANSVR_IF_SP_25G "25000" +#define TRANSVR_IF_SP_40G "40000" +#define TRANSVR_IF_SP_100G "100000" + +/* Transceiver mode define */ +#define TRANSVR_MODE_DIRECT (21000) +#define TRANSVR_MODE_POLLING (21001) + +/* Transceiver state define + * [Note] + * 1. State is used to represent the state of "Transceiver" and "Object". + * 2. State for different target has different means. The description as following: + */ +#define STATE_TRANSVR_CONNECTED (0) /* [Transvr]:Be plugged in. [Obj]:Link up, and work normally. */ +#define STATE_TRANSVR_NEW (-100) /* [Transvr]:(Not used) [Obj]:Create */ +#define STATE_TRANSVR_INIT (-101) /* [Transvr]:Be plugged in. [Obj]:Link up, and in initial process. */ +#define STATE_TRANSVR_ISOLATED (-102) /* [Transvr]:Be plugged in. [Obj]:Isolate, and not provide service. */ +#define STATE_TRANSVR_SWAPPED (-200) /* [Transvr]:Be plugged in. [Obj]:(Not used) */ +#define STATE_TRANSVR_DISCONNECTED (-300) /* [Transvr]:Un-plugged. [Obj]:Link down, and not provide service. */ +#define STATE_TRANSVR_UNEXCEPTED (-901) /* [Transvr]:Any [Obj]:Any, and not in expect case. */ + +/* Task state define */ +#define STATE_T_TASK_WAIT (110) +#define STATE_T_TASK_DONE (0) +#define STATE_T_TASK_INIT (-110) +#define STATE_T_TASK_FAIL (-410) + + +/* Event for task handling */ +#define EVENT_TRANSVR_TASK_WAIT (2101) +#define EVENT_TRANSVR_TASK_DONE (0) +#define EVENT_TRANSVR_TASK_FAIL (-2101) +/* Event for initial handling */ +#define EVENT_TRANSVR_INIT_UP (2201) +#define EVENT_TRANSVR_INIT_DOWN (1) +#define EVENT_TRANSVR_INIT_REINIT (-2201) +#define EVENT_TRANSVR_INIT_FAIL (-2202) +/* Event for others */ +#define EVENT_TRANSVR_RELOAD_FAIL (-2301) +#define EVENT_TRANSVR_EXCEP_INIT (-2401) +#define EVENT_TRANSVR_EXCEP_UP (-2402) +#define EVENT_TRANSVR_EXCEP_DOWN (-2403) +#define EVENT_TRANSVR_EXCEP_SWAP (-2404) +#define EVENT_TRANSVR_EXCEP_EXCEP (-2405) +#define EVENT_TRANSVR_EXCEP_ISOLATED (-2406) +#define EVENT_TRANSVR_I2C_CRASH (-2501) + +/* Transceiver error code define */ +#define ERR_TRANSVR_UNINIT (-201) +#define ERR_TRANSVR_UNPLUGGED (-202) +#define ERR_TRANSVR_ABNORMAL (-203) +#define ERR_TRANSVR_NOSTATE (-204) +#define ERR_TRANSVR_NOTSUPPORT (-205) +#define ERR_TRANSVR_BADINPUT (-206) +#define ERR_TRANSVR_UPDATE_FAIL (-207) +#define ERR_TRANSVR_RELOAD_FAIL (-208) +#define ERR_TRANSVR_INIT_FAIL (-209) +#define ERR_TRANSVR_UNDEFINED (-210) +#define ERR_TRANSVR_TASK_FAIL (-211) +#define ERR_TRANSVR_TASK_BUSY (-212) +#define ERR_TRANSVR_UEVENT_FAIL (-213) +#define ERR_TRANSVR_FUNC_DISABLE (-214) +#define ERR_TRANSVR_I2C_CRASH (-297) +#define ERR_TRNASVR_BE_ISOLATED (-298) +#define ERR_TRANSVR_UNEXCPT (-299) + +/* For debug */ +#define DEBUG_TRANSVR_INT_VAL (-99) +#define DEBUG_TRANSVR_HEX_VAL (0xfe) +#define DEBUG_TRANSVR_STR_VAL "ERROR" + +/* For system internal */ +#define VAL_TRANSVR_COMID_ARREESS (0x50) +#define VAL_TRANSVR_COMID_OFFSET (0x00) +#define VAL_TRANSVR_8472_READY_ADDR (0x51) +#define VAL_TRANSVR_8472_READY_PAGE (-1) +#define VAL_TRANSVR_8472_READY_OFFSET (110) +#define VAL_TRANSVR_8472_READY_BIT (0) +#define VAL_TRANSVR_8472_READY_VALUE (0) +#define VAL_TRANSVR_8472_READY_ABNORMAL (0xff) +#define VAL_TRANSVR_8436_READY_ADDR (0x50) +#define VAL_TRANSVR_8436_READY_PAGE (-1) +#define VAL_TRANSVR_8436_READY_OFFSET (2) +#define VAL_TRANSVR_8436_READY_BIT (0) +#define VAL_TRANSVR_8436_READY_VALUE (0) +#define VAL_TRANSVR_8436_READY_ABNORMAL (0xff) +#define VAL_TRANSVR_8436_PWD_ADDR (0x50) +#define VAL_TRANSVR_8436_PWD_PAGE (-1) +#define VAL_TRANSVR_8436_PWD_OFFSET (123) +#define VAL_TRANSVR_PAGE_FREE (-99) +#define VAL_TRANSVR_PAGE_SELECT_OFFSET (127) +#define VAL_TRANSVR_PAGE_SELECT_DELAY (5) +#define VAL_TRANSVR_TASK_RETRY_FOREVER (-999) +#define VAL_TRANSVR_FUNCTION_DISABLE (-1) +#define STR_TRANSVR_SFP "SFP" +#define STR_TRANSVR_QSFP "QSFP" +#define STR_TRANSVR_QSFP_PLUS "QSFP+" +#define STR_TRANSVR_QSFP28 "QSFP28" + +/* For transvr buf len */ +#define LEN_TRANSVR_S_STR (16) +#define LEN_TRANSVR_M_STR (32) +#define LEN_TRANSVR_L_STR (64) + +/* Optical wavelength */ +#define VAL_OPTICAL_WAVELENGTH_SR (850) +#define VAL_OPTICAL_WAVELENGTH_LR (1310) +#define VAL_OPTICAL_WAVELENGTH_ER (1550) + +/* BCM chip type define */ +#define BCM_CHIP_TYPE_TRIDENT_2 (31001) /* Magnolia, Hudson32i, Spruce */ +#define BCM_CHIP_TYPE_TOMAHAWK (31002) /* Redwood, Cypress */ + +/* Info from transceiver EEPROM */ +struct eeprom_map_s { + int addr_br; int page_br; int offset_br; int length_br; + int addr_cdr; int page_cdr; int offset_cdr; int length_cdr; + int addr_comp_rev; int page_comp_rev; int offset_comp_rev; int length_comp_rev; + int addr_connector; int page_connector; int offset_connector; int length_connector; + int addr_diag_type; int page_diag_type; int offset_diag_type; int length_diag_type; + int addr_extbr; int page_extbr; int offset_extbr; int length_extbr; + int addr_ext_id; int page_ext_id; int offset_ext_id; int length_ext_id; + int addr_id; int page_id; int offset_id; int length_id; + int addr_len_sm; int page_len_sm; int offset_len_sm; int length_len_sm; + int addr_len_smf; int page_len_smf; int offset_len_smf; int length_len_smf; + int addr_len_om1; int page_len_om1; int offset_len_om1; int length_len_om1; + int addr_len_om2; int page_len_om2; int offset_len_om2; int length_len_om2; + int addr_len_om3; int page_len_om3; int offset_len_om3; int length_len_om3; + int addr_len_om4; int page_len_om4; int offset_len_om4; int length_len_om4; + int addr_option; int page_option; int offset_option; int length_option; + int addr_rate_id; int page_rate_id; int offset_rate_id; int length_rate_id; + int addr_rx_am; int page_rx_am; int offset_rx_am; int length_rx_am; + int addr_rx_em; int page_rx_em; int offset_rx_em; int length_rx_em; + int addr_rx_los; int page_rx_los; int offset_rx_los; int length_rx_los; + int addr_rx_power; int page_rx_power; int offset_rx_power; int length_rx_power; + int addr_soft_rs0; int page_soft_rs0; int offset_soft_rs0; int length_soft_rs0; + int addr_soft_rs1; int page_soft_rs1; int offset_soft_rs1; int length_soft_rs1; + int addr_temp; int page_temp; int offset_temp; int length_temp; + int addr_trancomp; int page_trancomp; int offset_trancomp; int length_trancomp; + int addr_trancomp_ext; int page_trancomp_ext; int offset_trancomp_ext; int length_trancomp_ext; + int addr_tx_bias; int page_tx_bias; int offset_tx_bias; int length_tx_bias; + int addr_tx_disable; int page_tx_disable; int offset_tx_disable; int length_tx_disable; + int addr_tx_eq; int page_tx_eq; int offset_tx_eq; int length_tx_eq; + int addr_tx_fault; int page_tx_fault; int offset_tx_fault; int length_tx_fault; + int addr_tx_power; int page_tx_power; int offset_tx_power; int length_tx_power; + int addr_vendor_name; int page_vendor_name; int offset_vendor_name; int length_vendor_name; + int addr_vendor_pn; int page_vendor_pn; int offset_vendor_pn; int length_vendor_pn; + int addr_vendor_rev; int page_vendor_rev; int offset_vendor_rev; int length_vendor_rev; + int addr_vendor_sn; int page_vendor_sn; int offset_vendor_sn; int length_vendor_sn; + int addr_voltage; int page_voltage; int offset_voltage; int length_voltage; + int addr_wavelength; int page_wavelength; int offset_wavelength; int length_wavelength; +}; + + +struct transvr_worker_s; + +/* Class of transceiver object */ +struct transvr_obj_s { + + /* ========== Object private property ========== + * [Prop]: id + * [Desc]: Type of serial transceiver. + * [Note]: SFP:03h / QSFP:0Ch / QSPF+:0Dh /QSFP28:11h + */ + uint8_t id; + + /* [Prop]: connector + * [Desc]: Connector type. + * [Note]: SFP : A0h / 2 + * QSFP: 00h / 130 + */ + uint8_t connector; + + /* [Prop]: transvr_comp + * [Desc]: Transceiver compliance code. + * [Note]: SFP: SFF-8472 + * - Normal : A0h / offset 3-10 + * - Extended: A0h / offset 36 + * QSFP: SFF-8436 & SFF-8636 + * - Normal : 00h / offset 131-138 + * - Extended: 00h / offset 192 + */ + uint8_t transvr_comp[8]; + uint8_t transvr_comp_ext; + + /* [Prop]: vendor_name + * [Desc]: SFP vendor name (ASCII 16 byte char). + * [Note]: ex:FINISAR CORP. + */ + char *vendor_name; + + /* [Prop]: vendor_pn + * [Desc]: Part number provided by SFP vendor (ASCII 16 byte char). + * [Note]: + */ + char *vendor_pn; + + /* [Prop]: vendor_rev + * [Desc]: Revision level for part number provided by vendor (ASCII 4 byte char). + * [Note]: + */ + char *vendor_rev; + + /* [Prop]: vendor_sn + * [Desc]: Serial number provided by vendor (ASCII 16 byte char). + * [Note]: + */ + char *vendor_sn; + + /* [Prop]: Extended identifier + * [Desc]: SFP: + * => None + * + * QSFP: + * => This byte contained two information: + * (1) Power consumption class + * (2) CDR function present + * [Note]: Bit description as below: + * [SFP] + * None + * + * [QSFP] + * (1) Power consumption class: + * Class 1: 1.5W (Bit6-7 = 00:) + * Class 2: 2.0W (Bit6-7 = 01:) + * Class 3: 2.5W (Bit6-7 = 10:) + * Class 4: 3.5W (Bit6-7 = 11:) + * Class 5: 4.0W (Bit0-1 = 01:) + * Class 6: 4.5W (Bit0-1 = 10:) + * Class 7: 5.0W (Bit0-1 = 11:) + * (2) CDR function present: + * Bit2: 0 = No CDR in RX + * 1 = CDR present in RX + * Bit3: 0 = No CDR in TX + * 1 = CDR present in TX + */ + uint8_t ext_id; + + /* [Prop]: br + * [Desc]: Nominal bit rate, units of 100 MBits/sec. + * [Note]: SFP:03h / QSFP:0Ch / QSPF+:0Dh + * has val: 0x67 + * no val : + */ + uint8_t br; + + /* [Prop]: extbr + * [Desc]: Extended br (00h/222) + * [Desc]: Nominal bit rate per channel, units of 250 Mbps. + * Complements. Byte 140. See Table 32A. + */ + uint8_t extbr; + + /* [Prop]: len_sm + * [Desc]: Length (single mode)-(100's)m + * [Note]: This value specifies the link length that is supported by the transceiver + * while operating in compliance with the applicable standards using single mode + * fiber. The value is in units of 100 meters. A value of 255 means that the + * transceiver supports a link length greater than 25.4 km. A value of zero means + * that the transceiver does not support single mode fiber or that the length + * information must be determined from the transceiver technology. + */ + int len_sm; + + /* [Prop]: len_smf + * [Desc]: Length (single mode)-km + * [Note]: Addition to EEPROM data from original GBIC definition. This value specifies + * the link length that is supported by the transceiver while operating in + * compliance with the applicable standards using single mode fiber. The value + * is in units of kilometers. A value of 255 means that the transceiver supports + * a link length greater than 254 km. A value of zero means that the transceiver + * does not support single mode fiber or that the length information must be + * determined from the transceiver technology. + */ + int len_smf; + + /* [Prop]: len_om1 + * [Desc]: Link length supported for 62.5 um OM1 fiber, units of 10 m + * [Note]: The value is in units of 10 meters. A value of 255 means that the + * transceiver supports a link length greater than 2.54 km. A value of + * zero means that the transceiver does not support 50 micron multi-mode + * fiber or that the length information must be determined from the transceiver + * technology. + */ + int len_om1; + + /* [Prop]: len_om2 + * [Desc]: Link length supported for 50 um OM2 fiber, units of 10 m + * [Note]: The value is in units of 10 meters. A value of 255 means that the + * transceiver supports a link length greater than 2.54 km. A value of + * zero means that the transceiver does not support 50 micron multi-mode + * fiber or that the length information must be determined from the transceiver + * technology. + */ + int len_om2; + + /* [Prop]: len_om3 + * [Desc]: Length (50um, OM3) + * [Note]: This value specifies link length that is supported by the transceiver while + * operating in compliance with applicable standards using 50 micron multimode + * OM3 [2000 MHz*km] fiber. The value is in units of 10 meters. A value of 255 + * means that the transceiver supports a link length greater than 2.54 km. A value + * of zero means that the transceiver does not support 50 micron multimode fiber + * or that the length information must be determined from the transceiver technology. + */ + int len_om3; + + /* [Prop]: len_om4 + * [Desc]: Length (50um, OM4) and Length (Active Cable or Copper) + * [Note]: For optical links, this value specifies link length that is supported by the + * transceiver while operating in compliance with applicable standards using 50 micron + * multimode OM4 [4700 MHz*km] fiber. The value is in units of 10 meters. A value of + * 255 means that the transceiver supports a link length greater than 2.54 km. A value + * of zero means that the transceiver does not support 50 micron multimode fiber or that + * the length information must be determined from the transceiver codes specified in Table 5-3. + * + * For copper links, this value specifies minimum link length supported by the transceiver + * while operating in compliance with applicable standards using copper cable. For active + * cable, this value represents actual length. The value is in units of 1 meter. A value of 255 + * means the transceiver supports a link length greater than 254 meters. A value of zero means + * the transceiver does not support copper or active cables or the length information must be + * determined from transceiver technology. Further information about cable design, equalization, + * and connectors is usually required to guarantee meeting a particular length requirement. + */ + int len_om4; + + /* [Prop]: comp_rev + * [Desc]: SFF spec revision compliance + * [Note]: Indicates which revision of SFF SFF-8472 (SFP) / SFF-8636 (QSFP) the transceiver + * complies with. (unsigned integer) + */ + uint8_t comp_rev; + + /* [Prop]: CDR + * [Desc]: For transceivers with CDR capability, setting the CDR to ON engages the internal + * retiming function. Setting the CDR to OFF enables an internal bypassing mode ,which + * directs traffic around the internal CDR. (Reference: SFF-8636) + * [Note]: value=0xff: ON. + * value=0x00: OFF. + */ + uint8_t cdr; + + /* [Prop]: rate_id + * [Desc]: Soft Rate Select 0(RX). + * [Note]: 1. Addr: A0h / Offset: 13 + * 2. Value description: + * 00h Unspecified + * 01h SFF-8079 (4/2/1G Rate_Select & AS0/AS1) + * 02h SFF-8431 (8/4/2G Rx Rate_Select only) + * 03h Unspecified * + * 04h SFF-8431 (8/4/2G Tx Rate_Select only) + * 05h Unspecified * + * 06h SFF-8431 (8/4/2G Independent Rx & Tx Rate_select) + * 07h Unspecified * + * 08h FC-PI-5 (16/8/4G Rx Rate_select only) High=16G only, Low=8G/4G + * 09h Unspecified * + * 0Ah FC-PI-5 (16/8/4G Independent Rx, Tx Rate_select) High=16G only, + * Low=8G/4G + * 0Bh Unspecified * + * 0Ch FC-PI-6 (32/16/8G Independent Rx, Tx Rate_Select) + * High=32G only, Low = 16G/8G + * 0Dh Unspecified * + * 0Eh 10/8G Rx and Tx Rate_Select controlling the operation or locking + * modes of the internal signal conditioner, retimer or CDR, according + * to the logic table defined in Table 10-2, High Bit Rate + * (10G) =9.95-11.3 Gb/s; Low Bit Rate (8G) = 8.5 Gb/s. In this mode, + * the default value of bit 110.3 (Soft Rate Select RS(0), Table 9-11) + * and of bit 118.3 (Soft Rate Select RS(1), Table 10-1) is 1. + * 0Fh Unspecified * + * 10h-FFh Unallocated + */ + int rate_id; + + /* [Prop]: soft_rs0 + * [Desc]: Soft Rate Select 0(RX). + * [Note]: 1. Writing '1' selects full bandwidth operation. + * 2. This bit is "OR'd with the hard Rate_Select, AS(0) or RS(0) pin value. + * 3. Default at power up is logic zero/low + * 4. Addr: A2h / Offset: 110 / Bit: 3 + */ + uint8_t soft_rs0; + + /* [Prop]: soft_rs1 + * [Desc]: Soft Rate Select 1(TX). + * [Note]: 1. Writing '1' selects full bandwidth TX operation. + * 2. This bit is "OR'd with the hard Rate_Select, AS(1) or RS(1) pin value. + * 3. Default at power up is logic zero/low + * 4. Addr: A2h / Offset: 118 / Bit: 3 + */ + uint8_t soft_rs1; + + /* [Prop]: diag_type + * [Desc]: DIAGNOSTIC MONITORING TYPE (A0h/92) + * [Note]: Description in SFF-8472 as below: + * Bit7: Reserved for legacy diagnostic implementations. Must be '0' for compliance + * with this document. + * Bit6: Digital diagnostic monitoring implemented (described in this document). + * Must be '1' for compliance with this document. + * Bit5 Internally calibrated + * Bit4 Externally calibrated + * Bit3 Received power measurement type.0 = OMA, 1 = average power + * Bit2 Address change required see section above, "addressing modes" + * Bit1-0 Unallocated + */ + uint8_t diag_type; + + /* [Prop]: curr_temp + * [Desc]: Transceiver Current Temperature (A2h/96-97) + * [Note]: 1. Dependent on diag_type. + * 2. 96: High byte + * 3. 97: Low byte + * 4. This feature only for SFP + */ + uint8_t curr_temp[2]; + + /* [Prop]: curr_vol + * [Desc]: Transceiver Current Voltage (SFP:A2h/108-109; QSFP:00h/22-23) + * [Note]: 1. Dependent on diag_type. + * 2. 98: High byte + * 3. 99: Low byte + * 4. This feature only for SFP + * 5. Internally measured transceiver supply voltage. Represented + * as a 16 bit unsigned integer with the voltage defined as the + * full 16 bit value (0-65535) with LSB equal to 100 uVolt, + * yielding a total range of 0 to +6.55 Volts + */ + uint8_t curr_voltage[2]; + + /* [Prop]: curr_tx_bias + * [Desc]: Transceiver TX Bias Current (SFP:A2h/100-101; QSFP:00h/26-27) + * [Note]: 1. Dependent on diag_type. + * 2. 100: High byte + * 3. 101: Low byte + * 4. This feature only for SFP + * 5. Measured TX bias current in uA. Represented as a 16 bit unsigned + * integer with the current defined as the full 16 bit value (0-65535) + * with LSB equal to 2 uA, yielding a total range of 0 to 131 mA. + * Accuracy is vendor specific but must be better than 10% of the + * manufacturer's nominal value over specified operating temperature + * and voltage. + */ + uint8_t curr_tx_bias[8]; + + /* [Prop]: curr_tx_power + * [Desc]: Transceiver TX Output Power (A2h/102-103) + * [Note]: 1. Dependent on diag_type. + * 2. 102: High byte + * 3. 103: Low byte + * 4. This feature only for SFP + * 5. Measured TX output power in mW. Represented as a 16 bit unsigned + * integer with the power defined as the full 16 bit value (0-65535) + * with LSB equal to 0.1 uW, yielding a total range of 0 to 6.5535 mW + * (~ -40 to +8.2 dBm). Data is assumed to be based on measurement of + * laser monitor photodiode current. It is factory calibrated to absolute + * units using the most representative fiber output type. Accuracy is + * vendor specific but must be better than 3dB over specified temperature + * and voltage. Data is not valid when the transmitter is disabled. + */ + uint8_t curr_tx_power[8]; + + /* [Prop]: curr_tx_power + * [Desc]: Transceiver TX Output Power (A2h/102-103) + * [Note]: 1. Dependent on diag_type. + * 2. 102: High byte + * 3. 103: Low byte + * 4. This feature only for SFP + * 5. Measured RX received optical power in mW. Value can represent either + * average received power or OMA depending upon how bit 3 of byte 92 (A0h) + * is set. Represented as a 16 bit unsigned integer with the power defined + * as the full 16 bit value (0-65535) with LSB equal to 0.1 uW, yielding a + * total range of 0 to 6.5535 mW (~ -40 to +8.2 dBm). Absolute accuracy is + * dependent upon the exact optical wavelength. For the vendor specified + * wavelength, accuracy shall be better than 3dB over specified temperature + * and voltage. + */ + uint8_t curr_rx_power[8]; + + /* [Prop]: wavelength + * [Desc]: Wavelength or Copper Cable Attenuation + * [Note]: (Following is info from SFF-8636) + * For optical free side devices, this parameter identifies the nominal + * transmitter output wavelength at room temperature. This parameter is a + * 16-bit hex value with Byte 186 as high order byte and Byte 187 as low + * order byte. The laser wavelength is equal to the 16-bit integer value + * divided by 20 in nm (units of 0.05 nm). This resolution should be adequate + * to cover all relevant wavelengths yet provide enough resolution for all + * expected DWDM applications. For accurate representation of controlled + * wavelength applications, this value should represent the center of the + * guaranteed wavelength range. If the free side device is identified as + * copper cable these registers will be used to define the cable attenuation. + * An indication of 0 dB attenuation refers to the case where the attenuation + * is not known or is unavailable. + * Byte 186 (00-FFh) is the copper cable attenuation at 2.5 GHz in units of 1 dB. + * Byte 187 (00-FFh) is the copper cable attenuation at 5.0 GHz in units of 1 dB. + */ + uint8_t wavelength[2]; + + /* [Prop]: Amplitude control + * [Desc]: Amplitude control + * [Note]: QSFP28 => SFF-8636 03H Byte-238/239 + */ + uint8_t rx_am[2]; + + /* [Prop]: Emphasis control + * [Desc]: Emphasis control + * [Note]: SFP+/28 => SFF-8472 A2H Byte-115 + * QSFP28 => SFF-8636 03H Byte-236/237 + */ + uint8_t rx_em[2]; + + /* [Prop]: Soft Rx LOS + * [Desc]: Soft Rx LOS which provide by transceiver + * [Note]: (Following is info from SFF-8636) + * Byte 3: + * - Bit 0: L-Rx1 LOS + * - Bit 1: L-Rx2 LOS + * - Bit 2: L-Rx3 LOS + * - Bit 3: L-Rx4 LOS + */ + uint8_t rx_los; + + /* [Prop]: Soft Tx Disable + * [Desc]: Soft Tx Disable which provide by transceiver + * [Note]: (Following is info from SFF-8636) + * Byte 86: + * - Bit 0: Tx1 Disable + * - Bit 1: Tx2 Disable + * - Bit 2: Tx3 Disable + * - Bit 3: Tx4 Disable + */ + uint8_t tx_disable; + + /* [Prop]: Soft Tx Fault + * [Desc]: Soft Tx Fault which provide by transceiver + * [Note]: (Following is info from SFF-8636) + * Byte 86: + * - Bit 0: Tx1 Fault + * - Bit 1: Tx2 Fault + * - Bit 2: Tx3 Fault + * - Bit 3: Tx4 Fault + */ + uint8_t tx_fault; + + /* [Prop]: Transceiver EQUALIZATION + * [Desc]: Transceiver EQUALIZATION + * [Note]: SFP+/28 => SFF-8472 A2H Byte-114 + * QSFP28 => SFF-8636 03H Byte-234/235 + */ + uint8_t tx_eq[2]; + + /* [Prop]: OPTION VALUES + * [Desc]: The bits in the option field shall specify the options implemented in the transceiver. + * [Note]: SFP+/28 => SFF-8472 A0H Byte-64/65 + * QSFP+/28 => SFF-8636 00H Byte-193/195 + */ + uint8_t option[3]; + + + /* ========== Object private property ========== + */ + struct device *transvr_dev_p; + struct eeprom_map_s *eeprom_map_p; + struct i2c_client *i2c_client_p; + struct ioexp_obj_s *ioexp_obj_p; + struct transvr_worker_s *worker_p; + struct mutex lock; + char swp_name[32]; + int auto_config; + int auto_tx_disable; + int chan_id; + int chipset_type; + int curr_page; + int info; + int ioexp_virt_offset; + int lane_id[8]; + int layout; + int mode; + int retry; + int state; + int temp; + int type; + + /* ========== Object public functions ========== + */ + int (*get_id)(struct transvr_obj_s *self); + int (*get_ext_id)(struct transvr_obj_s *self); + int (*get_connector)(struct transvr_obj_s *self); + int (*get_vendor_name)(struct transvr_obj_s *self, char *buf_p); + int (*get_vendor_pn)(struct transvr_obj_s *self, char *buf_p); + int (*get_vendor_rev)(struct transvr_obj_s *self, char *buf_p); + int (*get_vendor_sn)(struct transvr_obj_s *self, char *buf_p); + int (*get_power_cls)(struct transvr_obj_s *self); + int (*get_br)(struct transvr_obj_s *self); + int (*get_len_sm)(struct transvr_obj_s *self); + int (*get_len_smf)(struct transvr_obj_s *self); + int (*get_len_om1)(struct transvr_obj_s *self); + int (*get_len_om2)(struct transvr_obj_s *self); + int (*get_len_om3)(struct transvr_obj_s *self); + int (*get_len_om4)(struct transvr_obj_s *self); + int (*get_comp_rev)(struct transvr_obj_s *self); + int (*get_comp_eth_1)(struct transvr_obj_s *self); + int (*get_comp_eth_10)(struct transvr_obj_s *self); + int (*get_comp_eth_10_40)(struct transvr_obj_s *self); + int (*get_comp_extend)(struct transvr_obj_s *self); + int (*get_cdr)(struct transvr_obj_s *self); + int (*get_rate_id)(struct transvr_obj_s *self); + int (*get_soft_rs0)(struct transvr_obj_s *self); + int (*get_soft_rs1)(struct transvr_obj_s *self); + int (*get_info)(struct transvr_obj_s *self); + int (*get_if_type)(struct transvr_obj_s *self, char *buf_p); + int (*get_if_speed)(struct transvr_obj_s *self, char *buf_p); + int (*get_if_lane)(struct transvr_obj_s *self, char *buf_p); + int (*get_curr_temp)(struct transvr_obj_s *self, char *buf_p); + int (*get_curr_vol)(struct transvr_obj_s *self, char *buf_p); + int (*get_soft_rx_los)(struct transvr_obj_s *self, char *buf_p); + int (*get_soft_tx_disable)(struct transvr_obj_s *self, char *buf_p); + int (*get_soft_tx_fault)(struct transvr_obj_s *self, char *buf_p); + int (*get_auto_tx_disable)(struct transvr_obj_s *self, char *buf_p); + int (*get_tx_bias)(struct transvr_obj_s *self, char *buf_p); + int (*get_tx_power)(struct transvr_obj_s *self, char *buf_p); + int (*get_rx_power)(struct transvr_obj_s *self, char *buf_p); + int (*get_tx_eq)(struct transvr_obj_s *self, char *buf_p); + int (*get_rx_am)(struct transvr_obj_s *self, char *buf_p); + int (*get_rx_em)(struct transvr_obj_s *self, char *buf_p); + int (*get_wavelength)(struct transvr_obj_s *self, char *buf_p); + int (*set_cdr)(struct transvr_obj_s *self, int input_val); + int (*set_soft_rs0)(struct transvr_obj_s *self, int input_val); + int (*set_soft_rs1)(struct transvr_obj_s *self, int input_val); + int (*set_soft_tx_disable)(struct transvr_obj_s *self, int input_val); + int (*set_auto_tx_disable)(struct transvr_obj_s *self, int input_val); + int (*set_tx_eq)(struct transvr_obj_s *self, int input_val); + int (*set_rx_am)(struct transvr_obj_s *self, int input_val); + int (*set_rx_em)(struct transvr_obj_s *self, int input_val); + + /* ========== Object private functions ========== + */ + int (*init)(struct transvr_obj_s *self); + int (*clean)(struct transvr_obj_s *self); + int (*check)(struct transvr_obj_s *self); + int (*update_all)(struct transvr_obj_s *self, int show_err); + int (*fsm_4_direct)(struct transvr_obj_s* self, char *caller_name); + int (*fsm_4_polling)(struct transvr_obj_s* self, char *caller_name); + int (*send_uevent)(struct transvr_obj_s* self, enum kobject_action u_action); + int (*dump_all)(struct transvr_obj_s* self); +}; + + +/* For AVL Mapping */ +struct transvr_avl_s { + char vendor_name[32]; + char vendor_pn[32]; + int (*init)(struct transvr_obj_s *self); +}; + + +/* Worker for long term task of transceiver */ +struct transvr_worker_s { + /* Task Parameter */ + struct transvr_obj_s *transvr_p; + struct transvr_worker_s *next_p; + struct transvr_worker_s *pre_p; + unsigned long trigger_time; + char func_name[64]; + int retry; + int state; + + /* Task private data */ + void *p_data; + + /* Call back function */ + int (*main_task)(struct transvr_worker_s *task); + int (*post_task)(struct transvr_worker_s *task); +}; + + +struct transvr_obj_s * +create_transvr_obj(char *swp_name, + int chan_id, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int run_mode); + +void lock_transvr_obj(struct transvr_obj_s *self); +void unlock_transvr_obj(struct transvr_obj_s *self); +int isolate_transvr_obj(struct transvr_obj_s *self); + +int resync_channel_tier_2(struct transvr_obj_s *self); + +void alarm_msg_2_user(struct transvr_obj_s *self, char *emsg); + +#endif /* TRANSCEIVER_H */ + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/utils/inventec_d7264_util.py b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/utils/inventec_d7264_util.py new file mode 100755 index 000000000000..18853b7b2400 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/utils/inventec_d7264_util.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Inventec, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +DEBUG = False +args = [] +FORCE = 0 +i2c_prefix = '/sys/bus/i2c/devices/' + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + install() + elif arg == 'clean': + uninstall() + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print "[D7264]"+txt + return + +def exec_cmd(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + show_log (cmd +"with result:" + str(status)) + show_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +instantiate =[ +#'echo pca9545 0x70> /sys/bus/i2c/devices/i2c-0/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-1/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-2/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-3/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-4/new_device', +#'echo inv_psoc 0x66> /sys/bus/i2c/devices/i2c-5/new_device', +#'echo inv_cpld 0x55> /sys/bus/i2c/devices/i2c-5/new_device', +'echo inv_eeprom 0x53> /sys/bus/i2c/devices/i2c-0/new_device'] + +drivers =[ +'lpc_ich', +'i2c-i801', +'i2c-mux', +'i2c-mux-pca954x', +'i2c-dev', +'inv_eeprom', +'inv_platform', +'inv_psoc', +'inv_cpld', +'swps'] + + + +def system_install(): + global FORCE + + #remove default drivers to avoid modprobe order conflicts + status, output = exec_cmd("rmmod i2c_ismt ", 1) + status, output = exec_cmd("rmmod i2c-i801 ", 1) + #install drivers + for i in range(0,len(drivers)): + status, output = exec_cmd("modprobe "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + + #instantiate devices + for i in range(0,len(instantiate)): + time.sleep(1) + status, output = exec_cmd(instantiate[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(10,17): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-2/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(18,25): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-3/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(26,33): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-4/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(34,41): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-5/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(42,49): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-6/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(50,57): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-7/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(58,65): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-8/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(66,73): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-9/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + + +def system_ready(): + if not device_found(): + return False + return True + +def install(): + if not device_found(): + print "No device, installing...." + status = system_install() + if status: + if FORCE == 0: + return status + else: + print " D7264 devices detected...." + return + +def uninstall(): + global FORCE + #uninstall drivers + for i in range(len(drivers)-1,-1,-1): + status, output = exec_cmd("rmmod "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_found(): + ret1, log = exec_cmd("ls "+i2c_prefix+"*0072", 0) + ret2, log = exec_cmd("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/changelog b/platform/broadcom/sonic-platform-modules-inventec/debian/changelog index 9d33aa418ef5..e49ed14c3e21 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/changelog +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/changelog @@ -1,3 +1,8 @@ +sonic-inventec-platform-modules (1.1.0) unstable; urgency=low + * Add support for Inventec d7264 + + -- developer Tue, 17 Apr 2018 15:27:30 +0800 + sonic-inventec-platform-modules (1.1.0) unstable; urgency=low * Add support for Inventec d7054 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/control b/platform/broadcom/sonic-platform-modules-inventec/debian/control index 27258c9226c3..9368de788ce9 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/control +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/control @@ -15,3 +15,7 @@ Architecture: amd64 Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led +Package: platform-modules-d7264q28b +Architecture: amd64 +Depends: linux-image-3.16.0-5-amd64 +Description: kernel modules for platform devices such as fan, led diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.init new file mode 100644 index 000000000000..87c145a95452 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.init @@ -0,0 +1,40 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup Inventec d7054q28b board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + depmod -a + /usr/local/bin/inventec_d7264_util.py -f install + echo "done." + ;; + +stop) + + /usr/local/bin/inventec_d7264_util.py -f clean + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-d7264q28b.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.install new file mode 100644 index 000000000000..dba76a7d05c1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.install @@ -0,0 +1 @@ +d7264q28b/utils/inventec_d7264_util.py usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.upstart b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.upstart new file mode 100644 index 000000000000..a438cb7bc7e9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.upstart @@ -0,0 +1,5 @@ +description "SONiC platform service" + +respawn + +exec /usr/local/bin/inventec_d7264_util.py -f install diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/rules b/platform/broadcom/sonic-platform-modules-inventec/debian/rules index 6ead4c21de50..9c3dcf4df8a3 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/rules +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/rules @@ -14,7 +14,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= d7032q28b d7054q28b +MODULE_DIRS:= d7032q28b d7054q28b d7264q28b %: dh $@ From c4e2f3e6303381185a9a83273666670ea34fd144 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 15 Aug 2018 02:05:07 +0300 Subject: [PATCH 1550/1833] [mellanox]: Update hw-mgmt service with the stop action (#1929) Signed-off-by: Volodymyr Samotiy --- .../mellanox/hw-management/Add-systemd-service-config.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/mellanox/hw-management/Add-systemd-service-config.patch b/platform/mellanox/hw-management/Add-systemd-service-config.patch index ce16bb712ee1..bef62b9ea3e7 100644 --- a/platform/mellanox/hw-management/Add-systemd-service-config.patch +++ b/platform/mellanox/hw-management/Add-systemd-service-config.patch @@ -29,7 +29,7 @@ new file mode 100644 index 0000000..d18916d --- /dev/null +++ b/debian/hw-management.service -@@ -0,0 +1,10 @@ +@@ -0,0 +1,11 @@ +[Unit] +Description=Mellanox Hardware Management + @@ -37,6 +37,7 @@ index 0000000..d18916d +Type=oneshot +EnvironmentFile=/host/machine.conf +ExecStart=/bin/bash -c "/etc/mlnx/mlnx-hw-management start" ++ExecStop=/bin/bash -c "/etc/mlnx/mlnx-hw-management stop" + +[Install] +WantedBy=multi-user.target From f0d4a07a20dcce6ebf115ef025518b129f574c0f Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Wed, 15 Aug 2018 16:02:03 +0300 Subject: [PATCH 1551/1833] [submodule] update snmpagent pointer (#1930) --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index ae99de071b33..b180f4423a6c 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit ae99de071b332882aa3ac1e163188af93f602231 +Subproject commit b180f4423a6cd205009f2aed19c2bac441a2dfd0 From 9f545456c9cfa2cec188dc8f10d458a37b866bd4 Mon Sep 17 00:00:00 2001 From: cawand <39776867+cawand@users.noreply.github.com> Date: Wed, 15 Aug 2018 21:41:12 -0700 Subject: [PATCH 1552/1833] Added picocom and pexpect to base image, for use in consutil (#1935) Signed-off-by: Cayla Wanderman-Milne --- build_debian.sh | 3 ++- files/build_templates/sonic_debian_extension.j2 | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index fc8a2cb59b2d..ebe32ca536d1 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -227,7 +227,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in hping3 \ python-scapy \ tcptraceroute \ - mtr-tiny + mtr-tiny \ + picocom sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ grub-pc-bin diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 62637446dda2..b43e616e1756 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -98,6 +98,10 @@ sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-click*_all.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Install python pexpect used by sonic-utilities consutil +# using pip install instead to get a more recent version than is available through debian +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install pexpect + # Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f From 7d2766077a42275726bf725a42c123a1c1698e1c Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 15 Aug 2018 21:45:44 -0700 Subject: [PATCH 1553/1833] [common]: Update sonic-swss-common submodule (#1934) Signed-off-by: Shu0T1an ChenG --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 051e08d79548..5a89b1e8be0c 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 051e08d79548eb362c12d8800b5d2cb7bf8a1e41 +Subproject commit 5a89b1e8be0c6960031697d134db3a5276c93b30 From c1e17c33b5b0ac6bcae9744b3ba23c82207b8873 Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Thu, 16 Aug 2018 07:46:34 +0300 Subject: [PATCH 1554/1833] [mellanox]: Fix qos.json.j2: apply qos config for active ports (#1932) Signed-off-by: Stepan Blyschak --- .../LS-SN2700/qos.json.j2 | 45 ++++++++++++++----- .../ACS-MSN2100/qos.json.j2 | 44 +++++++++++++----- .../ACS-MSN2410/qos.json.j2 | 44 +++++++++++++----- .../ACS-MSN2700/qos.json.j2 | 45 ++++++++++++++----- .../Mellanox-SN2700-D48C8/qos.json.j2 | 45 ++++++++++++++----- 5 files changed, 170 insertions(+), 53 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 index 3e01af3f2c64..b1759cb42118 100644 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 @@ -1,3 +1,30 @@ +{%- set PORT_ALL = [] %} + +{%- if PORT is not defined %} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- else %} + {%- for port in PORT %} + {%- if PORT_ALL.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} +{%- endfor %} +{%- set port_names_active = port_names_list_active | join(',') %} + { "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { @@ -114,7 +141,7 @@ } }, "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "{{ port_names_active }}": { "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", @@ -148,19 +175,15 @@ } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { + "{{ port_names_active }}|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "{{ port_names_active }}|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { + "{{ port_names_active }}|1" : { "scheduler" : "[SCHEDULER|scheduler.2]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" } } } - diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 index 74045469dbfd..b1759cb42118 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 @@ -1,3 +1,30 @@ +{%- set PORT_ALL = [] %} + +{%- if PORT is not defined %} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- else %} + {%- for port in PORT %} + {%- if PORT_ALL.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} +{%- endfor %} +{%- set port_names_active = port_names_list_active | join(',') %} + { "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { @@ -114,7 +141,7 @@ } }, "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60": { + "{{ port_names_active }}": { "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", @@ -148,18 +175,15 @@ } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|0": { + "{{ port_names_active }}|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "{{ port_names_active }}|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|1": { + "{{ port_names_active }}|1" : { "scheduler" : "[SCHEDULER|scheduler.2]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" } } } diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 index 95652cf96f4e..b1759cb42118 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 @@ -1,3 +1,30 @@ +{%- set PORT_ALL = [] %} + +{%- if PORT is not defined %} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- else %} + {%- for port in PORT %} + {%- if PORT_ALL.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} +{%- endfor %} +{%- set port_names_active = port_names_list_active | join(',') %} + { "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { @@ -114,7 +141,7 @@ } }, "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220": { + "{{ port_names_active }}": { "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", @@ -148,18 +175,15 @@ } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|0": { + "{{ port_names_active }}|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "{{ port_names_active }}|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|1": { + "{{ port_names_active }}|1" : { "scheduler" : "[SCHEDULER|scheduler.2]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212,Ethernet216,Ethernet220|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" } } } diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 index 3e01af3f2c64..b1759cb42118 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 @@ -1,3 +1,30 @@ +{%- set PORT_ALL = [] %} + +{%- if PORT is not defined %} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- else %} + {%- for port in PORT %} + {%- if PORT_ALL.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} +{%- endfor %} +{%- set port_names_active = port_names_list_active | join(',') %} + { "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { @@ -114,7 +141,7 @@ } }, "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "{{ port_names_active }}": { "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", @@ -148,19 +175,15 @@ } }, "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { + "{{ port_names_active }}|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "{{ port_names_active }}|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { + "{{ port_names_active }}|1" : { "scheduler" : "[SCHEDULER|scheduler.2]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" } } } - diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 index d35f614de635..b1759cb42118 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 @@ -1,3 +1,30 @@ +{%- set PORT_ALL = [] %} + +{%- if PORT is not defined %} + {%- for port_idx in range(0,64) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- else %} + {%- for port in PORT %} + {%- if PORT_ALL.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} +{%- endfor %} +{%- set port_names_active = port_names_list_active | join(',') %} + { "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { @@ -114,7 +141,7 @@ } }, "PORT_QOS_MAP": { - "Ethernet8,Ethernet2,Ethernet0,Ethernet6,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet106,Ethernet58,Ethernet126,Ethernet96,Ethernet124,Ethernet122,Ethernet92,Ethernet120,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet76,Ethernet74,Ethernet18,Ethernet70,Ethernet32,Ethernet72,Ethernet16,Ethernet36,Ethernet78,Ethernet60,Ethernet28,Ethernet62,Ethernet14,Ethernet88,Ethernet118,Ethernet24,Ethernet116,Ethernet82,Ethernet114,Ethernet80,Ethernet112,Ethernet86,Ethernet110,Ethernet84,Ethernet48,Ethernet10,Ethernet44,Ethernet42,Ethernet40,Ethernet64,Ethernet66,Ethernet12,Ethernet46,Ethernet20,Ethernet22,Ethernet68": { + "{{ port_names_active }}": { "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", @@ -148,19 +175,15 @@ } }, "QUEUE": { - "Ethernet8,Ethernet2,Ethernet0,Ethernet6,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet106,Ethernet58,Ethernet126,Ethernet96,Ethernet124,Ethernet122,Ethernet92,Ethernet120,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet76,Ethernet74,Ethernet18,Ethernet70,Ethernet32,Ethernet72,Ethernet16,Ethernet36,Ethernet78,Ethernet60,Ethernet28,Ethernet62,Ethernet14,Ethernet88,Ethernet118,Ethernet24,Ethernet116,Ethernet82,Ethernet114,Ethernet80,Ethernet112,Ethernet86,Ethernet110,Ethernet84,Ethernet48,Ethernet10,Ethernet44,Ethernet42,Ethernet40,Ethernet64,Ethernet66,Ethernet12,Ethernet46,Ethernet20,Ethernet22,Ethernet68|0": { + "{{ port_names_active }}|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "{{ port_names_active }}|0" : { "scheduler" : "[SCHEDULER|scheduler.1]" }, - "Ethernet8,Ethernet2,Ethernet0,Ethernet6,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet106,Ethernet58,Ethernet126,Ethernet96,Ethernet124,Ethernet122,Ethernet92,Ethernet120,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet76,Ethernet74,Ethernet18,Ethernet70,Ethernet32,Ethernet72,Ethernet16,Ethernet36,Ethernet78,Ethernet60,Ethernet28,Ethernet62,Ethernet14,Ethernet88,Ethernet118,Ethernet24,Ethernet116,Ethernet82,Ethernet114,Ethernet80,Ethernet112,Ethernet86,Ethernet110,Ethernet84,Ethernet48,Ethernet10,Ethernet44,Ethernet42,Ethernet40,Ethernet64,Ethernet66,Ethernet12,Ethernet46,Ethernet20,Ethernet22,Ethernet68|1": { + "{{ port_names_active }}|1" : { "scheduler" : "[SCHEDULER|scheduler.2]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet8,Ethernet2,Ethernet0,Ethernet6,Ethernet4,Ethernet108,Ethernet100,Ethernet104,Ethernet106,Ethernet58,Ethernet126,Ethernet96,Ethernet124,Ethernet122,Ethernet92,Ethernet120,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet76,Ethernet74,Ethernet18,Ethernet70,Ethernet32,Ethernet72,Ethernet16,Ethernet36,Ethernet78,Ethernet60,Ethernet28,Ethernet62,Ethernet14,Ethernet88,Ethernet118,Ethernet24,Ethernet116,Ethernet82,Ethernet114,Ethernet80,Ethernet112,Ethernet86,Ethernet110,Ethernet84,Ethernet48,Ethernet10,Ethernet44,Ethernet42,Ethernet40,Ethernet64,Ethernet66,Ethernet12,Ethernet46,Ethernet20,Ethernet22,Ethernet68|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" } } } - From 38f3eba695b0bd27fd3f10a8e6729118780caad4 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 16 Aug 2018 08:56:56 -0700 Subject: [PATCH 1555/1833] [kernel]: upgrade kernel to 4.9.0-7 (4.9.110-3+deb9u1) (#1922) * [kernel]: upgrade kernel to 4.9.0-7 (4.9.110-3+deb9u1) Signed-off-by: Guohan Lu * [mellanox]: Update SDK pointer for 4.9.0-7 kernel (#44) Signed-off-by: Volodymyr Samotiy * Update arista drivers for 4.9.0-7 linux kernel (#43) --- build_debian.sh | 2 +- files/build_templates/swss.service.j2 | 8 ++++---- installer/x86_64/install.sh | 4 ++-- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sai-modules.mk | 2 +- platform/broadcom/saibcm-modules/debian/control | 4 ++-- .../debian/opennsl-modules-4.9.0-5-amd64.dirs | 1 - .../debian/opennsl-modules-4.9.0-7-amd64.dirs | 1 + ....0-5-amd64.init => opennsl-modules-4.9.0-7-amd64.init} | 2 +- ...md64.install => opennsl-modules-4.9.0-7-amd64.install} | 8 ++++---- platform/broadcom/saibcm-modules/debian/rules | 6 +++--- ...md64.service => opennsl-modules-4.9.0-7-amd64.service} | 4 ++-- platform/broadcom/sonic-platform-modules-arista | 2 +- .../broadcom/sonic-platform-modules-cel/debian/control | 4 ++-- .../broadcom/sonic-platform-modules-dell/debian/control | 6 +++--- .../broadcom/sonic-platform-modules-delta/debian/control | 8 ++++---- .../debian/platform-modules-et-6248brb.init | 2 +- .../et-6248brb/scripts/led_status.sh | 2 +- .../broadcom/sonic-platform-modules-s6000/debian/control | 2 +- platform/mellanox/sdk.mk | 2 +- rules/linux-kernel.mk | 6 +++--- src/sonic-linux-kernel | 2 +- 22 files changed, 40 insertions(+), 40 deletions(-) delete mode 100644 platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.dirs create mode 100644 platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.dirs rename platform/broadcom/saibcm-modules/debian/{opennsl-modules-4.9.0-5-amd64.init => opennsl-modules-4.9.0-7-amd64.init} (92%) rename platform/broadcom/saibcm-modules/debian/{opennsl-modules-4.9.0-5-amd64.install => opennsl-modules-4.9.0-7-amd64.install} (56%) rename platform/broadcom/saibcm-modules/systemd/{opennsl-modules-4.9.0-5-amd64.service => opennsl-modules-4.9.0-7-amd64.service} (59%) diff --git a/build_debian.sh b/build_debian.sh index ebe32ca536d1..28b9833612b1 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -30,7 +30,7 @@ set -x -e ## docker engine version (with platform) DOCKER_VERSION=1.11.1-0~stretch_amd64 -LINUX_KERNEL_VERSION=4.9.0-5 +LINUX_KERNEL_VERSION=4.9.0-7 ## Working directory to prepare the file system FILESYSTEM_ROOT=./fsroot diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 8a138d46a7ca..08e3f50e2697 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -2,16 +2,16 @@ Description=switch state service Requires=database.service updategraph.service {% if sonic_asic_platform == 'broadcom' %} -Requires=opennsl-modules-4.9.0-5-amd64.service +Requires=opennsl-modules-4.9.0-7-amd64.service {% elif sonic_asic_platform == 'nephos' %} -Requires=nps-modules-4.9.0-5-amd64.service +Requires=nps-modules-4.9.0-7-amd64.service {% endif %} After=database.service updategraph.service After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} -After=opennsl-modules-4.9.0-5-amd64.service +After=opennsl-modules-4.9.0-7-amd64.service {% elif sonic_asic_platform == 'nephos' %} -After=nps-modules-4.9.0-5-amd64.service +After=nps-modules-4.9.0-7-amd64.service {% endif %} [Service] diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 327c0c47f111..874dc8d13da0 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -570,12 +570,12 @@ menuentry '$demo_grub_entry' { if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 - linux /$image_dir/boot/vmlinuz-4.9.0-5-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ + linux /$image_dir/boot/vmlinuz-4.9.0-7-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ net.ifnames=0 biosdevname=0 \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' - initrd /$image_dir/boot/initrd.img-4.9.0-5-amd64 + initrd /$image_dir/boot/initrd.img-4.9.0-7-amd64 } EOF diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index a4d1d8d2737c..4904fbd01e6a 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a4d1d8d2737cf49bd6cc802dbc6c8c0ff682fa87 +Subproject commit 4904fbd01e6a4547c404d3694139b36e716cfe31 diff --git a/platform/broadcom/sai-modules.mk b/platform/broadcom/sai-modules.mk index 31cd5996ef1c..f7c449300f8a 100644 --- a/platform/broadcom/sai-modules.mk +++ b/platform/broadcom/sai-modules.mk @@ -1,6 +1,6 @@ # Broadcom SAI modules -KVERSION = 4.9.0-5-amd64 +KVERSION = 4.9.0-7-amd64 BRCM_OPENNSL_KERNEL_VERSION = 3.4.1.11-1 BRCM_OPENNSL_KERNEL = opennsl-modules-$(KVERSION)_$(BRCM_OPENNSL_KERNEL_VERSION)_amd64.deb diff --git a/platform/broadcom/saibcm-modules/debian/control b/platform/broadcom/saibcm-modules/debian/control index e84d6de9fd52..b3884f80f2e0 100644 --- a/platform/broadcom/saibcm-modules/debian/control +++ b/platform/broadcom/saibcm-modules/debian/control @@ -7,8 +7,8 @@ Standards-Version: 3.9.3 #Vcs-Git: git://git.debian.org/collab-maint/bcmsdk.git #Vcs-Browser: http://git.debian.org/?p=collab-maint/bcmsdk.git;a=summary -Package: opennsl-modules-4.9.0-5-amd64 +Package: opennsl-modules-4.9.0-7-amd64 Architecture: amd64 Section: main -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for broadcom SAI diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.dirs b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.dirs deleted file mode 100644 index 30ebf9851ecb..000000000000 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.dirs +++ /dev/null @@ -1 +0,0 @@ -lib/modules/4.9.0-5-amd64/extra diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.dirs b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.dirs new file mode 100644 index 000000000000..e614841819bc --- /dev/null +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.dirs @@ -0,0 +1 @@ +lib/modules/4.9.0-7-amd64/extra diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.init b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.init similarity index 92% rename from platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.init rename to platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.init index 07a6f834757b..7f9f2e24db19 100755 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.init +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.init @@ -38,7 +38,7 @@ force-reload|restart) ;; *) - echo "Usage: /etc/init.d/opennsl-modules-4.9.0-5-amd64.init {start|stop}" + echo "Usage: /etc/init.d/opennsl-modules-4.9.0-7-amd64.init {start|stop}" exit 1 ;; esac diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.install b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.install similarity index 56% rename from platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.install rename to platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.install index d79178a4a549..fe6b748c29b8 100644 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-5-amd64.install +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-7-amd64.install @@ -1,4 +1,4 @@ -systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/4.9.0-5-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.9.0-5-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.9.0-5-amd64/extra -systemd/opennsl-modules-4.9.0-5-amd64.service lib/systemd/system +systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/4.9.0-7-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.9.0-7-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.9.0-7-amd64/extra +systemd/opennsl-modules-4.9.0-7-amd64.service lib/systemd/system diff --git a/platform/broadcom/saibcm-modules/debian/rules b/platform/broadcom/saibcm-modules/debian/rules index 231c52aa8ccd..7560bfad91fa 100755 --- a/platform/broadcom/saibcm-modules/debian/rules +++ b/platform/broadcom/saibcm-modules/debian/rules @@ -60,7 +60,7 @@ kdist_config: prep-deb-files kdist_clean: clean dh_testdir dh_clean - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-5-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-5-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-7-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-7-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean # rm -f driver/*.o driver/*.ko # ### end KERNEL SETUP @@ -78,7 +78,7 @@ build-arch-stamp: dh_testdir # Add here command to compile/build the package. - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-5-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-5-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-7-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-7-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 touch $@ @@ -103,7 +103,7 @@ clean: rm -f build-arch-stamp build-indep-stamp configure-stamp # Add here commands to clean up after the build process. - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-5-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-5-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 KERNDIR=/usr/src/linux-headers-4.9.0-7-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-7-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean dh_clean diff --git a/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-5-amd64.service b/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-7-amd64.service similarity index 59% rename from platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-5-amd64.service rename to platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-7-amd64.service index 4da3f9761991..12c5ae40db97 100644 --- a/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-5-amd64.service +++ b/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-7-amd64.service @@ -5,8 +5,8 @@ Before=syncd.service [Service] Type=oneshot -ExecStart=-/etc/init.d/opennsl-modules-4.9.0-5-amd64 start -ExecStop=-/etc/init.d/opennsl-modules-4.9.0-5-amd64 stop +ExecStart=-/etc/init.d/opennsl-modules-4.9.0-7-amd64 start +ExecStop=-/etc/init.d/opennsl-modules-4.9.0-7-amd64 stop RemainAfterExit=yes [Install] diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index a4d1d8d2737c..4904fbd01e6a 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a4d1d8d2737cf49bd6cc802dbc6c8c0ff682fa87 +Subproject commit 4904fbd01e6a4547c404d3694139b36e716cfe31 diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/control b/platform/broadcom/sonic-platform-modules-cel/debian/control index a26bdea11395..9f561288d399 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/control +++ b/platform/broadcom/sonic-platform-modules-cel/debian/control @@ -7,11 +7,11 @@ Standards-Version: 3.9.3 Package: platform-modules-dx010 Architecture: amd64 -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-haliburton Architecture: amd64 -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/control b/platform/broadcom/sonic-platform-modules-dell/debian/control index 557b5b884f93..15a88931c1c3 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/control +++ b/platform/broadcom/sonic-platform-modules-dell/debian/control @@ -7,16 +7,16 @@ Standards-Version: 3.9.3 Package: platform-modules-z9264f Architecture: amd64 -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-z9100 Architecture: amd64 -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-s6100 Architecture: amd64 -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control index 9b0119dbe042..0bcceccf6b18 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/control +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -7,21 +7,21 @@ Standards-Version: 3.9.3 Package: platform-modules-ag9032v1 Architecture: amd64 -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ag9064 Architecture: amd64 -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ag5648 Architecture: amd64 -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-et-6248brb Architecture: amd64 -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init index e314a528a6e9..726e0ba6923b 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init @@ -25,7 +25,7 @@ start) modprobe dni_gpio modprobe delta_et-6248brb_platform - if [ `uname -a | awk '{print $3}'` = "4.9.0-5-amd64" ]; then + if [ `uname -a | awk '{print $3}'` = "4.9.0-7-amd64" ]; then echo "453" > "/sys/class/gpio/export" echo "454" > "/sys/class/gpio/export" echo "455" > "/sys/class/gpio/export" diff --git a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh index 2ba61bbfecb3..74276a6d31f3 100644 --- a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh @@ -7,7 +7,7 @@ FAN2_RPM="/sys/bus/i2c/devices/0-002e/fan2_input" FAN_TRAY1_LED="/sys/devices/platform/delta-et6248brb-gpio.0/FAN/fan1_led_ag" FAN_TRAY2_LED="/sys/devices/platform/delta-et6248brb-gpio.0/FAN/fan2_led_ag" -if [ `uname -a | awk '{print $3}'` = "4.9.0-5-amd64" ]; then +if [ `uname -a | awk '{print $3}'` = "4.9.0-7-amd64" ]; then SYS_LED_G="/sys/class/gpio/gpio453/value" SYS_LED_R="/sys/class/gpio/gpio454/value" PWR_LED_G="/sys/class/gpio/gpio455/value" diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/control b/platform/broadcom/sonic-platform-modules-s6000/debian/control index fbd8529de4e8..eb91ec6718f3 100644 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/control +++ b/platform/broadcom/sonic-platform-modules-s6000/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: platform-modules-s6000 Architecture: amd64 -Depends: linux-image-4.9.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index d3bb61517339..a667005bc6c0 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,4 +1,4 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/87823de172a593e070ff7e9f3e17d442c7cf1eac/sdk +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/16e0822d7077d8558e6ff92b3c6650df17a88219/sdk MLNX_SDK_VERSION = 4.2.8103 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 333301644d50..7c9e7b2c07aa 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -1,9 +1,9 @@ # linux kernel package -KVERSION_SHORT = 4.9.0-5 +KVERSION_SHORT = 4.9.0-7 KVERSION = $(KVERSION_SHORT)-amd64 -KERNEL_VERSION = 4.9.65 -KERNEL_SUBVERSION = 3+deb9u2 +KERNEL_VERSION = 4.9.110 +KERNEL_SUBVERSION = 3+deb9u1 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 28e99c0e7618..7c97ae923c9e 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 28e99c0e76189e8ec5c46535cbd87145668262d8 +Subproject commit 7c97ae923c9ec9b2006ed275e8780233b32b28f6 From cd9c5e737309a6790a5384e019b9adef3467128b Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Thu, 16 Aug 2018 20:37:25 +0300 Subject: [PATCH 1556/1833] Allow similar devices configs sharing (#1933) * Allow similar devices configs sharing Signed-off-by: Stepan Blyschak * Remove unnecessary cp flags Signed-off-by: Stepan Blyschak * Remove hw-managment symlink for LS-SN2700 & resolve symlinks during cp Signed-off-by: Stepan Blyschak --- .../x86_64-mlnx_lssn2700-r0/LS-SN2700 | 1 + .../LS-SN2700/buffers.json.j2 | 1 - .../LS-SN2700/buffers_defaults_t0.j2 | 1 - .../LS-SN2700/buffers_defaults_t1.j2 | 1 - .../LS-SN2700/pg_profile_lookup.ini | 17 -- .../LS-SN2700/port_config.ini | 33 --- .../LS-SN2700/qos.json.j2 | 189 -------------- .../LS-SN2700/sai.profile | 1 - .../LS-SN2700/sai_2700.xml | 243 ------------------ .../x86_64-mlnx_lssn2700-r0/hw-management | 1 - .../x86_64-mlnx_lssn2700-r0/installer.conf | 2 +- .../x86_64-mlnx_lssn2700-r0/plugins/eeprom.py | 32 --- .../plugins/psuutil.py | 74 ------ .../plugins/sfplpmget.py | 43 ---- .../plugins/sfplpmset.py | 107 -------- .../plugins/sfpreset.py | 45 ---- .../plugins/sfputil.py | 190 -------------- .../x86_64-mlnx_lssn2700-r0/sensors.conf | 22 +- .../ACS-MSN2100/pg_profile_lookup.ini | 18 +- .../x86_64-mlnx_msn2100-r0/installer.conf | 2 +- .../x86_64-mlnx_msn2100-r0/sensors.conf | 22 +- .../ACS-MSN2410/pg_profile_lookup.ini | 18 +- .../x86_64-mlnx_msn2410-r0/installer.conf | 2 +- .../x86_64-mlnx_msn2410-r0/sensors.conf | 22 +- .../Mellanox-SN2700-D48C8/buffers.json.j2 | 3 +- .../buffers_defaults_t0.j2 | 91 +------ .../buffers_defaults_t1.j2 | 91 +------ .../pg_profile_lookup.ini | 18 +- .../ACS-MSN2740/pg_profile_lookup.ini | 18 +- .../x86_64-mlnx_msn2740-r0/installer.conf | 2 +- .../x86_64-mlnx_msn2740-r0/sensors.conf | 22 +- src/sonic-device-data/Makefile | 2 +- 32 files changed, 17 insertions(+), 1317 deletions(-) create mode 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700 delete mode 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 delete mode 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t0.j2 delete mode 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t1.j2 delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/pg_profile_lookup.ini delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/port_config.ini delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml delete mode 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/hw-management mode change 100644 => 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/eeprom.py delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/psuutil.py delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmget.py delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmset.py delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfpreset.py delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers.json.j2 mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700 new file mode 120000 index 000000000000..dfed1bb2cfb5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700 @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/ACS-MSN2700/ \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 deleted file mode 120000 index add8bf8bb7c2..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t0.j2 deleted file mode 120000 index 7bcae62336f6..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t0.j2 +++ /dev/null @@ -1 +0,0 @@ -../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t1.j2 deleted file mode 120000 index a437d613434d..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/buffers_defaults_t1.j2 +++ /dev/null @@ -1 +0,0 @@ -../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/pg_profile_lookup.ini deleted file mode 100644 index b66b129fe43f..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 34816 18432 16384 0 - 25000 5m 34816 18432 16384 0 - 40000 5m 34816 18432 16384 0 - 50000 5m 34816 18432 16384 0 - 100000 5m 36864 18432 18432 0 - 10000 40m 36864 18432 18432 0 - 25000 40m 39936 18432 21504 0 - 40000 40m 41984 18432 23552 0 - 50000 40m 41984 18432 23552 0 - 100000 40m 54272 18432 35840 0 - 10000 300m 49152 18432 30720 0 - 25000 300m 71680 18432 53248 0 - 40000 300m 94208 18432 75776 0 - 50000 300m 94208 18432 75776 0 - 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/port_config.ini b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/port_config.ini deleted file mode 100644 index 816bb0e94a70..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/port_config.ini +++ /dev/null @@ -1,33 +0,0 @@ -# name lanes -Ethernet0 0,1,2,3 -Ethernet4 4,5,6,7 -Ethernet8 8,9,10,11 -Ethernet12 12,13,14,15 -Ethernet16 16,17,18,19 -Ethernet20 20,21,22,23 -Ethernet24 24,25,26,27 -Ethernet28 28,29,30,31 -Ethernet32 32,33,34,35 -Ethernet36 36,37,38,39 -Ethernet40 40,41,42,43 -Ethernet44 44,45,46,47 -Ethernet48 48,49,50,51 -Ethernet52 52,53,54,55 -Ethernet56 56,57,58,59 -Ethernet60 60,61,62,63 -Ethernet64 64,65,66,67 -Ethernet68 68,69,70,71 -Ethernet72 72,73,74,75 -Ethernet76 76,77,78,79 -Ethernet80 80,81,82,83 -Ethernet84 84,85,86,87 -Ethernet88 88,89,90,91 -Ethernet92 92,93,94,95 -Ethernet96 96,97,98,99 -Ethernet100 100,101,102,103 -Ethernet104 104,105,106,107 -Ethernet108 108,109,110,111 -Ethernet112 112,113,114,115 -Ethernet116 116,117,118,119 -Ethernet120 120,121,122,123 -Ethernet124 124,125,126,127 diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 deleted file mode 100644 index b1759cb42118..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/qos.json.j2 +++ /dev/null @@ -1,189 +0,0 @@ -{%- set PORT_ALL = [] %} - -{%- if PORT is not defined %} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- else %} - {%- for port in PORT %} - {%- if PORT_ALL.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set PORT_ACTIVE = [] %} -{%- if DEVICE_NEIGHBOR is not defined %} - {%- set PORT_ACTIVE = PORT_ALL %} -{%- else %} - {%- for port in DEVICE_NEIGHBOR.keys() %} - {%- if PORT_ACTIVE.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set port_names_list_active = [] %} -{%- for port in PORT_ACTIVE %} - {%- if port_names_list_active.append(port) %}{%- endif %} -{%- endfor %} -{%- set port_names_active = port_names_list_active | join(',') %} - -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "PORT_QOS_MAP": { - "{{ port_names_active }}": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "{{ port_names_active }}|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "{{ port_names_active }}|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "{{ port_names_active }}|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile deleted file mode 100644 index 696f3d8182f9..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai.profile +++ /dev/null @@ -1 +0,0 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700.xml diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml b/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml deleted file mode 100644 index 7831c9cf59d0..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/LS-SN2700/sai_2700.xml +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - 00:02:03:04:05:00 - - - 32 - - - - - 1 - 4 - 16 - - - 3 - - - 98368 - - - 3 - 4 - 17 - 1 - 98368 - - - 5 - 4 - 18 - 3 - 98368 - - - 7 - 4 - 19 - 1 - 98368 - - - 9 - 4 - 20 - 3 - 98368 - - - 11 - 4 - 21 - 1 - 98368 - - - 13 - 4 - 22 - 3 - 98368 - - - 15 - 4 - 23 - 1 - 98368 - - - 17 - 4 - 24 - 3 - 98368 - - - 19 - 4 - 25 - 1 - 98368 - - - 21 - 4 - 26 - 3 - 98368 - - - 23 - 4 - 27 - 1 - 98368 - - - 25 - 4 - 28 - 3 - 98368 - - - 27 - 4 - 29 - 1 - 98368 - - - 29 - 4 - 30 - 3 - 98368 - - - 31 - 4 - 31 - 1 - 98368 - - - 33 - 4 - 14 - 3 - 98368 - - - 35 - 4 - 15 - 1 - 98368 - - - 37 - 4 - 12 - 3 - 98368 - - - 39 - 4 - 13 - 1 - 98368 - - - 41 - 4 - 10 - 3 - 98368 - - - 43 - 4 - 11 - 1 - 98368 - - - 45 - 4 - 8 - 3 - 98368 - - - 47 - 4 - 9 - 1 - 98368 - - - 49 - 4 - 6 - 3 - 98368 - - - 51 - 4 - 7 - 1 - 98368 - - - 53 - 4 - 4 - 3 - 98368 - - - 55 - 4 - 5 - 1 - 98368 - - - 57 - 4 - 2 - 3 - 98368 - - - 59 - 4 - 3 - 1 - 98368 - - - 61 - 4 - 0 - 3 - 98368 - - - 63 - 4 - 1 - 1 - 98368 - - - - diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/hw-management b/device/mellanox/x86_64-mlnx_lssn2700-r0/hw-management deleted file mode 120000 index eb5e941daad7..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/hw-management +++ /dev/null @@ -1 +0,0 @@ -/etc/mlnx/msn2700 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf b/device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf deleted file mode 100644 index c9c9493a5404..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf +++ /dev/null @@ -1 +0,0 @@ -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf b/device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf new file mode 120000 index 000000000000..955db12ff425 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/installer.conf @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/installer.conf \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/eeprom.py deleted file mode 100644 index 3650d9c8b70b..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/eeprom.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -############################################################################# -# Mellanox -# -# Platform and model specific eeprom subclass, inherits from the base class, -# and provides the followings: -# - the eeprom format definition -# - specific encoder/decoder if there is special need -############################################################################# - -try: - import exceptions - import binascii - import time - import optparse - import warnings - import os - import sys - from sonic_eeprom import eeprom_base - from sonic_eeprom import eeprom_tlvinfo - import subprocess -except ImportError, e: - raise ImportError (str(e) + "- required module not found") - -class board(eeprom_tlvinfo.TlvInfoDecoder): - - _TLV_INFO_MAX_LEN = 256 - - def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/bsp/eeprom/sys_eeprom" - super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/psuutil.py deleted file mode 100644 index 301569c13a94..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/psuutil.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python - -############################################################################# -# Mellanox -# -# Module contains an implementation of SONiC PSU Base API and -# provides the PSUs status which are available in the platform -# -############################################################################# - -import os.path - -try: - from sonic_psu.psu_base import PsuBase -except ImportError as e: - raise ImportError (str(e) + "- required module not found") - -class PsuUtil(PsuBase): - """Platform-specific PSUutil class""" - - def __init__(self): - PsuBase.__init__(self) - - self.psu_path = "/sys/bus/i2c/devices/2-0060/" - self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pg_status" - - def get_num_psus(self): - """ - Retrieves the number of PSUs available on the device - - :return: An integer, the number of PSUs available on the device - """ - return 2 - - def get_psu_status(self, index): - """ - Retrieves the oprational status of power supply unit (PSU) defined - by 1-based index - - :param index: An integer, 1-based index of the PSU of which to query status - :return: Boolean, True if PSU is operating properly, False if PSU is faulty - """ - if index is None: - return False - - status = 0 - try: - with open(self.psu_path + self.psu_oper_status.format(index), 'r') as power_status: - status = int(power_status.read()) - except IOError: - return False - - return status == 1 - - def get_psu_presence(self, index): - """ - Retrieves the presence status of power supply unit (PSU) defined - by 1-based index - - :param index: An integer, 1-based index of the PSU of which to query status - :return: Boolean, True if PSU is plugged, False if not - """ - if index is None: - return False - - status = 0 - try: - with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: - status = int(presence_status.read()) - except IOError: - return False - - return status == 1 diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmget.py deleted file mode 100644 index 170766e9bce4..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmget.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -# Check if SFP port number is provided -if len(sys.argv) < 2: - print "SFP module number is missed." - print "Usage: sfplpmget.py " - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -# Get SFP module number -sfp_module = int(sys.argv[1]) - -# Get MCION -mcion = ku_mcion_reg() -mcion.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET - -rc = sxd_access_reg_mcion(mcion, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_mcion failed, rc = %d" % rc - -# Get low power mode status -lpm_mask = 1 << 8 -lpm_status = (lpm_mask & mcion.module_status_bits) != 0 -print "LPM ON" if lpm_status else "LPM OFF" diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmset.py deleted file mode 100644 index 3f31af9f2944..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfplpmset.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import time -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -def get_log_ports(handle, sfp_module): - port_attributes_list = new_sx_port_attributes_t_arr(64) - port_cnt_p = new_uint32_t_p() - uint32_t_p_assign(port_cnt_p, 64) - - rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) - assert rc == SX_STATUS_SUCCESS, "sx_api_port_device_get failed, rc = %d" % rc - - port_cnt = uint32_t_p_value(port_cnt_p) - 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: - log_port_list.append(port_attributes.log_port) - - return log_port_list - -def set_sfp_admin_status(handle, meta, sfp_module, sfp_log_port_list, admin_status): - # Get PMAOS - pmaos = ku_pmaos_reg() - pmaos.module = sfp_module - meta.access_cmd = SXD_ACCESS_CMD_GET - rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) - assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - - # Set admin status to PMAOS - pmaos.ase = 1 - pmaos.ee = 1 - pmaos.e = 2 - pmaos.rst = 0 - if admin_status == SX_PORT_ADMIN_STATUS_DOWN: - pmaos.admin_status = 2 - else: - pmaos.admin_status = 1 - - meta.access_cmd = SXD_ACCESS_CMD_SET - rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) - assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - -# Check if SFP port number is provided -if len(sys.argv) < 3: - print "SFP module number or LPM is missed." - print "Usage: sfplpmset.py " - sys.exit(errno.EINVAL) - -lpm_enable = None -if sys.argv[2] == 'on': - lpm_enable = True -elif sys.argv[2] == 'off': - lpm_enable = False -else: - print "Unrecognized LPM parameter. Please use or values" - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES); - -# Get SFP module and log ports number and LPM status -sfp_module = int(sys.argv[1]) -log_port_list = get_log_ports(handle, sfp_module) -if not log_port_list: - print "Failed to get log ports" - sys.exit(errno.EACCES) - -# Get PMMP -pmmp = ku_pmmp_reg() -pmmp.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET -rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc - -# Disable admin status before LPM settings -set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_DOWN) - -# Set low power mode status -lpm_mask = 1 << 8 -if lpm_enable: - pmmp.eeprom_override = pmmp.eeprom_override | lpm_mask -else: - pmmp.eeprom_override = pmmp.eeprom_override & (~lpm_mask) - -meta.access_cmd = SXD_ACCESS_CMD_SET -rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc - -# Enable admin status after LPM settings -set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_UP) diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfpreset.py deleted file mode 100644 index 69fa2be614c2..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfpreset.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -# Check if SFP port number is provided -if len(sys.argv) < 2: - print "SFP module number or LPM is missed." - print "Usage: sfpreset.py " - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -# Get SFP module number -sfp_module = int(sys.argv[1]) - -# Get PMAOS -pmaos = ku_pmaos_reg() -pmaos.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET - -rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - -# Reset SFP -pmaos.rst = 1 -meta.access_cmd = SXD_ACCESS_CMD_SET -rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc -print "Reset flag is set" diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py deleted file mode 100644 index 2eb3d628ff9f..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/plugins/sfputil.py +++ /dev/null @@ -1,190 +0,0 @@ -# sfputil.py -# -# Platform-specific SFP transceiver interface for SONiC -# - -try: - import time - import subprocess - from sonic_sfp.sfputilbase import SfpUtilBase -except ImportError as e: - raise ImportError("%s - required module not found" % str(e)) - -# parameters for DB connection -REDIS_HOSTNAME = "localhost" -REDIS_PORT = 6379 -REDIS_TIMEOUT_USECS = 0 - -class SfpUtil(SfpUtilBase): - """Platform-specific SfpUtil class""" - PORT_START = 0 - PORT_END = 31 - PORTS_IN_BLOCK = 32 - - EEPROM_OFFSET = 1 - - _port_to_eeprom_mapping = {} - - db_sel = None - db_sel_timeout = None - db_sel_object = None - db_sel_tbl = None - state_db = None - - @property - def port_start(self): - return self.PORT_START - - @property - def port_end(self): - return self.PORT_END - - @property - def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) - - @property - def port_to_eeprom_mapping(self): - return self._port_to_eeprom_mapping - - def __init__(self): - eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon7/qsfp{0}_eeprom" - - for x in range(0, self.port_end + 1): - self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) - - SfpUtilBase.__init__(self) - - def get_presence(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - try: - reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) - except IOError as e: - print "Error: unable to open file: %s" % str(e) - return False - - content = reg_file.readline().rstrip() - - # content is a string with the qsfp status - if content == "good": - return True - - return False - - def get_low_power_mode(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmget.py {}".format(port_num) - - try: - output = subprocess.check_output(lpm_cmd, shell=True) - if 'LPM ON' in output: - return True - except subprocess.CalledProcessError as e: - print "Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - return False - - def set_low_power_mode(self, port_num, lpmode): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - curr_lpmode = self.get_low_power_mode(port_num) - if curr_lpmode == lpmode: - return True - - lpm = 'on' if lpmode else 'off' - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmset.py {} {}".format(port_num, lpm) - sfp_port_names = self.physical_to_logical[port_num] - - # Get port admin status - try: - enabled_ports = subprocess.check_output("ip link show up", shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to get ports status, err msg: {}".format(e.output) - return False - - port_to_disable = [] - for port in sfp_port_names: - if port in enabled_ports: - port_to_disable.append(port) - - # Disable ports before LPM settings - for port in port_to_disable: - try: - subprocess.check_output("ifconfig {} down".format(port), shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set admin status to DOWN for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) - return False - - time.sleep(3) - - # Set LPM - try: - subprocess.check_output(lpm_cmd, shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - # Enable ports after LPM settings - for port in port_to_disable: - try: - subprocess.check_output("ifconfig {} up".format(port), shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set admin status to UP for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) - return False - - return True - - def reset(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfpreset.py {}".format(port_num) - - try: - subprocess.check_output(lpm_cmd, shell=True) - return True - except subprocess.CalledProcessError as e: - print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - return False - - def get_transceiver_change_event(self, timeout=0): - phy_port_dict = {} - status = True - - if self.db_sel == None: - from swsscommon import swsscommon - self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, - REDIS_HOSTNAME, - REDIS_PORT, - REDIS_TIMEOUT_USECS) - - # Subscribe to state table for SFP change notifications - self.db_sel = swsscommon.Select() - self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') - self.db_sel.addSelectable(self.db_sel_tbl) - self.db_sel_timeout = swsscommon.Select.TIMEOUT - self.db_sel_object = swsscommon.Select.OBJECT - - (state, c) = self.db_sel.select(timeout) - if state == self.db_sel_timeout: - status = True - elif state != self.db_sel_object: - status = False - else: - (key, op, fvp) = self.db_sel_tbl.pop() - phy_port_dict[key] = op - - return status, phy_port_dict - diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf b/device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf deleted file mode 100644 index a3e30391863e..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf +++ /dev/null @@ -1,21 +0,0 @@ -bus "i2c-7" "i2c-1-mux (chan_id 5)" -chip "lm75-i2c-7-4a" - label temp1 "Ambient Port Temp" - -bus "i2c-5" "i2c-1-mux (chan_id 3)" -chip "ucd9200-i2c-5-27" - label in1 "UCD1 vin" - label in2 "ASIC 3.3 vout" - label in3 "ASIC 1.2 vout" - label temp1 "UCD1 Temp" - label temp2 "UCD1 Temp2" - -chip "ucd9200-i2c-5-41" - label in1 "UCD2 vin" - label in2 "ASIC Vcore vout" - label temp1 "UCD2 Temp1" - label temp2 "UCD2 Temp2" - -bus "i2c-17" "i2c-1-mux (chan_id 7)" -chip "lm75-i2c-17-49" - label temp1 "Ambient Board Temp" diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf b/device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf new file mode 120000 index 000000000000..ea04d66d008c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/sensors.conf @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/sensors.conf \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini deleted file mode 100644 index b66b129fe43f..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 34816 18432 16384 0 - 25000 5m 34816 18432 16384 0 - 40000 5m 34816 18432 16384 0 - 50000 5m 34816 18432 16384 0 - 100000 5m 36864 18432 18432 0 - 10000 40m 36864 18432 18432 0 - 25000 40m 39936 18432 21504 0 - 40000 40m 41984 18432 23552 0 - 50000 40m 41984 18432 23552 0 - 100000 40m 54272 18432 35840 0 - 10000 300m 49152 18432 30720 0 - 25000 300m 71680 18432 53248 0 - 40000 300m 94208 18432 75776 0 - 50000 300m 94208 18432 75776 0 - 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini new file mode 120000 index 000000000000..3c97f3dcb16f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/pg_profile_lookup.ini @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf b/device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf deleted file mode 100644 index c9c9493a5404..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf +++ /dev/null @@ -1 +0,0 @@ -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf b/device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf new file mode 120000 index 000000000000..955db12ff425 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/installer.conf @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/installer.conf \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf deleted file mode 100644 index a3e30391863e..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf +++ /dev/null @@ -1,21 +0,0 @@ -bus "i2c-7" "i2c-1-mux (chan_id 5)" -chip "lm75-i2c-7-4a" - label temp1 "Ambient Port Temp" - -bus "i2c-5" "i2c-1-mux (chan_id 3)" -chip "ucd9200-i2c-5-27" - label in1 "UCD1 vin" - label in2 "ASIC 3.3 vout" - label in3 "ASIC 1.2 vout" - label temp1 "UCD1 Temp" - label temp2 "UCD1 Temp2" - -chip "ucd9200-i2c-5-41" - label in1 "UCD2 vin" - label in2 "ASIC Vcore vout" - label temp1 "UCD2 Temp1" - label temp2 "UCD2 Temp2" - -bus "i2c-17" "i2c-1-mux (chan_id 7)" -chip "lm75-i2c-17-49" - label temp1 "Ambient Board Temp" diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf new file mode 120000 index 000000000000..ea04d66d008c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/sensors.conf \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini deleted file mode 100644 index b66b129fe43f..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 34816 18432 16384 0 - 25000 5m 34816 18432 16384 0 - 40000 5m 34816 18432 16384 0 - 50000 5m 34816 18432 16384 0 - 100000 5m 36864 18432 18432 0 - 10000 40m 36864 18432 18432 0 - 25000 40m 39936 18432 21504 0 - 40000 40m 41984 18432 23552 0 - 50000 40m 41984 18432 23552 0 - 100000 40m 54272 18432 35840 0 - 10000 300m 49152 18432 30720 0 - 25000 300m 71680 18432 53248 0 - 40000 300m 94208 18432 75776 0 - 50000 300m 94208 18432 75776 0 - 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini new file mode 120000 index 000000000000..3c97f3dcb16f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/pg_profile_lookup.ini @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf b/device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf deleted file mode 100644 index c9c9493a5404..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf +++ /dev/null @@ -1 +0,0 @@ -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf b/device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf new file mode 120000 index 000000000000..955db12ff425 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/installer.conf @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/installer.conf \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf deleted file mode 100644 index a3e30391863e..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf +++ /dev/null @@ -1,21 +0,0 @@ -bus "i2c-7" "i2c-1-mux (chan_id 5)" -chip "lm75-i2c-7-4a" - label temp1 "Ambient Port Temp" - -bus "i2c-5" "i2c-1-mux (chan_id 3)" -chip "ucd9200-i2c-5-27" - label in1 "UCD1 vin" - label in2 "ASIC 3.3 vout" - label in3 "ASIC 1.2 vout" - label temp1 "UCD1 Temp" - label temp2 "UCD1 Temp2" - -chip "ucd9200-i2c-5-41" - label in1 "UCD2 vin" - label in2 "ASIC Vcore vout" - label temp1 "UCD2 Temp1" - label temp2 "UCD2 Temp2" - -bus "i2c-17" "i2c-1-mux (chan_id 7)" -chip "lm75-i2c-17-49" - label temp1 "Ambient Board Temp" diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf new file mode 120000 index 000000000000..ea04d66d008c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/sensors.conf \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers.json.j2 deleted file mode 100644 index 1083a6210fc9..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers.json.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{%- set default_topo = 't0' %} -{%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers.json.j2 new file mode 120000 index 000000000000..30c4e1d5bfdd --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/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-D48C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 deleted file mode 100644 index 475a0227143c..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 +++ /dev/null @@ -1,90 +0,0 @@ -{% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '4194304' %} -{% set ingress_lossy_pool_size = '7340032' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '7340032' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"0" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"4096", - "dynamic_th":"3" - }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - } - }, -{%- endmacro %} - -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - } - } -{%- endmacro %} - -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - } - } -{%- endmacro %} - - diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..a722094938f8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/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-D48C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 deleted file mode 100644 index c292ecc2f21a..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 +++ /dev/null @@ -1,90 +0,0 @@ -{% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '2097152' %} -{% set ingress_lossy_pool_size = '5242880' %} -{% set egress_lossless_pool_size = '16777152' %} -{% set egress_lossy_pool_size = '5242880' %} - -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"0" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"4096", - "dynamic_th":"3" - }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - } - }, -{%- endmacro %} - -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile],[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { - "{{ port_names }}": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - } - } -{%- endmacro %} - -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - } - } -{%- endmacro %} - - diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..b02d5e0194ac --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/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-D48C8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini deleted file mode 100644 index b66b129fe43f..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 34816 18432 16384 0 - 25000 5m 34816 18432 16384 0 - 40000 5m 34816 18432 16384 0 - 50000 5m 34816 18432 16384 0 - 100000 5m 36864 18432 18432 0 - 10000 40m 36864 18432 18432 0 - 25000 40m 39936 18432 21504 0 - 40000 40m 41984 18432 23552 0 - 50000 40m 41984 18432 23552 0 - 100000 40m 54272 18432 35840 0 - 10000 300m 49152 18432 30720 0 - 25000 300m 71680 18432 53248 0 - 40000 300m 94208 18432 75776 0 - 50000 300m 94208 18432 75776 0 - 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini new file mode 120000 index 000000000000..229a556f88a8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/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_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini deleted file mode 100644 index b66b129fe43f..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold - 10000 5m 34816 18432 16384 0 - 25000 5m 34816 18432 16384 0 - 40000 5m 34816 18432 16384 0 - 50000 5m 34816 18432 16384 0 - 100000 5m 36864 18432 18432 0 - 10000 40m 36864 18432 18432 0 - 25000 40m 39936 18432 21504 0 - 40000 40m 41984 18432 23552 0 - 50000 40m 41984 18432 23552 0 - 100000 40m 54272 18432 35840 0 - 10000 300m 49152 18432 30720 0 - 25000 300m 71680 18432 53248 0 - 40000 300m 94208 18432 75776 0 - 50000 300m 94208 18432 75776 0 - 100000 300m 184320 18432 165888 0 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini new file mode 120000 index 000000000000..3c97f3dcb16f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/pg_profile_lookup.ini @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf b/device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf deleted file mode 100644 index c9c9493a5404..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf +++ /dev/null @@ -1 +0,0 @@ -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax acpi=noirq" diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf b/device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf new file mode 120000 index 000000000000..955db12ff425 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/installer.conf @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/installer.conf \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf deleted file mode 100644 index a3e30391863e..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf +++ /dev/null @@ -1,21 +0,0 @@ -bus "i2c-7" "i2c-1-mux (chan_id 5)" -chip "lm75-i2c-7-4a" - label temp1 "Ambient Port Temp" - -bus "i2c-5" "i2c-1-mux (chan_id 3)" -chip "ucd9200-i2c-5-27" - label in1 "UCD1 vin" - label in2 "ASIC 3.3 vout" - label in3 "ASIC 1.2 vout" - label temp1 "UCD1 Temp" - label temp2 "UCD1 Temp2" - -chip "ucd9200-i2c-5-41" - label in1 "UCD2 vin" - label in2 "ASIC Vcore vout" - label temp1 "UCD2 Temp1" - label temp2 "UCD2 Temp2" - -bus "i2c-17" "i2c-1-mux (chan_id 7)" -chip "lm75-i2c-17-49" - label temp1 "Ambient Board Temp" diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf new file mode 120000 index 000000000000..ea04d66d008c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/sensors.conf \ No newline at end of file diff --git a/src/sonic-device-data/Makefile b/src/sonic-device-data/Makefile index dc45dc6bff9f..911c8641a682 100644 --- a/src/sonic-device-data/Makefile +++ b/src/sonic-device-data/Makefile @@ -12,7 +12,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Create a new dir and copy all ONIE-platform-string-named dirs into it mkdir ./device - cp -r ../../../device/*/* ./device/ + cp -r -H ../../../device/*/* ./device/ # Build the package dpkg-buildpackage -rfakeroot -b -us -uc From fd5bce57ddadf4ea7214c4c3538a280fec66ac42 Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Fri, 17 Aug 2018 00:38:33 +0700 Subject: [PATCH 1557/1833] [device/dx010] configuration port index start from 1 (#1927) * update sfputil, port indext start from 1 * DX010 update SKUs port config index Port index in port_config.ini now start from 1. * Seastone-DX010-10-50 port config update * Seastone-DX010-50 port config update * Seastone-DX010 port config update * Update dx010 sfputil plugin * Implement lpmode set function. * Implement transceiver reset function. * Python code style format. * Remove new line at the end of port_config.ini *New line cause parsing error in sfputilbase. * Add get_transceiver_change_event method *This needed by new sfputilbase implement. * Fix unintended line breaks --- .../Seastone-DX010-10-50/port_config.ini | 224 +++++++++--------- .../Seastone-DX010-50/port_config.ini | 128 +++++----- .../Seastone-DX010/port_config.ini | 64 ++--- .../x86_64-cel_seastone-r0/plugins/sfputil.py | 120 +++++++++- 4 files changed, 319 insertions(+), 217 deletions(-) mode change 100755 => 100644 device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini index 383cc5a6a7ab..7f977a26e1f3 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/port_config.ini @@ -1,113 +1,113 @@ # name lanes alias index speed -Ethernet0 65 Eth1/1 0 10000 -Ethernet1 66 Eth1/2 0 10000 -Ethernet2 67 Eth1/3 0 10000 -Ethernet3 68 Eth1/4 0 10000 -Ethernet4 69 Eth2/1 1 10000 -Ethernet5 70 Eth2/2 1 10000 -Ethernet6 71 Eth2/3 1 10000 -Ethernet7 72 Eth2/4 1 10000 -Ethernet8 73 Eth3/1 2 10000 -Ethernet9 74 Eth3/2 2 10000 -Ethernet10 75 Eth3/3 2 10000 -Ethernet11 76 Eth3/4 2 10000 -Ethernet12 77 Eth4/1 3 10000 -Ethernet13 78 Eth4/2 3 10000 -Ethernet14 79 Eth4/3 3 10000 -Ethernet15 80 Eth4/4 3 10000 -Ethernet16 33 Eth5/1 4 10000 -Ethernet17 34 Eth5/2 4 10000 -Ethernet18 35 Eth5/3 4 10000 -Ethernet19 36 Eth5/4 4 10000 -Ethernet20 37 Eth6/1 5 10000 -Ethernet21 38 Eth6/2 5 10000 -Ethernet22 39 Eth6/3 5 10000 -Ethernet23 40 Eth6/4 5 10000 -Ethernet24 41 Eth7/1 6 10000 -Ethernet25 42 Eth7/2 6 10000 -Ethernet26 43 Eth7/3 6 10000 -Ethernet27 44 Eth7/4 6 10000 -Ethernet28 45 Eth8/1 7 10000 -Ethernet29 46 Eth8/2 7 10000 -Ethernet30 47 Eth8/3 7 10000 -Ethernet31 48 Eth8/4 7 10000 -Ethernet32 49 Eth9/1 8 10000 -Ethernet33 50 Eth9/2 8 10000 -Ethernet34 51 Eth9/3 8 10000 -Ethernet35 52 Eth9/4 8 10000 -Ethernet36 53 Eth10/1 9 10000 -Ethernet37 54 Eth10/2 9 10000 -Ethernet38 55 Eth10/3 9 10000 -Ethernet39 56 Eth10/4 9 10000 -Ethernet40 57 Eth11/1 10 10000 -Ethernet41 58 Eth11/2 10 10000 -Ethernet42 59 Eth11/3 10 10000 -Ethernet43 60 Eth11/4 10 10000 -Ethernet44 61 Eth12/1 11 10000 -Ethernet45 62 Eth12/2 11 10000 -Ethernet46 63 Eth12/3 11 10000 -Ethernet47 64 Eth12/4 11 10000 -Ethernet48 81 Eth13/1 12 10000 -Ethernet49 82 Eth13/2 12 10000 -Ethernet50 83 Eth13/3 12 10000 -Ethernet51 84 Eth13/4 12 10000 -Ethernet52 85 Eth14/1 13 10000 -Ethernet53 86 Eth14/2 13 10000 -Ethernet54 87 Eth14/3 13 10000 -Ethernet55 88 Eth14/4 13 10000 -Ethernet56 89 Eth15/1 14 10000 -Ethernet57 90 Eth15/2 14 10000 -Ethernet58 91 Eth15/3 14 10000 -Ethernet59 92 Eth15/4 14 10000 -Ethernet60 93 Eth16/1 15 10000 -Ethernet61 94 Eth16/2 15 10000 -Ethernet62 95 Eth16/3 15 10000 -Ethernet63 96 Eth16/4 15 10000 -Ethernet64 97 Eth17/1 16 10000 -Ethernet65 98 Eth17/2 16 10000 -Ethernet66 99 Eth17/3 16 10000 -Ethernet67 100 Eth17/4 16 10000 -Ethernet68 101 Eth18/1 17 10000 -Ethernet69 102 Eth18/2 17 10000 -Ethernet70 103 Eth18/3 17 10000 -Ethernet71 104 Eth18/4 17 10000 -Ethernet72 105 Eth19/1 18 10000 -Ethernet73 106 Eth19/2 18 10000 -Ethernet74 107 Eth19/3 18 10000 -Ethernet75 108 Eth19/4 18 10000 -Ethernet76 109 Eth20/1 19 10000 -Ethernet77 110 Eth20/2 19 10000 -Ethernet78 111 Eth20/3 19 10000 -Ethernet79 112 Eth20/4 19 10000 -Ethernet80 1 Eth21/1 20 10000 -Ethernet81 2 Eth21/2 20 10000 -Ethernet82 3 Eth21/3 20 10000 -Ethernet83 4 Eth21/4 20 10000 -Ethernet84 5 Eth22/1 21 10000 -Ethernet85 6 Eth22/2 21 10000 -Ethernet86 7 Eth22/3 21 10000 -Ethernet87 8 Eth22/4 21 10000 -Ethernet88 9 Eth23/1 22 10000 -Ethernet89 10 Eth23/2 22 10000 -Ethernet90 11 Eth23/3 22 10000 -Ethernet91 12 Eth23/4 22 10000 -Ethernet92 13 Eth24/1 23 10000 -Ethernet93 14 Eth24/2 23 10000 -Ethernet94 15 Eth24/3 23 10000 -Ethernet95 16 Eth24/4 23 10000 -Ethernet96 17,18 Eth25/1 24 50000 -Ethernet98 19,20 Eth25/2 24 50000 -Ethernet100 21,22 Eth26/1 25 50000 -Ethernet102 23,24 Eth26/2 25 50000 -Ethernet104 25,26 Eth27/1 26 50000 -Ethernet106 27,28 Eth27/2 26 50000 -Ethernet108 29,30 Eth28/1 27 50000 -Ethernet110 31,32 Eth28/2 27 50000 -Ethernet112 113,114 Eth29/1 28 50000 -Ethernet114 115,116 Eth29/2 28 50000 -Ethernet116 117,118 Eth30/1 29 50000 -Ethernet118 119,120 Eth30/2 29 50000 -Ethernet120 121,122 Eth31/1 30 50000 -Ethernet122 123,124 Eth31/2 30 50000 -Ethernet124 125,126 Eth32/1 31 50000 -Ethernet126 127,128 Eth32/2 31 50000 +Ethernet0 65 Eth1/1 1 10000 +Ethernet1 66 Eth1/2 1 10000 +Ethernet2 67 Eth1/3 1 10000 +Ethernet3 68 Eth1/4 1 10000 +Ethernet4 69 Eth2/1 2 10000 +Ethernet5 70 Eth2/2 2 10000 +Ethernet6 71 Eth2/3 2 10000 +Ethernet7 72 Eth2/4 2 10000 +Ethernet8 73 Eth3/1 3 10000 +Ethernet9 74 Eth3/2 3 10000 +Ethernet10 75 Eth3/3 3 10000 +Ethernet11 76 Eth3/4 3 10000 +Ethernet12 77 Eth4/1 4 10000 +Ethernet13 78 Eth4/2 4 10000 +Ethernet14 79 Eth4/3 4 10000 +Ethernet15 80 Eth4/4 4 10000 +Ethernet16 33 Eth5/1 5 10000 +Ethernet17 34 Eth5/2 5 10000 +Ethernet18 35 Eth5/3 5 10000 +Ethernet19 36 Eth5/4 5 10000 +Ethernet20 37 Eth6/1 6 10000 +Ethernet21 38 Eth6/2 6 10000 +Ethernet22 39 Eth6/3 6 10000 +Ethernet23 40 Eth6/4 6 10000 +Ethernet24 41 Eth7/1 7 10000 +Ethernet25 42 Eth7/2 7 10000 +Ethernet26 43 Eth7/3 7 10000 +Ethernet27 44 Eth7/4 7 10000 +Ethernet28 45 Eth8/1 8 10000 +Ethernet29 46 Eth8/2 8 10000 +Ethernet30 47 Eth8/3 8 10000 +Ethernet31 48 Eth8/4 8 10000 +Ethernet32 49 Eth9/1 9 10000 +Ethernet33 50 Eth9/2 9 10000 +Ethernet34 51 Eth9/3 9 10000 +Ethernet35 52 Eth9/4 9 10000 +Ethernet36 53 Eth10/1 10 10000 +Ethernet37 54 Eth10/2 10 10000 +Ethernet38 55 Eth10/3 10 10000 +Ethernet39 56 Eth10/4 10 10000 +Ethernet40 57 Eth11/1 11 10000 +Ethernet41 58 Eth11/2 11 10000 +Ethernet42 59 Eth11/3 11 10000 +Ethernet43 60 Eth11/4 11 10000 +Ethernet44 61 Eth12/1 12 10000 +Ethernet45 62 Eth12/2 12 10000 +Ethernet46 63 Eth12/3 12 10000 +Ethernet47 64 Eth12/4 12 10000 +Ethernet48 81 Eth13/1 13 10000 +Ethernet49 82 Eth13/2 13 10000 +Ethernet50 83 Eth13/3 13 10000 +Ethernet51 84 Eth13/4 13 10000 +Ethernet52 85 Eth14/1 14 10000 +Ethernet53 86 Eth14/2 14 10000 +Ethernet54 87 Eth14/3 14 10000 +Ethernet55 88 Eth14/4 14 10000 +Ethernet56 89 Eth15/1 15 10000 +Ethernet57 90 Eth15/2 15 10000 +Ethernet58 91 Eth15/3 15 10000 +Ethernet59 92 Eth15/4 15 10000 +Ethernet60 93 Eth16/1 16 10000 +Ethernet61 94 Eth16/2 16 10000 +Ethernet62 95 Eth16/3 16 10000 +Ethernet63 96 Eth16/4 16 10000 +Ethernet64 97 Eth17/1 17 10000 +Ethernet65 98 Eth17/2 17 10000 +Ethernet66 99 Eth17/3 17 10000 +Ethernet67 100 Eth17/4 17 10000 +Ethernet68 101 Eth18/1 18 10000 +Ethernet69 102 Eth18/2 18 10000 +Ethernet70 103 Eth18/3 18 10000 +Ethernet71 104 Eth18/4 18 10000 +Ethernet72 105 Eth19/1 19 10000 +Ethernet73 106 Eth19/2 19 10000 +Ethernet74 107 Eth19/3 19 10000 +Ethernet75 108 Eth19/4 19 10000 +Ethernet76 109 Eth20/1 20 10000 +Ethernet77 110 Eth20/2 20 10000 +Ethernet78 111 Eth20/3 20 10000 +Ethernet79 112 Eth20/4 20 10000 +Ethernet80 1 Eth21/1 21 10000 +Ethernet81 2 Eth21/2 21 10000 +Ethernet82 3 Eth21/3 21 10000 +Ethernet83 4 Eth21/4 21 10000 +Ethernet84 5 Eth22/1 22 10000 +Ethernet85 6 Eth22/2 22 10000 +Ethernet86 7 Eth22/3 22 10000 +Ethernet87 8 Eth22/4 22 10000 +Ethernet88 9 Eth23/1 23 10000 +Ethernet89 10 Eth23/2 23 10000 +Ethernet90 11 Eth23/3 23 10000 +Ethernet91 12 Eth23/4 23 10000 +Ethernet92 13 Eth24/1 24 10000 +Ethernet93 14 Eth24/2 24 10000 +Ethernet94 15 Eth24/3 25 10000 +Ethernet95 16 Eth24/4 25 10000 +Ethernet96 17,18 Eth25/1 26 50000 +Ethernet98 19,20 Eth25/2 26 50000 +Ethernet100 21,22 Eth26/1 27 50000 +Ethernet102 23,24 Eth26/2 27 50000 +Ethernet104 25,26 Eth27/1 28 50000 +Ethernet106 27,28 Eth27/2 28 50000 +Ethernet108 29,30 Eth28/1 29 50000 +Ethernet110 31,32 Eth28/2 29 50000 +Ethernet112 113,114 Eth29/1 30 50000 +Ethernet114 115,116 Eth29/2 30 50000 +Ethernet116 117,118 Eth30/1 31 50000 +Ethernet118 119,120 Eth30/2 31 50000 +Ethernet120 121,122 Eth31/1 32 50000 +Ethernet122 123,124 Eth31/2 32 50000 +Ethernet124 125,126 Eth32/1 32 50000 +Ethernet126 127,128 Eth32/2 32 50000 \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini index 3e2a0ebeafd5..bed33e9ed0f5 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/port_config.ini @@ -1,65 +1,65 @@ # 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 Eth17/1 16 50000 -Ethernet66 99,100 Eth17/2 16 50000 -Ethernet68 101,102 Eth18/1 17 50000 -Ethernet70 103,104 Eth18/2 17 50000 -Ethernet72 105,106 Eth19/1 18 50000 -Ethernet74 107,108 Eth19/2 18 50000 -Ethernet76 109,110 Eth20/1 19 50000 -Ethernet78 111,112 Eth20/2 19 50000 -Ethernet80 1,2 Eth21/1 20 50000 -Ethernet82 3,4 Eth21/2 20 50000 -Ethernet84 5,6 Eth22/1 21 50000 -Ethernet86 7,8 Eth22/2 21 50000 -Ethernet88 9,10 Eth23/1 22 50000 -Ethernet90 11,12 Eth23/2 22 50000 -Ethernet92 13,14 Eth24/1 23 50000 -Ethernet94 15,16 Eth24/2 23 50000 -Ethernet96 17,18 Eth25/1 24 50000 -Ethernet98 19,20 Eth25/2 24 50000 -Ethernet100 21,22 Eth26/1 25 50000 -Ethernet102 23,24 Eth26/2 25 50000 -Ethernet104 25,26 Eth27/1 26 50000 -Ethernet106 27,28 Eth27/2 26 50000 -Ethernet108 29,30 Eth28/1 27 50000 -Ethernet110 31,32 Eth28/2 27 50000 -Ethernet112 113,114 Eth29/1 28 50000 -Ethernet114 115,116 Eth29/2 28 50000 -Ethernet116 117,118 Eth30/1 29 50000 -Ethernet118 119,120 Eth30/2 29 50000 -Ethernet120 121,122 Eth31/1 30 50000 -Ethernet122 123,124 Eth31/2 30 50000 -Ethernet124 125,126 Eth32/1 31 50000 -Ethernet126 127,128 Eth32/2 31 50000 +Ethernet0 65,66 Eth1/1 1 50000 +Ethernet2 67,68 Eth1/2 1 50000 +Ethernet4 69,70 Eth2/1 2 50000 +Ethernet6 71,72 Eth2/2 2 50000 +Ethernet8 73,74 Eth3/1 3 50000 +Ethernet10 75,76 Eth3/2 3 50000 +Ethernet12 77,78 Eth4/1 4 50000 +Ethernet14 79,80 Eth4/2 4 50000 +Ethernet16 33,34 Eth5/1 5 50000 +Ethernet18 35,36 Eth5/2 5 50000 +Ethernet20 37,38 Eth6/1 6 50000 +Ethernet22 39,40 Eth6/2 6 50000 +Ethernet24 41,42 Eth7/1 7 50000 +Ethernet26 43,44 Eth7/2 7 50000 +Ethernet28 45,46 Eth8/1 8 50000 +Ethernet30 47,48 Eth8/2 8 50000 +Ethernet32 49,50 Eth9/1 9 50000 +Ethernet34 51,52 Eth9/2 9 50000 +Ethernet36 53,54 Eth10/1 10 50000 +Ethernet38 55,56 Eth10/2 10 50000 +Ethernet40 57,58 Eth11/1 11 50000 +Ethernet42 59,60 Eth11/2 11 50000 +Ethernet44 61,62 Eth12/1 12 50000 +Ethernet46 63,64 Eth12/2 12 50000 +Ethernet48 81,82 Eth13/1 13 50000 +Ethernet50 83,84 Eth13/2 13 50000 +Ethernet52 85,86 Eth14/1 14 50000 +Ethernet54 87,88 Eth14/2 14 50000 +Ethernet56 89,90 Eth15/1 15 50000 +Ethernet58 91,92 Eth15/2 15 50000 +Ethernet60 93,94 Eth16/1 16 50000 +Ethernet62 95,96 Eth16/2 16 50000 +Ethernet64 97,98 Eth17/1 17 50000 +Ethernet66 99,100 Eth17/2 17 50000 +Ethernet68 101,102 Eth18/1 18 50000 +Ethernet70 103,104 Eth18/2 18 50000 +Ethernet72 105,106 Eth19/1 19 50000 +Ethernet74 107,108 Eth19/2 19 50000 +Ethernet76 109,110 Eth20/1 20 50000 +Ethernet78 111,112 Eth20/2 20 50000 +Ethernet80 1,2 Eth21/1 21 50000 +Ethernet82 3,4 Eth21/2 21 50000 +Ethernet84 5,6 Eth22/1 22 50000 +Ethernet86 7,8 Eth22/2 22 50000 +Ethernet88 9,10 Eth23/1 23 50000 +Ethernet90 11,12 Eth23/2 23 50000 +Ethernet92 13,14 Eth24/1 24 50000 +Ethernet94 15,16 Eth24/2 24 50000 +Ethernet96 17,18 Eth25/1 25 50000 +Ethernet98 19,20 Eth25/2 25 50000 +Ethernet100 21,22 Eth26/1 26 50000 +Ethernet102 23,24 Eth26/2 26 50000 +Ethernet104 25,26 Eth27/1 27 50000 +Ethernet106 27,28 Eth27/2 27 50000 +Ethernet108 29,30 Eth28/1 28 50000 +Ethernet110 31,32 Eth28/2 28 50000 +Ethernet112 113,114 Eth29/1 29 50000 +Ethernet114 115,116 Eth29/2 29 50000 +Ethernet116 117,118 Eth30/1 30 50000 +Ethernet118 119,120 Eth30/2 30 50000 +Ethernet120 121,122 Eth31/1 31 50000 +Ethernet122 123,124 Eth31/2 31 50000 +Ethernet124 125,126 Eth32/1 32 50000 +Ethernet126 127,128 Eth32/2 32 50000 \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini index 94282c3379e4..91d2f91d41cc 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/port_config.ini @@ -1,33 +1,33 @@ # name lanes alias index speed -Ethernet0 65,66,67,68 Eth1 0 100000 -Ethernet4 69,70,71,72 Eth2 1 100000 -Ethernet8 73,74,75,76 Eth3 2 100000 -Ethernet12 77,78,79,80 Eth4 3 100000 -Ethernet16 33,34,35,36 Eth5 4 100000 -Ethernet20 37,38,39,40 Eth6 5 100000 -Ethernet24 41,42,43,44 Eth7 6 100000 -Ethernet28 45,46,47,48 Eth8 7 100000 -Ethernet32 49,50,51,52 Eth9 8 100000 -Ethernet36 53,54,55,56 Eth10 9 100000 -Ethernet40 57,58,59,60 Eth11 10 100000 -Ethernet44 61,62,63,64 Eth12 11 100000 -Ethernet48 81,82,83,84 Eth13 12 100000 -Ethernet52 85,86,87,88 Eth14 13 100000 -Ethernet56 89,90,91,92 Eth15 14 100000 -Ethernet60 93,94,95,96 Eth16 15 100000 -Ethernet64 97,98,99,100 Eth17 16 100000 -Ethernet68 101,102,103,104 Eth18 17 100000 -Ethernet72 105,106,107,108 Eth19 18 100000 -Ethernet76 109,110,111,112 Eth20 19 100000 -Ethernet80 1,2,3,4 Eth21 20 100000 -Ethernet84 5,6,7,8 Eth22 21 100000 -Ethernet88 9,10,11,12 Eth23 22 100000 -Ethernet92 13,14,15,16 Eth24 23 100000 -Ethernet96 17,18,19,20 Eth25 24 100000 -Ethernet100 21,22,23,24 Eth26 25 100000 -Ethernet104 25,26,27,28 Eth27 26 100000 -Ethernet108 29,30,31,32 Eth28 27 100000 -Ethernet112 113,114,115,116 Eth29 28 100000 -Ethernet116 117,118,119,120 Eth30 29 100000 -Ethernet120 121,122,123,124 Eth31 30 100000 -Ethernet124 125,126,127,128 Eth32 31 100000 +Ethernet0 65,66,67,68 Eth1 1 100000 +Ethernet4 69,70,71,72 Eth2 2 100000 +Ethernet8 73,74,75,76 Eth3 3 100000 +Ethernet12 77,78,79,80 Eth4 4 100000 +Ethernet16 33,34,35,36 Eth5 5 100000 +Ethernet20 37,38,39,40 Eth6 6 100000 +Ethernet24 41,42,43,44 Eth7 7 100000 +Ethernet28 45,46,47,48 Eth8 8 100000 +Ethernet32 49,50,51,52 Eth9 9 100000 +Ethernet36 53,54,55,56 Eth10 10 100000 +Ethernet40 57,58,59,60 Eth11 11 100000 +Ethernet44 61,62,63,64 Eth12 12 100000 +Ethernet48 81,82,83,84 Eth13 13 100000 +Ethernet52 85,86,87,88 Eth14 14 100000 +Ethernet56 89,90,91,92 Eth15 15 100000 +Ethernet60 93,94,95,96 Eth16 16 100000 +Ethernet64 97,98,99,100 Eth17 17 100000 +Ethernet68 101,102,103,104 Eth18 18 100000 +Ethernet72 105,106,107,108 Eth19 19 100000 +Ethernet76 109,110,111,112 Eth20 20 100000 +Ethernet80 1,2,3,4 Eth21 21 100000 +Ethernet84 5,6,7,8 Eth22 22 100000 +Ethernet88 9,10,11,12 Eth23 23 100000 +Ethernet92 13,14,15,16 Eth24 24 100000 +Ethernet96 17,18,19,20 Eth25 25 100000 +Ethernet100 21,22,23,24 Eth26 26 100000 +Ethernet104 25,26,27,28 Eth27 27 100000 +Ethernet108 29,30,31,32 Eth28 28 100000 +Ethernet112 113,114,115,116 Eth29 29 100000 +Ethernet116 117,118,119,120 Eth30 30 100000 +Ethernet120 121,122,123,124 Eth31 31 100000 +Ethernet124 125,126,127,128 Eth32 32 100000 \ No newline at end of file diff --git a/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py b/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py old mode 100755 new mode 100644 index f1e6b1daa3e1..c361659b0f17 --- a/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py +++ b/device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py @@ -13,12 +13,11 @@ class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" - PORT_START = 0 - PORT_END = 31 + PORT_START = 1 + PORT_END = 32 PORTS_IN_BLOCK = 32 _port_to_eeprom_mapping = {} - qsfp_ports = range(0, PORTS_IN_BLOCK + 1) @property def port_start(self): @@ -30,7 +29,7 @@ def port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): @@ -41,7 +40,10 @@ def __init__(self): 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_eeprom_mapping[x] = eeprom_path.format( x + 26 ) + if self.port_start == 1: + self.port_to_eeprom_mapping[x] = eeprom_path.format((x - 1) + 26) + else: + self.port_to_eeprom_mapping[x] = eeprom_path.format(x + 26) SfpUtilBase.__init__(self) def get_presence(self, port_num): @@ -60,8 +62,14 @@ def get_presence(self, port_num): # content is a string containing the hex representation of the register reg_value = int(content, 16) + # Determind if port_num start from 1 or 0 + if self.port_start == 1: + bit_index = port_num - 1 + else: + bit_index = port_num + # Mask off the bit corresponding to our port - mask = (1 << port_num) + mask = (1 << bit_index) # ModPrsL is active low if reg_value & mask == 0: @@ -85,8 +93,14 @@ def get_low_power_mode(self, port_num): # content is a string containing the hex representation of the register reg_value = int(content, 16) + # Determind if port_num start from 1 or 0 + if self.port_start == 1: + bit_index = port_num - 1 + else: + bit_index = port_num + # Mask off the bit corresponding to our port - mask = (1 << port_num) + mask = (1 << bit_index) # LPMode is active high if reg_value & mask == 0: @@ -95,8 +109,96 @@ def get_low_power_mode(self, port_num): return True def set_low_power_mode(self, port_num, lpmode): - raise NotImplementedError + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/dx010_cpld/qsfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Determind if port_num start from 1 or 0 + if self.port_start == 1: + bit_index = port_num - 1 + else: + bit_index = port_num + + # Mask off the bit corresponding to our port + mask = (1 << bit_index) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value).strip('L') + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True def reset(self, port_num): - raise NotImplementedError + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/dx010_cpld/qsfp_reset", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the + # register + reg_value = int(content, 16) + + # Determind if port_num start from 1 or 0 + if self.port_start == 1: + bit_index = port_num - 1 + else: + bit_index = port_num + + # Mask off the bit corresponding to our port + mask = (1 << bit_index) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value).rstrip('L')) + 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("/sys/devices/platform/dx010_cpld/qsfp_reset", "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value).rstrip('L')) + reg_file.close() + + return True + + def get_transceiver_change_event(self, timeout=0): + raise NotImplementedError From 986a857cd952a43cd0b17b012fdca1fbd10e7a8f Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Fri, 17 Aug 2018 01:53:43 +0300 Subject: [PATCH 1558/1833] [mellanox]: Fix problem with system EEPROM in "hw-mgmt" (#1938) Signed-off-by: Volodymyr Samotiy --- .../Add-modprobe-config-for-at24-module.patch | 21 +++++++++++++++++++ .../Add-systemd-service-config.patch | 3 +-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 platform/mellanox/hw-management/Add-modprobe-config-for-at24-module.patch diff --git a/platform/mellanox/hw-management/Add-modprobe-config-for-at24-module.patch b/platform/mellanox/hw-management/Add-modprobe-config-for-at24-module.patch new file mode 100644 index 000000000000..37d57da4e937 --- /dev/null +++ b/platform/mellanox/hw-management/Add-modprobe-config-for-at24-module.patch @@ -0,0 +1,21 @@ +From 2f70f5df445820fb86e3bd7f95707e0fb97b553f Mon Sep 17 00:00:00 2001 +From: Volodymyr Samotiy +Date: Thu, 16 Aug 2018 17:21:37 +0300 +Subject: Add modprobe config for "at24" module + +Signed-off-by: Volodymyr Samotiy +--- + usr/etc/modprobe.d/mellanox-system-whitelist.conf | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 usr/etc/modprobe.d/mellanox-system-whitelist.conf + +diff --git a/usr/etc/modprobe.d/mellanox-system-whitelist.conf b/usr/etc/modprobe.d/mellanox-system-whitelist.conf +new file mode 100644 +index 0000000..a3eef57 +--- /dev/null ++++ b/usr/etc/modprobe.d/mellanox-system-whitelist.conf +@@ -0,0 +1 @@ ++options at24 io_limit=32 +-- +1.9.1 + diff --git a/platform/mellanox/hw-management/Add-systemd-service-config.patch b/platform/mellanox/hw-management/Add-systemd-service-config.patch index bef62b9ea3e7..ce16bb712ee1 100644 --- a/platform/mellanox/hw-management/Add-systemd-service-config.patch +++ b/platform/mellanox/hw-management/Add-systemd-service-config.patch @@ -29,7 +29,7 @@ new file mode 100644 index 0000000..d18916d --- /dev/null +++ b/debian/hw-management.service -@@ -0,0 +1,11 @@ +@@ -0,0 +1,10 @@ +[Unit] +Description=Mellanox Hardware Management + @@ -37,7 +37,6 @@ index 0000000..d18916d +Type=oneshot +EnvironmentFile=/host/machine.conf +ExecStart=/bin/bash -c "/etc/mlnx/mlnx-hw-management start" -+ExecStop=/bin/bash -c "/etc/mlnx/mlnx-hw-management stop" + +[Install] +WantedBy=multi-user.target From a8ccf589c91cdc6d107d5244740a2ea9c0329872 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 16 Aug 2018 15:54:31 -0700 Subject: [PATCH 1559/1833] [build]: Makefile: make new step "make stretch" optional (#1936) * [makefile] Rename Makefile to Makefile.work Signed-off-by: Ying Xie * [makefile] Add new make file to avoid extra step * avoiding calling "make stretch" Signed-off-by: Ying Xie * [makefile] allow skipping "make stretch" Signed-off-by: Ying Xie * [makefile] add all PHONY targets to pass through list Signed-off-by: Ying Xie --- Makefile | 155 +++++--------------------------------------------- Makefile.work | 147 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 3 files changed, 162 insertions(+), 142 deletions(-) create mode 100644 Makefile.work diff --git a/Makefile b/Makefile index 2dfab3274869..4bc42cd3728c 100644 --- a/Makefile +++ b/Makefile @@ -1,147 +1,20 @@ -############################################################################### -## Wrapper for starting make inside sonic-slave container -# -# Supported parameters: -# -# * PLATFORM: Specific platform we wish to build images for. -# * BUILD_NUMBER: Desired version-number to pass to the building-system. -# * ENABLE_DHCP_GRAPH_SERVICE: Enables get-graph service to fetch minigraph files -# through http. -# * SHUTDOWN_BGP_ON_START: Sets admin-down state for all bgp peerings after restart. -# * ENABLE_PFCWD_ON_START: Enable PFC Watchdog (PFCWD) on server-facing ports -# * by default for TOR switch. -# * SONIC_ENABLE_SYNCD_RPC: Enables rpc-based syncd builds. -# * USERNAME: Desired username -- default at rules/config -# * PASSWORD: Desired password -- default at rules/config -# * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes. -# * 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 -# * KERNEL_PROCURE_METHOD: Specifying method of obtaining kernel Debian package: download or build -# -############################################################################### +# SONiC make file -SHELL = /bin/bash - -USER := $(shell id -un) -PWD := $(shell pwd) - -ifeq ($(USER), root) -$(error Add your user account to docker group and use your user account to make. root or sudo are not supported!) -endif - -# Remove lock file in case previous run was forcefully stopped -$(shell rm -f .screen) - -MAKEFLAGS += -B - -ifeq ($(BLDENV), stretch) -SLAVE_BASE_TAG = $(shell sha1sum sonic-slave-stretch/Dockerfile | awk '{print substr($$1,0,11);}') -SLAVE_TAG = $(shell cat sonic-slave-stretch/Dockerfile.user sonic-slave-stretch/Dockerfile | sha1sum | awk '{print substr($$1,0,11);}') -SLAVE_BASE_IMAGE = sonic-slave-stretch-base -SLAVE_IMAGE = sonic-slave-stretch-$(USER) -SLAVE_DIR = sonic-slave-stretch -else -SLAVE_BASE_TAG = $(shell sha1sum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') -SLAVE_TAG = $(shell cat sonic-slave/Dockerfile.user sonic-slave/Dockerfile | sha1sum | awk '{print substr($$1,0,11);}') -SLAVE_BASE_IMAGE = sonic-slave-base -SLAVE_IMAGE = sonic-slave-$(USER) -SLAVE_DIR = sonic-slave -endif - -INSMOD_OVERLAY := sudo modprobe overlay -DOCKER_RUN := docker run --rm=true --privileged \ - -v $(PWD):/sonic \ - -w /sonic \ - -e "http_proxy=$(http_proxy)" \ - -e "https_proxy=$(https_proxy)" \ - -i$(if $(TERM),t,) - -DOCKER_BASE_BUILD = docker build --no-cache \ - -t $(SLAVE_BASE_IMAGE) \ - --build-arg http_proxy=$(http_proxy) \ - --build-arg https_proxy=$(https_proxy) \ - $(SLAVE_DIR) && \ - docker tag $(SLAVE_BASE_IMAGE):latest $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) - -DOCKER_BUILD = docker build --no-cache \ - --build-arg user=$(USER) \ - --build-arg uid=$(shell id -u) \ - --build-arg guid=$(shell id -g) \ - --build-arg hostname=$(shell echo $$HOSTNAME) \ - -t $(SLAVE_IMAGE) \ - -f $(SLAVE_DIR)/Dockerfile.user \ - $(SLAVE_DIR) && \ - docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG) - -SONIC_BUILD_INSTRUCTION := make \ - -f slave.mk \ - PLATFORM=$(PLATFORM) \ - BUILD_NUMBER=$(BUILD_NUMBER) \ - ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ - SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ - SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \ - ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ - PASSWORD=$(PASSWORD) \ - USERNAME=$(USERNAME) \ - SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ - KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \ - HTTP_PROXY=$(http_proxy) \ - HTTPS_PROXY=$(https_proxy) \ - SONIC_ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY) - -.PHONY: sonic-slave-build sonic-slave-bash init reset - -.DEFAULT_GOAL := all +NOSTRETCH ?= 0 %:: - @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ - { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ - $(DOCKER_BASE_BUILD) ; } - @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ - { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ - $(DOCKER_BUILD) ; } - @$(INSMOD_OVERLAY) -ifeq "$(KEEP_SLAVE_ON)" "yes" - ifdef SOURCE_FOLDER - @$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/$(USER)/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" - else - @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" - endif -else - @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) $(SONIC_BUILD_INSTRUCTION) $@ + @echo "+++ --- Making $@ --- +++" +ifeq ($(NOSTRETCH), 0) + BLDENV=stretch make -f Makefile.work stretch endif + make -f Makefile.work $@ -sonic-slave-build : - $(DOCKER_BASE_BUILD) - $(DOCKER_BUILD) - -sonic-slave-bash : - @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ - { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ - $(DOCKER_BASE_BUILD) ; } - @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ - { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ - $(DOCKER_BUILD) ; } - @$(INSMOD_OVERLAY) - @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash - -showtag: - @echo $(SLAVE_IMAGE):$(SLAVE_TAG) - @echo $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) - -init : - @git submodule update --init --recursive - @git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' +stretch: + @echo "+++ Making $@ +++" +ifeq ($(NOSTRETCH), 0) + BLDENV=stretch make -f Makefile.work stretch +endif -reset : - @echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: " - @read ans && \ - if [ $$ans == y ]; then \ - git clean -xfdf; \ - git reset --hard; \ - git submodule foreach --recursive git clean -xfdf; \ - git submodule foreach --recursive git reset --hard; \ - git submodule update --init --recursive;\ - else \ - echo "Reset aborted"; \ - fi +clean reset init configure showtag sonic-slave-build sonic-slave-bash : + @echo "+++ Making $@ +++" + make -f Makefile.work $@ diff --git a/Makefile.work b/Makefile.work new file mode 100644 index 000000000000..2dfab3274869 --- /dev/null +++ b/Makefile.work @@ -0,0 +1,147 @@ +############################################################################### +## Wrapper for starting make inside sonic-slave container +# +# Supported parameters: +# +# * PLATFORM: Specific platform we wish to build images for. +# * BUILD_NUMBER: Desired version-number to pass to the building-system. +# * ENABLE_DHCP_GRAPH_SERVICE: Enables get-graph service to fetch minigraph files +# through http. +# * SHUTDOWN_BGP_ON_START: Sets admin-down state for all bgp peerings after restart. +# * ENABLE_PFCWD_ON_START: Enable PFC Watchdog (PFCWD) on server-facing ports +# * by default for TOR switch. +# * SONIC_ENABLE_SYNCD_RPC: Enables rpc-based syncd builds. +# * USERNAME: Desired username -- default at rules/config +# * PASSWORD: Desired password -- default at rules/config +# * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes. +# * 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 +# * KERNEL_PROCURE_METHOD: Specifying method of obtaining kernel Debian package: download or build +# +############################################################################### + +SHELL = /bin/bash + +USER := $(shell id -un) +PWD := $(shell pwd) + +ifeq ($(USER), root) +$(error Add your user account to docker group and use your user account to make. root or sudo are not supported!) +endif + +# Remove lock file in case previous run was forcefully stopped +$(shell rm -f .screen) + +MAKEFLAGS += -B + +ifeq ($(BLDENV), stretch) +SLAVE_BASE_TAG = $(shell sha1sum sonic-slave-stretch/Dockerfile | awk '{print substr($$1,0,11);}') +SLAVE_TAG = $(shell cat sonic-slave-stretch/Dockerfile.user sonic-slave-stretch/Dockerfile | sha1sum | awk '{print substr($$1,0,11);}') +SLAVE_BASE_IMAGE = sonic-slave-stretch-base +SLAVE_IMAGE = sonic-slave-stretch-$(USER) +SLAVE_DIR = sonic-slave-stretch +else +SLAVE_BASE_TAG = $(shell sha1sum sonic-slave/Dockerfile | awk '{print substr($$1,0,11);}') +SLAVE_TAG = $(shell cat sonic-slave/Dockerfile.user sonic-slave/Dockerfile | sha1sum | awk '{print substr($$1,0,11);}') +SLAVE_BASE_IMAGE = sonic-slave-base +SLAVE_IMAGE = sonic-slave-$(USER) +SLAVE_DIR = sonic-slave +endif + +INSMOD_OVERLAY := sudo modprobe overlay +DOCKER_RUN := docker run --rm=true --privileged \ + -v $(PWD):/sonic \ + -w /sonic \ + -e "http_proxy=$(http_proxy)" \ + -e "https_proxy=$(https_proxy)" \ + -i$(if $(TERM),t,) + +DOCKER_BASE_BUILD = docker build --no-cache \ + -t $(SLAVE_BASE_IMAGE) \ + --build-arg http_proxy=$(http_proxy) \ + --build-arg https_proxy=$(https_proxy) \ + $(SLAVE_DIR) && \ + docker tag $(SLAVE_BASE_IMAGE):latest $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) + +DOCKER_BUILD = docker build --no-cache \ + --build-arg user=$(USER) \ + --build-arg uid=$(shell id -u) \ + --build-arg guid=$(shell id -g) \ + --build-arg hostname=$(shell echo $$HOSTNAME) \ + -t $(SLAVE_IMAGE) \ + -f $(SLAVE_DIR)/Dockerfile.user \ + $(SLAVE_DIR) && \ + docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG) + +SONIC_BUILD_INSTRUCTION := make \ + -f slave.mk \ + PLATFORM=$(PLATFORM) \ + BUILD_NUMBER=$(BUILD_NUMBER) \ + ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ + SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ + SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \ + ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ + PASSWORD=$(PASSWORD) \ + USERNAME=$(USERNAME) \ + SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ + KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \ + HTTP_PROXY=$(http_proxy) \ + HTTPS_PROXY=$(https_proxy) \ + SONIC_ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY) + +.PHONY: sonic-slave-build sonic-slave-bash init reset + +.DEFAULT_GOAL := all + +%:: + @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ + { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ + $(DOCKER_BASE_BUILD) ; } + @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ + { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ + $(DOCKER_BUILD) ; } + @$(INSMOD_OVERLAY) +ifeq "$(KEEP_SLAVE_ON)" "yes" + ifdef SOURCE_FOLDER + @$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/$(USER)/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" + else + @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" + endif +else + @$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) $(SONIC_BUILD_INSTRUCTION) $@ +endif + +sonic-slave-build : + $(DOCKER_BASE_BUILD) + $(DOCKER_BUILD) + +sonic-slave-bash : + @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ + { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ + $(DOCKER_BASE_BUILD) ; } + @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ + { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ + $(DOCKER_BUILD) ; } + @$(INSMOD_OVERLAY) + @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash + +showtag: + @echo $(SLAVE_IMAGE):$(SLAVE_TAG) + @echo $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) + +init : + @git submodule update --init --recursive + @git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git' + +reset : + @echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: " + @read ans && \ + if [ $$ans == y ]; then \ + git clean -xfdf; \ + git reset --hard; \ + git submodule foreach --recursive git clean -xfdf; \ + git submodule foreach --recursive git reset --hard; \ + git submodule update --init --recursive;\ + else \ + echo "Reset aborted"; \ + fi diff --git a/README.md b/README.md index e09c4e2c2801..9b667661cd82 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ To build SONiC installer image and docker images, run the following commands: # Execute make configure once to configure ASIC make configure PLATFORM=[ASIC_VENDOR] - # build debian stretch required targets + # build debian stretch required targets (optional) BLDENV=stretch make stretch # build SONiC image From 86205b858a56bd4525f4e2f7992aebc048cf1074 Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Thu, 16 Aug 2018 23:11:20 -0700 Subject: [PATCH 1560/1833] [devices/a7050]: Separate ECN/WRED profile per queue to maintain a consistent view among CONFIG_DB get commands (#1941) for ecn on/off operations, which are conducted at per queue all interfaces granularity. TODO: Ideally, we should have ECN/WRED profile applied at per interface per queue granularity, and we should do it for all hwskus under the device directory, not just 7050. Signed-off-by: Wenda Ni --- .../x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 | 7 ++++++- .../Arista-7050-QX-32S/qos.json.j2 | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 index 926911ab59d0..698811c610ff 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 @@ -130,7 +130,12 @@ }, "QUEUE": { "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.0]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3" : { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|4" : { "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 index 926911ab59d0..698811c610ff 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 @@ -130,7 +130,12 @@ }, "QUEUE": { "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", + "scheduler" : "[SCHEDULER|scheduler.0]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3" : { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|4" : { "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" }, "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { From ec8a7f5e54467b3764527e256de6ca57a1ce2280 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 16 Aug 2018 23:11:45 -0700 Subject: [PATCH 1561/1833] [broadcom]: fix delay to load led proc init (#1940) led start bcm cmd triggers link state notifications. This is quick fix to avoid such fake link state notifications. Signed-off-by: Guohan Lu --- platform/broadcom/docker-syncd-brcm/start.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index cc0a0948e9aa..c52e5cb20271 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -29,11 +29,13 @@ wait_syncd() { fi sleep 1 done + + # wait until bcm sdk is ready to get a request + sleep 3 } # If this platform has an initialization file for the Broadcom LED microprocessor, load it if [ -r ${PLATFORM_DIR}/led_proc_init.soc ]; then wait_syncd - sleep 60 # wait until bcm sdk is ready to get a request supervisorctl start ledinit fi From 5a17a04c82b8d8a9e2c5fef96f586bee99601b68 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Fri, 17 Aug 2018 14:12:00 +0800 Subject: [PATCH 1562/1833] [mlnx-platform] enhancement for xcvrd implementation on mlnx platform (#1937) * mlnx enhancement for xcvrd implementation * fix conflict --- .../x86_64-mlnx_msn2100-r0/plugins/sfputil.py | 7 ++ .../x86_64-mlnx_msn2410-r0/plugins/sfputil.py | 9 +- .../x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 7 ++ .../x86_64-mlnx_msn2740-r0/plugins/sfputil.py | 7 ++ platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd | 109 +++++++++++++----- 5 files changed, 106 insertions(+), 33 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py index 631a6b774fb3..a4eda6edfe39 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py @@ -30,6 +30,7 @@ class SfpUtil(SfpUtilBase): db_sel_object = None db_sel_tbl = None state_db = None + sfpd_status_tbl = None @property def port_start(self): @@ -176,6 +177,12 @@ def get_transceiver_change_event(self, timeout=0): self.db_sel.addSelectable(self.db_sel_tbl) self.db_sel_timeout = swsscommon.Select.TIMEOUT self.db_sel_object = swsscommon.Select.OBJECT + self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') + + # Check the liveness of mlnx-sfpd, if it failed, return false + keys = self.sfpd_status_tbl.getKeys() + if 'LIVENESS' not in keys: + return False, phy_port_dict (state, c) = self.db_sel.select(timeout) if state == self.db_sel_timeout: diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py index c379155b82e7..8bd4ba789168 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py @@ -30,6 +30,7 @@ class SfpUtil(SfpUtilBase): db_sel_object = None db_sel_tbl = None state_db = None + sfpd_status_tbl = None @property def port_start(self): @@ -48,7 +49,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon6/qsfp{0}_eeprom" + eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon7/qsfp{0}_eeprom" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) @@ -177,6 +178,12 @@ def get_transceiver_change_event(self, timeout=0): self.db_sel.addSelectable(self.db_sel_tbl) self.db_sel_timeout = swsscommon.Select.TIMEOUT self.db_sel_object = swsscommon.Select.OBJECT + self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') + + # Check the liveness of mlnx-sfpd, if it failed, return false + keys = self.sfpd_status_tbl.getKeys() + if 'LIVENESS' not in keys: + return False, phy_port_dict (state, c) = self.db_sel.select(timeout) if state == self.db_sel_timeout: 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 2eb3d628ff9f..11a5bdcb02b6 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -30,6 +30,7 @@ class SfpUtil(SfpUtilBase): db_sel_object = None db_sel_tbl = None state_db = None + sfpd_status_tbl = None @property def port_start(self): @@ -176,6 +177,12 @@ def get_transceiver_change_event(self, timeout=0): self.db_sel.addSelectable(self.db_sel_tbl) self.db_sel_timeout = swsscommon.Select.TIMEOUT self.db_sel_object = swsscommon.Select.OBJECT + self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') + + # Check the liveness of mlnx-sfpd, if it failed, return false + keys = self.sfpd_status_tbl.getKeys() + if 'LIVENESS' not in keys: + return False, phy_port_dict (state, c) = self.db_sel.select(timeout) if state == self.db_sel_timeout: diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py index d617135e3e89..f84cefc67268 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py @@ -30,6 +30,7 @@ class SfpUtil(SfpUtilBase): db_sel_object = None db_sel_tbl = None state_db = None + sfpd_status_tbl = None @property def port_start(self): @@ -176,6 +177,12 @@ def get_transceiver_change_event(self, timeout=0): self.db_sel.addSelectable(self.db_sel_tbl) self.db_sel_timeout = swsscommon.Select.TIMEOUT self.db_sel_object = swsscommon.Select.OBJECT + self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') + + # Check the liveness of mlnx-sfpd, if it failed, return false + keys = self.sfpd_status_tbl.getKeys() + if 'LIVENESS' not in keys: + return False, phy_port_dict (state, c) = self.db_sel.select(timeout) if state == self.db_sel_timeout: diff --git a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd index e91dbb7a8aa6..a1d2e6d9c3b5 100644 --- a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd +++ b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd @@ -11,6 +11,7 @@ import time import syslog import signal import json +import threading from python_sdk_api.sx_api import * from swsssdk import SonicV2Connector @@ -26,10 +27,11 @@ STATUS_PLUGIN = '1' STATUS_PLUGOUT = '0' STATUS_UNKNOWN = '2' -sfp_value_status_dict = {SDK_SFP_STATE_IN:STATUS_PLUGIN, SDK_SFP_STATE_OUT:STATUS_PLUGOUT} +SFPD_LIVENESS_UPDATE_INTERVAL_SECS = 30 -#========================== Syslog wrappers ========================== +sfp_value_status_dict = {SDK_SFP_STATE_IN:STATUS_PLUGIN, SDK_SFP_STATE_OUT:STATUS_PLUGOUT} +# ========================== Syslog wrappers ========================== def log_info(msg, also_print_to_console=False): syslog.openlog(SYSLOG_IDENTIFIER) syslog.syslog(syslog.LOG_INFO, msg) @@ -54,8 +56,7 @@ def log_error(msg, also_print_to_console=False): if also_print_to_console: print(msg) -#========================== Signal Handling ========================== - +# ========================== Signal Handling ========================== def signal_handler(sig, frame): if sig == signal.SIGHUP: log_info("Caught SIGHUP - ignoring...") @@ -83,11 +84,14 @@ def sx_recv(fd_p, handle): port_cnt_p = new_uint32_t_p() uint32_t_p_assign(port_cnt_p,64) label_port_list = [] + status = True + module_state = 0 rc = sx_lib_host_ifc_recv(fd_p, pkt, pkt_size_p, recv_info_p) if rc != 0: log_error("event receive exit with error, rc %d" % rc) - exit(rc) + status = False + return status, label_port_list, module_state pmpe_t = recv_info_p.event_info.pmpe port_list_size = pmpe_t.list_size @@ -99,21 +103,50 @@ def sx_recv(fd_p, handle): rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) port_cnt = uint32_t_p_value(port_cnt_p) - for i in range(0,port_cnt): + for i in range(0, port_cnt): port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list,i) if port_attributes.log_port == logical_port: lable_port = port_attributes.port_mapping.module_port break label_port_list.append(lable_port) - return label_port_list, module_state + return status, label_port_list, module_state, def send_sfp_notification(db, interface, state): - sfp_notify = [interface,state] - msg = json.dumps(sfp_notify,separators=(',',':')) - db.publish('STATE_DB','TRANSCEIVER_NOTIFY', msg) + sfp_notify = [interface, state] + msg = json.dumps(sfp_notify, separators=(',', ':')) + db.publish('STATE_DB', 'TRANSCEIVER_NOTIFY', msg) return +def update_sfpd_liveness_key(db, timeout_secs): + if db.exists('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS'): + db.expire('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS', timeout_secs) + else: + db.set('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS', 'value', 'ok') + db.expire('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS', timeout_secs) + +# Timer thread wrapper class to update mlnx-sfpd liveness info to DB periodically +class sfpd_liveness_update_task: + def __init__(self, db): + self.task_stopping_event = threading.Event() + self.task_timer = None + self.state_db = db + + def task_run(self): + if self.task_stopping_event.isSet(): + log_error("Error: sfpd liveness update thread received stop event, exiting...") + return + + update_sfpd_liveness_key(self.state_db, 2*SFPD_LIVENESS_UPDATE_INTERVAL_SECS) + + self.task_timer = threading.Timer(SFPD_LIVENESS_UPDATE_INTERVAL_SECS, self.task_run) + self.task_timer.start() + + def task_stop(self): + self.task_stopping_event.set() + self.task_timer.join() + + # main start def main(): # Register our signal handlers @@ -121,26 +154,30 @@ def main(): signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGTERM, signal_handler) - #open SDK handler + # Connect to state db for notification sending + state_db = SonicV2Connector(host=REDIS_HOSTIP) + state_db.connect(state_db.STATE_DB) + + # Open SDK handler log_info("starting mlnx-sfpd...") rc, handle = sx_api_open(None) - retry_time = 1 + retry_time = 1 while rc != SX_STATUS_SUCCESS: time.sleep(2**retry_time) retry_time += 1 rc, handle = sx_api_open(None) if retry_time > 20: - log_error("Failed to open api handle.\nPlease check that SDK is running.") + log_error("Failed to open api handle. Please check that SDK is running.") sys.exit(errno.EACCES) - #open recv fd - rx_fd_p = new_sx_fd_t_p() + # Open recv fd + rx_fd_p = new_sx_fd_t_p() rc = sx_api_host_ifc_open(handle, rx_fd_p) if rc != 0: log_error("sx_api_host_ifc_open exit with error, rc %d" % rc) exit(rc) - # set up general host ifc parameters + # Set up general host ifc parameters swid = 0 cmd = SX_ACCESS_CMD_REGISTER uc_p = new_sx_user_channel_t_p() @@ -153,26 +190,34 @@ def main(): log_error("sx_api_host_ifc_trap_id_register_set exit with error, rc %d" % rc) exit(rc) - #connect to state db for notification sending - state_db = SonicV2Connector(host=REDIS_HOSTIP) - state_db.connect(state_db.STATE_DB) + liveness_info_update = sfpd_liveness_update_task(state_db) + liveness_info_update.task_run() - #main loop for sfp event listening + # Main loop for sfp event listening log_info("mlnx-sfpd started") while True: - state = STATUS_UNKNOWN - port_list, module_state = sx_recv(rx_fd_p, handle) - if module_state in sfp_value_status_dict: state = sfp_value_status_dict[module_state] + sfp_state = STATUS_UNKNOWN + rc, port_list, module_state = sx_recv(rx_fd_p, handle) + if not rc: + log_error("Failed to recv event from SDK, please check that SDK is running.") + break + + if module_state in sfp_value_status_dict: sfp_state = sfp_value_status_dict[module_state] - if state != STATUS_UNKNOWN: + if sfp_state != STATUS_UNKNOWN: for port in port_list: - log_info("SFP on port %d state %s" % (port, state)) - send_sfp_notification(state_db, str(port), state) + log_info("SFP on port %d state %s" % (port, sfp_state)) + send_sfp_notification(state_db, str(port), sfp_state) log_info("sfp change event handling done") - ''' - # TODO: clean open handlers before exit, need find out which errors can be raised by SDK in this case. + # Stop liveness update task + liveness_info_update.task_stop() + + # Remove mlnx-sfpd liveness key in DB if not expired yet. + if state_db.exists('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS'): + state_db.delete(state_db, 'MLNX_SFPD_TASK|LIVENESS') + # unregister trap id cmd = SX_ACCESS_CMD_DEREGISTER rc = sx_api_host_ifc_trap_id_register_set(handle, cmd, swid, trap_id, uc_p) @@ -180,20 +225,20 @@ def main(): log_error("sx_api_host_ifc_trap_id_register_set exit with error, rc %d" % rc) exit(rc) - # close read fp + # Close read fp rc = sx_api_host_ifc_close(handle, rx_fd_p) if rc != 0: log_error("sx_api_host_ifc_close exit with error, rc %d" % rc) exit(rc) - # close sdk handler + # Close sdk handler rc = sx_api_close(handle) if rc != 0: - log_error("exit with error, rc %d" % rc) + log_error("sx_api_close exit with error, rc %d" % rc) exit(rc) log_info("mlnx-sfpd exited") - ''' + if __name__ == '__main__': main() From c059d9982ac724e758e6a30e6e8347215b73b3f6 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 17 Aug 2018 09:06:05 -0700 Subject: [PATCH 1563/1833] [baseimage]: install picocom 3.1 in base image (#1943) * [baseimage]: install picocom 3.1 in base image Signed-off-by: Guohan Lu * add picocom to stretch build Signed-off-by: Guohan Lu * fix slave.mk bug Signed-off-by: Guohan Lu --- build_debian.sh | 6 ++++-- rules/picocom.mk | 11 +++++++++++ slave.mk | 3 ++- sonic-slave-stretch/Dockerfile | 4 +++- src/picocom/Makefile | 28 ++++++++++++++++++++++++++++ src/picocom/debhelper_10.patch | 11 +++++++++++ 6 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 rules/picocom.mk create mode 100644 src/picocom/Makefile create mode 100644 src/picocom/debhelper_10.patch diff --git a/build_debian.sh b/build_debian.sh index 28b9833612b1..fea55144cfa0 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -227,8 +227,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in hping3 \ python-scapy \ tcptraceroute \ - mtr-tiny \ - picocom + mtr-tiny sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ grub-pc-bin @@ -238,6 +237,9 @@ sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64- sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libwrap0_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/picocom_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec diff --git a/rules/picocom.mk b/rules/picocom.mk new file mode 100644 index 000000000000..a45ac9ecbbe6 --- /dev/null +++ b/rules/picocom.mk @@ -0,0 +1,11 @@ +# picocom packages + +PICOCOM_VERSION = 3.1-2 + +export PICOCOM_VERSION + +PICOCOM = picocom_$(PICOCOM_VERSION)_amd64.deb +$(PICOCOM)_SRC_PATH = $(SRC_PATH)/picocom +SONIC_MAKE_DEBS += $(PICOCOM) + +SONIC_STRETCH_DEBS += $(PICOCOM) diff --git a/slave.mk b/slave.mk index 4f1998680b29..a16a0cb488c1 100644 --- a/slave.mk +++ b/slave.mk @@ -462,7 +462,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(BASH) \ $(LIBWRAP) \ $(LIBPAM_TACPLUS) \ - $(LIBNSS_TACPLUS)) \ + $(LIBNSS_TACPLUS) \ + $(PICOCOM)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) \ $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2)) diff --git a/sonic-slave-stretch/Dockerfile b/sonic-slave-stretch/Dockerfile index 4f7582efa0b4..79f86bd7e255 100644 --- a/sonic-slave-stretch/Dockerfile +++ b/sonic-slave-stretch/Dockerfile @@ -201,7 +201,9 @@ RUN apt-get update && apt-get install -y \ # For pam_tacplus build autoconf-archive \ # For initramfs - bash-completion + bash-completion \ +# For picocom + pandoc # For linux build RUN apt-get -y build-dep linux diff --git a/src/picocom/Makefile b/src/picocom/Makefile new file mode 100644 index 000000000000..46b6034da9fa --- /dev/null +++ b/src/picocom/Makefile @@ -0,0 +1,28 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = picocom_$(PICOCOM_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./picocom-3.1 + + # Get source package + wget -NO picocom_$(PICOCOM_VERSION).dsc "https://sonicstorage.blob.core.windows.net/packages/debian/picocom_3.1-2.dsc?sv=2015-04-05&sr=b&sig=puo9KA27jT9Ey%2FkxRPBLIm30gFDdQJF85VKA7vuv9hk%3D&se=2155-07-10T08%3A03%3A50Z&sp=r" + wget -NO picocom_$(PICOCOM_VERSION).debian.tar.xz "https://sonicstorage.blob.core.windows.net/packages/debian/picocom_3.1-2.debian.tar.xz?sv=2015-04-05&sr=b&sig=4HPuUi2FTb0AzCEsH9%2FsSfj17qIukyyOdRrHQFtjyBE%3D&se=2155-07-10T08%3A04%3A23Z&sp=r" + wget -NO picocom_3.1.orig.tar.gz "https://sonicstorage.blob.core.windows.net/packages/debian/picocom_3.1.orig.tar.gz?sv=2015-04-05&sr=b&sig=RjQ84sf%2B%2FQuI%2B0PAcbPHXvnlNAuP%2BQoVrp2xzDJZfX4%3D&se=2155-07-10T08%3A04%3A45Z&sp=r" + + dpkg-source -x picocom_$(PICOCOM_VERSION).dsc + + # Build source and Debian packages + pushd picocom-3.1 + patch -p0 < ../debhelper_10.patch + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + # Move the newly-built .deb packages to the destination directory + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) + diff --git a/src/picocom/debhelper_10.patch b/src/picocom/debhelper_10.patch new file mode 100644 index 000000000000..6c0ff47a553e --- /dev/null +++ b/src/picocom/debhelper_10.patch @@ -0,0 +1,11 @@ +--- debian/control.old 2018-08-17 08:05:35.996230100 +0000 ++++ debian/control 2018-08-17 08:05:43.712230100 +0000 +@@ -3,7 +3,7 @@ + Priority: optional + Maintainer: Matt Palmer + Uploaders: W. Martin Borgert +-Build-Depends: debhelper (>= 11), ++Build-Depends: debhelper (>= 10), + pandoc + Standards-Version: 4.1.3 + Rules-Requires-Root: no From f499254f4638552edd94fdda5cf8519bf41ee64b Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sat, 18 Aug 2018 00:06:32 +0800 Subject: [PATCH 1564/1833] [swsssdk]: update DBInterface submodule (#1942) --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index ca540c9c51e2..6272b5f7abb7 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit ca540c9c51e2bb704802a89ecd2b485578bd8211 +Subproject commit 6272b5f7abb743411c703dac46eb39f951b57818 From f05ee30d53631e4fc96df20fd78011c76b116a86 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 17 Aug 2018 11:13:08 -0700 Subject: [PATCH 1565/1833] [sai]: upgrade SAI to version 1.3.3 (#1944) * [sai]: upgrade SAI to version 1.3.3 Signed-off-by: Guohan Lu * update mellanox sai --- platform/broadcom/sai.mk | 8 ++++---- platform/mellanox/mlnx-sai.mk | 2 +- src/sonic-sairedis | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 77171281d8e3..1ae99439fda0 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.5-5_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm_3.1.3.5-5_amd64.deb?sv=2015-04-05&sr=b&sig=QPeazVTcPxPiWnLQRX4BqAAoyo0kTXJlfNAAtp2nilk%3D&se=2155-06-28T00%3A35%3A53Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.5-7_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm_3.1.3.5-7_amd64.deb?sv=2015-04-05&sr=b&sig=0FaCT4a%2B07%2FkMIqZQF8NKk3UQL%2BU5M9icfe23F6rThY%3D&se=2155-07-10T08%3A53%3A11Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-5_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-7_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-5_amd64.deb?sv=2015-04-05&sr=b&sig=6yrT5BVHkTr5955Rf9sADlVVN8o8TzxSjoj3JZg6nHw%3D&se=2155-06-28T00%3A37%3A34Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-7_amd64.deb?sv=2015-04-05&sr=b&sig=aTEosIZH90NExzK3opDzVFB%2FhWATEggoxKaTYudoR3I%3D&se=2155-07-10T08%3A53%3A39Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index e22705a88e3a..f2bb52a7b5e0 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.12.1-master -MLNX_SAI_REVISION = fe6e9d418223de9debd5348bb61af514b1df15f5 +MLNX_SAI_REVISION = 08749ea08d4e4e4f8611bb1e29fe16a5914eef31 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/src/sonic-sairedis b/src/sonic-sairedis index c2c5e7cf7fa4..1c06195cc64f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit c2c5e7cf7fa477691cda579405dde3d2573e066c +Subproject commit 1c06195cc64f59120bb84ba9ffbd9051ec9214dc From 98082d56a0d17c1c6ef4ad18c9322f2fa67919af Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 17 Aug 2018 17:38:20 -0700 Subject: [PATCH 1566/1833] [baseimage]: Download picocom version 3.1-2 from stretch-backports; No longer build from source (#1946) --- build_debian.sh | 8 ++++-- files/apt/sources.list | 1 + ...ian_archive_trafficmanager_net_debian.list | 1 + rules/picocom.mk | 11 -------- slave.mk | 3 +- sonic-slave-stretch/Dockerfile | 6 ++-- src/picocom/Makefile | 28 ------------------- src/picocom/debhelper_10.patch | 11 -------- 8 files changed, 10 insertions(+), 59 deletions(-) delete mode 100644 rules/picocom.mk delete mode 100644 src/picocom/Makefile delete mode 100644 src/picocom/debhelper_10.patch diff --git a/build_debian.sh b/build_debian.sh index fea55144cfa0..28493ea16877 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -229,6 +229,11 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in tcptraceroute \ mtr-tiny +# Install certain fundamental packages from stretch-backports in order to get +# more up-to-date (but potentially less stable) versions +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y -t stretch-backports install \ + picocom + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \ grub-pc-bin @@ -237,9 +242,6 @@ sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64- sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libwrap0_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/picocom_*.deb || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f - ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec diff --git a/files/apt/sources.list b/files/apt/sources.list index bbcbbe64f691..b1ce507a44f5 100644 --- a/files/apt/sources.list +++ b/files/apt/sources.list @@ -5,3 +5,4 @@ deb http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-fr deb-src http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free deb http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free deb-src http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free +deb http://debian-archive.trafficmanager.net/debian/ stretch-backports main contrib non-free diff --git a/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list b/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list index 1ddb193b1034..cda7053c35c1 100644 --- a/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list +++ b/files/image_config/apt/sources.list.d/debian_archive_trafficmanager_net_debian.list @@ -1,2 +1,3 @@ deb http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free deb http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free +deb http://debian-archive.trafficmanager.net/debian/ stretch-backports main contrib non-free diff --git a/rules/picocom.mk b/rules/picocom.mk deleted file mode 100644 index a45ac9ecbbe6..000000000000 --- a/rules/picocom.mk +++ /dev/null @@ -1,11 +0,0 @@ -# picocom packages - -PICOCOM_VERSION = 3.1-2 - -export PICOCOM_VERSION - -PICOCOM = picocom_$(PICOCOM_VERSION)_amd64.deb -$(PICOCOM)_SRC_PATH = $(SRC_PATH)/picocom -SONIC_MAKE_DEBS += $(PICOCOM) - -SONIC_STRETCH_DEBS += $(PICOCOM) diff --git a/slave.mk b/slave.mk index a16a0cb488c1..4f1998680b29 100644 --- a/slave.mk +++ b/slave.mk @@ -462,8 +462,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(BASH) \ $(LIBWRAP) \ $(LIBPAM_TACPLUS) \ - $(LIBNSS_TACPLUS) \ - $(PICOCOM)) \ + $(LIBNSS_TACPLUS)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) \ $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2)) diff --git a/sonic-slave-stretch/Dockerfile b/sonic-slave-stretch/Dockerfile index 79f86bd7e255..d34cfda71c06 100644 --- a/sonic-slave-stretch/Dockerfile +++ b/sonic-slave-stretch/Dockerfile @@ -6,7 +6,7 @@ RUN echo "deb http://debian-archive.trafficmanager.net/debian/ stretch main cont echo "deb-src http://debian-archive.trafficmanager.net/debian/ stretch main contrib non-free" >> /etc/apt/sources.list && \ echo "deb http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ stretch/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo 'deb http://debian-archive.trafficmanager.net/debian stretch-backports main' >> /etc/apt/sources.list + echo "deb http://debian-archive.trafficmanager.net/debian stretch-backports main" >> /etc/apt/sources.list ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -201,9 +201,7 @@ RUN apt-get update && apt-get install -y \ # For pam_tacplus build autoconf-archive \ # For initramfs - bash-completion \ -# For picocom - pandoc + bash-completion # For linux build RUN apt-get -y build-dep linux diff --git a/src/picocom/Makefile b/src/picocom/Makefile deleted file mode 100644 index 46b6034da9fa..000000000000 --- a/src/picocom/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -.ONESHELL: -SHELL = /bin/bash -.SHELLFLAGS += -e - -MAIN_TARGET = picocom_$(PICOCOM_VERSION)_amd64.deb - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - # Remove any stale files - rm -rf ./picocom-3.1 - - # Get source package - wget -NO picocom_$(PICOCOM_VERSION).dsc "https://sonicstorage.blob.core.windows.net/packages/debian/picocom_3.1-2.dsc?sv=2015-04-05&sr=b&sig=puo9KA27jT9Ey%2FkxRPBLIm30gFDdQJF85VKA7vuv9hk%3D&se=2155-07-10T08%3A03%3A50Z&sp=r" - wget -NO picocom_$(PICOCOM_VERSION).debian.tar.xz "https://sonicstorage.blob.core.windows.net/packages/debian/picocom_3.1-2.debian.tar.xz?sv=2015-04-05&sr=b&sig=4HPuUi2FTb0AzCEsH9%2FsSfj17qIukyyOdRrHQFtjyBE%3D&se=2155-07-10T08%3A04%3A23Z&sp=r" - wget -NO picocom_3.1.orig.tar.gz "https://sonicstorage.blob.core.windows.net/packages/debian/picocom_3.1.orig.tar.gz?sv=2015-04-05&sr=b&sig=RjQ84sf%2B%2FQuI%2B0PAcbPHXvnlNAuP%2BQoVrp2xzDJZfX4%3D&se=2155-07-10T08%3A04%3A45Z&sp=r" - - dpkg-source -x picocom_$(PICOCOM_VERSION).dsc - - # Build source and Debian packages - pushd picocom-3.1 - patch -p0 < ../debhelper_10.patch - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) - popd - - # Move the newly-built .deb packages to the destination directory - mv $(DERIVED_TARGETS) $* $(DEST)/ - -$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) - diff --git a/src/picocom/debhelper_10.patch b/src/picocom/debhelper_10.patch deleted file mode 100644 index 6c0ff47a553e..000000000000 --- a/src/picocom/debhelper_10.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- debian/control.old 2018-08-17 08:05:35.996230100 +0000 -+++ debian/control 2018-08-17 08:05:43.712230100 +0000 -@@ -3,7 +3,7 @@ - Priority: optional - Maintainer: Matt Palmer - Uploaders: W. Martin Borgert --Build-Depends: debhelper (>= 11), -+Build-Depends: debhelper (>= 10), - pandoc - Standards-Version: 4.1.3 - Rules-Requires-Root: no From 4aa3f7af68ede3cf7017db5094d2819f7b583085 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Mon, 20 Aug 2018 19:06:21 +0300 Subject: [PATCH 1567/1833] [mellanox]: Fix system EEPROM for MSN2740 platform (#1950) Signed-off-by: Volodymyr Samotiy --- ...x-system-EEPROM-for-MSN2740-platform.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 platform/mellanox/hw-management/Fix-system-EEPROM-for-MSN2740-platform.patch diff --git a/platform/mellanox/hw-management/Fix-system-EEPROM-for-MSN2740-platform.patch b/platform/mellanox/hw-management/Fix-system-EEPROM-for-MSN2740-platform.patch new file mode 100644 index 000000000000..5519692e12ed --- /dev/null +++ b/platform/mellanox/hw-management/Fix-system-EEPROM-for-MSN2740-platform.patch @@ -0,0 +1,25 @@ +From cebfa8338c2e5953a097de2a776bb680e7a34410 Mon Sep 17 00:00:00 2001 +From: Volodymyr Samotiy +Date: Fri, 17 Aug 2018 13:27:16 +0300 +Subject: Fix system EEPROM for MSN2740 platform + +Signed-off-by: Volodymyr Samotiy +--- + usr/etc/mlnx/mlnx-hw-management | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/usr/etc/mlnx/mlnx-hw-management b/usr/etc/mlnx/mlnx-hw-management +index 54cdd30..4f0d265 100755 +--- a/usr/etc/mlnx/mlnx-hw-management ++++ b/usr/etc/mlnx/mlnx-hw-management +@@ -107,6 +107,7 @@ msn2740_connect_table=( mlxsw_minimal 0x48 2 \ + max11603 0x64 5 \ + tmp102 0x49 6 \ + tmp102 0x48 7 \ ++ 24c32 0x51 8 \ + max11603 0x6d 15 \ + 24c32 0x51 16) + +-- +1.9.1 + From e7ef637a097404efb482434c22950b7a31a6b313 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 20 Aug 2018 10:11:11 -0700 Subject: [PATCH 1568/1833] [config-bcm] move broadcom config files to device folder (#1947) - Future versions of SAI packages will stop carrying these files. Signed-off-by: Ying Xie --- .../Accton-AS5712-54X/sai.profile | 2 +- .../td2-as5712-72x10G.config.bcm | 145 +++ .../Accton-AS7312-54X/sai.profile | 2 +- .../th-as7312-48x25G+6x100G.config.bcm | 519 +++++++++ .../Accton-AS7712-32X/sai.profile | 2 +- .../th-as7712-32x100G.config.bcm | 570 +++++++++ .../Accton-AS7716-32X/sai.profile | 2 +- .../th-as7716-32x100G.config.bcm | 570 +++++++++ .../Accton-AS7716-32XB/sai.profile | 2 +- .../th-as7716-32x100G.config.bcm | 570 +++++++++ .../Accton-AS7816-64X/sai.profile | 2 +- .../th2-as7816-64x100G.config.bcm | 875 ++++++++++++++ .../Arista-7050-QX-32S/sai.profile | 2 +- .../td2-a7050-qx32s-32x40G.config.bcm | 745 ++++++++++++ .../Arista-7060CX-32S-C32/sai.profile | 2 +- .../th-a7060-cx32s-32x100G-t1.config.bcm | 446 ++++++++ .../Arista-7060CX-32S-D48C8/sai.profile | 2 +- .../th-a7060-cx32s-8x100G+48x50G.config.bcm | 547 +++++++++ .../Arista-7260CX3-C64/sai.profile | 2 +- .../th2-a7260cx3-64-64x100G.config.bcm | 1016 +++++++++++++++++ .../Seastone-DX010-10-50/sai.profile | 2 +- ...th-seastone-dx010-96x10G-16x50G.config.bcm | 927 +++++++++++++++ .../Seastone-DX010-50/sai.profile | 2 +- .../th-seastone-dx010-64x50G.config.bcm | 621 ++++++++++ .../Seastone-DX010/sai.profile | 2 +- .../th-seastone-dx010-32x100G.config.bcm | 374 ++++++ .../Force10-S6000/sai.profile | 2 +- .../Force10-S6000/td2-s6000-32x40G.config.bcm | 647 +++++++++++ .../Force10-S6100/sai.profile.j2 | 6 +- .../th-s6100-64x40G-t0.config.bcm | 415 +++++++ .../th-s6100-64x40G-t1.config.bcm | 415 +++++++ .../DellEMC-Z9264f/sai.profile | 2 +- .../th2-z9264f-64x100G.config.bcm | 1007 ++++++++++++++++ .../Delta-ag5648/sai.profile | 2 +- .../th-ag5648-48x25G+6x100G.config.bcm | 277 +++++ .../Delta-ag9032v1/sai.profile | 2 +- .../th-ag9032v1-32x100G.config.bcm | 523 +++++++++ .../Delta-ag9064/sai.profile | 2 +- .../th2-ag9064-64x100G.config.bcm | 803 +++++++++++++ .../Facebook-W100-C32/sai.profile | 2 +- .../th-wedge100-32x100G.config.bcm | 433 +++++++ .../INGRASYS-S8810-32Q/sai.profile | 2 +- .../td2-s8810-32x40G.config.bcm | 474 ++++++++ .../INGRASYS-S8900-54XC/sai.profile | 2 +- .../th-s8900-48x25G+6x100G.config.bcm | 337 ++++++ .../INGRASYS-S8900-64XC/sai.profile | 2 +- .../th-s8900-48x25G+16x100G.config.bcm | 448 ++++++++ .../INGRASYS-S9100-C32/sai.profile | 2 +- .../th-s9100-32x100G.config.bcm | 359 ++++++ .../MiTAC-LY1200-B32H0-C3/sai.profile | 2 +- .../th-ly1200-32x100G.config.bcm | 319 ++++++ .../Quanta-IX1B-32X/sai.profile | 2 +- .../th-ix1b-32x100G.config.bcm | 253 ++++ 53 files changed, 14663 insertions(+), 28 deletions(-) create mode 100644 device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/td2-as5712-72x10G.config.bcm create mode 100644 device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/th-as7312-48x25G+6x100G.config.bcm create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/th-as7712-32x100G.config.bcm create mode 100644 device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/th-as7716-32x100G.config.bcm create mode 100644 device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/th-as7716-32x100G.config.bcm create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/th2-as7816-64x100G.config.bcm create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/th-a7060-cx32s-32x100G-t1.config.bcm create mode 100644 device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/th-a7060-cx32s-8x100G+48x50G.config.bcm create mode 100644 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/th2-a7260cx3-64-64x100G.config.bcm create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/th-seastone-dx010-96x10G-16x50G.config.bcm create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/th-seastone-dx010-64x50G.config.bcm create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/th-seastone-dx010-32x100G.config.bcm create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm create mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/th2-z9264f-64x100G.config.bcm create mode 100644 device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/th-ag5648-48x25G+6x100G.config.bcm create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/th-ag9032v1-32x100G.config.bcm create mode 100644 device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/th2-ag9064-64x100G.config.bcm create mode 100644 device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/th-wedge100-32x100G.config.bcm create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/td2-s8810-32x40G.config.bcm create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/th-s8900-48x25G+6x100G.config.bcm create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/th-s8900-48x25G+16x100G.config.bcm create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/th-s9100-32x100G.config.bcm create mode 100644 device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/MiTAC-LY1200-B32H0-C3/th-ly1200-32x100G.config.bcm create mode 100644 device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm diff --git a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile index 01d0f6642549..aec436d22608 100755 --- a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile +++ b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/td2-as5712-72x10G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-as5712-72x10G.config.bcm diff --git a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/td2-as5712-72x10G.config.bcm b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/td2-as5712-72x10G.config.bcm new file mode 100644 index 000000000000..715468c621a1 --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/td2-as5712-72x10G.config.bcm @@ -0,0 +1,145 @@ +os=unix +bcm_stat_flags=0 +parity_enable=0 +parity_correction=0 + +l2_mem_entries=163840 +l3_mem_entries=81920 +mmu_lossless=0 +lls_num_l2uc=12 +module_64ports=0 + +#SFI +serdes_if_type=9 + +port_init_cl72=0 +phy_an_c73=5 # TSCMOD_CL73_CL37 + +#sdk6.5.5 only supports 156(default) or 125 +#xgxs_lcpll_xtal_refclk=1 +tslam_dma_enable=1 +table_dma_enable=1 + +#for 72 ports with 48 10G ports and 6 40G ports for breakout mode +pbmp_oversubscribe=0x1fffffffffffffffffe +pbmp_xport_xe=0x1fffffffffffffffffe + +rate_ext_mdio_divisor=96 + +#SFP+ 1-4 from WC3 +portmap_1=13:10 +portmap_2=14:10 +portmap_3=15:10 +portmap_4=16:10 + +#SFP+ 5-8 from WC5 +portmap_5=21:10 +portmap_6=22:10 +portmap_7=23:10 +portmap_8=24:10 + +#SFP+ 9-12 from WC6 +portmap_9=25:10 +portmap_10=26:10 +portmap_11=27:10 +portmap_12=28:10 + +#SFP+ 13-16 from WC7 +portmap_13=29:10 +portmap_14=30:10 +portmap_15=31:10 +portmap_16=32:10 + +#SFP+ 17-20 from WC11 +portmap_17=45:10 +portmap_18=46:10 +portmap_19=47:10 +portmap_20=48:10 + +#SFP+ 21-24 from WC12 +portmap_21=49:10 +portmap_22=50:10 +portmap_23=51:10 +portmap_24=52:10 + +#SFP+ 25-28 from WC13 +portmap_25=53:10 +portmap_26=54:10 +portmap_27=55:10 +portmap_28=56:10 + +#SFP+ 29-32 from WC14 +portmap_29=57:10 +portmap_30=58:10 +portmap_31=59:10 +portmap_32=60:10 + +#SFP+ 33-36 from WC15 +portmap_33=61:10 +portmap_34=62:10 +portmap_35=63:10 +portmap_36=64:10 + +#SFP+ 37-40 from WC16 +portmap_37=65:10 +portmap_38=66:10 +portmap_39=67:10 +portmap_40=68:10 + +#SFP+ 41-44 from WC17 +portmap_41=69:10 +portmap_42=70:10 +portmap_43=71:10 +portmap_44=72:10 + +#SFP+ 45-48 from WC18 +portmap_45=73:10 +portmap_46=74:10 +portmap_47=75:10 +portmap_48=76:10 + +# QSFP+ 49/WC24/port 49 +portmap_49=97:10 +portmap_50=98:10 +portmap_51=99:10 +portmap_52=100:10 + +# QSFP+ 51/WC25/port 50 +portmap_53=101:10 +portmap_54=102:10 +portmap_55=103:10 +portmap_56=104:10 + +# QSFP+ 53/WC20/port 51 +portmap_57=81:10 +portmap_58=82:10 +portmap_59=83:10 +portmap_60=84:10 + +# QSFP+ 50/WC26/port 52 +portmap_61=105:10 +portmap_62=106:10 +portmap_63=107:10 +portmap_64=108:10 + +# QSFP+ 52/WC27/port 53 +portmap_65=109:10 +portmap_66=110:10 +portmap_67=111:10 +portmap_68=112:10 + +# QSFP+ 54/WC19/port 54 +portmap_69=77:10 +portmap_70=78:10 +portmap_71=79:10 +portmap_72=80:10 + +# L3 ECMP +# - In Trident2, VP LAGs share the same table as ECMP group table. +# The first N entries are reserved for VP LAGs, where N is the value of the +# config property "max_vp_lags". By default this was set to 256 +l3_max_ecmp_mode=1 +max_vp_lags=0 + +stable_size=0x2000000 +scache_filename=/tmp/scache diff --git a/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile index f239b822834b..31aefe2c2905 100644 --- a/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile +++ b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7312-48x25G+6x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-as7312-48x25G+6x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/th-as7312-48x25G+6x100G.config.bcm b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/th-as7312-48x25G+6x100G.config.bcm new file mode 100644 index 000000000000..eef4d987e8ed --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/Accton-AS7312-54X/th-as7312-48x25G+6x100G.config.bcm @@ -0,0 +1,519 @@ +# accton_as7312_54x 48x25G+6x100G SDK config +os=unix +schan_intr_enable=0 + +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 +mmu_lossless=1 + +pbmp_oversubscribe=0x0407ffc00ff00ff003fc3ffc00200222 +pbmp_xport_xe=0x0407ffd00ff00ff403fc3ffc00200222 + +## FC10 ## +dport_map_port_42=1 +dport_map_port_43=2 +dport_map_port_44=3 +dport_map_port_45=4 + +## FC12 ## +dport_map_port_50=5 +dport_map_port_51=6 +dport_map_port_52=7 +dport_map_port_53=8 + +## FC13 ## +dport_map_port_54=9 +dport_map_port_55=10 +dport_map_port_56=11 +dport_map_port_57=12 + +## FC16 ## +dport_map_port_68=13 +dport_map_port_69=14 +dport_map_port_70=15 +dport_map_port_71=16 + +## FC8 ## +dport_map_port_34=17 +dport_map_port_35=18 +dport_map_port_36=19 +dport_map_port_37=20 + +## FC9 ## +dport_map_port_38=21 +dport_map_port_39=22 +dport_map_port_40=23 +dport_map_port_41=24 + +## FC17 ## +dport_map_port_72=25 +dport_map_port_73=26 +dport_map_port_74=27 +dport_map_port_75=28 + +## FC20 ## +dport_map_port_84=29 +dport_map_port_85=30 +dport_map_port_86=31 +dport_map_port_87=32 + +## FC21 ## +dport_map_port_88=33 +dport_map_port_89=34 +dport_map_port_90=35 +dport_map_port_91=36 + +## FC24 ## +dport_map_port_102=37 +dport_map_port_103=38 +dport_map_port_104=39 +dport_map_port_105=40 + +## FC25 ## +dport_map_port_106=41 +dport_map_port_107=42 +dport_map_port_108=43 +dport_map_port_109=44 + +## FC26 ## +dport_map_port_110=45 +dport_map_port_111=46 +dport_map_port_112=47 +dport_map_port_113=48 + +## FC1 ## +dport_map_port_5=49 + +## FC0 ## +dport_map_port_1=50 + +## FC27 ## +dport_map_port_114=51 + +## FC5 ## +dport_map_port_21=52 + +## FC2 ## +dport_map_port_9=53 + +## FC29 ## +dport_map_port_122=54 + +#for KR +#dport_map_port_66=55 +#dport_map_port_100=56 + +/* Port Map */ +## FC10 ## +portmap_42=41:25 +portmap_43=42:25 +portmap_44=43:25 +portmap_45=44:25 + +## FC12 ## +portmap_50=49:25 +portmap_51=50:25 +portmap_52=51:25 +portmap_53=52:25 + + +## FC13 ## +portmap_54=53:25 +portmap_55=54:25 +portmap_56=55:25 +portmap_57=56:25 + +## FC16 ## +portmap_68=65:25 +portmap_69=66:25 +portmap_70=67:25 +portmap_71=68:25 + + +## FC8 ## +portmap_34=33:25 +portmap_35=34:25 +portmap_36=35:25 +portmap_37=36:25 + +## FC9 ## +portmap_38=37:25 +portmap_39=38:25 +portmap_40=39:25 +portmap_41=40:25 + +## FC17 ## +portmap_72=69:25 +portmap_73=70:25 +portmap_74=71:25 +portmap_75=72:25 + +## FC20 ## +portmap_84=81:25 +portmap_85=82:25 +portmap_86=83:25 +portmap_87=84:25 + + +## FC21 ## +portmap_88=85:25 +portmap_89=86:25 +portmap_90=87:25 +portmap_91=88:25 + +## FC24 ## +portmap_102=97:25 +portmap_103=98:25 +portmap_104=99:25 +portmap_105=100:25 + +## FC25 ## +portmap_106=101:25 +portmap_107=102:25 +portmap_108=103:25 +portmap_109=104:25 + +## FC26 ## +portmap_110=105:25 +portmap_111=106:25 +portmap_112=107:25 +portmap_113=108:25 + +## FC1 ## +portmap_5=5:100 + +## FC0 ## +portmap_1=1:100 + +## FC27 ## +portmap_114=109:100 + +## FC5 ## +portmap_21=21:100 + +## FC2 ## +portmap_9=9:100 + +## FC29 ## +portmap_122=117:100 + +# CPU to MAC +# TSC-E management port 1 +#portmap_66=129:10 +# TSC-E management port 2 +#portmap_100=131:10 + +xgxs_rx_lane_map_42=0x2310 +xgxs_rx_lane_map_43=0x2310 +xgxs_rx_lane_map_44=0x2310 +xgxs_rx_lane_map_45=0x2310 +xgxs_rx_lane_map_50=0x3210 +xgxs_rx_lane_map_51=0x3210 +xgxs_rx_lane_map_52=0x3210 +xgxs_rx_lane_map_53=0x3210 +xgxs_rx_lane_map_54=0x3210 +xgxs_rx_lane_map_55=0x3210 +xgxs_rx_lane_map_56=0x3210 +xgxs_rx_lane_map_57=0x3210 +xgxs_rx_lane_map_68=0x0123 +xgxs_rx_lane_map_69=0x0123 +xgxs_rx_lane_map_70=0x0123 +xgxs_rx_lane_map_71=0x0123 +xgxs_rx_lane_map_34=0x0123 +xgxs_rx_lane_map_35=0x0123 +xgxs_rx_lane_map_36=0x0123 +xgxs_rx_lane_map_37=0x0123 +xgxs_rx_lane_map_38=0x0123 +xgxs_rx_lane_map_39=0x0123 +xgxs_rx_lane_map_40=0x0123 +xgxs_rx_lane_map_41=0x0123 +xgxs_rx_lane_map_72=0x3210 +xgxs_rx_lane_map_73=0x3210 +xgxs_rx_lane_map_74=0x3210 +xgxs_rx_lane_map_75=0x3210 +xgxs_rx_lane_map_84=0x1032 +xgxs_rx_lane_map_85=0x1032 +xgxs_rx_lane_map_86=0x1032 +xgxs_rx_lane_map_87=0x1032 +xgxs_rx_lane_map_88=0x2301 +xgxs_rx_lane_map_89=0x2301 +xgxs_rx_lane_map_90=0x2301 +xgxs_rx_lane_map_91=0x2301 +xgxs_rx_lane_map_102=0x0123 +xgxs_rx_lane_map_103=0x0123 +xgxs_rx_lane_map_104=0x0123 +xgxs_rx_lane_map_105=0x0123 +xgxs_rx_lane_map_106=0x3210 +xgxs_rx_lane_map_107=0x3210 +xgxs_rx_lane_map_108=0x3210 +xgxs_rx_lane_map_109=0x3210 +xgxs_rx_lane_map_110=0x1032 +xgxs_rx_lane_map_111=0x1032 +xgxs_rx_lane_map_112=0x1032 +xgxs_rx_lane_map_113=0x1032 +xgxs_rx_lane_map_5=0x3210 +xgxs_rx_lane_map_1=0x3210 +xgxs_rx_lane_map_114=0x0123 +xgxs_rx_lane_map_21=0x0213 +xgxs_rx_lane_map_9=0x3210 +xgxs_rx_lane_map_122=0x1230 + +xgxs_tx_lane_map_42=0x0132 +xgxs_tx_lane_map_43=0x0132 +xgxs_tx_lane_map_44=0x0132 +xgxs_tx_lane_map_45=0x0132 +xgxs_tx_lane_map_50=0x3210 +xgxs_tx_lane_map_51=0x3210 +xgxs_tx_lane_map_52=0x3210 +xgxs_tx_lane_map_53=0x3210 +xgxs_tx_lane_map_54=0x3210 +xgxs_tx_lane_map_55=0x3210 +xgxs_tx_lane_map_56=0x3210 +xgxs_tx_lane_map_57=0x3210 +xgxs_tx_lane_map_68=0x0123 +xgxs_tx_lane_map_69=0x0123 +xgxs_tx_lane_map_70=0x0123 +xgxs_tx_lane_map_71=0x0123 +xgxs_tx_lane_map_34=0x0123 +xgxs_tx_lane_map_35=0x0123 +xgxs_tx_lane_map_36=0x0123 +xgxs_tx_lane_map_37=0x0123 +xgxs_tx_lane_map_38=0x0123 +xgxs_tx_lane_map_39=0x0123 +xgxs_tx_lane_map_40=0x0123 +xgxs_tx_lane_map_41=0x0123 +xgxs_tx_lane_map_72=0x0123 +xgxs_tx_lane_map_73=0x0123 +xgxs_tx_lane_map_74=0x0123 +xgxs_tx_lane_map_75=0x0123 +xgxs_tx_lane_map_84=0x0123 +xgxs_tx_lane_map_85=0x0123 +xgxs_tx_lane_map_86=0x0123 +xgxs_tx_lane_map_87=0x0123 +xgxs_tx_lane_map_88=0x2301 +xgxs_tx_lane_map_89=0x2301 +xgxs_tx_lane_map_90=0x2301 +xgxs_tx_lane_map_91=0x2301 +xgxs_tx_lane_map_102=0x0123 +xgxs_tx_lane_map_103=0x0123 +xgxs_tx_lane_map_104=0x0123 +xgxs_tx_lane_map_105=0x0123 +xgxs_tx_lane_map_106=0x3210 +xgxs_tx_lane_map_107=0x3210 +xgxs_tx_lane_map_108=0x3210 +xgxs_tx_lane_map_109=0x3210 +xgxs_tx_lane_map_110=0x1032 +xgxs_tx_lane_map_111=0x1032 +xgxs_tx_lane_map_112=0x1032 +xgxs_tx_lane_map_113=0x1032 +xgxs_tx_lane_map_5=0x3210 +xgxs_tx_lane_map_1=0x3210 +xgxs_tx_lane_map_114=0x0123 +xgxs_tx_lane_map_21=0x3210 +xgxs_tx_lane_map_9=0x3210 +xgxs_tx_lane_map_122=0x3210 + +#Polarity RX +phy_xaui_rx_polarity_flip_34=0x1 +phy_xaui_rx_polarity_flip_35=0x1 +phy_xaui_rx_polarity_flip_36=0x1 +phy_xaui_rx_polarity_flip_37=0x1 +phy_xaui_rx_polarity_flip_38=0x1 +phy_xaui_rx_polarity_flip_39=0x1 +phy_xaui_rx_polarity_flip_40=0x1 +phy_xaui_rx_polarity_flip_41=0x1 +phy_xaui_rx_polarity_flip_84=0x1 +phy_xaui_rx_polarity_flip_85=0x0 +phy_xaui_rx_polarity_flip_86=0x1 +phy_xaui_rx_polarity_flip_87=0x0 +phy_xaui_rx_polarity_flip_88=0x1 +phy_xaui_rx_polarity_flip_89=0x0 +phy_xaui_rx_polarity_flip_90=0x1 +phy_xaui_rx_polarity_flip_91=0x1 +phy_xaui_rx_polarity_flip_102=0x0 +phy_xaui_rx_polarity_flip_103=0x0 +phy_xaui_rx_polarity_flip_104=0x1 +phy_xaui_rx_polarity_flip_105=0x0 +phy_xaui_rx_polarity_flip_122=0xf +#Polarity TX +phy_xaui_tx_polarity_flip_42=0x1 +phy_xaui_tx_polarity_flip_43=0x1 +phy_xaui_tx_polarity_flip_44=0x1 +phy_xaui_tx_polarity_flip_45=0x1 +phy_xaui_tx_polarity_flip_34=0x1 +phy_xaui_tx_polarity_flip_35=0x1 +phy_xaui_tx_polarity_flip_36=0x1 +phy_xaui_tx_polarity_flip_37=0x1 +phy_xaui_tx_polarity_flip_38=0x0 +phy_xaui_tx_polarity_flip_39=0x1 +phy_xaui_tx_polarity_flip_40=0x0 +phy_xaui_tx_polarity_flip_41=0x1 +phy_xaui_tx_polarity_flip_72=0x1 +phy_xaui_tx_polarity_flip_73=0x1 +phy_xaui_tx_polarity_flip_74=0x1 +phy_xaui_tx_polarity_flip_75=0x1 +phy_xaui_tx_polarity_flip_84=0x1 +phy_xaui_tx_polarity_flip_85=0x1 +phy_xaui_tx_polarity_flip_86=0x1 +phy_xaui_tx_polarity_flip_87=0x1 +phy_xaui_tx_polarity_flip_88=0x1 +phy_xaui_tx_polarity_flip_89=0x1 +phy_xaui_tx_polarity_flip_90=0x1 +phy_xaui_tx_polarity_flip_91=0x1 +phy_xaui_tx_polarity_flip_102=0x1 +phy_xaui_tx_polarity_flip_103=0x1 +phy_xaui_tx_polarity_flip_104=0x1 +phy_xaui_tx_polarity_flip_105=0x1 +phy_xaui_tx_polarity_flip_122=0xb + +#Driver Current +serdes_driver_current_42=0x8 +serdes_driver_current_43=0x8 +serdes_driver_current_44=0x8 +serdes_driver_current_45=0x8 +serdes_driver_current_50=0x8 +serdes_driver_current_51=0x8 +serdes_driver_current_52=0x8 +serdes_driver_current_53=0x8 +serdes_driver_current_54=0x8 +serdes_driver_current_55=0x8 +serdes_driver_current_56=0x8 +serdes_driver_current_57=0x8 +serdes_driver_current_68=0x8 +serdes_driver_current_69=0x8 +serdes_driver_current_70=0x8 +serdes_driver_current_71=0x8 +serdes_driver_current_34=0x8 +serdes_driver_current_35=0x8 +serdes_driver_current_36=0x8 +serdes_driver_current_37=0x8 +serdes_driver_current_38=0x8 +serdes_driver_current_39=0x8 +serdes_driver_current_40=0x8 +serdes_driver_current_41=0x8 +serdes_driver_current_72=0x8 +serdes_driver_current_73=0x8 +serdes_driver_current_74=0x8 +serdes_driver_current_75=0x8 +serdes_driver_current_84=0x8 +serdes_driver_current_85=0x8 +serdes_driver_current_86=0x8 +serdes_driver_current_87=0x8 +serdes_driver_current_88=0x8 +serdes_driver_current_89=0x8 +serdes_driver_current_90=0x8 +serdes_driver_current_91=0x8 +serdes_driver_current_102=0x8 +serdes_driver_current_103=0x8 +serdes_driver_current_104=0x8 +serdes_driver_current_105=0x8 +serdes_driver_current_106=0x8 +serdes_driver_current_107=0x8 +serdes_driver_current_108=0x8 +serdes_driver_current_109=0x8 +serdes_driver_current_110=0x8 +serdes_driver_current_111=0x8 +serdes_driver_current_112=0x8 +serdes_driver_current_113=0x8 +serdes_driver_current_lane0_5=0x8 +serdes_driver_current_lane1_5=0x8 +serdes_driver_current_lane2_5=0x8 +serdes_driver_current_lane3_5=0x8 +serdes_driver_current_lane0_1=0x8 +serdes_driver_current_lane1_1=0x8 +serdes_driver_current_lane2_1=0x8 +serdes_driver_current_lane3_1=0x8 +serdes_driver_current_lane0_114=0x8 +serdes_driver_current_lane1_114=0x8 +serdes_driver_current_lane2_114=0x8 +serdes_driver_current_lane3_114=0x8 +serdes_driver_current_lane0_21=0x8 +serdes_driver_current_lane1_21=0x8 +serdes_driver_current_lane2_21=0x8 +serdes_driver_current_lane3_21=0x8 +serdes_driver_current_lane0_9=0x8 +serdes_driver_current_lane1_9=0x8 +serdes_driver_current_lane2_9=0x8 +serdes_driver_current_lane3_9=0x8 +serdes_driver_current_lane0_122=0x8 +serdes_driver_current_lane1_122=0x8 +serdes_driver_current_lane2_122=0x8 +serdes_driver_current_lane3_122=0x8 + +#Preemphasis +serdes_preemphasis_42=0x264006 +serdes_preemphasis_43=0x264006 +serdes_preemphasis_44=0x254106 +serdes_preemphasis_45=0x254106 +serdes_preemphasis_50=0x254106 +serdes_preemphasis_51=0x254106 +serdes_preemphasis_52=0x254106 +serdes_preemphasis_53=0x254106 +serdes_preemphasis_54=0x254106 +serdes_preemphasis_55=0x254106 +serdes_preemphasis_56=0x254106 +serdes_preemphasis_57=0x234306 +serdes_preemphasis_68=0x234306 +serdes_preemphasis_69=0x204606 +serdes_preemphasis_70=0x204606 +serdes_preemphasis_71=0x204606 +serdes_preemphasis_34=0x234306 +serdes_preemphasis_35=0x234306 +serdes_preemphasis_36=0x234306 +serdes_preemphasis_37=0x234306 +serdes_preemphasis_38=0x234306 +serdes_preemphasis_39=0x234306 +serdes_preemphasis_40=0x234306 +serdes_preemphasis_41=0x234306 +serdes_preemphasis_72=0x1e4806 +serdes_preemphasis_73=0x1e4806 +serdes_preemphasis_74=0x1e4806 +serdes_preemphasis_75=0x1e4806 +serdes_preemphasis_84=0x1e4806 +serdes_preemphasis_85=0x1a4c06 +serdes_preemphasis_86=0x1a4c06 +serdes_preemphasis_87=0x1b4b06 +serdes_preemphasis_88=0x1b4b06 +serdes_preemphasis_89=0x1e4806 +serdes_preemphasis_90=0x1e4806 +serdes_preemphasis_91=0x1e4806 +serdes_preemphasis_102=0x1e4806 +serdes_preemphasis_103=0x1e4806 +serdes_preemphasis_104=0x1e4806 +serdes_preemphasis_105=0x1e4806 +serdes_preemphasis_106=0x1e4806 +serdes_preemphasis_107=0x1e4806 +serdes_preemphasis_108=0x1e4806 +serdes_preemphasis_109=0x1e4806 +serdes_preemphasis_110=0x1e4806 +serdes_preemphasis_111=0x1d4906 +serdes_preemphasis_112=0x234306 +serdes_preemphasis_113=0x1f4706 +serdes_preemphasis_lane0_5=0x294106 +serdes_preemphasis_lane1_5=0x294106 +serdes_preemphasis_lane2_5=0x294106 +serdes_preemphasis_lane3_5=0x294106 +serdes_preemphasis_lane0_1=0x294106 +serdes_preemphasis_lane1_1=0x294106 +serdes_preemphasis_lane2_1=0x294106 +serdes_preemphasis_lane3_1=0x294106 +serdes_preemphasis_lane0_114=0x2a4006 +serdes_preemphasis_lane1_114=0x2a4006 +serdes_preemphasis_lane2_114=0x2a4006 +serdes_preemphasis_lane3_114=0x2a4006 +serdes_preemphasis_lane0_21=0x2c3c08 +serdes_preemphasis_lane1_21=0x2a4006 +serdes_preemphasis_lane2_21=0x2a4006 +serdes_preemphasis_lane3_21=0x2a4006 +serdes_preemphasis_lane0_9=0x284206 +serdes_preemphasis_lane1_9=0x284206 +serdes_preemphasis_lane2_9=0x284206 +serdes_preemphasis_lane3_9=0x284206 +serdes_preemphasis_lane0_122=0x283e06 +serdes_preemphasis_lane1_122=0x283e06 +serdes_preemphasis_lane2_122=0x283e06 +serdes_preemphasis_lane3_122=0x294601 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile b/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile index dc74eef4d54b..28953a08f205 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile +++ b/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7712-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-as7712-32x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/th-as7712-32x100G.config.bcm b/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/th-as7712-32x100G.config.bcm new file mode 100644 index 000000000000..09d97c5e4c63 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X/th-as7712-32x100G.config.bcm @@ -0,0 +1,570 @@ +# accton_as7712_32x 32x100G SDK config +os=unix +schan_intr_enable=0 +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +parity_correction=0 +parity_enable=0 +mmu_lossless=1 + +pbmp_oversubscribe=0x444444441111111104444444422222222 +pbmp_xport_xe=0x444444451111111144444444422222222 + +# +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 +dma_desc_timeout_usec=15000000 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +max_vp_lags=0 +miim_intr_enable=0 +oversubscribe_mode=1 + +# portmap_0=x:xx +#FC0 +portmap_1=1:100 + +#FC1 +portmap_5=5:100 + +#FC2 +portmap_9=9:100 + +#FC3 +portmap_13=13:100 + +#FC4 +portmap_17=17:100 + +#FC5 +portmap_21=21:100 + +#FC6 +portmap_25=25:100 + +#FC7 +portmap_29=29:100 + +# Tile-1 +#FC8 +portmap_34=33:100 + +#FC9 +portmap_38=37:100 + +#FC10 +portmap_42=41:100 + +#FC11 +portmap_46=45:100 + +#FC12 +portmap_50=49:100 + +#FC13 +portmap_54=53:100 + +#FC14 +portmap_58=57:100 + +#FC15 +portmap_62=61:100 + +#TSC-E Management port 1 +#portmap_66=129:10 +#portmap_67=133:10 + +# Tile-2 +#FC16 +portmap_68=65:100 + +#FC17 +portmap_72=69:100 + +#FC18 +portmap_76=73:100 + +#FC19 +portmap_80=77:100 + +#FC20 +portmap_84=81:100 + +#FC21 +portmap_88=85:100 + +#FC22 +portmap_92=89:100 + +#FC23 +portmap_96=93:100 + +#TSC-E Management port 2 +#portmap_100=131:10 +#portmap_101=134:10 + +# Tile-3 +#FC24 +portmap_102=97:100 + +#FC25 +portmap_106=101:100 + +#FC26 +portmap_110=105:100 + +#FC27 +portmap_114=109:100 + +#FC28 +portmap_118=113:100 + +#FC29 +portmap_122=117:100 + +#FC30 +portmap_126=121:100 + +#FC31 +portmap_130=125:100 + + + +## TX/RX Lane Swap +######### +# port5 # +# FC16 # +######### +xgxs_tx_lane_map_68=0x0123 +xgxs_rx_lane_map_68=0x0123 + +######### +# port8 # +# FC19 # +######### +xgxs_tx_lane_map_80=0x0123 +xgxs_rx_lane_map_80=0x0123 + +######### +# port13# +# FC20 # +######### +xgxs_tx_lane_map_84=0x1032 +xgxs_rx_lane_map_84=0x1032 + +######### +# port14# +# FC21 # +######### +xgxs_tx_lane_map_88=0x0123 +xgxs_rx_lane_map_88=0x0123 + +######### +# port15# +# FC22 # +######### +xgxs_tx_lane_map_92=0x1032 +xgxs_rx_lane_map_92=0x1032 + +######### +# port17# +# FC24 # +######### +xgxs_tx_lane_map_102=0x1032 +xgxs_rx_lane_map_102=0x1032 + +######### +# port18# +# FC25 # +######### +xgxs_tx_lane_map_106=0x0123 +xgxs_rx_lane_map_106=0x0123 + +######### +# port19# +# FC26 # +######### +xgxs_tx_lane_map_110=0x1032 +xgxs_rx_lane_map_110=0x1032 + +######### +# port20# +# FC27 # +######### +xgxs_tx_lane_map_114=0x0123 +xgxs_rx_lane_map_114=0x0123 + +######### +# port26# +# FC29 # +######### +xgxs_tx_lane_map_122=0x0123 +xgxs_rx_lane_map_122=0x0123 + +######### +# port27# +# FC30 # +######### +xgxs_tx_lane_map_126=0x0123 +xgxs_rx_lane_map_126=0x0123 + +######### +# port29# +# FC0 # +######### +xgxs_tx_lane_map_1=0x0123 +xgxs_rx_lane_map_1=0x0123 + +# port30# +# FC1 # +######### +xgxs_tx_lane_map_5=0x0123 +xgxs_rx_lane_map_5=0x0123 + +######### +# port31# +# FC2 # +######### +xgxs_tx_lane_map_9=0x0123 +xgxs_rx_lane_map_9=0x0123 + +######### +# port32# +# FC3 # +######### +xgxs_tx_lane_map_13=0x0123 +xgxs_rx_lane_map_13=0x0123 + + +## RX / TX Serdes lane polarity flip list +## RX / TX Serdes lane polarity flip list +######### +# FC4 # +# port21 # +######### +phy_xaui_tx_polarity_flip_17=0xf + +######### +# FC20 # +# port13 # +######### +phy_xaui_rx_polarity_flip_84=0xf +phy_xaui_tx_polarity_flip_84=0x6 + +######### +# FC21 # +# port14 # +######### +phy_xaui_rx_polarity_flip_88=0xf + +######### +# FC22 # +# port15 # +######### +phy_xaui_rx_polarity_flip_92=0xf +phy_xaui_tx_polarity_flip_92=0xe + + +######### +# FC23 # +# port16 # +######### +phy_xaui_tx_polarity_flip_96=0x1 + +######### +# FC24 # +# port17 # +######### +phy_xaui_tx_polarity_flip_102=0x1 + + +######### +# FC25 # +# port18 # +######### +phy_xaui_rx_polarity_flip_106=0xf + +######### +# FC26 # +# port19 # +######### +phy_xaui_tx_polarity_flip_110=0xe + +######### +# FC27 # +# port20 # +######### +phy_xaui_rx_polarity_flip_114=0x2 + +######### +# FC28 # +# port25 # +######### +phy_xaui_rx_polarity_flip_118=0xa +phy_xaui_tx_polarity_flip_118=0xf + +#Driver Current +serdes_driver_current_lane0_1=0x8 +serdes_driver_current_lane1_1=0x8 +serdes_driver_current_lane2_1=0x8 +serdes_driver_current_lane3_1=0x8 +serdes_driver_current_lane0_5=0x8 +serdes_driver_current_lane1_5=0x8 +serdes_driver_current_lane2_5=0x8 +serdes_driver_current_lane3_5=0x8 +serdes_driver_current_lane0_9=0x8 +serdes_driver_current_lane1_9=0x8 +serdes_driver_current_lane2_9=0x8 +serdes_driver_current_lane3_9=0x8 +serdes_driver_current_lane0_13=0x8 +serdes_driver_current_lane1_13=0x8 +serdes_driver_current_lane2_13=0x8 +serdes_driver_current_lane3_13=0x8 +serdes_driver_current_lane0_17=0x8 +serdes_driver_current_lane1_17=0x8 +serdes_driver_current_lane2_17=0x8 +serdes_driver_current_lane3_17=0x8 +serdes_driver_current_lane0_21=0x8 +serdes_driver_current_lane1_21=0x8 +serdes_driver_current_lane2_21=0x8 +serdes_driver_current_lane3_21=0x8 +serdes_driver_current_lane0_25=0x8 +serdes_driver_current_lane1_25=0x8 +serdes_driver_current_lane2_25=0x8 +serdes_driver_current_lane3_25=0x8 +serdes_driver_current_lane0_29=0x8 +serdes_driver_current_lane1_29=0x8 +serdes_driver_current_lane2_29=0x8 +serdes_driver_current_lane3_29=0x8 +serdes_driver_current_lane0_34=0x8 +serdes_driver_current_lane1_34=0x8 +serdes_driver_current_lane2_34=0x8 +serdes_driver_current_lane3_34=0x8 +serdes_driver_current_lane0_38=0x8 +serdes_driver_current_lane1_38=0x8 +serdes_driver_current_lane2_38=0x8 +serdes_driver_current_lane3_38=0x8 +serdes_driver_current_lane0_42=0x8 +serdes_driver_current_lane1_42=0x8 +serdes_driver_current_lane2_42=0x8 +serdes_driver_current_lane3_42=0x8 +serdes_driver_current_lane0_46=0x8 +serdes_driver_current_lane1_46=0x8 +serdes_driver_current_lane2_46=0x8 +serdes_driver_current_lane3_46=0x8 +serdes_driver_current_lane0_50=0x8 +serdes_driver_current_lane1_50=0x8 +serdes_driver_current_lane2_50=0x8 +serdes_driver_current_lane3_50=0x8 +serdes_driver_current_lane0_54=0x8 +serdes_driver_current_lane1_54=0x8 +serdes_driver_current_lane2_54=0x8 +serdes_driver_current_lane3_54=0x8 +serdes_driver_current_lane0_58=0x8 +serdes_driver_current_lane1_58=0x8 +serdes_driver_current_lane2_58=0x8 +serdes_driver_current_lane3_58=0x8 +serdes_driver_current_lane0_62=0x8 +serdes_driver_current_lane1_62=0x8 +serdes_driver_current_lane2_62=0x8 +serdes_driver_current_lane3_62=0x8 +serdes_driver_current_lane0_68=0x8 +serdes_driver_current_lane1_68=0x8 +serdes_driver_current_lane2_68=0x8 +serdes_driver_current_lane3_68=0x8 +serdes_driver_current_lane0_72=0x8 +serdes_driver_current_lane1_72=0x8 +serdes_driver_current_lane2_72=0x8 +serdes_driver_current_lane3_72=0x8 +serdes_driver_current_lane0_76=0x8 +serdes_driver_current_lane1_76=0x8 +serdes_driver_current_lane2_76=0x8 +serdes_driver_current_lane3_76=0x8 +serdes_driver_current_lane0_80=0x8 +serdes_driver_current_lane1_80=0x8 +serdes_driver_current_lane2_80=0x8 +serdes_driver_current_lane3_80=0x8 +serdes_driver_current_lane0_84=0x8 +serdes_driver_current_lane1_84=0x8 +serdes_driver_current_lane2_84=0x8 +serdes_driver_current_lane3_84=0x8 +serdes_driver_current_lane0_88=0x8 +serdes_driver_current_lane1_88=0x8 +serdes_driver_current_lane2_88=0x8 +serdes_driver_current_lane3_88=0x8 +serdes_driver_current_lane0_92=0x8 +serdes_driver_current_lane1_92=0x8 +serdes_driver_current_lane2_92=0x8 +serdes_driver_current_lane3_92=0x8 +serdes_driver_current_lane0_96=0x8 +serdes_driver_current_lane1_96=0x8 +serdes_driver_current_lane2_96=0x8 +serdes_driver_current_lane3_96=0x8 +serdes_driver_current_lane0_102=0x8 +serdes_driver_current_lane1_102=0x8 +serdes_driver_current_lane2_102=0x8 +serdes_driver_current_lane3_102=0x8 +serdes_driver_current_lane0_106=0x8 +serdes_driver_current_lane1_106=0x8 +serdes_driver_current_lane2_106=0x8 +serdes_driver_current_lane3_106=0x8 +serdes_driver_current_lane0_110=0x8 +serdes_driver_current_lane1_110=0x8 +serdes_driver_current_lane2_110=0x8 +serdes_driver_current_lane3_110=0x8 +serdes_driver_current_lane0_114=0x8 +serdes_driver_current_lane1_114=0x8 +serdes_driver_current_lane2_114=0x8 +serdes_driver_current_lane3_114=0x8 +serdes_driver_current_lane0_118=0x8 +serdes_driver_current_lane1_118=0x8 +serdes_driver_current_lane2_118=0x8 +serdes_driver_current_lane3_118=0x8 +serdes_driver_current_lane0_122=0x8 +serdes_driver_current_lane1_122=0x8 +serdes_driver_current_lane2_122=0x8 +serdes_driver_current_lane3_122=0x8 +serdes_driver_current_lane0_126=0x8 +serdes_driver_current_lane1_126=0x8 +serdes_driver_current_lane2_126=0x8 +serdes_driver_current_lane3_126=0x8 +serdes_driver_current_lane0_130=0x8 +serdes_driver_current_lane1_130=0x8 +serdes_driver_current_lane2_130=0x8 +serdes_driver_current_lane3_130=0x8 + +#Preemphasis +serdes_preemphasis_lane0_1=0x264204 +serdes_preemphasis_lane1_1=0x264204 +serdes_preemphasis_lane2_1=0x264204 +serdes_preemphasis_lane3_1=0x264204 +serdes_preemphasis_lane0_5=0x224406 +serdes_preemphasis_lane1_5=0x224406 +serdes_preemphasis_lane2_5=0x264204 +serdes_preemphasis_lane3_5=0x244206 +serdes_preemphasis_lane0_9=0x204606 +serdes_preemphasis_lane1_9=0x264204 +serdes_preemphasis_lane2_9=0x204606 +serdes_preemphasis_lane3_9=0x224406 +serdes_preemphasis_lane0_13=0x204606 +serdes_preemphasis_lane1_13=0x224406 +serdes_preemphasis_lane2_13=0x224406 +serdes_preemphasis_lane3_13=0x244206 +serdes_preemphasis_lane0_17=0x204606 +serdes_preemphasis_lane1_17=0x204606 +serdes_preemphasis_lane2_17=0x204606 +serdes_preemphasis_lane3_17=0x204606 +serdes_preemphasis_lane0_21=0x204606 +serdes_preemphasis_lane1_21=0x204606 +serdes_preemphasis_lane2_21=0x204606 +serdes_preemphasis_lane3_21=0x224406 +serdes_preemphasis_lane0_25=0x204606 +serdes_preemphasis_lane1_25=0x204606 +serdes_preemphasis_lane2_25=0x204606 +serdes_preemphasis_lane3_25=0x204606 +serdes_preemphasis_lane0_29=0x204606 +serdes_preemphasis_lane1_29=0x204606 +serdes_preemphasis_lane2_29=0x204606 +serdes_preemphasis_lane3_29=0x204606 +serdes_preemphasis_lane0_34=0x284601 +serdes_preemphasis_lane1_34=0x284601 +serdes_preemphasis_lane2_34=0x284601 +serdes_preemphasis_lane3_34=0x284601 +serdes_preemphasis_lane0_38=0x204604 +serdes_preemphasis_lane1_38=0x204604 +serdes_preemphasis_lane2_38=0x224406 +serdes_preemphasis_lane3_38=0x224406 +serdes_preemphasis_lane0_42=0x284601 +serdes_preemphasis_lane1_42=0x294501 +serdes_preemphasis_lane2_42=0x284601 +serdes_preemphasis_lane3_42=0x284601 +serdes_preemphasis_lane0_46=0x204802 +serdes_preemphasis_lane1_46=0x204802 +serdes_preemphasis_lane2_46=0x204802 +serdes_preemphasis_lane3_46=0x204802 +serdes_preemphasis_lane0_50=0x1e4f01 +serdes_preemphasis_lane1_50=0x1e4d01 +serdes_preemphasis_lane2_50=0x1e4f01 +serdes_preemphasis_lane3_50=0x1e4f01 +serdes_preemphasis_lane0_54=0x1f4a03 +serdes_preemphasis_lane1_54=0x1f4a03 +serdes_preemphasis_lane2_54=0x1f4a03 +serdes_preemphasis_lane3_54=0x1f4a03 +serdes_preemphasis_lane0_58=0x1e4f01 +serdes_preemphasis_lane1_58=0x1e4f01 +serdes_preemphasis_lane2_58=0x1e4f01 +serdes_preemphasis_lane3_58=0x1e4f01 +serdes_preemphasis_lane0_62=0x1e4e02 +serdes_preemphasis_lane1_62=0x1e4e02 +serdes_preemphasis_lane2_62=0x1e4e02 +serdes_preemphasis_lane3_62=0x1e4e02 +serdes_preemphasis_lane0_68=0x1e4f01 +serdes_preemphasis_lane1_68=0x1e4f01 +serdes_preemphasis_lane2_68=0x1e4f01 +serdes_preemphasis_lane3_68=0x1e4f01 +serdes_preemphasis_lane0_72=0x1e4e02 +serdes_preemphasis_lane1_72=0x1e4e02 +serdes_preemphasis_lane2_72=0x1e4e02 +serdes_preemphasis_lane3_72=0x1e4e02 +serdes_preemphasis_lane0_76=0x1c4d02 +serdes_preemphasis_lane1_76=0x195002 +serdes_preemphasis_lane2_76=0x195002 +serdes_preemphasis_lane3_76=0x195002 +serdes_preemphasis_lane0_80=0x1e4e02 +serdes_preemphasis_lane1_80=0x1e4e02 +serdes_preemphasis_lane2_80=0x1e4e02 +serdes_preemphasis_lane3_80=0x1e4e02 +serdes_preemphasis_lane0_84=0x234701 +serdes_preemphasis_lane1_84=0x234701 +serdes_preemphasis_lane2_84=0x234701 +serdes_preemphasis_lane3_84=0x234701 +serdes_preemphasis_lane0_88=0x224802 +serdes_preemphasis_lane1_88=0x224602 +serdes_preemphasis_lane2_88=0x224802 +serdes_preemphasis_lane3_88=0x224802 +serdes_preemphasis_lane0_92=0x234801 +serdes_preemphasis_lane1_92=0x244701 +serdes_preemphasis_lane2_92=0x234801 +serdes_preemphasis_lane3_92=0x234601 +serdes_preemphasis_lane0_96=0x204406 +serdes_preemphasis_lane1_96=0x204406 +serdes_preemphasis_lane2_96=0x204406 +serdes_preemphasis_lane3_96=0x224602 +serdes_preemphasis_lane0_102=0x204606 +serdes_preemphasis_lane1_102=0x235002 +serdes_preemphasis_lane2_102=0x204606 +serdes_preemphasis_lane3_102=0x204606 +serdes_preemphasis_lane0_106=0x204606 +serdes_preemphasis_lane1_106=0x204606 +serdes_preemphasis_lane2_106=0x204606 +serdes_preemphasis_lane3_106=0x204606 +serdes_preemphasis_lane0_110=0x204606 +serdes_preemphasis_lane1_110=0x224406 +serdes_preemphasis_lane2_110=0x224406 +serdes_preemphasis_lane3_110=0x224406 +serdes_preemphasis_lane0_114=0x224406 +serdes_preemphasis_lane1_114=0x204606 +serdes_preemphasis_lane2_114=0x204606 +serdes_preemphasis_lane3_114=0x224406 +serdes_preemphasis_lane0_118=0x224406 +serdes_preemphasis_lane1_118=0x224406 +serdes_preemphasis_lane2_118=0x224406 +serdes_preemphasis_lane3_118=0x224406 +serdes_preemphasis_lane0_122=0x244404 +serdes_preemphasis_lane1_122=0x244404 +serdes_preemphasis_lane2_122=0x244404 +serdes_preemphasis_lane3_122=0x244404 +serdes_preemphasis_lane0_126=0x234504 +serdes_preemphasis_lane1_126=0x234404 +serdes_preemphasis_lane2_126=0x224406 +serdes_preemphasis_lane3_126=0x224406 +serdes_preemphasis_lane0_130=0x244404 +serdes_preemphasis_lane1_130=0x244404 +serdes_preemphasis_lane2_130=0x234504 +serdes_preemphasis_lane3_130=0x264501 diff --git a/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile b/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile index de1e16b49544..65944732653c 100644 --- a/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile +++ b/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7716-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-as7716-32x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/th-as7716-32x100G.config.bcm b/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/th-as7716-32x100G.config.bcm new file mode 100644 index 000000000000..1231bf302be7 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/Accton-AS7716-32X/th-as7716-32x100G.config.bcm @@ -0,0 +1,570 @@ +# accton_as7716_32x 32x100G SDK config +os=unix +schan_intr_enable=0 +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +parity_correction=0 +parity_enable=0 +mmu_lossless=1 + +pbmp_oversubscribe=0x444444441111111104444444422222222 +pbmp_xport_xe=0x444444451111111144444444422222222 + +# +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 +dma_desc_timeout_usec=15000000 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +max_vp_lags=0 +miim_intr_enable=0 +oversubscribe_mode=1 + +# portmap_0=x:xx +#FC0 +portmap_1=1:100 + +#FC1 +portmap_5=5:100 + +#FC2 +portmap_9=9:100 + +#FC3 +portmap_13=13:100 + +#FC4 +portmap_17=17:100 + +#FC5 +portmap_21=21:100 + +#FC6 +portmap_25=25:100 + +#FC7 +portmap_29=29:100 + +# Tile-1 +#FC8 +portmap_34=33:100 + +#FC9 +portmap_38=37:100 + +#FC10 +portmap_42=41:100 + +#FC11 +portmap_46=45:100 + +#FC12 +portmap_50=49:100 + +#FC13 +portmap_54=53:100 + +#FC14 +portmap_58=57:100 + +#FC15 +portmap_62=61:100 + +#TSC-E Management port 1 +#portmap_66=129:10 +#portmap_67=133:10 + +# Tile-2 +#FC16 +portmap_68=65:100 + +#FC17 +portmap_72=69:100 + +#FC18 +portmap_76=73:100 + +#FC19 +portmap_80=77:100 + +#FC20 +portmap_84=81:100 + +#FC21 +portmap_88=85:100 + +#FC22 +portmap_92=89:100 + +#FC23 +portmap_96=93:100 + +#TSC-E Management port 2 +#portmap_100=131:10 +#portmap_101=134:10 + +# Tile-3 +#FC24 +portmap_102=97:100 + +#FC25 +portmap_106=101:100 + +#FC26 +portmap_110=105:100 + +#FC27 +portmap_114=109:100 + +#FC28 +portmap_118=113:100 + +#FC29 +portmap_122=117:100 + +#FC30 +portmap_126=121:100 + +#FC31 +portmap_130=125:100 + + + +## TX/RX Lane Swap +######### +# port5 # +# FC16 # +######### +xgxs_tx_lane_map_68=0x0123 +xgxs_rx_lane_map_68=0x0123 + +######### +# port8 # +# FC19 # +######### +xgxs_tx_lane_map_80=0x0123 +xgxs_rx_lane_map_80=0x0123 + +######### +# port13# +# FC20 # +######### +xgxs_tx_lane_map_84=0x1032 +xgxs_rx_lane_map_84=0x1032 + +######### +# port14# +# FC21 # +######### +xgxs_tx_lane_map_88=0x0123 +xgxs_rx_lane_map_88=0x0123 + +######### +# port15# +# FC22 # +######### +xgxs_tx_lane_map_92=0x1032 +xgxs_rx_lane_map_92=0x1032 + +######### +# port17# +# FC24 # +######### +xgxs_tx_lane_map_102=0x1032 +xgxs_rx_lane_map_102=0x1032 + +######### +# port18# +# FC25 # +######### +xgxs_tx_lane_map_106=0x0123 +xgxs_rx_lane_map_106=0x0123 + +######### +# port19# +# FC26 # +######### +xgxs_tx_lane_map_110=0x1032 +xgxs_rx_lane_map_110=0x1032 + +######### +# port20# +# FC27 # +######### +xgxs_tx_lane_map_114=0x0123 +xgxs_rx_lane_map_114=0x0123 + +######### +# port26# +# FC29 # +######### +xgxs_tx_lane_map_122=0x0123 +xgxs_rx_lane_map_122=0x0123 + +######### +# port27# +# FC30 # +######### +xgxs_tx_lane_map_126=0x0123 +xgxs_rx_lane_map_126=0x0123 + +######### +# port29# +# FC0 # +######### +xgxs_tx_lane_map_1=0x0123 +xgxs_rx_lane_map_1=0x0123 + +# port30# +# FC1 # +######### +xgxs_tx_lane_map_5=0x0123 +xgxs_rx_lane_map_5=0x0123 + +######### +# port31# +# FC2 # +######### +xgxs_tx_lane_map_9=0x0123 +xgxs_rx_lane_map_9=0x0123 + +######### +# port32# +# FC3 # +######### +xgxs_tx_lane_map_13=0x0123 +xgxs_rx_lane_map_13=0x0123 + + +## RX / TX Serdes lane polarity flip list +## RX / TX Serdes lane polarity flip list +######### +# FC4 # +# port21 # +######### +phy_xaui_tx_polarity_flip_17=0xf + +######### +# FC20 # +# port13 # +######### +phy_xaui_rx_polarity_flip_84=0xf +phy_xaui_tx_polarity_flip_84=0x6 + +######### +# FC21 # +# port14 # +######### +phy_xaui_rx_polarity_flip_88=0xf + +######### +# FC22 # +# port15 # +######### +phy_xaui_rx_polarity_flip_92=0xf +phy_xaui_tx_polarity_flip_92=0xe + + +######### +# FC23 # +# port16 # +######### +phy_xaui_tx_polarity_flip_96=0x1 + +######### +# FC24 # +# port17 # +######### +phy_xaui_tx_polarity_flip_102=0x1 + + +######### +# FC25 # +# port18 # +######### +phy_xaui_rx_polarity_flip_106=0xf + +######### +# FC26 # +# port19 # +######### +phy_xaui_tx_polarity_flip_110=0xe + +######### +# FC27 # +# port20 # +######### +phy_xaui_rx_polarity_flip_114=0x2 + +######### +# FC28 # +# port25 # +######### +phy_xaui_rx_polarity_flip_118=0xa +phy_xaui_tx_polarity_flip_118=0xf + +#Driver Current +serdes_driver_current_lane0_1=0x8 +serdes_driver_current_lane1_1=0x8 +serdes_driver_current_lane2_1=0x8 +serdes_driver_current_lane3_1=0x8 +serdes_driver_current_lane0_5=0x8 +serdes_driver_current_lane1_5=0x8 +serdes_driver_current_lane2_5=0x8 +serdes_driver_current_lane3_5=0x8 +serdes_driver_current_lane0_9=0x8 +serdes_driver_current_lane1_9=0x8 +serdes_driver_current_lane2_9=0x8 +serdes_driver_current_lane3_9=0x8 +serdes_driver_current_lane0_13=0x8 +serdes_driver_current_lane1_13=0x8 +serdes_driver_current_lane2_13=0x8 +serdes_driver_current_lane3_13=0x8 +serdes_driver_current_lane0_17=0x8 +serdes_driver_current_lane1_17=0x8 +serdes_driver_current_lane2_17=0x8 +serdes_driver_current_lane3_17=0x8 +serdes_driver_current_lane0_21=0x8 +serdes_driver_current_lane1_21=0x8 +serdes_driver_current_lane2_21=0x8 +serdes_driver_current_lane3_21=0x8 +serdes_driver_current_lane0_25=0x8 +serdes_driver_current_lane1_25=0x8 +serdes_driver_current_lane2_25=0x8 +serdes_driver_current_lane3_25=0x8 +serdes_driver_current_lane0_29=0x8 +serdes_driver_current_lane1_29=0x8 +serdes_driver_current_lane2_29=0x8 +serdes_driver_current_lane3_29=0x8 +serdes_driver_current_lane0_34=0x8 +serdes_driver_current_lane1_34=0x8 +serdes_driver_current_lane2_34=0x8 +serdes_driver_current_lane3_34=0x8 +serdes_driver_current_lane0_38=0x8 +serdes_driver_current_lane1_38=0x8 +serdes_driver_current_lane2_38=0x8 +serdes_driver_current_lane3_38=0x8 +serdes_driver_current_lane0_42=0x8 +serdes_driver_current_lane1_42=0x8 +serdes_driver_current_lane2_42=0x8 +serdes_driver_current_lane3_42=0x8 +serdes_driver_current_lane0_46=0x8 +serdes_driver_current_lane1_46=0x8 +serdes_driver_current_lane2_46=0x8 +serdes_driver_current_lane3_46=0x8 +serdes_driver_current_lane0_50=0x8 +serdes_driver_current_lane1_50=0x8 +serdes_driver_current_lane2_50=0x8 +serdes_driver_current_lane3_50=0x8 +serdes_driver_current_lane0_54=0x8 +serdes_driver_current_lane1_54=0x8 +serdes_driver_current_lane2_54=0x8 +serdes_driver_current_lane3_54=0x8 +serdes_driver_current_lane0_58=0x8 +serdes_driver_current_lane1_58=0x8 +serdes_driver_current_lane2_58=0x8 +serdes_driver_current_lane3_58=0x8 +serdes_driver_current_lane0_62=0x8 +serdes_driver_current_lane1_62=0x8 +serdes_driver_current_lane2_62=0x8 +serdes_driver_current_lane3_62=0x8 +serdes_driver_current_lane0_68=0x8 +serdes_driver_current_lane1_68=0x8 +serdes_driver_current_lane2_68=0x8 +serdes_driver_current_lane3_68=0x8 +serdes_driver_current_lane0_72=0x8 +serdes_driver_current_lane1_72=0x8 +serdes_driver_current_lane2_72=0x8 +serdes_driver_current_lane3_72=0x8 +serdes_driver_current_lane0_76=0x8 +serdes_driver_current_lane1_76=0x8 +serdes_driver_current_lane2_76=0x8 +serdes_driver_current_lane3_76=0x8 +serdes_driver_current_lane0_80=0x8 +serdes_driver_current_lane1_80=0x8 +serdes_driver_current_lane2_80=0x8 +serdes_driver_current_lane3_80=0x8 +serdes_driver_current_lane0_84=0x8 +serdes_driver_current_lane1_84=0x8 +serdes_driver_current_lane2_84=0x8 +serdes_driver_current_lane3_84=0x8 +serdes_driver_current_lane0_88=0x8 +serdes_driver_current_lane1_88=0x8 +serdes_driver_current_lane2_88=0x8 +serdes_driver_current_lane3_88=0x8 +serdes_driver_current_lane0_92=0x8 +serdes_driver_current_lane1_92=0x8 +serdes_driver_current_lane2_92=0x8 +serdes_driver_current_lane3_92=0x8 +serdes_driver_current_lane0_96=0x8 +serdes_driver_current_lane1_96=0x8 +serdes_driver_current_lane2_96=0x8 +serdes_driver_current_lane3_96=0x8 +serdes_driver_current_lane0_102=0x8 +serdes_driver_current_lane1_102=0x8 +serdes_driver_current_lane2_102=0x8 +serdes_driver_current_lane3_102=0x8 +serdes_driver_current_lane0_106=0x8 +serdes_driver_current_lane1_106=0x8 +serdes_driver_current_lane2_106=0x8 +serdes_driver_current_lane3_106=0x8 +serdes_driver_current_lane0_110=0x8 +serdes_driver_current_lane1_110=0x8 +serdes_driver_current_lane2_110=0x8 +serdes_driver_current_lane3_110=0x8 +serdes_driver_current_lane0_114=0x8 +serdes_driver_current_lane1_114=0x8 +serdes_driver_current_lane2_114=0x8 +serdes_driver_current_lane3_114=0x8 +serdes_driver_current_lane0_118=0x8 +serdes_driver_current_lane1_118=0x8 +serdes_driver_current_lane2_118=0x8 +serdes_driver_current_lane3_118=0x8 +serdes_driver_current_lane0_122=0x8 +serdes_driver_current_lane1_122=0x8 +serdes_driver_current_lane2_122=0x8 +serdes_driver_current_lane3_122=0x8 +serdes_driver_current_lane0_126=0x8 +serdes_driver_current_lane1_126=0x8 +serdes_driver_current_lane2_126=0x8 +serdes_driver_current_lane3_126=0x8 +serdes_driver_current_lane0_130=0x8 +serdes_driver_current_lane1_130=0x8 +serdes_driver_current_lane2_130=0x8 +serdes_driver_current_lane3_130=0x8 + +#Preemphasis +serdes_preemphasis_lane0_1=0x264204 +serdes_preemphasis_lane1_1=0x264204 +serdes_preemphasis_lane2_1=0x264204 +serdes_preemphasis_lane3_1=0x264204 +serdes_preemphasis_lane0_5=0x224406 +serdes_preemphasis_lane1_5=0x224406 +serdes_preemphasis_lane2_5=0x264204 +serdes_preemphasis_lane3_5=0x244206 +serdes_preemphasis_lane0_9=0x204606 +serdes_preemphasis_lane1_9=0x264204 +serdes_preemphasis_lane2_9=0x204606 +serdes_preemphasis_lane3_9=0x224406 +serdes_preemphasis_lane0_13=0x204606 +serdes_preemphasis_lane1_13=0x224406 +serdes_preemphasis_lane2_13=0x224406 +serdes_preemphasis_lane3_13=0x244206 +serdes_preemphasis_lane0_17=0x204606 +serdes_preemphasis_lane1_17=0x204606 +serdes_preemphasis_lane2_17=0x204606 +serdes_preemphasis_lane3_17=0x204606 +serdes_preemphasis_lane0_21=0x204606 +serdes_preemphasis_lane1_21=0x204606 +serdes_preemphasis_lane2_21=0x204606 +serdes_preemphasis_lane3_21=0x224406 +serdes_preemphasis_lane0_25=0x204606 +serdes_preemphasis_lane1_25=0x204606 +serdes_preemphasis_lane2_25=0x204606 +serdes_preemphasis_lane3_25=0x204606 +serdes_preemphasis_lane0_29=0x204606 +serdes_preemphasis_lane1_29=0x204606 +serdes_preemphasis_lane2_29=0x204606 +serdes_preemphasis_lane3_29=0x204606 +serdes_preemphasis_lane0_34=0x284601 +serdes_preemphasis_lane1_34=0x284601 +serdes_preemphasis_lane2_34=0x284601 +serdes_preemphasis_lane3_34=0x284601 +serdes_preemphasis_lane0_38=0x204604 +serdes_preemphasis_lane1_38=0x204604 +serdes_preemphasis_lane2_38=0x224406 +serdes_preemphasis_lane3_38=0x224406 +serdes_preemphasis_lane0_42=0x284601 +serdes_preemphasis_lane1_42=0x294501 +serdes_preemphasis_lane2_42=0x284601 +serdes_preemphasis_lane3_42=0x284601 +serdes_preemphasis_lane0_46=0x204802 +serdes_preemphasis_lane1_46=0x204802 +serdes_preemphasis_lane2_46=0x204802 +serdes_preemphasis_lane3_46=0x204802 +serdes_preemphasis_lane0_50=0x1e4f01 +serdes_preemphasis_lane1_50=0x1e4d01 +serdes_preemphasis_lane2_50=0x1e4f01 +serdes_preemphasis_lane3_50=0x1e4f01 +serdes_preemphasis_lane0_54=0x1f4a03 +serdes_preemphasis_lane1_54=0x1f4a03 +serdes_preemphasis_lane2_54=0x1f4a03 +serdes_preemphasis_lane3_54=0x1f4a03 +serdes_preemphasis_lane0_58=0x1e4f01 +serdes_preemphasis_lane1_58=0x1e4f01 +serdes_preemphasis_lane2_58=0x1e4f01 +serdes_preemphasis_lane3_58=0x1e4f01 +serdes_preemphasis_lane0_62=0x1e4e02 +serdes_preemphasis_lane1_62=0x1e4e02 +serdes_preemphasis_lane2_62=0x1e4e02 +serdes_preemphasis_lane3_62=0x1e4e02 +serdes_preemphasis_lane0_68=0x1e4f01 +serdes_preemphasis_lane1_68=0x1e4f01 +serdes_preemphasis_lane2_68=0x1e4f01 +serdes_preemphasis_lane3_68=0x1e4f01 +serdes_preemphasis_lane0_72=0x1e4e02 +serdes_preemphasis_lane1_72=0x1e4e02 +serdes_preemphasis_lane2_72=0x1e4e02 +serdes_preemphasis_lane3_72=0x1e4e02 +serdes_preemphasis_lane0_76=0x1c4d02 +serdes_preemphasis_lane1_76=0x195002 +serdes_preemphasis_lane2_76=0x195002 +serdes_preemphasis_lane3_76=0x195002 +serdes_preemphasis_lane0_80=0x1e4e02 +serdes_preemphasis_lane1_80=0x1e4e02 +serdes_preemphasis_lane2_80=0x1e4e02 +serdes_preemphasis_lane3_80=0x1e4e02 +serdes_preemphasis_lane0_84=0x234701 +serdes_preemphasis_lane1_84=0x234701 +serdes_preemphasis_lane2_84=0x234701 +serdes_preemphasis_lane3_84=0x234701 +serdes_preemphasis_lane0_88=0x224802 +serdes_preemphasis_lane1_88=0x224602 +serdes_preemphasis_lane2_88=0x224802 +serdes_preemphasis_lane3_88=0x224802 +serdes_preemphasis_lane0_92=0x234801 +serdes_preemphasis_lane1_92=0x244701 +serdes_preemphasis_lane2_92=0x234801 +serdes_preemphasis_lane3_92=0x234601 +serdes_preemphasis_lane0_96=0x204406 +serdes_preemphasis_lane1_96=0x204406 +serdes_preemphasis_lane2_96=0x204406 +serdes_preemphasis_lane3_96=0x224602 +serdes_preemphasis_lane0_102=0x204606 +serdes_preemphasis_lane1_102=0x235002 +serdes_preemphasis_lane2_102=0x204606 +serdes_preemphasis_lane3_102=0x204606 +serdes_preemphasis_lane0_106=0x204606 +serdes_preemphasis_lane1_106=0x204606 +serdes_preemphasis_lane2_106=0x204606 +serdes_preemphasis_lane3_106=0x204606 +serdes_preemphasis_lane0_110=0x204606 +serdes_preemphasis_lane1_110=0x224406 +serdes_preemphasis_lane2_110=0x224406 +serdes_preemphasis_lane3_110=0x224406 +serdes_preemphasis_lane0_114=0x224406 +serdes_preemphasis_lane1_114=0x204606 +serdes_preemphasis_lane2_114=0x204606 +serdes_preemphasis_lane3_114=0x224406 +serdes_preemphasis_lane0_118=0x224406 +serdes_preemphasis_lane1_118=0x224406 +serdes_preemphasis_lane2_118=0x224406 +serdes_preemphasis_lane3_118=0x224406 +serdes_preemphasis_lane0_122=0x244404 +serdes_preemphasis_lane1_122=0x244404 +serdes_preemphasis_lane2_122=0x244404 +serdes_preemphasis_lane3_122=0x244404 +serdes_preemphasis_lane0_126=0x234504 +serdes_preemphasis_lane1_126=0x234404 +serdes_preemphasis_lane2_126=0x224406 +serdes_preemphasis_lane3_126=0x224406 +serdes_preemphasis_lane0_130=0x244404 +serdes_preemphasis_lane1_130=0x244404 +serdes_preemphasis_lane2_130=0x234504 +serdes_preemphasis_lane3_130=0x264501 diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/sai.profile b/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/sai.profile index de1e16b49544..65944732653c 100755 --- a/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/sai.profile +++ b/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-as7716-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-as7716-32x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/th-as7716-32x100G.config.bcm b/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/th-as7716-32x100G.config.bcm new file mode 100644 index 000000000000..1231bf302be7 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/Accton-AS7716-32XB/th-as7716-32x100G.config.bcm @@ -0,0 +1,570 @@ +# accton_as7716_32x 32x100G SDK config +os=unix +schan_intr_enable=0 +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +parity_correction=0 +parity_enable=0 +mmu_lossless=1 + +pbmp_oversubscribe=0x444444441111111104444444422222222 +pbmp_xport_xe=0x444444451111111144444444422222222 + +# +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 +dma_desc_timeout_usec=15000000 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +max_vp_lags=0 +miim_intr_enable=0 +oversubscribe_mode=1 + +# portmap_0=x:xx +#FC0 +portmap_1=1:100 + +#FC1 +portmap_5=5:100 + +#FC2 +portmap_9=9:100 + +#FC3 +portmap_13=13:100 + +#FC4 +portmap_17=17:100 + +#FC5 +portmap_21=21:100 + +#FC6 +portmap_25=25:100 + +#FC7 +portmap_29=29:100 + +# Tile-1 +#FC8 +portmap_34=33:100 + +#FC9 +portmap_38=37:100 + +#FC10 +portmap_42=41:100 + +#FC11 +portmap_46=45:100 + +#FC12 +portmap_50=49:100 + +#FC13 +portmap_54=53:100 + +#FC14 +portmap_58=57:100 + +#FC15 +portmap_62=61:100 + +#TSC-E Management port 1 +#portmap_66=129:10 +#portmap_67=133:10 + +# Tile-2 +#FC16 +portmap_68=65:100 + +#FC17 +portmap_72=69:100 + +#FC18 +portmap_76=73:100 + +#FC19 +portmap_80=77:100 + +#FC20 +portmap_84=81:100 + +#FC21 +portmap_88=85:100 + +#FC22 +portmap_92=89:100 + +#FC23 +portmap_96=93:100 + +#TSC-E Management port 2 +#portmap_100=131:10 +#portmap_101=134:10 + +# Tile-3 +#FC24 +portmap_102=97:100 + +#FC25 +portmap_106=101:100 + +#FC26 +portmap_110=105:100 + +#FC27 +portmap_114=109:100 + +#FC28 +portmap_118=113:100 + +#FC29 +portmap_122=117:100 + +#FC30 +portmap_126=121:100 + +#FC31 +portmap_130=125:100 + + + +## TX/RX Lane Swap +######### +# port5 # +# FC16 # +######### +xgxs_tx_lane_map_68=0x0123 +xgxs_rx_lane_map_68=0x0123 + +######### +# port8 # +# FC19 # +######### +xgxs_tx_lane_map_80=0x0123 +xgxs_rx_lane_map_80=0x0123 + +######### +# port13# +# FC20 # +######### +xgxs_tx_lane_map_84=0x1032 +xgxs_rx_lane_map_84=0x1032 + +######### +# port14# +# FC21 # +######### +xgxs_tx_lane_map_88=0x0123 +xgxs_rx_lane_map_88=0x0123 + +######### +# port15# +# FC22 # +######### +xgxs_tx_lane_map_92=0x1032 +xgxs_rx_lane_map_92=0x1032 + +######### +# port17# +# FC24 # +######### +xgxs_tx_lane_map_102=0x1032 +xgxs_rx_lane_map_102=0x1032 + +######### +# port18# +# FC25 # +######### +xgxs_tx_lane_map_106=0x0123 +xgxs_rx_lane_map_106=0x0123 + +######### +# port19# +# FC26 # +######### +xgxs_tx_lane_map_110=0x1032 +xgxs_rx_lane_map_110=0x1032 + +######### +# port20# +# FC27 # +######### +xgxs_tx_lane_map_114=0x0123 +xgxs_rx_lane_map_114=0x0123 + +######### +# port26# +# FC29 # +######### +xgxs_tx_lane_map_122=0x0123 +xgxs_rx_lane_map_122=0x0123 + +######### +# port27# +# FC30 # +######### +xgxs_tx_lane_map_126=0x0123 +xgxs_rx_lane_map_126=0x0123 + +######### +# port29# +# FC0 # +######### +xgxs_tx_lane_map_1=0x0123 +xgxs_rx_lane_map_1=0x0123 + +# port30# +# FC1 # +######### +xgxs_tx_lane_map_5=0x0123 +xgxs_rx_lane_map_5=0x0123 + +######### +# port31# +# FC2 # +######### +xgxs_tx_lane_map_9=0x0123 +xgxs_rx_lane_map_9=0x0123 + +######### +# port32# +# FC3 # +######### +xgxs_tx_lane_map_13=0x0123 +xgxs_rx_lane_map_13=0x0123 + + +## RX / TX Serdes lane polarity flip list +## RX / TX Serdes lane polarity flip list +######### +# FC4 # +# port21 # +######### +phy_xaui_tx_polarity_flip_17=0xf + +######### +# FC20 # +# port13 # +######### +phy_xaui_rx_polarity_flip_84=0xf +phy_xaui_tx_polarity_flip_84=0x6 + +######### +# FC21 # +# port14 # +######### +phy_xaui_rx_polarity_flip_88=0xf + +######### +# FC22 # +# port15 # +######### +phy_xaui_rx_polarity_flip_92=0xf +phy_xaui_tx_polarity_flip_92=0xe + + +######### +# FC23 # +# port16 # +######### +phy_xaui_tx_polarity_flip_96=0x1 + +######### +# FC24 # +# port17 # +######### +phy_xaui_tx_polarity_flip_102=0x1 + + +######### +# FC25 # +# port18 # +######### +phy_xaui_rx_polarity_flip_106=0xf + +######### +# FC26 # +# port19 # +######### +phy_xaui_tx_polarity_flip_110=0xe + +######### +# FC27 # +# port20 # +######### +phy_xaui_rx_polarity_flip_114=0x2 + +######### +# FC28 # +# port25 # +######### +phy_xaui_rx_polarity_flip_118=0xa +phy_xaui_tx_polarity_flip_118=0xf + +#Driver Current +serdes_driver_current_lane0_1=0x8 +serdes_driver_current_lane1_1=0x8 +serdes_driver_current_lane2_1=0x8 +serdes_driver_current_lane3_1=0x8 +serdes_driver_current_lane0_5=0x8 +serdes_driver_current_lane1_5=0x8 +serdes_driver_current_lane2_5=0x8 +serdes_driver_current_lane3_5=0x8 +serdes_driver_current_lane0_9=0x8 +serdes_driver_current_lane1_9=0x8 +serdes_driver_current_lane2_9=0x8 +serdes_driver_current_lane3_9=0x8 +serdes_driver_current_lane0_13=0x8 +serdes_driver_current_lane1_13=0x8 +serdes_driver_current_lane2_13=0x8 +serdes_driver_current_lane3_13=0x8 +serdes_driver_current_lane0_17=0x8 +serdes_driver_current_lane1_17=0x8 +serdes_driver_current_lane2_17=0x8 +serdes_driver_current_lane3_17=0x8 +serdes_driver_current_lane0_21=0x8 +serdes_driver_current_lane1_21=0x8 +serdes_driver_current_lane2_21=0x8 +serdes_driver_current_lane3_21=0x8 +serdes_driver_current_lane0_25=0x8 +serdes_driver_current_lane1_25=0x8 +serdes_driver_current_lane2_25=0x8 +serdes_driver_current_lane3_25=0x8 +serdes_driver_current_lane0_29=0x8 +serdes_driver_current_lane1_29=0x8 +serdes_driver_current_lane2_29=0x8 +serdes_driver_current_lane3_29=0x8 +serdes_driver_current_lane0_34=0x8 +serdes_driver_current_lane1_34=0x8 +serdes_driver_current_lane2_34=0x8 +serdes_driver_current_lane3_34=0x8 +serdes_driver_current_lane0_38=0x8 +serdes_driver_current_lane1_38=0x8 +serdes_driver_current_lane2_38=0x8 +serdes_driver_current_lane3_38=0x8 +serdes_driver_current_lane0_42=0x8 +serdes_driver_current_lane1_42=0x8 +serdes_driver_current_lane2_42=0x8 +serdes_driver_current_lane3_42=0x8 +serdes_driver_current_lane0_46=0x8 +serdes_driver_current_lane1_46=0x8 +serdes_driver_current_lane2_46=0x8 +serdes_driver_current_lane3_46=0x8 +serdes_driver_current_lane0_50=0x8 +serdes_driver_current_lane1_50=0x8 +serdes_driver_current_lane2_50=0x8 +serdes_driver_current_lane3_50=0x8 +serdes_driver_current_lane0_54=0x8 +serdes_driver_current_lane1_54=0x8 +serdes_driver_current_lane2_54=0x8 +serdes_driver_current_lane3_54=0x8 +serdes_driver_current_lane0_58=0x8 +serdes_driver_current_lane1_58=0x8 +serdes_driver_current_lane2_58=0x8 +serdes_driver_current_lane3_58=0x8 +serdes_driver_current_lane0_62=0x8 +serdes_driver_current_lane1_62=0x8 +serdes_driver_current_lane2_62=0x8 +serdes_driver_current_lane3_62=0x8 +serdes_driver_current_lane0_68=0x8 +serdes_driver_current_lane1_68=0x8 +serdes_driver_current_lane2_68=0x8 +serdes_driver_current_lane3_68=0x8 +serdes_driver_current_lane0_72=0x8 +serdes_driver_current_lane1_72=0x8 +serdes_driver_current_lane2_72=0x8 +serdes_driver_current_lane3_72=0x8 +serdes_driver_current_lane0_76=0x8 +serdes_driver_current_lane1_76=0x8 +serdes_driver_current_lane2_76=0x8 +serdes_driver_current_lane3_76=0x8 +serdes_driver_current_lane0_80=0x8 +serdes_driver_current_lane1_80=0x8 +serdes_driver_current_lane2_80=0x8 +serdes_driver_current_lane3_80=0x8 +serdes_driver_current_lane0_84=0x8 +serdes_driver_current_lane1_84=0x8 +serdes_driver_current_lane2_84=0x8 +serdes_driver_current_lane3_84=0x8 +serdes_driver_current_lane0_88=0x8 +serdes_driver_current_lane1_88=0x8 +serdes_driver_current_lane2_88=0x8 +serdes_driver_current_lane3_88=0x8 +serdes_driver_current_lane0_92=0x8 +serdes_driver_current_lane1_92=0x8 +serdes_driver_current_lane2_92=0x8 +serdes_driver_current_lane3_92=0x8 +serdes_driver_current_lane0_96=0x8 +serdes_driver_current_lane1_96=0x8 +serdes_driver_current_lane2_96=0x8 +serdes_driver_current_lane3_96=0x8 +serdes_driver_current_lane0_102=0x8 +serdes_driver_current_lane1_102=0x8 +serdes_driver_current_lane2_102=0x8 +serdes_driver_current_lane3_102=0x8 +serdes_driver_current_lane0_106=0x8 +serdes_driver_current_lane1_106=0x8 +serdes_driver_current_lane2_106=0x8 +serdes_driver_current_lane3_106=0x8 +serdes_driver_current_lane0_110=0x8 +serdes_driver_current_lane1_110=0x8 +serdes_driver_current_lane2_110=0x8 +serdes_driver_current_lane3_110=0x8 +serdes_driver_current_lane0_114=0x8 +serdes_driver_current_lane1_114=0x8 +serdes_driver_current_lane2_114=0x8 +serdes_driver_current_lane3_114=0x8 +serdes_driver_current_lane0_118=0x8 +serdes_driver_current_lane1_118=0x8 +serdes_driver_current_lane2_118=0x8 +serdes_driver_current_lane3_118=0x8 +serdes_driver_current_lane0_122=0x8 +serdes_driver_current_lane1_122=0x8 +serdes_driver_current_lane2_122=0x8 +serdes_driver_current_lane3_122=0x8 +serdes_driver_current_lane0_126=0x8 +serdes_driver_current_lane1_126=0x8 +serdes_driver_current_lane2_126=0x8 +serdes_driver_current_lane3_126=0x8 +serdes_driver_current_lane0_130=0x8 +serdes_driver_current_lane1_130=0x8 +serdes_driver_current_lane2_130=0x8 +serdes_driver_current_lane3_130=0x8 + +#Preemphasis +serdes_preemphasis_lane0_1=0x264204 +serdes_preemphasis_lane1_1=0x264204 +serdes_preemphasis_lane2_1=0x264204 +serdes_preemphasis_lane3_1=0x264204 +serdes_preemphasis_lane0_5=0x224406 +serdes_preemphasis_lane1_5=0x224406 +serdes_preemphasis_lane2_5=0x264204 +serdes_preemphasis_lane3_5=0x244206 +serdes_preemphasis_lane0_9=0x204606 +serdes_preemphasis_lane1_9=0x264204 +serdes_preemphasis_lane2_9=0x204606 +serdes_preemphasis_lane3_9=0x224406 +serdes_preemphasis_lane0_13=0x204606 +serdes_preemphasis_lane1_13=0x224406 +serdes_preemphasis_lane2_13=0x224406 +serdes_preemphasis_lane3_13=0x244206 +serdes_preemphasis_lane0_17=0x204606 +serdes_preemphasis_lane1_17=0x204606 +serdes_preemphasis_lane2_17=0x204606 +serdes_preemphasis_lane3_17=0x204606 +serdes_preemphasis_lane0_21=0x204606 +serdes_preemphasis_lane1_21=0x204606 +serdes_preemphasis_lane2_21=0x204606 +serdes_preemphasis_lane3_21=0x224406 +serdes_preemphasis_lane0_25=0x204606 +serdes_preemphasis_lane1_25=0x204606 +serdes_preemphasis_lane2_25=0x204606 +serdes_preemphasis_lane3_25=0x204606 +serdes_preemphasis_lane0_29=0x204606 +serdes_preemphasis_lane1_29=0x204606 +serdes_preemphasis_lane2_29=0x204606 +serdes_preemphasis_lane3_29=0x204606 +serdes_preemphasis_lane0_34=0x284601 +serdes_preemphasis_lane1_34=0x284601 +serdes_preemphasis_lane2_34=0x284601 +serdes_preemphasis_lane3_34=0x284601 +serdes_preemphasis_lane0_38=0x204604 +serdes_preemphasis_lane1_38=0x204604 +serdes_preemphasis_lane2_38=0x224406 +serdes_preemphasis_lane3_38=0x224406 +serdes_preemphasis_lane0_42=0x284601 +serdes_preemphasis_lane1_42=0x294501 +serdes_preemphasis_lane2_42=0x284601 +serdes_preemphasis_lane3_42=0x284601 +serdes_preemphasis_lane0_46=0x204802 +serdes_preemphasis_lane1_46=0x204802 +serdes_preemphasis_lane2_46=0x204802 +serdes_preemphasis_lane3_46=0x204802 +serdes_preemphasis_lane0_50=0x1e4f01 +serdes_preemphasis_lane1_50=0x1e4d01 +serdes_preemphasis_lane2_50=0x1e4f01 +serdes_preemphasis_lane3_50=0x1e4f01 +serdes_preemphasis_lane0_54=0x1f4a03 +serdes_preemphasis_lane1_54=0x1f4a03 +serdes_preemphasis_lane2_54=0x1f4a03 +serdes_preemphasis_lane3_54=0x1f4a03 +serdes_preemphasis_lane0_58=0x1e4f01 +serdes_preemphasis_lane1_58=0x1e4f01 +serdes_preemphasis_lane2_58=0x1e4f01 +serdes_preemphasis_lane3_58=0x1e4f01 +serdes_preemphasis_lane0_62=0x1e4e02 +serdes_preemphasis_lane1_62=0x1e4e02 +serdes_preemphasis_lane2_62=0x1e4e02 +serdes_preemphasis_lane3_62=0x1e4e02 +serdes_preemphasis_lane0_68=0x1e4f01 +serdes_preemphasis_lane1_68=0x1e4f01 +serdes_preemphasis_lane2_68=0x1e4f01 +serdes_preemphasis_lane3_68=0x1e4f01 +serdes_preemphasis_lane0_72=0x1e4e02 +serdes_preemphasis_lane1_72=0x1e4e02 +serdes_preemphasis_lane2_72=0x1e4e02 +serdes_preemphasis_lane3_72=0x1e4e02 +serdes_preemphasis_lane0_76=0x1c4d02 +serdes_preemphasis_lane1_76=0x195002 +serdes_preemphasis_lane2_76=0x195002 +serdes_preemphasis_lane3_76=0x195002 +serdes_preemphasis_lane0_80=0x1e4e02 +serdes_preemphasis_lane1_80=0x1e4e02 +serdes_preemphasis_lane2_80=0x1e4e02 +serdes_preemphasis_lane3_80=0x1e4e02 +serdes_preemphasis_lane0_84=0x234701 +serdes_preemphasis_lane1_84=0x234701 +serdes_preemphasis_lane2_84=0x234701 +serdes_preemphasis_lane3_84=0x234701 +serdes_preemphasis_lane0_88=0x224802 +serdes_preemphasis_lane1_88=0x224602 +serdes_preemphasis_lane2_88=0x224802 +serdes_preemphasis_lane3_88=0x224802 +serdes_preemphasis_lane0_92=0x234801 +serdes_preemphasis_lane1_92=0x244701 +serdes_preemphasis_lane2_92=0x234801 +serdes_preemphasis_lane3_92=0x234601 +serdes_preemphasis_lane0_96=0x204406 +serdes_preemphasis_lane1_96=0x204406 +serdes_preemphasis_lane2_96=0x204406 +serdes_preemphasis_lane3_96=0x224602 +serdes_preemphasis_lane0_102=0x204606 +serdes_preemphasis_lane1_102=0x235002 +serdes_preemphasis_lane2_102=0x204606 +serdes_preemphasis_lane3_102=0x204606 +serdes_preemphasis_lane0_106=0x204606 +serdes_preemphasis_lane1_106=0x204606 +serdes_preemphasis_lane2_106=0x204606 +serdes_preemphasis_lane3_106=0x204606 +serdes_preemphasis_lane0_110=0x204606 +serdes_preemphasis_lane1_110=0x224406 +serdes_preemphasis_lane2_110=0x224406 +serdes_preemphasis_lane3_110=0x224406 +serdes_preemphasis_lane0_114=0x224406 +serdes_preemphasis_lane1_114=0x204606 +serdes_preemphasis_lane2_114=0x204606 +serdes_preemphasis_lane3_114=0x224406 +serdes_preemphasis_lane0_118=0x224406 +serdes_preemphasis_lane1_118=0x224406 +serdes_preemphasis_lane2_118=0x224406 +serdes_preemphasis_lane3_118=0x224406 +serdes_preemphasis_lane0_122=0x244404 +serdes_preemphasis_lane1_122=0x244404 +serdes_preemphasis_lane2_122=0x244404 +serdes_preemphasis_lane3_122=0x244404 +serdes_preemphasis_lane0_126=0x234504 +serdes_preemphasis_lane1_126=0x234404 +serdes_preemphasis_lane2_126=0x224406 +serdes_preemphasis_lane3_126=0x224406 +serdes_preemphasis_lane0_130=0x244404 +serdes_preemphasis_lane1_130=0x244404 +serdes_preemphasis_lane2_130=0x234504 +serdes_preemphasis_lane3_130=0x264501 diff --git a/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/sai.profile b/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/sai.profile index f2d9aa96821b..e2f945e9a073 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/sai.profile +++ b/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th2-as7816-64x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-as7816-64x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/th2-as7816-64x100G.config.bcm b/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/th2-as7816-64x100G.config.bcm new file mode 100644 index 000000000000..78f6b419864e --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/Accton-AS7816-64X/th2-as7816-64x100G.config.bcm @@ -0,0 +1,875 @@ +# accton_as7816_64x 64x100G SDK config +os=unix +schan_intr_enable=0 +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +parity_correction=0 +parity_enable=0 +mmu_lossless=1 + +pbmp_xport_xe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +pbmp_oversubscribe=0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + +# platform specific setting +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 +dma_desc_timeout_usec=15000000 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +max_vp_lags=0 +miim_intr_enable=0 +module_64ports=1 +oversubscribe_mode=1 + +#add loopback port +# port 33 is the first loopback port +portmap_33=260:10 +# port 66 is the first management port +portmap_66=257:10 +# port 67 is the second loopback port +portmap_67=261:10 +# port 100 is the second management port +portmap_100=259:10 +# port 101 is the third loopback port +portmap_101=262:10 +# port 135 is the fourth loopback port +portmap_135=263:10 + +#Port0 +#FC18 +portmap_36=73:100 +phy_chain_rx_lane_map_physical{73.0}=0x3210 +phy_chain_tx_lane_map_physical{73.0}=0x3021 +phy_chain_rx_polarity_flip_physical{73.0}=0x0 +phy_chain_rx_polarity_flip_physical{74.0}=0x0 +phy_chain_rx_polarity_flip_physical{75.0}=0x0 +phy_chain_rx_polarity_flip_physical{76.0}=0x1 +phy_chain_tx_polarity_flip_physical{73.0}=0x0 +phy_chain_tx_polarity_flip_physical{74.0}=0x0 +phy_chain_tx_polarity_flip_physical{75.0}=0x1 +phy_chain_tx_polarity_flip_physical{76.0}=0x0 +#Port1 +#FC16 +portmap_34=65:100 +phy_chain_rx_lane_map_physical{65.0}=0x3210 +phy_chain_tx_lane_map_physical{65.0}=0x3210 +phy_chain_rx_polarity_flip_physical{65.0}=0x0 +phy_chain_rx_polarity_flip_physical{66.0}=0x0 +phy_chain_rx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x0 +phy_chain_tx_polarity_flip_physical{65.0}=0x1 +phy_chain_tx_polarity_flip_physical{66.0}=0x0 +phy_chain_tx_polarity_flip_physical{67.0}=0x0 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 +#Port2 +#FC20 +portmap_38=81:100 +phy_chain_rx_lane_map_physical{81.0}=0x1230 +phy_chain_tx_lane_map_physical{81.0}=0x1032 +phy_chain_rx_polarity_flip_physical{81.0}=0x1 +phy_chain_rx_polarity_flip_physical{82.0}=0x0 +phy_chain_rx_polarity_flip_physical{83.0}=0x1 +phy_chain_rx_polarity_flip_physical{84.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 +#Port3 +#FC22 +portmap_40=89:100 +phy_chain_rx_lane_map_physical{89.0}=0x0132 +phy_chain_tx_lane_map_physical{89.0}=0x1203 +phy_chain_rx_polarity_flip_physical{89.0}=0x1 +phy_chain_rx_polarity_flip_physical{90.0}=0x0 +phy_chain_rx_polarity_flip_physical{91.0}=0x0 +phy_chain_rx_polarity_flip_physical{92.0}=0x1 +phy_chain_tx_polarity_flip_physical{89.0}=0x1 +phy_chain_tx_polarity_flip_physical{90.0}=0x0 +phy_chain_tx_polarity_flip_physical{91.0}=0x1 +phy_chain_tx_polarity_flip_physical{92.0}=0x1 +#Port4 +#FC26 +portmap_44=105:100 +phy_chain_rx_lane_map_physical{105.0}=0x3210 +phy_chain_tx_lane_map_physical{105.0}=0x0231 +phy_chain_rx_polarity_flip_physical{105.0}=0x0 +phy_chain_rx_polarity_flip_physical{106.0}=0x0 +phy_chain_rx_polarity_flip_physical{107.0}=0x0 +phy_chain_rx_polarity_flip_physical{108.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{108.0}=0x1 +#Port5 +#FC24 +portmap_42=97:100 +phy_chain_rx_lane_map_physical{97.0}=0x0213 +phy_chain_tx_lane_map_physical{97.0}=0x3210 +phy_chain_rx_polarity_flip_physical{97.0}=0x1 +phy_chain_rx_polarity_flip_physical{98.0}=0x0 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x1 +phy_chain_tx_polarity_flip_physical{97.0}=0x1 +phy_chain_tx_polarity_flip_physical{98.0}=0x1 +phy_chain_tx_polarity_flip_physical{99.0}=0x0 +phy_chain_tx_polarity_flip_physical{100.0}=0x0 +#Port6 +#FC 28 +portmap_46=113:100 +phy_chain_rx_lane_map_physical{113.0}=0x3021 +phy_chain_tx_lane_map_physical{113.0}=0x0312 +phy_chain_rx_polarity_flip_physical{113.0}=0x0 +phy_chain_rx_polarity_flip_physical{114.0}=0x1 +phy_chain_rx_polarity_flip_physical{115.0}=0x1 +phy_chain_rx_polarity_flip_physical{116.0}=0x0 +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x0 +phy_chain_tx_polarity_flip_physical{115.0}=0x0 +phy_chain_tx_polarity_flip_physical{116.0}=0x1 +#Port7 +#FC30 +portmap_48=121:100 +phy_chain_rx_lane_map_physical{121.0}=0x3021 +phy_chain_tx_lane_map_physical{121.0}=0x2130 +phy_chain_rx_polarity_flip_physical{121.0}=0x0 +phy_chain_rx_polarity_flip_physical{122.0}=0x1 +phy_chain_rx_polarity_flip_physical{123.0}=0x1 +phy_chain_rx_polarity_flip_physical{124.0}=0x0 +phy_chain_tx_polarity_flip_physical{121.0}=0x1 +phy_chain_tx_polarity_flip_physical{122.0}=0x1 +phy_chain_tx_polarity_flip_physical{123.0}=0x1 +phy_chain_tx_polarity_flip_physical{124.0}=0x0 +#Port8 +#FC10 +portmap_11=41:100 +phy_chain_rx_lane_map_physical{41.0}=0x0132 +phy_chain_tx_lane_map_physical{41.0}=0x1302 +phy_chain_rx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{42.0}=0x0 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_rx_polarity_flip_physical{44.0}=0x0 +phy_chain_tx_polarity_flip_physical{41.0}=0x1 +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 +#Port9 +#FC8 +portmap_9=33:100 +phy_chain_rx_lane_map_physical{33.0}=0x2310 +phy_chain_tx_lane_map_physical{33.0}=0x0213 +phy_chain_rx_polarity_flip_physical{33.0}=0x0 +phy_chain_rx_polarity_flip_physical{34.0}=0x1 +phy_chain_rx_polarity_flip_physical{35.0}=0x0 +phy_chain_rx_polarity_flip_physical{36.0}=0x0 +phy_chain_tx_polarity_flip_physical{33.0}=0x1 +phy_chain_tx_polarity_flip_physical{34.0}=0x1 +phy_chain_tx_polarity_flip_physical{35.0}=0x0 +phy_chain_tx_polarity_flip_physical{36.0}=0x0 +#Port10 +#FC12 +portmap_13=49:100 +phy_chain_rx_lane_map_physical{49.0}=0x3210 +phy_chain_tx_lane_map_physical{49.0}=0x3102 +phy_chain_rx_polarity_flip_physical{49.0}=0x1 +phy_chain_rx_polarity_flip_physical{50.0}=0x0 +phy_chain_rx_polarity_flip_physical{51.0}=0x1 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 +phy_chain_tx_polarity_flip_physical{49.0}=0x1 +phy_chain_tx_polarity_flip_physical{50.0}=0x1 +phy_chain_tx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x1 +#Port11 +#FC14 +portmap_15=57:100 +phy_chain_rx_lane_map_physical{57.0}=0x3210 +phy_chain_tx_lane_map_physical{57.0}=0x1302 +phy_chain_rx_polarity_flip_physical{57.0}=0x1 +phy_chain_rx_polarity_flip_physical{58.0}=0x0 +phy_chain_rx_polarity_flip_physical{59.0}=0x1 +phy_chain_rx_polarity_flip_physical{60.0}=0x0 +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x0 +phy_chain_tx_polarity_flip_physical{59.0}=0x0 +phy_chain_tx_polarity_flip_physical{60.0}=0x1 +#Port12 +#FC34 +portmap_70=137:100 +phy_chain_rx_lane_map_physical{137.0}=0x3210 +phy_chain_tx_lane_map_physical{137.0}=0x0213 +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{140.0}=0x0 +phy_chain_tx_polarity_flip_physical{137.0}=0x1 +phy_chain_tx_polarity_flip_physical{138.0}=0x0 +phy_chain_tx_polarity_flip_physical{139.0}=0x0 +phy_chain_tx_polarity_flip_physical{140.0}=0x0 +#Port13 +#FC32 +portmap_68=129:100 +phy_chain_rx_lane_map_physical{129.0}=0x3021 +phy_chain_tx_lane_map_physical{129.0}=0x1203 +phy_chain_rx_polarity_flip_physical{129.0}=0x1 +phy_chain_rx_polarity_flip_physical{130.0}=0x0 +phy_chain_rx_polarity_flip_physical{131.0}=0x0 +phy_chain_rx_polarity_flip_physical{132.0}=0x0 +phy_chain_tx_polarity_flip_physical{129.0}=0x1 +phy_chain_tx_polarity_flip_physical{130.0}=0x1 +phy_chain_tx_polarity_flip_physical{131.0}=0x1 +phy_chain_tx_polarity_flip_physical{132.0}=0x1 +#Port14 +#FC36 +portmap_72=145:100 +phy_chain_rx_lane_map_physical{145.0}=0x0213 +phy_chain_tx_lane_map_physical{145.0}=0x2301 +phy_chain_rx_polarity_flip_physical{145.0}=0x1 +phy_chain_rx_polarity_flip_physical{146.0}=0x1 +phy_chain_rx_polarity_flip_physical{147.0}=0x0 +phy_chain_rx_polarity_flip_physical{148.0}=0x0 +phy_chain_tx_polarity_flip_physical{145.0}=0x0 +phy_chain_tx_polarity_flip_physical{146.0}=0x0 +phy_chain_tx_polarity_flip_physical{147.0}=0x0 +phy_chain_tx_polarity_flip_physical{148.0}=0x1 +#Port15 +#FC38 +portmap_74=153:100 +phy_chain_rx_lane_map_physical{153.0}=0x0213 +phy_chain_tx_lane_map_physical{153.0}=0x1302 +phy_chain_rx_polarity_flip_physical{153.0}=0x1 +phy_chain_rx_polarity_flip_physical{154.0}=0x0 +phy_chain_rx_polarity_flip_physical{155.0}=0x1 +phy_chain_rx_polarity_flip_physical{156.0}=0x1 +phy_chain_tx_polarity_flip_physical{153.0}=0x0 +phy_chain_tx_polarity_flip_physical{154.0}=0x1 +phy_chain_tx_polarity_flip_physical{155.0}=0x0 +phy_chain_tx_polarity_flip_physical{156.0}=0x0 +#Port16 +#FC43 +portmap_79=173:100 +phy_chain_rx_lane_map_physical{173.0}=0x1032 +phy_chain_tx_lane_map_physical{173.0}=0x1203 +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}=0x0 +phy_chain_rx_polarity_flip_physical{176.0}=0x0 +phy_chain_tx_polarity_flip_physical{173.0}=0x1 +phy_chain_tx_polarity_flip_physical{174.0}=0x1 +phy_chain_tx_polarity_flip_physical{175.0}=0x0 +phy_chain_tx_polarity_flip_physical{176.0}=0x1 +#Port17 +#FC41 +portmap_77=165:100 +phy_chain_rx_lane_map_physical{165.0}=0x1230 +phy_chain_tx_lane_map_physical{165.0}=0x2130 +phy_chain_rx_polarity_flip_physical{165.0}=0x1 +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_tx_polarity_flip_physical{165.0}=0x1 +phy_chain_tx_polarity_flip_physical{166.0}=0x0 +phy_chain_tx_polarity_flip_physical{167.0}=0x1 +phy_chain_tx_polarity_flip_physical{168.0}=0x0 +#Port18 +#FC45 +portmap_81=181:100 +phy_chain_rx_lane_map_physical{181.0}=0x0312 +phy_chain_tx_lane_map_physical{181.0}=0x3120 +phy_chain_rx_polarity_flip_physical{181.0}=0x0 +phy_chain_rx_polarity_flip_physical{182.0}=0x1 +phy_chain_rx_polarity_flip_physical{183.0}=0x1 +phy_chain_rx_polarity_flip_physical{184.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}=0x1 +phy_chain_tx_polarity_flip_physical{184.0}=0x0 +#Port19 +#FC47 +portmap_83=189:100 +phy_chain_rx_lane_map_physical{189.0}=0x0132 +phy_chain_tx_lane_map_physical{189.0}=0x3210 +phy_chain_rx_polarity_flip_physical{189.0}=0x0 +phy_chain_rx_polarity_flip_physical{190.0}=0x1 +phy_chain_rx_polarity_flip_physical{191.0}=0x1 +phy_chain_rx_polarity_flip_physical{192.0}=0x1 +phy_chain_tx_polarity_flip_physical{189.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 +#Port20 +#FC3 +portmap_4=13:100 +phy_chain_rx_lane_map_physical{13.0}=0x3120 +phy_chain_tx_lane_map_physical{13.0}=0x3210 +phy_chain_rx_polarity_flip_physical{13.0}=0x1 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x1 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{14.0}=0x0 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x1 +#Port21 +#FC1 +portmap_2=5:100 +phy_chain_rx_lane_map_physical{5.0}=0x0213 +phy_chain_tx_lane_map_physical{5.0}=0x0321 +phy_chain_rx_polarity_flip_physical{5.0}=0x0 +phy_chain_rx_polarity_flip_physical{6.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x1 +phy_chain_rx_polarity_flip_physical{8.0}=0x0 +phy_chain_tx_polarity_flip_physical{5.0}=0x1 +phy_chain_tx_polarity_flip_physical{6.0}=0x1 +phy_chain_tx_polarity_flip_physical{7.0}=0x0 +phy_chain_tx_polarity_flip_physical{8.0}=0x1 +#Port22 +#FC7 +portmap_8=29:100 +phy_chain_rx_lane_map_physical{29.0}=0x3021 +phy_chain_tx_lane_map_physical{29.0}=0x2130 +phy_chain_rx_polarity_flip_physical{29.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 +phy_chain_tx_polarity_flip_physical{29.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x0 +phy_chain_tx_polarity_flip_physical{31.0}=0x0 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +#Port23 +#FC5 +portmap_6=21:100 +phy_chain_rx_lane_map_physical{21.0}=0x0321 +phy_chain_tx_lane_map_physical{21.0}=0x0123 +phy_chain_rx_polarity_flip_physical{21.0}=0x1 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x1 +phy_chain_tx_polarity_flip_physical{23.0}=0x1 +phy_chain_tx_polarity_flip_physical{24.0}=0x1 +#Port24 +#FC51 +portmap_105=205:100 +phy_chain_rx_lane_map_physical{205.0}=0x0132 +phy_chain_tx_lane_map_physical{205.0}=0x1230 +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}=0x1 +phy_chain_rx_polarity_flip_physical{208.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{208.0}=0x1 +#Port25 +#FC49 +portmap_103=197:100 +phy_chain_rx_lane_map_physical{197.0}=0x1230 +phy_chain_tx_lane_map_physical{197.0}=0x3021 +phy_chain_rx_polarity_flip_physical{197.0}=0x0 +phy_chain_rx_polarity_flip_physical{198.0}=0x0 +phy_chain_rx_polarity_flip_physical{199.0}=0x0 +phy_chain_rx_polarity_flip_physical{200.0}=0x0 +phy_chain_tx_polarity_flip_physical{197.0}=0x1 +phy_chain_tx_polarity_flip_physical{198.0}=0x0 +phy_chain_tx_polarity_flip_physical{199.0}=0x1 +phy_chain_tx_polarity_flip_physical{200.0}=0x0 +#Port26 +#FC53 +portmap_107=213:100 +phy_chain_rx_lane_map_physical{213.0}=0x3210 +phy_chain_tx_lane_map_physical{213.0}=0x1230 +phy_chain_rx_polarity_flip_physical{213.0}=0x0 +phy_chain_rx_polarity_flip_physical{214.0}=0x1 +phy_chain_rx_polarity_flip_physical{215.0}=0x0 +phy_chain_rx_polarity_flip_physical{216.0}=0x1 +phy_chain_tx_polarity_flip_physical{213.0}=0x0 +phy_chain_tx_polarity_flip_physical{214.0}=0x0 +phy_chain_tx_polarity_flip_physical{215.0}=0x0 +phy_chain_tx_polarity_flip_physical{216.0}=0x1 +#Port27 +#FC55 +portmap_109=221:100 +phy_chain_rx_lane_map_physical{221.0}=0x3210 +phy_chain_tx_lane_map_physical{221.0}=0x3210 +phy_chain_rx_polarity_flip_physical{221.0}=0x1 +phy_chain_rx_polarity_flip_physical{222.0}=0x1 +phy_chain_rx_polarity_flip_physical{223.0}=0x0 +phy_chain_rx_polarity_flip_physical{224.0}=0x0 +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}=0x0 +#Port28 +#FC57 +portmap_111=229:100 +phy_chain_rx_lane_map_physical{229.0}=0x2301 +phy_chain_tx_lane_map_physical{229.0}=0x3210 +phy_chain_rx_polarity_flip_physical{229.0}=0x1 +phy_chain_rx_polarity_flip_physical{230.0}=0x1 +phy_chain_rx_polarity_flip_physical{231.0}=0x0 +phy_chain_rx_polarity_flip_physical{232.0}=0x1 +phy_chain_tx_polarity_flip_physical{229.0}=0x0 +phy_chain_tx_polarity_flip_physical{230.0}=0x1 +phy_chain_tx_polarity_flip_physical{231.0}=0x0 +phy_chain_tx_polarity_flip_physical{232.0}=0x0 +#Port29 +#FC59 +portmap_113=237:100 +phy_chain_rx_lane_map_physical{237.0}=0x0123 +phy_chain_tx_lane_map_physical{237.0}=0x3210 +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{240.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{240.0}=0x0 +#Port30 +#FC61 +portmap_115=245:100 +phy_chain_rx_lane_map_physical{245.0}=0x0213 +phy_chain_tx_lane_map_physical{245.0}=0x3210 +phy_chain_rx_polarity_flip_physical{245.0}=0x0 +phy_chain_rx_polarity_flip_physical{246.0}=0x0 +phy_chain_rx_polarity_flip_physical{247.0}=0x1 +phy_chain_rx_polarity_flip_physical{248.0}=0x1 +phy_chain_tx_polarity_flip_physical{245.0}=0x1 +phy_chain_tx_polarity_flip_physical{246.0}=0x0 +phy_chain_tx_polarity_flip_physical{247.0}=0x1 +phy_chain_tx_polarity_flip_physical{248.0}=0x0 +#Port31 +#FC63 +portmap_117=253:100 +phy_chain_rx_lane_map_physical{253.0}=0x0213 +phy_chain_tx_lane_map_physical{253.0}=0x0312 +phy_chain_rx_polarity_flip_physical{253.0}=0x0 +phy_chain_rx_polarity_flip_physical{254.0}=0x0 +phy_chain_rx_polarity_flip_physical{255.0}=0x0 +phy_chain_rx_polarity_flip_physical{256.0}=0x1 +phy_chain_tx_polarity_flip_physical{253.0}=0x0 +phy_chain_tx_polarity_flip_physical{254.0}=0x1 +phy_chain_tx_polarity_flip_physical{255.0}=0x0 +phy_chain_tx_polarity_flip_physical{256.0}=0x0 +#Port32 +#FC17 +portmap_35=69:100 +phy_chain_rx_lane_map_physical{69.0}=0x1032 +phy_chain_tx_lane_map_physical{69.0}=0x3102 +phy_chain_rx_polarity_flip_physical{69.0}=0x1 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x1 +phy_chain_tx_polarity_flip_physical{69.0}=0x0 +phy_chain_tx_polarity_flip_physical{70.0}=0x0 +phy_chain_tx_polarity_flip_physical{71.0}=0x1 +phy_chain_tx_polarity_flip_physical{72.0}=0x1 +#Port33 +#FC19 +portmap_37=77:100 +phy_chain_rx_lane_map_physical{77.0}=0x1230 +phy_chain_tx_lane_map_physical{77.0}=0x3021 +phy_chain_rx_polarity_flip_physical{77.0}=0x1 +phy_chain_rx_polarity_flip_physical{78.0}=0x0 +phy_chain_rx_polarity_flip_physical{79.0}=0x1 +phy_chain_rx_polarity_flip_physical{80.0}=0x0 +phy_chain_tx_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{80.0}=0x0 +#Port34 +#FC23 +portmap_41=93:100 +phy_chain_rx_lane_map_physical{93.0}=0x1032 +phy_chain_tx_lane_map_physical{93.0}=0x0231 +phy_chain_rx_polarity_flip_physical{93.0}=0x1 +phy_chain_rx_polarity_flip_physical{94.0}=0x1 +phy_chain_rx_polarity_flip_physical{95.0}=0x1 +phy_chain_rx_polarity_flip_physical{96.0}=0x1 +phy_chain_tx_polarity_flip_physical{93.0}=0x0 +phy_chain_tx_polarity_flip_physical{94.0}=0x1 +phy_chain_tx_polarity_flip_physical{95.0}=0x1 +phy_chain_tx_polarity_flip_physical{96.0}=0x1 +#Port35 +#FC21 +portmap_39=85:100 +phy_chain_rx_lane_map_physical{85.0}=0x0312 +phy_chain_tx_lane_map_physical{85.0}=0x1230 +phy_chain_rx_polarity_flip_physical{85.0}=0x0 +phy_chain_rx_polarity_flip_physical{86.0}=0x0 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{88.0}=0x0 +#Port36 +#FC25 +portmap_43=101:100 +phy_chain_rx_lane_map_physical{101.0}=0x1302 +phy_chain_tx_lane_map_physical{101.0}=0x0213 +phy_chain_rx_polarity_flip_physical{101.0}=0x1 +phy_chain_rx_polarity_flip_physical{102.0}=0x0 +phy_chain_rx_polarity_flip_physical{103.0}=0x0 +phy_chain_rx_polarity_flip_physical{104.0}=0x0 +phy_chain_tx_polarity_flip_physical{101.0}=0x0 +phy_chain_tx_polarity_flip_physical{102.0}=0x1 +phy_chain_tx_polarity_flip_physical{103.0}=0x0 +phy_chain_tx_polarity_flip_physical{104.0}=0x1 +#Port37 +#FC27 +portmap_45=109:100 +phy_chain_rx_lane_map_physical{109.0}=0x0213 +phy_chain_tx_lane_map_physical{109.0}=0x1032 +phy_chain_rx_polarity_flip_physical{109.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}=0x0 +phy_chain_tx_polarity_flip_physical{109.0}=0x0 +phy_chain_tx_polarity_flip_physical{110.0}=0x1 +phy_chain_tx_polarity_flip_physical{111.0}=0x1 +phy_chain_tx_polarity_flip_physical{112.0}=0x1 +#Port38 +#FC31 +portmap_49=125:100 +phy_chain_rx_lane_map_physical{125.0}=0x2130 +phy_chain_tx_lane_map_physical{125.0}=0x1203 +phy_chain_rx_polarity_flip_physical{125.0}=0x0 +phy_chain_rx_polarity_flip_physical{126.0}=0x0 +phy_chain_rx_polarity_flip_physical{127.0}=0x1 +phy_chain_rx_polarity_flip_physical{128.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 +#Port39 +#FC29 +portmap_47=117:100 +phy_chain_rx_lane_map_physical{117.0}=0x3102 +phy_chain_tx_lane_map_physical{117.0}=0x2310 +phy_chain_rx_polarity_flip_physical{117.0}=0x1 +phy_chain_rx_polarity_flip_physical{118.0}=0x0 +phy_chain_rx_polarity_flip_physical{119.0}=0x1 +phy_chain_rx_polarity_flip_physical{120.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}=0x1 +phy_chain_tx_polarity_flip_physical{120.0}=0x0 +#Port40 +#FC9 +portmap_10=37:100 +phy_chain_rx_lane_map_physical{37.0}=0x3210 +phy_chain_tx_lane_map_physical{37.0}=0x1302 +phy_chain_rx_polarity_flip_physical{37.0}=0x1 +phy_chain_rx_polarity_flip_physical{38.0}=0x0 +phy_chain_rx_polarity_flip_physical{39.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x0 +phy_chain_tx_polarity_flip_physical{37.0}=0x1 +phy_chain_tx_polarity_flip_physical{38.0}=0x0 +phy_chain_tx_polarity_flip_physical{39.0}=0x1 +phy_chain_tx_polarity_flip_physical{40.0}=0x1 +#Port41 +#FC11 +portmap_12=45:100 +phy_chain_rx_lane_map_physical{45.0}=0x3210 +phy_chain_tx_lane_map_physical{45.0}=0x0123 +phy_chain_rx_polarity_flip_physical{45.0}=0x0 +phy_chain_rx_polarity_flip_physical{46.0}=0x0 +phy_chain_rx_polarity_flip_physical{47.0}=0x0 +phy_chain_rx_polarity_flip_physical{48.0}=0x0 +phy_chain_tx_polarity_flip_physical{45.0}=0x0 +phy_chain_tx_polarity_flip_physical{46.0}=0x1 +phy_chain_tx_polarity_flip_physical{47.0}=0x0 +phy_chain_tx_polarity_flip_physical{48.0}=0x1 +#Port42 +#FC15 +portmap_16=61:100 +phy_chain_rx_lane_map_physical{61.0}=0x3210 +phy_chain_tx_lane_map_physical{61.0}=0x1230 +phy_chain_rx_polarity_flip_physical{61.0}=0x0 +phy_chain_rx_polarity_flip_physical{62.0}=0x1 +phy_chain_rx_polarity_flip_physical{63.0}=0x0 +phy_chain_rx_polarity_flip_physical{64.0}=0x0 +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}=0x0 +#Port43 +#FC13 +portmap_14=53:100 +phy_chain_rx_lane_map_physical{53.0}=0x3210 +phy_chain_tx_lane_map_physical{53.0}=0x3210 +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_tx_polarity_flip_physical{53.0}=0x1 +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 +#Port44 +#FC33 +portmap_69=133:100 +phy_chain_rx_lane_map_physical{133.0}=0x0312 +phy_chain_tx_lane_map_physical{133.0}=0x2310 +phy_chain_rx_polarity_flip_physical{133.0}=0x0 +phy_chain_rx_polarity_flip_physical{134.0}=0x0 +phy_chain_rx_polarity_flip_physical{135.0}=0x1 +phy_chain_rx_polarity_flip_physical{136.0}=0x0 +phy_chain_tx_polarity_flip_physical{133.0}=0x0 +phy_chain_tx_polarity_flip_physical{134.0}=0x1 +phy_chain_tx_polarity_flip_physical{135.0}=0x0 +phy_chain_tx_polarity_flip_physical{136.0}=0x1 +#Port45 +#FC35 +portmap_71=141:100 +phy_chain_rx_lane_map_physical{141.0}=0x3012 +phy_chain_tx_lane_map_physical{141.0}=0x0123 +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_tx_polarity_flip_physical{141.0}=0x1 +phy_chain_tx_polarity_flip_physical{142.0}=0x1 +phy_chain_tx_polarity_flip_physical{143.0}=0x0 +phy_chain_tx_polarity_flip_physical{144.0}=0x0 +#Port46 +#FC39 +portmap_75=157:100 +phy_chain_rx_lane_map_physical{157.0}=0x2103 +phy_chain_tx_lane_map_physical{157.0}=0x0231 +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{160.0}=0x0 +phy_chain_tx_polarity_flip_physical{157.0}=0x0 +phy_chain_tx_polarity_flip_physical{158.0}=0x1 +phy_chain_tx_polarity_flip_physical{159.0}=0x0 +phy_chain_tx_polarity_flip_physical{160.0}=0x0 +#Port47 +#FC37 +portmap_73=149:100 +phy_chain_rx_lane_map_physical{149.0}=0x3120 +phy_chain_tx_lane_map_physical{149.0}=0x1023 +phy_chain_rx_polarity_flip_physical{149.0}=0x0 +phy_chain_rx_polarity_flip_physical{150.0}=0x1 +phy_chain_rx_polarity_flip_physical{151.0}=0x0 +phy_chain_rx_polarity_flip_physical{152.0}=0x0 +phy_chain_tx_polarity_flip_physical{149.0}=0x1 +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}=0x1 +#Port48 +#FC40 +portmap_76=161:100 +phy_chain_rx_lane_map_physical{161.0}=0x3012 +phy_chain_tx_lane_map_physical{161.0}=0x1023 +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}=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}=0x0 +phy_chain_tx_polarity_flip_physical{164.0}=0x0 +#Port49 +#FC42 +portmap_78=169:100 +phy_chain_rx_lane_map_physical{169.0}=0x3210 +phy_chain_tx_lane_map_physical{169.0}=0x2031 +phy_chain_rx_polarity_flip_physical{169.0}=0x0 +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_tx_polarity_flip_physical{169.0}=0x1 +phy_chain_tx_polarity_flip_physical{170.0}=0x0 +phy_chain_tx_polarity_flip_physical{171.0}=0x0 +phy_chain_tx_polarity_flip_physical{172.0}=0x0 +#Port50 +#FC46 +portmap_82=185:100 +phy_chain_rx_lane_map_physical{185.0}=0x2310 +phy_chain_tx_lane_map_physical{185.0}=0x3021 +phy_chain_rx_polarity_flip_physical{185.0}=0x1 +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}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{188.0}=0x0 +#Port51 +#FC44 +portmap_80=177:100 +phy_chain_rx_lane_map_physical{177.0}=0x1032 +phy_chain_tx_lane_map_physical{177.0}=0x2301 +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{180.0}=0x1 +phy_chain_tx_polarity_flip_physical{177.0}=0x1 +phy_chain_tx_polarity_flip_physical{178.0}=0x1 +phy_chain_tx_polarity_flip_physical{179.0}=0x1 +phy_chain_tx_polarity_flip_physical{180.0}=0x0 +#Port52 +#FC6 +portmap_7=25:100 +phy_chain_rx_lane_map_physical{25.0}=0x3102 +phy_chain_tx_lane_map_physical{25.0}=0x0132 +phy_chain_rx_polarity_flip_physical{25.0}=0x0 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x1 +phy_chain_rx_polarity_flip_physical{28.0}=0x0 +phy_chain_tx_polarity_flip_physical{25.0}=0x0 +phy_chain_tx_polarity_flip_physical{26.0}=0x1 +phy_chain_tx_polarity_flip_physical{27.0}=0x0 +phy_chain_tx_polarity_flip_physical{28.0}=0x1 +#Port53 +#FC4 +portmap_5=17:100 +phy_chain_rx_lane_map_physical{17.0}=0x3120 +phy_chain_tx_lane_map_physical{17.0}=0x3021 +phy_chain_rx_polarity_flip_physical{17.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x1 +phy_chain_rx_polarity_flip_physical{19.0}=0x0 +phy_chain_rx_polarity_flip_physical{20.0}=0x0 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x0 +phy_chain_tx_polarity_flip_physical{19.0}=0x1 +phy_chain_tx_polarity_flip_physical{20.0}=0x0 +#Port54 +#FC0 +portmap_1=1:100 +phy_chain_rx_lane_map_physical{1.0}=0x2130 +phy_chain_tx_lane_map_physical{1.0}=0x1203 +phy_chain_rx_polarity_flip_physical{1.0}=0x1 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x1 +phy_chain_rx_polarity_flip_physical{4.0}=0x1 +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{2.0}=0x0 +phy_chain_tx_polarity_flip_physical{3.0}=0x0 +phy_chain_tx_polarity_flip_physical{4.0}=0x1 +#Port55 +#FC2 +portmap_3=9:100 +phy_chain_rx_lane_map_physical{9.0}=0x1203 +phy_chain_tx_lane_map_physical{9.0}=0x1230 +phy_chain_rx_polarity_flip_physical{9.0}=0x0 +phy_chain_rx_polarity_flip_physical{10.0}=0x1 +phy_chain_rx_polarity_flip_physical{11.0}=0x0 +phy_chain_rx_polarity_flip_physical{12.0}=0x0 +phy_chain_tx_polarity_flip_physical{9.0}=0x1 +phy_chain_tx_polarity_flip_physical{10.0}=0x0 +phy_chain_tx_polarity_flip_physical{11.0}=0x1 +phy_chain_tx_polarity_flip_physical{12.0}=0x0 +#Port56 +#FC48 +portmap_102=193:100 +phy_chain_rx_lane_map_physical{193.0}=0x2103 +phy_chain_tx_lane_map_physical{193.0}=0x1230 +phy_chain_rx_polarity_flip_physical{193.0}=0x0 +phy_chain_rx_polarity_flip_physical{194.0}=0x1 +phy_chain_rx_polarity_flip_physical{195.0}=0x0 +phy_chain_rx_polarity_flip_physical{196.0}=0x1 +phy_chain_tx_polarity_flip_physical{193.0}=0x0 +phy_chain_tx_polarity_flip_physical{194.0}=0x0 +phy_chain_tx_polarity_flip_physical{195.0}=0x1 +phy_chain_tx_polarity_flip_physical{196.0}=0x0 +#Port57 +#FC50 +portmap_104=201:100 +phy_chain_rx_lane_map_physical{201.0}=0x0321 +phy_chain_tx_lane_map_physical{201.0}=0x3021 +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_tx_polarity_flip_physical{201.0}=0x1 +phy_chain_tx_polarity_flip_physical{202.0}=0x1 +phy_chain_tx_polarity_flip_physical{203.0}=0x0 +phy_chain_tx_polarity_flip_physical{204.0}=0x1 +#Port58 +#FC54 +portmap_108=217:100 +phy_chain_rx_lane_map_physical{217.0}=0x1203 +phy_chain_tx_lane_map_physical{217.0}=0x2031 +phy_chain_rx_polarity_flip_physical{217.0}=0x1 +phy_chain_rx_polarity_flip_physical{218.0}=0x0 +phy_chain_rx_polarity_flip_physical{219.0}=0x1 +phy_chain_rx_polarity_flip_physical{220.0}=0x1 +phy_chain_tx_polarity_flip_physical{217.0}=0x1 +phy_chain_tx_polarity_flip_physical{218.0}=0x0 +phy_chain_tx_polarity_flip_physical{219.0}=0x1 +phy_chain_tx_polarity_flip_physical{220.0}=0x0 +#Port59 +#FC52 +portmap_106=209:100 +phy_chain_rx_lane_map_physical{209.0}=0x0321 +phy_chain_tx_lane_map_physical{209.0}=0x3102 +phy_chain_rx_polarity_flip_physical{209.0}=0x0 +phy_chain_rx_polarity_flip_physical{210.0}=0x0 +phy_chain_rx_polarity_flip_physical{211.0}=0x1 +phy_chain_rx_polarity_flip_physical{212.0}=0x0 +phy_chain_tx_polarity_flip_physical{209.0}=0x0 +phy_chain_tx_polarity_flip_physical{210.0}=0x0 +phy_chain_tx_polarity_flip_physical{211.0}=0x1 +phy_chain_tx_polarity_flip_physical{212.0}=0x0 +#Port60 +#FC56 +portmap_110=225:100 +phy_chain_rx_lane_map_physical{225.0}=0x2103 +phy_chain_tx_lane_map_physical{225.0}=0x2031 +phy_chain_rx_polarity_flip_physical{225.0}=0x0 +phy_chain_rx_polarity_flip_physical{226.0}=0x0 +phy_chain_rx_polarity_flip_physical{227.0}=0x1 +phy_chain_rx_polarity_flip_physical{228.0}=0x1 +phy_chain_tx_polarity_flip_physical{225.0}=0x1 +phy_chain_tx_polarity_flip_physical{226.0}=0x0 +phy_chain_tx_polarity_flip_physical{227.0}=0x1 +phy_chain_tx_polarity_flip_physical{228.0}=0x1 +#Port61 +#FC58 +portmap_112=233:100 +phy_chain_rx_lane_map_physical{233.0}=0x2130 +phy_chain_tx_lane_map_physical{233.0}=0x0312 +phy_chain_rx_polarity_flip_physical{233.0}=0x0 +phy_chain_rx_polarity_flip_physical{234.0}=0x1 +phy_chain_rx_polarity_flip_physical{235.0}=0x1 +phy_chain_rx_polarity_flip_physical{236.0}=0x0 +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}=0x1 +phy_chain_tx_polarity_flip_physical{236.0}=0x0 +#Port62 +#FC62 +portmap_116=249:100 +phy_chain_rx_lane_map_physical{249.0}=0x1302 +phy_chain_tx_lane_map_physical{249.0}=0x1302 +phy_chain_rx_polarity_flip_physical{249.0}=0x0 +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_tx_polarity_flip_physical{249.0}=0x1 +phy_chain_tx_polarity_flip_physical{250.0}=0x1 +phy_chain_tx_polarity_flip_physical{251.0}=0x1 +phy_chain_tx_polarity_flip_physical{252.0}=0x1 +#Port63 +#FC60 +portmap_114=241:100 +phy_chain_rx_lane_map_physical{241.0}=0x3012 +phy_chain_tx_lane_map_physical{241.0}=0x2301 +phy_chain_rx_polarity_flip_physical{241.0}=0x1 +phy_chain_rx_polarity_flip_physical{242.0}=0x1 +phy_chain_rx_polarity_flip_physical{243.0}=0x0 +phy_chain_rx_polarity_flip_physical{244.0}=0x1 +phy_chain_tx_polarity_flip_physical{241.0}=0x1 +phy_chain_tx_polarity_flip_physical{242.0}=0x0 +phy_chain_tx_polarity_flip_physical{243.0}=0x1 +phy_chain_tx_polarity_flip_physical{244.0}=0x0 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/sai.profile b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/sai.profile index e06f3ba3a4b1..6479c4c14d3f 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/sai.profile +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/td2-a7050-qx32s-32x40G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-a7050-qx32s-32x40G.config.bcm diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm new file mode 100644 index 000000000000..2e907dc1c72c --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm @@ -0,0 +1,745 @@ +#/****************************************************************************** +# * +# * File: config.bcm.clearlake (7050-QX32S) +# * Name: +# * +# * Description: This file contains SDK properties for an Arista +# * Clearlake platform. +# * +# *----------------------------------------------------------------------------- +# ******************************************************************************/ +#################################################################### +# BCM Config file for Clearlake platform +# - 32x40g Portmode + +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# l2 thread related config vars +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 + +bcm_num_cos=8 +bcm_stat_interval=2000000 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 + +scache_filename=/tmp/scache +stable_size=0x2000000 + +schan_intr_enable=0 +tdma_timeout_usec=5000000 +tslam_timeout_usec=15000000 +cdma_timeout_usec=15000000 +dma_desc_timeout_usec=15000000 + +############################### +serdes_fiber_pref=1 +############################### +mdio_output_delay=0x0d +############################### +xgxs_lcpll_xtal_refclk=1 +tdma_intr_enable=1 +tslam_intr_enable=1 +table_dma_enable=1 + +pbmp_oversubscribe.0=0x1fffffffffffffffffffffffffe +pbmp_xport_xe.0=0x1fffffffffffffffffffffffffe +phy_an_c37_1.0=3 +phy_an_c37_5.0=3 +phy_an_c37_9.0=3 +phy_an_c37_13.0=3 +phy_an_c37_17.0=3 +phy_an_c37_21.0=3 +phy_an_c37_25.0=3 +phy_an_c37_29.0=3 +phy_an_c37_33.0=3 +phy_an_c37_37.0=3 +phy_an_c37_41.0=3 +phy_an_c37_45.0=3 +phy_an_c37_49.0=3 +phy_an_c37_53.0=3 +phy_an_c37_57.0=3 +phy_an_c37_61.0=3 +phy_an_c37_65.0=3 +phy_an_c37_69.0=3 +phy_an_c37_73.0=3 +phy_an_c37_77.0=3 +phy_an_c37_81.0=3 +phy_an_c37_85.0=3 +phy_an_c37_89.0=3 +phy_an_c37_93.0=3 +phy_an_c37_97.0=0 +phy_an_c37_98.0=0 +phy_an_c37_99.0=0 +phy_an_c37_100.0=0 +phy_an_c37_101.0=0 +phy_an_c37_102.0=0 +phy_an_c37_103.0=0 +phy_an_c37_104.0=0 +phy_an_c73_1.0=0 +phy_an_c73_5.0=0 +phy_an_c73_9.0=0 +phy_an_c73_13.0=0 +phy_an_c73_17.0=0 +phy_an_c73_21.0=0 +phy_an_c73_25.0=0 +phy_an_c73_29.0=0 +phy_an_c73_33.0=0 +phy_an_c73_37.0=0 +phy_an_c73_41.0=0 +phy_an_c73_45.0=0 +phy_an_c73_49.0=0 +phy_an_c73_53.0=0 +phy_an_c73_57.0=0 +phy_an_c73_61.0=0 +phy_an_c73_65.0=0 +phy_an_c73_69.0=0 +phy_an_c73_73.0=0 +phy_an_c73_77.0=0 +phy_an_c73_81.0=0 +phy_an_c73_85.0=0 +phy_an_c73_89.0=0 +phy_an_c73_93.0=0 +phy_an_c73_97.0=2 +phy_an_c73_98.0=2 +phy_an_c73_99.0=2 +phy_an_c73_100.0=2 +phy_an_c73_101.0=2 +phy_an_c73_102.0=2 +phy_an_c73_103.0=2 +phy_an_c73_104.0=2 +phy_xaui_rx_polarity_flip_1.0=0x0 +phy_xaui_rx_polarity_flip_5.0=0x0 +phy_xaui_rx_polarity_flip_9.0=0x4 +phy_xaui_rx_polarity_flip_13.0=0x0 +phy_xaui_rx_polarity_flip_17.0=0xb +phy_xaui_rx_polarity_flip_21.0=0x3 +phy_xaui_rx_polarity_flip_25.0=0xb +phy_xaui_rx_polarity_flip_29.0=0xf +phy_xaui_rx_polarity_flip_33.0=0xb +phy_xaui_rx_polarity_flip_37.0=0x3 +phy_xaui_rx_polarity_flip_41.0=0xb +phy_xaui_rx_polarity_flip_45.0=0x0 +phy_xaui_rx_polarity_flip_49.0=0x4 +phy_xaui_rx_polarity_flip_53.0=0xc +phy_xaui_rx_polarity_flip_57.0=0x4 +phy_xaui_rx_polarity_flip_61.0=0x0 +phy_xaui_rx_polarity_flip_65.0=0xb +phy_xaui_rx_polarity_flip_69.0=0x3 +phy_xaui_rx_polarity_flip_73.0=0xb +phy_xaui_rx_polarity_flip_77.0=0xf +phy_xaui_rx_polarity_flip_81.0=0xb +phy_xaui_rx_polarity_flip_85.0=0x3 +phy_xaui_rx_polarity_flip_89.0=0x4 +phy_xaui_rx_polarity_flip_93.0=0x0 +phy_xaui_rx_polarity_flip_97.0=0xb +phy_xaui_rx_polarity_flip_98.0=0x3 +phy_xaui_rx_polarity_flip_99.0=0x4 +phy_xaui_rx_polarity_flip_100.0=0x0 +phy_xaui_rx_polarity_flip_101.0=0x0 +phy_xaui_rx_polarity_flip_102.0=0xe +phy_xaui_rx_polarity_flip_103.0=0x0 +phy_xaui_rx_polarity_flip_104.0=0x0 +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_5.0=0x0 +phy_xaui_tx_polarity_flip_9.0=0x2 +phy_xaui_tx_polarity_flip_13.0=0x0 +phy_xaui_tx_polarity_flip_17.0=0xd +phy_xaui_tx_polarity_flip_21.0=0xc +phy_xaui_tx_polarity_flip_25.0=0xd +phy_xaui_tx_polarity_flip_29.0=0xf +phy_xaui_tx_polarity_flip_33.0=0xd +phy_xaui_tx_polarity_flip_37.0=0xc +phy_xaui_tx_polarity_flip_41.0=0xd +phy_xaui_tx_polarity_flip_45.0=0x0 +phy_xaui_tx_polarity_flip_49.0=0x2 +phy_xaui_tx_polarity_flip_53.0=0x3 +phy_xaui_tx_polarity_flip_57.0=0x2 +phy_xaui_tx_polarity_flip_61.0=0x0 +phy_xaui_tx_polarity_flip_65.0=0xd +phy_xaui_tx_polarity_flip_69.0=0xc +phy_xaui_tx_polarity_flip_73.0=0xd +phy_xaui_tx_polarity_flip_77.0=0xf +phy_xaui_tx_polarity_flip_81.0=0xd +phy_xaui_tx_polarity_flip_85.0=0xc +phy_xaui_tx_polarity_flip_89.0=0x2 +phy_xaui_tx_polarity_flip_93.0=0x0 +phy_xaui_tx_polarity_flip_97.0=0xd +phy_xaui_tx_polarity_flip_98.0=0xc +phy_xaui_tx_polarity_flip_99.0=0x2 +phy_xaui_tx_polarity_flip_100.0=0x0 +phy_xaui_tx_polarity_flip_101.0=0x0 +phy_xaui_tx_polarity_flip_102.0=0x7 +phy_xaui_tx_polarity_flip_103.0=0x2 +phy_xaui_tx_polarity_flip_104.0=0x0 +port_init_autoneg_1.0=0 +port_init_autoneg_5.0=0 +port_init_autoneg_9.0=0 +port_init_autoneg_13.0=0 +port_init_autoneg_17.0=0 +port_init_autoneg_21.0=0 +port_init_autoneg_25.0=0 +port_init_autoneg_29.0=0 +port_init_autoneg_33.0=0 +port_init_autoneg_37.0=0 +port_init_autoneg_41.0=0 +port_init_autoneg_45.0=0 +port_init_autoneg_49.0=0 +port_init_autoneg_53.0=0 +port_init_autoneg_57.0=0 +port_init_autoneg_61.0=0 +port_init_autoneg_65.0=0 +port_init_autoneg_69.0=0 +port_init_autoneg_73.0=0 +port_init_autoneg_77.0=0 +port_init_autoneg_81.0=0 +port_init_autoneg_85.0=0 +port_init_autoneg_89.0=0 +port_init_autoneg_93.0=0 +port_init_autoneg_97.0=0 +port_init_autoneg_98.0=0 +port_init_autoneg_99.0=0 +port_init_autoneg_100.0=0 +port_init_autoneg_101.0=0 +port_init_autoneg_102.0=0 +port_init_autoneg_103.0=0 +port_init_autoneg_104.0=0 +port_init_cl72_hg.0=0x11 +port_phy_addr_1.0=0x7f +port_phy_addr_5.0=0x7f +port_phy_addr_9.0=0x7f +port_phy_addr_13.0=0x7f +port_phy_addr_17.0=0x7f +port_phy_addr_21.0=0x7f +port_phy_addr_25.0=0x7f +port_phy_addr_29.0=0x7f +port_phy_addr_33.0=0x7f +port_phy_addr_37.0=0x7f +port_phy_addr_41.0=0x7f +port_phy_addr_45.0=0x7f +port_phy_addr_49.0=0x7f +port_phy_addr_53.0=0x7f +port_phy_addr_57.0=0x7f +port_phy_addr_61.0=0x7f +port_phy_addr_65.0=0x7f +port_phy_addr_69.0=0x7f +port_phy_addr_73.0=0x7f +port_phy_addr_77.0=0x7f +port_phy_addr_81.0=0x7f +port_phy_addr_85.0=0x7f +port_phy_addr_89.0=0x7f +port_phy_addr_93.0=0x7f +port_phy_addr_97.0=0x7f +port_phy_addr_98.0=0x7f +port_phy_addr_99.0=0x7f +port_phy_addr_100.0=0x7f +port_phy_addr_101.0=0x7f +port_phy_addr_102.0=0x7f +port_phy_addr_103.0=0x7f +port_phy_addr_104.0=0x7f +portmap_1.0=9:40 +portmap_5.0=13:40 +portmap_9.0=17:40 +portmap_13.0=21:40 +portmap_17.0=29:40 +portmap_21.0=25:40 +portmap_25.0=33:40 +portmap_29.0=37:40 +portmap_33.0=45:40 +portmap_37.0=41:40 +portmap_41.0=49:40 +portmap_45.0=53:40 +portmap_49.0=69:40 +portmap_53.0=65:40 +portmap_57.0=73:40 +portmap_61.0=77:40 +portmap_65.0=93:40 +portmap_69.0=89:40 +portmap_73.0=97:40 +portmap_77.0=101:40 +portmap_81.0=109:40 +portmap_85.0=105:40 +portmap_89.0=121:40 +portmap_93.0=125:40 +portmap_97.0=61:40 +portmap_98.0=57:40 +portmap_99.0=81:40 +portmap_100.0=85:40 +portmap_101.0=117:40 +portmap_102.0=113:40 +portmap_103.0=1:40 +portmap_104.0=5:40 +serdes_firmware_mode_1.0=2 +serdes_firmware_mode_5.0=2 +serdes_firmware_mode_9.0=2 +serdes_firmware_mode_13.0=2 +serdes_firmware_mode_17.0=2 +serdes_firmware_mode_21.0=2 +serdes_firmware_mode_25.0=2 +serdes_firmware_mode_29.0=2 +serdes_firmware_mode_33.0=2 +serdes_firmware_mode_37.0=2 +serdes_firmware_mode_41.0=2 +serdes_firmware_mode_45.0=2 +serdes_firmware_mode_49.0=2 +serdes_firmware_mode_53.0=2 +serdes_firmware_mode_57.0=2 +serdes_firmware_mode_61.0=2 +serdes_firmware_mode_65.0=2 +serdes_firmware_mode_69.0=2 +serdes_firmware_mode_73.0=2 +serdes_firmware_mode_77.0=2 +serdes_firmware_mode_81.0=2 +serdes_firmware_mode_85.0=2 +serdes_firmware_mode_89.0=2 +serdes_firmware_mode_93.0=2 +serdes_firmware_mode_97.0=2 +serdes_firmware_mode_98.0=2 +serdes_firmware_mode_99.0=2 +serdes_firmware_mode_100.0=2 +serdes_firmware_mode_101.0=2 +serdes_firmware_mode_102.0=2 +serdes_firmware_mode_103.0=2 +serdes_firmware_mode_104.0=2 +xgxs_rx_lane_map_1.0=0x0123 +xgxs_rx_lane_map_5.0=0x0321 +xgxs_rx_lane_map_9.0=0x1302 +xgxs_rx_lane_map_13.0=0x0213 +xgxs_rx_lane_map_17.0=0x1302 +xgxs_rx_lane_map_21.0=0x1302 +xgxs_rx_lane_map_25.0=0x1302 +xgxs_rx_lane_map_29.0=0x0213 +xgxs_rx_lane_map_33.0=0x1302 +xgxs_rx_lane_map_37.0=0x1302 +xgxs_rx_lane_map_41.0=0x1302 +xgxs_rx_lane_map_45.0=0x0213 +xgxs_rx_lane_map_49.0=0x1302 +xgxs_rx_lane_map_53.0=0x1302 +xgxs_rx_lane_map_57.0=0x1302 +xgxs_rx_lane_map_61.0=0x0213 +xgxs_rx_lane_map_65.0=0x1302 +xgxs_rx_lane_map_69.0=0x1302 +xgxs_rx_lane_map_73.0=0x1302 +xgxs_rx_lane_map_77.0=0x0213 +xgxs_rx_lane_map_81.0=0x1302 +xgxs_rx_lane_map_85.0=0x1302 +xgxs_rx_lane_map_89.0=0x1302 +xgxs_rx_lane_map_93.0=0x0213 +xgxs_rx_lane_map_97.0=0x1302 +xgxs_rx_lane_map_98.0=0x1302 +xgxs_rx_lane_map_99.0=0x1302 +xgxs_rx_lane_map_100.0=0x0213 +xgxs_rx_lane_map_101.0=0x0213 +xgxs_rx_lane_map_102.0=0x1302 +xgxs_rx_lane_map_103.0=0x0123 +xgxs_rx_lane_map_104.0=0x2031 +xgxs_tx_lane_map_1.0=0x3210 +xgxs_tx_lane_map_5.0=0x0321 +xgxs_tx_lane_map_9.0=0x2031 +xgxs_tx_lane_map_13.0=0x0213 +xgxs_tx_lane_map_17.0=0x2031 +xgxs_tx_lane_map_21.0=0x2031 +xgxs_tx_lane_map_25.0=0x2031 +xgxs_tx_lane_map_29.0=0x0213 +xgxs_tx_lane_map_33.0=0x2031 +xgxs_tx_lane_map_37.0=0x2031 +xgxs_tx_lane_map_41.0=0x2031 +xgxs_tx_lane_map_45.0=0x0213 +xgxs_tx_lane_map_49.0=0x2031 +xgxs_tx_lane_map_53.0=0x2031 +xgxs_tx_lane_map_57.0=0x2031 +xgxs_tx_lane_map_61.0=0x0213 +xgxs_tx_lane_map_65.0=0x2031 +xgxs_tx_lane_map_69.0=0x2031 +xgxs_tx_lane_map_73.0=0x2031 +xgxs_tx_lane_map_77.0=0x0213 +xgxs_tx_lane_map_81.0=0x2031 +xgxs_tx_lane_map_85.0=0x2031 +xgxs_tx_lane_map_89.0=0x2031 +xgxs_tx_lane_map_93.0=0x0213 +xgxs_tx_lane_map_97.0=0x2031 +xgxs_tx_lane_map_98.0=0x2031 +xgxs_tx_lane_map_99.0=0x2031 +xgxs_tx_lane_map_100.0=0x0213 +xgxs_tx_lane_map_101.0=0x0213 +xgxs_tx_lane_map_102.0=0x2031 +xgxs_tx_lane_map_103.0=0x3120 +xgxs_tx_lane_map_104.0=0x1302 + +# tuning parameters +serdes_preemphasis_lane0_1.0=0x81f7 +serdes_preemphasis_lane1_1.0=0x81f7 +serdes_preemphasis_lane2_1.0=0x81f7 +serdes_preemphasis_lane3_1.0=0x81f7 +serdes_pre_driver_current_lane0_5.0=0x7 +serdes_driver_current_lane0_5.0=0x7 +serdes_preemphasis_lane0_5.0=0xc2f0 +serdes_pre_driver_current_lane1_5.0=0x7 +serdes_driver_current_lane1_5.0=0x7 +serdes_preemphasis_lane1_5.0=0xc2f0 +serdes_pre_driver_current_lane2_5.0=0x7 +serdes_driver_current_lane2_5.0=0x7 +serdes_preemphasis_lane2_5.0=0xc2f0 +serdes_pre_driver_current_lane3_5.0=0x7 +serdes_driver_current_lane3_5.0=0x7 +serdes_preemphasis_lane3_5.0=0xc2f0 +serdes_pre_driver_current_lane0_9.0=0x7 +serdes_driver_current_lane0_9.0=0x7 +serdes_preemphasis_lane0_9.0=0xbb10 +serdes_pre_driver_current_lane1_9.0=0x7 +serdes_driver_current_lane1_9.0=0x7 +serdes_preemphasis_lane1_9.0=0xbb10 +serdes_pre_driver_current_lane2_9.0=0x7 +serdes_driver_current_lane2_9.0=0x7 +serdes_preemphasis_lane2_9.0=0xbb10 +serdes_pre_driver_current_lane3_9.0=0x7 +serdes_driver_current_lane3_9.0=0x7 +serdes_preemphasis_lane3_9.0=0xbb10 +serdes_pre_driver_current_lane0_13.0=0x7 +serdes_driver_current_lane0_13.0=0x7 +serdes_preemphasis_lane0_13.0=0xbb10 +serdes_pre_driver_current_lane1_13.0=0x7 +serdes_driver_current_lane1_13.0=0x7 +serdes_preemphasis_lane1_13.0=0xbb10 +serdes_pre_driver_current_lane2_13.0=0x7 +serdes_driver_current_lane2_13.0=0x7 +serdes_preemphasis_lane2_13.0=0xbb10 +serdes_pre_driver_current_lane3_13.0=0x7 +serdes_driver_current_lane3_13.0=0x7 +serdes_preemphasis_lane3_13.0=0xbb10 +serdes_pre_driver_current_lane0_17.0=0x6 +serdes_driver_current_lane0_17.0=0x6 +serdes_preemphasis_lane0_17.0=0xb720 +serdes_pre_driver_current_lane1_17.0=0x6 +serdes_driver_current_lane1_17.0=0x6 +serdes_preemphasis_lane1_17.0=0xb720 +serdes_pre_driver_current_lane2_17.0=0x6 +serdes_driver_current_lane2_17.0=0x6 +serdes_preemphasis_lane2_17.0=0xb720 +serdes_pre_driver_current_lane3_17.0=0x6 +serdes_driver_current_lane3_17.0=0x6 +serdes_preemphasis_lane3_17.0=0xb720 +serdes_pre_driver_current_lane0_21.0=0x7 +serdes_driver_current_lane0_21.0=0x7 +serdes_preemphasis_lane0_21.0=0xbb10 +serdes_pre_driver_current_lane1_21.0=0x7 +serdes_driver_current_lane1_21.0=0x7 +serdes_preemphasis_lane1_21.0=0xbb10 +serdes_pre_driver_current_lane2_21.0=0x7 +serdes_driver_current_lane2_21.0=0x7 +serdes_preemphasis_lane2_21.0=0xbb10 +serdes_pre_driver_current_lane3_21.0=0x7 +serdes_driver_current_lane3_21.0=0x7 +serdes_preemphasis_lane3_21.0=0xbb10 +serdes_pre_driver_current_lane0_25.0=0x5 +serdes_driver_current_lane0_25.0=0x5 +serdes_preemphasis_lane0_25.0=0xb720 +serdes_pre_driver_current_lane1_25.0=0x5 +serdes_driver_current_lane1_25.0=0x5 +serdes_preemphasis_lane1_25.0=0xb720 +serdes_pre_driver_current_lane2_25.0=0x5 +serdes_driver_current_lane2_25.0=0x5 +serdes_preemphasis_lane2_25.0=0xb720 +serdes_pre_driver_current_lane3_25.0=0x5 +serdes_driver_current_lane3_25.0=0x5 +serdes_preemphasis_lane3_25.0=0xb720 +serdes_pre_driver_current_lane0_29.0=0x5 +serdes_driver_current_lane0_29.0=0x5 +serdes_preemphasis_lane0_29.0=0xb720 +serdes_pre_driver_current_lane1_29.0=0x5 +serdes_driver_current_lane1_29.0=0x5 +serdes_preemphasis_lane1_29.0=0xb720 +serdes_pre_driver_current_lane2_29.0=0x5 +serdes_driver_current_lane2_29.0=0x5 +serdes_preemphasis_lane2_29.0=0xb720 +serdes_pre_driver_current_lane3_29.0=0x5 +serdes_driver_current_lane3_29.0=0x5 +serdes_preemphasis_lane3_29.0=0xb720 +serdes_pre_driver_current_lane0_33.0=0x4 +serdes_driver_current_lane0_33.0=0x4 +serdes_preemphasis_lane0_33.0=0xb720 +serdes_pre_driver_current_lane1_33.0=0x4 +serdes_driver_current_lane1_33.0=0x4 +serdes_preemphasis_lane1_33.0=0xb720 +serdes_pre_driver_current_lane2_33.0=0x4 +serdes_driver_current_lane2_33.0=0x4 +serdes_preemphasis_lane2_33.0=0xb720 +serdes_pre_driver_current_lane3_33.0=0x4 +serdes_driver_current_lane3_33.0=0x4 +serdes_preemphasis_lane3_33.0=0xb720 +serdes_pre_driver_current_lane0_37.0=0x5 +serdes_driver_current_lane0_37.0=0x5 +serdes_preemphasis_lane0_37.0=0xb720 +serdes_pre_driver_current_lane1_37.0=0x5 +serdes_driver_current_lane1_37.0=0x5 +serdes_preemphasis_lane1_37.0=0xb720 +serdes_pre_driver_current_lane2_37.0=0x5 +serdes_driver_current_lane2_37.0=0x5 +serdes_preemphasis_lane2_37.0=0xb720 +serdes_pre_driver_current_lane3_37.0=0x5 +serdes_driver_current_lane3_37.0=0x5 +serdes_preemphasis_lane3_37.0=0xb720 +serdes_pre_driver_current_lane0_41.0=0x3 +serdes_driver_current_lane0_41.0=0x3 +serdes_preemphasis_lane0_41.0=0xb330 +serdes_pre_driver_current_lane1_41.0=0x3 +serdes_driver_current_lane1_41.0=0x3 +serdes_preemphasis_lane1_41.0=0xb330 +serdes_pre_driver_current_lane2_41.0=0x3 +serdes_driver_current_lane2_41.0=0x3 +serdes_preemphasis_lane2_41.0=0xb330 +serdes_pre_driver_current_lane3_41.0=0x3 +serdes_driver_current_lane3_41.0=0x3 +serdes_preemphasis_lane3_41.0=0xb330 +serdes_pre_driver_current_lane0_45.0=0x4 +serdes_driver_current_lane0_45.0=0x4 +serdes_preemphasis_lane0_45.0=0xb720 +serdes_pre_driver_current_lane1_45.0=0x4 +serdes_driver_current_lane1_45.0=0x4 +serdes_preemphasis_lane1_45.0=0xb720 +serdes_pre_driver_current_lane2_45.0=0x4 +serdes_driver_current_lane2_45.0=0x4 +serdes_preemphasis_lane2_45.0=0xb720 +serdes_pre_driver_current_lane3_45.0=0x4 +serdes_driver_current_lane3_45.0=0x4 +serdes_preemphasis_lane3_45.0=0xb720 +serdes_pre_driver_current_lane0_49.0=0x3 +serdes_driver_current_lane0_49.0=0x3 +serdes_preemphasis_lane0_49.0=0xb330 +serdes_pre_driver_current_lane1_49.0=0x3 +serdes_driver_current_lane1_49.0=0x3 +serdes_preemphasis_lane1_49.0=0xb330 +serdes_pre_driver_current_lane2_49.0=0x3 +serdes_driver_current_lane2_49.0=0x3 +serdes_preemphasis_lane2_49.0=0xb330 +serdes_pre_driver_current_lane3_49.0=0x3 +serdes_driver_current_lane3_49.0=0x3 +serdes_preemphasis_lane3_49.0=0xb330 +serdes_pre_driver_current_lane0_53.0=0x4 +serdes_driver_current_lane0_53.0=0x4 +serdes_preemphasis_lane0_53.0=0xb720 +serdes_pre_driver_current_lane1_53.0=0x4 +serdes_driver_current_lane1_53.0=0x4 +serdes_preemphasis_lane1_53.0=0xb720 +serdes_pre_driver_current_lane2_53.0=0x4 +serdes_driver_current_lane2_53.0=0x4 +serdes_preemphasis_lane2_53.0=0xb720 +serdes_pre_driver_current_lane3_53.0=0x4 +serdes_driver_current_lane3_53.0=0x4 +serdes_preemphasis_lane3_53.0=0xb720 +serdes_pre_driver_current_lane0_57.0=0x3 +serdes_driver_current_lane0_57.0=0x3 +serdes_preemphasis_lane0_57.0=0xb330 +serdes_pre_driver_current_lane1_57.0=0x3 +serdes_driver_current_lane1_57.0=0x3 +serdes_preemphasis_lane1_57.0=0xb330 +serdes_pre_driver_current_lane2_57.0=0x3 +serdes_driver_current_lane2_57.0=0x3 +serdes_preemphasis_lane2_57.0=0xb330 +serdes_pre_driver_current_lane3_57.0=0x3 +serdes_driver_current_lane3_57.0=0x3 +serdes_preemphasis_lane3_57.0=0xb330 +serdes_pre_driver_current_lane0_61.0=0x4 +serdes_driver_current_lane0_61.0=0x4 +serdes_preemphasis_lane0_61.0=0xb720 +serdes_pre_driver_current_lane1_61.0=0x4 +serdes_driver_current_lane1_61.0=0x4 +serdes_preemphasis_lane1_61.0=0xb720 +serdes_pre_driver_current_lane2_61.0=0x4 +serdes_driver_current_lane2_61.0=0x4 +serdes_preemphasis_lane2_61.0=0xb720 +serdes_pre_driver_current_lane3_61.0=0x4 +serdes_driver_current_lane3_61.0=0x4 +serdes_preemphasis_lane3_61.0=0xb720 +serdes_pre_driver_current_lane0_65.0=0x4 +serdes_driver_current_lane0_65.0=0x4 +serdes_preemphasis_lane0_65.0=0xb720 +serdes_pre_driver_current_lane1_65.0=0x4 +serdes_driver_current_lane1_65.0=0x4 +serdes_preemphasis_lane1_65.0=0xb720 +serdes_pre_driver_current_lane2_65.0=0x4 +serdes_driver_current_lane2_65.0=0x4 +serdes_preemphasis_lane2_65.0=0xb720 +serdes_pre_driver_current_lane3_65.0=0x4 +serdes_driver_current_lane3_65.0=0x4 +serdes_preemphasis_lane3_65.0=0xb720 +serdes_pre_driver_current_lane0_69.0=0x4 +serdes_driver_current_lane0_69.0=0x4 +serdes_preemphasis_lane0_69.0=0xb720 +serdes_pre_driver_current_lane1_69.0=0x4 +serdes_driver_current_lane1_69.0=0x4 +serdes_preemphasis_lane1_69.0=0xb720 +serdes_pre_driver_current_lane2_69.0=0x4 +serdes_driver_current_lane2_69.0=0x4 +serdes_preemphasis_lane2_69.0=0xb720 +serdes_pre_driver_current_lane3_69.0=0x4 +serdes_driver_current_lane3_69.0=0x4 +serdes_preemphasis_lane3_69.0=0xb720 +serdes_pre_driver_current_lane0_73.0=0x4 +serdes_driver_current_lane0_73.0=0x4 +serdes_preemphasis_lane0_73.0=0xb720 +serdes_pre_driver_current_lane1_73.0=0x4 +serdes_driver_current_lane1_73.0=0x4 +serdes_preemphasis_lane1_73.0=0xb720 +serdes_pre_driver_current_lane2_73.0=0x4 +serdes_driver_current_lane2_73.0=0x4 +serdes_preemphasis_lane2_73.0=0xb720 +serdes_pre_driver_current_lane3_73.0=0x4 +serdes_driver_current_lane3_73.0=0x4 +serdes_preemphasis_lane3_73.0=0xb720 +serdes_pre_driver_current_lane0_77.0=0x5 +serdes_driver_current_lane0_77.0=0x5 +serdes_preemphasis_lane0_77.0=0xb720 +serdes_pre_driver_current_lane1_77.0=0x5 +serdes_driver_current_lane1_77.0=0x5 +serdes_preemphasis_lane1_77.0=0xb720 +serdes_pre_driver_current_lane2_77.0=0x5 +serdes_driver_current_lane2_77.0=0x5 +serdes_preemphasis_lane2_77.0=0xb720 +serdes_pre_driver_current_lane3_77.0=0x5 +serdes_driver_current_lane3_77.0=0x5 +serdes_preemphasis_lane3_77.0=0xb720 +serdes_pre_driver_current_lane0_81.0=0x5 +serdes_driver_current_lane0_81.0=0x5 +serdes_preemphasis_lane0_81.0=0xb720 +serdes_pre_driver_current_lane1_81.0=0x5 +serdes_driver_current_lane1_81.0=0x5 +serdes_preemphasis_lane1_81.0=0xb720 +serdes_pre_driver_current_lane2_81.0=0x5 +serdes_driver_current_lane2_81.0=0x5 +serdes_preemphasis_lane2_81.0=0xb720 +serdes_pre_driver_current_lane3_81.0=0x5 +serdes_driver_current_lane3_81.0=0x5 +serdes_preemphasis_lane3_81.0=0xb720 +serdes_pre_driver_current_lane0_85.0=0x5 +serdes_driver_current_lane0_85.0=0x5 +serdes_preemphasis_lane0_85.0=0xb720 +serdes_pre_driver_current_lane1_85.0=0x5 +serdes_driver_current_lane1_85.0=0x5 +serdes_preemphasis_lane1_85.0=0xb720 +serdes_pre_driver_current_lane2_85.0=0x5 +serdes_driver_current_lane2_85.0=0x5 +serdes_preemphasis_lane2_85.0=0xb720 +serdes_pre_driver_current_lane3_85.0=0x5 +serdes_driver_current_lane3_85.0=0x5 +serdes_preemphasis_lane3_85.0=0xb720 +serdes_pre_driver_current_lane0_89.0=0x6 +serdes_driver_current_lane0_89.0=0x6 +serdes_preemphasis_lane0_89.0=0xb720 +serdes_pre_driver_current_lane1_89.0=0x6 +serdes_driver_current_lane1_89.0=0x6 +serdes_preemphasis_lane1_89.0=0xb720 +serdes_pre_driver_current_lane2_89.0=0x6 +serdes_driver_current_lane2_89.0=0x6 +serdes_preemphasis_lane2_89.0=0xb720 +serdes_pre_driver_current_lane3_89.0=0x6 +serdes_driver_current_lane3_89.0=0x6 +serdes_preemphasis_lane3_89.0=0xb720 +serdes_pre_driver_current_lane0_93.0=0x7 +serdes_driver_current_lane0_93.0=0x7 +serdes_preemphasis_lane0_93.0=0xbb10 +serdes_pre_driver_current_lane1_93.0=0x7 +serdes_driver_current_lane1_93.0=0x7 +serdes_preemphasis_lane1_93.0=0xbb10 +serdes_pre_driver_current_lane2_93.0=0x7 +serdes_driver_current_lane2_93.0=0x7 +serdes_preemphasis_lane2_93.0=0xbb10 +serdes_pre_driver_current_lane3_93.0=0x7 +serdes_driver_current_lane3_93.0=0x7 +serdes_preemphasis_lane3_93.0=0xbb10 +serdes_pre_driver_current_lane0_97.0=0x5 +serdes_driver_current_lane0_97.0=0x5 +serdes_preemphasis_lane0_97.0=0xb720 +serdes_pre_driver_current_lane1_97.0=0x5 +serdes_driver_current_lane1_97.0=0x5 +serdes_preemphasis_lane1_97.0=0xb720 +serdes_pre_driver_current_lane2_97.0=0x5 +serdes_driver_current_lane2_97.0=0x5 +serdes_preemphasis_lane2_97.0=0xb720 +serdes_pre_driver_current_lane3_97.0=0x5 +serdes_driver_current_lane3_97.0=0x5 +serdes_preemphasis_lane3_97.0=0xb720 +serdes_pre_driver_current_lane0_98.0=0x6 +serdes_driver_current_lane0_98.0=0x6 +serdes_preemphasis_lane0_98.0=0xb720 +serdes_pre_driver_current_lane1_98.0=0x6 +serdes_driver_current_lane1_98.0=0x6 +serdes_preemphasis_lane1_98.0=0xb720 +serdes_pre_driver_current_lane2_98.0=0x6 +serdes_driver_current_lane2_98.0=0x6 +serdes_preemphasis_lane2_98.0=0xb720 +serdes_pre_driver_current_lane3_98.0=0x6 +serdes_driver_current_lane3_98.0=0x6 +serdes_preemphasis_lane3_98.0=0xb720 +serdes_pre_driver_current_lane0_99.0=0x5 +serdes_driver_current_lane0_99.0=0x5 +serdes_preemphasis_lane0_99.0=0xb720 +serdes_pre_driver_current_lane1_99.0=0x5 +serdes_driver_current_lane1_99.0=0x5 +serdes_preemphasis_lane1_99.0=0xb720 +serdes_pre_driver_current_lane2_99.0=0x5 +serdes_driver_current_lane2_99.0=0x5 +serdes_preemphasis_lane2_99.0=0xb720 +serdes_pre_driver_current_lane3_99.0=0x5 +serdes_driver_current_lane3_99.0=0x5 +serdes_preemphasis_lane3_99.0=0xb720 +serdes_pre_driver_current_lane0_100.0=0x7 +serdes_driver_current_lane0_100.0=0x7 +serdes_preemphasis_lane0_100.0=0xbb10 +serdes_pre_driver_current_lane1_100.0=0x7 +serdes_driver_current_lane1_100.0=0x7 +serdes_preemphasis_lane1_100.0=0xbb10 +serdes_pre_driver_current_lane2_100.0=0x7 +serdes_driver_current_lane2_100.0=0x7 +serdes_preemphasis_lane2_100.0=0xbb10 +serdes_pre_driver_current_lane3_100.0=0x7 +serdes_driver_current_lane3_100.0=0x7 +serdes_preemphasis_lane3_100.0=0xbb10 +serdes_pre_driver_current_lane0_101.0=0x7 +serdes_driver_current_lane0_101.0=0x7 +serdes_preemphasis_lane0_101.0=0xbb10 +serdes_pre_driver_current_lane1_101.0=0x7 +serdes_driver_current_lane1_101.0=0x7 +serdes_preemphasis_lane1_101.0=0xbb10 +serdes_pre_driver_current_lane2_101.0=0x7 +serdes_driver_current_lane2_101.0=0x7 +serdes_preemphasis_lane2_101.0=0xbb10 +serdes_pre_driver_current_lane3_101.0=0x7 +serdes_driver_current_lane3_101.0=0x7 +serdes_preemphasis_lane3_101.0=0xbb10 +serdes_pre_driver_current_lane0_102.0=0x7 +serdes_driver_current_lane0_102.0=0x7 +serdes_preemphasis_lane0_102.0=0xbb10 +serdes_pre_driver_current_lane1_102.0=0x7 +serdes_driver_current_lane1_102.0=0x7 +serdes_preemphasis_lane1_102.0=0xbb10 +serdes_pre_driver_current_lane2_102.0=0x7 +serdes_driver_current_lane2_102.0=0x7 +serdes_preemphasis_lane2_102.0=0xbb10 +serdes_pre_driver_current_lane3_102.0=0x7 +serdes_driver_current_lane3_102.0=0x7 +serdes_preemphasis_lane3_102.0=0xbb10 +serdes_preemphasis_lane0_103.0=0x81f4 +serdes_preemphasis_lane1_103.0=0x81f4 +serdes_preemphasis_lane2_103.0=0x81f4 +serdes_preemphasis_lane3_103.0=0x81f4 +serdes_preemphasis_lane0_104.0=0x81f5 +serdes_preemphasis_lane1_104.0=0x81f5 +serdes_preemphasis_lane2_104.0=0x81f5 +serdes_preemphasis_lane3_104.0=0x81f5 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/sai.profile b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/sai.profile index 34d698db36b8..4f8c558b0885 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/sai.profile +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-32x100G-t1.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-a7060-cx32s-32x100G-t1.config.bcm diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/th-a7060-cx32s-32x100G-t1.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/th-a7060-cx32s-32x100G-t1.config.bcm new file mode 100644 index 000000000000..039fd955836c --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/th-a7060-cx32s-32x100G-t1.config.bcm @@ -0,0 +1,446 @@ +# Arista 7060CX-32S + +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 +dma_desc_timeout_usec=15000000 +higig2_hdr_mode=1 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +l2xmsg_mode=1 +max_vp_lags=0 +miim_intr_enable=0 +module_64ports=1 +os=unix +oversubscribe_mode=1 +ptp_bs_fref.0=25000000 +ptp_ts_pll_fref.0=25000000 +robust_hash_disable_egress_vlan.0=1 +robust_hash_disable_mpls.0=1 +robust_hash_disable_vlan.0=1 +tdma_timeout_usec.0=15000000 +tslam_timeout_usec.0=15000000 +pbmp_xport_xe.0=0x7ffffffffffffffffffffffffffffffffe +phy_an_allow_pll_change_hg.0=0 +phy_an_c73_1.0=1 +phy_an_c73_2.0=1 +phy_an_c73_3.0=1 +phy_an_c73_4.0=1 +phy_an_c73_5.0=1 +phy_an_c73_6.0=1 +phy_an_c73_7.0=1 +phy_an_c73_8.0=1 +phy_an_c73_34.0=1 +phy_an_c73_35.0=1 +phy_an_c73_36.0=1 +phy_an_c73_37.0=1 +phy_an_c73_38.0=1 +phy_an_c73_39.0=1 +phy_an_c73_40.0=1 +phy_an_c73_41.0=1 +phy_an_c73_68.0=1 +phy_an_c73_69.0=1 +phy_an_c73_70.0=1 +phy_an_c73_71.0=1 +phy_an_c73_72.0=1 +phy_an_c73_73.0=1 +phy_an_c73_74.0=1 +phy_an_c73_75.0=1 +phy_an_c73_102.0=1 +phy_an_c73_103.0=1 +phy_an_c73_104.0=1 +phy_an_c73_105.0=1 +phy_an_c73_106.0=1 +phy_an_c73_107.0=1 +phy_an_c73_108.0=1 +phy_an_c73_109.0=1 +phy_an_fec_1.0=1 +phy_an_fec_2.0=1 +phy_an_fec_3.0=1 +phy_an_fec_4.0=1 +phy_an_fec_5.0=1 +phy_an_fec_6.0=1 +phy_an_fec_7.0=1 +phy_an_fec_8.0=1 +phy_an_fec_9.0=1 +phy_an_fec_10.0=1 +phy_an_fec_11.0=1 +phy_an_fec_12.0=1 +phy_an_fec_13.0=1 +phy_an_fec_14.0=1 +phy_an_fec_15.0=1 +phy_an_fec_16.0=1 +phy_an_fec_17.0=1 +phy_an_fec_18.0=1 +phy_an_fec_19.0=1 +phy_an_fec_20.0=1 +phy_an_fec_21.0=1 +phy_an_fec_22.0=1 +phy_an_fec_23.0=1 +phy_an_fec_24.0=1 +phy_an_fec_25.0=1 +phy_an_fec_26.0=1 +phy_an_fec_27.0=1 +phy_an_fec_28.0=1 +phy_an_fec_29.0=1 +phy_an_fec_30.0=1 +phy_an_fec_31.0=1 +phy_an_fec_32.0=1 +phy_an_fec_34.0=1 +phy_an_fec_38.0=1 +phy_an_fec_39.0=1 +phy_an_fec_40.0=1 +phy_an_fec_41.0=1 +phy_an_fec_42.0=1 +phy_an_fec_43.0=1 +phy_an_fec_44.0=1 +phy_an_fec_45.0=1 +phy_an_fec_46.0=1 +phy_an_fec_47.0=1 +phy_an_fec_48.0=1 +phy_an_fec_49.0=1 +phy_an_fec_50.0=1 +phy_an_fec_51.0=1 +phy_an_fec_52.0=1 +phy_an_fec_53.0=1 +phy_an_fec_54.0=1 +phy_an_fec_55.0=1 +phy_an_fec_56.0=1 +phy_an_fec_57.0=1 +phy_an_fec_58.0=1 +phy_an_fec_59.0=1 +phy_an_fec_60.0=1 +phy_an_fec_61.0=1 +phy_an_fec_62.0=1 +phy_an_fec_63.0=1 +phy_an_fec_64.0=1 +phy_an_fec_65.0=1 +phy_an_fec_68.0=1 +phy_an_fec_69.0=1 +phy_an_fec_70.0=1 +phy_an_fec_71.0=1 +phy_an_fec_72.0=1 +phy_an_fec_73.0=1 +phy_an_fec_74.0=1 +phy_an_fec_75.0=1 +phy_an_fec_76.0=1 +phy_an_fec_77.0=1 +phy_an_fec_78.0=1 +phy_an_fec_79.0=1 +phy_an_fec_80.0=1 +phy_an_fec_81.0=1 +phy_an_fec_82.0=1 +phy_an_fec_83.0=1 +phy_an_fec_84.0=1 +phy_an_fec_85.0=1 +phy_an_fec_86.0=1 +phy_an_fec_87.0=1 +phy_an_fec_88.0=1 +phy_an_fec_89.0=1 +phy_an_fec_90.0=1 +phy_an_fec_91.0=1 +phy_an_fec_92.0=1 +phy_an_fec_93.0=1 +phy_an_fec_94.0=1 +phy_an_fec_95.0=1 +phy_an_fec_96.0=1 +phy_an_fec_97.0=1 +phy_an_fec_98.0=1 +phy_an_fec_99.0=1 +phy_an_fec_102.0=1 +phy_an_fec_103.0=1 +phy_an_fec_104.0=1 +phy_an_fec_105.0=1 +phy_an_fec_106.0=1 +phy_an_fec_107.0=1 +phy_an_fec_108.0=1 +phy_an_fec_109.0=1 +phy_an_fec_110.0=1 +phy_an_fec_111.0=1 +phy_an_fec_112.0=1 +phy_an_fec_113.0=1 +phy_an_fec_114.0=1 +phy_an_fec_115.0=1 +phy_an_fec_116.0=1 +phy_an_fec_117.0=1 +phy_an_fec_118.0=1 +phy_an_fec_119.0=1 +phy_an_fec_120.0=1 +phy_an_fec_121.0=1 +phy_an_fec_122.0=1 +phy_an_fec_123.0=1 +phy_an_fec_124.0=1 +phy_an_fec_125.0=1 +phy_an_fec_126.0=1 +phy_an_fec_127.0=1 +phy_an_fec_128.0=1 +phy_an_fec_129.0=1 +phy_an_fec_130.0=1 +phy_an_fec_131.0=1 +phy_an_fec_132.0=1 +phy_an_fec_133.0=1 +phy_xaui_rx_polarity_flip_1.0=0x1 +phy_xaui_rx_polarity_flip_2.0=0x5 +phy_xaui_rx_polarity_flip_3.0=0x1 +phy_xaui_rx_polarity_flip_4.0=0x7 +phy_xaui_rx_polarity_flip_5.0=0xc +phy_xaui_rx_polarity_flip_6.0=0xf +phy_xaui_rx_polarity_flip_7.0=0xc +phy_xaui_rx_polarity_flip_8.0=0xf +phy_xaui_rx_polarity_flip_34.0=0x0 +phy_xaui_rx_polarity_flip_35.0=0x7 +phy_xaui_rx_polarity_flip_36.0=0x4 +phy_xaui_rx_polarity_flip_37.0=0x7 +phy_xaui_rx_polarity_flip_38.0=0x4 +phy_xaui_rx_polarity_flip_39.0=0x6 +phy_xaui_rx_polarity_flip_40.0=0x1 +phy_xaui_rx_polarity_flip_41.0=0x2 +phy_xaui_rx_polarity_flip_68.0=0xd +phy_xaui_rx_polarity_flip_69.0=0x6 +phy_xaui_rx_polarity_flip_70.0=0x1 +phy_xaui_rx_polarity_flip_71.0=0x8 +phy_xaui_rx_polarity_flip_72.0=0x7 +phy_xaui_rx_polarity_flip_73.0=0xc +phy_xaui_rx_polarity_flip_74.0=0x7 +phy_xaui_rx_polarity_flip_75.0=0x8 +phy_xaui_rx_polarity_flip_102.0=0xb +phy_xaui_rx_polarity_flip_103.0=0xc +phy_xaui_rx_polarity_flip_104.0=0x3 +phy_xaui_rx_polarity_flip_105.0=0xc +phy_xaui_rx_polarity_flip_106.0=0xb +phy_xaui_rx_polarity_flip_107.0=0x5 +phy_xaui_rx_polarity_flip_108.0=0x1 +phy_xaui_rx_polarity_flip_109.0=0x9 +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_2.0=0xe +phy_xaui_tx_polarity_flip_3.0=0x2 +phy_xaui_tx_polarity_flip_4.0=0xe +phy_xaui_tx_polarity_flip_5.0=0xc +phy_xaui_tx_polarity_flip_6.0=0xf +phy_xaui_tx_polarity_flip_7.0=0xc +phy_xaui_tx_polarity_flip_8.0=0xf +phy_xaui_tx_polarity_flip_34.0=0x0 +phy_xaui_tx_polarity_flip_35.0=0xe +phy_xaui_tx_polarity_flip_36.0=0x0 +phy_xaui_tx_polarity_flip_37.0=0xe +phy_xaui_tx_polarity_flip_38.0=0xf +phy_xaui_tx_polarity_flip_39.0=0xe +phy_xaui_tx_polarity_flip_40.0=0x6 +phy_xaui_tx_polarity_flip_41.0=0xb +phy_xaui_tx_polarity_flip_68.0=0x9 +phy_xaui_tx_polarity_flip_69.0=0xb +phy_xaui_tx_polarity_flip_70.0=0xd +phy_xaui_tx_polarity_flip_71.0=0x9 +phy_xaui_tx_polarity_flip_72.0=0x6 +phy_xaui_tx_polarity_flip_73.0=0xc +phy_xaui_tx_polarity_flip_74.0=0x9 +phy_xaui_tx_polarity_flip_75.0=0x9 +phy_xaui_tx_polarity_flip_102.0=0x6 +phy_xaui_tx_polarity_flip_103.0=0xb +phy_xaui_tx_polarity_flip_104.0=0x6 +phy_xaui_tx_polarity_flip_105.0=0xb +phy_xaui_tx_polarity_flip_106.0=0x6 +phy_xaui_tx_polarity_flip_107.0=0xf +phy_xaui_tx_polarity_flip_108.0=0x6 +phy_xaui_tx_polarity_flip_109.0=0xc +portmap_1.0=1:100 +portmap_2.0=5:100 +portmap_3.0=9:100 +portmap_4.0=13:100 +portmap_5.0=17:100 +portmap_6.0=21:100 +portmap_7.0=25:100 +portmap_8.0=29:100 +portmap_34.0=33:100 +portmap_35.0=37:100 +portmap_36.0=41:100 +portmap_37.0=45:100 +portmap_38.0=49:100 +portmap_39.0=53:100 +portmap_40.0=57:100 +portmap_41.0=61:100 +portmap_68.0=65:100 +portmap_69.0=69:100 +portmap_70.0=73:100 +portmap_71.0=77:100 +portmap_72.0=81:100 +portmap_73.0=85:100 +portmap_74.0=89:100 +portmap_75.0=93:100 +portmap_102.0=97:100 +portmap_103.0=101:100 +portmap_104.0=105:100 +portmap_105.0=109:100 +portmap_106.0=113:100 +portmap_107.0=117:100 +portmap_108.0=121:100 +portmap_109.0=125:100 +port_phy_addr_1.0=0xff +port_phy_addr_2.0=0xff +port_phy_addr_3.0=0xff +port_phy_addr_4.0=0xff +port_phy_addr_5.0=0xff +port_phy_addr_6.0=0xff +port_phy_addr_7.0=0xff +port_phy_addr_8.0=0xff +port_phy_addr_34.0=0xff +port_phy_addr_35.0=0xff +port_phy_addr_36.0=0xff +port_phy_addr_37.0=0xff +port_phy_addr_38.0=0xff +port_phy_addr_39.0=0xff +port_phy_addr_40.0=0xff +port_phy_addr_41.0=0xff +port_phy_addr_68.0=0xff +port_phy_addr_69.0=0xff +port_phy_addr_70.0=0xff +port_phy_addr_71.0=0xff +port_phy_addr_72.0=0xff +port_phy_addr_73.0=0xff +port_phy_addr_74.0=0xff +port_phy_addr_75.0=0xff +port_phy_addr_102.0=0xff +port_phy_addr_103.0=0xff +port_phy_addr_104.0=0xff +port_phy_addr_105.0=0xff +port_phy_addr_106.0=0xff +port_phy_addr_107.0=0xff +port_phy_addr_108.0=0xff +port_phy_addr_109.0=0xff +xgxs_rx_lane_map_1.0=0x3210 +xgxs_rx_lane_map_2.0=0x3210 +xgxs_rx_lane_map_3.0=0x3210 +xgxs_rx_lane_map_4.0=0x3210 +xgxs_rx_lane_map_5.0=0x0123 +xgxs_rx_lane_map_6.0=0x2301 +xgxs_rx_lane_map_7.0=0x0123 +xgxs_rx_lane_map_8.0=0x2301 +xgxs_rx_lane_map_34.0=0x0123 +xgxs_rx_lane_map_35.0=0x0321 +xgxs_rx_lane_map_36.0=0x0321 +xgxs_rx_lane_map_37.0=0x0321 +xgxs_rx_lane_map_38.0=0x1230 +xgxs_rx_lane_map_39.0=0x2301 +xgxs_rx_lane_map_40.0=0x1230 +xgxs_rx_lane_map_41.0=0x2103 +xgxs_rx_lane_map_68.0=0x1230 +xgxs_rx_lane_map_69.0=0x2301 +xgxs_rx_lane_map_70.0=0x1230 +xgxs_rx_lane_map_71.0=0x2103 +xgxs_rx_lane_map_72.0=0x1230 +xgxs_rx_lane_map_73.0=0x2301 +xgxs_rx_lane_map_74.0=0x1230 +xgxs_rx_lane_map_75.0=0x2103 +xgxs_rx_lane_map_102.0=0x3210 +xgxs_rx_lane_map_103.0=0x3210 +xgxs_rx_lane_map_104.0=0x3210 +xgxs_rx_lane_map_105.0=0x3210 +xgxs_rx_lane_map_106.0=0x3210 +xgxs_rx_lane_map_107.0=0x3210 +xgxs_rx_lane_map_108.0=0x3210 +xgxs_rx_lane_map_109.0=0x3210 +xgxs_tx_lane_map_1.0=0x0321 +xgxs_tx_lane_map_2.0=0x2301 +xgxs_tx_lane_map_3.0=0x0321 +xgxs_tx_lane_map_4.0=0x2301 +xgxs_tx_lane_map_5.0=0x0123 +xgxs_tx_lane_map_6.0=0x0123 +xgxs_tx_lane_map_7.0=0x0123 +xgxs_tx_lane_map_8.0=0x0123 +xgxs_tx_lane_map_34.0=0x2301 +xgxs_tx_lane_map_35.0=0x0321 +xgxs_tx_lane_map_36.0=0x2301 +xgxs_tx_lane_map_37.0=0x0321 +xgxs_tx_lane_map_38.0=0x0123 +xgxs_tx_lane_map_39.0=0x1230 +xgxs_tx_lane_map_40.0=0x2301 +xgxs_tx_lane_map_41.0=0x1032 +xgxs_tx_lane_map_68.0=0x0123 +xgxs_tx_lane_map_69.0=0x1230 +xgxs_tx_lane_map_70.0=0x2301 +xgxs_tx_lane_map_71.0=0x1032 +xgxs_tx_lane_map_72.0=0x0123 +xgxs_tx_lane_map_73.0=0x1230 +xgxs_tx_lane_map_74.0=0x2301 +xgxs_tx_lane_map_75.0=0x1032 +xgxs_tx_lane_map_102.0=0x0321 +xgxs_tx_lane_map_103.0=0x2301 +xgxs_tx_lane_map_104.0=0x0321 +xgxs_tx_lane_map_105.0=0x2301 +xgxs_tx_lane_map_106.0=0x0321 +xgxs_tx_lane_map_107.0=0x2301 +xgxs_tx_lane_map_108.0=0x0321 +xgxs_tx_lane_map_109.0=0x2301 + +# tuning parameters for 25g serdes fiber +serdes_driver_current_1=0xa +serdes_preemphasis_1=0x284008 +serdes_driver_current_2=0xa +serdes_preemphasis_2=0x284008 +serdes_driver_current_3=0xa +serdes_preemphasis_3=0x284008 +serdes_driver_current_4=0xa +serdes_preemphasis_4=0x284008 +serdes_driver_current_5=0xa +serdes_preemphasis_5=0x284008 +serdes_driver_current_6=0xa +serdes_preemphasis_6=0x284008 +serdes_driver_current_7=0xa +serdes_preemphasis_7=0x284008 +serdes_driver_current_8=0xd +serdes_preemphasis_8=0x303808 +serdes_driver_current_34=0xd +serdes_preemphasis_34=0x303808 +serdes_driver_current_35=0xd +serdes_preemphasis_35=0x303808 +serdes_driver_current_36=0xd +serdes_preemphasis_36=0x303808 +serdes_driver_current_37=0xd +serdes_preemphasis_37=0x303808 +serdes_driver_current_38=0xf +serdes_preemphasis_38=0x373108 +serdes_driver_current_39=0xf +serdes_preemphasis_39=0x373108 +serdes_driver_current_40=0xf +serdes_preemphasis_40=0x373108 +serdes_driver_current_41=0xf +serdes_preemphasis_41=0x373108 +serdes_driver_current_68=0xf +serdes_preemphasis_68=0x373108 +serdes_driver_current_69=0xf +serdes_preemphasis_69=0x373108 +serdes_driver_current_70=0xf +serdes_preemphasis_70=0x373108 +serdes_driver_current_71=0xf +serdes_preemphasis_71=0x373108 +serdes_driver_current_72=0xd +serdes_preemphasis_72=0x303808 +serdes_driver_current_73=0xd +serdes_preemphasis_73=0x303808 +serdes_driver_current_74=0xd +serdes_preemphasis_74=0x303808 +serdes_driver_current_75=0xd +serdes_preemphasis_75=0x303808 +serdes_driver_current_102=0xa +serdes_preemphasis_102=0x284008 +serdes_driver_current_103=0xa +serdes_preemphasis_103=0x284008 +serdes_driver_current_104=0xa +serdes_preemphasis_104=0x284008 +serdes_driver_current_105=0xa +serdes_preemphasis_105=0x284008 +serdes_driver_current_106=0xa +serdes_preemphasis_106=0x284008 +serdes_driver_current_107=0xa +serdes_preemphasis_107=0x284008 +serdes_driver_current_108=0xa +serdes_preemphasis_108=0x284008 +serdes_driver_current_109=0xa +serdes_preemphasis_109=0x284008 + +mmu_init_config="MSFT-TH-Tier1" diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/sai.profile b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/sai.profile index 0c3ab159868b..87b4ffdadd6d 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/sai.profile +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-a7060-cx32s-8x100G+48x50G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-a7060-cx32s-8x100G+48x50G.config.bcm diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/th-a7060-cx32s-8x100G+48x50G.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/th-a7060-cx32s-8x100G+48x50G.config.bcm new file mode 100644 index 000000000000..326a51ada84f --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/th-a7060-cx32s-8x100G+48x50G.config.bcm @@ -0,0 +1,547 @@ +# Arista 7060CX-32S + +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 +dma_desc_timeout_usec=15000000 +higig2_hdr_mode=1 +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 +l2xmsg_mode=1 +max_vp_lags=0 +miim_intr_enable=0 +module_64ports=1 +os=unix +oversubscribe_mode=1 +ptp_bs_fref.0=25000000 +ptp_ts_pll_fref.0=25000000 +robust_hash_disable_egress_vlan.0=1 +robust_hash_disable_mpls.0=1 +robust_hash_disable_vlan.0=1 +tdma_timeout_usec.0=15000000 +tslam_timeout_usec.0=15000000 +pbmp_xport_xe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe +phy_an_allow_pll_change_hg.0=0 +dport_map_direct=1 +phy_an_c73=1 + +phy_an_fec_1.0=1 +phy_an_fec_2.0=1 +phy_an_fec_3.0=1 +phy_an_fec_4.0=1 +phy_an_fec_5.0=1 +phy_an_fec_6.0=1 +phy_an_fec_7.0=1 +phy_an_fec_8.0=1 +phy_an_fec_9.0=1 +phy_an_fec_10.0=1 +phy_an_fec_11.0=1 +phy_an_fec_12.0=1 +phy_an_fec_13.0=1 +phy_an_fec_14.0=1 +phy_an_fec_34.0=1 +phy_an_fec_35.0=1 +phy_an_fec_36.0=1 +phy_an_fec_37.0=1 +phy_an_fec_38.0=1 +phy_an_fec_39.0=1 +phy_an_fec_40.0=1 +phy_an_fec_41.0=1 +phy_an_fec_42.0=1 +phy_an_fec_43.0=1 +phy_an_fec_44.0=1 +phy_an_fec_45.0=1 +phy_an_fec_46.0=1 +phy_an_fec_47.0=1 +phy_an_fec_68.0=1 +phy_an_fec_69.0=1 +phy_an_fec_70.0=1 +phy_an_fec_71.0=1 +phy_an_fec_72.0=1 +phy_an_fec_73.0=1 +phy_an_fec_74.0=1 +phy_an_fec_75.0=1 +phy_an_fec_76.0=1 +phy_an_fec_77.0=1 +phy_an_fec_78.0=1 +phy_an_fec_79.0=1 +phy_an_fec_80.0=1 +phy_an_fec_81.0=1 +phy_an_fec_102.0=1 +phy_an_fec_103.0=1 +phy_an_fec_104.0=1 +phy_an_fec_105.0=1 +phy_an_fec_106.0=1 +phy_an_fec_107.0=1 +phy_an_fec_108.0=1 +phy_an_fec_109.0=1 +phy_an_fec_110.0=1 +phy_an_fec_111.0=1 +phy_an_fec_112.0=1 +phy_an_fec_113.0=1 +phy_an_fec_114.0=1 +phy_an_fec_115.0=1 + +# Q1 +portmap_1.0=1:100 +portmap_2.0=5:100 +portmap_3.0=9:50:2 +portmap_4.0=11:50:2 +portmap_5.0=13:50:2 +portmap_6.0=15:50:2 +portmap_7.0=17:50:2 +portmap_8.0=19:50:2 +portmap_9.0=21:50:2 +portmap_10.0=23:50:2 +portmap_11.0=25:50:2 +portmap_12.0=27:50:2 +portmap_13.0=29:50:2 +portmap_14.0=31:50:2 +phy_xaui_rx_polarity_flip_1.0=0x1 +phy_xaui_rx_polarity_flip_2.0=0x5 +phy_xaui_rx_polarity_flip_3.0=0x1 +phy_xaui_rx_polarity_flip_4.0=0x0 +phy_xaui_rx_polarity_flip_5.0=0x3 +phy_xaui_rx_polarity_flip_6.0=0x1 +phy_xaui_rx_polarity_flip_7.0=0x0 +phy_xaui_rx_polarity_flip_8.0=0x3 +phy_xaui_rx_polarity_flip_9.0=0x3 +phy_xaui_rx_polarity_flip_10.0=0x3 +phy_xaui_rx_polarity_flip_11.0=0x0 +phy_xaui_rx_polarity_flip_12.0=0x3 +phy_xaui_rx_polarity_flip_13.0=0x3 +phy_xaui_rx_polarity_flip_14.0=0x3 +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_2.0=0xe +phy_xaui_tx_polarity_flip_3.0=0x2 +phy_xaui_tx_polarity_flip_4.0=0x0 +phy_xaui_tx_polarity_flip_5.0=0x2 +phy_xaui_tx_polarity_flip_6.0=0x3 +phy_xaui_tx_polarity_flip_7.0=0x0 +phy_xaui_tx_polarity_flip_8.0=0x3 +phy_xaui_tx_polarity_flip_9.0=0x3 +phy_xaui_tx_polarity_flip_10.0=0x3 +phy_xaui_tx_polarity_flip_11.0=0x0 +phy_xaui_tx_polarity_flip_12.0=0x3 +phy_xaui_tx_polarity_flip_13.0=0x3 +phy_xaui_tx_polarity_flip_14.0=0x3 +port_phy_addr_1.0=0xff +port_phy_addr_2.0=0xff +port_phy_addr_3.0=0xff +port_phy_addr_4.0=0xff +port_phy_addr_5.0=0xff +port_phy_addr_6.0=0xff +port_phy_addr_7.0=0xff +port_phy_addr_8.0=0xff +port_phy_addr_9.0=0xff +port_phy_addr_10.0=0xff +port_phy_addr_11.0=0xff +port_phy_addr_12.0=0xff +port_phy_addr_13.0=0xff +port_phy_addr_14.0=0xff +xgxs_rx_lane_map_1.0=0x3210 +xgxs_rx_lane_map_2.0=0x3210 +xgxs_rx_lane_map_3.0=0x3210 +xgxs_rx_lane_map_4.0=0x3210 +xgxs_rx_lane_map_5.0=0x3210 +xgxs_rx_lane_map_6.0=0x3210 +xgxs_rx_lane_map_7.0=0x0123 +xgxs_rx_lane_map_8.0=0x0123 +xgxs_rx_lane_map_9.0=0x2301 +xgxs_rx_lane_map_10.0=0x2301 +xgxs_rx_lane_map_11.0=0x0123 +xgxs_rx_lane_map_12.0=0x0123 +xgxs_rx_lane_map_13.0=0x2301 +xgxs_rx_lane_map_14.0=0x2301 +xgxs_tx_lane_map_1.0=0x0321 +xgxs_tx_lane_map_2.0=0x2301 +xgxs_tx_lane_map_3.0=0x0321 +xgxs_tx_lane_map_4.0=0x0321 +xgxs_tx_lane_map_5.0=0x2301 +xgxs_tx_lane_map_6.0=0x2301 +xgxs_tx_lane_map_7.0=0x0123 +xgxs_tx_lane_map_8.0=0x0123 +xgxs_tx_lane_map_9.0=0x0123 +xgxs_tx_lane_map_10.0=0x0123 +xgxs_tx_lane_map_11.0=0x0123 +xgxs_tx_lane_map_12.0=0x0123 +xgxs_tx_lane_map_13.0=0x0123 +xgxs_tx_lane_map_14.0=0x0123 + +# Q2 +portmap_34.0=33:50:2 +portmap_35.0=35:50:2 +portmap_36.0=37:50:2 +portmap_37.0=39:50:2 +portmap_38.0=41:50:2 +portmap_39.0=43:50:2 +portmap_40.0=45:50:2 +portmap_41.0=47:50:2 +portmap_42.0=49:50:2 +portmap_43.0=51:50:2 +portmap_44.0=53:50:2 +portmap_45.0=55:50:2 +portmap_46.0=57:100 +portmap_47.0=61:100 +phy_xaui_rx_polarity_flip_34.0=0x0 +phy_xaui_rx_polarity_flip_35.0=0x0 +phy_xaui_rx_polarity_flip_36.0=0x3 +phy_xaui_rx_polarity_flip_37.0=0x1 +phy_xaui_rx_polarity_flip_38.0=0x0 +phy_xaui_rx_polarity_flip_39.0=0x1 +phy_xaui_rx_polarity_flip_40.0=0x3 +phy_xaui_rx_polarity_flip_41.0=0x1 +phy_xaui_rx_polarity_flip_42.0=0x0 +phy_xaui_rx_polarity_flip_43.0=0x1 +phy_xaui_rx_polarity_flip_44.0=0x2 +phy_xaui_rx_polarity_flip_45.0=0x1 +phy_xaui_rx_polarity_flip_46.0=0x1 +phy_xaui_rx_polarity_flip_47.0=0x2 +phy_xaui_tx_polarity_flip_34.0=0x0 +phy_xaui_tx_polarity_flip_35.0=0x0 +phy_xaui_tx_polarity_flip_36.0=0x2 +phy_xaui_tx_polarity_flip_37.0=0x3 +phy_xaui_tx_polarity_flip_38.0=0x0 +phy_xaui_tx_polarity_flip_39.0=0x0 +phy_xaui_tx_polarity_flip_40.0=0x2 +phy_xaui_tx_polarity_flip_41.0=0x3 +phy_xaui_tx_polarity_flip_42.0=0x3 +phy_xaui_tx_polarity_flip_43.0=0x3 +phy_xaui_tx_polarity_flip_44.0=0x2 +phy_xaui_tx_polarity_flip_45.0=0x3 +phy_xaui_tx_polarity_flip_46.0=0x6 +phy_xaui_tx_polarity_flip_47.0=0xb +port_phy_addr_34.0=0xff +port_phy_addr_35.0=0xff +port_phy_addr_36.0=0xff +port_phy_addr_37.0=0xff +port_phy_addr_38.0=0xff +port_phy_addr_39.0=0xff +port_phy_addr_40.0=0xff +port_phy_addr_41.0=0xff +port_phy_addr_42.0=0xff +port_phy_addr_43.0=0xff +port_phy_addr_44.0=0xff +port_phy_addr_45.0=0xff +port_phy_addr_46.0=0xff +port_phy_addr_47.0=0xff +xgxs_rx_lane_map_34.0=0x0123 +xgxs_rx_lane_map_35.0=0x0123 +xgxs_rx_lane_map_36.0=0x0321 +xgxs_rx_lane_map_37.0=0x0321 +xgxs_rx_lane_map_38.0=0x0321 +xgxs_rx_lane_map_39.0=0x0321 +xgxs_rx_lane_map_40.0=0x0321 +xgxs_rx_lane_map_41.0=0x0321 +xgxs_rx_lane_map_42.0=0x1230 +xgxs_rx_lane_map_43.0=0x1230 +xgxs_rx_lane_map_44.0=0x2301 +xgxs_rx_lane_map_45.0=0x2301 +xgxs_rx_lane_map_46.0=0x1230 +xgxs_rx_lane_map_47.0=0x2103 +xgxs_tx_lane_map_34.0=0x2301 +xgxs_tx_lane_map_35.0=0x2301 +xgxs_tx_lane_map_36.0=0x0321 +xgxs_tx_lane_map_37.0=0x0321 +xgxs_tx_lane_map_38.0=0x2301 +xgxs_tx_lane_map_39.0=0x2301 +xgxs_tx_lane_map_40.0=0x0321 +xgxs_tx_lane_map_41.0=0x0321 +xgxs_tx_lane_map_42.0=0x0123 +xgxs_tx_lane_map_43.0=0x0123 +xgxs_tx_lane_map_44.0=0x1230 +xgxs_tx_lane_map_45.0=0x1230 +xgxs_tx_lane_map_46.0=0x2301 +xgxs_tx_lane_map_47.0=0x1032 + +# Q3 +portmap_68.0=65:100 +portmap_69.0=69:100 +portmap_70.0=73:50:2 +portmap_71.0=75:50:2 +portmap_72.0=77:50:2 +portmap_73.0=79:50:2 +portmap_74.0=81:50:2 +portmap_75.0=83:50:2 +portmap_76.0=85:50:2 +portmap_77.0=87:50:2 +portmap_78.0=89:50:2 +portmap_79.0=91:50:2 +portmap_80.0=93:50:2 +portmap_81.0=95:50:2 +phy_xaui_rx_polarity_flip_68.0=0xd +phy_xaui_rx_polarity_flip_69.0=0x6 +phy_xaui_rx_polarity_flip_70.0=0x1 +phy_xaui_rx_polarity_flip_71.0=0x0 +phy_xaui_rx_polarity_flip_72.0=0x0 +phy_xaui_rx_polarity_flip_73.0=0x2 +phy_xaui_rx_polarity_flip_74.0=0x3 +phy_xaui_rx_polarity_flip_75.0=0x1 +phy_xaui_rx_polarity_flip_76.0=0x0 +phy_xaui_rx_polarity_flip_77.0=0x3 +phy_xaui_rx_polarity_flip_78.0=0x3 +phy_xaui_rx_polarity_flip_79.0=0x1 +phy_xaui_rx_polarity_flip_80.0=0x0 +phy_xaui_rx_polarity_flip_81.0=0x2 +phy_xaui_tx_polarity_flip_68.0=0x9 +phy_xaui_tx_polarity_flip_69.0=0xb +phy_xaui_tx_polarity_flip_70.0=0x1 +phy_xaui_tx_polarity_flip_71.0=0x3 +phy_xaui_tx_polarity_flip_72.0=0x1 +phy_xaui_tx_polarity_flip_73.0=0x2 +phy_xaui_tx_polarity_flip_74.0=0x2 +phy_xaui_tx_polarity_flip_75.0=0x1 +phy_xaui_tx_polarity_flip_76.0=0x0 +phy_xaui_tx_polarity_flip_77.0=0x3 +phy_xaui_tx_polarity_flip_78.0=0x1 +phy_xaui_tx_polarity_flip_79.0=0x2 +phy_xaui_tx_polarity_flip_80.0=0x1 +phy_xaui_tx_polarity_flip_81.0=0x2 +port_phy_addr_68.0=0xff +port_phy_addr_69.0=0xff +port_phy_addr_70.0=0xff +port_phy_addr_71.0=0xff +port_phy_addr_72.0=0xff +port_phy_addr_73.0=0xff +port_phy_addr_74.0=0xff +port_phy_addr_75.0=0xff +port_phy_addr_76.0=0xff +port_phy_addr_77.0=0xff +port_phy_addr_78.0=0xff +port_phy_addr_79.0=0xff +port_phy_addr_80.0=0xff +port_phy_addr_81.0=0xff +xgxs_rx_lane_map_68.0=0x1230 +xgxs_rx_lane_map_69.0=0x2301 +xgxs_rx_lane_map_70.0=0x1230 +xgxs_rx_lane_map_71.0=0x1230 +xgxs_rx_lane_map_72.0=0x2103 +xgxs_rx_lane_map_73.0=0x2103 +xgxs_rx_lane_map_74.0=0x1230 +xgxs_rx_lane_map_75.0=0x1230 +xgxs_rx_lane_map_76.0=0x2301 +xgxs_rx_lane_map_77.0=0x2301 +xgxs_rx_lane_map_78.0=0x1230 +xgxs_rx_lane_map_79.0=0x1230 +xgxs_rx_lane_map_80.0=0x2103 +xgxs_rx_lane_map_81.0=0x2103 +xgxs_tx_lane_map_68.0=0x0123 +xgxs_tx_lane_map_69.0=0x1230 +xgxs_tx_lane_map_70.0=0x2301 +xgxs_tx_lane_map_71.0=0x2301 +xgxs_tx_lane_map_72.0=0x1032 +xgxs_tx_lane_map_73.0=0x1032 +xgxs_tx_lane_map_74.0=0x0123 +xgxs_tx_lane_map_75.0=0x0123 +xgxs_tx_lane_map_76.0=0x1230 +xgxs_tx_lane_map_77.0=0x1230 +xgxs_tx_lane_map_78.0=0x2301 +xgxs_tx_lane_map_79.0=0x2301 +xgxs_tx_lane_map_80.0=0x1032 +xgxs_tx_lane_map_81.0=0x1032 + +# Q4 +portmap_102.0=97:50:2 +portmap_103.0=99:50:2 +portmap_104.0=101:50:2 +portmap_105.0=103:50:2 +portmap_106.0=105:50:2 +portmap_107.0=107:50:2 +portmap_108.0=109:50:2 +portmap_109.0=111:50:2 +portmap_110.0=113:50:2 +portmap_111.0=115:50:2 +portmap_112.0=117:50:2 +portmap_113.0=119:50:2 +portmap_114.0=121:100 +portmap_115.0=125:100 +phy_xaui_rx_polarity_flip_102.0=0x3 +phy_xaui_rx_polarity_flip_103.0=0x2 +phy_xaui_rx_polarity_flip_104.0=0x0 +phy_xaui_rx_polarity_flip_105.0=0x3 +phy_xaui_rx_polarity_flip_106.0=0x3 +phy_xaui_rx_polarity_flip_107.0=0x0 +phy_xaui_rx_polarity_flip_108.0=0x0 +phy_xaui_rx_polarity_flip_109.0=0x3 +phy_xaui_rx_polarity_flip_110.0=0x3 +phy_xaui_rx_polarity_flip_111.0=0x2 +phy_xaui_rx_polarity_flip_112.0=0x1 +phy_xaui_rx_polarity_flip_113.0=0x1 +phy_xaui_rx_polarity_flip_114.0=0x1 +phy_xaui_rx_polarity_flip_115.0=0x9 +phy_xaui_tx_polarity_flip_102.0=0x2 +phy_xaui_tx_polarity_flip_103.0=0x1 +phy_xaui_tx_polarity_flip_104.0=0x3 +phy_xaui_tx_polarity_flip_105.0=0x2 +phy_xaui_tx_polarity_flip_106.0=0x2 +phy_xaui_tx_polarity_flip_107.0=0x1 +phy_xaui_tx_polarity_flip_108.0=0x3 +phy_xaui_tx_polarity_flip_109.0=0x2 +phy_xaui_tx_polarity_flip_110.0=0x2 +phy_xaui_tx_polarity_flip_111.0=0x1 +phy_xaui_tx_polarity_flip_112.0=0x3 +phy_xaui_tx_polarity_flip_113.0=0x3 +phy_xaui_tx_polarity_flip_114.0=0x6 +phy_xaui_tx_polarity_flip_115.0=0xc +port_phy_addr_102.0=0xff +port_phy_addr_103.0=0xff +port_phy_addr_104.0=0xff +port_phy_addr_105.0=0xff +port_phy_addr_106.0=0xff +port_phy_addr_107.0=0xff +port_phy_addr_108.0=0xff +port_phy_addr_109.0=0xff +port_phy_addr_110.0=0xff +port_phy_addr_111.0=0xff +port_phy_addr_112.0=0xff +port_phy_addr_113.0=0xff +port_phy_addr_114.0=0xff +port_phy_addr_115.0=0xff +xgxs_rx_lane_map_102.0=0x3210 +xgxs_rx_lane_map_103.0=0x3210 +xgxs_rx_lane_map_104.0=0x3210 +xgxs_rx_lane_map_105.0=0x3210 +xgxs_rx_lane_map_106.0=0x3210 +xgxs_rx_lane_map_107.0=0x3210 +xgxs_rx_lane_map_108.0=0x3210 +xgxs_rx_lane_map_109.0=0x3210 +xgxs_rx_lane_map_110.0=0x3210 +xgxs_rx_lane_map_111.0=0x3210 +xgxs_rx_lane_map_112.0=0x3210 +xgxs_rx_lane_map_114.0=0x3210 +xgxs_rx_lane_map_115.0=0x3210 +xgxs_tx_lane_map_102.0=0x0321 +xgxs_tx_lane_map_103.0=0x0321 +xgxs_tx_lane_map_104.0=0x2301 +xgxs_tx_lane_map_105.0=0x2301 +xgxs_tx_lane_map_106.0=0x0321 +xgxs_tx_lane_map_107.0=0x0321 +xgxs_tx_lane_map_108.0=0x2301 +xgxs_tx_lane_map_109.0=0x2301 +xgxs_tx_lane_map_110.0=0x0321 +xgxs_tx_lane_map_111.0=0x0321 +xgxs_tx_lane_map_112.0=0x2301 +xgxs_tx_lane_map_113.0=0x2301 +xgxs_tx_lane_map_114.0=0x0321 +xgxs_tx_lane_map_115.0=0x2301 + +# tuning parameters +serdes_driver_current_1=0xa +serdes_preemphasis_1=0x284008 +serdes_driver_current_2=0xa +serdes_preemphasis_2=0x284008 +serdes_driver_current_3=0xf +serdes_preemphasis_3=0x46408 +serdes_driver_current_4=0xf +serdes_preemphasis_4=0x46408 +serdes_driver_current_5=0xf +serdes_preemphasis_5=0x46408 +serdes_driver_current_6=0xf +serdes_preemphasis_6=0x46408 +serdes_driver_current_7=0xf +serdes_preemphasis_7=0x46408 +serdes_driver_current_8=0xf +serdes_preemphasis_8=0x46408 +serdes_driver_current_9=0xf +serdes_preemphasis_9=0x46408 +serdes_driver_current_10=0xf +serdes_preemphasis_10=0x46408 +serdes_driver_current_11=0xf +serdes_preemphasis_11=0x46408 +serdes_driver_current_12=0xf +serdes_preemphasis_12=0x46408 +serdes_driver_current_13=0xf +serdes_preemphasis_13=0x46408 +serdes_driver_current_14=0xf +serdes_preemphasis_14=0x46408 +serdes_driver_current_34=0xf +serdes_preemphasis_34=0x46408 +serdes_driver_current_35=0xf +serdes_preemphasis_35=0x46408 +serdes_driver_current_36=0xf +serdes_preemphasis_36=0x46408 +serdes_driver_current_37=0xf +serdes_preemphasis_37=0x46408 +serdes_driver_current_38=0xf +serdes_preemphasis_38=0x46408 +serdes_driver_current_39=0xf +serdes_preemphasis_39=0x46408 +serdes_driver_current_40=0xf +serdes_preemphasis_40=0x46408 +serdes_driver_current_41=0xf +serdes_preemphasis_41=0x46408 +serdes_driver_current_42=0xf +serdes_preemphasis_42=0x46408 +serdes_driver_current_43=0xf +serdes_preemphasis_43=0x46408 +serdes_driver_current_44=0xf +serdes_preemphasis_44=0x46408 +serdes_driver_current_45=0xf +serdes_preemphasis_45=0x46408 +serdes_driver_current_46=0xf +serdes_preemphasis_46=0x373108 +serdes_driver_current_47=0xf +serdes_preemphasis_47=0x373108 +serdes_driver_current_68=0xf +serdes_preemphasis_68=0x373108 +serdes_driver_current_69=0xf +serdes_preemphasis_69=0x373108 +serdes_driver_current_70=0xf +serdes_preemphasis_70=0x46408 +serdes_driver_current_71=0xf +serdes_preemphasis_71=0x46408 +serdes_driver_current_72=0xf +serdes_preemphasis_72=0x46408 +serdes_driver_current_73=0xf +serdes_preemphasis_73=0x46408 +serdes_driver_current_74=0xf +serdes_preemphasis_74=0x46408 +serdes_driver_current_75=0xf +serdes_preemphasis_75=0x46408 +serdes_driver_current_76=0xf +serdes_preemphasis_76=0x46408 +serdes_driver_current_77=0xf +serdes_preemphasis_77=0x46408 +serdes_driver_current_78=0xf +serdes_preemphasis_78=0x46408 +serdes_driver_current_79=0xf +serdes_preemphasis_79=0x46408 +serdes_driver_current_80=0xf +serdes_preemphasis_80=0x46408 +serdes_driver_current_81=0xf +serdes_preemphasis_81=0x46408 +serdes_driver_current_102=0xf +serdes_preemphasis_102=0x46408 +serdes_driver_current_103=0xf +serdes_preemphasis_103=0x46408 +serdes_driver_current_104=0xf +serdes_preemphasis_104=0x46408 +serdes_driver_current_105=0xf +serdes_preemphasis_105=0x46408 +serdes_driver_current_106=0xf +serdes_preemphasis_106=0x46408 +serdes_driver_current_107=0xf +serdes_preemphasis_107=0x46408 +serdes_driver_current_108=0xf +serdes_preemphasis_108=0x46408 +serdes_driver_current_109=0xf +serdes_preemphasis_109=0x46408 +serdes_driver_current_110=0xf +serdes_preemphasis_110=0x46408 +serdes_driver_current_111=0xf +serdes_preemphasis_111=0x46408 +serdes_driver_current_112=0xf +serdes_preemphasis_112=0x46408 +serdes_driver_current_113=0xf +serdes_preemphasis_113=0x46408 +serdes_driver_current_114=0xa +serdes_preemphasis_114=0x284008 +serdes_driver_current_115=0xa +serdes_preemphasis_115=0x284008 + +mmu_init_config="MSFT-TH-Tier0" diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/sai.profile b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/sai.profile index d6fbf6e9c6b1..74aea949c3b7 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/sai.profile +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th2-a7260cx3-64-64x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-a7260cx3-64-64x100G.config.bcm diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/th2-a7260cx3-64-64x100G.config.bcm b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/th2-a7260cx3-64-64x100G.config.bcm new file mode 100644 index 000000000000..1197bca761b6 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/th2-a7260cx3-64-64x100G.config.bcm @@ -0,0 +1,1016 @@ +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:100 +portmap_103=213:100 +portmap_104=229:100 +portmap_105=237:100 +portmap_106=249:100 +portmap_107=245:100 +portmap_108=209:100 +portmap_109=221:100 +portmap_10=29:100 +portmap_110=233:100 +portmap_111=225:100 +portmap_112=241:100 +portmap_113=253:100 +portmap_114=197:100 +portmap_115=205:100 +portmap_116=201:100 +portmap_117=193:100 +portmap_11=41:100 +portmap_12=33:100 +portmap_134=263:10 +portmap_13=57:100 +portmap_14=53:100 +portmap_15=49:100 +portmap_16=61:100 +portmap_1=5:100 +portmap_2=13:100 +portmap_33=260:10 +portmap_34=77:100 +portmap_35=65:100 +portmap_36=85:100 +portmap_37=89:100 +portmap_38=109:100 +portmap_39=97:100 +portmap_3=25:100 +portmap_40=69:100 +portmap_41=73:100 +portmap_42=93:100 +portmap_43=81:100 +portmap_44=101:100 +portmap_45=105:100 +portmap_46=117:100 +portmap_47=121:100 +portmap_48=125:100 +portmap_49=113:100 +portmap_4=21:100 +portmap_5=37:100 +portmap_66=257:10 +portmap_67=261:10 +portmap_68=149:100 +portmap_69=153:100 +portmap_6=45:100 +portmap_70=173:100 +portmap_71=161:100 +portmap_72=181:100 +portmap_73=185:100 +portmap_74=157:100 +portmap_75=145:100 +portmap_76=165:100 +portmap_77=169:100 +portmap_78=189:100 +portmap_79=177:100 +portmap_7=9:100 +portmap_80=141:100 +portmap_81=133:100 +portmap_82=129:100 +portmap_83=137:100 +portmap_8=1:100 +portmap_9=17:100 +robust_hash_disable_egress_vlan=1 +robust_hash_disable_mpls=1 +robust_hash_disable_vlan=1 +scache_filename=/tmp/scache +scache_filename=/tmp/scache +sram_scan_enable=0 +stable_size=0x5500000 +stable_size=0x5500000 +tdma_timeout_usec=15000000 +tslam_timeout_usec=15000000 + +# tuning parameters +serdes_preemphasis_1=0x184606 +serdes_preemphasis_2=0x164108 +serdes_preemphasis_3=0x164308 +serdes_preemphasis_4=0x144108 +serdes_preemphasis_5=0x144108 +serdes_preemphasis_6=0x164106 +serdes_preemphasis_7=0x184507 +serdes_preemphasis_8=0x184606 +serdes_preemphasis_9=0x184507 +serdes_preemphasis_10=0x194407 +serdes_preemphasis_11=0x194407 +serdes_preemphasis_12=0x184507 +serdes_preemphasis_13=0x144108 +serdes_preemphasis_14=0x144108 +serdes_preemphasis_15=0x194407 +serdes_preemphasis_16=0x194407 +serdes_preemphasis_34=0x184408 +serdes_preemphasis_35=0x184606 +serdes_preemphasis_36=0x164308 +serdes_preemphasis_37=0x184606 +serdes_preemphasis_38=0x164108 +serdes_preemphasis_39=0x184606 +serdes_preemphasis_40=0xe3206 +serdes_preemphasis_41=0xe3205 +serdes_preemphasis_42=0x103a06 +serdes_preemphasis_43=0xe3205 +serdes_preemphasis_44=0x184606 +serdes_preemphasis_45=0x184507 +serdes_preemphasis_46=0x144108 +serdes_preemphasis_47=0x103a07 +serdes_preemphasis_48=0x194407 +serdes_preemphasis_49=0x194407 +serdes_preemphasis_66=0x62f01 +serdes_preemphasis_68=0x164308 +serdes_preemphasis_69=0x164408 +serdes_preemphasis_70=0xe3206 +serdes_preemphasis_71=0xe3205 +serdes_preemphasis_72=0xe3205 +serdes_preemphasis_73=0xe3206 +serdes_preemphasis_74=0x164108 +serdes_preemphasis_75=0x184606 +serdes_preemphasis_76=0x164608 +serdes_preemphasis_77=0x184507 +serdes_preemphasis_78=0x184507 +serdes_preemphasis_79=0x184606 +serdes_preemphasis_80=0x184606 +serdes_preemphasis_81=0x184407 +serdes_preemphasis_82=0x103706 +serdes_preemphasis_83=0x103706 +serdes_preemphasis_100=0x62f01 +serdes_preemphasis_102=0x184408 +serdes_preemphasis_103=0x184606 +serdes_preemphasis_104=0x184606 +serdes_preemphasis_105=0x16410a +serdes_preemphasis_106=0x184408 +serdes_preemphasis_107=0x194308 +serdes_preemphasis_108=0x144108 +serdes_preemphasis_109=0x144108 +serdes_preemphasis_110=0x144108 +serdes_preemphasis_111=0x144108 +serdes_preemphasis_112=0x164608 +serdes_preemphasis_113=0x164608 +serdes_preemphasis_114=0x174507 +serdes_preemphasis_115=0x184606 +serdes_preemphasis_116=0x103706 +serdes_preemphasis_117=0x133c06 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile index b8652e10e4d9..4618972dbba9 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-seastone-dx010-96x10G-16x50G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-96x10G-16x50G.config.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/th-seastone-dx010-96x10G-16x50G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/th-seastone-dx010-96x10G-16x50G.config.bcm new file mode 100644 index 000000000000..b62320f7c50b --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/th-seastone-dx010-96x10G-16x50G.config.bcm @@ -0,0 +1,927 @@ +# 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 +l2_mem_entries=8192 +l3_mem_entries=8192 +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +mmu_lossless=0 + +################################################################################### +# Celestica Customize for SeaStone +################################################################################### + +#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 + +#fpem_mem_entries=32768 +oversubscribe_mode=1 +#pbmp_xport_xe=0x3fd000000ff4000003fc000001fe + +dport_map_enable=1 + +dport_map_port_68=1 +dport_map_port_69=2 +dport_map_port_70=3 +dport_map_port_71=4 + +dport_map_port_72=5 +dport_map_port_73=6 +dport_map_port_74=7 +dport_map_port_75=8 + +dport_map_port_76=9 +dport_map_port_77=10 +dport_map_port_78=11 +dport_map_port_79=12 + +dport_map_port_80=13 +dport_map_port_81=14 +dport_map_port_82=15 +dport_map_port_83=16 + +dport_map_port_34=17 +dport_map_port_35=18 +dport_map_port_36=19 +dport_map_port_37=20 + +dport_map_port_38=21 +dport_map_port_39=22 +dport_map_port_40=23 +dport_map_port_41=24 + +dport_map_port_42=25 +dport_map_port_43=26 +dport_map_port_44=27 +dport_map_port_45=28 + +dport_map_port_46=29 +dport_map_port_47=30 +dport_map_port_48=31 +dport_map_port_49=32 + +dport_map_port_50=33 +dport_map_port_51=34 +dport_map_port_52=35 +dport_map_port_53=36 + +dport_map_port_54=37 +dport_map_port_55=38 +dport_map_port_56=39 +dport_map_port_57=40 + +dport_map_port_58=41 +dport_map_port_59=42 +dport_map_port_60=43 +dport_map_port_61=44 + +dport_map_port_62=45 +dport_map_port_63=46 +dport_map_port_64=47 +dport_map_port_65=48 + +dport_map_port_84=49 +dport_map_port_85=50 +dport_map_port_86=51 +dport_map_port_87=52 + +dport_map_port_88=53 +dport_map_port_89=54 +dport_map_port_90=55 +dport_map_port_91=56 + +dport_map_port_92=57 +dport_map_port_93=58 +dport_map_port_94=59 +dport_map_port_95=60 + +dport_map_port_96=61 +dport_map_port_97=62 +dport_map_port_98=63 +dport_map_port_99=64 + +dport_map_port_102=65 +dport_map_port_103=66 +dport_map_port_104=67 +dport_map_port_105=68 + +dport_map_port_106=69 +dport_map_port_107=70 +dport_map_port_108=71 +dport_map_port_109=72 + +dport_map_port_110=73 +dport_map_port_111=74 +dport_map_port_112=75 +dport_map_port_113=76 + +dport_map_port_114=77 +dport_map_port_115=78 +dport_map_port_116=79 +dport_map_port_117=80 + +dport_map_port_1=81 +dport_map_port_2=82 +dport_map_port_3=83 +dport_map_port_4=84 + +dport_map_port_5=85 +dport_map_port_6=86 +dport_map_port_7=87 +dport_map_port_8=88 + +dport_map_port_9=89 +dport_map_port_10=90 +dport_map_port_11=91 +dport_map_port_12=92 + +dport_map_port_13=93 +dport_map_port_14=94 +dport_map_port_15=95 +dport_map_port_16=96 + + +dport_map_port_17=97 +dport_map_port_18=98 + +dport_map_port_21=101 +dport_map_port_22=102 + +dport_map_port_25=105 +dport_map_port_26=106 + +dport_map_port_29=109 +dport_map_port_30=110 + +dport_map_port_118=113 +dport_map_port_119=114 + +dport_map_port_122=117 +dport_map_port_123=118 + +dport_map_port_126=121 +dport_map_port_127=122 + +dport_map_port_130=125 +dport_map_port_131=126 + + +# port mapping +portmap_68=65:10 +portmap_69=66:10 +portmap_70=67:10 +portmap_71=68:10 + +portmap_72=69:10 +portmap_73=70:10 +portmap_74=71:10 +portmap_75=72:10 + +portmap_76=73:10 +portmap_77=74:10 +portmap_78=75:10 +portmap_79=76:10 + +portmap_80=77:10 +portmap_81=78:10 +portmap_82=79:10 +portmap_83=80:10 + +portmap_34=33:10 +portmap_35=34:10 +portmap_36=35:10 +portmap_37=36:10 + +portmap_38=37:10 +portmap_39=38:10 +portmap_40=39:10 +portmap_41=40:10 + +portmap_42=41:10 +portmap_43=42:10 +portmap_44=43:10 +portmap_45=44:10 + +portmap_46=45:10 +portmap_47=46:10 +portmap_48=47:10 +portmap_49=48:10 + +portmap_50=49:10 +portmap_51=50:10 +portmap_52=51:10 +portmap_53=52:10 + +portmap_54=53:10 +portmap_55=54:10 +portmap_56=55:10 +portmap_57=56:10 + +portmap_58=57:10 +portmap_59=58:10 +portmap_60=59:10 +portmap_61=60:10 + +portmap_62=61:10 +portmap_63=62:10 +portmap_64=63:10 +portmap_65=64:10 + +portmap_84=81:10 +portmap_85=82:10 +portmap_86=83:10 +portmap_87=84:10 + +portmap_88=85:10 +portmap_89=86:10 +portmap_90=87:10 +portmap_91=88:10 + +portmap_92=89:10 +portmap_93=90:10 +portmap_94=91:10 +portmap_95=92:10 + +portmap_96=93:10 +portmap_97=94:10 +portmap_98=95:10 +portmap_99=96:10 + +portmap_102=97:10 +portmap_103=98:10 +portmap_104=99:10 +portmap_105=100:10 + +portmap_106=101:10 +portmap_107=102:10 +portmap_108=103:10 +portmap_109=104:10 + +portmap_110=105:10 +portmap_111=106:10 +portmap_112=107:10 +portmap_113=108:10 + +portmap_114=109:10 +portmap_115=110:10 +portmap_116=111:10 +portmap_117=112:10 + +portmap_1=1:10 +portmap_2=2:10 +portmap_3=3:10 +portmap_4=4:10 + +portmap_5=5:10 +portmap_6=6:10 +portmap_7=7:10 +portmap_8=8:10 + +portmap_9=9:10 +portmap_10=10:10 +portmap_11=11:10 +portmap_12=12:10 + +portmap_13=13:10 +portmap_14=14:10 +portmap_15=15:10 +portmap_16=16:10 + + +portmap_17=17:50:2 +portmap_18=19:50:2 + +portmap_21=21:50:2 +portmap_22=23:50:2 + +portmap_25=25:50:2 +portmap_26=27:50:2 + +portmap_29=29:50:2 +portmap_30=31:50:2 + +portmap_118=113:50:2 +portmap_119=115:50:2 + +portmap_122=117:50:2 +portmap_123=119:50:2 + +portmap_126=121:50:2 +portmap_127=123:50:2 + +portmap_130=125:50:2 +portmap_131=127:50:2 + +#portmap_66=129:10 +#portmap_100=131:10 + +#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 +xgxs_tx_lane_map_70=0x3201 +xgxs_rx_lane_map_70=0x2310 +xgxs_tx_lane_map_71=0x3201 +xgxs_rx_lane_map_71=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 +xgxs_tx_lane_map_74=0x3201 +xgxs_rx_lane_map_74=0x2301 +xgxs_tx_lane_map_75=0x3201 +xgxs_rx_lane_map_75=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 +xgxs_tx_lane_map_78=0x0132 +xgxs_rx_lane_map_78=0x0123 +xgxs_tx_lane_map_79=0x0132 +xgxs_rx_lane_map_79=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 +xgxs_tx_lane_map_82=0x2031 +xgxs_rx_lane_map_82=0x1320 +xgxs_tx_lane_map_83=0x2031 +xgxs_rx_lane_map_83=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 +#xgxs_tx_lane_map_36=0x3021 +#xgxs_rx_lane_map_36=0x0213 +#xgxs_tx_lane_map_37=0x3021 +#xgxs_rx_lane_map_37=0x0213 + +xgxs_tx_lane_map_34=0x3021 +xgxs_rx_lane_map_34=0x0213 +xgxs_tx_lane_map_35=0x3021 +xgxs_rx_lane_map_35=0x0213 +xgxs_tx_lane_map_36=0x3021 +xgxs_rx_lane_map_36=0x0213 +xgxs_tx_lane_map_37=0x3021 +xgxs_rx_lane_map_37=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 +xgxs_tx_lane_map_40=0x3210 +xgxs_rx_lane_map_40=0x1023 +xgxs_tx_lane_map_41=0x3210 +xgxs_rx_lane_map_41=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 +xgxs_tx_lane_map_44=0x2310 +xgxs_rx_lane_map_44=0x3210 +xgxs_tx_lane_map_45=0x2310 +xgxs_rx_lane_map_45=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 +xgxs_tx_lane_map_48=0x1032 +xgxs_rx_lane_map_48=0x1302 +xgxs_tx_lane_map_49=0x1032 +xgxs_rx_lane_map_49=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 +xgxs_tx_lane_map_52=0x3201 +xgxs_rx_lane_map_52=0x0213 +xgxs_tx_lane_map_53=0x3201 +xgxs_rx_lane_map_53=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 +xgxs_tx_lane_map_56=0x2301 +xgxs_rx_lane_map_56=0x2310 +xgxs_tx_lane_map_57=0x2301 +xgxs_rx_lane_map_57=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 +xgxs_tx_lane_map_60=0x3201 +xgxs_rx_lane_map_60=0x0213 +xgxs_tx_lane_map_61=0x3201 +xgxs_rx_lane_map_61=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 +xgxs_tx_lane_map_64=0x1302 +xgxs_rx_lane_map_64=0x2310 +xgxs_tx_lane_map_65=0x1302 +xgxs_rx_lane_map_65=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 +xgxs_tx_lane_map_86=0x0213 +xgxs_rx_lane_map_86=0x2301 +xgxs_tx_lane_map_87=0x0213 +xgxs_rx_lane_map_87=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 +xgxs_tx_lane_map_90=0x0132 +xgxs_rx_lane_map_90=0x3210 +xgxs_tx_lane_map_91=0x0132 +xgxs_rx_lane_map_91=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 +xgxs_tx_lane_map_94=0x0132 +xgxs_rx_lane_map_94=0x2031 +xgxs_tx_lane_map_95=0x0132 +xgxs_rx_lane_map_95=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 +xgxs_tx_lane_map_98=0x2031 +xgxs_rx_lane_map_98=0x3201 +xgxs_tx_lane_map_99=0x2031 +xgxs_rx_lane_map_99=0x3201 + +#WC24 +xgxs_tx_lane_map_102=0x0132 +xgxs_rx_lane_map_102=0x2301 +xgxs_tx_lane_map_103=0x0132 +xgxs_rx_lane_map_103=0x2301 +xgxs_tx_lane_map_104=0x0132 +xgxs_rx_lane_map_104=0x2301 +xgxs_tx_lane_map_105=0x0132 +xgxs_rx_lane_map_105=0x2301 + +#WC25 +xgxs_tx_lane_map_106=0x0132 +xgxs_rx_lane_map_106=0x3201 +xgxs_tx_lane_map_107=0x0132 +xgxs_rx_lane_map_107=0x3201 +xgxs_tx_lane_map_108=0x0132 +xgxs_rx_lane_map_108=0x3201 +xgxs_tx_lane_map_109=0x0132 +xgxs_rx_lane_map_109=0x3201 + +#WC26 +xgxs_tx_lane_map_110=0x0132 +xgxs_rx_lane_map_110=0x2031 +xgxs_tx_lane_map_111=0x0132 +xgxs_rx_lane_map_111=0x2031 +xgxs_tx_lane_map_112=0x0132 +xgxs_rx_lane_map_112=0x2031 +xgxs_tx_lane_map_113=0x0132 +xgxs_rx_lane_map_113=0x2031 + +#WC27 +xgxs_tx_lane_map_114=0x2031 +xgxs_rx_lane_map_114=0x2301 +xgxs_tx_lane_map_115=0x2031 +xgxs_rx_lane_map_115=0x2301 +xgxs_tx_lane_map_116=0x2031 +xgxs_rx_lane_map_116=0x2301 +xgxs_tx_lane_map_117=0x2031 +xgxs_rx_lane_map_117=0x2301 + + +#WC0 +xgxs_tx_lane_map_1=0x3210 +xgxs_rx_lane_map_1=0x3120 +xgxs_tx_lane_map_2=0x3210 +xgxs_rx_lane_map_2=0x3120 +xgxs_tx_lane_map_3=0x3210 +xgxs_rx_lane_map_3=0x3120 +xgxs_tx_lane_map_4=0x3210 +xgxs_rx_lane_map_4=0x3120 + +#WC1 +xgxs_tx_lane_map_5=0x0132 +xgxs_rx_lane_map_5=0x1023 +xgxs_tx_lane_map_6=0x0132 +xgxs_rx_lane_map_6=0x1023 +xgxs_tx_lane_map_7=0x0132 +xgxs_rx_lane_map_7=0x1023 +xgxs_tx_lane_map_8=0x0132 +xgxs_rx_lane_map_8=0x1023 + +#WC2 +xgxs_tx_lane_map_9=0x3201 +xgxs_rx_lane_map_9=0x3120 +xgxs_tx_lane_map_10=0x3201 +xgxs_rx_lane_map_10=0x3120 +xgxs_tx_lane_map_11=0x3201 +xgxs_rx_lane_map_11=0x3120 +xgxs_tx_lane_map_12=0x3201 +xgxs_rx_lane_map_12=0x3120 + +#WC3 +xgxs_tx_lane_map_13=0x2031 +xgxs_rx_lane_map_13=0x1032 +xgxs_tx_lane_map_14=0x2031 +xgxs_rx_lane_map_14=0x1032 +xgxs_tx_lane_map_15=0x2031 +xgxs_rx_lane_map_15=0x1032 +xgxs_tx_lane_map_16=0x2031 +xgxs_rx_lane_map_16=0x1032 + +#WC4 +xgxs_tx_lane_map_17=0x2310 +xgxs_rx_lane_map_17=0x3210 +xgxs_tx_lane_map_18=0x2310 +xgxs_rx_lane_map_18=0x3210 + +#WC5 +xgxs_tx_lane_map_21=0x2301 +xgxs_rx_lane_map_21=0x3120 +xgxs_tx_lane_map_22=0x2301 +xgxs_rx_lane_map_22=0x3120 + +#WC6 +xgxs_tx_lane_map_25=0x3201 +xgxs_rx_lane_map_25=0x0213 +xgxs_tx_lane_map_26=0x3201 +xgxs_rx_lane_map_26=0x0213 + +#WC7 +xgxs_tx_lane_map_29=0x1302 +xgxs_rx_lane_map_29=0x1023 +xgxs_tx_lane_map_30=0x1302 +xgxs_rx_lane_map_30=0x1023 + +#WC28 +xgxs_tx_lane_map_118=0x1320 +xgxs_rx_lane_map_118=0x1302 +xgxs_tx_lane_map_119=0x1320 +xgxs_rx_lane_map_119=0x1302 + +#WC29 +xgxs_tx_lane_map_122=0x1032 +xgxs_rx_lane_map_122=0x1023 +xgxs_tx_lane_map_123=0x1032 +xgxs_rx_lane_map_123=0x1023 + +#WC30 +xgxs_tx_lane_map_126=0x3120 +xgxs_rx_lane_map_126=0x3120 +xgxs_tx_lane_map_127=0x3120 +xgxs_rx_lane_map_127=0x3120 + +#WC31 +xgxs_tx_lane_map_130=0x1302 +xgxs_rx_lane_map_130=0x2310 +xgxs_tx_lane_map_131=0x1302 +xgxs_rx_lane_map_131=0x2310 + + + + +#PN + +#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 +phy_xaui_tx_polarity_flip_70=0x0000 +phy_xaui_rx_polarity_flip_70=0x0000 +phy_xaui_tx_polarity_flip_71=0x0000 +phy_xaui_rx_polarity_flip_71=0x0000 + +#WC17 +phy_xaui_tx_polarity_flip_72=0x0001 +phy_xaui_rx_polarity_flip_72=0x0000 +phy_xaui_tx_polarity_flip_73=0x0000 +phy_xaui_rx_polarity_flip_73=0x0001 +phy_xaui_tx_polarity_flip_74=0x0001 +phy_xaui_rx_polarity_flip_74=0x0000 +phy_xaui_tx_polarity_flip_75=0x0001 +phy_xaui_rx_polarity_flip_75=0x0000 + +#WC18 +phy_xaui_tx_polarity_flip_76=0x0001 +phy_xaui_rx_polarity_flip_76=0x0000 +phy_xaui_tx_polarity_flip_77=0x0001 +phy_xaui_rx_polarity_flip_77=0x0000 +phy_xaui_tx_polarity_flip_78=0x0001 +phy_xaui_rx_polarity_flip_78=0x0000 +phy_xaui_tx_polarity_flip_79=0x0001 +phy_xaui_rx_polarity_flip_79=0x0000 + +#WC19 +phy_xaui_tx_polarity_flip_80=0x0001 +phy_xaui_rx_polarity_flip_80=0x0001 +phy_xaui_tx_polarity_flip_81=0x0001 +phy_xaui_rx_polarity_flip_81=0x0001 +phy_xaui_tx_polarity_flip_82=0x0001 +phy_xaui_rx_polarity_flip_82=0x0001 +phy_xaui_tx_polarity_flip_83=0x0001 +phy_xaui_rx_polarity_flip_83=0x0001 + +#WC8 +phy_xaui_tx_polarity_flip_34=0x0000 +phy_xaui_rx_polarity_flip_34=0x0000 +phy_xaui_tx_polarity_flip_35=0x0001 +phy_xaui_rx_polarity_flip_35=0x0000 +phy_xaui_tx_polarity_flip_36=0x0001 +phy_xaui_rx_polarity_flip_36=0x0000 +phy_xaui_tx_polarity_flip_37=0x0001 +phy_xaui_rx_polarity_flip_37=0x0000 + +#WC9 +phy_xaui_tx_polarity_flip_38=0x0000 +phy_xaui_rx_polarity_flip_38=0x0000 +phy_xaui_tx_polarity_flip_39=0x0000 +phy_xaui_rx_polarity_flip_39=0x0000 +phy_xaui_tx_polarity_flip_40=0x0000 +phy_xaui_rx_polarity_flip_40=0x0000 +phy_xaui_tx_polarity_flip_41=0x0001 +phy_xaui_rx_polarity_flip_41=0x0000 + +#WC10 +phy_xaui_tx_polarity_flip_42=0x0001 +phy_xaui_rx_polarity_flip_42=0x0000 +phy_xaui_tx_polarity_flip_43=0x0000 +phy_xaui_rx_polarity_flip_43=0x0000 +phy_xaui_tx_polarity_flip_44=0x0001 +phy_xaui_rx_polarity_flip_44=0x0000 +phy_xaui_tx_polarity_flip_45=0x0001 +phy_xaui_rx_polarity_flip_45=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 +phy_xaui_tx_polarity_flip_48=0x0000 +phy_xaui_rx_polarity_flip_48=0x0000 +phy_xaui_tx_polarity_flip_49=0x0000 +phy_xaui_rx_polarity_flip_49=0x0000 + +#WC12 +phy_xaui_tx_polarity_flip_50=0x0000 +phy_xaui_rx_polarity_flip_50=0x0000 +phy_xaui_tx_polarity_flip_51=0x0001 +phy_xaui_rx_polarity_flip_51=0x0000 +phy_xaui_tx_polarity_flip_52=0x0000 +phy_xaui_rx_polarity_flip_52=0x0000 +phy_xaui_tx_polarity_flip_53=0x0000 +phy_xaui_rx_polarity_flip_53=0x0000 + +#WC13 +phy_xaui_tx_polarity_flip_54=0x0000 +phy_xaui_rx_polarity_flip_54=0x0000 +phy_xaui_tx_polarity_flip_55=0x0001 +phy_xaui_rx_polarity_flip_55=0x0000 +phy_xaui_tx_polarity_flip_56=0x0000 +phy_xaui_rx_polarity_flip_56=0x0000 +phy_xaui_tx_polarity_flip_57=0x0000 +phy_xaui_rx_polarity_flip_57=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 +phy_xaui_tx_polarity_flip_60=0x0000 +phy_xaui_rx_polarity_flip_60=0x0000 +phy_xaui_tx_polarity_flip_61=0x0000 +phy_xaui_rx_polarity_flip_61=0x0000 + +#WC15 +phy_xaui_tx_polarity_flip_62=0x0000 +phy_xaui_rx_polarity_flip_62=0x0001 +phy_xaui_tx_polarity_flip_63=0x0001 +phy_xaui_rx_polarity_flip_63=0x0001 +phy_xaui_tx_polarity_flip_64=0x0000 +phy_xaui_rx_polarity_flip_64=0x0001 +phy_xaui_tx_polarity_flip_65=0x0001 +phy_xaui_rx_polarity_flip_65=0x0001 + +#WC20 +phy_xaui_tx_polarity_flip_84=0x0001 +phy_xaui_rx_polarity_flip_84=0x0000 +phy_xaui_tx_polarity_flip_85=0x0001 +phy_xaui_rx_polarity_flip_85=0x0001 +phy_xaui_tx_polarity_flip_86=0x0001 +phy_xaui_rx_polarity_flip_86=0x0001 +phy_xaui_tx_polarity_flip_87=0x0000 +phy_xaui_rx_polarity_flip_87=0x0001 + +#WC21 +phy_xaui_tx_polarity_flip_88=0x0001 +phy_xaui_rx_polarity_flip_88=0x0001 +phy_xaui_tx_polarity_flip_89=0x0000 +phy_xaui_rx_polarity_flip_89=0x0000 +phy_xaui_tx_polarity_flip_90=0x0001 +phy_xaui_rx_polarity_flip_90=0x0001 +phy_xaui_tx_polarity_flip_91=0x0001 +phy_xaui_rx_polarity_flip_91=0x0001 + +#WC22 +phy_xaui_tx_polarity_flip_92=0x0001 +phy_xaui_rx_polarity_flip_92=0x0000 +phy_xaui_tx_polarity_flip_93=0x0001 +phy_xaui_rx_polarity_flip_93=0x0000 +phy_xaui_tx_polarity_flip_94=0x0001 +phy_xaui_rx_polarity_flip_94=0x0000 +phy_xaui_tx_polarity_flip_95=0x0001 +phy_xaui_rx_polarity_flip_95=0x0001 + +#WC23 +phy_xaui_tx_polarity_flip_96=0x0001 +phy_xaui_rx_polarity_flip_96=0x0000 +phy_xaui_tx_polarity_flip_97=0x0000 +phy_xaui_rx_polarity_flip_97=0x0000 +phy_xaui_tx_polarity_flip_98=0x0001 +phy_xaui_rx_polarity_flip_98=0x0000 +phy_xaui_tx_polarity_flip_99=0x0000 +phy_xaui_rx_polarity_flip_99=0x0000 + +#WC24 +phy_xaui_tx_polarity_flip_102=0x0000 +phy_xaui_rx_polarity_flip_102=0x0001 +phy_xaui_tx_polarity_flip_103=0x0000 +phy_xaui_rx_polarity_flip_103=0x0001 +phy_xaui_tx_polarity_flip_104=0x0000 +phy_xaui_rx_polarity_flip_104=0x0001 +phy_xaui_tx_polarity_flip_105=0x0000 +phy_xaui_rx_polarity_flip_105=0x0001 + +#WC25 +phy_xaui_tx_polarity_flip_106=0x0001 +phy_xaui_rx_polarity_flip_106=0x0000 +phy_xaui_tx_polarity_flip_107=0x0001 +phy_xaui_rx_polarity_flip_107=0x0000 +phy_xaui_tx_polarity_flip_108=0x0001 +phy_xaui_rx_polarity_flip_108=0x0000 +phy_xaui_tx_polarity_flip_109=0x0001 +phy_xaui_rx_polarity_flip_109=0x0000 + +#WC26 +phy_xaui_tx_polarity_flip_110=0x0001 +phy_xaui_rx_polarity_flip_110=0x0001 +phy_xaui_tx_polarity_flip_111=0x0001 +phy_xaui_rx_polarity_flip_111=0x0001 +phy_xaui_tx_polarity_flip_112=0x0001 +phy_xaui_rx_polarity_flip_112=0x0001 +phy_xaui_tx_polarity_flip_113=0x0001 +phy_xaui_rx_polarity_flip_113=0x0001 + +#WC27 +phy_xaui_tx_polarity_flip_114=0x0001 +phy_xaui_rx_polarity_flip_114=0x0001 +phy_xaui_tx_polarity_flip_115=0x0001 +phy_xaui_rx_polarity_flip_115=0x0001 +phy_xaui_tx_polarity_flip_116=0x0001 +phy_xaui_rx_polarity_flip_116=0x0001 +phy_xaui_tx_polarity_flip_117=0x0001 +phy_xaui_rx_polarity_flip_117=0x0000 + +#WC0 +phy_xaui_tx_polarity_flip_1=0x0001 +phy_xaui_rx_polarity_flip_1=0x0001 +phy_xaui_tx_polarity_flip_2=0x0001 +phy_xaui_rx_polarity_flip_2=0x0001 +phy_xaui_tx_polarity_flip_3=0x0000 +phy_xaui_rx_polarity_flip_3=0x0001 +phy_xaui_tx_polarity_flip_4=0x0000 +phy_xaui_rx_polarity_flip_4=0x0001 + +#WC1 +phy_xaui_tx_polarity_flip_5=0x0001 +phy_xaui_rx_polarity_flip_5=0x0000 +phy_xaui_tx_polarity_flip_6=0x0001 +phy_xaui_rx_polarity_flip_6=0x0000 +phy_xaui_tx_polarity_flip_7=0x0001 +phy_xaui_rx_polarity_flip_7=0x0000 +phy_xaui_tx_polarity_flip_8=0x0000 +phy_xaui_rx_polarity_flip_8=0x0000 + +#WC2 +phy_xaui_tx_polarity_flip_9=0x0000 +phy_xaui_rx_polarity_flip_9=0x0000 +phy_xaui_tx_polarity_flip_10=0x0001 +phy_xaui_rx_polarity_flip_10=0x0000 +phy_xaui_tx_polarity_flip_11=0x0000 +phy_xaui_rx_polarity_flip_11=0x0000 +phy_xaui_tx_polarity_flip_12=0x0000 +phy_xaui_rx_polarity_flip_12=0x0001 + +#WC3 +phy_xaui_tx_polarity_flip_13=0x0001 +phy_xaui_rx_polarity_flip_13=0x0000 +phy_xaui_tx_polarity_flip_14=0x0001 +phy_xaui_rx_polarity_flip_14=0x0000 +phy_xaui_tx_polarity_flip_15=0x0001 +phy_xaui_rx_polarity_flip_15=0x0000 +phy_xaui_tx_polarity_flip_16=0x0001 +phy_xaui_rx_polarity_flip_16=0x0000 + +#WC4 +phy_xaui_tx_polarity_flip_17=0x0003 +phy_xaui_rx_polarity_flip_17=0x0000 +phy_xaui_tx_polarity_flip_18=0x0001 +phy_xaui_rx_polarity_flip_18=0x0000 + +#WC5 +phy_xaui_tx_polarity_flip_21=0x0000 +phy_xaui_rx_polarity_flip_21=0x0000 +phy_xaui_tx_polarity_flip_22=0x0000 +phy_xaui_rx_polarity_flip_22=0x0000 + +#WC6 +phy_xaui_tx_polarity_flip_25=0x0002 +phy_xaui_rx_polarity_flip_25=0x0001 +phy_xaui_tx_polarity_flip_26=0x0000 +phy_xaui_rx_polarity_flip_26=0x0001 + +#WC7 +phy_xaui_tx_polarity_flip_29=0x0002 +phy_xaui_rx_polarity_flip_29=0x0000 +phy_xaui_tx_polarity_flip_30=0x0000 +phy_xaui_rx_polarity_flip_30=0x0000 + +#WC28 +phy_xaui_tx_polarity_flip_118=0x0003 +phy_xaui_rx_polarity_flip_118=0x0003 +phy_xaui_tx_polarity_flip_119=0x0003 +phy_xaui_rx_polarity_flip_119=0x0003 + +#WC29 +phy_xaui_tx_polarity_flip_122=0x0000 +phy_xaui_rx_polarity_flip_122=0x0000 +phy_xaui_tx_polarity_flip_123=0x0001 +phy_xaui_rx_polarity_flip_123=0x0000 + +#WC30 +phy_xaui_tx_polarity_flip_126=0x0003 +phy_xaui_rx_polarity_flip_126=0x0000 +phy_xaui_tx_polarity_flip_127=0x0003 +phy_xaui_rx_polarity_flip_127=0x0000 + +#WC31 +phy_xaui_tx_polarity_flip_130=0x0002 +phy_xaui_rx_polarity_flip_130=0x0000 +phy_xaui_tx_polarity_flip_131=0x0001 +phy_xaui_rx_polarity_flip_131=0x0000 + diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile index ced857611967..075fdfde2229 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-seastone-dx010-64x50G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-64x50G.config.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/th-seastone-dx010-64x50G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/th-seastone-dx010-64x50G.config.bcm new file mode 100644 index 000000000000..07814e52ac4a --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/th-seastone-dx010-64x50G.config.bcm @@ -0,0 +1,621 @@ +# 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 +l2_mem_entries=8192 +l3_mem_entries=8192 +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +mmu_lossless=0 + +################################################################################### +# Celestica Customize for SeaStone +################################################################################### + +#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 + +#fpem_mem_entries=32768 +oversubscribe_mode=1 +#pbmp_xport_xe=0x3fd000000ff4000003fc000001fe + +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 + +dport_map_port_102=65 +dport_map_port_103=66 + +dport_map_port_106=69 +dport_map_port_107=70 + +dport_map_port_110=73 +dport_map_port_111=74 + +dport_map_port_114=77 +dport_map_port_115=78 + +dport_map_port_1=81 +dport_map_port_2=82 + +dport_map_port_5=85 +dport_map_port_6=86 + +dport_map_port_9=89 +dport_map_port_10=90 + +dport_map_port_13=93 +dport_map_port_14=94 + +dport_map_port_17=97 +dport_map_port_18=98 + +dport_map_port_21=101 +dport_map_port_22=102 + +dport_map_port_25=105 +dport_map_port_26=106 + +dport_map_port_29=109 +dport_map_port_30=110 + +dport_map_port_118=113 +dport_map_port_119=114 + +dport_map_port_122=117 +dport_map_port_123=118 + +dport_map_port_126=121 +dport_map_port_127=122 + +dport_map_port_130=125 +dport_map_port_131=126 + + +# port mapping +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:50:2 +portmap_103=99:50:2 + +portmap_106=101:50:2 +portmap_107=103:50:2 + +portmap_110=105:50:2 +portmap_111=107:50:2 + +portmap_114=109:50:2 +portmap_115=111:50:2 + +portmap_1=1:50:2 +portmap_2=3:50:2 + +portmap_5=5:50:2 +portmap_6=7:50:2 + +portmap_9=9:50:2 +portmap_10=11:50:2 + +portmap_13=13:50:2 +portmap_14=15:50:2 + +portmap_17=17:50:2 +portmap_18=19:50:2 + +portmap_21=21:50:2 +portmap_22=23:50:2 + +portmap_25=25:50:2 +portmap_26=27:50:2 + +portmap_29=29:50:2 +portmap_30=31:50:2 + +portmap_118=113:50:2 +portmap_119=115:50:2 + +portmap_122=117:50:2 +portmap_123=119:50:2 + +portmap_126=121:50:2 +portmap_127=123:50:2 + +portmap_130=125:50:2 +portmap_131=127:50:2 + + +#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 +xgxs_tx_lane_map_103=0x0132 +xgxs_rx_lane_map_103=0x2301 + +#WC25 +xgxs_tx_lane_map_106=0x0132 +xgxs_rx_lane_map_106=0x3201 +xgxs_tx_lane_map_107=0x0132 +xgxs_rx_lane_map_107=0x3201 + +#WC26 +xgxs_tx_lane_map_110=0x0132 +xgxs_rx_lane_map_110=0x2031 +xgxs_tx_lane_map_111=0x0132 +xgxs_rx_lane_map_111=0x2031 + +#WC27 +xgxs_tx_lane_map_114=0x2031 +xgxs_rx_lane_map_114=0x2301 +xgxs_tx_lane_map_115=0x2031 +xgxs_rx_lane_map_115=0x2301 + + +#WC0 +xgxs_tx_lane_map_1=0x3210 +xgxs_rx_lane_map_1=0x3120 +xgxs_tx_lane_map_2=0x3210 +xgxs_rx_lane_map_2=0x3120 + +#WC1 +xgxs_tx_lane_map_5=0x0132 +xgxs_rx_lane_map_5=0x1023 +xgxs_tx_lane_map_6=0x0132 +xgxs_rx_lane_map_6=0x1023 + +#WC2 +xgxs_tx_lane_map_9=0x3201 +xgxs_rx_lane_map_9=0x3120 +xgxs_tx_lane_map_10=0x3201 +xgxs_rx_lane_map_10=0x3120 + +#WC3 +xgxs_tx_lane_map_13=0x2031 +xgxs_rx_lane_map_13=0x1032 +xgxs_tx_lane_map_14=0x2031 +xgxs_rx_lane_map_14=0x1032 + +#WC4 +xgxs_tx_lane_map_17=0x2310 +xgxs_rx_lane_map_17=0x3210 +xgxs_tx_lane_map_18=0x2310 +xgxs_rx_lane_map_18=0x3210 + +#WC5 +xgxs_tx_lane_map_21=0x2301 +xgxs_rx_lane_map_21=0x3120 +xgxs_tx_lane_map_22=0x2301 +xgxs_rx_lane_map_22=0x3120 + +#WC6 +xgxs_tx_lane_map_25=0x3201 +xgxs_rx_lane_map_25=0x0213 +xgxs_tx_lane_map_26=0x3201 +xgxs_rx_lane_map_26=0x0213 + +#WC7 +xgxs_tx_lane_map_29=0x1302 +xgxs_rx_lane_map_29=0x1023 +xgxs_tx_lane_map_30=0x1302 +xgxs_rx_lane_map_30=0x1023 + +#WC28 +xgxs_tx_lane_map_118=0x1320 +xgxs_rx_lane_map_118=0x1302 +xgxs_tx_lane_map_119=0x1320 +xgxs_rx_lane_map_119=0x1302 + +#WC29 +xgxs_tx_lane_map_122=0x1032 +xgxs_rx_lane_map_122=0x1023 +xgxs_tx_lane_map_123=0x1032 +xgxs_rx_lane_map_123=0x1023 + +#WC30 +xgxs_tx_lane_map_126=0x3120 +xgxs_rx_lane_map_126=0x3120 +xgxs_tx_lane_map_127=0x3120 +xgxs_rx_lane_map_127=0x3120 + +#WC31 +xgxs_tx_lane_map_130=0x1302 +xgxs_rx_lane_map_130=0x2310 +xgxs_tx_lane_map_131=0x1302 +xgxs_rx_lane_map_131=0x2310 + +#PN + +#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=0x0003 +phy_xaui_tx_polarity_flip_103=0x0000 +phy_xaui_rx_polarity_flip_103=0x0003 + +#WC25 +phy_xaui_tx_polarity_flip_106=0x0003 +phy_xaui_rx_polarity_flip_106=0x0000 +phy_xaui_tx_polarity_flip_107=0x0003 +phy_xaui_rx_polarity_flip_107=0x0000 + +#WC26 +phy_xaui_tx_polarity_flip_110=0x0003 +phy_xaui_rx_polarity_flip_110=0x0003 +phy_xaui_tx_polarity_flip_111=0x0003 +phy_xaui_rx_polarity_flip_111=0x0003 + +#WC27 +phy_xaui_tx_polarity_flip_114=0x0003 +phy_xaui_rx_polarity_flip_114=0x0003 +phy_xaui_tx_polarity_flip_115=0x0003 +phy_xaui_rx_polarity_flip_115=0x0001 + +#WC0 +phy_xaui_tx_polarity_flip_1=0x0003 +phy_xaui_rx_polarity_flip_1=0x0003 +phy_xaui_tx_polarity_flip_2=0x0000 +phy_xaui_rx_polarity_flip_2=0x0003 + +#WC1 +phy_xaui_tx_polarity_flip_5=0x0003 +phy_xaui_rx_polarity_flip_5=0x0000 +phy_xaui_tx_polarity_flip_6=0x0001 +phy_xaui_rx_polarity_flip_6=0x0000 + +#WC2 +phy_xaui_tx_polarity_flip_9=0x0002 +phy_xaui_rx_polarity_flip_9=0x0000 +phy_xaui_tx_polarity_flip_10=0x0000 +phy_xaui_rx_polarity_flip_10=0x0002 + +#WC3 +phy_xaui_tx_polarity_flip_13=0x0003 +phy_xaui_rx_polarity_flip_13=0x0000 +phy_xaui_tx_polarity_flip_14=0x0003 +phy_xaui_rx_polarity_flip_14=0x0000 + +#WC4 +phy_xaui_tx_polarity_flip_17=0x0003 +phy_xaui_rx_polarity_flip_17=0x0000 +phy_xaui_tx_polarity_flip_18=0x0001 +phy_xaui_rx_polarity_flip_18=0x0000 + +#WC5 +phy_xaui_tx_polarity_flip_21=0x0000 +phy_xaui_rx_polarity_flip_21=0x0000 +phy_xaui_tx_polarity_flip_22=0x0000 +phy_xaui_rx_polarity_flip_22=0x0000 + +#WC6 +phy_xaui_tx_polarity_flip_25=0x0002 +phy_xaui_rx_polarity_flip_25=0x0001 +phy_xaui_tx_polarity_flip_26=0x0000 +phy_xaui_rx_polarity_flip_26=0x0001 + +#WC7 +phy_xaui_tx_polarity_flip_29=0x0002 +phy_xaui_rx_polarity_flip_29=0x0000 +phy_xaui_tx_polarity_flip_30=0x0000 +phy_xaui_rx_polarity_flip_30=0x0000 + +#WC28 +phy_xaui_tx_polarity_flip_118=0x0003 +phy_xaui_rx_polarity_flip_118=0x0003 +phy_xaui_tx_polarity_flip_119=0x0003 +phy_xaui_rx_polarity_flip_119=0x0003 + +#WC29 +phy_xaui_tx_polarity_flip_122=0x0000 +phy_xaui_rx_polarity_flip_122=0x0000 +phy_xaui_tx_polarity_flip_123=0x0001 +phy_xaui_rx_polarity_flip_123=0x0000 + +#WC30 +phy_xaui_tx_polarity_flip_126=0x0003 +phy_xaui_rx_polarity_flip_126=0x0000 +phy_xaui_tx_polarity_flip_127=0x0003 +phy_xaui_rx_polarity_flip_127=0x0000 + +#WC31 +phy_xaui_tx_polarity_flip_130=0x0002 +phy_xaui_rx_polarity_flip_130=0x0000 +phy_xaui_tx_polarity_flip_131=0x0001 +phy_xaui_rx_polarity_flip_131=0x0000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile index 8db218c89a52..072467af3e9a 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-seastone-dx010-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-32x100G.config.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/th-seastone-dx010-32x100G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/th-seastone-dx010-32x100G.config.bcm new file mode 100644 index 000000000000..c8f3523189e3 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/th-seastone-dx010-32x100G.config.bcm @@ -0,0 +1,374 @@ +# 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 +l2_mem_entries=8192 +l3_mem_entries=8192 +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +mmu_lossless=0 + +################################################################################### +# Celestica Customize for SeaStone +################################################################################### + +#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 + +#fpem_mem_entries=32768 +oversubscribe_mode=1 +#pbmp_xport_xe=0x3fd000000ff4000003fc000001fe + + +dport_map_enable=1 + +dport_map_port_68=1 +dport_map_port_72=5 +dport_map_port_76=9 +dport_map_port_80=13 +dport_map_port_34=17 +dport_map_port_38=21 +dport_map_port_42=25 +dport_map_port_46=29 +dport_map_port_50=33 +dport_map_port_54=37 +dport_map_port_58=41 +dport_map_port_62=45 +dport_map_port_84=49 +dport_map_port_88=53 +dport_map_port_92=57 +dport_map_port_96=61 +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 mapping +portmap_68=65:100:4 +portmap_72=69:100:4 +portmap_76=73:100:4 +portmap_80=77:100:4 +portmap_34=33:100:4 +portmap_38=37:100:4 +portmap_42=41:100:4 +portmap_46=45:100:4 +portmap_50=49:100:4 +portmap_54=53:100:4 +portmap_58=57:100:4 +portmap_62=61:100:4 +portmap_84=81:100:4 +portmap_88=85:100:4 +portmap_92=89:100:4 +portmap_96=93:100:4 +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 +#portmap_66=129:10 +#portmap_100=131:10 + +#WC16 +xgxs_tx_lane_map_68=0x3201 +xgxs_rx_lane_map_68=0x2310 + + +#WC17 +xgxs_tx_lane_map_72=0x3201 +xgxs_rx_lane_map_72=0x2301 + +#WC18 +xgxs_tx_lane_map_76=0x0132 +xgxs_rx_lane_map_76=0x0123 + +#WC19 +xgxs_tx_lane_map_80=0x2031 +xgxs_rx_lane_map_80=0x1320 + +#WC8 +xgxs_tx_lane_map_34=0x3021 +xgxs_rx_lane_map_34=0x0213 + +#WC9 +xgxs_tx_lane_map_38=0x3210 +xgxs_rx_lane_map_38=0x1023 + +#WC10 +xgxs_tx_lane_map_42=0x2310 +xgxs_rx_lane_map_42=0x3210 + +#WC11 +xgxs_tx_lane_map_46=0x1032 +xgxs_rx_lane_map_46=0x1302 + +#WC12 +xgxs_tx_lane_map_50=0x3201 +xgxs_rx_lane_map_50=0x0213 + + +#WC13 +xgxs_tx_lane_map_54=0x2301 +xgxs_rx_lane_map_54=0x2310 + +#WC14 +xgxs_tx_lane_map_58=0x3201 +xgxs_rx_lane_map_58=0x0213 + +#WC15 +xgxs_tx_lane_map_62=0x1302 +xgxs_rx_lane_map_62=0x2310 + +#WC20 +xgxs_tx_lane_map_84=0x0213 +xgxs_rx_lane_map_84=0x2301 + +#WC21 +xgxs_tx_lane_map_88=0x0132 +xgxs_rx_lane_map_88=0x3210 + +#WC22 +xgxs_tx_lane_map_92=0x0132 +xgxs_rx_lane_map_92=0x2031 + +#WC23 +xgxs_tx_lane_map_96=0x2031 +xgxs_rx_lane_map_96=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 + +#PN + +#WC16 +phy_xaui_tx_polarity_flip_68=0x0000 +phy_xaui_rx_polarity_flip_68=0x0000 + +#WC17 +phy_xaui_tx_polarity_flip_72=0x000D +phy_xaui_rx_polarity_flip_72=0x0002 + + +#WC18 +phy_xaui_tx_polarity_flip_76=0x000F +phy_xaui_rx_polarity_flip_76=0x0000 + +#WC19 +phy_xaui_tx_polarity_flip_80=0x000F +phy_xaui_rx_polarity_flip_80=0x000F + + +#WC8 +phy_xaui_tx_polarity_flip_34=0x000E +phy_xaui_rx_polarity_flip_34=0x0000 + +#WC9 +phy_xaui_tx_polarity_flip_38=0x0008 +phy_xaui_rx_polarity_flip_38=0x0000 + +#WC10 +phy_xaui_tx_polarity_flip_42=0x000D +phy_xaui_rx_polarity_flip_42=0x0000 + +#WC11 +phy_xaui_tx_polarity_flip_46=0x0000 +phy_xaui_rx_polarity_flip_46=0x0000 + + +#WC12 +phy_xaui_tx_polarity_flip_50=0x0002 +phy_xaui_rx_polarity_flip_50=0x0000 + +#WC13 +phy_xaui_tx_polarity_flip_54=0x0002 +phy_xaui_rx_polarity_flip_54=0x0000 + +#WC14 +phy_xaui_tx_polarity_flip_58=0x0000 +phy_xaui_rx_polarity_flip_58=0x0000 + +#WC15 +phy_xaui_tx_polarity_flip_62=0x000A +phy_xaui_rx_polarity_flip_62=0x000F + + +#WC20 + phy_xaui_tx_polarity_flip_84=0x0007 + phy_xaui_rx_polarity_flip_84=0x000E + +#WC21 +phy_xaui_tx_polarity_flip_88=0x000D +phy_xaui_rx_polarity_flip_88=0x000D + +#WC22 +phy_xaui_tx_polarity_flip_92=0x000F +phy_xaui_rx_polarity_flip_92=0x0008 + +#WC23 +phy_xaui_tx_polarity_flip_96=0x0005 +phy_xaui_rx_polarity_flip_96=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/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile index 7ee11c46566e..52e2e289af60 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/sai.profile @@ -1,2 +1,2 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/td2-s6000-32x40G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-s6000-32x40G.config.bcm SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm new file mode 100644 index 000000000000..9ab9c29a32bc --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm @@ -0,0 +1,647 @@ +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# +bcm_num_cos=8 +bcm_stat_interval=2000000 +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +scache_filename=/tmp/scache +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +pbmp_oversubscribe=0x000007fffffffffffffffffffffffffe +pbmp_xport_xe=0x000007fffffffffffffffffffffffffe + +# Ports configuration +# xe0 (40G) +portmap_1=29:40 +xgxs_rx_lane_map_1=0x213 +xgxs_tx_lane_map_1=0x213 +phy_xaui_rx_polarity_flip_1=0xc +phy_xaui_tx_polarity_flip_1=0x9 +serdes_driver_current_lane0_xe0=0x6 +serdes_driver_current_lane1_xe0=0x7 +serdes_driver_current_lane2_xe0=0x6 +serdes_driver_current_lane3_xe0=0x6 +serdes_pre_driver_current_lane0_xe0=0x6 +serdes_pre_driver_current_lane1_xe0=0x7 +serdes_pre_driver_current_lane2_xe0=0x6 +serdes_pre_driver_current_lane3_xe0=0x6 +serdes_preemphasis_lane0_xe0=0xc2f0 +serdes_preemphasis_lane1_xe0=0xd2b0 +serdes_preemphasis_lane2_xe0=0xc6e0 +serdes_preemphasis_lane3_xe0=0xc2f0 + +# xe1 (40G) +portmap_2=25:40 +xgxs_rx_lane_map_2=0x213 +xgxs_tx_lane_map_2=0x2031 +phy_xaui_rx_polarity_flip_2=0xe +phy_xaui_tx_polarity_flip_2=0x2 +serdes_driver_current_lane0_xe1=0x5 +serdes_driver_current_lane1_xe1=0x5 +serdes_driver_current_lane2_xe1=0x5 +serdes_driver_current_lane3_xe1=0x5 +serdes_pre_driver_current_lane0_xe1=0x5 +serdes_pre_driver_current_lane1_xe1=0x5 +serdes_pre_driver_current_lane2_xe1=0x5 +serdes_pre_driver_current_lane3_xe1=0x5 +serdes_preemphasis_lane0_xe1=0xcad0 +serdes_preemphasis_lane1_xe1=0xc6e0 +serdes_preemphasis_lane2_xe1=0xc6e0 +serdes_preemphasis_lane3_xe1=0xd2b0 + +# xe2 (40G) +portmap_3=37:40 +xgxs_rx_lane_map_3=0x213 +xgxs_tx_lane_map_3=0x1203 +phy_xaui_rx_polarity_flip_3=0x3 +phy_xaui_tx_polarity_flip_3=0xe +serdes_driver_current_lane0_xe2=0x4 +serdes_driver_current_lane1_xe2=0x4 +serdes_driver_current_lane2_xe2=0x4 +serdes_driver_current_lane3_xe2=0x4 +serdes_pre_driver_current_lane0_xe2=0x4 +serdes_pre_driver_current_lane1_xe2=0x4 +serdes_pre_driver_current_lane2_xe2=0x4 +serdes_pre_driver_current_lane3_xe2=0x4 +serdes_preemphasis_lane0_xe2=0xcad0 +serdes_preemphasis_lane1_xe2=0xcad0 +serdes_preemphasis_lane2_xe2=0xc2f0 +serdes_preemphasis_lane3_xe2=0xc2f0 + +# xe3 (40G) +portmap_4=33:40 +xgxs_rx_lane_map_4=0x213 +xgxs_tx_lane_map_4=0x132 +phy_xaui_rx_polarity_flip_4=0xe +phy_xaui_tx_polarity_flip_4=0x2 +serdes_driver_current_lane0_xe3=0x4 +serdes_driver_current_lane1_xe3=0x4 +serdes_driver_current_lane2_xe3=0x4 +serdes_driver_current_lane3_xe3=0x4 +serdes_pre_driver_current_lane0_xe3=0x4 +serdes_pre_driver_current_lane1_xe3=0x4 +serdes_pre_driver_current_lane2_xe3=0x4 +serdes_pre_driver_current_lane3_xe3=0x4 +serdes_preemphasis_lane0_xe3=0xc6e0 +serdes_preemphasis_lane1_xe3=0xc6e0 +serdes_preemphasis_lane2_xe3=0xc6e0 +serdes_preemphasis_lane3_xe3=0xc6e0 + +# xe4 (40G) +portmap_5=41:40 +xgxs_rx_lane_map_5=0x213 +xgxs_tx_lane_map_5=0x3021 +phy_xaui_rx_polarity_flip_5=0x3 +phy_xaui_tx_polarity_flip_5=0xb +serdes_driver_current_lane0_xe4=0x4 +serdes_driver_current_lane1_xe4=0x4 +serdes_driver_current_lane2_xe4=0x4 +serdes_driver_current_lane3_xe4=0x4 +serdes_pre_driver_current_lane0_xe4=0x4 +serdes_pre_driver_current_lane1_xe4=0x4 +serdes_pre_driver_current_lane2_xe4=0x4 +serdes_pre_driver_current_lane3_xe4=0x4 +serdes_preemphasis_lane0_xe4=0xc6e0 +serdes_preemphasis_lane1_xe4=0xc2f0 +serdes_preemphasis_lane2_xe4=0xc2f0 +serdes_preemphasis_lane3_xe4=0xcad0 + +# xe5 (40G) +portmap_6=45:40 +xgxs_rx_lane_map_6=0x213 +xgxs_tx_lane_map_6=0x213 +phy_xaui_rx_polarity_flip_6=0xe +phy_xaui_tx_polarity_flip_6=0x8 +serdes_driver_current_lane0_xe5=0x4 +serdes_driver_current_lane1_xe5=0x4 +serdes_driver_current_lane2_xe5=0x4 +serdes_driver_current_lane3_xe5=0x4 +serdes_pre_driver_current_lane0_xe5=0x4 +serdes_pre_driver_current_lane1_xe5=0x4 +serdes_pre_driver_current_lane2_xe5=0x4 +serdes_pre_driver_current_lane3_xe5=0x4 +serdes_preemphasis_lane0_xe5=0xc2f0 +serdes_preemphasis_lane1_xe5=0xc2f0 +serdes_preemphasis_lane2_xe5=0xc2f0 +serdes_preemphasis_lane3_xe5=0xc2f0 + +# xe6 (40G) +portmap_7=5:40 +xgxs_rx_lane_map_7=0x213 +xgxs_tx_lane_map_7=0x1203 +phy_xaui_rx_polarity_flip_7=0xc +phy_xaui_tx_polarity_flip_7=0x1 +serdes_driver_current_lane0_xe6=0x4 +serdes_driver_current_lane1_xe6=0x4 +serdes_driver_current_lane2_xe6=0x4 +serdes_driver_current_lane3_xe6=0x4 +serdes_pre_driver_current_lane0_xe6=0x4 +serdes_pre_driver_current_lane1_xe6=0x4 +serdes_pre_driver_current_lane2_xe6=0x4 +serdes_pre_driver_current_lane3_xe6=0x4 +serdes_preemphasis_lane0_xe6=0xc6e0 +serdes_preemphasis_lane1_xe6=0xc6e0 +serdes_preemphasis_lane2_xe6=0xc6e0 +serdes_preemphasis_lane3_xe6=0xc6e0 + +# xe7 (40G) +portmap_8=1:40 +xgxs_rx_lane_map_8=0x213 +xgxs_tx_lane_map_8=0x2031 +phy_xaui_rx_polarity_flip_8=0xe +phy_xaui_tx_polarity_flip_8=0xd +serdes_driver_current_lane0_xe7=0x5 +serdes_driver_current_lane1_xe7=0x5 +serdes_driver_current_lane2_xe7=0x5 +serdes_driver_current_lane3_xe7=0x5 +serdes_pre_driver_current_lane0_xe7=0x5 +serdes_pre_driver_current_lane1_xe7=0x5 +serdes_pre_driver_current_lane2_xe7=0x5 +serdes_pre_driver_current_lane3_xe7=0x5 +serdes_preemphasis_lane0_xe7=0xc6e0 +serdes_preemphasis_lane1_xe7=0xcad0 +serdes_preemphasis_lane2_xe7=0xc6e0 +serdes_preemphasis_lane3_xe7=0xcad0 + +# xe9 (40G) +portmap_9=9:40 +xgxs_rx_lane_map_9=0x3120 +xgxs_tx_lane_map_9=0x3021 +phy_xaui_rx_polarity_flip_9=0x0 +phy_xaui_tx_polarity_flip_9=0x4 +serdes_driver_current_lane0_xe8=0x3 +serdes_driver_current_lane1_xe8=0x3 +serdes_driver_current_lane2_xe8=0x3 +serdes_driver_current_lane3_xe8=0x3 +serdes_pre_driver_current_lane0_xe8=0x3 +serdes_pre_driver_current_lane1_xe8=0x3 +serdes_pre_driver_current_lane2_xe8=0x3 +serdes_pre_driver_current_lane3_xe8=0x3 +serdes_preemphasis_lane0_xe8=0xc2f0 +serdes_preemphasis_lane1_xe8=0xc6e0 +serdes_preemphasis_lane2_xe8=0xbf00 +serdes_preemphasis_lane3_xe8=0xc2f0 + +# xe9 (40G) +portmap_10=13:40 +xgxs_rx_lane_map_10=0x213 +xgxs_tx_lane_map_10=0x132 +phy_xaui_rx_polarity_flip_10=0xe +phy_xaui_tx_polarity_flip_10=0x0 +serdes_driver_current_lane0_xe9=0x2 +serdes_driver_current_lane1_xe9=0x3 +serdes_driver_current_lane2_xe9=0x2 +serdes_driver_current_lane3_xe9=0x2 +serdes_pre_driver_current_lane0_xe9=0x2 +serdes_pre_driver_current_lane1_xe9=0x3 +serdes_pre_driver_current_lane2_xe9=0x2 +serdes_pre_driver_current_lane3_xe9=0x2 +serdes_preemphasis_lane0_xe9=0xb270 +serdes_preemphasis_lane1_xe9=0xbb10 +serdes_preemphasis_lane2_xe9=0xb720 +serdes_preemphasis_lane3_xe9=0xb720 + +# xe10 (40G) +portmap_11=21:40 +xgxs_rx_lane_map_11=0x123 +xgxs_tx_lane_map_11=0x1203 +phy_xaui_rx_polarity_flip_11=0xc +phy_xaui_tx_polarity_flip_11=0xe +serdes_driver_current_lane0_xe10=0x2 +serdes_driver_current_lane1_xe10=0x2 +serdes_driver_current_lane2_xe10=0x2 +serdes_driver_current_lane3_xe10=0x2 +serdes_pre_driver_current_lane0_xe10=0x2 +serdes_pre_driver_current_lane1_xe10=0x2 +serdes_pre_driver_current_lane2_xe10=0x2 +serdes_pre_driver_current_lane3_xe10=0x2 +serdes_preemphasis_lane0_xe10=0xb330 +serdes_preemphasis_lane1_xe10=0xb330 +serdes_preemphasis_lane2_xe10=0xb330 +serdes_preemphasis_lane3_xe10=0xb330 + +# xe11 (40G) +portmap_12=17:40 +xgxs_rx_lane_map_12=0x213 +xgxs_tx_lane_map_12=0x132 +phy_xaui_rx_polarity_flip_12=0xe +phy_xaui_tx_polarity_flip_12=0x0 +serdes_driver_current_lane0_xe11=0x2 +serdes_driver_current_lane1_xe11=0x2 +serdes_driver_current_lane2_xe11=0x2 +serdes_driver_current_lane3_xe11=0x2 +serdes_pre_driver_current_lane0_xe11=0x2 +serdes_pre_driver_current_lane1_xe11=0x2 +serdes_pre_driver_current_lane2_xe11=0x2 +serdes_pre_driver_current_lane3_xe11=0x2 +serdes_preemphasis_lane0_xe11=0xb330 +serdes_preemphasis_lane1_xe11=0xbb10 +serdes_preemphasis_lane2_xe11=0xbb10 +serdes_preemphasis_lane3_xe11=0xbb10 + +# xe12 (40G) +portmap_13=49:40 +xgxs_rx_lane_map_13=0x1302 +xgxs_tx_lane_map_13=0x2031 +phy_xaui_rx_polarity_flip_13=0xb +phy_xaui_tx_polarity_flip_13=0x3 +serdes_driver_current_lane0_xe12=0x2 +serdes_driver_current_lane1_xe12=0x2 +serdes_driver_current_lane2_xe12=0x2 +serdes_driver_current_lane3_xe12=0x2 +serdes_pre_driver_current_lane0_xe12=0x2 +serdes_pre_driver_current_lane1_xe12=0x2 +serdes_pre_driver_current_lane2_xe12=0x2 +serdes_pre_driver_current_lane3_xe12=0x2 +serdes_preemphasis_lane0_xe12=0xa760 +serdes_preemphasis_lane1_xe12=0xa760 +serdes_preemphasis_lane2_xe12=0xa760 +serdes_preemphasis_lane3_xe12=0xa760 + +# xe13 (40G) +portmap_14=53:40 +xgxs_rx_lane_map_14=0x213 +xgxs_tx_lane_map_14=0x231 +phy_xaui_rx_polarity_flip_14=0x1 +phy_xaui_tx_polarity_flip_14=0x0 +serdes_driver_current_lane0_xe13=0x2 +serdes_driver_current_lane1_xe13=0x2 +serdes_driver_current_lane2_xe13=0x2 +serdes_driver_current_lane3_xe13=0x2 +serdes_pre_driver_current_lane0_xe13=0x2 +serdes_pre_driver_current_lane1_xe13=0x2 +serdes_pre_driver_current_lane2_xe13=0x2 +serdes_pre_driver_current_lane3_xe13=0x2 +serdes_preemphasis_lane0_xe13=0xaf40 +serdes_preemphasis_lane1_xe13=0xaf40 +serdes_preemphasis_lane2_xe13=0xaf40 +serdes_preemphasis_lane3_xe13=0xaf40 + +# xe14 (40G) +portmap_15=61:40 +xgxs_rx_lane_map_15=0x132 +xgxs_tx_lane_map_15=0x213 +phy_xaui_rx_polarity_flip_15=0x0 +phy_xaui_tx_polarity_flip_15=0x0 +serdes_driver_current_lane0_xe14=0x2 +serdes_driver_current_lane1_xe14=0x2 +serdes_driver_current_lane2_xe14=0x2 +serdes_driver_current_lane3_xe14=0x2 +serdes_pre_driver_current_lane0_xe14=0x2 +serdes_pre_driver_current_lane1_xe14=0x2 +serdes_pre_driver_current_lane2_xe14=0x2 +serdes_pre_driver_current_lane3_xe14=0x2 +serdes_preemphasis_lane0_xe14=0xa760 +serdes_preemphasis_lane1_xe14=0xa760 +serdes_preemphasis_lane2_xe14=0xa760 +serdes_preemphasis_lane3_xe14=0xa760 + +# xe15 (40G) +portmap_16=57:40 +xgxs_rx_lane_map_16=0x213 +xgxs_tx_lane_map_16=0x2031 +phy_xaui_rx_polarity_flip_16=0x1 +phy_xaui_tx_polarity_flip_16=0x0 +serdes_driver_current_lane0_xe15=0x1 +serdes_driver_current_lane1_xe15=0x1 +serdes_driver_current_lane2_xe15=0x1 +serdes_driver_current_lane3_xe15=0x1 +serdes_pre_driver_current_lane0_xe15=0x1 +serdes_pre_driver_current_lane1_xe15=0x1 +serdes_pre_driver_current_lane2_xe15=0x1 +serdes_pre_driver_current_lane3_xe15=0x1 +serdes_preemphasis_lane0_xe15=0xa760 +serdes_preemphasis_lane1_xe15=0xa760 +serdes_preemphasis_lane2_xe15=0xa760 +serdes_preemphasis_lane3_xe15=0xa760 + +# xe16 (40G) +portmap_17=65:40 +xgxs_rx_lane_map_17=0x132 +xgxs_tx_lane_map_17=0x2031 +phy_xaui_rx_polarity_flip_17=0x3 +phy_xaui_tx_polarity_flip_17=0x9 +serdes_driver_current_lane0_xe16=0x1 +serdes_driver_current_lane1_xe16=0x1 +serdes_driver_current_lane2_xe16=0x1 +serdes_driver_current_lane3_xe16=0x1 +serdes_pre_driver_current_lane0_xe16=0x1 +serdes_pre_driver_current_lane1_xe16=0x1 +serdes_pre_driver_current_lane2_xe16=0x1 +serdes_pre_driver_current_lane3_xe16=0x1 +serdes_preemphasis_lane0_xe16=0xa370 +serdes_preemphasis_lane1_xe16=0xa370 +serdes_preemphasis_lane2_xe16=0xa370 +serdes_preemphasis_lane3_xe16=0xa370 + +# xe17 (40G) +portmap_18=69:40 +xgxs_rx_lane_map_18=0x213 +xgxs_tx_lane_map_18=0x2130 +phy_xaui_rx_polarity_flip_18=0x1 +phy_xaui_tx_polarity_flip_18=0xf +serdes_driver_current_lane0_xe17=0x1 +serdes_driver_current_lane1_xe17=0x1 +serdes_driver_current_lane2_xe17=0x1 +serdes_driver_current_lane3_xe17=0x1 +serdes_pre_driver_current_lane0_xe17=0x1 +serdes_pre_driver_current_lane1_xe17=0x1 +serdes_pre_driver_current_lane2_xe17=0x1 +serdes_pre_driver_current_lane3_xe17=0x1 +serdes_preemphasis_lane0_xe17=0xa760 +serdes_preemphasis_lane1_xe17=0xa760 +serdes_preemphasis_lane2_xe17=0xa760 +serdes_preemphasis_lane3_xe17=0xa760 + +# xe19 (40G) +portmap_19=77:40 +xgxs_rx_lane_map_19=0x123 +xgxs_tx_lane_map_19=0x1203 +phy_xaui_rx_polarity_flip_19=0x3 +phy_xaui_tx_polarity_flip_19=0xe +serdes_driver_current_lane0_xe18=0x2 +serdes_driver_current_lane1_xe18=0x2 +serdes_driver_current_lane2_xe18=0x2 +serdes_driver_current_lane3_xe18=0x2 +serdes_pre_driver_current_lane0_xe18=0x2 +serdes_pre_driver_current_lane1_xe18=0x2 +serdes_pre_driver_current_lane2_xe18=0x2 +serdes_pre_driver_current_lane3_xe18=0x2 +serdes_preemphasis_lane0_xe18=0xaf40 +serdes_preemphasis_lane1_xe18=0xaf40 +serdes_preemphasis_lane2_xe18=0xaf40 +serdes_preemphasis_lane3_xe18=0xaf40 + +# xe19 (40G) +portmap_20=73:40 +xgxs_rx_lane_map_20=0x213 +xgxs_tx_lane_map_20=0x2031 +phy_xaui_rx_polarity_flip_20=0x1 +phy_xaui_tx_polarity_flip_20=0x0 +serdes_driver_current_lane0_xe19=0x2 +serdes_driver_current_lane1_xe19=0x2 +serdes_driver_current_lane2_xe19=0x2 +serdes_driver_current_lane3_xe19=0x2 +serdes_pre_driver_current_lane0_xe19=0x2 +serdes_pre_driver_current_lane1_xe19=0x2 +serdes_pre_driver_current_lane2_xe19=0x2 +serdes_pre_driver_current_lane3_xe19=0x2 +serdes_preemphasis_lane0_xe19=0xa760 +serdes_preemphasis_lane1_xe19=0xa760 +serdes_preemphasis_lane2_xe19=0xa760 +serdes_preemphasis_lane3_xe19=0xa760 + +# xe20 (40G) +portmap_21=105:40 +xgxs_rx_lane_map_21=0x1320 +xgxs_tx_lane_map_21=0x3021 +phy_xaui_rx_polarity_flip_21=0xd +phy_xaui_tx_polarity_flip_21=0xb +serdes_driver_current_lane0_xe20=0x1 +serdes_driver_current_lane1_xe20=0x1 +serdes_driver_current_lane2_xe20=0x1 +serdes_driver_current_lane3_xe20=0x1 +serdes_pre_driver_current_lane0_xe20=0x1 +serdes_pre_driver_current_lane1_xe20=0x1 +serdes_pre_driver_current_lane2_xe20=0x1 +serdes_pre_driver_current_lane3_xe20=0x1 +serdes_preemphasis_lane0_xe20=0xb330 +serdes_preemphasis_lane1_xe20=0xb330 +serdes_preemphasis_lane2_xe20=0xb330 +serdes_preemphasis_lane3_xe20=0xb330 + +# xe21 (40G) +portmap_22=109:40 +xgxs_rx_lane_map_22=0x132 +xgxs_tx_lane_map_22=0x132 +phy_xaui_rx_polarity_flip_22=0x8 +phy_xaui_tx_polarity_flip_22=0x0 +serdes_driver_current_lane0_xe21=0x1 +serdes_driver_current_lane1_xe21=0x1 +serdes_driver_current_lane2_xe21=0x1 +serdes_driver_current_lane3_xe21=0x2 +serdes_pre_driver_current_lane0_xe21=0x1 +serdes_pre_driver_current_lane1_xe21=0x1 +serdes_pre_driver_current_lane2_xe21=0x1 +serdes_pre_driver_current_lane3_xe21=0x2 +serdes_preemphasis_lane0_xe21=0xb330 +serdes_preemphasis_lane1_xe21=0xb330 +serdes_preemphasis_lane2_xe21=0xb330 +serdes_preemphasis_lane3_xe21=0xbff0 + +# xe22 (40G) +portmap_23=117:40 +xgxs_rx_lane_map_23=0x231 +xgxs_tx_lane_map_23=0x1203 +phy_xaui_rx_polarity_flip_23=0x3 +phy_xaui_tx_polarity_flip_23=0xe +serdes_driver_current_lane0_xe22=0x3 +serdes_driver_current_lane1_xe22=0x5 +serdes_driver_current_lane2_xe22=0x3 +serdes_driver_current_lane3_xe22=0x3 +serdes_pre_driver_current_lane0_xe22=0x3 +serdes_pre_driver_current_lane1_xe22=0x5 +serdes_pre_driver_current_lane2_xe22=0x3 +serdes_pre_driver_current_lane3_xe22=0x3 +serdes_preemphasis_lane0_xe22=0xc6e0 +serdes_preemphasis_lane1_xe22=0xc6e0 +serdes_preemphasis_lane2_xe22=0xc6e0 +serdes_preemphasis_lane3_xe22=0xc6e0 + +# xe23 (40G) +portmap_24=113:40 +xgxs_rx_lane_map_24=0x132 +xgxs_tx_lane_map_24=0x132 +phy_xaui_rx_polarity_flip_24=0x8 +phy_xaui_tx_polarity_flip_24=0x0 +serdes_driver_current_lane0_xe23=0x1 +serdes_driver_current_lane1_xe23=0x1 +serdes_driver_current_lane2_xe23=0x1 +serdes_driver_current_lane3_xe23=0x1 +serdes_pre_driver_current_lane0_xe23=0x1 +serdes_pre_driver_current_lane1_xe23=0x1 +serdes_pre_driver_current_lane2_xe23=0x1 +serdes_pre_driver_current_lane3_xe23=0x1 +serdes_preemphasis_lane0_xe23=0xbb10 +serdes_preemphasis_lane1_xe23=0xbb10 +serdes_preemphasis_lane2_xe23=0xbb10 +serdes_preemphasis_lane3_xe23=0xc2f0 + +# xe24 (40G) +portmap_25=121:40 +xgxs_rx_lane_map_25=0x1320 +xgxs_tx_lane_map_25=0x3021 +phy_xaui_rx_polarity_flip_25=0xd +phy_xaui_tx_polarity_flip_25=0xb +serdes_driver_current_lane0_xe24=0x4 +serdes_driver_current_lane1_xe24=0x4 +serdes_driver_current_lane2_xe24=0x4 +serdes_driver_current_lane3_xe24=0x4 +serdes_pre_driver_current_lane0_xe24=0x4 +serdes_pre_driver_current_lane1_xe24=0x4 +serdes_pre_driver_current_lane2_xe24=0x4 +serdes_pre_driver_current_lane3_xe24=0x4 +serdes_preemphasis_lane0_xe24=0xc6e0 +serdes_preemphasis_lane1_xe24=0xc6e0 +serdes_preemphasis_lane2_xe24=0xc6e0 +serdes_preemphasis_lane3_xe24=0xc6e0 + +# xe25 (40G) +portmap_26=125:40 +xgxs_rx_lane_map_26=0x132 +xgxs_tx_lane_map_26=0x132 +phy_xaui_rx_polarity_flip_26=0x8 +phy_xaui_tx_polarity_flip_26=0x0 +serdes_driver_current_lane0_xe25=0x4 +serdes_driver_current_lane1_xe25=0x4 +serdes_driver_current_lane2_xe25=0x4 +serdes_driver_current_lane3_xe25=0x4 +serdes_pre_driver_current_lane0_xe25=0x4 +serdes_pre_driver_current_lane1_xe25=0x4 +serdes_pre_driver_current_lane2_xe25=0x4 +serdes_pre_driver_current_lane3_xe25=0x4 +serdes_preemphasis_lane0_xe25=0xc6e0 +serdes_preemphasis_lane1_xe25=0xc6e0 +serdes_preemphasis_lane2_xe25=0xc6e0 +serdes_preemphasis_lane3_xe25=0xcec0 + +# xe26 (40G) +portmap_27=85:40 +xgxs_rx_lane_map_27=0x213 +xgxs_tx_lane_map_27=0x1203 +phy_xaui_rx_polarity_flip_27=0xc +phy_xaui_tx_polarity_flip_27=0xe +serdes_driver_current_lane0_xe26=0x4 +serdes_driver_current_lane1_xe26=0x5 +serdes_driver_current_lane2_xe26=0x4 +serdes_driver_current_lane3_xe26=0x5 +serdes_pre_driver_current_lane0_xe26=0x4 +serdes_pre_driver_current_lane1_xe26=0x5 +serdes_pre_driver_current_lane2_xe26=0x4 +serdes_pre_driver_current_lane3_xe26=0x5 +serdes_preemphasis_lane0_xe26=0xc2f0 +serdes_preemphasis_lane1_xe26=0xc6e0 +serdes_preemphasis_lane2_xe26=0xc6e0 +serdes_preemphasis_lane3_xe26=0xc6e0 + +# xe27 (40G) +portmap_28=81:40 +xgxs_rx_lane_map_28=0x1320 +xgxs_tx_lane_map_28=0x2031 +phy_xaui_rx_polarity_flip_28=0x1 +phy_xaui_tx_polarity_flip_28=0x2 +serdes_driver_current_lane0_xe27=0x2 +serdes_driver_current_lane1_xe27=0x2 +serdes_driver_current_lane2_xe27=0x2 +serdes_driver_current_lane3_xe27=0x2 +serdes_pre_driver_current_lane0_xe27=0x2 +serdes_pre_driver_current_lane1_xe27=0x2 +serdes_pre_driver_current_lane2_xe27=0x2 +serdes_pre_driver_current_lane3_xe27=0x2 +serdes_preemphasis_lane0_xe27=0xbb10 +serdes_preemphasis_lane1_xe27=0xbb10 +serdes_preemphasis_lane2_xe27=0xbf00 +serdes_preemphasis_lane3_xe27=0xbb10 + +# xe29 (40G) +portmap_29=89:40 +xgxs_rx_lane_map_29=0x1320 +xgxs_tx_lane_map_29=0x3021 +phy_xaui_rx_polarity_flip_29=0x2 +phy_xaui_tx_polarity_flip_29=0xb +serdes_driver_current_lane0_xe28=0x4 +serdes_driver_current_lane1_xe28=0x4 +serdes_driver_current_lane2_xe28=0x4 +serdes_driver_current_lane3_xe28=0x4 +serdes_pre_driver_current_lane0_xe28=0x4 +serdes_pre_driver_current_lane1_xe28=0x4 +serdes_pre_driver_current_lane2_xe28=0x4 +serdes_pre_driver_current_lane3_xe28=0x4 +serdes_preemphasis_lane0_xe28=0xcad0 +serdes_preemphasis_lane1_xe28=0xc6e0 +serdes_preemphasis_lane2_xe28=0xc6e0 +serdes_preemphasis_lane3_xe28=0xc6e0 + +# xe29 (40G) +portmap_30=93:40 +xgxs_rx_lane_map_30=0x1320 +xgxs_tx_lane_map_30=0x2031 +phy_xaui_rx_polarity_flip_30=0x1 +phy_xaui_tx_polarity_flip_30=0x2 +serdes_driver_current_lane0_xe29=0x4 +serdes_driver_current_lane1_xe29=0x4 +serdes_driver_current_lane2_xe29=0x4 +serdes_driver_current_lane3_xe29=0x4 +serdes_pre_driver_current_lane0_xe29=0x4 +serdes_pre_driver_current_lane1_xe29=0x4 +serdes_pre_driver_current_lane2_xe29=0x4 +serdes_pre_driver_current_lane3_xe29=0x4 +serdes_preemphasis_lane0_xe29=0xc2f0 +serdes_preemphasis_lane1_xe29=0xc2f0 +serdes_preemphasis_lane2_xe29=0xc2f0 +serdes_preemphasis_lane3_xe29=0xc2f0 + +# xe30 (40G) +portmap_31=97:40 +xgxs_rx_lane_map_31=0x213 +xgxs_tx_lane_map_31=0x2031 +phy_xaui_rx_polarity_flip_31=0xc +phy_xaui_tx_polarity_flip_31=0x3 +serdes_driver_current_lane0_xe30=0x5 +serdes_driver_current_lane1_xe30=0x5 +serdes_driver_current_lane2_xe30=0x5 +serdes_driver_current_lane3_xe30=0x5 +serdes_pre_driver_current_lane0_xe30=0x5 +serdes_pre_driver_current_lane1_xe30=0x5 +serdes_pre_driver_current_lane2_xe30=0x5 +serdes_pre_driver_current_lane3_xe30=0x5 +serdes_preemphasis_lane0_xe30=0xcad0 +serdes_preemphasis_lane1_xe30=0xcad0 +serdes_preemphasis_lane2_xe30=0xcad0 +serdes_preemphasis_lane3_xe30=0xcad0 + +# xe31 (40G) +portmap_32=101:40 +xgxs_rx_lane_map_32=0x1320 +xgxs_tx_lane_map_32=0x1203 +phy_xaui_rx_polarity_flip_32=0x1 +phy_xaui_tx_polarity_flip_32=0x6 +serdes_driver_current_lane0_xe31=0x6 +serdes_driver_current_lane1_xe31=0x6 +serdes_driver_current_lane2_xe31=0x6 +serdes_driver_current_lane3_xe31=0x7 +serdes_pre_driver_current_lane0_xe31=0x6 +serdes_pre_driver_current_lane1_xe31=0x6 +serdes_pre_driver_current_lane2_xe31=0x6 +serdes_pre_driver_current_lane3_xe31=0x7 +serdes_preemphasis_lane0_xe31=0xcec0 +serdes_preemphasis_lane1_xe31=0xcec0 +serdes_preemphasis_lane2_xe31=0xcad0 +serdes_preemphasis_lane3_xe31=0xc6e0 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 index 92cda77668f6..df3cbb558294 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/sai.profile.j2 @@ -2,12 +2,12 @@ {%- if DEVICE_METADATA is defined -%} {%- set switch_role = DEVICE_METADATA['localhost']['type'] -%} {%- if switch_role.lower() == 'torrouter' %} -{% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G-t0.config.bcm' -%} +{% set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-s6100-64x40G-t0.config.bcm' -%} {%- else %} -{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G-t1.config.bcm' -%} +{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-s6100-64x40G-t1.config.bcm' -%} {%- endif %} {%- else %} -{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/etc/bcm/th-s6100-64x40G-t1.config.bcm' -%} +{%- set sai_profile_contents = 'SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-s6100-64x40G-t1.config.bcm' -%} {%- endif %} {# Write the contents of sai_ profile_filename to sai.profile file #} {{ sai_profile_contents }} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm new file mode 100644 index 000000000000..5132d448c91d --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm @@ -0,0 +1,415 @@ +#TH S6100 64x40 +l3_alpm_enable=2 +pfc_deadlock_seq_control=1 +bcm_stat_interval=2000000 +bcm_num_cos=8 +switch_bypass_mode=0 +mmu_lossless=0 +lpm_scaling_enable=0 +lpm_ipv6_128b_reserved=0 +ipv6_lpm_128b_enable=1 +l2xmsg_mode=1 +oversubscribe_mode=1 + +phy_gearbox_enable=1 +phy_84752=1 +phy_ext_rom_boot=0 +rate_ext_mdio_divisor=0x80 + +serdes_fiber_pref_xe=0 +serdes_if_type_xe=14 + +fpem_mem_entries=32768 + +os=unix + +parity_correction=1 +parity_enable=1 + +port_phy_addr_66=0x176 +port_phy_addr_100=0x177 +xgxs_tx_lane_map_104=0x3210 +xgxs_rx_lane_map_104=0x0312 +phy_xaui_tx_polarity_flip_104=0x0 +phy_xaui_rx_polarity_flip_104=0x0 +port_phy_addr_104=0x1e +port_phy_addr_105=0x1e +dport_map_port_104=1 +dport_map_port_105=2 +xgxs_tx_lane_map_102=0x1032 +xgxs_rx_lane_map_102=0x0132 +phy_xaui_tx_polarity_flip_102=0x3 +phy_xaui_rx_polarity_flip_102=0x3 +phy_xaui_tx_polarity_flip_103=0x3 +phy_xaui_rx_polarity_flip_103=0x3 +port_phy_addr_102=0x1f +port_phy_addr_103=0x1f +dport_map_port_102=3 +dport_map_port_103=4 +xgxs_tx_lane_map_70=0x0123 +xgxs_rx_lane_map_70=0x3201 +phy_xaui_tx_polarity_flip_70=0x3 +phy_xaui_rx_polarity_flip_70=0x3 +phy_xaui_tx_polarity_flip_71=0x3 +phy_xaui_rx_polarity_flip_71=0x3 +port_phy_addr_70=0xE +port_phy_addr_71=0xE +dport_map_port_70=5 +dport_map_port_71=6 +xgxs_tx_lane_map_68=0x2301 +xgxs_rx_lane_map_68=0x1023 +phy_xaui_tx_polarity_flip_68=0x0 +phy_xaui_rx_polarity_flip_68=0x2 +phy_xaui_tx_polarity_flip_69=0x0 +phy_xaui_rx_polarity_flip_69=0x3 +port_phy_addr_68=0xF +port_phy_addr_69=0xF +dport_map_port_68=7 +dport_map_port_69=8 +xgxs_tx_lane_map_44=0x0123 +xgxs_rx_lane_map_44=0x3201 +phy_xaui_tx_polarity_flip_44=0x3 +phy_xaui_rx_polarity_flip_44=0x3 +phy_xaui_tx_polarity_flip_45=0x3 +phy_xaui_rx_polarity_flip_45=0x3 +port_phy_addr_44=0x3e +port_phy_addr_45=0x3e +dport_map_port_44=9 +dport_map_port_45=10 +xgxs_tx_lane_map_42=0x1032 +xgxs_rx_lane_map_42=0x2310 +phy_xaui_tx_polarity_flip_42=0x0 +phy_xaui_rx_polarity_flip_42=0x0 +phy_xaui_tx_polarity_flip_43=0x3 +phy_xaui_rx_polarity_flip_43=0x0 +port_phy_addr_42=0x3f +port_phy_addr_43=0x3f +dport_map_port_42=11 +dport_map_port_43=12 +xgxs_tx_lane_map_11=0x0123 +xgxs_rx_lane_map_11=0x3201 +phy_xaui_tx_polarity_flip_11=0x3 +phy_xaui_rx_polarity_flip_11=0x0 +phy_xaui_tx_polarity_flip_12=0x3 +phy_xaui_rx_polarity_flip_12=0x0 +port_phy_addr_11=0x2E +port_phy_addr_12=0x2E +dport_map_port_11=13 +dport_map_port_12=14 +xgxs_tx_lane_map_9=0x2310 +xgxs_rx_lane_map_9=0x1023 +phy_xaui_tx_polarity_flip_9=0x0 +phy_xaui_rx_polarity_flip_9=0x0 +phy_xaui_tx_polarity_flip_10=0x0 +phy_xaui_rx_polarity_flip_10=0x0 +port_phy_addr_9=0x2F +port_phy_addr_10=0x2F +dport_map_port_9=15 +dport_map_port_10=16 +xgxs_tx_lane_map_13=0x0123 +xgxs_rx_lane_map_13=0x0132 +phy_xaui_tx_polarity_flip_13=0x3 +phy_xaui_rx_polarity_flip_13=0x3 +phy_xaui_tx_polarity_flip_14=0x3 +phy_xaui_rx_polarity_flip_14=0x3 +port_phy_addr_13=0x11e +port_phy_addr_14=0x11e +dport_map_port_13=17 +dport_map_port_14=18 +xgxs_tx_lane_map_15=0x2301 +xgxs_rx_lane_map_15=0x2310 +phy_xaui_tx_polarity_flip_15=0x0 +phy_xaui_rx_polarity_flip_15=0x0 +port_phy_addr_15=0x11f +port_phy_addr_16=0x11f +dport_map_port_15=19 +dport_map_port_16=20 +xgxs_tx_lane_map_46=0x3210 +xgxs_rx_lane_map_46=0x0132 +phy_xaui_tx_polarity_flip_46=0x3 +phy_xaui_rx_polarity_flip_46=0x3 +phy_xaui_tx_polarity_flip_47=0x3 +phy_xaui_rx_polarity_flip_47=0x3 +port_phy_addr_46=0x10e +port_phy_addr_47=0x10e +dport_map_port_46=21 +dport_map_port_47=22 +xgxs_tx_lane_map_48=0x2301 +xgxs_rx_lane_map_48=0x1023 +phy_xaui_tx_polarity_flip_48=0x0 +phy_xaui_rx_polarity_flip_48=0x1 +port_phy_addr_48=0x10F +port_phy_addr_49=0x10F +dport_map_port_48=23 +dport_map_port_49=24 +xgxs_tx_lane_map_72=0x3210 +xgxs_rx_lane_map_72=0x0132 +phy_xaui_tx_polarity_flip_72=0x3 +phy_xaui_rx_polarity_flip_72=0x0 +phy_xaui_tx_polarity_flip_73=0x3 +phy_xaui_rx_polarity_flip_73=0x0 +port_phy_addr_72=0x13e +port_phy_addr_73=0x13e +dport_map_port_72=25 +dport_map_port_73=26 +xgxs_tx_lane_map_74=0x1320 +xgxs_rx_lane_map_74=0x2013 +phy_xaui_tx_polarity_flip_74=0x0 +phy_xaui_rx_polarity_flip_74=0x0 +phy_xaui_tx_polarity_flip_75=0x3 +phy_xaui_rx_polarity_flip_75=0x0 +port_phy_addr_74=0x13f +port_phy_addr_75=0x13f +dport_map_port_74=27 +dport_map_port_75=28 +xgxs_tx_lane_map_106=0x3210 +xgxs_rx_lane_map_106=0x2310 +phy_xaui_tx_polarity_flip_106=0x0 +phy_xaui_rx_polarity_flip_106=0x3 +phy_xaui_tx_polarity_flip_107=0x0 +phy_xaui_rx_polarity_flip_107=0x3 +port_phy_addr_106=0x12e +port_phy_addr_107=0x12e +dport_map_port_106=29 +dport_map_port_107=30 +xgxs_tx_lane_map_108=0x1032 +xgxs_rx_lane_map_108=0x0132 +phy_xaui_tx_polarity_flip_108=0x3 +phy_xaui_rx_polarity_flip_108=0x3 +phy_xaui_tx_polarity_flip_109=0x3 +phy_xaui_rx_polarity_flip_109=0x3 +port_phy_addr_108=0x12f +port_phy_addr_109=0x12f +dport_map_port_108=31 +dport_map_port_109=32 +port_phy_addr_7=0x5e +port_phy_addr_8=0x5e +xgxs_tx_lane_map_7=0x3210 +xgxs_rx_lane_map_7=0x0132 +phy_xaui_tx_polarity_flip_7=0x3 +phy_xaui_rx_polarity_flip_7=0x1 +phy_xaui_tx_polarity_flip_8=0x3 +phy_xaui_rx_polarity_flip_8=0x3 +dport_map_port_7=33 +dport_map_port_8=34 +port_phy_addr_5=0x5f +port_phy_addr_6=0x5f +xgxs_tx_lane_map_5=0x2301 +xgxs_rx_lane_map_5=0x1023 +phy_xaui_tx_polarity_flip_5=0x0 +phy_xaui_rx_polarity_flip_5=0x0 +phy_xaui_tx_polarity_flip_6=0x0 +phy_xaui_tx_polarity_flip_6=0x0 +dport_map_port_5=35 +dport_map_port_6=36 +port_phy_addr_116=0x4e +port_phy_addr_117=0x4e +phy_xaui_tx_polarity_flip_116=0x0 +phy_xaui_rx_polarity_flip_116=0x1 +phy_xaui_tx_polarity_flip_117=0x3 +phy_xaui_rx_polarity_flip_117=0x3 +xgxs_tx_lane_map_116=0x0123 +xgxs_rx_lane_map_116=0x3201 +dport_map_port_116=37 +dport_map_port_117=38 +port_phy_addr_114=0x4f +port_phy_addr_115=0x4f +phy_xaui_tx_polarity_flip_114=0x0 +phy_xaui_rx_polarity_flip_114=0x0 +phy_xaui_tx_polarity_flip_115=0x1 +phy_xaui_rx_polarity_flip_115=0x0 +xgxs_tx_lane_map_114=0x2301 +xgxs_rx_lane_map_114=0x1023 +dport_map_port_114=39 +dport_map_port_115=40 +port_phy_addr_82=0x7e +port_phy_addr_83=0x7e +xgxs_tx_lane_map_82=0x3210 +xgxs_rx_lane_map_82=0x2310 +phy_xaui_tx_polarity_flip_82=0x0 +phy_xaui_rx_polarity_flip_82=0x0 +dport_map_port_82=41 +dport_map_port_83=42 +port_phy_addr_80=0x7f +port_phy_addr_81=0x7f +xgxs_tx_lane_map_80=0x1032 +xgxs_rx_lane_map_80=0x0132 +phy_xaui_tx_polarity_flip_80=0x3 +phy_xaui_rx_polarity_flip_80=0x3 +phy_xaui_tx_polarity_flip_81=0x0 +phy_xaui_rx_polarity_flip_81=0x3 +dport_map_port_80=43 +dport_map_port_81=44 +xgxs_tx_lane_map_40=0x0123 +xgxs_rx_lane_map_40=0x0132 +port_phy_addr_40=0x6e +port_phy_addr_41=0x6e +phy_xaui_tx_polarity_flip_40=0x3 +phy_xaui_rx_polarity_flip_40=0x0 +phy_xaui_tx_polarity_flip_41=0x3 +phy_xaui_rx_polarity_flip_41=0x0 +dport_map_port_40=45 +dport_map_port_41=46 +port_phy_addr_38=0x6f +port_phy_addr_39=0x6f +phy_xaui_tx_polarity_flip_38=0x0 +phy_xaui_rx_polarity_flip_38=0x0 +xgxs_tx_lane_map_38=0x2301 +xgxs_rx_lane_map_38=0x2310 +dport_map_port_38=47 +dport_map_port_39=48 +xgxs_tx_lane_map_110=0x2013 +xgxs_rx_lane_map_110=0x3102 +phy_xaui_tx_polarity_flip_110=0x3 +phy_xaui_rx_polarity_flip_110=0x3 +phy_xaui_tx_polarity_flip_111=0x3 +phy_xaui_rx_polarity_flip_111=0x3 +port_phy_addr_110=0x15e +port_phy_addr_111=0x15e +dport_map_port_110=49 +dport_map_port_111=50 +xgxs_tx_lane_map_112=0x1032 +xgxs_rx_lane_map_112=0x2310 +phy_xaui_tx_polarity_flip_112=0x3 +phy_xaui_rx_polarity_flip_112=0x3 +phy_xaui_tx_polarity_flip_113=0x3 +phy_xaui_rx_polarity_flip_113=0x3 +port_phy_addr_112=0x15f +port_phy_addr_113=0x15f +dport_map_port_112=51 +dport_map_port_113=52 +port_phy_addr_1=0x14e +port_phy_addr_2=0x14e +xgxs_tx_lane_map_1=0x0123 +xgxs_rx_lane_map_1=0x3201 +phy_xaui_tx_polarity_flip_1=0x3 +phy_xaui_rx_polarity_flip_1=0x3 +phy_xaui_tx_polarity_flip_2=0x3 +phy_xaui_rx_polarity_flip_2=0x3 +dport_map_port_1=53 +dport_map_port_2=54 +xgxs_tx_lane_map_3=0x1023 +xgxs_rx_lane_map_3=0x2310 +port_phy_addr_3=0x14f +port_phy_addr_4=0x14f +phy_xaui_tx_polarity_flip_3=0x3 +phy_xaui_rx_polarity_flip_3=0x0 +phy_xaui_tx_polarity_flip_4=0x3 +phy_xaui_rx_polarity_flip_4=0x3 +dport_map_port_3=55 +dport_map_port_4=56 +port_phy_addr_34=0x17e +port_phy_addr_35=0x17e +xgxs_tx_lane_map_34=0x0123 +xgxs_rx_lane_map_34=0x0132 +phy_xaui_tx_polarity_flip_34=0x3 +phy_xaui_rx_polarity_flip_34=0x0 +phy_xaui_tx_polarity_flip_35=0x3 +phy_xaui_rx_polarity_flip_35=0x0 +dport_map_port_34=57 +dport_map_port_35=58 +port_phy_addr_36=0x17f +port_phy_addr_37=0x17f +xgxs_tx_lane_map_36=0x2301 +xgxs_rx_lane_map_36=0x2310 +phy_xaui_tx_polarity_flip_36=0x0 +phy_xaui_rx_polarity_flip_36=0x3 +phy_xaui_tx_polarity_flip_37=0x3 +phy_xaui_rx_polarity_flip_37=0x3 +dport_map_port_36=59 +dport_map_port_37=60 +port_phy_addr_76=0x16e +port_phy_addr_77=0x16e +xgxs_tx_lane_map_76=0x3210 +xgxs_rx_lane_map_76=0x2310 +phy_xaui_tx_polarity_flip_76=0x0 +phy_xaui_rx_polarity_flip_76=0x3 +phy_xaui_tx_polarity_flip_77=0x0 +phy_xaui_rx_polarity_flip_77=0x3 +dport_map_port_76=61 +dport_map_port_77=62 +port_phy_addr_78=0x16f +port_phy_addr_79=0x16f +xgxs_tx_lane_map_78=0x1032 +xgxs_rx_lane_map_78=0x0132 +phy_xaui_tx_polarity_flip_78=0x3 +phy_xaui_rx_polarity_flip_78=0x3 +phy_xaui_tx_polarity_flip_79=0x3 +phy_xaui_rx_polarity_flip_79=0x3 +dport_map_port_78=63 +dport_map_port_79=64 +pbmp_xport_xe=0x3fffd0000ffff40003fffc0001fffe +portmap_66=129:10 +portmap_100=131:10 +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 +portmap_1=1:40:2 +portmap_2=3:40:2 +portmap_3=5:40:2 +portmap_4=7:40:2 +portmap_5=9:40:2 +portmap_6=11:40:2 +portmap_7=13:40:2 +portmap_8=15:40:2 +portmap_9=17:40:2 +portmap_10=19:40:2 +portmap_11=21:40:2 +portmap_12=23:40:2 +portmap_13=25:40:2 +portmap_14=27:40:2 +portmap_15=29:40:2 +portmap_16=31:40:2 +portmap_34=33:40:2 +portmap_35=35:40:2 +portmap_36=37:40:2 +portmap_37=39:40:2 +portmap_38=41:40:2 +portmap_39=43:40:2 +portmap_40=45:40:2 +portmap_41=47:40:2 +portmap_42=49:40:2 +portmap_43=51:40:2 +portmap_44=53:40:2 +portmap_45=55:40:2 +portmap_46=57:40:2 +portmap_47=59:40:2 +portmap_48=61:40:2 +portmap_49=63:40:2 +portmap_68=65:40:2 +portmap_69=67:40:2 +portmap_70=69:40:2 +portmap_71=71:40:2 +portmap_72=73:40:2 +portmap_73=75:40:2 +portmap_74=77:40:2 +portmap_75=79:40:2 +portmap_76=81:40:2 +portmap_77=83:40:2 +portmap_78=85:40:2 +portmap_79=87:40:2 +portmap_80=89:40:2 +portmap_81=91:40:2 +portmap_82=93:40:2 +portmap_83=95:40:2 +portmap_102=97:40:2 +portmap_103=99:40:2 +portmap_104=101:40:2 +portmap_105=103:40:2 +portmap_106=105:40:2 +portmap_107=107:40:2 +portmap_108=109:40:2 +portmap_109=111:40:2 +portmap_110=113:40:2 +portmap_111=115:40:2 +portmap_112=117:40:2 +portmap_113=119:40:2 +portmap_114=121:40:2 +portmap_115=123:40:2 +portmap_116=125:40:2 +portmap_117=127:40:2 +dport_map_port_66=65 +dport_map_port_100=66 + +mmu_init_config="MSFT-TH-Tier0" diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm new file mode 100644 index 000000000000..b6a4e6076a34 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm @@ -0,0 +1,415 @@ +#TH S6100 64x40 +l3_alpm_enable=2 +pfc_deadlock_seq_control=1 +bcm_stat_interval=2000000 +bcm_num_cos=8 +switch_bypass_mode=0 +mmu_lossless=0 +lpm_scaling_enable=0 +lpm_ipv6_128b_reserved=0 +ipv6_lpm_128b_enable=1 +l2xmsg_mode=1 +oversubscribe_mode=1 + +phy_gearbox_enable=1 +phy_84752=1 +phy_ext_rom_boot=0 +rate_ext_mdio_divisor=0x80 + +serdes_fiber_pref_xe=0 +serdes_if_type_xe=14 + +fpem_mem_entries=32768 + +os=unix + +parity_correction=1 +parity_enable=1 + +port_phy_addr_66=0x176 +port_phy_addr_100=0x177 +xgxs_tx_lane_map_104=0x3210 +xgxs_rx_lane_map_104=0x0312 +phy_xaui_tx_polarity_flip_104=0x0 +phy_xaui_rx_polarity_flip_104=0x0 +port_phy_addr_104=0x1e +port_phy_addr_105=0x1e +dport_map_port_104=1 +dport_map_port_105=2 +xgxs_tx_lane_map_102=0x1032 +xgxs_rx_lane_map_102=0x0132 +phy_xaui_tx_polarity_flip_102=0x3 +phy_xaui_rx_polarity_flip_102=0x3 +phy_xaui_tx_polarity_flip_103=0x3 +phy_xaui_rx_polarity_flip_103=0x3 +port_phy_addr_102=0x1f +port_phy_addr_103=0x1f +dport_map_port_102=3 +dport_map_port_103=4 +xgxs_tx_lane_map_70=0x0123 +xgxs_rx_lane_map_70=0x3201 +phy_xaui_tx_polarity_flip_70=0x3 +phy_xaui_rx_polarity_flip_70=0x3 +phy_xaui_tx_polarity_flip_71=0x3 +phy_xaui_rx_polarity_flip_71=0x3 +port_phy_addr_70=0xE +port_phy_addr_71=0xE +dport_map_port_70=5 +dport_map_port_71=6 +xgxs_tx_lane_map_68=0x2301 +xgxs_rx_lane_map_68=0x1023 +phy_xaui_tx_polarity_flip_68=0x0 +phy_xaui_rx_polarity_flip_68=0x2 +phy_xaui_tx_polarity_flip_69=0x0 +phy_xaui_rx_polarity_flip_69=0x3 +port_phy_addr_68=0xF +port_phy_addr_69=0xF +dport_map_port_68=7 +dport_map_port_69=8 +xgxs_tx_lane_map_44=0x0123 +xgxs_rx_lane_map_44=0x3201 +phy_xaui_tx_polarity_flip_44=0x3 +phy_xaui_rx_polarity_flip_44=0x3 +phy_xaui_tx_polarity_flip_45=0x3 +phy_xaui_rx_polarity_flip_45=0x3 +port_phy_addr_44=0x3e +port_phy_addr_45=0x3e +dport_map_port_44=9 +dport_map_port_45=10 +xgxs_tx_lane_map_42=0x1032 +xgxs_rx_lane_map_42=0x2310 +phy_xaui_tx_polarity_flip_42=0x0 +phy_xaui_rx_polarity_flip_42=0x0 +phy_xaui_tx_polarity_flip_43=0x3 +phy_xaui_rx_polarity_flip_43=0x0 +port_phy_addr_42=0x3f +port_phy_addr_43=0x3f +dport_map_port_42=11 +dport_map_port_43=12 +xgxs_tx_lane_map_11=0x0123 +xgxs_rx_lane_map_11=0x3201 +phy_xaui_tx_polarity_flip_11=0x3 +phy_xaui_rx_polarity_flip_11=0x0 +phy_xaui_tx_polarity_flip_12=0x3 +phy_xaui_rx_polarity_flip_12=0x0 +port_phy_addr_11=0x2E +port_phy_addr_12=0x2E +dport_map_port_11=13 +dport_map_port_12=14 +xgxs_tx_lane_map_9=0x2310 +xgxs_rx_lane_map_9=0x1023 +phy_xaui_tx_polarity_flip_9=0x0 +phy_xaui_rx_polarity_flip_9=0x0 +phy_xaui_tx_polarity_flip_10=0x0 +phy_xaui_rx_polarity_flip_10=0x0 +port_phy_addr_9=0x2F +port_phy_addr_10=0x2F +dport_map_port_9=15 +dport_map_port_10=16 +xgxs_tx_lane_map_13=0x0123 +xgxs_rx_lane_map_13=0x0132 +phy_xaui_tx_polarity_flip_13=0x3 +phy_xaui_rx_polarity_flip_13=0x3 +phy_xaui_tx_polarity_flip_14=0x3 +phy_xaui_rx_polarity_flip_14=0x3 +port_phy_addr_13=0x11e +port_phy_addr_14=0x11e +dport_map_port_13=17 +dport_map_port_14=18 +xgxs_tx_lane_map_15=0x2301 +xgxs_rx_lane_map_15=0x2310 +phy_xaui_tx_polarity_flip_15=0x0 +phy_xaui_rx_polarity_flip_15=0x0 +port_phy_addr_15=0x11f +port_phy_addr_16=0x11f +dport_map_port_15=19 +dport_map_port_16=20 +xgxs_tx_lane_map_46=0x3210 +xgxs_rx_lane_map_46=0x0132 +phy_xaui_tx_polarity_flip_46=0x3 +phy_xaui_rx_polarity_flip_46=0x3 +phy_xaui_tx_polarity_flip_47=0x3 +phy_xaui_rx_polarity_flip_47=0x3 +port_phy_addr_46=0x10e +port_phy_addr_47=0x10e +dport_map_port_46=21 +dport_map_port_47=22 +xgxs_tx_lane_map_48=0x2301 +xgxs_rx_lane_map_48=0x1023 +phy_xaui_tx_polarity_flip_48=0x0 +phy_xaui_rx_polarity_flip_48=0x1 +port_phy_addr_48=0x10F +port_phy_addr_49=0x10F +dport_map_port_48=23 +dport_map_port_49=24 +xgxs_tx_lane_map_72=0x3210 +xgxs_rx_lane_map_72=0x0132 +phy_xaui_tx_polarity_flip_72=0x3 +phy_xaui_rx_polarity_flip_72=0x0 +phy_xaui_tx_polarity_flip_73=0x3 +phy_xaui_rx_polarity_flip_73=0x0 +port_phy_addr_72=0x13e +port_phy_addr_73=0x13e +dport_map_port_72=25 +dport_map_port_73=26 +xgxs_tx_lane_map_74=0x1320 +xgxs_rx_lane_map_74=0x2013 +phy_xaui_tx_polarity_flip_74=0x0 +phy_xaui_rx_polarity_flip_74=0x0 +phy_xaui_tx_polarity_flip_75=0x3 +phy_xaui_rx_polarity_flip_75=0x0 +port_phy_addr_74=0x13f +port_phy_addr_75=0x13f +dport_map_port_74=27 +dport_map_port_75=28 +xgxs_tx_lane_map_106=0x3210 +xgxs_rx_lane_map_106=0x2310 +phy_xaui_tx_polarity_flip_106=0x0 +phy_xaui_rx_polarity_flip_106=0x3 +phy_xaui_tx_polarity_flip_107=0x0 +phy_xaui_rx_polarity_flip_107=0x3 +port_phy_addr_106=0x12e +port_phy_addr_107=0x12e +dport_map_port_106=29 +dport_map_port_107=30 +xgxs_tx_lane_map_108=0x1032 +xgxs_rx_lane_map_108=0x0132 +phy_xaui_tx_polarity_flip_108=0x3 +phy_xaui_rx_polarity_flip_108=0x3 +phy_xaui_tx_polarity_flip_109=0x3 +phy_xaui_rx_polarity_flip_109=0x3 +port_phy_addr_108=0x12f +port_phy_addr_109=0x12f +dport_map_port_108=31 +dport_map_port_109=32 +port_phy_addr_7=0x5e +port_phy_addr_8=0x5e +xgxs_tx_lane_map_7=0x3210 +xgxs_rx_lane_map_7=0x0132 +phy_xaui_tx_polarity_flip_7=0x3 +phy_xaui_rx_polarity_flip_7=0x1 +phy_xaui_tx_polarity_flip_8=0x3 +phy_xaui_rx_polarity_flip_8=0x3 +dport_map_port_7=33 +dport_map_port_8=34 +port_phy_addr_5=0x5f +port_phy_addr_6=0x5f +xgxs_tx_lane_map_5=0x2301 +xgxs_rx_lane_map_5=0x1023 +phy_xaui_tx_polarity_flip_5=0x0 +phy_xaui_rx_polarity_flip_5=0x0 +phy_xaui_tx_polarity_flip_6=0x0 +phy_xaui_tx_polarity_flip_6=0x0 +dport_map_port_5=35 +dport_map_port_6=36 +port_phy_addr_116=0x4e +port_phy_addr_117=0x4e +phy_xaui_tx_polarity_flip_116=0x0 +phy_xaui_rx_polarity_flip_116=0x1 +phy_xaui_tx_polarity_flip_117=0x3 +phy_xaui_rx_polarity_flip_117=0x3 +xgxs_tx_lane_map_116=0x0123 +xgxs_rx_lane_map_116=0x3201 +dport_map_port_116=37 +dport_map_port_117=38 +port_phy_addr_114=0x4f +port_phy_addr_115=0x4f +phy_xaui_tx_polarity_flip_114=0x0 +phy_xaui_rx_polarity_flip_114=0x0 +phy_xaui_tx_polarity_flip_115=0x1 +phy_xaui_rx_polarity_flip_115=0x0 +xgxs_tx_lane_map_114=0x2301 +xgxs_rx_lane_map_114=0x1023 +dport_map_port_114=39 +dport_map_port_115=40 +port_phy_addr_82=0x7e +port_phy_addr_83=0x7e +xgxs_tx_lane_map_82=0x3210 +xgxs_rx_lane_map_82=0x2310 +phy_xaui_tx_polarity_flip_82=0x0 +phy_xaui_rx_polarity_flip_82=0x0 +dport_map_port_82=41 +dport_map_port_83=42 +port_phy_addr_80=0x7f +port_phy_addr_81=0x7f +xgxs_tx_lane_map_80=0x1032 +xgxs_rx_lane_map_80=0x0132 +phy_xaui_tx_polarity_flip_80=0x3 +phy_xaui_rx_polarity_flip_80=0x3 +phy_xaui_tx_polarity_flip_81=0x0 +phy_xaui_rx_polarity_flip_81=0x3 +dport_map_port_80=43 +dport_map_port_81=44 +xgxs_tx_lane_map_40=0x0123 +xgxs_rx_lane_map_40=0x0132 +port_phy_addr_40=0x6e +port_phy_addr_41=0x6e +phy_xaui_tx_polarity_flip_40=0x3 +phy_xaui_rx_polarity_flip_40=0x0 +phy_xaui_tx_polarity_flip_41=0x3 +phy_xaui_rx_polarity_flip_41=0x0 +dport_map_port_40=45 +dport_map_port_41=46 +port_phy_addr_38=0x6f +port_phy_addr_39=0x6f +phy_xaui_tx_polarity_flip_38=0x0 +phy_xaui_rx_polarity_flip_38=0x0 +xgxs_tx_lane_map_38=0x2301 +xgxs_rx_lane_map_38=0x2310 +dport_map_port_38=47 +dport_map_port_39=48 +xgxs_tx_lane_map_110=0x2013 +xgxs_rx_lane_map_110=0x3102 +phy_xaui_tx_polarity_flip_110=0x3 +phy_xaui_rx_polarity_flip_110=0x3 +phy_xaui_tx_polarity_flip_111=0x3 +phy_xaui_rx_polarity_flip_111=0x3 +port_phy_addr_110=0x15e +port_phy_addr_111=0x15e +dport_map_port_110=49 +dport_map_port_111=50 +xgxs_tx_lane_map_112=0x1032 +xgxs_rx_lane_map_112=0x2310 +phy_xaui_tx_polarity_flip_112=0x3 +phy_xaui_rx_polarity_flip_112=0x3 +phy_xaui_tx_polarity_flip_113=0x3 +phy_xaui_rx_polarity_flip_113=0x3 +port_phy_addr_112=0x15f +port_phy_addr_113=0x15f +dport_map_port_112=51 +dport_map_port_113=52 +port_phy_addr_1=0x14e +port_phy_addr_2=0x14e +xgxs_tx_lane_map_1=0x0123 +xgxs_rx_lane_map_1=0x3201 +phy_xaui_tx_polarity_flip_1=0x3 +phy_xaui_rx_polarity_flip_1=0x3 +phy_xaui_tx_polarity_flip_2=0x3 +phy_xaui_rx_polarity_flip_2=0x3 +dport_map_port_1=53 +dport_map_port_2=54 +xgxs_tx_lane_map_3=0x1023 +xgxs_rx_lane_map_3=0x2310 +port_phy_addr_3=0x14f +port_phy_addr_4=0x14f +phy_xaui_tx_polarity_flip_3=0x3 +phy_xaui_rx_polarity_flip_3=0x0 +phy_xaui_tx_polarity_flip_4=0x3 +phy_xaui_rx_polarity_flip_4=0x3 +dport_map_port_3=55 +dport_map_port_4=56 +port_phy_addr_34=0x17e +port_phy_addr_35=0x17e +xgxs_tx_lane_map_34=0x0123 +xgxs_rx_lane_map_34=0x0132 +phy_xaui_tx_polarity_flip_34=0x3 +phy_xaui_rx_polarity_flip_34=0x0 +phy_xaui_tx_polarity_flip_35=0x3 +phy_xaui_rx_polarity_flip_35=0x0 +dport_map_port_34=57 +dport_map_port_35=58 +port_phy_addr_36=0x17f +port_phy_addr_37=0x17f +xgxs_tx_lane_map_36=0x2301 +xgxs_rx_lane_map_36=0x2310 +phy_xaui_tx_polarity_flip_36=0x0 +phy_xaui_rx_polarity_flip_36=0x3 +phy_xaui_tx_polarity_flip_37=0x3 +phy_xaui_rx_polarity_flip_37=0x3 +dport_map_port_36=59 +dport_map_port_37=60 +port_phy_addr_76=0x16e +port_phy_addr_77=0x16e +xgxs_tx_lane_map_76=0x3210 +xgxs_rx_lane_map_76=0x2310 +phy_xaui_tx_polarity_flip_76=0x0 +phy_xaui_rx_polarity_flip_76=0x3 +phy_xaui_tx_polarity_flip_77=0x0 +phy_xaui_rx_polarity_flip_77=0x3 +dport_map_port_76=61 +dport_map_port_77=62 +port_phy_addr_78=0x16f +port_phy_addr_79=0x16f +xgxs_tx_lane_map_78=0x1032 +xgxs_rx_lane_map_78=0x0132 +phy_xaui_tx_polarity_flip_78=0x3 +phy_xaui_rx_polarity_flip_78=0x3 +phy_xaui_tx_polarity_flip_79=0x3 +phy_xaui_rx_polarity_flip_79=0x3 +dport_map_port_78=63 +dport_map_port_79=64 +pbmp_xport_xe=0x3fffd0000ffff40003fffc0001fffe +portmap_66=129:10 +portmap_100=131:10 +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 +portmap_1=1:40:2 +portmap_2=3:40:2 +portmap_3=5:40:2 +portmap_4=7:40:2 +portmap_5=9:40:2 +portmap_6=11:40:2 +portmap_7=13:40:2 +portmap_8=15:40:2 +portmap_9=17:40:2 +portmap_10=19:40:2 +portmap_11=21:40:2 +portmap_12=23:40:2 +portmap_13=25:40:2 +portmap_14=27:40:2 +portmap_15=29:40:2 +portmap_16=31:40:2 +portmap_34=33:40:2 +portmap_35=35:40:2 +portmap_36=37:40:2 +portmap_37=39:40:2 +portmap_38=41:40:2 +portmap_39=43:40:2 +portmap_40=45:40:2 +portmap_41=47:40:2 +portmap_42=49:40:2 +portmap_43=51:40:2 +portmap_44=53:40:2 +portmap_45=55:40:2 +portmap_46=57:40:2 +portmap_47=59:40:2 +portmap_48=61:40:2 +portmap_49=63:40:2 +portmap_68=65:40:2 +portmap_69=67:40:2 +portmap_70=69:40:2 +portmap_71=71:40:2 +portmap_72=73:40:2 +portmap_73=75:40:2 +portmap_74=77:40:2 +portmap_75=79:40:2 +portmap_76=81:40:2 +portmap_77=83:40:2 +portmap_78=85:40:2 +portmap_79=87:40:2 +portmap_80=89:40:2 +portmap_81=91:40:2 +portmap_82=93:40:2 +portmap_83=95:40:2 +portmap_102=97:40:2 +portmap_103=99:40:2 +portmap_104=101:40:2 +portmap_105=103:40:2 +portmap_106=105:40:2 +portmap_107=107:40:2 +portmap_108=109:40:2 +portmap_109=111:40:2 +portmap_110=113:40:2 +portmap_111=115:40:2 +portmap_112=117:40:2 +portmap_113=119:40:2 +portmap_114=121:40:2 +portmap_115=123:40:2 +portmap_116=125:40:2 +portmap_117=127:40:2 +dport_map_port_66=65 +dport_map_port_100=66 + +mmu_init_config="MSFT-TH-Tier1" diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/sai.profile b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/sai.profile index a1755e764616..0a4fed041752 100644 --- a/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/sai.profile +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th2-z9264f-64x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-z9264f-64x100G.config.bcm diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/th2-z9264f-64x100G.config.bcm b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/th2-z9264f-64x100G.config.bcm new file mode 100644 index 000000000000..5231b526c112 --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/th2-z9264f-64x100G.config.bcm @@ -0,0 +1,1007 @@ +#TH2 Z9264F 64x100G +os=unix +core_clock_frequency=1700 +dpp_clock_ratio=2:3 +pbmp_xport_xe=0x3FFFD0000FFFF40003FFFC0001FFFE +oversubscribe_mode=1 +fpem_mem_entries=65536 +l2xmsg_mode=1 + +l3_alpm_enable=2 +bcm_num_cos=8 +switch_bypass_mode=0 +mmu_lossless=0 +lpm_scaling_enable=0 +lpm_ipv6_128b_reserved=0 +ipv6_lpm_128b_enable=1 + +parity_correction=1 +parity_enable=1 + +scache_filename=/tmp/scache + +dport_map_enable=1 + +dport_map_enable=1 +dport_map_port_13=1 +dport_map_port_14=2 +dport_map_port_34=3 +dport_map_port_35=4 +dport_map_port_38=5 +dport_map_port_39=6 +dport_map_port_42=7 +dport_map_port_43=8 +dport_map_port_1=9 +dport_map_port_2=10 +dport_map_port_5=11 +dport_map_port_6=12 +dport_map_port_9=13 +dport_map_port_10=14 +dport_map_port_46=15 +dport_map_port_47=16 + +dport_map_port_69=17 +dport_map_port_68=18 +dport_map_port_107=19 +dport_map_port_106=20 +dport_map_port_111=21 +dport_map_port_110=22 +dport_map_port_115=23 +dport_map_port_114=24 +dport_map_port_73=25 +dport_map_port_72=26 +dport_map_port_77=27 +dport_map_port_76=28 +dport_map_port_81=29 +dport_map_port_80=30 +dport_map_port_103=31 +dport_map_port_102=32 + +dport_map_port_16=33 +dport_map_port_15=34 +dport_map_port_37=35 +dport_map_port_36=36 +dport_map_port_41=37 +dport_map_port_40=38 +dport_map_port_45=39 +dport_map_port_44=40 +dport_map_port_4=41 +dport_map_port_3=42 +dport_map_port_8=43 +dport_map_port_7=44 +dport_map_port_12=45 +dport_map_port_11=46 +dport_map_port_49=47 +dport_map_port_48=48 + +dport_map_port_70=49 +dport_map_port_71=50 +dport_map_port_108=51 +dport_map_port_109=52 +dport_map_port_112=53 +dport_map_port_113=54 +dport_map_port_116=55 +dport_map_port_117=56 +dport_map_port_74=57 +dport_map_port_75=58 +dport_map_port_78=59 +dport_map_port_79=60 +dport_map_port_82=61 +dport_map_port_83=62 +dport_map_port_104=63 +dport_map_port_105=64 + +# +# Tile-0 FC0~FC15 +# +portmap_1=1:100 +portmap_2=5:100 +portmap_3=9:100 +portmap_4=13:100 +portmap_5=17:100 +portmap_6=21:100 +portmap_7=25:100 +portmap_8=29:100 +portmap_9=33:100 +portmap_10=37:100 +portmap_11=41:100 +portmap_12=45:100 +portmap_13=49:100 +portmap_14=53:100 +portmap_15=57:100 +portmap_16=61:100 + +# TX polarity +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{2.0}=0x0 +phy_chain_tx_polarity_flip_physical{3.0}=0x1 +phy_chain_tx_polarity_flip_physical{4.0}=0x1 + +phy_chain_tx_polarity_flip_physical{5.0}=0x1 +phy_chain_tx_polarity_flip_physical{6.0}=0x0 +phy_chain_tx_polarity_flip_physical{7.0}=0x1 +phy_chain_tx_polarity_flip_physical{8.0}=0x1 + +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x1 +phy_chain_tx_polarity_flip_physical{11.0}=0x0 +phy_chain_tx_polarity_flip_physical{12.0}=0x1 + +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{14.0}=0x1 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x1 + +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x0 +phy_chain_tx_polarity_flip_physical{19.0}=0x1 +phy_chain_tx_polarity_flip_physical{20.0}=0x1 + +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x1 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_tx_polarity_flip_physical{24.0}=0x1 + +phy_chain_tx_polarity_flip_physical{25.0}=0x0 +phy_chain_tx_polarity_flip_physical{26.0}=0x1 +phy_chain_tx_polarity_flip_physical{27.0}=0x1 +phy_chain_tx_polarity_flip_physical{28.0}=0x1 + +phy_chain_tx_polarity_flip_physical{29.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x0 +phy_chain_tx_polarity_flip_physical{31.0}=0x0 +phy_chain_tx_polarity_flip_physical{32.0}=0x1 + +phy_chain_tx_polarity_flip_physical{33.0}=0x1 +phy_chain_tx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x1 +phy_chain_tx_polarity_flip_physical{36.0}=0x1 + +phy_chain_tx_polarity_flip_physical{37.0}=0x0 +phy_chain_tx_polarity_flip_physical{38.0}=0x1 +phy_chain_tx_polarity_flip_physical{39.0}=0x0 +phy_chain_tx_polarity_flip_physical{40.0}=0x1 + +phy_chain_tx_polarity_flip_physical{41.0}=0x1 +phy_chain_tx_polarity_flip_physical{42.0}=0x1 +phy_chain_tx_polarity_flip_physical{43.0}=0x0 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 + +phy_chain_tx_polarity_flip_physical{45.0}=0x0 +phy_chain_tx_polarity_flip_physical{46.0}=0x0 +phy_chain_tx_polarity_flip_physical{47.0}=0x0 +phy_chain_tx_polarity_flip_physical{48.0}=0x1 + +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{50.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{55.0}=0x1 +phy_chain_tx_polarity_flip_physical{56.0}=0x1 + +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x0 +phy_chain_tx_polarity_flip_physical{60.0}=0x0 + +phy_chain_tx_polarity_flip_physical{61.0}=0x1 +phy_chain_tx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x0 +phy_chain_tx_polarity_flip_physical{64.0}=0x1 + +# RX polarity +phy_chain_rx_polarity_flip_physical{1.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x1 +phy_chain_rx_polarity_flip_physical{3.0}=0x0 +phy_chain_rx_polarity_flip_physical{4.0}=0x1 + +phy_chain_rx_polarity_flip_physical{5.0}=0x1 +phy_chain_rx_polarity_flip_physical{6.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x0 +phy_chain_rx_polarity_flip_physical{8.0}=0x0 + +phy_chain_rx_polarity_flip_physical{9.0}=0x0 +phy_chain_rx_polarity_flip_physical{10.0}=0x1 +phy_chain_rx_polarity_flip_physical{11.0}=0x0 +phy_chain_rx_polarity_flip_physical{12.0}=0x0 + +phy_chain_rx_polarity_flip_physical{13.0}=0x0 +phy_chain_rx_polarity_flip_physical{14.0}=0x1 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x0 + +phy_chain_rx_polarity_flip_physical{17.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x1 +phy_chain_rx_polarity_flip_physical{19.0}=0x1 +phy_chain_rx_polarity_flip_physical{20.0}=0x0 + +phy_chain_rx_polarity_flip_physical{21.0}=0x1 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 + +phy_chain_rx_polarity_flip_physical{25.0}=0x1 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x0 +phy_chain_rx_polarity_flip_physical{28.0}=0x1 + +phy_chain_rx_polarity_flip_physical{29.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x1 +phy_chain_rx_polarity_flip_physical{31.0}=0x1 +phy_chain_rx_polarity_flip_physical{32.0}=0x0 + +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}=0x0 +phy_chain_rx_polarity_flip_physical{39.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x1 + +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}=0x0 + +phy_chain_rx_polarity_flip_physical{45.0}=0x1 +phy_chain_rx_polarity_flip_physical{46.0}=0x1 +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{50.0}=0x1 +phy_chain_rx_polarity_flip_physical{51.0}=0x1 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 + +phy_chain_rx_polarity_flip_physical{53.0}=0x1 +phy_chain_rx_polarity_flip_physical{54.0}=0x0 +phy_chain_rx_polarity_flip_physical{55.0}=0x0 +phy_chain_rx_polarity_flip_physical{56.0}=0x1 + +phy_chain_rx_polarity_flip_physical{57.0}=0x0 +phy_chain_rx_polarity_flip_physical{58.0}=0x1 +phy_chain_rx_polarity_flip_physical{59.0}=0x1 +phy_chain_rx_polarity_flip_physical{60.0}=0x0 + +phy_chain_rx_polarity_flip_physical{61.0}=0x1 +phy_chain_rx_polarity_flip_physical{62.0}=0x0 +phy_chain_rx_polarity_flip_physical{63.0}=0x0 +phy_chain_rx_polarity_flip_physical{64.0}=0x1 + +# TX lane swap +phy_chain_tx_lane_map_physical{1.0}=0x3120 +phy_chain_tx_lane_map_physical{5.0}=0x2130 +phy_chain_tx_lane_map_physical{9.0}=0x0213 +phy_chain_tx_lane_map_physical{13.0}=0x3021 + +phy_chain_tx_lane_map_physical{17.0}=0x3201 +phy_chain_tx_lane_map_physical{21.0}=0x3210 +phy_chain_tx_lane_map_physical{25.0}=0x1023 +phy_chain_tx_lane_map_physical{29.0}=0x0231 + +phy_chain_tx_lane_map_physical{33.0}=0x3210 +phy_chain_tx_lane_map_physical{37.0}=0x3120 +phy_chain_tx_lane_map_physical{41.0}=0x2031 +phy_chain_tx_lane_map_physical{45.0}=0x2130 + +phy_chain_tx_lane_map_physical{49.0}=0x2130 +phy_chain_tx_lane_map_physical{53.0}=0x3012 +phy_chain_tx_lane_map_physical{57.0}=0x2031 +phy_chain_tx_lane_map_physical{61.0}=0x0231 + +# RX lane swap +phy_chain_rx_lane_map_physical{1.0}=0x1320 +phy_chain_rx_lane_map_physical{5.0}=0x0213 +phy_chain_rx_lane_map_physical{9.0}=0x2301 +phy_chain_rx_lane_map_physical{13.0}=0x0321 + +phy_chain_rx_lane_map_physical{17.0}=0x2031 +phy_chain_rx_lane_map_physical{21.0}=0x1032 +phy_chain_rx_lane_map_physical{25.0}=0x2310 +phy_chain_rx_lane_map_physical{29.0}=0x2013 + +phy_chain_rx_lane_map_physical{33.0}=0x2103 +phy_chain_rx_lane_map_physical{37.0}=0x0132 +phy_chain_rx_lane_map_physical{41.0}=0x2031 +phy_chain_rx_lane_map_physical{45.0}=0x1032 + +phy_chain_rx_lane_map_physical{49.0}=0x3201 +phy_chain_rx_lane_map_physical{53.0}=0x0132 +phy_chain_rx_lane_map_physical{57.0}=0x2031 +phy_chain_rx_lane_map_physical{61.0}=0x1032 + +# +# Tile-1 FC16~FC31 +# +portmap_34=65:100 +portmap_35=69:100 +portmap_36=73:100 +portmap_37=77:100 +portmap_38=81:100 +portmap_39=85:100 +portmap_40=89:100 +portmap_41=93:100 +portmap_42=97:100 +portmap_43=101:100 +portmap_44=105:100 +portmap_45=109:100 +portmap_46=113:100 +portmap_47=117:100 +portmap_48=121:100 +portmap_49=125:100 + +#TX polarity +phy_chain_tx_polarity_flip_physical{65.0}=0x1 +phy_chain_tx_polarity_flip_physical{66.0}=0x1 +phy_chain_tx_polarity_flip_physical{67.0}=0x0 +phy_chain_tx_polarity_flip_physical{68.0}=0x0 + +phy_chain_tx_polarity_flip_physical{69.0}=0x1 +phy_chain_tx_polarity_flip_physical{70.0}=0x0 +phy_chain_tx_polarity_flip_physical{71.0}=0x1 +phy_chain_tx_polarity_flip_physical{72.0}=0x1 + +phy_chain_tx_polarity_flip_physical{73.0}=0x0 +phy_chain_tx_polarity_flip_physical{74.0}=0x1 +phy_chain_tx_polarity_flip_physical{75.0}=0x1 +phy_chain_tx_polarity_flip_physical{76.0}=0x0 + +phy_chain_tx_polarity_flip_physical{77.0}=0x1 +phy_chain_tx_polarity_flip_physical{78.0}=0x1 +phy_chain_tx_polarity_flip_physical{79.0}=0x1 +phy_chain_tx_polarity_flip_physical{80.0}=0x1 + +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}=0x0 +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}=0x1 +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}=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}=0x1 +phy_chain_tx_polarity_flip_physical{94.0}=0x1 +phy_chain_tx_polarity_flip_physical{95.0}=0x1 +phy_chain_tx_polarity_flip_physical{96.0}=0x1 + +phy_chain_tx_polarity_flip_physical{97.0}=0x0 +phy_chain_tx_polarity_flip_physical{98.0}=0x0 +phy_chain_tx_polarity_flip_physical{99.0}=0x0 +phy_chain_tx_polarity_flip_physical{100.0}=0x1 + +phy_chain_tx_polarity_flip_physical{101.0}=0x1 +phy_chain_tx_polarity_flip_physical{102.0}=0x0 +phy_chain_tx_polarity_flip_physical{103.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{108.0}=0x0 + +phy_chain_tx_polarity_flip_physical{109.0}=0x0 +phy_chain_tx_polarity_flip_physical{110.0}=0x1 +phy_chain_tx_polarity_flip_physical{111.0}=0x0 +phy_chain_tx_polarity_flip_physical{112.0}=0x0 + +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x0 +phy_chain_tx_polarity_flip_physical{115.0}=0x0 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 + +phy_chain_tx_polarity_flip_physical{117.0}=0x0 +phy_chain_tx_polarity_flip_physical{118.0}=0x1 +phy_chain_tx_polarity_flip_physical{119.0}=0x0 +phy_chain_tx_polarity_flip_physical{120.0}=0x0 + +phy_chain_tx_polarity_flip_physical{121.0}=0x1 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_tx_polarity_flip_physical{123.0}=0x1 +phy_chain_tx_polarity_flip_physical{124.0}=0x0 + +phy_chain_tx_polarity_flip_physical{125.0}=0x1 +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 + +#RX polarity +phy_chain_rx_polarity_flip_physical{65.0}=0x0 +phy_chain_rx_polarity_flip_physical{66.0}=0x0 +phy_chain_rx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x1 + +phy_chain_rx_polarity_flip_physical{69.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}=0x0 + +phy_chain_rx_polarity_flip_physical{73.0}=0x0 +phy_chain_rx_polarity_flip_physical{74.0}=0x1 +phy_chain_rx_polarity_flip_physical{75.0}=0x1 +phy_chain_rx_polarity_flip_physical{76.0}=0x0 + +phy_chain_rx_polarity_flip_physical{77.0}=0x1 +phy_chain_rx_polarity_flip_physical{78.0}=0x1 +phy_chain_rx_polarity_flip_physical{79.0}=0x0 +phy_chain_rx_polarity_flip_physical{80.0}=0x1 + +phy_chain_rx_polarity_flip_physical{81.0}=0x0 +phy_chain_rx_polarity_flip_physical{82.0}=0x0 +phy_chain_rx_polarity_flip_physical{83.0}=0x0 +phy_chain_rx_polarity_flip_physical{84.0}=0x1 + +phy_chain_rx_polarity_flip_physical{85.0}=0x0 +phy_chain_rx_polarity_flip_physical{86.0}=0x0 +phy_chain_rx_polarity_flip_physical{87.0}=0x1 +phy_chain_rx_polarity_flip_physical{88.0}=0x0 + +phy_chain_rx_polarity_flip_physical{89.0}=0x0 +phy_chain_rx_polarity_flip_physical{90.0}=0x1 +phy_chain_rx_polarity_flip_physical{91.0}=0x1 +phy_chain_rx_polarity_flip_physical{92.0}=0x0 + +phy_chain_rx_polarity_flip_physical{93.0}=0x0 +phy_chain_rx_polarity_flip_physical{94.0}=0x1 +phy_chain_rx_polarity_flip_physical{95.0}=0x0 +phy_chain_rx_polarity_flip_physical{96.0}=0x0 + +phy_chain_rx_polarity_flip_physical{97.0}=0x0 +phy_chain_rx_polarity_flip_physical{98.0}=0x1 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x1 + +phy_chain_rx_polarity_flip_physical{101.0}=0x0 +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}=0x1 + +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}=0x0 +phy_chain_rx_polarity_flip_physical{108.0}=0x1 + +phy_chain_rx_polarity_flip_physical{109.0}=0x0 +phy_chain_rx_polarity_flip_physical{110.0}=0x1 +phy_chain_rx_polarity_flip_physical{111.0}=0x1 +phy_chain_rx_polarity_flip_physical{112.0}=0x1 + +phy_chain_rx_polarity_flip_physical{113.0}=0x0 +phy_chain_rx_polarity_flip_physical{114.0}=0x1 +phy_chain_rx_polarity_flip_physical{115.0}=0x1 +phy_chain_rx_polarity_flip_physical{116.0}=0x0 + +phy_chain_rx_polarity_flip_physical{117.0}=0x1 +phy_chain_rx_polarity_flip_physical{118.0}=0x0 +phy_chain_rx_polarity_flip_physical{119.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}=0x1 +phy_chain_rx_polarity_flip_physical{123.0}=0x0 +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}=0x0 + +# TX lane swap +phy_chain_tx_lane_map_physical{65.0}=0x2130 +phy_chain_tx_lane_map_physical{69.0}=0x3012 +phy_chain_tx_lane_map_physical{73.0}=0x2031 +phy_chain_tx_lane_map_physical{77.0}=0x0231 + +phy_chain_tx_lane_map_physical{81.0}=0x2130 +phy_chain_tx_lane_map_physical{85.0}=0x1032 +phy_chain_tx_lane_map_physical{89.0}=0x2031 +phy_chain_tx_lane_map_physical{93.0}=0x0231 + +phy_chain_tx_lane_map_physical{97.0}=0x0123 +phy_chain_tx_lane_map_physical{101.0}=0x1320 +phy_chain_tx_lane_map_physical{105.0}=0x2301 +phy_chain_tx_lane_map_physical{109.0}=0x0213 + +phy_chain_tx_lane_map_physical{113.0}=0x0123 +phy_chain_tx_lane_map_physical{117.0}=0x1023 +phy_chain_tx_lane_map_physical{121.0}=0x2130 +phy_chain_tx_lane_map_physical{125.0}=0x1302 + +# RX lane swap +phy_chain_rx_lane_map_physical{65.0}=0x2103 +phy_chain_rx_lane_map_physical{69.0}=0x3210 +phy_chain_rx_lane_map_physical{73.0}=0x2031 +phy_chain_rx_lane_map_physical{77.0}=0x1032 + +phy_chain_rx_lane_map_physical{81.0}=0x2103 +phy_chain_rx_lane_map_physical{85.0}=0x3210 +phy_chain_rx_lane_map_physical{89.0}=0x2031 +phy_chain_rx_lane_map_physical{93.0}=0x1032 + +phy_chain_rx_lane_map_physical{97.0}=0x1023 +phy_chain_rx_lane_map_physical{101.0}=0x3120 +phy_chain_rx_lane_map_physical{105.0}=0x1023 +phy_chain_rx_lane_map_physical{109.0}=0x0231 + +phy_chain_rx_lane_map_physical{113.0}=0x1320 +phy_chain_rx_lane_map_physical{117.0}=0x3102 +phy_chain_rx_lane_map_physical{121.0}=0x0213 +phy_chain_rx_lane_map_physical{125.0}=0x0231 + +# +# Tile-2 FC32~FC47 +# +# port 66 is the first management port +portmap_66=257:10 +# port 67 is the second loopback port +#portmap_67=261:10 +portmap_68=129:100 +portmap_69=133:100 +portmap_70=137:100 +portmap_71=141:100 +portmap_72=145:100 +portmap_73=149:100 +portmap_74=153:100 +portmap_75=157:100 +portmap_76=161:100 +portmap_77=165:100 +portmap_78=169:100 +portmap_79=173:100 +portmap_80=177:100 +portmap_81=181:100 +portmap_82=185:100 +portmap_83=189:100 + +# TX polarity +phy_chain_tx_polarity_flip_physical{129.0}=0x1 +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}=0x1 + +phy_chain_tx_polarity_flip_physical{133.0}=0x0 +phy_chain_tx_polarity_flip_physical{134.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{139.0}=0x1 +phy_chain_tx_polarity_flip_physical{140.0}=0x0 + +phy_chain_tx_polarity_flip_physical{141.0}=0x1 +phy_chain_tx_polarity_flip_physical{142.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{147.0}=0x0 +phy_chain_tx_polarity_flip_physical{148.0}=0x1 + +phy_chain_tx_polarity_flip_physical{149.0}=0x0 +phy_chain_tx_polarity_flip_physical{150.0}=0x1 +phy_chain_tx_polarity_flip_physical{151.0}=0x1 +phy_chain_tx_polarity_flip_physical{152.0}=0x1 + +phy_chain_tx_polarity_flip_physical{153.0}=0x0 +phy_chain_tx_polarity_flip_physical{154.0}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{160.0}=0x0 + +phy_chain_tx_polarity_flip_physical{161.0}=0x1 +phy_chain_tx_polarity_flip_physical{162.0}=0x0 +phy_chain_tx_polarity_flip_physical{163.0}=0x0 +phy_chain_tx_polarity_flip_physical{164.0}=0x1 + +phy_chain_tx_polarity_flip_physical{165.0}=0x1 +phy_chain_tx_polarity_flip_physical{166.0}=0x0 +phy_chain_tx_polarity_flip_physical{167.0}=0x0 +phy_chain_tx_polarity_flip_physical{168.0}=0x0 + +phy_chain_tx_polarity_flip_physical{169.0}=0x0 +phy_chain_tx_polarity_flip_physical{170.0}=0x0 +phy_chain_tx_polarity_flip_physical{171.0}=0x0 +phy_chain_tx_polarity_flip_physical{172.0}=0x0 + +phy_chain_tx_polarity_flip_physical{173.0}=0x0 +phy_chain_tx_polarity_flip_physical{174.0}=0x1 +phy_chain_tx_polarity_flip_physical{175.0}=0x0 +phy_chain_tx_polarity_flip_physical{176.0}=0x1 + +phy_chain_tx_polarity_flip_physical{177.0}=0x0 +phy_chain_tx_polarity_flip_physical{178.0}=0x0 +phy_chain_tx_polarity_flip_physical{179.0}=0x0 +phy_chain_tx_polarity_flip_physical{180.0}=0x0 + +phy_chain_tx_polarity_flip_physical{181.0}=0x1 +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}=0x0 + +phy_chain_tx_polarity_flip_physical{185.0}=0x0 +phy_chain_tx_polarity_flip_physical{186.0}=0x0 +phy_chain_tx_polarity_flip_physical{187.0}=0x0 +phy_chain_tx_polarity_flip_physical{188.0}=0x0 + +phy_chain_tx_polarity_flip_physical{189.0}=0x1 +phy_chain_tx_polarity_flip_physical{190.0}=0x0 +phy_chain_tx_polarity_flip_physical{191.0}=0x1 +phy_chain_tx_polarity_flip_physical{192.0}=0x0 + +# RX polarity +phy_chain_rx_polarity_flip_physical{129.0}=0x0 +phy_chain_rx_polarity_flip_physical{130.0}=0x0 +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}=0x0 +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}=0x1 +phy_chain_rx_polarity_flip_physical{138.0}=0x0 +phy_chain_rx_polarity_flip_physical{139.0}=0x1 +phy_chain_rx_polarity_flip_physical{140.0}=0x1 + +phy_chain_rx_polarity_flip_physical{141.0}=0x0 +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}=0x1 + +phy_chain_rx_polarity_flip_physical{145.0}=0x0 +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{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}=0x0 +phy_chain_rx_polarity_flip_physical{156.0}=0x0 + +phy_chain_rx_polarity_flip_physical{157.0}=0x1 +phy_chain_rx_polarity_flip_physical{158.0}=0x1 +phy_chain_rx_polarity_flip_physical{159.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}=0x1 +phy_chain_rx_polarity_flip_physical{167.0}=0x1 +phy_chain_rx_polarity_flip_physical{168.0}=0x0 + +phy_chain_rx_polarity_flip_physical{169.0}=0x0 +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}=0x1 + +phy_chain_rx_polarity_flip_physical{173.0}=0x0 +phy_chain_rx_polarity_flip_physical{174.0}=0x1 +phy_chain_rx_polarity_flip_physical{175.0}=0x0 +phy_chain_rx_polarity_flip_physical{176.0}=0x0 + +phy_chain_rx_polarity_flip_physical{177.0}=0x1 +phy_chain_rx_polarity_flip_physical{178.0}=0x0 +phy_chain_rx_polarity_flip_physical{179.0}=0x0 +phy_chain_rx_polarity_flip_physical{180.0}=0x1 + +phy_chain_rx_polarity_flip_physical{181.0}=0x0 +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}=0x1 + +phy_chain_rx_polarity_flip_physical{185.0}=0x1 +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}=0x0 + +phy_chain_rx_polarity_flip_physical{189.0}=0x1 +phy_chain_rx_polarity_flip_physical{190.0}=0x1 +phy_chain_rx_polarity_flip_physical{191.0}=0x0 +phy_chain_rx_polarity_flip_physical{192.0}=0x0 + +# TX lane swap +phy_chain_tx_lane_map_physical{129.0}=0x0312 +phy_chain_tx_lane_map_physical{133.0}=0x3120 +phy_chain_tx_lane_map_physical{137.0}=0x1203 +phy_chain_tx_lane_map_physical{141.0}=0x0132 + +phy_chain_tx_lane_map_physical{145.0}=0x0312 +phy_chain_tx_lane_map_physical{149.0}=0x2310 +phy_chain_tx_lane_map_physical{153.0}=0x1032 +phy_chain_tx_lane_map_physical{157.0}=0x3120 + +phy_chain_tx_lane_map_physical{161.0}=0x1023 +phy_chain_tx_lane_map_physical{165.0}=0x1203 +phy_chain_tx_lane_map_physical{169.0}=0x0213 +phy_chain_tx_lane_map_physical{173.0}=0x0123 + +phy_chain_tx_lane_map_physical{177.0}=0x2031 +phy_chain_tx_lane_map_physical{181.0}=0x1203 +phy_chain_tx_lane_map_physical{185.0}=0x0213 +phy_chain_tx_lane_map_physical{189.0}=0x3210 + +# RX lane swap +phy_chain_rx_lane_map_physical{129.0}=0x0321 +phy_chain_rx_lane_map_physical{133.0}=0x0312 +phy_chain_rx_lane_map_physical{137.0}=0x2103 +phy_chain_rx_lane_map_physical{141.0}=0x0231 + +phy_chain_rx_lane_map_physical{145.0}=0x0321 +phy_chain_rx_lane_map_physical{149.0}=0x0312 +phy_chain_rx_lane_map_physical{153.0}=0x3120 +phy_chain_rx_lane_map_physical{157.0}=0x2103 + +phy_chain_rx_lane_map_physical{161.0}=0x1032 +phy_chain_rx_lane_map_physical{165.0}=0x2031 +phy_chain_rx_lane_map_physical{169.0}=0x0132 +phy_chain_rx_lane_map_physical{173.0}=0x2103 + +phy_chain_rx_lane_map_physical{177.0}=0x1032 +phy_chain_rx_lane_map_physical{181.0}=0x1230 +phy_chain_rx_lane_map_physical{185.0}=0x0321 +phy_chain_rx_lane_map_physical{189.0}=0x3201 + +# +# Tile-3 FC48~FC63 +# portmap_0=x:xx // cpu port (not required, but included for illustration purposes) +# +# port 100 is the second management port +portmap_100=259:10 +# port 101 is the third loopback port +#portmap_101=262:10 +portmap_102=193:100 +portmap_103=197:100 +portmap_104=201:100 +portmap_105=205:100 +portmap_106=209:100 +portmap_107=213:100 +portmap_108=217:100 +portmap_109=221:100 +portmap_110=225:100 +portmap_111=229:100 +portmap_112=233:100 +portmap_113=237:100 +portmap_114=241:100 +portmap_115=245:100 +portmap_116=249:100 +portmap_117=253:100 +# port 135 is the fourth loopback port +portmap_135=263:10 + +# TX polarity +phy_chain_tx_polarity_flip_physical{193.0}=0x0 +phy_chain_tx_polarity_flip_physical{194.0}=0x0 +phy_chain_tx_polarity_flip_physical{195.0}=0x0 +phy_chain_tx_polarity_flip_physical{196.0}=0x0 + +phy_chain_tx_polarity_flip_physical{197.0}=0x1 +phy_chain_tx_polarity_flip_physical{198.0}=0x0 +phy_chain_tx_polarity_flip_physical{199.0}=0x1 +phy_chain_tx_polarity_flip_physical{200.0}=0x0 + +phy_chain_tx_polarity_flip_physical{201.0}=0x0 +phy_chain_tx_polarity_flip_physical{202.0}=0x0 +phy_chain_tx_polarity_flip_physical{203.0}=0x0 +phy_chain_tx_polarity_flip_physical{204.0}=0x0 + +phy_chain_tx_polarity_flip_physical{205.0}=0x1 +phy_chain_tx_polarity_flip_physical{206.0}=0x0 +phy_chain_tx_polarity_flip_physical{207.0}=0x1 +phy_chain_tx_polarity_flip_physical{208.0}=0x0 + +phy_chain_tx_polarity_flip_physical{209.0}=0x1 +phy_chain_tx_polarity_flip_physical{210.0}=0x0 +phy_chain_tx_polarity_flip_physical{211.0}=0x0 +phy_chain_tx_polarity_flip_physical{212.0}=0x1 + +phy_chain_tx_polarity_flip_physical{213.0}=0x1 +phy_chain_tx_polarity_flip_physical{214.0}=0x0 +phy_chain_tx_polarity_flip_physical{215.0}=0x0 +phy_chain_tx_polarity_flip_physical{216.0}=0x0 + +phy_chain_tx_polarity_flip_physical{217.0}=0x0 +phy_chain_tx_polarity_flip_physical{218.0}=0x0 +phy_chain_tx_polarity_flip_physical{219.0}=0x0 +phy_chain_tx_polarity_flip_physical{220.0}=0x0 + +phy_chain_tx_polarity_flip_physical{221.0}=0x0 +phy_chain_tx_polarity_flip_physical{222.0}=0x1 +phy_chain_tx_polarity_flip_physical{223.0}=0x1 +phy_chain_tx_polarity_flip_physical{224.0}=0x0 + +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}=0x0 +phy_chain_tx_polarity_flip_physical{228.0}=0x0 + +phy_chain_tx_polarity_flip_physical{229.0}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{236.0}=0x1 + +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}=0x0 +phy_chain_tx_polarity_flip_physical{240.0}=0x0 + +phy_chain_tx_polarity_flip_physical{241.0}=0x0 +phy_chain_tx_polarity_flip_physical{242.0}=0x1 +phy_chain_tx_polarity_flip_physical{243.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{247.0}=0x0 +phy_chain_tx_polarity_flip_physical{248.0}=0x0 + +phy_chain_tx_polarity_flip_physical{249.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{255.0}=0x0 +phy_chain_tx_polarity_flip_physical{256.0}=0x0 + +# RX polarity +phy_chain_rx_polarity_flip_physical{193.0}=0x1 +phy_chain_rx_polarity_flip_physical{194.0}=0x0 +phy_chain_rx_polarity_flip_physical{195.0}=0x0 +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{200.0}=0x1 + +phy_chain_rx_polarity_flip_physical{201.0}=0x1 +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}=0x1 + +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{210.0}=0x1 +phy_chain_rx_polarity_flip_physical{211.0}=0x0 +phy_chain_rx_polarity_flip_physical{212.0}=0x1 + +phy_chain_rx_polarity_flip_physical{213.0}=0x0 +phy_chain_rx_polarity_flip_physical{214.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{218.0}=0x0 +phy_chain_rx_polarity_flip_physical{219.0}=0x1 +phy_chain_rx_polarity_flip_physical{220.0}=0x1 + +phy_chain_rx_polarity_flip_physical{221.0}=0x1 +phy_chain_rx_polarity_flip_physical{222.0}=0x1 +phy_chain_rx_polarity_flip_physical{223.0}=0x0 +phy_chain_rx_polarity_flip_physical{224.0}=0x0 + +phy_chain_rx_polarity_flip_physical{225.0}=0x1 +phy_chain_rx_polarity_flip_physical{226.0}=0x1 +phy_chain_rx_polarity_flip_physical{227.0}=0x1 +phy_chain_rx_polarity_flip_physical{228.0}=0x0 + +phy_chain_rx_polarity_flip_physical{229.0}=0x1 +phy_chain_rx_polarity_flip_physical{230.0}=0x0 +phy_chain_rx_polarity_flip_physical{231.0}=0x0 +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}=0x1 +phy_chain_rx_polarity_flip_physical{235.0}=0x1 +phy_chain_rx_polarity_flip_physical{236.0}=0x0 + +phy_chain_rx_polarity_flip_physical{237.0}=0x0 +phy_chain_rx_polarity_flip_physical{238.0}=0x1 +phy_chain_rx_polarity_flip_physical{239.0}=0x0 +phy_chain_rx_polarity_flip_physical{240.0}=0x0 + +phy_chain_rx_polarity_flip_physical{241.0}=0x0 +phy_chain_rx_polarity_flip_physical{242.0}=0x1 +phy_chain_rx_polarity_flip_physical{243.0}=0x0 +phy_chain_rx_polarity_flip_physical{244.0}=0x1 + +phy_chain_rx_polarity_flip_physical{245.0}=0x1 +phy_chain_rx_polarity_flip_physical{246.0}=0x0 +phy_chain_rx_polarity_flip_physical{247.0}=0x0 +phy_chain_rx_polarity_flip_physical{248.0}=0x1 + +phy_chain_rx_polarity_flip_physical{249.0}=0x0 +phy_chain_rx_polarity_flip_physical{250.0}=0x0 +phy_chain_rx_polarity_flip_physical{251.0}=0x1 +phy_chain_rx_polarity_flip_physical{252.0}=0x0 + +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}=0x0 +phy_chain_rx_polarity_flip_physical{256.0}=0x0 + +# TX lane swap +phy_chain_tx_lane_map_physical{193.0}=0x2031 +phy_chain_tx_lane_map_physical{197.0}=0x1203 +phy_chain_tx_lane_map_physical{201.0}=0x0213 +phy_chain_tx_lane_map_physical{205.0}=0x3210 + +phy_chain_tx_lane_map_physical{209.0}=0x1023 +phy_chain_tx_lane_map_physical{213.0}=0x1203 +phy_chain_tx_lane_map_physical{217.0}=0x0213 +phy_chain_tx_lane_map_physical{221.0}=0x3102 + +phy_chain_tx_lane_map_physical{225.0}=0x2031 +phy_chain_tx_lane_map_physical{229.0}=0x1023 +phy_chain_tx_lane_map_physical{233.0}=0x1320 +phy_chain_tx_lane_map_physical{237.0}=0x2013 + +phy_chain_tx_lane_map_physical{241.0}=0x1023 +phy_chain_tx_lane_map_physical{245.0}=0x1203 +phy_chain_tx_lane_map_physical{249.0}=0x3120 +phy_chain_tx_lane_map_physical{253.0}=0x3210 + +# RX lane swap +phy_chain_rx_lane_map_physical{193.0}=0x1032 +phy_chain_rx_lane_map_physical{197.0}=0x1230 +phy_chain_rx_lane_map_physical{201.0}=0x0321 +phy_chain_rx_lane_map_physical{205.0}=0x3201 + +phy_chain_rx_lane_map_physical{209.0}=0x3201 +phy_chain_rx_lane_map_physical{213.0}=0x2031 +phy_chain_rx_lane_map_physical{217.0}=0x0321 +phy_chain_rx_lane_map_physical{221.0}=0x3201 + +phy_chain_rx_lane_map_physical{225.0}=0x2103 +phy_chain_rx_lane_map_physical{229.0}=0x2310 +phy_chain_rx_lane_map_physical{233.0}=0x0213 +phy_chain_rx_lane_map_physical{237.0}=0x1032 + +phy_chain_rx_lane_map_physical{241.0}=0x0321 +phy_chain_rx_lane_map_physical{245.0}=0x2301 +phy_chain_rx_lane_map_physical{249.0}=0x2103 +phy_chain_rx_lane_map_physical{253.0}=0x2013 + +physical_ports=64 +logical_ports=136 +uplink_ports=2 +dport_map_port_66=65 +dport_map_port_100=66 + +module_64ports=1 diff --git a/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/sai.profile b/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/sai.profile index 142de3e860c9..094e2d2cda01 100644 --- a/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/sai.profile +++ b/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-ag5648-48x25G+6x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-ag5648-48x25G+6x100G.config.bcm diff --git a/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/th-ag5648-48x25G+6x100G.config.bcm b/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/th-ag5648-48x25G+6x100G.config.bcm new file mode 100644 index 000000000000..86afb258fd1b --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/Delta-ag5648/th-ag5648-48x25G+6x100G.config.bcm @@ -0,0 +1,277 @@ +os=unix +schan_intr_enable=0 +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 +pbmp_oversubscribe=0x000fffc0000ffff0003ffffc0000001e +pbmp_xport_xe=0x000fffc0000ffff0003ffffc0000001e + +# Tile-0: 1, 5, 9, 21 +portmap_1=1:100 +portmap_2=5:100 +portmap_3=9:100 +portmap_4=21:100 + +## TX lane swap +xgxs_tx_lane_map_1=0x0123 +xgxs_tx_lane_map_2=0x2301 +xgxs_tx_lane_map_3=0x0123 +xgxs_tx_lane_map_4=0x1302 + +## RX lane swap +xgxs_rx_lane_map_1=0x0123 +xgxs_rx_lane_map_2=0x2301 +xgxs_rx_lane_map_3=0x0123 +xgxs_rx_lane_map_4=0x2031 + +## TX polarity +phy_xaui_tx_polarity_flip_1=0x0 +phy_xaui_tx_polarity_flip_2=0xf +phy_xaui_tx_polarity_flip_3=0x0 +phy_xaui_tx_polarity_flip_4=0xf + +## RX polarity +phy_xaui_rx_polarity_flip_1=0x0 +phy_xaui_rx_polarity_flip_2=0xf +phy_xaui_rx_polarity_flip_3=0x0 +phy_xaui_rx_polarity_flip_4=0xf + + +# Tile-1: 8, 9, 11, 12, 13 +portmap_34=33:25 +portmap_35=34:25 +portmap_36=35:25 +portmap_37=36:25 +portmap_38=37:25 +portmap_39=38:25 +portmap_40=39:25 +portmap_41=40:25 +portmap_42=41:25 +portmap_43=42:25 +portmap_44=43:25 +portmap_45=44:25 +portmap_46=49:25 +portmap_47=50:25 +portmap_48=51:25 +portmap_49=52:25 +portmap_50=53:25 +portmap_51=54:25 +portmap_52=55:25 +portmap_53=56:25 + + +## TX lane swap +xgxs_tx_lane_map_34=0x3210 +xgxs_tx_lane_map_38=0x0123 +xgxs_tx_lane_map_42=0x2031 +xgxs_tx_lane_map_46=0x0123 +xgxs_tx_lane_map_50=0x0123 + +## RX lane swap +xgxs_rx_lane_map_34=0x2301 +xgxs_rx_lane_map_38=0x1032 +xgxs_rx_lane_map_42=0x0213 +xgxs_rx_lane_map_46=0x2301 +xgxs_rx_lane_map_50=0x2301 + + +## TX polarity +phy_xaui_tx_polarity_flip_34=0x0 +phy_xaui_tx_polarity_flip_35=0x1 +phy_xaui_tx_polarity_flip_36=0x0 +phy_xaui_tx_polarity_flip_37=0x1 + +phy_xaui_tx_polarity_flip_38=0x1 +phy_xaui_tx_polarity_flip_39=0x0 +phy_xaui_tx_polarity_flip_40=0x1 +phy_xaui_tx_polarity_flip_41=0x0 + +phy_xaui_tx_polarity_flip_42=0x1 +phy_xaui_tx_polarity_flip_43=0x0 +phy_xaui_tx_polarity_flip_44=0x1 +phy_xaui_tx_polarity_flip_45=0x0 + +phy_xaui_tx_polarity_flip_46=0x0 +phy_xaui_tx_polarity_flip_47=0x1 +phy_xaui_tx_polarity_flip_48=0x0 +phy_xaui_tx_polarity_flip_49=0x1 + +phy_xaui_tx_polarity_flip_50=0x0 +phy_xaui_tx_polarity_flip_51=0x1 +phy_xaui_tx_polarity_flip_52=0x0 +phy_xaui_tx_polarity_flip_53=0x1 + + +## RX polarity +phy_xaui_rx_polarity_flip_34=0x0 +phy_xaui_rx_polarity_flip_35=0x1 +phy_xaui_rx_polarity_flip_36=0x0 +phy_xaui_rx_polarity_flip_37=0x1 + +phy_xaui_rx_polarity_flip_38=0x1 +phy_xaui_rx_polarity_flip_39=0x0 +phy_xaui_rx_polarity_flip_40=0x1 +phy_xaui_rx_polarity_flip_41=0x0 + +phy_xaui_rx_polarity_flip_42=0x1 +phy_xaui_rx_polarity_flip_43=0x0 +phy_xaui_rx_polarity_flip_44=0x1 +phy_xaui_rx_polarity_flip_45=0x0 + +phy_xaui_rx_polarity_flip_46=0x0 +phy_xaui_rx_polarity_flip_47=0x1 +phy_xaui_rx_polarity_flip_48=0x0 +phy_xaui_rx_polarity_flip_49=0x1 + +phy_xaui_rx_polarity_flip_50=0x0 +phy_xaui_rx_polarity_flip_51=0x1 +phy_xaui_rx_polarity_flip_52=0x0 +phy_xaui_rx_polarity_flip_53=0x1 + + +# Tile-2: 16, 17, 20, 21 +portmap_68=65:25 +portmap_69=66:25 +portmap_70=67:25 +portmap_71=68:25 +portmap_72=69:25 +portmap_73=70:25 +portmap_74=71:25 +portmap_75=72:25 +portmap_76=81:25 +portmap_77=82:25 +portmap_78=83:25 +portmap_79=84:25 +portmap_80=85:25 +portmap_81=86:25 +portmap_82=87:25 +portmap_83=88:25 + + +## TX lane swap +xgxs_tx_lane_map_68=0x3210 +xgxs_tx_lane_map_72=0x0123 +xgxs_tx_lane_map_76=0x0123 +xgxs_tx_lane_map_80=0x3210 + +## RX lane swap +xgxs_rx_lane_map_68=0x1032 +xgxs_rx_lane_map_72=0x2301 +xgxs_rx_lane_map_76=0x0123 +xgxs_rx_lane_map_80=0x3210 + + +## TX polarity +phy_xaui_tx_polarity_flip_68=0x0 +phy_xaui_tx_polarity_flip_69=0x1 +phy_xaui_tx_polarity_flip_70=0x0 +phy_xaui_tx_polarity_flip_71=0x1 + +phy_xaui_tx_polarity_flip_72=0x0 +phy_xaui_tx_polarity_flip_73=0x1 +phy_xaui_tx_polarity_flip_74=0x0 +phy_xaui_tx_polarity_flip_75=0x1 + +phy_xaui_tx_polarity_flip_76=0x0 +phy_xaui_tx_polarity_flip_77=0x1 +phy_xaui_tx_polarity_flip_78=0x0 +phy_xaui_tx_polarity_flip_79=0x1 + +phy_xaui_tx_polarity_flip_80=0x1 +phy_xaui_tx_polarity_flip_81=0x0 +phy_xaui_tx_polarity_flip_82=0x1 +phy_xaui_tx_polarity_flip_83=0x0 + +## RX polarity +phy_xaui_rx_polarity_flip_68=0x0 +phy_xaui_rx_polarity_flip_69=0x1 +phy_xaui_rx_polarity_flip_70=0x0 +phy_xaui_rx_polarity_flip_71=0x1 + +phy_xaui_rx_polarity_flip_72=0x0 +phy_xaui_rx_polarity_flip_73=0x1 +phy_xaui_rx_polarity_flip_74=0x0 +phy_xaui_rx_polarity_flip_75=0x1 + +phy_xaui_rx_polarity_flip_76=0x0 +phy_xaui_rx_polarity_flip_77=0x1 +phy_xaui_rx_polarity_flip_78=0x0 +phy_xaui_rx_polarity_flip_79=0x1 + +phy_xaui_rx_polarity_flip_80=0x1 +phy_xaui_rx_polarity_flip_81=0x0 +phy_xaui_rx_polarity_flip_82=0x1 +phy_xaui_rx_polarity_flip_83=0x0 + + +# Tile-3: 24, 25, 26; 27, 29 +portmap_102=97:25 +portmap_103=98:25 +portmap_104=99:25 +portmap_105=100:25 +portmap_106=101:25 +portmap_107=102:25 +portmap_108=103:25 +portmap_109=104:25 +portmap_110=105:25 +portmap_111=106:25 +portmap_112=107:25 +portmap_113=108:25 +portmap_114=109:100 +portmap_115=117:100 + + +## TX lane swap +xgxs_tx_lane_map_102=0x0123 +xgxs_tx_lane_map_106=0x3210 +xgxs_tx_lane_map_110=0x0123 +xgxs_tx_lane_map_114=0x3120 +xgxs_tx_lane_map_115=0x2301 + +## RX lane swap +xgxs_rx_lane_map_102=0x0123 +xgxs_rx_lane_map_106=0x3210 +xgxs_rx_lane_map_110=0x0123 +xgxs_rx_lane_map_114=0x3120 +xgxs_rx_lane_map_115=0x2301 + +## TX polarity +phy_xaui_tx_polarity_flip_102=0 +phy_xaui_tx_polarity_flip_103=1 +phy_xaui_tx_polarity_flip_104=0 +phy_xaui_tx_polarity_flip_105=1 + +phy_xaui_tx_polarity_flip_106=1 +phy_xaui_tx_polarity_flip_107=0 +phy_xaui_tx_polarity_flip_108=1 +phy_xaui_tx_polarity_flip_109=0 + +phy_xaui_tx_polarity_flip_110=0 +phy_xaui_tx_polarity_flip_111=1 +phy_xaui_tx_polarity_flip_112=0 +phy_xaui_tx_polarity_flip_113=1 + +phy_xaui_tx_polarity_flip_114=0xf +phy_xaui_tx_polarity_flip_115=0xf + +## RX polarity +phy_xaui_rx_polarity_flip_102=0 +phy_xaui_rx_polarity_flip_103=1 +phy_xaui_rx_polarity_flip_104=0 +phy_xaui_rx_polarity_flip_105=1 + +phy_xaui_rx_polarity_flip_106=1 +phy_xaui_rx_polarity_flip_107=0 +phy_xaui_rx_polarity_flip_108=1 +phy_xaui_rx_polarity_flip_109=0 + +phy_xaui_rx_polarity_flip_110=0 +phy_xaui_rx_polarity_flip_111=1 +phy_xaui_rx_polarity_flip_112=0 +phy_xaui_rx_polarity_flip_113=1 + +phy_xaui_rx_polarity_flip_114=0xf +phy_xaui_rx_polarity_flip_115=0xf diff --git a/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile index 08d9e7fa3b47..c77b2bf79a34 100644 --- a/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile +++ b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-ag9032v1-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-ag9032v1-32x100G.config.bcm diff --git a/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/th-ag9032v1-32x100G.config.bcm b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/th-ag9032v1-32x100G.config.bcm new file mode 100644 index 000000000000..a088c8f7a6be --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/Delta-ag9032v1/th-ag9032v1-32x100G.config.bcm @@ -0,0 +1,523 @@ +os=unix +schan_intr_enable=0 +ctr_evict_enable=0 +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 +pbmp_oversubscribe=0x00003fc000000ff0000003fc000001fe +pbmp_xport_xe=0x00003fc000000ff0000003fc000001fe +port_phy_clause_1=45 +port_phy_clause_2=45 +port_phy_clause_3=45 +port_phy_clause_4=45 +port_phy_clause_5=45 +port_phy_clause_6=45 +port_phy_clause_7=45 +port_phy_clause_8=45 + +port_phy_clause_34=45 +port_phy_clause_35=45 +port_phy_clause_36=45 +port_phy_clause_37=45 +port_phy_clause_38=45 +port_phy_clause_39=45 +port_phy_clause_40=45 +port_phy_clause_41=45 + +port_phy_clause_68=45 +port_phy_clause_69=45 +port_phy_clause_70=45 +port_phy_clause_71=45 +port_phy_clause_72=45 +port_phy_clause_73=45 +port_phy_clause_74=45 +port_phy_clause_75=45 + +port_phy_clause_102=45 +port_phy_clause_103=45 +port_phy_clause_104=45 +port_phy_clause_105=45 +port_phy_clause_106=45 +port_phy_clause_107=45 +port_phy_clause_108=45 +port_phy_clause_109=45 + +port_phy_addr_1=0xff +port_phy_addr_2=0xff +port_phy_addr_3=0xff +port_phy_addr_4=0xff +port_phy_addr_5=0xff +port_phy_addr_6=0xff +port_phy_addr_7=0xff +port_phy_addr_8=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_40=0xff +port_phy_addr_41=0xff + +port_phy_addr_68=0xff +port_phy_addr_69=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_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 + +# Tile-0 +portmap_1=1:100 +portmap_2=5:100 +portmap_3=9:100 +portmap_4=13:100 +portmap_5=17:100 +portmap_6=21:100 +portmap_7=25:100 +portmap_8=29:100 + +# Tile-1 +portmap_34=33:100 +portmap_35=37:100 +portmap_36=41:100 +portmap_37=45:100 +portmap_38=49:100 +portmap_39=53:100 +portmap_40=57:100 +portmap_41=61:100 + +# Tile-2 +portmap_68=65:100 +portmap_69=69:100 +portmap_70=73:100 +portmap_71=77:100 +portmap_72=81:100 +portmap_73=85:100 +portmap_74=89:100 +portmap_75=93:100 + +# Tile-3 +portmap_102=97:100 +portmap_103=101:100 +portmap_104=105:100 +portmap_105=109:100 +portmap_106=113:100 +portmap_107=117:100 +portmap_108=121:100 +portmap_109=125:100 + +dport_map_enable=1 +dport_map_indexed=1 +dport_map_direct=0 + +dport_map_port_36=1 +dport_map_port_37=2 +dport_map_port_38=3 +dport_map_port_35=4 +dport_map_port_34=5 +dport_map_port_39=6 +dport_map_port_40=7 +dport_map_port_41=8 + +dport_map_port_68=34 +dport_map_port_69=35 +dport_map_port_70=36 +dport_map_port_71=37 +dport_map_port_72=38 +dport_map_port_73=39 +dport_map_port_74=40 +dport_map_port_75=41 + +dport_map_port_102=68 +dport_map_port_103=69 +dport_map_port_104=70 +dport_map_port_105=71 +dport_map_port_108=72 +dport_map_port_106=73 +dport_map_port_1=74 +dport_map_port_107=75 + +dport_map_port_2=102 +dport_map_port_109=103 +dport_map_port_8=104 +dport_map_port_3=105 +dport_map_port_4=106 +dport_map_port_7=107 +dport_map_port_5=108 +dport_map_port_6=109 + +# Tile-0 FC0~FC7 +# TX polarity +phy_xaui_tx_polarity_flip_1=0xF +phy_xaui_tx_polarity_flip_2=0xF +phy_xaui_tx_polarity_flip_3=0x0 +phy_xaui_tx_polarity_flip_4=0x0 +phy_xaui_tx_polarity_flip_5=0x0 +phy_xaui_tx_polarity_flip_6=0x0 +phy_xaui_tx_polarity_flip_7=0xF +phy_xaui_tx_polarity_flip_8=0xF + +# RX polarity +phy_xaui_rx_polarity_flip_1=0xF +phy_xaui_rx_polarity_flip_2=0xF +phy_xaui_rx_polarity_flip_3=0x0 +phy_xaui_rx_polarity_flip_4=0x0 +phy_xaui_rx_polarity_flip_5=0x0 +phy_xaui_rx_polarity_flip_6=0x0 +phy_xaui_rx_polarity_flip_7=0xF +phy_xaui_rx_polarity_flip_8=0xF + +# TX lane swap +xgxs_tx_lane_map_1=0x1302 +xgxs_tx_lane_map_2=0x1302 +xgxs_tx_lane_map_3=0x0213 +xgxs_tx_lane_map_4=0x1302 +xgxs_tx_lane_map_5=0x1032 +xgxs_tx_lane_map_6=0x0213 +xgxs_tx_lane_map_7=0x3120 +xgxs_tx_lane_map_8=0x1302 + +# RX lane swap +xgxs_rx_lane_map_1=0x1302 +xgxs_rx_lane_map_2=0x1302 +xgxs_rx_lane_map_3=0x0213 +xgxs_rx_lane_map_4=0x1302 +xgxs_rx_lane_map_5=0x0123 +xgxs_rx_lane_map_6=0x1032 +xgxs_rx_lane_map_7=0x0213 +xgxs_rx_lane_map_8=0x2031 + +# Tile-1 FC8~FC15 +#TX polarity +phy_xaui_tx_polarity_flip_34=0x0 +phy_xaui_tx_polarity_flip_35=0x1 +phy_xaui_tx_polarity_flip_36=0x0 +phy_xaui_tx_polarity_flip_37=0x1 +phy_xaui_tx_polarity_flip_38=0xF +phy_xaui_tx_polarity_flip_39=0xE +phy_xaui_tx_polarity_flip_40=0x0 +phy_xaui_tx_polarity_flip_41=0xE + +#RX polarity +phy_xaui_rx_polarity_flip_34=0x0 +phy_xaui_rx_polarity_flip_35=0x0 +phy_xaui_rx_polarity_flip_36=0x0 +phy_xaui_rx_polarity_flip_37=0x2 +phy_xaui_rx_polarity_flip_38=0xF +phy_xaui_rx_polarity_flip_39=0xF +phy_xaui_rx_polarity_flip_40=0x0 +phy_xaui_rx_polarity_flip_41=0xF + +# TX lane swap +xgxs_tx_lane_map_34=0x0213 +xgxs_tx_lane_map_35=0x2031 +xgxs_tx_lane_map_36=0x0123 +xgxs_tx_lane_map_37=0x1032 +xgxs_tx_lane_map_38=0x0213 +xgxs_tx_lane_map_39=0x1302 +xgxs_tx_lane_map_40=0x0213 +xgxs_tx_lane_map_41=0x1302 + +# RX lane swap +xgxs_rx_lane_map_34=0x3120 +xgxs_rx_lane_map_35=0x2301 +xgxs_rx_lane_map_36=0x1032 +xgxs_rx_lane_map_37=0x0123 +xgxs_rx_lane_map_38=0x0213 +xgxs_rx_lane_map_39=0x1302 +xgxs_rx_lane_map_40=0x0213 +xgxs_rx_lane_map_41=0x1302 + +# Tile-2 FC16~FC23 +# TX polarity +phy_xaui_tx_polarity_flip_68=0x0 +phy_xaui_tx_polarity_flip_69=0xE +phy_xaui_tx_polarity_flip_70=0x0 +phy_xaui_tx_polarity_flip_71=0xE +phy_xaui_tx_polarity_flip_72=0xF +phy_xaui_tx_polarity_flip_73=0xE +phy_xaui_tx_polarity_flip_74=0xF +phy_xaui_tx_polarity_flip_75=0xE + +# RX polarity +phy_xaui_rx_polarity_flip_68=0x0 +phy_xaui_rx_polarity_flip_69=0xD +phy_xaui_rx_polarity_flip_70=0x0 +phy_xaui_rx_polarity_flip_71=0xF +phy_xaui_rx_polarity_flip_72=0xF +phy_xaui_rx_polarity_flip_73=0xF +phy_xaui_rx_polarity_flip_74=0xF +phy_xaui_rx_polarity_flip_75=0xF + +# TX lane swap +xgxs_tx_lane_map_68=0x3120 +xgxs_tx_lane_map_69=0x1302 +xgxs_tx_lane_map_70=0x0213 +xgxs_tx_lane_map_71=0x0123 +xgxs_tx_lane_map_72=0x0213 +xgxs_tx_lane_map_73=0x2031 +xgxs_tx_lane_map_74=0x0213 +xgxs_tx_lane_map_75=0x2031 + +# RX lane swap +xgxs_rx_lane_map_68=0x3120 +xgxs_rx_lane_map_69=0x1302 +xgxs_rx_lane_map_70=0x0213 +xgxs_rx_lane_map_71=0x2103 +xgxs_rx_lane_map_72=0x2031 +xgxs_rx_lane_map_73=0x0213 +xgxs_rx_lane_map_74=0x3210 +xgxs_rx_lane_map_75=0x0213 + +# Tile-3 +# portmap_0=x:xx // cpu port (not required, but included for illustration purposes) +# TX polarity +phy_xaui_tx_polarity_flip_102=0x0 +phy_xaui_tx_polarity_flip_103=0xF +phy_xaui_tx_polarity_flip_104=0x0 +phy_xaui_tx_polarity_flip_105=0x0 +phy_xaui_tx_polarity_flip_106=0x0 +phy_xaui_tx_polarity_flip_107=0x0 +phy_xaui_tx_polarity_flip_108=0xF +phy_xaui_tx_polarity_flip_109=0x0 + +# RX polarity +phy_xaui_rx_polarity_flip_102=0x0 +phy_xaui_rx_polarity_flip_103=0x2 +phy_xaui_rx_polarity_flip_104=0x0 +phy_xaui_rx_polarity_flip_105=0xF +phy_xaui_rx_polarity_flip_106=0x0 +phy_xaui_rx_polarity_flip_107=0x0 +phy_xaui_rx_polarity_flip_108=0xF +phy_xaui_rx_polarity_flip_109=0x2 + +# TX lane swap +xgxs_tx_lane_map_102=0x2031 +xgxs_tx_lane_map_103=0x0213 +xgxs_tx_lane_map_104=0x2031 +xgxs_tx_lane_map_105=0x0213 +xgxs_tx_lane_map_106=0x0123 +xgxs_tx_lane_map_107=0x0213 +xgxs_tx_lane_map_108=0x0312 +xgxs_tx_lane_map_109=0x3120 + +# RX lane swap +xgxs_rx_lane_map_102=0x0213 +xgxs_rx_lane_map_103=0x2031 +xgxs_rx_lane_map_104=0x0213 +xgxs_rx_lane_map_105=0x2031 +xgxs_rx_lane_map_106=0x0123 +xgxs_rx_lane_map_107=0x0213 +xgxs_rx_lane_map_108=0x1302 +xgxs_rx_lane_map_109=0x3120 + +#serdes_preemphasis_lane0_1=0x(post)(main)(pre) +#ce0 +serdes_preemphasis_lane0_36=0x3c320f +serdes_preemphasis_lane1_36=0x3c320f +serdes_preemphasis_lane2_36=0x3c320c +serdes_preemphasis_lane3_36=0x3c320c + +#ce1 +serdes_preemphasis_lane0_37=0x3c320f +serdes_preemphasis_lane1_37=0x3c320f +serdes_preemphasis_lane2_37=0x3c320c +serdes_preemphasis_lane3_37=0x37320c + +#ce2 +serdes_preemphasis_lane0_38=0x3c3206 +serdes_preemphasis_lane1_38=0x373206 +serdes_preemphasis_lane2_38=0x373206 +serdes_preemphasis_lane3_38=0x373206 + +#ce3 +serdes_preemphasis_lane0_35=0x3c3206 +serdes_preemphasis_lane1_35=0x3c3206 +serdes_preemphasis_lane2_35=0x3c3206 +serdes_preemphasis_lane3_35=0x3c3206 + +#ce4 +serdes_preemphasis_lane0_34=0x3c3206 +serdes_preemphasis_lane1_34=0x3c3206 +serdes_preemphasis_lane2_34=0x3c3206 +serdes_preemphasis_lane3_34=0x373206 + +#ce5 +serdes_preemphasis_lane0_39=0x323206 +serdes_preemphasis_lane1_39=0x323206 +serdes_preemphasis_lane2_39=0x323206 +serdes_preemphasis_lane3_39=0x323206 + +#ce6 +serdes_preemphasis_lane0_40=0x323206 +serdes_preemphasis_lane1_40=0x2D3206 +serdes_preemphasis_lane2_40=0x2D3206 +serdes_preemphasis_lane3_40=0x2D3206 + +#ce7 +serdes_preemphasis_lane0_41=0x2D3206 +serdes_preemphasis_lane1_41=0x2D3206 +serdes_preemphasis_lane2_41=0x2D3206 +serdes_preemphasis_lane3_41=0x2D3206 + +#ce8 +serdes_preemphasis_lane0_68=0x283206 +serdes_preemphasis_lane1_68=0x283206 +serdes_preemphasis_lane2_68=0x283206 +serdes_preemphasis_lane3_68=0x283206 + +#ce9 +serdes_preemphasis_lane0_69=0x283206 +serdes_preemphasis_lane1_69=0x283206 +serdes_preemphasis_lane2_69=0x283206 +serdes_preemphasis_lane3_69=0x283206 + +#ce10 +serdes_preemphasis_lane0_70=0x2D3206 +serdes_preemphasis_lane1_70=0x2D3206 +serdes_preemphasis_lane2_70=0x2D3206 +serdes_preemphasis_lane3_70=0x2D3206 + +#ce11 +serdes_preemphasis_lane0_71=0x2D3206 +serdes_preemphasis_lane1_71=0x2D3206 +serdes_preemphasis_lane2_71=0x2D3206 +serdes_preemphasis_lane3_71=0x2D3206 + +#ce12 +serdes_preemphasis_lane0_72=0x2D3203 +serdes_preemphasis_lane1_72=0x2D3206 +serdes_preemphasis_lane2_72=0x2D3206 +serdes_preemphasis_lane3_73=0x2D3206 + +#ce13 +serdes_preemphasis_lane0_73=0x2D3206 +serdes_preemphasis_lane1_73=0x283206 +serdes_preemphasis_lane2_73=0x283206 +serdes_preemphasis_lane3_73=0x283206 + +#ce14 +serdes_preemphasis_lane0_74=0x2D3203 +serdes_preemphasis_lane1_74=0x2D3203 +serdes_preemphasis_lane2_74=0x2D3203 +serdes_preemphasis_lane3_74=0x283206 + +#ce15 +serdes_preemphasis_lane0_75=0x2D3206 +serdes_preemphasis_lane1_75=0x283206 +serdes_preemphasis_lane2_75=0x283206 +serdes_preemphasis_lane3_75=0x283206 + +#ce16 +serdes_preemphasis_lane0_102=0x2D3206 +serdes_preemphasis_lane1_102=0x2D3206 +serdes_preemphasis_lane2_102=0x2D3206 +serdes_preemphasis_lane3_102=0x2D3206 + +#ce17 +serdes_preemphasis_lane0_103=0x2D3206 +serdes_preemphasis_lane1_103=0x283206 +serdes_preemphasis_lane2_103=0x283206 +serdes_preemphasis_lane3_103=0x283206 + +#ce18 +serdes_preemphasis_lane0_104=0x2D3206 +serdes_preemphasis_lane1_104=0x283206 +serdes_preemphasis_lane2_104=0x283206 +serdes_preemphasis_lane3_104=0x283206 + +#ce19 +serdes_preemphasis_lane0_105=0x2D3206 +serdes_preemphasis_lane1_105=0x2D3206 +serdes_preemphasis_lane2_105=0x2D3206 +serdes_preemphasis_lane3_105=0x2D3206 + +#ce20 +serdes_preemphasis_lane0_108=0x323206 +serdes_preemphasis_lane1_108=0x283206 +serdes_preemphasis_lane2_108=0x283206 +serdes_preemphasis_lane3_108=0x283206 + +#ce21 +serdes_preemphasis_lane0_106=0x2D3206 +serdes_preemphasis_lane1_106=0x283206 +serdes_preemphasis_lane2_106=0x283206 +serdes_preemphasis_lane3_106=0x283206 + +#ce22 +serdes_preemphasis_lane0_1=0x323206 +serdes_preemphasis_lane1_1=0x283206 +serdes_preemphasis_lane2_1=0x283206 +serdes_preemphasis_lane3_1=0x283206 + +#ce23 +serdes_preemphasis_lane0_107=0x323206 +serdes_preemphasis_lane1_107=0x283206 +serdes_preemphasis_lane2_107=0x283206 +serdes_preemphasis_lane3_107=0x283206 + +#ce24 +serdes_preemphasis_lane0_2=0x2D3206 +serdes_preemphasis_lane1_2=0x2D3206 +serdes_preemphasis_lane2_2=0x323206 +serdes_preemphasis_lane3_3=0x2D3206 + +#ce25 +serdes_preemphasis_lane0_109=0x323203 +serdes_preemphasis_lane1_109=0x2D3206 +serdes_preemphasis_lane2_109=0x2D3206 +serdes_preemphasis_lane3_109=0x2D3206 + +#ce26 +serdes_preemphasis_lane0_8=0x373206 +serdes_preemphasis_lane1_8=0x373206 +serdes_preemphasis_lane2_8=0x373206 +serdes_preemphasis_lane3_8=0x373206 + +#ce27 +serdes_preemphasis_lane0_3=0x323203 +serdes_preemphasis_lane1_3=0x323203 +serdes_preemphasis_lane2_3=0x323203 +serdes_preemphasis_lane3_3=0x323203 + +#ce28 +serdes_preemphasis_lane0_4=0x373203 +serdes_preemphasis_lane1_4=0x323203 +serdes_preemphasis_lane2_4=0x323203 +serdes_preemphasis_lane3_4=0x323205 + +#ce29 +serdes_preemphasis_lane0_7=0x3c3203 +serdes_preemphasis_lane1_7=0x3c3203 +serdes_preemphasis_lane2_7=0x3c3203 +serdes_preemphasis_lane3_7=0x3c3205 + +#ce30 +serdes_preemphasis_lane0_5=0x3c320f +serdes_preemphasis_lane1_5=0x3c320f +serdes_preemphasis_lane2_5=0x3c320c +serdes_preemphasis_lane3_5=0x2c320c + +#ce31 +serdes_preemphasis_lane0_6=0x3c320f +serdes_preemphasis_lane1_6=0x3c320f +serdes_preemphasis_lane2_6=0x2c320c +serdes_preemphasis_lane3_6=0x2c320c + + + diff --git a/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/sai.profile b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/sai.profile index b2ecd7a6da47..21f013773e61 100644 --- a/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/sai.profile +++ b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th2-ag9064-64x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-ag9064-64x100G.config.bcm diff --git a/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/th2-ag9064-64x100G.config.bcm b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/th2-ag9064-64x100G.config.bcm new file mode 100644 index 000000000000..4cc15059e8ba --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/th2-ag9064-64x100G.config.bcm @@ -0,0 +1,803 @@ +core_clock_frequency=1700 +dport_map_enable=1 +dport_map_port_102=31 +dport_map_port_103=32 +dport_map_port_104=64 +dport_map_port_105=63 +dport_map_port_106=20 +dport_map_port_107=21 +dport_map_port_108=51 +dport_map_port_109=54 +dport_map_port_10=13 +dport_map_port_110=22 +dport_map_port_111=23 +dport_map_port_112=53 +dport_map_port_113=56 +dport_map_port_114=24 +dport_map_port_115=25 +dport_map_port_116=55 +dport_map_port_117=58 +dport_map_port_11=43 +dport_map_port_12=45 +dport_map_port_13=1 +dport_map_port_14=2 +dport_map_port_15=34 +dport_map_port_16=33 +dport_map_port_1=7 +dport_map_port_2=9 +dport_map_port_34=3 +dport_map_port_35=4 +dport_map_port_36=36 +dport_map_port_37=35 +dport_map_port_38=5 +dport_map_port_39=6 +dport_map_port_3=40 +dport_map_port_40=38 +dport_map_port_41=37 +dport_map_port_42=14 +dport_map_port_43=8 +dport_map_port_44=39 +dport_map_port_45=46 +dport_map_port_46=15 +dport_map_port_47=16 +dport_map_port_48=48 +dport_map_port_49=47 +dport_map_port_4=42 +dport_map_port_5=10 +dport_map_port_68=17 +dport_map_port_69=18 +dport_map_port_6=11 +dport_map_port_70=50 +dport_map_port_71=49 +dport_map_port_72=19 +dport_map_port_73=52 +dport_map_port_74=57 +dport_map_port_75=26 +dport_map_port_76=27 +dport_map_port_77=28 +dport_map_port_78=60 +dport_map_port_79=59 +dport_map_port_7=41 +dport_map_port_80=29 +dport_map_port_81=30 +dport_map_port_82=62 +dport_map_port_83=61 +dport_map_port_8=44 +dport_map_port_9=12 +dpp_clock_ratio=2:3 +fpem_mem_entries=65536 +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +mem_cache_enable=0 +os=unix +oversubscribe_mode=1 +parity_correction=0 +parity_enable=0 +pbmp_xport_xe=0x40003ffff0000ffffc0003fffe0001fffe +phy_chain_rx_lane_map_physical{1.0}=0x2130 +phy_chain_rx_lane_map_physical{101.0}=0x2310 +phy_chain_rx_lane_map_physical{105.0}=0x3021 +phy_chain_rx_lane_map_physical{109.0}=0x0213 +phy_chain_rx_lane_map_physical{113.0}=0x1302 +phy_chain_rx_lane_map_physical{117.0}=0x0312 +phy_chain_rx_lane_map_physical{121.0}=0x1203 +phy_chain_rx_lane_map_physical{125.0}=0x3021 +phy_chain_rx_lane_map_physical{129.0}=0x1302 +phy_chain_rx_lane_map_physical{13.0}=0x2310 +phy_chain_rx_lane_map_physical{133.0}=0x2310 +phy_chain_rx_lane_map_physical{137.0}=0x1023 +phy_chain_rx_lane_map_physical{141.0}=0x2031 +phy_chain_rx_lane_map_physical{145.0}=0x1032 +phy_chain_rx_lane_map_physical{149.0}=0x1203 +phy_chain_rx_lane_map_physical{153.0}=0x2310 +phy_chain_rx_lane_map_physical{157.0}=0x2013 +phy_chain_rx_lane_map_physical{161.0}=0x2103 +phy_chain_rx_lane_map_physical{165.0}=0x3012 +phy_chain_rx_lane_map_physical{169.0}=0x1320 +phy_chain_rx_lane_map_physical{17.0}=0x0213 +phy_chain_rx_lane_map_physical{173.0}=0x2301 +phy_chain_rx_lane_map_physical{177.0}=0x1032 +phy_chain_rx_lane_map_physical{181.0}=0x1032 +phy_chain_rx_lane_map_physical{185.0}=0x3210 +phy_chain_rx_lane_map_physical{189.0}=0x2103 +phy_chain_rx_lane_map_physical{193.0}=0x1032 +phy_chain_rx_lane_map_physical{197.0}=0x1032 +phy_chain_rx_lane_map_physical{201.0}=0x2301 +phy_chain_rx_lane_map_physical{205.0}=0x2301 +phy_chain_rx_lane_map_physical{209.0}=0x2103 +phy_chain_rx_lane_map_physical{21.0}=0x3120 +phy_chain_rx_lane_map_physical{213.0}=0x3201 +phy_chain_rx_lane_map_physical{217.0}=0x2301 +phy_chain_rx_lane_map_physical{221.0}=0x2301 +phy_chain_rx_lane_map_physical{225.0}=0x0123 +phy_chain_rx_lane_map_physical{229.0}=0x1302 +phy_chain_rx_lane_map_physical{233.0}=0x3120 +phy_chain_rx_lane_map_physical{237.0}=0x0123 +phy_chain_rx_lane_map_physical{241.0}=0x2310 +phy_chain_rx_lane_map_physical{245.0}=0x0312 +phy_chain_rx_lane_map_physical{249.0}=0x3021 +phy_chain_rx_lane_map_physical{25.0}=0x1203 +phy_chain_rx_lane_map_physical{253.0}=0x2013 +phy_chain_rx_lane_map_physical{29.0}=0x3012 +phy_chain_rx_lane_map_physical{33.0}=0x3210 +phy_chain_rx_lane_map_physical{37.0}=0x3210 +phy_chain_rx_lane_map_physical{41.0}=0x1230 +phy_chain_rx_lane_map_physical{45.0}=0x2013 +phy_chain_rx_lane_map_physical{49.0}=0x2301 +phy_chain_rx_lane_map_physical{5.0}=0x2031 +phy_chain_rx_lane_map_physical{53.0}=0x3210 +phy_chain_rx_lane_map_physical{57.0}=0x1203 +phy_chain_rx_lane_map_physical{61.0}=0x0231 +phy_chain_rx_lane_map_physical{65.0}=0x2301 +phy_chain_rx_lane_map_physical{69.0}=0x3210 +phy_chain_rx_lane_map_physical{73.0}=0x2013 +phy_chain_rx_lane_map_physical{77.0}=0x3012 +phy_chain_rx_lane_map_physical{81.0}=0x2301 +phy_chain_rx_lane_map_physical{85.0}=0x3210 +phy_chain_rx_lane_map_physical{89.0}=0x2013 +phy_chain_rx_lane_map_physical{9.0}=0x0312 +phy_chain_rx_lane_map_physical{93.0}=0x3012 +phy_chain_rx_lane_map_physical{97.0}=0x1320 +phy_chain_rx_polarity_flip_physical{1.0}=0x0 +phy_chain_rx_polarity_flip_physical{10.0}=0x1 +phy_chain_rx_polarity_flip_physical{100.0}=0x0 +phy_chain_rx_polarity_flip_physical{101.0}=0x1 +phy_chain_rx_polarity_flip_physical{102.0}=0x1 +phy_chain_rx_polarity_flip_physical{103.0}=0x0 +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}=0x1 +phy_chain_rx_polarity_flip_physical{107.0}=0x0 +phy_chain_rx_polarity_flip_physical{108.0}=0x0 +phy_chain_rx_polarity_flip_physical{109.0}=0x1 +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}=0x1 +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}=0x0 +phy_chain_rx_polarity_flip_physical{12.0}=0x0 +phy_chain_rx_polarity_flip_physical{120.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{125.0}=0x1 +phy_chain_rx_polarity_flip_physical{126.0}=0x0 +phy_chain_rx_polarity_flip_physical{127.0}=0x1 +phy_chain_rx_polarity_flip_physical{128.0}=0x0 +phy_chain_rx_polarity_flip_physical{129.0}=0x0 +phy_chain_rx_polarity_flip_physical{13.0}=0x0 +phy_chain_rx_polarity_flip_physical{130.0}=0x1 +phy_chain_rx_polarity_flip_physical{131.0}=0x0 +phy_chain_rx_polarity_flip_physical{132.0}=0x0 +phy_chain_rx_polarity_flip_physical{133.0}=0x0 +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}=0x1 +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}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{143.0}=0x0 +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}=0x1 +phy_chain_rx_polarity_flip_physical{147.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{150.0}=0x1 +phy_chain_rx_polarity_flip_physical{151.0}=0x0 +phy_chain_rx_polarity_flip_physical{152.0}=0x1 +phy_chain_rx_polarity_flip_physical{153.0}=0x1 +phy_chain_rx_polarity_flip_physical{154.0}=0x1 +phy_chain_rx_polarity_flip_physical{155.0}=0x0 +phy_chain_rx_polarity_flip_physical{156.0}=0x0 +phy_chain_rx_polarity_flip_physical{157.0}=0x1 +phy_chain_rx_polarity_flip_physical{158.0}=0x0 +phy_chain_rx_polarity_flip_physical{159.0}=0x0 +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}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{168.0}=0x1 +phy_chain_rx_polarity_flip_physical{169.0}=0x0 +phy_chain_rx_polarity_flip_physical{17.0}=0x1 +phy_chain_rx_polarity_flip_physical{170.0}=0x0 +phy_chain_rx_polarity_flip_physical{171.0}=0x0 +phy_chain_rx_polarity_flip_physical{172.0}=0x1 +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}=0x0 +phy_chain_rx_polarity_flip_physical{179.0}=0x1 +phy_chain_rx_polarity_flip_physical{18.0}=0x0 +phy_chain_rx_polarity_flip_physical{180.0}=0x1 +phy_chain_rx_polarity_flip_physical{181.0}=0x0 +phy_chain_rx_polarity_flip_physical{182.0}=0x1 +phy_chain_rx_polarity_flip_physical{183.0}=0x1 +phy_chain_rx_polarity_flip_physical{184.0}=0x0 +phy_chain_rx_polarity_flip_physical{185.0}=0x1 +phy_chain_rx_polarity_flip_physical{186.0}=0x1 +phy_chain_rx_polarity_flip_physical{187.0}=0x1 +phy_chain_rx_polarity_flip_physical{188.0}=0x0 +phy_chain_rx_polarity_flip_physical{189.0}=0x0 +phy_chain_rx_polarity_flip_physical{19.0}=0x0 +phy_chain_rx_polarity_flip_physical{190.0}=0x0 +phy_chain_rx_polarity_flip_physical{191.0}=0x0 +phy_chain_rx_polarity_flip_physical{192.0}=0x1 +phy_chain_rx_polarity_flip_physical{193.0}=0x1 +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}=0x0 +phy_chain_rx_polarity_flip_physical{198.0}=0x1 +phy_chain_rx_polarity_flip_physical{199.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{203.0}=0x0 +phy_chain_rx_polarity_flip_physical{204.0}=0x1 +phy_chain_rx_polarity_flip_physical{205.0}=0x0 +phy_chain_rx_polarity_flip_physical{206.0}=0x1 +phy_chain_rx_polarity_flip_physical{207.0}=0x1 +phy_chain_rx_polarity_flip_physical{208.0}=0x0 +phy_chain_rx_polarity_flip_physical{209.0}=0x0 +phy_chain_rx_polarity_flip_physical{21.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{213.0}=0x1 +phy_chain_rx_polarity_flip_physical{214.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{219.0}=0x0 +phy_chain_rx_polarity_flip_physical{22.0}=0x0 +phy_chain_rx_polarity_flip_physical{220.0}=0x0 +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}=0x1 +phy_chain_rx_polarity_flip_physical{227.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{236.0}=0x1 +phy_chain_rx_polarity_flip_physical{237.0}=0x1 +phy_chain_rx_polarity_flip_physical{238.0}=0x1 +phy_chain_rx_polarity_flip_physical{239.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x1 +phy_chain_rx_polarity_flip_physical{240.0}=0x0 +phy_chain_rx_polarity_flip_physical{241.0}=0x0 +phy_chain_rx_polarity_flip_physical{242.0}=0x1 +phy_chain_rx_polarity_flip_physical{243.0}=0x0 +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}=0x0 +phy_chain_rx_polarity_flip_physical{247.0}=0x1 +phy_chain_rx_polarity_flip_physical{248.0}=0x1 +phy_chain_rx_polarity_flip_physical{249.0}=0x1 +phy_chain_rx_polarity_flip_physical{25.0}=0x0 +phy_chain_rx_polarity_flip_physical{250.0}=0x0 +phy_chain_rx_polarity_flip_physical{251.0}=0x1 +phy_chain_rx_polarity_flip_physical{252.0}=0x0 +phy_chain_rx_polarity_flip_physical{253.0}=0x1 +phy_chain_rx_polarity_flip_physical{254.0}=0x1 +phy_chain_rx_polarity_flip_physical{255.0}=0x0 +phy_chain_rx_polarity_flip_physical{256.0}=0x1 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x0 +phy_chain_rx_polarity_flip_physical{28.0}=0x1 +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}=0x1 +phy_chain_rx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{32.0}=0x0 +phy_chain_rx_polarity_flip_physical{33.0}=0x0 +phy_chain_rx_polarity_flip_physical{34.0}=0x1 +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}=0x0 +phy_chain_rx_polarity_flip_physical{38.0}=0x1 +phy_chain_rx_polarity_flip_physical{39.0}=0x1 +phy_chain_rx_polarity_flip_physical{4.0}=0x1 +phy_chain_rx_polarity_flip_physical{40.0}=0x1 +phy_chain_rx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{42.0}=0x0 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_rx_polarity_flip_physical{44.0}=0x0 +phy_chain_rx_polarity_flip_physical{45.0}=0x0 +phy_chain_rx_polarity_flip_physical{46.0}=0x1 +phy_chain_rx_polarity_flip_physical{47.0}=0x1 +phy_chain_rx_polarity_flip_physical{48.0}=0x0 +phy_chain_rx_polarity_flip_physical{49.0}=0x0 +phy_chain_rx_polarity_flip_physical{5.0}=0x0 +phy_chain_rx_polarity_flip_physical{50.0}=0x0 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 +phy_chain_rx_polarity_flip_physical{53.0}=0x0 +phy_chain_rx_polarity_flip_physical{54.0}=0x1 +phy_chain_rx_polarity_flip_physical{55.0}=0x0 +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}=0x1 +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}=0x0 +phy_chain_rx_polarity_flip_physical{61.0}=0x0 +phy_chain_rx_polarity_flip_physical{62.0}=0x1 +phy_chain_rx_polarity_flip_physical{63.0}=0x0 +phy_chain_rx_polarity_flip_physical{64.0}=0x1 +phy_chain_rx_polarity_flip_physical{65.0}=0x0 +phy_chain_rx_polarity_flip_physical{66.0}=0x1 +phy_chain_rx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x0 +phy_chain_rx_polarity_flip_physical{69.0}=0x0 +phy_chain_rx_polarity_flip_physical{7.0}=0x1 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x0 +phy_chain_rx_polarity_flip_physical{73.0}=0x0 +phy_chain_rx_polarity_flip_physical{74.0}=0x0 +phy_chain_rx_polarity_flip_physical{75.0}=0x0 +phy_chain_rx_polarity_flip_physical{76.0}=0x1 +phy_chain_rx_polarity_flip_physical{77.0}=0x1 +phy_chain_rx_polarity_flip_physical{78.0}=0x1 +phy_chain_rx_polarity_flip_physical{79.0}=0x0 +phy_chain_rx_polarity_flip_physical{8.0}=0x0 +phy_chain_rx_polarity_flip_physical{80.0}=0x1 +phy_chain_rx_polarity_flip_physical{81.0}=0x0 +phy_chain_rx_polarity_flip_physical{82.0}=0x0 +phy_chain_rx_polarity_flip_physical{83.0}=0x0 +phy_chain_rx_polarity_flip_physical{84.0}=0x0 +phy_chain_rx_polarity_flip_physical{85.0}=0x0 +phy_chain_rx_polarity_flip_physical{86.0}=0x0 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x0 +phy_chain_rx_polarity_flip_physical{89.0}=0x0 +phy_chain_rx_polarity_flip_physical{9.0}=0x0 +phy_chain_rx_polarity_flip_physical{90.0}=0x0 +phy_chain_rx_polarity_flip_physical{91.0}=0x0 +phy_chain_rx_polarity_flip_physical{92.0}=0x1 +phy_chain_rx_polarity_flip_physical{93.0}=0x0 +phy_chain_rx_polarity_flip_physical{94.0}=0x1 +phy_chain_rx_polarity_flip_physical{95.0}=0x1 +phy_chain_rx_polarity_flip_physical{96.0}=0x1 +phy_chain_rx_polarity_flip_physical{97.0}=0x0 +phy_chain_rx_polarity_flip_physical{98.0}=0x0 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_tx_lane_map_physical{1.0}=0x2301 +phy_chain_tx_lane_map_physical{101.0}=0x2103 +phy_chain_tx_lane_map_physical{105.0}=0x2310 +phy_chain_tx_lane_map_physical{109.0}=0x2013 +phy_chain_tx_lane_map_physical{113.0}=0x0312 +phy_chain_tx_lane_map_physical{117.0}=0x1230 +phy_chain_tx_lane_map_physical{121.0}=0x1203 +phy_chain_tx_lane_map_physical{125.0}=0x1203 +phy_chain_tx_lane_map_physical{129.0}=0x1320 +phy_chain_tx_lane_map_physical{13.0}=0x0312 +phy_chain_tx_lane_map_physical{133.0}=0x3201 +phy_chain_tx_lane_map_physical{137.0}=0x2130 +phy_chain_tx_lane_map_physical{141.0}=0x1032 +phy_chain_tx_lane_map_physical{145.0}=0x1320 +phy_chain_tx_lane_map_physical{149.0}=0x0321 +phy_chain_tx_lane_map_physical{153.0}=0x1023 +phy_chain_tx_lane_map_physical{157.0}=0x3021 +phy_chain_tx_lane_map_physical{161.0}=0x0321 +phy_chain_tx_lane_map_physical{165.0}=0x2130 +phy_chain_tx_lane_map_physical{169.0}=0x1320 +phy_chain_tx_lane_map_physical{17.0}=0x0213 +phy_chain_tx_lane_map_physical{173.0}=0x2130 +phy_chain_tx_lane_map_physical{177.0}=0x0321 +phy_chain_tx_lane_map_physical{181.0}=0x2130 +phy_chain_tx_lane_map_physical{185.0}=0x0132 +phy_chain_tx_lane_map_physical{189.0}=0x1320 +phy_chain_tx_lane_map_physical{193.0}=0x3012 +phy_chain_tx_lane_map_physical{197.0}=0x2130 +phy_chain_tx_lane_map_physical{201.0}=0x1023 +phy_chain_tx_lane_map_physical{205.0}=0x1320 +phy_chain_tx_lane_map_physical{209.0}=0x0321 +phy_chain_tx_lane_map_physical{21.0}=0x2310 +phy_chain_tx_lane_map_physical{213.0}=0x2031 +phy_chain_tx_lane_map_physical{217.0}=0x1032 +phy_chain_tx_lane_map_physical{221.0}=0x3201 +phy_chain_tx_lane_map_physical{225.0}=0x0123 +phy_chain_tx_lane_map_physical{229.0}=0x0231 +phy_chain_tx_lane_map_physical{233.0}=0x1302 +phy_chain_tx_lane_map_physical{237.0}=0x3210 +phy_chain_tx_lane_map_physical{241.0}=0x0312 +phy_chain_tx_lane_map_physical{245.0}=0x2031 +phy_chain_tx_lane_map_physical{249.0}=0x3201 +phy_chain_tx_lane_map_physical{25.0}=0x0312 +phy_chain_tx_lane_map_physical{253.0}=0x3120 +phy_chain_tx_lane_map_physical{29.0}=0x1230 +phy_chain_tx_lane_map_physical{33.0}=0x3201 +phy_chain_tx_lane_map_physical{37.0}=0x3201 +phy_chain_tx_lane_map_physical{41.0}=0x3201 +phy_chain_tx_lane_map_physical{45.0}=0x2031 +phy_chain_tx_lane_map_physical{49.0}=0x0132 +phy_chain_tx_lane_map_physical{5.0}=0x2301 +phy_chain_tx_lane_map_physical{53.0}=0x3201 +phy_chain_tx_lane_map_physical{57.0}=0x3201 +phy_chain_tx_lane_map_physical{61.0}=0x2031 +phy_chain_tx_lane_map_physical{65.0}=0x0321 +phy_chain_tx_lane_map_physical{69.0}=0x3201 +phy_chain_tx_lane_map_physical{73.0}=0x3201 +phy_chain_tx_lane_map_physical{77.0}=0x1032 +phy_chain_tx_lane_map_physical{81.0}=0x0132 +phy_chain_tx_lane_map_physical{85.0}=0x1320 +phy_chain_tx_lane_map_physical{89.0}=0x3201 +phy_chain_tx_lane_map_physical{9.0}=0x2130 +phy_chain_tx_lane_map_physical{93.0}=0x0321 +phy_chain_tx_lane_map_physical{97.0}=0x1320 +phy_chain_tx_polarity_flip_physical{1.0}=0x1 +phy_chain_tx_polarity_flip_physical{10.0}=0x1 +phy_chain_tx_polarity_flip_physical{100.0}=0x1 +phy_chain_tx_polarity_flip_physical{101.0}=0x0 +phy_chain_tx_polarity_flip_physical{102.0}=0x0 +phy_chain_tx_polarity_flip_physical{103.0}=0x1 +phy_chain_tx_polarity_flip_physical{104.0}=0x0 +phy_chain_tx_polarity_flip_physical{105.0}=0x1 +phy_chain_tx_polarity_flip_physical{106.0}=0x1 +phy_chain_tx_polarity_flip_physical{107.0}=0x0 +phy_chain_tx_polarity_flip_physical{108.0}=0x0 +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}=0x1 +phy_chain_tx_polarity_flip_physical{111.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{115.0}=0x1 +phy_chain_tx_polarity_flip_physical{116.0}=0x1 +phy_chain_tx_polarity_flip_physical{117.0}=0x1 +phy_chain_tx_polarity_flip_physical{118.0}=0x1 +phy_chain_tx_polarity_flip_physical{119.0}=0x1 +phy_chain_tx_polarity_flip_physical{12.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{13.0}=0x1 +phy_chain_tx_polarity_flip_physical{130.0}=0x1 +phy_chain_tx_polarity_flip_physical{131.0}=0x1 +phy_chain_tx_polarity_flip_physical{132.0}=0x1 +phy_chain_tx_polarity_flip_physical{133.0}=0x0 +phy_chain_tx_polarity_flip_physical{134.0}=0x0 +phy_chain_tx_polarity_flip_physical{135.0}=0x1 +phy_chain_tx_polarity_flip_physical{136.0}=0x0 +phy_chain_tx_polarity_flip_physical{137.0}=0x0 +phy_chain_tx_polarity_flip_physical{138.0}=0x1 +phy_chain_tx_polarity_flip_physical{139.0}=0x0 +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}=0x1 +phy_chain_tx_polarity_flip_physical{142.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{147.0}=0x0 +phy_chain_tx_polarity_flip_physical{148.0}=0x1 +phy_chain_tx_polarity_flip_physical{149.0}=0x1 +phy_chain_tx_polarity_flip_physical{15.0}=0x1 +phy_chain_tx_polarity_flip_physical{150.0}=0x0 +phy_chain_tx_polarity_flip_physical{151.0}=0x1 +phy_chain_tx_polarity_flip_physical{152.0}=0x1 +phy_chain_tx_polarity_flip_physical{153.0}=0x0 +phy_chain_tx_polarity_flip_physical{154.0}=0x1 +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}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{160.0}=0x1 +phy_chain_tx_polarity_flip_physical{161.0}=0x0 +phy_chain_tx_polarity_flip_physical{162.0}=0x0 +phy_chain_tx_polarity_flip_physical{163.0}=0x0 +phy_chain_tx_polarity_flip_physical{164.0}=0x1 +phy_chain_tx_polarity_flip_physical{165.0}=0x0 +phy_chain_tx_polarity_flip_physical{166.0}=0x0 +phy_chain_tx_polarity_flip_physical{167.0}=0x0 +phy_chain_tx_polarity_flip_physical{168.0}=0x1 +phy_chain_tx_polarity_flip_physical{169.0}=0x1 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{170.0}=0x0 +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}=0x1 +phy_chain_tx_polarity_flip_physical{174.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{178.0}=0x1 +phy_chain_tx_polarity_flip_physical{179.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x0 +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}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{186.0}=0x0 +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}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{192.0}=0x0 +phy_chain_tx_polarity_flip_physical{193.0}=0x0 +phy_chain_tx_polarity_flip_physical{194.0}=0x0 +phy_chain_tx_polarity_flip_physical{195.0}=0x1 +phy_chain_tx_polarity_flip_physical{196.0}=0x1 +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}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{201.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{207.0}=0x1 +phy_chain_tx_polarity_flip_physical{208.0}=0x0 +phy_chain_tx_polarity_flip_physical{209.0}=0x0 +phy_chain_tx_polarity_flip_physical{21.0}=0x1 +phy_chain_tx_polarity_flip_physical{210.0}=0x0 +phy_chain_tx_polarity_flip_physical{211.0}=0x0 +phy_chain_tx_polarity_flip_physical{212.0}=0x1 +phy_chain_tx_polarity_flip_physical{213.0}=0x1 +phy_chain_tx_polarity_flip_physical{214.0}=0x0 +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}=0x1 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{220.0}=0x0 +phy_chain_tx_polarity_flip_physical{221.0}=0x0 +phy_chain_tx_polarity_flip_physical{222.0}=0x1 +phy_chain_tx_polarity_flip_physical{223.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{227.0}=0x0 +phy_chain_tx_polarity_flip_physical{228.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{231.0}=0x1 +phy_chain_tx_polarity_flip_physical{232.0}=0x0 +phy_chain_tx_polarity_flip_physical{233.0}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{241.0}=0x1 +phy_chain_tx_polarity_flip_physical{242.0}=0x0 +phy_chain_tx_polarity_flip_physical{243.0}=0x1 +phy_chain_tx_polarity_flip_physical{244.0}=0x1 +phy_chain_tx_polarity_flip_physical{245.0}=0x1 +phy_chain_tx_polarity_flip_physical{246.0}=0x0 +phy_chain_tx_polarity_flip_physical{247.0}=0x0 +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}=0x0 +phy_chain_tx_polarity_flip_physical{250.0}=0x1 +phy_chain_tx_polarity_flip_physical{251.0}=0x0 +phy_chain_tx_polarity_flip_physical{252.0}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{256.0}=0x1 +phy_chain_tx_polarity_flip_physical{26.0}=0x0 +phy_chain_tx_polarity_flip_physical{27.0}=0x1 +phy_chain_tx_polarity_flip_physical{28.0}=0x1 +phy_chain_tx_polarity_flip_physical{29.0}=0x0 +phy_chain_tx_polarity_flip_physical{3.0}=0x0 +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}=0x1 +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}=0x0 +phy_chain_tx_polarity_flip_physical{4.0}=0x0 +phy_chain_tx_polarity_flip_physical{40.0}=0x1 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_tx_polarity_flip_physical{42.0}=0x1 +phy_chain_tx_polarity_flip_physical{43.0}=0x1 +phy_chain_tx_polarity_flip_physical{44.0}=0x1 +phy_chain_tx_polarity_flip_physical{45.0}=0x0 +phy_chain_tx_polarity_flip_physical{46.0}=0x1 +phy_chain_tx_polarity_flip_physical{47.0}=0x1 +phy_chain_tx_polarity_flip_physical{48.0}=0x0 +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{5.0}=0x0 +phy_chain_tx_polarity_flip_physical{50.0}=0x1 +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}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x1 +phy_chain_tx_polarity_flip_physical{6.0}=0x1 +phy_chain_tx_polarity_flip_physical{60.0}=0x0 +phy_chain_tx_polarity_flip_physical{61.0}=0x1 +phy_chain_tx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x0 +phy_chain_tx_polarity_flip_physical{65.0}=0x0 +phy_chain_tx_polarity_flip_physical{66.0}=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}=0x0 +phy_chain_tx_polarity_flip_physical{70.0}=0x1 +phy_chain_tx_polarity_flip_physical{71.0}=0x0 +phy_chain_tx_polarity_flip_physical{72.0}=0x1 +phy_chain_tx_polarity_flip_physical{73.0}=0x0 +phy_chain_tx_polarity_flip_physical{74.0}=0x1 +phy_chain_tx_polarity_flip_physical{75.0}=0x1 +phy_chain_tx_polarity_flip_physical{76.0}=0x0 +phy_chain_tx_polarity_flip_physical{77.0}=0x1 +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}=0x1 +phy_chain_tx_polarity_flip_physical{80.0}=0x1 +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}=0x0 +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}=0x1 +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}=0x0 +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}=0x1 +phy_chain_tx_polarity_flip_physical{94.0}=0x0 +phy_chain_tx_polarity_flip_physical{95.0}=0x1 +phy_chain_tx_polarity_flip_physical{96.0}=0x0 +phy_chain_tx_polarity_flip_physical{97.0}=0x1 +phy_chain_tx_polarity_flip_physical{98.0}=0x0 +phy_chain_tx_polarity_flip_physical{99.0}=0x1 +portmap_100=259:10 +portmap_101=262:10 +portmap_102=193:100 +portmap_103=197:100 +portmap_104=201:100 +portmap_105=205:100 +portmap_106=209:100 +portmap_107=213:100 +portmap_108=217:100 +portmap_109=221:100 +portmap_10=37:100 +portmap_110=225:100 +portmap_111=229:100 +portmap_112=233:100 +portmap_113=237:100 +portmap_114=241:100 +portmap_115=245:100 +portmap_116=249:100 +portmap_117=253:100 +portmap_11=41:100 +portmap_12=45:100 +portmap_135=263:10 +portmap_13=49:100 +portmap_14=53:100 +portmap_15=57:100 +portmap_16=61:100 +portmap_1=1:100 +portmap_2=5:100 +portmap_33=260:10 +portmap_34=65:100 +portmap_35=69:100 +portmap_36=73:100 +portmap_37=77:100 +portmap_38=81:100 +portmap_39=85:100 +portmap_3=9:100 +portmap_40=89:100 +portmap_41=93:100 +portmap_42=97:100 +portmap_43=101:100 +portmap_44=105:100 +portmap_45=109:100 +portmap_46=113:100 +portmap_47=117:100 +portmap_48=121:100 +portmap_49=125:100 +portmap_4=13:100 +portmap_5=17:100 +portmap_66=257:10 +portmap_67=261:10 +portmap_68=129:100 +portmap_69=133:100 +portmap_6=21:100 +portmap_70=137:100 +portmap_71=141:100 +portmap_72=145:100 +portmap_73=149:100 +portmap_74=153:100 +portmap_75=157:100 +portmap_76=161:100 +portmap_77=165:100 +portmap_78=169:100 +portmap_79=173:100 +portmap_7=25:100 +portmap_80=177:100 +portmap_81=181:100 +portmap_82=185:100 +portmap_83=189:100 +portmap_8=29:100 +portmap_9=33:100 + +lpm_scaling_enable=0 +bcm_num_cos=8 +bcm_stat_jumbo=9236 +ipv6_lpm_128b_enable=1 +max_vp_lags=0 +miim_intr_enable=0 +module_64ports=1 +phy_an_allow_pll_change_hg=0 +robust_hash_disable_egress_vlan=1 +robust_hash_disable_mpls=1 +robust_hash_disable_vlan=1 +scache_filename=/tmp/scache +sram_scan_enable=0 +stable_size=0x5500000 +mmu_lossless=1 diff --git a/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/sai.profile b/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/sai.profile index 5c93f84deb0b..b5586b7ba24c 100644 --- a/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/sai.profile +++ b/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-wedge100-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-wedge100-32x100G.config.bcm diff --git a/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/th-wedge100-32x100G.config.bcm b/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/th-wedge100-32x100G.config.bcm new file mode 100644 index 000000000000..afd1db4cbc02 --- /dev/null +++ b/device/facebook/x86_64-facebook_wedge100-r0/Facebook-W100-C32/th-wedge100-32x100G.config.bcm @@ -0,0 +1,433 @@ +ctr_evict_enable=0x0 +l2_mem_entries=0x8000 +l3_intf_vlan_split_egress=0x1 +l3_mem_entries=0x4000 +mdio_output_delay=0xb +mmu_lossless=0x0 +os=unix +oversubscribe_mode=0x1 +parity_enable=0x1 +pbmp_xport_xe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe +phy_an_c37=0x3 +phy_an_c73=0x0 +portmap_1=5:100 +portmap_102=101:100 +portmap_106=97:100 +portmap_110=109:100 +portmap_114=105:100 +portmap_118=117:100 +portmap_122=113:100 +portmap_126=125:100 +portmap_13=9:100 +portmap_130=121:100 +portmap_17=21:100 +portmap_21=17:100 +portmap_25=29:100 +portmap_29=25:100 +portmap_34=37:100 +portmap_38=33:100 +portmap_42=45:100 +portmap_46=41:100 +portmap_5=1:100 +portmap_50=53:100 +portmap_54=49:100 +portmap_58=61:100 +portmap_62=57:100 +portmap_68=69:100 +portmap_72=65:100 +portmap_76=77:100 +portmap_80=73:100 +portmap_84=85:100 +portmap_88=81:100 +portmap_9=13:100 +portmap_92=93:100 +portmap_96=89:100 +rate_ext_mdio_divisor=0x65 +serdes_automedium=0x0 +serdes_fiber_pref=0x1 +serdes_firmware_mode_xe=0x2 +serdes_preemphasis_1=0x284008 +serdes_preemphasis_10=0x284008 +serdes_preemphasis_102=0x2c4004 +serdes_preemphasis_103=0x2c4004 +serdes_preemphasis_104=0x2c4004 +serdes_preemphasis_105=0x2c4004 +serdes_preemphasis_106=0x2c4004 +serdes_preemphasis_107=0x2c4004 +serdes_preemphasis_108=0x2c4004 +serdes_preemphasis_109=0x2c4004 +serdes_preemphasis_11=0x284008 +serdes_preemphasis_110=0x303c04 +serdes_preemphasis_111=0x303c04 +serdes_preemphasis_112=0x303c04 +serdes_preemphasis_113=0x303c04 +serdes_preemphasis_114=0x303c04 +serdes_preemphasis_115=0x303c04 +serdes_preemphasis_116=0x303c04 +serdes_preemphasis_117=0x303c04 +serdes_preemphasis_118=0x2c4004 +serdes_preemphasis_119=0x2c4004 +serdes_preemphasis_12=0x284008 +serdes_preemphasis_120=0x2c4004 +serdes_preemphasis_121=0x2c4004 +serdes_preemphasis_122=0x303c04 +serdes_preemphasis_123=0x303c04 +serdes_preemphasis_124=0x303c04 +serdes_preemphasis_125=0x303c04 +serdes_preemphasis_126=0x2c4004 +serdes_preemphasis_127=0x2c4004 +serdes_preemphasis_128=0x2c4004 +serdes_preemphasis_129=0x2c4004 +serdes_preemphasis_13=0x284008 +serdes_preemphasis_130=0x2c4004 +serdes_preemphasis_131=0x2c4004 +serdes_preemphasis_132=0x2c4004 +serdes_preemphasis_133=0x2c4004 +serdes_preemphasis_14=0x284008 +serdes_preemphasis_15=0x284008 +serdes_preemphasis_16=0x284008 +serdes_preemphasis_17=0x205000 +serdes_preemphasis_18=0x205000 +serdes_preemphasis_19=0x205000 +serdes_preemphasis_2=0x284008 +serdes_preemphasis_20=0x205000 +serdes_preemphasis_21=0x284800 +serdes_preemphasis_22=0x284800 +serdes_preemphasis_23=0x284800 +serdes_preemphasis_24=0x284800 +serdes_preemphasis_25=0x205000 +serdes_preemphasis_26=0x205000 +serdes_preemphasis_27=0x205000 +serdes_preemphasis_28=0x205000 +serdes_preemphasis_29=0x205000 +serdes_preemphasis_3=0x284008 +serdes_preemphasis_30=0x205000 +serdes_preemphasis_31=0x205000 +serdes_preemphasis_32=0x205000 +serdes_preemphasis_34=0x205000 +serdes_preemphasis_35=0x205000 +serdes_preemphasis_36=0x205000 +serdes_preemphasis_37=0x205000 +serdes_preemphasis_38=0x205000 +serdes_preemphasis_39=0x205000 +serdes_preemphasis_4=0x284008 +serdes_preemphasis_40=0x205000 +serdes_preemphasis_41=0x205000 +serdes_preemphasis_42=0x205000 +serdes_preemphasis_43=0x205000 +serdes_preemphasis_44=0x205000 +serdes_preemphasis_45=0x205000 +serdes_preemphasis_46=0x205000 +serdes_preemphasis_47=0x205000 +serdes_preemphasis_48=0x205000 +serdes_preemphasis_49=0x205000 +serdes_preemphasis_5=0x284008 +serdes_preemphasis_50=0x205000 +serdes_preemphasis_51=0x205000 +serdes_preemphasis_52=0x205000 +serdes_preemphasis_53=0x205000 +serdes_preemphasis_54=0x205000 +serdes_preemphasis_55=0x205000 +serdes_preemphasis_56=0x205000 +serdes_preemphasis_57=0x205000 +serdes_preemphasis_58=0x205000 +serdes_preemphasis_59=0x205000 +serdes_preemphasis_6=0x284008 +serdes_preemphasis_60=0x205000 +serdes_preemphasis_61=0x205000 +serdes_preemphasis_62=0x205000 +serdes_preemphasis_63=0x205000 +serdes_preemphasis_64=0x205000 +serdes_preemphasis_65=0x205000 +serdes_preemphasis_68=0x205000 +serdes_preemphasis_69=0x205000 +serdes_preemphasis_7=0x284008 +serdes_preemphasis_70=0x205000 +serdes_preemphasis_71=0x205000 +serdes_preemphasis_72=0x205000 +serdes_preemphasis_73=0x205000 +serdes_preemphasis_74=0x205000 +serdes_preemphasis_75=0x205000 +serdes_preemphasis_76=0x284800 +serdes_preemphasis_77=0x284800 +serdes_preemphasis_78=0x284800 +serdes_preemphasis_79=0x284800 +serdes_preemphasis_8=0x284008 +serdes_preemphasis_80=0x205000 +serdes_preemphasis_81=0x205000 +serdes_preemphasis_82=0x205000 +serdes_preemphasis_83=0x205000 +serdes_preemphasis_84=0x284800 +serdes_preemphasis_85=0x284800 +serdes_preemphasis_86=0x284800 +serdes_preemphasis_87=0x284800 +serdes_preemphasis_88=0x284800 +serdes_preemphasis_89=0x284800 +serdes_preemphasis_9=0x284008 +serdes_preemphasis_90=0x284800 +serdes_preemphasis_91=0x284800 +serdes_preemphasis_92=0x284800 +serdes_preemphasis_93=0x284800 +serdes_preemphasis_94=0x284800 +serdes_preemphasis_95=0x284800 +serdes_preemphasis_96=0x284800 +serdes_preemphasis_97=0x284800 +serdes_preemphasis_98=0x284800 +serdes_preemphasis_99=0x284800 +stable_size=0x6000000 +xgxs_rx_lane_map_1=0x3210 +xgxs_rx_lane_map_10=0x3210 +xgxs_rx_lane_map_102=0x123 +xgxs_rx_lane_map_103=0x123 +xgxs_rx_lane_map_104=0x123 +xgxs_rx_lane_map_105=0x123 +xgxs_rx_lane_map_106=0x3210 +xgxs_rx_lane_map_107=0x3210 +xgxs_rx_lane_map_108=0x3210 +xgxs_rx_lane_map_109=0x3210 +xgxs_rx_lane_map_11=0x3210 +xgxs_rx_lane_map_110=0x1032 +xgxs_rx_lane_map_111=0x1032 +xgxs_rx_lane_map_112=0x1032 +xgxs_rx_lane_map_113=0x1032 +xgxs_rx_lane_map_114=0x3210 +xgxs_rx_lane_map_115=0x3210 +xgxs_rx_lane_map_116=0x3210 +xgxs_rx_lane_map_117=0x3210 +xgxs_rx_lane_map_118=0x2301 +xgxs_rx_lane_map_119=0x2301 +xgxs_rx_lane_map_12=0x3210 +xgxs_rx_lane_map_120=0x2301 +xgxs_rx_lane_map_121=0x2301 +xgxs_rx_lane_map_122=0x3210 +xgxs_rx_lane_map_123=0x3210 +xgxs_rx_lane_map_124=0x3210 +xgxs_rx_lane_map_125=0x3210 +xgxs_rx_lane_map_126=0x1032 +xgxs_rx_lane_map_127=0x1032 +xgxs_rx_lane_map_128=0x1032 +xgxs_rx_lane_map_129=0x1032 +xgxs_rx_lane_map_13=0x3210 +xgxs_rx_lane_map_130=0x3210 +xgxs_rx_lane_map_131=0x3210 +xgxs_rx_lane_map_132=0x3210 +xgxs_rx_lane_map_133=0x3210 +xgxs_rx_lane_map_14=0x3210 +xgxs_rx_lane_map_15=0x3210 +xgxs_rx_lane_map_16=0x3210 +xgxs_rx_lane_map_17=0x2301 +xgxs_rx_lane_map_18=0x2301 +xgxs_rx_lane_map_19=0x2301 +xgxs_rx_lane_map_2=0x3210 +xgxs_rx_lane_map_20=0x2301 +xgxs_rx_lane_map_21=0x1032 +xgxs_rx_lane_map_22=0x1032 +xgxs_rx_lane_map_23=0x1032 +xgxs_rx_lane_map_24=0x1032 +xgxs_rx_lane_map_25=0x3210 +xgxs_rx_lane_map_26=0x3210 +xgxs_rx_lane_map_27=0x3210 +xgxs_rx_lane_map_28=0x3210 +xgxs_rx_lane_map_29=0x1032 +xgxs_rx_lane_map_3=0x3210 +xgxs_rx_lane_map_30=0x1032 +xgxs_rx_lane_map_31=0x1032 +xgxs_rx_lane_map_32=0x1032 +xgxs_rx_lane_map_34=0x2301 +xgxs_rx_lane_map_35=0x2301 +xgxs_rx_lane_map_36=0x2301 +xgxs_rx_lane_map_37=0x2301 +xgxs_rx_lane_map_38=0x1032 +xgxs_rx_lane_map_39=0x1032 +xgxs_rx_lane_map_4=0x3210 +xgxs_rx_lane_map_40=0x1032 +xgxs_rx_lane_map_41=0x1032 +xgxs_rx_lane_map_42=0x3210 +xgxs_rx_lane_map_43=0x3210 +xgxs_rx_lane_map_44=0x3210 +xgxs_rx_lane_map_45=0x3210 +xgxs_rx_lane_map_46=0x1032 +xgxs_rx_lane_map_47=0x1032 +xgxs_rx_lane_map_48=0x1032 +xgxs_rx_lane_map_49=0x1032 +xgxs_rx_lane_map_5=0x3210 +xgxs_rx_lane_map_50=0x1032 +xgxs_rx_lane_map_51=0x1032 +xgxs_rx_lane_map_52=0x1032 +xgxs_rx_lane_map_53=0x1032 +xgxs_rx_lane_map_54=0x1032 +xgxs_rx_lane_map_55=0x1032 +xgxs_rx_lane_map_56=0x1032 +xgxs_rx_lane_map_57=0x1032 +xgxs_rx_lane_map_58=0x1032 +xgxs_rx_lane_map_59=0x1032 +xgxs_rx_lane_map_6=0x3210 +xgxs_rx_lane_map_60=0x1032 +xgxs_rx_lane_map_61=0x1032 +xgxs_rx_lane_map_62=0x1032 +xgxs_rx_lane_map_63=0x1032 +xgxs_rx_lane_map_64=0x1032 +xgxs_rx_lane_map_65=0x1032 +xgxs_rx_lane_map_68=0x1032 +xgxs_rx_lane_map_69=0x1032 +xgxs_rx_lane_map_7=0x3210 +xgxs_rx_lane_map_70=0x1032 +xgxs_rx_lane_map_71=0x1032 +xgxs_rx_lane_map_72=0x3210 +xgxs_rx_lane_map_73=0x3210 +xgxs_rx_lane_map_74=0x3210 +xgxs_rx_lane_map_75=0x3210 +xgxs_rx_lane_map_76=0x213 +xgxs_rx_lane_map_77=0x213 +xgxs_rx_lane_map_78=0x213 +xgxs_rx_lane_map_79=0x213 +xgxs_rx_lane_map_8=0x3210 +xgxs_rx_lane_map_80=0x1032 +xgxs_rx_lane_map_81=0x1032 +xgxs_rx_lane_map_82=0x1032 +xgxs_rx_lane_map_83=0x1032 +xgxs_rx_lane_map_84=0x123 +xgxs_rx_lane_map_85=0x123 +xgxs_rx_lane_map_86=0x123 +xgxs_rx_lane_map_87=0x123 +xgxs_rx_lane_map_88=0x3210 +xgxs_rx_lane_map_89=0x3210 +xgxs_rx_lane_map_9=0x3210 +xgxs_rx_lane_map_90=0x3210 +xgxs_rx_lane_map_91=0x3210 +xgxs_rx_lane_map_92=0x1032 +xgxs_rx_lane_map_93=0x1032 +xgxs_rx_lane_map_94=0x1032 +xgxs_rx_lane_map_95=0x1032 +xgxs_rx_lane_map_96=0x3210 +xgxs_rx_lane_map_97=0x3210 +xgxs_rx_lane_map_98=0x3210 +xgxs_rx_lane_map_99=0x3210 +xgxs_tx_lane_map_1=0x3210 +xgxs_tx_lane_map_10=0x3210 +xgxs_tx_lane_map_102=0x3210 +xgxs_tx_lane_map_103=0x3210 +xgxs_tx_lane_map_104=0x3210 +xgxs_tx_lane_map_105=0x3210 +xgxs_tx_lane_map_106=0x1032 +xgxs_tx_lane_map_107=0x1032 +xgxs_tx_lane_map_108=0x1032 +xgxs_tx_lane_map_109=0x1032 +xgxs_tx_lane_map_11=0x3210 +xgxs_tx_lane_map_110=0x3210 +xgxs_tx_lane_map_111=0x3210 +xgxs_tx_lane_map_112=0x3210 +xgxs_tx_lane_map_113=0x3210 +xgxs_tx_lane_map_114=0x1032 +xgxs_tx_lane_map_115=0x1032 +xgxs_tx_lane_map_116=0x1032 +xgxs_tx_lane_map_117=0x1032 +xgxs_tx_lane_map_118=0x3210 +xgxs_tx_lane_map_119=0x3210 +xgxs_tx_lane_map_12=0x3210 +xgxs_tx_lane_map_120=0x3210 +xgxs_tx_lane_map_121=0x3210 +xgxs_tx_lane_map_122=0x1032 +xgxs_tx_lane_map_123=0x1032 +xgxs_tx_lane_map_124=0x1032 +xgxs_tx_lane_map_125=0x1032 +xgxs_tx_lane_map_126=0x1032 +xgxs_tx_lane_map_127=0x1032 +xgxs_tx_lane_map_128=0x1032 +xgxs_tx_lane_map_129=0x1032 +xgxs_tx_lane_map_13=0x3210 +xgxs_tx_lane_map_130=0x3210 +xgxs_tx_lane_map_131=0x3210 +xgxs_tx_lane_map_132=0x3210 +xgxs_tx_lane_map_133=0x3210 +xgxs_tx_lane_map_14=0x3210 +xgxs_tx_lane_map_15=0x3210 +xgxs_tx_lane_map_16=0x3210 +xgxs_tx_lane_map_17=0x1032 +xgxs_tx_lane_map_18=0x1032 +xgxs_tx_lane_map_19=0x1032 +xgxs_tx_lane_map_2=0x3210 +xgxs_tx_lane_map_20=0x1032 +xgxs_tx_lane_map_21=0x3210 +xgxs_tx_lane_map_22=0x3210 +xgxs_tx_lane_map_23=0x3210 +xgxs_tx_lane_map_24=0x3210 +xgxs_tx_lane_map_25=0x1032 +xgxs_tx_lane_map_26=0x1032 +xgxs_tx_lane_map_27=0x1032 +xgxs_tx_lane_map_28=0x1032 +xgxs_tx_lane_map_29=0x3210 +xgxs_tx_lane_map_3=0x3210 +xgxs_tx_lane_map_30=0x3210 +xgxs_tx_lane_map_31=0x3210 +xgxs_tx_lane_map_32=0x3210 +xgxs_tx_lane_map_34=0x1032 +xgxs_tx_lane_map_35=0x1032 +xgxs_tx_lane_map_36=0x1032 +xgxs_tx_lane_map_37=0x1032 +xgxs_tx_lane_map_38=0x3210 +xgxs_tx_lane_map_39=0x3210 +xgxs_tx_lane_map_4=0x3210 +xgxs_tx_lane_map_40=0x3210 +xgxs_tx_lane_map_41=0x3210 +xgxs_tx_lane_map_42=0x1032 +xgxs_tx_lane_map_43=0x1032 +xgxs_tx_lane_map_44=0x1032 +xgxs_tx_lane_map_45=0x1032 +xgxs_tx_lane_map_46=0x3210 +xgxs_tx_lane_map_47=0x3210 +xgxs_tx_lane_map_48=0x3210 +xgxs_tx_lane_map_49=0x3210 +xgxs_tx_lane_map_5=0x3210 +xgxs_tx_lane_map_50=0x1032 +xgxs_tx_lane_map_51=0x1032 +xgxs_tx_lane_map_52=0x1032 +xgxs_tx_lane_map_53=0x1032 +xgxs_tx_lane_map_54=0x1032 +xgxs_tx_lane_map_55=0x1032 +xgxs_tx_lane_map_56=0x1032 +xgxs_tx_lane_map_57=0x1032 +xgxs_tx_lane_map_58=0x1032 +xgxs_tx_lane_map_59=0x1032 +xgxs_tx_lane_map_6=0x3210 +xgxs_tx_lane_map_60=0x1032 +xgxs_tx_lane_map_61=0x1032 +xgxs_tx_lane_map_62=0x1032 +xgxs_tx_lane_map_63=0x1032 +xgxs_tx_lane_map_64=0x1032 +xgxs_tx_lane_map_65=0x1032 +xgxs_tx_lane_map_68=0x1032 +xgxs_tx_lane_map_69=0x1032 +xgxs_tx_lane_map_7=0x3210 +xgxs_tx_lane_map_70=0x1032 +xgxs_tx_lane_map_71=0x1032 +xgxs_tx_lane_map_72=0x3210 +xgxs_tx_lane_map_73=0x3210 +xgxs_tx_lane_map_74=0x3210 +xgxs_tx_lane_map_75=0x3210 +xgxs_tx_lane_map_76=0x3210 +xgxs_tx_lane_map_77=0x3210 +xgxs_tx_lane_map_78=0x3210 +xgxs_tx_lane_map_79=0x3210 +xgxs_tx_lane_map_8=0x3210 +xgxs_tx_lane_map_80=0x1032 +xgxs_tx_lane_map_81=0x1032 +xgxs_tx_lane_map_82=0x1032 +xgxs_tx_lane_map_83=0x1032 +xgxs_tx_lane_map_84=0x3210 +xgxs_tx_lane_map_85=0x3210 +xgxs_tx_lane_map_86=0x3210 +xgxs_tx_lane_map_87=0x3210 +xgxs_tx_lane_map_88=0x1032 +xgxs_tx_lane_map_89=0x1032 +xgxs_tx_lane_map_9=0x3210 +xgxs_tx_lane_map_90=0x1032 +xgxs_tx_lane_map_91=0x1032 +xgxs_tx_lane_map_92=0x3210 +xgxs_tx_lane_map_93=0x3210 +xgxs_tx_lane_map_94=0x3210 +xgxs_tx_lane_map_95=0x3210 +xgxs_tx_lane_map_96=0x1032 +xgxs_tx_lane_map_97=0x1032 +xgxs_tx_lane_map_98=0x1032 +xgxs_tx_lane_map_99=0x1032 diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/sai.profile b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/sai.profile index 3fdcc3f1a506..42315ee4ea6a 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/sai.profile +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/td2-s8810-32x40G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-s8810-32x40G.config.bcm diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/td2-s8810-32x40G.config.bcm b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/td2-s8810-32x40G.config.bcm new file mode 100644 index 000000000000..daa4b7a7ed24 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/td2-s8810-32x40G.config.bcm @@ -0,0 +1,474 @@ +#2017/09/12 +os=unix + +module_64ports=0 +scache_filename=/tmp/scache +schan_intr_enable=0 +stable_size=0x2000000 + +pbmp_xport_xe=0x000007fffffffffffffffffffffffffe +pbmp_oversubscribe=0x000007fffffffffffffffffffffffffe + +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +l2xmsg_mode=1 +mmu_lossless=0 + +#Parity +parity_correction=1 +parity_enable=1 + +portmap_1=37:40 +portmap_2=33:40 +portmap_3=45:40 +portmap_4=41:40 +portmap_5=53:40 +portmap_6=49:40 +portmap_7=61:40 +portmap_8=57:40 +portmap_9=69:40 +portmap_10=65:40 +portmap_11=77:40 +portmap_12=73:40 +portmap_13=85:40 +portmap_14=81:40 +portmap_15=93:40 +portmap_16=89:40 +portmap_17=101:40 +portmap_18=97:40 +portmap_19=109:40 +portmap_20=105:40 +portmap_21=117:40 +portmap_22=113:40 +portmap_23=125:40 +portmap_24=121:40 +portmap_25=5:40 +portmap_26=1:40 +portmap_27=13:40 +portmap_28=9:40 +portmap_29=21:40 +portmap_30=17:40 +portmap_31=29:40 +portmap_32=25:40 + +serdes_driver_current_lane0_xe0=0x6 +serdes_driver_current_lane1_xe0=0x6 +serdes_driver_current_lane2_xe0=0x6 +serdes_driver_current_lane3_xe0=0x7 +serdes_pre_driver_current_lane0_xe0=0x6 +serdes_pre_driver_current_lane1_xe0=0x6 +serdes_pre_driver_current_lane2_xe0=0x6 +serdes_pre_driver_current_lane3_xe0=0x7 +serdes_preemphasis_lane0_xe0=0xc2f0 +serdes_preemphasis_lane1_xe0=0xcf20 +serdes_preemphasis_lane2_xe0=0xc2f0 +serdes_preemphasis_lane3_xe0=0xc2f0 + +serdes_driver_current_lane0_xe1=0x8 +serdes_driver_current_lane1_xe1=0x8 +serdes_driver_current_lane2_xe1=0x8 +serdes_driver_current_lane3_xe1=0x8 +serdes_pre_driver_current_lane0_xe1=0x8 +serdes_pre_driver_current_lane1_xe1=0x8 +serdes_pre_driver_current_lane2_xe1=0x8 +serdes_pre_driver_current_lane3_xe1=0x8 +serdes_preemphasis_lane0_xe1=0xc6e0 +serdes_preemphasis_lane1_xe1=0xc6e0 +serdes_preemphasis_lane2_xe1=0xc6e0 +serdes_preemphasis_lane3_xe1=0xc6e0 + +serdes_driver_current_lane0_xe2=0x5 +serdes_driver_current_lane1_xe2=0x3 +serdes_driver_current_lane2_xe2=0x3 +serdes_driver_current_lane3_xe2=0x3 +serdes_pre_driver_current_lane0_xe2=0x5 +serdes_pre_driver_current_lane1_xe2=0x3 +serdes_pre_driver_current_lane2_xe2=0x3 +serdes_pre_driver_current_lane3_xe2=0x3 +serdes_preemphasis_lane0_xe2=0x9b90 +serdes_preemphasis_lane1_xe2=0x9f80 +serdes_preemphasis_lane2_xe2=0x9b90 +serdes_preemphasis_lane3_xe2=0x9b90 + +serdes_driver_current_lane0_xe3=0x5 +serdes_driver_current_lane1_xe3=0x5 +serdes_driver_current_lane2_xe3=0x5 +serdes_driver_current_lane3_xe3=0x5 +serdes_pre_driver_current_lane0_xe3=0x5 +serdes_pre_driver_current_lane1_xe3=0x5 +serdes_pre_driver_current_lane2_xe3=0x5 +serdes_pre_driver_current_lane3_xe3=0x5 +serdes_preemphasis_lane0_xe3=0x9b90 +serdes_preemphasis_lane1_xe3=0x9b90 +serdes_preemphasis_lane2_xe3=0x9b90 +serdes_preemphasis_lane3_xe3=0x9b90 + +serdes_driver_current_lane0_xe4=0x3 +serdes_driver_current_lane1_xe4=0x3 +serdes_driver_current_lane2_xe4=0x3 +serdes_driver_current_lane3_xe4=0x3 +serdes_pre_driver_current_lane0_xe4=0x3 +serdes_pre_driver_current_lane1_xe4=0x3 +serdes_pre_driver_current_lane2_xe4=0x3 +serdes_pre_driver_current_lane3_xe4=0x3 +serdes_preemphasis_lane0_xe4=0x93b0 +serdes_preemphasis_lane1_xe4=0x97a0 +serdes_preemphasis_lane2_xe4=0x9b90 +serdes_preemphasis_lane3_xe4=0x9b90 + +serdes_driver_current_lane0_xe5=0x3 +serdes_driver_current_lane1_xe5=0x3 +serdes_driver_current_lane2_xe5=0x3 +serdes_driver_current_lane3_xe5=0x3 +serdes_pre_driver_current_lane0_xe5=0x3 +serdes_pre_driver_current_lane1_xe5=0x3 +serdes_pre_driver_current_lane2_xe5=0x3 +serdes_pre_driver_current_lane3_xe5=0x3 +serdes_preemphasis_lane0_xe5=0x9b90 +serdes_preemphasis_lane1_xe5=0x9b90 +serdes_preemphasis_lane2_xe5=0x9b90 +serdes_preemphasis_lane3_xe5=0x9b90 + +serdes_driver_current_lane0_xe6=0x1 +serdes_driver_current_lane1_xe6=0x1 +serdes_driver_current_lane2_xe6=0x1 +serdes_driver_current_lane3_xe6=0x1 +serdes_pre_driver_current_lane0_xe6=0x1 +serdes_pre_driver_current_lane1_xe6=0x1 +serdes_pre_driver_current_lane2_xe6=0x1 +serdes_pre_driver_current_lane3_xe6=0x1 +serdes_preemphasis_lane0_xe6=0xa760 +serdes_preemphasis_lane1_xe6=0xc2f0 +serdes_preemphasis_lane2_xe6=0xa760 +serdes_preemphasis_lane3_xe6=0xa760 + +serdes_driver_current_lane0_xe7=0x1 +serdes_driver_current_lane1_xe7=0x1 +serdes_driver_current_lane2_xe7=0x1 +serdes_driver_current_lane3_xe7=0x1 +serdes_pre_driver_current_lane0_xe7=0x0 +serdes_pre_driver_current_lane1_xe7=0x0 +serdes_pre_driver_current_lane2_xe7=0x0 +serdes_pre_driver_current_lane3_xe7=0x0 +serdes_preemphasis_lane0_xe7=0xa760 +serdes_preemphasis_lane1_xe7=0xa760 +serdes_preemphasis_lane2_xe7=0xa760 +serdes_preemphasis_lane3_xe7=0xa760 + +serdes_driver_current_lane0_xe8=0x1 +serdes_driver_current_lane1_xe8=0x1 +serdes_driver_current_lane2_xe8=0x1 +serdes_driver_current_lane3_xe8=0x0 +serdes_pre_driver_current_lane0_xe8=0x0 +serdes_pre_driver_current_lane1_xe8=0x0 +serdes_pre_driver_current_lane2_xe8=0x0 +serdes_pre_driver_current_lane3_xe8=0x0 +serdes_preemphasis_lane0_xe8=0xa760 +serdes_preemphasis_lane1_xe8=0xa760 +serdes_preemphasis_lane2_xe8=0xa760 +serdes_preemphasis_lane3_xe8=0xa760 + +serdes_driver_current_lane0_xe9=0x1 +serdes_driver_current_lane1_xe9=0x1 +serdes_driver_current_lane2_xe9=0x1 +serdes_driver_current_lane3_xe9=0x1 +serdes_pre_driver_current_lane0_xe9=0x0 +serdes_pre_driver_current_lane1_xe9=0x0 +serdes_pre_driver_current_lane2_xe9=0x0 +serdes_pre_driver_current_lane3_xe9=0x0 +serdes_preemphasis_lane0_xe9=0xa760 +serdes_preemphasis_lane1_xe9=0xa760 +serdes_preemphasis_lane2_xe9=0xa760 +serdes_preemphasis_lane3_xe9=0xa760 + +serdes_driver_current_lane0_xe10=0x1 +serdes_driver_current_lane1_xe10=0x1 +serdes_driver_current_lane2_xe10=0x1 +serdes_driver_current_lane3_xe10=0x1 +serdes_pre_driver_current_lane0_xe10=0x0 +serdes_pre_driver_current_lane1_xe10=0x0 +serdes_pre_driver_current_lane2_xe10=0x0 +serdes_pre_driver_current_lane3_xe10=0x0 +serdes_preemphasis_lane0_xe10=0xa760 +serdes_preemphasis_lane1_xe10=0xa760 +serdes_preemphasis_lane2_xe10=0xa760 +serdes_preemphasis_lane3_xe10=0xa760 + +serdes_driver_current_lane0_xe11=0x1 +serdes_driver_current_lane1_xe11=0x1 +serdes_driver_current_lane2_xe11=0x1 +serdes_driver_current_lane3_xe11=0x1 +serdes_pre_driver_current_lane0_xe11=0x1 +serdes_pre_driver_current_lane1_xe11=0x0 +serdes_pre_driver_current_lane2_xe11=0x1 +serdes_pre_driver_current_lane3_xe11=0x0 +serdes_preemphasis_lane0_xe11=0xa760 +serdes_preemphasis_lane1_xe11=0xa760 +serdes_preemphasis_lane2_xe11=0xa760 +serdes_preemphasis_lane3_xe11=0xa760 + +serdes_driver_current_lane0_xe12=0x1 +serdes_driver_current_lane1_xe12=0x1 +serdes_driver_current_lane2_xe12=0x1 +serdes_driver_current_lane3_xe12=0x1 +serdes_pre_driver_current_lane0_xe12=0x0 +serdes_pre_driver_current_lane1_xe12=0x0 +serdes_pre_driver_current_lane2_xe12=0x0 +serdes_pre_driver_current_lane3_xe12=0x0 +serdes_preemphasis_lane0_xe12=0xa760 +serdes_preemphasis_lane1_xe12=0xa760 +serdes_preemphasis_lane2_xe12=0xa760 +serdes_preemphasis_lane3_xe12=0xa760 + +serdes_driver_current_lane0_xe13=0x1 +serdes_driver_current_lane1_xe13=0x1 +serdes_driver_current_lane2_xe13=0x1 +serdes_driver_current_lane3_xe13=0x1 +serdes_pre_driver_current_lane0_xe13=0x1 +serdes_pre_driver_current_lane1_xe13=0x1 +serdes_pre_driver_current_lane2_xe13=0x1 +serdes_pre_driver_current_lane3_xe13=0x0 +serdes_preemphasis_lane0_xe13=0xa760 +serdes_preemphasis_lane1_xe13=0xa760 +serdes_preemphasis_lane2_xe13=0xa760 +serdes_preemphasis_lane3_xe13=0xa760 + +serdes_driver_current_lane0_xe14=0x3 +serdes_driver_current_lane1_xe14=0x3 +serdes_driver_current_lane2_xe14=0x3 +serdes_driver_current_lane3_xe14=0x3 +serdes_pre_driver_current_lane0_xe14=0x3 +serdes_pre_driver_current_lane1_xe14=0x3 +serdes_pre_driver_current_lane2_xe14=0x3 +serdes_pre_driver_current_lane3_xe14=0x3 +serdes_preemphasis_lane0_xe14=0xaf40 +serdes_preemphasis_lane1_xe14=0xab50 +serdes_preemphasis_lane2_xe14=0xaf40 +serdes_preemphasis_lane3_xe14=0xaf40 + +serdes_driver_current_lane0_xe15=0x3 +serdes_driver_current_lane1_xe15=0x3 +serdes_driver_current_lane2_xe15=0x3 +serdes_driver_current_lane3_xe15=0x3 +serdes_pre_driver_current_lane0_xe15=0x3 +serdes_pre_driver_current_lane1_xe15=0x3 +serdes_pre_driver_current_lane2_xe15=0x3 +serdes_pre_driver_current_lane3_xe15=0x3 +serdes_preemphasis_lane0_xe15=0xaf40 +serdes_preemphasis_lane1_xe15=0xaf40 +serdes_preemphasis_lane2_xe15=0xab50 +serdes_preemphasis_lane3_xe15=0xab50 + +serdes_driver_current_lane0_xe16=0x0 +serdes_driver_current_lane1_xe16=0x1 +serdes_driver_current_lane2_xe16=0x1 +serdes_driver_current_lane3_xe16=0x1 +serdes_pre_driver_current_lane0_xe16=0x0 +serdes_pre_driver_current_lane1_xe16=0x1 +serdes_pre_driver_current_lane2_xe16=0x1 +serdes_pre_driver_current_lane3_xe16=0x1 +serdes_preemphasis_lane0_xe16=0xa760 +serdes_preemphasis_lane1_xe16=0xa760 +serdes_preemphasis_lane2_xe16=0xa760 +serdes_preemphasis_lane3_xe16=0xa760 + +serdes_driver_current_lane0_xe17=0x1 +serdes_driver_current_lane1_xe17=0x0 +serdes_driver_current_lane2_xe17=0x1 +serdes_driver_current_lane3_xe17=0x1 +serdes_pre_driver_current_lane0_xe17=0x1 +serdes_pre_driver_current_lane1_xe17=0x0 +serdes_pre_driver_current_lane2_xe17=0x1 +serdes_pre_driver_current_lane3_xe17=0x1 +serdes_preemphasis_lane0_xe17=0xa760 +serdes_preemphasis_lane1_xe17=0x9b90 +serdes_preemphasis_lane2_xe17=0xa760 +serdes_preemphasis_lane3_xe17=0xa760 + +serdes_driver_current_lane0_xe18=0x1 +serdes_driver_current_lane1_xe18=0x1 +serdes_driver_current_lane2_xe18=0x1 +serdes_driver_current_lane3_xe18=0x1 +serdes_pre_driver_current_lane0_xe18=0x1 +serdes_pre_driver_current_lane1_xe18=0x1 +serdes_pre_driver_current_lane2_xe18=0x1 +serdes_pre_driver_current_lane3_xe18=0x1 +serdes_preemphasis_lane0_xe18=0xa760 +serdes_preemphasis_lane1_xe18=0xa760 +serdes_preemphasis_lane2_xe18=0xa760 +serdes_preemphasis_lane3_xe18=0xa760 + +serdes_driver_current_lane0_xe19=0x1 +serdes_driver_current_lane1_xe19=0x1 +serdes_driver_current_lane2_xe19=0x1 +serdes_driver_current_lane3_xe19=0x1 +serdes_pre_driver_current_lane0_xe19=0x1 +serdes_pre_driver_current_lane1_xe19=0x1 +serdes_pre_driver_current_lane2_xe19=0x0 +serdes_pre_driver_current_lane3_xe19=0x1 +serdes_preemphasis_lane0_xe19=0xa760 +serdes_preemphasis_lane1_xe19=0xa760 +serdes_preemphasis_lane2_xe19=0xa760 +serdes_preemphasis_lane3_xe19=0xa760 + +serdes_driver_current_lane0_xe20=0x1 +serdes_driver_current_lane1_xe20=0x2 +serdes_driver_current_lane2_xe20=0x1 +serdes_driver_current_lane3_xe20=0x1 +serdes_pre_driver_current_lane0_xe20=0x0 +serdes_pre_driver_current_lane1_xe20=0x2 +serdes_pre_driver_current_lane2_xe20=0x1 +serdes_pre_driver_current_lane3_xe20=0x1 +serdes_preemphasis_lane0_xe20=0xa760 +serdes_preemphasis_lane1_xe20=0xa670 +serdes_preemphasis_lane2_xe20=0xa760 +serdes_preemphasis_lane3_xe20=0xa760 + +serdes_driver_current_lane0_xe21=0x1 +serdes_driver_current_lane1_xe21=0x1 +serdes_driver_current_lane2_xe21=0x0 +serdes_driver_current_lane3_xe21=0x1 +serdes_pre_driver_current_lane0_xe21=0x0 +serdes_pre_driver_current_lane1_xe21=0x1 +serdes_pre_driver_current_lane2_xe21=0x0 +serdes_pre_driver_current_lane3_xe21=0x1 +serdes_preemphasis_lane0_xe21=0xa760 +serdes_preemphasis_lane1_xe21=0xa670 +serdes_preemphasis_lane2_xe21=0xa760 +serdes_preemphasis_lane3_xe21=0xa760 + +serdes_driver_current_lane0_xe22=0x1 +serdes_driver_current_lane1_xe22=0x4 +serdes_driver_current_lane2_xe22=0x2 +serdes_driver_current_lane3_xe22=0x2 +serdes_pre_driver_current_lane0_xe22=0x1 +serdes_pre_driver_current_lane1_xe22=0x4 +serdes_pre_driver_current_lane2_xe22=0x2 +serdes_pre_driver_current_lane3_xe22=0x2 +serdes_preemphasis_lane0_xe22=0xa760 +serdes_preemphasis_lane1_xe22=0x97a0 +serdes_preemphasis_lane2_xe22=0xa670 +serdes_preemphasis_lane3_xe22=0xa760 + +serdes_driver_current_lane0_xe23=0x3 +serdes_driver_current_lane1_xe23=0x3 +serdes_driver_current_lane2_xe23=0x1 +serdes_driver_current_lane3_xe23=0x1 +serdes_pre_driver_current_lane0_xe23=0x3 +serdes_pre_driver_current_lane1_xe23=0x3 +serdes_pre_driver_current_lane2_xe23=0x1 +serdes_pre_driver_current_lane3_xe23=0x1 +serdes_preemphasis_lane0_xe23=0xa760 +serdes_preemphasis_lane1_xe23=0x9b90 +serdes_preemphasis_lane2_xe23=0xab50 +serdes_preemphasis_lane3_xe23=0xa760 + +serdes_driver_current_lane0_xe24=0x1 +serdes_driver_current_lane1_xe24=0x4 +serdes_driver_current_lane2_xe24=0x4 +serdes_driver_current_lane3_xe24=0x3 +serdes_pre_driver_current_lane0_xe24=0x1 +serdes_pre_driver_current_lane1_xe24=0x4 +serdes_pre_driver_current_lane2_xe24=0x4 +serdes_pre_driver_current_lane3_xe24=0x3 +serdes_preemphasis_lane0_xe24=0xa760 +serdes_preemphasis_lane1_xe24=0x93b0 +serdes_preemphasis_lane2_xe24=0x9b90 +serdes_preemphasis_lane3_xe24=0xa760 + +serdes_driver_current_lane0_xe25=0x4 +serdes_driver_current_lane1_xe25=0x3 +serdes_driver_current_lane2_xe25=0x3 +serdes_driver_current_lane3_xe25=0x1 +serdes_pre_driver_current_lane0_xe25=0x4 +serdes_pre_driver_current_lane1_xe25=0x3 +serdes_pre_driver_current_lane2_xe25=0x3 +serdes_pre_driver_current_lane3_xe25=0x1 +serdes_preemphasis_lane0_xe25=0x93b0 +serdes_preemphasis_lane1_xe25=0x9b90 +serdes_preemphasis_lane2_xe25=0x9b90 +serdes_preemphasis_lane3_xe25=0xa760 + +serdes_driver_current_lane0_xe26=0x4 +serdes_driver_current_lane1_xe26=0x4 +serdes_driver_current_lane2_xe26=0x4 +serdes_driver_current_lane3_xe26=0x4 +serdes_pre_driver_current_lane0_xe26=0x4 +serdes_pre_driver_current_lane1_xe26=0x4 +serdes_pre_driver_current_lane2_xe26=0x4 +serdes_pre_driver_current_lane3_xe26=0x4 +serdes_preemphasis_lane0_xe26=0x9b90 +serdes_preemphasis_lane1_xe26=0x97a0 +serdes_preemphasis_lane2_xe26=0x9b90 +serdes_preemphasis_lane3_xe26=0x97a0 + +serdes_driver_current_lane0_xe27=0x4 +serdes_driver_current_lane1_xe27=0x3 +serdes_driver_current_lane2_xe27=0x3 +serdes_driver_current_lane3_xe27=0x3 +serdes_pre_driver_current_lane0_xe27=0x4 +serdes_pre_driver_current_lane1_xe27=0x3 +serdes_pre_driver_current_lane2_xe27=0x3 +serdes_pre_driver_current_lane3_xe27=0x3 +serdes_preemphasis_lane0_xe27=0x9b90 +serdes_preemphasis_lane1_xe27=0x9b90 +serdes_preemphasis_lane2_xe27=0x9b90 +serdes_preemphasis_lane3_xe27=0x9b90 + +serdes_driver_current_lane0_xe28=0x5 +serdes_driver_current_lane1_xe28=0x5 +serdes_driver_current_lane2_xe28=0x6 +serdes_driver_current_lane3_xe28=0x6 +serdes_pre_driver_current_lane0_xe28=0x5 +serdes_pre_driver_current_lane1_xe28=0x5 +serdes_pre_driver_current_lane2_xe28=0x6 +serdes_pre_driver_current_lane3_xe28=0x6 +serdes_preemphasis_lane0_xe28=0xbf00 +serdes_preemphasis_lane1_xe28=0xbf00 +serdes_preemphasis_lane2_xe28=0xbf00 +serdes_preemphasis_lane3_xe28=0xbf00 + +serdes_driver_current_lane0_xe29=0x7 +serdes_driver_current_lane1_xe29=0x6 +serdes_driver_current_lane2_xe29=0x6 +serdes_driver_current_lane3_xe29=0x6 +serdes_pre_driver_current_lane0_xe29=0x7 +serdes_pre_driver_current_lane1_xe29=0x6 +serdes_pre_driver_current_lane2_xe29=0x6 +serdes_pre_driver_current_lane3_xe29=0x6 +serdes_preemphasis_lane0_xe29=0xbb10 +serdes_preemphasis_lane1_xe29=0xbb10 +serdes_preemphasis_lane2_xe29=0xbb10 +serdes_preemphasis_lane3_xe29=0xbb10 + +serdes_driver_current_lane0_xe30=0x7 +serdes_driver_current_lane1_xe30=0x7 +serdes_driver_current_lane2_xe30=0x7 +serdes_driver_current_lane3_xe30=0x7 +serdes_pre_driver_current_lane0_xe30=0x7 +serdes_pre_driver_current_lane1_xe30=0x7 +serdes_pre_driver_current_lane2_xe30=0x7 +serdes_pre_driver_current_lane3_xe30=0x7 +serdes_preemphasis_lane0_xe30=0xc2f0 +serdes_preemphasis_lane1_xe30=0xc2f0 +serdes_preemphasis_lane2_xe30=0xc2f0 +serdes_preemphasis_lane3_xe30=0xc2f0 + +serdes_driver_current_lane0_xe31=0x7 +serdes_driver_current_lane1_xe31=0x7 +serdes_driver_current_lane2_xe31=0x7 +serdes_driver_current_lane3_xe31=0x7 +serdes_pre_driver_current_lane0_xe31=0x7 +serdes_pre_driver_current_lane1_xe31=0x7 +serdes_pre_driver_current_lane2_xe31=0x7 +serdes_pre_driver_current_lane3_xe31=0x7 +serdes_preemphasis_lane0_xe31=0xc2f0 +serdes_preemphasis_lane1_xe31=0xc2f0 +serdes_preemphasis_lane2_xe31=0xc2f0 +serdes_preemphasis_lane3_xe31=0xc2f0 + +serdes_if_type_xe=14 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/sai.profile b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/sai.profile index 6f07b4605cbf..29db3ecd1624 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/sai.profile +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-s8900-48x25G+6x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-s8900-48x25G+6x100G.config.bcm diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/th-s8900-48x25G+6x100G.config.bcm b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/th-s8900-48x25G+6x100G.config.bcm new file mode 100644 index 000000000000..9248b066561b --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/th-s8900-48x25G+6x100G.config.bcm @@ -0,0 +1,337 @@ +#2017/05/31 + +os=unix + +oversubscribe_mode=1 +pbmp_xport_xe=0x7f00001fff4003ffffc0001fffe + +lpm_scaling_enable=1 +lpm_ipv6_128b_reserved=0 + +#Parity +parity_correction=1 +parity_enable=1 + +scache_filename=/tmp/scach + +#PIPE0 +portmap_1=1:25 +portmap_2=2:25 +portmap_3=3:25 +portmap_4=4:25 +portmap_5=5:25 +portmap_6=6:25 +portmap_7=7:25 +portmap_8=8:25 +portmap_9=9:25 +portmap_10=10:25 +portmap_11=11:25 +portmap_12=12:25 +portmap_13=21:25 +portmap_14=22:25 +portmap_15=23:25 +portmap_16=24:25 + +#PIPE1 +portmap_34=33:25 +portmap_35=34:25 +portmap_36=35:25 +portmap_37=36:25 +portmap_38=37:25 +portmap_39=38:25 +portmap_40=39:25 +portmap_41=40:25 +portmap_42=41:25 +portmap_43=42:25 +portmap_44=43:25 +portmap_45=44:25 +portmap_46=49:25 +portmap_47=50:25 +portmap_48=51:25 +portmap_49=52:25 +portmap_50=53:25 +portmap_51=54:25 +portmap_52=55:25 +portmap_53=56:25 + +#PIPE2 +portmap_68=65:25 +portmap_69=66:25 +portmap_70=67:25 +portmap_71=68:25 +portmap_72=69:25 +portmap_73=70:25 +portmap_74=71:25 +portmap_75=72:25 +portmap_76=81:25 +portmap_77=82:25 +portmap_78=83:25 +portmap_79=84:25 +portmap_80=85:100 + +#PIPE3 +portmap_102=97:100 +portmap_103=101:100 +portmap_104=105:100 +portmap_105=109:100 +portmap_106=117:100 + + +portmap_66=129:10 +portmap_100=131:10 +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 + +serdes_driver_current_xe0=0xF +serdes_preemphasis_xe0=0x3E3200 +serdes_if_type_xe0=14 + +serdes_driver_current_xe1=0xF +serdes_preemphasis_xe1=0x3A3600 +serdes_if_type_xe1=14 + +serdes_driver_current_xe2=0xF +serdes_preemphasis_xe2=0x3A3600 +serdes_if_type_xe2=14 + +serdes_driver_current_xe3=0xF +serdes_preemphasis_xe3=0x383800 +serdes_if_type_xe3=14 + +serdes_driver_current_xe4=0xF +serdes_preemphasis_xe4=0x373900 +serdes_if_type_xe4=14 + +serdes_driver_current_xe5=0xF +serdes_preemphasis_xe5=0x2E4200 +serdes_if_type_xe5=14 + +serdes_driver_current_xe6=0xF +serdes_preemphasis_xe6=0x333D00 +serdes_if_type_xe6=14 + +serdes_driver_current_xe7=0xC +serdes_preemphasis_xe7=0x304000 +serdes_if_type_xe7=14 + +serdes_driver_current_xe8=0xE +serdes_preemphasis_xe8=0x2F4300 +serdes_if_type_xe8=14 + +serdes_driver_current_xe9=0xC +serdes_preemphasis_xe9=0x2D4300 +serdes_if_type_xe9=14 + +serdes_driver_current_xe10=0xC +serdes_preemphasis_xe10=0x2C4400 +serdes_if_type_xe10=14 + +serdes_driver_current_xe11=0xC +serdes_preemphasis_xe11=0x2D4300 +serdes_if_type_xe11=14 + +serdes_driver_current_xe12=0xC +serdes_preemphasis_xe12=0x294700 +serdes_if_type_xe12=14 + +serdes_driver_current_xe13=0xC +serdes_preemphasis_xe13=0x284800 +serdes_if_type_xe13=14 + +serdes_driver_current_xe14=0xA +serdes_preemphasis_xe14=0x294700 +serdes_if_type_xe14=14 + +serdes_driver_current_xe15=0xF +serdes_preemphasis_xe15=0x294700 +serdes_if_type_xe15=14 + +serdes_driver_current_xe16=0x9 +serdes_preemphasis_xe16=0x185800 +serdes_if_type_xe16=14 + +serdes_driver_current_xe17=0x9 +serdes_preemphasis_xe17=0x1D5300 +serdes_if_type_xe17=14 + +serdes_driver_current_xe18=0x9 +serdes_preemphasis_xe18=0x1C5400 +serdes_if_type_xe18=14 + +serdes_driver_current_xe19=0x9 +serdes_preemphasis_xe19=0x1C5400 +serdes_if_type_xe19=14 + +serdes_driver_current_xe20=0x9 +serdes_preemphasis_xe20=0x1C5400 +serdes_if_type_xe20=14 + +serdes_driver_current_xe21=0x9 +serdes_preemphasis_xe21=0x1C5400 +serdes_if_type_xe21=14 + +serdes_driver_current_xe22=0x9 +serdes_preemphasis_xe22=0x1C5400 +serdes_if_type_xe22=14 + +serdes_driver_current_xe23=0x9 +serdes_preemphasis_xe23=0x1C5400 +serdes_if_type_xe23=14 + +serdes_driver_current_xe24=0x8 +serdes_preemphasis_xe24=0x1C5400 +serdes_if_type_xe24=14 + +serdes_driver_current_xe25=0x8 +serdes_preemphasis_xe25=0x1C5400 +serdes_if_type_xe25=14 + +serdes_driver_current_xe26=0x8 +serdes_preemphasis_xe26=0x185800 +serdes_if_type_xe26=14 + +serdes_driver_current_xe27=0x8 +serdes_preemphasis_xe27=0x185800 +serdes_if_type_xe27=14 + +serdes_driver_current_xe28=0x8 +serdes_preemphasis_xe28=0x145C00 +serdes_if_type_xe28=14 + +serdes_driver_current_xe29=0x8 +serdes_preemphasis_xe29=0x195700 +serdes_if_type_xe29=14 + +serdes_driver_current_xe30=0x8 +serdes_preemphasis_xe30=0x195700 +serdes_if_type_xe30=14 + +serdes_driver_current_xe31=0x8 +serdes_preemphasis_xe31=0x195700 +serdes_if_type_xe31=14 + +serdes_driver_current_xe32=0xC +serdes_preemphasis_xe32=0x195700 +serdes_if_type_xe32=14 + +serdes_driver_current_xe33=0x9 +serdes_preemphasis_xe33=0x205000 +serdes_if_type_xe33=14 + +serdes_driver_current_xe34=0xC +serdes_preemphasis_xe34=0x214F00 +serdes_if_type_xe34=14 + +serdes_driver_current_xe35=0xC +serdes_preemphasis_xe35=0x244C00 +serdes_if_type_xe35=14 + +serdes_driver_current_xe36=0xC +serdes_preemphasis_xe36=0x244C00 +serdes_if_type_xe36=14 + +serdes_driver_current_xe37=0xC +serdes_preemphasis_xe37=0x244C00 +serdes_if_type_xe37=14 + +serdes_driver_current_xe38=0xC +serdes_preemphasis_xe38=0x244C00 +serdes_if_type_xe38=14 + +serdes_driver_current_xe39=0xC +serdes_preemphasis_xe39=0x244C00 +serdes_if_type_xe39=14 + +serdes_driver_current_xe40=0xD +serdes_preemphasis_xe40=0x284800 +serdes_if_type_xe40=14 + +serdes_driver_current_xe41=0xC +serdes_preemphasis_xe41=0x284800 +serdes_if_type_xe41=14 + +serdes_driver_current_xe42=0xE +serdes_preemphasis_xe42=0x294700 +serdes_if_type_xe42=14 + +serdes_driver_current_xe43=0xE +serdes_preemphasis_xe43=0x294700 +serdes_if_type_xe43=14 + +serdes_driver_current_xe44=0xE +serdes_preemphasis_xe44=0x294700 +serdes_if_type_xe44=14 + +serdes_driver_current_xe45=0xF +serdes_preemphasis_xe45=0x284800 +serdes_if_type_xe45=14 + +serdes_driver_current_xe46=0xF +serdes_preemphasis_xe46=0x284800 +serdes_if_type_xe46=14 + +serdes_driver_current_xe47=0xF +serdes_preemphasis_xe47=0x304000 +serdes_if_type_xe47=14 + +serdes_driver_current_lane0_ce0=0xC +serdes_driver_current_lane1_ce0=0xC +serdes_driver_current_lane2_ce0=0xF +serdes_driver_current_lane3_ce0=0xC +serdes_preemphasis_lane0_ce0=0x284800 +serdes_preemphasis_lane1_ce0=0x294100 +serdes_preemphasis_lane2_ce0=0x294100 +serdes_preemphasis_lane3_ce0=0x294100 +serdes_if_type_ce0=14 + +serdes_driver_current_lane0_ce1=0xC +serdes_driver_current_lane1_ce1=0xF +serdes_driver_current_lane2_ce1=0xC +serdes_driver_current_lane3_ce1=0xC +serdes_preemphasis_lane0_ce1=0x284200 +serdes_preemphasis_lane1_ce1=0x3A3600 +serdes_preemphasis_lane2_ce1=0x2C4400 +serdes_preemphasis_lane3_ce1=0x2C4400 +serdes_if_type_ce1=14 + +serdes_driver_current_lane0_ce2=0xC +serdes_driver_current_lane1_ce2=0xC +serdes_driver_current_lane2_ce2=0xC +serdes_driver_current_lane3_ce2=0xC +serdes_preemphasis_lane0_ce2=0x2F4100 +serdes_preemphasis_lane1_ce2=0x383800 +serdes_preemphasis_lane2_ce2=0x2F4100 +serdes_preemphasis_lane3_ce2=0x304000 +serdes_if_type_ce2=14 + +serdes_driver_current_lane0_ce3=0xC +serdes_driver_current_lane1_ce3=0xF +serdes_driver_current_lane2_ce3=0xC +serdes_driver_current_lane3_ce3=0xA +serdes_preemphasis_lane0_ce3=0x304000 +serdes_preemphasis_lane1_ce3=0x3F3100 +serdes_preemphasis_lane2_ce3=0x313F00 +serdes_preemphasis_lane3_ce3=0x304000 +serdes_if_type_ce3=14 + +serdes_driver_current_lane0_ce4=0xC +serdes_driver_current_lane1_ce4=0xF +serdes_driver_current_lane2_ce4=0xC +serdes_driver_current_lane3_ce4=0xC +serdes_preemphasis_lane0_ce4=0x304000 +serdes_preemphasis_lane1_ce4=0x313F00 +serdes_preemphasis_lane2_ce4=0x2F4100 +serdes_preemphasis_lane3_ce4=0x2E4200 +serdes_if_type_ce4=14 + +serdes_driver_current_lane0_ce5=0xE +serdes_driver_current_lane1_ce5=0xF +serdes_driver_current_lane2_ce5=0xF +serdes_driver_current_lane3_ce5=0xF +serdes_preemphasis_lane0_ce5=0x304000 +serdes_preemphasis_lane1_ce5=0x3F3100 +serdes_preemphasis_lane2_ce5=0x383800 +serdes_preemphasis_lane3_ce5=0x3F3100 +serdes_if_type_ce5=14 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/sai.profile b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/sai.profile index f617b8f3c473..77a0e3efa431 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/sai.profile +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-s8900-48x25G+16x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-s8900-48x25G+16x100G.config.bcm diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/th-s8900-48x25G+16x100G.config.bcm b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/th-s8900-48x25G+16x100G.config.bcm new file mode 100644 index 000000000000..11d8e30a2aa8 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/th-s8900-48x25G+16x100G.config.bcm @@ -0,0 +1,448 @@ +#2017/05/31 + +os=unix + +oversubscribe_mode=1 +pbmp_xport_xe=0x3d000000ff4003ffffdfffffffe + +lpm_scaling_enable=1 +lpm_ipv6_128b_reserved=0 + +#Parity +parity_correction=1 +parity_enable=1 + +scache_filename=/tmp/scach + +#PIPE0 +portmap_1=17:25 +portmap_2=18:25 +portmap_3=19:25 +portmap_4=20:25 +portmap_5=24:25 +portmap_6=23:25 +portmap_7=22:25 +portmap_8=21:25 +portmap_9=28:25 +portmap_10=27:25 +portmap_11=26:25 +portmap_12=25:25 +portmap_13=32:25 +portmap_14=31:25 +portmap_15=30:25 +portmap_16=29:25 +portmap_17=1:25 +portmap_18=2:25 +portmap_19=3:25 +portmap_20=4:25 +portmap_21=8:25 +portmap_22=7:25 +portmap_23=6:25 +portmap_24=5:25 +portmap_25=12:25 +portmap_26=11:25 +portmap_27=10:25 +portmap_28=9:25 +portmap_29=13:25 +portmap_30=14:25 +portmap_31=15:25 +portmap_32=16:25 + +#PIPE1 +portmap_34=33:25 +portmap_35=34:25 +portmap_36=35:25 +portmap_37=36:25 +portmap_38=38:25 +portmap_39=39:25 +portmap_40=40:25 +portmap_41=37:25 +portmap_42=41:25 +portmap_43=42:25 +portmap_44=43:25 +portmap_45=44:25 +portmap_46=48:25 +portmap_47=45:25 +portmap_48=46:25 +portmap_49=47:25 +portmap_50=49:100 +portmap_51=53:100 +portmap_52=57:100 +portmap_53=61:100 + +#PIPE2 +portmap_68=65:100 +portmap_69=69:100 +portmap_70=73:100 +portmap_71=77:100 +portmap_72=81:100 +portmap_73=85:100 +portmap_74=89:100 +portmap_75=93:100 + +#PIPE3 +portmap_102=97:100 +portmap_103=101:100 +portmap_104=105:100 +portmap_105=109:100 + + +portmap_66=129:10 +portmap_100=131:10 + +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 + +serdes_driver_current_xe0=0x9 +serdes_preemphasis_xe0=0x304000 +serdes_if_type_xe0=14 + +serdes_driver_current_xe1=0x9 +serdes_preemphasis_xe1=0x304000 +serdes_if_type_xe1=14 + +serdes_driver_current_xe2=0x9 +serdes_preemphasis_xe2=0x304000 +serdes_if_type_xe2=14 + +serdes_driver_current_xe3=0x9 +serdes_preemphasis_xe3=0x2c4400 +serdes_if_type_xe3=14 + +serdes_driver_current_xe4=0x9 +serdes_preemphasis_xe4=0x304000 +serdes_if_type_xe4=14 + +serdes_driver_current_xe5=0x9 +serdes_preemphasis_xe5=0x304000 +serdes_if_type_xe5=14 + +serdes_driver_current_xe6=0x9 +serdes_preemphasis_xe6=0x2c4400 +serdes_if_type_xe6=14 + +serdes_driver_current_xe7=0x9 +serdes_preemphasis_xe7=0x2C4400 +serdes_if_type_xe7=14 + +serdes_driver_current_xe8=0x9 +serdes_preemphasis_xe8=0x2c4400 +serdes_if_type_xe8=14 + +serdes_driver_current_xe9=0x9 +serdes_preemphasis_xe9=0x284800 +serdes_if_type_xe9=14 + +serdes_driver_current_xe10=0x9 +serdes_preemphasis_xe10=0x2C4400 +serdes_if_type_xe10=14 + +serdes_driver_current_xe11=0x9 +serdes_preemphasis_xe11=0x2c4400 +serdes_if_type_xe11=14 + +serdes_driver_current_xe12=0x9 +serdes_preemphasis_xe12=0x2c4400 +serdes_if_type_xe12=14 + +serdes_driver_current_xe13=0x9 +serdes_preemphasis_xe13=0x2c4400 +serdes_if_type_xe13=14 + +serdes_driver_current_xe14=0x9 +serdes_preemphasis_xe14=0x2c4400 +serdes_if_type_xe14=14 + +serdes_driver_current_xe15=0x9 +serdes_preemphasis_xe15=0x2c4400 +serdes_if_type_xe15=14 + +serdes_driver_current_xe16=0x9 +serdes_preemphasis_xe16=0x2c4400 +serdes_if_type_xe16=14 + +serdes_driver_current_xe17=0xB +serdes_preemphasis_xe17=0x304000 +serdes_if_type_xe17=14 + +serdes_driver_current_xe18=0xA +serdes_preemphasis_xe18=0x2C4400 +serdes_if_type_xe18=14 + +serdes_driver_current_xe19=0x9 +serdes_preemphasis_xe19=0x2C4400 +serdes_if_type_xe19=14 + +serdes_driver_current_xe20=0xA +serdes_preemphasis_xe20=0x304000 +serdes_if_type_xe20=14 + +serdes_driver_current_xe21=0x9 +serdes_preemphasis_xe21=0x2C4400 +serdes_if_type_xe21=14 + +serdes_driver_current_xe22=0x9 +serdes_preemphasis_xe22=0x2C4400 +serdes_if_type_xe22=14 + +serdes_driver_current_xe23=0xC +serdes_preemphasis_xe23=0x304000 +serdes_if_type_xe23=14 + +serdes_driver_current_xe24=0xF +serdes_preemphasis_xe24=0x005100 +serdes_if_type_xe24=14 + +serdes_driver_current_xe25=0x9 +serdes_preemphasis_xe25=0x2C4400 +serdes_if_type_xe25=14 + +serdes_driver_current_xe26=0x9 +serdes_preemphasis_xe26=0x304000 +serdes_if_type_xe26=14 + +serdes_driver_current_xe27=0x9 +serdes_preemphasis_xe27=0x304000 +serdes_if_type_xe27=14 + +serdes_driver_current_xe28=0xA +serdes_preemphasis_xe28=0x2C4400 +serdes_if_type_xe28=14 + +serdes_driver_current_xe29=0x9 +serdes_preemphasis_xe29=0x284800 +serdes_if_type_xe29=14 + +serdes_driver_current_xe30=0x9 +serdes_preemphasis_xe30=0x2C4400 +serdes_if_type_xe30=14 + +serdes_driver_current_xe31=0xA +serdes_preemphasis_xe31=0x2C4400 +serdes_if_type_xe31=14 + +serdes_driver_current_xe32=0x9 +serdes_preemphasis_xe32=0x284800 +serdes_if_type_xe32=14 + +serdes_driver_current_xe33=0x7 +serdes_preemphasis_xe33=0x284800 +serdes_if_type_xe33=14 + +serdes_driver_current_xe34=0x9 +serdes_preemphasis_xe34=0x284800 +serdes_if_type_xe34=14 + +serdes_driver_current_xe35=0x9 +serdes_preemphasis_xe35=0x284800 +serdes_if_type_xe35=14 + +serdes_driver_current_xe36=0x9 +serdes_preemphasis_xe36=0x284800 +serdes_if_type_xe36=14 + +serdes_driver_current_xe37=0x9 +serdes_preemphasis_xe37=0x284800 +serdes_if_type_xe37=14 + +serdes_driver_current_xe38=0x9 +serdes_preemphasis_xe38=0x2C4400 +serdes_if_type_xe38=14 + +serdes_driver_current_xe39=0x9 +serdes_preemphasis_xe39=0x284800 +serdes_if_type_xe39=14 + +serdes_driver_current_xe40=0xA +serdes_preemphasis_xe40=0x284800 +serdes_if_type_xe40=14 + +serdes_driver_current_xe41=0x9 +serdes_preemphasis_xe41=0x2C4400 +serdes_if_type_xe41=14 + +serdes_driver_current_xe42=0x9 +serdes_preemphasis_xe42=0x2C4400 +serdes_if_type_xe42=14 + +serdes_driver_current_xe43=0xA +serdes_preemphasis_xe43=0x2E4200 +serdes_if_type_xe43=14 + +serdes_driver_current_xe44=0xA +serdes_preemphasis_xe44=0x2E4200 +serdes_if_type_xe44=14 + +serdes_driver_current_xe45=0xA +serdes_preemphasis_xe45=0x2C4400 +serdes_if_type_xe45=14 + +serdes_driver_current_xe46=0x9 +serdes_preemphasis_xe46=0x2C4400 +serdes_if_type_xe46=14 + +serdes_driver_current_xe47=0x9 +serdes_preemphasis_xe47=0x2C4400 +serdes_if_type_xe47=14 + +serdes_driver_current_lane0_ce0=0x9 +serdes_driver_current_lane1_ce0=0xF +serdes_driver_current_lane2_ce0=0x9 +serdes_driver_current_lane3_ce0=0x9 +serdes_preemphasis_lane0_ce0=0x2C4400 +serdes_preemphasis_lane1_ce0=0x343C00 +serdes_preemphasis_lane2_ce0=0x2C4400 +serdes_preemphasis_lane3_ce0=0x2C4400 +serdes_if_type_ce0=14 + +serdes_driver_current_lane0_ce1=0x9 +serdes_driver_current_lane1_ce1=0x9 +serdes_driver_current_lane2_ce1=0x9 +serdes_driver_current_lane3_ce1=0xE +serdes_preemphasis_lane0_ce1=0x284800 +serdes_preemphasis_lane1_ce1=0x284800 +serdes_preemphasis_lane2_ce1=0x2C4400 +serdes_preemphasis_lane3_ce1=0x2C4400 +serdes_if_type_ce1=14 + +serdes_driver_current_lane0_ce2=0x9 +serdes_driver_current_lane1_ce2=0xF +serdes_driver_current_lane2_ce2=0x9 +serdes_driver_current_lane3_ce2=0xD +serdes_preemphasis_lane0_ce2=0x284800 +serdes_preemphasis_lane1_ce2=0x343C00 +serdes_preemphasis_lane2_ce2=0x284800 +serdes_preemphasis_lane3_ce2=0x304000 +serdes_if_type_ce2=14 + +serdes_driver_current_lane0_ce3=0x9 +serdes_driver_current_lane1_ce3=0xD +serdes_driver_current_lane2_ce3=0x9 +serdes_driver_current_lane3_ce3=0xD +serdes_preemphasis_lane0_ce3=0x2C4400 +serdes_preemphasis_lane1_ce3=0x304000 +serdes_preemphasis_lane2_ce3=0x2C4400 +serdes_preemphasis_lane3_ce3=0x304000 +serdes_if_type_ce3=14 + +serdes_driver_current_lane0_ce4=0x9 +serdes_driver_current_lane1_ce4=0x9 +serdes_driver_current_lane2_ce4=0x9 +serdes_driver_current_lane3_ce4=0xD +serdes_preemphasis_lane0_ce4=0x2C4400 +serdes_preemphasis_lane1_ce4=0x2C4400 +serdes_preemphasis_lane2_ce4=0x2C4400 +serdes_preemphasis_lane3_ce4=0x304000 +serdes_if_type_ce4=14 + +serdes_driver_current_lane0_ce5=0x9 +serdes_driver_current_lane1_ce5=0xF +serdes_driver_current_lane2_ce5=0x9 +serdes_driver_current_lane3_ce5=0x9 +serdes_preemphasis_lane0_ce5=0x2C4400 +serdes_preemphasis_lane1_ce5=0x383800 +serdes_preemphasis_lane2_ce5=0x2C4400 +serdes_preemphasis_lane3_ce5=0x2C4400 +serdes_if_type_ce5=14 + +serdes_driver_current_lane0_ce6=0x9 +serdes_driver_current_lane1_ce6=0x9 +serdes_driver_current_lane2_ce6=0x9 +serdes_driver_current_lane3_ce6=0xE +serdes_preemphasis_lane0_ce6=0x2C4400 +serdes_preemphasis_lane1_ce6=0x2C4400 +serdes_preemphasis_lane2_ce6=0x2C4400 +serdes_preemphasis_lane3_ce6=0x304000 +serdes_if_type_ce6=14 + +serdes_driver_current_lane0_ce7=0x9 +serdes_driver_current_lane1_ce7=0xA +serdes_driver_current_lane2_ce7=0x9 +serdes_driver_current_lane3_ce7=0XE +serdes_preemphasis_lane0_ce7=0x284800 +serdes_preemphasis_lane1_ce7=0x304000 +serdes_preemphasis_lane2_ce7=0x2C4400 +serdes_preemphasis_lane3_ce7=0x343C00 +serdes_if_type_ce7=14 + +serdes_driver_current_lane0_ce8=0x9 +serdes_driver_current_lane1_ce8=0xE +serdes_driver_current_lane2_ce8=0xF +serdes_driver_current_lane3_ce8=0xE +serdes_preemphasis_lane0_ce8=0x2C4400 +serdes_preemphasis_lane1_ce8=0x304000 +serdes_preemphasis_lane2_ce8=0x343C00 +serdes_preemphasis_lane3_ce8=0x304000 +serdes_if_type_ce8=14 + +serdes_driver_current_lane0_ce9=0x9 +serdes_driver_current_lane1_ce9=0xD +serdes_driver_current_lane2_ce9=0xD +serdes_driver_current_lane3_ce9=0xF +serdes_preemphasis_lane0_ce9=0x2C4400 +serdes_preemphasis_lane1_ce9=0x343C00 +serdes_preemphasis_lane2_ce9=0x343C00 +serdes_preemphasis_lane3_ce9=0x343C00 +serdes_if_type_ce9=14 + +serdes_driver_current_lane0_ce10=0xD +serdes_driver_current_lane1_ce10=0xE +serdes_driver_current_lane2_ce10=0xD +serdes_driver_current_lane3_ce10=0xD +serdes_preemphasis_lane0_ce10=0x343C00 +serdes_preemphasis_lane1_ce10=0x343C00 +serdes_preemphasis_lane2_ce10=0x343C00 +serdes_preemphasis_lane3_ce10=0x343C00 +serdes_if_type_ce10=14 + +serdes_driver_current_lane0_ce11=0xE +serdes_driver_current_lane1_ce11=0xD +serdes_driver_current_lane2_ce11=0xD +serdes_driver_current_lane3_ce11=0xD +serdes_preemphasis_lane0_ce11=0x343C00 +serdes_preemphasis_lane1_ce11=0x343C00 +serdes_preemphasis_lane2_ce11=0X343C00 +serdes_preemphasis_lane3_ce11=0X343C00 +serdes_if_type_ce11=14 + +serdes_driver_current_lane0_ce12=0xD +serdes_driver_current_lane1_ce12=0xD +serdes_driver_current_lane2_ce12=0xD +serdes_driver_current_lane3_ce12=0xD +serdes_preemphasis_lane0_ce12=0x343C00 +serdes_preemphasis_lane1_ce12=0x343C00 +serdes_preemphasis_lane2_ce12=0x343C00 +serdes_preemphasis_lane3_ce12=0x343C00 +serdes_if_type_ce12=14 + +serdes_driver_current_lane0_ce13=0xD +serdes_driver_current_lane1_ce13=0xD +serdes_driver_current_lane2_ce13=0xD +serdes_driver_current_lane3_ce13=0xF +serdes_preemphasis_lane0_ce13=0x343C00 +serdes_preemphasis_lane1_ce13=0x343C00 +serdes_preemphasis_lane2_ce13=0x343C00 +serdes_preemphasis_lane3_ce13=0x005800 +serdes_if_type_ce13=14 + +serdes_driver_current_lane0_ce14=0xE +serdes_driver_current_lane1_ce14=0xD +serdes_driver_current_lane2_ce14=0xD +serdes_driver_current_lane3_ce14=0xE +serdes_preemphasis_lane0_ce14=0x383800 +serdes_preemphasis_lane1_ce14=0x343C00 +serdes_preemphasis_lane2_ce14=0x343C00 +serdes_preemphasis_lane3_ce14=0x383800 +serdes_if_type_ce14=14 + +serdes_driver_current_lane0_ce15=0xD +serdes_driver_current_lane1_ce15=0xC +serdes_driver_current_lane2_ce15=0xC +serdes_driver_current_lane3_ce15=0xF +serdes_preemphasis_lane0_ce15=0x343C00 +serdes_preemphasis_lane1_ce15=0x304000 +serdes_preemphasis_lane2_ce15=0x304000 +serdes_preemphasis_lane3_ce15=0x005100 +serdes_if_type_ce15=14 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile index a431427469e3..14a36af5f554 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-s9100-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-s9100-32x100G.config.bcm diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/th-s9100-32x100G.config.bcm b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/th-s9100-32x100G.config.bcm new file mode 100644 index 000000000000..3f4ce8faa740 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/th-s9100-32x100G.config.bcm @@ -0,0 +1,359 @@ +#2017/09/12 + +os=unix + +oversubscribe_mode=1 +pbmp_xport_xe=0x3fc000000ff0000003fc000001fe + +#ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l3_mem_entries=40960 +l2_mem_entries=40960 + +l2xmsg_mode=1 +mmu_lossless=0 + +#Parity +parity_correction=1 +parity_enable=1 + +scache_filename=/tmp/scach + +#PIPE0 +portmap_1=5:100 +portmap_2=1:100 +portmap_3=13:100 +portmap_4=9:100 +portmap_5=21:100 +portmap_6=17:100 +portmap_7=29:100 +portmap_8=25:100 + +#PIPE1 +portmap_34=37:100 +portmap_35=33:100 +portmap_36=45:100 +portmap_37=41:100 +portmap_38=53:100 +portmap_39=49:100 +portmap_40=61:100 +portmap_41=57:100 + +#PIPE2 +portmap_68=69:100 +portmap_69=65:100 +portmap_70=77:100 +portmap_71=73:100 +portmap_72=85:100 +portmap_73=81:100 +portmap_74=93:100 +portmap_75=89:100 + +#PIPE3 +portmap_102=101:100 +portmap_103=97:100 +portmap_104=109:100 +portmap_105=105:100 +portmap_106=117:100 +portmap_107=113:100 +portmap_108=125:100 +portmap_109=121:100 + +#portmap_66=129:10 +#portmap_100=131:10 +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 + +serdes_driver_current_lane0_ce0=0xF +serdes_driver_current_lane1_ce0=0xF +serdes_driver_current_lane2_ce0=0xF +serdes_driver_current_lane3_ce0=0xF +serdes_preemphasis_lane0_ce0=0x153C1F +serdes_preemphasis_lane1_ce0=0x20341C +serdes_preemphasis_lane2_ce0=0x153C1F +serdes_preemphasis_lane3_ce0=0x243418 + +serdes_driver_current_lane0_ce1=0xF +serdes_driver_current_lane1_ce1=0xF +serdes_driver_current_lane2_ce1=0xF +serdes_driver_current_lane3_ce1=0xF +serdes_preemphasis_lane0_ce1=0x153C1F +serdes_preemphasis_lane1_ce1=0x20341C +serdes_preemphasis_lane2_ce1=0x153C1F +serdes_preemphasis_lane3_ce1=0x20341C + +serdes_driver_current_lane0_ce2=0xF +serdes_driver_current_lane1_ce2=0xD +serdes_driver_current_lane2_ce2=0xF +serdes_driver_current_lane3_ce2=0xD +serdes_preemphasis_lane0_ce2=0x153C1F +serdes_preemphasis_lane1_ce2=0x243418 +serdes_preemphasis_lane2_ce2=0x153C1F +serdes_preemphasis_lane3_ce2=0x203C14 + +serdes_driver_current_lane0_ce3=0xF +serdes_driver_current_lane1_ce3=0xD +serdes_driver_current_lane2_ce3=0xF +serdes_driver_current_lane3_ce3=0xD +serdes_preemphasis_lane0_ce3=0x153C1F +serdes_preemphasis_lane1_ce3=0x203C14 +serdes_preemphasis_lane2_ce3=0x153C1F +serdes_preemphasis_lane3_ce3=0x243418 + +serdes_driver_current_lane0_ce4=0xF +serdes_driver_current_lane1_ce4=0xB +serdes_driver_current_lane2_ce4=0xF +serdes_driver_current_lane3_ce4=0xA +serdes_preemphasis_lane0_ce4=0x153C1F +serdes_preemphasis_lane1_ce4=0x333D00 +serdes_preemphasis_lane2_ce4=0x153C1F +serdes_preemphasis_lane3_ce4=0x304000 + +serdes_driver_current_lane0_ce5=0xF +serdes_driver_current_lane1_ce5=0xB +serdes_driver_current_lane2_ce5=0xF +serdes_driver_current_lane3_ce5=0xA +serdes_preemphasis_lane0_ce5=0x153C1F +serdes_preemphasis_lane1_ce5=0x304000 +serdes_preemphasis_lane2_ce5=0x153C1F +serdes_preemphasis_lane3_ce5=0x304000 + +serdes_driver_current_lane0_ce6=0xF +serdes_driver_current_lane1_ce6=0xC +serdes_driver_current_lane2_ce6=0xF +serdes_driver_current_lane3_ce6=0xA +serdes_preemphasis_lane0_ce6=0x153C1F +serdes_preemphasis_lane1_ce6=0x363A00 +serdes_preemphasis_lane2_ce6=0x153C1F +serdes_preemphasis_lane3_ce6=0x304000 + +serdes_driver_current_lane0_ce7=0xF +serdes_driver_current_lane1_ce7=0x8 +serdes_driver_current_lane2_ce7=0xF +serdes_driver_current_lane3_ce7=0x8 +serdes_preemphasis_lane0_ce7=0x153C1F +serdes_preemphasis_lane1_ce7=0x304000 +serdes_preemphasis_lane2_ce7=0x153C1F +serdes_preemphasis_lane3_ce7=0x304000 + +serdes_driver_current_lane0_ce8=0x8 +serdes_driver_current_lane1_ce8=0x9 +serdes_driver_current_lane2_ce8=0x8 +serdes_driver_current_lane3_ce8=0x8 +serdes_preemphasis_lane0_ce8=0x254B00 +serdes_preemphasis_lane1_ce8=0x2C4400 +serdes_preemphasis_lane2_ce8=0x254B00 +serdes_preemphasis_lane3_ce8=0x254B00 + +serdes_driver_current_lane0_ce9=0x8 +serdes_driver_current_lane1_ce9=0x9 +serdes_driver_current_lane2_ce9=0x8 +serdes_driver_current_lane3_ce9=0x8 +serdes_preemphasis_lane0_ce9=0x254B00 +serdes_preemphasis_lane1_ce9=0x2B4500 +serdes_preemphasis_lane2_ce9=0x254B00 +serdes_preemphasis_lane3_ce9=0x254B00 + +serdes_driver_current_lane0_ce10=0x8 +serdes_driver_current_lane1_ce10=0x7 +serdes_driver_current_lane2_ce10=0x8 +serdes_driver_current_lane3_ce10=0x8 +serdes_preemphasis_lane0_ce10=0x254B00 +serdes_preemphasis_lane1_ce10=0x2B4500 +serdes_preemphasis_lane2_ce10=0x254B00 +serdes_preemphasis_lane3_ce10=0x254B00 + +serdes_driver_current_lane0_ce11=0x8 +serdes_driver_current_lane1_ce11=0x8 +serdes_driver_current_lane2_ce11=0x8 +serdes_driver_current_lane3_ce11=0x8 +serdes_preemphasis_lane0_ce11=0x254B00 +serdes_preemphasis_lane1_ce11=0x2C4400 +serdes_preemphasis_lane2_ce11=0x254B00 +serdes_preemphasis_lane3_ce11=0x254B00 + +serdes_driver_current_lane0_ce12=0x8 +serdes_driver_current_lane1_ce12=0x5 +serdes_driver_current_lane2_ce12=0x8 +serdes_driver_current_lane3_ce12=0x8 +serdes_preemphasis_lane0_ce12=0x254B00 +serdes_preemphasis_lane1_ce12=0x254B00 +serdes_preemphasis_lane2_ce12=0x254B00 +serdes_preemphasis_lane3_ce12=0x254B00 + +serdes_driver_current_lane0_ce13=0x8 +serdes_driver_current_lane1_ce13=0x8 +serdes_driver_current_lane2_ce13=0x8 +serdes_driver_current_lane3_ce13=0x8 +serdes_preemphasis_lane0_ce13=0x254B00 +serdes_preemphasis_lane1_ce13=0x254B00 +serdes_preemphasis_lane2_ce13=0x254B00 +serdes_preemphasis_lane3_ce13=0x254B00 + +serdes_driver_current_lane0_ce14=0x7 +serdes_driver_current_lane1_ce14=0x7 +serdes_driver_current_lane2_ce14=0x7 +serdes_driver_current_lane3_ce14=0x7 +serdes_preemphasis_lane0_ce14=0x254B00 +serdes_preemphasis_lane1_ce14=0x254B00 +serdes_preemphasis_lane2_ce14=0x254B00 +serdes_preemphasis_lane3_ce14=0x254B00 + +serdes_driver_current_lane0_ce15=0x7 +serdes_driver_current_lane1_ce15=0x5 +serdes_driver_current_lane2_ce15=0x7 +serdes_driver_current_lane3_ce15=0x7 +serdes_preemphasis_lane0_ce15=0x254B00 +serdes_preemphasis_lane1_ce15=0x254B00 +serdes_preemphasis_lane2_ce15=0x254B00 +serdes_preemphasis_lane3_ce15=0x254B00 + +serdes_driver_current_lane0_ce16=0x4 +serdes_driver_current_lane1_ce16=0x4 +serdes_driver_current_lane2_ce16=0x4 +serdes_driver_current_lane3_ce16=0x4 +serdes_preemphasis_lane0_ce16=0x274900 +serdes_preemphasis_lane1_ce16=0x274900 +serdes_preemphasis_lane2_ce16=0x274900 +serdes_preemphasis_lane3_ce16=0x274900 + +serdes_driver_current_lane0_ce17=0x8 +serdes_driver_current_lane1_ce17=0xF +serdes_driver_current_lane2_ce17=0xF +serdes_driver_current_lane3_ce17=0xF +serdes_preemphasis_lane0_ce17=0x254B00 +serdes_preemphasis_lane1_ce17=0x304000 +serdes_preemphasis_lane2_ce17=0x304000 +serdes_preemphasis_lane3_ce17=0x304000 + +serdes_driver_current_lane0_ce18=0x2 +serdes_driver_current_lane1_ce18=0x2 +serdes_driver_current_lane2_ce18=0x2 +serdes_driver_current_lane3_ce18=0x2 +serdes_preemphasis_lane0_ce18=0x205000 +serdes_preemphasis_lane1_ce18=0x205000 +serdes_preemphasis_lane2_ce18=0x205000 +serdes_preemphasis_lane3_ce18=0x205000 + +serdes_driver_current_lane0_ce19=0x2 +serdes_driver_current_lane1_ce19=0x2 +serdes_driver_current_lane2_ce19=0x2 +serdes_driver_current_lane3_ce19=0x2 +serdes_preemphasis_lane0_ce19=0x205000 +serdes_preemphasis_lane1_ce19=0x205000 +serdes_preemphasis_lane2_ce19=0x205000 +serdes_preemphasis_lane3_ce19=0x205000 + +serdes_driver_current_lane0_ce20=0x2 +serdes_driver_current_lane1_ce20=0x2 +serdes_driver_current_lane2_ce20=0x2 +serdes_driver_current_lane3_ce20=0x2 +serdes_preemphasis_lane0_ce20=0x205000 +serdes_preemphasis_lane1_ce20=0x205000 +serdes_preemphasis_lane2_ce20=0x205000 +serdes_preemphasis_lane3_ce20=0x205000 + +serdes_driver_current_lane0_ce21=0x4 +serdes_driver_current_lane1_ce21=0x2 +serdes_driver_current_lane2_ce21=0x2 +serdes_driver_current_lane3_ce21=0x2 +serdes_preemphasis_lane0_ce21=0x175900 +serdes_preemphasis_lane1_ce21=0x175900 +serdes_preemphasis_lane2_ce21=0x205000 +serdes_preemphasis_lane3_ce21=0x205000 + +serdes_driver_current_lane0_ce22=0x7 +serdes_driver_current_lane1_ce22=0x7 +serdes_driver_current_lane2_ce22=0x7 +serdes_driver_current_lane3_ce22=0x7 +serdes_preemphasis_lane0_ce22=0x254B00 +serdes_preemphasis_lane1_ce22=0x254B00 +serdes_preemphasis_lane2_ce22=0x254B00 +serdes_preemphasis_lane3_ce22=0x254B00 + +serdes_driver_current_lane0_ce23=0x7 +serdes_driver_current_lane1_ce23=0x7 +serdes_driver_current_lane2_ce23=0x7 +serdes_driver_current_lane3_ce23=0x7 +serdes_preemphasis_lane0_ce23=0x254B00 +serdes_preemphasis_lane1_ce23=0x254B00 +serdes_preemphasis_lane2_ce23=0x254B00 +serdes_preemphasis_lane3_ce23=0x254B00 + +serdes_driver_current_lane0_ce24=0xF +serdes_driver_current_lane1_ce24=0x8 +serdes_driver_current_lane2_ce24=0xF +serdes_driver_current_lane3_ce24=0x4 +serdes_preemphasis_lane0_ce24=0x153C1F +serdes_preemphasis_lane1_ce24=0x294700 +serdes_preemphasis_lane2_ce24=0x153C1F +serdes_preemphasis_lane3_ce24=0x294700 + +serdes_driver_current_lane0_ce25=0xF +serdes_driver_current_lane1_ce25=0x8 +serdes_driver_current_lane2_ce25=0xF +serdes_driver_current_lane3_ce25=0x4 +serdes_preemphasis_lane0_ce25=0x153C1F +serdes_preemphasis_lane1_ce25=0x294700 +serdes_preemphasis_lane2_ce25=0x153C1F +serdes_preemphasis_lane3_ce25=0x294700 + +serdes_driver_current_lane0_ce26=0xF +serdes_driver_current_lane1_ce26=0xA +serdes_driver_current_lane2_ce26=0xF +serdes_driver_current_lane3_ce26=0x9 +serdes_preemphasis_lane0_ce26=0x153C1F +serdes_preemphasis_lane1_ce26=0x304000 +serdes_preemphasis_lane2_ce26=0x153C1F +serdes_preemphasis_lane3_ce26=0x304000 + +serdes_driver_current_lane0_ce27=0xF +serdes_driver_current_lane1_ce27=0x9 +serdes_driver_current_lane2_ce27=0xF +serdes_driver_current_lane3_ce27=0x9 +serdes_preemphasis_lane0_ce27=0x153C1F +serdes_preemphasis_lane1_ce27=0x304000 +serdes_preemphasis_lane2_ce27=0x153C1F +serdes_preemphasis_lane3_ce27=0x304000 + +serdes_driver_current_lane0_ce28=0xF +serdes_driver_current_lane1_ce28=0xC +serdes_driver_current_lane2_ce28=0xF +serdes_driver_current_lane3_ce28=0xC +serdes_preemphasis_lane0_ce28=0x153C1F +serdes_preemphasis_lane1_ce28=0x183C10 +serdes_preemphasis_lane2_ce28=0x153C1F +serdes_preemphasis_lane3_ce28=0x1C3C10 + +serdes_driver_current_lane0_ce29=0xF +serdes_driver_current_lane1_ce29=0xC +serdes_driver_current_lane2_ce29=0xF +serdes_driver_current_lane3_ce29=0xC +serdes_preemphasis_lane0_ce29=0x153C1F +serdes_preemphasis_lane1_ce29=0x203C10 +serdes_preemphasis_lane2_ce29=0x153C1F +serdes_preemphasis_lane3_ce29=0x203C10 + +serdes_driver_current_lane0_ce30=0xF +serdes_driver_current_lane1_ce30=0xC +serdes_driver_current_lane2_ce30=0xF +serdes_driver_current_lane3_ce30=0xC +serdes_preemphasis_lane0_ce30=0x153C1F +serdes_preemphasis_lane1_ce30=0x243C10 +serdes_preemphasis_lane2_ce30=0x153C1F +serdes_preemphasis_lane3_ce30=0x243C08 + +serdes_driver_current_lane0_ce31=0xF +serdes_driver_current_lane1_ce31=0xC +serdes_driver_current_lane2_ce31=0xF +serdes_driver_current_lane3_ce31=0xE +serdes_preemphasis_lane0_ce31=0x153C1F +serdes_preemphasis_lane1_ce31=0x243C10 +serdes_preemphasis_lane2_ce31=0x153C1F +serdes_preemphasis_lane3_ce31=0x203C14 + +serdes_if_type_xe=14 +serdes_if_type_ce=14 diff --git a/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/MiTAC-LY1200-B32H0-C3/sai.profile b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/MiTAC-LY1200-B32H0-C3/sai.profile index 5bf97eb31a4c..a58c3ac6eabf 100644 --- a/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/MiTAC-LY1200-B32H0-C3/sai.profile +++ b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/MiTAC-LY1200-B32H0-C3/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-ly1200-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-ly1200-32x100G.config.bcm diff --git a/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/MiTAC-LY1200-B32H0-C3/th-ly1200-32x100G.config.bcm b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/MiTAC-LY1200-B32H0-C3/th-ly1200-32x100G.config.bcm new file mode 100644 index 000000000000..84b2c572664f --- /dev/null +++ b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/MiTAC-LY1200-B32H0-C3/th-ly1200-32x100G.config.bcm @@ -0,0 +1,319 @@ +### BMS (start) +## Global settings +bcm_num_cos=8 +dport_map_indexed=0 + +## Switch settings +# Port number and bandwidth assignment. +portmap_1=1:100 +portmap_5=5:100 +portmap_9=9:100 +portmap_13=13:100 +portmap_17=17:100 +portmap_21=21:100 +portmap_25=25:100 +portmap_29=29:100 +portmap_34=33:100 +portmap_38=37:100 +portmap_42=41:100 +portmap_46=45:100 +portmap_50=49:100 +portmap_54=53:100 +portmap_58=57:100 +portmap_62=61:100 +portmap_68=65:100 +portmap_72=69:100 +portmap_76=73:100 +portmap_80=77:100 +portmap_84=81:100 +portmap_88=85:100 +portmap_92=89:100 +portmap_96=93:100 +portmap_102=97:100 +portmap_106=101:100 +portmap_110=105:100 +portmap_114=109:100 +portmap_118=113:100 +portmap_122=117:100 +portmap_126=121:100 +portmap_130=125:100 + +# pbmp_xport_xe is used to specify if a XPORT block is configured as xe port +# By default, an XPORT block is treated as HG port. +pbmp_xport_xe=0x0444444441111111104444444422222222 + +# Map dport number to internal port number . +dport_map_port_0=327 +dport_map_port_1=112 +dport_map_port_5=116 +dport_map_port_9=120 +dport_map_port_13=124 +dport_map_port_17=80 +dport_map_port_21=84 +dport_map_port_25=88 +dport_map_port_29=92 +dport_map_port_34=32 +dport_map_port_38=36 +dport_map_port_42=40 +dport_map_port_46=44 +dport_map_port_50=0 +dport_map_port_54=4 +dport_map_port_58=8 +dport_map_port_62=12 +dport_map_port_68=16 +dport_map_port_72=20 +dport_map_port_76=24 +dport_map_port_80=28 +dport_map_port_84=48 +dport_map_port_88=52 +dport_map_port_92=56 +dport_map_port_96=60 +dport_map_port_102=64 +dport_map_port_106=68 +dport_map_port_110=72 +dport_map_port_114=76 +dport_map_port_118=96 +dport_map_port_122=100 +dport_map_port_126=104 +dport_map_port_130=108 + +# Remap XGXS rx and tx lanes to desired mapping. Four bits were used for +# specifying each lane in the format of Lane 0 (bit 15-12), Lane 1 (bit 11-8), +# lane 2 (bit 7-4), and lane 3 (bit 3-0). +# For example, to reverse the tx lane mapping in 3, 2, 1, 0 order, +xgxs_tx_lane_map_ce0=0x3210 +xgxs_rx_lane_map_ce0=0x3210 +xgxs_tx_lane_map_ce4=0x3210 +xgxs_rx_lane_map_ce4=0x2103 +xgxs_tx_lane_map_ce8=0x3210 +xgxs_rx_lane_map_ce8=0x3210 +xgxs_tx_lane_map_ce12=0x3210 +xgxs_rx_lane_map_ce12=0x2103 +xgxs_tx_lane_map_ce16=0x0123 +xgxs_rx_lane_map_ce16=0x0123 +xgxs_tx_lane_map_ce20=0x3210 +xgxs_rx_lane_map_ce20=0x2103 +xgxs_tx_lane_map_ce24=0x3210 +xgxs_rx_lane_map_ce24=0x3210 +xgxs_tx_lane_map_ce28=0x0123 +xgxs_rx_lane_map_ce28=0x1203 +xgxs_tx_lane_map_ce32=0x3210 +xgxs_rx_lane_map_ce32=0x3210 +xgxs_tx_lane_map_ce36=0x2301 +xgxs_rx_lane_map_ce36=0x3120 +xgxs_tx_lane_map_ce40=0x3210 +xgxs_rx_lane_map_ce40=0x3210 +xgxs_tx_lane_map_ce44=0x3102 +xgxs_rx_lane_map_ce44=0x2301 +xgxs_tx_lane_map_ce48=0x3210 +xgxs_rx_lane_map_ce48=0x1203 +xgxs_tx_lane_map_ce52=0x0123 +xgxs_rx_lane_map_ce52=0x3210 +xgxs_tx_lane_map_ce56=0x3210 +xgxs_rx_lane_map_ce56=0x1203 +xgxs_tx_lane_map_ce60=0x0213 +xgxs_rx_lane_map_ce60=0x3210 +xgxs_tx_lane_map_ce64=0x3120 +xgxs_rx_lane_map_ce64=0x1032 +xgxs_tx_lane_map_ce68=0x0123 +xgxs_rx_lane_map_ce68=0x3012 +xgxs_tx_lane_map_ce72=0x1230 +xgxs_rx_lane_map_ce72=0x1032 +xgxs_tx_lane_map_ce76=0x0123 +xgxs_rx_lane_map_ce76=0x3012 +xgxs_tx_lane_map_ce80=0x0213 +xgxs_rx_lane_map_ce80=0x2031 +xgxs_tx_lane_map_ce84=0x2301 +xgxs_rx_lane_map_ce84=0x3120 +xgxs_tx_lane_map_ce88=0x3210 +xgxs_rx_lane_map_ce88=0x3210 +xgxs_tx_lane_map_ce92=0x2301 +xgxs_rx_lane_map_ce92=0x3120 +xgxs_tx_lane_map_ce96=0x3210 +xgxs_rx_lane_map_ce96=0x0321 +xgxs_tx_lane_map_ce100=0x0123 +xgxs_rx_lane_map_ce100=0x1032 +xgxs_tx_lane_map_ce104=0x0123 +xgxs_rx_lane_map_ce104=0x0123 +xgxs_tx_lane_map_ce108=0x3210 +xgxs_rx_lane_map_ce108=0x2103 +xgxs_tx_lane_map_ce112=0x0123 +xgxs_rx_lane_map_ce112=0x0123 +xgxs_tx_lane_map_ce116=0x0123 +xgxs_rx_lane_map_ce116=0x1230 +xgxs_tx_lane_map_ce120=0x0123 +xgxs_rx_lane_map_ce120=0x0123 +xgxs_tx_lane_map_ce124=0x0123 +xgxs_rx_lane_map_ce124=0x1230 + +# Config to describe the system Linerate or Oversubscribe mode. +# 0: Linerate only (default). +# 1: Oversubscribe mode (all ports will be oversub). +# 2: Mixed mode. Check device specification for applicability. Port bitmap specified via pbmp_oversubscribe. +oversubscribe_mode=1 + +# Set the default MMU lossless behavior. +mmu_lossless=0 + +# Set preemphasis +serdes_preemphasis_lane0_ce0=0x2c3c08 +serdes_preemphasis_lane1_ce0=0x2c3c08 +serdes_preemphasis_lane2_ce0=0x2c3c08 +serdes_preemphasis_lane3_ce0=0x2c3c08 + +serdes_preemphasis_lane0_ce4=0x2c3c08 +serdes_preemphasis_lane1_ce4=0x2c3c08 +serdes_preemphasis_lane2_ce4=0x2c3c08 +serdes_preemphasis_lane3_ce4=0x2c3c08 + +serdes_preemphasis_lane0_ce8=0x2c3c08 +serdes_preemphasis_lane1_ce8=0x2c3c08 +serdes_preemphasis_lane2_ce8=0x2c3c08 +serdes_preemphasis_lane3_ce8=0x2c3c08 + +serdes_preemphasis_lane0_ce12=0x2c3c08 +serdes_preemphasis_lane1_ce12=0x2c3c08 +serdes_preemphasis_lane2_ce12=0x2c3c08 +serdes_preemphasis_lane3_ce12=0x2c3c08 + +serdes_preemphasis_lane0_ce16=0x244408 +serdes_preemphasis_lane1_ce16=0x244408 +serdes_preemphasis_lane2_ce16=0x244408 +serdes_preemphasis_lane3_ce16=0x244408 + +serdes_preemphasis_lane0_ce20=0x244408 +serdes_preemphasis_lane1_ce20=0x244408 +serdes_preemphasis_lane2_ce20=0x244408 +serdes_preemphasis_lane3_ce20=0x244408 + +serdes_preemphasis_lane0_ce24=0x244408 +serdes_preemphasis_lane1_ce24=0x244408 +serdes_preemphasis_lane2_ce24=0x244408 +serdes_preemphasis_lane3_ce24=0x244408 + +serdes_preemphasis_lane0_ce28=0x244408 +serdes_preemphasis_lane1_ce28=0x244408 +serdes_preemphasis_lane2_ce28=0x244408 +serdes_preemphasis_lane3_ce28=0x244408 + +serdes_preemphasis_lane0_ce32=0x2c3c08 +serdes_preemphasis_lane1_ce32=0x2c3c08 +serdes_preemphasis_lane2_ce32=0x2c3c08 +serdes_preemphasis_lane3_ce32=0x2c3c08 + +serdes_preemphasis_lane0_ce36=0x2c3c08 +serdes_preemphasis_lane1_ce36=0x2c3c08 +serdes_preemphasis_lane2_ce36=0x2c3c08 +serdes_preemphasis_lane3_ce36=0x2c3c08 + +serdes_preemphasis_lane0_ce40=0x2c3c08 +serdes_preemphasis_lane1_ce40=0x2c3c08 +serdes_preemphasis_lane2_ce40=0x2c3c08 +serdes_preemphasis_lane3_ce40=0x2c3c08 + +serdes_preemphasis_lane0_ce44=0x244408 +serdes_preemphasis_lane1_ce44=0x244408 +serdes_preemphasis_lane2_ce44=0x244408 +serdes_preemphasis_lane3_ce44=0x244408 + +serdes_preemphasis_lane0_ce48=0x244408 +serdes_preemphasis_lane1_ce48=0x244408 +serdes_preemphasis_lane2_ce48=0x244408 +serdes_preemphasis_lane3_ce48=0x244408 + +serdes_preemphasis_lane0_ce52=0x244408 +serdes_preemphasis_lane1_ce52=0x244408 +serdes_preemphasis_lane2_ce52=0x244408 +serdes_preemphasis_lane3_ce52=0x244408 + +serdes_preemphasis_lane0_ce56=0x244408 +serdes_preemphasis_lane1_ce56=0x244408 +serdes_preemphasis_lane2_ce56=0x244408 +serdes_preemphasis_lane3_ce56=0x244408 + +serdes_preemphasis_lane0_ce60=0x244408 +serdes_preemphasis_lane1_ce60=0x244408 +serdes_preemphasis_lane2_ce60=0x244408 +serdes_preemphasis_lane3_ce60=0x244408 + +serdes_preemphasis_lane0_ce64=0x244408 +serdes_preemphasis_lane1_ce64=0x244408 +serdes_preemphasis_lane2_ce64=0x244408 +serdes_preemphasis_lane3_ce64=0x244408 + +serdes_preemphasis_lane0_ce68=0x244408 +serdes_preemphasis_lane1_ce68=0x244408 +serdes_preemphasis_lane2_ce68=0x244408 +serdes_preemphasis_lane3_ce68=0x244408 + +serdes_preemphasis_lane0_ce72=0x244408 +serdes_preemphasis_lane1_ce72=0x244408 +serdes_preemphasis_lane2_ce72=0x244408 +serdes_preemphasis_lane3_ce72=0x244408 + +serdes_preemphasis_lane0_ce76=0x244408 +serdes_preemphasis_lane1_ce76=0x244408 +serdes_preemphasis_lane2_ce76=0x244408 +serdes_preemphasis_lane3_ce76=0x244408 + +serdes_preemphasis_lane0_ce80=0x244408 +serdes_preemphasis_lane1_ce80=0x244408 +serdes_preemphasis_lane2_ce80=0x244408 +serdes_preemphasis_lane3_ce80=0x244408 + +serdes_preemphasis_lane0_ce84=0x2c3c08 +serdes_preemphasis_lane1_ce84=0x2c3c08 +serdes_preemphasis_lane2_ce84=0x2c3c08 +serdes_preemphasis_lane3_ce84=0x2c3c08 + +serdes_preemphasis_lane0_ce88=0x2c3c08 +serdes_preemphasis_lane1_ce88=0x2c3c08 +serdes_preemphasis_lane2_ce88=0x2c3c08 +serdes_preemphasis_lane3_ce88=0x2c3c08 + +serdes_preemphasis_lane0_ce92=0x2c3c08 +serdes_preemphasis_lane1_ce92=0x2c3c08 +serdes_preemphasis_lane2_ce92=0x2c3c08 +serdes_preemphasis_lane3_ce92=0x2c3c08 + +serdes_preemphasis_lane0_ce96=0x244408 +serdes_preemphasis_lane1_ce96=0x244408 +serdes_preemphasis_lane2_ce96=0x244408 +serdes_preemphasis_lane3_ce96=0x244408 + +serdes_preemphasis_lane0_ce100=0x244408 +serdes_preemphasis_lane1_ce100=0x244408 +serdes_preemphasis_lane2_ce100=0x244408 +serdes_preemphasis_lane3_ce100=0x244408 + +serdes_preemphasis_lane0_ce104=0x244408 +serdes_preemphasis_lane1_ce104=0x244408 +serdes_preemphasis_lane2_ce104=0x244408 +serdes_preemphasis_lane3_ce104=0x244408 + +serdes_preemphasis_lane0_ce108=0x244408 +serdes_preemphasis_lane1_ce108=0x244408 +serdes_preemphasis_lane2_ce108=0x244408 +serdes_preemphasis_lane3_ce108=0x244408 + +serdes_preemphasis_lane0_ce112=0x2c3c08 +serdes_preemphasis_lane1_ce112=0x2c3c08 +serdes_preemphasis_lane2_ce112=0x2c3c08 +serdes_preemphasis_lane3_ce112=0x2c3c08 + +serdes_preemphasis_lane0_ce116=0x2c3c08 +serdes_preemphasis_lane1_ce116=0x2c3c08 +serdes_preemphasis_lane2_ce116=0x2c3c08 +serdes_preemphasis_lane3_ce116=0x2c3c08 + +serdes_preemphasis_lane0_ce120=0x2c3c08 +serdes_preemphasis_lane1_ce120=0x2c3c08 +serdes_preemphasis_lane2_ce120=0x2c3c08 +serdes_preemphasis_lane3_ce120=0x2c3c08 + +serdes_preemphasis_lane0_ce124=0x2c3c08 +serdes_preemphasis_lane1_ce124=0x2c3c08 +serdes_preemphasis_lane2_ce124=0x2c3c08 +serdes_preemphasis_lane3_ce124=0x2c3c08 + +### BMS (end) \ No newline at end of file diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/sai.profile b/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/sai.profile index fa4ce6c1de9d..fbd01105a4f3 100755 --- a/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/sai.profile +++ b/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/etc/bcm/th-ix1b-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-ix1b-32x100G.config.bcm diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm b/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm new file mode 100644 index 000000000000..f73d5be55cd4 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm @@ -0,0 +1,253 @@ +os=unix + +pbmp_xport_xe=0x3fd000000ff4000003fc000001fe +pbmp_oversubscribe=0x3fd000000ff4000003fc000001fe +l2xmsg_mode=1 + +schan_intr_enable=0 + +# Control to disable parity messages +parity_enable=1 + +# Control to disable parity correction +parity_correction=1 + +l2_mem_entries=<40960> +l3_mem_entries=<40960> + +portmap_1=1:100 +portmap_2=5:100 +portmap_3=9:100 +portmap_4=13:100 +portmap_5=17:100 +portmap_6=21:100 +portmap_7=25:100 +portmap_8=29:100 +portmap_34=33:100 +portmap_35=37:100 +portmap_36=41:100 +portmap_37=45:100 +portmap_38=49:100 +portmap_39=53:100 +portmap_40=57:100 +portmap_41=61:100 +portmap_68=65:100 +portmap_69=69:100 +portmap_70=73:100 +portmap_71=77:100 +portmap_72=81:100 +portmap_73=85:100 +portmap_74=89:100 +portmap_75=93:100 +portmap_102=97:100 +portmap_103=101:100 +portmap_104=105:100 +portmap_105=109:100 +portmap_106=113:100 +portmap_107=117:100 +portmap_108=121:100 +portmap_109=125:100 + +portmap_66=129:10 +portmap_100=131:10 +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 + + +mem_cache_enable=1 +ctr_evict_enable=0 + +#mdio setting +rate_ext_mdio_divisor=0x2f +mdio_output_delay=15 + +#lanes swap and polarity +xgxs_rx_lane_map_1=0x3120 +phy_xaui_rx_polarity_flip_1=0xa +xgxs_tx_lane_map_1=0x1230 +phy_xaui_tx_polarity_flip_1=0x7 + +xgxs_rx_lane_map_2=0x3120 +phy_xaui_rx_polarity_flip_2=0xc +xgxs_tx_lane_map_2=0x0213 +phy_xaui_tx_polarity_flip_2=0x5 + +xgxs_rx_lane_map_3=0x2013 +phy_xaui_rx_polarity_flip_3=0xb +xgxs_tx_lane_map_3=0x3120 +phy_xaui_tx_polarity_flip_3=0x6 + +xgxs_rx_lane_map_4=0x2103 +phy_xaui_rx_polarity_flip_4=0xf +xgxs_tx_lane_map_4=0x3201 +phy_xaui_tx_polarity_flip_4=0x5 + +xgxs_rx_lane_map_5=0x1032 +phy_xaui_rx_polarity_flip_5=0x7 +xgxs_tx_lane_map_5=0x1302 +phy_xaui_tx_polarity_flip_5=0x0 + +xgxs_rx_lane_map_6=0x2103 +phy_xaui_rx_polarity_flip_6=0x3 +xgxs_tx_lane_map_6=0x3120 +phy_xaui_tx_polarity_flip_6=0x2 + +xgxs_rx_lane_map_7=0x0123 +phy_xaui_rx_polarity_flip_7=0x5 +xgxs_tx_lane_map_7=0x3012 +phy_xaui_tx_polarity_flip_7=0x3 + +xgxs_rx_lane_map_8=0x1032 +phy_xaui_rx_polarity_flip_8=0xf +xgxs_tx_lane_map_8=0x3120 +phy_xaui_tx_polarity_flip_8=0x2 + +xgxs_rx_lane_map_34=0x3021 +phy_xaui_rx_polarity_flip_34=0xa +xgxs_tx_lane_map_34=0x3210 +phy_xaui_tx_polarity_flip_34=0xf + +xgxs_rx_lane_map_35=0x2103 +phy_xaui_rx_polarity_flip_35=0x6 +xgxs_tx_lane_map_35=0x3120 +phy_xaui_tx_polarity_flip_35=0x5 + +xgxs_rx_lane_map_36=0x0312 +phy_xaui_rx_polarity_flip_36=0x4 +xgxs_tx_lane_map_36=0x3210 +phy_xaui_tx_polarity_flip_36=0x2 + +xgxs_rx_lane_map_37=0x0231 +phy_xaui_rx_polarity_flip_37=0x4 +xgxs_tx_lane_map_37=0x1032 +phy_xaui_tx_polarity_flip_37=0x2 + +xgxs_rx_lane_map_38=0x3012 +phy_xaui_rx_polarity_flip_38=0xa +xgxs_tx_lane_map_38=0x2103 +phy_xaui_tx_polarity_flip_38=0xd + +xgxs_rx_lane_map_39=0x0123 +phy_xaui_rx_polarity_flip_39=0x9 +xgxs_tx_lane_map_39=0x3120 +phy_xaui_tx_polarity_flip_39=0xd + +xgxs_rx_lane_map_40=0x2310 +phy_xaui_rx_polarity_flip_40=0x6 +xgxs_tx_lane_map_40=0x0123 + +xgxs_rx_lane_map_41=0x1230 +phy_xaui_rx_polarity_flip_41=0xa +xgxs_tx_lane_map_41=0x0123 +phy_xaui_tx_polarity_flip_41=0xe + +xgxs_rx_lane_map_68=0x1230 +phy_xaui_rx_polarity_flip_68=0xb +xgxs_tx_lane_map_68=0x3012 +phy_xaui_tx_polarity_flip_68=0xa + +xgxs_rx_lane_map_69=0x2310 +phy_xaui_rx_polarity_flip_69=0xf +xgxs_tx_lane_map_69=0x3120 +phy_xaui_tx_polarity_flip_69=0x2 + +xgxs_rx_lane_map_70=0x2310 +phy_xaui_rx_polarity_flip_70=0xe +xgxs_tx_lane_map_70=0x0213 +phy_xaui_tx_polarity_flip_70=0x2 + +xgxs_rx_lane_map_71=0x2130 +phy_xaui_rx_polarity_flip_71=0x5 +xgxs_tx_lane_map_71=0x3210 + +phy_xaui_rx_polarity_flip_72=0xa +xgxs_tx_lane_map_72=0x1230 + +xgxs_rx_lane_map_73=0x0213 +phy_xaui_rx_polarity_flip_73=0x5 +xgxs_tx_lane_map_73=0x1320 +phy_xaui_tx_polarity_flip_73=0x3 + +xgxs_rx_lane_map_74=0x2310 +phy_xaui_rx_polarity_flip_74=0xe +xgxs_tx_lane_map_74=0x2310 +phy_xaui_tx_polarity_flip_74=0xc + +xgxs_rx_lane_map_75=0x0321 +xgxs_tx_lane_map_75=0x2130 +phy_xaui_tx_polarity_flip_75=0x6 + +xgxs_rx_lane_map_102=0x1302 +phy_xaui_rx_polarity_flip_102=0x4 +xgxs_tx_lane_map_102=0x0123 +phy_xaui_tx_polarity_flip_102=0xa + +xgxs_tx_lane_map_103=0x2130 +phy_xaui_tx_polarity_flip_103=0x8 + +xgxs_rx_lane_map_104=0x1302 +phy_xaui_rx_polarity_flip_104=0xd +xgxs_tx_lane_map_104=0x1302 +phy_xaui_tx_polarity_flip_104=0x2 + +xgxs_rx_lane_map_105=0x1230 +phy_xaui_rx_polarity_flip_105=0x8 +xgxs_tx_lane_map_105=0x1320 + +xgxs_rx_lane_map_106=0x3120 +phy_xaui_rx_polarity_flip_106=0xc +xgxs_tx_lane_map_106=0x3120 +phy_xaui_tx_polarity_flip_106=0x0 + +xgxs_rx_lane_map_107=0x0321 +phy_xaui_rx_polarity_flip_107=0xa +xgxs_tx_lane_map_107=0x1032 +phy_xaui_tx_polarity_flip_107=0xf + +xgxs_rx_lane_map_108=0x0321 +phy_xaui_rx_polarity_flip_108=0xf +xgxs_tx_lane_map_108=0x3210 +phy_xaui_tx_polarity_flip_108=0x0 + +xgxs_rx_lane_map_109=0x0321 +phy_xaui_rx_polarity_flip_109=0xa +xgxs_tx_lane_map_109=0x3021 +phy_xaui_tx_polarity_flip_109=0x3 + +dport_map_port_68=1 +dport_map_port_69=2 +dport_map_port_70=3 +dport_map_port_71=4 +dport_map_port_37=5 +dport_map_port_36=6 +dport_map_port_39=7 +dport_map_port_38=8 +dport_map_port_41=9 +dport_map_port_40=10 +dport_map_port_35=11 +dport_map_port_34=12 +dport_map_port_72=13 +dport_map_port_73=14 +dport_map_port_74=15 +dport_map_port_75=16 +dport_map_port_102=17 +dport_map_port_103=18 +dport_map_port_104=19 +dport_map_port_105=20 +dport_map_port_8=21 +dport_map_port_7=22 +dport_map_port_2=23 +dport_map_port_1=24 +dport_map_port_4=25 +dport_map_port_3=26 +dport_map_port_6=27 +dport_map_port_5=28 +dport_map_port_106=29 +dport_map_port_107=30 +dport_map_port_108=31 +dport_map_port_109=32 +dport_map_port_66=33 +dport_map_port_100=34 + From 9413fa9a7bb9e50e300a6b79525ecb4d98efccb2 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 20 Aug 2018 11:19:16 -0700 Subject: [PATCH 1569/1833] [interfaces]: Move IP/MTU information from interfaces file into database (#1908) - Move front panel ports and port channels MTU and IP configurations out of the current /etc/network/interfaces file and store them in the configuration database. - The default MTU value for both front panel ports and the port channels is 9100. They are set via the minigraph or 9100 by default. - Introduce portmgrd which will pick up the MTU configurations from the configuration database. - The updated intfmgrd will pick up IP address changes from the configuration database. - Update sonic-swss submodule Signed-off-by: Shu0T1an ChenG --- dockers/docker-orchagent/start.sh | 2 + dockers/docker-orchagent/supervisord.conf | 12 +++- files/image_config/interfaces/interfaces.j2 | 22 ------ platform/vs/docker-sonic-vs/start.sh | 2 + platform/vs/docker-sonic-vs/supervisord.conf | 18 +++-- src/sonic-config-engine/minigraph.py | 16 ++++- .../tests/sample_output/interfaces | 50 ------------- src/sonic-config-engine/tests/test_cfggen.py | 72 +++++++++---------- .../tests/test_minigraph_case.py | 2 +- src/sonic-swss | 2 +- 10 files changed, 80 insertions(+), 118 deletions(-) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 0321bf8428f4..9249dc5c0722 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -26,6 +26,8 @@ supervisorctl start vlanmgrd supervisorctl start intfmgrd +supervisorctl start portmgrd + supervisorctl start buffermgrd supervisorctl start enable_counters diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 2369a4c31b05..8f96037f11b6 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -84,9 +84,17 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog +[program:portmgrd] +command=/usr/bin/portmgrd +priority=11 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + [program:buffermgrd] command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini -priority=10 +priority=12 autostart=false autorestart=false stdout_logfile=syslog @@ -94,7 +102,7 @@ stderr_logfile=syslog [program:enable_counters] command=/usr/bin/enable_counters.py -priority=11 +priority=13 autostart=false autorestart=false stdout_logfile=syslog diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index 924ff54af308..da2499ee5047 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -49,15 +49,6 @@ iface eth0 inet dhcp # {% endblock mgmt_interface %} {% block front_panel_interfaces %} -# The switch front panel interfaces -{% for (name, prefix) in INTERFACE %} -allow-hotplug {{ name }} -iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static - mtu {{ PORT[name]['mtu'] if PORT[name]['mtu'] else 9100 }} - address {{ prefix | ip }} - netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} -# -{% endfor %} {% if PORTCHANNEL %} # "|| true" is added to suppress the error when interface is already a member of LAG # "ip link show | grep -q master" is added to ensure interface is enslaved @@ -73,16 +64,3 @@ iface {{ member }} inet manual {% endfor %} {% endif %} {% endblock front_panel_interfaces %} -{% block pc_interfaces %} -{% if PORTCHANNEL_INTERFACE %} -# Portchannel interfaces -{% for (name, prefix) in PORTCHANNEL_INTERFACE.keys() | sort %} -allow-hotplug {{ name }} -iface {{ name }} {{ 'inet' if prefix | ipv4 else 'inet6' }} static - mtu {{ PORTCHANNEL[name]['mtu'] if PORTCHANNEL[name]['mtu'] else 9100 }} - address {{ prefix | ip }} - netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }} -# -{% endfor %} -{% endif %} -{% endblock pc_interfaces %} diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 960cc242b862..d16e9535c218 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -42,6 +42,8 @@ supervisorctl start teamsyncd supervisorctl start fpmsyncd +supervisorctl start portmgrd + supervisorctl start intfmgrd supervisorctl start vlanmgrd diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index a4b24334d1bd..1f6dfad60cf0 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -91,9 +91,17 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog +[program:portmgrd] +command=/usr/bin/portmgrd +priority=12 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + [program:zebra] command=/usr/lib/quagga/zebra -A 127.0.0.1 -priority=12 +priority=13 autostart=false autorestart=false stdout_logfile=syslog @@ -101,7 +109,7 @@ stderr_logfile=syslog [program:bgpd] command=/usr/lib/quagga/bgpd -A 127.0.0.1 -F -priority=13 +priority=14 autostart=false autorestart=false stdout_logfile=syslog @@ -109,7 +117,7 @@ stderr_logfile=syslog [program:fpmsyncd] command=/usr/bin/fpmsyncd -priority=14 +priority=15 autostart=false autorestart=false stdout_logfile=syslog @@ -117,7 +125,7 @@ stderr_logfile=syslog [program:arp_update] command=/usr/bin/arp_update -priority=15 +priority=16 autostart=false autorestart=unexpected stdout_logfile=syslog @@ -125,7 +133,7 @@ stderr_logfile=syslog [program:buffermgrd] command=/usr/bin/buffermgrd -l /usr/share/sonic/device/vswitch/pg_profile_lookup.ini -priority=10 +priority=17 autostart=false autorestart=false stdout_logfile=syslog diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 19a4b0ceba7a..a990ec6a2067 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -91,7 +91,7 @@ def parse_png(png, hname): 'flow_control': flowcontrol } continue - + if linktype != "DeviceInterfaceLink" and linktype != "UnderlayInterfaceLink": continue @@ -516,6 +516,15 @@ def parse_xml(filename, platform=None, port_config_file=None): ports.setdefault(port_name, {})['description'] = port_descriptions[port_name] + # set default port MTU as 9100 + for port in ports.itervalues(): + port['mtu'] = '9100' + + # set physical port default admin status up + for port in phyport_intfs: + if port[0] in ports: + ports.get(port[0])['admin_status'] = 'up' + results['PORT'] = ports results['CONSOLE_PORT'] = console_ports @@ -528,6 +537,11 @@ def parse_xml(filename, platform=None, port_config_file=None): print >> sys.stderr, "Warning: ignore '%s' as part of its member interfaces is not in the port_config.ini" % pc_name del pcs[pc_name] + # set default port channel MTU as 9100 and admin status up + for pc in pcs.itervalues(): + pc['mtu'] = '9100' + pc['admin_status'] = 'up' + results['PORTCHANNEL'] = pcs diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index e3f09afd1a83..c471c0aa8d60 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -47,7 +47,6 @@ iface eth0 inet6 static down ip -6 route delete 2603:10e2:0:2902::/64 dev eth0 table default down ip -6 rule delete from 2603:10e2:0:2902::8/128 table default # -# The switch front panel interfaces # "|| true" is added to suppress the error when interface is already a member of LAG # "ip link show | grep -q master" is added to ensure interface is enslaved allow-hotplug fortyGigE0/112 @@ -74,53 +73,4 @@ iface fortyGigE0/124 inet manual post-up ip link show fortyGigE0/124 | grep -q master && ifconfig fortyGigE0/124 up post-down ifconfig fortyGigE0/124 down # -# Portchannel interfaces -allow-hotplug PortChannel01 -iface PortChannel01 inet static - mtu 9100 - address 10.0.0.56 - netmask 255.255.255.254 -# -allow-hotplug PortChannel01 -iface PortChannel01 inet6 static - mtu 9100 - address fc00::71 - netmask 126 -# -allow-hotplug PortChannel02 -iface PortChannel02 inet static - mtu 9100 - address 10.0.0.58 - netmask 255.255.255.254 -# -allow-hotplug PortChannel02 -iface PortChannel02 inet6 static - mtu 9100 - address fc00::75 - netmask 126 -# -allow-hotplug PortChannel03 -iface PortChannel03 inet static - mtu 9100 - address 10.0.0.60 - netmask 255.255.255.254 -# -allow-hotplug PortChannel03 -iface PortChannel03 inet6 static - mtu 9100 - address fc00::79 - netmask 126 -# -allow-hotplug PortChannel04 -iface PortChannel04 inet static - mtu 9100 - address 10.0.0.62 - netmask 255.255.255.254 -# -allow-hotplug PortChannel04 -iface PortChannel04 inet6 static - mtu 9100 - address fc00::7d - netmask 126 -# diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index d88f0525d546..a4f35021e1da 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -115,12 +115,12 @@ def test_minigraph_vlan_interfaces(self): def test_minigraph_portchannels(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'members': ['Ethernet4']}}") + self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet4'], 'mtu': '9100'}}") def test_minigraph_portchannels_more_member(self): argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}") + self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124'], 'mtu': '9100'}}") def test_minigraph_portchannel_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORTCHANNEL_INTERFACE.keys()"' @@ -159,47 +159,47 @@ 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(), "{'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '1000'}") + self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '1000', 'mtu': '9100'}") argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet12\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/12', 'lanes': '33,34,35,36', 'fec': 'rs', 'speed': '100000', 'description': 'Interface description'}") + self.assertEqual(output.strip(), "{'lanes': '33,34,35,36', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'speed': '100000', 'fec': 'rs'}") 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': {'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '1000'}, " - "'Ethernet0': {'alias': 'fortyGigE0/0', 'lanes': '29,30,31,32', 'speed': '10000'}, " - "'Ethernet4': {'alias': 'fortyGigE0/4', 'lanes': '25,26,27,28', 'speed': '25000'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'lanes': '81,82,83,84'}, " - "'Ethernet100': {'alias': 'fortyGigE0/100', 'lanes': '125,126,127,128'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'lanes': '85,86,87,88'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'lanes': '69,70,71,72'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'lanes': '121,122,123,124'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'lanes': '101,102,103,104'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'lanes': '113,114,115,116'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'lanes': '97,98,99,100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'lanes': '53,54,55,56'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'lanes': '61,62,63,64'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'lanes': '73,74,75,76'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'lanes': '77,78,79,80'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'lanes': '65,66,67,68'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'lanes': '9,10,11,12'}, " - "'Ethernet16': {'alias': 'fortyGigE0/16', 'lanes': '41,42,43,44'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'lanes': '13,14,15,16'}, " - "'Ethernet12': {'alias': 'fortyGigE0/12', 'lanes': '33,34,35,36', 'fec': 'rs', 'speed': '100000', 'description': 'Interface description'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'lanes': '117,118,119,120'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'lanes': '93,94,95,96'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'lanes': '105,106,107,108'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'lanes': '89,90,91,92'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'lanes': '109,110,111,112'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'lanes': '49,50,51,52'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'lanes': '17,18,19,20'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'lanes': '21,22,23,24'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'lanes': '1,2,3,4'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'lanes': '57,58,59,60'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'lanes': '45,46,47,48'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'lanes': '5,6,7,8'}}") + "{'Ethernet8': {'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '1000', 'mtu': '9100'}, " + "'Ethernet0': {'alias': 'fortyGigE0/0', 'admin_status': 'up', 'lanes': '29,30,31,32', 'speed': '10000', 'mtu': '9100'}, " + "'Ethernet4': {'alias': 'fortyGigE0/4', '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'}}") def test_metadata_everflow(self): argument = '-m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '" -v "MIRROR_SESSION"' diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 85110f56f7b9..6a4849c71480 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -87,7 +87,7 @@ def test_minigraph_vlan_interfaces(self): def test_minigraph_portchannels(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'members': ['Ethernet4']}}") + self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet4'], 'mtu': '9100'}}") def test_minigraph_console_port(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v CONSOLE_PORT' diff --git a/src/sonic-swss b/src/sonic-swss index 902239ad4c67..8bfdea086f14 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 902239ad4c67c8e85da296b00badbc08b9820001 +Subproject commit 8bfdea086f14bbe420846d42c607760999cbdcc3 From d9527ec5cb3108a3c5da4f5965ff290e1419ebad Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 20 Aug 2018 11:19:28 -0700 Subject: [PATCH 1570/1833] [utilities]: Update sonic-utilities submodule (#1949) Signed-off-by: Shu0T1an ChenG --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 747d5c386299..951633b02606 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 747d5c386299a8fac2acb4f4594fe2498d33df36 +Subproject commit 951633b02606768b458b7dc88f6c6f8ca736db4e From 454690506e5151070f895e0f0997734e22967c90 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 20 Aug 2018 21:10:49 -0700 Subject: [PATCH 1571/1833] [kernel]: upgrade kernel to 4.9.0-7 (4.9.110-3+deb9u2) (#1955) * [kernel]: upgrade kernel to 4.9.0-7 (4.9.110-3+deb9u2) Signed-off-by: Qi Luo * Update submodule Signed-off-by: Qi Luo --- rules/linux-kernel.mk | 2 +- src/sonic-linux-kernel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 7c9e7b2c07aa..05caf384bcc6 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -3,7 +3,7 @@ KVERSION_SHORT = 4.9.0-7 KVERSION = $(KVERSION_SHORT)-amd64 KERNEL_VERSION = 4.9.110 -KERNEL_SUBVERSION = 3+deb9u1 +KERNEL_SUBVERSION = 3+deb9u2 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 7c97ae923c9e..2991f0de99b0 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 7c97ae923c9ec9b2006ed275e8780233b32b28f6 +Subproject commit 2991f0de99b004d6336348d2da638bb58e51d152 From c692d2dcd0e7417a1d4cdf77350ac5f82de4519d Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 21 Aug 2018 00:00:46 -0700 Subject: [PATCH 1572/1833] [baseimage]: Build specific revision of initramfs-tools (#1957) Signed-off-by: Qi Luo --- src/initramfs-tools/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/initramfs-tools/Makefile b/src/initramfs-tools/Makefile index c92d1b54838a..0b08e4aa431e 100644 --- a/src/initramfs-tools/Makefile +++ b/src/initramfs-tools/Makefile @@ -5,6 +5,8 @@ SHELL = /bin/bash MAIN_TARGET = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb DERIVED_TARGETS = initramfs-tools-core_$(INITRAMFS_TOOLS_VERSION)_all.deb +INITRAMFS_TOOLS_REVISION = 18fc98e1b63b012f9bcf06ae3f5477872a5880c0 + $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the initramfs-tools rm -rf ./initramfs-tools @@ -12,6 +14,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Patch pushd ./initramfs-tools + git checkout $(INITRAMFS_TOOLS_REVISION) patch -p1 < ../loopback-file-system-support.patch # Build the package From 450cb04176bba90ef82062e8e69860b348ba2b2e Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 21 Aug 2018 00:55:39 -0700 Subject: [PATCH 1573/1833] [utilities]: Update sonic-utilities submodule (#1956) Signed-off-by: Shu0T1an ChenG --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 951633b02606..c14d917ec8e4 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 951633b02606768b458b7dc88f6c6f8ca736db4e +Subproject commit c14d917ec8e45983bedef82460ea1903a595b19f From 788b20ee1255c89ec8dd6254c961dda17c0bc223 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 21 Aug 2018 00:58:16 -0700 Subject: [PATCH 1574/1833] [arista]: Fix mount point discovery in boot0 for overlayfs (#1959) On overlay filesystem the name of the mountpoint will also match in the mount command for overlayfs as upperdir= To prevent detecting the wrong partition we now look for space before. This ensure that we match mountpoint and not devices in df and mount outputs. --- files/Aboot/boot0.j2 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 89a5299c4c67..4bb1a279ff31 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -63,6 +63,7 @@ cmdline_base="$target_path/kernel-params-base" cmdline_image="$image_path/kernel-cmdline" bootconfigvars="KERNEL INITRD CONSOLESPEED PASSWORD NETDEV NETAUTO NETIP NETMASK NETGW NETDOMAIN NETDNS NETHW memtest" +flash_re=" /mnt/flash| /host" parse_environment_config() { for n in ${bootconfigvars}; do @@ -148,7 +149,8 @@ platform_specific() { # set varlog size to 100MB local varlog_size=100 - local flash_size=$(($(df | grep -E '/mnt/flash|/host' | tr -s ' ' | cut -f2 -d' ') / 1000)) + # detect the size of the flash partition from name in Aboot/EOS/SONiC + local flash_size=$(($(df | grep -E "$flash_re" | tr -s ' ' | cut -f2 -d' ') / 1000)) if [ "$platform" = "raven" ]; then aboot_machine=arista_7050_qx32 @@ -241,8 +243,8 @@ write_boot_configs() { # setting root partition if not overridden by kernel-params if ! grep -q "root=" /tmp/append; then - rootdev="$(mount | grep -E '/mnt/flash|/host' | cut -f1 -d' ')" - rootfstype="$(mount | grep -E '/mnt/flash|/host' | cut -f5 -d' ')" + rootdev="$(mount | grep -E "$flash_re" | cut -f1 -d' ')" + rootfstype="$(mount | grep -E "$flash_re" | cut -f5 -d' ')" rootuuid="$(get_uuid_for $rootdev)" if [ -z "$rootuuid" ] || [ "$rootfstype" = "vfat" ] ; then echo "root=$rootdev" >> /tmp/append From a01791ebcde120493cf847058659dd2b57b332e9 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 21 Aug 2018 10:10:58 -0700 Subject: [PATCH 1575/1833] [vs-test]: support python docker 3.5.0 (#1958) * [vs-test]: support python docker 3.5.0 Signed-off-by: Guohan Lu --- platform/vs/tests/bgp/test_invalid_nexthop.py | 4 +- platform/vs/tests/bgp/test_no_export.py | 6 +-- platform/vs/tests/conftest.py | 40 ++++++++++--------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/platform/vs/tests/bgp/test_invalid_nexthop.py b/platform/vs/tests/bgp/test_invalid_nexthop.py index b6e7cfc86e5e..616f26df6e61 100644 --- a/platform/vs/tests/bgp/test_invalid_nexthop.py +++ b/platform/vs/tests/bgp/test_invalid_nexthop.py @@ -22,11 +22,11 @@ def test_InvalidNexthop(dvs): time.sleep(10) - output = dvs.runcmd(["vtysh", "-c", "show ipv6 bgp"]) + (exit_code, output) = dvs.runcmd(["vtysh", "-c", "show ipv6 bgp"]) p.terminate() p = p.wait() - print output + print exit_code, output assert "3333::/64" in output diff --git a/platform/vs/tests/bgp/test_no_export.py b/platform/vs/tests/bgp/test_no_export.py index 371d5f0b29ec..57f9bb322b01 100644 --- a/platform/vs/tests/bgp/test_no_export.py +++ b/platform/vs/tests/bgp/test_no_export.py @@ -27,9 +27,9 @@ def test_bounce(dvs): time.sleep(60) - sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"]) - all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"]) - announce_route = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) + (exit_code, sum_res) = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"]) + (exit_code, all_route) = dvs.runcmd(["vtysh", "-c", "show ip bgp"]) + (exit_code, announce_route) = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) p1.terminate() p1 = p1.wait() diff --git a/platform/vs/tests/conftest.py b/platform/vs/tests/conftest.py index 48ad7e15661a..8acaed5e9062 100644 --- a/platform/vs/tests/conftest.py +++ b/platform/vs/tests/conftest.py @@ -55,20 +55,7 @@ def __init__(self, dvs): keys = atbl.getKeys() assert len(keys) >= 1 - # Filter out DTel Acl tables - default_table_found = False - for k in keys: - if default_table_found: - break - (status, fvs) = atbl.get(k) - for item in fvs: - if item[0] == "SAI_ACL_TABLE_ATTR_ACL_BIND_POINT_TYPE_LIST": - if 'SAI_ACL_BIND_POINT_TYPE_PORT' in item[1]: - self.default_acl_table = k - default_table_found = True - break - else: - break + self.default_acl_tables = keys atbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_ACL_ENTRY") keys = atbl.getKeys() @@ -179,9 +166,13 @@ def __init__(self, name=None): network_mode="container:%s" % self.ctn_sw.name, volumes={ self.mount: { 'bind': '/var/run/redis', 'mode': 'rw' } }) - self.ctn.exec_run("sysctl -w net.ipv6.conf.all.disable_ipv6=0") - self.check_ready() - self.init_asicdb_validator() + try: + self.ctn.exec_run("sysctl -w net.ipv6.conf.all.disable_ipv6=0") + self.check_ready() + self.init_asicdb_validator() + except: + self.destroy() + raise def destroy(self): if self.cleanup: @@ -199,7 +190,11 @@ def check_ready(self, timeout=30): started = 0 while True: # get process status - out = self.ctn.exec_run("supervisorctl status") + res = self.ctn.exec_run("supervisorctl status") + try: + out = res.output + except AttributeError: + out = res for l in out.split('\n'): fds = re_space.split(l) if len(fds) < 2: @@ -231,7 +226,14 @@ def init_asicdb_validator(self): self.asicdb = AsicDbValidator(self) def runcmd(self, cmd): - return self.ctn.exec_run(cmd) + res = self.ctn.exec_run(cmd) + try: + exitcode = res.exit_code + out = res.output + except AttributeError: + exitcode = 0 + out = res + return (exitcode, out) def copy_file(self, path, filename): tarstr = StringIO.StringIO() From de0e892eaae23111b3cce50606936f04d775d5e4 Mon Sep 17 00:00:00 2001 From: yurypm Date: Tue, 21 Aug 2018 23:19:31 +0100 Subject: [PATCH 1576/1833] [arista] Fix arista-convertfs script (#1961) --- files/initramfs-tools/arista-convertfs.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 81de6750837a..1fc4db6ecfdb 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -185,7 +185,7 @@ cmd="wait_for_root_dev" run_cmd "$cmd" "$err_msg" err_msg="Error: formatting to ext4 failed" -cmd="mke2fs -t ext4 -m2 -F -O '^huge_file' $root_dev" +cmd="mke2fs -t ext4 -F -O '^huge_file,^metadata_csum' $root_dev" run_cmd "$cmd" "$err_msg" err_msg="Error: mounting $root_dev to $root_mnt failed" From d7be9a41c0eb053b8a0d52fb7f8e1f2d13dce165 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Wed, 22 Aug 2018 02:37:53 -0700 Subject: [PATCH 1577/1833] [kernel]: Update sonic-linux-kernel pointer (#1964) --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 2991f0de99b0..c87ebef623b6 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 2991f0de99b004d6336348d2da638bb58e51d152 +Subproject commit c87ebef623b60455edbdd71e33ac2c204b9e681d From ada11409b2506f0a854783e2c77fb684fb5349c3 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 22 Aug 2018 19:08:08 +0300 Subject: [PATCH 1578/1833] [mellanox]: Fix sysfs path for PSU devices in psuutil plugin (#1966) Signed-off-by: Volodymyr Samotiy --- device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py | 4 ++-- device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py | 4 ++-- device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py | 4 ++-- device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py index 88bdd51e9b67..01954dededf7 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py @@ -21,9 +21,9 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_path = "/bsp/module/" self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pg_status" + self.psu_oper_status = "psu{}_pwr_status" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py index 301569c13a94..13738bb77f46 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py @@ -21,9 +21,9 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_path = "/bsp/module/" self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pg_status" + self.psu_oper_status = "psu{}_pwr_status" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py index 301569c13a94..13738bb77f46 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py @@ -21,9 +21,9 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_path = "/bsp/module/" self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pg_status" + self.psu_oper_status = "psu{}_pwr_status" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py index 301569c13a94..13738bb77f46 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py @@ -21,9 +21,9 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_path = "/sys/bus/i2c/devices/2-0060/" + self.psu_path = "/bsp/module/" self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pg_status" + self.psu_oper_status = "psu{}_pwr_status" def get_num_psus(self): """ From 80c6453731275126be83956237d24309ee3f7c0b Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 22 Aug 2018 13:02:32 -0700 Subject: [PATCH 1579/1833] [swss]: simplify swss systemd service file (#1965) move the swss service start/stop logic into /usr/local/bin/swss.sh Signed-off-by: Guohan Lu --- .../build_templates/sonic_debian_extension.j2 | 4 ++ files/build_templates/swss.service.j2 | 38 +------------ files/scripts/swss.sh | 57 +++++++++++++++++++ 3 files changed, 64 insertions(+), 35 deletions(-) create mode 100755 files/scripts/swss.sh diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index b43e616e1756..9a4af3c3c637 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -27,6 +27,7 @@ set -x -e . functions.sh BUILD_TEMPLATES=files/build_templates IMAGE_CONFIGS=files/image_config +SCRIPTS_DIR=files/scripts # Define target fold macro FILESYSTEM_ROOT_USR="$FILESYSTEM_ROOT/usr" @@ -292,6 +293,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys {% endif %} +# Copy swss service script +sudo LANG=C cp $SCRIPTS_DIR/swss.sh $FILESYSTEM_ROOT/usr/local/bin/swss.sh + # Copy systemd timer configuration # It implements delayed start of services sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT/etc/systemd/system/ diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 08e3f50e2697..61fff9721aed 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -16,41 +16,9 @@ After=nps-modules-4.9.0-7-amd64.service [Service] User=root -# Wait for redis server start before database clean -ExecStartPre=/bin/bash -c 'until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; do sleep 1; done' -ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB -ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB -ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB -ExecStartPre=/usr/bin/docker exec database redis-cli -n 5 FLUSHDB -ExecStartPre=/usr/bin/docker exec database redis-cli -n 6 FLUSHDB - -{% if sonic_asic_platform == 'mellanox' %} -Environment=FAST_BOOT=1 -TimeoutStartSec=3min -ExecStartPre=/usr/bin/mst start -ExecStartPre=/usr/bin/mlnx-fw-upgrade.sh -ExecStartPre=/etc/init.d/sxdkernel start -ExecStartPre=/sbin/modprobe i2c-dev -ExecStartPre=/bin/bash -c "/etc/mlnx/mlnx-hw-management start" -{% elif sonic_asic_platform == 'cavium' %} -ExecStartPre=/etc/init.d/xpnet.sh start -{% endif %} - -ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStartPre=/usr/bin/syncd.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach - -ExecStop=/usr/bin/{{docker_container_name}}.sh stop -ExecStopPost=/usr/bin/syncd.sh stop - -{% if sonic_asic_platform == 'mellanox' %} -ExecStopPost=/bin/bash -c "/etc/mlnx/mlnx-hw-management stop" -ExecStopPost=/etc/init.d/sxdkernel stop -ExecStopPost=/usr/bin/mst stop -{% elif sonic_asic_platform == 'cavium' %} -ExecStopPost=/etc/init.d/xpnet.sh stop -ExecStopPost=/etc/init.d/xpnet.sh start -{% endif %} +Environment=sonic_asic_platform={{ sonic_asic_platform }} +ExecStart=/usr/local/bin/swss.sh start +ExecStop=/usr/local/bin/swss.sh stop [Install] WantedBy=multi-user.target diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh new file mode 100755 index 000000000000..de46c0fbe7fc --- /dev/null +++ b/files/scripts/swss.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +start() { + # 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 + + # Flush DB + /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 + /usr/bin/docker exec database redis-cli -n 6 FLUSHDB + + # platform specific tasks + if [ x$sonic_asic_platform == x'mellanox' ]; then + FAST_BOOT=1 + /usr/bin/mst start + /usr/bin/mlnx-fw-upgrade.sh + /etc/init.d/sxdkernel start + /sbin/modprobe i2c-dev + /etc/mlnx/mlnx-hw-management start + elif [ x$sonic_asic_platform == x'cavium' ]; then + /etc/init.d/xpnet.sh start + fi + + # start swss and syncd docker + /usr/bin/swss.sh start + /usr/bin/syncd.sh start + /usr/bin/swss.sh attach +} + +stop() { + /usr/bin/swss.sh stop + /usr/bin/syncd.sh stop + + # platform specific tasks + if [ x$sonic_asic_platform == x'mellanox' ]; then + /etc/mlnx/mlnx-hw-management stop + /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 +} + +case "$1" in + start|stop) + $1 + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac From a5fd3beb1b177ce7e5bd32d899d64e9c0ad41791 Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Wed, 22 Aug 2018 13:03:52 -0700 Subject: [PATCH 1580/1833] [mellanox]: Enable WRED red color profile on mellanox platform (#1968) Signed-off-by: Wenda --- device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 | 2 ++ device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 | 2 ++ device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 | 2 ++ .../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 | 2 ++ 4 files changed, 8 insertions(+) diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 index b1759cb42118..a11c77f7cc24 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 @@ -154,6 +154,7 @@ "AZURE_LOSSY": { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", "red_max_threshold":"516096", "red_min_threshold":"516096", @@ -165,6 +166,7 @@ "AZURE_LOSSLESS": { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", "red_max_threshold":"516096", "red_min_threshold":"516096", diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 index b1759cb42118..a11c77f7cc24 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 @@ -154,6 +154,7 @@ "AZURE_LOSSY": { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", "red_max_threshold":"516096", "red_min_threshold":"516096", @@ -165,6 +166,7 @@ "AZURE_LOSSLESS": { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", "red_max_threshold":"516096", "red_min_threshold":"516096", diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 index b1759cb42118..a11c77f7cc24 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 @@ -154,6 +154,7 @@ "AZURE_LOSSY": { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", "red_max_threshold":"516096", "red_min_threshold":"516096", @@ -165,6 +166,7 @@ "AZURE_LOSSLESS": { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", "red_max_threshold":"516096", "red_min_threshold":"516096", diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 index b1759cb42118..a11c77f7cc24 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 @@ -154,6 +154,7 @@ "AZURE_LOSSY": { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", "red_max_threshold":"516096", "red_min_threshold":"516096", @@ -165,6 +166,7 @@ "AZURE_LOSSLESS": { "wred_green_enable":"true", "wred_yellow_enable":"true", + "wred_red_enable":"true", "ecn":"ecn_all", "red_max_threshold":"516096", "red_min_threshold":"516096", From 7eacb683c470471ffe16baa809d4fe1e6fe20f78 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 22 Aug 2018 13:04:58 -0700 Subject: [PATCH 1581/1833] [baseimage]: update make file for initramfs-tools (#1967) Call add_extra_package instead add_derived_package. Because the 'extra' package doesn't require 'base' package to be installed to be built. This change enables make stretch with multiple threads. Signed-off-by: Ying Xie --- rules/initramfs-tools.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/initramfs-tools.mk b/rules/initramfs-tools.mk index 3b797762dc28..badc584dd2be 100644 --- a/rules/initramfs-tools.mk +++ b/rules/initramfs-tools.mk @@ -8,6 +8,6 @@ $(INITRAMFS_TOOLS)_SRC_PATH = $(SRC_PATH)/initramfs-tools SONIC_MAKE_DEBS += $(INITRAMFS_TOOLS) INITRAMFS_TOOLS_CORE = initramfs-tools-core_$(INITRAMFS_TOOLS_VERSION)_all.deb -$(eval $(call add_derived_package,$(INITRAMFS_TOOLS),$(INITRAMFS_TOOLS_CORE))) +$(eval $(call add_extra_package,$(INITRAMFS_TOOLS),$(INITRAMFS_TOOLS_CORE))) SONIC_STRETCH_DEBS += $(INITRAMFS_TOOLS) $(INITRAMFS_TOOLS_CORE) From a99008356b81f93f4c6cffbb17e4727020f9e175 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 22 Aug 2018 17:12:05 -0700 Subject: [PATCH 1582/1833] [dell]: Remove depmod -a from the platform initialization script (#1954) depmod -a will be executed automatically after the package get installed Signed-off-by: Shu0T1an ChenG --- .../sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh | 1 - .../sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh | 1 - .../z9264f/scripts/z9264f_platform.sh | 1 - 3 files changed, 3 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh index 8dd76f2ea6d3..be143cb9efe7 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh @@ -174,7 +174,6 @@ switch_board_qsfp_lpmode() { init_devnum if [[ "$1" == "init" ]]; then - depmod -a modprobe i2c-dev modprobe i2c-mux-pca954x force_deselect_on_exit=1 modprobe dell_s6100_iom_cpld diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh index 3c3fe31e9cbd..6b62144eedac 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh @@ -139,7 +139,6 @@ switch_board_qsfp() { init_devnum if [[ "$1" == "init" ]]; then - depmod -a modprobe i2c-dev modprobe i2c-mux-pca954x force_deselect_on_exit=1 modprobe dell_mailbox diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh index a899a53a9ffb..e38914319342 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh @@ -102,7 +102,6 @@ switch_board_modsel() { init_devnum if [ "$1" == "init" ]; then - depmod -a modprobe i2c-dev modprobe i2c-mux-pca954x force_deselect_on_exit=1 modprobe i2c_ocores From 27bdc00be397e3a30eb81fe63584002cec490bf5 Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Fri, 24 Aug 2018 03:43:05 +0700 Subject: [PATCH 1583/1833] [platform/device] - Update Haliburton platform modules and device configuration (#1975) * Add psuutil and sfputil support * Fixed fancontrol issue * Add sensor's label * Update haliburton platform modules --- .../Celestica-E1031-T48S4/port_config.ini | 106 +-- .../celestica/x86_64-cel_e1031-r0/fancontrol | 10 +- .../x86_64-cel_e1031-r0/plugins/psuutil.py | 61 ++ .../x86_64-cel_e1031-r0/plugins/sfputil.py | 123 +++ .../x86_64-cel_e1031-r0/sensors.conf | 39 +- platform/broadcom/platform-modules-cel.mk | 4 +- .../debian/changelog | 11 +- .../debian/platform-modules-haliburton.init | 20 +- .../platform-modules-haliburton.install | 1 + .../platform-modules-haliburton.postinst | 3 + .../haliburton/modules/Makefile | 2 +- .../haliburton/modules/smc.c | 777 ++++++++++++++++++ .../platform-modules-haliburton.service | 14 + 13 files changed, 1086 insertions(+), 85 deletions(-) create mode 100644 device/celestica/x86_64-cel_e1031-r0/plugins/psuutil.py create mode 100644 device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py create mode 100644 platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst create mode 100644 platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c create mode 100644 platform/broadcom/sonic-platform-modules-cel/haliburton/systemd/platform-modules-haliburton.service diff --git a/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/port_config.ini b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/port_config.ini index 6a7debfa45f6..a2b64ea155df 100644 --- a/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/port_config.ini +++ b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/port_config.ini @@ -1,53 +1,53 @@ -# name lanes speed alias autoneg -Ethernet0 2 1000 etp1 1 -Ethernet1 1 1000 etp2 1 -Ethernet2 4 1000 etp3 1 -Ethernet3 3 1000 etp4 1 -Ethernet4 6 1000 etp5 1 -Ethernet5 5 1000 etp6 1 -Ethernet6 8 1000 etp7 1 -Ethernet7 7 1000 etp8 1 -Ethernet8 10 1000 etp9 1 -Ethernet9 9 1000 etp10 1 -Ethernet10 12 1000 etp11 1 -Ethernet11 11 1000 etp12 1 -Ethernet12 14 1000 etp13 1 -Ethernet13 13 1000 etp14 1 -Ethernet14 16 1000 etp15 1 -Ethernet15 15 1000 etp16 1 -Ethernet16 18 1000 etp17 1 -Ethernet17 17 1000 etp18 1 -Ethernet18 20 1000 etp19 1 -Ethernet19 19 1000 etp20 1 -Ethernet20 22 1000 etp21 1 -Ethernet21 21 1000 etp22 1 -Ethernet22 24 1000 etp23 1 -Ethernet23 23 1000 etp24 1 -Ethernet24 26 1000 etp25 1 -Ethernet25 25 1000 etp26 1 -Ethernet26 28 1000 etp27 1 -Ethernet27 27 1000 etp28 1 -Ethernet28 30 1000 etp29 1 -Ethernet29 29 1000 etp30 1 -Ethernet30 32 1000 etp31 1 -Ethernet31 31 1000 etp32 1 -Ethernet32 34 1000 etp33 1 -Ethernet33 33 1000 etp34 1 -Ethernet34 36 1000 etp35 1 -Ethernet35 35 1000 etp36 1 -Ethernet36 38 1000 etp37 1 -Ethernet37 37 1000 etp38 1 -Ethernet38 40 1000 etp39 1 -Ethernet39 39 1000 etp40 1 -Ethernet40 42 1000 etp41 1 -Ethernet41 41 1000 etp42 1 -Ethernet42 44 1000 etp43 1 -Ethernet43 43 1000 etp44 1 -Ethernet44 46 1000 etp45 1 -Ethernet45 45 1000 etp46 1 -Ethernet46 48 1000 etp47 1 -Ethernet47 47 1000 etp48 1 -Ethernet48 54 10000 etp49 0 -Ethernet49 53 10000 etp50 0 -Ethernet50 56 10000 etp51 0 -Ethernet51 55 10000 etp52 0 +# name lanes index speed alias autoneg +Ethernet0 2 1 1000 etp1 1 +Ethernet1 1 2 1000 etp2 1 +Ethernet2 4 3 1000 etp3 1 +Ethernet3 3 4 1000 etp4 1 +Ethernet4 6 5 1000 etp5 1 +Ethernet5 5 6 1000 etp6 1 +Ethernet6 8 7 1000 etp7 1 +Ethernet7 7 8 1000 etp8 1 +Ethernet8 10 9 1000 etp9 1 +Ethernet9 9 10 1000 etp10 1 +Ethernet10 12 11 1000 etp11 1 +Ethernet11 11 12 1000 etp12 1 +Ethernet12 14 13 1000 etp13 1 +Ethernet13 13 14 1000 etp14 1 +Ethernet14 16 15 1000 etp15 1 +Ethernet15 15 16 1000 etp16 1 +Ethernet16 18 17 1000 etp17 1 +Ethernet17 17 18 1000 etp18 1 +Ethernet18 20 19 1000 etp19 1 +Ethernet19 19 20 1000 etp20 1 +Ethernet20 22 21 1000 etp21 1 +Ethernet21 21 22 1000 etp22 1 +Ethernet22 24 23 1000 etp23 1 +Ethernet23 23 24 1000 etp24 1 +Ethernet24 26 25 1000 etp25 1 +Ethernet25 25 26 1000 etp26 1 +Ethernet26 28 27 1000 etp27 1 +Ethernet27 27 28 1000 etp28 1 +Ethernet28 30 29 1000 etp29 1 +Ethernet29 29 30 1000 etp30 1 +Ethernet30 32 31 1000 etp31 1 +Ethernet31 31 32 1000 etp32 1 +Ethernet32 34 33 1000 etp33 1 +Ethernet33 33 34 1000 etp34 1 +Ethernet34 36 35 1000 etp35 1 +Ethernet35 35 36 1000 etp36 1 +Ethernet36 38 37 1000 etp37 1 +Ethernet37 37 38 1000 etp38 1 +Ethernet38 40 39 1000 etp39 1 +Ethernet39 39 40 1000 etp40 1 +Ethernet40 42 41 1000 etp41 1 +Ethernet41 41 42 1000 etp42 1 +Ethernet42 44 43 1000 etp43 1 +Ethernet43 43 44 1000 etp44 1 +Ethernet44 46 45 1000 etp45 1 +Ethernet45 45 46 1000 etp46 1 +Ethernet46 48 47 1000 etp47 1 +Ethernet47 47 48 1000 etp48 1 +Ethernet48 54 49 10000 etp49 0 +Ethernet49 53 50 10000 etp50 0 +Ethernet50 56 51 10000 etp51 0 +Ethernet51 55 52 10000 etp52 0 diff --git a/device/celestica/x86_64-cel_e1031-r0/fancontrol b/device/celestica/x86_64-cel_e1031-r0/fancontrol index a94c63055fd7..27c6dcb78e2c 100644 --- a/device/celestica/x86_64-cel_e1031-r0/fancontrol +++ b/device/celestica/x86_64-cel_e1031-r0/fancontrol @@ -1,12 +1,12 @@ # Configuration file generated by pwmconfig, changes will be lost INTERVAL=2 -DEVPATH=hwmon3=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-23/23-004d/ hwmon2=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-11/11-001a/hwmon/hwmon2 +DEVPATH=hwmon3=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-23/23-004d hwmon2=devices/pci0000:00/0000:00:13.0/i2c-0/i2c-8/i2c-11/11-001a DEVNAME=hwmon3=emc2305 hwmon2=max6697 -FCTEMPS=hwmon3/pwm1=hwmon2/temp2_input hwmon3/pwm2=hwmon2/temp2_input hwmon3/pwm4=hwmon2/temp2_input +FCTEMPS=hwmon3/device/pwm1=hwmon2/temp2_input hwmon3/device/pwm2=hwmon2/temp2_input hwmon3/device/pwm4=hwmon2/temp2_input FCFANS=hwmon3/device/pwm1=hwmon3/device/fan1_input hwmon3/device/pwm2=hwmon3/device/fan2_input hwmon3/device/pwm4=hwmon3/device/fan4_input MINTEMP=hwmon3/device/pwm1=29 hwmon3/device/pwm2=29 hwmon3/device/pwm4=29 MAXTEMP=hwmon3/device/pwm1=44 hwmon3/device/pwm2=44 hwmon3/device/pwm4=44 -MINSTART=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 -MINSTOP=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 -MINPWM=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 +MINSTART=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 +MINSTOP=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 +MINPWM=hwmon3/device/pwm1=102 hwmon3/device/pwm2=102 hwmon3/device/pwm4=102 MAXPWM=hwmon3/device/pwm1=255 hwmon3/device/pwm2=255 hwmon3/device/pwm4=255 diff --git a/device/celestica/x86_64-cel_e1031-r0/plugins/psuutil.py b/device/celestica/x86_64-cel_e1031-r0/plugins/psuutil.py new file mode 100644 index 000000000000..71b8d4ad3c59 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/devices/platform/e1031.smc/" + self.psu_presence = "psu{}_prs" + self.psu_oper_status = "psu{}_status" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + psu_location = ["R", "L"] + status = 0 + try: + with open(self.psu_path + self.psu_oper_status.format(psu_location[index - 1]), 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + psu_location = ["R", "L"] + status = 0 + try: + with open(self.psu_path + self.psu_presence.format(psu_location[index - 1]), 'r') as psu_prs: + status = int(psu_prs.read()) + except IOError: + return False + + return status == 1 diff --git a/device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py b/device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py new file mode 100644 index 000000000000..851fb9ccc071 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python + +try: + import time + import os + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 1 + PORT_END = 52 + port_to_i2c_mapping = { + 1 : None, + 2 : None, + 3 : None, + 4 : None, + 5 : None, + 6 : None, + 7 : None, + 8 : None, + 9 : None, + 10 : None, + 11 : None, + 12 : None, + 13 : None, + 14 : None, + 15 : None, + 16 : None, + 17 : None, + 18 : None, + 19 : None, + 20 : None, + 21 : None, + 22 : None, + 23 : None, + 24 : None, + 25 : None, + 26 : None, + 27 : None, + 28 : None, + 29 : None, + 30 : None, + 31 : None, + 32 : None, + 33 : None, + 34 : None, + 35 : None, + 36 : None, + 37 : None, + 38 : None, + 39 : None, + 40 : None, + 41 : None, + 42 : None, + 43 : None, + 44 : None, + 45 : None, + 46 : None, + 47 : None, + 48 : None, + 49 : 15, + 50 : 14, + 51 : 17, + 52 : 16 + } + _port_to_eeprom_mapping = {} + _sfp_port = range(49, PORT_END + 1) + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return [] + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + 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): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + sfp_modabs_path = '/sys/devices/platform/e1031.smc/SFP/SFP{0}/sfp_modabs' + + if port_num not in self._sfp_port: + return False + + status = 1 + try: + with open(sfp_modabs_path.format(port_num - 48), 'r') as port_status: + status = int(port_status.read()) + except IOError: + return False + + return status == 0 + + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + raise NotImplementedError + + def reset(self, port_num): + raise NotImplementedError + + def get_transceiver_change_event(self): + raise NotImplementedError diff --git a/device/celestica/x86_64-cel_e1031-r0/sensors.conf b/device/celestica/x86_64-cel_e1031-r0/sensors.conf index 1874548cff64..25c6047137b6 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sensors.conf +++ b/device/celestica/x86_64-cel_e1031-r0/sensors.conf @@ -1,12 +1,33 @@ -# libsensors configuration file for Celestica DX010. +# libsensors configuration file for Celestica E1031. # The i2c bus portion is omit because adapter name # changes every time when system boot up. -chip "max6697-i2c-*-1a" - label temp1 "temp sensor 1" - label temp2 "temp sensor 2" - label temp3 "temp sensor 3" - label temp4 "temp sensor 4" - label temp5 "temp sensor 5" - ignore temp6 - ignore temp7 +bus "i2c-3" "i2c-0-mux (chan_id 1)" +bus "i2c-11" "i2c-8-mux (chan_id 1)" + +chip "max6697-i2c-3-1a" + label temp1 "CPU board temperature sensor : 1" + label temp2 "CPU board temperature sensor : 2" + label temp3 "CPU board temperature sensor : 3" + ignore temp4 + ignore temp5 + ignore temp6 + ignore temp7 + +chip "max6697-i2c-11-1a" + label temp1 "Main board temperature sensor : 1" + label temp2 "Main board temperature sensor : 2" + label temp3 "Main board temperature sensor : 3" + label temp4 "Main board temperature sensor : 4" + label temp5 "Main board temperature sensor : 5" + ignore temp6 + ignore temp7 + + +chip "emc2305-i2c-*-4d" + ignore fan3 + ignore fan5 + label fan4 "Fan 1 :" + label fan2 "Fan 2 :" + label fan1 "Fan 3 :" + diff --git a/platform/broadcom/platform-modules-cel.mk b/platform/broadcom/platform-modules-cel.mk index 9226d9246308..1224faaa6750 100644 --- a/platform/broadcom/platform-modules-cel.mk +++ b/platform/broadcom/platform-modules-cel.mk @@ -1,7 +1,7 @@ # Celestica DX010 and Haliburton Platform modules -CEL_DX010_PLATFORM_MODULE_VERSION = 0.8 -CEL_HALIBURTON_PLATFORM_MODULE_VERSION = 0.8 +CEL_DX010_PLATFORM_MODULE_VERSION = 0.9 +CEL_HALIBURTON_PLATFORM_MODULE_VERSION = 0.9 export CEL_DX010_PLATFORM_MODULE_VERSION export CEL_HALIBURTON_PLATFORM_MODULE_VERSION diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/changelog b/platform/broadcom/sonic-platform-modules-cel/debian/changelog index 64f2decf2677..843b028e4301 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/changelog +++ b/platform/broadcom/sonic-platform-modules-cel/debian/changelog @@ -1,8 +1,15 @@ +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 haliburton platform + * Add dx010 platform fan led control. + * The platform gpio init moved to kernel space. - -- Supakit Fuangkaew Thu, 5 Apr 2018 09:09:09 +0700 + -- Pradchaya Phucharoen Mon, 1 Jul 2018 11:09:13 +0700 sonic-cel-platform-modules (0.7) unstable; urgency=low diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init index 08770d1d64f6..66f1ee5529c2 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init @@ -15,10 +15,8 @@ case "$1" in start) echo -n "Setting up board... " - depmod -a - modprobe i2c-dev - modprobe i2c-mux-pca954x - + modprobe smc + found=0 for devnum in 0 1; do devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name` @@ -56,15 +54,11 @@ start) # Attach fans echo emc2305 0x4d > /sys/bus/i2c/devices/i2c-23/new_device - # Attach PSUs - echo dps200 0x5a > /sys/bus/i2c/devices/i2c-12/new_device - echo dps200 0x5b > /sys/bus/i2c/devices/i2c-13/new_device - - # Attach 4 SFP+ Uplink - echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-14/new_device - echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-15/new_device - echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-16/new_device - echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-17/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 echo "done." ;; diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install index 464b77855f95..93b2eed633d1 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install @@ -1 +1,2 @@ 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 new file mode 100644 index 000000000000..bdc23c66d5a4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.postinst @@ -0,0 +1,3 @@ +depmod -a +systemctl enable platform-modules-haliburton.service +systemctl start platform-modules-haliburton.service diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile index 6d0c489154c2..58e2b0bf2d7a 100644 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/Makefile @@ -1 +1 @@ -obj-m := mc24lc64t.o emc2305.o +obj-m := mc24lc64t.o emc2305.o smc.o diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c new file mode 100644 index 000000000000..82abc9e8ea1f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c @@ -0,0 +1,777 @@ +/* + * 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 STATUS + * [7:4] RESERVED + * [3:0] TX_FAULT / MODABS / RXLOS + */ +#define SFP_TXFAULT 0x0242 +#define SFP_MODABS 0x0243 +#define SFP_RXLOS 0x0244 + +/* 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; +} + +/** + * 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"); +} + +/** + * 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; +} + +/** + * 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"); +} + +/** + * 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; + + // Use index to determind the status bit + 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; + struct sfp_device_data *dev_data = dev_get_drvdata(dev); + unsigned int port_bit = dev_data->portid - 1; + + mutex_lock(&cpld_data->cpld_lock); + data = inb(SFP_TXFAULT); + mutex_unlock(&cpld_data->cpld_lock); + return sprintf(buf, "%d\n", (data >> port_bit ) & 1U); +} + +static ssize_t sfp_modabs_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + unsigned char data; + struct sfp_device_data *dev_data = dev_get_drvdata(dev); + unsigned int port_bit = dev_data->portid - 1; + + mutex_lock(&cpld_data->cpld_lock); + data = inb(SFP_MODABS); + mutex_unlock(&cpld_data->cpld_lock); + return sprintf(buf, "%d\n", (data >> port_bit ) & 1U); +} + +static ssize_t sfp_rxlos_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + unsigned char data; + struct sfp_device_data *dev_data = dev_get_drvdata(dev); + unsigned int port_bit = dev_data->portid - 1; + + mutex_lock(&cpld_data->cpld_lock); + data = inb(SFP_RXLOS); + mutex_unlock(&cpld_data->cpld_lock); + return sprintf(buf, "%d\n", (data >> port_bit ) & 1U); +} + +static ssize_t sfp_txdis_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + unsigned char data; + struct sfp_device_data *dev_data = dev_get_drvdata(dev); + unsigned int port_bit = dev_data->portid - 1; + mutex_lock(&cpld_data->cpld_lock); + data = inb(SFP_TXCTRL); + mutex_unlock(&cpld_data->cpld_lock); + return sprintf(buf, "%d\n", (data >> port_bit ) & 1U); +} + +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; + struct sfp_device_data *dev_data = dev_get_drvdata(dev); + unsigned int port_bit = dev_data->portid - 1; + + mutex_lock(&cpld_data->cpld_lock); + status = kstrtol(buf, 0, &value); + if (status == 0) { + // check if value is 0, clear + data = inb(SFP_TXCTRL); + if (!value) + data = data & ~( 1U << port_bit); + else + data = data | ( 1U << port_bit); + 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; + struct sfp_device_data *dev_data = dev_get_drvdata(dev); + unsigned int port_bit = dev_data->portid - 1; + + // High nibble + port_bit = port_bit + 4; + mutex_lock(&cpld_data->cpld_lock); + data = inb(SFP_TXCTRL); + mutex_unlock(&cpld_data->cpld_lock); + return sprintf(buf, "%d\n", (data >> port_bit ) & 1U); +} + +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; + struct sfp_device_data *dev_data = dev_get_drvdata(dev); + unsigned int port_bit = dev_data->portid - 1; + + // High nibble + port_bit = port_bit + 4; + mutex_lock(&cpld_data->cpld_lock); + status = kstrtol(buf, 0, &value); + if (status == 0) { + // check if value is 0, clear + data = inb(SFP_TXCTRL); + if (!value) + data = data & ~( 1U << port_bit); + else + data = data | ( 1U << port_bit); + outb(data, SFP_TXCTRL); + status = size; + } + mutex_unlock(&cpld_data->cpld_lock); + 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 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, + NULL, +}; + +ATTRIBUTE_GROUPS(sfp); + +static struct resource cpld_resources[] = { + { + .start = 0x0200, + .end = 0x0255, + .flags = IORESOURCE_IO, + }, +}; + +static struct device * sfp_init(int portid) { + struct sfp_device_data *new_data; + struct device *new_device; + + new_data = kzalloc(sizeof(*new_data), GFP_KERNEL); + if (!new_data) { + printk(KERN_ALERT "Cannot alloc sff device data @port%d", portid); + return NULL; + } + /* Front panel port ID start from 1 */ + new_data->portid = portid + 1; + new_device = device_create_with_groups(celplatform, cpld_data->fpp_node, MKDEV(0, 0), new_data, sfp_groups, "SFP%d", new_data->portid); + if (IS_ERR(new_device)) { + printk(KERN_ALERT "Cannot create sff device @port%d", portid); + kfree(new_data); + return NULL; + } + return new_device; +} + +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, i = 0; + + 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(celplatform, NULL, MKDEV(0, 0), NULL, "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; + } + + // Creae SFP devices + for ( i = 0; i < 4; i++) { + cpld_data->sfp_devices[i] = sfp_init(i); + } + + // Clear all reset signals + outb(0xFF, SPR_RESET); + return 0; +} + +static int cpld_drv_remove(struct platform_device *pdev) +{ + struct sfp_device_data *rem_data; + int i; + + for ( i = 0; i < 4; i++ ) { + rem_data = dev_get_drvdata(cpld_data->sfp_devices[i]); + put_device(cpld_data->sfp_devices[i]); + device_unregister(cpld_data->sfp_devices[i]); + kzfree(rem_data); + } + put_device(cpld_data->fpp_node); + device_unregister(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("0.0.3"); +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 new file mode 100644 index 000000000000..bf1295038856 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/systemd/platform-modules-haliburton.service @@ -0,0 +1,14 @@ + +[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 From ad5b14cd3c314f76ac577ad4a27ae590a6aea15f Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 23 Aug 2018 19:11:53 -0700 Subject: [PATCH 1584/1833] [vs]: Add pip install six (#1978) sonic-utilities requires six Signed-off-by: Shu0T1an ChenG --- platform/vs/docker-sonic-vs/Dockerfile.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index ded75caff524..a7cccfd60a3b 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -46,6 +46,7 @@ RUN apt-get install -y net-tools \ RUN pip install setuptools RUN pip install py2_ipaddress +RUN pip install six {% if docker_sonic_vs_debs.strip() -%} # Copy locally-built Debian package dependencies From 83f0822ddee386c931a4fa783295ac307af21d7f Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 24 Aug 2018 10:33:56 -0700 Subject: [PATCH 1585/1833] [build]: run docker info at later stage in the build (#1984) wait till docker service started Signed-off-by: Guohan Lu --- files/build_templates/sonic_debian_extension.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 9a4af3c3c637..318c83f5f218 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -45,7 +45,6 @@ sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs sudo bash -c "echo \"DOCKER_OPTS=\"--storage-driver=overlay\"\" >> $FILESYSTEM_ROOT/etc/default/docker" sudo chroot $FILESYSTEM_ROOT service docker start -sudo chroot $FILESYSTEM_ROOT docker info # Apply apt configuration files sudo cp $IMAGE_CONFIGS/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ @@ -273,6 +272,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/tcpd_*_amd64.deb || \ sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/ {% if installer_images.strip() -%} +sudo chroot $FILESYSTEM_ROOT docker info {% for image in installer_images.strip().split(' ') -%} {% set imagefilename = image.split('/')|last -%} {% set imagename = imagefilename.split('.')|first -%} From 02322182fc09e4a95dc7edbe8d0e7997bf23b82f Mon Sep 17 00:00:00 2001 From: cpchang Date: Sat, 25 Aug 2018 05:05:19 +0800 Subject: [PATCH 1586/1833] [Quanta/device] Modify psuutil.py and config.bcm of IX1B (#1985) * Fix LED activity behavior * Modify psuutil.py and config.bcm of IX1B --- .../th-ix1b-32x100G.config.bcm | 7 ++- .../plugins/psuutil.py | 57 +++++++++---------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm b/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm index f73d5be55cd4..051b8ed71e8e 100644 --- a/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm +++ b/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm @@ -12,8 +12,11 @@ parity_enable=1 # Control to disable parity correction parity_correction=1 -l2_mem_entries=<40960> -l3_mem_entries=<40960> +ipv6_lpm_128b_enable=1 +l3_alpm_enable=2 + +l2_mem_entries=40960 +l3_mem_entries=40960 portmap_1=1:100 portmap_2=5:100 diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/psuutil.py b/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/psuutil.py index 5b12ba41c9ad..1986aa846c5e 100755 --- a/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/psuutil.py +++ b/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/psuutil.py @@ -5,7 +5,7 @@ import os.path -import commands +import subprocess import logging try: @@ -17,59 +17,58 @@ def show_log(txt): if DEBUG == True: - print "[IX1B]"+txt + print("[IX2]"+txt) return def exec_cmd(cmd, show): logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) - show_log (cmd +"with result:" + str(status)) - show_log (" output:"+output) - if status: - logging.info('Failed :'+cmd) + try: + output = subprocess.check_output(cmd, shell=True) + show_log (cmd +"output:"+str(output)) + except subprocess.CalledProcessError as e: + logging.info("Failed :"+cmd) if show: - print('Failed :'+cmd) - return status, output + print("Failed :"+cmd +"returncode = {}, err msg: {}".format(e.returncode, e.output)) + return output def my_log(txt): if DEBUG == True: - print "[QUANTA DBG]: "+txt + print("[QUANTA DBG]: "+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) status = 1 output = "" - status, output = commands.getstatusoutput(cmd) - my_log (cmd +"with result:" + str(status)) - my_log ("cmd:" + cmd) - my_log (" output:"+output) - if status: + try: + output = subprocess.check_output(cmd, shell=True) + my_log (cmd +"output:"+str(output)) + except subprocess.CalledProcessError as e: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) - return status, output + print("Failed :"+cmd +"returncode = {}, err msg: {}".format(e.returncode, e.output)) + return output def gpio16_exist(): - ret, ls = log_os_system("ls /sys/class/gpio/ | grep gpio16", 0) + ls = log_os_system("ls /sys/class/gpio/ | grep gpio16", 0) logging.info('mods:'+ls) if len(ls) ==0: return False def gpio17_exist(): - ret, ls = log_os_system("ls /sys/class/gpio/ | grep gpio17", 0) + ls = log_os_system("ls /sys/class/gpio/ | grep gpio17", 0) logging.info('mods:'+ls) if len(ls) ==0: return False def gpio19_exist(): - ret, ls = log_os_system("ls /sys/class/gpio/ | grep gpio19", 0) + ls = log_os_system("ls /sys/class/gpio/ | grep gpio19", 0) logging.info('mods:'+ls) if len(ls) ==0: return False def gpio20_exist(): - ret, ls = log_os_system("ls /sys/class/gpio/ | grep gpio20", 0) + ls = log_os_system("ls /sys/class/gpio/ | grep gpio20", 0) logging.info('mods:'+ls) if len(ls) ==0: return False @@ -86,20 +85,20 @@ def __init__(self): PsuBase.__init__(self) if gpio16_exist() == False: - status, output = exec_cmd("echo 16 > /sys/class/gpio/export ", 1) - status, output = exec_cmd("echo in > /sys/class/gpio/gpio16/direction ", 1) + output = exec_cmd("echo 16 > /sys/class/gpio/export ", 1) + output = exec_cmd("echo in > /sys/class/gpio/gpio16/direction ", 1) if gpio17_exist() == False: - status, output = exec_cmd("echo 17 > /sys/class/gpio/export ", 1) - status, output = exec_cmd("echo in > /sys/class/gpio/gpio17/direction ", 1) + output = exec_cmd("echo 17 > /sys/class/gpio/export ", 1) + output = exec_cmd("echo in > /sys/class/gpio/gpio17/direction ", 1) if gpio19_exist() == False: - status, output = exec_cmd("echo 19 > /sys/class/gpio/export ", 1) - status, output = exec_cmd("echo in > /sys/class/gpio/gpio19/direction ", 1) + output = exec_cmd("echo 19 > /sys/class/gpio/export ", 1) + output = exec_cmd("echo in > /sys/class/gpio/gpio19/direction ", 1) if gpio20_exist() == False: - status, output = exec_cmd("echo 20 > /sys/class/gpio/export ", 1) - status, output = exec_cmd("echo in > /sys/class/gpio/gpio20/direction ", 1) + output = exec_cmd("echo 20 > /sys/class/gpio/export ", 1) + output = exec_cmd("echo in > /sys/class/gpio/gpio20/direction ", 1) # Get sysfs attribute def get_attr_value(self, attr_path): From 1157dbb4f52924da8e30dc678abf467f3b135c10 Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Sat, 25 Aug 2018 01:02:35 -0700 Subject: [PATCH 1587/1833] [arista]: Update arista submodule to fix transceiver event (#1986) --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 4904fbd01e6a..1133dc7c957b 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 4904fbd01e6a4547c404d3694139b36e716cfe31 +Subproject commit 1133dc7c957bcca5305aab5abf569d0d90605aa4 diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 4904fbd01e6a..1133dc7c957b 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 4904fbd01e6a4547c404d3694139b36e716cfe31 +Subproject commit 1133dc7c957bcca5305aab5abf569d0d90605aa4 From 3f37b96de66ca26973227ab40426840e131190da Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Sat, 25 Aug 2018 01:39:09 -0700 Subject: [PATCH 1588/1833] [swss]: Add support for swss docker warm restart (#1982) Signed-off-by: Jipan Yang --- files/scripts/swss.sh | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index de46c0fbe7fc..0873deb37c8e 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -2,10 +2,29 @@ start() { # Wait for redis server start before database clean - until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; + 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 + + SYSTEM_WARM_START=`/usr/bin/docker exec database redis-cli -n 4 HGET "WARM_RESTART|system" enable` + SWSS_WARM_START=`/usr/bin/docker exec database redis-cli -n 4 HGET "WARM_RESTART|swss" enable` + # if warm start enabled, just do swss docker start. + # Don't flush DB or try to start other modules. + if [[ "$SYSTEM_WARM_START" == "true" ]] || [[ "$SWSS_WARM_START" == "true" ]]; then + RESTART_COUNT=`redis-cli -n 6 hget "WARM_RESTART_TABLE|orchagent" restart_count` + # We have to make sure db data has not been flushed. + if [[ -n "$RESTART_COUNT" ]]; then + /usr/bin/swss.sh start + /usr/bin/swss.sh attach + return 0 + fi + fi + # Flush DB /usr/bin/docker exec database redis-cli -n 0 FLUSHDB /usr/bin/docker exec database redis-cli -n 1 FLUSHDB @@ -25,14 +44,22 @@ start() { /etc/init.d/xpnet.sh start fi - # start swss and syncd docker - /usr/bin/swss.sh start + # start swss and syncd docker + /usr/bin/swss.sh start /usr/bin/syncd.sh start /usr/bin/swss.sh attach } stop() { /usr/bin/swss.sh stop + + SYSTEM_WARM_START=`redis-cli -n 4 hget "WARM_RESTART|system" enable` + SWSS_WARM_START=`redis-cli -n 4 hget "WARM_RESTART|swss" enable` + # if warm start enabled, just stop swss docker, then return + if [[ "$SYSTEM_WARM_START" == "true" ]] || [[ "$SWSS_WARM_START" == "true" ]]; then + return 0 + fi + /usr/bin/syncd.sh stop # platform specific tasks From f85a75c8112193654bbcf017eec241b64b20ddf5 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 28 Aug 2018 14:40:01 -0700 Subject: [PATCH 1589/1833] [debian]: Enable keep_addr_on_down to keep IPv6 addresses (#1992) Starting from kernel 4.6, this new attribute keep_addr_on_down is introduced (https://kernelnewbies.org/Linux_4.6). If set, static global addresses with no expiration time are not flushed. Ref: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f1705ec197e705b79ea40fe7a2cc5acfa1d3bfac Signed-off-by: Shu0T1an ChenG --- build_debian.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index 28493ea16877..e893b9df403a 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -318,6 +318,10 @@ set /files/etc/sysctl.conf/net.ipv6.conf.default.accept_dad 0 set /files/etc/sysctl.conf/net.ipv6.conf.all.accept_dad 0 set /files/etc/sysctl.conf/net.ipv6.conf.eth0.accept_dad 0 +set /files/etc/sysctl.conf/net.ipv6.conf.default.keep_addr_on_down 1 +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.core.rmem_max 2097152 From 929ef530ce1dfa4050615dd8057e3458b50e441e Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 29 Aug 2018 11:12:47 +0300 Subject: [PATCH 1590/1833] [mellanox]: Update SAI, SDK, FW pointers (#1996) * SAI v1.12.3 (API headers v1.3.3) * SDK v4.2.8300 * FW v13.1703.0000 Signed-off-by: Volodymyr Samotiy --- platform/mellanox/fw.mk | 2 +- platform/mellanox/mlnx-sai.mk | 4 ++-- platform/mellanox/sdk.mk | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 579c5e5e4986..4b778b08ae00 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1701.0008 +MLNX_FW_VERSION = 13.1703.0000 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/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index f2bb52a7b5e0..1689b43d5779 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.12.1-master -MLNX_SAI_REVISION = 08749ea08d4e4e4f8611bb1e29fe16a5914eef31 +MLNX_SAI_VERSION = SAIRel1.12.3-master +MLNX_SAI_REVISION = 71ae8c6d386f57a89742fc3261775b338bfc9c25 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index a667005bc6c0..c8f80e94f914 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/16e0822d7077d8558e6ff92b3c6650df17a88219/sdk -MLNX_SDK_VERSION = 4.2.8103 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/71ae8c6d386f57a89742fc3261775b338bfc9c25/sdk +MLNX_SDK_VERSION = 4.2.8300 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) From e8db1846adf050ab8238ffcba9dd2a6f7b78a672 Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Wed, 29 Aug 2018 22:50:29 +0700 Subject: [PATCH 1591/1833] [platform-device/haliburton] Support xcvr and sensor monitoring (#1998) * [platform/haliburton] Fix kernel panic when remove smc module. * [platform/haliburton] Chanage sysfs to support module interrupt * [device/haliburton] Update sfputil to use new sysfs. * [device/haliburton] sfputil to support xcvrd monitoring. --- .../x86_64-cel_e1031-r0/plugins/sfputil.py | 138 +++--- .../debian/platform-modules-haliburton.init | 4 + .../haliburton/modules/smc.c | 426 ++++++++++++++---- 3 files changed, 423 insertions(+), 145 deletions(-) diff --git a/device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py b/device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py index 851fb9ccc071..5e7d287ef543 100644 --- a/device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py +++ b/device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py @@ -14,58 +14,58 @@ class SfpUtil(SfpUtilBase): PORT_START = 1 PORT_END = 52 port_to_i2c_mapping = { - 1 : None, - 2 : None, - 3 : None, - 4 : None, - 5 : None, - 6 : None, - 7 : None, - 8 : None, - 9 : None, - 10 : None, - 11 : None, - 12 : None, - 13 : None, - 14 : None, - 15 : None, - 16 : None, - 17 : None, - 18 : None, - 19 : None, - 20 : None, - 21 : None, - 22 : None, - 23 : None, - 24 : None, - 25 : None, - 26 : None, - 27 : None, - 28 : None, - 29 : None, - 30 : None, - 31 : None, - 32 : None, - 33 : None, - 34 : None, - 35 : None, - 36 : None, - 37 : None, - 38 : None, - 39 : None, - 40 : None, - 41 : None, - 42 : None, - 43 : None, - 44 : None, - 45 : None, - 46 : None, - 47 : None, - 48 : None, - 49 : 15, - 50 : 14, - 51 : 17, - 52 : 16 + 1: None, + 2: None, + 3: None, + 4: None, + 5: None, + 6: None, + 7: None, + 8: None, + 9: None, + 10: None, + 11: None, + 12: None, + 13: None, + 14: None, + 15: None, + 16: None, + 17: None, + 18: None, + 19: None, + 20: None, + 21: None, + 22: None, + 23: None, + 24: None, + 25: None, + 26: None, + 27: None, + 28: None, + 29: None, + 30: None, + 31: None, + 32: None, + 33: None, + 34: None, + 35: None, + 36: None, + 37: None, + 38: None, + 39: None, + 40: None, + 41: None, + 42: None, + 43: None, + 44: None, + 45: None, + 46: None, + 47: None, + 48: None, + 49: 15, + 50: 14, + 51: 17, + 52: 16 } _port_to_eeprom_mapping = {} _sfp_port = range(49, PORT_END + 1) @@ -94,30 +94,42 @@ def __init__(self): self.port_to_eeprom_mapping[x] = port_eeprom_path SfpUtilBase.__init__(self) + def get_presence(self, port_num): - sfp_modabs_path = '/sys/devices/platform/e1031.smc/SFP/SFP{0}/sfp_modabs' + sfp_modabs_path = '/sys/devices/platform/e1031.smc/SFP/sfp_modabs' if port_num not in self._sfp_port: return False - + status = 1 try: - with open(sfp_modabs_path.format(port_num - 48), 'r') as port_status: - status = int(port_status.read()) - except IOError: + with open(sfp_modabs_path, 'r') as port_status: + status = int(port_status.read(), 16) + status = (status >> (port_num - 49)) & 1 + except IOError: return False return status == 0 - def get_low_power_mode(self, port_num): - raise NotImplementedError + raise NotImplementedError def set_low_power_mode(self, port_num, lpmode): - raise NotImplementedError + raise NotImplementedError def reset(self, port_num): - raise NotImplementedError - - def get_transceiver_change_event(self): raise NotImplementedError + + def get_transceiver_change_event(self, timeout=0): + modabs_interrupt_path = '/sys/devices/platform/e1031.smc/SFP/modabs_int' + ports_evt = {} + try: + with open(modabs_interrupt_path, 'r') as port_changes: + changes = int(port_changes.read(), 16) + for port_num in self._sfp_port: + change = (changes >> ( port_num - 49)) & 1 + if change == 1: + ports_evt[str(port_num)] = str(self.get_presence(port_num)) + except IOError: + return False, {} + return True, ports_evt diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init index 66f1ee5529c2..5192b202a3f9 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init @@ -60,6 +60,10 @@ start) 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." ;; diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c index 82abc9e8ea1f..7b8d410cdd2b 100644 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c @@ -116,6 +116,22 @@ enum MASTER_LED { #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 @@ -124,6 +140,24 @@ enum MASTER_LED { #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 @@ -250,7 +284,7 @@ static ssize_t setreg_store(struct device *dev, struct device_attribute *devattr } /** - * Show status led + * @brief Show status led * @param dev kernel device * @param devattr kernel device attribute * @param buf buffer for get value @@ -269,7 +303,7 @@ static ssize_t status_led_show(struct device *dev, struct device_attribute *deva } /** - * Set the status led + * @brief Set the status led * @param dev kernel device * @param devattr kernel device attribute * @param buf buffer of set value - off/on/blink @@ -301,7 +335,7 @@ static ssize_t status_led_store(struct device *dev, struct device_attribute *dev } /** - * Show master led + * @brief Show master led * @param dev kernel device * @param devattr kernel device attribute * @param buf buffer for get value @@ -320,7 +354,7 @@ static ssize_t master_led_show(struct device *dev, struct device_attribute *deva } /** - * Set the master led + * @brief Set the master led * @param dev kernel device * @param devattr kernel device attribute * @param buf buffer of set value - off/green/amber @@ -401,8 +435,6 @@ static ssize_t fan_dir_show(struct device *dev, struct device_attribute *devattr struct sensor_device_attribute *sa = to_sensor_dev_attr(devattr); int index = sa->index; unsigned char data = 0; - - // Use index to determind the status bit mutex_lock(&cpld_data->cpld_lock); data = inb(DEV_STAT); mutex_unlock(&cpld_data->cpld_lock); @@ -413,48 +445,41 @@ static ssize_t fan_dir_show(struct device *dev, struct device_attribute *devattr static ssize_t sfp_txfault_show(struct device *dev, struct device_attribute *attr, char *buf) { unsigned char data; - struct sfp_device_data *dev_data = dev_get_drvdata(dev); - unsigned int port_bit = dev_data->portid - 1; - mutex_lock(&cpld_data->cpld_lock); data = inb(SFP_TXFAULT); + data = data & 0x0F; mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%d\n", (data >> port_bit ) & 1U); + 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; - struct sfp_device_data *dev_data = dev_get_drvdata(dev); - unsigned int port_bit = dev_data->portid - 1; - mutex_lock(&cpld_data->cpld_lock); data = inb(SFP_MODABS); + data = data & 0x0F; mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%d\n", (data >> port_bit ) & 1U); + 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; - struct sfp_device_data *dev_data = dev_get_drvdata(dev); - unsigned int port_bit = dev_data->portid - 1; - mutex_lock(&cpld_data->cpld_lock); data = inb(SFP_RXLOS); + data = data & 0x0F; mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%d\n", (data >> port_bit ) & 1U); + 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; - struct sfp_device_data *dev_data = dev_get_drvdata(dev); - unsigned int port_bit = dev_data->portid - 1; mutex_lock(&cpld_data->cpld_lock); data = inb(SFP_TXCTRL); + data = data & 0x0F; mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%d\n", (data >> port_bit ) & 1U); + 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) @@ -462,18 +487,13 @@ static ssize_t sfp_txdis_store(struct device *dev, struct device_attribute *attr long value; ssize_t status; unsigned char data; - struct sfp_device_data *dev_data = dev_get_drvdata(dev); - unsigned int port_bit = dev_data->portid - 1; mutex_lock(&cpld_data->cpld_lock); status = kstrtol(buf, 0, &value); if (status == 0) { - // check if value is 0, clear data = inb(SFP_TXCTRL); - if (!value) - data = data & ~( 1U << port_bit); - else - data = data | ( 1U << port_bit); + data = data & ~(0x0F); + data = data | (value & 0x0F); outb(data, SFP_TXCTRL); status = size; } @@ -484,15 +504,11 @@ static ssize_t sfp_txdis_store(struct device *dev, struct device_attribute *attr static ssize_t sfp_rs_show(struct device *dev, struct device_attribute *attr, char *buf) { unsigned char data; - struct sfp_device_data *dev_data = dev_get_drvdata(dev); - unsigned int port_bit = dev_data->portid - 1; - - // High nibble - port_bit = port_bit + 4; mutex_lock(&cpld_data->cpld_lock); - data = inb(SFP_TXCTRL); + data = inb(SFP_TXCTRL) >> 4; + data = data & 0x0F; mutex_unlock(&cpld_data->cpld_lock); - return sprintf(buf, "%d\n", (data >> port_bit ) & 1U); + 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) @@ -500,20 +516,14 @@ static ssize_t sfp_rs_store(struct device *dev, struct device_attribute *attr, c long value; ssize_t status; unsigned char data; - struct sfp_device_data *dev_data = dev_get_drvdata(dev); - unsigned int port_bit = dev_data->portid - 1; - // High nibble - port_bit = port_bit + 4; mutex_lock(&cpld_data->cpld_lock); status = kstrtol(buf, 0, &value); + value = (value & 0x0F) << 4; if (status == 0) { - // check if value is 0, clear data = inb(SFP_TXCTRL); - if (!value) - data = data & ~( 1U << port_bit); - else - data = data | ( 1U << port_bit); + data = data & ~(0xF0); + data = data | value; outb(data, SFP_TXCTRL); status = size; } @@ -521,6 +531,273 @@ static ssize_t sfp_rs_store(struct device *dev, struct device_attribute *attr, c 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) { @@ -578,6 +855,15 @@ 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); @@ -619,6 +905,15 @@ static struct attribute *sfp_attrs[] = { &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, }; @@ -632,26 +927,6 @@ static struct resource cpld_resources[] = { }, }; -static struct device * sfp_init(int portid) { - struct sfp_device_data *new_data; - struct device *new_device; - - new_data = kzalloc(sizeof(*new_data), GFP_KERNEL); - if (!new_data) { - printk(KERN_ALERT "Cannot alloc sff device data @port%d", portid); - return NULL; - } - /* Front panel port ID start from 1 */ - new_data->portid = portid + 1; - new_device = device_create_with_groups(celplatform, cpld_data->fpp_node, MKDEV(0, 0), new_data, sfp_groups, "SFP%d", new_data->portid); - if (IS_ERR(new_device)) { - printk(KERN_ALERT "Cannot create sff device @port%d", portid); - kfree(new_data); - return NULL; - } - return new_device; -} - static void cpld_dev_release( struct device * dev) { return; @@ -670,7 +945,7 @@ static struct platform_device cpld_dev = { static int cpld_drv_probe(struct platform_device *pdev) { struct resource *res; - int err, i = 0; + int err; cpld_data = devm_kzalloc(&pdev->dev, sizeof(struct cpld_data), GFP_KERNEL); @@ -700,7 +975,8 @@ static int cpld_drv_probe(struct platform_device *pdev) return PTR_ERR(celplatform); } - cpld_data->fpp_node = device_create(celplatform, NULL, MKDEV(0, 0), NULL, "optical_ports"); + 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); @@ -716,11 +992,6 @@ static int cpld_drv_probe(struct platform_device *pdev) return err; } - // Creae SFP devices - for ( i = 0; i < 4; i++) { - cpld_data->sfp_devices[i] = sfp_init(i); - } - // Clear all reset signals outb(0xFF, SPR_RESET); return 0; @@ -728,17 +999,8 @@ static int cpld_drv_probe(struct platform_device *pdev) static int cpld_drv_remove(struct platform_device *pdev) { - struct sfp_device_data *rem_data; - int i; - - for ( i = 0; i < 4; i++ ) { - rem_data = dev_get_drvdata(cpld_data->sfp_devices[i]); - put_device(cpld_data->sfp_devices[i]); - device_unregister(cpld_data->sfp_devices[i]); - kzfree(rem_data); - } - put_device(cpld_data->fpp_node); 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; @@ -773,5 +1035,5 @@ module_exit(cpld_exit); MODULE_AUTHOR("Celestica Inc."); MODULE_DESCRIPTION("Celestica E1031 SMC driver"); -MODULE_VERSION("0.0.3"); +MODULE_VERSION("1.0.0"); MODULE_LICENSE("GPL"); From 90f6881e08eb637a896ce47dc1e1c0aac79d4e4e Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Wed, 29 Aug 2018 18:51:02 +0300 Subject: [PATCH 1592/1833] [mellanox] Enhance mlnx-fw-upgrade.sh (#1994) Install a new FW by specifying FW path (mlnx-fw-upgrade.sh /path/to/FW) or use default at '/etc/mlnx/fw-SPC.mfa' Signed-off-by: Stepan Blyschak --- platform/mellanox/mlnx-fw-upgrade.j2 | 65 ++++++++++++++++++---------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/platform/mellanox/mlnx-fw-upgrade.j2 b/platform/mellanox/mlnx-fw-upgrade.j2 index ec002497ebd8..4e7a4a77b6aa 100755 --- a/platform/mellanox/mlnx-fw-upgrade.j2 +++ b/platform/mellanox/mlnx-fw-upgrade.j2 @@ -23,25 +23,46 @@ while [[ (${query_retry_count} -lt ${query_retry_count_max}) && ($? -ne "0") ]]; ${query_cmd} > /dev/null done -run_or_fail "${query_cmd}" > /tmp/mlnxfwmanager-query.txt - -# get current firmware version and required version -fw_info=$(grep FW /tmp/mlnxfwmanager-query.txt) -fw_current=$(echo $fw_info | cut -f2 -d' ') - -if [[ -z ${fw_current} ]]; then - echo "Could not retreive current FW version." - exit 1 -fi - -if [[ -z ${fw_required} ]]; then - echo "Could not retreive required FW version." - exit 1 -fi - -if [[ ${fw_current} == ${fw_required} ]]; then - echo "Mellanox firmware is up to date." -else - echo "Mellanox firmware required version is ${fw_required}. Installing compatible version..." - run_or_fail "mlxfwmanager -i ${fw_file} -u -f -y" -fi +function upgrade() { + if [ ! -z "$1" ]; then + fw_file="$1" + if [ ! -f "$fw_file" ]; then + >&2 echo "No such file: $fw_file" + exit 1 + fi + + run_or_fail "${query_cmd} -i ${fw_file}" > /tmp/mlnxfwmanager-query.txt + + # get current firmware version and available version from $fw_file + fw_info=$(grep FW /tmp/mlnxfwmanager-query.txt) + fw_current=$(echo $fw_info | cut -f2 -d' ') + fw_available=$(echo $fw_info | cut -f3 -d' ') + + fw_required=$fw_available + else + run_or_fail "${query_cmd}" > /tmp/mlnxfwmanager-query.txt + + # get current firmware version and required version + fw_info=$(grep FW /tmp/mlnxfwmanager-query.txt) + fw_current=$(echo $fw_info | cut -f2 -d' ') + fi + + if [[ -z ${fw_current} ]]; then + echo "Could not retreive current FW version." + exit 1 + fi + + if [[ -z ${fw_required} ]]; then + echo "Could not retreive required FW version." + exit 1 + fi + + if [[ ${fw_current} == ${fw_required} ]]; then + echo "Mellanox firmware is up to date." + else + echo "Mellanox firmware required version is ${fw_required}. Installing compatible version..." + run_or_fail "mlxfwmanager -i ${fw_file} -u -f -y" + fi +} + +upgrade "$1" From c1ef5becadb27335c1c076907f12036dc33a4c62 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 29 Aug 2018 22:26:44 -0700 Subject: [PATCH 1593/1833] [submodules]: swss vxlan support (#2000) --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 8bfdea086f14..58a644794a26 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 8bfdea086f14bbe420846d42c607760999cbdcc3 +Subproject commit 58a644794a2650599e1102425f3903f56ff53835 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 5a89b1e8be0c..90855e07dffa 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 5a89b1e8be0c6960031697d134db3a5276c93b30 +Subproject commit 90855e07dffa996d6f0ece6d728c41dbc4f83e60 From 0d75b2ac45d2de05d70d3add03bd45544c41b3bd Mon Sep 17 00:00:00 2001 From: Rodny Molina Date: Thu, 30 Aug 2018 05:18:06 -0700 Subject: [PATCH 1594/1833] Deleting stretch-branch pointer from .gitmodules (#2003) Removing .gitmodules pointer to inexistent linux-kernel branch. rmolina-mn1:sonic-buildimage rmolina$ git submodule update --recursive --remote .. fatal: Needed a single revision Unable to find current origin/stretch revision in submodule path 'src/sonic-linux-kernel' ... Signed-off-by: Rodny Molina --- .gitmodules | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 72d743e426f5..3977babe5127 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,7 +4,6 @@ [submodule "sonic-linux-kernel"] path = src/sonic-linux-kernel url = https://github.com/Azure/sonic-linux-kernel - branch = stretch [submodule "sonic-sairedis"] path = src/sonic-sairedis url = https://github.com/Azure/sonic-sairedis From 674b58e2a27c34c2021fa28398cc11fdeeaceab5 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Thu, 30 Aug 2018 05:28:22 -0700 Subject: [PATCH 1595/1833] [snmpagent]: Update sonic-snmpagent submodule (#2001) - Fix NameError: name 'logger' is not defined bug Signed-off-by: Shu0T1an ChenG --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index b180f4423a6c..b7d915e2679c 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit b180f4423a6cd205009f2aed19c2bac441a2dfd0 +Subproject commit b7d915e2679c731bb47cb1fb2889bad76e6fe110 From 26850b351f60d761e6864e023ee917286393d0ff Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 30 Aug 2018 22:47:43 -0700 Subject: [PATCH 1596/1833] refactor bcm attribute checker (#1974) * refactor bcm attribute checker * exclude phy_84752 and phy_84328 Signed-off-by: Guohan Lu --- src/sonic-device-data/tests/config_checker | 43 ++++++++++------------ src/sonic-device-data/tests/permitted_list | 17 ++++++--- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/sonic-device-data/tests/config_checker b/src/sonic-device-data/tests/config_checker index 51c32c19c3e4..6e59d1f44ce4 100755 --- a/src/sonic-device-data/tests/config_checker +++ b/src/sonic-device-data/tests/config_checker @@ -10,29 +10,9 @@ def usage(): sys.exit(1) def check_property(p): + if p in permitted_properties: return True - # Try to remove trailing . - if re.sub(r".\d+$", "", p) in permitted_properties: - return True - # Try to remove trailing _. - if re.sub(r"_\d+.\d+$", "", p) in permitted_properties: - return True - # Try to remove trailing _hg. - if re.sub(r"_hg.0$", "", p) in permitted_properties: - return True - # Try to remove trailing _[cx]e - if re.sub(r"_[cx]e\d*$", "", p) in permitted_properties: - return True - # Try to remove trailing _lane_ - if re.sub(r"_lane\d_\d+$", "", p) in permitted_properties: - return True - # Try to remove trailing _lane_. - if re.sub(r"_lane\d_\d+.\d+$", "", p) in permitted_properties: - return True - # Try to remove trailing _lane_[cx]e - if re.sub(r"_lane\d_[cx]e\d+$", "", p) in permitted_properties: - return True return False def check_file(file_name): @@ -45,12 +25,27 @@ def check_file(file_name): lineno = lineno + 1 # Check both commented and uncommented lines line = line.strip().lstrip('#').strip().lower() + # Check if = in the line if line.find("=") == -1: continue p = line.split("=", 1)[0] - # Remove trailing "{.}" - p = re.sub('{[0-9]+\.[0-9]+}', '', p) - # Check if = in the line + + # Remove trailing unit ".$" + p = re.sub(r"\.[0-9]+$", '', p) + # Remove trailing port name + p = re.sub(r"_[cxg]e(\d+)?$", '', p) + # Remove trailing port name example + p = re.sub(r"_$", '', p) + # Remove trailing port number + if p != "phy_84752" and p != "phy_84328": + p = re.sub(r"_(port)?\d+$", '', p) + # Remove trailing higig port + p = re.sub(r"_hg$", '', p) + # Remove trailing lane number + p = re.sub(r"_lane\d+$", '', p) + # 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 150a16292c91..ea78b8165f3a 100644 --- a/src/sonic-device-data/tests/permitted_list +++ b/src/sonic-device-data/tests/permitted_list @@ -7,6 +7,9 @@ bcm_stat_interval bcm_stat_jumbo bcm_tunnel_term_compatible_mode bcm_xlate_port_enable +bcm56340_4x10 +bcm56340_2x10 +bcm56340_config cdma_timeout_usec core_clock_frequency ctr_evict_enable @@ -59,7 +62,7 @@ oversubscribe_mode parity_correction parity_enable pbmp_oversubscribe -pbmp_xport_xe +pbmp_xport pci2eb_overrid pfc_deadlock_seq_control phy_84328 @@ -69,31 +72,35 @@ phy_an_allow_pll_change_hg phy_an_c37 phy_an_c73 phy_an_fec +phy_automedium phy_aux_voltage_enable phy_chain_rx_lane_map_physical phy_chain_rx_polarity_flip_physical phy_chain_tx_lane_map_physical phy_chain_tx_polarity_flip_physical phy_ext_rom_boot +phy_fiber_pref phy_gearbox_enable +phy_null phy_line_tx_mode phy_pcs_rx_polarity_flip phy_pcs_tx_polarity_flip phy_port_primary_and_offset phy_rx_polarity_flip phy_system_tx_mode +phy_sgmii_autoneg phy_tx_polarity_flip phy_xaui_rx_polarity_flip phy_xaui_tx_polarity_flip physical_ports port_init_autoneg port_init_cl72 -port_init_cl72_hg -port_init_speed_xe +port_init_speed port_phy_addr port_phy_clause port_phy_id0 port_phy_id1 +portgroup portmap prbs_polynomial ptp_bs_fref @@ -113,7 +120,7 @@ serdes_firmware_mode serdes_if_type serdes_pre_driver_current serdes_preemphasis -serdes_rx_los_xe +serdes_rx_los serdes_sgmii_m skip_L2_USER_ENTRY sram_scan_enable @@ -129,6 +136,6 @@ tslam_intr_enable tslam_timeout_usec uplink_ports xgxs_lcpll_xtal_refclk -xgxs_pdetect_1 +xgxs_pdetect xgxs_rx_lane_map xgxs_tx_lane_map From 14a0b8c8a3f78e602e9fb77ec1cac5058783f843 Mon Sep 17 00:00:00 2001 From: jackyjs <38714676+jackyjs@users.noreply.github.com> Date: Sun, 2 Sep 2018 04:25:46 +0800 Subject: [PATCH 1597/1833] [devices]: Add Delta Platform et-6248brb (#1640) * Add Delta Platform et-6248brb Signed-off-by: jackyjsliu * add Broadcom configuration file Signed-off-by: jackyjsliu * modify Broadcom configuration file --- .../helix4-et-6248brb-48x1G+2x10G.config.bcm | 158 ++++++++++++++++++ .../x86_64-delta_et-6248brb-r0/sensors.conf | 4 +- platform/broadcom/platform-modules-delta.mk | 2 +- .../modules/delta_et-6248brb_platform.c | 2 +- .../et-6248brb/modules/dni_gpio.c | 2 + 5 files changed, 163 insertions(+), 5 deletions(-) create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/helix4-et-6248brb-48x1G+2x10G.config.bcm diff --git a/device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/helix4-et-6248brb-48x1G+2x10G.config.bcm b/device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/helix4-et-6248brb-48x1G+2x10G.config.bcm new file mode 100644 index 000000000000..05d1c1e8820c --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/Delta-et-6248brb/helix4-et-6248brb-48x1G+2x10G.config.bcm @@ -0,0 +1,158 @@ +# bcm56340 setting : +# Specifies the base port and phy index of a multi slice phy chip. +#phy_port_primary_and_offset_ value is 0xPPOO 0xPP is primary port number 0xOO is offset of the slice +# bcm56340 QG0 port setting +phy_port_primary_and_offset_1=0x0100 +phy_port_primary_and_offset_2=0x0101 +phy_port_primary_and_offset_3=0x0102 +phy_port_primary_and_offset_4=0x0103 +phy_port_primary_and_offset_5=0x0104 +phy_port_primary_and_offset_6=0x0105 +phy_port_primary_and_offset_7=0x0106 +phy_port_primary_and_offset_8=0x0107 + +# bcm56340 QG1 port setting +phy_port_primary_and_offset_9=0x0900 +phy_port_primary_and_offset_10=0x0901 +phy_port_primary_and_offset_11=0x0902 +phy_port_primary_and_offset_12=0x0903 +phy_port_primary_and_offset_13=0x0904 +phy_port_primary_and_offset_14=0x0905 +phy_port_primary_and_offset_15=0x0906 +phy_port_primary_and_offset_16=0x0907 + +# bcm56340 QG2 port setting +phy_port_primary_and_offset_17=0x1100 +phy_port_primary_and_offset_18=0x1101 +phy_port_primary_and_offset_19=0x1102 +phy_port_primary_and_offset_20=0x1103 +phy_port_primary_and_offset_21=0x1104 +phy_port_primary_and_offset_22=0x1105 +phy_port_primary_and_offset_23=0x1106 +phy_port_primary_and_offset_24=0x1107 + +# bcm56340 QG3 port setting +phy_port_primary_and_offset_25=0x1900 +phy_port_primary_and_offset_26=0x1901 +phy_port_primary_and_offset_27=0x1902 +phy_port_primary_and_offset_28=0x1903 +phy_port_primary_and_offset_29=0x1904 +phy_port_primary_and_offset_30=0x1905 +phy_port_primary_and_offset_31=0x1906 +phy_port_primary_and_offset_32=0x1907 + +# bcm56340 QG4 port setting +phy_port_primary_and_offset_33=0x2100 +phy_port_primary_and_offset_34=0x2101 +phy_port_primary_and_offset_35=0x2102 +phy_port_primary_and_offset_36=0x2103 +phy_port_primary_and_offset_37=0x2104 +phy_port_primary_and_offset_38=0x2105 +phy_port_primary_and_offset_39=0x2106 +phy_port_primary_and_offset_40=0x2107 + +# bcm56340 QG5 port setting +phy_port_primary_and_offset_41=0x2900 +phy_port_primary_and_offset_42=0x2901 +phy_port_primary_and_offset_43=0x2902 +phy_port_primary_and_offset_44=0x2903 +phy_port_primary_and_offset_45=0x2904 +phy_port_primary_and_offset_46=0x2905 +phy_port_primary_and_offset_47=0x2906 +phy_port_primary_and_offset_48=0x2907 + +# bcm56340 port group setting +bcm56340_4x10=1 +portgroup_0=1 +portgroup_1=1 +portgroup_2=1 +portgroup_3=1 +portgroup_4=1 +portgroup_5=1 +portgroup_6=1 +portgroup_7=1 +portgroup_8=1 +portgroup_9=1 +portgroup_10=1 +portgroup_11=1 +portgroup_12=1 + +# Port map +pbmp_xport_ge=0x0001FFFFFFFFFFFE +pbmp_xport_xe=0x3F000000000000 + +# phy addr setting for bcm54285-0 +port_phy_addr_1=0x1 +port_phy_addr_2=0x2 +port_phy_addr_3=0x3 +port_phy_addr_4=0x4 +port_phy_addr_5=0x5 +port_phy_addr_6=0x6 +port_phy_addr_7=0x7 +port_phy_addr_8=0x8 + +# phy addr setting for bcm54285-1 +port_phy_addr_9=0xa +port_phy_addr_10=0xb +port_phy_addr_11=0xc +port_phy_addr_12=0xd +port_phy_addr_13=0xe +port_phy_addr_14=0xf +port_phy_addr_15=0x10 +port_phy_addr_16=0x11 + +# phy addr setting for bcm54285-2 +port_phy_addr_17=0x13 +port_phy_addr_18=0x14 +port_phy_addr_19=0x15 +port_phy_addr_20=0x16 +port_phy_addr_21=0x17 +port_phy_addr_22=0x18 +port_phy_addr_23=0x19 +port_phy_addr_24=0x1a + +# phy addr setting for bcm54285-3 +port_phy_addr_25=0x21 +port_phy_addr_26=0x22 +port_phy_addr_27=0x23 +port_phy_addr_28=0x24 +port_phy_addr_29=0x25 +port_phy_addr_30=0x26 +port_phy_addr_31=0x27 +port_phy_addr_32=0x28 + +# phy addr setting for bcm54285-4 +port_phy_addr_33=0x2a +port_phy_addr_34=0x2b +port_phy_addr_35=0x2c +port_phy_addr_36=0x2d +port_phy_addr_37=0x2e +port_phy_addr_38=0x2f +port_phy_addr_39=0x30 +port_phy_addr_40=0x31 + +# phy addr setting for bcm54285-5 +port_phy_addr_41=0x33 +port_phy_addr_42=0x34 +port_phy_addr_43=0x35 +port_phy_addr_44=0x36 +port_phy_addr_45=0x37 +port_phy_addr_46=0x38 +port_phy_addr_47=0x39 +port_phy_addr_48=0x3a + +# phy addr setting for bcm84758 +port_phy_addr_50=0x40 +port_phy_addr_51=0x41 +port_phy_addr_52=0x42 +port_phy_addr_53=0x43 + +# Fiber prefer setting for bcm54285 +phy_automedium=1 +#phy_fiber_pref value is 1 +phy_ext_rom_boot=0 +phy_sgmii_autoneg_ge=1 + +os=unix +phy_null_port52=1 +phy_null_port53=1 diff --git a/device/delta/x86_64-delta_et-6248brb-r0/sensors.conf b/device/delta/x86_64-delta_et-6248brb-r0/sensors.conf index f388bd71ecbe..d5da19ffecd0 100644 --- a/device/delta/x86_64-delta_et-6248brb-r0/sensors.conf +++ b/device/delta/x86_64-delta_et-6248brb-r0/sensors.conf @@ -10,6 +10,4 @@ chip "tmp75-i2c-8-4a" chip "adt7473-i2c-0-2e" label fan1 "FANTRAY 1" - label fan2 "FANTRAY 2" - - + label fan2 "FANTRAY 2" \ No newline at end of file diff --git a/platform/broadcom/platform-modules-delta.mk b/platform/broadcom/platform-modules-delta.mk index 5e6137e74ac5..0c186f127a52 100644 --- a/platform/broadcom/platform-modules-delta.mk +++ b/platform/broadcom/platform-modules-delta.mk @@ -28,4 +28,4 @@ DELTA_ET6248BRB_PLATFORM_MODULE = platform-modules-et-6248brb_$(DELTA_ET6248BRB_ $(DELTA_ET6248BRB_PLATFORM_MODULE)_PLATFORM = x86_64-delta_et-6248brb-r0 $(eval $(call add_extra_package,$(DELTA_AG9032V1_PLATFORM_MODULE),$(DELTA_ET6248BRB_PLATFORM_MODULE))) -SONIC_STRETCH_DEBS += $(DELTA_AG9032V1_PLATFORM_MODULE) +SONIC_STRETCH_DEBS += $(DELTA_AG9032V1_PLATFORM_MODULE) \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/delta_et-6248brb_platform.c b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/delta_et-6248brb_platform.c index fc5ecf320033..72fccd9aa0e8 100644 --- a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/delta_et-6248brb_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/delta_et-6248brb_platform.c @@ -545,7 +545,7 @@ static ssize_t set_gpio_reg(struct device *dev, struct device_attribute *dev_att { int err; int value; - unsigned long set_data; + unsigned long set_data; unsigned char set_reg; unsigned char mask; unsigned char mask_out; diff --git a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/dni_gpio.c b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/dni_gpio.c index b83ed4e6035f..127cf6af13ab 100644 --- a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/dni_gpio.c +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/modules/dni_gpio.c @@ -401,6 +401,7 @@ static struct ichx_desc avoton_desc = { .reglen = avoton_reglen, .use_outlvl_cache = true, }; + #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) static int ichx_gpio_request_regions(struct resource *res_base, const char *name, u8 use_gpio) @@ -558,6 +559,7 @@ static int ichx_gpio_remove(struct platform_device *pdev) return 0; } + #else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) static int ichx_gpio_request_regions(struct device *dev, struct resource *res_base, const char *name, u8 use_gpio) From fd5a3cf6fbcb16fdb20ae89045fc4eb2f5187ee6 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sun, 2 Sep 2018 04:30:31 +0800 Subject: [PATCH 1598/1833] [console speed] Inherit console speed from install environment (#1987) * pick up console speed from install enviroment * get console speed from /proc/cmdline * add CONSOLE_PORT handle --- installer/x86_64/install.sh | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 874dc8d13da0..e39ed9727473 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -64,11 +64,6 @@ fi echo "onie_platform: $onie_platform" -# default console settings -CONSOLE_PORT=0x3f8 -CONSOLE_DEV=0 -CONSOLE_SPEED=9600 - # Get platform specific linux kernel command line arguments ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" @@ -77,6 +72,36 @@ VAR_LOG_SIZE=4096 [ -r platforms/$onie_platform ] && . platforms/$onie_platform +# Pick up console port and speed from install enviroment if not defined yet. +# Console port and speed setting in cmdline is like "console=ttyS0,9600n", +# so we can use pattern 'console=ttyS[0-9]+,[0-9]+' to match it. +# If failed to get the speed and ttyS from cmdline then set them to default: ttyS0 and 9600 +if [ -z "$CONSOLE_PORT" ]; then + console_ttys=$(cat /proc/cmdline | grep -Eo 'console=ttyS[0-9]+' | cut -d "=" -f2) + if [ -z "$console_ttys" -o "$console_ttys" = "ttyS0" ]; then + CONSOLE_PORT=0x3f8 + CONSOLE_DEV=0 + elif [ "$console_ttys" = "ttyS1" ]; then + CONSOLE_PORT=0x2f8 + CONSOLE_DEV=1 + elif [ "$console_ttys" = "ttyS2" ]; then + CONSOLE_PORT=0x3e8 + CONSOLE_DEV=2 + elif [ "$console_ttys" = "ttyS3" ]; then + CONSOLE_PORT=0x2e8 + CONSOLE_DEV=3 + fi +fi + +if [ -z "$CONSOLE_SPEED" ]; then + speed=$(cat /proc/cmdline | grep -Eo 'console=ttyS[0-9]+,[0-9]+' | cut -d "," -f2) + if [ -z "$speed" ]; then + CONSOLE_SPEED=9600 + else + CONSOLE_SPEED=$speed + fi +fi + # Install demo on same block device as ONIE if [ "$install_env" != "build" ]; then onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//') From 2cce4aec1c4292f490fb490130fec6220709f393 Mon Sep 17 00:00:00 2001 From: StanleyCi <34563271+StanleyCi@users.noreply.github.com> Date: Sun, 2 Sep 2018 04:52:38 +0800 Subject: [PATCH 1599/1833] [device] Update ag9032v1 and ag9064 modules. (#1690) * Update ag9032v1 and ag9064 modules. Signed-off-by: neal tai * Fix the sfputil.py when convert an integer to hexadecimal without the 'L' trailing. Signed-off-by: neal tai --- .../x86_64-delta_ag9064-r0/plugins/sfputil.py | 2 +- .../ag9032v1/modules/delta_ag9032v1_cpupld.c | 774 +-- .../modules/delta_ag9032v1_platform.c | 5108 ++++++++--------- .../scripts/ag9032v1_platform_init.sh | 3 + .../ag9032v1/scripts/led_status.sh | 2 +- .../debian/platform-modules-ag9032v1.init | 1 - 6 files changed, 2946 insertions(+), 2944 deletions(-) diff --git a/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py b/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py index d7eadb58036d..708c50819b09 100644 --- a/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py +++ b/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py @@ -120,7 +120,7 @@ def set_low_power_mode(self, port_num, lpmode): reg_value = reg_value & ~mask # Convert our register value back to a hex string and write back - content = hex(reg_value) + content = hex(reg_value).rstrip("L") or "0" reg_file.seek(0) reg_file.write(content) diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_cpupld.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_cpupld.c index ba920f7558df..22f997e71fab 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_cpupld.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_cpupld.c @@ -1,387 +1,387 @@ -#include -#include -#include -#include -#include -#include - -#define CPUPLD_REG 0x31 - -enum cpld_type { - cpld, -}; - -struct platform_data { - int reg_addr; - struct i2c_client *client; -}; - -enum{ - BUS0 = 0, - BUS1, - BUS2, - BUS3, - BUS4, - BUS5, - BUS6, - BUS7, -}; - -enum cpld_attributes { - CPLD_VER, - CPU_BOARD_VER, - CPU_ID, - CPLD_RST, - MB_RST, - I2C_SW_RST, - MB_PWR, - PSU_FAN_INT, - SPI_WP_GBE, - EEPROM_WP, -}; - -static void device_release(struct device *dev) -{ - return; -} - -/*---------------- CPUPLD - start ------------- */ -static struct platform_data ag9032v1_cpld_platform_data[] = { - [cpld] = { - .reg_addr = CPUPLD_REG, - }, -}; - -static struct platform_device ag9032v1_cpld = { - .name = "delta-ag9032v1-cpupld", - .id = 0, - .dev = { - .platform_data = ag9032v1_cpld_platform_data, - .release = device_release - }, -}; -static unsigned char cpld_reg_addr; -static ssize_t get_cpld_reg_value(struct device *dev, struct device_attribute *devattr, char *buf) -{ - int ret; - struct platform_data *pdata = dev->platform_data; - - ret = i2c_smbus_read_byte_data(pdata[cpld].client, cpld_reg_addr); - - return sprintf(buf, "0x%02x\n", ret); -} - -static ssize_t set_cpld_reg_value(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - unsigned long data; - int err; - struct platform_data *pdata = dev->platform_data; - err = kstrtoul(buf, 0, &data); - if (err){ - return err; - } - - if (data > 0xff){ - printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); - return count; - } - - i2c_smbus_write_byte_data(pdata[cpld].client, cpld_reg_addr, data); - - return count; -} - -static ssize_t get_cpld_reg_addr(struct device *dev, struct device_attribute *devattr, char *buf) -{ - - return sprintf(buf, "0x%02x\n", cpld_reg_addr); -} - -static ssize_t set_cpld_reg_addr(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - unsigned long data; - int err; - - err = kstrtoul(buf, 0, &data); - if (err){ - return err; - } - if (data > 0xff){ - printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); - return count; - } - cpld_reg_addr = data; - - return count; -} - -static ssize_t get_cpld_data(struct device *dev, struct device_attribute *dev_attr, char *buf) -{ - int ret; - struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); - struct platform_data *pdata = dev->platform_data; - unsigned char reg; - int mask; - int value; - char note[180]; - switch (attr->index) { - case CPLD_VER: - reg = 0x01; - value = i2c_smbus_read_byte_data(pdata[cpld].client, reg); - sprintf(note, "\nCPLD Version, controlled by CPLD editor.\n"); - return sprintf(buf, "0x%02x%s", value, note); - break; - case CPU_BOARD_VER: - reg = 0x02; - ret = i2c_smbus_read_byte_data(pdata[cpld].client, reg); - value = ret >> 4; - sprintf(note, "\n“0x00”: proto A1\n“0x01”: proto A2\n“0x02”: proto B\n"); - return sprintf(buf, "0x%02x%s", value, note); - break; - case CPU_ID: - reg = 0x02; - ret = i2c_smbus_read_byte_data(pdata[cpld].client, reg); - value = ret & 0x0F; - sprintf(note, "\n“0x00”: P2041 ECC\n“0x01”: Rangeley ECC\n“0x02”: T2080 ECC\n"); - return sprintf(buf, "0x%02x%s", value, note); - break; - case CPLD_RST: - reg = 0x05; - mask = 7; - sprintf(note, "\n“1” = Normal operation\n“0” = Reset\n"); - break; - case MB_RST: - reg = 0x05; - mask = 1; - sprintf(note, "\n“1” = Normal operation\n“0” = Reset\n"); - break; - case I2C_SW_RST: - reg = 0x05; - mask = 0; - sprintf(note, "\n“1” = Normal operation\n“0” = Reset\n"); - break; - case MB_PWR: - reg = 0x08; - mask = 4; - sprintf(note, "\n“1” = Power rail is good\n“0” = Power rail is failed\n"); - break; - case PSU_FAN_INT: - reg = 0x0A; - mask = 0; - sprintf(note, "\n“1” = Interrupt doesn’t occur\n“0” = Interrupt occurs\n"); - break; - case SPI_WP_GBE: - reg = 0x10; - mask = 3; - sprintf(note, "\n“1” = overrides the lock-down function enabling blocks to be erased or programmed using software commands.\n“0” = enables the lock-down mechanism.\n"); - break; - case EEPROM_WP: - reg = 0x10; - mask = 2; - sprintf(note, "\n“1” = overrides the lock-down function enabling blocks to be erased or programmed using software commands.\n“0” = enables the lock-down mechanism.\n"); - break; - default: - return sprintf(buf, "%d not found", attr->index); - } - ret = i2c_smbus_read_byte_data(pdata[cpld].client, reg); - value = (ret & (1 << mask)) >> mask; - return sprintf(buf, "%d%s", value, note); -} - -static ssize_t set_cpld_data(struct device *dev, struct device_attribute *dev_attr, - const char *buf, size_t count) -{ - int mask; - int err; - int ret; - unsigned long data; - unsigned char reg; - unsigned char mask_shift; - struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); - struct platform_data *pdata = dev->platform_data; - err = kstrtoul(buf, 0, &data); - if (err){ - return err; - } - - if (data > 0xff){ - printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); - return count; - } - switch (attr->index) { - case CPLD_RST: - reg = 0x05; - mask = 7; - break; - case MB_RST: - reg = 0x05; - mask = 1; - break; - case I2C_SW_RST: - reg = 0x05; - mask = 0; - break; - case SPI_WP_GBE: - reg = 0x10; - mask = 3; - break; - case EEPROM_WP: - reg = 0x10; - mask = 2; - break; - default: - return count; - } - - ret = i2c_smbus_read_byte_data(pdata[cpld].client, reg); - mask_shift = 1 << mask; - data = (ret & ~mask_shift) | (data << mask); - i2c_smbus_write_byte_data(pdata[cpld].client, cpld_reg_addr, data); - - return count; -} - -static DEVICE_ATTR(cpld_reg_value, S_IRUGO | S_IWUSR, get_cpld_reg_value, set_cpld_reg_value); -static DEVICE_ATTR(cpld_reg_addr, S_IRUGO | S_IWUSR, get_cpld_reg_addr, set_cpld_reg_addr); - -static SENSOR_DEVICE_ATTR(cpld_ver, S_IRUGO, get_cpld_data, NULL, CPLD_VER); -static SENSOR_DEVICE_ATTR(cpu_board_ver, S_IRUGO, get_cpld_data, NULL, CPU_BOARD_VER); -static SENSOR_DEVICE_ATTR(cpu_id, S_IRUGO, get_cpld_data, NULL, CPU_ID); -static SENSOR_DEVICE_ATTR(cpld_rst, S_IRUGO | S_IWUSR, get_cpld_data, set_cpld_data, CPLD_RST); -static SENSOR_DEVICE_ATTR(mb_rst, S_IRUGO | S_IWUSR, get_cpld_data, set_cpld_data, MB_RST); -static SENSOR_DEVICE_ATTR(i2c_sw_rst, S_IRUGO | S_IWUSR, get_cpld_data, set_cpld_data, I2C_SW_RST); -static SENSOR_DEVICE_ATTR(mb_pwr, S_IRUGO, get_cpld_data, NULL, MB_PWR); -static SENSOR_DEVICE_ATTR(psu_fan_int, S_IRUGO, get_cpld_data, NULL, PSU_FAN_INT); -static SENSOR_DEVICE_ATTR(spi_wp_gbe, S_IRUGO | S_IWUSR, get_cpld_data, set_cpld_data, SPI_WP_GBE); -static SENSOR_DEVICE_ATTR(eeprom_wp, S_IRUGO | S_IWUSR, get_cpld_data, set_cpld_data, EEPROM_WP); - -static struct attribute *ag9032v1_cpld_attrs[] = { - &dev_attr_cpld_reg_value.attr, - &dev_attr_cpld_reg_addr.attr, - &sensor_dev_attr_cpld_ver.dev_attr.attr, - &sensor_dev_attr_cpu_board_ver.dev_attr.attr, - &sensor_dev_attr_cpu_id.dev_attr.attr, - &sensor_dev_attr_cpld_rst.dev_attr.attr, - &sensor_dev_attr_mb_rst.dev_attr.attr, - &sensor_dev_attr_i2c_sw_rst.dev_attr.attr, - &sensor_dev_attr_mb_pwr.dev_attr.attr, - &sensor_dev_attr_psu_fan_int.dev_attr.attr, - &sensor_dev_attr_spi_wp_gbe.dev_attr.attr, - &sensor_dev_attr_eeprom_wp.dev_attr.attr, - NULL, -}; - -static struct attribute_group ag9032v1_cpld_attr_group = { - .attrs = ag9032v1_cpld_attrs, -}; - -static int __init cpld_probe(struct platform_device *pdev) -{ - struct platform_data *pdata; - struct i2c_adapter *parent; - int ret; - int retval; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "CPUPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(BUS2); - if (!parent) { - printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS2); - return -ENODEV; - } - - pdata[cpld].client = i2c_new_dummy(parent, pdata[cpld].reg_addr); - if (!pdata[cpld].client) { - printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[cpld].reg_addr); - goto error; - } - - retval = sysfs_create_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_group); - if (retval){ - printk(KERN_WARNING "Fail to create cpupld attribute group"); - goto error; - } - return 0; - -error: - i2c_unregister_device(pdata[cpld].client); - i2c_put_adapter(parent); - return -ENODEV; -} - -static int __exit cpld_remove(struct platform_device *pdev) -{ - struct i2c_adapter *parent = NULL; - struct platform_data *pdata = pdev->dev.platform_data; - sysfs_remove_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_group); - - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - } - else { - if (pdata[cpld].client) { - if (!parent) { - parent = (pdata[cpld].client)->adapter; - } - i2c_unregister_device(pdata[cpld].client); - } - } - i2c_put_adapter(parent); - return 0; -} - -static struct platform_driver cpld_driver = { - .probe = cpld_probe, - .remove = __exit_p(cpld_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9032v1-cpupld", - }, -}; -/*---------------- CPUPLD - end ------------- */ - - -/*---------------- module initialization ------------- */ -static int __init delta_ag9032v1_cpupld_init(void) -{ - int ret; - printk(KERN_WARNING "ag9032v1_platform_cpupld module initialization\n"); - - // set the CPUPLD prob and remove - ret = platform_driver_register(&cpld_driver); - if (ret) { - printk(KERN_WARNING "Fail to register cpupld driver\n"); - goto error_cpupld_driver; - } - - // register the CPUPLD - ret = platform_device_register(&ag9032v1_cpld); - if (ret) { - printk(KERN_WARNING "Fail to create cpupld device\n"); - goto error_ag9032v1_cpupld; - } - return 0; - -error_ag9032v1_cpupld: - platform_driver_unregister(&cpld_driver); -error_cpupld_driver: - return ret; -} - -static void __exit delta_ag9032v1_cpupld_exit(void) -{ - platform_device_unregister(&ag9032v1_cpld); - platform_driver_unregister(&cpld_driver); -} -module_init(delta_ag9032v1_cpupld_init); -module_exit(delta_ag9032v1_cpupld_exit); - -MODULE_DESCRIPTION("DNI ag9032v1 CPLD Platform Support"); -MODULE_AUTHOR("Stanley Chi "); -MODULE_LICENSE("GPL"); +#include +#include +#include +#include +#include +#include + +#define CPUPLD_REG 0x31 + +enum cpld_type { + cpld, +}; + +struct platform_data { + int reg_addr; + struct i2c_client *client; +}; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, +}; + +enum cpld_attributes { + CPLD_VER, + CPU_BOARD_VER, + CPU_ID, + CPLD_RST, + MB_RST, + I2C_SW_RST, + MB_PWR, + PSU_FAN_INT, + SPI_WP_GBE, + EEPROM_WP, +}; + +static void device_release(struct device *dev) +{ + return; +} + +/*---------------- CPUPLD - start ------------- */ +static struct platform_data ag9032v1_cpld_platform_data[] = { + [cpld] = { + .reg_addr = CPUPLD_REG, + }, +}; + +static struct platform_device ag9032v1_cpld = { + .name = "delta-ag9032v1-cpupld", + .id = 0, + .dev = { + .platform_data = ag9032v1_cpld_platform_data, + .release = device_release + }, +}; +static unsigned char cpld_reg_addr; +static ssize_t get_cpld_reg_value(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + struct platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[cpld].client, cpld_reg_addr); + + return sprintf(buf, "0x%02x\n", ret); +} + +static ssize_t set_cpld_reg_value(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int err; + struct platform_data *pdata = dev->platform_data; + err = kstrtoul(buf, 0, &data); + if (err){ + return err; + } + + if (data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + return count; + } + + i2c_smbus_write_byte_data(pdata[cpld].client, cpld_reg_addr, data); + + return count; +} + +static ssize_t get_cpld_reg_addr(struct device *dev, struct device_attribute *devattr, char *buf) +{ + + return sprintf(buf, "0x%02x\n", cpld_reg_addr); +} + +static ssize_t set_cpld_reg_addr(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int err; + + err = kstrtoul(buf, 0, &data); + if (err){ + return err; + } + if (data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + return count; + } + cpld_reg_addr = data; + + return count; +} + +static ssize_t get_cpld_data(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + int ret; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct platform_data *pdata = dev->platform_data; + unsigned char reg; + int mask; + int value; + char note[180]; + switch (attr->index) { + case CPLD_VER: + reg = 0x01; + value = i2c_smbus_read_byte_data(pdata[cpld].client, reg); + sprintf(note, "\nCPLD Version, controlled by CPLD editor.\n"); + return sprintf(buf, "0x%02x%s", value, note); + break; + case CPU_BOARD_VER: + reg = 0x02; + ret = i2c_smbus_read_byte_data(pdata[cpld].client, reg); + value = ret >> 4; + sprintf(note, "\n“0x00”: proto A1\n“0x01”: proto A2\n“0x02”: proto B\n"); + return sprintf(buf, "0x%02x%s", value, note); + break; + case CPU_ID: + reg = 0x02; + ret = i2c_smbus_read_byte_data(pdata[cpld].client, reg); + value = ret & 0x0F; + sprintf(note, "\n“0x00”: P2041 ECC\n“0x01”: Rangeley ECC\n“0x02”: T2080 ECC\n"); + return sprintf(buf, "0x%02x%s", value, note); + break; + case CPLD_RST: + reg = 0x05; + mask = 7; + sprintf(note, "\n“1” = Normal operation\n“0” = Reset\n"); + break; + case MB_RST: + reg = 0x05; + mask = 1; + sprintf(note, "\n“1” = Normal operation\n“0” = Reset\n"); + break; + case I2C_SW_RST: + reg = 0x05; + mask = 0; + sprintf(note, "\n“1” = Normal operation\n“0” = Reset\n"); + break; + case MB_PWR: + reg = 0x08; + mask = 4; + sprintf(note, "\n“1” = Power rail is good\n“0” = Power rail is failed\n"); + break; + case PSU_FAN_INT: + reg = 0x0A; + mask = 0; + sprintf(note, "\n“1” = Interrupt doesn’t occur\n“0” = Interrupt occurs\n"); + break; + case SPI_WP_GBE: + reg = 0x10; + mask = 3; + sprintf(note, "\n“1” = overrides the lock-down function enabling blocks to be erased or programmed using software commands.\n“0” = enables the lock-down mechanism.\n"); + break; + case EEPROM_WP: + reg = 0x10; + mask = 2; + sprintf(note, "\n“1” = overrides the lock-down function enabling blocks to be erased or programmed using software commands.\n“0” = enables the lock-down mechanism.\n"); + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + ret = i2c_smbus_read_byte_data(pdata[cpld].client, reg); + value = (ret & (1 << mask)) >> mask; + return sprintf(buf, "%d%s", value, note); +} + +static ssize_t set_cpld_data(struct device *dev, struct device_attribute *dev_attr, + const char *buf, size_t count) +{ + int mask; + int err; + int ret; + unsigned long data; + unsigned char reg; + unsigned char mask_shift; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct platform_data *pdata = dev->platform_data; + err = kstrtoul(buf, 0, &data); + if (err){ + return err; + } + + if (data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + return count; + } + switch (attr->index) { + case CPLD_RST: + reg = 0x05; + mask = 7; + break; + case MB_RST: + reg = 0x05; + mask = 1; + break; + case I2C_SW_RST: + reg = 0x05; + mask = 0; + break; + case SPI_WP_GBE: + reg = 0x10; + mask = 3; + break; + case EEPROM_WP: + reg = 0x10; + mask = 2; + break; + default: + return count; + } + + ret = i2c_smbus_read_byte_data(pdata[cpld].client, reg); + mask_shift = 1 << mask; + data = (ret & ~mask_shift) | (data << mask); + i2c_smbus_write_byte_data(pdata[cpld].client, cpld_reg_addr, data); + + return count; +} + +static DEVICE_ATTR(cpld_reg_value, S_IRUGO | S_IWUSR, get_cpld_reg_value, set_cpld_reg_value); +static DEVICE_ATTR(cpld_reg_addr, S_IRUGO | S_IWUSR, get_cpld_reg_addr, set_cpld_reg_addr); + +static SENSOR_DEVICE_ATTR(cpld_ver, S_IRUGO, get_cpld_data, NULL, CPLD_VER); +static SENSOR_DEVICE_ATTR(cpu_board_ver, S_IRUGO, get_cpld_data, NULL, CPU_BOARD_VER); +static SENSOR_DEVICE_ATTR(cpu_id, S_IRUGO, get_cpld_data, NULL, CPU_ID); +static SENSOR_DEVICE_ATTR(cpld_rst, S_IRUGO | S_IWUSR, get_cpld_data, set_cpld_data, CPLD_RST); +static SENSOR_DEVICE_ATTR(mb_rst, S_IRUGO | S_IWUSR, get_cpld_data, set_cpld_data, MB_RST); +static SENSOR_DEVICE_ATTR(i2c_sw_rst, S_IRUGO | S_IWUSR, get_cpld_data, set_cpld_data, I2C_SW_RST); +static SENSOR_DEVICE_ATTR(mb_pwr, S_IRUGO, get_cpld_data, NULL, MB_PWR); +static SENSOR_DEVICE_ATTR(psu_fan_int, S_IRUGO, get_cpld_data, NULL, PSU_FAN_INT); +static SENSOR_DEVICE_ATTR(spi_wp_gbe, S_IRUGO | S_IWUSR, get_cpld_data, set_cpld_data, SPI_WP_GBE); +static SENSOR_DEVICE_ATTR(eeprom_wp, S_IRUGO | S_IWUSR, get_cpld_data, set_cpld_data, EEPROM_WP); + +static struct attribute *ag9032v1_cpld_attrs[] = { + &dev_attr_cpld_reg_value.attr, + &dev_attr_cpld_reg_addr.attr, + &sensor_dev_attr_cpld_ver.dev_attr.attr, + &sensor_dev_attr_cpu_board_ver.dev_attr.attr, + &sensor_dev_attr_cpu_id.dev_attr.attr, + &sensor_dev_attr_cpld_rst.dev_attr.attr, + &sensor_dev_attr_mb_rst.dev_attr.attr, + &sensor_dev_attr_i2c_sw_rst.dev_attr.attr, + &sensor_dev_attr_mb_pwr.dev_attr.attr, + &sensor_dev_attr_psu_fan_int.dev_attr.attr, + &sensor_dev_attr_spi_wp_gbe.dev_attr.attr, + &sensor_dev_attr_eeprom_wp.dev_attr.attr, + NULL, +}; + +static struct attribute_group ag9032v1_cpld_attr_group = { + .attrs = ag9032v1_cpld_attrs, +}; + +static int __init cpld_probe(struct platform_device *pdev) +{ + struct platform_data *pdata; + struct i2c_adapter *parent; + int ret; + int retval; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPUPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS2); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n",BUS2); + return -ENODEV; + } + + pdata[cpld].client = i2c_new_dummy(parent, pdata[cpld].reg_addr); + if (!pdata[cpld].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[cpld].reg_addr); + goto error; + } + + retval = sysfs_create_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_group); + if (retval){ + printk(KERN_WARNING "Fail to create cpupld attribute group"); + goto error; + } + return 0; + +error: + i2c_unregister_device(pdata[cpld].client); + i2c_put_adapter(parent); + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_group); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + if (pdata[cpld].client) { + if (!parent) { + parent = (pdata[cpld].client)->adapter; + } + i2c_unregister_device(pdata[cpld].client); + } + } + i2c_put_adapter(parent); + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9032v1-cpupld", + }, +}; +/*---------------- CPUPLD - end ------------- */ + + +/*---------------- module initialization ------------- */ +static int __init delta_ag9032v1_cpupld_init(void) +{ + int ret; + printk(KERN_WARNING "ag9032v1_platform_cpupld module initialization\n"); + + // set the CPUPLD prob and remove + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpupld driver\n"); + goto error_cpupld_driver; + } + + // register the CPUPLD + ret = platform_device_register(&ag9032v1_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpupld device\n"); + goto error_ag9032v1_cpupld; + } + return 0; + +error_ag9032v1_cpupld: + platform_driver_unregister(&cpld_driver); +error_cpupld_driver: + return ret; +} + +static void __exit delta_ag9032v1_cpupld_exit(void) +{ + platform_device_unregister(&ag9032v1_cpld); + platform_driver_unregister(&cpld_driver); +} +module_init(delta_ag9032v1_cpupld_init); +module_exit(delta_ag9032v1_cpupld_exit); + +MODULE_DESCRIPTION("DNI ag9032v1 CPLD Platform Support"); +MODULE_AUTHOR("Stanley Chi "); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c index 20a91db4c0f9..9b7a1958c77a 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/modules/delta_ag9032v1_platform.c @@ -1,2554 +1,2554 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BUS3_DEV_NUM 9 -#define BUS4_DEV_NUM 6 -#define BUS5_DEV_NUM 32 -#define DEFAULT_NUM 1 -#define BUS3_BASE_NUM 30 -#define BUS4_BASE_NUM 40 -#define BUS5_BASE_NUM 50 - -#define BUS3_MUX_REG 0x21 -#define BUS4_MUX_REG 0x21 -#define BUS5_MUX_REG 0x20 - -#define TEMP_FAN_VAL 0x06 -#define FANIO_CTL_VAL 0x07 -#define FAN_CTRL_VAL 0x05 -#define PSU1_VAL 0x00 -#define PSU2_VAL 0x20 -#define HOT_SWAP1_VAL 0x10 -#define HOT_SWAP2_VAL 0x30 -#define FAN_EEPROM1_VAL 0x00 -#define FAN_EEPROM2_VAL 0x01 -#define FAN_EEPROM3_VAL 0x02 -#define FAN_EEPROM4_VAL 0x03 -#define FAN_EEPROM5_VAL 0x04 - -#define SWPLD_REG 0x31 -#define SWPLD_SFP_MUX_REG 0x20 - -#define SYS_LED_REG 0x1C -#define FAN1_LED_REG 0x1D -#define FAN2_LED_REG 0x1E - -#define SFP_PRESENCE_1 0x38 -#define SFP_PRESENCE_2 0x39 -#define SFP_PRESENCE_3 0x3A -#define SFP_PRESENCE_4 0x3B - -#define SFP_LP_MODE_1 0x34 -#define SFP_LP_MODE_2 0x35 -#define SFP_LP_MODE_3 0x36 -#define SFP_LP_MODE_4 0x37 - -#define SFP_RESET_1 0x3C -#define SFP_RESET_2 0x3D -#define SFP_RESET_3 0x3E -#define SFP_RESET_4 0x3F - -#define SFP_RESPONSE_1 0x30 -#define SFP_RESPONSE_2 0x31 -#define SFP_RESPONSE_3 0x32 -#define SFP_RESPONSE_4 0x33 - -#define SFF8436_INFO(data) \ - .type = "sff8436", .addr = 0x50, .platform_data = (data) - -#define SFF_8346_PORT(eedata) \ - .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY - -#define ag9032v1_i2c_device_num(NUM){ \ - .name = "delta-ag9032v1-i2c-device", \ - .id = NUM, \ - .dev = { \ - .platform_data = &ag9032v1_i2c_device_platform_data[NUM], \ - .release = device_release, \ - }, \ -} - -/*Define struct to get client of i2c_new_deivce */ -struct i2c_client * i2c_client_9547; - -enum{ - BUS0 = 0, - BUS1, - BUS2, - BUS3, - BUS4, - BUS5, - BUS6, - BUS7, -}; - -unsigned char reverse_8bits(unsigned char c) -{ - unsigned char s = 0; - int i; - for (i = 0; i < 8; ++i) { - s <<= 1; - s |= c & 1; - c >>= 1; - } - return s; -} -/*---------------- I2C device - start ------------- */ -static void device_release(struct device *dev) -{ - return; -} - -struct i2c_device_platform_data { - int parent; - struct i2c_board_info info; - struct i2c_client *client; -}; -/* pca9547 - add 8 bus */ -static struct pca954x_platform_mode pca954x_mode[] = { - { .adap_id = 2, - .deselect_on_exit = 1, - }, - { .adap_id = 3, - .deselect_on_exit = 1, - }, - { .adap_id = 4, - .deselect_on_exit = 1, - }, - { .adap_id = 5, - .deselect_on_exit = 1, - }, - { .adap_id = 6, - .deselect_on_exit = 1, - }, - { .adap_id = 7, - .deselect_on_exit = 1, - }, - { .adap_id = 8, - .deselect_on_exit = 1, - }, - { .adap_id = 9, - .deselect_on_exit = 1, - }, -}; - -static struct pca954x_platform_data pca954x_data = { - .modes = pca954x_mode, - .num_modes = ARRAY_SIZE(pca954x_mode), -}; - -static struct i2c_board_info __initdata i2c_info_pca9547[] = -{ - { - I2C_BOARD_INFO("pca9547", 0x71), - .platform_data = &pca954x_data, - }, -}; - - -static struct sff_8436_platform_data sff_8436_port[] = { - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, -}; - -static struct i2c_device_platform_data ag9032v1_i2c_device_platform_data[] = { - { - /* tmp75 (0x4d) */ - .parent = 2, - .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, - .client = NULL, - }, - { - /* id eeprom (0x53) */ - .parent = 2, - .info = { I2C_BOARD_INFO("24c02", 0x53) }, - .client = NULL, - }, - { - /* tmp75 (0x4c) */ - .parent = 7, - .info = { I2C_BOARD_INFO("tmp75", 0x4c) }, - .client = NULL, - }, - { - /* tmp75 (0x4d) */ - .parent = 7, - .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, - .client = NULL, - }, - { - /* tmp75 (0x4e) */ - .parent = 7, - .info = { I2C_BOARD_INFO("tmp75", 0x4e) }, - .client = NULL, - }, - { - /* tmp75 (0x4f) */ - .parent = 30, - .info = { I2C_BOARD_INFO("tmp75", 0x4f) }, - .client = NULL, - }, - { - /* FAN 1 Controller (0x2c) */ - .parent = 37, - .info = { I2C_BOARD_INFO("emc2305", 0x2c) }, - .client = NULL, - }, - { - /* FAN 2 Controller (0x2d) */ - .parent = 38, - .info = { I2C_BOARD_INFO("emc2305", 0x2d) }, - .client = NULL, - }, - { - /* psu 1 (0x58) */ - .parent = 40, - .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = (void *) 0 }, - .client = NULL, - }, - { - /* psu 2 (0x58) */ - .parent = 41, - .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = (void *) 1 }, - .client = NULL, - }, - { - /* hot-swap 1 (0x40) */ - .parent = 42, - .info = { .type = "ltc4215", .addr = 0x40, .platform_data = (void *) 0 }, - .client = NULL, - }, - { - /* hot-swap 2 (0x40) */ - .parent = 43, - .info = { .type = "ltc4215", .addr = 0x40, .platform_data = (void *) 1 }, - .client = NULL, - }, - { - /* qsfp 1 (0x50) */ - .parent = 50, - .info = { SFF8436_INFO(&sff_8436_port[0]) }, - .client = NULL, - }, - { - /* qsfp 2 (0x50) */ - .parent = 51, - .info = { SFF8436_INFO(&sff_8436_port[1]) }, - .client = NULL, - }, - { - /* qsfp 3 (0x50) */ - .parent = 52, - .info = { SFF8436_INFO(&sff_8436_port[2]) }, - .client = NULL, - }, - { - /* qsfp 4 (0x50) */ - .parent = 53, - .info = { SFF8436_INFO(&sff_8436_port[3]) }, - .client = NULL, - }, - { - /* qsfp 5 (0x50) */ - .parent = 54, - .info = { SFF8436_INFO(&sff_8436_port[4]) }, - .client = NULL, - }, - { - /* qsfp 6 (0x50) */ - .parent = 55, - .info = { SFF8436_INFO(&sff_8436_port[5]) }, - .client = NULL, - }, - { - /* qsfp 7 (0x50) */ - .parent = 56, - .info = { SFF8436_INFO(&sff_8436_port[6]) }, - .client = NULL, - }, - { - /* qsfp 8 (0x50) */ - .parent = 57, - .info = { SFF8436_INFO(&sff_8436_port[7]) }, - .client = NULL, - }, - { - /* qsfp 9 (0x50) */ - .parent = 58, - .info = { SFF8436_INFO(&sff_8436_port[8]) }, - .client = NULL, - }, - { - /* qsfp 10 (0x50) */ - .parent = 59, - .info = { SFF8436_INFO(&sff_8436_port[9]) }, - .client = NULL, - }, - { - /* qsfp 11 (0x50) */ - .parent = 60, - .info = { SFF8436_INFO(&sff_8436_port[10]) }, - .client = NULL, - }, - { - /* qsfp 12 (0x50) */ - .parent = 61, - .info = { SFF8436_INFO(&sff_8436_port[11]) }, - .client = NULL, - }, - { - /* qsfp 13 (0x50) */ - .parent = 62, - .info = { SFF8436_INFO(&sff_8436_port[12]) }, - .client = NULL, - }, - { - /* qsfp 14 (0x50) */ - .parent = 63, - .info = { SFF8436_INFO(&sff_8436_port[13]) }, - .client = NULL, - }, - { - /* qsfp 15 (0x50) */ - .parent = 64, - .info = { SFF8436_INFO(&sff_8436_port[14]) }, - .client = NULL, - }, - { - /* qsfp 16 (0x50) */ - .parent = 65, - .info = { SFF8436_INFO(&sff_8436_port[15]) }, - .client = NULL, - }, - { - /* qsfp 17 (0x50) */ - .parent = 66, - .info = { SFF8436_INFO(&sff_8436_port[16]) }, - .client = NULL, - }, - { - /* qsfp 18 (0x50) */ - .parent = 67, - .info = { SFF8436_INFO(&sff_8436_port[17]) }, - .client = NULL, - }, - { - /* qsfp 19 (0x50) */ - .parent = 68, - .info = { SFF8436_INFO(&sff_8436_port[18]) }, - .client = NULL, - }, - { - /* qsfp 20 (0x50) */ - .parent = 69, - .info = { SFF8436_INFO(&sff_8436_port[19]) }, - .client = NULL, - }, - { - /* qsfp 21 (0x50) */ - .parent = 70, - .info = { SFF8436_INFO(&sff_8436_port[20]) }, - .client = NULL, - }, - { - /* qsfp 22 (0x50) */ - .parent = 71, - .info = { SFF8436_INFO(&sff_8436_port[21]) }, - .client = NULL, - }, - { - /* qsfp 23 (0x50) */ - .parent = 72, - .info = { SFF8436_INFO(&sff_8436_port[22]) }, - .client = NULL, - }, - { - /* qsfp 24 (0x50) */ - .parent = 73, - .info = { SFF8436_INFO(&sff_8436_port[23]) }, - .client = NULL, - }, - { - /* qsfp 25 (0x50) */ - .parent = 74, - .info = { SFF8436_INFO(&sff_8436_port[24]) }, - .client = NULL, - }, - { - /* qsfp 26 (0x50) */ - .parent = 75, - .info = { SFF8436_INFO(&sff_8436_port[25]) }, - .client = NULL, - }, - { - /* qsfp 27 (0x50) */ - .parent = 76, - .info = { SFF8436_INFO(&sff_8436_port[26]) }, - .client = NULL, - }, - { - /* qsfp 28 (0x50) */ - .parent = 77, - .info = { SFF8436_INFO(&sff_8436_port[27]) }, - .client = NULL, - }, - { - /* qsfp 29 (0x50) */ - .parent = 78, - .info = { SFF8436_INFO(&sff_8436_port[28]) }, - .client = NULL, - }, - { - /* qsfp 30 (0x50) */ - .parent = 79, - .info = { SFF8436_INFO(&sff_8436_port[29]) }, - .client = NULL, - }, - { - /* qsfp 31 (0x50) */ - .parent = 80, - .info = { SFF8436_INFO(&sff_8436_port[30]) }, - .client = NULL, - }, - { - /* qsfp 32 (0x50) */ - .parent = 81, - .info = { SFF8436_INFO(&sff_8436_port[31]) }, - .client = NULL, - }, -}; - - -static struct platform_device ag9032v1_i2c_device[] = { - ag9032v1_i2c_device_num(0), - ag9032v1_i2c_device_num(1), - ag9032v1_i2c_device_num(2), - ag9032v1_i2c_device_num(3), - ag9032v1_i2c_device_num(4), - ag9032v1_i2c_device_num(5), - ag9032v1_i2c_device_num(6), - ag9032v1_i2c_device_num(7), - ag9032v1_i2c_device_num(8), - ag9032v1_i2c_device_num(9), - ag9032v1_i2c_device_num(10), - ag9032v1_i2c_device_num(11), - ag9032v1_i2c_device_num(12), - ag9032v1_i2c_device_num(13), - ag9032v1_i2c_device_num(14), - ag9032v1_i2c_device_num(15), - ag9032v1_i2c_device_num(16), - ag9032v1_i2c_device_num(17), - ag9032v1_i2c_device_num(18), - ag9032v1_i2c_device_num(19), - ag9032v1_i2c_device_num(20), - ag9032v1_i2c_device_num(21), - ag9032v1_i2c_device_num(22), - ag9032v1_i2c_device_num(23), - ag9032v1_i2c_device_num(24), - ag9032v1_i2c_device_num(25), - ag9032v1_i2c_device_num(26), - ag9032v1_i2c_device_num(27), - ag9032v1_i2c_device_num(28), - ag9032v1_i2c_device_num(29), - ag9032v1_i2c_device_num(30), - ag9032v1_i2c_device_num(31), - ag9032v1_i2c_device_num(32), - ag9032v1_i2c_device_num(33), - ag9032v1_i2c_device_num(34), - ag9032v1_i2c_device_num(35), - ag9032v1_i2c_device_num(36), - ag9032v1_i2c_device_num(37), - ag9032v1_i2c_device_num(38), - ag9032v1_i2c_device_num(39), - ag9032v1_i2c_device_num(40), - ag9032v1_i2c_device_num(41), - ag9032v1_i2c_device_num(42), - ag9032v1_i2c_device_num(43), -}; - -/*---------------- I2C device - end ------------- */ - -/*---------------- I2C driver - start ------------- */ -static int __init i2c_device_probe(struct platform_device *pdev) -{ - struct i2c_device_platform_data *pdata; - struct i2c_adapter *parent; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", - pdata->parent); - return -ENODEV; - } - - pdata->client = i2c_new_device(parent, &pdata->info); - if (!pdata->client) { - dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", - pdata->info.type, pdata->parent); - return -ENODEV; - } - - return 0; -} - -static int __exit i2c_deivce_remove(struct platform_device *pdev) -{ - struct i2c_adapter *parent; - struct i2c_device_platform_data *pdata; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - return -ENODEV; - } - - if (pdata->client) { - parent = (pdata->client)->adapter; - i2c_unregister_device(pdata->client); - i2c_put_adapter(parent); - } - - return 0; -} -static struct platform_driver i2c_device_driver = { - .probe = i2c_device_probe, - .remove = __exit_p(i2c_deivce_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9032v1-i2c-device", - } -}; - -/*---------------- I2C driver - end ------------- */ - -/*---------------- CPLD - start ------------- */ - -/* CPLD -- device */ - -enum cpld_type { - system_cpld, -}; - -struct cpld_platform_data { - int reg_addr; - struct i2c_client *client; -}; - -enum swpld_attributes { - SW_BOARD_ID, - SW_BOARD_VER, - SWPLD_VER, - SYS_RST, - B56960_RST, - MB_A_PLD_RST, - MB_B_PLD_RST, - PSU1_PWR_OK, - PSU2_PWR_OK, - HS1_PWR_OK, - HS2_PWR_OK, - B54616_RST, - B54616_INT, - B54616_MASK_INT, - PB_HS_INT, - MB_HS_INT, - PB_PWR_INT, - MB_PWR_INT, - FAN_INT, - PB_HS_MASK_INT, - MB_HS_MASK_INT, - PB_PWR1_MASK_INT, - PB_PWR2_MASK_INT, - FAN_MASK_INT, - QSFP_01TO08_INT, - QSFP_08TO16_INT, - QSFP_17TO24_INT, - QSFP_25TO32_INT, - QSFP_01TO08_ABS, - QSFP_08TO16_ABS, - QSFP_17TO24_ABS, - QSFP_25TO32_ABS, - QSFP_01TO08_MASK_INT, - QSFP_08TO16_MASK_INT, - QSFP_17TO24_MASK_INT, - QSFP_25TO32_MASK_INT, - QSFP_01TO08_MASK_ABS, - QSFP_08TO16_MASK_ABS, - QSFP_17TO24_MASK_ABS, - QSFP_25TO32_MASK_ABS, - QSFP01_MOD_INT, - QSFP02_MOD_INT, - QSFP03_MOD_INT, - QSFP04_MOD_INT, - QSFP05_MOD_INT, - QSFP06_MOD_INT, - QSFP07_MOD_INT, - QSFP08_MOD_INT, - QSFP09_MOD_INT, - QSFP10_MOD_INT, - QSFP11_MOD_INT, - QSFP12_MOD_INT, - QSFP13_MOD_INT, - QSFP14_MOD_INT, - QSFP15_MOD_INT, - QSFP16_MOD_INT, - QSFP17_MOD_INT, - QSFP18_MOD_INT, - QSFP19_MOD_INT, - QSFP20_MOD_INT, - QSFP21_MOD_INT, - QSFP22_MOD_INT, - QSFP23_MOD_INT, - QSFP24_MOD_INT, - QSFP25_MOD_INT, - QSFP26_MOD_INT, - QSFP27_MOD_INT, - QSFP28_MOD_INT, - QSFP29_MOD_INT, - QSFP30_MOD_INT, - QSFP31_MOD_INT, - QSFP32_MOD_INT, -}; - -static struct cpld_platform_data ag9032v1_cpld_platform_data[] = { - [system_cpld] = { - .reg_addr = SWPLD_REG, - }, -}; - -static struct platform_device ag9032v1_cpld = { - .name = "delta-ag9032v1-swpld", - .id = 0, - .dev = { - .platform_data = ag9032v1_cpld_platform_data, - .release = device_release, - }, -}; - -static struct swpld_attribute_data { - int reg_addr; - int reg_mask; - char reg_note[150]; -}; - -static struct swpld_attribute_data controller_interrupt_data[] = { -//BOARD - [SYS_RST] = { - .reg_addr = 0x04, - .reg_mask = 7, - .reg_note = "“1” = Normal operation\n“0” = Reset" - }, - [B56960_RST] = { - .reg_addr = 0x04, - .reg_mask = 6, - .reg_note = "“1” = Normal operation\n“0” = Reset" - }, - [MB_A_PLD_RST] = { - .reg_addr = 0x04, - .reg_mask = 4, - .reg_note = "“1” = Normal operation\n“0” = Reset" - }, - [MB_B_PLD_RST] = { - .reg_addr = 0x04, - .reg_mask = 3, - .reg_note = "“1” = Normal operation\n“0” = Reset" - }, -//PSU - [PSU1_PWR_OK] = { - .reg_addr = 0x0a, - .reg_mask = 7, - .reg_note = "‘0’ = Power rail is failed\n‘1’ = Power rail is good" - }, - [PSU2_PWR_OK] = { - .reg_addr = 0x0a, - .reg_mask = 6, - .reg_note = "‘0’ = Power rail is failed\n‘1’ = Power rail is good" - }, -//HOT SWAP - [HS1_PWR_OK] = { - .reg_addr = 0x08, - .reg_mask = 5, - .reg_note = "‘0’ = Hot swap controller disabled\n‘1’ = Hot swap controller enabled" - }, - [HS2_PWR_OK] = { - .reg_addr = 0x08, - .reg_mask = 4, - .reg_note = "‘0’ = Hot swap controller disabled\n‘1’ = Hot swap controller enabled" - }, -//BCM54616S - [B54616_RST] = { - .reg_addr = 0x04, - .reg_mask = 5, - .reg_note = "“0” = Reset\n“1” = Normal operation" - }, - [B54616_INT] = { - .reg_addr = 0x16, - .reg_mask = 7, - .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" - }, - [B54616_MASK_INT] = { - .reg_addr = 0x17, - .reg_mask = 7, - .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" - }, -//QSFP - [PB_HS_INT] = { - .reg_addr = 0x10, - .reg_mask = 7, - .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" - }, - [MB_HS_INT] = { - .reg_addr = 0x10, - .reg_mask = 6, - .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" - }, - [PB_PWR_INT] = { - .reg_addr = 0x10, - .reg_mask = 5, - .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" - }, - [MB_PWR_INT] = { - .reg_addr = 0x10, - .reg_mask = 4, - .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" - }, - [FAN_INT] = { - .reg_addr = 0x10, - .reg_mask = 3, - .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" - }, - [PB_HS_MASK_INT] = { - .reg_addr = 0x11, - .reg_mask = 7, - .reg_note = "‘0’ = Interrupt doesn’t masked\n‘1’ = Interrupt masked" - }, - [MB_HS_MASK_INT] = { - .reg_addr = 0x11, - .reg_mask = 6, - .reg_note = "‘0’ = Interrupt doesn’t masked\n‘1’ = Interrupt masked" - }, - [PB_PWR1_MASK_INT] = { - .reg_addr = 0x11, - .reg_mask = 5, - .reg_note = "‘0’ = Interrupt doesn’t masked\n‘1’ = Interrupt masked" - }, - [PB_PWR2_MASK_INT] = { - .reg_addr = 0x11, - .reg_mask = 4, - .reg_note = "‘0’ = Interrupt doesn’t masked\n‘1’ = Interrupt masked" - }, - [FAN_MASK_INT] = { - .reg_addr = 0x11, - .reg_mask = 3, - .reg_note = "‘0’ = Interrupt doesn’t masked\n‘1’ = Interrupt masked" - }, - [QSFP_01TO08_INT] = { - .reg_addr = 0x12, - .reg_mask = 7, - .reg_note = "“0” = Interrupt occurs\n“1” = Interrupt doesn’t occur" - }, - [QSFP_08TO16_INT] = { - .reg_addr = 0x12, - .reg_mask = 6, - .reg_note = "“0” = Interrupt occurs\n“1” = Interrupt doesn’t occur" - }, - [QSFP_17TO24_INT] = { - .reg_addr = 0x12, - .reg_mask = 5, - .reg_note = "“0” = Interrupt occurs\n“1” = Interrupt doesn’t occur" - }, - [QSFP_25TO32_INT] = { - .reg_addr = 0x12, - .reg_mask = 4, - .reg_note = "“0” = Interrupt occurs\n“1” = Interrupt doesn’t occur" - }, - [QSFP_01TO08_ABS] = { - .reg_addr = 0x12, - .reg_mask = 3, - .reg_note = "“0” = Absence status change\n“1” = Absence status not changes" - }, - [QSFP_08TO16_ABS] = { - .reg_addr = 0x12, - .reg_mask = 2, - .reg_note = "“0” = Absence status change\n“1” = Absence status not changes" - }, - [QSFP_17TO24_ABS] = { - .reg_addr = 0x12, - .reg_mask = 1, - .reg_note = "“0” = Absence status change\n“1” = Absence status not changes" - }, - [QSFP_25TO32_ABS] = { - .reg_addr = 0x12, - .reg_mask = 0, - .reg_note = "“0” = Absence status change\n“1” = Absence status not changes" - }, - [QSFP_01TO08_MASK_INT] = { - .reg_addr = 0x13, - .reg_mask = 7, - .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" - }, - [QSFP_08TO16_MASK_INT] = { - .reg_addr = 0x13, - .reg_mask = 6, - .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" - }, - [QSFP_17TO24_MASK_INT] = { - .reg_addr = 0x13, - .reg_mask = 5, - .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" - }, - [QSFP_25TO32_MASK_INT] = { - .reg_addr = 0x13, - .reg_mask = 4, - .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" - }, - [QSFP_01TO08_MASK_ABS] = { - .reg_addr = 0x13, - .reg_mask = 3, - .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" - }, - [QSFP_08TO16_MASK_ABS] = { - .reg_addr = 0x13, - .reg_mask = 2, - .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" - }, - [QSFP_17TO24_MASK_ABS] = { - .reg_addr = 0x13, - .reg_mask = 1, - .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" - }, - [QSFP_25TO32_MASK_ABS] = { - .reg_addr = 0x13, - .reg_mask = 0, - .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" - }, - [QSFP01_MOD_INT] = { - .reg_addr = 0x40, - .reg_mask = 7, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP02_MOD_INT] = { - .reg_addr = 0x40, - .reg_mask = 6, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP03_MOD_INT] = { - .reg_addr = 0x40, - .reg_mask = 5, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP04_MOD_INT] = { - .reg_addr = 0x40, - .reg_mask = 4, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP05_MOD_INT] = { - .reg_addr = 0x40, - .reg_mask = 3, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP06_MOD_INT] = { - .reg_addr = 0x40, - .reg_mask = 2, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP07_MOD_INT] = { - .reg_addr = 0x40, - .reg_mask = 1, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP08_MOD_INT] = { - .reg_addr = 0x40, - .reg_mask = 0, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP09_MOD_INT] = { - .reg_addr = 0x41, - .reg_mask = 7, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP10_MOD_INT] = { - .reg_addr = 0x41, - .reg_mask = 6, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP11_MOD_INT] = { - .reg_addr = 0x41, - .reg_mask = 5, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP12_MOD_INT] = { - .reg_addr = 0x41, - .reg_mask = 4, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP13_MOD_INT] = { - .reg_addr = 0x41, - .reg_mask = 3, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP14_MOD_INT] = { - .reg_addr = 0x41, - .reg_mask = 2, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP15_MOD_INT] = { - .reg_addr = 0x41, - .reg_mask = 1, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP16_MOD_INT] = { - .reg_addr = 0x41, - .reg_mask = 0, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP17_MOD_INT] = { - .reg_addr = 0x42, - .reg_mask = 7, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP18_MOD_INT] = { - .reg_addr = 0x42, - .reg_mask = 6, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP19_MOD_INT] = { - .reg_addr = 0x42, - .reg_mask = 5, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP20_MOD_INT] = { - .reg_addr = 0x42, - .reg_mask = 4, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP21_MOD_INT] = { - .reg_addr = 0x42, - .reg_mask = 3, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP22_MOD_INT] = { - .reg_addr = 0x42, - .reg_mask = 2, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP23_MOD_INT] = { - .reg_addr = 0x42, - .reg_mask = 1, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP24_MOD_INT] = { - .reg_addr = 0x42, - .reg_mask = 0, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP25_MOD_INT] = { - .reg_addr = 0x43, - .reg_mask = 7, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP26_MOD_INT] = { - .reg_addr = 0x43, - .reg_mask = 6, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP27_MOD_INT] = { - .reg_addr = 0x43, - .reg_mask = 5, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP28_MOD_INT] = { - .reg_addr = 0x43, - .reg_mask = 4, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP29_MOD_INT] = { - .reg_addr = 0x43, - .reg_mask = 3, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP30_MOD_INT] = { - .reg_addr = 0x43, - .reg_mask = 2, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP31_MOD_INT] = { - .reg_addr = 0x43, - .reg_mask = 1, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, - [QSFP32_MOD_INT] = { - .reg_addr = 0x43, - .reg_mask = 0, - .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" - }, -}; - -static ssize_t get_present(struct device *dev, struct device_attribute \ - *dev_attr, char *buf) -{ - int ret; - u32 data = 0; - struct cpld_platform_data *pdata = dev->platform_data; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_1); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data = (u32)reverse_8bits(ret) & 0xff; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_2); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 8; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_3); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 16; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_4); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 24; - - return sprintf(buf, "0x%08x\n", data); //return 32bits data -} - -static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) -{ - int ret; - u32 data = 0; - struct cpld_platform_data *pdata = dev->platform_data; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_1); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data = (u32)(reverse_8bits(ret) & 0xff); - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_2); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 8; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_3); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 16; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_4); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 24; - - return sprintf(buf, "0x%08x\n", data); //return 32bits data -} - -static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long data; - int err; - struct cpld_platform_data *pdata = dev->platform_data; - - err = kstrtoul(buf, 16, &data); - if (err) - return err; - - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_1, (u8)reverse_8bits(data & 0xff)); - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_2, (u8)(reverse_8bits(data >> 8) & 0xff)); - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_3, (u8)(reverse_8bits(data >> 16) & 0xff)); - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_4, (u8)(reverse_8bits(data >> 24) & 0xff)); - - return count; -} - -static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) -{ - int ret; - u32 data = 0; - struct cpld_platform_data *pdata = dev->platform_data; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_1); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data = (u32)(reverse_8bits(ret) & 0xff); - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_2); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 8; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_3); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 16; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_4); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 24; - - return sprintf(buf, "0x%08x\n", data); //return 32bits data -} - -static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long data; - int err; - struct cpld_platform_data *pdata = dev->platform_data; - - err = kstrtoul(buf, 16, &data); - if (err) - return err; - - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_1, (u8)reverse_8bits(data & 0xff)); - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_2, (u8)reverse_8bits((data >> 8)& 0xff)); - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_3, (u8)reverse_8bits((data >> 16) & 0xff)); - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_4, (u8)reverse_8bits((data >> 24) & 0xff)); - - return count; -} - -static ssize_t get_response(struct device *dev, struct device_attribute *devattr, char *buf) -{ - int ret; - u32 data = 0; - struct cpld_platform_data *pdata = dev->platform_data; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_1); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data = (u32)(reverse_8bits(ret) & 0xff); - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_2); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 8; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_3); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 16; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_4); - if (ret < 0) - return sprintf(buf, "error number(%d)",ret); - data |= (u32)(reverse_8bits(ret) & 0xff) << 24; - - return sprintf(buf, "0x%08x\n", data); //return 32bits data -} - -static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - unsigned long data; - int err; - struct cpld_platform_data *pdata = dev->platform_data; - - err = kstrtoul(buf, 16, &data); - if (err) - return err; - - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_1, (u8)reverse_8bits(data & 0xff)); - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_2, (u8)reverse_8bits((data >> 8)& 0xff)); - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_3, (u8)reverse_8bits((data >> 16) & 0xff)); - i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_4, (u8)reverse_8bits((data >> 24) & 0xff)); - - return count; -} - -struct platform_led_status{ - int reg_data; - char *led_status; - int led_id; -}; - -static struct platform_led_status led_info[] = { - { - .reg_data = 0x40, - .led_status = "pwr1_green", - .led_id = 0, - }, - { - .reg_data = 0x80, - .led_status = "pwr1_amber", - .led_id = 0, - }, - { - .reg_data = 0x00, - .led_status = "pwr1_off", - .led_id = 0, - }, - { - .reg_data = 0xc0, - .led_status = "pwr1_off", - .led_id = 0, - }, - { - .reg_data = 0x10, - .led_status = "pwr2_green", - .led_id = 1, - }, - { - .reg_data = 0x20, - .led_status = "pwr2_amber", - .led_id = 1, - }, - { - .reg_data = 0x00, - .led_status = "pwr2_off", - .led_id = 1, - }, - { - .reg_data = 0x30, - .led_status = "pwr2_off", - .led_id = 1, - }, - { - .reg_data = 0x04, - .led_status = "sys_green", - .led_id = 2, - }, - { - .reg_data = 0x08, - .led_status = "sys_blinking_green", - .led_id = 2, - }, - { - .reg_data = 0x0c, - .led_status = "sys_red", - .led_id = 2, - }, - { - .reg_data = 0x00, - .led_status = "sys_off", - .led_id = 2, - }, - { - .reg_data = 0x01, - .led_status = "fan_green", - .led_id = 3, - }, - { - .reg_data = 0x02, - .led_status = "fan_amber", - .led_id = 3, - }, - { - .reg_data = 0x00, - .led_status = "fan_off", - .led_id = 3, - }, - { - .reg_data = 0x03, - .led_status = "fan_off", - .led_id = 3, - }, - { - .reg_data = 0x40, - .led_status = "fan1_green", - .led_id = 4, - }, - { - .reg_data = 0x80, - .led_status = "fan1_red", - .led_id = 4, - }, - { - .reg_data = 0x00, - .led_status = "fan1_off", - .led_id = 4, - }, - { - .reg_data = 0x10, - .led_status = "fan2_green", - .led_id = 5, - }, - { - .reg_data = 0x20, - .led_status = "fan2_red", - .led_id = 5, - }, - { - .reg_data = 0x00, - .led_status = "fan2_off", - .led_id = 5, - }, - { - .reg_data = 0x04, - .led_status = "fan3_green", - .led_id = 6, - }, - { - .reg_data = 0x08, - .led_status = "fan3_red", - .led_id = 6, - }, - { - .reg_data = 0x00, - .led_status = "fan3_off", - .led_id = 6, - }, - { - .reg_data = 0x01, - .led_status = "fan4_green", - .led_id = 7, - }, - { - .reg_data = 0x02, - .led_status = "fan4_red", - .led_id = 7, - }, - { - .reg_data = 0x00, - .led_status = "fan4_off", - .led_id = 7, - }, - { - .reg_data = 0x40, - .led_status = "fan5_green", - .led_id = 8, - }, - { - .reg_data = 0x80, - .led_status = "fan5_red", - .led_id = 8, - }, - { - .reg_data = 0x00, - .led_status = "fan5_off", - .led_id = 8, - }, -}; - -struct platform_led_data{ - int reg_addr; - int mask; -}; - -static struct platform_led_data led_data[] = { - { - .reg_addr = SYS_LED_REG, - .mask = 0xc0, - }, - { - .reg_addr = SYS_LED_REG, - .mask = 0x30, - }, - { - .reg_addr = SYS_LED_REG, - .mask = 0x0c, - }, - { - .reg_addr = SYS_LED_REG, - .mask = 0x03, - }, - { - .reg_addr = FAN1_LED_REG, - .mask = 0xc0, - }, - { - .reg_addr = FAN1_LED_REG, - .mask = 0x30, - }, - { - .reg_addr = FAN1_LED_REG, - .mask = 0x0c, - }, - { - .reg_addr = FAN1_LED_REG, - .mask = 0x03, - }, - { - .reg_addr = FAN2_LED_REG, - .mask = 0xc0, - }, -}; - -static ssize_t get_led_color(struct device *dev, struct device_attribute *devattr, char *buf) -{ - char str[9][20] = {0}; - int board_data; - int led_data_number; - int led_info_number; - struct cpld_platform_data *pdata = dev->platform_data; - - for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ - board_data = i2c_smbus_read_byte_data(pdata[system_cpld].client, led_data[led_data_number].reg_addr); - if(board_data >= 0){ - board_data &= led_data[led_data_number].mask; - for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ - if (led_data_number == led_info[led_info_number].led_id){ - if(board_data == led_info[led_info_number].reg_data){ - sprintf(str[led_data_number], "%s", led_info[led_info_number].led_status); - } - } - } - } - else - printk( KERN_ERR "Missing LED board data\n"); - } - return sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",str[0],str[1],str[2],str[3],str[4],str[5],str[6],str[7],str[8]); -} - -static ssize_t set_led_color(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) -{ - int led_info_number; - int led_data_number; - int str_compar; - int led_reg_value; - struct cpld_platform_data *pdata = dev->platform_data; - - for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ - str_compar = strncmp(buf,led_info[led_info_number].led_status,strlen(led_info[led_info_number].led_status)); - if(str_compar == 0){ - for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ - if(led_info[led_info_number].led_id == led_data_number){ - led_reg_value = i2c_smbus_read_byte_data(pdata[system_cpld].client, led_data[led_data_number].reg_addr); - if(led_reg_value >= 0){ - led_reg_value &= (~led_data[led_data_number].mask); - led_reg_value |= led_info[led_info_number].reg_data; - i2c_smbus_write_byte_data(pdata[system_cpld].client, (u8)(led_data[led_data_number].reg_addr & 0xff), (u8)(led_reg_value & 0xff)); - } - else - printk( KERN_ERR "Missing LED reg. data\n"); - } - } - } - } - return count; -} - -static unsigned char swpld_reg_addr; -static ssize_t get_swpld_reg_value(struct device *dev, struct device_attribute *devattr, char *buf) -{ - int ret; - struct cpld_platform_data *pdata = dev->platform_data; - - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, swpld_reg_addr); - return sprintf(buf, "0x%02x\n", ret); -} - -static ssize_t set_swpld_reg_value(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - unsigned long data; - int err; - struct cpld_platform_data *pdata = dev->platform_data; - err = kstrtoul(buf, 0, &data); - if (err){ - return err; - } - - if (data > 0xff){ - printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); - return count; - } - - i2c_smbus_write_byte_data(pdata[system_cpld].client, swpld_reg_addr, data); - - return count; -} - -static ssize_t get_swpld_reg_addr(struct device *dev, struct device_attribute *devattr, char *buf) -{ - - return sprintf(buf, "0x%02x\n", swpld_reg_addr); -} - -static ssize_t set_swpld_reg_addr(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - unsigned long data; - int err; - - err = kstrtoul(buf, 0, &data); - if (err){ - return err; - } - if (data > 0xff){ - printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); - return count; - } - swpld_reg_addr = data; - - return count; -} - -static DEVICE_ATTR(swpld_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg_value, set_swpld_reg_value); -static DEVICE_ATTR(swpld_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg_addr, set_swpld_reg_addr); -static DEVICE_ATTR(sfp_present, S_IRUGO, get_present, NULL ); -static DEVICE_ATTR(sfp_lpmode, S_IRUGO | S_IWUSR, get_lpmode, set_lpmode ); -static DEVICE_ATTR(sfp_reset, S_IRUGO | S_IWUSR, get_reset, set_reset ); -static DEVICE_ATTR(sfp_response, S_IRUGO | S_IWUSR, get_response, set_response ); -static DEVICE_ATTR(led_control, S_IRUGO | S_IWUSR, get_led_color, set_led_color); - -static struct attribute *ag9032v1_cpld_attrs[] = { - &dev_attr_swpld_reg_value.attr, - &dev_attr_swpld_reg_addr.attr, - &dev_attr_sfp_response.attr, - &dev_attr_sfp_present.attr, - &dev_attr_sfp_lpmode.attr, - &dev_attr_sfp_reset.attr, - &dev_attr_led_control.attr, - NULL, -}; - -static struct attribute_group ag9032v1_cpld_attr_grp = { - .attrs = ag9032v1_cpld_attrs, -}; - -static struct kobject *kobj_swpld; -static struct kobject *kobj_board; -static struct kobject *kobj_psu; -static struct kobject *kobj_hot_swap; -static struct kobject *kobj_controller_interrupt; -static struct kobject *kobj_BCM54616S; - -static ssize_t get_swpld_data(struct device *dev, struct device_attribute *dev_attr, char *buf) -{ - int ret; - struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); - struct device *i2cdev = kobj_to_dev(kobj_swpld); - struct cpld_platform_data *pdata = i2cdev->platform_data; - - - unsigned char reg; - int mask; - int value; - char note[150]; - - switch (attr->index) { - //attributes on BOARD - case SW_BOARD_ID: - reg = 0x00; - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); - value = ret >> 4; - sprintf(note, "\n“0x00”: L9032NB-AL-R\n“0x01”: AK9032-R\n“0x02”: AG9032-R\n“0x03”: AG9032R-R\n“0x04”: AG9032 V1-R\n"); - return sprintf(buf, "0x%02x%s", value, note); - case SW_BOARD_VER: - reg = 0x00; - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); - value = ret & 0x0F; - sprintf(note, "\n“0x00”: proto-A\n“0x01”: proto-B\n"); - return sprintf(buf, "0x%02x%s", value, note); - case SWPLD_VER: - reg = 0x01; - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); - value = ret & 0xFF; - sprintf(note, " "); - return sprintf(buf, "0x%02x%s", value, note); - //other attributes - case SYS_RST ... QSFP32_MOD_INT: - reg = controller_interrupt_data[attr->index].reg_addr; - mask = controller_interrupt_data[attr->index].reg_mask; - sprintf(note, "\n%s\n",controller_interrupt_data[attr->index].reg_note); - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); - value = (ret & (1 << mask)) >> mask; - return sprintf(buf, "%d%s", value, note); - default: - return sprintf(buf, "%d not found", attr->index); - } -} - -static ssize_t set_swpld_data(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count) -{ - int ret; - struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); - struct device *i2cdev = kobj_to_dev(kobj_board->parent); - struct cpld_platform_data *pdata = i2cdev->platform_data; - unsigned char reg; - int mask; - int value; - char note[180]; - int data; - int val; - u8 mask_out; - - ret = kstrtoint(buf, 0, &val); - - if (ret) - { - return ret; - } - if (val > 1) - { - return -EINVAL; - } - - switch (attr->index) { - case SYS_RST ... MB_B_PLD_RST: - case HS1_PWR_OK ... HS2_PWR_OK: - case B54616_RST: - case QSFP_01TO08_MASK_INT... QSFP_25TO32_MASK_ABS: - reg = controller_interrupt_data[attr->index].reg_addr; - mask = controller_interrupt_data[attr->index].reg_mask; - break; - default: - return sprintf(buf, "%d not found", attr->index); - } - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); - mask_out = ret & ~((u8)(1 << mask)); - data = mask_out | (val << mask); - i2c_smbus_write_byte_data(pdata[system_cpld].client, reg, (u8)(data & 0xff)); - ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); - return count; -} - -static SENSOR_DEVICE_ATTR(sw_board_id, S_IRUGO, get_swpld_data, NULL, SW_BOARD_ID); -static SENSOR_DEVICE_ATTR(sw_board_ver, S_IRUGO, get_swpld_data, NULL, SW_BOARD_VER); -static SENSOR_DEVICE_ATTR(swpld_ver, S_IRUGO, get_swpld_data, NULL, SWPLD_VER); -static SENSOR_DEVICE_ATTR(sys_rst, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, SYS_RST); -static SENSOR_DEVICE_ATTR(B56960_rst, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, B56960_RST); -static SENSOR_DEVICE_ATTR(mb_a_pld_rst, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, MB_A_PLD_RST); -static SENSOR_DEVICE_ATTR(mb_b_pld_rst, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, MB_B_PLD_RST); - -static struct attribute *ag9032v1_swpld_attrs_board[] = { - &sensor_dev_attr_sw_board_id.dev_attr.attr, - &sensor_dev_attr_sw_board_ver.dev_attr.attr, - &sensor_dev_attr_swpld_ver.dev_attr.attr, - &sensor_dev_attr_sys_rst.dev_attr.attr, - &sensor_dev_attr_B56960_rst.dev_attr.attr, - &sensor_dev_attr_mb_a_pld_rst.dev_attr.attr, - &sensor_dev_attr_mb_b_pld_rst.dev_attr.attr, - NULL, -}; - -static SENSOR_DEVICE_ATTR(psu1_pwr_ok, S_IRUGO, get_swpld_data, NULL, PSU1_PWR_OK); -static SENSOR_DEVICE_ATTR(psu2_pwr_ok, S_IRUGO, get_swpld_data, NULL, PSU2_PWR_OK); - -static struct attribute *ag9032v1_swpld_attrs_psu[] = { - &sensor_dev_attr_psu1_pwr_ok.dev_attr.attr, - &sensor_dev_attr_psu2_pwr_ok.dev_attr.attr, - NULL, -}; - -static SENSOR_DEVICE_ATTR(hs1_pwr_ok, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, HS1_PWR_OK); -static SENSOR_DEVICE_ATTR(hs2_pwr_ok, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, HS2_PWR_OK); - -static struct attribute *ag9032v1_swpld_attrs_hot_swap[] = { - &sensor_dev_attr_hs1_pwr_ok.dev_attr.attr, - &sensor_dev_attr_hs2_pwr_ok.dev_attr.attr, - NULL, -}; - -static SENSOR_DEVICE_ATTR(B54616_rst, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, B54616_RST ); -static SENSOR_DEVICE_ATTR(B54616_int, S_IRUGO, get_swpld_data, NULL, B54616_INT ); -static SENSOR_DEVICE_ATTR(B54616_mask_int, S_IRUGO, get_swpld_data, NULL, B54616_MASK_INT); - -static struct attribute *ag9032v1_swpld_attrs_BCM54616S[] = { - &sensor_dev_attr_B54616_rst.dev_attr.attr, - &sensor_dev_attr_B54616_int.dev_attr.attr, - &sensor_dev_attr_B54616_mask_int.dev_attr.attr, - NULL, -}; - -static SENSOR_DEVICE_ATTR(pb_hs_int, S_IRUGO, get_swpld_data, NULL, PB_HS_INT); -static SENSOR_DEVICE_ATTR(mb_hs_int, S_IRUGO, get_swpld_data, NULL, MB_HS_INT); -static SENSOR_DEVICE_ATTR(pb_pwr_int, S_IRUGO, get_swpld_data, NULL, PB_PWR_INT); -static SENSOR_DEVICE_ATTR(mb_pwr_int, S_IRUGO, get_swpld_data, NULL, MB_PWR_INT); -static SENSOR_DEVICE_ATTR(fan_int, S_IRUGO, get_swpld_data, NULL, FAN_INT); -static SENSOR_DEVICE_ATTR(pb_hs_mask_int, S_IRUGO, get_swpld_data, NULL, PB_HS_MASK_INT); -static SENSOR_DEVICE_ATTR(mb_hs_mask_int, S_IRUGO, get_swpld_data, NULL, MB_HS_MASK_INT); -static SENSOR_DEVICE_ATTR(pb_pwr1_mask_int, S_IRUGO, get_swpld_data, NULL, PB_PWR1_MASK_INT); -static SENSOR_DEVICE_ATTR(pb_pwr2_mask_int, S_IRUGO, get_swpld_data, NULL, PB_PWR2_MASK_INT); -static SENSOR_DEVICE_ATTR(fan_mask_int, S_IRUGO, get_swpld_data, NULL, FAN_MASK_INT); -static SENSOR_DEVICE_ATTR(qsfp_01to08_int, S_IRUGO, get_swpld_data, NULL, QSFP_01TO08_INT); -static SENSOR_DEVICE_ATTR(qsfp_08to16_int, S_IRUGO, get_swpld_data, NULL, QSFP_08TO16_INT); -static SENSOR_DEVICE_ATTR(qsfp_17to24_int, S_IRUGO, get_swpld_data, NULL, QSFP_17TO24_INT); -static SENSOR_DEVICE_ATTR(qsfp_25to32_int, S_IRUGO, get_swpld_data, NULL, QSFP_25TO32_INT); -static SENSOR_DEVICE_ATTR(qsfp_01to08_abs, S_IRUGO, get_swpld_data, NULL, QSFP_01TO08_ABS); -static SENSOR_DEVICE_ATTR(qsfp_08to16_abs, S_IRUGO, get_swpld_data, NULL, QSFP_08TO16_ABS); -static SENSOR_DEVICE_ATTR(qsfp_17to24_abs, S_IRUGO, get_swpld_data, NULL, QSFP_17TO24_ABS); -static SENSOR_DEVICE_ATTR(qsfp_25to32_abs, S_IRUGO, get_swpld_data, NULL, QSFP_25TO32_ABS); -static SENSOR_DEVICE_ATTR(qsfp_01to08_mask_int, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_01TO08_MASK_INT); -static SENSOR_DEVICE_ATTR(qsfp_08to16_mask_int, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_08TO16_MASK_INT); -static SENSOR_DEVICE_ATTR(qsfp_17to24_mask_int, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_17TO24_MASK_INT); -static SENSOR_DEVICE_ATTR(qsfp_25to32_mask_int, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_25TO32_MASK_INT); -static SENSOR_DEVICE_ATTR(qsfp_01to08_mask_abs, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_01TO08_MASK_ABS); -static SENSOR_DEVICE_ATTR(qsfp_08to16_mask_abs, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_08TO16_MASK_ABS); -static SENSOR_DEVICE_ATTR(qsfp_17to24_mask_abs, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_17TO24_MASK_ABS); -static SENSOR_DEVICE_ATTR(qsfp_25to32_mask_abs, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_25TO32_MASK_ABS); -static SENSOR_DEVICE_ATTR(qsfp01_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP01_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp02_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP02_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp03_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP03_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp04_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP04_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp05_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP05_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp06_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP06_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp07_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP07_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp08_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP08_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp09_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP09_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp10_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP10_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp11_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP11_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp12_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP12_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp13_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP13_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp14_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP14_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp15_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP15_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp16_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP16_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp17_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP17_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp18_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP18_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp19_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP19_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp20_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP20_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp21_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP21_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp22_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP22_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp23_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP23_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp24_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP24_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp25_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP25_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp26_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP26_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp27_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP27_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp28_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP28_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp29_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP29_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp30_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP30_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp31_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP31_MOD_INT); -static SENSOR_DEVICE_ATTR(qsfp32_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP32_MOD_INT); - -static struct attribute *ag9032v1_swpld_attrs_controller_interrupt[] = { - &sensor_dev_attr_pb_hs_int.dev_attr.attr, - &sensor_dev_attr_mb_hs_int.dev_attr.attr, - &sensor_dev_attr_pb_pwr_int.dev_attr.attr, - &sensor_dev_attr_mb_pwr_int.dev_attr.attr, - &sensor_dev_attr_fan_int.dev_attr.attr, - &sensor_dev_attr_pb_hs_mask_int.dev_attr.attr, - &sensor_dev_attr_mb_hs_mask_int.dev_attr.attr, - &sensor_dev_attr_pb_pwr1_mask_int.dev_attr.attr, - &sensor_dev_attr_pb_pwr2_mask_int.dev_attr.attr, - &sensor_dev_attr_fan_mask_int.dev_attr.attr, - &sensor_dev_attr_qsfp_01to08_int.dev_attr.attr, - &sensor_dev_attr_qsfp_08to16_int.dev_attr.attr, - &sensor_dev_attr_qsfp_17to24_int.dev_attr.attr, - &sensor_dev_attr_qsfp_25to32_int.dev_attr.attr, - &sensor_dev_attr_qsfp_01to08_abs.dev_attr.attr, - &sensor_dev_attr_qsfp_08to16_abs.dev_attr.attr, - &sensor_dev_attr_qsfp_17to24_abs.dev_attr.attr, - &sensor_dev_attr_qsfp_25to32_abs.dev_attr.attr, - &sensor_dev_attr_qsfp_01to08_mask_int.dev_attr.attr, - &sensor_dev_attr_qsfp_08to16_mask_int.dev_attr.attr, - &sensor_dev_attr_qsfp_17to24_mask_int.dev_attr.attr, - &sensor_dev_attr_qsfp_25to32_mask_int.dev_attr.attr, - &sensor_dev_attr_qsfp_01to08_mask_abs.dev_attr.attr, - &sensor_dev_attr_qsfp_08to16_mask_abs.dev_attr.attr, - &sensor_dev_attr_qsfp_17to24_mask_abs.dev_attr.attr, - &sensor_dev_attr_qsfp_25to32_mask_abs.dev_attr.attr, - &sensor_dev_attr_qsfp01_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp02_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp03_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp04_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp05_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp06_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp07_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp08_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp09_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp10_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp11_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp12_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp13_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp14_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp15_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp16_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp17_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp18_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp19_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp20_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp21_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp22_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp23_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp24_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp25_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp26_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp27_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp28_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp29_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp30_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp31_mod_int.dev_attr.attr, - &sensor_dev_attr_qsfp32_mod_int.dev_attr.attr, - NULL, -}; - -static struct attribute_group ag9032v1_swpld_attr_grp_board = { - .attrs = ag9032v1_swpld_attrs_board, -}; -static struct attribute_group ag9032v1_swpld_attr_grp_psu = { - .attrs = ag9032v1_swpld_attrs_psu, -}; -static struct attribute_group ag9032v1_swpld_attr_grp_hot_swap = { - .attrs = ag9032v1_swpld_attrs_hot_swap, -}; -static struct attribute_group ag9032v1_swpld_attr_grp_BCM54616S = { - .attrs = ag9032v1_swpld_attrs_BCM54616S, -}; -static struct attribute_group ag9032v1_swpld_attr_grp_controller_interrupt = { - .attrs = ag9032v1_swpld_attrs_controller_interrupt, -}; - -/* CPLD -- driver */ -static int __init cpld_probe(struct platform_device *pdev) -{ - struct cpld_platform_data *pdata; - struct i2c_adapter *parent; - int ret; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "CPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(BUS6); - if (!parent) { - printk(KERN_WARNING "Parent adapter (%d) not found\n", BUS6); - return -ENODEV; - } - - pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); - if (!pdata[system_cpld].client) { - printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); - goto error; - } - - kobj_swpld = &pdev->dev.kobj; - kobj_board = kobject_create_and_add("Board", &pdev->dev.kobj); - if (!kobj_board){ - printk(KERN_WARNING "Fail to create directory"); - goto error; - } - - kobj_psu = kobject_create_and_add("PSU", &pdev->dev.kobj); - if (!kobj_psu){ - printk(KERN_WARNING "Fail to create directory"); - goto error; - } - - kobj_hot_swap = kobject_create_and_add("HOT_SWAP", &pdev->dev.kobj); - if (!kobj_hot_swap){ - printk(KERN_WARNING "Fail to create directory"); - goto error; - } - - kobj_controller_interrupt = kobject_create_and_add("Controller_interrupt", &pdev->dev.kobj); - if (!kobj_controller_interrupt){ - printk(KERN_WARNING "Fail to create directory"); - goto error; - } - - kobj_BCM54616S = kobject_create_and_add("BCM54616S", &pdev->dev.kobj); - if (!kobj_BCM54616S){ - printk(KERN_WARNING "Fail to create directory"); - goto error; - } - - ret = sysfs_create_group(kobj_board, &ag9032v1_swpld_attr_grp_board); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - goto error; - } - - ret = sysfs_create_group(kobj_psu, &ag9032v1_swpld_attr_grp_psu); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - goto error; - } - - ret = sysfs_create_group(kobj_hot_swap, &ag9032v1_swpld_attr_grp_hot_swap); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - goto error; - } - - ret = sysfs_create_group(kobj_BCM54616S, &ag9032v1_swpld_attr_grp_BCM54616S); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - goto error; - } - - ret = sysfs_create_group(kobj_controller_interrupt, &ag9032v1_swpld_attr_grp_controller_interrupt); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - goto error; - } - - ret = sysfs_create_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_grp); - if (ret) { - printk(KERN_WARNING "Fail to create cpld attribute group"); - goto error; - } - - return 0; - -error: - kobject_put(kobj_swpld); - kobject_put(kobj_board); - kobject_put(kobj_psu); - kobject_put(kobj_hot_swap); - kobject_put(kobj_controller_interrupt); - kobject_put(kobj_BCM54616S); - i2c_unregister_device(pdata[system_cpld].client); - i2c_put_adapter(parent); - - return -ENODEV; -} - -static int __exit cpld_remove(struct platform_device *pdev) -{ - struct i2c_adapter *parent = NULL; - struct cpld_platform_data *pdata = pdev->dev.platform_data; - sysfs_remove_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_grp); - sysfs_remove_group(kobj_board, &ag9032v1_swpld_attr_grp_board); - - if (!pdata) { - dev_err(&pdev->dev, "Missing platform data\n"); - } - else { - kobject_put(kobj_swpld); - kobject_put(kobj_board); - kobject_put(kobj_psu); - kobject_put(kobj_hot_swap); - kobject_put(kobj_controller_interrupt); - kobject_put(kobj_BCM54616S); - if (pdata[system_cpld].client) { - if (!parent) { - parent = (pdata[system_cpld].client)->adapter; - } - i2c_unregister_device(pdata[system_cpld].client); - } - } - i2c_put_adapter(parent); - - return 0; -} - -static struct platform_driver cpld_driver = { - .probe = cpld_probe, - .remove = __exit_p(cpld_remove), - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9032v1-swpld", - }, -}; - -/*---------------- CPLD - end ------------- */ - -/*---------------- MUX - start ------------- */ - -struct swpld_mux_platform_data { - int parent; - int base_nr; - int reg_addr; - struct i2c_client *cpld; -}; - -struct swpld_mux { - struct i2c_adapter *parent; - struct i2c_adapter **child; - struct swpld_mux_platform_data data; -}; -static struct swpld_mux_platform_data ag9032v1_swpld_mux_platform_data[] = { - { - .parent = BUS3, - .base_nr = BUS3_BASE_NUM, - .cpld = NULL, - .reg_addr = BUS3_MUX_REG ,// the i2c register address which for select mux TEMP(FAN) - }, - { - .parent = BUS4, - .base_nr = BUS4_BASE_NUM , - .cpld = NULL, - .reg_addr = BUS4_MUX_REG , - }, - { - .parent = BUS5, - .base_nr = BUS5_BASE_NUM , - .cpld = NULL, - .reg_addr = BUS5_MUX_REG , - }, -}; - -static struct platform_device ag9032v1_swpld_mux[] = { - { - .name = "delta-ag9032v1-swpld-mux", - .id = 0, - .dev = { - .platform_data = &ag9032v1_swpld_mux_platform_data[0], - .release = device_release, - }, - }, - { - .name = "delta-ag9032v1-swpld-mux", - .id = 1, - .dev = { - .platform_data = &ag9032v1_swpld_mux_platform_data[1], - .release = device_release, - }, - }, - { - .name = "delta-ag9032v1-swpld-mux", - .id = 2, - .dev = { - .platform_data = &ag9032v1_swpld_mux_platform_data[2], - .release = device_release, - }, - }, -}; - -static int cpld_reg_write_byte(struct i2c_client *client, u8 regaddr, u8 val) -{ - union i2c_smbus_data data; - - data.byte = val; - return client->adapter->algo->smbus_xfer(client->adapter, client->addr, - client->flags, - I2C_SMBUS_WRITE, - regaddr, I2C_SMBUS_BYTE_DATA, &data); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) -{ - struct swpld_mux *mux = data; - u8 swpld_mux_val=0; - - if ( mux->data.base_nr == BUS3_BASE_NUM ) - { - switch (chan) { - case 0: - swpld_mux_val = TEMP_FAN_VAL; - break; - case 1: - swpld_mux_val = FAN_EEPROM1_VAL; - break; - case 2: - swpld_mux_val = FAN_EEPROM2_VAL; - break; - case 3: - swpld_mux_val = FAN_EEPROM3_VAL; - break; - case 4: - swpld_mux_val = FAN_EEPROM4_VAL; - break; - case 5: - swpld_mux_val = FAN_EEPROM5_VAL; - break; - case 6: - swpld_mux_val = FANIO_CTL_VAL; - break; - case 7: - case 8: - swpld_mux_val = FAN_CTRL_VAL; - break; - } - } - else if ( mux->data.base_nr == BUS4_BASE_NUM ) - { - switch (chan) { - case 0: - swpld_mux_val = PSU1_VAL; - break; - case 1: - swpld_mux_val = PSU2_VAL; - break; - case 2: - swpld_mux_val = HOT_SWAP1_VAL; - break; - case 3: - swpld_mux_val = HOT_SWAP2_VAL; - break; - } - } - else if ( mux->data.base_nr == BUS5_BASE_NUM ){ - if (chan < 9){ - swpld_mux_val = (u8)(chan) + 0x01; - } - else if (8 < chan && chan < 19){ - swpld_mux_val = (u8)(chan - 9) + 0x10; - } - else if (18 < chan && chan < 29){ - swpld_mux_val = (u8)(chan - 19) + 0x20; - } - else if (28 < chan && chan < 39){ - swpld_mux_val = (u8)(chan - 29) + 0x30; - } - else{ - swpld_mux_val = 0x00; - } - } - else - { - swpld_mux_val = 0x00; - } - return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); -} -#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) -static int swpld_mux_select(struct i2c_mux_core *muxc, u32 chan) -{ - struct swpld_mux *mux = i2c_mux_priv(muxc); - u8 swpld_mux_val=0; - - if ( mux->data.base_nr == BUS3_BASE_NUM ) - { - switch (chan) { - case 0: - swpld_mux_val = TEMP_FAN_VAL; - break; - case 1: - swpld_mux_val = FAN_EEPROM1_VAL; - break; - case 2: - swpld_mux_val = FAN_EEPROM2_VAL; - break; - case 3: - swpld_mux_val = FAN_EEPROM3_VAL; - break; - case 4: - swpld_mux_val = FAN_EEPROM4_VAL; - break; - case 5: - swpld_mux_val = FAN_EEPROM5_VAL; - break; - case 6: - swpld_mux_val = FANIO_CTL_VAL; - break; - case 7: - case 8: - swpld_mux_val = FAN_CTRL_VAL; - break; - } - } - else if ( mux->data.base_nr == BUS4_BASE_NUM ) - { - switch (chan) { - case 0: - swpld_mux_val = PSU1_VAL; - break; - case 1: - swpld_mux_val = PSU2_VAL; - break; - case 2: - swpld_mux_val = HOT_SWAP1_VAL; - break; - case 3: - swpld_mux_val = HOT_SWAP2_VAL; - break; - } - } - else if ( mux->data.base_nr == BUS5_BASE_NUM ){ - if (chan < 9){ - swpld_mux_val = (u8)(chan) + 0x01; - } - else if (8 < chan && chan < 19){ - swpld_mux_val = (u8)(chan - 9) + 0x10; - } - else if (18 < chan && chan < 29){ - swpld_mux_val = (u8)(chan - 19) + 0x20; - } - else if (28 < chan && chan < 39){ - swpld_mux_val = (u8)(chan - 29) + 0x30; - } - else{ - swpld_mux_val = 0x00; - } - } - else - { - swpld_mux_val = 0x00; - } - - return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); -} -#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static int __init swpld_mux_probe(struct platform_device *pdev) -{ - struct swpld_mux *mux; - struct swpld_mux_platform_data *pdata; - struct i2c_adapter *parent; - int i, ret, dev_num; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "SWPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); - return -ENODEV; - } - /* Judge bus number to decide how many devices*/ - switch (pdata->parent) { - case BUS3: - dev_num = BUS3_DEV_NUM; - break; - case BUS4: - dev_num = BUS4_DEV_NUM; - break; - case BUS5: - dev_num = BUS5_DEV_NUM; - break; - default : - dev_num = DEFAULT_NUM; - break; - } - - mux = kzalloc(sizeof(*mux), GFP_KERNEL); - if (!mux) { - ret = -ENOMEM; - printk(KERN_ERR "Failed to allocate memory for mux\n"); - goto alloc_failed; - } - - mux->parent = parent; - mux->data = *pdata; - mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); - if (!mux->child) { - ret = -ENOMEM; - printk(KERN_ERR "Failed to allocate memory for device on mux\n"); - goto alloc_failed2; - } - - for (i = 0; i < dev_num; i++) { - int nr = pdata->base_nr + i; - unsigned int class = 0; - - mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, - nr, i, class, - swpld_mux_select, NULL); - if (!mux->child[i]) { - ret = -ENODEV; - dev_err(&pdev->dev, "Failed to add adapter %d\n", i); - goto add_adapter_failed; - } - } - - platform_set_drvdata(pdev, mux); - return 0; - -add_adapter_failed: - for (; i > 0; i--) - i2c_del_mux_adapter(mux->child[i - 1]); - kfree(mux->child); -alloc_failed2: - kfree(mux); -alloc_failed: - i2c_put_adapter(parent); - - return ret; -} -#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) -static int __init swpld_mux_probe(struct platform_device *pdev) -{ - struct i2c_mux_core *muxc; - struct swpld_mux *mux; - struct swpld_mux_platform_data *pdata; - struct i2c_adapter *parent; - int i, ret, dev_num; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "SWPLD platform data not found\n"); - return -ENODEV; - } - - mux = kzalloc(sizeof(*mux), GFP_KERNEL); - if (!mux) { - printk(KERN_ERR "Failed to allocate memory for mux\n"); - return -ENOMEM; - } - mux->data = *pdata; - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - kfree(mux); - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); - return -ENODEV; - } - - /* Judge bus number to decide how many devices*/ - switch (pdata->parent) { - case BUS3: - dev_num = BUS3_DEV_NUM; - break; - case BUS4: - dev_num = BUS4_DEV_NUM; - break; - case BUS5: - dev_num = BUS5_DEV_NUM; - break; - default : - dev_num = DEFAULT_NUM; - break; - } - - - - muxc = i2c_mux_alloc(parent, &pdev->dev, dev_num, 0, 0, - swpld_mux_select, NULL); - if (!muxc) { - ret = -ENOMEM; - goto alloc_failed; - } - muxc->priv = mux; - platform_set_drvdata(pdev, muxc); - - - for (i = 0; i < dev_num; i++) { - int nr = pdata->base_nr + i; - unsigned int class = 0; - - ret = i2c_mux_add_adapter(muxc, nr, i, class); - if (ret) { - dev_err(&pdev->dev, "Failed to add adapter %d\n", i); - goto add_adapter_failed; - } - } - - dev_info(&pdev->dev, "%d port mux on %s adapter\n", dev_num, parent->name); - - return 0; - -add_adapter_failed: - i2c_mux_del_adapters(muxc); -alloc_failed: - kfree(mux); - i2c_put_adapter(parent); - - return ret; -} -#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static int __exit swpld_mux_remove(struct platform_device *pdev) -{ - int i; - struct swpld_mux *mux = platform_get_drvdata(pdev); - struct swpld_mux_platform_data *pdata; - struct i2c_adapter *parent; - int dev_num; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "SWPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", - pdata->parent); - return -ENODEV; - } - switch (pdata->parent) { - case BUS3: - dev_num = BUS3_DEV_NUM; - break; - case BUS4: - dev_num = BUS4_DEV_NUM; - break; - case BUS5: - dev_num = BUS5_DEV_NUM; - break; - default : - dev_num = DEFAULT_NUM; - break; - } - - for (i = 0; i < dev_num; i++) - i2c_del_mux_adapter(mux->child[i]); - - platform_set_drvdata(pdev, NULL); - i2c_put_adapter(mux->parent); - kfree(mux->child); - kfree(mux); - - return 0; -} -#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) -static int __exit swpld_mux_remove(struct platform_device *pdev) -{ - struct i2c_mux_core *muxc = platform_get_drvdata(pdev); - struct i2c_adapter *parent=muxc->parent; - - i2c_mux_del_adapters(muxc); - i2c_put_adapter(parent); - - return 0; -} -#endif - -static struct platform_driver swpld_mux_driver = { - .probe = swpld_mux_probe, - .remove = __exit_p(swpld_mux_remove), /* TODO */ - .driver = { - .owner = THIS_MODULE, - .name = "delta-ag9032v1-swpld-mux", - }, -}; -/*---------------- MUX - end ------------- */ - -/*---------------- module initialization ------------- */ -static int __init delta_ag9032v1_platform_init(void) -{ -// struct i2c_client *client; - struct i2c_adapter *adapter; - struct cpld_platform_data *cpld_pdata; - struct swpld_mux_platform_data *swpld_mux_pdata; - int ret,i = 0; - printk("ag9032v1_platform module initialization\n"); - - //Use pca9547 in i2c_mux_pca954x.c - adapter = i2c_get_adapter(BUS1); - //client = i2c_new_device(adapter, &i2c_info_pca9547[0]); - i2c_client_9547 = i2c_new_device(adapter, &i2c_info_pca9547[0]); - - i2c_put_adapter(adapter); - - // set the CPLD prob and remove - ret = platform_driver_register(&cpld_driver); - if (ret) { - printk(KERN_WARNING "Fail to register cpld driver\n"); - goto error_cpld_driver; - } - // register the mux prob which call the CPLD - ret = platform_driver_register(&swpld_mux_driver); - if (ret) { - printk(KERN_WARNING "Fail to register swpld mux driver\n"); - goto error_swpld_mux_driver; - } - - // register the i2c devices - ret = platform_driver_register(&i2c_device_driver); - if (ret) { - printk(KERN_WARNING "Fail to register i2c device driver\n"); - goto error_i2c_device_driver; - } - - // register the CPLD - ret = platform_device_register(&ag9032v1_cpld); - if (ret) { - printk(KERN_WARNING "Fail to create cpld device\n"); - goto error_ag9032v1_cpld; - } - // link the CPLD and the Mux - cpld_pdata = ag9032v1_cpld.dev.platform_data; - - for (i = 0; i < ARRAY_SIZE(ag9032v1_swpld_mux); i++) - { - swpld_mux_pdata = ag9032v1_swpld_mux[i].dev.platform_data; - swpld_mux_pdata->cpld = cpld_pdata[system_cpld].client; - ret = platform_device_register(&ag9032v1_swpld_mux[i]); - if (ret) { - printk(KERN_WARNING "Fail to create swpld mux %d\n", i); - goto error_ag9032v1_swpld_mux; - } - } - - for (i = 0; i < ARRAY_SIZE(ag9032v1_i2c_device); i++) - { - ret = platform_device_register(&ag9032v1_i2c_device[i]); - if (ret) { - printk(KERN_WARNING "Fail to create i2c device %d\n", i); - goto error_ag9032v1_i2c_device; - } - } - - if (ret) - goto error_ag9032v1_swpld_mux; - - return 0; - -error_ag9032v1_i2c_device: - i--; - for (; i >= 0; i--) { - platform_device_unregister(&ag9032v1_i2c_device[i]); - } - i = ARRAY_SIZE(ag9032v1_swpld_mux); -error_ag9032v1_swpld_mux: - i--; - for (; i >= 0; i--) { - platform_device_unregister(&ag9032v1_swpld_mux[i]); - } - platform_driver_unregister((struct platform_driver *) &ag9032v1_cpld); -error_ag9032v1_cpld: - platform_driver_unregister(&i2c_device_driver); -error_i2c_device_driver: - platform_driver_unregister(&swpld_mux_driver); -error_swpld_mux_driver: - platform_driver_unregister(&cpld_driver); -error_cpld_driver: - return ret; -} - -static void __exit delta_ag9032v1_platform_exit(void) -{ - int i = 0; - - for ( i = 0; i < ARRAY_SIZE(ag9032v1_i2c_device); i++ ) { - platform_device_unregister(&ag9032v1_i2c_device[i]); - } - - for (i = 0; i < ARRAY_SIZE(ag9032v1_swpld_mux); i++) { - platform_device_unregister(&ag9032v1_swpld_mux[i]); - } - - platform_device_unregister(&ag9032v1_cpld); - platform_driver_unregister(&i2c_device_driver); - platform_driver_unregister(&cpld_driver); - platform_driver_unregister(&swpld_mux_driver); - - i2c_unregister_device(i2c_client_9547); -} - -module_init(delta_ag9032v1_platform_init); -module_exit(delta_ag9032v1_platform_exit); - -MODULE_DESCRIPTION("DNI ag9032v1 Platform Support"); -MODULE_AUTHOR("Neal Tai "); -MODULE_LICENSE("GPL"); +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BUS3_DEV_NUM 9 +#define BUS4_DEV_NUM 6 +#define BUS5_DEV_NUM 32 +#define DEFAULT_NUM 1 +#define BUS3_BASE_NUM 30 +#define BUS4_BASE_NUM 40 +#define BUS5_BASE_NUM 50 + +#define BUS3_MUX_REG 0x21 +#define BUS4_MUX_REG 0x21 +#define BUS5_MUX_REG 0x20 + +#define TEMP_FAN_VAL 0x06 +#define FANIO_CTL_VAL 0x07 +#define FAN_CTRL_VAL 0x05 +#define PSU1_VAL 0x00 +#define PSU2_VAL 0x20 +#define HOT_SWAP1_VAL 0x10 +#define HOT_SWAP2_VAL 0x30 +#define FAN_EEPROM1_VAL 0x00 +#define FAN_EEPROM2_VAL 0x01 +#define FAN_EEPROM3_VAL 0x02 +#define FAN_EEPROM4_VAL 0x03 +#define FAN_EEPROM5_VAL 0x04 + +#define SWPLD_REG 0x31 +#define SWPLD_SFP_MUX_REG 0x20 + +#define SYS_LED_REG 0x1C +#define FAN1_LED_REG 0x1D +#define FAN2_LED_REG 0x1E + +#define SFP_PRESENCE_1 0x38 +#define SFP_PRESENCE_2 0x39 +#define SFP_PRESENCE_3 0x3A +#define SFP_PRESENCE_4 0x3B + +#define SFP_LP_MODE_1 0x34 +#define SFP_LP_MODE_2 0x35 +#define SFP_LP_MODE_3 0x36 +#define SFP_LP_MODE_4 0x37 + +#define SFP_RESET_1 0x3C +#define SFP_RESET_2 0x3D +#define SFP_RESET_3 0x3E +#define SFP_RESET_4 0x3F + +#define SFP_RESPONSE_1 0x30 +#define SFP_RESPONSE_2 0x31 +#define SFP_RESPONSE_3 0x32 +#define SFP_RESPONSE_4 0x33 + +#define SFF8436_INFO(data) \ + .type = "sff8436", .addr = 0x50, .platform_data = (data) + +#define SFF_8346_PORT(eedata) \ + .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY + +#define ag9032v1_i2c_device_num(NUM){ \ + .name = "delta-ag9032v1-i2c-device", \ + .id = NUM, \ + .dev = { \ + .platform_data = &ag9032v1_i2c_device_platform_data[NUM], \ + .release = device_release, \ + }, \ +} + +/*Define struct to get client of i2c_new_deivce */ +struct i2c_client * i2c_client_9547; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, +}; + +unsigned char reverse_8bits(unsigned char c) +{ + unsigned char s = 0; + int i; + for (i = 0; i < 8; ++i) { + s <<= 1; + s |= c & 1; + c >>= 1; + } + return s; +} +/*---------------- I2C device - start ------------- */ +static void device_release(struct device *dev) +{ + return; +} + +struct i2c_device_platform_data { + int parent; + struct i2c_board_info info; + struct i2c_client *client; +}; +/* pca9547 - add 8 bus */ +static struct pca954x_platform_mode pca954x_mode[] = { + { .adap_id = 2, + .deselect_on_exit = 1, + }, + { .adap_id = 3, + .deselect_on_exit = 1, + }, + { .adap_id = 4, + .deselect_on_exit = 1, + }, + { .adap_id = 5, + .deselect_on_exit = 1, + }, + { .adap_id = 6, + .deselect_on_exit = 1, + }, + { .adap_id = 7, + .deselect_on_exit = 1, + }, + { .adap_id = 8, + .deselect_on_exit = 1, + }, + { .adap_id = 9, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_data pca954x_data = { + .modes = pca954x_mode, + .num_modes = ARRAY_SIZE(pca954x_mode), +}; + +static struct i2c_board_info __initdata i2c_info_pca9547[] = +{ + { + I2C_BOARD_INFO("pca9547", 0x71), + .platform_data = &pca954x_data, + }, +}; + + +static struct sff_8436_platform_data sff_8436_port[] = { + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, + { SFF_8346_PORT() }, +}; + +static struct i2c_device_platform_data ag9032v1_i2c_device_platform_data[] = { + { + /* tmp75 (0x4d) */ + .parent = 2, + .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, + .client = NULL, + }, + { + /* id eeprom (0x53) */ + .parent = 2, + .info = { I2C_BOARD_INFO("24c02", 0x53) }, + .client = NULL, + }, + { + /* tmp75 (0x4c) */ + .parent = 7, + .info = { I2C_BOARD_INFO("tmp75", 0x4c) }, + .client = NULL, + }, + { + /* tmp75 (0x4d) */ + .parent = 7, + .info = { I2C_BOARD_INFO("tmp75", 0x4d) }, + .client = NULL, + }, + { + /* tmp75 (0x4e) */ + .parent = 7, + .info = { I2C_BOARD_INFO("tmp75", 0x4e) }, + .client = NULL, + }, + { + /* tmp75 (0x4f) */ + .parent = 30, + .info = { I2C_BOARD_INFO("tmp75", 0x4f) }, + .client = NULL, + }, + { + /* FAN 1 Controller (0x2c) */ + .parent = 37, + .info = { I2C_BOARD_INFO("emc2305", 0x2c) }, + .client = NULL, + }, + { + /* FAN 2 Controller (0x2d) */ + .parent = 38, + .info = { I2C_BOARD_INFO("emc2305", 0x2d) }, + .client = NULL, + }, + { + /* psu 1 (0x58) */ + .parent = 40, + .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = (void *) 0 }, + .client = NULL, + }, + { + /* psu 2 (0x58) */ + .parent = 41, + .info = { .type = "dni_ag9032v1_psu", .addr = 0x58, .platform_data = (void *) 1 }, + .client = NULL, + }, + { + /* hot-swap 1 (0x40) */ + .parent = 42, + .info = { .type = "ltc4215", .addr = 0x40, .platform_data = (void *) 0 }, + .client = NULL, + }, + { + /* hot-swap 2 (0x40) */ + .parent = 43, + .info = { .type = "ltc4215", .addr = 0x40, .platform_data = (void *) 1 }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 50, + .info = { SFF8436_INFO(&sff_8436_port[0]) }, + .client = NULL, + }, + { + /* qsfp 2 (0x50) */ + .parent = 51, + .info = { SFF8436_INFO(&sff_8436_port[1]) }, + .client = NULL, + }, + { + /* qsfp 3 (0x50) */ + .parent = 52, + .info = { SFF8436_INFO(&sff_8436_port[2]) }, + .client = NULL, + }, + { + /* qsfp 4 (0x50) */ + .parent = 53, + .info = { SFF8436_INFO(&sff_8436_port[3]) }, + .client = NULL, + }, + { + /* qsfp 5 (0x50) */ + .parent = 54, + .info = { SFF8436_INFO(&sff_8436_port[4]) }, + .client = NULL, + }, + { + /* qsfp 6 (0x50) */ + .parent = 55, + .info = { SFF8436_INFO(&sff_8436_port[5]) }, + .client = NULL, + }, + { + /* qsfp 7 (0x50) */ + .parent = 56, + .info = { SFF8436_INFO(&sff_8436_port[6]) }, + .client = NULL, + }, + { + /* qsfp 8 (0x50) */ + .parent = 57, + .info = { SFF8436_INFO(&sff_8436_port[7]) }, + .client = NULL, + }, + { + /* qsfp 9 (0x50) */ + .parent = 58, + .info = { SFF8436_INFO(&sff_8436_port[8]) }, + .client = NULL, + }, + { + /* qsfp 10 (0x50) */ + .parent = 59, + .info = { SFF8436_INFO(&sff_8436_port[9]) }, + .client = NULL, + }, + { + /* qsfp 11 (0x50) */ + .parent = 60, + .info = { SFF8436_INFO(&sff_8436_port[10]) }, + .client = NULL, + }, + { + /* qsfp 12 (0x50) */ + .parent = 61, + .info = { SFF8436_INFO(&sff_8436_port[11]) }, + .client = NULL, + }, + { + /* qsfp 13 (0x50) */ + .parent = 62, + .info = { SFF8436_INFO(&sff_8436_port[12]) }, + .client = NULL, + }, + { + /* qsfp 14 (0x50) */ + .parent = 63, + .info = { SFF8436_INFO(&sff_8436_port[13]) }, + .client = NULL, + }, + { + /* qsfp 15 (0x50) */ + .parent = 64, + .info = { SFF8436_INFO(&sff_8436_port[14]) }, + .client = NULL, + }, + { + /* qsfp 16 (0x50) */ + .parent = 65, + .info = { SFF8436_INFO(&sff_8436_port[15]) }, + .client = NULL, + }, + { + /* qsfp 17 (0x50) */ + .parent = 66, + .info = { SFF8436_INFO(&sff_8436_port[16]) }, + .client = NULL, + }, + { + /* qsfp 18 (0x50) */ + .parent = 67, + .info = { SFF8436_INFO(&sff_8436_port[17]) }, + .client = NULL, + }, + { + /* qsfp 19 (0x50) */ + .parent = 68, + .info = { SFF8436_INFO(&sff_8436_port[18]) }, + .client = NULL, + }, + { + /* qsfp 20 (0x50) */ + .parent = 69, + .info = { SFF8436_INFO(&sff_8436_port[19]) }, + .client = NULL, + }, + { + /* qsfp 21 (0x50) */ + .parent = 70, + .info = { SFF8436_INFO(&sff_8436_port[20]) }, + .client = NULL, + }, + { + /* qsfp 22 (0x50) */ + .parent = 71, + .info = { SFF8436_INFO(&sff_8436_port[21]) }, + .client = NULL, + }, + { + /* qsfp 23 (0x50) */ + .parent = 72, + .info = { SFF8436_INFO(&sff_8436_port[22]) }, + .client = NULL, + }, + { + /* qsfp 24 (0x50) */ + .parent = 73, + .info = { SFF8436_INFO(&sff_8436_port[23]) }, + .client = NULL, + }, + { + /* qsfp 25 (0x50) */ + .parent = 74, + .info = { SFF8436_INFO(&sff_8436_port[24]) }, + .client = NULL, + }, + { + /* qsfp 26 (0x50) */ + .parent = 75, + .info = { SFF8436_INFO(&sff_8436_port[25]) }, + .client = NULL, + }, + { + /* qsfp 27 (0x50) */ + .parent = 76, + .info = { SFF8436_INFO(&sff_8436_port[26]) }, + .client = NULL, + }, + { + /* qsfp 28 (0x50) */ + .parent = 77, + .info = { SFF8436_INFO(&sff_8436_port[27]) }, + .client = NULL, + }, + { + /* qsfp 29 (0x50) */ + .parent = 78, + .info = { SFF8436_INFO(&sff_8436_port[28]) }, + .client = NULL, + }, + { + /* qsfp 30 (0x50) */ + .parent = 79, + .info = { SFF8436_INFO(&sff_8436_port[29]) }, + .client = NULL, + }, + { + /* qsfp 31 (0x50) */ + .parent = 80, + .info = { SFF8436_INFO(&sff_8436_port[30]) }, + .client = NULL, + }, + { + /* qsfp 32 (0x50) */ + .parent = 81, + .info = { SFF8436_INFO(&sff_8436_port[31]) }, + .client = NULL, + }, +}; + + +static struct platform_device ag9032v1_i2c_device[] = { + ag9032v1_i2c_device_num(0), + ag9032v1_i2c_device_num(1), + ag9032v1_i2c_device_num(2), + ag9032v1_i2c_device_num(3), + ag9032v1_i2c_device_num(4), + ag9032v1_i2c_device_num(5), + ag9032v1_i2c_device_num(6), + ag9032v1_i2c_device_num(7), + ag9032v1_i2c_device_num(8), + ag9032v1_i2c_device_num(9), + ag9032v1_i2c_device_num(10), + ag9032v1_i2c_device_num(11), + ag9032v1_i2c_device_num(12), + ag9032v1_i2c_device_num(13), + ag9032v1_i2c_device_num(14), + ag9032v1_i2c_device_num(15), + ag9032v1_i2c_device_num(16), + ag9032v1_i2c_device_num(17), + ag9032v1_i2c_device_num(18), + ag9032v1_i2c_device_num(19), + ag9032v1_i2c_device_num(20), + ag9032v1_i2c_device_num(21), + ag9032v1_i2c_device_num(22), + ag9032v1_i2c_device_num(23), + ag9032v1_i2c_device_num(24), + ag9032v1_i2c_device_num(25), + ag9032v1_i2c_device_num(26), + ag9032v1_i2c_device_num(27), + ag9032v1_i2c_device_num(28), + ag9032v1_i2c_device_num(29), + ag9032v1_i2c_device_num(30), + ag9032v1_i2c_device_num(31), + ag9032v1_i2c_device_num(32), + ag9032v1_i2c_device_num(33), + ag9032v1_i2c_device_num(34), + ag9032v1_i2c_device_num(35), + ag9032v1_i2c_device_num(36), + ag9032v1_i2c_device_num(37), + ag9032v1_i2c_device_num(38), + ag9032v1_i2c_device_num(39), + ag9032v1_i2c_device_num(40), + ag9032v1_i2c_device_num(41), + ag9032v1_i2c_device_num(42), + ag9032v1_i2c_device_num(43), +}; + +/*---------------- I2C device - end ------------- */ + +/*---------------- I2C driver - start ------------- */ +static int __init i2c_device_probe(struct platform_device *pdev) +{ + struct i2c_device_platform_data *pdata; + struct i2c_adapter *parent; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + + pdata->client = i2c_new_device(parent, &pdata->info); + if (!pdata->client) { + dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", + pdata->info.type, pdata->parent); + return -ENODEV; + } + + return 0; +} + +static int __exit i2c_deivce_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent; + struct i2c_device_platform_data *pdata; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + if (pdata->client) { + parent = (pdata->client)->adapter; + i2c_unregister_device(pdata->client); + i2c_put_adapter(parent); + } + + return 0; +} +static struct platform_driver i2c_device_driver = { + .probe = i2c_device_probe, + .remove = __exit_p(i2c_deivce_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9032v1-i2c-device", + } +}; + +/*---------------- I2C driver - end ------------- */ + +/*---------------- CPLD - start ------------- */ + +/* CPLD -- device */ + +enum cpld_type { + system_cpld, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +enum swpld_attributes { + SW_BOARD_ID, + SW_BOARD_VER, + SWPLD_VER, + SYS_RST, + B56960_RST, + MB_A_PLD_RST, + MB_B_PLD_RST, + PSU1_PWR_OK, + PSU2_PWR_OK, + HS1_PWR_OK, + HS2_PWR_OK, + B54616_RST, + B54616_INT, + B54616_MASK_INT, + PB_HS_INT, + MB_HS_INT, + PB_PWR_INT, + MB_PWR_INT, + FAN_INT, + PB_HS_MASK_INT, + MB_HS_MASK_INT, + PB_PWR1_MASK_INT, + PB_PWR2_MASK_INT, + FAN_MASK_INT, + QSFP_01TO08_INT, + QSFP_08TO16_INT, + QSFP_17TO24_INT, + QSFP_25TO32_INT, + QSFP_01TO08_ABS, + QSFP_08TO16_ABS, + QSFP_17TO24_ABS, + QSFP_25TO32_ABS, + QSFP_01TO08_MASK_INT, + QSFP_08TO16_MASK_INT, + QSFP_17TO24_MASK_INT, + QSFP_25TO32_MASK_INT, + QSFP_01TO08_MASK_ABS, + QSFP_08TO16_MASK_ABS, + QSFP_17TO24_MASK_ABS, + QSFP_25TO32_MASK_ABS, + QSFP01_MOD_INT, + QSFP02_MOD_INT, + QSFP03_MOD_INT, + QSFP04_MOD_INT, + QSFP05_MOD_INT, + QSFP06_MOD_INT, + QSFP07_MOD_INT, + QSFP08_MOD_INT, + QSFP09_MOD_INT, + QSFP10_MOD_INT, + QSFP11_MOD_INT, + QSFP12_MOD_INT, + QSFP13_MOD_INT, + QSFP14_MOD_INT, + QSFP15_MOD_INT, + QSFP16_MOD_INT, + QSFP17_MOD_INT, + QSFP18_MOD_INT, + QSFP19_MOD_INT, + QSFP20_MOD_INT, + QSFP21_MOD_INT, + QSFP22_MOD_INT, + QSFP23_MOD_INT, + QSFP24_MOD_INT, + QSFP25_MOD_INT, + QSFP26_MOD_INT, + QSFP27_MOD_INT, + QSFP28_MOD_INT, + QSFP29_MOD_INT, + QSFP30_MOD_INT, + QSFP31_MOD_INT, + QSFP32_MOD_INT, +}; + +static struct cpld_platform_data ag9032v1_cpld_platform_data[] = { + [system_cpld] = { + .reg_addr = SWPLD_REG, + }, +}; + +static struct platform_device ag9032v1_cpld = { + .name = "delta-ag9032v1-swpld", + .id = 0, + .dev = { + .platform_data = ag9032v1_cpld_platform_data, + .release = device_release, + }, +}; + +static struct swpld_attribute_data { + int reg_addr; + int reg_mask; + char reg_note[150]; +}; + +static struct swpld_attribute_data controller_interrupt_data[] = { +//BOARD + [SYS_RST] = { + .reg_addr = 0x04, + .reg_mask = 7, + .reg_note = "“1” = Normal operation\n“0” = Reset" + }, + [B56960_RST] = { + .reg_addr = 0x04, + .reg_mask = 6, + .reg_note = "“1” = Normal operation\n“0” = Reset" + }, + [MB_A_PLD_RST] = { + .reg_addr = 0x04, + .reg_mask = 4, + .reg_note = "“1” = Normal operation\n“0” = Reset" + }, + [MB_B_PLD_RST] = { + .reg_addr = 0x04, + .reg_mask = 3, + .reg_note = "“1” = Normal operation\n“0” = Reset" + }, +//PSU + [PSU1_PWR_OK] = { + .reg_addr = 0x0a, + .reg_mask = 7, + .reg_note = "‘0’ = Power rail is failed\n‘1’ = Power rail is good" + }, + [PSU2_PWR_OK] = { + .reg_addr = 0x0a, + .reg_mask = 6, + .reg_note = "‘0’ = Power rail is failed\n‘1’ = Power rail is good" + }, +//HOT SWAP + [HS1_PWR_OK] = { + .reg_addr = 0x08, + .reg_mask = 5, + .reg_note = "‘0’ = Hot swap controller disabled\n‘1’ = Hot swap controller enabled" + }, + [HS2_PWR_OK] = { + .reg_addr = 0x08, + .reg_mask = 4, + .reg_note = "‘0’ = Hot swap controller disabled\n‘1’ = Hot swap controller enabled" + }, +//BCM54616S + [B54616_RST] = { + .reg_addr = 0x04, + .reg_mask = 5, + .reg_note = "“0” = Reset\n“1” = Normal operation" + }, + [B54616_INT] = { + .reg_addr = 0x16, + .reg_mask = 7, + .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [B54616_MASK_INT] = { + .reg_addr = 0x17, + .reg_mask = 7, + .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" + }, +//QSFP + [PB_HS_INT] = { + .reg_addr = 0x10, + .reg_mask = 7, + .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [MB_HS_INT] = { + .reg_addr = 0x10, + .reg_mask = 6, + .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [PB_PWR_INT] = { + .reg_addr = 0x10, + .reg_mask = 5, + .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [MB_PWR_INT] = { + .reg_addr = 0x10, + .reg_mask = 4, + .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [FAN_INT] = { + .reg_addr = 0x10, + .reg_mask = 3, + .reg_note = "‘0’ = Interrupt occurs\n‘1’ = Interrupt doesn’t occur" + }, + [PB_HS_MASK_INT] = { + .reg_addr = 0x11, + .reg_mask = 7, + .reg_note = "‘0’ = Interrupt doesn’t masked\n‘1’ = Interrupt masked" + }, + [MB_HS_MASK_INT] = { + .reg_addr = 0x11, + .reg_mask = 6, + .reg_note = "‘0’ = Interrupt doesn’t masked\n‘1’ = Interrupt masked" + }, + [PB_PWR1_MASK_INT] = { + .reg_addr = 0x11, + .reg_mask = 5, + .reg_note = "‘0’ = Interrupt doesn’t masked\n‘1’ = Interrupt masked" + }, + [PB_PWR2_MASK_INT] = { + .reg_addr = 0x11, + .reg_mask = 4, + .reg_note = "‘0’ = Interrupt doesn’t masked\n‘1’ = Interrupt masked" + }, + [FAN_MASK_INT] = { + .reg_addr = 0x11, + .reg_mask = 3, + .reg_note = "‘0’ = Interrupt doesn’t masked\n‘1’ = Interrupt masked" + }, + [QSFP_01TO08_INT] = { + .reg_addr = 0x12, + .reg_mask = 7, + .reg_note = "“0” = Interrupt occurs\n“1” = Interrupt doesn’t occur" + }, + [QSFP_08TO16_INT] = { + .reg_addr = 0x12, + .reg_mask = 6, + .reg_note = "“0” = Interrupt occurs\n“1” = Interrupt doesn’t occur" + }, + [QSFP_17TO24_INT] = { + .reg_addr = 0x12, + .reg_mask = 5, + .reg_note = "“0” = Interrupt occurs\n“1” = Interrupt doesn’t occur" + }, + [QSFP_25TO32_INT] = { + .reg_addr = 0x12, + .reg_mask = 4, + .reg_note = "“0” = Interrupt occurs\n“1” = Interrupt doesn’t occur" + }, + [QSFP_01TO08_ABS] = { + .reg_addr = 0x12, + .reg_mask = 3, + .reg_note = "“0” = Absence status change\n“1” = Absence status not changes" + }, + [QSFP_08TO16_ABS] = { + .reg_addr = 0x12, + .reg_mask = 2, + .reg_note = "“0” = Absence status change\n“1” = Absence status not changes" + }, + [QSFP_17TO24_ABS] = { + .reg_addr = 0x12, + .reg_mask = 1, + .reg_note = "“0” = Absence status change\n“1” = Absence status not changes" + }, + [QSFP_25TO32_ABS] = { + .reg_addr = 0x12, + .reg_mask = 0, + .reg_note = "“0” = Absence status change\n“1” = Absence status not changes" + }, + [QSFP_01TO08_MASK_INT] = { + .reg_addr = 0x13, + .reg_mask = 7, + .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" + }, + [QSFP_08TO16_MASK_INT] = { + .reg_addr = 0x13, + .reg_mask = 6, + .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" + }, + [QSFP_17TO24_MASK_INT] = { + .reg_addr = 0x13, + .reg_mask = 5, + .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" + }, + [QSFP_25TO32_MASK_INT] = { + .reg_addr = 0x13, + .reg_mask = 4, + .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" + }, + [QSFP_01TO08_MASK_ABS] = { + .reg_addr = 0x13, + .reg_mask = 3, + .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" + }, + [QSFP_08TO16_MASK_ABS] = { + .reg_addr = 0x13, + .reg_mask = 2, + .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" + }, + [QSFP_17TO24_MASK_ABS] = { + .reg_addr = 0x13, + .reg_mask = 1, + .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" + }, + [QSFP_25TO32_MASK_ABS] = { + .reg_addr = 0x13, + .reg_mask = 0, + .reg_note = "“0” = Interrupt doesn’t masked\n“1” = Interrupt masked" + }, + [QSFP01_MOD_INT] = { + .reg_addr = 0x40, + .reg_mask = 7, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP02_MOD_INT] = { + .reg_addr = 0x40, + .reg_mask = 6, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP03_MOD_INT] = { + .reg_addr = 0x40, + .reg_mask = 5, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP04_MOD_INT] = { + .reg_addr = 0x40, + .reg_mask = 4, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP05_MOD_INT] = { + .reg_addr = 0x40, + .reg_mask = 3, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP06_MOD_INT] = { + .reg_addr = 0x40, + .reg_mask = 2, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP07_MOD_INT] = { + .reg_addr = 0x40, + .reg_mask = 1, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP08_MOD_INT] = { + .reg_addr = 0x40, + .reg_mask = 0, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP09_MOD_INT] = { + .reg_addr = 0x41, + .reg_mask = 7, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP10_MOD_INT] = { + .reg_addr = 0x41, + .reg_mask = 6, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP11_MOD_INT] = { + .reg_addr = 0x41, + .reg_mask = 5, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP12_MOD_INT] = { + .reg_addr = 0x41, + .reg_mask = 4, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP13_MOD_INT] = { + .reg_addr = 0x41, + .reg_mask = 3, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP14_MOD_INT] = { + .reg_addr = 0x41, + .reg_mask = 2, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP15_MOD_INT] = { + .reg_addr = 0x41, + .reg_mask = 1, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP16_MOD_INT] = { + .reg_addr = 0x41, + .reg_mask = 0, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP17_MOD_INT] = { + .reg_addr = 0x42, + .reg_mask = 7, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP18_MOD_INT] = { + .reg_addr = 0x42, + .reg_mask = 6, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP19_MOD_INT] = { + .reg_addr = 0x42, + .reg_mask = 5, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP20_MOD_INT] = { + .reg_addr = 0x42, + .reg_mask = 4, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP21_MOD_INT] = { + .reg_addr = 0x42, + .reg_mask = 3, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP22_MOD_INT] = { + .reg_addr = 0x42, + .reg_mask = 2, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP23_MOD_INT] = { + .reg_addr = 0x42, + .reg_mask = 1, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP24_MOD_INT] = { + .reg_addr = 0x42, + .reg_mask = 0, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP25_MOD_INT] = { + .reg_addr = 0x43, + .reg_mask = 7, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP26_MOD_INT] = { + .reg_addr = 0x43, + .reg_mask = 6, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP27_MOD_INT] = { + .reg_addr = 0x43, + .reg_mask = 5, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP28_MOD_INT] = { + .reg_addr = 0x43, + .reg_mask = 4, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP29_MOD_INT] = { + .reg_addr = 0x43, + .reg_mask = 3, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP30_MOD_INT] = { + .reg_addr = 0x43, + .reg_mask = 2, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP31_MOD_INT] = { + .reg_addr = 0x43, + .reg_mask = 1, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, + [QSFP32_MOD_INT] = { + .reg_addr = 0x43, + .reg_mask = 0, + .reg_note = "“0” = The module issue the interrupt\n“1” = The module NOT issue the interrupt" + }, +}; + +static ssize_t get_present(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_1); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data = (u32)reverse_8bits(ret) & 0xff; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_2); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_3); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_PRESENCE_4); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_1); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data = (u32)(reverse_8bits(ret) & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_2); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_3); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_LP_MODE_4); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_1, (u8)reverse_8bits(data & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_2, (u8)(reverse_8bits(data >> 8) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_3, (u8)(reverse_8bits(data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_LP_MODE_4, (u8)(reverse_8bits(data >> 24) & 0xff)); + + return count; +} + +static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_1); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data = (u32)(reverse_8bits(ret) & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_2); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_3); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESET_4); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_1, (u8)reverse_8bits(data & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_2, (u8)reverse_8bits((data >> 8)& 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_3, (u8)reverse_8bits((data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESET_4, (u8)reverse_8bits((data >> 24) & 0xff)); + + return count; +} + +static ssize_t get_response(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_1); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data = (u32)(reverse_8bits(ret) & 0xff); + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_2); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 8; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_3); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 16; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, SFP_RESPONSE_4); + if (ret < 0) + return sprintf(buf, "error number(%d)",ret); + data |= (u32)(reverse_8bits(ret) & 0xff) << 24; + + return sprintf(buf, "0x%08x\n", data); //return 32bits data +} + +static ssize_t set_response(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_1, (u8)reverse_8bits(data & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_2, (u8)reverse_8bits((data >> 8)& 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_3, (u8)reverse_8bits((data >> 16) & 0xff)); + i2c_smbus_write_byte_data(pdata[system_cpld].client, SFP_RESPONSE_4, (u8)reverse_8bits((data >> 24) & 0xff)); + + return count; +} + +struct platform_led_status{ + int reg_data; + char *led_status; + int led_id; +}; + +static struct platform_led_status led_info[] = { + { + .reg_data = 0x40, + .led_status = "pwr1_green", + .led_id = 0, + }, + { + .reg_data = 0x80, + .led_status = "pwr1_amber", + .led_id = 0, + }, + { + .reg_data = 0x00, + .led_status = "pwr1_off", + .led_id = 0, + }, + { + .reg_data = 0xc0, + .led_status = "pwr1_off", + .led_id = 0, + }, + { + .reg_data = 0x10, + .led_status = "pwr2_green", + .led_id = 1, + }, + { + .reg_data = 0x20, + .led_status = "pwr2_amber", + .led_id = 1, + }, + { + .reg_data = 0x00, + .led_status = "pwr2_off", + .led_id = 1, + }, + { + .reg_data = 0x30, + .led_status = "pwr2_off", + .led_id = 1, + }, + { + .reg_data = 0x04, + .led_status = "sys_green", + .led_id = 2, + }, + { + .reg_data = 0x08, + .led_status = "sys_blinking_green", + .led_id = 2, + }, + { + .reg_data = 0x0c, + .led_status = "sys_red", + .led_id = 2, + }, + { + .reg_data = 0x00, + .led_status = "sys_off", + .led_id = 2, + }, + { + .reg_data = 0x01, + .led_status = "fan_green", + .led_id = 3, + }, + { + .reg_data = 0x02, + .led_status = "fan_amber", + .led_id = 3, + }, + { + .reg_data = 0x00, + .led_status = "fan_off", + .led_id = 3, + }, + { + .reg_data = 0x03, + .led_status = "fan_off", + .led_id = 3, + }, + { + .reg_data = 0x40, + .led_status = "fan1_green", + .led_id = 4, + }, + { + .reg_data = 0x80, + .led_status = "fan1_red", + .led_id = 4, + }, + { + .reg_data = 0x00, + .led_status = "fan1_off", + .led_id = 4, + }, + { + .reg_data = 0x10, + .led_status = "fan2_green", + .led_id = 5, + }, + { + .reg_data = 0x20, + .led_status = "fan2_red", + .led_id = 5, + }, + { + .reg_data = 0x00, + .led_status = "fan2_off", + .led_id = 5, + }, + { + .reg_data = 0x04, + .led_status = "fan3_green", + .led_id = 6, + }, + { + .reg_data = 0x08, + .led_status = "fan3_red", + .led_id = 6, + }, + { + .reg_data = 0x00, + .led_status = "fan3_off", + .led_id = 6, + }, + { + .reg_data = 0x01, + .led_status = "fan4_green", + .led_id = 7, + }, + { + .reg_data = 0x02, + .led_status = "fan4_red", + .led_id = 7, + }, + { + .reg_data = 0x00, + .led_status = "fan4_off", + .led_id = 7, + }, + { + .reg_data = 0x40, + .led_status = "fan5_green", + .led_id = 8, + }, + { + .reg_data = 0x80, + .led_status = "fan5_red", + .led_id = 8, + }, + { + .reg_data = 0x00, + .led_status = "fan5_off", + .led_id = 8, + }, +}; + +struct platform_led_data{ + int reg_addr; + int mask; +}; + +static struct platform_led_data led_data[] = { + { + .reg_addr = SYS_LED_REG, + .mask = 0xc0, + }, + { + .reg_addr = SYS_LED_REG, + .mask = 0x30, + }, + { + .reg_addr = SYS_LED_REG, + .mask = 0x0c, + }, + { + .reg_addr = SYS_LED_REG, + .mask = 0x03, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0xc0, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0x30, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0x0c, + }, + { + .reg_addr = FAN1_LED_REG, + .mask = 0x03, + }, + { + .reg_addr = FAN2_LED_REG, + .mask = 0xc0, + }, +}; + +static ssize_t get_led_color(struct device *dev, struct device_attribute *devattr, char *buf) +{ + char str[9][20] = {0}; + int board_data; + int led_data_number; + int led_info_number; + struct cpld_platform_data *pdata = dev->platform_data; + + for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ + board_data = i2c_smbus_read_byte_data(pdata[system_cpld].client, led_data[led_data_number].reg_addr); + if(board_data >= 0){ + board_data &= led_data[led_data_number].mask; + for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ + if (led_data_number == led_info[led_info_number].led_id){ + if(board_data == led_info[led_info_number].reg_data){ + sprintf(str[led_data_number], "%s", led_info[led_info_number].led_status); + } + } + } + } + else + printk( KERN_ERR "Missing LED board data\n"); + } + return sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",str[0],str[1],str[2],str[3],str[4],str[5],str[6],str[7],str[8]); +} + +static ssize_t set_led_color(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int led_info_number; + int led_data_number; + int str_compar; + int led_reg_value; + struct cpld_platform_data *pdata = dev->platform_data; + + for(led_info_number = 0; led_info_number < ARRAY_SIZE(led_info); led_info_number++){ + str_compar = strncmp(buf,led_info[led_info_number].led_status,strlen(led_info[led_info_number].led_status)); + if(str_compar == 0){ + for(led_data_number = 0; led_data_number < ARRAY_SIZE(led_data); led_data_number++){ + if(led_info[led_info_number].led_id == led_data_number){ + led_reg_value = i2c_smbus_read_byte_data(pdata[system_cpld].client, led_data[led_data_number].reg_addr); + if(led_reg_value >= 0){ + led_reg_value &= (~led_data[led_data_number].mask); + led_reg_value |= led_info[led_info_number].reg_data; + i2c_smbus_write_byte_data(pdata[system_cpld].client, (u8)(led_data[led_data_number].reg_addr & 0xff), (u8)(led_reg_value & 0xff)); + } + else + printk( KERN_ERR "Missing LED reg. data\n"); + } + } + } + } + return count; +} + +static unsigned char swpld_reg_addr; +static ssize_t get_swpld_reg_value(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, swpld_reg_addr); + return sprintf(buf, "0x%02x\n", ret); +} + +static ssize_t set_swpld_reg_value(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int err; + struct cpld_platform_data *pdata = dev->platform_data; + err = kstrtoul(buf, 0, &data); + if (err){ + return err; + } + + if (data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + return count; + } + + i2c_smbus_write_byte_data(pdata[system_cpld].client, swpld_reg_addr, data); + + return count; +} + +static ssize_t get_swpld_reg_addr(struct device *dev, struct device_attribute *devattr, char *buf) +{ + + return sprintf(buf, "0x%02x\n", swpld_reg_addr); +} + +static ssize_t set_swpld_reg_addr(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long data; + int err; + + err = kstrtoul(buf, 0, &data); + if (err){ + return err; + } + if (data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + return count; + } + swpld_reg_addr = data; + + return count; +} + +static DEVICE_ATTR(swpld_reg_value, S_IRUGO | S_IWUSR, get_swpld_reg_value, set_swpld_reg_value); +static DEVICE_ATTR(swpld_reg_addr, S_IRUGO | S_IWUSR, get_swpld_reg_addr, set_swpld_reg_addr); +static DEVICE_ATTR(sfp_present, S_IRUGO, get_present, NULL ); +static DEVICE_ATTR(sfp_lpmode, S_IRUGO | S_IWUSR, get_lpmode, set_lpmode ); +static DEVICE_ATTR(sfp_reset, S_IRUGO | S_IWUSR, get_reset, set_reset ); +static DEVICE_ATTR(sfp_response, S_IRUGO | S_IWUSR, get_response, set_response ); +static DEVICE_ATTR(led_control, S_IRUGO | S_IWUSR, get_led_color, set_led_color); + +static struct attribute *ag9032v1_cpld_attrs[] = { + &dev_attr_swpld_reg_value.attr, + &dev_attr_swpld_reg_addr.attr, + &dev_attr_sfp_response.attr, + &dev_attr_sfp_present.attr, + &dev_attr_sfp_lpmode.attr, + &dev_attr_sfp_reset.attr, + &dev_attr_led_control.attr, + NULL, +}; + +static struct attribute_group ag9032v1_cpld_attr_grp = { + .attrs = ag9032v1_cpld_attrs, +}; + +static struct kobject *kobj_swpld; +static struct kobject *kobj_board; +static struct kobject *kobj_psu; +static struct kobject *kobj_hot_swap; +static struct kobject *kobj_controller_interrupt; +static struct kobject *kobj_BCM54616S; + +static ssize_t get_swpld_data(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + int ret; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct device *i2cdev = kobj_to_dev(kobj_swpld); + struct cpld_platform_data *pdata = i2cdev->platform_data; + + + unsigned char reg; + int mask; + int value; + char note[150]; + + switch (attr->index) { + //attributes on BOARD + case SW_BOARD_ID: + reg = 0x00; + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + value = ret >> 4; + sprintf(note, "\n“0x00”: L9032NB-AL-R\n“0x01”: AK9032-R\n“0x02”: AG9032-R\n“0x03”: AG9032R-R\n“0x04”: AG9032 V1-R\n"); + return sprintf(buf, "0x%02x%s", value, note); + case SW_BOARD_VER: + reg = 0x00; + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + value = ret & 0x0F; + sprintf(note, "\n“0x00”: proto-A\n“0x01”: proto-B\n"); + return sprintf(buf, "0x%02x%s", value, note); + case SWPLD_VER: + reg = 0x01; + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + value = ret & 0xFF; + sprintf(note, " "); + return sprintf(buf, "0x%02x%s", value, note); + //other attributes + case SYS_RST ... QSFP32_MOD_INT: + reg = controller_interrupt_data[attr->index].reg_addr; + mask = controller_interrupt_data[attr->index].reg_mask; + sprintf(note, "\n%s\n",controller_interrupt_data[attr->index].reg_note); + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + value = (ret & (1 << mask)) >> mask; + return sprintf(buf, "%d%s", value, note); + default: + return sprintf(buf, "%d not found", attr->index); + } +} + +static ssize_t set_swpld_data(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count) +{ + int ret; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct device *i2cdev = kobj_to_dev(kobj_board->parent); + struct cpld_platform_data *pdata = i2cdev->platform_data; + unsigned char reg; + int mask; + int value; + char note[180]; + int data; + int val; + u8 mask_out; + + ret = kstrtoint(buf, 0, &val); + + if (ret) + { + return ret; + } + if (val > 1) + { + return -EINVAL; + } + + switch (attr->index) { + case SYS_RST ... MB_B_PLD_RST: + case HS1_PWR_OK ... HS2_PWR_OK: + case B54616_RST: + case QSFP_01TO08_MASK_INT... QSFP_25TO32_MASK_ABS: + reg = controller_interrupt_data[attr->index].reg_addr; + mask = controller_interrupt_data[attr->index].reg_mask; + break; + default: + return sprintf(buf, "%d not found", attr->index); + } + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + mask_out = ret & ~((u8)(1 << mask)); + data = mask_out | (val << mask); + i2c_smbus_write_byte_data(pdata[system_cpld].client, reg, (u8)(data & 0xff)); + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, reg); + return count; +} + +static SENSOR_DEVICE_ATTR(sw_board_id, S_IRUGO, get_swpld_data, NULL, SW_BOARD_ID); +static SENSOR_DEVICE_ATTR(sw_board_ver, S_IRUGO, get_swpld_data, NULL, SW_BOARD_VER); +static SENSOR_DEVICE_ATTR(swpld_ver, S_IRUGO, get_swpld_data, NULL, SWPLD_VER); +static SENSOR_DEVICE_ATTR(sys_rst, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, SYS_RST); +static SENSOR_DEVICE_ATTR(B56960_rst, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, B56960_RST); +static SENSOR_DEVICE_ATTR(mb_a_pld_rst, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, MB_A_PLD_RST); +static SENSOR_DEVICE_ATTR(mb_b_pld_rst, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, MB_B_PLD_RST); + +static struct attribute *ag9032v1_swpld_attrs_board[] = { + &sensor_dev_attr_sw_board_id.dev_attr.attr, + &sensor_dev_attr_sw_board_ver.dev_attr.attr, + &sensor_dev_attr_swpld_ver.dev_attr.attr, + &sensor_dev_attr_sys_rst.dev_attr.attr, + &sensor_dev_attr_B56960_rst.dev_attr.attr, + &sensor_dev_attr_mb_a_pld_rst.dev_attr.attr, + &sensor_dev_attr_mb_b_pld_rst.dev_attr.attr, + NULL, +}; + +static SENSOR_DEVICE_ATTR(psu1_pwr_ok, S_IRUGO, get_swpld_data, NULL, PSU1_PWR_OK); +static SENSOR_DEVICE_ATTR(psu2_pwr_ok, S_IRUGO, get_swpld_data, NULL, PSU2_PWR_OK); + +static struct attribute *ag9032v1_swpld_attrs_psu[] = { + &sensor_dev_attr_psu1_pwr_ok.dev_attr.attr, + &sensor_dev_attr_psu2_pwr_ok.dev_attr.attr, + NULL, +}; + +static SENSOR_DEVICE_ATTR(hs1_pwr_ok, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, HS1_PWR_OK); +static SENSOR_DEVICE_ATTR(hs2_pwr_ok, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, HS2_PWR_OK); + +static struct attribute *ag9032v1_swpld_attrs_hot_swap[] = { + &sensor_dev_attr_hs1_pwr_ok.dev_attr.attr, + &sensor_dev_attr_hs2_pwr_ok.dev_attr.attr, + NULL, +}; + +static SENSOR_DEVICE_ATTR(B54616_rst, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, B54616_RST ); +static SENSOR_DEVICE_ATTR(B54616_int, S_IRUGO, get_swpld_data, NULL, B54616_INT ); +static SENSOR_DEVICE_ATTR(B54616_mask_int, S_IRUGO, get_swpld_data, NULL, B54616_MASK_INT); + +static struct attribute *ag9032v1_swpld_attrs_BCM54616S[] = { + &sensor_dev_attr_B54616_rst.dev_attr.attr, + &sensor_dev_attr_B54616_int.dev_attr.attr, + &sensor_dev_attr_B54616_mask_int.dev_attr.attr, + NULL, +}; + +static SENSOR_DEVICE_ATTR(pb_hs_int, S_IRUGO, get_swpld_data, NULL, PB_HS_INT); +static SENSOR_DEVICE_ATTR(mb_hs_int, S_IRUGO, get_swpld_data, NULL, MB_HS_INT); +static SENSOR_DEVICE_ATTR(pb_pwr_int, S_IRUGO, get_swpld_data, NULL, PB_PWR_INT); +static SENSOR_DEVICE_ATTR(mb_pwr_int, S_IRUGO, get_swpld_data, NULL, MB_PWR_INT); +static SENSOR_DEVICE_ATTR(fan_int, S_IRUGO, get_swpld_data, NULL, FAN_INT); +static SENSOR_DEVICE_ATTR(pb_hs_mask_int, S_IRUGO, get_swpld_data, NULL, PB_HS_MASK_INT); +static SENSOR_DEVICE_ATTR(mb_hs_mask_int, S_IRUGO, get_swpld_data, NULL, MB_HS_MASK_INT); +static SENSOR_DEVICE_ATTR(pb_pwr1_mask_int, S_IRUGO, get_swpld_data, NULL, PB_PWR1_MASK_INT); +static SENSOR_DEVICE_ATTR(pb_pwr2_mask_int, S_IRUGO, get_swpld_data, NULL, PB_PWR2_MASK_INT); +static SENSOR_DEVICE_ATTR(fan_mask_int, S_IRUGO, get_swpld_data, NULL, FAN_MASK_INT); +static SENSOR_DEVICE_ATTR(qsfp_01to08_int, S_IRUGO, get_swpld_data, NULL, QSFP_01TO08_INT); +static SENSOR_DEVICE_ATTR(qsfp_08to16_int, S_IRUGO, get_swpld_data, NULL, QSFP_08TO16_INT); +static SENSOR_DEVICE_ATTR(qsfp_17to24_int, S_IRUGO, get_swpld_data, NULL, QSFP_17TO24_INT); +static SENSOR_DEVICE_ATTR(qsfp_25to32_int, S_IRUGO, get_swpld_data, NULL, QSFP_25TO32_INT); +static SENSOR_DEVICE_ATTR(qsfp_01to08_abs, S_IRUGO, get_swpld_data, NULL, QSFP_01TO08_ABS); +static SENSOR_DEVICE_ATTR(qsfp_08to16_abs, S_IRUGO, get_swpld_data, NULL, QSFP_08TO16_ABS); +static SENSOR_DEVICE_ATTR(qsfp_17to24_abs, S_IRUGO, get_swpld_data, NULL, QSFP_17TO24_ABS); +static SENSOR_DEVICE_ATTR(qsfp_25to32_abs, S_IRUGO, get_swpld_data, NULL, QSFP_25TO32_ABS); +static SENSOR_DEVICE_ATTR(qsfp_01to08_mask_int, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_01TO08_MASK_INT); +static SENSOR_DEVICE_ATTR(qsfp_08to16_mask_int, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_08TO16_MASK_INT); +static SENSOR_DEVICE_ATTR(qsfp_17to24_mask_int, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_17TO24_MASK_INT); +static SENSOR_DEVICE_ATTR(qsfp_25to32_mask_int, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_25TO32_MASK_INT); +static SENSOR_DEVICE_ATTR(qsfp_01to08_mask_abs, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_01TO08_MASK_ABS); +static SENSOR_DEVICE_ATTR(qsfp_08to16_mask_abs, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_08TO16_MASK_ABS); +static SENSOR_DEVICE_ATTR(qsfp_17to24_mask_abs, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_17TO24_MASK_ABS); +static SENSOR_DEVICE_ATTR(qsfp_25to32_mask_abs, S_IRUGO | S_IWUSR, get_swpld_data, set_swpld_data, QSFP_25TO32_MASK_ABS); +static SENSOR_DEVICE_ATTR(qsfp01_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP01_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp02_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP02_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp03_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP03_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp04_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP04_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp05_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP05_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp06_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP06_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp07_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP07_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp08_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP08_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp09_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP09_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp10_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP10_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp11_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP11_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp12_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP12_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp13_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP13_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp14_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP14_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp15_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP15_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp16_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP16_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp17_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP17_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp18_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP18_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp19_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP19_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp20_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP20_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp21_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP21_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp22_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP22_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp23_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP23_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp24_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP24_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp25_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP25_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp26_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP26_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp27_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP27_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp28_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP28_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp29_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP29_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp30_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP30_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp31_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP31_MOD_INT); +static SENSOR_DEVICE_ATTR(qsfp32_mod_int, S_IRUGO, get_swpld_data, NULL, QSFP32_MOD_INT); + +static struct attribute *ag9032v1_swpld_attrs_controller_interrupt[] = { + &sensor_dev_attr_pb_hs_int.dev_attr.attr, + &sensor_dev_attr_mb_hs_int.dev_attr.attr, + &sensor_dev_attr_pb_pwr_int.dev_attr.attr, + &sensor_dev_attr_mb_pwr_int.dev_attr.attr, + &sensor_dev_attr_fan_int.dev_attr.attr, + &sensor_dev_attr_pb_hs_mask_int.dev_attr.attr, + &sensor_dev_attr_mb_hs_mask_int.dev_attr.attr, + &sensor_dev_attr_pb_pwr1_mask_int.dev_attr.attr, + &sensor_dev_attr_pb_pwr2_mask_int.dev_attr.attr, + &sensor_dev_attr_fan_mask_int.dev_attr.attr, + &sensor_dev_attr_qsfp_01to08_int.dev_attr.attr, + &sensor_dev_attr_qsfp_08to16_int.dev_attr.attr, + &sensor_dev_attr_qsfp_17to24_int.dev_attr.attr, + &sensor_dev_attr_qsfp_25to32_int.dev_attr.attr, + &sensor_dev_attr_qsfp_01to08_abs.dev_attr.attr, + &sensor_dev_attr_qsfp_08to16_abs.dev_attr.attr, + &sensor_dev_attr_qsfp_17to24_abs.dev_attr.attr, + &sensor_dev_attr_qsfp_25to32_abs.dev_attr.attr, + &sensor_dev_attr_qsfp_01to08_mask_int.dev_attr.attr, + &sensor_dev_attr_qsfp_08to16_mask_int.dev_attr.attr, + &sensor_dev_attr_qsfp_17to24_mask_int.dev_attr.attr, + &sensor_dev_attr_qsfp_25to32_mask_int.dev_attr.attr, + &sensor_dev_attr_qsfp_01to08_mask_abs.dev_attr.attr, + &sensor_dev_attr_qsfp_08to16_mask_abs.dev_attr.attr, + &sensor_dev_attr_qsfp_17to24_mask_abs.dev_attr.attr, + &sensor_dev_attr_qsfp_25to32_mask_abs.dev_attr.attr, + &sensor_dev_attr_qsfp01_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp02_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp03_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp04_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp05_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp06_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp07_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp08_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp09_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp10_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp11_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp12_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp13_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp14_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp15_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp16_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp17_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp18_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp19_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp20_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp21_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp22_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp23_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp24_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp25_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp26_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp27_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp28_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp29_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp30_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp31_mod_int.dev_attr.attr, + &sensor_dev_attr_qsfp32_mod_int.dev_attr.attr, + NULL, +}; + +static struct attribute_group ag9032v1_swpld_attr_grp_board = { + .attrs = ag9032v1_swpld_attrs_board, +}; +static struct attribute_group ag9032v1_swpld_attr_grp_psu = { + .attrs = ag9032v1_swpld_attrs_psu, +}; +static struct attribute_group ag9032v1_swpld_attr_grp_hot_swap = { + .attrs = ag9032v1_swpld_attrs_hot_swap, +}; +static struct attribute_group ag9032v1_swpld_attr_grp_BCM54616S = { + .attrs = ag9032v1_swpld_attrs_BCM54616S, +}; +static struct attribute_group ag9032v1_swpld_attr_grp_controller_interrupt = { + .attrs = ag9032v1_swpld_attrs_controller_interrupt, +}; + +/* CPLD -- driver */ +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS6); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n", BUS6); + return -ENODEV; + } + + pdata[system_cpld].client = i2c_new_dummy(parent, pdata[system_cpld].reg_addr); + if (!pdata[system_cpld].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[system_cpld].reg_addr); + goto error; + } + + kobj_swpld = &pdev->dev.kobj; + kobj_board = kobject_create_and_add("Board", &pdev->dev.kobj); + if (!kobj_board){ + printk(KERN_WARNING "Fail to create directory"); + goto error; + } + + kobj_psu = kobject_create_and_add("PSU", &pdev->dev.kobj); + if (!kobj_psu){ + printk(KERN_WARNING "Fail to create directory"); + goto error; + } + + kobj_hot_swap = kobject_create_and_add("HOT_SWAP", &pdev->dev.kobj); + if (!kobj_hot_swap){ + printk(KERN_WARNING "Fail to create directory"); + goto error; + } + + kobj_controller_interrupt = kobject_create_and_add("Controller_interrupt", &pdev->dev.kobj); + if (!kobj_controller_interrupt){ + printk(KERN_WARNING "Fail to create directory"); + goto error; + } + + kobj_BCM54616S = kobject_create_and_add("BCM54616S", &pdev->dev.kobj); + if (!kobj_BCM54616S){ + printk(KERN_WARNING "Fail to create directory"); + goto error; + } + + ret = sysfs_create_group(kobj_board, &ag9032v1_swpld_attr_grp_board); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + ret = sysfs_create_group(kobj_psu, &ag9032v1_swpld_attr_grp_psu); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + ret = sysfs_create_group(kobj_hot_swap, &ag9032v1_swpld_attr_grp_hot_swap); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + ret = sysfs_create_group(kobj_BCM54616S, &ag9032v1_swpld_attr_grp_BCM54616S); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + ret = sysfs_create_group(kobj_controller_interrupt, &ag9032v1_swpld_attr_grp_controller_interrupt); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + ret = sysfs_create_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + return 0; + +error: + kobject_put(kobj_swpld); + kobject_put(kobj_board); + kobject_put(kobj_psu); + kobject_put(kobj_hot_swap); + kobject_put(kobj_controller_interrupt); + kobject_put(kobj_BCM54616S); + i2c_unregister_device(pdata[system_cpld].client); + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &ag9032v1_cpld_attr_grp); + sysfs_remove_group(kobj_board, &ag9032v1_swpld_attr_grp_board); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + kobject_put(kobj_swpld); + kobject_put(kobj_board); + kobject_put(kobj_psu); + kobject_put(kobj_hot_swap); + kobject_put(kobj_controller_interrupt); + kobject_put(kobj_BCM54616S); + if (pdata[system_cpld].client) { + if (!parent) { + parent = (pdata[system_cpld].client)->adapter; + } + i2c_unregister_device(pdata[system_cpld].client); + } + } + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9032v1-swpld", + }, +}; + +/*---------------- CPLD - end ------------- */ + +/*---------------- MUX - start ------------- */ + +struct swpld_mux_platform_data { + int parent; + int base_nr; + int reg_addr; + struct i2c_client *cpld; +}; + +struct swpld_mux { + struct i2c_adapter *parent; + struct i2c_adapter **child; + struct swpld_mux_platform_data data; +}; +static struct swpld_mux_platform_data ag9032v1_swpld_mux_platform_data[] = { + { + .parent = BUS3, + .base_nr = BUS3_BASE_NUM, + .cpld = NULL, + .reg_addr = BUS3_MUX_REG ,// the i2c register address which for select mux TEMP(FAN) + }, + { + .parent = BUS4, + .base_nr = BUS4_BASE_NUM , + .cpld = NULL, + .reg_addr = BUS4_MUX_REG , + }, + { + .parent = BUS5, + .base_nr = BUS5_BASE_NUM , + .cpld = NULL, + .reg_addr = BUS5_MUX_REG , + }, +}; + +static struct platform_device ag9032v1_swpld_mux[] = { + { + .name = "delta-ag9032v1-swpld-mux", + .id = 0, + .dev = { + .platform_data = &ag9032v1_swpld_mux_platform_data[0], + .release = device_release, + }, + }, + { + .name = "delta-ag9032v1-swpld-mux", + .id = 1, + .dev = { + .platform_data = &ag9032v1_swpld_mux_platform_data[1], + .release = device_release, + }, + }, + { + .name = "delta-ag9032v1-swpld-mux", + .id = 2, + .dev = { + .platform_data = &ag9032v1_swpld_mux_platform_data[2], + .release = device_release, + }, + }, +}; + +static int cpld_reg_write_byte(struct i2c_client *client, u8 regaddr, u8 val) +{ + union i2c_smbus_data data; + + data.byte = val; + return client->adapter->algo->smbus_xfer(client->adapter, client->addr, + client->flags, + I2C_SMBUS_WRITE, + regaddr, I2C_SMBUS_BYTE_DATA, &data); +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) +{ + struct swpld_mux *mux = data; + u8 swpld_mux_val=0; + + if ( mux->data.base_nr == BUS3_BASE_NUM ) + { + switch (chan) { + case 0: + swpld_mux_val = TEMP_FAN_VAL; + break; + case 1: + swpld_mux_val = FAN_EEPROM1_VAL; + break; + case 2: + swpld_mux_val = FAN_EEPROM2_VAL; + break; + case 3: + swpld_mux_val = FAN_EEPROM3_VAL; + break; + case 4: + swpld_mux_val = FAN_EEPROM4_VAL; + break; + case 5: + swpld_mux_val = FAN_EEPROM5_VAL; + break; + case 6: + swpld_mux_val = FANIO_CTL_VAL; + break; + case 7: + case 8: + swpld_mux_val = FAN_CTRL_VAL; + break; + } + } + else if ( mux->data.base_nr == BUS4_BASE_NUM ) + { + switch (chan) { + case 0: + swpld_mux_val = PSU1_VAL; + break; + case 1: + swpld_mux_val = PSU2_VAL; + break; + case 2: + swpld_mux_val = HOT_SWAP1_VAL; + break; + case 3: + swpld_mux_val = HOT_SWAP2_VAL; + break; + } + } + else if ( mux->data.base_nr == BUS5_BASE_NUM ){ + if (chan < 9){ + swpld_mux_val = (u8)(chan) + 0x01; + } + else if (8 < chan && chan < 19){ + swpld_mux_val = (u8)(chan - 9) + 0x10; + } + else if (18 < chan && chan < 29){ + swpld_mux_val = (u8)(chan - 19) + 0x20; + } + else if (28 < chan && chan < 39){ + swpld_mux_val = (u8)(chan - 29) + 0x30; + } + else{ + swpld_mux_val = 0x00; + } + } + else + { + swpld_mux_val = 0x00; + } + return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); +} +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int swpld_mux_select(struct i2c_mux_core *muxc, u32 chan) +{ + struct swpld_mux *mux = i2c_mux_priv(muxc); + u8 swpld_mux_val=0; + + if ( mux->data.base_nr == BUS3_BASE_NUM ) + { + switch (chan) { + case 0: + swpld_mux_val = TEMP_FAN_VAL; + break; + case 1: + swpld_mux_val = FAN_EEPROM1_VAL; + break; + case 2: + swpld_mux_val = FAN_EEPROM2_VAL; + break; + case 3: + swpld_mux_val = FAN_EEPROM3_VAL; + break; + case 4: + swpld_mux_val = FAN_EEPROM4_VAL; + break; + case 5: + swpld_mux_val = FAN_EEPROM5_VAL; + break; + case 6: + swpld_mux_val = FANIO_CTL_VAL; + break; + case 7: + case 8: + swpld_mux_val = FAN_CTRL_VAL; + break; + } + } + else if ( mux->data.base_nr == BUS4_BASE_NUM ) + { + switch (chan) { + case 0: + swpld_mux_val = PSU1_VAL; + break; + case 1: + swpld_mux_val = PSU2_VAL; + break; + case 2: + swpld_mux_val = HOT_SWAP1_VAL; + break; + case 3: + swpld_mux_val = HOT_SWAP2_VAL; + break; + } + } + else if ( mux->data.base_nr == BUS5_BASE_NUM ){ + if (chan < 9){ + swpld_mux_val = (u8)(chan) + 0x01; + } + else if (8 < chan && chan < 19){ + swpld_mux_val = (u8)(chan - 9) + 0x10; + } + else if (18 < chan && chan < 29){ + swpld_mux_val = (u8)(chan - 19) + 0x20; + } + else if (28 < chan && chan < 39){ + swpld_mux_val = (u8)(chan - 29) + 0x30; + } + else{ + swpld_mux_val = 0x00; + } + } + else + { + swpld_mux_val = 0x00; + } + + return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(swpld_mux_val & 0xff)); +} +#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS3: + dev_num = BUS3_DEV_NUM; + break; + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + case BUS5: + dev_num = BUS5_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for mux\n"); + goto alloc_failed; + } + + mux->parent = parent; + mux->data = *pdata; + mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); + if (!mux->child) { + ret = -ENOMEM; + printk(KERN_ERR "Failed to allocate memory for device on mux\n"); + goto alloc_failed2; + } + + for (i = 0; i < dev_num; i++) { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, + nr, i, class, + swpld_mux_select, NULL); + if (!mux->child[i]) { + ret = -ENODEV; + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + + platform_set_drvdata(pdev, mux); + return 0; + +add_adapter_failed: + for (; i > 0; i--) + i2c_del_mux_adapter(mux->child[i - 1]); + kfree(mux->child); +alloc_failed2: + kfree(mux); +alloc_failed: + i2c_put_adapter(parent); + + return ret; +} +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int __init swpld_mux_probe(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc; + struct swpld_mux *mux; + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + printk(KERN_ERR "Failed to allocate memory for mux\n"); + return -ENOMEM; + } + mux->data = *pdata; + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + kfree(mux); + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS3: + dev_num = BUS3_DEV_NUM; + break; + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + case BUS5: + dev_num = BUS5_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + + + muxc = i2c_mux_alloc(parent, &pdev->dev, dev_num, 0, 0, + swpld_mux_select, NULL); + if (!muxc) { + ret = -ENOMEM; + goto alloc_failed; + } + muxc->priv = mux; + platform_set_drvdata(pdev, muxc); + + + for (i = 0; i < dev_num; i++) { + int nr = pdata->base_nr + i; + unsigned int class = 0; + + ret = i2c_mux_add_adapter(muxc, nr, i, class); + if (ret) { + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + + dev_info(&pdev->dev, "%d port mux on %s adapter\n", dev_num, parent->name); + + return 0; + +add_adapter_failed: + i2c_mux_del_adapters(muxc); +alloc_failed: + kfree(mux); + i2c_put_adapter(parent); + + return ret; +} +#endif // #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + int i; + struct swpld_mux *mux = platform_get_drvdata(pdev); + struct swpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + switch (pdata->parent) { + case BUS3: + dev_num = BUS3_DEV_NUM; + break; + case BUS4: + dev_num = BUS4_DEV_NUM; + break; + case BUS5: + dev_num = BUS5_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + for (i = 0; i < dev_num; i++) + i2c_del_mux_adapter(mux->child[i]); + + platform_set_drvdata(pdev, NULL); + i2c_put_adapter(mux->parent); + kfree(mux->child); + kfree(mux); + + return 0; +} +#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +static int __exit swpld_mux_remove(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc = platform_get_drvdata(pdev); + struct i2c_adapter *parent=muxc->parent; + + i2c_mux_del_adapters(muxc); + i2c_put_adapter(parent); + + return 0; +} +#endif + +static struct platform_driver swpld_mux_driver = { + .probe = swpld_mux_probe, + .remove = __exit_p(swpld_mux_remove), /* TODO */ + .driver = { + .owner = THIS_MODULE, + .name = "delta-ag9032v1-swpld-mux", + }, +}; +/*---------------- MUX - end ------------- */ + +/*---------------- module initialization ------------- */ +static int __init delta_ag9032v1_platform_init(void) +{ +// struct i2c_client *client; + struct i2c_adapter *adapter; + struct cpld_platform_data *cpld_pdata; + struct swpld_mux_platform_data *swpld_mux_pdata; + int ret,i = 0; + printk("ag9032v1_platform module initialization\n"); + + //Use pca9547 in i2c_mux_pca954x.c + adapter = i2c_get_adapter(BUS1); + //client = i2c_new_device(adapter, &i2c_info_pca9547[0]); + i2c_client_9547 = i2c_new_device(adapter, &i2c_info_pca9547[0]); + + i2c_put_adapter(adapter); + + // set the CPLD prob and remove + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpld driver\n"); + goto error_cpld_driver; + } + // register the mux prob which call the CPLD + ret = platform_driver_register(&swpld_mux_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld mux driver\n"); + goto error_swpld_mux_driver; + } + + // register the i2c devices + ret = platform_driver_register(&i2c_device_driver); + if (ret) { + printk(KERN_WARNING "Fail to register i2c device driver\n"); + goto error_i2c_device_driver; + } + + // register the CPLD + ret = platform_device_register(&ag9032v1_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpld device\n"); + goto error_ag9032v1_cpld; + } + // link the CPLD and the Mux + cpld_pdata = ag9032v1_cpld.dev.platform_data; + + for (i = 0; i < ARRAY_SIZE(ag9032v1_swpld_mux); i++) + { + swpld_mux_pdata = ag9032v1_swpld_mux[i].dev.platform_data; + swpld_mux_pdata->cpld = cpld_pdata[system_cpld].client; + ret = platform_device_register(&ag9032v1_swpld_mux[i]); + if (ret) { + printk(KERN_WARNING "Fail to create swpld mux %d\n", i); + goto error_ag9032v1_swpld_mux; + } + } + + for (i = 0; i < ARRAY_SIZE(ag9032v1_i2c_device); i++) + { + ret = platform_device_register(&ag9032v1_i2c_device[i]); + if (ret) { + printk(KERN_WARNING "Fail to create i2c device %d\n", i); + goto error_ag9032v1_i2c_device; + } + } + + if (ret) + goto error_ag9032v1_swpld_mux; + + return 0; + +error_ag9032v1_i2c_device: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag9032v1_i2c_device[i]); + } + i = ARRAY_SIZE(ag9032v1_swpld_mux); +error_ag9032v1_swpld_mux: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&ag9032v1_swpld_mux[i]); + } + platform_driver_unregister((struct platform_driver *) &ag9032v1_cpld); +error_ag9032v1_cpld: + platform_driver_unregister(&i2c_device_driver); +error_i2c_device_driver: + platform_driver_unregister(&swpld_mux_driver); +error_swpld_mux_driver: + platform_driver_unregister(&cpld_driver); +error_cpld_driver: + return ret; +} + +static void __exit delta_ag9032v1_platform_exit(void) +{ + int i = 0; + + for ( i = 0; i < ARRAY_SIZE(ag9032v1_i2c_device); i++ ) { + platform_device_unregister(&ag9032v1_i2c_device[i]); + } + + for (i = 0; i < ARRAY_SIZE(ag9032v1_swpld_mux); i++) { + platform_device_unregister(&ag9032v1_swpld_mux[i]); + } + + platform_device_unregister(&ag9032v1_cpld); + platform_driver_unregister(&i2c_device_driver); + platform_driver_unregister(&cpld_driver); + platform_driver_unregister(&swpld_mux_driver); + + i2c_unregister_device(i2c_client_9547); +} + +module_init(delta_ag9032v1_platform_init); +module_exit(delta_ag9032v1_platform_exit); + +MODULE_DESCRIPTION("DNI ag9032v1 Platform Support"); +MODULE_AUTHOR("Neal Tai "); +MODULE_LICENSE("GPL"); \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh index c5f897ff007f..b199ff349446 100755 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/ag9032v1_platform_init.sh @@ -5,5 +5,8 @@ #fan speed monitol start /usr/share/sonic/device/x86_64-delta_ag9032v1-r0/fancontrol.service /usr/share/sonic/device/x86_64-delta_ag9032v1-r0/fancontrol & +#set led status +/usr/local/bin/led_status.sh & + exit 0 diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh index 5685bd71f58c..825e09aa4cfb 100755 --- a/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh +++ b/platform/broadcom/sonic-platform-modules-delta/ag9032v1/scripts/led_status.sh @@ -5,7 +5,7 @@ FAN2_EEPROM="-y 32 0x52 0x0a" FAN3_EEPROM="-y 33 0x53 0x0a" FAN4_EEPROM="-y 34 0x54 0x0a" FAN5_EEPROM="-y 35 0x55 0x0a" -LED_CONTROL="/sys/devices/platform/delta-ag9032v1-cpld.0/led_control" +LED_CONTROL="/sys/devices/platform/delta-ag9032v1-swpld.0/led_control" FAN1_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan5_input" FAN1_REAR_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-38/38-002d/fan5_input" FAN2_FRONT_RPM="/sys/devices/pci0000:00/0000:00:13.0/i2c-1/i2c-3/i2c-37/37-002c/fan4_input" diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init index f98363b3ea01..3734ab362a2f 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9032v1.init @@ -28,7 +28,6 @@ start) modprobe delta_ag9032v1_cpupld /usr/local/bin/ag9032v1_platform_init.sh - echo "done." ;; From 4715dbb796ec53674ffeeacf8e777d9d9bb27a73 Mon Sep 17 00:00:00 2001 From: Sun Yongfeng Date: Tue, 4 Sep 2018 16:40:14 +0800 Subject: [PATCH 1600/1833] [SNMP] fix issue #1874, ERR snmpd[34]: Error allocating more space for arpcache. Cache will continue to be limited to 4096 entries (#1989) --- src/snmpd/Makefile | 9 ++++- ...ng-logs-with-statfs-permission-denie.patch | 40 +++++++++++++++++++ ...eck-return-status-from-realloc.-Than.patch | 31 ++++++++++++++ src/snmpd/patch-5.7.3+dfsg/series | 2 + src/snmpd/statfs_error.patch | 22 ---------- 5 files changed, 81 insertions(+), 23 deletions(-) create mode 100644 src/snmpd/patch-5.7.3+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch create mode 100644 src/snmpd/patch-5.7.3+dfsg/0002-at.c-properly-check-return-status-from-realloc.-Than.patch create mode 100644 src/snmpd/patch-5.7.3+dfsg/series delete mode 100644 src/snmpd/statfs_error.patch diff --git a/src/snmpd/Makefile b/src/snmpd/Makefile index b372f0d22458..e9645b93b686 100644 --- a/src/snmpd/Makefile +++ b/src/snmpd/Makefile @@ -23,7 +23,14 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : dpkg-source -x net-snmp_$(SNMPD_VERSION_FULL).dsc pushd net-snmp-$(SNMPD_VERSION) - patch -p0 < ../statfs_error.patch + git init + git add -f * + git commit -m "unmodified snmpd source" + + # Apply patches + stg init + stg import -s ../patch-$(SNMPD_VERSION)/series + fakeroot debian/rules -j$(SONIC_CONFIG_MAKE_JOBS) binary popd diff --git a/src/snmpd/patch-5.7.3+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch b/src/snmpd/patch-5.7.3+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch new file mode 100644 index 000000000000..f832d0044071 --- /dev/null +++ b/src/snmpd/patch-5.7.3+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch @@ -0,0 +1,40 @@ +From a1edbce39e46b5c8bd5bd7db17fc11fa30e7dd73 Mon Sep 17 00:00:00 2001 +From: pavel-shirshov +Date: Mon, 27 Aug 2018 16:50:16 +0800 +Subject: [PATCH] [SNMP] Stop spamming logs with statfs permission denied log + message #1668 + +--- + agent/mibgroup/hardware/fsys/fsys_mntctl.c | 2 -- + agent/mibgroup/hardware/fsys/fsys_mntent.c | 2 -- + 2 files changed, 4 deletions(-) + +diff --git a/agent/mibgroup/hardware/fsys/fsys_mntctl.c b/agent/mibgroup/hardware/fsys/fsys_mntctl.c +index 9fbb068..adc38d6 100644 +--- a/agent/mibgroup/hardware/fsys/fsys_mntctl.c ++++ b/agent/mibgroup/hardware/fsys/fsys_mntctl.c +@@ -163,8 +163,6 @@ netsnmp_fsys_arch_load( void ) + continue; + + if ( statfs( entry->path, &stat_buf ) < 0 ) { +- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path ); +- snmp_log_perror( tmpbuf ); + continue; + } + entry->units = stat_buf.f_bsize; +diff --git a/agent/mibgroup/hardware/fsys/fsys_mntent.c b/agent/mibgroup/hardware/fsys/fsys_mntent.c +index 94d23db..5ad5e43 100644 +--- a/agent/mibgroup/hardware/fsys/fsys_mntent.c ++++ b/agent/mibgroup/hardware/fsys/fsys_mntent.c +@@ -238,8 +238,6 @@ netsnmp_fsys_arch_load( void ) + if ( NSFS_STATFS( entry->path, &stat_buf ) < 0 ) + #endif + { +- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path ); +- snmp_log_perror( tmpbuf ); + continue; + } + entry->units = stat_buf.NSFS_SIZE; +-- +2.7.4 + diff --git a/src/snmpd/patch-5.7.3+dfsg/0002-at.c-properly-check-return-status-from-realloc.-Than.patch b/src/snmpd/patch-5.7.3+dfsg/0002-at.c-properly-check-return-status-from-realloc.-Than.patch new file mode 100644 index 000000000000..ceb0c68352bf --- /dev/null +++ b/src/snmpd/patch-5.7.3+dfsg/0002-at.c-properly-check-return-status-from-realloc.-Than.patch @@ -0,0 +1,31 @@ +From e370973f273ffc1b32673bc94c5a46f75a846d82 Mon Sep 17 00:00:00 2001 +From: Niels Baggesen +Date: Wed, 31 Aug 2016 21:43:36 +0200 +Subject: [PATCH] at.c: properly check return status from realloc. Thanks to + Daniel Eiland (bug 2678) + +--- + agent/mibgroup/mibII/at.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/agent/mibgroup/mibII/at.c b/agent/mibgroup/mibII/at.c +index f57ba2a..a73fb8c 100644 +--- a/agent/mibgroup/mibII/at.c ++++ b/agent/mibgroup/mibII/at.c +@@ -638,11 +638,12 @@ ARP_Scan_Init(void) + struct arptab *newtab = (struct arptab *) + realloc(at, (sizeof(struct arptab) * + (arptab_curr_max_size + ARP_CACHE_INCR))); +- if (newtab == at) { ++ if (newtab == NULL) { + snmp_log(LOG_ERR, + "Error allocating more space for arpcache. " + "Cache will continue to be limited to %d entries", + arptab_curr_max_size); ++ newtab = at; + break; + } else { + arptab_curr_max_size += ARP_CACHE_INCR; +-- +2.7.4 + diff --git a/src/snmpd/patch-5.7.3+dfsg/series b/src/snmpd/patch-5.7.3+dfsg/series new file mode 100644 index 000000000000..6da32966e731 --- /dev/null +++ b/src/snmpd/patch-5.7.3+dfsg/series @@ -0,0 +1,2 @@ +0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch +0002-at.c-properly-check-return-status-from-realloc.-Than.patch diff --git a/src/snmpd/statfs_error.patch b/src/snmpd/statfs_error.patch deleted file mode 100644 index a07b59bc9175..000000000000 --- a/src/snmpd/statfs_error.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- agent/mibgroup/hardware/fsys/fsys_mntctl.c.old 2018-04-30 23:26:58.097636453 +0000 -+++ agent/mibgroup/hardware/fsys/fsys_mntctl.c 2018-04-30 23:27:36.189499479 +0000 -@@ -163,8 +163,6 @@ - continue; - - if ( statfs( entry->path, &stat_buf ) < 0 ) { -- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path ); -- snmp_log_perror( tmpbuf ); - continue; - } - entry->units = stat_buf.f_bsize; ---- agent/mibgroup/hardware/fsys/fsys_mntent.c.old 2018-04-30 23:26:54.569649140 +0000 -+++ agent/mibgroup/hardware/fsys/fsys_mntent.c 2018-04-30 23:27:22.001550497 +0000 -@@ -238,8 +238,6 @@ - if ( NSFS_STATFS( entry->path, &stat_buf ) < 0 ) - #endif - { -- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path ); -- snmp_log_perror( tmpbuf ); - continue; - } - entry->units = stat_buf.NSFS_SIZE; From 35d93f0c3b15044bdfc3168a1d91cf2957a05b36 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 4 Sep 2018 22:32:46 -0700 Subject: [PATCH 1601/1833] [build] Remove sudo calls from build process (#2015) * [build] Remove sudo calls from build process * Make regex more strict --- Makefile.work | 7 ++++--- README.md | 10 +++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile.work b/Makefile.work index 2dfab3274869..43a2a3669f0c 100644 --- a/Makefile.work +++ b/Makefile.work @@ -48,7 +48,8 @@ SLAVE_IMAGE = sonic-slave-$(USER) SLAVE_DIR = sonic-slave endif -INSMOD_OVERLAY := sudo modprobe overlay +OVERLAY_MODULE_CHECK := lsmod | grep "^overlay " > /dev/null 2>&1 || (echo "ERROR: Module 'overlay' not loaded. Try running 'sudo modprobe overlay'."; exit 1) + DOCKER_RUN := docker run --rm=true --privileged \ -v $(PWD):/sonic \ -w /sonic \ @@ -94,13 +95,13 @@ SONIC_BUILD_INSTRUCTION := make \ .DEFAULT_GOAL := all %:: + @$(OVERLAY_MODULE_CHECK) @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ $(DOCKER_BASE_BUILD) ; } @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } - @$(INSMOD_OVERLAY) ifeq "$(KEEP_SLAVE_ON)" "yes" ifdef SOURCE_FOLDER @$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/$(USER)/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash" @@ -116,13 +117,13 @@ sonic-slave-build : $(DOCKER_BUILD) sonic-slave-bash : + @$(OVERLAY_MODULE_CHECK) @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ { echo Image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) not found. Building... ; \ $(DOCKER_BASE_BUILD) ; } @docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \ { echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \ $(DOCKER_BUILD) ; } - @$(INSMOD_OVERLAY) @$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash showtag: diff --git a/README.md b/README.md index 9b667661cd82..548fca5ab96e 100644 --- a/README.md +++ b/README.md @@ -47,21 +47,25 @@ To clone the code repository recursively, assuming git version 1.9 or newer: To build SONiC installer image and docker images, run the following commands: + # Ensure the 'overlay' module is loaded on your development system + sudo modprobe overlay + + # Enter the source directory cd sonic-buildimage # (Optional) Checkout a specific branch. By default, it uses master branch git checkout [branch_name] - # Execute make init once after cloning the repo, or fetched remote repo with submodule updates + # Execute make init once after cloning the repo, or after fetching remote repo with submodule updates make init # Execute make configure once to configure ASIC make configure PLATFORM=[ASIC_VENDOR] - # build debian stretch required targets (optional) + # Build Debian Stretch required targets (Manual execution optional; will also be executed as part of the build) BLDENV=stretch make stretch - # build SONiC image + # Build SONiC image make all **NOTE**: From 30c254fbc2a1dcf8c02239dc6f62759ffe6d9f72 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 4 Sep 2018 22:33:50 -0700 Subject: [PATCH 1602/1833] [arista] Update swi building recipe (#2014) --- build_image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_image.sh b/build_image.sh index 757ea026f16d..d1f9c2241ae6 100755 --- a/build_image.sh +++ b/build_image.sh @@ -95,7 +95,7 @@ elif [ "$IMAGE_TYPE" = "aboot" ]; then zip -g $ABOOT_BOOT_IMAGE .imagehash rm .imagehash echo "SWI_VERSION=42.0.0" > version - echo "SWI_MAX_HWEPOCH=1" >> version + echo "SWI_MAX_HWEPOCH=2" >> version echo "SWI_VARIANT=US" >> version zip -g $OUTPUT_ABOOT_IMAGE version zip -g $ABOOT_BOOT_IMAGE version From dc22ed076a7dbb78bdde37ecc95f11f4b7af9924 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 5 Sep 2018 10:08:48 -0700 Subject: [PATCH 1603/1833] [platform-common]: update sonic-platform-common (#2018) 6d8c940 [sff8472] Fix incorrect VendorOUI decode type. (#11) Signed-off-by: Guohan Lu --- src/sonic-platform-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 664d6cc37b14..6d8c9402a286 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 664d6cc37b1404ce076bf1addb62e55f93240258 +Subproject commit 6d8c9402a286b1ddf37bcb605119b751e2b736f7 From d3c1423d084d5ccbc0d6b05c6fd42c26f15a53dc Mon Sep 17 00:00:00 2001 From: Pradchaya P Date: Thu, 6 Sep 2018 00:10:13 +0700 Subject: [PATCH 1604/1833] [platform/dx010] Fix issing qsfp_reset sysfs file (#2007) * Fix qsfp_reset file missing. * [platform/dx010] Add systemd unit for platform init. --- .../debian/platform-modules-dx010.init | 1 - .../debian/platform-modules-dx010.install | 1 + .../debian/platform-modules-dx010.postinst | 3 + .../dx010/modules/dx010_cpld.c | 59 ++++++++++++++++++- .../systemd/platform-modules-dx010.service | 14 +++++ 5 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.postinst create mode 100644 platform/broadcom/sonic-platform-modules-cel/dx010/systemd/platform-modules-dx010.service 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 index f32785a798ca..2117ab22b402 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.init @@ -33,7 +33,6 @@ case "$1" in start) echo -n "Setting up board... " - depmod -a modprobe i2c-dev modprobe i2c-mux-pca954x modprobe dx010_wdt diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install index 329b584dc427..b25d47022b08 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install @@ -1,2 +1,3 @@ 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 new file mode 100644 index 000000000000..baff704171c7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.postinst @@ -0,0 +1,3 @@ +depmod -a +systemctl enable platform-modules-dx010.service +systemctl start platform-modules-dx010.service 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 index ab0692faab78..397361a5edd6 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_cpld.c +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/dx010_cpld.c @@ -30,6 +30,13 @@ #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 @@ -51,6 +58,7 @@ #define INT2229 0x3d6 #define INT3032 0x3d7 + #define LENGTH_PORT_CPLD 34 #define PORT_BANK1_START 1 #define PORT_BANK1_END 10 @@ -106,6 +114,53 @@ struct dx010_cpld_data { 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) { @@ -193,11 +248,13 @@ static ssize_t get_modirq(struct device *dev, struct device_attribute *devattr, 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, @@ -247,7 +304,6 @@ static int i2c_read_eeprom(struct i2c_adapter *a, u16 addr, short temp; short portid, opcode, devaddr, cmdbyte0, ssrr, writedata, readdata; __u16 word_data; - char read_byte; int error = -EIO; mutex_lock(&cpld_data->cpld_lock); @@ -465,7 +521,6 @@ static int cel_dx010_lpc_drv_probe(struct platform_device *pdev) static int cel_dx010_lpc_drv_remove(struct platform_device *pdev) { int portid_count; - struct dx010_i2c_data *new_data; sysfs_remove_group(&pdev->dev.kobj, &dx010_lpc_attr_grp); 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 new file mode 100644 index 000000000000..32827dcf0dec --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/systemd/platform-modules-dx010.service @@ -0,0 +1,14 @@ + +[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 From be9f3ad7c1aabcb1aecfd8212b1acbee5c9581e0 Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 5 Sep 2018 15:28:32 -0700 Subject: [PATCH 1605/1833] [build]: use vfs storage driver to build dockers (#2016) seen issues to build dockers using aufs in ubuntu 18.04 Immedidate dockers are exported to docker file and then imported into sonic image. Thus, whether using vfs or aufs as the storage driver does not matter for the immediate build. Signed-off-by: Guohan Lu --- slave.mk | 2 ++ sonic-slave/Dockerfile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index 4f1998680b29..c0e227267113 100644 --- a/slave.mk +++ b/slave.mk @@ -385,6 +385,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g $(HEADER) # Apply series of patches if exist if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && QUILT_PATCHES=../$(notdir $($*.gz_PATH)).patch quilt push -a; popd; fi + docker info $(LOG) docker build --squash --no-cache \ --build-arg http_proxy=$(HTTP_PROXY) \ --build-arg https_proxy=$(HTTPS_PROXY) \ @@ -416,6 +417,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile + docker info $(LOG) docker build --squash --no-cache \ --build-arg http_proxy=$(HTTP_PROXY) \ --build-arg https_proxy=$(HTTPS_PROXY) \ diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 961df459d003..32218b44d1df 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -298,4 +298,4 @@ RUN add-apt-repository \ stable" RUN apt-get update RUN apt-get install -y docker-ce=17.03.2~ce-0~debian-jessie -RUN echo "DOCKER_OPTS=\"--experimental\"" >> /etc/default/docker +RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker From 48f3b6c008f517a183f0e949a5aab30703eee52e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 5 Sep 2018 18:45:48 -0700 Subject: [PATCH 1606/1833] [sonic-swss]: Update sonic-swss. vxlan enhancements (#2021) --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 58a644794a26..29722e115b01 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 58a644794a2650599e1102425f3903f56ff53835 +Subproject commit 29722e115b019678219ad284457663fa1c947ff5 From 6af462ac5336edb1d3103f2311afae326c4a07ba Mon Sep 17 00:00:00 2001 From: paavaanan Date: Fri, 7 Sep 2018 11:57:23 +0530 Subject: [PATCH 1607/1833] Dell platform modules for S6100/Z9100 is added with systemd support (#2026) --- .../debian/platform-modules-s6100.install | 2 +- .../debian/platform-modules-z9100.install | 1 + .../s6100/systemd/platform-modules-s6100.service | 14 ++++++++++++++ .../z9100/scripts/platform_sensors.py | 8 ++++---- .../z9100/systemd/platform-modules-z9100.service | 13 +++++++++++++ 5 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 platform/broadcom/sonic-platform-modules-dell/s6100/systemd/platform-modules-s6100.service create mode 100644 platform/broadcom/sonic-platform-modules-dell/z9100/systemd/platform-modules-z9100.service diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install index f456acb9d812..2e57c0a045e3 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install @@ -6,4 +6,4 @@ common/fstrim.timer etc/systemd/system common/fstrim.service etc/systemd/system s6100/scripts/platform_sensors.py usr/local/bin s6100/scripts/sensors usr/bin - +s6100/systemd/platform-modules-s6100.service etc/systemd/system/multi-user.target.wants diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install index 66d24e98e89c..8425d8fc7a0b 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install @@ -6,3 +6,4 @@ common/fstrim.service etc/systemd/system z9100/scripts/platform_sensors.py usr/local/bin z9100/scripts/sensors usr/bin z9100/cfg/z9100-modules.conf etc/modules-load.d +z9100/systemd/platform-modules-z9100.service etc/systemd/system/multi-user.target.wants diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/platform-modules-s6100.service b/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/platform-modules-s6100.service new file mode 100644 index 000000000000..9b5805d5cbbb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/platform-modules-s6100.service @@ -0,0 +1,14 @@ +[Unit] +Description=Dell S6100 Platform modules +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStartPre=/usr/local/bin/iom_power_on.sh +ExecStart=/usr/local/bin/s6100_platform.sh init +ExecStop=/usr/local/bin/s6100_platform.sh deinit +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/platform_sensors.py index 763e65772282..1457537918f4 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/platform_sensors.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/platform_sensors.py @@ -16,7 +16,7 @@ Z9100_MAX_PSUS = 2 S6100_MAX_IOMS = 4 -MAILBOX_DIR = "/sys/devices/platform/SMF.512/hwmon/hwmon1" +MAILBOX_DIR = "/sys/devices/platform/SMF.512/hwmon/hwmon0" # Get a mailbox register @@ -42,10 +42,10 @@ def get_pmc_register(reg_name): logging.basicConfig(level=logging.DEBUG) if (os.path.isdir(MAILBOX_DIR)): - print 'dell-s6100-lpc' - print 'Adapter: S6100 Platform Management Controller' + print 'dell-z9100-lpc' + print 'Adapter: Z9100 Platform Management Controller' else: - logging.error('S6100 Platform Management Controller module not loaded !') + logging.error('Z9100 Platform Management Controller module not loaded !') # sys.exit(0) # Print the information for temperature sensors diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/systemd/platform-modules-z9100.service b/platform/broadcom/sonic-platform-modules-dell/z9100/systemd/platform-modules-z9100.service new file mode 100644 index 000000000000..00fbfa6803ef --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/systemd/platform-modules-z9100.service @@ -0,0 +1,13 @@ +[Unit] +Description=Dell Z9100 Platform modules +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/z9100_platform.sh init +ExecStop=/usr/local/bin/z9100_platform.sh deinit +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target From 588da73a7d6ad8bb588b2201285d1d7dfa2a0285 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 7 Sep 2018 10:40:20 -0700 Subject: [PATCH 1608/1833] [kernel]: update sonic linux kernel submodule (#2027) * a910776 2018-09-07 | import upstream optoe chunk offset fix (#60) [lguohan] * 5b4c0aa 2018-09-04 | enable GPIO_ICH (#59) [klhaung] Signed-off-by: Guohan Lu --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index c87ebef623b6..a910776f0519 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit c87ebef623b60455edbdd71e33ac2c204b9e681d +Subproject commit a910776f051945689daa02c0e476576df560491a From 3f049d33bf2c9f792f4cebd5d24dd9010a3562c0 Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Fri, 7 Sep 2018 12:25:38 -0700 Subject: [PATCH 1609/1833] =?UTF-8?q?Warm=20reboot:=20Don't=20load=20json?= =?UTF-8?q?=20conifg=20like=20copp,=20ininip,=20ports=20and=20switch=20aga?= =?UTF-8?q?in=20upon=E2=80=A6=20(#1939)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Don't load json conifg like copp, ininip, ports and switch again upon swss warm start Signed-off-by: Jipan Yang * double check DB data exists in case only swss warm restart is configured at system reboot Signed-off-by: Jipan Yang * Double check existence of db data before skipping json load, and format update Signed-off-by: Jipan Yang --- dockers/docker-orchagent/swssconfig.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 850a4afd1ef5..7188703d23ea 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -41,6 +41,18 @@ fast_reboot 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` +if [[ "$SYSTEM_WARM_START" == "true" ]] || [[ "$SWSS_WARM_START" == "true" ]]; then + # We have to make sure db data has not been flushed. + RESTART_COUNT=`redis-cli -n 6 hget "WARM_RESTART_TABLE|orchagent" restart_count` + if [[ -n "$RESTART_COUNT" ]] && [[ "$RESTART_COUNT" != "0" ]]; then + exit 0 + fi +fi + SWSSCONFIG_ARGS="00-copp.config.json ipinip.json ports.json switch.json " for file in $SWSSCONFIG_ARGS; do From 22edc3389645535cb8487addbe41d990c3ec6baa Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 7 Sep 2018 12:59:10 -0700 Subject: [PATCH 1610/1833] [broadcom]: upgrade SAI to 3.1.3.5-8 (#2028) Fix get_fdb_entry_attribute bridge port ID [Shuotian Cheng] Signed-off-by: Guohan Lu --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 1ae99439fda0..72ff4bba1a29 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.5-7_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm_3.1.3.5-7_amd64.deb?sv=2015-04-05&sr=b&sig=0FaCT4a%2B07%2FkMIqZQF8NKk3UQL%2BU5M9icfe23F6rThY%3D&se=2155-07-10T08%3A53%3A11Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.5-8_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm_3.1.3.5-8_amd64.deb?sv=2015-04-05&sr=b&sig=vM4LXDn4RIIxfK6lNL2mkEAnSPyaNgEH2QAfHSySMEg%3D&se=2155-07-31T18%3A43%3A06Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-7_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-8_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-7_amd64.deb?sv=2015-04-05&sr=b&sig=aTEosIZH90NExzK3opDzVFB%2FhWATEggoxKaTYudoR3I%3D&se=2155-07-10T08%3A53%3A39Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-8_amd64.deb?sv=2015-04-05&sr=b&sig=ehMedaC6GDviSVEhsCygfLS%2FG9gijkBjZT2y5WxByls%3D&se=2155-07-31T18%3A36%3A17Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From c4154eb9a96070ca57881c386c02527dbbbaaf92 Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Sun, 9 Sep 2018 00:13:19 -0700 Subject: [PATCH 1611/1833] [devices]: Add GPIO interrupt enable for Z9100/S6100 and transceiver-plug-inout-event for Z9100 (#2025) --- .../plugins/sfputil.py | 70 ++ .../common/dell_ich.c | 1042 +++++++++++++++++ .../sonic-platform-modules-dell/debian/rules | 8 +- .../s6100/modules/Makefile | 2 +- .../s6100/modules/dell_s6100_iom_cpld.c | 218 ++++ .../s6100/scripts/s6100_platform.sh | 24 + .../z9100/modules/Makefile | 2 +- .../z9100/modules/dell_z9100_cpld.c | 218 ++++ .../z9100/scripts/z9100_platform.sh | 24 + 9 files changed, 1604 insertions(+), 4 deletions(-) create mode 100644 platform/broadcom/sonic-platform-modules-dell/common/dell_ich.c diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py index 5609abe9b49a..1524c1bc0156 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py @@ -4,7 +4,10 @@ # try: + import os + import logging import time + import select from sonic_sfp.sfputilbase import SfpUtilBase except ImportError as e: raise ImportError("%s - required module not found" % str(e)) @@ -337,3 +340,70 @@ def reset(self, port_num): reg_file.close() return True + + def get_register(self, reg_file): + retval = 'ERR' + + if (not os.path.isfile(reg_file)): + print reg_file, 'not found !' + return retval + + try: + with open(reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", reg_file, "file !") + + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + return retval + + def get_transceiver_change_event(self, timeout=0): + epoll = select.epoll() + port_dict = {} + try: + # We get notified when there is an SCI interrupt from GPIO SUS6 + fd = open("/sys/devices/platform/dell_ich.0/sci_int_gpio_sus6", "r") + epoll.register(fd.fileno(), select.EPOLLIN) + events = epoll.poll(timeout=timeout if timeout != 0 else -1) + if events: + # Read the QSFP ABS interrupt & status registers + cpld2_abs_int = self.get_register("/sys/class/i2c-adapter/i2c-14/14-003e/qsfp_abs_int") + cpld2_abs_sta = self.get_register("/sys/class/i2c-adapter/i2c-14/14-003e/qsfp_abs_sta") + cpld3_abs_int = self.get_register("/sys/class/i2c-adapter/i2c-15/15-003e/qsfp_abs_int") + cpld3_abs_sta = self.get_register("/sys/class/i2c-adapter/i2c-15/15-003e/qsfp_abs_sta") + cpld4_abs_int = self.get_register("/sys/class/i2c-adapter/i2c-16/16-003e/qsfp_abs_int") + cpld4_abs_sta = self.get_register("/sys/class/i2c-adapter/i2c-16/16-003e/qsfp_abs_sta") + + if (cpld2_abs_int == 'ERR' or cpld2_abs_sta == 'ERR' or \ + cpld3_abs_int == 'ERR' or cpld3_abs_sta == 'ERR' or \ + cpld4_abs_int == 'ERR' or cpld4_abs_sta == 'ERR' ): + return False, {} + + cpld2_abs_int = int(cpld2_abs_int, 16) + cpld2_abs_sta = int(cpld2_abs_sta, 16) + cpld3_abs_int = int(cpld3_abs_int, 16) + cpld3_abs_sta = int(cpld3_abs_sta, 16) + cpld4_abs_int = int(cpld4_abs_int, 16) + cpld4_abs_sta = int(cpld4_abs_sta, 16) + + # Make it contiguous (discard reserved bits) + interrupt_reg = (cpld2_abs_int & 0xfff) | ((cpld3_abs_int & 0x3ff) << 12) | ((cpld4_abs_int & 0x3ff) << 22) + status_reg = (cpld2_abs_sta & 0xfff) | ((cpld3_abs_sta & 0x3ff) << 12) | ((cpld4_abs_sta & 0x3ff) << 22) + + port=self.port_start + while port <= self.port_end: + if interrupt_reg & (1< optics is removed + port_dict[port] = '0' + else: + # status reg 0 => optics is inserted + port_dict[port] = '1' + port += 1 + return True, port_dict + finally: + fd.close() + epoll.close() + + return False, {} diff --git a/platform/broadcom/sonic-platform-modules-dell/common/dell_ich.c b/platform/broadcom/sonic-platform-modules-dell/common/dell_ich.c new file mode 100644 index 000000000000..8bfe4295cb64 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/common/dell_ich.c @@ -0,0 +1,1042 @@ +/* Copyright (c) 2018 Dell Inc. + * dell_ich.c - ICH driver for Dell Avoton/Rangeley switches + * + * 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. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRV_NAME "dell_ich" + +#define AVOTON_PCU_DEVICE_ID 0x1f38 + +// GPIO registers +// GPIO Core Control/Access Registers in I/O Space +#define GPIO_SC_USE_SEL 0x0 +#define GPIO_SC_IO_SEL 0x4 +#define GPIO_SC_GP_LVL 0x8 +#define GPIO_SC_TPE 0xC +#define GPIO_SC_TNE 0x10 +#define GPIO_SC_TS 0x14 + +// GPIO SUS Control/Access Registers in I/O Space +#define GPIO_SUS_USE_SEL 0x80 +#define GPIO_SUS_IO_SEL 0x84 +#define GPIO_SUS_GP_LVL 0x88 +#define GPIO_SUS_TPE 0x8C +#define GPIO_SUS_TNE 0x90 +#define GPIO_SUS_TS 0x94 +#define GPIO_SUS_WAKE_EN 0x98 + +static const unsigned char avoton_gpio_regs[] = { + GPIO_SC_USE_SEL, + GPIO_SC_IO_SEL, + GPIO_SC_GP_LVL, + GPIO_SC_TPE, + GPIO_SC_TNE, + GPIO_SC_TS, + GPIO_SUS_USE_SEL, + GPIO_SUS_IO_SEL, + GPIO_SUS_GP_LVL, + GPIO_SUS_TPE, + GPIO_SUS_TNE, + GPIO_SUS_TS, + GPIO_SUS_WAKE_EN +}; + +#define GPIO_REG_LEN 0x4 + +#define GPIOS0_EN (1 << 0) +#define GPIOS1_EN (1 << 1) +#define GPIOS2_EN (1 << 2) +#define GPIOS3_EN (1 << 3) +#define GPIOS4_EN (1 << 4) +#define GPIOS5_EN (1 << 5) +#define GPIOS6_EN (1 << 6) +#define GPIOS7_EN (1 << 7) + +#define GPIOSUS0_EN (1 << 0) +#define GPIOSUS1_EN (1 << 1) +#define GPIOSUS2_EN (1 << 2) +#define GPIOSUS3_EN (1 << 3) +// GPIOSUS4_EN : unused +// GPIOSUS5_EN : unused +#define GPIOSUS6_EN (1 << 6) +#define GPIOSUS7_EN (1 << 7) + + +// GPE0a_EN - General Purpose Event 0 Enables +#define GPIO_GPE0a_EN_SUS0 (1 << 16) +#define GPIO_GPE0a_EN_SUS1 (1 << 17) +#define GPIO_GPE0a_EN_SUS2 (1 << 18) +#define GPIO_GPE0a_EN_SUS3 (1 << 19) +// GPIO_GPE0a_EN_SUS4 : unused +// GPIO_GPE0a_EN_SUS5 : unused +#define GPIO_GPE0a_EN_SUS6 (1 << 22) +#define GPIO_GPE0a_EN_SUS7 (1 << 23) + +#define GPIO_GPE0a_EN_CORE0 (1 << 24) +#define GPIO_GPE0a_EN_CORE1 (1 << 25) +#define GPIO_GPE0a_EN_CORE2 (1 << 26) +#define GPIO_GPE0a_EN_CORE3 (1 << 27) +#define GPIO_GPE0a_EN_CORE4 (1 << 28) +#define GPIO_GPE0a_EN_CORE5 (1 << 29) +#define GPIO_GPE0a_EN_CORE6 (1 << 30) +#define GPIO_GPE0a_EN_CORE7 (1 << 31) + +// GPE0a_STS - General Purpose Event 0 Status +// We're interested in only SUS6 for now +#define GPIO_GPE0a_STS_SUS6 (1 << 22) + +// GPIO_ROUT - GPIO_ROUT Register +#define GPIO_ROUT_OFFSET_SUS0 0 +#define GPIO_ROUT_OFFSET_SUS1 2 +#define GPIO_ROUT_OFFSET_SUS2 4 +#define GPIO_ROUT_OFFSET_SUS3 6 +// GPIO_ROUT_OFFSET_SUS4 : unused +// GPIO_ROUT_OFFSET_SUS5 : unused +#define GPIO_ROUT_OFFSET_SUS6 12 +#define GPIO_ROUT_OFFSET_SUS7 14 + +#define GPIO_ROUT_OFFSET_CORE0 16 +#define GPIO_ROUT_OFFSET_CORE1 18 +#define GPIO_ROUT_OFFSET_CORE2 20 +#define GPIO_ROUT_OFFSET_CORE3 22 +#define GPIO_ROUT_OFFSET_CORE4 24 +#define GPIO_ROUT_OFFSET_CORE5 26 +#define GPIO_ROUT_OFFSET_CORE6 28 +#define GPIO_ROUT_OFFSET_CORE7 30 + +enum GPIO_ROUT { + GPIO_NO_EFFECT = 0, + GPIO_SMI, + GPIO_SCI, + GPIO_RESERVED +}; + +/* + * GPIO resources + * defined as in drivers/gpio/gpio-ich.c + */ +#define ICH_RES_GPIO 0 +#define ICH_RES_GPE0 1 +static struct resource gpio_ich_res[] = { + /* GPIO */ + { + .flags = IORESOURCE_IO, + }, + /* ACPI - GPE0 */ + { + .flags = IORESOURCE_IO, + }, +}; + +// ACPI registers +#define ACPI_GPE0a_STS 0x20 +#define ACPI_GPE0a_EN 0x28 + +// PMC registers +#define PMC_GPIO_ROUT 0x58 +#define PMC_REG_LEN 0x4 + +// lpc_ich_priv is derived from drivers/mfd/lpc_ich.c +struct lpc_ich_priv { + int chipset; + + int abase; /* ACPI base */ + int actrl_pbase; /* ACPI control or PMC base */ + int gbase; /* GPIO base */ + int gctrl; /* GPIO control */ + + int abase_save; /* Cached ACPI base value */ + int actrl_pbase_save; /* Cached ACPI control or PMC base value */ + int gctrl_save; /* Cached GPIO control value */ +}; + +#define ICH_RES_MEM_GCS_PMC 0 + +#define IO_REG_WRITE(val, reg, base_res) outl(val, (reg) + (base_res)->start) +#define IO_REG_READ(reg, base_res) inl((reg) + (base_res)->start) + +struct resource pmc_res = {.flags = IORESOURCE_MEM,}; + +static struct kobject *dell_kobj; +static unsigned short force_id; +module_param(force_id, ushort, 0); + +#define SMF_REG_ADDR 0x200 +#define SIO_REG_DEVID 0x1 +#define SIO_Z9100_ID 0x1 +#define SIO_S6100_ID 0x2 +#define SIO_S4200_ID 0x3 +#define SIO_S5148_ID 0x4 + +enum kinds { + z9100smf, s6100smf +}; + +struct dell_ich_data { + enum kinds kind; + struct resource *gpio_base, *acpi_base, *pmc_base; + int gpio_alloc,pmc_alloc; + unsigned int int_gpio_sus6_count; +}; + +// GPIO sysfs attributes + +static ssize_t get_sc_use_sel(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SC_USE_SEL,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sc_use_sel(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SUS_USE_SEL,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sc_io_sel(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SC_IO_SEL,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sc_io_sel(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SC_IO_SEL,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sc_gp_lvl(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SC_GP_LVL,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sc_gp_lvl(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SC_GP_LVL,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sc_gp_tpe(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SC_TPE,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sc_gp_tpe(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SC_TPE,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sc_gp_tne(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SC_TNE,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sc_gp_tne(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SC_TNE,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sc_gp_ts(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SC_TS,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sc_gp_ts(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SC_TS,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sus_use_sel(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SUS_USE_SEL,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sus_use_sel(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SUS_USE_SEL,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sus_io_sel(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SUS_IO_SEL,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sus_io_sel(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SUS_IO_SEL,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sus_gp_lvl(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SUS_GP_LVL,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sus_gp_lvl(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SUS_GP_LVL,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sus_gp_tpe(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SUS_TPE,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sus_gp_tpe(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SUS_TPE,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sus_gp_tne(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SUS_TNE,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sus_gp_tne(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SUS_TNE,ich_data->gpio_base); + + return count; +} + +static ssize_t get_sus_gp_ts(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(GPIO_SUS_TS,ich_data->gpio_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sus_gp_ts(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,GPIO_SUS_TS,ich_data->gpio_base); + + return count; +} + +static DEVICE_ATTR(sc_use_sel, S_IRUGO | S_IWUSR, get_sc_use_sel, set_sc_use_sel); +static DEVICE_ATTR(sc_io_sel, S_IRUGO | S_IWUSR, get_sc_io_sel, set_sc_io_sel); +static DEVICE_ATTR(sc_gp_lvl, S_IRUGO | S_IWUSR, get_sc_gp_lvl, set_sc_gp_lvl); +static DEVICE_ATTR(sc_gp_tpe, S_IRUGO | S_IWUSR, get_sc_gp_tpe, set_sc_gp_tpe); +static DEVICE_ATTR(sc_gp_tne, S_IRUGO | S_IWUSR, get_sc_gp_tne, set_sc_gp_tne); +static DEVICE_ATTR(sc_gp_ts, S_IRUGO | S_IWUSR, get_sc_gp_ts, set_sc_gp_ts); +static DEVICE_ATTR(sus_use_sel, S_IRUGO | S_IWUSR, get_sus_use_sel,set_sus_use_sel); +static DEVICE_ATTR(sus_io_sel, S_IRUGO | S_IWUSR, get_sus_io_sel, set_sus_io_sel); +static DEVICE_ATTR(sus_gp_lvl, S_IRUGO | S_IWUSR, get_sus_gp_lvl, set_sus_gp_lvl); +static DEVICE_ATTR(sus_gp_tpe, S_IRUGO | S_IWUSR, get_sus_gp_tpe, set_sus_gp_tpe); +static DEVICE_ATTR(sus_gp_tne, S_IRUGO | S_IWUSR, get_sus_gp_tne, set_sus_gp_tne); +static DEVICE_ATTR(sus_gp_ts, S_IRUGO | S_IWUSR, get_sus_gp_ts, set_sus_gp_ts); + +static struct attribute *gpio_attrs[] = { + &dev_attr_sc_use_sel.attr, + &dev_attr_sc_io_sel.attr, + &dev_attr_sc_gp_lvl.attr, + &dev_attr_sc_gp_tpe.attr, + &dev_attr_sc_gp_tne.attr, + &dev_attr_sc_gp_ts.attr, + &dev_attr_sus_use_sel.attr, + &dev_attr_sus_io_sel.attr, + &dev_attr_sus_gp_lvl.attr, + &dev_attr_sus_gp_tpe.attr, + &dev_attr_sus_gp_tne.attr, + &dev_attr_sus_gp_ts.attr, + NULL, +}; + +static struct attribute_group gpio_attrs_group= { + .attrs = gpio_attrs, +}; + +// ACPI sysfs attributes + +static ssize_t get_gpe0a_sts(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(ACPI_GPE0a_STS,ich_data->acpi_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_gpe0a_sts(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,ACPI_GPE0a_STS,ich_data->acpi_base); + + return count; +} + +static ssize_t get_gpe0a_en(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = IO_REG_READ(ACPI_GPE0a_EN,ich_data->acpi_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_gpe0a_en(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + IO_REG_WRITE(devdata,ACPI_GPE0a_EN,ich_data->acpi_base); + + return count; +} + +static DEVICE_ATTR(gpe0a_sts, S_IRUGO | S_IWUSR, get_gpe0a_sts, set_gpe0a_sts); +static DEVICE_ATTR(gpe0a_en, S_IRUGO | S_IWUSR, get_gpe0a_en, set_gpe0a_en); + +static struct attribute *acpi_attrs[] = { + &dev_attr_gpe0a_sts.attr, + &dev_attr_gpe0a_en.attr, + NULL, +}; + +static struct attribute_group acpi_attrs_group= { + .attrs = acpi_attrs, +}; + +static ssize_t get_gpio_rout(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = readl(ich_data->pmc_base); + return sprintf(buf,"0x%08x\n",devdata); +} + +// PMC sysfs attributes + +static ssize_t set_gpio_rout(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + writel(devdata,ich_data->pmc_base); + + return count; +} + +static DEVICE_ATTR(gpio_rout, S_IRUGO | S_IWUSR, get_gpio_rout, set_gpio_rout); + +static struct attribute *pmc_attrs[] = { + &dev_attr_gpio_rout.attr, + NULL, +}; + +static struct attribute_group pmc_attrs_group= { + .attrs = pmc_attrs, +}; + +// SCI interrupt sysfs attributes + +static ssize_t get_sci_int_gpio_sus6(struct device *dev, struct device_attribute *devattr, char *buf) +{ + u32 devdata=0; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!ich_data) return sprintf(buf, "read error"); + + devdata = ich_data->int_gpio_sus6_count; + return sprintf(buf,"0x%08x\n",devdata); +} + +static ssize_t set_sci_int_gpio_sus6(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + ich_data->int_gpio_sus6_count = devdata; + + return count; +} + +static DEVICE_ATTR(sci_int_gpio_sus6, S_IRUGO | S_IWUSR, get_sci_int_gpio_sus6, set_sci_int_gpio_sus6); + +static struct attribute *sci_attrs[] = { + &dev_attr_sci_int_gpio_sus6.attr, + NULL, +}; + +static struct attribute_group sci_attrs_group= { + .attrs = sci_attrs, +}; + +static u32 dell_ich_sci_handler(void *context) +{ + unsigned int data; + struct device *dev = (struct device *)context; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + if(!dev) return ACPI_INTERRUPT_NOT_HANDLED; + + ich_data = dev_get_platdata(dev); + if(!ich_data) return ACPI_INTERRUPT_NOT_HANDLED; + + data=IO_REG_READ(ACPI_GPE0a_STS,ich_data->acpi_base); + if(data & GPIO_GPE0a_STS_SUS6) { + // Clear the SUS6 status + IO_REG_WRITE(data,ACPI_GPE0a_STS,ich_data->acpi_base); + ich_data->int_gpio_sus6_count++; + // and notify the user space clients + sysfs_notify(&dev->kobj, NULL, "sci_int_gpio_sus6"); + return ACPI_INTERRUPT_HANDLED; + } + + return ACPI_INTERRUPT_NOT_HANDLED; +} + +/* + * Setup GPIO SUS6 to generate an SCI interrupt for optics detection + * This can be alternatively be setup using sysfs + */ +int setup_gpio_sus6_sci_interrupt(struct device *dev) +{ + int ret=0; + unsigned int data; + struct resource *acpi_base, *pmc_base, *gpio_base; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + + gpio_base = ich_data->gpio_base; + acpi_base = ich_data->acpi_base; + pmc_base = ich_data->pmc_base; + + // Enable GPIOSUS6_EN + data = IO_REG_READ(GPIO_SUS_USE_SEL,gpio_base); + data |= GPIOSUS6_EN; + IO_REG_WRITE(data,GPIO_SUS_USE_SEL,gpio_base); + + // GPIOSUS6_EN is input + data = IO_REG_READ(GPIO_SUS_IO_SEL,gpio_base); + data |= GPIOSUS6_EN; + IO_REG_WRITE(data,GPIO_SUS_IO_SEL,gpio_base); + + // Trigger on positive edge for GPIOSUS6_EN + data = IO_REG_READ(GPIO_SUS_TPE,gpio_base); + data |= GPIOSUS6_EN; + IO_REG_WRITE(data,GPIO_SUS_TPE,gpio_base); + + // Enable GPE for SUS6 to generate an SCI + data=IO_REG_READ(ACPI_GPE0a_EN,acpi_base); + data|=GPIO_GPE0a_EN_SUS6; + IO_REG_WRITE(data,ACPI_GPE0a_EN,acpi_base); + + data=readl(pmc_base); + data=(data & ~(0x3 << GPIO_ROUT_OFFSET_SUS6)) | (GPIO_SCI << GPIO_ROUT_OFFSET_SUS6); + writel(data,pmc_base); + + ret = acpi_install_sci_handler(dell_ich_sci_handler,(void*)dev); + if(ret) { + pr_info("dell_ich acpi_install_sci_handler failed %d\n",ret); + return ret; + } + + return ret; +} + +static int dell_ich_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + struct pci_dev *lpc_ich_dev; + struct lpc_ich_priv *priv; + struct resource *res; + unsigned int base_addr_cfg, base_addr; + int ret,i; + + // Get the PCU device + lpc_ich_dev=pci_get_device(PCI_VENDOR_ID_INTEL,AVOTON_PCU_DEVICE_ID,NULL); + priv=(struct lpc_ich_priv*) pci_get_drvdata(lpc_ich_dev); + if(!priv) { + pr_info("dell_ich: Unable to retrieve private data\n"); + return -ENODEV; + } + + // Retrieve the GPIO Base (that was initialized by lpc-ich) + pci_read_config_dword(lpc_ich_dev, priv->gbase, &base_addr_cfg); + base_addr = base_addr_cfg & 0x0000ff80; + if (!base_addr) { + pr_info("dell_ich I/O space for GPIO uninitialized\n"); + ret = -ENODEV; + goto probe_err; + } + + res = &gpio_ich_res[ICH_RES_GPIO]; + res->start = base_addr; + res->end = res->start + 0x9c - 1; + ret = acpi_check_resource_conflict(res); + if (ret) { + pr_info("dell_ich gpio resource conflict ret %d\n",ret); + } + + ich_data->gpio_base=res; + // Request regions for GPIO registers + for(i=0; istart+avoton_gpio_regs[i],GPIO_REG_LEN, "dell_ich_gpio")) { + pr_info("dell_ich: request_region failed for GPIO : %x\n",(unsigned int) res->start+avoton_gpio_regs[i]); + ret = -EBUSY; + goto probe_err; + } + ich_data->gpio_alloc |= (1<kobj, &gpio_attrs_group); + if (ret) { + pr_info("dell_ich cannot create sysfs for GPIO %d\n",ret); + ret = -ENOMEM; + goto probe_err; + } + + // Retrieve the ACPI Base (that was initialized by lpc-ich) + pci_read_config_dword(lpc_ich_dev, priv->abase, &base_addr_cfg); + base_addr = base_addr_cfg & 0x0000ff80; + if (!base_addr) { + pr_info("dell_ich I/O space for ACPI uninitialized\n"); + ret = -ENODEV; + goto probe_err; + } + + res = &gpio_ich_res[ICH_RES_GPE0]; + res->start = base_addr; + res->end = base_addr + 0x40; + ret = acpi_check_resource_conflict(res); + if (ret) { + pr_info("dell_ich acpi resource conflict ret %d\n",ret); + } + + // ACPI region is requested by pnp 00:01/ACPI GPE0_BLK + ich_data->acpi_base=res; + + /* Register sysfs hooks for ACPI */ + ret = sysfs_create_group(&dev->kobj, &acpi_attrs_group); + if (ret) { + pr_info("dell_ich cannot create sysfs for ACPI %d\n",ret); + ret = -ENOMEM; + goto probe_err; + } + + // Retrieve the PMC Base (that was initialized by lpc-ich) + pci_read_config_dword(lpc_ich_dev, priv->actrl_pbase, &base_addr_cfg); + base_addr = base_addr_cfg & 0xfffffe00; + pr_info("dell_ich base_addr_cfg %x base_addr %x\n",(int)base_addr_cfg,(int)base_addr); + if (!base_addr) { + pr_info("dell_ich PMC space for GPIO uninitialized\n"); + ret = -ENODEV; + goto probe_err; + } + + res = &pmc_res; + res->start = base_addr + PMC_GPIO_ROUT; + res->end = base_addr + PMC_GPIO_ROUT + PMC_REG_LEN - 1; + pr_info("dell_ich pmc res_start:end %x:%x\n",(int)res->start,(int)res->end); + + ret = acpi_check_resource_conflict(res); + if (ret) { + pr_info("dell_ich acpi resource conflict ret %d\n",ret); + } + + if (!request_mem_region(res->start,resource_size(res),"dell_ich_pmc")) { + pr_info("dell_ich pmc request_region failed\n"); + ret = -EBUSY; + goto probe_err; + } else { + ich_data->pmc_alloc=1; + } + + ich_data->pmc_base = ioremap(res->start, resource_size(res)); + if(!ich_data->pmc_base) { + pr_info("dell_ich pmc ioremap failed\n"); + ret = -ENOMEM; + goto probe_err; + } + + /* Register sysfs hooks for pmc */ + ret = sysfs_create_group(&dev->kobj, &pmc_attrs_group); + if (ret) { + pr_info("dell_ich cannot create sysfs for PMC %d\n",ret); + ret = -ENOMEM; + goto probe_err; + } + + /* Register sysfs hooks for SCI interrupts*/ + ret = sysfs_create_group(&dev->kobj, &sci_attrs_group); + if (ret) { + pr_info("dell_ich cannot create sysfs for SCI %d\n",ret); + ret = -ENOMEM; + goto probe_err; + } + + if((ich_data->kind == z9100smf) || (ich_data->kind == s6100smf)) { + ret = setup_gpio_sus6_sci_interrupt(dev); + if (ret) { + pr_info("dell_ich unable to setup SCI interrupt %d\n",ret); + goto probe_err; + } + } + + return 0; + +probe_err: + pr_info("dell_ich dell_ich_probe failed with : %d\n",ret); + return ret; +} + +static int dell_ich_remove(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct dell_ich_data *ich_data = dev_get_platdata(dev); + int i,ret; + + // Release GPIO regions + for(i=0; igpio_alloc & (1<gpio_base->start+avoton_gpio_regs[i], GPIO_REG_LEN); + } + } + + // Unmap and release PMC regions + if(ich_data->pmc_base) iounmap(ich_data->pmc_base); + if(ich_data->pmc_alloc) release_region(pmc_res.start, PMC_REG_LEN); + + ret = acpi_remove_sci_handler(dell_ich_sci_handler); + if(ret) { + pr_info("dell_ich acpi_remove_sci_handler failed %d\n",ret); + return ret; + } + + pr_info("dell_ich : dell_ich_remove done.\n"); + + return 0; +} + +static struct platform_driver dell_ich_driver= { + .driver = { + .name = DRV_NAME, + }, + .probe = dell_ich_probe, + .remove = dell_ich_remove, +}; + +int __init +init_ich_data(int smf_address, struct dell_ich_data *ich_data) +{ + int val; + + memset(ich_data, 0, sizeof(struct dell_ich_data)); + + if (force_id) + val = force_id; + else + val = inb(smf_address + SIO_REG_DEVID); + + switch (val) { + case SIO_Z9100_ID: + ich_data->kind = z9100smf; + break; + case SIO_S6100_ID: + ich_data->kind = s6100smf; + break; + default: + if (val != 0xffff) + pr_debug("unsupported chip ID: 0x%04x\n", val); + return -ENODEV; + } + + pr_info("dell_ich: found SMF for ID %#x\n", ich_data->kind); + + return (0); +} + +static struct platform_device *pdev; + +static int __init dell_ich_init(void) +{ + int err; + struct dell_ich_data ich_data; + + if (init_ich_data(SMF_REG_ADDR, &ich_data)) + return -ENODEV; + + err = platform_driver_register(&dell_ich_driver); + if (err) + goto exit; + + pdev = platform_device_alloc(DRV_NAME, 0); + if (!pdev) { + err = -ENOMEM; + pr_err("dell_ich: Device allocation failed\n"); + goto exit_unregister; + } + + err = platform_device_add_data(pdev, &ich_data, + sizeof(struct dell_ich_data)); + if (err) { + pr_err("dell_ich: Platform data allocation failed\n"); + goto exit_device_put; + } + + /* platform_device_add calls probe() */ + err = platform_device_add(pdev); + if (err) { + pr_err("dell_ich: Device addition failed (%d)\n", err); + goto exit_device_put; + } + + return 0; + +exit_device_put: + platform_device_put(pdev); +exit_unregister: + platform_driver_unregister(&dell_ich_driver); +exit: + pr_err("dell_ich: dell_ich_init failed (%d)\n", err); + return err; +} + +static void __exit dell_ich_exit(void) +{ + platform_device_unregister(pdev); + platform_driver_unregister(&dell_ich_driver); + + /*Remove sysfs dell_kobj*/ + kobject_put(dell_kobj); +} + +MODULE_AUTHOR("Padmanabhan Narayanan"); +MODULE_DESCRIPTION("ICH driver for Dell Avoton/Rangeley switches"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:"DRV_NAME); +MODULE_PARM_DESC(force_id, "Override the detected device ID"); + +module_init(dell_ich_init); +module_exit(dell_ich_exit); diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/rules b/platform/broadcom/sonic-platform-modules-dell/debian/rules index 3386580a80a4..860e46bf7005 100755 --- a/platform/broadcom/sonic-platform-modules-dell/debian/rules +++ b/platform/broadcom/sonic-platform-modules-dell/debian/rules @@ -14,9 +14,11 @@ COMMON_DIR := common override_dh_auto_build: (for mod in $(MODULE_DIRS); do \ if [ $$mod = "s6100" ]; then \ - cp $(COMMON_DIR)/*.c $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \ + cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \ + cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \ elif [ $$mod = "z9100" ]; then \ - cp $(COMMON_DIR)/*.c $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \ + cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \ + cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \ fi; \ echo "making man page alias $$mod -> $$mod APIs";\ make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ @@ -37,8 +39,10 @@ override_dh_clean: (for mod in $(MODULE_DIRS); do \ if [ $$mod = "s6100" ]; then \ rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \ + rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \ elif [ $$mod = "z9100" ]; then \ rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \ + rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \ fi; \ make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ done) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/modules/Makefile b/platform/broadcom/sonic-platform-modules-dell/s6100/modules/Makefile index 0cdfbf5e67b8..63242a5cf123 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/modules/Makefile @@ -1,2 +1,2 @@ -obj-m := dell_s6100_iom_cpld.o dell_s6100_lpc.o +obj-m := dell_s6100_iom_cpld.o dell_s6100_lpc.o dell_ich.o diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_iom_cpld.c b/platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_iom_cpld.c index 6cc28f707a1f..7b9cf77a448e 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_iom_cpld.c +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_iom_cpld.c @@ -26,6 +26,21 @@ #define QSFP_MOD_PRS_REG0 0x16 #define QSFP_MOD_PRS_REG1 0x17 +//qsfp interrupt registers +#define QSFP_INT_STA_REG0 0x14 +#define QSFP_INT_STA_REG1 0x15 +#define QSFP_ABS_STA_REG0 0x16 +#define QSFP_ABS_STA_REG1 0x17 +#define QSFP_TRIG_MOD 0x20 +#define QSFP_INT_COMBINE 0x21 +#define QSFP_INT0 0x22 +#define QSFP_INT1 0x23 +#define QSFP_ABS_INT0 0x24 +#define QSFP_ABS_INT1 0x25 +#define QSFP_INT_MASK0 0x26 +#define QSFP_INT_MASK1 0x27 +#define QSFP_ABS_MASK0 0x28 +#define QSFP_ABS_MASK1 0x29 struct cpld_data { struct i2c_client *client; @@ -182,16 +197,219 @@ static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, c return count; } +static ssize_t get_int_sta(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_INT_STA_REG0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_INT_STA_REG1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_abs_sta(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_ABS_STA_REG0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_ABS_STA_REG1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_trig_mod(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u8 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_TRIG_MOD); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u8)ret & 0xff; + return sprintf(buf,"0x%02x\n",devdata); +} + +static ssize_t set_trig_mod(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct cpld_data *data = dev_get_drvdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + dell_s6100_iom_cpld_write(data,IOM_CPLD_SLAVE_ADD,QSFP_TRIG_MOD,(u8)(devdata & 0xff)); + + return count; +} + +static ssize_t get_int_combine(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u8 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_INT_COMBINE); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u8)ret & 0xff; + return sprintf(buf,"0x%02x\n",devdata); +} + +static ssize_t get_int(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_INT0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_INT1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_abs_int(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_ABS_INT0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_ABS_INT1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_int_mask(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_INT_MASK0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_INT_MASK1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t set_int_mask(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct cpld_data *data = dev_get_drvdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + dell_s6100_iom_cpld_write(data,IOM_CPLD_SLAVE_ADD,QSFP_INT_MASK0,(u8)(devdata & 0xff)); + dell_s6100_iom_cpld_write(data,IOM_CPLD_SLAVE_ADD,QSFP_INT_MASK1,(u8)((devdata >> 8) & 0xff)); + + return count; +} + +static ssize_t get_abs_mask(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_ABS_MASK0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_s6100_iom_cpld_read(data,IOM_CPLD_SLAVE_ADD,QSFP_ABS_MASK1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t set_abs_mask(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct cpld_data *data = dev_get_drvdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + dell_s6100_iom_cpld_write(data,IOM_CPLD_SLAVE_ADD,QSFP_ABS_MASK0,(u8)(devdata & 0xff)); + dell_s6100_iom_cpld_write(data,IOM_CPLD_SLAVE_ADD,QSFP_ABS_MASK1,(u8)((devdata >> 8) & 0xff)); + + return count; +} + static DEVICE_ATTR(iom_cpld_vers,S_IRUGO,get_cpldver, NULL); static DEVICE_ATTR(qsfp_modprs, S_IRUGO,get_modprs, NULL); static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR,get_lpmode,set_lpmode); static DEVICE_ATTR(qsfp_reset, S_IRUGO | S_IWUSR,get_reset, set_reset); +static DEVICE_ATTR(qsfp_int_sta, S_IRUGO, get_int_sta, NULL); +static DEVICE_ATTR(qsfp_abs_sta, S_IRUGO, get_abs_sta, NULL); +static DEVICE_ATTR(qsfp_trig_mod, S_IRUGO | S_IWUSR, get_trig_mod, set_trig_mod); +static DEVICE_ATTR(qsfp_int_combine, S_IRUGO, get_int_combine, NULL); +static DEVICE_ATTR(qsfp_int, S_IRUGO, get_int, NULL); +static DEVICE_ATTR(qsfp_abs_int, S_IRUGO, get_abs_int, NULL); +static DEVICE_ATTR(qsfp_int_mask, S_IRUGO | S_IWUSR, get_int_mask, set_int_mask); +static DEVICE_ATTR(qsfp_abs_mask, S_IRUGO | S_IWUSR, get_abs_mask, set_abs_mask); static struct attribute *i2c_cpld_attrs[] = { &dev_attr_qsfp_lpmode.attr, &dev_attr_qsfp_reset.attr, &dev_attr_qsfp_modprs.attr, &dev_attr_iom_cpld_vers.attr, + &dev_attr_qsfp_int_sta.attr, + &dev_attr_qsfp_abs_sta.attr, + &dev_attr_qsfp_trig_mod.attr, + &dev_attr_qsfp_int_combine.attr, + &dev_attr_qsfp_int.attr, + &dev_attr_qsfp_abs_int.attr, + &dev_attr_qsfp_int_mask.attr, + &dev_attr_qsfp_abs_mask.attr, NULL, }; diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh index be143cb9efe7..1d1e05f04258 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh @@ -171,11 +171,32 @@ switch_board_qsfp_lpmode() { echo $value > /sys/class/i2c-adapter/i2c-17/17-003e/qsfp_lpmode } +# Enable/Disable xcvr presence interrupts +xcvr_presence_interrupts() { + case $1 in + "enable") + for ((i=14;i<=17;i++)); + do + echo 0x0 > /sys/class/i2c-adapter/i2c-$i/$i-003e/qsfp_abs_mask + done + ;; + "disable") + for ((i=14;i<=17;i++)); + do + echo 0xffff > /sys/class/i2c-adapter/i2c-$i/$i-003e/qsfp_abs_mask + done + ;; + *) echo "s6100_platform: xcvr_presence_interrupts: invalid command !" + ;; + esac +} + init_devnum if [[ "$1" == "init" ]]; then modprobe i2c-dev modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe dell_ich modprobe dell_s6100_iom_cpld modprobe dell_s6100_lpc @@ -187,7 +208,9 @@ if [[ "$1" == "init" ]]; then switch_board_sfp "new_device" switch_board_qsfp "new_device" switch_board_qsfp_lpmode "disable" + xcvr_presence_interrupts "enable" elif [[ "$1" == "deinit" ]]; then + xcvr_presence_interrupts "disable" switch_board_sfp "delete_device" switch_board_cpld "delete_device" switch_board_mux "delete_device" @@ -200,6 +223,7 @@ elif [[ "$1" == "deinit" ]]; then modprobe -r dell_s6100_iom_cpld modprobe -r i2c-mux-pca954x modprobe -r i2c-dev + modprobe -r dell_ich else echo "s6100_platform : Invalid option !" fi diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/modules/Makefile b/platform/broadcom/sonic-platform-modules-dell/z9100/modules/Makefile index 46da5beec391..24ef231b2a50 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/modules/Makefile @@ -1,2 +1,2 @@ -obj-m := dell_mailbox.o dell_z9100_cpld.o +obj-m := dell_mailbox.o dell_z9100_cpld.o dell_ich.o diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_z9100_cpld.c b/platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_z9100_cpld.c index 01c3133354b1..6198771ab45a 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_z9100_cpld.c +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_z9100_cpld.c @@ -32,6 +32,21 @@ #define QSFP_MOD_PRS_REG0 0x16 #define QSFP_MOD_PRS_REG1 0x17 +//qsfp interrupt registers +#define QSFP_INT_STA_REG0 0x14 +#define QSFP_INT_STA_REG1 0x15 +#define QSFP_ABS_STA_REG0 0x16 +#define QSFP_ABS_STA_REG1 0x17 +#define QSFP_TRIG_MOD 0x20 +#define QSFP_INT_COMBINE 0x21 +#define QSFP_INT0 0x22 +#define QSFP_INT1 0x23 +#define QSFP_ABS_INT0 0x24 +#define QSFP_ABS_INT1 0x25 +#define QSFP_INT_MASK0 0x26 +#define QSFP_INT_MASK1 0x27 +#define QSFP_ABS_MASK0 0x28 +#define QSFP_ABS_MASK1 0x29 struct cpld_data { struct i2c_client *client; @@ -189,16 +204,219 @@ static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, c return count; } +static ssize_t get_int_sta(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_INT_STA_REG0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_z9100_iom_cpld_read(data,QSFP_INT_STA_REG1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_abs_sta(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_ABS_STA_REG0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_z9100_iom_cpld_read(data,QSFP_ABS_STA_REG1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_trig_mod(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u8 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_TRIG_MOD); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u8)ret & 0xff; + return sprintf(buf,"0x%02x\n",devdata); +} + +static ssize_t set_trig_mod(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct cpld_data *data = dev_get_drvdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + dell_z9100_iom_cpld_write(data,QSFP_TRIG_MOD,(u8)(devdata & 0xff)); + + return count; +} + +static ssize_t get_int_combine(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u8 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_INT_COMBINE); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u8)ret & 0xff; + return sprintf(buf,"0x%02x\n",devdata); +} + +static ssize_t get_int(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_INT0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_z9100_iom_cpld_read(data,QSFP_INT1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_abs_int(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_ABS_INT0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_z9100_iom_cpld_read(data,QSFP_ABS_INT1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t get_int_mask(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_INT_MASK0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_z9100_iom_cpld_read(data,QSFP_INT_MASK1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t set_int_mask(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct cpld_data *data = dev_get_drvdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + dell_z9100_iom_cpld_write(data,QSFP_INT_MASK0,(u8)(devdata & 0xff)); + dell_z9100_iom_cpld_write(data,QSFP_INT_MASK1,(u8)((devdata >> 8) & 0xff)); + + return count; +} + +static ssize_t get_abs_mask(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ret; + u16 devdata=0; + struct cpld_data *data = dev_get_drvdata(dev); + + ret = dell_z9100_iom_cpld_read(data,QSFP_ABS_MASK0); + if(ret < 0) + return sprintf(buf, "read error"); + devdata = (u16)ret & 0xff; + + ret = dell_z9100_iom_cpld_read(data,QSFP_ABS_MASK1); + if(ret < 0) + return sprintf(buf, "read error"); + devdata |= (u16)(ret & 0xff) << 8; + + return sprintf(buf,"0x%04x\n",devdata); +} + +static ssize_t set_abs_mask(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + unsigned long devdata; + int err; + struct cpld_data *data = dev_get_drvdata(dev); + + err = kstrtoul(buf, 16, &devdata); + if (err) + return err; + + dell_z9100_iom_cpld_write(data,QSFP_ABS_MASK0,(u8)(devdata & 0xff)); + dell_z9100_iom_cpld_write(data,QSFP_ABS_MASK1,(u8)((devdata >> 8) & 0xff)); + + return count; +} + static DEVICE_ATTR(iom_cpld_vers,S_IRUGO,get_cpldver, NULL); static DEVICE_ATTR(qsfp_modprs, S_IRUGO,get_modprs, NULL); static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR,get_lpmode,set_lpmode); static DEVICE_ATTR(qsfp_reset, S_IRUGO | S_IWUSR,get_reset, set_reset); +static DEVICE_ATTR(qsfp_int_sta, S_IRUGO, get_int_sta, NULL); +static DEVICE_ATTR(qsfp_abs_sta, S_IRUGO, get_abs_sta, NULL); +static DEVICE_ATTR(qsfp_trig_mod, S_IRUGO | S_IWUSR, get_trig_mod, set_trig_mod); +static DEVICE_ATTR(qsfp_int_combine, S_IRUGO, get_int_combine, NULL); +static DEVICE_ATTR(qsfp_int, S_IRUGO, get_int, NULL); +static DEVICE_ATTR(qsfp_abs_int, S_IRUGO, get_abs_int, NULL); +static DEVICE_ATTR(qsfp_int_mask, S_IRUGO | S_IWUSR, get_int_mask, set_int_mask); +static DEVICE_ATTR(qsfp_abs_mask, S_IRUGO | S_IWUSR, get_abs_mask, set_abs_mask); static struct attribute *i2c_cpld_attrs[] = { &dev_attr_qsfp_lpmode.attr, &dev_attr_qsfp_reset.attr, &dev_attr_qsfp_modprs.attr, &dev_attr_iom_cpld_vers.attr, + &dev_attr_qsfp_int_sta.attr, + &dev_attr_qsfp_abs_sta.attr, + &dev_attr_qsfp_trig_mod.attr, + &dev_attr_qsfp_int_combine.attr, + &dev_attr_qsfp_int.attr, + &dev_attr_qsfp_abs_int.attr, + &dev_attr_qsfp_int_mask.attr, + &dev_attr_qsfp_abs_mask.attr, NULL, }; diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh index 6b62144eedac..e264ff6ce644 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh @@ -136,11 +136,32 @@ switch_board_qsfp() { esac } +# Enable/Disable xcvr presence interrupts +xcvr_presence_interrupts() { + case $1 in + "enable") + for ((i=14;i<=16;i++)); + do + echo 0x0 > /sys/class/i2c-adapter/i2c-$i/$i-003e/qsfp_abs_mask + done + ;; + "disable") + for ((i=14;i<=16;i++)); + do + echo 0xffff > /sys/class/i2c-adapter/i2c-$i/$i-003e/qsfp_abs_mask + done + ;; + *) echo "z9100_platform: xcvr_presence_interrupts: invalid command !" + ;; + esac +} + init_devnum if [[ "$1" == "init" ]]; then modprobe i2c-dev modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe dell_ich modprobe dell_mailbox modprobe dell_z9100_cpld @@ -151,7 +172,9 @@ if [[ "$1" == "init" ]]; then switch_board_qsfp_mux "new_device" switch_board_sfp "new_device" switch_board_qsfp "new_device" + xcvr_presence_interrupts "enable" elif [[ "$1" == "deinit" ]]; then + xcvr_presence_interrupts "disable" switch_board_sfp "delete_device" switch_board_cpld "delete_device" switch_board_mux "delete_device" @@ -164,6 +187,7 @@ elif [[ "$1" == "deinit" ]]; then modprobe -r dell_mailbox modprobe -r i2c-mux-pca954x modprobe -r i2c-dev + modprobe -r dell_ich else echo "z9100_platform : Invalid option !" fi From 2d43385927fe4ee43a56b21a573b43fc67575ef2 Mon Sep 17 00:00:00 2001 From: ironjosh Date: Tue, 11 Sep 2018 18:15:19 +0800 Subject: [PATCH 1612/1833] [baseimage] set default locale en_US.UTF-8 (#1988) * [baseimage] set default locale en_US.UTF-8 Signed-off-by: chenhu * [baseimage]set default locale to en_US.UTF-8, clean all other unused * [baseimage] update-locale after locale-gen * correct update-locale command line Signed-off-by: Guohan Lu --- build_debian.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index e893b9df403a..78f40cc20c32 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -227,7 +227,14 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in hping3 \ python-scapy \ tcptraceroute \ - mtr-tiny + mtr-tiny \ + locales + +#Adds a locale to a debian system in non-interactive mode +sudo sed -i '/^#.* en_US.* /s/^#//' $FILESYSTEM_ROOT/etc/locale.gen && \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT locale-gen "en_US.UTF-8" +sudo LANG=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT update-locale "LANG=en_US.UTF-8" +sudo LANG=C chroot $FILESYSTEM_ROOT bash -c "find /usr/share/i18n/locales/ ! -name 'en_US' -type f -exec rm -f {} +" # Install certain fundamental packages from stretch-backports in order to get # more up-to-date (but potentially less stable) versions From a06d28eaa09c20660f9618bbd0059f2089fee2a9 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 11 Sep 2018 14:57:13 -0700 Subject: [PATCH 1613/1833] [common]: Update sonic-swss-common submodule (#2033) Signed-off-by: Shu0T1an ChenG --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 90855e07dffa..23dc1b139823 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 90855e07dffa996d6f0ece6d728c41dbc4f83e60 +Subproject commit 23dc1b139823efa385be4c7a51de52f085572b77 From 860de856a83897f63933a570384ef7494ecbeca1 Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 11 Sep 2018 14:57:29 -0700 Subject: [PATCH 1614/1833] [rsyslog]: use # to separate container name and program name in syslog message for syncd containers (#2031) previous commit f3ca7c422fc432e36a9c8653195b29fa04061cc6 missed syncd containers Signed-off-by: Guohan Lu --- platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 2 +- platform/cavium/docker-syncd-cavm/Dockerfile.j2 | 2 +- platform/centec/docker-syncd-centec/Dockerfile.j2 | 2 +- platform/marvell/docker-syncd-mrvl/Dockerfile.j2 | 2 +- platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 2 +- platform/nephos/docker-syncd-nephos/Dockerfile.j2 | 2 +- platform/p4/docker-sonic-p4/Dockerfile.j2 | 2 +- platform/vs/docker-sonic-vs/Dockerfile.j2 | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 8fab6c032b12..78c296d96d92 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/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/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index 9f6e872ff1e1..5594c8e576bc 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/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/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index 7fa2bd2ae0e4..d5b9bc73eeca 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/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/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 index 6e7c34d644d5..ca48db80879e 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/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/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 73a16fac2a4b..971602a212f0 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/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/platform/nephos/docker-syncd-nephos/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 index b25272be1a0d..1553e2786cf8 100755 --- a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos/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/platform/p4/docker-sonic-p4/Dockerfile.j2 b/platform/p4/docker-sonic-p4/Dockerfile.j2 index 971d7a962ed3..09849a7ae143 100644 --- a/platform/p4/docker-sonic-p4/Dockerfile.j2 +++ b/platform/p4/docker-sonic-p4/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/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index a7cccfd60a3b..3210a6814a53 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/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 From 5c6948a90e76b0ccee63685cbe8f57584397d837 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 11 Sep 2018 18:07:46 -0700 Subject: [PATCH 1615/1833] [minigraph]: Add PORTCHANNEL_MEMBER configurations (#2034) Signed-off-by: Shu0T1an ChenG --- src/sonic-config-engine/minigraph.py | 8 +++++--- src/sonic-config-engine/tests/test_cfggen.py | 9 +++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index a990ec6a2067..b5fa98bc98d5 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -176,6 +176,7 @@ def parse_dpg(dpg, hname): pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) pc_intfs = [] pcs = {} + pc_members = {} intfs_inpc = [] # List to hold all the LAG member interfaces for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): pcintfname = pcintf.find(str(QName(ns, "Name"))).text @@ -185,6 +186,7 @@ def parse_dpg(dpg, hname): for i, member in enumerate(pcmbr_list): pcmbr_list[i] = port_alias_map.get(member, member) intfs_inpc.append(pcmbr_list[i]) + pc_members[pcintfname + KEY_SEPARATOR + pcmbr_list[i]] = {'NULL': 'NULL'} if pcintf.find(str(QName(ns, "Fallback"))) != None: pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text} else: @@ -280,7 +282,7 @@ def parse_dpg(dpg, hname): except: print >> sys.stderr, "Warning: Ignoring Control Plane ACL %s without type" % aclname - return intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, acls + return intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, pc_members, acls return None, None, None, None, None, None, None @@ -443,7 +445,7 @@ def parse_xml(filename, platform=None, port_config_file=None): port_alias_map.update(alias_map) for child in root: if child.tag == str(QName(ns, "DpgDec")): - (intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, acls) = parse_dpg(child, hostname) + (intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, pc_members, acls) = parse_dpg(child, hostname) elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_asn, bgp_peers_with_range) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): @@ -543,7 +545,7 @@ def parse_xml(filename, platform=None, port_config_file=None): pc['admin_status'] = 'up' results['PORTCHANNEL'] = pcs - + results['PORTCHANNEL_MEMBER'] = pc_members for pc_intf in pc_intfs.keys(): # remove portchannels not in PORTCHANNEL dictionary diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index a4f35021e1da..fbb8ca6b21a7 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -93,7 +93,7 @@ def test_minigraph_everflow(self): self.assertEqual(output.strip(), "{'everflow0': {'src_ip': '10.1.0.32', 'dst_ip': '2.2.2.2'}}") def test_minigraph_interfaces(self): - argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v \'INTERFACE.keys()\'' + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "INTERFACE.keys()"' output = self.run_script(argument) self.assertEqual(output.strip(), "[('Ethernet0', '10.0.0.58/31'), ('Ethernet0', 'FC00::75/126')]") @@ -117,11 +117,16 @@ def test_minigraph_portchannels(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet4'], 'mtu': '9100'}}") - def test_minigraph_portchannels_more_member(self): + def test_minigraph_portchannel_with_more_member(self): argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124'], 'mtu': '9100'}}") + def test_minigraph_portchannel_members(self): + argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v "PORTCHANNEL_MEMBER.keys()"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "['PortChannel01|Ethernet112', 'PortChannel01|Ethernet124', 'PortChannel01|Ethernet116', 'PortChannel01|Ethernet120']") + def test_minigraph_portchannel_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORTCHANNEL_INTERFACE.keys()"' output = self.run_script(argument) From 47c9542c6391563c6d7ce19c6773fc76bd2fa803 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Tue, 11 Sep 2018 21:26:51 -0700 Subject: [PATCH 1616/1833] Don't reuse init_cfg.json from old image during upgrade (#2036) --- files/image_config/updategraph/updategraph | 3 --- 1 file changed, 3 deletions(-) diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 96827f09f97f..5a0304aa24e7 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -44,9 +44,6 @@ if [ -f /tmp/pending_config_migration ]; then if [ "$enabled" = "true" ]; then echo "Use minigraph.xml from old system..." cp /etc/sonic/old_config/minigraph.xml /etc/sonic/ - if [ -f /etc/sonic/old_config/init_cfg.json ]; then - cp /etc/sonic/old_config/init_cfg.json /etc/sonic/ - fi if [ -f /etc/sonic/old_config/snmp.yml ]; then cp /etc/sonic/old_config/snmp.yml /etc/sonic/ fi From 5d23a43c4c10c9d12fd54af60dce20b8abef5ed6 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 12 Sep 2018 00:23:00 -0700 Subject: [PATCH 1617/1833] [make file] add document for KEEP_SLAVE_ON with stretch builds (#2035) * [make file] add document for KEEP_SLAVE_ON with stretch builds Signed-off-by: Ying Xie * Update Makefile.work --- Makefile.work | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile.work b/Makefile.work index 43a2a3669f0c..fff349dc759a 100644 --- a/Makefile.work +++ b/Makefile.work @@ -13,7 +13,17 @@ # * SONIC_ENABLE_SYNCD_RPC: Enables rpc-based syncd builds. # * USERNAME: Desired username -- default at rules/config # * PASSWORD: Desired password -- default at rules/config -# * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes. +# * KEEP_SLAVE_ON: Keeps slave container up and active after building process concludes. +# * Note that rm=true is still set, so once user quits from the docker +# * session, the docker will be removed. +# * Please note that with current Stretch build structure, +# * user of KEEP_SLAVE_ON feature will have to be conscious +# * about which docker to stay inside after build is done. +# * - If user desires to stay inside Stretch docker, please issue +# * make KEEP_SLAVE_ON=yes stretch +# * - If user desires to stay inside Jessie docker, please issue +# * (a successful "make stretch" may be needed before the following command) +# * 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 # * KERNEL_PROCURE_METHOD: Specifying method of obtaining kernel Debian package: download or build From ac7e06debd2581676202d5fc12eefc58f22fae63 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Thu, 13 Sep 2018 00:40:29 +0800 Subject: [PATCH 1618/1833] [devices]: add stubs for new API in SfpUtilBase for all devices (#2038) --- .../x86_64-accton_as5712_54x-r0/plugins/sfputil.py | 10 +++++++++- .../x86_64-accton_as7116_54x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-accton_as7212_54x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-accton_as7312_54x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-accton_as7312_54xs-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-accton_as7326_56x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-accton_as7512_32x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-accton_as7712_32x-r0/plugins/sfputil.py | 8 +++++++- .../x86_64-accton_as7716_32x-r0/plugins/sfputil.py | 10 +++++++++- .../x86_64-accton_as7716_32xb-r0/plugins/sfputil.py | 8 +++++++- .../x86_64-accton_as7816_64x-r0/plugins/sfputil.py | 8 +++++++- .../x86_64-centec_e582_48x6q-r0/plugins/sfputil.py | 8 ++++++++ .../dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py | 8 ++++++++ .../dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py | 8 ++++++++ device/delta/x86_64-delta_ag5648-r0/plugins/sfputil.py | 8 ++++++++ .../delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py | 8 ++++++++ device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-delta_et-6248brb-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-ingrasys_s9100-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-ingrasys_s9180_32x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-ingrasys_s9280_64x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-inventec_d7032q28b-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-inventec_d7054q28b-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-inventec_d7264q28b-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-marvell_slm5401_54x-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-mitac_ly1200_b32h0_c3-r0/plugins/sfputil.py | 8 ++++++++ .../x86_64-quanta_ix1b_32x-r0/plugins/sfputil.py | 8 ++++++++ device/wnc/x86_64-wnc_osw1800-r0/plugins/sfputil.py | 8 ++++++++ 35 files changed, 279 insertions(+), 5 deletions(-) diff --git a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py index c30ba62c51bd..9eee5b99fbd0 100755 --- a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py @@ -225,4 +225,12 @@ def reset(self, port_num): reg_file.write(reg_value) reg_file.close() - return True \ No newline at end of file + return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py index 8abcd46ccb56..435dda79cc29 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py @@ -148,3 +148,11 @@ def qsfp_ports(self): @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as7212_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7212_54x-r0/plugins/sfputil.py index 925c6cb0d73a..fa706867a585 100755 --- a/device/accton/x86_64-accton_as7212_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7212_54x-r0/plugins/sfputil.py @@ -125,3 +125,11 @@ def qsfp_ports(self): @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as7312_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7312_54x-r0/plugins/sfputil.py index 956b6b352f9c..aa889a3c4e43 100644 --- a/device/accton/x86_64-accton_as7312_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7312_54x-r0/plugins/sfputil.py @@ -213,3 +213,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py index 956b6b352f9c..aa889a3c4e43 100644 --- a/device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py @@ -213,3 +213,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py index a09dd0d7c7bf..4844d220158f 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py @@ -201,3 +201,11 @@ def set_low_power_mode(self, port_num, lpmode): def reset(self, port_num): raise NotImplementedError + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py index f2e59d403344..ac89ddb19227 100644 --- a/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7512_32x-r0/plugins/sfputil.py @@ -70,3 +70,11 @@ def qsfp_ports(self): @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py index fd117ee38867..5d1346e9b937 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7712_32x-r0/plugins/sfputil.py @@ -125,4 +125,10 @@ def qsfp_ports(self): def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping - + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py index 7a36db7cf458..98e1278ca7d0 100755 --- a/device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7716_32x-r0/plugins/sfputil.py @@ -131,4 +131,12 @@ def reset(self, port_num): reg_file.write(reg_value) reg_file.close() - return True \ No newline at end of file + return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7716_32xb-r0/plugins/sfputil.py index d57f10e016db..b582602fa9b5 100755 --- a/device/accton/x86_64-accton_as7716_32xb-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7716_32xb-r0/plugins/sfputil.py @@ -135,4 +135,10 @@ def reset(self, port_num): (status, output) = commands.getstatusoutput (mod_rst_cmd) return True - \ No newline at end of file + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py index 26c2b37c6722..e0d3c46ab3ae 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7816_64x-r0/plugins/sfputil.py @@ -152,4 +152,10 @@ def qsfp_ports(self): def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping - + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/plugins/sfputil.py b/device/centec/x86_64-centec_e582_48x6q-r0/plugins/sfputil.py index 7bb1ac0d4192..2695957bd5e1 100644 --- a/device/centec/x86_64-centec_e582_48x6q-r0/plugins/sfputil.py +++ b/device/centec/x86_64-centec_e582_48x6q-r0/plugins/sfputil.py @@ -158,3 +158,11 @@ def reset(self, port_num): return False + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError + diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py index 1f2b9e9f61ef..9275c4c9b6fb 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py @@ -173,3 +173,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py index d6fbcbcf6944..90dd63fe4c18 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py @@ -431,3 +431,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py b/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py index 84a5e153b304..cbd723717afd 100644 --- a/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/plugins/sfputil.py @@ -190,3 +190,11 @@ def reset(self, port_num): status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/delta/x86_64-delta_ag5648-r0/plugins/sfputil.py b/device/delta/x86_64-delta_ag5648-r0/plugins/sfputil.py index 70d658e40183..864977414251 100644 --- a/device/delta/x86_64-delta_ag5648-r0/plugins/sfputil.py +++ b/device/delta/x86_64-delta_ag5648-r0/plugins/sfputil.py @@ -201,3 +201,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py b/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py index dc5f8037f26a..748e2b6643f4 100644 --- a/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py +++ b/device/delta/x86_64-delta_ag9032v1-r0/plugins/sfputil.py @@ -173,3 +173,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py b/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py index 708c50819b09..4b33dd8b090f 100644 --- a/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py +++ b/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py @@ -173,3 +173,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/delta/x86_64-delta_et-6248brb-r0/plugins/sfputil.py b/device/delta/x86_64-delta_et-6248brb-r0/plugins/sfputil.py index ac2b84bcbca5..84a3bfc3dac0 100644 --- a/device/delta/x86_64-delta_et-6248brb-r0/plugins/sfputil.py +++ b/device/delta/x86_64-delta_et-6248brb-r0/plugins/sfputil.py @@ -86,3 +86,11 @@ def reset(self, port_num): return False return False + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py index bef254484ac4..f146b0e442ac 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/plugins/sfputil.py @@ -145,3 +145,11 @@ def reset(self, port_num): val_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py index 076ecff4d42d..5c0f4362ace4 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/plugins/sfputil.py @@ -277,3 +277,11 @@ def reset(self, port_num): val_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py index 78793beec69d..26355bf441e6 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/plugins/sfputil.py @@ -254,3 +254,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py index f4ffc29bebc6..377f4109db18 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/sfputil.py @@ -280,3 +280,11 @@ def reset(self, port_num): val_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py index 387c8155eef2..fecb54bf0879 100644 --- a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py @@ -185,3 +185,11 @@ def reset(self, port_num): gpio_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/sfputil.py index e0f85a981182..45be2a0e466c 100644 --- a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/plugins/sfputil.py @@ -288,3 +288,11 @@ def reset(self, port_num): val_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py index 4d5651c63a68..584b0e9716b8 100644 --- a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/sfputil.py @@ -258,3 +258,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py index 70e5ebff403d..57fd620bc417 100644 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/sfputil.py @@ -291,3 +291,11 @@ def reset(self, port_num): return True + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError + diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/sfputil.py b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/sfputil.py index d9ef84c331c5..57edb81cd109 100644 --- a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/sfputil.py +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/plugins/sfputil.py @@ -298,3 +298,11 @@ def reset(self, port_num): return True + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError + diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py index 599c8dbd959c..d109f49f2e7d 100644 --- a/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py @@ -177,3 +177,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py index c2edefd2eb70..5dffdd0335b0 100755 --- a/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/plugins/sfputil.py @@ -207,3 +207,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/sfputil.py index aa551932dc78..6f23ad01bd2c 100755 --- a/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/sfputil.py +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/plugins/sfputil.py @@ -217,3 +217,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/marvell/x86_64-marvell_slm5401_54x-r0/plugins/sfputil.py b/device/marvell/x86_64-marvell_slm5401_54x-r0/plugins/sfputil.py index 925c6cb0d73a..fa706867a585 100755 --- a/device/marvell/x86_64-marvell_slm5401_54x-r0/plugins/sfputil.py +++ b/device/marvell/x86_64-marvell_slm5401_54x-r0/plugins/sfputil.py @@ -125,3 +125,11 @@ def qsfp_ports(self): @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/plugins/sfputil.py b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/plugins/sfputil.py index 17d4d2f95b5f..33e98016384a 100644 --- a/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/plugins/sfputil.py +++ b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/plugins/sfputil.py @@ -180,3 +180,11 @@ def reset(self, port_num): reg_file.close() return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/sfputil.py b/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/sfputil.py index fb168a5d38c4..851f4b90277d 100755 --- a/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/sfputil.py +++ b/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/sfputil.py @@ -168,4 +168,12 @@ def qsfp_ports(self): def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError + diff --git a/device/wnc/x86_64-wnc_osw1800-r0/plugins/sfputil.py b/device/wnc/x86_64-wnc_osw1800-r0/plugins/sfputil.py index 1c1e86bc5d6e..549790bfb44f 100644 --- a/device/wnc/x86_64-wnc_osw1800-r0/plugins/sfputil.py +++ b/device/wnc/x86_64-wnc_osw1800-r0/plugins/sfputil.py @@ -203,3 +203,11 @@ def get_eeprom_dict(self, port_num): sfp_data['dom'] = sfpd_obj.get_data_pretty() return sfp_data + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError From 0c2472a0405350d9010e1c0bc09f7d01e4f45f22 Mon Sep 17 00:00:00 2001 From: paavaanan Date: Fri, 14 Sep 2018 12:11:17 +0530 Subject: [PATCH 1619/1833] [device]: xcvrd support for Dell S6100 (#2041) --- .../plugins/sfputil.py | 123 +++++++++++++++++- .../plugins/sfputil.py | 4 +- 2 files changed, 118 insertions(+), 9 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py index 90dd63fe4c18..c5337707eb1a 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py @@ -432,10 +432,119 @@ def reset(self, port_num): return True - def get_transceiver_change_event(self): - """ - TODO: This function need to be implemented - when decide to support monitoring SFP(Xcvrd) - on this platform. - """ - raise NotImplementedError + + def get_register(self, reg_file): + retval = 'ERR' + + if (not os.path.isfile(reg_file)): + print reg_file, 'not found !' + return retval + + try: + with open(reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", reg_file, "file !") + + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + return retval + + def get_transceiver_change_event(self, timeout=0): + epoll = select.epoll() + port_dict = {} + try: + # We get notified when there is an SCI interrupt from GPIO SUS6 + fd = open("/sys/devices/platform/dell_ich.0/sci_int_gpio_sus6", "r") + epoll.register(fd.fileno(), select.EPOLLIN) + events = epoll.poll(timeout=timeout if timeout != 0 else -1) + if events: + # Read the QSFP ABS interrupt & status registers + cpld2_abs_int = self.get_register("/sys/class/i2c-adapter/i2c-14/14-003e/qsfp_abs_int") + cpld2_abs_sta = self.get_register("/sys/class/i2c-adapter/i2c-14/14-003e/qsfp_abs_sta") + cpld3_abs_int = self.get_register("/sys/class/i2c-adapter/i2c-15/15-003e/qsfp_abs_int") + cpld3_abs_sta = self.get_register("/sys/class/i2c-adapter/i2c-15/15-003e/qsfp_abs_sta") + cpld4_abs_int = self.get_register("/sys/class/i2c-adapter/i2c-16/16-003e/qsfp_abs_int") + cpld4_abs_sta = self.get_register("/sys/class/i2c-adapter/i2c-16/16-003e/qsfp_abs_sta") + cpld5_abs_int = self.get_register("/sys/class/i2c-adapter/i2c-17/17-003e/qsfp_abs_int") + cpld5_abs_sta = self.get_register("/sys/class/i2c-adapter/i2c-17/17-003e/qsfp_abs_sta") + + + if (cpld2_abs_int == 'read error' or cpld2_abs_sta == 'read error' or \ + cpld3_abs_int == 'read error' or cpld3_abs_sta == 'read error' or \ + cpld4_abs_int == 'read error' or cpld4_abs_sta == 'read error' or \ + cpld4_abs_int == 'read error' or cpld4_abs_sta == 'read error' ): + return False, {} + + cpld2_abs_int = int(cpld2_abs_int, 16) + cpld2_abs_sta = int(cpld2_abs_sta, 16) + cpld3_abs_int = int(cpld3_abs_int, 16) + cpld3_abs_sta = int(cpld3_abs_sta, 16) + cpld4_abs_int = int(cpld4_abs_int, 16) + cpld4_abs_sta = int(cpld4_abs_sta, 16) + cpld5_abs_int = int(cpld5_abs_int, 16) + cpld5_abs_sta = int(cpld5_abs_sta, 16) + + port=self.port_start + + while port >= self.iom1_port_start and port <= self.iom1_port_end: + + interrupt_reg = cpld2_abs_int + status_reg = cpld2_abs_sta + + if interrupt_reg & (1< optics is removed + port_dict[port] = '0' + else: + # status reg 0 => optics is inserted + port_dict[port] = '1' + port += 1 + + while port >= self.iom2_port_start and port <= self.iom2_port_end: + + interrupt_reg = cpld4_abs_int + status_reg = cpld4_abs_sta + + if interrupt_reg & (1< optics is removed + port_dict[port] = '0' + else: + # status reg 0 => optics is inserted + port_dict[port] = '1' + port += 1 + + while port >= self.iom3_port_start and port <= self.iom3_port_end: + + interrupt_reg = cpld3_abs_int + status_reg = cpld3_abs_sta + + if interrupt_reg & (1< optics is removed + port_dict[port] = '0' + else: + # status reg 0 => optics is inserted + port_dict[port] = '1' + port += 1 + + while port >= self.iom4_port_start and port <= self.iom4_port_end: + + interrupt_reg = cpld5_abs_int + status_reg = cpld5_sta + + if interrupt_reg & (1< optics is removed + port_dict[port] = '0' + else: + # status reg 0 => optics is inserted + port_dict[port] = '1' + port += 1 + return True, port_dict + finally: + fd.close() + epoll.close() + + return False, {} diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py index 1524c1bc0156..11be23b7e2d7 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py @@ -393,8 +393,8 @@ def get_transceiver_change_event(self, timeout=0): port=self.port_start while port <= self.port_end: - if interrupt_reg & (1< optics is removed port_dict[port] = '0' else: From 6f496bda204a26708fd68987166a3fb559e4c2d2 Mon Sep 17 00:00:00 2001 From: klhaung <38268572+klhaung@users.noreply.github.com> Date: Fri, 14 Sep 2018 15:54:08 +0800 Subject: [PATCH 1620/1833] [device][platform] Update Inventec platform porting to support stretch (#2010) * [device][platform] d6254qs d6556 platform porting [device][platform] sensor and status led support for d7032q28b d7254q28b d7264q28b d6254qs d6556 [device][platform] qos support for d7032q28b d7254q28b [device][platform] service configuration files for d7032q28b d7254q28b d7264q28b d6254qs d6556 * remove binary files and remove non-supported attributes in config.bcm * remove gpio-ich here. file a PR in sonic-linux-kernel instead. * remove unnecessary comments * add GPL license --- .../INVENTEC-D6254QS/port_config.ini | 74 + .../INVENTEC-D6254QS/sai.profile | 2 + .../td2-d6254qs-72x10G.config.bcm | 160 + .../x86_64-inventec_d6254qs-r0/installer.conf | 4 + .../led_proc_init.soc | 136 + .../x86_64-inventec_d6254qs-r0/minigraph.xml | 144 + .../plugins/eeprom.py | 22 + .../plugins/psuutil.py | 84 + .../plugins/sfputil.py | 209 + .../x86_64-inventec_d6254qs-r0/sensors.conf | 15 + .../INVENTEC-D6556/port_config.ini | 57 + .../INVENTEC-D6556/sai.profile | 2 + .../x86_64-inventec_d6556-r0/installer.conf | 4 + .../led_proc_init.soc | 6 + .../x86_64-inventec_d6556-r0/minigraph.xml | 144 + .../plugins/eeprom.py | 22 + .../plugins/psuutil.py | 84 + .../plugins/sfputil.py | 211 + .../x86_64-inventec_d6556-r0/sensors.conf | 44 + .../INVENTEC-D7032Q28B-C32/buffers.json.j2 | 128 + .../INVENTEC-D7032Q28B-C32/qos.json | 143 + .../led_proc_init.soc | 4 +- .../minigraph.xml | 2 - .../x86_64-inventec_d7032q28b-r0/sensors.conf | 15 + .../INVENTEC-D7054Q28B-S48-Q6/buffers.json.j2 | 128 + .../INVENTEC-D7054Q28B-S48-Q6/qos.json | 143 + .../minigraph.xml | 2 - .../x86_64-inventec_d7054q28b-r0/sensors.conf | 44 + .../th2-d7264q28b-64x100g.config.bcm | 81 +- .../x86_64-inventec_d7264q28b-r0/sensors.conf | 44 + .../broadcom/platform-modules-inventec.mk | 14 +- .../common/utils/asic_monitor.py | 126 + .../common/utils/led_proc.py | 464 +- .../common/utils/platform_status.py | 64 + .../common/utils/transceiver_monitor.py | 199 +- .../d6254qs/modules/Makefile | 7 + .../d6254qs/modules/inv_cpld.c | 415 + .../d6254qs/modules/inv_eeprom.c | 181 + .../d6254qs/modules/inv_mux.c | 280 + .../d6254qs/modules/inv_mux.h | 45 + .../d6254qs/modules/inv_platform.c | 243 + .../d6254qs/modules/inv_psoc.c | 1004 ++ .../d6254qs/modules/inv_pthread.c | 1312 +++ .../d6254qs/modules/inv_swps.c | 3027 ++++++ .../d6254qs/modules/inv_swps.h | 1033 ++ .../d6254qs/modules/io_expander.c | 1885 ++++ .../d6254qs/modules/io_expander.h | 183 + .../d6254qs/modules/transceiver.c | 8388 ++++++++++++++++ .../d6254qs/modules/transceiver.h | 814 ++ .../d6254qs/utils/inventec_d6254_util.py | 239 + .../d6556/modules/Makefile | 6 + .../d6556/modules/inv_cpld.c | 526 ++ .../d6556/modules/inv_eeprom.c | 181 + .../d6556/modules/inv_mux.c | 281 + .../d6556/modules/inv_mux.h | 47 + .../d6556/modules/inv_platform.c | 215 + .../d6556/modules/inv_psoc.c | 994 ++ .../d6556/modules/inv_pthread.c | 1459 +++ .../d6556/modules/inv_swps.c | 3049 ++++++ .../d6556/modules/inv_swps.h | 1164 +++ .../d6556/modules/io_expander.c | 2046 ++++ .../d6556/modules/io_expander.h | 187 + .../d6556/modules/transceiver.c | 8389 +++++++++++++++++ .../d6556/modules/transceiver.h | 815 ++ .../d6556/utils/inventec_d6556_util.py | 238 + .../d7032q28b/modules/Makefile | 1 + .../d7032q28b/modules/inv_psoc.c | 2066 ++-- .../d7032q28b/modules/inv_pthread.c | 1305 +++ .../d7032q28b/utils/inventec_d7032_util.py | 7 +- .../d7054q28b/modules/Makefile | 1 + .../d7054q28b/modules/inv_psoc.c | 18 + .../d7054q28b/modules/inv_pthread.c | 1284 +++ .../d7054q28b/utils/inventec_d7054_util.py | 5 +- .../d7264q28b/modules/Makefile | 1 + .../d7264q28b/modules/inv_psoc.c | 31 +- .../d7264q28b/modules/inv_pthread.c | 1303 +++ .../d7264q28b/utils/inventec_d7264_util.py | 5 +- .../debian/changelog | 12 +- .../debian/control | 18 +- .../debian/platform-modules-d6254qs.init | 73 + .../debian/platform-modules-d6254qs.install | 6 + .../debian/platform-modules-d6556.init | 72 + .../debian/platform-modules-d6556.install | 6 + .../debian/platform-modules-d7032q28b.init | 10 + .../debian/platform-modules-d7032q28b.install | 3 + .../debian/platform-modules-d7054q28b.init | 10 + .../debian/platform-modules-d7054q28b.install | 4 +- .../debian/platform-modules-d7264q28b.init | 29 +- .../debian/platform-modules-d7264q28b.install | 4 + .../debian/platform-modules-d7264q28b.upstart | 5 - .../debian/rules | 4 +- .../systemd/platform-modules-d6254qs.service | 13 + .../systemd/platform-modules-d6556.service | 13 + .../platform-modules-d7032q28b.service | 13 + .../platform-modules-d7054q28b.service | 13 + .../platform-modules-d7264q28b.service | 13 + 96 files changed, 46694 insertions(+), 1332 deletions(-) create mode 100644 device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/port_config.ini create mode 100644 device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/sai.profile create mode 100644 device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/td2-d6254qs-72x10G.config.bcm create mode 100644 device/inventec/x86_64-inventec_d6254qs-r0/installer.conf create mode 100644 device/inventec/x86_64-inventec_d6254qs-r0/led_proc_init.soc create mode 100644 device/inventec/x86_64-inventec_d6254qs-r0/minigraph.xml create mode 100644 device/inventec/x86_64-inventec_d6254qs-r0/plugins/eeprom.py create mode 100644 device/inventec/x86_64-inventec_d6254qs-r0/plugins/psuutil.py create mode 100644 device/inventec/x86_64-inventec_d6254qs-r0/plugins/sfputil.py create mode 100644 device/inventec/x86_64-inventec_d6254qs-r0/sensors.conf create mode 100644 device/inventec/x86_64-inventec_d6556-r0/INVENTEC-D6556/port_config.ini create mode 100644 device/inventec/x86_64-inventec_d6556-r0/INVENTEC-D6556/sai.profile create mode 100644 device/inventec/x86_64-inventec_d6556-r0/installer.conf create mode 100644 device/inventec/x86_64-inventec_d6556-r0/led_proc_init.soc create mode 100644 device/inventec/x86_64-inventec_d6556-r0/minigraph.xml create mode 100644 device/inventec/x86_64-inventec_d6556-r0/plugins/eeprom.py create mode 100644 device/inventec/x86_64-inventec_d6556-r0/plugins/psuutil.py create mode 100644 device/inventec/x86_64-inventec_d6556-r0/plugins/sfputil.py create mode 100644 device/inventec/x86_64-inventec_d6556-r0/sensors.conf create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/buffers.json.j2 create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/qos.json create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/sensors.conf create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/buffers.json.j2 create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/qos.json create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/sensors.conf create mode 100644 device/inventec/x86_64-inventec_d7264q28b-r0/sensors.conf create mode 100755 platform/broadcom/sonic-platform-modules-inventec/common/utils/asic_monitor.py create mode 100755 platform/broadcom/sonic-platform-modules-inventec/common/utils/platform_status.py create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_eeprom.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_mux.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_mux.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_platform.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_psoc.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_pthread.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_swps.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_swps.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/io_expander.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/io_expander.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/transceiver.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/transceiver.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6254qs/utils/inventec_d6254_util.py create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_eeprom.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_mux.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_mux.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_platform.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_psoc.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_pthread.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_swps.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_swps.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/io_expander.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/io_expander.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/transceiver.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/modules/transceiver.h create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d6556/utils/inventec_d6556_util.py create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_pthread.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_pthread.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_pthread.c create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6254qs.init create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6254qs.install create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6556.init create mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6556.install delete mode 100644 platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.upstart create mode 100644 platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d6254qs.service create mode 100644 platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d6556.service create mode 100644 platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7032q28b.service create mode 100644 platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7054q28b.service create mode 100644 platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7264q28b.service diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/port_config.ini b/device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/port_config.ini new file mode 100644 index 000000000000..24823135f4ca --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/port_config.ini @@ -0,0 +1,74 @@ +# name lanes alias +Ethernet0 16 Ethernet0 +Ethernet4 15 Ethernet4 +Ethernet8 14 Ethernet8 +Ethernet12 13 Ethernet12 +Ethernet16 24 Ethernet16 +Ethernet20 23 Ethernet20 +Ethernet24 22 Ethernet24 +Ethernet28 21 Ethernet28 +Ethernet32 28 Ethernet32 +Ethernet36 27 Ethernet36 +Ethernet40 26 Ethernet40 +Ethernet44 25 Ethernet44 +Ethernet48 32 Ethernet48 +Ethernet52 31 Ethernet52 +Ethernet56 30 Ethernet56 +Ethernet60 29 Ethernet60 +Ethernet64 48 Ethernet64 +Ethernet68 47 Ethernet68 +Ethernet72 46 Ethernet72 +Ethernet76 45 Ethernet76 +Ethernet80 52 Ethernet80 +Ethernet84 51 Ethernet84 +Ethernet88 50 Ethernet88 +Ethernet92 49 Ethernet92 +Ethernet96 56 Ethernet96 +Ethernet100 55 Ethernet100 +Ethernet104 54 Ethernet104 +Ethernet108 53 Ethernet108 +Ethernet112 60 Ethernet112 +Ethernet116 59 Ethernet116 +Ethernet120 58 Ethernet120 +Ethernet124 57 Ethernet124 +Ethernet128 64 Ethernet128 +Ethernet132 63 Ethernet132 +Ethernet136 62 Ethernet136 +Ethernet140 61 Ethernet140 +Ethernet144 68 Ethernet144 +Ethernet148 67 Ethernet148 +Ethernet152 66 Ethernet152 +Ethernet156 65 Ethernet156 +Ethernet160 72 Ethernet160 +Ethernet164 71 Ethernet164 +Ethernet168 70 Ethernet168 +Ethernet172 69 Ethernet172 +Ethernet176 76 Ethernet176 +Ethernet180 75 Ethernet180 +Ethernet184 74 Ethernet184 +Ethernet188 73 Ethernet188 +Ethernet192 82 Ethernet192 +Ethernet196 84 Ethernet196 +Ethernet200 81 Ethernet200 +Ethernet204 83 Ethernet204 +Ethernet208 78 Ethernet208 +Ethernet212 80 Ethernet212 +Ethernet216 77 Ethernet216 +Ethernet220 79 Ethernet220 +Ethernet224 98 Ethernet224 +Ethernet228 100 Ethernet228 +Ethernet232 97 Ethernet232 +Ethernet236 99 Ethernet236 +Ethernet240 104 Ethernet240 +Ethernet244 102 Ethernet244 +Ethernet248 103 Ethernet248 +Ethernet252 101 Ethernet252 +Ethernet256 108 Ethernet256 +Ethernet260 106 Ethernet260 +Ethernet264 107 Ethernet264 +Ethernet268 105 Ethernet268 +Ethernet272 112 Ethernet272 +Ethernet276 110 Ethernet276 +Ethernet280 111 Ethernet280 +Ethernet284 109 Ethernet284 + diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/sai.profile b/device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/sai.profile new file mode 100644 index 000000000000..3f549dd63b40 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-d6254qs-72x10G.config +SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/td2-d6254qs-72x10G.config.bcm b/device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/td2-d6254qs-72x10G.config.bcm new file mode 100644 index 000000000000..66b7172bce7c --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/INVENTEC-D6254QS/td2-d6254qs-72x10G.config.bcm @@ -0,0 +1,160 @@ +os=unix +parity_enable=0 +pbmp_xport_xe.0=0x1fffffffffffffffffffffffffffffffe +miim_intr_enable=0 +schan_intr_enable=0 +bcm_stat_interval=2000000 +serdes_firmware_mode_xe=0x2 + +portmap_1=16:10 +portmap_2=15:10 +portmap_3=14:10 +portmap_4=13:10 +portmap_5=24:10 +portmap_6=23:10 +portmap_7=22:10 +portmap_8=21:10 +portmap_9=28:10 +portmap_10=27:10 +portmap_11=26:10 +portmap_12=25:10 +portmap_13=32:10 +portmap_14=31:10 +portmap_15=30:10 +portmap_16=29:10 +portmap_17=48:10 +portmap_18=47:10 +portmap_19=46:10 +portmap_20=45:10 +portmap_21=52:10 +portmap_22=51:10 +portmap_23=50:10 +portmap_24=49:10 +portmap_25=56:10 +portmap_26=55:10 +portmap_27=54:10 +portmap_28=53:10 +portmap_29=60:10 +portmap_30=59:10 +portmap_31=58:10 +portmap_32=57:10 +portmap_33=64:10 +portmap_34=63:10 +portmap_35=62:10 +portmap_36=61:10 +portmap_37=68:10 +portmap_38=67:10 +portmap_39=66:10 +portmap_40=65:10 +portmap_41=72:10 +portmap_42=71:10 +portmap_43=70:10 +portmap_44=69:10 +portmap_45=76:10 +portmap_46=75:10 +portmap_47=74:10 +portmap_48=73:10 + +portmap_49=82:10 +portmap_50=84:10 +portmap_51=81:10 +portmap_52=83:10 + +portmap_53=78:10 +portmap_54=80:10 +portmap_55=77:10 +portmap_56=79:10 + +portmap_57=98:10 +portmap_58=100:10 +portmap_59=97:10 +portmap_60=99:10 + +portmap_61=104:10 +portmap_62=102:10 +portmap_63=103:10 +portmap_64=101:10 + +portmap_65=108:10 +portmap_66=106:10 +portmap_67=107:10 +portmap_68=105:10 + +portmap_69=112:10 +portmap_70=110:10 +portmap_71=111:10 +portmap_72=109:10 + +xgxs_rx_lane_map_xe0=0x0123 +xgxs_rx_lane_map_xe1=0x0123 +xgxs_rx_lane_map_xe2=0x0123 +xgxs_rx_lane_map_xe3=0x0123 +xgxs_rx_lane_map_xe4=0x0123 +xgxs_rx_lane_map_xe5=0x0123 +xgxs_rx_lane_map_xe6=0x0123 +xgxs_rx_lane_map_xe7=0x0123 +xgxs_rx_lane_map_xe8=0x0123 +xgxs_rx_lane_map_xe9=0x0123 +xgxs_rx_lane_map_xe10=0x0123 +xgxs_rx_lane_map_xe11=0x0123 +xgxs_rx_lane_map_xe12=0x0123 +xgxs_rx_lane_map_xe13=0x0123 +xgxs_rx_lane_map_xe14=0x0123 +xgxs_rx_lane_map_xe15=0x0123 +xgxs_rx_lane_map_xe16=0x0123 +xgxs_rx_lane_map_xe17=0x0123 +xgxs_rx_lane_map_xe18=0x0123 +xgxs_rx_lane_map_xe19=0x0123 +xgxs_rx_lane_map_xe20=0x0123 +xgxs_rx_lane_map_xe21=0x0123 +xgxs_rx_lane_map_xe22=0x0123 +xgxs_rx_lane_map_xe23=0x0123 +xgxs_rx_lane_map_xe24=0x0123 +xgxs_rx_lane_map_xe25=0x0123 +xgxs_rx_lane_map_xe26=0x0123 +xgxs_rx_lane_map_xe27=0x0123 +xgxs_rx_lane_map_xe28=0x0123 +xgxs_rx_lane_map_xe29=0x0123 +xgxs_rx_lane_map_xe30=0x0123 +xgxs_rx_lane_map_xe31=0x0123 +xgxs_rx_lane_map_xe32=0x0123 +xgxs_rx_lane_map_xe33=0x0123 +xgxs_rx_lane_map_xe34=0x0123 +xgxs_rx_lane_map_xe35=0x0123 +xgxs_rx_lane_map_xe36=0x0123 +xgxs_rx_lane_map_xe37=0x0123 +xgxs_rx_lane_map_xe38=0x0123 +xgxs_rx_lane_map_xe39=0x0123 +xgxs_rx_lane_map_xe40=0x0123 +xgxs_rx_lane_map_xe41=0x0123 +xgxs_rx_lane_map_xe42=0x0123 +xgxs_rx_lane_map_xe43=0x0123 +xgxs_rx_lane_map_xe44=0x0123 +xgxs_rx_lane_map_xe45=0x0123 +xgxs_rx_lane_map_xe46=0x0123 +xgxs_rx_lane_map_xe47=0x0123 +xgxs_rx_lane_map_xe48=0x0123 +xgxs_rx_lane_map_xe49=0x0123 +xgxs_rx_lane_map_xe50=0x0123 +xgxs_rx_lane_map_xe51=0x0123 +xgxs_rx_lane_map_xe52=0x0123 +xgxs_rx_lane_map_xe53=0x0123 +xgxs_rx_lane_map_xe54=0x0123 +xgxs_rx_lane_map_xe55=0x0123 +xgxs_rx_lane_map_xe56=0x0123 +xgxs_rx_lane_map_xe57=0x0123 +xgxs_rx_lane_map_xe58=0x0123 +xgxs_rx_lane_map_xe59=0x0123 +xgxs_rx_lane_map_xe60=0x0123 +xgxs_rx_lane_map_xe61=0x0123 +xgxs_rx_lane_map_xe62=0x0123 +xgxs_rx_lane_map_xe63=0x0123 +xgxs_rx_lane_map_xe64=0x0123 +xgxs_rx_lane_map_xe65=0x0123 +xgxs_rx_lane_map_xe66=0x0123 +xgxs_rx_lane_map_xe67=0x0123 +xgxs_rx_lane_map_xe68=0x0123 +xgxs_rx_lane_map_xe69=0x0123 +xgxs_rx_lane_map_xe70=0x0123 +xgxs_rx_lane_map_xe71=0x0123 + diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/installer.conf b/device/inventec/x86_64-inventec_d6254qs-r0/installer.conf new file mode 100644 index 000000000000..6b489db6e16f --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 +VAR_LOG_SIZE=1024 diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/led_proc_init.soc b/device/inventec/x86_64-inventec_d6254qs-r0/led_proc_init.soc new file mode 100644 index 000000000000..92423b234498 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/led_proc_init.soc @@ -0,0 +1,136 @@ +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=31 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=30 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=29 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=27 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=26 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=25 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=23 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=22 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=21 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=19 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=18 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=17 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=16 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=15 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=14 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=13 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=10 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=9 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=7 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=6 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=5 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=3 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=2 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=1 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=62 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=61 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=59 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=58 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=57 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=55 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=54 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=53 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=51 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=50 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=49 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=46 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=45 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=43 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=42 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=41 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=39 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=38 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=37 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=35 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=34 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=33 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=3 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=2 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=1 +m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=7 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=6 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=5 +m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=11 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=10 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=9 +m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=8 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=15 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=14 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=13 +m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=12 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=19 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=18 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=17 +m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=16 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=23 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=22 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=21 +m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=20 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=27 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=26 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=25 +m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=24 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=31 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=30 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=29 +m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=28 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=35 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=34 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=33 +m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=32 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=39 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=38 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=37 +m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=36 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=43 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=42 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=41 +m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=40 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=47 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=46 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=45 +m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=44 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=50 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=49 +m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=48 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=54 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=53 +m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=52 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=58 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=57 +m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=56 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=62 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=61 +m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=60 + +led 0 stop +led 0 prog 02 00 60 F1 12 00 DA 0F 70 10 67 47 67 42 77 06 02 A0 60 F0 12 00 06 F0 4A 04 27 67 42 4A 03 27 67 42 4A 07 27 67 42 4A 00 27 67 42 DA 80 70 34 86 F0 77 16 12 00 DA 03 70 40 67 4A 67 42 77 36 3E F1 87 86 F1 81 57 17 27 57 07 27 57 +led 0 start + +led 1 stop +led 1 prog 02 00 60 F1 12 00 DA 0F 70 10 67 47 67 42 77 06 02 A0 60 F0 12 00 06 F0 4A 04 27 67 42 4A 03 27 67 42 4A 07 27 67 42 4A 00 27 67 42 DA 80 70 34 86 F0 77 16 12 00 DA 03 70 40 67 4A 67 42 77 36 3E F1 87 86 F1 81 57 17 27 57 07 27 57 +led 1 start diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/minigraph.xml b/device/inventec/x86_64-inventec_d6254qs-r0/minigraph.xml new file mode 100644 index 000000000000..e2368e171b58 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/minigraph.xml @@ -0,0 +1,144 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + SONiC-Inventec-d6254qs + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + SONiC-Inventec-d6254qs + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + SONiC-Inventec-d6254qs + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + SONiC-Inventec-d6254qs + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + SONiC-Inventec-d6254qs + Ethernet0 + + + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + SONiC-Inventec-d6254qs + Ethernet4 + + + + + SONiC-Inventec-d6254qs + INVENTEC-D6254QS + + + + + + + SONiC-Inventec-d6254qs + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + SONiC-Inventec-d6254qs + INVENTEC-D6254QS +
diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/plugins/eeprom.py b/device/inventec/x86_64-inventec_d6254qs-r0/plugins/eeprom.py new file mode 100644 index 000000000000..de5c24ba0e6d --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Inventec d7032q28b +# +# 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-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/plugins/psuutil.py b/device/inventec/x86_64-inventec_d6254qs-r0/plugins/psuutil.py new file mode 100644 index 000000000000..4bd3f7a27052 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/plugins/psuutil.py @@ -0,0 +1,84 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + PSU_DIR = "/sys/bus/i2c/devices/0-0066" + + def __init__(self): + PsuBase.__init__(self) + +# Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip(' \t\n\r') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psoc_psu'+ str(index) + '_iout' + attr_path = self.PSU_DIR +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + if (attr_value != 'ERR'): + # Check for PSU status + if (attr_value != 0): + status = 1 + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + ind = index-1 + attr_file ='psu'+ str(ind) + attr_path = self.PSU_DIR +'/' + attr_file + normal_attr_value = '0 : normal' + attr_value = self.get_attr_value(attr_path) + if (attr_value != 'ERR'): + # Check for PSU presence + if (attr_value == normal_attr_value): + status = 1 + return status diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d6254qs-r0/plugins/sfputil.py new file mode 100644 index 000000000000..6cd470795fb6 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/plugins/sfputil.py @@ -0,0 +1,209 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 53 + PORTS_IN_BLOCK = 54 + QSFP_PORT_START = 48 + QSFP_PORT_END = 53 + + _port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: 10, + 1: 11, + 2: 12, + 3: 13, + 4: 14, + 5: 15, + 6: 16, + 7: 17, + 8: 18, + 9: 19, + 10: 20, + 11: 21, + 12: 22, + 13: 23, + 14: 24, + 15: 25, + 16: 26, + 17: 27, + 18: 28, + 19: 29, + 20: 30, + 21: 31, + 22: 32, + 23: 33, + 24: 34, + 25: 35, + 26: 36, + 27: 37, + 28: 38, + 29: 39, + 30: 40, + 31: 41, + 32: 42, + 33: 43, + 34: 44, + 35: 45, + 36: 46, + 37: 47, + 38: 48, + 39: 49, + 40: 50, + 41: 51, + 42: 52, + 43: 53, + 44: 54, + 45: 55, + 46: 56, + 47: 57, + 48: 58, + 49: 59, + 50: 60, + 51: 61, + 52: 62, + 53: 63 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/bus/i2c/devices/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/present") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + print "\nError:SFP's don't support this property" + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = 1 + else: + reg_value = 0 + + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/class/swps/port"+str(port_num)+"/reset" + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + print "\nError:SFP's don't support this property" + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 0 + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 2 second to allow it to settle + time.sleep(2) + + # Flip the value back write back to the register to take port out of reset + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 1 + reg_file.write(hex(reg_value)) + reg_file.close() + + return True diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/sensors.conf b/device/inventec/x86_64-inventec_d6254qs-r0/sensors.conf new file mode 100644 index 000000000000..653900cad36f --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/sensors.conf @@ -0,0 +1,15 @@ +# libsensors configuration file +chip "inv_psoc-*" + ignore temp3 + ignore temp4 + label temp1 "CPU Board Temperature" + label temp2 "SW Board I Temperature" + label temp5 "SW Board II Temperature" + label temp6 "ASIC Temperature" + label in1 "PSU1 Voltage" + label in2 "PSU2 Voltage" + label curr1 "PSU1 Current" + label curr2 "PSU2 Current" + label power1 "PSU1 Power" + label power2 "PSU2 Power" + diff --git a/device/inventec/x86_64-inventec_d6556-r0/INVENTEC-D6556/port_config.ini b/device/inventec/x86_64-inventec_d6556-r0/INVENTEC-D6556/port_config.ini new file mode 100644 index 000000000000..4af8faabf676 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6556-r0/INVENTEC-D6556/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias +Ethernet0 1 Ethernet0 +Ethernet4 2 Ethernet4 +Ethernet8 3 Ethernet8 +Ethernet12 4 Ethernet12 +Ethernet16 5 Ethernet16 +Ethernet20 6 Ethernet20 +Ethernet24 7 Ethernet24 +Ethernet28 8 Ethernet28 +Ethernet32 13 Ethernet32 +Ethernet36 14 Ethernet36 +Ethernet40 15 Ethernet40 +Ethernet44 16 Ethernet44 +Ethernet48 21 Ethernet48 +Ethernet52 22 Ethernet52 +Ethernet56 23 Ethernet56 +Ethernet60 24 Ethernet60 +Ethernet64 29 Ethernet64 +Ethernet68 30 Ethernet68 +Ethernet72 31 Ethernet72 +Ethernet76 32 Ethernet76 +Ethernet80 33 Ethernet80 +Ethernet84 34 Ethernet84 +Ethernet88 35 Ethernet88 +Ethernet92 36 Ethernet92 +Ethernet96 41 Ethernet96 +Ethernet100 42 Ethernet100 +Ethernet104 43 Ethernet104 +Ethernet108 44 Ethernet108 +Ethernet112 49 Ethernet112 +Ethernet116 50 Ethernet116 +Ethernet120 51 Ethernet120 +Ethernet124 52 Ethernet124 +Ethernet128 57 Ethernet128 +Ethernet132 58 Ethernet132 +Ethernet136 59 Ethernet136 +Ethernet140 60 Ethernet140 +Ethernet144 61 Ethernet144 +Ethernet148 62 Ethernet148 +Ethernet152 63 Ethernet152 +Ethernet156 64 Ethernet156 +Ethernet160 65 Ethernet160 +Ethernet164 66 Ethernet164 +Ethernet168 67 Ethernet168 +Ethernet172 68 Ethernet172 +Ethernet176 69 Ethernet176 +Ethernet180 70 Ethernet180 +Ethernet184 71 Ethernet184 +Ethernet188 72 Ethernet188 +Ethernet192 77,78,79,80 Ethernet192 +Ethernet196 85,86,87,88 Ethernet196 +Ethernet200 93,94,95,96 Ethernet200 +Ethernet204 97,98,99,100 Ethernet204 +Ethernet208 105,106,107,108 Ethernet208 +Ethernet212 113,114,115,116 Ethernet212 +Ethernet216 121,122,123,124 Ethernet216 +Ethernet220 125,126,127,128 Ethernet220 diff --git a/device/inventec/x86_64-inventec_d6556-r0/INVENTEC-D6556/sai.profile b/device/inventec/x86_64-inventec_d6556-r0/INVENTEC-D6556/sai.profile new file mode 100644 index 000000000000..6f0bf54024a7 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6556-r0/INVENTEC-D6556/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-d6556-48x25G-8x100G.config.bcm.inventec +SAI_NUM_ECMP_MEMBERS=32 diff --git a/device/inventec/x86_64-inventec_d6556-r0/installer.conf b/device/inventec/x86_64-inventec_d6556-r0/installer.conf new file mode 100644 index 000000000000..1db64ba02c38 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6556-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 +VAR_LOG_SIZE=1024 diff --git a/device/inventec/x86_64-inventec_d6556-r0/led_proc_init.soc b/device/inventec/x86_64-inventec_d6556-r0/led_proc_init.soc new file mode 100644 index 000000000000..d4c2fde64f9c --- /dev/null +++ b/device/inventec/x86_64-inventec_d6556-r0/led_proc_init.soc @@ -0,0 +1,6 @@ +led auto off +led stop +m0 load 0 0x0 /usr/share/sonic/platform/linkscan_led_fw.bin +m0 load 0 0x3800 /usr/share/sonic/platform/custom_led.bin +led auto on +led start diff --git a/device/inventec/x86_64-inventec_d6556-r0/minigraph.xml b/device/inventec/x86_64-inventec_d6556-r0/minigraph.xml new file mode 100644 index 000000000000..50b3a05cfcce --- /dev/null +++ b/device/inventec/x86_64-inventec_d6556-r0/minigraph.xml @@ -0,0 +1,144 @@ + + + + + + OCPSCH0104001MS + 10.10.1.26 + SONiC-Inventec-d6556 + 10.10.1.25 + 1 + 10 + 3 + + + OCPSCH0104002MS + 10.10.2.26 + SONiC-Inventec-d6556 + 10.10.2.25 + 1 + 10 + 3 + + + + + 64536 + SONiC-Inventec-d6556 + + +
10.10.1.26
+ + +
+ +
10.10.2.26
+ + +
+
+ +
+ + 64542 + OCPSCH0104001MS + + + + 64543 + OCPSCH0104002MS + + +
+
+ + + + + + HostIP + Loopback0 + + 100.0.0.9/32 + + 100.0.0.9/32 + + + + + + + + SONiC-Inventec-d6556 + + + + + + Ethernet0 + 10.10.1.25/30 + + + + Ethernet4 + 10.10.2.25/30 + + + + + + + + + + + + DeviceInterfaceLink + OCPSCH0104001MS + Ethernet24 + SONiC-Inventec-d6556 + Ethernet0 + + + DeviceInterfaceLink + OCPSCH0104002MS + Ethernet24 + SONiC-Inventec-d6556 + Ethernet4 + + + + + SONiC-Inventec-d6556 + INVENTEC-D6556 + + + + + + + SONiC-Inventec-d6556 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + SONiC-Inventec-d6556 + INVENTEC-D6556 +
diff --git a/device/inventec/x86_64-inventec_d6556-r0/plugins/eeprom.py b/device/inventec/x86_64-inventec_d6556-r0/plugins/eeprom.py new file mode 100644 index 000000000000..de5c24ba0e6d --- /dev/null +++ b/device/inventec/x86_64-inventec_d6556-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Inventec d7032q28b +# +# 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-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/inventec/x86_64-inventec_d6556-r0/plugins/psuutil.py b/device/inventec/x86_64-inventec_d6556-r0/plugins/psuutil.py new file mode 100644 index 000000000000..855162f63b98 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6556-r0/plugins/psuutil.py @@ -0,0 +1,84 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + PSU_DIR = "/sys/class/hwmon/hwmon1" + + def __init__(self): + PsuBase.__init__(self) + +# Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip(' \t\n\r') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psoc_psu'+ str(index) + '_iout' + attr_path = self.PSU_DIR +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + if (attr_value != 'ERR'): + # Check for PSU status + if (attr_value != 0): + status = 1 + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + ind = index-1 + attr_file ='psu'+ str(ind) + attr_path = self.PSU_DIR +'/' + attr_file + normal_attr_value = '0 : normal' + attr_value = self.get_attr_value(attr_path) + if (attr_value != 'ERR'): + # Check for PSU presence + if (attr_value == normal_attr_value): + status = 1 + return status diff --git a/device/inventec/x86_64-inventec_d6556-r0/plugins/sfputil.py b/device/inventec/x86_64-inventec_d6556-r0/plugins/sfputil.py new file mode 100644 index 000000000000..155b956827f1 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6556-r0/plugins/sfputil.py @@ -0,0 +1,211 @@ +# sfputil.py +# +# 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 = 0 + PORT_END = 55 + PORTS_IN_BLOCK = 56 + QSFP_PORT_START = 48 + QSFP_PORT_END = 55 + + _port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: 18, + 1: 19, + 2: 20, + 3: 21, + 4: 22, + 5: 23, + 6: 24, + 7: 25, + 8: 26, + 9: 27, + 10: 28, + 11: 29, + 12: 30, + 13: 31, + 14: 32, + 15: 33, + 16: 34, + 17: 35, + 18: 36, + 19: 37, + 20: 38, + 21: 39, + 22: 40, + 23: 41, + 24: 42, + 25: 43, + 26: 44, + 27: 45, + 28: 46, + 29: 47, + 30: 48, + 31: 49, + 32: 50, + 33: 51, + 34: 52, + 35: 53, + 36: 54, + 37: 55, + 38: 56, + 39: 57, + 40: 58, + 41: 59, + 42: 60, + 43: 61, + 44: 62, + 45: 63, + 46: 64, + 47: 65, + 48: 10, + 49: 11, + 50: 12, + 51: 13, + 52: 14, + 53: 15, + 54: 16, + 55: 17 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/bus/i2c/devices/{0}-0050/eeprom" + + for x in range(0, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/present") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + print "\nError:SFP's don't support this property" + return False + + try: + reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = 1 + else: + reg_value = 0 + + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/class/swps/port"+str(port_num)+"/reset" + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + print "\nError:SFP's don't support this property" + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 0 + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 2 second to allow it to settle + time.sleep(2) + + # Flip the value back write back to the register to take port out of reset + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 1 + reg_file.write(hex(reg_value)) + reg_file.close() + + return True diff --git a/device/inventec/x86_64-inventec_d6556-r0/sensors.conf b/device/inventec/x86_64-inventec_d6556-r0/sensors.conf new file mode 100644 index 000000000000..98a8e59b9158 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6556-r0/sensors.conf @@ -0,0 +1,44 @@ +# libsensors configuration file +chip "inv_psoc-*" + label temp1 "FrontSide Temperature" + label temp2 "FanBoard Temperature" + label temp3 "NearASIC Temperature" + label temp4 "Center Temperature" + + label temp5 "CPU Board Temperature" + label temp6 "ASIC Temperature" + label temp7 "PSU1 Temperature1" + label temp8 "PSU2 Temperature1" + label temp9 "PSU1 Temperature2" + label temp10 "PSU2 Temperature2" + label fan1 "FanModule1 Front RPM" + label fan2 "FanModule1 Rear RPM" + label fan3 "FanModule2 Front RPM" + label fan4 "FanModule2 Rear RPM" + label fan5 "FanModule3 Front RPM" + label fan6 "FanModule3 Rear RPM" + label fan7 "FanModule4 Front RPM" + label fan8 "FanModule4 Rear RPM" + label fan9 "FanModule5 Front RPM" + label fan10 "FanModule5 Rear RPM" + label pwm1 "FanModule1 PWM" + label pwm2 "FanModule2 PWM" + label pwm3 "FanModule3 PWM" + label pwm4 "FanModule4 PWM" + label pwm5 "FanModule5 PWM" + label pwm6 "PSU1 FAN PWM" + label pwm7 "PSU2 FAN PWM" + label fan11 "PSU1 FAN RPM" + label fan12 "PSU2 FAN RPM" + label in1 "PSU1 Input Voltage" + label in2 "PSU2 Input Voltage" + label curr1 "PSU1 Input Current" + label curr2 "PSU2 Input Current" + label power1 "PSU1 Input Power" + label power2 "PSU2 Input Power" + label in3 "PSU1 Output Voltage" + label in4 "PSU2 Output Voltage" + label curr3 "PSU1 Output Current" + label curr4 "PSU2 Output Current" + label power3 "PSU1 Output Power" + label power4 "PSU2 Output Power" diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/buffers.json.j2 b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/buffers.json.j2 new file mode 100644 index 000000000000..864e3bd9870d --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/buffers.json.j2 @@ -0,0 +1,128 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "12766208", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "6000000", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "8072396", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xon":"18432", + "xoff":"40560", + "size":"41808", + "dynamic_th":"-4", + "xon_offset":"2496" + }, + "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":"6000000" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/qos.json b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/qos.json new file mode 100644 index 000000000000..926911ab59d0 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/INVENTEC-D7032Q28B-C32/qos.json @@ -0,0 +1,143 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold":"312000", + "green_min_threshold":"104000" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/led_proc_init.soc b/device/inventec/x86_64-inventec_d7032q28b-r0/led_proc_init.soc index 39ae1f247929..92423b234498 100644 --- a/device/inventec/x86_64-inventec_d7032q28b-r0/led_proc_init.soc +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/led_proc_init.soc @@ -128,9 +128,9 @@ m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=61 m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=60 led 0 stop -led 0 prog 02 00 60 F1 12 00 DE F6 70 10 67 47 67 42 77 06 06 F2 60 F0 12 00 06 F0 4A 04 27 67 42 4A 03 27 67 42 4A 07 27 67 42 4A 00 27 67 42 DE F4 70 34 86 F0 77 16 12 00 DE F8 70 40 67 4A 67 42 77 36 3E F1 87 86 F1 81 57 17 27 57 07 27 57 00 00 00 +led 0 prog 02 00 60 F1 12 00 DA 0F 70 10 67 47 67 42 77 06 02 A0 60 F0 12 00 06 F0 4A 04 27 67 42 4A 03 27 67 42 4A 07 27 67 42 4A 00 27 67 42 DA 80 70 34 86 F0 77 16 12 00 DA 03 70 40 67 4A 67 42 77 36 3E F1 87 86 F1 81 57 17 27 57 07 27 57 led 0 start led 1 stop -led 1 prog 02 00 60 F1 12 00 DE F6 70 10 67 47 67 42 77 06 06 F2 60 F0 12 00 06 F0 4A 04 27 67 42 4A 03 27 67 42 4A 07 27 67 42 4A 00 27 67 42 DE F4 70 34 86 F0 77 16 12 00 DE F8 70 40 67 4A 67 42 77 36 3E F1 87 86 F1 81 57 17 27 57 07 27 57 00 00 00 +led 1 prog 02 00 60 F1 12 00 DA 0F 70 10 67 47 67 42 77 06 02 A0 60 F0 12 00 06 F0 4A 04 27 67 42 4A 03 27 67 42 4A 07 27 67 42 4A 00 27 67 42 DA 80 70 34 86 F0 77 16 12 00 DA 03 70 40 67 4A 67 42 77 36 3E F1 87 86 F1 81 57 17 27 57 07 27 57 led 1 start diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml b/device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml index a582bfa49a21..1f1dd3dfe35a 100644 --- a/device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml @@ -93,7 +93,6 @@ - 40000 DeviceInterfaceLink OCPSCH0104001MS Ethernet24 @@ -101,7 +100,6 @@ Ethernet0 - 40000 DeviceInterfaceLink OCPSCH0104002MS Ethernet24 diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/sensors.conf b/device/inventec/x86_64-inventec_d7032q28b-r0/sensors.conf new file mode 100644 index 000000000000..653900cad36f --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/sensors.conf @@ -0,0 +1,15 @@ +# libsensors configuration file +chip "inv_psoc-*" + ignore temp3 + ignore temp4 + label temp1 "CPU Board Temperature" + label temp2 "SW Board I Temperature" + label temp5 "SW Board II Temperature" + label temp6 "ASIC Temperature" + label in1 "PSU1 Voltage" + label in2 "PSU2 Voltage" + label curr1 "PSU1 Current" + label curr2 "PSU2 Current" + label power1 "PSU1 Power" + label power2 "PSU2 Power" + diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/buffers.json.j2 b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/buffers.json.j2 new file mode 100644 index 000000000000..ccf463c40526 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/buffers.json.j2 @@ -0,0 +1,128 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 54 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "12766208", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "6000000", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "8072396", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xon":"18432", + "xoff":"40560", + "size":"41808", + "dynamic_th":"-4", + "xon_offset":"2496" + }, + "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":"6000000" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-1": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/qos.json b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/qos.json new file mode 100644 index 000000000000..9949a5903d8b --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/INVENTEC-D7054Q28B-S48-Q6/qos.json @@ -0,0 +1,143 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold":"312000", + "green_min_threshold":"104000" + } + }, + "QUEUE": { + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]", + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124,Ethernet128,Ethernet132,Ethernet136,Ethernet140,Ethernet144,Ethernet148,Ethernet152,Ethernet156,Ethernet160,Ethernet164,Ethernet168,Ethernet172,Ethernet176,Ethernet180,Ethernet184,Ethernet188,Ethernet192,Ethernet196,Ethernet200,Ethernet204,Ethernet208,Ethernet212|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml b/device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml index 0e579ccbde14..7cd7dd75e608 100644 --- a/device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml @@ -93,7 +93,6 @@ - 40000 DeviceInterfaceLink OCPSCH0104001MS Ethernet24 @@ -101,7 +100,6 @@ Ethernet0 - 40000 DeviceInterfaceLink OCPSCH0104002MS Ethernet24 diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/sensors.conf b/device/inventec/x86_64-inventec_d7054q28b-r0/sensors.conf new file mode 100644 index 000000000000..b3fd61236c9e --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/sensors.conf @@ -0,0 +1,44 @@ +# libsensors configuration file +chip "inv_psoc-*" + label temp1 "FrontSide Temperature" + label temp2 "FanBoard Temperature" + label temp3 "NearASIC Temperature" + label temp4 "NearPSU Temperature" + label temp5 "CPU Board Temperature" + label temp6 "ASIC Temperature" + label temp7 "PSU1 Temperature1" + label temp8 "PSU2 Temperature1" + label temp9 "PSU1 Temperature2" + label temp10 "PSU2 Temperature2" + label fan1 "FanModule1 Front RPM" + label fan2 "FanModule1 Rear RPM" + label fan3 "FanModule2 Front RPM" + label fan4 "FanModule2 Rear RPM" + label fan5 "FanModule3 Front RPM" + label fan6 "FanModule3 Rear RPM" + label fan7 "FanModule4 Front RPM" + label fan8 "FanModule4 Rear RPM" + label fan9 "FanModule5 Front RPM" + label fan10 "FanModule5 Rear RPM" + label pwm1 "FanModule1 PWM" + label pwm2 "FanModule2 PWM" + label pwm3 "FanModule3 PWM" + label pwm4 "FanModule4 PWM" + label pwm5 "FanModule5 PWM" + label pwm6 "PSU1 FAN PWM" + label pwm7 "PSU2 FAN PWM" + label fan11 "PSU1 FAN RPM" + label fan12 "PSU2 FAN RPM" + label in1 "PSU1 Input Voltage" + label in2 "PSU2 Input Voltage" + label curr1 "PSU1 Input Current" + label curr2 "PSU2 Input Current" + label power1 "PSU1 Input Power" + label power2 "PSU2 Input Power" + label in3 "PSU1 Output Voltage" + label in4 "PSU2 Output Voltage" + label curr3 "PSU1 Output Current" + label curr4 "PSU2 Output Current" + label power3 "PSU1 Output Power" + label power4 "PSU2 Output Power" + diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/th2-d7264q28b-64x100g.config.bcm b/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/th2-d7264q28b-64x100g.config.bcm index 8ca378382c93..a7eaa1d6ac59 100644 --- a/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/th2-d7264q28b-64x100g.config.bcm +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/INVENTEC-D7264Q28B/th2-d7264q28b-64x100g.config.bcm @@ -15,12 +15,12 @@ portmap_135=263:10 # 64 ports config for 100G # For Tomahawk FalconCore: -# Physical ports in FalconCore[0 - 15] must map to logical port[1 - 32] at any order -# Physical ports in FalconCore[16 - 31] must map to logical port[34 - 65] at any order -# Physical ports in FalconCore[32 - 47] must map to logical port[68 - 99] at any order -# Physical ports in FalconCore[48 - 63] must map to logical port[102 - 133] at any order +#Physical ports in FalconCore[0-15] must map to logical port[1-32] at any order +#Physical ports in FalconCore[16-31] must map to logical port[34-65] at any order +#Physical ports in FalconCore[32-47] must map to logical port[68-99] at any order +#Physical ports in FalconCore[48-63] must map to logical port[102-133] at any order -## FalconCore[0 - 15] +## FalconCore[0-15] portmap_1=9:100 portmap_2=1:100 portmap_3=13:100 @@ -38,7 +38,7 @@ portmap_14=49:100 portmap_15=61:100 portmap_16=53:100 -## FalconCore[16 - 31] +## FalconCore[16-31] portmap_34=73:100 portmap_35=65:100 portmap_36=77:100 @@ -839,3 +839,72 @@ dport_map_port_112=114 dport_map_port_113=115 dport_map_port_114=48 dport_map_port_115=49 + +## ce +## POST: 24(18) MAIN: 62(3E) PRE: 8(08) +serdes_preemphasis_1=0x183E08 +serdes_preemphasis_2=0x193E08 +serdes_preemphasis_5=0x173E08 +serdes_preemphasis_6=0x173E08 +serdes_preemphasis_9=0x163E07 +serdes_preemphasis_10=0x173E08 +serdes_preemphasis_13=0x154007 +serdes_preemphasis_14=0x154007 +serdes_preemphasis_34=0x134007 +serdes_preemphasis_35=0x144007 +serdes_preemphasis_38=0x133F07 +serdes_preemphasis_39=0x133F07 +serdes_preemphasis_42=0x133F07 +serdes_preemphasis_43=0x133F06 +serdes_preemphasis_46=0x113E06 +serdes_preemphasis_47=0x113E05 +serdes_preemphasis_68=0x103F06 +serdes_preemphasis_69=0x103F06 +serdes_preemphasis_72=0x113F06 +serdes_preemphasis_73=0x103F06 +serdes_preemphasis_76=0x124006 +serdes_preemphasis_77=0x124006 +serdes_preemphasis_80=0x144007 +serdes_preemphasis_81=0x144007 +serdes_preemphasis_102=0x144007 +serdes_preemphasis_103=0x144007 +serdes_preemphasis_106=0x153F08 +serdes_preemphasis_107=0x153F08 +serdes_preemphasis_110=0x164008 +serdes_preemphasis_111=0x164008 +serdes_preemphasis_114=0x184008 +serdes_preemphasis_115=0x184008 +serdes_preemphasis_3=0x184108 +serdes_preemphasis_4=0x184108 +serdes_preemphasis_7=0x173F08 +serdes_preemphasis_8=0x174108 +serdes_preemphasis_11=0x154007 +serdes_preemphasis_12=0x154007 +serdes_preemphasis_15=0x144007 +serdes_preemphasis_16=0x144007 +serdes_preemphasis_36=0x133F07 +serdes_preemphasis_37=0x133F07 +serdes_preemphasis_40=0x133F07 +serdes_preemphasis_41=0x123F07 +serdes_preemphasis_44=0x113F07 +serdes_preemphasis_45=0x113F07 +serdes_preemphasis_48=0x113F06 +serdes_preemphasis_49=0x103F06 +serdes_preemphasis_70=0x113F06 +serdes_preemphasis_71=0x103F06 +serdes_preemphasis_74=0x113F06 +serdes_preemphasis_75=0x113F06 +serdes_preemphasis_78=0x123F07 +serdes_preemphasis_79=0x134007 +serdes_preemphasis_82=0x144007 +serdes_preemphasis_83=0x144007 +serdes_preemphasis_104=0x164007 +serdes_preemphasis_105=0x154107 +serdes_preemphasis_108=0x174107 +serdes_preemphasis_109=0x163F07 +serdes_preemphasis_112=0x194107 +serdes_preemphasis_113=0x174107 +serdes_preemphasis_116=0x1B4108 +serdes_preemphasis_117=0x194108 + + diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/sensors.conf b/device/inventec/x86_64-inventec_d7264q28b-r0/sensors.conf new file mode 100644 index 000000000000..38072557730e --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/sensors.conf @@ -0,0 +1,44 @@ +# libsensors configuration file +chip "inv_psoc-*" + label temp1 "FrontSide Temperature" + label temp2 "FanBoard Temperature" + label temp3 "NearASIC Temperature" + label temp4 "Center(U10) Temperature" + label temp5 "CPU Board Temperature" + label temp6 "ASIC Temperature" + label temp7 "PSU1 Temperature1" + label temp8 "PSU2 Temperature1" + label temp9 "PSU1 Temperature2" + label temp10 "PSU2 Temperature2" + label fan1 "FanModule1 Front RPM" + label fan2 "FanModule1 Rear RPM" + label fan3 "FanModule2 Front RPM" + label fan4 "FanModule2 Rear RPM" + label fan5 "FanModule3 Front RPM" + label fan6 "FanModule3 Rear RPM" + label fan7 "FanModule4 Front RPM" + label fan8 "FanModule4 Rear RPM" + label fan9 "FanModule5 Front RPM" + label fan10 "FanModule5 Rear RPM" + label pwm1 "FanModule1 PWM" + label pwm2 "FanModule2 PWM" + label pwm3 "FanModule3 PWM" + label pwm4 "FanModule4 PWM" + label pwm5 "FanModule5 PWM" + label pwm6 "PSU1 FAN PWM" + label pwm7 "PSU2 FAN PWM" + label fan11 "PSU1 FAN RPM" + label fan12 "PSU2 FAN RPM" + label in1 "PSU1 Input Voltage" + label in2 "PSU2 Input Voltage" + label curr1 "PSU1 Input Current" + label curr2 "PSU2 Input Current" + label power1 "PSU1 Input Power" + label power2 "PSU2 Input Power" + label in3 "PSU1 Output Voltage" + label in4 "PSU2 Output Voltage" + label curr3 "PSU1 Output Current" + label curr4 "PSU2 Output Current" + label power3 "PSU1 Output Power" + label power4 "PSU2 Output Power" + diff --git a/platform/broadcom/platform-modules-inventec.mk b/platform/broadcom/platform-modules-inventec.mk index 2a6f32f923c4..ead32e75a815 100644 --- a/platform/broadcom/platform-modules-inventec.mk +++ b/platform/broadcom/platform-modules-inventec.mk @@ -1,11 +1,15 @@ -# Inventec d7032q28b , d7054q28b and d7264q28b Platform modules +# Inventec platform modules INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION = 1.1.0 INVENTEC_D7054Q28B_PLATFORM_MODULE_VERSION = 1.1.0 +INVENTEC_D6254QS_PLATFORM_MODULE_VERSION = 1.1.0 +INVENTEC_D6556_PLATFORM_MODULE_VERSION = 1.1.0 INVENTEC_D7264Q28B_PLATFORM_MODULE_VERSION = 1.1.0 export INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION export INVENTEC_D7054Q28B_PLATFORM_MODULE_VERSION +export INVENTEC_D6254QS_PLATFORM_MODULE_VERSION +export INVENTEC_D6556_PLATFORM_MODULE_VERSION export INVENTEC_D7264Q28B_PLATFORM_MODULE_VERSION INVENTEC_D7032Q28B_PLATFORM_MODULE = platform-modules-d7032q28b_$(INVENTEC_D7032Q28B_PLATFORM_MODULE_VERSION)_amd64.deb @@ -18,6 +22,14 @@ INVENTEC_D7054Q28B_PLATFORM_MODULE = platform-modules-d7054q28b_$(INVENTEC_D7054 $(INVENTEC_D7054Q28B_PLATFORM_MODULE)_PLATFORM = x86_64-inventec_d7054q28b-r0 $(eval $(call add_extra_package,$(INVENTEC_D7032Q28B_PLATFORM_MODULE),$(INVENTEC_D7054Q28B_PLATFORM_MODULE))) +INVENTEC_D6254QS_PLATFORM_MODULE = platform-modules-d6254qs_$(INVENTEC_D6254QS_PLATFORM_MODULE_VERSION)_amd64.deb +$(INVENTEC_D6254QS_PLATFORM_MODULE)_PLATFORM = x86_64-inventec_d6254qs-r0 +$(eval $(call add_extra_package,$(INVENTEC_D7032Q28B_PLATFORM_MODULE),$(INVENTEC_D6254QS_PLATFORM_MODULE))) + +INVENTEC_D6556_PLATFORM_MODULE = platform-modules-d6556_$(INVENTEC_D6556_PLATFORM_MODULE_VERSION)_amd64.deb +$(INVENTEC_D6556_PLATFORM_MODULE)_PLATFORM = x86_64-inventec_d6556-r0 +$(eval $(call add_extra_package,$(INVENTEC_D7032Q28B_PLATFORM_MODULE),$(INVENTEC_D6556_PLATFORM_MODULE))) + INVENTEC_D7264Q28B_PLATFORM_MODULE = platform-modules-d7264q28b_$(INVENTEC_D7264Q28B_PLATFORM_MODULE_VERSION)_amd64.deb $(INVENTEC_D7264Q28B_PLATFORM_MODULE)_PLATFORM = x86_64-inventec_d7264q28b-r0 $(eval $(call add_extra_package,$(INVENTEC_D7032Q28B_PLATFORM_MODULE),$(INVENTEC_D7264Q28B_PLATFORM_MODULE))) diff --git a/platform/broadcom/sonic-platform-modules-inventec/common/utils/asic_monitor.py b/platform/broadcom/sonic-platform-modules-inventec/common/utils/asic_monitor.py new file mode 100755 index 000000000000..bcb05b9cb845 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/common/utils/asic_monitor.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Inventec, Inc. +# +# Editor: James Huang ( Huang.James@inventec.com ) +# +""" +Usage: %(scriptName)s [options] command object + +Auto detecting the Chipset temperature and update + +options: + -h | --help : this help message + -d | --debug : run with debug mode + +""" + +try: + import os + import commands + import sys, getopt + import logging + import re + import time + import syslog + from sonic_sfp.bcmshell import bcmshell + +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +args = [] +INV_REDWOOD_PLATFORM = "SONiC-Inventec-d7032-100" +INV_CYPRESS_PLATFORM = "SONiC-Inventec-d7054" +INV_SEQUOIA_PLATFORM = "SONiC-Inventec-d7264" +INV_MAPLE_PLATFORM = "SONiC-Inventec-d6556" +INV_MAGNOLIA_PLATFORM = "SONiC-Inventec-d6254qs" + +PSOC_NAME = "name" +HWMON_PATH = "/sys/class/hwmon/" +SWITCH_TEMP_FILE_NAME = "switch_tmp" + +def log_message( level, string ): + syslog.openlog("asic_monitor", syslog.LOG_PID, facility=syslog.LOG_DAEMON) + syslog.syslog( level, string ) + +def initialLoop(): + + global bcm_obj + initialNotOK = True + + while initialNotOK : + try: + bcm_obj = BCMUtil() + bcm_obj.execute_command("echo") + initialNotOK = False + print bcm_obj + log_message( syslog.LOG_INFO, "BCMUtil Object initialed successfully" ) + except Exception, e: + print "Exception. The warning is {0}".format(str(e)) + time.sleep(10) + +class BCMUtil(bcmshell): + + asic_temperature = 0 + platform = None + + def get_platform(self): + if self.platform is None: + self.platform = os.popen("uname -n").read().strip() + return self.platform + + def get_asic_temperature( self ): + return self.asic_temperature + + def set_asic_temperature( self, temp ): + self.asic_temperature = temp + + def parsing_asic_temp(self): + content = self.run("show temp") + for line in content.split("\n"): + TempObject = re.search(r"(average current temperature is)\s+(?P\d+)\.(?P\d+)",line) + if TempObject is not None: + self.set_asic_temperature( int( TempObject.group("temperature_high") ) ) + + def execute_command(self, cmd): + return self.run(cmd) + + +def main(): + + global bcm_obj + initialLoop() + log_message( syslog.LOG_INFO, "Object initialed successfully" ) + + while 1 : + try: + bcm_obj.parsing_asic_temp() + for index in os.listdir(HWMON_PATH): + file_list = os.listdir("{0}/{1}/device/".format(HWMON_PATH,index)) + if PSOC_NAME in file_list : + with open( "{0}/{1}/device/{2}".format(HWMON_PATH, index, PSOC_NAME), 'rb') as readPtr: + content = readPtr.read().strip() + if bcm_obj.get_platform() == INV_SEQUOIA_PLATFORM : + if content == "inv_bmc" and SWITCH_TEMP_FILE_NAME in file_list : + os.system("echo {0} > {1}/{2}/device/{3}".format( ( bcm_obj.get_asic_temperature() * 1000 ), HWMON_PATH, index, SWITCH_TEMP_FILE_NAME )) + break + else : + if content == "inv_psoc" and SWITCH_TEMP_FILE_NAME in file_list : + print "echo {0} > {1}/{2}/device/{3}".format( ( bcm_obj.get_asic_temperature() * 1000 ), HWMON_PATH, index, SWITCH_TEMP_FILE_NAME ) + os.system("echo {0} > {1}/{2}/device/{3}".format( ( bcm_obj.get_asic_temperature() * 1000 ), HWMON_PATH, index, SWITCH_TEMP_FILE_NAME )) + break + except Exception, e: + log_message( syslog.LOG_WARNING, "Exception. The warning is {0}".format(str(e)) ) + initialLoop() + time.sleep(5) + + syslog.closelog() + del bcm_obj + +if __name__ == "__main__": + main() + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py b/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py index 57c5dfc6035f..bab0e2dafe76 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py +++ b/platform/broadcom/sonic-platform-modules-inventec/common/utils/led_proc.py @@ -1,5 +1,19 @@ #!/usr/bin/env python # +# Copyright (C) 2018 Inventec, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . import os import time @@ -7,20 +21,28 @@ import re from sonic_sfp.bcmshell import bcmshell + # ===================================================================== # global variable init # ===================================================================== - +# port object +PORT_LIST = [] +# object is to execute bcm shell command +BCM_SHELL = None +SHELL_READY = False +# port status that is auto update by chip in data ram +STATUS_RX = 1<<0 +STATUS_TX = 1<<1 # define data ram address PORT_DATA_OFFSET_ADDR = 0xA0 -PORT_DATA_START_ADDR = 0xF2 -TOTAL_SCAN_BITS_ADDR = 0xF4 -SYNC_START_LEN_ADDR = 0xF6 -SYNC_STOP_LEN_ADDR = 0xF8 -# bit streaming rule for CPLD decode -TOTAL_SCAN_BITS = None -SYNC_S = None -SYNC_P = None +# define board type +INV_MAGNOLIA = "SONiC-Inventec-d6254qs" +INV_REDWOOD = "SONiC-Inventec-d7032-100" +INV_CYPRESS = "SONiC-Inventec-d7054" +INV_MAPLE = "SONiC-Inventec-d6556" +INV_SEQUOIA = "" +BOARD_TPYE = "" +EAGLE_CORE = [] # define port data for bit streaming BIT_LINK = None BIT_FAULT = None @@ -33,86 +55,41 @@ SPEED_40G = 40 SPEED_25G = 25 SPEED_10G = 10 -# the amount of LED processor -AMOUNT_LED_UP = None -# define board type -INV_REDWOOD = "SONiC-Inventec-d7032-100" -INV_CYPRESS = "SONiC-Inventec-d7054" -INV_SEQUOIA = "" -BOARD_TPYE = "" -EAGLE_CORE = [] - -PORT_LIST = [] - -# port status that is auto update by chip in data ram -# there are two byte to indicate each port status -''' -RX equ 0x0 ; received packet -TX equ 0x1 ; transmitted packet -COLL equ 0x2 ; collision indicator -SPEED_C equ 0x3 ; 100 Mbps -SPEED_M equ 0x4 ; 1000 Mbps -DUPLEX equ 0x5 ; half/full duplex -FLOW equ 0x6 ; flow control capable -LINKUP equ 0x7 ; link down/up status -LINKEN equ 0x8 ; link disabled/enabled status -ZERO equ 0xE ; always 0 -ONE equ 0xF ; always 1 -''' -STATUS_ENABLE = 1<<0 -STATUS_RX = 1<<0 -STATUS_TX = 1<<1 - -# object is to execute bcm shell command -BCM_SHELL = None - # ===================================================================== # class object # ===================================================================== -class Led(): - - up = None - pfw = None - - def __init__(self, led_number, program_fw): - self.up = led_number - self.pfw = program_fw - - def led_start(self): - BCM_SHELL.cmd("led {0} start".format(self.up)) - syslog.syslog(syslog.LOG_INFO, "Start Led({0})".format(self.up)) - - def led_stop(self): - BCM_SHELL.cmd("led {0} stop".format(self.up)) - syslog.syslog(syslog.LOG_INFO, "Stop Led({0})".format(self.up)) - - def load_prog(self): - BCM_SHELL.cmd("led {0} prog {1}".format(self.up, self.pfw)) - syslog.syslog(syslog.LOG_INFO, "Load Led({0}) program firmware".format(self.up)) - - def write_port_data(self, addr, data): - BCM_SHELL.cmd("setreg CMIC_LEDUP{0}_DATA_RAM({1}) {2}".format(self.up, addr, data)) - #syslog.syslog(syslog.LOG_DEBUG, "Write Led({0}) data_ram({1}): {2}".format(self.up, addr, data)) - - def read_data_ram(self, offset): - return_string = BCM_SHELL.run("getreg CMIC_LEDUP{0}_DATA_RAM({1})".format(self.up, offset)) - for line in return_string.split("\n"): - re_obj = re.search(r"\.+)\>",line) +class Port(): + + port_num = None + name = None + bcm_id = None + led_up = None + s_addr = None + write2_up = None + led_index = None + link_status = None + speed = None + + def write_data_ram(self, data): + BCM_SHELL.cmd("setreg CMIC_LEDUP{0}_DATA_RAM({1}) {2}".format(self.write2_up, self.led_index, data)) + + def read_data_ram(self): + r_string = BCM_SHELL.run("getreg CMIC_LEDUP{0}_DATA_RAM({1})".format(self.led_up, self.s_addr)) + for line in r_string.split("\n"): + re_obj = re.search(r"\.+)\>", line) if re_obj is not None: - #syslog.syslog(syslog.LOG_DEBUG, "Read Led({0}) data_ram({1}): {2}".format(self.up, offset, re_obj.group("data"))) + #syslog.syslog(syslog.LOG_DEBUG, "Read Led({0}) data_ram({1}): {2}".format(self.up, addr, re_obj.group("data"))) return int(re_obj.group("data"), 16) - return None # ===================================================================== # Function # ===================================================================== -def _remap_registers(): +def _remap_registers(fp): - fp = open('/usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/led_proc_init.soc', "r") content = fp.readlines() fp.close() err = False @@ -125,60 +102,13 @@ def _remap_registers(): syslog.syslog(syslog.LOG_ERR, "remap register abnormal: {0}".format(str(e))) if not err: - pass - #syslog.syslog(syslog.LOG_DEBUG, "remap Led registers successfully") - - - -def _update_port_list(): - - global PORT_LIST - PORT_LIST = [] - number = 0 - count = 0 - - content = BCM_SHELL.run("ps") - for line in content.split("\n"): - re_obj = re.search(r"(?P(xe|ce)\d+)\(\s*(?P\d+)\)\s+(?P(up|down|!ena)).+\s+(?P\d+)G",line) - if re_obj is not None: - if int(re_obj.group("bcm_id")) not in EAGLE_CORE: - PORT_LIST.append({"port_id":number, "name":re_obj.group("port_name"), "bcm_id":int(re_obj.group("bcm_id")), "link":re_obj.group("link"), "speed":int(re_obj.group("speed"))}) - number += 1 - - content = BCM_SHELL.run("led status") - for line in content.split("\n"): - re_obj = re.search(r"(?P\d+).+(?P\d)\:(?P\d+)",line) - if re_obj is not None: - if int(re_obj.group("bcm_id")) not in EAGLE_CORE: - PORT_LIST[count]["led_up"] = int(re_obj.group("led_up")) - PORT_LIST[count]["offset"] = int(re_obj.group("offset")) - count += 1 - - if number is not count: - PORT_LIST = [] - syslog.syslog(syslog.LOG_ERR, "The amount of port is not match") - else: - pass - #syslog.syslog(syslog.LOG_DEBUG, "update port list successfully") - - - -def _lookup_led_index(p): - - index = 0 - for port in PORT_LIST: - if p["bcm_id"] == port["bcm_id"]: - break - if p["led_up"] == port["led_up"]: - index += 1 - return index + PORT_DATA_OFFSET_ADDR + syslog.syslog(syslog.LOG_INFO, "remap Led registers successfully") -def _led_init(): +def _board_init(): global BOARD_TPYE - global AMOUNT_LED_UP global BIT_LINK global BIT_FAULT global BIT_TX @@ -193,24 +123,29 @@ def _led_init(): cmd = "uname -n" platform = os.popen(cmd).read() - if platform.rstrip() == INV_REDWOOD: + if platform.rstrip() == INV_MAGNOLIA: + BOARD_TPYE = "inventec_d6254qs" + BIT_RX = 1<<0 #0x01 + BIT_TX = 1<<1 #0x02 + BIT_SPEED1 = 1<<4 #0x10 + BIT_LINK = 1<<7 #0x80 + fp = open('/usr/share/sonic/device/x86_64-inventec_d6254qs-r0/led_proc_init.soc', "r") + _remap_registers(fp) + + elif platform.rstrip() == INV_REDWOOD: BOARD_TPYE = "inventec_d7032q28b" - AMOUNT_LED_UP = 2 BIT_RX = 1<<0 #0x01 BIT_TX = 1<<1 #0x02 BIT_SPEED0 = 1<<3 #0x08 BIT_SPEED1 = 1<<4 #0x10 BIT_FAULT = 1<<6 #0x40 BIT_LINK = 1<<7 #0x80 - TOTAL_SCAN_BITS = 32*1*4 - SYNC_S = 15 - SYNC_P = 3 EAGLE_CORE = [66, 100] - _remap_registers() + fp = open('/usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/led_proc_init.soc', "r") + _remap_registers(fp) elif platform.rstrip() == INV_CYPRESS: BOARD_TPYE = "inventec_d7054q28b" - AMOUNT_LED_UP = 2 BIT_LINK = 1<<0 #0x01 BIT_FAULT = 1<<1 #0x02 BIT_SPEED0 = 1<<2 #0x04 @@ -218,97 +153,220 @@ def _led_init(): elif platform.rstrip() == INV_SEQUOIA: BOARD_TPYE = "inventec_d7264q28b" - AMOUNT_LED_UP = 4 + + elif platform.rstrip() == INV_MAPLE: + BOARD_TPYE = "inventec_d6556" + fp = open('/usr/share/sonic/device/x86_64-inventec_d6556-r0/led_proc_init.soc', "r") + _remap_registers(fp) + #led process: m0 led process that is controlled by linkscan_led_fw.bin and custom_led.bin + syslog.syslog(syslog.LOG_INFO, "Found device: {0}".format(BOARD_TPYE)) + exit(0) else: BOARD_TPYE = "not found" + syslog.syslog(syslog.LOG_ERR, "Found device: {0}".format(BOARD_TPYE)) + exit(0) - syslog.syslog(syslog.LOG_INFO, "Device: {0}".format(BOARD_TPYE)) - #syslog.syslog(syslog.LOG_DEBUG, "led_amount: {0}".format(AMOUNT_LED_UP)) + syslog.syslog(syslog.LOG_INFO, "Found device: {0}".format(BOARD_TPYE)) -if __name__ == "__main__": +def _lookup_led_index(p): + + index = 0 + if BOARD_TPYE == "inventec_d6254qs": + if 0 <= p.port_num <= 47: + index = p.port_num + (p.port_num / 4) + p.write2_up = 0 + elif 48 <= p.port_num <= 71: + index = p.port_num - 48 + p.write2_up = 1 + if p.led_up == 0: + p.s_addr = p.port_num * 2 + elif p.led_up == 1: + p.s_addr = (p.port_num - 36) * 2 + + elif BOARD_TPYE == "inventec_d7032q28b": + p.write2_up = 0 + index = p.port_num + if 0 <= p.port_num <= 7: + p.s_addr = p.port_num * 8 + elif 8 <= p.port_num <= 23: + p.s_addr = (p.port_num - 8) * 8 + elif 24 <= p.port_num <= 31: + p.s_addr = (p.port_num - 16) * 8 + + else: + p.write2_up = p.led_up + for port in PORT_LIST: + if p.bcm_id == port.bcm_id: + break + if p.led_up == port.led_up: + index += 1 + + return PORT_DATA_OFFSET_ADDR + index + + +def _update_port_list(only_update): + + global PORT_LIST + number = 0 + count = 0 + + content = BCM_SHELL.run("ps") + for line in content.split("\n"): + re_obj = re.search(r"(?P(xe|ce)\d+)\(\s*(?P\d+)\)\s+(?P(up|down|!ena)).+\s+(?P\d+)G", line) + if re_obj is not None: + if int(re_obj.group("bcm_id")) not in EAGLE_CORE: + if only_update: + PORT_LIST[number].link_status = re_obj.group("link") + else: + # create port object while first time + port_obj = Port() + port_obj.port_num = number + port_obj.name = re_obj.group("port_name") + port_obj.bcm_id = int(re_obj.group("bcm_id")) + port_obj.link_status = re_obj.group("link") + port_obj.speed = int(re_obj.group("speed")) + PORT_LIST.append(port_obj) + number += 1 + + if not only_update: + content = BCM_SHELL.run("led status") + for line in content.split("\n"): + re_obj = re.search(r"(?P\d+).+(?P\d)\:", line) + if re_obj is not None: + if int(re_obj.group("bcm_id")) not in EAGLE_CORE: + PORT_LIST[count].led_up = int(re_obj.group("led_up")) + PORT_LIST[count].led_index = _lookup_led_index(PORT_LIST[count]) + count += 1 + + if number is not count: + PORT_LIST = [] + syslog.syslog(syslog.LOG_ERR, "The amount of port is not match") + - waitSyncd = True - retryCount = 0 - syslog.openlog("led_proc", syslog.LOG_PID, facility=syslog.LOG_DAEMON) + +def sync_bcmsh_socket(): + + global BCM_SHELL + global SHELL_READY + waitSyncd = True + retryCount = 0 while waitSyncd: + time.sleep(10) try: BCM_SHELL = bcmshell() + BCM_SHELL.run("Echo") waitSyncd = False except Exception, e: - syslog.syslog(syslog.LOG_WARNING, "{0}, Retry times({1})".format(str(e),retryCount)) + print "{0}, Retry times({1})".format(str(e),retryCount) + #syslog.syslog(syslog.LOG_DEBUG, "{0}, Retry times({1})".format(str(e),retryCount)) retryCount += 1 - time.sleep(5) - - - _led_init() - led_obj = [] - for idx in range(AMOUNT_LED_UP): - led_obj.append(Led(idx, "")) - #syslog.syslog(syslog.LOG_DEBUG, "create object led({0}) successfully".format(idx)) - - if BOARD_TPYE == "inventec_d7032q28b": - led_obj[idx].write_port_data(PORT_DATA_START_ADDR, PORT_DATA_OFFSET_ADDR) - led_obj[idx].write_port_data(TOTAL_SCAN_BITS_ADDR, TOTAL_SCAN_BITS) - led_obj[idx].write_port_data(SYNC_START_LEN_ADDR, SYNC_S) - led_obj[idx].write_port_data(SYNC_STOP_LEN_ADDR, SYNC_P) - - - reset_sec = 2 - count_down = 0 - queue_active = [] - port_data = None - while True: - if count_down == 0: - queue_active = [] - _update_port_list() - for port in PORT_LIST: - if port["link"] == "up": - queue_active.append(port) - else: - port_data = 0 - # redwood bit streaming for CPLD decode is only use led up0 - led_obj[0].write_port_data(PORT_DATA_OFFSET_ADDR + port["port_id"], port_data) - count_down = reset_sec - else: - for port in queue_active: - port_data = 0 - - if BOARD_TPYE == "inventec_d7032q28b": - port_data |= BIT_LINK - addr = 2*(port["offset"]-1) - byte1 = led_obj[port["led_up"]].read_data_ram(addr) - byte2 = led_obj[port["led_up"]].read_data_ram(addr+1) - if byte1&STATUS_RX: - port_data |= BIT_RX - if byte1&STATUS_TX: - port_data |= BIT_TX - if port["speed"] == SPEED_100G: - port_data |= BIT_SPEED0 - port_data |= BIT_SPEED1 - elif port["speed"] == SPEED_40G: - port_data |= BIT_SPEED1 - elif port["speed"] == SPEED_25G: - port_data |= BIT_SPEED0 + + syslog.syslog(syslog.LOG_INFO, "bcmshell socket create successfully") + + if SHELL_READY is False: + SHELL_READY = True + return + elif SHELL_READY is True: + update_led_status() + + + +def update_led_status(): + + led_thread = True # True/False (gate to turn on/off) + reset_sec = 2 + count_down = 0 + queue_active = [] + port_data = None + s_byte = None + + + # thread for keeping update port status in data ram + while led_thread: + try: + if count_down == 0: + queue_active = [] + _update_port_list(1) + for port in PORT_LIST: + if port.link_status == "up": + queue_active.append(port) else: - pass + port_data = 0 + port.write_data_ram(port_data) + count_down = reset_sec + else: + for port in queue_active: + port_data = 0 - # redwood bit streaming for CPLD decode is only use led up0 - led_obj[0].write_port_data(PORT_DATA_OFFSET_ADDR + port["port_id"], port_data) - continue + if BOARD_TPYE == "inventec_d6254qs": + s_byte = port.read_data_ram() + if s_byte&STATUS_RX: + port_data |= BIT_RX + if s_byte&STATUS_TX: + port_data |= BIT_TX + port_data |= BIT_LINK + + elif BOARD_TPYE == "inventec_d7032q28b": + s_byte = port.read_data_ram() + if s_byte&STATUS_RX: + port_data |= BIT_RX + if s_byte&STATUS_TX: + port_data |= BIT_TX + if port.speed == SPEED_100G: + port_data |= BIT_SPEED0 + port_data |= BIT_SPEED1 + elif port.speed == SPEED_40G: + port_data |= BIT_SPEED1 + elif port.speed == SPEED_25G: + port_data |= BIT_SPEED0 + else: + pass + port_data |= BIT_LINK + + elif BOARD_TPYE == "inventec_d7054q28b": + if port.speed != SPEED_100G and port.speed != SPEED_25G: + port_data |= BIT_SPEED0 + + # write data to update data ram for specific port + port.write_data_ram(port_data) + + time.sleep(0.5) + count_down -= 1 - elif BOARD_TPYE == "inventec_d7054q28b": - if port["speed"] != SPEED_100G and port["speed"] != SPEED_25G: - port_data |= BIT_SPEED0 + except Exception, e: + syslog.syslog(syslog.LOG_WARNING, "{0}".format(str(e))) + sync_bcmsh_socket() - led_index = _lookup_led_index(port) - led_obj[port["led_up"]].write_port_data(led_index, port_data) - time.sleep(0.5) - count_down -= 1 - syslog.closelog() +def debug_print(): + + for port in PORT_LIST: + output = "" + output += "name:{0} | ".format(port.name) + output += "port_num:{0} | ".format(port.port_num) + output += "bcm_id:{0} | ".format(port.bcm_id) + output += "link_status:{0} | ".format(port.link_status) + output += "speed:{0} | ".format(port.speed) + output += "led_up:{0} | ".format(port.led_up) + output += "s_addr:{0} | ".format(port.s_addr) + output += "write2_up:{0} | ".format(port.write2_up) + output += "led_index:{0} | ".format(port.led_index) + print output + +if __name__ == "__main__": + + syslog.openlog("led_proc", syslog.LOG_PID, facility=syslog.LOG_DAEMON) + + sync_bcmsh_socket() + _board_init() + _update_port_list(0) + #debug_print() + update_led_status() + + syslog.closelog() diff --git a/platform/broadcom/sonic-platform-modules-inventec/common/utils/platform_status.py b/platform/broadcom/sonic-platform-modules-inventec/common/utils/platform_status.py new file mode 100755 index 000000000000..f1e7f7fece77 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/common/utils/platform_status.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python + +import os +import socket +from collections import OrderedDict + +# Purpose: Shutdown DUT upon receiving thermaltrip event from kernel (inv_pthread) + +NETLINK_KOBJECT_UEVENT = 15 + +class KernelEventMonitor(object): + + def __init__(self): + self.received_events = OrderedDict() + self.socket = socket.socket(socket.AF_NETLINK, socket.SOCK_DGRAM, NETLINK_KOBJECT_UEVENT) + + def start(self): + self.socket.bind((os.getpid(), -1)) + + def stop(self): + self.socket.close() + + def __enter__(self): + self.start() + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.stop() + + def __iter__(self): + while True: + for item in monitor.next_events(): + yield item + + def next_events(self): + data = self.socket.recv(16384) + event = {} + for item in data.split(b'\x00'): + if not item: + #check if we have an event and if we already received it + if event and event['SEQNUM'] not in self.received_events: + self.received_events[event['SEQNUM']] = None + if (len(self.received_events) > 100): + self.received_events.popitem(last=False) + yield event + event = {} + else: + try: + k, v = item.split(b'=', 1) + event[k.decode('ascii')] = v.decode('ascii') + except ValueError: + pass + +if __name__ == '__main__': + with KernelEventMonitor() as monitor: + for event in monitor: + if event['SUBSYSTEM'] == 'platform_status': + print('subsystem is platform_status') + + # Receive thermaltrip event + if event['ACTION'] == 'remove' and event['DEVPATH'] == '/kernel/platform_status/fan': + os.system("shutdown -h now") + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py b/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py index 6546a4e44ca0..9e4a44c167fe 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py +++ b/platform/broadcom/sonic-platform-modules-inventec/common/utils/transceiver_monitor.py @@ -1,5 +1,10 @@ #!/usr/bin/env python # +# Copyright (C) 2018 Inventec, Inc. +# +# Editor: James Huang ( Huang.James@inventec.com ) +# +# """ Usage: %(scriptName)s [options] command object @@ -32,6 +37,8 @@ INV_REDWOOD_PLATFORM = "SONiC-Inventec-d7032-100" INV_CYPRESS_PLATFORM = "SONiC-Inventec-d7054" INV_SEQUOIA_PLATFORM = "SONiC-Inventec-d7264" +INV_MAPLE_PLATFORM = "SONiC-Inventec-d6556" +INV_MAGNOLIA_PLATFORM = "SONiC-Inventec-d6254qs" transceiver_type_dict = { "FCBG110SD1C03": "SR", @@ -76,7 +83,29 @@ "L0HSF006-SD-R": "KR", "L0HSF007-SD-R": "KR", "L0HSF008-SD-R": "KR", - "L0HQF009-SD-R": "KR4" + "L0HQF009-SD-R": "KR4", + "FSPP-H7-M85-X3D": "SR", + "PT0-M3-4D33K-C2": "SR", + "RTXM228-551": "SR", + "RTXM330-003": "SR", + "RTXM330-030": "SR", + "MFA2P10-A005": "SR", + "QAB-OA03MC": "SR4", + "QAB-OA05MC": "SR4", + "RTXM320-571": "SR4", + "AFBR-89CDDZ": "SR4", + "RTXM420-550": "SR4", + "MMA1B00-C100D": "SR4", + "RTXM420-551": "SR4", + "E04025QTXA000": "SR4", + "LQ210PR-Oxxx": "SR4", + "TR-FC13L-N00": "SR4", + "SPQ-CE-LR-CDFL": "SR4", + "FIM37700/170": "SR4", + "FCBN425QE1C03": "SR4", + "TQS-Q14H8-XCAXX": "SR4", + "FPD-203R008-10/3": "SR4", + "LTA8531-PC+": "SR4" } initial_command = [] @@ -107,8 +136,9 @@ def get_port_to_bcm_mapping(self): else: return self.port_to_bcm_mapping - def show_port_to_bcm_mapping(self): - print self.port_to_bcm_mapping + def show_port_to_bcm_mapping(self): + for key,value in self.port_to_bcm_mapping.iteritems(): + print "{0}---{1}".format(key, value) def get_eagle_port(self): return self.eagle_list @@ -122,6 +152,8 @@ def parsing_eagle_port(self): self.eagle_list = [66,100] elif name == INV_SEQUOIA_PLATFORM: self.eagle_list = [66,100] + elif name == INV_MAPLE_PLATFORM: + self.eagle_list = [66,130] else: self.eagle_list = [] @@ -129,7 +161,8 @@ def get_sal_config_list(self): return self.sal_config_list def show_sal_config_list(self): - print self.sal_config_list + for key,value in self.sal_config_list.iteritems(): + print "{0}---{1}".format(key, value) def initial_sal_config_list( self ): content = self.run("config") @@ -164,7 +197,8 @@ def get_transceiver_port_mapping(self): return self.transceiver_port_mapping def show_transceiver_port_mapping(self): - print self.transceiver_port_mapping + for key,value in self.transceiver_port_mapping.iteritems(): + print "{0}---{1}".format(key, value) def get_bcm_port_name(self, index): if self.transceiver_port_mapping.has_key(index) and bcm_obj.get_sal_config_list().has_key(self.transceiver_port_mapping[index]["bcm"]): @@ -179,7 +213,8 @@ def get_port_to_i2c_mapping(self): return self.port_to_i2c_mapping def show_port_to_i2c_mapping(self): - print self.port_to_i2c_mapping + for key,value in self.port_to_i2c_mapping.iteritems(): + print "{0}---{1}".format(key, value) def get_eeprom_partNum(self, portNum): tempdict = dict() @@ -210,12 +245,12 @@ def get_transceiver_type(self, pn ): def set_transceiver_type( self, portNum, pn ): type = self.get_transceiver_type( pn ) if type is not None: - if bcm_obj.get_platform() == INV_SEQUOIA_PLATFORM: + if bcm_obj.get_platform() == INV_SEQUOIA_PLATFORM or bcm_obj.get_platform() == INV_MAPLE_PLATFORM : speed = bcm_obj.get_sal_config_list()[self.transceiver_port_mapping[portNum]["bcm"]]["speed"] bcm_obj.execute_command( "port %s if=%s speed=%d" % ( self.get_bcm_port_name(portNum), type, speed ) ) else: bcm_obj.execute_command( "port %s if=%s" % ( self.get_bcm_port_name(portNum), type ) ) - #print "Detecting port {0} need to change interface type {1} ({2})".format(self.get_bcm_port_name(portNum), type, self.get_transceiver_port_mapping()[portNum]["pn"]) + print "Detecting port {0}({1}) need to change interface type {2} ({3})".format( self.get_bcm_port_name(portNum), portNum, type, self.get_transceiver_port_mapping()[portNum]["pn"]) log_message("Detecting port {0} need to change interface type {1} ({2})".format(self.get_bcm_port_name(portNum), type, self.get_transceiver_port_mapping()[portNum]["pn"]) ) def initial_transceiver_port_mapping(self): @@ -229,57 +264,90 @@ def set_power_mode_for_QSFP(self): for index in self.get_port_to_i2c_mapping().keys(): if index >= self.qsfp_port_start and index <= self.qsfp_port_end : self.set_low_power_mode(index, False) + else: + # To set tx_disable + self.set_tx_disable(index) -def main(): - try: - global DEBUG - global transceiver_obj - global bcm_obj - - initalNotOK = True - retestCount = 0 - while initalNotOK : - try: - transceiver_obj = TransceiverUtil() - bcm_obj = BCMUtil() - initalNotOK = False - except Exception, e: - log_message("Exception. The warning is {0}, Retry again ({1})".format(str(e),retestCount) ) - retestCount = retestCount + 1 - time.sleep(5) - - log_message( "Object initialed successfully" ) + def set_tx_disable(self, port_num): + if port_num >= self.qsfp_port_start and port_num <= self.qsfp_port_end : + pass + else: + try: + tx_file = open("/sys/class/swps/port"+str(port_num)+"/tx_disable", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(tx_file.readline().rstrip()) + + # always set 0 to tx_disable field + if reg_value == 1 : + reg_value = 0 + tx_file.write(hex(reg_value)) + tx_file.close() - options, args = getopt.getopt(sys.argv[1:], 'hd', ['help', - 'debug' - ]) - for opt, arg in options: - if opt in ('-h', '--help'): - show_help() - elif opt in ('-d', '--debug'): - DEBUG = True - logging.basicConfig(level=logging.INFO) - else: - logging.info("no option") - - # Before loop, You could execute specific command to initial chip - for cmd_index in initial_command : - bcm_obj.execute_command(cmd_index) - - # Initial the sal config list - bcm_obj.parsing_eagle_port() - bcm_obj.initial_sal_config_list() - bcm_obj.parsing_port_list() - # bcm_obj.show_port_to_bcm_mapping() - # bcm_obj.show_sal_config_list() - # Initial the transceiver_obj - transceiver_obj.initial_transceiver_port_mapping() - # transceiver_obj.show_transceiver_port_mapping() - - transceiver_obj.set_power_mode_for_QSFP() +def main(): - while 1 : + global DEBUG + global transceiver_obj + global bcm_obj + + initalNotOK = True + retestCount = 0 + while initalNotOK : + try: + transceiver_obj = TransceiverUtil() + bcm_obj = BCMUtil() + initalNotOK = False + except Exception, e: + log_message("Exception. The warning is {0}, Retry again ({1})".format(str(e),retestCount) ) + retestCount = retestCount + 1 + time.sleep(5) + + log_message( "Object initialed successfully" ) + options, args = getopt.getopt(sys.argv[1:], 'hd', ['help', + 'debug' + ]) + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + else: + logging.info("no option") + + initalNotOK = True + while initalNotOK : + try : + # Before loop, You could execute specific command to initial chip + for cmd_index in initial_command : + bcm_obj.execute_command(cmd_index) + + # Initial the sal config list + bcm_obj.parsing_eagle_port() + bcm_obj.initial_sal_config_list() + # bcm_obj.show_sal_config_list() + bcm_obj.parsing_port_list() + #bcm_obj.show_port_to_bcm_mapping() + #bcm_obj.show_sal_config_list() + # transceiver_obj.show_port_to_i2c_mapping() + + # Initial the transceiver_obj + transceiver_obj.initial_transceiver_port_mapping() + # transceiver_obj.show_transceiver_port_mapping() + + initalNotOK = False + except Exception, e: + log_message("Exception. The warning is {0}".format(str(e)) ) + time.sleep(5) + + # Improve the power mode for QSFP ports + transceiver_obj.set_power_mode_for_QSFP() + + while 1 : + try: if bcm_obj.get_platform() == INV_SEQUOIA_PLATFORM: bcm_obj.parsing_port_list() for index in transceiver_obj.get_port_to_i2c_mapping().keys(): @@ -287,15 +355,17 @@ def main(): value = transceiver_obj.get_eeprom_partNum_from_parser_eeprom_dict(info) if transceiver_obj.get_transceiver_port_mapping().has_key(index) is not False and transceiver_obj.get_transceiver_port_mapping()[index]["pn"] <> value: transceiver_obj.get_transceiver_port_mapping()[index]["pn"] = value - transceiver_obj.set_transceiver_type(index,value) - #transceiver_obj.show_transceiver_port_mapping() - time.sleep(1) + transceiver_obj.set_transceiver_type(index,value) + transceiver_obj.set_tx_disable(index) + #transceiver_obj.show_transceiver_port_mapping() + # transceiver_obj.show_transceiver_port_mapping() + except Exception, e: + log_message("Exception. The warning is {0}".format(str(e)) ) + time.sleep(1) - except (Exception, KeyboardInterrupt) as e: - log_message("Terminating this python daemon ({0})".format(e)) - syslog.closelog() - del transceiver_obj - del bcm_obj + syslog.closelog() + del transceiver_obj + del bcm_obj if __name__ == "__main__": main() @@ -303,3 +373,6 @@ def main(): + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/Makefile b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/Makefile new file mode 100644 index 000000000000..13fc34c230c5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/Makefile @@ -0,0 +1,7 @@ +obj-m += inv_cpld.o inv_psoc.o +obj-m += inv_platform.o +obj-m += inv_eeprom.o +obj-m += swps.o +obj-m += inv_pthread.o +swps-objs := inv_swps.o io_expander.o transceiver.o + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_cpld.c b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_cpld.c new file mode 100644 index 000000000000..683ffa0ff3ce --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_cpld.c @@ -0,0 +1,415 @@ +/* + * 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 "I2CHostCommunication.h" + +#define USE_SMBUS 1 + +/* definition */ +#define CPLD_INFO_OFFSET 0x00 +#define CPLD_PSU_OFFSET 0x08 +#define CPLD_LED_OFFSET 0x0E +#define CPLD_LED_STATU_OFFSET 0x0D +#define CPLD_CTL_OFFSET 0x0C + + + +/* Each client has this additional data */ +struct cpld_data { + struct device *hwmon_dev; + struct mutex update_lock; +}; + +/*-----------------------------------------------------------------------*/ + +static ssize_t cpld_i2c_read(struct i2c_client *client, u8 *buf, u8 offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg[0].buf = msgbuf; + msg[0].len = 1; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + status = i2c_transfer(client->adapter, msg, 2); + + if(status == 2) + status = count; + + return status; +#endif +} + +static ssize_t cpld_i2c_write(struct i2c_client *client, char *buf, unsigned offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + return status; +#endif +} + +/*-----------------------------------------------------------------------*/ + +/* sysfs attributes for hwmon */ + +static ssize_t show_info(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[4]; + + memset(b, 0, 4); + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, b, CPLD_INFO_OFFSET, 4); + mutex_unlock(&data->update_lock); + + if(status != 4) return sprintf(buf, "read cpld info fail\n"); + + status = sprintf (buf, "The CPLD release date is %02d/%02d/%d.\n", b[2] & 0xf, (b[3] & 0x1f), 2014+(b[2] >> 4)); /* mm/dd/yyyy*/ + status = sprintf (buf, "%sThe PCB version is %X%X\n", buf, b[0]>>4, b[0]&0xf); + status = sprintf (buf, "%sThe CPLD version is %d.%d\n", buf, b[1]>>4, b[1]&0xf); + + return strlen(buf); +} + + +static ssize_t show_ctl(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[1]; + + mutex_lock(&data->update_lock); + + status = cpld_i2c_read(client, b, CPLD_CTL_OFFSET, 1); + + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld ctl fail\n"); + + + status = sprintf (buf, "0x%X\n", b[0]); + + return strlen(buf); +} + +static ssize_t set_ctl(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + + u8 temp = simple_strtol(buf, NULL, 10); + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_CTL_OFFSET, 1); + if(temp) byte |= (1<<0); + else byte &= ~(1<<0); + cpld_i2c_write(client, &byte, CPLD_CTL_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + + +static char* led_str[] = { + "OFF", //000 + "0.5 Hz", //001 + "1 Hz", //010 + "2 Hz", //011 + "NA", //100 + "NA", //101 + "NA", //110 + "ON", //111 +}; + +static ssize_t show_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 0)?3:0; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_LED_OFFSET, 1); + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld offset 0x%x\n", CPLD_LED_OFFSET); + + byte = (byte >> shift) & 0x7; + + /* + 0: off + 1: 0.5hz + 2: 1 hz + 3: 2 hz + 4~6: not define + 7: on + */ + + status = sprintf (buf, "%d: %s\n", byte, led_str[byte]); + + return strlen(buf); +} + +static ssize_t set_led(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + + u8 temp = simple_strtol(buf, NULL, 16); + u8 byte; + int shift = (attr->index == 0)?3:0; + + temp &= 0x7; + //validate temp value: 0,1,2,3,7, TBD + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_LED_OFFSET, 1); + byte &= ~(0x7<update_lock); + + return count; +} + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu0 | psu1 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 1)?0:3; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_PSU_OFFSET, 1); + mutex_unlock(&data->update_lock); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + + +static SENSOR_DEVICE_ATTR(info, S_IRUGO, show_info, 0, 0); +static SENSOR_DEVICE_ATTR(ctl, S_IWUSR|S_IRUGO, show_ctl, set_ctl, 0); + +static SENSOR_DEVICE_ATTR(grn_led, S_IWUSR|S_IRUGO, show_led, set_led, 0); +static SENSOR_DEVICE_ATTR(red_led, S_IWUSR|S_IRUGO, show_led, set_led, 1); + +static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu, 0, 0); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu, 0, 1); + +static struct attribute *cpld_attributes[] = { + //info + &sensor_dev_attr_info.dev_attr.attr, + &sensor_dev_attr_ctl.dev_attr.attr, + + &sensor_dev_attr_grn_led.dev_attr.attr, + &sensor_dev_attr_red_led.dev_attr.attr, + + &sensor_dev_attr_psu0.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + + NULL +}; + +static const struct attribute_group cpld_group = { + .attrs = cpld_attributes, +}; + +/*-----------------------------------------------------------------------*/ + +/* device probe and removal */ + +static int +cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct cpld_data *data; + int status; + + printk("+%s\n", __func__); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + return -EIO; + + data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cpld_group); + if (status) + goto exit_free; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &cpld_group); +exit_free: + i2c_set_clientdata(client, NULL); + kfree(data); + return status; +} + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cpld_group); + i2c_set_clientdata(client, NULL); + kfree(data); + return 0; +} + +static const struct i2c_device_id cpld_ids[] = { + { "inv_cpld", 0, }, + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, cpld_ids); + +static struct i2c_driver cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "inv_cpld", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_ids, +}; + +/*-----------------------------------------------------------------------*/ + +/* module glue */ + +static int __init inv_cpld_init(void) +{ + return i2c_add_driver(&cpld_driver); +} + +static void __exit inv_cpld_exit(void) +{ + i2c_del_driver(&cpld_driver); +} + +MODULE_AUTHOR("eddie.lan "); +MODULE_DESCRIPTION("inv cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_cpld_init); +module_exit(inv_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_eeprom.c b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_eeprom.c new file mode 100644 index 000000000000..3d13f3b04719 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_eeprom.c @@ -0,0 +1,181 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void inv_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, ((u8)addr >> 8) & 0xFF, (u8)addr & 0xFF); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } + +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t inv_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + inv_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static struct bin_attribute inv_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = inv_eeprom_read, +}; + +static int inv_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &inv_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int inv_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &inv_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id inv_eeprom_id[] = { + { "inv_eeprom", 0 }, + { } +}; + +static struct i2c_driver inv_eeprom_driver = { + .driver = { + .name = "inv_eeprom", + }, + .probe = inv_eeprom_probe, + .remove = inv_eeprom_remove, + .id_table = inv_eeprom_id, +}; + +module_i2c_driver(inv_eeprom_driver); + +MODULE_AUTHOR("Inventec"); +MODULE_DESCRIPTION("Inventec D7054 Mother Board EEPROM driver"); +MODULE_LICENSE("GPL"); + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_mux.c b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_mux.c new file mode 100644 index 000000000000..a8a9a3c3df79 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_mux.c @@ -0,0 +1,280 @@ +/* + * 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 "io_expander.h" +#include "inv_mux.h" + +static struct mux_obj_s *mux_head_p = NULL; + + +/* ========== MUX object functions ========== + */ +int +_common_force_pull_gpio(int mem_addr, + int input, + int bit_offset){ + + unsigned int val = 0; + unsigned int targ = 0; + + /* Get current value */ + val = inl(mem_addr); + if (val == 0) { + SWPS_ERR("%s: inl:%d fail!\n", __func__, val); + return -1; + } + /* Count target value */ + switch (input) { + case 0: /* Pull Low */ + targ = (val & (~(1 << bit_offset))); + break; + case 1: /* Pull high */ + targ = (val | (1 << bit_offset)); + break; + default: + SWPS_ERR("%s: input state:%d incorrect!\n", + __func__, input); + return -1; + } + /* Setup gpio */ + outl(targ, mem_addr); + if (targ != inl(mem_addr)){ + SWPS_ERR("%s: outl:%d fail!\n", __func__, targ); + return -1; + } + SWPS_DEBUG("%s: done.\n", __func__); + return 0; +} + + +int +rangeley_force_pull_high(struct mux_obj_s *self){ + SWPS_ERR("%s: not ready!\n", __func__); + return -1; +} + + +int +rangeley_force_pull_low(struct mux_obj_s *self){ + SWPS_ERR("%s: not ready!\n", __func__); + return -1; +} + + +int +hedera_force_pull_high(struct mux_obj_s *self){ + return _common_force_pull_gpio(MUX_RST_MEM_ADDR_HEDERA, 1, 5); +} + + +int +hedera_force_pull_low(struct mux_obj_s *self){ + return _common_force_pull_gpio(MUX_RST_MEM_ADDR_HEDERA, 0, 5); +} + + +int +normal_gpio_pull_high(struct mux_obj_s *self){ + return gpio_direction_output(self->gpio_num, 1); +} + + +int +normal_gpio_pull_low(struct mux_obj_s *self){ + return gpio_direction_output(self->gpio_num, 0); +} + + +int +pca9548_reset_mux_all(struct mux_obj_s *self){ + /* [Note] Power-on reset (PCA9548A-NXP) + * When power is applied to VDD, an internal Power-On Reset (POR) + * holds the PCA9548A in a reset condition until VDD has reached + * VPOR. At this point, the reset condition is released and the + * PCA9548A register and I2C-bus state machine are initialized to + * their default states (all zeroes) causing all the channels to + * be deselected. Thereafter, VDD must be lowered below 0.2 V for + * at least 5 us in order to reset the device. + */ + if (self->_pull_low(self) < 0) { + SWPS_ERR("%s: _pull_low fail!\n", __func__); + return -1; + } + mdelay(MUX_RST_WAIT_MS); + if (self->_pull_high(self) < 0) { + SWPS_ERR("%s: _pull_high fail!\n", __func__); + return -1; + } + mdelay(MUX_RST_WAIT_MS); + return 0; +} + + +int +common_reset_mux_all(struct mux_obj_s *self){ + SWPS_ERR("%s: not ready!\n", __func__); + return -1; +} + + +int +init_gpio_4_force(struct mux_obj_s *self){ + return 0; +} + + +int +init_gpio_4_normal(struct mux_obj_s *self){ + + int err = 0; + + if (!gpio_is_valid(self->gpio_num)) { + SWPS_ERR("%s: GIPO:%d isn't valid\n", __func__, self->gpio_num); + return -1; + } + err = gpio_request(self->gpio_num, MUX_GPIO_LABEL); + if (err < 0) { + SWPS_ERR("%s: gpio_request fail :%d :%d\n", + __func__, err, self->gpio_num); + return -1; + } + SWPS_DEBUG("%s: gpio_request:%d ok.\n", __func__, self->gpio_num); + return 0; +} + + +static int +_setup_muxctl_cb(struct mux_obj_s *self, + unsigned gpio){ + + char mod_dsc[32] = "ERR"; + + switch (gpio) { + case MUX_RST_GPIO_FORCE_RANGELEY: + self->gpio_num = gpio; + self->_pull_low = rangeley_force_pull_low; + self->_pull_high = rangeley_force_pull_high; + self->_init = init_gpio_4_force; + self->reset = pca9548_reset_mux_all; + memset(mod_dsc, 0, 32); + snprintf(mod_dsc, 31, "Rangeley force mode"); + goto ok_setup_muxctl_cb; + + case MUX_RST_GPIO_FORCE_HEDERA: + self->gpio_num = gpio; + self->_pull_low = hedera_force_pull_low; + self->_pull_high = hedera_force_pull_high; + self->_init = init_gpio_4_force; + self->reset = pca9548_reset_mux_all; + memset(mod_dsc, 0, 32); + snprintf(mod_dsc, 31, "Hedera force mode"); + goto ok_setup_muxctl_cb; + + case MUX_RST_GPIO_48_PAC9548: + case MUX_RST_GPIO_69_PAC9548: + case MUX_RST_GPIO_249_PCA9548: + case MUX_RST_GPIO_505_PCA9548: + self->gpio_num = gpio; + self->_pull_low = normal_gpio_pull_low; + self->_pull_high = normal_gpio_pull_high; + self->_init = init_gpio_4_normal; + self->reset = pca9548_reset_mux_all; + memset(mod_dsc, 0, 32); + snprintf(mod_dsc, 31, "Normal mode :%d", (int)gpio); + goto ok_setup_muxctl_cb; + + default: + break; + } + SWPS_ERR("%s: Unexpected GPIO:%d\n", __func__, gpio); + return -1; + +ok_setup_muxctl_cb: + SWPS_INFO("muxctl: %s.\n", mod_dsc); + return 0; +} + + +/* ========== MUX public functions ========== + */ +void +clean_mux_gpio(void){ + + if (!mux_head_p) { + SWPS_DEBUG("%s: mux_head_p is NULL\n", __func__); + return; + } + if (gpio_is_valid(mux_head_p->gpio_num)) { + gpio_free(mux_head_p->gpio_num); + } + kfree(mux_head_p); + mux_head_p = NULL; + SWPS_DEBUG("%s: done.\n", __func__); +} + + +int +reset_mux_gpio(void){ + + if (!mux_head_p) { + SWPS_ERR("%s: MUX ctl object doesn't exist!\n", __func__); + return -1; + } + if (mux_head_p->reset(mux_head_p) < 0){ + SWPS_ERR("%s: reset fail!\n", __func__); + return -1; + } + return 0; +} + + +int +init_mux_gpio(unsigned gpio){ + + /* Create MUX control object */ + if (mux_head_p) { + SWPS_DEBUG("%s: mux_head_p is not NULL!\n", __func__); + clean_mux_gpio(); + } + /* Currently, it is using single muxctl architecture. + * In the future, it may use the multi-muxctl if HW add new features. + * (Ex: Port power-status control) + */ + mux_head_p = kzalloc(sizeof(struct mux_obj_s), GFP_KERNEL); + if (!mux_head_p) { + SWPS_ERR("%s: kzalloc fail!\n", __func__); + return -1; + } + /* Initial MUX controller */ + if (_setup_muxctl_cb(mux_head_p, gpio) < 0){ + SWPS_ERR("%s: _setup_muxctl_cb fail!\n", __func__); + return -1; + } + if (mux_head_p->_init(mux_head_p) < 0) { + SWPS_ERR("%s: init() fail\n", __func__); + goto err_init_mux_gpio; + } + /* Setup default value */ + if (mux_head_p->_pull_high(mux_head_p) < 0) { + SWPS_ERR("%s: setup default fail!\n", __func__); + goto err_init_mux_gpio; + } + return 0; + +err_init_mux_gpio: + clean_mux_gpio(); + return -1; +} + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_mux.h b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_mux.h new file mode 100644 index 000000000000..687a11b4e5be --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_mux.h @@ -0,0 +1,45 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#ifndef INV_MUX_H +#define INV_MUX_H + + +/* MUX basic information */ +#define MUX_GPIO_LABEL "SWPS_RST_MUX" + +/* MUX reset GPIO define */ +#define MUX_RST_GPIO_FORCE (30100) +#define MUX_RST_GPIO_FORCE_RANGELEY (30101) +#define MUX_RST_GPIO_FORCE_HEDERA (30102) +#define MUX_RST_GPIO_48_PAC9548 (48) +#define MUX_RST_GPIO_69_PAC9548 (69) +#define MUX_RST_GPIO_249_PCA9548 (249) +#define MUX_RST_GPIO_505_PCA9548 (505) + +/* MUX relate value define */ +#define MUX_RST_WAIT_MS (1) +#define MUX_RST_MEM_ADDR_RANGELEY (0) // TBD +#define MUX_RST_MEM_ADDR_HEDERA (0x548) + +struct mux_obj_s { + unsigned gpio_num; + int (*_pull_high)(struct mux_obj_s *self); + int (*_pull_low)(struct mux_obj_s *self); + int (*_init)(struct mux_obj_s *self); + int (*reset)(struct mux_obj_s *self); +}; + + +void clean_mux_gpio(void); +int reset_mux_gpio(void); +int init_mux_gpio(unsigned gpio); + + +#endif /* INV_MUX_H */ + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_platform.c b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_platform.c new file mode 100644 index 000000000000..e69b526f4555 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_platform.c @@ -0,0 +1,243 @@ +/* + * 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 + +struct inv_i2c_board_info { + int ch; + int size; + struct i2c_board_info *board_info; +}; + +///////////////////////////////////////////////////////////////////////////////////////// +static struct pca954x_platform_mode mux_modes_0[] = { + {.adap_id = 2,}, {.adap_id = 3,}, + {.adap_id = 4,}, {.adap_id = 5,}, + {.adap_id = 6,}, {.adap_id = 7,}, + {.adap_id = 8,}, {.adap_id = 9,}, +}; +static struct pca954x_platform_mode mux_modes_0_0[] = { + {.adap_id = 10,}, {.adap_id = 11,}, + {.adap_id = 12,}, {.adap_id = 13,}, + {.adap_id = 14,}, {.adap_id = 15,}, + {.adap_id = 16,}, {.adap_id = 17,}, +}; + +static struct pca954x_platform_mode mux_modes_0_1[] = { + {.adap_id = 18,}, {.adap_id = 19,}, + {.adap_id = 20,}, {.adap_id = 21,}, + {.adap_id = 22,}, {.adap_id = 23,}, + {.adap_id = 24,}, {.adap_id = 25,}, +}; + +static struct pca954x_platform_mode mux_modes_0_2[] = { + {.adap_id = 26,}, {.adap_id = 27,}, + {.adap_id = 28,}, {.adap_id = 29,}, + {.adap_id = 30,}, {.adap_id = 31,}, + {.adap_id = 32,}, {.adap_id = 33,}, +}; + +static struct pca954x_platform_mode mux_modes_0_3[] = { + {.adap_id = 34,}, {.adap_id = 35,}, + {.adap_id = 36,}, {.adap_id = 37,}, + {.adap_id = 38,}, {.adap_id = 39,}, + {.adap_id = 40,}, {.adap_id = 41,}, +}; + +static struct pca954x_platform_mode mux_modes_0_4[] = { + {.adap_id = 42,}, {.adap_id = 43,}, + {.adap_id = 44,}, {.adap_id = 45,}, + {.adap_id = 46,}, {.adap_id = 47,}, + {.adap_id = 48,}, {.adap_id = 49,}, +}; + +static struct pca954x_platform_mode mux_modes_0_5[] = { + {.adap_id = 50,}, {.adap_id = 51,}, + {.adap_id = 52,}, {.adap_id = 53,}, + {.adap_id = 54,}, {.adap_id = 55,}, + {.adap_id = 56,}, {.adap_id = 57,}, +}; + +static struct pca954x_platform_mode mux_modes_0_6[] = { + {.adap_id = 58,}, {.adap_id = 59,}, + {.adap_id = 60,}, {.adap_id = 61,}, + {.adap_id = 62,}, {.adap_id = 63,}, + {.adap_id = 64,}, {.adap_id = 65,}, +}; + +//no i2c device driver attach to mux 7 + + +static struct pca954x_platform_data mux_data_0 = { + .modes = mux_modes_0, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_0 = { + .modes = mux_modes_0_0, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_1 = { + .modes = mux_modes_0_1, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_2 = { + .modes = mux_modes_0_2, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_3 = { + .modes = mux_modes_0_3, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_4 = { + .modes = mux_modes_0_4, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_5 = { + .modes = mux_modes_0_5, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_6 = { + .modes = mux_modes_0_6, + .num_modes = 8, +}; + + +static struct i2c_board_info xlp_i2c_device_info0[] __initdata = { + {"inv_psoc", 0, 0x66, 0, 0, 0},//psoc + {"inv_cpld", 0, 0x55, 0, 0, 0},//cpld + {"pca9548", 0, 0x71, &mux_data_0, 0, 0}, +}; + +static struct i2c_board_info xlp_i2c_device_info1[] __initdata = { + {"inv_psoc", 0, 0x66, 0, 0, 0},//psoc + {"inv_cpld", 0, 0x55, 0, 0, 0},//cpld +}; + +static struct i2c_board_info xlp_i2c_device_info2[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_0, 0, 0}, +}; + +static struct i2c_board_info xlp_i2c_device_info3[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_1, 0, 0}, +}; + +static struct i2c_board_info xlp_i2c_device_info4[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_2, 0, 0}, +}; + +static struct i2c_board_info xlp_i2c_device_info5[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_3, 0, 0}, +}; +static struct i2c_board_info xlp_i2c_device_info6[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_4, 0, 0}, +}; +static struct i2c_board_info xlp_i2c_device_info7[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_5, 0, 0}, +}; +static struct i2c_board_info xlp_i2c_device_info8[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_6, 0, 0}, +}; + + +static struct inv_i2c_board_info i2cdev_list[] = { + {0, ARRAY_SIZE(xlp_i2c_device_info0), xlp_i2c_device_info0 }, //smbus 0 + + {2, ARRAY_SIZE(xlp_i2c_device_info2), xlp_i2c_device_info2 }, //mux 0 + {3, ARRAY_SIZE(xlp_i2c_device_info3), xlp_i2c_device_info3 }, //mux 1 + {4, ARRAY_SIZE(xlp_i2c_device_info4), xlp_i2c_device_info4 }, //mux 2 + {5, ARRAY_SIZE(xlp_i2c_device_info5), xlp_i2c_device_info5 }, //mux 3 + {6, ARRAY_SIZE(xlp_i2c_device_info6), xlp_i2c_device_info6 }, //mux 4 + {7, ARRAY_SIZE(xlp_i2c_device_info7), xlp_i2c_device_info7 }, //mux 5 + {8, ARRAY_SIZE(xlp_i2c_device_info8), xlp_i2c_device_info8 }, //mux 6 +}; + +///////////////////////////////////////////////////////////////////////////////////////// +static struct i2c_gpio_platform_data i2c_gpio_platdata = { + .scl_pin = 8, + .sda_pin = 9, + + .udelay = 5, //5:100kHz + .sda_is_open_drain = 0, + .scl_is_open_drain = 0, + .scl_is_output_only = 0 +}; + +static struct platform_device magnolia_device_i2c_gpio = { + .name = "i2c-gpio", + .id = 0, // adapter number + .dev.platform_data = &i2c_gpio_platdata, +}; + +#define PLAT_MAX_I2C_CLIENTS 32 +static struct i2c_client *plat_i2c_client[PLAT_MAX_I2C_CLIENTS]; +static int num_i2c_clients = 0; +static int plat_i2c_client_add(struct i2c_client *e) +{ + if (num_i2c_clients >= PLAT_MAX_I2C_CLIENTS) + return -1; + + plat_i2c_client[num_i2c_clients] = e; + num_i2c_clients++; + return num_i2c_clients; +} + +static void plat_i2c_client_remove_all(void) +{ + int i; + for (i = num_i2c_clients-1; i >= 0; i--) + i2c_unregister_device(plat_i2c_client[i]); +} + +static int __init plat_magnolia_init(void) +{ + struct i2c_adapter *adap = NULL; + struct i2c_client *e = NULL; + int ret = 0; + int i,j; + + for(i=0; i +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//#include "I2CHostCommunication.h" + +#define USE_SMBUS 1 + +#define FAN_NUM 4 +#define PSU_NUM 2 + +struct __attribute__ ((__packed__)) psoc_psu_layout { + u16 psu1_iin; + u16 psu2_iin; + u16 psu1_iout; + u16 psu2_iout; + + u16 psu1_pin; + u16 psu2_pin; + u16 psu1_pout; + u16 psu2_pout; + + u16 psu1_vin; + u16 psu2_vin; + u16 psu1_vout; + u16 psu2_vout; + + u8 psu1_vendor[16]; + u8 psu2_vendor[16]; + u8 psu1_model[20]; + u8 psu2_model[20]; + u8 psu1_version[8]; + u8 psu2_version[8]; + u8 psu1_date[6]; + u8 psu2_date[6]; + u8 psu1_sn[20]; + u8 psu2_sn[20]; +}; + +struct __attribute__ ((__packed__)) psoc_layout { + u8 ctl; //offset: 0 + u16 switch_temp; //offset: 1 + u8 reserve0; //offset: 3 + + u8 fw_upgrade; //offset: 4 + + //i2c bridge + u8 i2c_st; //offset: 5 + u8 i2c_ctl; //offset: 6 + u8 i2c_addr; //offset: 7 + u8 i2c_data[0x20]; //offset: 8 + + //gpo + u8 led_ctl; //offset: 28 + + u8 gpio; //offset: 29 + + //pwm duty + u8 pwm[FAN_NUM]; //offset: 2a + u8 pwm_psu[PSU_NUM]; //offset: 2e + + //fan rpm + u16 fan[FAN_NUM*2]; //offset: 30 + + u8 reserve1[4]; //offset: 40 + + //gpi + u8 gpi_fan; //offset: 44 + + //psu state + u8 psu_state; //offset: 45 + + //temperature + u16 temp[5]; //offset: 46 + u16 temp_psu[PSU_NUM]; //offset: 50 + + //version + u8 version[2]; //offset: 54 + + u8 reserve2[4]; //offset: 56 + struct psoc_psu_layout psu_info; //offset: 5a +}; + +/* definition */ +/* definition */ +#define PSOC_OFF(m) offsetof(struct psoc_layout, m) +#define PSOC_PSU_OFF(m) offsetof(struct psoc_psu_layout, m) + +#define SWITCH_TMP_OFFSET PSOC_OFF(switch_temp) +#define PWM_OFFSET PSOC_OFF(pwm) +#define THERMAL_OFFSET PSOC_OFF(temp) +#define RPM_OFFSET PSOC_OFF(fan) +#define DIAG_FLAG_OFFSET PSOC_OFF(ctl) +#define FAN_LED_OFFSET PSOC_OFF(led_ctl) +#define FAN_GPI_OFFSET PSOC_OFF(gpi_fan) +#define PSOC_PSU_OFFSET PSOC_OFF(psu_state) +#define VERSION_OFFSET PSOC_OFF(version) +#define PSU_INFO_OFFSET PSOC_OFF(psu_info) + +/* Each client has this additional data */ +struct psoc_data { + struct device *hwmon_dev; + struct mutex update_lock; + u32 diag; +}; + +/*-----------------------------------------------------------------------*/ + +static ssize_t psoc_i2c_read(struct i2c_client *client, u8 *buf, u8 offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg[0].buf = msgbuf; + msg[0].len = 1; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + status = i2c_transfer(client->adapter, msg, 2); + + if(status == 2) + status = count; + + return status; +#endif +} + +static ssize_t psoc_i2c_write(struct i2c_client *client, char *buf, unsigned offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + return status; +#endif +} + +#if 0 +static u32 psoc_read32(struct i2c_client *client, u8 offset) +{ + u32 value = 0; + u8 buf[4]; + + if( psoc_i2c_read(client, buf, offset, 4) == 4) + value = (buf[0]<<24 | buf[1]<<16 | buf[2]<<8 | buf[3]); + + return value; +} +#endif + +static u16 psoc_read16(struct i2c_client *client, u8 offset) +{ + u16 value = 0; + u8 buf[2]; + + if(psoc_i2c_read(client, buf, offset, 2) == 2) + value = (buf[0]<<8 | buf[1]<<0); + + return value; +} + +static u8 psoc_read8(struct i2c_client *client, u8 offset) +{ + u8 value = 0; + u8 buf = 0; + + if(psoc_i2c_read(client, &buf, offset, 1) == 1) + value = buf; + + return value; +} + +//PSOC i2c bridge regsters +#define PSOC_I2C_STATUS 0x05 +#define PSOC_I2C_CNTRL 0x06 +#define PSOC_I2C_ADDR 0x07 +#define PSOC_I2C_DATA 0x08 + +//status bit definition +#define PSOC_I2C_START (1 << 0) +#define PSOC_PMB_SEL (1 << 7) + +//addr bits definition +#define PSOC_I2C_READ (1 << 0) + +//PMBUS registers definition +#define PMBUS_READ_VIN (0x88) +#define PMBUS_READ_IIN (0x89) +#define PMBUS_READ_VOUT (0x8B) +#define PMBUS_READ_IOUT (0x8C) +#define PMBUS_READ_POUT (0x96) +#define PMBUS_READ_PIN (0x97) + +#define PMBUS_MFR_ID (0x99) +#define PMBUS_MFR_MODEL (0x9A) +#define PMBUS_MFR_REVISION (0x9B) +#define PMBUS_MFR_DATE (0x9D) +#define PMBUS_MFR_SERIAL (0x9E) + +static int psoc_i2c_bridge_read(struct i2c_client *client, + unsigned char bus, + unsigned char chip, + char *addr, int alen, + unsigned char *data, int len ) +{ + unsigned char txdata[28], rxdata[28]; + int index, timeout; + + txdata[PSOC_I2C_STATUS] = 0; /* the status */ + txdata[PSOC_I2C_CNTRL] = ((alen & 3) << 5) | (len & 0x1f); /* the sizes */ + txdata[PSOC_I2C_ADDR] = (chip << 1) | PSOC_I2C_READ; /* read address */ + for(index = 0; index < alen; index++) + txdata[PSOC_I2C_DATA + index] = addr[index]; /* the chip address */ + for(; index < alen+len; index++) + txdata[PSOC_I2C_DATA + index] = 0; /* clear the chip data */ + + psoc_i2c_write(client, &txdata[PSOC_I2C_CNTRL], PSOC_I2C_CNTRL, 2 + alen + len); + + //delay a while ??? + //--------------------------------------------------------------------- + //start write + txdata[PSOC_I2C_STATUS] = PSOC_I2C_START | PSOC_PMB_SEL; /* the start bit for the PM bus */ + psoc_i2c_write(client, &txdata[PSOC_I2C_STATUS], PSOC_I2C_STATUS, 1); + + //delay a while + timeout = 40; //40*20==>800 ms + do { + psoc_i2c_read(client, &rxdata[PSOC_I2C_STATUS], PSOC_I2C_STATUS, 1); + + //check rxdata[5] error bit(1) and complete bit(0) ,TBD + if((rxdata[PSOC_I2C_STATUS] & 0x2) == 0x2) { + //printk("i2c bridge fail!!!\n"); + timeout = 0; + break; + } + if((rxdata[PSOC_I2C_STATUS] & PSOC_I2C_START) == 0) { + /* comand complete */ + psoc_i2c_read(client, &rxdata[PSOC_I2C_DATA+alen], PSOC_I2C_DATA+alen, len); + break; + } + + //delay + msleep(20); + } while(timeout--); + + if(timeout <= 0) { + return -1; + } + + //--------------------------------------------------------------------- + + for(index=0; index < len; index++) { + data[index] = rxdata[PSOC_I2C_DATA + alen + index]; + } + + return 0; +} + + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu1 | psu0 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu_st(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 0)?3:0; + + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client, &byte, PSOC_PSU_OFFSET, 1); + mutex_unlock(&data->update_lock); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + +/*-----------------------------------------------------------------------*/ + +/* sysfs attributes for hwmon */ + +static ssize_t show_thermal(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index * 2 + THERMAL_OFFSET; + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + (s8)(status>>8) * 1000 ); +} + + +static ssize_t show_pwm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index + PWM_OFFSET; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + status); +} + +static ssize_t set_pwm(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index + PWM_OFFSET; + + u8 pwm = simple_strtol(buf, NULL, 10); + if(pwm > 255) pwm = 255; + + if(data->diag) { + mutex_lock(&data->update_lock); + psoc_i2c_write(client, &pwm, offset, 1); + mutex_unlock(&data->update_lock); + } + + return count; +} + + +static ssize_t show_rpm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index*2 + RPM_OFFSET; + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + status); +} + +static ssize_t show_switch_tmp(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u16 temp = 0; + + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client, (u8*)&temp, SWITCH_TMP_OFFSET, 2); + mutex_unlock(&data->update_lock); + + status = sprintf (buf, "%d\n", (s8)(temp>>8) * 1000 ); + + return strlen(buf); +} + +static ssize_t set_switch_tmp(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + + long temp = simple_strtol(buf, NULL, 10); + u16 temp2 = ( (temp/1000) <<8 ) & 0xFF00 ; + + //printk("set_switch_tmp temp=%d, temp2=0x%x (%x,%x)\n", temp, temp2, ( ( (temp/1000) <<8 ) & 0xFF00 ), (( (temp%1000) / 10 ) & 0xFF)); + + mutex_lock(&data->update_lock); + psoc_i2c_write(client, (u8*)&temp2, SWITCH_TMP_OFFSET, 2); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_diag(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 diag_flag = 0; + + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client, (u8*)&diag_flag, DIAG_FLAG_OFFSET, 1); + mutex_unlock(&data->update_lock); + + data->diag = (diag_flag & 0x80)?1:0; + status = sprintf (buf, "%d\n", data->diag); + + return strlen(buf); +} + +static ssize_t set_diag(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 value = 0; + u8 diag = simple_strtol(buf, NULL, 10); + + diag = diag?1:0; + data->diag = diag; + + mutex_lock(&data->update_lock); + psoc_i2c_read(client, (u8*)&value, DIAG_FLAG_OFFSET, 1); + if(diag) value |= (1<<7); + else value &= ~(1<<7); + psoc_i2c_write(client, (u8*)&value, DIAG_FLAG_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, VERSION_OFFSET); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "ver: %x.%x\n", (status & 0xFF00)>>8, (status & 0xFF) ); +} + + +static ssize_t show_fan_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 bit = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, FAN_LED_OFFSET); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + (status & (1<index; + u8 led_state = 0; + + u8 v = simple_strtol(buf, NULL, 10); + + if(data->diag) { + mutex_lock(&data->update_lock); + led_state = psoc_read8(client, FAN_LED_OFFSET); + if(v) led_state |= (1<update_lock); + } + + return count; +} + +static ssize_t show_value8(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "0x%02X\n", status ); +} + +static long pmbus_reg2data_linear(int data, int linear16) +{ + s16 exponent; + s32 mantissa; + long val; + + if (linear16) { /* LINEAR16 */ + exponent = -9; + mantissa = (u16) data; + } else { /* LINEAR11 */ + exponent = ((s16)data) >> 11; + exponent = ((s16)( data & 0xF800) ) >> 11; + mantissa = ((s32)((data & 0x7ff) << 5)) >> 5; + } + + //printk("data=%d, m=%d, e=%d\n", data, exponent, mantissa); + val = mantissa; + + /* scale result to micro-units for power sensors */ + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val; +} + +static ssize_t show_psu(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 reg = attr->index & 0xFF; + u8 len = ((attr->index & 0xFF00) >> 8); + u8 chip = (attr->index >> 16)? 0x59:0x58; + u8 bus = 1; + unsigned char value[2] = {0,0};; + + if (len == 2) + { + mutex_lock(&data->update_lock); + psoc_i2c_bridge_read(client, bus, chip, ®, 1, value, 2); + mutex_unlock(&data->update_lock); + + status = value[1]<<8 | value[0]; + //status1 = value[1]<<8 | value[0]; + + return sprintf(buf, "%ld\n", pmbus_reg2data_linear(status, (reg==PMBUS_READ_VOUT)?1:0) ); + } + else + { //len is not defined. + u8 tmpbuf[32]; + mutex_lock(&data->update_lock); + //length of block read + psoc_i2c_bridge_read(client, bus, chip, ®, 1, &len, 1); + //data included length + psoc_i2c_bridge_read(client, bus, chip, ®, 1, tmpbuf, len+1); + mutex_unlock(&data->update_lock); + + memcpy(buf, tmpbuf+1, len); + buf[len]='\n'; + + return len+1; + } +} + +static ssize_t show_psu_psoc(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = (attr->index & 0xFF) + PSU_INFO_OFFSET; + u8 len = (attr->index >> 8)& 0xFF; + u8 rxbuf[21] = {0}; + if (len == 2) + { + mutex_lock(&data->update_lock); + status = psoc_read16(client, offset); + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%ld \n", pmbus_reg2data_linear(status, strstr(attr->dev_attr.attr.name, "vout")? 1:0 )); + } + else + { + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client,rxbuf,offset,len); + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s \n",rxbuf); + } +} + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_thermal, 0, 0); +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_thermal, 0, 1); +static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_thermal, 0, 2); +static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_thermal, 0, 3); +static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_thermal, 0, 4); +static SENSOR_DEVICE_ATTR(thermal_psu1, S_IRUGO, show_thermal, 0, 5); +static SENSOR_DEVICE_ATTR(thermal_psu2, S_IRUGO, show_thermal, 0, 6); + +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 0); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 1); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 2); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 3); +static SENSOR_DEVICE_ATTR(pwm_psu1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 4); +static SENSOR_DEVICE_ATTR(pwm_psu2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 5); + +static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu_st, 0, 0); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu_st, 0, 1); + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_rpm, 0, 0); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_rpm, 0, 1); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_rpm, 0, 2); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_rpm, 0, 3); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_rpm, 0, 4); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_rpm, 0, 5); +static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_rpm, 0, 6); +static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_rpm, 0, 7); +static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8); +static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9); + +static SENSOR_DEVICE_ATTR(switch_tmp, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); +static SENSOR_DEVICE_ATTR(temp6_input, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); + +static SENSOR_DEVICE_ATTR(diag, S_IWUSR|S_IRUGO, show_diag, set_diag, 0); +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, 0, 0); + +static SENSOR_DEVICE_ATTR(fan_led_grn1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 0); +static SENSOR_DEVICE_ATTR(fan_led_grn2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 1); +static SENSOR_DEVICE_ATTR(fan_led_grn3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 2); +static SENSOR_DEVICE_ATTR(fan_led_grn4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 3); +static SENSOR_DEVICE_ATTR(fan_led_red1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 4); +static SENSOR_DEVICE_ATTR(fan_led_red2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 5); +static SENSOR_DEVICE_ATTR(fan_led_red3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 6); +static SENSOR_DEVICE_ATTR(fan_led_red4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 7); + +static SENSOR_DEVICE_ATTR(fan_gpi, S_IRUGO, show_value8, 0, FAN_GPI_OFFSET); + +static SENSOR_DEVICE_ATTR(psu1_vin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_VIN); +static SENSOR_DEVICE_ATTR(psu1_vout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_VOUT); +static SENSOR_DEVICE_ATTR(psu1_iin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_IIN); +static SENSOR_DEVICE_ATTR(psu1_iout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_IOUT); +static SENSOR_DEVICE_ATTR(psu1_pin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_PIN); +static SENSOR_DEVICE_ATTR(psu1_pout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_POUT); + +static SENSOR_DEVICE_ATTR(psu1_vendor, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_ID); +static SENSOR_DEVICE_ATTR(psu1_model, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu1_version, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu1_date, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_DATE); +static SENSOR_DEVICE_ATTR(psu1_sn, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_SERIAL); + +static SENSOR_DEVICE_ATTR(psu2_vin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_VIN); +static SENSOR_DEVICE_ATTR(psu2_vout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_VOUT); +static SENSOR_DEVICE_ATTR(psu2_iin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_IIN); +static SENSOR_DEVICE_ATTR(psu2_iout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_IOUT); +static SENSOR_DEVICE_ATTR(psu2_pin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_PIN); +static SENSOR_DEVICE_ATTR(psu2_pout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_POUT); + +static SENSOR_DEVICE_ATTR(psu2_vendor, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_ID); +static SENSOR_DEVICE_ATTR(psu2_model, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu2_version, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu2_date, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_DATE); +static SENSOR_DEVICE_ATTR(psu2_sn, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_SERIAL); + +static SENSOR_DEVICE_ATTR(psoc_psu1_vin, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_vout, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu1_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iin, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iout, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu1_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pin, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pout, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu1_pout)); + + +static SENSOR_DEVICE_ATTR(psoc_psu2_vin, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_vout, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu2_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iin, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iout, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu2_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pin, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu2_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pout, S_IRUGO, show_psu_psoc, 0, (0x02<<8)|PSOC_PSU_OFF(psu2_pout)); + +static SENSOR_DEVICE_ATTR(psoc_psu1_vendor, S_IRUGO, show_psu_psoc, 0, (0x10<<8)|PSOC_PSU_OFF(psu1_vendor)); +static SENSOR_DEVICE_ATTR(psoc_psu1_model, S_IRUGO, show_psu_psoc, 0, (0x14<<8)|PSOC_PSU_OFF(psu1_model)); +static SENSOR_DEVICE_ATTR(psoc_psu1_version, S_IRUGO, show_psu_psoc, 0, (0x08<<8)|PSOC_PSU_OFF(psu1_version)); +static SENSOR_DEVICE_ATTR(psoc_psu1_date, S_IRUGO, show_psu_psoc, 0, (0x06<<8)|PSOC_PSU_OFF(psu1_date)); +static SENSOR_DEVICE_ATTR(psoc_psu1_sn, S_IRUGO, show_psu_psoc, 0, (0x14<<8)|PSOC_PSU_OFF(psu1_sn)); +static SENSOR_DEVICE_ATTR(psoc_psu2_vendor, S_IRUGO, show_psu_psoc, 0, (0x10<<8)|PSOC_PSU_OFF(psu2_vendor)); +static SENSOR_DEVICE_ATTR(psoc_psu2_model, S_IRUGO, show_psu_psoc, 0, (0x14<<8)|PSOC_PSU_OFF(psu2_model)); +static SENSOR_DEVICE_ATTR(psoc_psu2_version, S_IRUGO, show_psu_psoc, 0, (0x08<<8)|PSOC_PSU_OFF(psu2_version)); +static SENSOR_DEVICE_ATTR(psoc_psu2_date, S_IRUGO, show_psu_psoc, 0, (0x06<<8)|PSOC_PSU_OFF(psu2_date)); +static SENSOR_DEVICE_ATTR(psoc_psu2_sn, S_IRUGO, show_psu_psoc, 0, (0x14<<8)|PSOC_PSU_OFF(psu2_sn)); + +static struct attribute *psoc_attributes[] = { + //thermal + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp4_input.dev_attr.attr, + &sensor_dev_attr_temp5_input.dev_attr.attr, + + &sensor_dev_attr_thermal_psu1.dev_attr.attr, + &sensor_dev_attr_thermal_psu2.dev_attr.attr, + + + //pwm + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, + &sensor_dev_attr_pwm_psu1.dev_attr.attr, + &sensor_dev_attr_pwm_psu2.dev_attr.attr, + + //rpm + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan6_input.dev_attr.attr, + &sensor_dev_attr_fan7_input.dev_attr.attr, + &sensor_dev_attr_fan8_input.dev_attr.attr, + + &sensor_dev_attr_rpm_psu1.dev_attr.attr, + &sensor_dev_attr_rpm_psu2.dev_attr.attr, + + //switch temperature + &sensor_dev_attr_switch_tmp.dev_attr.attr, + &sensor_dev_attr_temp6_input.dev_attr.attr, + //diag flag + &sensor_dev_attr_diag.dev_attr.attr, + + //version + &sensor_dev_attr_version.dev_attr.attr, + + //fan led + &sensor_dev_attr_fan_led_grn1.dev_attr.attr, + &sensor_dev_attr_fan_led_grn2.dev_attr.attr, + &sensor_dev_attr_fan_led_grn3.dev_attr.attr, + &sensor_dev_attr_fan_led_grn4.dev_attr.attr, + &sensor_dev_attr_fan_led_red1.dev_attr.attr, + &sensor_dev_attr_fan_led_red2.dev_attr.attr, + &sensor_dev_attr_fan_led_red3.dev_attr.attr, + &sensor_dev_attr_fan_led_red4.dev_attr.attr, + + //fan GPI + &sensor_dev_attr_fan_gpi.dev_attr.attr, + + //psu + &sensor_dev_attr_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psu2_pout.dev_attr.attr, + + &sensor_dev_attr_psu1_vendor.dev_attr.attr, + &sensor_dev_attr_psu1_model.dev_attr.attr, + &sensor_dev_attr_psu1_version.dev_attr.attr, + &sensor_dev_attr_psu1_date.dev_attr.attr, + &sensor_dev_attr_psu1_sn.dev_attr.attr, + &sensor_dev_attr_psu2_vendor.dev_attr.attr, + &sensor_dev_attr_psu2_model.dev_attr.attr, + &sensor_dev_attr_psu2_version.dev_attr.attr, + &sensor_dev_attr_psu2_date.dev_attr.attr, + &sensor_dev_attr_psu2_sn.dev_attr.attr, + + &sensor_dev_attr_psu0.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + + + //psu_psoc, new added on psoc 1.9 + &sensor_dev_attr_psoc_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pout.dev_attr.attr, + + //add info + &sensor_dev_attr_psoc_psu1_vendor.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_model.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_version.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_date.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_sn.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vendor.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_model.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_version.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_date.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_sn.dev_attr.attr, + NULL +}; + +static const struct attribute_group psoc_group = { + .attrs = psoc_attributes, +}; + +/*-----------------------------------------------------------------------*/ + +/* device probe and removal */ + +static int +psoc_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct psoc_data *data; + int status; + + printk("+%s\n", __func__); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + return -EIO; + + data = kzalloc(sizeof(struct psoc_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->diag = 0; + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &psoc_group); + if (status) + goto exit_free; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &psoc_group); +exit_free: + i2c_set_clientdata(client, NULL); + kfree(data); + return status; +} + +static int psoc_remove(struct i2c_client *client) +{ + struct psoc_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &psoc_group); + i2c_set_clientdata(client, NULL); + kfree(data); + return 0; +} + +static const struct i2c_device_id psoc_ids[] = { + { "inv_psoc", 0, }, + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, psoc_ids); + +static struct i2c_driver psoc_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "inv_psoc", + }, + .probe = psoc_probe, + .remove = psoc_remove, + .id_table = psoc_ids, +}; + +/*-----------------------------------------------------------------------*/ + +/* module glue */ + +static int __init inv_psoc_init(void) +{ + return i2c_add_driver(&psoc_driver); +} + +static void __exit inv_psoc_exit(void) +{ + i2c_del_driver(&psoc_driver); +} + +MODULE_AUTHOR("eddie.lan "); +MODULE_DESCRIPTION("inv psoc driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_psoc_init); +module_exit(inv_psoc_exit); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_pthread.c b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_pthread.c new file mode 100644 index 000000000000..7d3287a591c6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_pthread.c @@ -0,0 +1,1312 @@ +/* + * 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. + */ + +/***************************** + Magnolia platform +******************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define SHOW_ATTR_WARNING ("N/A") +#define SHOW_ATTR_NOTPRINT ("Not Available") +#define SHOW_ATTR_NOTSUPPORT ("Not Support") + +#define INV_HWMID_MAX (10) +#define INV_HWMID_INIT (-1) + +/*access userspace data to kernel space*/ +#define ACC_R (0) +#define ACC_W (1) + +#define TINY_BUF_SIZE (8) +#define MAX_PATH_SIZE (64) +#define MIN_ACC_SIZE (32) +#define MAX_ACC_SIZE (256) + +/* + * LED definitions + */ +#define STATUS_LED_MODE_AUTO 0 +#define STATUS_LED_MODE_DIAG 1 +#define STATUS_LED_MODE_MANU 2 + +#define STATUS_LED_GRN0 10 // 0 - 000: off +#define STATUS_LED_GRN1 11 // 1 - 001: 0.5hz +#define STATUS_LED_GRN2 12 // 2 - 010: 1 hz +#define STATUS_LED_GRN3 13 // 3 - 011: 2 hz +#define STATUS_LED_GRN7 17 // 7 - 111: on +#define STATUS_LED_RED0 20 // 0 - 000: off +#define STATUS_LED_RED1 21 // 1 - 001: 0.5hz +#define STATUS_LED_RED2 22 // 2 - 010: 1 hz +#define STATUS_LED_RED3 23 // 3 - 011: 2 hz +#define STATUS_LED_RED7 27 // 7 - 111: on +#define STATUS_LED_INVALID 0 // Invalid + +ssize_t status_led_change(const char *path1, const char *tmp1, const char *path2, const char *tmp2); +ssize_t status_led_grn(const char *freq); +ssize_t status_led_red(const char *freq); +ssize_t status_led_diag_mode_enable(void); +ssize_t status_led_diag_mode_disable(void); +int status_led_check_color(void); +int status_led_check_diag_mode(void); + +#if 1 +/* For timestamps in SYSFS_LOG */ +#define SYSFS_LOG printk +#else +//#define SYSFS_LOG(fmt, args...) printk(KERN_WARNING "[SYSFS] %s/%d: " fmt, __func__, __LINE__, ##args) +#define SYSFS_LOG(fmt, args...) printk(KERN_WARNING "[p_thread] " fmt, ##args) +#endif + +#define INV_PTHREAD_KERNEL_MODULE (1) +#define SWITCH_HEALTH_LED_CHANGE_VIA_GPIO (1) + +/* inventec_class *********************************/ +static struct kobject *status_kobj; +static struct kset *status_kset; + + +static struct mutex rw_lock; + +static int hwm_psoc = INV_HWMID_INIT; +static int hwm_cpld = INV_HWMID_INIT; + +int get_hwm_psoc(void) +{ + return hwm_psoc; +} + +int get_hwm_cpld(void) +{ + return hwm_cpld; +} + +static ssize_t access_user_space(const char *name, int mode, char *buf, size_t len, loff_t offset) +{ + struct file *fp; + mm_segment_t fs; + loff_t pos = offset; + char *mark = NULL; + ssize_t vfs_ret = 0; + + if (mode == ACC_R) { + fp = filp_open(name, O_RDONLY, S_IRUGO); + if (IS_ERR(fp)) + return -ENODEV; + + fs = get_fs(); + set_fs(KERNEL_DS); + + vfs_ret = vfs_read(fp, buf, len, &pos); + + mark = strpbrk(buf, "\n"); + if (mark) + *mark = '\0'; + + filp_close(fp, NULL); + set_fs(fs); + } else if (mode == ACC_W) { + fp = filp_open(name, O_WRONLY, S_IWUSR | S_IRUGO); + if (IS_ERR(fp)) + return -ENODEV; + + fs = get_fs(); + set_fs(KERNEL_DS); + + vfs_ret = vfs_write(fp, buf, len, &pos); + filp_close(fp, NULL); + set_fs(fs); + } + + return vfs_ret; +} + +int inventec_strtol(const char *sbufp, char **endp, unsigned int base) +{ + char *endptr; + int value = simple_strtol(sbufp, &endptr, base); + if (value == 0 && sbufp == endptr) { + *endp = NULL; + return value; + } + *endp = (char*)1; + return value; +} + +int inventec_singlechar_to_int(const char c) +{ + if ((c >= '0') && (c <= '9')) { + return (c - '0'); + } + else + if ((c >= 'a') && (c <= 'f')) { + return (c - 'a' + 10); + } + else + if ((c >= 'A') && (c <= 'F')) { + return (c - 'A' + 10); + } + return -1; +} + +int inventec_store_input(char *inputp, int count) +{ + int i = 0; + while(inputp[i] != '\n' && inputp[i] != '\0' && i < count) { + i++; + } + inputp[i] = '\0'; + return strlen(inputp); +} + +#if 0 +/* + * Time stamps for kernel log on yocto + */ +#include + +void SYSFS_LOG(char *fmt, ...) +{ + char buf[80], ts[32]; + va_list args; + int hlen; + + inventec_tmstmp(&ts[0]); + hlen = sprintf(buf, "[SYSFS] %s ", ts); // Do not edit this line + + va_start(args, fmt); + vsprintf(&buf[hlen-1], fmt, args); + va_end(args); + printk(KERN_WARNING "[p_thread] %s\n", buf); +} +#endif + +ssize_t +inventec_show_attr(char *buf_p, const char *invdevp) +{ + int inv_len = MAX_ACC_SIZE; /* INV driver return max length */ + char tmp_buf[MAX_ACC_SIZE]; + char *str_negative = "-", *mark = NULL; + + /* [Step2] Get data by uaccess */ + memset(tmp_buf, 0, sizeof(tmp_buf)); + mutex_lock(&rw_lock); + if (access_user_space(invdevp, ACC_R, tmp_buf, inv_len, 0) < 0) { + /* u_access fail */ + mutex_unlock(&rw_lock); + return sprintf(buf_p, "%s\n", SHOW_ATTR_WARNING); + } + mutex_unlock(&rw_lock); + + /* [Step3] Check return value + * - Ex: When transceiver not plugged + * => SWPS return error code "-202" + * => Pic8 need return "NA" (assume) + */ + if (strcspn(tmp_buf, str_negative) == 0) { + /* error case: "-202" */ + return sprintf(buf_p, "%s\n", SHOW_ATTR_WARNING); + } + + /* OK case:*/ + mark = strpbrk(tmp_buf, "\n"); + if (mark) { *mark = '\0'; } + + return sprintf(buf_p, "%s\n", tmp_buf); +} + +ssize_t +inventec_store_attr(const char *buf_p, size_t count, const char *invdevp) +{ + ssize_t ret = 0; + + /* [Step2] Get data by uaccess */ + mutex_lock(&rw_lock); + if ((ret = access_user_space(invdevp, ACC_W, (char*)buf_p, count, 0)) < 0) { + /* u_access fail */ + mutex_unlock(&rw_lock); + return -EINVAL; + } + mutex_unlock(&rw_lock); + + /* OK case:*/ + return ret; +} + +int sysfs_detect_hwmon_index(void) +{ + char hwmon_buf[MAX_ACC_SIZE]; + char hwmon_path[MAX_PATH_SIZE]; + int hwid = 0; + + for (hwid = 0; + hwid < INV_HWMID_MAX && (hwm_psoc == INV_HWMID_INIT || hwm_cpld == INV_HWMID_INIT); + hwid++) { + memset(hwmon_buf, 0, sizeof(hwmon_buf)); + sprintf(hwmon_path, "/sys/class/hwmon/hwmon%d/device/name", hwid); + + inventec_show_attr(hwmon_buf, hwmon_path); + if (strncmp(hwmon_buf, "inv_psoc", 8) == 0) { + hwm_psoc = hwid; + } + else + if (strncmp(hwmon_buf, "inv_bmc", 7) == 0) { + hwm_psoc = hwid; + } + else + if (strncmp(hwmon_buf, "inv_cpld", 8) == 0) { + hwm_cpld = hwid; + } + } + if (hwid >= INV_HWMID_MAX) { + printk(KERN_ERR "[p_thread] detect hwmon index failed, psoc = %d, cpld = %d\n", hwm_psoc, hwm_cpld); + return -1; + } + printk(KERN_INFO "[p_thread] detect hwmon index success, psoc = %d, cpld = %d\n", hwm_psoc, hwm_cpld); + return 0; +} + +static int __init +inventec_class_init(void) +{ + mutex_init(&rw_lock); + +#ifdef INV_PTHREAD_KERNEL_MODULE + if (sysfs_detect_hwmon_index() < 0) { + return -1; + } +#endif + + printk(KERN_INFO "[p_thread] [%s/%d] Module initial success.\n",__func__,__LINE__); + + return 0; +} + +static void __exit +inventec_class_exit(void) +{ + printk(KERN_INFO "[p_thread] [%s/%d] Remove module.\n",__func__,__LINE__); +} + +/* fan device *************************************/ +#define FAN_DEV_PATH_STATE "/sys/class/hwmon/hwmon%d/device/fan_gpi" +#define FAN_DEV_PATH_FAN1_INPUT "/sys/class/hwmon/hwmon%d/device/fan1_input" +#define FAN_DEV_PATH_FAN2_INPUT "/sys/class/hwmon/hwmon%d/device/fan2_input" +#define FAN_DEV_PATH_FAN3_INPUT "/sys/class/hwmon/hwmon%d/device/fan3_input" +#define FAN_DEV_PATH_FAN4_INPUT "/sys/class/hwmon/hwmon%d/device/fan4_input" +#define FAN_DEV_PATH_FAN5_INPUT "/sys/class/hwmon/hwmon%d/device/fan5_input" +#define FAN_DEV_PATH_FAN6_INPUT "/sys/class/hwmon/hwmon%d/device/fan6_input" +#define FAN_DEV_PATH_FAN7_INPUT "/sys/class/hwmon/hwmon%d/device/fan7_input" +#define FAN_DEV_PATH_FAN8_INPUT "/sys/class/hwmon/hwmon%d/device/fan8_input" + +static char fan_dev_path_state[MAX_PATH_SIZE]; +static char fan_dev_path_fan1_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan2_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan3_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan4_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan5_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan6_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan7_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan8_input[MAX_PATH_SIZE]; + +void sysfs_fan_path_init(void) +{ + sprintf(&fan_dev_path_state[0], FAN_DEV_PATH_STATE, get_hwm_psoc()); + sprintf(&fan_dev_path_fan1_input[0],FAN_DEV_PATH_FAN1_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan2_input[0],FAN_DEV_PATH_FAN2_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan3_input[0],FAN_DEV_PATH_FAN3_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan4_input[0],FAN_DEV_PATH_FAN4_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan5_input[0],FAN_DEV_PATH_FAN5_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan6_input[0],FAN_DEV_PATH_FAN6_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan7_input[0],FAN_DEV_PATH_FAN7_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan8_input[0],FAN_DEV_PATH_FAN8_INPUT, get_hwm_psoc()); +} + +#define FAN_STATE_NORMAL "normal" +#define FAN_STATE_FAULTY "faulty" +#define FAN_STATE_UNINSTALLED "uninstalled" +#define FAN_STATE_UNKNOW "unknown state" +#define FAN_STATE_INVALID "Invalid state value" +#define FAN_STATE_READ_ERROR "state read error" + +#define FAN_LOG_UNINSTALLED "removed" +#define FAN_LOG_NORMAL "inserted" + +//#define FAN_STATE_BIT_NORMAL 0 +#define FAN_STATE_BIT_FAULTY 0 +#define FAN_STATE_BIT_UNINSTALLED 1 +#define FAN_STATE_BIT_UNKNOW 2 +#define FAN_STATE_BIT_INVALID 3 +#define FAN_STATE_BIT_READ_ERROR 4 + +static struct fans_tbl_s { + char *fan_name; + char *fan_front; + char *fan_rear; + unsigned int fan_state; +} fans_tbl[] = { + {"fan1", fan_dev_path_fan1_input, + fan_dev_path_fan2_input, 0}, + {"fan2", fan_dev_path_fan3_input, + fan_dev_path_fan4_input, 0}, + {"fan3", fan_dev_path_fan5_input, + fan_dev_path_fan6_input, 0}, + {"fan4", fan_dev_path_fan7_input, + fan_dev_path_fan8_input, 0}, +}; +#define FAN_TBL_TOTAL ( sizeof(fans_tbl)/ sizeof(const struct fans_tbl_s) ) + +#define FAN_STATE_CHECK(i,b) (fans_tbl[i].fan_state & (1< 0) + { + printk(KERN_ERR "[p_thread] All fans failed.\n"); + printk(KERN_ERR "[p_thread] System shutdown immediately in %d seconds.\n", cd_shutdown); + } + cd_shutdown -= 1; + } + return ret; +} + +/* End of faninfo_device */ + +static int __init +fan_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_fan_path_init(); +#endif + return 0; +} + + +static void __exit +fan_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove fan module.\n"); +} + +/* psu device *************************************/ +static unsigned int psu_voltin = 0; +#define PSU_VOLTIN_ACDC (70000) + +/* + * normal/unpower/uninstall/fault are PSU states output from driver level + * checkpsu/error are defined by sysfs + */ +#define PSU_STATE_VAL_NORMAL (0) +#define PSU_STATE_VAL_UNPOWER (2) +#define PSU_STATE_VAL_FAULT (4) +#define PSU_STATE_VAL_UNINSTALL (7) +#define PSU_STATE_VAL_CHECKPSU (8) +#define PSU_STATE_VAL_ERROR (9) + +#define PSU_STATE_NORMAL ("0 : normal") +#define PSU_STATE_UNPOWER ("2 : unpowered") +#define PSU_STATE_FAULT ("4 : fault") +#define PSU_STATE_UNINSTALL ("7 : not installed") +#define PSU_STATE_CHECKPSU ("8 : check psu") +#define PSU_STATE_ERROR ("9 : state error") + +#define PSU_STATE_LEN_NORMAL (strlen(PSU_STATE_NORMAL)) +#define PSU_STATE_LEN_UNPOWER (strlen(PSU_STATE_UNPOWER)) +#define PSU_STATE_LEN_FAULT (strlen(PSU_STATE_FAULT)) +#define PSU_STATE_LEN_UNINSTALL (strlen(PSU_STATE_UNINSTALL)) +#define PSU_STATE_LEN_CHECKPSU (strlen(PSU_STATE_CHECKPSU)) + +typedef struct { + char *inv_dev_attrp; + char *inv_dev_pathp; +} psu_dev_t; + +typedef struct { + const char *psu_name; + int psu_major; + dev_t psu_devt; + struct device *psu_dev_p; + psu_dev_t *psu_dev_namep; + int psu_dev_total; + char *psu_inv_pathp; + void *psu_tracking; + char *psu_currentin; + char *psu_currentout; + char *psu_powerin; + char *psu_powerout; + char *psu_voltin; + char *psu_voltout; +} psu_dev_group_t; + +#define PSU_DEV_PATH_TEMPLATE "/sys/class/hwmon/hwmon%d/device/%s" + +static char psu_dev_path_state[MAX_PATH_SIZE]; +static char psu_dev_path_psu_voltin[MAX_PATH_SIZE]; +#if 0 +static char psu_dev_path_vendor[MAX_PATH_SIZE]; +static char psu_dev_path_version[MAX_PATH_SIZE]; +static char psu_dev_path_sn[MAX_PATH_SIZE]; +static char psu_dev_path_temperature[MAX_PATH_SIZE]; +static char psu_dev_path_fan_speed[MAX_PATH_SIZE]; +static char psu_dev_path_fan_pwm[MAX_PATH_SIZE]; +static char psu_dev_path_fan_faulty[MAX_PATH_SIZE]; +static char psu_dev_path_psu_currentin[MAX_PATH_SIZE]; +static char psu_dev_path_psu_currentout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_powerin[MAX_PATH_SIZE]; +static char psu_dev_path_psu_powerout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_voltout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_pwm[MAX_PATH_SIZE]; +static char psu_dev_path_psu_rpm[MAX_PATH_SIZE]; +#endif + +void sysfs_psu_path_init(void) +{ + sprintf(&psu_dev_path_state[0], PSU_DEV_PATH_TEMPLATE, get_hwm_cpld(), "\%s" ); + sprintf(&psu_dev_path_psu_voltin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); +#if 0 + sprintf(&psu_dev_path_vendor[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_version[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_sn[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_temperature[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_speed[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_pwm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_faulty[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_currentin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_currentout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_powerin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_powerout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_voltout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_pwm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_rpm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); +#endif +} + +static psu_dev_t psu_dev_name[] = { + { "state", psu_dev_path_state }, // Using cpld + { "psu_voltin", psu_dev_path_psu_voltin }, +#if 0 + { "vendor", psu_dev_path_vendor }, + { "version", psu_dev_path_version }, + { "sn", psu_dev_path_sn }, + { "temperature", psu_dev_path_temperature }, + { "fan_speed", psu_dev_path_fan_speed }, + { "fan_pwm", psu_dev_path_fan_pwm }, + { "fan_faulty", psu_dev_path_fan_faulty }, + { "psu_currentin", psu_dev_path_psu_currentin }, + { "psu_currentout", psu_dev_path_psu_currentout }, + { "psu_powerin", psu_dev_path_psu_powerin }, + { "psu_powerout", psu_dev_path_psu_powerout }, + { "psu_voltout", psu_dev_path_psu_voltout }, + { "psu_pwm", psu_dev_path_psu_pwm }, + { "psu_rpm", psu_dev_path_psu_rpm }, +#endif +}; +#define PSU_DEV_NAME_TOTAL ( sizeof(psu_dev_name) / sizeof(const psu_dev_t) ) + +static psu_dev_group_t psu_dev_group[] = { + { + .psu_name = "psu1", + .psu_dev_namep = &psu_dev_name[0], + .psu_dev_total = sizeof(psu_dev_name) / sizeof(const psu_dev_t), + }, + { + .psu_name = "psu2", + .psu_dev_namep = &psu_dev_name[0], + .psu_dev_total = sizeof(psu_dev_name) / sizeof(const psu_dev_t), + }, +}; +#define PSU_DEV_GROUP_TOTAL ( sizeof(psu_dev_group)/ sizeof(const psu_dev_group_t) ) + +static char psu_state[4][MIN_ACC_SIZE]; + +static struct psu_wire_tbl_s { + char *psu_attr; + char *psu_name; + char *psu_wire; + char *psu_state; +} psu_wire_tbl[] = { + { "state", "psu1", "psu0", psu_state[0] }, // Using cpld + { "state", "psu2", "psu1", psu_state[1] }, + { "psu_voltin", "psu1", "psoc_psu1_vin", psu_state[2] }, + { "psu_voltin", "psu2", "psoc_psu2_vin", psu_state[3] }, +}; +#define PSU_WIRE_TBL_TOTAL ( sizeof(psu_wire_tbl)/ sizeof(const struct psu_wire_tbl_s) ) + +static char * +psu_attr_get_wirep(const char *psu_attrp, const char *psu_namep, char **psu_statepp) +{ + int i; + + for (i = 0; i < PSU_WIRE_TBL_TOTAL; i++) { + if (strncmp(psu_wire_tbl[i].psu_attr, psu_attrp, strlen(psu_attrp)) == 0 && + strncmp(psu_wire_tbl[i].psu_name, psu_namep, strlen(psu_namep)) == 0) { + if (psu_statepp) { + *psu_statepp = psu_wire_tbl[i].psu_state; + } + return psu_wire_tbl[i].psu_wire; + } + } + return NULL; +} + +int psu_check_state_normal(char *statep) +{ + if (strstr(statep, "normal")) { + return 1; + } + return 0; +} + +#define PSU_ATTR_VOLTIN ("psu_voltin") +#define PSU_ATTR_VOLTIN_LEN (10) + +/* Get PSU voltin for determon AC(110v) or DC(48v) */ +void psu_get_voltin(void) +{ + char acc_path[MAX_PATH_SIZE], volt[MIN_ACC_SIZE]; + psu_dev_t *devnamep; + unsigned int voltin; + char *invwirep; + int i, j; + + for (i = 0; i < PSU_DEV_GROUP_TOTAL; i++) { + //psu_dev_group[i].psu_name; + devnamep = psu_dev_group[i].psu_dev_namep; + for (j = 0; j < psu_dev_group[i].psu_dev_total; j++, devnamep++) { + if (strncmp(devnamep->inv_dev_attrp, PSU_ATTR_VOLTIN, PSU_ATTR_VOLTIN_LEN) == 0) { + invwirep = psu_attr_get_wirep(PSU_ATTR_VOLTIN, psu_dev_group[i].psu_name, NULL); + if (invwirep == NULL) { + printk(KERN_DEBUG "[p_thread] Invalid psuname: %s\n", psu_dev_group[i].psu_name); + continue; + } + sprintf(acc_path, devnamep->inv_dev_pathp, invwirep); + //printk(KERN_DEBUG "[p_thread] RYU: %s/%d: acc_path = %s\n",__func__,__LINE__,acc_path); + if (inventec_show_attr(volt, acc_path) <= 0) { + printk(KERN_DEBUG "[p_thread] Read %s failed\n", acc_path); + continue; + } + else { + voltin = simple_strtol(&volt[0], NULL, 10); + printk(KERN_DEBUG "[p_thread] Read %s %s = %u\n",acc_path,volt,voltin); + if (voltin > psu_voltin) { + psu_voltin = voltin; + } + } + } + } + } + + SYSFS_LOG("[p_thread] PSU voltin = %u\n", psu_voltin); +} + +#define PSU_ATTR_STATE ("state") +#define PSU_ATTR_STATE_LEN (5) + +/* psus_control() by inv_thread */ +int psus_control(int log_only) +{ + char acc_path[MAX_PATH_SIZE], state[MIN_ACC_SIZE]; + psu_dev_t *devnamep = NULL; + char *invwirep = NULL; + char *psu_statep = NULL; + int i, j, flag = 0; + + for (i = 0; i < PSU_DEV_GROUP_TOTAL; i++) { + devnamep = psu_dev_group[i].psu_dev_namep; + for (j = 0; j < psu_dev_group[i].psu_dev_total; j++, devnamep++) { + if (strncmp(devnamep->inv_dev_attrp, PSU_ATTR_STATE, PSU_ATTR_STATE_LEN) == 0) { + invwirep = psu_attr_get_wirep(PSU_ATTR_STATE, psu_dev_group[i].psu_name, &psu_statep); + if (invwirep == NULL) { + printk(KERN_DEBUG "[p_thread] Invalid psuname: %s\n", psu_dev_group[i].psu_name); + continue; + } + sprintf(acc_path, devnamep->inv_dev_pathp, invwirep); + //printk(KERN_INFO "[p_thread] RYU: %s/%d: acc_path = %s\n",__func__,__LINE__,acc_path); + if (inventec_show_attr(state, acc_path) <= 0) { + printk(KERN_DEBUG "[p_thread] Read %s failed\n", acc_path); + if (strncmp(psu_statep, PSU_STATE_ERROR, strlen(PSU_STATE_ERROR)) != 0) { + strcpy(psu_statep, PSU_STATE_ERROR); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,PSU_STATE_ERROR); + } + flag = 1; + } + else + if (strstr(state, "normal")) { + //printk(KERN_INFO "[p_thread] %s: %s\n", psu_dev_group[i].psu_name, state); + if (strncmp(psu_statep, state, strlen(state)) != 0) { + strcpy(psu_statep, state); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,state); + } + } + else + if (psu_voltin > PSU_VOLTIN_ACDC) { /* AC PSUS */ + //printk(KERN_INFO "[p_thread] RYU: %s: %s\n", psu_dev_group[i].psu_name, state); + if (strncmp(psu_statep, state, strlen(state)) != 0) { + strcpy(psu_statep, state); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,state); + } + flag = 1; + } + else { /* DC PSUS */ + if (strncmp(psu_statep, PSU_STATE_CHECKPSU, PSU_STATE_LEN_CHECKPSU) != 0) { + strcpy(psu_statep, PSU_STATE_CHECKPSU); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,PSU_STATE_CHECKPSU); + } + flag = 1; + } + } + } + } + + if (log_only) { + return 0; + } + + //SYSFS_LOG("[p_thread] RYU: %s: flag = %d\n",psu_wire_tbl[i].psu_name,flag); + if (flag == 1) { + status_led_grn("3"); + return 1; + } + return 0; +} + +/* End of psuinfo_device */ + +static int __init +psu_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_psu_path_init(); +#endif + return 0; +} + + +static void __exit +psu_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove psu module.\n"); +} + +/* led device *************************************/ +#define STATUS_LED_GRN_PATH "/sys/class/hwmon/hwmon%d/device/grn_led" +#define STATUS_LED_RED_PATH "/sys/class/hwmon/hwmon%d/device/red_led" + +#define FAN_LED_GRN1_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn1" +#define FAN_LED_GRN2_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn2" +#define FAN_LED_GRN3_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn3" +#define FAN_LED_GRN4_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn4" +#define FAN_LED_RED1_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red1" +#define FAN_LED_RED2_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red2" +#define FAN_LED_RED3_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red3" +#define FAN_LED_RED4_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red4" + +#define HWMON_DEVICE_DIAG_PATH "/sys/class/hwmon/hwmon%d/device/diag" +#define HWMON_DEVICE_CTRL_PATH "/sys/class/hwmon/hwmon%d/device/ctl" + +static char status_led_grn_path[MAX_PATH_SIZE]; +static char status_led_red_path[MAX_PATH_SIZE]; +static char fan_led_grn1_path[MAX_PATH_SIZE]; +static char fan_led_grn2_path[MAX_PATH_SIZE]; +static char fan_led_grn3_path[MAX_PATH_SIZE]; +static char fan_led_grn4_path[MAX_PATH_SIZE]; +static char fan_led_red1_path[MAX_PATH_SIZE]; +static char fan_led_red2_path[MAX_PATH_SIZE]; +static char fan_led_red3_path[MAX_PATH_SIZE]; +static char fan_led_red4_path[MAX_PATH_SIZE]; +static char hwmon_device_diag_path[MAX_PATH_SIZE]; +static char hwmon_device_ctrl_path[MAX_PATH_SIZE]; + +void sysfs_led_path_init(void) +{ + sprintf(&status_led_grn_path[0], STATUS_LED_GRN_PATH, get_hwm_cpld()); + sprintf(&status_led_red_path[0], STATUS_LED_RED_PATH, get_hwm_cpld()); + sprintf(&fan_led_grn1_path[0], FAN_LED_GRN1_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn2_path[0], FAN_LED_GRN2_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn3_path[0], FAN_LED_GRN3_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn4_path[0], FAN_LED_GRN4_PATH, get_hwm_psoc()); + sprintf(&fan_led_red1_path[0], FAN_LED_RED1_PATH, get_hwm_psoc()); + sprintf(&fan_led_red2_path[0], FAN_LED_RED2_PATH, get_hwm_psoc()); + sprintf(&fan_led_red3_path[0], FAN_LED_RED3_PATH, get_hwm_psoc()); + sprintf(&fan_led_red4_path[0], FAN_LED_RED4_PATH, get_hwm_psoc()); + sprintf(&hwmon_device_diag_path[0], HWMON_DEVICE_DIAG_PATH, get_hwm_psoc()); + sprintf(&hwmon_device_ctrl_path[0], HWMON_DEVICE_CTRL_PATH, get_hwm_cpld()); +} + +/* return 0/off 1/green 2/red */ +int +status_led_check_color(void) +{ + char tmpbuf[MIN_ACC_SIZE]; + int ret = STATUS_LED_INVALID; + + if (inventec_show_attr(&tmpbuf[0], status_led_grn_path) > 0) { + if (tmpbuf[0] == '0') { + ret = STATUS_LED_GRN0; + } + if (tmpbuf[0] == '1') { + ret = STATUS_LED_GRN1; + } + if (tmpbuf[0] == '2') { + ret = STATUS_LED_GRN2; + } + if (tmpbuf[0] == '3') { + ret = STATUS_LED_GRN3; + } + if (tmpbuf[0] == '7') { + ret = STATUS_LED_GRN7; + } + return ret; + } + + if (inventec_show_attr(&tmpbuf[0], status_led_red_path) > 0) { + if (tmpbuf[0] == '0') { + ret = STATUS_LED_RED0; + } + if (tmpbuf[0] == '1') { + ret = STATUS_LED_RED1; + } + if (tmpbuf[0] == '2') { + ret = STATUS_LED_RED2; + } + if (tmpbuf[0] == '3') { + ret = STATUS_LED_RED3; + } + if (tmpbuf[0] == '7') { + ret = STATUS_LED_RED7; + } + return ret; + } + return ret; +} + +/* + * Store attr Section + */ +static DEFINE_MUTEX(diag_mutex); + +ssize_t status_led_diag_mode_enable(void) +{ + char tmp[MIN_ACC_SIZE]; + ssize_t ret; + + ret = inventec_show_attr(&tmp[0], hwmon_device_diag_path); + if (ret <= 0) { + return ret; + } + + if (tmp[0] == '0') { + mutex_lock(&diag_mutex); + ret = inventec_store_attr("1", 1, hwmon_device_diag_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return ret; + } + + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return ret; + } + mutex_unlock(&diag_mutex); + } + + return ret; +} + +ssize_t status_led_diag_mode_disable(void) +{ + char tmp[MIN_ACC_SIZE]; + ssize_t ret; + + ret = inventec_show_attr(&tmp[0], hwmon_device_diag_path); + if (ret <= 0) { + return ret; + } + + if (tmp[0] == '1') { + mutex_lock(&diag_mutex); + ret = inventec_store_attr("0", 1, hwmon_device_diag_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return 1; + } + + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return 1; + } + mutex_unlock(&diag_mutex); + } + return 1; +} + +ssize_t +status_led_change(const char *path1, const char *tmp1, const char *path2, const char *tmp2) +{ + ssize_t ret; + + ret = inventec_store_attr(tmp1, strlen(tmp1), path1); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(tmp2, strlen(tmp2), path2); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_led_red(const char *freq) +{ + ssize_t ret; + + ret = inventec_store_attr("0", 1, &status_led_grn_path[0]); + + if (ret < 0) { + return ret; + } + + ret = inventec_store_attr(freq, strlen(freq), &status_led_red_path[0]); + + if (ret < 0) { + return ret; + } + + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_led_grn(const char *freq) +{ + ssize_t ret; + + ret = inventec_store_attr("0", 1, &status_led_red_path[0]); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(freq, strlen(freq), &status_led_grn_path[0]); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +static int status_led_diag_mode = STATUS_LED_MODE_AUTO; + +int status_led_check_diag_mode(void) +{ + return status_led_diag_mode; +} + +/* End of ledinfo_device */ + +static int __init +led_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_led_path_init(); +#endif + return 0; +} + + +static void __exit +led_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove led module.\n"); +} + +/* sensor device **********************************/ +#define SENSOR_DEV_PATH_SWITCH_TEMP "/sys/class/hwmon/hwmon%d/device/switch_tmp" + +static char sensor_dev_path_switch_temp[MAX_PATH_SIZE]; + +void sysfs_sensor_path_init(void) +{ + sprintf(&sensor_dev_path_switch_temp[0], SENSOR_DEV_PATH_SWITCH_TEMP, get_hwm_psoc()); +} + +void switch_temp_update(void) +{ + char buf[MIN_ACC_SIZE]; + ssize_t count = inventec_show_attr(&buf[0], "proc/switch/temp"); + if (count > 0) { + //printk(KERN_ERR "[p_thread] [STEMP] Switch temperature is out of range: %d\n", stemp); + inventec_store_attr(&buf[0], count, sensor_dev_path_switch_temp); + } +} + +/**************************************************/ +/* From system_device */ +static int inv_pthread_control = 1; + +int thread_control(void) +{ + return inv_pthread_control; +} + +void thread_control_set(int val) +{ + inv_pthread_control = val; +} +/* End system_device */ + +#define THREAD_SLEEP_MINS (3) +#define THREAD_DELAY_MINS (THREAD_SLEEP_MINS + THREAD_SLEEP_MINS + 1) + +extern void psu_get_voltin(void); + +static struct task_struct *thread_st; +static int thread_data; + +#ifdef SWITCH_HEALTH_LED_CHANGE_VIA_GPIO +void led_set_gpio_to_change_status_led(void) +{ + ssize_t ret = inventec_store_attr("253", 3, "/sys/class/gpio/export"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 253 to /sys/class/gpio/export failed\n"); + return; + } + + printk("[p_thread] Write 253 to /sys/class/gpio/export\n"); + + ret = inventec_store_attr("out", 3, "/sys/class/gpio/gpio253/direction"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write low to /sys/class/gpio/gpio253/direction failed\n"); + return; + } + + //pull high and then low + ret = inventec_store_attr("1", 1, "sys/class/gpio/gpio253/value"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 1 to sys/class/gpio/gpio253/value failed\n"); + } + + //pull low + ret = inventec_store_attr("0", 1, "sys/class/gpio/gpio253/value"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 0 to sys/class/gpio/gpio253/value failed\n"); + } + + SYSFS_LOG("[p_thread] Set gpio to support status led change successfully\n"); +} +#endif + +// Function executed by kernel thread +static int thread_fn(void *unused) +{ + /* Delay for guarantee HW ready */ + ssleep(THREAD_DELAY_MINS); + +#ifndef INV_PTHREAD_KERNEL_MODULE + sysfs_led_path_init(); + sysfs_fan_path_init(); + sysfs_psu_path_init(); +#endif + //sysfs_sensor_path_init(); + + /* Default status init */ + status_led_grn("7"); + + psu_get_voltin(); + +#ifdef SWITCH_HEALTH_LED_CHANGE_VIA_GPIO + led_set_gpio_to_change_status_led(); +#endif + + while (1) + { + ssleep(THREAD_SLEEP_MINS); + + if (thread_control() == 0) { + printk(KERN_INFO "[p_thread] %s/%d: Thread Stop by inv_pthread control\n",__func__,__LINE__); + break; + } + + if (status_led_check_diag_mode() == STATUS_LED_MODE_MANU) { + /* status led in change color/freq mode, higher priority. Ignore fans sttaus */ + continue; + } + + //switch_temp_update(); + + if (fans_control() > 0) { + psus_control(1); + continue; + } + else + if (psus_control(0) > 0) { + continue; + } + + if (status_led_check_color() != STATUS_LED_GRN7) { /* status led red, change it to green */ + status_led_grn("7"); + } + } + +#ifndef INV_PTHREAD_KERNEL_MODULE +err_inv_pthread_fn_1: +#endif + do_exit(0); + printk(KERN_INFO "[p_thread] %s/%d: Thread Stopped\n",__func__,__LINE__); + return 0; +} + + +static ssize_t s_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + int fan_absence; + size_t count; + + fan_absence = fans_control(); + count += sprintf(&buf[count], "%d\n", fan_absence); + return count; +} + +static ssize_t s_store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) +{ + return count; +} + +static struct attribute status_att = { + .name = "fan_absence", + .mode = 0777, +}; + +static const struct sysfs_ops status_ops = { + .show = s_show, + .store = s_store, +}; + +static struct kobj_type status_ktype = { + .sysfs_ops = &status_ops, +}; + + +static int __init inv_pthread_init(void) +{ + int retval; + + status_kobj = kzalloc(sizeof(*status_kobj), GFP_KERNEL); + if(!status_kobj) + return PTR_ERR(status_kobj); + + status_kset = kset_create_and_add("platform_status", NULL, kernel_kobj); + if(!status_kset) + return -1; + + status_kobj->kset = status_kset; + + retval = kobject_init_and_add(status_kobj, &status_ktype, NULL, "fan"); + if(retval) + return retval; + + retval = sysfs_create_file(status_kobj, &status_att); + + + inventec_class_init(); + fan_device_init(); + psu_device_init(); + led_device_init(); + + thread_control_set(1); + + printk(KERN_INFO "[p_thread] %s/%d: Creating Thread\n",__func__,__LINE__); + //Create the kernel thread with name 'inv_pthread' + thread_st = kthread_run(thread_fn, (void*)&thread_data, "inv_pthread"); + if (thread_st) + printk(KERN_INFO "[p_thread] inv_pthread Created successfully\n"); + else + printk(KERN_ERR "[p_thread] inv_pthread creation failed\n"); + + return retval; +} + +static void __exit inv_pthread_exit(void) +{ + thread_control_set(0); + /* Delay for guarantee thread exit */ + ssleep(THREAD_DELAY_MINS); + + fan_device_exit(); + psu_device_exit(); + led_device_exit(); + inventec_class_exit(); + + sysfs_remove_file(status_kobj, &status_att); + kset_unregister(status_kset); + kobject_del(status_kobj); + + printk(KERN_INFO "[p_thread] inv_pthread cleaning Up\n"); +} + +module_init(inv_pthread_init); +module_exit(inv_pthread_exit); + +MODULE_AUTHOR("Robert "); +MODULE_DESCRIPTION("Inventec Platform Management Thread"); +MODULE_VERSION("version 1.0"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_swps.c b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_swps.c new file mode 100644 index 000000000000..eff030df0a8a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_swps.c @@ -0,0 +1,3027 @@ +/* + * 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 "inv_swps.h" + +static int ctl_major; +static int port_major; +static int ioexp_total; +static int port_total; +static int auto_config; +static int flag_i2c_reset; +static int flag_mod_state; +static unsigned gpio_rest_mux; +static struct class *swp_class_p = NULL; +static struct inv_platform_s *platform_p = NULL; +static struct inv_ioexp_layout_s *ioexp_layout = NULL; +static struct inv_port_layout_s *port_layout = NULL; + +static void swp_polling_worker(struct work_struct *work); +static DECLARE_DELAYED_WORK(swp_polling, swp_polling_worker); + +static int reset_i2c_topology(void); + + +static int +__swp_match(struct device *dev, +#ifdef SWPS_KERN_VER_AF_3_10 + + const void *data){ +#else + void *data){ +#endif + + char *name = (char *)data; + if (strcmp(dev_name(dev), name) == 0) + return 1; + return 0; +} + + +struct device * +get_swpdev_by_name(char *name){ + struct device *dev = class_find_device(swp_class_p, + NULL, + name, + __swp_match); + return dev; +} + + +static int +sscanf_2_int(const char *buf) { + + int result = -EBFONT; + char *hex_tag = "0x"; + + if (strcspn(buf, hex_tag) == 0) { + if (sscanf(buf,"%x",&result)) { + return result; + } + } else { + if (sscanf(buf,"%d",&result)) { + return result; + } + if(sscanf(buf,"-%d",&result)) { + return -result; + } + if (sscanf(buf,"%x",&result)) { + return result; + } + } + return -EBFONT; +} + + +static int +sscanf_2_binary(const char *buf) { + + int result = sscanf_2_int(buf); + + if (result < 0){ + return -EBFONT; + } + switch (result) { + case 0: + case 1: + return result; + default: + break; + } + return -EBFONT; +} + + +static int +_get_polling_period(void) { + + int retval = 0; + + if (SWP_POLLING_PERIOD == 0) { + return 0; + } + retval = ((SWP_POLLING_PERIOD * HZ) / 1000); + if (retval == 0) { + return 1; + } + return retval; +} + + +static struct transvr_obj_s * +_get_transvr_obj(char *dev_name) { + + struct device *dev_p = NULL; + struct transvr_obj_s *transvr_obj_p = NULL; + + dev_p = get_swpdev_by_name(dev_name); + if (!dev_p){ + return NULL; + } + transvr_obj_p = dev_get_drvdata(dev_p); + if (!transvr_obj_p){ + return NULL; + } + return transvr_obj_p; +} + + +static void +unlock_tobj_all(void) { + + struct transvr_obj_s *tobj_p; + char port_name[32]; + int port_id = 0; + int minor_curr = 0; + + for (minor_curr=0; minor_currauto_config = auto_config; + unlock_transvr_obj(tobj_p); + SWPS_DEBUG("%s: Set %s auto_config=%d\n", + __func__, tobj_p->swp_name, auto_config); + } + return retval; +} + + +/* ========== R/W Functions module control attribute ========== + */ +static ssize_t +show_attr_platform(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + return snprintf(buf_p, 32, "%s\n", platform_p->name); +} + + +static ssize_t +show_attr_version(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + return snprintf(buf_p, 8, "%s\n", SWP_VERSION); +} + + +static ssize_t +show_attr_status(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + return snprintf(buf_p, 8, "%d\n", flag_mod_state); +} + + +static ssize_t +show_attr_auto_config(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + return snprintf(buf_p, 8, "%d\n", auto_config); +} + + +static int +_check_reset_pwd(const char *buf_p, + size_t count) { + + int in_max = 64; + int in_len = (int)count; + char in_val[64] = "ERR"; + char *emsg = "ERR"; + + if (in_len >= in_max) { + emsg = "input too much"; + goto err_check_reset_pwd; + } + if (!sscanf(buf_p,"%s",in_val)) { + emsg = "format incorrect"; + goto err_check_reset_pwd; + } + if (strcmp(in_val, SWP_RESET_PWD) != 0) { + emsg = "password incorrect"; + goto err_check_reset_pwd; + } + return 0; + +err_check_reset_pwd: + SWPS_ERR("%s: %s\n", __func__, emsg); + return -1; +} + + +static ssize_t +store_attr_reset_i2c(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + if (_check_reset_pwd(buf_p, count) < 0) { + return -EBFONT; + } + /* Polling mode */ + if (SWP_POLLING_ENABLE) { + SWPS_INFO("%s: reset I2C :polling\n", __func__); + flag_i2c_reset = 1; + return count; + } + /* Direct mode */ + SWPS_INFO("%s: reset I2C go. :direct\n", __func__); + if (reset_i2c_topology() < 0) { + SWPS_ERR("%s: reset fail!\n", __func__); + return -EIO; + } + SWPS_INFO("%s: reset I2C ok. :direct\n", __func__); + return count; +} + + +static ssize_t +store_attr_reset_swps(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p; + char port_name[32] = "ERR"; + int port_id = 0; + int minor_curr = 0; + + if (_check_reset_pwd(buf_p, count) < 0) { + return -EBFONT; + } + for (minor_curr=0; minor_currstate = STATE_TRANSVR_DISCONNECTED; + unlock_transvr_obj(tobj_p); + SWPS_INFO("%s: reset:%s\n", __func__, tobj_p->swp_name); + } + return count; +} + + +static ssize_t +store_attr_auto_config(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + int input_val = sscanf_2_int(buf_p); + + if (input_val < 0){ + return -EBFONT; + } + if ((input_val != 0) && (input_val != 1)) { + return -EBFONT; + } + auto_config = input_val; + _update_auto_config_2_trnasvr(); + return count; +} + + +/* ========== Show functions: For transceiver attribute ========== + */ +static ssize_t +_show_transvr_hex_attr(struct transvr_obj_s* tobj_p, + int (*get_func)(struct transvr_obj_s* tobj_p), + char *buf_p) { + size_t len; + int result; + + lock_transvr_obj(tobj_p); + result = get_func(tobj_p); + unlock_transvr_obj(tobj_p); + if (result < 0){ + len = snprintf(buf_p, 8, "%d\n", result); + } else { + len = snprintf(buf_p, 8, "0x%02x\n", result); + } + return len; +} + + +static ssize_t +_show_transvr_int_attr(struct transvr_obj_s* tobj_p, + int (*get_func)(struct transvr_obj_s* tobj_p), + char *buf_p) { + size_t len; + + lock_transvr_obj(tobj_p); + len = snprintf(buf_p, 16, "%d\n", get_func(tobj_p)); + unlock_transvr_obj(tobj_p); + return len; +} + + +static ssize_t +_show_transvr_str_attr(struct transvr_obj_s* tobj_p, + int (*get_func)(struct transvr_obj_s* tobj_p, char* buf), + char *buf_p) { + size_t len; + + lock_transvr_obj(tobj_p); + len = get_func(tobj_p, buf_p); + unlock_transvr_obj(tobj_p); + return len; +} + + +static ssize_t +show_attr_id(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_id, + buf_p); +} + + +static ssize_t +show_attr_ext_id(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_ext_id, + buf_p); +} + + +static ssize_t +show_attr_connector(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_connector, + buf_p); +} + + +static ssize_t +show_attr_vendor_name(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_vendor_name, + buf_p); +} + + +static ssize_t +show_attr_vendor_pn(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_vendor_pn, + buf_p); +} + + +static ssize_t +show_attr_vendor_rev(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_vendor_rev, + buf_p); +} + + +static ssize_t +show_attr_vendor_sn(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_vendor_sn, + buf_p); +} + + +static ssize_t +show_attr_power_cls(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + size_t len; + int result; + struct transvr_obj_s *tobj_p; + + tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + lock_transvr_obj(tobj_p); + result = tobj_p->get_power_cls(tobj_p); + unlock_transvr_obj(tobj_p); + if (result < 0){ + len = snprintf(buf_p, 16, "%d\n", result); + } else { + len = snprintf(buf_p, 16, "Power Class %d\n", result); + } + return len; +} + + +static ssize_t +show_attr_br(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_br, + buf_p); +} + + +static ssize_t +show_attr_len_sm(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_sm, + buf_p); +} + + +static ssize_t +show_attr_len_smf(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_smf, + buf_p); +} + + +static ssize_t +show_attr_len_om1(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_om1, + buf_p); +} + + +static ssize_t +show_attr_len_om2(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_om2, + buf_p); +} + + +static ssize_t +show_attr_len_om3(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_om3, + buf_p); +} + + +static ssize_t +show_attr_len_om4(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_om4, + buf_p); +} + + +static ssize_t +show_attr_comp_rev(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_comp_rev, + buf_p); +} + + +static ssize_t +show_attr_comp_eth(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_comp_eth_1, + buf_p); +} + + +static ssize_t +show_attr_comp_eth_10(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_comp_eth_10, + buf_p); +} + + +static ssize_t +show_attr_comp_eth_10_40(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_comp_eth_10_40, + buf_p); +} + + +static ssize_t +show_attr_comp_extend(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_comp_extend, + buf_p); +} + + +static ssize_t +show_attr_rate_id(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_rate_id, + buf_p); +} + + +static ssize_t +show_attr_temperature(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_curr_temp, + buf_p); +} + + +static ssize_t +show_attr_voltage(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_curr_vol, + buf_p); +} + + +static ssize_t +show_attr_tx_bias(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_tx_bias, + buf_p); +} + + +static ssize_t +show_attr_tx_power(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_tx_power, + buf_p); +} + + +static ssize_t +show_attr_tx_eq(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_tx_eq, + buf_p); +} + + +static ssize_t +show_attr_rx_power(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_rx_power, + buf_p); +} + + +static ssize_t +show_attr_rx_am(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_rx_am, + buf_p); +} + + +static ssize_t +show_attr_rx_em(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_rx_em, + buf_p); +} + + +static ssize_t +show_attr_wavelength(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_wavelength, + buf_p); +} + + +static ssize_t +show_attr_extphy_offset(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_extphy_offset, + buf_p); +} + + +static ssize_t +show_attr_extphy_reg(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_extphy_reg, + buf_p); +} + + +static ssize_t +show_attr_info(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_info, + buf_p); +} + + +static ssize_t +show_attr_if_type(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_if_type, + buf_p); +} + + +static ssize_t +show_attr_if_speed(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_if_speed, + buf_p); +} + + +static ssize_t +show_attr_if_lane(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_if_lane, + buf_p); +} + + +static ssize_t +show_attr_cdr(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_cdr, + buf_p); +} + + +static ssize_t +show_attr_soft_rs0(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_soft_rs0, + buf_p); +} + + +static ssize_t +show_attr_soft_rs1(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_soft_rs1, + buf_p); +} + + +static ssize_t +show_attr_soft_rx_los(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_soft_rx_los, + buf_p); +} + + +static ssize_t +show_attr_soft_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_soft_tx_disable, + buf_p); +} + + +static ssize_t +show_attr_soft_tx_fault(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_soft_tx_fault, + buf_p); +} + + +static ssize_t +show_attr_auto_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_auto_tx_disable, + buf_p); +} + + +/* ========== Store functions: transceiver (R/W) attribute ========== + */ +static ssize_t +_store_transvr_int_attr(struct transvr_obj_s* tobj_p, + int (*set_func)(struct transvr_obj_s *tobj_p, int input_val), + const char *buf_p, + size_t count) { + int input, err; + + input = sscanf_2_int(buf_p); + if (input < 0){ + return -EBFONT; + } + lock_transvr_obj(tobj_p); + err = set_func(tobj_p, input); + unlock_transvr_obj(tobj_p); + if (err < 0){ + return err; + } + return count; +} + + +static ssize_t +_store_transvr_byte_hex_attr(struct transvr_obj_s* tobj_p, + int (*set_func)(struct transvr_obj_s *tobj_p, int input_val), + const char *buf_p, + size_t count) { + int input, err; + + input = sscanf_2_int(buf_p); + if ((input < 0) || (input > 0xff)){ + return -EBFONT; + } + lock_transvr_obj(tobj_p); + err = set_func(tobj_p, input); + unlock_transvr_obj(tobj_p); + if (err < 0){ + return err; + } + return count; +} + + +static ssize_t +_store_transvr_binary_attr(struct transvr_obj_s* tobj_p, + int (*set_func)(struct transvr_obj_s *tobj_p, int input_val), + const char *buf_p, + size_t count) { + int input, err; + + input = sscanf_2_binary(buf_p); + if (input < 0){ + return -EBFONT; + } + lock_transvr_obj(tobj_p); + err = set_func(tobj_p, input); + unlock_transvr_obj(tobj_p); + if (err < 0){ + return err; + } + return count; +} + + +static ssize_t +store_attr_cdr(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_byte_hex_attr(tobj_p, + tobj_p->set_cdr, + buf_p, + count); +} + + +static ssize_t +store_attr_soft_rs0(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_binary_attr(tobj_p, + tobj_p->set_soft_rs0, + buf_p, + count); +} + + +static ssize_t +store_attr_soft_rs1(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_binary_attr(tobj_p, + tobj_p->set_soft_rs1, + buf_p, + count); +} + + +static ssize_t +store_attr_soft_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count) { + + int check = sscanf_2_int(buf_p); + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + if ((check < 0) || (check > 0xf)){ + return -EBFONT; + } + return _store_transvr_byte_hex_attr(tobj_p, + tobj_p->set_soft_tx_disable, + buf_p, + count); +} + + +static ssize_t +store_attr_auto_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count) { + + int err = -EPERM; + int input = sscanf_2_int(buf_p); + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + if ((input < 0) || (input > 0xf)){ + if (input != VAL_TRANSVR_FUNCTION_DISABLE) { + return -EBFONT; + } + } + lock_transvr_obj(tobj_p); + err = tobj_p->set_auto_tx_disable(tobj_p, input); + unlock_transvr_obj(tobj_p); + if (err < 0){ + return err; + } + return count; +} + + +static ssize_t +store_attr_tx_eq(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_int_attr(tobj_p, + tobj_p->set_tx_eq, + buf_p, + count); +} + + +static ssize_t +store_attr_rx_am(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_int_attr(tobj_p, + tobj_p->set_rx_am, + buf_p, + count); +} + + +static ssize_t +store_attr_rx_em(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_int_attr(tobj_p, + tobj_p->set_rx_em, + buf_p, + count); +} + + +static ssize_t +store_attr_extphy_offset(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_int_attr(tobj_p, + tobj_p->set_extphy_offset, + buf_p, + count); +} + + +static ssize_t +store_attr_extphy_reg(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_int_attr(tobj_p, + tobj_p->set_extphy_reg, + buf_p, + count); +} + +/* ========== Show functions: For I/O Expander attribute ========== + */ +static ssize_t +_show_ioexp_binary_attr(struct transvr_obj_s *tobj_p, + int (*get_func)(struct ioexp_obj_s *ioexp_p, int voffset), + char *buf_p) { + size_t len; + struct ioexp_obj_s *ioexp_p = tobj_p->ioexp_obj_p; + + if (!ioexp_p) { + SWPS_ERR(" %s: data corruption! :%s\n", __func__, tobj_p->swp_name); + return -ENODATA; + } + mutex_lock(&ioexp_p->lock); + len = snprintf(buf_p, 8, "%d\n", get_func(ioexp_p, tobj_p->ioexp_virt_offset)); + mutex_unlock(&ioexp_p->lock); + return len; +} + + +static ssize_t +show_attr_present(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_present, + buf_p); +} + + +static ssize_t +show_attr_tx_fault(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_tx_fault, + buf_p); +} + + +static ssize_t +show_attr_rxlos(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_rxlos, + buf_p); +} + + +static ssize_t +show_attr_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_tx_disable, + buf_p); +} + + +static ssize_t +show_attr_reset(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_reset, + buf_p); +} + + +static ssize_t +show_attr_lpmod(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_lpmod, + buf_p); +} + + +static ssize_t +show_attr_modsel(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_modsel, + buf_p); +} + + +static ssize_t +show_attr_hard_rs0(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_hard_rs0, + buf_p); +} + + +static ssize_t +show_attr_hard_rs1(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_hard_rs1, + buf_p); +} + + +/* ========== Store functions: For I/O Expander (R/W) attribute ========== + */ +static ssize_t +_store_ioexp_binary_attr(struct transvr_obj_s *tobj_p, + int (*set_func)(struct ioexp_obj_s *ioexp_p, + int virt_offset, int input_val), + const char *buf_p, + size_t count) { + + int input, err; + struct ioexp_obj_s *ioexp_p = tobj_p->ioexp_obj_p; + + if (!ioexp_p) { + SWPS_ERR("%s: data corruption! :%s\n", + __func__, tobj_p->swp_name); + return -ENODATA; + } + input = sscanf_2_binary(buf_p); + if (input < 0) { + return -EBFONT; + } + mutex_lock(&ioexp_p->lock); + err = set_func(ioexp_p, tobj_p->ioexp_virt_offset, input); + mutex_unlock(&ioexp_p->lock); + if (err < 0){ + return err; + } + return count; +} + +static ssize_t +store_attr_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_tx_disable, + buf_p, + count); +} + + +static ssize_t +store_attr_reset(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_reset, + buf_p, + count); +} + + +static ssize_t +store_attr_lpmod(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_lpmod, + buf_p, + count); +} + + +static ssize_t +store_attr_modsel(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_modsel, + buf_p, + count); +} + + +static ssize_t +store_attr_hard_rs0(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_hard_rs0, + buf_p, + count); +} + + +static ssize_t +store_attr_hard_rs1(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_hard_rs1, + buf_p, + count); +} + + +/* ========== SWPS attribute: For module control ========== + */ +static DEVICE_ATTR(platform, S_IRUGO, show_attr_platform, NULL); +static DEVICE_ATTR(version, S_IRUGO, show_attr_version, NULL); +static DEVICE_ATTR(status, S_IRUGO, show_attr_status, NULL); +static DEVICE_ATTR(reset_i2c, S_IWUSR, NULL, store_attr_reset_i2c); +static DEVICE_ATTR(reset_swps, S_IWUSR, NULL, store_attr_reset_swps); +static DEVICE_ATTR(auto_config, S_IRUGO|S_IWUSR, show_attr_auto_config, store_attr_auto_config); + +/* ========== Transceiver attribute: from eeprom ========== + */ +static DEVICE_ATTR(id, S_IRUGO, show_attr_id, NULL); +static DEVICE_ATTR(ext_id, S_IRUGO, show_attr_ext_id, NULL); +static DEVICE_ATTR(connector, S_IRUGO, show_attr_connector, NULL); +static DEVICE_ATTR(vendor_name, S_IRUGO, show_attr_vendor_name, NULL); +static DEVICE_ATTR(vendor_pn, S_IRUGO, show_attr_vendor_pn, NULL); +static DEVICE_ATTR(vendor_rev, S_IRUGO, show_attr_vendor_rev, NULL); +static DEVICE_ATTR(vendor_sn, S_IRUGO, show_attr_vendor_sn, NULL); +static DEVICE_ATTR(power_cls, S_IRUGO, show_attr_power_cls, NULL); +static DEVICE_ATTR(br, S_IRUGO, show_attr_br, NULL); +static DEVICE_ATTR(len_sm, S_IRUGO, show_attr_len_sm, NULL); +static DEVICE_ATTR(len_smf, S_IRUGO, show_attr_len_smf, NULL); +static DEVICE_ATTR(len_om1, S_IRUGO, show_attr_len_om1, NULL); +static DEVICE_ATTR(len_om2, S_IRUGO, show_attr_len_om2, NULL); +static DEVICE_ATTR(len_om3, S_IRUGO, show_attr_len_om3, NULL); +static DEVICE_ATTR(len_om4, S_IRUGO, show_attr_len_om4, NULL); +static DEVICE_ATTR(comp_rev, S_IRUGO, show_attr_comp_rev, NULL); +static DEVICE_ATTR(comp_eth, S_IRUGO, show_attr_comp_eth, NULL); +static DEVICE_ATTR(comp_eth_10, S_IRUGO, show_attr_comp_eth_10, NULL); +static DEVICE_ATTR(comp_eth_10_40, S_IRUGO, show_attr_comp_eth_10_40, NULL); +static DEVICE_ATTR(comp_extend, S_IRUGO, show_attr_comp_extend, NULL); +static DEVICE_ATTR(rate_id, S_IRUGO, show_attr_rate_id, NULL); +static DEVICE_ATTR(temperature, S_IRUGO, show_attr_temperature, NULL); +static DEVICE_ATTR(voltage, S_IRUGO, show_attr_voltage, NULL); +static DEVICE_ATTR(tx_bias, S_IRUGO, show_attr_tx_bias, NULL); +static DEVICE_ATTR(tx_power, S_IRUGO, show_attr_tx_power, NULL); +static DEVICE_ATTR(rx_power, S_IRUGO, show_attr_rx_power, NULL); +static DEVICE_ATTR(info, S_IRUGO, show_attr_info, NULL); +static DEVICE_ATTR(if_type, S_IRUGO, show_attr_if_type, NULL); +static DEVICE_ATTR(if_speed, S_IRUGO, show_attr_if_speed, NULL); +static DEVICE_ATTR(if_lane, S_IRUGO, show_attr_if_lane, NULL); +static DEVICE_ATTR(soft_rx_los, S_IRUGO, show_attr_soft_rx_los, NULL); +static DEVICE_ATTR(soft_tx_fault, S_IRUGO, show_attr_soft_tx_fault, NULL); +static DEVICE_ATTR(wavelength, S_IRUGO, show_attr_wavelength, NULL); +static DEVICE_ATTR(tx_eq, S_IRUGO|S_IWUSR, show_attr_tx_eq, store_attr_tx_eq); +static DEVICE_ATTR(rx_am, S_IRUGO|S_IWUSR, show_attr_rx_am, store_attr_rx_am); +static DEVICE_ATTR(rx_em, S_IRUGO|S_IWUSR, show_attr_rx_em, store_attr_rx_em); +static DEVICE_ATTR(cdr, S_IRUGO|S_IWUSR, show_attr_cdr, store_attr_cdr); +static DEVICE_ATTR(soft_rs0, S_IRUGO|S_IWUSR, show_attr_soft_rs0, store_attr_soft_rs0); +static DEVICE_ATTR(soft_rs1, S_IRUGO|S_IWUSR, show_attr_soft_rs1, store_attr_soft_rs1); +static DEVICE_ATTR(soft_tx_disable, S_IRUGO|S_IWUSR, show_attr_soft_tx_disable, store_attr_soft_tx_disable); +static DEVICE_ATTR(auto_tx_disable, S_IRUGO|S_IWUSR, show_attr_auto_tx_disable, store_attr_auto_tx_disable); +static DEVICE_ATTR(extphy_offset, S_IRUGO|S_IWUSR, show_attr_extphy_offset, store_attr_extphy_offset); +static DEVICE_ATTR(extphy_reg, S_IRUGO|S_IWUSR, show_attr_extphy_reg, store_attr_extphy_reg); + +/* ========== IO Expander attribute: from expander ========== + */ +static DEVICE_ATTR(present, S_IRUGO, show_attr_present, NULL); +static DEVICE_ATTR(tx_fault, S_IRUGO, show_attr_tx_fault, NULL); +static DEVICE_ATTR(rxlos, S_IRUGO, show_attr_rxlos, NULL); +static DEVICE_ATTR(tx_disable, S_IRUGO|S_IWUSR, show_attr_tx_disable, store_attr_tx_disable); +static DEVICE_ATTR(reset, S_IRUGO|S_IWUSR, show_attr_reset, store_attr_reset); +static DEVICE_ATTR(lpmod, S_IRUGO|S_IWUSR, show_attr_lpmod, store_attr_lpmod); +static DEVICE_ATTR(modsel, S_IRUGO|S_IWUSR, show_attr_modsel, store_attr_modsel); +static DEVICE_ATTR(hard_rs0, S_IRUGO|S_IWUSR, show_attr_hard_rs0, store_attr_hard_rs0); +static DEVICE_ATTR(hard_rs1, S_IRUGO|S_IWUSR, show_attr_hard_rs1, store_attr_hard_rs1); + +/* ========== Functions for module handling ========== + */ +static void +clean_port_obj(void){ + + dev_t dev_num; + char dev_name[32]; + struct device *device_p; + struct transvr_obj_s *transvr_obj_p; + int minor_curr, port_id; + + for (minor_curr=0; minor_curri2c_client_p); + kfree(transvr_obj_p->vendor_name); + kfree(transvr_obj_p->vendor_pn); + kfree(transvr_obj_p->vendor_rev); + kfree(transvr_obj_p->vendor_sn); + kfree(transvr_obj_p->worker_p); + kfree(transvr_obj_p); + } + dev_num = MKDEV(port_major, minor_curr); + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); + } + SWPS_DEBUG("%s: done.\n", __func__); +} + + +static void +clean_swps_common(void){ + + dev_t dev_num; + struct device *device_p; + + device_p = get_swpdev_by_name(SWP_DEV_MODCTL); + if (device_p){ + dev_num = MKDEV(ctl_major, 1); + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); + } + cancel_delayed_work_sync(&swp_polling); + SWPS_DEBUG("%s: done.\n", __func__); +} + + +static int +get_platform_type(void){ + + int i; + int pf_total = ARRAY_SIZE(platform_map); + char log_msg[64] = "ERROR"; + + platform_p = kzalloc(sizeof(struct inv_platform_s), GFP_KERNEL); + if (!platform_p){ + snprintf(log_msg, sizeof(log_msg), "kzalloc fail"); + goto err_get_platform_type_1; + } + memset(platform_p->name, 0, sizeof(platform_p->name)); + + switch (PLATFORM_SETTINGS) { + case PLATFORM_TYPE_AUTO: + snprintf(platform_p->name, (sizeof(platform_p->name) - 1), + "%s", dmi_get_system_info(DMI_BOARD_NAME)); + for (i=0; iname, platform_map[i].name) == 0) { + platform_p->id = platform_map[i].id; + snprintf(log_msg, sizeof(log_msg), + "Auto detect platform: %d (%s)", + platform_p->id, platform_p->name); + goto ok_get_platform_type_1; + } + } + snprintf(log_msg, sizeof(log_msg), + "Auto detect fail! detect platform: %s", + platform_p->name); + goto err_get_platform_type_2; + + case PLATFORM_TYPE_MAGNOLIA: + case PLATFORM_TYPE_MAGNOLIA_FNC: + case PLATFORM_TYPE_REDWOOD: + case PLATFORM_TYPE_REDWOOD_FSL: + case PLATFORM_TYPE_HUDSON32I_GA: + case PLATFORM_TYPE_SPRUCE: + case PLATFORM_TYPE_CYPRESS_GA1: + case PLATFORM_TYPE_CYPRESS_GA2: + case PLATFORM_TYPE_CYPRESS_BAI: + case PLATFORM_TYPE_TAHOE: + case PLATFORM_TYPE_SEQUOIA_GA: + case PLATFORM_TYPE_LAVENDER_GA: + case PLATFORM_TYPE_LAVENDER_ONL: + platform_p->id = PLATFORM_SETTINGS; + for (i=0; iname, (sizeof(platform_p->name) - 1), + "%s", platform_map[i].name); + snprintf(log_msg, sizeof(log_msg), + "User setup platform: %d (%s)", + platform_p->id, platform_p->name); + goto ok_get_platform_type_1; + } + } + snprintf(log_msg, sizeof(log_msg), + "Internal error, can not map id:%d", + PLATFORM_SETTINGS); + goto err_get_platform_type_2; + + default: + break; + } + snprintf(log_msg, sizeof(log_msg), + "PLATFORM_SETTINGS:%d undefined", PLATFORM_SETTINGS); + goto err_get_platform_type_2; + +ok_get_platform_type_1: + SWPS_DEBUG("%s: %s, :%d\n", __func__, log_msg, PLATFORM_SETTINGS); + return 0; + +err_get_platform_type_2: + kfree(platform_p); +err_get_platform_type_1: + SWPS_ERR("%s: %s :%d\n", __func__, log_msg, PLATFORM_SETTINGS); + return -1; +} + + +static int +get_layout_info(void){ + + switch (platform_p->id) { +#ifdef SWPS_MAGNOLIA + case PLATFORM_TYPE_MAGNOLIA: + case PLATFORM_TYPE_MAGNOLIA_FNC: + gpio_rest_mux = magnolia_gpio_rest_mux; + ioexp_layout = magnolia_ioexp_layout; + port_layout = magnolia_port_layout; + ioexp_total = ARRAY_SIZE(magnolia_ioexp_layout); + port_total = ARRAY_SIZE(magnolia_port_layout); + break; +#endif +#ifdef SWPS_REDWOOD + case PLATFORM_TYPE_REDWOOD: + gpio_rest_mux = redwood_gpio_rest_mux; + ioexp_layout = redwood_ioexp_layout; + port_layout = redwood_port_layout; + ioexp_total = ARRAY_SIZE(redwood_ioexp_layout); + port_total = ARRAY_SIZE(redwood_port_layout); + break; +#endif +#ifdef SWPS_HUDSON32I_GA + case PLATFORM_TYPE_HUDSON32I_GA: + gpio_rest_mux = hudsin32iga_gpio_rest_mux; + ioexp_layout = hudson32iga_ioexp_layout; + port_layout = hudson32iga_port_layout; + ioexp_total = ARRAY_SIZE(hudson32iga_ioexp_layout); + port_total = ARRAY_SIZE(hudson32iga_port_layout); + break; +#endif +#ifdef SWPS_SPRUCE + case PLATFORM_TYPE_SPRUCE: + gpio_rest_mux = spruce_gpio_rest_mux; + ioexp_layout = spruce_ioexp_layout; + port_layout = spruce_port_layout; + ioexp_total = ARRAY_SIZE(spruce_ioexp_layout); + port_total = ARRAY_SIZE(spruce_port_layout); + break; +#endif +#ifdef SWPS_CYPRESS_GA1 + case PLATFORM_TYPE_CYPRESS_GA1: + gpio_rest_mux = cypress_ga1_gpio_rest_mux; + ioexp_layout = cypress_ga1_ioexp_layout; + port_layout = cypress_ga1_port_layout; + ioexp_total = ARRAY_SIZE(cypress_ga1_ioexp_layout); + port_total = ARRAY_SIZE(cypress_ga1_port_layout); + break; +#endif +#ifdef SWPS_CYPRESS_GA2 + case PLATFORM_TYPE_CYPRESS_GA2: + gpio_rest_mux = cypress_ga2_gpio_rest_mux; + ioexp_layout = cypress_ga2_ioexp_layout; + port_layout = cypress_ga2_port_layout; + ioexp_total = ARRAY_SIZE(cypress_ga2_ioexp_layout); + port_total = ARRAY_SIZE(cypress_ga2_port_layout); + break; +#endif +#ifdef SWPS_CYPRESS_BAI + case PLATFORM_TYPE_CYPRESS_BAI: + gpio_rest_mux = cypress_b_gpio_rest_mux; + ioexp_layout = cypress_b_ioexp_layout; + port_layout = cypress_b_port_layout; + ioexp_total = ARRAY_SIZE(cypress_b_ioexp_layout); + port_total = ARRAY_SIZE(cypress_b_port_layout); + break; +#endif +#ifdef SWPS_REDWOOD_FSL + case PLATFORM_TYPE_REDWOOD_FSL: + gpio_rest_mux = redwood_fsl_gpio_rest_mux; + ioexp_layout = redwood_fsl_ioexp_layout; + port_layout = redwood_fsl_port_layout; + ioexp_total = ARRAY_SIZE(redwood_fsl_ioexp_layout); + port_total = ARRAY_SIZE(redwood_fsl_port_layout); + break; +#endif +#ifdef SWPS_TAHOE + case PLATFORM_TYPE_TAHOE: + gpio_rest_mux = tahoe_gpio_rest_mux; + ioexp_layout = tahoe_ioexp_layout; + port_layout = tahoe_port_layout; + ioexp_total = ARRAY_SIZE(tahoe_ioexp_layout); + port_total = ARRAY_SIZE(tahoe_port_layout); + break; +#endif +#ifdef SWPS_SEQUOIA + case PLATFORM_TYPE_SEQUOIA_GA: + gpio_rest_mux = sequoia_gpio_rest_mux; + ioexp_layout = sequoia_ioexp_layout; + port_layout = sequoia_port_layout; + ioexp_total = ARRAY_SIZE(sequoia_ioexp_layout); + port_total = ARRAY_SIZE(sequoia_port_layout); + break; +#endif +#ifdef SWPS_LAVENDER + case PLATFORM_TYPE_LAVENDER_GA: + case PLATFORM_TYPE_LAVENDER_ONL: + gpio_rest_mux = lavender_gpio_rest_mux; + ioexp_layout = lavender_ioexp_layout; + port_layout = lavender_port_layout; + ioexp_total = ARRAY_SIZE(lavender_ioexp_layout); + port_total = ARRAY_SIZE(lavender_port_layout); + break; +#endif + default: + SWPS_ERR(" Invalid platform: %d (%s)\n", + platform_p->id, platform_p->name); + return -1; + } + SWPS_INFO("Start to initial platform: %d (%s)\n", + platform_p->id, platform_p->name); + return 0; +} + + +/* ========== Functions for objects operations ========== + */ +static int +__detect_issues_port(int minor_num) { + + struct transvr_obj_s *tobj_p; + int port_id = port_layout[minor_num].port_id; + char port_name[32] = "ERR"; + char *i2c_emsg = "detected bad transceiver/cable"; + + memset(port_name, 0, sizeof(port_name)); + snprintf(port_name, sizeof(port_name), "%s%d", SWP_DEV_PORT, port_id); + tobj_p = _get_transvr_obj(port_name); + if (!tobj_p) { + SWPS_INFO("%s: tobj_p is NULL :%d\n", __func__, minor_num); + return -1; + } + if (resync_channel_tier_2(tobj_p) < 0) { + if (check_channel_tier_1() < 0) { + alarm_msg_2_user(tobj_p, i2c_emsg); + return -2;; + } + } + return 0; +} + + +static int +_detect_issues_port(void) { + /* OK : retrun -1; + * Fail: return fail at which minor number (0~N) + */ + char *emsg = "ERR"; + int minor = 0; + int minor_2st = 1; + + /* Force moving the initial channel pointer + * Filter out case of fail at minor-0 port + */ + while (minor_2st < port_total) { + minor = minor_2st; + if (__detect_issues_port(minor_2st) < 0) { + emsg = "detect minor_2st fail"; + goto err_p_detect_issues_port; + } + minor_2st += 8; + } + /* Scan all port */ + for (minor=0; minor:%d\n", __func__, emsg, minor_err); + return -1; +} + + +static int +check_transvr_obj_one(char *dev_name){ + /* [Return] + * 0 : Doesn't need to take care + * -1 : Single error + * -2 : Critical error (I2C topology die) + * -9 : Internal error + */ + struct transvr_obj_s *tobj_p = NULL; + int retval = -9; + + tobj_p = _get_transvr_obj(dev_name); + if (!tobj_p) { + SWPS_ERR("%s: %s _get_transvr_obj fail\n", + __func__, dev_name); + return -9; + } + /* Check transceiver current status */ + lock_transvr_obj(tobj_p); + retval = tobj_p->check(tobj_p); + unlock_transvr_obj(tobj_p); + switch (retval) { + case 0: + case ERR_TRANSVR_UNPLUGGED: + case ERR_TRNASVR_BE_ISOLATED: + case ERR_TRANSVR_TASK_BUSY: + return 0; + + case ERR_TRANSVR_I2C_CRASH: + default: + break; + } + /* Identify abnormal case */ + if (check_channel_tier_1() < 0) { + SWPS_DEBUG("%s: %s critical error :%d\n", + __func__, dev_name, retval); + return -2; + } + SWPS_DEBUG("%s: %s single error :%d\n", + __func__, dev_name, retval); + return -1; +} + + +static int +check_transvr_objs(void){ + + char dev_name[32]; + int port_id, err_code; + int minor_curr = 0; + + for (minor_curr=0; minor_curr:%d\n", + __func__, dev_name, err_code); + break; + } + } + return 0; + +err_check_transvr_objs: + SWPS_ERR("%s: %s reset_i2c_topology fail.\n", + __func__, dev_name); + return -1; +} + + +static void +swp_polling_worker(struct work_struct *work){ + + /* Reset I2C */ + if (flag_i2c_reset) { + goto polling_reset_i2c; + } + /* Check IOEXP */ + if (check_ioexp_objs() < 0) { + goto polling_reset_i2c; + } + /* Check transceiver */ + if (check_transvr_objs() < 0) { + SWPS_DEBUG("%s: check_transvr_objs fail.\n", __func__); + flag_i2c_reset = 1; + } + goto polling_schedule_round; + +polling_reset_i2c: + SWPS_DEBUG("%s: reset_i2c_topology start.\n", __func__); + if (reset_i2c_topology() < 0) { + SWPS_ERR("%s: reset i2c fail!\n", __func__); + flag_i2c_reset = 1; + } else { + SWPS_DEBUG("%s: reset_i2c_topology OK.\n", __func__); + flag_i2c_reset = 0; + } +polling_schedule_round: + schedule_delayed_work(&swp_polling, _get_polling_period()); +} + + +/* ========== Functions for register something ========== + */ +static int +register_transvr_common_attr(struct device *device_p){ + + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_id) < 0) { + err_attr = "dev_attr_id"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_ext_id) < 0) { + err_attr = "dev_attr_ext_id"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_connector) < 0) { + err_attr = "dev_attr_connector"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_vendor_name) < 0) { + err_attr = "dev_attr_vendor_name"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_vendor_pn) < 0) { + err_attr = "dev_attr_vendor_pn"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_vendor_rev) < 0) { + err_attr = "dev_attr_vendor_rev"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_vendor_sn) < 0) { + err_attr = "dev_attr_vendor_sn"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_br) < 0) { + err_attr = "dev_attr_br"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_len_smf) < 0) { + err_attr = "dev_attr_len_smf"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_len_om1) < 0) { + err_attr = "dev_attr_len_om1"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_len_om2) < 0) { + err_attr = "dev_attr_len_om2"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_len_om3) < 0) { + err_attr = "dev_attr_len_om3"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_len_om4) < 0) { + err_attr = "dev_attr_len_om4"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_comp_extend) < 0) { + err_attr = "dev_attr_comp_extend"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_comp_eth) < 0) { + err_attr = "dev_attr_comp_eth"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_comp_rev) < 0) { + err_attr = "dev_attr_comp_rev"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_info) < 0) { + err_attr = "dev_attr_info"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_if_type) < 0) { + err_attr = "dev_attr_if_type"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_if_speed) < 0) { + err_attr = "dev_attr_if_speed"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_if_lane) < 0) { + err_attr = "dev_attr_if_lane"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_temperature) < 0) { + err_attr = "dev_attr_temperature"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_voltage) < 0) { + err_attr = "dev_attr_voltage"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_tx_bias) < 0) { + err_attr = "dev_attr_tx_bias"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_tx_power) < 0) { + err_attr = "dev_attr_tx_power"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_rx_power) < 0) { + err_attr = "dev_attr_rx_power"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_tx_eq) < 0) { + err_attr = "dev_attr_tx_eq"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_rx_em) < 0) { + err_attr = "dev_attr_rx_em"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_wavelength) < 0) { + err_attr = "dev_attr_wavelength"; + goto err_transvr_comm_attr; + } + return 0; + +err_transvr_comm_attr: + SWPS_ERR("%s: %s\n", __func__, err_attr); + return -1; +} + +static int +register_transvr_sfp_attr(struct device *device_p){ + + char *err_attr = NULL; + + if (register_transvr_common_attr(device_p) < 0) { + err_attr = "register_transvr_common_attr"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_comp_eth_10) < 0) { + err_attr = "dev_attr_comp_eth_10"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_len_sm) < 0) { + err_attr = "dev_attr_len_sm"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_rate_id) < 0) { + err_attr = "dev_attr_rate_id"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_soft_rs0) < 0) { + err_attr = "dev_attr_soft_rs0"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_soft_rs1) < 0) { + err_attr = "dev_attr_soft_rs1"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_extphy_offset) < 0) { + err_attr = "dev_attr_extphy_offset"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_extphy_reg) < 0) { + err_attr = "dev_attr_extphy_reg"; + goto err_transvr_sfp_attr; + } + return 0; + +err_transvr_sfp_attr: + SWPS_ERR("%s: %s\n", __func__, err_attr); + return -1; +} + + +static int +register_transvr_qsfp_attr(struct device *device_p){ + + char *err_attr = NULL; + + if (register_transvr_common_attr(device_p) < 0) { + err_attr = "register_transvr_common_attr"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_comp_eth_10_40) < 0) { + err_attr = "dev_attr_comp_eth_10_40"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_power_cls) < 0) { + err_attr = "dev_attr_power_cls"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_soft_rx_los) < 0) { + err_attr = "soft_rx_los"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_soft_tx_disable) < 0) { + err_attr = "soft_tx_disable"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_auto_tx_disable) < 0) { + err_attr = "auto_tx_disable"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_soft_tx_fault) < 0) { + err_attr = "soft_tx_fault"; + goto err_transvr_qsfp_attr; + } + return 0; + +err_transvr_qsfp_attr: + SWPS_ERR("%s: %s\n", __func__, err_attr); + return -1; +} + + +static int +register_transvr_qsfp28_attr(struct device *device_p){ + + char *err_attr = NULL; + + if (register_transvr_qsfp_attr(device_p) < 0){ + err_attr = "register_transvr_qsfp_attr"; + goto err_transvr_qsfp28_attr; + } + if (device_create_file(device_p, &dev_attr_cdr) < 0) { + err_attr = "dev_attr_cdr"; + goto err_transvr_qsfp28_attr; + } + if (device_create_file(device_p, &dev_attr_rx_am) < 0) { + err_attr = "dev_attr_rx_am"; + goto err_transvr_qsfp28_attr; + } + return 0; + +err_transvr_qsfp28_attr: + SWPS_ERR("%s: %s\n", __func__, err_attr); + return -1; +} + + +static int +register_transvr_attr(struct device *device_p, + struct transvr_obj_s *transvr_obj){ + + switch (transvr_obj->layout){ + case TRANSVR_TYPE_SFP: + if (register_transvr_sfp_attr(device_p) < 0){ + goto err_reg_tvr_attr; + } + break; + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + if (register_transvr_qsfp_attr(device_p) < 0){ + goto err_reg_tvr_attr; + } + break; + case TRANSVR_TYPE_QSFP_28: + if (register_transvr_qsfp28_attr(device_p) < 0){ + goto err_reg_tvr_attr; + } + break; + default: + goto err_reg_tvr_attr; + } + return 0; + +err_reg_tvr_attr: + SWPS_ERR("%s: fail! type=%d \n", __func__, transvr_obj->type); + return -1; +} + + +static int +register_ioexp_attr_sfp_1(struct device *device_p){ + /* Support machine type: + * - SFP : Magnolia + */ + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_present) < 0) { + err_attr = "dev_attr_present"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_tx_fault) < 0) { + err_attr = "dev_attr_tx_fault"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_rxlos) < 0) { + err_attr = "dev_attr_rxlos"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_tx_disable) < 0) { + err_attr = "dev_attr_tx_disable"; + goto err_ioexp_sfp1_attr; + } + return 0; + +err_ioexp_sfp1_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + + +static int +register_ioexp_attr_sfp_2(struct device *device_p){ + /* Support machine type: + * - SFP28 : Cypress + */ + char *err_attr = NULL; + + if (register_ioexp_attr_sfp_1(device_p) < 0){ + goto err_ioexp_sfp2_attr; + } + if (device_create_file(device_p, &dev_attr_hard_rs0) < 0) { + err_attr = "dev_attr_hard_rs0"; + goto err_ioexp_sfp2_attr; + } + if (device_create_file(device_p, &dev_attr_hard_rs1) < 0) { + err_attr = "dev_attr_hard_rs1"; + goto err_ioexp_sfp2_attr; + } + return 0; + +err_ioexp_sfp2_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + + +static int +register_ioexp_attr_qsfp_1(struct device *device_p){ + /* Support machine type: + * - QSFP : Magnolia, Redwood, Hudson32i + * - QSFP+ : Magnolia, Redwood, Hudson32i + * - QSFP28: Redwood + */ + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_present) < 0) { + err_attr = "dev_attr_present"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_reset) < 0) { + err_attr = "dev_attr_reset"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_lpmod) < 0) { + err_attr = "dev_attr_lpmod"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_modsel) < 0) { + err_attr = "dev_attr_modsel"; + goto err_ioexp_qsfp1_attr; + } + return 0; + +err_ioexp_qsfp1_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + + +static int +register_modctl_attr(struct device *device_p){ + + char *err_msg = NULL; + + if (device_create_file(device_p, &dev_attr_platform) < 0) { + err_msg = "dev_attr_platform"; + goto err_reg_modctl_attr; + } + if (device_create_file(device_p, &dev_attr_version) < 0) { + err_msg = "dev_attr_version"; + goto err_reg_modctl_attr; + } + if (device_create_file(device_p, &dev_attr_status) < 0) { + err_msg = "dev_attr_status"; + goto err_reg_modctl_attr; + } + if (device_create_file(device_p, &dev_attr_reset_i2c) < 0) { + err_msg = "dev_attr_reset_i2c"; + goto err_reg_modctl_attr; + } + if (device_create_file(device_p, &dev_attr_reset_swps) < 0) { + err_msg = "dev_attr_reset_swps"; + goto err_reg_modctl_attr; + } + if (device_create_file(device_p, &dev_attr_auto_config) < 0) { + err_msg = "dev_attr_auto_config"; + goto err_reg_modctl_attr; + } + return 0; + +err_reg_modctl_attr: + SWPS_ERR("%s: %s\n", __func__, err_msg); + return -1; +} + + +static int +register_ioexp_attr(struct device *device_p, + struct transvr_obj_s *transvr_obj){ + + char *err_msg = "ERR"; + + switch (transvr_obj->ioexp_obj_p->ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + case IOEXP_TYPE_MAGINOLIA_4AB: + if (register_ioexp_attr_sfp_1(device_p) < 0){ + err_msg = "register_ioexp_attr_sfp_1 fail"; + goto err_reg_ioexp_attr; + } + break; + case IOEXP_TYPE_CYPRESS_NABC: + if (register_ioexp_attr_sfp_2(device_p) < 0){ + err_msg = "register_ioexp_attr_sfp_2 fail"; + goto err_reg_ioexp_attr; + } + break; + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + case IOEXP_TYPE_CYPRESS_7ABC: + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + case IOEXP_TYPE_HUDSON32IGA_P01P08: + case IOEXP_TYPE_HUDSON32IGA_P09P16: + case IOEXP_TYPE_TAHOE_5A: + case IOEXP_TYPE_TAHOE_6ABC: + case IOEXP_TYPE_SEQUOIA_NABC: + case IOEXP_TYPE_LAVENDER_P65: + if (register_ioexp_attr_qsfp_1(device_p) < 0){ + err_msg = "register_ioexp_attr_qsfp_1 fail"; + goto err_reg_ioexp_attr; + } + break; + + default: + err_msg = "Unknow type"; + goto err_reg_ioexp_attr; + } + return 0; + +err_reg_ioexp_attr: + SWPS_ERR("%s: %s :%d \n", + __func__, err_msg, transvr_obj->ioexp_obj_p->ioexp_type); + return -1; +} + + +static int +register_modctl_device(void) { + + struct device *device_p = NULL; + int minor_comm = 0; /* Default minor number for common device */ + dev_t dev_num = MKDEV(ctl_major, minor_comm); + char *err_msg = "ERROR"; + + device_p = device_create(swp_class_p, /* struct class *cls */ + NULL, /* struct device *parent */ + dev_num, /* dev_t devt */ + NULL, /* void *private_data */ + SWP_DEV_MODCTL); /* const char *fmt */ + if (IS_ERR(device_p)){ + err_msg = "device_create fail"; + goto err_register_modctl_device_1; + } + if (register_modctl_attr(device_p) < 0) { + err_msg = "register_modctl_attr fail"; + goto err_register_modctl_device_2; + } + return 0; + +err_register_modctl_device_2: + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); +err_register_modctl_device_1: + SWPS_ERR("%s: %s\n", __func__, err_msg); + return -1; +} + + +static int +register_port_device(char *dev_name, + dev_t dev_num, + struct transvr_obj_s *transvr_obj){ + + struct device *device_p = NULL; + device_p = device_create(swp_class_p, /* struct class *cls */ + NULL, /* struct device *parent */ + dev_num, /* dev_t devt */ + transvr_obj, /* void *private_data */ + dev_name); /* const char *fmt */ + if (IS_ERR(device_p)){ + goto err_regswp_create_dev; + } + if (register_transvr_attr(device_p, transvr_obj) < 0){ + goto err_regswp_reg_attr; + } + if (register_ioexp_attr(device_p, transvr_obj) < 0){ + goto err_regswp_reg_attr; + } + return 0; + +err_regswp_reg_attr: + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); +err_regswp_create_dev: + SWPS_ERR("%s fail! :%s\n", __func__, dev_name); + return -1; +} + + +static int +register_swp_module(void){ + + dev_t ctl_devt = 0; + dev_t port_devt = 0; + int dev_total = port_total + 1; /* char_dev for module control */ + + /* Register device number */ + if (alloc_chrdev_region(&ctl_devt, 0, 1, SWP_DEV_MODCTL) < 0){ + SWPS_WARN("Allocate CTL MAJOR failure! \n"); + goto err_register_swp_module_1; + } + if (alloc_chrdev_region(&port_devt, 0, dev_total, SWP_CLS_NAME) < 0){ + SWPS_WARN("Allocate PORT MAJOR failure! \n"); + goto err_register_swp_module_2; + } + ctl_major = MAJOR(ctl_devt); + port_major = MAJOR(port_devt); + + /* Create class object */ + swp_class_p = class_create(THIS_MODULE, SWP_CLS_NAME); + if (IS_ERR(swp_class_p)) { + SWPS_ERR("Create class failure! \n"); + goto err_register_swp_module_3; + } + return 0; + +err_register_swp_module_3: + unregister_chrdev_region(MKDEV(port_major, 0), port_total); +err_register_swp_module_2: + unregister_chrdev_region(MKDEV(ctl_major, 0), 1); +err_register_swp_module_1: + return -1; +} + + +/* ========== Module initial relate ========== + */ +static int +create_ioexp_objs(void) { + + int i, run_mod; + + /* Clean IOEXP object */ + clean_ioexp_objs(); + /* Get running mode */ + run_mod = IOEXP_MODE_DIRECT; + if (SWP_POLLING_ENABLE){ + run_mod = IOEXP_MODE_POLLING; + } + /* Create IOEXP object */ + for(i=0; i devlen_max) { + snprintf(err_msg, sizeof(err_msg), + "SWP_DEV_PORT too long!"); + goto err_initport_create_tranobj; + } + memset(dev_name, 0, sizeof(dev_name)); + snprintf(dev_name, devlen_max, "%s%d", SWP_DEV_PORT, port_id); + /* Create transceiver object */ + ioexp_obj_p = get_ioexp_obj(ioexp_id); + if (!ioexp_obj_p){ + snprintf(err_msg, sizeof(err_msg), + "IOEXP object:%d not exist", ioexp_id); + goto err_initport_create_tranobj; + } + transvr_obj_p = create_transvr_obj(dev_name, chan_id, ioexp_obj_p, + ioexp_virt_offset, transvr_type, + chipset_type, run_mod); + if (!transvr_obj_p){ + snprintf(err_msg, sizeof(err_msg), + "Create transceiver object fail :%s", dev_name); + goto err_initport_create_tranobj; + } + /* Setup Lane_ID mapping */ + i = ARRAY_SIZE(port_layout[minor_curr].lane_id); + j = ARRAY_SIZE(transvr_obj_p->lane_id); + if (i != j) { + snprintf(err_msg, sizeof(err_msg), + "Lane_id size inconsistent %d/%d", i, j); + goto err_initport_reg_device; + } + memcpy(transvr_obj_p->lane_id, port_layout[minor_curr].lane_id, i*sizeof(int)); + /* Create and register device object */ + if (register_port_device(dev_name, MKDEV(port_major, minor_curr), transvr_obj_p) < 0){ + snprintf(err_msg, sizeof(err_msg), + "register_port_device fail"); + goto err_initport_reg_device; + } + /* Setup device_ptr of transvr_obj */ + dev_p = get_swpdev_by_name(dev_name); + if (!dev_p){ + snprintf(err_msg, sizeof(err_msg), + "get_swpdev_by_name fail"); + goto err_initport_reg_device; + } + transvr_obj_p->transvr_dev_p = dev_p; + /* Success */ + ok_count++; + } + SWPS_INFO("%s: initialed %d port-dev",__func__, ok_count); + return 0; + +err_initport_reg_device: + kfree(transvr_obj_p); +err_initport_create_tranobj: + clean_port_obj(); + SWPS_ERR("%s: %s", __func__, err_msg); + SWPS_ERR("Dump: :%d :%d :%d :%d :%d :%d\n", + port_id, chan_id, ioexp_id, ioexp_virt_offset, transvr_type, run_mod); + return -1; +} + + +static int +init_dev_topology(void){ + + int err; + char *emsg = "ERR"; + flag_mod_state = SWP_STATE_NORMAL; + + err = init_ioexp_objs(); + switch(err){ + case 0: /* Normal */ + SWPS_DEBUG("%s: normal case\n", __func__); + break; + + case -1: /* topology error */ + SWPS_DEBUG("%s: detect tier-1 topology initial failure :%d\n", + __func__, err); + /* Reset and isolate */ + err = reset_i2c_topology(); + if (err < 0) { + emsg = "reset i2c topology fail"; + goto err_init_dev_topology; + } + /* Re-initial again */ + err = init_ioexp_objs(); + if (err < 0) { + emsg = "re-init ioexp objects fail"; + goto err_init_dev_topology; + } + break; + + case -2: /* Internal error */ + SWPS_DEBUG("%s: internal error case\n", __func__); + err = -2; + emsg = "internal error"; + goto err_init_dev_topology; + + default: + SWPS_DEBUG("%s: undefined error case\n", __func__); + emsg = "undefined error case"; + goto err_init_dev_topology; + } + SWPS_DEBUG("%s: initial I2C topology success\n", __func__); + return 0; + +err_init_dev_topology: + SWPS_ERR("%s: %s :%d\n", __func__, emsg, err); + return -1; +} + + +static int +init_polling_task(void){ + + if (SWP_POLLING_ENABLE){ + schedule_delayed_work(&swp_polling, _get_polling_period()); + } + return 0; +} + + +static int +init_swps_common(void){ + + char *err_msg = "ERR"; + + auto_config = 0; + if ((SWP_AUTOCONFIG_ENABLE) && (SWP_POLLING_ENABLE)){ + auto_config = 1; + } + if (register_modctl_device() < 0) { + err_msg = "register_modctl_device fail"; + goto err_init_swps_common_1; + } + if (_update_auto_config_2_trnasvr() < 0) { + err_msg = "_update_auto_config_2_trnasvr fail"; + goto err_init_swps_common_1; + } + if (init_polling_task() < 0){ + err_msg = "init_polling_task fail"; + goto err_init_swps_common_1; + } + return 0; + +err_init_swps_common_1: + clean_swps_common(); + SWPS_ERR("%s: %s\n", __func__, err_msg); + return -1; +} + + +static int __init +swp_module_init(void){ + + if (get_platform_type() < 0){ + goto err_init_out; + } + if (get_layout_info() < 0){ + goto err_init_out; + } + if (register_swp_module() < 0){ + goto err_init_out; + } + if (create_ioexp_objs() < 0){ + goto err_init_ioexp; + } + if (create_port_objs() < 0){ + goto err_init_portobj; + } + if (init_mux_gpio(gpio_rest_mux) < 0){ + goto err_init_mux; + } + if (init_dev_topology() < 0){ + goto err_init_topology; + } + if (init_swps_common() < 0){ + goto err_init_topology; + } + SWPS_INFO("Inventec switch-port module V.%s initial success.\n", SWP_VERSION); + return 0; + + +err_init_topology: + clean_mux_gpio(); +err_init_mux: + clean_port_obj(); +err_init_portobj: + clean_ioexp_objs(); +err_init_ioexp: + class_unregister(swp_class_p); + class_destroy(swp_class_p); + unregister_chrdev_region(MKDEV(ctl_major, 0), 1); + unregister_chrdev_region(MKDEV(port_major, 0), port_total); +err_init_out: + SWPS_ERR("Inventec switch-port module V.%s initial failure.\n", SWP_VERSION); + return -1; +} + + +static void __exit +swp_module_exit(void){ + + clean_swps_common(); + clean_port_obj(); + clean_ioexp_objs(); + clean_mux_gpio(); + class_unregister(swp_class_p); + class_destroy(swp_class_p); + unregister_chrdev_region(MKDEV(ctl_major, 0), 1); + unregister_chrdev_region(MKDEV(port_major, 0), port_total); + SWPS_INFO("Remove Inventec switch-port module success.\n"); +} + + +/* Module information */ +MODULE_AUTHOR(SWP_AUTHOR); +MODULE_DESCRIPTION(SWP_DESC); +MODULE_VERSION(SWP_VERSION); +MODULE_LICENSE(SWP_LICENSE); + +module_init(swp_module_init); +module_exit(swp_module_exit); + + + + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_swps.h b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_swps.h new file mode 100644 index 000000000000..8e1451d6149a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/inv_swps.h @@ -0,0 +1,1033 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef INV_SWPS_H +#define INV_SWPS_H + +#include "transceiver.h" +#include "io_expander.h" +#include "inv_mux.h" + +/* Module settings */ +#define SWP_CLS_NAME "swps" +#define SWP_DEV_PORT "port" +#define SWP_DEV_MODCTL "module" +#define SWP_RESET_PWD "inventec" +#define SWP_POLLING_PERIOD (300) /* msec */ +#define SWP_POLLING_ENABLE (1) +#define SWP_AUTOCONFIG_ENABLE (1) + +/* Module information */ +#define SWP_AUTHOR "Neil " +#define SWP_DESC "Inventec port and transceiver driver" +#define SWP_VERSION "4.2.7" +#define SWP_LICENSE "GPL" + +/* Module status define */ +#define SWP_STATE_NORMAL (0) +#define SWP_STATE_I2C_DIE (-91) + +/* [Note]: + * Functions and mechanism for auto-detect platform type is ready, + * But HW and BIOS not ready! We need to wait them. + * So, please do not use PLATFORM_TYPE_AUTO until they are ready. + * (2016.06.13) + */ +#define PLATFORM_TYPE_AUTO (100) +#define PLATFORM_TYPE_MAGNOLIA (111) +#define PLATFORM_TYPE_MAGNOLIA_FNC (112) +#define PLATFORM_TYPE_REDWOOD (121) +#define PLATFORM_TYPE_REDWOOD_FSL (122) +#define PLATFORM_TYPE_HUDSON32I_GA (131) +#define PLATFORM_TYPE_SPRUCE (141) +#define PLATFORM_TYPE_CYPRESS_GA1 (151) /* Up -> Down */ +#define PLATFORM_TYPE_CYPRESS_GA2 (152) /* Down -> Up */ +#define PLATFORM_TYPE_CYPRESS_BAI (153) /* Down -> Up */ +#define PLATFORM_TYPE_TAHOE (161) +#define PLATFORM_TYPE_SEQUOIA_GA (171) +#define PLATFORM_TYPE_LAVENDER_GA (181) +#define PLATFORM_TYPE_LAVENDER_ONL (182) +/* Current running platfrom */ +#define PLATFORM_SETTINGS PLATFORM_TYPE_MAGNOLIA + +/* Define platform flag and kernel version */ +#if (PLATFORM_SETTINGS == PLATFORM_TYPE_MAGNOLIA) + #define SWPS_MAGNOLIA (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_MAGNOLIA_FNC) + #define SWPS_MAGNOLIA (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_REDWOOD) + #define SWPS_REDWOOD (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_REDWOOD_FSL) + #define SWPS_REDWOOD_FSL (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_HUDSON32I_GA) + #define SWPS_HUDSON32I_GA (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_SPRUCE) + #define SWPS_SPRUCE (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_CYPRESS_GA1) + #define SWPS_CYPRESS_GA1 (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_CYPRESS_GA2) + #define SWPS_CYPRESS_GA2 (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_CYPRESS_BAI) + #define SWPS_CYPRESS_BAI (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_TAHOE) + #define SWPS_TAHOE (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_SEQUOIA_GA) + #define SWPS_SEQUOIA (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_LAVENDER_GA) + #define SWPS_LAVENDER (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_LAVENDER_ONL) + #define SWPS_LAVENDER (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#endif + + +struct inv_platform_s { + int id; + char name[64]; +}; + +struct inv_ioexp_layout_s { + int ioexp_id; + int ioexp_type; + struct ioexp_addr_s addr[4]; +}; + +struct inv_port_layout_s { + int port_id; + int chan_id; + int ioexp_id; + int ioexp_offset; + int transvr_type; + int chipset_type; + int lane_id[8]; +}; + + +/* ========================================== + * Inventec Platform Settings + * ========================================== + */ +struct inv_platform_s platform_map[] = { + {PLATFORM_TYPE_AUTO, "Auto-Detect" }, + {PLATFORM_TYPE_MAGNOLIA, "Magnolia" }, + {PLATFORM_TYPE_MAGNOLIA_FNC, "Magnolia_FNC" }, + {PLATFORM_TYPE_REDWOOD, "Redwood" }, + {PLATFORM_TYPE_REDWOOD_FSL, "Redwood_FSL" }, + {PLATFORM_TYPE_HUDSON32I_GA, "Hudson32i" }, + {PLATFORM_TYPE_SPRUCE, "Spruce" }, + {PLATFORM_TYPE_CYPRESS_GA1, "Cypress_GA1" }, + {PLATFORM_TYPE_CYPRESS_GA2, "Cypress_GA2" }, + {PLATFORM_TYPE_CYPRESS_BAI, "Cypress_BAI" }, + {PLATFORM_TYPE_TAHOE, "Tahoe" }, + {PLATFORM_TYPE_SEQUOIA_GA, "Sequoia_GA" }, + {PLATFORM_TYPE_LAVENDER_GA, "Lavender_GA" }, + {PLATFORM_TYPE_LAVENDER_ONL, "Lavender_ONL" }, +}; + + +/* ========================================== + * Magnolia Layout configuration + * ========================================== + */ +#ifdef SWPS_MAGNOLIA +unsigned magnolia_gpio_rest_mux = MUX_RST_GPIO_48_PAC9548; + +struct inv_ioexp_layout_s magnolia_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_MAGINOLIA_NAB, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, }, /* addr[1] = I/O Expander N B */ + }, + {1, IOEXP_TYPE_MAGINOLIA_NAB, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, }, /* addr[1] = I/O Expander N B */ + }, + {2, IOEXP_TYPE_MAGINOLIA_NAB, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, }, /* addr[1] = I/O Expander N B */ + }, + {3, IOEXP_TYPE_MAGINOLIA_4AB, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander 4 A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xf0, 0xff}, {0xf0, 0xff}, }, }, /* addr[1] = I/O Expander 4 B */ + }, + {4, IOEXP_TYPE_MAGINOLIA_NAB, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, }, /* addr[1] = I/O Expander N B */ + }, + {5, IOEXP_TYPE_MAGINOLIA_NAB, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, }, /* addr[1] = I/O Expander N B */ + }, + {6, IOEXP_TYPE_MAGINOLIA_7AB, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xf0, 0x33}, }, }, /* addr[1] = I/O Expander 7 B */ + }, +}; + +struct inv_port_layout_s magnolia_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 16} }, + { 1, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 15} }, + { 2, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 14} }, + { 3, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 13} }, + { 4, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 24} }, + { 5, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 23} }, + { 6, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 22} }, + { 7, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 21} }, + { 8, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 28} }, + { 9, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 27} }, + {10, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 26} }, + {11, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 25} }, + {12, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 32} }, + {13, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 31} }, + {14, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 30} }, + {15, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 29} }, + {16, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 48} }, + {17, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 47} }, + {18, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 46} }, + {19, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 45} }, + {20, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 52} }, + {21, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 51} }, + {22, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 50} }, + {23, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 49} }, + {24, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 56} }, + {25, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 55} }, + {26, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 54} }, + {27, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 53} }, + {28, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 60} }, + {29, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 59} }, + {30, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 58} }, + {31, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 57} }, + {32, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 64} }, + {33, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 63} }, + {34, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 62} }, + {35, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 61} }, + {36, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 68} }, + {37, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 67} }, + {38, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 66} }, + {39, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 65} }, + {40, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 72} }, + {41, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 71} }, + {42, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 70} }, + {43, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 69} }, + {44, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 76} }, + {45, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 75} }, + {46, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 74} }, + {47, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 73} }, + {48, 58, 6, 0, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, { 81, 82, 83, 84} }, + {49, 59, 6, 1, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, { 77, 78, 79, 80} }, + {50, 60, 6, 2, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, { 97, 98, 99,100} }, + {51, 61, 6, 3, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, {101,102,103,104} }, + {52, 62, 6, 4, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, {105,106,107,108} }, + {53, 63, 6, 5, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, {109,110,111,112} }, +}; +#endif + + +/* ========================================== + * Redwood Layout configuration + * ========================================== + */ +#ifdef SWPS_REDWOOD +unsigned redwood_gpio_rest_mux = MUX_RST_GPIO_48_PAC9548; + +struct inv_ioexp_layout_s redwood_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_REDWOOD_P01P08, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {1, IOEXP_TYPE_REDWOOD_P09P16, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {2, IOEXP_TYPE_REDWOOD_P01P08, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {3, IOEXP_TYPE_REDWOOD_P09P16, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, +}; + +struct inv_port_layout_s redwood_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 22, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} }, + { 1, 23, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} }, + { 2, 24, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} }, + { 3, 25, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} }, + { 4, 26, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} }, + { 5, 27, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} }, + { 6, 28, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} }, + { 7, 29, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} }, + { 8, 30, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} }, + { 9, 31, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} }, + {10, 32, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} }, + {11, 33, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} }, + {12, 34, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} }, + {13, 35, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, + {14, 36, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} }, + {15, 37, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} }, + {16, 6, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, + {17, 7, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, + {18, 8, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} }, + {19, 9, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} }, + {20, 10, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, + {21, 11, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {22, 12, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} }, + {23, 13, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} }, + {24, 14, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {25, 15, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {26, 16, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {27, 17, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, + {28, 18, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113,114,115,116} }, + {29, 19, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + {30, 20, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121,122,123,124} }, + {31, 21, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125,126,127,128} }, +}; +#endif + + +/* ========================================== + * Hudson32i Layout configuration + * ========================================== + */ +#ifdef SWPS_HUDSON32I_GA +unsigned hudsin32iga_gpio_rest_mux = MUX_RST_GPIO_48_PAC9548; + +struct inv_ioexp_layout_s hudson32iga_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_HUDSON32IGA_P01P08, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0x24 */ + }, + {1, IOEXP_TYPE_HUDSON32IGA_P09P16, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0x24 */ + }, + {2, IOEXP_TYPE_HUDSON32IGA_P01P08, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0x25 */ + }, + {3, IOEXP_TYPE_HUDSON32IGA_P09P16, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0x25 */ + }, +}; + +struct inv_port_layout_s hudson32iga_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 6, 0, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 1, 2, 3, 4} }, + { 1, 7, 0, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 5, 6, 7, 8} }, + { 2, 8, 0, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 9, 10, 11, 12} }, + { 3, 9, 0, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 13, 14, 15, 16} }, + { 4, 10, 0, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 17, 18, 19, 20} }, + { 5, 11, 0, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 21, 22, 23, 24} }, + { 6, 12, 0, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 25, 26, 27, 28} }, + { 7, 13, 0, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 29, 30, 31, 32} }, + { 8, 14, 1, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 33, 34, 35, 36} }, + { 9, 15, 1, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 37, 38, 39, 40} }, + {10, 16, 1, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 41, 42, 43, 44} }, + {11, 17, 1, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 45, 46, 47, 48} }, + {12, 18, 1, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 49, 50, 51, 52} }, + {13, 19, 1, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 53, 54, 55, 56} }, + {14, 20, 1, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 57, 58, 59, 60} }, + {15, 21, 1, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 61, 62, 63, 64} }, + {16, 22, 2, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 65, 66, 67, 68} }, + {17, 23, 2, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 69, 70, 71, 72} }, + {18, 24, 2, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 73, 74, 75, 76} }, + {19, 25, 2, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 77, 78, 79, 80} }, + {20, 26, 2, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 81, 82, 83, 84} }, + {21, 27, 2, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 85, 86, 87, 88} }, + {22, 28, 2, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 89, 90, 91, 92} }, + {23, 29, 2, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 93, 94, 95, 96} }, + {24, 30, 3, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 97, 98, 99,100} }, + {25, 31, 3, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {101,102,103,104} }, + {26, 32, 3, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {105,106,107,108} }, + {27, 33, 3, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {109,110,111,112} }, + {28, 34, 3, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {113,114,115,116} }, + {29, 35, 3, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {117,118,119,120} }, + {30, 36, 3, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {121,122,123,124} }, + {31, 37, 3, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {125,126,127,128} }, +}; +#endif + + +/* ========================================== + * Spruce Layout configuration + * ========================================== + */ +#ifdef SWPS_SPRUCE +unsigned spruce_gpio_rest_mux = MUX_RST_GPIO_48_PAC9548; + +struct inv_ioexp_layout_s spruce_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_SPRUCE_7AB, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 7A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xf0, 0x33}, }, }, /* addr[2] = I/O Expander 7B */ + }, +}; + +struct inv_port_layout_s spruce_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 6, 0, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 81, 82, 83, 84} }, + { 1, 7, 0, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 77, 78, 79, 80} }, + { 2, 8, 0, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 97, 98, 99,100} }, + { 3, 9, 0, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {101,102,103,104} }, + { 4, 10, 0, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {105,106,107,108} }, + { 5, 11, 0, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {109,110,111,112} }, +}; +#endif + + +/* ========================================== + * Cypress Layout configuration (Inventec version [Up->Down]) + * ========================================== + */ +#ifdef SWPS_CYPRESS_GA1 +unsigned cypress_ga1_gpio_rest_mux = MUX_RST_GPIO_69_PAC9548; + +struct inv_ioexp_layout_s cypress_ga1_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_CYPRESS_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {1, IOEXP_TYPE_CYPRESS_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {2, IOEXP_TYPE_CYPRESS_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {3, IOEXP_TYPE_CYPRESS_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {4, IOEXP_TYPE_CYPRESS_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {5, IOEXP_TYPE_CYPRESS_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {6, IOEXP_TYPE_CYPRESS_7ABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xc0, 0xc0}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xc0, 0xc0}, {0xff, 0xc0}, }, /* addr[1] = I/O Expander 7 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + +struct inv_port_layout_s cypress_ga1_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 1} }, + { 1, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 2} }, + { 2, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 3} }, + { 3, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 4} }, + { 4, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 5} }, + { 5, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 6} }, + { 6, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 7} }, + { 7, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 8} }, + { 8, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 9} }, + { 9, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 10} }, + {10, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 11} }, + {11, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 12} }, + {12, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 21} }, + {13, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 22} }, + {14, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 23} }, + {15, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 24} }, + {16, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 33} }, + {17, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 34} }, + {18, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 35} }, + {19, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 36} }, + {20, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 37} }, + {21, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 38} }, + {22, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 39} }, + {23, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 40} }, + {24, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 41} }, + {25, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 42} }, + {26, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 43} }, + {27, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 44} }, + {28, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 49} }, + {29, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 50} }, + {30, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 51} }, + {31, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 52} }, + {32, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 53} }, + {33, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 54} }, + {34, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 55} }, + {35, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 56} }, + {36, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 65} }, + {37, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 66} }, + {38, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 67} }, + {39, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 68} }, + {40, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 69} }, + {41, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 70} }, + {42, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 71} }, + {43, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 72} }, + {44, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 81} }, + {45, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 82} }, + {46, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 83} }, + {47, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 84} }, + {48, 58, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {49, 59, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {50, 60, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {51, 61, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {52, 62, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, + {53, 63, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, +}; +#endif + + +/* ========================================== + * Cypress Layout configuration (Inventec version [Down->Up]) + * ========================================== + */ +#ifdef SWPS_CYPRESS_GA2 +unsigned cypress_ga2_gpio_rest_mux = MUX_RST_GPIO_FORCE_HEDERA; + +struct inv_ioexp_layout_s cypress_ga2_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_CYPRESS_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {1, IOEXP_TYPE_CYPRESS_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {2, IOEXP_TYPE_CYPRESS_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {3, IOEXP_TYPE_CYPRESS_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {4, IOEXP_TYPE_CYPRESS_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {5, IOEXP_TYPE_CYPRESS_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {6, IOEXP_TYPE_CYPRESS_7ABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xc0, 0xc0}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xc0, 0xc0}, {0xff, 0xc0}, }, /* addr[1] = I/O Expander 7 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + +struct inv_port_layout_s cypress_ga2_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 2} }, + { 1, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 1} }, + { 2, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 4} }, + { 3, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 3} }, + { 4, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 6} }, + { 5, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 5} }, + { 6, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 8} }, + { 7, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 7} }, + { 8, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 10} }, + { 9, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 9} }, + {10, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 12} }, + {11, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 11} }, + {12, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 22} }, + {13, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 21} }, + {14, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 24} }, + {15, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 23} }, + {16, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 34} }, + {17, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 33} }, + {18, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 36} }, + {19, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 35} }, + {20, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 38} }, + {21, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 37} }, + {22, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 40} }, + {23, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 39} }, + {24, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 42} }, + {25, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 41} }, + {26, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 44} }, + {27, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 43} }, + {28, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 50} }, + {29, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 49} }, + {30, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 52} }, + {31, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 51} }, + {32, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 54} }, + {33, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 53} }, + {34, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 56} }, + {35, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 55} }, + {36, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 66} }, + {37, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 65} }, + {38, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 68} }, + {39, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 67} }, + {40, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 70} }, + {41, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 69} }, + {42, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 72} }, + {43, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 71} }, + {44, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 82} }, + {45, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 81} }, + {46, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 84} }, + {47, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 83} }, + {48, 59, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {49, 58, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {50, 61, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {51, 60, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {52, 63, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + {53, 62, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, +}; +#endif + + +/* ========================================== + * Cypress Layout configuration (BaiDu version) + * ========================================== + */ +#ifdef SWPS_CYPRESS_BAI +unsigned cypress_b_gpio_rest_mux = MUX_RST_GPIO_FORCE_HEDERA; + +struct inv_ioexp_layout_s cypress_b_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_CYPRESS_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {1, IOEXP_TYPE_CYPRESS_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {2, IOEXP_TYPE_CYPRESS_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {3, IOEXP_TYPE_CYPRESS_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {4, IOEXP_TYPE_CYPRESS_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {5, IOEXP_TYPE_CYPRESS_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {6, IOEXP_TYPE_CYPRESS_7ABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xc0, 0xc0}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xc0, 0xc0}, {0xff, 0xc0}, }, /* addr[1] = I/O Expander 7 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + +struct inv_port_layout_s cypress_b_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 1, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 2} }, + { 2, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 1} }, + { 3, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 4} }, + { 4, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 3} }, + { 5, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 6} }, + { 6, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 5} }, + { 7, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 8} }, + { 8, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 7} }, + { 9, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 10} }, + {10, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 9} }, + {11, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 12} }, + {12, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 11} }, + {13, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 22} }, + {14, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 21} }, + {15, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 24} }, + {16, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 23} }, + {17, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 34} }, + {18, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 33} }, + {19, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 36} }, + {20, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 35} }, + {21, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 38} }, + {22, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 37} }, + {23, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 40} }, + {24, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 39} }, + {25, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 42} }, + {26, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 41} }, + {27, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 44} }, + {28, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 43} }, + {29, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 50} }, + {30, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 49} }, + {31, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 52} }, + {32, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 51} }, + {33, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 54} }, + {34, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 53} }, + {35, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 56} }, + {36, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 55} }, + {37, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 66} }, + {38, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 65} }, + {39, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 68} }, + {40, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 67} }, + {41, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 70} }, + {42, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 69} }, + {43, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 72} }, + {44, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 71} }, + {45, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 82} }, + {46, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 81} }, + {47, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 84} }, + {48, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 83} }, + {49, 59, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {50, 58, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {51, 61, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {52, 60, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {53, 63, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + {54, 62, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, +}; +#endif + + +/* ========================================== + * Redwood_fsl Layout configuration + * ========================================== + */ +#ifdef SWPS_REDWOOD_FSL +unsigned redwood_fsl_gpio_rest_mux = MUX_RST_GPIO_48_PAC9548; + +struct inv_ioexp_layout_s redwood_fsl_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_REDWOOD_P01P08, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {1, IOEXP_TYPE_REDWOOD_P09P16, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {2, IOEXP_TYPE_REDWOOD_P01P08, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {3, IOEXP_TYPE_REDWOOD_P09P16, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, +}; + + +struct inv_port_layout_s redwood_fsl_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 22, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} }, + { 1, 23, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} }, + { 2, 24, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} }, + { 3, 25, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} }, + { 4, 26, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} }, + { 5, 27, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} }, + { 6, 28, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} }, + { 7, 29, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} }, + { 8, 30, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} }, + { 9, 31, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} }, + {10, 32, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} }, + {11, 33, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} }, + {12, 34, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} }, + {13, 35, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, + {14, 36, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} }, + {15, 37, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} }, + {16, 6, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, + {17, 7, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, + {18, 8, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} }, + {19, 9, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} }, + {20, 10, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, + {21, 11, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {22, 12, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} }, + {23, 13, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} }, + {24, 14, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {25, 15, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {26, 16, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {27, 17, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, + {28, 18, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113,114,115,116} }, + {29, 19, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + {30, 20, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121,122,123,124} }, + {31, 21, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125,126,127,128} }, +}; +#endif + + +/* ========================================== + * Tahoe Layout configuration + * ========================================== + */ +#ifdef SWPS_TAHOE +unsigned tahoe_gpio_rest_mux = MUX_RST_GPIO_249_PCA9548; + +struct inv_ioexp_layout_s tahoe_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_TAHOE_6ABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xce, 0xb9}, {0x18, 0xe3}, }, /* addr[0] = I/O Expander 6 A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xce, 0xb9}, {0x18, 0xe3}, }, /* addr[1] = I/O Expander 6 B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xce, 0xb9}, {0x18, 0xe3}, }, }, /* addr[2] = I/O Expander 6 C */ + }, + {1, IOEXP_TYPE_TAHOE_5A, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xce, 0xb9}, {0x18, 0xe3}, }, }, /* addr[0] = I/O Expander 5 A */ + }, +}; + + +struct inv_port_layout_s tahoe_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 12, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, + { 1, 11, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, + { 2, 22, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, + { 3, 21, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, + { 4, 24, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99, 100} }, + { 5, 23, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + { 6, 18, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101, 102, 103, 104} }, + { 7, 17, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105, 106, 107, 108} }, + { 8, 20, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113, 114, 115, 116} }, + { 9, 19, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109, 110, 111, 112} }, +}; +#endif + + +/* ========================================== + * Sequoia Layout configuration + * ========================================== + */ +#ifdef SWPS_SEQUOIA +unsigned sequoia_gpio_rest_mux = MUX_RST_GPIO_69_PAC9548; + +struct inv_ioexp_layout_s sequoia_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_SEQUOIA_NABC, { {1, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 0 A */ + {1, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 0 B */ + {1, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0 C */ + }, + {1, IOEXP_TYPE_SEQUOIA_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 1 A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 1 B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 1 C */ + }, + {2, IOEXP_TYPE_SEQUOIA_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 2 A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 2 B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 2 C */ + }, + {3, IOEXP_TYPE_SEQUOIA_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 3 A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 3 B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 3 C */ + }, + {4, IOEXP_TYPE_SEQUOIA_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 4 A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 4 B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 4 C */ + }, + {5, IOEXP_TYPE_SEQUOIA_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 5 A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 5 B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 C */ + }, + {6, IOEXP_TYPE_SEQUOIA_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 6 A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 6 B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 6 C */ + }, + {7, IOEXP_TYPE_SEQUOIA_NABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 7 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + + +struct inv_port_layout_s sequoia_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 9, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} }, + { 1, 10, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} }, + { 2, 11, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} }, + { 3, 12, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} }, + { 4, 13, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} }, + { 5, 14, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} }, + { 6, 15, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} }, + { 7, 16, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} }, + { 8, 17, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} }, + { 9, 18, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, + {10, 19, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} }, + {11, 20, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, + {12, 21, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105, 106, 107, 108} }, + {13, 22, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99, 100} }, + {14, 23, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121, 122, 123, 124} }, + {15, 24, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113, 114, 115, 116} }, + {16, 25, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {137, 138, 139, 140} }, + {17, 26, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {129, 130, 131, 132} }, + {18, 27, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {153, 154, 155, 156} }, + {19, 28, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {145, 146, 147, 148} }, + {20, 29, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {169, 170, 171, 172} }, + {21, 30, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {161, 162, 163, 164} }, + {22, 31, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {185, 186, 187, 188} }, + {23, 32, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {177, 178, 179, 180} }, + {24, 33, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {201, 202, 203, 204} }, + {25, 34, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {193, 194, 195, 196} }, + {26, 35, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {217, 218, 219, 220} }, + {27, 36, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {209, 210, 211, 212} }, + {28, 37, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {233, 234, 235, 236} }, + {29, 38, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {225, 226, 227, 228} }, + {30, 39, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {249, 250, 251, 252} }, + {31, 40, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {241, 242, 243, 244} }, + {32, 44, 4, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} }, + {33, 43, 4, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} }, + {34, 42, 4, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} }, + {35, 41, 4, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} }, + {36, 48, 4, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} }, + {37, 47, 4, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} }, + {38, 46, 4, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} }, + {39, 45, 4, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, + {40, 52, 5, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} }, + {41, 51, 5, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, + {42, 50, 5, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} }, + {43, 49, 5, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {44, 56, 5, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109, 110, 111, 112} }, + {45, 55, 5, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101, 102, 103, 104} }, + {46, 54, 5, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125, 126, 127, 128} }, + {47, 53, 5, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117, 118, 119, 120} }, + {48, 60, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {141, 142, 143, 144} }, + {49, 59, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {133, 134, 135, 136} }, + {50, 58, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {157, 158, 159, 160} }, + {51, 57, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {149, 150, 151, 152} }, + {52, 64, 6, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {173, 174, 175, 176} }, + {53, 63, 6, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {165, 166, 167, 168} }, + {54, 62, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {189, 190, 191, 192} }, + {55, 61, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {181, 182, 183, 184} }, + {56, 68, 7, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {205, 206, 207, 208} }, + {57, 67, 7, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {197, 198, 199, 200} }, + {58, 66, 7, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {221, 222, 223, 224} }, + {59, 65, 7, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {213, 214, 215, 216} }, + {60, 72, 7, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {237, 238, 239, 240} }, + {61, 71, 7, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {229, 230, 231, 232} }, + {62, 70, 7, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {253, 254, 255, 256} }, + {63, 69, 7, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {245, 246, 247, 248} }, +}; +#endif + + +/* ========================================== + * Lavender Layout configuration + * ========================================== + */ +#if (PLATFORM_SETTINGS == PLATFORM_TYPE_LAVENDER_GA) +unsigned lavender_gpio_rest_mux = MUX_RST_GPIO_505_PCA9548; +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_LAVENDER_ONL) +unsigned lavender_gpio_rest_mux = MUX_RST_GPIO_69_PAC9548; +#endif + +#ifdef SWPS_LAVENDER +struct inv_ioexp_layout_s lavender_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_SEQUOIA_NABC, { { 1, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 0 A */ + { 1, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 0 B */ + { 1, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0 C */ + }, + {1, IOEXP_TYPE_SEQUOIA_NABC, { { 2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 1 A */ + { 2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 1 B */ + { 2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 1 C */ + }, + {2, IOEXP_TYPE_SEQUOIA_NABC, { { 3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 2 A */ + { 3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 2 B */ + { 3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 2 C */ + }, + {3, IOEXP_TYPE_SEQUOIA_NABC, { { 4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 3 A */ + { 4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 3 B */ + { 4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 3 C */ + }, + {4, IOEXP_TYPE_SEQUOIA_NABC, { { 9, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 4 A */ + { 9, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 4 B */ + { 9, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 4 C */ + }, + {5, IOEXP_TYPE_SEQUOIA_NABC, { {10, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 5 A */ + {10, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 5 B */ + {10, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 C */ + }, + {6, IOEXP_TYPE_SEQUOIA_NABC, { {11, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 6 A */ + {11, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 6 B */ + {11, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 6 C */ + }, + {7, IOEXP_TYPE_SEQUOIA_NABC, { {12, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 7 A */ + {12, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 7 B */ + {12, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, + {8, IOEXP_TYPE_LAVENDER_P65, { { 5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xF6, 0xff}, {0xF8, 0xff}, }, }, /* addr[0] = I/O Expander CPU */ + }, +}; + + +struct inv_port_layout_s lavender_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 17, 0, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {188, 189, 190, 191} }, + { 1, 18, 0, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {184, 185, 186, 187} }, + { 2, 19, 0, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {180, 181, 182, 183} }, + { 3, 20, 0, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {176, 177, 178, 179} }, + { 4, 21, 0, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {172, 173, 174, 175} }, + { 5, 22, 0, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {168, 169, 170, 171} }, + { 6, 23, 0, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {164, 165, 166, 167} }, + { 7, 24, 0, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {160, 161, 162, 163} }, + { 8, 25, 1, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {156, 157, 158, 159} }, + { 9, 26, 1, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {152, 153, 154, 155} }, + {10, 27, 1, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {148, 149, 150, 151} }, + {11, 28, 1, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {144, 145, 146, 147} }, + {12, 29, 1, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {140, 141, 142, 143} }, + {13, 30, 1, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {136, 137, 138, 139} }, + {14, 31, 1, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {132, 133, 134, 135} }, + {15, 32, 1, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {128, 129, 130, 131} }, + {16, 33, 2, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 0, 1, 2, 3} }, + {17, 34, 2, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 4, 5, 6, 7} }, + {18, 35, 2, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 8, 9, 10, 11} }, + {19, 36, 2, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 12, 13, 14, 15} }, + {20, 37, 2, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 16, 17, 18, 19} }, + {21, 38, 2, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 20, 21, 22, 23} }, + {22, 39, 2, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 24, 25, 26, 27} }, + {23, 40, 2, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 28, 29, 30, 31} }, + {24, 41, 3, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 32, 33, 34, 35} }, + {25, 42, 3, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 36, 37, 38, 39} }, + {26, 43, 3, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 40, 41, 42, 43} }, + {27, 44, 3, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 44, 45, 46, 47} }, + {28, 45, 3, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 48, 49, 50, 51} }, + {29, 46, 3, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 52, 53, 54, 55} }, + {30, 47, 3, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 56, 57, 58, 59} }, + {31, 48, 3, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 60, 61, 62, 63} }, + {32, 49, 4, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {256, 257, 258, 259} }, + {33, 50, 4, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {260, 261, 262, 263} }, + {34, 51, 4, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {264, 265, 266, 267} }, + {35, 52, 4, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {268, 269, 270, 271} }, + {36, 53, 4, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {272, 273, 274, 275} }, + {37, 54, 4, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {276, 277, 278, 279} }, + {38, 55, 4, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {280, 281, 282, 283} }, + {39, 56, 4, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {284, 285, 286, 287} }, + {40, 57, 5, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {288, 289, 290, 291} }, + {41, 58, 5, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {292, 293, 294, 295} }, + {42, 59, 5, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {296, 297, 298, 299} }, + {43, 60, 5, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {300, 301, 302, 303} }, + {44, 61, 5, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {304, 305, 306, 307} }, + {45, 62, 5, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {308, 309, 310, 311} }, + {46, 63, 5, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {312, 313, 314, 315} }, + {47, 64, 5, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {316, 317, 318, 319} }, + {48, 65, 6, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {444, 445, 446, 447} }, + {49, 66, 6, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {440, 441, 442, 443} }, + {50, 67, 6, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {436, 437, 438, 439} }, + {51, 68, 6, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {432, 433, 434, 435} }, + {52, 69, 6, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {428, 429, 430, 431} }, + {53, 70, 6, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {424, 425, 426, 427} }, + {54, 71, 6, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {420, 421, 422, 423} }, + {55, 72, 6, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {416, 417, 418, 419} }, + {56, 73, 7, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {412, 413, 414, 415} }, + {57, 74, 7, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {408, 409, 410, 411} }, + {58, 75, 7, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {404, 405, 406, 407} }, + {59, 76, 7, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {400, 401, 402, 403} }, + {60, 77, 7, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {396, 397, 398, 399} }, + {61, 78, 7, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {392, 393, 394, 395} }, + {62, 79, 7, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {388, 389, 390, 391} }, + {63, 80, 7, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {384, 385, 386, 387} }, + {64, 5, 8, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 64, 65, 66, 67} }, +}; +#endif + + +#endif /* INV_SWPS_H */ + + + + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/io_expander.c b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/io_expander.c new file mode 100644 index 000000000000..9f1bbd0e4f2f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/io_expander.c @@ -0,0 +1,1885 @@ +/* + * 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 "io_expander.h" + +static struct ioexp_obj_s *ioexp_head_p = NULL; +static struct ioexp_obj_s *ioexp_tail_p = NULL; + + +/* ========== Register IOEXP layout ========== + */ +struct ioexp_map_s ioexp_map_magnolia_nab = { + + .chip_amount = 2, + .data_width = 2, + + .map_present = { {0, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {1, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {1, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_tx_disable = { {0, 1, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 1, 1}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 2}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 3}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + {1, 1, 0}, /* map_tx_disable[4] = TXDISABLE_SFP+_P(X+4) */ + {1, 1, 1}, /* map_tx_disable[5] = TXDISABLE_SFP+_P(X+5) */ + {1, 1, 2}, /* map_tx_disable[6] = TXDISABLE_SFP+_P(X+6) */ + {1, 1, 3}, /* map_tx_disable[7] = TXDISABLE_SFP+_P(X+7) */ + }, + .map_tx_fault = { {0, 0, 0}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 0, 1}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 0, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 0, 3}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + {1, 0, 0}, /* map_tx_fault[4] = TXFAULT_SFP+_P(X+4) */ + {1, 0, 1}, /* map_tx_fault[5] = TXFAULT_SFP+_P(X+5) */ + {1, 0, 2}, /* map_tx_fault[6] = TXFAULT_SFP+_P(X+6) */ + {1, 0, 3}, /* map_tx_fault[7] = TXFAULT_SFP+_P(X+7) */ + }, + .map_rxlos = { {0, 1, 4}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 1, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 1, 6}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 1, 7}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + {1, 1, 4}, /* map_rxlos[4] = OPRXLOS_PORT(X+4) */ + {1, 1, 5}, /* map_rxlos[5] = OPRXLOS_PORT(X+5) */ + {1, 1, 6}, /* map_rxlos[6] = OPRXLOS_PORT(X+6) */ + {1, 1, 7}, /* map_rxlos[7] = OPRXLOS_PORT(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_magnolia_4ab = { + + .chip_amount = 2, + .data_width = 2, + + .map_present = { {0, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {1, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {1, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_tx_disable = { {0, 1, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 1, 1}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 2}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 3}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + {1, 0, 0}, /* map_tx_disable[4] = TXDISABLE_SFP+_P(X+4) */ + {1, 0, 1}, /* map_tx_disable[5] = TXDISABLE_SFP+_P(X+5) */ + {1, 0, 2}, /* map_tx_disable[6] = TXDISABLE_SFP+_P(X+6) */ + {1, 0, 3}, /* map_tx_disable[7] = TXDISABLE_SFP+_P(X+7) */ + }, + .map_tx_fault = { {0, 0, 0}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 0, 1}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 0, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 0, 3}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + {1, 1, 0}, /* map_tx_fault[4] = TXFAULT_SFP+_P(X+4) */ + {1, 1, 1}, /* map_tx_fault[5] = TXFAULT_SFP+_P(X+5) */ + {1, 1, 2}, /* map_tx_fault[6] = TXFAULT_SFP+_P(X+6) */ + {1, 1, 3}, /* map_tx_fault[7] = TXFAULT_SFP+_P(X+7) */ + }, + .map_rxlos = { {0, 1, 4}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 1, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 1, 6}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 1, 7}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + {1, 1, 4}, /* map_rxlos[4] = OPRXLOS_PORT(X+4) */ + {1, 1, 5}, /* map_rxlos[5] = OPRXLOS_PORT(X+5) */ + {1, 1, 6}, /* map_rxlos[6] = OPRXLOS_PORT(X+6) */ + {1, 1, 7}, /* map_rxlos[7] = OPRXLOS_PORT(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_magnolia_7ab = { + + .chip_amount = 2, + .data_width = 2, + + .map_present = { {1, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {1, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {1, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {1, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP_N_P(X+5) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP_P(X+3) */ + {1, 0, 2}, /* map_lpmod[4] = LPMODE_QSFP_P(X+4) */ + {1, 0, 3}, /* map_lpmod[5] = LPMODE_QSFP_P(X+5) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP_N_P(X+5) */ + }, +}; + + +struct ioexp_map_s ioexp_map_redwood_p01p08_p17p24 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 0, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 0, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_redwood_p09p16_p25p32 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 1, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 1, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 1, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 1, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_hudson32iga_p01p08_p17p24 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MODABS_QSFP(X) */ + {2, 0, 1}, /* map_present[1] = MODABS_QSFP(X+1) */ + {2, 0, 2}, /* map_present[2] = MODABS_QSFP(X+2) */ + {2, 0, 3}, /* map_present[3] = MODABS_QSFP(X+3) */ + {2, 0, 4}, /* map_present[4] = MODABS_QSFP(X+4) */ + {2, 0, 5}, /* map_present[5] = MODABS_QSFP(X+5) */ + {2, 0, 6}, /* map_present[6] = MODABS_QSFP(X+6) */ + {2, 0, 7}, /* map_present[7] = MODABS_QSFP(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_hudson32iga_p09p16_p25p32 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MODABS_QSFP(X) */ + {2, 1, 1}, /* map_present[1] = MODABS_QSFP(X+1) */ + {2, 1, 2}, /* map_present[2] = MODABS_QSFP(X+2) */ + {2, 1, 3}, /* map_present[3] = MODABS_QSFP(X+3) */ + {2, 1, 4}, /* map_present[4] = MODABS_QSFP(X+4) */ + {2, 1, 5}, /* map_present[5] = MODABS_QSFP(X+5) */ + {2, 1, 6}, /* map_present[6] = MODABS_QSFP(X+6) */ + {2, 1, 7}, /* map_present[7] = MODABS_QSFP(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_cypress_nabc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {0, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {1, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {1, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_tx_disable = { {0, 1, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 1, 1}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 2}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 3}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + {1, 1, 0}, /* map_tx_disable[4] = TXDISABLE_SFP+_P(X+4) */ + {1, 1, 1}, /* map_tx_disable[5] = TXDISABLE_SFP+_P(X+5) */ + {1, 1, 2}, /* map_tx_disable[6] = TXDISABLE_SFP+_P(X+6) */ + {1, 1, 3}, /* map_tx_disable[7] = TXDISABLE_SFP+_P(X+7) */ + }, + .map_tx_fault = { {0, 0, 0}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 0, 1}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 0, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 0, 3}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + {1, 0, 0}, /* map_tx_fault[4] = TXFAULT_SFP+_P(X+4) */ + {1, 0, 1}, /* map_tx_fault[5] = TXFAULT_SFP+_P(X+5) */ + {1, 0, 2}, /* map_tx_fault[6] = TXFAULT_SFP+_P(X+6) */ + {1, 0, 3}, /* map_tx_fault[7] = TXFAULT_SFP+_P(X+7) */ + }, + .map_rxlos = { {0, 1, 4}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 1, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 1, 6}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 1, 7}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + {1, 1, 4}, /* map_rxlos[4] = OPRXLOS_PORT(X+4) */ + {1, 1, 5}, /* map_rxlos[5] = OPRXLOS_PORT(X+5) */ + {1, 1, 6}, /* map_rxlos[6] = OPRXLOS_PORT(X+6) */ + {1, 1, 7}, /* map_rxlos[7] = OPRXLOS_PORT(X+7) */ + }, + .map_hard_rs0 = { {2, 0, 0}, /* map_hard_rs0[0] = RS0_SFP28_P(X) */ + {2, 0, 2}, /* map_hard_rs0[1] = RS0_SFP28_P(X+1) */ + {2, 0, 4}, /* map_hard_rs0[2] = RS0_SFP28_P(X+2) */ + {2, 0, 6}, /* map_hard_rs0[3] = RS0_SFP28_P(X+3) */ + {2, 1, 0}, /* map_hard_rs0[4] = RS0_SFP28_P(X+4) */ + {2, 1, 2}, /* map_hard_rs0[5] = RS0_SFP28_P(X+5) */ + {2, 1, 4}, /* map_hard_rs0[6] = RS0_SFP28_P(X+6) */ + {2, 1, 6}, /* map_hard_rs0[7] = RS0_SFP28_P(X+7) */ + }, + .map_hard_rs1 = { {2, 0, 1}, /* map_hard_rs1[0] = RS1_SFP28_P(X) */ + {2, 0, 3}, /* map_hard_rs1[1] = RS1_SFP28_P(X+1) */ + {2, 0, 5}, /* map_hard_rs1[2] = RS1_SFP28_P(X+2) */ + {2, 0, 7}, /* map_hard_rs1[3] = RS1_SFP28_P(X+3) */ + {2, 1, 1}, /* map_hard_rs1[4] = RS1_SFP28_P(X+4) */ + {2, 1, 3}, /* map_hard_rs1[5] = RS1_SFP28_P(X+5) */ + {2, 1, 5}, /* map_hard_rs1[6] = RS1_SFP28_P(X+6) */ + {2, 1, 7}, /* map_hard_rs1[7] = RS1_SFP28_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_cypress_7abc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 0, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 0, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP_N_P(X+3) */ + {0, 0, 4}, /* map_reset[4] = QRESET_QSFP_N_P(X+4) */ + {0, 0, 5}, /* map_reset[5] = QRESET_QSFP_N_P(X+5) */ + }, + .map_lpmod = { {0, 1, 0}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {0, 1, 1}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {0, 1, 2}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + {0, 1, 3}, /* map_lpmod[3] = LPMODE_QSFP_P(X+3) */ + {0, 1, 4}, /* map_lpmod[4] = LPMODE_QSFP_P(X+4) */ + {0, 1, 5}, /* map_lpmod[5] = LPMODE_QSFP_P(X+5) */ + }, + .map_modsel = { {1, 1, 0}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {1, 1, 1}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {1, 1, 2}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + {1, 1, 3}, /* map_modsel[3] = MODSEL_QSFP_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP_N_P(X+5) */ + }, +}; + + +struct ioexp_map_s ioexp_map_tahoe_5a = { + + .chip_amount = 1, + .data_width = 2, + + .map_present = { {0, 0, 3}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 1, 0}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 1, 5}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + }, + .map_reset = { {0, 0, 1}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 0, 6}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 1, 3}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + }, + .map_lpmod = { {0, 0, 2}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {0, 0, 7}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {0, 1, 4}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + }, + .map_modsel = { {0, 0, 0}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {0, 0, 5}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {0, 1, 2}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + }, +}; + + +struct ioexp_map_s ioexp_map_tahoe_6abc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {0, 0, 3}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 1, 0}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 1, 5}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {1, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 1, 0}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 0, 3}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 0}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + {2, 1, 5}, /* map_present[8] = MOD_ABS_PORT(X+8) */ + }, + .map_reset = { {0, 0, 1}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 6}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 1, 3}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {1, 0, 1}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 6}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 1, 3}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {2, 0, 1}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {2, 0, 6}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + {2, 1, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 2}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 7}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 1, 4}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {1, 0, 2}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 7}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 1, 4}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {2, 0, 2}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {2, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + {2, 1, 4}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+8) */ + }, + .map_modsel = { {0, 0, 0}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 0, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 2}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {1, 0, 0}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 0, 5}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 2}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {2, 0, 0}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {2, 0, 5}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + {2, 1, 2}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_sequoia_nabc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 1, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 1, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 1, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 1, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 1, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 1, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 1, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 1, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {0, 1, 4}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {0, 1, 5}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {0, 1, 6}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {0, 1, 7}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {1, 0, 0}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {1, 0, 1}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {1, 0, 2}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {1, 0, 3}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 0, 0}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {0, 0, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {0, 0, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {0, 0, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {0, 0, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_lavender_p65 = { + + .chip_amount = 1, + .data_width = 1, + + .map_present = { {0, 0, 4}, }, /* map_present[0] = MOD_ABS_PORT(X) */ + .map_reset = { {0, 0, 1}, }, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + .map_lpmod = { {0, 0, 2}, }, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + .map_modsel = { {0, 0, 0}, }, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ +}; + + +/* ========== Private functions ========== + */ +int check_channel_tier_1(void); + +struct i2c_client * +_get_i2c_client(struct ioexp_obj_s *self, + int chip_id){ + + struct ioexp_i2c_s *i2c_curr_p = self->i2c_head_p; + + if (!(i2c_curr_p)){ + SWPS_ERR("%s: i2c_curr_p is NULL\n", __func__); + return NULL; + } + while (i2c_curr_p){ + if ((i2c_curr_p->chip_id) == chip_id){ + return i2c_curr_p->i2c_client_p; + } + i2c_curr_p = i2c_curr_p->next; + } + SWPS_ERR("%s: not exist! :%d\n", __func__, chip_id); + return NULL; +} + + +static int +_common_ioexp_update_one(struct ioexp_obj_s *self, + struct ioexp_addr_s *ioexp_addr, + int chip_id, + int data_width, + int show_err, + char *caller_name) { + int buf = 0; + int err = 0; + int data_id = 0; + int r_offset = 0; + + for(data_id=0; data_idread_offset[data_id]; + buf = i2c_smbus_read_byte_data(_get_i2c_client(self, chip_id), r_offset); + /* Check error */ + if (buf < 0) { + err = 1; + if (show_err) { + SWPS_INFO("IOEXP-%d read fail! :%d \n", self->ioexp_id, buf); + SWPS_INFO("Dump: :%d :0x%02x :%d, :%s\n", + ioexp_addr->chan_id, ioexp_addr->chip_addr, + ioexp_addr->read_offset[data_id], caller_name); + } + continue; + } + /* Update IOEXP object */ + self->chip_data[chip_id].data[data_id] = (uint8_t)buf; + } + if (err) { + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +static int +common_ioexp_update_all(struct ioexp_obj_s *self, + int show_err, + char *caller_name){ + + int err = 0; + int chip_id = 0; + int chip_amount = self->ioexp_map_p->chip_amount; + + for (chip_id=0; chip_idioexp_map_p->map_addr[chip_id]), + chip_id, + self->ioexp_map_p->data_width, + show_err, + caller_name) < 0) { + err = 1; + } + } + if (err) { + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +static int +_common_check_by_mode(struct ioexp_obj_s *self){ + + switch (self->mode){ + case IOEXP_MODE_DIRECT: + return self->fsm_4_direct(self); + + case IOEXP_MODE_POLLING: + if (self->state >= 0){ + return 0; + } + switch (self->state){ + case STATE_IOEXP_INIT: + return ERR_IOEXP_UNINIT; + case STATE_IOEXP_ABNORMAL: + return ERR_IOEXP_ABNORMAL; + default: + return ERR_IOEXP_NOSTATE; + } + break; + + default: + break; + } + SWPS_ERR("%s: Exception occurs. :%d \n", __func__, self->mode); + return ERR_IOEXP_UNEXCPT; +} + + +static int +_common_get_bit(struct ioexp_obj_s *self, + struct ioexp_bitmap_s *bitmap_obj_p, + char *func_mane){ + uint8_t buf; + int err_code; + + /* Check and get address */ + err_code = _common_check_by_mode(self); + if (err_code < 0){ + return err_code; + } + if (!bitmap_obj_p){ + SWPS_ERR("Layout config incorrect! :%d :%s\n", + self->ioexp_id, func_mane); + return ERR_IOEXP_BADCONF; + } + /* Get data form cache */ + buf = self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset]; + return (int)(buf >> bitmap_obj_p->bit_shift & 0x01); +} + + +static int +_common_set_bit(struct ioexp_obj_s *self, + struct ioexp_bitmap_s *bitmap_obj_p, + int input_val, + char *func_mane){ + int err_code, target_offset; + uint8_t origin_byte; + uint8_t modify_byte; + + /* Check and get address */ + err_code = _common_check_by_mode(self); + if (err_code < 0){ + return err_code; + } + if (!bitmap_obj_p){ + SWPS_ERR("Layout config incorrect! :%d :%s\n", + self->ioexp_id, func_mane); + return ERR_IOEXP_BADCONF; + } + /* Prepare write date */ + origin_byte = self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset]; + switch (input_val) { + case 0: + modify_byte = origin_byte; + SWP_BIT_CLEAR(modify_byte, bitmap_obj_p->bit_shift); + break; + case 1: + modify_byte = origin_byte; + SWP_BIT_SET(modify_byte, bitmap_obj_p->bit_shift); + break; + default: + SWPS_ERR("Input value incorrect! :%d :%d :%s\n", + input_val, self->ioexp_id, func_mane); + return ERR_IOEXP_BADINPUT; + } + /* Setup i2c client */ + target_offset = self->ioexp_map_p->map_addr[bitmap_obj_p->chip_id].write_offset[bitmap_obj_p->ioexp_voffset]; + /* Write byte to chip via I2C */ + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, bitmap_obj_p->chip_id), + target_offset, + modify_byte); + /* Update or bollback object */ + if (err_code < 0){ + self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset] = origin_byte; + SWPS_ERR("I2C write fail! :%d :%d :%s :%d\n", + input_val, self->ioexp_id, func_mane, err_code); + return err_code; + } + self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset] = modify_byte; + return 0; +} + + +/* ========== Object public functions ========== + */ +int +common_get_present(struct ioexp_obj_s *self, + int virt_offset){ + + int UNPLUG = 1; + int retval = ERR_IOEXP_UNEXCPT; + + retval = _common_get_bit(self, + &(self->ioexp_map_p->map_present[virt_offset]), + "common_get_present"); + if (retval < 0) { + /* [Note] + * => Transceiver object does not need to handle IOEXP layer issues. + */ + return UNPLUG; + } + return retval; +} + + +int +common_get_tx_fault(struct ioexp_obj_s *self, + int virt_offset){ + /* [Transmit Fault (Tx_Fault)] + * A catastrophic laser fault will activate the transmitter signal, + * TX_FAULT, and disable the laser. This signal is an open collector + * output (pull-up required on the host board). A low signal indicates + * normal laser operation and a high signal indicates a fault. The + * TX_FAULT will be latched high when a laser fault occurs and is + * cleared by toggling the TX_DISABLE input or power cycling the + * transceiver. The transmitter fault condition can also be monitored + * via the two-wire serial interface. + * (address A2, byte 110, bit 2). + * + * 0: Normal + * 1: Abnormal + */ + return _common_get_bit(self, + &(self->ioexp_map_p->map_tx_fault[virt_offset]), + "common_get_tx_fault"); +} + + +int +common_get_rxlos(struct ioexp_obj_s *self, + int virt_offset){ + /* [Receiver Loss of Signal (Rx_LOS)] + * The post-amplification IC also includes transition detection circuitry + * which monitors the ac level of incoming optical signals and provides a + * TTL/CMOS compatible status signal to the host (pin 8). An adequate optical + * input results in a low Rx_LOS output while a high Rx_LOS output indicates + * an unusable optical input. The Rx_LOS thresholds are factory set so that + * a high output indicates a definite optical fault has occurred. Rx_LOS can + * also be monitored via the two-wire serial interface + * (address A2h, byte 110, bit 1). + * + * 0: Normal + * 1: Abnormal + */ + return _common_get_bit(self, + &(self->ioexp_map_p->map_rxlos[virt_offset]), + "common_get_rxlos"); +} + + +int +common_get_tx_disable(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_tx_disable[virt_offset]), + "common_get_tx_disable"); +} + + +int +common_get_reset(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_reset[virt_offset]), + "common_get_reset"); +} + + +int +common_get_lpmod(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_lpmod[virt_offset]), + "common_get_lpmod"); +} + + +int +common_get_modsel(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_modsel[virt_offset]), + "common_get_modsel"); +} + + +int +common_get_hard_rs0(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_hard_rs0[virt_offset]), + "common_get_hard_rs0"); +} + + +int +common_get_hard_rs1(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_hard_rs1[virt_offset]), + "common_get_hard_rs1"); +} + + +int +common_set_tx_disable(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_tx_disable[virt_offset]), + input_val, + "common_set_tx_disable"); +} + + +int +common_set_reset(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_reset[virt_offset]), + input_val, + "common_set_reset"); +} + + +int +common_set_lpmod(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_lpmod[virt_offset]), + input_val, + "common_set_lpmod"); +} + + +int +common_set_modsel(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_modsel[virt_offset]), + input_val, + "common_set_modsel"); +} + + +int +common_set_hard_rs0(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_hard_rs0[virt_offset]), + input_val, + "common_set_hard_rs0"); +} + + +int +common_set_hard_rs1(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_hard_rs1[virt_offset]), + input_val, + "common_set_hard_rs1"); +} + + +int +ioexp_get_not_support(struct ioexp_obj_s *self, + int virt_offset){ + return ERR_IOEXP_NOTSUPPORT; +} + + +int +ioexp_set_not_support(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + return ERR_IOEXP_NOTSUPPORT; +} + + +int +fake_ioexp_init(struct ioexp_obj_s *self){ + return 1; +} + +int +fake_ioexp_update(struct ioexp_obj_s *self){ + return 1; +} + + +int +fake_update_func(struct ioexp_obj_s *self){ + return 1; +} + +int +fake_get_func(struct ioexp_obj_s *self, + int virt_offset){ + SWPS_WARN("Someone called fake_get_func\n"); + return -1; +} + +int +fake_set_func(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + SWPS_WARN("Someone called fake_set_func\n"); + return -1; +} + + +/* ========== Initial functions for IO Expander ========== + */ +int +common_ioexp_init(struct ioexp_obj_s *self) { + + int chip_id, offset, err_code; + struct ioexp_addr_s *addr_p; + + if (self->mode == IOEXP_MODE_DIRECT) { + goto update_common_ioexp_init; + } + /* Setup default value to each physical IO Expander */ + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + /* Get address mapping */ + addr_p = &(self->ioexp_map_p->map_addr[chip_id]); + if (!addr_p){ + SWPS_ERR("%s: IOEXP config incorrect! :%d \n", + __func__, chip_id); + return -1; + } + /* Setup default value */ + for (offset=0; offset<(self->ioexp_map_p->data_width); offset++){ + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, chip_id), + addr_p->write_offset[offset], + addr_p->data_default[offset]); + if (err_code < 0){ + SWPS_ERR("%s: set default fail! :%d \n", + __func__, err_code); + return ERR_IOEXP_UNEXCPT; + } + } + } +update_common_ioexp_init: + /* Check and update info to object */ + err_code = self->update_all(self, 1, "common_ioexp_init"); + if (err_code < 0) { + SWPS_ERR("%s: update_all() fail! :%d \n", + __func__, err_code); + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +/* ========== Object functions for Final State Machine ========== + */ +int +_is_channel_ready(struct ioexp_obj_s *self){ + + int buf = 0; + int chip_id = 0; /* Use first chip which be registered */ + int data_id = 0; /* Use first byte which be registered */ + struct ioexp_addr_s *ioexp_addr = NULL; + + ioexp_addr = &(self->ioexp_map_p->map_addr[chip_id]); + if (!ioexp_addr){ + SWPS_ERR("%s: config incorrect!\n", __func__); + return ERR_IOEXP_UNEXCPT; + } + buf = i2c_smbus_read_byte_data(_get_i2c_client(self, chip_id), + ioexp_addr->read_offset[data_id]); + if (buf >= 0){ + return 1; + } + return 0; +} + +int +_ioexp_init_handler(struct ioexp_obj_s *self){ + + int return_val; + + switch (self->mode) { + case IOEXP_MODE_DIRECT: + return_val = self->init(self); + if (return_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + } else { + self->state = STATE_IOEXP_NORMAL; + } + return return_val; + + case IOEXP_MODE_POLLING: + /* Check system and channel is ready */ + if (self->state == STATE_IOEXP_INIT){ + if (!_is_channel_ready(self)){ + self->state = STATE_IOEXP_INIT; + SWPS_WARN("%s: IOEXP:%d channel not ready.\n", + __func__, self->ioexp_id); + return 0; + } + } + /* Execute initial callback */ + return_val = self->init(self); + if (return_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + } else { + self->state = STATE_IOEXP_NORMAL; + } + return return_val; + + default: + break; + } + SWPS_ERR("%s: exception occur :%d\n", __func__, self->mode); + return ERR_IOEXP_UNEXCPT; +} + + +int +common_ioexp_fsm_4_direct(struct ioexp_obj_s *self){ + + int result_val; + int show_err = 1; + char *func_mane = "common_ioexp_fsm_4_direct"; + + switch (self->state){ + case STATE_IOEXP_INIT: + result_val = _ioexp_init_handler(self); + /* Exception case: terminate initial procedure */ + if(result_val < 0){ + /* Initial fail */ + return result_val; + } + if(self->state == STATE_IOEXP_INIT){ + /* Keep in INIT state, and return error */ + return ERR_IOEXP_UNINIT; + } + /* Case: Initial done */ + return 0; + + case STATE_IOEXP_NORMAL: + result_val = self->update_all(self, show_err, func_mane); + if (result_val < 0){ + SWPS_INFO("%s: NORMAL -> ABNORMAL :%d\n", + __func__, result_val); + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + self->state = STATE_IOEXP_NORMAL; + return 0; + + case STATE_IOEXP_ABNORMAL: + result_val = self->update_all(self, show_err, func_mane); + if (result_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + SWPS_DEBUG("%s: ABNORMAL -> NORMAL :%d\n", + __func__, result_val); + self->state = STATE_IOEXP_NORMAL; + return 0; + + default: + break; + } + SWPS_ERR("%s: Exception occurs :%d\n", + __func__, self->state); + return ERR_IOEXP_UNEXCPT; +} + + +int +common_ioexp_fsm_4_polling(struct ioexp_obj_s *self){ + + int result_val, i, show_e; + int fail_retry = 3; + char *func_name = "common_ioexp_fsm_4_polling"; + +#ifdef DEBUG_SWPS + show_e = 1; +#else + show_e = 0; +#endif + + switch (self->state){ + case STATE_IOEXP_INIT: + result_val = _ioexp_init_handler(self); + /* Exception case: terminate initial procedure */ + if(result_val < 0){ + /* Initial fail */ + return result_val; + } + /* Case: System (Channel) not ready */ + if(self->state == STATE_IOEXP_INIT){ + /* Keep in INIT state, wait and retry */ + return 0; + } + /* Case: Initial done */ + SWPS_INFO("IOEXP-%d: initial done. :%d\n", + self->ioexp_id, self->ioexp_type); + return result_val; + + case STATE_IOEXP_NORMAL: + /* Retry mechanism for case of i2c topology not stable */ + for (i=0; iupdate_all(self, show_e, func_name); + if (result_val >= 0) { + self->state = STATE_IOEXP_NORMAL; + return 0; + } + if (check_channel_tier_1() < 0) { + SWPS_INFO("%s: detect I2C crash :%d\n", + __func__, self->ioexp_id); + break; + } + SWPS_DEBUG("IOEXP-%d: unstable :%d\n", + self->ioexp_id, result_val); + } + SWPS_INFO("IOEXP-%d: NORMAL -> ABNORMAL :%d\n", + self->ioexp_id, result_val); + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + + case STATE_IOEXP_ABNORMAL: + result_val = self->update_all(self, show_e, func_name); + if (result_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + SWPS_INFO("IOEXP-%d: ABNORMAL -> NORMAL :%d\n", + self->ioexp_id, result_val); + self->state = STATE_IOEXP_NORMAL; + return 0; + + default: + break; + } + SWPS_ERR("IOEXP-%d: Exception occurs :%d\n", + self->ioexp_id, self->state); + return ERR_IOEXP_UNEXCPT; +} + + +/* ========== Object private functions for check & update ========== + */ +int +common_ioexp_check(struct ioexp_obj_s *self){ + + int result; + + if (self->mode != IOEXP_MODE_POLLING){ + SWPS_ERR("%s: not polling mode :%d\n", + __func__, self->mode); + return ERR_IOEXP_NOTSUPPORT; + } + mutex_lock(&self->lock); + result = self->fsm_4_polling(self); + mutex_unlock(&self->lock); + return result; +} + + +/* ========== Functions for Factory pattern ========== + */ +static struct ioexp_map_s * +get_ioexp_map(int ioexp_type){ + switch (ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + return &ioexp_map_magnolia_nab; + case IOEXP_TYPE_MAGINOLIA_4AB: + return &ioexp_map_magnolia_4ab; + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + return &ioexp_map_magnolia_7ab; + case IOEXP_TYPE_REDWOOD_P01P08: + return &ioexp_map_redwood_p01p08_p17p24; + case IOEXP_TYPE_REDWOOD_P09P16: + return &ioexp_map_redwood_p09p16_p25p32; + case IOEXP_TYPE_HUDSON32IGA_P01P08: + return &ioexp_map_hudson32iga_p01p08_p17p24; + case IOEXP_TYPE_HUDSON32IGA_P09P16: + return &ioexp_map_hudson32iga_p09p16_p25p32; + case IOEXP_TYPE_CYPRESS_NABC: + return &ioexp_map_cypress_nabc; + case IOEXP_TYPE_CYPRESS_7ABC: + return &ioexp_map_cypress_7abc; + case IOEXP_TYPE_TAHOE_5A: + return &ioexp_map_tahoe_5a; + case IOEXP_TYPE_TAHOE_6ABC: + return &ioexp_map_tahoe_6abc; + case IOEXP_TYPE_SEQUOIA_NABC: + return &ioexp_map_sequoia_nabc; + case IOEXP_TYPE_LAVENDER_P65: + return &ioexp_map_lavender_p65; + default: + return NULL; + } +} + + +int +setup_ioexp_ssize_attr(struct ioexp_obj_s *self, + struct ioexp_map_s *ioexp_map_p, + int ioexp_id, + int ioexp_type, + int run_mode){ + switch (run_mode){ + case IOEXP_MODE_POLLING: /* Direct access device mode */ + case IOEXP_MODE_DIRECT: /* Polling mode, read from cache */ + self->mode = run_mode; + break; + default: + SWPS_ERR("%s: non-defined run_mode:%d\n", + __func__, run_mode); + self->mode = ERR_IOEXP_UNEXCPT; + return ERR_IOEXP_UNEXCPT; + } + /* Setup mapping structure */ + self->ioexp_map_p = kzalloc(sizeof(*ioexp_map_p), GFP_KERNEL); + if (!(self->ioexp_map_p)) { + SWPS_ERR("%s: kzalloc ioexp_map_p fail\n", __func__); + return -1; + } + memcpy(self->ioexp_map_p, ioexp_map_p, sizeof(*ioexp_map_p)); + /* Setup attributes */ + self->ioexp_id = ioexp_id; + self->ioexp_type = ioexp_type; + self->state = STATE_IOEXP_INIT; + mutex_init(&self->lock); + return 0; +} + + +static int +setup_addr_mapping(struct ioexp_obj_s *self, + struct ioexp_addr_s *addr_map_p, + int chip_amount){ + struct ioexp_addr_s *tmp_p; + if (!addr_map_p){ + SWPS_ERR("%s: map is null\n", __func__); + return -1; + } + tmp_p = kzalloc((sizeof(*addr_map_p) * chip_amount), GFP_KERNEL); + if (!tmp_p){ + SWPS_ERR("%s: kzalloc fail.\n", __func__); + return -1; + } + memcpy(tmp_p, addr_map_p, (sizeof(*addr_map_p) * chip_amount)); + self->ioexp_map_p->map_addr = tmp_p; + + return 0; +} + + +static int +setup_ioexp_public_cb(struct ioexp_obj_s *self, + int ioexp_type){ + + switch (ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + case IOEXP_TYPE_MAGINOLIA_4AB: + self->get_present = common_get_present; + self->get_tx_fault = common_get_tx_fault; + self->get_rxlos = common_get_rxlos; + self->get_tx_disable = common_get_tx_disable; + self->get_reset = ioexp_get_not_support; + self->get_lpmod = ioexp_get_not_support; + self->get_modsel = ioexp_get_not_support; + self->get_hard_rs0 = ioexp_get_not_support; + self->get_hard_rs1 = ioexp_get_not_support; + self->set_tx_disable = common_set_tx_disable; + self->set_reset = ioexp_set_not_support; + self->set_lpmod = ioexp_set_not_support; + self->set_modsel = ioexp_set_not_support; + self->set_hard_rs0 = ioexp_set_not_support; + self->set_hard_rs1 = ioexp_set_not_support; + return 0; + case IOEXP_TYPE_CYPRESS_NABC: + self->get_present = common_get_present; + self->get_tx_fault = common_get_tx_fault; + self->get_rxlos = common_get_rxlos; + self->get_tx_disable = common_get_tx_disable; + self->get_reset = ioexp_get_not_support; + self->get_lpmod = ioexp_get_not_support; + self->get_modsel = ioexp_get_not_support; + self->get_hard_rs0 = common_get_hard_rs0; + self->get_hard_rs1 = common_get_hard_rs1; + self->set_tx_disable = common_set_tx_disable; + self->set_reset = ioexp_set_not_support; + self->set_lpmod = ioexp_set_not_support; + self->set_modsel = ioexp_set_not_support; + self->set_hard_rs0 = common_set_hard_rs0; + self->set_hard_rs1 = common_set_hard_rs1; + return 0; + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + case IOEXP_TYPE_HUDSON32IGA_P01P08: + case IOEXP_TYPE_HUDSON32IGA_P09P16: + case IOEXP_TYPE_CYPRESS_7ABC: + case IOEXP_TYPE_TAHOE_5A: + case IOEXP_TYPE_TAHOE_6ABC: + case IOEXP_TYPE_SEQUOIA_NABC: + case IOEXP_TYPE_LAVENDER_P65: + self->get_present = common_get_present; + self->get_tx_fault = ioexp_get_not_support; + self->get_rxlos = ioexp_get_not_support; + self->get_tx_disable = ioexp_get_not_support; + self->get_reset = common_get_reset; + self->get_lpmod = common_get_lpmod; + self->get_modsel = common_get_modsel; + self->get_hard_rs0 = ioexp_get_not_support; + self->get_hard_rs1 = ioexp_get_not_support; + self->set_tx_disable = ioexp_set_not_support; + self->set_reset = common_set_reset; + self->set_lpmod = common_set_lpmod; + self->set_modsel = common_set_modsel; + self->set_hard_rs0 = ioexp_set_not_support; + self->set_hard_rs1 = ioexp_set_not_support; + return 0; + + default: + SWPS_ERR("%s: type:%d incorrect!\n", __func__, ioexp_type); + break; + } + return ERR_IOEXP_UNEXCPT; +} + + +static int +setup_ioexp_private_cb(struct ioexp_obj_s *self, + int ioexp_type){ + + switch (ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + case IOEXP_TYPE_MAGINOLIA_4AB: + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + case IOEXP_TYPE_HUDSON32IGA_P01P08: + case IOEXP_TYPE_HUDSON32IGA_P09P16: + case IOEXP_TYPE_CYPRESS_NABC: + case IOEXP_TYPE_CYPRESS_7ABC: + case IOEXP_TYPE_TAHOE_5A: + case IOEXP_TYPE_TAHOE_6ABC: + case IOEXP_TYPE_SEQUOIA_NABC: + case IOEXP_TYPE_LAVENDER_P65: + self->init = common_ioexp_init; + self->check = common_ioexp_check; + self->update_all = common_ioexp_update_all; + self->fsm_4_direct = common_ioexp_fsm_4_direct; + self->fsm_4_polling = common_ioexp_fsm_4_polling; + return 0; + + default: + SWPS_ERR("%s: type:%d incorrect!\n", __func__, ioexp_type); + break; + } + return ERR_IOEXP_UNEXCPT; +} + + +static int +setup_i2c_client_one(struct ioexp_obj_s *self, + int chip_id){ + + char *err_msg = "ERROR"; + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + struct ioexp_i2c_s *i2c_obj_p = NULL; + struct ioexp_i2c_s *i2c_curr_p = NULL; + + int chan_id = self->ioexp_map_p->map_addr[chip_id].chan_id; + adap = i2c_get_adapter(chan_id); + if(!adap){ + err_msg = "Can not get adap!"; + goto err_ioexp_setup_i2c_1; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + err_msg = "Can not kzalloc client!"; + goto err_ioexp_setup_i2c_1; + } + i2c_obj_p = kzalloc(sizeof(*i2c_obj_p), GFP_KERNEL); + if (!i2c_obj_p){ + err_msg = "Can not kzalloc i2c_obj_p!"; + goto err_ioexp_setup_i2c_2; + } + client->adapter = adap; + client->addr = self->ioexp_map_p->map_addr[chip_id].chip_addr; + i2c_obj_p->i2c_client_p = client; + i2c_obj_p->chip_id = chip_id; + i2c_obj_p->next = NULL; + if (!self->i2c_head_p){ + self->i2c_head_p = i2c_obj_p; + } else { + i2c_curr_p = self->i2c_head_p; + while (i2c_curr_p->next){ + i2c_curr_p = i2c_curr_p->next; + } + i2c_curr_p->next = i2c_obj_p; + } + return 0; + +err_ioexp_setup_i2c_2: + kfree(client); +err_ioexp_setup_i2c_1: + SWPS_ERR("%s: %s :%d\n", __func__, err_msg, chan_id); + return -1; +} + + +static int +setup_i2c_client(struct ioexp_obj_s* self){ + + int result; + int chip_id = 0; + + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + result = setup_i2c_client_one(self, chip_id); + if (result < 0){ + SWPS_ERR("%s fail! :%d\n", __func__, chip_id); + return -1; + } + } + return 0; +} + + +static int +setup_ioexp_config(struct ioexp_obj_s *self) { + + int chip_id, offset, err_code; + struct ioexp_addr_s *addr_p; + + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + addr_p = &(self->ioexp_map_p->map_addr[chip_id]); + if (!addr_p){ + SWPS_ERR("IOEXP config incorrect! :%d \n",chip_id); + return -1; + } + for (offset=0; offset<(self->ioexp_map_p->data_width); offset++){ + + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, chip_id), + addr_p->conf_offset[offset], + addr_p->conf_default[offset]); + + if (err_code < 0){ + SWPS_INFO("%s: set conf fail! :%d \n", __func__, err_code); + return -2; + } + } + } + return 0; +} + + +struct ioexp_obj_s * +_create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode){ + + struct ioexp_map_s* ioexp_map_p; + struct ioexp_obj_s* result_p; + struct ioexp_i2c_s *i2c_curr_p; + struct ioexp_i2c_s *i2c_next_p; + + /* Get layout */ + ioexp_map_p = get_ioexp_map(ioexp_type); + if (!ioexp_map_p){ + SWPS_ERR("%s: Invalid ioexp_type\n", __func__); + goto err_create_ioexp_fail; + } + /* Prepare IOEXP object */ + result_p = kzalloc(sizeof(*result_p), GFP_KERNEL); + if (!result_p){ + SWPS_ERR("%s: kzalloc failure!\n", __func__); + goto err_create_ioexp_fail; + } + /* Prepare static size attributes */ + if (setup_ioexp_ssize_attr(result_p, + ioexp_map_p, + ioexp_id, + ioexp_type, + run_mode) < 0){ + goto err_create_ioexp_setup_attr_fail; + } + /* Prepare address mapping */ + if (setup_addr_mapping(result_p, addr_map_p, ioexp_map_p->chip_amount) < 0){ + goto err_create_ioexp_setup_attr_fail; + } + if (setup_i2c_client(result_p) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + /* Prepare call back functions of object */ + if (setup_ioexp_public_cb(result_p, ioexp_type) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + if (setup_ioexp_private_cb(result_p, ioexp_type) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + return result_p; + +err_create_ioexp_setup_i2c_fail: + i2c_curr_p = result_p->i2c_head_p; + i2c_next_p = result_p->i2c_head_p; + while (i2c_curr_p){ + i2c_next_p = i2c_curr_p->next; + kfree(i2c_curr_p->i2c_client_p); + kfree(i2c_curr_p); + i2c_curr_p = i2c_next_p; + } +err_create_ioexp_setup_attr_fail: + kfree(result_p); +err_create_ioexp_fail: + SWPS_ERR("%s: fail! :%d :%d \n", + __func__, ioexp_id, ioexp_type); + return NULL; +} + + +int +create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode){ + + struct ioexp_obj_s *ioexp_p = NULL; + + ioexp_p = _create_ioexp_obj(ioexp_id, ioexp_type, + addr_map_p, run_mode); + if (!ioexp_p){ + return -1; + } + if (ioexp_head_p == NULL){ + ioexp_head_p = ioexp_p; + ioexp_tail_p = ioexp_p; + return 0; + } + ioexp_tail_p->next = ioexp_p; + ioexp_tail_p = ioexp_p; + return 0; +} + + +static int +_init_ioexp_obj(struct ioexp_obj_s* self) { + + char *err_msg = "ERR"; + char *func_name = "_init_ioexp_obj"; + + /* Setup IOEXP configure byte */ + if (setup_ioexp_config(self) < 0){ + err_msg = "setup_ioexp_config fail"; + goto err_init_ioexp_obj; + } + /* Setup default data */ + if (_ioexp_init_handler(self) < 0){ + err_msg = "_ioexp_init_handler fail"; + goto err_init_ioexp_obj; + } + /* Update all */ + if (self->state == STATE_IOEXP_NORMAL){ + if (self->update_all(self, 1, func_name) < 0){ + err_msg = "update_all() fail"; + goto err_init_ioexp_obj; + } + } + return 0; + +err_init_ioexp_obj: + SWPS_DEBUG("%s: %s\n", __func__, err_msg); + return -1; +} + + +int +init_ioexp_objs(void){ + /* Return value: + * 0: Success + * -1: Detect topology error + * -2: SWPS internal error + */ + + struct ioexp_obj_s *curr_p = ioexp_head_p; + + if (!curr_p) { + SWPS_ERR("%s: ioexp_head_p is NULL\n", __func__); + return -2; + } + while (curr_p) { + if (_init_ioexp_obj(curr_p) < 0) { + SWPS_DEBUG("%s: _init_ioexp_obj() fail\n", __func__); + return -1; + } + curr_p = curr_p->next; + } + SWPS_DEBUG("%s: done.\n", __func__); + return 0; +} + + +void +clean_ioexp_objs(void){ + + struct ioexp_i2c_s *i2c_curr_p = NULL; + struct ioexp_i2c_s *i2c_next_p = NULL; + struct ioexp_obj_s *ioexp_next_p = NULL; + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + if (ioexp_head_p == NULL){ + ioexp_tail_p = NULL; + return; + } + while(ioexp_curr_p){ + ioexp_next_p = ioexp_curr_p->next; + if (ioexp_curr_p->ioexp_map_p) { + if (ioexp_curr_p->ioexp_map_p->map_addr) { + kfree(ioexp_curr_p->ioexp_map_p->map_addr); + } + kfree(ioexp_curr_p->ioexp_map_p); + } + + i2c_curr_p = ioexp_curr_p->i2c_head_p; + while (i2c_curr_p) { + i2c_next_p = i2c_curr_p->next; + kfree(i2c_curr_p->i2c_client_p); + kfree(i2c_curr_p); + i2c_curr_p = i2c_next_p; + } + kfree(ioexp_curr_p); + ioexp_curr_p = ioexp_next_p; + } + ioexp_tail_p = NULL; + SWPS_DEBUG("%s: done.\n", __func__); +} + + +int +check_ioexp_objs(void){ + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while (ioexp_curr_p){ + if ( (ioexp_curr_p->check(ioexp_curr_p)) < 0){ + SWPS_INFO("check IOEXP-%d fail! :%d\n", + ioexp_curr_p->ioexp_id, ioexp_curr_p->ioexp_type); + return -1; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return 0; +} + + +struct ioexp_obj_s * +get_ioexp_obj(int ioexp_id){ + + struct ioexp_obj_s *result_p = NULL; + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + if (ioexp_curr_p->ioexp_id == ioexp_id){ + result_p = ioexp_curr_p; + break; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return result_p; +} + + +void +unlock_ioexp_all(void) { + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + mutex_unlock(&ioexp_curr_p->lock); + ioexp_curr_p = ioexp_curr_p->next; + } +} + + +int +lock_ioexp_all(void) { + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + mutex_lock(&ioexp_curr_p->lock); + ioexp_curr_p = ioexp_curr_p->next; + } + return 0; +} + + +int +check_channel_tier_1(void) { + + if ( (!_is_channel_ready(ioexp_head_p)) && + (!_is_channel_ready(ioexp_tail_p)) ){ + return -1; + } + return 0; +} + + +static int +_scan_channel_tier_1(int force, + int show_err) { + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + int ready = 0; + + if (!ioexp_curr_p) { + goto err_scan_tier_1_channel; + } + while(ioexp_curr_p) { + ready = _is_channel_ready(ioexp_curr_p); + if ((!ready) && (!force)) { + goto err_scan_tier_1_channel; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return 0; + +err_scan_tier_1_channel: + if (show_err) { + if (ioexp_curr_p) { + SWPS_INFO("%s: IOEXP-%d fail\n", __func__, ioexp_curr_p->ioexp_id); + } else { + SWPS_INFO("%s: IOEXP is null.\n", __func__); + } + } + return -1; +} + + +static int +_scan_channel_tier_1_single(void) { + + int ret = 0; + int chan_id = 0; + int fake_cid = 0; + int fake_offs = 0; + int fake_addr = 0; + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + + if (ioexp_head_p->ioexp_id != ioexp_tail_p->ioexp_id) { + return 0; + } + /* Setup i2c_client */ + chan_id = ioexp_head_p->ioexp_map_p->map_addr[fake_cid].chan_id; + fake_addr = ioexp_head_p->ioexp_map_p->map_addr[fake_cid].chip_addr; + adap = i2c_get_adapter((chan_id + 1)); + if(!adap){ + SWPS_INFO("%s: Can not get adap!\n", __func__); + return 0; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + SWPS_INFO("%s: Can not kzalloc client!\n", __func__); + return 0; + } + client->adapter = adap; + client->addr = fake_addr; + /* Fouce move ioexp ptr to next */ + ret = i2c_smbus_read_byte_data(client, fake_offs); + SWPS_DEBUG("%s: move ioexp_ptr done. :%d\n", __func__, ret); + kfree(client); + return 1; +} + + +int +resync_channel_tier_1(void) { + + char *emsg = "ERR"; + + if (!ioexp_head_p) { + emsg = "ioexp_head_p is NULL"; + goto err_resync_ioexp_status_1; + } + /* Run all */ + if (ioexp_head_p->ioexp_id == ioexp_tail_p->ioexp_id) { + _scan_channel_tier_1_single(); + } else { + _scan_channel_tier_1(1, 0); + } + /* Check all */ + if (_scan_channel_tier_1(0, 1) < 0) { + emsg = "resync tier-1 channel fail"; + goto err_resync_ioexp_status_1; + } + return 0; + +err_resync_ioexp_status_1: + SWPS_ERR("%s: %s\n", __func__, emsg); + return -1; +} + + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/io_expander.h b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/io_expander.h new file mode 100644 index 000000000000..82fef3f7febc --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/io_expander.h @@ -0,0 +1,183 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef IO_EXPANDER_H +#define IO_EXPANDER_H + +#include + + +/* IOEXP type define (SFP series) */ +#define IOEXP_TYPE_MAGINOLIA_NAB (10101) +#define IOEXP_TYPE_MAGINOLIA_4AB (10102) +#define IOEXP_TYPE_CYPRESS_NABC (10103) + +/* IOEXP type define (QSFP series) */ +#define IOEXP_TYPE_MAGINOLIA_7AB (10201) +#define IOEXP_TYPE_REDWOOD_P01P08 (10202) +#define IOEXP_TYPE_REDWOOD_P09P16 (10203) +#define IOEXP_TYPE_HUDSON32IGA_P01P08 (10204) +#define IOEXP_TYPE_HUDSON32IGA_P09P16 (10205) +#define IOEXP_TYPE_SPRUCE_7AB (10206) +#define IOEXP_TYPE_CYPRESS_7ABC (10207) +#define IOEXP_TYPE_TAHOE_5A (10208) +#define IOEXP_TYPE_TAHOE_6ABC (10209) +#define IOEXP_TYPE_SEQUOIA_NABC (10210) +#define IOEXP_TYPE_LAVENDER_P65 (10211) + +/* IOEXP mode define */ +#define IOEXP_MODE_POLLING (19000) +#define IOEXP_MODE_DIRECT (19001) + +/* IOEXP state define */ +#define STATE_IOEXP_NORMAL (0) +#define STATE_IOEXP_INIT (-1) +#define STATE_IOEXP_ABNORMAL (-2) + +/* IOEXP error code define */ +#define ERR_IOEXP_NOTSUPPORT (-100) +#define ERR_IOEXP_UNINIT (-101) +#define ERR_IOEXP_BADCONF (-102) +#define ERR_IOEXP_ABNORMAL (-103) +#define ERR_IOEXP_NOSTATE (-104) +#define ERR_IOEXP_BADINPUT (-105) +#define ERR_IOEXP_UNEXCPT (-199) + + +#define SWPS_INFO(fmt, args...) printk( KERN_INFO "[SWPS] " fmt, ##args) +#define SWPS_WARN(fmt, args...) printk( KERN_WARNING "[SWPS] " fmt, ##args) +#define SWPS_ERR(fmt, args...) printk( KERN_ERR "[SWPS] " fmt, ##args) + +#ifdef DEBUG_SWPS +# define SWPS_DEBUG(fmt, args...) printk( KERN_DEBUG "[SWPS] " fmt, ##args) +#else +# define SWPS_DEBUG(fmt, args...) +#endif + + +struct ioexp_addr_s { + int chan_id; + int chip_addr; + int read_offset[8]; + int write_offset[8]; + int conf_offset[8]; + uint8_t data_default[8]; + uint8_t conf_default[8]; +}; + +struct ioexp_i2c_s { + int chip_id; + struct i2c_client *i2c_client_p; + struct ioexp_i2c_s *next; +}; + + +struct ioexp_bitmap_s { + int chip_id; /* IOEXP chip id */ + int ioexp_voffset; /* IOEXP virtual offset */ + int bit_shift; +}; + +struct ioexp_map_s { + int chip_amount; /* Number of chips that IOEXP object content */ + int data_width; /* Number of (Read/Write/Config) bytes */ + struct ioexp_addr_s *map_addr; /* Chip address info */ + struct ioexp_bitmap_s map_present[10]; /* IOEXP for SFP / QSFP */ + struct ioexp_bitmap_s map_tx_disable[10]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_tx_fault[10]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_rxlos[10]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_reset[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_lpmod[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_modsel[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_hard_rs0[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_hard_rs1[10]; /* IOEXP for QSFP */ +}; + +struct ioexp_data_s { + uint8_t data[8]; +}; + +struct ioexp_obj_s { + + /* ============================ + * Object public property + * ============================ + */ + int ioexp_id; + int ioexp_type; + + /* ============================ + * Object private property + * ============================ + */ + struct ioexp_data_s chip_data[16]; /* Max: 8-ioexp in one virt-ioexp(ioexp_obj) */ + struct ioexp_map_s *ioexp_map_p; + struct ioexp_obj_s *next; + struct ioexp_i2c_s *i2c_head_p; + struct mutex lock; + int mode; + int state; + + /* =========================================== + * Object public functions + * =========================================== + */ + int (*get_present)(struct ioexp_obj_s *self, int virt_offset); + int (*get_tx_fault)(struct ioexp_obj_s *self, int virt_offset); + int (*get_rxlos)(struct ioexp_obj_s *self, int virt_offset); + int (*get_tx_disable)(struct ioexp_obj_s *self, int virt_offset); + int (*get_reset)(struct ioexp_obj_s *self, int virt_offset); + int (*get_lpmod)(struct ioexp_obj_s *self, int virt_offset); + int (*get_modsel)(struct ioexp_obj_s *self, int virt_offset); + int (*get_hard_rs0)(struct ioexp_obj_s *self, int virt_offset); + int (*get_hard_rs1)(struct ioexp_obj_s *self, int virt_offset); + int (*set_tx_disable)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_reset)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_lpmod)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_modsel)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_hard_rs0)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_hard_rs1)(struct ioexp_obj_s *self, int virt_offset, int input_val); + + /* =========================================== + * Object private functions + * =========================================== + */ + int (*init)(struct ioexp_obj_s *self); + int (*check)(struct ioexp_obj_s *self); + int (*update_all)(struct ioexp_obj_s *self, int show_err, char *caller_name); + int (*fsm_4_direct)(struct ioexp_obj_s* self); + int (*fsm_4_polling)(struct ioexp_obj_s* self); +}; + + +struct ioexp_obj_s* get_ioexp_obj(int ioexp_id); +int create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode); +int init_ioexp_objs(void); +int check_ioexp_objs(void); +void clean_ioexp_objs(void); + +void unlock_ioexp_all(void); +int lock_ioexp_all(void); + +int check_channel_tier_1(void); +int resync_channel_tier_1(void); + +/* Macro for bit control */ +#define SWP_BIT_SET(byte_val,bit_shift) ((byte_val) |= (1<<(bit_shift))) +#define SWP_BIT_CLEAR(byte_val,bit_shift) ((byte_val) &= ~(1<<(bit_shift))) + + +#endif /* IO_EXPANDER_H */ + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/transceiver.c b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/transceiver.c new file mode 100644 index 000000000000..e7f3cf70fa68 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/transceiver.c @@ -0,0 +1,8388 @@ +/* + * 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 "io_expander.h" +#include "transceiver.h" + + +/* ========== Register EEPROM address mapping ========== + */ +struct eeprom_map_s eeprom_map_sfp = { + .addr_br =0x50, .page_br =-1, .offset_br =12, .length_br =1, + .addr_cdr =-1, .page_cdr =-1, .offset_cdr =-1, .length_cdr =-1, + .addr_comp_rev =0x50, .page_comp_rev =-1, .offset_comp_rev =94, .length_comp_rev =1, + .addr_connector =0x50, .page_connector =-1, .offset_connector =2, .length_connector =1, + .addr_diag_type =0x50, .page_diag_type =-1, .offset_diag_type =92 , .length_diag_type =1, + .addr_extbr =-1, .page_extbr =-1, .offset_extbr =-1, .length_extbr =-1, + .addr_ext_id =0x50, .page_ext_id =-1, .offset_ext_id =1, .length_ext_id =1, + .addr_id =0x50, .page_id =-1, .offset_id =0, .length_id =1, + .addr_len_sm =0x50, .page_len_sm =-1, .offset_len_sm =15, .length_len_sm =1, + .addr_len_smf =0x50, .page_len_smf =-1, .offset_len_smf =14, .length_len_smf =1, + .addr_len_om1 =0x50, .page_len_om1 =-1, .offset_len_om1 =17, .length_len_om1 =1, + .addr_len_om2 =0x50, .page_len_om2 =-1, .offset_len_om2 =16, .length_len_om2 =1, + .addr_len_om3 =0x50, .page_len_om3 =-1, .offset_len_om3 =19, .length_len_om3 =1, + .addr_len_om4 =0x50, .page_len_om4 =-1, .offset_len_om4 =18, .length_len_om4 =1, + .addr_option =0x50, .page_option =-1, .offset_option =64, .length_option =2, + .addr_rate_id =0x50, .page_rate_id =-1, .offset_rate_id =13, .length_rate_id =1, + .addr_rx_am =-1, .page_rx_am =-1, .offset_rx_am =-1, .length_rx_am =-1, + .addr_rx_em =0x51, .page_rx_em =-1, .offset_rx_em =115, .length_rx_em =1, + .addr_rx_los =-1, .page_rx_los =-1, .offset_rx_los =-1, .length_rx_los =-1, + .addr_rx_power =0x51, .page_rx_power =-1, .offset_rx_power =104, .length_rx_power =2, + .addr_soft_rs0 =0x51, .page_soft_rs0 =-1, .offset_soft_rs0 =110, .length_soft_rs0 =1, + .addr_soft_rs1 =0x51, .page_soft_rs1 =-1, .offset_soft_rs1 =118, .length_soft_rs0 =1, + .addr_temp =0x51, .page_temp =-1, .offset_temp =96, .length_temp =2, + .addr_trancomp =0x50, .page_trancomp =-1, .offset_trancomp =3, .length_trancomp =8, + .addr_trancomp_ext =0x50, .page_trancomp_ext =-1, .offset_trancomp_ext =36, .length_trancomp_ext =1, + .addr_tx_bias =0x51, .page_tx_bias =-1, .offset_tx_bias =100, .length_tx_bias =2, + .addr_tx_disable =-1, .page_tx_disable =-1, .offset_tx_disable =-1, .length_tx_disable =-1, + .addr_tx_eq =0x51, .page_tx_eq =-1, .offset_tx_eq =114, .length_tx_eq =1, + .addr_tx_fault =-1, .page_tx_fault =-1, .offset_tx_fault =-1, .length_tx_fault =-1, + .addr_tx_power =0x51, .page_tx_power =-1, .offset_tx_power =102, .length_tx_power =2, + .addr_vendor_name =0x50, .page_vendor_name =-1, .offset_vendor_name =20, .length_vendor_name =16, + .addr_vendor_pn =0x50, .page_vendor_pn =-1, .offset_vendor_pn =40, .length_vendor_pn =16, + .addr_vendor_rev =0x50, .page_vendor_rev =-1, .offset_vendor_rev =56, .length_vendor_rev =4, + .addr_vendor_sn =0x50, .page_vendor_sn =-1, .offset_vendor_sn =68, .length_vendor_sn =16, + .addr_voltage =0x51, .page_voltage =-1, .offset_voltage =98, .length_voltage =2, + .addr_wavelength =0x50, .page_wavelength =-1, .offset_wavelength =60, .length_wavelength =2, +}; + +struct eeprom_map_s eeprom_map_qsfp = { + .addr_br =0x50, .page_br =0, .offset_br =140, .length_br =1, + .addr_cdr =-1, .page_cdr =-1, .offset_cdr =-1, .length_cdr =-1, + .addr_comp_rev =0x50, .page_comp_rev =-1, .offset_comp_rev =1, .length_comp_rev =1, + .addr_connector =0x50, .page_connector =0, .offset_connector =130, .length_connector =1, + .addr_diag_type =0x50, .page_diag_type =0, .offset_diag_type =220, .length_diag_type =1, + .addr_extbr =0x50, .page_extbr =0, .offset_extbr =222, .length_extbr =1, + .addr_ext_id =0x50, .page_ext_id =0, .offset_ext_id =129, .length_ext_id =1, + .addr_id =0x50, .page_id =0, .offset_id =128, .length_id =1, + .addr_len_sm =-1, .page_len_sm =-1, .offset_len_sm =-1, .length_len_sm =-1, + .addr_len_smf =0x50, .page_len_smf =0, .offset_len_smf =142, .length_len_smf =1, + .addr_len_om1 =0x50, .page_len_om1 =0, .offset_len_om1 =145, .length_len_om1 =1, + .addr_len_om2 =0x50, .page_len_om2 =0, .offset_len_om2 =144, .length_len_om2 =1, + .addr_len_om3 =0x50, .page_len_om3 =0, .offset_len_om3 =143, .length_len_om3 =1, + .addr_len_om4 =0x50, .page_len_om4 =0, .offset_len_om4 =146, .length_len_om4 =1, + .addr_option =0x50, .page_option =0, .offset_option =193, .length_option =3, + .addr_rate_id =-1, .page_rate_id =-1, .offset_rate_id =-1, .length_rate_id =-1, + .addr_rx_am =-1, .page_rx_am =-1, .offset_rx_am =-1, .length_rx_am =-1, + .addr_rx_em =-1, .page_rx_em =-1, .offset_rx_em =-1, .length_rx_em =-1, + .addr_rx_los =0x50, .page_rx_los =-1, .offset_rx_los =3, .length_rx_los =1, + .addr_rx_power =0x50, .page_rx_power =-1, .offset_rx_power =34, .length_rx_power =8, + .addr_soft_rs0 =-1, .page_soft_rs0 =-1, .offset_soft_rs0 =-1, .length_soft_rs0 =-1, + .addr_soft_rs1 =-1, .page_soft_rs1 =-1, .offset_soft_rs1 =-1, .length_soft_rs0 =-1, + .addr_temp =0x50, .page_temp =-1, .offset_temp =22, .length_temp =2, + .addr_trancomp =0x50, .page_trancomp =0, .offset_trancomp =131, .length_trancomp =8, + .addr_trancomp_ext =0x50, .page_trancomp_ext =0, .offset_trancomp_ext =192, .length_trancomp_ext =1, + .addr_tx_bias =0x50, .page_tx_bias =-1, .offset_tx_bias =42, .length_tx_bias =8, + .addr_tx_disable =0x50, .page_tx_disable =-1, .offset_tx_disable =86, .length_tx_disable =1, + .addr_tx_eq =-1, .page_tx_eq =-1, .offset_tx_eq =-1, .length_tx_eq =-1, + .addr_tx_fault =0x50, .page_tx_fault =-1, .offset_tx_fault =4, .length_tx_fault =1, + .addr_tx_power =0x50, .page_tx_power =-1, .offset_tx_power =50, .length_tx_power =8, + .addr_vendor_name =0x50, .page_vendor_name =0, .offset_vendor_name =148, .length_vendor_name =16, + .addr_vendor_pn =0x50, .page_vendor_pn =0, .offset_vendor_pn =168, .length_vendor_pn =16, + .addr_vendor_rev =0x50, .page_vendor_rev =0, .offset_vendor_rev =184, .length_vendor_rev =2, + .addr_vendor_sn =0x50, .page_vendor_sn =0, .offset_vendor_sn =196, .length_vendor_sn =16, + .addr_voltage =0x50, .page_voltage =-1, .offset_voltage =26, .length_voltage =2, + .addr_wavelength =0x50, .page_wavelength =0, .offset_wavelength =186, .length_wavelength =2, +}; + +struct eeprom_map_s eeprom_map_qsfp28 = { + .addr_br =0x50, .page_br =0, .offset_br =140, .length_br =1, + .addr_cdr =0x50, .page_cdr =-1, .offset_cdr =98, .length_cdr =1, + .addr_comp_rev =0x50, .page_comp_rev =-1, .offset_comp_rev =1, .length_comp_rev =1, + .addr_connector =0x50, .page_connector =0, .offset_connector =130, .length_connector =1, + .addr_diag_type =0x50, .page_diag_type =0, .offset_diag_type =220, .length_diag_type =1, + .addr_extbr =0x50, .page_extbr =0, .offset_extbr =222, .length_extbr =1, + .addr_ext_id =0x50, .page_ext_id =0, .offset_ext_id =129, .length_ext_id =1, + .addr_id =0x50, .page_id =0, .offset_id =128, .length_id =1, + .addr_len_sm =-1, .page_len_sm =-1, .offset_len_sm =-1, .length_len_sm =-1, + .addr_len_smf =0x50, .page_len_smf =0, .offset_len_smf =142, .length_len_smf =1, + .addr_len_om1 =0x50, .page_len_om1 =0, .offset_len_om1 =145, .length_len_om1 =1, + .addr_len_om2 =0x50, .page_len_om2 =0, .offset_len_om2 =144, .length_len_om2 =1, + .addr_len_om3 =0x50, .page_len_om3 =0, .offset_len_om3 =143, .length_len_om3 =1, + .addr_len_om4 =0x50, .page_len_om4 =0, .offset_len_om4 =146, .length_len_om4 =1, + .addr_option =0x50, .page_option =0, .offset_option =193, .length_option =3, + .addr_rate_id =-1, .page_rate_id =-1, .offset_rate_id =-1, .length_rate_id =-1, + .addr_rx_am =0x50, .page_rx_am =3, .offset_rx_am =238, .length_rx_am =2, + .addr_rx_em =0x50, .page_rx_em =3, .offset_rx_em =236, .length_rx_em =2, + .addr_rx_los =0x50, .page_rx_los =-1, .offset_rx_los =3, .length_rx_los =1, + .addr_rx_power =0x50, .page_rx_power =-1, .offset_rx_power =34, .length_rx_power =8, + .addr_soft_rs0 =-1, .page_soft_rs0 =-1, .offset_soft_rs0 =-1, .length_soft_rs0 =-1, + .addr_soft_rs1 =-1, .page_soft_rs1 =-1, .offset_soft_rs1 =-1, .length_soft_rs0 =-1, + .addr_temp =0x50, .page_temp =-1, .offset_temp =22, .length_temp =2, + .addr_trancomp =0x50, .page_trancomp =0, .offset_trancomp =131, .length_trancomp =8, + .addr_trancomp_ext =0x50, .page_trancomp_ext =0, .offset_trancomp_ext =192, .length_trancomp_ext =1, + .addr_tx_bias =0x50, .page_tx_bias =-1, .offset_tx_bias =42, .length_tx_bias =8, + .addr_tx_disable =0x50, .page_tx_disable =-1, .offset_tx_disable =86, .length_tx_disable =1, + .addr_tx_eq =0x50, .page_tx_eq =3, .offset_tx_eq =234, .length_tx_eq =2, + .addr_tx_fault =0x50, .page_tx_fault =-1, .offset_tx_fault =4, .length_tx_fault =1, + .addr_tx_power =0x50, .page_tx_power =-1, .offset_tx_power =50, .length_tx_power =8, + .addr_vendor_name =0x50, .page_vendor_name =0, .offset_vendor_name =148, .length_vendor_name =16, + .addr_vendor_pn =0x50, .page_vendor_pn =0, .offset_vendor_pn =168, .length_vendor_pn =16, + .addr_vendor_rev =0x50, .page_vendor_rev =0, .offset_vendor_rev =184, .length_vendor_rev =2, + .addr_vendor_sn =0x50, .page_vendor_sn =0, .offset_vendor_sn =196, .length_vendor_sn =16, + .addr_voltage =0x50, .page_voltage =-1, .offset_voltage =26, .length_voltage =2, + .addr_wavelength =0x50, .page_wavelength =0, .offset_wavelength =186, .length_wavelength =2, +}; + + +/* ========== Utility Functions ========== + */ +static int +get_bit(uint8_t origin_byte, int bit_shift) { + return (int)((origin_byte >> bit_shift) & 0x1); +} + +static int +transform_word_to_int(uint8_t hight_byte, + uint8_t low_byte) { + return ((((int)hight_byte) << 8) + (int)low_byte); +} + + +void +alarm_msg_2_user(struct transvr_obj_s *self, + char *emsg) { + + SWPS_ERR("%s on %s.\n", emsg, self->swp_name); +} + + +/* ========== Private functions ========== + */ +static int +_reload_transvr_obj(struct transvr_obj_s *self,int new_type); + +static int +reload_transvr_obj(struct transvr_obj_s *self,int new_type); + +static int +_is_transvr_support_ctle(struct transvr_obj_s *self); + +static int +_transvr_init_handler(struct transvr_obj_s *self); + +int +_transvr_clean_handler(struct transvr_obj_s *self); + +int +_sfp_detect_class_by_1g_ethernet(struct transvr_obj_s* self); + + +void +lock_transvr_obj(struct transvr_obj_s *self) { + + mutex_lock(&self->lock); + self->curr_page = VAL_TRANSVR_PAGE_FREE; +} + + +void +unlock_transvr_obj(struct transvr_obj_s *self) { + + self->curr_page = VAL_TRANSVR_PAGE_FREE; + mutex_unlock(&self->lock); +} + + +static int +_check_by_mode(struct transvr_obj_s *self, + int (*attr_update_func)(struct transvr_obj_s *self, int show_err), + char *caller_name){ + + int return_val = ERR_TRANSVR_UNEXCPT; + + switch (self->mode){ + case TRANSVR_MODE_POLLING: + switch (self->state){ + case STATE_TRANSVR_CONNECTED: + goto ok_check_by_mode_1; + case STATE_TRANSVR_NEW: + case STATE_TRANSVR_INIT: + return ERR_TRANSVR_UNINIT; + case STATE_TRANSVR_DISCONNECTED: + return ERR_TRANSVR_UNPLUGGED; + case STATE_TRANSVR_UNEXCEPTED: + return ERR_TRANSVR_ABNORMAL; + case STATE_TRANSVR_ISOLATED: + return ERR_TRNASVR_BE_ISOLATED; + default: + goto err_check_by_mode_1; + } + goto ok_check_by_mode_1; + + case TRANSVR_MODE_DIRECT: + return_val = self->fsm_4_direct(self, caller_name); + if (return_val < 0){ + return return_val; + } + goto ok_check_by_mode_1; + + default: + goto err_check_by_mode_1; + } + goto ok_check_by_mode_1; + +ok_check_by_mode_1: + return attr_update_func(self, 0); + +err_check_by_mode_1: + SWPS_INFO("_check_by_mode: mode:%d state:%d\n", self->mode, self->state); + return ERR_TRANSVR_UNEXCPT; +} + + +static void +_transvr_clean_retry(struct transvr_obj_s *self) { + self->retry = 0; +} + + +static int +_transvr_handle_retry(struct transvr_obj_s *self, int retry) { + /* Return: 0: keep retry + * -1: stop retry + */ + if (self->retry == 0) { + self->retry = retry; + } + self->retry -= 1; + if (self->retry <= 0) { + _transvr_clean_retry(self); + return -1; + } + return 0; +} + + +static int +_common_setup_page(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + int show_e) { + /* return: + * 0 : OK + * -1 : EEPROM settings incorrect + * -2 : I2C R/W failure + * -3 : Undefined case + */ + int retval = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Check */ + if ((addr < 0) || (offset < 0) || (len < 0)) { + emsg = "EEPROM settings incorrect"; + retval = -1; + goto err_common_setup_page; + } + /* Case1: continue access */ + if ((self->i2c_client_p->addr == addr) && + (self->curr_page == page)) { + return 0; + } + self->i2c_client_p->addr = addr; + /* Case2: select lower page */ + if (page == -1) { + self->curr_page = page; + return 0; + } + /* Case3: select upper page */ + if (page >= 0) { + goto upper_common_setup_page; + } + /* Unexpected case */ + show_e = 1; + emsg = "Unexpected case"; + retval = -3; + goto err_common_setup_page; + +upper_common_setup_page: + if (i2c_smbus_write_byte_data(self->i2c_client_p, + VAL_TRANSVR_PAGE_SELECT_OFFSET, + page) < 0) { + emsg = "I2C R/W failure"; + retval = -2; + goto err_common_setup_page; + } + self->curr_page = page; + mdelay(VAL_TRANSVR_PAGE_SELECT_DELAY); + return 0; + +err_common_setup_page: + if (show_e) { + SWPS_INFO("%s: %s", __func__, emsg); + SWPS_INFO("%s: :0x%02x :%d :%d :%d\n", + __func__, addr, page, offset, len); + } + return retval; +} + +/* +static int +_common_setup_password(struct transvr_obj_s *self, + int addr, + int page, + int offs, + uint8_t pwd[4], + int show_e) { + int i = 0; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offs, 4, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_setup_password; + } + for (i=0; i<4; i++) { + err = i2c_smbus_write_byte_data(self->i2c_client_p, + (offs + i), + pwd[i]); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_setup_password; + } + } + return 0; + +err_common_setup_password: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, err); + } + return ERR_TRANSVR_UPDATE_FAIL; +} +*/ + +static int +_common_update_uint8_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + uint8_t *buf, + char *caller, + int show_e){ + + int i; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_update_uint8_attr; + } + for (i=0; ii2c_client_p, (offset + i)); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_update_uint8_attr; + } + buf[i] = err; + } + return 0; + +err_common_update_uint8_attr: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + buf[0] = DEBUG_TRANSVR_HEX_VAL; + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_update_int_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + int *buf, + char *caller, + int show_e){ + + int i; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_update_int_attr; + } + for (i=0; ii2c_client_p, (offset + i)); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_update_int_attr; + } + buf[i] = (int)err; + } + return 0; + +err_common_update_int_attr: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + buf[0] = DEBUG_TRANSVR_INT_VAL; + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_update_string_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + char buf[], + char *caller, + int show_e){ + + int i; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_update_string_attr; + } + for (i=0; ii2c_client_p, (offset + i)); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_update_string_attr; + } + buf[i] = (char)err; + } + return 0; + +err_common_update_string_attr: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + buf[0] = 'e'; + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_set_uint8_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + uint8_t update, + uint8_t *buf, + char *caller, + int show_e){ + int len = 1; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + if ((*buf) == update){ + return 0; + } + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_set_uint8_attr_1; + } + err = i2c_smbus_write_byte_data(self->i2c_client_p, + offset, + update); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_set_uint8_attr_1; + } + (*buf) = update; + return 0; + +err_common_set_uint8_attr_1: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_set_uint8_array(struct transvr_obj_s *self, + int addr, + int page, + int offs, + int len, + uint8_t update[], + uint8_t buf[], + char *caller, + int show_e){ + int i = 0; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offs, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_set_uint8_attr_1; + } + for (i=0; ii2c_client_p, + (offs + i), + update[i]); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_set_uint8_attr_1; + } + buf[i] = update[i]; + } + return 0; + +err_common_set_uint8_attr_1: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + __func__, emsg, caller, err, i); + } + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_update_attr_id(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_id, + self->eeprom_map_p->page_id, + self->eeprom_map_p->offset_id, + self->eeprom_map_p->length_id, + &(self->id), + "_common_update_attr_id", + show_err); +} + + +static int +_common_update_attr_extended_id(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_ext_id, + self->eeprom_map_p->page_ext_id, + self->eeprom_map_p->offset_ext_id, + self->eeprom_map_p->length_ext_id, + &(self->ext_id), + "_common_update_attr_extended_id", + show_err); +} + + +static int +_common_update_attr_connector(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_connector, + self->eeprom_map_p->page_connector, + self->eeprom_map_p->offset_connector, + self->eeprom_map_p->length_connector, + &(self->connector), + "_common_update_attr_connector", + show_err); +} + + +static int +_common_update_attr_transvr_comp(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_trancomp, + self->eeprom_map_p->page_trancomp, + self->eeprom_map_p->offset_trancomp, + self->eeprom_map_p->length_trancomp, + self->transvr_comp, + "_common_update_attr_transvr_comp", + show_err); +} + + +static int +_common_update_attr_transvr_comp_ext(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_trancomp_ext, + self->eeprom_map_p->page_trancomp_ext, + self->eeprom_map_p->offset_trancomp_ext, + self->eeprom_map_p->length_trancomp_ext, + &(self->transvr_comp_ext), + "_common_update_attr_transvr_comp_ext", + show_err); +} + + +static int +_common_update_attr_vendor_name(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_name, + self->eeprom_map_p->page_vendor_name, + self->eeprom_map_p->offset_vendor_name, + self->eeprom_map_p->length_vendor_name, + self->vendor_name, + "_common_update_attr_vendor_name", + show_err); +} + + +static int +_common_update_attr_vendor_pn(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_pn, + self->eeprom_map_p->page_vendor_pn, + self->eeprom_map_p->offset_vendor_pn, + self->eeprom_map_p->length_vendor_pn, + self->vendor_pn, + "_common_update_attr_vendor_pn", + show_err); +} + + +static int +_common_update_attr_vendor_rev(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_rev, + self->eeprom_map_p->page_vendor_rev, + self->eeprom_map_p->offset_vendor_rev, + self->eeprom_map_p->length_vendor_rev, + self->vendor_rev, + "_common_update_attr_vendor_rev", + show_err); +} + + +static int +_common_update_attr_vendor_sn(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_sn, + self->eeprom_map_p->page_vendor_sn, + self->eeprom_map_p->offset_vendor_sn, + self->eeprom_map_p->length_vendor_sn, + self->vendor_sn, + "_common_update_attr_vendor_sn", + show_err); +} + + +static int +_common_update_attr_br(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_br, + self->eeprom_map_p->page_br, + self->eeprom_map_p->offset_br, + self->eeprom_map_p->length_br, + &(self->br), + "_common_update_attr_br", + show_err); +} + + +static int +_common_update_attr_len_smf(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_smf, + self->eeprom_map_p->page_len_smf, + self->eeprom_map_p->offset_len_smf, + self->eeprom_map_p->length_len_smf, + &(self->len_smf), + "_common_update_attr_len_smf", + show_err); +} + + +static int +_common_update_attr_len_om1(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om1, + self->eeprom_map_p->page_len_om1, + self->eeprom_map_p->offset_len_om1, + self->eeprom_map_p->length_len_om1, + &(self->len_om1), + "_common_update_attr_len_om1", + show_err); +} + +static int +_common_update_attr_len_om2(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om2, + self->eeprom_map_p->page_len_om2, + self->eeprom_map_p->offset_len_om2, + self->eeprom_map_p->length_len_om2, + &(self->len_om2), + "_common_update_attr_len_om2", + show_err); +} + +static int +_common_update_attr_len_om3(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om3, + self->eeprom_map_p->page_len_om3, + self->eeprom_map_p->offset_len_om3, + self->eeprom_map_p->length_len_om3, + &(self->len_om3), + "_common_update_attr_len_om3", + show_err); +} + + +static int +_common_update_attr_len_om4(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om4, + self->eeprom_map_p->page_len_om4, + self->eeprom_map_p->offset_len_om4, + self->eeprom_map_p->length_len_om4, + &(self->len_om4), + "_common_update_attr_len_om4", + show_err); +} + + +static int +_common_update_attr_option(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_option, + self->eeprom_map_p->page_option, + self->eeprom_map_p->offset_option, + self->eeprom_map_p->length_option, + self->option, + "_common_update_attr_option", + show_err); +} + + +static int +_common_update_attr_comp_rev(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_comp_rev, + self->eeprom_map_p->page_comp_rev, + self->eeprom_map_p->offset_comp_rev, + self->eeprom_map_p->length_comp_rev, + &(self->comp_rev), + "_common_update_attr_comp_rev", + show_err); +} + + +static int +_common_update_attr_diag_type(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_diag_type, + self->eeprom_map_p->page_diag_type, + self->eeprom_map_p->offset_diag_type, + self->eeprom_map_p->length_diag_type, + &(self->diag_type), + "_common_update_attr_diag_type", + show_err); +} + + +static int +_common_update_attr_wavelength(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_wavelength, + self->eeprom_map_p->page_wavelength, + self->eeprom_map_p->offset_wavelength, + self->eeprom_map_p->length_wavelength, + self->wavelength, + "_common_update_attr_wavelength", + show_err); +} + + +int +_common_get_option_value(struct transvr_obj_s *self, + int offset, + int bit_shift) { + /* SFP: + * - option[0] = A0h / 64 + * - option[1] = A0h / 65 + * QSFP: + * - option[0] = 00h / 193 + * - option[1] = 00h / 194 + * - option[2] = 00h / 195 + */ + return (self->option[offset] & (1 << bit_shift)); +} + + +static int +_sfp_update_attr_len_sm(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_sm, + self->eeprom_map_p->page_len_sm, + self->eeprom_map_p->offset_len_sm, + self->eeprom_map_p->length_len_sm, + &(self->len_sm), + "_common_update_attr_len_sm", + show_err); +} + + +static int +_sfp_update_attr_rate_id(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_rate_id, + self->eeprom_map_p->page_rate_id, + self->eeprom_map_p->offset_rate_id, + self->eeprom_map_p->length_rate_id, + &(self->rate_id), + "_sfp_update_attr_rate_id", + show_err); +} + + +static int +_sfp_update_attr_soft_rs0(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_soft_rs0, + self->eeprom_map_p->page_soft_rs0, + self->eeprom_map_p->offset_soft_rs0, + self->eeprom_map_p->length_soft_rs0, + &(self->soft_rs0), + "_sfp_update_attr_soft_rs0", + show_err); +} + + +static int +_sfp_update_attr_soft_rs1(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_soft_rs1, + self->eeprom_map_p->page_soft_rs1, + self->eeprom_map_p->offset_soft_rs1, + self->eeprom_map_p->length_soft_rs1, + &(self->soft_rs1), + "_sfp_update_attr_soft_rs1", + show_err); +} + + +int +_sfp_is_diag_support(struct transvr_obj_s *self){ + + uint8_t bit_mask = 0xC0; /* 1100 0000 */ + uint8_t en_val = 0x40; /* 0100 0000 */ + uint8_t checkval = (self->diag_type & bit_mask); + + if (checkval == en_val) { + return 1; + } + return 0; +} + + +static int +_sfp_update_attr_curr_temp(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_temp, + self->eeprom_map_p->page_temp, + self->eeprom_map_p->offset_temp, + self->eeprom_map_p->length_temp, + self->curr_temp, + "_sfp_update_attr_curr_temp", + show_err); +} + + +static int +_sfp_update_attr_curr_voltage(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_voltage, + self->eeprom_map_p->page_voltage, + self->eeprom_map_p->offset_voltage, + self->eeprom_map_p->length_voltage, + self->curr_voltage, + "_sfp_update_attr_curr_voltage", + show_err); +} + + +static int +_sfp_update_attr_curr_tx_bias(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_bias, + self->eeprom_map_p->page_tx_bias, + self->eeprom_map_p->offset_tx_bias, + self->eeprom_map_p->length_tx_bias, + self->curr_tx_bias, + "_sfp_update_attr_curr_tx_bias", + show_err); +} + + +static int +_sfp_update_attr_curr_tx_power(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_power, + self->eeprom_map_p->page_tx_power, + self->eeprom_map_p->offset_tx_power, + self->eeprom_map_p->length_tx_power, + self->curr_tx_power, + "_sfp_update_attr_curr_tx_power", + show_err); +} + + +static int +_sfp_update_attr_curr_rx_power(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_power, + self->eeprom_map_p->page_rx_power, + self->eeprom_map_p->offset_rx_power, + self->eeprom_map_p->length_rx_power, + self->curr_rx_power, + "_sfp_update_attr_curr_rx_power", + show_err); +} + + +static int +_sfp_update_attr_rx_em(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + self->eeprom_map_p->length_rx_em, + self->rx_em, + "_sfp_update_attr_rx_em", + show_err); +} + + +static int +_sfp_update_attr_tx_eq(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + self->eeprom_map_p->length_tx_eq, + self->tx_eq, + "_sfp_update_attr_tx_eq", + show_err); +} + + +static int +_qsfp_update_attr_cdr(struct transvr_obj_s *self, + int show_err){ + if (self->type != TRANSVR_TYPE_QSFP_28){ + self->cdr = DEBUG_TRANSVR_HEX_VAL; + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->page_cdr, + self->eeprom_map_p->offset_cdr, + self->eeprom_map_p->length_cdr, + &(self->cdr), + "_common_update_attr_cdr", + show_err); +} + + +static int +_qsfg_update_attr_extbr(struct transvr_obj_s *self, + int show_err) { + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_extbr, + self->eeprom_map_p->page_extbr, + self->eeprom_map_p->offset_extbr, + self->eeprom_map_p->length_extbr, + &(self->extbr), + "_common_update_attr_extbr", + show_err); +} + + +static int +_qsfp_is_diag_support(struct transvr_obj_s *self, + int diag_type) { + /* Input Parm: diag_type + * => 1 : temperature + * => 2 : voltage + * => 3 : tx relate + * => 4 : rx relate + */ + uint8_t mask_b2 = 0x04; /* 0000 0100 */ + uint8_t mask_b3 = 0x08; /* 0000 1000 */ + + switch (diag_type) { + case 1: /* temperature */ + case 2: /* voltage */ + /* Direct access target, because of spec not defined */ + return 1; + case 3: + case 4: + /* [Note] + * Due to lot of transceiver vendor defined it not rigorously and + * consider of general support, we seem it as supported if there + * are bit-2 OR bit-3 defined by transceiver vendor. + */ + if ( ((self->diag_type & mask_b2) == mask_b2 ) || + ((self->diag_type & mask_b3) == mask_b3 ) ){ + return 1; + } + return 0; + default: + SWPS_INFO("%s: undefined diag_type:%d\n", + __func__, diag_type); + break; + } + return 0; +} + + +int +_qsfp_is_implement_tx_disable(struct transvr_obj_s *self) { + /* + * 00h / Byte-195 / Bit-4 + */ + int byte = 2; + int bit = 4; + return _common_get_option_value(self, byte, bit); +} + + +int +_qsfp_is_implement_tx_fault(struct transvr_obj_s *self) { + /* + * 00h / Byte-195 / Bit-3 + */ + int byte = 2; + int bit = 3; + return _common_get_option_value(self, byte, bit); +} + + +static int +_qsfp_update_attr_curr_temp(struct transvr_obj_s *self, + int show_err){ + int diag_type = 1; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_temp, + self->eeprom_map_p->page_temp, + self->eeprom_map_p->offset_temp, + self->eeprom_map_p->length_temp, + self->curr_temp, + "_qsfp_update_attr_curr_temp", + show_err); +} + + +static int +_qsfp_update_attr_curr_voltage(struct transvr_obj_s *self, + int show_err){ + int diag_type = 2; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_voltage, + self->eeprom_map_p->page_voltage, + self->eeprom_map_p->offset_voltage, + self->eeprom_map_p->length_voltage, + self->curr_voltage, + "_qsfp_update_attr_curr_voltage", + show_err); +} + + +static int +_qsfp_update_attr_curr_tx_bias(struct transvr_obj_s *self, + int show_err){ + int diag_type = 3; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_bias, + self->eeprom_map_p->page_tx_bias, + self->eeprom_map_p->offset_tx_bias, + self->eeprom_map_p->length_tx_bias, + self->curr_tx_bias, + "_qsfp_update_attr_curr_tx_bias", + show_err); +} + + +static int +_qsfp_update_attr_curr_tx_power(struct transvr_obj_s *self, + int show_err){ + int diag_type = 3; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_power, + self->eeprom_map_p->page_tx_power, + self->eeprom_map_p->offset_tx_power, + self->eeprom_map_p->length_tx_power, + self->curr_tx_power, + "_qsfp_update_attr_curr_tx_power", + show_err); +} + + +static int +_qsfp_update_attr_curr_rx_power(struct transvr_obj_s *self, + int show_err){ + int diag_type = 4; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_power, + self->eeprom_map_p->page_rx_power, + self->eeprom_map_p->offset_rx_power, + self->eeprom_map_p->length_rx_power, + self->curr_rx_power, + "_qsfp_update_attr_curr_rx_power", + show_err); +} + + +static int +_qsfp_update_attr_soft_rx_los(struct transvr_obj_s *self, + int show_err){ + + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_los, + self->eeprom_map_p->page_rx_los, + self->eeprom_map_p->offset_rx_los, + self->eeprom_map_p->length_rx_los, + &(self->rx_los), + "_qsfp_update_attr_soft_rx_los", + show_err); +} + + +static int +_qsfp_update_attr_soft_tx_disable(struct transvr_obj_s *self, + int show_err){ + + if (!_qsfp_is_implement_tx_disable(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + self->eeprom_map_p->length_tx_disable, + &(self->tx_disable), + "_qsfp_update_attr_soft_tx_disable", + show_err); +} + + +static int +_qsfp_update_attr_soft_tx_fault(struct transvr_obj_s *self, + int show_err){ + + if (!_qsfp_is_implement_tx_fault(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_fault, + self->eeprom_map_p->page_tx_fault, + self->eeprom_map_p->offset_tx_fault, + self->eeprom_map_p->length_tx_fault, + &(self->tx_fault), + "_qsfp_update_attr_soft_tx_fault", + show_err); +} + + +static int +_qsfp_update_attr_tx_eq(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + self->eeprom_map_p->length_tx_eq, + self->tx_eq, + "_qsfp_update_attr_tx_eq", + show_err); +} + + +static int +_qsfp_update_attr_rx_am(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_am, + self->eeprom_map_p->page_rx_am, + self->eeprom_map_p->offset_rx_am, + self->eeprom_map_p->length_rx_am, + self->rx_am, + "_qsfp_update_attr_rx_am", + show_err); +} + + +static int +_qsfp_update_attr_rx_em(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + self->eeprom_map_p->length_rx_em, + self->rx_em, + "_qsfp_update_attr_rx_em", + show_err); +} + + +int +_common_update_attr_all(struct transvr_obj_s *self, + int show_err){ + + char *err_str = "err"; + + if (_common_update_attr_id(self, show_err) < 0) { + err_str = "_common_update_attr_id"; + goto err_common_update_attr_all; + } + if (_common_update_attr_extended_id(self, show_err) < 0) { + err_str = "_common_update_attr_extended_id"; + goto err_common_update_attr_all; + } + if (_common_update_attr_connector(self, show_err) < 0) { + err_str = "_common_update_attr_connector"; + goto err_common_update_attr_all; + } + if (_common_update_attr_transvr_comp(self, show_err) < 0) { + err_str = "_common_update_attr_transvr_comp"; + goto err_common_update_attr_all; + } + if (_common_update_attr_transvr_comp_ext(self, show_err) < 0) { + err_str = "_common_update_attr_transvr_comp_ext"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_name(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_name"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_pn(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_pn"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_rev(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_rev"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_sn(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_sn"; + goto err_common_update_attr_all; + } + if (_common_update_attr_br(self, show_err) < 0) { + err_str = "_common_update_attr_br"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_smf(self, show_err) < 0) { + err_str = "_common_update_attr_len_smf"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om1(self, show_err) < 0) { + err_str = "_common_update_attr_len_om1"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om2(self, show_err) < 0) { + err_str = "_common_update_attr_len_om2"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om3(self, show_err) < 0) { + err_str = "_common_update_attr_len_om3"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om4(self, show_err) < 0) { + err_str = "_common_update_attr_len_om4"; + goto err_common_update_attr_all; + } + if (_common_update_attr_option(self, show_err) < 0) { + err_str = "_common_update_attr_option"; + goto err_common_update_attr_all; + } + if (_common_update_attr_comp_rev(self, show_err) < 0) { + err_str = "_common_update_attr_comp_rev"; + goto err_common_update_attr_all; + } + if (_common_update_attr_diag_type(self, show_err) < 0) { + err_str = "_common_update_attr_diag_type"; + goto err_common_update_attr_all; + } + if (_common_update_attr_wavelength(self, show_err) < 0) { + err_str = "_common_update_attr_wavelength"; + goto err_common_update_attr_all; + } + return 0; + +err_common_update_attr_all: + if (show_err){ + SWPS_INFO("%s: fail at:%s :%s\n", __func__, err_str, self->swp_name); + } + return -1; +} + + +int +_sfp_update_attr_all(struct transvr_obj_s *self, + int show_err){ + + char *err_str = DEBUG_TRANSVR_STR_VAL; + + if (_common_update_attr_all(self, show_err) < 0){ + err_str = "_common_update_attr_all"; + goto err_sfp_update_attr_all; + } + if (_sfp_update_attr_len_sm(self, show_err) < 0) { + err_str = "_sfp_update_attr_len_sm"; + goto err_sfp_update_attr_all; + } + if (_sfp_update_attr_rate_id(self, show_err) < 0) { + err_str = "_sfp_update_attr_rate_id"; + goto err_sfp_update_attr_all; + } + if ((self->rate_id) > 0) { + if (_sfp_update_attr_soft_rs0(self, show_err) < 0) { + err_str = "_sfp_update_attr_soft_rs0"; + goto err_sfp_update_attr_all; + } + if (_sfp_update_attr_soft_rs1(self, show_err) < 0) { + err_str = "_sfp_update_attr_soft_rs1"; + goto err_sfp_update_attr_all; + } + } + return 0; + +err_sfp_update_attr_all: + if (show_err){ + SWPS_INFO("%s: fail at:%s :%s\n", __func__, err_str, self->swp_name); + } + return -1; +} + + +int +_qsfp_update_attr_all(struct transvr_obj_s *self, + int show_err){ + + char *err_str = DEBUG_TRANSVR_STR_VAL; + + if (_common_update_attr_all(self, show_err) < 0){ + err_str = "_common_update_attr_all"; + goto err_qsfp_update_attr_all; + } + if (_qsfg_update_attr_extbr(self, show_err) < 0) { + err_str = "_qsfg_update_attr_extbr"; + goto err_qsfp_update_attr_all; + } + if (self->type == TRANSVR_TYPE_QSFP_28) { + if (_qsfp_update_attr_cdr(self, 1) < 0) { + err_str = "_qsfp_update_attr_cdr"; + goto err_qsfp_update_attr_all; + } + } + return 0; + +err_qsfp_update_attr_all: + if (show_err){ + SWPS_INFO("%s: fail at:%s :%s\n", __func__, err_str, self->swp_name); + } + return -1; +} + + +/* ========== Object functions for common type ========== + */ +int +_common_count_temp(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + int sign = 0; + int high = 0; + int low = 0; + int lmax = 8; + + /* Count high */ + sign = get_bit(high_byte,7); + SWP_BIT_CLEAR(high_byte, 7); + high = (int)high_byte; + if (sign == 1) { + high = 0 - high; + } + /* Count low */ + low = (get_bit(low_byte, 7) * 500); + low += (get_bit(low_byte, 6) * 250); + low += (get_bit(low_byte, 5) * 125); + low += (get_bit(low_byte, 4) * 62); + low = (low / 100); + /* Integrate High and Low */ + return snprintf(buf_p, lmax, "%d.%d\n", high, low); +} + + +int +_common_count_voltage(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note]: + * Internally measured transceiver supply voltage. Represented + * as a 16 bit unsigned integer with the voltage defined as the + * full 16 bit value (0-65535) with LSB equal to 100 uVolt, + * yielding a total range of 0 to +6.55 Volts. Practical + * considerations to be defined by transceiver manufacturer will + * tend to limit the actual bounds of the supply voltage measurement. + * Accuracy is vendor specific but must be better than 3% of the + * manufacturer's nominal value over specified operating temperature + * and voltage. Note that in some transceivers, transmitter supply + * voltage and receiver supply voltage are isolated. In that case, + * only one supply is monitored. Refer to the device specification + * for more detail. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 100 uV (1mV=1000uV) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total/10) / 1000); + val_f = ((total/10) - (val_i*1000)); + /* Return Unit: 1 Volt */ + return snprintf(buf_p, lmax, "%d.%03d\n", val_i, val_f); +} + + +int +_common_count_tx_bias(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note] + * Measured TX bias current in uA. Represented as a 16 bit unsigned + * integer with the current defined as the full 16 bit value (0-65535) + * with LSB equal to 2 uA, yielding a total range of 0 to 131 mA. + * Accuracy is vendor specific but must be better than 10% of the + * manufacturer's nominal value over specified operating temperature + * and voltage. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 2 uA (1mA=1000uA) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total*2) / 1000); + val_f = (((total*2) - (val_i*1000)) / 100); + /* Return Unit: 1 mA */ + return snprintf(buf_p, lmax, "%d.%01d\n", val_i, val_f); +} + + +int +_common_count_tx_power(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note] + * Measured TX output power in mW. Represented as a 16 bit unsigned + * integer with the power defined as the full 16 bit value (0-65535) + * with LSB equal to 0.1 uW, yielding a total range of 0 to 6.5535 mW + * (~ -40 to +8.2 dBm). Data is assumed to be based on measurement of + * laser monitor photodiode current. It is factory calibrated to absolute + * units using the most representative fiber output type. Accuracy is + * vendor specific but must be better than 3dB over specified temperature + * and voltage. Data is not valid when the transmitter is disabled. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 0.1 uW (1mW=1000uW) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total/10) / 1000); + val_f = ((total/10) - (val_i*1000)); + /* Return Unit: 1 mW */ + return snprintf(buf_p, lmax, "%d.%03d\n", val_i, val_f); +} + + +int +_common_count_rx_power(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note] + * Measured RX received optical power in mW. Value can represent either + * average received power or OMA depending upon how bit 3 of byte 92 (A0h) + * is set. Represented as a 16 bit unsigned integer with the power defined + * as the full 16 bit value (0-65535) with LSB equal to 0.1 uW, yielding a + * total range of 0 to 6.5535 mW (~ -40 to +8.2 dBm). Absolute accuracy is + * dependent upon the exact optical wavelength. For the vendor specified + * wavelength, accuracy shall be better than 3dB over specified temperature + * and voltage. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 0.1 uW (1mW=1000uW) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total/10) / 1000); + val_f = ((total/10) - (val_i*1000)); + /* Return Unit: 1 mW */ + return snprintf(buf_p, lmax, "%d.%03d\n", val_i, val_f); +} + + +int +_common_count_wavelength(struct transvr_obj_s *self, + uint8_t high_byte, + uint8_t low_byte) { + /* [Note] + * SFP : uint 1 um. + * QSFP: unit 0.05 um. + */ + int total = 0; + + total = transform_word_to_int(high_byte, low_byte); + switch (self->type) { + case TRANSVR_TYPE_SFP: + return total; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + return (total/20); + + default: + break; + } + return ERR_TRANSVR_UNDEFINED; +} + + +int +common_get_id(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_id, + "common_get_id"); + if (err_code < 0){ + return err_code; + } + /* Transform to INT to show error case */ + return (int)self->id; +} + + +int +common_get_ext_id(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_extended_id, + "common_get_ext_id"); + if (err_code < 0){ + return err_code; + } + /* Transform to INT to show error case */ + return (int)self->ext_id; +} + + +int +common_get_connector(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_connector, + "common_get_connector"); + if (err_code < 0){ + return err_code; + } + /* Transform to INT to show error case */ + return (int)self->connector; +} + + +int +common_get_vendor_name(struct transvr_obj_s *self, char *buf){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_name); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_name, + "common_get_vendor_name"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_name); +} + + +int +common_get_vendor_pn(struct transvr_obj_s *self, char *buf) { + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_pn); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_pn, + "common_get_vendor_pn"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_pn); +} + + +int +common_get_vendor_rev(struct transvr_obj_s *self, char *buf) { + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_rev); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_rev, + "common_get_vendor_rev"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_rev); +} + + +int +common_get_vendor_sn(struct transvr_obj_s *self, char *buf) { + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_sn); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_sn, + "common_get_vendor_sn"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_sn); +} + + +int +common_get_br(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return (int)self->br; + } + err = _check_by_mode(self, + &_common_update_attr_br, + "common_get_br"); + if (err < 0){ + return err; + } + /* Transform to INT to show error case */ + return (int)self->br; +} + + +int +common_get_len_smf(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_smf; + } + err = _check_by_mode(self, + &_common_update_attr_len_smf, + "common_get_len_smf"); + if (err < 0){ + return err; + } + return self->len_smf; +} + + +int +common_get_len_om1(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om1; + } + err = _check_by_mode(self, + &_common_update_attr_len_om1, + "common_get_len_om1"); + if (err < 0){ + return err; + } + return self->len_om1; +} + + +int +common_get_len_om2(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om2; + } + + err = _check_by_mode(self, + &_common_update_attr_len_om2, + "common_get_len_om2"); + if (err < 0){ + return err; + } + return self->len_om2; +} + + +int +common_get_len_om3(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om3; + } + + err = _check_by_mode(self, + &_common_update_attr_len_om3, + "common_get_len_om3"); + if (err < 0){ + return err; + } + return self->len_om3; +} + + +int +common_get_len_om4(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om4; + } + err = _check_by_mode(self, + &_common_update_attr_len_om4, + "common_get_len_om4"); + if (err < 0){ + return err; + } + return self->len_om4; +} + + +int +common_get_comp_extended(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp_ext, + "common_get_comp_extended"); + if (err_code < 0){ + return err_code; + } + return self->transvr_comp_ext; +} + + +int +common_get_comp_rev(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_comp_rev, + "common_get_comp_rev"); + if (err_code < 0){ + return err_code; + } + return self->comp_rev; +} + + +int +common_get_info(struct transvr_obj_s *self){ + + if (self->state != STATE_TRANSVR_CONNECTED) { + return self->state; + } + return self->info; +} + + +int +_common_get_if_lane(struct transvr_obj_s *self, + char *result){ + int i = 0; + int tmp_val = 0; + char tmp_str[LEN_TRANSVR_M_STR] = DEBUG_TRANSVR_STR_VAL; + + memset(result, 0, LEN_TRANSVR_M_STR); + + for (i=0; ilane_id); i++) { + tmp_val = self->lane_id[i]; + if (tmp_val < 1) { + break; + } + memset(tmp_str, 0, LEN_TRANSVR_M_STR); + if (i == 0) { + snprintf(tmp_str, LEN_TRANSVR_M_STR, "%d", tmp_val); + } else { + snprintf(tmp_str, LEN_TRANSVR_M_STR, ",%d", tmp_val); + } + strncat(result, tmp_str, LEN_TRANSVR_M_STR); + } + if (i == 0) { + return EVENT_TRANSVR_TASK_FAIL; + } + return 0; +} + + +int +common_get_if_lane(struct transvr_obj_s *self, + char *buf_p){ + + char tmp_str[LEN_TRANSVR_M_STR] = DEBUG_TRANSVR_STR_VAL; + + if (self->ioexp_obj_p->state != STATE_IOEXP_NORMAL) { + return snprintf(buf_p, LEN_TRANSVR_M_STR, "%d\n", ERR_TRANSVR_ABNORMAL); + } + if (_common_get_if_lane(self, tmp_str) < 0) { + return snprintf(buf_p, LEN_TRANSVR_M_STR, "%d\n" ,ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, LEN_TRANSVR_M_STR, "%s\n" ,tmp_str); +} + + +int +sfp_get_len_sm(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_sfp_update_attr_len_sm, + "sfp_get_len_sm"); + if (err_code < 0){ + return err_code; + } + return self->len_sm; +} + + +int +sfp_get_rate_id(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_sfp_update_attr_rate_id, + "sfp_get_rate_id"); + if (err_code < 0){ + return err_code; + } + return self->rate_id; +} + + +int +sfp_get_soft_rs0(struct transvr_obj_s *self){ + /* Note: + * SFP Soft Rate_Select Select [aka. "RS(0)"] address + * A2h, offset: 110, bit 3 (begin form 0) + */ + int err_code = DEBUG_TRANSVR_INT_VAL; + int bit_shift = 3; + uint8_t result = 0x00; + uint8_t bitmask = (1 << bit_shift); + + /* Check rate identifier is supported */ + err_code = self->get_rate_id(self); + if (err_code <= 0) { + return ERR_TRANSVR_NOTSUPPORT; + } + /* Update and check */ + err_code = _check_by_mode(self, + &_sfp_update_attr_soft_rs0, + "sfp_get_soft_rs0"); + if (err_code <0){ + return err_code; + } + result = (self->soft_rs0 & bitmask); + if (result == bitmask) { + return 1; + } + if (result == 0) { + return 0; + } + return ERR_TRANSVR_UNEXCPT; +} + + +int +sfp_get_soft_rs1(struct transvr_obj_s *self){ + /* Note: + * SFP Soft RS(1) Select address + * A2h, offset: 118, bit 3 (begin form 0) + */ + int err_code = DEBUG_TRANSVR_INT_VAL; + int bit_shift = 3; + uint8_t result = 0x00; + uint8_t bitmask = (1 << bit_shift); + + /* Check rate identifier is supported */ + err_code = self->get_rate_id(self); + if (err_code <= 0) { + return ERR_TRANSVR_NOTSUPPORT; + } + /* Update and check */ + err_code = _check_by_mode(self, + &_sfp_update_attr_soft_rs1, + "sfp_get_soft_rs1"); + if (err_code <0){ + return err_code; + } + result = (self->soft_rs1 & bitmask); + if (result == bitmask) { + return 1; + } + if (result == 0) { + return 0; + } + return ERR_TRANSVR_UNEXCPT; +} + + +int +sfp_get_transvr_temp(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_temp, + "sfp_get_transvr_temp"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_temp[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return _common_count_temp(self->curr_temp[0], + self->curr_temp[1], + buf_p); +} + + +int +sfp_get_transvr_voltage(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_voltage, + "sfp_get_transvr_voltage"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_voltage[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 Volt */ + return _common_count_voltage(self->curr_voltage[0], + self->curr_voltage[1], + buf_p); +} + + +int +sfp_get_transvr_tx_bias(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_tx_bias, + "sfp_get_transvr_tx_bias"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mA */ + return _common_count_tx_bias(self->curr_tx_bias[0], + self->curr_tx_bias[1], + buf_p); +} + + +int +sfp_get_transvr_tx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_tx_power, + "sfp_get_transvr_tx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _common_count_tx_power(self->curr_tx_power[0], + self->curr_tx_power[1], + buf_p); +} + + +int +sfp_get_transvr_rx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_rx_power, + "sfp_get_transvr_rx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _common_count_rx_power(self->curr_rx_power[0], + self->curr_rx_power[0], + buf_p); +} + + +int +sfp_get_transvr_rx_em(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_sfp_update_attr_rx_em, + "sfp_get_transvr_rx_em"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->tx_eq[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x\n", self->rx_em[0]); +} + + +int +sfp_get_transvr_tx_eq(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_sfp_update_attr_tx_eq, + "sfp_get_transvr_tx_eq"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->tx_eq[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x\n", self->tx_eq[0]); +} + + +int +_sfp_get_comp_extended(struct transvr_obj_s *self) { + /* Address: A0h / 36 + * Reference: SFF-8024 TABLE 4-4 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp_ext); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +__sfp_get_comp_attr(struct transvr_obj_s *self, + int array_offset) { + /* SFP Specification Compliance: A0h / 3-10 + * transvr_comp[0-7] = 3 - 10 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp[array_offset]); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +_sfp_get_comp_10g_eth_comp(struct transvr_obj_s *self) { + /* transvr_comp[0] = address A0h / 3 + * + * 3 7: 10G Base-ER + * 3 6: 10GBASE-LRM + * 3 5: 10GBASE-LR + * 3 4: 10GBASE-SR + */ + int bitmask = 0xf0; /* 11110000 */ + return (__sfp_get_comp_attr(self, 0) & bitmask); +} + + +int +_sfp_get_comp_1g_eth_comp(struct transvr_obj_s *self) { + /* transvr_comp[3] = address A0h / 6 + * + * 6 7: BASE-PX *3 + * 6 6: BASE-BX10 *3 + * 6 5: 100BASE-FX + * 6 4: 100BASE-LX/LX10 + * 6 3: 1000BASE-T + * 6 2: 1000BASE-CX + * 6 1: 1000BASE-LX *3 + * 6 0: 1000BASE-SX + */ + return __sfp_get_comp_attr(self, 3); +} + + +int +_sfp_get_cable_tech(struct transvr_obj_s *self) { + /* transvr_comp[5] = address A0h / 8 + * + * 8 3: Active Cable *8 + * 8 2: Passive Cable *8 + */ + int bitmask = 0x0c; /* 00001100 */ + return (__sfp_get_comp_attr(self, 5) & bitmask); +} + + +int +sfp_get_comp_eth_1(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "sfp_get_comp_eth_1"); + if (err_code < 0){ + return err_code; + } + return _sfp_get_comp_1g_eth_comp(self); +} + + +int +sfp_get_comp_eth_10(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "sfp_get_comp_eth_10"); + if (err_code < 0){ + return err_code; + } + return _sfp_get_comp_10g_eth_comp(self); +} + + +int +_sfp_get_connector_type(struct transvr_obj_s *self) { + /* Address: A0h / 2 + * Reference: SFF-8024 TABLE 4-3 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->connector); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +sfp_get_wavelength(struct transvr_obj_s *self, + char *buf_p) { + /* [Note] Optical and Cable Variants Specification Compliance (SFF-8472) + * [Addr] A0h, Bytes 60-61 + * [Note] For optical variants, as defined by having zero's in A0h Byte 8 + * bits 2 and 3, Bytes 60 and 61 denote nominal transmitter output + * wavelength at room temperature. 16 bit value with byte 60 as high + * order byte and byte 61 as low order byte. The laser wavelength is + * equal to the 16 bit integer value in nm. This field allows the user + * to read the laser wavelength directly, so it is not necessary to + * infer it from the Transceiver Codes A0h Bytes 3 to 10 (see Table + * 5-3). This also allows specification of wavelengths not covered + * in the Transceiver Codes, such as those used in coarse WDM systems. + * + * For passive and active cable variants, a value of 00h for both A0h + * Byte 60 and Byte 61 denotes laser wavelength or cable specification + * compliance is unspecified. + */ + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_common_update_attr_wavelength, + "common_get_wavelength"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->wavelength[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* unit: 1 um */ + return snprintf(buf_p, lmax, "%d\n", + _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1])); +} + + +int +sfp_get_1g_rj45_extphy_offset(struct transvr_obj_s *self, char *buf) { + + if (self->state != STATE_TRANSVR_CONNECTED) { + return ERR_TRANSVR_UNPLUGGED; + } + if ((self->info != TRANSVR_CLASS_BASE_T_1000) && + (self->info != TRANSVR_CLASS_BASE_T_1000_up) ){ + return ERR_TRANSVR_NOTSUPPORT; + } + return snprintf(buf, LEN_TRANSVR_S_STR, "0x%02x\n", self->extphy_offset); +} + + +int +sfp_get_1g_rj45_extphy_reg(struct transvr_obj_s *self, char *buf) { + + int i = 0; + int ret = 0; + int retry = 3; + int delay = 200; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return ERR_TRANSVR_UNPLUGGED; + } + if ((self->info != TRANSVR_CLASS_BASE_T_1000) && + (self->info != TRANSVR_CLASS_BASE_T_1000_up) ){ + return ERR_TRANSVR_NOTSUPPORT; + } + if (_common_setup_page(self, VAL_TRANSVR_EXTPHY_ADDR_56, + -1, self->extphy_offset, 1, 0) < 0) { + return -EIO; + } + for (i=0; ii2c_client_p, self->extphy_offset); + if (ret >=0) { + goto ok_sfp_get_1g_rj45_extphy_reg; + } + msleep(delay); + } + SWPS_INFO("%s: retry:%d fail :%s :0x%02x\n", + __func__, retry, self->swp_name, self->extphy_offset); + return -EIO; + +ok_sfp_get_1g_rj45_extphy_reg: + ret = ((ret & 0x00ff) << 8) | ((ret & 0xff00) >> 8); + return snprintf(buf, LEN_TRANSVR_S_STR, "0x%04x\n", ret); +} + + +int +__qsfp_get_power_cls(struct transvr_obj_s *self, + int direct_access){ + + int err_code; + uint8_t detect_val; + + /* Detect and Update power class attribute */ + if (direct_access){ + err_code = _check_by_mode(self, + &_common_update_attr_extended_id, + "__qsfp_get_power_cls"); + } else { + err_code = self->ext_id; + } + if (err_code <0){ + return err_code; + } + if (err_code == DEBUG_TRANSVR_HEX_VAL){ + return ERR_TRANSVR_UPDATE_FAIL; + } + /* Clean data */ + detect_val = self->ext_id; + SWP_BIT_CLEAR(detect_val, 2); /* Bit2: CDR RX present */ + SWP_BIT_CLEAR(detect_val, 3); /* Bit3: CDR TX present */ + SWP_BIT_CLEAR(detect_val, 4); /* Bit4: CLEI present */ + SWP_BIT_CLEAR(detect_val, 5); /* Bit5: reserved */ + /* Identify power class */ + switch (detect_val) { + case 0: /* Class_1: 00000000 */ + return 1; + case 64: /* Class_2: 01000000 */ + return 2; + case 128: /* Class_3: 10000000 */ + return 3; + case 192: /* Class_4: 11000000 */ + return 4; + case 1: /* Class_5: 00000001 */ + case 193: /* Class_5: 11000001 */ + return 5; + case 2: /* Class_6: 00000010 */ + case 194: /* Class_6: 11000010 */ + return 6; + case 3: /* Class_7: 00000011 */ + case 195: /* Class_7: 11000011 */ + return 7; + default: + break; + } + SWPS_INFO("%s: Detect undefined power class:%d\n", __func__, detect_val); + return ERR_TRANSVR_UNDEFINED; +} + + +int +qsfp_get_power_cls(struct transvr_obj_s *self) { + return __qsfp_get_power_cls(self, 1); +} + + +int +__qsfp_get_cdr_present(struct transvr_obj_s *self, + int direct_access){ + + int retval; + int BIT_SHIFT = 2; + int BIT_MASK = 0x3; + + /* Detect and Update power class attribute */ + if (direct_access) { + retval = _check_by_mode(self, + &_common_update_attr_extended_id, + "__qsfp_get_cdr_present"); + if (retval < 0){ + return retval; + } + } + retval = self->ext_id; + if (retval == DEBUG_TRANSVR_HEX_VAL){ + return ERR_TRANSVR_UPDATE_FAIL; + } + /* Clean data and return */ + return (int)(retval >> BIT_SHIFT & BIT_MASK); +} + + +int +qsfp_get_cdr_present(struct transvr_obj_s *self) { + return __qsfp_get_cdr_present(self, 1); +} + + +int +qsfp_get_cdr(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_qsfp_update_attr_cdr, + "qsfp_get_cdr"); + if (err_code <0){ + return err_code; + } + + return self->cdr; +} + + +int +__qsfp_get_comp_attr(struct transvr_obj_s *self, + int array_offset) { + /* QSFP Specification Compliance: 00h / 131-138 + * transvr_comp[0-7] = 131 - 138 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp[array_offset]); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +_qsfp_get_comp_10_40_100_ethernet(struct transvr_obj_s *self) { + /* transvr_comp[0] = address 00h / 131 + * + * 131 7: Extended: See section 6.3.23. The Extended Specification Compliance + * Codes are maintained in the Transceiver Management section of SFF- + * 8024. + * 131 6: 10GBASE-LRM + * 131 5: 10GBASE-LR + * 131 4: 10GBASE-SR + * 131 3: 40GBASE-CR4 + * 131 2: 40GBASE-SR4 + * 131 1: 40GBASE-LR4 + * 131 0: 40G Active Cable (XLPPI) + */ + return __qsfp_get_comp_attr(self, 0); +} + + +int +_qsfp_get_comp_sonet(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 132 7-3: Reserved + * 132 2: OC 48, long reach + * 132 1: OC 48, intermediate reach + * 132 0: OC 48 short reach + */ + return __qsfp_get_comp_attr(self, 1); +} + + +int +_qsfp_get_comp_sas_sata(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 133 7: SAS 24.0 Gb/s + * 133 6: SAS 12.0 Gb/s + * 133 5: SAS 6.0 Gb/s + * 133 4: SAS 3.0 Gb/s + * 133 3-0: Reserved + */ + return __qsfp_get_comp_attr(self, 2); +} + + +int +_qsfp_get_comp_ethernet(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 134 7-4: Reserved + * 134 3: 1000BASE-T + * 134 2: 1000BASE-CX + * 134 1: 1000BASE-LX + * 134 0: 1000BASE-SX + */ + return __qsfp_get_comp_attr(self, 3); +} + + +int +_qsfp_get_comp_fc_link_length(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 135 7: Very long distance (V) + * 135 6: Short distance (S) + * 135 5: Intermediate distance (I) + * 135 4: Long distance (L) + * 135 3: Medium (M) + */ + int mask = 0xFC; /* 11111100 */ + return (__qsfp_get_comp_attr(self, 4) & mask); +} + + +int +_qsfp_get_comp_fc_trans_tech(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 135 2: Reserved + * 135 1: Longwave laser (LC) + * 135 0: Electrical inter-enclosure (EL) + * + * 136 7: Electrical intra-enclosure + * 136 6: Shortwave laser w/o OFC (SN) + * 136 5: Shortwave laser w OFC (SL) + * 136 4: Longwave Laser (LL) + * 136 3-0: Reserved + * + * return value = [bit 8-15:addr 135][bit 0-7:addr 136] + */ + int mask_135 = 7; /* 00000111 */ + int val_135 = (__qsfp_get_comp_attr(self, 4) & mask_135); + int val_136 = __qsfp_get_comp_attr(self, 5); + return ((val_135 << 7) + val_136); +} + + +int +_qsfp_get_comp_fc_trans_media(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 137 7: Twin Axial Pair (TW) + * 137 6: Shielded Twisted Pair (TP) + * 137 5: Miniature Coax (MI) + * 137 4: Video Coax (TV) + * 137 3: Multi-mode 62.5 m (M6) + * 137 2: Multi-mode 50 m (M5) + * 137 1: Multi-mode 50 um (OM3) + * 137 0: Single Mode (SM) + */ + return __qsfp_get_comp_attr(self, 6); +} + + +int +_qsfp_get_comp_fc_speed(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 138 7: 1200 MBps (per channel) + * 138 6: 800 MBps + * 138 5: 1600 MBps (per channel) + * 138 4: 400 MBps + * 138 3: 3200 MBps (per channel) + * 138 2: 200 MBps + * 138 1: Extended: See section 6.3.23. The Extended Specification + * Compliance Codes are maintained in the Transceiver Management + * section of SFF-8024. + * 138 0: 100 MBps + */ + return __qsfp_get_comp_attr(self, 7); +} + + +int +_qsfp_get_comp_extended(struct transvr_obj_s *self) { + /* Address: 00h / 192 + * Reference: SFF-8024 TABLE 4-4 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp_ext); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_comp_eth(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "qsfp_get_comp_eth"); + if (err_code < 0){ + return err_code; + } + return _qsfp_get_comp_ethernet(self); +} + + +int +qsfp_get_comp_10_40(struct transvr_obj_s *self) { + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "qsfp_get_comp_10_40"); + if (err_code < 0){ + return err_code; + } + return _qsfp_get_comp_10_40_100_ethernet(self); +} + + +int +_qsfp_get_connector_type(struct transvr_obj_s *self) { + /* Address: 00h / 130 + * Reference: SFF-8024 TABLE 4-3 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->connector); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_transvr_temp(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_temp, + "qsfp_get_transvr_temp"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_temp[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return _common_count_temp(self->curr_temp[0], + self->curr_temp[1], + buf_p); +} + + +int +qsfp_get_transvr_voltage(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_voltage, + "qsfp_get_transvr_voltage"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_voltage[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 Volt */ + return _common_count_voltage(self->curr_voltage[0], + self->curr_voltage[1], + buf_p); +} + + +int +qsfp_get_transvr_tx_eq(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_qsfp_update_attr_tx_eq, + "qsfp_get_transvr_tx_eq"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->tx_eq[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x%02x\n", + self->tx_eq[0], self->tx_eq[1]); +} + + +int +qsfp_get_transvr_rx_am(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_qsfp_update_attr_rx_am, + "qsfp_get_transvr_rx_am"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->rx_am[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x%02x\n", + self->rx_am[0], self->rx_am[1]); +} + + +int +qsfp_get_transvr_rx_em(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_qsfp_update_attr_rx_em, + "qsfp_get_transvr_rx_em"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->rx_em[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x%02x\n", + self->rx_em[0], self->rx_em[1]); +} + + +int +_qsfp_get_channel_diag(uint8_t *data_array, + int (*count_func)(uint8_t high_byte, uint8_t low_byte, char *buf_p), + char *ch_name, + char *result_p) { + int i, high, low; + int len_max = 128; + char ch_buf[4][16] = { DEBUG_TRANSVR_STR_VAL, + DEBUG_TRANSVR_STR_VAL, + DEBUG_TRANSVR_STR_VAL, + DEBUG_TRANSVR_STR_VAL }; + + for (i=0; i<4; i++) { + high = (i*2); + low = ((i*2) + 1); + count_func(data_array[high], data_array[low], ch_buf[i]); + } + return snprintf(result_p, len_max, + "%s-%d:%s%s-%d:%s%s-%d:%s%s-%d:%s", + ch_name, 1, ch_buf[0], + ch_name, 2, ch_buf[1], + ch_name, 3, ch_buf[2], + ch_name, 4, ch_buf[3]); +} + + +int +qsfp_get_soft_rx_los(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int mask = 0x0f; /* Bit 0 ~ Bit 3 */ + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_soft_rx_los, + "qsfp_get_soft_rx_los"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + return snprintf(buf_p, lmax, "0x%02x\n", (self->rx_los & mask)); +} + + +int +qsfp_get_soft_tx_disable(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int mask = 0x0f; /* Bit 0 ~ Bit 3 */ + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_disable, + "qsfp_get_soft_tx_disable"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + return snprintf(buf_p, lmax, "0x%02x\n", (self->tx_disable & mask)); +} + + +int +qsfp_get_soft_tx_fault(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int mask = 0x0f; /* Bit 0 ~ Bit 3 */ + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_fault, + "qsfp_get_soft_tx_fault"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + return snprintf(buf_p, lmax, "0x%02x\n", (self->tx_fault & mask)); +} + + +int +qsfp_get_auto_tx_disable(struct transvr_obj_s *self, + char *buf_p) { + + if (self->auto_tx_disable == VAL_TRANSVR_FUNCTION_DISABLE) { + return snprintf(buf_p, LEN_TRANSVR_S_STR, + "%d\n", ERR_TRANSVR_FUNC_DISABLE); + } + return snprintf(buf_p, LEN_TRANSVR_S_STR, + "0x%02x\n", self->auto_tx_disable); +} + + +int +qsfp_get_transvr_tx_bias(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *ch_name = "TX"; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_tx_bias, + "qsfp_get_transvr_tx_bias"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mA */ + return _qsfp_get_channel_diag(self->curr_tx_bias, + _common_count_tx_bias, + ch_name, + buf_p); +} + + +int +qsfp_get_transvr_tx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *ch_name = "TX"; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_tx_power, + "qsfp_get_transvr_tx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_power[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _qsfp_get_channel_diag(self->curr_tx_power, + _common_count_tx_power, + ch_name, + buf_p); +} + + +int +qsfp_get_transvr_rx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *ch_name = "RX"; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_rx_power, + "qsfp_get_transvr_rx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_power[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _qsfp_get_channel_diag(self->curr_rx_power, + _common_count_rx_power, + ch_name, + buf_p); +} + + +int +qsfp_get_wavelength(struct transvr_obj_s *self, + char *buf_p) { + /* [Desc] Wavelength or Copper Cable Attenuation (SFF-8636) + * [Addr] 00h 186-187 + * [Note] + * For optical free side devices, this parameter identifies the nominal + * transmitter output wavelength at room temperature. This parameter is + * a 16-bit hex value with Byte 186 as high order byte and Byte 187 as + * low order byte. The laser wavelength is equal to the 16-bit integer value + * divided by 20 in nm (units of 0.05 nm). This resolution should be adequate + * to cover all relevant wavelengths yet provide enough resolution for all + * expected DWDM applications. For accurate representation of controlled + * wavelength applications, this value should represent the center of the + * guaranteed wavelength range. + * If the free side device is identified as copper cable these registers will + * be used to define the cable attenuation. An indication of 0 dB attenuation + * refers to the case where the attenuation is not known or is unavailable. + * Byte 186 (00-FFh) is the copper cable attenuation at 2.5 GHz in units of 1 dB. + * Byte 187 (00-FFh) is the copper cable attenuation at 5.0 GHz in units of 1 dB. + */ + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_common_update_attr_wavelength, + "common_get_wavelength"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->wavelength[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* unit: 1 um */ + return snprintf(buf_p, lmax, "%d\n", + _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1])); +} + + +/* Public Function for Setup Features + */ +static int +__sfp_set_soft_rs(struct transvr_obj_s *self, + int input_val, + int address, + int page, + int offset, + int bit_shift, + uint8_t *attr_p, + char *caller, + int show_err) { + + int retval = ERR_TRANSVR_UNEXCPT; + int err_code = ERR_TRANSVR_UNEXCPT; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + uint8_t update_val = (*attr_p); + + switch (input_val) { + case 0: + SWP_BIT_CLEAR(update_val, bit_shift); + break; + case 1: + SWP_BIT_SET(update_val, bit_shift); + break; + default: + retval = ERR_TRANSVR_UNEXCPT; + err_code = ERR_TRANSVR_UNEXCPT; + err_msg = "Exception occurs"; + goto err_private_sfp_set_soft_rs_1; + } + err_code = _common_set_uint8_attr(self, + address, + page, + offset, + update_val, + attr_p, + caller, + show_err); + if (err_code < 0) { + retval = err_code; + err_msg = "Write data via i2c fail!"; + goto err_private_sfp_set_soft_rs_1; + } + (*attr_p) = update_val; + return 0; + +err_private_sfp_set_soft_rs_1: + if (show_err) { + SWPS_INFO("%s: %s :%d :%s\n :%d\n", + __func__, err_msg, err_code, self->swp_name, input_val); + } + return retval; +} + + +static int +_sfp_set_soft_rs(struct transvr_obj_s *self, + int input_val, + int address, + int page, + int offset, + int bit_shift, + int (*attr_update_func)(struct transvr_obj_s *self, int show_err), + uint8_t *attr_p, + char *caller, + int show_err) { + + int retval = ERR_TRANSVR_UNEXCPT; + int err_code = ERR_TRANSVR_UNEXCPT; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + + /* Check input value */ + if ((input_val != 0) && (input_val != 1)){ + retval = ERR_TRANSVR_BADINPUT; + err_code = ERR_TRANSVR_BADINPUT; + err_msg = "Input range incorrect!"; + goto err_common_sfp_set_soft_rs_1; + } + /* Check rate identifier is supported */ + err_code = self->get_rate_id(self); + if (err_code <= 0) { + switch (err_code) { + case 0: + retval = ERR_TRANSVR_NOTSUPPORT; + err_msg = "Not support this feature"; + break; + case ERR_TRANSVR_UNINIT: + retval = ERR_TRANSVR_UNINIT; + err_msg = "Check CDR present fail!"; + break; + case ERR_TRANSVR_UNPLUGGED: + retval = ERR_TRANSVR_UNPLUGGED; + err_msg = "Transceiver unplugged!"; + break; + default: + retval = err_code; + err_msg = "Check Rate_ID fail!"; + break; + } + goto err_common_sfp_set_soft_rs_1; + } + /* Check and update */ + err_code = _check_by_mode(self, + attr_update_func, + caller); + if ( (err_code < 0) || + ((*attr_p) == DEBUG_TRANSVR_HEX_VAL) ){ + retval = err_code; + err_msg = "Get current value fail!"; + goto err_common_sfp_set_soft_rs_1; + } + /* Generate and update value */ + return __sfp_set_soft_rs(self, + input_val, + address, + page, + offset, + bit_shift, + attr_p, + caller, + show_err); + +err_common_sfp_set_soft_rs_1: + if (show_err) { + SWPS_INFO("%s: %s :%d :%s\n :%d\n", + __func__, err_msg, err_code, self->swp_name, input_val); + } + return retval; +} + + +int +sfp_set_soft_rs0(struct transvr_obj_s *self, + int input_val) { + /* Note: + * SFP Soft Rate_Select Select RX ["RS(0)"] address + * A2h, offset: 110, bit 3 + */ + int bit_shift = 3; + int show_err = 1; + return _sfp_set_soft_rs(self, + input_val, + self->eeprom_map_p->addr_soft_rs0, + self->eeprom_map_p->page_soft_rs0, + self->eeprom_map_p->offset_soft_rs0, + bit_shift, + &_sfp_update_attr_soft_rs0, + &(self->soft_rs0), + "sfp_set_soft_rs0", + show_err); +} + + +int +sfp_set_soft_rs1(struct transvr_obj_s *self, + int input_val) { + /* Note: + * SFP Soft Rate_Select Select RX ["RS(1)"] address + * A2h, offset: 118, bit 3 + */ + int bit_shift = 3; + int show_err = 1; + return _sfp_set_soft_rs(self, + input_val, + self->eeprom_map_p->addr_soft_rs1, + self->eeprom_map_p->page_soft_rs1, + self->eeprom_map_p->offset_soft_rs1, + bit_shift, + &_sfp_update_attr_soft_rs1, + &(self->soft_rs1), + "sfp_set_soft_rs1", + show_err); +} + + +int +__sfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv = DEBUG_TRANSVR_HEX_VAL; + + if ((input < 0) || (input > 0xFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_sfp_set_tx_eq; + } + setv = (uint8_t)input; + if (self->tx_eq[0] == setv) { + return 0; + } + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + setv, + &(self->tx_eq[0]), + "_sfp_set_tx_eq", + show_e); + if (err < 0) { + emsg = "set_uint8_attr fail"; + goto err_sfp_set_tx_eq; + } + return 0; + +err_sfp_set_tx_eq: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_sfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + + uint8_t tmp; + int i = 0; + int retry = 3; + + for (i=0; itx_eq[0]; + if (_sfp_update_attr_tx_eq(self, show_e) < 0){ + continue; + } + if (self->tx_eq[0] == tmp){ + return 0; + } + } + return ERR_TRANSVR_UPDATE_FAIL; +} + + +int +sfp_set_tx_eq(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_sfp_update_attr_tx_eq, + "sfp_set_tx_eq"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _sfp_set_tx_eq(self, input, 1); +} + + +int +__sfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv = DEBUG_TRANSVR_HEX_VAL; + + if ((input < 0) || (input > 0xFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_sfp_set_rx_em; + } + setv = (uint8_t)input; + if (self->rx_em[0] == setv) { + return 0; + } + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + setv, + &(self->rx_em[0]), + "_sfp_set_rx_em", + show_e); + if (err < 0) { + emsg = "set_uint8_attr fail"; + goto err_sfp_set_rx_em; + } + return 0; + +err_sfp_set_rx_em: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_sfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + + uint8_t tmp; + int i = 0; + int retry = 3; + + for (i=0; irx_em[0]; + if (_sfp_update_attr_rx_em(self, show_e) < 0){ + continue; + } + if (self->rx_em[0] == tmp){ + return 0; + } + } + return -1; +} + + +int +sfp_set_rx_em(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_sfp_update_attr_rx_em, + "sfp_set_rx_em"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _sfp_set_rx_em(self, input, 1); +} + + +int +sfp_set_1g_rj45_extphy_offset(struct transvr_obj_s *self, + int input) { + + if (self->state != STATE_TRANSVR_CONNECTED) { + return ERR_TRANSVR_UNPLUGGED; + } + if ((self->info != TRANSVR_CLASS_BASE_T_1000) && + (self->info != TRANSVR_CLASS_BASE_T_1000_up) ){ + return ERR_TRANSVR_NOTSUPPORT; + } + if ((input < 0) || (input > 0xff)) { + return ERR_TRANSVR_BADINPUT; + } + self->extphy_offset = (uint8_t)input; + return 0; +} + + +int +sfp_set_1g_rj45_extphy_reg(struct transvr_obj_s *self, + int input) { + + int i = 0; + int retry = 3; + int delay = 200; + uint16_t tmp = 0; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return ERR_TRANSVR_UNPLUGGED; + } + if ((self->info != TRANSVR_CLASS_BASE_T_1000) && + (self->info != TRANSVR_CLASS_BASE_T_1000_up) ){ + return ERR_TRANSVR_NOTSUPPORT; + } + if ((input < 0) || (input > 0xffff)) { + return ERR_TRANSVR_BADINPUT; + } + tmp = ((input & 0x00ff) << 8) | ((input & 0xff00) >> 8); + if (_common_setup_page(self, VAL_TRANSVR_EXTPHY_ADDR_56, + -1, self->extphy_offset, 1, 0) < 0) { + return -EIO; + } + for (i=0; i<=retry; i++) { + if (i2c_smbus_write_word_data(self->i2c_client_p, + self->extphy_offset, + tmp) >= 0) { + return 0; + } + msleep(delay); + } + SWPS_INFO("%s: retry:%d fail :%s :0x%02x\n", + __func__, retry, self->swp_name, self->extphy_offset); + return -EIO; +} + + +static int +__qsfp_set_cdr(struct transvr_obj_s *self, + int input_val, + int show_err) { + + uint8_t update_val; + int CDR_FEATURE_SUPPORTED = 0x3; + int retval = ERR_TRANSVR_UNEXCPT; + int err_code = ERR_TRANSVR_UNEXCPT; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + char *func_name = "__qsfp_set_cdr"; + + /* Check input value */ + if ((input_val < 0) || (input_val > 0xff)){ + retval = ERR_TRANSVR_BADINPUT; + err_code = ERR_TRANSVR_BADINPUT; + err_msg = "Input range incorrect!"; + goto err_qsfp_set_cdr_1; + } + update_val = (uint8_t)input_val; + /* Check CDR supported by transceiver */ + err_code = qsfp_get_cdr_present(self); + if (err_code < 0) { + retval = err_code; + switch (err_code) { + case ERR_TRANSVR_UNINIT: + err_msg = "Check CDR present fail!"; + break; + case ERR_TRANSVR_UNPLUGGED: + err_msg = "Transceiver unplugged!"; + break; + default: + err_msg = "Check CDR present fail!"; + break; + } + goto err_qsfp_set_cdr_1; + } + if (err_code != CDR_FEATURE_SUPPORTED) { + retval = ERR_TRANSVR_NOTSUPPORT; + err_msg = "This transceiver not support CDR!"; + goto err_qsfp_set_cdr_1; + } + /* Check and update */ + err_code = _check_by_mode(self, + &_qsfp_update_attr_cdr, + func_name); + if ( (err_code < 0) || + (self->cdr == DEBUG_TRANSVR_HEX_VAL) ){ + retval = err_code; + err_msg = "Get current value fail!"; + goto err_qsfp_set_cdr_1; + } + /* Write input value to transceiver */ + return _common_set_uint8_attr(self, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->page_cdr, + self->eeprom_map_p->offset_cdr, + update_val, + &(self->cdr), + func_name, + show_err); + +err_qsfp_set_cdr_1: + if (show_err) { + SWPS_INFO("%s: %s :%d :%s\n :%d\n", + __func__, err_msg, err_code, self->swp_name, input_val); + } + return retval; +} + + +int +qsfp_set_cdr(struct transvr_obj_s *self, + int input_val) { + return __qsfp_set_cdr(self, input_val, 1); +} + + +int +qsfp_set_soft_tx_disable(struct transvr_obj_s *self, + int input_val) { + + int show_err = 1; + int in_max = 0xf; /* 1111 */ + int in_min = 0x0; /* 0000 */ + int retval = DEBUG_TRANSVR_INT_VAL; + int update_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + retval = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_disable, + "qsfp_set_soft_tx_disable"); + if (retval < 0) { + snprintf(err_msg, 63, "Not ready. err:%d", retval); + goto err_qsfp_set_soft_tx_disable; + } + if ((input_val > in_max) || + (input_val < in_min) ){ + retval = ERR_TRANSVR_BADINPUT; + snprintf(err_msg, 63, "Input value:%d incorrect!", input_val); + goto err_qsfp_set_soft_tx_disable; + } + if ((self->tx_disable & 0x0f) == input_val) { + return 0; + } + update_val = ((self->tx_disable & 0xf0) & input_val); + retval = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + input_val, + &(self->tx_disable), + "qsfp_set_tx_disable", + show_err); + if (retval < 0) { + snprintf(err_msg, 63, "_common_set_uint8_attr:%d fail!", retval); + goto err_qsfp_set_soft_tx_disable; + } + return 0; + +err_qsfp_set_soft_tx_disable: + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return retval; +} + + +int +_qsfp_set_auto_tx_disable(struct transvr_obj_s *self, + uint8_t update) { + + uint8_t tx_enable = 0x0; + int show_e = 1; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Handle timing issues */ + if (update != tx_enable) { + /* Note: + * Because there are some txvr has timing issues, + * therefore we need to execute reset cycle first. + * (enable -> other settings) + */ + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + tx_enable, + &(self->tx_disable), + "_qsfp_set_auto_tx_disable", + show_e); + if (err < 0) { + emsg = "I2C set reset value fail"; + goto err_qsfp_set_auto_tx_disable; + } + mdelay(10); + } + /* Setup target value */ + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + self->auto_tx_disable, + &(self->tx_disable), + "_qsfp_set_auto_tx_disable", + show_e); + if (err < 0) { + emsg = "I2C set target value fail"; + goto err_qsfp_set_auto_tx_disable; + } + /* Check and update */ + err = _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + self->eeprom_map_p->length_tx_disable, + &(self->tx_disable), + "_qsfp_set_auto_tx_disable", + show_e); + if (err < 0) { + emsg = "I2C get value fail"; + goto err_qsfp_set_auto_tx_disable; + } + if (self->tx_disable != update) { + emsg = "data not become effective"; + goto err_qsfp_set_auto_tx_disable; + } + return 0; + +err_qsfp_set_auto_tx_disable: + SWPS_DEBUG("%s: %s :%s\n", + __func__, emsg, self->swp_name); + return ERR_TRANSVR_UPDATE_FAIL; +} + + +int +qsfp_set_auto_tx_disable(struct transvr_obj_s *self, + int input_val) { + + int in_max = 0xf; /* 1111 */ + int in_min = 0x0; /* 0000 */ + int retval = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Update settings*/ + if (input_val == VAL_TRANSVR_FUNCTION_DISABLE) { + emsg = "User disable auto tx_disable"; + self->auto_tx_disable = VAL_TRANSVR_FUNCTION_DISABLE; + goto out_qsfp_set_auto_tx_disable; + } + if ((input_val > in_max) || (input_val < in_min) ){ + SWPS_INFO("%s: Input value:%d incorrect! :%s\n", + __func__, input_val, self->swp_name); + return ERR_TRANSVR_BADINPUT; + } + self->auto_tx_disable = input_val; + /* Check current soft tx_disable */ + retval = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_disable, + "qsfp_set_auto_tx_disable"); + switch (retval) { + case 0: + break; + case ERR_TRANSVR_UNPLUGGED: + emsg = "Doesn't need to update"; + goto out_qsfp_set_auto_tx_disable; + default: + SWPS_INFO("%s: setup fail :%d :%s\n", + __func__, retval, self->swp_name); + return retval; + } + return _qsfp_set_auto_tx_disable(self, input_val); + +out_qsfp_set_auto_tx_disable: + SWPS_DEBUG("%s: %s :%s :%d\n :%d", + __func__, emsg, self->swp_name, input_val, retval); + return 0; +} + + +int +__qsfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + /* [Note] + * 0x + */ + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv[2] = {0x00, 0x00}; + + if ((input < 0) || (input > 0xFFFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_qsfp_set_tx_eq; + } + setv[0] = (uint8_t)((input & 0xFF00) >> 8); + setv[1] = (uint8_t)(input & 0xFF); + if ((self->tx_eq[0] == setv[0]) && + (self->tx_eq[1] == setv[1]) ) { + return 0; + } + err = _common_set_uint8_array(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + self->eeprom_map_p->length_tx_eq, + setv, + self->tx_eq, + "_qsfp_set_tx_eq", + show_e); + if (err < 0) { + emsg = "set_uint8_array fail"; + goto err_qsfp_set_tx_eq; + } + return 0; + +err_qsfp_set_tx_eq: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_qsfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + + int i = 0; + int retry = 3; + uint8_t tmp[2]; + + for (i=0; itx_eq[0]; + tmp[1] = self->tx_eq[1]; + if (_qsfp_update_attr_tx_eq(self, show_e) < 0){ + continue; + } + if ((self->tx_eq[0] == tmp[0]) && + (self->tx_eq[1] == tmp[1]) ){ + return 0; + } + } + return -1; +} + + +int +qsfp_set_tx_eq(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_qsfp_update_attr_tx_eq, + "qsfp_set_tx_eq"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _qsfp_set_tx_eq(self, input, 1); +} + + +int +__qsfp_set_rx_am(struct transvr_obj_s *self, + int input, + int show_e) { + /* [Note] + * 0x + */ + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv[2] = {0x00, 0x00}; + + if ((input < 0) || (input > 0xFFFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_qsfp_set_rx_am; + } + setv[0] = (uint8_t)((input & 0xFF00) >> 8); + setv[1] = (uint8_t)(input & 0xFF); + if ((self->rx_am[0] == setv[0]) && + (self->rx_am[1] == setv[1]) ) { + return 0; + } + err = _common_set_uint8_array(self, + self->eeprom_map_p->addr_rx_am, + self->eeprom_map_p->page_rx_am, + self->eeprom_map_p->offset_rx_am, + self->eeprom_map_p->length_rx_am, + setv, + self->rx_am, + "_qsfp_set_rx_am", + show_e); + if (err < 0) { + emsg = "set_uint8_array fail"; + goto err_qsfp_set_rx_am; + } + return 0; + +err_qsfp_set_rx_am: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_qsfp_set_rx_am(struct transvr_obj_s *self, + int input, + int show_e) { + + int i = 0; + int retry = 3; + uint8_t tmp[2]; + + for (i=0; irx_am[0]; + tmp[1] = self->rx_am[1]; + if (_qsfp_update_attr_rx_am(self, show_e) < 0){ + continue; + } + if ((self->rx_am[0] == tmp[0]) && + (self->rx_am[1] == tmp[1]) ){ + return 0; + } + } + return -1; +} + + +int +qsfp_set_rx_am(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_qsfp_update_attr_rx_am, + "qsfp_set_rx_am"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _qsfp_set_rx_am(self, input, 1); +} + + +int +__qsfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + /* [Note] + * 0x + */ + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv[2] = {0x00, 0x00}; + + if ((input < 0) || (input > 0xFFFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_qsfp_set_rx_em; + } + setv[0] = (uint8_t)((input & 0xFF00) >> 8); + setv[1] = (uint8_t)(input & 0xFF); + if ((self->rx_em[0] == setv[0]) && + (self->rx_em[1] == setv[1]) ) { + return 0; + } + err = _common_set_uint8_array(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + self->eeprom_map_p->length_rx_em, + setv, + self->rx_em, + "_qsfp_set_rx_em", + show_e); + if (err < 0) { + emsg = "set_uint8_array fail"; + goto err_qsfp_set_rx_em; + } + return 0; + +err_qsfp_set_rx_em: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_qsfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + + int i = 0; + int retry = 3; + uint8_t tmp[2]; + + for (i=0; irx_em[0]; + tmp[1] = self->rx_em[1]; + if (_qsfp_update_attr_rx_em(self, show_e) < 0){ + continue; + } + if ((self->rx_em[0] == tmp[0]) && + (self->rx_em[1] == tmp[1]) ){ + return 0; + } + } + return -1; +} + + +int +qsfp_set_rx_em(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_qsfp_update_attr_rx_em, + "qsfp_set_rx_em"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _qsfp_set_rx_em(self, input, 1); +} + + +int +common_transvr_dump(struct transvr_obj_s* self){ + + char *type_name = "Undefined"; + + if (TRANSVR_INFO_DUMP_ENABLE != 1) { + return 0; + } + switch (self->type) { + case TRANSVR_TYPE_SFP: + type_name = STR_TRANSVR_SFP; + break; + case TRANSVR_TYPE_QSFP: + type_name = STR_TRANSVR_QSFP; + break; + case TRANSVR_TYPE_QSFP_PLUS: + type_name = STR_TRANSVR_QSFP_PLUS; + break; + case TRANSVR_TYPE_QSFP_28: + type_name = STR_TRANSVR_QSFP28; + break; + case TRANSVR_TYPE_FAKE: + type_name = "FAKE"; + goto ok_common_transvr_dump; + case TRANSVR_TYPE_UNPLUGGED: + type_name = "UNPLUGGED"; + goto err_common_transvr_dump; + case TRANSVR_TYPE_INCONSISTENT: + type_name = "INCONSISTENT"; + goto err_common_transvr_dump; + case TRANSVR_TYPE_ERROR: + type_name = "ERROR"; + goto err_common_transvr_dump; + + default: + type_name = "UNEXPECTED"; + goto err_common_transvr_dump; + } + printk(KERN_INFO "[SWPS] Dump %s information:\n", self->swp_name); + printk(KERN_INFO " |- :%s\n", type_name); + printk(KERN_INFO " |- :%s\n", self->vendor_name); + printk(KERN_INFO " |- :%s\n", self->vendor_pn); + printk(KERN_INFO " |- :%s\n", self->vendor_rev); + printk(KERN_INFO " |- :%s\n", self->vendor_sn); + printk(KERN_INFO " |- :0x%02x\n", self->br); + printk(KERN_INFO " |- :0x%02x\n", self->comp_rev); + printk(KERN_INFO " |- :%d\n", self->len_om1); + printk(KERN_INFO " |- :%d\n", self->len_om2); + printk(KERN_INFO " |- :%d\n", self->len_om3); + printk(KERN_INFO " |- :%d\n", self->len_om4); + return 0; + +ok_common_transvr_dump: + SWPS_INFO("%s: %s is %s\n", __func__, self->swp_name, type_name); + return 0; + +err_common_transvr_dump: + SWPS_INFO("%s: %s is %s\n", __func__, self->swp_name, type_name); + return -1; +} + + +int +sfp_transvr_dump(struct transvr_obj_s* self) { + + if (TRANSVR_INFO_DUMP_ENABLE != 1) { + return 0; + } + if (common_transvr_dump(self) < 0) { + return -1; + } + printk(KERN_INFO " |- :%d\n", self->len_sm); + printk(KERN_INFO " |- :%d\n", self->len_smf); + printk(KERN_INFO " '- :0x%02x\n", self->rate_id); + return 0; +} + + +int +qsfp_transvr_dump(struct transvr_obj_s* self) { + + if (TRANSVR_INFO_DUMP_ENABLE != 1) { + return 0; + } + if (common_transvr_dump(self) < 0) { + return -1; + } + printk(KERN_INFO " |- :%d\n", self->len_smf); + printk(KERN_INFO " '- :Class_%d\n", __qsfp_get_power_cls(self, 0)); + return 0; +} + + +int +fake_transvr_dump(struct transvr_obj_s* self) { + + printk(KERN_INFO "[SWPS] Dump transceiver information: %s\n", self->swp_name); + printk(KERN_INFO " |- :FAKE\n"); + printk(KERN_INFO " |- :FAKE_VENDER_NAME\n"); + printk(KERN_INFO " |- :FAKE_VENDER_PN\n"); + printk(KERN_INFO " |- :FAKE_VENDER_REV\n"); + printk(KERN_INFO " |- :FAKE_VENDER_SN\n"); + printk(KERN_INFO " |- :0x99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " '- :0x99\n"); + return 0; +} + + +/* ========== Object functions for fake type ========== + */ +int +fake_transvr_update(struct transvr_obj_s *self, + int show_err){ + self->state = STATE_TRANSVR_CONNECTED; + return 0; +} + + +int +fake_get_binary(struct transvr_obj_s *self){ + return 1; +} + +int +fake_get_int(struct transvr_obj_s *self){ + return 99; +} + + +int +fake_get_hex(struct transvr_obj_s *self){ + return 0x0f; +} + + +int +fake_get_str(struct transvr_obj_s *self, char *buf) { + return snprintf(buf, 16, "fake_get_str\n"); +} + + +int +fake_set_int(struct transvr_obj_s *self, int input){ + SWPS_INFO("%s: %d\n", __func__, input); + return 0; +} + + +int +fake_set_hex(struct transvr_obj_s *self, int input){ + SWPS_INFO("%s: 0x%02x\n", __func__, input); + return 0; +} + + +/* ========== Object functions for unsupported ========== + */ +int +unsupported_get_func(struct transvr_obj_s *self){ + return ERR_TRANSVR_NOTSUPPORT; +} + + +int +unsupported_get_func2(struct transvr_obj_s *self, + char *buf_p) { + int len = snprintf(buf_p, 8, "%d\n", ERR_TRANSVR_NOTSUPPORT); + return len; +} + + +int +unsupported_set_func(struct transvr_obj_s *self, + int input_val){ + return ERR_TRANSVR_NOTSUPPORT; +} + + + +/* ========== Object functions for long term task ========== + * + * [Note] + * SWPS transceiver worker is likely the green-thread (coroutine). + * Due to resource and performance considerations. SWPS run all + * features in one kthread at the same time, and handle by it self. + */ + +/* For Transceiver Task Handling + */ +static struct transvr_worker_s * +transvr_task_get(struct transvr_obj_s *self, + char *func_name) { + + struct transvr_worker_s *curr_p = self->worker_p; + + while(curr_p != NULL){ + if (strcmp((curr_p->func_name), func_name) == 0 ) { + return curr_p; + } + curr_p = curr_p->next_p; + } + return NULL; +} + + +static struct transvr_worker_s* +transvr_task_creat(struct transvr_obj_s *self, + int (*main_task)(struct transvr_worker_s *task), + int (*post_task)(struct transvr_worker_s *task), + char *caller) { + + struct transvr_worker_s *task_p = NULL; + struct transvr_worker_s *curr_p = NULL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Check task not exist */ + task_p = transvr_task_get(self, caller); + if (task_p) { + snprintf(err_msg, sizeof(err_msg), "Task already created!"); + goto err_transvr_task_creat; + } + /* Create task worker */ + task_p = kzalloc(sizeof(struct transvr_worker_s), GFP_KERNEL); + if (!task_p){ + snprintf(err_msg, sizeof(err_msg), "kzalloc fail"); + goto err_transvr_task_creat; + } + /* Setup task data */ + task_p->transvr_p = self; + task_p->next_p = NULL; + task_p->trigger_time = 0; + task_p->retry = 1; + task_p->state = STATE_T_TASK_INIT; + task_p->main_task = main_task; + task_p->post_task = post_task; + task_p->p_data = NULL; + snprintf(task_p->func_name, sizeof(task_p->func_name), "%s", caller); + /* Setup Link List */ + if (self->worker_p) { + curr_p = self->worker_p; + while(curr_p->next_p != NULL) { + curr_p = curr_p->next_p; + } + curr_p->next_p = task_p; + task_p->pre_p = curr_p; + } else { + self->worker_p = task_p; + task_p->pre_p = NULL; + } + return task_p; + +err_transvr_task_creat: + SWPS_ERR("%s: %s :%s :%s\n", + __func__, err_msg, caller, self->swp_name); + return NULL; +} + + +static void +transvr_task_free_one(struct transvr_worker_s *task_p){ + + struct transvr_worker_s *pre_p = NULL; + struct transvr_worker_s *next_p = NULL; + + if (task_p) { + pre_p = task_p->pre_p; + next_p = task_p->next_p; + + if ((pre_p) && (next_p)) { + pre_p->next_p = next_p; + next_p->pre_p = pre_p; + + } else if ((!pre_p) && (next_p)) { + next_p->pre_p = NULL; + + } else if ((pre_p) && (!next_p)) { + pre_p->next_p = NULL; + + } else if ((!pre_p) && (!next_p)) { + task_p->transvr_p->worker_p = NULL; + } else { + SWPS_ERR("%s: Unexcept case!\n :%s", + __func__, task_p->transvr_p->swp_name); + } + kfree(task_p->p_data); + kfree(task_p); + } +} + + +static void +transvr_task_free_all(struct transvr_obj_s *self) { + + struct transvr_worker_s *curr_p = NULL; + struct transvr_worker_s *next_p = NULL; + + if (self->worker_p) { + curr_p = self->worker_p; + while(curr_p) { + next_p = curr_p->next_p; + transvr_task_free_one(curr_p); + curr_p = next_p; + } + self->worker_p = NULL; + } +} + + +static void +transvr_cache_free_all(struct transvr_obj_s *self) { + + memset(self->vendor_name, 0, (LEN_TRANSVR_M_STR * sizeof(char)) ); + memset(self->vendor_rev, 0, (LEN_TRANSVR_M_STR * sizeof(char)) ); + memset(self->vendor_pn, 0, (LEN_TRANSVR_M_STR * sizeof(char)) ); + memset(self->vendor_sn, 0, (LEN_TRANSVR_M_STR * sizeof(char)) ); + self->extphy_offset = 0; +} + +static int +_transvr_task_run_main(struct transvr_worker_s *task_p) { + + int retval = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + if (!task_p){ + snprintf(err_msg, sizeof(err_msg), "main_task is NULL!"); + goto main_transvr_task_err; + } + if ((task_p->trigger_time) == 0){ + goto main_transvr_task_run; + } + if (time_before(jiffies, task_p->trigger_time)){ + goto main_transvr_task_wait; + } + goto main_transvr_task_run; + +main_transvr_task_run: + if (task_p->retry != VAL_TRANSVR_TASK_RETRY_FOREVER) { + task_p->retry -= 1; + } + retval = task_p->main_task(task_p); + if (retval < 0) { + if (task_p->retry > 0) { + task_p->state = STATE_T_TASK_WAIT; + return EVENT_TRANSVR_TASK_WAIT; + } + snprintf(err_msg, sizeof(err_msg), "Run main_task fail!"); + goto main_transvr_task_err; + } + goto main_transvr_task_identify; + +main_transvr_task_identify: + switch (retval) { + case EVENT_TRANSVR_TASK_WAIT: + task_p->state = STATE_T_TASK_WAIT; + return EVENT_TRANSVR_TASK_WAIT; + + case EVENT_TRANSVR_TASK_DONE: + task_p->state = STATE_T_TASK_DONE; + return EVENT_TRANSVR_TASK_DONE; + + default: + break; + } + snprintf(err_msg, sizeof(err_msg), "Run main_task fail!"); + goto main_transvr_task_err; + +main_transvr_task_wait: + task_p->state = STATE_T_TASK_WAIT; + return EVENT_TRANSVR_TASK_WAIT; + +main_transvr_task_err: + task_p->state = STATE_T_TASK_FAIL; + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, retval, task_p->transvr_p->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +static int +_transvr_task_run_post(struct transvr_worker_s *task_p) { + + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + if ((task_p->post_task) == NULL) { + return EVENT_TRANSVR_TASK_DONE; + } + switch (task_p->state) { + case STATE_T_TASK_WAIT: + case STATE_T_TASK_INIT: + goto post_transvr_task_wait; + + case STATE_T_TASK_DONE: + case STATE_T_TASK_FAIL: + goto post_transvr_task_run; + + default: + break; + } + snprintf(err_msg, sizeof(err_msg), "Unexcept task state"); + goto post_transvr_task_err; + +post_transvr_task_run: + task_p->post_task(task_p); + return EVENT_TRANSVR_TASK_DONE; + +post_transvr_task_wait: + return EVENT_TRANSVR_TASK_WAIT; + +post_transvr_task_err: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, task_p->state, task_p->transvr_p->swp_name); + return EVENT_TRANSVR_TASK_FAIL; +} + + +static int +transvr_task_run_one(struct transvr_worker_s *task_p) { + + int retval_main = DEBUG_TRANSVR_INT_VAL; + int retval_post = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + retval_main = _transvr_task_run_main(task_p); + if (retval_main < 0) { + snprintf(err_msg, sizeof(err_msg), "Execute main_task fail!"); + goto err_transvr_task_run_one; + } + retval_post = _transvr_task_run_post(task_p); + if (retval_post < 0) { + snprintf(err_msg, sizeof(err_msg), "Execute post_task fail!"); + goto err_transvr_task_run_one; + } + return retval_main; + +err_transvr_task_run_one: + SWPS_INFO("%s: %s
:%d :%d :%s :%s\n", + __func__, err_msg, retval_main, retval_post, + task_p->func_name, task_p->transvr_p->swp_name); + return EVENT_TRANSVR_TASK_FAIL; +} + + +static int +transvr_task_run_all(struct transvr_obj_s *self) { + + int haserr = 0; + int retval = DEBUG_TRANSVR_INT_VAL; + struct transvr_worker_s *curr_p = NULL; + struct transvr_worker_s *next_p = NULL; + + if ((self->worker_p) == NULL) { + return EVENT_TRANSVR_TASK_DONE; + } + curr_p = self->worker_p; + while (curr_p != NULL) { + next_p = curr_p->next_p; + retval = transvr_task_run_one(curr_p); + if (curr_p->retry == VAL_TRANSVR_TASK_RETRY_FOREVER) { + curr_p = next_p; + continue; + } + switch (retval) { + case EVENT_TRANSVR_TASK_WAIT: + break; + case EVENT_TRANSVR_TASK_DONE: + transvr_task_free_one(curr_p); + break; + case EVENT_TRANSVR_TASK_FAIL: + + default: + haserr = 1; + transvr_task_free_one(curr_p); + break; + } + curr_p = next_p; + } + if (haserr) { + return EVENT_TRANSVR_TASK_FAIL; + } + return EVENT_TRANSVR_TASK_DONE; +} + + +static void +transvr_task_set_delay(struct transvr_worker_s *task_p, + unsigned long delay_msec) { + + task_p->trigger_time = (jiffies + (delay_msec * (HZ/1000))); +} + + +static void +transvr_task_set_retry(struct transvr_worker_s *task_p, + unsigned long retry_times) { + + task_p->retry = retry_times; +} + + +/* For Transceiver Post Task + */ +int +taskfunc_post_do_nothing(struct transvr_worker_s *task_p) { + + return EVENT_TRANSVR_TASK_DONE; +} + + +int +taskfunc_post_handle_task_state(struct transvr_worker_s *task_p) { + + struct transvr_obj_s* tp = task_p->transvr_p; + + switch (task_p->state) { + case STATE_T_TASK_INIT: + case STATE_T_TASK_WAIT: + return EVENT_TRANSVR_TASK_WAIT; + + case STATE_T_TASK_DONE: + tp->state = STATE_TRANSVR_CONNECTED; + tp->send_uevent(tp, KOBJ_ADD); + return EVENT_TRANSVR_TASK_DONE; + + case STATE_T_TASK_FAIL: + tp->state = STATE_TRANSVR_UNEXCEPTED; + return EVENT_TRANSVR_TASK_FAIL; + + default: + break; + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +/* For Transceiver Main Task + */ +int +_taskfunc_sfp_setup_soft_rs(struct transvr_worker_s *task_p, + int input_val, + int address, + int page, + int offset, + int bit_shift, + uint8_t *attr_p, + char *caller) { + + int show_err = 0; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "_taskfunc_sfp_setup_soft_rs"; + + err_code = _sfp_update_attr_soft_rs0(task_p->transvr_p, 0); + if (err_code < 0) { + err_str = "Get current soft_rs0 fail!"; + goto err_taskfunc_sfp_setup_soft_rs_1; + } + err_code = __sfp_set_soft_rs(task_p->transvr_p, + input_val, + address, + page, + offset, + bit_shift, + attr_p, + caller, + show_err); + if (err_code < 0) { + err_str = "Get current soft_rs0 fail!"; + goto err_taskfunc_sfp_setup_soft_rs_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_sfp_setup_soft_rs_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + func_str, err_str, task_p->transvr_p->swp_name, input_val, err_code); + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +__taskfunc_sfp_setup_hard_rs(struct transvr_worker_s *task_p, + int input_val, + int (*get_func)(struct ioexp_obj_s *self, int virt_offset), + int (*set_func)(struct ioexp_obj_s *self, int virt_offset, int input_val)) { + + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_str = DEBUG_TRANSVR_STR_VAL; + + err_val = get_func(task_p->transvr_p->ioexp_obj_p, + task_p->transvr_p->ioexp_virt_offset); + + if (err_val < 0) { + if (err_val == ERR_IOEXP_NOTSUPPORT) { + return EVENT_TRANSVR_TASK_DONE; + } + err_str = "Get current hard_rs fail!"; + goto err_p_taskfunc_sfp_setup_hard_rs_1; + } + if (err_val == input_val) { + return EVENT_TRANSVR_TASK_DONE; + } + err_val = set_func(task_p->transvr_p->ioexp_obj_p, + task_p->transvr_p->ioexp_virt_offset, + input_val); + if (err_val < 0) { + err_str = "Setup hard_rs fail!"; + goto err_p_taskfunc_sfp_setup_hard_rs_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_p_taskfunc_sfp_setup_hard_rs_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + __func__, err_str, task_p->transvr_p->swp_name, input_val, err_val); + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_taskfunc_sfp_setup_hard_rs0(struct transvr_worker_s *task_p, + int input_val) { + + return __taskfunc_sfp_setup_hard_rs(task_p, + input_val, + task_p->transvr_p->ioexp_obj_p->get_hard_rs0, + task_p->transvr_p->ioexp_obj_p->set_hard_rs0); +} + + +int +_taskfunc_sfp_setup_hard_rs1(struct transvr_worker_s *task_p, + int input_val) { + + return __taskfunc_sfp_setup_hard_rs(task_p, + input_val, + task_p->transvr_p->ioexp_obj_p->get_hard_rs1, + task_p->transvr_p->ioexp_obj_p->set_hard_rs1); +} + + +int +_taskfunc_sfp_setup_rs0(struct transvr_worker_s *task_p, + int input_val) { + + int bit_shift = 3; + int old_val = DEBUG_TRANSVR_INT_VAL; + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "_taskfunc_sfp_setup_rs0"; + + err_val = _taskfunc_sfp_setup_hard_rs0(task_p, + input_val); + if (err_val < 0) { + err_str = "Setup hard_rs0 fail!"; + goto err_private_taskfunc_sfp_setup_rs0_1; + } + old_val = err_val; + err_val = _taskfunc_sfp_setup_soft_rs(task_p, + input_val, + task_p->transvr_p->eeprom_map_p->addr_soft_rs0, + task_p->transvr_p->eeprom_map_p->page_soft_rs0, + task_p->transvr_p->eeprom_map_p->offset_soft_rs0, + bit_shift, + &(task_p->transvr_p->soft_rs0), + func_str); + if (err_val < 0) { + err_str = "Setup soft_rs0 fail!"; + goto err_private_taskfunc_sfp_setup_rs0_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_private_taskfunc_sfp_setup_rs0_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + func_str, err_str, task_p->transvr_p->swp_name, input_val, err_val); + } + _taskfunc_sfp_setup_hard_rs0(task_p, old_val); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_taskfunc_sfp_setup_rs1(struct transvr_worker_s *task_p, + int input_val) { + + int bit_shift = 3; + int old_val = DEBUG_TRANSVR_INT_VAL; + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "_taskfunc_sfp_setup_rs1"; + + err_val = _taskfunc_sfp_setup_hard_rs1(task_p, + input_val); + if (err_val < 0) { + err_str = "Setup hard_rs1 fail!"; + goto err_private_taskfunc_sfp_setup_rs1_1; + } + old_val = err_val; + err_val = _taskfunc_sfp_setup_soft_rs(task_p, + input_val, + task_p->transvr_p->eeprom_map_p->addr_soft_rs1, + task_p->transvr_p->eeprom_map_p->page_soft_rs1, + task_p->transvr_p->eeprom_map_p->offset_soft_rs1, + bit_shift, + &(task_p->transvr_p->soft_rs1), + func_str); + if (err_val < 0) { + err_str = "Setup soft_rs1 fail!"; + goto err_private_taskfunc_sfp_setup_rs1_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_private_taskfunc_sfp_setup_rs1_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + func_str, err_str, task_p->transvr_p->swp_name, input_val, err_val); + } + _taskfunc_sfp_setup_hard_rs1(task_p, old_val); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +taskfunc_sfp_setup_SFF8431_case1(struct transvr_worker_s *task_p) { + /* SFF-8431 (8/4/2G Rx Rate_Select only) */ + int update_val = 1; + + return _taskfunc_sfp_setup_rs0(task_p, update_val); +} + + + +int +taskfunc_sfp_setup_SFF8431_case2(struct transvr_worker_s *task_p) { + /* SFF-8431 (8/4/2G Tx Rate_Select only) */ + int update_val = 1; + + return _taskfunc_sfp_setup_rs1(task_p, update_val); +} + + +int +taskfunc_sfp_setup_SFF8431_case3(struct transvr_worker_s *task_p) { + /* SFF-8431 (8/4/2G Independent Rx & Tx Rate_select) */ + int update_rs0 = 1; + int update_rs1 = 1; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _taskfunc_sfp_setup_rs0(task_p, update_rs0); + if (err_code < 0) { + return err_code; + } + return _taskfunc_sfp_setup_rs1(task_p, update_rs1); +} + + +int +taskfunc_sfp_handle_1g_rj45(struct transvr_worker_s *task_p) { + + /* Not all of platform support 0x56 for transceiver + * external PHY, Support list as below: + * => 1. Magnolia-PVT (PS: EVT & DVT not ready) + */ + int ext_phy_addr = 0x56; + int ext_phy_page = -1; + int ext_phy_offs = 0x11; + int ext_phy_len = 1; + int lstate_mask = 0x04; /* 00000100 */ + int show_err = 0; + int fail_retry = 5; + int fail_delay = 1000; /* msec */ + int err_code = DEBUG_TRANSVR_INT_VAL; + uint8_t detect_val = DEBUG_TRANSVR_HEX_VAL; + char err_str[64] = DEBUG_TRANSVR_STR_VAL; + int *tmp_p = NULL; + char *func_name = "taskfunc_sfp_handle_1g_rj45"; + + if (task_p->transvr_p->state != STATE_TRANSVR_CONNECTED) { + return EVENT_TRANSVR_TASK_DONE; + } + if ( (task_p->transvr_p->info != TRANSVR_CLASS_BASE_T_1000) && + (task_p->transvr_p->info != TRANSVR_CLASS_BASE_T_1000_up) ) { + goto err_taskfunc_sfp_handle_1g_rj45_1; + } + err_code = _common_update_uint8_attr(task_p->transvr_p, + ext_phy_addr, + ext_phy_page, + ext_phy_offs, + ext_phy_len, + &detect_val, + func_name, + show_err); + if ( (err_code < 0) || + (detect_val == DEBUG_TRANSVR_HEX_VAL) ) { + snprintf(err_str, sizeof(err_str), "Detect external link status fail"); + goto err_taskfunc_sfp_handle_1g_rj45_2; + } + if ((detect_val & lstate_mask) == lstate_mask) { + goto ok_taskfunc_sfp_handle_1g_rj45_link_up; + } + goto ok_taskfunc_sfp_handle_1g_rj45_link_down; + +ok_taskfunc_sfp_handle_1g_rj45_link_up: + /* Filter out noise */ + if (!(task_p->p_data)) { + tmp_p = kzalloc(sizeof(int), GFP_KERNEL); + if (!tmp_p) { + snprintf(err_str, sizeof(err_str), "kzalloc p_data fail"); + goto err_taskfunc_sfp_handle_1g_rj45_2; + } + *tmp_p = TRANSVR_CLASS_BASE_T_1000_up; + task_p->p_data = tmp_p; + goto ok_taskfunc_sfp_handle_1g_rj45_done; + } + if ((*(int *)(task_p->p_data)) != TRANSVR_CLASS_BASE_T_1000_up) { + kfree(task_p->p_data); + task_p->p_data = NULL; + snprintf(err_str, sizeof(err_str), "Internal error"); + goto err_taskfunc_sfp_handle_1g_rj45_2; + } + task_p->transvr_p->info = TRANSVR_CLASS_BASE_T_1000_up; + kfree(task_p->p_data); + task_p->p_data = NULL; + goto ok_taskfunc_sfp_handle_1g_rj45_done; + +ok_taskfunc_sfp_handle_1g_rj45_link_down: + if (task_p->p_data) { + kfree(task_p->p_data); + task_p->p_data = NULL; + } + task_p->transvr_p->info = TRANSVR_CLASS_BASE_T_1000; + goto ok_taskfunc_sfp_handle_1g_rj45_done; + +ok_taskfunc_sfp_handle_1g_rj45_done: + if (task_p->retry != VAL_TRANSVR_TASK_RETRY_FOREVER) { + transvr_task_set_retry(task_p, VAL_TRANSVR_TASK_RETRY_FOREVER); + } + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_sfp_handle_1g_rj45_1: + snprintf(err_str, sizeof(err_str), "Detect transceiver:%d not Base-T, remove task.", + task_p->transvr_p->info); + SWPS_INFO("%s: %s :%s\n", __func__, err_str, task_p->transvr_p->swp_name); + transvr_task_set_retry(task_p, 0); + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_sfp_handle_1g_rj45_2: + if (task_p->retry == VAL_TRANSVR_TASK_RETRY_FOREVER) { + transvr_task_set_retry(task_p, fail_retry); + } + if ((task_p->retry) == 0) { + /* Error case: + * => In this case, SWPS will stop external Link state monitor features + * and keeps transvr_p->info on TRANSVR_CLASS_BASE_T_1000_up. + * Upper layer will see it always Linkup that because of these type of + * transceiver has external phy, BCM chip see it as Loopback transceiver. + */ + SWPS_WARN("%s can not access external PHY of Base-T SFP transceiver\n", + task_p->transvr_p->swp_name); + task_p->transvr_p->info = TRANSVR_CLASS_BASE_T_1000_up; + return EVENT_TRANSVR_TASK_DONE; + } else { + transvr_task_set_delay(task_p, fail_delay); + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_taskfunc_qsfp_setup_power_mod(struct transvr_obj_s *self, + int setup_val) { + + int curr_val = DEBUG_TRANSVR_INT_VAL; + int err_val = DEBUG_TRANSVR_INT_VAL; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + + curr_val = self->ioexp_obj_p->get_lpmod(self->ioexp_obj_p, + self->ioexp_virt_offset); + if (curr_val < 0){ + err_msg = "Get current value fail!"; + goto err_private_taskfunc_qsfp_setup_power_mod_1; + } + if (curr_val == setup_val){ + return EVENT_TRANSVR_TASK_DONE; + } + err_val = self->ioexp_obj_p->set_lpmod(self->ioexp_obj_p, + self->ioexp_virt_offset, + setup_val); + if (err_val < 0){ + err_msg = "Setup power mode fail!"; + goto err_private_taskfunc_qsfp_setup_power_mod_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_private_taskfunc_qsfp_setup_power_mod_1: + SWPS_INFO("%s: %s :%d :%d :%d\n", + __func__, err_msg, err_val, curr_val, setup_val); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +taskfunc_qsfp_handle_tx_disable(struct transvr_worker_s *task_p) { + + int i = 0; + int retry = 5; + int delay_ms = 100; + + if (task_p->transvr_p->auto_tx_disable == VAL_TRANSVR_FUNCTION_DISABLE) { + return EVENT_TRANSVR_TASK_DONE; + } + if (!_qsfp_is_implement_tx_disable(task_p->transvr_p)) { + return EVENT_TRANSVR_TASK_DONE; + } + for (i=0; itransvr_p, + task_p->transvr_p->auto_tx_disable) + == EVENT_TRANSVR_TASK_DONE) { + goto ok_taskfunc_qsfp_handle_tx_disable; + } + mdelay(delay_ms); + } + SWPS_INFO("%s auto setup tx_disable:0x%02x fail.\n", + task_p->transvr_p->swp_name, + task_p->transvr_p->auto_tx_disable); + return EVENT_TRANSVR_INIT_FAIL; + +ok_taskfunc_qsfp_handle_tx_disable: + SWPS_INFO("%s auto setup tx_disable:0x%02x ok.\n", + task_p->transvr_p->swp_name, + task_p->transvr_p->auto_tx_disable); + return EVENT_TRANSVR_TASK_DONE; +} + + +int +taskfunc_qsfp_set_hpmod(struct transvr_worker_s *task_p) { + + int err = DEBUG_TRANSVR_INT_VAL; + int HIGH_POWER_MODE = 0; + + /* Handle power mode */ + err = _taskfunc_qsfp_setup_power_mod(task_p->transvr_p, + HIGH_POWER_MODE); + if (err < 0) { + SWPS_INFO("%s: setup hpmod fail :%d :%s\n", + __func__, err, task_p->transvr_p->swp_name); + return err; + } + /* Handle auto tx_disable + * [Note] + * => Because there are some transceiver have timing issues or + * setup sequence issues, therefore we handle auto tx_disable + * after handle power mode. + */ + mdelay(100); + return taskfunc_qsfp_handle_tx_disable(task_p); +} + + +int +taskfunc_qsfp_set_lpmod(struct transvr_worker_s *task_p) { + + int LOW_POWER_MODE = 1; + return _taskfunc_qsfp_setup_power_mod(task_p->transvr_p, + LOW_POWER_MODE); +} + + +static int +initfunc_sfp_handle_multi_rate_mode(struct transvr_obj_s *self) { + + int task_retry = 3; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "sfp_handle_multi_rate_mode"; + struct transvr_worker_s *task_p = NULL; + + switch (self->rate_id) { + case 0x00: /* Unspecified */ + case 0x03: /* Unspecified */ + case 0x05: /* Unspecified */ + case 0x07: /* Unspecified */ + case 0x09: /* Unspecified */ + case 0x0B: /* Unspecified */ + case 0x0D: /* Unspecified */ + case 0x0F: /* Unspecified */ + goto sfp_handle_multi_rate_mode_4_unspecified; + + case 0x02: /* SFF-8431 (8/4/2G Rx Rate_Select only) */ + task_p = transvr_task_creat(self, + taskfunc_sfp_setup_SFF8431_case1, + taskfunc_post_handle_task_state, + func_str); + goto sfp_handle_multi_rate_mode_4_sff8431; + + case 0x04: /* SFF-8431 (8/4/2G Tx Rate_Select only) */ + task_p = transvr_task_creat(self, + taskfunc_sfp_setup_SFF8431_case2, + taskfunc_post_handle_task_state, + func_str); + goto sfp_handle_multi_rate_mode_4_sff8431; + + case 0x06: /* SFF-8431 (8/4/2G Independent Rx & Tx Rate_select) */ + task_p = transvr_task_creat(self, + taskfunc_sfp_setup_SFF8431_case3, + taskfunc_post_handle_task_state, + func_str); + goto sfp_handle_multi_rate_mode_4_sff8431; + + case 0x01: /* SFF-8079 (4/2/1G Rate_Select & AS0/AS1) */ + err_str = "SFF-8079 (4/2/1G Rate_Select & AS0/AS1)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x08: /* FC-PI-5 (16/8/4G Rx Rate_select only) + * High=16G only, Low=8G/4G + */ + err_str = "FC-PI-5 (16/8/4G Rx Rate_select only)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x0A: /* FC-PI-5 (16/8/4G Independent Rx, Tx Rate_select) + * High=16G only, Low=8G/4G + */ + err_str = "FC-PI-5 (16/8/4G Independent Rx, Tx Rate_select)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x0C: /* FC-PI-6 (32/16/8G Independent Rx, Tx Rate_Select) + * High=32G only, Low = 16G/8G + */ + err_str = "FC-PI-6 (32/16/8G Independent Rx, Tx Rate_Select)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x0E: /* 10/8G Rx and Tx Rate_Select controlling the operation or + * locking modes of the internal signal conditioner, retimer + * or CDR, according to the logic table defined in Table 10-2, + * High Bit Rate (10G) =9.95-11.3 Gb/s; Low Bit Rate (8G) = + * 8.5 Gb/s. In this mode, the default value of bit 110.3 (Soft + * Rate Select RS(0), Table 9-11) and of bit 118.3 (Soft Rate + * Select RS(1), Table 10-1) is 1. + */ + err_str = "cable type: 0x0E"; + goto sfp_handle_multi_rate_mode_4_not_support; + + default: + err_str = "cable type: UNKNOW"; + goto sfp_handle_multi_rate_mode_4_not_support; + } + +sfp_handle_multi_rate_mode_4_sff8431: + if (!task_p) { + err_str = "Create task fail!"; + goto sfp_handle_multi_rate_mode_4_fail_1; + } + transvr_task_set_retry(task_p, task_retry); + return EVENT_TRANSVR_TASK_WAIT; + +sfp_handle_multi_rate_mode_4_unspecified: + return EVENT_TRANSVR_TASK_DONE; + +sfp_handle_multi_rate_mode_4_not_support: + SWPS_INFO("%s: Does not support %s :%s :0x%02x\n", + func_str, err_str, self->swp_name, self->rate_id); + return EVENT_TRANSVR_TASK_DONE; + +sfp_handle_multi_rate_mode_4_fail_1: + SWPS_INFO("%s: %s :%s :0x%02x, :%d\n", + func_str, err_str, self->swp_name, self->rate_id, err_code); + return EVENT_TRANSVR_INIT_FAIL; +} + + +static int +initfunc_sfp_handle_1g_rj45(struct transvr_obj_s *self) { + + struct transvr_worker_s *task_p = NULL; + int detect_cls = DEBUG_TRANSVR_INT_VAL; + char err_str[64] = DEBUG_TRANSVR_STR_VAL; + char *func_str = "initfunc_sfp_handle_1g_rj45"; + + + if (self->info == TRANSVR_CLASS_BASE_T_1000) { + task_p = transvr_task_creat(self, + taskfunc_sfp_handle_1g_rj45, + taskfunc_post_do_nothing, + func_str); + if (!task_p) { + snprintf(err_str, sizeof(err_str), "Create task fail"); + goto err_initfunc_sfp_handle_1g_rj45; + } + transvr_task_set_retry(task_p, VAL_TRANSVR_TASK_RETRY_FOREVER); + } + return EVENT_TRANSVR_TASK_DONE; + +err_initfunc_sfp_handle_1g_rj45: + SWPS_INFO("%s: %s :%s :%d\n", + __func__, err_str, self->swp_name, detect_cls); + return EVENT_TRANSVR_TASK_FAIL; +} + + +static int +initfunc_qsfp_handle_power_mode(struct transvr_obj_s *self) { + + int err_code = EVENT_TRANSVR_EXCEP_INIT; + int power_class = DEBUG_TRANSVR_INT_VAL; + int hpmod_retry = 3; + int lpower_config = 1; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + unsigned long hpmod_delay = 500; /* msec */ + struct transvr_worker_s *task_p = NULL; + + /* Handle power mode for IOEXP */ + power_class = __qsfp_get_power_cls(self, 0); + switch (power_class) { + case 1: /* Case: Low power mode (Class = 1) */ + err_code = _taskfunc_qsfp_setup_power_mod(self, lpower_config); + if (err_code < 0){ + snprintf(err_msg, sizeof(err_msg), "Setup lpmod fail :%d", err_code); + goto err_initfunc_qsfp_handle_power_mode; + } + return EVENT_TRANSVR_TASK_DONE; + + case 2: /* Case: High power mode (Class > 1) */ + case 3: + case 4: + case 5: + case 6: + case 7: + task_p = transvr_task_creat(self, + taskfunc_qsfp_set_hpmod, + taskfunc_post_handle_task_state, + "transvr_init_qsfp"); + if (!task_p) { + snprintf(err_msg, sizeof(err_msg), "Setup lpmod fail :%d", err_code); + goto err_initfunc_qsfp_handle_power_mode; + } + transvr_task_set_retry(task_p, hpmod_retry); + transvr_task_set_delay(task_p, hpmod_delay); + return EVENT_TRANSVR_TASK_WAIT; + + default: + break; + } + snprintf(err_msg, sizeof(err_msg), "Exception case"); + goto err_initfunc_qsfp_handle_power_mode; + +err_initfunc_qsfp_handle_power_mode: + SWPS_INFO("%s: %s :%s \n", __func__, err_msg, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +int +initfunc_qsfp28_handle_cdr(struct transvr_obj_s *self) { + + uint8_t DEFAULT_VAL_CDR = 0xff; + int CDR_FUNC_EXISTED = 0x3; + int show_err = 1; + int err_val = EVENT_TRANSVR_TASK_FAIL; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + char *func_str = "initfunc_qsfp28_handle_cdr"; + + err_val = __qsfp_get_cdr_present(self, 0); + if ( (err_val < 0) || + (err_val == DEBUG_TRANSVR_HEX_VAL) ) { + err_msg = "detect cdr_present fail!"; + goto err_taskfunc_qsfp_handle_cdr_1; + } + if (err_val == CDR_FUNC_EXISTED) { + err_val = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->offset_cdr, + DEFAULT_VAL_CDR, + &(self->cdr), + func_str, + show_err); + if (err_val < 0) { + err_msg = "set CDR fail!"; + goto err_taskfunc_qsfp_handle_cdr_1; + } + } + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_qsfp_handle_cdr_1: + SWPS_INFO("%s: %s :%d :%s\n", + func_str, err_msg, err_val, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + +/* ========== Object functions for Final State Machine ========== + */ +int +is_plugged(struct transvr_obj_s *self){ + + int limit = 63; + int present = DEBUG_TRANSVR_INT_VAL; + char emsg[64] = DEBUG_TRANSVR_STR_VAL; + struct ioexp_obj_s *ioexp_p = self->ioexp_obj_p; + + if (!ioexp_p) { + snprintf(emsg, limit, "ioexp_p is null!"); + goto err_is_plugged_1; + } + present = ioexp_p->get_present(ioexp_p, self->ioexp_virt_offset); + switch (present){ + case 0: + return 1; + case 1: + return 0; + case ERR_IOEXP_UNINIT: + snprintf(emsg, limit, "ioexp_p not ready!"); + goto err_is_plugged_1; + default: + if (ioexp_p->state == STATE_IOEXP_INIT){ + snprintf(emsg, limit, "ioexp_p not ready!"); + goto err_is_plugged_1; + } + break; + } + SWPS_INFO("%s: Exception case! :%d :%d\n", + __func__, present, ioexp_p->state); + return 0; + +err_is_plugged_1: + SWPS_DEBUG("%s: %s\n", __func__, emsg); + return 0; +} + + +static int +detect_transvr_type(struct transvr_obj_s* self){ + + int type = TRANSVR_TYPE_ERROR; + + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + type = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + + /* Case: 1. Wait transceiver I2C module. + * 2. Transceiver I2C module failure. + * Note: 1. SFF allow maximum transceiver initial time is 2 second. So, there + * are exist some case that we need to wait transceiver. + * For these case, we keeps status on "TRANSVR_TYPE_UNPLUGGED", than + * state machine will keep trace with it. + * 2. There exist some I2C failure case we need to handle. Such as user + * insert the failure transceiver, or any reason cause it abnormal. + */ + if (type < 0){ + switch (type) { + case -EIO: + SWPS_DEBUG("%s: %s smbus return:-5 (I/O error)\n", + __func__, self->swp_name); + return TRANSVR_TYPE_UNPLUGGED; + case -ENXIO: + SWPS_DEBUG("%s: %s smbus return:-6 (No such device or address)\n", + __func__, self->swp_name); + return TRANSVR_TYPE_UNPLUGGED; + default: + break; + } + SWPS_INFO("%s: %s unexpected smbus return:%d \n", + __func__, self->swp_name, type); + return TRANSVR_TYPE_ERROR; + } + /* Identify valid transceiver type */ + switch (type){ + case TRANSVR_TYPE_SFP: + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + break; + case TRANSVR_TYPE_UNKNOW_1: + case TRANSVR_TYPE_UNKNOW_2: + type = TRANSVR_TYPE_UNKNOW_2; + break; + default: + SWPS_DEBUG("%s: unknow type:0x%02x \n", __func__, type); + type = TRANSVR_TYPE_ERROR; + break; + } + return type; +} + + +static int +detect_transvr_state(struct transvr_obj_s *self, + int result[2]){ + /* [return] [result-0] [result-1] + * 0 STATE_TRANSVR_CONNECTED TRANSVR_TYPE_FAKE + * 0 STATE_TRANSVR_DISCONNECTED TRANSVR_TYPE_UNPLUGGED + * 0 STATE_TRANSVR_ISOLATED TRANSVR_TYPE_ERROR + * 0 STATE_TRANSVR_INIT / + * 0 STATE_TRANSVR_SWAPPED + * 0 STATE_TRANSVR_CONNECTED + * ERR_TRNASVR_BE_ISOLATED STATE_TRANSVR_ISOLATED TRANSVR_TYPE_ERROR + * ERR_TRANSVR_I2C_CRASH STATE_TRANSVR_UNEXCEPTED TRANSVR_TYPE_ERROR + * ERR_TRANSVR_UNEXCPT STATE_TRANSVR_UNEXCEPTED TRANSVR_TYPE_UNKNOW_1/2 + */ + result[0] = STATE_TRANSVR_UNEXCEPTED; /* For return state */ + result[1] = TRANSVR_TYPE_ERROR; /* For return type */ + + /* Case1: Fake type */ + if (self->type == TRANSVR_TYPE_FAKE){ + result[0] = STATE_TRANSVR_CONNECTED; + result[1] = TRANSVR_TYPE_FAKE; + return 0; + } + /* Case2: Transceiver unplugged */ + if (!is_plugged(self)){ + result[0] = STATE_TRANSVR_DISCONNECTED; + result[1] = TRANSVR_TYPE_UNPLUGGED; + return 0; + } + /* Case3: Transceiver be isolated */ + if (self->state == STATE_TRANSVR_ISOLATED){ + result[0] = STATE_TRANSVR_ISOLATED; + result[1] = TRANSVR_TYPE_ERROR; + return ERR_TRNASVR_BE_ISOLATED; + } + /* Case4: Transceiver plugged */ + result[1] = detect_transvr_type(self); + /* Case4.1: I2C topology crash + * Note : There are some I2C issues cause by transceiver/cables. + * We need to check topology status when user insert it. + * But in this step, we can't not ensure this is the issues + * port. So, it return the ERR_TRANSVR_I2C_CRASH, then upper + * layer will diagnostic I2C topology. + */ + if (check_channel_tier_1() < 0) { + SWPS_INFO("%s: %s detect I2C crash :%d\n", + __func__, self->swp_name, self->state); + result[0] = STATE_TRANSVR_UNEXCEPTED; + result[1] = TRANSVR_TYPE_ERROR; + return ERR_TRANSVR_I2C_CRASH; + } + /* Case4.2: System initial not ready, + * Note : Sometime i2c channel or transceiver EEPROM will delay that will + * cause system in inconsistent state between EEPROM and IOEXP. + * In this case, SWP transceiver object keep state at LINK_DOWN + * to wait system ready. + * By the way, State Machine will handle these case. + */ + if (result[1] == TRANSVR_TYPE_UNPLUGGED){ + result[0] = STATE_TRANSVR_DISCONNECTED; + return 0; + } + /* Case4.3: Error transceiver type */ + if (result[1] == TRANSVR_TYPE_ERROR){ + result[0] = STATE_TRANSVR_ISOLATED; + SWPS_INFO("%s: %s detect error type\n", __func__, self->swp_name); + alarm_msg_2_user(self, "detected transceiver/cables not meet SFF standard!"); + return ERR_TRNASVR_BE_ISOLATED; + } + /* Case3.3: Unknow transceiver type */ + if ((result[1] == TRANSVR_TYPE_UNKNOW_1) || + (result[1] == TRANSVR_TYPE_UNKNOW_2) ){ + result[0] = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_UNEXCPT; + } + /* Case3.4: During initial process */ + if (self->state == STATE_TRANSVR_INIT){ + result[0] = STATE_TRANSVR_INIT; + return 0; + } + /* Case3.5: Transceiver be swapped */ + if (self->type != result[1]){ + result[0] = STATE_TRANSVR_SWAPPED; + return 0; + } + /* Case3.6: Link up state */ + result[0] = STATE_TRANSVR_CONNECTED; + return 0; +} + + +int +_sfp_detect_class_by_extend_comp(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int detect_val = _sfp_get_comp_extended(self); + + switch(detect_val) { + case 0x00: /* Unspecified */ + return TRANSVR_CLASS_UNSPECIFIED; + + case 0x01: /* 100G AOC (Active Optical Cable) or 25GAUI C2M */ + case 0x18: /* 100G AOC or 25GAUI C2M AOC. */ + return TRANSVR_CLASS_OPTICAL_25G_AOC; + + case 0x02: /* 100GBASE-SR4 or 25GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_25G_SR; + + case 0x03: /* 100GBASE-LR4 or 25GBASE-LR */ + return TRANSVR_CLASS_OPTICAL_25G_LR; + + case 0x04: /* 100GBASE-ER4 or 25GBASE-ER */ + return TRANSVR_CLASS_OPTICAL_25G_ER; + + case 0x08: /* 100G ACC (Active Copper Cable) or 25GAUI C2M ACC. */ + case 0x0b: /* 100GBASE-CR4 or 25GBASE-CR CA-L */ + case 0x0c: /* 25GBASE-CR CA-S */ + case 0x0d: /* 25GBASE-CR CA-N */ + case 0x19: /* 100G ACC or 25GAUI C2M ACC. */ + return TRANSVR_CLASS_COPPER_L1_25G; + + default: + break; + } + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_detect_class_by_10_ethernet(struct transvr_obj_s* self) { + /* Reference: SFF-8472 (v12.2) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + + detect_val = _sfp_get_comp_10g_eth_comp(self); + /* Case: Unspecified */ + if (detect_val == 0x00) { + return TRANSVR_CLASS_UNSPECIFIED; + } + /* Case: 10G Optical (x1) */ + if ((detect_val & 0x10) == 0x10) { /* 00010000 : 10GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_10G_S_SR; + } + if ( ((detect_val & 0x20) == 0x20) || /* 00100000 : 10GBASE-LR */ + ((detect_val & 0x40) == 0x40) ){ /* 01000000 : 10GBASE-LRM */ + return TRANSVR_CLASS_OPTICAL_10G_S_LR; + } + if ((detect_val & 0x80) == 0x80) { /* 10000000 : 10GBASE-ER */ + return TRANSVR_CLASS_OPTICAL_10G_S_ER; + } + /* Case: ERROR */ + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_detect_if_sp_by_br(struct transvr_obj_s* self) { + + int lower_bound_1g = 0x0b; + int upper_bound_1g = 0x1A; + int lower_bound_10g = 0x60; + int upper_bound_10g = 0x75; + int lower_bound_25g = 0xf0; + int upper_bound_25g = 0xff; + int notmal_br = DEBUG_TRANSVR_INT_VAL; + + notmal_br = (int)(self->br); /* updated by update_all() */ + /* Check 25G */ + if ((notmal_br >= lower_bound_25g) && + (notmal_br <= upper_bound_25g) ) { + return TRANSVR_CLASS_25G; + } + /* Check 10G */ + if ((notmal_br >= lower_bound_10g) && + (notmal_br <= upper_bound_10g) ) { + return TRANSVR_CLASS_10G; + } + /* Check 1G */ + if ((notmal_br >= lower_bound_1g) && + (notmal_br <= upper_bound_1g) ) { + return TRANSVR_CLASS_1G; + } + return TRANSVR_CLASS_UNSPECIFIED; +} + + +int +_sfp_detect_class_by_1g_ethernet(struct transvr_obj_s* self) { + /* Reference: SFF-8472 (v12.2) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + int speed_br = DEBUG_TRANSVR_INT_VAL; + int speed_tmp = DEBUG_TRANSVR_INT_VAL; + char err_str[64] = DEBUG_TRANSVR_STR_VAL; + + speed_br = _sfp_detect_if_sp_by_br(self); + detect_val = _sfp_get_comp_1g_eth_comp(self); + + if (detect_val < 0) { + snprintf(err_str, sizeof(err_str), "Detect abnormal value:%d", detect_val); + goto err_p_sfp_detect_class_by_1g_ethernet; + } + /* Case: Unspecified */ + if (detect_val == 0x00) { + return TRANSVR_CLASS_UNSPECIFIED; + } + /* Case: 1G (x1) */ + if ((detect_val & 0x01) == 0x01) { /* 00000001 : 1000BASE-SX */ + speed_tmp = TRANSVR_CLASS_OPTICAL_1G_SX; + goto ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g; + } + if ((detect_val & 0x02) == 0x02) { /* 00000010 : 1000BASE-LX *3 */ + speed_tmp = TRANSVR_CLASS_OPTICAL_1G_LX; + goto ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g; + } + if ((detect_val & 0x04) == 0x04) { /* 00000100 : 1000BASE-CX */ + speed_tmp = TRANSVR_CLASS_COPPER_L1_1G; + goto ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g; + } + /* Case: 1000 Base-T (x1) */ + if ((detect_val & 0x08) == 0x08) { /* 00001000 : 1000BASE-T */ + return TRANSVR_CLASS_BASE_T_1000; + } + /* Case: 100 Base */ + if ( ((detect_val & 0x10) == 0x10) || /* 00010000 : 100BASE-LX/LX10 */ + ((detect_val & 0x20) == 0x20) || /* 00100000 : 100BASE-FX */ + ((detect_val & 0x40) == 0x40) || /* 01000000 : BASE-BX10 *3 */ + ((detect_val & 0x80) == 0x80) ){ /* 10000000 : BASE-PX *3 */ + return TRANSVR_CLASS_OPTICAL_100; + } + /* Case: ERROR */ + snprintf(err_str, sizeof(err_str), "Case:ERROR, value:%d", detect_val); + goto err_p_sfp_detect_class_by_1g_ethernet; + +ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g: + switch (speed_br) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_1G: + return speed_tmp; + case TRANSVR_CLASS_10G: + goto ok_sfp_detect_class_by_1g_ethernet_4_transfer_10G; + } + +ok_sfp_detect_class_by_1g_ethernet_4_transfer_10G: + switch (speed_tmp) { + case TRANSVR_CLASS_OPTICAL_1G_SX: + return TRANSVR_CLASS_OPTICAL_10G_S_SR; + case TRANSVR_CLASS_OPTICAL_1G_LX: + return TRANSVR_CLASS_OPTICAL_10G_S_LR; + case TRANSVR_CLASS_COPPER_L1_1G: + return TRANSVR_CLASS_COPPER_L1_10G; + default: + break; + } + snprintf(err_str, sizeof(err_str), "transfer_1to10 fail, speed:%d", speed_tmp); + goto err_p_sfp_detect_class_by_1g_ethernet; + +err_p_sfp_detect_class_by_1g_ethernet: + SWPS_INFO("%s: %s :%s", __func__, err_str, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_detect_class_by_feature(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int is_active = 0; + int conn_val = DEBUG_TRANSVR_INT_VAL; + int check_val = DEBUG_TRANSVR_INT_VAL; + int wave_len = DEBUG_TRANSVR_INT_VAL; + int speed_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + speed_val = _sfp_detect_if_sp_by_br(self); + conn_val = _sfp_get_connector_type(self); + + switch(conn_val) { + case 0x00: /* Unspecified */ + goto ok_sfp_detect_class_by_feature_4_check_active_passive; + case 0x07: /* LC (Lucent Connector) */ + case 0x0b: /* Optical Pigtail */ + case 0x0c: /* MPO 1x12 */ + case 0x0d: /* MPO 2x16 */ + /* + * ToDo: Need verify Optical Pigtail + */ + goto ok_sfp_detect_class_by_feature_4_optiocal; + case 0x21: /* Copper pigtail */ + /* + * ToDo: Need check ACC use case + */ + goto ok_sfp_detect_class_by_feature_4_check_active_passive; + case 0x23: /* No separable connector */ + /* + * ToDo: Standard not clear, not all transceiver vendor + * have the same defined + */ + goto ok_sfp_detect_class_by_feature_4_check_active_passive; + default: + break; + } + goto ok_sfp_detect_class_by_feature_4_unknow; + +ok_sfp_detect_class_by_feature_4_check_active_passive: + check_val = _sfp_get_cable_tech(self); + switch(check_val) { + case 0x00: /* Unspecified */ + goto ok_sfp_detect_class_by_feature_4_unknow; + case 0x04: /* Passive */ + goto ok_sfp_detect_class_by_feature_4_copper; + case 0x08: /* Active */ + is_active = 1; + goto ok_sfp_detect_class_by_feature_4_aoc; + default: + snprintf(err_msg, sizeof(err_msg), + "_sfp_get_cable_tech return Non define value:%d", + check_val); + break; + } + goto err_sfp_detect_class_by_feature_1; + +ok_sfp_detect_class_by_feature_4_optiocal: + wave_len = _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1]); + switch(speed_val) { + case TRANSVR_CLASS_25G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_25G_SR; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_25G_LR; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_25G_ER; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_25G; + + case TRANSVR_CLASS_10G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_10G_S_SR; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_10G_S_LR; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_10G_S_ER; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_10G; + + case TRANSVR_CLASS_1G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_1G_SX; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_1G_LX; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_1G_EX; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_1G; + + default: + return TRANSVR_CLASS_OPTICAL; + } + +ok_sfp_detect_class_by_feature_4_aoc: + switch(speed_val) { + case TRANSVR_CLASS_25G: + return TRANSVR_CLASS_OPTICAL_25G_AOC; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_OPTICAL_10G_S_AOC; + case TRANSVR_CLASS_1G: + return TRANSVR_CLASS_OPTICAL_1G_AOC; + default: + break; + } + goto ok_sfp_detect_class_by_feature_4_unknow; + +ok_sfp_detect_class_by_feature_4_copper: + switch(speed_val) { + case TRANSVR_CLASS_25G: + return TRANSVR_CLASS_COPPER_L1_25G; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_COPPER_L1_10G; + case TRANSVR_CLASS_1G: + return TRANSVR_CLASS_COPPER_L1_1G; + default: + return TRANSVR_CLASS_COPPER; + } + +ok_sfp_detect_class_by_feature_4_unknow: + return TRANSVR_CLASS_UNSPECIFIED; + +err_sfp_detect_class_by_feature_1: + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +sft_detect_transvr_class(struct transvr_obj_s* self) { + + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Check Extended Compliance */ + detect_val = _sfp_detect_class_by_extend_comp(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_COPPER_L1_25G: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined extend_comp:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Check 10G Compliance */ + detect_val = _sfp_detect_class_by_10_ethernet(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined 10G_eth:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Check 1G Compliance */ + detect_val = _sfp_detect_class_by_1g_ethernet(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_COPPER_L1_1G: + case TRANSVR_CLASS_BASE_T_1000: + case TRANSVR_CLASS_OPTICAL_100: + /* + * ToDo: Need Check 0.1G + */ + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_COPPER_L1_10G: + /* Transfer speed case + * => Example: Raycom 10G DAC + */ + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined 1G_eth:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Check by connector, br, wavelength */ + detect_val = _sfp_detect_class_by_feature(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL: + case TRANSVR_CLASS_OPTICAL_1G: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_25G: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_COPPER: + case TRANSVR_CLASS_COPPER_L1_1G: + case TRANSVR_CLASS_COPPER_L1_10G: + case TRANSVR_CLASS_COPPER_L1_25G: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined get_connector:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sft_detect_transceiver_class_1; + +err_sft_detect_transceiver_class_1: + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_set_trident2_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result){ + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch(transvr_cls) { + case TRANSVR_CLASS_ERROR: + case TRANSVR_CLASS_UNSPECIFIED: + break; + /* 25G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 25G COPPER */ + case TRANSVR_CLASS_COPPER_L1_25G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 10G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 10G COPPER */ + case TRANSVR_CLASS_COPPER_L1_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 1G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G COPPER */ + case TRANSVR_CLASS_COPPER_L1_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G BASE_T */ + case TRANSVR_CLASS_BASE_T_1000: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 100 Base */ + case TRANSVR_CLASS_OPTICAL_100: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_sfp_set_trident2_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sfp_set_trident2_if_type_1; + +err_sfp_set_trident2_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_sfp_set_tomahawk_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result) { + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch(transvr_cls) { + case TRANSVR_CLASS_ERROR: + case TRANSVR_CLASS_UNSPECIFIED: + break; + /* 25G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G: + return snprintf(result, lmax, TRANSVR_IF_SR); + /* 25G COPPER */ + case TRANSVR_CLASS_COPPER_L1_25G: + return snprintf(result, lmax, TRANSVR_IF_KR); + /* 10G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 10G COPPER */ + case TRANSVR_CLASS_COPPER_L1_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 1G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G COPPER */ + case TRANSVR_CLASS_COPPER_L1_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G BASE_T */ + case TRANSVR_CLASS_BASE_T_1000: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 100 Base */ + case TRANSVR_CLASS_OPTICAL_100: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_sfp_set_tomahawk_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sfp_set_tomahawk_if_type_1; + +err_sfp_set_tomahawk_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_sfp_set_bf_tofino_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result) { + /* (TBD) + * Due to BF looks like doesn't have interface type. + * We bypass it currently. + */ + int lmax = 8; + return snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); +} + + +int +_sfp_detect_if_type(struct transvr_obj_s* self, + char *result){ + + int lmax = 8; + int detect_cls = DEBUG_TRANSVR_INT_VAL; + + detect_cls = sft_detect_transvr_class(self); + switch (self->chipset_type) { + case BCM_CHIP_TYPE_TRIDENT_2: + return _sfp_set_trident2_if_type(self, detect_cls, result); + + case BCM_CHIP_TYPE_TOMAHAWK: + return _sfp_set_tomahawk_if_type(self, detect_cls, result); + + case BF_CHIP_TYPE_TOFINO: + return _sfp_set_bf_tofino_if_type(self, detect_cls, result); + + default: + SWPS_INFO("%s: non-defined chipset_type:%d :%s\n", + __func__, self->chipset_type, self->swp_name); + break; + } + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + return ERR_TRANSVR_ABNORMAL; +} + + +int +sfp_get_if_type(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 16; + char tmp_result[16] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_sfp_detect_if_type(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_sfp_detect_if_speed(struct transvr_obj_s* self, + char *result){ + + int lmax = 16; + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + detect_val = sft_detect_transvr_class(self); + switch(detect_val) { + case TRANSVR_CLASS_ERROR: + case TRANSVR_CLASS_UNSPECIFIED: + break; + /* 25G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G: + return snprintf(result, lmax, TRANSVR_IF_SP_25G); + /* 25G COPPER */ + case TRANSVR_CLASS_COPPER_L1_25G: + return snprintf(result, lmax, TRANSVR_IF_SP_25G); + /* 10G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* 10G COPPER */ + case TRANSVR_CLASS_COPPER_L1_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* 1G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + /* 1G COPPER */ + case TRANSVR_CLASS_COPPER_L1_1G: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + /* 1G BASE_T */ + case TRANSVR_CLASS_BASE_T_1000: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + /* 100 Base */ + case TRANSVR_CLASS_OPTICAL_100: + return snprintf(result, lmax, TRANSVR_IF_SP_100); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + detect_val); + goto err_sfp_detect_if_speed_1; + } + /* Check by BR */ + detect_val = _sfp_detect_if_sp_by_br(self); + switch (detect_val) { + case TRANSVR_CLASS_25G: + return snprintf(result, lmax, TRANSVR_IF_SP_25G); + case TRANSVR_CLASS_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + case TRANSVR_CLASS_1G: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + default: + break; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sfp_detect_if_speed_1; + +err_sfp_detect_if_speed_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +sfp_get_if_speed(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 16; + char tmp_result[16] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_sfp_detect_if_speed(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_qsfp_detect_class_by_extend_comp(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + + detect_val = _qsfp_get_comp_extended(self); + switch(detect_val) { + case 0x00: /* Unspecified */ + return TRANSVR_CLASS_UNSPECIFIED; + + case 0x01: /* 100G AOC (Active Optical Cable) or 25GAUI C2M */ + case 0x18: /* 100G AOC or 25GAUI C2M AOC. */ + return TRANSVR_CLASS_OPTICAL_100G_AOC; + + case 0x06: /* 100G CWDM4 */ + case 0x09: /* Obsolete (assigned before 100G CWDM4 MSA required FEC) */ + case 0x17: /* 100G CLR4 */ + case 0x1A: /* 100GE-DWDM2 */ + return TRANSVR_CLASS_OPTICAL_100G; + + case 0x02: /* 100GBASE-SR4 or 25GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_100G_SR4; + + case 0x03: /* 100GBASE-LR4 or 25GBASE-LR */ + return TRANSVR_CLASS_OPTICAL_100G_LR4; + + case 0x04: /* 100GBASE-ER4 or 25GBASE-ER */ + return TRANSVR_CLASS_OPTICAL_100G_ER4; + + case 0x07: /* 100G PSM4 Parallel SMF */ + return TRANSVR_CLASS_OPTICAL_100G_PSM4; + + case 0x12: /* 40G PSM4 Parallel SMF */ + return TRANSVR_CLASS_OPTICAL_40G; + + case 0x11: /* 4 x 10GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_40G_SR4; + + case 0x10: /* 40GBASE-ER4 */ + return TRANSVR_CLASS_OPTICAL_40G_ER4; + + case 0x08: /* 100G ACC (Active Copper Cable) or 25GAUI C2M ACC. */ + case 0x0b: /* 100GBASE-CR4 or 25GBASE-CR CA-L */ + case 0x19: /* 100G ACC or 25GAUI C2M ACC. */ + return TRANSVR_CLASS_COPPER_L4_100G; + + default: + break; + } + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_qsfp_detect_class_by_10_40_100_ethernet(struct transvr_obj_s* self) { + /* Reference: SFF-8472 (v12.2) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + + detect_val = _qsfp_get_comp_10_40_100_ethernet(self); + /* Case: Unspecified */ + if (detect_val == 0x00) { + return TRANSVR_CLASS_UNSPECIFIED; + } + /* Case: 40G Optical */ + if ((detect_val & 0x01) == 0x01) { /* 00000001 : 40G Active Cable (XLPPI) */ + return TRANSVR_CLASS_OPTICAL_40G_AOC; + } + if ((detect_val & 0x04) == 0x04) { /* 00000100 : 40GBASE-SR4 */ + return TRANSVR_CLASS_OPTICAL_40G_SR4; + } + if ( (detect_val & 0x02) == 0x02) { /* 00000010 : 40GBASE-LR4 */ + return TRANSVR_CLASS_OPTICAL_40G_LR4; + } + if ( (detect_val & 0x08) == 0x08) { /* 00001000 : 40GBASE-CR4 */ + return TRANSVR_CLASS_COPPER_L4_40G; + } + /* Case: 10G Optical */ + if ( (detect_val & 0x10) == 0x10) { /* 00010000 : 10GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_10G_Q_SR; + } + if ( ((detect_val & 0x20) == 0x20) || /* 00100000 : 10GBASE-LR */ + ((detect_val & 0x40) == 0x40) ){ /* 01000000 : 10GBASE-LRM */ + return TRANSVR_CLASS_OPTICAL_10G_Q_LR; + } + /* Case: Extend Compliance */ + if ( ((detect_val & 0x80) == 0x80) ){ /* 10000000 : Use Extend Compliance */ + return TRANSVR_CLASS_EXTEND_COMP; + } + /* Case: ERROR */ + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_qsfp_detect_if_sp_by_br(struct transvr_obj_s* self) { + + int lower_bound_10g = 0x10; + int upper_bound_10g = 0x25; + int lower_bound_40g = 0x60; + int upper_bound_40g = 0x75; + int lower_bound_100g = 0x60; + int upper_bound_100g = 0x75; + int used_extend_br = 0xff; + int notmal_br = DEBUG_TRANSVR_INT_VAL; + int extend_br = DEBUG_TRANSVR_INT_VAL; + + notmal_br = (int)(self->br); /* updated by update_all() */ + /* Check 40G */ + if ((notmal_br >= lower_bound_40g) && + (notmal_br <= upper_bound_40g) ) { + return TRANSVR_CLASS_40G; + } + /* Check 100G */ + if (notmal_br == used_extend_br) { + extend_br = (int)(self->extbr); /* updated by update_all() */ + if ((extend_br >= lower_bound_100g) && + (extend_br <= upper_bound_100g) ) { + return TRANSVR_CLASS_100G; + } + } + /* Check 10G */ + if ((notmal_br >= lower_bound_10g) && + (notmal_br <= upper_bound_10g) ) { + return TRANSVR_CLASS_10G; + } + return TRANSVR_CLASS_UNSPECIFIED; +} + + +int +_qsfp_detect_class_by_feature(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int conn_val = DEBUG_TRANSVR_INT_VAL; + int wave_len = DEBUG_TRANSVR_INT_VAL; + int speed_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + speed_val = _qsfp_detect_if_sp_by_br(self); + conn_val = _qsfp_get_connector_type(self); + + switch(conn_val) { + case 0x00: /* Unspecified */ + return TRANSVR_CLASS_UNSPECIFIED; + case 0x07: /* LC (Lucent Connector) */ + case 0x0b: /* Optical Pigtail */ + case 0x0c: /* MPO 1x12 (Multifiber Parallel Optic) */ + case 0x0d: /* MPO 2x16 */ + goto ok_qsfp_detect_class_by_feature_4_optiocal; + case 0x21: /* Copper pigtail */ + goto ok_qsfp_detect_class_by_feature_4_copper; + case 0x23: /* No separable connector */ + if ((_qsfp_get_comp_fc_link_length(self) > 0) || + (_qsfp_get_comp_fc_trans_tech(self) > 0) || + (_qsfp_get_comp_fc_trans_media(self) > 0) || + (_qsfp_get_comp_fc_speed(self) > 0) ) { + goto ok_qsfp_detect_class_by_feature_4_aoc; + } + goto ok_qsfp_detect_class_by_feature_4_copper; + default: + snprintf(err_msg, sizeof(err_msg), + "_qsfp_get_connector_type return Non define value:%d", + conn_val); + goto err_qsfp_detect_class_by_feature_1; + } + return TRANSVR_CLASS_UNSPECIFIED; + +ok_qsfp_detect_class_by_feature_4_optiocal: + wave_len = _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1]); + switch(speed_val) { + case TRANSVR_CLASS_100G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_100G_SR4; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_100G_LR4; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_100G_ER4; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_100G; + + case TRANSVR_CLASS_40G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_40G_SR4; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_40G_LR4; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_40G_ER4; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_40G; + + case TRANSVR_CLASS_10G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_10G_Q_SR; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_10G_Q_LR; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_10G_Q_ER; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_10G; + + default: + return TRANSVR_CLASS_OPTICAL; + } + +ok_qsfp_detect_class_by_feature_4_aoc: + switch(speed_val) { + case TRANSVR_CLASS_100G: + return TRANSVR_CLASS_OPTICAL_100G_AOC; + case TRANSVR_CLASS_40G: + return TRANSVR_CLASS_OPTICAL_40G_AOC; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_OPTICAL_10G_Q_AOC; + default: + return TRANSVR_CLASS_OPTICAL; + } + +ok_qsfp_detect_class_by_feature_4_copper: + switch(speed_val) { + case TRANSVR_CLASS_100G: + return TRANSVR_CLASS_COPPER_L4_100G; + case TRANSVR_CLASS_40G: + return TRANSVR_CLASS_COPPER_L4_40G; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_COPPER_L4_10G; + default: + return TRANSVR_CLASS_COPPER; + } + +err_qsfp_detect_class_by_feature_1: + SWPS_INFO("%s: %s\n :%s", + __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +qsft_detect_transvr_class(struct transvr_obj_s* self) { + + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Check Extended Compliance */ + detect_val = _qsfp_detect_class_by_extend_comp(self); + switch (detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + case TRANSVR_CLASS_COPPER_L4_100G: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined extend_comp:%d", + detect_val); + goto err_qsft_detect_transvr_class_1; + } + /* Check 10/40G/100G Ethernet Compliance */ + detect_val = _qsfp_detect_class_by_10_40_100_ethernet(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_COPPER_L4_40G: + return detect_val; + case TRANSVR_CLASS_EXTEND_COMP: + /* Format incorrect case (We already checked the Extend + * Compliance is 0 + */ + snprintf(err_msg, sizeof(err_msg), + "Transceiver format incorrect"); + goto err_qsft_detect_transvr_class_1; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined 10/40/100:%d", + detect_val); + goto err_qsft_detect_transvr_class_1; + } + /* Check by Connector type, BR and wavelength */ + detect_val = _qsfp_detect_class_by_feature(self); + switch (detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL: + case TRANSVR_CLASS_COPPER_L4_100G: + case TRANSVR_CLASS_COPPER_L4_40G: + case TRANSVR_CLASS_COPPER_L4_10G: + case TRANSVR_CLASS_COPPER: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined connector:%d", + detect_val); + goto err_qsft_detect_transvr_class_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), + "Can not identify!"); + goto err_qsft_detect_transvr_class_1; + +err_qsft_detect_transvr_class_1: + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_qsfp_set_trident2_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result){ + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch (transvr_cls) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_ERROR: + break; + /* 100G Optical */ + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* 100G Copper */ + case TRANSVR_CLASS_COPPER_L4_100G: + return snprintf(result, lmax, TRANSVR_IF_KR4); + /* 40G Optical */ + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* 40G Copper */ + case TRANSVR_CLASS_COPPER_L4_40G: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* 10G Optical */ + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: LR4 or LR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: /* Need Check: ER4 or ER */ + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* Optical */ + case TRANSVR_CLASS_OPTICAL: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* Copper */ + case TRANSVR_CLASS_COPPER: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_qsfp_set_trident2_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_qsfp_set_trident2_if_type_1; + +err_qsfp_set_trident2_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_qsfp_set_tomahawk_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result){ + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch (transvr_cls) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_ERROR: + break; + /* 100G Optical */ + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* 100G Copper */ + case TRANSVR_CLASS_COPPER_L4_100G: + return snprintf(result, lmax, TRANSVR_IF_KR4); + /* 40G Optical */ + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* 40G Copper */ + case TRANSVR_CLASS_COPPER_L4_40G: + return snprintf(result, lmax, TRANSVR_IF_KR4); + /* 10G Optical */ + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* Optical */ + case TRANSVR_CLASS_OPTICAL: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* Copper */ + case TRANSVR_CLASS_COPPER: + return snprintf(result, lmax, TRANSVR_IF_KR4); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_qsfp_set_trident2_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_qsfp_set_trident2_if_type_1; + +err_qsfp_set_trident2_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_qsfp_set_bf_tofino_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result) { + /* (TBD) + * Due to BF looks like doesn't have interface type. + * We bypass it currently. + */ + int lmax = 8; + return snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); +} + + +int +_qsfp_detect_if_type(struct transvr_obj_s* self, + char *result){ + + int lmax = 8; + int detect_cls = DEBUG_TRANSVR_INT_VAL; + + detect_cls = qsft_detect_transvr_class(self); + switch (self->chipset_type) { + case BCM_CHIP_TYPE_TRIDENT_2: + return _qsfp_set_trident2_if_type(self, detect_cls, result); + + case BCM_CHIP_TYPE_TOMAHAWK: + return _qsfp_set_tomahawk_if_type(self, detect_cls, result); + + case BF_CHIP_TYPE_TOFINO: + return _qsfp_set_bf_tofino_if_type(self, detect_cls, result); + + default: + SWPS_INFO("%s: non-defined chipset_type:%d :%s\n", + __func__, self->chipset_type, self->swp_name); + break; + } + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_if_type(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 8; + char tmp_result[8] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_qsfp_detect_if_type(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_qsfp_detect_if_speed(struct transvr_obj_s* self, + char *result){ + int lmax = 16; + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + detect_val = qsft_detect_transvr_class(self); + switch (detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_ERROR: + break; + /* 100G Optical */ + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return snprintf(result, lmax, TRANSVR_IF_SP_100G); + /* 100G Copper */ + case TRANSVR_CLASS_COPPER_L4_100G: + return snprintf(result, lmax, TRANSVR_IF_SP_100G); + /* 40G Optical */ + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + return snprintf(result, lmax, TRANSVR_IF_SP_40G); + /* 40G Copper */ + case TRANSVR_CLASS_COPPER_L4_40G: + return snprintf(result, lmax, TRANSVR_IF_SP_40G); + /* 10G Optical */ + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* 10G Copper */ + case TRANSVR_CLASS_COPPER_L4_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* Optical */ + case TRANSVR_CLASS_OPTICAL: + break; + /* Copper */ + case TRANSVR_CLASS_COPPER: + break; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined class case:%d", + detect_val); + goto err_qsfp_detect_if_speed_1; + } + /* Check br and extbr */ + detect_val = _qsfp_detect_if_sp_by_br(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + case TRANSVR_CLASS_40G: + return snprintf(result, lmax, TRANSVR_IF_SP_40G); + case TRANSVR_CLASS_100G: + return snprintf(result, lmax, TRANSVR_IF_SP_100G); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined BR case:%d", + detect_val); + goto err_qsfp_detect_if_speed_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_qsfp_detect_if_speed_1; + +err_qsfp_detect_if_speed_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_if_speed(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 16; + char tmp_result[16] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_qsfp_detect_if_speed(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_common_set_lane_map_str(struct transvr_obj_s* self, + char *result) { + int i = 0; + int tmp_val = 0; + char tmp_str[LEN_TRANSVR_L_STR] = DEBUG_TRANSVR_STR_VAL; + char err_msg[LEN_TRANSVR_L_STR] = DEBUG_TRANSVR_STR_VAL; + + memset(result, 0, LEN_TRANSVR_L_STR); + snprintf(result, LEN_TRANSVR_L_STR, "%s=", TRANSVR_UEVENT_KEY_LANE); + + for (i=0; ilane_id); i++) { + tmp_val = self->lane_id[i]; + if (tmp_val < 1) { + break; + } + if (tmp_val > 256) { + snprintf(err_msg, sizeof(err_msg), + "detect abnormal value:%d", tmp_val); + goto err_common_set_lane_map_str_1; + } + memset(tmp_str, 0, sizeof(tmp_str)); + if (i == 0) { + snprintf(tmp_str, LEN_TRANSVR_L_STR, "%d", tmp_val); + } else { + snprintf(tmp_str, LEN_TRANSVR_L_STR, ",%d", tmp_val); + } + strncat(result, tmp_str, LEN_TRANSVR_L_STR); + } + if (i == 0) { + goto err_common_set_lane_map_str_2; + } + return 0; + +err_common_set_lane_map_str_1: + SWPS_INFO("%s: %s", __func__, err_msg); +err_common_set_lane_map_str_2: + snprintf(result, LEN_TRANSVR_L_STR, "%s=%s", TRANSVR_UEVENT_KEY_LANE, TRANSVR_UEVENT_UNKNOW); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_common_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action, + int (*detect_if_type)(struct transvr_obj_s *self, char *result), + int (*detect_if_speed)(struct transvr_obj_s *self, char *result), + int send_anyway) { + + char *uevent_envp[4]; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + char tmp_str[32] = DEBUG_TRANSVR_STR_VAL; + char tmp_str_1[32] = DEBUG_TRANSVR_STR_VAL; + char tmp_str_2[32] = DEBUG_TRANSVR_STR_VAL; + char tmp_str_3[64] = DEBUG_TRANSVR_STR_VAL; + + if (TRANSVR_UEVENT_ENABLE != 1) { + return ERR_TRANSVR_NOTSUPPORT; + } + if (_common_get_if_lane(self, tmp_str) < 0) { + snprintf(tmp_str_3, sizeof(tmp_str_3), + "%s=%s", TRANSVR_UEVENT_KEY_LANE, TRANSVR_UEVENT_UNKNOW); + } else { + snprintf(tmp_str_3, sizeof(tmp_str_3), + "%s=%s", TRANSVR_UEVENT_KEY_LANE, tmp_str); + } + switch (u_action) { + case KOBJ_ADD: + /* Detect type */ + if (detect_if_type(self, tmp_str) < 0) { + snprintf(err_msg, sizeof(err_msg), "%s", "Detect interface type fail!"); + snprintf(tmp_str_1, sizeof(tmp_str_1), "%s=%s", TRANSVR_UEVENT_KEY_IF, TRANSVR_UEVENT_UNKNOW); + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, TRANSVR_UEVENT_UNKNOW); + uevent_envp[0] = tmp_str_1; + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_fail; + } + snprintf(tmp_str_1, sizeof(tmp_str_1), "%s=%s", TRANSVR_UEVENT_KEY_IF, tmp_str); + uevent_envp[0] = tmp_str_1; + /* Detect speed */ + if (detect_if_speed(self, tmp_str) < 0) { + snprintf(err_msg, sizeof(err_msg), "%s", "Detect interface speed fail!"); + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, TRANSVR_UEVENT_UNKNOW); + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_fail; + } + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, tmp_str); + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_send; + + case KOBJ_REMOVE: + snprintf(tmp_str_1, sizeof(tmp_str_1), "%s=%s", TRANSVR_UEVENT_KEY_IF, TRANSVR_UEVENT_UNKNOW); + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, TRANSVR_UEVENT_UNKNOW); + uevent_envp[0] = tmp_str_1; + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_send; + + default: + snprintf(err_msg, sizeof(err_msg), "kobject_action:%d not support", u_action); + goto private_common_send_uevent_4_fail; + } + snprintf(err_msg, sizeof(err_msg), "%s", "Exception case"); + goto private_common_send_uevent_4_fail; + +private_common_send_uevent_4_fail: + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + if (send_anyway) { + goto private_common_send_uevent_4_send; + } + return ERR_TRANSVR_UEVENT_FAIL; + +private_common_send_uevent_4_send: + return kobject_uevent_env(&(self->transvr_dev_p->kobj), + u_action, + uevent_envp); +} + +int +sfp_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action) { + int send_anyway = 1; + return _common_send_uevent(self, + u_action, + &_sfp_detect_if_type, + &_sfp_detect_if_speed, + send_anyway); +} + + +int +qsfp_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action) { + int send_anyway = 1; + return _common_send_uevent(self, + u_action, + &_qsfp_detect_if_type, + &_qsfp_detect_if_speed, + send_anyway); +} + + +int +fake_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action) { + return EVENT_TRANSVR_TASK_DONE; +} + + +int +common_fsm_4_direct_mode(struct transvr_obj_s* self, + char *caller_name){ + + int err; + int detect_result[2]; + int current_state = STATE_TRANSVR_UNEXCEPTED; + int current_type = TRANSVR_TYPE_ERROR; + + if (self->state == STATE_TRANSVR_NEW) { + if (_transvr_init_handler(self) < 0){ + return ERR_TRANSVR_INIT_FAIL; + } + } + err = detect_transvr_state(self, detect_result); + if (err < 0) { + return err; + } + /* In Direct mode, driver only detect transceiver when user call driver interface + * which on sysfs. So it only need consider the state of Transceiver. + */ + current_state = detect_result[0]; + current_type = detect_result[1]; + + switch (current_state){ + + case STATE_TRANSVR_DISCONNECTED: /* Transceiver is not plugged */ + self->state = current_state; + self->type = current_type; + return ERR_TRANSVR_UNPLUGGED; + + case STATE_TRANSVR_INIT: /* Transceiver is plugged, system not ready */ + return ERR_TRANSVR_UNINIT; + + case STATE_TRANSVR_ISOLATED: /* Transceiver is plugged, but has some issues */ + return ERR_TRNASVR_BE_ISOLATED; + + case STATE_TRANSVR_CONNECTED: /* Transceiver is plugged, system is ready */ + self->state = current_state; + self->type = current_type; + return 0; + + case STATE_TRANSVR_SWAPPED: /* Transceiver is plugged, system detect user changed */ + self->type = current_type; + if (reload_transvr_obj(self, current_type) < 0){ + self->state = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_UNEXCPT; + } + self->state = current_state; + return 0; + + case STATE_TRANSVR_UNEXCEPTED: /* Transceiver type or state is unexpected case */ + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = TRANSVR_TYPE_ERROR; + return ERR_TRANSVR_UNEXCPT; + + default: + SWPS_INFO("%s: state:%d not in define.\n", __func__, current_state); + break; + } + return ERR_TRANSVR_UNEXCPT; +} + + +static int +_is_except_happened_4_pmode(struct transvr_obj_s* self, + int new_state) { + + int event_chk = 0; + + if (self->temp == 0){ + return 0; + } + switch (new_state) { + case STATE_TRANSVR_INIT: + event_chk = EVENT_TRANSVR_EXCEP_INIT; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_CONNECTED: + event_chk = EVENT_TRANSVR_EXCEP_UP; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_DISCONNECTED: + event_chk = EVENT_TRANSVR_EXCEP_DOWN; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_SWAPPED: + event_chk = EVENT_TRANSVR_EXCEP_SWAP; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_UNEXCEPTED: + event_chk = EVENT_TRANSVR_EXCEP_EXCEP; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_ISOLATED: + event_chk = EVENT_TRANSVR_EXCEP_ISOLATED; + goto check_event_happened_4_pmode; + + default: + SWPS_INFO("%s: unexcepted case:%d\n", __func__, new_state); + break; + } + return 0; + +check_event_happened_4_pmode: + if (self->temp == event_chk){ + return 1; + } + return 0; +} + + +int +common_fsm_4_polling_mode(struct transvr_obj_s* self, + char *caller_name){ + /* [Return Value]: + * ERR_TRANSVR_UNINIT : (1) Initial not ready + * ERR_TRANSVR_UNPLUGGED : (1) Any -> Down + * ERR_TRANSVR_TASK_BUSY : (1) Wait Initial task + * ERR_TRANSVR_UNEXCPT : (1) Initial fail + * (2) Task fail + * (3) Reload fail + * ERR_TRNASVR_BE_ISOLATED : (1) Already be isolated + * OK Case (return 0) : (1) action_4_connected + * (2) action_4_nothing (initial retry) + */ + int curr_state[2]; + int old_state = self->state; + int old_type = self->type; + int new_state = STATE_TRANSVR_UNEXCEPTED; + int new_type = TRANSVR_TYPE_ERROR; + int return_val = ERR_TRANSVR_UNEXCPT; + + /* Never initial */ + if (self->state == STATE_TRANSVR_NEW) { + goto comfsm_action_4_reinit_obj; + } + /* Detect current state */ + switch (detect_transvr_state(self, curr_state)) { + case 0: + new_state = curr_state[0]; + new_type = curr_state[1]; + break; + + case ERR_TRNASVR_BE_ISOLATED: + new_state = STATE_TRANSVR_ISOLATED; + new_type = old_type; + break; + + case ERR_TRANSVR_I2C_CRASH: + goto comfsm_action_4_report_i2c_crash; + + case ERR_TRANSVR_UNEXCPT: + default: + new_state = STATE_TRANSVR_UNEXCEPTED; + new_type = old_type; + } + /* State handling */ + switch (old_state) { + case STATE_TRANSVR_INIT: /* INIT -> */ + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 1-1: UP -> INIT */ + SWPS_INFO("Detect %s is present. :1-1\n",self->swp_name); + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 1-2: UP -> UP */ + return_val = 0; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_DISCONNECTED: /* Case 1-3: UP -> DOWN */ + SWPS_INFO("Detect %s is removed. :1-3\n",self->swp_name); + goto comfsm_action_4_disconnected; + + case STATE_TRANSVR_SWAPPED: /* Case 1-4: UP -> SWAP */ + SWPS_INFO("Detect %s is swapped. :1-4\n",self->swp_name); + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 1-5: UP -> UNEXPET */ + SWPS_INFO("Detect %s has error. :1-5\n",self->swp_name); + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_ISOLATED: /* Case 1-6: UP -> ISOLATE */ + SWPS_INFO("Detect %s be isolated. :1-6\n",self->swp_name); + goto comfsm_action_4_isolate_obj; + + default: + break; + } + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_DISCONNECTED: + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 2-1: DOWN -> INIT */ + SWPS_INFO("Detect %s is present. :2-1\n",self->swp_name); + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 2-2: DOWN -> UP */ + SWPS_INFO("Detect %s is present. :2-2\n",self->swp_name); + goto comfsm_action_4_reinit_obj; + + case STATE_TRANSVR_DISCONNECTED: /* Case 2-3: DOWN -> DOWN */ + return_val = ERR_TRANSVR_UNPLUGGED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_SWAPPED: /* Case 2-4: DOWN -> SWAP */ + SWPS_INFO("Detect %s is swapped. :2-4\n",self->swp_name); + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 2-5: DOWN -> UNEXPET */ + SWPS_INFO("Detect %s has error. :2-5\n",self->swp_name); + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_ISOLATED: /* Case 2-6: DOWN -> ISOLATE */ + SWPS_INFO("Detect %s be isolated. :2-6\n",self->swp_name); + goto comfsm_action_4_isolate_obj; + + default: + break; + } + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_UNEXCEPTED: + /* Filter out re-action */ + if (_is_except_happened_4_pmode(self, new_state)) { + goto comfsm_action_4_keep_state; + } + /* First action */ + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 3-1: UNEXPET -> INIT */ + SWPS_INFO("Detect %s is present. :3-1\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_INIT; + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 3-2: UNEXPET -> UP */ + SWPS_INFO("Detect %s is present. :3-2\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_UP; + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_DISCONNECTED: /* Case 3-3: UNEXPET -> DOWN */ + SWPS_INFO("Detect %s is removed. :3-3\n",self->swp_name); + goto comfsm_action_4_disconnected; + + case STATE_TRANSVR_SWAPPED: /* Case 3-4: UNEXPET -> SWAP */ + SWPS_INFO("Detect %s is swapped. :3-4\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_SWAP; + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 3-5: UNEXPET -> UNEXPET */ + self->temp = EVENT_TRANSVR_EXCEP_EXCEP; + return_val = ERR_TRANSVR_UNEXCPT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_ISOLATED: /* Case 3-6: UNEXPET -> ISOLATE */ + SWPS_INFO("Detect %s be isolated. :3-6\n",self->swp_name); + goto comfsm_action_4_isolate_obj; + + default: + break; + } + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_ISOLATED: + /* Filter out re-action */ + if (_is_except_happened_4_pmode(self, new_state)) { + goto comfsm_action_4_keep_state; + } + /* First action */ + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 4-1: ISOLATE -> INIT */ + SWPS_INFO("Detect %s internal error. :4-1\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_INIT; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 4-2: ISOLATE -> UP */ + SWPS_INFO("Detect %s internal error. :4-2\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_UP; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_DISCONNECTED: /* Case 4-3: ISOLATE -> DOWN */ + SWPS_INFO("Detect %s is removed. :4-3\n",self->swp_name); + goto comfsm_action_4_disconnected; + + case STATE_TRANSVR_SWAPPED: /* Case 4-4: ISOLATE -> SWAP */ + SWPS_INFO("Detect %s internal error. :4-4\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_SWAP; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 4-5: ISOLATE -> UNEXPET */ + SWPS_INFO("Detect %s internal error. :4-5\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_EXCEP; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_ISOLATED: /* Case 4-6: ISOLATE -> ISOLATE */ + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + default: + break; + } + goto comfsm_action_4_unexpected; + + default: + break; + } + goto comfsm_action_4_unexpected; + + +comfsm_action_4_keep_state: + return return_val; + +comfsm_action_4_reinit_obj: + SWPS_DEBUG("FSM action: %s re-initial.\n", self->swp_name); + return_val = _transvr_init_handler(self); + goto comfsm_action_4_identify_event; + +comfsm_action_4_reload_obj: + SWPS_DEBUG("FSM action: %s reload.\n", self->swp_name); + self->type = new_type; + return_val = reload_transvr_obj(self, new_type); + goto comfsm_action_4_identify_event; + +comfsm_action_4_identify_event: + switch (return_val) { + case EVENT_TRANSVR_INIT_UP: + case EVENT_TRANSVR_TASK_DONE: + goto comfsm_action_4_connected; + + case EVENT_TRANSVR_INIT_DOWN: + goto comfsm_action_4_disconnected; + + case EVENT_TRANSVR_INIT_REINIT: + goto comfsm_action_4_nothing; + + case EVENT_TRANSVR_TASK_WAIT: + self->state = STATE_TRANSVR_INIT; + return ERR_TRANSVR_TASK_BUSY; + + case EVENT_TRANSVR_TASK_FAIL: + SWPS_INFO("%s detect EVENT_TRANSVR_TASK_FAIL.\n", self->swp_name); + goto comfsm_action_4_unexpected; + + case EVENT_TRANSVR_INIT_FAIL: + SWPS_INFO("%s detect EVENT_TRANSVR_INIT_FAIL.\n", self->swp_name); + goto comfsm_action_4_unexpected; + + case EVENT_TRANSVR_RELOAD_FAIL: + SWPS_INFO("%s detect EVENT_TRANSVR_RELOAD_FAIL.\n", self->swp_name); + goto comfsm_action_4_unexpected; + + case EVENT_TRANSVR_I2C_CRASH: + goto comfsm_action_4_report_i2c_crash; + + case EVENT_TRANSVR_EXCEP_ISOLATED: + goto comfsm_action_4_isolate_obj; + + default: + SWPS_INFO("%s detect undefined event:%d.\n", self->swp_name, return_val); + goto comfsm_action_4_unexpected; + } + +comfsm_action_4_nothing: + SWPS_DEBUG("FSM action: %s do nothing.\n", self->swp_name); + return 0; + +comfsm_action_4_connected: + SWPS_DEBUG("FSM action: %s Connected.\n", self->swp_name); + self->state = STATE_TRANSVR_CONNECTED; + self->type = new_type; + self->send_uevent(self, KOBJ_ADD); + _transvr_clean_retry(self); + return 0; + +comfsm_action_4_disconnected: + SWPS_DEBUG("FSM action: %s Disconnected. \n", self->swp_name); + self->state = STATE_TRANSVR_DISCONNECTED; + self->temp = EVENT_TRANSVR_TASK_DONE; + self->send_uevent(self, KOBJ_REMOVE); + _transvr_clean_retry(self); + _transvr_clean_handler(self); + return ERR_TRANSVR_UNPLUGGED; + +comfsm_action_4_report_i2c_crash: + SWPS_DEBUG("FSM action: %s report I2C crash.\n", self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_I2C_CRASH; + +comfsm_action_4_isolate_obj: + SWPS_DEBUG("FSM action: %s isolate.\n", self->swp_name); + self->state = STATE_TRANSVR_ISOLATED; + return ERR_TRNASVR_BE_ISOLATED; + +comfsm_action_4_unexpected: + SWPS_INFO("FSM action: %s unexpected.\n", self->swp_name); + SWPS_INFO("Dump: :%d :0x%02x :%d :0x%02x\n", + old_state, old_type, new_state, new_type); + self->state = STATE_TRANSVR_UNEXCEPTED; + self->send_uevent(self, KOBJ_REMOVE); + _transvr_clean_handler(self); + return ERR_TRANSVR_UNEXCPT; +} + + +int +fake_fsm_4_direct_mode(struct transvr_obj_s* self, + char *caller_name){ + self->state = STATE_TRANSVR_CONNECTED; + self->type = TRANSVR_TYPE_FAKE; + return 0; +} + + +int +fake_fsm_4_polling_mode(struct transvr_obj_s* self, + char *caller_name){ + self->state = STATE_TRANSVR_CONNECTED; + self->type = TRANSVR_TYPE_FAKE; + return 0; +} + + +/* ========== Object functions for Initial procedure ========== + */ +int +transvr_init_common(struct transvr_obj_s *self){ + /* Nothing to update */ + return EVENT_TRANSVR_TASK_DONE; +} + + +int +transvr_init_fake(struct transvr_obj_s *self){ + return EVENT_TRANSVR_TASK_DONE; +} + + +int +transvr_init_sfp(struct transvr_obj_s *self){ + + int tmp_val = DEBUG_TRANSVR_INT_VAL; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *err_msg = "ERR"; + + self->info = sft_detect_transvr_class(self); + /* Disable auto_config */ + if (!self->auto_config) { + return EVENT_TRANSVR_TASK_DONE; + } + /* Handle multi-rate */ + err_code = initfunc_sfp_handle_multi_rate_mode(self); + if (err_code < 0) { + err_msg = "initfunc_sfp_handle_multi_rate_mode fail!"; + goto err_transvr_init_sfp_1; + } + /* Handle 1G- RJ45 */ + tmp_val = err_code; + err_code = initfunc_sfp_handle_1g_rj45(self); + if (err_code < 0) { + err_msg = "initfunc_sfp_handle_1g_rj45 fail!"; + goto err_transvr_init_sfp_1; + } + tmp_val = (tmp_val > err_code ? tmp_val : err_code); + if (tmp_val > EVENT_TRANSVR_TASK_DONE) { + return tmp_val; + } + return EVENT_TRANSVR_TASK_DONE; + +err_transvr_init_sfp_1: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, err_code, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +int +transvr_init_qsfp(struct transvr_obj_s *self){ + + int err = EVENT_TRANSVR_EXCEP_EXCEP; + char *emsg = "ERR"; + + self->info = qsft_detect_transvr_class(self); + if (!self->auto_config) { + return EVENT_TRANSVR_TASK_DONE; + } + err = initfunc_qsfp_handle_power_mode(self); + if (err < 0){ + emsg = "initfunc_qsfp_handle_tx_disable fail!"; + goto err_transvr_init_qsfp; + } + return EVENT_TRANSVR_TASK_DONE; + +err_transvr_init_qsfp: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, emsg, err, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +int +transvr_init_qsfp28(struct transvr_obj_s *self){ + + int tmp_val = EVENT_TRANSVR_EXCEP_EXCEP; + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_msg = "ERR"; + + /* Handle QSFP common */ + err_val = transvr_init_qsfp(self); + if (err_val < 0){ + err_msg = "transvr_init_qsfp fail!"; + goto err_transvr_init_qsfp28_1; + } + /* Disable auto_config */ + if (!self->auto_config) { + return err_val; + } + /* Handle CDR */ + tmp_val = err_val; + err_val = initfunc_qsfp28_handle_cdr(self); + if (err_val < 0){ + err_msg = "Handle CDR fail!"; + goto err_transvr_init_qsfp28_1; + } + tmp_val = (tmp_val > err_val ? tmp_val : err_val); + if (tmp_val > EVENT_TRANSVR_TASK_DONE) { + return tmp_val; + } + return EVENT_TRANSVR_TASK_DONE; + +err_transvr_init_qsfp28_1: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, err_val, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +/* ========== Object Initial handler ========== + */ +static int +_is_transvr_valid(struct transvr_obj_s *self, + int type, + int state) { + /* [Return] + * 0 : OK, inserted + * EVENT_TRANSVR_INIT_DOWN : OK, removed + * EVENT_TRANSVR_INIT_FAIL : Outside error, type doesn't supported + * EVENT_TRANSVR_EXCEP_INIT : Internal error, state undefined + */ + switch (type) { + case TRANSVR_TYPE_SFP: + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + case TRANSVR_TYPE_UNPLUGGED: + case TRANSVR_TYPE_FAKE: + break; + default: + SWPS_INFO("detect undefined type:0x%02x on %s\n", + type, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; + } + switch (state) { + case STATE_TRANSVR_DISCONNECTED: + return EVENT_TRANSVR_INIT_DOWN; + case STATE_TRANSVR_INIT: + case STATE_TRANSVR_CONNECTED: + case STATE_TRANSVR_SWAPPED: + break; + default: + SWPS_INFO("detect undefined state:%d on %s\n", + state, self->swp_name); + return EVENT_TRANSVR_EXCEP_INIT; + } + return 0; +} + + +static int +_is_transvr_hw_ready(struct transvr_obj_s *self, + int type){ + /* [Return] + * EVENT_TRANSVR_TASK_DONE : Ready + * EVENT_TRANSVR_TASK_WAIT : Not ready + * EVENT_TRANSVR_INIT_FAIL : Error + */ + int addr = DEBUG_TRANSVR_INT_VAL; + int page = DEBUG_TRANSVR_INT_VAL; + int offs = DEBUG_TRANSVR_INT_VAL; + int bit = DEBUG_TRANSVR_INT_VAL; + int ready = DEBUG_TRANSVR_INT_VAL; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t ab_val = DEBUG_TRANSVR_HEX_VAL; + + switch (type) { + case TRANSVR_TYPE_SFP: + addr = VAL_TRANSVR_8472_READY_ADDR; + page = VAL_TRANSVR_8472_READY_PAGE; + offs = VAL_TRANSVR_8472_READY_OFFSET; + bit = VAL_TRANSVR_8472_READY_BIT; + ready = VAL_TRANSVR_8472_READY_VALUE; + ab_val = VAL_TRANSVR_8472_READY_ABNORMAL; + break; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + addr = VAL_TRANSVR_8436_READY_ADDR; + page = VAL_TRANSVR_8436_READY_PAGE; + offs = VAL_TRANSVR_8436_READY_OFFSET; + bit = VAL_TRANSVR_8436_READY_BIT; + ready = VAL_TRANSVR_8436_READY_VALUE; + ab_val = VAL_TRANSVR_8436_READY_ABNORMAL; + break; + + case TRANSVR_TYPE_UNPLUGGED: + case TRANSVR_TYPE_FAKE: + return EVENT_TRANSVR_TASK_DONE; + + default: + emsg = "unexpected case"; + goto err_is_transvr_hw_ready; + } + /* Select target page */ + err = _common_setup_page(self, addr, page, offs, 1, 0); + if (err < 0) { + emsg = "setup page fail"; + goto err_is_transvr_hw_ready; + } + /* Check feature supported + * [Note] + * Some of transceiver/cables doesn't support "Status Indicators" + * (ex:DAC, RJ45 copper SFP ...etc). In these case, we bypass the + * step of checking Status Indicators, then state machine will take + * the following handle procedure. + */ + err = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + if (err < 0) { + emsg = "doesn't support Status Indicators"; + goto bypass_is_transvr_hw_ready; + } + /* Filter abnormal case */ + if (err == ab_val) { + emsg = "detect using unusual definition."; + goto bypass_is_transvr_hw_ready; + } + /* Get Status Indicators */ + err = i2c_smbus_read_byte_data(self->i2c_client_p, offs); + if (err < 0) { + emsg = "detect current value fail"; + goto err_is_transvr_hw_ready; + } + if ((err & (1<:%d\n", __func__, emsg, type); + return EVENT_TRANSVR_TASK_DONE; + +err_is_transvr_hw_ready: + SWPS_DEBUG("%s: %s :%d\n", __func__, emsg, type); + return EVENT_TRANSVR_INIT_FAIL; +} + + +static int +_is_transvr_support_ctle(struct transvr_obj_s *self) { + + switch (self->info) { + case TRANSVR_CLASS_OPTICAL_25G: + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return 1; + default: + break; + } + return 0; +} + + +static int +_transvr_init_handler(struct transvr_obj_s *self){ + + int detect[2]; + int d_state = STATE_TRANSVR_UNEXCEPTED; + int d_type = TRANSVR_TYPE_ERROR; + int result = ERR_TRANSVR_UNINIT; + int retry = 6; /* (6+1) x 0.3 = 2.1s > spec:2.0s */ + int elimit = 63; + char emsg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Clean and check callback */ + self->state = STATE_TRANSVR_INIT; + if (self->init == NULL) { + snprintf(emsg, elimit, "init() is null"); + goto initer_err_case_unexcept_0; + } + if (self->clean == NULL) { + snprintf(emsg, elimit, "clean() is null"); + goto initer_err_case_unexcept_0; + } + self->clean(self); + + /* Detect transceiver information */ + result = detect_transvr_state(self, detect); + if (result < 0) { + snprintf(emsg, elimit, "detect_transvr_state() fail"); + switch (result) { + case ERR_TRANSVR_I2C_CRASH: + goto initer_err_case_i2c_ceash; + case ERR_TRNASVR_BE_ISOLATED: + goto initer_err_case_be_isolated; + + case ERR_TRANSVR_UNEXCPT: + default: + break; + } + goto initer_err_case_retry_1; + } + d_state = detect[0]; + d_type = detect[1]; + + /* Verify transceiver type and state */ + switch (_is_transvr_valid(self, d_type, d_state)) { + case 0: + break; + case EVENT_TRANSVR_INIT_DOWN: + goto initer_ok_case_down;; + case EVENT_TRANSVR_INIT_FAIL: + snprintf(emsg, elimit, "transceiver type doesn't support"); + goto initer_err_case_alarm_to_user; + case EVENT_TRANSVR_EXCEP_INIT: + default: + goto initer_err_case_unexcept_1; + } + + /* Handle reload case */ + if (self->type != d_type){ + /* This is the protect mechanism. Normally, This case will not happen. + * When State machine detect swap event during initial, It will trigger + * reload function to ensure type correct. */ + if (_reload_transvr_obj(self, d_type) < 0){ + snprintf(emsg, elimit, "reload object fail"); + goto initer_err_case_unexcept_1; + } + } + + /* Check transceiver HW initial ready */ + switch (_is_transvr_hw_ready(self, d_type)) { + case EVENT_TRANSVR_TASK_DONE: + break; + case EVENT_TRANSVR_TASK_WAIT: + goto initer_err_case_retry_1; + case EVENT_TRANSVR_INIT_FAIL: + default: + goto initer_err_case_unexcept_1; + } + + /* Try to update all and check */ + if (self->update_all(self, 1) < 0){ + /* For some transceiver, EEPROME has lag issues during initial stage. + * In this case, we set status back to STATE_TRANSVR_NEW, than it will + * be checked in next polling cycle. */ + goto initer_err_case_retry_1; + } + + /* Execute init() call back */ + result = self->init(self); + switch (result) { + case EVENT_TRANSVR_TASK_DONE: + break; + case EVENT_TRANSVR_TASK_WAIT: + goto initer_ok_case_wait; + + default: + snprintf(emsg, elimit, "undefined init() return:%d\n", result); + goto initer_err_case_unexcept_1; + } + goto initer_ok_case_up; + + +initer_ok_case_wait: + self->dump_all(self); + return EVENT_TRANSVR_TASK_WAIT; + +initer_ok_case_up: + self->state = STATE_TRANSVR_CONNECTED; + self->temp = 0; + self->dump_all(self); + return EVENT_TRANSVR_INIT_UP; + +initer_ok_case_down: + self->temp = 0; + self->state = STATE_TRANSVR_DISCONNECTED; + return EVENT_TRANSVR_INIT_DOWN; + +initer_err_case_i2c_ceash: + SWPS_DEBUG("%s: %s :%s :I2C crash\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + return EVENT_TRANSVR_I2C_CRASH; + +initer_err_case_be_isolated: + SWPS_DEBUG("%s: %s :%s :isolated\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_ISOLATED; + return EVENT_TRANSVR_EXCEP_ISOLATED; + +initer_err_case_retry_1: + SWPS_DEBUG("%s: %s :%s :retry\n", + __func__, emsg, self->swp_name); + if (_transvr_handle_retry(self, retry) == 0) { + self->state = STATE_TRANSVR_NEW; + return EVENT_TRANSVR_INIT_REINIT; + } + goto initer_err_case_alarm_to_user; + +initer_err_case_unexcept_1: + self->clean(self); +initer_err_case_unexcept_0: + self->state = STATE_TRANSVR_UNEXCEPTED; + if (_is_except_happened_4_pmode(self, d_state) && + (self->mode == TRANSVR_MODE_POLLING) ){ + SWPS_INFO("%s: %s :%s\n", __func__, emsg, self->swp_name); + SWPS_INFO("Dump: :%d :%d :%d :%d\n", + self->state, self->type, d_state, d_type); + } + return EVENT_TRANSVR_INIT_FAIL; + +initer_err_case_alarm_to_user: + SWPS_DEBUG("%s: %s :%s :alarm_to_user\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + alarm_msg_2_user(self, "detected transceiver/cables not meet SFF standard"); + return EVENT_TRANSVR_INIT_FAIL; +} + + +/* ========== Object functions for Clean procedure ========== + */ +int +_transvr_clean_handler(struct transvr_obj_s *self){ + + int retval = DEBUG_TRANSVR_INT_VAL; + + if (!self->clean) { + SWPS_ERR("%s: %s clean() is NULL.\n", + __func__, self->swp_name); + return EVENT_TRANSVR_TASK_FAIL; + } + retval = self->clean(self); + if (retval != EVENT_TRANSVR_TASK_DONE){ + SWPS_ERR("%s: %s clean() fail. [ERR]:%d\n", + __func__, self->swp_name, retval); + return retval; + } + return EVENT_TRANSVR_TASK_DONE; +} + + +int +common_transvr_clean(struct transvr_obj_s *self){ + + transvr_task_free_all(self); + transvr_cache_free_all(self); + return EVENT_TRANSVR_TASK_DONE; +} + + +int +qsfp_transvr_clean(struct transvr_obj_s *self){ + + int retval; + int lpower_config = 1; + + retval = _taskfunc_qsfp_setup_power_mod(self, lpower_config); + if (retval < 0){ + SWPS_ERR("%s: Set lpmod fail! :%d\n", + __func__, retval); + return retval; + } + retval = common_transvr_clean(self); + if (retval < 0){ + SWPS_ERR("%s: common_transvr_clean fail! :%d\n", + __func__, retval); + return retval; + } + return EVENT_TRANSVR_TASK_DONE; +} + + +int +fake_transvr_clean(struct transvr_obj_s *self){ + + return EVENT_TRANSVR_TASK_DONE; +} + + +/* ========== Object functions for check and update ========== + */ +int +common_transvr_check(struct transvr_obj_s *self){ + + char fun_str[32] = "common_transvr_check"; + + if (self->mode != TRANSVR_MODE_POLLING) { + SWPS_ERR("%s: mode:%d is not TRANSVR_MODE_POLLING\n", + fun_str, self->mode); + return ERR_TRANSVR_UNEXCPT; + } + /* Trigger delay task */ + transvr_task_run_all(self); + /* Trigger state machine to check and update */ + return self->fsm_4_polling(self, fun_str); +} + + +int +fake_transvr_check(struct transvr_obj_s *self){ + return 0; +} + + +/* ========== Functions for Factory pattern ========== + */ +static int +setup_transvr_public_cb(struct transvr_obj_s *self, + int transvr_type){ + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + self->get_id = common_get_id; + self->get_ext_id = common_get_ext_id; + self->get_connector = common_get_connector; + self->get_vendor_name = common_get_vendor_name; + self->get_vendor_pn = common_get_vendor_pn; + self->get_vendor_rev = common_get_vendor_rev; + self->get_vendor_sn = common_get_vendor_sn; + self->get_power_cls = unsupported_get_func; + self->get_br = common_get_br; + self->get_len_sm = sfp_get_len_sm; + self->get_len_smf = common_get_len_smf; + self->get_len_om1 = common_get_len_om1; + self->get_len_om2 = common_get_len_om2; + self->get_len_om3 = common_get_len_om3; + self->get_len_om4 = common_get_len_om4; + self->get_comp_rev = common_get_comp_rev; + self->get_comp_eth_1 = sfp_get_comp_eth_1; + self->get_comp_eth_10 = sfp_get_comp_eth_10; + self->get_comp_eth_10_40 = unsupported_get_func; + self->get_comp_extend = common_get_comp_extended; + self->get_cdr = unsupported_get_func; + self->get_rate_id = sfp_get_rate_id; + self->get_soft_rs0 = sfp_get_soft_rs0; + self->get_soft_rs1 = sfp_get_soft_rs1; + self->get_info = common_get_info; + self->get_if_type = sfp_get_if_type; + self->get_if_speed = sfp_get_if_speed; + self->get_if_lane = common_get_if_lane; + self->get_curr_temp = sfp_get_transvr_temp; + self->get_curr_vol = sfp_get_transvr_voltage; + self->get_soft_rx_los = unsupported_get_func2; + self->get_soft_tx_disable = unsupported_get_func2; + self->get_soft_tx_fault = unsupported_get_func2; + self->get_auto_tx_disable = unsupported_get_func2; + self->get_tx_bias = sfp_get_transvr_tx_bias; + self->get_tx_power = sfp_get_transvr_tx_power; + self->get_rx_power = sfp_get_transvr_rx_power; + self->get_tx_eq = sfp_get_transvr_tx_eq; + self->get_rx_am = unsupported_get_func2; + self->get_rx_em = sfp_get_transvr_rx_em; + self->get_wavelength = sfp_get_wavelength; + self->get_extphy_offset = sfp_get_1g_rj45_extphy_offset; + self->get_extphy_reg = sfp_get_1g_rj45_extphy_reg; + self->set_cdr = unsupported_set_func; + self->set_soft_rs0 = sfp_set_soft_rs0; + self->set_soft_rs1 = sfp_set_soft_rs1; + self->set_soft_tx_disable = unsupported_set_func; + self->set_auto_tx_disable = unsupported_set_func; + self->set_tx_eq = sfp_set_tx_eq; + self->set_rx_am = unsupported_set_func; + self->set_rx_em = sfp_set_rx_em; + self->set_extphy_offset = sfp_set_1g_rj45_extphy_offset; + self->set_extphy_reg = sfp_set_1g_rj45_extphy_reg; + return 0; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + self->get_id = common_get_id; + self->get_ext_id = common_get_ext_id; + self->get_connector = common_get_connector; + self->get_vendor_name = common_get_vendor_name; + self->get_vendor_pn = common_get_vendor_pn; + self->get_vendor_rev = common_get_vendor_rev; + self->get_vendor_sn = common_get_vendor_sn; + self->get_power_cls = qsfp_get_power_cls; + self->get_br = common_get_br; + self->get_len_sm = unsupported_get_func; + self->get_len_smf = common_get_len_smf; + self->get_len_om1 = common_get_len_om1; + self->get_len_om2 = common_get_len_om2; + self->get_len_om3 = common_get_len_om3; + self->get_len_om4 = common_get_len_om4; + self->get_comp_rev = common_get_comp_rev; + self->get_comp_eth_1 = qsfp_get_comp_eth; + self->get_comp_eth_10 = unsupported_get_func; + self->get_comp_eth_10_40 = qsfp_get_comp_10_40; + self->get_comp_extend = common_get_comp_extended; + self->get_cdr = unsupported_get_func; + self->get_rate_id = unsupported_get_func; + self->get_soft_rs0 = unsupported_get_func; /* TBD */ + self->get_soft_rs1 = unsupported_get_func; /* TBD */ + self->get_info = common_get_info; + self->get_if_type = qsfp_get_if_type; + self->get_if_speed = qsfp_get_if_speed; + self->get_if_lane = common_get_if_lane; + self->get_curr_temp = qsfp_get_transvr_temp; + self->get_curr_vol = qsfp_get_transvr_voltage; + self->get_soft_rx_los = qsfp_get_soft_rx_los; + self->get_soft_tx_disable = qsfp_get_soft_tx_disable; + self->get_soft_tx_fault = qsfp_get_soft_tx_fault; + self->get_auto_tx_disable = qsfp_get_auto_tx_disable; + self->get_tx_bias = qsfp_get_transvr_tx_bias; + self->get_tx_power = qsfp_get_transvr_tx_power; + self->get_rx_power = qsfp_get_transvr_rx_power; + self->get_tx_eq = unsupported_get_func2; + self->get_rx_am = unsupported_get_func2; + self->get_rx_em = unsupported_get_func2; + self->get_wavelength = qsfp_get_wavelength; + self->get_extphy_offset = unsupported_get_func2; + self->get_extphy_reg = unsupported_get_func2; + self->set_cdr = unsupported_set_func; + self->set_soft_rs0 = unsupported_set_func; /* TBD */ + self->set_soft_rs1 = unsupported_set_func; /* TBD */ + self->set_soft_tx_disable = qsfp_set_soft_tx_disable; + self->set_auto_tx_disable = qsfp_set_auto_tx_disable; + self->set_tx_eq = unsupported_set_func; + self->set_rx_am = unsupported_set_func; + self->set_rx_em = unsupported_set_func; + self->set_extphy_offset = unsupported_set_func; + self->set_extphy_reg = unsupported_set_func; + return 0; + + case TRANSVR_TYPE_QSFP_28: + self->get_id = common_get_id; + self->get_ext_id = common_get_ext_id; + self->get_connector = common_get_connector; + self->get_vendor_name = common_get_vendor_name; + self->get_vendor_pn = common_get_vendor_pn; + self->get_vendor_rev = common_get_vendor_rev; + self->get_vendor_sn = common_get_vendor_sn; + self->get_power_cls = qsfp_get_power_cls; + self->get_br = common_get_br; + self->get_len_sm = unsupported_get_func; + self->get_len_smf = common_get_len_smf; + self->get_len_om1 = common_get_len_om1; + self->get_len_om2 = common_get_len_om2; + self->get_len_om3 = common_get_len_om3; + self->get_len_om4 = common_get_len_om4; + self->get_comp_rev = common_get_comp_rev; + self->get_comp_eth_1 = qsfp_get_comp_eth; + self->get_comp_eth_10 = unsupported_get_func; + self->get_comp_eth_10_40 = qsfp_get_comp_10_40; + self->get_comp_extend = common_get_comp_extended; + self->get_cdr = qsfp_get_cdr; + self->get_rate_id = unsupported_get_func; + self->get_soft_rs0 = unsupported_get_func; /* TBD */ + self->get_soft_rs1 = unsupported_get_func; /* TBD */ + self->get_info = common_get_info; + self->get_if_type = qsfp_get_if_type; + self->get_if_speed = qsfp_get_if_speed; + self->get_if_lane = common_get_if_lane; + self->get_curr_temp = qsfp_get_transvr_temp; + self->get_curr_vol = qsfp_get_transvr_voltage; + self->get_soft_rx_los = qsfp_get_soft_rx_los; + self->get_soft_tx_disable = qsfp_get_soft_tx_disable; + self->get_soft_tx_fault = qsfp_get_soft_tx_fault; + self->get_auto_tx_disable = qsfp_get_auto_tx_disable; + self->get_tx_bias = qsfp_get_transvr_tx_bias; + self->get_tx_power = qsfp_get_transvr_tx_power; + self->get_rx_power = qsfp_get_transvr_rx_power; + self->get_tx_eq = qsfp_get_transvr_tx_eq; + self->get_rx_am = qsfp_get_transvr_rx_am; + self->get_rx_em = qsfp_get_transvr_rx_em; + self->get_wavelength = qsfp_get_wavelength; + self->get_extphy_offset = unsupported_get_func2; + self->get_extphy_reg = unsupported_get_func2; + self->set_cdr = qsfp_set_cdr; + self->set_soft_rs0 = unsupported_set_func; /* TBD */ + self->set_soft_rs1 = unsupported_set_func; /* TBD */ + self->set_soft_tx_disable = qsfp_set_soft_tx_disable; + self->set_auto_tx_disable = qsfp_set_auto_tx_disable; + self->set_tx_eq = qsfp_set_tx_eq; + self->set_rx_am = qsfp_set_rx_am; + self->set_rx_em = qsfp_set_rx_em; + self->set_extphy_offset = unsupported_set_func; + self->set_extphy_reg = unsupported_set_func; + return 0; + + case TRANSVR_TYPE_FAKE: + self->get_id = fake_get_hex; + self->get_ext_id = fake_get_hex; + self->get_connector = fake_get_hex; + self->get_vendor_name = fake_get_str; + self->get_vendor_pn = fake_get_str; + self->get_vendor_rev = fake_get_str; + self->get_vendor_sn = fake_get_str; + self->get_power_cls = fake_get_int; + self->get_br = fake_get_hex; + self->get_len_sm = fake_get_int; + self->get_len_smf = fake_get_int; + self->get_len_om1 = fake_get_int; + self->get_len_om2 = fake_get_int; + self->get_len_om3 = fake_get_int; + self->get_len_om4 = fake_get_int; + self->get_comp_rev = fake_get_hex; + self->get_comp_eth_1 = fake_get_hex; + self->get_comp_eth_10 = fake_get_hex; + self->get_comp_eth_10_40 = fake_get_hex; + self->get_comp_extend = fake_get_hex; + self->get_cdr = fake_get_hex; + self->get_rate_id = fake_get_hex; + self->get_soft_rs0 = fake_get_binary; + self->get_soft_rs1 = fake_get_binary; + self->get_info = fake_get_int; + self->get_if_type = fake_get_str; + self->get_if_speed = fake_get_str; + self->get_if_lane = fake_get_str; + self->get_curr_temp = fake_get_str; + self->get_curr_vol = fake_get_str; + self->get_soft_rx_los = fake_get_str; + self->get_soft_tx_disable = fake_get_str; + self->get_soft_tx_fault = fake_get_str; + self->get_auto_tx_disable = fake_get_str; + self->get_tx_bias = fake_get_str; + self->get_tx_power = fake_get_str; + self->get_rx_power = fake_get_str; + self->get_tx_eq = fake_get_str; + self->get_rx_am = fake_get_str; + self->get_rx_em = fake_get_str; + self->get_wavelength = fake_get_str; + self->get_extphy_offset = fake_get_str; + self->get_extphy_reg = fake_get_str; + self->set_cdr = fake_set_hex; + self->set_soft_rs0 = fake_set_int; + self->set_soft_rs1 = fake_set_int; + self->set_soft_tx_disable = fake_set_int; + self->set_auto_tx_disable = fake_set_int; + self->set_tx_eq = fake_set_int; + self->set_rx_am = fake_set_int; + self->set_rx_em = fake_set_int; + self->set_extphy_offset = fake_set_hex; + self->set_extphy_reg = fake_set_hex; + return 0; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return ERR_TRANSVR_UNEXCPT; +} + + +static int +setup_transvr_private_cb(struct transvr_obj_s *self, + int transvr_type){ + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + self->init = transvr_init_sfp; + self->clean = common_transvr_clean; + self->check = common_transvr_check; + self->update_all = _sfp_update_attr_all; + self->fsm_4_direct = common_fsm_4_direct_mode; + self->fsm_4_polling = common_fsm_4_polling_mode; + self->send_uevent = sfp_send_uevent; + self->dump_all = sfp_transvr_dump; + return 0; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + self->init = transvr_init_qsfp; + self->clean = qsfp_transvr_clean; + self->check = common_transvr_check; + self->update_all = _qsfp_update_attr_all; + self->fsm_4_direct = common_fsm_4_direct_mode; + self->fsm_4_polling = common_fsm_4_polling_mode; + self->send_uevent = qsfp_send_uevent; + self->dump_all = qsfp_transvr_dump; + return 0; + + case TRANSVR_TYPE_QSFP_28: + self->init = transvr_init_qsfp28; + self->clean = qsfp_transvr_clean; + self->check = common_transvr_check; + self->update_all = _qsfp_update_attr_all; + self->fsm_4_direct = common_fsm_4_direct_mode; + self->fsm_4_polling = common_fsm_4_polling_mode; + self->send_uevent = qsfp_send_uevent; + self->dump_all = qsfp_transvr_dump; + return 0; + + case TRANSVR_TYPE_FAKE: + self->init = transvr_init_fake; + self->clean = fake_transvr_clean; + self->check = fake_transvr_check; + self->update_all = fake_transvr_update; + self->fsm_4_direct = fake_fsm_4_direct_mode; + self->fsm_4_polling = fake_fsm_4_polling_mode; + self->send_uevent = fake_send_uevent; + self->dump_all = fake_transvr_dump; + return 0; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return ERR_TRANSVR_UNEXCPT; +} + + +static struct eeprom_map_s * +get_eeprom_map(int transvr_type){ + + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + return &eeprom_map_sfp; + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + return &eeprom_map_qsfp; + case TRANSVR_TYPE_QSFP_28: + return &eeprom_map_qsfp28; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return NULL; +} + + +static int +setup_transvr_ssize_attr(char *swp_name, + struct transvr_obj_s *self, + struct eeprom_map_s *map_p, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int chan_id, + int run_mode){ + switch (run_mode){ + case TRANSVR_MODE_DIRECT: /* Direct access device mode */ + case TRANSVR_MODE_POLLING: /* Polling mode, read from cache */ + self->mode = run_mode; + break; + default: + SWPS_ERR("%s: non-defined run_mode:%d\n", + __func__, run_mode); + self->mode = DEBUG_TRANSVR_INT_VAL; + return -1; + } + self->eeprom_map_p = map_p; + self->ioexp_obj_p = ioexp_obj_p; + self->ioexp_virt_offset = ioexp_virt_offset; + self->chan_id = chan_id; + self->layout = transvr_type; + self->type = transvr_type; + self->chipset_type = chipset_type; + self->state = STATE_TRANSVR_NEW; + self->info = STATE_TRANSVR_NEW; + self->auto_tx_disable = VAL_TRANSVR_FUNCTION_DISABLE; + strncpy(self->swp_name, swp_name, 32); + mutex_init(&self->lock); + return 0; +} + + +static int +setup_transvr_dsize_attr(struct transvr_obj_s *self){ + + char *emsg = DEBUG_TRANSVR_STR_VAL; + + self->vendor_name = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_name){ + emsg = "vendor_name"; + goto err_setup_d_attr; + } + self->vendor_pn = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_pn){ + emsg = "vendor_pn"; + goto err_setup_d_attr; + } + self->vendor_rev = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_rev){ + emsg = "vendor_rev"; + goto err_setup_d_attr; + } + self->vendor_sn = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_sn){ + emsg = "vendor_sn"; + goto err_setup_d_attr; + } + self->worker_p = NULL; + return 0; + +err_setup_d_attr: + SWPS_ERR("%s: %s kzalloc fail!", __func__, emsg); + return ERR_TRANSVR_UNEXCPT; +} + + +static int +setup_i2c_client(struct transvr_obj_s *self){ + + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + adap = i2c_get_adapter(self->chan_id); + if(!adap){ + snprintf(err_msg, sizeof(err_msg), + "can not get adap:%d", self->chan_id); + goto err_setup_i2c_client; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + snprintf(err_msg, sizeof(err_msg), + "can not kzalloc client:%d", self->chan_id); + goto err_setup_i2c_client; + } + client->adapter = adap; + self->i2c_client_p = client; + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + return 0; + +err_setup_i2c_client: + SWPS_ERR("%s: %s\n", __func__, err_msg); + return ERR_TRANSVR_UNEXCPT; +} + + +struct transvr_obj_s * +create_transvr_obj(char *swp_name, + int chan_id, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int run_mode){ + + struct transvr_obj_s *result_p; + struct eeprom_map_s *map_p; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Allocate transceiver object */ + map_p = get_eeprom_map(transvr_type); + if (!map_p){ + snprintf(err_msg, sizeof(err_msg), + "Invalid transvr_type:%d", transvr_type); + goto err_create_transvr_fail; + } + result_p = kzalloc(sizeof(*result_p), GFP_KERNEL); + if (!result_p){ + snprintf(err_msg, sizeof(err_msg), "kzalloc fail"); + goto err_create_transvr_fail; + } + /* Prepare static size attributes */ + if (setup_transvr_ssize_attr(swp_name, + result_p, + map_p, + ioexp_obj_p, + ioexp_virt_offset, + transvr_type, + chipset_type, + chan_id, + run_mode) < 0){ + goto err_create_transvr_sattr_fail; + } + /* Prepare dynamic size attributes */ + if (setup_transvr_dsize_attr(result_p) < 0){ + goto err_create_transvr_dattr_fail; + } + /* Prepare call back functions of object */ + if (setup_transvr_public_cb(result_p, transvr_type) < 0){ + goto err_create_transvr_dattr_fail; + } + /* Prepare call back functions of object */ + if (setup_transvr_private_cb(result_p, transvr_type) < 0){ + goto err_create_transvr_dattr_fail; + } + /* Prepare i2c client object */ + if (setup_i2c_client(result_p) < 0){ + goto err_create_transvr_dattr_fail; + } + return result_p; + +err_create_transvr_dattr_fail: + kfree(result_p->vendor_sn); + kfree(result_p->vendor_rev); + kfree(result_p->vendor_pn); + kfree(result_p->vendor_name); +err_create_transvr_sattr_fail: + kfree(result_p); +err_create_transvr_fail: + SWPS_ERR("%s: %s :%d :%d :%d\n", + __func__, err_msg, chan_id, ioexp_virt_offset, transvr_type); + return NULL; +} + + +static int +_reload_transvr_obj(struct transvr_obj_s *self, + int new_type){ + + struct eeprom_map_s *new_map_p; + struct eeprom_map_s *old_map_p = self->eeprom_map_p; + struct i2c_client *old_i2c_p = self->i2c_client_p; + int old_type = self->type; + + /* Change state to STATE_TRANSVR_INIT */ + self->state = STATE_TRANSVR_INIT; + self->type = new_type; + /* Replace EEPROME map */ + new_map_p = get_eeprom_map(new_type); + if (!new_map_p){ + goto err_private_reload_func_1; + } + self->eeprom_map_p = new_map_p; + /* Reload i2c client */ + if (setup_i2c_client(self) < 0){ + goto err_private_reload_func_2; + } + /* Replace call back functions */ + if (setup_transvr_public_cb(self, new_type) < 0){ + goto err_private_reload_func_3; + } + if (setup_transvr_private_cb(self, new_type) < 0){ + goto err_private_reload_func_3; + } + kfree(old_i2c_p); + return 0; + +err_private_reload_func_3: + SWPS_INFO("%s: init() fail!\n", __func__); + kfree(old_i2c_p); + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = TRANSVR_TYPE_ERROR; + return -2; + +err_private_reload_func_2: + self->eeprom_map_p = old_map_p; + self->i2c_client_p = old_i2c_p; +err_private_reload_func_1: + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = old_type; + SWPS_INFO("%s fail! :0x%02x\n", __func__, new_type); + return -1; +} + + +static int +reload_transvr_obj(struct transvr_obj_s *self, + int new_type){ + + int result_val = ERR_TRANSVR_UNEXCPT; + + /* Reload phase */ + result_val = _reload_transvr_obj(self, new_type); + if (result_val < 0){ + SWPS_INFO("%s: reload phase fail! :%d\n", + __func__, result_val); + return EVENT_TRANSVR_RELOAD_FAIL; + } + /* Initial phase */ + result_val = _transvr_init_handler(self); + if (result_val < 0){ + SWPS_INFO("%s: initial phase fail! :%d\n", + __func__, result_val); + } + return result_val; +} + + +int +isolate_transvr_obj(struct transvr_obj_s *self) { + + self->state = STATE_TRANSVR_ISOLATED; + SWPS_INFO("%s: %s be isolated\n", __func__, self->swp_name); + return 0; +} + + +int +resync_channel_tier_2(struct transvr_obj_s *self) { + + int val = TRANSVR_TYPE_ERROR; + + if (self->state == STATE_TRANSVR_ISOLATED) { + return 0; + } + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + val = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + if (val < 0) { + return -1; + } + return 0; +} + + +/* ----------------------------------------- + * ToDo List + * ----------------------------------------- + * 1. _sfp_detect_class_by_feature() + * => Need check ACC use case. + * 2. _sfp_detect_class_by_1g_ethernet() + * => Need check 0.1G use case. + * 3. Loopback transceiver use case. + * => Less much data + * 4. _qsfp_detect_class_by_extend_comp() + * => Verify 100G CWDM4 + * => Verify Obsolete (assigned before 100G CWDM4 MSA required FEC) + * => Verify 100G CLR4 + * => Verify 100GE-DWDM2 + * => Verify 40G PSM4 Parallel SMF + * => Verify 100G ACC (Active Copper Cable) or 25GAUI C2M ACC. + * => Verify 100G ACC or 25GAUI C2M ACC. + * => Verify 25GBASE-LR + * => Verify 40G Active Cable (XLPPI) + */ + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/transceiver.h b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/transceiver.h new file mode 100644 index 000000000000..42e1938670fb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/modules/transceiver.h @@ -0,0 +1,814 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef TRANSCEIVER_H +#define TRANSCEIVER_H + +#include + +/* advanced features control */ +#define TRANSVR_INFO_DUMP_ENABLE (1) +#define TRANSVR_INFO_CACHE_ENABLE (1) +#define TRANSVR_UEVENT_ENABLE (1) + +/* Transceiver type define */ +#define TRANSVR_TYPE_UNKNOW_1 (0x00) +#define TRANSVR_TYPE_UNKNOW_2 (0xff) +#define TRANSVR_TYPE_SFP (0x03) /* Define for SFP, SFP+, SFP28 */ +#define TRANSVR_TYPE_QSFP (0x0c) +#define TRANSVR_TYPE_QSFP_PLUS (0x0d) +#define TRANSVR_TYPE_QSFP_28 (0x11) +#define TRANSVR_TYPE_UNPLUGGED (0xfa) /* Define for ERROR handle */ +#define TRANSVR_TYPE_FAKE (0xfc) /* Define for ERROR handle */ +#define TRANSVR_TYPE_INCONSISTENT (0xfd) /* Define for ERROR handle */ +#define TRANSVR_TYPE_ERROR (0xfe) /* Define for ERROR handle */ + +/* Transceiver class for base info */ +#define TRANSVR_CLASS_UNSPECIFIED (0) +#define TRANSVR_CLASS_ERROR (-26001) +#define TRANSVR_CLASS_1G (26001) +#define TRANSVR_CLASS_10G (26011) +#define TRANSVR_CLASS_25G (26021) +#define TRANSVR_CLASS_40G (26041) +#define TRANSVR_CLASS_100G (26101) +#define TRANSVR_CLASS_NO_SPERARABLE (26901) +#define TRANSVR_CLASS_EXTEND_COMP (26902) +/* Transceiver class for Optical 1G */ +#define TRANSVR_CLASS_OPTICAL (27000) +#define TRANSVR_CLASS_OPTICAL_100 (27001) +#define TRANSVR_CLASS_OPTICAL_1G (27002) +#define TRANSVR_CLASS_OPTICAL_1G_AOC (27003) +#define TRANSVR_CLASS_OPTICAL_1G_SX (27004) +#define TRANSVR_CLASS_OPTICAL_1G_LX (27005) +#define TRANSVR_CLASS_OPTICAL_1G_EX (27006) +/* Transceiver class for Optical 10G */ +#define TRANSVR_CLASS_OPTICAL_10G (27010) +#define TRANSVR_CLASS_OPTICAL_10G_S_AOC (27011) +#define TRANSVR_CLASS_OPTICAL_10G_S_SR (27012) +#define TRANSVR_CLASS_OPTICAL_10G_S_LR (27013) +#define TRANSVR_CLASS_OPTICAL_10G_S_ER (27014) +#define TRANSVR_CLASS_OPTICAL_10G_Q_AOC (27015) +#define TRANSVR_CLASS_OPTICAL_10G_Q_SR (27016) +#define TRANSVR_CLASS_OPTICAL_10G_Q_LR (27017) +#define TRANSVR_CLASS_OPTICAL_10G_Q_ER (27018) +/* Transceiver class for Optical 25G */ +#define TRANSVR_CLASS_OPTICAL_25G (27020) +#define TRANSVR_CLASS_OPTICAL_25G_AOC (27021) +#define TRANSVR_CLASS_OPTICAL_25G_SR (27022) +#define TRANSVR_CLASS_OPTICAL_25G_LR (27023) +#define TRANSVR_CLASS_OPTICAL_25G_ER (27024) +/* Transceiver class for Optical 40G */ +#define TRANSVR_CLASS_OPTICAL_40G (27040) +#define TRANSVR_CLASS_OPTICAL_40G_AOC (27041) +#define TRANSVR_CLASS_OPTICAL_40G_SR4 (27042) +#define TRANSVR_CLASS_OPTICAL_40G_LR4 (27043) +#define TRANSVR_CLASS_OPTICAL_40G_ER4 (27044) +/* Transceiver class for Optical 100G */ +#define TRANSVR_CLASS_OPTICAL_100G (27100) +#define TRANSVR_CLASS_OPTICAL_100G_AOC (27101) +#define TRANSVR_CLASS_OPTICAL_100G_SR4 (27102) +#define TRANSVR_CLASS_OPTICAL_100G_LR4 (27103) +#define TRANSVR_CLASS_OPTICAL_100G_ER4 (27104) +#define TRANSVR_CLASS_OPTICAL_100G_PSM4 (27105) +/* Transceiver class for Copper */ +#define TRANSVR_CLASS_COPPER (28000) +#define TRANSVR_CLASS_COPPER_L1_1G (28001) +#define TRANSVR_CLASS_COPPER_L1_10G (28011) +#define TRANSVR_CLASS_COPPER_L4_10G (28012) +#define TRANSVR_CLASS_COPPER_L1_25G (28021) +#define TRANSVR_CLASS_COPPER_L4_40G (28041) +#define TRANSVR_CLASS_COPPER_L4_100G (28101) +/* Transceiver class for Base-T */ +#define TRANSVR_CLASS_BASE_T_1000 (29001) +#define TRANSVR_CLASS_BASE_T_1000_up (29002) +/* For uevent message */ +#define TRANSVR_UEVENT_KEY_IF "IF_TYPE" +#define TRANSVR_UEVENT_KEY_SP "IF_SPEED" +#define TRANSVR_UEVENT_KEY_LANE "IF_LANE" +#define TRANSVR_UEVENT_UNKNOW "UNKNOW" +#define TRANSVR_IF_KR "KR" +#define TRANSVR_IF_KR4 "KR4" +#define TRANSVR_IF_SR "SR" +#define TRANSVR_IF_SR4 "SR4" +#define TRANSVR_IF_SFI "SFI" +#define TRANSVR_IF_IF_GMII "GMII" +#define TRANSVR_IF_IF_XGMII "XGMII" +#define TRANSVR_IF_SP_100 "100" +#define TRANSVR_IF_SP_1G "1000" +#define TRANSVR_IF_SP_10G "10000" +#define TRANSVR_IF_SP_25G "25000" +#define TRANSVR_IF_SP_40G "40000" +#define TRANSVR_IF_SP_100G "100000" + +/* Transceiver mode define */ +#define TRANSVR_MODE_DIRECT (21000) +#define TRANSVR_MODE_POLLING (21001) + +/* Transceiver state define + * [Note] + * 1. State is used to represent the state of "Transceiver" and "Object". + * 2. State for different target has different means. The description as following: + */ +#define STATE_TRANSVR_CONNECTED (0) /* [Transvr]:Be plugged in. [Obj]:Link up, and work normally. */ +#define STATE_TRANSVR_NEW (-100) /* [Transvr]:(Not used) [Obj]:Create */ +#define STATE_TRANSVR_INIT (-101) /* [Transvr]:Be plugged in. [Obj]:Link up, and in initial process. */ +#define STATE_TRANSVR_ISOLATED (-102) /* [Transvr]:Be plugged in. [Obj]:Isolate, and not provide service. */ +#define STATE_TRANSVR_SWAPPED (-200) /* [Transvr]:Be plugged in. [Obj]:(Not used) */ +#define STATE_TRANSVR_DISCONNECTED (-300) /* [Transvr]:Un-plugged. [Obj]:Link down, and not provide service. */ +#define STATE_TRANSVR_UNEXCEPTED (-901) /* [Transvr]:Any [Obj]:Any, and not in expect case. */ + +/* Task state define */ +#define STATE_T_TASK_WAIT (110) +#define STATE_T_TASK_DONE (0) +#define STATE_T_TASK_INIT (-110) +#define STATE_T_TASK_FAIL (-410) + + +/* Event for task handling */ +#define EVENT_TRANSVR_TASK_WAIT (2101) +#define EVENT_TRANSVR_TASK_DONE (0) +#define EVENT_TRANSVR_TASK_FAIL (-2101) +/* Event for initial handling */ +#define EVENT_TRANSVR_INIT_UP (2201) +#define EVENT_TRANSVR_INIT_DOWN (1) +#define EVENT_TRANSVR_INIT_REINIT (-2201) +#define EVENT_TRANSVR_INIT_FAIL (-2202) +/* Event for others */ +#define EVENT_TRANSVR_RELOAD_FAIL (-2301) +#define EVENT_TRANSVR_EXCEP_INIT (-2401) +#define EVENT_TRANSVR_EXCEP_UP (-2402) +#define EVENT_TRANSVR_EXCEP_DOWN (-2403) +#define EVENT_TRANSVR_EXCEP_SWAP (-2404) +#define EVENT_TRANSVR_EXCEP_EXCEP (-2405) +#define EVENT_TRANSVR_EXCEP_ISOLATED (-2406) +#define EVENT_TRANSVR_I2C_CRASH (-2501) + +/* Transceiver error code define */ +#define ERR_TRANSVR_UNINIT (-201) +#define ERR_TRANSVR_UNPLUGGED (-202) +#define ERR_TRANSVR_ABNORMAL (-203) +#define ERR_TRANSVR_NOSTATE (-204) +#define ERR_TRANSVR_NOTSUPPORT (-205) +#define ERR_TRANSVR_BADINPUT (-206) +#define ERR_TRANSVR_UPDATE_FAIL (-207) +#define ERR_TRANSVR_RELOAD_FAIL (-208) +#define ERR_TRANSVR_INIT_FAIL (-209) +#define ERR_TRANSVR_UNDEFINED (-210) +#define ERR_TRANSVR_TASK_FAIL (-211) +#define ERR_TRANSVR_TASK_BUSY (-212) +#define ERR_TRANSVR_UEVENT_FAIL (-213) +#define ERR_TRANSVR_FUNC_DISABLE (-214) +#define ERR_TRANSVR_I2C_CRASH (-297) +#define ERR_TRNASVR_BE_ISOLATED (-298) +#define ERR_TRANSVR_UNEXCPT (-299) + +/* For debug */ +#define DEBUG_TRANSVR_INT_VAL (-99) +#define DEBUG_TRANSVR_HEX_VAL (0xfe) +#define DEBUG_TRANSVR_STR_VAL "ERROR" + +/* For system internal */ +#define VAL_TRANSVR_COMID_ARREESS (0x50) +#define VAL_TRANSVR_COMID_OFFSET (0x00) +#define VAL_TRANSVR_EXTPHY_ADDR_56 (0x56) +#define VAL_TRANSVR_8472_READY_ADDR (0x51) +#define VAL_TRANSVR_8472_READY_PAGE (-1) +#define VAL_TRANSVR_8472_READY_OFFSET (110) +#define VAL_TRANSVR_8472_READY_BIT (0) +#define VAL_TRANSVR_8472_READY_VALUE (0) +#define VAL_TRANSVR_8472_READY_ABNORMAL (0xff) +#define VAL_TRANSVR_8436_READY_ADDR (0x50) +#define VAL_TRANSVR_8436_READY_PAGE (-1) +#define VAL_TRANSVR_8436_READY_OFFSET (2) +#define VAL_TRANSVR_8436_READY_BIT (0) +#define VAL_TRANSVR_8436_READY_VALUE (0) +#define VAL_TRANSVR_8436_READY_ABNORMAL (0xff) +#define VAL_TRANSVR_8436_PWD_ADDR (0x50) +#define VAL_TRANSVR_8436_PWD_PAGE (-1) +#define VAL_TRANSVR_8436_PWD_OFFSET (123) +#define VAL_TRANSVR_PAGE_FREE (-99) +#define VAL_TRANSVR_PAGE_SELECT_OFFSET (127) +#define VAL_TRANSVR_PAGE_SELECT_DELAY (5) +#define VAL_TRANSVR_TASK_RETRY_FOREVER (-999) +#define VAL_TRANSVR_FUNCTION_DISABLE (-1) +#define STR_TRANSVR_SFP "SFP" +#define STR_TRANSVR_QSFP "QSFP" +#define STR_TRANSVR_QSFP_PLUS "QSFP+" +#define STR_TRANSVR_QSFP28 "QSFP28" + +/* For transvr buf len */ +#define LEN_TRANSVR_S_STR (16) +#define LEN_TRANSVR_M_STR (32) +#define LEN_TRANSVR_L_STR (64) + +/* Optical wavelength */ +#define VAL_OPTICAL_WAVELENGTH_SR (850) +#define VAL_OPTICAL_WAVELENGTH_LR (1310) +#define VAL_OPTICAL_WAVELENGTH_ER (1550) + +/* BCM chip type define */ +#define BCM_CHIP_TYPE_TRIDENT_2 (31001) /* Magnolia, Hudson32i, Spruce */ +#define BCM_CHIP_TYPE_TOMAHAWK (31002) /* Redwood, Cypress, Sequoia */ + +#define BF_CHIP_TYPE_TOFINO (31011) /* Lavender */ + +/* Info from transceiver EEPROM */ +struct eeprom_map_s { + int addr_br; int page_br; int offset_br; int length_br; + int addr_cdr; int page_cdr; int offset_cdr; int length_cdr; + int addr_comp_rev; int page_comp_rev; int offset_comp_rev; int length_comp_rev; + int addr_connector; int page_connector; int offset_connector; int length_connector; + int addr_diag_type; int page_diag_type; int offset_diag_type; int length_diag_type; + int addr_extbr; int page_extbr; int offset_extbr; int length_extbr; + int addr_ext_id; int page_ext_id; int offset_ext_id; int length_ext_id; + int addr_id; int page_id; int offset_id; int length_id; + int addr_len_sm; int page_len_sm; int offset_len_sm; int length_len_sm; + int addr_len_smf; int page_len_smf; int offset_len_smf; int length_len_smf; + int addr_len_om1; int page_len_om1; int offset_len_om1; int length_len_om1; + int addr_len_om2; int page_len_om2; int offset_len_om2; int length_len_om2; + int addr_len_om3; int page_len_om3; int offset_len_om3; int length_len_om3; + int addr_len_om4; int page_len_om4; int offset_len_om4; int length_len_om4; + int addr_option; int page_option; int offset_option; int length_option; + int addr_rate_id; int page_rate_id; int offset_rate_id; int length_rate_id; + int addr_rx_am; int page_rx_am; int offset_rx_am; int length_rx_am; + int addr_rx_em; int page_rx_em; int offset_rx_em; int length_rx_em; + int addr_rx_los; int page_rx_los; int offset_rx_los; int length_rx_los; + int addr_rx_power; int page_rx_power; int offset_rx_power; int length_rx_power; + int addr_soft_rs0; int page_soft_rs0; int offset_soft_rs0; int length_soft_rs0; + int addr_soft_rs1; int page_soft_rs1; int offset_soft_rs1; int length_soft_rs1; + int addr_temp; int page_temp; int offset_temp; int length_temp; + int addr_trancomp; int page_trancomp; int offset_trancomp; int length_trancomp; + int addr_trancomp_ext; int page_trancomp_ext; int offset_trancomp_ext; int length_trancomp_ext; + int addr_tx_bias; int page_tx_bias; int offset_tx_bias; int length_tx_bias; + int addr_tx_disable; int page_tx_disable; int offset_tx_disable; int length_tx_disable; + int addr_tx_eq; int page_tx_eq; int offset_tx_eq; int length_tx_eq; + int addr_tx_fault; int page_tx_fault; int offset_tx_fault; int length_tx_fault; + int addr_tx_power; int page_tx_power; int offset_tx_power; int length_tx_power; + int addr_vendor_name; int page_vendor_name; int offset_vendor_name; int length_vendor_name; + int addr_vendor_pn; int page_vendor_pn; int offset_vendor_pn; int length_vendor_pn; + int addr_vendor_rev; int page_vendor_rev; int offset_vendor_rev; int length_vendor_rev; + int addr_vendor_sn; int page_vendor_sn; int offset_vendor_sn; int length_vendor_sn; + int addr_voltage; int page_voltage; int offset_voltage; int length_voltage; + int addr_wavelength; int page_wavelength; int offset_wavelength; int length_wavelength; +}; + + +struct transvr_worker_s; + +/* Class of transceiver object */ +struct transvr_obj_s { + + /* ========== Object private property ========== + * [Prop]: id + * [Desc]: Type of serial transceiver. + * [Note]: SFP:03h / QSFP:0Ch / QSPF+:0Dh /QSFP28:11h + */ + uint8_t id; + + /* [Prop]: connector + * [Desc]: Connector type. + * [Note]: SFP : A0h / 2 + * QSFP: 00h / 130 + */ + uint8_t connector; + + /* [Prop]: transvr_comp + * [Desc]: Transceiver compliance code. + * [Note]: SFP: SFF-8472 + * - Normal : A0h / offset 3-10 + * - Extended: A0h / offset 36 + * QSFP: SFF-8436 & SFF-8636 + * - Normal : 00h / offset 131-138 + * - Extended: 00h / offset 192 + */ + uint8_t transvr_comp[8]; + uint8_t transvr_comp_ext; + + /* [Prop]: vendor_name + * [Desc]: SFP vendor name (ASCII 16 byte char). + * [Note]: ex:FINISAR CORP. + */ + char *vendor_name; + + /* [Prop]: vendor_pn + * [Desc]: Part number provided by SFP vendor (ASCII 16 byte char). + * [Note]: + */ + char *vendor_pn; + + /* [Prop]: vendor_rev + * [Desc]: Revision level for part number provided by vendor (ASCII 4 byte char). + * [Note]: + */ + char *vendor_rev; + + /* [Prop]: vendor_sn + * [Desc]: Serial number provided by vendor (ASCII 16 byte char). + * [Note]: + */ + char *vendor_sn; + + /* [Prop]: Extended identifier + * [Desc]: SFP: + * => None + * + * QSFP: + * => This byte contained two information: + * (1) Power consumption class + * (2) CDR function present + * [Note]: Bit description as below: + * [SFP] + * None + * + * [QSFP] + * (1) Power consumption class: + * Class 1: 1.5W (Bit6-7 = 00:) + * Class 2: 2.0W (Bit6-7 = 01:) + * Class 3: 2.5W (Bit6-7 = 10:) + * Class 4: 3.5W (Bit6-7 = 11:) + * Class 5: 4.0W (Bit0-1 = 01:) + * Class 6: 4.5W (Bit0-1 = 10:) + * Class 7: 5.0W (Bit0-1 = 11:) + * (2) CDR function present: + * Bit2: 0 = No CDR in RX + * 1 = CDR present in RX + * Bit3: 0 = No CDR in TX + * 1 = CDR present in TX + */ + uint8_t ext_id; + + /* [Prop]: br + * [Desc]: Nominal bit rate, units of 100 MBits/sec. + * [Note]: SFP:03h / QSFP:0Ch / QSPF+:0Dh + * has val: 0x67 + * no val : + */ + uint8_t br; + + /* [Prop]: extbr + * [Desc]: Extended br (00h/222) + * [Desc]: Nominal bit rate per channel, units of 250 Mbps. + * Complements. Byte 140. See Table 32A. + */ + uint8_t extbr; + + /* [Prop]: len_sm + * [Desc]: Length (single mode)-(100's)m + * [Note]: This value specifies the link length that is supported by the transceiver + * while operating in compliance with the applicable standards using single mode + * fiber. The value is in units of 100 meters. A value of 255 means that the + * transceiver supports a link length greater than 25.4 km. A value of zero means + * that the transceiver does not support single mode fiber or that the length + * information must be determined from the transceiver technology. + */ + int len_sm; + + /* [Prop]: len_smf + * [Desc]: Length (single mode)-km + * [Note]: Addition to EEPROM data from original GBIC definition. This value specifies + * the link length that is supported by the transceiver while operating in + * compliance with the applicable standards using single mode fiber. The value + * is in units of kilometers. A value of 255 means that the transceiver supports + * a link length greater than 254 km. A value of zero means that the transceiver + * does not support single mode fiber or that the length information must be + * determined from the transceiver technology. + */ + int len_smf; + + /* [Prop]: len_om1 + * [Desc]: Link length supported for 62.5 um OM1 fiber, units of 10 m + * [Note]: The value is in units of 10 meters. A value of 255 means that the + * transceiver supports a link length greater than 2.54 km. A value of + * zero means that the transceiver does not support 50 micron multi-mode + * fiber or that the length information must be determined from the transceiver + * technology. + */ + int len_om1; + + /* [Prop]: len_om2 + * [Desc]: Link length supported for 50 um OM2 fiber, units of 10 m + * [Note]: The value is in units of 10 meters. A value of 255 means that the + * transceiver supports a link length greater than 2.54 km. A value of + * zero means that the transceiver does not support 50 micron multi-mode + * fiber or that the length information must be determined from the transceiver + * technology. + */ + int len_om2; + + /* [Prop]: len_om3 + * [Desc]: Length (50um, OM3) + * [Note]: This value specifies link length that is supported by the transceiver while + * operating in compliance with applicable standards using 50 micron multimode + * OM3 [2000 MHz*km] fiber. The value is in units of 10 meters. A value of 255 + * means that the transceiver supports a link length greater than 2.54 km. A value + * of zero means that the transceiver does not support 50 micron multimode fiber + * or that the length information must be determined from the transceiver technology. + */ + int len_om3; + + /* [Prop]: len_om4 + * [Desc]: Length (50um, OM4) and Length (Active Cable or Copper) + * [Note]: For optical links, this value specifies link length that is supported by the + * transceiver while operating in compliance with applicable standards using 50 micron + * multimode OM4 [4700 MHz*km] fiber. The value is in units of 10 meters. A value of + * 255 means that the transceiver supports a link length greater than 2.54 km. A value + * of zero means that the transceiver does not support 50 micron multimode fiber or that + * the length information must be determined from the transceiver codes specified in Table 5-3. + * + * For copper links, this value specifies minimum link length supported by the transceiver + * while operating in compliance with applicable standards using copper cable. For active + * cable, this value represents actual length. The value is in units of 1 meter. A value of 255 + * means the transceiver supports a link length greater than 254 meters. A value of zero means + * the transceiver does not support copper or active cables or the length information must be + * determined from transceiver technology. Further information about cable design, equalization, + * and connectors is usually required to guarantee meeting a particular length requirement. + */ + int len_om4; + + /* [Prop]: comp_rev + * [Desc]: SFF spec revision compliance + * [Note]: Indicates which revision of SFF SFF-8472 (SFP) / SFF-8636 (QSFP) the transceiver + * complies with. (unsigned integer) + */ + uint8_t comp_rev; + + /* [Prop]: CDR + * [Desc]: For transceivers with CDR capability, setting the CDR to ON engages the internal + * retiming function. Setting the CDR to OFF enables an internal bypassing mode ,which + * directs traffic around the internal CDR. (Reference: SFF-8636) + * [Note]: value=0xff: ON. + * value=0x00: OFF. + */ + uint8_t cdr; + + /* [Prop]: rate_id + * [Desc]: Soft Rate Select 0(RX). + * [Note]: 1. Addr: A0h / Offset: 13 + * 2. Value description: + * 00h Unspecified + * 01h SFF-8079 (4/2/1G Rate_Select & AS0/AS1) + * 02h SFF-8431 (8/4/2G Rx Rate_Select only) + * 03h Unspecified * + * 04h SFF-8431 (8/4/2G Tx Rate_Select only) + * 05h Unspecified * + * 06h SFF-8431 (8/4/2G Independent Rx & Tx Rate_select) + * 07h Unspecified * + * 08h FC-PI-5 (16/8/4G Rx Rate_select only) High=16G only, Low=8G/4G + * 09h Unspecified * + * 0Ah FC-PI-5 (16/8/4G Independent Rx, Tx Rate_select) High=16G only, + * Low=8G/4G + * 0Bh Unspecified * + * 0Ch FC-PI-6 (32/16/8G Independent Rx, Tx Rate_Select) + * High=32G only, Low = 16G/8G + * 0Dh Unspecified * + * 0Eh 10/8G Rx and Tx Rate_Select controlling the operation or locking + * modes of the internal signal conditioner, retimer or CDR, according + * to the logic table defined in Table 10-2, High Bit Rate + * (10G) =9.95-11.3 Gb/s; Low Bit Rate (8G) = 8.5 Gb/s. In this mode, + * the default value of bit 110.3 (Soft Rate Select RS(0), Table 9-11) + * and of bit 118.3 (Soft Rate Select RS(1), Table 10-1) is 1. + * 0Fh Unspecified * + * 10h-FFh Unallocated + */ + int rate_id; + + /* [Prop]: soft_rs0 + * [Desc]: Soft Rate Select 0(RX). + * [Note]: 1. Writing '1' selects full bandwidth operation. + * 2. This bit is "OR'd with the hard Rate_Select, AS(0) or RS(0) pin value. + * 3. Default at power up is logic zero/low + * 4. Addr: A2h / Offset: 110 / Bit: 3 + */ + uint8_t soft_rs0; + + /* [Prop]: soft_rs1 + * [Desc]: Soft Rate Select 1(TX). + * [Note]: 1. Writing '1' selects full bandwidth TX operation. + * 2. This bit is "OR'd with the hard Rate_Select, AS(1) or RS(1) pin value. + * 3. Default at power up is logic zero/low + * 4. Addr: A2h / Offset: 118 / Bit: 3 + */ + uint8_t soft_rs1; + + /* [Prop]: diag_type + * [Desc]: DIAGNOSTIC MONITORING TYPE (A0h/92) + * [Note]: Description in SFF-8472 as below: + * Bit7: Reserved for legacy diagnostic implementations. Must be '0' for compliance + * with this document. + * Bit6: Digital diagnostic monitoring implemented (described in this document). + * Must be '1' for compliance with this document. + * Bit5 Internally calibrated + * Bit4 Externally calibrated + * Bit3 Received power measurement type.0 = OMA, 1 = average power + * Bit2 Address change required see section above, "addressing modes" + * Bit1-0 Unallocated + */ + uint8_t diag_type; + + /* [Prop]: curr_temp + * [Desc]: Transceiver Current Temperature (A2h/96-97) + * [Note]: 1. Dependent on diag_type. + * 2. 96: High byte + * 3. 97: Low byte + * 4. This feature only for SFP + */ + uint8_t curr_temp[2]; + + /* [Prop]: curr_vol + * [Desc]: Transceiver Current Voltage (SFP:A2h/108-109; QSFP:00h/22-23) + * [Note]: 1. Dependent on diag_type. + * 2. 98: High byte + * 3. 99: Low byte + * 4. This feature only for SFP + * 5. Internally measured transceiver supply voltage. Represented + * as a 16 bit unsigned integer with the voltage defined as the + * full 16 bit value (0-65535) with LSB equal to 100 uVolt, + * yielding a total range of 0 to +6.55 Volts + */ + uint8_t curr_voltage[2]; + + /* [Prop]: curr_tx_bias + * [Desc]: Transceiver TX Bias Current (SFP:A2h/100-101; QSFP:00h/26-27) + * [Note]: 1. Dependent on diag_type. + * 2. 100: High byte + * 3. 101: Low byte + * 4. This feature only for SFP + * 5. Measured TX bias current in uA. Represented as a 16 bit unsigned + * integer with the current defined as the full 16 bit value (0-65535) + * with LSB equal to 2 uA, yielding a total range of 0 to 131 mA. + * Accuracy is vendor specific but must be better than 10% of the + * manufacturer's nominal value over specified operating temperature + * and voltage. + */ + uint8_t curr_tx_bias[8]; + + /* [Prop]: curr_tx_power + * [Desc]: Transceiver TX Output Power (A2h/102-103) + * [Note]: 1. Dependent on diag_type. + * 2. 102: High byte + * 3. 103: Low byte + * 4. This feature only for SFP + * 5. Measured TX output power in mW. Represented as a 16 bit unsigned + * integer with the power defined as the full 16 bit value (0-65535) + * with LSB equal to 0.1 uW, yielding a total range of 0 to 6.5535 mW + * (~ -40 to +8.2 dBm). Data is assumed to be based on measurement of + * laser monitor photodiode current. It is factory calibrated to absolute + * units using the most representative fiber output type. Accuracy is + * vendor specific but must be better than 3dB over specified temperature + * and voltage. Data is not valid when the transmitter is disabled. + */ + uint8_t curr_tx_power[8]; + + /* [Prop]: curr_tx_power + * [Desc]: Transceiver TX Output Power (A2h/102-103) + * [Note]: 1. Dependent on diag_type. + * 2. 102: High byte + * 3. 103: Low byte + * 4. This feature only for SFP + * 5. Measured RX received optical power in mW. Value can represent either + * average received power or OMA depending upon how bit 3 of byte 92 (A0h) + * is set. Represented as a 16 bit unsigned integer with the power defined + * as the full 16 bit value (0-65535) with LSB equal to 0.1 uW, yielding a + * total range of 0 to 6.5535 mW (~ -40 to +8.2 dBm). Absolute accuracy is + * dependent upon the exact optical wavelength. For the vendor specified + * wavelength, accuracy shall be better than 3dB over specified temperature + * and voltage. + */ + uint8_t curr_rx_power[8]; + + /* [Prop]: wavelength + * [Desc]: Wavelength or Copper Cable Attenuation + * [Note]: (Following is info from SFF-8636) + * For optical free side devices, this parameter identifies the nominal + * transmitter output wavelength at room temperature. This parameter is a + * 16-bit hex value with Byte 186 as high order byte and Byte 187 as low + * order byte. The laser wavelength is equal to the 16-bit integer value + * divided by 20 in nm (units of 0.05 nm). This resolution should be adequate + * to cover all relevant wavelengths yet provide enough resolution for all + * expected DWDM applications. For accurate representation of controlled + * wavelength applications, this value should represent the center of the + * guaranteed wavelength range. If the free side device is identified as + * copper cable these registers will be used to define the cable attenuation. + * An indication of 0 dB attenuation refers to the case where the attenuation + * is not known or is unavailable. + * Byte 186 (00-FFh) is the copper cable attenuation at 2.5 GHz in units of 1 dB. + * Byte 187 (00-FFh) is the copper cable attenuation at 5.0 GHz in units of 1 dB. + */ + uint8_t wavelength[2]; + + /* [Prop]: Amplitude control + * [Desc]: Amplitude control + * [Note]: QSFP28 => SFF-8636 03H Byte-238/239 + */ + uint8_t rx_am[2]; + + /* [Prop]: Emphasis control + * [Desc]: Emphasis control + * [Note]: SFP+/28 => SFF-8472 A2H Byte-115 + * QSFP28 => SFF-8636 03H Byte-236/237 + */ + uint8_t rx_em[2]; + + /* [Prop]: Soft Rx LOS + * [Desc]: Soft Rx LOS which provide by transceiver + * [Note]: (Following is info from SFF-8636) + * Byte 3: + * - Bit 0: L-Rx1 LOS + * - Bit 1: L-Rx2 LOS + * - Bit 2: L-Rx3 LOS + * - Bit 3: L-Rx4 LOS + */ + uint8_t rx_los; + + /* [Prop]: Soft Tx Disable + * [Desc]: Soft Tx Disable which provide by transceiver + * [Note]: (Following is info from SFF-8636) + * Byte 86: + * - Bit 0: Tx1 Disable + * - Bit 1: Tx2 Disable + * - Bit 2: Tx3 Disable + * - Bit 3: Tx4 Disable + */ + uint8_t tx_disable; + + /* [Prop]: Soft Tx Fault + * [Desc]: Soft Tx Fault which provide by transceiver + * [Note]: (Following is info from SFF-8636) + * Byte 86: + * - Bit 0: Tx1 Fault + * - Bit 1: Tx2 Fault + * - Bit 2: Tx3 Fault + * - Bit 3: Tx4 Fault + */ + uint8_t tx_fault; + + /* [Prop]: Transceiver EQUALIZATION + * [Desc]: Transceiver EQUALIZATION + * [Note]: SFP+/28 => SFF-8472 A2H Byte-114 + * QSFP28 => SFF-8636 03H Byte-234/235 + */ + uint8_t tx_eq[2]; + + /* [Prop]: OPTION VALUES + * [Desc]: The bits in the option field shall specify the options implemented in the transceiver. + * [Note]: SFP+/28 => SFF-8472 A0H Byte-64/65 + * QSFP+/28 => SFF-8636 00H Byte-193/195 + */ + uint8_t option[3]; + + /* [Prop]: External PHY offset + * [Desc]: It needs to be setup first if you want to access transceiver external phy. + * [Note]: This feature dependent on transceiver. + * Currently, only 1G-RJ45 transceiver supported it. + */ + uint8_t extphy_offset; + + /* ========== Object private property ========== + */ + struct device *transvr_dev_p; + struct eeprom_map_s *eeprom_map_p; + struct i2c_client *i2c_client_p; + struct ioexp_obj_s *ioexp_obj_p; + struct transvr_worker_s *worker_p; + struct mutex lock; + char swp_name[32]; + int auto_config; + int auto_tx_disable; + int chan_id; + int chipset_type; + int curr_page; + int info; + int ioexp_virt_offset; + int lane_id[8]; + int layout; + int mode; + int retry; + int state; + int temp; + int type; + + /* ========== Object public functions ========== + */ + int (*get_id)(struct transvr_obj_s *self); + int (*get_ext_id)(struct transvr_obj_s *self); + int (*get_connector)(struct transvr_obj_s *self); + int (*get_vendor_name)(struct transvr_obj_s *self, char *buf_p); + int (*get_vendor_pn)(struct transvr_obj_s *self, char *buf_p); + int (*get_vendor_rev)(struct transvr_obj_s *self, char *buf_p); + int (*get_vendor_sn)(struct transvr_obj_s *self, char *buf_p); + int (*get_power_cls)(struct transvr_obj_s *self); + int (*get_br)(struct transvr_obj_s *self); + int (*get_len_sm)(struct transvr_obj_s *self); + int (*get_len_smf)(struct transvr_obj_s *self); + int (*get_len_om1)(struct transvr_obj_s *self); + int (*get_len_om2)(struct transvr_obj_s *self); + int (*get_len_om3)(struct transvr_obj_s *self); + int (*get_len_om4)(struct transvr_obj_s *self); + int (*get_comp_rev)(struct transvr_obj_s *self); + int (*get_comp_eth_1)(struct transvr_obj_s *self); + int (*get_comp_eth_10)(struct transvr_obj_s *self); + int (*get_comp_eth_10_40)(struct transvr_obj_s *self); + int (*get_comp_extend)(struct transvr_obj_s *self); + int (*get_cdr)(struct transvr_obj_s *self); + int (*get_rate_id)(struct transvr_obj_s *self); + int (*get_soft_rs0)(struct transvr_obj_s *self); + int (*get_soft_rs1)(struct transvr_obj_s *self); + int (*get_info)(struct transvr_obj_s *self); + int (*get_if_type)(struct transvr_obj_s *self, char *buf_p); + int (*get_if_speed)(struct transvr_obj_s *self, char *buf_p); + int (*get_if_lane)(struct transvr_obj_s *self, char *buf_p); + int (*get_curr_temp)(struct transvr_obj_s *self, char *buf_p); + int (*get_curr_vol)(struct transvr_obj_s *self, char *buf_p); + int (*get_soft_rx_los)(struct transvr_obj_s *self, char *buf_p); + int (*get_soft_tx_disable)(struct transvr_obj_s *self, char *buf_p); + int (*get_soft_tx_fault)(struct transvr_obj_s *self, char *buf_p); + int (*get_auto_tx_disable)(struct transvr_obj_s *self, char *buf_p); + int (*get_tx_bias)(struct transvr_obj_s *self, char *buf_p); + int (*get_tx_power)(struct transvr_obj_s *self, char *buf_p); + int (*get_rx_power)(struct transvr_obj_s *self, char *buf_p); + int (*get_tx_eq)(struct transvr_obj_s *self, char *buf_p); + int (*get_rx_am)(struct transvr_obj_s *self, char *buf_p); + int (*get_rx_em)(struct transvr_obj_s *self, char *buf_p); + int (*get_wavelength)(struct transvr_obj_s *self, char *buf_p); + int (*get_extphy_offset)(struct transvr_obj_s *self, char *buf_p); + int (*get_extphy_reg)(struct transvr_obj_s *self, char *buf_p); + int (*set_cdr)(struct transvr_obj_s *self, int input_val); + int (*set_soft_rs0)(struct transvr_obj_s *self, int input_val); + int (*set_soft_rs1)(struct transvr_obj_s *self, int input_val); + int (*set_soft_tx_disable)(struct transvr_obj_s *self, int input_val); + int (*set_auto_tx_disable)(struct transvr_obj_s *self, int input_val); + int (*set_tx_eq)(struct transvr_obj_s *self, int input_val); + int (*set_rx_am)(struct transvr_obj_s *self, int input_val); + int (*set_rx_em)(struct transvr_obj_s *self, int input_val); + int (*set_extphy_offset)(struct transvr_obj_s *self, int input_val); + int (*set_extphy_reg)(struct transvr_obj_s *self, int input_val); + + /* ========== Object private functions ========== + */ + int (*init)(struct transvr_obj_s *self); + int (*clean)(struct transvr_obj_s *self); + int (*check)(struct transvr_obj_s *self); + int (*update_all)(struct transvr_obj_s *self, int show_err); + int (*fsm_4_direct)(struct transvr_obj_s* self, char *caller_name); + int (*fsm_4_polling)(struct transvr_obj_s* self, char *caller_name); + int (*send_uevent)(struct transvr_obj_s* self, enum kobject_action u_action); + int (*dump_all)(struct transvr_obj_s* self); +}; + + +/* For AVL Mapping */ +struct transvr_avl_s { + char vendor_name[32]; + char vendor_pn[32]; + int (*init)(struct transvr_obj_s *self); +}; + + +/* Worker for long term task of transceiver */ +struct transvr_worker_s { + /* Task Parameter */ + struct transvr_obj_s *transvr_p; + struct transvr_worker_s *next_p; + struct transvr_worker_s *pre_p; + unsigned long trigger_time; + char func_name[64]; + int retry; + int state; + + /* Task private data */ + void *p_data; + + /* Call back function */ + int (*main_task)(struct transvr_worker_s *task); + int (*post_task)(struct transvr_worker_s *task); +}; + + +struct transvr_obj_s * +create_transvr_obj(char *swp_name, + int chan_id, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int run_mode); + +void lock_transvr_obj(struct transvr_obj_s *self); +void unlock_transvr_obj(struct transvr_obj_s *self); +int isolate_transvr_obj(struct transvr_obj_s *self); + +int resync_channel_tier_2(struct transvr_obj_s *self); + +void alarm_msg_2_user(struct transvr_obj_s *self, char *emsg); + +#endif /* TRANSCEIVER_H */ + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6254qs/utils/inventec_d6254_util.py b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/utils/inventec_d6254_util.py new file mode 100644 index 000000000000..31cf736dafb4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6254qs/utils/inventec_d6254_util.py @@ -0,0 +1,239 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Inventec, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +DEBUG = False +args = [] +FORCE = 0 +i2c_prefix = '/sys/bus/i2c/devices/' + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + install() + elif arg == 'clean': + uninstall() + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print "[D6254]"+txt + return + +def exec_cmd(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + show_log (cmd +"with result:" + str(status)) + show_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +instantiate =[ +#'echo pca9548 0x71> /sys/bus/i2c/devices/i2c-0/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-2/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-3/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-4/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-5/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-6/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-7/new_device', +#'echo pca9548 0x72> /sys/bus/i2c/devices/i2c-0/i2c-8/new_device', +'echo inv_eeprom 0x53 > /sys/bus/i2c/devices/i2c-0/new_device'] +#'echo inv_psoc 0x66> /sys/bus/i2c/devices/i2c-0/new_device', +#'echo inv_cpld 0x55> /sys/bus/i2c/devices/i2c-0/new_device'] + +drivers =[ +'gpio_ich', +'lpc_ich', +'i2c-i801', +'i2c-mux', +'i2c-mux-pca954x', +'i2c-dev', +'inv_eeprom', +'inv_platform', +'inv_psoc', +'inv_cpld', +'swps', +'inv_pthread'] + + + +def system_install(): + global FORCE + + #remove default drivers to avoid modprobe order conflicts + status, output = exec_cmd("rmmod i2c_ismt ", 1) + status, output = exec_cmd("rmmod i2c-i801 ", 1) + #install drivers + for i in range(0,len(drivers)): + status, output = exec_cmd("modprobe "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + + #instantiate devices + for i in range(0,len(instantiate)): + #time.sleep(1) + status, output = exec_cmd(instantiate[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(10,18): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-2/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(18,26): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-3/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(26,34): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-4/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(34,42): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-5/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(42,50): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-6/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(50,58): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-7/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(58,64): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-0/i2c-8/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + + +def system_ready(): + if not device_found(): + return False + return True + +def install(): + if not device_found(): + print "No device, installing...." + status = system_install() + if status: + if FORCE == 0: + return status + else: + print " D6254 devices detected...." + return + +def uninstall(): + global FORCE + #uninstall drivers + for i in range(len(drivers)-1,-1,-1): + status, output = exec_cmd("rmmod "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_found(): + ret1, log = exec_cmd("ls "+i2c_prefix+"*0072", 0) + ret2, log = exec_cmd("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/Makefile b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/Makefile new file mode 100644 index 000000000000..c13abd37e129 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/Makefile @@ -0,0 +1,6 @@ +obj-m += inv_cpld.o inv_psoc.o +obj-m += inv_platform.o +obj-m += inv_eeprom.o +obj-m += swps.o +obj-m += inv_pthread.o +swps-objs := inv_swps.o inv_mux.o io_expander.o transceiver.o diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_cpld.c b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_cpld.c new file mode 100644 index 000000000000..5ee4b26cdab9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_cpld.c @@ -0,0 +1,526 @@ +/* + * 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 "I2CHostCommunication.h" + +#define USE_SMBUS 1 + +/* definition */ +#define CPLD_INFO_OFFSET 0x00 +#define CPLD_PSU_OFFSET 0x08 +#define CPLD_LED_OFFSET 0x0E +#define CPLD_LED_STATU_OFFSET 0x0D +#define CPLD_CTL_OFFSET 0x0C +#define CPLD_BIOSCS_OFFSET 0x04 +#define CPLD_PSUFANLED_OFFSET 0x75 + +/* Each client has this additional data */ +struct cpld_data { + struct device *hwmon_dev; + struct mutex update_lock; +}; + +/*-----------------------------------------------------------------------*/ + +static ssize_t cpld_i2c_read(struct i2c_client *client, u8 *buf, u8 offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg[0].buf = msgbuf; + msg[0].len = 1; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + status = i2c_transfer(client->adapter, msg, 2); + + if(status == 2) + status = count; + + return status; +#endif +} + +static ssize_t cpld_i2c_write(struct i2c_client *client, char *buf, unsigned offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + return status; +#endif +} + +/*-----------------------------------------------------------------------*/ + +/* sysfs attributes for hwmon */ + +static ssize_t show_info(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[4]; + + memset(b, 0, 4); + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, b, CPLD_INFO_OFFSET, 4); + mutex_unlock(&data->update_lock); + + if(status != 4) return sprintf(buf, "read cpld info fail\n"); + + status = sprintf (buf, "The CPLD release date is %02d/%02d/%d.\n", b[2] & 0xf, (b[3] & 0x1f), 2014+(b[2] >> 4)); /* mm/dd/yyyy*/ + status = sprintf (buf, "%sThe PCB version is %X%X\n", buf, b[0]>>4, b[0]&0xf); + status = sprintf (buf, "%sThe CPLD version is %d.%d\n", buf, b[1]>>4, b[1]&0xf); + + return strlen(buf); +} + + +static ssize_t show_ctl(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[1]; + + mutex_lock(&data->update_lock); + + status = cpld_i2c_read(client, b, CPLD_CTL_OFFSET, 1); + + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld ctl fail\n"); + + + status = sprintf (buf, "0x%X\n", b[0]); + + return strlen(buf); +} + +static ssize_t set_ctl(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + + u8 temp = simple_strtol(buf, NULL, 10); + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_CTL_OFFSET, 1); + if(temp) byte |= (1<<0); + else byte &= ~(1<<0); + cpld_i2c_write(client, &byte, CPLD_CTL_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_bios_cs(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 b[1]; + + mutex_lock(&data->update_lock); + + status = cpld_i2c_read(client, b, CPLD_BIOSCS_OFFSET, 1); + + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld BIOS_CS fail\n"); + + + status = sprintf (buf, "0x%X\n", b[0] & 0x01); + + return strlen(buf); +} + +static ssize_t set_bios_cs(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + + u8 temp = simple_strtol(buf, NULL, 10); + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_BIOSCS_OFFSET, 1); + if(temp) byte |= 0x01; + else byte &= ~(0x01); + cpld_i2c_write(client, &byte, CPLD_BIOSCS_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + + +static char* led_str[] = { + "OFF", //000 + "0.5 Hz", //001 + "1 Hz", //010 + "2 Hz", //011 + "4 Hz", //100 + "NA", //101 + "NA", //110 + "ON", //111 +}; + +static ssize_t show_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 0)?3:0; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_LED_OFFSET, 1); + mutex_unlock(&data->update_lock); + + if(status != 1) return sprintf(buf, "read cpld offset 0x%x\n", CPLD_LED_OFFSET); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d: %s\n", byte, led_str[byte]); + + return strlen(buf); +} + +static ssize_t set_led(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + + u8 temp = simple_strtol(buf, NULL, 16); + u8 byte; + int shift = (attr->index == 0)?3:0; + + temp &= 0x7; + //validate temp value: 0,1,2,3,7, TBD + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_LED_OFFSET, 1); + byte &= ~(0x7<update_lock); + + return count; +} + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu0 | psu1 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 1)?0:3; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_PSU_OFFSET, 1); + mutex_unlock(&data->update_lock); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + +static char* status_psufan_str[] = { + "OFF", //00 + "ON", //01 + "1 Hz", //10 + "2 Hz", //11 +}; + +static ssize_t show_psufan_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 red_status, grn_status, byte; + int shift = (attr->index == 0)?0:2; + + mutex_lock(&data->update_lock); + status = cpld_i2c_read(client, &byte, CPLD_PSUFANLED_OFFSET, 1); + mutex_unlock(&data->update_lock); + + byte = (byte>>shift) & 0x33; + grn_status = byte >> 4; + red_status = byte & 0x03; + + return sprintf (buf, "0x%02x: Green %s , Red %s\n", byte, status_psufan_str[grn_status],status_psufan_str[red_status]); +} + +static ssize_t set_psufan_led(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + int shift = (attr->index == 0)?0:2; + int mask = (attr->index == 0)?0xcc:0x33; + u8 temp = simple_strtol(buf, NULL, 16) & 0x33; + u8 byte = 0; + + mutex_lock(&data->update_lock); + cpld_i2c_read(client, &byte, CPLD_PSUFANLED_OFFSET, 1); + byte &= mask; + byte |= (temp<update_lock); + + return count; +} + + +static SENSOR_DEVICE_ATTR(info, S_IRUGO, show_info, 0, 0); +static SENSOR_DEVICE_ATTR(ctl, S_IWUSR|S_IRUGO, show_ctl, set_ctl, 0); + +static SENSOR_DEVICE_ATTR(grn_led, S_IWUSR|S_IRUGO, show_led, set_led, 0); +static SENSOR_DEVICE_ATTR(red_led, S_IWUSR|S_IRUGO, show_led, set_led, 1); + +static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu, 0, 0); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu, 0, 1); + +static SENSOR_DEVICE_ATTR(fan_led, S_IWUSR|S_IRUGO, show_psufan_led, set_psufan_led, 0); +static SENSOR_DEVICE_ATTR(psu_led, S_IWUSR|S_IRUGO, show_psufan_led, set_psufan_led, 1); + +static SENSOR_DEVICE_ATTR(bios_cs, S_IWUSR|S_IRUGO, show_bios_cs, set_bios_cs, 0); + +static struct attribute *cpld_attributes[] = { + //info + &sensor_dev_attr_info.dev_attr.attr, + &sensor_dev_attr_ctl.dev_attr.attr, + + &sensor_dev_attr_grn_led.dev_attr.attr, + &sensor_dev_attr_red_led.dev_attr.attr, + + &sensor_dev_attr_psu0.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + + &sensor_dev_attr_fan_led.dev_attr.attr, + &sensor_dev_attr_psu_led.dev_attr.attr, + + &sensor_dev_attr_bios_cs.dev_attr.attr, + + NULL +}; + +static const struct attribute_group cpld_group = { + .attrs = cpld_attributes, +}; + +static struct attribute *cpld2_attributes[] = { + //info + &sensor_dev_attr_info.dev_attr.attr, + + NULL +}; + +static const struct attribute_group cpld2_group = { + .attrs = cpld2_attributes, +}; + + +/*-----------------------------------------------------------------------*/ + +/* device probe and removal */ + +static int +cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct cpld_data *data; + int status; + +// printk("+%s \n", __func__); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + return -EIO; + + data = kzalloc(sizeof(struct cpld_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* Register sysfs hooks */ + if(id->driver_data==1) // CPLD2 + status = sysfs_create_group(&client->dev.kobj, &cpld2_group); + else // default CPLD1 + status = sysfs_create_group(&client->dev.kobj, &cpld_group); + + if (status) + goto exit_free; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &cpld_group); +exit_free: + i2c_set_clientdata(client, NULL); + kfree(data); + return status; +} + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cpld_group); + i2c_set_clientdata(client, NULL); + kfree(data); + return 0; +} + +static const struct i2c_device_id cpld_ids[] = { + { "inv_cpld" , 0, }, + { "inv_cpld2", 1, }, + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, cpld_ids); + +static struct i2c_driver cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "inv_cpld", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_ids, +}; + +/*-----------------------------------------------------------------------*/ + +/* module glue */ + +static int __init inv_cpld_init(void) +{ + return i2c_add_driver(&cpld_driver); +} + +static void __exit inv_cpld_exit(void) +{ + i2c_del_driver(&cpld_driver); +} + +MODULE_AUTHOR("eddie.lan "); +MODULE_DESCRIPTION("inv cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_cpld_init); +module_exit(inv_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_eeprom.c b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_eeprom.c new file mode 100644 index 000000000000..7bb167d2e74e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_eeprom.c @@ -0,0 +1,181 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + + +/* Size of EEPROM in bytes */ +#define EEPROM_SIZE 256 + +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +/* Each client has this additional data */ +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + + +static void inv_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, ((u8)addr >> 8) & 0xFF, (u8)addr & 0xFF); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } + +exit: + mutex_unlock(&data->update_lock); +} + +static ssize_t inv_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); + struct eeprom_data *data = i2c_get_clientdata(client); + u8 slice; + + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + inv_eeprom_update_client(client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +static struct bin_attribute inv_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = inv_eeprom_read, +}; + +static int inv_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct eeprom_data *data; + int err; + + if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit; + } + + memset(data->data, 0xff, EEPROM_SIZE); + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + /* create the sysfs eeprom file */ + err = sysfs_create_bin_file(&client->dev.kobj, &inv_eeprom_attr); + if (err) { + goto exit_kfree; + } + + return 0; + +exit_kfree: + kfree(data); +exit: + return err; +} + +static int inv_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_bin_file(&client->dev.kobj, &inv_eeprom_attr); + kfree(i2c_get_clientdata(client)); + + return 0; +} + +static const struct i2c_device_id inv_eeprom_id[] = { + { "inv_eeprom", 0 }, + { } +}; + +static struct i2c_driver inv_eeprom_driver = { + .driver = { + .name = "inv_eeprom", + }, + .probe = inv_eeprom_probe, + .remove = inv_eeprom_remove, + .id_table = inv_eeprom_id, +}; + +module_i2c_driver(inv_eeprom_driver); + +MODULE_AUTHOR("Inventec"); +MODULE_DESCRIPTION("Inventec D6556 Mother Board EEPROM driver"); +MODULE_LICENSE("GPL"); + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_mux.c b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_mux.c new file mode 100644 index 000000000000..a303527bec46 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_mux.c @@ -0,0 +1,281 @@ +/* + * 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 "io_expander.h" +#include "inv_mux.h" + +static struct mux_obj_s *mux_head_p = NULL; + + +/* ========== MUX object functions ========== + */ +int +_common_force_pull_gpio(int mem_addr, + int input, + int bit_offset){ + + unsigned int val = 0; + unsigned int targ = 0; + + /* Get current value */ + val = inl(mem_addr); + if (val == 0) { + SWPS_ERR("%s: inl:%d fail!\n", __func__, val); + return -1; + } + /* Count target value */ + switch (input) { + case 0: /* Pull Low */ + targ = (val & (~(1 << bit_offset))); + break; + case 1: /* Pull high */ + targ = (val | (1 << bit_offset)); + break; + default: + SWPS_ERR("%s: input state:%d incorrect!\n", + __func__, input); + return -1; + } + /* Setup gpio */ + outl(targ, mem_addr); + if (targ != inl(mem_addr)){ + SWPS_ERR("%s: outl:%d fail!\n", __func__, targ); + return -1; + } + SWPS_DEBUG("%s: done.\n", __func__); + return 0; +} + + +int +rangeley_force_pull_high(struct mux_obj_s *self){ + SWPS_ERR("%s: not ready!\n", __func__); + return -1; +} + + +int +rangeley_force_pull_low(struct mux_obj_s *self){ + SWPS_ERR("%s: not ready!\n", __func__); + return -1; +} + + +int +hedera_force_pull_high(struct mux_obj_s *self){ + return _common_force_pull_gpio(MUX_RST_MEM_ADDR_HEDERA, 1, 5); +} + + +int +hedera_force_pull_low(struct mux_obj_s *self){ + return _common_force_pull_gpio(MUX_RST_MEM_ADDR_HEDERA, 0, 5); +} + + +int +normal_gpio_pull_high(struct mux_obj_s *self){ + return gpio_direction_output(self->gpio_num, 1); +} + + +int +normal_gpio_pull_low(struct mux_obj_s *self){ + return gpio_direction_output(self->gpio_num, 0); +} + + +int +pca9548_reset_mux_all(struct mux_obj_s *self){ + /* [Note] Power-on reset (PCA9548A-NXP) + * When power is applied to VDD, an internal Power-On Reset (POR) + * holds the PCA9548A in a reset condition until VDD has reached + * VPOR. At this point, the reset condition is released and the + * PCA9548A register and I2C-bus state machine are initialized to + * their default states (all zeroes) causing all the channels to + * be deselected. Thereafter, VDD must be lowered below 0.2 V for + * at least 5 us in order to reset the device. + */ + if (self->_pull_low(self) < 0) { + SWPS_ERR("%s: _pull_low fail!\n", __func__); + return -1; + } + mdelay(MUX_RST_WAIT_MS); + if (self->_pull_high(self) < 0) { + SWPS_ERR("%s: _pull_high fail!\n", __func__); + return -1; + } + mdelay(MUX_RST_WAIT_MS); + return 0; +} + + +int +common_reset_mux_all(struct mux_obj_s *self){ + SWPS_ERR("%s: not ready!\n", __func__); + return -1; +} + + +int +init_gpio_4_force(struct mux_obj_s *self){ + return 0; +} + + +int +init_gpio_4_normal(struct mux_obj_s *self){ + + int err = 0; + + if (!gpio_is_valid(self->gpio_num)) { + SWPS_ERR("%s: GIPO:%d isn't valid\n", __func__, self->gpio_num); + return -1; + } + err = gpio_request(self->gpio_num, MUX_GPIO_LABEL); + if (err < 0) { + SWPS_ERR("%s: gpio_request fail :%d :%d\n", + __func__, err, self->gpio_num); + return -1; + } + SWPS_DEBUG("%s: gpio_request:%d ok.\n", __func__, self->gpio_num); + return 0; +} + + +static int +_setup_muxctl_cb(struct mux_obj_s *self, + unsigned gpio){ + + char mod_dsc[32] = "ERR"; + + switch (gpio) { + case MUX_RST_GPIO_FORCE_RANGELEY: + self->gpio_num = gpio; + self->_pull_low = rangeley_force_pull_low; + self->_pull_high = rangeley_force_pull_high; + self->_init = init_gpio_4_force; + self->reset = pca9548_reset_mux_all; + memset(mod_dsc, 0, 32); + snprintf(mod_dsc, 31, "Rangeley force mode"); + goto ok_setup_muxctl_cb; + + case MUX_RST_GPIO_FORCE_HEDERA: + self->gpio_num = gpio; + self->_pull_low = hedera_force_pull_low; + self->_pull_high = hedera_force_pull_high; + self->_init = init_gpio_4_force; + self->reset = pca9548_reset_mux_all; + memset(mod_dsc, 0, 32); + snprintf(mod_dsc, 31, "Hedera force mode"); + goto ok_setup_muxctl_cb; + + case MUX_RST_GPIO_48_PAC9548: + case MUX_RST_GPIO_69_PAC9548: + case MUX_RST_GPIO_249_PCA9548: + case MUX_RST_GPIO_500_PAC9548: + case MUX_RST_GPIO_505_PCA9548: + self->gpio_num = gpio; + self->_pull_low = normal_gpio_pull_low; + self->_pull_high = normal_gpio_pull_high; + self->_init = init_gpio_4_normal; + self->reset = pca9548_reset_mux_all; + memset(mod_dsc, 0, 32); + snprintf(mod_dsc, 31, "Normal mode :%d", (int)gpio); + goto ok_setup_muxctl_cb; + + default: + break; + } + SWPS_ERR("%s: Unexpected GPIO:%d\n", __func__, gpio); + return -1; + +ok_setup_muxctl_cb: + SWPS_INFO("muxctl: %s.\n", mod_dsc); + return 0; +} + + +/* ========== MUX public functions ========== + */ +void +clean_mux_gpio(void){ + + if (!mux_head_p) { + SWPS_DEBUG("%s: mux_head_p is NULL\n", __func__); + return; + } + if (gpio_is_valid(mux_head_p->gpio_num)) { + gpio_free(mux_head_p->gpio_num); + } + kfree(mux_head_p); + mux_head_p = NULL; + SWPS_DEBUG("%s: done.\n", __func__); +} + + +int +reset_mux_gpio(void){ + + if (!mux_head_p) { + SWPS_ERR("%s: MUX ctl object doesn't exist!\n", __func__); + return -1; + } + if (mux_head_p->reset(mux_head_p) < 0){ + SWPS_ERR("%s: reset fail!\n", __func__); + return -1; + } + return 0; +} + + +int +init_mux_gpio(unsigned gpio){ + + /* Create MUX control object */ + if (mux_head_p) { + SWPS_DEBUG("%s: mux_head_p is not NULL!\n", __func__); + clean_mux_gpio(); + } + /* Currently, it is using single muxctl architecture. + * In the future, it may use the multi-muxctl if HW add new features. + * (Ex: Port power-status control) + */ + mux_head_p = kzalloc(sizeof(struct mux_obj_s), GFP_KERNEL); + if (!mux_head_p) { + SWPS_ERR("%s: kzalloc fail!\n", __func__); + return -1; + } + /* Initial MUX controller */ + if (_setup_muxctl_cb(mux_head_p, gpio) < 0){ + SWPS_ERR("%s: _setup_muxctl_cb fail!\n", __func__); + return -1; + } + if (mux_head_p->_init(mux_head_p) < 0) { + SWPS_ERR("%s: init() fail\n", __func__); + goto err_init_mux_gpio; + } + /* Setup default value */ + if (mux_head_p->_pull_high(mux_head_p) < 0) { + SWPS_ERR("%s: setup default fail!\n", __func__); + goto err_init_mux_gpio; + } + return 0; + +err_init_mux_gpio: + clean_mux_gpio(); + return -1; +} + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_mux.h b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_mux.h new file mode 100644 index 000000000000..f981a304644a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_mux.h @@ -0,0 +1,47 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef INV_MUX_H +#define INV_MUX_H + + +/* MUX basic information */ +#define MUX_GPIO_LABEL "SWPS_RST_MUX" + +/* MUX reset GPIO define */ +#define MUX_RST_GPIO_FORCE (30100) +#define MUX_RST_GPIO_FORCE_RANGELEY (30101) +#define MUX_RST_GPIO_FORCE_HEDERA (30102) +#define MUX_RST_GPIO_48_PAC9548 (48) +#define MUX_RST_GPIO_69_PAC9548 (69) +#define MUX_RST_GPIO_249_PCA9548 (249) +#define MUX_RST_GPIO_500_PAC9548 (500) +#define MUX_RST_GPIO_505_PCA9548 (505) + +/* MUX relate value define */ +#define MUX_RST_WAIT_MS (1) +#define MUX_RST_MEM_ADDR_RANGELEY (0) // TBD +#define MUX_RST_MEM_ADDR_HEDERA (0x548) + +struct mux_obj_s { + unsigned gpio_num; + int (*_pull_high)(struct mux_obj_s *self); + int (*_pull_low)(struct mux_obj_s *self); + int (*_init)(struct mux_obj_s *self); + int (*reset)(struct mux_obj_s *self); +}; + + +void clean_mux_gpio(void); +int reset_mux_gpio(void); +int init_mux_gpio(unsigned gpio); + + +#endif /* INV_MUX_H */ + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_platform.c b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_platform.c new file mode 100644 index 000000000000..26bd47300dab --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_platform.c @@ -0,0 +1,215 @@ +/* + * 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 inv_i2c_board_info { + int ch; + int size; + struct i2c_board_info *board_info; +}; + +#define bus_id(id) (id) +static struct pca954x_platform_mode mux_modes_0[] = { + {.adap_id = bus_id(2),}, {.adap_id = bus_id(3),}, + {.adap_id = bus_id(4),}, {.adap_id = bus_id(5),}, + {.adap_id = bus_id(6),}, {.adap_id = bus_id(7),}, + {.adap_id = bus_id(8),}, {.adap_id = bus_id(9),}, +}; +static struct pca954x_platform_mode mux_modes_0_0[] = { + {.adap_id = bus_id(10),}, {.adap_id = bus_id(11),}, + {.adap_id = bus_id(12),}, {.adap_id = bus_id(13),}, + {.adap_id = bus_id(14),}, {.adap_id = bus_id(15),}, + {.adap_id = bus_id(16),}, {.adap_id = bus_id(17),}, +}; + +static struct pca954x_platform_mode mux_modes_0_1[] = { + {.adap_id = bus_id(18),}, {.adap_id = bus_id(19),}, + {.adap_id = bus_id(20),}, {.adap_id = bus_id(21),}, + {.adap_id = bus_id(22),}, {.adap_id = bus_id(23),}, + {.adap_id = bus_id(24),}, {.adap_id = bus_id(25),}, +}; + +static struct pca954x_platform_mode mux_modes_0_2[] = { + {.adap_id = bus_id(26),}, {.adap_id = bus_id(27),}, + {.adap_id = bus_id(28),}, {.adap_id = bus_id(29),}, + {.adap_id = bus_id(30),}, {.adap_id = bus_id(31),}, + {.adap_id = bus_id(32),}, {.adap_id = bus_id(33),}, +}; + +static struct pca954x_platform_mode mux_modes_0_3[] = { + {.adap_id = bus_id(34),}, {.adap_id = bus_id(35),}, + {.adap_id = bus_id(36),}, {.adap_id = bus_id(37),}, + {.adap_id = bus_id(38),}, {.adap_id = bus_id(39),}, + {.adap_id = bus_id(40),}, {.adap_id = bus_id(41),}, +}; + +static struct pca954x_platform_mode mux_modes_0_4[] = { + {.adap_id = bus_id(42),}, {.adap_id = bus_id(43),}, + {.adap_id = bus_id(44),}, {.adap_id = bus_id(45),}, + {.adap_id = bus_id(46),}, {.adap_id = bus_id(47),}, + {.adap_id = bus_id(48),}, {.adap_id = bus_id(49),}, +}; + +static struct pca954x_platform_mode mux_modes_0_5[] = { + {.adap_id = bus_id(50),}, {.adap_id = bus_id(51),}, + {.adap_id = bus_id(52),}, {.adap_id = bus_id(53),}, + {.adap_id = bus_id(54),}, {.adap_id = bus_id(55),}, + {.adap_id = bus_id(56),}, {.adap_id = bus_id(57),}, +}; + +static struct pca954x_platform_mode mux_modes_0_6[] = { + {.adap_id = bus_id(58),}, {.adap_id = bus_id(59),}, + {.adap_id = bus_id(60),}, {.adap_id = bus_id(61),}, + {.adap_id = bus_id(62),}, {.adap_id = bus_id(63),}, + {.adap_id = bus_id(64),}, {.adap_id = bus_id(65),}, +}; + +//no i2c device driver attach to mux 7 + + +static struct pca954x_platform_data mux_data_0 = { + .modes = mux_modes_0, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_0 = { + .modes = mux_modes_0_0, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_1 = { + .modes = mux_modes_0_1, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_2 = { + .modes = mux_modes_0_2, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_3 = { + .modes = mux_modes_0_3, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_4 = { + .modes = mux_modes_0_4, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_5 = { + .modes = mux_modes_0_5, + .num_modes = 8, +}; +static struct pca954x_platform_data mux_data_0_6 = { + .modes = mux_modes_0_6, + .num_modes = 8, +}; + +static struct i2c_board_info i2c_device_info0[] __initdata = { + {"pca9548", 0, 0x70, &mux_data_0, 0, 0}, +}; + +static struct i2c_board_info i2c_device_info2[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_0, 0, 0}, +}; +static struct i2c_board_info i2c_device_info3[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_1, 0, 0}, +}; +static struct i2c_board_info i2c_device_info4[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_2, 0, 0}, +}; +static struct i2c_board_info i2c_device_info5[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_3, 0, 0}, +}; +static struct i2c_board_info i2c_device_info6[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_4, 0, 0}, +}; +static struct i2c_board_info i2c_device_info7[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_5, 0, 0}, +}; +static struct i2c_board_info i2c_device_info8[] __initdata = { + {"pca9548", 0, 0x72, &mux_data_0_6, 0, 0}, +}; + + +static struct inv_i2c_board_info i2cdev_list[] = { + {bus_id(1), ARRAY_SIZE(i2c_device_info0), i2c_device_info0 }, //mux root + + {bus_id(2), ARRAY_SIZE(i2c_device_info2), i2c_device_info2 }, //mux 0 + {bus_id(3), ARRAY_SIZE(i2c_device_info3), i2c_device_info3 }, //mux 1 + {bus_id(4), ARRAY_SIZE(i2c_device_info4), i2c_device_info4 }, //mux 2 + {bus_id(5), ARRAY_SIZE(i2c_device_info5), i2c_device_info5 }, //mux 3 + {bus_id(6), ARRAY_SIZE(i2c_device_info6), i2c_device_info6 }, //mux 4 + {bus_id(7), ARRAY_SIZE(i2c_device_info7), i2c_device_info7 }, //mux 5 + {bus_id(8), ARRAY_SIZE(i2c_device_info8), i2c_device_info8 }, //mux 6 +}; + +///////////////////////////////////////////////////////////////////////////////////////// +static struct i2c_gpio_platform_data i2c_gpio_platdata0 = { + .scl_pin = 238, + .sda_pin = 255, + + .udelay = 5, //5:100kHz + .sda_is_open_drain = 0, + .scl_is_open_drain = 0, + .scl_is_output_only = 0 +}; + +static struct platform_device device_i2c_gpio0 = { + .name = "i2c-gpio", + .id = 1, // adapter number + .dev.platform_data = &i2c_gpio_platdata0, +}; + +static int __init inv_platform_init(void) +{ + struct i2c_adapter *adap = NULL; + struct i2c_client *e = NULL; + int ret = 0; + int i,j,k; + + //use i2c-gpio + //register i2c gpio + //config gpio58,75 to gpio function 58=32+3*8+2 75=32*2+8*1+3 gpio69=32*2+8*0+5 + outl( inl(0x533) | (1<<2), 0x533); + outl( inl(0x541) | (1<<3), 0x541); + outl( inl(0x540) | (1<<5), 0x540); //RST_I2C_MUX_N (GPIO69) + outl( inl(0x500) | (1<<7), 0x500); //SYS_RDY_N (GPIO7) + outl( inl(0x501) | (1<<7), 0x501); //BMC_HEART_BEAT (GPIO15) + outl( inl(0x503) | (1<<2)|(1<<3), 0x503); //PSOC_HEART_BEAT(26),CPLD_HEART_BEAT(27) + + + ret = platform_device_register(&device_i2c_gpio0); + if (ret) { + printk(KERN_ERR "i2c-gpio: device_i2c_gpio0 register fail %d\n", ret); + } + mdelay(500); //wait for device_i2c_gpio register successfully + + for(i=0; i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define SWITCH_TEMPERATURE_SOCK "/proc/switch/temp" +#define PSOC_POLLING_PERIOD 1000 + +#include +#include +#include +#include + +#define IPMI_MAX_INTF (4) +#define NETFN_OEM 0x30 +#define CMD_GETDATA 0x31 +#define CMD_SETDATA 0x32 +#define FAN_NUM 4 +#define PSU_NUM 2 + +#define FAN_CLEI_SUPPORT 1 +#define PSU_CLEI_SUPPORT 0 + +#define PSU1 0x5800 +#define PSU2 0x5900 +#define BMC_PMBusNumber 3 +#define PMBus_Vendor 0x99 +#define PMBus_Serial 0x9E +#define PMBus_Temp2 0x8E +#define PMBus_Version 0x9B +#define MaxLeng_Result 0x40 + +#define BMC_FanCLEIBusNumber 9 +#define DEVICE_CLEI_ADDR 0x52,0x53,0x54,0x55,0x56,0x50,0x51 + +#define MAX_IPMI_RECV_LENGTH 0xff +static char CLEI_ADDR[]={DEVICE_CLEI_ADDR}; +struct task_struct *kthread_auto_update; +static long pmbus_reg2data_linear(int data, int linear16); +struct ipmi_result{ + char result[MAX_IPMI_RECV_LENGTH]; + int result_length; +}; + +DEFINE_MUTEX(ipmi_mutex); +DEFINE_MUTEX(ipmi2_mutex); +static struct ipmi_result ipmiresult; +static struct device *hwmon_dev; +static struct kobject *device_kobj; +static ipmi_user_t ipmi_mh_user = NULL; +static void msg_handler(struct ipmi_recv_msg *msg,void* handler_data); +static struct ipmi_user_hndl ipmi_hndlrs = { .ipmi_recv_hndl = msg_handler,}; + +static atomic_t dummy_count = ATOMIC_INIT(0); +static void dummy_smi_free(struct ipmi_smi_msg *msg) +{ + atomic_dec(&dummy_count); +} +static void dummy_recv_free(struct ipmi_recv_msg *msg) +{ + atomic_dec(&dummy_count); +} +static struct ipmi_smi_msg halt_smi_msg = { + .done = dummy_smi_free +}; +static struct ipmi_recv_msg halt_recv_msg = { + .done = dummy_recv_free +}; + +struct __attribute__ ((__packed__)) psoc_psu_layout { + u16 psu1_iin; + u16 psu2_iin; + u16 psu1_iout; + u16 psu2_iout; + + u16 psu1_pin; + u16 psu2_pin; + u16 psu1_pout; + u16 psu2_pout; + + u16 psu1_vin; + u16 psu2_vin; + u16 psu1_vout; + u16 psu2_vout; +}; + +struct __attribute__ ((__packed__)) clei { + u8 issue_number[3]; + u8 abbreviation_number[9]; + u8 fc_number[10]; + u8 clei_code[10]; + u8 product_year_and_month[5]; + u8 label_location_code[2]; + u8 serial_number[5]; + u8 pcb_revision[5]; + u8 vendor_name[10]; + u8 reserved[5]; +}; + +struct __attribute__ ((__packed__)) psoc_layout { + u8 ctl; //offset: 0 + u16 switch_temp; //offset: 1 + + // BYTE[03:20] - voltage + u16 voltage[15]; //offset: 0x03-0x20 + + // BYTE[21:27] - ExtFan + u8 led_ctl2; //offset: 21 + u8 ext_pwm; //offset: 22 + u16 ext_rpm[2]; //offset: 23 + u8 gpi_fan2; //offset: 27 + + //gpo + u8 led_ctl; //offset: 28 + + u8 gpio; //offset: 29 + + //pwm duty + u8 pwm[4]; //offset: 2a + u8 pwm_psu[2]; //offset: 2e + + //fan rpm + u16 fan[4*2]; //offset: 30 + + u8 reserve1[4]; //offset: 40 + + //gpi + u8 gpi_fan; //offset: 44 + + //psu state + u8 psu_state; //offset: 45 + + //temperature + u16 temp[5]; //offset: 46 + u16 temp_psu[2]; //offset: 50 + + //version + u8 version[2]; //offset: 54 + + u8 reserve2[4]; //offset: 56 + struct psoc_psu_layout psu_info; //offset: 5a +}; + +/* definition */ +#define PSOC_OFF(m) offsetof(struct psoc_layout, m) +#define PSOC_PSU_OFF(m) offsetof(struct psoc_psu_layout, m) + +#define SWITCH_TMP_OFFSET PSOC_OFF(switch_temp) +#define PWM_OFFSET PSOC_OFF(pwm) +#define THERMAL_OFFSET PSOC_OFF(temp) +#define RPM_OFFSET PSOC_OFF(fan) +#define DIAG_FLAG_OFFSET PSOC_OFF(ctl) +#define FAN_LED_OFFSET PSOC_OFF(led_ctl) +#define FAN_GPI_OFFSET PSOC_OFF(gpi_fan) +#define PSOC_PSU_OFFSET PSOC_OFF(psu_state) +#define VERSION_OFFSET PSOC_OFF(version) +#define PSU_INFO_OFFSET PSOC_OFF(psu_info) + +#define PWM2_OFFSET PSOC_OFF(ext_pwm) +#define RPM2_OFFSET PSOC_OFF(ext_rpm) +#define FAN_LED2_OFFSET PSOC_OFF(led_ctl2) +#define FAN_GPI2_OFFSET PSOC_OFF(gpi_fan2) + +#define CLEI_OFF(m) offsetof(struct clei, m) +#define FAN1_CLEI_INDEX 0 +#define FAN2_CLEI_INDEX 1 +#define FAN3_CLEI_INDEX 2 +#define FAN4_CLEI_INDEX 3 +#define FAN5_CLEI_INDEX 4 +#define PSU1_CLEI_INDEX 5 +#define PSU2_CLEI_INDEX 6 + +static void msg_handler(struct ipmi_recv_msg *recv_msg,void* handler_data) +{ + struct ipmi_result *msg_result = recv_msg->user_msg_data; + + if(recv_msg->msg.data[0]==0 && recv_msg->msg.data_len>0) { + msg_result->result_length=recv_msg->msg.data_len-1; + memcpy(msg_result->result, &recv_msg->msg.data[1], recv_msg->msg.data_len-1); + } + ipmi_free_recv_msg(recv_msg); + mutex_unlock(&ipmi_mutex); + + return; +} + +int start_ipmi_command(char NetFn, char cmd,char *data,int data_length, char* result, int* result_length) +{ + int rv=0,i; + int timeout; + + //wait previous command finish at least 50msec + timeout=50; + while((mutex_is_locked(&ipmi_mutex) == 1 || (mutex_is_locked(&ipmi2_mutex) == 1)) && (--timeout)>0) { usleep_range(1000,1010); } + if(timeout==0) { return -1; } + mutex_lock(&ipmi_mutex); + mutex_lock(&ipmi2_mutex); + + if(ipmi_mh_user == NULL) { + for (i=0,rv=1; i0) { usleep_range(1000,1100);} + if(timeout==0) { + mutex_unlock(&ipmi2_mutex); + return -1; + } + else { + *result_length=ipmiresult.result_length; + memcpy(result,ipmiresult.result,*result_length); + mutex_unlock(&ipmi2_mutex); + return 0; + } + } + return 0; +} +EXPORT_SYMBOL(start_ipmi_command); + +static ssize_t psoc_ipmi_read(u8 *buf, u8 offset, size_t count) +{ + uint8_t data[2]; + int result_len=0; + int rv; + + data[0] = offset; + data[1] = count; + + rv=start_ipmi_command(NETFN_OEM, CMD_GETDATA,data,2, buf, &result_len); + + return result_len; +} + +static ssize_t psoc_ipmi_write(char *buf, unsigned offset, size_t count) +{ + uint8_t data[count+1],result[1]; + int result_len; + + data[0] = offset; + memcpy(&data[1],buf,count); + + start_ipmi_command(NETFN_OEM, CMD_SETDATA,data,count+1, result, &result_len); + return count; +} + + +static u16 psoc_read16(u8 offset) +{ + u16 value = 0; + u8 buf[]={0,0}; + + if(psoc_ipmi_read(buf, offset, 2) == 2) + value = (buf[0]<<8 | buf[1]<<0); + + return value; +} + +static u8 psoc_read8(u8 offset) +{ + u8 value = 0; + u8 buf = 0; + + if(psoc_ipmi_read(&buf, offset, 1) == 1) + value = buf; + + return value; +} + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu1 | psu0 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu_st(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 byte=0; + int shift = (attr->index == 0)?3:0; + + status = psoc_ipmi_read(&byte, PSOC_PSU_OFFSET, 1); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + +static ssize_t show_ipmi_pmbus(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + uint8_t data[4],result[MaxLeng_Result]; + int result_len=0; + + data[0] = BMC_PMBusNumber; + data[1] = (attr->index & 0xFF00 ) >>7; + data[3] = attr->index & 0xff; + if(data[3]==PMBus_Temp2) + {data[2]=2;} + else + {data[2]=MaxLeng_Result;} + + if(start_ipmi_command(0x06, 0x52,data,4, result, &result_len)==0) + { + if(data[3]==PMBus_Temp2) + { + return sprintf(buf, "%ld \n", pmbus_reg2data_linear(result[0] | (result[1]<<8), 0 )); + } + result[result[0]+1]='\0'; + return sprintf(buf, "%s\n",&result[1] ); + } + else + { + return 0; + } +} + +static ssize_t show_clei(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 device_index = attr->index & 0xFF; + + uint8_t data[5],result[MaxLeng_Result]; + int result_len=0; + + data[0] = (device_index<=FAN5_CLEI_INDEX) ? BMC_FanCLEIBusNumber:BMC_PMBusNumber; + data[1] = CLEI_ADDR[device_index]<<1; + data[2] = sizeof(struct clei); + data[3] = (device_index<=FAN5_CLEI_INDEX) ? 0x00 : 0x01; //PSU CLEI will start from 0x0100 + data[4] = 0; + + if(start_ipmi_command(0x06, 0x52,data,5, result, &result_len)==0) + { + if(result_len < sizeof(struct clei)) memset(result, 0, sizeof(struct clei)); + sprintf (buf, "Issue Number: %.3s\n", &result[CLEI_OFF(issue_number)]); + sprintf (buf, "%sAbbreviation Number: %.9s\n", buf, &result[CLEI_OFF(abbreviation_number)]); + sprintf (buf, "%sFC Number: %.10s\n", buf, &result[CLEI_OFF(fc_number)]); + sprintf (buf, "%sCLEI Code: %.10s\n", buf, &result[CLEI_OFF(clei_code)]); + sprintf (buf, "%sProduct Year and Month: %.5s\n", buf, &result[CLEI_OFF(product_year_and_month)]); + sprintf (buf, "%s2D Label Location Code: %.2s\n", buf, &result[CLEI_OFF(label_location_code)]); + sprintf (buf, "%sSerial Number: %.5s\n", buf, &result[CLEI_OFF(serial_number)]); + sprintf (buf, "%sPCB Revision: %.5s\n", buf, &result[CLEI_OFF(pcb_revision)]); + sprintf (buf, "%sVendor Name: %.10s\n", buf, &result[CLEI_OFF(vendor_name)]); + return strlen(buf); + } + else + { + return sprintf(buf, "NONE\n"); + } +} + +static ssize_t show_thermal(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index * 2 + THERMAL_OFFSET; + + status = psoc_read16(offset); + + return sprintf(buf, "%d\n", + (s8)(status>>8) * 1000 ); +} + +static ssize_t show_pwm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index; + + status = psoc_read8(offset); + + return sprintf(buf, "%d\n", + status); +} + +static ssize_t set_pwm(struct device *dev, + struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index; + u8 pwm = simple_strtol(buf, NULL, 10); + if(pwm > 255) pwm = 255; + psoc_ipmi_write(&pwm, offset, 1); + + return count; +} + + +static ssize_t show_rpm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index; + status = psoc_read16(offset); + + return sprintf(buf, "%d\n", + status); +} + +static ssize_t show_switch_tmp(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status=0; + u16 temp = 0; + + status = psoc_ipmi_read((u8*)&temp, SWITCH_TMP_OFFSET, 2); + + status = sprintf (buf, "%d\n", (s8)(temp>>8) * 1000 ); + + return strlen(buf); +} + +static ssize_t set_switch_tmp(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + long temp = simple_strtol(buf, NULL, 10); + u16 temp2 = ( (temp/1000) <<8 ) & 0xFF00 ; + + psoc_ipmi_write((u8*)&temp2, SWITCH_TMP_OFFSET, 2); + + + return count; +} + +static ssize_t show_diag(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status=0; + u8 diag_flag = 0; + + status = psoc_ipmi_read((u8*)&diag_flag, DIAG_FLAG_OFFSET, 1); + + status = sprintf (buf, "%d\n", ((diag_flag & 0x80)?1:0)); + + return strlen(buf); +} + +static ssize_t set_diag(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + u8 value = 0; + u8 diag = simple_strtol(buf, NULL, 10); + + diag = diag?1:0; + + psoc_ipmi_read((u8*)&value, DIAG_FLAG_OFFSET, 1); + if(diag) value |= (1<<7); + else value &= ~(1<<7); + psoc_ipmi_write((u8*)&value, DIAG_FLAG_OFFSET, 1); + + return count; +} + +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status=0; + + status = psoc_read16(VERSION_OFFSET); + + return sprintf(buf, "ver: %x.%x\n", (status & 0xFF00)>>8, (status & 0xFF) ); +} + + +static ssize_t show_fan_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 bit = attr->index; + + if(bit < 8) { status = psoc_read8(FAN_LED_OFFSET); } +#if FAN_NUM>4 + if(bit >= 8) { status = psoc_read8(FAN_LED2_OFFSET); bit-=8; } +#endif + + return sprintf(buf, "%d\n", + (status & (1<index; + u8 led_state = 0; + + u8 v = simple_strtol(buf, NULL, 10); + + if(attr->index < 8) { led_state = psoc_read8(FAN_LED_OFFSET ); } +#if FAN_NUM>4 + if(attr->index >= 8) { led_state = psoc_read8(FAN_LED2_OFFSET); bit-=8; } +#endif + if(v) led_state |= (1<index < 8) { psoc_ipmi_write(&led_state, FAN_LED_OFFSET, 1);} +#if FAN_NUM>4 + if(attr->index >= 8) { psoc_ipmi_write(&led_state, FAN_LED2_OFFSET,1);} +#endif + return count; +} + +static ssize_t show_value8(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index; + + status = psoc_read8(offset); + + return sprintf(buf, "0x%02X\n", status ); +} + +static long pmbus_reg2data_linear(int data, int linear16) +{ + s16 exponent; + s32 mantissa; + long val; + + if (linear16) { /* LINEAR16 */ + exponent = -9; + mantissa = (u16) data; + } else { /* LINEAR11 */ + exponent = ((s16)data) >> 11; + exponent = ((s16)( data & 0xF800) ) >> 11; + mantissa = ((s32)((data & 0x7ff) << 5)) >> 5; + } + + //printk("data=%d, m=%d, e=%d\n", data, exponent, mantissa); + val = mantissa; + + /* scale result to micro-units for power sensors */ + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val; +} + +static ssize_t show_psu_psoc(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status=0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 offset = attr->index + PSU_INFO_OFFSET; + + status = psoc_read16(offset); + + if((strstr(attr->dev_attr.attr.name, "vout")!=NULL)|(strstr(attr->dev_attr.attr.name, "in3")!=NULL)|(strstr(attr->dev_attr.attr.name, "in4")!=NULL)) { + offset=1; + } + else { + offset=0; + } + + return sprintf(buf, "%ld \n", pmbus_reg2data_linear(status, offset )); +} + +static ssize_t show_name(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + return sprintf(buf, "inv_psoc\n"); +} + +static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_thermal, 0, 0); +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_thermal, 0, 1); +static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_thermal, 0, 2); +static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_thermal, 0, 3); +static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_thermal, 0, 4); +static SENSOR_DEVICE_ATTR(thermal_psu1, S_IRUGO, show_thermal, 0, 5); +static SENSOR_DEVICE_ATTR(thermal_psu2, S_IRUGO, show_thermal, 0, 6); +static SENSOR_DEVICE_ATTR(temp7_input, S_IRUGO, show_thermal, 0, 5); +static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, show_thermal, 0, 6); + +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 0 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 1 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 2 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 3 + PWM_OFFSET); +#if FAN_NUM > 4 +static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 0 + PWM2_OFFSET); +#endif +static SENSOR_DEVICE_ATTR(pwm_psu1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 4 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm_psu2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 5 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm6, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 4 + PWM_OFFSET); +static SENSOR_DEVICE_ATTR(pwm7, S_IWUSR|S_IRUGO, show_pwm, set_pwm, 5 + PWM_OFFSET); + +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu_st, 0, 0); +static SENSOR_DEVICE_ATTR(psu2, S_IRUGO, show_psu_st, 0, 1); + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_rpm, 0, 0*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_rpm, 0, 1*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_rpm, 0, 2*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_rpm, 0, 3*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_rpm, 0, 4*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_rpm, 0, 5*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_rpm, 0, 6*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_rpm, 0, 7*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan11_input, S_IRUGO, show_rpm, 0, 8*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan12_input, S_IRUGO, show_rpm, 0, 9*2 + RPM_OFFSET); + +#if FAN_NUM > 4 +static SENSOR_DEVICE_ATTR(fan9_input , S_IRUGO, show_rpm, 0,0*2 + RPM2_OFFSET); +static SENSOR_DEVICE_ATTR(fan10_input, S_IRUGO, show_rpm, 0,1*2 + RPM2_OFFSET); +#endif + +static SENSOR_DEVICE_ATTR(switch_tmp, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); +static SENSOR_DEVICE_ATTR(temp6_input, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); + +static SENSOR_DEVICE_ATTR(diag, S_IWUSR|S_IRUGO, show_diag, set_diag, 0); +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, 0, 0); + +static SENSOR_DEVICE_ATTR(fan_led_grn1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 0); +static SENSOR_DEVICE_ATTR(fan_led_grn2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 1); +static SENSOR_DEVICE_ATTR(fan_led_grn3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 2); +static SENSOR_DEVICE_ATTR(fan_led_grn4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 3); +static SENSOR_DEVICE_ATTR(fan_led_red1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 4); +static SENSOR_DEVICE_ATTR(fan_led_red2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 5); +static SENSOR_DEVICE_ATTR(fan_led_red3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 6); +static SENSOR_DEVICE_ATTR(fan_led_red4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 7); + +#if FAN_NUM>4 +static SENSOR_DEVICE_ATTR(fan_led_grn5, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 8); +static SENSOR_DEVICE_ATTR(fan_led_red5, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 12); +static SENSOR_DEVICE_ATTR(fan_gpi2, S_IRUGO, show_value8, 0, FAN_GPI2_OFFSET); +#endif + +static SENSOR_DEVICE_ATTR(fan_gpi, S_IRUGO, show_value8, 0, FAN_GPI_OFFSET); +static SENSOR_DEVICE_ATTR(psoc_psu1_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pout)); + +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vout)); +static SENSOR_DEVICE_ATTR(curr3_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iout)); +static SENSOR_DEVICE_ATTR(power3_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pout)); + +static SENSOR_DEVICE_ATTR(psoc_psu2_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); + +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); +static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vout)); +static SENSOR_DEVICE_ATTR(curr4_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iout)); +static SENSOR_DEVICE_ATTR(power4_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); + +//IPMI +static SENSOR_DEVICE_ATTR(thermal2_psu1, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Temp2); +static SENSOR_DEVICE_ATTR(temp9_input, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Temp2); + +static SENSOR_DEVICE_ATTR(psoc_psu1_vendor, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Vendor); +static SENSOR_DEVICE_ATTR(psoc_psu1_serial, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Serial); +static SENSOR_DEVICE_ATTR(psoc_psu1_version, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Version); + +static SENSOR_DEVICE_ATTR(thermal2_psu2, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Temp2); +static SENSOR_DEVICE_ATTR(temp10_input, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Temp2); +static SENSOR_DEVICE_ATTR(psoc_psu2_vendor, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Vendor); +static SENSOR_DEVICE_ATTR(psoc_psu2_serial, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Serial); +static SENSOR_DEVICE_ATTR(psoc_psu2_version, S_IRUGO, show_ipmi_pmbus, 0, PSU2 | PMBus_Version); + +//CLEI +#if FAN_CLEI_SUPPORT +static SENSOR_DEVICE_ATTR(fan1_clei, S_IRUGO, show_clei, 0, FAN1_CLEI_INDEX ); +static SENSOR_DEVICE_ATTR(fan2_clei, S_IRUGO, show_clei, 0, FAN2_CLEI_INDEX ); +static SENSOR_DEVICE_ATTR(fan3_clei, S_IRUGO, show_clei, 0, FAN3_CLEI_INDEX ); +static SENSOR_DEVICE_ATTR(fan4_clei, S_IRUGO, show_clei, 0, FAN4_CLEI_INDEX ); +#if FAN_NUM > 4 +static SENSOR_DEVICE_ATTR(fan5_clei, S_IRUGO, show_clei, 0, FAN5_CLEI_INDEX ); +#endif +#endif + +#if PSU_CLEI_SUPPORT +static SENSOR_DEVICE_ATTR(psu1_clei, S_IRUGO, show_clei, 0, PSU1_CLEI_INDEX ); +static SENSOR_DEVICE_ATTR(psu2_clei, S_IRUGO, show_clei, 0, PSU2_CLEI_INDEX ); +#endif + +static struct attribute *psoc_attributes[] = { + //name + &dev_attr_name.attr, + //thermal + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp4_input.dev_attr.attr, + &sensor_dev_attr_temp5_input.dev_attr.attr, + &sensor_dev_attr_thermal_psu1.dev_attr.attr, + &sensor_dev_attr_thermal_psu2.dev_attr.attr, + + &sensor_dev_attr_temp7_input.dev_attr.attr, + &sensor_dev_attr_temp8_input.dev_attr.attr, + + //pwm + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, +#if FAN_NUM > 4 + &sensor_dev_attr_pwm5.dev_attr.attr, +#endif + &sensor_dev_attr_pwm_psu1.dev_attr.attr, + &sensor_dev_attr_pwm_psu2.dev_attr.attr, + &sensor_dev_attr_pwm6.dev_attr.attr, + &sensor_dev_attr_pwm7.dev_attr.attr, + + //rpm + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan6_input.dev_attr.attr, + &sensor_dev_attr_fan7_input.dev_attr.attr, + &sensor_dev_attr_fan8_input.dev_attr.attr, +#if FAN_NUM > 4 + &sensor_dev_attr_fan9_input.dev_attr.attr, + &sensor_dev_attr_fan10_input.dev_attr.attr, +#endif + &sensor_dev_attr_rpm_psu1.dev_attr.attr, + &sensor_dev_attr_rpm_psu2.dev_attr.attr, + &sensor_dev_attr_fan11_input.dev_attr.attr, + &sensor_dev_attr_fan12_input.dev_attr.attr, + //switch temperature + &sensor_dev_attr_switch_tmp.dev_attr.attr, + &sensor_dev_attr_temp6_input.dev_attr.attr, + + //diag flag + &sensor_dev_attr_diag.dev_attr.attr, + + //version + &sensor_dev_attr_version.dev_attr.attr, + + //fan led + &sensor_dev_attr_fan_led_grn1.dev_attr.attr, + &sensor_dev_attr_fan_led_grn2.dev_attr.attr, + &sensor_dev_attr_fan_led_grn3.dev_attr.attr, + &sensor_dev_attr_fan_led_grn4.dev_attr.attr, + &sensor_dev_attr_fan_led_red1.dev_attr.attr, + &sensor_dev_attr_fan_led_red2.dev_attr.attr, + &sensor_dev_attr_fan_led_red3.dev_attr.attr, + &sensor_dev_attr_fan_led_red4.dev_attr.attr, +#if FAN_NUM >4 + &sensor_dev_attr_fan_led_grn5.dev_attr.attr, + &sensor_dev_attr_fan_led_red5.dev_attr.attr, + &sensor_dev_attr_fan_gpi2.dev_attr.attr, +#endif + //fan GPI + &sensor_dev_attr_fan_gpi.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + &sensor_dev_attr_psu2.dev_attr.attr, + + + //psu_psoc + &sensor_dev_attr_psoc_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pout.dev_attr.attr, + + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + &sensor_dev_attr_curr3_input.dev_attr.attr, + &sensor_dev_attr_power3_input.dev_attr.attr, + &sensor_dev_attr_in4_input.dev_attr.attr, + &sensor_dev_attr_curr4_input.dev_attr.attr, + &sensor_dev_attr_power4_input.dev_attr.attr, + + //ipmi_i2c_command + &sensor_dev_attr_thermal2_psu1.dev_attr.attr, + &sensor_dev_attr_temp9_input.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_vendor.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_serial.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_version.dev_attr.attr, + + &sensor_dev_attr_thermal2_psu2.dev_attr.attr, + &sensor_dev_attr_temp10_input.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vendor.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_serial.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_version.dev_attr.attr, + + //clei +#if FAN_CLEI_SUPPORT + &sensor_dev_attr_fan1_clei.dev_attr.attr, + &sensor_dev_attr_fan2_clei.dev_attr.attr, + &sensor_dev_attr_fan3_clei.dev_attr.attr, + &sensor_dev_attr_fan4_clei.dev_attr.attr, +#if FAN_NUM > 4 + &sensor_dev_attr_fan5_clei.dev_attr.attr, +#endif +#endif + +#if PSU_CLEI_SUPPORT + &sensor_dev_attr_psu1_clei.dev_attr.attr, + &sensor_dev_attr_psu2_clei.dev_attr.attr, +#endif + NULL +}; + +static const struct attribute_group psoc_group = { + .attrs = psoc_attributes, +}; + +//================================= +static void check_switch_temp(void) +{ + static struct file *f; + mm_segment_t old_fs; + + set_fs(get_ds()); + f = filp_open(SWITCH_TEMPERATURE_SOCK,O_RDONLY,0644); + if(IS_ERR(f)) { + return; + } + else { + char temp_str[]={0,0,0,0,0,0,0}; + loff_t pos = 0; + u16 temp2 = 0; + old_fs = get_fs(); + set_fs(KERNEL_DS); + vfs_read(f, temp_str,6,&pos); + temp2 = ((simple_strtoul(temp_str,NULL,10)/1000) <<8 ) & 0xFF00 ; + psoc_ipmi_write((u8*)&temp2, SWITCH_TMP_OFFSET, 2); + } + filp_close(f,NULL); + set_fs(old_fs); +} + +static int psoc_polling_thread(void *p) +{ + while (!kthread_should_stop()) + { + check_switch_temp(); + set_current_state(TASK_INTERRUPTIBLE); + if(kthread_should_stop()) + break; + + schedule_timeout(msecs_to_jiffies(PSOC_POLLING_PERIOD)); + } + return 0; +} + +static int __init inv_psoc_init(void) +{ + int ret; + + hwmon_dev = hwmon_device_register(NULL); + if (IS_ERR(hwmon_dev)) { + goto fail_hwmon_device_register; + } + + device_kobj = kobject_create_and_add("device", &hwmon_dev->kobj); + if(!device_kobj) { + goto fail_hwmon_device_register; + } + + ret = sysfs_create_group(device_kobj, &psoc_group); + if (ret) { + goto fail_create_group_hwmon; + } + + ret = sysfs_create_group(&hwmon_dev->kobj, &psoc_group); + if (ret) { + goto fail_create_group_hwmon; + } + + kthread_auto_update = kthread_run(psoc_polling_thread,NULL,"BMC_DRIVER"); + if (IS_ERR(kthread_auto_update)) { + goto fail_create_group_hwmon; + } + return ret; + +fail_create_group_hwmon: + hwmon_device_unregister(hwmon_dev); +fail_hwmon_device_register: + return -ENOMEM; +} + +static void __exit inv_psoc_exit(void) +{ + kthread_stop(kthread_auto_update); + if(ipmi_mh_user!=NULL) {ipmi_destroy_user(ipmi_mh_user);} + if(hwmon_dev != NULL) hwmon_device_unregister(hwmon_dev); + sysfs_remove_group(device_kobj, &psoc_group); +} + +MODULE_AUTHOR("Ting.Jack "); +MODULE_DESCRIPTION("inv psoc driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_psoc_init); +module_exit(inv_psoc_exit); + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_pthread.c b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_pthread.c new file mode 100644 index 000000000000..e3b180cd5eab --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_pthread.c @@ -0,0 +1,1459 @@ +/* + * 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. + */ + +/***************************** + Maple platform +******************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define SHOW_ATTR_WARNING ("N/A") +#define SHOW_ATTR_NOTPRINT ("Not Available") +#define SHOW_ATTR_NOTSUPPORT ("Not Support") + +#define INV_HWMID_MAX (10) +#define INV_HWMID_INIT (-1) + +/*access userspace data to kernel space*/ +#define ACC_R (0) +#define ACC_W (1) + +#define TINY_BUF_SIZE (8) +#define MAX_PATH_SIZE (64) +#define MIN_ACC_SIZE (32) +#define MAX_ACC_SIZE (256) + +/* + * LED definitions + */ +#define STATUS_LED_MODE_AUTO 0 +#define STATUS_LED_MODE_DIAG 1 +#define STATUS_LED_MODE_MANU 2 + +#define STATUS_LED_GRN0 10 // 0 - 000: off +#define STATUS_LED_GRN1 11 // 1 - 001: 0.5hz +#define STATUS_LED_GRN2 12 // 2 - 010: 1 hz +#define STATUS_LED_GRN3 13 // 3 - 011: 2 hz +#define STATUS_LED_GRN7 17 // 7 - 111: on +#define STATUS_LED_RED0 20 // 0 - 000: off +#define STATUS_LED_RED1 21 // 1 - 001: 0.5hz +#define STATUS_LED_RED2 22 // 2 - 010: 1 hz +#define STATUS_LED_RED3 23 // 3 - 011: 2 hz +#define STATUS_LED_RED7 27 // 7 - 111: on +#define STATUS_LED_INVALID 0 // Invalid + +ssize_t status_led_change(const char *path1, const char *tmp1, const char *path2, const char *tmp2); +ssize_t status_led_grn(const char *freq); +ssize_t status_led_red(const char *freq); +ssize_t status_led_diag_mode_enable(void); +ssize_t status_led_diag_mode_disable(void); +int status_led_check_color(void); +int status_led_check_diag_mode(void); + +int status_led_psu_control(void); +ssize_t status_fan_led(const char *freq); +ssize_t status_psu_led(const char *freq); + +#if 1 +/* For timestamps in SYSFS_LOG */ +#define SYSFS_LOG printk +#else +//#define SYSFS_LOG(fmt, args...) printk(KERN_WARNING "[SYSFS] %s/%d: " fmt, __func__, __LINE__, ##args) +#define SYSFS_LOG(fmt, args...) printk(KERN_WARNING "[p_thread] " fmt, ##args) +#endif + +#define INV_PTHREAD_KERNEL_MODULE (1) + +/* inventec_class *********************************/ +static struct kobject *status_kobj; +static struct kset *status_kset; + + +static struct mutex rw_lock; + +static int hwm_psoc = INV_HWMID_INIT; +static int hwm_cpld = INV_HWMID_INIT; + +int get_hwm_psoc(void) +{ + return hwm_psoc; +} + +int get_hwm_cpld(void) +{ + return hwm_cpld; +} + +static ssize_t access_user_space(const char *name, int mode, char *buf, size_t len, loff_t offset) +{ + struct file *fp; + mm_segment_t fs; + loff_t pos = offset; + char *mark = NULL; + ssize_t vfs_ret = 0; + + if (mode == ACC_R) { + fp = filp_open(name, O_RDONLY, S_IRUGO); + if (IS_ERR(fp)) + return -ENODEV; + + fs = get_fs(); + set_fs(KERNEL_DS); + + vfs_ret = vfs_read(fp, buf, len, &pos); + + mark = strpbrk(buf, "\n"); + if (mark) + *mark = '\0'; + + filp_close(fp, NULL); + set_fs(fs); + } else if (mode == ACC_W) { + fp = filp_open(name, O_WRONLY, S_IWUSR | S_IRUGO); + if (IS_ERR(fp)) + return -ENODEV; + + fs = get_fs(); + set_fs(KERNEL_DS); + + vfs_ret = vfs_write(fp, buf, len, &pos); + filp_close(fp, NULL); + set_fs(fs); + } + + return vfs_ret; +} + +int inventec_strtol(const char *sbufp, char **endp, unsigned int base) +{ + char *endptr; + int value = simple_strtol(sbufp, &endptr, base); + if (value == 0 && sbufp == endptr) { + *endp = NULL; + return value; + } + *endp = (char*)1; + return value; +} + +int inventec_singlechar_to_int(const char c) +{ + if ((c >= '0') && (c <= '9')) { + return (c - '0'); + } + else + if ((c >= 'a') && (c <= 'f')) { + return (c - 'a' + 10); + } + else + if ((c >= 'A') && (c <= 'F')) { + return (c - 'A' + 10); + } + return -1; +} + +int inventec_store_input(char *inputp, int count) +{ + int i = 0; + while(inputp[i] != '\n' && inputp[i] != '\0' && i < count) { + i++; + } + inputp[i] = '\0'; + return strlen(inputp); +} + +#if 0 +/* + * Time stamps for kernel log on yocto + */ +#include + +void SYSFS_LOG(char *fmt, ...) +{ + char buf[80], ts[32]; + va_list args; + int hlen; + + inventec_tmstmp(&ts[0]); + hlen = sprintf(buf, "[SYSFS] %s ", ts); // Do not edit this line + + va_start(args, fmt); + vsprintf(&buf[hlen-1], fmt, args); + va_end(args); + printk(KERN_WARNING "[p_thread] %s\n", buf); +} +#endif + +ssize_t +inventec_show_attr(char *buf_p, const char *invdevp) +{ + int inv_len = MAX_ACC_SIZE; /* INV driver return max length */ + char tmp_buf[MAX_ACC_SIZE]; + char *str_negative = "-", *mark = NULL; + + /* [Step2] Get data by uaccess */ + memset(tmp_buf, 0, sizeof(tmp_buf)); + mutex_lock(&rw_lock); + if (access_user_space(invdevp, ACC_R, tmp_buf, inv_len, 0) < 0) { + /* u_access fail */ + mutex_unlock(&rw_lock); + return sprintf(buf_p, "%s\n", SHOW_ATTR_WARNING); + } + mutex_unlock(&rw_lock); + + /* [Step3] Check return value + * - Ex: When transceiver not plugged + * => SWPS return error code "-202" + * => Pic8 need return "NA" (assume) + */ + if (strcspn(tmp_buf, str_negative) == 0) { + /* error case: "-202" */ + return sprintf(buf_p, "%s\n", SHOW_ATTR_WARNING); + } + + /* OK case:*/ + mark = strpbrk(tmp_buf, "\n"); + if (mark) { *mark = '\0'; } + + return sprintf(buf_p, "%s\n", tmp_buf); +} + +ssize_t +inventec_store_attr(const char *buf_p, size_t count, const char *invdevp) +{ + ssize_t ret = 0; + + /* [Step2] Get data by uaccess */ + mutex_lock(&rw_lock); + if ((ret = access_user_space(invdevp, ACC_W, (char*)buf_p, count, 0)) < 0) { + /* u_access fail */ + mutex_unlock(&rw_lock); + return -EINVAL; + } + mutex_unlock(&rw_lock); + + /* OK case:*/ + return ret; +} + +int sysfs_detect_hwmon_index(void) +{ + char hwmon_buf[MAX_ACC_SIZE]; + char hwmon_path[MAX_PATH_SIZE]; + char hwmon_dev_path[MAX_PATH_SIZE]; + int hwid = 0; + + for (hwid = 0; + hwid < INV_HWMID_MAX && (hwm_psoc == INV_HWMID_INIT || hwm_cpld == INV_HWMID_INIT); + hwid++) { + memset(hwmon_buf, 0, sizeof(hwmon_buf)); + sprintf(hwmon_path, "/sys/class/hwmon/hwmon%d/name", hwid); + + inventec_show_attr(hwmon_buf, hwmon_path); + if (strncmp(hwmon_buf, "inv_psoc", 8) == 0) { + hwm_psoc = hwid; + } + else + if (strncmp(hwmon_buf, "inv_bmc", 7) == 0) { + hwm_psoc = hwid; + } + + sprintf(hwmon_dev_path, "/sys/class/hwmon/hwmon%d/device/name", hwid); + inventec_show_attr(hwmon_buf, hwmon_dev_path); + if (strncmp(hwmon_buf, "inv_cpld", 8) == 0) { + hwm_cpld = hwid; + } + } + if (hwid >= INV_HWMID_MAX) { + printk(KERN_ERR "[p_thread] detect hwmon index failed, psoc = %d, cpld = %d\n", hwm_psoc, hwm_cpld); + return -1; + } + printk(KERN_INFO "[p_thread] detect hwmon index success, psoc = %d, cpld = %d\n", hwm_psoc, hwm_cpld); + return 0; +} + +static int __init +inventec_class_init(void) +{ + mutex_init(&rw_lock); + +#ifdef INV_PTHREAD_KERNEL_MODULE + if (sysfs_detect_hwmon_index() < 0) { + return -1; + } +#endif + + printk(KERN_INFO "[p_thread] [%s/%d] Module initial success.\n",__func__,__LINE__); + + return 0; +} + +static void __exit +inventec_class_exit(void) +{ + printk(KERN_INFO "[p_thread] [%s/%d] Remove module.\n",__func__,__LINE__); +} + +/* fan device *************************************/ +#define FAN_DEV_PATH_STATE "/sys/class/hwmon/hwmon%d/device/fan_gpi" +#define FAN_DEV_PATH_FAN1_INPUT "/sys/class/hwmon/hwmon%d/device/fan1_input" +#define FAN_DEV_PATH_FAN2_INPUT "/sys/class/hwmon/hwmon%d/device/fan2_input" +#define FAN_DEV_PATH_FAN3_INPUT "/sys/class/hwmon/hwmon%d/device/fan3_input" +#define FAN_DEV_PATH_FAN4_INPUT "/sys/class/hwmon/hwmon%d/device/fan4_input" +#define FAN_DEV_PATH_FAN5_INPUT "/sys/class/hwmon/hwmon%d/device/fan5_input" +#define FAN_DEV_PATH_FAN6_INPUT "/sys/class/hwmon/hwmon%d/device/fan6_input" +#define FAN_DEV_PATH_FAN7_INPUT "/sys/class/hwmon/hwmon%d/device/fan7_input" +#define FAN_DEV_PATH_FAN8_INPUT "/sys/class/hwmon/hwmon%d/device/fan8_input" + +static char fan_dev_path_state[MAX_PATH_SIZE]; +static char fan_dev_path_fan1_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan2_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan3_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan4_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan5_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan6_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan7_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan8_input[MAX_PATH_SIZE]; + +void sysfs_fan_path_init(void) +{ + sprintf(&fan_dev_path_state[0], FAN_DEV_PATH_STATE, get_hwm_psoc()); + sprintf(&fan_dev_path_fan1_input[0],FAN_DEV_PATH_FAN1_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan2_input[0],FAN_DEV_PATH_FAN2_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan3_input[0],FAN_DEV_PATH_FAN3_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan4_input[0],FAN_DEV_PATH_FAN4_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan5_input[0],FAN_DEV_PATH_FAN5_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan6_input[0],FAN_DEV_PATH_FAN6_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan7_input[0],FAN_DEV_PATH_FAN7_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan8_input[0],FAN_DEV_PATH_FAN8_INPUT, get_hwm_psoc()); +} + +#define FAN_STATE_NORMAL "normal" +#define FAN_STATE_FAULTY "faulty" +#define FAN_STATE_UNINSTALLED "uninstalled" +#define FAN_STATE_UNKNOW "unknown state" +#define FAN_STATE_INVALID "Invalid state value" +#define FAN_STATE_READ_ERROR "state read error" + +#define FAN_LOG_UNINSTALLED "removed" +#define FAN_LOG_NORMAL "inserted" + +//#define FAN_STATE_BIT_NORMAL 0 +#define FAN_STATE_BIT_FAULTY 0 +#define FAN_STATE_BIT_UNINSTALLED 1 +#define FAN_STATE_BIT_UNKNOW 2 +#define FAN_STATE_BIT_INVALID 3 +#define FAN_STATE_BIT_READ_ERROR 4 + +static struct fans_tbl_s { + char *fan_name; + char *fan_front; + char *fan_rear; + unsigned int fan_state; +} fans_tbl[] = { + {"fan1", fan_dev_path_fan1_input, + fan_dev_path_fan2_input, 0}, + {"fan2", fan_dev_path_fan3_input, + fan_dev_path_fan4_input, 0}, + {"fan3", fan_dev_path_fan5_input, + fan_dev_path_fan6_input, 0}, + {"fan4", fan_dev_path_fan7_input, + fan_dev_path_fan8_input, 0}, +}; +#define FAN_TBL_TOTAL ( sizeof(fans_tbl)/ sizeof(const struct fans_tbl_s) ) + +#define FAN_STATE_CHECK(i,b) (fans_tbl[i].fan_state & (1< 0) + { + printk(KERN_ERR "[p_thread] All fans failed.\n"); + printk(KERN_ERR "[p_thread] System shutdown immediately in %d seconds.\n", cd_shutdown); + } + cd_shutdown -= 1; + } + return ret; +} + +/* End of faninfo_device */ + +static int __init +fan_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_fan_path_init(); +#endif + return 0; +} + + +static void __exit +fan_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove fan module.\n"); +} + +/* psu device *************************************/ +static unsigned int psu_voltin = 0; +#define PSU_VOLTIN_ACDC (70000) + +/* + * normal/unpower/uninstall/fault are PSU states output from driver level + * checkpsu/error are defined by sysfs + */ +#define PSU_STATE_VAL_NORMAL (0) +#define PSU_STATE_VAL_UNPOWER (2) +#define PSU_STATE_VAL_FAULT (4) +#define PSU_STATE_VAL_UNINSTALL (7) +#define PSU_STATE_VAL_CHECKPSU (8) +#define PSU_STATE_VAL_ERROR (9) + +#define PSU_STATE_NORMAL ("0 : normal") +#define PSU_STATE_UNPOWER ("2 : unnormal") +#define PSU_STATE_FAULT ("4 : fault") +#define PSU_STATE_UNINSTALL ("7 : not installed") +#define PSU_STATE_CHECKPSU ("8 : check psu") +#define PSU_STATE_ERROR ("9 : state error") + +#define PSU_STATE_LEN_NORMAL (strlen(PSU_STATE_NORMAL)) +#define PSU_STATE_LEN_UNPOWER (strlen(PSU_STATE_UNPOWER)) +#define PSU_STATE_LEN_FAULT (strlen(PSU_STATE_FAULT)) +#define PSU_STATE_LEN_UNINSTALL (strlen(PSU_STATE_UNINSTALL)) +#define PSU_STATE_LEN_CHECKPSU (strlen(PSU_STATE_CHECKPSU)) + +typedef struct { + char *inv_dev_attrp; + char *inv_dev_pathp; +} psu_dev_t; + +typedef struct { + const char *psu_name; + int psu_major; + dev_t psu_devt; + struct device *psu_dev_p; + psu_dev_t *psu_dev_namep; + int psu_dev_total; + char *psu_inv_pathp; + void *psu_tracking; + char *psu_currentin; + char *psu_currentout; + char *psu_powerin; + char *psu_powerout; + char *psu_voltin; + char *psu_voltout; +} psu_dev_group_t; + +#define PSU_DEV_PATH_TEMPLATE "/sys/class/hwmon/hwmon%d/device/%s" + +static char psu_dev_path_state[MAX_PATH_SIZE]; +static char psu_dev_path_psu_voltin[MAX_PATH_SIZE]; + +static char psu_0_dev_path_state[MAX_PATH_SIZE]; +static char psu_1_dev_path_state[MAX_PATH_SIZE]; + +#if 0 +static char psu_dev_path_vendor[MAX_PATH_SIZE]; +static char psu_dev_path_version[MAX_PATH_SIZE]; +static char psu_dev_path_sn[MAX_PATH_SIZE]; +static char psu_dev_path_temperature[MAX_PATH_SIZE]; +static char psu_dev_path_fan_speed[MAX_PATH_SIZE]; +static char psu_dev_path_fan_pwm[MAX_PATH_SIZE]; +static char psu_dev_path_fan_faulty[MAX_PATH_SIZE]; +static char psu_dev_path_psu_currentin[MAX_PATH_SIZE]; +static char psu_dev_path_psu_currentout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_powerin[MAX_PATH_SIZE]; +static char psu_dev_path_psu_powerout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_voltout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_pwm[MAX_PATH_SIZE]; +static char psu_dev_path_psu_rpm[MAX_PATH_SIZE]; +#endif + +void sysfs_psu_path_init(void) +{ + sprintf(&psu_dev_path_state[0], PSU_DEV_PATH_TEMPLATE, get_hwm_cpld(), "\%s" ); + sprintf(&psu_dev_path_psu_voltin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + + sprintf(&psu_0_dev_path_state[0], PSU_DEV_PATH_TEMPLATE, get_hwm_cpld(), "psu0" ); + sprintf(&psu_1_dev_path_state[0], PSU_DEV_PATH_TEMPLATE, get_hwm_cpld(), "psu1" ); + +#if 0 + sprintf(&psu_dev_path_vendor[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_version[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_sn[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_temperature[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_speed[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_pwm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_faulty[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_currentin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_currentout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_powerin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_powerout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_voltout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_pwm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_rpm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); +#endif +} + +static psu_dev_t psu_dev_name[] = { + { "state", psu_dev_path_state }, // Using cpld + { "psu_voltin", psu_dev_path_psu_voltin }, +#if 0 + { "vendor", psu_dev_path_vendor }, + { "version", psu_dev_path_version }, + { "sn", psu_dev_path_sn }, + { "temperature", psu_dev_path_temperature }, + { "fan_speed", psu_dev_path_fan_speed }, + { "fan_pwm", psu_dev_path_fan_pwm }, + { "fan_faulty", psu_dev_path_fan_faulty }, + { "psu_currentin", psu_dev_path_psu_currentin }, + { "psu_currentout", psu_dev_path_psu_currentout }, + { "psu_powerin", psu_dev_path_psu_powerin }, + { "psu_powerout", psu_dev_path_psu_powerout }, + { "psu_voltout", psu_dev_path_psu_voltout }, + { "psu_pwm", psu_dev_path_psu_pwm }, + { "psu_rpm", psu_dev_path_psu_rpm }, +#endif +}; +#define PSU_DEV_NAME_TOTAL ( sizeof(psu_dev_name) / sizeof(const psu_dev_t) ) + +static psu_dev_group_t psu_dev_group[] = { + { + .psu_name = "psu1", + .psu_dev_namep = &psu_dev_name[0], + .psu_dev_total = sizeof(psu_dev_name) / sizeof(const psu_dev_t), + }, + { + .psu_name = "psu2", + .psu_dev_namep = &psu_dev_name[0], + .psu_dev_total = sizeof(psu_dev_name) / sizeof(const psu_dev_t), + }, +}; +#define PSU_DEV_GROUP_TOTAL ( sizeof(psu_dev_group)/ sizeof(const psu_dev_group_t) ) + +static char psu_state[4][MIN_ACC_SIZE]; + +static struct psu_wire_tbl_s { + char *psu_attr; + char *psu_name; + char *psu_wire; + char *psu_state; +} psu_wire_tbl[] = { + { "state", "psu1", "psu0", psu_state[0] }, // Using cpld + { "state", "psu2", "psu1", psu_state[1] }, + { "psu_voltin", "psu1", "psoc_psu1_vin", psu_state[2] }, + { "psu_voltin", "psu2", "psoc_psu2_vin", psu_state[3] }, +}; +#define PSU_WIRE_TBL_TOTAL ( sizeof(psu_wire_tbl)/ sizeof(const struct psu_wire_tbl_s) ) + +static char * +psu_attr_get_wirep(const char *psu_attrp, const char *psu_namep, char **psu_statepp) +{ + int i; + + for (i = 0; i < PSU_WIRE_TBL_TOTAL; i++) { + if (strncmp(psu_wire_tbl[i].psu_attr, psu_attrp, strlen(psu_attrp)) == 0 && + strncmp(psu_wire_tbl[i].psu_name, psu_namep, strlen(psu_namep)) == 0) { + if (psu_statepp) { + *psu_statepp = psu_wire_tbl[i].psu_state; + } + return psu_wire_tbl[i].psu_wire; + } + } + return NULL; +} + +int psu_check_state_normal(char *statep) +{ + if (strstr(statep, "normal")) { + return 1; + } + return 0; +} + +#define PSU_ATTR_VOLTIN ("psu_voltin") +#define PSU_ATTR_VOLTIN_LEN (10) + +/* Get PSU voltin for determon AC(110v) or DC(48v) */ +void psu_get_voltin(void) +{ + char acc_path[MAX_PATH_SIZE], volt[MIN_ACC_SIZE]; + psu_dev_t *devnamep; + unsigned int voltin; + char *invwirep; + int i, j; + + for (i = 0; i < PSU_DEV_GROUP_TOTAL; i++) { + //psu_dev_group[i].psu_name; + devnamep = psu_dev_group[i].psu_dev_namep; + for (j = 0; j < psu_dev_group[i].psu_dev_total; j++, devnamep++) { + if (strncmp(devnamep->inv_dev_attrp, PSU_ATTR_VOLTIN, PSU_ATTR_VOLTIN_LEN) == 0) { + invwirep = psu_attr_get_wirep(PSU_ATTR_VOLTIN, psu_dev_group[i].psu_name, NULL); + if (invwirep == NULL) { + printk(KERN_DEBUG "[p_thread] Invalid psuname: %s\n", psu_dev_group[i].psu_name); + continue; + } + sprintf(acc_path, devnamep->inv_dev_pathp, invwirep); + //printk(KERN_DEBUG "[p_thread] RYU: %s/%d: acc_path = %s\n",__func__,__LINE__,acc_path); + if (inventec_show_attr(volt, acc_path) <= 0) { + printk(KERN_DEBUG "[p_thread] Read %s failed\n", acc_path); + continue; + } + else { + voltin = simple_strtol(&volt[0], NULL, 10); + printk(KERN_DEBUG "[p_thread] Read %s %s = %u\n",acc_path,volt,voltin); + if (voltin > psu_voltin) { + psu_voltin = voltin; + } + } + } + } + } + + SYSFS_LOG("[p_thread] PSU voltin = %u\n", psu_voltin); +} + +#define PSU_ATTR_STATE ("state") +#define PSU_ATTR_STATE_LEN (5) + +/* psus_control() by inv_thread */ +int psus_control(int log_only) +{ + char acc_path[MAX_PATH_SIZE], state[MIN_ACC_SIZE]; + psu_dev_t *devnamep = NULL; + char *invwirep = NULL; + char *psu_statep = NULL; + int i, j, flag = 0; + + for (i = 0; i < PSU_DEV_GROUP_TOTAL; i++) { + devnamep = psu_dev_group[i].psu_dev_namep; + for (j = 0; j < psu_dev_group[i].psu_dev_total; j++, devnamep++) { + if (strncmp(devnamep->inv_dev_attrp, PSU_ATTR_STATE, PSU_ATTR_STATE_LEN) == 0) { + invwirep = psu_attr_get_wirep(PSU_ATTR_STATE, psu_dev_group[i].psu_name, &psu_statep); + if (invwirep == NULL) { + printk(KERN_DEBUG "[p_thread] Invalid psuname: %s\n", psu_dev_group[i].psu_name); + continue; + } + sprintf(acc_path, devnamep->inv_dev_pathp, invwirep); + //printk(KERN_INFO "[p_thread] RYU: %s/%d: acc_path = %s\n",__func__,__LINE__,acc_path); + if (inventec_show_attr(state, acc_path) <= 0) { + printk(KERN_DEBUG "[p_thread] Read %s failed\n", acc_path); + if (strncmp(psu_statep, PSU_STATE_ERROR, strlen(PSU_STATE_ERROR)) != 0) { + strcpy(psu_statep, PSU_STATE_ERROR); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,PSU_STATE_ERROR); + } + flag = 1; + } + else + if (strstr(state, "normal")) { + //printk(KERN_INFO "[p_thread] %s: %s\n", psu_dev_group[i].psu_name, state); + if (strncmp(psu_statep, state, strlen(state)) != 0) { + strcpy(psu_statep, state); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,state); + } + } + else + if (psu_voltin > PSU_VOLTIN_ACDC) { /* AC PSUS */ + //printk(KERN_INFO "[p_thread] RYU: %s: %s\n", psu_dev_group[i].psu_name, state); + if (strncmp(psu_statep, state, strlen(state)) != 0) { + strcpy(psu_statep, state); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,state); + } + flag = 1; + } + else { /* DC PSUS */ + if (strncmp(psu_statep, PSU_STATE_CHECKPSU, PSU_STATE_LEN_CHECKPSU) != 0) { + strcpy(psu_statep, PSU_STATE_CHECKPSU); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,PSU_STATE_CHECKPSU); + } + flag = 1; + } + } + } + } + + if (log_only) { + return 0; + } + + //SYSFS_LOG("[p_thread] RYU: %s: flag = %d\n",psu_wire_tbl[i].psu_name,flag); + if (flag == 1) { + status_psu_led("0x20"); + return 1; + } + return 0; +} + +int status_led_psu_control(void) +{ + int retVal = 0; //no issue + + char buf[MAX_ACC_SIZE]; + + int normal_psu_cnt = 0; //normal + + int fault_psu_cnt = 0; + + //read fan status one by one + //read psu 0 status + if (inventec_show_attr(&buf[0], psu_0_dev_path_state) > 0) + { + if(buf[0] == '0') //normal + { + normal_psu_cnt = normal_psu_cnt + 1; + } + else if (buf[0] == '4') // psu fault + { + fault_psu_cnt = fault_psu_cnt + 1; + } + + //Check 2nd psu + if(inventec_show_attr(&buf[0], psu_1_dev_path_state) > 0) + { + if(buf[0] == '0') //normal + { + normal_psu_cnt = normal_psu_cnt + 1; + } + else if (buf[0] == '4') // psu fault + { + fault_psu_cnt = fault_psu_cnt + 1; + } + } + } + + if (normal_psu_cnt == 0) + { + status_psu_led("0"); + retVal = 1; + } + else + { + if( fault_psu_cnt > 0) + { + status_psu_led("0x01"); //Red lit + retVal = 1; + } + else if (normal_psu_cnt == 1) + { + status_psu_led("0x20"); // Green blink + retVal = 1; + } + else if (normal_psu_cnt == 2) + { + status_psu_led("0x10"); // Green Lit + retVal = 0; + } + } + + return retVal; +} + + +/* End of psuinfo_device */ + +static int __init +psu_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_psu_path_init(); +#endif + return 0; +} + + +static void __exit +psu_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove psu module.\n"); +} + +/* led device *************************************/ +#define STATUS_LED_GRN_PATH "/sys/class/hwmon/hwmon%d/device/grn_led" +#define STATUS_LED_RED_PATH "/sys/class/hwmon/hwmon%d/device/red_led" + +#define STATUS_LED_FAN_PATH "/sys/class/hwmon/hwmon%d/device/fan_led" +#define STATUS_LED_PSU_PATH "/sys/class/hwmon/hwmon%d/device/psu_led" + +#define FAN_LED_GRN1_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn1" +#define FAN_LED_GRN2_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn2" +#define FAN_LED_GRN3_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn3" +#define FAN_LED_GRN4_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn4" +#define FAN_LED_RED1_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red1" +#define FAN_LED_RED2_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red2" +#define FAN_LED_RED3_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red3" +#define FAN_LED_RED4_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red4" + +#define HWMON_DEVICE_DIAG_PATH "/sys/class/hwmon/hwmon%d/device/diag" +#define HWMON_DEVICE_CTRL_PATH "/sys/class/hwmon/hwmon%d/device/ctl" + +static char status_led_grn_path[MAX_PATH_SIZE]; +static char status_led_red_path[MAX_PATH_SIZE]; +static char status_led_fan_path[MAX_PATH_SIZE]; +static char status_led_psu_path[MAX_PATH_SIZE]; + +static char fan_led_grn1_path[MAX_PATH_SIZE]; +static char fan_led_grn2_path[MAX_PATH_SIZE]; +static char fan_led_grn3_path[MAX_PATH_SIZE]; +static char fan_led_grn4_path[MAX_PATH_SIZE]; +static char fan_led_red1_path[MAX_PATH_SIZE]; +static char fan_led_red2_path[MAX_PATH_SIZE]; +static char fan_led_red3_path[MAX_PATH_SIZE]; +static char fan_led_red4_path[MAX_PATH_SIZE]; +static char hwmon_device_diag_path[MAX_PATH_SIZE]; +static char hwmon_device_ctrl_path[MAX_PATH_SIZE]; + +void sysfs_led_path_init(void) +{ + sprintf(&status_led_grn_path[0], STATUS_LED_GRN_PATH, get_hwm_cpld()); + sprintf(&status_led_red_path[0], STATUS_LED_RED_PATH, get_hwm_cpld()); + sprintf(&status_led_fan_path[0], STATUS_LED_FAN_PATH, get_hwm_cpld()); + sprintf(&status_led_psu_path[0], STATUS_LED_PSU_PATH, get_hwm_cpld()); + + sprintf(&fan_led_grn1_path[0], FAN_LED_GRN1_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn2_path[0], FAN_LED_GRN2_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn3_path[0], FAN_LED_GRN3_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn4_path[0], FAN_LED_GRN4_PATH, get_hwm_psoc()); + sprintf(&fan_led_red1_path[0], FAN_LED_RED1_PATH, get_hwm_psoc()); + sprintf(&fan_led_red2_path[0], FAN_LED_RED2_PATH, get_hwm_psoc()); + sprintf(&fan_led_red3_path[0], FAN_LED_RED3_PATH, get_hwm_psoc()); + sprintf(&fan_led_red4_path[0], FAN_LED_RED4_PATH, get_hwm_psoc()); + sprintf(&hwmon_device_diag_path[0], HWMON_DEVICE_DIAG_PATH, get_hwm_psoc()); + sprintf(&hwmon_device_ctrl_path[0], HWMON_DEVICE_CTRL_PATH, get_hwm_cpld()); +} + +/* return 0/off 1/green 2/red */ +int +status_led_check_color(void) +{ + char tmpbuf[MIN_ACC_SIZE]; + int ret = STATUS_LED_INVALID; + + if (inventec_show_attr(&tmpbuf[0], status_led_grn_path) > 0) { + if (tmpbuf[0] == '0') { + ret = STATUS_LED_GRN0; + } + if (tmpbuf[0] == '1') { + ret = STATUS_LED_GRN1; + } + if (tmpbuf[0] == '2') { + ret = STATUS_LED_GRN2; + } + if (tmpbuf[0] == '3') { + ret = STATUS_LED_GRN3; + } + if (tmpbuf[0] == '7') { + ret = STATUS_LED_GRN7; + } + return ret; + } + + if (inventec_show_attr(&tmpbuf[0], status_led_red_path) > 0) { + if (tmpbuf[0] == '0') { + ret = STATUS_LED_RED0; + } + if (tmpbuf[0] == '1') { + ret = STATUS_LED_RED1; + } + if (tmpbuf[0] == '2') { + ret = STATUS_LED_RED2; + } + if (tmpbuf[0] == '3') { + ret = STATUS_LED_RED3; + } + if (tmpbuf[0] == '7') { + ret = STATUS_LED_RED7; + } + return ret; + } + return ret; +} + +/* + * Store attr Section + */ +static DEFINE_MUTEX(diag_mutex); + +ssize_t status_led_diag_mode_enable(void) +{ + char tmp[MIN_ACC_SIZE]; + ssize_t ret; + + ret = inventec_show_attr(&tmp[0], hwmon_device_diag_path); + if (ret <= 0) { + return ret; + } + + if (tmp[0] == '0') { + mutex_lock(&diag_mutex); + ret = inventec_store_attr("1", 1, hwmon_device_diag_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return ret; + } + + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return ret; + } + mutex_unlock(&diag_mutex); + } + + return ret; +} + +ssize_t status_led_diag_mode_disable(void) +{ + char tmp[MIN_ACC_SIZE]; + ssize_t ret; + + ret = inventec_show_attr(&tmp[0], hwmon_device_diag_path); + if (ret <= 0) { + return ret; + } + + if (tmp[0] == '1') { + mutex_lock(&diag_mutex); + ret = inventec_store_attr("0", 1, hwmon_device_diag_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return 1; + } + + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return 1; + } + mutex_unlock(&diag_mutex); + } + return 1; +} + +ssize_t +status_led_change(const char *path1, const char *tmp1, const char *path2, const char *tmp2) +{ + ssize_t ret; + + ret = inventec_store_attr(tmp1, strlen(tmp1), path1); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(tmp2, strlen(tmp2), path2); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_led_red(const char *freq) +{ + ssize_t ret; + + ret = inventec_store_attr("0", 1, &status_led_grn_path[0]); + + if (ret < 0) { + return ret; + } + + ret = inventec_store_attr(freq, strlen(freq), &status_led_red_path[0]); + + if (ret < 0) { + return ret; + } + + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_led_grn(const char *freq) +{ + ssize_t ret; + + ret = inventec_store_attr("0", 1, &status_led_red_path[0]); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(freq, strlen(freq), &status_led_grn_path[0]); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +static int status_led_diag_mode = STATUS_LED_MODE_AUTO; + +int status_led_check_diag_mode(void) +{ + return status_led_diag_mode; +} + +//status led: FAN & PSU +ssize_t +status_fan_led(const char *freq) +{ + ssize_t ret; + ret = inventec_store_attr(freq, strlen(freq), &status_led_fan_path[0]); + if (ret < 0) { + return ret; + } + + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_psu_led(const char *freq) +{ + ssize_t ret; + ret = inventec_store_attr(freq, strlen(freq), &status_led_psu_path[0]); + if (ret < 0) { + return ret; + } + + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +/* End of ledinfo_device */ + +static int __init +led_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_led_path_init(); +#endif + return 0; +} + + +static void __exit +led_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove led module.\n"); +} + +/* sensor device **********************************/ +#define SENSOR_DEV_PATH_SWITCH_TEMP "/sys/class/hwmon/hwmon%d/device/switch_tmp" + +static char sensor_dev_path_switch_temp[MAX_PATH_SIZE]; + +void sysfs_sensor_path_init(void) +{ + sprintf(&sensor_dev_path_switch_temp[0], SENSOR_DEV_PATH_SWITCH_TEMP, get_hwm_psoc()); +} + +void switch_temp_update(void) +{ + char buf[MIN_ACC_SIZE]; + ssize_t count = inventec_show_attr(&buf[0], "proc/switch/temp"); + if (count > 0) { + //printk(KERN_ERR "[p_thread] [STEMP] Switch temperature is out of range: %d\n", stemp); + inventec_store_attr(&buf[0], count, sensor_dev_path_switch_temp); + } +} + +/**************************************************/ +/* From system_device */ +static int inv_pthread_control = 1; + +int thread_control(void) +{ + return inv_pthread_control; +} + +void thread_control_set(int val) +{ + inv_pthread_control = val; +} +/* End system_device */ + +#define THREAD_SLEEP_MINS (3) +#define THREAD_DELAY_MINS (THREAD_SLEEP_MINS + THREAD_SLEEP_MINS + 1) + +extern void psu_get_voltin(void); + +static struct task_struct *thread_st; +static int thread_data; + +#ifdef SWITCH_HEALTH_LED_CHANGE_VIA_GPIO +void led_set_gpio_to_change_status_led(void) +{ + ssize_t ret = inventec_store_attr("253", 2, "/sys/class/gpio/export"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 253 to /sys/class/gpio/export failed\n"); + return; + } + + printk("[p_thread] Write 253 to /sys/class/gpio/export\n"); + + ret = inventec_store_attr("out", 3, "/sys/class/gpio/gpio253/direction"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write low to /sys/class/gpio/gpio253/direction failed\n"); + return; + } + + //pull high and then low + ret = inventec_store_attr("1", 1, "sys/class/gpio/gpio253/value"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 1 to sys/class/gpio/gpio253/value failed\n"); + } + + //pull low + ret = inventec_store_attr("0", 1, "sys/class/gpio/gpio253/value"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 0 to sys/class/gpio/gpio253/value failed\n"); + } + + SYSFS_LOG("[p_thread] Set gpio to support status led change successfully\n"); +} +#endif + +// Function executed by kernel thread +static int thread_fn(void *unused) +{ + bool fan_issue = false; + bool psu_issue = false; + bool psu_number_issue = false; + + /* Delay for guarantee HW ready */ + ssleep(THREAD_DELAY_MINS); + +#ifndef INV_PTHREAD_KERNEL_MODULE + sysfs_led_path_init(); + sysfs_fan_path_init(); + sysfs_psu_path_init(); +#endif + //sysfs_sensor_path_init(); + + /* Default status init */ + status_led_grn("7"); + + psu_get_voltin(); + +#ifdef SWITCH_HEALTH_LED_CHANGE_VIA_GPIO + led_set_gpio_to_change_status_led(); +#endif + + while (1) + { + ssleep(THREAD_SLEEP_MINS); + + if (thread_control() == 0) { + printk(KERN_INFO "[p_thread] %s/%d: Thread Stop by inv_pthread control\n",__func__,__LINE__); + break; + } + + if (status_led_check_diag_mode() == STATUS_LED_MODE_MANU) { + /* status led in change color/freq mode, higher priority. Ignore fans sttaus */ + continue; + } + + //switch_temp_update(); + + if (fans_control() > 0) //has at least one failed fan + { + psus_control(0); //now we have separate led for FAN and PSU + fan_issue = true; + } + + if (psus_control(1) > 0) + { + psu_issue = true; + } + + if (status_led_psu_control() > 0) + { + psu_number_issue = true; + } + + if(fan_issue || psu_issue || psu_number_issue) + { + continue; + } + + if (status_led_check_color() != STATUS_LED_GRN7) { /* status led red, change it to green */ + status_led_grn("7"); + } + } + +#ifndef INV_PTHREAD_KERNEL_MODULE +err_inv_pthread_fn_1: +#endif + do_exit(0); + printk(KERN_INFO "[p_thread] %s/%d: Thread Stopped\n",__func__,__LINE__); + return 0; +} + + +static ssize_t s_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + int fan_absence; + size_t count; + + fan_absence = fans_control(); + count += sprintf(&buf[count], "%d\n", fan_absence); + return count; +} + +static ssize_t s_store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) +{ + return count; +} + +static struct attribute status_att = { + .name = "fan_absence", + .mode = 0777, +}; + +static const struct sysfs_ops status_ops = { + .show = s_show, + .store = s_store, +}; + +static struct kobj_type status_ktype = { + .sysfs_ops = &status_ops, +}; + + +static int __init inv_pthread_init(void) +{ + int retval; + + status_kobj = kzalloc(sizeof(*status_kobj), GFP_KERNEL); + if(!status_kobj) + return PTR_ERR(status_kobj); + + status_kset = kset_create_and_add("platform_status", NULL, kernel_kobj); + if(!status_kset) + return -1; + + status_kobj->kset = status_kset; + + retval = kobject_init_and_add(status_kobj, &status_ktype, NULL, "fan"); + if(retval) + return retval; + + retval = sysfs_create_file(status_kobj, &status_att); + + + inventec_class_init(); + fan_device_init(); + psu_device_init(); + led_device_init(); + + thread_control_set(1); + + printk(KERN_INFO "[p_thread] %s/%d: Creating Thread\n",__func__,__LINE__); + //Create the kernel thread with name 'inv_pthread' + thread_st = kthread_run(thread_fn, (void*)&thread_data, "inv_pthread"); + if (thread_st) + printk(KERN_INFO "[p_thread] inv_pthread Created successfully\n"); + else + printk(KERN_ERR "[p_thread] inv_pthread creation failed\n"); + + return retval; +} + +static void __exit inv_pthread_exit(void) +{ + thread_control_set(0); + /* Delay for guarantee thread exit */ + ssleep(THREAD_DELAY_MINS); + + fan_device_exit(); + psu_device_exit(); + led_device_exit(); + inventec_class_exit(); + + sysfs_remove_file(status_kobj, &status_att); + kset_unregister(status_kset); + kobject_del(status_kobj); + + printk(KERN_INFO "[p_thread] inv_pthread cleaning Up\n"); +} + +module_init(inv_pthread_init); +module_exit(inv_pthread_exit); + +MODULE_AUTHOR("Robert "); +MODULE_DESCRIPTION("Inventec Platform Management Thread"); +MODULE_VERSION("version 1.0"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_swps.c b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_swps.c new file mode 100644 index 000000000000..cbb22fba2979 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_swps.c @@ -0,0 +1,3049 @@ +/* + * 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 "inv_swps.h" + +static int ctl_major; +static int port_major; +static int ioexp_total; +static int port_total; +static int auto_config; +static int flag_i2c_reset; +static int flag_mod_state; +static unsigned gpio_rest_mux; +static struct class *swp_class_p = NULL; +static struct inv_platform_s *platform_p = NULL; +static struct inv_ioexp_layout_s *ioexp_layout = NULL; +static struct inv_port_layout_s *port_layout = NULL; + +static void swp_polling_worker(struct work_struct *work); +static DECLARE_DELAYED_WORK(swp_polling, swp_polling_worker); + +static int reset_i2c_topology(void); + + +static int +__swp_match(struct device *dev, +#ifdef SWPS_KERN_VER_AF_3_10 + + const void *data){ +#else + void *data){ +#endif + + char *name = (char *)data; + if (strcmp(dev_name(dev), name) == 0) + return 1; + return 0; +} + + +struct device * +get_swpdev_by_name(char *name){ + struct device *dev = class_find_device(swp_class_p, + NULL, + name, + __swp_match); + return dev; +} + + +static int +sscanf_2_int(const char *buf) { + + int result = -EBFONT; + char *hex_tag = "0x"; + + if (strcspn(buf, hex_tag) == 0) { + if (sscanf(buf,"%x",&result)) { + return result; + } + } else { + if (sscanf(buf,"%d",&result)) { + return result; + } + if(sscanf(buf,"-%d",&result)) { + return -result; + } + if (sscanf(buf,"%x",&result)) { + return result; + } + } + return -EBFONT; +} + + +static int +sscanf_2_binary(const char *buf) { + + int result = sscanf_2_int(buf); + + if (result < 0){ + return -EBFONT; + } + switch (result) { + case 0: + case 1: + return result; + default: + break; + } + return -EBFONT; +} + + +static int +_get_polling_period(void) { + + int retval = 0; + + if (SWP_POLLING_PERIOD == 0) { + return 0; + } + retval = ((SWP_POLLING_PERIOD * HZ) / 1000); + if (retval == 0) { + return 1; + } + return retval; +} + + +static struct transvr_obj_s * +_get_transvr_obj(char *dev_name) { + + struct device *dev_p = NULL; + struct transvr_obj_s *transvr_obj_p = NULL; + + dev_p = get_swpdev_by_name(dev_name); + if (!dev_p){ + return NULL; + } + transvr_obj_p = dev_get_drvdata(dev_p); + if (!transvr_obj_p){ + return NULL; + } + return transvr_obj_p; +} + + +static void +unlock_tobj_all(void) { + + struct transvr_obj_s *tobj_p; + char port_name[32]; + int port_id = 0; + int minor_curr = 0; + + for (minor_curr=0; minor_currauto_config = auto_config; + unlock_transvr_obj(tobj_p); + SWPS_DEBUG("%s: Set %s auto_config=%d\n", + __func__, tobj_p->swp_name, auto_config); + } + return retval; +} + + +/* ========== R/W Functions module control attribute ========== + */ +static ssize_t +show_attr_platform(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + return snprintf(buf_p, 32, "%s\n", platform_p->name); +} + + +static ssize_t +show_attr_version(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + return snprintf(buf_p, 8, "%s\n", SWP_VERSION); +} + + +static ssize_t +show_attr_status(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + return snprintf(buf_p, 8, "%d\n", flag_mod_state); +} + + +static ssize_t +show_attr_auto_config(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + return snprintf(buf_p, 8, "%d\n", auto_config); +} + + +static int +_check_reset_pwd(const char *buf_p, + size_t count) { + + int in_max = 64; + int in_len = (int)count; + char in_val[64] = "ERR"; + char *emsg = "ERR"; + + if (in_len >= in_max) { + emsg = "input too much"; + goto err_check_reset_pwd; + } + if (!sscanf(buf_p,"%s",in_val)) { + emsg = "format incorrect"; + goto err_check_reset_pwd; + } + if (strcmp(in_val, SWP_RESET_PWD) != 0) { + emsg = "password incorrect"; + goto err_check_reset_pwd; + } + return 0; + +err_check_reset_pwd: + SWPS_ERR("%s: %s\n", __func__, emsg); + return -1; +} + + +static ssize_t +store_attr_reset_i2c(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + if (_check_reset_pwd(buf_p, count) < 0) { + return -EBFONT; + } + /* Polling mode */ + if (SWP_POLLING_ENABLE) { + SWPS_INFO("%s: reset I2C :polling\n", __func__); + flag_i2c_reset = 1; + return count; + } + /* Direct mode */ + SWPS_INFO("%s: reset I2C go. :direct\n", __func__); + if (reset_i2c_topology() < 0) { + SWPS_ERR("%s: reset fail!\n", __func__); + return -EIO; + } + SWPS_INFO("%s: reset I2C ok. :direct\n", __func__); + return count; +} + + +static ssize_t +store_attr_reset_swps(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p; + char port_name[32] = "ERR"; + int port_id = 0; + int minor_curr = 0; + + if (_check_reset_pwd(buf_p, count) < 0) { + return -EBFONT; + } + for (minor_curr=0; minor_currstate = STATE_TRANSVR_DISCONNECTED; + unlock_transvr_obj(tobj_p); + SWPS_INFO("%s: reset:%s\n", __func__, tobj_p->swp_name); + } + return count; +} + + +static ssize_t +store_attr_auto_config(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + int input_val = sscanf_2_int(buf_p); + + if (input_val < 0){ + return -EBFONT; + } + if ((input_val != 0) && (input_val != 1)) { + return -EBFONT; + } + auto_config = input_val; + _update_auto_config_2_trnasvr(); + return count; +} + + +/* ========== Show functions: For transceiver attribute ========== + */ +static ssize_t +_show_transvr_hex_attr(struct transvr_obj_s* tobj_p, + int (*get_func)(struct transvr_obj_s* tobj_p), + char *buf_p) { + size_t len; + int result; + + lock_transvr_obj(tobj_p); + result = get_func(tobj_p); + unlock_transvr_obj(tobj_p); + if (result < 0){ + len = snprintf(buf_p, 8, "%d\n", result); + } else { + len = snprintf(buf_p, 8, "0x%02x\n", result); + } + return len; +} + + +static ssize_t +_show_transvr_int_attr(struct transvr_obj_s* tobj_p, + int (*get_func)(struct transvr_obj_s* tobj_p), + char *buf_p) { + size_t len; + + lock_transvr_obj(tobj_p); + len = snprintf(buf_p, 16, "%d\n", get_func(tobj_p)); + unlock_transvr_obj(tobj_p); + return len; +} + + +static ssize_t +_show_transvr_str_attr(struct transvr_obj_s* tobj_p, + int (*get_func)(struct transvr_obj_s* tobj_p, char* buf), + char *buf_p) { + size_t len; + + lock_transvr_obj(tobj_p); + len = get_func(tobj_p, buf_p); + unlock_transvr_obj(tobj_p); + return len; +} + + +static ssize_t +show_attr_id(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_id, + buf_p); +} + + +static ssize_t +show_attr_ext_id(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_ext_id, + buf_p); +} + + +static ssize_t +show_attr_connector(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_connector, + buf_p); +} + + +static ssize_t +show_attr_vendor_name(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_vendor_name, + buf_p); +} + + +static ssize_t +show_attr_vendor_pn(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_vendor_pn, + buf_p); +} + + +static ssize_t +show_attr_vendor_rev(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_vendor_rev, + buf_p); +} + + +static ssize_t +show_attr_vendor_sn(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_vendor_sn, + buf_p); +} + + +static ssize_t +show_attr_power_cls(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + size_t len; + int result; + struct transvr_obj_s *tobj_p; + + tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + lock_transvr_obj(tobj_p); + result = tobj_p->get_power_cls(tobj_p); + unlock_transvr_obj(tobj_p); + if (result < 0){ + len = snprintf(buf_p, 16, "%d\n", result); + } else { + len = snprintf(buf_p, 16, "Power Class %d\n", result); + } + return len; +} + + +static ssize_t +show_attr_br(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_br, + buf_p); +} + + +static ssize_t +show_attr_len_sm(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_sm, + buf_p); +} + + +static ssize_t +show_attr_len_smf(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_smf, + buf_p); +} + + +static ssize_t +show_attr_len_om1(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_om1, + buf_p); +} + + +static ssize_t +show_attr_len_om2(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_om2, + buf_p); +} + + +static ssize_t +show_attr_len_om3(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_om3, + buf_p); +} + + +static ssize_t +show_attr_len_om4(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_len_om4, + buf_p); +} + + +static ssize_t +show_attr_comp_rev(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_comp_rev, + buf_p); +} + + +static ssize_t +show_attr_comp_eth(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_comp_eth_1, + buf_p); +} + + +static ssize_t +show_attr_comp_eth_10(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_comp_eth_10, + buf_p); +} + + +static ssize_t +show_attr_comp_eth_10_40(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_comp_eth_10_40, + buf_p); +} + + +static ssize_t +show_attr_comp_extend(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_comp_extend, + buf_p); +} + + +static ssize_t +show_attr_rate_id(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_rate_id, + buf_p); +} + + +static ssize_t +show_attr_temperature(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_curr_temp, + buf_p); +} + + +static ssize_t +show_attr_voltage(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_curr_vol, + buf_p); +} + + +static ssize_t +show_attr_tx_bias(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_tx_bias, + buf_p); +} + + +static ssize_t +show_attr_tx_power(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_tx_power, + buf_p); +} + + +static ssize_t +show_attr_tx_eq(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_tx_eq, + buf_p); +} + + +static ssize_t +show_attr_rx_power(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_rx_power, + buf_p); +} + + +static ssize_t +show_attr_rx_am(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_rx_am, + buf_p); +} + + +static ssize_t +show_attr_rx_em(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_rx_em, + buf_p); +} + + +static ssize_t +show_attr_wavelength(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_wavelength, + buf_p); +} + + +static ssize_t +show_attr_extphy_offset(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_extphy_offset, + buf_p); +} + + +static ssize_t +show_attr_extphy_reg(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_extphy_reg, + buf_p); +} + + +static ssize_t +show_attr_info(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_info, + buf_p); +} + + +static ssize_t +show_attr_if_type(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_if_type, + buf_p); +} + + +static ssize_t +show_attr_if_speed(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_if_speed, + buf_p); +} + + +static ssize_t +show_attr_if_lane(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_if_lane, + buf_p); +} + + +static ssize_t +show_attr_cdr(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_hex_attr(tobj_p, + tobj_p->get_cdr, + buf_p); +} + + +static ssize_t +show_attr_soft_rs0(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_soft_rs0, + buf_p); +} + + +static ssize_t +show_attr_soft_rs1(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_int_attr(tobj_p, + tobj_p->get_soft_rs1, + buf_p); +} + + +static ssize_t +show_attr_soft_rx_los(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_soft_rx_los, + buf_p); +} + + +static ssize_t +show_attr_soft_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_soft_tx_disable, + buf_p); +} + + +static ssize_t +show_attr_soft_tx_fault(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_soft_tx_fault, + buf_p); +} + + +static ssize_t +show_attr_auto_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if(!tobj_p){ + return -ENODEV; + } + return _show_transvr_str_attr(tobj_p, + tobj_p->get_auto_tx_disable, + buf_p); +} + + +/* ========== Store functions: transceiver (R/W) attribute ========== + */ +static ssize_t +_store_transvr_int_attr(struct transvr_obj_s* tobj_p, + int (*set_func)(struct transvr_obj_s *tobj_p, int input_val), + const char *buf_p, + size_t count) { + int input, err; + + input = sscanf_2_int(buf_p); + if (input < 0){ + return -EBFONT; + } + lock_transvr_obj(tobj_p); + err = set_func(tobj_p, input); + unlock_transvr_obj(tobj_p); + if (err < 0){ + return err; + } + return count; +} + + +static ssize_t +_store_transvr_byte_hex_attr(struct transvr_obj_s* tobj_p, + int (*set_func)(struct transvr_obj_s *tobj_p, int input_val), + const char *buf_p, + size_t count) { + int input, err; + + input = sscanf_2_int(buf_p); + if ((input < 0) || (input > 0xff)){ + return -EBFONT; + } + lock_transvr_obj(tobj_p); + err = set_func(tobj_p, input); + unlock_transvr_obj(tobj_p); + if (err < 0){ + return err; + } + return count; +} + + +static ssize_t +_store_transvr_binary_attr(struct transvr_obj_s* tobj_p, + int (*set_func)(struct transvr_obj_s *tobj_p, int input_val), + const char *buf_p, + size_t count) { + int input, err; + + input = sscanf_2_binary(buf_p); + if (input < 0){ + return -EBFONT; + } + lock_transvr_obj(tobj_p); + err = set_func(tobj_p, input); + unlock_transvr_obj(tobj_p); + if (err < 0){ + return err; + } + return count; +} + + +static ssize_t +store_attr_cdr(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_byte_hex_attr(tobj_p, + tobj_p->set_cdr, + buf_p, + count); +} + + +static ssize_t +store_attr_soft_rs0(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_binary_attr(tobj_p, + tobj_p->set_soft_rs0, + buf_p, + count); +} + + +static ssize_t +store_attr_soft_rs1(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_binary_attr(tobj_p, + tobj_p->set_soft_rs1, + buf_p, + count); +} + + +static ssize_t +store_attr_soft_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count) { + + int check = sscanf_2_int(buf_p); + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + if ((check < 0) || (check > 0xf)){ + return -EBFONT; + } + return _store_transvr_byte_hex_attr(tobj_p, + tobj_p->set_soft_tx_disable, + buf_p, + count); +} + + +static ssize_t +store_attr_auto_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count) { + + int err = -EPERM; + int input = sscanf_2_int(buf_p); + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + if ((input < 0) || (input > 0xf)){ + if (input != VAL_TRANSVR_FUNCTION_DISABLE) { + return -EBFONT; + } + } + lock_transvr_obj(tobj_p); + err = tobj_p->set_auto_tx_disable(tobj_p, input); + unlock_transvr_obj(tobj_p); + if (err < 0){ + return err; + } + return count; +} + + +static ssize_t +store_attr_tx_eq(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_int_attr(tobj_p, + tobj_p->set_tx_eq, + buf_p, + count); +} + + +static ssize_t +store_attr_rx_am(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_int_attr(tobj_p, + tobj_p->set_rx_am, + buf_p, + count); +} + + +static ssize_t +store_attr_rx_em(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_int_attr(tobj_p, + tobj_p->set_rx_em, + buf_p, + count); +} + + +static ssize_t +store_attr_extphy_offset(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_int_attr(tobj_p, + tobj_p->set_extphy_offset, + buf_p, + count); +} + + +static ssize_t +store_attr_extphy_reg(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _store_transvr_int_attr(tobj_p, + tobj_p->set_extphy_reg, + buf_p, + count); +} + +/* ========== Show functions: For I/O Expander attribute ========== + */ +static ssize_t +_show_ioexp_binary_attr(struct transvr_obj_s *tobj_p, + int (*get_func)(struct ioexp_obj_s *ioexp_p, int voffset), + char *buf_p) { + size_t len; + struct ioexp_obj_s *ioexp_p = tobj_p->ioexp_obj_p; + + if (!ioexp_p) { + SWPS_ERR(" %s: data corruption! :%s\n", __func__, tobj_p->swp_name); + return -ENODATA; + } + mutex_lock(&ioexp_p->lock); + len = snprintf(buf_p, 8, "%d\n", get_func(ioexp_p, tobj_p->ioexp_virt_offset)); + mutex_unlock(&ioexp_p->lock); + return len; +} + + +static ssize_t +show_attr_present(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_present, + buf_p); +} + + +static ssize_t +show_attr_tx_fault(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_tx_fault, + buf_p); +} + + +static ssize_t +show_attr_rxlos(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_rxlos, + buf_p); +} + + +static ssize_t +show_attr_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_tx_disable, + buf_p); +} + + +static ssize_t +show_attr_reset(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_reset, + buf_p); +} + + +static ssize_t +show_attr_lpmod(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_lpmod, + buf_p); +} + + +static ssize_t +show_attr_modsel(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_modsel, + buf_p); +} + + +static ssize_t +show_attr_hard_rs0(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_hard_rs0, + buf_p); +} + + +static ssize_t +show_attr_hard_rs1(struct device *dev_p, + struct device_attribute *attr_p, + char *buf_p){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p){ + return -ENODEV; + } + return _show_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->get_hard_rs1, + buf_p); +} + + +/* ========== Store functions: For I/O Expander (R/W) attribute ========== + */ +static ssize_t +_store_ioexp_binary_attr(struct transvr_obj_s *tobj_p, + int (*set_func)(struct ioexp_obj_s *ioexp_p, + int virt_offset, int input_val), + const char *buf_p, + size_t count) { + + int input, err; + struct ioexp_obj_s *ioexp_p = tobj_p->ioexp_obj_p; + + if (!ioexp_p) { + SWPS_ERR("%s: data corruption! :%s\n", + __func__, tobj_p->swp_name); + return -ENODATA; + } + input = sscanf_2_binary(buf_p); + if (input < 0) { + return -EBFONT; + } + mutex_lock(&ioexp_p->lock); + err = set_func(ioexp_p, tobj_p->ioexp_virt_offset, input); + mutex_unlock(&ioexp_p->lock); + if (err < 0){ + return err; + } + return count; +} + +static ssize_t +store_attr_tx_disable(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_tx_disable, + buf_p, + count); +} + + +static ssize_t +store_attr_reset(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_reset, + buf_p, + count); +} + + +static ssize_t +store_attr_lpmod(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_lpmod, + buf_p, + count); +} + + +static ssize_t +store_attr_modsel(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_modsel, + buf_p, + count); +} + + +static ssize_t +store_attr_hard_rs0(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_hard_rs0, + buf_p, + count); +} + + +static ssize_t +store_attr_hard_rs1(struct device *dev_p, + struct device_attribute *attr_p, + const char *buf_p, + size_t count){ + + struct transvr_obj_s *tobj_p = dev_get_drvdata(dev_p); + if (!tobj_p) { + return -ENODEV; + } + return _store_ioexp_binary_attr(tobj_p, + tobj_p->ioexp_obj_p->set_hard_rs1, + buf_p, + count); +} + + +/* ========== SWPS attribute: For module control ========== + */ +static DEVICE_ATTR(platform, S_IRUGO, show_attr_platform, NULL); +static DEVICE_ATTR(version, S_IRUGO, show_attr_version, NULL); +static DEVICE_ATTR(status, S_IRUGO, show_attr_status, NULL); +static DEVICE_ATTR(reset_i2c, S_IWUSR, NULL, store_attr_reset_i2c); +static DEVICE_ATTR(reset_swps, S_IWUSR, NULL, store_attr_reset_swps); +static DEVICE_ATTR(auto_config, S_IRUGO|S_IWUSR, show_attr_auto_config, store_attr_auto_config); + +/* ========== Transceiver attribute: from eeprom ========== + */ +static DEVICE_ATTR(id, S_IRUGO, show_attr_id, NULL); +static DEVICE_ATTR(ext_id, S_IRUGO, show_attr_ext_id, NULL); +static DEVICE_ATTR(connector, S_IRUGO, show_attr_connector, NULL); +static DEVICE_ATTR(vendor_name, S_IRUGO, show_attr_vendor_name, NULL); +static DEVICE_ATTR(vendor_pn, S_IRUGO, show_attr_vendor_pn, NULL); +static DEVICE_ATTR(vendor_rev, S_IRUGO, show_attr_vendor_rev, NULL); +static DEVICE_ATTR(vendor_sn, S_IRUGO, show_attr_vendor_sn, NULL); +static DEVICE_ATTR(power_cls, S_IRUGO, show_attr_power_cls, NULL); +static DEVICE_ATTR(br, S_IRUGO, show_attr_br, NULL); +static DEVICE_ATTR(len_sm, S_IRUGO, show_attr_len_sm, NULL); +static DEVICE_ATTR(len_smf, S_IRUGO, show_attr_len_smf, NULL); +static DEVICE_ATTR(len_om1, S_IRUGO, show_attr_len_om1, NULL); +static DEVICE_ATTR(len_om2, S_IRUGO, show_attr_len_om2, NULL); +static DEVICE_ATTR(len_om3, S_IRUGO, show_attr_len_om3, NULL); +static DEVICE_ATTR(len_om4, S_IRUGO, show_attr_len_om4, NULL); +static DEVICE_ATTR(comp_rev, S_IRUGO, show_attr_comp_rev, NULL); +static DEVICE_ATTR(comp_eth, S_IRUGO, show_attr_comp_eth, NULL); +static DEVICE_ATTR(comp_eth_10, S_IRUGO, show_attr_comp_eth_10, NULL); +static DEVICE_ATTR(comp_eth_10_40, S_IRUGO, show_attr_comp_eth_10_40, NULL); +static DEVICE_ATTR(comp_extend, S_IRUGO, show_attr_comp_extend, NULL); +static DEVICE_ATTR(rate_id, S_IRUGO, show_attr_rate_id, NULL); +static DEVICE_ATTR(temperature, S_IRUGO, show_attr_temperature, NULL); +static DEVICE_ATTR(voltage, S_IRUGO, show_attr_voltage, NULL); +static DEVICE_ATTR(tx_bias, S_IRUGO, show_attr_tx_bias, NULL); +static DEVICE_ATTR(tx_power, S_IRUGO, show_attr_tx_power, NULL); +static DEVICE_ATTR(rx_power, S_IRUGO, show_attr_rx_power, NULL); +static DEVICE_ATTR(info, S_IRUGO, show_attr_info, NULL); +static DEVICE_ATTR(if_type, S_IRUGO, show_attr_if_type, NULL); +static DEVICE_ATTR(if_speed, S_IRUGO, show_attr_if_speed, NULL); +static DEVICE_ATTR(if_lane, S_IRUGO, show_attr_if_lane, NULL); +static DEVICE_ATTR(soft_rx_los, S_IRUGO, show_attr_soft_rx_los, NULL); +static DEVICE_ATTR(soft_tx_fault, S_IRUGO, show_attr_soft_tx_fault, NULL); +static DEVICE_ATTR(wavelength, S_IRUGO, show_attr_wavelength, NULL); +static DEVICE_ATTR(tx_eq, S_IRUGO|S_IWUSR, show_attr_tx_eq, store_attr_tx_eq); +static DEVICE_ATTR(rx_am, S_IRUGO|S_IWUSR, show_attr_rx_am, store_attr_rx_am); +static DEVICE_ATTR(rx_em, S_IRUGO|S_IWUSR, show_attr_rx_em, store_attr_rx_em); +static DEVICE_ATTR(cdr, S_IRUGO|S_IWUSR, show_attr_cdr, store_attr_cdr); +static DEVICE_ATTR(soft_rs0, S_IRUGO|S_IWUSR, show_attr_soft_rs0, store_attr_soft_rs0); +static DEVICE_ATTR(soft_rs1, S_IRUGO|S_IWUSR, show_attr_soft_rs1, store_attr_soft_rs1); +static DEVICE_ATTR(soft_tx_disable, S_IRUGO|S_IWUSR, show_attr_soft_tx_disable, store_attr_soft_tx_disable); +static DEVICE_ATTR(auto_tx_disable, S_IRUGO|S_IWUSR, show_attr_auto_tx_disable, store_attr_auto_tx_disable); +static DEVICE_ATTR(extphy_offset, S_IRUGO|S_IWUSR, show_attr_extphy_offset, store_attr_extphy_offset); +static DEVICE_ATTR(extphy_reg, S_IRUGO|S_IWUSR, show_attr_extphy_reg, store_attr_extphy_reg); + +/* ========== IO Expander attribute: from expander ========== + */ +static DEVICE_ATTR(present, S_IRUGO, show_attr_present, NULL); +static DEVICE_ATTR(tx_fault, S_IRUGO, show_attr_tx_fault, NULL); +static DEVICE_ATTR(rxlos, S_IRUGO, show_attr_rxlos, NULL); +static DEVICE_ATTR(tx_disable, S_IRUGO|S_IWUSR, show_attr_tx_disable, store_attr_tx_disable); +static DEVICE_ATTR(reset, S_IRUGO|S_IWUSR, show_attr_reset, store_attr_reset); +static DEVICE_ATTR(lpmod, S_IRUGO|S_IWUSR, show_attr_lpmod, store_attr_lpmod); +static DEVICE_ATTR(modsel, S_IRUGO|S_IWUSR, show_attr_modsel, store_attr_modsel); +static DEVICE_ATTR(hard_rs0, S_IRUGO|S_IWUSR, show_attr_hard_rs0, store_attr_hard_rs0); +static DEVICE_ATTR(hard_rs1, S_IRUGO|S_IWUSR, show_attr_hard_rs1, store_attr_hard_rs1); + +/* ========== Functions for module handling ========== + */ +static void +clean_port_obj(void){ + + dev_t dev_num; + char dev_name[32]; + struct device *device_p; + struct transvr_obj_s *transvr_obj_p; + int minor_curr, port_id; + + for (minor_curr=0; minor_curri2c_client_p); + kfree(transvr_obj_p->vendor_name); + kfree(transvr_obj_p->vendor_pn); + kfree(transvr_obj_p->vendor_rev); + kfree(transvr_obj_p->vendor_sn); + kfree(transvr_obj_p->worker_p); + kfree(transvr_obj_p); + } + dev_num = MKDEV(port_major, minor_curr); + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); + } + SWPS_DEBUG("%s: done.\n", __func__); +} + + +static void +clean_swps_common(void){ + + dev_t dev_num; + struct device *device_p; + + device_p = get_swpdev_by_name(SWP_DEV_MODCTL); + if (device_p){ + dev_num = MKDEV(ctl_major, 1); + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); + } + cancel_delayed_work_sync(&swp_polling); + SWPS_DEBUG("%s: done.\n", __func__); +} + + +static int +get_platform_type(void){ + + int i; + int pf_total = ARRAY_SIZE(platform_map); + char log_msg[64] = "ERROR"; + + platform_p = kzalloc(sizeof(struct inv_platform_s), GFP_KERNEL); + if (!platform_p){ + snprintf(log_msg, sizeof(log_msg), "kzalloc fail"); + goto err_get_platform_type_1; + } + memset(platform_p->name, 0, sizeof(platform_p->name)); + + switch (PLATFORM_SETTINGS) { + case PLATFORM_TYPE_AUTO: + snprintf(platform_p->name, (sizeof(platform_p->name) - 1), + "%s", dmi_get_system_info(DMI_BOARD_NAME)); + for (i=0; iname, platform_map[i].name) == 0) { + platform_p->id = platform_map[i].id; + snprintf(log_msg, sizeof(log_msg), + "Auto detect platform: %d (%s)", + platform_p->id, platform_p->name); + goto ok_get_platform_type_1; + } + } + snprintf(log_msg, sizeof(log_msg), + "Auto detect fail! detect platform: %s", + platform_p->name); + goto err_get_platform_type_2; + + case PLATFORM_TYPE_MAGNOLIA: + case PLATFORM_TYPE_MAGNOLIA_FNC: + case PLATFORM_TYPE_REDWOOD: + case PLATFORM_TYPE_REDWOOD_FSL: + case PLATFORM_TYPE_HUDSON32I_GA: + case PLATFORM_TYPE_SPRUCE: + case PLATFORM_TYPE_CYPRESS_GA1: + case PLATFORM_TYPE_CYPRESS_GA2: + case PLATFORM_TYPE_CYPRESS_BAI: + case PLATFORM_TYPE_TAHOE: + case PLATFORM_TYPE_SEQUOIA_GA: + case PLATFORM_TYPE_LAVENDER_GA: + case PLATFORM_TYPE_LAVENDER_ONL: + case PLATFORM_TYPE_COTTONWOOD_RANGELEY: + case PLATFORM_TYPE_MAPLE: + platform_p->id = PLATFORM_SETTINGS; + for (i=0; iname, (sizeof(platform_p->name) - 1), + "%s", platform_map[i].name); + snprintf(log_msg, sizeof(log_msg), + "User setup platform: %d (%s)", + platform_p->id, platform_p->name); + goto ok_get_platform_type_1; + } + } + snprintf(log_msg, sizeof(log_msg), + "Internal error, can not map id:%d", + PLATFORM_SETTINGS); + goto err_get_platform_type_2; + + default: + break; + } + snprintf(log_msg, sizeof(log_msg), + "PLATFORM_SETTINGS:%d undefined", PLATFORM_SETTINGS); + goto err_get_platform_type_2; + +ok_get_platform_type_1: + SWPS_DEBUG("%s: %s, :%d\n", __func__, log_msg, PLATFORM_SETTINGS); + return 0; + +err_get_platform_type_2: + kfree(platform_p); +err_get_platform_type_1: + SWPS_ERR("%s: %s :%d\n", __func__, log_msg, PLATFORM_SETTINGS); + return -1; +} + + +static int +get_layout_info(void){ + + switch (platform_p->id) { +#ifdef SWPS_MAGNOLIA + case PLATFORM_TYPE_MAGNOLIA: + case PLATFORM_TYPE_MAGNOLIA_FNC: + gpio_rest_mux = magnolia_gpio_rest_mux; + ioexp_layout = magnolia_ioexp_layout; + port_layout = magnolia_port_layout; + ioexp_total = ARRAY_SIZE(magnolia_ioexp_layout); + port_total = ARRAY_SIZE(magnolia_port_layout); + break; +#endif +#ifdef SWPS_REDWOOD + case PLATFORM_TYPE_REDWOOD: + gpio_rest_mux = redwood_gpio_rest_mux; + ioexp_layout = redwood_ioexp_layout; + port_layout = redwood_port_layout; + ioexp_total = ARRAY_SIZE(redwood_ioexp_layout); + port_total = ARRAY_SIZE(redwood_port_layout); + break; +#endif +#ifdef SWPS_HUDSON32I_GA + case PLATFORM_TYPE_HUDSON32I_GA: + gpio_rest_mux = hudsin32iga_gpio_rest_mux; + ioexp_layout = hudson32iga_ioexp_layout; + port_layout = hudson32iga_port_layout; + ioexp_total = ARRAY_SIZE(hudson32iga_ioexp_layout); + port_total = ARRAY_SIZE(hudson32iga_port_layout); + break; +#endif +#ifdef SWPS_SPRUCE + case PLATFORM_TYPE_SPRUCE: + gpio_rest_mux = spruce_gpio_rest_mux; + ioexp_layout = spruce_ioexp_layout; + port_layout = spruce_port_layout; + ioexp_total = ARRAY_SIZE(spruce_ioexp_layout); + port_total = ARRAY_SIZE(spruce_port_layout); + break; +#endif +#ifdef SWPS_CYPRESS_GA1 + case PLATFORM_TYPE_CYPRESS_GA1: + gpio_rest_mux = cypress_ga1_gpio_rest_mux; + ioexp_layout = cypress_ga1_ioexp_layout; + port_layout = cypress_ga1_port_layout; + ioexp_total = ARRAY_SIZE(cypress_ga1_ioexp_layout); + port_total = ARRAY_SIZE(cypress_ga1_port_layout); + break; +#endif +#ifdef SWPS_CYPRESS_GA2 + case PLATFORM_TYPE_CYPRESS_GA2: + gpio_rest_mux = cypress_ga2_gpio_rest_mux; + ioexp_layout = cypress_ga2_ioexp_layout; + port_layout = cypress_ga2_port_layout; + ioexp_total = ARRAY_SIZE(cypress_ga2_ioexp_layout); + port_total = ARRAY_SIZE(cypress_ga2_port_layout); + break; +#endif +#ifdef SWPS_CYPRESS_BAI + case PLATFORM_TYPE_CYPRESS_BAI: + gpio_rest_mux = cypress_b_gpio_rest_mux; + ioexp_layout = cypress_b_ioexp_layout; + port_layout = cypress_b_port_layout; + ioexp_total = ARRAY_SIZE(cypress_b_ioexp_layout); + port_total = ARRAY_SIZE(cypress_b_port_layout); + break; +#endif +#ifdef SWPS_REDWOOD_FSL + case PLATFORM_TYPE_REDWOOD_FSL: + gpio_rest_mux = redwood_fsl_gpio_rest_mux; + ioexp_layout = redwood_fsl_ioexp_layout; + port_layout = redwood_fsl_port_layout; + ioexp_total = ARRAY_SIZE(redwood_fsl_ioexp_layout); + port_total = ARRAY_SIZE(redwood_fsl_port_layout); + break; +#endif +#ifdef SWPS_TAHOE + case PLATFORM_TYPE_TAHOE: + gpio_rest_mux = tahoe_gpio_rest_mux; + ioexp_layout = tahoe_ioexp_layout; + port_layout = tahoe_port_layout; + ioexp_total = ARRAY_SIZE(tahoe_ioexp_layout); + port_total = ARRAY_SIZE(tahoe_port_layout); + break; +#endif +#ifdef SWPS_SEQUOIA + case PLATFORM_TYPE_SEQUOIA_GA: + gpio_rest_mux = sequoia_gpio_rest_mux; + ioexp_layout = sequoia_ioexp_layout; + port_layout = sequoia_port_layout; + ioexp_total = ARRAY_SIZE(sequoia_ioexp_layout); + port_total = ARRAY_SIZE(sequoia_port_layout); + break; +#endif +#ifdef SWPS_LAVENDER + case PLATFORM_TYPE_LAVENDER_GA: + case PLATFORM_TYPE_LAVENDER_ONL: + gpio_rest_mux = lavender_gpio_rest_mux; + ioexp_layout = lavender_ioexp_layout; + port_layout = lavender_port_layout; + ioexp_total = ARRAY_SIZE(lavender_ioexp_layout); + port_total = ARRAY_SIZE(lavender_port_layout); + break; +#endif +#ifdef SWPS_COTTONWOOD_RANGELEY + case PLATFORM_TYPE_COTTONWOOD_RANGELEY: + gpio_rest_mux = cottonwood_rangeley_gpio_rest_mux; + ioexp_layout = cottonwood_rangeley_ioexp_layout; + port_layout = cottonwood_rangeley_port_layout; + ioexp_total = ARRAY_SIZE(cottonwood_rangeley_ioexp_layout); + port_total = ARRAY_SIZE(cottonwood_rangeley_port_layout); + break; +#endif +#ifdef SWPS_MAPLE + case PLATFORM_TYPE_MAPLE: + gpio_rest_mux = maple_gpio_rest_mux; + ioexp_layout = maple_ioexp_layout; + port_layout = maple_port_layout; + ioexp_total = ARRAY_SIZE(maple_ioexp_layout); + port_total = ARRAY_SIZE(maple_port_layout); + break; +#endif + default: + SWPS_ERR(" Invalid platform: %d (%s)\n", + platform_p->id, platform_p->name); + return -1; + } + SWPS_INFO("Start to initial platform: %d (%s)\n", + platform_p->id, platform_p->name); + return 0; +} + + +/* ========== Functions for objects operations ========== + */ +static int +__detect_issues_port(int minor_num) { + + struct transvr_obj_s *tobj_p; + int port_id = port_layout[minor_num].port_id; + char port_name[32] = "ERR"; + char *i2c_emsg = "detected bad transceiver/cable"; + + memset(port_name, 0, sizeof(port_name)); + snprintf(port_name, sizeof(port_name), "%s%d", SWP_DEV_PORT, port_id); + tobj_p = _get_transvr_obj(port_name); + if (!tobj_p) { + SWPS_INFO("%s: tobj_p is NULL :%d\n", __func__, minor_num); + return -1; + } + if (resync_channel_tier_2(tobj_p) < 0) { + if (check_channel_tier_1() < 0) { + alarm_msg_2_user(tobj_p, i2c_emsg); + return -2;; + } + } + return 0; +} + + +static int +_detect_issues_port(void) { + /* OK : retrun -1; + * Fail: return fail at which minor number (0~N) + */ + char *emsg = "ERR"; + int minor = 0; + int minor_2st = 1; + + /* Force moving the initial channel pointer + * Filter out case of fail at minor-0 port + */ + while (minor_2st < port_total) { + minor = minor_2st; + if (__detect_issues_port(minor_2st) < 0) { + emsg = "detect minor_2st fail"; + goto err_p_detect_issues_port; + } + minor_2st += 8; + } + /* Scan all port */ + for (minor=0; minor:%d\n", __func__, emsg, minor_err); + return -1; +} + + +static int +check_transvr_obj_one(char *dev_name){ + /* [Return] + * 0 : Doesn't need to take care + * -1 : Single error + * -2 : Critical error (I2C topology die) + * -9 : Internal error + */ + struct transvr_obj_s *tobj_p = NULL; + int retval = -9; + + tobj_p = _get_transvr_obj(dev_name); + if (!tobj_p) { + SWPS_ERR("%s: %s _get_transvr_obj fail\n", + __func__, dev_name); + return -9; + } + /* Check transceiver current status */ + lock_transvr_obj(tobj_p); + retval = tobj_p->check(tobj_p); + unlock_transvr_obj(tobj_p); + switch (retval) { + case 0: + case ERR_TRANSVR_UNPLUGGED: + case ERR_TRNASVR_BE_ISOLATED: + case ERR_TRANSVR_TASK_BUSY: + return 0; + + case ERR_TRANSVR_I2C_CRASH: + default: + break; + } + /* Identify abnormal case */ + if (check_channel_tier_1() < 0) { + SWPS_DEBUG("%s: %s critical error :%d\n", + __func__, dev_name, retval); + return -2; + } + SWPS_DEBUG("%s: %s single error :%d\n", + __func__, dev_name, retval); + return -1; +} + + +static int +check_transvr_objs(void){ + + char dev_name[32]; + int port_id, err_code; + int minor_curr = 0; + + for (minor_curr=0; minor_curr:%d\n", + __func__, dev_name, err_code); + break; + } + } + return 0; + +err_check_transvr_objs: + SWPS_ERR("%s: %s reset_i2c_topology fail.\n", + __func__, dev_name); + return -1; +} + + +static void +swp_polling_worker(struct work_struct *work){ + + /* Reset I2C */ + if (flag_i2c_reset) { + goto polling_reset_i2c; + } + /* Check IOEXP */ + if (check_ioexp_objs() < 0) { + goto polling_reset_i2c; + } + /* Check transceiver */ + if (check_transvr_objs() < 0) { + SWPS_DEBUG("%s: check_transvr_objs fail.\n", __func__); + flag_i2c_reset = 1; + } + goto polling_schedule_round; + +polling_reset_i2c: + SWPS_DEBUG("%s: reset_i2c_topology start.\n", __func__); + if (reset_i2c_topology() < 0) { + SWPS_ERR("%s: reset i2c fail!\n", __func__); + flag_i2c_reset = 1; + } else { + SWPS_DEBUG("%s: reset_i2c_topology OK.\n", __func__); + flag_i2c_reset = 0; + } +polling_schedule_round: + schedule_delayed_work(&swp_polling, _get_polling_period()); +} + + +/* ========== Functions for register something ========== + */ +static int +register_transvr_common_attr(struct device *device_p){ + + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_id) < 0) { + err_attr = "dev_attr_id"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_ext_id) < 0) { + err_attr = "dev_attr_ext_id"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_connector) < 0) { + err_attr = "dev_attr_connector"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_vendor_name) < 0) { + err_attr = "dev_attr_vendor_name"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_vendor_pn) < 0) { + err_attr = "dev_attr_vendor_pn"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_vendor_rev) < 0) { + err_attr = "dev_attr_vendor_rev"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_vendor_sn) < 0) { + err_attr = "dev_attr_vendor_sn"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_br) < 0) { + err_attr = "dev_attr_br"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_len_smf) < 0) { + err_attr = "dev_attr_len_smf"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_len_om1) < 0) { + err_attr = "dev_attr_len_om1"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_len_om2) < 0) { + err_attr = "dev_attr_len_om2"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_len_om3) < 0) { + err_attr = "dev_attr_len_om3"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_len_om4) < 0) { + err_attr = "dev_attr_len_om4"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_comp_extend) < 0) { + err_attr = "dev_attr_comp_extend"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_comp_eth) < 0) { + err_attr = "dev_attr_comp_eth"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_comp_rev) < 0) { + err_attr = "dev_attr_comp_rev"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_info) < 0) { + err_attr = "dev_attr_info"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_if_type) < 0) { + err_attr = "dev_attr_if_type"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_if_speed) < 0) { + err_attr = "dev_attr_if_speed"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_if_lane) < 0) { + err_attr = "dev_attr_if_lane"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_temperature) < 0) { + err_attr = "dev_attr_temperature"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_voltage) < 0) { + err_attr = "dev_attr_voltage"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_tx_bias) < 0) { + err_attr = "dev_attr_tx_bias"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_tx_power) < 0) { + err_attr = "dev_attr_tx_power"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_rx_power) < 0) { + err_attr = "dev_attr_rx_power"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_tx_eq) < 0) { + err_attr = "dev_attr_tx_eq"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_rx_em) < 0) { + err_attr = "dev_attr_rx_em"; + goto err_transvr_comm_attr; + } + if (device_create_file(device_p, &dev_attr_wavelength) < 0) { + err_attr = "dev_attr_wavelength"; + goto err_transvr_comm_attr; + } + return 0; + +err_transvr_comm_attr: + SWPS_ERR("%s: %s\n", __func__, err_attr); + return -1; +} + +static int +register_transvr_sfp_attr(struct device *device_p){ + + char *err_attr = NULL; + + if (register_transvr_common_attr(device_p) < 0) { + err_attr = "register_transvr_common_attr"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_comp_eth_10) < 0) { + err_attr = "dev_attr_comp_eth_10"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_len_sm) < 0) { + err_attr = "dev_attr_len_sm"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_rate_id) < 0) { + err_attr = "dev_attr_rate_id"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_soft_rs0) < 0) { + err_attr = "dev_attr_soft_rs0"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_soft_rs1) < 0) { + err_attr = "dev_attr_soft_rs1"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_extphy_offset) < 0) { + err_attr = "dev_attr_extphy_offset"; + goto err_transvr_sfp_attr; + } + if (device_create_file(device_p, &dev_attr_extphy_reg) < 0) { + err_attr = "dev_attr_extphy_reg"; + goto err_transvr_sfp_attr; + } + return 0; + +err_transvr_sfp_attr: + SWPS_ERR("%s: %s\n", __func__, err_attr); + return -1; +} + + +static int +register_transvr_qsfp_attr(struct device *device_p){ + + char *err_attr = NULL; + + if (register_transvr_common_attr(device_p) < 0) { + err_attr = "register_transvr_common_attr"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_comp_eth_10_40) < 0) { + err_attr = "dev_attr_comp_eth_10_40"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_power_cls) < 0) { + err_attr = "dev_attr_power_cls"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_soft_rx_los) < 0) { + err_attr = "soft_rx_los"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_soft_tx_disable) < 0) { + err_attr = "soft_tx_disable"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_auto_tx_disable) < 0) { + err_attr = "auto_tx_disable"; + goto err_transvr_qsfp_attr; + } + if (device_create_file(device_p, &dev_attr_soft_tx_fault) < 0) { + err_attr = "soft_tx_fault"; + goto err_transvr_qsfp_attr; + } + return 0; + +err_transvr_qsfp_attr: + SWPS_ERR("%s: %s\n", __func__, err_attr); + return -1; +} + + +static int +register_transvr_qsfp28_attr(struct device *device_p){ + + char *err_attr = NULL; + + if (register_transvr_qsfp_attr(device_p) < 0){ + err_attr = "register_transvr_qsfp_attr"; + goto err_transvr_qsfp28_attr; + } + if (device_create_file(device_p, &dev_attr_cdr) < 0) { + err_attr = "dev_attr_cdr"; + goto err_transvr_qsfp28_attr; + } + if (device_create_file(device_p, &dev_attr_rx_am) < 0) { + err_attr = "dev_attr_rx_am"; + goto err_transvr_qsfp28_attr; + } + return 0; + +err_transvr_qsfp28_attr: + SWPS_ERR("%s: %s\n", __func__, err_attr); + return -1; +} + + +static int +register_transvr_attr(struct device *device_p, + struct transvr_obj_s *transvr_obj){ + + switch (transvr_obj->layout){ + case TRANSVR_TYPE_SFP: + if (register_transvr_sfp_attr(device_p) < 0){ + goto err_reg_tvr_attr; + } + break; + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + if (register_transvr_qsfp_attr(device_p) < 0){ + goto err_reg_tvr_attr; + } + break; + case TRANSVR_TYPE_QSFP_28: + if (register_transvr_qsfp28_attr(device_p) < 0){ + goto err_reg_tvr_attr; + } + break; + default: + goto err_reg_tvr_attr; + } + return 0; + +err_reg_tvr_attr: + SWPS_ERR("%s: fail! type=%d \n", __func__, transvr_obj->type); + return -1; +} + + +static int +register_ioexp_attr_sfp_1(struct device *device_p){ + /* Support machine type: + * - SFP : Magnolia + */ + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_present) < 0) { + err_attr = "dev_attr_present"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_tx_fault) < 0) { + err_attr = "dev_attr_tx_fault"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_rxlos) < 0) { + err_attr = "dev_attr_rxlos"; + goto err_ioexp_sfp1_attr; + } + if (device_create_file(device_p, &dev_attr_tx_disable) < 0) { + err_attr = "dev_attr_tx_disable"; + goto err_ioexp_sfp1_attr; + } + return 0; + +err_ioexp_sfp1_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + + +static int +register_ioexp_attr_sfp_2(struct device *device_p){ + /* Support machine type: + * - SFP28 : Cypress + */ + char *err_attr = NULL; + + if (register_ioexp_attr_sfp_1(device_p) < 0){ + goto err_ioexp_sfp2_attr; + } + if (device_create_file(device_p, &dev_attr_hard_rs0) < 0) { + err_attr = "dev_attr_hard_rs0"; + goto err_ioexp_sfp2_attr; + } + if (device_create_file(device_p, &dev_attr_hard_rs1) < 0) { + err_attr = "dev_attr_hard_rs1"; + goto err_ioexp_sfp2_attr; + } + return 0; + +err_ioexp_sfp2_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + + +static int +register_ioexp_attr_qsfp_1(struct device *device_p){ + /* Support machine type: + * - QSFP : Magnolia, Redwood, Hudson32i + * - QSFP+ : Magnolia, Redwood, Hudson32i + * - QSFP28: Redwood + */ + char *err_attr = NULL; + + if (device_create_file(device_p, &dev_attr_present) < 0) { + err_attr = "dev_attr_present"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_reset) < 0) { + err_attr = "dev_attr_reset"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_lpmod) < 0) { + err_attr = "dev_attr_lpmod"; + goto err_ioexp_qsfp1_attr; + } + if (device_create_file(device_p, &dev_attr_modsel) < 0) { + err_attr = "dev_attr_modsel"; + goto err_ioexp_qsfp1_attr; + } + return 0; + +err_ioexp_qsfp1_attr: + SWPS_ERR("Add device attribute:%s failure! \n",err_attr); + return -1; +} + + +static int +register_modctl_attr(struct device *device_p){ + + char *err_msg = NULL; + + if (device_create_file(device_p, &dev_attr_platform) < 0) { + err_msg = "dev_attr_platform"; + goto err_reg_modctl_attr; + } + if (device_create_file(device_p, &dev_attr_version) < 0) { + err_msg = "dev_attr_version"; + goto err_reg_modctl_attr; + } + if (device_create_file(device_p, &dev_attr_status) < 0) { + err_msg = "dev_attr_status"; + goto err_reg_modctl_attr; + } + if (device_create_file(device_p, &dev_attr_reset_i2c) < 0) { + err_msg = "dev_attr_reset_i2c"; + goto err_reg_modctl_attr; + } + if (device_create_file(device_p, &dev_attr_reset_swps) < 0) { + err_msg = "dev_attr_reset_swps"; + goto err_reg_modctl_attr; + } + if (device_create_file(device_p, &dev_attr_auto_config) < 0) { + err_msg = "dev_attr_auto_config"; + goto err_reg_modctl_attr; + } + return 0; + +err_reg_modctl_attr: + SWPS_ERR("%s: %s\n", __func__, err_msg); + return -1; +} + + +static int +register_ioexp_attr(struct device *device_p, + struct transvr_obj_s *transvr_obj){ + + char *err_msg = "ERR"; + + switch (transvr_obj->ioexp_obj_p->ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + case IOEXP_TYPE_MAGINOLIA_4AB: + case CPLD_TYPE_COTTONWOOD: + if (register_ioexp_attr_sfp_1(device_p) < 0){ + err_msg = "register_ioexp_attr_sfp_1 fail"; + goto err_reg_ioexp_attr; + } + break; + case IOEXP_TYPE_CYPRESS_NABC: + case IOEXP_TYPE_MAPLE_NABC: + if (register_ioexp_attr_sfp_2(device_p) < 0){ + err_msg = "register_ioexp_attr_sfp_2 fail"; + goto err_reg_ioexp_attr; + } + break; + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + case IOEXP_TYPE_CYPRESS_7ABC: + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + case IOEXP_TYPE_HUDSON32IGA_P01P08: + case IOEXP_TYPE_HUDSON32IGA_P09P16: + case IOEXP_TYPE_TAHOE_5A: + case IOEXP_TYPE_TAHOE_6ABC: + case IOEXP_TYPE_SEQUOIA_NABC: + case IOEXP_TYPE_LAVENDER_P65: + case IOEXP_TYPE_MAPLE_0ABC: + if (register_ioexp_attr_qsfp_1(device_p) < 0){ + err_msg = "register_ioexp_attr_qsfp_1 fail"; + goto err_reg_ioexp_attr; + } + break; + + default: + err_msg = "Unknow type"; + goto err_reg_ioexp_attr; + } + return 0; + +err_reg_ioexp_attr: + SWPS_ERR("%s: %s :%d \n", + __func__, err_msg, transvr_obj->ioexp_obj_p->ioexp_type); + return -1; +} + + +static int +register_modctl_device(void) { + + struct device *device_p = NULL; + int minor_comm = 0; /* Default minor number for common device */ + dev_t dev_num = MKDEV(ctl_major, minor_comm); + char *err_msg = "ERROR"; + + device_p = device_create(swp_class_p, /* struct class *cls */ + NULL, /* struct device *parent */ + dev_num, /* dev_t devt */ + NULL, /* void *private_data */ + SWP_DEV_MODCTL); /* const char *fmt */ + if (IS_ERR(device_p)){ + err_msg = "device_create fail"; + goto err_register_modctl_device_1; + } + if (register_modctl_attr(device_p) < 0) { + err_msg = "register_modctl_attr fail"; + goto err_register_modctl_device_2; + } + return 0; + +err_register_modctl_device_2: + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); +err_register_modctl_device_1: + SWPS_ERR("%s: %s\n", __func__, err_msg); + return -1; +} + + +static int +register_port_device(char *dev_name, + dev_t dev_num, + struct transvr_obj_s *transvr_obj){ + + struct device *device_p = NULL; + device_p = device_create(swp_class_p, /* struct class *cls */ + NULL, /* struct device *parent */ + dev_num, /* dev_t devt */ + transvr_obj, /* void *private_data */ + dev_name); /* const char *fmt */ + if (IS_ERR(device_p)){ + goto err_regswp_create_dev; + } + if (register_transvr_attr(device_p, transvr_obj) < 0){ + goto err_regswp_reg_attr; + } + if (register_ioexp_attr(device_p, transvr_obj) < 0){ + goto err_regswp_reg_attr; + } + return 0; + +err_regswp_reg_attr: + device_unregister(device_p); + device_destroy(swp_class_p, dev_num); +err_regswp_create_dev: + SWPS_ERR("%s fail! :%s\n", __func__, dev_name); + return -1; +} + + +static int +register_swp_module(void){ + + dev_t ctl_devt = 0; + dev_t port_devt = 0; + int dev_total = port_total + 1; /* char_dev for module control */ + + /* Register device number */ + if (alloc_chrdev_region(&ctl_devt, 0, 1, SWP_DEV_MODCTL) < 0){ + SWPS_WARN("Allocate CTL MAJOR failure! \n"); + goto err_register_swp_module_1; + } + if (alloc_chrdev_region(&port_devt, 0, dev_total, SWP_CLS_NAME) < 0){ + SWPS_WARN("Allocate PORT MAJOR failure! \n"); + goto err_register_swp_module_2; + } + ctl_major = MAJOR(ctl_devt); + port_major = MAJOR(port_devt); + + /* Create class object */ + swp_class_p = class_create(THIS_MODULE, SWP_CLS_NAME); + if (IS_ERR(swp_class_p)) { + SWPS_ERR("Create class failure! \n"); + goto err_register_swp_module_3; + } + return 0; + +err_register_swp_module_3: + unregister_chrdev_region(MKDEV(port_major, 0), port_total); +err_register_swp_module_2: + unregister_chrdev_region(MKDEV(ctl_major, 0), 1); +err_register_swp_module_1: + return -1; +} + + +/* ========== Module initial relate ========== + */ +static int +create_ioexp_objs(void) { + + int i, run_mod; + + /* Clean IOEXP object */ + clean_ioexp_objs(); + /* Get running mode */ + run_mod = IOEXP_MODE_DIRECT; + if (SWP_POLLING_ENABLE){ + run_mod = IOEXP_MODE_POLLING; + } + /* Create IOEXP object */ + for(i=0; i devlen_max) { + snprintf(err_msg, sizeof(err_msg), + "SWP_DEV_PORT too long!"); + goto err_initport_create_tranobj; + } + memset(dev_name, 0, sizeof(dev_name)); + snprintf(dev_name, devlen_max, "%s%d", SWP_DEV_PORT, port_id); + /* Create transceiver object */ + ioexp_obj_p = get_ioexp_obj(ioexp_id); + if (!ioexp_obj_p){ + snprintf(err_msg, sizeof(err_msg), + "IOEXP object:%d not exist", ioexp_id); + goto err_initport_create_tranobj; + } + transvr_obj_p = create_transvr_obj(dev_name, chan_id, ioexp_obj_p, + ioexp_virt_offset, transvr_type, + chipset_type, run_mod); + if (!transvr_obj_p){ + snprintf(err_msg, sizeof(err_msg), + "Create transceiver object fail :%s", dev_name); + goto err_initport_create_tranobj; + } + /* Setup Lane_ID mapping */ + i = ARRAY_SIZE(port_layout[minor_curr].lane_id); + j = ARRAY_SIZE(transvr_obj_p->lane_id); + if (i != j) { + snprintf(err_msg, sizeof(err_msg), + "Lane_id size inconsistent %d/%d", i, j); + goto err_initport_reg_device; + } + memcpy(transvr_obj_p->lane_id, port_layout[minor_curr].lane_id, i*sizeof(int)); + /* Create and register device object */ + if (register_port_device(dev_name, MKDEV(port_major, minor_curr), transvr_obj_p) < 0){ + snprintf(err_msg, sizeof(err_msg), + "register_port_device fail"); + goto err_initport_reg_device; + } + /* Setup device_ptr of transvr_obj */ + dev_p = get_swpdev_by_name(dev_name); + if (!dev_p){ + snprintf(err_msg, sizeof(err_msg), + "get_swpdev_by_name fail"); + goto err_initport_reg_device; + } + transvr_obj_p->transvr_dev_p = dev_p; + /* Success */ + ok_count++; + } + SWPS_INFO("%s: initialed %d port-dev",__func__, ok_count); + return 0; + +err_initport_reg_device: + kfree(transvr_obj_p); +err_initport_create_tranobj: + clean_port_obj(); + SWPS_ERR("%s: %s", __func__, err_msg); + SWPS_ERR("Dump: :%d :%d :%d :%d :%d :%d\n", + port_id, chan_id, ioexp_id, ioexp_virt_offset, transvr_type, run_mod); + return -1; +} + + +static int +init_dev_topology(void){ + + int err; + char *emsg = "ERR"; + flag_mod_state = SWP_STATE_NORMAL; + + err = init_ioexp_objs(); + switch(err){ + case 0: /* Normal */ + SWPS_DEBUG("%s: normal case\n", __func__); + break; + + case -1: /* topology error */ + SWPS_DEBUG("%s: detect tier-1 topology initial failure :%d\n", + __func__, err); + /* Reset and isolate */ + err = reset_i2c_topology(); + if (err < 0) { + emsg = "reset i2c topology fail"; + goto err_init_dev_topology; + } + /* Re-initial again */ + err = init_ioexp_objs(); + if (err < 0) { + emsg = "re-init ioexp objects fail"; + goto err_init_dev_topology; + } + break; + + case -2: /* Internal error */ + SWPS_DEBUG("%s: internal error case\n", __func__); + err = -2; + emsg = "internal error"; + goto err_init_dev_topology; + + default: + SWPS_DEBUG("%s: undefined error case\n", __func__); + emsg = "undefined error case"; + goto err_init_dev_topology; + } + SWPS_DEBUG("%s: initial I2C topology success\n", __func__); + return 0; + +err_init_dev_topology: + SWPS_ERR("%s: %s :%d\n", __func__, emsg, err); + return -1; +} + + +static int +init_polling_task(void){ + + if (SWP_POLLING_ENABLE){ + schedule_delayed_work(&swp_polling, _get_polling_period()); + } + return 0; +} + + +static int +init_swps_common(void){ + + char *err_msg = "ERR"; + + auto_config = 0; + if ((SWP_AUTOCONFIG_ENABLE) && (SWP_POLLING_ENABLE)){ + auto_config = 1; + } + if (register_modctl_device() < 0) { + err_msg = "register_modctl_device fail"; + goto err_init_swps_common_1; + } + if (_update_auto_config_2_trnasvr() < 0) { + err_msg = "_update_auto_config_2_trnasvr fail"; + goto err_init_swps_common_1; + } + if (init_polling_task() < 0){ + err_msg = "init_polling_task fail"; + goto err_init_swps_common_1; + } + return 0; + +err_init_swps_common_1: + clean_swps_common(); + SWPS_ERR("%s: %s\n", __func__, err_msg); + return -1; +} + + +static int __init +swp_module_init(void){ + + if (get_platform_type() < 0){ + goto err_init_out; + } + if (get_layout_info() < 0){ + goto err_init_out; + } + if (register_swp_module() < 0){ + goto err_init_out; + } + if (create_ioexp_objs() < 0){ + goto err_init_ioexp; + } + if (create_port_objs() < 0){ + goto err_init_portobj; + } + if (init_mux_gpio(gpio_rest_mux) < 0){ + goto err_init_mux; + } + if (init_dev_topology() < 0){ + goto err_init_topology; + } + if (init_swps_common() < 0){ + goto err_init_topology; + } + SWPS_INFO("Inventec switch-port module V.%s initial success.\n", SWP_VERSION); + return 0; + + +err_init_topology: + clean_mux_gpio(); +err_init_mux: + clean_port_obj(); +err_init_portobj: + clean_ioexp_objs(); +err_init_ioexp: + class_unregister(swp_class_p); + class_destroy(swp_class_p); + unregister_chrdev_region(MKDEV(ctl_major, 0), 1); + unregister_chrdev_region(MKDEV(port_major, 0), port_total); +err_init_out: + SWPS_ERR("Inventec switch-port module V.%s initial failure.\n", SWP_VERSION); + return -1; +} + + +static void __exit +swp_module_exit(void){ + + clean_swps_common(); + clean_port_obj(); + clean_ioexp_objs(); + clean_mux_gpio(); + class_unregister(swp_class_p); + class_destroy(swp_class_p); + unregister_chrdev_region(MKDEV(ctl_major, 0), 1); + unregister_chrdev_region(MKDEV(port_major, 0), port_total); + SWPS_INFO("Remove Inventec switch-port module success.\n"); +} + + +/* Module information */ +MODULE_AUTHOR(SWP_AUTHOR); +MODULE_DESCRIPTION(SWP_DESC); +MODULE_VERSION(SWP_VERSION); +MODULE_LICENSE(SWP_LICENSE); + +module_init(swp_module_init); +module_exit(swp_module_exit); + + + + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_swps.h b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_swps.h new file mode 100644 index 000000000000..d28a0a3c968e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/inv_swps.h @@ -0,0 +1,1164 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef INV_SWPS_H +#define INV_SWPS_H + +#include "transceiver.h" +#include "io_expander.h" +#include "inv_mux.h" + +/* Module settings */ +#define SWP_CLS_NAME "swps" +#define SWP_DEV_PORT "port" +#define SWP_DEV_MODCTL "module" +#define SWP_RESET_PWD "inventec" +#define SWP_POLLING_PERIOD (300) /* msec */ +#define SWP_POLLING_ENABLE (1) +#define SWP_AUTOCONFIG_ENABLE (1) + +/* Module information */ +#define SWP_AUTHOR "Neil " +#define SWP_DESC "Inventec port and transceiver driver" +#define SWP_VERSION "4.2.9" +#define SWP_LICENSE "GPL" + +/* Module status define */ +#define SWP_STATE_NORMAL (0) +#define SWP_STATE_I2C_DIE (-91) + +/* [Note]: + * Functions and mechanism for auto-detect platform type is ready, + * But HW and BIOS not ready! We need to wait them. + * So, please do not use PLATFORM_TYPE_AUTO until they are ready. + * (2016.06.13) + */ +#define PLATFORM_TYPE_AUTO (100) +#define PLATFORM_TYPE_MAGNOLIA (111) +#define PLATFORM_TYPE_MAGNOLIA_FNC (112) +#define PLATFORM_TYPE_REDWOOD (121) +#define PLATFORM_TYPE_REDWOOD_FSL (122) +#define PLATFORM_TYPE_HUDSON32I_GA (131) +#define PLATFORM_TYPE_SPRUCE (141) +#define PLATFORM_TYPE_CYPRESS_GA1 (151) /* Up -> Down */ +#define PLATFORM_TYPE_CYPRESS_GA2 (152) /* Down -> Up */ +#define PLATFORM_TYPE_CYPRESS_BAI (153) /* Down -> Up */ +#define PLATFORM_TYPE_TAHOE (161) +#define PLATFORM_TYPE_SEQUOIA_GA (171) +#define PLATFORM_TYPE_LAVENDER_GA (181) +#define PLATFORM_TYPE_LAVENDER_ONL (182) +#define PLATFORM_TYPE_COTTONWOOD_RANGELEY (191) +#define PLATFORM_TYPE_MAPLE (201) +/* Current running platfrom */ +#define PLATFORM_SETTINGS PLATFORM_TYPE_MAPLE + +/* Define platform flag and kernel version */ +#if (PLATFORM_SETTINGS == PLATFORM_TYPE_MAGNOLIA) + #define SWPS_MAGNOLIA (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_MAGNOLIA_FNC) + #define SWPS_MAGNOLIA (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_REDWOOD) + #define SWPS_REDWOOD (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_REDWOOD_FSL) + #define SWPS_REDWOOD_FSL (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_HUDSON32I_GA) + #define SWPS_HUDSON32I_GA (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_SPRUCE) + #define SWPS_SPRUCE (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_CYPRESS_GA1) + #define SWPS_CYPRESS_GA1 (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_CYPRESS_GA2) + #define SWPS_CYPRESS_GA2 (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_CYPRESS_BAI) + #define SWPS_CYPRESS_BAI (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_TAHOE) + #define SWPS_TAHOE (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_SEQUOIA_GA) + #define SWPS_SEQUOIA (1) + #define SWPS_KERN_VER_BF_3_8 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_LAVENDER_GA) + #define SWPS_LAVENDER (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_LAVENDER_ONL) + #define SWPS_LAVENDER (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_COTTONWOOD_RANGELEY) + #define SWPS_COTTONWOOD_RANGELEY (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_MAPLE) + #define SWPS_MAPLE (1) + #define SWPS_KERN_VER_AF_3_10 (1) +#endif + + +struct inv_platform_s { + int id; + char name[64]; +}; + +struct inv_ioexp_layout_s { + int ioexp_id; + int ioexp_type; + struct ioexp_addr_s addr[4]; +}; + +struct inv_port_layout_s { + int port_id; + int chan_id; + int ioexp_id; + int ioexp_offset; + int transvr_type; + int chipset_type; + int lane_id[8]; +}; + + +/* ========================================== + * Inventec Platform Settings + * ========================================== + */ +struct inv_platform_s platform_map[] = { + {PLATFORM_TYPE_AUTO, "Auto-Detect" }, + {PLATFORM_TYPE_MAGNOLIA, "Magnolia" }, + {PLATFORM_TYPE_MAGNOLIA_FNC, "Magnolia_FNC" }, + {PLATFORM_TYPE_REDWOOD, "Redwood" }, + {PLATFORM_TYPE_REDWOOD_FSL, "Redwood_FSL" }, + {PLATFORM_TYPE_HUDSON32I_GA, "Hudson32i" }, + {PLATFORM_TYPE_SPRUCE, "Spruce" }, + {PLATFORM_TYPE_CYPRESS_GA1, "Cypress_GA1" }, + {PLATFORM_TYPE_CYPRESS_GA2, "Cypress_GA2" }, + {PLATFORM_TYPE_CYPRESS_BAI, "Cypress_BAI" }, + {PLATFORM_TYPE_TAHOE, "Tahoe" }, + {PLATFORM_TYPE_SEQUOIA_GA, "Sequoia_GA" }, + {PLATFORM_TYPE_LAVENDER_GA, "Lavender_GA" }, + {PLATFORM_TYPE_LAVENDER_ONL, "Lavender_ONL" }, + {PLATFORM_TYPE_COTTONWOOD_RANGELEY, "Cottonwood_RANGELEY" }, + {PLATFORM_TYPE_MAPLE, "Maple" }, +}; + + +/* ========================================== + * Magnolia Layout configuration + * ========================================== + */ +#ifdef SWPS_MAGNOLIA +unsigned magnolia_gpio_rest_mux = MUX_RST_GPIO_48_PAC9548; + +struct inv_ioexp_layout_s magnolia_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_MAGINOLIA_NAB, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, }, /* addr[1] = I/O Expander N B */ + }, + {1, IOEXP_TYPE_MAGINOLIA_NAB, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, }, /* addr[1] = I/O Expander N B */ + }, + {2, IOEXP_TYPE_MAGINOLIA_NAB, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, }, /* addr[1] = I/O Expander N B */ + }, + {3, IOEXP_TYPE_MAGINOLIA_4AB, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander 4 A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xf0, 0xff}, {0xf0, 0xff}, }, }, /* addr[1] = I/O Expander 4 B */ + }, + {4, IOEXP_TYPE_MAGINOLIA_NAB, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, }, /* addr[1] = I/O Expander N B */ + }, + {5, IOEXP_TYPE_MAGINOLIA_NAB, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, }, /* addr[1] = I/O Expander N B */ + }, + {6, IOEXP_TYPE_MAGINOLIA_7AB, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xf0, 0x33}, }, }, /* addr[1] = I/O Expander 7 B */ + }, +}; + +struct inv_port_layout_s magnolia_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 16} }, + { 1, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 15} }, + { 2, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 14} }, + { 3, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 13} }, + { 4, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 24} }, + { 5, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 23} }, + { 6, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 22} }, + { 7, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 21} }, + { 8, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 28} }, + { 9, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 27} }, + {10, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 26} }, + {11, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 25} }, + {12, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 32} }, + {13, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 31} }, + {14, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 30} }, + {15, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 29} }, + {16, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 48} }, + {17, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 47} }, + {18, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 46} }, + {19, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 45} }, + {20, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 52} }, + {21, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 51} }, + {22, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 50} }, + {23, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 49} }, + {24, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 56} }, + {25, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 55} }, + {26, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 54} }, + {27, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 53} }, + {28, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 60} }, + {29, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 59} }, + {30, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 58} }, + {31, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 57} }, + {32, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 64} }, + {33, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 63} }, + {34, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 62} }, + {35, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 61} }, + {36, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 68} }, + {37, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 67} }, + {38, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 66} }, + {39, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 65} }, + {40, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 72} }, + {41, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 71} }, + {42, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 70} }, + {43, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 69} }, + {44, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 76} }, + {45, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 75} }, + {46, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 74} }, + {47, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_2, { 73} }, + {48, 58, 6, 0, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, { 81, 82, 83, 84} }, + {49, 59, 6, 1, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, { 77, 78, 79, 80} }, + {50, 60, 6, 2, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, { 97, 98, 99,100} }, + {51, 61, 6, 3, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, {101,102,103,104} }, + {52, 62, 6, 4, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, {105,106,107,108} }, + {53, 63, 6, 5, TRANSVR_TYPE_QSFP, BCM_CHIP_TYPE_TRIDENT_2, {109,110,111,112} }, +}; +#endif + + +/* ========================================== + * Redwood Layout configuration + * ========================================== + */ +#ifdef SWPS_REDWOOD +unsigned redwood_gpio_rest_mux = MUX_RST_GPIO_48_PAC9548; + +struct inv_ioexp_layout_s redwood_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_REDWOOD_P01P08, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {1, IOEXP_TYPE_REDWOOD_P09P16, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {2, IOEXP_TYPE_REDWOOD_P01P08, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {3, IOEXP_TYPE_REDWOOD_P09P16, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, +}; + +struct inv_port_layout_s redwood_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 22, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} }, + { 1, 23, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} }, + { 2, 24, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} }, + { 3, 25, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} }, + { 4, 26, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} }, + { 5, 27, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} }, + { 6, 28, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} }, + { 7, 29, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} }, + { 8, 30, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} }, + { 9, 31, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} }, + {10, 32, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} }, + {11, 33, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} }, + {12, 34, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} }, + {13, 35, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, + {14, 36, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} }, + {15, 37, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} }, + {16, 6, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, + {17, 7, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, + {18, 8, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} }, + {19, 9, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} }, + {20, 10, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, + {21, 11, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {22, 12, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} }, + {23, 13, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} }, + {24, 14, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {25, 15, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {26, 16, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {27, 17, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, + {28, 18, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113,114,115,116} }, + {29, 19, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + {30, 20, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121,122,123,124} }, + {31, 21, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125,126,127,128} }, +}; +#endif + + +/* ========================================== + * Hudson32i Layout configuration + * ========================================== + */ +#ifdef SWPS_HUDSON32I_GA +unsigned hudsin32iga_gpio_rest_mux = MUX_RST_GPIO_48_PAC9548; + +struct inv_ioexp_layout_s hudson32iga_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_HUDSON32IGA_P01P08, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0x24 */ + }, + {1, IOEXP_TYPE_HUDSON32IGA_P09P16, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0x24 */ + }, + {2, IOEXP_TYPE_HUDSON32IGA_P01P08, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0x25 */ + }, + {3, IOEXP_TYPE_HUDSON32IGA_P09P16, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0x25 */ + }, +}; + +struct inv_port_layout_s hudson32iga_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 6, 0, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 1, 2, 3, 4} }, + { 1, 7, 0, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 5, 6, 7, 8} }, + { 2, 8, 0, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 9, 10, 11, 12} }, + { 3, 9, 0, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 13, 14, 15, 16} }, + { 4, 10, 0, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 17, 18, 19, 20} }, + { 5, 11, 0, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 21, 22, 23, 24} }, + { 6, 12, 0, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 25, 26, 27, 28} }, + { 7, 13, 0, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 29, 30, 31, 32} }, + { 8, 14, 1, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 33, 34, 35, 36} }, + { 9, 15, 1, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 37, 38, 39, 40} }, + {10, 16, 1, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 41, 42, 43, 44} }, + {11, 17, 1, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 45, 46, 47, 48} }, + {12, 18, 1, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 49, 50, 51, 52} }, + {13, 19, 1, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 53, 54, 55, 56} }, + {14, 20, 1, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 57, 58, 59, 60} }, + {15, 21, 1, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 61, 62, 63, 64} }, + {16, 22, 2, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 65, 66, 67, 68} }, + {17, 23, 2, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 69, 70, 71, 72} }, + {18, 24, 2, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 73, 74, 75, 76} }, + {19, 25, 2, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 77, 78, 79, 80} }, + {20, 26, 2, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 81, 82, 83, 84} }, + {21, 27, 2, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 85, 86, 87, 88} }, + {22, 28, 2, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 89, 90, 91, 92} }, + {23, 29, 2, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 93, 94, 95, 96} }, + {24, 30, 3, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 97, 98, 99,100} }, + {25, 31, 3, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {101,102,103,104} }, + {26, 32, 3, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {105,106,107,108} }, + {27, 33, 3, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {109,110,111,112} }, + {28, 34, 3, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {113,114,115,116} }, + {29, 35, 3, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {117,118,119,120} }, + {30, 36, 3, 6, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {121,122,123,124} }, + {31, 37, 3, 7, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {125,126,127,128} }, +}; +#endif + + +/* ========================================== + * Spruce Layout configuration + * ========================================== + */ +#ifdef SWPS_SPRUCE +unsigned spruce_gpio_rest_mux = MUX_RST_GPIO_48_PAC9548; + +struct inv_ioexp_layout_s spruce_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_SPRUCE_7AB, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 7A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xf0, 0x33}, }, }, /* addr[2] = I/O Expander 7B */ + }, +}; + +struct inv_port_layout_s spruce_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 6, 0, 0, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 81, 82, 83, 84} }, + { 1, 7, 0, 1, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 77, 78, 79, 80} }, + { 2, 8, 0, 2, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, { 97, 98, 99,100} }, + { 3, 9, 0, 3, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {101,102,103,104} }, + { 4, 10, 0, 4, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {105,106,107,108} }, + { 5, 11, 0, 5, TRANSVR_TYPE_QSFP_PLUS, BCM_CHIP_TYPE_TRIDENT_2, {109,110,111,112} }, +}; +#endif + + +/* ========================================== + * Cypress Layout configuration (Inventec version [Up->Down]) + * ========================================== + */ +#ifdef SWPS_CYPRESS_GA1 +unsigned cypress_ga1_gpio_rest_mux = MUX_RST_GPIO_69_PAC9548; + +struct inv_ioexp_layout_s cypress_ga1_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_CYPRESS_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {1, IOEXP_TYPE_CYPRESS_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {2, IOEXP_TYPE_CYPRESS_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {3, IOEXP_TYPE_CYPRESS_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {4, IOEXP_TYPE_CYPRESS_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {5, IOEXP_TYPE_CYPRESS_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {6, IOEXP_TYPE_CYPRESS_7ABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xc0, 0xc0}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xc0, 0xc0}, {0xff, 0xc0}, }, /* addr[1] = I/O Expander 7 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + +struct inv_port_layout_s cypress_ga1_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 1} }, + { 1, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 2} }, + { 2, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 3} }, + { 3, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 4} }, + { 4, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 5} }, + { 5, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 6} }, + { 6, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 7} }, + { 7, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 8} }, + { 8, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 9} }, + { 9, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 10} }, + {10, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 11} }, + {11, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 12} }, + {12, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 21} }, + {13, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 22} }, + {14, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 23} }, + {15, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 24} }, + {16, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 33} }, + {17, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 34} }, + {18, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 35} }, + {19, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 36} }, + {20, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 37} }, + {21, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 38} }, + {22, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 39} }, + {23, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 40} }, + {24, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 41} }, + {25, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 42} }, + {26, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 43} }, + {27, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 44} }, + {28, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 49} }, + {29, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 50} }, + {30, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 51} }, + {31, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 52} }, + {32, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 53} }, + {33, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 54} }, + {34, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 55} }, + {35, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 56} }, + {36, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 65} }, + {37, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 66} }, + {38, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 67} }, + {39, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 68} }, + {40, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 69} }, + {41, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 70} }, + {42, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 71} }, + {43, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 72} }, + {44, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 81} }, + {45, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 82} }, + {46, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 83} }, + {47, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 84} }, + {48, 58, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {49, 59, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {50, 60, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {51, 61, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {52, 62, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, + {53, 63, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, +}; +#endif + + +/* ========================================== + * Cypress Layout configuration (Inventec version [Down->Up]) + * ========================================== + */ +#ifdef SWPS_CYPRESS_GA2 +unsigned cypress_ga2_gpio_rest_mux = MUX_RST_GPIO_FORCE_HEDERA; + +struct inv_ioexp_layout_s cypress_ga2_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_CYPRESS_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {1, IOEXP_TYPE_CYPRESS_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {2, IOEXP_TYPE_CYPRESS_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {3, IOEXP_TYPE_CYPRESS_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {4, IOEXP_TYPE_CYPRESS_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {5, IOEXP_TYPE_CYPRESS_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {6, IOEXP_TYPE_CYPRESS_7ABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xc0, 0xc0}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xc0, 0xc0}, {0xff, 0xc0}, }, /* addr[1] = I/O Expander 7 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + +struct inv_port_layout_s cypress_ga2_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 2} }, + { 1, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 1} }, + { 2, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 4} }, + { 3, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 3} }, + { 4, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 6} }, + { 5, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 5} }, + { 6, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 8} }, + { 7, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 7} }, + { 8, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 10} }, + { 9, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 9} }, + {10, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 12} }, + {11, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 11} }, + {12, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 22} }, + {13, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 21} }, + {14, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 24} }, + {15, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 23} }, + {16, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 34} }, + {17, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 33} }, + {18, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 36} }, + {19, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 35} }, + {20, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 38} }, + {21, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 37} }, + {22, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 40} }, + {23, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 39} }, + {24, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 42} }, + {25, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 41} }, + {26, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 44} }, + {27, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 43} }, + {28, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 50} }, + {29, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 49} }, + {30, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 52} }, + {31, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 51} }, + {32, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 54} }, + {33, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 53} }, + {34, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 56} }, + {35, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 55} }, + {36, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 66} }, + {37, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 65} }, + {38, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 68} }, + {39, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 67} }, + {40, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 70} }, + {41, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 69} }, + {42, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 72} }, + {43, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 71} }, + {44, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 82} }, + {45, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 81} }, + {46, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 84} }, + {47, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 83} }, + {48, 59, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {49, 58, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {50, 61, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {51, 60, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {52, 63, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + {53, 62, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, +}; +#endif + + +/* ========================================== + * Cypress Layout configuration (BaiDu version) + * ========================================== + */ +#ifdef SWPS_CYPRESS_BAI +unsigned cypress_b_gpio_rest_mux = MUX_RST_GPIO_FORCE_HEDERA; + +struct inv_ioexp_layout_s cypress_b_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_CYPRESS_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {1, IOEXP_TYPE_CYPRESS_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {2, IOEXP_TYPE_CYPRESS_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {3, IOEXP_TYPE_CYPRESS_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {4, IOEXP_TYPE_CYPRESS_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {5, IOEXP_TYPE_CYPRESS_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {6, IOEXP_TYPE_CYPRESS_7ABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xc0, 0xc0}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xc0, 0xc0}, {0xff, 0xc0}, }, /* addr[1] = I/O Expander 7 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + +struct inv_port_layout_s cypress_b_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 1, 11, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 2} }, + { 2, 10, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 1} }, + { 3, 13, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 4} }, + { 4, 12, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 3} }, + { 5, 15, 0, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 6} }, + { 6, 14, 0, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 5} }, + { 7, 17, 0, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 8} }, + { 8, 16, 0, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 7} }, + { 9, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 10} }, + {10, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 9} }, + {11, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 12} }, + {12, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 11} }, + {13, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 22} }, + {14, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 21} }, + {15, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 24} }, + {16, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 23} }, + {17, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 34} }, + {18, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 33} }, + {19, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 36} }, + {20, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 35} }, + {21, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 38} }, + {22, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 37} }, + {23, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 40} }, + {24, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 39} }, + {25, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 42} }, + {26, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 41} }, + {27, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 44} }, + {28, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 43} }, + {29, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 50} }, + {30, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 49} }, + {31, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 52} }, + {32, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 51} }, + {33, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 54} }, + {34, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 53} }, + {35, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 56} }, + {36, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 55} }, + {37, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 66} }, + {38, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 65} }, + {39, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 68} }, + {40, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 67} }, + {41, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 70} }, + {42, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 69} }, + {43, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 72} }, + {44, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 71} }, + {45, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 82} }, + {46, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 81} }, + {47, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 84} }, + {48, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 83} }, + {49, 59, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {50, 58, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {51, 61, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {52, 60, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {53, 63, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + {54, 62, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, +}; +#endif + + +/* ========================================== + * Redwood_fsl Layout configuration + * ========================================== + */ +#ifdef SWPS_REDWOOD_FSL +unsigned redwood_fsl_gpio_rest_mux = MUX_RST_GPIO_48_PAC9548; + +struct inv_ioexp_layout_s redwood_fsl_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_REDWOOD_P01P08, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {1, IOEXP_TYPE_REDWOOD_P09P16, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x25, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {2, IOEXP_TYPE_REDWOOD_P01P08, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, + {3, IOEXP_TYPE_REDWOOD_P09P16, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[0] = I/O Expander 1-4 A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0x0f}, }, /* addr[1] = I/O Expander 1-4 B */ + {0, 0x24, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 B */ + }, +}; + + +struct inv_port_layout_s redwood_fsl_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 22, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} }, + { 1, 23, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} }, + { 2, 24, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} }, + { 3, 25, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} }, + { 4, 26, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} }, + { 5, 27, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} }, + { 6, 28, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} }, + { 7, 29, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} }, + { 8, 30, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} }, + { 9, 31, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} }, + {10, 32, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} }, + {11, 33, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} }, + {12, 34, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} }, + {13, 35, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, + {14, 36, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} }, + {15, 37, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} }, + {16, 6, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, + {17, 7, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, + {18, 8, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} }, + {19, 9, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} }, + {20, 10, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, + {21, 11, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {22, 12, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} }, + {23, 13, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} }, + {24, 14, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99,100} }, + {25, 15, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101,102,103,104} }, + {26, 16, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105,106,107,108} }, + {27, 17, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109,110,111,112} }, + {28, 18, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113,114,115,116} }, + {29, 19, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117,118,119,120} }, + {30, 20, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121,122,123,124} }, + {31, 21, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125,126,127,128} }, +}; +#endif + + +/* ========================================== + * Tahoe Layout configuration + * ========================================== + */ +#ifdef SWPS_TAHOE +unsigned tahoe_gpio_rest_mux = MUX_RST_GPIO_249_PCA9548; + +struct inv_ioexp_layout_s tahoe_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_TAHOE_6ABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xce, 0xb9}, {0x18, 0xe3}, }, /* addr[0] = I/O Expander 6 A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xce, 0xb9}, {0x18, 0xe3}, }, /* addr[1] = I/O Expander 6 B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xce, 0xb9}, {0x18, 0xe3}, }, }, /* addr[2] = I/O Expander 6 C */ + }, + {1, IOEXP_TYPE_TAHOE_5A, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xce, 0xb9}, {0x18, 0xe3}, }, }, /* addr[0] = I/O Expander 5 A */ + }, +}; + + +struct inv_port_layout_s tahoe_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 12, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, + { 1, 11, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, + { 2, 22, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, + { 3, 21, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, + { 4, 24, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99, 100} }, + { 5, 23, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + { 6, 18, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101, 102, 103, 104} }, + { 7, 17, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105, 106, 107, 108} }, + { 8, 20, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113, 114, 115, 116} }, + { 9, 19, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109, 110, 111, 112} }, +}; +#endif + + +/* ========================================== + * Sequoia Layout configuration + * ========================================== + */ +#ifdef SWPS_SEQUOIA +unsigned sequoia_gpio_rest_mux = MUX_RST_GPIO_69_PAC9548; + +struct inv_ioexp_layout_s sequoia_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_SEQUOIA_NABC, { {1, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 0 A */ + {1, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 0 B */ + {1, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0 C */ + }, + {1, IOEXP_TYPE_SEQUOIA_NABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 1 A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 1 B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 1 C */ + }, + {2, IOEXP_TYPE_SEQUOIA_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 2 A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 2 B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 2 C */ + }, + {3, IOEXP_TYPE_SEQUOIA_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 3 A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 3 B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 3 C */ + }, + {4, IOEXP_TYPE_SEQUOIA_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 4 A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 4 B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 4 C */ + }, + {5, IOEXP_TYPE_SEQUOIA_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 5 A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 5 B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 C */ + }, + {6, IOEXP_TYPE_SEQUOIA_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 6 A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 6 B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 6 C */ + }, + {7, IOEXP_TYPE_SEQUOIA_NABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 7 A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 7 B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, +}; + + +struct inv_port_layout_s sequoia_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 9, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 9, 10, 11, 12} }, + { 1, 10, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 1, 2, 3, 4} }, + { 2, 11, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 25, 26, 27, 28} }, + { 3, 12, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 17, 18, 19, 20} }, + { 4, 13, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 41, 42, 43, 44} }, + { 5, 14, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 33, 34, 35, 36} }, + { 6, 15, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 57, 58, 59, 60} }, + { 7, 16, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 49, 50, 51, 52} }, + { 8, 17, 1, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 73, 74, 75, 76} }, + { 9, 18, 1, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 65, 66, 67, 68} }, + {10, 19, 1, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 89, 90, 91, 92} }, + {11, 20, 1, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 81, 82, 83, 84} }, + {12, 21, 1, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {105, 106, 107, 108} }, + {13, 22, 1, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 97, 98, 99, 100} }, + {14, 23, 1, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {121, 122, 123, 124} }, + {15, 24, 1, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {113, 114, 115, 116} }, + {16, 25, 2, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {137, 138, 139, 140} }, + {17, 26, 2, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {129, 130, 131, 132} }, + {18, 27, 2, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {153, 154, 155, 156} }, + {19, 28, 2, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {145, 146, 147, 148} }, + {20, 29, 2, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {169, 170, 171, 172} }, + {21, 30, 2, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {161, 162, 163, 164} }, + {22, 31, 2, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {185, 186, 187, 188} }, + {23, 32, 2, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {177, 178, 179, 180} }, + {24, 33, 3, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {201, 202, 203, 204} }, + {25, 34, 3, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {193, 194, 195, 196} }, + {26, 35, 3, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {217, 218, 219, 220} }, + {27, 36, 3, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {209, 210, 211, 212} }, + {28, 37, 3, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {233, 234, 235, 236} }, + {29, 38, 3, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {225, 226, 227, 228} }, + {30, 39, 3, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {249, 250, 251, 252} }, + {31, 40, 3, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {241, 242, 243, 244} }, + {32, 44, 4, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 13, 14, 15, 16} }, + {33, 43, 4, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 5, 6, 7, 8} }, + {34, 42, 4, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 29, 30, 31, 32} }, + {35, 41, 4, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 21, 22, 23, 24} }, + {36, 48, 4, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 45, 46, 47, 48} }, + {37, 47, 4, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 37, 38, 39, 40} }, + {38, 46, 4, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 61, 62, 63, 64} }, + {39, 45, 4, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 53, 54, 55, 56} }, + {40, 52, 5, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 77, 78, 79, 80} }, + {41, 51, 5, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 69, 70, 71, 72} }, + {42, 50, 5, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 93, 94, 95, 96} }, + {43, 49, 5, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, { 85, 86, 87, 88} }, + {44, 56, 5, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {109, 110, 111, 112} }, + {45, 55, 5, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {101, 102, 103, 104} }, + {46, 54, 5, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {125, 126, 127, 128} }, + {47, 53, 5, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {117, 118, 119, 120} }, + {48, 60, 6, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {141, 142, 143, 144} }, + {49, 59, 6, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {133, 134, 135, 136} }, + {50, 58, 6, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {157, 158, 159, 160} }, + {51, 57, 6, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {149, 150, 151, 152} }, + {52, 64, 6, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {173, 174, 175, 176} }, + {53, 63, 6, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {165, 166, 167, 168} }, + {54, 62, 6, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {189, 190, 191, 192} }, + {55, 61, 6, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {181, 182, 183, 184} }, + {56, 68, 7, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {205, 206, 207, 208} }, + {57, 67, 7, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {197, 198, 199, 200} }, + {58, 66, 7, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {221, 222, 223, 224} }, + {59, 65, 7, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {213, 214, 215, 216} }, + {60, 72, 7, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {237, 238, 239, 240} }, + {61, 71, 7, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {229, 230, 231, 232} }, + {62, 70, 7, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {253, 254, 255, 256} }, + {63, 69, 7, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TOMAHAWK, {245, 246, 247, 248} }, +}; +#endif + + +/* ========================================== + * Lavender Layout configuration + * ========================================== + */ +#if (PLATFORM_SETTINGS == PLATFORM_TYPE_LAVENDER_GA) +unsigned lavender_gpio_rest_mux = MUX_RST_GPIO_505_PCA9548; +#elif (PLATFORM_SETTINGS == PLATFORM_TYPE_LAVENDER_ONL) +unsigned lavender_gpio_rest_mux = MUX_RST_GPIO_69_PAC9548; +#endif + +#ifdef SWPS_LAVENDER +struct inv_ioexp_layout_s lavender_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_SEQUOIA_NABC, { { 1, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 0 A */ + { 1, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 0 B */ + { 1, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0 C */ + }, + {1, IOEXP_TYPE_SEQUOIA_NABC, { { 2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 1 A */ + { 2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 1 B */ + { 2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 1 C */ + }, + {2, IOEXP_TYPE_SEQUOIA_NABC, { { 3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 2 A */ + { 3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 2 B */ + { 3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 2 C */ + }, + {3, IOEXP_TYPE_SEQUOIA_NABC, { { 4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 3 A */ + { 4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 3 B */ + { 4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 3 C */ + }, + {4, IOEXP_TYPE_SEQUOIA_NABC, { { 9, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 4 A */ + { 9, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 4 B */ + { 9, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 4 C */ + }, + {5, IOEXP_TYPE_SEQUOIA_NABC, { {10, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 5 A */ + {10, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 5 B */ + {10, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 5 C */ + }, + {6, IOEXP_TYPE_SEQUOIA_NABC, { {11, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 6 A */ + {11, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 6 B */ + {11, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 6 C */ + }, + {7, IOEXP_TYPE_SEQUOIA_NABC, { {12, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 7 A */ + {12, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0x00}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 7 B */ + {12, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 7 C */ + }, + {8, IOEXP_TYPE_LAVENDER_P65, { { 5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xF6, 0xff}, {0xF8, 0xff}, }, }, /* addr[0] = I/O Expander CPU */ + }, +}; + + +struct inv_port_layout_s lavender_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 17, 0, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {188, 189, 190, 191} }, + { 1, 18, 0, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {184, 185, 186, 187} }, + { 2, 19, 0, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {180, 181, 182, 183} }, + { 3, 20, 0, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {176, 177, 178, 179} }, + { 4, 21, 0, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {172, 173, 174, 175} }, + { 5, 22, 0, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {168, 169, 170, 171} }, + { 6, 23, 0, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {164, 165, 166, 167} }, + { 7, 24, 0, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {160, 161, 162, 163} }, + { 8, 25, 1, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {156, 157, 158, 159} }, + { 9, 26, 1, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {152, 153, 154, 155} }, + {10, 27, 1, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {148, 149, 150, 151} }, + {11, 28, 1, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {144, 145, 146, 147} }, + {12, 29, 1, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {140, 141, 142, 143} }, + {13, 30, 1, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {136, 137, 138, 139} }, + {14, 31, 1, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {132, 133, 134, 135} }, + {15, 32, 1, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {128, 129, 130, 131} }, + {16, 33, 2, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 0, 1, 2, 3} }, + {17, 34, 2, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 4, 5, 6, 7} }, + {18, 35, 2, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 8, 9, 10, 11} }, + {19, 36, 2, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 12, 13, 14, 15} }, + {20, 37, 2, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 16, 17, 18, 19} }, + {21, 38, 2, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 20, 21, 22, 23} }, + {22, 39, 2, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 24, 25, 26, 27} }, + {23, 40, 2, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 28, 29, 30, 31} }, + {24, 41, 3, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 32, 33, 34, 35} }, + {25, 42, 3, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 36, 37, 38, 39} }, + {26, 43, 3, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 40, 41, 42, 43} }, + {27, 44, 3, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 44, 45, 46, 47} }, + {28, 45, 3, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 48, 49, 50, 51} }, + {29, 46, 3, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 52, 53, 54, 55} }, + {30, 47, 3, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 56, 57, 58, 59} }, + {31, 48, 3, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 60, 61, 62, 63} }, + {32, 49, 4, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {256, 257, 258, 259} }, + {33, 50, 4, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {260, 261, 262, 263} }, + {34, 51, 4, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {264, 265, 266, 267} }, + {35, 52, 4, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {268, 269, 270, 271} }, + {36, 53, 4, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {272, 273, 274, 275} }, + {37, 54, 4, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {276, 277, 278, 279} }, + {38, 55, 4, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {280, 281, 282, 283} }, + {39, 56, 4, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {284, 285, 286, 287} }, + {40, 57, 5, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {288, 289, 290, 291} }, + {41, 58, 5, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {292, 293, 294, 295} }, + {42, 59, 5, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {296, 297, 298, 299} }, + {43, 60, 5, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {300, 301, 302, 303} }, + {44, 61, 5, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {304, 305, 306, 307} }, + {45, 62, 5, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {308, 309, 310, 311} }, + {46, 63, 5, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {312, 313, 314, 315} }, + {47, 64, 5, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {316, 317, 318, 319} }, + {48, 65, 6, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {444, 445, 446, 447} }, + {49, 66, 6, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {440, 441, 442, 443} }, + {50, 67, 6, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {436, 437, 438, 439} }, + {51, 68, 6, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {432, 433, 434, 435} }, + {52, 69, 6, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {428, 429, 430, 431} }, + {53, 70, 6, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {424, 425, 426, 427} }, + {54, 71, 6, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {420, 421, 422, 423} }, + {55, 72, 6, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {416, 417, 418, 419} }, + {56, 73, 7, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {412, 413, 414, 415} }, + {57, 74, 7, 1, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {408, 409, 410, 411} }, + {58, 75, 7, 2, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {404, 405, 406, 407} }, + {59, 76, 7, 3, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {400, 401, 402, 403} }, + {60, 77, 7, 4, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {396, 397, 398, 399} }, + {61, 78, 7, 5, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {392, 393, 394, 395} }, + {62, 79, 7, 6, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {388, 389, 390, 391} }, + {63, 80, 7, 7, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, {384, 385, 386, 387} }, + {64, 5, 8, 0, TRANSVR_TYPE_QSFP_28, BF_CHIP_TYPE_TOFINO, { 64, 65, 66, 67} }, +}; +#endif + +/* =========================================================== + * Cottonwood Layout configuration Rangeley (Rangeley CPU board) + * =========================================================== + */ +#ifdef SWPS_COTTONWOOD_RANGELEY +unsigned cottonwood_rangeley_gpio_rest_mux = MUX_RST_GPIO_500_PAC9548; + +struct inv_ioexp_layout_s cottonwood_rangeley_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, CPLD_TYPE_COTTONWOOD,{ {1, 0x55, {22, 23, 24, 25}, {22, 23, 24, 25}, {-1, -1, -1, -1}, {0xee, 0xee, 0x99, 0x99}, {0x00, 0x00, 0x00, 0x00}, }, + }, + }, +}; + + +struct inv_port_layout_s cottonwood_rangeley_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHI_TYPE / LANE_ID */ + { 0, 2, 0, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 75} }, + { 1, 3, 0, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 77} }, + { 2, 4, 0, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 79} }, + { 3, 5, 0, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TOMAHAWK, { 81} }, +}; +#endif + +/* =========================================================== + * Maple Layout configuration + * =========================================================== + */ +#ifdef SWPS_MAPLE +unsigned maple_gpio_rest_mux = 249; + +struct inv_ioexp_layout_s maple_ioexp_layout[] = { + /* IOEXP_ID / IOEXP_TYPE / { Chan_ID, Chip_addr, Read_offset, Write_offset, config_offset, data_default, conf_default } */ + {0, IOEXP_TYPE_MAPLE_0ABC, { {2, 0x20, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0x00, 0x00}, }, /* addr[0] = I/O Expander 0 A */ + {2, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0xff}, }, /* addr[1] = I/O Expander 0 B */ + {2, 0x22, {0, 1}, {2, 3}, {6, 7}, {0x00, 0xff}, {0xff, 0xff}, }, }, /* addr[2] = I/O Expander 0 C */ + }, + {1, IOEXP_TYPE_MAPLE_NABC, { {3, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {3, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {3, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {2, IOEXP_TYPE_MAPLE_NABC, { {4, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {4, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {4, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {3, IOEXP_TYPE_MAPLE_NABC, { {5, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {5, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {5, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {4, IOEXP_TYPE_MAPLE_NABC, { {6, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {6, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {6, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {5, IOEXP_TYPE_MAPLE_NABC, { {7, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {7, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {7, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, + {6, IOEXP_TYPE_MAPLE_NABC, { {8, 0x20, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[0] = I/O Expander N A */ + {8, 0x21, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xf0}, {0xff, 0xf0}, }, /* addr[1] = I/O Expander N B */ + {8, 0x22, {0, 1}, {2, 3}, {6, 7}, {0xff, 0xff}, {0x00, 0x00}, }, }, /* addr[2] = I/O Expander N C */ + }, +}; + +struct inv_port_layout_s maple_port_layout[] = { + /* Port_ID / Chan_ID / IOEXP_ID / IOEXP_VIRT_OFFSET / TRANSCEIVER_TYPE / BCM_CHIP_TYPE / LANE_ID */ + { 0, 18, 1, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 1} }, + { 1, 19, 1, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 2} }, + { 2, 20, 1, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 3} }, + { 3, 21, 1, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 4} }, + { 4, 22, 1, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 5} }, + { 5, 23, 1, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 6} }, + { 6, 24, 1, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 7} }, + { 7, 25, 1, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 8} }, + { 8, 26, 2, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 13} }, + { 9, 27, 2, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 14} }, + {10, 28, 2, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 15} }, + {11, 29, 2, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 16} }, + {12, 30, 2, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 21} }, + {13, 31, 2, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 22} }, + {14, 32, 2, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 23} }, + {15, 33, 2, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 24} }, + {16, 34, 3, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 29} }, + {17, 35, 3, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 30} }, + {18, 36, 3, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 31} }, + {19, 37, 3, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 32} }, + {20, 38, 3, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 33} }, + {21, 39, 3, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 34} }, + {22, 40, 3, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 35} }, + {23, 41, 3, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 36} }, + {24, 42, 4, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 41} }, + {25, 43, 4, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 42} }, + {26, 44, 4, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 43} }, + {27, 45, 4, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 44} }, + {28, 46, 4, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 49} }, + {29, 47, 4, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 50} }, + {30, 48, 4, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 51} }, + {31, 49, 4, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 52} }, + {32, 50, 5, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 57} }, + {33, 51, 5, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 58} }, + {34, 52, 5, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 59} }, + {35, 53, 5, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 60} }, + {36, 54, 5, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 61} }, + {37, 55, 5, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 62} }, + {38, 56, 5, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 63} }, + {39, 57, 5, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 64} }, + {40, 58, 6, 0, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 65} }, + {41, 59, 6, 1, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 66} }, + {42, 60, 6, 2, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 67} }, + {43, 61, 6, 3, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 68} }, + {44, 62, 6, 4, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 69} }, + {45, 63, 6, 5, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 70} }, + {46, 64, 6, 6, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 71} }, + {47, 65, 6, 7, TRANSVR_TYPE_SFP, BCM_CHIP_TYPE_TRIDENT_3, { 72} }, + {48, 10, 0, 0, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TRIDENT_3, { 77, 78, 79, 80} }, + {49, 11, 0, 1, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TRIDENT_3, { 85, 86, 87, 88} }, + {50, 12, 0, 2, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TRIDENT_3, { 93, 94, 95, 96} }, + {51, 13, 0, 3, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TRIDENT_3, { 97, 98, 99,100} }, + {52, 14, 0, 4, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TRIDENT_3, {105,106,107,108} }, + {53, 15, 0, 5, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TRIDENT_3, {113,114,115,116} }, + {54, 16, 0, 6, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TRIDENT_3, {121,122,123,124} }, + {55, 17, 0, 7, TRANSVR_TYPE_QSFP_28, BCM_CHIP_TYPE_TRIDENT_3, {125,126,127,128} }, +}; +#endif + +#endif /* INV_SWPS_H */ + + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/io_expander.c b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/io_expander.c new file mode 100644 index 000000000000..4564b5855fd8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/io_expander.c @@ -0,0 +1,2046 @@ +#include +#include +#include "io_expander.h" + +static struct ioexp_obj_s *ioexp_head_p = NULL; +static struct ioexp_obj_s *ioexp_tail_p = NULL; + + +/* ========== Register IOEXP layout ========== + */ +struct ioexp_map_s ioexp_map_magnolia_nab = { + + .chip_amount = 2, + .data_width = 2, + + .map_present = { {0, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {1, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {1, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_tx_disable = { {0, 1, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 1, 1}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 2}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 3}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + {1, 1, 0}, /* map_tx_disable[4] = TXDISABLE_SFP+_P(X+4) */ + {1, 1, 1}, /* map_tx_disable[5] = TXDISABLE_SFP+_P(X+5) */ + {1, 1, 2}, /* map_tx_disable[6] = TXDISABLE_SFP+_P(X+6) */ + {1, 1, 3}, /* map_tx_disable[7] = TXDISABLE_SFP+_P(X+7) */ + }, + .map_tx_fault = { {0, 0, 0}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 0, 1}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 0, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 0, 3}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + {1, 0, 0}, /* map_tx_fault[4] = TXFAULT_SFP+_P(X+4) */ + {1, 0, 1}, /* map_tx_fault[5] = TXFAULT_SFP+_P(X+5) */ + {1, 0, 2}, /* map_tx_fault[6] = TXFAULT_SFP+_P(X+6) */ + {1, 0, 3}, /* map_tx_fault[7] = TXFAULT_SFP+_P(X+7) */ + }, + .map_rxlos = { {0, 1, 4}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 1, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 1, 6}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 1, 7}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + {1, 1, 4}, /* map_rxlos[4] = OPRXLOS_PORT(X+4) */ + {1, 1, 5}, /* map_rxlos[5] = OPRXLOS_PORT(X+5) */ + {1, 1, 6}, /* map_rxlos[6] = OPRXLOS_PORT(X+6) */ + {1, 1, 7}, /* map_rxlos[7] = OPRXLOS_PORT(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_magnolia_4ab = { + + .chip_amount = 2, + .data_width = 2, + + .map_present = { {0, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {1, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {1, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_tx_disable = { {0, 1, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 1, 1}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 2}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 3}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + {1, 0, 0}, /* map_tx_disable[4] = TXDISABLE_SFP+_P(X+4) */ + {1, 0, 1}, /* map_tx_disable[5] = TXDISABLE_SFP+_P(X+5) */ + {1, 0, 2}, /* map_tx_disable[6] = TXDISABLE_SFP+_P(X+6) */ + {1, 0, 3}, /* map_tx_disable[7] = TXDISABLE_SFP+_P(X+7) */ + }, + .map_tx_fault = { {0, 0, 0}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 0, 1}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 0, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 0, 3}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + {1, 1, 0}, /* map_tx_fault[4] = TXFAULT_SFP+_P(X+4) */ + {1, 1, 1}, /* map_tx_fault[5] = TXFAULT_SFP+_P(X+5) */ + {1, 1, 2}, /* map_tx_fault[6] = TXFAULT_SFP+_P(X+6) */ + {1, 1, 3}, /* map_tx_fault[7] = TXFAULT_SFP+_P(X+7) */ + }, + .map_rxlos = { {0, 1, 4}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 1, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 1, 6}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 1, 7}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + {1, 1, 4}, /* map_rxlos[4] = OPRXLOS_PORT(X+4) */ + {1, 1, 5}, /* map_rxlos[5] = OPRXLOS_PORT(X+5) */ + {1, 1, 6}, /* map_rxlos[6] = OPRXLOS_PORT(X+6) */ + {1, 1, 7}, /* map_rxlos[7] = OPRXLOS_PORT(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_magnolia_7ab = { + + .chip_amount = 2, + .data_width = 2, + + .map_present = { {1, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {1, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {1, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {1, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP_N_P(X+5) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP_P(X+3) */ + {1, 0, 2}, /* map_lpmod[4] = LPMODE_QSFP_P(X+4) */ + {1, 0, 3}, /* map_lpmod[5] = LPMODE_QSFP_P(X+5) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP_N_P(X+5) */ + }, +}; + + +struct ioexp_map_s ioexp_map_redwood_p01p08_p17p24 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 0, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 0, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_redwood_p09p16_p25p32 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 1, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 1, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 1, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 1, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_hudson32iga_p01p08_p17p24 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MODABS_QSFP(X) */ + {2, 0, 1}, /* map_present[1] = MODABS_QSFP(X+1) */ + {2, 0, 2}, /* map_present[2] = MODABS_QSFP(X+2) */ + {2, 0, 3}, /* map_present[3] = MODABS_QSFP(X+3) */ + {2, 0, 4}, /* map_present[4] = MODABS_QSFP(X+4) */ + {2, 0, 5}, /* map_present[5] = MODABS_QSFP(X+5) */ + {2, 0, 6}, /* map_present[6] = MODABS_QSFP(X+6) */ + {2, 0, 7}, /* map_present[7] = MODABS_QSFP(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_hudson32iga_p09p16_p25p32 = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MODABS_QSFP(X) */ + {2, 1, 1}, /* map_present[1] = MODABS_QSFP(X+1) */ + {2, 1, 2}, /* map_present[2] = MODABS_QSFP(X+2) */ + {2, 1, 3}, /* map_present[3] = MODABS_QSFP(X+3) */ + {2, 1, 4}, /* map_present[4] = MODABS_QSFP(X+4) */ + {2, 1, 5}, /* map_present[5] = MODABS_QSFP(X+5) */ + {2, 1, 6}, /* map_present[6] = MODABS_QSFP(X+6) */ + {2, 1, 7}, /* map_present[7] = MODABS_QSFP(X+7) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP(X+3) */ + {1, 0, 0}, /* map_reset[4] = QRESET_QSFP(X+4) */ + {1, 0, 1}, /* map_reset[5] = QRESET_QSFP(X+5) */ + {1, 0, 2}, /* map_reset[6] = QRESET_QSFP(X+6) */ + {1, 0, 3}, /* map_reset[7] = QRESET_QSFP(X+7) */ + }, + .map_lpmod = { {0, 0, 4}, /* map_lpmod[0] = LPMODE_QSFP(X) */ + {0, 0, 5}, /* map_lpmod[1] = LPMODE_QSFP(X+1) */ + {0, 0, 6}, /* map_lpmod[2] = LPMODE_QSFP(X+2) */ + {0, 0, 7}, /* map_lpmod[3] = LPMODE_QSFP(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP(X+7) */ + }, + .map_modsel = { {0, 1, 4}, /* map_modsel[0] = MODSEL_QSFP(X) */ + {0, 1, 5}, /* map_modsel[1] = MODSEL_QSFP(X+1) */ + {0, 1, 6}, /* map_modsel[2] = MODSEL_QSFP(X+2) */ + {0, 1, 7}, /* map_modsel[3] = MODSEL_QSFP(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP(X+5) */ + {1, 1, 6}, /* map_modsel[6] = MODSEL_QSFP(X+6) */ + {1, 1, 7}, /* map_modsel[7] = MODSEL_QSFP(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_cypress_nabc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {0, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {1, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {1, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_tx_disable = { {0, 1, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 1, 1}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 2}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 3}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + {1, 1, 0}, /* map_tx_disable[4] = TXDISABLE_SFP+_P(X+4) */ + {1, 1, 1}, /* map_tx_disable[5] = TXDISABLE_SFP+_P(X+5) */ + {1, 1, 2}, /* map_tx_disable[6] = TXDISABLE_SFP+_P(X+6) */ + {1, 1, 3}, /* map_tx_disable[7] = TXDISABLE_SFP+_P(X+7) */ + }, + .map_tx_fault = { {0, 0, 0}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 0, 1}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 0, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 0, 3}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + {1, 0, 0}, /* map_tx_fault[4] = TXFAULT_SFP+_P(X+4) */ + {1, 0, 1}, /* map_tx_fault[5] = TXFAULT_SFP+_P(X+5) */ + {1, 0, 2}, /* map_tx_fault[6] = TXFAULT_SFP+_P(X+6) */ + {1, 0, 3}, /* map_tx_fault[7] = TXFAULT_SFP+_P(X+7) */ + }, + .map_rxlos = { {0, 1, 4}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 1, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 1, 6}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 1, 7}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + {1, 1, 4}, /* map_rxlos[4] = OPRXLOS_PORT(X+4) */ + {1, 1, 5}, /* map_rxlos[5] = OPRXLOS_PORT(X+5) */ + {1, 1, 6}, /* map_rxlos[6] = OPRXLOS_PORT(X+6) */ + {1, 1, 7}, /* map_rxlos[7] = OPRXLOS_PORT(X+7) */ + }, + .map_hard_rs0 = { {2, 0, 0}, /* map_hard_rs0[0] = RS0_SFP28_P(X) */ + {2, 0, 2}, /* map_hard_rs0[1] = RS0_SFP28_P(X+1) */ + {2, 0, 4}, /* map_hard_rs0[2] = RS0_SFP28_P(X+2) */ + {2, 0, 6}, /* map_hard_rs0[3] = RS0_SFP28_P(X+3) */ + {2, 1, 0}, /* map_hard_rs0[4] = RS0_SFP28_P(X+4) */ + {2, 1, 2}, /* map_hard_rs0[5] = RS0_SFP28_P(X+5) */ + {2, 1, 4}, /* map_hard_rs0[6] = RS0_SFP28_P(X+6) */ + {2, 1, 6}, /* map_hard_rs0[7] = RS0_SFP28_P(X+7) */ + }, + .map_hard_rs1 = { {2, 0, 1}, /* map_hard_rs1[0] = RS1_SFP28_P(X) */ + {2, 0, 3}, /* map_hard_rs1[1] = RS1_SFP28_P(X+1) */ + {2, 0, 5}, /* map_hard_rs1[2] = RS1_SFP28_P(X+2) */ + {2, 0, 7}, /* map_hard_rs1[3] = RS1_SFP28_P(X+3) */ + {2, 1, 1}, /* map_hard_rs1[4] = RS1_SFP28_P(X+4) */ + {2, 1, 3}, /* map_hard_rs1[5] = RS1_SFP28_P(X+5) */ + {2, 1, 5}, /* map_hard_rs1[6] = RS1_SFP28_P(X+6) */ + {2, 1, 7}, /* map_hard_rs1[7] = RS1_SFP28_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_cypress_7abc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 0, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 0, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 0, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + }, + .map_reset = { {0, 0, 0}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 0, 1}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 0, 2}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + {0, 0, 3}, /* map_reset[3] = QRESET_QSFP_N_P(X+3) */ + {0, 0, 4}, /* map_reset[4] = QRESET_QSFP_N_P(X+4) */ + {0, 0, 5}, /* map_reset[5] = QRESET_QSFP_N_P(X+5) */ + }, + .map_lpmod = { {0, 1, 0}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {0, 1, 1}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {0, 1, 2}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + {0, 1, 3}, /* map_lpmod[3] = LPMODE_QSFP_P(X+3) */ + {0, 1, 4}, /* map_lpmod[4] = LPMODE_QSFP_P(X+4) */ + {0, 1, 5}, /* map_lpmod[5] = LPMODE_QSFP_P(X+5) */ + }, + .map_modsel = { {1, 1, 0}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {1, 1, 1}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {1, 1, 2}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + {1, 1, 3}, /* map_modsel[3] = MODSEL_QSFP_N_P(X+3) */ + {1, 1, 4}, /* map_modsel[4] = MODSEL_QSFP_N_P(X+4) */ + {1, 1, 5}, /* map_modsel[5] = MODSEL_QSFP_N_P(X+5) */ + }, +}; + + +struct ioexp_map_s ioexp_map_tahoe_5a = { + + .chip_amount = 1, + .data_width = 2, + + .map_present = { {0, 0, 3}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 1, 0}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 1, 5}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + }, + .map_reset = { {0, 0, 1}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 0, 6}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 1, 3}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + }, + .map_lpmod = { {0, 0, 2}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {0, 0, 7}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {0, 1, 4}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + }, + .map_modsel = { {0, 0, 0}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {0, 0, 5}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {0, 1, 2}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + }, +}; + + +struct ioexp_map_s ioexp_map_tahoe_6abc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {0, 0, 3}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 1, 0}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 1, 5}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {1, 0, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 1, 0}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 0, 3}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 0}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + {2, 1, 5}, /* map_present[8] = MOD_ABS_PORT(X+8) */ + }, + .map_reset = { {0, 0, 1}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 0, 6}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 1, 3}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {1, 0, 1}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {1, 0, 6}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {1, 1, 3}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {2, 0, 1}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {2, 0, 6}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + {2, 1, 3}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {0, 0, 2}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {0, 0, 7}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {0, 1, 4}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {1, 0, 2}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 7}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 1, 4}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {2, 0, 2}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {2, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + {2, 1, 4}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+8) */ + }, + .map_modsel = { {0, 0, 0}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 0, 5}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 1, 2}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {1, 0, 0}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {1, 0, 5}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {1, 1, 2}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {2, 0, 0}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {2, 0, 5}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + {2, 1, 2}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_sequoia_nabc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 1, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 1, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 1, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 1, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 1, 0}, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + {0, 1, 1}, /* map_reset[1] = QRESET_QSFP28_N_P(X+1) */ + {0, 1, 2}, /* map_reset[2] = QRESET_QSFP28_N_P(X+2) */ + {0, 1, 3}, /* map_reset[3] = QRESET_QSFP28_N_P(X+3) */ + {0, 1, 4}, /* map_reset[4] = QRESET_QSFP28_N_P(X+4) */ + {0, 1, 5}, /* map_reset[5] = QRESET_QSFP28_N_P(X+5) */ + {0, 1, 6}, /* map_reset[6] = QRESET_QSFP28_N_P(X+6) */ + {0, 1, 7}, /* map_reset[7] = QRESET_QSFP28_N_P(X+7) */ + }, + .map_lpmod = { {1, 0, 0}, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + {1, 0, 1}, /* map_lpmod[1] = LPMODE_QSFP28_P(X+1) */ + {1, 0, 2}, /* map_lpmod[2] = LPMODE_QSFP28_P(X+2) */ + {1, 0, 3}, /* map_lpmod[3] = LPMODE_QSFP28_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP28_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP28_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP28_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP28_P(X+7) */ + }, + .map_modsel = { {0, 0, 0}, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ + {0, 0, 1}, /* map_modsel[1] = MODSEL_QSFP28_N_P(X+1) */ + {0, 0, 2}, /* map_modsel[2] = MODSEL_QSFP28_N_P(X+2) */ + {0, 0, 3}, /* map_modsel[3] = MODSEL_QSFP28_N_P(X+3) */ + {0, 0, 4}, /* map_modsel[4] = MODSEL_QSFP28_N_P(X+4) */ + {0, 0, 5}, /* map_modsel[5] = MODSEL_QSFP28_N_P(X+5) */ + {0, 0, 6}, /* map_modsel[6] = MODSEL_QSFP28_N_P(X+6) */ + {0, 0, 7}, /* map_modsel[7] = MODSEL_QSFP28_N_P(X+7) */ + }, +}; + + +struct ioexp_map_s ioexp_map_lavender_p65 = { + + .chip_amount = 1, + .data_width = 1, + + .map_present = { {0, 0, 4}, }, /* map_present[0] = MOD_ABS_PORT(X) */ + .map_reset = { {0, 0, 1}, }, /* map_reset[0] = QRESET_QSFP28_N_P(X) */ + .map_lpmod = { {0, 0, 2}, }, /* map_lpmod[0] = LPMODE_QSFP28_P(X) */ + .map_modsel = { {0, 0, 0}, }, /* map_modsel[0] = MODSEL_QSFP28_N_P(X) */ +}; + + +struct ioexp_map_s cpld_map_cottonwood = { + + .chip_amount = 1, + .data_width = 4, + + .map_present = { {0, 2, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 2, 4}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 3, 0}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 3, 4}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + }, + .map_tx_disable = { {0, 0, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 0, 4}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 0}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 4}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + }, + .map_tx_fault = { {0, 2, 2}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 2, 6}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 3, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 3, 6}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + }, + .map_rxlos = { {0, 2, 1}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 2, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 3, 1}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 3, 5}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + }, + .map_hard_rs0 = { {0, 0, 2}, /* map_hard_rs0[0] = RS0_SFP28_P(X) */ + {0, 0, 6}, /* map_hard_rs0[1] = RS0_SFP28_P(X+1) */ + {0, 1, 2}, /* map_hard_rs0[2] = RS0_SFP28_P(X+2) */ + {0, 1, 6}, /* map_hard_rs0[3] = RS0_SFP28_P(X+3) */ + }, + .map_hard_rs1 = { {0, 0, 2}, /* map_hard_rs1[0] = RS1_SFP28_P(X) */ + {0, 0, 6}, /* map_hard_rs1[1] = RS1_SFP28_P(X+1) */ + {0, 1, 2}, /* map_hard_rs1[2] = RS1_SFP28_P(X+2) */ + {0, 1, 6}, /* map_hard_rs1[3] = RS1_SFP28_P(X+3) */ + }, +}; + +struct ioexp_map_s ioexp_map_maple_0abc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {2, 1, 0}, /* map_present[0] = MOD_ABS_PORT(X) */ + {2, 1, 1}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {2, 1, 2}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {2, 1, 3}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {2, 1, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {2, 1, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {2, 1, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {2, 1, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_reset = { {0, 1, 0}, /* map_reset[0] = QRESET_QSFP_N_P(X) */ + {0, 1, 1}, /* map_reset[1] = QRESET_QSFP_N_P(X+1) */ + {0, 1, 2}, /* map_reset[2] = QRESET_QSFP_N_P(X+2) */ + {0, 1, 3}, /* map_reset[3] = QRESET_QSFP_N_P(X+3) */ + {0, 1, 4}, /* map_reset[4] = QRESET_QSFP_N_P(X+4) */ + {0, 1, 5}, /* map_reset[5] = QRESET_QSFP_N_P(X+5) */ + {0, 1, 6}, /* map_reset[6] = QRESET_QSFP_N_P(X+6) */ + {0, 1, 7}, /* map_reset[7] = QRESET_QSFP_N_P(X+7) */ + }, + .map_lpmod = { {1, 0, 0}, /* map_lpmod[0] = LPMODE_QSFP_P(X) */ + {1, 0, 1}, /* map_lpmod[1] = LPMODE_QSFP_P(X+1) */ + {1, 0, 2}, /* map_lpmod[2] = LPMODE_QSFP_P(X+2) */ + {1, 0, 3}, /* map_lpmod[3] = LPMODE_QSFP_P(X+3) */ + {1, 0, 4}, /* map_lpmod[4] = LPMODE_QSFP_P(X+4) */ + {1, 0, 5}, /* map_lpmod[5] = LPMODE_QSFP_P(X+5) */ + {1, 0, 6}, /* map_lpmod[6] = LPMODE_QSFP_P(X+6) */ + {1, 0, 7}, /* map_lpmod[7] = LPMODE_QSFP_P(X+7) */ + }, + .map_modsel = { {0, 0, 0}, /* map_modsel[0] = MODSEL_QSFP_N_P(X) */ + {0, 0, 1}, /* map_modsel[1] = MODSEL_QSFP_N_P(X+1) */ + {0, 0, 2}, /* map_modsel[2] = MODSEL_QSFP_N_P(X+2) */ + {0, 0, 3}, /* map_modsel[3] = MODSEL_QSFP_N_P(X+3) */ + {0, 0, 4}, /* map_modsel[4] = MODSEL_QSFP_N_P(X+4) */ + {0, 0, 5}, /* map_modsel[5] = MODSEL_QSFP_N_P(X+5) */ + {0, 0, 6}, /* map_modsel[6] = MODSEL_QSFP_N_P(X+6) */ + {0, 0, 7}, /* map_modsel[7] = MODSEL_QSFP_N_P(X+7) */ + }, +}; + +struct ioexp_map_s ioexp_map_maple_nabc = { + + .chip_amount = 3, + .data_width = 2, + + .map_present = { {0, 0, 4}, /* map_present[0] = MOD_ABS_PORT(X) */ + {0, 0, 5}, /* map_present[1] = MOD_ABS_PORT(X+1) */ + {0, 0, 6}, /* map_present[2] = MOD_ABS_PORT(X+2) */ + {0, 0, 7}, /* map_present[3] = MOD_ABS_PORT(X+3) */ + {1, 0, 4}, /* map_present[4] = MOD_ABS_PORT(X+4) */ + {1, 0, 5}, /* map_present[5] = MOD_ABS_PORT(X+5) */ + {1, 0, 6}, /* map_present[6] = MOD_ABS_PORT(X+6) */ + {1, 0, 7}, /* map_present[7] = MOD_ABS_PORT(X+7) */ + }, + .map_tx_disable = { {0, 1, 0}, /* map_tx_disable[0] = TXDISABLE_SFP+_P(X) */ + {0, 1, 1}, /* map_tx_disable[1] = TXDISABLE_SFP+_P(X+1) */ + {0, 1, 2}, /* map_tx_disable[2] = TXDISABLE_SFP+_P(X+2) */ + {0, 1, 3}, /* map_tx_disable[3] = TXDISABLE_SFP+_P(X+3) */ + {1, 1, 0}, /* map_tx_disable[4] = TXDISABLE_SFP+_P(X+4) */ + {1, 1, 1}, /* map_tx_disable[5] = TXDISABLE_SFP+_P(X+5) */ + {1, 1, 2}, /* map_tx_disable[6] = TXDISABLE_SFP+_P(X+6) */ + {1, 1, 3}, /* map_tx_disable[7] = TXDISABLE_SFP+_P(X+7) */ + }, + .map_tx_fault = { {0, 0, 0}, /* map_tx_fault[0] = TXFAULT_SFP+_P(X) */ + {0, 0, 1}, /* map_tx_fault[1] = TXFAULT_SFP+_P(X+1) */ + {0, 0, 2}, /* map_tx_fault[2] = TXFAULT_SFP+_P(X+2) */ + {0, 0, 3}, /* map_tx_fault[3] = TXFAULT_SFP+_P(X+3) */ + {1, 0, 0}, /* map_tx_fault[4] = TXFAULT_SFP+_P(X+4) */ + {1, 0, 1}, /* map_tx_fault[5] = TXFAULT_SFP+_P(X+5) */ + {1, 0, 2}, /* map_tx_fault[6] = TXFAULT_SFP+_P(X+6) */ + {1, 0, 3}, /* map_tx_fault[7] = TXFAULT_SFP+_P(X+7) */ + }, + .map_rxlos = { {0, 1, 4}, /* map_rxlos[0] = OPRXLOS_PORT(X) */ + {0, 1, 5}, /* map_rxlos[1] = OPRXLOS_PORT(X+1) */ + {0, 1, 6}, /* map_rxlos[2] = OPRXLOS_PORT(X+2) */ + {0, 1, 7}, /* map_rxlos[3] = OPRXLOS_PORT(X+3) */ + {1, 1, 4}, /* map_rxlos[4] = OPRXLOS_PORT(X+4) */ + {1, 1, 5}, /* map_rxlos[5] = OPRXLOS_PORT(X+5) */ + {1, 1, 6}, /* map_rxlos[6] = OPRXLOS_PORT(X+6) */ + {1, 1, 7}, /* map_rxlos[7] = OPRXLOS_PORT(X+7) */ + }, + .map_hard_rs0 = { {2, 0, 0}, /* map_hard_rs0[0] = RS0_SFP28_P(X) */ + {2, 0, 2}, /* map_hard_rs0[1] = RS0_SFP28_P(X+1) */ + {2, 0, 4}, /* map_hard_rs0[2] = RS0_SFP28_P(X+2) */ + {2, 0, 6}, /* map_hard_rs0[3] = RS0_SFP28_P(X+3) */ + {2, 1, 0}, /* map_hard_rs0[4] = RS0_SFP28_P(X+4) */ + {2, 1, 2}, /* map_hard_rs0[5] = RS0_SFP28_P(X+5) */ + {2, 1, 4}, /* map_hard_rs0[6] = RS0_SFP28_P(X+6) */ + {2, 1, 6}, /* map_hard_rs0[7] = RS0_SFP28_P(X+7) */ + }, + .map_hard_rs1 = { {2, 0, 1}, /* map_hard_rs1[0] = RS1_SFP28_P(X) */ + {2, 0, 3}, /* map_hard_rs1[1] = RS1_SFP28_P(X+1) */ + {2, 0, 5}, /* map_hard_rs1[2] = RS1_SFP28_P(X+2) */ + {2, 0, 7}, /* map_hard_rs1[3] = RS1_SFP28_P(X+3) */ + {2, 1, 1}, /* map_hard_rs1[4] = RS1_SFP28_P(X+4) */ + {2, 1, 3}, /* map_hard_rs1[5] = RS1_SFP28_P(X+5) */ + {2, 1, 5}, /* map_hard_rs1[6] = RS1_SFP28_P(X+6) */ + {2, 1, 7}, /* map_hard_rs1[7] = RS1_SFP28_P(X+7) */ + }, +}; + +/* ========== Private functions ========== + */ +int check_channel_tier_1(void); + +struct i2c_client * +_get_i2c_client(struct ioexp_obj_s *self, + int chip_id){ + + struct ioexp_i2c_s *i2c_curr_p = self->i2c_head_p; + + if (!(i2c_curr_p)){ + SWPS_ERR("%s: i2c_curr_p is NULL\n", __func__); + return NULL; + } + while (i2c_curr_p){ + if ((i2c_curr_p->chip_id) == chip_id){ + return i2c_curr_p->i2c_client_p; + } + i2c_curr_p = i2c_curr_p->next; + } + SWPS_ERR("%s: not exist! :%d\n", __func__, chip_id); + return NULL; +} + + +static int +_common_ioexp_update_one(struct ioexp_obj_s *self, + struct ioexp_addr_s *ioexp_addr, + int chip_id, + int data_width, + int show_err, + char *caller_name) { + int buf = 0; + int err = 0; + int data_id = 0; + int r_offset = 0; + + for(data_id=0; data_idread_offset[data_id]; + buf = i2c_smbus_read_byte_data(_get_i2c_client(self, chip_id), r_offset); + /* Check error */ + if (buf < 0) { + err = 1; + if (show_err) { + SWPS_INFO("IOEXP-%d read fail! :%d \n", self->ioexp_id, buf); + SWPS_INFO("Dump: :%d :0x%02x :%d, :%s\n", + ioexp_addr->chan_id, ioexp_addr->chip_addr, + ioexp_addr->read_offset[data_id], caller_name); + } + continue; + } + /* Update IOEXP object */ + self->chip_data[chip_id].data[data_id] = (uint8_t)buf; + } + if (err) { + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +static int +common_ioexp_update_all(struct ioexp_obj_s *self, + int show_err, + char *caller_name){ + + int err = 0; + int chip_id = 0; + int chip_amount = self->ioexp_map_p->chip_amount; + + for (chip_id=0; chip_idioexp_map_p->map_addr[chip_id]), + chip_id, + self->ioexp_map_p->data_width, + show_err, + caller_name) < 0) { + err = 1; + } + } + if (err) { + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +static int +_common_check_by_mode(struct ioexp_obj_s *self){ + + switch (self->mode){ + case IOEXP_MODE_DIRECT: + return self->fsm_4_direct(self); + + case IOEXP_MODE_POLLING: + if (self->state >= 0){ + return 0; + } + switch (self->state){ + case STATE_IOEXP_INIT: + return ERR_IOEXP_UNINIT; + case STATE_IOEXP_ABNORMAL: + return ERR_IOEXP_ABNORMAL; + default: + return ERR_IOEXP_NOSTATE; + } + break; + + default: + break; + } + SWPS_ERR("%s: Exception occurs. :%d \n", __func__, self->mode); + return ERR_IOEXP_UNEXCPT; +} + + +static int +_common_get_bit(struct ioexp_obj_s *self, + struct ioexp_bitmap_s *bitmap_obj_p, + char *func_mane){ + uint8_t buf; + int err_code; + + /* Check and get address */ + err_code = _common_check_by_mode(self); + if (err_code < 0){ + return err_code; + } + if (!bitmap_obj_p){ + SWPS_ERR("Layout config incorrect! :%d :%s\n", + self->ioexp_id, func_mane); + return ERR_IOEXP_BADCONF; + } + /* Get data form cache */ + buf = self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset]; + return (int)(buf >> bitmap_obj_p->bit_shift & 0x01); +} + + +static int +_common_set_bit(struct ioexp_obj_s *self, + struct ioexp_bitmap_s *bitmap_obj_p, + int input_val, + char *func_mane){ + int err_code, target_offset; + uint8_t origin_byte; + uint8_t modify_byte; + + /* Check and get address */ + err_code = _common_check_by_mode(self); + if (err_code < 0){ + return err_code; + } + if (!bitmap_obj_p){ + SWPS_ERR("Layout config incorrect! :%d :%s\n", + self->ioexp_id, func_mane); + return ERR_IOEXP_BADCONF; + } + /* Prepare write date */ + origin_byte = self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset]; + switch (input_val) { + case 0: + modify_byte = origin_byte; + SWP_BIT_CLEAR(modify_byte, bitmap_obj_p->bit_shift); + break; + case 1: + modify_byte = origin_byte; + SWP_BIT_SET(modify_byte, bitmap_obj_p->bit_shift); + break; + default: + SWPS_ERR("Input value incorrect! :%d :%d :%s\n", + input_val, self->ioexp_id, func_mane); + return ERR_IOEXP_BADINPUT; + } + /* Setup i2c client */ + target_offset = self->ioexp_map_p->map_addr[bitmap_obj_p->chip_id].write_offset[bitmap_obj_p->ioexp_voffset]; + /* Write byte to chip via I2C */ + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, bitmap_obj_p->chip_id), + target_offset, + modify_byte); + /* Update or bollback object */ + if (err_code < 0){ + self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset] = origin_byte; + SWPS_ERR("I2C write fail! :%d :%d :%s :%d\n", + input_val, self->ioexp_id, func_mane, err_code); + return err_code; + } + self->chip_data[bitmap_obj_p->chip_id].data[bitmap_obj_p->ioexp_voffset] = modify_byte; + return 0; +} + + +/* ========== Object public functions ========== + */ +int +common_get_present(struct ioexp_obj_s *self, + int virt_offset){ + + int UNPLUG = 1; + int retval = ERR_IOEXP_UNEXCPT; + + retval = _common_get_bit(self, + &(self->ioexp_map_p->map_present[virt_offset]), + "common_get_present"); + if (retval < 0) { + /* [Note] + * => Transceiver object does not need to handle IOEXP layer issues. + */ + return UNPLUG; + } + return retval; +} + + +int +common_get_tx_fault(struct ioexp_obj_s *self, + int virt_offset){ + /* [Transmit Fault (Tx_Fault)] + * A catastrophic laser fault will activate the transmitter signal, + * TX_FAULT, and disable the laser. This signal is an open collector + * output (pull-up required on the host board). A low signal indicates + * normal laser operation and a high signal indicates a fault. The + * TX_FAULT will be latched high when a laser fault occurs and is + * cleared by toggling the TX_DISABLE input or power cycling the + * transceiver. The transmitter fault condition can also be monitored + * via the two-wire serial interface. + * (address A2, byte 110, bit 2). + * + * 0: Normal + * 1: Abnormal + */ + return _common_get_bit(self, + &(self->ioexp_map_p->map_tx_fault[virt_offset]), + "common_get_tx_fault"); +} + + +int +common_get_rxlos(struct ioexp_obj_s *self, + int virt_offset){ + /* [Receiver Loss of Signal (Rx_LOS)] + * The post-amplification IC also includes transition detection circuitry + * which monitors the ac level of incoming optical signals and provides a + * TTL/CMOS compatible status signal to the host (pin 8). An adequate optical + * input results in a low Rx_LOS output while a high Rx_LOS output indicates + * an unusable optical input. The Rx_LOS thresholds are factory set so that + * a high output indicates a definite optical fault has occurred. Rx_LOS can + * also be monitored via the two-wire serial interface + * (address A2h, byte 110, bit 1). + * + * 0: Normal + * 1: Abnormal + */ + return _common_get_bit(self, + &(self->ioexp_map_p->map_rxlos[virt_offset]), + "common_get_rxlos"); +} + + +int +common_get_tx_disable(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_tx_disable[virt_offset]), + "common_get_tx_disable"); +} + + +int +common_get_reset(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_reset[virt_offset]), + "common_get_reset"); +} + + +int +common_get_lpmod(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_lpmod[virt_offset]), + "common_get_lpmod"); +} + + +int +common_get_modsel(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_modsel[virt_offset]), + "common_get_modsel"); +} + + +int +common_get_hard_rs0(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_hard_rs0[virt_offset]), + "common_get_hard_rs0"); +} + + +int +common_get_hard_rs1(struct ioexp_obj_s *self, + int virt_offset){ + + return _common_get_bit(self, + &(self->ioexp_map_p->map_hard_rs1[virt_offset]), + "common_get_hard_rs1"); +} + + +int +common_set_tx_disable(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_tx_disable[virt_offset]), + input_val, + "common_set_tx_disable"); +} + + +int +common_set_reset(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_reset[virt_offset]), + input_val, + "common_set_reset"); +} + + +int +common_set_lpmod(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_lpmod[virt_offset]), + input_val, + "common_set_lpmod"); +} + + +int +common_set_modsel(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_modsel[virt_offset]), + input_val, + "common_set_modsel"); +} + + +int +common_set_hard_rs0(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_hard_rs0[virt_offset]), + input_val, + "common_set_hard_rs0"); +} + + +int +common_set_hard_rs1(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + + return _common_set_bit(self, + &(self->ioexp_map_p->map_hard_rs1[virt_offset]), + input_val, + "common_set_hard_rs1"); +} + + +int +ioexp_get_not_support(struct ioexp_obj_s *self, + int virt_offset){ + return ERR_IOEXP_NOTSUPPORT; +} + + +int +ioexp_set_not_support(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + return ERR_IOEXP_NOTSUPPORT; +} + + +int +fake_ioexp_init(struct ioexp_obj_s *self){ + return 1; +} + +int +fake_ioexp_update(struct ioexp_obj_s *self){ + return 1; +} + + +int +fake_update_func(struct ioexp_obj_s *self){ + return 1; +} + +int +fake_get_func(struct ioexp_obj_s *self, + int virt_offset){ + SWPS_WARN("Someone called fake_get_func\n"); + return -1; +} + +int +fake_set_func(struct ioexp_obj_s *self, + int virt_offset, + int input_val){ + SWPS_WARN("Someone called fake_set_func\n"); + return -1; +} + + +/* ========== Initial functions for IO Expander ========== + */ +int +common_ioexp_init(struct ioexp_obj_s *self) { + + int chip_id, offset, err_code; + struct ioexp_addr_s *addr_p; + + if (self->mode == IOEXP_MODE_DIRECT) { + goto update_common_ioexp_init; + } + /* Setup default value to each physical IO Expander */ + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + /* Get address mapping */ + addr_p = &(self->ioexp_map_p->map_addr[chip_id]); + if (!addr_p){ + SWPS_ERR("%s: IOEXP config incorrect! :%d \n", + __func__, chip_id); + return -1; + } + /* Setup default value */ + for (offset=0; offset<(self->ioexp_map_p->data_width); offset++){ + + /* [Desc] Skip the setup default value behavior + [Note] Setup default value = -1 if you don't want to write the value to IOEXP or CPLD + */ + if(addr_p->write_offset[offset] < 0){ + SWPS_DEBUG("skip a write_offset <%d>\n", addr_p->conf_offset[offset]); + continue; + } + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, chip_id), + addr_p->write_offset[offset], + addr_p->data_default[offset]); + if (err_code < 0){ + SWPS_ERR("%s: set default fail! :%d \n", + __func__, err_code); + return ERR_IOEXP_UNEXCPT; + } + } + } +update_common_ioexp_init: + /* Check and update info to object */ + err_code = self->update_all(self, 1, "common_ioexp_init"); + if (err_code < 0) { + SWPS_ERR("%s: update_all() fail! :%d \n", + __func__, err_code); + return ERR_IOEXP_UNEXCPT; + } + return 0; +} + + +/* ========== Object functions for Final State Machine ========== + */ +int +_is_channel_ready(struct ioexp_obj_s *self){ + + int buf = 0; + int chip_id = 0; /* Use first chip which be registered */ + int data_id = 0; /* Use first byte which be registered */ + struct ioexp_addr_s *ioexp_addr = NULL; + + ioexp_addr = &(self->ioexp_map_p->map_addr[chip_id]); + if (!ioexp_addr){ + SWPS_ERR("%s: config incorrect!\n", __func__); + return ERR_IOEXP_UNEXCPT; + } + buf = i2c_smbus_read_byte_data(_get_i2c_client(self, chip_id), + ioexp_addr->read_offset[data_id]); + if (buf >= 0){ + return 1; + } + return 0; +} + +int +_ioexp_init_handler(struct ioexp_obj_s *self){ + + int return_val; + + switch (self->mode) { + case IOEXP_MODE_DIRECT: + return_val = self->init(self); + if (return_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + } else { + self->state = STATE_IOEXP_NORMAL; + } + return return_val; + + case IOEXP_MODE_POLLING: + /* Check system and channel is ready */ + if (self->state == STATE_IOEXP_INIT){ + if (!_is_channel_ready(self)){ + self->state = STATE_IOEXP_INIT; + SWPS_WARN("%s: IOEXP:%d channel not ready.\n", + __func__, self->ioexp_id); + return 0; + } + } + /* Execute initial callback */ + return_val = self->init(self); + if (return_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + } else { + self->state = STATE_IOEXP_NORMAL; + } + return return_val; + + default: + break; + } + SWPS_ERR("%s: exception occur :%d\n", __func__, self->mode); + return ERR_IOEXP_UNEXCPT; +} + + +int +common_ioexp_fsm_4_direct(struct ioexp_obj_s *self){ + + int result_val; + int show_err = 1; + char *func_mane = "common_ioexp_fsm_4_direct"; + + switch (self->state){ + case STATE_IOEXP_INIT: + result_val = _ioexp_init_handler(self); + /* Exception case: terminate initial procedure */ + if(result_val < 0){ + /* Initial fail */ + return result_val; + } + if(self->state == STATE_IOEXP_INIT){ + /* Keep in INIT state, and return error */ + return ERR_IOEXP_UNINIT; + } + /* Case: Initial done */ + return 0; + + case STATE_IOEXP_NORMAL: + result_val = self->update_all(self, show_err, func_mane); + if (result_val < 0){ + SWPS_INFO("%s: NORMAL -> ABNORMAL :%d\n", + __func__, result_val); + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + self->state = STATE_IOEXP_NORMAL; + return 0; + + case STATE_IOEXP_ABNORMAL: + result_val = self->update_all(self, show_err, func_mane); + if (result_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + SWPS_DEBUG("%s: ABNORMAL -> NORMAL :%d\n", + __func__, result_val); + self->state = STATE_IOEXP_NORMAL; + return 0; + + default: + break; + } + SWPS_ERR("%s: Exception occurs :%d\n", + __func__, self->state); + return ERR_IOEXP_UNEXCPT; +} + + +int +common_ioexp_fsm_4_polling(struct ioexp_obj_s *self){ + + int result_val, i, show_e; + int fail_retry = 3; + char *func_name = "common_ioexp_fsm_4_polling"; + +#ifdef DEBUG_SWPS + show_e = 1; +#else + show_e = 0; +#endif + + switch (self->state){ + case STATE_IOEXP_INIT: + result_val = _ioexp_init_handler(self); + /* Exception case: terminate initial procedure */ + if(result_val < 0){ + /* Initial fail */ + return result_val; + } + /* Case: System (Channel) not ready */ + if(self->state == STATE_IOEXP_INIT){ + /* Keep in INIT state, wait and retry */ + return 0; + } + /* Case: Initial done */ + SWPS_INFO("IOEXP-%d: initial done. :%d\n", + self->ioexp_id, self->ioexp_type); + return result_val; + + case STATE_IOEXP_NORMAL: + /* Retry mechanism for case of i2c topology not stable */ + for (i=0; iupdate_all(self, show_e, func_name); + if (result_val >= 0) { + self->state = STATE_IOEXP_NORMAL; + return 0; + } + if (check_channel_tier_1() < 0) { + SWPS_INFO("%s: detect I2C crash :%d\n", + __func__, self->ioexp_id); + break; + } + SWPS_DEBUG("IOEXP-%d: unstable :%d\n", + self->ioexp_id, result_val); + } + SWPS_INFO("IOEXP-%d: NORMAL -> ABNORMAL :%d\n", + self->ioexp_id, result_val); + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + + case STATE_IOEXP_ABNORMAL: + result_val = self->update_all(self, show_e, func_name); + if (result_val < 0){ + self->state = STATE_IOEXP_ABNORMAL; + return result_val; + } + SWPS_INFO("IOEXP-%d: ABNORMAL -> NORMAL :%d\n", + self->ioexp_id, result_val); + self->state = STATE_IOEXP_NORMAL; + return 0; + + default: + break; + } + SWPS_ERR("IOEXP-%d: Exception occurs :%d\n", + self->ioexp_id, self->state); + return ERR_IOEXP_UNEXCPT; +} + + +/* ========== Object private functions for check & update ========== + */ +int +common_ioexp_check(struct ioexp_obj_s *self){ + + int result; + + if (self->mode != IOEXP_MODE_POLLING){ + SWPS_ERR("%s: not polling mode :%d\n", + __func__, self->mode); + return ERR_IOEXP_NOTSUPPORT; + } + mutex_lock(&self->lock); + result = self->fsm_4_polling(self); + mutex_unlock(&self->lock); + return result; +} + + +/* ========== Functions for Factory pattern ========== + */ +static struct ioexp_map_s * +get_ioexp_map(int ioexp_type){ + switch (ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + return &ioexp_map_magnolia_nab; + case IOEXP_TYPE_MAGINOLIA_4AB: + return &ioexp_map_magnolia_4ab; + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + return &ioexp_map_magnolia_7ab; + case IOEXP_TYPE_REDWOOD_P01P08: + return &ioexp_map_redwood_p01p08_p17p24; + case IOEXP_TYPE_REDWOOD_P09P16: + return &ioexp_map_redwood_p09p16_p25p32; + case IOEXP_TYPE_HUDSON32IGA_P01P08: + return &ioexp_map_hudson32iga_p01p08_p17p24; + case IOEXP_TYPE_HUDSON32IGA_P09P16: + return &ioexp_map_hudson32iga_p09p16_p25p32; + case IOEXP_TYPE_CYPRESS_NABC: + return &ioexp_map_cypress_nabc; + case IOEXP_TYPE_CYPRESS_7ABC: + return &ioexp_map_cypress_7abc; + case IOEXP_TYPE_TAHOE_5A: + return &ioexp_map_tahoe_5a; + case IOEXP_TYPE_TAHOE_6ABC: + return &ioexp_map_tahoe_6abc; + case IOEXP_TYPE_SEQUOIA_NABC: + return &ioexp_map_sequoia_nabc; + case IOEXP_TYPE_LAVENDER_P65: + return &ioexp_map_lavender_p65; + case CPLD_TYPE_COTTONWOOD: + return &cpld_map_cottonwood; + case IOEXP_TYPE_MAPLE_0ABC: + return &ioexp_map_maple_0abc; + case IOEXP_TYPE_MAPLE_NABC: + return &ioexp_map_maple_nabc; + default: + return NULL; + } +} + + +int +setup_ioexp_ssize_attr(struct ioexp_obj_s *self, + struct ioexp_map_s *ioexp_map_p, + int ioexp_id, + int ioexp_type, + int run_mode){ + switch (run_mode){ + case IOEXP_MODE_POLLING: /* Direct access device mode */ + case IOEXP_MODE_DIRECT: /* Polling mode, read from cache */ + self->mode = run_mode; + break; + default: + SWPS_ERR("%s: non-defined run_mode:%d\n", + __func__, run_mode); + self->mode = ERR_IOEXP_UNEXCPT; + return ERR_IOEXP_UNEXCPT; + } + /* Setup mapping structure */ + self->ioexp_map_p = kzalloc(sizeof(*ioexp_map_p), GFP_KERNEL); + if (!(self->ioexp_map_p)) { + SWPS_ERR("%s: kzalloc ioexp_map_p fail\n", __func__); + return -1; + } + memcpy(self->ioexp_map_p, ioexp_map_p, sizeof(*ioexp_map_p)); + /* Setup attributes */ + self->ioexp_id = ioexp_id; + self->ioexp_type = ioexp_type; + self->state = STATE_IOEXP_INIT; + mutex_init(&self->lock); + return 0; +} + + +static int +setup_addr_mapping(struct ioexp_obj_s *self, + struct ioexp_addr_s *addr_map_p, + int chip_amount){ + struct ioexp_addr_s *tmp_p; + if (!addr_map_p){ + SWPS_ERR("%s: map is null\n", __func__); + return -1; + } + tmp_p = kzalloc((sizeof(*addr_map_p) * chip_amount), GFP_KERNEL); + if (!tmp_p){ + SWPS_ERR("%s: kzalloc fail.\n", __func__); + return -1; + } + memcpy(tmp_p, addr_map_p, (sizeof(*addr_map_p) * chip_amount)); + self->ioexp_map_p->map_addr = tmp_p; + + return 0; +} + + +static int +setup_ioexp_public_cb(struct ioexp_obj_s *self, + int ioexp_type){ + + switch (ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + case IOEXP_TYPE_MAGINOLIA_4AB: + case CPLD_TYPE_COTTONWOOD: + self->get_present = common_get_present; + self->get_tx_fault = common_get_tx_fault; + self->get_rxlos = common_get_rxlos; + self->get_tx_disable = common_get_tx_disable; + self->get_reset = ioexp_get_not_support; + self->get_lpmod = ioexp_get_not_support; + self->get_modsel = ioexp_get_not_support; + self->get_hard_rs0 = ioexp_get_not_support; + self->get_hard_rs1 = ioexp_get_not_support; + self->set_tx_disable = common_set_tx_disable; + self->set_reset = ioexp_set_not_support; + self->set_lpmod = ioexp_set_not_support; + self->set_modsel = ioexp_set_not_support; + self->set_hard_rs0 = ioexp_set_not_support; + self->set_hard_rs1 = ioexp_set_not_support; + return 0; + case IOEXP_TYPE_CYPRESS_NABC: + case IOEXP_TYPE_MAPLE_NABC: + self->get_present = common_get_present; + self->get_tx_fault = common_get_tx_fault; + self->get_rxlos = common_get_rxlos; + self->get_tx_disable = common_get_tx_disable; + self->get_reset = ioexp_get_not_support; + self->get_lpmod = ioexp_get_not_support; + self->get_modsel = ioexp_get_not_support; + self->get_hard_rs0 = common_get_hard_rs0; + self->get_hard_rs1 = common_get_hard_rs1; + self->set_tx_disable = common_set_tx_disable; + self->set_reset = ioexp_set_not_support; + self->set_lpmod = ioexp_set_not_support; + self->set_modsel = ioexp_set_not_support; + self->set_hard_rs0 = common_set_hard_rs0; + self->set_hard_rs1 = common_set_hard_rs1; + return 0; + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + case IOEXP_TYPE_HUDSON32IGA_P01P08: + case IOEXP_TYPE_HUDSON32IGA_P09P16: + case IOEXP_TYPE_CYPRESS_7ABC: + case IOEXP_TYPE_TAHOE_5A: + case IOEXP_TYPE_TAHOE_6ABC: + case IOEXP_TYPE_SEQUOIA_NABC: + case IOEXP_TYPE_LAVENDER_P65: + case IOEXP_TYPE_MAPLE_0ABC: + self->get_present = common_get_present; + self->get_tx_fault = ioexp_get_not_support; + self->get_rxlos = ioexp_get_not_support; + self->get_tx_disable = ioexp_get_not_support; + self->get_reset = common_get_reset; + self->get_lpmod = common_get_lpmod; + self->get_modsel = common_get_modsel; + self->get_hard_rs0 = ioexp_get_not_support; + self->get_hard_rs1 = ioexp_get_not_support; + self->set_tx_disable = ioexp_set_not_support; + self->set_reset = common_set_reset; + self->set_lpmod = common_set_lpmod; + self->set_modsel = common_set_modsel; + self->set_hard_rs0 = ioexp_set_not_support; + self->set_hard_rs1 = ioexp_set_not_support; + return 0; + + default: + SWPS_ERR("%s: type:%d incorrect!\n", __func__, ioexp_type); + break; + } + return ERR_IOEXP_UNEXCPT; +} + + +static int +setup_ioexp_private_cb(struct ioexp_obj_s *self, + int ioexp_type){ + + switch (ioexp_type){ + case IOEXP_TYPE_MAGINOLIA_NAB: + case IOEXP_TYPE_MAGINOLIA_4AB: + case IOEXP_TYPE_MAGINOLIA_7AB: + case IOEXP_TYPE_SPRUCE_7AB: + case IOEXP_TYPE_REDWOOD_P01P08: + case IOEXP_TYPE_REDWOOD_P09P16: + case IOEXP_TYPE_HUDSON32IGA_P01P08: + case IOEXP_TYPE_HUDSON32IGA_P09P16: + case IOEXP_TYPE_CYPRESS_NABC: + case IOEXP_TYPE_CYPRESS_7ABC: + case IOEXP_TYPE_TAHOE_5A: + case IOEXP_TYPE_TAHOE_6ABC: + case IOEXP_TYPE_SEQUOIA_NABC: + case IOEXP_TYPE_LAVENDER_P65: + case CPLD_TYPE_COTTONWOOD: + case IOEXP_TYPE_MAPLE_NABC: + case IOEXP_TYPE_MAPLE_0ABC: + self->init = common_ioexp_init; + self->check = common_ioexp_check; + self->update_all = common_ioexp_update_all; + self->fsm_4_direct = common_ioexp_fsm_4_direct; + self->fsm_4_polling = common_ioexp_fsm_4_polling; + return 0; + + default: + SWPS_ERR("%s: type:%d incorrect!\n", __func__, ioexp_type); + break; + } + return ERR_IOEXP_UNEXCPT; +} + + +static int +setup_i2c_client_one(struct ioexp_obj_s *self, + int chip_id){ + + char *err_msg = "ERROR"; + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + struct ioexp_i2c_s *i2c_obj_p = NULL; + struct ioexp_i2c_s *i2c_curr_p = NULL; + + int chan_id = self->ioexp_map_p->map_addr[chip_id].chan_id; + adap = i2c_get_adapter(chan_id); + if(!adap){ + err_msg = "Can not get adap!"; + goto err_ioexp_setup_i2c_1; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + err_msg = "Can not kzalloc client!"; + goto err_ioexp_setup_i2c_1; + } + i2c_obj_p = kzalloc(sizeof(*i2c_obj_p), GFP_KERNEL); + if (!i2c_obj_p){ + err_msg = "Can not kzalloc i2c_obj_p!"; + goto err_ioexp_setup_i2c_2; + } + client->adapter = adap; + client->addr = self->ioexp_map_p->map_addr[chip_id].chip_addr; + i2c_obj_p->i2c_client_p = client; + i2c_obj_p->chip_id = chip_id; + i2c_obj_p->next = NULL; + if (!self->i2c_head_p){ + self->i2c_head_p = i2c_obj_p; + } else { + i2c_curr_p = self->i2c_head_p; + while (i2c_curr_p->next){ + i2c_curr_p = i2c_curr_p->next; + } + i2c_curr_p->next = i2c_obj_p; + } + return 0; + +err_ioexp_setup_i2c_2: + kfree(client); +err_ioexp_setup_i2c_1: + SWPS_ERR("%s: %s :%d\n", __func__, err_msg, chan_id); + return -1; +} + + +static int +setup_i2c_client(struct ioexp_obj_s* self){ + + int result; + int chip_id = 0; + + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + result = setup_i2c_client_one(self, chip_id); + if (result < 0){ + SWPS_ERR("%s fail! :%d\n", __func__, chip_id); + return -1; + } + } + return 0; +} + + +static int +setup_ioexp_config(struct ioexp_obj_s *self) { + + int chip_id, offset, err_code; + struct ioexp_addr_s *addr_p; + + for (chip_id=0; chip_id<(self->ioexp_map_p->chip_amount); chip_id++){ + addr_p = &(self->ioexp_map_p->map_addr[chip_id]); + if (!addr_p){ + SWPS_ERR("IOEXP config incorrect! :%d \n",chip_id); + return -1; + } + for (offset=0; offset<(self->ioexp_map_p->data_width); offset++){ + + /* [Desc] Skip the setup config value behavior + [Note] Setup config value = -1 if you don't want to write the value to IOEXP or CPLD + */ + if(addr_p->conf_offset[offset] < 0){ + SWPS_DEBUG("skip a config_offset <%d>\n", addr_p->conf_offset[offset]); + continue; + } + err_code = i2c_smbus_write_byte_data(_get_i2c_client(self, chip_id), + addr_p->conf_offset[offset], + addr_p->conf_default[offset]); + + if (err_code < 0){ + SWPS_INFO("%s: set conf fail! :%d \n", __func__, err_code); + return -2; + } + } + } + return 0; +} + + +struct ioexp_obj_s * +_create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode){ + + struct ioexp_map_s* ioexp_map_p; + struct ioexp_obj_s* result_p; + struct ioexp_i2c_s *i2c_curr_p; + struct ioexp_i2c_s *i2c_next_p; + + /* Get layout */ + ioexp_map_p = get_ioexp_map(ioexp_type); + if (!ioexp_map_p){ + SWPS_ERR("%s: Invalid ioexp_type\n", __func__); + goto err_create_ioexp_fail; + } + /* Prepare IOEXP object */ + result_p = kzalloc(sizeof(*result_p), GFP_KERNEL); + if (!result_p){ + SWPS_ERR("%s: kzalloc failure!\n", __func__); + goto err_create_ioexp_fail; + } + /* Prepare static size attributes */ + if (setup_ioexp_ssize_attr(result_p, + ioexp_map_p, + ioexp_id, + ioexp_type, + run_mode) < 0){ + goto err_create_ioexp_setup_attr_fail; + } + /* Prepare address mapping */ + if (setup_addr_mapping(result_p, addr_map_p, ioexp_map_p->chip_amount) < 0){ + goto err_create_ioexp_setup_attr_fail; + } + if (setup_i2c_client(result_p) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + /* Prepare call back functions of object */ + if (setup_ioexp_public_cb(result_p, ioexp_type) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + if (setup_ioexp_private_cb(result_p, ioexp_type) < 0){ + goto err_create_ioexp_setup_i2c_fail; + } + return result_p; + +err_create_ioexp_setup_i2c_fail: + i2c_curr_p = result_p->i2c_head_p; + i2c_next_p = result_p->i2c_head_p; + while (i2c_curr_p){ + i2c_next_p = i2c_curr_p->next; + kfree(i2c_curr_p->i2c_client_p); + kfree(i2c_curr_p); + i2c_curr_p = i2c_next_p; + } +err_create_ioexp_setup_attr_fail: + kfree(result_p); +err_create_ioexp_fail: + SWPS_ERR("%s: fail! :%d :%d \n", + __func__, ioexp_id, ioexp_type); + return NULL; +} + + +int +create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode){ + + struct ioexp_obj_s *ioexp_p = NULL; + + ioexp_p = _create_ioexp_obj(ioexp_id, ioexp_type, + addr_map_p, run_mode); + if (!ioexp_p){ + return -1; + } + if (ioexp_head_p == NULL){ + ioexp_head_p = ioexp_p; + ioexp_tail_p = ioexp_p; + return 0; + } + ioexp_tail_p->next = ioexp_p; + ioexp_tail_p = ioexp_p; + return 0; +} + + +static int +_init_ioexp_obj(struct ioexp_obj_s* self) { + + char *err_msg = "ERR"; + char *func_name = "_init_ioexp_obj"; + + /* Setup IOEXP configure byte */ + if (setup_ioexp_config(self) < 0){ + err_msg = "setup_ioexp_config fail"; + goto err_init_ioexp_obj; + } + /* Setup default data */ + if (_ioexp_init_handler(self) < 0){ + err_msg = "_ioexp_init_handler fail"; + goto err_init_ioexp_obj; + } + /* Update all */ + if (self->state == STATE_IOEXP_NORMAL){ + if (self->update_all(self, 1, func_name) < 0){ + err_msg = "update_all() fail"; + goto err_init_ioexp_obj; + } + } + return 0; + +err_init_ioexp_obj: + SWPS_DEBUG("%s: %s\n", __func__, err_msg); + return -1; +} + + +int +init_ioexp_objs(void){ + /* Return value: + * 0: Success + * -1: Detect topology error + * -2: SWPS internal error + */ + + struct ioexp_obj_s *curr_p = ioexp_head_p; + + if (!curr_p) { + SWPS_ERR("%s: ioexp_head_p is NULL\n", __func__); + return -2; + } + while (curr_p) { + if (_init_ioexp_obj(curr_p) < 0) { + SWPS_DEBUG("%s: _init_ioexp_obj() fail\n", __func__); + return -1; + } + curr_p = curr_p->next; + } + SWPS_DEBUG("%s: done.\n", __func__); + return 0; +} + + +void +clean_ioexp_objs(void){ + + struct ioexp_i2c_s *i2c_curr_p = NULL; + struct ioexp_i2c_s *i2c_next_p = NULL; + struct ioexp_obj_s *ioexp_next_p = NULL; + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + if (ioexp_head_p == NULL){ + ioexp_tail_p = NULL; + return; + } + while(ioexp_curr_p){ + ioexp_next_p = ioexp_curr_p->next; + if (ioexp_curr_p->ioexp_map_p) { + if (ioexp_curr_p->ioexp_map_p->map_addr) { + kfree(ioexp_curr_p->ioexp_map_p->map_addr); + } + kfree(ioexp_curr_p->ioexp_map_p); + } + + i2c_curr_p = ioexp_curr_p->i2c_head_p; + while (i2c_curr_p) { + i2c_next_p = i2c_curr_p->next; + kfree(i2c_curr_p->i2c_client_p); + kfree(i2c_curr_p); + i2c_curr_p = i2c_next_p; + } + kfree(ioexp_curr_p); + ioexp_curr_p = ioexp_next_p; + } + ioexp_tail_p = NULL; + SWPS_DEBUG("%s: done.\n", __func__); +} + + +int +check_ioexp_objs(void){ + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while (ioexp_curr_p){ + if ( (ioexp_curr_p->check(ioexp_curr_p)) < 0){ + SWPS_INFO("check IOEXP-%d fail! :%d\n", + ioexp_curr_p->ioexp_id, ioexp_curr_p->ioexp_type); + return -1; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return 0; +} + + +struct ioexp_obj_s * +get_ioexp_obj(int ioexp_id){ + + struct ioexp_obj_s *result_p = NULL; + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + if (ioexp_curr_p->ioexp_id == ioexp_id){ + result_p = ioexp_curr_p; + break; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return result_p; +} + + +void +unlock_ioexp_all(void) { + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + mutex_unlock(&ioexp_curr_p->lock); + ioexp_curr_p = ioexp_curr_p->next; + } +} + + +int +lock_ioexp_all(void) { + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + + while(ioexp_curr_p){ + mutex_lock(&ioexp_curr_p->lock); + ioexp_curr_p = ioexp_curr_p->next; + } + return 0; +} + + +int +check_channel_tier_1(void) { + + if ( (!_is_channel_ready(ioexp_head_p)) && + (!_is_channel_ready(ioexp_tail_p)) ){ + return -1; + } + return 0; +} + + +static int +_scan_channel_tier_1(int force, + int show_err) { + + struct ioexp_obj_s *ioexp_curr_p = ioexp_head_p; + int ready = 0; + + if (!ioexp_curr_p) { + goto err_scan_tier_1_channel; + } + while(ioexp_curr_p) { + ready = _is_channel_ready(ioexp_curr_p); + if ((!ready) && (!force)) { + goto err_scan_tier_1_channel; + } + ioexp_curr_p = ioexp_curr_p->next; + } + return 0; + +err_scan_tier_1_channel: + if (show_err) { + if (ioexp_curr_p) { + SWPS_INFO("%s: IOEXP-%d fail\n", __func__, ioexp_curr_p->ioexp_id); + } else { + SWPS_INFO("%s: IOEXP is null.\n", __func__); + } + } + return -1; +} + + +static int +_scan_channel_tier_1_single(void) { + + int ret = 0; + int chan_id = 0; + int fake_cid = 0; + int fake_offs = 0; + int fake_addr = 0; + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + + if (ioexp_head_p->ioexp_id != ioexp_tail_p->ioexp_id) { + return 0; + } + /* Setup i2c_client */ + chan_id = ioexp_head_p->ioexp_map_p->map_addr[fake_cid].chan_id; + fake_addr = ioexp_head_p->ioexp_map_p->map_addr[fake_cid].chip_addr; + adap = i2c_get_adapter((chan_id + 1)); + if(!adap){ + SWPS_INFO("%s: Can not get adap!\n", __func__); + return 0; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + SWPS_INFO("%s: Can not kzalloc client!\n", __func__); + return 0; + } + client->adapter = adap; + client->addr = fake_addr; + /* Fouce move ioexp ptr to next */ + ret = i2c_smbus_read_byte_data(client, fake_offs); + SWPS_DEBUG("%s: move ioexp_ptr done. :%d\n", __func__, ret); + kfree(client); + return 1; +} + + +int +resync_channel_tier_1(void) { + + char *emsg = "ERR"; + + if (!ioexp_head_p) { + emsg = "ioexp_head_p is NULL"; + goto err_resync_ioexp_status_1; + } + /* Run all */ + if (ioexp_head_p->ioexp_id == ioexp_tail_p->ioexp_id) { + _scan_channel_tier_1_single(); + } else { + _scan_channel_tier_1(1, 0); + } + /* Check all */ + if (_scan_channel_tier_1(0, 1) < 0) { + emsg = "resync tier-1 channel fail"; + goto err_resync_ioexp_status_1; + } + return 0; + +err_resync_ioexp_status_1: + SWPS_ERR("%s: %s\n", __func__, emsg); + return -1; +} + + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/io_expander.h b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/io_expander.h new file mode 100644 index 000000000000..1af909e2466a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/io_expander.h @@ -0,0 +1,187 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef IO_EXPANDER_H +#define IO_EXPANDER_H + +#include + + +/* IOEXP type define (SFP series) */ +#define IOEXP_TYPE_MAGINOLIA_NAB (10101) +#define IOEXP_TYPE_MAGINOLIA_4AB (10102) +#define IOEXP_TYPE_CYPRESS_NABC (10103) +#define IOEXP_TYPE_MAPLE_NABC (10104) + +/* IOEXP type define (QSFP series) */ +#define IOEXP_TYPE_MAGINOLIA_7AB (10201) +#define IOEXP_TYPE_REDWOOD_P01P08 (10202) +#define IOEXP_TYPE_REDWOOD_P09P16 (10203) +#define IOEXP_TYPE_HUDSON32IGA_P01P08 (10204) +#define IOEXP_TYPE_HUDSON32IGA_P09P16 (10205) +#define IOEXP_TYPE_SPRUCE_7AB (10206) +#define IOEXP_TYPE_CYPRESS_7ABC (10207) +#define IOEXP_TYPE_TAHOE_5A (10208) +#define IOEXP_TYPE_TAHOE_6ABC (10209) +#define IOEXP_TYPE_SEQUOIA_NABC (10210) +#define IOEXP_TYPE_LAVENDER_P65 (10211) +#define IOEXP_TYPE_MAPLE_0ABC (10212) + +/* CPLD type define */ +#define CPLD_TYPE_COTTONWOOD (10301) + +/* IOEXP mode define */ +#define IOEXP_MODE_POLLING (19000) +#define IOEXP_MODE_DIRECT (19001) + +/* IOEXP state define */ +#define STATE_IOEXP_NORMAL (0) +#define STATE_IOEXP_INIT (-1) +#define STATE_IOEXP_ABNORMAL (-2) + +/* IOEXP error code define */ +#define ERR_IOEXP_NOTSUPPORT (-100) +#define ERR_IOEXP_UNINIT (-101) +#define ERR_IOEXP_BADCONF (-102) +#define ERR_IOEXP_ABNORMAL (-103) +#define ERR_IOEXP_NOSTATE (-104) +#define ERR_IOEXP_BADINPUT (-105) +#define ERR_IOEXP_UNEXCPT (-199) + +#define SWPS_INFO(fmt, args...) printk( KERN_INFO "[SWPS] " fmt, ##args) +#define SWPS_WARN(fmt, args...) printk( KERN_WARNING "[SWPS] " fmt, ##args) +#define SWPS_ERR(fmt, args...) printk( KERN_ERR "[SWPS] " fmt, ##args) + +#ifdef DEBUG_SWPS +# define SWPS_DEBUG(fmt, args...) printk( KERN_DEBUG "[SWPS] " fmt, ##args) +#else +# define SWPS_DEBUG(fmt, args...) +#endif + + +struct ioexp_addr_s { + int chan_id; + int chip_addr; + int read_offset[8]; + int write_offset[8]; + int conf_offset[8]; + uint8_t data_default[8]; + uint8_t conf_default[8]; +}; + +struct ioexp_i2c_s { + int chip_id; + struct i2c_client *i2c_client_p; + struct ioexp_i2c_s *next; +}; + + +struct ioexp_bitmap_s { + int chip_id; /* IOEXP chip id */ + int ioexp_voffset; /* IOEXP virtual offset */ + int bit_shift; +}; + +struct ioexp_map_s { + int chip_amount; /* Number of chips that IOEXP object content */ + int data_width; /* Number of (Read/Write/Config) bytes */ + struct ioexp_addr_s *map_addr; /* Chip address info */ + struct ioexp_bitmap_s map_present[10]; /* IOEXP for SFP / QSFP */ + struct ioexp_bitmap_s map_tx_disable[10]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_tx_fault[10]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_rxlos[10]; /* IOEXP for SFP */ + struct ioexp_bitmap_s map_reset[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_lpmod[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_modsel[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_hard_rs0[10]; /* IOEXP for QSFP */ + struct ioexp_bitmap_s map_hard_rs1[10]; /* IOEXP for QSFP */ +}; + +struct ioexp_data_s { + uint8_t data[8]; +}; + +struct ioexp_obj_s { + + /* ============================ + * Object public property + * ============================ + */ + int ioexp_id; + int ioexp_type; + + /* ============================ + * Object private property + * ============================ + */ + struct ioexp_data_s chip_data[16]; /* Max: 8-ioexp in one virt-ioexp(ioexp_obj) */ + struct ioexp_map_s *ioexp_map_p; + struct ioexp_obj_s *next; + struct ioexp_i2c_s *i2c_head_p; + struct mutex lock; + int mode; + int state; + + /* =========================================== + * Object public functions + * =========================================== + */ + int (*get_present)(struct ioexp_obj_s *self, int virt_offset); + int (*get_tx_fault)(struct ioexp_obj_s *self, int virt_offset); + int (*get_rxlos)(struct ioexp_obj_s *self, int virt_offset); + int (*get_tx_disable)(struct ioexp_obj_s *self, int virt_offset); + int (*get_reset)(struct ioexp_obj_s *self, int virt_offset); + int (*get_lpmod)(struct ioexp_obj_s *self, int virt_offset); + int (*get_modsel)(struct ioexp_obj_s *self, int virt_offset); + int (*get_hard_rs0)(struct ioexp_obj_s *self, int virt_offset); + int (*get_hard_rs1)(struct ioexp_obj_s *self, int virt_offset); + int (*set_tx_disable)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_reset)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_lpmod)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_modsel)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_hard_rs0)(struct ioexp_obj_s *self, int virt_offset, int input_val); + int (*set_hard_rs1)(struct ioexp_obj_s *self, int virt_offset, int input_val); + + /* =========================================== + * Object private functions + * =========================================== + */ + int (*init)(struct ioexp_obj_s *self); + int (*check)(struct ioexp_obj_s *self); + int (*update_all)(struct ioexp_obj_s *self, int show_err, char *caller_name); + int (*fsm_4_direct)(struct ioexp_obj_s* self); + int (*fsm_4_polling)(struct ioexp_obj_s* self); +}; + + +struct ioexp_obj_s* get_ioexp_obj(int ioexp_id); +int create_ioexp_obj(int ioexp_id, + int ioexp_type, + struct ioexp_addr_s *addr_map_p, + int run_mode); +int init_ioexp_objs(void); +int check_ioexp_objs(void); +void clean_ioexp_objs(void); + +void unlock_ioexp_all(void); +int lock_ioexp_all(void); + +int check_channel_tier_1(void); +int resync_channel_tier_1(void); + +/* Macro for bit control */ +#define SWP_BIT_SET(byte_val,bit_shift) ((byte_val) |= (1<<(bit_shift))) +#define SWP_BIT_CLEAR(byte_val,bit_shift) ((byte_val) &= ~(1<<(bit_shift))) + + +#endif /* IO_EXPANDER_H */ + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/transceiver.c b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/transceiver.c new file mode 100644 index 000000000000..6fe8f599fb48 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/transceiver.c @@ -0,0 +1,8389 @@ +/* + * 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 "io_expander.h" +#include "transceiver.h" + + +/* ========== Register EEPROM address mapping ========== + */ +struct eeprom_map_s eeprom_map_sfp = { + .addr_br =0x50, .page_br =-1, .offset_br =12, .length_br =1, + .addr_cdr =-1, .page_cdr =-1, .offset_cdr =-1, .length_cdr =-1, + .addr_comp_rev =0x50, .page_comp_rev =-1, .offset_comp_rev =94, .length_comp_rev =1, + .addr_connector =0x50, .page_connector =-1, .offset_connector =2, .length_connector =1, + .addr_diag_type =0x50, .page_diag_type =-1, .offset_diag_type =92 , .length_diag_type =1, + .addr_extbr =-1, .page_extbr =-1, .offset_extbr =-1, .length_extbr =-1, + .addr_ext_id =0x50, .page_ext_id =-1, .offset_ext_id =1, .length_ext_id =1, + .addr_id =0x50, .page_id =-1, .offset_id =0, .length_id =1, + .addr_len_sm =0x50, .page_len_sm =-1, .offset_len_sm =15, .length_len_sm =1, + .addr_len_smf =0x50, .page_len_smf =-1, .offset_len_smf =14, .length_len_smf =1, + .addr_len_om1 =0x50, .page_len_om1 =-1, .offset_len_om1 =17, .length_len_om1 =1, + .addr_len_om2 =0x50, .page_len_om2 =-1, .offset_len_om2 =16, .length_len_om2 =1, + .addr_len_om3 =0x50, .page_len_om3 =-1, .offset_len_om3 =19, .length_len_om3 =1, + .addr_len_om4 =0x50, .page_len_om4 =-1, .offset_len_om4 =18, .length_len_om4 =1, + .addr_option =0x50, .page_option =-1, .offset_option =64, .length_option =2, + .addr_rate_id =0x50, .page_rate_id =-1, .offset_rate_id =13, .length_rate_id =1, + .addr_rx_am =-1, .page_rx_am =-1, .offset_rx_am =-1, .length_rx_am =-1, + .addr_rx_em =0x51, .page_rx_em =-1, .offset_rx_em =115, .length_rx_em =1, + .addr_rx_los =-1, .page_rx_los =-1, .offset_rx_los =-1, .length_rx_los =-1, + .addr_rx_power =0x51, .page_rx_power =-1, .offset_rx_power =104, .length_rx_power =2, + .addr_soft_rs0 =0x51, .page_soft_rs0 =-1, .offset_soft_rs0 =110, .length_soft_rs0 =1, + .addr_soft_rs1 =0x51, .page_soft_rs1 =-1, .offset_soft_rs1 =118, .length_soft_rs0 =1, + .addr_temp =0x51, .page_temp =-1, .offset_temp =96, .length_temp =2, + .addr_trancomp =0x50, .page_trancomp =-1, .offset_trancomp =3, .length_trancomp =8, + .addr_trancomp_ext =0x50, .page_trancomp_ext =-1, .offset_trancomp_ext =36, .length_trancomp_ext =1, + .addr_tx_bias =0x51, .page_tx_bias =-1, .offset_tx_bias =100, .length_tx_bias =2, + .addr_tx_disable =-1, .page_tx_disable =-1, .offset_tx_disable =-1, .length_tx_disable =-1, + .addr_tx_eq =0x51, .page_tx_eq =-1, .offset_tx_eq =114, .length_tx_eq =1, + .addr_tx_fault =-1, .page_tx_fault =-1, .offset_tx_fault =-1, .length_tx_fault =-1, + .addr_tx_power =0x51, .page_tx_power =-1, .offset_tx_power =102, .length_tx_power =2, + .addr_vendor_name =0x50, .page_vendor_name =-1, .offset_vendor_name =20, .length_vendor_name =16, + .addr_vendor_pn =0x50, .page_vendor_pn =-1, .offset_vendor_pn =40, .length_vendor_pn =16, + .addr_vendor_rev =0x50, .page_vendor_rev =-1, .offset_vendor_rev =56, .length_vendor_rev =4, + .addr_vendor_sn =0x50, .page_vendor_sn =-1, .offset_vendor_sn =68, .length_vendor_sn =16, + .addr_voltage =0x51, .page_voltage =-1, .offset_voltage =98, .length_voltage =2, + .addr_wavelength =0x50, .page_wavelength =-1, .offset_wavelength =60, .length_wavelength =2, +}; + +struct eeprom_map_s eeprom_map_qsfp = { + .addr_br =0x50, .page_br =0, .offset_br =140, .length_br =1, + .addr_cdr =-1, .page_cdr =-1, .offset_cdr =-1, .length_cdr =-1, + .addr_comp_rev =0x50, .page_comp_rev =-1, .offset_comp_rev =1, .length_comp_rev =1, + .addr_connector =0x50, .page_connector =0, .offset_connector =130, .length_connector =1, + .addr_diag_type =0x50, .page_diag_type =0, .offset_diag_type =220, .length_diag_type =1, + .addr_extbr =0x50, .page_extbr =0, .offset_extbr =222, .length_extbr =1, + .addr_ext_id =0x50, .page_ext_id =0, .offset_ext_id =129, .length_ext_id =1, + .addr_id =0x50, .page_id =0, .offset_id =128, .length_id =1, + .addr_len_sm =-1, .page_len_sm =-1, .offset_len_sm =-1, .length_len_sm =-1, + .addr_len_smf =0x50, .page_len_smf =0, .offset_len_smf =142, .length_len_smf =1, + .addr_len_om1 =0x50, .page_len_om1 =0, .offset_len_om1 =145, .length_len_om1 =1, + .addr_len_om2 =0x50, .page_len_om2 =0, .offset_len_om2 =144, .length_len_om2 =1, + .addr_len_om3 =0x50, .page_len_om3 =0, .offset_len_om3 =143, .length_len_om3 =1, + .addr_len_om4 =0x50, .page_len_om4 =0, .offset_len_om4 =146, .length_len_om4 =1, + .addr_option =0x50, .page_option =0, .offset_option =193, .length_option =3, + .addr_rate_id =-1, .page_rate_id =-1, .offset_rate_id =-1, .length_rate_id =-1, + .addr_rx_am =-1, .page_rx_am =-1, .offset_rx_am =-1, .length_rx_am =-1, + .addr_rx_em =-1, .page_rx_em =-1, .offset_rx_em =-1, .length_rx_em =-1, + .addr_rx_los =0x50, .page_rx_los =-1, .offset_rx_los =3, .length_rx_los =1, + .addr_rx_power =0x50, .page_rx_power =-1, .offset_rx_power =34, .length_rx_power =8, + .addr_soft_rs0 =-1, .page_soft_rs0 =-1, .offset_soft_rs0 =-1, .length_soft_rs0 =-1, + .addr_soft_rs1 =-1, .page_soft_rs1 =-1, .offset_soft_rs1 =-1, .length_soft_rs0 =-1, + .addr_temp =0x50, .page_temp =-1, .offset_temp =22, .length_temp =2, + .addr_trancomp =0x50, .page_trancomp =0, .offset_trancomp =131, .length_trancomp =8, + .addr_trancomp_ext =0x50, .page_trancomp_ext =0, .offset_trancomp_ext =192, .length_trancomp_ext =1, + .addr_tx_bias =0x50, .page_tx_bias =-1, .offset_tx_bias =42, .length_tx_bias =8, + .addr_tx_disable =0x50, .page_tx_disable =-1, .offset_tx_disable =86, .length_tx_disable =1, + .addr_tx_eq =-1, .page_tx_eq =-1, .offset_tx_eq =-1, .length_tx_eq =-1, + .addr_tx_fault =0x50, .page_tx_fault =-1, .offset_tx_fault =4, .length_tx_fault =1, + .addr_tx_power =0x50, .page_tx_power =-1, .offset_tx_power =50, .length_tx_power =8, + .addr_vendor_name =0x50, .page_vendor_name =0, .offset_vendor_name =148, .length_vendor_name =16, + .addr_vendor_pn =0x50, .page_vendor_pn =0, .offset_vendor_pn =168, .length_vendor_pn =16, + .addr_vendor_rev =0x50, .page_vendor_rev =0, .offset_vendor_rev =184, .length_vendor_rev =2, + .addr_vendor_sn =0x50, .page_vendor_sn =0, .offset_vendor_sn =196, .length_vendor_sn =16, + .addr_voltage =0x50, .page_voltage =-1, .offset_voltage =26, .length_voltage =2, + .addr_wavelength =0x50, .page_wavelength =0, .offset_wavelength =186, .length_wavelength =2, +}; + +struct eeprom_map_s eeprom_map_qsfp28 = { + .addr_br =0x50, .page_br =0, .offset_br =140, .length_br =1, + .addr_cdr =0x50, .page_cdr =-1, .offset_cdr =98, .length_cdr =1, + .addr_comp_rev =0x50, .page_comp_rev =-1, .offset_comp_rev =1, .length_comp_rev =1, + .addr_connector =0x50, .page_connector =0, .offset_connector =130, .length_connector =1, + .addr_diag_type =0x50, .page_diag_type =0, .offset_diag_type =220, .length_diag_type =1, + .addr_extbr =0x50, .page_extbr =0, .offset_extbr =222, .length_extbr =1, + .addr_ext_id =0x50, .page_ext_id =0, .offset_ext_id =129, .length_ext_id =1, + .addr_id =0x50, .page_id =0, .offset_id =128, .length_id =1, + .addr_len_sm =-1, .page_len_sm =-1, .offset_len_sm =-1, .length_len_sm =-1, + .addr_len_smf =0x50, .page_len_smf =0, .offset_len_smf =142, .length_len_smf =1, + .addr_len_om1 =0x50, .page_len_om1 =0, .offset_len_om1 =145, .length_len_om1 =1, + .addr_len_om2 =0x50, .page_len_om2 =0, .offset_len_om2 =144, .length_len_om2 =1, + .addr_len_om3 =0x50, .page_len_om3 =0, .offset_len_om3 =143, .length_len_om3 =1, + .addr_len_om4 =0x50, .page_len_om4 =0, .offset_len_om4 =146, .length_len_om4 =1, + .addr_option =0x50, .page_option =0, .offset_option =193, .length_option =3, + .addr_rate_id =-1, .page_rate_id =-1, .offset_rate_id =-1, .length_rate_id =-1, + .addr_rx_am =0x50, .page_rx_am =3, .offset_rx_am =238, .length_rx_am =2, + .addr_rx_em =0x50, .page_rx_em =3, .offset_rx_em =236, .length_rx_em =2, + .addr_rx_los =0x50, .page_rx_los =-1, .offset_rx_los =3, .length_rx_los =1, + .addr_rx_power =0x50, .page_rx_power =-1, .offset_rx_power =34, .length_rx_power =8, + .addr_soft_rs0 =-1, .page_soft_rs0 =-1, .offset_soft_rs0 =-1, .length_soft_rs0 =-1, + .addr_soft_rs1 =-1, .page_soft_rs1 =-1, .offset_soft_rs1 =-1, .length_soft_rs0 =-1, + .addr_temp =0x50, .page_temp =-1, .offset_temp =22, .length_temp =2, + .addr_trancomp =0x50, .page_trancomp =0, .offset_trancomp =131, .length_trancomp =8, + .addr_trancomp_ext =0x50, .page_trancomp_ext =0, .offset_trancomp_ext =192, .length_trancomp_ext =1, + .addr_tx_bias =0x50, .page_tx_bias =-1, .offset_tx_bias =42, .length_tx_bias =8, + .addr_tx_disable =0x50, .page_tx_disable =-1, .offset_tx_disable =86, .length_tx_disable =1, + .addr_tx_eq =0x50, .page_tx_eq =3, .offset_tx_eq =234, .length_tx_eq =2, + .addr_tx_fault =0x50, .page_tx_fault =-1, .offset_tx_fault =4, .length_tx_fault =1, + .addr_tx_power =0x50, .page_tx_power =-1, .offset_tx_power =50, .length_tx_power =8, + .addr_vendor_name =0x50, .page_vendor_name =0, .offset_vendor_name =148, .length_vendor_name =16, + .addr_vendor_pn =0x50, .page_vendor_pn =0, .offset_vendor_pn =168, .length_vendor_pn =16, + .addr_vendor_rev =0x50, .page_vendor_rev =0, .offset_vendor_rev =184, .length_vendor_rev =2, + .addr_vendor_sn =0x50, .page_vendor_sn =0, .offset_vendor_sn =196, .length_vendor_sn =16, + .addr_voltage =0x50, .page_voltage =-1, .offset_voltage =26, .length_voltage =2, + .addr_wavelength =0x50, .page_wavelength =0, .offset_wavelength =186, .length_wavelength =2, +}; + + +/* ========== Utility Functions ========== + */ +static int +get_bit(uint8_t origin_byte, int bit_shift) { + return (int)((origin_byte >> bit_shift) & 0x1); +} + +static int +transform_word_to_int(uint8_t hight_byte, + uint8_t low_byte) { + return ((((int)hight_byte) << 8) + (int)low_byte); +} + +void +alarm_msg_2_user(struct transvr_obj_s *self, + char *emsg) { + + SWPS_ERR("%s on %s.\n", emsg, self->swp_name); +} + + +/* ========== Private functions ========== + */ +static int +_reload_transvr_obj(struct transvr_obj_s *self,int new_type); + +static int +reload_transvr_obj(struct transvr_obj_s *self,int new_type); + +static int +_is_transvr_support_ctle(struct transvr_obj_s *self); + +static int +_transvr_init_handler(struct transvr_obj_s *self); + +int +_transvr_clean_handler(struct transvr_obj_s *self); + +int +_sfp_detect_class_by_1g_ethernet(struct transvr_obj_s* self); + + +void +lock_transvr_obj(struct transvr_obj_s *self) { + + mutex_lock(&self->lock); + self->curr_page = VAL_TRANSVR_PAGE_FREE; +} + + +void +unlock_transvr_obj(struct transvr_obj_s *self) { + + self->curr_page = VAL_TRANSVR_PAGE_FREE; + mutex_unlock(&self->lock); +} + + +static int +_check_by_mode(struct transvr_obj_s *self, + int (*attr_update_func)(struct transvr_obj_s *self, int show_err), + char *caller_name){ + + int return_val = ERR_TRANSVR_UNEXCPT; + + switch (self->mode){ + case TRANSVR_MODE_POLLING: + switch (self->state){ + case STATE_TRANSVR_CONNECTED: + goto ok_check_by_mode_1; + case STATE_TRANSVR_NEW: + case STATE_TRANSVR_INIT: + return ERR_TRANSVR_UNINIT; + case STATE_TRANSVR_DISCONNECTED: + return ERR_TRANSVR_UNPLUGGED; + case STATE_TRANSVR_UNEXCEPTED: + return ERR_TRANSVR_ABNORMAL; + case STATE_TRANSVR_ISOLATED: + return ERR_TRNASVR_BE_ISOLATED; + default: + goto err_check_by_mode_1; + } + goto ok_check_by_mode_1; + + case TRANSVR_MODE_DIRECT: + return_val = self->fsm_4_direct(self, caller_name); + if (return_val < 0){ + return return_val; + } + goto ok_check_by_mode_1; + + default: + goto err_check_by_mode_1; + } + goto ok_check_by_mode_1; + +ok_check_by_mode_1: + return attr_update_func(self, 0); + +err_check_by_mode_1: + SWPS_INFO("_check_by_mode: mode:%d state:%d\n", self->mode, self->state); + return ERR_TRANSVR_UNEXCPT; +} + + +static void +_transvr_clean_retry(struct transvr_obj_s *self) { + self->retry = 0; +} + + +static int +_transvr_handle_retry(struct transvr_obj_s *self, int retry) { + /* Return: 0: keep retry + * -1: stop retry + */ + if (self->retry == 0) { + self->retry = retry; + } + self->retry -= 1; + if (self->retry <= 0) { + _transvr_clean_retry(self); + return -1; + } + return 0; +} + + +static int +_common_setup_page(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + int show_e) { + /* return: + * 0 : OK + * -1 : EEPROM settings incorrect + * -2 : I2C R/W failure + * -3 : Undefined case + */ + int retval = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Check */ + if ((addr < 0) || (offset < 0) || (len < 0)) { + emsg = "EEPROM settings incorrect"; + retval = -1; + goto err_common_setup_page; + } + /* Case1: continue access */ + if ((self->i2c_client_p->addr == addr) && + (self->curr_page == page)) { + return 0; + } + self->i2c_client_p->addr = addr; + /* Case2: select lower page */ + if (page == -1) { + self->curr_page = page; + return 0; + } + /* Case3: select upper page */ + if (page >= 0) { + goto upper_common_setup_page; + } + /* Unexpected case */ + show_e = 1; + emsg = "Unexpected case"; + retval = -3; + goto err_common_setup_page; + +upper_common_setup_page: + if (i2c_smbus_write_byte_data(self->i2c_client_p, + VAL_TRANSVR_PAGE_SELECT_OFFSET, + page) < 0) { + emsg = "I2C R/W failure"; + retval = -2; + goto err_common_setup_page; + } + self->curr_page = page; + mdelay(VAL_TRANSVR_PAGE_SELECT_DELAY); + return 0; + +err_common_setup_page: + if (show_e) { + SWPS_INFO("%s: %s", __func__, emsg); + SWPS_INFO("%s: :0x%02x :%d :%d :%d\n", + __func__, addr, page, offset, len); + } + return retval; +} + +/* +static int +_common_setup_password(struct transvr_obj_s *self, + int addr, + int page, + int offs, + uint8_t pwd[4], + int show_e) { + int i = 0; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offs, 4, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_setup_password; + } + for (i=0; i<4; i++) { + err = i2c_smbus_write_byte_data(self->i2c_client_p, + (offs + i), + pwd[i]); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_setup_password; + } + } + return 0; + +err_common_setup_password: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, err); + } + return ERR_TRANSVR_UPDATE_FAIL; +} +*/ + +static int +_common_update_uint8_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + uint8_t *buf, + char *caller, + int show_e){ + + int i; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_update_uint8_attr; + } + for (i=0; ii2c_client_p, (offset + i)); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_update_uint8_attr; + } + buf[i] = err; + } + return 0; + +err_common_update_uint8_attr: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + buf[0] = DEBUG_TRANSVR_HEX_VAL; + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_update_int_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + int *buf, + char *caller, + int show_e){ + + int i; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_update_int_attr; + } + for (i=0; ii2c_client_p, (offset + i)); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_update_int_attr; + } + buf[i] = (int)err; + } + return 0; + +err_common_update_int_attr: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + buf[0] = DEBUG_TRANSVR_INT_VAL; + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_update_string_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + int len, + char buf[], + char *caller, + int show_e){ + + int i; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_update_string_attr; + } + for (i=0; ii2c_client_p, (offset + i)); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_update_string_attr; + } + buf[i] = (char)err; + } + return 0; + +err_common_update_string_attr: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + buf[0] = 'e'; + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_set_uint8_attr(struct transvr_obj_s *self, + int addr, + int page, + int offset, + uint8_t update, + uint8_t *buf, + char *caller, + int show_e){ + int len = 1; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + if ((*buf) == update){ + return 0; + } + err = _common_setup_page(self, addr, page, offset, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_set_uint8_attr_1; + } + err = i2c_smbus_write_byte_data(self->i2c_client_p, + offset, + update); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_set_uint8_attr_1; + } + (*buf) = update; + return 0; + +err_common_set_uint8_attr_1: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d\n", + __func__, emsg, caller, err); + } + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_set_uint8_array(struct transvr_obj_s *self, + int addr, + int page, + int offs, + int len, + uint8_t update[], + uint8_t buf[], + char *caller, + int show_e){ + int i = 0; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + err = _common_setup_page(self, addr, page, offs, len, show_e); + if (err < 0){ + emsg = "setup EEPROM page fail"; + goto err_common_set_uint8_attr_1; + } + for (i=0; ii2c_client_p, + (offs + i), + update[i]); + if (err < 0){ + emsg = "I2C R/W fail!"; + goto err_common_set_uint8_attr_1; + } + buf[i] = update[i]; + } + return 0; + +err_common_set_uint8_attr_1: + if (show_e) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + __func__, emsg, caller, err, i); + } + return ERR_TRANSVR_UPDATE_FAIL; +} + + +static int +_common_update_attr_id(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_id, + self->eeprom_map_p->page_id, + self->eeprom_map_p->offset_id, + self->eeprom_map_p->length_id, + &(self->id), + "_common_update_attr_id", + show_err); +} + + +static int +_common_update_attr_extended_id(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_ext_id, + self->eeprom_map_p->page_ext_id, + self->eeprom_map_p->offset_ext_id, + self->eeprom_map_p->length_ext_id, + &(self->ext_id), + "_common_update_attr_extended_id", + show_err); +} + + +static int +_common_update_attr_connector(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_connector, + self->eeprom_map_p->page_connector, + self->eeprom_map_p->offset_connector, + self->eeprom_map_p->length_connector, + &(self->connector), + "_common_update_attr_connector", + show_err); +} + + +static int +_common_update_attr_transvr_comp(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_trancomp, + self->eeprom_map_p->page_trancomp, + self->eeprom_map_p->offset_trancomp, + self->eeprom_map_p->length_trancomp, + self->transvr_comp, + "_common_update_attr_transvr_comp", + show_err); +} + + +static int +_common_update_attr_transvr_comp_ext(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_trancomp_ext, + self->eeprom_map_p->page_trancomp_ext, + self->eeprom_map_p->offset_trancomp_ext, + self->eeprom_map_p->length_trancomp_ext, + &(self->transvr_comp_ext), + "_common_update_attr_transvr_comp_ext", + show_err); +} + + +static int +_common_update_attr_vendor_name(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_name, + self->eeprom_map_p->page_vendor_name, + self->eeprom_map_p->offset_vendor_name, + self->eeprom_map_p->length_vendor_name, + self->vendor_name, + "_common_update_attr_vendor_name", + show_err); +} + + +static int +_common_update_attr_vendor_pn(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_pn, + self->eeprom_map_p->page_vendor_pn, + self->eeprom_map_p->offset_vendor_pn, + self->eeprom_map_p->length_vendor_pn, + self->vendor_pn, + "_common_update_attr_vendor_pn", + show_err); +} + + +static int +_common_update_attr_vendor_rev(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_rev, + self->eeprom_map_p->page_vendor_rev, + self->eeprom_map_p->offset_vendor_rev, + self->eeprom_map_p->length_vendor_rev, + self->vendor_rev, + "_common_update_attr_vendor_rev", + show_err); +} + + +static int +_common_update_attr_vendor_sn(struct transvr_obj_s *self, + int show_err){ + return _common_update_string_attr(self, + self->eeprom_map_p->addr_vendor_sn, + self->eeprom_map_p->page_vendor_sn, + self->eeprom_map_p->offset_vendor_sn, + self->eeprom_map_p->length_vendor_sn, + self->vendor_sn, + "_common_update_attr_vendor_sn", + show_err); +} + + +static int +_common_update_attr_br(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_br, + self->eeprom_map_p->page_br, + self->eeprom_map_p->offset_br, + self->eeprom_map_p->length_br, + &(self->br), + "_common_update_attr_br", + show_err); +} + + +static int +_common_update_attr_len_smf(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_smf, + self->eeprom_map_p->page_len_smf, + self->eeprom_map_p->offset_len_smf, + self->eeprom_map_p->length_len_smf, + &(self->len_smf), + "_common_update_attr_len_smf", + show_err); +} + + +static int +_common_update_attr_len_om1(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om1, + self->eeprom_map_p->page_len_om1, + self->eeprom_map_p->offset_len_om1, + self->eeprom_map_p->length_len_om1, + &(self->len_om1), + "_common_update_attr_len_om1", + show_err); +} + +static int +_common_update_attr_len_om2(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om2, + self->eeprom_map_p->page_len_om2, + self->eeprom_map_p->offset_len_om2, + self->eeprom_map_p->length_len_om2, + &(self->len_om2), + "_common_update_attr_len_om2", + show_err); +} + +static int +_common_update_attr_len_om3(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om3, + self->eeprom_map_p->page_len_om3, + self->eeprom_map_p->offset_len_om3, + self->eeprom_map_p->length_len_om3, + &(self->len_om3), + "_common_update_attr_len_om3", + show_err); +} + + +static int +_common_update_attr_len_om4(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_om4, + self->eeprom_map_p->page_len_om4, + self->eeprom_map_p->offset_len_om4, + self->eeprom_map_p->length_len_om4, + &(self->len_om4), + "_common_update_attr_len_om4", + show_err); +} + + +static int +_common_update_attr_option(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_option, + self->eeprom_map_p->page_option, + self->eeprom_map_p->offset_option, + self->eeprom_map_p->length_option, + self->option, + "_common_update_attr_option", + show_err); +} + + +static int +_common_update_attr_comp_rev(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_comp_rev, + self->eeprom_map_p->page_comp_rev, + self->eeprom_map_p->offset_comp_rev, + self->eeprom_map_p->length_comp_rev, + &(self->comp_rev), + "_common_update_attr_comp_rev", + show_err); +} + + +static int +_common_update_attr_diag_type(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_diag_type, + self->eeprom_map_p->page_diag_type, + self->eeprom_map_p->offset_diag_type, + self->eeprom_map_p->length_diag_type, + &(self->diag_type), + "_common_update_attr_diag_type", + show_err); +} + + +static int +_common_update_attr_wavelength(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_wavelength, + self->eeprom_map_p->page_wavelength, + self->eeprom_map_p->offset_wavelength, + self->eeprom_map_p->length_wavelength, + self->wavelength, + "_common_update_attr_wavelength", + show_err); +} + + +int +_common_get_option_value(struct transvr_obj_s *self, + int offset, + int bit_shift) { + /* SFP: + * - option[0] = A0h / 64 + * - option[1] = A0h / 65 + * QSFP: + * - option[0] = 00h / 193 + * - option[1] = 00h / 194 + * - option[2] = 00h / 195 + */ + return (self->option[offset] & (1 << bit_shift)); +} + + +static int +_sfp_update_attr_len_sm(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_len_sm, + self->eeprom_map_p->page_len_sm, + self->eeprom_map_p->offset_len_sm, + self->eeprom_map_p->length_len_sm, + &(self->len_sm), + "_common_update_attr_len_sm", + show_err); +} + + +static int +_sfp_update_attr_rate_id(struct transvr_obj_s *self, + int show_err){ + return _common_update_int_attr(self, + self->eeprom_map_p->addr_rate_id, + self->eeprom_map_p->page_rate_id, + self->eeprom_map_p->offset_rate_id, + self->eeprom_map_p->length_rate_id, + &(self->rate_id), + "_sfp_update_attr_rate_id", + show_err); +} + + +static int +_sfp_update_attr_soft_rs0(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_soft_rs0, + self->eeprom_map_p->page_soft_rs0, + self->eeprom_map_p->offset_soft_rs0, + self->eeprom_map_p->length_soft_rs0, + &(self->soft_rs0), + "_sfp_update_attr_soft_rs0", + show_err); +} + + +static int +_sfp_update_attr_soft_rs1(struct transvr_obj_s *self, + int show_err){ + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_soft_rs1, + self->eeprom_map_p->page_soft_rs1, + self->eeprom_map_p->offset_soft_rs1, + self->eeprom_map_p->length_soft_rs1, + &(self->soft_rs1), + "_sfp_update_attr_soft_rs1", + show_err); +} + + +int +_sfp_is_diag_support(struct transvr_obj_s *self){ + + uint8_t bit_mask = 0xC0; /* 1100 0000 */ + uint8_t en_val = 0x40; /* 0100 0000 */ + uint8_t checkval = (self->diag_type & bit_mask); + + if (checkval == en_val) { + return 1; + } + return 0; +} + + +static int +_sfp_update_attr_curr_temp(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_temp, + self->eeprom_map_p->page_temp, + self->eeprom_map_p->offset_temp, + self->eeprom_map_p->length_temp, + self->curr_temp, + "_sfp_update_attr_curr_temp", + show_err); +} + + +static int +_sfp_update_attr_curr_voltage(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_voltage, + self->eeprom_map_p->page_voltage, + self->eeprom_map_p->offset_voltage, + self->eeprom_map_p->length_voltage, + self->curr_voltage, + "_sfp_update_attr_curr_voltage", + show_err); +} + + +static int +_sfp_update_attr_curr_tx_bias(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_bias, + self->eeprom_map_p->page_tx_bias, + self->eeprom_map_p->offset_tx_bias, + self->eeprom_map_p->length_tx_bias, + self->curr_tx_bias, + "_sfp_update_attr_curr_tx_bias", + show_err); +} + + +static int +_sfp_update_attr_curr_tx_power(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_power, + self->eeprom_map_p->page_tx_power, + self->eeprom_map_p->offset_tx_power, + self->eeprom_map_p->length_tx_power, + self->curr_tx_power, + "_sfp_update_attr_curr_tx_power", + show_err); +} + + +static int +_sfp_update_attr_curr_rx_power(struct transvr_obj_s *self, + int show_err){ + + if (!(_sfp_is_diag_support(self))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_power, + self->eeprom_map_p->page_rx_power, + self->eeprom_map_p->offset_rx_power, + self->eeprom_map_p->length_rx_power, + self->curr_rx_power, + "_sfp_update_attr_curr_rx_power", + show_err); +} + + +static int +_sfp_update_attr_rx_em(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + self->eeprom_map_p->length_rx_em, + self->rx_em, + "_sfp_update_attr_rx_em", + show_err); +} + + +static int +_sfp_update_attr_tx_eq(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + self->eeprom_map_p->length_tx_eq, + self->tx_eq, + "_sfp_update_attr_tx_eq", + show_err); +} + + +static int +_qsfp_update_attr_cdr(struct transvr_obj_s *self, + int show_err){ + if (self->type != TRANSVR_TYPE_QSFP_28){ + self->cdr = DEBUG_TRANSVR_HEX_VAL; + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->page_cdr, + self->eeprom_map_p->offset_cdr, + self->eeprom_map_p->length_cdr, + &(self->cdr), + "_common_update_attr_cdr", + show_err); +} + + +static int +_qsfg_update_attr_extbr(struct transvr_obj_s *self, + int show_err) { + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_extbr, + self->eeprom_map_p->page_extbr, + self->eeprom_map_p->offset_extbr, + self->eeprom_map_p->length_extbr, + &(self->extbr), + "_common_update_attr_extbr", + show_err); +} + + +static int +_qsfp_is_diag_support(struct transvr_obj_s *self, + int diag_type) { + /* Input Parm: diag_type + * => 1 : temperature + * => 2 : voltage + * => 3 : tx relate + * => 4 : rx relate + */ + uint8_t mask_b2 = 0x04; /* 0000 0100 */ + uint8_t mask_b3 = 0x08; /* 0000 1000 */ + + switch (diag_type) { + case 1: /* temperature */ + case 2: /* voltage */ + /* Direct access target, because of spec not defined */ + return 1; + case 3: + case 4: + /* [Note] + * Due to lot of transceiver vendor defined it not rigorously and + * consider of general support, we seem it as supported if there + * are bit-2 OR bit-3 defined by transceiver vendor. + */ + if ( ((self->diag_type & mask_b2) == mask_b2 ) || + ((self->diag_type & mask_b3) == mask_b3 ) ){ + return 1; + } + return 0; + default: + SWPS_INFO("%s: undefined diag_type:%d\n", + __func__, diag_type); + break; + } + return 0; +} + + +int +_qsfp_is_implement_tx_disable(struct transvr_obj_s *self) { + /* + * 00h / Byte-195 / Bit-4 + */ + int byte = 2; + int bit = 4; + return _common_get_option_value(self, byte, bit); +} + + +int +_qsfp_is_implement_tx_fault(struct transvr_obj_s *self) { + /* + * 00h / Byte-195 / Bit-3 + */ + int byte = 2; + int bit = 3; + return _common_get_option_value(self, byte, bit); +} + + +static int +_qsfp_update_attr_curr_temp(struct transvr_obj_s *self, + int show_err){ + int diag_type = 1; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_temp, + self->eeprom_map_p->page_temp, + self->eeprom_map_p->offset_temp, + self->eeprom_map_p->length_temp, + self->curr_temp, + "_qsfp_update_attr_curr_temp", + show_err); +} + + +static int +_qsfp_update_attr_curr_voltage(struct transvr_obj_s *self, + int show_err){ + int diag_type = 2; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_voltage, + self->eeprom_map_p->page_voltage, + self->eeprom_map_p->offset_voltage, + self->eeprom_map_p->length_voltage, + self->curr_voltage, + "_qsfp_update_attr_curr_voltage", + show_err); +} + + +static int +_qsfp_update_attr_curr_tx_bias(struct transvr_obj_s *self, + int show_err){ + int diag_type = 3; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_bias, + self->eeprom_map_p->page_tx_bias, + self->eeprom_map_p->offset_tx_bias, + self->eeprom_map_p->length_tx_bias, + self->curr_tx_bias, + "_qsfp_update_attr_curr_tx_bias", + show_err); +} + + +static int +_qsfp_update_attr_curr_tx_power(struct transvr_obj_s *self, + int show_err){ + int diag_type = 3; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_power, + self->eeprom_map_p->page_tx_power, + self->eeprom_map_p->offset_tx_power, + self->eeprom_map_p->length_tx_power, + self->curr_tx_power, + "_qsfp_update_attr_curr_tx_power", + show_err); +} + + +static int +_qsfp_update_attr_curr_rx_power(struct transvr_obj_s *self, + int show_err){ + int diag_type = 4; + + if (!(_qsfp_is_diag_support(self, diag_type))) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_power, + self->eeprom_map_p->page_rx_power, + self->eeprom_map_p->offset_rx_power, + self->eeprom_map_p->length_rx_power, + self->curr_rx_power, + "_qsfp_update_attr_curr_rx_power", + show_err); +} + + +static int +_qsfp_update_attr_soft_rx_los(struct transvr_obj_s *self, + int show_err){ + + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_los, + self->eeprom_map_p->page_rx_los, + self->eeprom_map_p->offset_rx_los, + self->eeprom_map_p->length_rx_los, + &(self->rx_los), + "_qsfp_update_attr_soft_rx_los", + show_err); +} + + +static int +_qsfp_update_attr_soft_tx_disable(struct transvr_obj_s *self, + int show_err){ + + if (!_qsfp_is_implement_tx_disable(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + self->eeprom_map_p->length_tx_disable, + &(self->tx_disable), + "_qsfp_update_attr_soft_tx_disable", + show_err); +} + + +static int +_qsfp_update_attr_soft_tx_fault(struct transvr_obj_s *self, + int show_err){ + + if (!_qsfp_is_implement_tx_fault(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_fault, + self->eeprom_map_p->page_tx_fault, + self->eeprom_map_p->offset_tx_fault, + self->eeprom_map_p->length_tx_fault, + &(self->tx_fault), + "_qsfp_update_attr_soft_tx_fault", + show_err); +} + + +static int +_qsfp_update_attr_tx_eq(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + self->eeprom_map_p->length_tx_eq, + self->tx_eq, + "_qsfp_update_attr_tx_eq", + show_err); +} + + +static int +_qsfp_update_attr_rx_am(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_am, + self->eeprom_map_p->page_rx_am, + self->eeprom_map_p->offset_rx_am, + self->eeprom_map_p->length_rx_am, + self->rx_am, + "_qsfp_update_attr_rx_am", + show_err); +} + + +static int +_qsfp_update_attr_rx_em(struct transvr_obj_s *self, + int show_err){ + + if (!_is_transvr_support_ctle(self)) { + return ERR_TRANSVR_NOTSUPPORT; + } + return _common_update_uint8_attr(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + self->eeprom_map_p->length_rx_em, + self->rx_em, + "_qsfp_update_attr_rx_em", + show_err); +} + + +int +_common_update_attr_all(struct transvr_obj_s *self, + int show_err){ + + char *err_str = "err"; + + if (_common_update_attr_id(self, show_err) < 0) { + err_str = "_common_update_attr_id"; + goto err_common_update_attr_all; + } + if (_common_update_attr_extended_id(self, show_err) < 0) { + err_str = "_common_update_attr_extended_id"; + goto err_common_update_attr_all; + } + if (_common_update_attr_connector(self, show_err) < 0) { + err_str = "_common_update_attr_connector"; + goto err_common_update_attr_all; + } + if (_common_update_attr_transvr_comp(self, show_err) < 0) { + err_str = "_common_update_attr_transvr_comp"; + goto err_common_update_attr_all; + } + if (_common_update_attr_transvr_comp_ext(self, show_err) < 0) { + err_str = "_common_update_attr_transvr_comp_ext"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_name(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_name"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_pn(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_pn"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_rev(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_rev"; + goto err_common_update_attr_all; + } + if (_common_update_attr_vendor_sn(self, show_err) < 0) { + err_str = "_common_update_attr_vendor_sn"; + goto err_common_update_attr_all; + } + if (_common_update_attr_br(self, show_err) < 0) { + err_str = "_common_update_attr_br"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_smf(self, show_err) < 0) { + err_str = "_common_update_attr_len_smf"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om1(self, show_err) < 0) { + err_str = "_common_update_attr_len_om1"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om2(self, show_err) < 0) { + err_str = "_common_update_attr_len_om2"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om3(self, show_err) < 0) { + err_str = "_common_update_attr_len_om3"; + goto err_common_update_attr_all; + } + if (_common_update_attr_len_om4(self, show_err) < 0) { + err_str = "_common_update_attr_len_om4"; + goto err_common_update_attr_all; + } + if (_common_update_attr_option(self, show_err) < 0) { + err_str = "_common_update_attr_option"; + goto err_common_update_attr_all; + } + if (_common_update_attr_comp_rev(self, show_err) < 0) { + err_str = "_common_update_attr_comp_rev"; + goto err_common_update_attr_all; + } + if (_common_update_attr_diag_type(self, show_err) < 0) { + err_str = "_common_update_attr_diag_type"; + goto err_common_update_attr_all; + } + if (_common_update_attr_wavelength(self, show_err) < 0) { + err_str = "_common_update_attr_wavelength"; + goto err_common_update_attr_all; + } + return 0; + +err_common_update_attr_all: + if (show_err){ + SWPS_INFO("%s: fail at:%s :%s\n", __func__, err_str, self->swp_name); + } + return -1; +} + + +int +_sfp_update_attr_all(struct transvr_obj_s *self, + int show_err){ + + char *err_str = DEBUG_TRANSVR_STR_VAL; + + if (_common_update_attr_all(self, show_err) < 0){ + err_str = "_common_update_attr_all"; + goto err_sfp_update_attr_all; + } + if (_sfp_update_attr_len_sm(self, show_err) < 0) { + err_str = "_sfp_update_attr_len_sm"; + goto err_sfp_update_attr_all; + } + if (_sfp_update_attr_rate_id(self, show_err) < 0) { + err_str = "_sfp_update_attr_rate_id"; + goto err_sfp_update_attr_all; + } + if ((self->rate_id) > 0) { + if (_sfp_update_attr_soft_rs0(self, show_err) < 0) { + err_str = "_sfp_update_attr_soft_rs0"; + goto err_sfp_update_attr_all; + } + if (_sfp_update_attr_soft_rs1(self, show_err) < 0) { + err_str = "_sfp_update_attr_soft_rs1"; + goto err_sfp_update_attr_all; + } + } + return 0; + +err_sfp_update_attr_all: + if (show_err){ + SWPS_INFO("%s: fail at:%s :%s\n", __func__, err_str, self->swp_name); + } + return -1; +} + + +int +_qsfp_update_attr_all(struct transvr_obj_s *self, + int show_err){ + + char *err_str = DEBUG_TRANSVR_STR_VAL; + + if (_common_update_attr_all(self, show_err) < 0){ + err_str = "_common_update_attr_all"; + goto err_qsfp_update_attr_all; + } + if (_qsfg_update_attr_extbr(self, show_err) < 0) { + err_str = "_qsfg_update_attr_extbr"; + goto err_qsfp_update_attr_all; + } + if (self->type == TRANSVR_TYPE_QSFP_28) { + if (_qsfp_update_attr_cdr(self, 1) < 0) { + err_str = "_qsfp_update_attr_cdr"; + goto err_qsfp_update_attr_all; + } + } + return 0; + +err_qsfp_update_attr_all: + if (show_err){ + SWPS_INFO("%s: fail at:%s :%s\n", __func__, err_str, self->swp_name); + } + return -1; +} + + +/* ========== Object functions for common type ========== + */ +int +_common_count_temp(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + int sign = 0; + int high = 0; + int low = 0; + int lmax = 8; + + /* Count high */ + sign = get_bit(high_byte,7); + SWP_BIT_CLEAR(high_byte, 7); + high = (int)high_byte; + if (sign == 1) { + high = 0 - high; + } + /* Count low */ + low = (get_bit(low_byte, 7) * 500); + low += (get_bit(low_byte, 6) * 250); + low += (get_bit(low_byte, 5) * 125); + low += (get_bit(low_byte, 4) * 62); + low = (low / 100); + /* Integrate High and Low */ + return snprintf(buf_p, lmax, "%d.%d\n", high, low); +} + + +int +_common_count_voltage(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note]: + * Internally measured transceiver supply voltage. Represented + * as a 16 bit unsigned integer with the voltage defined as the + * full 16 bit value (0-65535) with LSB equal to 100 uVolt, + * yielding a total range of 0 to +6.55 Volts. Practical + * considerations to be defined by transceiver manufacturer will + * tend to limit the actual bounds of the supply voltage measurement. + * Accuracy is vendor specific but must be better than 3% of the + * manufacturer's nominal value over specified operating temperature + * and voltage. Note that in some transceivers, transmitter supply + * voltage and receiver supply voltage are isolated. In that case, + * only one supply is monitored. Refer to the device specification + * for more detail. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 100 uV (1mV=1000uV) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total/10) / 1000); + val_f = ((total/10) - (val_i*1000)); + /* Return Unit: 1 Volt */ + return snprintf(buf_p, lmax, "%d.%03d\n", val_i, val_f); +} + + +int +_common_count_tx_bias(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note] + * Measured TX bias current in uA. Represented as a 16 bit unsigned + * integer with the current defined as the full 16 bit value (0-65535) + * with LSB equal to 2 uA, yielding a total range of 0 to 131 mA. + * Accuracy is vendor specific but must be better than 10% of the + * manufacturer's nominal value over specified operating temperature + * and voltage. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 2 uA (1mA=1000uA) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total*2) / 1000); + val_f = (((total*2) - (val_i*1000)) / 100); + /* Return Unit: 1 mA */ + return snprintf(buf_p, lmax, "%d.%01d\n", val_i, val_f); +} + + +int +_common_count_tx_power(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note] + * Measured TX output power in mW. Represented as a 16 bit unsigned + * integer with the power defined as the full 16 bit value (0-65535) + * with LSB equal to 0.1 uW, yielding a total range of 0 to 6.5535 mW + * (~ -40 to +8.2 dBm). Data is assumed to be based on measurement of + * laser monitor photodiode current. It is factory calibrated to absolute + * units using the most representative fiber output type. Accuracy is + * vendor specific but must be better than 3dB over specified temperature + * and voltage. Data is not valid when the transmitter is disabled. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 0.1 uW (1mW=1000uW) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total/10) / 1000); + val_f = ((total/10) - (val_i*1000)); + /* Return Unit: 1 mW */ + return snprintf(buf_p, lmax, "%d.%03d\n", val_i, val_f); +} + + +int +_common_count_rx_power(uint8_t high_byte, + uint8_t low_byte, + char *buf_p) { + /* [Note] + * Measured RX received optical power in mW. Value can represent either + * average received power or OMA depending upon how bit 3 of byte 92 (A0h) + * is set. Represented as a 16 bit unsigned integer with the power defined + * as the full 16 bit value (0-65535) with LSB equal to 0.1 uW, yielding a + * total range of 0 to 6.5535 mW (~ -40 to +8.2 dBm). Absolute accuracy is + * dependent upon the exact optical wavelength. For the vendor specified + * wavelength, accuracy shall be better than 3dB over specified temperature + * and voltage. + */ + int total = 0; + int lmax = 8; + int val_i = 0; + int val_f = 0; + /* unit: 0.1 uW (1mW=1000uW) */ + total = transform_word_to_int(high_byte, low_byte); + val_i = ((total/10) / 1000); + val_f = ((total/10) - (val_i*1000)); + /* Return Unit: 1 mW */ + return snprintf(buf_p, lmax, "%d.%03d\n", val_i, val_f); +} + + +int +_common_count_wavelength(struct transvr_obj_s *self, + uint8_t high_byte, + uint8_t low_byte) { + /* [Note] + * SFP : uint 1 um. + * QSFP: unit 0.05 um. + */ + int total = 0; + + total = transform_word_to_int(high_byte, low_byte); + switch (self->type) { + case TRANSVR_TYPE_SFP: + return total; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + return (total/20); + + default: + break; + } + return ERR_TRANSVR_UNDEFINED; +} + + +int +common_get_id(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_id, + "common_get_id"); + if (err_code < 0){ + return err_code; + } + /* Transform to INT to show error case */ + return (int)self->id; +} + + +int +common_get_ext_id(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_extended_id, + "common_get_ext_id"); + if (err_code < 0){ + return err_code; + } + /* Transform to INT to show error case */ + return (int)self->ext_id; +} + + +int +common_get_connector(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_connector, + "common_get_connector"); + if (err_code < 0){ + return err_code; + } + /* Transform to INT to show error case */ + return (int)self->connector; +} + + +int +common_get_vendor_name(struct transvr_obj_s *self, char *buf){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_name); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_name, + "common_get_vendor_name"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_name); +} + + +int +common_get_vendor_pn(struct transvr_obj_s *self, char *buf) { + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_pn); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_pn, + "common_get_vendor_pn"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_pn); +} + + +int +common_get_vendor_rev(struct transvr_obj_s *self, char *buf) { + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_rev); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_rev, + "common_get_vendor_rev"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_rev); +} + + +int +common_get_vendor_sn(struct transvr_obj_s *self, char *buf) { + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_sn); + } + err = _check_by_mode(self, + &_common_update_attr_vendor_sn, + "common_get_vendor_sn"); + memset(buf, 0, LEN_TRANSVR_M_STR); + if (err < 0){ + return snprintf(buf, LEN_TRANSVR_M_STR, "%d\n", err); + } + return snprintf(buf, LEN_TRANSVR_M_STR, "%s\n", self->vendor_sn); +} + + +int +common_get_br(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return (int)self->br; + } + err = _check_by_mode(self, + &_common_update_attr_br, + "common_get_br"); + if (err < 0){ + return err; + } + /* Transform to INT to show error case */ + return (int)self->br; +} + + +int +common_get_len_smf(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_smf; + } + err = _check_by_mode(self, + &_common_update_attr_len_smf, + "common_get_len_smf"); + if (err < 0){ + return err; + } + return self->len_smf; +} + + +int +common_get_len_om1(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om1; + } + err = _check_by_mode(self, + &_common_update_attr_len_om1, + "common_get_len_om1"); + if (err < 0){ + return err; + } + return self->len_om1; +} + + +int +common_get_len_om2(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om2; + } + + err = _check_by_mode(self, + &_common_update_attr_len_om2, + "common_get_len_om2"); + if (err < 0){ + return err; + } + return self->len_om2; +} + + +int +common_get_len_om3(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om3; + } + + err = _check_by_mode(self, + &_common_update_attr_len_om3, + "common_get_len_om3"); + if (err < 0){ + return err; + } + return self->len_om3; +} + + +int +common_get_len_om4(struct transvr_obj_s *self){ + + int err = DEBUG_TRANSVR_INT_VAL; + + if (self->state == STATE_TRANSVR_CONNECTED && + self->mode == TRANSVR_MODE_POLLING && + TRANSVR_INFO_CACHE_ENABLE) { + return self->len_om4; + } + err = _check_by_mode(self, + &_common_update_attr_len_om4, + "common_get_len_om4"); + if (err < 0){ + return err; + } + return self->len_om4; +} + + +int +common_get_comp_extended(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp_ext, + "common_get_comp_extended"); + if (err_code < 0){ + return err_code; + } + return self->transvr_comp_ext; +} + + +int +common_get_comp_rev(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_comp_rev, + "common_get_comp_rev"); + if (err_code < 0){ + return err_code; + } + return self->comp_rev; +} + + +int +common_get_info(struct transvr_obj_s *self){ + + if (self->state != STATE_TRANSVR_CONNECTED) { + return self->state; + } + return self->info; +} + + +int +_common_get_if_lane(struct transvr_obj_s *self, + char *result){ + int i = 0; + int tmp_val = 0; + char tmp_str[LEN_TRANSVR_M_STR] = DEBUG_TRANSVR_STR_VAL; + + memset(result, 0, LEN_TRANSVR_M_STR); + + for (i=0; ilane_id); i++) { + tmp_val = self->lane_id[i]; + if (tmp_val < 1) { + break; + } + memset(tmp_str, 0, LEN_TRANSVR_M_STR); + if (i == 0) { + snprintf(tmp_str, LEN_TRANSVR_M_STR, "%d", tmp_val); + } else { + snprintf(tmp_str, LEN_TRANSVR_M_STR, ",%d", tmp_val); + } + strncat(result, tmp_str, LEN_TRANSVR_M_STR); + } + if (i == 0) { + return EVENT_TRANSVR_TASK_FAIL; + } + return 0; +} + + +int +common_get_if_lane(struct transvr_obj_s *self, + char *buf_p){ + + char tmp_str[LEN_TRANSVR_M_STR] = DEBUG_TRANSVR_STR_VAL; + + if (self->ioexp_obj_p->state != STATE_IOEXP_NORMAL) { + return snprintf(buf_p, LEN_TRANSVR_M_STR, "%d\n", ERR_TRANSVR_ABNORMAL); + } + if (_common_get_if_lane(self, tmp_str) < 0) { + return snprintf(buf_p, LEN_TRANSVR_M_STR, "%d\n" ,ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, LEN_TRANSVR_M_STR, "%s\n" ,tmp_str); +} + + +int +sfp_get_len_sm(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_sfp_update_attr_len_sm, + "sfp_get_len_sm"); + if (err_code < 0){ + return err_code; + } + return self->len_sm; +} + + +int +sfp_get_rate_id(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_sfp_update_attr_rate_id, + "sfp_get_rate_id"); + if (err_code < 0){ + return err_code; + } + return self->rate_id; +} + + +int +sfp_get_soft_rs0(struct transvr_obj_s *self){ + /* Note: + * SFP Soft Rate_Select Select [aka. "RS(0)"] address + * A2h, offset: 110, bit 3 (begin form 0) + */ + int err_code = DEBUG_TRANSVR_INT_VAL; + int bit_shift = 3; + uint8_t result = 0x00; + uint8_t bitmask = (1 << bit_shift); + + /* Check rate identifier is supported */ + err_code = self->get_rate_id(self); + if (err_code <= 0) { + return ERR_TRANSVR_NOTSUPPORT; + } + /* Update and check */ + err_code = _check_by_mode(self, + &_sfp_update_attr_soft_rs0, + "sfp_get_soft_rs0"); + if (err_code <0){ + return err_code; + } + result = (self->soft_rs0 & bitmask); + if (result == bitmask) { + return 1; + } + if (result == 0) { + return 0; + } + return ERR_TRANSVR_UNEXCPT; +} + + +int +sfp_get_soft_rs1(struct transvr_obj_s *self){ + /* Note: + * SFP Soft RS(1) Select address + * A2h, offset: 118, bit 3 (begin form 0) + */ + int err_code = DEBUG_TRANSVR_INT_VAL; + int bit_shift = 3; + uint8_t result = 0x00; + uint8_t bitmask = (1 << bit_shift); + + /* Check rate identifier is supported */ + err_code = self->get_rate_id(self); + if (err_code <= 0) { + return ERR_TRANSVR_NOTSUPPORT; + } + /* Update and check */ + err_code = _check_by_mode(self, + &_sfp_update_attr_soft_rs1, + "sfp_get_soft_rs1"); + if (err_code <0){ + return err_code; + } + result = (self->soft_rs1 & bitmask); + if (result == bitmask) { + return 1; + } + if (result == 0) { + return 0; + } + return ERR_TRANSVR_UNEXCPT; +} + + +int +sfp_get_transvr_temp(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_temp, + "sfp_get_transvr_temp"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_temp[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return _common_count_temp(self->curr_temp[0], + self->curr_temp[1], + buf_p); +} + + +int +sfp_get_transvr_voltage(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_voltage, + "sfp_get_transvr_voltage"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_voltage[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 Volt */ + return _common_count_voltage(self->curr_voltage[0], + self->curr_voltage[1], + buf_p); +} + + +int +sfp_get_transvr_tx_bias(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_tx_bias, + "sfp_get_transvr_tx_bias"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mA */ + return _common_count_tx_bias(self->curr_tx_bias[0], + self->curr_tx_bias[1], + buf_p); +} + + +int +sfp_get_transvr_tx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_tx_power, + "sfp_get_transvr_tx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _common_count_tx_power(self->curr_tx_power[0], + self->curr_tx_power[1], + buf_p); +} + + +int +sfp_get_transvr_rx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_sfp_update_attr_curr_rx_power, + "sfp_get_transvr_rx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _common_count_rx_power(self->curr_rx_power[0], + self->curr_rx_power[0], + buf_p); +} + + +int +sfp_get_transvr_rx_em(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_sfp_update_attr_rx_em, + "sfp_get_transvr_rx_em"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->tx_eq[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x\n", self->rx_em[0]); +} + + +int +sfp_get_transvr_tx_eq(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_sfp_update_attr_tx_eq, + "sfp_get_transvr_tx_eq"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->tx_eq[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x\n", self->tx_eq[0]); +} + + +int +_sfp_get_comp_extended(struct transvr_obj_s *self) { + /* Address: A0h / 36 + * Reference: SFF-8024 TABLE 4-4 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp_ext); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +__sfp_get_comp_attr(struct transvr_obj_s *self, + int array_offset) { + /* SFP Specification Compliance: A0h / 3-10 + * transvr_comp[0-7] = 3 - 10 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp[array_offset]); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +_sfp_get_comp_10g_eth_comp(struct transvr_obj_s *self) { + /* transvr_comp[0] = address A0h / 3 + * + * 3 7: 10G Base-ER + * 3 6: 10GBASE-LRM + * 3 5: 10GBASE-LR + * 3 4: 10GBASE-SR + */ + int bitmask = 0xf0; /* 11110000 */ + return (__sfp_get_comp_attr(self, 0) & bitmask); +} + + +int +_sfp_get_comp_1g_eth_comp(struct transvr_obj_s *self) { + /* transvr_comp[3] = address A0h / 6 + * + * 6 7: BASE-PX *3 + * 6 6: BASE-BX10 *3 + * 6 5: 100BASE-FX + * 6 4: 100BASE-LX/LX10 + * 6 3: 1000BASE-T + * 6 2: 1000BASE-CX + * 6 1: 1000BASE-LX *3 + * 6 0: 1000BASE-SX + */ + return __sfp_get_comp_attr(self, 3); +} + + +int +_sfp_get_cable_tech(struct transvr_obj_s *self) { + /* transvr_comp[5] = address A0h / 8 + * + * 8 3: Active Cable *8 + * 8 2: Passive Cable *8 + */ + int bitmask = 0x0c; /* 00001100 */ + return (__sfp_get_comp_attr(self, 5) & bitmask); +} + + +int +sfp_get_comp_eth_1(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "sfp_get_comp_eth_1"); + if (err_code < 0){ + return err_code; + } + return _sfp_get_comp_1g_eth_comp(self); +} + + +int +sfp_get_comp_eth_10(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "sfp_get_comp_eth_10"); + if (err_code < 0){ + return err_code; + } + return _sfp_get_comp_10g_eth_comp(self); +} + + +int +_sfp_get_connector_type(struct transvr_obj_s *self) { + /* Address: A0h / 2 + * Reference: SFF-8024 TABLE 4-3 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->connector); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +sfp_get_wavelength(struct transvr_obj_s *self, + char *buf_p) { + /* [Note] Optical and Cable Variants Specification Compliance (SFF-8472) + * [Addr] A0h, Bytes 60-61 + * [Note] For optical variants, as defined by having zero's in A0h Byte 8 + * bits 2 and 3, Bytes 60 and 61 denote nominal transmitter output + * wavelength at room temperature. 16 bit value with byte 60 as high + * order byte and byte 61 as low order byte. The laser wavelength is + * equal to the 16 bit integer value in nm. This field allows the user + * to read the laser wavelength directly, so it is not necessary to + * infer it from the Transceiver Codes A0h Bytes 3 to 10 (see Table + * 5-3). This also allows specification of wavelengths not covered + * in the Transceiver Codes, such as those used in coarse WDM systems. + * + * For passive and active cable variants, a value of 00h for both A0h + * Byte 60 and Byte 61 denotes laser wavelength or cable specification + * compliance is unspecified. + */ + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_common_update_attr_wavelength, + "common_get_wavelength"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->wavelength[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* unit: 1 um */ + return snprintf(buf_p, lmax, "%d\n", + _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1])); +} + + +int +sfp_get_1g_rj45_extphy_offset(struct transvr_obj_s *self, char *buf) { + + if (self->state != STATE_TRANSVR_CONNECTED) { + return ERR_TRANSVR_UNPLUGGED; + } + if ((self->info != TRANSVR_CLASS_BASE_T_1000) && + (self->info != TRANSVR_CLASS_BASE_T_1000_up) ){ + return ERR_TRANSVR_NOTSUPPORT; + } + return snprintf(buf, LEN_TRANSVR_S_STR, "0x%02x\n", self->extphy_offset); +} + + +int +sfp_get_1g_rj45_extphy_reg(struct transvr_obj_s *self, char *buf) { + + int i = 0; + int ret = 0; + int retry = 3; + int delay = 200; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return ERR_TRANSVR_UNPLUGGED; + } + if ((self->info != TRANSVR_CLASS_BASE_T_1000) && + (self->info != TRANSVR_CLASS_BASE_T_1000_up) ){ + return ERR_TRANSVR_NOTSUPPORT; + } + if (_common_setup_page(self, VAL_TRANSVR_EXTPHY_ADDR_56, + -1, self->extphy_offset, 1, 0) < 0) { + return -EIO; + } + for (i=0; ii2c_client_p, self->extphy_offset); + if (ret >=0) { + goto ok_sfp_get_1g_rj45_extphy_reg; + } + msleep(delay); + } + SWPS_INFO("%s: retry:%d fail :%s :0x%02x\n", + __func__, retry, self->swp_name, self->extphy_offset); + return -EIO; + +ok_sfp_get_1g_rj45_extphy_reg: + ret = ((ret & 0x00ff) << 8) | ((ret & 0xff00) >> 8); + return snprintf(buf, LEN_TRANSVR_S_STR, "0x%04x\n", ret); +} + + +int +__qsfp_get_power_cls(struct transvr_obj_s *self, + int direct_access){ + + int err_code; + uint8_t detect_val; + + /* Detect and Update power class attribute */ + if (direct_access){ + err_code = _check_by_mode(self, + &_common_update_attr_extended_id, + "__qsfp_get_power_cls"); + } else { + err_code = self->ext_id; + } + if (err_code <0){ + return err_code; + } + if (err_code == DEBUG_TRANSVR_HEX_VAL){ + return ERR_TRANSVR_UPDATE_FAIL; + } + /* Clean data */ + detect_val = self->ext_id; + SWP_BIT_CLEAR(detect_val, 2); /* Bit2: CDR RX present */ + SWP_BIT_CLEAR(detect_val, 3); /* Bit3: CDR TX present */ + SWP_BIT_CLEAR(detect_val, 4); /* Bit4: CLEI present */ + SWP_BIT_CLEAR(detect_val, 5); /* Bit5: reserved */ + /* Identify power class */ + switch (detect_val) { + case 0: /* Class_1: 00000000 */ + return 1; + case 64: /* Class_2: 01000000 */ + return 2; + case 128: /* Class_3: 10000000 */ + return 3; + case 192: /* Class_4: 11000000 */ + return 4; + case 1: /* Class_5: 00000001 */ + case 193: /* Class_5: 11000001 */ + return 5; + case 2: /* Class_6: 00000010 */ + case 194: /* Class_6: 11000010 */ + return 6; + case 3: /* Class_7: 00000011 */ + case 195: /* Class_7: 11000011 */ + return 7; + default: + break; + } + SWPS_INFO("%s: Detect undefined power class:%d\n", __func__, detect_val); + return ERR_TRANSVR_UNDEFINED; +} + + +int +qsfp_get_power_cls(struct transvr_obj_s *self) { + return __qsfp_get_power_cls(self, 1); +} + + +int +__qsfp_get_cdr_present(struct transvr_obj_s *self, + int direct_access){ + + int retval; + int BIT_SHIFT = 2; + int BIT_MASK = 0x3; + + /* Detect and Update power class attribute */ + if (direct_access) { + retval = _check_by_mode(self, + &_common_update_attr_extended_id, + "__qsfp_get_cdr_present"); + if (retval < 0){ + return retval; + } + } + retval = self->ext_id; + if (retval == DEBUG_TRANSVR_HEX_VAL){ + return ERR_TRANSVR_UPDATE_FAIL; + } + /* Clean data and return */ + return (int)(retval >> BIT_SHIFT & BIT_MASK); +} + + +int +qsfp_get_cdr_present(struct transvr_obj_s *self) { + return __qsfp_get_cdr_present(self, 1); +} + + +int +qsfp_get_cdr(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_qsfp_update_attr_cdr, + "qsfp_get_cdr"); + if (err_code <0){ + return err_code; + } + + return self->cdr; +} + + +int +__qsfp_get_comp_attr(struct transvr_obj_s *self, + int array_offset) { + /* QSFP Specification Compliance: 00h / 131-138 + * transvr_comp[0-7] = 131 - 138 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp[array_offset]); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +_qsfp_get_comp_10_40_100_ethernet(struct transvr_obj_s *self) { + /* transvr_comp[0] = address 00h / 131 + * + * 131 7: Extended: See section 6.3.23. The Extended Specification Compliance + * Codes are maintained in the Transceiver Management section of SFF- + * 8024. + * 131 6: 10GBASE-LRM + * 131 5: 10GBASE-LR + * 131 4: 10GBASE-SR + * 131 3: 40GBASE-CR4 + * 131 2: 40GBASE-SR4 + * 131 1: 40GBASE-LR4 + * 131 0: 40G Active Cable (XLPPI) + */ + return __qsfp_get_comp_attr(self, 0); +} + + +int +_qsfp_get_comp_sonet(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 132 7-3: Reserved + * 132 2: OC 48, long reach + * 132 1: OC 48, intermediate reach + * 132 0: OC 48 short reach + */ + return __qsfp_get_comp_attr(self, 1); +} + + +int +_qsfp_get_comp_sas_sata(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 133 7: SAS 24.0 Gb/s + * 133 6: SAS 12.0 Gb/s + * 133 5: SAS 6.0 Gb/s + * 133 4: SAS 3.0 Gb/s + * 133 3-0: Reserved + */ + return __qsfp_get_comp_attr(self, 2); +} + + +int +_qsfp_get_comp_ethernet(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 134 7-4: Reserved + * 134 3: 1000BASE-T + * 134 2: 1000BASE-CX + * 134 1: 1000BASE-LX + * 134 0: 1000BASE-SX + */ + return __qsfp_get_comp_attr(self, 3); +} + + +int +_qsfp_get_comp_fc_link_length(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 135 7: Very long distance (V) + * 135 6: Short distance (S) + * 135 5: Intermediate distance (I) + * 135 4: Long distance (L) + * 135 3: Medium (M) + */ + int mask = 0xFC; /* 11111100 */ + return (__qsfp_get_comp_attr(self, 4) & mask); +} + + +int +_qsfp_get_comp_fc_trans_tech(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 135 2: Reserved + * 135 1: Longwave laser (LC) + * 135 0: Electrical inter-enclosure (EL) + * + * 136 7: Electrical intra-enclosure + * 136 6: Shortwave laser w/o OFC (SN) + * 136 5: Shortwave laser w OFC (SL) + * 136 4: Longwave Laser (LL) + * 136 3-0: Reserved + * + * return value = [bit 8-15:addr 135][bit 0-7:addr 136] + */ + int mask_135 = 7; /* 00000111 */ + int val_135 = (__qsfp_get_comp_attr(self, 4) & mask_135); + int val_136 = __qsfp_get_comp_attr(self, 5); + return ((val_135 << 7) + val_136); +} + + +int +_qsfp_get_comp_fc_trans_media(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 137 7: Twin Axial Pair (TW) + * 137 6: Shielded Twisted Pair (TP) + * 137 5: Miniature Coax (MI) + * 137 4: Video Coax (TV) + * 137 3: Multi-mode 62.5 m (M6) + * 137 2: Multi-mode 50 m (M5) + * 137 1: Multi-mode 50 um (OM3) + * 137 0: Single Mode (SM) + */ + return __qsfp_get_comp_attr(self, 6); +} + + +int +_qsfp_get_comp_fc_speed(struct transvr_obj_s *self) { + /* transvr_comp[1] = address 00h / 132 + * + * 138 7: 1200 MBps (per channel) + * 138 6: 800 MBps + * 138 5: 1600 MBps (per channel) + * 138 4: 400 MBps + * 138 3: 3200 MBps (per channel) + * 138 2: 200 MBps + * 138 1: Extended: See section 6.3.23. The Extended Specification + * Compliance Codes are maintained in the Transceiver Management + * section of SFF-8024. + * 138 0: 100 MBps + */ + return __qsfp_get_comp_attr(self, 7); +} + + +int +_qsfp_get_comp_extended(struct transvr_obj_s *self) { + /* Address: 00h / 192 + * Reference: SFF-8024 TABLE 4-4 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->transvr_comp_ext); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_comp_eth(struct transvr_obj_s *self){ + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "qsfp_get_comp_eth"); + if (err_code < 0){ + return err_code; + } + return _qsfp_get_comp_ethernet(self); +} + + +int +qsfp_get_comp_10_40(struct transvr_obj_s *self) { + + int err_code = _check_by_mode(self, + &_common_update_attr_transvr_comp, + "qsfp_get_comp_10_40"); + if (err_code < 0){ + return err_code; + } + return _qsfp_get_comp_10_40_100_ethernet(self); +} + + +int +_qsfp_get_connector_type(struct transvr_obj_s *self) { + /* Address: 00h / 130 + * Reference: SFF-8024 TABLE 4-3 + */ + if ((self->state == STATE_TRANSVR_CONNECTED) || + (self->state == STATE_TRANSVR_INIT) ) { + return (int)(self->connector); + } + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_transvr_temp(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_temp, + "qsfp_get_transvr_temp"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_temp[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return _common_count_temp(self->curr_temp[0], + self->curr_temp[1], + buf_p); +} + + +int +qsfp_get_transvr_voltage(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_voltage, + "qsfp_get_transvr_voltage"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_voltage[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 Volt */ + return _common_count_voltage(self->curr_voltage[0], + self->curr_voltage[1], + buf_p); +} + + +int +qsfp_get_transvr_tx_eq(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_qsfp_update_attr_tx_eq, + "qsfp_get_transvr_tx_eq"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->tx_eq[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x%02x\n", + self->tx_eq[0], self->tx_eq[1]); +} + + +int +qsfp_get_transvr_rx_am(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_qsfp_update_attr_rx_am, + "qsfp_get_transvr_rx_am"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->rx_am[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x%02x\n", + self->rx_am[0], self->rx_am[1]); +} + + +int +qsfp_get_transvr_rx_em(struct transvr_obj_s *self, + char *buf_p) { + + int limt = 8; + int err = DEBUG_TRANSVR_INT_VAL; + + err = _check_by_mode(self, + &_qsfp_update_attr_rx_em, + "qsfp_get_transvr_rx_em"); + if (err < 0) { + return snprintf(buf_p, limt, "%d\n", err); + } + if ((self->rx_em[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, limt, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + return snprintf(buf_p, limt, "0x%02x%02x\n", + self->rx_em[0], self->rx_em[1]); +} + + +int +_qsfp_get_channel_diag(uint8_t *data_array, + int (*count_func)(uint8_t high_byte, uint8_t low_byte, char *buf_p), + char *ch_name, + char *result_p) { + int i, high, low; + int len_max = 128; + char ch_buf[4][16] = { DEBUG_TRANSVR_STR_VAL, + DEBUG_TRANSVR_STR_VAL, + DEBUG_TRANSVR_STR_VAL, + DEBUG_TRANSVR_STR_VAL }; + + for (i=0; i<4; i++) { + high = (i*2); + low = ((i*2) + 1); + count_func(data_array[high], data_array[low], ch_buf[i]); + } + return snprintf(result_p, len_max, + "%s-%d:%s%s-%d:%s%s-%d:%s%s-%d:%s", + ch_name, 1, ch_buf[0], + ch_name, 2, ch_buf[1], + ch_name, 3, ch_buf[2], + ch_name, 4, ch_buf[3]); +} + + +int +qsfp_get_soft_rx_los(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int mask = 0x0f; /* Bit 0 ~ Bit 3 */ + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_soft_rx_los, + "qsfp_get_soft_rx_los"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + return snprintf(buf_p, lmax, "0x%02x\n", (self->rx_los & mask)); +} + + +int +qsfp_get_soft_tx_disable(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int mask = 0x0f; /* Bit 0 ~ Bit 3 */ + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_disable, + "qsfp_get_soft_tx_disable"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + return snprintf(buf_p, lmax, "0x%02x\n", (self->tx_disable & mask)); +} + + +int +qsfp_get_soft_tx_fault(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int mask = 0x0f; /* Bit 0 ~ Bit 3 */ + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_fault, + "qsfp_get_soft_tx_fault"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + return snprintf(buf_p, lmax, "0x%02x\n", (self->tx_fault & mask)); +} + + +int +qsfp_get_auto_tx_disable(struct transvr_obj_s *self, + char *buf_p) { + + if (self->auto_tx_disable == VAL_TRANSVR_FUNCTION_DISABLE) { + return snprintf(buf_p, LEN_TRANSVR_S_STR, + "%d\n", ERR_TRANSVR_FUNC_DISABLE); + } + return snprintf(buf_p, LEN_TRANSVR_S_STR, + "0x%02x\n", self->auto_tx_disable); +} + + +int +qsfp_get_transvr_tx_bias(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *ch_name = "TX"; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_tx_bias, + "qsfp_get_transvr_tx_bias"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_bias[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mA */ + return _qsfp_get_channel_diag(self->curr_tx_bias, + _common_count_tx_bias, + ch_name, + buf_p); +} + + +int +qsfp_get_transvr_tx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *ch_name = "TX"; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_tx_power, + "qsfp_get_transvr_tx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_power[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _qsfp_get_channel_diag(self->curr_tx_power, + _common_count_tx_power, + ch_name, + buf_p); +} + + +int +qsfp_get_transvr_rx_power(struct transvr_obj_s *self, + char *buf_p) { + + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *ch_name = "RX"; + + err_code = _check_by_mode(self, + &_qsfp_update_attr_curr_rx_power, + "qsfp_get_transvr_rx_power"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->curr_tx_power[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* Return Unit: 1 mW */ + return _qsfp_get_channel_diag(self->curr_rx_power, + _common_count_rx_power, + ch_name, + buf_p); +} + + +int +qsfp_get_wavelength(struct transvr_obj_s *self, + char *buf_p) { + /* [Desc] Wavelength or Copper Cable Attenuation (SFF-8636) + * [Addr] 00h 186-187 + * [Note] + * For optical free side devices, this parameter identifies the nominal + * transmitter output wavelength at room temperature. This parameter is + * a 16-bit hex value with Byte 186 as high order byte and Byte 187 as + * low order byte. The laser wavelength is equal to the 16-bit integer value + * divided by 20 in nm (units of 0.05 nm). This resolution should be adequate + * to cover all relevant wavelengths yet provide enough resolution for all + * expected DWDM applications. For accurate representation of controlled + * wavelength applications, this value should represent the center of the + * guaranteed wavelength range. + * If the free side device is identified as copper cable these registers will + * be used to define the cable attenuation. An indication of 0 dB attenuation + * refers to the case where the attenuation is not known or is unavailable. + * Byte 186 (00-FFh) is the copper cable attenuation at 2.5 GHz in units of 1 dB. + * Byte 187 (00-FFh) is the copper cable attenuation at 5.0 GHz in units of 1 dB. + */ + int lmax = 8; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _check_by_mode(self, + &_common_update_attr_wavelength, + "common_get_wavelength"); + if (err_code < 0) { + return snprintf(buf_p, lmax, "%d\n", err_code); + } + if ((self->wavelength[0]) == DEBUG_TRANSVR_HEX_VAL) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_UPDATE_FAIL); + } + /* unit: 1 um */ + return snprintf(buf_p, lmax, "%d\n", + _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1])); +} + + +/* Public Function for Setup Features + */ +static int +__sfp_set_soft_rs(struct transvr_obj_s *self, + int input_val, + int address, + int page, + int offset, + int bit_shift, + uint8_t *attr_p, + char *caller, + int show_err) { + + int retval = ERR_TRANSVR_UNEXCPT; + int err_code = ERR_TRANSVR_UNEXCPT; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + uint8_t update_val = (*attr_p); + + switch (input_val) { + case 0: + SWP_BIT_CLEAR(update_val, bit_shift); + break; + case 1: + SWP_BIT_SET(update_val, bit_shift); + break; + default: + retval = ERR_TRANSVR_UNEXCPT; + err_code = ERR_TRANSVR_UNEXCPT; + err_msg = "Exception occurs"; + goto err_private_sfp_set_soft_rs_1; + } + err_code = _common_set_uint8_attr(self, + address, + page, + offset, + update_val, + attr_p, + caller, + show_err); + if (err_code < 0) { + retval = err_code; + err_msg = "Write data via i2c fail!"; + goto err_private_sfp_set_soft_rs_1; + } + (*attr_p) = update_val; + return 0; + +err_private_sfp_set_soft_rs_1: + if (show_err) { + SWPS_INFO("%s: %s :%d :%s\n :%d\n", + __func__, err_msg, err_code, self->swp_name, input_val); + } + return retval; +} + + +static int +_sfp_set_soft_rs(struct transvr_obj_s *self, + int input_val, + int address, + int page, + int offset, + int bit_shift, + int (*attr_update_func)(struct transvr_obj_s *self, int show_err), + uint8_t *attr_p, + char *caller, + int show_err) { + + int retval = ERR_TRANSVR_UNEXCPT; + int err_code = ERR_TRANSVR_UNEXCPT; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + + /* Check input value */ + if ((input_val != 0) && (input_val != 1)){ + retval = ERR_TRANSVR_BADINPUT; + err_code = ERR_TRANSVR_BADINPUT; + err_msg = "Input range incorrect!"; + goto err_common_sfp_set_soft_rs_1; + } + /* Check rate identifier is supported */ + err_code = self->get_rate_id(self); + if (err_code <= 0) { + switch (err_code) { + case 0: + retval = ERR_TRANSVR_NOTSUPPORT; + err_msg = "Not support this feature"; + break; + case ERR_TRANSVR_UNINIT: + retval = ERR_TRANSVR_UNINIT; + err_msg = "Check CDR present fail!"; + break; + case ERR_TRANSVR_UNPLUGGED: + retval = ERR_TRANSVR_UNPLUGGED; + err_msg = "Transceiver unplugged!"; + break; + default: + retval = err_code; + err_msg = "Check Rate_ID fail!"; + break; + } + goto err_common_sfp_set_soft_rs_1; + } + /* Check and update */ + err_code = _check_by_mode(self, + attr_update_func, + caller); + if ( (err_code < 0) || + ((*attr_p) == DEBUG_TRANSVR_HEX_VAL) ){ + retval = err_code; + err_msg = "Get current value fail!"; + goto err_common_sfp_set_soft_rs_1; + } + /* Generate and update value */ + return __sfp_set_soft_rs(self, + input_val, + address, + page, + offset, + bit_shift, + attr_p, + caller, + show_err); + +err_common_sfp_set_soft_rs_1: + if (show_err) { + SWPS_INFO("%s: %s :%d :%s\n :%d\n", + __func__, err_msg, err_code, self->swp_name, input_val); + } + return retval; +} + + +int +sfp_set_soft_rs0(struct transvr_obj_s *self, + int input_val) { + /* Note: + * SFP Soft Rate_Select Select RX ["RS(0)"] address + * A2h, offset: 110, bit 3 + */ + int bit_shift = 3; + int show_err = 1; + return _sfp_set_soft_rs(self, + input_val, + self->eeprom_map_p->addr_soft_rs0, + self->eeprom_map_p->page_soft_rs0, + self->eeprom_map_p->offset_soft_rs0, + bit_shift, + &_sfp_update_attr_soft_rs0, + &(self->soft_rs0), + "sfp_set_soft_rs0", + show_err); +} + + +int +sfp_set_soft_rs1(struct transvr_obj_s *self, + int input_val) { + /* Note: + * SFP Soft Rate_Select Select RX ["RS(1)"] address + * A2h, offset: 118, bit 3 + */ + int bit_shift = 3; + int show_err = 1; + return _sfp_set_soft_rs(self, + input_val, + self->eeprom_map_p->addr_soft_rs1, + self->eeprom_map_p->page_soft_rs1, + self->eeprom_map_p->offset_soft_rs1, + bit_shift, + &_sfp_update_attr_soft_rs1, + &(self->soft_rs1), + "sfp_set_soft_rs1", + show_err); +} + + +int +__sfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv = DEBUG_TRANSVR_HEX_VAL; + + if ((input < 0) || (input > 0xFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_sfp_set_tx_eq; + } + setv = (uint8_t)input; + if (self->tx_eq[0] == setv) { + return 0; + } + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + setv, + &(self->tx_eq[0]), + "_sfp_set_tx_eq", + show_e); + if (err < 0) { + emsg = "set_uint8_attr fail"; + goto err_sfp_set_tx_eq; + } + return 0; + +err_sfp_set_tx_eq: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_sfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + + uint8_t tmp; + int i = 0; + int retry = 3; + + for (i=0; itx_eq[0]; + if (_sfp_update_attr_tx_eq(self, show_e) < 0){ + continue; + } + if (self->tx_eq[0] == tmp){ + return 0; + } + } + return ERR_TRANSVR_UPDATE_FAIL; +} + + +int +sfp_set_tx_eq(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_sfp_update_attr_tx_eq, + "sfp_set_tx_eq"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _sfp_set_tx_eq(self, input, 1); +} + + +int +__sfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv = DEBUG_TRANSVR_HEX_VAL; + + if ((input < 0) || (input > 0xFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_sfp_set_rx_em; + } + setv = (uint8_t)input; + if (self->rx_em[0] == setv) { + return 0; + } + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + setv, + &(self->rx_em[0]), + "_sfp_set_rx_em", + show_e); + if (err < 0) { + emsg = "set_uint8_attr fail"; + goto err_sfp_set_rx_em; + } + return 0; + +err_sfp_set_rx_em: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_sfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + + uint8_t tmp; + int i = 0; + int retry = 3; + + for (i=0; irx_em[0]; + if (_sfp_update_attr_rx_em(self, show_e) < 0){ + continue; + } + if (self->rx_em[0] == tmp){ + return 0; + } + } + return -1; +} + + +int +sfp_set_rx_em(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_sfp_update_attr_rx_em, + "sfp_set_rx_em"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _sfp_set_rx_em(self, input, 1); +} + + +int +sfp_set_1g_rj45_extphy_offset(struct transvr_obj_s *self, + int input) { + + if (self->state != STATE_TRANSVR_CONNECTED) { + return ERR_TRANSVR_UNPLUGGED; + } + if ((self->info != TRANSVR_CLASS_BASE_T_1000) && + (self->info != TRANSVR_CLASS_BASE_T_1000_up) ){ + return ERR_TRANSVR_NOTSUPPORT; + } + if ((input < 0) || (input > 0xff)) { + return ERR_TRANSVR_BADINPUT; + } + self->extphy_offset = (uint8_t)input; + return 0; +} + + +int +sfp_set_1g_rj45_extphy_reg(struct transvr_obj_s *self, + int input) { + + int i = 0; + int retry = 3; + int delay = 200; + uint16_t tmp = 0; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return ERR_TRANSVR_UNPLUGGED; + } + if ((self->info != TRANSVR_CLASS_BASE_T_1000) && + (self->info != TRANSVR_CLASS_BASE_T_1000_up) ){ + return ERR_TRANSVR_NOTSUPPORT; + } + if ((input < 0) || (input > 0xffff)) { + return ERR_TRANSVR_BADINPUT; + } + tmp = ((input & 0x00ff) << 8) | ((input & 0xff00) >> 8); + if (_common_setup_page(self, VAL_TRANSVR_EXTPHY_ADDR_56, + -1, self->extphy_offset, 1, 0) < 0) { + return -EIO; + } + for (i=0; i<=retry; i++) { + if (i2c_smbus_write_word_data(self->i2c_client_p, + self->extphy_offset, + tmp) >= 0) { + return 0; + } + msleep(delay); + } + SWPS_INFO("%s: retry:%d fail :%s :0x%02x\n", + __func__, retry, self->swp_name, self->extphy_offset); + return -EIO; +} + + +static int +__qsfp_set_cdr(struct transvr_obj_s *self, + int input_val, + int show_err) { + + uint8_t update_val; + int CDR_FEATURE_SUPPORTED = 0x3; + int retval = ERR_TRANSVR_UNEXCPT; + int err_code = ERR_TRANSVR_UNEXCPT; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + char *func_name = "__qsfp_set_cdr"; + + /* Check input value */ + if ((input_val < 0) || (input_val > 0xff)){ + retval = ERR_TRANSVR_BADINPUT; + err_code = ERR_TRANSVR_BADINPUT; + err_msg = "Input range incorrect!"; + goto err_qsfp_set_cdr_1; + } + update_val = (uint8_t)input_val; + /* Check CDR supported by transceiver */ + err_code = qsfp_get_cdr_present(self); + if (err_code < 0) { + retval = err_code; + switch (err_code) { + case ERR_TRANSVR_UNINIT: + err_msg = "Check CDR present fail!"; + break; + case ERR_TRANSVR_UNPLUGGED: + err_msg = "Transceiver unplugged!"; + break; + default: + err_msg = "Check CDR present fail!"; + break; + } + goto err_qsfp_set_cdr_1; + } + if (err_code != CDR_FEATURE_SUPPORTED) { + retval = ERR_TRANSVR_NOTSUPPORT; + err_msg = "This transceiver not support CDR!"; + goto err_qsfp_set_cdr_1; + } + /* Check and update */ + err_code = _check_by_mode(self, + &_qsfp_update_attr_cdr, + func_name); + if ( (err_code < 0) || + (self->cdr == DEBUG_TRANSVR_HEX_VAL) ){ + retval = err_code; + err_msg = "Get current value fail!"; + goto err_qsfp_set_cdr_1; + } + /* Write input value to transceiver */ + return _common_set_uint8_attr(self, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->page_cdr, + self->eeprom_map_p->offset_cdr, + update_val, + &(self->cdr), + func_name, + show_err); + +err_qsfp_set_cdr_1: + if (show_err) { + SWPS_INFO("%s: %s :%d :%s\n :%d\n", + __func__, err_msg, err_code, self->swp_name, input_val); + } + return retval; +} + + +int +qsfp_set_cdr(struct transvr_obj_s *self, + int input_val) { + return __qsfp_set_cdr(self, input_val, 1); +} + + +int +qsfp_set_soft_tx_disable(struct transvr_obj_s *self, + int input_val) { + + int show_err = 1; + int in_max = 0xf; /* 1111 */ + int in_min = 0x0; /* 0000 */ + int retval = DEBUG_TRANSVR_INT_VAL; + int update_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + retval = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_disable, + "qsfp_set_soft_tx_disable"); + if (retval < 0) { + snprintf(err_msg, 63, "Not ready. err:%d", retval); + goto err_qsfp_set_soft_tx_disable; + } + if ((input_val > in_max) || + (input_val < in_min) ){ + retval = ERR_TRANSVR_BADINPUT; + snprintf(err_msg, 63, "Input value:%d incorrect!", input_val); + goto err_qsfp_set_soft_tx_disable; + } + if ((self->tx_disable & 0x0f) == input_val) { + return 0; + } + update_val = ((self->tx_disable & 0xf0) & input_val); + retval = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + input_val, + &(self->tx_disable), + "qsfp_set_tx_disable", + show_err); + if (retval < 0) { + snprintf(err_msg, 63, "_common_set_uint8_attr:%d fail!", retval); + goto err_qsfp_set_soft_tx_disable; + } + return 0; + +err_qsfp_set_soft_tx_disable: + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return retval; +} + + +int +_qsfp_set_auto_tx_disable(struct transvr_obj_s *self, + uint8_t update) { + + uint8_t tx_enable = 0x0; + int show_e = 1; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Handle timing issues */ + if (update != tx_enable) { + /* Note: + * Because there are some txvr has timing issues, + * therefore we need to execute reset cycle first. + * (enable -> other settings) + */ + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + tx_enable, + &(self->tx_disable), + "_qsfp_set_auto_tx_disable", + show_e); + if (err < 0) { + emsg = "I2C set reset value fail"; + goto err_qsfp_set_auto_tx_disable; + } + mdelay(10); + } + /* Setup target value */ + err = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + self->auto_tx_disable, + &(self->tx_disable), + "_qsfp_set_auto_tx_disable", + show_e); + if (err < 0) { + emsg = "I2C set target value fail"; + goto err_qsfp_set_auto_tx_disable; + } + /* Check and update */ + err = _common_update_uint8_attr(self, + self->eeprom_map_p->addr_tx_disable, + self->eeprom_map_p->page_tx_disable, + self->eeprom_map_p->offset_tx_disable, + self->eeprom_map_p->length_tx_disable, + &(self->tx_disable), + "_qsfp_set_auto_tx_disable", + show_e); + if (err < 0) { + emsg = "I2C get value fail"; + goto err_qsfp_set_auto_tx_disable; + } + if (self->tx_disable != update) { + emsg = "data not become effective"; + goto err_qsfp_set_auto_tx_disable; + } + return 0; + +err_qsfp_set_auto_tx_disable: + SWPS_DEBUG("%s: %s :%s\n", + __func__, emsg, self->swp_name); + return ERR_TRANSVR_UPDATE_FAIL; +} + + +int +qsfp_set_auto_tx_disable(struct transvr_obj_s *self, + int input_val) { + + int in_max = 0xf; /* 1111 */ + int in_min = 0x0; /* 0000 */ + int retval = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + + /* Update settings*/ + if (input_val == VAL_TRANSVR_FUNCTION_DISABLE) { + emsg = "User disable auto tx_disable"; + self->auto_tx_disable = VAL_TRANSVR_FUNCTION_DISABLE; + goto out_qsfp_set_auto_tx_disable; + } + if ((input_val > in_max) || (input_val < in_min) ){ + SWPS_INFO("%s: Input value:%d incorrect! :%s\n", + __func__, input_val, self->swp_name); + return ERR_TRANSVR_BADINPUT; + } + self->auto_tx_disable = input_val; + /* Check current soft tx_disable */ + retval = _check_by_mode(self, + &_qsfp_update_attr_soft_tx_disable, + "qsfp_set_auto_tx_disable"); + switch (retval) { + case 0: + break; + case ERR_TRANSVR_UNPLUGGED: + emsg = "Doesn't need to update"; + goto out_qsfp_set_auto_tx_disable; + default: + SWPS_INFO("%s: setup fail :%d :%s\n", + __func__, retval, self->swp_name); + return retval; + } + return _qsfp_set_auto_tx_disable(self, input_val); + +out_qsfp_set_auto_tx_disable: + SWPS_DEBUG("%s: %s :%s :%d\n :%d", + __func__, emsg, self->swp_name, input_val, retval); + return 0; +} + + +int +__qsfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + /* [Note] + * 0x + */ + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv[2] = {0x00, 0x00}; + + if ((input < 0) || (input > 0xFFFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_qsfp_set_tx_eq; + } + setv[0] = (uint8_t)((input & 0xFF00) >> 8); + setv[1] = (uint8_t)(input & 0xFF); + if ((self->tx_eq[0] == setv[0]) && + (self->tx_eq[1] == setv[1]) ) { + return 0; + } + err = _common_set_uint8_array(self, + self->eeprom_map_p->addr_tx_eq, + self->eeprom_map_p->page_tx_eq, + self->eeprom_map_p->offset_tx_eq, + self->eeprom_map_p->length_tx_eq, + setv, + self->tx_eq, + "_qsfp_set_tx_eq", + show_e); + if (err < 0) { + emsg = "set_uint8_array fail"; + goto err_qsfp_set_tx_eq; + } + return 0; + +err_qsfp_set_tx_eq: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_qsfp_set_tx_eq(struct transvr_obj_s *self, + int input, + int show_e) { + + int i = 0; + int retry = 3; + uint8_t tmp[2]; + + for (i=0; itx_eq[0]; + tmp[1] = self->tx_eq[1]; + if (_qsfp_update_attr_tx_eq(self, show_e) < 0){ + continue; + } + if ((self->tx_eq[0] == tmp[0]) && + (self->tx_eq[1] == tmp[1]) ){ + return 0; + } + } + return -1; +} + + +int +qsfp_set_tx_eq(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_qsfp_update_attr_tx_eq, + "qsfp_set_tx_eq"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _qsfp_set_tx_eq(self, input, 1); +} + + +int +__qsfp_set_rx_am(struct transvr_obj_s *self, + int input, + int show_e) { + /* [Note] + * 0x + */ + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv[2] = {0x00, 0x00}; + + if ((input < 0) || (input > 0xFFFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_qsfp_set_rx_am; + } + setv[0] = (uint8_t)((input & 0xFF00) >> 8); + setv[1] = (uint8_t)(input & 0xFF); + if ((self->rx_am[0] == setv[0]) && + (self->rx_am[1] == setv[1]) ) { + return 0; + } + err = _common_set_uint8_array(self, + self->eeprom_map_p->addr_rx_am, + self->eeprom_map_p->page_rx_am, + self->eeprom_map_p->offset_rx_am, + self->eeprom_map_p->length_rx_am, + setv, + self->rx_am, + "_qsfp_set_rx_am", + show_e); + if (err < 0) { + emsg = "set_uint8_array fail"; + goto err_qsfp_set_rx_am; + } + return 0; + +err_qsfp_set_rx_am: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_qsfp_set_rx_am(struct transvr_obj_s *self, + int input, + int show_e) { + + int i = 0; + int retry = 3; + uint8_t tmp[2]; + + for (i=0; irx_am[0]; + tmp[1] = self->rx_am[1]; + if (_qsfp_update_attr_rx_am(self, show_e) < 0){ + continue; + } + if ((self->rx_am[0] == tmp[0]) && + (self->rx_am[1] == tmp[1]) ){ + return 0; + } + } + return -1; +} + + +int +qsfp_set_rx_am(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_qsfp_update_attr_rx_am, + "qsfp_set_rx_am"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _qsfp_set_rx_am(self, input, 1); +} + + +int +__qsfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + /* [Note] + * 0x + */ + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t setv[2] = {0x00, 0x00}; + + if ((input < 0) || (input > 0xFFFF)) { + emsg = "input incorrect"; + err = ERR_TRANSVR_BADINPUT; + goto err_qsfp_set_rx_em; + } + setv[0] = (uint8_t)((input & 0xFF00) >> 8); + setv[1] = (uint8_t)(input & 0xFF); + if ((self->rx_em[0] == setv[0]) && + (self->rx_em[1] == setv[1]) ) { + return 0; + } + err = _common_set_uint8_array(self, + self->eeprom_map_p->addr_rx_em, + self->eeprom_map_p->page_rx_em, + self->eeprom_map_p->offset_rx_em, + self->eeprom_map_p->length_rx_em, + setv, + self->rx_em, + "_qsfp_set_rx_em", + show_e); + if (err < 0) { + emsg = "set_uint8_array fail"; + goto err_qsfp_set_rx_em; + } + return 0; + +err_qsfp_set_rx_em: + if (show_e) { + SWPS_INFO("%s: %s :%d\n", __func__, emsg, input); + } + return err; +} + + +int +_qsfp_set_rx_em(struct transvr_obj_s *self, + int input, + int show_e) { + + int i = 0; + int retry = 3; + uint8_t tmp[2]; + + for (i=0; irx_em[0]; + tmp[1] = self->rx_em[1]; + if (_qsfp_update_attr_rx_em(self, show_e) < 0){ + continue; + } + if ((self->rx_em[0] == tmp[0]) && + (self->rx_em[1] == tmp[1]) ){ + return 0; + } + } + return -1; +} + + +int +qsfp_set_rx_em(struct transvr_obj_s *self, + int input) { + + int err = _check_by_mode(self, + &_qsfp_update_attr_rx_em, + "qsfp_set_rx_em"); + if (err < 0) { + SWPS_DEBUG("%s: check fail :%d\n", __func__, err); + return err; + } + return _qsfp_set_rx_em(self, input, 1); +} + + +int +common_transvr_dump(struct transvr_obj_s* self){ + + char *type_name = "Undefined"; + + if (TRANSVR_INFO_DUMP_ENABLE != 1) { + return 0; + } + switch (self->type) { + case TRANSVR_TYPE_SFP: + type_name = STR_TRANSVR_SFP; + break; + case TRANSVR_TYPE_QSFP: + type_name = STR_TRANSVR_QSFP; + break; + case TRANSVR_TYPE_QSFP_PLUS: + type_name = STR_TRANSVR_QSFP_PLUS; + break; + case TRANSVR_TYPE_QSFP_28: + type_name = STR_TRANSVR_QSFP28; + break; + case TRANSVR_TYPE_FAKE: + type_name = "FAKE"; + goto ok_common_transvr_dump; + case TRANSVR_TYPE_UNPLUGGED: + type_name = "UNPLUGGED"; + goto err_common_transvr_dump; + case TRANSVR_TYPE_INCONSISTENT: + type_name = "INCONSISTENT"; + goto err_common_transvr_dump; + case TRANSVR_TYPE_ERROR: + type_name = "ERROR"; + goto err_common_transvr_dump; + + default: + type_name = "UNEXPECTED"; + goto err_common_transvr_dump; + } + printk(KERN_INFO "[SWPS] Dump %s information:\n", self->swp_name); + printk(KERN_INFO " |- :%s\n", type_name); + printk(KERN_INFO " |- :%s\n", self->vendor_name); + printk(KERN_INFO " |- :%s\n", self->vendor_pn); + printk(KERN_INFO " |- :%s\n", self->vendor_rev); + printk(KERN_INFO " |- :%s\n", self->vendor_sn); + printk(KERN_INFO " |- :0x%02x\n", self->br); + printk(KERN_INFO " |- :0x%02x\n", self->comp_rev); + printk(KERN_INFO " |- :%d\n", self->len_om1); + printk(KERN_INFO " |- :%d\n", self->len_om2); + printk(KERN_INFO " |- :%d\n", self->len_om3); + printk(KERN_INFO " |- :%d\n", self->len_om4); + return 0; + +ok_common_transvr_dump: + SWPS_INFO("%s: %s is %s\n", __func__, self->swp_name, type_name); + return 0; + +err_common_transvr_dump: + SWPS_INFO("%s: %s is %s\n", __func__, self->swp_name, type_name); + return -1; +} + + +int +sfp_transvr_dump(struct transvr_obj_s* self) { + + if (TRANSVR_INFO_DUMP_ENABLE != 1) { + return 0; + } + if (common_transvr_dump(self) < 0) { + return -1; + } + printk(KERN_INFO " |- :%d\n", self->len_sm); + printk(KERN_INFO " |- :%d\n", self->len_smf); + printk(KERN_INFO " '- :0x%02x\n", self->rate_id); + return 0; +} + + +int +qsfp_transvr_dump(struct transvr_obj_s* self) { + + if (TRANSVR_INFO_DUMP_ENABLE != 1) { + return 0; + } + if (common_transvr_dump(self) < 0) { + return -1; + } + printk(KERN_INFO " |- :%d\n", self->len_smf); + printk(KERN_INFO " '- :Class_%d\n", __qsfp_get_power_cls(self, 0)); + return 0; +} + + +int +fake_transvr_dump(struct transvr_obj_s* self) { + + printk(KERN_INFO "[SWPS] Dump transceiver information: %s\n", self->swp_name); + printk(KERN_INFO " |- :FAKE\n"); + printk(KERN_INFO " |- :FAKE_VENDER_NAME\n"); + printk(KERN_INFO " |- :FAKE_VENDER_PN\n"); + printk(KERN_INFO " |- :FAKE_VENDER_REV\n"); + printk(KERN_INFO " |- :FAKE_VENDER_SN\n"); + printk(KERN_INFO " |- :0x99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " |- :99\n"); + printk(KERN_INFO " '- :0x99\n"); + return 0; +} + + +/* ========== Object functions for fake type ========== + */ +int +fake_transvr_update(struct transvr_obj_s *self, + int show_err){ + self->state = STATE_TRANSVR_CONNECTED; + return 0; +} + + +int +fake_get_binary(struct transvr_obj_s *self){ + return 1; +} + +int +fake_get_int(struct transvr_obj_s *self){ + return 99; +} + + +int +fake_get_hex(struct transvr_obj_s *self){ + return 0x0f; +} + + +int +fake_get_str(struct transvr_obj_s *self, char *buf) { + return snprintf(buf, 16, "fake_get_str\n"); +} + + +int +fake_set_int(struct transvr_obj_s *self, int input){ + SWPS_INFO("%s: %d\n", __func__, input); + return 0; +} + + +int +fake_set_hex(struct transvr_obj_s *self, int input){ + SWPS_INFO("%s: 0x%02x\n", __func__, input); + return 0; +} + + +/* ========== Object functions for unsupported ========== + */ +int +unsupported_get_func(struct transvr_obj_s *self){ + return ERR_TRANSVR_NOTSUPPORT; +} + + +int +unsupported_get_func2(struct transvr_obj_s *self, + char *buf_p) { + int len = snprintf(buf_p, 8, "%d\n", ERR_TRANSVR_NOTSUPPORT); + return len; +} + + +int +unsupported_set_func(struct transvr_obj_s *self, + int input_val){ + return ERR_TRANSVR_NOTSUPPORT; +} + + + +/* ========== Object functions for long term task ========== + * + * [Note] + * SWPS transceiver worker is likely the green-thread (coroutine). + * Due to resource and performance considerations. SWPS run all + * features in one kthread at the same time, and handle by it self. + */ + +/* For Transceiver Task Handling + */ +static struct transvr_worker_s * +transvr_task_get(struct transvr_obj_s *self, + char *func_name) { + + struct transvr_worker_s *curr_p = self->worker_p; + + while(curr_p != NULL){ + if (strcmp((curr_p->func_name), func_name) == 0 ) { + return curr_p; + } + curr_p = curr_p->next_p; + } + return NULL; +} + + +static struct transvr_worker_s* +transvr_task_creat(struct transvr_obj_s *self, + int (*main_task)(struct transvr_worker_s *task), + int (*post_task)(struct transvr_worker_s *task), + char *caller) { + + struct transvr_worker_s *task_p = NULL; + struct transvr_worker_s *curr_p = NULL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Check task not exist */ + task_p = transvr_task_get(self, caller); + if (task_p) { + snprintf(err_msg, sizeof(err_msg), "Task already created!"); + goto err_transvr_task_creat; + } + /* Create task worker */ + task_p = kzalloc(sizeof(struct transvr_worker_s), GFP_KERNEL); + if (!task_p){ + snprintf(err_msg, sizeof(err_msg), "kzalloc fail"); + goto err_transvr_task_creat; + } + /* Setup task data */ + task_p->transvr_p = self; + task_p->next_p = NULL; + task_p->trigger_time = 0; + task_p->retry = 1; + task_p->state = STATE_T_TASK_INIT; + task_p->main_task = main_task; + task_p->post_task = post_task; + task_p->p_data = NULL; + snprintf(task_p->func_name, sizeof(task_p->func_name), "%s", caller); + /* Setup Link List */ + if (self->worker_p) { + curr_p = self->worker_p; + while(curr_p->next_p != NULL) { + curr_p = curr_p->next_p; + } + curr_p->next_p = task_p; + task_p->pre_p = curr_p; + } else { + self->worker_p = task_p; + task_p->pre_p = NULL; + } + return task_p; + +err_transvr_task_creat: + SWPS_ERR("%s: %s :%s :%s\n", + __func__, err_msg, caller, self->swp_name); + return NULL; +} + + +static void +transvr_task_free_one(struct transvr_worker_s *task_p){ + + struct transvr_worker_s *pre_p = NULL; + struct transvr_worker_s *next_p = NULL; + + if (task_p) { + pre_p = task_p->pre_p; + next_p = task_p->next_p; + + if ((pre_p) && (next_p)) { + pre_p->next_p = next_p; + next_p->pre_p = pre_p; + + } else if ((!pre_p) && (next_p)) { + next_p->pre_p = NULL; + + } else if ((pre_p) && (!next_p)) { + pre_p->next_p = NULL; + + } else if ((!pre_p) && (!next_p)) { + task_p->transvr_p->worker_p = NULL; + } else { + SWPS_ERR("%s: Unexcept case!\n :%s", + __func__, task_p->transvr_p->swp_name); + } + kfree(task_p->p_data); + kfree(task_p); + } +} + + +static void +transvr_task_free_all(struct transvr_obj_s *self) { + + struct transvr_worker_s *curr_p = NULL; + struct transvr_worker_s *next_p = NULL; + + if (self->worker_p) { + curr_p = self->worker_p; + while(curr_p) { + next_p = curr_p->next_p; + transvr_task_free_one(curr_p); + curr_p = next_p; + } + self->worker_p = NULL; + } +} + + +static void +transvr_cache_free_all(struct transvr_obj_s *self) { + + memset(self->vendor_name, 0, (LEN_TRANSVR_M_STR * sizeof(char)) ); + memset(self->vendor_rev, 0, (LEN_TRANSVR_M_STR * sizeof(char)) ); + memset(self->vendor_pn, 0, (LEN_TRANSVR_M_STR * sizeof(char)) ); + memset(self->vendor_sn, 0, (LEN_TRANSVR_M_STR * sizeof(char)) ); + self->extphy_offset = 0; +} + +static int +_transvr_task_run_main(struct transvr_worker_s *task_p) { + + int retval = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + if (!task_p){ + snprintf(err_msg, sizeof(err_msg), "main_task is NULL!"); + goto main_transvr_task_err; + } + if ((task_p->trigger_time) == 0){ + goto main_transvr_task_run; + } + if (time_before(jiffies, task_p->trigger_time)){ + goto main_transvr_task_wait; + } + goto main_transvr_task_run; + +main_transvr_task_run: + if (task_p->retry != VAL_TRANSVR_TASK_RETRY_FOREVER) { + task_p->retry -= 1; + } + retval = task_p->main_task(task_p); + if (retval < 0) { + if (task_p->retry > 0) { + task_p->state = STATE_T_TASK_WAIT; + return EVENT_TRANSVR_TASK_WAIT; + } + snprintf(err_msg, sizeof(err_msg), "Run main_task fail!"); + goto main_transvr_task_err; + } + goto main_transvr_task_identify; + +main_transvr_task_identify: + switch (retval) { + case EVENT_TRANSVR_TASK_WAIT: + task_p->state = STATE_T_TASK_WAIT; + return EVENT_TRANSVR_TASK_WAIT; + + case EVENT_TRANSVR_TASK_DONE: + task_p->state = STATE_T_TASK_DONE; + return EVENT_TRANSVR_TASK_DONE; + + default: + break; + } + snprintf(err_msg, sizeof(err_msg), "Run main_task fail!"); + goto main_transvr_task_err; + +main_transvr_task_wait: + task_p->state = STATE_T_TASK_WAIT; + return EVENT_TRANSVR_TASK_WAIT; + +main_transvr_task_err: + task_p->state = STATE_T_TASK_FAIL; + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, retval, task_p->transvr_p->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +static int +_transvr_task_run_post(struct transvr_worker_s *task_p) { + + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + if ((task_p->post_task) == NULL) { + return EVENT_TRANSVR_TASK_DONE; + } + switch (task_p->state) { + case STATE_T_TASK_WAIT: + case STATE_T_TASK_INIT: + goto post_transvr_task_wait; + + case STATE_T_TASK_DONE: + case STATE_T_TASK_FAIL: + goto post_transvr_task_run; + + default: + break; + } + snprintf(err_msg, sizeof(err_msg), "Unexcept task state"); + goto post_transvr_task_err; + +post_transvr_task_run: + task_p->post_task(task_p); + return EVENT_TRANSVR_TASK_DONE; + +post_transvr_task_wait: + return EVENT_TRANSVR_TASK_WAIT; + +post_transvr_task_err: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, task_p->state, task_p->transvr_p->swp_name); + return EVENT_TRANSVR_TASK_FAIL; +} + + +static int +transvr_task_run_one(struct transvr_worker_s *task_p) { + + int retval_main = DEBUG_TRANSVR_INT_VAL; + int retval_post = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + retval_main = _transvr_task_run_main(task_p); + if (retval_main < 0) { + snprintf(err_msg, sizeof(err_msg), "Execute main_task fail!"); + goto err_transvr_task_run_one; + } + retval_post = _transvr_task_run_post(task_p); + if (retval_post < 0) { + snprintf(err_msg, sizeof(err_msg), "Execute post_task fail!"); + goto err_transvr_task_run_one; + } + return retval_main; + +err_transvr_task_run_one: + SWPS_INFO("%s: %s
:%d :%d :%s :%s\n", + __func__, err_msg, retval_main, retval_post, + task_p->func_name, task_p->transvr_p->swp_name); + return EVENT_TRANSVR_TASK_FAIL; +} + + +static int +transvr_task_run_all(struct transvr_obj_s *self) { + + int haserr = 0; + int retval = DEBUG_TRANSVR_INT_VAL; + struct transvr_worker_s *curr_p = NULL; + struct transvr_worker_s *next_p = NULL; + + if ((self->worker_p) == NULL) { + return EVENT_TRANSVR_TASK_DONE; + } + curr_p = self->worker_p; + while (curr_p != NULL) { + next_p = curr_p->next_p; + retval = transvr_task_run_one(curr_p); + if (curr_p->retry == VAL_TRANSVR_TASK_RETRY_FOREVER) { + curr_p = next_p; + continue; + } + switch (retval) { + case EVENT_TRANSVR_TASK_WAIT: + break; + case EVENT_TRANSVR_TASK_DONE: + transvr_task_free_one(curr_p); + break; + case EVENT_TRANSVR_TASK_FAIL: + + default: + haserr = 1; + transvr_task_free_one(curr_p); + break; + } + curr_p = next_p; + } + if (haserr) { + return EVENT_TRANSVR_TASK_FAIL; + } + return EVENT_TRANSVR_TASK_DONE; +} + + +static void +transvr_task_set_delay(struct transvr_worker_s *task_p, + unsigned long delay_msec) { + + task_p->trigger_time = (jiffies + (delay_msec * (HZ/1000))); +} + + +static void +transvr_task_set_retry(struct transvr_worker_s *task_p, + unsigned long retry_times) { + + task_p->retry = retry_times; +} + + +/* For Transceiver Post Task + */ +int +taskfunc_post_do_nothing(struct transvr_worker_s *task_p) { + + return EVENT_TRANSVR_TASK_DONE; +} + + +int +taskfunc_post_handle_task_state(struct transvr_worker_s *task_p) { + + struct transvr_obj_s* tp = task_p->transvr_p; + + switch (task_p->state) { + case STATE_T_TASK_INIT: + case STATE_T_TASK_WAIT: + return EVENT_TRANSVR_TASK_WAIT; + + case STATE_T_TASK_DONE: + tp->state = STATE_TRANSVR_CONNECTED; + tp->send_uevent(tp, KOBJ_ADD); + return EVENT_TRANSVR_TASK_DONE; + + case STATE_T_TASK_FAIL: + tp->state = STATE_TRANSVR_UNEXCEPTED; + return EVENT_TRANSVR_TASK_FAIL; + + default: + break; + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +/* For Transceiver Main Task + */ +int +_taskfunc_sfp_setup_soft_rs(struct transvr_worker_s *task_p, + int input_val, + int address, + int page, + int offset, + int bit_shift, + uint8_t *attr_p, + char *caller) { + + int show_err = 0; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "_taskfunc_sfp_setup_soft_rs"; + + err_code = _sfp_update_attr_soft_rs0(task_p->transvr_p, 0); + if (err_code < 0) { + err_str = "Get current soft_rs0 fail!"; + goto err_taskfunc_sfp_setup_soft_rs_1; + } + err_code = __sfp_set_soft_rs(task_p->transvr_p, + input_val, + address, + page, + offset, + bit_shift, + attr_p, + caller, + show_err); + if (err_code < 0) { + err_str = "Get current soft_rs0 fail!"; + goto err_taskfunc_sfp_setup_soft_rs_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_sfp_setup_soft_rs_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + func_str, err_str, task_p->transvr_p->swp_name, input_val, err_code); + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +__taskfunc_sfp_setup_hard_rs(struct transvr_worker_s *task_p, + int input_val, + int (*get_func)(struct ioexp_obj_s *self, int virt_offset), + int (*set_func)(struct ioexp_obj_s *self, int virt_offset, int input_val)) { + + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_str = DEBUG_TRANSVR_STR_VAL; + + err_val = get_func(task_p->transvr_p->ioexp_obj_p, + task_p->transvr_p->ioexp_virt_offset); + + if (err_val < 0) { + if (err_val == ERR_IOEXP_NOTSUPPORT) { + return EVENT_TRANSVR_TASK_DONE; + } + err_str = "Get current hard_rs fail!"; + goto err_p_taskfunc_sfp_setup_hard_rs_1; + } + if (err_val == input_val) { + return EVENT_TRANSVR_TASK_DONE; + } + err_val = set_func(task_p->transvr_p->ioexp_obj_p, + task_p->transvr_p->ioexp_virt_offset, + input_val); + if (err_val < 0) { + err_str = "Setup hard_rs fail!"; + goto err_p_taskfunc_sfp_setup_hard_rs_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_p_taskfunc_sfp_setup_hard_rs_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + __func__, err_str, task_p->transvr_p->swp_name, input_val, err_val); + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_taskfunc_sfp_setup_hard_rs0(struct transvr_worker_s *task_p, + int input_val) { + + return __taskfunc_sfp_setup_hard_rs(task_p, + input_val, + task_p->transvr_p->ioexp_obj_p->get_hard_rs0, + task_p->transvr_p->ioexp_obj_p->set_hard_rs0); +} + + +int +_taskfunc_sfp_setup_hard_rs1(struct transvr_worker_s *task_p, + int input_val) { + + return __taskfunc_sfp_setup_hard_rs(task_p, + input_val, + task_p->transvr_p->ioexp_obj_p->get_hard_rs1, + task_p->transvr_p->ioexp_obj_p->set_hard_rs1); +} + + +int +_taskfunc_sfp_setup_rs0(struct transvr_worker_s *task_p, + int input_val) { + + int bit_shift = 3; + int old_val = DEBUG_TRANSVR_INT_VAL; + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "_taskfunc_sfp_setup_rs0"; + + err_val = _taskfunc_sfp_setup_hard_rs0(task_p, + input_val); + if (err_val < 0) { + err_str = "Setup hard_rs0 fail!"; + goto err_private_taskfunc_sfp_setup_rs0_1; + } + old_val = err_val; + err_val = _taskfunc_sfp_setup_soft_rs(task_p, + input_val, + task_p->transvr_p->eeprom_map_p->addr_soft_rs0, + task_p->transvr_p->eeprom_map_p->page_soft_rs0, + task_p->transvr_p->eeprom_map_p->offset_soft_rs0, + bit_shift, + &(task_p->transvr_p->soft_rs0), + func_str); + if (err_val < 0) { + err_str = "Setup soft_rs0 fail!"; + goto err_private_taskfunc_sfp_setup_rs0_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_private_taskfunc_sfp_setup_rs0_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + func_str, err_str, task_p->transvr_p->swp_name, input_val, err_val); + } + _taskfunc_sfp_setup_hard_rs0(task_p, old_val); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_taskfunc_sfp_setup_rs1(struct transvr_worker_s *task_p, + int input_val) { + + int bit_shift = 3; + int old_val = DEBUG_TRANSVR_INT_VAL; + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "_taskfunc_sfp_setup_rs1"; + + err_val = _taskfunc_sfp_setup_hard_rs1(task_p, + input_val); + if (err_val < 0) { + err_str = "Setup hard_rs1 fail!"; + goto err_private_taskfunc_sfp_setup_rs1_1; + } + old_val = err_val; + err_val = _taskfunc_sfp_setup_soft_rs(task_p, + input_val, + task_p->transvr_p->eeprom_map_p->addr_soft_rs1, + task_p->transvr_p->eeprom_map_p->page_soft_rs1, + task_p->transvr_p->eeprom_map_p->offset_soft_rs1, + bit_shift, + &(task_p->transvr_p->soft_rs1), + func_str); + if (err_val < 0) { + err_str = "Setup soft_rs1 fail!"; + goto err_private_taskfunc_sfp_setup_rs1_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_private_taskfunc_sfp_setup_rs1_1: + if ((task_p->retry) == 0) { + SWPS_INFO("%s: %s :%s :%d :%d\n", + func_str, err_str, task_p->transvr_p->swp_name, input_val, err_val); + } + _taskfunc_sfp_setup_hard_rs1(task_p, old_val); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +taskfunc_sfp_setup_SFF8431_case1(struct transvr_worker_s *task_p) { + /* SFF-8431 (8/4/2G Rx Rate_Select only) */ + int update_val = 1; + + return _taskfunc_sfp_setup_rs0(task_p, update_val); +} + + + +int +taskfunc_sfp_setup_SFF8431_case2(struct transvr_worker_s *task_p) { + /* SFF-8431 (8/4/2G Tx Rate_Select only) */ + int update_val = 1; + + return _taskfunc_sfp_setup_rs1(task_p, update_val); +} + + +int +taskfunc_sfp_setup_SFF8431_case3(struct transvr_worker_s *task_p) { + /* SFF-8431 (8/4/2G Independent Rx & Tx Rate_select) */ + int update_rs0 = 1; + int update_rs1 = 1; + int err_code = DEBUG_TRANSVR_INT_VAL; + + err_code = _taskfunc_sfp_setup_rs0(task_p, update_rs0); + if (err_code < 0) { + return err_code; + } + return _taskfunc_sfp_setup_rs1(task_p, update_rs1); +} + + +int +taskfunc_sfp_handle_1g_rj45(struct transvr_worker_s *task_p) { + + /* Not all of platform support 0x56 for transceiver + * external PHY, Support list as below: + * => 1. Magnolia-PVT (PS: EVT & DVT not ready) + */ + int ext_phy_addr = 0x56; + int ext_phy_page = -1; + int ext_phy_offs = 0x11; + int ext_phy_len = 1; + int lstate_mask = 0x04; /* 00000100 */ + int show_err = 0; + int fail_retry = 5; + int fail_delay = 1000; /* msec */ + int err_code = DEBUG_TRANSVR_INT_VAL; + uint8_t detect_val = DEBUG_TRANSVR_HEX_VAL; + char err_str[64] = DEBUG_TRANSVR_STR_VAL; + int *tmp_p = NULL; + char *func_name = "taskfunc_sfp_handle_1g_rj45"; + + if (task_p->transvr_p->state != STATE_TRANSVR_CONNECTED) { + return EVENT_TRANSVR_TASK_DONE; + } + if ( (task_p->transvr_p->info != TRANSVR_CLASS_BASE_T_1000) && + (task_p->transvr_p->info != TRANSVR_CLASS_BASE_T_1000_up) ) { + goto err_taskfunc_sfp_handle_1g_rj45_1; + } + err_code = _common_update_uint8_attr(task_p->transvr_p, + ext_phy_addr, + ext_phy_page, + ext_phy_offs, + ext_phy_len, + &detect_val, + func_name, + show_err); + if ( (err_code < 0) || + (detect_val == DEBUG_TRANSVR_HEX_VAL) ) { + snprintf(err_str, sizeof(err_str), "Detect external link status fail"); + goto err_taskfunc_sfp_handle_1g_rj45_2; + } + if ((detect_val & lstate_mask) == lstate_mask) { + goto ok_taskfunc_sfp_handle_1g_rj45_link_up; + } + goto ok_taskfunc_sfp_handle_1g_rj45_link_down; + +ok_taskfunc_sfp_handle_1g_rj45_link_up: + /* Filter out noise */ + if (!(task_p->p_data)) { + tmp_p = kzalloc(sizeof(int), GFP_KERNEL); + if (!tmp_p) { + snprintf(err_str, sizeof(err_str), "kzalloc p_data fail"); + goto err_taskfunc_sfp_handle_1g_rj45_2; + } + *tmp_p = TRANSVR_CLASS_BASE_T_1000_up; + task_p->p_data = tmp_p; + goto ok_taskfunc_sfp_handle_1g_rj45_done; + } + if ((*(int *)(task_p->p_data)) != TRANSVR_CLASS_BASE_T_1000_up) { + kfree(task_p->p_data); + task_p->p_data = NULL; + snprintf(err_str, sizeof(err_str), "Internal error"); + goto err_taskfunc_sfp_handle_1g_rj45_2; + } + task_p->transvr_p->info = TRANSVR_CLASS_BASE_T_1000_up; + kfree(task_p->p_data); + task_p->p_data = NULL; + goto ok_taskfunc_sfp_handle_1g_rj45_done; + +ok_taskfunc_sfp_handle_1g_rj45_link_down: + if (task_p->p_data) { + kfree(task_p->p_data); + task_p->p_data = NULL; + } + task_p->transvr_p->info = TRANSVR_CLASS_BASE_T_1000; + goto ok_taskfunc_sfp_handle_1g_rj45_done; + +ok_taskfunc_sfp_handle_1g_rj45_done: + if (task_p->retry != VAL_TRANSVR_TASK_RETRY_FOREVER) { + transvr_task_set_retry(task_p, VAL_TRANSVR_TASK_RETRY_FOREVER); + } + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_sfp_handle_1g_rj45_1: + snprintf(err_str, sizeof(err_str), "Detect transceiver:%d not Base-T, remove task.", + task_p->transvr_p->info); + SWPS_INFO("%s: %s :%s\n", __func__, err_str, task_p->transvr_p->swp_name); + transvr_task_set_retry(task_p, 0); + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_sfp_handle_1g_rj45_2: + if (task_p->retry == VAL_TRANSVR_TASK_RETRY_FOREVER) { + transvr_task_set_retry(task_p, fail_retry); + } + if ((task_p->retry) == 0) { + /* Error case: + * => In this case, SWPS will stop external Link state monitor features + * and keeps transvr_p->info on TRANSVR_CLASS_BASE_T_1000_up. + * Upper layer will see it always Linkup that because of these type of + * transceiver has external phy, BCM chip see it as Loopback transceiver. + */ + SWPS_WARN("%s can not access external PHY of Base-T SFP transceiver\n", + task_p->transvr_p->swp_name); + task_p->transvr_p->info = TRANSVR_CLASS_BASE_T_1000_up; + return EVENT_TRANSVR_TASK_DONE; + } else { + transvr_task_set_delay(task_p, fail_delay); + } + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_taskfunc_qsfp_setup_power_mod(struct transvr_obj_s *self, + int setup_val) { + + int curr_val = DEBUG_TRANSVR_INT_VAL; + int err_val = DEBUG_TRANSVR_INT_VAL; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + + curr_val = self->ioexp_obj_p->get_lpmod(self->ioexp_obj_p, + self->ioexp_virt_offset); + if (curr_val < 0){ + err_msg = "Get current value fail!"; + goto err_private_taskfunc_qsfp_setup_power_mod_1; + } + if (curr_val == setup_val){ + return EVENT_TRANSVR_TASK_DONE; + } + err_val = self->ioexp_obj_p->set_lpmod(self->ioexp_obj_p, + self->ioexp_virt_offset, + setup_val); + if (err_val < 0){ + err_msg = "Setup power mode fail!"; + goto err_private_taskfunc_qsfp_setup_power_mod_1; + } + return EVENT_TRANSVR_TASK_DONE; + +err_private_taskfunc_qsfp_setup_power_mod_1: + SWPS_INFO("%s: %s :%d :%d :%d\n", + __func__, err_msg, err_val, curr_val, setup_val); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +taskfunc_qsfp_handle_tx_disable(struct transvr_worker_s *task_p) { + + int i = 0; + int retry = 5; + int delay_ms = 100; + + if (task_p->transvr_p->auto_tx_disable == VAL_TRANSVR_FUNCTION_DISABLE) { + return EVENT_TRANSVR_TASK_DONE; + } + if (!_qsfp_is_implement_tx_disable(task_p->transvr_p)) { + return EVENT_TRANSVR_TASK_DONE; + } + for (i=0; itransvr_p, + task_p->transvr_p->auto_tx_disable) + == EVENT_TRANSVR_TASK_DONE) { + goto ok_taskfunc_qsfp_handle_tx_disable; + } + mdelay(delay_ms); + } + SWPS_INFO("%s auto setup tx_disable:0x%02x fail.\n", + task_p->transvr_p->swp_name, + task_p->transvr_p->auto_tx_disable); + return EVENT_TRANSVR_INIT_FAIL; + +ok_taskfunc_qsfp_handle_tx_disable: + SWPS_INFO("%s auto setup tx_disable:0x%02x ok.\n", + task_p->transvr_p->swp_name, + task_p->transvr_p->auto_tx_disable); + return EVENT_TRANSVR_TASK_DONE; +} + + +int +taskfunc_qsfp_set_hpmod(struct transvr_worker_s *task_p) { + + int err = DEBUG_TRANSVR_INT_VAL; + int HIGH_POWER_MODE = 0; + + /* Handle power mode */ + err = _taskfunc_qsfp_setup_power_mod(task_p->transvr_p, + HIGH_POWER_MODE); + if (err < 0) { + SWPS_INFO("%s: setup hpmod fail :%d :%s\n", + __func__, err, task_p->transvr_p->swp_name); + return err; + } + /* Handle auto tx_disable + * [Note] + * => Because there are some transceiver have timing issues or + * setup sequence issues, therefore we handle auto tx_disable + * after handle power mode. + */ + mdelay(100); + return taskfunc_qsfp_handle_tx_disable(task_p); +} + + +int +taskfunc_qsfp_set_lpmod(struct transvr_worker_s *task_p) { + + int LOW_POWER_MODE = 1; + return _taskfunc_qsfp_setup_power_mod(task_p->transvr_p, + LOW_POWER_MODE); +} + + +static int +initfunc_sfp_handle_multi_rate_mode(struct transvr_obj_s *self) { + + int task_retry = 3; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *err_str = DEBUG_TRANSVR_STR_VAL; + char *func_str = "sfp_handle_multi_rate_mode"; + struct transvr_worker_s *task_p = NULL; + + switch (self->rate_id) { + case 0x00: /* Unspecified */ + case 0x03: /* Unspecified */ + case 0x05: /* Unspecified */ + case 0x07: /* Unspecified */ + case 0x09: /* Unspecified */ + case 0x0B: /* Unspecified */ + case 0x0D: /* Unspecified */ + case 0x0F: /* Unspecified */ + goto sfp_handle_multi_rate_mode_4_unspecified; + + case 0x02: /* SFF-8431 (8/4/2G Rx Rate_Select only) */ + task_p = transvr_task_creat(self, + taskfunc_sfp_setup_SFF8431_case1, + taskfunc_post_handle_task_state, + func_str); + goto sfp_handle_multi_rate_mode_4_sff8431; + + case 0x04: /* SFF-8431 (8/4/2G Tx Rate_Select only) */ + task_p = transvr_task_creat(self, + taskfunc_sfp_setup_SFF8431_case2, + taskfunc_post_handle_task_state, + func_str); + goto sfp_handle_multi_rate_mode_4_sff8431; + + case 0x06: /* SFF-8431 (8/4/2G Independent Rx & Tx Rate_select) */ + task_p = transvr_task_creat(self, + taskfunc_sfp_setup_SFF8431_case3, + taskfunc_post_handle_task_state, + func_str); + goto sfp_handle_multi_rate_mode_4_sff8431; + + case 0x01: /* SFF-8079 (4/2/1G Rate_Select & AS0/AS1) */ + err_str = "SFF-8079 (4/2/1G Rate_Select & AS0/AS1)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x08: /* FC-PI-5 (16/8/4G Rx Rate_select only) + * High=16G only, Low=8G/4G + */ + err_str = "FC-PI-5 (16/8/4G Rx Rate_select only)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x0A: /* FC-PI-5 (16/8/4G Independent Rx, Tx Rate_select) + * High=16G only, Low=8G/4G + */ + err_str = "FC-PI-5 (16/8/4G Independent Rx, Tx Rate_select)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x0C: /* FC-PI-6 (32/16/8G Independent Rx, Tx Rate_Select) + * High=32G only, Low = 16G/8G + */ + err_str = "FC-PI-6 (32/16/8G Independent Rx, Tx Rate_Select)"; + goto sfp_handle_multi_rate_mode_4_not_support; + + case 0x0E: /* 10/8G Rx and Tx Rate_Select controlling the operation or + * locking modes of the internal signal conditioner, retimer + * or CDR, according to the logic table defined in Table 10-2, + * High Bit Rate (10G) =9.95-11.3 Gb/s; Low Bit Rate (8G) = + * 8.5 Gb/s. In this mode, the default value of bit 110.3 (Soft + * Rate Select RS(0), Table 9-11) and of bit 118.3 (Soft Rate + * Select RS(1), Table 10-1) is 1. + */ + err_str = "cable type: 0x0E"; + goto sfp_handle_multi_rate_mode_4_not_support; + + default: + err_str = "cable type: UNKNOW"; + goto sfp_handle_multi_rate_mode_4_not_support; + } + +sfp_handle_multi_rate_mode_4_sff8431: + if (!task_p) { + err_str = "Create task fail!"; + goto sfp_handle_multi_rate_mode_4_fail_1; + } + transvr_task_set_retry(task_p, task_retry); + return EVENT_TRANSVR_TASK_WAIT; + +sfp_handle_multi_rate_mode_4_unspecified: + return EVENT_TRANSVR_TASK_DONE; + +sfp_handle_multi_rate_mode_4_not_support: + SWPS_INFO("%s: Does not support %s :%s :0x%02x\n", + func_str, err_str, self->swp_name, self->rate_id); + return EVENT_TRANSVR_TASK_DONE; + +sfp_handle_multi_rate_mode_4_fail_1: + SWPS_INFO("%s: %s :%s :0x%02x, :%d\n", + func_str, err_str, self->swp_name, self->rate_id, err_code); + return EVENT_TRANSVR_INIT_FAIL; +} + + +static int +initfunc_sfp_handle_1g_rj45(struct transvr_obj_s *self) { + + struct transvr_worker_s *task_p = NULL; + int detect_cls = DEBUG_TRANSVR_INT_VAL; + char err_str[64] = DEBUG_TRANSVR_STR_VAL; + char *func_str = "initfunc_sfp_handle_1g_rj45"; + + + if (self->info == TRANSVR_CLASS_BASE_T_1000) { + task_p = transvr_task_creat(self, + taskfunc_sfp_handle_1g_rj45, + taskfunc_post_do_nothing, + func_str); + if (!task_p) { + snprintf(err_str, sizeof(err_str), "Create task fail"); + goto err_initfunc_sfp_handle_1g_rj45; + } + transvr_task_set_retry(task_p, VAL_TRANSVR_TASK_RETRY_FOREVER); + } + return EVENT_TRANSVR_TASK_DONE; + +err_initfunc_sfp_handle_1g_rj45: + SWPS_INFO("%s: %s :%s :%d\n", + __func__, err_str, self->swp_name, detect_cls); + return EVENT_TRANSVR_TASK_FAIL; +} + + +static int +initfunc_qsfp_handle_power_mode(struct transvr_obj_s *self) { + + int err_code = EVENT_TRANSVR_EXCEP_INIT; + int power_class = DEBUG_TRANSVR_INT_VAL; + int hpmod_retry = 3; + int lpower_config = 1; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + unsigned long hpmod_delay = 500; /* msec */ + struct transvr_worker_s *task_p = NULL; + + /* Handle power mode for IOEXP */ + power_class = __qsfp_get_power_cls(self, 0); + switch (power_class) { + case 1: /* Case: Low power mode (Class = 1) */ + err_code = _taskfunc_qsfp_setup_power_mod(self, lpower_config); + if (err_code < 0){ + snprintf(err_msg, sizeof(err_msg), "Setup lpmod fail :%d", err_code); + goto err_initfunc_qsfp_handle_power_mode; + } + return EVENT_TRANSVR_TASK_DONE; + + case 2: /* Case: High power mode (Class > 1) */ + case 3: + case 4: + case 5: + case 6: + case 7: + task_p = transvr_task_creat(self, + taskfunc_qsfp_set_hpmod, + taskfunc_post_handle_task_state, + "transvr_init_qsfp"); + if (!task_p) { + snprintf(err_msg, sizeof(err_msg), "Setup lpmod fail :%d", err_code); + goto err_initfunc_qsfp_handle_power_mode; + } + transvr_task_set_retry(task_p, hpmod_retry); + transvr_task_set_delay(task_p, hpmod_delay); + return EVENT_TRANSVR_TASK_WAIT; + + default: + break; + } + snprintf(err_msg, sizeof(err_msg), "Exception case"); + goto err_initfunc_qsfp_handle_power_mode; + +err_initfunc_qsfp_handle_power_mode: + SWPS_INFO("%s: %s :%s \n", __func__, err_msg, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +int +initfunc_qsfp28_handle_cdr(struct transvr_obj_s *self) { + + uint8_t DEFAULT_VAL_CDR = 0xff; + int CDR_FUNC_EXISTED = 0x3; + int show_err = 1; + int err_val = EVENT_TRANSVR_TASK_FAIL; + char *err_msg = DEBUG_TRANSVR_STR_VAL; + char *func_str = "initfunc_qsfp28_handle_cdr"; + + err_val = __qsfp_get_cdr_present(self, 0); + if ( (err_val < 0) || + (err_val == DEBUG_TRANSVR_HEX_VAL) ) { + err_msg = "detect cdr_present fail!"; + goto err_taskfunc_qsfp_handle_cdr_1; + } + if (err_val == CDR_FUNC_EXISTED) { + err_val = _common_set_uint8_attr(self, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->addr_cdr, + self->eeprom_map_p->offset_cdr, + DEFAULT_VAL_CDR, + &(self->cdr), + func_str, + show_err); + if (err_val < 0) { + err_msg = "set CDR fail!"; + goto err_taskfunc_qsfp_handle_cdr_1; + } + } + return EVENT_TRANSVR_TASK_DONE; + +err_taskfunc_qsfp_handle_cdr_1: + SWPS_INFO("%s: %s :%d :%s\n", + func_str, err_msg, err_val, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + +/* ========== Object functions for Final State Machine ========== + */ +int +is_plugged(struct transvr_obj_s *self){ + + int limit = 63; + int present = DEBUG_TRANSVR_INT_VAL; + char emsg[64] = DEBUG_TRANSVR_STR_VAL; + struct ioexp_obj_s *ioexp_p = self->ioexp_obj_p; + + if (!ioexp_p) { + snprintf(emsg, limit, "ioexp_p is null!"); + goto err_is_plugged_1; + } + present = ioexp_p->get_present(ioexp_p, self->ioexp_virt_offset); + switch (present){ + case 0: + return 1; + case 1: + return 0; + case ERR_IOEXP_UNINIT: + snprintf(emsg, limit, "ioexp_p not ready!"); + goto err_is_plugged_1; + default: + if (ioexp_p->state == STATE_IOEXP_INIT){ + snprintf(emsg, limit, "ioexp_p not ready!"); + goto err_is_plugged_1; + } + break; + } + SWPS_INFO("%s: Exception case! :%d :%d\n", + __func__, present, ioexp_p->state); + return 0; + +err_is_plugged_1: + SWPS_DEBUG("%s: %s\n", __func__, emsg); + return 0; +} + + +static int +detect_transvr_type(struct transvr_obj_s* self){ + + int type = TRANSVR_TYPE_ERROR; + + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + type = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + + /* Case: 1. Wait transceiver I2C module. + * 2. Transceiver I2C module failure. + * Note: 1. SFF allow maximum transceiver initial time is 2 second. So, there + * are exist some case that we need to wait transceiver. + * For these case, we keeps status on "TRANSVR_TYPE_UNPLUGGED", than + * state machine will keep trace with it. + * 2. There exist some I2C failure case we need to handle. Such as user + * insert the failure transceiver, or any reason cause it abnormal. + */ + if (type < 0){ + switch (type) { + case -EIO: + SWPS_DEBUG("%s: %s smbus return:-5 (I/O error)\n", + __func__, self->swp_name); + return TRANSVR_TYPE_UNPLUGGED; + case -ENXIO: + SWPS_DEBUG("%s: %s smbus return:-6 (No such device or address)\n", + __func__, self->swp_name); + return TRANSVR_TYPE_UNPLUGGED; + default: + break; + } + SWPS_INFO("%s: %s unexpected smbus return:%d \n", + __func__, self->swp_name, type); + return TRANSVR_TYPE_ERROR; + } + /* Identify valid transceiver type */ + switch (type){ + case TRANSVR_TYPE_SFP: + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + break; + case TRANSVR_TYPE_UNKNOW_1: + case TRANSVR_TYPE_UNKNOW_2: + type = TRANSVR_TYPE_UNKNOW_2; + break; + default: + SWPS_DEBUG("%s: unknow type:0x%02x \n", __func__, type); + type = TRANSVR_TYPE_ERROR; + break; + } + return type; +} + + +static int +detect_transvr_state(struct transvr_obj_s *self, + int result[2]){ + /* [return] [result-0] [result-1] + * 0 STATE_TRANSVR_CONNECTED TRANSVR_TYPE_FAKE + * 0 STATE_TRANSVR_DISCONNECTED TRANSVR_TYPE_UNPLUGGED + * 0 STATE_TRANSVR_ISOLATED TRANSVR_TYPE_ERROR + * 0 STATE_TRANSVR_INIT / + * 0 STATE_TRANSVR_SWAPPED + * 0 STATE_TRANSVR_CONNECTED + * ERR_TRNASVR_BE_ISOLATED STATE_TRANSVR_ISOLATED TRANSVR_TYPE_ERROR + * ERR_TRANSVR_I2C_CRASH STATE_TRANSVR_UNEXCEPTED TRANSVR_TYPE_ERROR + * ERR_TRANSVR_UNEXCPT STATE_TRANSVR_UNEXCEPTED TRANSVR_TYPE_UNKNOW_1/2 + */ + result[0] = STATE_TRANSVR_UNEXCEPTED; /* For return state */ + result[1] = TRANSVR_TYPE_ERROR; /* For return type */ + + /* Case1: Fake type */ + if (self->type == TRANSVR_TYPE_FAKE){ + result[0] = STATE_TRANSVR_CONNECTED; + result[1] = TRANSVR_TYPE_FAKE; + return 0; + } + /* Case2: Transceiver unplugged */ + if (!is_plugged(self)){ + result[0] = STATE_TRANSVR_DISCONNECTED; + result[1] = TRANSVR_TYPE_UNPLUGGED; + return 0; + } + /* Case3: Transceiver be isolated */ + if (self->state == STATE_TRANSVR_ISOLATED){ + result[0] = STATE_TRANSVR_ISOLATED; + result[1] = TRANSVR_TYPE_ERROR; + return ERR_TRNASVR_BE_ISOLATED; + } + /* Case4: Transceiver plugged */ + result[1] = detect_transvr_type(self); + /* Case4.1: I2C topology crash + * Note : There are some I2C issues cause by transceiver/cables. + * We need to check topology status when user insert it. + * But in this step, we can't not ensure this is the issues + * port. So, it return the ERR_TRANSVR_I2C_CRASH, then upper + * layer will diagnostic I2C topology. + */ + if (check_channel_tier_1() < 0) { + SWPS_INFO("%s: %s detect I2C crash :%d\n", + __func__, self->swp_name, self->state); + result[0] = STATE_TRANSVR_UNEXCEPTED; + result[1] = TRANSVR_TYPE_ERROR; + return ERR_TRANSVR_I2C_CRASH; + } + /* Case4.2: System initial not ready, + * Note : Sometime i2c channel or transceiver EEPROM will delay that will + * cause system in inconsistent state between EEPROM and IOEXP. + * In this case, SWP transceiver object keep state at LINK_DOWN + * to wait system ready. + * By the way, State Machine will handle these case. + */ + if (result[1] == TRANSVR_TYPE_UNPLUGGED){ + result[0] = STATE_TRANSVR_DISCONNECTED; + return 0; + } + /* Case4.3: Error transceiver type */ + if (result[1] == TRANSVR_TYPE_ERROR){ + result[0] = STATE_TRANSVR_ISOLATED; + SWPS_INFO("%s: %s detect error type\n", __func__, self->swp_name); + alarm_msg_2_user(self, "detected transceiver/cables not meet SFF standard!"); + return ERR_TRNASVR_BE_ISOLATED; + } + /* Case3.3: Unknow transceiver type */ + if ((result[1] == TRANSVR_TYPE_UNKNOW_1) || + (result[1] == TRANSVR_TYPE_UNKNOW_2) ){ + result[0] = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_UNEXCPT; + } + /* Case3.4: During initial process */ + if (self->state == STATE_TRANSVR_INIT){ + result[0] = STATE_TRANSVR_INIT; + return 0; + } + /* Case3.5: Transceiver be swapped */ + if (self->type != result[1]){ + result[0] = STATE_TRANSVR_SWAPPED; + return 0; + } + /* Case3.6: Link up state */ + result[0] = STATE_TRANSVR_CONNECTED; + return 0; +} + + +int +_sfp_detect_class_by_extend_comp(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int detect_val = _sfp_get_comp_extended(self); + + switch(detect_val) { + case 0x00: /* Unspecified */ + return TRANSVR_CLASS_UNSPECIFIED; + + case 0x01: /* 100G AOC (Active Optical Cable) or 25GAUI C2M */ + case 0x18: /* 100G AOC or 25GAUI C2M AOC. */ + return TRANSVR_CLASS_OPTICAL_25G_AOC; + + case 0x02: /* 100GBASE-SR4 or 25GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_25G_SR; + + case 0x03: /* 100GBASE-LR4 or 25GBASE-LR */ + return TRANSVR_CLASS_OPTICAL_25G_LR; + + case 0x04: /* 100GBASE-ER4 or 25GBASE-ER */ + return TRANSVR_CLASS_OPTICAL_25G_ER; + + case 0x08: /* 100G ACC (Active Copper Cable) or 25GAUI C2M ACC. */ + case 0x0b: /* 100GBASE-CR4 or 25GBASE-CR CA-L */ + case 0x0c: /* 25GBASE-CR CA-S */ + case 0x0d: /* 25GBASE-CR CA-N */ + case 0x19: /* 100G ACC or 25GAUI C2M ACC. */ + return TRANSVR_CLASS_COPPER_L1_25G; + + default: + break; + } + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_detect_class_by_10_ethernet(struct transvr_obj_s* self) { + /* Reference: SFF-8472 (v12.2) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + + detect_val = _sfp_get_comp_10g_eth_comp(self); + /* Case: Unspecified */ + if (detect_val == 0x00) { + return TRANSVR_CLASS_UNSPECIFIED; + } + /* Case: 10G Optical (x1) */ + if ((detect_val & 0x10) == 0x10) { /* 00010000 : 10GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_10G_S_SR; + } + if ( ((detect_val & 0x20) == 0x20) || /* 00100000 : 10GBASE-LR */ + ((detect_val & 0x40) == 0x40) ){ /* 01000000 : 10GBASE-LRM */ + return TRANSVR_CLASS_OPTICAL_10G_S_LR; + } + if ((detect_val & 0x80) == 0x80) { /* 10000000 : 10GBASE-ER */ + return TRANSVR_CLASS_OPTICAL_10G_S_ER; + } + /* Case: ERROR */ + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_detect_if_sp_by_br(struct transvr_obj_s* self) { + + int lower_bound_1g = 0x0b; + int upper_bound_1g = 0x1A; + int lower_bound_10g = 0x60; + int upper_bound_10g = 0x75; + int lower_bound_25g = 0xf0; + int upper_bound_25g = 0xff; + int notmal_br = DEBUG_TRANSVR_INT_VAL; + + notmal_br = (int)(self->br); /* updated by update_all() */ + /* Check 25G */ + if ((notmal_br >= lower_bound_25g) && + (notmal_br <= upper_bound_25g) ) { + return TRANSVR_CLASS_25G; + } + /* Check 10G */ + if ((notmal_br >= lower_bound_10g) && + (notmal_br <= upper_bound_10g) ) { + return TRANSVR_CLASS_10G; + } + /* Check 1G */ + if ((notmal_br >= lower_bound_1g) && + (notmal_br <= upper_bound_1g) ) { + return TRANSVR_CLASS_1G; + } + return TRANSVR_CLASS_UNSPECIFIED; +} + + +int +_sfp_detect_class_by_1g_ethernet(struct transvr_obj_s* self) { + /* Reference: SFF-8472 (v12.2) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + int speed_br = DEBUG_TRANSVR_INT_VAL; + int speed_tmp = DEBUG_TRANSVR_INT_VAL; + char err_str[64] = DEBUG_TRANSVR_STR_VAL; + + speed_br = _sfp_detect_if_sp_by_br(self); + detect_val = _sfp_get_comp_1g_eth_comp(self); + + if (detect_val < 0) { + snprintf(err_str, sizeof(err_str), "Detect abnormal value:%d", detect_val); + goto err_p_sfp_detect_class_by_1g_ethernet; + } + /* Case: Unspecified */ + if (detect_val == 0x00) { + return TRANSVR_CLASS_UNSPECIFIED; + } + /* Case: 1G (x1) */ + if ((detect_val & 0x01) == 0x01) { /* 00000001 : 1000BASE-SX */ + speed_tmp = TRANSVR_CLASS_OPTICAL_1G_SX; + goto ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g; + } + if ((detect_val & 0x02) == 0x02) { /* 00000010 : 1000BASE-LX *3 */ + speed_tmp = TRANSVR_CLASS_OPTICAL_1G_LX; + goto ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g; + } + if ((detect_val & 0x04) == 0x04) { /* 00000100 : 1000BASE-CX */ + speed_tmp = TRANSVR_CLASS_COPPER_L1_1G; + goto ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g; + } + /* Case: 1000 Base-T (x1) */ + if ((detect_val & 0x08) == 0x08) { /* 00001000 : 1000BASE-T */ + return TRANSVR_CLASS_BASE_T_1000; + } + /* Case: 100 Base */ + if ( ((detect_val & 0x10) == 0x10) || /* 00010000 : 100BASE-LX/LX10 */ + ((detect_val & 0x20) == 0x20) || /* 00100000 : 100BASE-FX */ + ((detect_val & 0x40) == 0x40) || /* 01000000 : BASE-BX10 *3 */ + ((detect_val & 0x80) == 0x80) ){ /* 10000000 : BASE-PX *3 */ + return TRANSVR_CLASS_OPTICAL_100; + } + /* Case: ERROR */ + snprintf(err_str, sizeof(err_str), "Case:ERROR, value:%d", detect_val); + goto err_p_sfp_detect_class_by_1g_ethernet; + +ok_sfp_detect_class_by_1g_ethernet_4_check_br_10g: + switch (speed_br) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_1G: + return speed_tmp; + case TRANSVR_CLASS_10G: + goto ok_sfp_detect_class_by_1g_ethernet_4_transfer_10G; + } + +ok_sfp_detect_class_by_1g_ethernet_4_transfer_10G: + switch (speed_tmp) { + case TRANSVR_CLASS_OPTICAL_1G_SX: + return TRANSVR_CLASS_OPTICAL_10G_S_SR; + case TRANSVR_CLASS_OPTICAL_1G_LX: + return TRANSVR_CLASS_OPTICAL_10G_S_LR; + case TRANSVR_CLASS_COPPER_L1_1G: + return TRANSVR_CLASS_COPPER_L1_10G; + default: + break; + } + snprintf(err_str, sizeof(err_str), "transfer_1to10 fail, speed:%d", speed_tmp); + goto err_p_sfp_detect_class_by_1g_ethernet; + +err_p_sfp_detect_class_by_1g_ethernet: + SWPS_INFO("%s: %s :%s", __func__, err_str, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_detect_class_by_feature(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int is_active = 0; + int conn_val = DEBUG_TRANSVR_INT_VAL; + int check_val = DEBUG_TRANSVR_INT_VAL; + int wave_len = DEBUG_TRANSVR_INT_VAL; + int speed_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + speed_val = _sfp_detect_if_sp_by_br(self); + conn_val = _sfp_get_connector_type(self); + + switch(conn_val) { + case 0x00: /* Unspecified */ + goto ok_sfp_detect_class_by_feature_4_check_active_passive; + case 0x07: /* LC (Lucent Connector) */ + case 0x0b: /* Optical Pigtail */ + case 0x0c: /* MPO 1x12 */ + case 0x0d: /* MPO 2x16 */ + /* + * ToDo: Need verify Optical Pigtail + */ + goto ok_sfp_detect_class_by_feature_4_optiocal; + case 0x21: /* Copper pigtail */ + /* + * ToDo: Need check ACC use case + */ + goto ok_sfp_detect_class_by_feature_4_check_active_passive; + case 0x23: /* No separable connector */ + /* + * ToDo: Standard not clear, not all transceiver vendor + * have the same defined + */ + goto ok_sfp_detect_class_by_feature_4_check_active_passive; + default: + break; + } + goto ok_sfp_detect_class_by_feature_4_unknow; + +ok_sfp_detect_class_by_feature_4_check_active_passive: + check_val = _sfp_get_cable_tech(self); + switch(check_val) { + case 0x00: /* Unspecified */ + goto ok_sfp_detect_class_by_feature_4_unknow; + case 0x04: /* Passive */ + goto ok_sfp_detect_class_by_feature_4_copper; + case 0x08: /* Active */ + is_active = 1; + goto ok_sfp_detect_class_by_feature_4_aoc; + default: + snprintf(err_msg, sizeof(err_msg), + "_sfp_get_cable_tech return Non define value:%d", + check_val); + break; + } + goto err_sfp_detect_class_by_feature_1; + +ok_sfp_detect_class_by_feature_4_optiocal: + wave_len = _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1]); + switch(speed_val) { + case TRANSVR_CLASS_25G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_25G_SR; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_25G_LR; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_25G_ER; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_25G; + + case TRANSVR_CLASS_10G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_10G_S_SR; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_10G_S_LR; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_10G_S_ER; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_10G; + + case TRANSVR_CLASS_1G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_1G_SX; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_1G_LX; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_1G_EX; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_1G; + + default: + return TRANSVR_CLASS_OPTICAL; + } + +ok_sfp_detect_class_by_feature_4_aoc: + switch(speed_val) { + case TRANSVR_CLASS_25G: + return TRANSVR_CLASS_OPTICAL_25G_AOC; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_OPTICAL_10G_S_AOC; + case TRANSVR_CLASS_1G: + return TRANSVR_CLASS_OPTICAL_1G_AOC; + default: + break; + } + goto ok_sfp_detect_class_by_feature_4_unknow; + +ok_sfp_detect_class_by_feature_4_copper: + switch(speed_val) { + case TRANSVR_CLASS_25G: + return TRANSVR_CLASS_COPPER_L1_25G; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_COPPER_L1_10G; + case TRANSVR_CLASS_1G: + return TRANSVR_CLASS_COPPER_L1_1G; + default: + return TRANSVR_CLASS_COPPER; + } + +ok_sfp_detect_class_by_feature_4_unknow: + return TRANSVR_CLASS_UNSPECIFIED; + +err_sfp_detect_class_by_feature_1: + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +sft_detect_transvr_class(struct transvr_obj_s* self) { + + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Check Extended Compliance */ + detect_val = _sfp_detect_class_by_extend_comp(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_COPPER_L1_25G: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined extend_comp:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Check 10G Compliance */ + detect_val = _sfp_detect_class_by_10_ethernet(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined 10G_eth:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Check 1G Compliance */ + detect_val = _sfp_detect_class_by_1g_ethernet(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_COPPER_L1_1G: + case TRANSVR_CLASS_BASE_T_1000: + case TRANSVR_CLASS_OPTICAL_100: + /* + * ToDo: Need Check 0.1G + */ + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_COPPER_L1_10G: + /* Transfer speed case + * => Example: Raycom 10G DAC + */ + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined 1G_eth:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Check by connector, br, wavelength */ + detect_val = _sfp_detect_class_by_feature(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL: + case TRANSVR_CLASS_OPTICAL_1G: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_25G: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_COPPER: + case TRANSVR_CLASS_COPPER_L1_1G: + case TRANSVR_CLASS_COPPER_L1_10G: + case TRANSVR_CLASS_COPPER_L1_25G: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined get_connector:%d", + detect_val); + goto err_sft_detect_transceiver_class_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sft_detect_transceiver_class_1; + +err_sft_detect_transceiver_class_1: + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_sfp_set_trident2_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result){ + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch(transvr_cls) { + case TRANSVR_CLASS_ERROR: + case TRANSVR_CLASS_UNSPECIFIED: + break; + /* 25G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 25G COPPER */ + case TRANSVR_CLASS_COPPER_L1_25G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 10G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 10G COPPER */ + case TRANSVR_CLASS_COPPER_L1_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 1G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G COPPER */ + case TRANSVR_CLASS_COPPER_L1_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G BASE_T */ + case TRANSVR_CLASS_BASE_T_1000: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 100 Base */ + case TRANSVR_CLASS_OPTICAL_100: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_sfp_set_trident2_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sfp_set_trident2_if_type_1; + +err_sfp_set_trident2_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_sfp_set_tomahawk_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result) { + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch(transvr_cls) { + case TRANSVR_CLASS_ERROR: + case TRANSVR_CLASS_UNSPECIFIED: + break; + /* 25G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G: + return snprintf(result, lmax, TRANSVR_IF_SR); + /* 25G COPPER */ + case TRANSVR_CLASS_COPPER_L1_25G: + return snprintf(result, lmax, TRANSVR_IF_KR); + /* 10G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 10G COPPER */ + case TRANSVR_CLASS_COPPER_L1_10G: + return snprintf(result, lmax, TRANSVR_IF_SFI); + /* 1G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G COPPER */ + case TRANSVR_CLASS_COPPER_L1_1G: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 1G BASE_T */ + case TRANSVR_CLASS_BASE_T_1000: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + /* 100 Base */ + case TRANSVR_CLASS_OPTICAL_100: + return snprintf(result, lmax, TRANSVR_IF_IF_GMII); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_sfp_set_tomahawk_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sfp_set_tomahawk_if_type_1; + +err_sfp_set_tomahawk_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_sfp_set_bf_tofino_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result) { + /* (TBD) + * Due to BF looks like doesn't have interface type. + * We bypass it currently. + */ + int lmax = 8; + return snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); +} + + +int +_sfp_detect_if_type(struct transvr_obj_s* self, + char *result){ + + int lmax = 8; + int detect_cls = DEBUG_TRANSVR_INT_VAL; + + detect_cls = sft_detect_transvr_class(self); + switch (self->chipset_type) { + case BCM_CHIP_TYPE_TRIDENT_2: + return _sfp_set_trident2_if_type(self, detect_cls, result); + + case BCM_CHIP_TYPE_TRIDENT_3: + case BCM_CHIP_TYPE_TOMAHAWK: + return _sfp_set_tomahawk_if_type(self, detect_cls, result); + + case BF_CHIP_TYPE_TOFINO: + return _sfp_set_bf_tofino_if_type(self, detect_cls, result); + + default: + SWPS_INFO("%s: non-defined chipset_type:%d :%s\n", + __func__, self->chipset_type, self->swp_name); + break; + } + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + return ERR_TRANSVR_ABNORMAL; +} + + +int +sfp_get_if_type(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 16; + char tmp_result[16] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_sfp_detect_if_type(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_sfp_detect_if_speed(struct transvr_obj_s* self, + char *result){ + + int lmax = 16; + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + detect_val = sft_detect_transvr_class(self); + switch(detect_val) { + case TRANSVR_CLASS_ERROR: + case TRANSVR_CLASS_UNSPECIFIED: + break; + /* 25G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_25G: + return snprintf(result, lmax, TRANSVR_IF_SP_25G); + /* 25G COPPER */ + case TRANSVR_CLASS_COPPER_L1_25G: + return snprintf(result, lmax, TRANSVR_IF_SP_25G); + /* 10G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_10G_S_AOC: + case TRANSVR_CLASS_OPTICAL_10G_S_SR: + case TRANSVR_CLASS_OPTICAL_10G_S_LR: + case TRANSVR_CLASS_OPTICAL_10G_S_ER: + case TRANSVR_CLASS_OPTICAL_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* 10G COPPER */ + case TRANSVR_CLASS_COPPER_L1_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* 1G OPTICAL */ + case TRANSVR_CLASS_OPTICAL_1G_AOC: + case TRANSVR_CLASS_OPTICAL_1G_SX: + case TRANSVR_CLASS_OPTICAL_1G_LX: + case TRANSVR_CLASS_OPTICAL_1G_EX: + case TRANSVR_CLASS_OPTICAL_1G: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + /* 1G COPPER */ + case TRANSVR_CLASS_COPPER_L1_1G: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + /* 1G BASE_T */ + case TRANSVR_CLASS_BASE_T_1000: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + /* 100 Base */ + case TRANSVR_CLASS_OPTICAL_100: + return snprintf(result, lmax, TRANSVR_IF_SP_100); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + detect_val); + goto err_sfp_detect_if_speed_1; + } + /* Check by BR */ + detect_val = _sfp_detect_if_sp_by_br(self); + switch (detect_val) { + case TRANSVR_CLASS_25G: + return snprintf(result, lmax, TRANSVR_IF_SP_25G); + case TRANSVR_CLASS_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + case TRANSVR_CLASS_1G: + return snprintf(result, lmax, TRANSVR_IF_SP_1G); + default: + break; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_sfp_detect_if_speed_1; + +err_sfp_detect_if_speed_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +sfp_get_if_speed(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 16; + char tmp_result[16] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_sfp_detect_if_speed(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_qsfp_detect_class_by_extend_comp(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + + detect_val = _qsfp_get_comp_extended(self); + switch(detect_val) { + case 0x00: /* Unspecified */ + return TRANSVR_CLASS_UNSPECIFIED; + + case 0x01: /* 100G AOC (Active Optical Cable) or 25GAUI C2M */ + case 0x18: /* 100G AOC or 25GAUI C2M AOC. */ + return TRANSVR_CLASS_OPTICAL_100G_AOC; + + case 0x06: /* 100G CWDM4 */ + case 0x09: /* Obsolete (assigned before 100G CWDM4 MSA required FEC) */ + case 0x17: /* 100G CLR4 */ + case 0x1A: /* 100GE-DWDM2 */ + return TRANSVR_CLASS_OPTICAL_100G; + + case 0x02: /* 100GBASE-SR4 or 25GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_100G_SR4; + + case 0x03: /* 100GBASE-LR4 or 25GBASE-LR */ + return TRANSVR_CLASS_OPTICAL_100G_LR4; + + case 0x04: /* 100GBASE-ER4 or 25GBASE-ER */ + return TRANSVR_CLASS_OPTICAL_100G_ER4; + + case 0x07: /* 100G PSM4 Parallel SMF */ + return TRANSVR_CLASS_OPTICAL_100G_PSM4; + + case 0x12: /* 40G PSM4 Parallel SMF */ + return TRANSVR_CLASS_OPTICAL_40G; + + case 0x11: /* 4 x 10GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_40G_SR4; + + case 0x10: /* 40GBASE-ER4 */ + return TRANSVR_CLASS_OPTICAL_40G_ER4; + + case 0x08: /* 100G ACC (Active Copper Cable) or 25GAUI C2M ACC. */ + case 0x0b: /* 100GBASE-CR4 or 25GBASE-CR CA-L */ + case 0x19: /* 100G ACC or 25GAUI C2M ACC. */ + return TRANSVR_CLASS_COPPER_L4_100G; + + default: + break; + } + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_qsfp_detect_class_by_10_40_100_ethernet(struct transvr_obj_s* self) { + /* Reference: SFF-8472 (v12.2) + */ + int detect_val = DEBUG_TRANSVR_INT_VAL; + + detect_val = _qsfp_get_comp_10_40_100_ethernet(self); + /* Case: Unspecified */ + if (detect_val == 0x00) { + return TRANSVR_CLASS_UNSPECIFIED; + } + /* Case: 40G Optical */ + if ((detect_val & 0x01) == 0x01) { /* 00000001 : 40G Active Cable (XLPPI) */ + return TRANSVR_CLASS_OPTICAL_40G_AOC; + } + if ((detect_val & 0x04) == 0x04) { /* 00000100 : 40GBASE-SR4 */ + return TRANSVR_CLASS_OPTICAL_40G_SR4; + } + if ( (detect_val & 0x02) == 0x02) { /* 00000010 : 40GBASE-LR4 */ + return TRANSVR_CLASS_OPTICAL_40G_LR4; + } + if ( (detect_val & 0x08) == 0x08) { /* 00001000 : 40GBASE-CR4 */ + return TRANSVR_CLASS_COPPER_L4_40G; + } + /* Case: 10G Optical */ + if ( (detect_val & 0x10) == 0x10) { /* 00010000 : 10GBASE-SR */ + return TRANSVR_CLASS_OPTICAL_10G_Q_SR; + } + if ( ((detect_val & 0x20) == 0x20) || /* 00100000 : 10GBASE-LR */ + ((detect_val & 0x40) == 0x40) ){ /* 01000000 : 10GBASE-LRM */ + return TRANSVR_CLASS_OPTICAL_10G_Q_LR; + } + /* Case: Extend Compliance */ + if ( ((detect_val & 0x80) == 0x80) ){ /* 10000000 : Use Extend Compliance */ + return TRANSVR_CLASS_EXTEND_COMP; + } + /* Case: ERROR */ + SWPS_INFO("%s: Unexcept value:0x%02x\n :%s", + __func__, detect_val, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_qsfp_detect_if_sp_by_br(struct transvr_obj_s* self) { + + int lower_bound_10g = 0x10; + int upper_bound_10g = 0x25; + int lower_bound_40g = 0x60; + int upper_bound_40g = 0x75; + int lower_bound_100g = 0x60; + int upper_bound_100g = 0x75; + int used_extend_br = 0xff; + int notmal_br = DEBUG_TRANSVR_INT_VAL; + int extend_br = DEBUG_TRANSVR_INT_VAL; + + notmal_br = (int)(self->br); /* updated by update_all() */ + /* Check 40G */ + if ((notmal_br >= lower_bound_40g) && + (notmal_br <= upper_bound_40g) ) { + return TRANSVR_CLASS_40G; + } + /* Check 100G */ + if (notmal_br == used_extend_br) { + extend_br = (int)(self->extbr); /* updated by update_all() */ + if ((extend_br >= lower_bound_100g) && + (extend_br <= upper_bound_100g) ) { + return TRANSVR_CLASS_100G; + } + } + /* Check 10G */ + if ((notmal_br >= lower_bound_10g) && + (notmal_br <= upper_bound_10g) ) { + return TRANSVR_CLASS_10G; + } + return TRANSVR_CLASS_UNSPECIFIED; +} + + +int +_qsfp_detect_class_by_feature(struct transvr_obj_s* self) { + /* Reference: SFF-8024 (v3.8) + */ + int conn_val = DEBUG_TRANSVR_INT_VAL; + int wave_len = DEBUG_TRANSVR_INT_VAL; + int speed_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + speed_val = _qsfp_detect_if_sp_by_br(self); + conn_val = _qsfp_get_connector_type(self); + + switch(conn_val) { + case 0x00: /* Unspecified */ + return TRANSVR_CLASS_UNSPECIFIED; + case 0x07: /* LC (Lucent Connector) */ + case 0x0b: /* Optical Pigtail */ + case 0x0c: /* MPO 1x12 (Multifiber Parallel Optic) */ + case 0x0d: /* MPO 2x16 */ + goto ok_qsfp_detect_class_by_feature_4_optiocal; + case 0x21: /* Copper pigtail */ + goto ok_qsfp_detect_class_by_feature_4_copper; + case 0x23: /* No separable connector */ + if ((_qsfp_get_comp_fc_link_length(self) > 0) || + (_qsfp_get_comp_fc_trans_tech(self) > 0) || + (_qsfp_get_comp_fc_trans_media(self) > 0) || + (_qsfp_get_comp_fc_speed(self) > 0) ) { + goto ok_qsfp_detect_class_by_feature_4_aoc; + } + goto ok_qsfp_detect_class_by_feature_4_copper; + default: + snprintf(err_msg, sizeof(err_msg), + "_qsfp_get_connector_type return Non define value:%d", + conn_val); + goto err_qsfp_detect_class_by_feature_1; + } + return TRANSVR_CLASS_UNSPECIFIED; + +ok_qsfp_detect_class_by_feature_4_optiocal: + wave_len = _common_count_wavelength(self, + self->wavelength[0], + self->wavelength[1]); + switch(speed_val) { + case TRANSVR_CLASS_100G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_100G_SR4; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_100G_LR4; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_100G_ER4; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_100G; + + case TRANSVR_CLASS_40G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_40G_SR4; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_40G_LR4; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_40G_ER4; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_40G; + + case TRANSVR_CLASS_10G: + switch (wave_len) { + case VAL_OPTICAL_WAVELENGTH_SR: + return TRANSVR_CLASS_OPTICAL_10G_Q_SR; + case VAL_OPTICAL_WAVELENGTH_LR: + return TRANSVR_CLASS_OPTICAL_10G_Q_LR; + case VAL_OPTICAL_WAVELENGTH_ER: + return TRANSVR_CLASS_OPTICAL_10G_Q_ER; + default: + break; + } + return TRANSVR_CLASS_OPTICAL_10G; + + default: + return TRANSVR_CLASS_OPTICAL; + } + +ok_qsfp_detect_class_by_feature_4_aoc: + switch(speed_val) { + case TRANSVR_CLASS_100G: + return TRANSVR_CLASS_OPTICAL_100G_AOC; + case TRANSVR_CLASS_40G: + return TRANSVR_CLASS_OPTICAL_40G_AOC; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_OPTICAL_10G_Q_AOC; + default: + return TRANSVR_CLASS_OPTICAL; + } + +ok_qsfp_detect_class_by_feature_4_copper: + switch(speed_val) { + case TRANSVR_CLASS_100G: + return TRANSVR_CLASS_COPPER_L4_100G; + case TRANSVR_CLASS_40G: + return TRANSVR_CLASS_COPPER_L4_40G; + case TRANSVR_CLASS_10G: + return TRANSVR_CLASS_COPPER_L4_10G; + default: + return TRANSVR_CLASS_COPPER; + } + +err_qsfp_detect_class_by_feature_1: + SWPS_INFO("%s: %s\n :%s", + __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +qsft_detect_transvr_class(struct transvr_obj_s* self) { + + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Check Extended Compliance */ + detect_val = _qsfp_detect_class_by_extend_comp(self); + switch (detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + case TRANSVR_CLASS_COPPER_L4_100G: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined extend_comp:%d", + detect_val); + goto err_qsft_detect_transvr_class_1; + } + /* Check 10/40G/100G Ethernet Compliance */ + detect_val = _qsfp_detect_class_by_10_40_100_ethernet(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_COPPER_L4_40G: + return detect_val; + case TRANSVR_CLASS_EXTEND_COMP: + /* Format incorrect case (We already checked the Extend + * Compliance is 0 + */ + snprintf(err_msg, sizeof(err_msg), + "Transceiver format incorrect"); + goto err_qsft_detect_transvr_class_1; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined 10/40/100:%d", + detect_val); + goto err_qsft_detect_transvr_class_1; + } + /* Check by Connector type, BR and wavelength */ + detect_val = _qsfp_detect_class_by_feature(self); + switch (detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL: + case TRANSVR_CLASS_COPPER_L4_100G: + case TRANSVR_CLASS_COPPER_L4_40G: + case TRANSVR_CLASS_COPPER_L4_10G: + case TRANSVR_CLASS_COPPER: + return detect_val; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined connector:%d", + detect_val); + goto err_qsft_detect_transvr_class_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), + "Can not identify!"); + goto err_qsft_detect_transvr_class_1; + +err_qsft_detect_transvr_class_1: + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return TRANSVR_CLASS_ERROR; +} + + +int +_qsfp_set_trident2_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result){ + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch (transvr_cls) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_ERROR: + break; + /* 100G Optical */ + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* 100G Copper */ + case TRANSVR_CLASS_COPPER_L4_100G: + return snprintf(result, lmax, TRANSVR_IF_KR4); + /* 40G Optical */ + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* 40G Copper */ + case TRANSVR_CLASS_COPPER_L4_40G: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* 10G Optical */ + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: LR4 or LR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: /* Need Check: ER4 or ER */ + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* Optical */ + case TRANSVR_CLASS_OPTICAL: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + /* Copper */ + case TRANSVR_CLASS_COPPER: + return snprintf(result, lmax, TRANSVR_IF_IF_XGMII); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_qsfp_set_trident2_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_qsfp_set_trident2_if_type_1; + +err_qsfp_set_trident2_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_qsfp_set_tomahawk_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result){ + + int lmax = 8; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + switch (transvr_cls) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_ERROR: + break; + /* 100G Optical */ + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* 100G Copper */ + case TRANSVR_CLASS_COPPER_L4_100G: + return snprintf(result, lmax, TRANSVR_IF_KR4); + /* 40G Optical */ + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* 40G Copper */ + case TRANSVR_CLASS_COPPER_L4_40G: + return snprintf(result, lmax, TRANSVR_IF_KR4); + /* 10G Optical */ + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* Optical */ + case TRANSVR_CLASS_OPTICAL: + return snprintf(result, lmax, TRANSVR_IF_SR4); + /* Copper */ + case TRANSVR_CLASS_COPPER: + return snprintf(result, lmax, TRANSVR_IF_KR4); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined value:%d", + transvr_cls); + goto err_qsfp_set_trident2_if_type_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_qsfp_set_trident2_if_type_1; + +err_qsfp_set_trident2_if_type_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s\n :%s", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +_qsfp_set_bf_tofino_if_type(struct transvr_obj_s* self, + int transvr_cls, + char *result) { + /* (TBD) + * Due to BF looks like doesn't have interface type. + * We bypass it currently. + */ + int lmax = 8; + return snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); +} + + +int +_qsfp_detect_if_type(struct transvr_obj_s* self, + char *result){ + + int lmax = 8; + int detect_cls = DEBUG_TRANSVR_INT_VAL; + + detect_cls = qsft_detect_transvr_class(self); + switch (self->chipset_type) { + case BCM_CHIP_TYPE_TRIDENT_2: + return _qsfp_set_trident2_if_type(self, detect_cls, result); + + case BCM_CHIP_TYPE_TRIDENT_3: + case BCM_CHIP_TYPE_TOMAHAWK: + return _qsfp_set_tomahawk_if_type(self, detect_cls, result); + + case BF_CHIP_TYPE_TOFINO: + return _qsfp_set_bf_tofino_if_type(self, detect_cls, result); + + default: + SWPS_INFO("%s: non-defined chipset_type:%d :%s\n", + __func__, self->chipset_type, self->swp_name); + break; + } + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_if_type(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 8; + char tmp_result[8] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_qsfp_detect_if_type(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_qsfp_detect_if_speed(struct transvr_obj_s* self, + char *result){ + int lmax = 16; + int detect_val = DEBUG_TRANSVR_INT_VAL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + detect_val = qsft_detect_transvr_class(self); + switch (detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + case TRANSVR_CLASS_ERROR: + break; + /* 100G Optical */ + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return snprintf(result, lmax, TRANSVR_IF_SP_100G); + /* 100G Copper */ + case TRANSVR_CLASS_COPPER_L4_100G: + return snprintf(result, lmax, TRANSVR_IF_SP_100G); + /* 40G Optical */ + case TRANSVR_CLASS_OPTICAL_40G: + case TRANSVR_CLASS_OPTICAL_40G_AOC: + case TRANSVR_CLASS_OPTICAL_40G_SR4: + case TRANSVR_CLASS_OPTICAL_40G_LR4: + case TRANSVR_CLASS_OPTICAL_40G_ER4: + return snprintf(result, lmax, TRANSVR_IF_SP_40G); + /* 40G Copper */ + case TRANSVR_CLASS_COPPER_L4_40G: + return snprintf(result, lmax, TRANSVR_IF_SP_40G); + /* 10G Optical */ + case TRANSVR_CLASS_OPTICAL_10G: + case TRANSVR_CLASS_OPTICAL_10G_Q_AOC: + case TRANSVR_CLASS_OPTICAL_10G_Q_SR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_LR: /* Need Check: SR4 or SR */ + case TRANSVR_CLASS_OPTICAL_10G_Q_ER: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* 10G Copper */ + case TRANSVR_CLASS_COPPER_L4_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + /* Optical */ + case TRANSVR_CLASS_OPTICAL: + break; + /* Copper */ + case TRANSVR_CLASS_COPPER: + break; + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined class case:%d", + detect_val); + goto err_qsfp_detect_if_speed_1; + } + /* Check br and extbr */ + detect_val = _qsfp_detect_if_sp_by_br(self); + switch(detect_val) { + case TRANSVR_CLASS_UNSPECIFIED: + break; + case TRANSVR_CLASS_10G: + return snprintf(result, lmax, TRANSVR_IF_SP_10G); + case TRANSVR_CLASS_40G: + return snprintf(result, lmax, TRANSVR_IF_SP_40G); + case TRANSVR_CLASS_100G: + return snprintf(result, lmax, TRANSVR_IF_SP_100G); + default: + snprintf(err_msg, sizeof(err_msg), + "Detect undefined BR case:%d", + detect_val); + goto err_qsfp_detect_if_speed_1; + } + /* Exception case: Can't verify */ + snprintf(err_msg, sizeof(err_msg), "Can not identify!"); + goto err_qsfp_detect_if_speed_1; + +err_qsfp_detect_if_speed_1: + snprintf(result, lmax, TRANSVR_UEVENT_UNKNOW); + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + return ERR_TRANSVR_ABNORMAL; +} + + +int +qsfp_get_if_speed(struct transvr_obj_s *self, + char *buf_p){ + + int lmax = 16; + char tmp_result[16] = DEBUG_TRANSVR_STR_VAL; + + if (self->state != STATE_TRANSVR_CONNECTED) { + return snprintf(buf_p, lmax, "%d\n", self->state); + } + if (_qsfp_detect_if_speed(self, tmp_result) < 0) { + return snprintf(buf_p, lmax, "%d\n", ERR_TRANSVR_ABNORMAL); + } + return snprintf(buf_p, lmax, "%s\n", tmp_result); +} + + +int +_common_set_lane_map_str(struct transvr_obj_s* self, + char *result) { + int i = 0; + int tmp_val = 0; + char tmp_str[LEN_TRANSVR_L_STR] = DEBUG_TRANSVR_STR_VAL; + char err_msg[LEN_TRANSVR_L_STR] = DEBUG_TRANSVR_STR_VAL; + + memset(result, 0, LEN_TRANSVR_L_STR); + snprintf(result, LEN_TRANSVR_L_STR, "%s=", TRANSVR_UEVENT_KEY_LANE); + + for (i=0; ilane_id); i++) { + tmp_val = self->lane_id[i]; + if (tmp_val < 1) { + break; + } + if (tmp_val > 256) { + snprintf(err_msg, sizeof(err_msg), + "detect abnormal value:%d", tmp_val); + goto err_common_set_lane_map_str_1; + } + memset(tmp_str, 0, sizeof(tmp_str)); + if (i == 0) { + snprintf(tmp_str, LEN_TRANSVR_L_STR, "%d", tmp_val); + } else { + snprintf(tmp_str, LEN_TRANSVR_L_STR, ",%d", tmp_val); + } + strncat(result, tmp_str, LEN_TRANSVR_L_STR); + } + if (i == 0) { + goto err_common_set_lane_map_str_2; + } + return 0; + +err_common_set_lane_map_str_1: + SWPS_INFO("%s: %s", __func__, err_msg); +err_common_set_lane_map_str_2: + snprintf(result, LEN_TRANSVR_L_STR, "%s=%s", TRANSVR_UEVENT_KEY_LANE, TRANSVR_UEVENT_UNKNOW); + return EVENT_TRANSVR_TASK_FAIL; +} + + +int +_common_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action, + int (*detect_if_type)(struct transvr_obj_s *self, char *result), + int (*detect_if_speed)(struct transvr_obj_s *self, char *result), + int send_anyway) { + + char *uevent_envp[4]; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + char tmp_str[32] = DEBUG_TRANSVR_STR_VAL; + char tmp_str_1[32] = DEBUG_TRANSVR_STR_VAL; + char tmp_str_2[32] = DEBUG_TRANSVR_STR_VAL; + char tmp_str_3[64] = DEBUG_TRANSVR_STR_VAL; + + if (TRANSVR_UEVENT_ENABLE != 1) { + return ERR_TRANSVR_NOTSUPPORT; + } + if (_common_get_if_lane(self, tmp_str) < 0) { + snprintf(tmp_str_3, sizeof(tmp_str_3), + "%s=%s", TRANSVR_UEVENT_KEY_LANE, TRANSVR_UEVENT_UNKNOW); + } else { + snprintf(tmp_str_3, sizeof(tmp_str_3), + "%s=%s", TRANSVR_UEVENT_KEY_LANE, tmp_str); + } + switch (u_action) { + case KOBJ_ADD: + /* Detect type */ + if (detect_if_type(self, tmp_str) < 0) { + snprintf(err_msg, sizeof(err_msg), "%s", "Detect interface type fail!"); + snprintf(tmp_str_1, sizeof(tmp_str_1), "%s=%s", TRANSVR_UEVENT_KEY_IF, TRANSVR_UEVENT_UNKNOW); + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, TRANSVR_UEVENT_UNKNOW); + uevent_envp[0] = tmp_str_1; + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_fail; + } + snprintf(tmp_str_1, sizeof(tmp_str_1), "%s=%s", TRANSVR_UEVENT_KEY_IF, tmp_str); + uevent_envp[0] = tmp_str_1; + /* Detect speed */ + if (detect_if_speed(self, tmp_str) < 0) { + snprintf(err_msg, sizeof(err_msg), "%s", "Detect interface speed fail!"); + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, TRANSVR_UEVENT_UNKNOW); + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_fail; + } + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, tmp_str); + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_send; + + case KOBJ_REMOVE: + snprintf(tmp_str_1, sizeof(tmp_str_1), "%s=%s", TRANSVR_UEVENT_KEY_IF, TRANSVR_UEVENT_UNKNOW); + snprintf(tmp_str_2, sizeof(tmp_str_2), "%s=%s", TRANSVR_UEVENT_KEY_SP, TRANSVR_UEVENT_UNKNOW); + uevent_envp[0] = tmp_str_1; + uevent_envp[1] = tmp_str_2; + uevent_envp[2] = tmp_str_3; + uevent_envp[3] = NULL; + goto private_common_send_uevent_4_send; + + default: + snprintf(err_msg, sizeof(err_msg), "kobject_action:%d not support", u_action); + goto private_common_send_uevent_4_fail; + } + snprintf(err_msg, sizeof(err_msg), "%s", "Exception case"); + goto private_common_send_uevent_4_fail; + +private_common_send_uevent_4_fail: + SWPS_INFO("%s: %s :%s\n", __func__, err_msg, self->swp_name); + if (send_anyway) { + goto private_common_send_uevent_4_send; + } + return ERR_TRANSVR_UEVENT_FAIL; + +private_common_send_uevent_4_send: + return kobject_uevent_env(&(self->transvr_dev_p->kobj), + u_action, + uevent_envp); +} + +int +sfp_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action) { + int send_anyway = 1; + return _common_send_uevent(self, + u_action, + &_sfp_detect_if_type, + &_sfp_detect_if_speed, + send_anyway); +} + + +int +qsfp_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action) { + int send_anyway = 1; + return _common_send_uevent(self, + u_action, + &_qsfp_detect_if_type, + &_qsfp_detect_if_speed, + send_anyway); +} + + +int +fake_send_uevent(struct transvr_obj_s* self, + enum kobject_action u_action) { + return EVENT_TRANSVR_TASK_DONE; +} + + +int +common_fsm_4_direct_mode(struct transvr_obj_s* self, + char *caller_name){ + + int err; + int detect_result[2]; + int current_state = STATE_TRANSVR_UNEXCEPTED; + int current_type = TRANSVR_TYPE_ERROR; + + if (self->state == STATE_TRANSVR_NEW) { + if (_transvr_init_handler(self) < 0){ + return ERR_TRANSVR_INIT_FAIL; + } + } + err = detect_transvr_state(self, detect_result); + if (err < 0) { + return err; + } + /* In Direct mode, driver only detect transceiver when user call driver interface + * which on sysfs. So it only need consider the state of Transceiver. + */ + current_state = detect_result[0]; + current_type = detect_result[1]; + + switch (current_state){ + + case STATE_TRANSVR_DISCONNECTED: /* Transceiver is not plugged */ + self->state = current_state; + self->type = current_type; + return ERR_TRANSVR_UNPLUGGED; + + case STATE_TRANSVR_INIT: /* Transceiver is plugged, system not ready */ + return ERR_TRANSVR_UNINIT; + + case STATE_TRANSVR_ISOLATED: /* Transceiver is plugged, but has some issues */ + return ERR_TRNASVR_BE_ISOLATED; + + case STATE_TRANSVR_CONNECTED: /* Transceiver is plugged, system is ready */ + self->state = current_state; + self->type = current_type; + return 0; + + case STATE_TRANSVR_SWAPPED: /* Transceiver is plugged, system detect user changed */ + self->type = current_type; + if (reload_transvr_obj(self, current_type) < 0){ + self->state = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_UNEXCPT; + } + self->state = current_state; + return 0; + + case STATE_TRANSVR_UNEXCEPTED: /* Transceiver type or state is unexpected case */ + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = TRANSVR_TYPE_ERROR; + return ERR_TRANSVR_UNEXCPT; + + default: + SWPS_INFO("%s: state:%d not in define.\n", __func__, current_state); + break; + } + return ERR_TRANSVR_UNEXCPT; +} + + +static int +_is_except_happened_4_pmode(struct transvr_obj_s* self, + int new_state) { + + int event_chk = 0; + + if (self->temp == 0){ + return 0; + } + switch (new_state) { + case STATE_TRANSVR_INIT: + event_chk = EVENT_TRANSVR_EXCEP_INIT; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_CONNECTED: + event_chk = EVENT_TRANSVR_EXCEP_UP; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_DISCONNECTED: + event_chk = EVENT_TRANSVR_EXCEP_DOWN; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_SWAPPED: + event_chk = EVENT_TRANSVR_EXCEP_SWAP; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_UNEXCEPTED: + event_chk = EVENT_TRANSVR_EXCEP_EXCEP; + goto check_event_happened_4_pmode; + + case STATE_TRANSVR_ISOLATED: + event_chk = EVENT_TRANSVR_EXCEP_ISOLATED; + goto check_event_happened_4_pmode; + + default: + SWPS_INFO("%s: unexcepted case:%d\n", __func__, new_state); + break; + } + return 0; + +check_event_happened_4_pmode: + if (self->temp == event_chk){ + return 1; + } + return 0; +} + + +int +common_fsm_4_polling_mode(struct transvr_obj_s* self, + char *caller_name){ + /* [Return Value]: + * ERR_TRANSVR_UNINIT : (1) Initial not ready + * ERR_TRANSVR_UNPLUGGED : (1) Any -> Down + * ERR_TRANSVR_TASK_BUSY : (1) Wait Initial task + * ERR_TRANSVR_UNEXCPT : (1) Initial fail + * (2) Task fail + * (3) Reload fail + * ERR_TRNASVR_BE_ISOLATED : (1) Already be isolated + * OK Case (return 0) : (1) action_4_connected + * (2) action_4_nothing (initial retry) + */ + int curr_state[2]; + int old_state = self->state; + int old_type = self->type; + int new_state = STATE_TRANSVR_UNEXCEPTED; + int new_type = TRANSVR_TYPE_ERROR; + int return_val = ERR_TRANSVR_UNEXCPT; + + /* Never initial */ + if (self->state == STATE_TRANSVR_NEW) { + goto comfsm_action_4_reinit_obj; + } + /* Detect current state */ + switch (detect_transvr_state(self, curr_state)) { + case 0: + new_state = curr_state[0]; + new_type = curr_state[1]; + break; + + case ERR_TRNASVR_BE_ISOLATED: + new_state = STATE_TRANSVR_ISOLATED; + new_type = old_type; + break; + + case ERR_TRANSVR_I2C_CRASH: + goto comfsm_action_4_report_i2c_crash; + + case ERR_TRANSVR_UNEXCPT: + default: + new_state = STATE_TRANSVR_UNEXCEPTED; + new_type = old_type; + } + /* State handling */ + switch (old_state) { + case STATE_TRANSVR_INIT: /* INIT -> */ + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 1-1: UP -> INIT */ + SWPS_INFO("Detect %s is present. :1-1\n",self->swp_name); + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 1-2: UP -> UP */ + return_val = 0; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_DISCONNECTED: /* Case 1-3: UP -> DOWN */ + SWPS_INFO("Detect %s is removed. :1-3\n",self->swp_name); + goto comfsm_action_4_disconnected; + + case STATE_TRANSVR_SWAPPED: /* Case 1-4: UP -> SWAP */ + SWPS_INFO("Detect %s is swapped. :1-4\n",self->swp_name); + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 1-5: UP -> UNEXPET */ + SWPS_INFO("Detect %s has error. :1-5\n",self->swp_name); + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_ISOLATED: /* Case 1-6: UP -> ISOLATE */ + SWPS_INFO("Detect %s be isolated. :1-6\n",self->swp_name); + goto comfsm_action_4_isolate_obj; + + default: + break; + } + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_DISCONNECTED: + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 2-1: DOWN -> INIT */ + SWPS_INFO("Detect %s is present. :2-1\n",self->swp_name); + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 2-2: DOWN -> UP */ + SWPS_INFO("Detect %s is present. :2-2\n",self->swp_name); + goto comfsm_action_4_reinit_obj; + + case STATE_TRANSVR_DISCONNECTED: /* Case 2-3: DOWN -> DOWN */ + return_val = ERR_TRANSVR_UNPLUGGED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_SWAPPED: /* Case 2-4: DOWN -> SWAP */ + SWPS_INFO("Detect %s is swapped. :2-4\n",self->swp_name); + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 2-5: DOWN -> UNEXPET */ + SWPS_INFO("Detect %s has error. :2-5\n",self->swp_name); + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_ISOLATED: /* Case 2-6: DOWN -> ISOLATE */ + SWPS_INFO("Detect %s be isolated. :2-6\n",self->swp_name); + goto comfsm_action_4_isolate_obj; + + default: + break; + } + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_UNEXCEPTED: + /* Filter out re-action */ + if (_is_except_happened_4_pmode(self, new_state)) { + goto comfsm_action_4_keep_state; + } + /* First action */ + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 3-1: UNEXPET -> INIT */ + SWPS_INFO("Detect %s is present. :3-1\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_INIT; + return_val = ERR_TRANSVR_UNINIT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 3-2: UNEXPET -> UP */ + SWPS_INFO("Detect %s is present. :3-2\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_UP; + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_DISCONNECTED: /* Case 3-3: UNEXPET -> DOWN */ + SWPS_INFO("Detect %s is removed. :3-3\n",self->swp_name); + goto comfsm_action_4_disconnected; + + case STATE_TRANSVR_SWAPPED: /* Case 3-4: UNEXPET -> SWAP */ + SWPS_INFO("Detect %s is swapped. :3-4\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_SWAP; + goto comfsm_action_4_reload_obj; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 3-5: UNEXPET -> UNEXPET */ + self->temp = EVENT_TRANSVR_EXCEP_EXCEP; + return_val = ERR_TRANSVR_UNEXCPT; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_ISOLATED: /* Case 3-6: UNEXPET -> ISOLATE */ + SWPS_INFO("Detect %s be isolated. :3-6\n",self->swp_name); + goto comfsm_action_4_isolate_obj; + + default: + break; + } + goto comfsm_action_4_unexpected; + + case STATE_TRANSVR_ISOLATED: + /* Filter out re-action */ + if (_is_except_happened_4_pmode(self, new_state)) { + goto comfsm_action_4_keep_state; + } + /* First action */ + switch (new_state) { + case STATE_TRANSVR_INIT: /* Case 4-1: ISOLATE -> INIT */ + SWPS_INFO("Detect %s internal error. :4-1\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_INIT; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_CONNECTED: /* Case 4-2: ISOLATE -> UP */ + SWPS_INFO("Detect %s internal error. :4-2\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_UP; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_DISCONNECTED: /* Case 4-3: ISOLATE -> DOWN */ + SWPS_INFO("Detect %s is removed. :4-3\n",self->swp_name); + goto comfsm_action_4_disconnected; + + case STATE_TRANSVR_SWAPPED: /* Case 4-4: ISOLATE -> SWAP */ + SWPS_INFO("Detect %s internal error. :4-4\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_SWAP; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_UNEXCEPTED: /* Case 4-5: ISOLATE -> UNEXPET */ + SWPS_INFO("Detect %s internal error. :4-5\n",self->swp_name); + self->temp = EVENT_TRANSVR_EXCEP_EXCEP; + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + case STATE_TRANSVR_ISOLATED: /* Case 4-6: ISOLATE -> ISOLATE */ + return_val = ERR_TRNASVR_BE_ISOLATED; + goto comfsm_action_4_keep_state; + + default: + break; + } + goto comfsm_action_4_unexpected; + + default: + break; + } + goto comfsm_action_4_unexpected; + + +comfsm_action_4_keep_state: + return return_val; + +comfsm_action_4_reinit_obj: + SWPS_DEBUG("FSM action: %s re-initial.\n", self->swp_name); + return_val = _transvr_init_handler(self); + goto comfsm_action_4_identify_event; + +comfsm_action_4_reload_obj: + SWPS_DEBUG("FSM action: %s reload.\n", self->swp_name); + self->type = new_type; + return_val = reload_transvr_obj(self, new_type); + goto comfsm_action_4_identify_event; + +comfsm_action_4_identify_event: + switch (return_val) { + case EVENT_TRANSVR_INIT_UP: + case EVENT_TRANSVR_TASK_DONE: + goto comfsm_action_4_connected; + + case EVENT_TRANSVR_INIT_DOWN: + goto comfsm_action_4_disconnected; + + case EVENT_TRANSVR_INIT_REINIT: + goto comfsm_action_4_nothing; + + case EVENT_TRANSVR_TASK_WAIT: + self->state = STATE_TRANSVR_INIT; + return ERR_TRANSVR_TASK_BUSY; + + case EVENT_TRANSVR_TASK_FAIL: + SWPS_INFO("%s detect EVENT_TRANSVR_TASK_FAIL.\n", self->swp_name); + goto comfsm_action_4_unexpected; + + case EVENT_TRANSVR_INIT_FAIL: + SWPS_INFO("%s detect EVENT_TRANSVR_INIT_FAIL.\n", self->swp_name); + goto comfsm_action_4_unexpected; + + case EVENT_TRANSVR_RELOAD_FAIL: + SWPS_INFO("%s detect EVENT_TRANSVR_RELOAD_FAIL.\n", self->swp_name); + goto comfsm_action_4_unexpected; + + case EVENT_TRANSVR_I2C_CRASH: + goto comfsm_action_4_report_i2c_crash; + + case EVENT_TRANSVR_EXCEP_ISOLATED: + goto comfsm_action_4_isolate_obj; + + default: + SWPS_INFO("%s detect undefined event:%d.\n", self->swp_name, return_val); + goto comfsm_action_4_unexpected; + } + +comfsm_action_4_nothing: + SWPS_DEBUG("FSM action: %s do nothing.\n", self->swp_name); + return 0; + +comfsm_action_4_connected: + SWPS_DEBUG("FSM action: %s Connected.\n", self->swp_name); + self->state = STATE_TRANSVR_CONNECTED; + self->type = new_type; + self->send_uevent(self, KOBJ_ADD); + _transvr_clean_retry(self); + return 0; + +comfsm_action_4_disconnected: + SWPS_DEBUG("FSM action: %s Disconnected. \n", self->swp_name); + self->state = STATE_TRANSVR_DISCONNECTED; + self->temp = EVENT_TRANSVR_TASK_DONE; + self->send_uevent(self, KOBJ_REMOVE); + _transvr_clean_retry(self); + _transvr_clean_handler(self); + return ERR_TRANSVR_UNPLUGGED; + +comfsm_action_4_report_i2c_crash: + SWPS_DEBUG("FSM action: %s report I2C crash.\n", self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + return ERR_TRANSVR_I2C_CRASH; + +comfsm_action_4_isolate_obj: + SWPS_DEBUG("FSM action: %s isolate.\n", self->swp_name); + self->state = STATE_TRANSVR_ISOLATED; + return ERR_TRNASVR_BE_ISOLATED; + +comfsm_action_4_unexpected: + SWPS_INFO("FSM action: %s unexpected.\n", self->swp_name); + SWPS_INFO("Dump: :%d :0x%02x :%d :0x%02x\n", + old_state, old_type, new_state, new_type); + self->state = STATE_TRANSVR_UNEXCEPTED; + self->send_uevent(self, KOBJ_REMOVE); + _transvr_clean_handler(self); + return ERR_TRANSVR_UNEXCPT; +} + + +int +fake_fsm_4_direct_mode(struct transvr_obj_s* self, + char *caller_name){ + self->state = STATE_TRANSVR_CONNECTED; + self->type = TRANSVR_TYPE_FAKE; + return 0; +} + + +int +fake_fsm_4_polling_mode(struct transvr_obj_s* self, + char *caller_name){ + self->state = STATE_TRANSVR_CONNECTED; + self->type = TRANSVR_TYPE_FAKE; + return 0; +} + + +/* ========== Object functions for Initial procedure ========== + */ +int +transvr_init_common(struct transvr_obj_s *self){ + /* Nothing to update */ + return EVENT_TRANSVR_TASK_DONE; +} + + +int +transvr_init_fake(struct transvr_obj_s *self){ + return EVENT_TRANSVR_TASK_DONE; +} + + +int +transvr_init_sfp(struct transvr_obj_s *self){ + + int tmp_val = DEBUG_TRANSVR_INT_VAL; + int err_code = DEBUG_TRANSVR_INT_VAL; + char *err_msg = "ERR"; + + self->info = sft_detect_transvr_class(self); + /* Disable auto_config */ + if (!self->auto_config) { + return EVENT_TRANSVR_TASK_DONE; + } + /* Handle multi-rate */ + err_code = initfunc_sfp_handle_multi_rate_mode(self); + if (err_code < 0) { + err_msg = "initfunc_sfp_handle_multi_rate_mode fail!"; + goto err_transvr_init_sfp_1; + } + /* Handle 1G- RJ45 */ + tmp_val = err_code; + err_code = initfunc_sfp_handle_1g_rj45(self); + if (err_code < 0) { + err_msg = "initfunc_sfp_handle_1g_rj45 fail!"; + goto err_transvr_init_sfp_1; + } + tmp_val = (tmp_val > err_code ? tmp_val : err_code); + if (tmp_val > EVENT_TRANSVR_TASK_DONE) { + return tmp_val; + } + return EVENT_TRANSVR_TASK_DONE; + +err_transvr_init_sfp_1: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, err_code, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +int +transvr_init_qsfp(struct transvr_obj_s *self){ + + int err = EVENT_TRANSVR_EXCEP_EXCEP; + char *emsg = "ERR"; + + self->info = qsft_detect_transvr_class(self); + if (!self->auto_config) { + return EVENT_TRANSVR_TASK_DONE; + } + err = initfunc_qsfp_handle_power_mode(self); + if (err < 0){ + emsg = "initfunc_qsfp_handle_tx_disable fail!"; + goto err_transvr_init_qsfp; + } + return EVENT_TRANSVR_TASK_DONE; + +err_transvr_init_qsfp: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, emsg, err, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +int +transvr_init_qsfp28(struct transvr_obj_s *self){ + + int tmp_val = EVENT_TRANSVR_EXCEP_EXCEP; + int err_val = EVENT_TRANSVR_EXCEP_EXCEP; + char *err_msg = "ERR"; + + /* Handle QSFP common */ + err_val = transvr_init_qsfp(self); + if (err_val < 0){ + err_msg = "transvr_init_qsfp fail!"; + goto err_transvr_init_qsfp28_1; + } + /* Disable auto_config */ + if (!self->auto_config) { + return err_val; + } + /* Handle CDR */ + tmp_val = err_val; + err_val = initfunc_qsfp28_handle_cdr(self); + if (err_val < 0){ + err_msg = "Handle CDR fail!"; + goto err_transvr_init_qsfp28_1; + } + tmp_val = (tmp_val > err_val ? tmp_val : err_val); + if (tmp_val > EVENT_TRANSVR_TASK_DONE) { + return tmp_val; + } + return EVENT_TRANSVR_TASK_DONE; + +err_transvr_init_qsfp28_1: + SWPS_INFO("%s: %s :%d :%s\n", + __func__, err_msg, err_val, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; +} + + +/* ========== Object Initial handler ========== + */ +static int +_is_transvr_valid(struct transvr_obj_s *self, + int type, + int state) { + /* [Return] + * 0 : OK, inserted + * EVENT_TRANSVR_INIT_DOWN : OK, removed + * EVENT_TRANSVR_INIT_FAIL : Outside error, type doesn't supported + * EVENT_TRANSVR_EXCEP_INIT : Internal error, state undefined + */ + switch (type) { + case TRANSVR_TYPE_SFP: + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + case TRANSVR_TYPE_UNPLUGGED: + case TRANSVR_TYPE_FAKE: + break; + default: + SWPS_INFO("detect undefined type:0x%02x on %s\n", + type, self->swp_name); + return EVENT_TRANSVR_INIT_FAIL; + } + switch (state) { + case STATE_TRANSVR_DISCONNECTED: + return EVENT_TRANSVR_INIT_DOWN; + case STATE_TRANSVR_INIT: + case STATE_TRANSVR_CONNECTED: + case STATE_TRANSVR_SWAPPED: + break; + default: + SWPS_INFO("detect undefined state:%d on %s\n", + state, self->swp_name); + return EVENT_TRANSVR_EXCEP_INIT; + } + return 0; +} + + +static int +_is_transvr_hw_ready(struct transvr_obj_s *self, + int type){ + /* [Return] + * EVENT_TRANSVR_TASK_DONE : Ready + * EVENT_TRANSVR_TASK_WAIT : Not ready + * EVENT_TRANSVR_INIT_FAIL : Error + */ + int addr = DEBUG_TRANSVR_INT_VAL; + int page = DEBUG_TRANSVR_INT_VAL; + int offs = DEBUG_TRANSVR_INT_VAL; + int bit = DEBUG_TRANSVR_INT_VAL; + int ready = DEBUG_TRANSVR_INT_VAL; + int err = DEBUG_TRANSVR_INT_VAL; + char *emsg = DEBUG_TRANSVR_STR_VAL; + uint8_t ab_val = DEBUG_TRANSVR_HEX_VAL; + + switch (type) { + case TRANSVR_TYPE_SFP: + addr = VAL_TRANSVR_8472_READY_ADDR; + page = VAL_TRANSVR_8472_READY_PAGE; + offs = VAL_TRANSVR_8472_READY_OFFSET; + bit = VAL_TRANSVR_8472_READY_BIT; + ready = VAL_TRANSVR_8472_READY_VALUE; + ab_val = VAL_TRANSVR_8472_READY_ABNORMAL; + break; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + case TRANSVR_TYPE_QSFP_28: + addr = VAL_TRANSVR_8436_READY_ADDR; + page = VAL_TRANSVR_8436_READY_PAGE; + offs = VAL_TRANSVR_8436_READY_OFFSET; + bit = VAL_TRANSVR_8436_READY_BIT; + ready = VAL_TRANSVR_8436_READY_VALUE; + ab_val = VAL_TRANSVR_8436_READY_ABNORMAL; + break; + + case TRANSVR_TYPE_UNPLUGGED: + case TRANSVR_TYPE_FAKE: + return EVENT_TRANSVR_TASK_DONE; + + default: + emsg = "unexpected case"; + goto err_is_transvr_hw_ready; + } + /* Select target page */ + err = _common_setup_page(self, addr, page, offs, 1, 0); + if (err < 0) { + emsg = "setup page fail"; + goto err_is_transvr_hw_ready; + } + /* Check feature supported + * [Note] + * Some of transceiver/cables doesn't support "Status Indicators" + * (ex:DAC, RJ45 copper SFP ...etc). In these case, we bypass the + * step of checking Status Indicators, then state machine will take + * the following handle procedure. + */ + err = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + if (err < 0) { + emsg = "doesn't support Status Indicators"; + goto bypass_is_transvr_hw_ready; + } + /* Filter abnormal case */ + if (err == ab_val) { + emsg = "detect using unusual definition."; + goto bypass_is_transvr_hw_ready; + } + /* Get Status Indicators */ + err = i2c_smbus_read_byte_data(self->i2c_client_p, offs); + if (err < 0) { + emsg = "detect current value fail"; + goto err_is_transvr_hw_ready; + } + if ((err & (1<:%d\n", __func__, emsg, type); + return EVENT_TRANSVR_TASK_DONE; + +err_is_transvr_hw_ready: + SWPS_DEBUG("%s: %s :%d\n", __func__, emsg, type); + return EVENT_TRANSVR_INIT_FAIL; +} + + +static int +_is_transvr_support_ctle(struct transvr_obj_s *self) { + + switch (self->info) { + case TRANSVR_CLASS_OPTICAL_25G: + case TRANSVR_CLASS_OPTICAL_25G_AOC: + case TRANSVR_CLASS_OPTICAL_25G_SR: + case TRANSVR_CLASS_OPTICAL_25G_LR: + case TRANSVR_CLASS_OPTICAL_25G_ER: + case TRANSVR_CLASS_OPTICAL_100G: + case TRANSVR_CLASS_OPTICAL_100G_AOC: + case TRANSVR_CLASS_OPTICAL_100G_SR4: + case TRANSVR_CLASS_OPTICAL_100G_LR4: + case TRANSVR_CLASS_OPTICAL_100G_ER4: + case TRANSVR_CLASS_OPTICAL_100G_PSM4: + return 1; + default: + break; + } + return 0; +} + + +static int +_transvr_init_handler(struct transvr_obj_s *self){ + + int detect[2]; + int d_state = STATE_TRANSVR_UNEXCEPTED; + int d_type = TRANSVR_TYPE_ERROR; + int result = ERR_TRANSVR_UNINIT; + int retry = 6; /* (6+1) x 0.3 = 2.1s > spec:2.0s */ + int elimit = 63; + char emsg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Clean and check callback */ + self->state = STATE_TRANSVR_INIT; + if (self->init == NULL) { + snprintf(emsg, elimit, "init() is null"); + goto initer_err_case_unexcept_0; + } + if (self->clean == NULL) { + snprintf(emsg, elimit, "clean() is null"); + goto initer_err_case_unexcept_0; + } + self->clean(self); + + /* Detect transceiver information */ + result = detect_transvr_state(self, detect); + if (result < 0) { + snprintf(emsg, elimit, "detect_transvr_state() fail"); + switch (result) { + case ERR_TRANSVR_I2C_CRASH: + goto initer_err_case_i2c_ceash; + case ERR_TRNASVR_BE_ISOLATED: + goto initer_err_case_be_isolated; + + case ERR_TRANSVR_UNEXCPT: + default: + break; + } + goto initer_err_case_retry_1; + } + d_state = detect[0]; + d_type = detect[1]; + + /* Verify transceiver type and state */ + switch (_is_transvr_valid(self, d_type, d_state)) { + case 0: + break; + case EVENT_TRANSVR_INIT_DOWN: + goto initer_ok_case_down;; + case EVENT_TRANSVR_INIT_FAIL: + snprintf(emsg, elimit, "transceiver type doesn't support"); + goto initer_err_case_alarm_to_user; + case EVENT_TRANSVR_EXCEP_INIT: + default: + goto initer_err_case_unexcept_1; + } + + /* Handle reload case */ + if (self->type != d_type){ + /* This is the protect mechanism. Normally, This case will not happen. + * When State machine detect swap event during initial, It will trigger + * reload function to ensure type correct. */ + if (_reload_transvr_obj(self, d_type) < 0){ + snprintf(emsg, elimit, "reload object fail"); + goto initer_err_case_unexcept_1; + } + } + + /* Check transceiver HW initial ready */ + switch (_is_transvr_hw_ready(self, d_type)) { + case EVENT_TRANSVR_TASK_DONE: + break; + case EVENT_TRANSVR_TASK_WAIT: + goto initer_err_case_retry_1; + case EVENT_TRANSVR_INIT_FAIL: + default: + goto initer_err_case_unexcept_1; + } + + /* Try to update all and check */ + if (self->update_all(self, 1) < 0){ + /* For some transceiver, EEPROME has lag issues during initial stage. + * In this case, we set status back to STATE_TRANSVR_NEW, than it will + * be checked in next polling cycle. */ + goto initer_err_case_retry_1; + } + + /* Execute init() call back */ + result = self->init(self); + switch (result) { + case EVENT_TRANSVR_TASK_DONE: + break; + case EVENT_TRANSVR_TASK_WAIT: + goto initer_ok_case_wait; + + default: + snprintf(emsg, elimit, "undefined init() return:%d\n", result); + goto initer_err_case_unexcept_1; + } + goto initer_ok_case_up; + + +initer_ok_case_wait: + self->dump_all(self); + return EVENT_TRANSVR_TASK_WAIT; + +initer_ok_case_up: + self->state = STATE_TRANSVR_CONNECTED; + self->temp = 0; + self->dump_all(self); + return EVENT_TRANSVR_INIT_UP; + +initer_ok_case_down: + self->temp = 0; + self->state = STATE_TRANSVR_DISCONNECTED; + return EVENT_TRANSVR_INIT_DOWN; + +initer_err_case_i2c_ceash: + SWPS_DEBUG("%s: %s :%s :I2C crash\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + return EVENT_TRANSVR_I2C_CRASH; + +initer_err_case_be_isolated: + SWPS_DEBUG("%s: %s :%s :isolated\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_ISOLATED; + return EVENT_TRANSVR_EXCEP_ISOLATED; + +initer_err_case_retry_1: + SWPS_DEBUG("%s: %s :%s :retry\n", + __func__, emsg, self->swp_name); + if (_transvr_handle_retry(self, retry) == 0) { + self->state = STATE_TRANSVR_NEW; + return EVENT_TRANSVR_INIT_REINIT; + } + goto initer_err_case_alarm_to_user; + +initer_err_case_unexcept_1: + self->clean(self); +initer_err_case_unexcept_0: + self->state = STATE_TRANSVR_UNEXCEPTED; + if (_is_except_happened_4_pmode(self, d_state) && + (self->mode == TRANSVR_MODE_POLLING) ){ + SWPS_INFO("%s: %s :%s\n", __func__, emsg, self->swp_name); + SWPS_INFO("Dump: :%d :%d :%d :%d\n", + self->state, self->type, d_state, d_type); + } + return EVENT_TRANSVR_INIT_FAIL; + +initer_err_case_alarm_to_user: + SWPS_DEBUG("%s: %s :%s :alarm_to_user\n", + __func__, emsg, self->swp_name); + self->state = STATE_TRANSVR_UNEXCEPTED; + alarm_msg_2_user(self, "detected transceiver/cables not meet SFF standard"); + return EVENT_TRANSVR_INIT_FAIL; +} + + +/* ========== Object functions for Clean procedure ========== + */ +int +_transvr_clean_handler(struct transvr_obj_s *self){ + + int retval = DEBUG_TRANSVR_INT_VAL; + + if (!self->clean) { + SWPS_ERR("%s: %s clean() is NULL.\n", + __func__, self->swp_name); + return EVENT_TRANSVR_TASK_FAIL; + } + retval = self->clean(self); + if (retval != EVENT_TRANSVR_TASK_DONE){ + SWPS_ERR("%s: %s clean() fail. [ERR]:%d\n", + __func__, self->swp_name, retval); + return retval; + } + return EVENT_TRANSVR_TASK_DONE; +} + + +int +common_transvr_clean(struct transvr_obj_s *self){ + + transvr_task_free_all(self); + transvr_cache_free_all(self); + return EVENT_TRANSVR_TASK_DONE; +} + + +int +qsfp_transvr_clean(struct transvr_obj_s *self){ + + int retval; + int lpower_config = 1; + + retval = _taskfunc_qsfp_setup_power_mod(self, lpower_config); + if (retval < 0){ + SWPS_ERR("%s: Set lpmod fail! :%d\n", + __func__, retval); + return retval; + } + retval = common_transvr_clean(self); + if (retval < 0){ + SWPS_ERR("%s: common_transvr_clean fail! :%d\n", + __func__, retval); + return retval; + } + return EVENT_TRANSVR_TASK_DONE; +} + + +int +fake_transvr_clean(struct transvr_obj_s *self){ + + return EVENT_TRANSVR_TASK_DONE; +} + + +/* ========== Object functions for check and update ========== + */ +int +common_transvr_check(struct transvr_obj_s *self){ + + char fun_str[32] = "common_transvr_check"; + + if (self->mode != TRANSVR_MODE_POLLING) { + SWPS_ERR("%s: mode:%d is not TRANSVR_MODE_POLLING\n", + fun_str, self->mode); + return ERR_TRANSVR_UNEXCPT; + } + /* Trigger delay task */ + transvr_task_run_all(self); + /* Trigger state machine to check and update */ + return self->fsm_4_polling(self, fun_str); +} + + +int +fake_transvr_check(struct transvr_obj_s *self){ + return 0; +} + + +/* ========== Functions for Factory pattern ========== + */ +static int +setup_transvr_public_cb(struct transvr_obj_s *self, + int transvr_type){ + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + self->get_id = common_get_id; + self->get_ext_id = common_get_ext_id; + self->get_connector = common_get_connector; + self->get_vendor_name = common_get_vendor_name; + self->get_vendor_pn = common_get_vendor_pn; + self->get_vendor_rev = common_get_vendor_rev; + self->get_vendor_sn = common_get_vendor_sn; + self->get_power_cls = unsupported_get_func; + self->get_br = common_get_br; + self->get_len_sm = sfp_get_len_sm; + self->get_len_smf = common_get_len_smf; + self->get_len_om1 = common_get_len_om1; + self->get_len_om2 = common_get_len_om2; + self->get_len_om3 = common_get_len_om3; + self->get_len_om4 = common_get_len_om4; + self->get_comp_rev = common_get_comp_rev; + self->get_comp_eth_1 = sfp_get_comp_eth_1; + self->get_comp_eth_10 = sfp_get_comp_eth_10; + self->get_comp_eth_10_40 = unsupported_get_func; + self->get_comp_extend = common_get_comp_extended; + self->get_cdr = unsupported_get_func; + self->get_rate_id = sfp_get_rate_id; + self->get_soft_rs0 = sfp_get_soft_rs0; + self->get_soft_rs1 = sfp_get_soft_rs1; + self->get_info = common_get_info; + self->get_if_type = sfp_get_if_type; + self->get_if_speed = sfp_get_if_speed; + self->get_if_lane = common_get_if_lane; + self->get_curr_temp = sfp_get_transvr_temp; + self->get_curr_vol = sfp_get_transvr_voltage; + self->get_soft_rx_los = unsupported_get_func2; + self->get_soft_tx_disable = unsupported_get_func2; + self->get_soft_tx_fault = unsupported_get_func2; + self->get_auto_tx_disable = unsupported_get_func2; + self->get_tx_bias = sfp_get_transvr_tx_bias; + self->get_tx_power = sfp_get_transvr_tx_power; + self->get_rx_power = sfp_get_transvr_rx_power; + self->get_tx_eq = sfp_get_transvr_tx_eq; + self->get_rx_am = unsupported_get_func2; + self->get_rx_em = sfp_get_transvr_rx_em; + self->get_wavelength = sfp_get_wavelength; + self->get_extphy_offset = sfp_get_1g_rj45_extphy_offset; + self->get_extphy_reg = sfp_get_1g_rj45_extphy_reg; + self->set_cdr = unsupported_set_func; + self->set_soft_rs0 = sfp_set_soft_rs0; + self->set_soft_rs1 = sfp_set_soft_rs1; + self->set_soft_tx_disable = unsupported_set_func; + self->set_auto_tx_disable = unsupported_set_func; + self->set_tx_eq = sfp_set_tx_eq; + self->set_rx_am = unsupported_set_func; + self->set_rx_em = sfp_set_rx_em; + self->set_extphy_offset = sfp_set_1g_rj45_extphy_offset; + self->set_extphy_reg = sfp_set_1g_rj45_extphy_reg; + return 0; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + self->get_id = common_get_id; + self->get_ext_id = common_get_ext_id; + self->get_connector = common_get_connector; + self->get_vendor_name = common_get_vendor_name; + self->get_vendor_pn = common_get_vendor_pn; + self->get_vendor_rev = common_get_vendor_rev; + self->get_vendor_sn = common_get_vendor_sn; + self->get_power_cls = qsfp_get_power_cls; + self->get_br = common_get_br; + self->get_len_sm = unsupported_get_func; + self->get_len_smf = common_get_len_smf; + self->get_len_om1 = common_get_len_om1; + self->get_len_om2 = common_get_len_om2; + self->get_len_om3 = common_get_len_om3; + self->get_len_om4 = common_get_len_om4; + self->get_comp_rev = common_get_comp_rev; + self->get_comp_eth_1 = qsfp_get_comp_eth; + self->get_comp_eth_10 = unsupported_get_func; + self->get_comp_eth_10_40 = qsfp_get_comp_10_40; + self->get_comp_extend = common_get_comp_extended; + self->get_cdr = unsupported_get_func; + self->get_rate_id = unsupported_get_func; + self->get_soft_rs0 = unsupported_get_func; /* TBD */ + self->get_soft_rs1 = unsupported_get_func; /* TBD */ + self->get_info = common_get_info; + self->get_if_type = qsfp_get_if_type; + self->get_if_speed = qsfp_get_if_speed; + self->get_if_lane = common_get_if_lane; + self->get_curr_temp = qsfp_get_transvr_temp; + self->get_curr_vol = qsfp_get_transvr_voltage; + self->get_soft_rx_los = qsfp_get_soft_rx_los; + self->get_soft_tx_disable = qsfp_get_soft_tx_disable; + self->get_soft_tx_fault = qsfp_get_soft_tx_fault; + self->get_auto_tx_disable = qsfp_get_auto_tx_disable; + self->get_tx_bias = qsfp_get_transvr_tx_bias; + self->get_tx_power = qsfp_get_transvr_tx_power; + self->get_rx_power = qsfp_get_transvr_rx_power; + self->get_tx_eq = unsupported_get_func2; + self->get_rx_am = unsupported_get_func2; + self->get_rx_em = unsupported_get_func2; + self->get_wavelength = qsfp_get_wavelength; + self->get_extphy_offset = unsupported_get_func2; + self->get_extphy_reg = unsupported_get_func2; + self->set_cdr = unsupported_set_func; + self->set_soft_rs0 = unsupported_set_func; /* TBD */ + self->set_soft_rs1 = unsupported_set_func; /* TBD */ + self->set_soft_tx_disable = qsfp_set_soft_tx_disable; + self->set_auto_tx_disable = qsfp_set_auto_tx_disable; + self->set_tx_eq = unsupported_set_func; + self->set_rx_am = unsupported_set_func; + self->set_rx_em = unsupported_set_func; + self->set_extphy_offset = unsupported_set_func; + self->set_extphy_reg = unsupported_set_func; + return 0; + + case TRANSVR_TYPE_QSFP_28: + self->get_id = common_get_id; + self->get_ext_id = common_get_ext_id; + self->get_connector = common_get_connector; + self->get_vendor_name = common_get_vendor_name; + self->get_vendor_pn = common_get_vendor_pn; + self->get_vendor_rev = common_get_vendor_rev; + self->get_vendor_sn = common_get_vendor_sn; + self->get_power_cls = qsfp_get_power_cls; + self->get_br = common_get_br; + self->get_len_sm = unsupported_get_func; + self->get_len_smf = common_get_len_smf; + self->get_len_om1 = common_get_len_om1; + self->get_len_om2 = common_get_len_om2; + self->get_len_om3 = common_get_len_om3; + self->get_len_om4 = common_get_len_om4; + self->get_comp_rev = common_get_comp_rev; + self->get_comp_eth_1 = qsfp_get_comp_eth; + self->get_comp_eth_10 = unsupported_get_func; + self->get_comp_eth_10_40 = qsfp_get_comp_10_40; + self->get_comp_extend = common_get_comp_extended; + self->get_cdr = qsfp_get_cdr; + self->get_rate_id = unsupported_get_func; + self->get_soft_rs0 = unsupported_get_func; /* TBD */ + self->get_soft_rs1 = unsupported_get_func; /* TBD */ + self->get_info = common_get_info; + self->get_if_type = qsfp_get_if_type; + self->get_if_speed = qsfp_get_if_speed; + self->get_if_lane = common_get_if_lane; + self->get_curr_temp = qsfp_get_transvr_temp; + self->get_curr_vol = qsfp_get_transvr_voltage; + self->get_soft_rx_los = qsfp_get_soft_rx_los; + self->get_soft_tx_disable = qsfp_get_soft_tx_disable; + self->get_soft_tx_fault = qsfp_get_soft_tx_fault; + self->get_auto_tx_disable = qsfp_get_auto_tx_disable; + self->get_tx_bias = qsfp_get_transvr_tx_bias; + self->get_tx_power = qsfp_get_transvr_tx_power; + self->get_rx_power = qsfp_get_transvr_rx_power; + self->get_tx_eq = qsfp_get_transvr_tx_eq; + self->get_rx_am = qsfp_get_transvr_rx_am; + self->get_rx_em = qsfp_get_transvr_rx_em; + self->get_wavelength = qsfp_get_wavelength; + self->get_extphy_offset = unsupported_get_func2; + self->get_extphy_reg = unsupported_get_func2; + self->set_cdr = qsfp_set_cdr; + self->set_soft_rs0 = unsupported_set_func; /* TBD */ + self->set_soft_rs1 = unsupported_set_func; /* TBD */ + self->set_soft_tx_disable = qsfp_set_soft_tx_disable; + self->set_auto_tx_disable = qsfp_set_auto_tx_disable; + self->set_tx_eq = qsfp_set_tx_eq; + self->set_rx_am = qsfp_set_rx_am; + self->set_rx_em = qsfp_set_rx_em; + self->set_extphy_offset = unsupported_set_func; + self->set_extphy_reg = unsupported_set_func; + return 0; + + case TRANSVR_TYPE_FAKE: + self->get_id = fake_get_hex; + self->get_ext_id = fake_get_hex; + self->get_connector = fake_get_hex; + self->get_vendor_name = fake_get_str; + self->get_vendor_pn = fake_get_str; + self->get_vendor_rev = fake_get_str; + self->get_vendor_sn = fake_get_str; + self->get_power_cls = fake_get_int; + self->get_br = fake_get_hex; + self->get_len_sm = fake_get_int; + self->get_len_smf = fake_get_int; + self->get_len_om1 = fake_get_int; + self->get_len_om2 = fake_get_int; + self->get_len_om3 = fake_get_int; + self->get_len_om4 = fake_get_int; + self->get_comp_rev = fake_get_hex; + self->get_comp_eth_1 = fake_get_hex; + self->get_comp_eth_10 = fake_get_hex; + self->get_comp_eth_10_40 = fake_get_hex; + self->get_comp_extend = fake_get_hex; + self->get_cdr = fake_get_hex; + self->get_rate_id = fake_get_hex; + self->get_soft_rs0 = fake_get_binary; + self->get_soft_rs1 = fake_get_binary; + self->get_info = fake_get_int; + self->get_if_type = fake_get_str; + self->get_if_speed = fake_get_str; + self->get_if_lane = fake_get_str; + self->get_curr_temp = fake_get_str; + self->get_curr_vol = fake_get_str; + self->get_soft_rx_los = fake_get_str; + self->get_soft_tx_disable = fake_get_str; + self->get_soft_tx_fault = fake_get_str; + self->get_auto_tx_disable = fake_get_str; + self->get_tx_bias = fake_get_str; + self->get_tx_power = fake_get_str; + self->get_rx_power = fake_get_str; + self->get_tx_eq = fake_get_str; + self->get_rx_am = fake_get_str; + self->get_rx_em = fake_get_str; + self->get_wavelength = fake_get_str; + self->get_extphy_offset = fake_get_str; + self->get_extphy_reg = fake_get_str; + self->set_cdr = fake_set_hex; + self->set_soft_rs0 = fake_set_int; + self->set_soft_rs1 = fake_set_int; + self->set_soft_tx_disable = fake_set_int; + self->set_auto_tx_disable = fake_set_int; + self->set_tx_eq = fake_set_int; + self->set_rx_am = fake_set_int; + self->set_rx_em = fake_set_int; + self->set_extphy_offset = fake_set_hex; + self->set_extphy_reg = fake_set_hex; + return 0; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return ERR_TRANSVR_UNEXCPT; +} + + +static int +setup_transvr_private_cb(struct transvr_obj_s *self, + int transvr_type){ + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + self->init = transvr_init_sfp; + self->clean = common_transvr_clean; + self->check = common_transvr_check; + self->update_all = _sfp_update_attr_all; + self->fsm_4_direct = common_fsm_4_direct_mode; + self->fsm_4_polling = common_fsm_4_polling_mode; + self->send_uevent = sfp_send_uevent; + self->dump_all = sfp_transvr_dump; + return 0; + + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + self->init = transvr_init_qsfp; + self->clean = qsfp_transvr_clean; + self->check = common_transvr_check; + self->update_all = _qsfp_update_attr_all; + self->fsm_4_direct = common_fsm_4_direct_mode; + self->fsm_4_polling = common_fsm_4_polling_mode; + self->send_uevent = qsfp_send_uevent; + self->dump_all = qsfp_transvr_dump; + return 0; + + case TRANSVR_TYPE_QSFP_28: + self->init = transvr_init_qsfp28; + self->clean = qsfp_transvr_clean; + self->check = common_transvr_check; + self->update_all = _qsfp_update_attr_all; + self->fsm_4_direct = common_fsm_4_direct_mode; + self->fsm_4_polling = common_fsm_4_polling_mode; + self->send_uevent = qsfp_send_uevent; + self->dump_all = qsfp_transvr_dump; + return 0; + + case TRANSVR_TYPE_FAKE: + self->init = transvr_init_fake; + self->clean = fake_transvr_clean; + self->check = fake_transvr_check; + self->update_all = fake_transvr_update; + self->fsm_4_direct = fake_fsm_4_direct_mode; + self->fsm_4_polling = fake_fsm_4_polling_mode; + self->send_uevent = fake_send_uevent; + self->dump_all = fake_transvr_dump; + return 0; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return ERR_TRANSVR_UNEXCPT; +} + + +static struct eeprom_map_s * +get_eeprom_map(int transvr_type){ + + switch (transvr_type){ + case TRANSVR_TYPE_SFP: + return &eeprom_map_sfp; + case TRANSVR_TYPE_QSFP: + case TRANSVR_TYPE_QSFP_PLUS: + return &eeprom_map_qsfp; + case TRANSVR_TYPE_QSFP_28: + return &eeprom_map_qsfp28; + + default: + break; + } + SWPS_WARN("%s: Detect non-defined type:%d\n", __func__, transvr_type); + return NULL; +} + + +static int +setup_transvr_ssize_attr(char *swp_name, + struct transvr_obj_s *self, + struct eeprom_map_s *map_p, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int chan_id, + int run_mode){ + switch (run_mode){ + case TRANSVR_MODE_DIRECT: /* Direct access device mode */ + case TRANSVR_MODE_POLLING: /* Polling mode, read from cache */ + self->mode = run_mode; + break; + default: + SWPS_ERR("%s: non-defined run_mode:%d\n", + __func__, run_mode); + self->mode = DEBUG_TRANSVR_INT_VAL; + return -1; + } + self->eeprom_map_p = map_p; + self->ioexp_obj_p = ioexp_obj_p; + self->ioexp_virt_offset = ioexp_virt_offset; + self->chan_id = chan_id; + self->layout = transvr_type; + self->type = transvr_type; + self->chipset_type = chipset_type; + self->state = STATE_TRANSVR_NEW; + self->info = STATE_TRANSVR_NEW; + self->auto_tx_disable = VAL_TRANSVR_FUNCTION_DISABLE; + strncpy(self->swp_name, swp_name, 32); + mutex_init(&self->lock); + return 0; +} + + +static int +setup_transvr_dsize_attr(struct transvr_obj_s *self){ + + char *emsg = DEBUG_TRANSVR_STR_VAL; + + self->vendor_name = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_name){ + emsg = "vendor_name"; + goto err_setup_d_attr; + } + self->vendor_pn = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_pn){ + emsg = "vendor_pn"; + goto err_setup_d_attr; + } + self->vendor_rev = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_rev){ + emsg = "vendor_rev"; + goto err_setup_d_attr; + } + self->vendor_sn = kzalloc((LEN_TRANSVR_M_STR * sizeof(char)), GFP_KERNEL); + if (!self->vendor_sn){ + emsg = "vendor_sn"; + goto err_setup_d_attr; + } + self->worker_p = NULL; + return 0; + +err_setup_d_attr: + SWPS_ERR("%s: %s kzalloc fail!", __func__, emsg); + return ERR_TRANSVR_UNEXCPT; +} + + +static int +setup_i2c_client(struct transvr_obj_s *self){ + + struct i2c_adapter *adap = NULL; + struct i2c_client *client = NULL; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + adap = i2c_get_adapter(self->chan_id); + if(!adap){ + snprintf(err_msg, sizeof(err_msg), + "can not get adap:%d", self->chan_id); + goto err_setup_i2c_client; + } + client = kzalloc(sizeof(*client), GFP_KERNEL); + if (!client){ + snprintf(err_msg, sizeof(err_msg), + "can not kzalloc client:%d", self->chan_id); + goto err_setup_i2c_client; + } + client->adapter = adap; + self->i2c_client_p = client; + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + return 0; + +err_setup_i2c_client: + SWPS_ERR("%s: %s\n", __func__, err_msg); + return ERR_TRANSVR_UNEXCPT; +} + + +struct transvr_obj_s * +create_transvr_obj(char *swp_name, + int chan_id, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int run_mode){ + + struct transvr_obj_s *result_p; + struct eeprom_map_s *map_p; + char err_msg[64] = DEBUG_TRANSVR_STR_VAL; + + /* Allocate transceiver object */ + map_p = get_eeprom_map(transvr_type); + if (!map_p){ + snprintf(err_msg, sizeof(err_msg), + "Invalid transvr_type:%d", transvr_type); + goto err_create_transvr_fail; + } + result_p = kzalloc(sizeof(*result_p), GFP_KERNEL); + if (!result_p){ + snprintf(err_msg, sizeof(err_msg), "kzalloc fail"); + goto err_create_transvr_fail; + } + /* Prepare static size attributes */ + if (setup_transvr_ssize_attr(swp_name, + result_p, + map_p, + ioexp_obj_p, + ioexp_virt_offset, + transvr_type, + chipset_type, + chan_id, + run_mode) < 0){ + goto err_create_transvr_sattr_fail; + } + /* Prepare dynamic size attributes */ + if (setup_transvr_dsize_attr(result_p) < 0){ + goto err_create_transvr_dattr_fail; + } + /* Prepare call back functions of object */ + if (setup_transvr_public_cb(result_p, transvr_type) < 0){ + goto err_create_transvr_dattr_fail; + } + /* Prepare call back functions of object */ + if (setup_transvr_private_cb(result_p, transvr_type) < 0){ + goto err_create_transvr_dattr_fail; + } + /* Prepare i2c client object */ + if (setup_i2c_client(result_p) < 0){ + goto err_create_transvr_dattr_fail; + } + return result_p; + +err_create_transvr_dattr_fail: + kfree(result_p->vendor_sn); + kfree(result_p->vendor_rev); + kfree(result_p->vendor_pn); + kfree(result_p->vendor_name); +err_create_transvr_sattr_fail: + kfree(result_p); +err_create_transvr_fail: + SWPS_ERR("%s: %s :%d :%d :%d\n", + __func__, err_msg, chan_id, ioexp_virt_offset, transvr_type); + return NULL; +} + + +static int +_reload_transvr_obj(struct transvr_obj_s *self, + int new_type){ + + struct eeprom_map_s *new_map_p; + struct eeprom_map_s *old_map_p = self->eeprom_map_p; + struct i2c_client *old_i2c_p = self->i2c_client_p; + int old_type = self->type; + + /* Change state to STATE_TRANSVR_INIT */ + self->state = STATE_TRANSVR_INIT; + self->type = new_type; + /* Replace EEPROME map */ + new_map_p = get_eeprom_map(new_type); + if (!new_map_p){ + goto err_private_reload_func_1; + } + self->eeprom_map_p = new_map_p; + /* Reload i2c client */ + if (setup_i2c_client(self) < 0){ + goto err_private_reload_func_2; + } + /* Replace call back functions */ + if (setup_transvr_public_cb(self, new_type) < 0){ + goto err_private_reload_func_3; + } + if (setup_transvr_private_cb(self, new_type) < 0){ + goto err_private_reload_func_3; + } + kfree(old_i2c_p); + return 0; + +err_private_reload_func_3: + SWPS_INFO("%s: init() fail!\n", __func__); + kfree(old_i2c_p); + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = TRANSVR_TYPE_ERROR; + return -2; + +err_private_reload_func_2: + self->eeprom_map_p = old_map_p; + self->i2c_client_p = old_i2c_p; +err_private_reload_func_1: + self->state = STATE_TRANSVR_UNEXCEPTED; + self->type = old_type; + SWPS_INFO("%s fail! :0x%02x\n", __func__, new_type); + return -1; +} + + +static int +reload_transvr_obj(struct transvr_obj_s *self, + int new_type){ + + int result_val = ERR_TRANSVR_UNEXCPT; + + /* Reload phase */ + result_val = _reload_transvr_obj(self, new_type); + if (result_val < 0){ + SWPS_INFO("%s: reload phase fail! :%d\n", + __func__, result_val); + return EVENT_TRANSVR_RELOAD_FAIL; + } + /* Initial phase */ + result_val = _transvr_init_handler(self); + if (result_val < 0){ + SWPS_INFO("%s: initial phase fail! :%d\n", + __func__, result_val); + } + return result_val; +} + + +int +isolate_transvr_obj(struct transvr_obj_s *self) { + + self->state = STATE_TRANSVR_ISOLATED; + SWPS_INFO("%s: %s be isolated\n", __func__, self->swp_name); + return 0; +} + + +int +resync_channel_tier_2(struct transvr_obj_s *self) { + + int val = TRANSVR_TYPE_ERROR; + + if (self->state == STATE_TRANSVR_ISOLATED) { + return 0; + } + self->i2c_client_p->addr = VAL_TRANSVR_COMID_ARREESS; + val = i2c_smbus_read_byte_data(self->i2c_client_p, + VAL_TRANSVR_COMID_OFFSET); + if (val < 0) { + return -1; + } + return 0; +} + + +/* ----------------------------------------- + * ToDo List + * ----------------------------------------- + * 1. _sfp_detect_class_by_feature() + * => Need check ACC use case. + * 2. _sfp_detect_class_by_1g_ethernet() + * => Need check 0.1G use case. + * 3. Loopback transceiver use case. + * => Less much data + * 4. _qsfp_detect_class_by_extend_comp() + * => Verify 100G CWDM4 + * => Verify Obsolete (assigned before 100G CWDM4 MSA required FEC) + * => Verify 100G CLR4 + * => Verify 100GE-DWDM2 + * => Verify 40G PSM4 Parallel SMF + * => Verify 100G ACC (Active Copper Cable) or 25GAUI C2M ACC. + * => Verify 100G ACC or 25GAUI C2M ACC. + * => Verify 25GBASE-LR + * => Verify 40G Active Cable (XLPPI) + */ + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/transceiver.h b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/transceiver.h new file mode 100644 index 000000000000..f17b7fde71b1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/modules/transceiver.h @@ -0,0 +1,815 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef TRANSCEIVER_H +#define TRANSCEIVER_H + +#include + +/* advanced features control */ +#define TRANSVR_INFO_DUMP_ENABLE (1) +#define TRANSVR_INFO_CACHE_ENABLE (1) +#define TRANSVR_UEVENT_ENABLE (1) + +/* Transceiver type define */ +#define TRANSVR_TYPE_UNKNOW_1 (0x00) +#define TRANSVR_TYPE_UNKNOW_2 (0xff) +#define TRANSVR_TYPE_SFP (0x03) /* Define for SFP, SFP+, SFP28 */ +#define TRANSVR_TYPE_QSFP (0x0c) +#define TRANSVR_TYPE_QSFP_PLUS (0x0d) +#define TRANSVR_TYPE_QSFP_28 (0x11) +#define TRANSVR_TYPE_UNPLUGGED (0xfa) /* Define for ERROR handle */ +#define TRANSVR_TYPE_FAKE (0xfc) /* Define for ERROR handle */ +#define TRANSVR_TYPE_INCONSISTENT (0xfd) /* Define for ERROR handle */ +#define TRANSVR_TYPE_ERROR (0xfe) /* Define for ERROR handle */ + +/* Transceiver class for base info */ +#define TRANSVR_CLASS_UNSPECIFIED (0) +#define TRANSVR_CLASS_ERROR (-26001) +#define TRANSVR_CLASS_1G (26001) +#define TRANSVR_CLASS_10G (26011) +#define TRANSVR_CLASS_25G (26021) +#define TRANSVR_CLASS_40G (26041) +#define TRANSVR_CLASS_100G (26101) +#define TRANSVR_CLASS_NO_SPERARABLE (26901) +#define TRANSVR_CLASS_EXTEND_COMP (26902) +/* Transceiver class for Optical 1G */ +#define TRANSVR_CLASS_OPTICAL (27000) +#define TRANSVR_CLASS_OPTICAL_100 (27001) +#define TRANSVR_CLASS_OPTICAL_1G (27002) +#define TRANSVR_CLASS_OPTICAL_1G_AOC (27003) +#define TRANSVR_CLASS_OPTICAL_1G_SX (27004) +#define TRANSVR_CLASS_OPTICAL_1G_LX (27005) +#define TRANSVR_CLASS_OPTICAL_1G_EX (27006) +/* Transceiver class for Optical 10G */ +#define TRANSVR_CLASS_OPTICAL_10G (27010) +#define TRANSVR_CLASS_OPTICAL_10G_S_AOC (27011) +#define TRANSVR_CLASS_OPTICAL_10G_S_SR (27012) +#define TRANSVR_CLASS_OPTICAL_10G_S_LR (27013) +#define TRANSVR_CLASS_OPTICAL_10G_S_ER (27014) +#define TRANSVR_CLASS_OPTICAL_10G_Q_AOC (27015) +#define TRANSVR_CLASS_OPTICAL_10G_Q_SR (27016) +#define TRANSVR_CLASS_OPTICAL_10G_Q_LR (27017) +#define TRANSVR_CLASS_OPTICAL_10G_Q_ER (27018) +/* Transceiver class for Optical 25G */ +#define TRANSVR_CLASS_OPTICAL_25G (27020) +#define TRANSVR_CLASS_OPTICAL_25G_AOC (27021) +#define TRANSVR_CLASS_OPTICAL_25G_SR (27022) +#define TRANSVR_CLASS_OPTICAL_25G_LR (27023) +#define TRANSVR_CLASS_OPTICAL_25G_ER (27024) +/* Transceiver class for Optical 40G */ +#define TRANSVR_CLASS_OPTICAL_40G (27040) +#define TRANSVR_CLASS_OPTICAL_40G_AOC (27041) +#define TRANSVR_CLASS_OPTICAL_40G_SR4 (27042) +#define TRANSVR_CLASS_OPTICAL_40G_LR4 (27043) +#define TRANSVR_CLASS_OPTICAL_40G_ER4 (27044) +/* Transceiver class for Optical 100G */ +#define TRANSVR_CLASS_OPTICAL_100G (27100) +#define TRANSVR_CLASS_OPTICAL_100G_AOC (27101) +#define TRANSVR_CLASS_OPTICAL_100G_SR4 (27102) +#define TRANSVR_CLASS_OPTICAL_100G_LR4 (27103) +#define TRANSVR_CLASS_OPTICAL_100G_ER4 (27104) +#define TRANSVR_CLASS_OPTICAL_100G_PSM4 (27105) +/* Transceiver class for Copper */ +#define TRANSVR_CLASS_COPPER (28000) +#define TRANSVR_CLASS_COPPER_L1_1G (28001) +#define TRANSVR_CLASS_COPPER_L1_10G (28011) +#define TRANSVR_CLASS_COPPER_L4_10G (28012) +#define TRANSVR_CLASS_COPPER_L1_25G (28021) +#define TRANSVR_CLASS_COPPER_L4_40G (28041) +#define TRANSVR_CLASS_COPPER_L4_100G (28101) +/* Transceiver class for Base-T */ +#define TRANSVR_CLASS_BASE_T_1000 (29001) +#define TRANSVR_CLASS_BASE_T_1000_up (29002) +/* For uevent message */ +#define TRANSVR_UEVENT_KEY_IF "IF_TYPE" +#define TRANSVR_UEVENT_KEY_SP "IF_SPEED" +#define TRANSVR_UEVENT_KEY_LANE "IF_LANE" +#define TRANSVR_UEVENT_UNKNOW "UNKNOW" +#define TRANSVR_IF_KR "KR" +#define TRANSVR_IF_KR4 "KR4" +#define TRANSVR_IF_SR "SR" +#define TRANSVR_IF_SR4 "SR4" +#define TRANSVR_IF_SFI "SFI" +#define TRANSVR_IF_IF_GMII "GMII" +#define TRANSVR_IF_IF_XGMII "XGMII" +#define TRANSVR_IF_SP_100 "100" +#define TRANSVR_IF_SP_1G "1000" +#define TRANSVR_IF_SP_10G "10000" +#define TRANSVR_IF_SP_25G "25000" +#define TRANSVR_IF_SP_40G "40000" +#define TRANSVR_IF_SP_100G "100000" + +/* Transceiver mode define */ +#define TRANSVR_MODE_DIRECT (21000) +#define TRANSVR_MODE_POLLING (21001) + +/* Transceiver state define + * [Note] + * 1. State is used to represent the state of "Transceiver" and "Object". + * 2. State for different target has different means. The description as following: + */ +#define STATE_TRANSVR_CONNECTED (0) /* [Transvr]:Be plugged in. [Obj]:Link up, and work normally. */ +#define STATE_TRANSVR_NEW (-100) /* [Transvr]:(Not used) [Obj]:Create */ +#define STATE_TRANSVR_INIT (-101) /* [Transvr]:Be plugged in. [Obj]:Link up, and in initial process. */ +#define STATE_TRANSVR_ISOLATED (-102) /* [Transvr]:Be plugged in. [Obj]:Isolate, and not provide service. */ +#define STATE_TRANSVR_SWAPPED (-200) /* [Transvr]:Be plugged in. [Obj]:(Not used) */ +#define STATE_TRANSVR_DISCONNECTED (-300) /* [Transvr]:Un-plugged. [Obj]:Link down, and not provide service. */ +#define STATE_TRANSVR_UNEXCEPTED (-901) /* [Transvr]:Any [Obj]:Any, and not in expect case. */ + +/* Task state define */ +#define STATE_T_TASK_WAIT (110) +#define STATE_T_TASK_DONE (0) +#define STATE_T_TASK_INIT (-110) +#define STATE_T_TASK_FAIL (-410) + + +/* Event for task handling */ +#define EVENT_TRANSVR_TASK_WAIT (2101) +#define EVENT_TRANSVR_TASK_DONE (0) +#define EVENT_TRANSVR_TASK_FAIL (-2101) +/* Event for initial handling */ +#define EVENT_TRANSVR_INIT_UP (2201) +#define EVENT_TRANSVR_INIT_DOWN (1) +#define EVENT_TRANSVR_INIT_REINIT (-2201) +#define EVENT_TRANSVR_INIT_FAIL (-2202) +/* Event for others */ +#define EVENT_TRANSVR_RELOAD_FAIL (-2301) +#define EVENT_TRANSVR_EXCEP_INIT (-2401) +#define EVENT_TRANSVR_EXCEP_UP (-2402) +#define EVENT_TRANSVR_EXCEP_DOWN (-2403) +#define EVENT_TRANSVR_EXCEP_SWAP (-2404) +#define EVENT_TRANSVR_EXCEP_EXCEP (-2405) +#define EVENT_TRANSVR_EXCEP_ISOLATED (-2406) +#define EVENT_TRANSVR_I2C_CRASH (-2501) + +/* Transceiver error code define */ +#define ERR_TRANSVR_UNINIT (-201) +#define ERR_TRANSVR_UNPLUGGED (-202) +#define ERR_TRANSVR_ABNORMAL (-203) +#define ERR_TRANSVR_NOSTATE (-204) +#define ERR_TRANSVR_NOTSUPPORT (-205) +#define ERR_TRANSVR_BADINPUT (-206) +#define ERR_TRANSVR_UPDATE_FAIL (-207) +#define ERR_TRANSVR_RELOAD_FAIL (-208) +#define ERR_TRANSVR_INIT_FAIL (-209) +#define ERR_TRANSVR_UNDEFINED (-210) +#define ERR_TRANSVR_TASK_FAIL (-211) +#define ERR_TRANSVR_TASK_BUSY (-212) +#define ERR_TRANSVR_UEVENT_FAIL (-213) +#define ERR_TRANSVR_FUNC_DISABLE (-214) +#define ERR_TRANSVR_I2C_CRASH (-297) +#define ERR_TRNASVR_BE_ISOLATED (-298) +#define ERR_TRANSVR_UNEXCPT (-299) + +/* For debug */ +#define DEBUG_TRANSVR_INT_VAL (-99) +#define DEBUG_TRANSVR_HEX_VAL (0xfe) +#define DEBUG_TRANSVR_STR_VAL "ERROR" + +/* For system internal */ +#define VAL_TRANSVR_COMID_ARREESS (0x50) +#define VAL_TRANSVR_COMID_OFFSET (0x00) +#define VAL_TRANSVR_EXTPHY_ADDR_56 (0x56) +#define VAL_TRANSVR_8472_READY_ADDR (0x51) +#define VAL_TRANSVR_8472_READY_PAGE (-1) +#define VAL_TRANSVR_8472_READY_OFFSET (110) +#define VAL_TRANSVR_8472_READY_BIT (0) +#define VAL_TRANSVR_8472_READY_VALUE (0) +#define VAL_TRANSVR_8472_READY_ABNORMAL (0xff) +#define VAL_TRANSVR_8436_READY_ADDR (0x50) +#define VAL_TRANSVR_8436_READY_PAGE (-1) +#define VAL_TRANSVR_8436_READY_OFFSET (2) +#define VAL_TRANSVR_8436_READY_BIT (0) +#define VAL_TRANSVR_8436_READY_VALUE (0) +#define VAL_TRANSVR_8436_READY_ABNORMAL (0xff) +#define VAL_TRANSVR_8436_PWD_ADDR (0x50) +#define VAL_TRANSVR_8436_PWD_PAGE (-1) +#define VAL_TRANSVR_8436_PWD_OFFSET (123) +#define VAL_TRANSVR_PAGE_FREE (-99) +#define VAL_TRANSVR_PAGE_SELECT_OFFSET (127) +#define VAL_TRANSVR_PAGE_SELECT_DELAY (5) +#define VAL_TRANSVR_TASK_RETRY_FOREVER (-999) +#define VAL_TRANSVR_FUNCTION_DISABLE (-1) +#define STR_TRANSVR_SFP "SFP" +#define STR_TRANSVR_QSFP "QSFP" +#define STR_TRANSVR_QSFP_PLUS "QSFP+" +#define STR_TRANSVR_QSFP28 "QSFP28" + +/* For transvr buf len */ +#define LEN_TRANSVR_S_STR (16) +#define LEN_TRANSVR_M_STR (32) +#define LEN_TRANSVR_L_STR (64) + +/* Optical wavelength */ +#define VAL_OPTICAL_WAVELENGTH_SR (850) +#define VAL_OPTICAL_WAVELENGTH_LR (1310) +#define VAL_OPTICAL_WAVELENGTH_ER (1550) + +/* BCM chip type define */ +#define BCM_CHIP_TYPE_TRIDENT_2 (31001) /* Magnolia, Hudson32i, Spruce */ +#define BCM_CHIP_TYPE_TOMAHAWK (31002) /* Redwood, Cypress, Sequoia */ +#define BCM_CHIP_TYPE_TRIDENT_3 (31003) /* Maple */ + +#define BF_CHIP_TYPE_TOFINO (31011) /* Lavender */ + +/* Info from transceiver EEPROM */ +struct eeprom_map_s { + int addr_br; int page_br; int offset_br; int length_br; + int addr_cdr; int page_cdr; int offset_cdr; int length_cdr; + int addr_comp_rev; int page_comp_rev; int offset_comp_rev; int length_comp_rev; + int addr_connector; int page_connector; int offset_connector; int length_connector; + int addr_diag_type; int page_diag_type; int offset_diag_type; int length_diag_type; + int addr_extbr; int page_extbr; int offset_extbr; int length_extbr; + int addr_ext_id; int page_ext_id; int offset_ext_id; int length_ext_id; + int addr_id; int page_id; int offset_id; int length_id; + int addr_len_sm; int page_len_sm; int offset_len_sm; int length_len_sm; + int addr_len_smf; int page_len_smf; int offset_len_smf; int length_len_smf; + int addr_len_om1; int page_len_om1; int offset_len_om1; int length_len_om1; + int addr_len_om2; int page_len_om2; int offset_len_om2; int length_len_om2; + int addr_len_om3; int page_len_om3; int offset_len_om3; int length_len_om3; + int addr_len_om4; int page_len_om4; int offset_len_om4; int length_len_om4; + int addr_option; int page_option; int offset_option; int length_option; + int addr_rate_id; int page_rate_id; int offset_rate_id; int length_rate_id; + int addr_rx_am; int page_rx_am; int offset_rx_am; int length_rx_am; + int addr_rx_em; int page_rx_em; int offset_rx_em; int length_rx_em; + int addr_rx_los; int page_rx_los; int offset_rx_los; int length_rx_los; + int addr_rx_power; int page_rx_power; int offset_rx_power; int length_rx_power; + int addr_soft_rs0; int page_soft_rs0; int offset_soft_rs0; int length_soft_rs0; + int addr_soft_rs1; int page_soft_rs1; int offset_soft_rs1; int length_soft_rs1; + int addr_temp; int page_temp; int offset_temp; int length_temp; + int addr_trancomp; int page_trancomp; int offset_trancomp; int length_trancomp; + int addr_trancomp_ext; int page_trancomp_ext; int offset_trancomp_ext; int length_trancomp_ext; + int addr_tx_bias; int page_tx_bias; int offset_tx_bias; int length_tx_bias; + int addr_tx_disable; int page_tx_disable; int offset_tx_disable; int length_tx_disable; + int addr_tx_eq; int page_tx_eq; int offset_tx_eq; int length_tx_eq; + int addr_tx_fault; int page_tx_fault; int offset_tx_fault; int length_tx_fault; + int addr_tx_power; int page_tx_power; int offset_tx_power; int length_tx_power; + int addr_vendor_name; int page_vendor_name; int offset_vendor_name; int length_vendor_name; + int addr_vendor_pn; int page_vendor_pn; int offset_vendor_pn; int length_vendor_pn; + int addr_vendor_rev; int page_vendor_rev; int offset_vendor_rev; int length_vendor_rev; + int addr_vendor_sn; int page_vendor_sn; int offset_vendor_sn; int length_vendor_sn; + int addr_voltage; int page_voltage; int offset_voltage; int length_voltage; + int addr_wavelength; int page_wavelength; int offset_wavelength; int length_wavelength; +}; + + +struct transvr_worker_s; + +/* Class of transceiver object */ +struct transvr_obj_s { + + /* ========== Object private property ========== + * [Prop]: id + * [Desc]: Type of serial transceiver. + * [Note]: SFP:03h / QSFP:0Ch / QSPF+:0Dh /QSFP28:11h + */ + uint8_t id; + + /* [Prop]: connector + * [Desc]: Connector type. + * [Note]: SFP : A0h / 2 + * QSFP: 00h / 130 + */ + uint8_t connector; + + /* [Prop]: transvr_comp + * [Desc]: Transceiver compliance code. + * [Note]: SFP: SFF-8472 + * - Normal : A0h / offset 3-10 + * - Extended: A0h / offset 36 + * QSFP: SFF-8436 & SFF-8636 + * - Normal : 00h / offset 131-138 + * - Extended: 00h / offset 192 + */ + uint8_t transvr_comp[8]; + uint8_t transvr_comp_ext; + + /* [Prop]: vendor_name + * [Desc]: SFP vendor name (ASCII 16 byte char). + * [Note]: ex:FINISAR CORP. + */ + char *vendor_name; + + /* [Prop]: vendor_pn + * [Desc]: Part number provided by SFP vendor (ASCII 16 byte char). + * [Note]: + */ + char *vendor_pn; + + /* [Prop]: vendor_rev + * [Desc]: Revision level for part number provided by vendor (ASCII 4 byte char). + * [Note]: + */ + char *vendor_rev; + + /* [Prop]: vendor_sn + * [Desc]: Serial number provided by vendor (ASCII 16 byte char). + * [Note]: + */ + char *vendor_sn; + + /* [Prop]: Extended identifier + * [Desc]: SFP: + * => None + * + * QSFP: + * => This byte contained two information: + * (1) Power consumption class + * (2) CDR function present + * [Note]: Bit description as below: + * [SFP] + * None + * + * [QSFP] + * (1) Power consumption class: + * Class 1: 1.5W (Bit6-7 = 00:) + * Class 2: 2.0W (Bit6-7 = 01:) + * Class 3: 2.5W (Bit6-7 = 10:) + * Class 4: 3.5W (Bit6-7 = 11:) + * Class 5: 4.0W (Bit0-1 = 01:) + * Class 6: 4.5W (Bit0-1 = 10:) + * Class 7: 5.0W (Bit0-1 = 11:) + * (2) CDR function present: + * Bit2: 0 = No CDR in RX + * 1 = CDR present in RX + * Bit3: 0 = No CDR in TX + * 1 = CDR present in TX + */ + uint8_t ext_id; + + /* [Prop]: br + * [Desc]: Nominal bit rate, units of 100 MBits/sec. + * [Note]: SFP:03h / QSFP:0Ch / QSPF+:0Dh + * has val: 0x67 + * no val : + */ + uint8_t br; + + /* [Prop]: extbr + * [Desc]: Extended br (00h/222) + * [Desc]: Nominal bit rate per channel, units of 250 Mbps. + * Complements. Byte 140. See Table 32A. + */ + uint8_t extbr; + + /* [Prop]: len_sm + * [Desc]: Length (single mode)-(100's)m + * [Note]: This value specifies the link length that is supported by the transceiver + * while operating in compliance with the applicable standards using single mode + * fiber. The value is in units of 100 meters. A value of 255 means that the + * transceiver supports a link length greater than 25.4 km. A value of zero means + * that the transceiver does not support single mode fiber or that the length + * information must be determined from the transceiver technology. + */ + int len_sm; + + /* [Prop]: len_smf + * [Desc]: Length (single mode)-km + * [Note]: Addition to EEPROM data from original GBIC definition. This value specifies + * the link length that is supported by the transceiver while operating in + * compliance with the applicable standards using single mode fiber. The value + * is in units of kilometers. A value of 255 means that the transceiver supports + * a link length greater than 254 km. A value of zero means that the transceiver + * does not support single mode fiber or that the length information must be + * determined from the transceiver technology. + */ + int len_smf; + + /* [Prop]: len_om1 + * [Desc]: Link length supported for 62.5 um OM1 fiber, units of 10 m + * [Note]: The value is in units of 10 meters. A value of 255 means that the + * transceiver supports a link length greater than 2.54 km. A value of + * zero means that the transceiver does not support 50 micron multi-mode + * fiber or that the length information must be determined from the transceiver + * technology. + */ + int len_om1; + + /* [Prop]: len_om2 + * [Desc]: Link length supported for 50 um OM2 fiber, units of 10 m + * [Note]: The value is in units of 10 meters. A value of 255 means that the + * transceiver supports a link length greater than 2.54 km. A value of + * zero means that the transceiver does not support 50 micron multi-mode + * fiber or that the length information must be determined from the transceiver + * technology. + */ + int len_om2; + + /* [Prop]: len_om3 + * [Desc]: Length (50um, OM3) + * [Note]: This value specifies link length that is supported by the transceiver while + * operating in compliance with applicable standards using 50 micron multimode + * OM3 [2000 MHz*km] fiber. The value is in units of 10 meters. A value of 255 + * means that the transceiver supports a link length greater than 2.54 km. A value + * of zero means that the transceiver does not support 50 micron multimode fiber + * or that the length information must be determined from the transceiver technology. + */ + int len_om3; + + /* [Prop]: len_om4 + * [Desc]: Length (50um, OM4) and Length (Active Cable or Copper) + * [Note]: For optical links, this value specifies link length that is supported by the + * transceiver while operating in compliance with applicable standards using 50 micron + * multimode OM4 [4700 MHz*km] fiber. The value is in units of 10 meters. A value of + * 255 means that the transceiver supports a link length greater than 2.54 km. A value + * of zero means that the transceiver does not support 50 micron multimode fiber or that + * the length information must be determined from the transceiver codes specified in Table 5-3. + * + * For copper links, this value specifies minimum link length supported by the transceiver + * while operating in compliance with applicable standards using copper cable. For active + * cable, this value represents actual length. The value is in units of 1 meter. A value of 255 + * means the transceiver supports a link length greater than 254 meters. A value of zero means + * the transceiver does not support copper or active cables or the length information must be + * determined from transceiver technology. Further information about cable design, equalization, + * and connectors is usually required to guarantee meeting a particular length requirement. + */ + int len_om4; + + /* [Prop]: comp_rev + * [Desc]: SFF spec revision compliance + * [Note]: Indicates which revision of SFF SFF-8472 (SFP) / SFF-8636 (QSFP) the transceiver + * complies with. (unsigned integer) + */ + uint8_t comp_rev; + + /* [Prop]: CDR + * [Desc]: For transceivers with CDR capability, setting the CDR to ON engages the internal + * retiming function. Setting the CDR to OFF enables an internal bypassing mode ,which + * directs traffic around the internal CDR. (Reference: SFF-8636) + * [Note]: value=0xff: ON. + * value=0x00: OFF. + */ + uint8_t cdr; + + /* [Prop]: rate_id + * [Desc]: Soft Rate Select 0(RX). + * [Note]: 1. Addr: A0h / Offset: 13 + * 2. Value description: + * 00h Unspecified + * 01h SFF-8079 (4/2/1G Rate_Select & AS0/AS1) + * 02h SFF-8431 (8/4/2G Rx Rate_Select only) + * 03h Unspecified * + * 04h SFF-8431 (8/4/2G Tx Rate_Select only) + * 05h Unspecified * + * 06h SFF-8431 (8/4/2G Independent Rx & Tx Rate_select) + * 07h Unspecified * + * 08h FC-PI-5 (16/8/4G Rx Rate_select only) High=16G only, Low=8G/4G + * 09h Unspecified * + * 0Ah FC-PI-5 (16/8/4G Independent Rx, Tx Rate_select) High=16G only, + * Low=8G/4G + * 0Bh Unspecified * + * 0Ch FC-PI-6 (32/16/8G Independent Rx, Tx Rate_Select) + * High=32G only, Low = 16G/8G + * 0Dh Unspecified * + * 0Eh 10/8G Rx and Tx Rate_Select controlling the operation or locking + * modes of the internal signal conditioner, retimer or CDR, according + * to the logic table defined in Table 10-2, High Bit Rate + * (10G) =9.95-11.3 Gb/s; Low Bit Rate (8G) = 8.5 Gb/s. In this mode, + * the default value of bit 110.3 (Soft Rate Select RS(0), Table 9-11) + * and of bit 118.3 (Soft Rate Select RS(1), Table 10-1) is 1. + * 0Fh Unspecified * + * 10h-FFh Unallocated + */ + int rate_id; + + /* [Prop]: soft_rs0 + * [Desc]: Soft Rate Select 0(RX). + * [Note]: 1. Writing '1' selects full bandwidth operation. + * 2. This bit is "OR'd with the hard Rate_Select, AS(0) or RS(0) pin value. + * 3. Default at power up is logic zero/low + * 4. Addr: A2h / Offset: 110 / Bit: 3 + */ + uint8_t soft_rs0; + + /* [Prop]: soft_rs1 + * [Desc]: Soft Rate Select 1(TX). + * [Note]: 1. Writing '1' selects full bandwidth TX operation. + * 2. This bit is "OR'd with the hard Rate_Select, AS(1) or RS(1) pin value. + * 3. Default at power up is logic zero/low + * 4. Addr: A2h / Offset: 118 / Bit: 3 + */ + uint8_t soft_rs1; + + /* [Prop]: diag_type + * [Desc]: DIAGNOSTIC MONITORING TYPE (A0h/92) + * [Note]: Description in SFF-8472 as below: + * Bit7: Reserved for legacy diagnostic implementations. Must be '0' for compliance + * with this document. + * Bit6: Digital diagnostic monitoring implemented (described in this document). + * Must be '1' for compliance with this document. + * Bit5 Internally calibrated + * Bit4 Externally calibrated + * Bit3 Received power measurement type.0 = OMA, 1 = average power + * Bit2 Address change required see section above, "addressing modes" + * Bit1-0 Unallocated + */ + uint8_t diag_type; + + /* [Prop]: curr_temp + * [Desc]: Transceiver Current Temperature (A2h/96-97) + * [Note]: 1. Dependent on diag_type. + * 2. 96: High byte + * 3. 97: Low byte + * 4. This feature only for SFP + */ + uint8_t curr_temp[2]; + + /* [Prop]: curr_vol + * [Desc]: Transceiver Current Voltage (SFP:A2h/108-109; QSFP:00h/22-23) + * [Note]: 1. Dependent on diag_type. + * 2. 98: High byte + * 3. 99: Low byte + * 4. This feature only for SFP + * 5. Internally measured transceiver supply voltage. Represented + * as a 16 bit unsigned integer with the voltage defined as the + * full 16 bit value (0-65535) with LSB equal to 100 uVolt, + * yielding a total range of 0 to +6.55 Volts + */ + uint8_t curr_voltage[2]; + + /* [Prop]: curr_tx_bias + * [Desc]: Transceiver TX Bias Current (SFP:A2h/100-101; QSFP:00h/26-27) + * [Note]: 1. Dependent on diag_type. + * 2. 100: High byte + * 3. 101: Low byte + * 4. This feature only for SFP + * 5. Measured TX bias current in uA. Represented as a 16 bit unsigned + * integer with the current defined as the full 16 bit value (0-65535) + * with LSB equal to 2 uA, yielding a total range of 0 to 131 mA. + * Accuracy is vendor specific but must be better than 10% of the + * manufacturer's nominal value over specified operating temperature + * and voltage. + */ + uint8_t curr_tx_bias[8]; + + /* [Prop]: curr_tx_power + * [Desc]: Transceiver TX Output Power (A2h/102-103) + * [Note]: 1. Dependent on diag_type. + * 2. 102: High byte + * 3. 103: Low byte + * 4. This feature only for SFP + * 5. Measured TX output power in mW. Represented as a 16 bit unsigned + * integer with the power defined as the full 16 bit value (0-65535) + * with LSB equal to 0.1 uW, yielding a total range of 0 to 6.5535 mW + * (~ -40 to +8.2 dBm). Data is assumed to be based on measurement of + * laser monitor photodiode current. It is factory calibrated to absolute + * units using the most representative fiber output type. Accuracy is + * vendor specific but must be better than 3dB over specified temperature + * and voltage. Data is not valid when the transmitter is disabled. + */ + uint8_t curr_tx_power[8]; + + /* [Prop]: curr_tx_power + * [Desc]: Transceiver TX Output Power (A2h/102-103) + * [Note]: 1. Dependent on diag_type. + * 2. 102: High byte + * 3. 103: Low byte + * 4. This feature only for SFP + * 5. Measured RX received optical power in mW. Value can represent either + * average received power or OMA depending upon how bit 3 of byte 92 (A0h) + * is set. Represented as a 16 bit unsigned integer with the power defined + * as the full 16 bit value (0-65535) with LSB equal to 0.1 uW, yielding a + * total range of 0 to 6.5535 mW (~ -40 to +8.2 dBm). Absolute accuracy is + * dependent upon the exact optical wavelength. For the vendor specified + * wavelength, accuracy shall be better than 3dB over specified temperature + * and voltage. + */ + uint8_t curr_rx_power[8]; + + /* [Prop]: wavelength + * [Desc]: Wavelength or Copper Cable Attenuation + * [Note]: (Following is info from SFF-8636) + * For optical free side devices, this parameter identifies the nominal + * transmitter output wavelength at room temperature. This parameter is a + * 16-bit hex value with Byte 186 as high order byte and Byte 187 as low + * order byte. The laser wavelength is equal to the 16-bit integer value + * divided by 20 in nm (units of 0.05 nm). This resolution should be adequate + * to cover all relevant wavelengths yet provide enough resolution for all + * expected DWDM applications. For accurate representation of controlled + * wavelength applications, this value should represent the center of the + * guaranteed wavelength range. If the free side device is identified as + * copper cable these registers will be used to define the cable attenuation. + * An indication of 0 dB attenuation refers to the case where the attenuation + * is not known or is unavailable. + * Byte 186 (00-FFh) is the copper cable attenuation at 2.5 GHz in units of 1 dB. + * Byte 187 (00-FFh) is the copper cable attenuation at 5.0 GHz in units of 1 dB. + */ + uint8_t wavelength[2]; + + /* [Prop]: Amplitude control + * [Desc]: Amplitude control + * [Note]: QSFP28 => SFF-8636 03H Byte-238/239 + */ + uint8_t rx_am[2]; + + /* [Prop]: Emphasis control + * [Desc]: Emphasis control + * [Note]: SFP+/28 => SFF-8472 A2H Byte-115 + * QSFP28 => SFF-8636 03H Byte-236/237 + */ + uint8_t rx_em[2]; + + /* [Prop]: Soft Rx LOS + * [Desc]: Soft Rx LOS which provide by transceiver + * [Note]: (Following is info from SFF-8636) + * Byte 3: + * - Bit 0: L-Rx1 LOS + * - Bit 1: L-Rx2 LOS + * - Bit 2: L-Rx3 LOS + * - Bit 3: L-Rx4 LOS + */ + uint8_t rx_los; + + /* [Prop]: Soft Tx Disable + * [Desc]: Soft Tx Disable which provide by transceiver + * [Note]: (Following is info from SFF-8636) + * Byte 86: + * - Bit 0: Tx1 Disable + * - Bit 1: Tx2 Disable + * - Bit 2: Tx3 Disable + * - Bit 3: Tx4 Disable + */ + uint8_t tx_disable; + + /* [Prop]: Soft Tx Fault + * [Desc]: Soft Tx Fault which provide by transceiver + * [Note]: (Following is info from SFF-8636) + * Byte 86: + * - Bit 0: Tx1 Fault + * - Bit 1: Tx2 Fault + * - Bit 2: Tx3 Fault + * - Bit 3: Tx4 Fault + */ + uint8_t tx_fault; + + /* [Prop]: Transceiver EQUALIZATION + * [Desc]: Transceiver EQUALIZATION + * [Note]: SFP+/28 => SFF-8472 A2H Byte-114 + * QSFP28 => SFF-8636 03H Byte-234/235 + */ + uint8_t tx_eq[2]; + + /* [Prop]: OPTION VALUES + * [Desc]: The bits in the option field shall specify the options implemented in the transceiver. + * [Note]: SFP+/28 => SFF-8472 A0H Byte-64/65 + * QSFP+/28 => SFF-8636 00H Byte-193/195 + */ + uint8_t option[3]; + + /* [Prop]: External PHY offset + * [Desc]: It needs to be setup first if you want to access transceiver external phy. + * [Note]: This feature dependent on transceiver. + * Currently, only 1G-RJ45 transceiver supported it. + */ + uint8_t extphy_offset; + + /* ========== Object private property ========== + */ + struct device *transvr_dev_p; + struct eeprom_map_s *eeprom_map_p; + struct i2c_client *i2c_client_p; + struct ioexp_obj_s *ioexp_obj_p; + struct transvr_worker_s *worker_p; + struct mutex lock; + char swp_name[32]; + int auto_config; + int auto_tx_disable; + int chan_id; + int chipset_type; + int curr_page; + int info; + int ioexp_virt_offset; + int lane_id[8]; + int layout; + int mode; + int retry; + int state; + int temp; + int type; + + /* ========== Object public functions ========== + */ + int (*get_id)(struct transvr_obj_s *self); + int (*get_ext_id)(struct transvr_obj_s *self); + int (*get_connector)(struct transvr_obj_s *self); + int (*get_vendor_name)(struct transvr_obj_s *self, char *buf_p); + int (*get_vendor_pn)(struct transvr_obj_s *self, char *buf_p); + int (*get_vendor_rev)(struct transvr_obj_s *self, char *buf_p); + int (*get_vendor_sn)(struct transvr_obj_s *self, char *buf_p); + int (*get_power_cls)(struct transvr_obj_s *self); + int (*get_br)(struct transvr_obj_s *self); + int (*get_len_sm)(struct transvr_obj_s *self); + int (*get_len_smf)(struct transvr_obj_s *self); + int (*get_len_om1)(struct transvr_obj_s *self); + int (*get_len_om2)(struct transvr_obj_s *self); + int (*get_len_om3)(struct transvr_obj_s *self); + int (*get_len_om4)(struct transvr_obj_s *self); + int (*get_comp_rev)(struct transvr_obj_s *self); + int (*get_comp_eth_1)(struct transvr_obj_s *self); + int (*get_comp_eth_10)(struct transvr_obj_s *self); + int (*get_comp_eth_10_40)(struct transvr_obj_s *self); + int (*get_comp_extend)(struct transvr_obj_s *self); + int (*get_cdr)(struct transvr_obj_s *self); + int (*get_rate_id)(struct transvr_obj_s *self); + int (*get_soft_rs0)(struct transvr_obj_s *self); + int (*get_soft_rs1)(struct transvr_obj_s *self); + int (*get_info)(struct transvr_obj_s *self); + int (*get_if_type)(struct transvr_obj_s *self, char *buf_p); + int (*get_if_speed)(struct transvr_obj_s *self, char *buf_p); + int (*get_if_lane)(struct transvr_obj_s *self, char *buf_p); + int (*get_curr_temp)(struct transvr_obj_s *self, char *buf_p); + int (*get_curr_vol)(struct transvr_obj_s *self, char *buf_p); + int (*get_soft_rx_los)(struct transvr_obj_s *self, char *buf_p); + int (*get_soft_tx_disable)(struct transvr_obj_s *self, char *buf_p); + int (*get_soft_tx_fault)(struct transvr_obj_s *self, char *buf_p); + int (*get_auto_tx_disable)(struct transvr_obj_s *self, char *buf_p); + int (*get_tx_bias)(struct transvr_obj_s *self, char *buf_p); + int (*get_tx_power)(struct transvr_obj_s *self, char *buf_p); + int (*get_rx_power)(struct transvr_obj_s *self, char *buf_p); + int (*get_tx_eq)(struct transvr_obj_s *self, char *buf_p); + int (*get_rx_am)(struct transvr_obj_s *self, char *buf_p); + int (*get_rx_em)(struct transvr_obj_s *self, char *buf_p); + int (*get_wavelength)(struct transvr_obj_s *self, char *buf_p); + int (*get_extphy_offset)(struct transvr_obj_s *self, char *buf_p); + int (*get_extphy_reg)(struct transvr_obj_s *self, char *buf_p); + int (*set_cdr)(struct transvr_obj_s *self, int input_val); + int (*set_soft_rs0)(struct transvr_obj_s *self, int input_val); + int (*set_soft_rs1)(struct transvr_obj_s *self, int input_val); + int (*set_soft_tx_disable)(struct transvr_obj_s *self, int input_val); + int (*set_auto_tx_disable)(struct transvr_obj_s *self, int input_val); + int (*set_tx_eq)(struct transvr_obj_s *self, int input_val); + int (*set_rx_am)(struct transvr_obj_s *self, int input_val); + int (*set_rx_em)(struct transvr_obj_s *self, int input_val); + int (*set_extphy_offset)(struct transvr_obj_s *self, int input_val); + int (*set_extphy_reg)(struct transvr_obj_s *self, int input_val); + + /* ========== Object private functions ========== + */ + int (*init)(struct transvr_obj_s *self); + int (*clean)(struct transvr_obj_s *self); + int (*check)(struct transvr_obj_s *self); + int (*update_all)(struct transvr_obj_s *self, int show_err); + int (*fsm_4_direct)(struct transvr_obj_s* self, char *caller_name); + int (*fsm_4_polling)(struct transvr_obj_s* self, char *caller_name); + int (*send_uevent)(struct transvr_obj_s* self, enum kobject_action u_action); + int (*dump_all)(struct transvr_obj_s* self); +}; + + +/* For AVL Mapping */ +struct transvr_avl_s { + char vendor_name[32]; + char vendor_pn[32]; + int (*init)(struct transvr_obj_s *self); +}; + + +/* Worker for long term task of transceiver */ +struct transvr_worker_s { + /* Task Parameter */ + struct transvr_obj_s *transvr_p; + struct transvr_worker_s *next_p; + struct transvr_worker_s *pre_p; + unsigned long trigger_time; + char func_name[64]; + int retry; + int state; + + /* Task private data */ + void *p_data; + + /* Call back function */ + int (*main_task)(struct transvr_worker_s *task); + int (*post_task)(struct transvr_worker_s *task); +}; + + +struct transvr_obj_s * +create_transvr_obj(char *swp_name, + int chan_id, + struct ioexp_obj_s *ioexp_obj_p, + int ioexp_virt_offset, + int transvr_type, + int chipset_type, + int run_mode); + +void lock_transvr_obj(struct transvr_obj_s *self); +void unlock_transvr_obj(struct transvr_obj_s *self); +int isolate_transvr_obj(struct transvr_obj_s *self); + +int resync_channel_tier_2(struct transvr_obj_s *self); + +void alarm_msg_2_user(struct transvr_obj_s *self, char *emsg); + +#endif /* TRANSCEIVER_H */ + + + + + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6556/utils/inventec_d6556_util.py b/platform/broadcom/sonic-platform-modules-inventec/d6556/utils/inventec_d6556_util.py new file mode 100644 index 000000000000..2ca077945f5a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d6556/utils/inventec_d6556_util.py @@ -0,0 +1,238 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Inventec, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +DEBUG = False +args = [] +FORCE = 0 +i2c_prefix = '/sys/bus/i2c/devices/' + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV: ', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + install() + elif arg == 'clean': + uninstall() + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print "[D6556]"+txt + return + +def exec_cmd(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + show_log (cmd +" with result:" + str(status)) + show_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + + +instantiate = [ +'echo inv_eeprom 0x53 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo inv_cpld 0x55 > /sys/bus/i2c/devices/i2c-0/new_device'] + + +drivers =[ +'gpio_ich', +'lpc_ich', +'i2c-i801', +'i2c-mux', +'i2c-mux-pca954x', +'i2c-dev', +'inv_eeprom', +'inv_platform', +'inv_psoc', +'inv_cpld', +'swps', +'inv_pthread'] + + + +def system_install(): + global FORCE + + #remove default drivers to avoid modprobe order conflicts + status, output = exec_cmd("rmmod i2c_ismt ", 1) + status, output = exec_cmd("rmmod i2c-i801 ", 1) + status, output = exec_cmd("rmmod gpio_ich ", 1) + status, output = exec_cmd("rmmod lpc_ich ", 1) + + + #install drivers + for i in range(0,len(drivers)): + status, output = exec_cmd("modprobe "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + + #instantiate devices + for i in range(0,len(instantiate)): + #time.sleep(1) + status, output = exec_cmd(instantiate[i], 1) + if status: + print output + if FORCE == 0: + return status + + + for i in range(10,18): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-1/i2c-2/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(18,26): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-1/i2c-3/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(26,34): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-1/i2c-4/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(34,42): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-1/i2c-5/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(42,50): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-1/i2c-6/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(50,58): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-1/i2c-7/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + for i in range(58,66): + status, output =exec_cmd("echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-1/i2c-8/i2c-"+str(i)+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + + +def system_ready(): + if not device_found(): + return False + return True + +def install(): + if not device_found(): + print "No device, installing...." + status = system_install() + if status: + if FORCE == 0: + return status + else: + print "D6556 devices detected...." + return + +def uninstall(): + global FORCE + #uninstall drivers + for i in range(len(drivers)-1,-1,-1): + status, output = exec_cmd("rmmod "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_found(): + ret1, log = exec_cmd("ls "+i2c_prefix+"*0072", 0) + ret2, log = exec_cmd("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() + + diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile index c43c47745229..b596d1c4bc4d 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/Makefile @@ -2,6 +2,7 @@ obj-m += inv_cpld.o inv_psoc.o obj-m += inv_platform.o obj-m += inv_eeprom.o obj-m += swps.o +obj-m += inv_pthread.o swps-objs := inv_swps.o io_expander.o transceiver.o diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_psoc.c b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_psoc.c index fec3d25dc3da..d32d1e1daa11 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_psoc.c +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_psoc.c @@ -1,1024 +1,1042 @@ -/* - * 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 "I2CHostCommunication.h" - -#define USE_SMBUS 1 - -//#define offsetof(st, m) ((size_t)(&((st *)0)->m)) -#define FAN_NUM 5 -#define PSU_NUM 2 - -struct __attribute__ ((__packed__)) psoc_psu_layout { - u16 psu1_iin; - u16 psu2_iin; - u16 psu1_iout; - u16 psu2_iout; - - u16 psu1_pin; - u16 psu2_pin; - u16 psu1_pout; - u16 psu2_pout; - - u16 psu1_vin; - u16 psu2_vin; - u16 psu1_vout; - u16 psu2_vout; -}; - -struct __attribute__ ((__packed__)) psoc_layout { - u8 ctl; //offset: 0 - u16 switch_temp; //offset: 1 - u8 reserve1; //offset: 3 - - u8 fw_upgrade; //offset: 4 - - //i2c bridge - u8 i2c_st; //offset: 5 - u8 i2c_ctl; //offset: 6 - u8 i2c_addr; //offset: 7 - u8 i2c_data[0x20]; //offset: 8 - - //gpo - u8 led_grn; //offset: 28 - u8 led_red; //offset: 29 - - //pwm duty - u8 pwm[FAN_NUM]; //offset: 2a - u8 pwm_psu[PSU_NUM]; //offset: 2f - - //fan rpm - u16 fan[FAN_NUM*2]; //offset: 31 - //u16 fan_psu[PSU_NUM]; - - //gpi - u8 gpi_fan; //offset: 45 - - //psu state - u8 psu_state; //offset: 46 - - //temperature - u16 temp[5]; //offset: 47 - u16 temp_psu[PSU_NUM]; //offset: 51 - - //version - u8 version[2]; //offset: 55 - - u8 reserve2[3]; //offset: 57 - struct psoc_psu_layout psu_info; //offset: 5a -}; - - -/* definition */ -#define PSOC_OFF(m) offsetof(struct psoc_layout, m) -#define PSOC_PSU_OFF(m) offsetof(struct psoc_psu_layout, m) - -#define SWITCH_TMP_OFFSET PSOC_OFF(switch_temp) //0x01 -#define PWM_OFFSET PSOC_OFF(pwm) -#define PWM_PSU_OFFSET PSOC_OFF(pwm_psu) -#define THERMAL_OFFSET PSOC_OFF(temp) -#define RPM_OFFSET PSOC_OFF(fan) -//#define RPM_PSU_OFFSET PSOC_OFF(fan_psu) -#define DIAG_FLAG_OFFSET PSOC_OFF(ctl) -#define FAN_LED_OFFSET PSOC_OFF(led_grn) -#define FAN_GPI_OFFSET PSOC_OFF(gpi_fan) -#define PSOC_PSU_OFFSET PSOC_OFF(psu_state) -#define VERSION_OFFSET PSOC_OFF(version) -#define PSU_INFO_OFFSET PSOC_OFF(psu_info) - - -/* Each client has this additional data */ -struct psoc_data { - struct device *hwmon_dev; - struct mutex update_lock; - u32 diag; -}; - -/*-----------------------------------------------------------------------*/ - -static ssize_t psoc_i2c_read(struct i2c_client *client, u8 *buf, u8 offset, size_t count) -{ -#if USE_SMBUS - int i; - - for(i=0; iaddr; - msg[0].buf = msgbuf; - msg[0].len = 1; - - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].buf = buf; - msg[1].len = count; - - status = i2c_transfer(client->adapter, msg, 2); - - if(status == 2) - status = count; - - return status; -#endif -} - -static ssize_t psoc_i2c_write(struct i2c_client *client, char *buf, unsigned offset, size_t count) -{ -#if USE_SMBUS - int i; - - for(i=0; iaddr; - msg.flags = 0; - - /* msg.buf is u8 and casts will mask the values */ - msg.buf = writebuf; - - msg.buf[i++] = offset; - memcpy(&msg.buf[i], buf, count); - msg.len = i + count; - - status = i2c_transfer(client->adapter, &msg, 1); - if (status == 1) - status = count; - - return status; -#endif -} - -static u32 psoc_read32(struct i2c_client *client, u8 offset) -{ - u32 value = 0; - u8 buf[4]; - - if( psoc_i2c_read(client, buf, offset, 4) == 4) - value = (buf[0]<<24 | buf[1]<<16 | buf[2]<<8 | buf[3]); - - return value; -} - -static u16 psoc_read16(struct i2c_client *client, u8 offset) -{ - u16 value = 0; - u8 buf[2]; - - if(psoc_i2c_read(client, buf, offset, 2) == 2) - value = (buf[0]<<8 | buf[1]<<0); - - return value; -} - -static u8 psoc_read8(struct i2c_client *client, u8 offset) -{ - u8 value = 0; - u8 buf = 0; - - if(psoc_i2c_read(client, &buf, offset, 1) == 1) - value = buf; - - return value; -} - -static int psoc_write_value(struct i2c_client *client, unsigned offset, u16 value) -{ - //TBD - return 0; -} - - -//PSOC i2c bridge regsters -#define PSOC_I2C_STATUS PSOC_OFF(i2c_st) -#define PSOC_I2C_CNTRL PSOC_OFF(i2c_ctl) -#define PSOC_I2C_ADDR PSOC_OFF(i2c_addr) -#define PSOC_I2C_DATA PSOC_OFF(i2c_data) - -//status bit definition -#define PSOC_I2C_START (1 << 0) -#define PSOC_PMB_SEL (1 << 7) - -//addr bits definition -#define PSOC_I2C_READ (1 << 0) - -//PMBUS registers definition -#define PMBUS_READ_VIN (0x88) -#define PMBUS_READ_IIN (0x89) -#define PMBUS_READ_VOUT (0x8B) -#define PMBUS_READ_IOUT (0x8C) -#define PMBUS_READ_POUT (0x96) -#define PMBUS_READ_PIN (0x97) - -#define PMBUS_MFR_ID (0x99) -#define PMBUS_MFR_MODEL (0x9A) -#define PMBUS_MFR_REVISION (0x9B) -#define PMBUS_MFR_DATE (0x9D) -#define PMBUS_MFR_SERIAL (0x9E) - -static int psoc_i2c_bridge_read(struct i2c_client *client, - unsigned char bus, - unsigned char chip, - char *addr, int alen, - unsigned char *data, int len ) -{ - unsigned char txdata[28], rxdata[28]; - int index, timeout; - - txdata[PSOC_I2C_STATUS] = 0; /* the status */ - txdata[PSOC_I2C_CNTRL] = ((alen & 3) << 5) | (len & 0x1f); /* the sizes */ - txdata[PSOC_I2C_ADDR] = (chip << 1) | PSOC_I2C_READ; /* read address */ - for(index = 0; index < alen; index++) - txdata[PSOC_I2C_DATA + index] = addr[index]; /* the chip address */ - for(; index < alen+len; index++) - txdata[PSOC_I2C_DATA + index] = 0; /* clear the chip data */ - - psoc_i2c_write(client, &txdata[PSOC_I2C_CNTRL], PSOC_I2C_CNTRL, 2 + alen + len); - - //delay a while ??? - //--------------------------------------------------------------------- - //start write - txdata[PSOC_I2C_STATUS] = PSOC_I2C_START; /* the start bit*/ - if(bus) - txdata[PSOC_I2C_STATUS] |= PSOC_PMB_SEL;/* bus id */ - psoc_i2c_write(client, &txdata[PSOC_I2C_STATUS], PSOC_I2C_STATUS, 1); - - //delay a while - timeout = 40; //40*20==>800 ms - do { - psoc_i2c_read(client, &rxdata[PSOC_I2C_STATUS], PSOC_I2C_STATUS, 1); - - //check rxdata[5] error bit(1) and complete bit(0) ,TBD - if((rxdata[PSOC_I2C_STATUS] & 0x2) == 0x2) { - //printk("i2c bridge fail!!!\n"); - timeout = 0; - break; - } - if((rxdata[PSOC_I2C_STATUS] & PSOC_I2C_START) == 0) { - /* comand complete */ - psoc_i2c_read(client, &rxdata[PSOC_I2C_DATA+alen], PSOC_I2C_DATA+alen, len); - break; - } - - //delay - msleep(20); - } while(timeout--); - - if(timeout <= 0) { - return -1; - } - - //--------------------------------------------------------------------- - - for(index=0; index < len; index++) { - data[index] = rxdata[PSOC_I2C_DATA + alen + index]; - } - - return 0; -} - - -/* -CPLD report the PSU0 status -000 = PSU normal operation -100 = PSU fault -010 = PSU unpowered -111 = PSU not installed - -7 6 | 5 4 3 | 2 1 0 ----------------------- - | psu1 | psu0 -*/ -static char* psu_str[] = { - "normal", //000 - "NA", //001 - "unpowered", //010 - "NA", //011 - "fault", //100 - "NA", //101 - "NA", //110 - "not installed", //111 -}; - -static ssize_t show_psu_st(struct device *dev, struct device_attribute *da, - char *buf) -{ - u32 status; - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 byte; - int shift = (attr->index == 0)?3:0; - - mutex_lock(&data->update_lock); - status = psoc_i2c_read(client, &byte, PSOC_PSU_OFFSET, 1); - mutex_unlock(&data->update_lock); - - byte = (byte >> shift) & 0x7; - - status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); - - return strlen(buf); -} - -/*-----------------------------------------------------------------------*/ - -/* sysfs attributes for hwmon */ - -static ssize_t show_thermal(struct device *dev, struct device_attribute *da, - char *buf) -{ - u16 status; - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 offset = attr->index * 2 + THERMAL_OFFSET; - - mutex_lock(&data->update_lock); - - status = psoc_read16(client, offset); - status = __swab16(status); - - mutex_unlock(&data->update_lock); - - return sprintf(buf, "%d\n", - (s8)(status>>8) * 1000 ); -} - - -static ssize_t show_pwm(struct device *dev, struct device_attribute *da, - char *buf) -{ - int status; - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 offset = attr->index; - - mutex_lock(&data->update_lock); - - status = psoc_read8(client, offset); - - mutex_unlock(&data->update_lock); - - return sprintf(buf, "%d\n", - status); -} - -static ssize_t set_pwm(struct device *dev, - struct device_attribute *devattr, - const char *buf, size_t count) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 offset = attr->index; - - u8 pwm = simple_strtol(buf, NULL, 10); - if(pwm > 255) pwm = 255; - - if(data->diag) { - mutex_lock(&data->update_lock); - psoc_i2c_write(client, &pwm, offset, 1); - mutex_unlock(&data->update_lock); - } - - return count; -} - - -static ssize_t show_rpm(struct device *dev, struct device_attribute *da, - char *buf) -{ - int status; - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 offset = attr->index; - - mutex_lock(&data->update_lock); - - status = psoc_read16(client, offset); - status = __swab16(status); - - mutex_unlock(&data->update_lock); - - return sprintf(buf, "%d\n", - status); -} -static ssize_t show_fan_type(struct device *dev, struct device_attribute *da, - char *buf) -{ - u8 status; - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 index = attr->index; - int type = -1; - - mutex_lock(&data->update_lock); - status = psoc_read8(client, FAN_GPI_OFFSET); - mutex_unlock(&data->update_lock); - - if( (status & 1<update_lock); - status = psoc_i2c_read(client, (u8*)&temp, SWITCH_TMP_OFFSET, 2); - status = __swab16(status); - mutex_unlock(&data->update_lock); - - status = sprintf (buf, "%d\n", (s8)(temp>>8) * 1000 ); - - return strlen(buf); -} - -static ssize_t set_switch_tmp(struct device *dev, - struct device_attribute *devattr, - const char *buf, size_t count) -{ - //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - - long temp = simple_strtol(buf, NULL, 10); - u16 temp2 = ( (temp/1000) <<8 ) & 0xFF00 ; - - //printk("set_switch_tmp temp=%d, temp2=0x%x (%x,%x)\n", temp, temp2, ( ( (temp/1000) <<8 ) & 0xFF00 ), (( (temp%1000) / 10 ) & 0xFF)); - - mutex_lock(&data->update_lock); - psoc_i2c_write(client, (u8*)&temp2, SWITCH_TMP_OFFSET, 2); - mutex_unlock(&data->update_lock); - - return count; -} - -static ssize_t show_diag(struct device *dev, struct device_attribute *da, - char *buf) -{ - u16 status; - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 diag_flag = 0; - - mutex_lock(&data->update_lock); - status = psoc_i2c_read(client, (u8*)&diag_flag, DIAG_FLAG_OFFSET, 1); - mutex_unlock(&data->update_lock); - - data->diag = (diag_flag & 0x80)?1:0; - status = sprintf (buf, "%d\n", data->diag); - - return strlen(buf); -} - -static ssize_t set_diag(struct device *dev, - struct device_attribute *devattr, - const char *buf, size_t count) -{ - //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 value = 0; - u8 diag = simple_strtol(buf, NULL, 10); - - diag = diag?1:0; - data->diag = diag; - - mutex_lock(&data->update_lock); - psoc_i2c_read(client, (u8*)&value, DIAG_FLAG_OFFSET, 1); - if(diag) value |= (1<<7); - else value &= ~(1<<7); - psoc_i2c_write(client, (u8*)&value, DIAG_FLAG_OFFSET, 1); - mutex_unlock(&data->update_lock); - - return count; -} - -static ssize_t show_version(struct device *dev, struct device_attribute *da, - char *buf) -{ - u16 status; - //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - - mutex_lock(&data->update_lock); - - status = psoc_read16(client, VERSION_OFFSET); - - mutex_unlock(&data->update_lock); - - return sprintf(buf, "ver: %x.%x\n", (status & 0xFF00)>>8, (status & 0xFF) ); -} - - -static ssize_t show_fan_led(struct device *dev, struct device_attribute *da, - char *buf) -{ - int status; - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 bit = attr->index; - - mutex_lock(&data->update_lock); - - status = psoc_read8(client, FAN_LED_OFFSET); - - mutex_unlock(&data->update_lock); - - return sprintf(buf, "%d\n", - (status & (1<index; - u8 led_state = 0; - - u8 v = simple_strtol(buf, NULL, 10); - - if(data->diag) { - mutex_lock(&data->update_lock); - led_state = psoc_read8(client, FAN_LED_OFFSET); - if(v) led_state |= (1<update_lock); - } - - return count; -} - -static ssize_t show_value8(struct device *dev, struct device_attribute *da, - char *buf) -{ - int status; - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 offset = attr->index; - - mutex_lock(&data->update_lock); - - status = psoc_read8(client, offset); - - mutex_unlock(&data->update_lock); - - return sprintf(buf, "0x%02X\n", status ); -} - -static long pmbus_reg2data_linear(int data, int linear16) -{ - s16 exponent; - s32 mantissa; - long val; - - if (linear16) { /* LINEAR16 */ - exponent = -9; - mantissa = (u16) data; - } else { /* LINEAR11 */ - exponent = ((s16)data) >> 11; - exponent = ((s16)( data & 0xF800) ) >> 11; - mantissa = ((s32)((data & 0x7ff) << 5)) >> 5; - } - - //printk("data=%d, m=%d, e=%d\n", data, exponent, mantissa); - val = mantissa; - - /* scale result to micro-units for power sensors */ - val = val * 1000L; - - if (exponent >= 0) - val <<= exponent; - else - val >>= -exponent; - - return val; -} - -static ssize_t show_psu(struct device *dev, struct device_attribute *da, - char *buf) -{ - int status; - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 reg = attr->index & 0xFF; - u8 len = ((attr->index & 0xFF00) >> 8); - u8 chip = (attr->index >> 16)? 0x59:0x58; - u8 bus = 1; - unsigned char value[2] = {0,0};; - - if (len == 2) - { - mutex_lock(&data->update_lock); - psoc_i2c_bridge_read(client, bus, chip, ®, 1, value, 2); - mutex_unlock(&data->update_lock); - - status = value[1]<<8 | value[0]; - //status1 = value[1]<<8 | value[0]; - - return sprintf(buf, "%ld\n", pmbus_reg2data_linear(status, (reg==PMBUS_READ_VOUT)?1:0) ); - } - else - { //len is not defined. - u8 tmpbuf[32]; - mutex_lock(&data->update_lock); - //length of block read - psoc_i2c_bridge_read(client, bus, chip, ®, 1, &len, 1); - //data included length - psoc_i2c_bridge_read(client, bus, chip, ®, 1, tmpbuf, len+1); - mutex_unlock(&data->update_lock); - - memcpy(buf, tmpbuf+1, len); - buf[len]='\n'; - - return len+1; - } -} - -static ssize_t show_psu_psoc(struct device *dev, struct device_attribute *da, - char *buf) -{ - u16 status; - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct psoc_data *data = i2c_get_clientdata(client); - u8 offset = attr->index + PSU_INFO_OFFSET; - - mutex_lock(&data->update_lock); - status = psoc_read16(client, offset); - mutex_unlock(&data->update_lock); - - return sprintf(buf, "%ld \n", pmbus_reg2data_linear(status, strstr(attr->dev_attr.attr.name, "vout")? 1:0 )); -} - - -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_thermal, 0, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_thermal, 0, 1); -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_thermal, 0, 2); -static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_thermal, 0, 3); -static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_thermal, 0, 4); -static SENSOR_DEVICE_ATTR(thermal_psu1, S_IRUGO, show_thermal, 0, 5); -static SENSOR_DEVICE_ATTR(thermal_psu2, S_IRUGO, show_thermal, 0, 6); - -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+0); -static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+1); -static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+2); -static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+3); -#if (FAN_NUM >= 5) -static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+4); -#endif -static SENSOR_DEVICE_ATTR(pwm_psu1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_PSU_OFFSET+0); -static SENSOR_DEVICE_ATTR(pwm_psu2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_PSU_OFFSET+1); - -static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu_st, 0, 0); -static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu_st, 0, 1); - -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_rpm, 0, 0*2 + RPM_OFFSET); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_rpm, 0, 1*2 + RPM_OFFSET); -static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_rpm, 0, 2*2 + RPM_OFFSET); -static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_rpm, 0, 3*2 + RPM_OFFSET); -static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_rpm, 0, 4*2 + RPM_OFFSET); -static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_rpm, 0, 5*2 + RPM_OFFSET); -static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_rpm, 0, 6*2 + RPM_OFFSET); -static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_rpm, 0, 7*2 + RPM_OFFSET); -#if (FAN_NUM >= 5) -static SENSOR_DEVICE_ATTR(fan9_input, S_IRUGO, show_rpm, 0, 8*2 + RPM_OFFSET); -static SENSOR_DEVICE_ATTR(fan10_input, S_IRUGO, show_rpm, 0, 9*2 + RPM_OFFSET); -#endif -static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8*2 + RPM_OFFSET); -static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9*2 + RPM_OFFSET); - -static SENSOR_DEVICE_ATTR(switch_tmp, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); - -static SENSOR_DEVICE_ATTR(diag, S_IWUSR|S_IRUGO, show_diag, set_diag, 0); -static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, 0, 0); - -static SENSOR_DEVICE_ATTR(fan_led_grn1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 0); -static SENSOR_DEVICE_ATTR(fan_led_grn2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 1); -static SENSOR_DEVICE_ATTR(fan_led_grn3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 2); -static SENSOR_DEVICE_ATTR(fan_led_grn4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 3); -static SENSOR_DEVICE_ATTR(fan_led_red1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 4); -static SENSOR_DEVICE_ATTR(fan_led_red2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 5); -static SENSOR_DEVICE_ATTR(fan_led_red3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 6); -static SENSOR_DEVICE_ATTR(fan_led_red4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 7); - -static SENSOR_DEVICE_ATTR(fan_gpi, S_IRUGO, show_value8, 0, FAN_GPI_OFFSET); -static SENSOR_DEVICE_ATTR(fan1_type, S_IRUGO, show_fan_type, 0, 0); -static SENSOR_DEVICE_ATTR(fan2_type, S_IRUGO, show_fan_type, 0, 1); -static SENSOR_DEVICE_ATTR(fan3_type, S_IRUGO, show_fan_type, 0, 2); -static SENSOR_DEVICE_ATTR(fan4_type, S_IRUGO, show_fan_type, 0, 3); - -static SENSOR_DEVICE_ATTR(psu1_vin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_VIN); -static SENSOR_DEVICE_ATTR(psu1_vout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_VOUT); -static SENSOR_DEVICE_ATTR(psu1_iin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_IIN); -static SENSOR_DEVICE_ATTR(psu1_iout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_IOUT); -static SENSOR_DEVICE_ATTR(psu1_pin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_PIN); -static SENSOR_DEVICE_ATTR(psu1_pout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_POUT); - -static SENSOR_DEVICE_ATTR(psu1_vendor, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_ID); -static SENSOR_DEVICE_ATTR(psu1_model, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_MODEL); -static SENSOR_DEVICE_ATTR(psu1_version, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_REVISION); -static SENSOR_DEVICE_ATTR(psu1_date, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_DATE); -static SENSOR_DEVICE_ATTR(psu1_sn, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_SERIAL); - -static SENSOR_DEVICE_ATTR(psu2_vin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_VIN); -static SENSOR_DEVICE_ATTR(psu2_vout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_VOUT); -static SENSOR_DEVICE_ATTR(psu2_iin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_IIN); -static SENSOR_DEVICE_ATTR(psu2_iout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_IOUT); -static SENSOR_DEVICE_ATTR(psu2_pin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_PIN); -static SENSOR_DEVICE_ATTR(psu2_pout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_POUT); - -static SENSOR_DEVICE_ATTR(psu2_vendor, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_ID); -static SENSOR_DEVICE_ATTR(psu2_model, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_MODEL); -static SENSOR_DEVICE_ATTR(psu2_version, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_REVISION); -static SENSOR_DEVICE_ATTR(psu2_date, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_DATE); -static SENSOR_DEVICE_ATTR(psu2_sn, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_SERIAL); - -static SENSOR_DEVICE_ATTR(psoc_psu1_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); -static SENSOR_DEVICE_ATTR(psoc_psu1_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vout)); -static SENSOR_DEVICE_ATTR(psoc_psu1_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); -static SENSOR_DEVICE_ATTR(psoc_psu1_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iout)); -static SENSOR_DEVICE_ATTR(psoc_psu1_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); -static SENSOR_DEVICE_ATTR(psoc_psu1_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pout)); - - -static SENSOR_DEVICE_ATTR(psoc_psu2_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); -static SENSOR_DEVICE_ATTR(psoc_psu2_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vout)); -static SENSOR_DEVICE_ATTR(psoc_psu2_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); -static SENSOR_DEVICE_ATTR(psoc_psu2_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iout)); -static SENSOR_DEVICE_ATTR(psoc_psu2_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); -static SENSOR_DEVICE_ATTR(psoc_psu2_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); - -static struct attribute *psoc_attributes[] = { - //thermal - &sensor_dev_attr_temp1_input.dev_attr.attr, - &sensor_dev_attr_temp2_input.dev_attr.attr, - &sensor_dev_attr_temp3_input.dev_attr.attr, - &sensor_dev_attr_temp4_input.dev_attr.attr, - &sensor_dev_attr_temp5_input.dev_attr.attr, - - &sensor_dev_attr_thermal_psu1.dev_attr.attr, - &sensor_dev_attr_thermal_psu2.dev_attr.attr, - - - //pwm - &sensor_dev_attr_pwm1.dev_attr.attr, - &sensor_dev_attr_pwm2.dev_attr.attr, - &sensor_dev_attr_pwm3.dev_attr.attr, - &sensor_dev_attr_pwm4.dev_attr.attr, -#if (FAN_NUM >= 5) - //&sensor_dev_attr_pwm5.dev_attr.attr, -#endif - &sensor_dev_attr_pwm_psu1.dev_attr.attr, - &sensor_dev_attr_pwm_psu2.dev_attr.attr, - - //rpm - &sensor_dev_attr_fan1_input.dev_attr.attr, - &sensor_dev_attr_fan2_input.dev_attr.attr, - &sensor_dev_attr_fan3_input.dev_attr.attr, - &sensor_dev_attr_fan4_input.dev_attr.attr, - &sensor_dev_attr_fan5_input.dev_attr.attr, - &sensor_dev_attr_fan6_input.dev_attr.attr, - &sensor_dev_attr_fan7_input.dev_attr.attr, - &sensor_dev_attr_fan8_input.dev_attr.attr, -#if (FAN_NUM >= 5) - //&sensor_dev_attr_fan9_input.dev_attr.attr, - //&sensor_dev_attr_fan10_input.dev_attr.attr, -#endif - - &sensor_dev_attr_rpm_psu1.dev_attr.attr, - &sensor_dev_attr_rpm_psu2.dev_attr.attr, - - //switch temperature - &sensor_dev_attr_switch_tmp.dev_attr.attr, - - //diag flag - &sensor_dev_attr_diag.dev_attr.attr, - - //version - &sensor_dev_attr_version.dev_attr.attr, - - //fan led - &sensor_dev_attr_fan_led_grn1.dev_attr.attr, - &sensor_dev_attr_fan_led_grn2.dev_attr.attr, - &sensor_dev_attr_fan_led_grn3.dev_attr.attr, - &sensor_dev_attr_fan_led_grn4.dev_attr.attr, - &sensor_dev_attr_fan_led_red1.dev_attr.attr, - &sensor_dev_attr_fan_led_red2.dev_attr.attr, - &sensor_dev_attr_fan_led_red3.dev_attr.attr, - &sensor_dev_attr_fan_led_red4.dev_attr.attr, - - //fan GPI - &sensor_dev_attr_fan_gpi.dev_attr.attr, - - //fan type - &sensor_dev_attr_fan1_type.dev_attr.attr, - &sensor_dev_attr_fan2_type.dev_attr.attr, - &sensor_dev_attr_fan3_type.dev_attr.attr, - &sensor_dev_attr_fan4_type.dev_attr.attr, - - //psu - &sensor_dev_attr_psu1_vin.dev_attr.attr, - &sensor_dev_attr_psu1_vout.dev_attr.attr, - &sensor_dev_attr_psu1_iin.dev_attr.attr, - &sensor_dev_attr_psu1_iout.dev_attr.attr, - &sensor_dev_attr_psu1_pin.dev_attr.attr, - &sensor_dev_attr_psu1_pout.dev_attr.attr, - &sensor_dev_attr_psu2_vin.dev_attr.attr, - &sensor_dev_attr_psu2_vout.dev_attr.attr, - &sensor_dev_attr_psu2_iin.dev_attr.attr, - &sensor_dev_attr_psu2_iout.dev_attr.attr, - &sensor_dev_attr_psu2_pin.dev_attr.attr, - &sensor_dev_attr_psu2_pout.dev_attr.attr, - - &sensor_dev_attr_psu1_vendor.dev_attr.attr, - &sensor_dev_attr_psu1_model.dev_attr.attr, - &sensor_dev_attr_psu1_version.dev_attr.attr, - &sensor_dev_attr_psu1_date.dev_attr.attr, - &sensor_dev_attr_psu1_sn.dev_attr.attr, - &sensor_dev_attr_psu2_vendor.dev_attr.attr, - &sensor_dev_attr_psu2_model.dev_attr.attr, - &sensor_dev_attr_psu2_version.dev_attr.attr, - &sensor_dev_attr_psu2_date.dev_attr.attr, - &sensor_dev_attr_psu2_sn.dev_attr.attr, - - &sensor_dev_attr_psu0.dev_attr.attr, - &sensor_dev_attr_psu1.dev_attr.attr, - - //psu_psoc, new added on psoc 1.9 - &sensor_dev_attr_psoc_psu1_vin.dev_attr.attr, - &sensor_dev_attr_psoc_psu1_vout.dev_attr.attr, - &sensor_dev_attr_psoc_psu1_iin.dev_attr.attr, - &sensor_dev_attr_psoc_psu1_iout.dev_attr.attr, - &sensor_dev_attr_psoc_psu1_pin.dev_attr.attr, - &sensor_dev_attr_psoc_psu1_pout.dev_attr.attr, - &sensor_dev_attr_psoc_psu2_vin.dev_attr.attr, - &sensor_dev_attr_psoc_psu2_vout.dev_attr.attr, - &sensor_dev_attr_psoc_psu2_iin.dev_attr.attr, - &sensor_dev_attr_psoc_psu2_iout.dev_attr.attr, - &sensor_dev_attr_psoc_psu2_pin.dev_attr.attr, - &sensor_dev_attr_psoc_psu2_pout.dev_attr.attr, - - NULL -}; - -static const struct attribute_group psoc_group = { - .attrs = psoc_attributes, -}; - -/*-----------------------------------------------------------------------*/ - -/* device probe and removal */ - -static int -psoc_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - struct psoc_data *data; - int status; - - printk("+%s\n", __func__); - - if (!i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) - return -EIO; - - data = kzalloc(sizeof(struct psoc_data), GFP_KERNEL); - if (!data) - return -ENOMEM; - - i2c_set_clientdata(client, data); - mutex_init(&data->update_lock); - data->diag = 0; - - /* Register sysfs hooks */ - status = sysfs_create_group(&client->dev.kobj, &psoc_group); - if (status) - goto exit_free; - - data->hwmon_dev = hwmon_device_register(&client->dev); - if (IS_ERR(data->hwmon_dev)) { - status = PTR_ERR(data->hwmon_dev); - goto exit_remove; - } - - dev_info(&client->dev, "%s: sensor '%s'\n", - dev_name(data->hwmon_dev), client->name); - - return 0; - -exit_remove: - sysfs_remove_group(&client->dev.kobj, &psoc_group); -exit_free: - i2c_set_clientdata(client, NULL); - kfree(data); - return status; -} - -static int psoc_remove(struct i2c_client *client) -{ - struct psoc_data *data = i2c_get_clientdata(client); - - hwmon_device_unregister(data->hwmon_dev); - sysfs_remove_group(&client->dev.kobj, &psoc_group); - i2c_set_clientdata(client, NULL); - kfree(data); - return 0; -} - -static const struct i2c_device_id psoc_ids[] = { - { "inv_psoc", 0, }, - { /* LIST END */ } -}; -MODULE_DEVICE_TABLE(i2c, psoc_ids); - -static struct i2c_driver psoc_driver = { - .class = I2C_CLASS_HWMON, - .driver = { - .name = "inv_psoc", - }, - .probe = psoc_probe, - .remove = psoc_remove, - .id_table = psoc_ids, -}; - -/*-----------------------------------------------------------------------*/ - -/* module glue */ - -static int __init inv_psoc_init(void) -{ - return i2c_add_driver(&psoc_driver); -} - -static void __exit inv_psoc_exit(void) -{ - i2c_del_driver(&psoc_driver); -} - -MODULE_AUTHOR("eddie.lan "); -MODULE_DESCRIPTION("inv psoc driver"); -MODULE_LICENSE("GPL"); - -module_init(inv_psoc_init); -module_exit(inv_psoc_exit); +/* + * 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 "I2CHostCommunication.h" + +#define USE_SMBUS 1 + +//#define offsetof(st, m) ((size_t)(&((st *)0)->m)) +#define FAN_NUM 5 +#define PSU_NUM 2 + +struct __attribute__ ((__packed__)) psoc_psu_layout { + u16 psu1_iin; + u16 psu2_iin; + u16 psu1_iout; + u16 psu2_iout; + + u16 psu1_pin; + u16 psu2_pin; + u16 psu1_pout; + u16 psu2_pout; + + u16 psu1_vin; + u16 psu2_vin; + u16 psu1_vout; + u16 psu2_vout; +}; + +struct __attribute__ ((__packed__)) psoc_layout { + u8 ctl; //offset: 0 + u16 switch_temp; //offset: 1 + u8 reserve1; //offset: 3 + + u8 fw_upgrade; //offset: 4 + + //i2c bridge + u8 i2c_st; //offset: 5 + u8 i2c_ctl; //offset: 6 + u8 i2c_addr; //offset: 7 + u8 i2c_data[0x20]; //offset: 8 + + //gpo + u8 led_grn; //offset: 28 + u8 led_red; //offset: 29 + + //pwm duty + u8 pwm[FAN_NUM]; //offset: 2a + u8 pwm_psu[PSU_NUM]; //offset: 2f + + //fan rpm + u16 fan[FAN_NUM*2]; //offset: 31 + //u16 fan_psu[PSU_NUM]; + + //gpi + u8 gpi_fan; //offset: 45 + + //psu state + u8 psu_state; //offset: 46 + + //temperature + u16 temp[5]; //offset: 47 + u16 temp_psu[PSU_NUM]; //offset: 51 + + //version + u8 version[2]; //offset: 55 + + u8 reserve2[3]; //offset: 57 + struct psoc_psu_layout psu_info; //offset: 5a +}; + + +/* definition */ +#define PSOC_OFF(m) offsetof(struct psoc_layout, m) +#define PSOC_PSU_OFF(m) offsetof(struct psoc_psu_layout, m) + +#define SWITCH_TMP_OFFSET PSOC_OFF(switch_temp) //0x01 +#define PWM_OFFSET PSOC_OFF(pwm) +#define PWM_PSU_OFFSET PSOC_OFF(pwm_psu) +#define THERMAL_OFFSET PSOC_OFF(temp) +#define RPM_OFFSET PSOC_OFF(fan) +//#define RPM_PSU_OFFSET PSOC_OFF(fan_psu) +#define DIAG_FLAG_OFFSET PSOC_OFF(ctl) +#define FAN_LED_OFFSET PSOC_OFF(led_grn) +#define FAN_GPI_OFFSET PSOC_OFF(gpi_fan) +#define PSOC_PSU_OFFSET PSOC_OFF(psu_state) +#define VERSION_OFFSET PSOC_OFF(version) +#define PSU_INFO_OFFSET PSOC_OFF(psu_info) + + +/* Each client has this additional data */ +struct psoc_data { + struct device *hwmon_dev; + struct mutex update_lock; + u32 diag; +}; + +/*-----------------------------------------------------------------------*/ + +static ssize_t psoc_i2c_read(struct i2c_client *client, u8 *buf, u8 offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg[0].buf = msgbuf; + msg[0].len = 1; + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].buf = buf; + msg[1].len = count; + + status = i2c_transfer(client->adapter, msg, 2); + + if(status == 2) + status = count; + + return status; +#endif +} + +static ssize_t psoc_i2c_write(struct i2c_client *client, char *buf, unsigned offset, size_t count) +{ +#if USE_SMBUS + int i; + + for(i=0; iaddr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = writebuf; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + return status; +#endif +} + +static u32 psoc_read32(struct i2c_client *client, u8 offset) +{ + u32 value = 0; + u8 buf[4]; + + if( psoc_i2c_read(client, buf, offset, 4) == 4) + value = (buf[0]<<24 | buf[1]<<16 | buf[2]<<8 | buf[3]); + + return value; +} + +static u16 psoc_read16(struct i2c_client *client, u8 offset) +{ + u16 value = 0; + u8 buf[2]; + + if(psoc_i2c_read(client, buf, offset, 2) == 2) + value = (buf[0]<<8 | buf[1]<<0); + + return value; +} + +static u8 psoc_read8(struct i2c_client *client, u8 offset) +{ + u8 value = 0; + u8 buf = 0; + + if(psoc_i2c_read(client, &buf, offset, 1) == 1) + value = buf; + + return value; +} + +static int psoc_write_value(struct i2c_client *client, unsigned offset, u16 value) +{ + //TBD + return 0; +} + + +//PSOC i2c bridge regsters +#define PSOC_I2C_STATUS PSOC_OFF(i2c_st) +#define PSOC_I2C_CNTRL PSOC_OFF(i2c_ctl) +#define PSOC_I2C_ADDR PSOC_OFF(i2c_addr) +#define PSOC_I2C_DATA PSOC_OFF(i2c_data) + +//status bit definition +#define PSOC_I2C_START (1 << 0) +#define PSOC_PMB_SEL (1 << 7) + +//addr bits definition +#define PSOC_I2C_READ (1 << 0) + +//PMBUS registers definition +#define PMBUS_READ_VIN (0x88) +#define PMBUS_READ_IIN (0x89) +#define PMBUS_READ_VOUT (0x8B) +#define PMBUS_READ_IOUT (0x8C) +#define PMBUS_READ_POUT (0x96) +#define PMBUS_READ_PIN (0x97) + +#define PMBUS_MFR_ID (0x99) +#define PMBUS_MFR_MODEL (0x9A) +#define PMBUS_MFR_REVISION (0x9B) +#define PMBUS_MFR_DATE (0x9D) +#define PMBUS_MFR_SERIAL (0x9E) + +static int psoc_i2c_bridge_read(struct i2c_client *client, + unsigned char bus, + unsigned char chip, + char *addr, int alen, + unsigned char *data, int len ) +{ + unsigned char txdata[28], rxdata[28]; + int index, timeout; + + txdata[PSOC_I2C_STATUS] = 0; /* the status */ + txdata[PSOC_I2C_CNTRL] = ((alen & 3) << 5) | (len & 0x1f); /* the sizes */ + txdata[PSOC_I2C_ADDR] = (chip << 1) | PSOC_I2C_READ; /* read address */ + for(index = 0; index < alen; index++) + txdata[PSOC_I2C_DATA + index] = addr[index]; /* the chip address */ + for(; index < alen+len; index++) + txdata[PSOC_I2C_DATA + index] = 0; /* clear the chip data */ + + psoc_i2c_write(client, &txdata[PSOC_I2C_CNTRL], PSOC_I2C_CNTRL, 2 + alen + len); + + //delay a while ??? + //--------------------------------------------------------------------- + //start write + txdata[PSOC_I2C_STATUS] = PSOC_I2C_START; /* the start bit*/ + if(bus) + txdata[PSOC_I2C_STATUS] |= PSOC_PMB_SEL;/* bus id */ + psoc_i2c_write(client, &txdata[PSOC_I2C_STATUS], PSOC_I2C_STATUS, 1); + + //delay a while + timeout = 40; //40*20==>800 ms + do { + psoc_i2c_read(client, &rxdata[PSOC_I2C_STATUS], PSOC_I2C_STATUS, 1); + + //check rxdata[5] error bit(1) and complete bit(0) ,TBD + if((rxdata[PSOC_I2C_STATUS] & 0x2) == 0x2) { + //printk("i2c bridge fail!!!\n"); + timeout = 0; + break; + } + if((rxdata[PSOC_I2C_STATUS] & PSOC_I2C_START) == 0) { + /* comand complete */ + psoc_i2c_read(client, &rxdata[PSOC_I2C_DATA+alen], PSOC_I2C_DATA+alen, len); + break; + } + + //delay + msleep(20); + } while(timeout--); + + if(timeout <= 0) { + return -1; + } + + //--------------------------------------------------------------------- + + for(index=0; index < len; index++) { + data[index] = rxdata[PSOC_I2C_DATA + alen + index]; + } + + return 0; +} + + +/* +CPLD report the PSU0 status +000 = PSU normal operation +100 = PSU fault +010 = PSU unpowered +111 = PSU not installed + +7 6 | 5 4 3 | 2 1 0 +---------------------- + | psu1 | psu0 +*/ +static char* psu_str[] = { + "normal", //000 + "NA", //001 + "unpowered", //010 + "NA", //011 + "fault", //100 + "NA", //101 + "NA", //110 + "not installed", //111 +}; + +static ssize_t show_psu_st(struct device *dev, struct device_attribute *da, + char *buf) +{ + u32 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 byte; + int shift = (attr->index == 0)?3:0; + + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client, &byte, PSOC_PSU_OFFSET, 1); + mutex_unlock(&data->update_lock); + + byte = (byte >> shift) & 0x7; + + status = sprintf (buf, "%d : %s\n", byte, psu_str[byte]); + + return strlen(buf); +} + +/*-----------------------------------------------------------------------*/ + +/* sysfs attributes for hwmon */ + +static ssize_t show_thermal(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index * 2 + THERMAL_OFFSET; + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, offset); + status = __swab16(status); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + (s8)(status>>8) * 1000 ); +} + + +static ssize_t show_pwm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + status); +} + +static ssize_t set_pwm(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index; + + u8 pwm = simple_strtol(buf, NULL, 10); + if(pwm > 255) pwm = 255; + + if(data->diag) { + mutex_lock(&data->update_lock); + psoc_i2c_write(client, &pwm, offset, 1); + mutex_unlock(&data->update_lock); + } + + return count; +} + + +static ssize_t show_rpm(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, offset); + status = __swab16(status); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + status); +} +static ssize_t show_fan_type(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 index = attr->index; + int type = -1; + + mutex_lock(&data->update_lock); + status = psoc_read8(client, FAN_GPI_OFFSET); + mutex_unlock(&data->update_lock); + + if( (status & 1<update_lock); + status = psoc_i2c_read(client, (u8*)&temp, SWITCH_TMP_OFFSET, 2); + status = __swab16(status); + mutex_unlock(&data->update_lock); + + status = sprintf (buf, "%d\n", (s8)(temp>>8) * 1000 ); + + return strlen(buf); +} + +static ssize_t set_switch_tmp(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + long temp = simple_strtol(buf, NULL, 10); + u16 temp2 = ( (temp/1000) <<8 ) & 0xFF00 ; + + //printk("set_switch_tmp temp=%d, temp2=0x%x (%x,%x)\n", temp, temp2, ( ( (temp/1000) <<8 ) & 0xFF00 ), (( (temp%1000) / 10 ) & 0xFF)); + + mutex_lock(&data->update_lock); + psoc_i2c_write(client, (u8*)&temp2, SWITCH_TMP_OFFSET, 2); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_diag(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 diag_flag = 0; + + mutex_lock(&data->update_lock); + status = psoc_i2c_read(client, (u8*)&diag_flag, DIAG_FLAG_OFFSET, 1); + mutex_unlock(&data->update_lock); + + data->diag = (diag_flag & 0x80)?1:0; + status = sprintf (buf, "%d\n", data->diag); + + return strlen(buf); +} + +static ssize_t set_diag(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) +{ + //struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 value = 0; + u8 diag = simple_strtol(buf, NULL, 10); + + diag = diag?1:0; + data->diag = diag; + + mutex_lock(&data->update_lock); + psoc_i2c_read(client, (u8*)&value, DIAG_FLAG_OFFSET, 1); + if(diag) value |= (1<<7); + else value &= ~(1<<7); + psoc_i2c_write(client, (u8*)&value, DIAG_FLAG_OFFSET, 1); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + //struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + status = psoc_read16(client, VERSION_OFFSET); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "ver: %x.%x\n", (status & 0xFF00)>>8, (status & 0xFF) ); +} + + +static ssize_t show_fan_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 bit = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, FAN_LED_OFFSET); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", + (status & (1<index; + u8 led_state = 0; + + u8 v = simple_strtol(buf, NULL, 10); + + if(data->diag) { + mutex_lock(&data->update_lock); + led_state = psoc_read8(client, FAN_LED_OFFSET); + if(v) led_state |= (1<update_lock); + } + + return count; +} + +static ssize_t show_value8(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index; + + mutex_lock(&data->update_lock); + + status = psoc_read8(client, offset); + + mutex_unlock(&data->update_lock); + + return sprintf(buf, "0x%02X\n", status ); +} + +static long pmbus_reg2data_linear(int data, int linear16) +{ + s16 exponent; + s32 mantissa; + long val; + + if (linear16) { /* LINEAR16 */ + exponent = -9; + mantissa = (u16) data; + } else { /* LINEAR11 */ + exponent = ((s16)data) >> 11; + exponent = ((s16)( data & 0xF800) ) >> 11; + mantissa = ((s32)((data & 0x7ff) << 5)) >> 5; + } + + //printk("data=%d, m=%d, e=%d\n", data, exponent, mantissa); + val = mantissa; + + /* scale result to micro-units for power sensors */ + val = val * 1000L; + + if (exponent >= 0) + val <<= exponent; + else + val >>= -exponent; + + return val; +} + +static ssize_t show_psu(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 reg = attr->index & 0xFF; + u8 len = ((attr->index & 0xFF00) >> 8); + u8 chip = (attr->index >> 16)? 0x59:0x58; + u8 bus = 1; + unsigned char value[2] = {0,0};; + + if (len == 2) + { + mutex_lock(&data->update_lock); + psoc_i2c_bridge_read(client, bus, chip, ®, 1, value, 2); + mutex_unlock(&data->update_lock); + + status = value[1]<<8 | value[0]; + //status1 = value[1]<<8 | value[0]; + + return sprintf(buf, "%ld\n", pmbus_reg2data_linear(status, (reg==PMBUS_READ_VOUT)?1:0) ); + } + else + { //len is not defined. + u8 tmpbuf[32]; + mutex_lock(&data->update_lock); + //length of block read + psoc_i2c_bridge_read(client, bus, chip, ®, 1, &len, 1); + //data included length + psoc_i2c_bridge_read(client, bus, chip, ®, 1, tmpbuf, len+1); + mutex_unlock(&data->update_lock); + + memcpy(buf, tmpbuf+1, len); + buf[len]='\n'; + + return len+1; + } +} + +static ssize_t show_psu_psoc(struct device *dev, struct device_attribute *da, + char *buf) +{ + u16 status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct psoc_data *data = i2c_get_clientdata(client); + u8 offset = attr->index + PSU_INFO_OFFSET; + + mutex_lock(&data->update_lock); + status = psoc_read16(client, offset); + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%ld \n", pmbus_reg2data_linear(status, strstr(attr->dev_attr.attr.name, "vout")? 1:0 )); +} + + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_thermal, 0, 0); +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_thermal, 0, 1); +static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_thermal, 0, 2); +static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_thermal, 0, 3); +static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_thermal, 0, 4); +static SENSOR_DEVICE_ATTR(thermal_psu1, S_IRUGO, show_thermal, 0, 5); +static SENSOR_DEVICE_ATTR(thermal_psu2, S_IRUGO, show_thermal, 0, 6); + +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+0); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+1); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+2); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+3); +#if (FAN_NUM >= 5) +static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_OFFSET+4); +#endif +static SENSOR_DEVICE_ATTR(pwm_psu1, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_PSU_OFFSET+0); +static SENSOR_DEVICE_ATTR(pwm_psu2, S_IWUSR|S_IRUGO, show_pwm, set_pwm, PWM_PSU_OFFSET+1); + +static SENSOR_DEVICE_ATTR(psu0, S_IRUGO, show_psu_st, 0, 0); +static SENSOR_DEVICE_ATTR(psu1, S_IRUGO, show_psu_st, 0, 1); + +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_rpm, 0, 0*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_rpm, 0, 1*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_rpm, 0, 2*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_rpm, 0, 3*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_rpm, 0, 4*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_rpm, 0, 5*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_rpm, 0, 6*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_rpm, 0, 7*2 + RPM_OFFSET); +#if (FAN_NUM >= 5) +static SENSOR_DEVICE_ATTR(fan9_input, S_IRUGO, show_rpm, 0, 8*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(fan10_input, S_IRUGO, show_rpm, 0, 9*2 + RPM_OFFSET); +#endif +static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8*2 + RPM_OFFSET); +static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9*2 + RPM_OFFSET); + +static SENSOR_DEVICE_ATTR(switch_tmp, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); +static SENSOR_DEVICE_ATTR(temp6_input, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); + +static SENSOR_DEVICE_ATTR(diag, S_IWUSR|S_IRUGO, show_diag, set_diag, 0); +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, 0, 0); + +static SENSOR_DEVICE_ATTR(fan_led_grn1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 0); +static SENSOR_DEVICE_ATTR(fan_led_grn2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 1); +static SENSOR_DEVICE_ATTR(fan_led_grn3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 2); +static SENSOR_DEVICE_ATTR(fan_led_grn4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 3); +static SENSOR_DEVICE_ATTR(fan_led_red1, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 4); +static SENSOR_DEVICE_ATTR(fan_led_red2, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 5); +static SENSOR_DEVICE_ATTR(fan_led_red3, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 6); +static SENSOR_DEVICE_ATTR(fan_led_red4, S_IWUSR|S_IRUGO, show_fan_led, set_fan_led, 7); + +static SENSOR_DEVICE_ATTR(fan_gpi, S_IRUGO, show_value8, 0, FAN_GPI_OFFSET); +static SENSOR_DEVICE_ATTR(fan1_type, S_IRUGO, show_fan_type, 0, 0); +static SENSOR_DEVICE_ATTR(fan2_type, S_IRUGO, show_fan_type, 0, 1); +static SENSOR_DEVICE_ATTR(fan3_type, S_IRUGO, show_fan_type, 0, 2); +static SENSOR_DEVICE_ATTR(fan4_type, S_IRUGO, show_fan_type, 0, 3); + +static SENSOR_DEVICE_ATTR(psu1_vin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_VIN); +static SENSOR_DEVICE_ATTR(psu1_vout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_VOUT); +static SENSOR_DEVICE_ATTR(psu1_iin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_IIN); +static SENSOR_DEVICE_ATTR(psu1_iout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_IOUT); +static SENSOR_DEVICE_ATTR(psu1_pin, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_PIN); +static SENSOR_DEVICE_ATTR(psu1_pout, S_IRUGO, show_psu, 0, (0<<16) | (2<<8) | PMBUS_READ_POUT); + +static SENSOR_DEVICE_ATTR(psu1_vendor, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_ID); +static SENSOR_DEVICE_ATTR(psu1_model, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu1_version, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu1_date, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_DATE); +static SENSOR_DEVICE_ATTR(psu1_sn, S_IRUGO, show_psu, 0, (0<<16) | (0<<8) | PMBUS_MFR_SERIAL); + +static SENSOR_DEVICE_ATTR(psu2_vin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_VIN); +static SENSOR_DEVICE_ATTR(psu2_vout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_VOUT); +static SENSOR_DEVICE_ATTR(psu2_iin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_IIN); +static SENSOR_DEVICE_ATTR(psu2_iout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_IOUT); +static SENSOR_DEVICE_ATTR(psu2_pin, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_PIN); +static SENSOR_DEVICE_ATTR(psu2_pout, S_IRUGO, show_psu, 0, (1<<16) | (2<<8) | PMBUS_READ_POUT); + +static SENSOR_DEVICE_ATTR(psu2_vendor, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_ID); +static SENSOR_DEVICE_ATTR(psu2_model, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu2_version, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu2_date, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_DATE); +static SENSOR_DEVICE_ATTR(psu2_sn, S_IRUGO, show_psu, 0, (1<<16) | (0<<8) | PMBUS_MFR_SERIAL); + +static SENSOR_DEVICE_ATTR(psoc_psu1_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu1_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pout)); + + +static SENSOR_DEVICE_ATTR(psoc_psu2_vin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_vout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_iout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iout)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); +static SENSOR_DEVICE_ATTR(psoc_psu2_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); + +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); + + + +static struct attribute *psoc_attributes[] = { + //thermal + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp3_input.dev_attr.attr, + &sensor_dev_attr_temp4_input.dev_attr.attr, + &sensor_dev_attr_temp5_input.dev_attr.attr, + + &sensor_dev_attr_thermal_psu1.dev_attr.attr, + &sensor_dev_attr_thermal_psu2.dev_attr.attr, + + + //pwm + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, +#if (FAN_NUM >= 5) + //&sensor_dev_attr_pwm5.dev_attr.attr, +#endif + &sensor_dev_attr_pwm_psu1.dev_attr.attr, + &sensor_dev_attr_pwm_psu2.dev_attr.attr, + + //rpm + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan6_input.dev_attr.attr, + &sensor_dev_attr_fan7_input.dev_attr.attr, + &sensor_dev_attr_fan8_input.dev_attr.attr, +#if (FAN_NUM >= 5) + //&sensor_dev_attr_fan9_input.dev_attr.attr, + //&sensor_dev_attr_fan10_input.dev_attr.attr, +#endif + + &sensor_dev_attr_rpm_psu1.dev_attr.attr, + &sensor_dev_attr_rpm_psu2.dev_attr.attr, + + //switch temperature + &sensor_dev_attr_switch_tmp.dev_attr.attr, + &sensor_dev_attr_temp6_input.dev_attr.attr, + + //diag flag + &sensor_dev_attr_diag.dev_attr.attr, + + //version + &sensor_dev_attr_version.dev_attr.attr, + + //fan led + &sensor_dev_attr_fan_led_grn1.dev_attr.attr, + &sensor_dev_attr_fan_led_grn2.dev_attr.attr, + &sensor_dev_attr_fan_led_grn3.dev_attr.attr, + &sensor_dev_attr_fan_led_grn4.dev_attr.attr, + &sensor_dev_attr_fan_led_red1.dev_attr.attr, + &sensor_dev_attr_fan_led_red2.dev_attr.attr, + &sensor_dev_attr_fan_led_red3.dev_attr.attr, + &sensor_dev_attr_fan_led_red4.dev_attr.attr, + + //fan GPI + &sensor_dev_attr_fan_gpi.dev_attr.attr, + + //fan type + &sensor_dev_attr_fan1_type.dev_attr.attr, + &sensor_dev_attr_fan2_type.dev_attr.attr, + &sensor_dev_attr_fan3_type.dev_attr.attr, + &sensor_dev_attr_fan4_type.dev_attr.attr, + + //psu + &sensor_dev_attr_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psu2_pout.dev_attr.attr, + + &sensor_dev_attr_psu1_vendor.dev_attr.attr, + &sensor_dev_attr_psu1_model.dev_attr.attr, + &sensor_dev_attr_psu1_version.dev_attr.attr, + &sensor_dev_attr_psu1_date.dev_attr.attr, + &sensor_dev_attr_psu1_sn.dev_attr.attr, + &sensor_dev_attr_psu2_vendor.dev_attr.attr, + &sensor_dev_attr_psu2_model.dev_attr.attr, + &sensor_dev_attr_psu2_version.dev_attr.attr, + &sensor_dev_attr_psu2_date.dev_attr.attr, + &sensor_dev_attr_psu2_sn.dev_attr.attr, + + &sensor_dev_attr_psu0.dev_attr.attr, + &sensor_dev_attr_psu1.dev_attr.attr, + + //psu_psoc, new added on psoc 1.9 + &sensor_dev_attr_psoc_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psoc_psu2_pout.dev_attr.attr, + + // Add new fields which matching standard + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + + NULL +}; + +static const struct attribute_group psoc_group = { + .attrs = psoc_attributes, +}; + +/*-----------------------------------------------------------------------*/ + +/* device probe and removal */ + +static int +psoc_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct psoc_data *data; + int status; + + printk("+%s\n", __func__); + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + return -EIO; + + data = kzalloc(sizeof(struct psoc_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->diag = 0; + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &psoc_group); + if (status) + goto exit_free; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: sensor '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &psoc_group); +exit_free: + i2c_set_clientdata(client, NULL); + kfree(data); + return status; +} + +static int psoc_remove(struct i2c_client *client) +{ + struct psoc_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &psoc_group); + i2c_set_clientdata(client, NULL); + kfree(data); + return 0; +} + +static const struct i2c_device_id psoc_ids[] = { + { "inv_psoc", 0, }, + { /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, psoc_ids); + +static struct i2c_driver psoc_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "inv_psoc", + }, + .probe = psoc_probe, + .remove = psoc_remove, + .id_table = psoc_ids, +}; + +/*-----------------------------------------------------------------------*/ + +/* module glue */ + +static int __init inv_psoc_init(void) +{ + return i2c_add_driver(&psoc_driver); +} + +static void __exit inv_psoc_exit(void) +{ + i2c_del_driver(&psoc_driver); +} + +MODULE_AUTHOR("eddie.lan "); +MODULE_DESCRIPTION("inv psoc driver"); +MODULE_LICENSE("GPL"); + +module_init(inv_psoc_init); +module_exit(inv_psoc_exit); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_pthread.c b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_pthread.c new file mode 100644 index 000000000000..b0f905d6a7d9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/modules/inv_pthread.c @@ -0,0 +1,1305 @@ +/***************************** + Redwood platform +******************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define SHOW_ATTR_WARNING ("N/A") +#define SHOW_ATTR_NOTPRINT ("Not Available") +#define SHOW_ATTR_NOTSUPPORT ("Not Support") + +#define INV_HWMID_MAX (10) +#define INV_HWMID_INIT (-1) + +/*access userspace data to kernel space*/ +#define ACC_R (0) +#define ACC_W (1) + +#define TINY_BUF_SIZE (8) +#define MAX_PATH_SIZE (64) +#define MIN_ACC_SIZE (32) +#define MAX_ACC_SIZE (256) + +/* + * LED definitions + */ +#define STATUS_LED_MODE_AUTO 0 +#define STATUS_LED_MODE_DIAG 1 +#define STATUS_LED_MODE_MANU 2 + +#define STATUS_LED_GRN0 10 // 0 - 000: off +#define STATUS_LED_GRN1 11 // 1 - 001: 0.5hz +#define STATUS_LED_GRN2 12 // 2 - 010: 1 hz +#define STATUS_LED_GRN3 13 // 3 - 011: 2 hz +#define STATUS_LED_GRN7 17 // 7 - 111: on +#define STATUS_LED_RED0 20 // 0 - 000: off +#define STATUS_LED_RED1 21 // 1 - 001: 0.5hz +#define STATUS_LED_RED2 22 // 2 - 010: 1 hz +#define STATUS_LED_RED3 23 // 3 - 011: 2 hz +#define STATUS_LED_RED7 27 // 7 - 111: on +#define STATUS_LED_INVALID 0 // Invalid + +ssize_t status_led_change(const char *path1, const char *tmp1, const char *path2, const char *tmp2); +ssize_t status_led_grn(const char *freq); +ssize_t status_led_red(const char *freq); +ssize_t status_led_diag_mode_enable(void); +ssize_t status_led_diag_mode_disable(void); +int status_led_check_color(void); +int status_led_check_diag_mode(void); + +#if 1 +/* For timestamps in SYSFS_LOG */ +#define SYSFS_LOG printk +#else +//#define SYSFS_LOG(fmt, args...) printk(KERN_WARNING "[SYSFS] %s/%d: " fmt, __func__, __LINE__, ##args) +#define SYSFS_LOG(fmt, args...) printk(KERN_WARNING "[p_thread] " fmt, ##args) +#endif + +#define INV_PTHREAD_KERNEL_MODULE (1) +#define SWITCH_HEALTH_LED_CHANGE_VIA_GPIO (1) + +/* inventec_class *********************************/ +static struct kobject *status_kobj; +static struct kset *status_kset; + + +static struct mutex rw_lock; + +static int hwm_psoc = INV_HWMID_INIT; +static int hwm_cpld = INV_HWMID_INIT; + +int get_hwm_psoc(void) +{ + return hwm_psoc; +} + +int get_hwm_cpld(void) +{ + return hwm_cpld; +} + +static ssize_t access_user_space(const char *name, int mode, char *buf, size_t len, loff_t offset) +{ + struct file *fp; + mm_segment_t fs; + loff_t pos = offset; + char *mark = NULL; + ssize_t vfs_ret = 0; + + if (mode == ACC_R) { + fp = filp_open(name, O_RDONLY, S_IRUGO); + if (IS_ERR(fp)) + return -ENODEV; + + fs = get_fs(); + set_fs(KERNEL_DS); + + vfs_ret = vfs_read(fp, buf, len, &pos); + + mark = strpbrk(buf, "\n"); + if (mark) + *mark = '\0'; + + filp_close(fp, NULL); + set_fs(fs); + } else if (mode == ACC_W) { + fp = filp_open(name, O_WRONLY, S_IWUSR | S_IRUGO); + if (IS_ERR(fp)) + return -ENODEV; + + fs = get_fs(); + set_fs(KERNEL_DS); + + vfs_ret = vfs_write(fp, buf, len, &pos); + filp_close(fp, NULL); + set_fs(fs); + } + + return vfs_ret; +} + +int inventec_strtol(const char *sbufp, char **endp, unsigned int base) +{ + char *endptr; + int value = simple_strtol(sbufp, &endptr, base); + if (value == 0 && sbufp == endptr) { + *endp = NULL; + return value; + } + *endp = (char*)1; + return value; +} + +int inventec_singlechar_to_int(const char c) +{ + if ((c >= '0') && (c <= '9')) { + return (c - '0'); + } + else + if ((c >= 'a') && (c <= 'f')) { + return (c - 'a' + 10); + } + else + if ((c >= 'A') && (c <= 'F')) { + return (c - 'A' + 10); + } + return -1; +} + +int inventec_store_input(char *inputp, int count) +{ + int i = 0; + while(inputp[i] != '\n' && inputp[i] != '\0' && i < count) { + i++; + } + inputp[i] = '\0'; + return strlen(inputp); +} + +#if 0 +/* + * Time stamps for kernel log on yocto + */ +#include + +void SYSFS_LOG(char *fmt, ...) +{ + char buf[80], ts[32]; + va_list args; + int hlen; + + inventec_tmstmp(&ts[0]); + hlen = sprintf(buf, "[SYSFS] %s ", ts); // Do not edit this line + + va_start(args, fmt); + vsprintf(&buf[hlen-1], fmt, args); + va_end(args); + printk(KERN_WARNING "[p_thread] %s\n", buf); +} +#endif + +ssize_t +inventec_show_attr(char *buf_p, const char *invdevp) +{ + int inv_len = MAX_ACC_SIZE; /* INV driver return max length */ + char tmp_buf[MAX_ACC_SIZE]; + char *str_negative = "-", *mark = NULL; + + /* [Step2] Get data by uaccess */ + memset(tmp_buf, 0, sizeof(tmp_buf)); + mutex_lock(&rw_lock); + if (access_user_space(invdevp, ACC_R, tmp_buf, inv_len, 0) < 0) { + /* u_access fail */ + mutex_unlock(&rw_lock); + return sprintf(buf_p, "%s\n", SHOW_ATTR_WARNING); + } + mutex_unlock(&rw_lock); + + /* [Step3] Check return value + * - Ex: When transceiver not plugged + * => SWPS return error code "-202" + * => Pic8 need return "NA" (assume) + */ + if (strcspn(tmp_buf, str_negative) == 0) { + /* error case: "-202" */ + return sprintf(buf_p, "%s\n", SHOW_ATTR_WARNING); + } + + /* OK case:*/ + mark = strpbrk(tmp_buf, "\n"); + if (mark) { *mark = '\0'; } + + return sprintf(buf_p, "%s\n", tmp_buf); +} + +ssize_t +inventec_store_attr(const char *buf_p, size_t count, const char *invdevp) +{ + ssize_t ret = 0; + + /* [Step2] Get data by uaccess */ + mutex_lock(&rw_lock); + if ((ret = access_user_space(invdevp, ACC_W, (char*)buf_p, count, 0)) < 0) { + /* u_access fail */ + mutex_unlock(&rw_lock); + return -EINVAL; + } + mutex_unlock(&rw_lock); + + /* OK case:*/ + return ret; +} + +int sysfs_detect_hwmon_index(void) +{ + char hwmon_buf[MAX_ACC_SIZE]; + char hwmon_path[MAX_PATH_SIZE]; + int hwid = 0; + + for (hwid = 0; + hwid < INV_HWMID_MAX && (hwm_psoc == INV_HWMID_INIT || hwm_cpld == INV_HWMID_INIT); + hwid++) { + memset(hwmon_buf, 0, sizeof(hwmon_buf)); + sprintf(hwmon_path, "/sys/class/hwmon/hwmon%d/device/name", hwid); + + inventec_show_attr(hwmon_buf, hwmon_path); + if (strncmp(hwmon_buf, "inv_psoc", 8) == 0) { + hwm_psoc = hwid; + } + else + if (strncmp(hwmon_buf, "inv_bmc", 7) == 0) { + hwm_psoc = hwid; + } + else + if (strncmp(hwmon_buf, "inv_cpld", 8) == 0) { + hwm_cpld = hwid; + } + } + if (hwid >= INV_HWMID_MAX) { + printk(KERN_ERR "[p_thread] detect hwmon index failed, psoc = %d, cpld = %d\n", hwm_psoc, hwm_cpld); + return -1; + } + printk(KERN_INFO "[p_thread] detect hwmon index success, psoc = %d, cpld = %d\n", hwm_psoc, hwm_cpld); + return 0; +} + +static int __init +inventec_class_init(void) +{ + mutex_init(&rw_lock); + +#ifdef INV_PTHREAD_KERNEL_MODULE + if (sysfs_detect_hwmon_index() < 0) { + return -1; + } +#endif + + printk(KERN_INFO "[p_thread] [%s/%d] Module initial success.\n",__func__,__LINE__); + + return 0; +} + +static void __exit +inventec_class_exit(void) +{ + printk(KERN_INFO "[p_thread] [%s/%d] Remove module.\n",__func__,__LINE__); +} + +/* fan device *************************************/ +#define FAN_DEV_PATH_STATE "/sys/class/hwmon/hwmon%d/device/fan_gpi" +#define FAN_DEV_PATH_FAN1_INPUT "/sys/class/hwmon/hwmon%d/device/fan1_input" +#define FAN_DEV_PATH_FAN2_INPUT "/sys/class/hwmon/hwmon%d/device/fan2_input" +#define FAN_DEV_PATH_FAN3_INPUT "/sys/class/hwmon/hwmon%d/device/fan3_input" +#define FAN_DEV_PATH_FAN4_INPUT "/sys/class/hwmon/hwmon%d/device/fan4_input" +#define FAN_DEV_PATH_FAN5_INPUT "/sys/class/hwmon/hwmon%d/device/fan5_input" +#define FAN_DEV_PATH_FAN6_INPUT "/sys/class/hwmon/hwmon%d/device/fan6_input" +#define FAN_DEV_PATH_FAN7_INPUT "/sys/class/hwmon/hwmon%d/device/fan7_input" +#define FAN_DEV_PATH_FAN8_INPUT "/sys/class/hwmon/hwmon%d/device/fan8_input" + +static char fan_dev_path_state[MAX_PATH_SIZE]; +static char fan_dev_path_fan1_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan2_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan3_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan4_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan5_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan6_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan7_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan8_input[MAX_PATH_SIZE]; + +void sysfs_fan_path_init(void) +{ + sprintf(&fan_dev_path_state[0], FAN_DEV_PATH_STATE, get_hwm_psoc()); + sprintf(&fan_dev_path_fan1_input[0],FAN_DEV_PATH_FAN1_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan2_input[0],FAN_DEV_PATH_FAN2_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan3_input[0],FAN_DEV_PATH_FAN3_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan4_input[0],FAN_DEV_PATH_FAN4_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan5_input[0],FAN_DEV_PATH_FAN5_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan6_input[0],FAN_DEV_PATH_FAN6_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan7_input[0],FAN_DEV_PATH_FAN7_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan8_input[0],FAN_DEV_PATH_FAN8_INPUT, get_hwm_psoc()); +} + +#define FAN_STATE_NORMAL "normal" +#define FAN_STATE_FAULTY "faulty" +#define FAN_STATE_UNINSTALLED "uninstalled" +#define FAN_STATE_UNKNOW "unknown state" +#define FAN_STATE_INVALID "Invalid state value" +#define FAN_STATE_READ_ERROR "state read error" + +#define FAN_LOG_UNINSTALLED "removed" +#define FAN_LOG_NORMAL "inserted" + +//#define FAN_STATE_BIT_NORMAL 0 +#define FAN_STATE_BIT_FAULTY 0 +#define FAN_STATE_BIT_UNINSTALLED 1 +#define FAN_STATE_BIT_UNKNOW 2 +#define FAN_STATE_BIT_INVALID 3 +#define FAN_STATE_BIT_READ_ERROR 4 + +static struct fans_tbl_s { + char *fan_name; + char *fan_front; + char *fan_rear; + unsigned int fan_state; +} fans_tbl[] = { + {"fan1", fan_dev_path_fan1_input, + fan_dev_path_fan2_input, 0}, + {"fan2", fan_dev_path_fan3_input, + fan_dev_path_fan4_input, 0}, + {"fan3", fan_dev_path_fan5_input, + fan_dev_path_fan6_input, 0}, + {"fan4", fan_dev_path_fan7_input, + fan_dev_path_fan8_input, 0}, +}; +#define FAN_TBL_TOTAL ( sizeof(fans_tbl)/ sizeof(const struct fans_tbl_s) ) + +#define FAN_STATE_CHECK(i,b) (fans_tbl[i].fan_state & (1< 0) + { + printk(KERN_ERR "[p_thread] All fans failed.\n"); + printk(KERN_ERR "[p_thread] System shutdown immediately in %d seconds.\n", cd_shutdown); + } + cd_shutdown -= 1; + } + return ret; +} + +/* End of faninfo_device */ + +static int __init +fan_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_fan_path_init(); +#endif + return 0; +} + + +static void __exit +fan_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove fan module.\n"); +} + +/* psu device *************************************/ +static unsigned int psu_voltin = 0; +#define PSU_VOLTIN_ACDC (70000) + +/* + * normal/unpower/uninstall/fault are PSU states output from driver level + * checkpsu/error are defined by sysfs + */ +#define PSU_STATE_VAL_NORMAL (0) +#define PSU_STATE_VAL_UNPOWER (2) +#define PSU_STATE_VAL_FAULT (4) +#define PSU_STATE_VAL_UNINSTALL (7) +#define PSU_STATE_VAL_CHECKPSU (8) +#define PSU_STATE_VAL_ERROR (9) + +#define PSU_STATE_NORMAL ("0 : normal") +#define PSU_STATE_UNPOWER ("2 : unpowered") +#define PSU_STATE_FAULT ("4 : fault") +#define PSU_STATE_UNINSTALL ("7 : not installed") +#define PSU_STATE_CHECKPSU ("8 : check psu") +#define PSU_STATE_ERROR ("9 : state error") + +#define PSU_STATE_LEN_NORMAL (strlen(PSU_STATE_NORMAL)) +#define PSU_STATE_LEN_UNPOWER (strlen(PSU_STATE_UNPOWER)) +#define PSU_STATE_LEN_FAULT (strlen(PSU_STATE_FAULT)) +#define PSU_STATE_LEN_UNINSTALL (strlen(PSU_STATE_UNINSTALL)) +#define PSU_STATE_LEN_CHECKPSU (strlen(PSU_STATE_CHECKPSU)) + +typedef struct { + char *inv_dev_attrp; + char *inv_dev_pathp; +} psu_dev_t; + +typedef struct { + const char *psu_name; + int psu_major; + dev_t psu_devt; + struct device *psu_dev_p; + psu_dev_t *psu_dev_namep; + int psu_dev_total; + char *psu_inv_pathp; + void *psu_tracking; + char *psu_currentin; + char *psu_currentout; + char *psu_powerin; + char *psu_powerout; + char *psu_voltin; + char *psu_voltout; +} psu_dev_group_t; + +#define PSU_DEV_PATH_TEMPLATE "/sys/class/hwmon/hwmon%d/device/%s" + +static char psu_dev_path_state[MAX_PATH_SIZE]; +static char psu_dev_path_psu_voltin[MAX_PATH_SIZE]; +#if 0 +static char psu_dev_path_vendor[MAX_PATH_SIZE]; +static char psu_dev_path_version[MAX_PATH_SIZE]; +static char psu_dev_path_sn[MAX_PATH_SIZE]; +static char psu_dev_path_temperature[MAX_PATH_SIZE]; +static char psu_dev_path_fan_speed[MAX_PATH_SIZE]; +static char psu_dev_path_fan_pwm[MAX_PATH_SIZE]; +static char psu_dev_path_fan_faulty[MAX_PATH_SIZE]; +static char psu_dev_path_psu_currentin[MAX_PATH_SIZE]; +static char psu_dev_path_psu_currentout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_powerin[MAX_PATH_SIZE]; +static char psu_dev_path_psu_powerout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_voltout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_pwm[MAX_PATH_SIZE]; +static char psu_dev_path_psu_rpm[MAX_PATH_SIZE]; +#endif + +void sysfs_psu_path_init(void) +{ + sprintf(&psu_dev_path_state[0], PSU_DEV_PATH_TEMPLATE, get_hwm_cpld(), "\%s" ); + sprintf(&psu_dev_path_psu_voltin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); +#if 0 + sprintf(&psu_dev_path_vendor[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_version[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_sn[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_temperature[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_speed[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_pwm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_faulty[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_currentin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_currentout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_powerin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_powerout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_voltout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_pwm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_rpm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); +#endif +} + +static psu_dev_t psu_dev_name[] = { + { "state", psu_dev_path_state }, // Using cpld + { "psu_voltin", psu_dev_path_psu_voltin }, +#if 0 + { "vendor", psu_dev_path_vendor }, + { "version", psu_dev_path_version }, + { "sn", psu_dev_path_sn }, + { "temperature", psu_dev_path_temperature }, + { "fan_speed", psu_dev_path_fan_speed }, + { "fan_pwm", psu_dev_path_fan_pwm }, + { "fan_faulty", psu_dev_path_fan_faulty }, + { "psu_currentin", psu_dev_path_psu_currentin }, + { "psu_currentout", psu_dev_path_psu_currentout }, + { "psu_powerin", psu_dev_path_psu_powerin }, + { "psu_powerout", psu_dev_path_psu_powerout }, + { "psu_voltout", psu_dev_path_psu_voltout }, + { "psu_pwm", psu_dev_path_psu_pwm }, + { "psu_rpm", psu_dev_path_psu_rpm }, +#endif +}; +#define PSU_DEV_NAME_TOTAL ( sizeof(psu_dev_name) / sizeof(const psu_dev_t) ) + +static psu_dev_group_t psu_dev_group[] = { + { + .psu_name = "psu1", + .psu_dev_namep = &psu_dev_name[0], + .psu_dev_total = sizeof(psu_dev_name) / sizeof(const psu_dev_t), + }, + { + .psu_name = "psu2", + .psu_dev_namep = &psu_dev_name[0], + .psu_dev_total = sizeof(psu_dev_name) / sizeof(const psu_dev_t), + }, +}; +#define PSU_DEV_GROUP_TOTAL ( sizeof(psu_dev_group)/ sizeof(const psu_dev_group_t) ) + +static char psu_state[4][MIN_ACC_SIZE]; + +static struct psu_wire_tbl_s { + char *psu_attr; + char *psu_name; + char *psu_wire; + char *psu_state; +} psu_wire_tbl[] = { + { "state", "psu1", "psu0", psu_state[0] }, // Using cpld + { "state", "psu2", "psu1", psu_state[1] }, + { "psu_voltin", "psu1", "psoc_psu1_vin", psu_state[2] }, + { "psu_voltin", "psu2", "psoc_psu2_vin", psu_state[3] }, +}; +#define PSU_WIRE_TBL_TOTAL ( sizeof(psu_wire_tbl)/ sizeof(const struct psu_wire_tbl_s) ) + +static char * +psu_attr_get_wirep(const char *psu_attrp, const char *psu_namep, char **psu_statepp) +{ + int i; + + for (i = 0; i < PSU_WIRE_TBL_TOTAL; i++) { + if (strncmp(psu_wire_tbl[i].psu_attr, psu_attrp, strlen(psu_attrp)) == 0 && + strncmp(psu_wire_tbl[i].psu_name, psu_namep, strlen(psu_namep)) == 0) { + if (psu_statepp) { + *psu_statepp = psu_wire_tbl[i].psu_state; + } + return psu_wire_tbl[i].psu_wire; + } + } + return NULL; +} + +int psu_check_state_normal(char *statep) +{ + if (strstr(statep, "normal")) { + return 1; + } + return 0; +} + +#define PSU_ATTR_VOLTIN ("psu_voltin") +#define PSU_ATTR_VOLTIN_LEN (10) + +/* Get PSU voltin for determon AC(110v) or DC(48v) */ +void psu_get_voltin(void) +{ + char acc_path[MAX_PATH_SIZE], volt[MIN_ACC_SIZE]; + psu_dev_t *devnamep; + unsigned int voltin; + char *invwirep; + int i, j; + + for (i = 0; i < PSU_DEV_GROUP_TOTAL; i++) { + //psu_dev_group[i].psu_name; + devnamep = psu_dev_group[i].psu_dev_namep; + for (j = 0; j < psu_dev_group[i].psu_dev_total; j++, devnamep++) { + if (strncmp(devnamep->inv_dev_attrp, PSU_ATTR_VOLTIN, PSU_ATTR_VOLTIN_LEN) == 0) { + invwirep = psu_attr_get_wirep(PSU_ATTR_VOLTIN, psu_dev_group[i].psu_name, NULL); + if (invwirep == NULL) { + printk(KERN_DEBUG "[p_thread] Invalid psuname: %s\n", psu_dev_group[i].psu_name); + continue; + } + sprintf(acc_path, devnamep->inv_dev_pathp, invwirep); + //printk(KERN_DEBUG "[p_thread] RYU: %s/%d: acc_path = %s\n",__func__,__LINE__,acc_path); + if (inventec_show_attr(volt, acc_path) <= 0) { + printk(KERN_DEBUG "[p_thread] Read %s failed\n", acc_path); + continue; + } + else { + voltin = simple_strtol(&volt[0], NULL, 10); + printk(KERN_DEBUG "[p_thread] Read %s %s = %u\n",acc_path,volt,voltin); + if (voltin > psu_voltin) { + psu_voltin = voltin; + } + } + } + } + } + + SYSFS_LOG("[p_thread] PSU voltin = %u\n", psu_voltin); +} + +#define PSU_ATTR_STATE ("state") +#define PSU_ATTR_STATE_LEN (5) + +/* psus_control() by inv_thread */ +int psus_control(int log_only) +{ + char acc_path[MAX_PATH_SIZE], state[MIN_ACC_SIZE]; + psu_dev_t *devnamep = NULL; + char *invwirep = NULL; + char *psu_statep = NULL; + int i, j, flag = 0; + + for (i = 0; i < PSU_DEV_GROUP_TOTAL; i++) { + devnamep = psu_dev_group[i].psu_dev_namep; + for (j = 0; j < psu_dev_group[i].psu_dev_total; j++, devnamep++) { + if (strncmp(devnamep->inv_dev_attrp, PSU_ATTR_STATE, PSU_ATTR_STATE_LEN) == 0) { + invwirep = psu_attr_get_wirep(PSU_ATTR_STATE, psu_dev_group[i].psu_name, &psu_statep); + if (invwirep == NULL) { + printk(KERN_DEBUG "[p_thread] Invalid psuname: %s\n", psu_dev_group[i].psu_name); + continue; + } + sprintf(acc_path, devnamep->inv_dev_pathp, invwirep); + //printk(KERN_INFO "[p_thread] RYU: %s/%d: acc_path = %s\n",__func__,__LINE__,acc_path); + if (inventec_show_attr(state, acc_path) <= 0) { + printk(KERN_DEBUG "[p_thread] Read %s failed\n", acc_path); + if (strncmp(psu_statep, PSU_STATE_ERROR, strlen(PSU_STATE_ERROR)) != 0) { + strcpy(psu_statep, PSU_STATE_ERROR); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,PSU_STATE_ERROR); + } + flag = 1; + } + else + if (strstr(state, "normal")) { + //printk(KERN_INFO "[p_thread] %s: %s\n", psu_dev_group[i].psu_name, state); + if (strncmp(psu_statep, state, strlen(state)) != 0) { + strcpy(psu_statep, state); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,state); + } + } + else + if (psu_voltin > PSU_VOLTIN_ACDC) { /* AC PSUS */ + //printk(KERN_INFO "[p_thread] RYU: %s: %s\n", psu_dev_group[i].psu_name, state); + if (strncmp(psu_statep, state, strlen(state)) != 0) { + strcpy(psu_statep, state); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,state); + } + flag = 1; + } + else { /* DC PSUS */ + if (strncmp(psu_statep, PSU_STATE_CHECKPSU, PSU_STATE_LEN_CHECKPSU) != 0) { + strcpy(psu_statep, PSU_STATE_CHECKPSU); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,PSU_STATE_CHECKPSU); + } + flag = 1; + } + } + } + } + + if (log_only) { + return 0; + } + + //SYSFS_LOG("[p_thread] RYU: %s: flag = %d\n",psu_wire_tbl[i].psu_name,flag); + if (flag == 1) { + status_led_grn("3"); + return 1; + } + return 0; +} + +/* End of psuinfo_device */ + +static int __init +psu_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_psu_path_init(); +#endif + return 0; +} + + +static void __exit +psu_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove psu module.\n"); +} + +/* led device *************************************/ +#define STATUS_LED_GRN_PATH "/sys/class/hwmon/hwmon%d/device/grn_led" +#define STATUS_LED_RED_PATH "/sys/class/hwmon/hwmon%d/device/red_led" + +#define FAN_LED_GRN1_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn1" +#define FAN_LED_GRN2_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn2" +#define FAN_LED_GRN3_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn3" +#define FAN_LED_GRN4_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn4" +#define FAN_LED_RED1_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red1" +#define FAN_LED_RED2_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red2" +#define FAN_LED_RED3_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red3" +#define FAN_LED_RED4_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red4" + +#define HWMON_DEVICE_DIAG_PATH "/sys/class/hwmon/hwmon%d/device/diag" +#define HWMON_DEVICE_CTRL_PATH "/sys/class/hwmon/hwmon%d/device/ctl" + +static char status_led_grn_path[MAX_PATH_SIZE]; +static char status_led_red_path[MAX_PATH_SIZE]; +static char fan_led_grn1_path[MAX_PATH_SIZE]; +static char fan_led_grn2_path[MAX_PATH_SIZE]; +static char fan_led_grn3_path[MAX_PATH_SIZE]; +static char fan_led_grn4_path[MAX_PATH_SIZE]; +static char fan_led_red1_path[MAX_PATH_SIZE]; +static char fan_led_red2_path[MAX_PATH_SIZE]; +static char fan_led_red3_path[MAX_PATH_SIZE]; +static char fan_led_red4_path[MAX_PATH_SIZE]; +static char hwmon_device_diag_path[MAX_PATH_SIZE]; +static char hwmon_device_ctrl_path[MAX_PATH_SIZE]; + +void sysfs_led_path_init(void) +{ + sprintf(&status_led_grn_path[0], STATUS_LED_GRN_PATH, get_hwm_cpld()); + sprintf(&status_led_red_path[0], STATUS_LED_RED_PATH, get_hwm_cpld()); + sprintf(&fan_led_grn1_path[0], FAN_LED_GRN1_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn2_path[0], FAN_LED_GRN2_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn3_path[0], FAN_LED_GRN3_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn4_path[0], FAN_LED_GRN4_PATH, get_hwm_psoc()); + sprintf(&fan_led_red1_path[0], FAN_LED_RED1_PATH, get_hwm_psoc()); + sprintf(&fan_led_red2_path[0], FAN_LED_RED2_PATH, get_hwm_psoc()); + sprintf(&fan_led_red3_path[0], FAN_LED_RED3_PATH, get_hwm_psoc()); + sprintf(&fan_led_red4_path[0], FAN_LED_RED4_PATH, get_hwm_psoc()); + sprintf(&hwmon_device_diag_path[0], HWMON_DEVICE_DIAG_PATH, get_hwm_psoc()); + sprintf(&hwmon_device_ctrl_path[0], HWMON_DEVICE_CTRL_PATH, get_hwm_cpld()); +} + +/* return 0/off 1/green 2/red */ +int +status_led_check_color(void) +{ + char tmpbuf[MIN_ACC_SIZE]; + int ret = STATUS_LED_INVALID; + + if (inventec_show_attr(&tmpbuf[0], status_led_grn_path) > 0) { + if (tmpbuf[0] == '0') { + ret = STATUS_LED_GRN0; + } + if (tmpbuf[0] == '1') { + ret = STATUS_LED_GRN1; + } + if (tmpbuf[0] == '2') { + ret = STATUS_LED_GRN2; + } + if (tmpbuf[0] == '3') { + ret = STATUS_LED_GRN3; + } + if (tmpbuf[0] == '7') { + ret = STATUS_LED_GRN7; + } + return ret; + } + + if (inventec_show_attr(&tmpbuf[0], status_led_red_path) > 0) { + if (tmpbuf[0] == '0') { + ret = STATUS_LED_RED0; + } + if (tmpbuf[0] == '1') { + ret = STATUS_LED_RED1; + } + if (tmpbuf[0] == '2') { + ret = STATUS_LED_RED2; + } + if (tmpbuf[0] == '3') { + ret = STATUS_LED_RED3; + } + if (tmpbuf[0] == '7') { + ret = STATUS_LED_RED7; + } + return ret; + } + return ret; +} + +/* + * Store attr Section + */ +static DEFINE_MUTEX(diag_mutex); + +ssize_t status_led_diag_mode_enable(void) +{ + char tmp[MIN_ACC_SIZE]; + ssize_t ret; + + ret = inventec_show_attr(&tmp[0], hwmon_device_diag_path); + if (ret <= 0) { + return ret; + } + + if (tmp[0] == '0') { + mutex_lock(&diag_mutex); + ret = inventec_store_attr("1", 1, hwmon_device_diag_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return ret; + } + + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return ret; + } + mutex_unlock(&diag_mutex); + } + + return ret; +} + +ssize_t status_led_diag_mode_disable(void) +{ + char tmp[MIN_ACC_SIZE]; + ssize_t ret; + + ret = inventec_show_attr(&tmp[0], hwmon_device_diag_path); + if (ret <= 0) { + return ret; + } + + if (tmp[0] == '1') { + mutex_lock(&diag_mutex); + ret = inventec_store_attr("0", 1, hwmon_device_diag_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return 1; + } + + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return 1; + } + mutex_unlock(&diag_mutex); + } + return 1; +} + +ssize_t +status_led_change(const char *path1, const char *tmp1, const char *path2, const char *tmp2) +{ + ssize_t ret; + + ret = inventec_store_attr(tmp1, strlen(tmp1), path1); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(tmp2, strlen(tmp2), path2); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_led_red(const char *freq) +{ + ssize_t ret; + + ret = inventec_store_attr("0", 1, &status_led_grn_path[0]); + + if (ret < 0) { + return ret; + } + + ret = inventec_store_attr(freq, strlen(freq), &status_led_red_path[0]); + + if (ret < 0) { + return ret; + } + + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_led_grn(const char *freq) +{ + ssize_t ret; + + ret = inventec_store_attr("0", 1, &status_led_red_path[0]); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(freq, strlen(freq), &status_led_grn_path[0]); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +static int status_led_diag_mode = STATUS_LED_MODE_AUTO; + +int status_led_check_diag_mode(void) +{ + return status_led_diag_mode; +} + +/* End of ledinfo_device */ + +static int __init +led_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_led_path_init(); +#endif + return 0; +} + + +static void __exit +led_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove led module.\n"); +} + +/* sensor device **********************************/ +#define SENSOR_DEV_PATH_SWITCH_TEMP "/sys/class/hwmon/hwmon%d/device/switch_tmp" + +static char sensor_dev_path_switch_temp[MAX_PATH_SIZE]; + +void sysfs_sensor_path_init(void) +{ + sprintf(&sensor_dev_path_switch_temp[0], SENSOR_DEV_PATH_SWITCH_TEMP, get_hwm_psoc()); +} + +void switch_temp_update(void) +{ + char buf[MIN_ACC_SIZE]; + ssize_t count = inventec_show_attr(&buf[0], "proc/switch/temp"); + if (count > 0) { + //printk(KERN_ERR "[p_thread] [STEMP] Switch temperature is out of range: %d\n", stemp); + inventec_store_attr(&buf[0], count, sensor_dev_path_switch_temp); + } +} + +/**************************************************/ +/* From system_device */ +static int inv_pthread_control = 1; + +int thread_control(void) +{ + return inv_pthread_control; +} + +void thread_control_set(int val) +{ + inv_pthread_control = val; +} +/* End system_device */ + +#define THREAD_SLEEP_MINS (3) +#define THREAD_DELAY_MINS (THREAD_SLEEP_MINS + THREAD_SLEEP_MINS + 1) + +extern void psu_get_voltin(void); + +static struct task_struct *thread_st; +static int thread_data; + +#ifdef SWITCH_HEALTH_LED_CHANGE_VIA_GPIO +void led_set_gpio_to_change_status_led(void) +{ + ssize_t ret = inventec_store_attr("253", 3, "/sys/class/gpio/export"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 253 to /sys/class/gpio/export failed\n"); + return; + } + + printk("[p_thread] Write 253 to /sys/class/gpio/export\n"); + + ret = inventec_store_attr("out", 3, "/sys/class/gpio/gpio253/direction"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write low to /sys/class/gpio/gpio253/direction failed\n"); + return; + } + + //pull high and then low + ret = inventec_store_attr("1", 1, "sys/class/gpio/gpio253/value"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 1 to sys/class/gpio/gpio253/value failed\n"); + } + + //pull low + ret = inventec_store_attr("0", 1, "sys/class/gpio/gpio253/value"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 0 to sys/class/gpio/gpio253/value failed\n"); + } + + SYSFS_LOG("[p_thread] Set gpio to support status led change successfully\n"); +} +#endif + +// Function executed by kernel thread +static int thread_fn(void *unused) +{ + /* Delay for guarantee HW ready */ + ssleep(THREAD_DELAY_MINS); + +#ifndef INV_PTHREAD_KERNEL_MODULE + sysfs_led_path_init(); + sysfs_fan_path_init(); + sysfs_psu_path_init(); +#endif + //sysfs_sensor_path_init(); + + /* Default status init */ + status_led_grn("7"); + + psu_get_voltin(); + +#ifdef SWITCH_HEALTH_LED_CHANGE_VIA_GPIO + led_set_gpio_to_change_status_led(); +#endif + + while (1) + { + ssleep(THREAD_SLEEP_MINS); + + if (thread_control() == 0) { + printk(KERN_INFO "[p_thread] %s/%d: Thread Stop by inv_pthread control\n",__func__,__LINE__); + break; + } + + if (status_led_check_diag_mode() == STATUS_LED_MODE_MANU) { + /* status led in change color/freq mode, higher priority. Ignore fans sttaus */ + continue; + } + + // switch_temp_update(); + + if (fans_control() > 0) { + psus_control(1); + continue; + } + else + if (psus_control(0) > 0) { + continue; + } + + if (status_led_check_color() != STATUS_LED_GRN7) { /* status led red, change it to green */ + status_led_grn("7"); + } + } + +#ifndef INV_PTHREAD_KERNEL_MODULE +err_inv_pthread_fn_1: +#endif + do_exit(0); + printk(KERN_INFO "[p_thread] %s/%d: Thread Stopped\n",__func__,__LINE__); + return 0; +} + + +static ssize_t s_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + int fan_absence; + size_t count; + + fan_absence = fans_control(); + count += sprintf(&buf[count], "%d\n", fan_absence); + return count; +} + +static ssize_t s_store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) +{ + return count; +} + +static struct attribute status_att = { + .name = "fan_absence", + .mode = 0777, +}; + +static const struct sysfs_ops status_ops = { + .show = s_show, + .store = s_store, +}; + +static struct kobj_type status_ktype = { + .sysfs_ops = &status_ops, +}; + + +static int __init inv_pthread_init(void) +{ + int retval; + + status_kobj = kzalloc(sizeof(*status_kobj), GFP_KERNEL); + if(!status_kobj) + return PTR_ERR(status_kobj); + + status_kset = kset_create_and_add("platform_status", NULL, kernel_kobj); + if(!status_kset) + return -1; + + status_kobj->kset = status_kset; + + retval = kobject_init_and_add(status_kobj, &status_ktype, NULL, "fan"); + if(retval) + return retval; + + retval = sysfs_create_file(status_kobj, &status_att); + + + inventec_class_init(); + fan_device_init(); + psu_device_init(); + led_device_init(); + + thread_control_set(1); + + printk(KERN_INFO "[p_thread] %s/%d: Creating Thread\n",__func__,__LINE__); + //Create the kernel thread with name 'inv_pthread' + thread_st = kthread_run(thread_fn, (void*)&thread_data, "inv_pthread"); + if (thread_st) + printk(KERN_INFO "[p_thread] inv_pthread Created successfully\n"); + else + printk(KERN_ERR "[p_thread] inv_pthread creation failed\n"); + + return retval; +} + +static void __exit inv_pthread_exit(void) +{ + thread_control_set(0); + /* Delay for guarantee thread exit */ + ssleep(THREAD_DELAY_MINS); + + fan_device_exit(); + psu_device_exit(); + led_device_exit(); + inventec_class_exit(); + + sysfs_remove_file(status_kobj, &status_att); + kset_unregister(status_kset); + kobject_del(status_kobj); + + printk(KERN_INFO "[p_thread] inv_pthread cleaning Up\n"); +} + +module_init(inv_pthread_init); +module_exit(inv_pthread_exit); + +MODULE_AUTHOR("Robert "); +MODULE_DESCRIPTION("Inventec Platform Management Thread"); +MODULE_VERSION("version 1.0"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/inventec_d7032_util.py b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/inventec_d7032_util.py index f6f5e46c5536..6625efc00ed2 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/inventec_d7032_util.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d7032q28b/utils/inventec_d7032_util.py @@ -124,7 +124,8 @@ def exec_cmd(cmd, show): 'inv_platform', 'inv_psoc', 'inv_cpld', -'swps'] +'swps', +'inv_pthread'] @@ -134,6 +135,9 @@ def system_install(): #remove default drivers to avoid modprobe order conflicts status, output = exec_cmd("rmmod i2c_ismt ", 1) status, output = exec_cmd("rmmod i2c-i801 ", 1) + status, output = exec_cmd("rmmod gpio_ich",1) + status, output = exec_cmd("insmod /lib/modules/3.16.0-5-amd64/extra/gpio-ich.ko gpiobase=0",1) + #install drivers for i in range(0,len(drivers)): status, output = exec_cmd("modprobe "+drivers[i], 1) @@ -196,6 +200,7 @@ def install(): def uninstall(): global FORCE + exec_cmd("rmmod gpio_ich",1) #uninstall drivers for i in range(len(drivers)-1,-1,-1): status, output = exec_cmd("rmmod "+drivers[i], 1) diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/Makefile b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/Makefile index aeffa4376588..37cbc2f4e8be 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/Makefile @@ -1,5 +1,6 @@ obj-m += inv_cpld.o inv_psoc.o obj-m += inv_platform.o +obj-m += inv_pthread.o obj-m += inv_eeprom.o obj-m += swps.o swps-objs := inv_swps.o io_expander.o transceiver.o diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_psoc.c b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_psoc.c index d6eb6fd2d98d..8b14419e050c 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_psoc.c +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_psoc.c @@ -802,6 +802,7 @@ static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8); static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9); static SENSOR_DEVICE_ATTR(switch_tmp, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); +static SENSOR_DEVICE_ATTR(temp6_input, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); static SENSOR_DEVICE_ATTR(diag, S_IWUSR|S_IRUGO, show_diag, set_diag, 0); static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, 0, 0); @@ -831,6 +832,14 @@ static SENSOR_DEVICE_ATTR(psoc_psu2_iout, S_IRUGO, show_psu_psoc, static SENSOR_DEVICE_ATTR(psoc_psu2_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); static SENSOR_DEVICE_ATTR(psoc_psu2_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); + + //IPMI static SENSOR_DEVICE_ATTR(thermal2_psu1, S_IRUGO, show_ipmi_i2c, 0, PSU1 | PMBus_Temp2); static SENSOR_DEVICE_ATTR(psoc_psu1_vender, S_IRUGO, show_ipmi_i2c, 0, PSU1 | PMBus_Vender); @@ -880,6 +889,7 @@ static struct attribute *psoc_attributes[] = { //switch temperature &sensor_dev_attr_switch_tmp.dev_attr.attr, + &sensor_dev_attr_temp6_input.dev_attr.attr, //diag flag &sensor_dev_attr_diag.dev_attr.attr, @@ -917,6 +927,14 @@ static struct attribute *psoc_attributes[] = { &sensor_dev_attr_psoc_psu2_pin.dev_attr.attr, &sensor_dev_attr_psoc_psu2_pout.dev_attr.attr, + // Add new fields which matching standard + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + //ipmi_command &sensor_dev_attr_thermal2_psu1.dev_attr.attr, &sensor_dev_attr_psoc_psu1_vender.dev_attr.attr, diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_pthread.c b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_pthread.c new file mode 100644 index 000000000000..4ca41e432be1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/modules/inv_pthread.c @@ -0,0 +1,1284 @@ +/***************************** + Cypress platform +******************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define INV_PTHREAD_KERNEL_MODULE + +#define SHOW_ATTR_WARNING ("N/A") +#define SHOW_ATTR_NOTPRINT ("Not Available") +#define SHOW_ATTR_NOTSUPPORT ("Not Support") + +#define INV_HWMID_MAX (10) +#define INV_HWMID_INIT (-1) + +/*access userspace data to kernel space*/ +#define ACC_R (0) +#define ACC_W (1) + +#define TINY_BUF_SIZE (8) +#define MAX_PATH_SIZE (64) +#define MIN_ACC_SIZE (32) +#define MAX_ACC_SIZE (256) + +/* + * LED definitions + */ +#define STATUS_LED_MODE_AUTO 0 +#define STATUS_LED_MODE_DIAG 1 +#define STATUS_LED_MODE_MANU 2 + +#define STATUS_LED_GRN0 10 // 0 - 000: off +#define STATUS_LED_GRN1 11 // 1 - 001: 0.5hz +#define STATUS_LED_GRN2 12 // 2 - 010: 1 hz +#define STATUS_LED_GRN3 13 // 3 - 011: 2 hz +#define STATUS_LED_GRN7 17 // 7 - 111: on +#define STATUS_LED_RED0 20 // 0 - 000: off +#define STATUS_LED_RED1 21 // 1 - 001: 0.5hz +#define STATUS_LED_RED2 22 // 2 - 010: 1 hz +#define STATUS_LED_RED3 23 // 3 - 011: 2 hz +#define STATUS_LED_RED7 27 // 7 - 111: on +#define STATUS_LED_INVALID 0 // Invalid + +ssize_t status_led_change(const char *path1, const char *tmp1, const char *path2, const char *tmp2); +ssize_t status_led_grn(const char *freq); +ssize_t status_led_red(const char *freq); +ssize_t status_led_diag_mode_enable(void); +ssize_t status_led_diag_mode_disable(void); +int status_led_check_color(void); +int status_led_check_diag_mode(void); + +#if 1 +/* For timestamps in SYSFS_LOG */ +#define SYSFS_LOG printk +#else +//#define SYSFS_LOG(fmt, args...) printk(KERN_WARNING "[SYSFS] %s/%d: " fmt, __func__, __LINE__, ##args) +#define SYSFS_LOG(fmt, args...) printk(KERN_WARNING "[p_thread] " fmt, ##args) +#endif + + +/* inventec_class *********************************/ +static struct kobject *status_kobj; +static struct kset *status_kset; + + +static struct mutex rw_lock; + +static int hwm_psoc = INV_HWMID_INIT; +static int hwm_cpld = INV_HWMID_INIT; + +int get_hwm_psoc(void) +{ + return hwm_psoc; +} + +int get_hwm_cpld(void) +{ + return hwm_cpld; +} + +static ssize_t access_user_space(const char *name, int mode, char *buf, size_t len, loff_t offset) +{ + struct file *fp; + mm_segment_t fs; + loff_t pos = offset; + char *mark = NULL; + ssize_t vfs_ret = 0; + + if (mode == ACC_R) { + fp = filp_open(name, O_RDONLY, S_IRUGO); + if (IS_ERR(fp)) + return -ENODEV; + + fs = get_fs(); + set_fs(KERNEL_DS); + + vfs_ret = vfs_read(fp, buf, len, &pos); + + mark = strpbrk(buf, "\n"); + if (mark) + *mark = '\0'; + + filp_close(fp, NULL); + set_fs(fs); + } else if (mode == ACC_W) { + fp = filp_open(name, O_WRONLY, S_IWUSR | S_IRUGO); + if (IS_ERR(fp)) + return -ENODEV; + + fs = get_fs(); + set_fs(KERNEL_DS); + + vfs_ret = vfs_write(fp, buf, len, &pos); + filp_close(fp, NULL); + set_fs(fs); + } + + return vfs_ret; +} + +int inventec_strtol(const char *sbufp, char **endp, unsigned int base) +{ + char *endptr; + int value = simple_strtol(sbufp, &endptr, base); + if (value == 0 && sbufp == endptr) { + *endp = NULL; + return value; + } + *endp = (char*)1; + return value; +} + +int inventec_singlechar_to_int(const char c) +{ + if ((c >= '0') && (c <= '9')) { + return (c - '0'); + } + else + if ((c >= 'a') && (c <= 'f')) { + return (c - 'a' + 10); + } + else + if ((c >= 'A') && (c <= 'F')) { + return (c - 'A' + 10); + } + return -1; +} + +int inventec_store_input(char *inputp, int count) +{ + int i = 0; + while(inputp[i] != '\n' && inputp[i] != '\0' && i < count) { + i++; + } + inputp[i] = '\0'; + return strlen(inputp); +} + +#if 0 +/* + * Time stamps for kernel log on yocto + */ +#include + +void SYSFS_LOG(char *fmt, ...) +{ + char buf[80], ts[32]; + va_list args; + int hlen; + + inventec_tmstmp(&ts[0]); + hlen = sprintf(buf, "[SYSFS] %s ", ts); // Do not edit this line + + va_start(args, fmt); + vsprintf(&buf[hlen-1], fmt, args); + va_end(args); + printk(KERN_WARNING "[p_thread] %s\n", buf); +} +#endif + +ssize_t +inventec_show_attr(char *buf_p, const char *invdevp) +{ + int inv_len = MAX_ACC_SIZE; /* INV driver return max length */ + char tmp_buf[MAX_ACC_SIZE]; + char *str_negative = "-", *mark = NULL; + + /* [Step2] Get data by uaccess */ + memset(tmp_buf, 0, sizeof(tmp_buf)); + mutex_lock(&rw_lock); + if (access_user_space(invdevp, ACC_R, tmp_buf, inv_len, 0) < 0) { + /* u_access fail */ + mutex_unlock(&rw_lock); + return sprintf(buf_p, "%s\n", SHOW_ATTR_WARNING); + } + mutex_unlock(&rw_lock); + + /* [Step3] Check return value + * - Ex: When transceiver not plugged + * => SWPS return error code "-202" + * => Pic8 need return "NA" (assume) + */ + if (strcspn(tmp_buf, str_negative) == 0) { + /* error case: "-202" */ + return sprintf(buf_p, "%s\n", SHOW_ATTR_WARNING); + } + + /* OK case:*/ + mark = strpbrk(tmp_buf, "\n"); + if (mark) { *mark = '\0'; } + + return sprintf(buf_p, "%s\n", tmp_buf); +} + +ssize_t +inventec_store_attr(const char *buf_p, size_t count, const char *invdevp) +{ + ssize_t ret = 0; + + /* [Step2] Get data by uaccess */ + mutex_lock(&rw_lock); + if ((ret = access_user_space(invdevp, ACC_W, (char*)buf_p, count, 0)) < 0) { + /* u_access fail */ + mutex_unlock(&rw_lock); + return -EINVAL; + } + mutex_unlock(&rw_lock); + + /* OK case:*/ + return ret; +} + +int sysfs_detect_hwmon_index(void) +{ + char hwmon_buf[MAX_ACC_SIZE]; + char hwmon_path[MAX_PATH_SIZE]; + int hwid = 0; + + for (hwid = 0; + hwid < INV_HWMID_MAX && (hwm_psoc == INV_HWMID_INIT || hwm_cpld == INV_HWMID_INIT); + hwid++) { + memset(hwmon_buf, 0, sizeof(hwmon_buf)); + sprintf(hwmon_path, "/sys/class/hwmon/hwmon%d/device/name", hwid); + + inventec_show_attr(hwmon_buf, hwmon_path); + if (strncmp(hwmon_buf, "inv_psoc", 8) == 0) { + hwm_psoc = hwid; + } + else + if (strncmp(hwmon_buf, "inv_bmc", 7) == 0) { + hwm_psoc = hwid; + } + else + if (strncmp(hwmon_buf, "inv_cpld", 8) == 0) { + hwm_cpld = hwid; + } + } + if (hwid >= INV_HWMID_MAX) { + printk(KERN_ERR "[p_thread] detect hwmon index failed, psoc = %d, cpld = %d\n", hwm_psoc, hwm_cpld); + return -1; + } + printk(KERN_INFO "[p_thread] detect hwmon index success, psoc = %d, cpld = %d\n", hwm_psoc, hwm_cpld); + return 0; +} + +static int __init +inventec_class_init(void) +{ + mutex_init(&rw_lock); + +#ifdef INV_PTHREAD_KERNEL_MODULE + if (sysfs_detect_hwmon_index() < 0) { + return -1; + } +#endif + + printk(KERN_INFO "[p_thread] [%s/%d] Module initial success.\n",__func__,__LINE__); + + return 0; +} + +static void __exit +inventec_class_exit(void) +{ + printk(KERN_INFO "[p_thread] [%s/%d] Remove module.\n",__func__,__LINE__); +} + +/* fan device *************************************/ +#define FAN_DEV_PATH_STATE "/sys/class/hwmon/hwmon%d/device/fan_gpi" +#define FAN_DEV_PATH_FAN1_INPUT "/sys/class/hwmon/hwmon%d/device/fan1_input" +#define FAN_DEV_PATH_FAN2_INPUT "/sys/class/hwmon/hwmon%d/device/fan2_input" +#define FAN_DEV_PATH_FAN3_INPUT "/sys/class/hwmon/hwmon%d/device/fan3_input" +#define FAN_DEV_PATH_FAN4_INPUT "/sys/class/hwmon/hwmon%d/device/fan4_input" +#define FAN_DEV_PATH_FAN5_INPUT "/sys/class/hwmon/hwmon%d/device/fan5_input" +#define FAN_DEV_PATH_FAN6_INPUT "/sys/class/hwmon/hwmon%d/device/fan6_input" +#define FAN_DEV_PATH_FAN7_INPUT "/sys/class/hwmon/hwmon%d/device/fan7_input" +#define FAN_DEV_PATH_FAN8_INPUT "/sys/class/hwmon/hwmon%d/device/fan8_input" + +static char fan_dev_path_state[MAX_PATH_SIZE]; +static char fan_dev_path_fan1_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan2_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan3_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan4_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan5_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan6_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan7_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan8_input[MAX_PATH_SIZE]; + +void sysfs_fan_path_init(void) +{ + sprintf(&fan_dev_path_state[0], FAN_DEV_PATH_STATE, get_hwm_psoc()); + sprintf(&fan_dev_path_fan1_input[0],FAN_DEV_PATH_FAN1_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan2_input[0],FAN_DEV_PATH_FAN2_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan3_input[0],FAN_DEV_PATH_FAN3_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan4_input[0],FAN_DEV_PATH_FAN4_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan5_input[0],FAN_DEV_PATH_FAN5_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan6_input[0],FAN_DEV_PATH_FAN6_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan7_input[0],FAN_DEV_PATH_FAN7_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan8_input[0],FAN_DEV_PATH_FAN8_INPUT, get_hwm_psoc()); +} + +#define FAN_STATE_NORMAL "normal" +#define FAN_STATE_FAULTY "faulty" +#define FAN_STATE_UNINSTALLED "uninstalled" +#define FAN_STATE_UNKNOW "unknown state" +#define FAN_STATE_INVALID "Invalid state value" +#define FAN_STATE_READ_ERROR "state read error" + +#define FAN_LOG_UNINSTALLED "removed" +#define FAN_LOG_NORMAL "inserted" + +//#define FAN_STATE_BIT_NORMAL 0 +#define FAN_STATE_BIT_FAULTY 0 +#define FAN_STATE_BIT_UNINSTALLED 1 +#define FAN_STATE_BIT_UNKNOW 2 +#define FAN_STATE_BIT_INVALID 3 +#define FAN_STATE_BIT_READ_ERROR 4 + +static struct fans_tbl_s { + char *fan_name; + char *fan_front; + char *fan_rear; + unsigned int fan_state; +} fans_tbl[] = { + {"fan1", fan_dev_path_fan1_input, + fan_dev_path_fan2_input, 0}, + {"fan2", fan_dev_path_fan3_input, + fan_dev_path_fan4_input, 0}, + {"fan3", fan_dev_path_fan5_input, + fan_dev_path_fan6_input, 0}, + {"fan4", fan_dev_path_fan7_input, + fan_dev_path_fan8_input, 0}, +}; +#define FAN_TBL_TOTAL ( sizeof(fans_tbl)/ sizeof(const struct fans_tbl_s) ) + +#define FAN_STATE_CHECK(i,b) (fans_tbl[i].fan_state & (1< 0) + { + printk(KERN_ERR "[p_thread] All fans failed.\n"); + printk(KERN_ERR "[p_thread] System shutdown immediately in %d seconds.\n", cd_shutdown); + } + cd_shutdown -= 1; + } + return ret; +} + +/* End of faninfo_device */ + +static int __init +fan_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_fan_path_init(); +#endif + return 0; +} + + +static void __exit +fan_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove fan module.\n"); +} + +/* psu device *************************************/ +static unsigned int psu_voltin = 0; +#define PSU_VOLTIN_ACDC (70000) + +/* + * normal/unpower/uninstall/fault are PSU states output from driver level + * checkpsu/error are defined by sysfs + */ +#define PSU_STATE_VAL_NORMAL (0) +#define PSU_STATE_VAL_UNPOWER (2) +#define PSU_STATE_VAL_FAULT (4) +#define PSU_STATE_VAL_UNINSTALL (7) +#define PSU_STATE_VAL_CHECKPSU (8) +#define PSU_STATE_VAL_ERROR (9) + +#define PSU_STATE_NORMAL ("0 : normal") +#define PSU_STATE_UNPOWER ("2 : unpowered") +#define PSU_STATE_FAULT ("4 : fault") +#define PSU_STATE_UNINSTALL ("7 : not installed") +#define PSU_STATE_CHECKPSU ("8 : check psu") +#define PSU_STATE_ERROR ("9 : state error") + +#define PSU_STATE_LEN_NORMAL (strlen(PSU_STATE_NORMAL)) +#define PSU_STATE_LEN_UNPOWER (strlen(PSU_STATE_UNPOWER)) +#define PSU_STATE_LEN_FAULT (strlen(PSU_STATE_FAULT)) +#define PSU_STATE_LEN_UNINSTALL (strlen(PSU_STATE_UNINSTALL)) +#define PSU_STATE_LEN_CHECKPSU (strlen(PSU_STATE_CHECKPSU)) + +typedef struct { + char *inv_dev_attrp; + char *inv_dev_pathp; +} psu_dev_t; + +typedef struct { + const char *psu_name; + int psu_major; + dev_t psu_devt; + struct device *psu_dev_p; + psu_dev_t *psu_dev_namep; + int psu_dev_total; + char *psu_inv_pathp; + void *psu_tracking; + char *psu_currentin; + char *psu_currentout; + char *psu_powerin; + char *psu_powerout; + char *psu_voltin; + char *psu_voltout; +} psu_dev_group_t; + +#define PSU_DEV_PATH_TEMPLATE "/sys/class/hwmon/hwmon%d/device/%s" + +static char psu_dev_path_state[MAX_PATH_SIZE]; +static char psu_dev_path_psu_voltin[MAX_PATH_SIZE]; +#if 0 +static char psu_dev_path_vendor[MAX_PATH_SIZE]; +static char psu_dev_path_version[MAX_PATH_SIZE]; +static char psu_dev_path_sn[MAX_PATH_SIZE]; +static char psu_dev_path_temperature[MAX_PATH_SIZE]; +static char psu_dev_path_fan_speed[MAX_PATH_SIZE]; +static char psu_dev_path_fan_pwm[MAX_PATH_SIZE]; +static char psu_dev_path_fan_faulty[MAX_PATH_SIZE]; +static char psu_dev_path_psu_currentin[MAX_PATH_SIZE]; +static char psu_dev_path_psu_currentout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_powerin[MAX_PATH_SIZE]; +static char psu_dev_path_psu_powerout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_voltout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_pwm[MAX_PATH_SIZE]; +static char psu_dev_path_psu_rpm[MAX_PATH_SIZE]; +#endif + +void sysfs_psu_path_init(void) +{ + sprintf(&psu_dev_path_state[0], PSU_DEV_PATH_TEMPLATE, get_hwm_cpld(), "\%s" ); + sprintf(&psu_dev_path_psu_voltin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); +#if 0 + sprintf(&psu_dev_path_vendor[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_version[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_sn[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_temperature[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_speed[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_pwm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_faulty[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_currentin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_currentout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_powerin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_powerout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_voltout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_pwm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_rpm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); +#endif +} + +static psu_dev_t psu_dev_name[] = { + { "state", psu_dev_path_state }, // Using cpld + { "psu_voltin", psu_dev_path_psu_voltin }, +#if 0 + { "vendor", psu_dev_path_vendor }, + { "version", psu_dev_path_version }, + { "sn", psu_dev_path_sn }, + { "temperature", psu_dev_path_temperature }, + { "fan_speed", psu_dev_path_fan_speed }, + { "fan_pwm", psu_dev_path_fan_pwm }, + { "fan_faulty", psu_dev_path_fan_faulty }, + { "psu_currentin", psu_dev_path_psu_currentin }, + { "psu_currentout", psu_dev_path_psu_currentout }, + { "psu_powerin", psu_dev_path_psu_powerin }, + { "psu_powerout", psu_dev_path_psu_powerout }, + { "psu_voltout", psu_dev_path_psu_voltout }, + { "psu_pwm", psu_dev_path_psu_pwm }, + { "psu_rpm", psu_dev_path_psu_rpm }, +#endif +}; +#define PSU_DEV_NAME_TOTAL ( sizeof(psu_dev_name) / sizeof(const psu_dev_t) ) + +static psu_dev_group_t psu_dev_group[] = { + { + .psu_name = "psu1", + .psu_dev_namep = &psu_dev_name[0], + .psu_dev_total = sizeof(psu_dev_name) / sizeof(const psu_dev_t), + }, + { + .psu_name = "psu2", + .psu_dev_namep = &psu_dev_name[0], + .psu_dev_total = sizeof(psu_dev_name) / sizeof(const psu_dev_t), + }, +}; +#define PSU_DEV_GROUP_TOTAL ( sizeof(psu_dev_group)/ sizeof(const psu_dev_group_t) ) + +static char psu_state[4][MIN_ACC_SIZE]; + +static struct psu_wire_tbl_s { + char *psu_attr; + char *psu_name; + char *psu_wire; + char *psu_state; +} psu_wire_tbl[] = { + { "state", "psu1", "psu0", psu_state[0] }, // Using cpld + { "state", "psu2", "psu1", psu_state[1] }, + { "psu_voltin", "psu1", "psoc_psu1_vin", psu_state[2] }, + { "psu_voltin", "psu2", "psoc_psu2_vin", psu_state[3] }, +}; +#define PSU_WIRE_TBL_TOTAL ( sizeof(psu_wire_tbl)/ sizeof(const struct psu_wire_tbl_s) ) + +static char * +psu_attr_get_wirep(const char *psu_attrp, const char *psu_namep, char **psu_statepp) +{ + int i; + + for (i = 0; i < PSU_WIRE_TBL_TOTAL; i++) { + if (strncmp(psu_wire_tbl[i].psu_attr, psu_attrp, strlen(psu_attrp)) == 0 && + strncmp(psu_wire_tbl[i].psu_name, psu_namep, strlen(psu_namep)) == 0) { + if (psu_statepp) { + *psu_statepp = psu_wire_tbl[i].psu_state; + } + return psu_wire_tbl[i].psu_wire; + } + } + return NULL; +} + +int psu_check_state_normal(char *statep) +{ + if (strstr(statep, "normal")) { + return 1; + } + return 0; +} + +#define PSU_ATTR_VOLTIN ("psu_voltin") +#define PSU_ATTR_VOLTIN_LEN (10) + +/* Get PSU voltin for determon AC(110v) or DC(48v) */ +void psu_get_voltin(void) +{ + char acc_path[MAX_PATH_SIZE], volt[MIN_ACC_SIZE]; + psu_dev_t *devnamep; + unsigned int voltin; + char *invwirep; + int i, j; + + for (i = 0; i < PSU_DEV_GROUP_TOTAL; i++) { + //psu_dev_group[i].psu_name; + devnamep = psu_dev_group[i].psu_dev_namep; + for (j = 0; j < psu_dev_group[i].psu_dev_total; j++, devnamep++) { + if (strncmp(devnamep->inv_dev_attrp, PSU_ATTR_VOLTIN, PSU_ATTR_VOLTIN_LEN) == 0) { + invwirep = psu_attr_get_wirep(PSU_ATTR_VOLTIN, psu_dev_group[i].psu_name, NULL); + if (invwirep == NULL) { + printk(KERN_DEBUG "[p_thread] Invalid psuname: %s\n", psu_dev_group[i].psu_name); + continue; + } + sprintf(acc_path, devnamep->inv_dev_pathp, invwirep); + //printk(KERN_DEBUG "[p_thread] RYU: %s/%d: acc_path = %s\n",__func__,__LINE__,acc_path); + if (inventec_show_attr(volt, acc_path) <= 0) { + printk(KERN_DEBUG "[p_thread] Read %s failed\n", acc_path); + continue; + } + else { + voltin = simple_strtol(&volt[0], NULL, 10); + printk(KERN_DEBUG "[p_thread] Read %s %s = %u\n",acc_path,volt,voltin); + if (voltin > psu_voltin) { + psu_voltin = voltin; + } + } + } + } + } + + SYSFS_LOG("[p_thread] PSU voltin = %u\n", psu_voltin); +} + +#define PSU_ATTR_STATE ("state") +#define PSU_ATTR_STATE_LEN (5) + +/* psus_control() by inv_thread */ +int psus_control(int log_only) +{ + char acc_path[MAX_PATH_SIZE], state[MIN_ACC_SIZE]; + psu_dev_t *devnamep = NULL; + char *invwirep = NULL; + char *psu_statep = NULL; + int i, j, flag = 0; + + for (i = 0; i < PSU_DEV_GROUP_TOTAL; i++) { + devnamep = psu_dev_group[i].psu_dev_namep; + for (j = 0; j < psu_dev_group[i].psu_dev_total; j++, devnamep++) { + if (strncmp(devnamep->inv_dev_attrp, PSU_ATTR_STATE, PSU_ATTR_STATE_LEN) == 0) { + invwirep = psu_attr_get_wirep(PSU_ATTR_STATE, psu_dev_group[i].psu_name, &psu_statep); + if (invwirep == NULL) { + printk(KERN_DEBUG "[p_thread] Invalid psuname: %s\n", psu_dev_group[i].psu_name); + continue; + } + sprintf(acc_path, devnamep->inv_dev_pathp, invwirep); + //printk(KERN_INFO "[p_thread] RYU: %s/%d: acc_path = %s\n",__func__,__LINE__,acc_path); + if (inventec_show_attr(state, acc_path) <= 0) { + printk(KERN_DEBUG "[p_thread] Read %s failed\n", acc_path); + if (strncmp(psu_statep, PSU_STATE_ERROR, strlen(PSU_STATE_ERROR)) != 0) { + strcpy(psu_statep, PSU_STATE_ERROR); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,PSU_STATE_ERROR); + } + flag = 1; + } + else + if (strstr(state, "normal")) { + //printk(KERN_INFO "[p_thread] %s: %s\n", psu_dev_group[i].psu_name, state); + if (strncmp(psu_statep, state, strlen(state)) != 0) { + strcpy(psu_statep, state); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,state); + } + } + else + if (psu_voltin > PSU_VOLTIN_ACDC) { /* AC PSUS */ + //printk(KERN_INFO "[p_thread] RYU: %s: %s\n", psu_dev_group[i].psu_name, state); + if (strncmp(psu_statep, state, strlen(state)) != 0) { + strcpy(psu_statep, state); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,state); + } + flag = 1; + } + else { /* DC PSUS */ + if (strncmp(psu_statep, PSU_STATE_CHECKPSU, PSU_STATE_LEN_CHECKPSU) != 0) { + strcpy(psu_statep, PSU_STATE_CHECKPSU); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,PSU_STATE_CHECKPSU); + } + flag = 1; + } + } + } + } + + if (log_only) { + return 0; + } + + //SYSFS_LOG("[p_thread] RYU: %s: flag = %d\n",psu_wire_tbl[i].psu_name,flag); + if (flag == 1) { + status_led_grn("3"); + return 1; + } + return 0; +} + +/* End of psuinfo_device */ + +static int __init +psu_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_psu_path_init(); +#endif + return 0; +} + + +static void __exit +psu_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove psu module.\n"); +} + +/* led device *************************************/ +#define STATUS_LED_GRN_PATH "/sys/class/hwmon/hwmon%d/device/grn_led" +#define STATUS_LED_RED_PATH "/sys/class/hwmon/hwmon%d/device/red_led" + +#define FAN_LED_GRN1_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn1" +#define FAN_LED_GRN2_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn2" +#define FAN_LED_GRN3_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn3" +#define FAN_LED_GRN4_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn4" +#define FAN_LED_RED1_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red1" +#define FAN_LED_RED2_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red2" +#define FAN_LED_RED3_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red3" +#define FAN_LED_RED4_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red4" + +#define HWMON_DEVICE_DIAG_PATH "/sys/class/hwmon/hwmon%d/device/diag" +#define HWMON_DEVICE_CTRL_PATH "/sys/class/hwmon/hwmon%d/device/ctl" + +static char status_led_grn_path[MAX_PATH_SIZE]; +static char status_led_red_path[MAX_PATH_SIZE]; +static char fan_led_grn1_path[MAX_PATH_SIZE]; +static char fan_led_grn2_path[MAX_PATH_SIZE]; +static char fan_led_grn3_path[MAX_PATH_SIZE]; +static char fan_led_grn4_path[MAX_PATH_SIZE]; +static char fan_led_red1_path[MAX_PATH_SIZE]; +static char fan_led_red2_path[MAX_PATH_SIZE]; +static char fan_led_red3_path[MAX_PATH_SIZE]; +static char fan_led_red4_path[MAX_PATH_SIZE]; +static char hwmon_device_diag_path[MAX_PATH_SIZE]; +static char hwmon_device_ctrl_path[MAX_PATH_SIZE]; + +void sysfs_led_path_init(void) +{ + sprintf(&status_led_grn_path[0], STATUS_LED_GRN_PATH, get_hwm_cpld()); + sprintf(&status_led_red_path[0], STATUS_LED_RED_PATH, get_hwm_cpld()); + sprintf(&fan_led_grn1_path[0], FAN_LED_GRN1_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn2_path[0], FAN_LED_GRN2_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn3_path[0], FAN_LED_GRN3_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn4_path[0], FAN_LED_GRN4_PATH, get_hwm_psoc()); + sprintf(&fan_led_red1_path[0], FAN_LED_RED1_PATH, get_hwm_psoc()); + sprintf(&fan_led_red2_path[0], FAN_LED_RED2_PATH, get_hwm_psoc()); + sprintf(&fan_led_red3_path[0], FAN_LED_RED3_PATH, get_hwm_psoc()); + sprintf(&fan_led_red4_path[0], FAN_LED_RED4_PATH, get_hwm_psoc()); + sprintf(&hwmon_device_diag_path[0], HWMON_DEVICE_DIAG_PATH, get_hwm_psoc()); + sprintf(&hwmon_device_ctrl_path[0], HWMON_DEVICE_CTRL_PATH, get_hwm_cpld()); +} + +/* return 0/off 1/green 2/red */ +int +status_led_check_color(void) +{ + char tmpbuf[MIN_ACC_SIZE]; + int ret = STATUS_LED_INVALID; + + if (inventec_show_attr(&tmpbuf[0], status_led_grn_path) > 0) { + if (tmpbuf[0] == '0') { + ret = STATUS_LED_GRN0; + } + if (tmpbuf[0] == '1') { + ret = STATUS_LED_GRN1; + } + if (tmpbuf[0] == '2') { + ret = STATUS_LED_GRN2; + } + if (tmpbuf[0] == '3') { + ret = STATUS_LED_GRN3; + } + if (tmpbuf[0] == '7') { + ret = STATUS_LED_GRN7; + } + return ret; + } + + if (inventec_show_attr(&tmpbuf[0], status_led_red_path) > 0) { + if (tmpbuf[0] == '0') { + ret = STATUS_LED_RED0; + } + if (tmpbuf[0] == '1') { + ret = STATUS_LED_RED1; + } + if (tmpbuf[0] == '2') { + ret = STATUS_LED_RED2; + } + if (tmpbuf[0] == '3') { + ret = STATUS_LED_RED3; + } + if (tmpbuf[0] == '7') { + ret = STATUS_LED_RED7; + } + return ret; + } + return ret; +} + +/* + * Store attr Section + */ +static DEFINE_MUTEX(diag_mutex); + +ssize_t status_led_diag_mode_enable(void) +{ + char tmp[MIN_ACC_SIZE]; + ssize_t ret; + + ret = inventec_show_attr(&tmp[0], hwmon_device_diag_path); + if (ret <= 0) { + return ret; + } + + if (tmp[0] == '0') { + mutex_lock(&diag_mutex); + ret = inventec_store_attr("1", 1, hwmon_device_diag_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return ret; + } + + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return ret; + } + mutex_unlock(&diag_mutex); + } + + return ret; +} + +ssize_t status_led_diag_mode_disable(void) +{ + char tmp[MIN_ACC_SIZE]; + ssize_t ret; + + ret = inventec_show_attr(&tmp[0], hwmon_device_diag_path); + if (ret <= 0) { + return ret; + } + + if (tmp[0] == '1') { + mutex_lock(&diag_mutex); + ret = inventec_store_attr("0", 1, hwmon_device_diag_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return 1; + } + + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return 1; + } + mutex_unlock(&diag_mutex); + } + return 1; +} + +ssize_t +status_led_change(const char *path1, const char *tmp1, const char *path2, const char *tmp2) +{ + ssize_t ret; + + ret = inventec_store_attr(tmp1, strlen(tmp1), path1); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(tmp2, strlen(tmp2), path2); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_led_red(const char *freq) +{ + ssize_t ret; + + ret = inventec_store_attr("0", 1, &status_led_grn_path[0]); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(freq, strlen(freq), &status_led_red_path[0]); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_led_grn(const char *freq) +{ + ssize_t ret; + + ret = inventec_store_attr("0", 1, &status_led_red_path[0]); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(freq, strlen(freq), &status_led_grn_path[0]); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +static int status_led_diag_mode = STATUS_LED_MODE_AUTO; + +int status_led_check_diag_mode(void) +{ + return status_led_diag_mode; +} + +/* End of ledinfo_device */ + +static int __init +led_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_led_path_init(); +#endif + return 0; +} + + +static void __exit +led_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove led module.\n"); +} + +/* sensor device **********************************/ +#define SENSOR_DEV_PATH_SWITCH_TEMP "/sys/class/hwmon/hwmon%d/device/switch_tmp" + +static char sensor_dev_path_switch_temp[MAX_PATH_SIZE]; + +void sysfs_sensor_path_init(void) +{ + sprintf(&sensor_dev_path_switch_temp[0], SENSOR_DEV_PATH_SWITCH_TEMP, get_hwm_psoc()); +} + +void switch_temp_update(void) +{ + char buf[MIN_ACC_SIZE]; + ssize_t count = inventec_show_attr(&buf[0], "proc/switch/temp"); + if (count > 0) { + //printk(KERN_ERR "[p_thread] [STEMP] Switch temperature is out of range: %d\n", stemp); + inventec_store_attr(&buf[0], count, sensor_dev_path_switch_temp); + } +} + +/**************************************************/ +/* From system_device */ +static int inv_pthread_control = 1; + +int thread_control(void) +{ + return inv_pthread_control; +} + +void thread_control_set(int val) +{ + inv_pthread_control = val; +} +/* End system_device */ + +#define THREAD_SLEEP_MINS (3) +#define THREAD_DELAY_MINS (THREAD_SLEEP_MINS + THREAD_SLEEP_MINS + 1) + +extern void psu_get_voltin(void); + +static struct task_struct *thread_st; +static int thread_data; + +#ifdef SWITCH_HEALTH_LED_CHANGE_VIA_GPIO +void led_set_gpio_to_change_status_led(void) +{ + ssize_t ret = inventec_store_attr("57", 2, "/sys/class/gpio/export"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 57 to /sys/class/gpio/export failed\n"); + return; + } + ret = inventec_store_attr("low", 3, "/sys/class/gpio/gpio57/direction"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write low to /sys/class/gpio/gpio57/direction failed\n"); + return; + } + SYSFS_LOG("[p_thread] Set gpio to support status led change successfully\n"); +} +#endif + +// Function executed by kernel thread +static int thread_fn(void *unused) +{ + /* Delay for guarantee HW ready */ + ssleep(THREAD_DELAY_MINS); + +#ifndef INV_PTHREAD_KERNEL_MODULE + sysfs_led_path_init(); + sysfs_fan_path_init(); + sysfs_psu_path_init(); +#endif + //sysfs_sensor_path_init(); + + /* Default status init */ + status_led_grn("7"); + + psu_get_voltin(); + +#ifdef SWITCH_HEALTH_LED_CHANGE_VIA_GPIO + led_set_gpio_to_change_status_led(); +#endif + + while (1) + { + ssleep(THREAD_SLEEP_MINS); + + if (thread_control() == 0) { + printk(KERN_INFO "[p_thread] %s/%d: Thread Stop by inv_pthread control\n",__func__,__LINE__); + break; + } + + if (status_led_check_diag_mode() == STATUS_LED_MODE_MANU) { + /* status led in change color/freq mode, higher priority. Ignore fans sttaus */ + continue; + } + + //switch_temp_update(); + + if (fans_control() > 0) { + psus_control(1); + continue; + } + else + if (psus_control(0) > 0) { + continue; + } + + if (status_led_check_color() != STATUS_LED_GRN7) { /* status led red, change it to green */ + status_led_grn("7"); + } + } + +#ifndef INV_PTHREAD_KERNEL_MODULE +err_inv_pthread_fn_1: +#endif + do_exit(0); + printk(KERN_INFO "[p_thread] %s/%d: Thread Stopped\n",__func__,__LINE__); + return 0; +} + + +static ssize_t s_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + int fan_absence; + size_t count; + + fan_absence = fans_control(); + count += sprintf(&buf[count], "%d\n", fan_absence); + return count; +} + +static ssize_t s_store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) +{ + return count; +} + +static struct attribute status_att = { + .name = "fan_absence", + .mode = 0777, +}; + +static const struct sysfs_ops status_ops = { + .show = s_show, + .store = s_store, +}; + +static struct kobj_type status_ktype = { + .sysfs_ops = &status_ops, +}; + + +static int __init inv_pthread_init(void) +{ + int retval; + + status_kobj = kzalloc(sizeof(*status_kobj), GFP_KERNEL); + if(!status_kobj) + return PTR_ERR(status_kobj); + + status_kset = kset_create_and_add("platform_status", NULL, kernel_kobj); + if(!status_kset) + return -1; + + status_kobj->kset = status_kset; + + retval = kobject_init_and_add(status_kobj, &status_ktype, NULL, "fan"); + if(retval) + return retval; + + retval = sysfs_create_file(status_kobj, &status_att); + + + inventec_class_init(); + fan_device_init(); + psu_device_init(); + led_device_init(); + + thread_control_set(1); + + printk(KERN_INFO "[p_thread] %s/%d: Creating Thread\n",__func__,__LINE__); + //Create the kernel thread with name 'inv_pthread' + thread_st = kthread_run(thread_fn, (void*)&thread_data, "inv_pthread"); + if (thread_st) + printk(KERN_INFO "[p_thread] inv_pthread Created successfully\n"); + else + printk(KERN_ERR "[p_thread] inv_pthread creation failed\n"); + + return retval; +} + +static void __exit inv_pthread_exit(void) +{ + thread_control_set(0); + /* Delay for guarantee thread exit */ + ssleep(THREAD_DELAY_MINS); + + fan_device_exit(); + psu_device_exit(); + led_device_exit(); + inventec_class_exit(); + + sysfs_remove_file(status_kobj, &status_att); + kset_unregister(status_kset); + kobject_del(status_kobj); + + printk(KERN_INFO "[p_thread] inv_pthread cleaning Up\n"); +} + +module_init(inv_pthread_init); +module_exit(inv_pthread_exit); + +MODULE_AUTHOR("Robert "); +MODULE_DESCRIPTION("Inventec Platform Management Thread"); +MODULE_VERSION("version 1.0"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/utils/inventec_d7054_util.py b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/utils/inventec_d7054_util.py index 7fbb707f4187..246893ba05b7 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/utils/inventec_d7054_util.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/utils/inventec_d7054_util.py @@ -127,13 +127,14 @@ def exec_cmd(cmd, show): 'inv_platform', 'inv_psoc', 'inv_cpld', +'inv_pthread', 'swps'] def system_install(): global FORCE - + #install drivers for i in range(0,len(drivers)): status, output = exec_cmd("modprobe "+drivers[i], 1) @@ -209,7 +210,7 @@ def install(): if FORCE == 0: return status else: - print " D7032 devices detected...." + print " D7054 devices detected...." return def uninstall(): diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/Makefile b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/Makefile index aeffa4376588..37cbc2f4e8be 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/Makefile @@ -1,5 +1,6 @@ obj-m += inv_cpld.o inv_psoc.o obj-m += inv_platform.o +obj-m += inv_pthread.o obj-m += inv_eeprom.o obj-m += swps.o swps-objs := inv_swps.o io_expander.o transceiver.o diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_psoc.c b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_psoc.c index 7372c0eb3a23..c7ab224d0289 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_psoc.c +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_psoc.c @@ -50,7 +50,6 @@ DEFINE_MUTEX(ipmi_mutex); DEFINE_MUTEX(ipmi2_mutex); static struct ipmi_result ipmiresult; static struct device *hwmon_dev; -static struct kobject *device_kobj; static ipmi_user_t ipmi_mh_user = NULL; static void msg_handler(struct ipmi_recv_msg *msg,void* handler_data); static struct ipmi_user_hndl ipmi_hndlrs = { .ipmi_recv_hndl = msg_handler,}; @@ -588,6 +587,7 @@ static SENSOR_DEVICE_ATTR(rpm_psu1, S_IRUGO, show_rpm, 0, 8); static SENSOR_DEVICE_ATTR(rpm_psu2, S_IRUGO, show_rpm, 0, 9); static SENSOR_DEVICE_ATTR(switch_tmp, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); +static SENSOR_DEVICE_ATTR(temp6_input, S_IWUSR|S_IRUGO, show_switch_tmp, set_switch_tmp, 0); static SENSOR_DEVICE_ATTR(diag, S_IWUSR|S_IRUGO, show_diag, set_diag, 0); static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, 0, 0); @@ -618,6 +618,13 @@ static SENSOR_DEVICE_ATTR(psoc_psu2_iout, S_IRUGO, show_psu_psoc, static SENSOR_DEVICE_ATTR(psoc_psu2_pin, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); static SENSOR_DEVICE_ATTR(psoc_psu2_pout, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pout)); +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_vin)); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_vin)); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_iin)); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_iin)); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu1_pin)); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_psu_psoc, 0, PSOC_PSU_OFF(psu2_pin)); + //IPMI static SENSOR_DEVICE_ATTR(thermal2_psu1, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Temp2); static SENSOR_DEVICE_ATTR(psoc_psu1_vender, S_IRUGO, show_ipmi_pmbus, 0, PSU1 | PMBus_Vender); @@ -665,7 +672,7 @@ static struct attribute *psoc_attributes[] = { //switch temperature &sensor_dev_attr_switch_tmp.dev_attr.attr, - + &sensor_dev_attr_temp6_input.dev_attr.attr, //diag flag &sensor_dev_attr_diag.dev_attr.attr, @@ -702,6 +709,14 @@ static struct attribute *psoc_attributes[] = { &sensor_dev_attr_psoc_psu2_pin.dev_attr.attr, &sensor_dev_attr_psoc_psu2_pout.dev_attr.attr, + // Add new fields which matching standard + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + //ipmi_i2c_command &sensor_dev_attr_thermal2_psu1.dev_attr.attr, &sensor_dev_attr_psoc_psu1_vender.dev_attr.attr, @@ -732,13 +747,8 @@ static int __init inv_psoc_init(void) if (IS_ERR(hwmon_dev)) { goto fail_hwmon_device_register; } - - device_kobj = kobject_create_and_add("device", &hwmon_dev->kobj); - if(!device_kobj) { - goto fail_hwmon_device_register; - } - - ret = sysfs_create_group(device_kobj, &psoc_group); + + ret = sysfs_create_group(&hwmon_dev->kobj, &psoc_group); if (ret) { goto fail_create_group_hwmon; } @@ -754,9 +764,10 @@ static int __init inv_psoc_init(void) static void __exit inv_psoc_exit(void) { + sysfs_remove_group(&hwmon_dev->kobj, &psoc_group); + if(ipmi_mh_user!=NULL) {ipmi_destroy_user(ipmi_mh_user);} if(hwmon_dev != NULL) hwmon_device_unregister(hwmon_dev); - sysfs_remove_group(device_kobj, &psoc_group); } MODULE_AUTHOR("Ting.Jack "); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_pthread.c b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_pthread.c new file mode 100644 index 000000000000..a45db7423f25 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/modules/inv_pthread.c @@ -0,0 +1,1303 @@ +/***************************** + Sequoia platform +******************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define INV_PTHREAD_KERNEL_MODULE + +#define SHOW_ATTR_WARNING ("N/A") +#define SHOW_ATTR_NOTPRINT ("Not Available") +#define SHOW_ATTR_NOTSUPPORT ("Not Support") + +#define INV_HWMID_MAX (10) +#define INV_HWMID_INIT (-1) + +/*access userspace data to kernel space*/ +#define ACC_R (0) +#define ACC_W (1) + +#define TINY_BUF_SIZE (8) +#define MAX_PATH_SIZE (64) +#define MIN_ACC_SIZE (32) +#define MAX_ACC_SIZE (256) + +/* + * LED definitions + */ +#define STATUS_LED_MODE_AUTO 0 +#define STATUS_LED_MODE_DIAG 1 +#define STATUS_LED_MODE_MANU 2 + +#define STATUS_LED_GRN0 10 // 0 - 000: off +#define STATUS_LED_GRN1 11 // 1 - 001: 0.5hz +#define STATUS_LED_GRN2 12 // 2 - 010: 1 hz +#define STATUS_LED_GRN3 13 // 3 - 011: 2 hz +#define STATUS_LED_GRN7 17 // 7 - 111: on +#define STATUS_LED_RED0 20 // 0 - 000: off +#define STATUS_LED_RED1 21 // 1 - 001: 0.5hz +#define STATUS_LED_RED2 22 // 2 - 010: 1 hz +#define STATUS_LED_RED3 23 // 3 - 011: 2 hz +#define STATUS_LED_RED7 27 // 7 - 111: on +#define STATUS_LED_INVALID 0 // Invalid + +ssize_t status_led_change(const char *path1, const char *tmp1, const char *path2, const char *tmp2); +ssize_t status_led_grn(const char *freq); +ssize_t status_led_red(const char *freq); +ssize_t status_led_diag_mode_enable(void); +ssize_t status_led_diag_mode_disable(void); +int status_led_check_color(void); +int status_led_check_diag_mode(void); + +#if 1 +/* For timestamps in SYSFS_LOG */ +#define SYSFS_LOG printk +#else +//#define SYSFS_LOG(fmt, args...) printk(KERN_WARNING "[SYSFS] %s/%d: " fmt, __func__, __LINE__, ##args) +#define SYSFS_LOG(fmt, args...) printk(KERN_WARNING "[p_thread] " fmt, ##args) +#endif + + +/* inventec_class *********************************/ +static struct kobject *status_kobj; +static struct kset *status_kset; + + +static struct mutex rw_lock; + +static int hwm_psoc = INV_HWMID_INIT; +static int hwm_cpld = INV_HWMID_INIT; +static int hwm_cpld2 = INV_HWMID_INIT; + +int get_hwm_psoc(void) +{ + return hwm_psoc; +} + +int get_hwm_cpld(void) +{ + return hwm_cpld; +} + +static ssize_t access_user_space(const char *name, int mode, char *buf, size_t len, loff_t offset) +{ + struct file *fp; + mm_segment_t fs; + loff_t pos = offset; + char *mark = NULL; + ssize_t vfs_ret = 0; + + if (mode == ACC_R) { + fp = filp_open(name, O_RDONLY, S_IRUGO); + if (IS_ERR(fp)) + return -ENODEV; + + fs = get_fs(); + set_fs(KERNEL_DS); + + vfs_ret = vfs_read(fp, buf, len, &pos); + + mark = strpbrk(buf, "\n"); + if (mark) + *mark = '\0'; + + filp_close(fp, NULL); + set_fs(fs); + } else if (mode == ACC_W) { + fp = filp_open(name, O_WRONLY, S_IWUSR | S_IRUGO); + if (IS_ERR(fp)) + return -ENODEV; + + fs = get_fs(); + set_fs(KERNEL_DS); + + vfs_ret = vfs_write(fp, buf, len, &pos); + filp_close(fp, NULL); + set_fs(fs); + } + + return vfs_ret; +} + +int inventec_strtol(const char *sbufp, char **endp, unsigned int base) +{ + char *endptr; + int value = simple_strtol(sbufp, &endptr, base); + if (value == 0 && sbufp == endptr) { + *endp = NULL; + return value; + } + *endp = (char*)1; + return value; +} + +int inventec_singlechar_to_int(const char c) +{ + if ((c >= '0') && (c <= '9')) { + return (c - '0'); + } + else + if ((c >= 'a') && (c <= 'f')) { + return (c - 'a' + 10); + } + else + if ((c >= 'A') && (c <= 'F')) { + return (c - 'A' + 10); + } + return -1; +} + +int inventec_store_input(char *inputp, int count) +{ + int i = 0; + while(inputp[i] != '\n' && inputp[i] != '\0' && i < count) { + i++; + } + inputp[i] = '\0'; + return strlen(inputp); +} + +#if 0 +/* + * Time stamps for kernel log on yocto + */ +#include + +void SYSFS_LOG(char *fmt, ...) +{ + char buf[80], ts[32]; + va_list args; + int hlen; + + inventec_tmstmp(&ts[0]); + hlen = sprintf(buf, "[SYSFS] %s ", ts); // Do not edit this line + + va_start(args, fmt); + vsprintf(&buf[hlen-1], fmt, args); + va_end(args); + printk(KERN_WARNING "[p_thread] %s\n", buf); +} +#endif + +ssize_t +inventec_show_attr(char *buf_p, const char *invdevp) +{ + int inv_len = MAX_ACC_SIZE; /* INV driver return max length */ + char tmp_buf[MAX_ACC_SIZE]; + char *str_negative = "-", *mark = NULL; + + /* [Step2] Get data by uaccess */ + memset(tmp_buf, 0, sizeof(tmp_buf)); + mutex_lock(&rw_lock); + if (access_user_space(invdevp, ACC_R, tmp_buf, inv_len, 0) < 0) { + /* u_access fail */ + mutex_unlock(&rw_lock); + return sprintf(buf_p, "%s\n", SHOW_ATTR_WARNING); + } + mutex_unlock(&rw_lock); + + /* [Step3] Check return value + * - Ex: When transceiver not plugged + * => SWPS return error code "-202" + * => Pic8 need return "NA" (assume) + */ + if (strcspn(tmp_buf, str_negative) == 0) { + /* error case: "-202" */ + return sprintf(buf_p, "%s\n", SHOW_ATTR_WARNING); + } + + /* OK case:*/ + mark = strpbrk(tmp_buf, "\n"); + if (mark) { *mark = '\0'; } + + return sprintf(buf_p, "%s\n", tmp_buf); +} + +ssize_t +inventec_store_attr(const char *buf_p, size_t count, const char *invdevp) +{ + ssize_t ret = 0; + + /* [Step2] Get data by uaccess */ + mutex_lock(&rw_lock); + if ((ret = access_user_space(invdevp, ACC_W, (char*)buf_p, count, 0)) < 0) { + /* u_access fail */ + mutex_unlock(&rw_lock); + return -EINVAL; + } + mutex_unlock(&rw_lock); + + /* OK case:*/ + return ret; +} + +int sysfs_detect_hwmon_index(void) +{ + char hwmon_buf[MAX_ACC_SIZE]; + char hwmon_path[MAX_PATH_SIZE]; + int hwid = 0; + + for (hwid = 0; + hwid < INV_HWMID_MAX && (hwm_psoc == INV_HWMID_INIT || hwm_cpld == INV_HWMID_INIT); + hwid++) { + memset(hwmon_buf, 0, sizeof(hwmon_buf)); + sprintf(hwmon_path, "/sys/class/hwmon/hwmon%d/name", hwid); + + inventec_show_attr(hwmon_buf, hwmon_path); + if (strncmp(hwmon_buf, "inv_psoc", 8) == 0) { + hwm_psoc = hwid; + } + else + if (strncmp(hwmon_buf, "inv_bmc", 7) == 0) { + hwm_psoc = hwid; + } + + sprintf(hwmon_path, "/sys/class/hwmon/hwmon%d/device/name", hwid); + inventec_show_attr(hwmon_buf, hwmon_path); + if (strncmp(hwmon_buf, "inv_cpld2", 9) == 0) { + hwm_cpld2 = hwid; + } + else + if (strncmp(hwmon_buf, "inv_cpld", 8) == 0) { + hwm_cpld = hwid; + } + } + if (hwid >= INV_HWMID_MAX) { + printk(KERN_ERR "[p_thread] detect hwmon index failed, psoc = %d, cpld = %d\n", hwm_psoc, hwm_cpld); + return -1; + } + printk(KERN_INFO "[p_thread] detect hwmon index success, psoc = %d, cpld = %d\n", hwm_psoc, hwm_cpld); + return 0; +} + +static int __init +inventec_class_init(void) +{ + mutex_init(&rw_lock); + +#ifdef INV_PTHREAD_KERNEL_MODULE + if (sysfs_detect_hwmon_index() < 0) { + return -1; + } +#endif + + printk(KERN_INFO "[p_thread] [%s/%d] Module initial success.\n",__func__,__LINE__); + + return 0; +} + +static void __exit +inventec_class_exit(void) +{ + printk(KERN_INFO "[p_thread] [%s/%d] Remove module.\n",__func__,__LINE__); +} + +/* fan device *************************************/ +#define FAN_DEV_PATH_STATE "/sys/class/hwmon/hwmon%d/fan_gpi" +#define FAN_DEV_PATH_FAN1_INPUT "/sys/class/hwmon/hwmon%d/fan1_input" +#define FAN_DEV_PATH_FAN2_INPUT "/sys/class/hwmon/hwmon%d/fan2_input" +#define FAN_DEV_PATH_FAN3_INPUT "/sys/class/hwmon/hwmon%d/fan3_input" +#define FAN_DEV_PATH_FAN4_INPUT "/sys/class/hwmon/hwmon%d/fan4_input" +#define FAN_DEV_PATH_FAN5_INPUT "/sys/class/hwmon/hwmon%d/fan5_input" +#define FAN_DEV_PATH_FAN6_INPUT "/sys/class/hwmon/hwmon%d/fan6_input" +#define FAN_DEV_PATH_FAN7_INPUT "/sys/class/hwmon/hwmon%d/fan7_input" +#define FAN_DEV_PATH_FAN8_INPUT "/sys/class/hwmon/hwmon%d/fan8_input" + +static char fan_dev_path_state[MAX_PATH_SIZE]; +static char fan_dev_path_fan1_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan2_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan3_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan4_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan5_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan6_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan7_input[MAX_PATH_SIZE]; +static char fan_dev_path_fan8_input[MAX_PATH_SIZE]; + +void sysfs_fan_path_init(void) +{ + sprintf(&fan_dev_path_state[0], FAN_DEV_PATH_STATE, get_hwm_psoc()); + sprintf(&fan_dev_path_fan1_input[0],FAN_DEV_PATH_FAN1_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan2_input[0],FAN_DEV_PATH_FAN2_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan3_input[0],FAN_DEV_PATH_FAN3_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan4_input[0],FAN_DEV_PATH_FAN4_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan5_input[0],FAN_DEV_PATH_FAN5_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan6_input[0],FAN_DEV_PATH_FAN6_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan7_input[0],FAN_DEV_PATH_FAN7_INPUT, get_hwm_psoc()); + sprintf(&fan_dev_path_fan8_input[0],FAN_DEV_PATH_FAN8_INPUT, get_hwm_psoc()); +} + +#define FAN_STATE_NORMAL "normal" +#define FAN_STATE_FAULTY "faulty" +#define FAN_STATE_UNINSTALLED "uninstalled" +#define FAN_STATE_UNKNOW "unknown state" +#define FAN_STATE_INVALID "Invalid state value" +#define FAN_STATE_READ_ERROR "state read error" + +#define FAN_LOG_UNINSTALLED "removed" +#define FAN_LOG_NORMAL "inserted" + +//#define FAN_STATE_BIT_NORMAL 0 +#define FAN_STATE_BIT_FAULTY 0 +#define FAN_STATE_BIT_UNINSTALLED 1 +#define FAN_STATE_BIT_UNKNOW 2 +#define FAN_STATE_BIT_INVALID 3 +#define FAN_STATE_BIT_READ_ERROR 4 + +static struct fans_tbl_s { + char *fan_name; + char *fan_front; + char *fan_rear; + unsigned int fan_state; +} fans_tbl[] = { + {"fan1", fan_dev_path_fan1_input, + fan_dev_path_fan2_input, 0}, + {"fan2", fan_dev_path_fan3_input, + fan_dev_path_fan4_input, 0}, + {"fan3", fan_dev_path_fan5_input, + fan_dev_path_fan6_input, 0}, + {"fan4", fan_dev_path_fan7_input, + fan_dev_path_fan8_input, 0}, +}; +#define FAN_TBL_TOTAL ( sizeof(fans_tbl)/ sizeof(const struct fans_tbl_s) ) + +#define FAN_STATE_CHECK(i,b) (fans_tbl[i].fan_state & (1< 0) + { + printk(KERN_ERR "[p_thread] All fans failed.\n"); + printk(KERN_ERR "[p_thread] System shutdown immediately in %d seconds.\n", cd_shutdown); + } + cd_shutdown -= 1; + } + return ret; +} + +/* End of faninfo_device */ + +static int __init +fan_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_fan_path_init(); +#endif + return 0; +} + + +static void __exit +fan_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove fan module.\n"); +} + +/* psu device *************************************/ +static unsigned int psu_voltin = 0; +#define PSU_VOLTIN_ACDC (70000) + +/* + * normal/unpower/uninstall/fault are PSU states output from driver level + * checkpsu/error are defined by sysfs + */ +#define PSU_STATE_VAL_NORMAL (0) +#define PSU_STATE_VAL_UNPOWER (2) +#define PSU_STATE_VAL_FAULT (4) +#define PSU_STATE_VAL_UNINSTALL (7) +#define PSU_STATE_VAL_CHECKPSU (8) +#define PSU_STATE_VAL_ERROR (9) + +#define PSU_STATE_NORMAL ("0 : normal") +#define PSU_STATE_UNPOWER ("2 : unpowered") +#define PSU_STATE_FAULT ("4 : fault") +#define PSU_STATE_UNINSTALL ("7 : not installed") +#define PSU_STATE_CHECKPSU ("8 : check psu") +#define PSU_STATE_ERROR ("9 : state error") + +#define PSU_STATE_LEN_NORMAL (strlen(PSU_STATE_NORMAL)) +#define PSU_STATE_LEN_UNPOWER (strlen(PSU_STATE_UNPOWER)) +#define PSU_STATE_LEN_FAULT (strlen(PSU_STATE_FAULT)) +#define PSU_STATE_LEN_UNINSTALL (strlen(PSU_STATE_UNINSTALL)) +#define PSU_STATE_LEN_CHECKPSU (strlen(PSU_STATE_CHECKPSU)) + +typedef struct { + char *inv_dev_attrp; + char *inv_dev_pathp; +} psu_dev_t; + +typedef struct { + const char *psu_name; + int psu_major; + dev_t psu_devt; + struct device *psu_dev_p; + psu_dev_t *psu_dev_namep; + int psu_dev_total; + char *psu_inv_pathp; + void *psu_tracking; + char *psu_currentin; + char *psu_currentout; + char *psu_powerin; + char *psu_powerout; + char *psu_voltin; + char *psu_voltout; +} psu_dev_group_t; + +#define PSU_PSOC_DEV_PATH_TEMPLATE "/sys/class/hwmon/hwmon%d/%s" +#define PSU_CPLD_DEV_PATH_TEMPLATE "/sys/class/hwmon/hwmon%d/device/%s" + +static char psu_dev_path_state[MAX_PATH_SIZE]; +static char psu_dev_path_psu_voltin[MAX_PATH_SIZE]; +#if 0 +static char psu_dev_path_vendor[MAX_PATH_SIZE]; +static char psu_dev_path_version[MAX_PATH_SIZE]; +static char psu_dev_path_sn[MAX_PATH_SIZE]; +static char psu_dev_path_temperature[MAX_PATH_SIZE]; +static char psu_dev_path_fan_speed[MAX_PATH_SIZE]; +static char psu_dev_path_fan_pwm[MAX_PATH_SIZE]; +static char psu_dev_path_fan_faulty[MAX_PATH_SIZE]; +static char psu_dev_path_psu_currentin[MAX_PATH_SIZE]; +static char psu_dev_path_psu_currentout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_powerin[MAX_PATH_SIZE]; +static char psu_dev_path_psu_powerout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_voltout[MAX_PATH_SIZE]; +static char psu_dev_path_psu_pwm[MAX_PATH_SIZE]; +static char psu_dev_path_psu_rpm[MAX_PATH_SIZE]; +#endif + +void sysfs_psu_path_init(void) +{ + sprintf(&psu_dev_path_state[0], PSU_CPLD_DEV_PATH_TEMPLATE, get_hwm_cpld(), "\%s" ); + sprintf(&psu_dev_path_psu_voltin[0], PSU_PSOC_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); +#if 0 + sprintf(&psu_dev_path_vendor[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_version[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_sn[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_temperature[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_speed[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_pwm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_fan_faulty[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_currentin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_currentout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_powerin[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_powerout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_voltout[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_pwm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); + sprintf(&psu_dev_path_psu_rpm[0], PSU_DEV_PATH_TEMPLATE, get_hwm_psoc(), "\%s" ); +#endif +} + +static psu_dev_t psu_dev_name[] = { + { "state", psu_dev_path_state }, // Using cpld + { "psu_voltin", psu_dev_path_psu_voltin }, +#if 0 + { "vendor", psu_dev_path_vendor }, + { "version", psu_dev_path_version }, + { "sn", psu_dev_path_sn }, + { "temperature", psu_dev_path_temperature }, + { "fan_speed", psu_dev_path_fan_speed }, + { "fan_pwm", psu_dev_path_fan_pwm }, + { "fan_faulty", psu_dev_path_fan_faulty }, + { "psu_currentin", psu_dev_path_psu_currentin }, + { "psu_currentout", psu_dev_path_psu_currentout }, + { "psu_powerin", psu_dev_path_psu_powerin }, + { "psu_powerout", psu_dev_path_psu_powerout }, + { "psu_voltout", psu_dev_path_psu_voltout }, + { "psu_pwm", psu_dev_path_psu_pwm }, + { "psu_rpm", psu_dev_path_psu_rpm }, +#endif +}; +#define PSU_DEV_NAME_TOTAL ( sizeof(psu_dev_name) / sizeof(const psu_dev_t) ) + +static psu_dev_group_t psu_dev_group[] = { + { + .psu_name = "psu1", + .psu_dev_namep = &psu_dev_name[0], + .psu_dev_total = sizeof(psu_dev_name) / sizeof(const psu_dev_t), + }, + { + .psu_name = "psu2", + .psu_dev_namep = &psu_dev_name[0], + .psu_dev_total = sizeof(psu_dev_name) / sizeof(const psu_dev_t), + }, +}; +#define PSU_DEV_GROUP_TOTAL ( sizeof(psu_dev_group)/ sizeof(const psu_dev_group_t) ) + +static char psu_state[4][MIN_ACC_SIZE]; + +static struct psu_wire_tbl_s { + char *psu_attr; + char *psu_name; + char *psu_wire; + char *psu_state; +} psu_wire_tbl[] = { + { "state", "psu1", "psu0", psu_state[0] }, // Using cpld + { "state", "psu2", "psu1", psu_state[1] }, + { "psu_voltin", "psu1", "psoc_psu1_vin", psu_state[2] }, + { "psu_voltin", "psu2", "psoc_psu2_vin", psu_state[3] }, +}; +#define PSU_WIRE_TBL_TOTAL ( sizeof(psu_wire_tbl)/ sizeof(const struct psu_wire_tbl_s) ) + +static char * +psu_attr_get_wirep(const char *psu_attrp, const char *psu_namep, char **psu_statepp) +{ + int i; + + for (i = 0; i < PSU_WIRE_TBL_TOTAL; i++) { + if (strncmp(psu_wire_tbl[i].psu_attr, psu_attrp, strlen(psu_attrp)) == 0 && + strncmp(psu_wire_tbl[i].psu_name, psu_namep, strlen(psu_namep)) == 0) { + if (psu_statepp) { + *psu_statepp = psu_wire_tbl[i].psu_state; + } + return psu_wire_tbl[i].psu_wire; + } + } + return NULL; +} + +int psu_check_state_normal(char *statep) +{ + if (strstr(statep, "normal")) { + return 1; + } + return 0; +} + +#define PSU_ATTR_VOLTIN ("psu_voltin") +#define PSU_ATTR_VOLTIN_LEN (10) + +/* Get PSU voltin for determon AC(110v) or DC(48v) */ +void psu_get_voltin(void) +{ + char acc_path[MAX_PATH_SIZE], volt[MIN_ACC_SIZE]; + psu_dev_t *devnamep; + unsigned int voltin; + char *invwirep; + int i, j; + + for (i = 0; i < PSU_DEV_GROUP_TOTAL; i++) { + //psu_dev_group[i].psu_name; + devnamep = psu_dev_group[i].psu_dev_namep; + for (j = 0; j < psu_dev_group[i].psu_dev_total; j++, devnamep++) { + if (strncmp(devnamep->inv_dev_attrp, PSU_ATTR_VOLTIN, PSU_ATTR_VOLTIN_LEN) == 0) { + invwirep = psu_attr_get_wirep(PSU_ATTR_VOLTIN, psu_dev_group[i].psu_name, NULL); + if (invwirep == NULL) { + printk(KERN_DEBUG "[p_thread] Invalid psuname: %s\n", psu_dev_group[i].psu_name); + continue; + } + sprintf(acc_path, devnamep->inv_dev_pathp, invwirep); + //printk(KERN_DEBUG "[p_thread] RYU: %s/%d: acc_path = %s\n",__func__,__LINE__,acc_path); + if (inventec_show_attr(volt, acc_path) <= 0) { + printk(KERN_DEBUG "[p_thread] Read %s failed\n", acc_path); + continue; + } + else { + voltin = simple_strtol(&volt[0], NULL, 10); + printk(KERN_DEBUG "[p_thread] Read %s %s = %u\n",acc_path,volt,voltin); + if (voltin > psu_voltin) { + psu_voltin = voltin; + } + } + } + } + } + + SYSFS_LOG("[p_thread] PSU voltin = %u\n", psu_voltin); +} + +#define PSU_ATTR_STATE ("state") +#define PSU_ATTR_STATE_LEN (5) + +/* psus_control() by inv_thread */ +int psus_control(int log_only) +{ + char acc_path[MAX_PATH_SIZE], state[MIN_ACC_SIZE]; + psu_dev_t *devnamep = NULL; + char *invwirep = NULL; + char *psu_statep = NULL; + int i, j, flag = 0; + + for (i = 0; i < PSU_DEV_GROUP_TOTAL; i++) { + devnamep = psu_dev_group[i].psu_dev_namep; + for (j = 0; j < psu_dev_group[i].psu_dev_total; j++, devnamep++) { + if (strncmp(devnamep->inv_dev_attrp, PSU_ATTR_STATE, PSU_ATTR_STATE_LEN) == 0) { + invwirep = psu_attr_get_wirep(PSU_ATTR_STATE, psu_dev_group[i].psu_name, &psu_statep); + if (invwirep == NULL) { + printk(KERN_DEBUG "[p_thread] Invalid psuname: %s\n", psu_dev_group[i].psu_name); + continue; + } + sprintf(acc_path, devnamep->inv_dev_pathp, invwirep); + //printk(KERN_INFO "[p_thread] RYU: %s/%d: acc_path = %s\n",__func__,__LINE__,acc_path); + if (inventec_show_attr(state, acc_path) <= 0) { + printk(KERN_DEBUG "[p_thread] Read %s failed\n", acc_path); + if (strncmp(psu_statep, PSU_STATE_ERROR, strlen(PSU_STATE_ERROR)) != 0) { + strcpy(psu_statep, PSU_STATE_ERROR); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,PSU_STATE_ERROR); + } + flag = 1; + } + else + if (strstr(state, "normal")) { + //printk(KERN_INFO "[p_thread] %s: %s\n", psu_dev_group[i].psu_name, state); + if (strncmp(psu_statep, state, strlen(state)) != 0) { + strcpy(psu_statep, state); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,state); + } + } + else + if (psu_voltin > PSU_VOLTIN_ACDC) { /* AC PSUS */ + //printk(KERN_INFO "[p_thread] RYU: %s: %s\n", psu_dev_group[i].psu_name, state); + if (strncmp(psu_statep, state, strlen(state)) != 0) { + strcpy(psu_statep, state); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,state); + } + flag = 1; + } + else { /* DC PSUS */ + if (strncmp(psu_statep, PSU_STATE_CHECKPSU, PSU_STATE_LEN_CHECKPSU) != 0) { + strcpy(psu_statep, PSU_STATE_CHECKPSU); + SYSFS_LOG("[p_thread] %s: %s\n",psu_dev_group[i].psu_name,PSU_STATE_CHECKPSU); + } + flag = 1; + } + } + } + } + + if (log_only) { + return 0; + } + + //SYSFS_LOG("[p_thread] RYU: %s: flag = %d\n",psu_wire_tbl[i].psu_name,flag); + if (flag == 1) { + status_led_grn("3"); + return 1; + } + return 0; +} + +/* End of psuinfo_device */ + +static int __init +psu_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_psu_path_init(); +#endif + return 0; +} + + +static void __exit +psu_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove psu module.\n"); +} + +/* led device *************************************/ +#define STATUS_LED_GRN_PATH "/sys/class/hwmon/hwmon%d/device/grn_led" +#define STATUS_LED_RED_PATH "/sys/class/hwmon/hwmon%d/device/red_led" + +#define FAN_LED_GRN1_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn1" +#define FAN_LED_GRN2_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn2" +#define FAN_LED_GRN3_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn3" +#define FAN_LED_GRN4_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_grn4" +#define FAN_LED_RED1_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red1" +#define FAN_LED_RED2_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red2" +#define FAN_LED_RED3_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red3" +#define FAN_LED_RED4_PATH "/sys/class/hwmon/hwmon%d/device/fan_led_red4" + +#define HWMON_DEVICE_DIAG_PATH "/sys/class/hwmon/hwmon%d/device/diag" +#define HWMON_DEVICE_CTRL_PATH "/sys/class/hwmon/hwmon%d/device/ctl" + +static char status_led_grn_path[MAX_PATH_SIZE]; +static char status_led_red_path[MAX_PATH_SIZE]; +static char fan_led_grn1_path[MAX_PATH_SIZE]; +static char fan_led_grn2_path[MAX_PATH_SIZE]; +static char fan_led_grn3_path[MAX_PATH_SIZE]; +static char fan_led_grn4_path[MAX_PATH_SIZE]; +static char fan_led_red1_path[MAX_PATH_SIZE]; +static char fan_led_red2_path[MAX_PATH_SIZE]; +static char fan_led_red3_path[MAX_PATH_SIZE]; +static char fan_led_red4_path[MAX_PATH_SIZE]; +static char hwmon_device_diag_path[MAX_PATH_SIZE]; +static char hwmon_device_ctrl_path[MAX_PATH_SIZE]; + +void sysfs_led_path_init(void) +{ + sprintf(&status_led_grn_path[0], STATUS_LED_GRN_PATH, get_hwm_cpld()); + sprintf(&status_led_red_path[0], STATUS_LED_RED_PATH, get_hwm_cpld()); + sprintf(&fan_led_grn1_path[0], FAN_LED_GRN1_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn2_path[0], FAN_LED_GRN2_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn3_path[0], FAN_LED_GRN3_PATH, get_hwm_psoc()); + sprintf(&fan_led_grn4_path[0], FAN_LED_GRN4_PATH, get_hwm_psoc()); + sprintf(&fan_led_red1_path[0], FAN_LED_RED1_PATH, get_hwm_psoc()); + sprintf(&fan_led_red2_path[0], FAN_LED_RED2_PATH, get_hwm_psoc()); + sprintf(&fan_led_red3_path[0], FAN_LED_RED3_PATH, get_hwm_psoc()); + sprintf(&fan_led_red4_path[0], FAN_LED_RED4_PATH, get_hwm_psoc()); + sprintf(&hwmon_device_diag_path[0], HWMON_DEVICE_DIAG_PATH, get_hwm_psoc()); + sprintf(&hwmon_device_ctrl_path[0], HWMON_DEVICE_CTRL_PATH, get_hwm_cpld()); +} + +/* return 0/off 1/green 2/red */ +int +status_led_check_color(void) +{ + char tmpbuf[MIN_ACC_SIZE]; + int ret = STATUS_LED_INVALID; + + if (inventec_show_attr(&tmpbuf[0], status_led_grn_path) > 0) { + if (tmpbuf[0] == '0') { + ret = STATUS_LED_GRN0; + } + if (tmpbuf[0] == '1') { + ret = STATUS_LED_GRN1; + } + if (tmpbuf[0] == '2') { + ret = STATUS_LED_GRN2; + } + if (tmpbuf[0] == '3') { + ret = STATUS_LED_GRN3; + } + if (tmpbuf[0] == '7') { + ret = STATUS_LED_GRN7; + } + return ret; + } + + if (inventec_show_attr(&tmpbuf[0], status_led_red_path) > 0) { + if (tmpbuf[0] == '0') { + ret = STATUS_LED_RED0; + } + if (tmpbuf[0] == '1') { + ret = STATUS_LED_RED1; + } + if (tmpbuf[0] == '2') { + ret = STATUS_LED_RED2; + } + if (tmpbuf[0] == '3') { + ret = STATUS_LED_RED3; + } + if (tmpbuf[0] == '7') { + ret = STATUS_LED_RED7; + } + return ret; + } + return ret; +} + +/* + * Store attr Section + */ +static DEFINE_MUTEX(diag_mutex); + +ssize_t status_led_diag_mode_enable(void) +{ + char tmp[MIN_ACC_SIZE]; + ssize_t ret; + + ret = inventec_show_attr(&tmp[0], hwmon_device_diag_path); + if (ret <= 0) { + return ret; + } + + if (tmp[0] == '0') { + mutex_lock(&diag_mutex); + ret = inventec_store_attr("1", 1, hwmon_device_diag_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return ret; + } + + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return ret; + } + mutex_unlock(&diag_mutex); + } + + return ret; +} + +ssize_t status_led_diag_mode_disable(void) +{ + char tmp[MIN_ACC_SIZE]; + ssize_t ret; + + ret = inventec_show_attr(&tmp[0], hwmon_device_diag_path); + if (ret <= 0) { + return ret; + } + + if (tmp[0] == '1') { + mutex_lock(&diag_mutex); + ret = inventec_store_attr("0", 1, hwmon_device_diag_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return 1; + } + + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + mutex_unlock(&diag_mutex); + return 1; + } + mutex_unlock(&diag_mutex); + } + return 1; +} + +ssize_t +status_led_change(const char *path1, const char *tmp1, const char *path2, const char *tmp2) +{ + ssize_t ret; + + ret = inventec_store_attr(tmp1, strlen(tmp1), path1); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(tmp2, strlen(tmp2), path2); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_led_red(const char *freq) +{ + ssize_t ret; + + ret = inventec_store_attr("0", 1, &status_led_grn_path[0]); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(freq, strlen(freq), &status_led_red_path[0]); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +ssize_t +status_led_grn(const char *freq) +{ + ssize_t ret; + + ret = inventec_store_attr("0", 1, &status_led_red_path[0]); + if (ret < 0) { + return ret; + } + ret = inventec_store_attr(freq, strlen(freq), &status_led_grn_path[0]); + if (ret < 0) { + return ret; + } + if ((ret = status_led_diag_mode_enable()) <= 0) { + return ret; + } + ssleep(1); + if ((ret = status_led_diag_mode_disable()) <= 0) { + return ret; + } + return ret; +} + +static int status_led_diag_mode = STATUS_LED_MODE_AUTO; + +int status_led_check_diag_mode(void) +{ + return status_led_diag_mode; +} + +void sys_ready(void) +{ + ssize_t ret; + ret = inventec_store_attr("1", 1, hwmon_device_ctrl_path); + if (ret < 0) { + SYSFS_LOG("[p_thread] set ctl fail"); + } + SYSFS_LOG("[p_thread] set ctl successfully"); +} + +/* End of ledinfo_device */ + +static int __init +led_device_init(void) +{ +#ifdef INV_PTHREAD_KERNEL_MODULE + sysfs_led_path_init(); + sys_ready(); +#endif + return 0; +} + + +static void __exit +led_device_exit(void) +{ + printk(KERN_INFO "[p_thread] Remove led module.\n"); +} + +/* sensor device **********************************/ +#define SENSOR_DEV_PATH_SWITCH_TEMP "/sys/class/hwmon/hwmon%d/device/switch_tmp" + +static char sensor_dev_path_switch_temp[MAX_PATH_SIZE]; + +void sysfs_sensor_path_init(void) +{ + sprintf(&sensor_dev_path_switch_temp[0], SENSOR_DEV_PATH_SWITCH_TEMP, get_hwm_psoc()); +} + +void switch_temp_update(void) +{ + char buf[MIN_ACC_SIZE]; + ssize_t count = inventec_show_attr(&buf[0], "proc/switch/temp"); + if (count > 0) { + //printk(KERN_ERR "[p_thread] [STEMP] Switch temperature is out of range: %d\n", stemp); + inventec_store_attr(&buf[0], count, sensor_dev_path_switch_temp); + } +} + +/**************************************************/ +/* From system_device */ +static int inv_pthread_control = 1; + +int thread_control(void) +{ + return inv_pthread_control; +} + +void thread_control_set(int val) +{ + inv_pthread_control = val; +} +/* End system_device */ + +#define THREAD_SLEEP_MINS (3) +#define THREAD_DELAY_MINS (THREAD_SLEEP_MINS + THREAD_SLEEP_MINS + 1) + +extern void psu_get_voltin(void); + +static struct task_struct *thread_st; +static int thread_data; + +#ifdef SWITCH_HEALTH_LED_CHANGE_VIA_GPIO +void led_set_gpio_to_change_status_led(void) +{ + ssize_t ret = inventec_store_attr("57", 2, "/sys/class/gpio/export"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write 57 to /sys/class/gpio/export failed\n"); + return; + } + ret = inventec_store_attr("low", 3, "/sys/class/gpio/gpio57/direction"); + if (ret < 0) { + SYSFS_LOG("[p_thread] Write low to /sys/class/gpio/gpio57/direction failed\n"); + return; + } + SYSFS_LOG("[p_thread] Set gpio to support status led change successfully\n"); +} +#endif + +// Function executed by kernel thread +static int thread_fn(void *unused) +{ + /* Delay for guarantee HW ready */ + ssleep(THREAD_DELAY_MINS); + +#ifndef INV_PTHREAD_KERNEL_MODULE + sysfs_led_path_init(); + sysfs_fan_path_init(); + sysfs_psu_path_init(); +#endif + //sysfs_sensor_path_init(); + + /* Default status init */ + status_led_grn("7"); + + psu_get_voltin(); + +#ifdef SWITCH_HEALTH_LED_CHANGE_VIA_GPIO + led_set_gpio_to_change_status_led(); +#endif + + while (1) + { + ssleep(THREAD_SLEEP_MINS); + + if (thread_control() == 0) { + printk(KERN_INFO "[p_thread] %s/%d: Thread Stop by inv_pthread control\n",__func__,__LINE__); + break; + } + + if (status_led_check_diag_mode() == STATUS_LED_MODE_MANU) { + /* status led in change color/freq mode, higher priority. Ignore fans sttaus */ + continue; + } + + //switch_temp_update(); + + if (fans_control() > 0) { + psus_control(1); + continue; + } + else + if (psus_control(0) > 0) { + continue; + } + + if (status_led_check_color() != STATUS_LED_GRN7) { /* status led red, change it to green */ + status_led_grn("7"); + } + } + +#ifndef INV_PTHREAD_KERNEL_MODULE +err_inv_pthread_fn_1: +#endif + do_exit(0); + printk(KERN_INFO "[p_thread] %s/%d: Thread Stopped\n",__func__,__LINE__); + return 0; +} + + +static ssize_t s_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + int fan_absence; + size_t count; + + fan_absence = fans_control(); + count += sprintf(&buf[count], "%d\n", fan_absence); + return count; +} + +static ssize_t s_store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) +{ + return count; +} + +static struct attribute status_att = { + .name = "fan_absence", + .mode = 0777, +}; + +static const struct sysfs_ops status_ops = { + .show = s_show, + .store = s_store, +}; + +static struct kobj_type status_ktype = { + .sysfs_ops = &status_ops, +}; + + +static int __init inv_pthread_init(void) +{ + int retval; + + status_kobj = kzalloc(sizeof(*status_kobj), GFP_KERNEL); + if(!status_kobj) + return PTR_ERR(status_kobj); + + status_kset = kset_create_and_add("platform_status", NULL, kernel_kobj); + if(!status_kset) + return -1; + + status_kobj->kset = status_kset; + + retval = kobject_init_and_add(status_kobj, &status_ktype, NULL, "fan"); + if(retval) + return retval; + + retval = sysfs_create_file(status_kobj, &status_att); + + + inventec_class_init(); + fan_device_init(); + psu_device_init(); + led_device_init(); + + thread_control_set(1); + + printk(KERN_INFO "[p_thread] %s/%d: Creating Thread\n",__func__,__LINE__); + //Create the kernel thread with name 'inv_pthread' + thread_st = kthread_run(thread_fn, (void*)&thread_data, "inv_pthread"); + if (thread_st) + printk(KERN_INFO "[p_thread] inv_pthread Created successfully\n"); + else + printk(KERN_ERR "[p_thread] inv_pthread creation failed\n"); + + return retval; +} + +static void __exit inv_pthread_exit(void) +{ + thread_control_set(0); + /* Delay for guarantee thread exit */ + ssleep(THREAD_DELAY_MINS); + + fan_device_exit(); + psu_device_exit(); + led_device_exit(); + inventec_class_exit(); + + sysfs_remove_file(status_kobj, &status_att); + kset_unregister(status_kset); + kobject_del(status_kobj); + + printk(KERN_INFO "[p_thread] inv_pthread cleaning Up\n"); +} + +module_init(inv_pthread_init); +module_exit(inv_pthread_exit); + +MODULE_AUTHOR("Robert "); +MODULE_DESCRIPTION("Inventec Platform Management Thread"); +MODULE_VERSION("version 1.0"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/utils/inventec_d7264_util.py b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/utils/inventec_d7264_util.py index 18853b7b2400..fea26decf2a5 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/utils/inventec_d7264_util.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d7264q28b/utils/inventec_d7264_util.py @@ -115,6 +115,7 @@ def exec_cmd(cmd, show): 'echo inv_eeprom 0x53> /sys/bus/i2c/devices/i2c-0/new_device'] drivers =[ +'gpio-ich', 'lpc_ich', 'i2c-i801', 'i2c-mux', @@ -124,9 +125,9 @@ def exec_cmd(cmd, show): 'inv_platform', 'inv_psoc', 'inv_cpld', +'inv_pthread', 'swps'] - def system_install(): global FORCE @@ -213,7 +214,7 @@ def install(): status = system_install() if status: if FORCE == 0: - return status + return status else: print " D7264 devices detected...." return diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/changelog b/platform/broadcom/sonic-platform-modules-inventec/debian/changelog index e49ed14c3e21..46aebb02ec8e 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/changelog +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/changelog @@ -1,7 +1,17 @@ sonic-inventec-platform-modules (1.1.0) unstable; urgency=low * Add support for Inventec d7264 - -- developer Tue, 17 Apr 2018 15:27:30 +0800 + -- alvin lin Thu, 12 Jul 2018 16:00:00 +0800 + +sonic-inventec-platform-modules (1.1.0) unstable; urgency=low + * Add support for Inventec d6556 + + -- alvin lin Thu, 12 Jul 2018 16:00:00 +0800 + +sonic-inventec-platform-modules (1.1.0) unstable; urgency=low + * Add support for Inventec d6254 + + -- alvin lin Wed, 09 May 2018 16:00:00 +0800 sonic-inventec-platform-modules (1.1.0) unstable; urgency=low * Add support for Inventec d7054 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/control b/platform/broadcom/sonic-platform-modules-inventec/debian/control index 9368de788ce9..464211650fa9 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/control +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/control @@ -6,16 +6,26 @@ Build-Depends: debhelper (>= 8.0.0), bzip2 Standards-Version: 3.9.3 Package: platform-modules-d7032q28b -Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 +Architecture: amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d7054q28b Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 +Description: kernel modules for platform devices such as fan, led + +Package: platform-modules-d6254qs +Architecture: amd64 +Depends: linux-image-4.9.0-7-amd64 +Description: kernel modules for platform devices such as fan, led + +Package: platform-modules-d6556 +Architecture: amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d7264q28b Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6254qs.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6254qs.init new file mode 100644 index 000000000000..92405e28fd26 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6254qs.init @@ -0,0 +1,73 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup Inventec d6254qs board. +### END INIT INFO + +DIR=/usr/share/sonic/device/x86_64-inventec_d6254qs-r0/plugins +MONITOR_DAEMON=$DIR/transceiver_monitor.py +MONITOR_DAEMON_NAME=transceiver_monitor +LED_DAEMON=$DIR/led_proc.py +LED_DAEMON_NAME=led_proc +ASIC_DAEMON=$DIR/asic_monitor.py +ASIC_DAEMON_NAME=asic_monitor +ASIC_DAEMON_NAM=asic_monitor +PLATFORM_STATUS_DAEMON=$DIR/platform_status.py +PLATFORM_STATUS_DAEMON_NAME=platform_status + +# The process ID of the script when it runs is stored here: +MONITOR_PIDFILE=/var/run/$MONITOR_DAEMON_NAME.pid +LED_PIDFILE=/var/run/$LED_DAEMON_NAME.pid +ASIC_PIDFILE=/var/run/$ASIC_DAEMON_NAME.pid +PLATFORM_STATUS_PIDFILE=/var/run/$PLATFORM_STATUS_DAEMON_NAME.pid + +do_monitor_start() { + /sbin/start-stop-daemon --quiet --oknodo --pidfile $LED_PIDFILE --make-pidfile --startas $LED_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $MONITOR_PIDFILE --make-pidfile --startas $MONITOR_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $ASIC_PIDFILE --make-pidfile --startas $ASIC_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $PLATFORM_STATUS_PIDFILE --make-pidfile --startas $PLATFORM_STATUS_DAEMON --start --background -- $DAEMON_OPTS +} + +do_monitor_stop() { + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $MONITOR_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $LED_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $ASIC_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $PLATFORM_STATUS_PIDFILE --retry 10 +} + +case "$1" in +start) + echo -n "Setting up board... " + + depmod -a + /usr/local/bin/inventec_d6254_util.py -f install + do_monitor_${1} + echo "done." + ;; + +stop) + + /usr/local/bin/inventec_d6254_util.py -f clean + do_monitor_${1} + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-d6254qs.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6254qs.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6254qs.install new file mode 100644 index 000000000000..c4c32c02b299 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6254qs.install @@ -0,0 +1,6 @@ +d6254qs/utils/inventec_d6254_util.py usr/local/bin +common/utils/transceiver_monitor.py usr/share/sonic/device/x86_64-inventec_d6254qs-r0/plugins +common/utils/led_proc.py usr/share/sonic/device/x86_64-inventec_d6254qs-r0/plugins +common/utils/asic_monitor.py usr/share/sonic/device/x86_64-inventec_d6254qs-r0/plugins +common/utils/platform_status.py usr/share/sonic/device/x86_64-inventec_d6254qs-r0/plugins +systemd/platform-modules-d6254qs.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6556.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6556.init new file mode 100644 index 000000000000..fc6ba5a261bf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6556.init @@ -0,0 +1,72 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup Inventec d6556 board. +### END INIT INFO + +DIR=/usr/share/sonic/device/x86_64-inventec_d6556-r0/plugins +MONITOR_DAEMON=$DIR/transceiver_monitor.py +MONITOR_DAEMON_NAME=transceiver_monitor +LED_DAEMON=$DIR/led_proc.py +LED_DAEMON_NAME=led_proc +ASIC_DAEMON=$DIR/asic_monitor.py +ASIC_DAEMON_NAME=asic_monitor +PLATFORM_STATUS_DAEMON=$DIR/platform_status.py +PLATFORM_STATUS_DAEMON_NAME=platform_status + +# The process ID of the script when it runs is stored here: +MONITOR_PIDFILE=/var/run/$MONITOR_DAEMON_NAME.pid +LED_PIDFILE=/var/run/$LED_DAEMON_NAME.pid +ASIC_PIDFILE=/var/run/$ASIC_DAEMON_NAME.pid +PLATFORM_STATUS_PIDFILE=/var/run/$PLATFORM_STATUS_DAEMON_NAME.pid + +do_monitor_start() { + /sbin/start-stop-daemon --quiet --oknodo --pidfile $LED_PIDFILE --make-pidfile --startas $LED_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $MONITOR_PIDFILE --make-pidfile --startas $MONITOR_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $ASIC_PIDFILE --make-pidfile --startas $ASIC_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $PLATFORM_STATUS_PIDFILE --make-pidfile --startas $PLATFORM_STATUS_DAEMON --start --background -- $DAEMON_OPTS +} + +do_monitor_stop() { + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $MONITOR_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $LED_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $ASIC_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $PLATFORM_STATUS_PIDFILE --retry 10 +} + +case "$1" in +start) + echo -n "Setting up board... " + + depmod -a + /usr/local/bin/inventec_d6556_util.py -f install + do_monitor_${1} + echo "done." + ;; + +stop) + + /usr/local/bin/inventec_d6556_util.py -f clean + do_monitor_${1} + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-d6556.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6556.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6556.install new file mode 100644 index 000000000000..f9e9de9a8b10 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d6556.install @@ -0,0 +1,6 @@ +d6556/utils/inventec_d6556_util.py usr/local/bin +common/utils/transceiver_monitor.py usr/share/sonic/device/x86_64-inventec_d6556-r0/plugins +common/utils/led_proc.py usr/share/sonic/device/x86_64-inventec_d6556-r0/plugins +common/utils/asic_monitor.py usr/share/sonic/device/x86_64-inventec_d6556-r0/plugins +common/utils/platform_status.py usr/share/sonic/device/x86_64-inventec_d6556-r0/plugins +systemd/platform-modules-d6556.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init index 97fee8c3ad57..bcc9610abedb 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.init @@ -16,19 +16,29 @@ MONITOR_DAEMON=$DIR/transceiver_monitor.py MONITOR_DAEMON_NAME=transceiver_monitor LED_DAEMON=$DIR/led_proc.py LED_DAEMON_NAME=led_proc +ASIC_DAEMON=$DIR/asic_monitor.py +ASIC_DAEMON_NAME=asic_monitor +PLATFORM_STATUS_DAEMON=$DIR/platform_status.py +PLATFORM_STATUS_DAEMON_NAME=platform_status # The process ID of the script when it runs is stored here: MONITOR_PIDFILE=/var/run/$MONITOR_DAEMON_NAME.pid LED_PIDFILE=/var/run/$LED_DAEMON_NAME.pid +ASIC_PIDFILE=/var/run/$ASIC_DAEMON_NAME.pid +PLATFORM_STATUS_PIDFILE=/var/run/$PLATFORM_STATUS_DAEMON_NAME.pid do_monitor_start() { /sbin/start-stop-daemon --quiet --oknodo --pidfile $LED_PIDFILE --make-pidfile --startas $LED_DAEMON --start --background -- $DAEMON_OPTS /sbin/start-stop-daemon --quiet --oknodo --pidfile $MONITOR_PIDFILE --make-pidfile --startas $MONITOR_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $ASIC_PIDFILE --make-pidfile --startas $ASIC_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $PLATFORM_STATUS_PIDFILE --make-pidfile --startas $PLATFORM_STATUS_DAEMON --start --background -- $DAEMON_OPTS } do_monitor_stop() { /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $MONITOR_PIDFILE --retry 10 /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $LED_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $ASIC_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $PLATFORM_STATUS_PIDFILE --retry 10 } case "$1" in diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install index c716a9d0d8b7..49ef07def38a 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7032q28b.install @@ -1,3 +1,6 @@ d7032q28b/utils/inventec_d7032_util.py usr/local/bin common/utils/transceiver_monitor.py usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/plugins common/utils/led_proc.py usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/plugins +common/utils/asic_monitor.py usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/plugins +common/utils/platform_status.py usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/plugins +systemd/platform-modules-d7032q28b.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init index a6e3e88f20d4..809ad6255556 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.init @@ -16,19 +16,29 @@ MONITOR_DAEMON=$DIR/transceiver_monitor.py MONITOR_DAEMON_NAME=transceiver_monitor LED_DAEMON=$DIR/led_proc.py LED_DAEMON_NAME=led_proc +ASIC_DAEMON=$DIR/asic_monitor.py +ASIC_DAEMON_NAME=asic_monitor +PLATFORM_STATUS_DAEMON=$DIR/platform_status.py +PLATFORM_STATUS_DAEMON_NAME=platform_status # The process ID of the script when it runs is stored here: MONITOR_PIDFILE=/var/run/$MONITOR_DAEMON_NAME.pid LED_PIDFILE=/var/run/$LED_DAEMON_NAME.pid +ASIC_PIDFILE=/var/run/$ASIC_DAEMON_NAME.pid +PLATFORM_STATUS_PIDFILE=/var/run/$PLATFORM_STATUS_DAEMON_NAME.pid do_monitor_start() { /sbin/start-stop-daemon --quiet --oknodo --pidfile $LED_PIDFILE --make-pidfile --startas $LED_DAEMON --start --background -- $DAEMON_OPTS /sbin/start-stop-daemon --quiet --oknodo --pidfile $MONITOR_PIDFILE --make-pidfile --startas $MONITOR_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $ASIC_PIDFILE --make-pidfile --startas $ASIC_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $PLATFORM_STATUS_PIDFILE --make-pidfile --startas $PLATFORM_STATUS_DAEMON --start --background -- $DAEMON_OPTS } do_monitor_stop() { /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $MONITOR_PIDFILE --retry 10 /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $LED_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $ASIC_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $PLATFORM_STATUS_PIDFILE --retry 10 } case "$1" in diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install index 699a5ef41417..0ffc0a4f92a3 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7054q28b.install @@ -1,4 +1,6 @@ d7054q28b/utils/inventec_d7054_util.py usr/local/bin common/utils/transceiver_monitor.py usr/share/sonic/device/x86_64-inventec_d7054q28b-r0/plugins common/utils/led_proc.py usr/share/sonic/device/x86_64-inventec_d7054q28b-r0/plugins - +common/utils/asic_monitor.py usr/share/sonic/device/x86_64-inventec_d7054q28b-r0/plugins +common/utils/platform_status.py usr/share/sonic/device/x86_64-inventec_d7054q28b-r0/plugins +systemd/platform-modules-d7054q28b.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.init b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.init index 87c145a95452..606c7a7cdd09 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.init +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.init @@ -8,21 +8,48 @@ # Should-Stop: # Default-Start: S # Default-Stop: 0 6 -# Short-Description: Setup Inventec d7054q28b board. +# Short-Description: Setup Inventec d7264q28b board. ### END INIT INFO +DIR=/usr/share/sonic/device/x86_64-inventec_d7264q28b-r0/plugins +MONITOR_DAEMON=$DIR/transceiver_monitor.py +MONITOR_DAEMON_NAME=transceiver_monitor +ASIC_DAEMON=$DIR/asic_monitor.py +ASIC_DAEMON_NAME=asic_monitor +PLATFORM_STATUS_DAEMON=$DIR/platform_status.py +PLATFORM_STATUS_DAEMON_NAME=platform_status + +# The process ID of the script when it runs is stored here: +MONITOR_PIDFILE=/var/run/$MONITOR_DAEMON_NAME.pid +ASIC_PIDFILE=/var/run/$ASIC_DAEMON_NAME.pid +PLATFORM_STATUS_PIDFILE=/var/run/$PLATFORM_STATUS_DAEMON_NAME.pid + +do_monitor_start() { + /sbin/start-stop-daemon --quiet --oknodo --pidfile $MONITOR_PIDFILE --make-pidfile --startas $MONITOR_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $ASIC_PIDFILE --make-pidfile --startas $ASIC_DAEMON --start --background -- $DAEMON_OPTS + /sbin/start-stop-daemon --quiet --oknodo --pidfile $PLATFORM_STATUS_PIDFILE --make-pidfile --startas $PLATFORM_STATUS_DAEMON --start --background -- $DAEMON_OPTS +} + +do_monitor_stop() { + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $MONITOR_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $ASIC_PIDFILE --retry 10 + /sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $PLATFORM_STATUS_PIDFILE --retry 10 +} + case "$1" in start) echo -n "Setting up board... " depmod -a /usr/local/bin/inventec_d7264_util.py -f install + do_monitor_${1} echo "done." ;; stop) /usr/local/bin/inventec_d7264_util.py -f clean + do_monitor_${1} echo "done." ;; diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.install b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.install index dba76a7d05c1..66e77e1ddf89 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.install +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.install @@ -1 +1,5 @@ d7264q28b/utils/inventec_d7264_util.py usr/local/bin +common/utils/transceiver_monitor.py usr/share/sonic/device/x86_64-inventec_d7264q28b-r0/plugins +common/utils/asic_monitor.py usr/share/sonic/device/x86_64-inventec_d7264q28b-r0/plugins +common/utils/platform_status.py usr/share/sonic/device/x86_64-inventec_d7264q28b-r0/plugins +systemd/platform-modules-d7264q28b.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.upstart b/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.upstart deleted file mode 100644 index a438cb7bc7e9..000000000000 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/platform-modules-d7264q28b.upstart +++ /dev/null @@ -1,5 +0,0 @@ -description "SONiC platform service" - -respawn - -exec /usr/local/bin/inventec_d7264_util.py -f install diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/rules b/platform/broadcom/sonic-platform-modules-inventec/debian/rules index 9c3dcf4df8a3..2e396e167822 100755 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/rules +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/rules @@ -14,10 +14,10 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= d7032q28b d7054q28b d7264q28b +MODULE_DIRS:= d7032q28b d7054q28b d6254qs d6556 d7264q28b %: - dh $@ + dh $@ --with=systemd override_dh_auto_build: (for mod in $(MODULE_DIRS); do \ diff --git a/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d6254qs.service b/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d6254qs.service new file mode 100644 index 000000000000..b7aa6dc0e1e7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d6254qs.service @@ -0,0 +1,13 @@ +[Unit] +Description=Inventec d6254qs Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-d6254qs start +ExecStop=-/etc/init.d/platform-modules-d6254qs stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d6556.service b/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d6556.service new file mode 100644 index 000000000000..6fbd6711ede8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d6556.service @@ -0,0 +1,13 @@ +[Unit] +Description=Inventec d7032q28b Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-d6556 start +ExecStop=-/etc/init.d/platform-modules-d6556 stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7032q28b.service b/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7032q28b.service new file mode 100644 index 000000000000..b96374b343f4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7032q28b.service @@ -0,0 +1,13 @@ +[Unit] +Description=Inventec d7032q28b Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-d7032q28b start +ExecStop=-/etc/init.d/platform-modules-d7032q28b stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7054q28b.service b/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7054q28b.service new file mode 100644 index 000000000000..0c2d463598ad --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7054q28b.service @@ -0,0 +1,13 @@ +[Unit] +Description=Inventec d7054q28b Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-d7054q28b start +ExecStop=-/etc/init.d/platform-modules-d7054q28b stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7264q28b.service b/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7264q28b.service new file mode 100644 index 000000000000..a4cda3934357 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-inventec/systemd/platform-modules-d7264q28b.service @@ -0,0 +1,13 @@ +[Unit] +Description=Inventec d7032q28b Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-d7264q28b start +ExecStop=-/etc/init.d/platform-modules-d7264q28b stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target From ea28f3aa4499ea201179a8b4ee5dc5b920a22cef Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Sat, 15 Sep 2018 22:15:02 -0700 Subject: [PATCH 1621/1833] [sonic-cfggen] Add support to generate sample t1 config (#2039) * [sonic-cfggen] Add support to generate sample t1 config * Fix typo * Fix space issue * Add list of preset messages in help message * Utilize choice support of argparse * Fix missing module in setup.py --- src/sonic-config-engine/config_samples.py | 66 +++++++++++++++++++++++ src/sonic-config-engine/setup.py | 2 +- src/sonic-config-engine/sonic-cfggen | 7 +++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 src/sonic-config-engine/config_samples.py diff --git a/src/sonic-config-engine/config_samples.py b/src/sonic-config-engine/config_samples.py new file mode 100644 index 000000000000..6cb417b9a50b --- /dev/null +++ b/src/sonic-config-engine/config_samples.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +import os +import sys +from natsort import natsorted + +def generate_t1_sample_config(data): + data['DEVICE_METADATA']['localhost']['hostname'] = 'sonic' + data['DEVICE_METADATA']['localhost']['type'] = 'LeafRouter' + data['DEVICE_METADATA']['localhost']['bgp_asn'] = '65100' + data['LOOPBACK_INTERFACE'] = {"Loopback0|10.1.0.1/32": {}} + data['BGP_NEIGHBOR'] = {} + data['DEVICE_NEIGHBOR'] = {} + data['INTERFACE'] = {} + port_count = 0 + total_port_amount = len(data['PORT']) + for port in natsorted(data['PORT'].keys()): + data['PORT'][port]['admin_status'] = 'up' + data['PORT'][port]['mtu'] = '9100' + local_addr = '10.0.{}.{}'.format(2 * port_count / 256, 2 * port_count % 256) + peer_addr = '10.0.{}.{}'.format(2 * port_count / 256, 2 * port_count % 256 + 1) + peer_name='ARISTA{0:02d}{1}'.format(1+port_count%(total_port_amount/2), 'T2' if port_count < (total_port_amount/2) else 'T0') + peer_asn = 65200 if port_count < total_port_amount/2 else 64001 + port_count - total_port_amount/2 + data['INTERFACE']['{}|{}/31'.format(port, local_addr)] = {} + data['BGP_NEIGHBOR'][peer_addr] = { + 'rrclient': 0, + 'name': peer_name, + 'local_addr': local_addr, + 'nhopself': 0, + 'holdtime': '180', + 'asn': str(peer_asn), + 'keepalive': '60' + } + port_count += 1 + return data; + +def generate_empty_config(data): + new_data = {'DEVICE_METADATA': data['DEVICE_METADATA']} + if not new_data['DEVICE_METADATA']['localhost'].has_key('hostname'): + new_data['DEVICE_METADATA']['localhost']['hostname'] = 'sonic' + if not new_data['DEVICE_METADATA']['localhost'].has_key('type'): + new_data['DEVICE_METADATA']['localhost']['type'] = 'LeafRouter' + return new_data + +def generate_l2_config(data): + if not data['DEVICE_METADATA']['localhost'].has_key('hostname'): + data['DEVICE_METADATA']['localhost']['hostname'] = 'sonic' + if not data['DEVICE_METADATA']['localhost'].has_key('type'): + data['DEVICE_METADATA']['localhost']['type'] = 'ToRRouter' + data['VLAN'] = {'Vlan1000': {'vlanid': '1000'}} + data['VLAN_MEMBER'] = {} + for port in natsorted(data['PORT'].keys()): + data['VLAN_MEMBER']['Vlan1000|{}'.format(port)] = {'tagging_mode': 'untagged'} + return data + +_sample_generators = { + 't1': generate_t1_sample_config, + 'l2': generate_l2_config, + 'empty': generate_empty_config + } + +def get_available_config(): + return _sample_generators.keys() + +def generate_sample_config(data, setting_name): + return _sample_generators[setting_name.lower()](data) + diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 1d0c7f99fa41..8375b6af89ad 100755 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -16,7 +16,7 @@ def get_test_suite(): author='Taoyu Li', author_email='taoyl@microsoft.com', url='https://github.com/Azure/sonic-buildimage', - py_modules=['portconfig', 'minigraph', 'openconfig_acl', 'sonic_platform'], + py_modules=['portconfig', 'minigraph', 'openconfig_acl', 'sonic_platform', 'config_samples'], scripts=['sonic-cfggen'], install_requires=['lxml', 'jinja2>=2.10', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind==0.6.0'], test_suite='setup.get_test_suite', diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index bdb3c804fc73..463b69c8f167 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -31,6 +31,8 @@ from portconfig import get_port_config from sonic_platform import get_machine_info from sonic_platform import get_platform_info from sonic_platform import get_system_mac +from config_samples import generate_sample_config +from config_samples import get_available_config from swsssdk import ConfigDBConnector from collections import OrderedDict from natsort import natsorted @@ -156,6 +158,7 @@ def main(): group.add_argument("--var-json", help="print the value of a variable, in json format") group.add_argument("--write-to-db", help="write config into configdb", action='store_true') group.add_argument("--print-data", help="print all data", action='store_true') + group.add_argument("--preset", help="generate sample configuration from a preset template", choices=get_available_config()) args = parser.parse_args() platform = get_platform_info(get_machine_info()) @@ -244,6 +247,10 @@ def main(): if args.print_data: print(json.dumps(FormatConverter.to_serialized(data), indent=4, cls=minigraph_encoder)) + if args.preset != None: + data = generate_sample_config(data, args.preset) + print(json.dumps(FormatConverter.to_serialized(data), indent=4, cls=minigraph_encoder)) + if __name__ == "__main__": main() From 51a8d8ecfa0ad11961aeb7140d6b6ef20602e29f Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Mon, 17 Sep 2018 03:10:03 +0300 Subject: [PATCH 1622/1833] [docker-orchagent]: Upgrade iproute2 to v4.9 (#2052) Signed-off-by: Marian Pritsak --- dockers/docker-orchagent/Dockerfile.j2 | 2 ++ platform/barefoot/docker-orchagent-bfn.mk | 2 +- platform/broadcom/docker-orchagent-brcm.mk | 2 +- platform/cavium/docker-orchagent-cavm.mk | 2 +- platform/centec/docker-orchagent-centec.mk | 2 +- platform/marvell/docker-orchagent-mrvl.mk | 2 +- platform/mellanox/docker-orchagent-mlnx.mk | 2 +- platform/nephos/docker-orchagent-nephos.mk | 2 +- 8 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index dc70bbcbdedc..61cb094ba70d 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -15,6 +15,8 @@ RUN apt-get install -f -y ndisc6 ## TODO: implicitly install dependencies RUN apt-get -y install libjemalloc1 +RUN apt-get install -y libelf1 libmnl0 + COPY \ {% for deb in docker_orchagent_debs.split(' ') -%} debs/{{ deb }}{{' '}} diff --git a/platform/barefoot/docker-orchagent-bfn.mk b/platform/barefoot/docker-orchagent-bfn.mk index f13fa63d6f2a..67069a6060c4 100644 --- a/platform/barefoot/docker-orchagent-bfn.mk +++ b/platform/barefoot/docker-orchagent-bfn.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_BFN = docker-orchagent-bfn.gz $(DOCKER_ORCHAGENT_BFN)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_BFN)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_BFN)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) $(DOCKER_ORCHAGENT_BFN)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BFN) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BFN) diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index 066973967450..5b4cd31f8b39 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_BRCM = docker-orchagent-brcm.gz $(DOCKER_ORCHAGENT_BRCM)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) $(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index a171a6c801d7..6513fbabf4f3 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz $(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) $(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk index e1d7fd6cf0d6..c6ee277f7ed7 100644 --- a/platform/centec/docker-orchagent-centec.mk +++ b/platform/centec/docker-orchagent-centec.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_CENTEC = docker-orchagent-centec.gz $(DOCKER_ORCHAGENT_CENTEC)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_CENTEC)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_CENTEC)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) $(DOCKER_ORCHAGENT_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC) diff --git a/platform/marvell/docker-orchagent-mrvl.mk b/platform/marvell/docker-orchagent-mrvl.mk index f2cb0c997d75..1106aedac05d 100644 --- a/platform/marvell/docker-orchagent-mrvl.mk +++ b/platform/marvell/docker-orchagent-mrvl.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_MRVL = docker-orchagent-mrvl.gz $(DOCKER_ORCHAGENT_MRVL)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_MRVL)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_MRVL)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) $(DOCKER_ORCHAGENT_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MRVL) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MRVL) diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index 6dda3c446b06..f43f986527a3 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz $(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) $(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) diff --git a/platform/nephos/docker-orchagent-nephos.mk b/platform/nephos/docker-orchagent-nephos.mk index b21e69d6cf87..098a94772b5c 100644 --- a/platform/nephos/docker-orchagent-nephos.mk +++ b/platform/nephos/docker-orchagent-nephos.mk @@ -2,7 +2,7 @@ DOCKER_ORCHAGENT_NEPHOS = docker-orchagent-nephos.gz $(DOCKER_ORCHAGENT_NEPHOS)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_NEPHOS)_DEPENDS += $(SWSS) $(REDIS_TOOLS) +$(DOCKER_ORCHAGENT_NEPHOS)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) $(DOCKER_ORCHAGENT_NEPHOS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_NEPHOS) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_NEPHOS) From f7024424bb19de16ae6964bc85a4caf3d2b050eb Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 17 Sep 2018 20:23:36 -0700 Subject: [PATCH 1623/1833] [minigraph]: Add min_links attribute to PORTCHANNEL configuration table (#2053) The default min_links value is the ceiling value of 75% of total number of members. Signed-off-by: Shu0T1an ChenG --- src/sonic-config-engine/minigraph.py | 5 +++-- src/sonic-config-engine/tests/test_cfggen.py | 4 ++-- src/sonic-config-engine/tests/test_minigraph_case.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index b5fa98bc98d5..a978f5906eb7 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1,5 +1,6 @@ #!/usr/bin/env python import calendar +import math import os import sys import socket @@ -188,9 +189,9 @@ def parse_dpg(dpg, hname): intfs_inpc.append(pcmbr_list[i]) pc_members[pcintfname + KEY_SEPARATOR + pcmbr_list[i]] = {'NULL': 'NULL'} if pcintf.find(str(QName(ns, "Fallback"))) != None: - pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text} + pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text, 'min_links': str(int(math.ceil(len() * 0.75)))} else: - pcs[pcintfname] = {'members': pcmbr_list} + pcs[pcintfname] = {'members': pcmbr_list, 'min_links': str(int(math.ceil(len(pcmbr_list) * 0.75)))} vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) vlan_intfs = [] diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index fbb8ca6b21a7..7ffdf61a4058 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -115,12 +115,12 @@ def test_minigraph_vlan_interfaces(self): def test_minigraph_portchannels(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet4'], 'mtu': '9100'}}") + self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100'}}") def test_minigraph_portchannel_with_more_member(self): argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124'], 'mtu': '9100'}}") + self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'min_links': '3', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124'], 'mtu': '9100'}}") def test_minigraph_portchannel_members(self): argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v "PORTCHANNEL_MEMBER.keys()"' diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 6a4849c71480..67a82abb09b6 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -87,7 +87,7 @@ def test_minigraph_vlan_interfaces(self): def test_minigraph_portchannels(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'members': ['Ethernet4'], 'mtu': '9100'}}") + self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100'}}") def test_minigraph_console_port(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v CONSOLE_PORT' From ef4ee9f242c55c751e4f46a2d98ad6f39730bd93 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 18 Sep 2018 01:23:50 -0700 Subject: [PATCH 1624/1833] [sonic-py-swsssdk] Update submodule (#2054) --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 6272b5f7abb7..9d36ad3b4d08 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 6272b5f7abb743411c703dac46eb39f951b57818 +Subproject commit 9d36ad3b4d0850429a021d79b12ffcc194642d96 From 514b38f348f396737901c51e8b6d2f5b32d05ab6 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 19 Sep 2018 23:14:10 +0300 Subject: [PATCH 1625/1833] [mellanox]: Integrate CRIU tool to SYNCD docker container (#2061) Signed-off-by: Volodymyr Samotiy --- platform/mellanox/criu.mk | 8 ++++++++ platform/mellanox/criu/Makefile | 14 ++++++++++++++ platform/mellanox/docker-syncd-mlnx.mk | 3 ++- platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 2 +- sonic-slave/Dockerfile | 15 ++++++++++++++- 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 platform/mellanox/criu.mk create mode 100644 platform/mellanox/criu/Makefile diff --git a/platform/mellanox/criu.mk b/platform/mellanox/criu.mk new file mode 100644 index 000000000000..01a425bb2a8a --- /dev/null +++ b/platform/mellanox/criu.mk @@ -0,0 +1,8 @@ +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 new file mode 100644 index 000000000000..e9d49b569042 --- /dev/null +++ b/platform/mellanox/criu/Makefile @@ -0,0 +1,14 @@ +.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.mk b/platform/mellanox/docker-syncd-mlnx.mk index 6ac895d2eb9c..5ad6f6dccf1c 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) +$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MLNX_SFPD) $(CRIU) $(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) ifneq ($(ENABLE_SYNCD_RPC),y) @@ -13,3 +13,4 @@ $(DOCKER_SYNCD_MLNX)_CONTAINER_NAME = syncd $(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 += --tmpfs /run/criu diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 971602a212f0..bf301f179a42 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 libxml2 +RUN apt-get install -y --no-install-recommends libxml2 iptables libbsd0 protobuf-c-compiler protobuf-compiler python-protobuf libprotobuf-c1 python-future python-ipaddr libnet1 pkg-config asciidoc xmlto RUN dpkg -i \ {% for deb in docker_syncd_mlnx_debs.split(' ') -%} diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 32218b44d1df..c284161c7edd 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -230,7 +230,20 @@ RUN apt-get update && apt-get install -y \ # For bash texi2html \ # For initramfs - bash-completion + 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 linux build RUN apt-get -y build-dep linux From 5e082133cdd1ee8c9c9d19a0ba1b5999890ea914 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Wed, 19 Sep 2018 13:25:54 -0700 Subject: [PATCH 1626/1833] [arista] update arista drivers submodule (#2059) --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/platform-modules-arista.mk | 2 -- platform/broadcom/sonic-platform-modules-arista | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 1133dc7c957b..f705fe155859 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 1133dc7c957bcca5305aab5abf569d0d90605aa4 +Subproject commit f705fe155859084d7df916e580659394e1516f6c diff --git a/platform/broadcom/platform-modules-arista.mk b/platform/broadcom/platform-modules-arista.mk index 73d86bda4e33..480aa0cf8396 100644 --- a/platform/broadcom/platform-modules-arista.mk +++ b/platform/broadcom/platform-modules-arista.mk @@ -23,5 +23,3 @@ export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MOD export ARISTA_SCD_DRIVER_CONFIG=m SONIC_STRETCH_DEBS += $(ARISTA_PLATFORM_MODULE) - -export ARISTA_SCD_DRIVER_CONFIG=m diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 1133dc7c957b..f705fe155859 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 1133dc7c957bcca5305aab5abf569d0d90605aa4 +Subproject commit f705fe155859084d7df916e580659394e1516f6c From 8a5e6ac47d31ee5b513a6cf856e0e32fa1e58a42 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 20 Sep 2018 08:18:39 +0300 Subject: [PATCH 1627/1833] [docker-orchagent]: Add vrfmgrd to supervisorctl (#2055) * [docker-orchagent]: Add vrfmgrd to supervisorctl Signed-off-by: Marian Pritsak * [sonic-vs]: Add vrfmgrd to supervisorctl Signed-off-by: Marian Pritsak --- dockers/docker-orchagent/start.sh | 2 ++ dockers/docker-orchagent/supervisord.conf | 8 ++++++++ platform/vs/docker-sonic-vs/start.sh | 2 ++ platform/vs/docker-sonic-vs/supervisord.conf | 8 ++++++++ 4 files changed, 20 insertions(+) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 9249dc5c0722..a0d4ad646b27 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -32,6 +32,8 @@ supervisorctl start buffermgrd supervisorctl start enable_counters +supervisorctl start vrfmgrd + # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 8f96037f11b6..6a0b18cb70d0 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -107,3 +107,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:vrfmgrd] +command=/usr/bin/vrfmgrd +priority=14 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index d16e9535c218..6180c0b66b1c 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -52,6 +52,8 @@ supervisorctl start zebra supervisorctl start buffermgrd +supervisorctl start vrfmgrd + # Start arp_update when VLAN exists VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` if [ "$VLAN" != "" ]; then diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index 1f6dfad60cf0..29283c7102a3 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -138,3 +138,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:vrfmgrd] +command=/usr/bin/vrfmgrd +priority=18 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog From 7ece396592bad0c5e10fb6583d8da62dafa53536 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Thu, 20 Sep 2018 00:19:40 -0700 Subject: [PATCH 1628/1833] Add SWI_DEFAULT support in boot0 (#2056) Currently setting the next boot image is the same as setting a default image. With this change SWI_DEFAULT= will be considered the default image and SWI= the next image. When executing the boot0 SWI= will be overriden by SWI_DEFAULT= if it exists and create in with the value of SWI= otherwise. --- files/Aboot/boot0.j2 | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 4bb1a279ff31..b1f29ac89544 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -48,7 +48,6 @@ kernel_params="kernel-params" aboot_machine="arista_unknown" - # extract mount point from the swi path, e.g., /mnt/flash/sonic.swi --> /mnt/flash if [ -z "$target_path" ]; then if [ -z "$swipath" ]; then @@ -61,6 +60,7 @@ image_path="$target_path/$image_name" cmdline_base="$target_path/kernel-params-base" cmdline_image="$image_path/kernel-cmdline" +boot_config="$target_path/boot-config" bootconfigvars="KERNEL INITRD CONSOLESPEED PASSWORD NETDEV NETAUTO NETIP NETMASK NETGW NETDOMAIN NETDNS NETHW memtest" flash_re=" /mnt/flash| /host" @@ -88,6 +88,33 @@ clean_flash() { done } +update_boot_config() { + local key="$1" + local value="$2" + + if grep "$key" "$boot_config" 2>&1 > /dev/null; then + sed -i "s#^$key=.*\$#$key=$value#" "$boot_config" + else + echo "$key=$value" >> "$boot_config" + fi +} + +get_boot_config() { + local key="$1" + + sed -n "s#^$key=##p" "$boot_config" || : +} + +update_next_boot() { + local default="$(get_boot_config SWI_DEFAULT)" + + if [ -z "$default" ]; then + echo "warning: no variable SWI_DEFAULT available" + else + update_boot_config SWI "$default" + fi +} + extract_image() { mkdir -p "$image_path" @@ -114,7 +141,9 @@ extract_image() { fi ## use new reduced-size boot swi - echo "SWI=flash:$image_name/{{ ABOOT_BOOT_IMAGE }}" > "$target_path/boot-config" + local swi_boot_path="flash:$image_name/{{ ABOOT_BOOT_IMAGE }}" + update_boot_config SWI "$swi_boot_path" + update_boot_config SWI_DEFAULT "$swi_boot_path" ## Remove installer swi as it has lots of redundunt contents rm -f "$swipath" @@ -320,6 +349,7 @@ fi # chainloading using kexec if $do_kexec; then + update_next_boot run_kexec fi From c8a799716c51fc108f95ae9c649f56685f365c69 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 21 Sep 2018 00:32:26 -0700 Subject: [PATCH 1629/1833] [submodules]: update swss, swss-common, sairedis (#2062) swss: * 13df5a9 2018-09-19 | [cfgmgr]: Add vrfmgrd (#621) (HEAD, origin/master, origin/HEAD) [Marian Pritsak] * 54a7c9a 2018-09-18 | [portsorch]: Remove m_ifindex from Port class (#624) [Shuotian Cheng] * e765c12 2018-09-17 | [aclorch]: Remove error message when match not found (#618) [stepanblyschak] * 07f4cd8 2018-09-14 | Enable vxlan test (#620) [pavel-shirshov] * 9fda944 2018-09-14 | Warm reboot: Add support for orchagent pre-shutdown warm-restart state check (#562) [Jipan Yang] * 41e61bd 2018-09-14 | Warm reboot: port state sync up (#557) [Jipan Yang] * bf38bec 2018-09-14 | [vxlan tunnel]: Don't create encap mapper. Currently not supported (#613) [pavel-shirshov] * 528295d 2018-09-14 | [mirrororch]: Remove the queue initialization for different platforms (#614) [Shuotian Cheng] * 5af88ab 2018-09-14 | Temporarily disable two test cases to unblock others (#617) [Qi Luo] * 60a9d61 2018-09-08 | Support warm-restart for neighsyncd (#599) [zhenggen-xu] * 387eac6 2018-09-08 | [mirrororch]: Change Mellanox GRE type to 0x8949 (#610) [Shuotian Cheng] * 7114352 2018-09-07 | Store mirror session state in StateDB (#609) [Qi Luo] * fa2b5d9 2018-09-06 | [test]: Mark VLAN related mirror test invalid in Debian Jessie (#608) [Shuotian Cheng] * 6d40d85 2018-09-06 | [mirrororch]: Fix bug: return false when SAI API call fails (#607) [Shuotian Cheng] * cbc5a05 2018-09-05 | [mirrororch]: Enable mirror session destination to point into VLAN (#595) [Shuotian Cheng] swss-common: * c6c9a9b 2018-09-19 | Add new macro STATE_FDB_TABLE_NAME (#233) (HEAD, origin/master, origin/HEAD) [Qi Luo] * 41b6e18 2018-09-13 | NotificationProducer.send() returns the number of clients that received the message (#231) [Qi Luo] sairedis: * 5ef97ca 2018-09-11 | Fix findBridgeVlanForPortVlan for 1Q bridge (#345) (HEAD) [Qi Luo] * e402ff6 2018-09-11 | update SAI header (#344) [lguohan] * fd75e54 2018-09-11 | sairedis: add while loop to make syncd processEvent() handle as many entries as possible in one event call (#335) [Dong Zhang] * 50e1915 2018-08-29 | [misc]: Fix typos (#342) [Shuotian Cheng] * 2322375 2018-08-29 | Use syncd -u option (#341) [Qi Luo] * 2c2a13c 2018-08-28 | Cleanup usage (#340) [Qi Luo] * 7cd75c0 2018-08-26 | [saimeta]: Fix typo: > then -> >; don't exists -> doesn't exist (#339) [Shuotian Cheng] Signed-off-by: Guohan Lu --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 1c06195cc64f..5ef97caffc42 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 1c06195cc64f59120bb84ba9ffbd9051ec9214dc +Subproject commit 5ef97caffc427c9b6f8cbee3804a3e1d7de6e3c4 diff --git a/src/sonic-swss b/src/sonic-swss index 29722e115b01..13df5a98d4a6 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 29722e115b019678219ad284457663fa1c947ff5 +Subproject commit 13df5a98d4a6375a778b6216cff886a0c474aa9a diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 23dc1b139823..c6c9a9b3ea7b 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 23dc1b139823efa385be4c7a51de52f085572b77 +Subproject commit c6c9a9b3ea7bd1d0db9ddb9d5efadff6caa2a9e6 From 0e85986088a97135dc4472d49c1f2fa8bc264318 Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Fri, 21 Sep 2018 10:44:28 -0700 Subject: [PATCH 1630/1833] Add Tag info to docker label meta data (#2058) * Add Tag info to docker label meta data Signed-off-by: Jipan Yang * Move DIRTY_SUFFIX to sonic_get_version() Signed-off-by: Jipan Yang --- functions.sh | 1 + slave.mk | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/functions.sh b/functions.sh index 01f645ca72c7..3605877834fa 100644 --- a/functions.sh +++ b/functions.sh @@ -51,6 +51,7 @@ docker_try_rmi() { } sonic_get_version() { + DIRTY_SUFFIX="$(date +%Y%m%d\.%H%M%S)" local describe=$(git describe --tags) local latest_tag=$(git describe --tags --abbrev=0) local branch_name=$(git rev-parse --abbrev-ref HEAD) diff --git a/slave.mk b/slave.mk index c0e227267113..bb1d86be48de 100644 --- a/slave.mk +++ b/slave.mk @@ -9,6 +9,7 @@ SHELL = /bin/bash USER = $(shell id -un) UID = $(shell id -u) GUID = $(shell id -g) +SONIC_GET_VERSION=$(shell . functions.sh && sonic_get_version) .SECONDEXPANSION: @@ -393,6 +394,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g --build-arg uid=$(UID) \ --build-arg guid=$(GUID) \ --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ + --label Tag=$(SONIC_GET_VERSION) \ -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ # Clean up @@ -425,6 +427,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl --build-arg uid=$(UID) \ --build-arg guid=$(GUID) \ --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ + --label Tag=$(SONIC_GET_VERSION) \ -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ # Clean up @@ -514,9 +517,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ chmod +x sonic_debian_extension.sh, ) - DIRTY_SUFFIX="$(shell date +%Y%m%d\.%H%M%S)" - export DIRTY_SUFFIX - USERNAME="$(USERNAME)" \ PASSWORD="$(PASSWORD)" \ ./build_debian.sh $(LOG) From 792e2dfbf3fddf415b2729ed61a0a3165faa5aa5 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 21 Sep 2018 21:56:44 -0700 Subject: [PATCH 1631/1833] [broadcom]: Update SAI to 3.1.3.5-10 (#2068) * Fix Trident2 parity error correction bug * VXLAN decapsulation implementation Signed-off-by: Shu0T1an ChenG --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 72ff4bba1a29..55e0e0631e3a 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.5-8_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm_3.1.3.5-8_amd64.deb?sv=2015-04-05&sr=b&sig=vM4LXDn4RIIxfK6lNL2mkEAnSPyaNgEH2QAfHSySMEg%3D&se=2155-07-31T18%3A43%3A06Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.5-10_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm_3.1.3.5-10_amd64.deb?sv=2015-04-05&sr=b&sig=knKdBT4t%2B%2F8JvPe5wfCJPsJ1JU1kSsCBzMBFQHtXoAg%3D&se=2032-05-30T19%3A33%3A41Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-8_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-10_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-8_amd64.deb?sv=2015-04-05&sr=b&sig=ehMedaC6GDviSVEhsCygfLS%2FG9gijkBjZT2y5WxByls%3D&se=2155-07-31T18%3A36%3A17Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-10_amd64.deb?sv=2015-04-05&sr=b&sig=aYTN5yyq9dy4uz%2FctVXhuG9qqLs%2FefT4lJFmheRAk7I%3D&se=2032-05-30T19%3A34%3A34Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 51fec6eebd81990d305bf0068a2babd90b9e5be3 Mon Sep 17 00:00:00 2001 From: Jonathan Tsai Date: Sat, 22 Sep 2018 12:57:10 +0800 Subject: [PATCH 1632/1833] [Quanta/device] Correct IX1B platform name to fit ONIE rule (#2065) * Change platform name from x86_64-quanta_ix1b_32x-r0 to x86_64-quanta_ix1b_rglbmc-r0 --- .../Quanta-IX1B-32X/port_config.ini | 0 .../Quanta-IX1B-32X/sai.profile | 0 .../Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm | 0 .../installer.conf | 0 .../led_proc_init.soc | 0 .../minigraph.xml | 0 .../plugins/eeprom.py | 0 .../plugins/psuutil.py | 0 .../plugins/sfputil.py | 0 platform/broadcom/platform-modules-quanta.mk | 2 +- 10 files changed, 1 insertion(+), 1 deletion(-) rename device/quanta/{x86_64-quanta_ix1b_32x-r0 => x86_64-quanta_ix1b_rglbmc-r0}/Quanta-IX1B-32X/port_config.ini (100%) rename device/quanta/{x86_64-quanta_ix1b_32x-r0 => x86_64-quanta_ix1b_rglbmc-r0}/Quanta-IX1B-32X/sai.profile (100%) rename device/quanta/{x86_64-quanta_ix1b_32x-r0 => x86_64-quanta_ix1b_rglbmc-r0}/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm (100%) rename device/quanta/{x86_64-quanta_ix1b_32x-r0 => x86_64-quanta_ix1b_rglbmc-r0}/installer.conf (100%) rename device/quanta/{x86_64-quanta_ix1b_32x-r0 => x86_64-quanta_ix1b_rglbmc-r0}/led_proc_init.soc (100%) rename device/quanta/{x86_64-quanta_ix1b_32x-r0 => x86_64-quanta_ix1b_rglbmc-r0}/minigraph.xml (100%) rename device/quanta/{x86_64-quanta_ix1b_32x-r0 => x86_64-quanta_ix1b_rglbmc-r0}/plugins/eeprom.py (100%) rename device/quanta/{x86_64-quanta_ix1b_32x-r0 => x86_64-quanta_ix1b_rglbmc-r0}/plugins/psuutil.py (100%) rename device/quanta/{x86_64-quanta_ix1b_32x-r0 => x86_64-quanta_ix1b_rglbmc-r0}/plugins/sfputil.py (100%) diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/port_config.ini b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/Quanta-IX1B-32X/port_config.ini similarity index 100% rename from device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/port_config.ini rename to device/quanta/x86_64-quanta_ix1b_rglbmc-r0/Quanta-IX1B-32X/port_config.ini diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/sai.profile b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/Quanta-IX1B-32X/sai.profile similarity index 100% rename from device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/sai.profile rename to device/quanta/x86_64-quanta_ix1b_rglbmc-r0/Quanta-IX1B-32X/sai.profile diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm similarity index 100% rename from device/quanta/x86_64-quanta_ix1b_32x-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm rename to device/quanta/x86_64-quanta_ix1b_rglbmc-r0/Quanta-IX1B-32X/th-ix1b-32x100G.config.bcm diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/installer.conf b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/installer.conf similarity index 100% rename from device/quanta/x86_64-quanta_ix1b_32x-r0/installer.conf rename to device/quanta/x86_64-quanta_ix1b_rglbmc-r0/installer.conf diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/led_proc_init.soc b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/led_proc_init.soc similarity index 100% rename from device/quanta/x86_64-quanta_ix1b_32x-r0/led_proc_init.soc rename to device/quanta/x86_64-quanta_ix1b_rglbmc-r0/led_proc_init.soc diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/minigraph.xml b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/minigraph.xml similarity index 100% rename from device/quanta/x86_64-quanta_ix1b_32x-r0/minigraph.xml rename to device/quanta/x86_64-quanta_ix1b_rglbmc-r0/minigraph.xml diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/eeprom.py b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/plugins/eeprom.py similarity index 100% rename from device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/eeprom.py rename to device/quanta/x86_64-quanta_ix1b_rglbmc-r0/plugins/eeprom.py diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/psuutil.py b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/plugins/psuutil.py similarity index 100% rename from device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/psuutil.py rename to device/quanta/x86_64-quanta_ix1b_rglbmc-r0/plugins/psuutil.py diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/sfputil.py b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/plugins/sfputil.py similarity index 100% rename from device/quanta/x86_64-quanta_ix1b_32x-r0/plugins/sfputil.py rename to device/quanta/x86_64-quanta_ix1b_rglbmc-r0/plugins/sfputil.py diff --git a/platform/broadcom/platform-modules-quanta.mk b/platform/broadcom/platform-modules-quanta.mk index e1c633cd08f3..747c41425908 100755 --- a/platform/broadcom/platform-modules-quanta.mk +++ b/platform/broadcom/platform-modules-quanta.mk @@ -7,7 +7,7 @@ export QUANTA_IX1B_32X_PLATFORM_MODULE_VERSION QUANTA_IX1B_32X_PLATFORM_MODULE = sonic-platform-quanta-ix1b-32x_$(QUANTA_IX1B_32X_PLATFORM_MODULE_VERSION)_amd64.deb $(QUANTA_IX1B_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-quanta $(QUANTA_IX1B_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -$(QUANTA_IX1B_32X_PLATFORM_MODULE)_PLATFORM = x86_64-quanta_ix1b_32x-r0 +$(QUANTA_IX1B_32X_PLATFORM_MODULE)_PLATFORM = x86_64-quanta_ix1b_rglbmc-r0 SONIC_DPKG_DEBS += $(QUANTA_IX1B_32X_PLATFORM_MODULE) SONIC_STRETCH_DEBS += $(QUANTA_IX1B_32X_PLATFORM_MODULE) From 018b5899be9bde8ead1337ca5a4c3a38329d5bcb Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 21 Sep 2018 22:01:10 -0700 Subject: [PATCH 1633/1833] [updategraph] add support to use preset config instead of default minigraph (#2050) * [updategraph] add support to use preset config instead of default minigraph * Fix variable case * Remove default minigraph case * Remove default minigraphs and add default_sku files --- .../x86_64-accton_as5712_54x-r0/default_sku | 1 + .../x86_64-accton_as5712_54x-r0/minigraph.xml | 1274 ------------ .../x86_64-accton_as7116_54x-r0/default_sku | 1 + .../x86_64-accton_as7116_54x-r0/minigraph.xml | 68 - .../x86_64-accton_as7212_54x-r0/default_sku | 1 + .../x86_64-accton_as7212_54x-r0/minigraph.xml | 1074 ---------- .../x86_64-accton_as7312_54x-r0/default_sku | 1 + .../x86_64-accton_as7312_54x-r0/minigraph.xml | 1184 ----------- .../x86_64-accton_as7312_54xs-r0/default_sku | 1 + .../minigraph.xml | 1184 ----------- .../x86_64-accton_as7326_56x-r0/default_sku | 1 + .../x86_64-accton_as7326_56x-r0/minigraph.xml | 1184 ----------- .../x86_64-accton_as7512_32x-r0/default_sku | 1 + .../x86_64-accton_as7512_32x-r0/minigraph.xml | 1079 ---------- .../x86_64-accton_as7712_32x-r0/default_sku | 1 + .../x86_64-accton_as7712_32x-r0/minigraph.xml | 1074 ---------- .../x86_64-accton_as7716_32x-r0/default_sku | 1 + .../x86_64-accton_as7716_32x-r0/minigraph.xml | 1074 ---------- .../x86_64-accton_as7716_32xb-r0/default_sku | 1 + .../minigraph.xml | 1074 ---------- .../x86_64-accton_as7816_64x-r0/default_sku | 1 + .../x86_64-accton_as7816_64x-r0/minigraph.xml | 848 -------- .../x86_64-arista_7050_qx32/default_sku | 1 + .../x86_64-arista_7050_qx32/minigraph.xml | 1079 ---------- .../x86_64-arista_7050_qx32s/default_sku | 1 + .../x86_64-arista_7050_qx32s/minigraph.xml | 240 --- .../x86_64-arista_7060_cx32s/default_sku | 1 + .../x86_64-arista_7060_cx32s/minigraph.xml | 1079 ---------- .../arista/x86_64-arista_7170_64c/default_sku | 1 + .../x86_64-arista_7170_64c/minigraph.xml | 70 - .../x86_64-arista_7260cx3_64/default_sku | 1 + .../x86_64-arista_7260cx3_64/minigraph.xml | 848 -------- .../default_sku | 1 + .../minigraph.xml | 1079 ---------- .../default_sku | 1 + .../minigraph.xml | 1079 ---------- .../celestica/x86_64-cel_e1031-r0/default_sku | 1 + .../x86_64-cel_e1031-r0/minigraph.xml | 810 -------- .../x86_64-cel_seastone-r0/default_sku | 1 + .../x86_64-cel_seastone-r0/minigraph.xml | 1253 ------------ .../x86_64-centec_e582_48x6q-r0/default_sku | 1 + .../x86_64-ew_es6220_x48q2h4-r0/default_sku | 1 + .../x86_64-ew_es6220_x48q2h4-r0/minigraph.xml | 1049 ---------- .../x86_64-dell_s6000_s1220-r0/default_sku | 1 + .../x86_64-dell_s6000_s1220-r0/minigraph.xml | 1079 ---------- .../x86_64-dell_s6100_c2538-r0/default_sku | 1 + .../x86_64-dell_s6100_c2538-r0/minigraph.xml | 774 -------- .../x86_64-dell_z9100_c2538-r0/default_sku | 1 + .../x86_64-dell_z9100_c2538-r0/minigraph.xml | 1079 ---------- .../default_sku | 1 + .../minigraph.xml | 1541 --------------- .../delta/x86_64-delta_ag5648-r0/default_sku | 1 + .../x86_64-delta_ag5648-r0/minigraph.xml | 1184 ----------- .../x86_64-delta_ag9032v1-r0/default_sku | 1 + .../x86_64-delta_ag9032v1-r0/minigraph.xml | 1079 ---------- .../delta/x86_64-delta_ag9064-r0/default_sku | 1 + .../x86_64-delta_ag9064-r0/minigraph.xml | 848 -------- .../x86_64-delta_et-6248brb-r0/default_sku | 1 + .../x86_64-delta_et-6248brb-r0/minigraph.xml | 766 ------- .../x86_64-ew_es6220_x48q2h4-r0/default_sku | 1 + .../x86_64-facebook_wedge100-r0/default_sku | 1 + .../x86_64-facebook_wedge100-r0/minigraph.xml | 151 -- .../x86_64-ingrasys_s8810_32q-r0/default_sku | 1 + .../minigraph.xml | 121 -- .../x86_64-ingrasys_s8900_54xc-r0/default_sku | 1 + .../minigraph.xml | 121 -- .../x86_64-ingrasys_s8900_64xc-r0/default_sku | 1 + .../minigraph.xml | 359 ---- .../x86_64-ingrasys_s9100-r0/default_sku | 1 + .../x86_64-ingrasys_s9100-r0/minigraph.xml | 151 -- .../x86_64-ingrasys_s9130_32x-r0/default_sku | 1 + .../minigraph.xml | 69 - .../x86_64-ingrasys_s9180_32x-r0/default_sku | 1 + .../minigraph.xml | 151 -- .../x86_64-ingrasys_s9200_64x-r0/default_sku | 1 + .../minigraph.xml | 151 -- .../x86_64-ingrasys_s9230_64x-r0/default_sku | 1 + .../minigraph.xml | 69 - .../x86_64-ingrasys_s9280_64x-r0/default_sku | 1 + .../minigraph.xml | 151 -- .../x86_64-inventec_d7032q28b-r0/default_sku | 1 + .../minigraph.xml | 144 -- .../x86_64-inventec_d7054q28b-r0/default_sku | 1 + .../minigraph.xml | 144 -- .../x86_64-inventec_d7264q28b-r0/default_sku | 1 + .../minigraph.xml | 144 -- .../x86_64-marvell_slm5401_54x-r0/default_sku | 1 + .../minigraph.xml | 1074 ---------- .../x86_64-mlnx_lssn2700-r0/default_sku | 1 + .../x86_64-mlnx_lssn2700-r0/minigraph.xml | 1079 ---------- .../x86_64-mlnx_msn2010-r0/default_sku | 1 + .../x86_64-mlnx_msn2010-r0/minigraph.xml | 855 -------- .../x86_64-mlnx_msn2100-r0/default_sku | 1 + .../x86_64-mlnx_msn2100-r0/minigraph.xml | 578 ------ .../x86_64-mlnx_msn2410-r0/default_sku | 1 + .../x86_64-mlnx_msn2410-r0/minigraph.xml | 1199 ----------- .../x86_64-mlnx_msn2700-r0/default_sku | 1 + .../x86_64-mlnx_msn2700-r0/minigraph.xml | 1079 ---------- .../x86_64-mlnx_msn2740-r0/default_sku | 1 + .../x86_64-mlnx_msn2740-r0/minigraph.xml | 1079 ---------- .../x86_64-mlnx_x86-r5.0.1400/default_sku | 1 + .../default_sku | 1 + .../minigraph.xml | 1074 ---------- .../x86_64-quanta_ix1b_32x-r0/default_sku | 1 + device/wnc/x86_64-wnc_osw1800-r0/default_sku | 1 + .../wnc/x86_64-wnc_osw1800-r0/minigraph.xml | 1761 ----------------- files/image_config/updategraph/updategraph | 35 +- 107 files changed, 67 insertions(+), 39780 deletions(-) create mode 100644 device/accton/x86_64-accton_as5712_54x-r0/default_sku delete mode 100755 device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7116_54x-r0/default_sku delete mode 100644 device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7212_54x-r0/default_sku delete mode 100755 device/accton/x86_64-accton_as7212_54x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7312_54x-r0/default_sku delete mode 100644 device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/default_sku delete mode 100644 device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7326_56x-r0/default_sku delete mode 100644 device/accton/x86_64-accton_as7326_56x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7512_32x-r0/default_sku delete mode 100644 device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7712_32x-r0/default_sku delete mode 100644 device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7716_32x-r0/default_sku delete mode 100644 device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7716_32xb-r0/default_sku delete mode 100755 device/accton/x86_64-accton_as7716_32xb-r0/minigraph.xml create mode 100644 device/accton/x86_64-accton_as7816_64x-r0/default_sku delete mode 100644 device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml create mode 100644 device/arista/x86_64-arista_7050_qx32/default_sku delete mode 100644 device/arista/x86_64-arista_7050_qx32/minigraph.xml create mode 100644 device/arista/x86_64-arista_7050_qx32s/default_sku delete mode 100644 device/arista/x86_64-arista_7050_qx32s/minigraph.xml create mode 100644 device/arista/x86_64-arista_7060_cx32s/default_sku delete mode 100644 device/arista/x86_64-arista_7060_cx32s/minigraph.xml create mode 100644 device/arista/x86_64-arista_7170_64c/default_sku delete mode 100644 device/arista/x86_64-arista_7170_64c/minigraph.xml create mode 100644 device/arista/x86_64-arista_7260cx3_64/default_sku delete mode 100644 device/arista/x86_64-arista_7260cx3_64/minigraph.xml create mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/default_sku delete mode 100644 device/barefoot/x86_64-accton_wedge100bf_32x-r0/minigraph.xml create mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/default_sku delete mode 100644 device/barefoot/x86_64-accton_wedge100bf_65x-r0/minigraph.xml create mode 100644 device/celestica/x86_64-cel_e1031-r0/default_sku delete mode 100644 device/celestica/x86_64-cel_e1031-r0/minigraph.xml create mode 100644 device/celestica/x86_64-cel_seastone-r0/default_sku delete mode 100644 device/celestica/x86_64-cel_seastone-r0/minigraph.xml create mode 100644 device/centec/x86_64-centec_e582_48x6q-r0/default_sku create mode 100644 device/centec/x86_64-ew_es6220_x48q2h4-r0/default_sku delete mode 100644 device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/default_sku delete mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml create mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/default_sku delete mode 100644 device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/default_sku delete mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml create mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/default_sku delete mode 100644 device/dell/x86_64-dellemc_z9264f_c3538-r0/minigraph.xml create mode 100644 device/delta/x86_64-delta_ag5648-r0/default_sku delete mode 100644 device/delta/x86_64-delta_ag5648-r0/minigraph.xml create mode 100644 device/delta/x86_64-delta_ag9032v1-r0/default_sku delete mode 100644 device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml create mode 100644 device/delta/x86_64-delta_ag9064-r0/default_sku delete mode 100644 device/delta/x86_64-delta_ag9064-r0/minigraph.xml create mode 100644 device/delta/x86_64-delta_et-6248brb-r0/default_sku delete mode 100644 device/delta/x86_64-delta_et-6248brb-r0/minigraph.xml create mode 100644 device/embedway/x86_64-ew_es6220_x48q2h4-r0/default_sku create mode 100644 device/facebook/x86_64-facebook_wedge100-r0/default_sku delete mode 100644 device/facebook/x86_64-facebook_wedge100-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/default_sku delete mode 100644 device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/default_sku delete mode 100644 device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/default_sku delete mode 100644 device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/default_sku delete mode 100644 device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/default_sku delete mode 100644 device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/default_sku delete mode 100644 device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/default_sku delete mode 100644 device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/default_sku delete mode 100644 device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml create mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/default_sku delete mode 100644 device/ingrasys/x86_64-ingrasys_s9280_64x-r0/minigraph.xml create mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/default_sku delete mode 100644 device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml create mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/default_sku delete mode 100644 device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml create mode 100644 device/inventec/x86_64-inventec_d7264q28b-r0/default_sku delete mode 100644 device/inventec/x86_64-inventec_d7264q28b-r0/minigraph.xml create mode 100644 device/marvell/x86_64-marvell_slm5401_54x-r0/default_sku delete mode 100755 device/marvell/x86_64-marvell_slm5401_54x-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/default_sku delete mode 100644 device/mellanox/x86_64-mlnx_lssn2700-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/default_sku delete mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/default_sku delete mode 100644 device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/default_sku delete mode 100644 device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/default_sku delete mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/default_sku delete mode 100644 device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml create mode 100644 device/mellanox/x86_64-mlnx_x86-r5.0.1400/default_sku create mode 100644 device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/default_sku delete mode 100644 device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/minigraph.xml create mode 100644 device/quanta/x86_64-quanta_ix1b_32x-r0/default_sku create mode 100644 device/wnc/x86_64-wnc_osw1800-r0/default_sku delete mode 100644 device/wnc/x86_64-wnc_osw1800-r0/minigraph.xml diff --git a/device/accton/x86_64-accton_as5712_54x-r0/default_sku b/device/accton/x86_64-accton_as5712_54x-r0/default_sku new file mode 100644 index 000000000000..a65f8088752a --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/default_sku @@ -0,0 +1 @@ +Accton-AS5712-54X t1 diff --git a/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml deleted file mode 100755 index 065105bf183a..000000000000 --- a/device/accton/x86_64-accton_as5712_54x-r0/minigraph.xml +++ /dev/null @@ -1,1274 +0,0 @@ - - - - - - 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 - - - - - - tenGigE0 - 10.0.0.0/31 - - - - tenGigE1 - 10.0.0.2/31 - - - - tenGigE2 - 10.0.0.4/31 - - - - tenGigE3 - 10.0.0.6/31 - - - - tenGigE4 - 10.0.0.8/31 - - - - tenGigE5 - 10.0.0.10/31 - - - - tenGigE6 - 10.0.0.12/31 - - - - tenGigE7 - 10.0.0.14/31 - - - - tenGigE8 - 10.0.0.16/31 - - - - tenGigE9 - 10.0.0.18/31 - - - - tenGigE10 - 10.0.0.20/31 - - - - tenGigE11 - 10.0.0.22/31 - - - - tenGigE12 - 10.0.0.24/31 - - - - tenGigE13 - 10.0.0.26/31 - - - - tenGigE14 - 10.0.0.28/31 - - - - tenGigE15 - 10.0.0.30/31 - - - - tenGigE16 - 10.0.0.32/31 - - - - tenGigE17 - 10.0.0.34/31 - - - - tenGigE18 - 10.0.0.36/31 - - - - tenGigE19 - 10.0.0.38/31 - - - - tenGigE20 - 10.0.0.40/31 - - - - tenGigE21 - 10.0.0.42/31 - - - - tenGigE22 - 10.0.0.44/31 - - - - tenGigE23 - 10.0.0.46/31 - - - - tenGigE24 - 10.0.0.48/31 - - - - tenGigE25 - 10.0.0.50/31 - - - - tenGigE26 - 10.0.0.52/31 - - - - tenGigE27 - 10.0.0.54/31 - - - - tenGigE28 - 10.0.0.56/31 - - - - tenGigE29 - 10.0.0.58/31 - - - - tenGigE30 - 10.0.0.60/31 - - - - tenGigE31 - 10.0.0.62/31 - - - - tenGigE32 - 10.0.0.64/31 - - - - tenGigE33 - 10.0.0.66/31 - - - - tenGigE34 - 10.0.0.68/31 - - - - tenGigE35 - 10.0.0.70/31 - - - - tenGigE36 - 10.0.0.72/31 - - - - tenGigE37 - 10.0.0.74/31 - - - - tenGigE38 - 10.0.0.76/31 - - - - tenGigE39 - 10.0.0.78/31 - - - - tenGigE40 - 10.0.0.80/31 - - - - tenGigE41 - 10.0.0.82/31 - - - - tenGigE42 - 10.0.0.84/31 - - - - tenGigE43 - 10.0.0.86/31 - - - - tenGigE44 - 10.0.0.88/31 - - - - tenGigE45 - 10.0.0.90/31 - - - - tenGigE46 - 10.0.0.92/31 - - - - tenGigE47 - 10.0.0.94/31 - - - - tenGigE48 - 10.0.0.96/31 - - - - tenGigE49 - 10.0.0.98/31 - - - - tenGigE50 - 10.0.0.100/31 - - - - tenGigE51 - 10.0.0.102/31 - - - - tenGigE52 - 10.0.0.104/31 - - - - tenGigE53 - 10.0.0.106/31 - - - - tenGigE54 - 10.0.0.108/31 - - - - tenGigE55 - 10.0.0.110/31 - - - - tenGigE56 - 10.0.0.112/31 - - - - tenGigE57 - 10.0.0.114/31 - - - - tenGigE58 - 10.0.0.116/31 - - - - tenGigE59 - 10.0.0.118/31 - - - - tenGigE60 - 10.0.0.120/31 - - - - tenGigE61 - 10.0.0.122/31 - - - - tenGigE62 - 10.0.0.124/31 - - - - tenGigE63 - 10.0.0.126/31 - - - - tenGigE64 - 10.0.0.128/31 - - - - tenGigE65 - 10.0.0.130/31 - - - - tenGigE66 - 10.0.0.132/31 - - - - tenGigE67 - 10.0.0.134/31 - - - - tenGigE68 - 10.0.0.136/31 - - - - tenGigE69 - 10.0.0.138/31 - - - - tenGigE70 - 10.0.0.140/31 - - - - tenGigE71 - 10.0.0.142/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - tenGigE0 - ARISTA01T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE1 - ARISTA02T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE2 - ARISTA03T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE3 - ARISTA04T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE4 - ARISTA05T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE5 - ARISTA06T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE6 - ARISTA07T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE7 - ARISTA08T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE8 - ARISTA09T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE9 - ARISTA10T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE10 - ARISTA11T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE11 - ARISTA12T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE12 - ARISTA13T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE13 - ARISTA14T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE14 - ARISTA15T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE15 - ARISTA16T2 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE16 - ARISTA01T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE17 - ARISTA02T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE18 - ARISTA03T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE19 - ARISTA04T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE20 - ARISTA05T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE21 - ARISTA06T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE22 - ARISTA07T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE23 - ARISTA08T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE24 - ARISTA09T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE25 - ARISTA10T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE26 - ARISTA11T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE27 - ARISTA12T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE28 - ARISTA13T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE29 - ARISTA14T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE30 - ARISTA15T0 - tenGigE1 - - - DeviceInterfaceLink - sonic - tenGigE31 - ARISTA16T0 - tenGigE1 - - - - - sonic - Accton-AS5712-54X - - - - - - - sonic - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - sonic - Accton-AS5712-54X -
diff --git a/device/accton/x86_64-accton_as7116_54x-r0/default_sku b/device/accton/x86_64-accton_as7116_54x-r0/default_sku new file mode 100644 index 000000000000..829dce6b5748 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/default_sku @@ -0,0 +1 @@ +Accton-AS7116-54X t1 diff --git a/device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml deleted file mode 100644 index 91269c2f68f6..000000000000 --- a/device/accton/x86_64-accton_as7116_54x-r0/minigraph.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - - - - - - switch1 - - - - - - - - - - - - - switch1 - Accton-AS7116-54X - - - - - - - switch1 - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - switch1 - Accton-AS7116-54X - diff --git a/device/accton/x86_64-accton_as7212_54x-r0/default_sku b/device/accton/x86_64-accton_as7212_54x-r0/default_sku new file mode 100644 index 000000000000..d8a1bd55cd48 --- /dev/null +++ b/device/accton/x86_64-accton_as7212_54x-r0/default_sku @@ -0,0 +1 @@ +AS7212-54x t1 diff --git a/device/accton/x86_64-accton_as7212_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as7212_54x-r0/minigraph.xml deleted file mode 100755 index 8dd87023110c..000000000000 --- a/device/accton/x86_64-accton_as7212_54x-r0/minigraph.xml +++ /dev/null @@ -1,1074 +0,0 @@ - - - - - - ARISTA01T0 - 10.0.0.33 - switch1 - 10.0.0.32 - 1 - 180 - 60 - - - switch1 - 10.0.0.0 - ARISTA01T2 - 10.0.0.1 - 1 - 180 - 60 - - - ARISTA02T0 - 10.0.0.35 - switch1 - 10.0.0.34 - 1 - 180 - 60 - - - switch1 - 10.0.0.2 - ARISTA02T2 - 10.0.0.3 - 1 - 180 - 60 - - - ARISTA03T0 - 10.0.0.37 - switch1 - 10.0.0.36 - 1 - 180 - 60 - - - switch1 - 10.0.0.4 - ARISTA03T2 - 10.0.0.5 - 1 - 180 - 60 - - - ARISTA04T0 - 10.0.0.39 - switch1 - 10.0.0.38 - 1 - 180 - 60 - - - switch1 - 10.0.0.6 - ARISTA04T2 - 10.0.0.7 - 1 - 180 - 60 - - - ARISTA05T0 - 10.0.0.41 - switch1 - 10.0.0.40 - 1 - 180 - 60 - - - switch1 - 10.0.0.8 - ARISTA05T2 - 10.0.0.9 - 1 - 180 - 60 - - - ARISTA06T0 - 10.0.0.43 - switch1 - 10.0.0.42 - 1 - 180 - 60 - - - switch1 - 10.0.0.10 - ARISTA06T2 - 10.0.0.11 - 1 - 180 - 60 - - - ARISTA07T0 - 10.0.0.45 - switch1 - 10.0.0.44 - 1 - 180 - 60 - - - switch1 - 10.0.0.12 - ARISTA07T2 - 10.0.0.13 - 1 - 180 - 60 - - - ARISTA08T0 - 10.0.0.47 - switch1 - 10.0.0.46 - 1 - 180 - 60 - - - switch1 - 10.0.0.14 - ARISTA08T2 - 10.0.0.15 - 1 - 180 - 60 - - - ARISTA09T0 - 10.0.0.49 - switch1 - 10.0.0.48 - 1 - 180 - 60 - - - switch1 - 10.0.0.16 - ARISTA09T2 - 10.0.0.17 - 1 - 180 - 60 - - - ARISTA10T0 - 10.0.0.51 - switch1 - 10.0.0.50 - 1 - 180 - 60 - - - switch1 - 10.0.0.18 - ARISTA10T2 - 10.0.0.19 - 1 - 180 - 60 - - - ARISTA11T0 - 10.0.0.53 - switch1 - 10.0.0.52 - 1 - 180 - 60 - - - switch1 - 10.0.0.20 - ARISTA11T2 - 10.0.0.21 - 1 - 180 - 60 - - - ARISTA12T0 - 10.0.0.55 - switch1 - 10.0.0.54 - 1 - 180 - 60 - - - switch1 - 10.0.0.22 - ARISTA12T2 - 10.0.0.23 - 1 - 180 - 60 - - - ARISTA13T0 - 10.0.0.57 - switch1 - 10.0.0.56 - 1 - 180 - 60 - - - switch1 - 10.0.0.24 - ARISTA13T2 - 10.0.0.25 - 1 - 180 - 60 - - - ARISTA14T0 - 10.0.0.59 - switch1 - 10.0.0.58 - 1 - 180 - 60 - - - switch1 - 10.0.0.26 - ARISTA14T2 - 10.0.0.27 - 1 - 180 - 60 - - - ARISTA15T0 - 10.0.0.61 - switch1 - 10.0.0.60 - 1 - 180 - 60 - - - switch1 - 10.0.0.28 - ARISTA15T2 - 10.0.0.29 - 1 - 180 - 60 - - - ARISTA16T0 - 10.0.0.63 - switch1 - 10.0.0.62 - 1 - 180 - 60 - - - switch1 - 10.0.0.30 - ARISTA16T2 - 10.0.0.31 - 1 - 180 - 60 - - - - - 65100 - switch1 - - -
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 - - - - - - - - switch1 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - switch1 - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - switch1 - AS7212-54x - - - - - - - switch1 - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - switch1 - AS7212-54x -
diff --git a/device/accton/x86_64-accton_as7312_54x-r0/default_sku b/device/accton/x86_64-accton_as7312_54x-r0/default_sku new file mode 100644 index 000000000000..c3c21a98f0e4 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/default_sku @@ -0,0 +1 @@ +Accton-AS7312-54X t1 diff --git a/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml b/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml deleted file mode 100644 index a967047b237b..000000000000 --- a/device/accton/x86_64-accton_as7312_54x-r0/minigraph.xml +++ /dev/null @@ -1,1184 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet1 - 10.0.0.2/31 - - - - Ethernet2 - 10.0.0.4/31 - - - - Ethernet3 - 10.0.0.6/31 - - - - Ethernet4 - 10.0.0.8/31 - - - - Ethernet5 - 10.0.0.10/31 - - - - Ethernet6 - 10.0.0.12/31 - - - - Ethernet7 - 10.0.0.14/31 - - - - Ethernet8 - 10.0.0.16/31 - - - - Ethernet9 - 10.0.0.18/31 - - - - Ethernet10 - 10.0.0.20/31 - - - - Ethernet11 - 10.0.0.22/31 - - - - Ethernet12 - 10.0.0.24/31 - - - - Ethernet13 - 10.0.0.26/31 - - - - Ethernet14 - 10.0.0.28/31 - - - - Ethernet15 - 10.0.0.30/31 - - - - Ethernet16 - 10.0.0.32/31 - - - - Ethernet17 - 10.0.0.34/31 - - - - Ethernet18 - 10.0.0.36/31 - - - - Ethernet19 - 10.0.0.38/31 - - - - Ethernet20 - 10.0.0.40/31 - - - - Ethernet21 - 10.0.0.42/31 - - - - Ethernet22 - 10.0.0.44/31 - - - - Ethernet23 - 10.0.0.46/31 - - - - Ethernet24 - 10.0.0.48/31 - - - - Ethernet25 - 10.0.0.50/31 - - - - Ethernet26 - 10.0.0.52/31 - - - - Ethernet27 - 10.0.0.54/31 - - - - Ethernet28 - 10.0.0.56/31 - - - - Ethernet29 - 10.0.0.58/31 - - - - Ethernet30 - 10.0.0.60/31 - - - - Ethernet31 - 10.0.0.62/31 - - - - Ethernet32 - 10.0.0.64/31 - - - - Ethernet33 - 10.0.0.66/31 - - - - Ethernet34 - 10.0.0.68/31 - - - - Ethernet35 - 10.0.0.70/31 - - - - Ethernet36 - 10.0.0.72/31 - - - - Ethernet37 - 10.0.0.74/31 - - - - Ethernet38 - 10.0.0.76/31 - - - - Ethernet39 - 10.0.0.78/31 - - - - Ethernet40 - 10.0.0.80/31 - - - - Ethernet41 - 10.0.0.82/31 - - - - Ethernet42 - 10.0.0.84/31 - - - - Ethernet43 - 10.0.0.86/31 - - - - Ethernet44 - 10.0.0.88/31 - - - - Ethernet45 - 10.0.0.90/31 - - - - Ethernet46 - 10.0.0.92/31 - - - - Ethernet47 - 10.0.0.94/31 - - - - Ethernet48 - 10.0.0.96/31 - - - - Ethernet52 - 10.0.0.98/31 - - - - Ethernet56 - 10.0.0.100/31 - - - - Ethernet60 - 10.0.0.102/31 - - - - Ethernet64 - 10.0.0.104/31 - - - - Ethernet68 - 10.0.0.106/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet1 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet2 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet3 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet5 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet6 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet7 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet9 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet10 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet11 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet13 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet14 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet15 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet17 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet18 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet19 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet21 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet22 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet23 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet25 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet26 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet27 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet29 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet30 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet31 - ARISTA16T0 - Ethernet1 - - - - - sonic - Accton-AS7312-54X - - - - - - - sonic - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - sonic - Accton-AS7312-54X -
diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/default_sku b/device/accton/x86_64-accton_as7312_54xs-r0/default_sku new file mode 100644 index 000000000000..9e6062dee23b --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/default_sku @@ -0,0 +1 @@ +Accton-AS7312-54XS t1 diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml b/device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml deleted file mode 100644 index 30f9962d1f11..000000000000 --- a/device/accton/x86_64-accton_as7312_54xs-r0/minigraph.xml +++ /dev/null @@ -1,1184 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet1 - 10.0.0.2/31 - - - - Ethernet2 - 10.0.0.4/31 - - - - Ethernet3 - 10.0.0.6/31 - - - - Ethernet4 - 10.0.0.8/31 - - - - Ethernet5 - 10.0.0.10/31 - - - - Ethernet6 - 10.0.0.12/31 - - - - Ethernet7 - 10.0.0.14/31 - - - - Ethernet8 - 10.0.0.16/31 - - - - Ethernet9 - 10.0.0.18/31 - - - - Ethernet10 - 10.0.0.20/31 - - - - Ethernet11 - 10.0.0.22/31 - - - - Ethernet12 - 10.0.0.24/31 - - - - Ethernet13 - 10.0.0.26/31 - - - - Ethernet14 - 10.0.0.28/31 - - - - Ethernet15 - 10.0.0.30/31 - - - - Ethernet16 - 10.0.0.32/31 - - - - Ethernet17 - 10.0.0.34/31 - - - - Ethernet18 - 10.0.0.36/31 - - - - Ethernet19 - 10.0.0.38/31 - - - - Ethernet20 - 10.0.0.40/31 - - - - Ethernet21 - 10.0.0.42/31 - - - - Ethernet22 - 10.0.0.44/31 - - - - Ethernet23 - 10.0.0.46/31 - - - - Ethernet24 - 10.0.0.48/31 - - - - Ethernet25 - 10.0.0.50/31 - - - - Ethernet26 - 10.0.0.52/31 - - - - Ethernet27 - 10.0.0.54/31 - - - - Ethernet28 - 10.0.0.56/31 - - - - Ethernet29 - 10.0.0.58/31 - - - - Ethernet30 - 10.0.0.60/31 - - - - Ethernet31 - 10.0.0.62/31 - - - - Ethernet32 - 10.0.0.64/31 - - - - Ethernet33 - 10.0.0.66/31 - - - - Ethernet34 - 10.0.0.68/31 - - - - Ethernet35 - 10.0.0.70/31 - - - - Ethernet36 - 10.0.0.72/31 - - - - Ethernet37 - 10.0.0.74/31 - - - - Ethernet38 - 10.0.0.76/31 - - - - Ethernet39 - 10.0.0.78/31 - - - - Ethernet40 - 10.0.0.80/31 - - - - Ethernet41 - 10.0.0.82/31 - - - - Ethernet42 - 10.0.0.84/31 - - - - Ethernet43 - 10.0.0.86/31 - - - - Ethernet44 - 10.0.0.88/31 - - - - Ethernet45 - 10.0.0.90/31 - - - - Ethernet46 - 10.0.0.92/31 - - - - Ethernet47 - 10.0.0.94/31 - - - - Ethernet48 - 10.0.0.96/31 - - - - Ethernet52 - 10.0.0.98/31 - - - - Ethernet56 - 10.0.0.100/31 - - - - Ethernet60 - 10.0.0.102/31 - - - - Ethernet64 - 10.0.0.104/31 - - - - Ethernet68 - 10.0.0.106/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet1 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet2 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet3 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet5 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet6 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet7 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet9 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet10 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet11 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet13 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet14 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet15 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet17 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet18 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet19 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet21 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet22 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet23 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet25 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet26 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet27 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet29 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet30 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet31 - ARISTA16T0 - Ethernet1 - - - - - sonic - Accton-AS7312-54XS - - - - - - - sonic - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - sonic - Accton-AS7312-54XS -
diff --git a/device/accton/x86_64-accton_as7326_56x-r0/default_sku b/device/accton/x86_64-accton_as7326_56x-r0/default_sku new file mode 100644 index 000000000000..922268da79b6 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/default_sku @@ -0,0 +1 @@ +Accton-AS7326-56X t1 diff --git a/device/accton/x86_64-accton_as7326_56x-r0/minigraph.xml b/device/accton/x86_64-accton_as7326_56x-r0/minigraph.xml deleted file mode 100644 index 0aa3f02144ef..000000000000 --- a/device/accton/x86_64-accton_as7326_56x-r0/minigraph.xml +++ /dev/null @@ -1,1184 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet1 - 10.0.0.2/31 - - - - Ethernet2 - 10.0.0.4/31 - - - - Ethernet3 - 10.0.0.6/31 - - - - Ethernet4 - 10.0.0.8/31 - - - - Ethernet5 - 10.0.0.10/31 - - - - Ethernet6 - 10.0.0.12/31 - - - - Ethernet7 - 10.0.0.14/31 - - - - Ethernet8 - 10.0.0.16/31 - - - - Ethernet9 - 10.0.0.18/31 - - - - Ethernet10 - 10.0.0.20/31 - - - - Ethernet11 - 10.0.0.22/31 - - - - Ethernet12 - 10.0.0.24/31 - - - - Ethernet13 - 10.0.0.26/31 - - - - Ethernet14 - 10.0.0.28/31 - - - - Ethernet15 - 10.0.0.30/31 - - - - Ethernet16 - 10.0.0.32/31 - - - - Ethernet17 - 10.0.0.34/31 - - - - Ethernet18 - 10.0.0.36/31 - - - - Ethernet19 - 10.0.0.38/31 - - - - Ethernet20 - 10.0.0.40/31 - - - - Ethernet21 - 10.0.0.42/31 - - - - Ethernet22 - 10.0.0.44/31 - - - - Ethernet23 - 10.0.0.46/31 - - - - Ethernet24 - 10.0.0.48/31 - - - - Ethernet25 - 10.0.0.50/31 - - - - Ethernet26 - 10.0.0.52/31 - - - - Ethernet27 - 10.0.0.54/31 - - - - Ethernet28 - 10.0.0.56/31 - - - - Ethernet29 - 10.0.0.58/31 - - - - Ethernet30 - 10.0.0.60/31 - - - - Ethernet31 - 10.0.0.62/31 - - - - Ethernet32 - 10.0.0.64/31 - - - - Ethernet33 - 10.0.0.66/31 - - - - Ethernet34 - 10.0.0.68/31 - - - - Ethernet35 - 10.0.0.70/31 - - - - Ethernet36 - 10.0.0.72/31 - - - - Ethernet37 - 10.0.0.74/31 - - - - Ethernet38 - 10.0.0.76/31 - - - - Ethernet39 - 10.0.0.78/31 - - - - Ethernet40 - 10.0.0.80/31 - - - - Ethernet41 - 10.0.0.82/31 - - - - Ethernet42 - 10.0.0.84/31 - - - - Ethernet43 - 10.0.0.86/31 - - - - Ethernet44 - 10.0.0.88/31 - - - - Ethernet45 - 10.0.0.90/31 - - - - Ethernet46 - 10.0.0.92/31 - - - - Ethernet47 - 10.0.0.94/31 - - - - Ethernet48 - 10.0.0.96/31 - - - - Ethernet52 - 10.0.0.98/31 - - - - Ethernet56 - 10.0.0.100/31 - - - - Ethernet60 - 10.0.0.102/31 - - - - Ethernet64 - 10.0.0.104/31 - - - - Ethernet68 - 10.0.0.106/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet1 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet2 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet3 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet5 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet6 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet7 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet9 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet10 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet11 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet13 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet14 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet15 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet17 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet18 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet19 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet21 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet22 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet23 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet25 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet26 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet27 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet29 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet30 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet31 - ARISTA16T0 - Ethernet1 - - - - - sonic - Accton-AS7326-56X - - - - - - - sonic - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - sonic - Accton-AS7326-56X -
diff --git a/device/accton/x86_64-accton_as7512_32x-r0/default_sku b/device/accton/x86_64-accton_as7512_32x-r0/default_sku new file mode 100644 index 000000000000..45eb53f68a97 --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/default_sku @@ -0,0 +1 @@ +AS7512 t1 diff --git a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml deleted file mode 100644 index ac05be93960a..000000000000 --- a/device/accton/x86_64-accton_as7512_32x-r0/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - AS7512 - - - - - - - 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 - AS7512 -
diff --git a/device/accton/x86_64-accton_as7712_32x-r0/default_sku b/device/accton/x86_64-accton_as7712_32x-r0/default_sku new file mode 100644 index 000000000000..fb1c5c5afc92 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/default_sku @@ -0,0 +1 @@ +Accton-AS7712-32X t1 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml deleted file mode 100644 index d252de01ca8a..000000000000 --- a/device/accton/x86_64-accton_as7712_32x-r0/minigraph.xml +++ /dev/null @@ -1,1074 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - Accton-AS7712-32X - - - - - - - sonic - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - sonic - Accton-AS7712-32X -
diff --git a/device/accton/x86_64-accton_as7716_32x-r0/default_sku b/device/accton/x86_64-accton_as7716_32x-r0/default_sku new file mode 100644 index 000000000000..4cd528a50e93 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/default_sku @@ -0,0 +1 @@ +Accton-AS7716-32X t1 diff --git a/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml b/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml deleted file mode 100644 index 148a17769129..000000000000 --- a/device/accton/x86_64-accton_as7716_32x-r0/minigraph.xml +++ /dev/null @@ -1,1074 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - Accton-AS7716-32X - - - - - - - sonic - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - sonic - Accton-AS7716-32X -
diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/default_sku b/device/accton/x86_64-accton_as7716_32xb-r0/default_sku new file mode 100644 index 000000000000..973e749a1fc7 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/default_sku @@ -0,0 +1 @@ +Accton-AS7716-32XB t1 diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/minigraph.xml b/device/accton/x86_64-accton_as7716_32xb-r0/minigraph.xml deleted file mode 100755 index 5cefa847181c..000000000000 --- a/device/accton/x86_64-accton_as7716_32xb-r0/minigraph.xml +++ /dev/null @@ -1,1074 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - Accton-AS7716-32XB - - - - - - - sonic - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - sonic - Accton-AS7716-32XB -
diff --git a/device/accton/x86_64-accton_as7816_64x-r0/default_sku b/device/accton/x86_64-accton_as7816_64x-r0/default_sku new file mode 100644 index 000000000000..31d29c2deb8d --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/default_sku @@ -0,0 +1 @@ +Accton-AS7816-64X t1 diff --git a/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml b/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml deleted file mode 100644 index b561c2f7b8f6..000000000000 --- a/device/accton/x86_64-accton_as7816_64x-r0/minigraph.xml +++ /dev/null @@ -1,848 +0,0 @@ - - - - - - - - - - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - - - - - - sonic - - - - - - hundredGigE1 - 10.0.0.0/31 - - - - hundredGigE2 - 10.0.0.2/31 - - - - hundredGigE3 - 10.0.0.4/31 - - - - hundredGigE4 - 10.0.0.6/31 - - - - hundredGigE5 - 10.0.0.8/31 - - - - hundredGigE6 - 10.0.0.10/31 - - - - hundredGigE7 - 10.0.0.12/31 - - - - hundredGigE8 - 10.0.0.14/31 - - - - hundredGigE9 - 10.0.0.16/31 - - - - hundredGigE10 - 10.0.0.18/31 - - - - hundredGigE11 - 10.0.0.20/31 - - - - hundredGigE12 - 10.0.0.22/31 - - - - hundredGigE13 - 10.0.0.24/31 - - - - hundredGigE14 - 10.0.0.26/31 - - - - hundredGigE15 - 10.0.0.28/31 - - - - hundredGigE16 - 10.0.0.30/31 - - - - hundredGigE17 - 10.0.0.32/31 - - - - hundredGigE18 - 10.0.0.34/31 - - - - hundredGigE19 - 10.0.0.36/31 - - - - hundredGigE20 - 10.0.0.38/31 - - - - hundredGigE21 - 10.0.0.40/31 - - - - hundredGigE22 - 10.0.0.42/31 - - - - hundredGigE23 - 10.0.0.44/31 - - - - hundredGigE24 - 10.0.0.46/31 - - - - hundredGigE25 - 10.0.0.48/31 - - - - hundredGigE26 - 10.0.0.50/31 - - - - hundredGigE27 - 10.0.0.52/31 - - - - hundredGigE28 - 10.0.0.54/31 - - - - hundredGigE29 - 10.0.0.56/31 - - - - hundredGigE30 - 10.0.0.58/31 - - - - hundredGigE31 - 10.0.0.60/31 - - - - hundredGigE32 - 10.0.0.62/31 - - - - hundredGigE33 - 10.0.0.64/31 - - - - hundredGigE34 - 10.0.0.66/31 - - - - hundredGigE35 - 10.0.0.68/31 - - - - hundredGigE36 - 10.0.0.70/31 - - - - hundredGigE37 - 10.0.0.72/31 - - - - hundredGigE38 - 10.0.0.74/31 - - - - hundredGigE39 - 10.0.0.76/31 - - - - hundredGigE40 - 10.0.0.78/31 - - - - hundredGigE41 - 10.0.0.80/31 - - - - hundredGigE42 - 10.0.0.82/31 - - - - hundredGigE43 - 10.0.0.84/31 - - - - hundredGigE44 - 10.0.0.86/31 - - - - hundredGigE45 - 10.0.0.88/31 - - - - hundredGigE46 - 10.0.0.90/31 - - - - hundredGigE47 - 10.0.0.92/31 - - - - hundredGigE48 - 10.0.0.94/31 - - - - hundredGigE49 - 10.0.0.96/31 - - - - hundredGigE50 - 10.0.0.98/31 - - - - hundredGigE51 - 10.0.0.100/31 - - - - hundredGigE52 - 10.0.0.102/31 - - - - hundredGigE53 - 10.0.0.104/31 - - - - hundredGigE54 - 10.0.0.106/31 - - - - hundredGigE55 - 10.0.0.108/31 - - - - hundredGigE56 - 10.0.0.110/31 - - - - hundredGigE57 - 10.0.0.112/31 - - - - hundredGigE58 - 10.0.0.114/31 - - - - hundredGigE59 - 10.0.0.116/31 - - - - hundredGigE60 - 10.0.0.118/31 - - - - hundredGigE61 - 10.0.0.120/31 - - - - hundredGigE62 - 10.0.0.122/31 - - - - hundredGigE63 - 10.0.0.124/31 - - - - hundredGigE64 - 10.0.0.126/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic-target - hundredGigE1 - sonic - hundredGigE1 - - - DeviceInterfaceLink - sonic-target - hundredGigE2 - sonic - hundredGigE2 - - - DeviceInterfaceLink - sonic-target - hundredGigE3 - sonic - hundredGigE3 - - - DeviceInterfaceLink - sonic-target - hundredGigE4 - sonic - hundredGigE4 - - - DeviceInterfaceLink - sonic-target - hundredGigE5 - sonic - hundredGigE5 - - - DeviceInterfaceLink - sonic-target - hundredGigE6 - sonic - hundredGigE6 - - - DeviceInterfaceLink - sonic-target - hundredGigE7 - sonic - hundredGigE7 - - - DeviceInterfaceLink - sonic-target - hundredGigE8 - sonic - hundredGigE8 - - - DeviceInterfaceLink - sonic-target - hundredGigE9 - sonic - hundredGigE9 - - - DeviceInterfaceLink - sonic-target - hundredGigE10 - sonic - hundredGigE10 - - - DeviceInterfaceLink - sonic-target - hundredGigE11 - sonic - hundredGigE11 - - - DeviceInterfaceLink - sonic-target - hundredGigE12 - sonic - hundredGigE12 - - - DeviceInterfaceLink - sonic-target - hundredGigE13 - sonic - hundredGigE13 - - - DeviceInterfaceLink - sonic-target - hundredGigE14 - sonic - hundredGigE14 - - - DeviceInterfaceLink - sonic-target - hundredGigE15 - sonic - hundredGigE15 - - - DeviceInterfaceLink - sonic-target - hundredGigE16 - sonic - hundredGigE16 - - - DeviceInterfaceLink - sonic-target - hundredGigE17 - sonic - hundredGigE17 - - - DeviceInterfaceLink - sonic-target - hundredGigE18 - sonic - hundredGigE18 - - - DeviceInterfaceLink - sonic-target - hundredGigE19 - sonic - hundredGigE19 - - - DeviceInterfaceLink - sonic-target - hundredGigE20 - sonic - hundredGigE20 - - - DeviceInterfaceLink - sonic-target - hundredGigE21 - sonic - hundredGigE21 - - - DeviceInterfaceLink - sonic-target - hundredGigE22 - sonic - hundredGigE22 - - - DeviceInterfaceLink - sonic-target - hundredGigE23 - sonic - hundredGigE23 - - - DeviceInterfaceLink - sonic-target - hundredGigE24 - sonic - hundredGigE24 - - - DeviceInterfaceLink - sonic-target - hundredGigE25 - sonic - hundredGigE25 - - - DeviceInterfaceLink - sonic-target - hundredGigE26 - sonic - hundredGigE26 - - - DeviceInterfaceLink - sonic-target - hundredGigE27 - sonic - hundredGigE27 - - - DeviceInterfaceLink - sonic-target - hundredGigE28 - sonic - hundredGigE28 - - - DeviceInterfaceLink - sonic-target - hundredGigE29 - sonic - hundredGigE29 - - - DeviceInterfaceLink - sonic-target - hundredGigE30 - sonic - hundredGigE30 - - - DeviceInterfaceLink - sonic-target - hundredGigE31 - sonic - hundredGigE31 - - - DeviceInterfaceLink - sonic-target - hundredGigE32 - sonic - hundredGigE32 - - - DeviceInterfaceLink - sonic-target - hundredGigE33 - sonic - hundredGigE33 - - - DeviceInterfaceLink - sonic-target - hundredGigE34 - sonic - hundredGigE34 - - - DeviceInterfaceLink - sonic-target - hundredGigE35 - sonic - hundredGigE35 - - - DeviceInterfaceLink - sonic-target - hundredGigE36 - sonic - hundredGigE36 - - - DeviceInterfaceLink - sonic-target - hundredGigE37 - sonic - hundredGigE37 - - - DeviceInterfaceLink - sonic-target - hundredGigE38 - sonic - hundredGigE38 - - - DeviceInterfaceLink - sonic-target - hundredGigE39 - sonic - hundredGigE39 - - - DeviceInterfaceLink - sonic-target - hundredGigE40 - sonic - hundredGigE40 - - - DeviceInterfaceLink - sonic-target - hundredGigE41 - sonic - hundredGigE41 - - - DeviceInterfaceLink - sonic-target - hundredGigE42 - sonic - hundredGigE42 - - - DeviceInterfaceLink - sonic-target - hundredGigE43 - sonic - hundredGigE43 - - - DeviceInterfaceLink - sonic-target - hundredGigE44 - sonic - hundredGigE44 - - - DeviceInterfaceLink - sonic-target - hundredGigE45 - sonic - hundredGigE45 - - - DeviceInterfaceLink - sonic-target - hundredGigE46 - sonic - hundredGigE46 - - - DeviceInterfaceLink - sonic-target - hundredGigE47 - sonic - hundredGigE47 - - - DeviceInterfaceLink - sonic-target - hundredGigE48 - sonic - hundredGigE48 - - - DeviceInterfaceLink - sonic-target - hundredGigE49 - sonic - hundredGigE49 - - - DeviceInterfaceLink - sonic-target - hundredGigE50 - sonic - hundredGigE50 - - - DeviceInterfaceLink - sonic-target - hundredGigE51 - sonic - hundredGigE51 - - - DeviceInterfaceLink - sonic-target - hundredGigE52 - sonic - hundredGigE52 - - - DeviceInterfaceLink - sonic-target - hundredGigE53 - sonic - hundredGigE53 - - - DeviceInterfaceLink - sonic-target - hundredGigE54 - sonic - hundredGigE54 - - - DeviceInterfaceLink - sonic-target - hundredGigE55 - sonic - hundredGigE55 - - - DeviceInterfaceLink - sonic-target - hundredGigE56 - sonic - hundredGigE56 - - - DeviceInterfaceLink - sonic-target - hundredGigE57 - sonic - hundredGigE57 - - - DeviceInterfaceLink - sonic-target - hundredGigE58 - sonic - hundredGigE58 - - - DeviceInterfaceLink - sonic-target - hundredGigE59 - sonic - hundredGigE59 - - - DeviceInterfaceLink - sonic-target - hundredGigE60 - sonic - hundredGigE60 - - - DeviceInterfaceLink - sonic-target - hundredGigE61 - sonic - hundredGigE61 - - - DeviceInterfaceLink - sonic-target - hundredGigE62 - sonic - hundredGigE62 - - - DeviceInterfaceLink - sonic-target - hundredGigE63 - sonic - hundredGigE63 - - - DeviceInterfaceLink - sonic-target - hundredGigE64 - sonic - hundredGigE64 - - - - - sonic - Accton-AS7816-64X - - - - - - - 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 - Accton-AS7816-64X - diff --git a/device/arista/x86_64-arista_7050_qx32/default_sku b/device/arista/x86_64-arista_7050_qx32/default_sku new file mode 100644 index 000000000000..8c19bef02a08 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/default_sku @@ -0,0 +1 @@ +Arista-7050-QX32 t1 diff --git a/device/arista/x86_64-arista_7050_qx32/minigraph.xml b/device/arista/x86_64-arista_7050_qx32/minigraph.xml deleted file mode 100644 index 538a0ca61a0d..000000000000 --- a/device/arista/x86_64-arista_7050_qx32/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - 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 - - - - - - Ethernet1/1 - 10.0.0.0/31 - - - - Ethernet2/1 - 10.0.0.2/31 - - - - Ethernet3/1 - 10.0.0.4/31 - - - - Ethernet4/1 - 10.0.0.6/31 - - - - Ethernet5/1 - 10.0.0.8/31 - - - - Ethernet6/1 - 10.0.0.10/31 - - - - Ethernet7/1 - 10.0.0.12/31 - - - - Ethernet8/1 - 10.0.0.14/31 - - - - Ethernet9/1 - 10.0.0.16/31 - - - - Ethernet10/1 - 10.0.0.18/31 - - - - Ethernet11/1 - 10.0.0.20/31 - - - - Ethernet12/1 - 10.0.0.22/31 - - - - Ethernet13/1 - 10.0.0.24/31 - - - - Ethernet14/1 - 10.0.0.26/31 - - - - Ethernet15/1 - 10.0.0.28/31 - - - - Ethernet16/1 - 10.0.0.30/31 - - - - Ethernet17/1 - 10.0.0.32/31 - - - - Ethernet18/1 - 10.0.0.34/31 - - - - Ethernet19/1 - 10.0.0.36/31 - - - - Ethernet20/1 - 10.0.0.38/31 - - - - Ethernet21/1 - 10.0.0.40/31 - - - - Ethernet22/1 - 10.0.0.42/31 - - - - Ethernet23/1 - 10.0.0.44/31 - - - - Ethernet24/1 - 10.0.0.46/31 - - - - Ethernet25 - 10.0.0.48/31 - - - - Ethernet26 - 10.0.0.50/31 - - - - Ethernet27 - 10.0.0.52/31 - - - - Ethernet28 - 10.0.0.54/31 - - - - Ethernet29 - 10.0.0.56/31 - - - - Ethernet30 - 10.0.0.58/31 - - - - Ethernet31 - 10.0.0.60/31 - - - - Ethernet32 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet1/1 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet2/1 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet3/1 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4/1 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet5/1 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet6/1 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet7/1 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8/1 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet9/1 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet10/1 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet11/1 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12/1 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet13/1 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet14/1 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet15/1 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16/1 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet17/1 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet18/1 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet19/1 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20/1 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet21/1 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet22/1 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet23/1 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24/1 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet25 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet26 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet27 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet29 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet30 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet31 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA16T0 - Ethernet1 - - - - - sonic - Arista-7050-QX32 - - - - - - - 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 - Arista-7050-QX32 -
diff --git a/device/arista/x86_64-arista_7050_qx32s/default_sku b/device/arista/x86_64-arista_7050_qx32s/default_sku new file mode 100644 index 000000000000..657093e0b603 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/default_sku @@ -0,0 +1 @@ +Arista-7050-QX-32S t1 diff --git a/device/arista/x86_64-arista_7050_qx32s/minigraph.xml b/device/arista/x86_64-arista_7050_qx32s/minigraph.xml deleted file mode 100644 index f8b99096ab24..000000000000 --- a/device/arista/x86_64-arista_7050_qx32s/minigraph.xml +++ /dev/null @@ -1,240 +0,0 @@ - - - - - - - - - - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - - - - - - sonic - - - - - - Ethernet5/1 - 10.0.0.0/31 - - - - Ethernet6/1 - 10.0.0.2/31 - - - - Ethernet7/1 - 10.0.0.4/31 - - - - Ethernet8/1 - 10.0.0.6/31 - - - - Ethernet9/1 - 10.0.0.8/31 - - - - Ethernet10/1 - 10.0.0.10/31 - - - - Ethernet11/1 - 10.0.0.12/31 - - - - Ethernet12/1 - 10.0.0.14/31 - - - - Ethernet13/1 - 10.0.0.16/31 - - - - Ethernet14/1 - 10.0.0.18/31 - - - - Ethernet15/1 - 10.0.0.20/31 - - - - Ethernet16/1 - 10.0.0.22/31 - - - - Ethernet17/1 - 10.0.0.24/31 - - - - Ethernet18/1 - 10.0.0.26/31 - - - - Ethernet19/1 - 10.0.0.28/31 - - - - Ethernet20/1 - 10.0.0.30/31 - - - - Ethernet21/1 - 10.0.0.32/31 - - - - Ethernet22/1 - 10.0.0.34/31 - - - - Ethernet23/1 - 10.0.0.36/31 - - - - Ethernet24/1 - 10.0.0.38/31 - - - - Ethernet25/1 - 10.0.0.40/31 - - - - Ethernet26/1 - 10.0.0.42/31 - - - - Ethernet27/1 - 10.0.0.44/31 - - - - Ethernet28/1 - 10.0.0.46/31 - - - - Ethernet29 - 10.0.0.48/31 - - - - Ethernet30 - 10.0.0.50/31 - - - - Ethernet31 - 10.0.0.52/31 - - - - Ethernet32 - 10.0.0.54/31 - - - - Ethernet33 - 10.0.0.56/31 - - - - Ethernet34 - 10.0.0.58/31 - - - - Ethernet35 - 10.0.0.60/31 - - - - Ethernet36 - 10.0.0.62/31 - - - - - - - - - - - - - - sonic - Arista-7050-QX-32S - - - - - - - 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 - Arista-7050-QX-32S - diff --git a/device/arista/x86_64-arista_7060_cx32s/default_sku b/device/arista/x86_64-arista_7060_cx32s/default_sku new file mode 100644 index 000000000000..e94d12dba895 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/default_sku @@ -0,0 +1 @@ +Arista-7060CX-32S-C32 t1 diff --git a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml b/device/arista/x86_64-arista_7060_cx32s/minigraph.xml deleted file mode 100644 index 772325080e79..000000000000 --- a/device/arista/x86_64-arista_7060_cx32s/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - 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 - - - - - - Ethernet1/1 - 10.0.0.0/31 - - - - Ethernet2/1 - 10.0.0.2/31 - - - - Ethernet3/1 - 10.0.0.4/31 - - - - Ethernet4/1 - 10.0.0.6/31 - - - - Ethernet5/1 - 10.0.0.8/31 - - - - Ethernet6/1 - 10.0.0.10/31 - - - - Ethernet7/1 - 10.0.0.12/31 - - - - Ethernet8/1 - 10.0.0.14/31 - - - - Ethernet9/1 - 10.0.0.16/31 - - - - Ethernet10/1 - 10.0.0.18/31 - - - - Ethernet11/1 - 10.0.0.20/31 - - - - Ethernet12/1 - 10.0.0.22/31 - - - - Ethernet13/1 - 10.0.0.24/31 - - - - Ethernet14/1 - 10.0.0.26/31 - - - - Ethernet15/1 - 10.0.0.28/31 - - - - Ethernet16/1 - 10.0.0.30/31 - - - - Ethernet17/1 - 10.0.0.32/31 - - - - Ethernet18/1 - 10.0.0.34/31 - - - - Ethernet19/1 - 10.0.0.36/31 - - - - Ethernet20/1 - 10.0.0.38/31 - - - - Ethernet21/1 - 10.0.0.40/31 - - - - Ethernet22/1 - 10.0.0.42/31 - - - - Ethernet23/1 - 10.0.0.44/31 - - - - Ethernet24/1 - 10.0.0.46/31 - - - - Ethernet25/1 - 10.0.0.48/31 - - - - Ethernet26/1 - 10.0.0.50/31 - - - - Ethernet27/1 - 10.0.0.52/31 - - - - Ethernet28/1 - 10.0.0.54/31 - - - - Ethernet29/1 - 10.0.0.56/31 - - - - Ethernet30/1 - 10.0.0.58/31 - - - - Ethernet31/1 - 10.0.0.60/31 - - - - Ethernet32/1 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet1/1 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet2/1 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet3/1 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4/1 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet5/1 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet6/1 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet7/1 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8/1 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet9/1 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet10/1 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet11/1 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12/1 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet13/1 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet14/1 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet15/1 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16/1 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet17/1 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet18/1 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet19/1 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20/1 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet21/1 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet22/1 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet23/1 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24/1 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet25/1 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet26/1 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet27/1 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28/1 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet29/1 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet30/1 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet31/1 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32/1 - ARISTA16T0 - Ethernet1 - - - - - sonic - Arista-7060CX-32S-C32 - - - - - - - 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 - Arista-7060CX-32S-C32 -
diff --git a/device/arista/x86_64-arista_7170_64c/default_sku b/device/arista/x86_64-arista_7170_64c/default_sku new file mode 100644 index 000000000000..c3355162a6da --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/default_sku @@ -0,0 +1 @@ +Arista-7170-64C t1 diff --git a/device/arista/x86_64-arista_7170_64c/minigraph.xml b/device/arista/x86_64-arista_7170_64c/minigraph.xml deleted file mode 100644 index 2b2586cf7596..000000000000 --- a/device/arista/x86_64-arista_7170_64c/minigraph.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - HostIP - Loopback0 - - 100.1.0.1/32 - - 100.1.0.1/32 - - - - - - - ManagementIP1 - Management0 - - 172.24.37.166/18 - - 172.24.37.166/18 - - - - - - - sonic - - - - - - - - - - - - - - - - - - sonic - Arista-7170-64C - - - - - - - - sonic - Arista-7170-64C - diff --git a/device/arista/x86_64-arista_7260cx3_64/default_sku b/device/arista/x86_64-arista_7260cx3_64/default_sku new file mode 100644 index 000000000000..959766d95f5c --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/default_sku @@ -0,0 +1 @@ +Arista-7260CX3-C64 t1 diff --git a/device/arista/x86_64-arista_7260cx3_64/minigraph.xml b/device/arista/x86_64-arista_7260cx3_64/minigraph.xml deleted file mode 100644 index 2c632dacc471..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/minigraph.xml +++ /dev/null @@ -1,848 +0,0 @@ - - - - - - - - - - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - - - - - - sonic - - - - - - Ethernet1/1 - 10.0.0.0/31 - - - - Ethernet2/1 - 10.0.0.2/31 - - - - Ethernet3/1 - 10.0.0.4/31 - - - - Ethernet4/1 - 10.0.0.6/31 - - - - Ethernet5/1 - 10.0.0.8/31 - - - - Ethernet6/1 - 10.0.0.10/31 - - - - Ethernet7/1 - 10.0.0.12/31 - - - - Ethernet8/1 - 10.0.0.14/31 - - - - Ethernet9/1 - 10.0.0.16/31 - - - - Ethernet10/1 - 10.0.0.18/31 - - - - Ethernet11/1 - 10.0.0.20/31 - - - - Ethernet12/1 - 10.0.0.22/31 - - - - Ethernet13/1 - 10.0.0.24/31 - - - - Ethernet14/1 - 10.0.0.26/31 - - - - Ethernet15/1 - 10.0.0.28/31 - - - - Ethernet16/1 - 10.0.0.30/31 - - - - Ethernet17/1 - 10.0.0.32/31 - - - - Ethernet18/1 - 10.0.0.34/31 - - - - Ethernet19/1 - 10.0.0.36/31 - - - - Ethernet20/1 - 10.0.0.38/31 - - - - Ethernet21/1 - 10.0.0.40/31 - - - - Ethernet22/1 - 10.0.0.42/31 - - - - Ethernet23/1 - 10.0.0.44/31 - - - - Ethernet24/1 - 10.0.0.46/31 - - - - Ethernet25/1 - 10.0.0.48/31 - - - - Ethernet26/1 - 10.0.0.50/31 - - - - Ethernet27/1 - 10.0.0.52/31 - - - - Ethernet28/1 - 10.0.0.54/31 - - - - Ethernet29/1 - 10.0.0.56/31 - - - - Ethernet30/1 - 10.0.0.58/31 - - - - Ethernet31/1 - 10.0.0.60/31 - - - - Ethernet32/1 - 10.0.0.62/31 - - - - Ethernet33/1 - 10.0.0.64/31 - - - - Ethernet34/1 - 10.0.0.66/31 - - - - Ethernet35/1 - 10.0.0.68/31 - - - - Ethernet36/1 - 10.0.0.70/31 - - - - Ethernet37/1 - 10.0.0.72/31 - - - - Ethernet38/1 - 10.0.0.74/31 - - - - Ethernet39/1 - 10.0.0.76/31 - - - - Ethernet40/1 - 10.0.0.78/31 - - - - Ethernet41/1 - 10.0.0.80/31 - - - - Ethernet42/1 - 10.0.0.82/31 - - - - Ethernet43/1 - 10.0.0.84/31 - - - - Ethernet44/1 - 10.0.0.86/31 - - - - Ethernet45/1 - 10.0.0.88/31 - - - - Ethernet46/1 - 10.0.0.90/31 - - - - Ethernet47/1 - 10.0.0.92/31 - - - - Ethernet48/1 - 10.0.0.94/31 - - - - Ethernet49/1 - 10.0.0.96/31 - - - - Ethernet50/1 - 10.0.0.98/31 - - - - Ethernet51/1 - 10.0.0.100/31 - - - - Ethernet52/1 - 10.0.0.102/31 - - - - Ethernet53/1 - 10.0.0.104/31 - - - - Ethernet54/1 - 10.0.0.106/31 - - - - Ethernet55/1 - 10.0.0.108/31 - - - - Ethernet56/1 - 10.0.0.110/31 - - - - Ethernet57/1 - 10.0.0.112/31 - - - - Ethernet58/1 - 10.0.0.114/31 - - - - Ethernet59/1 - 10.0.0.116/31 - - - - Ethernet60/1 - 10.0.0.118/31 - - - - Ethernet61/1 - 10.0.0.120/31 - - - - Ethernet62/1 - 10.0.0.122/31 - - - - Ethernet63/1 - 10.0.0.124/31 - - - - Ethernet64/1 - 10.0.0.126/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic-target - Ethernet1/1 - sonic - Ethernet1/1 - - - DeviceInterfaceLink - sonic-target - Ethernet2/1 - sonic - Ethernet2/1 - - - DeviceInterfaceLink - sonic-target - Ethernet3/1 - sonic - Ethernet3/1 - - - DeviceInterfaceLink - sonic-target - Ethernet4/1 - sonic - Ethernet4/1 - - - DeviceInterfaceLink - sonic-target - Ethernet5/1 - sonic - Ethernet5/1 - - - DeviceInterfaceLink - sonic-target - Ethernet6/1 - sonic - Ethernet6/1 - - - DeviceInterfaceLink - sonic-target - Ethernet7/1 - sonic - Ethernet7/1 - - - DeviceInterfaceLink - sonic-target - Ethernet8/1 - sonic - Ethernet8/1 - - - DeviceInterfaceLink - sonic-target - Ethernet9/1 - sonic - Ethernet9/1 - - - DeviceInterfaceLink - sonic-target - Ethernet10/1 - sonic - Ethernet10/1 - - - DeviceInterfaceLink - sonic-target - Ethernet11/1 - sonic - Ethernet11/1 - - - DeviceInterfaceLink - sonic-target - Ethernet12/1 - sonic - Ethernet12/1 - - - DeviceInterfaceLink - sonic-target - Ethernet13/1 - sonic - Ethernet13/1 - - - DeviceInterfaceLink - sonic-target - Ethernet14/1 - sonic - Ethernet14/1 - - - DeviceInterfaceLink - sonic-target - Ethernet15/1 - sonic - Ethernet15/1 - - - DeviceInterfaceLink - sonic-target - Ethernet16/1 - sonic - Ethernet16/1 - - - DeviceInterfaceLink - sonic-target - Ethernet17/1 - sonic - Ethernet17/1 - - - DeviceInterfaceLink - sonic-target - Ethernet18/1 - sonic - Ethernet18/1 - - - DeviceInterfaceLink - sonic-target - Ethernet19/1 - sonic - Ethernet19/1 - - - DeviceInterfaceLink - sonic-target - Ethernet20/1 - sonic - Ethernet20/1 - - - DeviceInterfaceLink - sonic-target - Ethernet21/1 - sonic - Ethernet21/1 - - - DeviceInterfaceLink - sonic-target - Ethernet22/1 - sonic - Ethernet22/1 - - - DeviceInterfaceLink - sonic-target - Ethernet23/1 - sonic - Ethernet23/1 - - - DeviceInterfaceLink - sonic-target - Ethernet24/1 - sonic - Ethernet24/1 - - - DeviceInterfaceLink - sonic-target - Ethernet25/1 - sonic - Ethernet25/1 - - - DeviceInterfaceLink - sonic-target - Ethernet26/1 - sonic - Ethernet26/1 - - - DeviceInterfaceLink - sonic-target - Ethernet27/1 - sonic - Ethernet27/1 - - - DeviceInterfaceLink - sonic-target - Ethernet28/1 - sonic - Ethernet28/1 - - - DeviceInterfaceLink - sonic-target - Ethernet29/1 - sonic - Ethernet29/1 - - - DeviceInterfaceLink - sonic-target - Ethernet30/1 - sonic - Ethernet30/1 - - - DeviceInterfaceLink - sonic-target - Ethernet31/1 - sonic - Ethernet31/1 - - - DeviceInterfaceLink - sonic-target - Ethernet32/1 - sonic - Ethernet32/1 - - - DeviceInterfaceLink - sonic-target - Ethernet33/1 - sonic - Ethernet33/1 - - - DeviceInterfaceLink - sonic-target - Ethernet34/1 - sonic - Ethernet34/1 - - - DeviceInterfaceLink - sonic-target - Ethernet35/1 - sonic - Ethernet35/1 - - - DeviceInterfaceLink - sonic-target - Ethernet36/1 - sonic - Ethernet36/1 - - - DeviceInterfaceLink - sonic-target - Ethernet37/1 - sonic - Ethernet37/1 - - - DeviceInterfaceLink - sonic-target - Ethernet38/1 - sonic - Ethernet38/1 - - - DeviceInterfaceLink - sonic-target - Ethernet39/1 - sonic - Ethernet39/1 - - - DeviceInterfaceLink - sonic-target - Ethernet40/1 - sonic - Ethernet40/1 - - - DeviceInterfaceLink - sonic-target - Ethernet41/1 - sonic - Ethernet41/1 - - - DeviceInterfaceLink - sonic-target - Ethernet42/1 - sonic - Ethernet42/1 - - - DeviceInterfaceLink - sonic-target - Ethernet43/1 - sonic - Ethernet43/1 - - - DeviceInterfaceLink - sonic-target - Ethernet44/1 - sonic - Ethernet44/1 - - - DeviceInterfaceLink - sonic-target - Ethernet45/1 - sonic - Ethernet45/1 - - - DeviceInterfaceLink - sonic-target - Ethernet46/1 - sonic - Ethernet46/1 - - - DeviceInterfaceLink - sonic-target - Ethernet47/1 - sonic - Ethernet47/1 - - - DeviceInterfaceLink - sonic-target - Ethernet48/1 - sonic - Ethernet48/1 - - - DeviceInterfaceLink - sonic-target - Ethernet49/1 - sonic - Ethernet49/1 - - - DeviceInterfaceLink - sonic-target - Ethernet50/1 - sonic - Ethernet50/1 - - - DeviceInterfaceLink - sonic-target - Ethernet51/1 - sonic - Ethernet51/1 - - - DeviceInterfaceLink - sonic-target - Ethernet52/1 - sonic - Ethernet52/1 - - - DeviceInterfaceLink - sonic-target - Ethernet53/1 - sonic - Ethernet53/1 - - - DeviceInterfaceLink - sonic-target - Ethernet54/1 - sonic - Ethernet54/1 - - - DeviceInterfaceLink - sonic-target - Ethernet55/1 - sonic - Ethernet55/1 - - - DeviceInterfaceLink - sonic-target - Ethernet56/1 - sonic - Ethernet56/1 - - - DeviceInterfaceLink - sonic-target - Ethernet57/1 - sonic - Ethernet57/1 - - - DeviceInterfaceLink - sonic-target - Ethernet58/1 - sonic - Ethernet58/1 - - - DeviceInterfaceLink - sonic-target - Ethernet59/1 - sonic - Ethernet59/1 - - - DeviceInterfaceLink - sonic-target - Ethernet60/1 - sonic - Ethernet60/1 - - - DeviceInterfaceLink - sonic-target - Ethernet61/1 - sonic - Ethernet61/1 - - - DeviceInterfaceLink - sonic-target - Ethernet62/1 - sonic - Ethernet62/1 - - - DeviceInterfaceLink - sonic-target - Ethernet63/1 - sonic - Ethernet63/1 - - - DeviceInterfaceLink - sonic-target - Ethernet64/1 - sonic - Ethernet64/1 - - - - - sonic - Arista-7260CX3-C64 - - - - - - - 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 - Arista-7260CX3-C64 - diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/default_sku b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/default_sku new file mode 100644 index 000000000000..e2f0630cc576 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/default_sku @@ -0,0 +1 @@ +montara t1 diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/minigraph.xml b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/minigraph.xml deleted file mode 100644 index 60d93ad69d66..000000000000 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - ARISTA01T0 - 10.0.0.33 - switch - 10.0.0.32 - 1 - 180 - 60 - - - switch - 10.0.0.0 - ARISTA01T2 - 10.0.0.1 - 1 - 180 - 60 - - - ARISTA02T0 - 10.0.0.35 - switch - 10.0.0.34 - 1 - 180 - 60 - - - switch - 10.0.0.2 - ARISTA02T2 - 10.0.0.3 - 1 - 180 - 60 - - - ARISTA03T0 - 10.0.0.37 - switch - 10.0.0.36 - 1 - 180 - 60 - - - switch - 10.0.0.4 - ARISTA03T2 - 10.0.0.5 - 1 - 180 - 60 - - - ARISTA04T0 - 10.0.0.39 - switch - 10.0.0.38 - 1 - 180 - 60 - - - switch - 10.0.0.6 - ARISTA04T2 - 10.0.0.7 - 1 - 180 - 60 - - - ARISTA05T0 - 10.0.0.41 - switch - 10.0.0.40 - 1 - 180 - 60 - - - switch - 10.0.0.8 - ARISTA05T2 - 10.0.0.9 - 1 - 180 - 60 - - - ARISTA06T0 - 10.0.0.43 - switch - 10.0.0.42 - 1 - 180 - 60 - - - switch - 10.0.0.10 - ARISTA06T2 - 10.0.0.11 - 1 - 180 - 60 - - - ARISTA07T0 - 10.0.0.45 - switch - 10.0.0.44 - 1 - 180 - 60 - - - switch - 10.0.0.12 - ARISTA07T2 - 10.0.0.13 - 1 - 180 - 60 - - - ARISTA08T0 - 10.0.0.47 - switch - 10.0.0.46 - 1 - 180 - 60 - - - switch - 10.0.0.14 - ARISTA08T2 - 10.0.0.15 - 1 - 180 - 60 - - - ARISTA09T0 - 10.0.0.49 - switch - 10.0.0.48 - 1 - 180 - 60 - - - switch - 10.0.0.16 - ARISTA09T2 - 10.0.0.17 - 1 - 180 - 60 - - - ARISTA10T0 - 10.0.0.51 - switch - 10.0.0.50 - 1 - 180 - 60 - - - switch - 10.0.0.18 - ARISTA10T2 - 10.0.0.19 - 1 - 180 - 60 - - - ARISTA11T0 - 10.0.0.53 - switch - 10.0.0.52 - 1 - 180 - 60 - - - switch - 10.0.0.20 - ARISTA11T2 - 10.0.0.21 - 1 - 180 - 60 - - - ARISTA12T0 - 10.0.0.55 - switch - 10.0.0.54 - 1 - 180 - 60 - - - switch - 10.0.0.22 - ARISTA12T2 - 10.0.0.23 - 1 - 180 - 60 - - - ARISTA13T0 - 10.0.0.57 - switch - 10.0.0.56 - 1 - 180 - 60 - - - switch - 10.0.0.24 - ARISTA13T2 - 10.0.0.25 - 1 - 180 - 60 - - - ARISTA14T0 - 10.0.0.59 - switch - 10.0.0.58 - 1 - 180 - 60 - - - switch - 10.0.0.26 - ARISTA14T2 - 10.0.0.27 - 1 - 180 - 60 - - - ARISTA15T0 - 10.0.0.61 - switch - 10.0.0.60 - 1 - 180 - 60 - - - switch - 10.0.0.28 - ARISTA15T2 - 10.0.0.29 - 1 - 180 - 60 - - - ARISTA16T0 - 10.0.0.63 - switch - 10.0.0.62 - 1 - 180 - 60 - - - switch - 10.0.0.30 - ARISTA16T2 - 10.0.0.31 - 1 - 180 - 60 - - - - - 65100 - switch - - -
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 - - - - - - - - switch - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - switch - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - switch - montara - - ` - - - - - switch - - - 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 - - - - - - - switch - montara -
diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/default_sku b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/default_sku new file mode 100644 index 000000000000..ba06df1e2a59 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/default_sku @@ -0,0 +1 @@ +mavericks t1 diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/minigraph.xml b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/minigraph.xml deleted file mode 100644 index 18d614739737..000000000000 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - ARISTA01T0 - 10.0.0.33 - switch - 10.0.0.32 - 1 - 180 - 60 - - - switch - 10.0.0.0 - ARISTA01T2 - 10.0.0.1 - 1 - 180 - 60 - - - ARISTA02T0 - 10.0.0.35 - switch - 10.0.0.34 - 1 - 180 - 60 - - - switch - 10.0.0.2 - ARISTA02T2 - 10.0.0.3 - 1 - 180 - 60 - - - ARISTA03T0 - 10.0.0.37 - switch - 10.0.0.36 - 1 - 180 - 60 - - - switch - 10.0.0.4 - ARISTA03T2 - 10.0.0.5 - 1 - 180 - 60 - - - ARISTA04T0 - 10.0.0.39 - switch - 10.0.0.38 - 1 - 180 - 60 - - - switch - 10.0.0.6 - ARISTA04T2 - 10.0.0.7 - 1 - 180 - 60 - - - ARISTA05T0 - 10.0.0.41 - switch - 10.0.0.40 - 1 - 180 - 60 - - - switch - 10.0.0.8 - ARISTA05T2 - 10.0.0.9 - 1 - 180 - 60 - - - ARISTA06T0 - 10.0.0.43 - switch - 10.0.0.42 - 1 - 180 - 60 - - - switch - 10.0.0.10 - ARISTA06T2 - 10.0.0.11 - 1 - 180 - 60 - - - ARISTA07T0 - 10.0.0.45 - switch - 10.0.0.44 - 1 - 180 - 60 - - - switch - 10.0.0.12 - ARISTA07T2 - 10.0.0.13 - 1 - 180 - 60 - - - ARISTA08T0 - 10.0.0.47 - switch - 10.0.0.46 - 1 - 180 - 60 - - - switch - 10.0.0.14 - ARISTA08T2 - 10.0.0.15 - 1 - 180 - 60 - - - ARISTA09T0 - 10.0.0.49 - switch - 10.0.0.48 - 1 - 180 - 60 - - - switch - 10.0.0.16 - ARISTA09T2 - 10.0.0.17 - 1 - 180 - 60 - - - ARISTA10T0 - 10.0.0.51 - switch - 10.0.0.50 - 1 - 180 - 60 - - - switch - 10.0.0.18 - ARISTA10T2 - 10.0.0.19 - 1 - 180 - 60 - - - ARISTA11T0 - 10.0.0.53 - switch - 10.0.0.52 - 1 - 180 - 60 - - - switch - 10.0.0.20 - ARISTA11T2 - 10.0.0.21 - 1 - 180 - 60 - - - ARISTA12T0 - 10.0.0.55 - switch - 10.0.0.54 - 1 - 180 - 60 - - - switch - 10.0.0.22 - ARISTA12T2 - 10.0.0.23 - 1 - 180 - 60 - - - ARISTA13T0 - 10.0.0.57 - switch - 10.0.0.56 - 1 - 180 - 60 - - - switch - 10.0.0.24 - ARISTA13T2 - 10.0.0.25 - 1 - 180 - 60 - - - ARISTA14T0 - 10.0.0.59 - switch - 10.0.0.58 - 1 - 180 - 60 - - - switch - 10.0.0.26 - ARISTA14T2 - 10.0.0.27 - 1 - 180 - 60 - - - ARISTA15T0 - 10.0.0.61 - switch - 10.0.0.60 - 1 - 180 - 60 - - - switch - 10.0.0.28 - ARISTA15T2 - 10.0.0.29 - 1 - 180 - 60 - - - ARISTA16T0 - 10.0.0.63 - switch - 10.0.0.62 - 1 - 180 - 60 - - - switch - 10.0.0.30 - ARISTA16T2 - 10.0.0.31 - 1 - 180 - 60 - - - - - 65100 - switch - - -
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 - - - - - - - - switch - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - switch - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - switch - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - switch - mavericks - - ` - - - - - switch - - - 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 - - - - - - - switch - mavericks -
diff --git a/device/celestica/x86_64-cel_e1031-r0/default_sku b/device/celestica/x86_64-cel_e1031-r0/default_sku new file mode 100644 index 000000000000..89a0aac4181a --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/default_sku @@ -0,0 +1 @@ +Celestica-E1031-T48S4 t1 diff --git a/device/celestica/x86_64-cel_e1031-r0/minigraph.xml b/device/celestica/x86_64-cel_e1031-r0/minigraph.xml deleted file mode 100644 index 7b24807718ac..000000000000 --- a/device/celestica/x86_64-cel_e1031-r0/minigraph.xml +++ /dev/null @@ -1,810 +0,0 @@ - - - - - - ARISTA01T1 - 10.0.0.1 - sonic - 10.0.0.0 - 1 - 180 - 60 - - - ARISTA02T1 - 10.0.0.5 - sonic - 10.0.0.4 - 1 - 180 - 60 - - - ARISTA03T1 - 10.0.0.9 - sonic - 10.0.0.8 - 1 - 180 - 60 - - - ARISTA04T1 - 10.0.0.13 - sonic - 10.0.0.12 - 1 - 180 - 60 - - - ARISTA01T1 - FC00::2 - sonic - FC00::1 - 1 - 180 - 60 - - - ARISTA02T1 - FC00::A - sonic - FC00::9 - 1 - 180 - 60 - - - ARISTA03T1 - FC00::12 - sonic - FC00::11 - 1 - 180 - 60 - - - ARISTA04T1 - FC00::1A - sonic - FC00::19 - 1 - 180 - 60 - - - - - 64601 - sonic - - - BGPPeer -
10.0.0.1
- - - -
- - BGPPeer -
10.0.0.5
- - - -
- - BGPPeer -
10.0.0.9
- - - -
- - BGPPeer -
10.0.0.13
- - - -
- - BGPPeer -
FC00::2
- - - -
- - BGPPeer -
FC00::A
- - - -
- - BGPPeer -
FC00::12
- - - -
- - BGPPeer -
FC00::1A
- - - -
-
- -
- - 64802 - ARISTA01T1 - - - - 64802 - ARISTA02T1 - - - - 64802 - ARISTA03T1 - - - - 64802 - ARISTA04T1 - - -
-
- - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - HostIP1 - Loopback0 - - FC00:1::32/128 - - FC00:1::32/128 - - - - - HostIP - eth0 - - 10.251.0.243/23 - - 10.251.0.243/23 - - - - - - sonic - - - - VlanInterface - Vlan2 - etp1;etp2;etp3;etp4;etp5;etp6;etp7;etp8;etp9;etp10;etp11;etp12;etp13;etp14;etp15;etp16;etp17;etp18;etp19;etp20;etp21;etp22;etp23;etp24;etp25;etp26;etp27;etp28;etp29;etp30;etp31;etp32;etp33;etp34;etp35;etp36;etp37;etp38;etp39;etp40;etp41;etp42;etp43;etp44;etp45;etp46;etp47;etp48 - False - 0.0.0.0/0 - - 2 - 2 - 172.0.0.0/26 - - - - - IPInterface - - etp49 - 10.0.0.0/31 - - - IPInterface - - etp50 - 10.0.0.4/31 - - - IPInterface - - etp51 - 10.0.0.8/31 - - - IPInterface - - etp52 - 10.0.0.12/31 - - - IPInterface - - etp49 - FC00::1/126 - - - IPInterface - - etp50 - FC00::9/126 - - - IPInterface - - etp51 - FC00::11/126 - - - IPInterface - - etp52 - FC00::19/126 - - - IPInterface - - Vlan2 - 172.0.0.1/26 - - - - - - - - - - - - DeviceInterfaceLink - true - 10000 - ARISTA01T1 - Ethernet1 - true - sonic - etp49 - - - DeviceInterfaceLink - true - 10000 - ARISTA02T1 - Ethernet1 - true - sonic - etp50 - - - DeviceInterfaceLink - true - 10000 - ARISTA03T1 - Ethernet1 - true - sonic - etp51 - - - DeviceInterfaceLink - true - 10000 - ARISTA04T1 - Ethernet1 - true - sonic - etp52 - - - DeviceInterfaceLink - true - 1000 - sonic - etp1 - true - server-01 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp2 - true - server-02 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp3 - true - server-03 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp4 - true - server-04 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp5 - true - server-05 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp6 - true - server-06 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp7 - true - server-07 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp8 - true - server-08 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp9 - true - server-09 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp10 - true - server-10 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp11 - true - server-11 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp12 - true - server-12 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp13 - true - server-13 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp14 - true - server-14 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp15 - true - server-15 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp16 - true - server-16 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp17 - true - server-17 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp18 - true - server-18 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp19 - true - server-19 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp20 - true - server-20 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp21 - true - server-21 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp22 - true - server-22 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp23 - true - server-23 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp24 - true - server-24 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp25 - true - server-25 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp26 - true - server-26 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp27 - true - server-27 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp28 - true - server-28 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp29 - true - server-29 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp30 - true - server-30 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp31 - true - server-31 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp32 - true - server-32 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp33 - true - server-33 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp34 - true - server-34 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp35 - true - server-35 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp36 - true - server-36 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp37 - true - server-37 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp38 - true - server-38 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp39 - true - server-39 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp40 - true - server-40 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp41 - true - server-41 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp42 - true - server-42 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp43 - true - server-43 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp44 - true - server-44 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp45 - true - server-45 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp46 - true - server-46 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp47 - true - server-47 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - etp48 - true - server-48 - 0 - - - - - sonic - Celestica-E1031-T48S4 - - 10.251.0.243 - - - - - sonic - Celestica-E1031-T48S4 -
diff --git a/device/celestica/x86_64-cel_seastone-r0/default_sku b/device/celestica/x86_64-cel_seastone-r0/default_sku new file mode 100644 index 000000000000..0c95475c8505 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/default_sku @@ -0,0 +1 @@ +Seastone-DX010 t1 diff --git a/device/celestica/x86_64-cel_seastone-r0/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/minigraph.xml deleted file mode 100644 index 2590e4f50c29..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/minigraph.xml +++ /dev/null @@ -1,1253 +0,0 @@ - - - - - - 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 - - - - - - Eth1/1 - 10.0.0.0/31 - - - - Eth1/2 - 10.0.0.2/31 - - - - Eth1/3 - 10.0.0.4/31 - - - - Eth1/4 - 10.0.0.6/31 - - - - Eth2/1 - 10.0.0.8/31 - - - - Eth2/2 - 10.0.0.10/31 - - - - Eth2/3 - 10.0.0.12/31 - - - - Eth2/4 - 10.0.0.14/31 - - - - Eth3/1 - 10.0.0.16/31 - - - - Eth3/2 - 10.0.0.18/31 - - - - Eth3/3 - 10.0.0.20/31 - - - - Eth3/4 - 10.0.0.22/31 - - - - Eth4/1 - 10.0.0.24/31 - - - - Eth4/2 - 10.0.0.26/31 - - - - Eth4/3 - 10.0.0.28/31 - - - - Eth4/4 - 10.0.0.30/31 - - - - Eth5/1 - 10.0.0.32/31 - - - - Eth5/2 - 10.0.0.34/31 - - - - Eth5/3 - 10.0.0.36/31 - - - - Eth5/4 - 10.0.0.38/31 - - - - Eth6/1 - 10.0.0.40/31 - - - - Eth6/2 - 10.0.0.42/31 - - - - Eth6/3 - 10.0.0.44/31 - - - - Eth6/4 - 10.0.0.46/31 - - - - Eth7/1 - 10.0.0.48/31 - - - - Eth7/2 - 10.0.0.50/31 - - - - Eth7/3 - 10.0.0.52/31 - - - - Eth7/4 - 10.0.0.54/31 - - - - Eth8/1 - 10.0.0.56/31 - - - - Eth8/2 - 10.0.0.58/31 - - - - Eth8/3 - 10.0.0.60/31 - - - - Eth8/4 - 10.0.0.62/31 - - - - Eth9/1 - 10.0.0.64/31 - - - - Eth9/2 - 10.0.0.66/31 - - - - Eth9/3 - 10.0.0.68/31 - - - - Eth9/4 - 10.0.0.70/31 - - - - Eth10/1 - 10.0.0.72/31 - - - - Eth10/2 - 10.0.0.74/31 - - - - Eth10/3 - 10.0.0.76/31 - - - - Eth10/4 - 10.0.0.78/31 - - - - Eth11/1 - 10.0.0.80/31 - - - - Eth11/2 - 10.0.0.82/31 - - - - Eth11/3 - 10.0.0.84/31 - - - - Eth11/4 - 10.0.0.86/31 - - - - Eth12/1 - 10.0.0.88/31 - - - - Eth12/2 - 10.0.0.90/31 - - - - Eth12/3 - 10.0.0.92/31 - - - - Eth12/4 - 10.0.0.94/31 - - - - Eth13/1 - 10.0.0.96/31 - - - - Eth13/2 - 10.0.0.98/31 - - - - Eth13/3 - 10.0.0.100/31 - - - - Eth13/4 - 10.0.0.102/31 - - - - Eth14/1 - 10.0.0.104/31 - - - - Eth14/2 - 10.0.0.106/31 - - - - Eth14/3 - 10.0.0.108/31 - - - - Eth14/4 - 10.0.0.110/31 - - - - Eth15/1 - 10.0.0.112/31 - - - - Eth15/2 - 10.0.0.114/31 - - - - Eth15/3 - 10.0.0.116/31 - - - - Eth15/4 - 10.0.0.118/31 - - - - Eth16/1 - 10.0.0.120/31 - - - - Eth16/2 - 10.0.0.122/31 - - - - Eth16/3 - 10.0.0.124/31 - - - - Eth16/4 - 10.0.0.126/31 - - - - Eth17/1 - 10.0.0.128/31 - - - - Eth17/2 - 10.0.0.130/31 - - - - Eth17/3 - 10.0.0.132/31 - - - - Eth17/4 - 10.0.0.134/31 - - - - Eth18/1 - 10.0.0.136/31 - - - - Eth18/2 - 10.0.0.138/31 - - - - Eth18/3 - 10.0.0.140/31 - - - - Eth18/4 - 10.0.0.142/31 - - - - Eth19/1 - 10.0.0.144/31 - - - - Eth19/2 - 10.0.0.146/31 - - - - Eth19/3 - 10.0.0.148/31 - - - - Eth19/4 - 10.0.0.150/31 - - - - Eth20/1 - 10.0.0.152/31 - - - - Eth20/2 - 10.0.0.154/31 - - - - Eth20/3 - 10.0.0.156/31 - - - - Eth20/4 - 10.0.0.158/31 - - - - Eth21/1 - 10.0.0.160/31 - - - - Eth21/2 - 10.0.0.162/31 - - - - Eth21/3 - 10.0.0.164/31 - - - - Eth21/4 - 10.0.0.166/31 - - - - Eth22/1 - 10.0.0.168/31 - - - - Eth22/2 - 10.0.0.170/31 - - - - Eth22/3 - 10.0.0.172/31 - - - - Eth22/4 - 10.0.0.174/31 - - - - Eth23/1 - 10.0.0.176/31 - - - - Eth23/2 - 10.0.0.178/31 - - - - Eth23/3 - 10.0.0.180/31 - - - - Eth23/4 - 10.0.0.182/31 - - - - Eth24/1 - 10.0.0.184/31 - - - - Eth24/2 - 10.0.0.186/31 - - - - Eth24/3 - 10.0.0.188/31 - - - - Eth24/4 - 10.0.0.190/31 - - - - Eth25/1 - 10.0.1.0/31 - - - - Eth25/2 - 10.0.1.2/31 - - - - Eth26/1 - 10.0.1.4/31 - - - - Eth26/2 - 10.0.1.6/31 - - - - Eth27/1 - 10.0.1.8/31 - - - - Eth27/2 - 10.0.1.10/31 - - - - Eth28/1 - 10.0.1.12/31 - - - - Eth28/2 - 10.0.1.14/31 - - - - Eth29/1 - 10.0.1.16/31 - - - - Eth29/2 - 10.0.1.18/31 - - - - Eth30/1 - 10.0.1.20/31 - - - - Eth30/2 - 10.0.1.22/31 - - - - Eth31/1 - 10.0.1.24/31 - - - - Eth31/2 - 10.0.1.26/31 - - - - Eth32/1 - 10.0.1.28/31 - - - - Eth32/2 - 10.0.1.30/31 - - - - - - - - - - - - sonic - Seastone-DX010-10-50 - - - - - - - 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 - Seastone-DX010-10-50 -
diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/default_sku b/device/centec/x86_64-centec_e582_48x6q-r0/default_sku new file mode 100644 index 000000000000..e0f7b24535b6 --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/default_sku @@ -0,0 +1 @@ +E582-48x6q t1 diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/default_sku b/device/centec/x86_64-ew_es6220_x48q2h4-r0/default_sku new file mode 100644 index 000000000000..d10e1b46328c --- /dev/null +++ b/device/centec/x86_64-ew_es6220_x48q2h4-r0/default_sku @@ -0,0 +1 @@ +ES6428A-X48Q2H4 t1 diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml b/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml deleted file mode 100644 index cb0e9d4e2b0a..000000000000 --- a/device/centec/x86_64-ew_es6220_x48q2h4-r0/minigraph.xml +++ /dev/null @@ -1,1049 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - ES6428A-X48Q2H4 - - - - sonic - ES6428A-X48Q2H4 -
diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/default_sku b/device/dell/x86_64-dell_s6000_s1220-r0/default_sku new file mode 100644 index 000000000000..493e1989b662 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/default_sku @@ -0,0 +1 @@ +Force10-S6000 t1 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml b/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml deleted file mode 100644 index d5b453c43081..000000000000 --- a/device/dell/x86_64-dell_s6000_s1220-r0/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - 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 - - - - - - fortyGigE0/0 - 10.0.0.0/31 - - - - fortyGigE0/4 - 10.0.0.2/31 - - - - fortyGigE0/8 - 10.0.0.4/31 - - - - fortyGigE0/12 - 10.0.0.6/31 - - - - fortyGigE0/16 - 10.0.0.8/31 - - - - fortyGigE0/20 - 10.0.0.10/31 - - - - fortyGigE0/24 - 10.0.0.12/31 - - - - fortyGigE0/28 - 10.0.0.14/31 - - - - fortyGigE0/32 - 10.0.0.16/31 - - - - fortyGigE0/36 - 10.0.0.18/31 - - - - fortyGigE0/40 - 10.0.0.20/31 - - - - fortyGigE0/44 - 10.0.0.22/31 - - - - fortyGigE0/48 - 10.0.0.24/31 - - - - fortyGigE0/52 - 10.0.0.26/31 - - - - fortyGigE0/56 - 10.0.0.28/31 - - - - fortyGigE0/60 - 10.0.0.30/31 - - - - fortyGigE0/64 - 10.0.0.32/31 - - - - fortyGigE0/68 - 10.0.0.34/31 - - - - fortyGigE0/72 - 10.0.0.36/31 - - - - fortyGigE0/76 - 10.0.0.38/31 - - - - fortyGigE0/80 - 10.0.0.40/31 - - - - fortyGigE0/84 - 10.0.0.42/31 - - - - fortyGigE0/88 - 10.0.0.44/31 - - - - fortyGigE0/92 - 10.0.0.46/31 - - - - fortyGigE0/96 - 10.0.0.48/31 - - - - fortyGigE0/100 - 10.0.0.50/31 - - - - fortyGigE0/104 - 10.0.0.52/31 - - - - fortyGigE0/108 - 10.0.0.54/31 - - - - fortyGigE0/112 - 10.0.0.56/31 - - - - fortyGigE0/116 - 10.0.0.58/31 - - - - fortyGigE0/120 - 10.0.0.60/31 - - - - fortyGigE0/124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - fortyGigE0/0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - fortyGigE0/124 - ARISTA16T0 - Ethernet1 - - - - - sonic - Force10-S6000 - - - - - - - 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 - Force10-S6000 -
diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/default_sku b/device/dell/x86_64-dell_s6100_c2538-r0/default_sku new file mode 100644 index 000000000000..0ab292005678 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/default_sku @@ -0,0 +1 @@ +Force10-S6100 t1 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml deleted file mode 100644 index 224cf4a9a6bb..000000000000 --- a/device/dell/x86_64-dell_s6100_c2538-r0/minigraph.xml +++ /dev/null @@ -1,774 +0,0 @@ - - - - - - ARISTA01T1 - 10.0.0.1 - sonic - 10.0.0.0 - 1 - 180 - 60 - - - ARISTA02T1 - 10.0.0.5 - sonic - 10.0.0.4 - 1 - 180 - 60 - - - ARISTA03T1 - 10.0.0.9 - sonic - 10.0.0.8 - 1 - 180 - 60 - - - ARISTA04T1 - 10.0.0.13 - sonic - 10.0.0.12 - 1 - 180 - 60 - - - ARISTA01T1 - FC00::2 - sonic - FC00::1 - 1 - 180 - 60 - - - ARISTA02T1 - FC00::A - sonic - FC00::9 - 1 - 180 - 60 - - - ARISTA03T1 - FC00::12 - sonic - FC00::11 - 1 - 180 - 60 - - - ARISTA04T1 - FC00::1A - sonic - FC00::19 - 1 - 180 - 60 - - - - - 64601 - sonic - - - BGPPeer -
10.0.0.1
- - - -
- - BGPPeer -
10.0.0.5
- - - -
- - BGPPeer -
10.0.0.9
- - - -
- - BGPPeer -
10.0.0.13
- - - -
- - BGPPeer -
FC00::2
- - - -
- - BGPPeer -
FC00::A
- - - -
- - BGPPeer -
FC00::12
- - - -
- - BGPPeer -
FC00::1A
- - - -
-
- -
- - 64802 - ARISTA01T1 - - - - 64802 - ARISTA02T1 - - - - 64802 - ARISTA03T1 - - - - 64802 - ARISTA04T1 - - -
-
- - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - HostIP1 - Loopback0 - - FC00:1::32/128 - - FC00:1::32/128 - - - - - - - - sonic - - - PortChannelInterface - PortChannel1 - fortyGigE1/1/1;fortyGigE1/1/2 - - - - PortChannelInterface - PortChannel5 - fortyGigE1/1/5;fortyGigE1/1/6 - - - - PortChannelInterface - PortChannel16 - fortyGigE1/2/1;fortyGigE1/2/2 - - - - PortChannelInterface - PortChannel20 - fortyGigE1/2/5;fortyGigE1/2/6 - - - - - - VlanInterface - Vlan2 - fortyGigE1/1/7;fortyGigE1/1/8;fortyGigE1/1/9;fortyGigE1/1/10;fortyGigE1/1/11;fortyGigE1/1/12;fortyGigE1/1/13;fortyGigE1/1/14;fortyGigE1/1/15;fortyGigE1/1/16;fortyGigE1/3/1;fortyGigE1/3/5;fortyGigE1/3/6;fortyGigE1/3/7;fortyGigE1/3/8;fortyGigE1/3/9;fortyGigE1/3/10;fortyGigE1/3/11;fortyGigE1/2/7;fortyGigE1/2/8;fortyGigE1/2/9;fortyGigE1/2/10;fortyGigE1/2/11;fortyGigE1/2/12;fortyGigE1/2/13;fortyGigE1/2/14;fortyGigE1/2/15;fortyGigE1/2/16;fortyGigE1/4/1;fortyGigE1/4/5;fortyGigE1/4/6;fortyGigE1/4/7;fortyGigE1/4/8;fortyGigE1/4/9;fortyGigE1/4/10;fortyGigE1/4/11 - False - 0.0.0.0/0 - - 2 - 2 - 172.0.0.0/26 - - - - - IPInterface - - PortChannel1 - 10.0.0.0/31 - - - IPInterface - - PortChannel5 - 10.0.0.4/31 - - - IPInterface - - PortChannel16 - 10.0.0.8/31 - - - IPInterface - - PortChannel20 - 10.0.0.12/31 - - - IPInterface - - PortChannel1 - FC00::1/126 - - - IPInterface - - PortChannel5 - FC00::9/126 - - - IPInterface - - PortChannel16 - FC00::11/126 - - - IPInterface - - PortChannel20 - FC00::19/126 - - - IPInterface - - Vlan2 - 172.0.0.1/26 - - - - - - - - - - - - DeviceInterfaceLink - true - 40000 - ARISTA01T1 - Ethernet1 - true - sonic - fortyGigE1/1/1 - - - DeviceInterfaceLink - true - 40000 - ARISTA01T1 - Ethernet2 - true - sonic - fortyGigE1/1/2 - - - DeviceInterfaceLink - true - 40000 - ARISTA02T1 - Ethernet1 - true - sonic - fortyGigE1/1/5 - - - DeviceInterfaceLink - true - 40000 - ARISTA02T1 - Ethernet2 - true - sonic - fortyGigE1/1/6 - - - DeviceInterfaceLink - true - 40000 - ARISTA03T1 - Ethernet1 - true - sonic - fortyGigE1/2/1 - - - DeviceInterfaceLink - true - 40000 - ARISTA03T1 - Ethernet2 - true - sonic - fortyGigE1/2/2 - - - DeviceInterfaceLink - true - 40000 - ARISTA04T1 - Ethernet1 - true - sonic - fortyGigE1/2/5 - - - DeviceInterfaceLink - true - 40000 - ARISTA04T1 - Ethernet2 - true - sonic - fortyGigE1/2/6 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/1/7 - true - server-01 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/1/8 - true - server-02 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/1/9 - true - server-03 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/1/10 - true - server-04 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/1/11 - true - server-05 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/1/12 - true - server-06 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/1/13 - true - server-07 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/1/14 - true - server-08 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/1/15 - true - server-09 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/1/16 - true - server-10 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/3/1 - true - server-11 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/3/5 - true - server-12 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/3/6 - true - server-13 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/3/7 - true - server-14 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/3/8 - true - server-15 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/3/9 - true - server-16 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/3/10 - true - server-17 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/3/11 - true - server-18 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/2/7 - true - server-19 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/2/8 - true - server-20 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/2/9 - true - server-21 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/2/10 - true - server-22 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/2/11 - true - server-23 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/2/12 - true - server-24 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/2/13 - true - server-25 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/2/14 - true - server-26 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/2/15 - true - server-27 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/2/16 - true - server-28 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/4/1 - true - server-29 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/4/5 - true - server-30 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/4/6 - true - server-31 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/4/7 - true - server-32 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/4/8 - true - server-33 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/4/9 - true - server-34 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/4/10 - true - server-35 - 0 - - - DeviceInterfaceLink - true - 40000 - sonic - fortyGigE1/4/11 - true - server-36 - 0 - - - - - sonic - Force10-S6100 - - - - - - - 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 - Force10-S6100 -
diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/default_sku b/device/dell/x86_64-dell_z9100_c2538-r0/default_sku new file mode 100644 index 000000000000..71a625493829 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/default_sku @@ -0,0 +1 @@ +Force10-Z9100 t1 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml b/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml deleted file mode 100644 index e1d42d180fe0..000000000000 --- a/device/dell/x86_64-dell_z9100_c2538-r0/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - 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 - - - - - - hundredGigE1/1 - 10.0.0.0/31 - - - - hundredGigE1/2 - 10.0.0.2/31 - - - - hundredGigE1/3 - 10.0.0.4/31 - - - - hundredGigE1/4 - 10.0.0.6/31 - - - - hundredGigE1/5 - 10.0.0.8/31 - - - - hundredGigE1/6 - 10.0.0.10/31 - - - - hundredGigE1/7 - 10.0.0.12/31 - - - - hundredGigE1/8 - 10.0.0.14/31 - - - - hundredGigE1/9 - 10.0.0.16/31 - - - - hundredGigE1/10 - 10.0.0.18/31 - - - - hundredGigE1/11 - 10.0.0.20/31 - - - - hundredGigE1/12 - 10.0.0.22/31 - - - - hundredGigE1/13 - 10.0.0.24/31 - - - - hundredGigE1/14 - 10.0.0.26/31 - - - - hundredGigE1/15 - 10.0.0.28/31 - - - - hundredGigE1/16 - 10.0.0.30/31 - - - - hundredGigE1/17 - 10.0.0.32/31 - - - - hundredGigE1/18 - 10.0.0.34/31 - - - - hundredGigE1/19 - 10.0.0.36/31 - - - - hundredGigE1/20 - 10.0.0.38/31 - - - - hundredGigE1/21 - 10.0.0.40/31 - - - - hundredGigE1/22 - 10.0.0.42/31 - - - - hundredGigE1/23 - 10.0.0.44/31 - - - - hundredGigE1/24 - 10.0.0.46/31 - - - - hundredGigE1/25 - 10.0.0.48/31 - - - - hundredGigE1/26 - 10.0.0.50/31 - - - - hundredGigE1/27 - 10.0.0.52/31 - - - - hundredGigE1/28 - 10.0.0.54/31 - - - - hundredGigE1/29 - 10.0.0.56/31 - - - - hundredGigE1/30 - 10.0.0.58/31 - - - - hundredGigE1/31 - 10.0.0.60/31 - - - - hundredGigE1/32 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - hundredGigE1/1 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/2 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/3 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/4 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/5 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/6 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/7 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/8 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/9 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/10 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/11 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/12 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/13 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/14 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/15 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/16 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/17 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/18 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/19 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/20 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/21 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/22 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/23 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/24 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/25 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/26 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/27 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/28 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/29 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/30 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/31 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/32 - ARISTA16T0 - Ethernet1 - - - - - sonic - Force10-Z9100 - - - - - - - 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 - Force10-Z9100 -
diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/default_sku b/device/dell/x86_64-dellemc_z9264f_c3538-r0/default_sku new file mode 100644 index 000000000000..206373c042de --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/default_sku @@ -0,0 +1 @@ +DellEMC-Z9264f t1 diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/minigraph.xml b/device/dell/x86_64-dellemc_z9264f_c3538-r0/minigraph.xml deleted file mode 100644 index ba95944260df..000000000000 --- a/device/dell/x86_64-dellemc_z9264f_c3538-r0/minigraph.xml +++ /dev/null @@ -1,1541 +0,0 @@ - - - - - - ARISTA01T0 - 10.0.0.33 - sonic - 10.0.0.32 - 1 - 10 - 3 - - - ARISTA01T0 - FC00::42 - sonic - FC00::41 - 1 - 10 - 3 - - - sonic - 10.0.0.0 - ARISTA01T2 - 10.0.0.1 - 1 - 10 - 3 - - - sonic - FC00::1 - ARISTA01T2 - FC00::2 - 1 - 10 - 3 - - - ARISTA02T0 - 10.0.0.35 - sonic - 10.0.0.34 - 1 - 10 - 3 - - - ARISTA02T0 - FC00::46 - sonic - FC00::45 - 1 - 10 - 3 - - - sonic - 10.0.0.2 - ARISTA02T2 - 10.0.0.3 - 1 - 10 - 3 - - - ARISTA04T1 - FC00::1A - sonic - FC00::19 - 1 - 180 - 60 - - - - - 65100 - sonic - - -
10.0.0.33
- - -
- -
10.0.0.1
- - -
- - BGPPeer -
10.0.0.5
- - -
- - BGPPeer -
10.0.0.9
- - -
- - BGPPeer -
10.0.0.13
- - -
- - BGPPeer -
FC00::2
- - -
- -
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 - - -
-
- - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - HostIP1 - Loopback0 - - FC00:1::32/128 - - FC00:1::32/128 - - - - - - - - sonic - - - - - IPInterface - - hundredGigE1/1 - 10.0.0.1/31 - - - - hundredGigE1/1 - FC00::1/1 - - - - hundredGigE1/2 - 10.0.0.3/31 - - - - hundredGigE1/1 - FC00::1/5 - - - - hundredGigE1/3 - 10.0.0.5/31 - - - - hundredGigE1/1 - FC00::1/9 - - - - hundredGigE1/4 - 10.0.0.7/31 - - - - hundredGigE1/1 - FC00::1/D - - - - hundredGigE1/5 - 10.0.0.9/31 - - - - hundredGigE1/1 - FC00::1/11 - - - - hundredGigE1/6 - 10.0.0.11/31 - - - - hundredGigE1/1 - FC00::1/15 - - - - hundredGigE1/7 - 10.0.0.13/31 - - - - hundredGigE1/1 - FC00::1/19 - - - - hundredGigE1/8 - 10.0.0.15/31 - - - - hundredGigE1/1 - FC00::1/1D - - - - hundredGigE1/9 - 10.0.0.17/31 - - - - hundredGigE1/1 - FC00::1/21 - - - - hundredGigE1/10 - 10.0.0.19/31 - - - - hundredGigE1/1 - FC00::1/25 - - - - hundredGigE1/11 - 10.0.0.21/31 - - - - hundredGigE1/1 - FC00::1/29 - - - - hundredGigE1/12 - 10.0.0.23/31 - - - - hundredGigE1/1 - FC00::1/2D - - - - hundredGigE1/13 - 10.0.0.25/31 - - - - hundredGigE1/1 - FC00::1/31 - - - - hundredGigE1/14 - 10.0.0.27/31 - - - - hundredGigE1/1 - FC00::1/35 - - - - hundredGigE1/15 - 10.0.0.29/31 - - - - hundredGigE1/1 - FC00::1/39 - - - - hundredGigE1/16 - 10.0.0.31/31 - - - - hundredGigE1/1 - FC00::1/3D - - - - hundredGigE1/17 - 10.0.0.33/31 - - - - hundredGigE1/1 - FC00::1/41 - - - - hundredGigE1/18 - 10.0.0.35/31 - - - - hundredGigE1/1 - FC00::1/45 - - - - hundredGigE1/19 - 10.0.0.37/31 - - - - hundredGigE1/1 - FC00::1/49 - - - - hundredGigE1/20 - 10.0.0.39/31 - - - - hundredGigE1/1 - FC00::1/4D - - - - hundredGigE1/21 - 10.0.0.41/31 - - - - hundredGigE1/1 - FC00::1/51 - - - - hundredGigE1/22 - 10.0.0.43/31 - - - - hundredGigE1/1 - FC00::1/55 - - - - hundredGigE1/23 - 10.0.0.45/31 - - - - hundredGigE1/1 - FC00::1/59 - - - - hundredGigE1/24 - 10.0.0.47/31 - - - - hundredGigE1/1 - FC00::1/5D - - - - hundredGigE1/25 - 10.0.0.49/31 - - - - hundredGigE1/1 - FC00::1/61 - - - - hundredGigE1/26 - 10.0.0.51/31 - - - - hundredGigE1/1 - FC00::1/65 - - - - hundredGigE1/27 - 10.0.0.53/31 - - - - hundredGigE1/1 - FC00::1/69 - - - - hundredGigE1/28 - 10.0.0.55/31 - - - - hundredGigE1/1 - FC00::1/6D - - - - hundredGigE1/29 - 10.0.0.57/31 - - - - hundredGigE1/1 - FC00::1/71 - - - - hundredGigE1/30 - 10.0.0.59/31 - - - - hundredGigE1/1 - FC00::1/75 - - - IPInterface - - hundredGigE1/31 - 10.0.0.61/31 - - - - hundredGigE1/1 - FC00::1/79 - - - IPInterface - - hundredGigE1/32 - 10.0.0.63/31 - - - - hundredGigE1/1 - FC00::1/7D - - - IPInterface - - hundredGigE1/33 - 10.0.0.65/31 - - - - hundredGigE1/1 - FC00::1/81 - - - - hundredGigE1/34 - 10.0.0.67/31 - - - - hundredGigE1/1 - FC00::1/85 - - - IPInterface - - hundredGigE1/35 - 10.0.0.69/31 - - - - hundredGigE1/1 - FC00::1/89 - - - IPInterface - - hundredGigE1/36 - 10.0.0.71/31 - - - - hundredGigE1/1 - FC00::1/8D - - - IPInterface - - hundredGigE1/37 - 10.0.0.73/31 - - - - hundredGigE1/1 - FC00::1/91 - - - - hundredGigE1/38 - 10.0.0.75/31 - - - - hundredGigE1/1 - FC00::1/95 - - - - hundredGigE1/39 - 10.0.0.77/31 - - - - hundredGigE1/1 - FC00::1/99 - - - - hundredGigE1/40 - 10.0.0.79/31 - - - - hundredGigE1/1 - FC00::1/9D - - - - hundredGigE1/41 - 10.0.0.81/31 - - - - hundredGigE1/1 - FC00::1/A1 - - - - hundredGigE1/42 - 10.0.0.83/31 - - - - hundredGigE1/1 - FC00::1/A5 - - - - hundredGigE1/43 - 10.0.0.85/31 - - - - hundredGigE1/1 - FC00::1/A9 - - - - hundredGigE1/44 - 10.0.0.87/31 - - - - hundredGigE1/1 - FC00::1/AD - - - - hundredGigE1/45 - 10.0.0.89/31 - - - - hundredGigE1/1 - FC00::1/B1 - - - - hundredGigE1/46 - 10.0.0.91/31 - - - - hundredGigE1/1 - FC00::1/B5 - - - - hundredGigE1/47 - 10.0.0.93/31 - - - - hundredGigE1/1 - FC00::1/B9 - - - - hundredGigE1/48 - 10.0.0.95/31 - - - - hundredGigE1/1 - FC00::1/BD - - - - hundredGigE1/49 - 10.0.0.97/31 - - - - hundredGigE1/1 - FC00::1/C1 - - - - hundredGigE1/50 - 10.0.0.99/31 - - - - hundredGigE1/1 - FC00::1/C5 - - - - hundredGigE1/51 - 10.0.0.101/31 - - - - hundredGigE1/1 - FC00::1/C9 - - - - hundredGigE1/52 - 10.0.0.103/31 - - - - hundredGigE1/1 - FC00::1/CD - - - - hundredGigE1/53 - 10.0.0.105/31 - - - - hundredGigE1/1 - FC00::1/D1 - - - - hundredGigE1/54 - 10.0.0.107/31 - - - - hundredGigE1/1 - FC00::1/D5 - - - - hundredGigE1/55 - 10.0.0.109/31 - - - - hundredGigE1/1 - FC00::1/D9 - - - - hundredGigE1/56 - 10.0.0.111/31 - - - - hundredGigE1/1 - FC00::1/DD - - - - hundredGigE1/57 - 10.0.0.113/31 - - - - hundredGigE1/1 - FC00::1/E1 - - - - hundredGigE1/58 - 10.0.0.115/31 - - - - hundredGigE1/1 - FC00::1/E5 - - - - hundredGigE1/59 - 10.0.0.117/31 - - - - hundredGigE1/1 - FC00::1/E9 - - - - hundredGigE1/60 - 10.0.0.119/31 - - - - hundredGigE1/1 - FC00::1/ED - - - - hundredGigE1/61 - 10.0.0.121/31 - - - - hundredGigE1/1 - FC00::1/F1 - - - - hundredGigE1/62 - 10.0.0.123/31 - - - - hundredGigE1/1 - FC00::1/F5 - - - - hundredGigE1/63 - 10.0.0.125/31 - - - - hundredGigE1/1 - FC00::1/F9 - - - - hundredGigE1/64 - 10.0.0.127/31 - - - - hundredGigE1/1 - FC00::1/FD - - - - - - - - - - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet1 - true - sonic - hundredGigE1/1 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet2 - true - sonic - hundredGigE1/2 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet3 - true - sonic - hundredGigE1/3 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet4 - true - sonic - hundredGigE1/4 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet5 - true - sonic - hundredGigE1/5 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet6 - true - sonic - hundredGigE1/6 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet7 - true - sonic - hundredGigE1/7 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet8 - true - sonic - hundredGigE1/8 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet9 - true - sonic - hundredGigE1/9 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet10 - true - sonic - hundredGigE1/10 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet11 - true - sonic - hundredGigE1/11 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet12 - true - sonic - hundredGigE1/12 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet13 - true - sonic - hundredGigE1/13 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet14 - true - sonic - hundredGigE1/14 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet15 - true - sonic - hundredGigE1/15 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet16 - true - sonic - hundredGigE1/16 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet17 - true - sonic - hundredGigE1/17 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet18 - true - sonic - hundredGigE1/18 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet19 - true - sonic - hundredGigE1/19 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet20 - true - sonic - hundredGigE1/20 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet21 - true - sonic - hundredGigE1/21 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet22 - true - sonic - hundredGigE1/22 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet23 - true - sonic - hundredGigE1/23 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet24 - true - sonic - hundredGigE1/24 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet25 - true - sonic - hundredGigE1/25 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet26 - true - sonic - hundredGigE1/26 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet27 - true - sonic - hundredGigE1/27 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet28 - true - sonic - hundredGigE1/28 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet29 - true - sonic - hundredGigE1/29 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet30 - true - sonic - hundredGigE1/30 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet31 - true - sonic - hundredGigE1/31 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet32 - true - sonic - hundredGigE1/32 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet33 - true - sonic - hundredGigE1/33 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet34 - true - sonic - hundredGigE1/34 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet35 - true - sonic - hundredGigE1/35 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet36 - true - sonic - hundredGigE1/36 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet37 - true - sonic - hundredGigE1/37 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet38 - true - sonic - hundredGigE1/38 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet39 - true - sonic - hundredGigE1/39 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet40 - true - sonic - hundredGigE1/40 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet41 - true - sonic - hundredGigE1/41 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet42 - true - sonic - hundredGigE1/42 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet43 - true - sonic - hundredGigE1/43 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet44 - true - sonic - hundredGigE1/44 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet45 - true - sonic - hundredGigE1/45 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet46 - true - sonic - hundredGigE1/46 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet47 - true - sonic - hundredGigE1/47 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet48 - true - sonic - hundredGigE1/48 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet49 - true - sonic - hundredGigE1/49 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet50 - true - sonic - hundredGigE1/50 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet51 - true - sonic - hundredGigE1/51 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet52 - true - sonic - hundredGigE1/52 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet53 - true - sonic - hundredGigE1/53 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet54 - true - sonic - hundredGigE1/54 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet55 - true - sonic - hundredGigE1/55 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet56 - true - sonic - hundredGigE1/56 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet57 - true - sonic - hundredGigE1/57 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet58 - true - sonic - hundredGigE1/58 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet59 - true - sonic - hundredGigE1/59 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet60 - true - sonic - hundredGigE1/60 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet61 - true - sonic - hundredGigE1/61 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet62 - true - sonic - hundredGigE1/62 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet63 - true - sonic - hundredGigE1/63 - - - DeviceInterfaceLink - true - 100000 - ARISTA01T1 - Ethernet64 - true - sonic - hundredGigE1/64 - - - - - sonic - DellEMC-Z9264f - - 10.11.150.26 - - - - - - - - sonic - - - DhcpResources - - - - - SnmpResources - - 10.0.0.9 - - - SyslogResources - - 10.0.0.5;10.0.0.6 - - - ErspanDestinationIpv4 - - 10.0.0.7 - - - - - - - sonic - DellEMC-Z9264f -
diff --git a/device/delta/x86_64-delta_ag5648-r0/default_sku b/device/delta/x86_64-delta_ag5648-r0/default_sku new file mode 100644 index 000000000000..c4ce98e35557 --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/default_sku @@ -0,0 +1 @@ +Delta-ag5648 t1 diff --git a/device/delta/x86_64-delta_ag5648-r0/minigraph.xml b/device/delta/x86_64-delta_ag5648-r0/minigraph.xml deleted file mode 100644 index 37c952f49c32..000000000000 --- a/device/delta/x86_64-delta_ag5648-r0/minigraph.xml +++ /dev/null @@ -1,1184 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - Ethernet128 - 10.0.0.64/31 - - - - Ethernet132 - 10.0.0.66/31 - - - - Ethernet136 - 10.0.0.68/31 - - - - Ethernet140 - 10.0.0.70/31 - - - - Ethernet144 - 10.0.0.72/31 - - - - Ethernet148 - 10.0.0.74/31 - - - - Ethernet152 - 10.0.0.76/31 - - - - Ethernet156 - 10.0.0.78/31 - - - - Ethernet160 - 10.0.0.80/31 - - - - Ethernet164 - 10.0.0.82/31 - - - - Ethernet168 - 10.0.0.84/31 - - - - Ethernet172 - 10.0.0.86/31 - - - - Ethernet176 - 10.0.0.88/31 - - - - Ethernet180 - 10.0.0.90/31 - - - - Ethernet184 - 10.0.0.92/31 - - - - Ethernet188 - 10.0.0.94/31 - - - - Ethernet192 - 10.0.0.96/31 - - - - Ethernet196 - 10.0.0.98/31 - - - - Ethernet200 - 10.0.0.100/31 - - - - Ethernet204 - 10.0.0.102/31 - - - - Ethernet208 - 10.0.0.104/31 - - - - Ethernet212 - 10.0.0.106/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet8 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet12 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet16 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet20 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet24 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet4 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet4 - - - - - sonic - Delta-ag5648 - - - - - - - sonic - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - sonic - Delta-ag5648 -
diff --git a/device/delta/x86_64-delta_ag9032v1-r0/default_sku b/device/delta/x86_64-delta_ag9032v1-r0/default_sku new file mode 100644 index 000000000000..f175f53b323e --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/default_sku @@ -0,0 +1 @@ +Delta-ag9032v1 t1 diff --git a/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml b/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml deleted file mode 100644 index 129103ce6bfe..000000000000 --- a/device/delta/x86_64-delta_ag9032v1-r0/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - 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 - - - - - - hundredGigE1/1 - 10.0.0.0/31 - - - - hundredGigE1/2 - 10.0.0.2/31 - - - - hundredGigE1/3 - 10.0.0.4/31 - - - - hundredGigE1/4 - 10.0.0.6/31 - - - - hundredGigE1/5 - 10.0.0.8/31 - - - - hundredGigE1/6 - 10.0.0.10/31 - - - - hundredGigE1/7 - 10.0.0.12/31 - - - - hundredGigE1/8 - 10.0.0.14/31 - - - - hundredGigE1/9 - 10.0.0.16/31 - - - - hundredGigE1/10 - 10.0.0.18/31 - - - - hundredGigE1/11 - 10.0.0.20/31 - - - - hundredGigE1/12 - 10.0.0.22/31 - - - - hundredGigE1/13 - 10.0.0.24/31 - - - - hundredGigE1/14 - 10.0.0.26/31 - - - - hundredGigE1/15 - 10.0.0.28/31 - - - - hundredGigE1/16 - 10.0.0.30/31 - - - - hundredGigE1/17 - 10.0.0.32/31 - - - - hundredGigE1/18 - 10.0.0.34/31 - - - - hundredGigE1/19 - 10.0.0.36/31 - - - - hundredGigE1/20 - 10.0.0.38/31 - - - - hundredGigE1/21 - 10.0.0.40/31 - - - - hundredGigE1/22 - 10.0.0.42/31 - - - - hundredGigE1/23 - 10.0.0.44/31 - - - - hundredGigE1/24 - 10.0.0.46/31 - - - - hundredGigE1/25 - 10.0.0.48/31 - - - - hundredGigE1/26 - 10.0.0.50/31 - - - - hundredGigE1/27 - 10.0.0.52/31 - - - - hundredGigE1/28 - 10.0.0.54/31 - - - - hundredGigE1/29 - 10.0.0.56/31 - - - - hundredGigE1/30 - 10.0.0.58/31 - - - - hundredGigE1/31 - 10.0.0.60/31 - - - - hundredGigE1/32 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - hundredGigE1/1 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/2 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/3 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/4 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/5 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/6 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/7 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/8 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/9 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/10 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/11 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/12 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/13 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/14 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/15 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/16 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/17 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/18 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/19 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/20 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/21 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/22 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/23 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/24 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/25 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/26 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/27 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/28 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/29 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/30 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/31 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - hundredGigE1/32 - ARISTA16T0 - Ethernet1 - - - - - sonic - Delta-ag9032v1 - - - - - - - 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 - Delta-ag9032v1 -
diff --git a/device/delta/x86_64-delta_ag9064-r0/default_sku b/device/delta/x86_64-delta_ag9064-r0/default_sku new file mode 100644 index 000000000000..5de7fcd3733a --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/default_sku @@ -0,0 +1 @@ +Delta-ag9064 t1 diff --git a/device/delta/x86_64-delta_ag9064-r0/minigraph.xml b/device/delta/x86_64-delta_ag9064-r0/minigraph.xml deleted file mode 100644 index 7a2ece422288..000000000000 --- a/device/delta/x86_64-delta_ag9064-r0/minigraph.xml +++ /dev/null @@ -1,848 +0,0 @@ - - - - - - - - - - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - - - - - - sonic - - - - - - Ethernet1/1 - 10.0.0.0/31 - - - - Ethernet2/1 - 10.0.0.2/31 - - - - Ethernet3/1 - 10.0.0.4/31 - - - - Ethernet4/1 - 10.0.0.6/31 - - - - Ethernet5/1 - 10.0.0.8/31 - - - - Ethernet6/1 - 10.0.0.10/31 - - - - Ethernet7/1 - 10.0.0.12/31 - - - - Ethernet8/1 - 10.0.0.14/31 - - - - Ethernet9/1 - 10.0.0.16/31 - - - - Ethernet10/1 - 10.0.0.18/31 - - - - Ethernet11/1 - 10.0.0.20/31 - - - - Ethernet12/1 - 10.0.0.22/31 - - - - Ethernet13/1 - 10.0.0.24/31 - - - - Ethernet14/1 - 10.0.0.26/31 - - - - Ethernet15/1 - 10.0.0.28/31 - - - - Ethernet16/1 - 10.0.0.30/31 - - - - Ethernet17/1 - 10.0.0.32/31 - - - - Ethernet18/1 - 10.0.0.34/31 - - - - Ethernet19/1 - 10.0.0.36/31 - - - - Ethernet20/1 - 10.0.0.38/31 - - - - Ethernet21/1 - 10.0.0.40/31 - - - - Ethernet22/1 - 10.0.0.42/31 - - - - Ethernet23/1 - 10.0.0.44/31 - - - - Ethernet24/1 - 10.0.0.46/31 - - - - Ethernet25/1 - 10.0.0.48/31 - - - - Ethernet26/1 - 10.0.0.50/31 - - - - Ethernet27/1 - 10.0.0.52/31 - - - - Ethernet28/1 - 10.0.0.54/31 - - - - Ethernet29/1 - 10.0.0.56/31 - - - - Ethernet30/1 - 10.0.0.58/31 - - - - Ethernet31/1 - 10.0.0.60/31 - - - - Ethernet32/1 - 10.0.0.62/31 - - - - Ethernet33/1 - 10.0.0.64/31 - - - - Ethernet34/1 - 10.0.0.66/31 - - - - Ethernet35/1 - 10.0.0.68/31 - - - - Ethernet36/1 - 10.0.0.70/31 - - - - Ethernet37/1 - 10.0.0.72/31 - - - - Ethernet38/1 - 10.0.0.74/31 - - - - Ethernet39/1 - 10.0.0.76/31 - - - - Ethernet40/1 - 10.0.0.78/31 - - - - Ethernet41/1 - 10.0.0.80/31 - - - - Ethernet42/1 - 10.0.0.82/31 - - - - Ethernet43/1 - 10.0.0.84/31 - - - - Ethernet44/1 - 10.0.0.86/31 - - - - Ethernet45/1 - 10.0.0.88/31 - - - - Ethernet46/1 - 10.0.0.90/31 - - - - Ethernet47/1 - 10.0.0.92/31 - - - - Ethernet48/1 - 10.0.0.94/31 - - - - Ethernet49/1 - 10.0.0.96/31 - - - - Ethernet50/1 - 10.0.0.98/31 - - - - Ethernet51/1 - 10.0.0.100/31 - - - - Ethernet52/1 - 10.0.0.102/31 - - - - Ethernet53/1 - 10.0.0.104/31 - - - - Ethernet54/1 - 10.0.0.106/31 - - - - Ethernet55/1 - 10.0.0.108/31 - - - - Ethernet56/1 - 10.0.0.110/31 - - - - Ethernet57/1 - 10.0.0.112/31 - - - - Ethernet58/1 - 10.0.0.114/31 - - - - Ethernet59/1 - 10.0.0.116/31 - - - - Ethernet60/1 - 10.0.0.118/31 - - - - Ethernet61/1 - 10.0.0.120/31 - - - - Ethernet62/1 - 10.0.0.122/31 - - - - Ethernet63/1 - 10.0.0.124/31 - - - - Ethernet64/1 - 10.0.0.126/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic-target - Ethernet1/1 - sonic - Ethernet1/1 - - - DeviceInterfaceLink - sonic-target - Ethernet2/1 - sonic - Ethernet2/1 - - - DeviceInterfaceLink - sonic-target - Ethernet3/1 - sonic - Ethernet3/1 - - - DeviceInterfaceLink - sonic-target - Ethernet4/1 - sonic - Ethernet4/1 - - - DeviceInterfaceLink - sonic-target - Ethernet5/1 - sonic - Ethernet5/1 - - - DeviceInterfaceLink - sonic-target - Ethernet6/1 - sonic - Ethernet6/1 - - - DeviceInterfaceLink - sonic-target - Ethernet7/1 - sonic - Ethernet7/1 - - - DeviceInterfaceLink - sonic-target - Ethernet8/1 - sonic - Ethernet8/1 - - - DeviceInterfaceLink - sonic-target - Ethernet9/1 - sonic - Ethernet9/1 - - - DeviceInterfaceLink - sonic-target - Ethernet10/1 - sonic - Ethernet10/1 - - - DeviceInterfaceLink - sonic-target - Ethernet11/1 - sonic - Ethernet11/1 - - - DeviceInterfaceLink - sonic-target - Ethernet12/1 - sonic - Ethernet12/1 - - - DeviceInterfaceLink - sonic-target - Ethernet13/1 - sonic - Ethernet13/1 - - - DeviceInterfaceLink - sonic-target - Ethernet14/1 - sonic - Ethernet14/1 - - - DeviceInterfaceLink - sonic-target - Ethernet15/1 - sonic - Ethernet15/1 - - - DeviceInterfaceLink - sonic-target - Ethernet16/1 - sonic - Ethernet16/1 - - - DeviceInterfaceLink - sonic-target - Ethernet17/1 - sonic - Ethernet17/1 - - - DeviceInterfaceLink - sonic-target - Ethernet18/1 - sonic - Ethernet18/1 - - - DeviceInterfaceLink - sonic-target - Ethernet19/1 - sonic - Ethernet19/1 - - - DeviceInterfaceLink - sonic-target - Ethernet20/1 - sonic - Ethernet20/1 - - - DeviceInterfaceLink - sonic-target - Ethernet21/1 - sonic - Ethernet21/1 - - - DeviceInterfaceLink - sonic-target - Ethernet22/1 - sonic - Ethernet22/1 - - - DeviceInterfaceLink - sonic-target - Ethernet23/1 - sonic - Ethernet23/1 - - - DeviceInterfaceLink - sonic-target - Ethernet24/1 - sonic - Ethernet24/1 - - - DeviceInterfaceLink - sonic-target - Ethernet25/1 - sonic - Ethernet25/1 - - - DeviceInterfaceLink - sonic-target - Ethernet26/1 - sonic - Ethernet26/1 - - - DeviceInterfaceLink - sonic-target - Ethernet27/1 - sonic - Ethernet27/1 - - - DeviceInterfaceLink - sonic-target - Ethernet28/1 - sonic - Ethernet28/1 - - - DeviceInterfaceLink - sonic-target - Ethernet29/1 - sonic - Ethernet29/1 - - - DeviceInterfaceLink - sonic-target - Ethernet30/1 - sonic - Ethernet30/1 - - - DeviceInterfaceLink - sonic-target - Ethernet31/1 - sonic - Ethernet31/1 - - - DeviceInterfaceLink - sonic-target - Ethernet32/1 - sonic - Ethernet32/1 - - - DeviceInterfaceLink - sonic-target - Ethernet33/1 - sonic - Ethernet33/1 - - - DeviceInterfaceLink - sonic-target - Ethernet34/1 - sonic - Ethernet34/1 - - - DeviceInterfaceLink - sonic-target - Ethernet35/1 - sonic - Ethernet35/1 - - - DeviceInterfaceLink - sonic-target - Ethernet36/1 - sonic - Ethernet36/1 - - - DeviceInterfaceLink - sonic-target - Ethernet37/1 - sonic - Ethernet37/1 - - - DeviceInterfaceLink - sonic-target - Ethernet38/1 - sonic - Ethernet38/1 - - - DeviceInterfaceLink - sonic-target - Ethernet39/1 - sonic - Ethernet39/1 - - - DeviceInterfaceLink - sonic-target - Ethernet40/1 - sonic - Ethernet40/1 - - - DeviceInterfaceLink - sonic-target - Ethernet41/1 - sonic - Ethernet41/1 - - - DeviceInterfaceLink - sonic-target - Ethernet42/1 - sonic - Ethernet42/1 - - - DeviceInterfaceLink - sonic-target - Ethernet43/1 - sonic - Ethernet43/1 - - - DeviceInterfaceLink - sonic-target - Ethernet44/1 - sonic - Ethernet44/1 - - - DeviceInterfaceLink - sonic-target - Ethernet45/1 - sonic - Ethernet45/1 - - - DeviceInterfaceLink - sonic-target - Ethernet46/1 - sonic - Ethernet46/1 - - - DeviceInterfaceLink - sonic-target - Ethernet47/1 - sonic - Ethernet47/1 - - - DeviceInterfaceLink - sonic-target - Ethernet48/1 - sonic - Ethernet48/1 - - - DeviceInterfaceLink - sonic-target - Ethernet49/1 - sonic - Ethernet49/1 - - - DeviceInterfaceLink - sonic-target - Ethernet50/1 - sonic - Ethernet50/1 - - - DeviceInterfaceLink - sonic-target - Ethernet51/1 - sonic - Ethernet51/1 - - - DeviceInterfaceLink - sonic-target - Ethernet52/1 - sonic - Ethernet52/1 - - - DeviceInterfaceLink - sonic-target - Ethernet53/1 - sonic - Ethernet53/1 - - - DeviceInterfaceLink - sonic-target - Ethernet54/1 - sonic - Ethernet54/1 - - - DeviceInterfaceLink - sonic-target - Ethernet55/1 - sonic - Ethernet55/1 - - - DeviceInterfaceLink - sonic-target - Ethernet56/1 - sonic - Ethernet56/1 - - - DeviceInterfaceLink - sonic-target - Ethernet57/1 - sonic - Ethernet57/1 - - - DeviceInterfaceLink - sonic-target - Ethernet58/1 - sonic - Ethernet58/1 - - - DeviceInterfaceLink - sonic-target - Ethernet59/1 - sonic - Ethernet59/1 - - - DeviceInterfaceLink - sonic-target - Ethernet60/1 - sonic - Ethernet60/1 - - - DeviceInterfaceLink - sonic-target - Ethernet61/1 - sonic - Ethernet61/1 - - - DeviceInterfaceLink - sonic-target - Ethernet62/1 - sonic - Ethernet62/1 - - - DeviceInterfaceLink - sonic-target - Ethernet63/1 - sonic - Ethernet63/1 - - - DeviceInterfaceLink - sonic-target - Ethernet64/1 - sonic - Ethernet64/1 - - - - - sonic - Delta-ag9064 - - - - - - - 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 - Delta-ag9064 - diff --git a/device/delta/x86_64-delta_et-6248brb-r0/default_sku b/device/delta/x86_64-delta_et-6248brb-r0/default_sku new file mode 100644 index 000000000000..ce1cdf6e4c69 --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/default_sku @@ -0,0 +1 @@ +Delta-et-6248brb t1 diff --git a/device/delta/x86_64-delta_et-6248brb-r0/minigraph.xml b/device/delta/x86_64-delta_et-6248brb-r0/minigraph.xml deleted file mode 100644 index 98318a862591..000000000000 --- a/device/delta/x86_64-delta_et-6248brb-r0/minigraph.xml +++ /dev/null @@ -1,766 +0,0 @@ - - - - - - ARISTA01T1 - 10.0.0.1 - sonic - 10.0.0.0 - 1 - 180 - 60 - - - ARISTA02T1 - 10.0.0.5 - sonic - 10.0.0.4 - 1 - 180 - 60 - - - ARISTA03T1 - 10.0.0.9 - sonic - 10.0.0.8 - 1 - 180 - 60 - - - ARISTA04T1 - 10.0.0.13 - sonic - 10.0.0.12 - 1 - 180 - 60 - - - ARISTA01T1 - FC00::2 - sonic - FC00::1 - 1 - 180 - 60 - - - ARISTA02T1 - FC00::A - sonic - FC00::9 - 1 - 180 - 60 - - - ARISTA03T1 - FC00::12 - sonic - FC00::11 - 1 - 180 - 60 - - - ARISTA04T1 - FC00::1A - sonic - FC00::19 - 1 - 180 - 60 - - - - - 64601 - sonic - - - BGPPeer -
10.0.0.1
- - - -
- - BGPPeer -
10.0.0.5
- - - -
- - BGPPeer -
10.0.0.9
- - - -
- - BGPPeer -
10.0.0.13
- - - -
- - BGPPeer -
FC00::2
- - - -
- - BGPPeer -
FC00::A
- - - -
- - BGPPeer -
FC00::12
- - - -
- - BGPPeer -
FC00::1A
- - - -
-
- -
- - 64802 - ARISTA01T1 - - - - 64802 - ARISTA02T1 - - - - 64802 - ARISTA03T1 - - - - 64802 - ARISTA04T1 - - -
-
- - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - HostIP1 - Loopback0 - - FC00:1::32/128 - - FC00:1::32/128 - - - - - HostIP - eth0 - - 10.251.0.243/23 - - 10.251.0.243/23 - - - - - - sonic - - - - VlanInterface - Vlan2 - Ethernet0;Ethernet1;Ethernet2;Ethernet3;Ethernet4;Ethernet5;Ethernet6;Ethernet7;Ethernet8;Ethernet9;Ethernet10;Ethernet11;Ethernet12;Ethernet13;Ethernet14;Ethernet15;Ethernet16;Ethernet17;Ethernet18;Ethernet19;Ethernet20;Ethernet21;Ethernet22;Ethernet23;Ethernet24;Ethernet25;Ethernet26;Ethernet27;Ethernet28;Ethernet29;Ethernet30;Ethernet31;Ethernet32;Ethernet33;Ethernet34;Ethernet35;Ethernet36;Ethernet37;Ethernet38;Ethernet39;Ethernet40;Ethernet41;Ethernet42;Ethernet43;Ethernet44;Ethernet45;Ethernet46;Ethernet47 - False - 0.0.0.0/0 - - 2 - 2 - 172.0.0.0/26 - - - - - IPInterface - - Ethernet48 - 10.0.0.0/31 - - - IPInterface - - Ethernet49 - 10.0.0.4/31 - - - IPInterface - - Ethernet48 - FC00::1/126 - - - IPInterface - - Ethernet49 - FC00::9/126 - - - IPInterface - - Vlan2 - 172.0.0.1/26 - - - - - - - - - - - - DeviceInterfaceLink - true - 10000 - ARISTA01T1 - Ethernet1 - true - sonic - Ethernet48 - - - DeviceInterfaceLink - true - 10000 - ARISTA02T1 - Ethernet1 - true - sonic - Ethernet49 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet0 - true - server-01 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet1 - true - server-02 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet2 - true - server-03 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet3 - true - server-04 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet4 - true - server-05 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet5 - true - server-06 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet6 - true - server-07 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet7 - true - server-08 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet8 - true - server-09 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet9 - true - server-10 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet10 - true - server-11 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet11 - true - server-12 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet12 - true - server-13 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet13 - true - server-14 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet14 - true - server-15 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet15 - true - server-16 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet16 - true - server-17 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet17 - true - server-18 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet18 - true - server-19 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet19 - true - server-20 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet20 - true - server-21 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet21 - true - server-22 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet22 - true - server-23 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet23 - true - server-24 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet24 - true - server-25 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet25 - true - server-26 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet26 - true - server-27 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet27 - true - server-28 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet28 - true - server-29 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet29 - true - server-30 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet30 - true - server-31 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet31 - true - server-32 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet32 - true - server-33 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet33 - true - server-34 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet34 - true - server-35 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet35 - true - server-36 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet36 - true - server-37 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet37 - true - server-38 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet38 - true - server-39 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet39 - true - server-40 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet40 - true - server-41 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet41 - true - server-42 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet42 - true - server-43 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet43 - true - server-44 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet44 - true - server-45 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet45 - true - server-46 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet46 - true - server-47 - 0 - - - DeviceInterfaceLink - true - 1000 - sonic - Ethernet47 - true - server-48 - 0 - - - - - sonic - Delta-et-6248brb - - 10.251.0.243 - - - - - sonic - Delta-et-6248brb -
diff --git a/device/embedway/x86_64-ew_es6220_x48q2h4-r0/default_sku b/device/embedway/x86_64-ew_es6220_x48q2h4-r0/default_sku new file mode 100644 index 000000000000..0f663505d7a4 --- /dev/null +++ b/device/embedway/x86_64-ew_es6220_x48q2h4-r0/default_sku @@ -0,0 +1 @@ +OSW1800-48x6q t1 diff --git a/device/facebook/x86_64-facebook_wedge100-r0/default_sku b/device/facebook/x86_64-facebook_wedge100-r0/default_sku new file mode 100644 index 000000000000..e8fafcb709da --- /dev/null +++ b/device/facebook/x86_64-facebook_wedge100-r0/default_sku @@ -0,0 +1 @@ +Facebook-W100-C32 t1 diff --git a/device/facebook/x86_64-facebook_wedge100-r0/minigraph.xml b/device/facebook/x86_64-facebook_wedge100-r0/minigraph.xml deleted file mode 100644 index 2e9c121e0b36..000000000000 --- a/device/facebook/x86_64-facebook_wedge100-r0/minigraph.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - OCPSCH0104001MS - 10.10.1.26 - SONiC-Facebook-Wedge100 - 10.10.1.25 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.26 - SONiC-Facebook-Wedge100 - 10.10.2.25 - 1 - 10 - 3 - - - - - 64536 - SONiC-Facebook-Wedge100 - - -
10.10.1.26
- - -
- -
10.10.2.26
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.9/32 - - 100.0.0.9/32 - - - - - - - - SONiC-Facebook-Wedge100 - - - - - - Ethernet0 - 10.10.1.25/30 - - - - Ethernet4 - 10.10.2.25/30 - - - - - - - - - - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - SONiC-Facebook-Wedge100 - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - SONiC-Facebook-Wedge100 - Ethernet4 - - - - - SONiC-Facebook-Wedge100 - Facebook-W100-C32 - - - - - - - SONiC-Facebook-Wedge100 - - - 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-Facebook-Wedge100 - Facebook-W100-C32 -
diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/default_sku b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/default_sku new file mode 100644 index 000000000000..fe68cd87d182 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/default_sku @@ -0,0 +1 @@ +INGRASYS-S8810-32Q t1 diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml deleted file mode 100644 index 991591585cca..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/minigraph.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - OCPSCH0104001MS - 10.10.1.30 - OCPSCH01040HHLF - 10.10.1.29 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.30 - OCPSCH01040HHLF - 10.10.2.29 - 1 - 10 - 3 - - - - - 64536 - OCPSCH01040HHLF - - -
10.10.1.30
- - -
- -
10.10.2.30
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.10/32 - - 100.0.0.10/32 - - - - - - - - OCPSCH01040HHLF - - - - - - Ethernet48 - 10.10.1.29/30 - - - - Ethernet52 - 10.10.2.29/30 - - - - - - - - - - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet48 - OCPSCH01040HHLF - Ethernet48 - - - 40000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet0 - OCPSCH01040HHLF - Ethernet52 - - - - - OCPSCH01040HHLF - INGRASYS-S8810-32Q - - - - OCPSCH01040HHLF - INGRASYS-S8810-32Q -
diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/default_sku b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/default_sku new file mode 100644 index 000000000000..ba80569555d1 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/default_sku @@ -0,0 +1 @@ +INGRASYS-S8900-54XC t1 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml deleted file mode 100644 index 98c87eb8af0e..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/minigraph.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - OCPSCH0104001MS - 10.10.1.30 - OCPSCH01040HHLF - 10.10.1.29 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.30 - OCPSCH01040HHLF - 10.10.2.29 - 1 - 10 - 3 - - - - - 64536 - OCPSCH01040HHLF - - -
10.10.1.30
- - -
- -
10.10.2.30
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.10/32 - - 100.0.0.10/32 - - - - - - - - OCPSCH01040HHLF - - - - - - Ethernet48 - 10.10.1.29/30 - - - - Ethernet52 - 10.10.2.29/30 - - - - - - - - - - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet48 - OCPSCH01040HHLF - Ethernet48 - - - 40000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet0 - OCPSCH01040HHLF - Ethernet52 - - - - - OCPSCH01040HHLF - INGRASYS-S8900-54XC - - - - OCPSCH01040HHLF - INGRASYS-S8900-54XC -
diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/default_sku b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/default_sku new file mode 100644 index 000000000000..3002ec5856f3 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/default_sku @@ -0,0 +1 @@ +INGRASYS-S8900-64XC t1 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml deleted file mode 100644 index 8a7d765cefc1..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/minigraph.xml +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - BGPSession - OCPSCH0104001MS - 10.10.1.2 - OCPSCH01040AALF - 10.10.1.1 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.6 - OCPSCH01040BBLF - 10.10.1.5 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.10 - OCPSCH01040CCLF - 10.10.1.9 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.14 - OCPSCH01040DDLF - 10.10.1.13 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.18 - OCPSCH01040EELF - 10.10.1.17 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.22 - OCPSCH01040FFLF - 10.10.1.21 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.26 - OCPSCH01040GGLF - 10.10.1.25 - 1 - 10 - 3 - - - BGPSession - OCPSCH0104001MS - 10.10.1.30 - OCPSCH01040HHLF - 10.10.1.29 - 1 - 10 - 3 - - - - - 64542 - OCPSCH0104001MS - - - BGPPeer -
10.10.1.2
- - -
- - BGPPeer -
10.10.1.6
- - -
- - BGPPeer -
10.10.1.10
- - -
- - BGPPeer -
10.10.1.14
- - -
- - BGPPeer -
10.10.1.18
- - -
- - BGPPeer -
10.10.1.22
- - -
- - BGPPeer -
10.10.1.26
- - -
- - BGPPeer -
10.10.1.30
- - -
-
- -
- - 64536 - OCPSCH01040AALF - - - - 64536 - OCPSCH01040BBLF - - - - 64536 - OCPSCH01040CCLF - - - - 64536 - OCPSCH01040DDLF - - - - 64536 - OCPSCH01040EELF - - - - 64536 - OCPSCH01040FFLF - - - - 64536 - OCPSCH01040GGLF - - - - 64536 - OCPSCH01040HHLF - - -
-
- - - - - - LoopbackInterface - HostIP - Loopback0 - - 100.0.0.1/32 - - 100.0.0.1/32 - - - - - - - - OCPSCH0104001MS - - - - VlanInterface - Vlan851 - Ethernet0;Ethernet1;Ethernet2;Ethernet3;Ethernet96;Ethernet100;Ethernet104;Ethernet108 - False - 0.0.0.0/0 - - 851 - 10.20.1.0/24 - - - - - IPInterface - - Vlan851 - 10.20.1.1/24 - - - IPInterface - - Ethernet48 - 10.10.1.2/30 - - - IPInterface - - Ethernet52 - 10.10.1.6/30 - - - IPInterface - - Ethernet56 - 10.10.1.10/30 - - - IPInterface - - Ethernet60 - 10.10.1.14/30 - - - IPInterface - - Ethernet64 - 10.10.1.18/30 - - - IPInterface - - Ethernet68 - 10.10.1.22/30 - - - IPInterface - - Ethernet72 - 10.10.1.26/30 - - - IPInterface - - Ethernet76 - 10.10.1.30/30 - - - - - - - - - - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet48 - OCPSCH01040AALF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet52 - OCPSCH01040BBLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet56 - OCPSCH01040CCLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet60 - OCPSCH01040DDLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet64 - OCPSCH01040EELF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet68 - OCPSCH01040FFLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet72 - OCPSCH01040GGLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet76 - OCPSCH01040HHLF - Ethernet48 - - - - - OCPSCH0104001MS - INGRASYS-S8900-64XC - - - - - - - - OCPSCH0104001MS - INGRASYS-S8900-64XC -
diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/default_sku b/device/ingrasys/x86_64-ingrasys_s9100-r0/default_sku new file mode 100644 index 000000000000..1a78c849d5e5 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/default_sku @@ -0,0 +1 @@ +INGRASYS-S9100-C32 t1 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml deleted file mode 100644 index 0c4dec50942a..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/minigraph.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - OCPSCH0104001MS - 10.10.1.26 - OCPSCH01040GGLF - 10.10.1.25 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.26 - OCPSCH01040GGLF - 10.10.2.25 - 1 - 10 - 3 - - - - - 64536 - OCPSCH01040GGLF - - -
10.10.1.26
- - -
- -
10.10.2.26
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.9/32 - - 100.0.0.9/32 - - - - - - - - OCPSCH01040GGLF - - - - - - Ethernet0 - 10.10.1.25/30 - - - - Ethernet4 - 10.10.2.25/30 - - - - - - - - - - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - OCPSCH01040GGLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - OCPSCH01040GGLF - Ethernet4 - - - - - OCPSCH01040GGLF - INGRASYS-S9100-C32 - - - - - - - OCPSCH01040GGLF - - - 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 - - - - - - - OCPSCH01040GGLF - INGRASYS-S9100-C32 -
diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/default_sku b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/default_sku new file mode 100644 index 000000000000..2464f73308e3 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/default_sku @@ -0,0 +1 @@ +INGRASYS-S9130-32X t1 diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml deleted file mode 100644 index 949ea6641b07..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/minigraph.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - HostIP - Loopback0 - - 100.0.0.9/32 - - 100.0.0.9/32 - - - - - - - - OCPSCH01040GGLF - - - - - - - - - - - - - - OCPSCH01040GGLF - INGRASYS-S9130-32X - - - - - - - OCPSCH01040GGLF - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - OCPSCH01040GGLF - INGRASYS-S9130-32X - diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/default_sku b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/default_sku new file mode 100644 index 000000000000..984f54a96e23 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/default_sku @@ -0,0 +1 @@ +INGRASYS-S9180-32X t1 diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml deleted file mode 100644 index 803ae39d22c2..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/minigraph.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - OCPSCH0104001MS - 10.10.1.26 - OCPSCH01040GGLF - 10.10.1.25 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.26 - OCPSCH01040GGLF - 10.10.2.25 - 1 - 10 - 3 - - - - - 64536 - OCPSCH01040GGLF - - -
10.10.1.26
- - -
- -
10.10.2.26
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.9/32 - - 100.0.0.9/32 - - - - - - - - OCPSCH01040GGLF - - - - - - Ethernet0 - 10.10.1.25/30 - - - - Ethernet4 - 10.10.2.25/30 - - - - - - - - - - - - 100000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - OCPSCH01040GGLF - Ethernet0 - - - 100000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - OCPSCH01040GGLF - Ethernet4 - - - - - OCPSCH01040GGLF - INGRASYS-S9180-32X - - - - - - - OCPSCH01040GGLF - - - 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 - - - - - - - OCPSCH01040GGLF - INGRASYS-S9180-32X -
diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/default_sku b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/default_sku new file mode 100644 index 000000000000..30331b0d9fc0 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/default_sku @@ -0,0 +1 @@ +INGRASYS-S9200-64X t1 diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml deleted file mode 100644 index 2b05e9ed15b7..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/minigraph.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - OCPSCH0104001MS - 10.10.1.26 - OCPSCH01040GGLF - 10.10.1.25 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.26 - OCPSCH01040GGLF - 10.10.2.25 - 1 - 10 - 3 - - - - - 64536 - OCPSCH01040GGLF - - -
10.10.1.26
- - -
- -
10.10.2.26
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.9/32 - - 100.0.0.9/32 - - - - - - - - OCPSCH01040GGLF - - - - - - Ethernet0 - 10.10.1.25/30 - - - - Ethernet4 - 10.10.2.25/30 - - - - - - - - - - - - 40000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - OCPSCH01040GGLF - Ethernet0 - - - 40000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - OCPSCH01040GGLF - Ethernet4 - - - - - OCPSCH01040GGLF - INGRASYS-S9200-64X - - - - - - - OCPSCH01040GGLF - - - 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 - - - - - - - OCPSCH01040GGLF - INGRASYS-S9200-64X -
diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/default_sku b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/default_sku new file mode 100644 index 000000000000..46ddac21550c --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/default_sku @@ -0,0 +1 @@ +INGRASYS-S9230-64X t1 diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml deleted file mode 100644 index 048bbbdd156f..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/minigraph.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - HostIP - Loopback0 - - 100.0.0.9/32 - - 100.0.0.9/32 - - - - - - - - OCPSCH01040GGLF - - - - - - - - - - - - - - OCPSCH01040GGLF - INGRASYS-S9230-64X - - - - - - - OCPSCH01040GGLF - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - OCPSCH01040GGLF - INGRASYS-S9230-64X - diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/default_sku b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/default_sku new file mode 100644 index 000000000000..68e0c87eb0a3 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/default_sku @@ -0,0 +1 @@ +INGRASYS-S9280-64X t1 diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/minigraph.xml b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/minigraph.xml deleted file mode 100644 index ffc71df148e5..000000000000 --- a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/minigraph.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - OCPSCH0104001MS - 10.10.1.26 - OCPSCH01040GGLF - 10.10.1.25 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.26 - OCPSCH01040GGLF - 10.10.2.25 - 1 - 10 - 3 - - - - - 64536 - OCPSCH01040GGLF - - -
10.10.1.26
- - -
- -
10.10.2.26
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.9/32 - - 100.0.0.9/32 - - - - - - - - OCPSCH01040GGLF - - - - - - Ethernet0 - 10.10.1.25/30 - - - - Ethernet4 - 10.10.2.25/30 - - - - - - - - - - - - 100000 - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - OCPSCH01040GGLF - Ethernet0 - - - 100000 - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - OCPSCH01040GGLF - Ethernet4 - - - - - OCPSCH01040GGLF - INGRASYS-S9280-64X - - - - - - - OCPSCH01040GGLF - - - 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 - - - - - - - OCPSCH01040GGLF - INGRASYS-S9280-64X -
diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/default_sku b/device/inventec/x86_64-inventec_d7032q28b-r0/default_sku new file mode 100644 index 000000000000..505f1765e6e5 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/default_sku @@ -0,0 +1 @@ +INVENTEC-D7032Q28B-C32 t1 diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml b/device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml deleted file mode 100644 index 1f1dd3dfe35a..000000000000 --- a/device/inventec/x86_64-inventec_d7032q28b-r0/minigraph.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - OCPSCH0104001MS - 10.10.1.26 - SONiC-Inventec-d7032-100 - 10.10.1.25 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.26 - SONiC-Inventec-d7032-100 - 10.10.2.25 - 1 - 10 - 3 - - - - - 64536 - SONiC-Inventec-d7032-100 - - -
10.10.1.26
- - -
- -
10.10.2.26
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.9/32 - - 100.0.0.9/32 - - - - - - - - SONiC-Inventec-d7032-100 - - - - - - Ethernet0 - 10.10.1.25/30 - - - - Ethernet4 - 10.10.2.25/30 - - - - - - - - - - - - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - SONiC-Inventec-d7032-100 - Ethernet0 - - - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - SONiC-Inventec-d7032-100 - Ethernet4 - - - - - SONiC-Inventec-d7032-100 - INVENTEC-D7032Q28B-C32 - - - - - - - SONiC-Inventec-d7032-100 - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - SONiC-Inventec-d7032-100 - INVENTEC-D7032Q28B-C32 -
diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/default_sku b/device/inventec/x86_64-inventec_d7054q28b-r0/default_sku new file mode 100644 index 000000000000..3b1520a5e174 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/default_sku @@ -0,0 +1 @@ +INVENTEC-D7054Q28B-S48-Q6 t1 diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml b/device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml deleted file mode 100644 index 7cd7dd75e608..000000000000 --- a/device/inventec/x86_64-inventec_d7054q28b-r0/minigraph.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - OCPSCH0104001MS - 10.10.1.26 - SONiC-Inventec-d7054 - 10.10.1.25 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.26 - SONiC-Inventec-d7054 - 10.10.2.25 - 1 - 10 - 3 - - - - - 64536 - SONiC-Inventec-d7054 - - -
10.10.1.26
- - -
- -
10.10.2.26
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.9/32 - - 100.0.0.9/32 - - - - - - - - SONiC-Inventec-d7054 - - - - - - Ethernet0 - 10.10.1.25/30 - - - - Ethernet4 - 10.10.2.25/30 - - - - - - - - - - - - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - SONiC-Inventec-d7054 - Ethernet0 - - - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - SONiC-Inventec-d7054 - Ethernet4 - - - - - SONiC-Inventec-d7054 - INVENTEC-D7054Q28B-S48-Q6 - - - - - - - SONiC-Inventec-d7054 - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - SONiC-Inventec-d7054 - INVENTEC-D7054Q28B-S48-Q6 -
diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/default_sku b/device/inventec/x86_64-inventec_d7264q28b-r0/default_sku new file mode 100644 index 000000000000..134ade2e2cd3 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/default_sku @@ -0,0 +1 @@ +INVENTEC-D7264Q28B t1 diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/minigraph.xml b/device/inventec/x86_64-inventec_d7264q28b-r0/minigraph.xml deleted file mode 100644 index b68f712b2624..000000000000 --- a/device/inventec/x86_64-inventec_d7264q28b-r0/minigraph.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - OCPSCH0104001MS - 10.10.1.26 - SONiC-Inventec-d7264 - 10.10.1.25 - 1 - 10 - 3 - - - OCPSCH0104002MS - 10.10.2.26 - SONiC-Inventec-d7264 - 10.10.2.25 - 1 - 10 - 3 - - - - - 64536 - SONiC-Inventec-d7264 - - -
10.10.1.26
- - -
- -
10.10.2.26
- - -
-
- -
- - 64542 - OCPSCH0104001MS - - - - 64543 - OCPSCH0104002MS - - -
-
- - - - - - HostIP - Loopback0 - - 100.0.0.9/32 - - 100.0.0.9/32 - - - - - - - - SONiC-Inventec-d7264 - - - - - - Ethernet0 - 10.10.1.25/30 - - - - Ethernet4 - 10.10.2.25/30 - - - - - - - - - - - - DeviceInterfaceLink - OCPSCH0104001MS - Ethernet24 - SONiC-Inventec-d7264 - Ethernet0 - - - DeviceInterfaceLink - OCPSCH0104002MS - Ethernet24 - SONiC-Inventec-d7264 - Ethernet4 - - - - - SONiC-Inventec-d7264 - INVENTEC-D7264Q28B - - - - - - - SONiC-Inventec-d7264 - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - SONiC-Inventec-d7264 - INVENTEC-D7264Q28B -
diff --git a/device/marvell/x86_64-marvell_slm5401_54x-r0/default_sku b/device/marvell/x86_64-marvell_slm5401_54x-r0/default_sku new file mode 100644 index 000000000000..8ace9a8abcef --- /dev/null +++ b/device/marvell/x86_64-marvell_slm5401_54x-r0/default_sku @@ -0,0 +1 @@ +SLM5401-54x t1 diff --git a/device/marvell/x86_64-marvell_slm5401_54x-r0/minigraph.xml b/device/marvell/x86_64-marvell_slm5401_54x-r0/minigraph.xml deleted file mode 100755 index 3fc83ef7fc61..000000000000 --- a/device/marvell/x86_64-marvell_slm5401_54x-r0/minigraph.xml +++ /dev/null @@ -1,1074 +0,0 @@ - - - - - - ARISTA01T0 - 10.0.0.33 - switch1 - 10.0.0.32 - 1 - 180 - 60 - - - switch1 - 10.0.0.0 - ARISTA01T2 - 10.0.0.1 - 1 - 180 - 60 - - - ARISTA02T0 - 10.0.0.35 - switch1 - 10.0.0.34 - 1 - 180 - 60 - - - switch1 - 10.0.0.2 - ARISTA02T2 - 10.0.0.3 - 1 - 180 - 60 - - - ARISTA03T0 - 10.0.0.37 - switch1 - 10.0.0.36 - 1 - 180 - 60 - - - switch1 - 10.0.0.4 - ARISTA03T2 - 10.0.0.5 - 1 - 180 - 60 - - - ARISTA04T0 - 10.0.0.39 - switch1 - 10.0.0.38 - 1 - 180 - 60 - - - switch1 - 10.0.0.6 - ARISTA04T2 - 10.0.0.7 - 1 - 180 - 60 - - - ARISTA05T0 - 10.0.0.41 - switch1 - 10.0.0.40 - 1 - 180 - 60 - - - switch1 - 10.0.0.8 - ARISTA05T2 - 10.0.0.9 - 1 - 180 - 60 - - - ARISTA06T0 - 10.0.0.43 - switch1 - 10.0.0.42 - 1 - 180 - 60 - - - switch1 - 10.0.0.10 - ARISTA06T2 - 10.0.0.11 - 1 - 180 - 60 - - - ARISTA07T0 - 10.0.0.45 - switch1 - 10.0.0.44 - 1 - 180 - 60 - - - switch1 - 10.0.0.12 - ARISTA07T2 - 10.0.0.13 - 1 - 180 - 60 - - - ARISTA08T0 - 10.0.0.47 - switch1 - 10.0.0.46 - 1 - 180 - 60 - - - switch1 - 10.0.0.14 - ARISTA08T2 - 10.0.0.15 - 1 - 180 - 60 - - - ARISTA09T0 - 10.0.0.49 - switch1 - 10.0.0.48 - 1 - 180 - 60 - - - switch1 - 10.0.0.16 - ARISTA09T2 - 10.0.0.17 - 1 - 180 - 60 - - - ARISTA10T0 - 10.0.0.51 - switch1 - 10.0.0.50 - 1 - 180 - 60 - - - switch1 - 10.0.0.18 - ARISTA10T2 - 10.0.0.19 - 1 - 180 - 60 - - - ARISTA11T0 - 10.0.0.53 - switch1 - 10.0.0.52 - 1 - 180 - 60 - - - switch1 - 10.0.0.20 - ARISTA11T2 - 10.0.0.21 - 1 - 180 - 60 - - - ARISTA12T0 - 10.0.0.55 - switch1 - 10.0.0.54 - 1 - 180 - 60 - - - switch1 - 10.0.0.22 - ARISTA12T2 - 10.0.0.23 - 1 - 180 - 60 - - - ARISTA13T0 - 10.0.0.57 - switch1 - 10.0.0.56 - 1 - 180 - 60 - - - switch1 - 10.0.0.24 - ARISTA13T2 - 10.0.0.25 - 1 - 180 - 60 - - - ARISTA14T0 - 10.0.0.59 - switch1 - 10.0.0.58 - 1 - 180 - 60 - - - switch1 - 10.0.0.26 - ARISTA14T2 - 10.0.0.27 - 1 - 180 - 60 - - - ARISTA15T0 - 10.0.0.61 - switch1 - 10.0.0.60 - 1 - 180 - 60 - - - switch1 - 10.0.0.28 - ARISTA15T2 - 10.0.0.29 - 1 - 180 - 60 - - - ARISTA16T0 - 10.0.0.63 - switch1 - 10.0.0.62 - 1 - 180 - 60 - - - switch1 - 10.0.0.30 - ARISTA16T2 - 10.0.0.31 - 1 - 180 - 60 - - - - - 65100 - switch1 - - -
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 - - - - - - - - switch1 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - switch1 - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - switch1 - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - switch1 - SLM5401-54x - - - - - - - switch1 - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - switch1 - SLM5401-54x -
diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/default_sku b/device/mellanox/x86_64-mlnx_lssn2700-r0/default_sku new file mode 100644 index 000000000000..22e3116d2dbb --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/default_sku @@ -0,0 +1 @@ +LS-SN2700 t1 diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_lssn2700-r0/minigraph.xml deleted file mode 100644 index 40eb5252610b..000000000000 --- a/device/mellanox/x86_64-mlnx_lssn2700-r0/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - LS-SN2700 - - - - - - - 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 - LS-SN2700 -
diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/default_sku b/device/mellanox/x86_64-mlnx_msn2010-r0/default_sku new file mode 100644 index 000000000000..558120a701d4 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/default_sku @@ -0,0 +1 @@ +ACS-MSN2010 t1 diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2010-r0/minigraph.xml deleted file mode 100644 index 580cdff142f2..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/minigraph.xml +++ /dev/null @@ -1,855 +0,0 @@ - - - - - - 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 - - -
-
- - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - - - - - - sonic - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - - - sonic - ACS-MSN2010 - - - - - - - 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 - ACS-MSN2010 -
- diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/default_sku b/device/mellanox/x86_64-mlnx_msn2100-r0/default_sku new file mode 100644 index 000000000000..5d7c94c0bc8c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/default_sku @@ -0,0 +1 @@ +ACS-MSN2100 t1 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml deleted file mode 100644 index d902d6eac4d4..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/minigraph.xml +++ /dev/null @@ -1,578 +0,0 @@ - - - - - - sonic - 10.0.0.0 - ARISTA01T2 - 10.0.0.1 - 1 - 180 - 60 - - - sonic - 10.0.0.2 - ARISTA02T2 - 10.0.0.3 - 1 - 180 - 60 - - - sonic - 10.0.0.4 - ARISTA03T2 - 10.0.0.5 - 1 - 180 - 60 - - - sonic - 10.0.0.6 - ARISTA04T2 - 10.0.0.7 - 1 - 180 - 60 - - - sonic - 10.0.0.8 - ARISTA05T2 - 10.0.0.9 - 1 - 180 - 60 - - - sonic - 10.0.0.10 - ARISTA06T2 - 10.0.0.11 - 1 - 180 - 60 - - - sonic - 10.0.0.12 - ARISTA07T2 - 10.0.0.13 - 1 - 180 - 60 - - - sonic - 10.0.0.14 - ARISTA08T2 - 10.0.0.15 - 1 - 180 - 60 - - - sonic - 10.0.0.16 - ARISTA09T2 - 10.0.0.17 - 1 - 180 - 60 - - - sonic - 10.0.0.18 - ARISTA10T2 - 10.0.0.19 - 1 - 180 - 60 - - - sonic - 10.0.0.20 - ARISTA11T2 - 10.0.0.21 - 1 - 180 - 60 - - - sonic - 10.0.0.22 - ARISTA12T2 - 10.0.0.23 - 1 - 180 - 60 - - - sonic - 10.0.0.24 - ARISTA13T2 - 10.0.0.25 - 1 - 180 - 60 - - - sonic - 10.0.0.26 - ARISTA14T2 - 10.0.0.27 - 1 - 180 - 60 - - - sonic - 10.0.0.28 - ARISTA15T2 - 10.0.0.29 - 1 - 180 - 60 - - - sonic - 10.0.0.30 - ARISTA16T2 - 10.0.0.31 - 1 - 180 - 60 - - - - - 65100 - sonic - - -
10.0.0.1
- - -
- -
10.0.0.3
- - -
- -
10.0.0.5
- - -
- -
10.0.0.7
- - -
- -
10.0.0.9
- - -
- -
10.0.0.11
- - -
- -
10.0.0.13
- - -
- -
10.0.0.15
- - -
- -
10.0.0.17
- - -
- -
10.0.0.19
- - -
- -
10.0.0.21
- - -
- -
10.0.0.23
- - -
- -
10.0.0.25
- - -
- -
10.0.0.27
- - -
- -
10.0.0.29
- - -
- -
10.0.0.31
- - -
-
- -
- - 65200 - ARISTA01T2 - - - - 65200 - ARISTA02T2 - - - - 65200 - ARISTA03T2 - - - - 65200 - ARISTA04T2 - - - - 65200 - ARISTA05T2 - - - - 65200 - ARISTA06T2 - - - - 65200 - ARISTA07T2 - - - - 65200 - ARISTA08T2 - - - - 65200 - ARISTA09T2 - - - - 65200 - ARISTA10T2 - - - - 65200 - ARISTA11T2 - - - - 65200 - ARISTA12T2 - - - - 65200 - ARISTA13T2 - - - - 65200 - ARISTA14T2 - - - - 65200 - ARISTA15T2 - - - - 65200 - ARISTA16T2 - - -
-
- - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - - - - - - sonic - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - - - sonic - ACS-MSN2700 - - ` - - - - - sonic - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - sonic - ACS-MSN2100 -
diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/default_sku b/device/mellanox/x86_64-mlnx_msn2410-r0/default_sku new file mode 100644 index 000000000000..ac04d6adf5f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/default_sku @@ -0,0 +1 @@ +ACS-MSN2410 t1 diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml deleted file mode 100644 index 8b417c35353f..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/minigraph.xml +++ /dev/null @@ -1,1199 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - Ethernet128 - 10.0.0.64/31 - - - - Ethernet132 - 10.0.0.66/31 - - - - Ethernet136 - 10.0.0.68/31 - - - - Ethernet140 - 10.0.0.70/31 - - - - Ethernet144 - 10.0.0.72/31 - - - - Ethernet148 - 10.0.0.74/31 - - - - Ethernet152 - 10.0.0.76/31 - - - - Ethernet156 - 10.0.0.78/31 - - - - Ethernet160 - 10.0.0.80/31 - - - - Ethernet164 - 10.0.0.82/31 - - - - Ethernet168 - 10.0.0.84/31 - - - - Ethernet172 - 10.0.0.86/31 - - - - Ethernet176 - 10.0.0.88/31 - - - - Ethernet180 - 10.0.0.90/31 - - - - Ethernet184 - 10.0.0.92/31 - - - - Ethernet188 - 10.0.0.94/31 - - - - Ethernet192 - 10.0.0.96/31 - - - - Ethernet196 - 10.0.0.98/31 - - - - Ethernet200 - 10.0.0.100/31 - - - - Ethernet204 - 10.0.0.102/31 - - - - Ethernet208 - 10.0.0.104/31 - - - - Ethernet212 - 10.0.0.106/31 - - - - Ethernet216 - 10.0.0.108/31 - - - - Ethernet220 - 10.0.0.110/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - ACS-MSN2410 - - - - - - - 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 - ACS-MSN2410 -
diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/default_sku b/device/mellanox/x86_64-mlnx_msn2700-r0/default_sku new file mode 100644 index 000000000000..bcce12890af1 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/default_sku @@ -0,0 +1 @@ +Mellanox-SN2700 t1 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml deleted file mode 100644 index 19ea4a9670bf..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - ACS-MSN2700 - - - - - - - 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 - ACS-MSN2700 -
diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/default_sku b/device/mellanox/x86_64-mlnx_msn2740-r0/default_sku new file mode 100644 index 000000000000..9641115a4946 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/default_sku @@ -0,0 +1 @@ +ACS-MSN2740 t1 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml b/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml deleted file mode 100644 index f25aa94384e5..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/minigraph.xml +++ /dev/null @@ -1,1079 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - ACS-MSN2740 - - ` - - - - - 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 - ACS-MSN2740 -
diff --git a/device/mellanox/x86_64-mlnx_x86-r5.0.1400/default_sku b/device/mellanox/x86_64-mlnx_x86-r5.0.1400/default_sku new file mode 100644 index 000000000000..9641115a4946 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_x86-r5.0.1400/default_sku @@ -0,0 +1 @@ +ACS-MSN2740 t1 diff --git a/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/default_sku b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/default_sku new file mode 100644 index 000000000000..b533cbe35c56 --- /dev/null +++ b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/default_sku @@ -0,0 +1 @@ +MiTAC-LY1200-B32H0-C3 t1 diff --git a/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/minigraph.xml b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/minigraph.xml deleted file mode 100644 index 210eac2fd620..000000000000 --- a/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/minigraph.xml +++ /dev/null @@ -1,1074 +0,0 @@ - - - - - - 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 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - - - - - - - - - DeviceInterfaceLink - sonic - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet64 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet68 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet72 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet76 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet80 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet84 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet88 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet92 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet96 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet100 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet104 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet108 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet112 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet116 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet120 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - sonic - Ethernet124 - ARISTA16T0 - Ethernet1 - - - - - sonic - MiTAC-LY1200-B32H0-C3 - - - - - - - sonic - - - DhcpResources - - - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - - - - - - - - sonic - MiTAC-LY1200-B32H0-C3 -
diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/default_sku b/device/quanta/x86_64-quanta_ix1b_32x-r0/default_sku new file mode 100644 index 000000000000..68cbc0d6058d --- /dev/null +++ b/device/quanta/x86_64-quanta_ix1b_32x-r0/default_sku @@ -0,0 +1 @@ +Quanta-IX1B-32X t1 diff --git a/device/wnc/x86_64-wnc_osw1800-r0/default_sku b/device/wnc/x86_64-wnc_osw1800-r0/default_sku new file mode 100644 index 000000000000..0f663505d7a4 --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/default_sku @@ -0,0 +1 @@ +OSW1800-48x6q t1 diff --git a/device/wnc/x86_64-wnc_osw1800-r0/minigraph.xml b/device/wnc/x86_64-wnc_osw1800-r0/minigraph.xml deleted file mode 100644 index fc4dcee3058e..000000000000 --- a/device/wnc/x86_64-wnc_osw1800-r0/minigraph.xml +++ /dev/null @@ -1,1761 +0,0 @@ - - - - - - ARISTA01T0 - 10.0.0.55 - switch2 - 10.0.0.54 - 1 - 180 - 60 - - - switch2 - 10.0.0.0 - ARISTA01T2 - 10.0.0.1 - 1 - 180 - 60 - - - ARISTA02T0 - 10.0.0.57 - switch2 - 10.0.0.56 - 1 - 180 - 60 - - - switch2 - 10.0.0.2 - ARISTA02T2 - 10.0.0.3 - 1 - 180 - 60 - - - ARISTA03T0 - 10.0.0.59 - switch2 - 10.0.0.58 - 1 - 180 - 60 - - - switch2 - 10.0.0.4 - ARISTA03T2 - 10.0.0.5 - 1 - 180 - 60 - - - ARISTA04T0 - 10.0.0.61 - switch2 - 10.0.0.60 - 1 - 180 - 60 - - - switch2 - 10.0.0.6 - ARISTA04T2 - 10.0.0.7 - 1 - 180 - 60 - - - ARISTA05T0 - 10.0.0.63 - switch2 - 10.0.0.62 - 1 - 180 - 60 - - - switch2 - 10.0.0.8 - ARISTA05T2 - 10.0.0.9 - 1 - 180 - 60 - - - ARISTA06T0 - 10.0.0.65 - switch2 - 10.0.0.64 - 1 - 180 - 60 - - - switch2 - 10.0.0.10 - ARISTA06T2 - 10.0.0.11 - 1 - 180 - 60 - - - ARISTA07T0 - 10.0.0.67 - switch2 - 10.0.0.66 - 1 - 180 - 60 - - - switch2 - 10.0.0.12 - ARISTA07T2 - 10.0.0.13 - 1 - 180 - 60 - - - ARISTA08T0 - 10.0.0.69 - switch2 - 10.0.0.68 - 1 - 180 - 60 - - - switch2 - 10.0.0.14 - ARISTA08T2 - 10.0.0.15 - 1 - 180 - 60 - - - ARISTA09T0 - 10.0.0.71 - switch2 - 10.0.0.70 - 1 - 180 - 60 - - - switch2 - 10.0.0.16 - ARISTA09T2 - 10.0.0.17 - 1 - 180 - 60 - - - ARISTA10T0 - 10.0.0.73 - switch2 - 10.0.0.72 - 1 - 180 - 60 - - - switch2 - 10.0.0.18 - ARISTA10T2 - 10.0.0.19 - 1 - 180 - 60 - - - ARISTA11T0 - 10.0.0.75 - switch2 - 10.0.0.74 - 1 - 180 - 60 - - - switch2 - 10.0.0.20 - ARISTA11T2 - 10.0.0.21 - 1 - 180 - 60 - - - ARISTA12T0 - 10.0.0.77 - switch2 - 10.0.0.76 - 1 - 180 - 60 - - - switch2 - 10.0.0.22 - ARISTA12T2 - 10.0.0.23 - 1 - 180 - 60 - - - ARISTA13T0 - 10.0.0.79 - switch2 - 10.0.0.78 - 1 - 180 - 60 - - - switch2 - 10.0.0.24 - ARISTA13T2 - 10.0.0.25 - 1 - 180 - 60 - - - ARISTA14T0 - 10.0.0.81 - switch2 - 10.0.0.80 - 1 - 180 - 60 - - - switch2 - 10.0.0.26 - ARISTA14T2 - 10.0.0.27 - 1 - 180 - 60 - - - ARISTA15T0 - 10.0.0.83 - switch2 - 10.0.0.82 - 1 - 180 - 60 - - - switch2 - 10.0.0.28 - ARISTA15T2 - 10.0.0.29 - 1 - 180 - 60 - - - ARISTA16T0 - 10.0.0.85 - switch2 - 10.0.0.84 - 1 - 180 - 60 - - - switch2 - 10.0.0.30 - ARISTA16T2 - 10.0.0.31 - 1 - 180 - 60 - - - ARISTA17T0 - 10.0.0.87 - switch2 - 10.0.0.86 - 1 - 180 - 60 - - - switch2 - 10.0.0.32 - ARISTA17T2 - 10.0.0.33 - 1 - 180 - 60 - - - ARISTA18T0 - 10.0.0.89 - switch2 - 10.0.0.88 - 1 - 180 - 60 - - - switch2 - 10.0.0.34 - ARISTA18T2 - 10.0.0.35 - 1 - 180 - 60 - - - ARISTA19T0 - 10.0.0.91 - switch2 - 10.0.0.90 - 1 - 180 - 60 - - - switch2 - 10.0.0.36 - ARISTA19T2 - 10.0.0.37 - 1 - 180 - 60 - - - ARISTA20T0 - 10.0.0.93 - switch2 - 10.0.0.92 - 1 - 180 - 60 - - - switch2 - 10.0.0.38 - ARISTA20T2 - 10.0.0.39 - 1 - 180 - 60 - - - ARISTA21T0 - 10.0.0.95 - switch2 - 10.0.0.94 - 1 - 180 - 60 - - - switch2 - 10.0.0.40 - ARISTA21T2 - 10.0.0.41 - 1 - 180 - 60 - - - ARISTA22T0 - 10.0.0.97 - switch2 - 10.0.0.96 - 1 - 180 - 60 - - - switch2 - 10.0.0.42 - ARISTA22T2 - 10.0.0.43 - 1 - 180 - 60 - - - ARISTA23T0 - 10.0.0.99 - switch2 - 10.0.0.98 - 1 - 180 - 60 - - - switch2 - 10.0.0.44 - ARISTA23T2 - 10.0.0.45 - 1 - 180 - 60 - - - ARISTA24T0 - 10.0.0.101 - switch2 - 10.0.0.100 - 1 - 180 - 60 - - - switch2 - 10.0.0.46 - ARISTA24T2 - 10.0.0.47 - 1 - 180 - 60 - - - ARISTA25T0 - 10.0.0.103 - switch2 - 10.0.0.102 - 1 - 180 - 60 - - - switch2 - 10.0.0.48 - ARISTA25T2 - 10.0.0.49 - 1 - 180 - 60 - - - ARISTA26T0 - 10.0.0.105 - switch2 - 10.0.0.104 - 1 - 180 - 60 - - - switch2 - 10.0.0.50 - ARISTA26T2 - 10.0.0.51 - 1 - 180 - 60 - - - ARISTA27T0 - 10.0.0.107 - switch2 - 10.0.0.106 - 1 - 180 - 60 - - - switch2 - 10.0.0.52 - ARISTA27T2 - 10.0.0.53 - 1 - 180 - 60 - - - - - 65100 - switch2 - - -
10.0.0.55
- - -
- -
10.0.0.1
- - -
- -
10.0.0.57
- - -
- -
10.0.0.3
- - -
- -
10.0.0.59
- - -
- -
10.0.0.5
- - -
- -
10.0.0.61
- - -
- -
10.0.0.7
- - -
- -
10.0.0.63
- - -
- -
10.0.0.9
- - -
- -
10.0.0.65
- - -
- -
10.0.0.11
- - -
- -
10.0.0.67
- - -
- -
10.0.0.13
- - -
- -
10.0.0.69
- - -
- -
10.0.0.15
- - -
- -
10.0.0.71
- - -
- -
10.0.0.17
- - -
- -
10.0.0.73
- - -
- -
10.0.0.19
- - -
- -
10.0.0.75
- - -
- -
10.0.0.21
- - -
- -
10.0.0.77
- - -
- -
10.0.0.23
- - -
- -
10.0.0.79
- - -
- -
10.0.0.25
- - -
- -
10.0.0.81
- - -
- -
10.0.0.27
- - -
- -
10.0.0.83
- - -
- -
10.0.0.29
- - -
- -
10.0.0.85
- - -
- -
10.0.0.31
- - -
- -
10.0.0.87
- - -
- -
10.0.0.33
- - -
- -
10.0.0.89
- - -
- -
10.0.0.35
- - -
- -
10.0.0.91
- - -
- -
10.0.0.37
- - -
- -
10.0.0.93
- - -
- -
10.0.0.39
- - -
- -
10.0.0.95
- - -
- -
10.0.0.41
- - -
- -
10.0.0.97
- - -
- -
10.0.0.43
- - -
- -
10.0.0.99
- - -
- -
10.0.0.45
- - -
- -
10.0.0.101
- - -
- -
10.0.0.47
- - -
- -
10.0.0.103
- - -
- -
10.0.0.49
- - -
- -
10.0.0.105
- - -
- -
10.0.0.51
- - -
- -
10.0.0.107
- - -
- -
10.0.0.53
- - -
-
- -
- - 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 - - - - 64016 - ARISTA17T0 - - - - 65200 - ARISTA17T2 - - - - 64016 - ARISTA18T0 - - - - 65200 - ARISTA18T2 - - - - 64016 - ARISTA19T0 - - - - 65200 - ARISTA19T2 - - - - 64016 - ARISTA20T0 - - - - 65200 - ARISTA20T2 - - - - 64016 - ARISTA21T0 - - - - 65200 - ARISTA21T2 - - - - 64016 - ARISTA22T0 - - - - 65200 - ARISTA22T2 - - - - 64016 - ARISTA23T0 - - - - 65200 - ARISTA23T2 - - - - 64016 - ARISTA24T0 - - - - 65200 - ARISTA24T2 - - - - 64016 - ARISTA25T0 - - - - 65200 - ARISTA25T2 - - - - 64016 - ARISTA26T0 - - - - 65200 - ARISTA26T2 - - - - 64016 - ARISTA27T0 - - - - 65200 - ARISTA27T2 - - -
-
- - - - - - HostIP - Loopback0 - - 10.1.0.32/32 - - 10.1.0.32/32 - - - - - - - - switch2 - - - - - - Ethernet0 - 10.0.0.0/31 - - - - Ethernet4 - 10.0.0.2/31 - - - - Ethernet8 - 10.0.0.4/31 - - - - Ethernet12 - 10.0.0.6/31 - - - - Ethernet16 - 10.0.0.8/31 - - - - Ethernet20 - 10.0.0.10/31 - - - - Ethernet24 - 10.0.0.12/31 - - - - Ethernet28 - 10.0.0.14/31 - - - - Ethernet32 - 10.0.0.16/31 - - - - Ethernet36 - 10.0.0.18/31 - - - - Ethernet40 - 10.0.0.20/31 - - - - Ethernet44 - 10.0.0.22/31 - - - - Ethernet48 - 10.0.0.24/31 - - - - Ethernet52 - 10.0.0.26/31 - - - - Ethernet56 - 10.0.0.28/31 - - - - Ethernet60 - 10.0.0.30/31 - - - - Ethernet64 - 10.0.0.32/31 - - - - Ethernet68 - 10.0.0.34/31 - - - - Ethernet72 - 10.0.0.36/31 - - - - Ethernet76 - 10.0.0.38/31 - - - - Ethernet80 - 10.0.0.40/31 - - - - Ethernet84 - 10.0.0.42/31 - - - - Ethernet88 - 10.0.0.44/31 - - - - Ethernet92 - 10.0.0.46/31 - - - - Ethernet96 - 10.0.0.48/31 - - - - Ethernet100 - 10.0.0.50/31 - - - - Ethernet104 - 10.0.0.52/31 - - - - Ethernet108 - 10.0.0.54/31 - - - - Ethernet112 - 10.0.0.56/31 - - - - Ethernet116 - 10.0.0.58/31 - - - - Ethernet120 - 10.0.0.60/31 - - - - Ethernet124 - 10.0.0.62/31 - - - - Ethernet128 - 10.0.0.64/31 - - - - Ethernet132 - 10.0.0.66/31 - - - - Ethernet136 - 10.0.0.68/31 - - - - Ethernet140 - 10.0.0.70/31 - - - - Ethernet144 - 10.0.0.72/31 - - - - Ethernet148 - 10.0.0.74/31 - - - - Ethernet152 - 10.0.0.76/31 - - - - Ethernet156 - 10.0.0.78/31 - - - - Ethernet160 - 10.0.0.80/31 - - - - Ethernet164 - 10.0.0.82/31 - - - - Ethernet168 - 10.0.0.84/31 - - - - Ethernet172 - 10.0.0.86/31 - - - - Ethernet176 - 10.0.0.88/31 - - - - Ethernet180 - 10.0.0.90/31 - - - - Ethernet184 - 10.0.0.92/31 - - - - Ethernet188 - 10.0.0.94/31 - - - - Ethernet192 - 10.0.0.96/31 - - - - Ethernet196 - 10.0.0.98/31 - - - - Ethernet200 - 10.0.0.100/31 - - - - Ethernet204 - 10.0.0.102/31 - - - - Ethernet208 - 10.0.0.104/31 - - - - Ethernet212 - 10.0.0.106/31 - - - - - - - - - - - - DeviceInterfaceLink - switch2 - Ethernet0 - ARISTA01T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet4 - ARISTA02T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet8 - ARISTA03T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet12 - ARISTA04T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet16 - ARISTA05T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet20 - ARISTA06T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet24 - ARISTA07T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet28 - ARISTA08T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet32 - ARISTA09T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet36 - ARISTA10T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet40 - ARISTA11T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet44 - ARISTA12T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet48 - ARISTA13T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet52 - ARISTA14T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet56 - ARISTA15T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet60 - ARISTA16T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet64 - ARISTA17T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet68 - ARISTA18T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet72 - ARISTA19T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet76 - ARISTA20T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet80 - ARISTA21T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet84 - ARISTA22T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet88 - ARISTA23T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet92 - ARISTA24T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet96 - ARISTA25T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet100 - ARISTA26T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet104 - ARISTA27T2 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet108 - ARISTA01T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet112 - ARISTA02T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet116 - ARISTA03T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet120 - ARISTA04T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet124 - ARISTA05T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet128 - ARISTA06T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet132 - ARISTA07T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet136 - ARISTA08T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet140 - ARISTA09T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet144 - ARISTA10T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet148 - ARISTA11T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet152 - ARISTA12T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet156 - ARISTA13T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet160 - ARISTA14T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet164 - ARISTA15T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet168 - ARISTA16T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet172 - ARISTA17T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet176 - ARISTA18T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet180 - ARISTA19T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet184 - ARISTA20T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet188 - ARISTA21T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet192 - ARISTA22T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet196 - ARISTA23T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet200 - ARISTA24T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet204 - ARISTA25T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet208 - ARISTA26T0 - Ethernet1 - - - DeviceInterfaceLink - switch2 - Ethernet212 - ARISTA27T0 - Ethernet1 - - - - - switch2 - OSW1800-48x6q - - - - - - - switch2 - - - DhcpResources - - 192.168.1.111 - - - NtpResources - - 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org - - - SyslogResources - - 192.0.0.1 - - - ErspanDestinationIpv4 - - 2.2.2.2 - - - - - - - switch2 - OSW1800-48x6q -
diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 5a0304aa24e7..4c084fa8c272 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -17,21 +17,6 @@ reload_minigraph() config qos reload } -copy_default_minigraph() -{ - . /host/machine.conf - if [ -n "$aboot_platform" ]; then - platform=$aboot_platform - elif [ -n "$onie_platform" ]; then - platform=$onie_platform - else - echo "Unknown sonic platform." - exit 1 - fi - echo "Copying default minigraph..." - cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/ -} - if [ ! -f /etc/sonic/updategraph.conf ]; then echo "No updategraph.conf found, generating a default one." @@ -66,9 +51,12 @@ fi if [ -f /tmp/pending_config_initialization ]; then rm -f /tmp/pending_config_initialization if [ "$enabled" != "true" ]; then - copy_default_minigraph - reload_minigraph - sonic-cfggen -d --print-data > /etc/sonic/config_db.json + 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 + redis-cli -n $CONFIG_DB_INDEX FLUSHDB + sonic-cfggen -j /etc/sonic/config_db.json --write-to-db + redis-cli -n $CONFIG_DB_INDEX SET "CONFIG_DB_INITIALIZED" "1" exit 0 fi fi @@ -103,12 +91,13 @@ if [ "$src" = "dhcp" ]; then fi if [ "`cat /tmp/dhcp_graph_url`" = "N/A" ]; then echo "'N/A' found in DHCP response. Skipping graph update and generating an empty configuration." - if [ ! -f /etc/sonic/minigraph.xml ]; then - copy_default_minigraph + PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform` + if [ -f /etc/sonic/minigraph.xml ]; then + sonic-cfggen -H -m /etc/sonic/minigraph.xml --preset empty > /tmp/device_meta.json + else + PRESET=(`head -n 1 /usr/share/sonic/device/$PLATFORM/default_sku`) + sonic-cfggen -H -k ${PRESET[0]} --preset empty > /tmp/device_meta.json fi - echo '{"DEVICE_METADATA":' > /tmp/device_meta.json - sonic-cfggen -H -m /etc/sonic/minigraph.xml --var-json DEVICE_METADATA >> /tmp/device_meta.json - echo '}' >> /tmp/device_meta.json if [ -f /etc/sonic/init_cfg.json ]; then sonic-cfggen -j /tmp/device_meta.json -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json else From 715806c906c1199da4f85d208041c172a4fdc593 Mon Sep 17 00:00:00 2001 From: "Kevin(Shengkai) Wang" Date: Sun, 23 Sep 2018 07:24:12 +0800 Subject: [PATCH 1634/1833] [mellanox]: Add support for Mellanox MSN2010 (#2069) * [device]: Add support for Mellanox MSN2010 MSN2010 runs on Spectrum silicon and has 22 ports: 18 25GbE and 4 100GbE * [device]: Fix a potential qos config issue for MSN2700 Signed-off-by: Kevin Wang --- .../ACS-MSN2010/buffers.json.j2 | 1 + .../ACS-MSN2010/buffers_defaults_t0.j2 | 1 + .../ACS-MSN2010/buffers_defaults_t1.j2 | 1 + .../ACS-MSN2010/pg_profile_lookup.ini | 1 + .../ACS-MSN2010/port_config.ini | 56 ++-- .../ACS-MSN2010/qos.json.j2 | 1 + .../ACS-MSN2010/sai_2010.xml | 243 ++++++++++++++++++ .../x86_64-mlnx_msn2010-r0/plugins/psuutil.py | 5 +- .../x86_64-mlnx_msn2010-r0/plugins/sfputil.py | 57 +++- .../ACS-MSN2700/qos.json.j2 | 3 + 10 files changed, 339 insertions(+), 30 deletions(-) create mode 120000 device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_t0.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_t1.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/pg_profile_lookup.ini create mode 120000 device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/qos.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers.json.j2 new file mode 120000 index 000000000000..add8bf8bb7c2 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..7bcae62336f6 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..a437d613434d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/pg_profile_lookup.ini new file mode 120000 index 000000000000..3c97f3dcb16f --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/pg_profile_lookup.ini @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini index 1cb2cb69c592..987720e3b120 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini @@ -1,23 +1,33 @@ -# name lanes -Ethernet0 0 -Ethernet4 4 -Ethernet8 8 -Ethernet12 12 -Ethernet16 16 -Ethernet20 20 -Ethernet24 24 -Ethernet28 28 -Ethernet32 32 -Ethernet36 36 -Ethernet40 40 -Ethernet44 44 -Ethernet48 48 -Ethernet52 52 -Ethernet56 56 -Ethernet60 60 -Ethernet64 64 -Ethernet68 68 -Ethernet72 72,73,74,75 -Ethernet76 76,77,78,79 -Ethernet80 80,81,82,83 -Ethernet84 84,85,86,87 \ No newline at end of file +# name lanes index +Ethernet0 0 0 +Ethernet4 4 1 +Ethernet8 8 2 +Ethernet12 12 3 +Ethernet16 16 4 +Ethernet20 20 5 +Ethernet24 24 6 +Ethernet28 28 7 +Ethernet32 32 8 +Ethernet36 36 9 +Ethernet40 40 10 +Ethernet44 44 11 +Ethernet48 48 12 +Ethernet52 52 13 +Ethernet56 56 14 +Ethernet60 60 15 +Ethernet64 64 16 +Ethernet68 68 17 +Ethernet72 72 18 +Ethernet76 73 18 +Ethernet80 74 18 +Ethernet84 75 18 +Ethernet88 76 19 +Ethernet92 77 19 +Ethernet96 78 19 +Ethernet100 79 19 +Ethernet104 80 20 +Ethernet108 81 20 +Ethernet112 82 20 +Ethernet116 83 20 +Ethernet120 84 21 +Ethernet124 86 21 diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/qos.json.j2 new file mode 120000 index 000000000000..eccf286dc879 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/qos.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml new file mode 100644 index 000000000000..8f4af640ddde --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml @@ -0,0 +1,243 @@ + + + + + + 00:02:03:04:05:00 + + + 32 + + + + + 1 + 32 + 1 + + + 0 + + + 939524096 + + + 2 + 33 + 1 + 0 + 939524096 + + + 3 + 34 + 1 + 0 + 939524096 + + + 4 + 35 + 1 + 0 + 939524096 + + + 5 + 36 + 1 + 0 + 4096 + + + 6 + 37 + 1 + 0 + 4096 + + + 7 + 38 + 1 + 0 + 4096 + + + 8 + 39 + 1 + 0 + 4096 + + + 9 + 40 + 1 + 0 + 4096 + + + 10 + 41 + 1 + 0 + 4096 + + + 11 + 42 + 1 + 0 + 4096 + + + 12 + 43 + 1 + 0 + 4096 + + + 13 + 44 + 1 + 0 + 4096 + + + 14 + 45 + 1 + 0 + 4096 + + + 15 + 46 + 1 + 0 + 4096 + + + 16 + 47 + 1 + 0 + 4096 + + + 17 + 48 + 1 + 0 + 4096 + + + 18 + 49 + 1 + 0 + 4096 + + + 19 + 1 + 3 + 0 + 4096 + + + 20 + 1 + 4 + 0 + 4096 + + + 21 + 1 + 5 + 0 + 4096 + + + 22 + 1 + 6 + 0 + 4096 + + + 23 + 1 + 7 + 0 + 4096 + + + 24 + 1 + 8 + 0 + 4096 + + + 25 + 1 + 9 + 0 + 4096 + + + 26 + 1 + 10 + 0 + 4096 + + + 27 + 1 + 11 + 0 + 4096 + + + 28 + 1 + 12 + 0 + 4096 + + + 29 + 1 + 13 + 0 + 4096 + + + 30 + 1 + 14 + 0 + 4096 + + + 31 + 1 + 15 + 0 + 4096 + + + 32 + 1 + 16 + 0 + 4096 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py index b1900d173f57..d89a046940d0 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py @@ -64,10 +64,11 @@ def get_psu_presence(self, index): if index is None: return False + status = 0 try: with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: - return True + status = int(presence_status.read()) except IOError: return False - return False + return status == 1 diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py index d15c11943280..77831b54d2fd 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py @@ -10,18 +10,28 @@ except ImportError as e: raise ImportError("%s - required module not found" % str(e)) +# parameters for DB connection +REDIS_HOSTNAME = "localhost" +REDIS_PORT = 6379 +REDIS_TIMEOUT_USECS = 0 class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" - PORT_START = 0 - PORT_END = 55 - PORTS_IN_BLOCK = 56 - + PORT_END = 21 + PORTS_IN_BLOCK = 22 + QSFP_PORT_START = 18 EEPROM_OFFSET = 1 _port_to_eeprom_mapping = {} + db_sel = None + db_sel_timeout = None + db_sel_object = None + db_sel_tbl = None + state_db = None + sfpd_status_tbl = None + @property def port_start(self): return self.PORT_START @@ -32,7 +42,7 @@ def port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): @@ -46,6 +56,7 @@ def __init__(self): SfpUtilBase.__init__(self) + def get_presence(self, port_num): # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: @@ -149,3 +160,39 @@ def reset(self, port_num): return False return False + + def get_transceiver_change_event(self, timeout=0): + phy_port_dict = {} + status = True + + if self.db_sel == None: + from swsscommon import swsscommon + self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, + REDIS_HOSTNAME, + REDIS_PORT, + REDIS_TIMEOUT_USECS) + + # Subscribe to state table for SFP change notifications + self.db_sel = swsscommon.Select() + self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') + self.db_sel.addSelectable(self.db_sel_tbl) + self.db_sel_timeout = swsscommon.Select.TIMEOUT + self.db_sel_object = swsscommon.Select.OBJECT + self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') + + # Check the liveness of mlnx-sfpd, if it failed, return false + keys = self.sfpd_status_tbl.getKeys() + if 'LIVENESS' not in keys: + return False, phy_port_dict + + (state, c) = self.db_sel.select(timeout) + if state == self.db_sel_timeout: + status = True + elif state != self.db_sel_object: + status = False + else: + (key, op, fvp) = self.db_sel_tbl.pop() + phy_port_dict[key] = op + + return status, phy_port_dict + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 index a11c77f7cc24..55fd79a875ea 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 @@ -177,6 +177,9 @@ } }, "QUEUE": { + "{{ port_names_active }}|0-1" : { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" + }, "{{ port_names_active }}|3-4" : { "scheduler" : "[SCHEDULER|scheduler.0]", "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" From cfe01f19e4d8fcac23310868dddd02ae5047c3ba Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 24 Sep 2018 16:35:01 -0700 Subject: [PATCH 1635/1833] Separate syncd service from swss service (#2051) * [swss.sh] refactor ssh service script code - Move checks and waits to helper functions. - Remove early returns from code stream Signed-off-by: Ying Xie * [swss.sh] Add debug log for service state changes Signed-off-by: Ying Xie * [syncd] Separate out syncd service from swss service Still make them start/stop/restart synchronously so existing scripts continue working. Signed-off-by: Ying Xie * Remove extra 'After' in swss service and remove syncd docker warm boot code Syncd warm boot needs more thinking, we can put it back once the work flow has been defined and ready for coding/testing. * [syncd] syncd start/stop/restart shouldn't affect swss state Semi-detach syncd service state change from swss: - swss state change still chase syncd service to follow except warm boot - syncd state change will only affect itself. Signed-off-by: Ying Xie * add missing '{' --- .../build_templates/sonic_debian_extension.j2 | 3 +- files/build_templates/swss.service.j2 | 5 - files/build_templates/syncd.service.j2 | 24 +++ files/scripts/swss.sh | 144 +++++++++++------- files/scripts/syncd.sh | 123 +++++++++++++++ 5 files changed, 242 insertions(+), 57 deletions(-) create mode 100644 files/build_templates/syncd.service.j2 create mode 100755 files/scripts/syncd.sh diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 318c83f5f218..9217e77bff68 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -293,8 +293,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys {% endif %} -# Copy swss service script +# Copy swss and syncd service script sudo LANG=C cp $SCRIPTS_DIR/swss.sh $FILESYSTEM_ROOT/usr/local/bin/swss.sh +sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh # Copy systemd timer configuration # It implements delayed start of services diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 61fff9721aed..8b8d7b42d1ee 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -8,11 +8,6 @@ Requires=nps-modules-4.9.0-7-amd64.service {% endif %} After=database.service updategraph.service After=interfaces-config.service -{% if sonic_asic_platform == 'broadcom' %} -After=opennsl-modules-4.9.0-7-amd64.service -{% elif sonic_asic_platform == 'nephos' %} -After=nps-modules-4.9.0-7-amd64.service -{% endif %} [Service] User=root diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 new file mode 100644 index 000000000000..38b208e74b0b --- /dev/null +++ b/files/build_templates/syncd.service.j2 @@ -0,0 +1,24 @@ +[Unit] +Description=syncd service +Requires=database.service updategraph.service +{% if sonic_asic_platform == 'broadcom' %} +Requires=opennsl-modules-4.9.0-7-amd64.service +{% elif sonic_asic_platform == 'nephos' %} +Requires=nps-modules-4.9.0-7-amd64.service +{% endif %} +After=database.service updategraph.service +After=interfaces-config.service +{% if sonic_asic_platform == 'broadcom' %} +After=opennsl-modules-4.9.0-7-amd64.service +{% elif sonic_asic_platform == 'nephos' %} +After=nps-modules-4.9.0-7-amd64.service +{% endif %} + +[Service] +User=root +Environment=sonic_asic_platform={{ sonic_asic_platform }} +ExecStart=/usr/local/bin/syncd.sh start +ExecStop=/usr/local/bin/syncd.sh stop + +[Install] +WantedBy=multi-user.target diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 0873deb37c8e..22f1f0d668dd 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -1,6 +1,56 @@ #!/bin/bash -start() { +SERVICE="swss" +PEER="syncd" +DEBUGLOG="/tmp/swss-syncd-debug.log" +LOCKFILE="/tmp/swss-syncd-lock" + +function debug() +{ + /bin/echo `date` "- $1" >> ${DEBUGLOG} +} + +function lock_service_state_change() +{ + debug "Locking ${LOCKFILE} from ${SERVICE} service" + + exec {LOCKFD}>${LOCKFILE} + /usr/bin/flock -x ${LOCKFD} + trap "/usr/bin/flock -u ${LOCKFD}" 0 2 3 15 + + debug "Locked ${LOCKFILE} (${LOCKFD}) from ${SERVICE} service" +} + +function unlock_service_state_change() +{ + debug "Unlocking ${LOCKFILE} (${LOCKFD}) from ${SERVICE} service" + /usr/bin/flock -u ${LOCKFD} +} + +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` + if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then + WARM_BOOT="true" + else + WARM_BOOT="false" + fi +} + +function validate_restart_count() +{ + if [[ x"$WARM_BOOT" == x"true" ]]; then + RESTART_COUNT=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_TABLE|orchagent" restart_count` + # We have to make sure db data has not been flushed. + if [[ -z "$RESTART_COUNT" ]]; then + WARM_BOOT="false" + fi + fi +} + +function wait_for_database_service() +{ # 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; @@ -10,66 +60,58 @@ start() { until [[ $(/usr/bin/docker exec database redis-cli -n 4 GET "CONFIG_DB_INITIALIZED") ]]; do sleep 1; done +} - SYSTEM_WARM_START=`/usr/bin/docker exec database redis-cli -n 4 HGET "WARM_RESTART|system" enable` - SWSS_WARM_START=`/usr/bin/docker exec database redis-cli -n 4 HGET "WARM_RESTART|swss" enable` - # if warm start enabled, just do swss docker start. - # Don't flush DB or try to start other modules. - if [[ "$SYSTEM_WARM_START" == "true" ]] || [[ "$SWSS_WARM_START" == "true" ]]; then - RESTART_COUNT=`redis-cli -n 6 hget "WARM_RESTART_TABLE|orchagent" restart_count` - # We have to make sure db data has not been flushed. - if [[ -n "$RESTART_COUNT" ]]; then - /usr/bin/swss.sh start - /usr/bin/swss.sh attach - return 0 - fi - fi +start() { + debug "Starting ${SERVICE} service..." + + lock_service_state_change + + wait_for_database_service + check_warm_boot + validate_restart_count - # Flush DB - /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 - /usr/bin/docker exec database redis-cli -n 6 FLUSHDB - - # platform specific tasks - if [ x$sonic_asic_platform == x'mellanox' ]; then - FAST_BOOT=1 - /usr/bin/mst start - /usr/bin/mlnx-fw-upgrade.sh - /etc/init.d/sxdkernel start - /sbin/modprobe i2c-dev - /etc/mlnx/mlnx-hw-management start - elif [ x$sonic_asic_platform == x'cavium' ]; then - /etc/init.d/xpnet.sh start + debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." + + # Don't flush DB during warm boot + if [[ x"$WARM_BOOT" != x"true" ]]; then + /usr/bin/docker exec database redis-cli -n 0 FLUSHDB + /usr/bin/docker exec database redis-cli -n 2 FLUSHDB + /usr/bin/docker exec database redis-cli -n 5 FLUSHDB + /usr/bin/docker exec database redis-cli -n 6 FLUSHDB fi - # start swss and syncd docker - /usr/bin/swss.sh start - /usr/bin/syncd.sh start - /usr/bin/swss.sh attach + # start service docker + /usr/bin/${SERVICE}.sh start + debug "Started ${SERVICE} service..." + + # 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 } stop() { - /usr/bin/swss.sh stop + debug "Stopping ${SERVICE} service..." - SYSTEM_WARM_START=`redis-cli -n 4 hget "WARM_RESTART|system" enable` - SWSS_WARM_START=`redis-cli -n 4 hget "WARM_RESTART|swss" enable` - # if warm start enabled, just stop swss docker, then return - if [[ "$SYSTEM_WARM_START" == "true" ]] || [[ "$SWSS_WARM_START" == "true" ]]; then - return 0 - fi + [[ -f ${LOCKFILE} ]] || /usr/bin/touch ${LOCKFILE} + + lock_service_state_change + check_warm_boot + debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." + + /usr/bin/${SERVICE}.sh stop + debug "Stopped ${SERVICE} service..." - /usr/bin/syncd.sh stop + # Unlock has to happen before reaching out to peer service + unlock_service_state_change - # platform specific tasks - if [ x$sonic_asic_platform == x'mellanox' ]; then - /etc/mlnx/mlnx-hw-management stop - /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 + # if warm start enabled or peer lock exists, don't stop peer service docker + if [[ x"$WARM_BOOT" != x"true" ]]; then + /bin/systemctl stop ${PEER} fi } diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh new file mode 100755 index 000000000000..2ceb0c21b3fc --- /dev/null +++ b/files/scripts/syncd.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +SERVICE="syncd" +PEER="swss" +DEBUGLOG="/tmp/swss-syncd-debug.log" +LOCKFILE="/tmp/swss-syncd-lock" + +function debug() +{ + /bin/echo `date` "- $1" >> ${DEBUGLOG} +} + +function lock_service_state_change() +{ + debug "Locking ${LOCKFILE} from ${SERVICE} service" + + exec {LOCKFD}>${LOCKFILE} + /usr/bin/flock -x ${LOCKFD} + trap "/usr/bin/flock -u ${LOCKFD}" 0 2 3 15 + + debug "Locked ${LOCKFILE} (${LOCKFD}) from ${SERVICE} service" +} + +function unlock_service_state_change() +{ + debug "Unlocking ${LOCKFILE} (${LOCKFD}) from ${SERVICE} service" + /usr/bin/flock -u ${LOCKFD} +} + +function check_warm_boot() +{ + SYSTEM_WARM_START=`/usr/bin/redis-cli -n 4 hget "WARM_RESTART|system" enable` + # SYSTEM_WARM_START could be empty, always make WARM_BOOT meaningful. + if [[ x"$SYSTEM_WARM_START" == x"true" ]]; then + WARM_BOOT="true" + else + WARM_BOOT="false" + fi +} + +function wait_for_database_service() +{ + # 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 +} + +start() { + debug "Starting ${SERVICE} service..." + + lock_service_state_change + + wait_for_database_service + check_warm_boot + + debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." + + # Don't flush DB during warm boot + if [[ x"$WARM_BOOT" != x"true" ]]; then + /usr/bin/docker exec database redis-cli -n 1 FLUSHDB + + # platform specific tasks + if [ x$sonic_asic_platform == x'mellanox' ]; then + FAST_BOOT=1 + /usr/bin/mst start + /usr/bin/mlnx-fw-upgrade.sh + /etc/init.d/sxdkernel start + /sbin/modprobe i2c-dev + /etc/mlnx/mlnx-hw-management start + elif [ x$sonic_asic_platform == x'cavium' ]; then + /etc/init.d/xpnet.sh start + fi + fi + + # start service docker + /usr/bin/${SERVICE}.sh start + debug "Started ${SERVICE} service..." + + unlock_service_state_change + /usr/bin/${SERVICE}.sh attach +} + +stop() { + debug "Stopping ${SERVICE} service..." + + lock_service_state_change + check_warm_boot + debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." + + /usr/bin/${SERVICE}.sh stop + debug "Stopped ${SERVICE} service..." + + # if warm start enabled, don't stop peer service docker + if [[ x"$WARM_BOOT" != x"true" ]]; then + # platform specific tasks + if [ x$sonic_asic_platform == x'mellanox' ]; then + /etc/mlnx/mlnx-hw-management stop + /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 + fi + + unlock_service_state_change +} + +case "$1" in + start|stop) + $1 + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac From 9b2a5943bdef58fedaf4fb005cf69d9913a08d88 Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Tue, 25 Sep 2018 01:24:31 -0700 Subject: [PATCH 1636/1833] [devices]: Add new hwsku Arista-7050-Q31S4 (#2075) --- .../Arista-7050-Q31S4/buffers.json.j2 | 3 + .../Arista-7050-Q31S4/buffers_defaults_t1.j2 | 49 ++ .../Arista-7050-Q31S4/hwsku-init | 1 + .../Arista-7050-Q31S4/pg_profile_lookup.ini | 14 + .../Arista-7050-Q31S4/port_config.ini | 36 + .../Arista-7050-Q31S4/qos.json.j2 | 148 ++++ .../Arista-7050-Q31S4/sai.profile | 1 + .../td2-a7050-q31s4-31x40G-4x10G.config.bcm | 676 ++++++++++++++++++ .../Arista-7050-QX-32S/hwsku-init | 1 + 9 files changed, 929 insertions(+) create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers.json.j2 create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers_defaults_t1.j2 create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/hwsku-init create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/pg_profile_lookup.ini create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/port_config.ini create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/qos.json.j2 create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/sai.profile create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/td2-a7050-q31s4-31x40G-4x10G.config.bcm create mode 100644 device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers.json.j2 new file mode 100644 index 000000000000..b67cf577ab75 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers.json.j2 @@ -0,0 +1,3 @@ +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} + diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..f72e3eb06fb5 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers_defaults_t1.j2 @@ -0,0 +1,49 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {% if PORT_ALL.append("Ethernet0") %}{% endif %} + {% if PORT_ALL.append("Ethernet1") %}{% endif %} + {% if PORT_ALL.append("Ethernet2") %}{% endif %} + {% if PORT_ALL.append("Ethernet3") %}{% endif %} + {% for port_idx in range(1,32) %} + {% if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{% endif %} + {% endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "12766208", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "12766208", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "8072396", + "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-Q31S4/hwsku-init b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/hwsku-init new file mode 100644 index 000000000000..c005241e4b6a --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/hwsku-init @@ -0,0 +1 @@ +echo 1 > /sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/mux diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/pg_profile_lookup.ini new file mode 100644 index 000000000000..f961fd33b138 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/pg_profile_lookup.ini @@ -0,0 +1,14 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 41808 18432 40560 -4 2496 + 40000 5m 41808 18432 40560 -4 2496 + 50000 5m 41808 18432 40560 -4 2496 + 100000 5m 41808 18432 40560 -4 2496 + 10000 40m 41808 18432 40560 -4 2496 + 40000 40m 41808 18432 40560 -4 2496 + 50000 40m 41808 18432 40560 -4 2496 + 100000 40m 41808 18432 40560 -4 2496 + 10000 300m 41808 18432 40560 -4 2496 + 40000 300m 41808 18432 40560 -4 2496 + 50000 300m 41808 18432 40560 -4 2496 + 100000 300m 41808 18432 40560 -4 2496 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/port_config.ini new file mode 100644 index 000000000000..dafdb570e9cc --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/port_config.ini @@ -0,0 +1,36 @@ +# name lanes alias index +Ethernet0 9 Ethernet1 1 +Ethernet1 10 Ethernet2 2 +Ethernet2 11 Ethernet3 3 +Ethernet3 12 Ethernet4 4 +Ethernet4 13,14,15,16 Ethernet6/1 6 +Ethernet8 17,18,19,20 Ethernet7/1 7 +Ethernet12 21,22,23,24 Ethernet8/1 8 +Ethernet16 29,30,31,32 Ethernet9/1 9 +Ethernet20 25,26,27,28 Ethernet10/1 10 +Ethernet24 33,34,35,36 Ethernet11/1 11 +Ethernet28 37,38,39,40 Ethernet12/1 12 +Ethernet32 45,46,47,48 Ethernet13/1 13 +Ethernet36 41,42,43,44 Ethernet14/1 14 +Ethernet40 49,50,51,52 Ethernet15/1 15 +Ethernet44 53,54,55,56 Ethernet16/1 16 +Ethernet48 69,70,71,72 Ethernet17/1 17 +Ethernet52 65,66,67,68 Ethernet18/1 18 +Ethernet56 73,74,75,76 Ethernet19/1 19 +Ethernet60 77,78,79,80 Ethernet20/1 20 +Ethernet64 93,94,95,96 Ethernet21/1 21 +Ethernet68 89,90,91,92 Ethernet22/1 22 +Ethernet72 97,98,99,100 Ethernet23/1 23 +Ethernet76 101,102,103,104 Ethernet24/1 24 +Ethernet80 109,110,111,112 Ethernet25/1 25 +Ethernet84 105,106,107,108 Ethernet26/1 26 +Ethernet88 121,122,123,124 Ethernet27/1 27 +Ethernet92 125,126,127,128 Ethernet28/1 28 +Ethernet96 61,62,63,64 Ethernet29 29 +Ethernet100 57,58,59,60 Ethernet30 30 +Ethernet104 81,82,83,84 Ethernet31 31 +Ethernet108 85,86,87,88 Ethernet32 32 +Ethernet112 117,118,119,120 Ethernet33 33 +Ethernet116 113,114,115,116 Ethernet34 34 +Ethernet120 1,2,3,4 Ethernet35 35 +Ethernet124 5,6,7,8 Ethernet36 36 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/qos.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/qos.json.j2 new file mode 100644 index 000000000000..1accac3ddd0d --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/qos.json.j2 @@ -0,0 +1,148 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"312000", + "red_min_threshold":"104000", + "yellow_max_threshold":"312000", + "yellow_min_threshold":"104000", + "green_max_threshold":"312000", + "green_min_threshold":"104000" + } + }, + "QUEUE": { + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { + "scheduler" : "[SCHEDULER|scheduler.0]" + }, + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3" : { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|4" : { + "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + }, + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, + "Ethernet0,Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { + "scheduler" : "[SCHEDULER|scheduler.2]" + } + } +} diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/sai.profile b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/sai.profile new file mode 100644 index 000000000000..9a50433cabdc --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-a7050-q31s4-31x40G-4x10G.config.bcm diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/td2-a7050-q31s4-31x40G-4x10G.config.bcm b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/td2-a7050-q31s4-31x40G-4x10G.config.bcm new file mode 100644 index 000000000000..9be3064af257 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/td2-a7050-q31s4-31x40G-4x10G.config.bcm @@ -0,0 +1,676 @@ +arl_clean_timeout_usec=15000000 +bcm_num_cos.0=8 +bcm_stat_flags=1 +bcm_stat_jumbo.0=9236 +cdma_timeout_usec.0=15000000 +dma_desc_timeout_usec.0=15000000 +higig2_hdr_mode.0=1 +ipv6_lpm_128b_enable.0=2 +l2xmsg_mode.0=1 +max_vp_lags.0=0 +mdio_output_delay=0x0d +miim_intr_enable.0=0 +module_64ports.0=0 +os=unix +pbmp_oversubscribe.0=0x1fffffffffffffffffffffffffe +pbmp_xport_xe.0=0x1fffffffffffffffffffffffffe +phy_an_c37_1.0=3 +phy_an_c37_5.0=3 +phy_an_c37_9.0=3 +phy_an_c37_13.0=3 +phy_an_c37_17.0=3 +phy_an_c37_21.0=3 +phy_an_c37_25.0=3 +phy_an_c37_29.0=3 +phy_an_c37_33.0=3 +phy_an_c37_37.0=3 +phy_an_c37_41.0=3 +phy_an_c37_45.0=3 +phy_an_c37_49.0=3 +phy_an_c37_53.0=3 +phy_an_c37_57.0=3 +phy_an_c37_61.0=3 +phy_an_c37_65.0=3 +phy_an_c37_69.0=3 +phy_an_c37_73.0=3 +phy_an_c37_77.0=3 +phy_an_c37_81.0=3 +phy_an_c37_85.0=3 +phy_an_c37_89.0=3 +phy_an_c37_93.0=3 +phy_an_c37_97.0=0 +phy_an_c37_98.0=0 +phy_an_c37_99.0=0 +phy_an_c37_100.0=0 +phy_an_c37_101.0=0 +phy_an_c37_102.0=0 +phy_an_c37_103.0=0 +phy_an_c37_104.0=0 +phy_an_c73_1.0=0 +phy_an_c73_5.0=0 +phy_an_c73_9.0=0 +phy_an_c73_13.0=0 +phy_an_c73_17.0=0 +phy_an_c73_21.0=0 +phy_an_c73_25.0=0 +phy_an_c73_29.0=0 +phy_an_c73_33.0=0 +phy_an_c73_37.0=0 +phy_an_c73_41.0=0 +phy_an_c73_45.0=0 +phy_an_c73_49.0=0 +phy_an_c73_53.0=0 +phy_an_c73_57.0=0 +phy_an_c73_61.0=0 +phy_an_c73_65.0=0 +phy_an_c73_69.0=0 +phy_an_c73_73.0=0 +phy_an_c73_77.0=0 +phy_an_c73_81.0=0 +phy_an_c73_85.0=0 +phy_an_c73_89.0=0 +phy_an_c73_93.0=0 +phy_an_c73_97.0=2 +phy_an_c73_98.0=2 +phy_an_c73_99.0=2 +phy_an_c73_100.0=2 +phy_an_c73_101.0=2 +phy_an_c73_102.0=2 +phy_an_c73_103.0=2 +phy_an_c73_104.0=2 +phy_xaui_rx_polarity_flip_1.0=0x0 +phy_xaui_rx_polarity_flip_5.0=0x0 +phy_xaui_rx_polarity_flip_9.0=0x4 +phy_xaui_rx_polarity_flip_13.0=0x0 +phy_xaui_rx_polarity_flip_17.0=0xb +phy_xaui_rx_polarity_flip_21.0=0x3 +phy_xaui_rx_polarity_flip_25.0=0xb +phy_xaui_rx_polarity_flip_29.0=0xf +phy_xaui_rx_polarity_flip_33.0=0xb +phy_xaui_rx_polarity_flip_37.0=0x3 +phy_xaui_rx_polarity_flip_41.0=0xb +phy_xaui_rx_polarity_flip_45.0=0x0 +phy_xaui_rx_polarity_flip_49.0=0x4 +phy_xaui_rx_polarity_flip_53.0=0xc +phy_xaui_rx_polarity_flip_57.0=0x4 +phy_xaui_rx_polarity_flip_61.0=0x0 +phy_xaui_rx_polarity_flip_65.0=0xb +phy_xaui_rx_polarity_flip_69.0=0x3 +phy_xaui_rx_polarity_flip_73.0=0xb +phy_xaui_rx_polarity_flip_77.0=0xf +phy_xaui_rx_polarity_flip_81.0=0xb +phy_xaui_rx_polarity_flip_85.0=0x3 +phy_xaui_rx_polarity_flip_89.0=0x4 +phy_xaui_rx_polarity_flip_93.0=0x0 +phy_xaui_rx_polarity_flip_97.0=0xb +phy_xaui_rx_polarity_flip_98.0=0x3 +phy_xaui_rx_polarity_flip_99.0=0x4 +phy_xaui_rx_polarity_flip_100.0=0x0 +phy_xaui_rx_polarity_flip_101.0=0x0 +phy_xaui_rx_polarity_flip_102.0=0xe +phy_xaui_rx_polarity_flip_103.0=0x0 +phy_xaui_rx_polarity_flip_104.0=0x0 +phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_5.0=0x0 +phy_xaui_tx_polarity_flip_9.0=0x2 +phy_xaui_tx_polarity_flip_13.0=0x0 +phy_xaui_tx_polarity_flip_17.0=0xd +phy_xaui_tx_polarity_flip_21.0=0xc +phy_xaui_tx_polarity_flip_25.0=0xd +phy_xaui_tx_polarity_flip_29.0=0xf +phy_xaui_tx_polarity_flip_33.0=0xd +phy_xaui_tx_polarity_flip_37.0=0xc +phy_xaui_tx_polarity_flip_41.0=0xd +phy_xaui_tx_polarity_flip_45.0=0x0 +phy_xaui_tx_polarity_flip_49.0=0x2 +phy_xaui_tx_polarity_flip_53.0=0x3 +phy_xaui_tx_polarity_flip_57.0=0x2 +phy_xaui_tx_polarity_flip_61.0=0x0 +phy_xaui_tx_polarity_flip_65.0=0xd +phy_xaui_tx_polarity_flip_69.0=0xc +phy_xaui_tx_polarity_flip_73.0=0xd +phy_xaui_tx_polarity_flip_77.0=0xf +phy_xaui_tx_polarity_flip_81.0=0xd +phy_xaui_tx_polarity_flip_85.0=0xc +phy_xaui_tx_polarity_flip_89.0=0x2 +phy_xaui_tx_polarity_flip_93.0=0x0 +phy_xaui_tx_polarity_flip_97.0=0xd +phy_xaui_tx_polarity_flip_98.0=0xc +phy_xaui_tx_polarity_flip_99.0=0x2 +phy_xaui_tx_polarity_flip_100.0=0x0 +phy_xaui_tx_polarity_flip_101.0=0x0 +phy_xaui_tx_polarity_flip_102.0=0x7 +phy_xaui_tx_polarity_flip_103.0=0x2 +phy_xaui_tx_polarity_flip_104.0=0x0 +port_init_autoneg_1.0=0 +port_init_autoneg_5.0=0 +port_init_autoneg_9.0=0 +port_init_autoneg_13.0=0 +port_init_autoneg_17.0=0 +port_init_autoneg_21.0=0 +port_init_autoneg_25.0=0 +port_init_autoneg_29.0=0 +port_init_autoneg_33.0=0 +port_init_autoneg_37.0=0 +port_init_autoneg_41.0=0 +port_init_autoneg_45.0=0 +port_init_autoneg_49.0=0 +port_init_autoneg_53.0=0 +port_init_autoneg_57.0=0 +port_init_autoneg_61.0=0 +port_init_autoneg_65.0=0 +port_init_autoneg_69.0=0 +port_init_autoneg_73.0=0 +port_init_autoneg_77.0=0 +port_init_autoneg_81.0=0 +port_init_autoneg_85.0=0 +port_init_autoneg_89.0=0 +port_init_autoneg_93.0=0 +port_init_autoneg_97.0=0 +port_init_autoneg_98.0=0 +port_init_autoneg_99.0=0 +port_init_autoneg_100.0=0 +port_init_autoneg_101.0=0 +port_init_autoneg_102.0=0 +port_init_autoneg_103.0=0 +port_init_autoneg_104.0=0 +port_init_cl72.0=0 +portmap_1.0=9:10 +portmap_2.0=10:10 +portmap_3.0=11:10 +portmap_4.0=12:10 +portmap_5.0=13:40 +portmap_9.0=17:40 +portmap_13.0=21:40 +portmap_17.0=29:40 +portmap_21.0=25:40 +portmap_25.0=33:40 +portmap_29.0=37:40 +portmap_33.0=45:40 +portmap_37.0=41:40 +portmap_41.0=49:40 +portmap_45.0=53:40 +portmap_49.0=69:40 +portmap_53.0=65:40 +portmap_57.0=73:40 +portmap_61.0=77:40 +portmap_65.0=93:40 +portmap_69.0=89:40 +portmap_73.0=97:40 +portmap_77.0=101:40 +portmap_81.0=109:40 +portmap_85.0=105:40 +portmap_89.0=121:40 +portmap_93.0=125:40 +portmap_97.0=61:40 +portmap_98.0=57:40 +portmap_99.0=81:40 +portmap_100.0=85:40 +portmap_101.0=117:40 +portmap_102.0=113:40 +portmap_103.0=1:40 +portmap_104.0=5:40 +scache_filename=/tmp/scache +schan_intr_enable=0 +serdes_firmware_mode_1.0=2 +serdes_firmware_mode_5.0=2 +serdes_firmware_mode_9.0=2 +serdes_firmware_mode_13.0=2 +serdes_firmware_mode_17.0=2 +serdes_firmware_mode_21.0=2 +serdes_firmware_mode_25.0=2 +serdes_firmware_mode_29.0=2 +serdes_firmware_mode_33.0=2 +serdes_firmware_mode_37.0=2 +serdes_firmware_mode_41.0=2 +serdes_firmware_mode_45.0=2 +serdes_firmware_mode_49.0=2 +serdes_firmware_mode_53.0=2 +serdes_firmware_mode_57.0=2 +serdes_firmware_mode_61.0=2 +serdes_firmware_mode_65.0=2 +serdes_firmware_mode_69.0=2 +serdes_firmware_mode_73.0=2 +serdes_firmware_mode_77.0=2 +serdes_firmware_mode_81.0=2 +serdes_firmware_mode_85.0=2 +serdes_firmware_mode_89.0=2 +serdes_firmware_mode_93.0=2 +serdes_firmware_mode_97.0=2 +serdes_firmware_mode_98.0=2 +serdes_firmware_mode_99.0=2 +serdes_firmware_mode_100.0=2 +serdes_firmware_mode_101.0=2 +serdes_firmware_mode_102.0=2 +serdes_firmware_mode_103.0=2 +serdes_firmware_mode_104.0=2 +stable_size=0x2000000 +tdma_timeout_usec.0=15000000 +tslam_timeout_usec.0=15000000 +xgxs_lcpll_xtal_refclk.0=1 +xgxs_rx_lane_map_1.0=0x0123 +xgxs_rx_lane_map_5.0=0x0321 +xgxs_rx_lane_map_9.0=0x1302 +xgxs_rx_lane_map_13.0=0x0213 +xgxs_rx_lane_map_17.0=0x1302 +xgxs_rx_lane_map_21.0=0x1302 +xgxs_rx_lane_map_25.0=0x1302 +xgxs_rx_lane_map_29.0=0x0213 +xgxs_rx_lane_map_33.0=0x1302 +xgxs_rx_lane_map_37.0=0x1302 +xgxs_rx_lane_map_41.0=0x1302 +xgxs_rx_lane_map_45.0=0x0213 +xgxs_rx_lane_map_49.0=0x1302 +xgxs_rx_lane_map_53.0=0x1302 +xgxs_rx_lane_map_57.0=0x1302 +xgxs_rx_lane_map_61.0=0x0213 +xgxs_rx_lane_map_65.0=0x1302 +xgxs_rx_lane_map_69.0=0x1302 +xgxs_rx_lane_map_73.0=0x1302 +xgxs_rx_lane_map_77.0=0x0213 +xgxs_rx_lane_map_81.0=0x1302 +xgxs_rx_lane_map_85.0=0x1302 +xgxs_rx_lane_map_89.0=0x1302 +xgxs_rx_lane_map_93.0=0x0213 +xgxs_rx_lane_map_97.0=0x1302 +xgxs_rx_lane_map_98.0=0x1302 +xgxs_rx_lane_map_99.0=0x1302 +xgxs_rx_lane_map_100.0=0x0213 +xgxs_rx_lane_map_101.0=0x0213 +xgxs_rx_lane_map_102.0=0x1302 +xgxs_rx_lane_map_103.0=0x0123 +xgxs_rx_lane_map_104.0=0x2031 +xgxs_tx_lane_map_1.0=0x3210 +xgxs_tx_lane_map_5.0=0x0321 +xgxs_tx_lane_map_9.0=0x2031 +xgxs_tx_lane_map_13.0=0x0213 +xgxs_tx_lane_map_17.0=0x2031 +xgxs_tx_lane_map_21.0=0x2031 +xgxs_tx_lane_map_25.0=0x2031 +xgxs_tx_lane_map_29.0=0x0213 +xgxs_tx_lane_map_33.0=0x2031 +xgxs_tx_lane_map_37.0=0x2031 +xgxs_tx_lane_map_41.0=0x2031 +xgxs_tx_lane_map_45.0=0x0213 +xgxs_tx_lane_map_49.0=0x2031 +xgxs_tx_lane_map_53.0=0x2031 +xgxs_tx_lane_map_57.0=0x2031 +xgxs_tx_lane_map_61.0=0x0213 +xgxs_tx_lane_map_65.0=0x2031 +xgxs_tx_lane_map_69.0=0x2031 +xgxs_tx_lane_map_73.0=0x2031 +xgxs_tx_lane_map_77.0=0x0213 +xgxs_tx_lane_map_81.0=0x2031 +xgxs_tx_lane_map_85.0=0x2031 +xgxs_tx_lane_map_89.0=0x2031 +xgxs_tx_lane_map_93.0=0x0213 +xgxs_tx_lane_map_97.0=0x2031 +xgxs_tx_lane_map_98.0=0x2031 +xgxs_tx_lane_map_99.0=0x2031 +xgxs_tx_lane_map_100.0=0x0213 +xgxs_tx_lane_map_101.0=0x0213 +xgxs_tx_lane_map_102.0=0x2031 +xgxs_tx_lane_map_103.0=0x3120 +xgxs_tx_lane_map_104.0=0x1302 + +# tuning parameters +serdes_preemphasis_lane0_1.0=0x81f7 +serdes_preemphasis_lane1_1.0=0x81f7 +serdes_preemphasis_lane2_1.0=0x81f7 +serdes_preemphasis_lane3_1.0=0x81f7 +serdes_pre_driver_current_lane0_5.0=0x7 +serdes_driver_current_lane0_5.0=0x7 +serdes_preemphasis_lane0_5.0=0xc2f0 +serdes_pre_driver_current_lane1_5.0=0x7 +serdes_driver_current_lane1_5.0=0x7 +serdes_preemphasis_lane1_5.0=0xc2f0 +serdes_pre_driver_current_lane2_5.0=0x7 +serdes_driver_current_lane2_5.0=0x7 +serdes_preemphasis_lane2_5.0=0xc2f0 +serdes_pre_driver_current_lane3_5.0=0x7 +serdes_driver_current_lane3_5.0=0x7 +serdes_preemphasis_lane3_5.0=0xc2f0 +serdes_pre_driver_current_lane0_9.0=0x7 +serdes_driver_current_lane0_9.0=0x7 +serdes_preemphasis_lane0_9.0=0xbb10 +serdes_pre_driver_current_lane1_9.0=0x7 +serdes_driver_current_lane1_9.0=0x7 +serdes_preemphasis_lane1_9.0=0xbb10 +serdes_pre_driver_current_lane2_9.0=0x7 +serdes_driver_current_lane2_9.0=0x7 +serdes_preemphasis_lane2_9.0=0xbb10 +serdes_pre_driver_current_lane3_9.0=0x7 +serdes_driver_current_lane3_9.0=0x7 +serdes_preemphasis_lane3_9.0=0xbb10 +serdes_pre_driver_current_lane0_13.0=0x7 +serdes_driver_current_lane0_13.0=0x7 +serdes_preemphasis_lane0_13.0=0xbb10 +serdes_pre_driver_current_lane1_13.0=0x7 +serdes_driver_current_lane1_13.0=0x7 +serdes_preemphasis_lane1_13.0=0xbb10 +serdes_pre_driver_current_lane2_13.0=0x7 +serdes_driver_current_lane2_13.0=0x7 +serdes_preemphasis_lane2_13.0=0xbb10 +serdes_pre_driver_current_lane3_13.0=0x7 +serdes_driver_current_lane3_13.0=0x7 +serdes_preemphasis_lane3_13.0=0xbb10 +serdes_pre_driver_current_lane0_17.0=0x6 +serdes_driver_current_lane0_17.0=0x6 +serdes_preemphasis_lane0_17.0=0xb720 +serdes_pre_driver_current_lane1_17.0=0x6 +serdes_driver_current_lane1_17.0=0x6 +serdes_preemphasis_lane1_17.0=0xb720 +serdes_pre_driver_current_lane2_17.0=0x6 +serdes_driver_current_lane2_17.0=0x6 +serdes_preemphasis_lane2_17.0=0xb720 +serdes_pre_driver_current_lane3_17.0=0x6 +serdes_driver_current_lane3_17.0=0x6 +serdes_preemphasis_lane3_17.0=0xb720 +serdes_pre_driver_current_lane0_21.0=0x7 +serdes_driver_current_lane0_21.0=0x7 +serdes_preemphasis_lane0_21.0=0xbb10 +serdes_pre_driver_current_lane1_21.0=0x7 +serdes_driver_current_lane1_21.0=0x7 +serdes_preemphasis_lane1_21.0=0xbb10 +serdes_pre_driver_current_lane2_21.0=0x7 +serdes_driver_current_lane2_21.0=0x7 +serdes_preemphasis_lane2_21.0=0xbb10 +serdes_pre_driver_current_lane3_21.0=0x7 +serdes_driver_current_lane3_21.0=0x7 +serdes_preemphasis_lane3_21.0=0xbb10 +serdes_pre_driver_current_lane0_25.0=0x5 +serdes_driver_current_lane0_25.0=0x5 +serdes_preemphasis_lane0_25.0=0xb720 +serdes_pre_driver_current_lane1_25.0=0x5 +serdes_driver_current_lane1_25.0=0x5 +serdes_preemphasis_lane1_25.0=0xb720 +serdes_pre_driver_current_lane2_25.0=0x5 +serdes_driver_current_lane2_25.0=0x5 +serdes_preemphasis_lane2_25.0=0xb720 +serdes_pre_driver_current_lane3_25.0=0x5 +serdes_driver_current_lane3_25.0=0x5 +serdes_preemphasis_lane3_25.0=0xb720 +serdes_pre_driver_current_lane0_29.0=0x5 +serdes_driver_current_lane0_29.0=0x5 +serdes_preemphasis_lane0_29.0=0xb720 +serdes_pre_driver_current_lane1_29.0=0x5 +serdes_driver_current_lane1_29.0=0x5 +serdes_preemphasis_lane1_29.0=0xb720 +serdes_pre_driver_current_lane2_29.0=0x5 +serdes_driver_current_lane2_29.0=0x5 +serdes_preemphasis_lane2_29.0=0xb720 +serdes_pre_driver_current_lane3_29.0=0x5 +serdes_driver_current_lane3_29.0=0x5 +serdes_preemphasis_lane3_29.0=0xb720 +serdes_pre_driver_current_lane0_33.0=0x4 +serdes_driver_current_lane0_33.0=0x4 +serdes_preemphasis_lane0_33.0=0xb720 +serdes_pre_driver_current_lane1_33.0=0x4 +serdes_driver_current_lane1_33.0=0x4 +serdes_preemphasis_lane1_33.0=0xb720 +serdes_pre_driver_current_lane2_33.0=0x4 +serdes_driver_current_lane2_33.0=0x4 +serdes_preemphasis_lane2_33.0=0xb720 +serdes_pre_driver_current_lane3_33.0=0x4 +serdes_driver_current_lane3_33.0=0x4 +serdes_preemphasis_lane3_33.0=0xb720 +serdes_pre_driver_current_lane0_37.0=0x5 +serdes_driver_current_lane0_37.0=0x5 +serdes_preemphasis_lane0_37.0=0xb720 +serdes_pre_driver_current_lane1_37.0=0x5 +serdes_driver_current_lane1_37.0=0x5 +serdes_preemphasis_lane1_37.0=0xb720 +serdes_pre_driver_current_lane2_37.0=0x5 +serdes_driver_current_lane2_37.0=0x5 +serdes_preemphasis_lane2_37.0=0xb720 +serdes_pre_driver_current_lane3_37.0=0x5 +serdes_driver_current_lane3_37.0=0x5 +serdes_preemphasis_lane3_37.0=0xb720 +serdes_pre_driver_current_lane0_41.0=0x3 +serdes_driver_current_lane0_41.0=0x3 +serdes_preemphasis_lane0_41.0=0xb330 +serdes_pre_driver_current_lane1_41.0=0x3 +serdes_driver_current_lane1_41.0=0x3 +serdes_preemphasis_lane1_41.0=0xb330 +serdes_pre_driver_current_lane2_41.0=0x3 +serdes_driver_current_lane2_41.0=0x3 +serdes_preemphasis_lane2_41.0=0xb330 +serdes_pre_driver_current_lane3_41.0=0x3 +serdes_driver_current_lane3_41.0=0x3 +serdes_preemphasis_lane3_41.0=0xb330 +serdes_pre_driver_current_lane0_45.0=0x4 +serdes_driver_current_lane0_45.0=0x4 +serdes_preemphasis_lane0_45.0=0xb720 +serdes_pre_driver_current_lane1_45.0=0x4 +serdes_driver_current_lane1_45.0=0x4 +serdes_preemphasis_lane1_45.0=0xb720 +serdes_pre_driver_current_lane2_45.0=0x4 +serdes_driver_current_lane2_45.0=0x4 +serdes_preemphasis_lane2_45.0=0xb720 +serdes_pre_driver_current_lane3_45.0=0x4 +serdes_driver_current_lane3_45.0=0x4 +serdes_preemphasis_lane3_45.0=0xb720 +serdes_pre_driver_current_lane0_49.0=0x3 +serdes_driver_current_lane0_49.0=0x3 +serdes_preemphasis_lane0_49.0=0xb330 +serdes_pre_driver_current_lane1_49.0=0x3 +serdes_driver_current_lane1_49.0=0x3 +serdes_preemphasis_lane1_49.0=0xb330 +serdes_pre_driver_current_lane2_49.0=0x3 +serdes_driver_current_lane2_49.0=0x3 +serdes_preemphasis_lane2_49.0=0xb330 +serdes_pre_driver_current_lane3_49.0=0x3 +serdes_driver_current_lane3_49.0=0x3 +serdes_preemphasis_lane3_49.0=0xb330 +serdes_pre_driver_current_lane0_53.0=0x4 +serdes_driver_current_lane0_53.0=0x4 +serdes_preemphasis_lane0_53.0=0xb720 +serdes_pre_driver_current_lane1_53.0=0x4 +serdes_driver_current_lane1_53.0=0x4 +serdes_preemphasis_lane1_53.0=0xb720 +serdes_pre_driver_current_lane2_53.0=0x4 +serdes_driver_current_lane2_53.0=0x4 +serdes_preemphasis_lane2_53.0=0xb720 +serdes_pre_driver_current_lane3_53.0=0x4 +serdes_driver_current_lane3_53.0=0x4 +serdes_preemphasis_lane3_53.0=0xb720 +serdes_pre_driver_current_lane0_57.0=0x3 +serdes_driver_current_lane0_57.0=0x3 +serdes_preemphasis_lane0_57.0=0xb330 +serdes_pre_driver_current_lane1_57.0=0x3 +serdes_driver_current_lane1_57.0=0x3 +serdes_preemphasis_lane1_57.0=0xb330 +serdes_pre_driver_current_lane2_57.0=0x3 +serdes_driver_current_lane2_57.0=0x3 +serdes_preemphasis_lane2_57.0=0xb330 +serdes_pre_driver_current_lane3_57.0=0x3 +serdes_driver_current_lane3_57.0=0x3 +serdes_preemphasis_lane3_57.0=0xb330 +serdes_pre_driver_current_lane0_61.0=0x4 +serdes_driver_current_lane0_61.0=0x4 +serdes_preemphasis_lane0_61.0=0xb720 +serdes_pre_driver_current_lane1_61.0=0x4 +serdes_driver_current_lane1_61.0=0x4 +serdes_preemphasis_lane1_61.0=0xb720 +serdes_pre_driver_current_lane2_61.0=0x4 +serdes_driver_current_lane2_61.0=0x4 +serdes_preemphasis_lane2_61.0=0xb720 +serdes_pre_driver_current_lane3_61.0=0x4 +serdes_driver_current_lane3_61.0=0x4 +serdes_preemphasis_lane3_61.0=0xb720 +serdes_pre_driver_current_lane0_65.0=0x4 +serdes_driver_current_lane0_65.0=0x4 +serdes_preemphasis_lane0_65.0=0xb720 +serdes_pre_driver_current_lane1_65.0=0x4 +serdes_driver_current_lane1_65.0=0x4 +serdes_preemphasis_lane1_65.0=0xb720 +serdes_pre_driver_current_lane2_65.0=0x4 +serdes_driver_current_lane2_65.0=0x4 +serdes_preemphasis_lane2_65.0=0xb720 +serdes_pre_driver_current_lane3_65.0=0x4 +serdes_driver_current_lane3_65.0=0x4 +serdes_preemphasis_lane3_65.0=0xb720 +serdes_pre_driver_current_lane0_69.0=0x4 +serdes_driver_current_lane0_69.0=0x4 +serdes_preemphasis_lane0_69.0=0xb720 +serdes_pre_driver_current_lane1_69.0=0x4 +serdes_driver_current_lane1_69.0=0x4 +serdes_preemphasis_lane1_69.0=0xb720 +serdes_pre_driver_current_lane2_69.0=0x4 +serdes_driver_current_lane2_69.0=0x4 +serdes_preemphasis_lane2_69.0=0xb720 +serdes_pre_driver_current_lane3_69.0=0x4 +serdes_driver_current_lane3_69.0=0x4 +serdes_preemphasis_lane3_69.0=0xb720 +serdes_pre_driver_current_lane0_73.0=0x4 +serdes_driver_current_lane0_73.0=0x4 +serdes_preemphasis_lane0_73.0=0xb720 +serdes_pre_driver_current_lane1_73.0=0x4 +serdes_driver_current_lane1_73.0=0x4 +serdes_preemphasis_lane1_73.0=0xb720 +serdes_pre_driver_current_lane2_73.0=0x4 +serdes_driver_current_lane2_73.0=0x4 +serdes_preemphasis_lane2_73.0=0xb720 +serdes_pre_driver_current_lane3_73.0=0x4 +serdes_driver_current_lane3_73.0=0x4 +serdes_preemphasis_lane3_73.0=0xb720 +serdes_pre_driver_current_lane0_77.0=0x5 +serdes_driver_current_lane0_77.0=0x5 +serdes_preemphasis_lane0_77.0=0xb720 +serdes_pre_driver_current_lane1_77.0=0x5 +serdes_driver_current_lane1_77.0=0x5 +serdes_preemphasis_lane1_77.0=0xb720 +serdes_pre_driver_current_lane2_77.0=0x5 +serdes_driver_current_lane2_77.0=0x5 +serdes_preemphasis_lane2_77.0=0xb720 +serdes_pre_driver_current_lane3_77.0=0x5 +serdes_driver_current_lane3_77.0=0x5 +serdes_preemphasis_lane3_77.0=0xb720 +serdes_pre_driver_current_lane0_81.0=0x5 +serdes_driver_current_lane0_81.0=0x5 +serdes_preemphasis_lane0_81.0=0xb720 +serdes_pre_driver_current_lane1_81.0=0x5 +serdes_driver_current_lane1_81.0=0x5 +serdes_preemphasis_lane1_81.0=0xb720 +serdes_pre_driver_current_lane2_81.0=0x5 +serdes_driver_current_lane2_81.0=0x5 +serdes_preemphasis_lane2_81.0=0xb720 +serdes_pre_driver_current_lane3_81.0=0x5 +serdes_driver_current_lane3_81.0=0x5 +serdes_preemphasis_lane3_81.0=0xb720 +serdes_pre_driver_current_lane0_85.0=0x5 +serdes_driver_current_lane0_85.0=0x5 +serdes_preemphasis_lane0_85.0=0xb720 +serdes_pre_driver_current_lane1_85.0=0x5 +serdes_driver_current_lane1_85.0=0x5 +serdes_preemphasis_lane1_85.0=0xb720 +serdes_pre_driver_current_lane2_85.0=0x5 +serdes_driver_current_lane2_85.0=0x5 +serdes_preemphasis_lane2_85.0=0xb720 +serdes_pre_driver_current_lane3_85.0=0x5 +serdes_driver_current_lane3_85.0=0x5 +serdes_preemphasis_lane3_85.0=0xb720 +serdes_pre_driver_current_lane0_89.0=0x6 +serdes_driver_current_lane0_89.0=0x6 +serdes_preemphasis_lane0_89.0=0xb720 +serdes_pre_driver_current_lane1_89.0=0x6 +serdes_driver_current_lane1_89.0=0x6 +serdes_preemphasis_lane1_89.0=0xb720 +serdes_pre_driver_current_lane2_89.0=0x6 +serdes_driver_current_lane2_89.0=0x6 +serdes_preemphasis_lane2_89.0=0xb720 +serdes_pre_driver_current_lane3_89.0=0x6 +serdes_driver_current_lane3_89.0=0x6 +serdes_preemphasis_lane3_89.0=0xb720 +serdes_pre_driver_current_lane0_93.0=0x7 +serdes_driver_current_lane0_93.0=0x7 +serdes_preemphasis_lane0_93.0=0xbb10 +serdes_pre_driver_current_lane1_93.0=0x7 +serdes_driver_current_lane1_93.0=0x7 +serdes_preemphasis_lane1_93.0=0xbb10 +serdes_pre_driver_current_lane2_93.0=0x7 +serdes_driver_current_lane2_93.0=0x7 +serdes_preemphasis_lane2_93.0=0xbb10 +serdes_pre_driver_current_lane3_93.0=0x7 +serdes_driver_current_lane3_93.0=0x7 +serdes_preemphasis_lane3_93.0=0xbb10 +serdes_pre_driver_current_lane0_97.0=0x5 +serdes_driver_current_lane0_97.0=0x5 +serdes_preemphasis_lane0_97.0=0xb720 +serdes_pre_driver_current_lane1_97.0=0x5 +serdes_driver_current_lane1_97.0=0x5 +serdes_preemphasis_lane1_97.0=0xb720 +serdes_pre_driver_current_lane2_97.0=0x5 +serdes_driver_current_lane2_97.0=0x5 +serdes_preemphasis_lane2_97.0=0xb720 +serdes_pre_driver_current_lane3_97.0=0x5 +serdes_driver_current_lane3_97.0=0x5 +serdes_preemphasis_lane3_97.0=0xb720 +serdes_pre_driver_current_lane0_98.0=0x6 +serdes_driver_current_lane0_98.0=0x6 +serdes_preemphasis_lane0_98.0=0xb720 +serdes_pre_driver_current_lane1_98.0=0x6 +serdes_driver_current_lane1_98.0=0x6 +serdes_preemphasis_lane1_98.0=0xb720 +serdes_pre_driver_current_lane2_98.0=0x6 +serdes_driver_current_lane2_98.0=0x6 +serdes_preemphasis_lane2_98.0=0xb720 +serdes_pre_driver_current_lane3_98.0=0x6 +serdes_driver_current_lane3_98.0=0x6 +serdes_preemphasis_lane3_98.0=0xb720 +serdes_pre_driver_current_lane0_99.0=0x5 +serdes_driver_current_lane0_99.0=0x5 +serdes_preemphasis_lane0_99.0=0xb720 +serdes_pre_driver_current_lane1_99.0=0x5 +serdes_driver_current_lane1_99.0=0x5 +serdes_preemphasis_lane1_99.0=0xb720 +serdes_pre_driver_current_lane2_99.0=0x5 +serdes_driver_current_lane2_99.0=0x5 +serdes_preemphasis_lane2_99.0=0xb720 +serdes_pre_driver_current_lane3_99.0=0x5 +serdes_driver_current_lane3_99.0=0x5 +serdes_preemphasis_lane3_99.0=0xb720 +serdes_pre_driver_current_lane0_100.0=0x7 +serdes_driver_current_lane0_100.0=0x7 +serdes_preemphasis_lane0_100.0=0xbb10 +serdes_pre_driver_current_lane1_100.0=0x7 +serdes_driver_current_lane1_100.0=0x7 +serdes_preemphasis_lane1_100.0=0xbb10 +serdes_pre_driver_current_lane2_100.0=0x7 +serdes_driver_current_lane2_100.0=0x7 +serdes_preemphasis_lane2_100.0=0xbb10 +serdes_pre_driver_current_lane3_100.0=0x7 +serdes_driver_current_lane3_100.0=0x7 +serdes_preemphasis_lane3_100.0=0xbb10 +serdes_pre_driver_current_lane0_101.0=0x7 +serdes_driver_current_lane0_101.0=0x7 +serdes_preemphasis_lane0_101.0=0xbb10 +serdes_pre_driver_current_lane1_101.0=0x7 +serdes_driver_current_lane1_101.0=0x7 +serdes_preemphasis_lane1_101.0=0xbb10 +serdes_pre_driver_current_lane2_101.0=0x7 +serdes_driver_current_lane2_101.0=0x7 +serdes_preemphasis_lane2_101.0=0xbb10 +serdes_pre_driver_current_lane3_101.0=0x7 +serdes_driver_current_lane3_101.0=0x7 +serdes_preemphasis_lane3_101.0=0xbb10 +serdes_pre_driver_current_lane0_102.0=0x7 +serdes_driver_current_lane0_102.0=0x7 +serdes_preemphasis_lane0_102.0=0xbb10 +serdes_pre_driver_current_lane1_102.0=0x7 +serdes_driver_current_lane1_102.0=0x7 +serdes_preemphasis_lane1_102.0=0xbb10 +serdes_pre_driver_current_lane2_102.0=0x7 +serdes_driver_current_lane2_102.0=0x7 +serdes_preemphasis_lane2_102.0=0xbb10 +serdes_pre_driver_current_lane3_102.0=0x7 +serdes_driver_current_lane3_102.0=0x7 +serdes_preemphasis_lane3_102.0=0xbb10 +serdes_preemphasis_lane0_103.0=0x81f4 +serdes_preemphasis_lane1_103.0=0x81f4 +serdes_preemphasis_lane2_103.0=0x81f4 +serdes_preemphasis_lane3_103.0=0x81f4 +serdes_preemphasis_lane0_104.0=0x81f5 +serdes_preemphasis_lane1_104.0=0x81f5 +serdes_preemphasis_lane2_104.0=0x81f5 +serdes_preemphasis_lane3_104.0=0x81f5 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init new file mode 100644 index 000000000000..49639a743436 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init @@ -0,0 +1 @@ +echo 0 > /sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/mux From 542b4332c85816b84c35f154e1ae7c97e1164285 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 24 Sep 2018 14:56:37 -0700 Subject: [PATCH 1637/1833] [hwsku-init] Introduce mechanism to run HWSKU specific initialization code (#2072) When there is HWSKU specific initialization needs to be performed, please add hwsku-init script under device folder, it will be invoked by swss before any subsequent initializations. Signed-off-by: Ying Xie --- dockers/docker-orchagent/start.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index a0d4ad646b27..cf78850451a7 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -6,6 +6,11 @@ sonic-cfggen -d -t /usr/share/sonic/templates/switch.json.j2 > /etc/swss/config. sonic-cfggen -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json sonic-cfggen -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json +# Executed HWSKU specific initialization tasks. +if [ -x /usr/share/sonic/hwsku/hwsku-init ]; then + /usr/share/sonic/hwsku/hwsku-init +fi + export platform=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform` rm -f /var/run/rsyslogd.pid From 22f631ad135be161d47388a632bf5c793e49c686 Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Tue, 25 Sep 2018 21:05:45 +0300 Subject: [PATCH 1638/1833] [mellanox] SAI pointer update (#2079) Signed-off-by: Stepan Blyschak --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 1689b43d5779..cdd76035703b 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.12.3-master -MLNX_SAI_REVISION = 71ae8c6d386f57a89742fc3261775b338bfc9c25 +MLNX_SAI_REVISION = 9b27abc4d69e86c39202d6d2f5e794aeb2974ba0 export MLNX_SAI_VERSION MLNX_SAI_REVISION From 0ed2ac36de006eb1b25735aa97a9301c4a394e4f Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 25 Sep 2018 15:58:35 -0700 Subject: [PATCH 1639/1833] [utilities] Update sonic-utilities submodule (#2082) Signed-off-by: Samuel Angebault --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index c14d917ec8e4..f78bba447a1a 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit c14d917ec8e45983bedef82460ea1903a595b19f +Subproject commit f78bba447a1aabac0d97801455bf144e9f4f1ece From 763982b70eab3d416adbf82882bd0891b504ba49 Mon Sep 17 00:00:00 2001 From: paavaanan Date: Wed, 26 Sep 2018 11:44:09 +0530 Subject: [PATCH 1640/1833] [devices]: Dell-S6100/Z9100 depmod fixes (#2071) --- .../debian/platform-modules-s6100.install | 2 +- .../debian/platform-modules-s6100.postinst | 4 ++++ .../debian/platform-modules-z9100.install | 2 +- .../debian/platform-modules-z9100.postinst | 6 ++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install index 2e57c0a045e3..7d56aee6e2f7 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install @@ -6,4 +6,4 @@ common/fstrim.timer etc/systemd/system common/fstrim.service etc/systemd/system s6100/scripts/platform_sensors.py usr/local/bin s6100/scripts/sensors usr/bin -s6100/systemd/platform-modules-s6100.service etc/systemd/system/multi-user.target.wants +s6100/systemd/platform-modules-s6100.service etc/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst index aeabe1abd27c..1c220633451d 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.postinst @@ -4,4 +4,8 @@ systemctl enable fstrim.timer systemctl start fstrim.timer +# Enable Dell-S6100-platform-service +depmod -a +systemctl enable platform-modules-s6100.service +systemctl start platform-modules-s6100.service #DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install index 8425d8fc7a0b..410dcf16ea1b 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install @@ -6,4 +6,4 @@ common/fstrim.service etc/systemd/system z9100/scripts/platform_sensors.py usr/local/bin z9100/scripts/sensors usr/bin z9100/cfg/z9100-modules.conf etc/modules-load.d -z9100/systemd/platform-modules-z9100.service etc/systemd/system/multi-user.target.wants +z9100/systemd/platform-modules-z9100.service etc/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst index b11ae1f274c4..61039dcd70d3 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.postinst @@ -4,4 +4,10 @@ systemctl enable fstrim.timer systemctl start fstrim.timer +# Enable Dell-Z9100-platform-service +depmod -a +systemctl enable platform-modules-z9100.service +systemctl start platform-modules-z9100.service + + #DEBHELPER# From d629f7599dc92b9eef3199f2bd2de2680162e20d Mon Sep 17 00:00:00 2001 From: "Kevin(Shengkai) Wang" Date: Thu, 27 Sep 2018 11:22:41 +0800 Subject: [PATCH 1641/1833] [kernel]: update sonic linux kernel submodule (#2084) * 90c4cdb 2018-09-22 | Fix a mlnx hardware-management issue (#61) Signed-off-by: Kevin Wang --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index a910776f0519..90c4cdb3be1a 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit a910776f051945689daa02c0e476576df560491a +Subproject commit 90c4cdb3be1a70be21abbaa92e15c01cd24164af From cfcaee978d548187feb53ecd37aed881484d11a5 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 26 Sep 2018 23:08:02 -0700 Subject: [PATCH 1642/1833] [swss]: Update sonic-swss-common submodule (#2087) [schema]: Define STATE_VRF_TABLE_NAME (#234) Signed-off-by: Shu0T1an ChenG --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index c6c9a9b3ea7b..ca1f29319321 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit c6c9a9b3ea7bd1d0db9ddb9d5efadff6caa2a9e6 +Subproject commit ca1f293193213f50dac2ccc268182efaf2f6687c From 794885eef9ef299ea59b450ef0e0ad346906d55a Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 26 Sep 2018 23:08:20 -0700 Subject: [PATCH 1643/1833] Update submodule: sonic-py-swsssdk (#2088) Signed-off-by: Qi Luo --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 9d36ad3b4d08..d67519c4a3af 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 9d36ad3b4d0850429a021d79b12ffcc194642d96 +Subproject commit d67519c4a3affb94da858f8fe96c37045d0d7e92 From 66e0d6bcc07e1688e1b32a38d4a2d276c7777553 Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Thu, 27 Sep 2018 09:27:52 +0300 Subject: [PATCH 1644/1833] [sonic-device-data] Fix config symlinks dereference (#2085) ('cp -H' -> 'cp -L') '-L' does what we need in this case From man cp ... -H follow command-line symbolic links in SOURCE ... -L, --dereference always follow symbolic links in SOURCE Signed-off-by: Stepan Blyschak --- src/sonic-device-data/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-device-data/Makefile b/src/sonic-device-data/Makefile index 911c8641a682..b258db960727 100644 --- a/src/sonic-device-data/Makefile +++ b/src/sonic-device-data/Makefile @@ -12,7 +12,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Create a new dir and copy all ONIE-platform-string-named dirs into it mkdir ./device - cp -r -H ../../../device/*/* ./device/ + cp -r -L ../../../device/*/* ./device/ # Build the package dpkg-buildpackage -rfakeroot -b -us -uc From 11ac4fe76ed5b78e1a8528e8bb2afd04212ad267 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 27 Sep 2018 01:11:18 -0700 Subject: [PATCH 1645/1833] [7050] Rename HWSKU Arista-7050-Q31S4 to Arista-7050QX-32S-S4Q31 (#2090) Signed-off-by: Ying Xie --- .../buffers.json.j2 | 0 .../buffers_defaults_t1.j2 | 0 .../{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/hwsku-init | 0 .../pg_profile_lookup.ini | 0 .../port_config.ini | 0 .../{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/qos.json.j2 | 0 .../{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/sai.profile | 0 .../td2-a7050-q31s4-31x40G-4x10G.config.bcm | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename device/arista/x86_64-arista_7050_qx32s/{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/buffers.json.j2 (100%) rename device/arista/x86_64-arista_7050_qx32s/{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/buffers_defaults_t1.j2 (100%) rename device/arista/x86_64-arista_7050_qx32s/{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/hwsku-init (100%) rename device/arista/x86_64-arista_7050_qx32s/{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/pg_profile_lookup.ini (100%) rename device/arista/x86_64-arista_7050_qx32s/{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/port_config.ini (100%) rename device/arista/x86_64-arista_7050_qx32s/{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/qos.json.j2 (100%) rename device/arista/x86_64-arista_7050_qx32s/{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/sai.profile (100%) rename device/arista/x86_64-arista_7050_qx32s/{Arista-7050-Q31S4 => Arista-7050QX-32S-S4Q31}/td2-a7050-q31s4-31x40G-4x10G.config.bcm (100%) diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers.json.j2 rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers.json.j2 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers_defaults_t1.j2 similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/buffers_defaults_t1.j2 rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/buffers_defaults_t1.j2 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/hwsku-init b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/hwsku-init rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/pg_profile_lookup.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/pg_profile_lookup.ini similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/pg_profile_lookup.ini rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/pg_profile_lookup.ini diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/port_config.ini b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/port_config.ini similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/port_config.ini rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/port_config.ini diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/qos.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/qos.json.j2 similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/qos.json.j2 rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/qos.json.j2 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/sai.profile b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/sai.profile similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/sai.profile rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/sai.profile diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/td2-a7050-q31s4-31x40G-4x10G.config.bcm b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm similarity index 100% rename from device/arista/x86_64-arista_7050_qx32s/Arista-7050-Q31S4/td2-a7050-q31s4-31x40G-4x10G.config.bcm rename to device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm From 1c7d50748e50f3f281a614527b2d90606341e5dc Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 27 Sep 2018 16:08:23 -0700 Subject: [PATCH 1646/1833] Update submodule: sonic-snmpagent (#2093) Signed-off-by: Qi Luo --- src/sonic-snmpagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index b7d915e2679c..8a628a527558 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit b7d915e2679c731bb47cb1fb2889bad76e6fe110 +Subproject commit 8a628a5275582123ce43e50ae4b7348790f1d2ef From f57dae054ef1e4e376223d24eaa43c3958cac1b7 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 27 Sep 2018 21:52:35 -0700 Subject: [PATCH 1647/1833] Update dbsyncd submodule (#2094) --- src/sonic-dbsyncd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd index eeb678cb44a3..1cdcffc08f6e 160000 --- a/src/sonic-dbsyncd +++ b/src/sonic-dbsyncd @@ -1 +1 @@ -Subproject commit eeb678cb44a37c15bd3250dc64d932c3ea33ac26 +Subproject commit 1cdcffc08f6ea1c3fc53f7aeeef5b5632124496f From bd96e097a9c8750eed599d1e0adec3bff6b029da Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 28 Sep 2018 14:16:45 -0700 Subject: [PATCH 1648/1833] [7050] device specific hwsku-init file needs execution privilege (#2101) Signed-off-by: Ying Xie --- .../arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init | 0 .../x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init mode change 100644 => 100755 device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init old mode 100644 new mode 100755 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init old mode 100644 new mode 100755 From e72d63cf927b36d875009936635d8e9733a42e9d Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 28 Sep 2018 21:27:41 -0700 Subject: [PATCH 1649/1833] [arista] Update Arista drivers submodule (#2097) * [arista] Update Arista drivers submodule * Fix 7050qx32 fancontrol for kernel 4.9 * Fix 7060cx32s fancontrol for kernel 4.9 * Install python3-yaml for sonic config tests * Fix 7260cx3 fancontrol for kernel 4.9 * Fix hwsku-init scripts and permissions * Preserve old_config folder in boot0 --- .../arista/x86_64-arista_7050_qx32/fancontrol | 2 +- .../Arista-7050-QX-32S/hwsku-init | 2 ++ .../Arista-7050QX-32S-S4Q31/hwsku-init | 2 ++ .../arista/x86_64-arista_7060_cx32s/fancontrol | 18 +++++++++--------- .../arista/x86_64-arista_7260cx3_64/fancontrol | 18 +++++++++--------- files/Aboot/boot0.j2 | 1 + .../barefoot/sonic-platform-modules-arista | 2 +- .../broadcom/sonic-platform-modules-arista | 2 +- sonic-slave-stretch/Dockerfile | 1 + 9 files changed, 27 insertions(+), 21 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32/fancontrol b/device/arista/x86_64-arista_7050_qx32/fancontrol index 02bf4d76dbec..1d94fcf7674c 100644 --- a/device/arista/x86_64-arista_7050_qx32/fancontrol +++ b/device/arista/x86_64-arista_7050_qx32/fancontrol @@ -1,5 +1,5 @@ INTERVAL=5 -DEVPATH=hwmon1=devices/platform/sb800-fans hwmon2=devices/pci0000:00/0000:00:09.0/0000:04:00.0/i2c-2/2-004c +DEVPATH=hwmon1=devices/platform/sb800-fans hwmon2=devices/pci0000:00/0000:00:09.0/0000:04:00.0/i2c-5/5-004c DEVNAME=hwmon1=fans hwmon2=max6658 FCTEMPS=hwmon1/pwm4=hwmon2/temp1_input hwmon1/pwm3=hwmon2/temp1_input hwmon1/pwm2=hwmon2/temp1_input hwmon1/pwm1=hwmon2/temp1_input FCFANS=hwmon1/pwm4=hwmon1/fan4_input hwmon1/pwm3=hwmon1/fan3_input hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm1=hwmon1/fan1_input diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init index 49639a743436..415bca984228 100755 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/hwsku-init @@ -1 +1,3 @@ +#!/bin/bash + echo 0 > /sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/mux diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init index c005241e4b6a..ffc913582aa7 100755 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init @@ -1 +1,3 @@ +#!/bin/bash + echo 1 > /sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/mux diff --git a/device/arista/x86_64-arista_7060_cx32s/fancontrol b/device/arista/x86_64-arista_7060_cx32s/fancontrol index e69f9d75acda..43f885a9f246 100644 --- a/device/arista/x86_64-arista_7060_cx32s/fancontrol +++ b/device/arista/x86_64-arista_7060_cx32s/fancontrol @@ -1,10 +1,10 @@ INTERVAL=5 -DEVPATH=hwmon1=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-2/2-001a hwmon3=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060 -DEVNAME=hwmon1=max6697 hwmon3=crow_cpld -FCTEMPS=hwmon3/pwm4=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input -FCFANS=hwmon3/pwm4=hwmon3/fan4_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm1=hwmon3/fan1_input -MINTEMP=hwmon3/pwm4=40 hwmon3/pwm3=40 hwmon3/pwm2=40 hwmon3/pwm1=40 -MINPWM=hwmon3/pwm4=179 hwmon3/pwm3=179 hwmon3/pwm2=179 hwmon3/pwm1=179 -MAXTEMP=hwmon3/pwm4=50 hwmon3/pwm3=50 hwmon3/pwm2=50 hwmon3/pwm1=50 -MINSTART=hwmon3/pwm4=179 hwmon3/pwm3=179 hwmon3/pwm2=179 hwmon3/pwm1=179 -MINSTOP=hwmon3/pwm4=179 hwmon3/pwm3=179 hwmon3/pwm2=179 hwmon3/pwm1=179 +DEVPATH=hwmon2=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-2/2-001a hwmon4=devices/pci0000:00/0000:00:02.2/0000:02:00.0/i2c-3/3-0060 +DEVNAME=hwmon2=max6697 hwmon4=crow_cpld +FCTEMPS=hwmon4/pwm4=hwmon2/temp1_input hwmon4/pwm3=hwmon2/temp1_input hwmon4/pwm2=hwmon2/temp1_input hwmon4/pwm1=hwmon2/temp1_input +FCFANS=hwmon4/pwm4=hwmon4/fan4_input hwmon4/pwm3=hwmon4/fan3_input hwmon4/pwm2=hwmon4/fan2_input hwmon4/pwm1=hwmon4/fan1_input +MINTEMP=hwmon4/pwm4=40 hwmon4/pwm3=40 hwmon4/pwm2=40 hwmon4/pwm1=40 +MINPWM=hwmon4/pwm4=179 hwmon4/pwm3=179 hwmon4/pwm2=179 hwmon4/pwm1=179 +MAXTEMP=hwmon4/pwm4=50 hwmon4/pwm3=50 hwmon4/pwm2=50 hwmon4/pwm1=50 +MINSTART=hwmon4/pwm4=179 hwmon4/pwm3=179 hwmon4/pwm2=179 hwmon4/pwm1=179 +MINSTOP=hwmon4/pwm4=179 hwmon4/pwm3=179 hwmon4/pwm2=179 hwmon4/pwm1=179 diff --git a/device/arista/x86_64-arista_7260cx3_64/fancontrol b/device/arista/x86_64-arista_7260cx3_64/fancontrol index c78f598ff111..2397d6d700c0 100644 --- a/device/arista/x86_64-arista_7260cx3_64/fancontrol +++ b/device/arista/x86_64-arista_7260cx3_64/fancontrol @@ -1,10 +1,10 @@ INTERVAL=5 -DEVPATH=hwmon1=devices/pci0000:00/0000:00:1c.0/0000:06:00.0/i2c-1/1-004c hwmon3=devices/pci0000:ff/0000:ff:0b.3/i2c-85/85-0060 -DEVNAME=hwmon1=max6658 hwmon3=rook_cpld -FCTEMPS=hwmon3/pwm4=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input -FCFANS=hwmon3/pwm4=hwmon3/fan4_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm1=hwmon3/fan1_input -MINTEMP=hwmon3/pwm4=50 hwmon3/pwm3=50 hwmon3/pwm2=50 hwmon3/pwm1=50 -MINPWM=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 -MAXTEMP=hwmon3/pwm4=60 hwmon3/pwm3=60 hwmon3/pwm2=60 hwmon3/pwm1=60 -MINSTART=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 -MINSTOP=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 +DEVPATH=hwmon2=devices/pci0000:00/0000:00:1c.0/0000:06:00.0/i2c-1/1-004c hwmon4=devices/pci0000:ff/0000:ff:0b.3/i2c-85/85-0060 +DEVNAME=hwmon2=max6658 hwmon4=rook_cpld +FCTEMPS=hwmon4/pwm4=hwmon2/temp1_input hwmon4/pwm3=hwmon2/temp1_input hwmon4/pwm2=hwmon2/temp1_input hwmon4/pwm1=hwmon2/temp1_input +FCFANS=hwmon4/pwm4=hwmon4/fan4_input hwmon4/pwm3=hwmon4/fan3_input hwmon4/pwm2=hwmon4/fan2_input hwmon4/pwm1=hwmon4/fan1_input +MINTEMP=hwmon4/pwm4=50 hwmon4/pwm3=50 hwmon4/pwm2=50 hwmon4/pwm1=50 +MINPWM=hwmon4/pwm4=128 hwmon4/pwm3=128 hwmon4/pwm2=128 hwmon4/pwm1=128 +MAXTEMP=hwmon4/pwm4=60 hwmon4/pwm3=60 hwmon4/pwm2=60 hwmon4/pwm1=60 +MINSTART=hwmon4/pwm4=128 hwmon4/pwm3=128 hwmon4/pwm2=128 hwmon4/pwm1=128 +MINSTOP=hwmon4/pwm4=128 hwmon4/pwm3=128 hwmon4/pwm2=128 hwmon4/pwm1=128 diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index b1f29ac89544..a476f5c27e9e 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -81,6 +81,7 @@ clean_flash() { [ $f != "boot-config" ] && [ $f != "$kernel_params" ] && [ $f != "$cmdline_base" ] && + [ $f != "old_config" ] && [ $f != "minigraph.xml" ] then rm -rf "$target_path/$f" diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index f705fe155859..ead22a71435b 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit f705fe155859084d7df916e580659394e1516f6c +Subproject commit ead22a71435b93058baef48f6ab3f5f057361366 diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index f705fe155859..ead22a71435b 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit f705fe155859084d7df916e580659394e1516f6c +Subproject commit ead22a71435b93058baef48f6ab3f5f057361366 diff --git a/sonic-slave-stretch/Dockerfile b/sonic-slave-stretch/Dockerfile index d34cfda71c06..eeac24ae8475 100644 --- a/sonic-slave-stretch/Dockerfile +++ b/sonic-slave-stretch/Dockerfile @@ -193,6 +193,7 @@ RUN apt-get update && apt-get install -y \ python-netaddr \ python-ipaddr \ python-yaml \ + python3-yaml \ # For lockfile procmail \ # For gtest From 034f472f46d04898c64ec850edd08113af50820e Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Fri, 28 Sep 2018 22:56:40 -0700 Subject: [PATCH 1650/1833] [minigraph parser] add basic support for MGMT_PORT (#2103) * [minigraph parser] add basic support for MGMT_PORT * Change method to determine local interface name --- src/sonic-config-engine/minigraph.py | 15 ++++++++++++++- src/sonic-config-engine/tests/test_cfggen.py | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index a978f5906eb7..a72eed754b8c 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -472,7 +472,20 @@ def parse_xml(filename, platform=None, port_config_file=None): if mgmt_routes: # TODO: differentiate v4 and v6 mgmt_intf.itervalues().next()['forced_mgmt_routes'] = mgmt_routes - results['MGMT_INTERFACE'] = mgmt_intf + results['MGMT_PORT'] = {} + results['MGMT_INTERFACE'] = {} + mgmt_intf_count = 0 + mgmt_alias_reverse_mapping = {} + for key in mgmt_intf: + alias = key[0] + if mgmt_alias_reverse_mapping.has_key(alias): + name = mgmt_alias_reverse_mapping[alias] + else: + name = 'eth' + str(mgmt_intf_count) + mgmt_intf_count += 1 + mgmt_alias_reverse_mapping[alias] = name + results['MGMT_PORT'][name] = {'alias': alias, 'admin_status': 'up'} + results['MGMT_INTERFACE'][(name, key[1])] = mgmt_intf[key] results['LOOPBACK_INTERFACE'] = lo_intfs phyport_intfs = {} diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 7ffdf61a4058..4ed8e4079f75 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -92,6 +92,11 @@ def test_minigraph_everflow(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'everflow0': {'src_ip': '10.1.0.32', 'dst_ip': '2.2.2.2'}}") + def test_minigraph_mgmt_ports(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v MGMT_PORT' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'eth0': {'alias': 'Management0', 'admin_status': 'up'}}") + def test_minigraph_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "INTERFACE.keys()"' output = self.run_script(argument) From 3c687744af9764198b27400d1df163719551540e Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sat, 29 Sep 2018 15:01:16 -0700 Subject: [PATCH 1651/1833] [common]: Update sonic-swss-common submodule (#2098) * VNET/VXLAN Tables * [schema]: Add MGMT_PORT_TABLE in state database Signed-off-by: Shu0T1an ChenG --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index ca1f29319321..882d899fa1ef 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit ca1f293193213f50dac2ccc268182efaf2f6687c +Subproject commit 882d899fa1ef0b65114454d9e92b27bfde998055 From c8e6b155040d2339b5e0438e8542e07400bf7636 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 1 Oct 2018 19:01:04 -0700 Subject: [PATCH 1652/1833] [syncd] warn shutdown syncd process when warm boot is enabled (#2078) * [syncd] warn shutdown syncd process when warm boot is enabled Signed-off-by: Ying Xie * [warmboot] mount folder to hold warmboot temporary files Signed-off-by: Ying Xie * Fix a typo --- files/scripts/syncd.sh | 15 +++++++++++++++ platform/broadcom/docker-syncd-brcm.mk | 1 + 2 files changed, 16 insertions(+) diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 2ceb0c21b3fc..ad3ddd164cde 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -56,6 +56,8 @@ start() { lock_service_state_change + mkdir -p /host/warmboot + wait_for_database_service check_warm_boot @@ -93,6 +95,19 @@ stop() { check_warm_boot debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." + if [[ x"$WARM_BOOT" == x"true" ]]; then + debug "Warm shutdown syncd process ..." + /usr/bin/docker exec -i syncd /usr/bin/syncd_request_shutdown --warm + + # wait until syncd quits gracefully + while docker top syncd | grep -q /usr/bin/syncd; do + sleep 0.1 + done + + /usr/bin/docker exec -i syncd /bin/sync + debug "Finished warm shutdown syncd process ..." + fi + /usr/bin/${SERVICE}.sh stop debug "Stopped ${SERVICE} service..." diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index 80da1446a9a8..088437060964 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -15,6 +15,7 @@ $(DOCKER_SYNCD_BRCM)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd $(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh From 593bcb1c1b9fcac052ed584f83de70813d1899ac Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Tue, 2 Oct 2018 20:36:28 +0800 Subject: [PATCH 1653/1833] [device] accton update driver and sync as5712-54x from 201807. (#2110) * [platform_accton] Remove dependency on particular version of linux. Signed-off-by: Polly Hsu * [platfrom] as5712-54x: update i2c_client for linux kernel 4.x. Signed-off-by: Polly Hsu * [platform] Update lastest optoe.c from https://github.com/opencomputeproject/oom/blob/master/optoe/optoe.c. Signed-off-by: roy_lee * [platform] rm optoe driver here. For it's inside the kernel. Signed-off-by: roy_lee * [platform] as5712-54x, merge the change of Azure/sonic-buildimage#2002 which is on branch 201807. Signed-off-by: roy_lee --- .../plugins/sfputil.py | 67 +- .../modules/i2c-mux-accton_as5712_54x_cpld.c | 1491 +++++++---------- .../as5712-54x/utils/accton_as5712_util.py | 148 +- .../as7716-32x/modules/optoe.c | 1148 ------------- .../debian/control | 9 +- 5 files changed, 792 insertions(+), 2071 deletions(-) delete mode 100755 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/optoe.c diff --git a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py index 9eee5b99fbd0..7c585ab2d6ef 100755 --- a/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py @@ -2,9 +2,9 @@ # # Platform-specific SFP transceiver interface for SONiC # - try: import time + import os from sonic_sfp.sfputilbase import SfpUtilBase except ImportError as e: raise ImportError("%s - required module not found" % str(e)) @@ -21,8 +21,14 @@ class SfpUtil(SfpUtilBase): BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/" BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" - BASE_CPLD2_PATH = "/sys/bus/i2c/devices/0-0061/" - BASE_CPLD3_PATH = "/sys/bus/i2c/devices/0-0062/" + BASE_CPLD2_PATH = "/sys/bus/i2c/devices/{0}-0061/" + BASE_CPLD3_PATH = "/sys/bus/i2c/devices/{0}-0062/" + I2C_BUS_ORDER = -1 + + #The sidebands of QSFP is different. + #present is in-order. + #But lp_mode and reset are not. + qsfp_sb_map = [1, 3, 5, 2, 4, 6] _port_to_is_present = {} _port_to_lp_mode = {} @@ -137,18 +143,30 @@ def __init__(self): SfpUtilBase.__init__(self) + #Two i2c buses might get flipped order, check them both. + def update_i2c_order(self): + if self.I2C_BUS_ORDER < 0: + eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + if os.path.exists(eeprom_path): + self.I2C_BUS_ORDER = 0 + eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + if os.path.exists(eeprom_path): + self.I2C_BUS_ORDER = 1 + return self.I2C_BUS_ORDER + def get_presence(self, port_num): # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: return False + order = self.update_i2c_order() if port_num < 24: - present_path = self.BASE_CPLD2_PATH + "module_present_" + str(self._port_to_i2c_mapping[port_num][0]) + present_path = self.BASE_CPLD2_PATH.format(order) else: - present_path = self.BASE_CPLD3_PATH + "module_present_" + str(self._port_to_i2c_mapping[port_num][0]) + present_path = self.BASE_CPLD3_PATH.format(order) + present_path = present_path + "module_present_" + str(self._port_to_i2c_mapping[port_num][0]) self.__port_to_is_present = present_path - try: val_file = open(self.__port_to_is_present) @@ -165,11 +183,21 @@ def get_presence(self, port_num): return False + def qsfp_sb_remap(self, port_num): + qsfp_start = self.qsfp_port_start + qsfp_index = self._port_to_i2c_mapping[port_num][0] - qsfp_start + qsfp_index = self.qsfp_sb_map[qsfp_index-1] + return qsfp_start+qsfp_index + def get_low_power_mode(self, port_num): if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: return False - lp_mode_path = self.BASE_CPLD3_PATH + "module_lp_mode_" + str(self._port_to_i2c_mapping[port_num][0]) + order = self.update_i2c_order() + lp_mode_path = self.BASE_CPLD3_PATH.format(order) + lp_mode_path = lp_mode_path + "module_lp_mode_" + q = self.qsfp_sb_remap(port_num) + lp_mode_path = lp_mode_path + str(q) try: val_file = open(lp_mode_path) @@ -190,7 +218,11 @@ def set_low_power_mode(self, port_num, lpmode): if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: return False - lp_mode_path = self.BASE_CPLD3_PATH + "module_lp_mode_" + str(self._port_to_i2c_mapping[port_num][0]) + order = self.update_i2c_order() + lp_mode_path = self.BASE_CPLD3_PATH.format(order) + lp_mode_path = lp_mode_path + "module_lp_mode_" + q = self.qsfp_sb_remap(port_num) + lp_mode_path = lp_mode_path + str(q) try: reg_file = open(lp_mode_path, 'r+') @@ -212,7 +244,11 @@ def reset(self, port_num): if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: return False - mod_rst_path = lp_mode_path = self.BASE_CPLD3_PATH + "module_reset_" + str(self._port_to_i2c_mapping[port_num][0]) + order = self.update_i2c_order() + lp_mode_path = self.BASE_CPLD3_PATH.format(order) + mod_rst_path = lp_mode_path + "module_reset_" + q = self.qsfp_sb_remap(port_num) + mod_rst_path = mod_rst_path + str(q) try: reg_file = open(mod_rst_path, 'r+') @@ -220,13 +256,15 @@ def reset(self, port_num): print "Error: unable to open file: %s" % str(e) return False - reg_value = '1' - - reg_file.write(reg_value) + #toggle reset + reg_file.seek(0) + reg_file.write('0') + time.sleep(1) + reg_file.seek(0) + reg_file.write('1') reg_file.close() - return True - + def get_transceiver_change_event(self): """ TODO: This function need to be implemented @@ -234,3 +272,4 @@ def get_transceiver_change_event(self): on this platform. """ raise NotImplementedError + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/i2c-mux-accton_as5712_54x_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/i2c-mux-accton_as5712_54x_cpld.c index d63cb14b5a67..ed097e6b30e8 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/i2c-mux-accton_as5712_54x_cpld.c +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/modules/i2c-mux-accton_as5712_54x_cpld.c @@ -1,33 +1,31 @@ /* - * I2C multiplexer + * An I2C multiplexer dirver for accton as5712 CPLD * - * Copyright (C) Brandon Chuang + * Copyright (C) 2015 Accton Technology Corporation. + * Brandon Chuang * * This module supports the accton cpld that hold the channel select * mechanism for other i2c slave devices, such as SFP. * This includes the: - * Accton as5712_54x CPLD1/CPLD2/CPLD3 + * Accton as5712_54x CPLD1/CPLD2/CPLD3 * * Based on: - * pca954x.c from Kumar Gala + * pca954x.c from Kumar Gala * Copyright (C) 2006 * * Based on: - * pca954x.c from Ken Harrenstien + * pca954x.c from Ken Harrenstien * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) * * Based on: - * i2c-virtual_cb.c from Brian Kuschak + * i2c-virtual_cb.c from Brian Kuschak * and - * pca9540.c from Jean Delvare . + * pca9540.c from Jean Delvare . * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ -#if 0 -#define DEBUG -#endif #include #include @@ -40,8 +38,8 @@ #include #include -#define I2C_RW_RETRY_COUNT 10 -#define I2C_RW_RETRY_INTERVAL 60 /* ms */ +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ #define NUM_OF_CPLD1_CHANS 0x0 #define NUM_OF_CPLD2_CHANS 0x18 @@ -49,12 +47,6 @@ #define CPLD_CHANNEL_SELECT_REG 0x2 #define CPLD_DESELECT_CHANNEL 0xFF -#if 0 -#define NUM_OF_ALL_CPLD_CHANS (NUM_OF_CPLD2_CHANS + NUM_OF_CPLD3_CHANS) -#endif - -#define ACCTON_I2C_CPLD_MUX_MAX_NCHANS NUM_OF_CPLD3_CHANS - static LIST_HEAD(cpld_client_list); static struct mutex list_lock; @@ -71,24 +63,13 @@ enum cpld_mux_type { struct as5712_54x_cpld_data { enum cpld_mux_type type; - struct i2c_adapter *virt_adaps[ACCTON_I2C_CPLD_MUX_MAX_NCHANS]; - u8 last_chan; /* last register value */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) struct i2c_client *client; - struct i2c_mux_core *muxc; -#endif + u8 last_chan; /* last register value */ + struct device *hwmon_dev; struct mutex update_lock; }; -#if 0 -/* The mapping table between mux index and adapter index - array index : the mux index - the content : adapter index - */ -static int mux_adap_map[NUM_OF_ALL_CPLD_CHANS]; -#endif - struct chip_desc { u8 nchans; u8 deselectChan; @@ -97,16 +78,16 @@ struct chip_desc { /* Provide specs for the PCA954x types we know about */ static const struct chip_desc chips[] = { [as5712_54x_cpld1] = { - .nchans = NUM_OF_CPLD1_CHANS, - .deselectChan = CPLD_DESELECT_CHANNEL, + .nchans = NUM_OF_CPLD1_CHANS, + .deselectChan = CPLD_DESELECT_CHANNEL, }, [as5712_54x_cpld2] = { - .nchans = NUM_OF_CPLD2_CHANS, - .deselectChan = CPLD_DESELECT_CHANNEL, + .nchans = NUM_OF_CPLD2_CHANS, + .deselectChan = CPLD_DESELECT_CHANNEL, }, [as5712_54x_cpld3] = { - .nchans = NUM_OF_CPLD3_CHANS, - .deselectChan = CPLD_DESELECT_CHANNEL, + .nchans = NUM_OF_CPLD3_CHANS, + .deselectChan = CPLD_DESELECT_CHANNEL, } }; @@ -118,229 +99,215 @@ static const struct i2c_device_id as5712_54x_cpld_mux_id[] = { }; MODULE_DEVICE_TABLE(i2c, as5712_54x_cpld_mux_id); -#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index -#define TRANSCEIVER_TXDISABLE_ATTR_ID(index) MODULE_TXDISABLE_##index -#define TRANSCEIVER_RXLOS_ATTR_ID(index) MODULE_RXLOS_##index -#define TRANSCEIVER_TXFAULT_ATTR_ID(index) MODULE_TXFAULT_##index -#define TRANSCEIVER_LPMODE_ATTR_ID(index) MODULE_LPMODE_##index -#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_TXDISABLE_ATTR_ID(index) MODULE_TXDISABLE_##index +#define TRANSCEIVER_RXLOS_ATTR_ID(index) MODULE_RXLOS_##index +#define TRANSCEIVER_TXFAULT_ATTR_ID(index) MODULE_TXFAULT_##index enum as5712_54x_cpld1_sysfs_attributes { - CPLD_VERSION, - ACCESS, - MODULE_PRESENT_ALL, - MODULE_RXLOS_ALL, - /* transceiver attributes */ - TRANSCEIVER_PRESENT_ATTR_ID(1), - TRANSCEIVER_PRESENT_ATTR_ID(2), - TRANSCEIVER_PRESENT_ATTR_ID(3), - TRANSCEIVER_PRESENT_ATTR_ID(4), - TRANSCEIVER_PRESENT_ATTR_ID(5), - TRANSCEIVER_PRESENT_ATTR_ID(6), - TRANSCEIVER_PRESENT_ATTR_ID(7), - TRANSCEIVER_PRESENT_ATTR_ID(8), - TRANSCEIVER_PRESENT_ATTR_ID(9), - TRANSCEIVER_PRESENT_ATTR_ID(10), - TRANSCEIVER_PRESENT_ATTR_ID(11), - TRANSCEIVER_PRESENT_ATTR_ID(12), - TRANSCEIVER_PRESENT_ATTR_ID(13), - TRANSCEIVER_PRESENT_ATTR_ID(14), - TRANSCEIVER_PRESENT_ATTR_ID(15), - TRANSCEIVER_PRESENT_ATTR_ID(16), - TRANSCEIVER_PRESENT_ATTR_ID(17), - TRANSCEIVER_PRESENT_ATTR_ID(18), - TRANSCEIVER_PRESENT_ATTR_ID(19), - TRANSCEIVER_PRESENT_ATTR_ID(20), - TRANSCEIVER_PRESENT_ATTR_ID(21), - TRANSCEIVER_PRESENT_ATTR_ID(22), - TRANSCEIVER_PRESENT_ATTR_ID(23), - TRANSCEIVER_PRESENT_ATTR_ID(24), - TRANSCEIVER_PRESENT_ATTR_ID(25), - TRANSCEIVER_PRESENT_ATTR_ID(26), - TRANSCEIVER_PRESENT_ATTR_ID(27), - TRANSCEIVER_PRESENT_ATTR_ID(28), - TRANSCEIVER_PRESENT_ATTR_ID(29), - TRANSCEIVER_PRESENT_ATTR_ID(30), - TRANSCEIVER_PRESENT_ATTR_ID(31), - TRANSCEIVER_PRESENT_ATTR_ID(32), - TRANSCEIVER_PRESENT_ATTR_ID(33), - TRANSCEIVER_PRESENT_ATTR_ID(34), - TRANSCEIVER_PRESENT_ATTR_ID(35), - TRANSCEIVER_PRESENT_ATTR_ID(36), - TRANSCEIVER_PRESENT_ATTR_ID(37), - TRANSCEIVER_PRESENT_ATTR_ID(38), - TRANSCEIVER_PRESENT_ATTR_ID(39), - TRANSCEIVER_PRESENT_ATTR_ID(40), - TRANSCEIVER_PRESENT_ATTR_ID(41), - TRANSCEIVER_PRESENT_ATTR_ID(42), - TRANSCEIVER_PRESENT_ATTR_ID(43), - TRANSCEIVER_PRESENT_ATTR_ID(44), - TRANSCEIVER_PRESENT_ATTR_ID(45), - TRANSCEIVER_PRESENT_ATTR_ID(46), - TRANSCEIVER_PRESENT_ATTR_ID(47), - TRANSCEIVER_PRESENT_ATTR_ID(48), - TRANSCEIVER_PRESENT_ATTR_ID(49), - TRANSCEIVER_PRESENT_ATTR_ID(50), - TRANSCEIVER_PRESENT_ATTR_ID(51), - TRANSCEIVER_PRESENT_ATTR_ID(52), - TRANSCEIVER_PRESENT_ATTR_ID(53), - TRANSCEIVER_PRESENT_ATTR_ID(54), - TRANSCEIVER_TXDISABLE_ATTR_ID(1), - TRANSCEIVER_TXDISABLE_ATTR_ID(2), - TRANSCEIVER_TXDISABLE_ATTR_ID(3), - TRANSCEIVER_TXDISABLE_ATTR_ID(4), - TRANSCEIVER_TXDISABLE_ATTR_ID(5), - TRANSCEIVER_TXDISABLE_ATTR_ID(6), - TRANSCEIVER_TXDISABLE_ATTR_ID(7), - TRANSCEIVER_TXDISABLE_ATTR_ID(8), - TRANSCEIVER_TXDISABLE_ATTR_ID(9), - TRANSCEIVER_TXDISABLE_ATTR_ID(10), - TRANSCEIVER_TXDISABLE_ATTR_ID(11), - TRANSCEIVER_TXDISABLE_ATTR_ID(12), - TRANSCEIVER_TXDISABLE_ATTR_ID(13), - TRANSCEIVER_TXDISABLE_ATTR_ID(14), - TRANSCEIVER_TXDISABLE_ATTR_ID(15), - TRANSCEIVER_TXDISABLE_ATTR_ID(16), - TRANSCEIVER_TXDISABLE_ATTR_ID(17), - TRANSCEIVER_TXDISABLE_ATTR_ID(18), - TRANSCEIVER_TXDISABLE_ATTR_ID(19), - TRANSCEIVER_TXDISABLE_ATTR_ID(20), - TRANSCEIVER_TXDISABLE_ATTR_ID(21), - TRANSCEIVER_TXDISABLE_ATTR_ID(22), - TRANSCEIVER_TXDISABLE_ATTR_ID(23), - TRANSCEIVER_TXDISABLE_ATTR_ID(24), - TRANSCEIVER_TXDISABLE_ATTR_ID(25), - TRANSCEIVER_TXDISABLE_ATTR_ID(26), - TRANSCEIVER_TXDISABLE_ATTR_ID(27), - TRANSCEIVER_TXDISABLE_ATTR_ID(28), - TRANSCEIVER_TXDISABLE_ATTR_ID(29), - TRANSCEIVER_TXDISABLE_ATTR_ID(30), - TRANSCEIVER_TXDISABLE_ATTR_ID(31), - TRANSCEIVER_TXDISABLE_ATTR_ID(32), - TRANSCEIVER_TXDISABLE_ATTR_ID(33), - TRANSCEIVER_TXDISABLE_ATTR_ID(34), - TRANSCEIVER_TXDISABLE_ATTR_ID(35), - TRANSCEIVER_TXDISABLE_ATTR_ID(36), - TRANSCEIVER_TXDISABLE_ATTR_ID(37), - TRANSCEIVER_TXDISABLE_ATTR_ID(38), - TRANSCEIVER_TXDISABLE_ATTR_ID(39), - TRANSCEIVER_TXDISABLE_ATTR_ID(40), - TRANSCEIVER_TXDISABLE_ATTR_ID(41), - TRANSCEIVER_TXDISABLE_ATTR_ID(42), - TRANSCEIVER_TXDISABLE_ATTR_ID(43), - TRANSCEIVER_TXDISABLE_ATTR_ID(44), - TRANSCEIVER_TXDISABLE_ATTR_ID(45), - TRANSCEIVER_TXDISABLE_ATTR_ID(46), - TRANSCEIVER_TXDISABLE_ATTR_ID(47), - TRANSCEIVER_TXDISABLE_ATTR_ID(48), - TRANSCEIVER_RXLOS_ATTR_ID(1), - TRANSCEIVER_RXLOS_ATTR_ID(2), - TRANSCEIVER_RXLOS_ATTR_ID(3), - TRANSCEIVER_RXLOS_ATTR_ID(4), - TRANSCEIVER_RXLOS_ATTR_ID(5), - TRANSCEIVER_RXLOS_ATTR_ID(6), - TRANSCEIVER_RXLOS_ATTR_ID(7), - TRANSCEIVER_RXLOS_ATTR_ID(8), - TRANSCEIVER_RXLOS_ATTR_ID(9), - TRANSCEIVER_RXLOS_ATTR_ID(10), - TRANSCEIVER_RXLOS_ATTR_ID(11), - TRANSCEIVER_RXLOS_ATTR_ID(12), - TRANSCEIVER_RXLOS_ATTR_ID(13), - TRANSCEIVER_RXLOS_ATTR_ID(14), - TRANSCEIVER_RXLOS_ATTR_ID(15), - TRANSCEIVER_RXLOS_ATTR_ID(16), - TRANSCEIVER_RXLOS_ATTR_ID(17), - TRANSCEIVER_RXLOS_ATTR_ID(18), - TRANSCEIVER_RXLOS_ATTR_ID(19), - TRANSCEIVER_RXLOS_ATTR_ID(20), - TRANSCEIVER_RXLOS_ATTR_ID(21), - TRANSCEIVER_RXLOS_ATTR_ID(22), - TRANSCEIVER_RXLOS_ATTR_ID(23), - TRANSCEIVER_RXLOS_ATTR_ID(24), - TRANSCEIVER_RXLOS_ATTR_ID(25), - TRANSCEIVER_RXLOS_ATTR_ID(26), - TRANSCEIVER_RXLOS_ATTR_ID(27), - TRANSCEIVER_RXLOS_ATTR_ID(28), - TRANSCEIVER_RXLOS_ATTR_ID(29), - TRANSCEIVER_RXLOS_ATTR_ID(30), - TRANSCEIVER_RXLOS_ATTR_ID(31), - TRANSCEIVER_RXLOS_ATTR_ID(32), - TRANSCEIVER_RXLOS_ATTR_ID(33), - TRANSCEIVER_RXLOS_ATTR_ID(34), - TRANSCEIVER_RXLOS_ATTR_ID(35), - TRANSCEIVER_RXLOS_ATTR_ID(36), - TRANSCEIVER_RXLOS_ATTR_ID(37), - TRANSCEIVER_RXLOS_ATTR_ID(38), - TRANSCEIVER_RXLOS_ATTR_ID(39), - TRANSCEIVER_RXLOS_ATTR_ID(40), - TRANSCEIVER_RXLOS_ATTR_ID(41), - TRANSCEIVER_RXLOS_ATTR_ID(42), - TRANSCEIVER_RXLOS_ATTR_ID(43), - TRANSCEIVER_RXLOS_ATTR_ID(44), - TRANSCEIVER_RXLOS_ATTR_ID(45), - TRANSCEIVER_RXLOS_ATTR_ID(46), - TRANSCEIVER_RXLOS_ATTR_ID(47), - TRANSCEIVER_RXLOS_ATTR_ID(48), - TRANSCEIVER_TXFAULT_ATTR_ID(1), - TRANSCEIVER_TXFAULT_ATTR_ID(2), - TRANSCEIVER_TXFAULT_ATTR_ID(3), - TRANSCEIVER_TXFAULT_ATTR_ID(4), - TRANSCEIVER_TXFAULT_ATTR_ID(5), - TRANSCEIVER_TXFAULT_ATTR_ID(6), - TRANSCEIVER_TXFAULT_ATTR_ID(7), - TRANSCEIVER_TXFAULT_ATTR_ID(8), - TRANSCEIVER_TXFAULT_ATTR_ID(9), - TRANSCEIVER_TXFAULT_ATTR_ID(10), - TRANSCEIVER_TXFAULT_ATTR_ID(11), - TRANSCEIVER_TXFAULT_ATTR_ID(12), - TRANSCEIVER_TXFAULT_ATTR_ID(13), - TRANSCEIVER_TXFAULT_ATTR_ID(14), - TRANSCEIVER_TXFAULT_ATTR_ID(15), - TRANSCEIVER_TXFAULT_ATTR_ID(16), - TRANSCEIVER_TXFAULT_ATTR_ID(17), - TRANSCEIVER_TXFAULT_ATTR_ID(18), - TRANSCEIVER_TXFAULT_ATTR_ID(19), - TRANSCEIVER_TXFAULT_ATTR_ID(20), - TRANSCEIVER_TXFAULT_ATTR_ID(21), - TRANSCEIVER_TXFAULT_ATTR_ID(22), - TRANSCEIVER_TXFAULT_ATTR_ID(23), - TRANSCEIVER_TXFAULT_ATTR_ID(24), - TRANSCEIVER_TXFAULT_ATTR_ID(25), - TRANSCEIVER_TXFAULT_ATTR_ID(26), - TRANSCEIVER_TXFAULT_ATTR_ID(27), - TRANSCEIVER_TXFAULT_ATTR_ID(28), - TRANSCEIVER_TXFAULT_ATTR_ID(29), - TRANSCEIVER_TXFAULT_ATTR_ID(30), - TRANSCEIVER_TXFAULT_ATTR_ID(31), - TRANSCEIVER_TXFAULT_ATTR_ID(32), - TRANSCEIVER_TXFAULT_ATTR_ID(33), - TRANSCEIVER_TXFAULT_ATTR_ID(34), - TRANSCEIVER_TXFAULT_ATTR_ID(35), - TRANSCEIVER_TXFAULT_ATTR_ID(36), - TRANSCEIVER_TXFAULT_ATTR_ID(37), - TRANSCEIVER_TXFAULT_ATTR_ID(38), - TRANSCEIVER_TXFAULT_ATTR_ID(39), - TRANSCEIVER_TXFAULT_ATTR_ID(40), - TRANSCEIVER_TXFAULT_ATTR_ID(41), - TRANSCEIVER_TXFAULT_ATTR_ID(42), - TRANSCEIVER_TXFAULT_ATTR_ID(43), - TRANSCEIVER_TXFAULT_ATTR_ID(44), - TRANSCEIVER_TXFAULT_ATTR_ID(45), - TRANSCEIVER_TXFAULT_ATTR_ID(46), - TRANSCEIVER_TXFAULT_ATTR_ID(47), - TRANSCEIVER_TXFAULT_ATTR_ID(48), - TRANSCEIVER_LPMODE_ATTR_ID(49), - TRANSCEIVER_LPMODE_ATTR_ID(50), - TRANSCEIVER_LPMODE_ATTR_ID(51), - TRANSCEIVER_LPMODE_ATTR_ID(52), - TRANSCEIVER_LPMODE_ATTR_ID(53), - TRANSCEIVER_LPMODE_ATTR_ID(54), - TRANSCEIVER_RESET_ATTR_ID(49), - TRANSCEIVER_RESET_ATTR_ID(50), - TRANSCEIVER_RESET_ATTR_ID(51), - TRANSCEIVER_RESET_ATTR_ID(52), - TRANSCEIVER_RESET_ATTR_ID(53), - TRANSCEIVER_RESET_ATTR_ID(54), + CPLD_VERSION, + ACCESS, + MODULE_PRESENT_ALL, + MODULE_RXLOS_ALL, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + TRANSCEIVER_PRESENT_ATTR_ID(33), + TRANSCEIVER_PRESENT_ATTR_ID(34), + TRANSCEIVER_PRESENT_ATTR_ID(35), + TRANSCEIVER_PRESENT_ATTR_ID(36), + TRANSCEIVER_PRESENT_ATTR_ID(37), + TRANSCEIVER_PRESENT_ATTR_ID(38), + TRANSCEIVER_PRESENT_ATTR_ID(39), + TRANSCEIVER_PRESENT_ATTR_ID(40), + TRANSCEIVER_PRESENT_ATTR_ID(41), + TRANSCEIVER_PRESENT_ATTR_ID(42), + TRANSCEIVER_PRESENT_ATTR_ID(43), + TRANSCEIVER_PRESENT_ATTR_ID(44), + TRANSCEIVER_PRESENT_ATTR_ID(45), + TRANSCEIVER_PRESENT_ATTR_ID(46), + TRANSCEIVER_PRESENT_ATTR_ID(47), + TRANSCEIVER_PRESENT_ATTR_ID(48), + TRANSCEIVER_PRESENT_ATTR_ID(49), + TRANSCEIVER_PRESENT_ATTR_ID(50), + TRANSCEIVER_PRESENT_ATTR_ID(51), + TRANSCEIVER_PRESENT_ATTR_ID(52), + TRANSCEIVER_PRESENT_ATTR_ID(53), + TRANSCEIVER_PRESENT_ATTR_ID(54), + TRANSCEIVER_TXDISABLE_ATTR_ID(1), + TRANSCEIVER_TXDISABLE_ATTR_ID(2), + TRANSCEIVER_TXDISABLE_ATTR_ID(3), + TRANSCEIVER_TXDISABLE_ATTR_ID(4), + TRANSCEIVER_TXDISABLE_ATTR_ID(5), + TRANSCEIVER_TXDISABLE_ATTR_ID(6), + TRANSCEIVER_TXDISABLE_ATTR_ID(7), + TRANSCEIVER_TXDISABLE_ATTR_ID(8), + TRANSCEIVER_TXDISABLE_ATTR_ID(9), + TRANSCEIVER_TXDISABLE_ATTR_ID(10), + TRANSCEIVER_TXDISABLE_ATTR_ID(11), + TRANSCEIVER_TXDISABLE_ATTR_ID(12), + TRANSCEIVER_TXDISABLE_ATTR_ID(13), + TRANSCEIVER_TXDISABLE_ATTR_ID(14), + TRANSCEIVER_TXDISABLE_ATTR_ID(15), + TRANSCEIVER_TXDISABLE_ATTR_ID(16), + TRANSCEIVER_TXDISABLE_ATTR_ID(17), + TRANSCEIVER_TXDISABLE_ATTR_ID(18), + TRANSCEIVER_TXDISABLE_ATTR_ID(19), + TRANSCEIVER_TXDISABLE_ATTR_ID(20), + TRANSCEIVER_TXDISABLE_ATTR_ID(21), + TRANSCEIVER_TXDISABLE_ATTR_ID(22), + TRANSCEIVER_TXDISABLE_ATTR_ID(23), + TRANSCEIVER_TXDISABLE_ATTR_ID(24), + TRANSCEIVER_TXDISABLE_ATTR_ID(25), + TRANSCEIVER_TXDISABLE_ATTR_ID(26), + TRANSCEIVER_TXDISABLE_ATTR_ID(27), + TRANSCEIVER_TXDISABLE_ATTR_ID(28), + TRANSCEIVER_TXDISABLE_ATTR_ID(29), + TRANSCEIVER_TXDISABLE_ATTR_ID(30), + TRANSCEIVER_TXDISABLE_ATTR_ID(31), + TRANSCEIVER_TXDISABLE_ATTR_ID(32), + TRANSCEIVER_TXDISABLE_ATTR_ID(33), + TRANSCEIVER_TXDISABLE_ATTR_ID(34), + TRANSCEIVER_TXDISABLE_ATTR_ID(35), + TRANSCEIVER_TXDISABLE_ATTR_ID(36), + TRANSCEIVER_TXDISABLE_ATTR_ID(37), + TRANSCEIVER_TXDISABLE_ATTR_ID(38), + TRANSCEIVER_TXDISABLE_ATTR_ID(39), + TRANSCEIVER_TXDISABLE_ATTR_ID(40), + TRANSCEIVER_TXDISABLE_ATTR_ID(41), + TRANSCEIVER_TXDISABLE_ATTR_ID(42), + TRANSCEIVER_TXDISABLE_ATTR_ID(43), + TRANSCEIVER_TXDISABLE_ATTR_ID(44), + TRANSCEIVER_TXDISABLE_ATTR_ID(45), + TRANSCEIVER_TXDISABLE_ATTR_ID(46), + TRANSCEIVER_TXDISABLE_ATTR_ID(47), + TRANSCEIVER_TXDISABLE_ATTR_ID(48), + TRANSCEIVER_RXLOS_ATTR_ID(1), + TRANSCEIVER_RXLOS_ATTR_ID(2), + TRANSCEIVER_RXLOS_ATTR_ID(3), + TRANSCEIVER_RXLOS_ATTR_ID(4), + TRANSCEIVER_RXLOS_ATTR_ID(5), + TRANSCEIVER_RXLOS_ATTR_ID(6), + TRANSCEIVER_RXLOS_ATTR_ID(7), + TRANSCEIVER_RXLOS_ATTR_ID(8), + TRANSCEIVER_RXLOS_ATTR_ID(9), + TRANSCEIVER_RXLOS_ATTR_ID(10), + TRANSCEIVER_RXLOS_ATTR_ID(11), + TRANSCEIVER_RXLOS_ATTR_ID(12), + TRANSCEIVER_RXLOS_ATTR_ID(13), + TRANSCEIVER_RXLOS_ATTR_ID(14), + TRANSCEIVER_RXLOS_ATTR_ID(15), + TRANSCEIVER_RXLOS_ATTR_ID(16), + TRANSCEIVER_RXLOS_ATTR_ID(17), + TRANSCEIVER_RXLOS_ATTR_ID(18), + TRANSCEIVER_RXLOS_ATTR_ID(19), + TRANSCEIVER_RXLOS_ATTR_ID(20), + TRANSCEIVER_RXLOS_ATTR_ID(21), + TRANSCEIVER_RXLOS_ATTR_ID(22), + TRANSCEIVER_RXLOS_ATTR_ID(23), + TRANSCEIVER_RXLOS_ATTR_ID(24), + TRANSCEIVER_RXLOS_ATTR_ID(25), + TRANSCEIVER_RXLOS_ATTR_ID(26), + TRANSCEIVER_RXLOS_ATTR_ID(27), + TRANSCEIVER_RXLOS_ATTR_ID(28), + TRANSCEIVER_RXLOS_ATTR_ID(29), + TRANSCEIVER_RXLOS_ATTR_ID(30), + TRANSCEIVER_RXLOS_ATTR_ID(31), + TRANSCEIVER_RXLOS_ATTR_ID(32), + TRANSCEIVER_RXLOS_ATTR_ID(33), + TRANSCEIVER_RXLOS_ATTR_ID(34), + TRANSCEIVER_RXLOS_ATTR_ID(35), + TRANSCEIVER_RXLOS_ATTR_ID(36), + TRANSCEIVER_RXLOS_ATTR_ID(37), + TRANSCEIVER_RXLOS_ATTR_ID(38), + TRANSCEIVER_RXLOS_ATTR_ID(39), + TRANSCEIVER_RXLOS_ATTR_ID(40), + TRANSCEIVER_RXLOS_ATTR_ID(41), + TRANSCEIVER_RXLOS_ATTR_ID(42), + TRANSCEIVER_RXLOS_ATTR_ID(43), + TRANSCEIVER_RXLOS_ATTR_ID(44), + TRANSCEIVER_RXLOS_ATTR_ID(45), + TRANSCEIVER_RXLOS_ATTR_ID(46), + TRANSCEIVER_RXLOS_ATTR_ID(47), + TRANSCEIVER_RXLOS_ATTR_ID(48), + TRANSCEIVER_TXFAULT_ATTR_ID(1), + TRANSCEIVER_TXFAULT_ATTR_ID(2), + TRANSCEIVER_TXFAULT_ATTR_ID(3), + TRANSCEIVER_TXFAULT_ATTR_ID(4), + TRANSCEIVER_TXFAULT_ATTR_ID(5), + TRANSCEIVER_TXFAULT_ATTR_ID(6), + TRANSCEIVER_TXFAULT_ATTR_ID(7), + TRANSCEIVER_TXFAULT_ATTR_ID(8), + TRANSCEIVER_TXFAULT_ATTR_ID(9), + TRANSCEIVER_TXFAULT_ATTR_ID(10), + TRANSCEIVER_TXFAULT_ATTR_ID(11), + TRANSCEIVER_TXFAULT_ATTR_ID(12), + TRANSCEIVER_TXFAULT_ATTR_ID(13), + TRANSCEIVER_TXFAULT_ATTR_ID(14), + TRANSCEIVER_TXFAULT_ATTR_ID(15), + TRANSCEIVER_TXFAULT_ATTR_ID(16), + TRANSCEIVER_TXFAULT_ATTR_ID(17), + TRANSCEIVER_TXFAULT_ATTR_ID(18), + TRANSCEIVER_TXFAULT_ATTR_ID(19), + TRANSCEIVER_TXFAULT_ATTR_ID(20), + TRANSCEIVER_TXFAULT_ATTR_ID(21), + TRANSCEIVER_TXFAULT_ATTR_ID(22), + TRANSCEIVER_TXFAULT_ATTR_ID(23), + TRANSCEIVER_TXFAULT_ATTR_ID(24), + TRANSCEIVER_TXFAULT_ATTR_ID(25), + TRANSCEIVER_TXFAULT_ATTR_ID(26), + TRANSCEIVER_TXFAULT_ATTR_ID(27), + TRANSCEIVER_TXFAULT_ATTR_ID(28), + TRANSCEIVER_TXFAULT_ATTR_ID(29), + TRANSCEIVER_TXFAULT_ATTR_ID(30), + TRANSCEIVER_TXFAULT_ATTR_ID(31), + TRANSCEIVER_TXFAULT_ATTR_ID(32), + TRANSCEIVER_TXFAULT_ATTR_ID(33), + TRANSCEIVER_TXFAULT_ATTR_ID(34), + TRANSCEIVER_TXFAULT_ATTR_ID(35), + TRANSCEIVER_TXFAULT_ATTR_ID(36), + TRANSCEIVER_TXFAULT_ATTR_ID(37), + TRANSCEIVER_TXFAULT_ATTR_ID(38), + TRANSCEIVER_TXFAULT_ATTR_ID(39), + TRANSCEIVER_TXFAULT_ATTR_ID(40), + TRANSCEIVER_TXFAULT_ATTR_ID(41), + TRANSCEIVER_TXFAULT_ATTR_ID(42), + TRANSCEIVER_TXFAULT_ATTR_ID(43), + TRANSCEIVER_TXFAULT_ATTR_ID(44), + TRANSCEIVER_TXFAULT_ATTR_ID(45), + TRANSCEIVER_TXFAULT_ATTR_ID(46), + TRANSCEIVER_TXFAULT_ATTR_ID(47), + TRANSCEIVER_TXFAULT_ATTR_ID(48), }; /* sysfs attributes for hwmon @@ -352,13 +319,9 @@ static ssize_t show_present_all(struct device *dev, struct device_attribute *da, static ssize_t show_rxlos_all(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, - const char *buf, size_t count); -static ssize_t set_lp_mode(struct device *dev, struct device_attribute *da, - const char *buf, size_t count); -static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, - const char *buf, size_t count); + const char *buf, size_t count); static ssize_t access(struct device *dev, struct device_attribute *da, - const char *buf, size_t count); + const char *buf, size_t count); static ssize_t show_version(struct device *dev, struct device_attribute *da, char *buf); static int as5712_54x_cpld_read_internal(struct i2c_client *client, u8 reg); @@ -366,27 +329,17 @@ static int as5712_54x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 /* transceiver attributes */ #define DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(index) \ - static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index) + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index) #define DECLARE_TRANSCEIVER_PRESENT_ATTR(index) &sensor_dev_attr_module_present_##index.dev_attr.attr #define DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ - static SENSOR_DEVICE_ATTR(module_tx_disable_##index, S_IRUGO | S_IWUSR, show_status, set_tx_disable, MODULE_TXDISABLE_##index); \ - static SENSOR_DEVICE_ATTR(module_rx_los_##index, S_IRUGO, show_status, NULL, MODULE_RXLOS_##index); \ - static SENSOR_DEVICE_ATTR(module_tx_fault_##index, S_IRUGO, show_status, NULL, MODULE_TXFAULT_##index) - + static SENSOR_DEVICE_ATTR(module_tx_disable_##index, S_IRUGO | S_IWUSR, show_status, set_tx_disable, MODULE_TXDISABLE_##index); \ + static SENSOR_DEVICE_ATTR(module_rx_los_##index, S_IRUGO, show_status, NULL, MODULE_RXLOS_##index); \ + static SENSOR_DEVICE_ATTR(module_tx_fault_##index, S_IRUGO, show_status, NULL, MODULE_TXFAULT_##index) #define DECLARE_SFP_TRANSCEIVER_ATTR(index) \ - &sensor_dev_attr_module_tx_disable_##index.dev_attr.attr, \ - &sensor_dev_attr_module_rx_los_##index.dev_attr.attr, \ - &sensor_dev_attr_module_tx_fault_##index.dev_attr.attr - -#define DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ - static SENSOR_DEVICE_ATTR(module_lp_mode_##index, S_IRUGO | S_IWUSR, show_status, set_lp_mode, MODULE_LPMODE_##index); \ - static SENSOR_DEVICE_ATTR(module_reset_##index, S_IWUSR | S_IRUGO, show_status, set_mode_reset, MODULE_RESET_##index) - -#define DECLARE_QSFP_TRANSCEIVER_ATTR(index) \ - &sensor_dev_attr_module_lp_mode_##index.dev_attr.attr, \ - &sensor_dev_attr_module_reset_##index.dev_attr.attr - + &sensor_dev_attr_module_tx_disable_##index.dev_attr.attr, \ + &sensor_dev_attr_module_rx_los_##index.dev_attr.attr, \ + &sensor_dev_attr_module_tx_fault_##index.dev_attr.attr static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); @@ -496,167 +449,156 @@ DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(45); DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(46); DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(47); DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(48); -DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(49); -DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(50); -DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(51); -DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(52); -DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(53); -DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(54); static struct attribute *as5712_54x_cpld1_attributes[] = { &sensor_dev_attr_version.dev_attr.attr, &sensor_dev_attr_access.dev_attr.attr, - NULL + NULL }; static const struct attribute_group as5712_54x_cpld1_group = { - .attrs = as5712_54x_cpld1_attributes, + .attrs = as5712_54x_cpld1_attributes, }; static struct attribute *as5712_54x_cpld2_attributes[] = { &sensor_dev_attr_version.dev_attr.attr, &sensor_dev_attr_access.dev_attr.attr, - /* transceiver attributes */ - &sensor_dev_attr_module_present_all.dev_attr.attr, - &sensor_dev_attr_module_rx_los_all.dev_attr.attr, - DECLARE_TRANSCEIVER_PRESENT_ATTR(1), - DECLARE_TRANSCEIVER_PRESENT_ATTR(2), - DECLARE_TRANSCEIVER_PRESENT_ATTR(3), - DECLARE_TRANSCEIVER_PRESENT_ATTR(4), - DECLARE_TRANSCEIVER_PRESENT_ATTR(5), - DECLARE_TRANSCEIVER_PRESENT_ATTR(6), - DECLARE_TRANSCEIVER_PRESENT_ATTR(7), - DECLARE_TRANSCEIVER_PRESENT_ATTR(8), - DECLARE_TRANSCEIVER_PRESENT_ATTR(9), - DECLARE_TRANSCEIVER_PRESENT_ATTR(10), - DECLARE_TRANSCEIVER_PRESENT_ATTR(11), - DECLARE_TRANSCEIVER_PRESENT_ATTR(12), - DECLARE_TRANSCEIVER_PRESENT_ATTR(13), - DECLARE_TRANSCEIVER_PRESENT_ATTR(14), - DECLARE_TRANSCEIVER_PRESENT_ATTR(15), - DECLARE_TRANSCEIVER_PRESENT_ATTR(16), - DECLARE_TRANSCEIVER_PRESENT_ATTR(17), - DECLARE_TRANSCEIVER_PRESENT_ATTR(18), - DECLARE_TRANSCEIVER_PRESENT_ATTR(19), - DECLARE_TRANSCEIVER_PRESENT_ATTR(20), - DECLARE_TRANSCEIVER_PRESENT_ATTR(21), - DECLARE_TRANSCEIVER_PRESENT_ATTR(22), - DECLARE_TRANSCEIVER_PRESENT_ATTR(23), - DECLARE_TRANSCEIVER_PRESENT_ATTR(24), - DECLARE_SFP_TRANSCEIVER_ATTR(1), - DECLARE_SFP_TRANSCEIVER_ATTR(2), - DECLARE_SFP_TRANSCEIVER_ATTR(3), - DECLARE_SFP_TRANSCEIVER_ATTR(4), - DECLARE_SFP_TRANSCEIVER_ATTR(5), - DECLARE_SFP_TRANSCEIVER_ATTR(6), - DECLARE_SFP_TRANSCEIVER_ATTR(7), - DECLARE_SFP_TRANSCEIVER_ATTR(8), - DECLARE_SFP_TRANSCEIVER_ATTR(9), - DECLARE_SFP_TRANSCEIVER_ATTR(10), - DECLARE_SFP_TRANSCEIVER_ATTR(11), - DECLARE_SFP_TRANSCEIVER_ATTR(12), - DECLARE_SFP_TRANSCEIVER_ATTR(13), - DECLARE_SFP_TRANSCEIVER_ATTR(14), - DECLARE_SFP_TRANSCEIVER_ATTR(15), - DECLARE_SFP_TRANSCEIVER_ATTR(16), - DECLARE_SFP_TRANSCEIVER_ATTR(17), - DECLARE_SFP_TRANSCEIVER_ATTR(18), - DECLARE_SFP_TRANSCEIVER_ATTR(19), - DECLARE_SFP_TRANSCEIVER_ATTR(20), - DECLARE_SFP_TRANSCEIVER_ATTR(21), - DECLARE_SFP_TRANSCEIVER_ATTR(22), - DECLARE_SFP_TRANSCEIVER_ATTR(23), - DECLARE_SFP_TRANSCEIVER_ATTR(24), - NULL + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + &sensor_dev_attr_module_rx_los_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(1), + DECLARE_TRANSCEIVER_PRESENT_ATTR(2), + DECLARE_TRANSCEIVER_PRESENT_ATTR(3), + DECLARE_TRANSCEIVER_PRESENT_ATTR(4), + DECLARE_TRANSCEIVER_PRESENT_ATTR(5), + DECLARE_TRANSCEIVER_PRESENT_ATTR(6), + DECLARE_TRANSCEIVER_PRESENT_ATTR(7), + DECLARE_TRANSCEIVER_PRESENT_ATTR(8), + DECLARE_TRANSCEIVER_PRESENT_ATTR(9), + DECLARE_TRANSCEIVER_PRESENT_ATTR(10), + DECLARE_TRANSCEIVER_PRESENT_ATTR(11), + DECLARE_TRANSCEIVER_PRESENT_ATTR(12), + DECLARE_TRANSCEIVER_PRESENT_ATTR(13), + DECLARE_TRANSCEIVER_PRESENT_ATTR(14), + DECLARE_TRANSCEIVER_PRESENT_ATTR(15), + DECLARE_TRANSCEIVER_PRESENT_ATTR(16), + DECLARE_TRANSCEIVER_PRESENT_ATTR(17), + DECLARE_TRANSCEIVER_PRESENT_ATTR(18), + DECLARE_TRANSCEIVER_PRESENT_ATTR(19), + DECLARE_TRANSCEIVER_PRESENT_ATTR(20), + DECLARE_TRANSCEIVER_PRESENT_ATTR(21), + DECLARE_TRANSCEIVER_PRESENT_ATTR(22), + DECLARE_TRANSCEIVER_PRESENT_ATTR(23), + DECLARE_TRANSCEIVER_PRESENT_ATTR(24), + DECLARE_SFP_TRANSCEIVER_ATTR(1), + DECLARE_SFP_TRANSCEIVER_ATTR(2), + DECLARE_SFP_TRANSCEIVER_ATTR(3), + DECLARE_SFP_TRANSCEIVER_ATTR(4), + DECLARE_SFP_TRANSCEIVER_ATTR(5), + DECLARE_SFP_TRANSCEIVER_ATTR(6), + DECLARE_SFP_TRANSCEIVER_ATTR(7), + DECLARE_SFP_TRANSCEIVER_ATTR(8), + DECLARE_SFP_TRANSCEIVER_ATTR(9), + DECLARE_SFP_TRANSCEIVER_ATTR(10), + DECLARE_SFP_TRANSCEIVER_ATTR(11), + DECLARE_SFP_TRANSCEIVER_ATTR(12), + DECLARE_SFP_TRANSCEIVER_ATTR(13), + DECLARE_SFP_TRANSCEIVER_ATTR(14), + DECLARE_SFP_TRANSCEIVER_ATTR(15), + DECLARE_SFP_TRANSCEIVER_ATTR(16), + DECLARE_SFP_TRANSCEIVER_ATTR(17), + DECLARE_SFP_TRANSCEIVER_ATTR(18), + DECLARE_SFP_TRANSCEIVER_ATTR(19), + DECLARE_SFP_TRANSCEIVER_ATTR(20), + DECLARE_SFP_TRANSCEIVER_ATTR(21), + DECLARE_SFP_TRANSCEIVER_ATTR(22), + DECLARE_SFP_TRANSCEIVER_ATTR(23), + DECLARE_SFP_TRANSCEIVER_ATTR(24), + NULL }; static const struct attribute_group as5712_54x_cpld2_group = { - .attrs = as5712_54x_cpld2_attributes, + .attrs = as5712_54x_cpld2_attributes, }; static struct attribute *as5712_54x_cpld3_attributes[] = { &sensor_dev_attr_version.dev_attr.attr, &sensor_dev_attr_access.dev_attr.attr, - /* transceiver attributes */ - &sensor_dev_attr_module_present_all.dev_attr.attr, - &sensor_dev_attr_module_rx_los_all.dev_attr.attr, - DECLARE_TRANSCEIVER_PRESENT_ATTR(25), - DECLARE_TRANSCEIVER_PRESENT_ATTR(26), - DECLARE_TRANSCEIVER_PRESENT_ATTR(27), - DECLARE_TRANSCEIVER_PRESENT_ATTR(28), - DECLARE_TRANSCEIVER_PRESENT_ATTR(29), - DECLARE_TRANSCEIVER_PRESENT_ATTR(30), - DECLARE_TRANSCEIVER_PRESENT_ATTR(31), - DECLARE_TRANSCEIVER_PRESENT_ATTR(32), - DECLARE_TRANSCEIVER_PRESENT_ATTR(33), - DECLARE_TRANSCEIVER_PRESENT_ATTR(34), - DECLARE_TRANSCEIVER_PRESENT_ATTR(35), - DECLARE_TRANSCEIVER_PRESENT_ATTR(36), - DECLARE_TRANSCEIVER_PRESENT_ATTR(37), - DECLARE_TRANSCEIVER_PRESENT_ATTR(38), - DECLARE_TRANSCEIVER_PRESENT_ATTR(39), - DECLARE_TRANSCEIVER_PRESENT_ATTR(40), - DECLARE_TRANSCEIVER_PRESENT_ATTR(41), - DECLARE_TRANSCEIVER_PRESENT_ATTR(42), - DECLARE_TRANSCEIVER_PRESENT_ATTR(43), - DECLARE_TRANSCEIVER_PRESENT_ATTR(44), - DECLARE_TRANSCEIVER_PRESENT_ATTR(45), - DECLARE_TRANSCEIVER_PRESENT_ATTR(46), - DECLARE_TRANSCEIVER_PRESENT_ATTR(47), - DECLARE_TRANSCEIVER_PRESENT_ATTR(48), - DECLARE_TRANSCEIVER_PRESENT_ATTR(49), - DECLARE_TRANSCEIVER_PRESENT_ATTR(50), - DECLARE_TRANSCEIVER_PRESENT_ATTR(51), - DECLARE_TRANSCEIVER_PRESENT_ATTR(52), - DECLARE_TRANSCEIVER_PRESENT_ATTR(53), - DECLARE_TRANSCEIVER_PRESENT_ATTR(54), - DECLARE_SFP_TRANSCEIVER_ATTR(25), - DECLARE_SFP_TRANSCEIVER_ATTR(26), - DECLARE_SFP_TRANSCEIVER_ATTR(27), - DECLARE_SFP_TRANSCEIVER_ATTR(28), - DECLARE_SFP_TRANSCEIVER_ATTR(29), - DECLARE_SFP_TRANSCEIVER_ATTR(30), - DECLARE_SFP_TRANSCEIVER_ATTR(31), - DECLARE_SFP_TRANSCEIVER_ATTR(32), - DECLARE_SFP_TRANSCEIVER_ATTR(33), - DECLARE_SFP_TRANSCEIVER_ATTR(34), - DECLARE_SFP_TRANSCEIVER_ATTR(35), - DECLARE_SFP_TRANSCEIVER_ATTR(36), - DECLARE_SFP_TRANSCEIVER_ATTR(37), - DECLARE_SFP_TRANSCEIVER_ATTR(38), - DECLARE_SFP_TRANSCEIVER_ATTR(39), - DECLARE_SFP_TRANSCEIVER_ATTR(40), - DECLARE_SFP_TRANSCEIVER_ATTR(41), - DECLARE_SFP_TRANSCEIVER_ATTR(42), - DECLARE_SFP_TRANSCEIVER_ATTR(43), - DECLARE_SFP_TRANSCEIVER_ATTR(44), - DECLARE_SFP_TRANSCEIVER_ATTR(45), - DECLARE_SFP_TRANSCEIVER_ATTR(46), - DECLARE_SFP_TRANSCEIVER_ATTR(47), - DECLARE_SFP_TRANSCEIVER_ATTR(48), - DECLARE_QSFP_TRANSCEIVER_ATTR(49), - DECLARE_QSFP_TRANSCEIVER_ATTR(50), - DECLARE_QSFP_TRANSCEIVER_ATTR(51), - DECLARE_QSFP_TRANSCEIVER_ATTR(52), - DECLARE_QSFP_TRANSCEIVER_ATTR(53), - DECLARE_QSFP_TRANSCEIVER_ATTR(54), - NULL + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + &sensor_dev_attr_module_rx_los_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(25), + DECLARE_TRANSCEIVER_PRESENT_ATTR(26), + DECLARE_TRANSCEIVER_PRESENT_ATTR(27), + DECLARE_TRANSCEIVER_PRESENT_ATTR(28), + DECLARE_TRANSCEIVER_PRESENT_ATTR(29), + DECLARE_TRANSCEIVER_PRESENT_ATTR(30), + DECLARE_TRANSCEIVER_PRESENT_ATTR(31), + DECLARE_TRANSCEIVER_PRESENT_ATTR(32), + DECLARE_TRANSCEIVER_PRESENT_ATTR(33), + DECLARE_TRANSCEIVER_PRESENT_ATTR(34), + DECLARE_TRANSCEIVER_PRESENT_ATTR(35), + DECLARE_TRANSCEIVER_PRESENT_ATTR(36), + DECLARE_TRANSCEIVER_PRESENT_ATTR(37), + DECLARE_TRANSCEIVER_PRESENT_ATTR(38), + DECLARE_TRANSCEIVER_PRESENT_ATTR(39), + DECLARE_TRANSCEIVER_PRESENT_ATTR(40), + DECLARE_TRANSCEIVER_PRESENT_ATTR(41), + DECLARE_TRANSCEIVER_PRESENT_ATTR(42), + DECLARE_TRANSCEIVER_PRESENT_ATTR(43), + DECLARE_TRANSCEIVER_PRESENT_ATTR(44), + DECLARE_TRANSCEIVER_PRESENT_ATTR(45), + DECLARE_TRANSCEIVER_PRESENT_ATTR(46), + DECLARE_TRANSCEIVER_PRESENT_ATTR(47), + DECLARE_TRANSCEIVER_PRESENT_ATTR(48), + DECLARE_TRANSCEIVER_PRESENT_ATTR(49), + DECLARE_TRANSCEIVER_PRESENT_ATTR(50), + DECLARE_TRANSCEIVER_PRESENT_ATTR(51), + DECLARE_TRANSCEIVER_PRESENT_ATTR(52), + DECLARE_TRANSCEIVER_PRESENT_ATTR(53), + DECLARE_TRANSCEIVER_PRESENT_ATTR(54), + DECLARE_SFP_TRANSCEIVER_ATTR(25), + DECLARE_SFP_TRANSCEIVER_ATTR(26), + DECLARE_SFP_TRANSCEIVER_ATTR(27), + DECLARE_SFP_TRANSCEIVER_ATTR(28), + DECLARE_SFP_TRANSCEIVER_ATTR(29), + DECLARE_SFP_TRANSCEIVER_ATTR(30), + DECLARE_SFP_TRANSCEIVER_ATTR(31), + DECLARE_SFP_TRANSCEIVER_ATTR(32), + DECLARE_SFP_TRANSCEIVER_ATTR(33), + DECLARE_SFP_TRANSCEIVER_ATTR(34), + DECLARE_SFP_TRANSCEIVER_ATTR(35), + DECLARE_SFP_TRANSCEIVER_ATTR(36), + DECLARE_SFP_TRANSCEIVER_ATTR(37), + DECLARE_SFP_TRANSCEIVER_ATTR(38), + DECLARE_SFP_TRANSCEIVER_ATTR(39), + DECLARE_SFP_TRANSCEIVER_ATTR(40), + DECLARE_SFP_TRANSCEIVER_ATTR(41), + DECLARE_SFP_TRANSCEIVER_ATTR(42), + DECLARE_SFP_TRANSCEIVER_ATTR(43), + DECLARE_SFP_TRANSCEIVER_ATTR(44), + DECLARE_SFP_TRANSCEIVER_ATTR(45), + DECLARE_SFP_TRANSCEIVER_ATTR(46), + DECLARE_SFP_TRANSCEIVER_ATTR(47), + DECLARE_SFP_TRANSCEIVER_ATTR(48), + NULL }; static const struct attribute_group as5712_54x_cpld3_group = { - .attrs = as5712_54x_cpld3_attributes, + .attrs = as5712_54x_cpld3_attributes, }; static ssize_t show_present_all(struct device *dev, struct device_attribute *da, char *buf) { - int i, status, num_regs = 0; - u8 values[4] = {0}; - u8 regs[] = {0x6, 0x7, 0x8, 0x14}; - struct i2c_client *client = to_i2c_client(dev); - struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + int i, status, num_regs = 0; + u8 values[4] = {0}; + u8 regs[] = {0x6, 0x7, 0x8, 0x14}; + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc); - mutex_lock(&data->update_lock); + mutex_lock(&data->update_lock); num_regs = (data->type == as5712_54x_cpld2) ? 3 : 4; @@ -670,7 +612,7 @@ static ssize_t show_present_all(struct device *dev, struct device_attribute *da, values[i] = ~(u8)status; } - mutex_unlock(&data->update_lock); + mutex_unlock(&data->update_lock); /* Return values 1 -> 54 in order */ if (data->type == as5712_54x_cpld2) { @@ -686,20 +628,21 @@ static ssize_t show_present_all(struct device *dev, struct device_attribute *da, return status; exit: - mutex_unlock(&data->update_lock); - return status; + mutex_unlock(&data->update_lock); + return status; } static ssize_t show_rxlos_all(struct device *dev, struct device_attribute *da, char *buf) { - int i, status; - u8 values[3] = {0}; - u8 regs[] = {0xF, 0x10, 0x11}; - struct i2c_client *client = to_i2c_client(dev); - struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); + int i, status; + u8 values[3] = {0}; + u8 regs[] = {0xF, 0x10, 0x11}; + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc); - mutex_lock(&data->update_lock); + mutex_lock(&data->update_lock); for (i = 0; i < ARRAY_SIZE(regs); i++) { status = as5712_54x_cpld_read_internal(client, regs[i]); @@ -711,14 +654,14 @@ static ssize_t show_rxlos_all(struct device *dev, struct device_attribute *da, values[i] = (u8)status; } - mutex_unlock(&data->update_lock); + mutex_unlock(&data->update_lock); /* Return values 1 -> 24 in order */ return sprintf(buf, "%.2x %.2x %.2x\n", values[0], values[1], values[2]); exit: - mutex_unlock(&data->update_lock); - return status; + mutex_unlock(&data->update_lock); + return status; } static ssize_t show_status(struct device *dev, struct device_attribute *da, @@ -726,35 +669,36 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct i2c_client *client = to_i2c_client(dev); - struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); - int status = 0; - u8 reg = 0, mask = 0, revert = 0; - - switch (attr->index) { - case MODULE_PRESENT_1 ... MODULE_PRESENT_8: - reg = 0x6; - mask = 0x1 << (attr->index - MODULE_PRESENT_1); - break; - case MODULE_PRESENT_9 ... MODULE_PRESENT_16: - reg = 0x7; - mask = 0x1 << (attr->index - MODULE_PRESENT_9); - break; - case MODULE_PRESENT_17 ... MODULE_PRESENT_24: - reg = 0x8; - mask = 0x1 << (attr->index - MODULE_PRESENT_17); - break; - case MODULE_PRESENT_25 ... MODULE_PRESENT_32: - reg = 0x6; - mask = 0x1 << (attr->index - MODULE_PRESENT_25); - break; - case MODULE_PRESENT_33 ... MODULE_PRESENT_40: - reg = 0x7; - mask = 0x1 << (attr->index - MODULE_PRESENT_33); - break; - case MODULE_PRESENT_41 ... MODULE_PRESENT_48: - reg = 0x8; - mask = 0x1 << (attr->index - MODULE_PRESENT_41); - break; + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc); + int status = 0; + u8 reg = 0, mask = 0, revert = 0; + + switch (attr->index) { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + reg = 0x6; + mask = 0x1 << (attr->index - MODULE_PRESENT_1); + break; + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + reg = 0x7; + mask = 0x1 << (attr->index - MODULE_PRESENT_9); + break; + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + reg = 0x8; + mask = 0x1 << (attr->index - MODULE_PRESENT_17); + break; + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + reg = 0x6; + mask = 0x1 << (attr->index - MODULE_PRESENT_25); + break; + case MODULE_PRESENT_33 ... MODULE_PRESENT_40: + reg = 0x7; + mask = 0x1 << (attr->index - MODULE_PRESENT_33); + break; + case MODULE_PRESENT_41 ... MODULE_PRESENT_48: + reg = 0x8; + mask = 0x1 << (attr->index - MODULE_PRESENT_41); + break; case MODULE_PRESENT_49: reg = 0x14; mask = 0x1; @@ -779,247 +723,145 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, reg = 0x14; mask = 0x20; break; - case MODULE_TXFAULT_1 ... MODULE_TXFAULT_8: - reg = 0x9; - mask = 0x1 << (attr->index - MODULE_TXFAULT_1); - break; - case MODULE_TXFAULT_9 ... MODULE_TXFAULT_16: - reg = 0xA; - mask = 0x1 << (attr->index - MODULE_TXFAULT_9); - break; - case MODULE_TXFAULT_17 ... MODULE_TXFAULT_24: - reg = 0xB; - mask = 0x1 << (attr->index - MODULE_TXFAULT_17); - break; - case MODULE_TXFAULT_25 ... MODULE_TXFAULT_32: - reg = 0x9; - mask = 0x1 << (attr->index - MODULE_TXFAULT_25); - break; - case MODULE_TXFAULT_33 ... MODULE_TXFAULT_40: - reg = 0xA; - mask = 0x1 << (attr->index - MODULE_TXFAULT_33); - break; - case MODULE_TXFAULT_41 ... MODULE_TXFAULT_48: - reg = 0xB; - mask = 0x1 << (attr->index - MODULE_TXFAULT_41); - break; - case MODULE_TXDISABLE_1 ... MODULE_TXDISABLE_8: - reg = 0xC; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_1); - break; - case MODULE_TXDISABLE_9 ... MODULE_TXDISABLE_16: - reg = 0xD; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_9); - break; - case MODULE_TXDISABLE_17 ... MODULE_TXDISABLE_24: - reg = 0xE; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_17); - break; - case MODULE_TXDISABLE_25 ... MODULE_TXDISABLE_32: - reg = 0xC; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_25); - break; - case MODULE_TXDISABLE_33 ... MODULE_TXDISABLE_40: - reg = 0xD; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_33); - break; - case MODULE_TXDISABLE_41 ... MODULE_TXDISABLE_48: - reg = 0xE; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_41); - break; - case MODULE_RXLOS_1 ... MODULE_RXLOS_8: - reg = 0xF; - mask = 0x1 << (attr->index - MODULE_RXLOS_1); - break; - case MODULE_RXLOS_9 ... MODULE_RXLOS_16: - reg = 0x10; - mask = 0x1 << (attr->index - MODULE_RXLOS_9); - break; - case MODULE_RXLOS_17 ... MODULE_RXLOS_24: - reg = 0x11; - mask = 0x1 << (attr->index - MODULE_RXLOS_17); - break; - case MODULE_RXLOS_25 ... MODULE_RXLOS_32: - reg = 0xF; - mask = 0x1 << (attr->index - MODULE_RXLOS_25); - break; - case MODULE_RXLOS_33 ... MODULE_RXLOS_40: - reg = 0x10; - mask = 0x1 << (attr->index - MODULE_RXLOS_33); - break; - case MODULE_RXLOS_41 ... MODULE_RXLOS_48: - reg = 0x11; - mask = 0x1 << (attr->index - MODULE_RXLOS_41); - break; - case MODULE_LPMODE_49 ... MODULE_LPMODE_54: - reg = 0x16; - mask = 0x1 << (attr->index - MODULE_LPMODE_49); + case MODULE_TXFAULT_1 ... MODULE_TXFAULT_8: + reg = 0x9; + mask = 0x1 << (attr->index - MODULE_TXFAULT_1); + break; + case MODULE_TXFAULT_9 ... MODULE_TXFAULT_16: + reg = 0xA; + mask = 0x1 << (attr->index - MODULE_TXFAULT_9); + break; + case MODULE_TXFAULT_17 ... MODULE_TXFAULT_24: + reg = 0xB; + mask = 0x1 << (attr->index - MODULE_TXFAULT_17); + break; + case MODULE_TXFAULT_25 ... MODULE_TXFAULT_32: + reg = 0x9; + mask = 0x1 << (attr->index - MODULE_TXFAULT_25); + break; + case MODULE_TXFAULT_33 ... MODULE_TXFAULT_40: + reg = 0xA; + mask = 0x1 << (attr->index - MODULE_TXFAULT_33); + break; + case MODULE_TXFAULT_41 ... MODULE_TXFAULT_48: + reg = 0xB; + mask = 0x1 << (attr->index - MODULE_TXFAULT_41); + break; + case MODULE_TXDISABLE_1 ... MODULE_TXDISABLE_8: + reg = 0xC; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_1); + break; + case MODULE_TXDISABLE_9 ... MODULE_TXDISABLE_16: + reg = 0xD; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_9); + break; + case MODULE_TXDISABLE_17 ... MODULE_TXDISABLE_24: + reg = 0xE; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_17); + break; + case MODULE_TXDISABLE_25 ... MODULE_TXDISABLE_32: + reg = 0xC; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_25); + break; + case MODULE_TXDISABLE_33 ... MODULE_TXDISABLE_40: + reg = 0xD; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_33); break; - case MODULE_RESET_49 ... MODULE_RESET_54: - reg = 0x15; - mask = 0x1 << (attr->index - MODULE_RESET_49); + case MODULE_TXDISABLE_41 ... MODULE_TXDISABLE_48: + reg = 0xE; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_41); break; - default: - return 0; - } + case MODULE_RXLOS_1 ... MODULE_RXLOS_8: + reg = 0xF; + mask = 0x1 << (attr->index - MODULE_RXLOS_1); + break; + case MODULE_RXLOS_9 ... MODULE_RXLOS_16: + reg = 0x10; + mask = 0x1 << (attr->index - MODULE_RXLOS_9); + break; + case MODULE_RXLOS_17 ... MODULE_RXLOS_24: + reg = 0x11; + mask = 0x1 << (attr->index - MODULE_RXLOS_17); + break; + case MODULE_RXLOS_25 ... MODULE_RXLOS_32: + reg = 0xF; + mask = 0x1 << (attr->index - MODULE_RXLOS_25); + break; + case MODULE_RXLOS_33 ... MODULE_RXLOS_40: + reg = 0x10; + mask = 0x1 << (attr->index - MODULE_RXLOS_33); + break; + case MODULE_RXLOS_41 ... MODULE_RXLOS_48: + reg = 0x11; + mask = 0x1 << (attr->index - MODULE_RXLOS_41); + break; + default: + return 0; + } if (attr->index >= MODULE_PRESENT_1 && attr->index <= MODULE_PRESENT_54) { revert = 1; } mutex_lock(&data->update_lock); - status = as5712_54x_cpld_read_internal(client, reg); - if (unlikely(status < 0)) { - goto exit; - } - mutex_unlock(&data->update_lock); - - return sprintf(buf, "%d\n", revert ? !(status & mask) : !!(status & mask)); - -exit: - mutex_unlock(&data->update_lock); - return status; -} - -static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); - long disable; - int status; - u8 reg = 0, mask = 0; - - status = kstrtol(buf, 10, &disable); - if (status) { - return status; - } - - switch (attr->index) { - case MODULE_TXDISABLE_1 ... MODULE_TXDISABLE_8: - reg = 0xC; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_1); - break; - case MODULE_TXDISABLE_9 ... MODULE_TXDISABLE_16: - reg = 0xD; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_9); - break; - case MODULE_TXDISABLE_17 ... MODULE_TXDISABLE_24: - reg = 0xE; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_17); - break; - case MODULE_TXDISABLE_25 ... MODULE_TXDISABLE_32: - reg = 0xC; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_25); - break; - case MODULE_TXDISABLE_33 ... MODULE_TXDISABLE_40: - reg = 0xD; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_33); - break; - case MODULE_TXDISABLE_41 ... MODULE_TXDISABLE_48: - reg = 0xE; - mask = 0x1 << (attr->index - MODULE_TXDISABLE_41); - break; - default: - return 0; - } - - /* Read current status */ - mutex_lock(&data->update_lock); - status = as5712_54x_cpld_read_internal(client, reg); - if (unlikely(status < 0)) { - goto exit; - } - - /* Update tx_disable status */ - if (disable) { - status |= mask; - } - else { - status &= ~mask; - } - - status = as5712_54x_cpld_write_internal(client, reg, status); - if (unlikely(status < 0)) { - goto exit; - } - - mutex_unlock(&data->update_lock); - return count; - -exit: - mutex_unlock(&data->update_lock); - return status; -} - -static ssize_t set_lp_mode(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ - struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); - long on; - int status= -ENOENT; - u8 reg = 0x16, mask = 0; - - if(attr->index < MODULE_LPMODE_49 || attr->index > MODULE_LPMODE_54) - return status; - - status = kstrtol(buf, 10, &on); - if (status) { - return status; - } - - /* Read current status */ - mutex_lock(&data->update_lock); - status = as5712_54x_cpld_read_internal(client, reg); - if (unlikely(status < 0)) { - goto exit; - } - - mask = 0x1 << (attr->index - MODULE_LPMODE_49); - - /* Update lp_mode status */ - if (on) { - status |= mask; - } - else { - status &= ~mask; - } - - status = as5712_54x_cpld_write_internal(client, reg, status); + status = as5712_54x_cpld_read_internal(client, reg); if (unlikely(status < 0)) { goto exit; } - mutex_unlock(&data->update_lock); - return count; + + return sprintf(buf, "%d\n", revert ? !(status & mask) : !!(status & mask)); exit: mutex_unlock(&data->update_lock); return status; - } -static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct i2c_client *client = to_i2c_client(dev); - struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); - long on; - int status= -ENOENT; - u8 reg = 0x15, mask = 0; - - if(attr->index < MODULE_RESET_49 || attr->index > MODULE_RESET_54) - return status; + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc); + long disable; + int status; + u8 reg = 0, mask = 0; - status = kstrtol(buf, 10, &on); + status = kstrtol(buf, 10, &disable); if (status) { return status; } + switch (attr->index) { + case MODULE_TXDISABLE_1 ... MODULE_TXDISABLE_8: + reg = 0xC; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_1); + break; + case MODULE_TXDISABLE_9 ... MODULE_TXDISABLE_16: + reg = 0xD; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_9); + break; + case MODULE_TXDISABLE_17 ... MODULE_TXDISABLE_24: + reg = 0xE; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_17); + break; + case MODULE_TXDISABLE_25 ... MODULE_TXDISABLE_32: + reg = 0xC; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_25); + break; + case MODULE_TXDISABLE_33 ... MODULE_TXDISABLE_40: + reg = 0xD; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_33); + break; + case MODULE_TXDISABLE_41 ... MODULE_TXDISABLE_48: + reg = 0xE; + mask = 0x1 << (attr->index - MODULE_TXDISABLE_41); + break; + default: + return 0; + } + /* Read current status */ mutex_lock(&data->update_lock); status = as5712_54x_cpld_read_internal(client, reg); @@ -1027,63 +869,61 @@ static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, goto exit; } - mask = 0x1 << (attr->index - MODULE_RESET_49); - /* Update tx_disable status */ - if (on) { - status |= mask; + if (disable) { + status |= mask; } else { - status &= ~mask; + status &= ~mask; } status = as5712_54x_cpld_write_internal(client, reg, status); if (unlikely(status < 0)) { goto exit; - } + } mutex_unlock(&data->update_lock); return count; exit: - mutex_unlock(&data->update_lock); - return status; - + mutex_unlock(&data->update_lock); + return status; } static ssize_t access(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) + const char *buf, size_t count) { + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc); int status; u32 addr, val; - struct i2c_client *client = to_i2c_client(dev); - struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); - if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { - return -EINVAL; - } + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } - if (addr > 0xFF || val > 0xFF) { - return -EINVAL; - } + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } - mutex_lock(&data->update_lock); - status = as5712_54x_cpld_write_internal(client, addr, val); - if (unlikely(status < 0)) { - goto exit; - } - mutex_unlock(&data->update_lock); - return count; + mutex_lock(&data->update_lock); + status = as5712_54x_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; exit: - mutex_unlock(&data->update_lock); - return status; + mutex_unlock(&data->update_lock); + return status; } /* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() for this as they will try to lock adapter a second time */ static int as5712_54x_cpld_mux_reg_write(struct i2c_adapter *adap, - struct i2c_client *client, u8 val) + struct i2c_client *client, u8 val) { unsigned long orig_jiffies; unsigned short flags; @@ -1099,31 +939,29 @@ static int as5712_54x_cpld_mux_reg_write(struct i2c_adapter *adap, /* Retry automatically on arbitration loss */ orig_jiffies = jiffies; for (res = 0, try = 0; try <= adap->retries; try++) { - res = adap->algo->smbus_xfer(adap, client->addr, flags, - I2C_SMBUS_WRITE, CPLD_CHANNEL_SELECT_REG, - I2C_SMBUS_BYTE_DATA, &data); - if (res != -EAGAIN) - break; - if (time_after(jiffies, - orig_jiffies + adap->timeout)) - break; - } + res = adap->algo->smbus_xfer(adap, client->addr, flags, + I2C_SMBUS_WRITE, CPLD_CHANNEL_SELECT_REG, + I2C_SMBUS_BYTE_DATA, &data); + if (res != -EAGAIN) + break; + if (time_after(jiffies, + orig_jiffies + adap->timeout)) + break; + } } return res; - } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) -static int as5712_54x_cpld_mux_select_chan(struct i2c_mux_core *muxc, - u32 chan) +static int as5712_54x_cpld_mux_select_chan(struct i2c_mux_core *muxc, + u32 chan) { struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc); struct i2c_client *client = data->client; u8 regval; int ret = 0; - regval = chan; + regval = chan; /* Only select the channel if its different from the last channel */ if (data->last_chan != regval) { ret = as5712_54x_cpld_mux_reg_write(muxc->parent, client, regval); @@ -1134,7 +972,7 @@ static int as5712_54x_cpld_mux_select_chan(struct i2c_mux_core *muxc, } static int as5712_54x_cpld_mux_deselect_mux(struct i2c_mux_core *muxc, - u32 chan) + u32 chan) { struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc); struct i2c_client *client = data->client; @@ -1144,37 +982,6 @@ static int as5712_54x_cpld_mux_deselect_mux(struct i2c_mux_core *muxc, return as5712_54x_cpld_mux_reg_write(muxc->parent, client, data->last_chan); } -#else - -static int as5712_54x_cpld_mux_select_chan(struct i2c_adapter *adap, - void *client, u32 chan) -{ - struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); - u8 regval; - int ret = 0; - regval = chan; - - /* Only select the channel if its different from the last channel */ - if (data->last_chan != regval) { - ret = as5712_54x_cpld_mux_reg_write(adap, client, regval); - data->last_chan = regval; - } - - return ret; -} - -static int as5712_54x_cpld_mux_deselect_mux(struct i2c_adapter *adap, - void *client, u32 chan) -{ - struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); - - /* Deselect active channel */ - data->last_chan = chips[data->type].deselectChan; - - return as5712_54x_cpld_mux_reg_write(adap, client, data->last_chan); -} - -#endif /*#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)*/ static void as5712_54x_cpld_add_client(struct i2c_client *client) { @@ -1200,8 +1007,7 @@ static void as5712_54x_cpld_remove_client(struct i2c_client *client) mutex_lock(&list_lock); - list_for_each(list_node, &cpld_client_list) - { + list_for_each(list_node, &cpld_client_list) { cpld_node = list_entry(list_node, struct cpld_client_node, list); if (cpld_node->client == client) { @@ -1222,13 +1028,13 @@ static ssize_t show_version(struct device *dev, struct device_attribute *attr, c { int val = 0; struct i2c_client *client = to_i2c_client(dev); - + val = i2c_smbus_read_byte_data(client, 0x1); if (val < 0) { dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); -} - + } + return sprintf(buf, "%d", val); } @@ -1236,122 +1042,94 @@ static ssize_t show_version(struct device *dev, struct device_attribute *attr, c * I2C init/probing/exit functions */ static int as5712_54x_cpld_mux_probe(struct i2c_client *client, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) - int force, class; + int num, force, class; struct i2c_mux_core *muxc; -#endif - - int chan=0; struct as5712_54x_cpld_data *data; - int ret = -ENODEV; + int ret = 0; const struct attribute_group *group = NULL; if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) - goto exit; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) + return -ENODEV; + muxc = i2c_mux_alloc(adap, &client->dev, - chips[id->driver_data].nchans, - sizeof(*data), 0, - accton_i2c_cpld_mux_select_chan, - accton_i2c_cpld_mux_deselect_mux); + chips[id->driver_data].nchans, sizeof(*data), 0, + as5712_54x_cpld_mux_select_chan, as5712_54x_cpld_mux_deselect_mux); if (!muxc) return -ENOMEM; + i2c_set_clientdata(client, muxc); data = i2c_mux_priv(muxc); - i2c_set_clientdata(client, data); - data->muxc = muxc; data->client = client; -#else - - data = kzalloc(sizeof(struct as5712_54x_cpld_data), GFP_KERNEL); - if (!data) { - ret = -ENOMEM; - goto exit; - } - i2c_set_clientdata(client, data); - mutex_init(&data->update_lock); -#endif data->type = id->driver_data; - if (data->type == as5712_54x_cpld2 || data->type == as5712_54x_cpld3) { - data->last_chan = chips[data->type].deselectChan; /* force the first selection */ - - /* Now create an adapter for each channel */ - for (chan = 0; chan < chips[data->type].nchans; chan++) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) - force = 0; /* dynamic adap number */ - class = 0; /* no class by default */ - ret = i2c_mux_add_adapter(muxc, force, chan, class); - if (ret) -#else - data->virt_adaps[chan] = i2c_add_mux_adapter(adap, &client->dev, client, 0, chan, - 0, - as5712_54x_cpld_mux_select_chan, - as5712_54x_cpld_mux_deselect_mux); - if (data->virt_adaps[chan] == NULL) -#endif - { - ret = -ENODEV; - dev_err(&client->dev, "failed to register multiplexed adapter %d\n", chan); - goto exit_mux_register; - } - } + data->last_chan = chips[data->type].deselectChan; /* force the first selection */ + mutex_init(&data->update_lock); - dev_info(&client->dev, "registered %d multiplexed busses for I2C mux %s\n", - chan, client->name); - } - /* Register sysfs hooks */ - switch (data->type) - { - case as5712_54x_cpld1: - group = &as5712_54x_cpld1_group; - break; - case as5712_54x_cpld2: - group = &as5712_54x_cpld2_group; - break; - case as5712_54x_cpld3: - group = &as5712_54x_cpld3_group; - break; - default: - break; + /* Now create an adapter for each channel */ + for (num = 0; num < chips[data->type].nchans; num++) { + force = 0; /* dynamic adap number */ + class = 0; /* no class by default */ + + ret = i2c_mux_add_adapter(muxc, force, num, class); + + if (ret) { + dev_err(&client->dev, + "failed to register multiplexed adapter" + " %d as bus %d\n", num, force); + goto add_mux_failed; + } } + /* Register sysfs hooks */ + switch (data->type) { + case as5712_54x_cpld1: + group = &as5712_54x_cpld1_group; + break; + case as5712_54x_cpld2: + group = &as5712_54x_cpld2_group; + break; + case as5712_54x_cpld3: + group = &as5712_54x_cpld3_group; + /* Bring QSFPs out of reset */ + as5712_54x_cpld_write_internal(client, 0x15, 0x3F); + break; + default: + break; + } + if (group) { ret = sysfs_create_group(&client->dev.kobj, group); if (ret) { - goto exit_mux_register; + goto add_mux_failed; } } + if (chips[data->type].nchans) { + dev_info(&client->dev, + "registered %d multiplexed busses for I2C %s\n", + num, client->name); + } + else { + dev_info(&client->dev, + "device %s registered\n", client->name); + } + as5712_54x_cpld_add_client(client); + return 0; -exit_mux_register: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) +add_mux_failed: i2c_mux_del_adapters(muxc); -#else - for (chan--; chan >= 0; chan--) { - i2c_del_mux_adapter(data->virt_adaps[chan]); - } -#endif - kfree(data); -exit: return ret; } static int as5712_54x_cpld_mux_remove(struct i2c_client *client) { - struct as5712_54x_cpld_data *data = i2c_get_clientdata(client); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) - struct i2c_mux_core *muxc = data->muxc; - - i2c_mux_del_adapters(muxc); -#else - const struct chip_desc *chip = &chips[data->type]; - int chan; + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as5712_54x_cpld_data *data = i2c_mux_priv(muxc); const struct attribute_group *group = NULL; as5712_54x_cpld_remove_client(client); @@ -1364,7 +1142,7 @@ static int as5712_54x_cpld_mux_remove(struct i2c_client *client) case as5712_54x_cpld2: group = &as5712_54x_cpld2_group; break; - case as5712_54x_cpld3: + case as5712_54x_cpld3: group = &as5712_54x_cpld3_group; break; default: @@ -1375,14 +1153,7 @@ static int as5712_54x_cpld_mux_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, group); } - for (chan = 0; chan < chip->nchans; ++chan) { - if (data->virt_adaps[chan]) { - i2c_del_mux_adapter(data->virt_adaps[chan]); - data->virt_adaps[chan] = NULL; - } - } -#endif - kfree(data); + i2c_mux_del_adapters(muxc); return 0; } @@ -1399,7 +1170,7 @@ static int as5712_54x_cpld_read_internal(struct i2c_client *client, u8 reg) continue; } - break; + break; } return status; @@ -1431,8 +1202,7 @@ int as5712_54x_cpld_read(unsigned short cpld_addr, u8 reg) mutex_lock(&list_lock); - list_for_each(list_node, &cpld_client_list) - { + list_for_each(list_node, &cpld_client_list) { cpld_node = list_entry(list_node, struct cpld_client_node, list); if (cpld_node->client->addr == cpld_addr) { @@ -1455,8 +1225,7 @@ int as5712_54x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) mutex_lock(&list_lock); - list_for_each(list_node, &cpld_client_list) - { + list_for_each(list_node, &cpld_client_list) { cpld_node = list_entry(list_node, struct cpld_client_node, list); if (cpld_node->client->addr == cpld_addr) { @@ -1471,30 +1240,14 @@ int as5712_54x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) } EXPORT_SYMBOL(as5712_54x_cpld_write); -#if 0 -int accton_i2c_cpld_mux_get_index(int adap_index) -{ - int i; - - for (i = 0; i < NUM_OF_ALL_CPLD_CHANS; i++) { - if (mux_adap_map[i] == adap_index) { - return i; - } - } - - return -EINVAL; -} -EXPORT_SYMBOL(accton_i2c_cpld_mux_get_index); -#endif - static struct i2c_driver as5712_54x_cpld_mux_driver = { - .driver = { - .name = "as5712_54x_cpld", - .owner = THIS_MODULE, + .driver = { + .name = "as5712_54x_cpld", + .owner = THIS_MODULE, }, - .probe = as5712_54x_cpld_mux_probe, - .remove = as5712_54x_cpld_mux_remove, - .id_table = as5712_54x_cpld_mux_id, + .probe = as5712_54x_cpld_mux_probe, + .remove = as5712_54x_cpld_mux_remove, + .id_table = as5712_54x_cpld_mux_id, }; static int __init as5712_54x_cpld_mux_init(void) @@ -1509,7 +1262,7 @@ static void __exit as5712_54x_cpld_mux_exit(void) } MODULE_AUTHOR("Brandon Chuang "); -MODULE_DESCRIPTION("Accton I2C CPLD mux driver"); +MODULE_DESCRIPTION("Accton as5712-54x CPLD driver"); MODULE_LICENSE("GPL"); module_init(as5712_54x_cpld_mux_init); diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py index e958cb596862..791409913448 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py @@ -14,7 +14,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . - """ Usage: %(scriptName)s [options] command object @@ -36,6 +35,7 @@ import logging import re import time +import pickle from collections import namedtuple PROJECT_NAME = 'as5712_54x' @@ -62,7 +62,7 @@ 'fan3': ['fan3_duty_cycle_percentage','fan3_fault', 'fan3_speed_rpm', 'fan3_direction', 'fanr3_fault', 'fanr3_speed_rpm'], 'fan4': ['fan4_duty_cycle_percentage','fan4_fault', 'fan4_speed_rpm', 'fan4_direction', 'fanr4_fault', 'fanr4_speed_rpm'], 'fan5': ['fan5_duty_cycle_percentage','fan5_fault', 'fan5_speed_rpm', 'fan5_direction', 'fanr5_fault', 'fanr5_speed_rpm'], - } + } hwmon_prefix ={'led': led_prefix, 'fan1': fan_prefix, 'fan2': fan_prefix, @@ -80,12 +80,19 @@ 'psu': ['psu_present ', 'psu_power_good'] , 'sfp': ['sfp_is_present ', 'sfp_tx_disable']} +QSFP_START = 48 +I2C_BUS_ORDER = -1 + sfp_map = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 54, 51, 53, 55] + +port_cpld_path = [ "/sys/bus/i2c/devices/0-0061/" + ,'/sys/bus/i2c/devices/0-0062/'] + mknod =[ 'echo as5712_54x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-0/new_device', 'echo as5712_54x_cpld2 0x61 > /sys/bus/i2c/devices/i2c-0/new_device', @@ -131,7 +138,7 @@ 'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-63/new_device', #EERPOM -'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-0/new_device', ] FORCE = 0 @@ -207,7 +214,7 @@ def show_set_help(): print cmd +" [led|sfp|fan]" print " use \""+ cmd + " led 0-4 \" to set led color" print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-54 {0|1}\" to set sfp# tx_disable" + print " use \""+ cmd + " sfp 1-48 {0|1}\" to set sfp# tx_disable" sys.exit(0) def show_eeprom_help(): @@ -289,10 +296,28 @@ def i2c_order_check(): status, output = log_os_system(tmp, 0) return order +def update_i2c_order(): + global I2C_BUS_ORDER + + order = i2c_order_check() + pickle.dump(order, open("/tmp/accton_util.p", "wb")) # save it + I2C_BUS_ORDER = order + print "[%s]Detected I2C_BUS_ORDER:%d" % (os.path.basename(__file__), I2C_BUS_ORDER) + +def get_i2c_order(): + global I2C_BUS_ORDER + if I2C_BUS_ORDER < 0: + if os.path.exists("/tmp/accton_util.p"): + I2C_BUS_ORDER = pickle.load(open("/tmp/accton_util.p", "rb")) + else: + update_i2c_order() + def device_install(): global FORCE + global I2C_BUS_ORDER - order = i2c_order_check() + update_i2c_order() + order = I2C_BUS_ORDER # if 0x76 is not exist @i2c-0, use reversed bus order if order: for i in range(0,len(mknod2)): @@ -318,7 +343,10 @@ def device_install(): return status for i in range(0,len(sfp_map)): - status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if i < QSFP_START: + status, output =log_os_system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + else: + status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) if status: print output if FORCE == 0: @@ -333,13 +361,10 @@ def device_install(): def device_uninstall(): global FORCE + global I2C_BUS_ORDER - status, output =log_os_system("ls /sys/bus/i2c/devices/0-0070", 0) - if status==0: - I2C_ORDER=1 - else: - I2C_ORDER=0 - + get_i2c_order() + order = I2C_BUS_ORDER for i in range(0,len(sfp_map)): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) @@ -348,7 +373,7 @@ def device_uninstall(): if FORCE == 0: return status - if I2C_ORDER==0: + if order == 0: nodelist = mknod else: nodelist = mknod2 @@ -476,7 +501,7 @@ def show_eeprom(index): if len(ALL_DEVICE)==0: devices_info() node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] - node = node.replace(node.split("/")[-1], 'sfp_eeprom') + node = node.replace(node.split("/")[-1], 'eeprom') # check if got hexdump command in current environment ret, log = log_os_system("which hexdump", 0) ret, log2 = log_os_system("which busybox hexdump", 0) @@ -498,6 +523,43 @@ def show_eeprom(index): print "**********device no found**********" return + +def get_cpld_path(index): + global I2C_BUS_ORDER + + if I2C_BUS_ORDER < 0: + get_i2c_order() + + if I2C_BUS_ORDER !=0 : + return port_cpld_path[index].replace("0-", "1-") + else: + return port_cpld_path[index] + +def cpld_path_of_port(port_index): + if port_index < 1 and port_index > DEVICE_NO['sfp']: + return None + if port_index < 25: + return get_cpld_path(0) + else: + return get_cpld_path(1) + +def get_path_sfp_tx_dis(port_index): + cpld_p = cpld_path_of_port(port_index) + if cpld_p == None: + return False, '' + else: + dev = cpld_p+"module_tx_disable_"+str(port_index) + return True, dev + +def get_path_sfp_presence(port_index): + cpld_p = cpld_path_of_port(port_index) + if cpld_p == None: + return False, '' + else: + dev = cpld_p+"module_present_"+str(port_index) + return True, dev + + def set_device(args): global DEVICE_NO global ALL_DEVICE @@ -535,7 +597,9 @@ def set_device(args): print ("Current fan duty: " + args[1] +"%") return ret elif args[0]=='sfp': - if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + #if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + #There no tx_disable for QSFP port + if int(args[1]) > QSFP_START or int(args[1])==0: show_set_help() return if len(args)<2: @@ -546,14 +610,13 @@ def set_device(args): show_set_help() return - #print ALL_DEVICE[args[0]] - for i in range(0,len(ALL_DEVICE[args[0]])): - for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: - if j.find('tx_disable')!= -1: - ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) - if ret: - return ret - + port_index = int(args[1]) + ret, dev = get_path_sfp_tx_dis(port_index) + if ret == False: + return False + else: + ret, log = log_os_system("echo "+args[2]+" >"+ dev, 1) + return ret return #get digits inside a string. @@ -562,6 +625,16 @@ def get_value(input): digit = re.findall('\d+', input) return int(digit[0]) +def print_1_device_traversal(i, j, k): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + return func+"="+log+" " + else: + return func+"="+"X"+" " + def device_traversal(): if system_ready()==False: print("System's not ready.") @@ -577,15 +650,26 @@ def device_traversal(): for j in sorted(ALL_DEVICE[i].keys(), key=get_value): print " "+j+":", - for k in (ALL_DEVICE[i][j]): - ret, log = log_os_system("cat "+k, 0) - func = k.split("/")[-1].strip() - func = re.sub(j+'_','',func,1) - func = re.sub(i.lower()+'_','',func,1) - if ret==0: - print func+"="+log+" ", - else: - print func+"="+"X"+" ", + if i == 'sfp': + port_index = int(filter(str.isdigit, j)) + for k in (ALL_DEVICE[i][j]): + if k.find('tx_disable')!= -1: + ret, k = get_path_sfp_tx_dis(port_index) + if ret == False: + continue + log = print_1_device_traversal(i, j, k) + print log, + if k.find('present')!= -1: + ret, k = get_path_sfp_presence(port_index) + if ret == False: + continue + log = print_1_device_traversal(i, j, k) + print log, + + else: + for k in (ALL_DEVICE[i][j]): + log = print_1_device_traversal(i, j, k) + print log, print print("----------------------------------------------------------------") diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/optoe.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/optoe.c deleted file mode 100755 index 16be2fef89b1..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/optoe.c +++ /dev/null @@ -1,1148 +0,0 @@ -/* - * optoe.c - A driver to read and write the EEPROM on optical transceivers - * (SFP, QSFP and similar I2C based devices) - * - * Copyright (C) 2014 Cumulus networks Inc. - * Copyright (C) 2017 Finisar 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 Freeoftware Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* - * Description: - * a) Optical transceiver EEPROM read/write transactions are just like - * the at24 eeproms managed by the at24.c i2c driver - * b) The register/memory layout is up to 256 128 byte pages defined by - * a "pages valid" register and switched via a "page select" - * register as explained in below diagram. - * c) 256 bytes are mapped at a time. 'Lower page 00h' is the first 128 - * bytes of address space, and always references the same - * location, independent of the page select register. - * All mapped pages are mapped into the upper 128 bytes - * (offset 128-255) of the i2c address. - * d) Devices with one I2C address (eg QSFP) use I2C address 0x50 - * (A0h in the spec), and map all pages in the upper 128 bytes - * of that address. - * e) Devices with two I2C addresses (eg SFP) have 256 bytes of data - * at I2C address 0x50, and 256 bytes of data at I2C address - * 0x51 (A2h in the spec). Page selection and paged access - * only apply to this second I2C address (0x51). - * e) The address space is presented, by the driver, as a linear - * address space. For devices with one I2C client at address - * 0x50 (eg QSFP), offset 0-127 are in the lower - * half of address 50/A0h/client[0]. Offset 128-255 are in - * page 0, 256-383 are page 1, etc. More generally, offset - * 'n' resides in page (n/128)-1. ('page -1' is the lower - * half, offset 0-127). - * f) For devices with two I2C clients at address 0x50 and 0x51 (eg SFP), - * the address space places offset 0-127 in the lower - * half of 50/A0/client[0], offset 128-255 in the upper - * half. Offset 256-383 is in the lower half of 51/A2/client[1]. - * Offset 384-511 is in page 0, in the upper half of 51/A2/... - * Offset 512-639 is in page 1, in the upper half of 51/A2/... - * Offset 'n' is in page (n/128)-3 (for n > 383) - * - * One I2c addressed (eg QSFP) Memory Map - * - * 2-Wire Serial Address: 1010000x - * - * Lower Page 00h (128 bytes) - * ===================== - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * |Page Select Byte(127)| - * ===================== - * | - * | - * | - * | - * V - * ------------------------------------------------------------ - * | | | | - * | | | | - * | | | | - * | | | | - * | | | | - * | | | | - * | | | | - * | | | | - * | | | | - * V V V V - * ------------ -------------- --------------- -------------- - * | | | | | | | | - * | Upper | | Upper | | Upper | | Upper | - * | Page 00h | | Page 01h | | Page 02h | | Page 03h | - * | | | (Optional) | | (Optional) | | (Optional | - * | | | | | | | for Cable | - * | | | | | | | Assemblies) | - * | ID | | AST | | User | | | - * | Fields | | Table | | EEPROM Data | | | - * | | | | | | | | - * | | | | | | | | - * | | | | | | | | - * ------------ -------------- --------------- -------------- - * - * The SFF 8436 (QSFP) spec only defines the 4 pages described above. - * In anticipation of future applications and devices, this driver - * supports access to the full architected range, 256 pages. - * - **/ - -/* #define DEBUG 1 */ - -#undef EEPROM_CLASS -#ifdef CONFIG_EEPROM_CLASS -#define EEPROM_CLASS -#endif -#ifdef CONFIG_EEPROM_CLASS_MODULE -#define EEPROM_CLASS -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * The optoe driver is for read/write access to the EEPROM on standard - * I2C based optical transceivers (SFP, QSFP, etc) - * - * While based on the at24 driver, it eliminates code that supports other - * types of I2C EEPROMs, and adds support for pages accessed through the - * page-select register at offset 127. - */ - -struct optoe_platform_data { - u32 byte_len; /* size (sum of all addr) */ - u16 page_size; /* for writes */ - u8 flags; - - void (*setup)(struct memory_accessor *, void *context); - void *context; -#ifdef EEPROM_CLASS - struct eeprom_platform_data *eeprom_data; /* extra data for the eeprom_class */ -#endif -}; - -#ifdef EEPROM_CLASS -#include -#endif - -#include - -/* fundamental unit of addressing for EEPROM */ -#define OPTOE_PAGE_SIZE 128 -/* - * Single address devices (eg QSFP) have 256 pages, plus the unpaged - * low 128 bytes. If the device does not support paging, it is - * only 2 'pages' long. - */ -#define OPTOE_ARCH_PAGES 256 -#define ONE_ADDR_EEPROM_SIZE ((1 + OPTOE_ARCH_PAGES) * OPTOE_PAGE_SIZE) -#define ONE_ADDR_EEPROM_UNPAGED_SIZE (2 * OPTOE_PAGE_SIZE) -/* - * Dual address devices (eg SFP) have 256 pages, plus the unpaged - * low 128 bytes, plus 256 bytes at 0x50. If the device does not - * support paging, it is 4 'pages' long. - */ -#define TWO_ADDR_EEPROM_SIZE ((3 + OPTOE_ARCH_PAGES) * OPTOE_PAGE_SIZE) -#define TWO_ADDR_EEPROM_UNPAGED_SIZE (4 * OPTOE_PAGE_SIZE) - -/* a few constants to find our way around the EEPROM */ -#define OPTOE_PAGE_SELECT_REG 0x7F -#define ONE_ADDR_PAGEABLE_REG 0x02 -#define ONE_ADDR_NOT_PAGEABLE (1<<2) -#define TWO_ADDR_PAGEABLE_REG 0x40 -#define TWO_ADDR_PAGEABLE (1<<4) -#define OPTOE_ID_REG 0 - -/* The maximum length of a port name */ -#define MAX_PORT_NAME_LEN 20 -struct optoe_data { - struct optoe_platform_data chip; - struct memory_accessor macc; - int use_smbus; - char port_name[MAX_PORT_NAME_LEN]; - - /* - * Lock protects against activities from other Linux tasks, - * but not from changes by other I2C masters. - */ - struct mutex lock; - struct bin_attribute bin; - struct attribute_group attr_group; - - u8 *writebuf; - unsigned write_max; - - unsigned num_addresses; - -#ifdef EEPROM_CLASS - struct eeprom_device *eeprom_dev; -#endif - - /* dev_class: ONE_ADDR (QSFP) or TWO_ADDR (SFP) */ - int dev_class; - - struct i2c_client *client[]; -}; - -typedef enum optoe_opcode { - OPTOE_READ_OP = 0, - OPTOE_WRITE_OP = 1 -} optoe_opcode_e; - -/* - * This parameter is to help this driver avoid blocking other drivers out - * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C - * clock, one 256 byte read takes about 1/43 second which is excessive; - * but the 1/170 second it takes at 400 kHz may be quite reasonable; and - * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. - * - * This value is forced to be a power of two so that writes align on pages. - */ -static unsigned io_limit = OPTOE_PAGE_SIZE; - -/* - * specs often allow 5 msec for a page write, sometimes 20 msec; - * it's important to recover from write timeouts. - */ -static unsigned write_timeout = 25; - -/* - * flags to distinguish one-address (QSFP family) from two-address (SFP family) - * If the family is not known, figure it out when the device is accessed - */ -#define ONE_ADDR 1 -#define TWO_ADDR 2 - -static const struct i2c_device_id optoe_ids[] = { - { "optoe1", ONE_ADDR }, - { "optoe2", TWO_ADDR }, - { "sff8436", ONE_ADDR }, - { "24c04", TWO_ADDR }, - { /* END OF LIST */ } -}; -MODULE_DEVICE_TABLE(i2c, optoe_ids); - -/*-------------------------------------------------------------------------*/ -/* - * This routine computes the addressing information to be used for - * a given r/w request. - * - * Task is to calculate the client (0 = i2c addr 50, 1 = i2c addr 51), - * the page, and the offset. - * - * Handles both single address (eg QSFP) and two address (eg SFP). - * For SFP, offset 0-255 are on client[0], >255 is on client[1] - * Offset 256-383 are on the lower half of client[1] - * Pages are accessible on the upper half of client[1]. - * Offset >383 are in 128 byte pages mapped into the upper half - * - * For QSFP, all offsets are on client[0] - * offset 0-127 are on the lower half of client[0] (no paging) - * Pages are accessible on the upper half of client[1]. - * Offset >127 are in 128 byte pages mapped into the upper half - * - * Callers must not read/write beyond the end of a client or a page - * without recomputing the client/page. Hence offset (within page) - * plus length must be less than or equal to 128. (Note that this - * routine does not have access to the length of the call, hence - * cannot do the validity check.) - * - * Offset within Lower Page 00h and Upper Page 00h are not recomputed - */ - -static uint8_t optoe_translate_offset(struct optoe_data *optoe, - loff_t *offset, struct i2c_client **client) -{ - unsigned page = 0; - - *client = optoe->client[0]; - - /* if SFP style, offset > 255, shift to i2c addr 0x51 */ - if (optoe->dev_class == TWO_ADDR) { - if (*offset > 255) { - /* like QSFP, but shifted to client[1] */ - *client = optoe->client[1]; - *offset -= 256; - } - } - - /* - * if offset is in the range 0-128... - * page doesn't matter (using lower half), return 0. - * offset is already correct (don't add 128 to get to paged area) - */ - if (*offset < OPTOE_PAGE_SIZE) - return page; - - /* note, page will always be positive since *offset >= 128 */ - page = (*offset >> 7)-1; - /* 0x80 places the offset in the top half, offset is last 7 bits */ - *offset = OPTOE_PAGE_SIZE + (*offset & 0x7f); - - return page; /* note also returning client and offset */ -} - -static ssize_t optoe_eeprom_read(struct optoe_data *optoe, - struct i2c_client *client, - char *buf, unsigned offset, size_t count) -{ - struct i2c_msg msg[2]; - u8 msgbuf[2]; - unsigned long timeout, read_time; - int status, i; - - memset(msg, 0, sizeof(msg)); - - switch (optoe->use_smbus) { - case I2C_SMBUS_I2C_BLOCK_DATA: - /*smaller eeproms can work given some SMBus extension calls */ - if (count > I2C_SMBUS_BLOCK_MAX) - count = I2C_SMBUS_BLOCK_MAX; - break; - case I2C_SMBUS_WORD_DATA: - /* Check for odd length transaction */ - count = (count == 1) ? 1 : 2; - break; - case I2C_SMBUS_BYTE_DATA: - count = 1; - break; - default: - /* - * When we have a better choice than SMBus calls, use a - * combined I2C message. Write address; then read up to - * io_limit data bytes. msgbuf is u8 and will cast to our - * needs. - */ - i = 0; - msgbuf[i++] = offset; - - msg[0].addr = client->addr; - msg[0].buf = msgbuf; - msg[0].len = i; - - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].buf = buf; - msg[1].len = count; - } - - /* - * Reads fail if the previous write didn't complete yet. We may - * loop a few times until this one succeeds, waiting at least - * long enough for one entire page write to work. - */ - timeout = jiffies + msecs_to_jiffies(write_timeout); - do { - read_time = jiffies; - - switch (optoe->use_smbus) { - case I2C_SMBUS_I2C_BLOCK_DATA: - status = i2c_smbus_read_i2c_block_data(client, offset, - count, buf); - break; - case I2C_SMBUS_WORD_DATA: - status = i2c_smbus_read_word_data(client, offset); - if (status >= 0) { - buf[0] = status & 0xff; - if (count == 2) - buf[1] = status >> 8; - status = count; - } - break; - case I2C_SMBUS_BYTE_DATA: - status = i2c_smbus_read_byte_data(client, offset); - if (status >= 0) { - buf[0] = status; - status = count; - } - break; - default: - status = i2c_transfer(client->adapter, msg, 2); - if (status == 2) - status = count; - } - - dev_dbg(&client->dev, "eeprom read %zu@%d --> %d (%ld)\n", - count, offset, status, jiffies); - - if (status == count) /* happy path */ - return count; - - if (status == -ENXIO) /* no module present */ - return status; - - /* REVISIT: at HZ=100, this is sloooow */ - msleep(1); - } while (time_before(read_time, timeout)); - - return -ETIMEDOUT; -} - -static ssize_t optoe_eeprom_write(struct optoe_data *optoe, - struct i2c_client *client, - const char *buf, - unsigned offset, size_t count) -{ - struct i2c_msg msg; - ssize_t status; - unsigned long timeout, write_time; - unsigned next_page_start; - int i = 0; - - /* write max is at most a page - * (In this driver, write_max is actually one byte!) - */ - if (count > optoe->write_max) - count = optoe->write_max; - - /* shorten count if necessary to avoid crossing page boundary */ - next_page_start = roundup(offset + 1, OPTOE_PAGE_SIZE); - if (offset + count > next_page_start) - count = next_page_start - offset; - - switch (optoe->use_smbus) { - case I2C_SMBUS_I2C_BLOCK_DATA: - /*smaller eeproms can work given some SMBus extension calls */ - if (count > I2C_SMBUS_BLOCK_MAX) - count = I2C_SMBUS_BLOCK_MAX; - break; - case I2C_SMBUS_WORD_DATA: - /* Check for odd length transaction */ - count = (count == 1) ? 1 : 2; - break; - case I2C_SMBUS_BYTE_DATA: - count = 1; - break; - default: - /* If we'll use I2C calls for I/O, set up the message */ - msg.addr = client->addr; - msg.flags = 0; - - /* msg.buf is u8 and casts will mask the values */ - msg.buf = optoe->writebuf; - - msg.buf[i++] = offset; - memcpy(&msg.buf[i], buf, count); - msg.len = i + count; - break; - } - - /* - * Reads fail if the previous write didn't complete yet. We may - * loop a few times until this one succeeds, waiting at least - * long enough for one entire page write to work. - */ - timeout = jiffies + msecs_to_jiffies(write_timeout); - do { - write_time = jiffies; - - switch (optoe->use_smbus) { - case I2C_SMBUS_I2C_BLOCK_DATA: - status = i2c_smbus_write_i2c_block_data(client, - offset, count, buf); - if (status == 0) - status = count; - break; - case I2C_SMBUS_WORD_DATA: - if (count == 2) { - status = i2c_smbus_write_word_data(client, - offset, (u16)((buf[0])|(buf[1] << 8))); - } else { - /* count = 1 */ - status = i2c_smbus_write_byte_data(client, - offset, buf[0]); - } - if (status == 0) - status = count; - break; - case I2C_SMBUS_BYTE_DATA: - status = i2c_smbus_write_byte_data(client, offset, - buf[0]); - if (status == 0) - status = count; - break; - default: - status = i2c_transfer(client->adapter, &msg, 1); - if (status == 1) - status = count; - break; - } - - dev_dbg(&client->dev, "eeprom write %zu@%d --> %ld (%lu)\n", - count, offset, (long int) status, jiffies); - - if (status == count) - return count; - - /* REVISIT: at HZ=100, this is sloooow */ - msleep(1); - } while (time_before(write_time, timeout)); - - return -ETIMEDOUT; -} - - -static ssize_t optoe_eeprom_update_client(struct optoe_data *optoe, - char *buf, loff_t off, - size_t count, optoe_opcode_e opcode) -{ - struct i2c_client *client; - ssize_t retval = 0; - uint8_t page = 0; - loff_t phy_offset = off; - int ret = 0; - - page = optoe_translate_offset(optoe, &phy_offset, &client); - dev_dbg(&client->dev, - "optoe_eeprom_update_client off %lld page:%d phy_offset:%lld, count:%ld, opcode:%d\n", - off, page, phy_offset, (long int) count, opcode); - if (page > 0) { - ret = optoe_eeprom_write(optoe, client, &page, - OPTOE_PAGE_SELECT_REG, 1); - if (ret < 0) { - dev_dbg(&client->dev, - "Write page register for page %d failed ret:%d!\n", - page, ret); - return ret; - } - } - - while (count) { - ssize_t status; - - if (opcode == OPTOE_READ_OP) { - status = optoe_eeprom_read(optoe, client, - buf, phy_offset, count); - } else { - status = optoe_eeprom_write(optoe, client, - buf, phy_offset, count); - } - if (status <= 0) { - if (retval == 0) - retval = status; - break; - } - buf += status; - phy_offset += status; - count -= status; - retval += status; - } - - - if (page > 0) { - /* return the page register to page 0 (why?) */ - page = 0; - ret = optoe_eeprom_write(optoe, client, &page, - OPTOE_PAGE_SELECT_REG, 1); - if (ret < 0) { - dev_err(&client->dev, - "Restore page register to 0 failed:%d!\n", ret); - /* error only if nothing has been transferred */ - if (retval == 0) retval = ret; - } - } - return retval; -} - -/* - * Figure out if this access is within the range of supported pages. - * Note this is called on every access because we don't know if the - * module has been replaced since the last call. - * If/when modules support more pages, this is the routine to update - * to validate and allow access to additional pages. - * - * Returns updated len for this access: - * - entire access is legal, original len is returned. - * - access begins legal but is too long, len is truncated to fit. - * - initial offset exceeds supported pages, return -EINVAL - */ -static ssize_t optoe_page_legal(struct optoe_data *optoe, - loff_t off, size_t len) -{ - struct i2c_client *client = optoe->client[0]; - u8 regval; - int status; - size_t maxlen; - - if (off < 0) return -EINVAL; - if (optoe->dev_class == TWO_ADDR) { - /* SFP case */ - /* if no pages needed, we're good */ - if ((off + len) <= TWO_ADDR_EEPROM_UNPAGED_SIZE) return len; - /* if offset exceeds possible pages, we're not good */ - if (off >= TWO_ADDR_EEPROM_SIZE) return -EINVAL; - /* in between, are pages supported? */ - status = optoe_eeprom_read(optoe, client, ®val, - TWO_ADDR_PAGEABLE_REG, 1); - if (status < 0) return status; /* error out (no module?) */ - if (regval & TWO_ADDR_PAGEABLE) { - /* Pages supported, trim len to the end of pages */ - maxlen = TWO_ADDR_EEPROM_SIZE - off; - } else { - /* pages not supported, trim len to unpaged size */ - if (off >= TWO_ADDR_EEPROM_UNPAGED_SIZE) return -EINVAL; - maxlen = TWO_ADDR_EEPROM_UNPAGED_SIZE - off; - } - len = (len > maxlen) ? maxlen : len; - dev_dbg(&client->dev, - "page_legal, SFP, off %lld len %ld\n", - off, (long int) len); - } else { - /* QSFP case */ - /* if no pages needed, we're good */ - if ((off + len) <= ONE_ADDR_EEPROM_UNPAGED_SIZE) return len; - /* if offset exceeds possible pages, we're not good */ - if (off >= ONE_ADDR_EEPROM_SIZE) return -EINVAL; - /* in between, are pages supported? */ - status = optoe_eeprom_read(optoe, client, ®val, - ONE_ADDR_PAGEABLE_REG, 1); - if (status < 0) return status; /* error out (no module?) */ - if (regval & ONE_ADDR_NOT_PAGEABLE) { - /* pages not supported, trim len to unpaged size */ - if (off >= ONE_ADDR_EEPROM_UNPAGED_SIZE) return -EINVAL; - maxlen = ONE_ADDR_EEPROM_UNPAGED_SIZE - off; - } else { - /* Pages supported, trim len to the end of pages */ - maxlen = ONE_ADDR_EEPROM_SIZE - off; - } - len = (len > maxlen) ? maxlen : len; - dev_dbg(&client->dev, - "page_legal, QSFP, off %lld len %ld\n", - off, (long int) len); - } - return len; -} - -static ssize_t optoe_read_write(struct optoe_data *optoe, - char *buf, loff_t off, size_t len, optoe_opcode_e opcode) -{ - struct i2c_client *client = optoe->client[0]; - int chunk; - int status = 0; - ssize_t retval; - size_t pending_len = 0, chunk_len = 0; - loff_t chunk_offset = 0, chunk_start_offset = 0; - - dev_dbg(&client->dev, - "optoe_read_write: off %lld len:%ld, opcode:%s\n", - off, (long int) len, (opcode == OPTOE_READ_OP) ? "r": "w"); - if (unlikely(!len)) - return len; - - /* - * Read data from chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&optoe->lock); - - /* - * Confirm this access fits within the device suppored addr range - */ - status = optoe_page_legal(optoe, off, len); - if (status < 0) { - goto err; - } - len = status; - - /* - * For each (128 byte) chunk involved in this request, issue a - * separate call to sff_eeprom_update_client(), to - * ensure that each access recalculates the client/page - * and writes the page register as needed. - * Note that chunk to page mapping is confusing, is different for - * QSFP and SFP, and never needs to be done. Don't try! - */ - pending_len = len; /* amount remaining to transfer */ - retval = 0; /* amount transferred */ - for (chunk = off >> 7; chunk <= (off + len - 1) >> 7; chunk++) { - - /* - * Compute the offset and number of bytes to be read/write - * - * 1. start at offset 0 (within the chunk), and read/write - * the entire chunk - * 2. start at offset 0 (within the chunk) and read/write less - * than entire chunk - * 3. start at an offset not equal to 0 and read/write the rest - * of the chunk - * 4. start at an offset not equal to 0 and read/write less than - * (end of chunk - offset) - */ - chunk_start_offset = chunk * OPTOE_PAGE_SIZE; - - if (chunk_start_offset < off) { - chunk_offset = off; - if ((off + pending_len) < (chunk_start_offset + - OPTOE_PAGE_SIZE)) - chunk_len = pending_len; - else - chunk_len = OPTOE_PAGE_SIZE - off; - } else { - chunk_offset = chunk_start_offset; - if (pending_len > OPTOE_PAGE_SIZE) - chunk_len = OPTOE_PAGE_SIZE; - else - chunk_len = pending_len; - } - - dev_dbg(&client->dev, - "sff_r/w: off %lld, len %ld, chunk_start_offset %lld, chunk_offset %lld, chunk_len %ld, pending_len %ld\n", - off, (long int) len, chunk_start_offset, chunk_offset, - (long int) chunk_len, (long int) pending_len); - - /* - * note: chunk_offset is from the start of the EEPROM, - * not the start of the chunk - */ - status = optoe_eeprom_update_client(optoe, buf, - chunk_offset, chunk_len, opcode); - if (status != chunk_len) { - /* This is another 'no device present' path */ - dev_dbg(&client->dev, - "optoe_update_client for chunk %d chunk_offset %lld chunk_len %ld failed %d!\n", - chunk, chunk_offset, (long int) chunk_len, status); - goto err; - } - buf += status; - pending_len -= status; - retval += status; - } - mutex_unlock(&optoe->lock); - - return retval; - -err: - mutex_unlock(&optoe->lock); - - return status; -} - -static ssize_t optoe_bin_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct i2c_client *client = to_i2c_client(container_of(kobj, - struct device, kobj)); - struct optoe_data *optoe = i2c_get_clientdata(client); - - return optoe_read_write(optoe, buf, off, count, OPTOE_READ_OP); -} - - -static ssize_t optoe_bin_write(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct i2c_client *client = to_i2c_client(container_of(kobj, - struct device, kobj)); - struct optoe_data *optoe = i2c_get_clientdata(client); - - return optoe_read_write(optoe, buf, off, count, OPTOE_WRITE_OP); -} -/*-------------------------------------------------------------------------*/ - -/* - * This lets other kernel code access the eeprom data. For example, it - * might hold a board's Ethernet address, or board-specific calibration - * data generated on the manufacturing floor. - */ - -static ssize_t optoe_macc_read(struct memory_accessor *macc, - char *buf, off_t offset, size_t count) -{ - struct optoe_data *optoe = container_of(macc, - struct optoe_data, macc); - - return optoe_read_write(optoe, buf, offset, count, OPTOE_READ_OP); -} - -static ssize_t optoe_macc_write(struct memory_accessor *macc, - const char *buf, off_t offset, size_t count) -{ - struct optoe_data *optoe = container_of(macc, - struct optoe_data, macc); - - return optoe_read_write(optoe, (char *) buf, offset, - count, OPTOE_WRITE_OP); -} - -/*-------------------------------------------------------------------------*/ - -static int optoe_remove(struct i2c_client *client) -{ - struct optoe_data *optoe; - int i; - - optoe = i2c_get_clientdata(client); - sysfs_remove_group(&client->dev.kobj, &optoe->attr_group); - sysfs_remove_bin_file(&client->dev.kobj, &optoe->bin); - - for (i = 1; i < optoe->num_addresses; i++) - i2c_unregister_device(optoe->client[i]); - -#ifdef EEPROM_CLASS - eeprom_device_unregister(optoe->eeprom_dev); -#endif - - kfree(optoe->writebuf); - kfree(optoe); - return 0; -} - -static ssize_t show_port_name(struct device *dev, - struct device_attribute *dattr, char *buf) -{ - struct i2c_client *client = to_i2c_client(dev); - struct optoe_data *optoe = i2c_get_clientdata(client); - ssize_t count; - - mutex_lock(&optoe->lock); - count = sprintf(buf, "%s\n", optoe->port_name); - mutex_unlock(&optoe->lock); - - return count; -} - -static ssize_t set_port_name(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - struct optoe_data *optoe = i2c_get_clientdata(client); - char port_name[MAX_PORT_NAME_LEN]; - - /* no checking, this value is not used except by show_port_name */ - - if (sscanf(buf, "%19s", port_name) != 1) - return -EINVAL; - - mutex_lock(&optoe->lock); - strcpy(optoe->port_name, port_name); - mutex_unlock(&optoe->lock); - - return count; -} - -static DEVICE_ATTR(port_name, S_IRUGO | S_IWUSR, - show_port_name, set_port_name); - -static ssize_t show_dev_class(struct device *dev, - struct device_attribute *dattr, char *buf) -{ - struct i2c_client *client = to_i2c_client(dev); - struct optoe_data *optoe = i2c_get_clientdata(client); - ssize_t count; - - mutex_lock(&optoe->lock); - count = sprintf(buf, "%d\n", optoe->dev_class); - mutex_unlock(&optoe->lock); - - return count; -} - -static ssize_t set_dev_class(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct i2c_client *client = to_i2c_client(dev); - struct optoe_data *optoe = i2c_get_clientdata(client); - int dev_class; - - /* - * dev_class is actually the number of sfp ports used, thus - * legal values are "1" (QSFP class) and "2" (SFP class) - */ - if (sscanf(buf, "%d", &dev_class) != 1 || - dev_class < 1 || dev_class > 2) - return -EINVAL; - - mutex_lock(&optoe->lock); - optoe->dev_class = dev_class; - mutex_unlock(&optoe->lock); - - return count; -} - -static DEVICE_ATTR(dev_class, S_IRUGO | S_IWUSR, - show_dev_class, set_dev_class); - -static struct attribute *optoe_attrs[] = { - &dev_attr_port_name.attr, - &dev_attr_dev_class.attr, - NULL, -}; - -static struct attribute_group optoe_attr_group = { - .attrs = optoe_attrs, -}; - -static int optoe_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int err; - int use_smbus = 0; - struct optoe_platform_data chip; - struct optoe_data *optoe; - int num_addresses = 0; - int i = 0; - - if (client->addr != 0x50) { - dev_dbg(&client->dev, "probe, bad i2c addr: 0x%x\n", - client->addr); - err = -EINVAL; - goto exit; - } - - if (client->dev.platform_data) { - chip = *(struct optoe_platform_data *)client->dev.platform_data; - dev_dbg(&client->dev, "probe, chip provided, flags:0x%x; name: %s\n", chip.flags, client->name); - } else { - if (!id->driver_data) { - err = -ENODEV; - goto exit; - } - dev_dbg(&client->dev, "probe, building chip\n"); - chip.flags = 0; - chip.setup = NULL; - chip.context = NULL; -#ifdef EEPROM_CLASS - chip.eeprom_data = NULL; -#endif - } - - /* Use I2C operations unless we're stuck with SMBus extensions. */ - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { - if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { - use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_WORD_DATA)) { - use_smbus = I2C_SMBUS_WORD_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - use_smbus = I2C_SMBUS_BYTE_DATA; - } else { - err = -EPFNOSUPPORT; - goto exit; - } - } - - - /* - * Make room for two i2c clients - */ - num_addresses = 2; - - optoe = kzalloc(sizeof(struct optoe_data) + - num_addresses * sizeof(struct i2c_client *), - GFP_KERNEL); - if (!optoe) { - err = -ENOMEM; - goto exit; - } - - mutex_init(&optoe->lock); - - /* determine whether this is a one-address or two-address module */ - if ((strcmp(client->name, "optoe1") == 0) || - (strcmp(client->name, "sff8436") == 0)) { - /* one-address (eg QSFP) family */ - optoe->dev_class = ONE_ADDR; - chip.byte_len = ONE_ADDR_EEPROM_SIZE; - num_addresses = 1; - } else if ((strcmp(client->name, "optoe2") == 0) || - (strcmp(client->name, "24c04") == 0)) { - /* SFP family */ - optoe->dev_class = TWO_ADDR; - chip.byte_len = TWO_ADDR_EEPROM_SIZE; - } else { /* those were the only two choices */ - err = -EINVAL; - goto exit; - } - - dev_dbg(&client->dev, "dev_class: %d\n", optoe->dev_class); - optoe->use_smbus = use_smbus; - optoe->chip = chip; - optoe->num_addresses = num_addresses; - strcpy(optoe->port_name, "unitialized"); - - /* - * Export the EEPROM bytes through sysfs, since that's convenient. - * By default, only root should see the data (maybe passwords etc) - */ - sysfs_bin_attr_init(&optoe->bin); - optoe->bin.attr.name = "eeprom"; - optoe->bin.attr.mode = S_IRUGO; - optoe->bin.read = optoe_bin_read; - optoe->bin.size = chip.byte_len; - - optoe->macc.read = optoe_macc_read; - - if (!use_smbus || - (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) || - i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_WORD_DATA) || - i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { - /* - * NOTE: AN-2079 - * Finisar recommends that the host implement 1 byte writes - * only since this module only supports 32 byte page boundaries. - * 2 byte writes are acceptable for PE and Vout changes per - * Application Note AN-2071. - */ - unsigned write_max = 1; - - optoe->macc.write = optoe_macc_write; - - optoe->bin.write = optoe_bin_write; - optoe->bin.attr.mode |= S_IWUSR; - - if (write_max > io_limit) - write_max = io_limit; - if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) - write_max = I2C_SMBUS_BLOCK_MAX; - optoe->write_max = write_max; - - /* buffer (data + address at the beginning) */ - optoe->writebuf = kmalloc(write_max + 2, GFP_KERNEL); - if (!optoe->writebuf) { - err = -ENOMEM; - goto exit_kfree; - } - } else { - dev_warn(&client->dev, - "cannot write due to controller restrictions."); - } - - optoe->client[0] = client; - - /* use a dummy I2C device for two-address chips */ - for (i = 1; i < num_addresses; i++) { - optoe->client[i] = i2c_new_dummy(client->adapter, - client->addr + i); - if (!optoe->client[i]) { - dev_err(&client->dev, "address 0x%02x unavailable\n", - client->addr + i); - err = -EADDRINUSE; - goto err_struct; - } - } - - /* create the sysfs eeprom file */ - err = sysfs_create_bin_file(&client->dev.kobj, &optoe->bin); - if (err) - goto err_struct; - - optoe->attr_group = optoe_attr_group; - - err = sysfs_create_group(&client->dev.kobj, &optoe->attr_group); - if (err) { - dev_err(&client->dev, "failed to create sysfs attribute group.\n"); - goto err_struct; - } -#ifdef EEPROM_CLASS - optoe->eeprom_dev = eeprom_device_register(&client->dev, - chip.eeprom_data); - if (IS_ERR(optoe->eeprom_dev)) { - dev_err(&client->dev, "error registering eeprom device.\n"); - err = PTR_ERR(optoe->eeprom_dev); - goto err_sysfs_cleanup; - } -#endif - - i2c_set_clientdata(client, optoe); - - dev_info(&client->dev, "%zu byte %s EEPROM, %s\n", - optoe->bin.size, client->name, - optoe->bin.write ? "read/write" : "read-only"); - - if (use_smbus == I2C_SMBUS_WORD_DATA || - use_smbus == I2C_SMBUS_BYTE_DATA) { - dev_notice(&client->dev, "Falling back to %s reads, " - "performance will suffer\n", use_smbus == - I2C_SMBUS_WORD_DATA ? "word" : "byte"); - } - - if (chip.setup) - chip.setup(&optoe->macc, chip.context); - - return 0; - -#ifdef EEPROM_CLASS -err_sysfs_cleanup: - sysfs_remove_group(&client->dev.kobj, &optoe->attr_group); - sysfs_remove_bin_file(&client->dev.kobj, &optoe->bin); -#endif - -err_struct: - for (i = 1; i < num_addresses; i++) { - if (optoe->client[i]) - i2c_unregister_device(optoe->client[i]); - } - - kfree(optoe->writebuf); -exit_kfree: - kfree(optoe); -exit: - dev_dbg(&client->dev, "probe error %d\n", err); - - return err; -} - -/*-------------------------------------------------------------------------*/ - -static struct i2c_driver optoe_driver = { - .driver = { - .name = "optoe", - .owner = THIS_MODULE, - }, - .probe = optoe_probe, - .remove = optoe_remove, - .id_table = optoe_ids, -}; - -static int __init optoe_init(void) -{ - - if (!io_limit) { - pr_err("optoe: io_limit must not be 0!\n"); - return -EINVAL; - } - - io_limit = rounddown_pow_of_two(io_limit); - return i2c_add_driver(&optoe_driver); -} -module_init(optoe_init); - -static void __exit optoe_exit(void) -{ - i2c_del_driver(&optoe_driver); -} -module_exit(optoe_exit); - -MODULE_DESCRIPTION("Driver for optical transceiver (SFP, QSFP, ...) EEPROMs"); -MODULE_AUTHOR("DON BOLLINGER "); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/control b/platform/broadcom/sonic-platform-modules-accton/debian/control index 22faf6d202b8..8b020a6644e0 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/control +++ b/platform/broadcom/sonic-platform-modules-accton/debian/control @@ -2,40 +2,33 @@ Source: sonic-accton-platform-modules Section: main Priority: extra Maintainer: Accton network , Accton Network -Build-Depends: debhelper (>= 8.0.0), bzip2 +Build-Depends: debhelper (>= 9), bzip2 Standards-Version: 3.9.3 Package: sonic-platform-accton-as7712-32x Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-accton-as5712-54x Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-accton-as7816-64x Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-accton-as7716-32x Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-accton-as7716-32xb Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-accton-as7312-54x Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-accton-as7326-56x Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 Description: kernel modules for platform devices such as fan, led, sfp From dedd5624a06aaae81425b9c03714f6801e7b6251 Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Tue, 2 Oct 2018 06:08:26 -0700 Subject: [PATCH 1654/1833] =?UTF-8?q?Adapt=20to=20the=20new=20WARM=5FRESTA?= =?UTF-8?q?RT=5FTABLE=20table=20schema:=20change=20from=20restart=E2=80=A6?= =?UTF-8?q?=20(#2083)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adapt to the new WARM_RESTART_TABLE table schema: change from restart_count to restore_count Signed-off-by: Jipan Yang * Update variable and function name to match restore_count name change Signed-off-by: Jipan Yang * Update swss submodule for warm restart schema change Signed-off-by: Jipan Yang --- dockers/docker-orchagent/swssconfig.sh | 4 ++-- files/scripts/swss.sh | 8 ++++---- src/sonic-swss | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 7188703d23ea..c6915f0597a1 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -47,8 +47,8 @@ SYSTEM_WARM_START=`redis-cli -n 4 hget "WARM_RESTART|system" enable` SWSS_WARM_START=`redis-cli -n 4 hget "WARM_RESTART|swss" enable` if [[ "$SYSTEM_WARM_START" == "true" ]] || [[ "$SWSS_WARM_START" == "true" ]]; then # We have to make sure db data has not been flushed. - RESTART_COUNT=`redis-cli -n 6 hget "WARM_RESTART_TABLE|orchagent" restart_count` - if [[ -n "$RESTART_COUNT" ]] && [[ "$RESTART_COUNT" != "0" ]]; then + RESTORE_COUNT=`redis-cli -n 6 hget "WARM_RESTART_TABLE|orchagent" restore_count` + if [[ -n "$RESTORE_COUNT" ]] && [[ "$RESTORE_COUNT" != "0" ]]; then exit 0 fi fi diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 22f1f0d668dd..f7fe1a5510cd 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -38,12 +38,12 @@ function check_warm_boot() fi } -function validate_restart_count() +function validate_restore_count() { if [[ x"$WARM_BOOT" == x"true" ]]; then - RESTART_COUNT=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_TABLE|orchagent" restart_count` + RESTORE_COUNT=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_TABLE|orchagent" restore_count` # We have to make sure db data has not been flushed. - if [[ -z "$RESTART_COUNT" ]]; then + if [[ -z "$RESTORE_COUNT" ]]; then WARM_BOOT="false" fi fi @@ -69,7 +69,7 @@ start() { wait_for_database_service check_warm_boot - validate_restart_count + validate_restore_count debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." diff --git a/src/sonic-swss b/src/sonic-swss index 13df5a98d4a6..f13aaed9f21f 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 13df5a98d4a6375a778b6216cff886a0c474aa9a +Subproject commit f13aaed9f21f457419e96a5d28a52d319fbee9ed From 6ba2f97f1ec1c15b3b644d571e83d30593bceb0b Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Tue, 2 Oct 2018 06:10:12 -0700 Subject: [PATCH 1655/1833] [devices]: Align flash partition at 1M (#2104) Flashes used for the 7050QX-32 and 7050QX-32S have a fw issue. The best option to solve the problem is to upgrade to a newer firmware. However this can only be done while in memory and take 10 seconds. Adding an upgrade mechanism is possible but would need more consideration as flashing the firmware and reformating the flash will exceed the fast-reboot requirements. A quick mitigation is to align the ext4 partition that we create on these vfat based system on a 4k boundary. Here we chose 1M instead but it's the same. Newer version of sfdisk do this automatically but the one in SONiC today doesn't have this behavior. This workaround will only reduce the pace of the flash health degradation. The only long term fix is to flash the firmware. --- files/initramfs-tools/arista-convertfs.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 1fc4db6ecfdb..abcf0c81b559 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -175,7 +175,7 @@ umount "$root_mnt" if [ $(echo -n "$root_dev" | tail -c 1) == "1" ]; then # Create a new partition table (content in flash_dev will be deleted) err_msg="Error: repartitioning $flash_dev failed" - cmd="echo ';' | sfdisk $flash_dev || (sleep 3; blockdev --rereadpt $flash_dev && fdisk -l $flash_dev | grep -q ${root_dev}.*Linux)" + cmd="echo '2048' | sfdisk $flash_dev || (sleep 3; blockdev --rereadpt $flash_dev && fdisk -l $flash_dev | grep -q ${root_dev}.*Linux)" run_cmd "$cmd" "$err_msg" fi From 673bb6580e19382bffce250802e987b0e0745353 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Tue, 2 Oct 2018 10:24:59 -0700 Subject: [PATCH 1656/1833] [sonic-frr]: FRR 4.0 integration with SONiC (#2099) * FRR 4.0 integration with SONiC -- Uses SONiC FRR repo frr/4.0 (which has SONiC support) to build image -- Makefile changes to make frr4.0 builtable. -- Updated/Added FRR configuration files -- bgpd jinja template fixes To build SONiC images with FRR4.0, simply edit rules/config file and change routing stack to following: SONIC_ROUTING_STACK = frr and then build images as usual. * Used integrated-vtysh-config in FRR Changed to single template: frr.conf.j2 for configuration and added tests --- .gitmodules | 2 +- dockers/docker-fpm-frr/Dockerfile.j2 | 3 +- dockers/docker-fpm-frr/bgpd.conf.j2 | 101 --------- dockers/docker-fpm-frr/config.sh | 8 +- dockers/docker-fpm-frr/daemons | 23 +- .../{debian.conf => daemons.conf} | 10 +- dockers/docker-fpm-frr/frr.conf.j2 | 209 ++++++++++++++++++ dockers/docker-fpm-frr/vtysh.conf | 1 + dockers/docker-fpm-frr/zebra.conf.j2 | 74 ------- rules/config | 4 +- rules/frr.mk | 4 +- sonic-slave/Dockerfile | 1 + .../{bgpd.conf => bgpd_quagga.conf} | 0 .../tests/sample_output/frr.conf | 136 ++++++++++++ .../{zebra.conf => zebra_quagga.conf} | 0 src/sonic-config-engine/tests/test_j2files.py | 14 +- src/sonic-frr/Makefile | 38 +++- src/sonic-frr/frr | 2 +- src/sonic-frr/sonic_frr.install | 23 -- src/sonic-frr/sonic_frr.rules | 99 --------- 20 files changed, 419 insertions(+), 333 deletions(-) delete mode 100644 dockers/docker-fpm-frr/bgpd.conf.j2 rename dockers/docker-fpm-frr/{debian.conf => daemons.conf} (60%) create mode 100644 dockers/docker-fpm-frr/frr.conf.j2 create mode 100644 dockers/docker-fpm-frr/vtysh.conf delete mode 100644 dockers/docker-fpm-frr/zebra.conf.j2 rename src/sonic-config-engine/tests/sample_output/{bgpd.conf => bgpd_quagga.conf} (100%) create mode 100644 src/sonic-config-engine/tests/sample_output/frr.conf rename src/sonic-config-engine/tests/sample_output/{zebra.conf => zebra_quagga.conf} (100%) delete mode 100644 src/sonic-frr/sonic_frr.install delete mode 100755 src/sonic-frr/sonic_frr.rules diff --git a/.gitmodules b/.gitmodules index 3977babe5127..79905318f822 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,7 +46,7 @@ url = https://github.com/Azure/sonic-platform-daemons [submodule "src/sonic-frr/frr"] path = src/sonic-frr/frr - url = https://github.com/FRRouting/frr.git + url = https://github.com/Azure/sonic-frr.git [submodule "platform/p4/p4-hlir/p4-hlir-v1.1"] path = platform/p4/p4-hlir/p4-hlir-v1.1 url = https://github.com/p4lang/p4-hlir.git diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 194b91f33499..f1cddbd0c416 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -33,7 +33,8 @@ RUN rm -rf /debs ~/.cache COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["start.sh", "config.sh", "/usr/bin/"] COPY ["daemons", "/etc/frr/"] -COPY ["debian.conf", "/etc/frr/"] +COPY ["daemons.conf", "/etc/frr/"] +COPY ["vtysh.conf", "/etc/frr/"] ENTRYPOINT /usr/bin/config.sh \ && /usr/bin/start.sh \ diff --git a/dockers/docker-fpm-frr/bgpd.conf.j2 b/dockers/docker-fpm-frr/bgpd.conf.j2 deleted file mode 100644 index 9afd6a5a8bf0..000000000000 --- a/dockers/docker-fpm-frr/bgpd.conf.j2 +++ /dev/null @@ -1,101 +0,0 @@ -! -{% block banner %} -! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/bgpd.conf.j2 with config DB data -! file: bgpd.conf -! -{% endblock banner %} -! -{% block system_init %} -hostname {{ DEVICE_METADATA['localhost']['hostname'] }} -password zebra -log syslog informational -log facility local4 -! enable password {# {{ en_passwd }} TODO: param needed #} -{% endblock system_init %} -! -{% block bgp_init %} -! -! bgp multiple-instance -! -router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} - bgp log-neighbor-changes - bgp bestpath as-path multipath-relax - no bgp default ipv4-unicast -{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #} -{% for (name, prefix) in LOOPBACK_INTERFACE %} -{% if prefix | ipv4 and name == 'Loopback0' %} - bgp router-id {{ prefix | ip }} -{% endif %} -{% endfor %} -{# advertise loopback #} - -{% for (name, prefix) in LOOPBACK_INTERFACE %} -{% if prefix | ipv4 %} - network {{ prefix | ip }}/32 -{% elif prefix | ipv6 %} - address-family ipv6 - network {{ prefix | ip }}/128 - exit-address-family -{% endif %} -{% endfor %} -{% endblock bgp_init %} -{% block vlan_advertisement %} -{% for (name, prefix) in VLAN_INTERFACE %} -{% if prefix | ipv4 %} - network {{ prefix }} -{% elif prefix | ipv6 %} - address-family ipv6 - network {{ prefix }} - exit-address-family -{% endif %} -{% endfor %} -{% endblock vlan_advertisement %} -{% block bgp_sessions %} -{% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} -{% if bgp_session['asn'] | int != 0 %} - neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} - neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} - neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }} -{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} - neighbor {{ neighbor_addr }} allowas-in 1 -{% endif %} -{% if neighbor_addr | ipv4 %} - address-family ipv4 - neighbor {{ neighbor_addr }} activate -{% if bgp_session['rrclient'] | int != 0 %} - neighbor {{ neighbor_addr }} route-reflector-client -{% endif %} -{% if bgp_session['nhopself'] | int != 0 %} - neighbor {{ neighbor_addr }} next-hop-self -{% endif %} - maximum-paths 64 - exit-address-family -{% endif %} -{% if neighbor_addr | ipv6 %} - address-family ipv6 - neighbor {{ neighbor_addr }} activate -{% if bgp_session['rrclient'] | int != 0 %} - neighbor {{ neighbor_addr }} route-reflector-client -{% endif %} -{% if bgp_session['nhopself'] | int != 0 %} - neighbor {{ neighbor_addr }} next-hop-self -{% endif %} -{% if bgp_session['asn'] != DEVICE_METADATA['localhost']['bgp_asn'] %} - neighbor {{ neighbor_addr }} route-map set-next-hop-global-v6 in -{% endif %} - maximum-paths 64 - exit-address-family -{% endif %} -{% endif %} -{% endfor %} -{% endblock bgp_sessions %} -! -maximum-paths 64 -! -route-map ISOLATE permit 10 -set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }} -! -route-map set-next-hop-global-v6 permit 10 -set ipv6 next-hop prefer-global -! diff --git a/dockers/docker-fpm-frr/config.sh b/dockers/docker-fpm-frr/config.sh index ef7a13a214f4..a0039abf5e73 100755 --- a/dockers/docker-fpm-frr/config.sh +++ b/dockers/docker-fpm-frr/config.sh @@ -1,8 +1,7 @@ #!/bin/bash mkdir -p /etc/frr -sonic-cfggen -d -t /usr/share/sonic/templates/bgpd.conf.j2 >/etc/frr/bgpd.conf -sonic-cfggen -d -t /usr/share/sonic/templates/zebra.conf.j2 >/etc/frr/zebra.conf +sonic-cfggen -d -t /usr/share/sonic/templates/frr.conf.j2 >/etc/frr/frr.conf sonic-cfggen -d -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate chown root:root /usr/sbin/bgp-isolate @@ -12,10 +11,5 @@ sonic-cfggen -d -t /usr/share/sonic/templates/unisolate.j2 >/usr/sbin/bgp-unisol chown root:root /usr/sbin/bgp-unisolate chmod 0755 /usr/sbin/bgp-unisolate -# If there's an integrated-config file, go ahead and remote it -if [ -f /etc/frr/frr.conf ]; then - rm -rf /etc/frr/frr.conf -fi - mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status diff --git a/dockers/docker-fpm-frr/daemons b/dockers/docker-fpm-frr/daemons index cb7c2322c9fb..c008d1248bf3 100644 --- a/dockers/docker-fpm-frr/daemons +++ b/dockers/docker-fpm-frr/daemons @@ -1,25 +1,25 @@ -# This file tells the quagga package which daemons to start. +# This file tells the frr package which daemons to start. # # Entries are in the format: =(yes|no|priority) # 0, "no" = disabled # 1, "yes" = highest priority # 2 .. 10 = lower priorities -# Read /usr/share/doc/quagga/README.Debian for details. +# Read /usr/share/doc/frr/README.Debian for details. # # Sample configurations for these daemons can be found in -# /usr/share/doc/quagga/examples/. +# /usr/share/doc/frr/examples/. # -# ATTENTION: +# ATTENTION: # # When activation a daemon at the first time, a config file, even if it is -# empty, has to be present *and* be owned by the user and group "quagga", else -# the daemon will not be started by /etc/init.d/quagga. The permissions should +# empty, has to be present *and* be owned by the user and group "frr", else +# the daemon will not be started by /etc/init.d/frr. The permissions should # be u=rw,g=r,o=. # When using "vtysh" such a config file is also needed. It should be owned by -# group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too. +# group "frrvty" and set to ug=rw,o= though. Check /etc/pam.d/frr, too. # -# The watchquagga daemon is always started. Per default in monitoring-only but -# that can be changed via /etc/quagga/debian.conf. +# The watchfrr daemon is always started. Per default in monitoring-only but +# that can be changed via /etc/frr/daemons.conf. # zebra=yes bgpd=yes @@ -28,4 +28,9 @@ ospf6d=no ripd=no ripngd=no isisd=no +pimd=no +ldpd=no +nhrpd=no +eigrpd=no babeld=no +sharpd=no diff --git a/dockers/docker-fpm-frr/debian.conf b/dockers/docker-fpm-frr/daemons.conf similarity index 60% rename from dockers/docker-fpm-frr/debian.conf rename to dockers/docker-fpm-frr/daemons.conf index 4724fc87422f..33f4acd0ae88 100644 --- a/dockers/docker-fpm-frr/debian.conf +++ b/dockers/docker-fpm-frr/daemons.conf @@ -14,7 +14,15 @@ isisd_options=" --daemon -A 127.0.0.1" pimd_options=" --daemon -A 127.0.0.1" ldpd_options=" --daemon -A 127.0.0.1" nhrpd_options=" --daemon -A 127.0.0.1" +eigrpd_options=" --daemon -A 127.0.0.1" +babeld_options=" --daemon -A 127.0.0.1" +sharpd_options=" --daemon -A 127.0.0.1" # The list of daemons to watch is automatically generated by the init script. watchfrr_enable=yes -watchfrr_options=(-adz -r /usr/sbin/servicebBfrrbBrestartbB%s -s /usr/sbin/servicebBfrrbBstartbB%s -k /usr/sbin/servicebBfrrbBstopbB%s -b bB -t 30) +watchfrr_options=(-d -r /usr/sbin/servicebBfrrbBrestartbB%s -s /usr/sbin/servicebBfrrbBstartbB%s -k /usr/sbin/servicebBfrrbBstopbB%s -b bB -t 30) + +# If valgrind_enable is 'yes' the frr daemons will be started via valgrind. +# The use case for doing so is tracking down memory leaks, etc in frr. +valgrind_enable=no +valgrind=/usr/bin/valgrind diff --git a/dockers/docker-fpm-frr/frr.conf.j2 b/dockers/docker-fpm-frr/frr.conf.j2 new file mode 100644 index 000000000000..d4fdec897da2 --- /dev/null +++ b/dockers/docker-fpm-frr/frr.conf.j2 @@ -0,0 +1,209 @@ +! +{% block banner %} +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/frr/frr.conf.j2 with config DB data +! file: frr.conf +! +{% endblock banner %} +! +{% block system_init %} +hostname {{ DEVICE_METADATA['localhost']['hostname'] }} +password zebra +log syslog informational +log facility local4 +! enable password {# {{ en_passwd }} TODO: param needed #} +{% endblock system_init %} +! +{% block interfaces %} +! Enable link-detect (default disabled) +{% for (name, prefix) in INTERFACE %} +interface {{ name }} +link-detect +! +{% endfor %} +{% for pc in PORTCHANNEL %} +interface {{ pc }} +link-detect +! +{% endfor %} +{% endblock interfaces %} +! +{% block default_route %} +! set static default route to mgmt gateway as a backup to learned default +{% for (name, prefix) in MGMT_INTERFACE %} +{% if prefix | ipv4 %} +ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 +{% endif %} +{% endfor %} +{% endblock default_route %} +! +{% block source_loopback %} +{% set lo_ipv4_addrs = [] %} +{% set lo_ipv6_addrs = [] %} +{% if LOOPBACK_INTERFACE %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if name == 'Loopback0' %} +{% if prefix | ipv6 %} +{% if lo_ipv6_addrs.append(prefix) %} +{% endif %} +{% else %} +{% if lo_ipv4_addrs.append(prefix) %} +{% endif %} +{% endif %} +{% endif %} +{% endfor %} +{% endif %} +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src {{ lo_ipv4_addrs[0] | ip }} +! +{% if lo_ipv6_addrs|length > 0 %} +route-map RM_SET_SRC6 permit 10 + set src {{ lo_ipv6_addrs[0] | ip }} +! +{% endif %} +ip protocol bgp route-map RM_SET_SRC +! +{% if lo_ipv6_addrs|length > 0 %} +ipv6 protocol bgp route-map RM_SET_SRC6 +! +{% endif %} +{% endblock source_loopback %} +! +{% if DEVICE_METADATA['localhost'].has_key('bgp_asn') %} +{% block bgp_init %} +! +! bgp multiple-instance +! +route-map FROM_BGP_SPEAKER_V4 permit 10 +! +route-map TO_BGP_SPEAKER_V4 deny 10 +! +router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} + bgp log-neighbor-changes + bgp bestpath as-path multipath-relax + no bgp default ipv4-unicast +{# Advertise graceful restart capability for ToR #} +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} + bgp graceful-restart +{% endif %} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv4 and name == 'Loopback0' %} + bgp router-id {{ prefix | ip }} +{% endif %} +{% endfor %} +{# advertise loopback #} +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if prefix | ipv4 and name == 'Loopback0' %} + network {{ prefix | ip }}/32 +{% elif prefix | ipv6 and name == 'Loopback0' %} + address-family ipv6 + network {{ prefix | ip }}/128 + exit-address-family +{% endif %} +{% endfor %} +{% endblock bgp_init %} +{% endif %} +{% block vlan_advertisement %} +{% for (name, prefix) in VLAN_INTERFACE %} +{% if prefix | ipv4 %} + network {{ prefix }} +{% elif prefix | ipv6 %} + address-family ipv6 + network {{ prefix }} + exit-address-family +{% endif %} +{% endfor %} +{% endblock vlan_advertisement %} +{% block bgp_sessions %} +{% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %} +{% if bgp_session['asn'] | int != 0 %} + neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} + neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} +{# set the bgp neighbor timers if they have not default values #} +{% if (bgp_session['keepalive'] is defined and bgp_session['keepalive'] | int != 60) + or (bgp_session['holdtime'] is defined and bgp_session['holdtime'] | int != 180) %} + neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }} +{% endif %} +{% if bgp_session.has_key('admin_status') and bgp_session['admin_status'] == 'down' or not bgp_session.has_key('admin_status') and DEVICE_METADATA['localhost'].has_key('default_bgp_status') and DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %} + neighbor {{ neighbor_addr }} shutdown +{% endif %} +{% if neighbor_addr | ipv4 %} + address-family ipv4 +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} + neighbor {{ neighbor_addr }} allowas-in 1 +{% endif %} + neighbor {{ neighbor_addr }} activate + neighbor {{ neighbor_addr }} soft-reconfiguration inbound +{% if bgp_session['rrclient'] | int != 0 %} + neighbor {{ neighbor_addr }} route-reflector-client +{% endif %} +{% if bgp_session['nhopself'] | int != 0 %} + neighbor {{ neighbor_addr }} next-hop-self +{% endif %} + maximum-paths 64 + exit-address-family +{% endif %} +{% if neighbor_addr | ipv6 %} + address-family ipv6 +{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} + neighbor {{ neighbor_addr }} allowas-in 1 +{% endif %} + neighbor {{ neighbor_addr }} activate + neighbor {{ neighbor_addr }} soft-reconfiguration inbound +{% if bgp_session['rrclient'] | int != 0 %} + neighbor {{ neighbor_addr }} route-reflector-client +{% endif %} +{% if bgp_session['nhopself'] | int != 0 %} + neighbor {{ neighbor_addr }} next-hop-self +{% endif %} +{% if bgp_session['asn'] != DEVICE_METADATA['localhost']['bgp_asn'] %} + neighbor {{ neighbor_addr }} route-map set-next-hop-global-v6 in +{% endif %} + maximum-paths 64 + exit-address-family +{% endif %} +{% endif %} +{% endfor %} +{% endblock bgp_sessions %} +{% block bgp_peers_with_range %} +{% if BGP_PEER_RANGE %} +{% for bgp_peer in BGP_PEER_RANGE.values() %} + neighbor {{ bgp_peer['name'] }} peer-group + neighbor {{ bgp_peer['name'] }} passive + neighbor {{ bgp_peer['name'] }} remote-as {{ deployment_id_asn_map[DEVICE_METADATA['localhost']['deployment_id']] }} + neighbor {{ bgp_peer['name'] }} ebgp-multihop 255 +{% for (name, prefix) in LOOPBACK_INTERFACE %} +{% if name == 'Loopback1' %} + neighbor {{ bgp_peer['name'] }} update-source {{ prefix | ip }} +{% endif %} +{% endfor %} +{% for ip_range in bgp_peer['ip_range'] %} + bgp listen range {{ip_range}} peer-group {{ bgp_peer['name'] }} +{% endfor %} + address-family ipv4 + neighbor {{ bgp_peer['name'] }} activate + neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound + neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in + neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out + maximum-paths 64 + exit-address-family + address-family ipv6 + neighbor {{ bgp_peer['name'] }} activate + neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound + maximum-paths 64 + exit-address-family +{% endfor %} +{% endif %} +{% endblock bgp_peers_with_range %} +! +{% if DEVICE_METADATA['localhost'].has_key('bgp_asn') %} +maximum-paths 64 +! +route-map ISOLATE permit 10 +set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }} +{% endif %} +! +route-map set-next-hop-global-v6 permit 10 +set ipv6 next-hop prefer-global +! diff --git a/dockers/docker-fpm-frr/vtysh.conf b/dockers/docker-fpm-frr/vtysh.conf new file mode 100644 index 000000000000..e0ab9cb6f314 --- /dev/null +++ b/dockers/docker-fpm-frr/vtysh.conf @@ -0,0 +1 @@ +service integrated-vtysh-config diff --git a/dockers/docker-fpm-frr/zebra.conf.j2 b/dockers/docker-fpm-frr/zebra.conf.j2 deleted file mode 100644 index 8b967f98671c..000000000000 --- a/dockers/docker-fpm-frr/zebra.conf.j2 +++ /dev/null @@ -1,74 +0,0 @@ -! -{% block banner %} -! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== -! generated by templates/quagga/zebra.conf.j2 using config DB data -! file: zebra.conf -! -{% endblock banner %} -! -{% block sys_init %} -hostname {{ DEVICE_METADATA['localhost']['hostname'] }} -password zebra -enable password zebra -{% endblock sys_init %} -! -{% block interfaces %} -! Enable link-detect (default disabled) -{% for (name, prefix) in INTERFACE %} -interface {{ name }} -link-detect -! -{% endfor %} -{% for pc in PORTCHANNEL %} -interface {{ pc }} -link-detect -! -{% endfor %} -{% endblock interfaces %} -! -{% block default_route %} -! set static default route to mgmt gateway as a backup to learned default -{% for (name, prefix) in MGMT_INTERFACE %} -{% if prefix | ipv4 %} -ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 -{% endif %} -{% endfor %} -{% endblock default_route %} -! -{% block source_loopback %} -{% set lo_ipv4_addrs = [] %} -{% set lo_ipv6_addrs = [] %} -{% if LOOPBACK_INTERFACE %} -{% for (name, prefix) in LOOPBACK_INTERFACE %} -{% if prefix | ipv6 %} -{% if lo_ipv6_addrs.append(prefix) %} -{% endif %} -{% else %} -{% if lo_ipv4_addrs.append(prefix) %} -{% endif %} -{% endif %} -{% endfor %} -{% endif %} -! Set ip source to loopback for bgp learned routes -route-map RM_SET_SRC permit 10 - set src {{ lo_ipv4_addrs[0] | ip }} -! -{% if lo_ipv6_addrs|length > 0 %} -route-map RM_SET_SRC6 permit 10 - set src {{ lo_ipv6_addrs[0] | ip }} -! -{% endif %} -ip protocol bgp route-map RM_SET_SRC -! -{% if lo_ipv6_addrs|length > 0 %} -ipv6 protocol bgp route-map RM_SET_SRC6 -! -{% endif %} -{% endblock source_loopback %} -! -{% block logging %} -log syslog informational -log facility local4 -{% endblock logging %} -! - diff --git a/rules/config b/rules/config index 5e8a3389530d..ae3ca4f83960 100644 --- a/rules/config +++ b/rules/config @@ -45,8 +45,8 @@ DEFAULT_PASSWORD = YourPaSsWoRd # SONIC_INSTALL_DEBUG_TOOLS = y # SONIC_ROUTING_STACK - specify the routing-stack being elected to drive SONiC's control-plane. -# Quagga will be the default routing-stack for all the SONiC platforms. Other supported -# routing-stacks: frr, gobgp. +# Supported routing stacks on SONiC are: +# routing-stacks: quagga, frr. SONIC_ROUTING_STACK = quagga # ENABLE_SYNCD_RPC - build docker-syncd with rpc packages for testing purposes. diff --git a/rules/frr.mk b/rules/frr.mk index 7fb1837585aa..2b7cc1fa14e4 100644 --- a/rules/frr.mk +++ b/rules/frr.mk @@ -1,9 +1,9 @@ # FRRouting (frr) package -FRR_VERSION = 3.0 +FRR_VERSION = 4.0 export FRR_VERSION -FRR = frr_$(FRR_VERSION)_amd64.deb +FRR = frr_$(FRR_VERSION)-1~sonic.debian8+1_amd64.deb $(FRR)_DEPENDS += $(LIBSNMP_DEV) $(FRR)_SRC_PATH = $(SRC_PATH)/sonic-frr SONIC_MAKE_DEBS += $(FRR) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index c284161c7edd..76ec1781d526 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -63,6 +63,7 @@ RUN apt-get update && apt-get install -y \ libjson0-dev \ libsystemd-dev \ python-ipaddr \ + install-info \ # For libnl3 (local) build cdbs \ # For SAI meta build diff --git a/src/sonic-config-engine/tests/sample_output/bgpd.conf b/src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf similarity index 100% rename from src/sonic-config-engine/tests/sample_output/bgpd.conf rename to src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf diff --git a/src/sonic-config-engine/tests/sample_output/frr.conf b/src/sonic-config-engine/tests/sample_output/frr.conf new file mode 100644 index 000000000000..7ea45508f236 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/frr.conf @@ -0,0 +1,136 @@ +! +! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== +! generated by templates/frr/frr.conf.j2 with config DB data +! file: frr.conf +! +! +hostname switch-t0 +password zebra +log syslog informational +log facility local4 +! enable password ! +! Enable link-detect (default disabled) +interface PortChannel01 +link-detect +! +interface PortChannel02 +link-detect +! +interface PortChannel03 +link-detect +! +interface PortChannel04 +link-detect +! +! +! set static default route to mgmt gateway as a backup to learned default +ip route 0.0.0.0/0 10.0.0.1 200 +! +! Set ip source to loopback for bgp learned routes +route-map RM_SET_SRC permit 10 + set src 10.1.0.32 +! + +route-map RM_SET_SRC6 permit 10 + set src fc00:1::32 +! +ip protocol bgp route-map RM_SET_SRC +! +ipv6 protocol bgp route-map RM_SET_SRC6 +! +! +! +! bgp multiple-instance +! +route-map FROM_BGP_SPEAKER_V4 permit 10 +! +route-map TO_BGP_SPEAKER_V4 deny 10 +! +router bgp 65100 + bgp log-neighbor-changes + bgp bestpath as-path multipath-relax + no bgp default ipv4-unicast + bgp graceful-restart + bgp router-id 10.1.0.32 + network 10.1.0.32/32 + address-family ipv6 + network fc00:1::32/128 + exit-address-family + network 192.168.0.1/27 + neighbor 10.0.0.57 remote-as 64600 + neighbor 10.0.0.57 description ARISTA01T1 + address-family ipv4 + neighbor 10.0.0.57 allowas-in 1 + neighbor 10.0.0.57 activate + neighbor 10.0.0.57 soft-reconfiguration inbound + maximum-paths 64 + exit-address-family + neighbor 10.0.0.59 remote-as 64600 + neighbor 10.0.0.59 description ARISTA02T1 + address-family ipv4 + neighbor 10.0.0.59 allowas-in 1 + neighbor 10.0.0.59 activate + neighbor 10.0.0.59 soft-reconfiguration inbound + maximum-paths 64 + exit-address-family + neighbor 10.0.0.61 remote-as 64600 + neighbor 10.0.0.61 description ARISTA03T1 + address-family ipv4 + neighbor 10.0.0.61 allowas-in 1 + neighbor 10.0.0.61 activate + neighbor 10.0.0.61 soft-reconfiguration inbound + maximum-paths 64 + exit-address-family + neighbor 10.0.0.63 remote-as 64600 + neighbor 10.0.0.63 description ARISTA04T1 + address-family ipv4 + neighbor 10.0.0.63 allowas-in 1 + neighbor 10.0.0.63 activate + neighbor 10.0.0.63 soft-reconfiguration inbound + maximum-paths 64 + exit-address-family + neighbor fc00::7a remote-as 64600 + neighbor fc00::7a description ARISTA03T1 + address-family ipv6 + neighbor fc00::7a allowas-in 1 + neighbor fc00::7a activate + neighbor fc00::7a soft-reconfiguration inbound + neighbor fc00::7a route-map set-next-hop-global-v6 in + maximum-paths 64 + exit-address-family + neighbor fc00::7e remote-as 64600 + neighbor fc00::7e description ARISTA04T1 + address-family ipv6 + neighbor fc00::7e allowas-in 1 + neighbor fc00::7e activate + neighbor fc00::7e soft-reconfiguration inbound + neighbor fc00::7e route-map set-next-hop-global-v6 in + maximum-paths 64 + exit-address-family + neighbor fc00::72 remote-as 64600 + neighbor fc00::72 description ARISTA01T1 + address-family ipv6 + neighbor fc00::72 allowas-in 1 + neighbor fc00::72 activate + neighbor fc00::72 soft-reconfiguration inbound + neighbor fc00::72 route-map set-next-hop-global-v6 in + maximum-paths 64 + exit-address-family + neighbor fc00::76 remote-as 64600 + neighbor fc00::76 description ARISTA02T1 + address-family ipv6 + neighbor fc00::76 allowas-in 1 + neighbor fc00::76 activate + neighbor fc00::76 soft-reconfiguration inbound + neighbor fc00::76 route-map set-next-hop-global-v6 in + maximum-paths 64 + exit-address-family +! +maximum-paths 64 +! +route-map ISOLATE permit 10 +set as-path prepend 65100 +! +route-map set-next-hop-global-v6 permit 10 +set ipv6 next-hop prefer-global +! diff --git a/src/sonic-config-engine/tests/sample_output/zebra.conf b/src/sonic-config-engine/tests/sample_output/zebra_quagga.conf similarity index 100% rename from src/sonic-config-engine/tests/sample_output/zebra.conf rename to src/sonic-config-engine/tests/sample_output/zebra_quagga.conf diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index ce4b17500f8d..06c26b03cab1 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -64,17 +64,23 @@ def test_lldp(self): self.run_script(argument) self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'lldpd.conf'), self.output_file)) - def test_bgpd(self): + def test_bgpd_quagga(self): conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-quagga', 'bgpd.conf.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + conf_template + ' > ' + self.output_file self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'bgpd.conf'), self.output_file)) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'bgpd_quagga.conf'), self.output_file)) - def test_zebra(self): + def test_zebra_quagga(self): conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-quagga', 'zebra.conf.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + conf_template + ' > ' + self.output_file self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'zebra.conf'), self.output_file)) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'zebra_quagga.conf'), self.output_file)) + + def test_config_frr(self): + conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-frr', 'frr.conf.j2') + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + conf_template + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'frr.conf'), self.output_file)) def test_teamd(self): diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index b044781a60f2..e3c82e158ec2 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -2,18 +2,40 @@ SHELL = /bin/bash .SHELLFLAGS += -e -MAIN_TARGET = frr_$(FRR_VERSION)_amd64.deb +MAIN_TARGET = frr_$(FRR_VERSION)-1~sonic.debian8+1_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - # Replacing frr's rules/install files with SONiC's own versions to activate - # specific knobs and adjust install process to address SONiC's needs. - cp sonic_frr.rules frr/debian/rules - cp sonic_frr.install frr/debian/frr.install - # Build the package + # Build the package pushd ./frr - rm -f debian/*.debhelper.log + + # clean up the previous build + rm -rf debian + rm frr*.tar.gz + rm frr*.tar.xz + rm frr*.dsc + + # make a dist tarball + ./bootstrap.sh + ./configure + make dist + + # Create backports debian sources + cp -a debianpkg debian + make -f debian/rules backports + + # new directory to build the package + rm -rf frrpkg + mkdir frrpkg + cd frrpkg + tar xf ../frr_*.orig.tar.gz + cd frr* + tar xf ../../frr_*sonic.debian8*.debian.tar.xz + + # build package dpkg-buildpackage -rfakeroot -b -us -uc + cd .. + mv $* $(DEST)/ + popd - mv $* $(DEST)/ diff --git a/src/sonic-frr/frr b/src/sonic-frr/frr index 5424c62d6e9d..aaf54fda1378 160000 --- a/src/sonic-frr/frr +++ b/src/sonic-frr/frr @@ -1 +1 @@ -Subproject commit 5424c62d6e9d574a00529edfc0a0b3bb3beb8811 +Subproject commit aaf54fda1378167d7ce317f5b4a16c3a61ef59eb diff --git a/src/sonic-frr/sonic_frr.install b/src/sonic-frr/sonic_frr.install deleted file mode 100644 index b0bf8d6909a7..000000000000 --- a/src/sonic-frr/sonic_frr.install +++ /dev/null @@ -1,23 +0,0 @@ -etc/frr/ -etc/init.d/ -usr/bin/vtysh -usr/include/frr/ -usr/lib/ -tools/frr-reload.py usr/lib/frr/ -tools/frr usr/lib/frr -usr/share/doc/frr/ -usr/share/man/man1/vtysh.1 -usr/share/man/man1/frr.1 -usr/share/man/man8 -usr/share/man/man8/bgpd.8 -usr/share/man/man8/ospf6d.8 -usr/share/man/man8/ospfd.8 -usr/share/man/man8/ripd.8 -usr/share/man/man8/ripngd.8 -usr/share/man/man8/zebra.8 -usr/share/man/man8/isisd.8 -usr/share/man/man8/watchfrr.8 -usr/share/snmp/mibs/ -cumulus/etc/* etc/ -tools/*.service lib/systemd/system -debian/frr.conf usr/lib/tmpfiles.d diff --git a/src/sonic-frr/sonic_frr.rules b/src/sonic-frr/sonic_frr.rules deleted file mode 100755 index f4e0706b5c33..000000000000 --- a/src/sonic-frr/sonic_frr.rules +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/make -f - -export DH_VERBOSE=1 -export DEB_BUILD_HARDENING=1 -export DH_OPTIONS=-v - -ifeq ($(WANT_SNMP), 1) - USE_SNMP=--enable-snmp - $(warning "DEBIAN: SNMP enabled, sorry for your inconvenience") -else - $(warning "DEBIAN: SNMP disabled, see README.Debian") -endif - -ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) - DEBIAN_JOBS := $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) -endif - -ifdef DEBIAN_JOBS -MAKEFLAGS += -j$(DEBIAN_JOBS) -endif - -%: - dh $@ --with=systemd,autoreconf --parallel --dbg-package=frr-dbg --list-missing - -override_dh_auto_configure: - # Frr needs /proc to check some BSD vs Linux specific stuff. - # Else it fails with an obscure error message pointing out that - # IPCTL_FORWARDING is an undefined symbol which is not very helpful. - @if ! [ -d /proc/1 ]; then \ - echo "./configure needs a mounted /proc"; \ - exit 1; \ - fi - - if ! [ -e config.status ]; then \ - dh_auto_configure -- \ - --enable-exampledir=/usr/share/doc/frr/examples/ \ - --localstatedir=/var/run/frr \ - --sbindir=/usr/lib/frr \ - --sysconfdir=/etc/frr \ - $(USE_SNMP) \ - --enable-vtysh=yes \ - --enable-isisd=yes \ - --enable-multipath=256 \ - --enable-user=frr \ - --enable-group=frr \ - --enable-vty-group=frrvty \ - --enable-configfile-mask=0640 \ - --enable-logfile-mask=0640 \ - --enable-werror \ - --enable-gcc-rdynamic \ - --with-libpam \ - --enable-systemd=yes \ - --enable-poll=yes \ - --enable-dependency-tracking \ - --enable-bgp-vnc=no \ - --enable-tcp-zebra \ - --enable-fpm; \ - fi - -override_dh_auto_build: - #dh_auto_build - $(MAKE) - dh_auto_build -- -C doc draft-zebra-00.txt - - - # doc/ is a bit crazy -ifeq ($(GENERATE_PDF), 1) - dh_auto_build -- -C doc frr.pdf || true # pdfetex fails with exit code 1 but still produces a good looking .pdf -endif - rm -vf doc/frr.info - dh_auto_build -- -C doc frr.info - rm -vf doc/frr.info.html* - -override_dh_auto_test: - -override_dh_auto_install: - dh_auto_install - - # cleaning up the info dir - rm -f debian/tmp/usr/share/info/dir* - - # install config files - mkdir -p debian/tmp/etc/frr/ - perl -pi -e 's#^!log file #!log file /var/log/frr/#' debian/tmp/usr/share/doc/frr/examples/*sample* - - # installing frr initialization script - mkdir -p debian/tmp/etc/init.d/ - cp debian/tmp/usr/lib/frr/frr debian/tmp/etc/init.d/ - - # installing the Frr specific SNMP MIB -ifeq ($(WANT_SNMP), 1) - install -D -m 644 ./zebra/GNOME-PRODUCT-ZEBRA-MIB debian/tmp/usr/share/snmp/mibs/GNOME-PRODUCT-ZEBRA-MIB -else - mkdir -p debian/tmp/usr/share/snmp/mibs/ -endif - - # cleaning .la files - sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/*.la - From d9d341bc730d427aa7d781b7d38a79e3c7c0a2b6 Mon Sep 17 00:00:00 2001 From: Nikos <31227248+nikos-github@users.noreply.github.com> Date: Wed, 3 Oct 2018 23:51:13 -0700 Subject: [PATCH 1657/1833] [sonic-frr]: Fix sonic build with frr (#2114) Signed-off-by: nikos --- src/sonic-frr/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index e3c82e158ec2..d5db7168bf11 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -11,9 +11,9 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # clean up the previous build rm -rf debian - rm frr*.tar.gz - rm frr*.tar.xz - rm frr*.dsc + rm -f frr*.tar.gz + rm -f frr*.tar.xz + rm -f frr*.dsc # make a dist tarball ./bootstrap.sh From bb8e76797536b84f18496142b73ad8514da2d0dc Mon Sep 17 00:00:00 2001 From: paavaanan Date: Fri, 5 Oct 2018 02:59:09 +0530 Subject: [PATCH 1658/1833] [devices]: Add missing python header files for S6000 sfputil.py (#2117) --- device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py index c5337707eb1a..6521cc0e93a5 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py @@ -15,6 +15,8 @@ try: import time import os + import logging + import select from sonic_sfp.sfputilbase import SfpUtilBase except ImportError as e: raise ImportError("%s - required module not found" % str(e)) From 7cdf3cb7f7c6842b8f1fe437279ac7ffabdb848f Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Thu, 4 Oct 2018 14:31:54 -0700 Subject: [PATCH 1659/1833] [devices]: Fix broadcom lane map for 7050-QX32S (#2120) First port lane map needs to be swapped. --- .../Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm | 4 ++-- .../td2-a7050-q31s4-31x40G-4x10G.config.bcm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm index 2e907dc1c72c..c898369b035d 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm @@ -317,7 +317,7 @@ serdes_firmware_mode_101.0=2 serdes_firmware_mode_102.0=2 serdes_firmware_mode_103.0=2 serdes_firmware_mode_104.0=2 -xgxs_rx_lane_map_1.0=0x0123 +xgxs_rx_lane_map_1.0=0x3210 xgxs_rx_lane_map_5.0=0x0321 xgxs_rx_lane_map_9.0=0x1302 xgxs_rx_lane_map_13.0=0x0213 @@ -349,7 +349,7 @@ xgxs_rx_lane_map_101.0=0x0213 xgxs_rx_lane_map_102.0=0x1302 xgxs_rx_lane_map_103.0=0x0123 xgxs_rx_lane_map_104.0=0x2031 -xgxs_tx_lane_map_1.0=0x3210 +xgxs_tx_lane_map_1.0=0x0123 xgxs_tx_lane_map_5.0=0x0321 xgxs_tx_lane_map_9.0=0x2031 xgxs_tx_lane_map_13.0=0x0213 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm index 9be3064af257..e34b925da2ce 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm @@ -248,7 +248,7 @@ stable_size=0x2000000 tdma_timeout_usec.0=15000000 tslam_timeout_usec.0=15000000 xgxs_lcpll_xtal_refclk.0=1 -xgxs_rx_lane_map_1.0=0x0123 +xgxs_rx_lane_map_1.0=0x3210 xgxs_rx_lane_map_5.0=0x0321 xgxs_rx_lane_map_9.0=0x1302 xgxs_rx_lane_map_13.0=0x0213 @@ -280,7 +280,7 @@ xgxs_rx_lane_map_101.0=0x0213 xgxs_rx_lane_map_102.0=0x1302 xgxs_rx_lane_map_103.0=0x0123 xgxs_rx_lane_map_104.0=0x2031 -xgxs_tx_lane_map_1.0=0x3210 +xgxs_tx_lane_map_1.0=0x0123 xgxs_tx_lane_map_5.0=0x0321 xgxs_tx_lane_map_9.0=0x2031 xgxs_tx_lane_map_13.0=0x0213 From 0a8e0c1238fb8856e810359a23a6e7c56e49335f Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 4 Oct 2018 21:20:01 -0700 Subject: [PATCH 1660/1833] =?UTF-8?q?[build]:=20generate=20build=20timesta?= =?UTF-8?q?mp=20at=20the=20beginning=20and=20use=20it=20for=20the=E2=80=A6?= =?UTF-8?q?=20(#2118)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [build]: generate build timestamp at the beginning and use it for the rest of build Signed-off-by: Guohan Lu --- Makefile.work | 3 +++ functions.sh | 3 +-- slave.mk | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile.work b/Makefile.work index fff349dc759a..cce9d4f9add1 100644 --- a/Makefile.work +++ b/Makefile.work @@ -60,6 +60,8 @@ endif OVERLAY_MODULE_CHECK := lsmod | grep "^overlay " > /dev/null 2>&1 || (echo "ERROR: Module 'overlay' not loaded. Try running 'sudo modprobe overlay'."; exit 1) +BUILD_TIMESTAMP := $(shell date +%Y%m%d\.%H%M%S) + DOCKER_RUN := docker run --rm=true --privileged \ -v $(PWD):/sonic \ -w /sonic \ @@ -88,6 +90,7 @@ SONIC_BUILD_INSTRUCTION := make \ -f slave.mk \ PLATFORM=$(PLATFORM) \ BUILD_NUMBER=$(BUILD_NUMBER) \ + BUILD_TIMESTAMP=$(BUILD_TIMESTAMP) \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \ diff --git a/functions.sh b/functions.sh index 3605877834fa..45812a8dab75 100644 --- a/functions.sh +++ b/functions.sh @@ -51,12 +51,11 @@ docker_try_rmi() { } sonic_get_version() { - DIRTY_SUFFIX="$(date +%Y%m%d\.%H%M%S)" local describe=$(git describe --tags) local latest_tag=$(git describe --tags --abbrev=0) local branch_name=$(git rev-parse --abbrev-ref HEAD) if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then - local dirty="-dirty-$DIRTY_SUFFIX" + local dirty="-dirty-$BUILD_TIMESTAMP" fi BUILD_NUMBER=${BUILD_NUMBER:-0} ## Check if we are on tagged commit diff --git a/slave.mk b/slave.mk index bb1d86be48de..28833e3605dd 100644 --- a/slave.mk +++ b/slave.mk @@ -32,6 +32,7 @@ PROJECT_ROOT = $(shell pwd) CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo generic) PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM) export BUILD_NUMBER +export BUILD_TIMESTAMP export CONFIGURED_PLATFORM ############################################################################### @@ -133,6 +134,7 @@ $(info "ENABLE_SYSTEM_TELEMETRY" : "$(ENABLE_SYSTEM_TELEMETRY)") $(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 ) ############################################################################### From 8359597796b01ceb3fbb468eb29d5da281e00a26 Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Fri, 5 Oct 2018 09:15:47 -0700 Subject: [PATCH 1661/1833] [devices]: Update arista submodules for SFP txdisable toggle (#2122) * Fix broadcom lane map for 7050-QX32S First port lane map needs to be swapped. * Update arista submodules for SFP txdisable toggle With this update the SFPs will set txdisable to 0 when out of reset. Allowing optical cables to be used on these ports. --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index ead22a71435b..49088611fc5c 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit ead22a71435b93058baef48f6ab3f5f057361366 +Subproject commit 49088611fc5c339c8a8d18e78c354c16aca33704 diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index ead22a71435b..49088611fc5c 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit ead22a71435b93058baef48f6ab3f5f057361366 +Subproject commit 49088611fc5c339c8a8d18e78c354c16aca33704 From 37287d2eef8a361f89eae7867f794433f5ba18fd Mon Sep 17 00:00:00 2001 From: Sagar Balani Date: Fri, 5 Oct 2018 09:44:08 -0700 Subject: [PATCH 1662/1833] [barefoot]: Fix SONiC Build for BFN platforms (#2124) * BFN fixes for sonic master bld (#26) * Need to still update sde deb package with sai1.3.3, will be done in seperate commit * Update bfn sde url - sai1.3.3 --- platform/barefoot/bfn-platform.mk | 2 +- platform/barefoot/bfn-sai.mk | 2 +- .../docker-syncd-bfn-rpc/Dockerfile.j2 | 1 + .../barefoot/docker-syncd-bfn/Dockerfile.j2 | 2 +- .../debian/control | 2 +- .../sonic-platform-modules-bfn/debian/control | 2 +- .../modules/bf_tun.c | 942 +++++++++++------- .../modules/bf_tun.c | 942 +++++++++++------- 8 files changed, 1168 insertions(+), 727 deletions(-) diff --git a/platform/barefoot/bfn-platform.mk b/platform/barefoot/bfn-platform.mk index 6f1e6e302961..72315b1ca553 100644 --- a/platform/barefoot/bfn-platform.mk +++ b/platform/barefoot/bfn-platform.mk @@ -1,5 +1,5 @@ BFN_PLATFORM = bfnplatform_1.0.0_amd64.deb -$(BFN_PLATFORM)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_2/bfnplatform_1.0.0_amd64.deb" +$(BFN_PLATFORM)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/sde-sai1.3.3/bfnplatform_1.0.0_amd64.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 index 7e507d15a9fe..34c9f5ffc244 100644 --- a/platform/barefoot/bfn-sai.mk +++ b/platform/barefoot/bfn-sai.mk @@ -1,5 +1,5 @@ BFN_SAI = bfnsdk_1.0.0_amd64.deb -$(BFN_SAI)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/rel_8_2/bfnsdk_1.0.0_amd64.deb" +$(BFN_SAI)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/sde-sai1.3.3/bfnsdk_1.0.0_amd64.deb" SONIC_ONLINE_DEBS += $(BFN_SAI) # $(BFN_SAI_DEV) $(BFN_SAI_DEV)_DEPENDS += $(BFN_SAI) diff --git a/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 index 9efeeb3f6b51..68604d92f6b5 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 @@ -27,6 +27,7 @@ RUN apt-get update \ python-dev \ wget \ cmake \ + libpython3.4 \ && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && tar xvfz 1.0.0.tar.gz \ && cd nanomsg-1.0.0 \ diff --git a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 index 3e31e4b94417..25c7872f6460 100755 --- a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 @@ -11,7 +11,7 @@ debs/{{ deb }}{{' '}} {%- endfor -%} debs/ -RUN apt-get install -y libxml2 libpcap-dev libusb-1.0-0-dev libcurl3 libcurl4-gnutls-dev libunwind8-dev +RUN apt-get install -y libxml2 libpcap-dev libusb-1.0-0-dev libcurl3 libcurl4-gnutls-dev libunwind8-dev libpython3.4 RUN dpkg -i \ {% for deb in docker_syncd_bfn_debs.split(' ') -%} diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control index 2b1a9804baea..589f03d2f484 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: platform-modules-bfn-montara Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/control b/platform/barefoot/sonic-platform-modules-bfn/debian/control index 09d0cc82d2c3..d4fd702298d3 100644 --- a/platform/barefoot/sonic-platform-modules-bfn/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: platform-modules-bfn Architecture: amd64 -Depends: linux-image-3.16.0-5-amd64 +Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/barefoot/sonic-platform-modules-bfn/modules/bf_tun.c b/platform/barefoot/sonic-platform-modules-bfn/modules/bf_tun.c index a1ba7047baaa..abb906a24618 100644 --- a/platform/barefoot/sonic-platform-modules-bfn/modules/bf_tun.c +++ b/platform/barefoot/sonic-platform-modules-bfn/modules/bf_tun.c @@ -65,20 +65,21 @@ #include #include #include -#include #include #include #include #include #include +#include +#include #include +#define TUN_MINOR1 201 + /* Uncomment to enable debugging */ /* #define TUN_DEBUG 1 */ -#define TUN_MINOR1 201 - #ifdef TUN_DEBUG static int debug; @@ -105,6 +106,18 @@ do { \ } while (0) #endif +/* TUN device flags */ + +/* IFF_ATTACH_QUEUE is never stored in device flags, + * overload it to mean fasync when stored there. + */ +#define TUN_FASYNC IFF_ATTACH_QUEUE +/* High bits in flags field are unused. */ +#define TUN_VNET_LE 0x80000000 +#define TUN_VNET_BE 0x40000000 + +#define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | \ + IFF_MULTI_QUEUE) #define GOODCOPY_LEN 128 #define FLT_EXACT_COUNT 8 @@ -114,14 +127,24 @@ struct tap_filter { unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN]; }; -/* DEFAULT_MAX_NUM_RSS_QUEUES were chosen to let the rx/tx queues allocated for - * the netdevice to be fit in one page. So we can make sure the success of - * memory allocation. TODO: increase the limit. */ -#define MAX_TAP_QUEUES DEFAULT_MAX_NUM_RSS_QUEUES +/* MAX_TAP_QUEUES 256 is chosen to allow rx/tx queues to be equal + * to max number of VCPUs in guest. */ +#define MAX_TAP_QUEUES 256 #define MAX_TAP_FLOWS 4096 #define TUN_FLOW_EXPIRE (3 * HZ) +struct tun_pcpu_stats { + u64 rx_packets; + u64 rx_bytes; + u64 tx_packets; + u64 tx_bytes; + struct u64_stats_sync syncp; + u32 rx_dropped; + u32 tx_dropped; + u32 rx_frame_errors; +}; + /* A tun_file connects an open character device to a tuntap netdevice. It * also contains all socket related structures (except sock_fprog and tap_filter) * to serve as one transmit queue for tuntap device. The sock_fprog and @@ -138,7 +161,6 @@ struct tun_file { struct socket socket; struct socket_wq wq; struct tun_struct __rcu *tun; - struct net *net; struct fasync_struct *fasync; /* only used for fasnyc */ unsigned int flags; @@ -148,6 +170,7 @@ struct tun_file { }; struct list_head next; struct tun_struct *detached; + struct skb_array tx_array; }; struct tun_flow_entry { @@ -179,6 +202,7 @@ struct tun_struct { #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ NETIF_F_TSO6|NETIF_F_UFO) + int align; int vnet_hdr_sz; int sndbuf; struct tap_filter txflt; @@ -196,8 +220,73 @@ struct tun_struct { struct list_head disabled; void *security; u32 flow_count; + struct tun_pcpu_stats __percpu *pcpu_stats; }; +#ifdef CONFIG_TUN_VNET_CROSS_LE +static inline bool tun_legacy_is_little_endian(struct tun_struct *tun) +{ + return tun->flags & TUN_VNET_BE ? false : + virtio_legacy_is_little_endian(); +} + +static long tun_get_vnet_be(struct tun_struct *tun, int __user *argp) +{ + int be = !!(tun->flags & TUN_VNET_BE); + + if (put_user(be, argp)) + return -EFAULT; + + return 0; +} + +static long tun_set_vnet_be(struct tun_struct *tun, int __user *argp) +{ + int be; + + if (get_user(be, argp)) + return -EFAULT; + + if (be) + tun->flags |= TUN_VNET_BE; + else + tun->flags &= ~TUN_VNET_BE; + + return 0; +} +#else +static inline bool tun_legacy_is_little_endian(struct tun_struct *tun) +{ + return virtio_legacy_is_little_endian(); +} + +static long tun_get_vnet_be(struct tun_struct *tun, int __user *argp) +{ + return -EINVAL; +} + +static long tun_set_vnet_be(struct tun_struct *tun, int __user *argp) +{ + return -EINVAL; +} +#endif /* CONFIG_TUN_VNET_CROSS_LE */ + +static inline bool tun_is_little_endian(struct tun_struct *tun) +{ + return tun->flags & TUN_VNET_LE || + tun_legacy_is_little_endian(tun); +} + +static inline u16 tun16_to_cpu(struct tun_struct *tun, __virtio16 val) +{ + return __virtio16_to_cpu(tun_is_little_endian(tun), val); +} + +static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val) +{ + return __cpu_to_virtio16(tun_is_little_endian(tun), val); +} + static inline u32 tun_hashfn(u32 rxhash) { return rxhash & 0x3ff; @@ -238,7 +327,6 @@ static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) { tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", e->rxhash, e->queue_index); - sock_rps_reset_flow_hash(e->rps_rxhash); hlist_del_rcu(&e->hash_link); kfree_rcu(e, rcu); --tun->flow_count; @@ -355,10 +443,8 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, */ static inline void tun_flow_save_rps_rxhash(struct tun_flow_entry *e, u32 hash) { - if (unlikely(e->rps_rxhash != hash)) { - sock_rps_reset_flow_hash(e->rps_rxhash); + if (unlikely(e->rps_rxhash != hash)) e->rps_rxhash = hash; - } } /* We try to identify a flow through its rxhash first. The reason that @@ -433,10 +519,22 @@ static struct tun_struct *tun_enable_queue(struct tun_file *tfile) static void tun_queue_purge(struct tun_file *tfile) { - skb_queue_purge(&tfile->sk.sk_receive_queue); + struct sk_buff *skb; + + while ((skb = skb_array_consume(&tfile->tx_array)) != NULL) + kfree_skb(skb); + skb_queue_purge(&tfile->sk.sk_error_queue); } +static void tun_cleanup_tx_array(struct tun_file *tfile) +{ + if (tfile->tx_array.ring.queue) { + skb_array_cleanup(&tfile->tx_array); + memset(&tfile->tx_array, 0, sizeof(tfile->tx_array)); + } +} + static void __tun_detach(struct tun_file *tfile, bool clean) { struct tun_file *ntfile; @@ -474,14 +572,12 @@ static void __tun_detach(struct tun_file *tfile, bool clean) if (tun && tun->numqueues == 0 && tun->numdisabled == 0) { netif_carrier_off(tun->dev); - if (!(tun->flags & TUN_PERSIST) && + if (!(tun->flags & IFF_PERSIST) && tun->dev->reg_state == NETREG_REGISTERED) unregister_netdevice(tun->dev); } - - BUG_ON(!test_bit(SOCK_EXTERNALLY_ALLOCATED, - &tfile->socket.flags)); - sk_release_kernel(&tfile->sk); + tun_cleanup_tx_array(tfile); + sock_put(&tfile->sk); } } @@ -501,11 +597,13 @@ static void tun_detach_all(struct net_device *dev) for (i = 0; i < n; i++) { tfile = rtnl_dereference(tun->tfiles[i]); BUG_ON(!tfile); + tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN; tfile->socket.sk->sk_data_ready(tfile->socket.sk); RCU_INIT_POINTER(tfile->tun, NULL); --tun->numqueues; } list_for_each_entry(tfile, &tun->disabled, next) { + tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN; tfile->socket.sk->sk_data_ready(tfile->socket.sk); RCU_INIT_POINTER(tfile->tun, NULL); } @@ -517,21 +615,24 @@ static void tun_detach_all(struct net_device *dev) /* Drop read queue */ tun_queue_purge(tfile); sock_put(&tfile->sk); + tun_cleanup_tx_array(tfile); } list_for_each_entry_safe(tfile, tmp, &tun->disabled, next) { tun_enable_queue(tfile); tun_queue_purge(tfile); sock_put(&tfile->sk); + tun_cleanup_tx_array(tfile); } BUG_ON(tun->numdisabled != 0); - if (tun->flags & TUN_PERSIST) + if (tun->flags & IFF_PERSIST) module_put(THIS_MODULE); } static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filter) { struct tun_file *tfile = file->private_data; + struct net_device *dev = tun->dev; int err; err = security_tun_dev_attach(tfile->socket.sk, tun->security); @@ -543,7 +644,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filte goto out; err = -EBUSY; - if (!(tun->flags & TUN_TAP_MQ) && tun->numqueues == 1) + if (!(tun->flags & IFF_MULTI_QUEUE) && tun->numqueues == 1) goto out; err = -E2BIG; @@ -555,12 +656,21 @@ static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filte /* Re-attach the filter to persist device */ if (!skip_filter && (tun->filter_attached == true)) { - err = __sk_attach_filter(&tun->fprog, tfile->socket.sk, - lockdep_rtnl_is_held()); + lock_sock(tfile->socket.sk); + err = sk_attach_filter(&tun->fprog, tfile->socket.sk); + release_sock(tfile->socket.sk); if (!err) goto out; } + + if (!tfile->detached && + skb_array_init(&tfile->tx_array, dev->tx_queue_len, GFP_KERNEL)) { + err = -ENOMEM; + goto out; + } + tfile->queue_index = tun->numqueues; + tfile->socket.sk->sk_shutdown &= ~RCV_SHUTDOWN; rcu_assign_pointer(tfile->tun, tun); rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); tun->numqueues++; @@ -632,14 +742,9 @@ static int update_filter(struct tap_filter *filter, void __user *arg) } alen = ETH_ALEN * uf.count; - addr = kmalloc(alen, GFP_KERNEL); - if (!addr) - return -ENOMEM; - - if (copy_from_user(addr, arg + sizeof(uf), alen)) { - err = -EFAULT; - goto done; - } + addr = memdup_user(arg + sizeof(uf), alen); + if (IS_ERR(addr)) + return PTR_ERR(addr); /* The filter is updated without holding any locks. Which is * perfectly safe. We disable it first and in the worst @@ -659,7 +764,7 @@ static int update_filter(struct tap_filter *filter, void __user *arg) for (; n < uf.count; n++) { if (!is_multicast_ether_addr(addr[n].u)) { err = 0; /* no filter */ - goto done; + goto free_addr; } addr_hash_set(filter->mask, addr[n].u); } @@ -675,8 +780,7 @@ static int update_filter(struct tap_filter *filter, void __user *arg) /* Return the number of exact filters */ err = nexact; - -done: +free_addr: kfree(addr); return err; } @@ -726,7 +830,18 @@ static void tun_net_uninit(struct net_device *dev) /* Net device open. */ static int tun_net_open(struct net_device *dev) { + struct tun_struct *tun = netdev_priv(dev); + int i; + netif_tx_start_all_queues(dev); + + for (i = 0; i < tun->numqueues; i++) { + struct tun_file *tfile; + + tfile = rtnl_dereference(tun->tfiles[i]); + tfile->socket.sk->sk_write_space(tfile->socket.sk); + } + return 0; } @@ -753,7 +868,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) if (txq >= numqueues) goto drop; - if (numqueues == 1) { +#ifdef CONFIG_RPS + if (numqueues == 1 && static_key_false(&rps_needed)) { /* Select queue was not called for the skbuff, so we extract the * RPS hash and save it into the flow_table here. */ @@ -768,6 +884,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) tun_flow_save_rps_rxhash(e, rxhash); } } +#endif tun_debug(KERN_INFO, tun, "tun_net_xmit %d\n", skb->len); @@ -793,10 +910,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) goto drop; - if (skb->sk) { - sock_tx_timestamp(skb->sk, &skb_shinfo(skb)->tx_flags); - sw_tx_timestamp(skb); - } + skb_tx_timestamp(skb); /* Orphan the skb - required as we might hang on to it * for indefinite time. @@ -805,8 +919,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) nf_reset(skb); - /* Enqueue packet */ - skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb); + if (skb_array_produce(&tfile->tx_array, skb)) + goto drop; /* Notify and wake up reader process */ if (tfile->flags & TUN_FASYNC) @@ -817,11 +931,11 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; drop: - dev->stats.tx_dropped++; + this_cpu_inc(tun->pcpu_stats->tx_dropped); skb_tx_error(skb); kfree_skb(skb); rcu_read_unlock(); - return NETDEV_TX_OK; + return NET_XMIT_DROP; } static void tun_net_mclist(struct net_device *dev) @@ -852,16 +966,6 @@ static netdev_features_t tun_net_fix_features(struct net_device *dev, return (features & tun->set_features) | (features & ~TUN_USER_FEATURES); } - -static int -tun_change_carrier(struct net_device *dev, bool new_carrier) { - if (new_carrier) - netif_carrier_on(dev); - else - netif_carrier_off(dev); - return 0; -} - #ifdef CONFIG_NET_POLL_CONTROLLER static void tun_poll_controller(struct net_device *dev) { @@ -879,6 +983,63 @@ static void tun_poll_controller(struct net_device *dev) return; } #endif + +static void tun_set_headroom(struct net_device *dev, int new_hr) +{ + struct tun_struct *tun = netdev_priv(dev); + + if (new_hr < NET_SKB_PAD) + new_hr = NET_SKB_PAD; + + tun->align = new_hr; +} + +static struct rtnl_link_stats64 * +tun_net_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +{ + u32 rx_dropped = 0, tx_dropped = 0, rx_frame_errors = 0; + struct tun_struct *tun = netdev_priv(dev); + struct tun_pcpu_stats *p; + int i; + + for_each_possible_cpu(i) { + u64 rxpackets, rxbytes, txpackets, txbytes; + unsigned int start; + + p = per_cpu_ptr(tun->pcpu_stats, i); + do { + start = u64_stats_fetch_begin(&p->syncp); + rxpackets = p->rx_packets; + rxbytes = p->rx_bytes; + txpackets = p->tx_packets; + txbytes = p->tx_bytes; + } while (u64_stats_fetch_retry(&p->syncp, start)); + + stats->rx_packets += rxpackets; + stats->rx_bytes += rxbytes; + stats->tx_packets += txpackets; + stats->tx_bytes += txbytes; + + /* u32 counters */ + rx_dropped += p->rx_dropped; + rx_frame_errors += p->rx_frame_errors; + tx_dropped += p->tx_dropped; + } + stats->rx_dropped = rx_dropped; + stats->rx_frame_errors = rx_frame_errors; + stats->tx_dropped = tx_dropped; + return stats; +} + +static int +tun_change_carrier(struct net_device *dev, bool new_carrier) { + if (new_carrier) + netif_carrier_on(dev); + else + netif_carrier_off(dev); + return 0; +} + static const struct net_device_ops tun_netdev_ops = { .ndo_uninit = tun_net_uninit, .ndo_open = tun_net_open, @@ -890,6 +1051,9 @@ static const struct net_device_ops tun_netdev_ops = { #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = tun_poll_controller, #endif + .ndo_set_rx_headroom = tun_set_headroom, + .ndo_get_stats64 = tun_net_get_stats64, + .ndo_change_carrier = tun_change_carrier, }; static const struct net_device_ops tap_netdev_ops = { @@ -906,7 +1070,9 @@ static const struct net_device_ops tap_netdev_ops = { #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = tun_poll_controller, #endif - .ndo_change_carrier = tun_change_carrier, + .ndo_features_check = passthru_features_check, + .ndo_set_rx_headroom = tun_set_headroom, + .ndo_get_stats64 = tun_net_get_stats64, }; static void tun_flow_init(struct tun_struct *tun) @@ -934,7 +1100,7 @@ static void tun_net_init(struct net_device *dev) struct tun_struct *tun = netdev_priv(dev); switch (tun->flags & TUN_TYPE_MASK) { - case TUN_TUN_DEV: + case IFF_TUN: dev->netdev_ops = &tun_netdev_ops; /* Point-to-Point TUN Device */ @@ -945,10 +1111,9 @@ static void tun_net_init(struct net_device *dev) /* Zero header length */ dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; - dev->tx_queue_len = TUN_READQ_SIZE*2; /* We prefer our own queue length */ break; - case TUN_TAP_DEV: + case IFF_TAP: dev->netdev_ops = &tap_netdev_ops; /* Ethernet TAP Device */ ether_setup(dev); @@ -957,7 +1122,6 @@ static void tun_net_init(struct net_device *dev) eth_hw_addr_random(dev); - dev->tx_queue_len = TUN_READQ_SIZE*2; /* We prefer our own queue length */ break; } } @@ -981,12 +1145,13 @@ static unsigned int tun_chr_poll(struct file *file, poll_table *wait) poll_wait(file, sk_sleep(sk), wait); - if (!skb_queue_empty(&sk->sk_receive_queue)) + if (!skb_array_empty(&tfile->tx_array)) mask |= POLLIN | POLLRDNORM; - if (sock_writeable(sk) || - (!test_and_set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags) && - sock_writeable(sk))) + if (tun->dev->flags & IFF_UP && + (sock_writeable(sk) || + (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) && + sock_writeable(sk)))) mask |= POLLOUT | POLLWRNORM; if (tun->dev->reg_state != NETREG_REGISTERED) @@ -1025,121 +1190,127 @@ static struct sk_buff *tun_alloc_skb(struct tun_file *tfile, /* Get packet from user space buffer */ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, - void *msg_control, const struct iovec *iv, - size_t total_len, size_t count, int noblock) + void *msg_control, struct iov_iter *from, + int noblock) { struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) }; struct sk_buff *skb; - size_t len = total_len, align = NET_SKB_PAD, linear; + size_t total_len = iov_iter_count(from); + size_t len = total_len, align = tun->align, linear; struct virtio_net_hdr gso = { 0 }; + struct tun_pcpu_stats *stats; int good_linear; - int offset = 0; int copylen; bool zerocopy = false; int err; u32 rxhash; + ssize_t n; + + if (!(tun->dev->flags & IFF_UP)) + return -EIO; - if (!(tun->flags & TUN_NO_PI)) { + if (!(tun->flags & IFF_NO_PI)) { if (len < sizeof(pi)) return -EINVAL; len -= sizeof(pi); - if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) + n = copy_from_iter(&pi, sizeof(pi), from); + if (n != sizeof(pi)) return -EFAULT; - offset += sizeof(pi); } - if (tun->flags & TUN_VNET_HDR) { - if (len < tun->vnet_hdr_sz) + if (tun->flags & IFF_VNET_HDR) { + int vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz); + + if (len < vnet_hdr_sz) return -EINVAL; - len -= tun->vnet_hdr_sz; + len -= vnet_hdr_sz; - if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) + n = copy_from_iter(&gso, sizeof(gso), from); + if (n != sizeof(gso)) return -EFAULT; if ((gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && - gso.csum_start + gso.csum_offset + 2 > gso.hdr_len) - gso.hdr_len = gso.csum_start + gso.csum_offset + 2; + tun16_to_cpu(tun, gso.csum_start) + tun16_to_cpu(tun, gso.csum_offset) + 2 > tun16_to_cpu(tun, gso.hdr_len)) + gso.hdr_len = cpu_to_tun16(tun, tun16_to_cpu(tun, gso.csum_start) + tun16_to_cpu(tun, gso.csum_offset) + 2); - if (gso.hdr_len > len) + if (tun16_to_cpu(tun, gso.hdr_len) > len) return -EINVAL; - offset += tun->vnet_hdr_sz; + iov_iter_advance(from, vnet_hdr_sz - sizeof(gso)); } - if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) { + if ((tun->flags & TUN_TYPE_MASK) == IFF_TAP) { align += NET_IP_ALIGN; if (unlikely(len < ETH_HLEN || - (gso.hdr_len && gso.hdr_len < ETH_HLEN))) + (gso.hdr_len && tun16_to_cpu(tun, gso.hdr_len) < ETH_HLEN))) return -EINVAL; } good_linear = SKB_MAX_HEAD(align); if (msg_control) { + struct iov_iter i = *from; + /* There are 256 bytes to be copied in skb, so there is * enough room for skb expand head in case it is used. * The rest of the buffer is mapped from userspace. */ - copylen = gso.hdr_len ? gso.hdr_len : GOODCOPY_LEN; + copylen = gso.hdr_len ? tun16_to_cpu(tun, gso.hdr_len) : GOODCOPY_LEN; if (copylen > good_linear) copylen = good_linear; linear = copylen; - if (iov_pages(iv, offset + copylen, count) <= MAX_SKB_FRAGS) + iov_iter_advance(&i, copylen); + if (iov_iter_npages(&i, INT_MAX) <= MAX_SKB_FRAGS) zerocopy = true; } if (!zerocopy) { copylen = len; - if (gso.hdr_len > good_linear) + if (tun16_to_cpu(tun, gso.hdr_len) > good_linear) linear = good_linear; else - linear = gso.hdr_len; + linear = tun16_to_cpu(tun, gso.hdr_len); } skb = tun_alloc_skb(tfile, align, copylen, linear, noblock); if (IS_ERR(skb)) { if (PTR_ERR(skb) != -EAGAIN) - tun->dev->stats.rx_dropped++; + this_cpu_inc(tun->pcpu_stats->rx_dropped); return PTR_ERR(skb); } if (zerocopy) - err = zerocopy_sg_from_iovec(skb, iv, offset, count); - else { - err = skb_copy_datagram_from_iovec(skb, 0, iv, offset, len); - if (!err && msg_control) { - struct ubuf_info *uarg = msg_control; - uarg->callback(uarg, false); - } - } + err = zerocopy_sg_from_iter(skb, from); + else + err = skb_copy_datagram_from_iter(skb, 0, from, len); if (err) { - tun->dev->stats.rx_dropped++; + this_cpu_inc(tun->pcpu_stats->rx_dropped); kfree_skb(skb); return -EFAULT; } - if (gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { - if (!skb_partial_csum_set(skb, gso.csum_start, - gso.csum_offset)) { - tun->dev->stats.rx_frame_errors++; - kfree_skb(skb); - return -EINVAL; - } + err = virtio_net_hdr_to_skb(skb, &gso, tun_is_little_endian(tun)); + if (err) { + this_cpu_inc(tun->pcpu_stats->rx_frame_errors); + kfree_skb(skb); + return -EINVAL; } switch (tun->flags & TUN_TYPE_MASK) { - case TUN_TUN_DEV: - if (tun->flags & TUN_NO_PI) { - switch (skb->data[0] & 0xf0) { - case 0x40: + case IFF_TUN: + if (tun->flags & IFF_NO_PI) { + u8 ip_version = skb->len ? (skb->data[0] >> 4) : 0; + + switch (ip_version) { + case 4: pi.proto = htons(ETH_P_IP); break; - case 0x60: + case 6: pi.proto = htons(ETH_P_IPV6); break; default: - tun->dev->stats.rx_dropped++; + this_cpu_inc(tun->pcpu_stats->rx_dropped); kfree_skb(skb); return -EINVAL; } @@ -1149,69 +1320,39 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, skb->protocol = pi.proto; skb->dev = tun->dev; break; - case TUN_TAP_DEV: + case IFF_TAP: skb->protocol = eth_type_trans(skb, tun->dev); break; } - skb_reset_network_header(skb); - - if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { - pr_debug("GSO!\n"); - switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { - case VIRTIO_NET_HDR_GSO_TCPV4: - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; - break; - case VIRTIO_NET_HDR_GSO_TCPV6: - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; - break; - case VIRTIO_NET_HDR_GSO_UDP: - skb_shinfo(skb)->gso_type = SKB_GSO_UDP; - if (skb->protocol == htons(ETH_P_IPV6)) - ipv6_proxy_select_ident(skb); - break; - default: - tun->dev->stats.rx_frame_errors++; - kfree_skb(skb); - return -EINVAL; - } - - if (gso.gso_type & VIRTIO_NET_HDR_GSO_ECN) - skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; - - skb_shinfo(skb)->gso_size = gso.gso_size; - if (skb_shinfo(skb)->gso_size == 0) { - tun->dev->stats.rx_frame_errors++; - kfree_skb(skb); - return -EINVAL; - } - - /* Header must be checked, and gso_segs computed. */ - skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; - skb_shinfo(skb)->gso_segs = 0; - } - /* copy skb_ubuf_info for callback when skb has no error */ if (zerocopy) { skb_shinfo(skb)->destructor_arg = msg_control; skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; + } else if (msg_control) { + struct ubuf_info *uarg = msg_control; + uarg->callback(uarg, false); } + skb_reset_network_header(skb); skb_probe_transport_header(skb, 0); rxhash = skb_get_hash(skb); netif_rx_ni(skb); - tun->dev->stats.rx_packets++; - tun->dev->stats.rx_bytes += len; + stats = get_cpu_ptr(tun->pcpu_stats); + u64_stats_update_begin(&stats->syncp); + stats->rx_packets++; + stats->rx_bytes += len; + u64_stats_update_end(&stats->syncp); + put_cpu_ptr(stats); tun_flow_update(tun, rxhash, tfile); return total_len; } -static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, - unsigned long count, loff_t pos) +static ssize_t tun_chr_write_iter(struct kiocb *iocb, struct iov_iter *from) { struct file *file = iocb->ki_filp; struct tun_struct *tun = tun_get(file); @@ -1221,10 +1362,7 @@ static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, if (!tun) return -EBADFD; - tun_debug(KERN_INFO, tun, "tun_chr_write %ld\n", count); - - result = tun_get_user(tun, tfile, NULL, iv, iov_length(iv, count), - count, file->f_flags & O_NONBLOCK); + result = tun_get_user(tun, tfile, NULL, from, file->f_flags & O_NONBLOCK); tun_put(tun); return result; @@ -1234,167 +1372,183 @@ static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, static ssize_t tun_put_user(struct tun_struct *tun, struct tun_file *tfile, struct sk_buff *skb, - const struct iovec *iv, int len) + struct iov_iter *iter) { struct tun_pi pi = { 0, skb->protocol }; - ssize_t total = 0; - int vlan_offset = 0, copied; + struct tun_pcpu_stats *stats; + ssize_t total; + int vlan_offset = 0; int vlan_hlen = 0; + int vnet_hdr_sz = 0; - if (vlan_tx_tag_present(skb)) + if (skb_vlan_tag_present(skb)) vlan_hlen = VLAN_HLEN; - if (!(tun->flags & TUN_NO_PI)) { - if ((len -= sizeof(pi)) < 0) + if (tun->flags & IFF_VNET_HDR) + vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz); + + total = skb->len + vlan_hlen + vnet_hdr_sz; + + if (!(tun->flags & IFF_NO_PI)) { + if (iov_iter_count(iter) < sizeof(pi)) return -EINVAL; - if (len < skb->len) { + total += sizeof(pi); + if (iov_iter_count(iter) < total) { /* Packet will be striped */ pi.flags |= TUN_PKT_STRIP; } - if (memcpy_toiovecend(iv, (void *) &pi, 0, sizeof(pi))) + if (copy_to_iter(&pi, sizeof(pi), iter) != sizeof(pi)) return -EFAULT; - total += sizeof(pi); } - if (tun->flags & TUN_VNET_HDR) { + if (vnet_hdr_sz) { struct virtio_net_hdr gso = { 0 }; /* no info leak */ - if ((len -= tun->vnet_hdr_sz) < 0) + int ret; + + if (iov_iter_count(iter) < vnet_hdr_sz) return -EINVAL; - if (skb_is_gso(skb)) { + ret = virtio_net_hdr_from_skb(skb, &gso, + tun_is_little_endian(tun), true); + if (ret) { struct skb_shared_info *sinfo = skb_shinfo(skb); + pr_err("unexpected GSO type: " + "0x%x, gso_size %d, hdr_len %d\n", + sinfo->gso_type, tun16_to_cpu(tun, gso.gso_size), + tun16_to_cpu(tun, gso.hdr_len)); + print_hex_dump(KERN_ERR, "tun: ", + DUMP_PREFIX_NONE, + 16, 1, skb->head, + min((int)tun16_to_cpu(tun, gso.hdr_len), 64), true); + WARN_ON_ONCE(1); + return -EINVAL; + } - /* This is a hint as to how much should be linear. */ - gso.hdr_len = skb_headlen(skb); - gso.gso_size = sinfo->gso_size; - if (sinfo->gso_type & SKB_GSO_TCPV4) - gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; - else if (sinfo->gso_type & SKB_GSO_TCPV6) - gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; - else if (sinfo->gso_type & SKB_GSO_UDP) - gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; - else { - pr_err("unexpected GSO type: " - "0x%x, gso_size %d, hdr_len %d\n", - sinfo->gso_type, gso.gso_size, - gso.hdr_len); - print_hex_dump(KERN_ERR, "tun: ", - DUMP_PREFIX_NONE, - 16, 1, skb->head, - min((int)gso.hdr_len, 64), true); - WARN_ON_ONCE(1); - return -EINVAL; - } - if (sinfo->gso_type & SKB_GSO_TCP_ECN) - gso.gso_type |= VIRTIO_NET_HDR_GSO_ECN; - } else - gso.gso_type = VIRTIO_NET_HDR_GSO_NONE; - - if (skb->ip_summed == CHECKSUM_PARTIAL) { - gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; - gso.csum_start = skb_checksum_start_offset(skb) + - vlan_hlen; - gso.csum_offset = skb->csum_offset; - } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { - gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; - } /* else everything is zero */ - - if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total, - sizeof(gso)))) + if (copy_to_iter(&gso, sizeof(gso), iter) != sizeof(gso)) return -EFAULT; - total += tun->vnet_hdr_sz; + + iov_iter_advance(iter, vnet_hdr_sz - sizeof(gso)); } - copied = total; - len = min_t(int, skb->len + vlan_hlen, len); - total += skb->len + vlan_hlen; if (vlan_hlen) { - int copy, ret; + int ret; struct { __be16 h_vlan_proto; __be16 h_vlan_TCI; } veth; veth.h_vlan_proto = skb->vlan_proto; - veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); + veth.h_vlan_TCI = htons(skb_vlan_tag_get(skb)); vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); - copy = min_t(int, vlan_offset, len); - ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); - len -= copy; - copied += copy; - if (ret || !len) + ret = skb_copy_datagram_iter(skb, 0, iter, vlan_offset); + if (ret || !iov_iter_count(iter)) goto done; - copy = min_t(int, sizeof(veth), len); - ret = memcpy_toiovecend(iv, (void *)&veth, copied, copy); - len -= copy; - copied += copy; - if (ret || !len) + ret = copy_to_iter(&veth, sizeof(veth), iter); + if (ret != sizeof(veth) || !iov_iter_count(iter)) goto done; } - skb_copy_datagram_const_iovec(skb, vlan_offset, iv, copied, len); + skb_copy_datagram_iter(skb, vlan_offset, iter, skb->len - vlan_offset); done: - tun->dev->stats.tx_packets++; - tun->dev->stats.tx_bytes += len; + /* caller is in process context, */ + stats = get_cpu_ptr(tun->pcpu_stats); + u64_stats_update_begin(&stats->syncp); + stats->tx_packets++; + stats->tx_bytes += skb->len + vlan_hlen; + u64_stats_update_end(&stats->syncp); + put_cpu_ptr(tun->pcpu_stats); return total; } +static struct sk_buff *tun_ring_recv(struct tun_file *tfile, int noblock, + int *err) +{ + DECLARE_WAITQUEUE(wait, current); + struct sk_buff *skb = NULL; + int error = 0; + + skb = skb_array_consume(&tfile->tx_array); + if (skb) + goto out; + if (noblock) { + error = -EAGAIN; + goto out; + } + + add_wait_queue(&tfile->wq.wait, &wait); + current->state = TASK_INTERRUPTIBLE; + + while (1) { + skb = skb_array_consume(&tfile->tx_array); + if (skb) + break; + if (signal_pending(current)) { + error = -ERESTARTSYS; + break; + } + if (tfile->socket.sk->sk_shutdown & RCV_SHUTDOWN) { + error = -EFAULT; + break; + } + + schedule(); + } + + current->state = TASK_RUNNING; + remove_wait_queue(&tfile->wq.wait, &wait); + +out: + *err = error; + return skb; +} + static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile, - const struct iovec *iv, ssize_t len, int noblock) + struct iov_iter *to, + int noblock) { struct sk_buff *skb; - ssize_t ret = 0; - int peeked, err, off = 0; + ssize_t ret; + int err; tun_debug(KERN_INFO, tun, "tun_do_read\n"); - if (!len) - return ret; + if (!iov_iter_count(to)) + return 0; - if (tun->dev->reg_state != NETREG_REGISTERED) - return -EIO; + /* Read frames from ring */ + skb = tun_ring_recv(tfile, noblock, &err); + if (!skb) + return err; - /* Read frames from queue */ - skb = __skb_recv_datagram(tfile->socket.sk, noblock ? MSG_DONTWAIT : 0, - &peeked, &off, &err); - if (skb) { - ret = tun_put_user(tun, tfile, skb, iv, len); + ret = tun_put_user(tun, tfile, skb, to); + if (unlikely(ret < 0)) kfree_skb(skb); - } else - ret = err; + else + consume_skb(skb); return ret; } -static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, - unsigned long count, loff_t pos) +static ssize_t tun_chr_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct file *file = iocb->ki_filp; struct tun_file *tfile = file->private_data; struct tun_struct *tun = __tun_get(tfile); - ssize_t len, ret; + ssize_t len = iov_iter_count(to), ret; if (!tun) return -EBADFD; - len = iov_length(iv, count); - if (len < 0) { - ret = -EINVAL; - goto out; - } - - ret = tun_do_read(tun, tfile, iv, len, - file->f_flags & O_NONBLOCK); + ret = tun_do_read(tun, tfile, to, file->f_flags & O_NONBLOCK); ret = min_t(ssize_t, ret, len); if (ret > 0) iocb->ki_pos = ret; -out: tun_put(tun); return ret; } @@ -1404,6 +1558,7 @@ static void tun_free_netdev(struct net_device *dev) struct tun_struct *tun = netdev_priv(dev); BUG_ON(!(list_empty(&tun->disabled))); + free_percpu(tun->pcpu_stats); tun_flow_uninit(tun); security_tun_dev_free_security(tun->security); free_netdev(dev); @@ -1418,6 +1573,8 @@ static void tun_setup(struct net_device *dev) dev->ethtool_ops = &tun_ethtool_ops; dev->destructor = tun_free_netdev; + /* We prefer our own queue length */ + dev->tx_queue_len = TUN_READQ_SIZE; } /* Trivial set of netlink ops to allow deleting tun or tap @@ -1443,7 +1600,7 @@ static void tun_sock_write_space(struct sock *sk) if (!sock_writeable(sk)) return; - if (!test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags)) + if (!test_and_clear_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags)) return; wqueue = sk_sleep(sk); @@ -1455,8 +1612,7 @@ static void tun_sock_write_space(struct sock *sk) kill_fasync(&tfile->fasync, SIGIO, POLL_OUT); } -static int tun_sendmsg(struct kiocb *iocb, struct socket *sock, - struct msghdr *m, size_t total_len) +static int tun_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) { int ret; struct tun_file *tfile = container_of(sock, struct tun_file, socket); @@ -1464,14 +1620,14 @@ static int tun_sendmsg(struct kiocb *iocb, struct socket *sock, if (!tun) return -EBADFD; - ret = tun_get_user(tun, tfile, m->msg_control, m->msg_iov, total_len, - m->msg_iovlen, m->msg_flags & MSG_DONTWAIT); + + ret = tun_get_user(tun, tfile, m->msg_control, &m->msg_iter, + m->msg_flags & MSG_DONTWAIT); tun_put(tun); return ret; } -static int tun_recvmsg(struct kiocb *iocb, struct socket *sock, - struct msghdr *m, size_t total_len, +static int tun_recvmsg(struct socket *sock, struct msghdr *m, size_t total_len, int flags) { struct tun_file *tfile = container_of(sock, struct tun_file, socket); @@ -1490,9 +1646,8 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock, SOL_PACKET, TUN_TX_TIMESTAMP); goto out; } - ret = tun_do_read(tun, tfile, m->msg_iov, total_len, - flags & MSG_DONTWAIT); - if (ret > total_len) { + ret = tun_do_read(tun, tfile, &m->msg_iter, flags & MSG_DONTWAIT); + if (ret > (ssize_t)total_len) { m->msg_flags |= MSG_TRUNC; ret = flags & MSG_TRUNC ? ret : total_len; } @@ -1501,54 +1656,38 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock, return ret; } -static int tun_release(struct socket *sock) +static int tun_peek_len(struct socket *sock) { - if (sock->sk) - sock_put(sock->sk); - return 0; + struct tun_file *tfile = container_of(sock, struct tun_file, socket); + struct tun_struct *tun; + int ret = 0; + + tun = __tun_get(tfile); + if (!tun) + return 0; + + ret = skb_array_peek_len(&tfile->tx_array); + tun_put(tun); + + return ret; } /* Ops structure to mimic raw sockets with tun */ static const struct proto_ops tun_socket_ops = { + .peek_len = tun_peek_len, .sendmsg = tun_sendmsg, .recvmsg = tun_recvmsg, - .release = tun_release, }; static struct proto tun_proto = { - .name = "bf_tun", + .name = "tun", .owner = THIS_MODULE, .obj_size = sizeof(struct tun_file), }; static int tun_flags(struct tun_struct *tun) { - int flags = 0; - - if (tun->flags & TUN_TUN_DEV) - flags |= IFF_TUN; - else - flags |= IFF_TAP; - - if (tun->flags & TUN_NO_PI) - flags |= IFF_NO_PI; - - /* This flag has no real effect. We track the value for backwards - * compatibility. - */ - if (tun->flags & TUN_ONE_QUEUE) - flags |= IFF_ONE_QUEUE; - - if (tun->flags & TUN_VNET_HDR) - flags |= IFF_VNET_HDR; - - if (tun->flags & TUN_TAP_MQ) - flags |= IFF_MULTI_QUEUE; - - if (tun->flags & TUN_PERSIST) - flags |= IFF_PERSIST; - - return flags; + return tun->flags & (TUN_FEATURES | IFF_PERSIST | IFF_TUN | IFF_TAP); } static ssize_t tun_show_flags(struct device *dev, struct device_attribute *attr, @@ -1582,6 +1721,17 @@ static DEVICE_ATTR(tun_flags, 0444, tun_show_flags, NULL); static DEVICE_ATTR(owner, 0444, tun_show_owner, NULL); static DEVICE_ATTR(group, 0444, tun_show_group, NULL); +static struct attribute *tun_dev_attrs[] = { + &dev_attr_tun_flags.attr, + &dev_attr_owner.attr, + &dev_attr_group.attr, + NULL +}; + +static const struct attribute_group tun_attr_group = { + .attrs = tun_dev_attrs +}; + static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) { struct tun_struct *tun; @@ -1604,7 +1754,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) return -EINVAL; if (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) != - !!(tun->flags & TUN_TAP_MQ)) + !!(tun->flags & IFF_MULTI_QUEUE)) return -EINVAL; if (tun_not_capable(tun)) @@ -1617,7 +1767,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) if (err < 0) return err; - if (tun->flags & TUN_TAP_MQ && + if (tun->flags & IFF_MULTI_QUEUE && (tun->numqueues + tun->numdisabled > 1)) { /* One or more queue has already been attached, no need * to initialize the device again. @@ -1640,11 +1790,11 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) /* Set dev type */ if (ifr->ifr_flags & IFF_TUN) { /* TUN device */ - flags |= TUN_TUN_DEV; + flags |= IFF_TUN; name = "tun%d"; } else if (ifr->ifr_flags & IFF_TAP) { /* TAP device */ - flags |= TUN_TAP_DEV; + flags |= IFF_TAP; name = "tap%d"; } else return -EINVAL; @@ -1653,14 +1803,20 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) name = ifr->ifr_name; dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, - tun_setup, queues, queues); + NET_NAME_UNKNOWN, tun_setup, queues, + queues); if (!dev) return -ENOMEM; - +#if 0 + err = dev_get_valid_name(net, dev, name); + if (err < 0) + goto err_free_dev; +#endif dev_net_set(dev, net); dev->rtnl_link_ops = &tun_link_ops; dev->ifindex = tfile->ifindex; + dev->sysfs_groups[0] = &tun_attr_group; tun = netdev_priv(dev); tun->dev = dev; @@ -1668,14 +1824,21 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) tun->txflt.count = 0; tun->vnet_hdr_sz = sizeof(struct virtio_net_hdr); + tun->align = NET_SKB_PAD; tun->filter_attached = false; tun->sndbuf = tfile->socket.sk->sk_sndbuf; + tun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats); + if (!tun->pcpu_stats) { + err = -ENOMEM; + goto err_free_dev; + } + spin_lock_init(&tun->lock); err = security_tun_dev_alloc_security(&tun->security); if (err < 0) - goto err_free_dev; + goto err_free_stat; tun_net_init(dev); tun_flow_init(tun); @@ -1683,7 +1846,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; - dev->features = dev->hw_features; + dev->features = dev->hw_features | NETIF_F_LLTX; dev->vlan_features = dev->features & ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX); @@ -1696,39 +1859,14 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) err = register_netdevice(tun->dev); if (err < 0) goto err_detach; - - if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) || - device_create_file(&tun->dev->dev, &dev_attr_owner) || - device_create_file(&tun->dev->dev, &dev_attr_group)) - pr_err("Failed to create tun sysfs files\n"); } netif_carrier_on(tun->dev); tun_debug(KERN_INFO, tun, "tun_set_iff\n"); - if (ifr->ifr_flags & IFF_NO_PI) - tun->flags |= TUN_NO_PI; - else - tun->flags &= ~TUN_NO_PI; - - /* This flag has no real effect. We track the value for backwards - * compatibility. - */ - if (ifr->ifr_flags & IFF_ONE_QUEUE) - tun->flags |= TUN_ONE_QUEUE; - else - tun->flags &= ~TUN_ONE_QUEUE; - - if (ifr->ifr_flags & IFF_VNET_HDR) - tun->flags |= TUN_VNET_HDR; - else - tun->flags &= ~TUN_VNET_HDR; - - if (ifr->ifr_flags & IFF_MULTI_QUEUE) - tun->flags |= TUN_TAP_MQ; - else - tun->flags &= ~TUN_TAP_MQ; + tun->flags = (tun->flags & ~TUN_FEATURES) | + (ifr->ifr_flags & TUN_FEATURES); /* Make sure persistent devices do not get stuck in * xoff state. @@ -1744,6 +1882,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) err_free_flow: tun_flow_uninit(tun); security_tun_dev_free_security(tun->security); +err_free_stat: + free_percpu(tun->pcpu_stats); err_free_dev: free_netdev(dev); return err; @@ -1806,7 +1946,9 @@ static void tun_detach_filter(struct tun_struct *tun, int n) for (i = 0; i < n; i++) { tfile = rtnl_dereference(tun->tfiles[i]); - __sk_detach_filter(tfile->socket.sk, lockdep_rtnl_is_held()); + lock_sock(tfile->socket.sk); + sk_detach_filter(tfile->socket.sk); + release_sock(tfile->socket.sk); } tun->filter_attached = false; @@ -1819,8 +1961,9 @@ static int tun_attach_filter(struct tun_struct *tun) for (i = 0; i < tun->numqueues; i++) { tfile = rtnl_dereference(tun->tfiles[i]); - ret = __sk_attach_filter(&tun->fprog, tfile->socket.sk, - lockdep_rtnl_is_held()); + lock_sock(tfile->socket.sk); + ret = sk_attach_filter(&tun->fprog, tfile->socket.sk); + release_sock(tfile->socket.sk); if (ret) { tun_detach_filter(tun, i); return ret; @@ -1862,7 +2005,7 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr) ret = tun_attach(tun, file, false); } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { tun = rtnl_dereference(tfile->tun); - if (!tun || !(tun->flags & TUN_TAP_MQ) || tfile->detached) + if (!tun || !(tun->flags & IFF_MULTI_QUEUE) || tfile->detached) ret = -EINVAL; else __tun_detach(tfile, false); @@ -1886,6 +2029,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, int sndbuf; int vnet_hdr_sz; unsigned int ifindex; + int le; int ret; if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == 0x89) { @@ -1897,9 +2041,9 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, if (cmd == TUNGETFEATURES) { /* Currently this just means: "what IFF flags are valid?". * This is needed because we never checked for invalid flags on - * TUNSETIFF. */ - return put_user(IFF_TUN | IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE | - IFF_VNET_HDR | IFF_MULTI_QUEUE, + * TUNSETIFF. + */ + return put_user(IFF_TUN | IFF_TAP | TUN_FEATURES, (unsigned int __user*)argp); } else if (cmd == TUNSETQUEUE) return tun_set_queue(file, &ifr); @@ -1911,7 +2055,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, if (cmd == TUNSETIFF && !tun) { ifr.ifr_name[IFNAMSIZ-1] = '\0'; - ret = tun_set_iff(tfile->net, file, &ifr); + ret = tun_set_iff(sock_net(&tfile->sk), file, &ifr); if (ret) goto unlock; @@ -1966,12 +2110,12 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, /* Disable/Enable persist mode. Keep an extra reference to the * module to prevent the module being unprobed. */ - if (arg && !(tun->flags & TUN_PERSIST)) { - tun->flags |= TUN_PERSIST; + if (arg && !(tun->flags & IFF_PERSIST)) { + tun->flags |= IFF_PERSIST; __module_get(THIS_MODULE); } - if (!arg && (tun->flags & TUN_PERSIST)) { - tun->flags &= ~TUN_PERSIST; + if (!arg && (tun->flags & IFF_PERSIST)) { + tun->flags &= ~IFF_PERSIST; module_put(THIS_MODULE); } @@ -2029,7 +2173,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, case TUNSETTXFILTER: /* Can be set only for TAPs */ ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) break; ret = update_filter(&tun->txflt, (void __user *)arg); break; @@ -2061,6 +2205,10 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, ret = -EFAULT; break; } + if (sndbuf <= 0) { + ret = -EINVAL; + break; + } tun->sndbuf = sndbuf; tun_set_sndbuf(tun); @@ -2085,10 +2233,35 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, tun->vnet_hdr_sz = vnet_hdr_sz; break; + case TUNGETVNETLE: + le = !!(tun->flags & TUN_VNET_LE); + if (put_user(le, (int __user *)argp)) + ret = -EFAULT; + break; + + case TUNSETVNETLE: + if (get_user(le, (int __user *)argp)) { + ret = -EFAULT; + break; + } + if (le) + tun->flags |= TUN_VNET_LE; + else + tun->flags &= ~TUN_VNET_LE; + break; + + case TUNGETVNETBE: + ret = tun_get_vnet_be(tun, argp); + break; + + case TUNSETVNETBE: + ret = tun_set_vnet_be(tun, argp); + break; + case TUNATTACHFILTER: /* Can be set only for TAPs */ ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) break; ret = -EFAULT; if (copy_from_user(&tun->fprog, argp, sizeof(tun->fprog))) @@ -2100,7 +2273,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, case TUNDETACHFILTER: /* Can be set only for TAPs */ ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) break; ret = 0; tun_detach_filter(tun, tun->numqueues); @@ -2108,7 +2281,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, case TUNGETFILTER: ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) break; ret = -EFAULT; if (copy_to_user(argp, &tun->fprog, sizeof(tun->fprog))) @@ -2172,9 +2345,7 @@ static int tun_chr_fasync(int fd, struct file *file, int on) goto out; if (on) { - ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0); - if (ret) - goto out; + __f_setown(file, task_pid(current), PIDTYPE_PID, 0); tfile->flags |= TUN_FASYNC; } else tfile->flags &= ~TUN_FASYNC; @@ -2185,16 +2356,16 @@ static int tun_chr_fasync(int fd, struct file *file, int on) static int tun_chr_open(struct inode *inode, struct file * file) { + struct net *net = current->nsproxy->net_ns; struct tun_file *tfile; DBG1(KERN_INFO, "tunX: tun_chr_open\n"); - tfile = (struct tun_file *)sk_alloc(&init_net, AF_UNSPEC, GFP_KERNEL, - &tun_proto); + tfile = (struct tun_file *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL, + &tun_proto, 0); if (!tfile) return -ENOMEM; RCU_INIT_POINTER(tfile->tun, NULL); - tfile->net = get_net(current->nsproxy->net_ns); tfile->flags = 0; tfile->ifindex = 0; @@ -2205,33 +2376,31 @@ static int tun_chr_open(struct inode *inode, struct file * file) tfile->socket.ops = &tun_socket_ops; sock_init_data(&tfile->socket, &tfile->sk); - sk_change_net(&tfile->sk, tfile->net); tfile->sk.sk_write_space = tun_sock_write_space; tfile->sk.sk_sndbuf = INT_MAX; file->private_data = tfile; - set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags); INIT_LIST_HEAD(&tfile->next); sock_set_flag(&tfile->sk, SOCK_ZEROCOPY); + memset(&tfile->tx_array, 0, sizeof(tfile->tx_array)); + return 0; } static int tun_chr_close(struct inode *inode, struct file *file) { struct tun_file *tfile = file->private_data; - struct net *net = tfile->net; tun_detach(tfile, true); - put_net(net); return 0; } #ifdef CONFIG_PROC_FS -static int tun_chr_show_fdinfo(struct seq_file *m, struct file *f) +static void tun_chr_show_fdinfo(struct seq_file *m, struct file *f) { struct tun_struct *tun; struct ifreq ifr; @@ -2247,17 +2416,15 @@ static int tun_chr_show_fdinfo(struct seq_file *m, struct file *f) if (tun) tun_put(tun); - return seq_printf(m, "iff:\t%s\n", ifr.ifr_name); + seq_printf(m, "iff:\t%s\n", ifr.ifr_name); } #endif static const struct file_operations tun_fops = { .owner = THIS_MODULE, .llseek = no_llseek, - .read = do_sync_read, - .aio_read = tun_chr_aio_read, - .write = do_sync_write, - .aio_write = tun_chr_aio_write, + .read_iter = tun_chr_read_iter, + .write_iter = tun_chr_write_iter, .poll = tun_chr_poll, .unlocked_ioctl = tun_chr_ioctl, #ifdef CONFIG_COMPAT @@ -2272,7 +2439,7 @@ static const struct file_operations tun_fops = { }; static struct miscdevice tun_miscdev = { - .minor = (TUN_MINOR1), + .minor = TUN_MINOR1, .name = "bf_tun", .nodename = "net/bf_tun", .fops = &tun_fops, @@ -2303,10 +2470,10 @@ static void tun_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info strlcpy(info->version, DRV_VERSION, sizeof(info->version)); switch (tun->flags & TUN_TYPE_MASK) { - case TUN_TUN_DEV: - strlcpy(info->bus_info, "bf_tun", sizeof(info->bus_info)); + case IFF_TUN: + strlcpy(info->bus_info, "tun", sizeof(info->bus_info)); break; - case TUN_TAP_DEV: + case IFF_TAP: strlcpy(info->bus_info, "tap", sizeof(info->bus_info)); break; } @@ -2339,6 +2506,56 @@ static const struct ethtool_ops tun_ethtool_ops = { .get_ts_info = ethtool_op_get_ts_info, }; +static int tun_queue_resize(struct tun_struct *tun) +{ + struct net_device *dev = tun->dev; + struct tun_file *tfile; + struct skb_array **arrays; + int n = tun->numqueues + tun->numdisabled; + int ret, i; + + arrays = kmalloc(sizeof *arrays * n, GFP_KERNEL); + if (!arrays) + return -ENOMEM; + + for (i = 0; i < tun->numqueues; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + arrays[i] = &tfile->tx_array; + } + list_for_each_entry(tfile, &tun->disabled, next) + arrays[i++] = &tfile->tx_array; + + ret = skb_array_resize_multiple(arrays, n, + dev->tx_queue_len, GFP_KERNEL); + + kfree(arrays); + return ret; +} + +static int tun_device_event(struct notifier_block *unused, + unsigned long event, void *ptr) +{ + struct net_device *dev = netdev_notifier_info_to_dev(ptr); + struct tun_struct *tun = netdev_priv(dev); + + if (dev->rtnl_link_ops != &tun_link_ops) + return NOTIFY_DONE; + + switch (event) { + case NETDEV_CHANGE_TX_QUEUE_LEN: + if (tun_queue_resize(tun)) + return NOTIFY_BAD; + break; + default: + break; + } + + return NOTIFY_DONE; +} + +static struct notifier_block tun_notifier_block __read_mostly = { + .notifier_call = tun_device_event, +}; static int __init tun_init(void) { @@ -2355,9 +2572,11 @@ static int __init tun_init(void) ret = misc_register(&tun_miscdev); if (ret) { - pr_err("Can't register misc device %d\n", (TUN_MINOR1)); + pr_err("Can't register misc device %d\n", TUN_MINOR1); goto err_misc; } + + register_netdevice_notifier(&tun_notifier_block); return 0; err_misc: rtnl_link_unregister(&tun_link_ops); @@ -2369,13 +2588,14 @@ static void tun_cleanup(void) { misc_deregister(&tun_miscdev); rtnl_link_unregister(&tun_link_ops); + unregister_netdevice_notifier(&tun_notifier_block); } /* Get an underlying socket object from tun file. Returns error unless file is * attached to a device. The returned object works like a packet socket, it * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for * holding a reference to the file for as long as the socket is in use. */ -struct socket *bf_tun_get_socket(struct file *file) +struct socket *tun_get_socket(struct file *file) { struct tun_file *tfile; if (file->f_op != &tun_fops) @@ -2385,7 +2605,7 @@ struct socket *bf_tun_get_socket(struct file *file) return ERR_PTR(-EBADFD); return &tfile->socket; } -EXPORT_SYMBOL_GPL(bf_tun_get_socket); +EXPORT_SYMBOL_GPL(tun_get_socket); module_init(tun_init); module_exit(tun_cleanup); diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c index a1ba7047baaa..abb906a24618 100644 --- a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c @@ -65,20 +65,21 @@ #include #include #include -#include #include #include #include #include #include +#include +#include #include +#define TUN_MINOR1 201 + /* Uncomment to enable debugging */ /* #define TUN_DEBUG 1 */ -#define TUN_MINOR1 201 - #ifdef TUN_DEBUG static int debug; @@ -105,6 +106,18 @@ do { \ } while (0) #endif +/* TUN device flags */ + +/* IFF_ATTACH_QUEUE is never stored in device flags, + * overload it to mean fasync when stored there. + */ +#define TUN_FASYNC IFF_ATTACH_QUEUE +/* High bits in flags field are unused. */ +#define TUN_VNET_LE 0x80000000 +#define TUN_VNET_BE 0x40000000 + +#define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | \ + IFF_MULTI_QUEUE) #define GOODCOPY_LEN 128 #define FLT_EXACT_COUNT 8 @@ -114,14 +127,24 @@ struct tap_filter { unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN]; }; -/* DEFAULT_MAX_NUM_RSS_QUEUES were chosen to let the rx/tx queues allocated for - * the netdevice to be fit in one page. So we can make sure the success of - * memory allocation. TODO: increase the limit. */ -#define MAX_TAP_QUEUES DEFAULT_MAX_NUM_RSS_QUEUES +/* MAX_TAP_QUEUES 256 is chosen to allow rx/tx queues to be equal + * to max number of VCPUs in guest. */ +#define MAX_TAP_QUEUES 256 #define MAX_TAP_FLOWS 4096 #define TUN_FLOW_EXPIRE (3 * HZ) +struct tun_pcpu_stats { + u64 rx_packets; + u64 rx_bytes; + u64 tx_packets; + u64 tx_bytes; + struct u64_stats_sync syncp; + u32 rx_dropped; + u32 tx_dropped; + u32 rx_frame_errors; +}; + /* A tun_file connects an open character device to a tuntap netdevice. It * also contains all socket related structures (except sock_fprog and tap_filter) * to serve as one transmit queue for tuntap device. The sock_fprog and @@ -138,7 +161,6 @@ struct tun_file { struct socket socket; struct socket_wq wq; struct tun_struct __rcu *tun; - struct net *net; struct fasync_struct *fasync; /* only used for fasnyc */ unsigned int flags; @@ -148,6 +170,7 @@ struct tun_file { }; struct list_head next; struct tun_struct *detached; + struct skb_array tx_array; }; struct tun_flow_entry { @@ -179,6 +202,7 @@ struct tun_struct { #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ NETIF_F_TSO6|NETIF_F_UFO) + int align; int vnet_hdr_sz; int sndbuf; struct tap_filter txflt; @@ -196,8 +220,73 @@ struct tun_struct { struct list_head disabled; void *security; u32 flow_count; + struct tun_pcpu_stats __percpu *pcpu_stats; }; +#ifdef CONFIG_TUN_VNET_CROSS_LE +static inline bool tun_legacy_is_little_endian(struct tun_struct *tun) +{ + return tun->flags & TUN_VNET_BE ? false : + virtio_legacy_is_little_endian(); +} + +static long tun_get_vnet_be(struct tun_struct *tun, int __user *argp) +{ + int be = !!(tun->flags & TUN_VNET_BE); + + if (put_user(be, argp)) + return -EFAULT; + + return 0; +} + +static long tun_set_vnet_be(struct tun_struct *tun, int __user *argp) +{ + int be; + + if (get_user(be, argp)) + return -EFAULT; + + if (be) + tun->flags |= TUN_VNET_BE; + else + tun->flags &= ~TUN_VNET_BE; + + return 0; +} +#else +static inline bool tun_legacy_is_little_endian(struct tun_struct *tun) +{ + return virtio_legacy_is_little_endian(); +} + +static long tun_get_vnet_be(struct tun_struct *tun, int __user *argp) +{ + return -EINVAL; +} + +static long tun_set_vnet_be(struct tun_struct *tun, int __user *argp) +{ + return -EINVAL; +} +#endif /* CONFIG_TUN_VNET_CROSS_LE */ + +static inline bool tun_is_little_endian(struct tun_struct *tun) +{ + return tun->flags & TUN_VNET_LE || + tun_legacy_is_little_endian(tun); +} + +static inline u16 tun16_to_cpu(struct tun_struct *tun, __virtio16 val) +{ + return __virtio16_to_cpu(tun_is_little_endian(tun), val); +} + +static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val) +{ + return __cpu_to_virtio16(tun_is_little_endian(tun), val); +} + static inline u32 tun_hashfn(u32 rxhash) { return rxhash & 0x3ff; @@ -238,7 +327,6 @@ static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) { tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", e->rxhash, e->queue_index); - sock_rps_reset_flow_hash(e->rps_rxhash); hlist_del_rcu(&e->hash_link); kfree_rcu(e, rcu); --tun->flow_count; @@ -355,10 +443,8 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, */ static inline void tun_flow_save_rps_rxhash(struct tun_flow_entry *e, u32 hash) { - if (unlikely(e->rps_rxhash != hash)) { - sock_rps_reset_flow_hash(e->rps_rxhash); + if (unlikely(e->rps_rxhash != hash)) e->rps_rxhash = hash; - } } /* We try to identify a flow through its rxhash first. The reason that @@ -433,10 +519,22 @@ static struct tun_struct *tun_enable_queue(struct tun_file *tfile) static void tun_queue_purge(struct tun_file *tfile) { - skb_queue_purge(&tfile->sk.sk_receive_queue); + struct sk_buff *skb; + + while ((skb = skb_array_consume(&tfile->tx_array)) != NULL) + kfree_skb(skb); + skb_queue_purge(&tfile->sk.sk_error_queue); } +static void tun_cleanup_tx_array(struct tun_file *tfile) +{ + if (tfile->tx_array.ring.queue) { + skb_array_cleanup(&tfile->tx_array); + memset(&tfile->tx_array, 0, sizeof(tfile->tx_array)); + } +} + static void __tun_detach(struct tun_file *tfile, bool clean) { struct tun_file *ntfile; @@ -474,14 +572,12 @@ static void __tun_detach(struct tun_file *tfile, bool clean) if (tun && tun->numqueues == 0 && tun->numdisabled == 0) { netif_carrier_off(tun->dev); - if (!(tun->flags & TUN_PERSIST) && + if (!(tun->flags & IFF_PERSIST) && tun->dev->reg_state == NETREG_REGISTERED) unregister_netdevice(tun->dev); } - - BUG_ON(!test_bit(SOCK_EXTERNALLY_ALLOCATED, - &tfile->socket.flags)); - sk_release_kernel(&tfile->sk); + tun_cleanup_tx_array(tfile); + sock_put(&tfile->sk); } } @@ -501,11 +597,13 @@ static void tun_detach_all(struct net_device *dev) for (i = 0; i < n; i++) { tfile = rtnl_dereference(tun->tfiles[i]); BUG_ON(!tfile); + tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN; tfile->socket.sk->sk_data_ready(tfile->socket.sk); RCU_INIT_POINTER(tfile->tun, NULL); --tun->numqueues; } list_for_each_entry(tfile, &tun->disabled, next) { + tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN; tfile->socket.sk->sk_data_ready(tfile->socket.sk); RCU_INIT_POINTER(tfile->tun, NULL); } @@ -517,21 +615,24 @@ static void tun_detach_all(struct net_device *dev) /* Drop read queue */ tun_queue_purge(tfile); sock_put(&tfile->sk); + tun_cleanup_tx_array(tfile); } list_for_each_entry_safe(tfile, tmp, &tun->disabled, next) { tun_enable_queue(tfile); tun_queue_purge(tfile); sock_put(&tfile->sk); + tun_cleanup_tx_array(tfile); } BUG_ON(tun->numdisabled != 0); - if (tun->flags & TUN_PERSIST) + if (tun->flags & IFF_PERSIST) module_put(THIS_MODULE); } static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filter) { struct tun_file *tfile = file->private_data; + struct net_device *dev = tun->dev; int err; err = security_tun_dev_attach(tfile->socket.sk, tun->security); @@ -543,7 +644,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filte goto out; err = -EBUSY; - if (!(tun->flags & TUN_TAP_MQ) && tun->numqueues == 1) + if (!(tun->flags & IFF_MULTI_QUEUE) && tun->numqueues == 1) goto out; err = -E2BIG; @@ -555,12 +656,21 @@ static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filte /* Re-attach the filter to persist device */ if (!skip_filter && (tun->filter_attached == true)) { - err = __sk_attach_filter(&tun->fprog, tfile->socket.sk, - lockdep_rtnl_is_held()); + lock_sock(tfile->socket.sk); + err = sk_attach_filter(&tun->fprog, tfile->socket.sk); + release_sock(tfile->socket.sk); if (!err) goto out; } + + if (!tfile->detached && + skb_array_init(&tfile->tx_array, dev->tx_queue_len, GFP_KERNEL)) { + err = -ENOMEM; + goto out; + } + tfile->queue_index = tun->numqueues; + tfile->socket.sk->sk_shutdown &= ~RCV_SHUTDOWN; rcu_assign_pointer(tfile->tun, tun); rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); tun->numqueues++; @@ -632,14 +742,9 @@ static int update_filter(struct tap_filter *filter, void __user *arg) } alen = ETH_ALEN * uf.count; - addr = kmalloc(alen, GFP_KERNEL); - if (!addr) - return -ENOMEM; - - if (copy_from_user(addr, arg + sizeof(uf), alen)) { - err = -EFAULT; - goto done; - } + addr = memdup_user(arg + sizeof(uf), alen); + if (IS_ERR(addr)) + return PTR_ERR(addr); /* The filter is updated without holding any locks. Which is * perfectly safe. We disable it first and in the worst @@ -659,7 +764,7 @@ static int update_filter(struct tap_filter *filter, void __user *arg) for (; n < uf.count; n++) { if (!is_multicast_ether_addr(addr[n].u)) { err = 0; /* no filter */ - goto done; + goto free_addr; } addr_hash_set(filter->mask, addr[n].u); } @@ -675,8 +780,7 @@ static int update_filter(struct tap_filter *filter, void __user *arg) /* Return the number of exact filters */ err = nexact; - -done: +free_addr: kfree(addr); return err; } @@ -726,7 +830,18 @@ static void tun_net_uninit(struct net_device *dev) /* Net device open. */ static int tun_net_open(struct net_device *dev) { + struct tun_struct *tun = netdev_priv(dev); + int i; + netif_tx_start_all_queues(dev); + + for (i = 0; i < tun->numqueues; i++) { + struct tun_file *tfile; + + tfile = rtnl_dereference(tun->tfiles[i]); + tfile->socket.sk->sk_write_space(tfile->socket.sk); + } + return 0; } @@ -753,7 +868,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) if (txq >= numqueues) goto drop; - if (numqueues == 1) { +#ifdef CONFIG_RPS + if (numqueues == 1 && static_key_false(&rps_needed)) { /* Select queue was not called for the skbuff, so we extract the * RPS hash and save it into the flow_table here. */ @@ -768,6 +884,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) tun_flow_save_rps_rxhash(e, rxhash); } } +#endif tun_debug(KERN_INFO, tun, "tun_net_xmit %d\n", skb->len); @@ -793,10 +910,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) goto drop; - if (skb->sk) { - sock_tx_timestamp(skb->sk, &skb_shinfo(skb)->tx_flags); - sw_tx_timestamp(skb); - } + skb_tx_timestamp(skb); /* Orphan the skb - required as we might hang on to it * for indefinite time. @@ -805,8 +919,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) nf_reset(skb); - /* Enqueue packet */ - skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb); + if (skb_array_produce(&tfile->tx_array, skb)) + goto drop; /* Notify and wake up reader process */ if (tfile->flags & TUN_FASYNC) @@ -817,11 +931,11 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; drop: - dev->stats.tx_dropped++; + this_cpu_inc(tun->pcpu_stats->tx_dropped); skb_tx_error(skb); kfree_skb(skb); rcu_read_unlock(); - return NETDEV_TX_OK; + return NET_XMIT_DROP; } static void tun_net_mclist(struct net_device *dev) @@ -852,16 +966,6 @@ static netdev_features_t tun_net_fix_features(struct net_device *dev, return (features & tun->set_features) | (features & ~TUN_USER_FEATURES); } - -static int -tun_change_carrier(struct net_device *dev, bool new_carrier) { - if (new_carrier) - netif_carrier_on(dev); - else - netif_carrier_off(dev); - return 0; -} - #ifdef CONFIG_NET_POLL_CONTROLLER static void tun_poll_controller(struct net_device *dev) { @@ -879,6 +983,63 @@ static void tun_poll_controller(struct net_device *dev) return; } #endif + +static void tun_set_headroom(struct net_device *dev, int new_hr) +{ + struct tun_struct *tun = netdev_priv(dev); + + if (new_hr < NET_SKB_PAD) + new_hr = NET_SKB_PAD; + + tun->align = new_hr; +} + +static struct rtnl_link_stats64 * +tun_net_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +{ + u32 rx_dropped = 0, tx_dropped = 0, rx_frame_errors = 0; + struct tun_struct *tun = netdev_priv(dev); + struct tun_pcpu_stats *p; + int i; + + for_each_possible_cpu(i) { + u64 rxpackets, rxbytes, txpackets, txbytes; + unsigned int start; + + p = per_cpu_ptr(tun->pcpu_stats, i); + do { + start = u64_stats_fetch_begin(&p->syncp); + rxpackets = p->rx_packets; + rxbytes = p->rx_bytes; + txpackets = p->tx_packets; + txbytes = p->tx_bytes; + } while (u64_stats_fetch_retry(&p->syncp, start)); + + stats->rx_packets += rxpackets; + stats->rx_bytes += rxbytes; + stats->tx_packets += txpackets; + stats->tx_bytes += txbytes; + + /* u32 counters */ + rx_dropped += p->rx_dropped; + rx_frame_errors += p->rx_frame_errors; + tx_dropped += p->tx_dropped; + } + stats->rx_dropped = rx_dropped; + stats->rx_frame_errors = rx_frame_errors; + stats->tx_dropped = tx_dropped; + return stats; +} + +static int +tun_change_carrier(struct net_device *dev, bool new_carrier) { + if (new_carrier) + netif_carrier_on(dev); + else + netif_carrier_off(dev); + return 0; +} + static const struct net_device_ops tun_netdev_ops = { .ndo_uninit = tun_net_uninit, .ndo_open = tun_net_open, @@ -890,6 +1051,9 @@ static const struct net_device_ops tun_netdev_ops = { #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = tun_poll_controller, #endif + .ndo_set_rx_headroom = tun_set_headroom, + .ndo_get_stats64 = tun_net_get_stats64, + .ndo_change_carrier = tun_change_carrier, }; static const struct net_device_ops tap_netdev_ops = { @@ -906,7 +1070,9 @@ static const struct net_device_ops tap_netdev_ops = { #ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = tun_poll_controller, #endif - .ndo_change_carrier = tun_change_carrier, + .ndo_features_check = passthru_features_check, + .ndo_set_rx_headroom = tun_set_headroom, + .ndo_get_stats64 = tun_net_get_stats64, }; static void tun_flow_init(struct tun_struct *tun) @@ -934,7 +1100,7 @@ static void tun_net_init(struct net_device *dev) struct tun_struct *tun = netdev_priv(dev); switch (tun->flags & TUN_TYPE_MASK) { - case TUN_TUN_DEV: + case IFF_TUN: dev->netdev_ops = &tun_netdev_ops; /* Point-to-Point TUN Device */ @@ -945,10 +1111,9 @@ static void tun_net_init(struct net_device *dev) /* Zero header length */ dev->type = ARPHRD_NONE; dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; - dev->tx_queue_len = TUN_READQ_SIZE*2; /* We prefer our own queue length */ break; - case TUN_TAP_DEV: + case IFF_TAP: dev->netdev_ops = &tap_netdev_ops; /* Ethernet TAP Device */ ether_setup(dev); @@ -957,7 +1122,6 @@ static void tun_net_init(struct net_device *dev) eth_hw_addr_random(dev); - dev->tx_queue_len = TUN_READQ_SIZE*2; /* We prefer our own queue length */ break; } } @@ -981,12 +1145,13 @@ static unsigned int tun_chr_poll(struct file *file, poll_table *wait) poll_wait(file, sk_sleep(sk), wait); - if (!skb_queue_empty(&sk->sk_receive_queue)) + if (!skb_array_empty(&tfile->tx_array)) mask |= POLLIN | POLLRDNORM; - if (sock_writeable(sk) || - (!test_and_set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags) && - sock_writeable(sk))) + if (tun->dev->flags & IFF_UP && + (sock_writeable(sk) || + (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) && + sock_writeable(sk)))) mask |= POLLOUT | POLLWRNORM; if (tun->dev->reg_state != NETREG_REGISTERED) @@ -1025,121 +1190,127 @@ static struct sk_buff *tun_alloc_skb(struct tun_file *tfile, /* Get packet from user space buffer */ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, - void *msg_control, const struct iovec *iv, - size_t total_len, size_t count, int noblock) + void *msg_control, struct iov_iter *from, + int noblock) { struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) }; struct sk_buff *skb; - size_t len = total_len, align = NET_SKB_PAD, linear; + size_t total_len = iov_iter_count(from); + size_t len = total_len, align = tun->align, linear; struct virtio_net_hdr gso = { 0 }; + struct tun_pcpu_stats *stats; int good_linear; - int offset = 0; int copylen; bool zerocopy = false; int err; u32 rxhash; + ssize_t n; + + if (!(tun->dev->flags & IFF_UP)) + return -EIO; - if (!(tun->flags & TUN_NO_PI)) { + if (!(tun->flags & IFF_NO_PI)) { if (len < sizeof(pi)) return -EINVAL; len -= sizeof(pi); - if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) + n = copy_from_iter(&pi, sizeof(pi), from); + if (n != sizeof(pi)) return -EFAULT; - offset += sizeof(pi); } - if (tun->flags & TUN_VNET_HDR) { - if (len < tun->vnet_hdr_sz) + if (tun->flags & IFF_VNET_HDR) { + int vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz); + + if (len < vnet_hdr_sz) return -EINVAL; - len -= tun->vnet_hdr_sz; + len -= vnet_hdr_sz; - if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) + n = copy_from_iter(&gso, sizeof(gso), from); + if (n != sizeof(gso)) return -EFAULT; if ((gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && - gso.csum_start + gso.csum_offset + 2 > gso.hdr_len) - gso.hdr_len = gso.csum_start + gso.csum_offset + 2; + tun16_to_cpu(tun, gso.csum_start) + tun16_to_cpu(tun, gso.csum_offset) + 2 > tun16_to_cpu(tun, gso.hdr_len)) + gso.hdr_len = cpu_to_tun16(tun, tun16_to_cpu(tun, gso.csum_start) + tun16_to_cpu(tun, gso.csum_offset) + 2); - if (gso.hdr_len > len) + if (tun16_to_cpu(tun, gso.hdr_len) > len) return -EINVAL; - offset += tun->vnet_hdr_sz; + iov_iter_advance(from, vnet_hdr_sz - sizeof(gso)); } - if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) { + if ((tun->flags & TUN_TYPE_MASK) == IFF_TAP) { align += NET_IP_ALIGN; if (unlikely(len < ETH_HLEN || - (gso.hdr_len && gso.hdr_len < ETH_HLEN))) + (gso.hdr_len && tun16_to_cpu(tun, gso.hdr_len) < ETH_HLEN))) return -EINVAL; } good_linear = SKB_MAX_HEAD(align); if (msg_control) { + struct iov_iter i = *from; + /* There are 256 bytes to be copied in skb, so there is * enough room for skb expand head in case it is used. * The rest of the buffer is mapped from userspace. */ - copylen = gso.hdr_len ? gso.hdr_len : GOODCOPY_LEN; + copylen = gso.hdr_len ? tun16_to_cpu(tun, gso.hdr_len) : GOODCOPY_LEN; if (copylen > good_linear) copylen = good_linear; linear = copylen; - if (iov_pages(iv, offset + copylen, count) <= MAX_SKB_FRAGS) + iov_iter_advance(&i, copylen); + if (iov_iter_npages(&i, INT_MAX) <= MAX_SKB_FRAGS) zerocopy = true; } if (!zerocopy) { copylen = len; - if (gso.hdr_len > good_linear) + if (tun16_to_cpu(tun, gso.hdr_len) > good_linear) linear = good_linear; else - linear = gso.hdr_len; + linear = tun16_to_cpu(tun, gso.hdr_len); } skb = tun_alloc_skb(tfile, align, copylen, linear, noblock); if (IS_ERR(skb)) { if (PTR_ERR(skb) != -EAGAIN) - tun->dev->stats.rx_dropped++; + this_cpu_inc(tun->pcpu_stats->rx_dropped); return PTR_ERR(skb); } if (zerocopy) - err = zerocopy_sg_from_iovec(skb, iv, offset, count); - else { - err = skb_copy_datagram_from_iovec(skb, 0, iv, offset, len); - if (!err && msg_control) { - struct ubuf_info *uarg = msg_control; - uarg->callback(uarg, false); - } - } + err = zerocopy_sg_from_iter(skb, from); + else + err = skb_copy_datagram_from_iter(skb, 0, from, len); if (err) { - tun->dev->stats.rx_dropped++; + this_cpu_inc(tun->pcpu_stats->rx_dropped); kfree_skb(skb); return -EFAULT; } - if (gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { - if (!skb_partial_csum_set(skb, gso.csum_start, - gso.csum_offset)) { - tun->dev->stats.rx_frame_errors++; - kfree_skb(skb); - return -EINVAL; - } + err = virtio_net_hdr_to_skb(skb, &gso, tun_is_little_endian(tun)); + if (err) { + this_cpu_inc(tun->pcpu_stats->rx_frame_errors); + kfree_skb(skb); + return -EINVAL; } switch (tun->flags & TUN_TYPE_MASK) { - case TUN_TUN_DEV: - if (tun->flags & TUN_NO_PI) { - switch (skb->data[0] & 0xf0) { - case 0x40: + case IFF_TUN: + if (tun->flags & IFF_NO_PI) { + u8 ip_version = skb->len ? (skb->data[0] >> 4) : 0; + + switch (ip_version) { + case 4: pi.proto = htons(ETH_P_IP); break; - case 0x60: + case 6: pi.proto = htons(ETH_P_IPV6); break; default: - tun->dev->stats.rx_dropped++; + this_cpu_inc(tun->pcpu_stats->rx_dropped); kfree_skb(skb); return -EINVAL; } @@ -1149,69 +1320,39 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, skb->protocol = pi.proto; skb->dev = tun->dev; break; - case TUN_TAP_DEV: + case IFF_TAP: skb->protocol = eth_type_trans(skb, tun->dev); break; } - skb_reset_network_header(skb); - - if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { - pr_debug("GSO!\n"); - switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { - case VIRTIO_NET_HDR_GSO_TCPV4: - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; - break; - case VIRTIO_NET_HDR_GSO_TCPV6: - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; - break; - case VIRTIO_NET_HDR_GSO_UDP: - skb_shinfo(skb)->gso_type = SKB_GSO_UDP; - if (skb->protocol == htons(ETH_P_IPV6)) - ipv6_proxy_select_ident(skb); - break; - default: - tun->dev->stats.rx_frame_errors++; - kfree_skb(skb); - return -EINVAL; - } - - if (gso.gso_type & VIRTIO_NET_HDR_GSO_ECN) - skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; - - skb_shinfo(skb)->gso_size = gso.gso_size; - if (skb_shinfo(skb)->gso_size == 0) { - tun->dev->stats.rx_frame_errors++; - kfree_skb(skb); - return -EINVAL; - } - - /* Header must be checked, and gso_segs computed. */ - skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; - skb_shinfo(skb)->gso_segs = 0; - } - /* copy skb_ubuf_info for callback when skb has no error */ if (zerocopy) { skb_shinfo(skb)->destructor_arg = msg_control; skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; + } else if (msg_control) { + struct ubuf_info *uarg = msg_control; + uarg->callback(uarg, false); } + skb_reset_network_header(skb); skb_probe_transport_header(skb, 0); rxhash = skb_get_hash(skb); netif_rx_ni(skb); - tun->dev->stats.rx_packets++; - tun->dev->stats.rx_bytes += len; + stats = get_cpu_ptr(tun->pcpu_stats); + u64_stats_update_begin(&stats->syncp); + stats->rx_packets++; + stats->rx_bytes += len; + u64_stats_update_end(&stats->syncp); + put_cpu_ptr(stats); tun_flow_update(tun, rxhash, tfile); return total_len; } -static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, - unsigned long count, loff_t pos) +static ssize_t tun_chr_write_iter(struct kiocb *iocb, struct iov_iter *from) { struct file *file = iocb->ki_filp; struct tun_struct *tun = tun_get(file); @@ -1221,10 +1362,7 @@ static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, if (!tun) return -EBADFD; - tun_debug(KERN_INFO, tun, "tun_chr_write %ld\n", count); - - result = tun_get_user(tun, tfile, NULL, iv, iov_length(iv, count), - count, file->f_flags & O_NONBLOCK); + result = tun_get_user(tun, tfile, NULL, from, file->f_flags & O_NONBLOCK); tun_put(tun); return result; @@ -1234,167 +1372,183 @@ static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, static ssize_t tun_put_user(struct tun_struct *tun, struct tun_file *tfile, struct sk_buff *skb, - const struct iovec *iv, int len) + struct iov_iter *iter) { struct tun_pi pi = { 0, skb->protocol }; - ssize_t total = 0; - int vlan_offset = 0, copied; + struct tun_pcpu_stats *stats; + ssize_t total; + int vlan_offset = 0; int vlan_hlen = 0; + int vnet_hdr_sz = 0; - if (vlan_tx_tag_present(skb)) + if (skb_vlan_tag_present(skb)) vlan_hlen = VLAN_HLEN; - if (!(tun->flags & TUN_NO_PI)) { - if ((len -= sizeof(pi)) < 0) + if (tun->flags & IFF_VNET_HDR) + vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz); + + total = skb->len + vlan_hlen + vnet_hdr_sz; + + if (!(tun->flags & IFF_NO_PI)) { + if (iov_iter_count(iter) < sizeof(pi)) return -EINVAL; - if (len < skb->len) { + total += sizeof(pi); + if (iov_iter_count(iter) < total) { /* Packet will be striped */ pi.flags |= TUN_PKT_STRIP; } - if (memcpy_toiovecend(iv, (void *) &pi, 0, sizeof(pi))) + if (copy_to_iter(&pi, sizeof(pi), iter) != sizeof(pi)) return -EFAULT; - total += sizeof(pi); } - if (tun->flags & TUN_VNET_HDR) { + if (vnet_hdr_sz) { struct virtio_net_hdr gso = { 0 }; /* no info leak */ - if ((len -= tun->vnet_hdr_sz) < 0) + int ret; + + if (iov_iter_count(iter) < vnet_hdr_sz) return -EINVAL; - if (skb_is_gso(skb)) { + ret = virtio_net_hdr_from_skb(skb, &gso, + tun_is_little_endian(tun), true); + if (ret) { struct skb_shared_info *sinfo = skb_shinfo(skb); + pr_err("unexpected GSO type: " + "0x%x, gso_size %d, hdr_len %d\n", + sinfo->gso_type, tun16_to_cpu(tun, gso.gso_size), + tun16_to_cpu(tun, gso.hdr_len)); + print_hex_dump(KERN_ERR, "tun: ", + DUMP_PREFIX_NONE, + 16, 1, skb->head, + min((int)tun16_to_cpu(tun, gso.hdr_len), 64), true); + WARN_ON_ONCE(1); + return -EINVAL; + } - /* This is a hint as to how much should be linear. */ - gso.hdr_len = skb_headlen(skb); - gso.gso_size = sinfo->gso_size; - if (sinfo->gso_type & SKB_GSO_TCPV4) - gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; - else if (sinfo->gso_type & SKB_GSO_TCPV6) - gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; - else if (sinfo->gso_type & SKB_GSO_UDP) - gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; - else { - pr_err("unexpected GSO type: " - "0x%x, gso_size %d, hdr_len %d\n", - sinfo->gso_type, gso.gso_size, - gso.hdr_len); - print_hex_dump(KERN_ERR, "tun: ", - DUMP_PREFIX_NONE, - 16, 1, skb->head, - min((int)gso.hdr_len, 64), true); - WARN_ON_ONCE(1); - return -EINVAL; - } - if (sinfo->gso_type & SKB_GSO_TCP_ECN) - gso.gso_type |= VIRTIO_NET_HDR_GSO_ECN; - } else - gso.gso_type = VIRTIO_NET_HDR_GSO_NONE; - - if (skb->ip_summed == CHECKSUM_PARTIAL) { - gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; - gso.csum_start = skb_checksum_start_offset(skb) + - vlan_hlen; - gso.csum_offset = skb->csum_offset; - } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { - gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; - } /* else everything is zero */ - - if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total, - sizeof(gso)))) + if (copy_to_iter(&gso, sizeof(gso), iter) != sizeof(gso)) return -EFAULT; - total += tun->vnet_hdr_sz; + + iov_iter_advance(iter, vnet_hdr_sz - sizeof(gso)); } - copied = total; - len = min_t(int, skb->len + vlan_hlen, len); - total += skb->len + vlan_hlen; if (vlan_hlen) { - int copy, ret; + int ret; struct { __be16 h_vlan_proto; __be16 h_vlan_TCI; } veth; veth.h_vlan_proto = skb->vlan_proto; - veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); + veth.h_vlan_TCI = htons(skb_vlan_tag_get(skb)); vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); - copy = min_t(int, vlan_offset, len); - ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); - len -= copy; - copied += copy; - if (ret || !len) + ret = skb_copy_datagram_iter(skb, 0, iter, vlan_offset); + if (ret || !iov_iter_count(iter)) goto done; - copy = min_t(int, sizeof(veth), len); - ret = memcpy_toiovecend(iv, (void *)&veth, copied, copy); - len -= copy; - copied += copy; - if (ret || !len) + ret = copy_to_iter(&veth, sizeof(veth), iter); + if (ret != sizeof(veth) || !iov_iter_count(iter)) goto done; } - skb_copy_datagram_const_iovec(skb, vlan_offset, iv, copied, len); + skb_copy_datagram_iter(skb, vlan_offset, iter, skb->len - vlan_offset); done: - tun->dev->stats.tx_packets++; - tun->dev->stats.tx_bytes += len; + /* caller is in process context, */ + stats = get_cpu_ptr(tun->pcpu_stats); + u64_stats_update_begin(&stats->syncp); + stats->tx_packets++; + stats->tx_bytes += skb->len + vlan_hlen; + u64_stats_update_end(&stats->syncp); + put_cpu_ptr(tun->pcpu_stats); return total; } +static struct sk_buff *tun_ring_recv(struct tun_file *tfile, int noblock, + int *err) +{ + DECLARE_WAITQUEUE(wait, current); + struct sk_buff *skb = NULL; + int error = 0; + + skb = skb_array_consume(&tfile->tx_array); + if (skb) + goto out; + if (noblock) { + error = -EAGAIN; + goto out; + } + + add_wait_queue(&tfile->wq.wait, &wait); + current->state = TASK_INTERRUPTIBLE; + + while (1) { + skb = skb_array_consume(&tfile->tx_array); + if (skb) + break; + if (signal_pending(current)) { + error = -ERESTARTSYS; + break; + } + if (tfile->socket.sk->sk_shutdown & RCV_SHUTDOWN) { + error = -EFAULT; + break; + } + + schedule(); + } + + current->state = TASK_RUNNING; + remove_wait_queue(&tfile->wq.wait, &wait); + +out: + *err = error; + return skb; +} + static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile, - const struct iovec *iv, ssize_t len, int noblock) + struct iov_iter *to, + int noblock) { struct sk_buff *skb; - ssize_t ret = 0; - int peeked, err, off = 0; + ssize_t ret; + int err; tun_debug(KERN_INFO, tun, "tun_do_read\n"); - if (!len) - return ret; + if (!iov_iter_count(to)) + return 0; - if (tun->dev->reg_state != NETREG_REGISTERED) - return -EIO; + /* Read frames from ring */ + skb = tun_ring_recv(tfile, noblock, &err); + if (!skb) + return err; - /* Read frames from queue */ - skb = __skb_recv_datagram(tfile->socket.sk, noblock ? MSG_DONTWAIT : 0, - &peeked, &off, &err); - if (skb) { - ret = tun_put_user(tun, tfile, skb, iv, len); + ret = tun_put_user(tun, tfile, skb, to); + if (unlikely(ret < 0)) kfree_skb(skb); - } else - ret = err; + else + consume_skb(skb); return ret; } -static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, - unsigned long count, loff_t pos) +static ssize_t tun_chr_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct file *file = iocb->ki_filp; struct tun_file *tfile = file->private_data; struct tun_struct *tun = __tun_get(tfile); - ssize_t len, ret; + ssize_t len = iov_iter_count(to), ret; if (!tun) return -EBADFD; - len = iov_length(iv, count); - if (len < 0) { - ret = -EINVAL; - goto out; - } - - ret = tun_do_read(tun, tfile, iv, len, - file->f_flags & O_NONBLOCK); + ret = tun_do_read(tun, tfile, to, file->f_flags & O_NONBLOCK); ret = min_t(ssize_t, ret, len); if (ret > 0) iocb->ki_pos = ret; -out: tun_put(tun); return ret; } @@ -1404,6 +1558,7 @@ static void tun_free_netdev(struct net_device *dev) struct tun_struct *tun = netdev_priv(dev); BUG_ON(!(list_empty(&tun->disabled))); + free_percpu(tun->pcpu_stats); tun_flow_uninit(tun); security_tun_dev_free_security(tun->security); free_netdev(dev); @@ -1418,6 +1573,8 @@ static void tun_setup(struct net_device *dev) dev->ethtool_ops = &tun_ethtool_ops; dev->destructor = tun_free_netdev; + /* We prefer our own queue length */ + dev->tx_queue_len = TUN_READQ_SIZE; } /* Trivial set of netlink ops to allow deleting tun or tap @@ -1443,7 +1600,7 @@ static void tun_sock_write_space(struct sock *sk) if (!sock_writeable(sk)) return; - if (!test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags)) + if (!test_and_clear_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags)) return; wqueue = sk_sleep(sk); @@ -1455,8 +1612,7 @@ static void tun_sock_write_space(struct sock *sk) kill_fasync(&tfile->fasync, SIGIO, POLL_OUT); } -static int tun_sendmsg(struct kiocb *iocb, struct socket *sock, - struct msghdr *m, size_t total_len) +static int tun_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) { int ret; struct tun_file *tfile = container_of(sock, struct tun_file, socket); @@ -1464,14 +1620,14 @@ static int tun_sendmsg(struct kiocb *iocb, struct socket *sock, if (!tun) return -EBADFD; - ret = tun_get_user(tun, tfile, m->msg_control, m->msg_iov, total_len, - m->msg_iovlen, m->msg_flags & MSG_DONTWAIT); + + ret = tun_get_user(tun, tfile, m->msg_control, &m->msg_iter, + m->msg_flags & MSG_DONTWAIT); tun_put(tun); return ret; } -static int tun_recvmsg(struct kiocb *iocb, struct socket *sock, - struct msghdr *m, size_t total_len, +static int tun_recvmsg(struct socket *sock, struct msghdr *m, size_t total_len, int flags) { struct tun_file *tfile = container_of(sock, struct tun_file, socket); @@ -1490,9 +1646,8 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock, SOL_PACKET, TUN_TX_TIMESTAMP); goto out; } - ret = tun_do_read(tun, tfile, m->msg_iov, total_len, - flags & MSG_DONTWAIT); - if (ret > total_len) { + ret = tun_do_read(tun, tfile, &m->msg_iter, flags & MSG_DONTWAIT); + if (ret > (ssize_t)total_len) { m->msg_flags |= MSG_TRUNC; ret = flags & MSG_TRUNC ? ret : total_len; } @@ -1501,54 +1656,38 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock, return ret; } -static int tun_release(struct socket *sock) +static int tun_peek_len(struct socket *sock) { - if (sock->sk) - sock_put(sock->sk); - return 0; + struct tun_file *tfile = container_of(sock, struct tun_file, socket); + struct tun_struct *tun; + int ret = 0; + + tun = __tun_get(tfile); + if (!tun) + return 0; + + ret = skb_array_peek_len(&tfile->tx_array); + tun_put(tun); + + return ret; } /* Ops structure to mimic raw sockets with tun */ static const struct proto_ops tun_socket_ops = { + .peek_len = tun_peek_len, .sendmsg = tun_sendmsg, .recvmsg = tun_recvmsg, - .release = tun_release, }; static struct proto tun_proto = { - .name = "bf_tun", + .name = "tun", .owner = THIS_MODULE, .obj_size = sizeof(struct tun_file), }; static int tun_flags(struct tun_struct *tun) { - int flags = 0; - - if (tun->flags & TUN_TUN_DEV) - flags |= IFF_TUN; - else - flags |= IFF_TAP; - - if (tun->flags & TUN_NO_PI) - flags |= IFF_NO_PI; - - /* This flag has no real effect. We track the value for backwards - * compatibility. - */ - if (tun->flags & TUN_ONE_QUEUE) - flags |= IFF_ONE_QUEUE; - - if (tun->flags & TUN_VNET_HDR) - flags |= IFF_VNET_HDR; - - if (tun->flags & TUN_TAP_MQ) - flags |= IFF_MULTI_QUEUE; - - if (tun->flags & TUN_PERSIST) - flags |= IFF_PERSIST; - - return flags; + return tun->flags & (TUN_FEATURES | IFF_PERSIST | IFF_TUN | IFF_TAP); } static ssize_t tun_show_flags(struct device *dev, struct device_attribute *attr, @@ -1582,6 +1721,17 @@ static DEVICE_ATTR(tun_flags, 0444, tun_show_flags, NULL); static DEVICE_ATTR(owner, 0444, tun_show_owner, NULL); static DEVICE_ATTR(group, 0444, tun_show_group, NULL); +static struct attribute *tun_dev_attrs[] = { + &dev_attr_tun_flags.attr, + &dev_attr_owner.attr, + &dev_attr_group.attr, + NULL +}; + +static const struct attribute_group tun_attr_group = { + .attrs = tun_dev_attrs +}; + static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) { struct tun_struct *tun; @@ -1604,7 +1754,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) return -EINVAL; if (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) != - !!(tun->flags & TUN_TAP_MQ)) + !!(tun->flags & IFF_MULTI_QUEUE)) return -EINVAL; if (tun_not_capable(tun)) @@ -1617,7 +1767,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) if (err < 0) return err; - if (tun->flags & TUN_TAP_MQ && + if (tun->flags & IFF_MULTI_QUEUE && (tun->numqueues + tun->numdisabled > 1)) { /* One or more queue has already been attached, no need * to initialize the device again. @@ -1640,11 +1790,11 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) /* Set dev type */ if (ifr->ifr_flags & IFF_TUN) { /* TUN device */ - flags |= TUN_TUN_DEV; + flags |= IFF_TUN; name = "tun%d"; } else if (ifr->ifr_flags & IFF_TAP) { /* TAP device */ - flags |= TUN_TAP_DEV; + flags |= IFF_TAP; name = "tap%d"; } else return -EINVAL; @@ -1653,14 +1803,20 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) name = ifr->ifr_name; dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, - tun_setup, queues, queues); + NET_NAME_UNKNOWN, tun_setup, queues, + queues); if (!dev) return -ENOMEM; - +#if 0 + err = dev_get_valid_name(net, dev, name); + if (err < 0) + goto err_free_dev; +#endif dev_net_set(dev, net); dev->rtnl_link_ops = &tun_link_ops; dev->ifindex = tfile->ifindex; + dev->sysfs_groups[0] = &tun_attr_group; tun = netdev_priv(dev); tun->dev = dev; @@ -1668,14 +1824,21 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) tun->txflt.count = 0; tun->vnet_hdr_sz = sizeof(struct virtio_net_hdr); + tun->align = NET_SKB_PAD; tun->filter_attached = false; tun->sndbuf = tfile->socket.sk->sk_sndbuf; + tun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats); + if (!tun->pcpu_stats) { + err = -ENOMEM; + goto err_free_dev; + } + spin_lock_init(&tun->lock); err = security_tun_dev_alloc_security(&tun->security); if (err < 0) - goto err_free_dev; + goto err_free_stat; tun_net_init(dev); tun_flow_init(tun); @@ -1683,7 +1846,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; - dev->features = dev->hw_features; + dev->features = dev->hw_features | NETIF_F_LLTX; dev->vlan_features = dev->features & ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX); @@ -1696,39 +1859,14 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) err = register_netdevice(tun->dev); if (err < 0) goto err_detach; - - if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) || - device_create_file(&tun->dev->dev, &dev_attr_owner) || - device_create_file(&tun->dev->dev, &dev_attr_group)) - pr_err("Failed to create tun sysfs files\n"); } netif_carrier_on(tun->dev); tun_debug(KERN_INFO, tun, "tun_set_iff\n"); - if (ifr->ifr_flags & IFF_NO_PI) - tun->flags |= TUN_NO_PI; - else - tun->flags &= ~TUN_NO_PI; - - /* This flag has no real effect. We track the value for backwards - * compatibility. - */ - if (ifr->ifr_flags & IFF_ONE_QUEUE) - tun->flags |= TUN_ONE_QUEUE; - else - tun->flags &= ~TUN_ONE_QUEUE; - - if (ifr->ifr_flags & IFF_VNET_HDR) - tun->flags |= TUN_VNET_HDR; - else - tun->flags &= ~TUN_VNET_HDR; - - if (ifr->ifr_flags & IFF_MULTI_QUEUE) - tun->flags |= TUN_TAP_MQ; - else - tun->flags &= ~TUN_TAP_MQ; + tun->flags = (tun->flags & ~TUN_FEATURES) | + (ifr->ifr_flags & TUN_FEATURES); /* Make sure persistent devices do not get stuck in * xoff state. @@ -1744,6 +1882,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) err_free_flow: tun_flow_uninit(tun); security_tun_dev_free_security(tun->security); +err_free_stat: + free_percpu(tun->pcpu_stats); err_free_dev: free_netdev(dev); return err; @@ -1806,7 +1946,9 @@ static void tun_detach_filter(struct tun_struct *tun, int n) for (i = 0; i < n; i++) { tfile = rtnl_dereference(tun->tfiles[i]); - __sk_detach_filter(tfile->socket.sk, lockdep_rtnl_is_held()); + lock_sock(tfile->socket.sk); + sk_detach_filter(tfile->socket.sk); + release_sock(tfile->socket.sk); } tun->filter_attached = false; @@ -1819,8 +1961,9 @@ static int tun_attach_filter(struct tun_struct *tun) for (i = 0; i < tun->numqueues; i++) { tfile = rtnl_dereference(tun->tfiles[i]); - ret = __sk_attach_filter(&tun->fprog, tfile->socket.sk, - lockdep_rtnl_is_held()); + lock_sock(tfile->socket.sk); + ret = sk_attach_filter(&tun->fprog, tfile->socket.sk); + release_sock(tfile->socket.sk); if (ret) { tun_detach_filter(tun, i); return ret; @@ -1862,7 +2005,7 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr) ret = tun_attach(tun, file, false); } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { tun = rtnl_dereference(tfile->tun); - if (!tun || !(tun->flags & TUN_TAP_MQ) || tfile->detached) + if (!tun || !(tun->flags & IFF_MULTI_QUEUE) || tfile->detached) ret = -EINVAL; else __tun_detach(tfile, false); @@ -1886,6 +2029,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, int sndbuf; int vnet_hdr_sz; unsigned int ifindex; + int le; int ret; if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == 0x89) { @@ -1897,9 +2041,9 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, if (cmd == TUNGETFEATURES) { /* Currently this just means: "what IFF flags are valid?". * This is needed because we never checked for invalid flags on - * TUNSETIFF. */ - return put_user(IFF_TUN | IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE | - IFF_VNET_HDR | IFF_MULTI_QUEUE, + * TUNSETIFF. + */ + return put_user(IFF_TUN | IFF_TAP | TUN_FEATURES, (unsigned int __user*)argp); } else if (cmd == TUNSETQUEUE) return tun_set_queue(file, &ifr); @@ -1911,7 +2055,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, if (cmd == TUNSETIFF && !tun) { ifr.ifr_name[IFNAMSIZ-1] = '\0'; - ret = tun_set_iff(tfile->net, file, &ifr); + ret = tun_set_iff(sock_net(&tfile->sk), file, &ifr); if (ret) goto unlock; @@ -1966,12 +2110,12 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, /* Disable/Enable persist mode. Keep an extra reference to the * module to prevent the module being unprobed. */ - if (arg && !(tun->flags & TUN_PERSIST)) { - tun->flags |= TUN_PERSIST; + if (arg && !(tun->flags & IFF_PERSIST)) { + tun->flags |= IFF_PERSIST; __module_get(THIS_MODULE); } - if (!arg && (tun->flags & TUN_PERSIST)) { - tun->flags &= ~TUN_PERSIST; + if (!arg && (tun->flags & IFF_PERSIST)) { + tun->flags &= ~IFF_PERSIST; module_put(THIS_MODULE); } @@ -2029,7 +2173,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, case TUNSETTXFILTER: /* Can be set only for TAPs */ ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) break; ret = update_filter(&tun->txflt, (void __user *)arg); break; @@ -2061,6 +2205,10 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, ret = -EFAULT; break; } + if (sndbuf <= 0) { + ret = -EINVAL; + break; + } tun->sndbuf = sndbuf; tun_set_sndbuf(tun); @@ -2085,10 +2233,35 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, tun->vnet_hdr_sz = vnet_hdr_sz; break; + case TUNGETVNETLE: + le = !!(tun->flags & TUN_VNET_LE); + if (put_user(le, (int __user *)argp)) + ret = -EFAULT; + break; + + case TUNSETVNETLE: + if (get_user(le, (int __user *)argp)) { + ret = -EFAULT; + break; + } + if (le) + tun->flags |= TUN_VNET_LE; + else + tun->flags &= ~TUN_VNET_LE; + break; + + case TUNGETVNETBE: + ret = tun_get_vnet_be(tun, argp); + break; + + case TUNSETVNETBE: + ret = tun_set_vnet_be(tun, argp); + break; + case TUNATTACHFILTER: /* Can be set only for TAPs */ ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) break; ret = -EFAULT; if (copy_from_user(&tun->fprog, argp, sizeof(tun->fprog))) @@ -2100,7 +2273,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, case TUNDETACHFILTER: /* Can be set only for TAPs */ ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) break; ret = 0; tun_detach_filter(tun, tun->numqueues); @@ -2108,7 +2281,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, case TUNGETFILTER: ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) + if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) break; ret = -EFAULT; if (copy_to_user(argp, &tun->fprog, sizeof(tun->fprog))) @@ -2172,9 +2345,7 @@ static int tun_chr_fasync(int fd, struct file *file, int on) goto out; if (on) { - ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0); - if (ret) - goto out; + __f_setown(file, task_pid(current), PIDTYPE_PID, 0); tfile->flags |= TUN_FASYNC; } else tfile->flags &= ~TUN_FASYNC; @@ -2185,16 +2356,16 @@ static int tun_chr_fasync(int fd, struct file *file, int on) static int tun_chr_open(struct inode *inode, struct file * file) { + struct net *net = current->nsproxy->net_ns; struct tun_file *tfile; DBG1(KERN_INFO, "tunX: tun_chr_open\n"); - tfile = (struct tun_file *)sk_alloc(&init_net, AF_UNSPEC, GFP_KERNEL, - &tun_proto); + tfile = (struct tun_file *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL, + &tun_proto, 0); if (!tfile) return -ENOMEM; RCU_INIT_POINTER(tfile->tun, NULL); - tfile->net = get_net(current->nsproxy->net_ns); tfile->flags = 0; tfile->ifindex = 0; @@ -2205,33 +2376,31 @@ static int tun_chr_open(struct inode *inode, struct file * file) tfile->socket.ops = &tun_socket_ops; sock_init_data(&tfile->socket, &tfile->sk); - sk_change_net(&tfile->sk, tfile->net); tfile->sk.sk_write_space = tun_sock_write_space; tfile->sk.sk_sndbuf = INT_MAX; file->private_data = tfile; - set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags); INIT_LIST_HEAD(&tfile->next); sock_set_flag(&tfile->sk, SOCK_ZEROCOPY); + memset(&tfile->tx_array, 0, sizeof(tfile->tx_array)); + return 0; } static int tun_chr_close(struct inode *inode, struct file *file) { struct tun_file *tfile = file->private_data; - struct net *net = tfile->net; tun_detach(tfile, true); - put_net(net); return 0; } #ifdef CONFIG_PROC_FS -static int tun_chr_show_fdinfo(struct seq_file *m, struct file *f) +static void tun_chr_show_fdinfo(struct seq_file *m, struct file *f) { struct tun_struct *tun; struct ifreq ifr; @@ -2247,17 +2416,15 @@ static int tun_chr_show_fdinfo(struct seq_file *m, struct file *f) if (tun) tun_put(tun); - return seq_printf(m, "iff:\t%s\n", ifr.ifr_name); + seq_printf(m, "iff:\t%s\n", ifr.ifr_name); } #endif static const struct file_operations tun_fops = { .owner = THIS_MODULE, .llseek = no_llseek, - .read = do_sync_read, - .aio_read = tun_chr_aio_read, - .write = do_sync_write, - .aio_write = tun_chr_aio_write, + .read_iter = tun_chr_read_iter, + .write_iter = tun_chr_write_iter, .poll = tun_chr_poll, .unlocked_ioctl = tun_chr_ioctl, #ifdef CONFIG_COMPAT @@ -2272,7 +2439,7 @@ static const struct file_operations tun_fops = { }; static struct miscdevice tun_miscdev = { - .minor = (TUN_MINOR1), + .minor = TUN_MINOR1, .name = "bf_tun", .nodename = "net/bf_tun", .fops = &tun_fops, @@ -2303,10 +2470,10 @@ static void tun_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info strlcpy(info->version, DRV_VERSION, sizeof(info->version)); switch (tun->flags & TUN_TYPE_MASK) { - case TUN_TUN_DEV: - strlcpy(info->bus_info, "bf_tun", sizeof(info->bus_info)); + case IFF_TUN: + strlcpy(info->bus_info, "tun", sizeof(info->bus_info)); break; - case TUN_TAP_DEV: + case IFF_TAP: strlcpy(info->bus_info, "tap", sizeof(info->bus_info)); break; } @@ -2339,6 +2506,56 @@ static const struct ethtool_ops tun_ethtool_ops = { .get_ts_info = ethtool_op_get_ts_info, }; +static int tun_queue_resize(struct tun_struct *tun) +{ + struct net_device *dev = tun->dev; + struct tun_file *tfile; + struct skb_array **arrays; + int n = tun->numqueues + tun->numdisabled; + int ret, i; + + arrays = kmalloc(sizeof *arrays * n, GFP_KERNEL); + if (!arrays) + return -ENOMEM; + + for (i = 0; i < tun->numqueues; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + arrays[i] = &tfile->tx_array; + } + list_for_each_entry(tfile, &tun->disabled, next) + arrays[i++] = &tfile->tx_array; + + ret = skb_array_resize_multiple(arrays, n, + dev->tx_queue_len, GFP_KERNEL); + + kfree(arrays); + return ret; +} + +static int tun_device_event(struct notifier_block *unused, + unsigned long event, void *ptr) +{ + struct net_device *dev = netdev_notifier_info_to_dev(ptr); + struct tun_struct *tun = netdev_priv(dev); + + if (dev->rtnl_link_ops != &tun_link_ops) + return NOTIFY_DONE; + + switch (event) { + case NETDEV_CHANGE_TX_QUEUE_LEN: + if (tun_queue_resize(tun)) + return NOTIFY_BAD; + break; + default: + break; + } + + return NOTIFY_DONE; +} + +static struct notifier_block tun_notifier_block __read_mostly = { + .notifier_call = tun_device_event, +}; static int __init tun_init(void) { @@ -2355,9 +2572,11 @@ static int __init tun_init(void) ret = misc_register(&tun_miscdev); if (ret) { - pr_err("Can't register misc device %d\n", (TUN_MINOR1)); + pr_err("Can't register misc device %d\n", TUN_MINOR1); goto err_misc; } + + register_netdevice_notifier(&tun_notifier_block); return 0; err_misc: rtnl_link_unregister(&tun_link_ops); @@ -2369,13 +2588,14 @@ static void tun_cleanup(void) { misc_deregister(&tun_miscdev); rtnl_link_unregister(&tun_link_ops); + unregister_netdevice_notifier(&tun_notifier_block); } /* Get an underlying socket object from tun file. Returns error unless file is * attached to a device. The returned object works like a packet socket, it * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for * holding a reference to the file for as long as the socket is in use. */ -struct socket *bf_tun_get_socket(struct file *file) +struct socket *tun_get_socket(struct file *file) { struct tun_file *tfile; if (file->f_op != &tun_fops) @@ -2385,7 +2605,7 @@ struct socket *bf_tun_get_socket(struct file *file) return ERR_PTR(-EBADFD); return &tfile->socket; } -EXPORT_SYMBOL_GPL(bf_tun_get_socket); +EXPORT_SYMBOL_GPL(tun_get_socket); module_init(tun_init); module_exit(tun_cleanup); From a1715a15e3124f2c2d716ddc333cf567ea05d759 Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Fri, 5 Oct 2018 20:33:40 +0300 Subject: [PATCH 1663/1833] Fixed FW upgrade sequence. (#2111) * Fixed FW upgrade sequence. * Removed code duplication. --- .../x86_64-mlnx_lssn2700-r0/platform_reboot | 1 + .../x86_64-mlnx_msn2010-r0/platform_reboot | 1 + .../x86_64-mlnx_msn2100-r0/platform_reboot | 1 + .../x86_64-mlnx_msn2410-r0/platform_reboot | 1 + .../x86_64-mlnx_msn2700-r0/platform_reboot | 34 ++++ .../x86_64-mlnx_msn2740-r0/platform_reboot | 1 + platform/mellanox/mlnx-fw-upgrade.j2 | 179 +++++++++++++----- 7 files changed, 166 insertions(+), 52 deletions(-) create mode 120000 device/mellanox/x86_64-mlnx_lssn2700-r0/platform_reboot create mode 120000 device/mellanox/x86_64-mlnx_msn2010-r0/platform_reboot create mode 120000 device/mellanox/x86_64-mlnx_msn2100-r0/platform_reboot create mode 120000 device/mellanox/x86_64-mlnx_msn2410-r0/platform_reboot create mode 100755 device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot create mode 120000 device/mellanox/x86_64-mlnx_msn2740-r0/platform_reboot diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/platform_reboot b/device/mellanox/x86_64-mlnx_lssn2700-r0/platform_reboot new file mode 120000 index 000000000000..43c8ea567493 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/platform_reboot @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/platform_reboot \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2010-r0/platform_reboot new file mode 120000 index 000000000000..43c8ea567493 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/platform_reboot @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/platform_reboot \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2100-r0/platform_reboot new file mode 120000 index 000000000000..43c8ea567493 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/platform_reboot @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/platform_reboot \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2410-r0/platform_reboot new file mode 120000 index 000000000000..43c8ea567493 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/platform_reboot @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/platform_reboot \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot new file mode 100755 index 000000000000..58ead6402398 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot @@ -0,0 +1,34 @@ +#!/bin/bash + +declare -r EXIT_SUCCESS="0" +declare -r EXIT_ERROR="1" + +declare -r FW_UPGRADE_SCRIPT="/usr/bin/mlnx-fw-upgrade.sh" + +FORCE_REBOOT="no" + +function ParseArguments() { + while [ $# -ge 1 ]; do + case "$1" in + -f|--force) + FORCE_REBOOT="yes" + ;; + esac + shift + done +} + +ParseArguments "$@" + +${FW_UPGRADE_SCRIPT} --upgrade +EXIT_CODE="$?" +if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then + echo "Failed to burn MLNX FW: errno=${EXIT_CODE}" + + if [[ "${FORCE_REBOOT}" != "yes" ]]; then + echo "Reboot is interrupted: use -f|--force to override" + exit "${EXIT_ERROR}" + fi +fi + +exec /sbin/reboot $@ diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2740-r0/platform_reboot new file mode 120000 index 000000000000..43c8ea567493 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/platform_reboot @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/platform_reboot \ No newline at end of file diff --git a/platform/mellanox/mlnx-fw-upgrade.j2 b/platform/mellanox/mlnx-fw-upgrade.j2 index 4e7a4a77b6aa..28df25f43ec0 100755 --- a/platform/mellanox/mlnx-fw-upgrade.j2 +++ b/platform/mellanox/mlnx-fw-upgrade.j2 @@ -1,68 +1,143 @@ #!/bin/bash -fw_required="{{ MLNX_FW_VERSION }}" -query_retry_count_max="10" -fw_file=/etc/mlnx/fw-SPC.mfa - -run_or_fail() { - $1 - if [[ $? != 0 ]]; then - echo $1 failed - exit 1 - fi +declare -r SCRIPT_NAME="$(basename "$0")" +declare -r SCRIPT_PATH="$(readlink -f "$0")" +declare -r SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" + +declare -r EXIT_SUCCESS="0" +declare -r EXIT_ERROR="1" + +declare -r QUERY_CMD="mlxfwmanager --query" +declare -r BURN_CMD="mlxfwmanager -u -f -y" + +declare -r FW_FILE="/etc/mlnx/fw-SPC.mfa" +declare -r QUERY_FILE="/tmp/mlnxfwmanager-query.txt" + +declare -r FW_REQUIRED="{{ MLNX_FW_VERSION }}" + +IMAGE_UPGRADE="no" + +function PrintHelp() { + echo + echo "Usage: ./${SCRIPT_NAME} [OPTIONS]" + echo + echo "OPTIONS:" + echo " -u, --upgrade Upgrade MLNX ASIC firmware using next boot image (useful after SONiC-To-SONiC update)" + echo " -h, --help Print help" + echo + echo "Examples:" + echo " ./${SCRIPT_NAME}" + echo " ./${SCRIPT_NAME} --upgrade" + echo " ./${SCRIPT_NAME} --help" + echo } -# wait until devices will be available -query_retry_count="0" -query_cmd="mlxfwmanager --query" -${query_cmd} > /dev/null - -while [[ (${query_retry_count} -lt ${query_retry_count_max}) && ($? -ne "0") ]]; do - sleep 1 - query_retry_count=$[${query_retry_count}+1] - ${query_cmd} > /dev/null -done - -function upgrade() { - if [ ! -z "$1" ]; then - fw_file="$1" - if [ ! -f "$fw_file" ]; then - >&2 echo "No such file: $fw_file" - exit 1 - fi +function ParseArguments() { + while [ $# -ge 1 ]; do + case "$1" in + -u|--upgrade) + IMAGE_UPGRADE="yes" + ;; + -h|--help) + PrintHelp + exit "${EXIT_SUCCESS}" + ;; + esac + shift + done +} + +function WaitForDevice() { + local -i QUERY_RETRY_COUNT_MAX="10" + local -i QUERY_RETRY_COUNT="0" + + ${QUERY_CMD} > /dev/null + + while [[ ("${QUERY_RETRY_COUNT}" -lt "${QUERY_RETRY_COUNT_MAX}") && ("$?" -ne "0") ]]; do + sleep 1s + ((QUERY_RETRY_COUNT++)) + ${QUERY_CMD} > /dev/null + done +} + +function RunCmd() { + $1 + if [[ $? != 0 ]]; then + echo "Command failed: cmd=$1, errno=$?" + exit "${EXIT_ERROR}" + fi +} + +function UpgradeFW() { + local _FW_FILE="$1" - run_or_fail "${query_cmd} -i ${fw_file}" > /tmp/mlnxfwmanager-query.txt + if [ ! -z "${_FW_FILE}" ]; then + if [ ! -f "${_FW_FILE}" ]; then + echo "No such file: ${_FW_FILE}" + exit "${EXIT_ERROR}" + fi - # get current firmware version and available version from $fw_file - fw_info=$(grep FW /tmp/mlnxfwmanager-query.txt) - fw_current=$(echo $fw_info | cut -f2 -d' ') - fw_available=$(echo $fw_info | cut -f3 -d' ') + RunCmd "${QUERY_CMD} -i ${_FW_FILE}" > "${QUERY_FILE}" - fw_required=$fw_available + local -r _FW_INFO="$(grep FW ${QUERY_FILE})" + local -r _FW_CURRENT="$(echo ${_FW_INFO} | cut -f2 -d' ')" + local -r _FW_AVAILABLE="$(echo ${_FW_INFO} | cut -f3 -d' ')" else - run_or_fail "${query_cmd}" > /tmp/mlnxfwmanager-query.txt + RunCmd "${QUERY_CMD}" > "${QUERY_FILE}" + + local -r _FW_INFO="$(grep FW ${QUERY_FILE})" + local -r _FW_CURRENT="$(echo ${_FW_INFO} | cut -f2 -d' ')" + local -r _FW_AVAILABLE="${FW_REQUIRED}" + + _FW_FILE="${FW_FILE}" + fi - # get current firmware version and required version - fw_info=$(grep FW /tmp/mlnxfwmanager-query.txt) - fw_current=$(echo $fw_info | cut -f2 -d' ') + if [[ -z "${_FW_CURRENT}" ]]; then + echo "Could not retreive current FW version" + exit "${EXIT_ERROR}" fi - - if [[ -z ${fw_current} ]]; then - echo "Could not retreive current FW version." - exit 1 + + if [[ -z "${_FW_AVAILABLE}" ]]; then + echo "Could not retreive available FW version" + exit "${EXIT_ERROR}" fi - - if [[ -z ${fw_required} ]]; then - echo "Could not retreive required FW version." - exit 1 + + if [[ "${_FW_CURRENT}" == "${_FW_AVAILABLE}" ]]; then + echo "Mellanox firmware is up to date" + else + echo "Mellanox firmware upgrade is required. Installing compatible version..." + RunCmd "${BURN_CMD} -i ${_FW_FILE}" fi - - if [[ ${fw_current} == ${fw_required} ]]; then - echo "Mellanox firmware is up to date." +} + +function UpgradeFWFromImage() { + local -r _NEXT_SONIC_IMAGE="$(sonic_installer list | grep "Next: " | cut -f2 -d' ')" + local -r _CURRENT_SONIC_IMAGE="$(sonic_installer list | grep "Current: " | cut -f2 -d' ')" + + local -r _FS_PATH="/host/image-${_NEXT_SONIC_IMAGE#SONiC-OS-}/fs.squashfs" + local -r _FS_MOUNTPOINT="/tmp/image-${_NEXT_SONIC_IMAGE#SONiC-OS-}-fs" + + if [[ "${_CURRENT_SONIC_IMAGE}" == "${_NEXT_SONIC_IMAGE}" ]]; then + echo "Mellanox firmware is up to date" else - echo "Mellanox firmware required version is ${fw_required}. Installing compatible version..." - run_or_fail "mlxfwmanager -i ${fw_file} -u -f -y" + mkdir -p "${_FS_MOUNTPOINT}" + mount -t squashfs "${_FS_PATH}" "${_FS_MOUNTPOINT}" + + UpgradeFW "${_FS_MOUNTPOINT}/etc/mlnx/fw-SPC.mfa" + + umount -rf "${_FS_MOUNTPOINT}" + rm -rf "${_FS_MOUNTPOINT}" fi } -upgrade "$1" +ParseArguments "$@" + +WaitForDevice + +if [ "${IMAGE_UPGRADE}" != "yes" ]; then + UpgradeFW +else + UpgradeFWFromImage +fi + +exit "${EXIT_SUCCESS}" From 62fa79e4d75f05f69b9fbb681a41875306aa272f Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 6 Oct 2018 11:19:42 -0700 Subject: [PATCH 1664/1833] [submodule]: update sonic-linux-kernel (#2127) 3107549 2018-10-06 | uart: fix race between uart_put_char() and uart_shutdown() (#67) (azure/master) [lguohan] 95db35e 2018-10-02 | [mellanox]: Update kernel with the latest upstream patches. (#62) [sholeksandr] Signed-off-by: Guohan Lu --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 90c4cdb3be1a..3107549d4727 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 90c4cdb3be1a70be21abbaa92e15c01cd24164af +Subproject commit 3107549d4727d382d5588372114f6863aad424cd From b1d290c74615b0fc742ec8dcc90808654f66ce88 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sat, 6 Oct 2018 18:41:37 +0000 Subject: [PATCH 1665/1833] update build to 201803 and 201807 Signed-off-by: Guohan Lu --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 548fca5ab96e..8959b0d0fbed 100644 --- a/README.md +++ b/README.md @@ -6,21 +6,21 @@ Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/j P4: [![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all) VS: [![VS](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all) -*201712*: -Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201712/) -Barefoot: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-201712/) -Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201712/) -Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201712/) -Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201712/) -Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201712/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201712/) - -*201709*: -Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201709/) -Cavium: [![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-201709/) -Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201709/) -Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201709/) -Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201709/) -Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201709/) +*201807*: +Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201807/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201807/) +Barefoot: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-201807/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-201807/) +Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201807/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201807/) +Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201807/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201807/) +Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201807/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201807/) +Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201807/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201807/) + +*201803*: +Broadcom: [![Broadcom](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201803/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-201803/) +Cavium: [![Cavium](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-201803/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/cavium/job/buildimage-cavm-201803/) +Centec: [![Centec](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201803/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/centec/job/buildimage-centec-201803/) +Nephos: [![Nephos](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201803/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/nephos/job/buildimage-nephos-201803/) +Marvell: [![Marvell](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201803/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/marvell/job/buildimage-mrvl-201803/) +Mellanox: [![Mellanox](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201803/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-201803/) # sonic-buildimage From ea4b4bd650f825b745959f767aa2140c42ffe453 Mon Sep 17 00:00:00 2001 From: "Kevin(Shengkai) Wang" Date: Tue, 9 Oct 2018 09:33:44 +0800 Subject: [PATCH 1666/1833] [mellanox]: Update recipe for hw-mgmt according to latest changes (#2128) Update the hw-mgmt to latest release V.2.0.0060. Update the related files according to the latest hw-mgmt. Signed-off-by: Kevin Wang --- .../x86_64-mlnx_msn2010-r0/plugins/sfputil.py | 2 +- .../x86_64-mlnx_msn2100-r0/plugins/sfputil.py | 2 +- .../x86_64-mlnx_msn2410-r0/plugins/sfputil.py | 2 +- .../x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 2 +- .../x86_64-mlnx_msn2740-r0/plugins/sfputil.py | 2 +- files/build_templates/updategraph.service.j2 | 2 +- files/scripts/syncd.sh | 2 - platform/mellanox/hw-management.mk | 2 +- .../Add-modprobe-config-for-at24-module.patch | 21 ------- .../Add-systemd-service-config.patch | 58 ------------------- ...x-system-EEPROM-for-MSN2740-platform.patch | 25 -------- platform/mellanox/hw-management/hw-mgmt | 2 +- 12 files changed, 8 insertions(+), 114 deletions(-) delete mode 100644 platform/mellanox/hw-management/Add-modprobe-config-for-at24-module.patch delete mode 100644 platform/mellanox/hw-management/Add-systemd-service-config.patch delete mode 100644 platform/mellanox/hw-management/Fix-system-EEPROM-for-MSN2740-platform.patch diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py index 77831b54d2fd..053b591b70fb 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py @@ -49,7 +49,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/bsp/qsfp/qsfp{0}" + eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py index a4eda6edfe39..d534386e2fbe 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py @@ -49,7 +49,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon4/qsfp{0}_eeprom" + eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py index 8bd4ba789168..bc61073ba10b 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py @@ -49,7 +49,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon7/qsfp{0}_eeprom" + eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) 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 11a5bdcb02b6..f85fcc4d9040 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -49,7 +49,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon7/qsfp{0}_eeprom" + eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py index f84cefc67268..f85fcc4d9040 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py @@ -49,7 +49,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0048/hwmon/hwmon6/qsfp{0}_eeprom" + eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) diff --git a/files/build_templates/updategraph.service.j2 b/files/build_templates/updategraph.service.j2 index 8039f42531cd..e01fd0146f98 100644 --- a/files/build_templates/updategraph.service.j2 +++ b/files/build_templates/updategraph.service.j2 @@ -4,7 +4,7 @@ After=rc-local.service After=database.service Requires=database.service {% if sonic_asic_platform == 'mellanox' -%} -Requires=hw-management.service +Requires=msn-chassis.service {% endif -%} diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index ad3ddd164cde..b7d23209557f 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -74,7 +74,6 @@ start() { /usr/bin/mlnx-fw-upgrade.sh /etc/init.d/sxdkernel start /sbin/modprobe i2c-dev - /etc/mlnx/mlnx-hw-management start elif [ x$sonic_asic_platform == x'cavium' ]; then /etc/init.d/xpnet.sh start fi @@ -115,7 +114,6 @@ stop() { if [[ x"$WARM_BOOT" != x"true" ]]; then # platform specific tasks if [ x$sonic_asic_platform == x'mellanox' ]; then - /etc/mlnx/mlnx-hw-management stop /etc/init.d/sxdkernel stop /usr/bin/mst stop elif [ x$sonic_asic_platform == x'cavium' ]; then diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index cd457181268f..10e6bcd76652 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,6 +1,6 @@ # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = onl.deb9.13.12.2017 +MLNX_HW_MANAGEMENT_VERSION = 27.09.2018 export MLNX_HW_MANAGEMENT_VERSION diff --git a/platform/mellanox/hw-management/Add-modprobe-config-for-at24-module.patch b/platform/mellanox/hw-management/Add-modprobe-config-for-at24-module.patch deleted file mode 100644 index 37d57da4e937..000000000000 --- a/platform/mellanox/hw-management/Add-modprobe-config-for-at24-module.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 2f70f5df445820fb86e3bd7f95707e0fb97b553f Mon Sep 17 00:00:00 2001 -From: Volodymyr Samotiy -Date: Thu, 16 Aug 2018 17:21:37 +0300 -Subject: Add modprobe config for "at24" module - -Signed-off-by: Volodymyr Samotiy ---- - usr/etc/modprobe.d/mellanox-system-whitelist.conf | 1 + - 1 file changed, 1 insertion(+) - create mode 100644 usr/etc/modprobe.d/mellanox-system-whitelist.conf - -diff --git a/usr/etc/modprobe.d/mellanox-system-whitelist.conf b/usr/etc/modprobe.d/mellanox-system-whitelist.conf -new file mode 100644 -index 0000000..a3eef57 ---- /dev/null -+++ b/usr/etc/modprobe.d/mellanox-system-whitelist.conf -@@ -0,0 +1 @@ -+options at24 io_limit=32 --- -1.9.1 - diff --git a/platform/mellanox/hw-management/Add-systemd-service-config.patch b/platform/mellanox/hw-management/Add-systemd-service-config.patch deleted file mode 100644 index ce16bb712ee1..000000000000 --- a/platform/mellanox/hw-management/Add-systemd-service-config.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 22fef644b1150677353ab0559828ea45a982d901 Mon Sep 17 00:00:00 2001 -From: Andriy Moroz -Date: Wed, 11 Jul 2018 16:51:07 +0300 -Subject: [PATCH] Add systemd service config - -Signed-off-by: Andriy Moroz ---- - debian/control | 2 +- - debian/hw-management.service | 10 ++++++++++ - debian/rules | 2 +- - 3 files changed, 12 insertions(+), 2 deletions(-) - create mode 100644 debian/hw-management.service - -diff --git a/debian/control b/debian/control -index 048cd61..7e3a545 100644 ---- a/debian/control -+++ b/debian/control -@@ -1,7 +1,7 @@ - Source: hw-management - Priority: extra - Maintainer: MellanoxBSP --Build-Depends: -+Build-Depends: dh-systemd - Standards-Version: - Section: libs - Homepage: http://www.mellanox.com -diff --git a/debian/hw-management.service b/debian/hw-management.service -new file mode 100644 -index 0000000..d18916d ---- /dev/null -+++ b/debian/hw-management.service -@@ -0,0 +1,10 @@ -+[Unit] -+Description=Mellanox Hardware Management -+ -+[Service] -+Type=oneshot -+EnvironmentFile=/host/machine.conf -+ExecStart=/bin/bash -c "/etc/mlnx/mlnx-hw-management start" -+ -+[Install] -+WantedBy=multi-user.target -diff --git a/debian/rules b/debian/rules -index fc38817..fba4150 100755 ---- a/debian/rules -+++ b/debian/rules -@@ -8,7 +8,7 @@ K_SRC ?= "/lib/modules/$(KVERSION)/build" - pwd=$(shell pwd) - - %: -- dh $@ -+ dh $@ --with systemd - - override_dh_auto_configure: - --- -1.9.1 - diff --git a/platform/mellanox/hw-management/Fix-system-EEPROM-for-MSN2740-platform.patch b/platform/mellanox/hw-management/Fix-system-EEPROM-for-MSN2740-platform.patch deleted file mode 100644 index 5519692e12ed..000000000000 --- a/platform/mellanox/hw-management/Fix-system-EEPROM-for-MSN2740-platform.patch +++ /dev/null @@ -1,25 +0,0 @@ -From cebfa8338c2e5953a097de2a776bb680e7a34410 Mon Sep 17 00:00:00 2001 -From: Volodymyr Samotiy -Date: Fri, 17 Aug 2018 13:27:16 +0300 -Subject: Fix system EEPROM for MSN2740 platform - -Signed-off-by: Volodymyr Samotiy ---- - usr/etc/mlnx/mlnx-hw-management | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/usr/etc/mlnx/mlnx-hw-management b/usr/etc/mlnx/mlnx-hw-management -index 54cdd30..4f0d265 100755 ---- a/usr/etc/mlnx/mlnx-hw-management -+++ b/usr/etc/mlnx/mlnx-hw-management -@@ -107,6 +107,7 @@ msn2740_connect_table=( mlxsw_minimal 0x48 2 \ - max11603 0x64 5 \ - tmp102 0x49 6 \ - tmp102 0x48 7 \ -+ 24c32 0x51 8 \ - max11603 0x6d 15 \ - 24c32 0x51 16) - --- -1.9.1 - diff --git a/platform/mellanox/hw-management/hw-mgmt b/platform/mellanox/hw-management/hw-mgmt index ff83e6490d5c..344e81942c02 160000 --- a/platform/mellanox/hw-management/hw-mgmt +++ b/platform/mellanox/hw-management/hw-mgmt @@ -1 +1 @@ -Subproject commit ff83e6490d5c36fff6bfb17781119b52e234f5f6 +Subproject commit 344e81942c02c279db03c3aba40db4142dc6817d From f047756d7bb4b10eebf3b2636a9a256fedf3b1f9 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 8 Oct 2018 18:36:37 -0700 Subject: [PATCH 1667/1833] [image config] Install Python tabulate library v0.8.2 via pip (#2130) --- files/build_templates/sonic_debian_extension.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 9217e77bff68..bb1631abd147 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -102,6 +102,9 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-click*_all.deb || \ # using pip install instead to get a more recent version than is available through debian sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install pexpect +# Install tabulate >= 0.8.1 via pip in order to support multi-line row output for sonic-utilities +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install tabulate==0.8.2 + # Install SONiC Utilities (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f From a6fb0602e8c2f1c39dc99349fbec124c52e1aeec Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Tue, 9 Oct 2018 18:50:56 -0700 Subject: [PATCH 1668/1833] sonic-swss-common update for Vnet tables (#2133) --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 882d899fa1ef..35b003dda673 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 882d899fa1ef0b65114454d9e92b27bfde998055 +Subproject commit 35b003dda6731810bb6564af707da5bc39a4b5c8 From 794981f283274e17f39f9bff709f6a818f4e557e Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 9 Oct 2018 23:43:31 -0700 Subject: [PATCH 1669/1833] [submodule]: update broadcom SAI to 3.1.3.5-11 (#2135) disable vxlan init for helix4 Signed-off-by: Guohan Lu --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 55e0e0631e3a..980b5775dba9 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.1.3.5-10_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm_3.1.3.5-10_amd64.deb?sv=2015-04-05&sr=b&sig=knKdBT4t%2B%2F8JvPe5wfCJPsJ1JU1kSsCBzMBFQHtXoAg%3D&se=2032-05-30T19%3A33%3A41Z&sp=r" +BRCM_SAI = libsaibcm_3.1.3.5-11_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm_3.1.3.5-11_amd64.deb?sv=2015-04-05&sr=b&sig=gATwARdB%2FH42%2FUYDirrHcqXzGfSDq79IP4LMVgjUuo0%3D&se=2155-09-02T04%3A33%3A51Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-10_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-11_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-10_amd64.deb?sv=2015-04-05&sr=b&sig=aYTN5yyq9dy4uz%2FctVXhuG9qqLs%2FefT4lJFmheRAk7I%3D&se=2032-05-30T19%3A34%3A34Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-11_amd64.deb?sv=2015-04-05&sr=b&sig=YE%2BCpURwLGSzE8qBVandbERncFUkm5CEvCdMB9YrKZM%3D&se=2155-09-02T02%3A43%3A51Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 96eac8f099cd3ea0d49e4e1f4f0169b5b8cd4895 Mon Sep 17 00:00:00 2001 From: juntseng62 <37563687+juntseng62@users.noreply.github.com> Date: Thu, 11 Oct 2018 09:33:51 +0800 Subject: [PATCH 1670/1833] [devices]: Add snh60b0-640f device (Tomhawk2) & snh60a0-320fv2 device 32x100G (Tomhawk) (#2129) * [platform]:add platfrom snh60a0-320fv2 & snh60b0-640f * [device]:add platfrom snh60a0-320fv2 & snh60b0-640f * remove minigraph.xml for snh60a0_320fv2-r0 and snh60b0_640f-r0 platform --- .../port_config.ini | 33 + .../Alphanetworks-SNH60A0-320FV2/sai.profile | 1 + .../th-snh60a0-32x100G.config.bcm | 163 ++ .../default_sku | 1 + .../fancontrol | 9 + .../installer.conf | 3 + .../led_proc_init.soc | 45 + .../plugins/eeprom.py | 24 + .../plugins/led_control.py | 255 ++ .../plugins/psuutil.py | 66 + .../plugins/sfputil.py | 116 + .../sensors.conf | 17 + .../port_config.ini | 67 + .../Alphanetworks-SNH60B0-640F/sai.profile | 1 + .../th2-snh60b0-64x100G.config.bcm | 535 +++++ .../default_sku | 1 + .../fancontrol | 9 + .../installer.conf | 3 + .../led_proc_init.soc | 111 + .../plugins/eeprom.py | 24 + .../plugins/led_control.py | 217 ++ .../plugins/psuutil.py | 66 + .../plugins/sfputil.py | 132 ++ .../sensors.conf | 13 + platform/broadcom/one-image.mk | 4 +- .../platform-modules-alphanetworks.mk | 21 + platform/broadcom/rules.mk | 1 + .../.gitignore | 50 + .../README.md | 1 + .../debian/changelog | 6 + .../debian/compat | 1 + .../debian/control | 17 + .../debian/rules | 86 + .../snh60a0-320fv2/classes/__init__.py | 0 .../snh60a0-320fv2/modules/Makefile | 8 + .../alphanetworks_snh60a0-320fv2_sfp.c | 1669 +++++++++++++ .../modules/snh60a0_onie_eeprom.c | 268 +++ .../modules/snh60a0_power_cpld.c | 507 ++++ .../modules/snh60a0_system_cpld.c | 380 +++ .../service/snh60a0-platform-init.service | 13 + .../snh60a0-320fv2/setup.py | 16 + .../utils/alphanetworks_snh60a0_util.py | 399 ++++ .../snh60b0-640f/classes/__init__.py | 0 .../snh60b0-640f/modules/Makefile | 8 + .../modules/alphanetworks_snh60b0-640f_sfp.c | 2076 +++++++++++++++++ .../modules/snh60b0-640f_onie_eeprom.c | 268 +++ .../modules/snh60b0-640f_power_cpld.c | 501 ++++ .../modules/snh60b0-640f_system_cpld.c | 365 +++ .../service/snh60b0-platform-init.service | 13 + .../snh60b0-640f/setup.py | 16 + .../utils/alphanetworks_snh60b0_util.py | 427 ++++ 51 files changed, 9032 insertions(+), 1 deletion(-) create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/port_config.ini create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/sai.profile create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/th-snh60a0-32x100G.config.bcm create mode 100755 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/default_sku create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/fancontrol create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/installer.conf create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/led_proc_init.soc create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/eeprom.py create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/psuutil.py create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/sfputil.py create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/sensors.conf create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/port_config.ini create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/sai.profile create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/th2-snh60b0-64x100G.config.bcm create mode 100755 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/default_sku create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/fancontrol create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/installer.conf create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/led_proc_init.soc create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/eeprom.py create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/psuutil.py create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/sfputil.py create mode 100644 device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/sensors.conf create mode 100644 platform/broadcom/platform-modules-alphanetworks.mk create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/.gitignore create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/README.md create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/debian/changelog create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/debian/compat create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/debian/control create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/classes/__init__.py create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/alphanetworks_snh60a0-320fv2_sfp.c create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_onie_eeprom.c create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_power_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_system_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/service/snh60a0-platform-init.service create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/utils/alphanetworks_snh60a0_util.py create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/classes/__init__.py create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/Makefile create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/alphanetworks_snh60b0-640f_sfp.c create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_onie_eeprom.c create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_power_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_system_cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/service/snh60b0-platform-init.service create mode 100644 platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/utils/alphanetworks_snh60b0_util.py diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/port_config.ini b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/port_config.ini new file mode 100644 index 000000000000..745cc69428b4 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index speed +Ethernet0 33,34,35,36 Ethernet1/0/1 0 100000 +Ethernet4 37,38,39,40 Ethernet1/0/5 1 100000 +Ethernet8 41,42,43,44 Ethernet1/0/9 2 100000 +Ethernet12 45,46,47,48 Ethernet1/0/13 3 100000 +Ethernet16 49,50,51,52 Ethernet1/0/17 4 100000 +Ethernet20 53,54,55,56 Ethernet1/0/21 5 100000 +Ethernet24 57,58,59,60 Ethernet1/0/25 6 100000 +Ethernet28 61,62,63,64 Ethernet1/0/29 7 100000 +Ethernet32 65,66,67,68 Ethernet1/0/33 8 100000 +Ethernet36 69,70,71,72 Ethernet1/0/37 9 100000 +Ethernet40 73,74,75,76 Ethernet1/0/41 10 100000 +Ethernet44 77,78,79,80 Ethernet1/0/45 11 100000 +Ethernet48 81,82,83,84 Ethernet1/0/49 12 100000 +Ethernet52 85,86,87,88 Ethernet1/0/53 13 100000 +Ethernet56 89,90,91,92 Ethernet1/0/57 14 100000 +Ethernet60 93,94,95,96 Ethernet1/0/61 15 100000 +Ethernet64 97,98,99,100 Ethernet1/0/65 16 100000 +Ethernet68 101,102,103,104 Ethernet1/0/69 17 100000 +Ethernet72 105,106,107,108 Ethernet1/0/73 18 100000 +Ethernet76 109,110,111,112 Ethernet1/0/77 19 100000 +Ethernet80 113,114,115,116 Ethernet1/0/81 20 100000 +Ethernet84 117,118,119,120 Ethernet1/0/85 21 100000 +Ethernet88 121,122,123,124 Ethernet1/0/89 22 100000 +Ethernet92 125,126,127,128 Ethernet1/0/93 23 100000 +Ethernet96 1,2,3,4 Ethernet1/0/97 24 100000 +Ethernet100 5,6,7,8 Ethernet1/0/101 25 100000 +Ethernet104 9,10,11,12 Ethernet1/0/105 26 100000 +Ethernet108 13,14,15,16 Ethernet1/0/109 27 100000 +Ethernet112 17,18,19,20 Ethernet1/0/113 28 100000 +Ethernet116 21,22,23,24 Ethernet1/0/117 29 100000 +Ethernet120 25,26,27,28 Ethernet1/0/121 30 100000 +Ethernet124 29,30,31,32 Ethernet1/0/125 31 100000 \ No newline at end of file diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/sai.profile b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/sai.profile new file mode 100644 index 000000000000..b6e792ad0a18 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-snh60a0-32x100G.config.bcm diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/th-snh60a0-32x100G.config.bcm b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/th-snh60a0-32x100G.config.bcm new file mode 100644 index 000000000000..395827122e16 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/Alphanetworks-SNH60A0-320FV2/th-snh60a0-32x100G.config.bcm @@ -0,0 +1,163 @@ +# This property file is for ZION-320F 100G mode only. +# Zion-320F uses Tomahawk BCM56960 as its mac. Besides, it is phyless. +# Note: The settings in this file are not verified yet. + + + +# Set stat collection interval in microseconds. +# Setting this to 0 will prevent counters from being started. +bcm_stat_interval.0=1000000 + +# Linkscan interval in microseconds. +# If non-zero, bcm_init() will start linkscan +bcm_linkscan_interval.0=450000 + + + +# BCM56960 : MMU Cell Buffer Allocation Profile to support ASF (cut-thru) Forwarding +# 0: No cut-through support +# 1: Similar speed profile (Default) +# 2: Extreme speed profile + +os=unix + + + +# EagleCore ports +#portmap_66=129:10 +#portmap_100=131:10 + +# Loopback ports +portmap_33=132:10 +portmap_67=133:10 +portmap_101=134:10 +portmap_135=135:10 + +#FalconCore[0 - 7] must map to logical port[1 - 32] +portmap_1=1:100 +portmap_2=5:100 +portmap_3=9:100 +portmap_4=13:100 +portmap_5=17:100 +portmap_6=21:100 +portmap_7=25:100 +portmap_8=29:100 +#FalconCore[8 - 15] must map to logical port[34 - 65] +portmap_34=33:100 +portmap_35=37:100 +portmap_36=41:100 +portmap_37=45:100 +portmap_38=49:100 +portmap_39=53:100 +portmap_40=57:100 +portmap_41=61:100 +#FalconCore[16 - 23] must map to logical port[68 - 99] +portmap_68=65:100 +portmap_69=69:100 +portmap_70=73:100 +portmap_71=77:100 +portmap_72=81:100 +portmap_73=85:100 +portmap_74=89:100 +portmap_75=93:100 +#FalconCore[24 - 31] must map to logical port[102 - 133] +portmap_102=97:100 +portmap_103=101:100 +portmap_104=105:100 +portmap_105=109:100 +portmap_106=113:100 +portmap_107=117:100 +portmap_108=121:100 +portmap_109=125:100 + +pbmp_xport_xe=0x3fd000000ff4000003fc000001fe +pbmp_oversubscribe=0x0000000000000000000000000000000000003fc000000ff0000003fc000001fe + + + +#core-0 +xgxs_rx_lane_map_ce0=0x3012 +xgxs_rx_lane_map_ce1=0x1230 +xgxs_rx_lane_map_ce2=0x3012 +xgxs_rx_lane_map_ce3=0x1230 +xgxs_rx_lane_map_ce4=0x1230 +xgxs_rx_lane_map_ce5=0x1230 +xgxs_rx_lane_map_ce6=0x1230 +xgxs_rx_lane_map_ce7=0x1230 + +#core-8 +xgxs_rx_lane_map_ce8=0x1032 +xgxs_rx_lane_map_ce9=0x1230 +xgxs_rx_lane_map_ce10=0x1032 +xgxs_rx_lane_map_ce11=0x1230 +xgxs_rx_lane_map_ce12=0x1230 +xgxs_rx_lane_map_ce13=0x3012 +xgxs_rx_lane_map_ce14=0x1230 +xgxs_rx_lane_map_ce15=0x3012 + +#core-16 +xgxs_rx_lane_map_ce16=0x3012 +xgxs_rx_lane_map_ce17=0x3012 +xgxs_rx_lane_map_ce18=0x1230 +xgxs_rx_lane_map_ce19=0x3012 +xgxs_rx_lane_map_ce20=0x3012 +xgxs_rx_lane_map_ce21=0x3012 +xgxs_rx_lane_map_ce22=0x3012 +xgxs_rx_lane_map_ce23=0x3012 + +#core-24 +xgxs_rx_lane_map_ce24=0x3210 +xgxs_rx_lane_map_ce25=0x3012 +xgxs_rx_lane_map_ce26=0x3210 +xgxs_rx_lane_map_ce27=0x3012 +xgxs_rx_lane_map_ce28=0x3012 +xgxs_rx_lane_map_ce29=0x1230 +xgxs_rx_lane_map_ce30=0x3012 +xgxs_rx_lane_map_ce31=0x3012 + +# +# Remap XGXS tx lanes to desired mapping by hardware provide. +#core-0 +xgxs_tx_lane_map_ce0=0x3210 +xgxs_tx_lane_map_ce1=0x1032 +xgxs_tx_lane_map_ce2=0x3210 +xgxs_tx_lane_map_ce3=0x1032 +xgxs_tx_lane_map_ce4=0x3210 +xgxs_tx_lane_map_ce5=0x3210 +xgxs_tx_lane_map_ce6=0x3210 +xgxs_tx_lane_map_ce7=0x1230 + +#core-8 +xgxs_tx_lane_map_ce8=0x2301 +xgxs_tx_lane_map_ce9=0x3210 +xgxs_tx_lane_map_ce10=0x2301 +xgxs_tx_lane_map_ce11=0x3210 +xgxs_tx_lane_map_ce12=0x0123 +xgxs_tx_lane_map_ce13=0x3210 +xgxs_tx_lane_map_ce14=0x0123 +xgxs_tx_lane_map_ce15=0x3210 + +#core-16 +xgxs_tx_lane_map_ce16=0x2301 +xgxs_tx_lane_map_ce17=0x3210 +xgxs_tx_lane_map_ce18=0x0123 +xgxs_tx_lane_map_ce19=0x1032 +xgxs_tx_lane_map_ce20=0x0123 +xgxs_tx_lane_map_ce21=0x1032 +xgxs_tx_lane_map_ce22=0x0123 +xgxs_tx_lane_map_ce23=0x1032 + +#core-24 +xgxs_tx_lane_map_ce24=0x1032 +xgxs_tx_lane_map_ce25=0x1032 +xgxs_tx_lane_map_ce26=0x1032 +xgxs_tx_lane_map_ce27=0x1032 +xgxs_tx_lane_map_ce28=0x1032 +xgxs_tx_lane_map_ce29=0x1032 +xgxs_tx_lane_map_ce30=0x3210 +xgxs_tx_lane_map_ce31=0x3210 + + + +ptp_ts_pll_fref=25000000 +ptp_bs_fref=25000000 diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/default_sku b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/default_sku new file mode 100755 index 000000000000..588c4a951df7 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/default_sku @@ -0,0 +1 @@ +Alphanetworks-SNH60A0-320FV2 t1 diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/fancontrol b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/fancontrol new file mode 100644 index 000000000000..24184113d2be --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/fancontrol @@ -0,0 +1,9 @@ +INTERVAL=10 +FCTEMPS=/sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/4-004d/hwmon/hwmon3/temp1_input +FCFANS=/sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan1_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan2_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan3_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan4_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan5_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan6_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan11_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan12_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan13_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan14_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan15_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan16_input +MINTEMP=/sys/bus/i2c/devices/0-005e/fan_pwm=50 +MAXTEMP=/sys/bus/i2c/devices/0-005e/fan_pwm=70 +MINSTART=/sys/bus/i2c/devices/0-005e/fan_pwm=100 +MINSTOP=/sys/bus/i2c/devices/0-005e/fan_pwm=100 +MINPWM=/sys/bus/i2c/devices/0-005e/fan_pwm=100 +MAXPWM=/sys/bus/i2c/devices/0-005e/fan_pwm=200 \ No newline at end of file diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/installer.conf b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/led_proc_init.soc b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/led_proc_init.soc new file mode 100644 index 000000000000..c05dbe3326f9 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/led_proc_init.soc @@ -0,0 +1,45 @@ +# LED microprocessor initialization for alphanetworks snh60a0-320fv2 + +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=31 REMAP_PORT_1=30 REMAP_PORT_2=29 REMAP_PORT_3=28 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=27 REMAP_PORT_5=26 REMAP_PORT_6=25 REMAP_PORT_7=24 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=23 REMAP_PORT_9=22 REMAP_PORT_10=21 REMAP_PORT_11=20 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=19 REMAP_PORT_13=18 REMAP_PORT_14=17 REMAP_PORT_15=16 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=15 REMAP_PORT_17=14 REMAP_PORT_18=13 REMAP_PORT_19=12 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=11 REMAP_PORT_21=10 REMAP_PORT_22=9 REMAP_PORT_23=8 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=7 REMAP_PORT_25=6 REMAP_PORT_26=5 REMAP_PORT_27=4 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=3 REMAP_PORT_29=2 REMAP_PORT_30=1 REMAP_PORT_31=0 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=63 REMAP_PORT_33=62 REMAP_PORT_34=61 REMAP_PORT_35=60 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=59 REMAP_PORT_37=58 REMAP_PORT_38=57 REMAP_PORT_39=56 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=55 REMAP_PORT_41=54 REMAP_PORT_42=53 REMAP_PORT_43=52 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=51 REMAP_PORT_45=50 REMAP_PORT_46=49 REMAP_PORT_47=48 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=47 REMAP_PORT_49=46 REMAP_PORT_50=45 REMAP_PORT_51=44 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=43 REMAP_PORT_53=42 REMAP_PORT_54=41 REMAP_PORT_55=40 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=39 REMAP_PORT_57=38 REMAP_PORT_58=37 REMAP_PORT_59=36 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=35 REMAP_PORT_61=34 REMAP_PORT_62=33 REMAP_PORT_63=32 + +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=3 REMAP_PORT_1=2 REMAP_PORT_2=1 REMAP_PORT_3=0 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=7 REMAP_PORT_5=6 REMAP_PORT_6=5 REMAP_PORT_7=4 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=11 REMAP_PORT_9=10 REMAP_PORT_10=9 REMAP_PORT_11=8 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=15 REMAP_PORT_13=14 REMAP_PORT_14=13 REMAP_PORT_15=12 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=19 REMAP_PORT_17=18 REMAP_PORT_18=17 REMAP_PORT_19=16 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=23 REMAP_PORT_21=22 REMAP_PORT_22=21 REMAP_PORT_23=20 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=27 REMAP_PORT_25=26 REMAP_PORT_26=25 REMAP_PORT_27=24 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=31 REMAP_PORT_29=30 REMAP_PORT_30=29 REMAP_PORT_31=28 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=35 REMAP_PORT_33=34 REMAP_PORT_34=33 REMAP_PORT_35=32 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=39 REMAP_PORT_37=38 REMAP_PORT_38=37 REMAP_PORT_39=36 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=43 REMAP_PORT_41=42 REMAP_PORT_42=41 REMAP_PORT_43=40 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=47 REMAP_PORT_45=46 REMAP_PORT_46=45 REMAP_PORT_47=44 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 REMAP_PORT_49=50 REMAP_PORT_50=49 REMAP_PORT_51=48 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 REMAP_PORT_53=54 REMAP_PORT_54=53 REMAP_PORT_55=52 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 REMAP_PORT_57=58 REMAP_PORT_58=57 REMAP_PORT_59=56 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=62 REMAP_PORT_62=61 REMAP_PORT_63=60 + +led 0 stop +led 0 prog 2A 01 86 FF 06 FF C2 7F 60 FF 02 20 60 FE 67 2E 06 FE F2 04 60 FE D2 40 74 0E 70 1C 02 00 60 FE 67 2E 06 FE F2 04 60 FE D2 20 74 20 70 70 02 A0 F6 FE 04 D2 01 70 39 74 5F 06 FE 28 32 00 32 01 B7 97 71 46 75 4E 06 FF C2 04 74 4E 70 5F 67 76 67 72 67 76 67 76 67 76 67 76 67 76 67 76 57 67 76 67 76 67 76 67 76 67 76 67 76 67 76 67 76 57 3A 80 32 0E 87 57 32 0F 87 57 +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 2A 01 86 FF 06 FF C2 7F 60 FF 02 00 60 FE 67 1C 06 FE F2 04 60 FE D2 40 74 0E 70 5E 02 A0 F6 FE 04 D2 01 70 27 74 4D 06 FE 28 32 00 32 01 B7 97 71 34 75 3C 06 FF C2 04 74 3C 70 4D 67 64 67 60 67 64 67 64 67 64 67 64 67 64 67 64 57 67 64 67 64 67 64 67 64 67 64 67 64 67 64 67 64 57 3A 80 32 0E 87 57 32 0F 87 57 +led 1 auto on +led 1 start diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/eeprom.py b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/eeprom.py new file mode 100644 index 000000000000..c0122e65844a --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom" + #Two i2c buses might get flipped order, check them both. + if not os.path.exists(self.eeprom_path): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py new file mode 100644 index 000000000000..bab96d69dc47 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py @@ -0,0 +1,255 @@ +#!/usr/bin/env python +# +# led_control.py +# +# Platform-specific LED control functionality for SONiC +# + +# try: +# from sonic_led.led_control_base import LedControlBase +# import swsssdk +# except ImportError, e: +# raise ImportError (str(e) + " - required module not found") + +import time + +class LedControlBase(object): +# __metaclass__ = abc.ABCMeta + +# @abc.abstractmethod + def port_link_state_change(self, port, state): + """ + Called when port link state changes. Update port link state LED here. + + :param port: A string, SONiC port name (e.shg., "Ethernet0") + :param state: A string, the port link state (either "up" or "down") + """ + return + +### Zion specified ### +read_fan_fault = 0 +is_fan_all_OK = 0 +read_power_status = 0 +is_power_all_OK = 0 +is_thermal_high = 0 +is_reset_button_push = 0 +########################## + +def sysled_task(): + while True: + system_led_check() + time.sleep(5) + +### Zion specified ### +def system_led_check(): + global read_fan_fault, read_power_status, is_fan_all_OK, is_power_all_OK, is_thermal_high, is_reset_button_push + is_fan_all_OK = 1 + is_power_all_OK = 0 + is_thermal_high = 0 + is_reset_button_push = 0 + with open("/sys/bus/i2c/devices/1-005e/fan1_fault", "r") as f1: + read_fan_fault = f1.read() + with open("/sys/bus/i2c/devices/9-005f/fan1_led", "w") as f11: + if str(read_fan_fault) == str("1\n"): + is_fan_all_OK = 0 + f11.write("4") + else: + f11.write("1") + with open("/sys/bus/i2c/devices/1-005e/fan2_fault", "r") as f1: + read_fan_fault = f1.read() + with open("/sys/bus/i2c/devices/9-005f/fan2_led", "w") as f11: + if str(read_fan_fault) == str("1\n"): + is_fan_all_OK = 0 + f11.write("4") + else: + f11.write("1") + with open("/sys/bus/i2c/devices/1-005e/fan3_fault", "r") as f1: + read_fan_fault = f1.read() + with open("/sys/bus/i2c/devices/9-005f/fan3_led", "w") as f11: + if str(read_fan_fault) == str("1\n"): + is_fan_all_OK = 0 + f11.write("4") + else: + f11.write("1") + with open("/sys/bus/i2c/devices/1-005e/fan4_fault", "r") as f1: + read_fan_fault = f1.read() + with open("/sys/bus/i2c/devices/9-005f/fan4_led", "w") as f11: + if str(read_fan_fault) == str("1\n"): + is_fan_all_OK = 0 + f11.write("4") + else: + f11.write("1") + with open("/sys/bus/i2c/devices/1-005e/fan5_fault", "r") as f1: + read_fan_fault = f1.read() + with open("/sys/bus/i2c/devices/9-005f/fan5_led", "w") as f11: + if str(read_fan_fault) == str("1\n"): + is_fan_all_OK = 0 + f11.write("4") + else: + f11.write("1") + with open("/sys/bus/i2c/devices/1-005e/fan6_fault", "r") as f1: + read_fan_fault = f1.read() + with open("/sys/bus/i2c/devices/9-005f/fan6_led", "w") as f11: + if str(read_fan_fault) == str("1\n"): + is_fan_all_OK = 0 + f11.write("4") + else: + f11.write("1") + + + with open("/sys/bus/i2c/devices/1-005e/psu1_power_good", "r") as f1: + read_power_status = f1.read() + with open("/sys/bus/i2c/devices/9-005f/sys_pwr", "w") as f11: + if str(read_power_status) == str("1\n"): + f11.write("1") + else: + f11.write("4") + with open("/sys/bus/i2c/devices/1-005e/psu1_present", "r") as f1: + read_power_status = f1.read() + with open("/sys/bus/i2c/devices/9-005f/sys_pwr", "w") as f11: + if str(read_power_status) == str("1\n"): + is_power_all_OK = is_power_all_OK + 1 + f11.write("1") + else: + f11.write("4") + with open("/sys/bus/i2c/devices/1-005e/psu2_power_good", "r") as f1: + read_power_status = f1.read() + with open("/sys/bus/i2c/devices/9-005f/sys_pwr", "w") as f11: + if str(read_power_status) == str("1\n"): + f11.write("1") + else: + f11.write("4") + with open("/sys/bus/i2c/devices/1-005e/psu2_present", "r") as f1: + read_power_status = f1.read() + with open("/sys/bus/i2c/devices/9-005f/sys_pwr", "w") as f11: + if str(read_power_status) == str("1\n"): + is_power_all_OK = is_power_all_OK + 1 + f11.write("1") + else: + f11.write("4") + + + with open("/sys/bus/i2c/devices/9-005f/swi_ctrl", "r") as f5: + is_reset_button_push = f5.read() + if str(is_reset_button_push) == "1\n": + is_reset_button_push = 1 + else: + is_reset_button_push = 0 + + with open("/sys/bus/i2c/devices/4-004d/hwmon/hwmon3/temp1_input", "r") as f3: + is_thermal_high = f3.read() + if int(is_thermal_high) >= 70000: + is_thermal_high = 1 + else: + is_thermal_high = 0 + + with open("/sys/bus/i2c/devices/9-005f/sys_status", "w") as f2: + if is_reset_button_push == 1: + f2.write("3") + elif is_fan_all_OK == 0 or is_power_all_OK == 0 or is_thermal_high == 1: + f2.write("4") + else: + f2.write("1") + + return +########## + + +class LedControl(LedControlBase): + """Platform specific LED control class""" + PORT_TABLE_PREFIX = "PORT_TABLE:" + + SONIC_PORT_NAME_PREFIX = "Ethernet" + + LED_SYSFS_PATH_BREAKOUT_CAPABLE = "/sys/class/leds/qsfp{0}_{1}/brightness" + LED_SYSFS_PATH_NO_BREAKOUT = "/sys/class/leds/qsfp{0}/brightness" + + QSFP_BREAKOUT_START_IDX = 1 + QSFP_BREAKOUT_END_IDX = 24 + QSFP_NO_BREAKOUT_START_IDX = 25 + QSFP_NO_BREAKOUT_END_IDX = 32 + + LED_COLOR_OFF = 0 + LED_COLOR_GREEN = 1 + LED_COLOR_YELLOW = 2 + + # Helper method to map SONiC port name to Arista QSFP index + def _port_name_to_qsfp_index(self, port_name): + # Strip "Ethernet" off port name + if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): + return -1 + + sonic_port_num = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) + + swss = swsssdk.SonicV2Connector() + swss.connect(swss.APPL_DB) + + lanes = swss.get(swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes') + + # SONiC port nums are 0-based and increment by 4 + # Arista QSFP indices are 1-based and increment by 1 + return (((sonic_port_num/4) + 1), sonic_port_num%4, len(lanes.split(','))) + + + # Concrete implementation of port_link_state_change() method + def port_link_state_change_bk(self, port, state): + qsfp_index, lane_index, lanes = self._port_name_to_qsfp_index(port) + + # Ignore invalid QSFP indices + if qsfp_index <= 0 or lanes <= 0 or lanes > 4: + return + + # QSFP indices 1-24 are breakout-capable and have four LEDs, and each LED indicate one lane. + # whereas indices 25-32 are not breakout-capable, and only have one + if qsfp_index <= self.QSFP_BREAKOUT_END_IDX: + # assuming 40G, then we need to control four lanes + led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, i) for i in range(lane_index + 1, lane_index + 1 + lanes) ] + else: + led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) ] + + for led_sysfs_path in led_sysfs_paths: + led_file = open(led_sysfs_path, "w") + + if state == "up": + led_file.write("%d" % self.LED_COLOR_GREEN) + else: + led_file.write("%d" % self.LED_COLOR_OFF) + + led_file.close() + + # Constructor + def __init__(self): + # Initialize all front-panel status LEDs to green + with open("/sys/bus/i2c/devices/9-005f/sys_locator", "w") as f: + f.write("0") + with open("/sys/bus/i2c/devices/9-005f/sys_pwr", "w") as f: + f.write("1") + with open("/sys/bus/i2c/devices/9-005f/sys_status", "w") as f: + f.write("1") + + # Initialize all fan LEDs to green + with open("/sys/bus/i2c/devices/9-005f/fan1_led", "w") as f: + f.write("1") + with open("/sys/bus/i2c/devices/9-005f/fan2_led", "w") as f: + f.write("1") + with open("/sys/bus/i2c/devices/9-005f/fan3_led", "w") as f: + f.write("1") + with open("/sys/bus/i2c/devices/9-005f/fan4_led", "w") as f: + f.write("1") + with open("/sys/bus/i2c/devices/9-005f/fan5_led", "w") as f: + f.write("1") + with open("/sys/bus/i2c/devices/9-005f/fan6_led", "w") as f: + f.write("1") + sysled_task() + + # Initialize: Turn all front panel QSFP LEDs off + # # for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): + # # for lane in range(1, 5): + # # led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, lane) + # # with open(led_sysfs_path, 'w') as led_file: + # # led_file.write("%d" % self.LED_COLOR_OFF) + + # # for qsfp_index in range(self.QSFP_NO_BREAKOUT_START_IDX, self.QSFP_NO_BREAKOUT_END_IDX + 1): + # # led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) + # # with open(led_sysfs_path, 'w') as led_file: + # # led_file.write("%d" % self.LED_COLOR_OFF) diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/psuutil.py b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/psuutil.py new file mode 100644 index 000000000000..7a3b87f24d2d --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/psuutil.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python + +############################################################################# +# Alphanetworks +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = { + 1: "/psu1_present", + 2: "/psu2_present", + } + self.psu_oper_status = { + 1: "/psu1_power_good", + 2: "/psu2_power_good", + } + self.psu_mapping = "0-005e" + if not os.path.exists(self.psu_path+self.psu_mapping): + self.psu_mapping = "1-005e" + + def get_num_psus(self): + return len(self.psu_presence) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping+self.psu_oper_status[index] + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping + self.psu_presence[index] + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/sfputil.py b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/sfputil.py new file mode 100644 index 000000000000..9e502578f153 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/sfputil.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + first_port = 0 + last_port = 31 + port_num = 32 + + port_to_eeprom = {} + port_to_i2cbus_mapping = { + 1 : 14, + 2 : 15, + 3 : 16, + 4 : 17, + } + + eeprom_path = "/sys/bus/i2c/devices/{0}-005f/sfp{1}_eeprom" + port_reset_path = "/sys/bus/i2c/devices/{0}-005f/sfp{1}_port_reset" + present_path = "/sys/bus/i2c/devices/{0}-005f/sfp{1}_is_present" + + _qsfp_ports = range(first_port, port_num + 1) + @property + def port_start(self): + return self.first_port + + @property + def port_end(self): + return self.last_port + + @property + def qsfp_ports(self): + return range(self.first_port, self.port_num + 1) + + @property + def port_to_eeprom_mapping(self): + return self.port_to_eeprom + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError + + def __init__(self): + path = self.eeprom_path + for x in range(self.first_port, self.last_port + 1): + index = (x % 8) + i2c_index = (x / 8) + 1 + self.port_to_eeprom[x] = path.format(self.port_to_i2cbus_mapping[i2c_index], (index + 1)) + SfpUtilBase.__init__(self) + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.first_port or port_num > self.last_port: + return False + + index = (port_num % 8) + i2c_index = (port_num / 8) + 1 + path = self.port_reset_path + port_path = path.format(self.port_to_i2cbus_mapping[i2c_index], (index + 1)) + + try: + reg_file = open(port_path, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + # reset + reg_file.write('1') + + time.sleep(1) + + reg_file.write('0') + + reg_file.close() + return True + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedError + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.first_port or port_num > self.last_port: + return False + + index = (port_num % 8) + i2c_index = (port_num / 8) + 1 + path = self.present_path + port_path = path.format(self.port_to_i2cbus_mapping[i2c_index], (index + 1)) + + + try: + reg_file = open(port_path) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/sensors.conf b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/sensors.conf new file mode 100644 index 000000000000..90562c389f00 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/sensors.conf @@ -0,0 +1,17 @@ +# libsensors configuration file for snh60a0_320f +# ------------------------------------------------ + +bus "i2c-1" "SMBus I801 adapter at f000" +chip "goreme_power_cpld-*" + label fan1 "Fan tray 1 front" + label fan2 "Fan tray 2 front" + label fan3 "Fan tray 3 front" + label fan4 "Fan tray 4 front" + label fan5 "Fan tray 5 front" + label fan6 "Fan tray 6 front" + label fan11 "Fan tray 1 rear" + label fan12 "Fan tray 2 rear" + label fan13 "Fan tray 3 rear" + label fan14 "Fan tray 4 rear" + label fan15 "Fan tray 5 rear" + label fan16 "Fan tray 6 rear" diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/port_config.ini b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/port_config.ini new file mode 100644 index 000000000000..d365e18da78e --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/port_config.ini @@ -0,0 +1,67 @@ +# name lanes alias index speed +Ethernet0 5,6,7,8 Ethernet1/0/1 0 100000 +Ethernet4 9,10,11,12 Ethernet1/0/5 1 100000 +Ethernet8 13,14,15,16 Ethernet1/0/9 2 100000 +Ethernet12 1,2,3,4 Ethernet1/0/13 3 100000 +Ethernet16 21,22,23,24 Ethernet1/0/17 4 100000 +Ethernet20 25,26,27,28 Ethernet1/0/21 5 100000 +Ethernet24 29,30,31,32 Ethernet1/0/25 6 100000 +Ethernet28 17,18,19,20 Ethernet1/0/29 7 100000 +Ethernet32 37,38,39,40 Ethernet1/0/33 8 100000 +Ethernet36 41,42,43,44 Ethernet1/0/37 9 100000 +Ethernet40 45,46,47,48 Ethernet1/0/41 10 100000 +Ethernet44 33,34,35,36 Ethernet1/0/45 11 100000 +Ethernet48 53,54,55,56 Ethernet1/0/49 12 100000 +Ethernet52 57,58,59,60 Ethernet1/0/53 13 100000 +Ethernet56 61,62,63,64 Ethernet1/0/57 14 100000 +Ethernet60 49,50,51,52 Ethernet1/0/61 15 100000 +Ethernet64 69,70,71,72 Ethernet1/0/65 16 100000 +Ethernet68 73,74,75,76 Ethernet1/0/69 17 100000 +Ethernet72 77,78,79,80 Ethernet1/0/73 18 100000 +Ethernet76 65,66,67,68 Ethernet1/0/77 19 100000 +Ethernet80 85,86,87,88 Ethernet1/0/81 20 100000 +Ethernet84 89,90,91,92 Ethernet1/0/85 21 100000 +Ethernet88 93,94,95,96 Ethernet1/0/89 22 100000 +Ethernet92 81,82,83,84 Ethernet1/0/93 23 100000 +Ethernet96 101,102,103,104 Ethernet1/0/97 24 100000 +Ethernet100 105,106,107,108 Ethernet1/0/101 25 100000 +Ethernet104 109,110,111,112 Ethernet1/0/105 26 100000 +Ethernet108 97,98,99,100 Ethernet1/0/109 27 100000 +Ethernet112 117,118,119,120 Ethernet1/0/113 28 100000 +Ethernet116 121,122,123,124 Ethernet1/0/117 29 100000 +Ethernet120 125,126,127,128 Ethernet1/0/121 30 100000 +Ethernet124 113,114,115,116 Ethernet1/0/125 31 100000 +Ethernet128 133,134,135,136 Ethernet1/0/129 32 100000 +Ethernet132 137,138,139,140 Ethernet1/0/133 33 100000 +Ethernet136 141,142,143,144 Ethernet1/0/137 34 100000 +Ethernet140 129,130,131,132 Ethernet1/0/141 35 100000 +Ethernet144 149,150,151,152 Ethernet1/0/145 36 100000 +Ethernet148 153,154,155,156 Ethernet1/0/149 37 100000 +Ethernet152 157,158,159,160 Ethernet1/0/153 38 100000 +Ethernet156 145,146,147,148 Ethernet1/0/157 39 100000 +Ethernet160 165,166,167,168 Ethernet1/0/161 40 100000 +Ethernet164 169,170,171,172 Ethernet1/0/165 41 100000 +Ethernet168 173,174,175,176 Ethernet1/0/169 42 100000 +Ethernet172 161,162,163,164 Ethernet1/0/173 43 100000 +Ethernet176 181,182,183,184 Ethernet1/0/177 44 100000 +Ethernet180 185,186,187,188 Ethernet1/0/181 45 100000 +Ethernet184 189,190,191,192 Ethernet1/0/185 46 100000 +Ethernet188 177,178,179,180 Ethernet1/0/189 47 100000 +Ethernet192 197,198,199,200 Ethernet1/0/193 48 100000 +Ethernet196 201,202,203,204 Ethernet1/0/197 49 100000 +Ethernet200 205,206,207,208 Ethernet1/0/201 50 100000 +Ethernet204 193,194,195,196 Ethernet1/0/205 51 100000 +Ethernet208 213,214,215,216 Ethernet1/0/209 52 100000 +Ethernet212 217,218,219,220 Ethernet1/0/213 53 100000 +Ethernet216 221,222,223,224 Ethernet1/0/217 54 100000 +Ethernet220 209,210,211,212 Ethernet1/0/221 55 100000 +Ethernet224 229,230,231,232 Ethernet1/0/225 56 100000 +Ethernet228 233,234,235,236 Ethernet1/0/229 57 100000 +Ethernet232 237,238,239,240 Ethernet1/0/233 58 100000 +Ethernet236 225,226,227,228 Ethernet1/0/237 59 100000 +Ethernet240 245,246,247,248 Ethernet1/0/241 60 100000 +Ethernet244 249,250,251,252 Ethernet1/0/245 61 100000 +Ethernet248 253,254,255,256 Ethernet1/0/249 62 100000 +Ethernet252 241,242,243,244 Ethernet1/0/253 63 100000 +Ethernet256 257 Ethernet1/0/257 64 10000 +Ethernet260 259 Ethernet1/0/261 65 10000 diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/sai.profile b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/sai.profile new file mode 100644 index 000000000000..04555733c028 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-snh60b0-64x100G.config.bcm diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/th2-snh60b0-64x100G.config.bcm b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/th2-snh60b0-64x100G.config.bcm new file mode 100644 index 000000000000..60ca5053b971 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/Alphanetworks-SNH60B0-640F/th2-snh60b0-64x100G.config.bcm @@ -0,0 +1,535 @@ +# This property file is for GOREME-2U 1x100G mode only. +# GOREME-2U uses Tomahawk2 BCM56970 as its mac. Besides, it is phyless. +# Note: The settings in this file are not verified yet. + +os=unix + +bcm_stat_interval.0=1000000 +bcm_linkscan_interval.0=250000 + +# Tuning MDIO_OUTPUT_DELAY as 0xf based on HW RD suggesstion and DVT result. +mdio_output_delay.0=0xf + +# 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 +l2_mem_entries=40960 +l3_mem_entries=40960 + +portmap_66=257:10 +portmap_100=259:10 + +# Falcon core - front port +# FalconCore[0 - 15] must map to logical port[1-16], PIPE-0. +portmap_1=5:100 +portmap_2=9:100 +portmap_3=13:100 +portmap_4=1:100 +portmap_5=21:100 +portmap_6=25:100 +portmap_7=29:100 +portmap_8=17:100 +portmap_9=37:100 +portmap_10=41:100 +portmap_11=45:100 +portmap_12=33:100 +portmap_13=53:100 +portmap_14=57:100 +portmap_15=61:100 +portmap_16=49:100 + +# FalconCore[16 - 31] must map to logical port[34-49], PIPE-1. +portmap_34=69:100 +portmap_35=73:100 +portmap_36=77:100 +portmap_37=65:100 +portmap_38=85:100 +portmap_39=89:100 +portmap_40=93:100 +portmap_41=81:100 +portmap_42=101:100 +portmap_43=105:100 +portmap_44=109:100 +portmap_45=97:100 +portmap_46=117:100 +portmap_47=121:100 +portmap_48=125:100 +portmap_49=113:100 + +# FalconCore[32 - 47] must map to logical port[68-83], PIPE-2. +portmap_68=133:100 +portmap_69=137:100 +portmap_70=141:100 +portmap_71=129:100 +portmap_72=149:100 +portmap_73=153:100 +portmap_74=157:100 +portmap_75=145:100 +portmap_76=165:100 +portmap_77=169:100 +portmap_78=173:100 +portmap_79=161:100 +portmap_80=181:100 +portmap_81=185:100 +portmap_82=189:100 +portmap_83=177:100 + +# FalconCore[48 - 63] must map to logical port[102-117], PIPE-3. +portmap_102=197:100 +portmap_103=201:100 +portmap_104=205:100 +portmap_105=193:100 +portmap_106=213:100 +portmap_107=217:100 +portmap_108=221:100 +portmap_109=209:100 +portmap_110=229:100 +portmap_111=233:100 +portmap_112=237:100 +portmap_113=225:100 +portmap_114=245:100 +portmap_115=249:100 +portmap_116=253:100 +portmap_117=241:100 + +# Configure all front port as CE ports. +pbmp_xport_xe=0x00000000000000000000000000000000003fffd0000ffff40003fffc0001fffe + +# Oversubscription mode +# +# Refers to a switch being configured such that the I/O bandwidth is greater than the +# core bandwidth. +# BCM56970 device supports a maximum I/O bandwidth of 6,400 Gbps when the average packet size +# is greater than 250 bytes. +pbmp_oversubscribe=0x00000000000000000000000000000000003fffc0000ffff00003fffc0001fffe + + + +# core-0~7 +xgxs_rx_lane_map_ce0=0x0213 +xgxs_rx_lane_map_ce1=0x3102 +xgxs_rx_lane_map_ce2=0x1032 +xgxs_rx_lane_map_ce3=0x2103 +xgxs_rx_lane_map_ce4=0x0213 +xgxs_rx_lane_map_ce5=0x2103 +xgxs_rx_lane_map_ce6=0x1230 +xgxs_rx_lane_map_ce7=0x3120 + +# core-8~15 +xgxs_rx_lane_map_ce8=0x0123 +xgxs_rx_lane_map_ce9=0x3102 +xgxs_rx_lane_map_ce10=0x1230 +xgxs_rx_lane_map_ce11=0x0123 +xgxs_rx_lane_map_ce12=0x0123 +xgxs_rx_lane_map_ce13=0X1230 +xgxs_rx_lane_map_ce14=0x1230 +xgxs_rx_lane_map_ce15=0x0123 + +# core-16~23 +xgxs_rx_lane_map_ce16=0x0123 +xgxs_rx_lane_map_ce17=0x1230 +xgxs_rx_lane_map_ce18=0x1230 +xgxs_rx_lane_map_ce19=0x0123 +xgxs_rx_lane_map_ce20=0x0123 +xgxs_rx_lane_map_ce21=0x1230 +xgxs_rx_lane_map_ce22=0x1230 +xgxs_rx_lane_map_ce23=0x0123 + +# core-24~31 +xgxs_rx_lane_map_ce24=0x0123 +xgxs_rx_lane_map_ce25=0x0231 +xgxs_rx_lane_map_ce26=0x2130 +xgxs_rx_lane_map_ce27=0x2103 +xgxs_rx_lane_map_ce28=0x3012 +xgxs_rx_lane_map_ce29=0x3102 +xgxs_rx_lane_map_ce30=0x1032 +xgxs_rx_lane_map_ce31=0x2103 + +# core-32~39 +xgxs_rx_lane_map_ce32=0x3102 +xgxs_rx_lane_map_ce33=0x3102 +xgxs_rx_lane_map_ce34=0x0132 +xgxs_rx_lane_map_ce35=0x3021 +xgxs_rx_lane_map_ce36=0x0213 +xgxs_rx_lane_map_ce37=0x3012 +xgxs_rx_lane_map_ce38=0x2130 +xgxs_rx_lane_map_ce39=0x0123 + +# core-40~47 +xgxs_rx_lane_map_ce40=0x0312 +xgxs_rx_lane_map_ce41=0x0132 +xgxs_rx_lane_map_ce42=0x1230 +xgxs_rx_lane_map_ce43=0x0123 +xgxs_rx_lane_map_ce44=0x0312 +xgxs_rx_lane_map_ce45=0x0132 +xgxs_rx_lane_map_ce46=0x1230 +xgxs_rx_lane_map_ce47=0x0123 + +# core-48~55 +xgxs_rx_lane_map_ce48=0x0123 +xgxs_rx_lane_map_ce49=0x0132 +xgxs_rx_lane_map_ce50=0x1230 +xgxs_rx_lane_map_ce51=0x0123 +xgxs_rx_lane_map_ce52=0x0312 +xgxs_rx_lane_map_ce53=0x0132 +xgxs_rx_lane_map_ce54=0x1230 +xgxs_rx_lane_map_ce55=0x0123 + +# core-56~63 +xgxs_rx_lane_map_ce56=0x0123 +xgxs_rx_lane_map_ce57=0x0312 +xgxs_rx_lane_map_ce58=0x1032 +xgxs_rx_lane_map_ce59=0x2103 +xgxs_rx_lane_map_ce60=0x2103 +xgxs_rx_lane_map_ce61=0x3120 +xgxs_rx_lane_map_ce62=0x1032 +xgxs_rx_lane_map_ce63=0x0213 + +# Remap XGXS tx lanes to desired mapping by hardware provide. +#core-0~7 +xgxs_tx_lane_map_ce0=0x2301 +xgxs_tx_lane_map_ce1=0x2301 +xgxs_tx_lane_map_ce2=0x1302 +xgxs_tx_lane_map_ce3=0x3210 +xgxs_tx_lane_map_ce4=0x2301 +xgxs_tx_lane_map_ce5=0x2301 +xgxs_tx_lane_map_ce6=0x0213 +xgxs_tx_lane_map_ce7=0x3210 + +#core-8~15 +xgxs_tx_lane_map_ce8=0x1230 +xgxs_tx_lane_map_ce9=0x2301 +xgxs_tx_lane_map_ce10=0x0231 +xgxs_tx_lane_map_ce11=0x1230 +xgxs_tx_lane_map_ce12=0x3102 +xgxs_tx_lane_map_ce13=0x2301 +xgxs_tx_lane_map_ce14=0x0231 +xgxs_tx_lane_map_ce15=0x1230 + +#core-16~23 +xgxs_tx_lane_map_ce16=0x3102 +xgxs_tx_lane_map_ce17=0x2301 +xgxs_tx_lane_map_ce18=0x0231 +xgxs_tx_lane_map_ce19=0x1230 +xgxs_tx_lane_map_ce20=0x3102 +xgxs_tx_lane_map_ce21=0x2301 +xgxs_tx_lane_map_ce22=0x0231 +xgxs_tx_lane_map_ce23=0x1230 + +#core-24~31 +xgxs_tx_lane_map_ce24=0x3102 +xgxs_tx_lane_map_ce25=0x2301 +xgxs_tx_lane_map_ce26=0x0321 +xgxs_tx_lane_map_ce27=0x3210 +xgxs_tx_lane_map_ce28=0x1302 +xgxs_tx_lane_map_ce29=0x2031 +xgxs_tx_lane_map_ce30=0x3120 +xgxs_tx_lane_map_ce31=0x3210 + +#core-32~39 +xgxs_tx_lane_map_ce32=0x2310 +xgxs_tx_lane_map_ce33=0x2301 +xgxs_tx_lane_map_ce34=0x1203 +xgxs_tx_lane_map_ce35=0x1032 +xgxs_tx_lane_map_ce36=0x2130 +xgxs_tx_lane_map_ce37=0x2301 +xgxs_tx_lane_map_ce38=0x1302 +xgxs_tx_lane_map_ce39=0x3210 + +#core-40~47 +xgxs_tx_lane_map_ce40=0x3201 +xgxs_tx_lane_map_ce41=0x0231 +xgxs_tx_lane_map_ce42=0x1203 +xgxs_tx_lane_map_ce43=0x1230 +xgxs_tx_lane_map_ce44=0x3201 +xgxs_tx_lane_map_ce45=0x0231 +xgxs_tx_lane_map_ce46=0x1203 +xgxs_tx_lane_map_ce47=0x3210 + +#core-48~55 +xgxs_tx_lane_map_ce48=0x3201 +xgxs_tx_lane_map_ce49=0x0231 +xgxs_tx_lane_map_ce50=0x1203 +xgxs_tx_lane_map_ce51=0x3210 +xgxs_tx_lane_map_ce52=0x3201 +xgxs_tx_lane_map_ce53=0x0231 +xgxs_tx_lane_map_ce54=0x1203 +xgxs_tx_lane_map_ce55=0x3210 + +#core-56~63 +xgxs_tx_lane_map_ce56=0x1203 +xgxs_tx_lane_map_ce57=0x2301 +xgxs_tx_lane_map_ce58=0x0213 +xgxs_tx_lane_map_ce59=0x3210 +xgxs_tx_lane_map_ce60=0x0213 +xgxs_tx_lane_map_ce61=0x3021 +xgxs_tx_lane_map_ce62=0x3210 +xgxs_tx_lane_map_ce63=0x3210 + +serdes_preemphasis_lane0_ce0=0x0c5800 +serdes_preemphasis_lane1_ce0=0x0c5800 +serdes_preemphasis_lane2_ce0=0x0c5800 +serdes_preemphasis_lane3_ce0=0x0c5800 +serdes_preemphasis_lane0_ce1=0x0c5800 +serdes_preemphasis_lane1_ce1=0x0c5800 +serdes_preemphasis_lane2_ce1=0x0c5800 +serdes_preemphasis_lane3_ce1=0x0c5800 +serdes_preemphasis_lane0_ce2=0x0c5800 +serdes_preemphasis_lane1_ce2=0x0c5800 +serdes_preemphasis_lane2_ce2=0x0c5800 +serdes_preemphasis_lane3_ce2=0x0c5800 +serdes_preemphasis_lane0_ce3=0x0c5800 +serdes_preemphasis_lane1_ce3=0x0c5800 +serdes_preemphasis_lane2_ce3=0x0c5800 +serdes_preemphasis_lane3_ce3=0x0c5800 +serdes_preemphasis_lane0_ce4=0x0c5800 +serdes_preemphasis_lane1_ce4=0x0c5800 +serdes_preemphasis_lane2_ce4=0x0c5800 +serdes_preemphasis_lane3_ce4=0x0c5800 +serdes_preemphasis_lane0_ce5=0x0c5800 +serdes_preemphasis_lane1_ce5=0x0c5800 +serdes_preemphasis_lane2_ce5=0x0c5800 +serdes_preemphasis_lane3_ce5=0x0c5800 +serdes_preemphasis_lane0_ce6=0x0c5800 +serdes_preemphasis_lane1_ce6=0x0c5800 +serdes_preemphasis_lane2_ce6=0x0c5800 +serdes_preemphasis_lane3_ce6=0x0c5800 +serdes_preemphasis_lane0_ce7=0x0c5800 +serdes_preemphasis_lane1_ce7=0x0c5800 +serdes_preemphasis_lane2_ce7=0x0c5800 +serdes_preemphasis_lane3_ce7=0x0c5800 +serdes_preemphasis_lane0_ce8=0x0c5800 +serdes_preemphasis_lane1_ce8=0x0c5800 +serdes_preemphasis_lane2_ce8=0x0c5800 +serdes_preemphasis_lane3_ce8=0x0c5800 +serdes_preemphasis_lane0_ce9=0x0c5800 +serdes_preemphasis_lane1_ce9=0x0c5800 +serdes_preemphasis_lane2_ce9=0x0c5800 +serdes_preemphasis_lane3_ce9=0x0c5800 +serdes_preemphasis_lane0_ce10=0x0c5800 +serdes_preemphasis_lane1_ce10=0x0c5800 +serdes_preemphasis_lane2_ce10=0x0c5800 +serdes_preemphasis_lane3_ce10=0x0c5800 +serdes_preemphasis_lane0_ce11=0x0c5800 +serdes_preemphasis_lane1_ce11=0x0c5800 +serdes_preemphasis_lane2_ce11=0x0c5800 +serdes_preemphasis_lane3_ce11=0x0c5800 +serdes_preemphasis_lane0_ce12=0x0c5800 +serdes_preemphasis_lane1_ce12=0x0c5800 +serdes_preemphasis_lane2_ce12=0x0c5800 +serdes_preemphasis_lane3_ce12=0x0c5800 +serdes_preemphasis_lane0_ce13=0x0c5800 +serdes_preemphasis_lane1_ce13=0x0c5800 +serdes_preemphasis_lane2_ce13=0x0c5800 +serdes_preemphasis_lane3_ce13=0x0c5800 +serdes_preemphasis_lane0_ce14=0x0c5800 +serdes_preemphasis_lane1_ce14=0x0c5800 +serdes_preemphasis_lane2_ce14=0x0c5800 +serdes_preemphasis_lane3_ce14=0x0c5800 +serdes_preemphasis_lane0_ce15=0x0c5800 +serdes_preemphasis_lane1_ce15=0x0c5800 +serdes_preemphasis_lane2_ce15=0x0c5800 +serdes_preemphasis_lane3_ce15=0x0c5800 +serdes_preemphasis_lane0_ce16=0x085408 +serdes_preemphasis_lane1_ce16=0x085408 +serdes_preemphasis_lane2_ce16=0x085408 +serdes_preemphasis_lane3_ce16=0x085408 +serdes_preemphasis_lane0_ce17=0x085408 +serdes_preemphasis_lane1_ce17=0x085408 +serdes_preemphasis_lane2_ce17=0x085408 +serdes_preemphasis_lane3_ce17=0x085408 +serdes_preemphasis_lane0_ce18=0x085408 +serdes_preemphasis_lane1_ce18=0x085408 +serdes_preemphasis_lane2_ce18=0x085408 +serdes_preemphasis_lane3_ce18=0x085408 +serdes_preemphasis_lane0_ce19=0x085408 +serdes_preemphasis_lane1_ce19=0x085408 +serdes_preemphasis_lane2_ce19=0x085408 +serdes_preemphasis_lane3_ce19=0x085408 +serdes_preemphasis_lane0_ce20=0x085408 +serdes_preemphasis_lane1_ce20=0x085408 +serdes_preemphasis_lane2_ce20=0x085408 +serdes_preemphasis_lane3_ce20=0x085408 +serdes_preemphasis_lane0_ce21=0x085408 +serdes_preemphasis_lane1_ce21=0x085408 +serdes_preemphasis_lane2_ce21=0x085408 +serdes_preemphasis_lane3_ce21=0x085408 +serdes_preemphasis_lane0_ce22=0x085408 +serdes_preemphasis_lane1_ce22=0x085408 +serdes_preemphasis_lane2_ce22=0x085408 +serdes_preemphasis_lane3_ce22=0x085408 +serdes_preemphasis_lane0_ce23=0x085408 +serdes_preemphasis_lane1_ce23=0x085408 +serdes_preemphasis_lane2_ce23=0x085408 +serdes_preemphasis_lane3_ce23=0x085408 +serdes_preemphasis_lane0_ce24=0x085408 +serdes_preemphasis_lane1_ce24=0x085408 +serdes_preemphasis_lane2_ce24=0x085408 +serdes_preemphasis_lane3_ce24=0x085408 +serdes_preemphasis_lane0_ce25=0x085408 +serdes_preemphasis_lane1_ce25=0x085408 +serdes_preemphasis_lane2_ce25=0x085408 +serdes_preemphasis_lane3_ce25=0x085408 +serdes_preemphasis_lane0_ce26=0x0a500a +serdes_preemphasis_lane1_ce26=0x0a500a +serdes_preemphasis_lane2_ce26=0x0a500a +serdes_preemphasis_lane3_ce26=0x0a500a +serdes_preemphasis_lane0_ce27=0x0a500a +serdes_preemphasis_lane1_ce27=0x0a500a +serdes_preemphasis_lane2_ce27=0x0a500a +serdes_preemphasis_lane3_ce27=0x0a500a +serdes_preemphasis_lane0_ce28=0x0a500a +serdes_preemphasis_lane1_ce28=0x0a500a +serdes_preemphasis_lane2_ce28=0x0a500a +serdes_preemphasis_lane3_ce28=0x0a500a +serdes_preemphasis_lane0_ce29=0x0a500a +serdes_preemphasis_lane1_ce29=0x0a500a +serdes_preemphasis_lane2_ce29=0x0a500a +serdes_preemphasis_lane3_ce29=0x0a500a +serdes_preemphasis_lane0_ce30=0x0a500a +serdes_preemphasis_lane1_ce30=0x0a500a +serdes_preemphasis_lane2_ce30=0x0a500a +serdes_preemphasis_lane3_ce30=0x0a500a +serdes_preemphasis_lane0_ce31=0x0a500a +serdes_preemphasis_lane1_ce31=0x0a500a +serdes_preemphasis_lane2_ce31=0x0a500a +serdes_preemphasis_lane3_ce31=0x0a500a +serdes_preemphasis_lane0_ce32=0x0a500a +serdes_preemphasis_lane1_ce32=0x0a500a +serdes_preemphasis_lane2_ce32=0x0a500a +serdes_preemphasis_lane3_ce32=0x0a500a +serdes_preemphasis_lane0_ce33=0x0a500a +serdes_preemphasis_lane1_ce33=0x0a500a +serdes_preemphasis_lane2_ce33=0x0a500a +serdes_preemphasis_lane3_ce33=0x0a500a +serdes_preemphasis_lane0_ce34=0x0a500a +serdes_preemphasis_lane1_ce34=0x0a500a +serdes_preemphasis_lane2_ce34=0x0a500a +serdes_preemphasis_lane3_ce34=0x0a500a +serdes_preemphasis_lane0_ce35=0x0a500a +serdes_preemphasis_lane1_ce35=0x0a500a +serdes_preemphasis_lane2_ce35=0x0a500a +serdes_preemphasis_lane3_ce35=0x0a500a +serdes_preemphasis_lane0_ce36=0x0a500a +serdes_preemphasis_lane1_ce36=0x0a500a +serdes_preemphasis_lane2_ce36=0x0a500a +serdes_preemphasis_lane3_ce36=0x0a500a +serdes_preemphasis_lane0_ce37=0x0a500a +serdes_preemphasis_lane1_ce37=0x0a500a +serdes_preemphasis_lane2_ce37=0x0a500a +serdes_preemphasis_lane3_ce37=0x0a500a +serdes_preemphasis_lane0_ce38=0x0a500a +serdes_preemphasis_lane1_ce38=0x0a500a +serdes_preemphasis_lane2_ce38=0x0a500a +serdes_preemphasis_lane3_ce38=0x0a500a +serdes_preemphasis_lane0_ce39=0x0a500a +serdes_preemphasis_lane1_ce39=0x0a500a +serdes_preemphasis_lane2_ce39=0x0a500a +serdes_preemphasis_lane3_ce39=0x0a500a +serdes_preemphasis_lane0_ce40=0x085408 +serdes_preemphasis_lane1_ce40=0x085408 +serdes_preemphasis_lane2_ce40=0x085408 +serdes_preemphasis_lane3_ce40=0x085408 +serdes_preemphasis_lane0_ce41=0x085408 +serdes_preemphasis_lane1_ce41=0x085408 +serdes_preemphasis_lane2_ce41=0x085408 +serdes_preemphasis_lane3_ce41=0x085408 +serdes_preemphasis_lane0_ce42=0x085408 +serdes_preemphasis_lane1_ce42=0x085408 +serdes_preemphasis_lane2_ce42=0x085408 +serdes_preemphasis_lane3_ce42=0x085408 +serdes_preemphasis_lane0_ce43=0x085408 +serdes_preemphasis_lane1_ce43=0x085408 +serdes_preemphasis_lane2_ce43=0x085408 +serdes_preemphasis_lane3_ce43=0x085408 +serdes_preemphasis_lane0_ce44=0x085408 +serdes_preemphasis_lane1_ce44=0x085408 +serdes_preemphasis_lane2_ce44=0x085408 +serdes_preemphasis_lane3_ce44=0x085408 +serdes_preemphasis_lane0_ce45=0x085408 +serdes_preemphasis_lane1_ce45=0x085408 +serdes_preemphasis_lane2_ce45=0x085408 +serdes_preemphasis_lane3_ce45=0x085408 +serdes_preemphasis_lane0_ce46=0x085408 +serdes_preemphasis_lane1_ce46=0x085408 +serdes_preemphasis_lane2_ce46=0x085408 +serdes_preemphasis_lane3_ce46=0x085408 +serdes_preemphasis_lane0_ce47=0x085408 +serdes_preemphasis_lane1_ce47=0x085408 +serdes_preemphasis_lane2_ce47=0x085408 +serdes_preemphasis_lane3_ce47=0x085408 +serdes_preemphasis_lane0_ce48=0x085408 +serdes_preemphasis_lane1_ce48=0x085408 +serdes_preemphasis_lane2_ce48=0x085408 +serdes_preemphasis_lane3_ce48=0x085408 +serdes_preemphasis_lane0_ce49=0x085408 +serdes_preemphasis_lane1_ce49=0x085408 +serdes_preemphasis_lane2_ce49=0x085408 +serdes_preemphasis_lane3_ce49=0x085408 +serdes_preemphasis_lane0_ce50=0x085408 +serdes_preemphasis_lane1_ce50=0x085408 +serdes_preemphasis_lane2_ce50=0x085408 +serdes_preemphasis_lane3_ce50=0x085408 +serdes_preemphasis_lane0_ce51=0x085408 +serdes_preemphasis_lane1_ce51=0x085408 +serdes_preemphasis_lane2_ce51=0x085408 +serdes_preemphasis_lane3_ce51=0x085408 +serdes_preemphasis_lane0_ce52=0x085408 +serdes_preemphasis_lane1_ce52=0x085408 +serdes_preemphasis_lane2_ce52=0x085408 +serdes_preemphasis_lane3_ce52=0x085408 +serdes_preemphasis_lane0_ce53=0x085408 +serdes_preemphasis_lane1_ce53=0x085408 +serdes_preemphasis_lane2_ce53=0x085408 +serdes_preemphasis_lane3_ce53=0x085408 +serdes_preemphasis_lane0_ce54=0x085408 +serdes_preemphasis_lane1_ce54=0x085408 +serdes_preemphasis_lane2_ce54=0x085408 +serdes_preemphasis_lane3_ce54=0x085408 +serdes_preemphasis_lane0_ce55=0x085408 +serdes_preemphasis_lane1_ce55=0x085408 +serdes_preemphasis_lane2_ce55=0x085408 +serdes_preemphasis_lane3_ce55=0x085408 +serdes_preemphasis_lane0_ce56=0x0c5800 +serdes_preemphasis_lane1_ce56=0x0c5800 +serdes_preemphasis_lane2_ce56=0x0c5800 +serdes_preemphasis_lane3_ce56=0x0c5800 +serdes_preemphasis_lane0_ce57=0x0c5800 +serdes_preemphasis_lane1_ce57=0x0c5800 +serdes_preemphasis_lane2_ce57=0x0c5800 +serdes_preemphasis_lane3_ce57=0x0c5800 +serdes_preemphasis_lane0_ce58=0x0c5800 +serdes_preemphasis_lane1_ce58=0x0c5800 +serdes_preemphasis_lane2_ce58=0x0c5800 +serdes_preemphasis_lane3_ce58=0x0c5800 +serdes_preemphasis_lane0_ce59=0x0c5800 +serdes_preemphasis_lane1_ce59=0x0c5800 +serdes_preemphasis_lane2_ce59=0x0c5800 +serdes_preemphasis_lane3_ce59=0x0c5800 +serdes_preemphasis_lane0_ce60=0x0c5800 +serdes_preemphasis_lane1_ce60=0x0c5800 +serdes_preemphasis_lane2_ce60=0x0c5800 +serdes_preemphasis_lane3_ce60=0x0c5800 +serdes_preemphasis_lane0_ce61=0x0c5800 +serdes_preemphasis_lane1_ce61=0x0c5800 +serdes_preemphasis_lane2_ce61=0x0c5800 +serdes_preemphasis_lane3_ce61=0x0c5800 +serdes_preemphasis_lane0_ce62=0x0c5800 +serdes_preemphasis_lane1_ce62=0x0c5800 +serdes_preemphasis_lane2_ce62=0x0c5800 +serdes_preemphasis_lane3_ce62=0x0c5800 +serdes_preemphasis_lane0_ce63=0x0c5800 +serdes_preemphasis_lane1_ce63=0x0c5800 +serdes_preemphasis_lane2_ce63=0x0c5800 +serdes_preemphasis_lane3_ce63=0x0c5800 + +# # The TX and RX polarity flip variable. +# # It is affected by lane swapping, we used to debug for TE QSFP28 transceiver. +# # + +# # Used to select the reference clock for Timestamping and BroadSync/10Mhz PLL value. +# # 25MHz LVPECL to BS_PLL0_REFCLK, BS_PLL1_REFCLK, and TS_PLL_REFCLK +# ptp_ts_pll_fref=25000000 +# ptp_bs_fref=25000000 diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/default_sku b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/default_sku new file mode 100755 index 000000000000..e262bc70c380 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/default_sku @@ -0,0 +1 @@ +Alphanetworks-SNH60B0-640F t1 diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/fancontrol b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/fancontrol new file mode 100644 index 000000000000..9d443b3d3e61 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/fancontrol @@ -0,0 +1,9 @@ +INTERVAL=10 +FCTEMPS=/sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/3-004d/hwmon/hwmon2/temp1_input +FCFANS=/sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan1_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan2_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan3_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan4_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan11_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan12_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan13_input /sys/bus/i2c/devices/0-005e/fan_pwm=/sys/bus/i2c/devices/0-005e/fan14_input +MINTEMP=/sys/bus/i2c/devices/0-005e/fan_pwm=50 +MAXTEMP=/sys/bus/i2c/devices/0-005e/fan_pwm=70 +MINSTART=/sys/bus/i2c/devices/0-005e/fan_pwm=100 +MINSTOP=/sys/bus/i2c/devices/0-005e/fan_pwm=100 +MINPWM=/sys/bus/i2c/devices/0-005e/fan_pwm=100 +MAXPWM=/sys/bus/i2c/devices/0-005e/fan_pwm=200 \ No newline at end of file diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/installer.conf b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/led_proc_init.soc b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/led_proc_init.soc new file mode 100644 index 000000000000..3fa944a9faba --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/led_proc_init.soc @@ -0,0 +1,111 @@ +# LED microprocessor initialization for alphanetworks snh60b0-640f + +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=0x3f REMAP_PORT_1=0x3e REMAP_PORT_2=0x3d REMAP_PORT_3=0x3c +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=0x3b REMAP_PORT_5=0x3a REMAP_PORT_6=0x39 REMAP_PORT_7=0x38 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=0x37 REMAP_PORT_9=0x36 REMAP_PORT_10=0x35 REMAP_PORT_11=0x34 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=0x33 REMAP_PORT_13=0x32 REMAP_PORT_14=0x31 REMAP_PORT_15=0x30 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=0x2f REMAP_PORT_17=0x2e REMAP_PORT_18=0x2d REMAP_PORT_19=0x2c +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=0x2b REMAP_PORT_21=0x2a REMAP_PORT_22=0x29 REMAP_PORT_23=0x28 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=0x27 REMAP_PORT_25=0x26 REMAP_PORT_26=0x25 REMAP_PORT_27=0x24 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=0x23 REMAP_PORT_29=0x22 REMAP_PORT_30=0x21 REMAP_PORT_31=0x20 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=0x1f REMAP_PORT_33=0x1e REMAP_PORT_34=0x1d REMAP_PORT_35=0x1c +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=0x1b REMAP_PORT_37=0x1a REMAP_PORT_38=0x19 REMAP_PORT_39=0x18 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=0x17 REMAP_PORT_41=0x16 REMAP_PORT_42=0x15 REMAP_PORT_43=0x14 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=0x13 REMAP_PORT_45=0x12 REMAP_PORT_46=0x11 REMAP_PORT_47=0x10 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=0xf REMAP_PORT_49=0xe REMAP_PORT_50=0xd REMAP_PORT_51=0xc +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=0xb REMAP_PORT_53=0xa REMAP_PORT_54=9 REMAP_PORT_55=8 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=3 REMAP_PORT_1=2 REMAP_PORT_2=1 REMAP_PORT_3=0 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=7 REMAP_PORT_5=6 REMAP_PORT_6=5 REMAP_PORT_7=4 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=0xb REMAP_PORT_9=0xa REMAP_PORT_10=9 REMAP_PORT_11=8 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=0xf REMAP_PORT_13=0xe REMAP_PORT_14=0xd REMAP_PORT_15=0xc +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=0x13 REMAP_PORT_17=0x12 REMAP_PORT_18=0x11 REMAP_PORT_19=0x10 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=0x17 REMAP_PORT_21=0x16 REMAP_PORT_22=0x15 REMAP_PORT_23=0x14 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=0x1b REMAP_PORT_25=0x1a REMAP_PORT_26=0x19 REMAP_PORT_27=0x18 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=0x1f REMAP_PORT_29=0x1e REMAP_PORT_30=0x1d REMAP_PORT_31=0x1c +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=0x23 REMAP_PORT_33=0x22 REMAP_PORT_34=0x21 REMAP_PORT_35=0x20 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=0x27 REMAP_PORT_37=0x26 REMAP_PORT_38=0x25 REMAP_PORT_39=0x24 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=0x2b REMAP_PORT_41=0x2a REMAP_PORT_42=0x29 REMAP_PORT_43=0x28 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=0x2f REMAP_PORT_45=0x2e REMAP_PORT_46=0x2d REMAP_PORT_47=0x2c +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=0x33 REMAP_PORT_49=0x32 REMAP_PORT_50=0x31 REMAP_PORT_51=0x30 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=0x37 REMAP_PORT_53=0x36 REMAP_PORT_54=0x35 REMAP_PORT_55=0x34 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=0x3b REMAP_PORT_57=0x3a REMAP_PORT_58=0x39 REMAP_PORT_59=0x38 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=0x3f REMAP_PORT_61=0x3e REMAP_PORT_62=0x3d REMAP_PORT_63=0x3c + +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=0x3f REMAP_PORT_1=0x3e REMAP_PORT_2=0x3d REMAP_PORT_3=0x3c +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=0x3b REMAP_PORT_5=0x3a REMAP_PORT_6=0x39 REMAP_PORT_7=0x38 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=0x37 REMAP_PORT_9=0x36 REMAP_PORT_10=0x35 REMAP_PORT_11=0x34 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=0x33 REMAP_PORT_13=0x32 REMAP_PORT_14=0x31 REMAP_PORT_15=0x30 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=0x2f REMAP_PORT_17=0x2e REMAP_PORT_18=0x2d REMAP_PORT_19=0x2c +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=0x2b REMAP_PORT_21=0x2a REMAP_PORT_22=0x29 REMAP_PORT_23=0x28 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=0x27 REMAP_PORT_25=0x26 REMAP_PORT_26=0x25 REMAP_PORT_27=0x24 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=0x23 REMAP_PORT_29=0x22 REMAP_PORT_30=0x21 REMAP_PORT_31=0x20 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=0x1f REMAP_PORT_33=0x1e REMAP_PORT_34=0x1d REMAP_PORT_35=0x1c +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=0x1b REMAP_PORT_37=0x1a REMAP_PORT_38=0x19 REMAP_PORT_39=0x18 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=0x17 REMAP_PORT_41=0x16 REMAP_PORT_42=0x15 REMAP_PORT_43=0x14 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=0x13 REMAP_PORT_45=0x12 REMAP_PORT_46=0x11 REMAP_PORT_47=0x10 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=0xf REMAP_PORT_49=0xe REMAP_PORT_50=0xd REMAP_PORT_51=0xc +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=0xb REMAP_PORT_53=0xa REMAP_PORT_54=9 REMAP_PORT_55=8 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +modreg CMIC_LEDUP2_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 + +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=3 REMAP_PORT_1=2 REMAP_PORT_2=1 REMAP_PORT_3=0 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=7 REMAP_PORT_5=6 REMAP_PORT_6=5 REMAP_PORT_7=4 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=0xb REMAP_PORT_9=0xa REMAP_PORT_10=9 REMAP_PORT_11=8 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=0xf REMAP_PORT_13=0xe REMAP_PORT_14=0xd REMAP_PORT_15=0xc +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=0x13 REMAP_PORT_17=0x12 REMAP_PORT_18=0x11 REMAP_PORT_19=0x10 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=0x17 REMAP_PORT_21=0x16 REMAP_PORT_22=0x15 REMAP_PORT_23=0x14 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=0x1b REMAP_PORT_25=0x1a REMAP_PORT_26=0x19 REMAP_PORT_27=0x18 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=0x1f REMAP_PORT_29=0x1e REMAP_PORT_30=0x1d REMAP_PORT_31=0x1c +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=0x23 REMAP_PORT_33=0x22 REMAP_PORT_34=0x21 REMAP_PORT_35=0x20 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=0x27 REMAP_PORT_37=0x26 REMAP_PORT_38=0x25 REMAP_PORT_39=0x24 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=0x2b REMAP_PORT_41=0x2a REMAP_PORT_42=0x29 REMAP_PORT_43=0x28 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=0x2f REMAP_PORT_45=0x2e REMAP_PORT_46=0x2d REMAP_PORT_47=0x2c +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=0x33 REMAP_PORT_49=0x32 REMAP_PORT_50=0x31 REMAP_PORT_51=0x30 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=0x37 REMAP_PORT_53=0x36 REMAP_PORT_54=0x35 REMAP_PORT_55=0x34 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=0x3b REMAP_PORT_57=0x3a REMAP_PORT_58=0x39 REMAP_PORT_59=0x38 +modreg CMIC_LEDUP3_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=0x3f REMAP_PORT_61=0x3e REMAP_PORT_62=0x3d REMAP_PORT_63=0x3c + +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=0x3f REMAP_PORT_1=1 REMAP_PORT_2=0x3f REMAP_PORT_3=0 +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=0x3f REMAP_PORT_5=0x3f REMAP_PORT_6=0x3f REMAP_PORT_7=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=0x3f REMAP_PORT_9=0x3f REMAP_PORT_10=0x3f REMAP_PORT_11=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=0x3f REMAP_PORT_13=0x3f REMAP_PORT_14=0x3f REMAP_PORT_15=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=0x3f REMAP_PORT_17=0x3f REMAP_PORT_18=0x3f REMAP_PORT_19=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=0x3f REMAP_PORT_21=0x3f REMAP_PORT_22=0x3f REMAP_PORT_23=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=0x3f REMAP_PORT_25=0x3f REMAP_PORT_26=0x3f REMAP_PORT_27=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=0x3f REMAP_PORT_29=0x3f REMAP_PORT_30=0x3f REMAP_PORT_31=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=0x3f REMAP_PORT_33=0x3f REMAP_PORT_34=0x3f REMAP_PORT_35=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=0x3f REMAP_PORT_37=0x3f REMAP_PORT_38=0x3f REMAP_PORT_39=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=0x3f REMAP_PORT_41=0x3f REMAP_PORT_42=0x3f REMAP_PORT_43=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=0x3f REMAP_PORT_45=0x3f REMAP_PORT_46=0x3f REMAP_PORT_47=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=0x3f REMAP_PORT_49=0x3f REMAP_PORT_50=0x3f REMAP_PORT_51=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=0x3f REMAP_PORT_53=0x3f REMAP_PORT_54=0x3f REMAP_PORT_55=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=0x3f REMAP_PORT_57=0x3f REMAP_PORT_58=0x3f REMAP_PORT_59=0x3f +modreg CMIC_LEDUP4_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=0x3f REMAP_PORT_61=0x3f REMAP_PORT_62=0x3f REMAP_PORT_63=0x3f + +led 0 stop +led 0 prog 86 FF 06 FF C2 7F 60 FF 02 41 60 FE 67 1A 06 FE E2 04 60 FE D2 01 74 0C 77 51 02 9F F6 FE E2 04 04 D2 01 70 27 74 48 06 FE E2 04 90 28 32 00 32 01 B7 97 71 37 75 3F 06 FF C2 10 70 48 74 3F 67 57 67 53 67 57 67 57 57 67 57 67 57 67 57 67 57 57 3A 40 32 0E 87 57 32 0F 87 57 +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 86 FF 06 FF C2 7F 60 FF 02 41 60 FE 67 1A 06 FE E2 04 60 FE D2 01 74 0C 77 51 02 9F F6 FE E2 04 04 D2 01 70 27 74 48 06 FE E2 04 90 28 32 00 32 01 B7 97 71 37 75 3F 06 FF C2 10 70 48 74 3F 67 57 67 53 67 57 67 57 57 67 57 67 57 67 57 67 57 57 3A 40 32 0E 87 57 32 0F 87 57 +led 1 auto on +led 1 start + +led 2 stop +led 2 prog 86 FF 06 FF C2 7F 60 FF 02 41 60 FE 67 1A 06 FE E2 04 60 FE D2 01 74 0C 77 51 02 9F F6 FE E2 04 04 D2 01 70 27 74 48 06 FE E2 04 90 28 32 00 32 01 B7 97 71 37 75 3F 06 FF C2 10 70 48 74 3F 67 57 67 53 67 57 67 57 57 67 57 67 57 67 57 67 57 57 3A 40 32 0E 87 57 32 0F 87 57 +led 2 auto on +led 2 start + +led 3 stop +led 3 prog 86 FF 06 FF C2 7F 60 FF 02 41 60 FE 67 1A 06 FE E2 04 60 FE D2 01 74 0C 77 51 02 9F F6 FE E2 04 04 D2 01 70 27 74 48 06 FE E2 04 90 28 32 00 32 01 B7 97 71 37 75 3F 06 FF C2 10 70 48 74 3F 67 57 67 53 67 57 67 57 57 67 57 67 57 67 57 67 57 57 3A 40 32 0E 87 57 32 0F 87 57 +led 3 auto on +led 3 start + +led 4 stop +led 4 prog 86 FF 06 FF C2 7F 60 FF 02 02 60 FE 67 1A 06 FE E2 01 60 FE D2 00 74 0C 77 6A 02 9F F6 FE 04 D2 01 70 25 74 51 06 FE 90 28 32 03 32 04 97 75 64 97 71 58 75 5E 06 FE 90 28 32 00 32 01 B7 97 71 43 75 4B 06 FF C2 10 70 4E 74 4B 67 6C 57 67 70 57 67 70 67 70 67 70 57 67 6C 67 70 77 35 67 70 67 6C 77 35 67 70 67 70 77 35 3A 06 32 0E 87 57 32 0F 87 57 +led 4 auto on +led 4 start diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/eeprom.py b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/eeprom.py new file mode 100644 index 000000000000..c0122e65844a --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom" + #Two i2c buses might get flipped order, check them both. + if not os.path.exists(self.eeprom_path): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py new file mode 100644 index 000000000000..457b1d750b28 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python +# +# led_control.py +# +# Platform-specific LED control functionality for SONiC +# + +# try: +# from sonic_led.led_control_base import LedControlBase +# import swsssdk +# except ImportError, e: +# raise ImportError (str(e) + " - required module not found") + +import time + +class LedControlBase(object): +# __metaclass__ = abc.ABCMeta + +# @abc.abstractmethod + def port_link_state_change(self, port, state): + """ + Called when port link state changes. Update port link state LED here. + + :param port: A string, SONiC port name (e.g., "Ethernet0") + :param state: A string, the port link state (either "up" or "down") + """ + return + +### Goreme specified ### +read_fan_fault = 0 +is_fan_all_OK = 0 +read_power_status = 0 +is_power_all_OK = 0 +is_thermal_high = 0 +is_reset_button_push = 0 +########################## + +def sysled_task(): + while True: + system_led_check() + time.sleep(5) + +########## Goreme System LED checking +def system_led_check(): + global read_fan_fault, read_power_status, is_fan_all_OK, is_power_all_OK, is_thermal_high, is_reset_button_push + is_fan_all_OK = 1 + is_power_all_OK = 0 + is_thermal_high = 0 + is_reset_button_push = 0 + with open("/sys/bus/i2c/devices/0-005e/fan1_fault", "r") as f1: + read_fan_fault = f1.read() + if str(read_fan_fault) == str("1\n"): + is_fan_all_OK = 0 + with open("/sys/bus/i2c/devices/0-005e/fan2_fault", "r") as f1: + read_fan_fault = f1.read() + if str(read_fan_fault) == str("1\n"): + is_fan_all_OK = 0 + with open("/sys/bus/i2c/devices/0-005e/fan3_fault", "r") as f1: + read_fan_fault = f1.read() + if str(read_fan_fault) == str("1\n"): + is_fan_all_OK = 0 + with open("/sys/bus/i2c/devices/0-005e/fan4_fault", "r") as f1: + read_fan_fault = f1.read() + if str(read_fan_fault) == str("1\n"): + is_fan_all_OK = 0 + + with open("/sys/bus/i2c/devices/8-005f/fan1_led", "w") as f11: + if int(is_fan_all_OK) == 1: + f11.write("1") + else: + f11.write("4") + + + with open("/sys/bus/i2c/devices/0-005e/psu1_power_good", "r") as f1: + read_power_status = f1.read() + if str(read_power_status) != str("1\n"): + is_power_all_OK = -10 + with open("/sys/bus/i2c/devices/0-005e/psu1_present", "r") as f1: + read_power_status = f1.read() + if str(read_power_status) == str("1\n"): + is_power_all_OK = is_power_all_OK + 1 + with open("/sys/bus/i2c/devices/0-005e/psu2_power_good", "r") as f1: + read_power_status = f1.read() + if str(read_power_status) != str("1\n"): + is_power_all_OK = -10 + with open("/sys/bus/i2c/devices/0-005e/psu2_present", "r") as f1: + read_power_status = f1.read() + if str(read_power_status) == str("1\n"): + is_power_all_OK = is_power_all_OK + 1 + + with open("/sys/bus/i2c/devices/8-005f/sys_pwr", "w") as f11: + if int(is_power_all_OK) > 0: + f11.write("1") + else: + f11.write("4") + + + with open("/sys/bus/i2c/devices/8-005f/swi_ctrl", "r") as f5: + is_reset_button_push = f5.read() + if str(is_reset_button_push) == "1\n": + is_reset_button_push = 1 + else: + is_reset_button_push = 0 + + with open("/sys/bus/i2c/devices/3-004d/hwmon/hwmon2/temp1_input", "r") as f3: + is_thermal_high = f3.read() + if int(is_thermal_high) >= 70000: + is_thermal_high = 1 + else: + is_thermal_high = 0 + + with open("/sys/bus/i2c/devices/8-005f/sys_status", "w") as f2: + if is_reset_button_push == 1: + f2.write("3") + elif is_fan_all_OK == 0 or is_power_all_OK == 0 or is_thermal_high == 1: + f2.write("4") + else: + f2.write("1") + + return +########## + +class LedControl(LedControlBase): + """Platform specific LED control class""" + PORT_TABLE_PREFIX = "PORT_TABLE:" + + SONIC_PORT_NAME_PREFIX = "Ethernet" + + LED_SYSFS_PATH_BREAKOUT_CAPABLE = "/sys/class/leds/qsfp{0}_{1}/brightness" + LED_SYSFS_PATH_NO_BREAKOUT = "/sys/class/leds/qsfp{0}/brightness" + + QSFP_BREAKOUT_START_IDX = 1 + QSFP_BREAKOUT_END_IDX = 24 + QSFP_NO_BREAKOUT_START_IDX = 25 + QSFP_NO_BREAKOUT_END_IDX = 32 + + LED_COLOR_OFF = 0 + LED_COLOR_GREEN = 1 + LED_COLOR_YELLOW = 2 + + # Helper method to map SONiC port name to Arista QSFP index + def _port_name_to_qsfp_index(self, port_name): + # Strip "Ethernet" off port name + if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX): + return -1 + + sonic_port_num = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):]) + + swss = swsssdk.SonicV2Connector() + swss.connect(swss.APPL_DB) + + lanes = swss.get(swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes') + + # SONiC port nums are 0-based and increment by 4 + # Arista QSFP indices are 1-based and increment by 1 + return (((sonic_port_num/4) + 1), sonic_port_num%4, len(lanes.split(','))) + + + + # Concrete implementation of port_link_state_change() method + def port_link_state_change_bk(self, port, state): + qsfp_index, lane_index, lanes = self._port_name_to_qsfp_index(port) + + # Ignore invalid QSFP indices + if qsfp_index <= 0 or lanes <= 0 or lanes > 4: + return + + # QSFP indices 0-24 are breakout-capable and have four LEDs, and each LED indicate one lane. + # whereas indices 25-32 are not breakout-capable, and only have one + if qsfp_index <= self.QSFP_BREAKOUT_END_IDX: + # assuming 40G, then we need to control four lanes + led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, i) for i in range(lane_index + 1, lane_index + 1 + lanes) ] + else: + led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) ] + + for led_sysfs_path in led_sysfs_paths: + led_file = open(led_sysfs_path, "w") + + if state == "up": + led_file.write("%d" % self.LED_COLOR_GREEN) + else: + led_file.write("%d" % self.LED_COLOR_OFF) + + led_file.close() + + # Constructor + def __init__(self): + # Initialize all front-panel status LEDs to green + with open("/sys/bus/i2c/devices/8-005f/sys_locator", "w") as f: + f.write("0") + with open("/sys/bus/i2c/devices/8-005f/sys_pwr", "w") as f: + f.write("1") + with open("/sys/bus/i2c/devices/8-005f/sys_status", "w") as f: + f.write("1") + + # Initialize all fan LEDs to green + with open("/sys/bus/i2c/devices/8-005f/fan1_led", "w") as f: + f.write("1") + with open("/sys/bus/i2c/devices/8-005f/fan2_led", "w") as f: + f.write("1") + with open("/sys/bus/i2c/devices/8-005f/fan3_led", "w") as f: + f.write("1") + with open("/sys/bus/i2c/devices/8-005f/fan4_led", "w") as f: + f.write("1") + sysled_task() + + # Initialize: Turn all front panel QSFP LEDs off + # # for qsfp_index in range(self.QSFP_BREAKOUT_START_IDX, self.QSFP_BREAKOUT_END_IDX + 1): + # # for lane in range(1, 5): + # # led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, lane) + # # with open(led_sysfs_path, 'w') as led_file: + # # led_file.write("%d" % self.LED_COLOR_OFF) + + # # for qsfp_index in range(self.QSFP_NO_BREAKOUT_START_IDX, self.QSFP_NO_BREAKOUT_END_IDX + 1): + # # led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) + # # with open(led_sysfs_path, 'w') as led_file: + # # led_file.write("%d" % self.LED_COLOR_OFF) diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/psuutil.py b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/psuutil.py new file mode 100644 index 000000000000..7a3b87f24d2d --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/psuutil.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python + +############################################################################# +# Alphanetworks +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = { + 1: "/psu1_present", + 2: "/psu2_present", + } + self.psu_oper_status = { + 1: "/psu1_power_good", + 2: "/psu2_power_good", + } + self.psu_mapping = "0-005e" + if not os.path.exists(self.psu_path+self.psu_mapping): + self.psu_mapping = "1-005e" + + def get_num_psus(self): + return len(self.psu_presence) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping+self.psu_oper_status[index] + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping + self.psu_presence[index] + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/sfputil.py b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/sfputil.py new file mode 100644 index 000000000000..cc3cd4e8611d --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/sfputil.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + first_port = 0 + last_port = 65 + port_num = 63 + + port_to_eeprom = {} + port_to_i2cbus_mapping = { + 1 : 13, + 2 : 14, + 3 : 15, + 4 : 16, + 5 : 23, + } + + eeprom_path_1 = "/sys/bus/i2c/devices/{0}-0020/sfp{1}_eeprom" + eeprom_path = "/sys/bus/i2c/devices/{0}-005f/sfp{1}_eeprom" + port_reset_path_1 = "/sys/bus/i2c/devices/{0}-0020/sfp{1}_port_reset" + port_reset_path = "/sys/bus/i2c/devices/{0}-005f/sfp{1}_port_reset" + present_path_1 = "/sys/bus/i2c/devices/{0}-0020/sfp{1}_is_present" + present_path = "/sys/bus/i2c/devices/{0}-005f/sfp{1}_is_present" + + _qsfp_ports = range(first_port, port_num) + + @property + def port_start(self): + return self.first_port + + @property + def port_end(self): + return self.last_port + + @property + def qsfp_ports(self): + return range(self.first_port, self.port_num + 1) + + @property + def port_to_eeprom_mapping(self): + return self.port_to_eeprom + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError + + def __init__(self): + for x in range(self.first_port, self.last_port + 1): + cpld_index = (x / 16) + 1 + index = (x % 16) + 1 + if cpld_index == 5: + path = self.eeprom_path_1 + else: + path = self.eeprom_path + self.port_to_eeprom[x] = path.format(self.port_to_i2cbus_mapping[cpld_index], index) + SfpUtilBase.__init__(self) + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.first_port or port_num > self.last_port: + return False + + cpld_index = (port_num / 16) + 1 + index = (port_num % 16) + 1 + if cpld_index == 5: + path = self.port_reset_path_1 + else: + path = self.port_reset_path + port_path = path.format(self.port_to_i2cbus_mapping[cpld_index], index) + + try: + reg_file = open(port_path, 'w') + except IOError as e: + if cpld_index < 5: + print "Error: unable to open file: %s" % str(e) + return False + + # reset + reg_file.write('1') + + time.sleep(1) + + reg_file.write('0') + + reg_file.close() + return True + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedError + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.first_port or port_num > self.last_port: + return False + + cpld_index = (port_num / 16) + 1 + index = (port_num % 16) + 1 + if cpld_index == 5: + path = self.present_path_1 + else: + path = self.present_path + port_path = path.format(self.port_to_i2cbus_mapping[cpld_index], index) + + + try: + reg_file = open(port_path) + except IOError as e: + if cpld_index < 5: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/sensors.conf b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/sensors.conf new file mode 100644 index 000000000000..0650d9da652b --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/sensors.conf @@ -0,0 +1,13 @@ +# libsensors configuration file for snh60b0_640f +# ------------------------------------------------ + +bus "i2c-1" "SMBus I801 adapter at f000" +chip "goreme_power_cpld-*" + label fan1 "Fan tray 1 front" + label fan2 "Fan tray 2 front" + label fan3 "Fan tray 3 front" + label fan4 "Fan tray 4 front" + label fan11 "Fan tray 1 rear" + label fan12 "Fan tray 2 rear" + label fan13 "Fan tray 3 rear" + label fan14 "Fan tray 4 rear" diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 29b0f20ef01b..8f56a6cf50ad 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -30,6 +30,8 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(DELTA_AG5648_PLATFORM_MODULE) \ $(DELTA_ET6248BRB_PLATFORM_MODULE) \ $(QUANTA_IX1B_32X_PLATFORM_MODULE) \ - $(MITAC_LY1200_32X_PLATFORM_MODULE) + $(MITAC_LY1200_32X_PLATFORM_MODULE) \ + $(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE) \ + $(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/broadcom/platform-modules-alphanetworks.mk b/platform/broadcom/platform-modules-alphanetworks.mk new file mode 100644 index 000000000000..425656e06653 --- /dev/null +++ b/platform/broadcom/platform-modules-alphanetworks.mk @@ -0,0 +1,21 @@ +# Alphanetworks Platform modules + +ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION = 1.0 +ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE_VERSION = 1.0 + +export ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION +export ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE_VERSION + +ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE = sonic-platform-alphanetworks-snh60a0-320fv2_$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION)_amd64.deb +$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-alphanetworks +$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE)_PLATFORM = x86_64-alphanetworks_snh60a0_320fv2-r0 +SONIC_DPKG_DEBS += $(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE) + +ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE = sonic-platform-alphanetworks-snh60b0-640f_$(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE_VERSION)_amd64.deb +$(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE)_PLATFORM = x86_64-alphanetworks_snh60b0_640f-r0 +$(eval $(call add_extra_package,$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE),$(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE))) + +SONIC_STRETCH_DEBS += $(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE) + + diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index c7fa0f7aa80e..e0f07fec869b 100755 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -5,6 +5,7 @@ include $(PLATFORM_PATH)/platform-modules-dell.mk include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk +include $(PLATFORM_PATH)/platform-modules-alphanetworks.mk include $(PLATFORM_PATH)/platform-modules-inventec.mk include $(PLATFORM_PATH)/platform-modules-cel.mk include $(PLATFORM_PATH)/platform-modules-delta.mk diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/.gitignore b/platform/broadcom/sonic-platform-modules-alphanetworks/.gitignore new file mode 100644 index 000000000000..7f287d538227 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/.gitignore @@ -0,0 +1,50 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# 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 + +# Kernel Module Compile Results +*.mod* +*.cmd +*.o.d +.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-alphanetworks/README.md b/platform/broadcom/sonic-platform-modules-alphanetworks/README.md new file mode 100644 index 000000000000..a0c753830103 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/README.md @@ -0,0 +1 @@ +platform drivers of Alphanetworks products for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/changelog b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/changelog new file mode 100644 index 000000000000..2742b7c6a416 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/changelog @@ -0,0 +1,6 @@ +sonic-alphanetworks-platform-modules (1.0) unstable; urgency=low + + * Add support for SNH60A0-320FV2 and SNH60B0_640F. + + -- Alphanetworks Tue, 19 Dec 2017 09:35:58 +0800 + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/compat b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control new file mode 100644 index 000000000000..075e86a008e4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control @@ -0,0 +1,17 @@ +Source: sonic-alphanetworks-platform-modules +Section: main +Priority: extra +Maintainer: Alphanetworks , Alphanetworks +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: sonic-platform-alphanetworks-snh60a0-320fv2 +Architecture: amd64 +Depends: linux-image-4.9.0-7-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: sonic-platform-alphanetworks-snh60b0-640f +Architecture: amd64 +Depends: linux-image-4.9.0-7-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules new file mode 100644 index 000000000000..0d1a588db6bd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +include /usr/share/dpkg/pkg-info.mk + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +PYTHON ?= python2 + +PACKAGE_PRE_NAME := sonic-platform-alphanetworks +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= snh60a0-320fv2 snh60b0-640f +MODULE_DIR := modules +UTILS_DIR := utils +SERVICE_DIR := service +CLASSES_DIR := classes +CONF_DIR := conf + +%: + dh $@ --with systemd,python2,python3 --buildsystem=pybuild + +clean: + dh_testdir + dh_testroot + dh_clean + +build: + #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + $(PYTHON) $${mod}/setup.py build; \ + done) + +binary: binary-arch binary-indep + # Nothing to do + +binary-arch: + # Nothing to do + +#install: build + #dh_testdir + #dh_testroot + #dh_clean -k + #dh_installdirs + +binary-indep: + dh_testdir + dh_installdirs + + # Custom package commands + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + $(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + done) + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +.PHONY: build binary binary-arch binary-indep clean diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/classes/__init__.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/classes/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/Makefile b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/Makefile new file mode 100644 index 000000000000..f9477910d382 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/Makefile @@ -0,0 +1,8 @@ +# obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \ +# goreme_system_cpld.o ym2651y.o optoe.o + +obj-m:=alphanetworks_snh60a0-320fv2_sfp.o snh60a0_system_cpld.o snh60a0_power_cpld.o snh60a0_onie_eeprom.o + + +# obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \ +# accton_as7712_32x_psu.o accton_i2c_cpld.o ym2651y.o optoe.o diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/alphanetworks_snh60a0-320fv2_sfp.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/alphanetworks_snh60a0-320fv2_sfp.c new file mode 100644 index 000000000000..af47c6521a0f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/alphanetworks_snh60a0-320fv2_sfp.c @@ -0,0 +1,1669 @@ +/* + * SFP driver for alphanetworks snh60a0-320fv2 sfp + * + * Copyright (C) 2018 Alphanetworks Technology Corporation. + * Philip Wang + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "snh60a0_320fv2_sfp" + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s[%s,%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define NUM_OF_SFP_PORT 32 +#define EEPROM_NAME "sfp_eeprom" +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define BIT_INDEX(i) (1ULL << (i)) +#define USE_I2C_BLOCK_READ 1 +#define I2C_RW_RETRY_COUNT 3 +#define I2C_RW_RETRY_INTERVAL 100 /* ms */ + +#define SFP_CPLD_I2C_ADDR 0x5F +#define SFP_EEPROM_A0_I2C_ADDR 0x50 +#define SFP_EEPROM_A2_I2C_ADDR 0x68 + +#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 +#define SFF8024_DEVICE_ID_SFP 0x3 +#define SFF8024_DEVICE_ID_QSFP 0xC +#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD +#define SFF8024_DEVICE_ID_QSFP28 0x11 + +#define SFF8472_DIAG_MON_TYPE_ADDR 92 +#define SFF8472_DIAG_MON_TYPE_DDM_MASK 0x40 +#define SFF8472_10G_ETH_COMPLIANCE_ADDR 0x3 +#define SFF8472_10G_BASE_MASK 0xF0 + +#define SFF8436_RX_LOS_ADDR 3 +#define SFF8436_TX_FAULT_ADDR 4 +#define SFF8436_TX_DISABLE_ADDR 86 + +static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); +/* extern int alpha_i2c_cpld_read(unsigned short cpld_addr, u8 reg); */ +extern int alpha_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { SFP_EEPROM_A0_I2C_ADDR, SFP_EEPROM_A2_I2C_ADDR, SFP_CPLD_I2C_ADDR, I2C_CLIENT_END }; + +#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) + +enum port_numbers { +sfp1, sfp2, sfp3, sfp4, sfp5, sfp6, sfp7, sfp8, +sfp9, sfp10, sfp11, sfp12, sfp13, sfp14, sfp15, sfp16, +sfp17, sfp18, sfp19, sfp20, sfp21, sfp22, sfp23, sfp24, +sfp25, sfp26, sfp27, sfp28, sfp29, sfp30, sfp31, sfp32 +}; + +static const struct i2c_device_id sfp_device_id[] = { +{ "sfpcpld1", sfp1 }, { "sfpcpld2", sfp2 }, { "sfpcpld3", sfp3 }, { "sfpcpld4", sfp4 }, +{ "sfpcpld5", sfp5 }, { "sfpcpld6", sfp6 }, { "sfpcpld7", sfp7 }, { "sfpcpld8", sfp8 }, +{ "sfpcpld9", sfp9 }, { "sfpcpld10", sfp10 }, { "sfpcpld11", sfp11 }, { "sfpcpld12", sfp12 }, +{ "sfpcpld13", sfp13 }, { "sfpcpld14", sfp14 }, { "sfpcpld15", sfp15 }, { "sfpcpld16", sfp16 }, +{ "sfpcpld17", sfp17 }, { "sfpcpld18", sfp18 }, { "sfpcpld19", sfp19 }, { "sfpcpld20", sfp20 }, +{ "sfpcpld21", sfp21 }, { "sfpcpld22", sfp22 }, { "sfpcpld23", sfp23 }, { "sfpcpld24", sfp24 }, +{ "sfpcpld25", sfp25 }, { "sfpcpld26", sfp26 }, { "sfpcpld27", sfp27 }, { "sfpcpld28", sfp28 }, +{ "sfpcpld29", sfp29 }, { "sfpcpld30", sfp30 }, { "sfpcpld31", sfp31 }, { "sfpcpld32", sfp32 }, +{} +}; +MODULE_DEVICE_TABLE(i2c, sfp_device_id); + +/* + * list of valid port types + * note OOM_PORT_TYPE_NOT_PRESENT to indicate no + * module is present in this port + */ +typedef enum oom_driver_port_type_e { + OOM_DRIVER_PORT_TYPE_INVALID, + OOM_DRIVER_PORT_TYPE_NOT_PRESENT, + OOM_DRIVER_PORT_TYPE_SFP, + OOM_DRIVER_PORT_TYPE_SFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP, + OOM_DRIVER_PORT_TYPE_QSFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP28 +} oom_driver_port_type_t; + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_SFP_DDM, + DRIVER_TYPE_QSFP +}; + +/* Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct sfp_msa_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[2]; /* index 0 => device id + 1 => 10G Ethernet Compliance Codes + to distinguish SFP or SFP+ + 2 => DIAGNOSTIC MONITORING TYPE */ + struct eeprom_data eeprom; +}; + +struct sfp_ddm_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + struct eeprom_data eeprom; +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + oom_driver_port_type_t port_type; + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + u64 port_reset; /* reset status, bit0:port0, bit1:port1 and so on */ + + struct sfp_msa_data *msa; + struct sfp_ddm_data *ddm; + struct qsfp_data *qsfp; + + struct i2c_client *client; +}; + +enum sfp_sysfs_port_num_attributes { + PORT1_NUMBER, + PORT2_NUMBER, + PORT3_NUMBER, + PORT4_NUMBER, + PORT5_NUMBER, + PORT6_NUMBER, + PORT7_NUMBER, + PORT8_NUMBER, + PORT_NUMBER_MAX +}; + +enum sfp_sysfs_present_attributes { + PORT1_PRESENT, + PORT2_PRESENT, + PORT3_PRESENT, + PORT4_PRESENT, + PORT5_PRESENT, + PORT6_PRESENT, + PORT7_PRESENT, + PORT8_PRESENT, + PORT1_PRESENT_ALL, + PORT2_PRESENT_ALL, + PORT3_PRESENT_ALL, + PORT4_PRESENT_ALL, + PORT5_PRESENT_ALL, + PORT6_PRESENT_ALL, + PORT7_PRESENT_ALL, + PORT8_PRESENT_ALL, + PORT_PRESENT_MAX +}; + +enum sfp_sysfs_type_attributes { + PORT1_TYPE, + PORT2_TYPE, + PORT3_TYPE, + PORT4_TYPE, + PORT5_TYPE, + PORT6_TYPE, + PORT7_TYPE, + PORT8_TYPE, + PORT_TYPE_MAX +}; + +enum sfp_sysfs_reset_attributes { + PORT1_RESET, + PORT2_RESET, + PORT3_RESET, + PORT4_RESET, + PORT5_RESET, + PORT6_RESET, + PORT7_RESET, + PORT8_RESET, + PORT_RESET_MAX +}; + +enum sfp_sysfs_rx_los_attributes { + PORT1_RX_LOS, + PORT2_RX_LOS, + PORT3_RX_LOS, + PORT4_RX_LOS, + PORT5_RX_LOS, + PORT6_RX_LOS, + PORT7_RX_LOS, + PORT8_RX_LOS, + PORT1_RX_LOS1, + PORT2_RX_LOS1, + PORT3_RX_LOS1, + PORT4_RX_LOS1, + PORT5_RX_LOS1, + PORT6_RX_LOS1, + PORT7_RX_LOS1, + PORT8_RX_LOS1, + PORT1_RX_LOS2, + PORT2_RX_LOS2, + PORT3_RX_LOS2, + PORT4_RX_LOS2, + PORT5_RX_LOS2, + PORT6_RX_LOS2, + PORT7_RX_LOS2, + PORT8_RX_LOS2, + PORT1_RX_LOS3, + PORT2_RX_LOS3, + PORT3_RX_LOS3, + PORT4_RX_LOS3, + PORT5_RX_LOS3, + PORT6_RX_LOS3, + PORT7_RX_LOS3, + PORT8_RX_LOS3, + PORT1_RX_LOS4, + PORT2_RX_LOS4, + PORT3_RX_LOS4, + PORT4_RX_LOS4, + PORT5_RX_LOS4, + PORT6_RX_LOS4, + PORT7_RX_LOS4, + PORT8_RX_LOS4, + PORT1_RX_LOS_ALL, + PORT2_RX_LOS_ALL, + PORT3_RX_LOS_ALL, + PORT4_RX_LOS_ALL, + PORT5_RX_LOS_ALL, + PORT6_RX_LOS_ALL, + PORT7_RX_LOS_ALL, + PORT8_RX_LOS_ALL, + PORT_RX_LOS_MAX +}; + +enum sfp_sysfs_tx_disable_attributes { + PORT1_TX_DISABLE = PORT_RX_LOS_MAX, + PORT2_TX_DISABLE, + PORT3_TX_DISABLE, + PORT4_TX_DISABLE, + PORT5_TX_DISABLE, + PORT6_TX_DISABLE, + PORT7_TX_DISABLE, + PORT8_TX_DISABLE, + PORT1_TX_DISABLE1, + PORT2_TX_DISABLE1, + PORT3_TX_DISABLE1, + PORT4_TX_DISABLE1, + PORT5_TX_DISABLE1, + PORT6_TX_DISABLE1, + PORT7_TX_DISABLE1, + PORT8_TX_DISABLE1, + PORT1_TX_DISABLE2, + PORT2_TX_DISABLE2, + PORT3_TX_DISABLE2, + PORT4_TX_DISABLE2, + PORT5_TX_DISABLE2, + PORT6_TX_DISABLE2, + PORT7_TX_DISABLE2, + PORT8_TX_DISABLE2, + PORT1_TX_DISABLE3, + PORT2_TX_DISABLE3, + PORT3_TX_DISABLE3, + PORT4_TX_DISABLE3, + PORT5_TX_DISABLE3, + PORT6_TX_DISABLE3, + PORT7_TX_DISABLE3, + PORT8_TX_DISABLE3, + PORT1_TX_DISABLE4, + PORT2_TX_DISABLE4, + PORT3_TX_DISABLE4, + PORT4_TX_DISABLE4, + PORT5_TX_DISABLE4, + PORT6_TX_DISABLE4, + PORT7_TX_DISABLE4, + PORT8_TX_DISABLE4, + PORT1_TX_DISABLE_ALL, + PORT2_TX_DISABLE_ALL, + PORT3_TX_DISABLE_ALL, + PORT4_TX_DISABLE_ALL, + PORT5_TX_DISABLE_ALL, + PORT6_TX_DISABLE_ALL, + PORT7_TX_DISABLE_ALL, + PORT8_TX_DISABLE_ALL, + PORT_TX_DISABLE_MAX +}; + +enum sfp_sysfs_tx_fault_attributes { + PORT1_TX_FAULT = PORT_TX_DISABLE_MAX, + PORT2_TX_FAULT, + PORT3_TX_FAULT, + PORT4_TX_FAULT, + PORT5_TX_FAULT, + PORT6_TX_FAULT, + PORT7_TX_FAULT, + PORT8_TX_FAULT, + PORT1_TX_FAULT1, + PORT2_TX_FAULT1, + PORT3_TX_FAULT1, + PORT4_TX_FAULT1, + PORT5_TX_FAULT1, + PORT6_TX_FAULT1, + PORT7_TX_FAULT1, + PORT8_TX_FAULT1, + PORT1_TX_FAULT2, + PORT2_TX_FAULT2, + PORT3_TX_FAULT2, + PORT4_TX_FAULT2, + PORT5_TX_FAULT2, + PORT6_TX_FAULT2, + PORT7_TX_FAULT2, + PORT8_TX_FAULT2, + PORT1_TX_FAULT3, + PORT2_TX_FAULT3, + PORT3_TX_FAULT3, + PORT4_TX_FAULT3, + PORT5_TX_FAULT3, + PORT6_TX_FAULT3, + PORT7_TX_FAULT3, + PORT8_TX_FAULT3, + PORT1_TX_FAULT4, + PORT2_TX_FAULT4, + PORT3_TX_FAULT4, + PORT4_TX_FAULT4, + PORT5_TX_FAULT4, + PORT6_TX_FAULT4, + PORT7_TX_FAULT4, + PORT8_TX_FAULT4, + PORT_TX_FAULT_MAX +}; + +enum sfp_sysfs_eeprom_attributes { + PORT1_EEPROM, + PORT2_EEPROM, + PORT3_EEPROM, + PORT4_EEPROM, + PORT5_EEPROM, + PORT6_EEPROM, + PORT7_EEPROM, + PORT8_EEPROM, + PORT_EEPROM_MAX +}; + +enum sfp_sysfs_ddm_implemented_attributes { + PORT1_DDM_IMPLEMENTED, + PORT2_DDM_IMPLEMENTED, + PORT3_DDM_IMPLEMENTED, + PORT4_DDM_IMPLEMENTED, + PORT5_DDM_IMPLEMENTED, + PORT6_DDM_IMPLEMENTED, + PORT7_DDM_IMPLEMENTED, + PORT8_DDM_IMPLEMENTED, + PORT_DDM_IMPLEMENTED_MAX +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + DEBUG_PRINT("show_port_number port number:%d", data->port + attr->index); + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port + attr->index)); +} + +static struct sfp_port_data *sfp_update_present(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {0x05}; + + DEBUG_PRINT("Starting sfp present status update"); + mutex_lock(&data->update_lock); + + /* Read present status of port 1~32 */ + data->present = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = i2c_smbus_read_byte_data(client, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld(0x5f) reg(0x%x) err %d", regs[i], status); + goto exit; + } + + DEBUG_PRINT("Present status = 0x%llx", data->present); + data->present |= (u64)status << (i*8); + } + + DEBUG_PRINT("Present status = 0x%llx", data->present); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static struct sfp_port_data *sfp_update_tx_rx_status(struct device *dev) +{ + return NULL; +} + +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + return 0; +} + +static int sfp_is_port_present(struct i2c_client *client, int port) +{ + struct sfp_port_data *data = sfp_update_present(client); + return (data->present & BIT_INDEX(port)) ? 1 : 0; +} + +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + + if ((attr->index >= PORT1_PRESENT_ALL) && (attr->index <= PORT8_PRESENT_ALL)) { + + } + + /* PRESENT */ + return sprintf(buf, "%d\n", sfp_is_port_present(client, attr->index)); +} + +static struct sfp_port_data *sfp_update_port_type(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 buf = 0; + int status; + + mutex_lock(&data->update_lock); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + { + status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + if (buf != SFF8024_DEVICE_ID_SFP) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + status = sfp_eeprom_read(data->client, SFF8472_10G_ETH_COMPLIANCE_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("sfp port type (0x3) data = (0x%x)", buf); + data->port_type = buf & SFF8472_10G_BASE_MASK ? OOM_DRIVER_PORT_TYPE_SFP_PLUS : OOM_DRIVER_PORT_TYPE_SFP; + break; + } + case DRIVER_TYPE_QSFP: + { + status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("qsfp port type (0x0) buf = (0x%x)", buf); + switch (buf) { + case SFF8024_DEVICE_ID_QSFP: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP; + break; + case SFF8024_DEVICE_ID_QSFP_PLUS: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + case SFF8024_DEVICE_ID_QSFP28: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + default: + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + break; + } + default: + break; + } + + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_type(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + + if (!sfp_is_port_present(client, attr->index)) { + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_type(dev); + return sprintf(buf, "%d\n", data->port_type); +} + + +static struct sfp_port_data *sfp_update_port_reset(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {0x7}; + + mutex_lock(&data->update_lock); + + /* Read reset status of port 1~32 */ + data->port_reset = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = i2c_smbus_read_byte_data(client, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld(0x60) reg(0x%x) err %d", regs[i], status); + goto exit; + } + + DEBUG_PRINT("reset status = 0x%x", status); + data->port_reset |= (u64)status << (i*8); + } + + DEBUG_PRINT("reset status = 0x%llx", data->port_reset); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_reset(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + int is_reset = 0; + + if (!sfp_is_port_present(client, attr->index)) { + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_reset(client); + is_reset = (data->port_reset & BIT_INDEX(attr->index))? 0 : 1; + + return sprintf(buf, "%d\n", is_reset); +} + +static ssize_t sfp_set_port_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 cpld_reg = 0, cpld_val = 0; /*, cpld_bit = 0; //remove unused variable */ + long is_reset; + int error; + + error = kstrtol(buf, 10, &is_reset); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + cpld_reg = 0x07; + + cpld_val = i2c_smbus_read_byte_data(client, cpld_reg); + + DEBUG_PRINT("current cpld reg = 0x%x value = 0x%x", cpld_reg, cpld_val); + + /* Update reset status. CPLD defined 0 is reset state, 1 is normal state. + * is_reset: 0 is not reset. 1 is reset. + */ + if (is_reset == 0) { + data->port_reset |= BIT_INDEX(attr->index); + } + else { + data->port_reset &= ~BIT_INDEX(attr->index); + } + + alpha_i2c_cpld_write(0x5f, cpld_reg, cpld_val); + DEBUG_PRINT("write cpld reg = 0x%x value = 0x%x", cpld_reg, cpld_val); + + mutex_unlock(&data->update_lock); + + return count; +} + +static struct sfp_port_data *qsfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i, status = -1; + u8 buf = 0; + u8 reg[] = {SFF8436_TX_FAULT_ADDR, SFF8436_TX_DISABLE_ADDR, SFF8436_RX_LOS_ADDR}; + + if (time_before(jiffies, data->qsfp->last_updated + HZ + HZ / 2) && data->qsfp->valid) { + return data; + } + + dev_dbg(dev, "Starting sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->qsfp->valid = 0; + memset(data->qsfp->status, 0, sizeof(data->qsfp->status)); + + /* Notify device to update tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(data->client, reg[i], &buf, sizeof(buf)); + if (status < 0) { + goto exit; + } + } + msleep(200); + + /* Read actual tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(data->client, reg[i], &buf, sizeof(buf)); + if (status < 0) { + goto exit; + } + + DEBUG_PRINT("qsfp reg(0x%x) status = (0x%x)", reg[i], data->qsfp->status[i]); + data->qsfp->status[i] = (buf & 0xF); + } + + data->qsfp->valid = 1; + data->qsfp->last_updated = jiffies; + mutex_unlock(&data->update_lock); + return data; + +exit: + mutex_unlock(&data->update_lock); + return NULL; +} + +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (!sfp_is_port_present(client, attr->index)) { + return -ENODEV; + } + + data = qsfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + + if ((attr->index >= PORT1_TX_FAULT1) && (attr->index <= PORT8_TX_FAULT4)){ + val = (data->qsfp->status[2] & BIT_INDEX(attr->index - PORT1_TX_FAULT1)) ? 1 : 0; + } + else if ((attr->index >= PORT1_TX_DISABLE1) && (attr->index <= PORT8_TX_DISABLE4)){ + val = (data->qsfp->status[1] & BIT_INDEX(attr->index - PORT1_TX_DISABLE1)) ? 1 : 0; + } + else if ((attr->index >= PORT1_TX_DISABLE_ALL) && (attr->index <= PORT8_TX_DISABLE_ALL)){ + val = ((data->qsfp->status[1] & 0xF) == 0xF) ? 1 : 0; + } + if ((attr->index >= PORT1_RX_LOS1) && (attr->index <= PORT8_RX_LOS4)){ + val = (data->qsfp->status[0] & BIT_INDEX(attr->index - PORT1_RX_LOS1)) ? 1 : 0; + } + + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + long disable; + int result; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data; + + result = kstrtol(buf, 10, &disable); + if (result) { + return result; + } + + data = qsfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + + mutex_lock(&data->update_lock); + + if((attr->index >= PORT1_TX_DISABLE_ALL) && (attr->index <= PORT8_TX_DISABLE_ALL)){ + DEBUG_PRINT ("disable:%ld %d==TX_DISABLE_ALL %u\r\n", disable, attr->index, data->qsfp->status[1]); + data->qsfp->status[1] = disable? 0xF:0; + } + else{ + if (disable) { + data->qsfp->status[1] |= (1 << (attr->index - PORT1_TX_DISABLE1)); + } + else { + data->qsfp->status[1] &= ~(1 << (attr->index - PORT1_TX_DISABLE1)); + } + } + + DEBUG_PRINT("index = (%d), status = (0x%x)", attr->index, data->qsfp->status[1]); + result = sfp_eeprom_write(client, SFF8436_TX_DISABLE_ADDR, &data->qsfp->status[1], sizeof(data->qsfp->status[1])); + mutex_unlock(&data->update_lock); + return count; +} + +static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + char ddm; + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (!sfp_is_port_present(client, attr->index)) { + return -ENODEV; + } + + status = sfp_eeprom_read(data->client, SFF8472_DIAG_MON_TYPE_ADDR, &ddm, sizeof(ddm)); + if (status < 0) { + return -EIO; + } + + return sprintf(buf, "%d\n", (ddm & SFF8472_DIAG_MON_TYPE_DDM_MASK) ? 1 : 0); +} + +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0, index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data; + + data = sfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + if ((attr->index >= PORT1_TX_FAULT) && (attr->index <= PORT8_TX_FAULT)){ + index = 0; + } + else if ((attr->index >= PORT1_TX_DISABLE) && (attr->index <= PORT8_TX_DISABLE)){ + index = 1; + } + if ((attr->index >= PORT1_RX_LOS) && (attr->index <= PORT8_RX_LOS)){ + index = 2; + } + + val = (data->ddm->status[index] & BIT_INDEX(attr->index)) ? 1 : 0; + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_show_eeprom(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + char devfile[96]; + struct file *sfd; + int i2c_index = 0; + int status, result, offset = 0xb; + int rdlen, rc; + mm_segment_t old_fs; + char buffer[256]; + + if (!sfp_is_port_present(client, attr->index)) { + return 0; + } + + if(strcmp(client->name, "sfpcpld1") == 0) + i2c_index = 14; + else if(strcmp(client->name, "sfpcpld9") == 0) + i2c_index = 15; + else if(strcmp(client->name, "sfpcpld17") == 0) + i2c_index = 16; + else if(strcmp(client->name, "sfpcpld25") == 0) + i2c_index = 17; + + snprintf(devfile, sizeof(devfile), "/sys/bus/i2c/devices/%d-0050/sfp_eeprom", i2c_index); + + /* Set module select register */ + result = i2c_smbus_write_byte_data(client, offset, BIT_INDEX(attr->index)); + if (result < 0) { + dev_info(&client->dev, "i2c_smbus_write_byte_data faill(%d)", result); + } + + /* Read SFP EEPROM */ + sfd = filp_open(devfile, O_RDONLY, 0); + if (IS_ERR(sfd)) { + dev_info(&client->dev, "Failed to open file(%s)#%d", devfile, __LINE__); + return 0; + } + + if(!(sfd->f_op) || !(sfd->f_op->read) ) { + dev_info(&client->dev, "file %s cann't readable ?\n", devfile); + return 0; + } + + old_fs = get_fs(); + set_fs(KERNEL_DS); + rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); + if (rdlen == 0) { + dev_info(&client->dev, "File(%s) empty!\n", devfile); + rc = 0; + goto exit; + } + + rc = sizeof(buffer); + memcpy(buf, buffer, rc); + + /* Reset module select register */ + result = i2c_smbus_write_byte_data(client, offset, 0); + if (result < 0) { + dev_info(&client->dev, "i2c_smbus_write_byte_data faill(%d)", result); + } + +exit: + set_fs(old_fs); + filp_close(sfd, 0); + + return rc; +} + +#if 0 +static ssize_t qsfp_set_eeprom(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + DEBUG_PRINT("data->port:%d attr index:%d", data->port, attr->index); + return 1; +} +#endif + +/* SFP/QSFP common attributes for sysfs */ +#define DECLARE_PORT_NUMBER_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT1##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT2##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT3##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT4##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT5##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT6##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT7##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT8##_NUMBER); +#define DECLARE_PORT_NUMBER_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_port_number.dev_attr.attr, +DECLARE_PORT_NUMBER_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_IS_PRESENT_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_is_present, S_IRUGO, show_present, NULL, PORT##PORT1##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_is_present, S_IRUGO, show_present, NULL, PORT##PORT2##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_is_present, S_IRUGO, show_present, NULL, PORT##PORT3##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_is_present, S_IRUGO, show_present, NULL, PORT##PORT4##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_is_present, S_IRUGO, show_present, NULL, PORT##PORT5##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_is_present, S_IRUGO, show_present, NULL, PORT##PORT6##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_is_present, S_IRUGO, show_present, NULL, PORT##PORT7##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_is_present, S_IRUGO, show_present, NULL, PORT##PORT8##_PRESENT); +#define DECLARE_PORT_IS_PRESENT_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_is_present.dev_attr.attr, +DECLARE_PORT_IS_PRESENT_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_TYPE_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT1##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT2##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT3##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT4##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT5##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT6##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT7##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT8##_TYPE); +#define DECLARE_PORT_TYPE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_port_type.dev_attr.attr, +DECLARE_PORT_TYPE_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_RESET_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT1##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT2##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT3##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT4##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT5##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT6##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT7##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT8##_RESET); +#define DECLARE_PORT_RESET_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_port_reset.dev_attr.attr, +DECLARE_PORT_RESET_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +/* QSFP attributes for sysfs */ +#define DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT1##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT2##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT3##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT4##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT5##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT6##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT7##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT8##_RX_LOS##INDEX); +#define DECLARE_PORT_RX_LOSn_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_rx_los##INDEX.dev_attr.attr, +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT1##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT2##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT3##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT4##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT5##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT6##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT7##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT8##_TX_DISABLE##INDEX); + +#define DECLARE_PORT_TX_DISABLEn_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_tx_disable##INDEX.dev_attr.attr, +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT1##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT2##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT3##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT4##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT5##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT6##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT7##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT8##_TX_FAULT##INDEX); +#define DECLARE_PORT_TX_FAULTn_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_tx_fault##INDEX.dev_attr.attr, +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_EEPROMn_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT1##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT2##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT3##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT4##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT5##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT6##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT7##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT8##_EEPROM); +#define DECLARE_PORT_EEPROMTn_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_eeprom.dev_attr.attr, +DECLARE_PORT_EEPROMn_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +static struct attribute *qsfp_attributes[] = { + DECLARE_PORT_NUMBER_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TYPE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_IS_PRESENT_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RESET_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RX_LOSn_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RX_LOSn_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RX_LOSn_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RX_LOSn_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_DISABLEn_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_DISABLEn_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_DISABLEn_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_DISABLEn_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_FAULTn_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_FAULTn_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_FAULTn_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_FAULTn_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_EEPROMTn_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + NULL +}; + + +/* SFP msa attributes for sysfs */ +static struct attribute *sfp_msa_attributes[] = { + DECLARE_PORT_NUMBER_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TYPE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_IS_PRESENT_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RESET_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + NULL +}; + +/* SFP ddm attributes for sysfs */ +#define DECLARE_RX_LOS_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT1##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT2##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT3##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT4##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT5##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT6##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT7##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT8##_RX_LOS); +#define DECLARE_RX_LOS_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_rx_los.dev_attr.attr, +DECLARE_RX_LOS_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_TX_DISABLE_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT1##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT2##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT3##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT4##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT5##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT6##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT7##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT8##_TX_DISABLE); +#define DECLARE_TX_DISABLE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_tx_disable.dev_attr.attr, +DECLARE_TX_DISABLE_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_TX_FAULT_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT1##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT2##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT3##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT4##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT5##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT6##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT7##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT8##_TX_FAULT); +#define DECLARE_TX_FAULT_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_tx_fault.dev_attr.attr, +DECLARE_TX_FAULT_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +static struct attribute *sfp_ddm_attributes[] = { + DECLARE_RX_LOS_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_TX_DISABLE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_TX_FAULT_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + NULL +}; + +static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return data_len; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_write_byte_data(client, command, *data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return 1; +#endif + + +} + + +static ssize_t sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; +} + + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", (int)off, (int)count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return sfp_port_write(data, buf, off, count); +} + +static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + /* result = data_len; */ + +abort: + return result; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_read_byte_data(client, command); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, result); + goto abort; + } + + *data = (u8)result; + result = 1; + +abort: + return result; +#endif +} + +static ssize_t sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; + +} + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", (int)off, (int)count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return sfp_port_read(data, buf, off, count); +} + +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; + eeprom->size = EEPROM_SIZE; + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + return 0; +} + +static const struct attribute_group sfp_msa_group = { + .attrs = sfp_msa_attributes, +}; + +static int sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} + +static int sfp_msa_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_msa_data **data) +{ + int status; + struct sfp_msa_data *msa; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + msa = kzalloc(sizeof(struct sfp_msa_data), GFP_KERNEL); + if (!msa) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_msa_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &msa->eeprom.bin); + if (status) { + dev_info(&client->dev, "sfp msa '%s' (sfp_sysfs_eeprom_init fail...)\n", client->name); + /* goto exit_remove; */ + } + + *data = msa; + dev_info(&client->dev, "sfp msa '%s'\n", client->name); + + return 0; + +/* exit_remove: */ + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); +exit_free: + kfree(msa); +exit: + + return status; +} + +static const struct attribute_group sfp_ddm_group = { + .attrs = sfp_ddm_attributes, +}; + +static int sfp_ddm_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_ddm_data **data) +{ + int status; + struct sfp_ddm_data *ddm; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + ddm = kzalloc(sizeof(struct sfp_ddm_data), GFP_KERNEL); + if (!ddm) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_ddm_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &ddm->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = ddm; + dev_info(&client->dev, "sfp ddm '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); +exit_free: + kfree(ddm); +exit: + + return status; +} + +static const struct attribute_group qsfp_group = { + .attrs = qsfp_attributes, +}; + +static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + goto exit; + } + + if (client->addr == SFP_CPLD_I2C_ADDR){ + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } + } + + if (client->addr == SFP_EEPROM_A0_I2C_ADDR){ + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); + if (status) { + goto exit_remove; + } + } + + /* Bring QSFPs out of reset */ + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &qsfp_group); +exit_free: + kfree(qsfp); +exit: + + return status; +} + +static int sfp_device_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct sfp_port_data *data = NULL; + + data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + data->client = client; + + if ((client->addr != SFP_EEPROM_A0_I2C_ADDR) && (client->addr != SFP_CPLD_I2C_ADDR)){ + DEBUG_PRINT("client->addr:0x%0x\n", client->addr); + return -ENODEV; + } + + data->driver_type = DRIVER_TYPE_QSFP; + return qsfp_probe(client, dev_id, &data->qsfp); +} + +static int sfp_msa_remove(struct i2c_client *client, struct sfp_msa_data *data) +{ + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + if (client->addr == SFP_CPLD_I2C_ADDR) + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); + kfree(data); + return 0; +} + +static int sfp_ddm_remove(struct i2c_client *client, struct sfp_ddm_data *data) +{ + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + if (client->addr == SFP_CPLD_I2C_ADDR) + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); + kfree(data); + return 0; +} + +static int qfp_remove(struct i2c_client *client, struct qsfp_data *data) +{ + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + if (client->addr == SFP_CPLD_I2C_ADDR) + sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + return 0; +} + +static int sfp_device_remove(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + return sfp_msa_remove(client, data->msa); + case DRIVER_TYPE_SFP_DDM: + return sfp_ddm_remove(client, data->ddm); + case DRIVER_TYPE_QSFP: + return qfp_remove(client, data->qsfp); + } + + return 0; +} + +static struct i2c_driver sfp_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = sfp_device_probe, + .remove = sfp_device_remove, + .id_table = sfp_device_id, + .address_list = normal_i2c, +}; + +static int __init sfp_init(void) +{ + return i2c_add_driver(&sfp_driver); +} + +static void __exit sfp_exit(void) +{ + i2c_del_driver(&sfp_driver); +} + +MODULE_AUTHOR("Philip Wang "); +MODULE_DESCRIPTION("alphanetworks snh60a0-320fv2 driver"); +MODULE_LICENSE("GPL"); + +module_init(sfp_init); +module_exit(sfp_exit); + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_onie_eeprom.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_onie_eeprom.c new file mode 100644 index 000000000000..d8e246ec2a86 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_onie_eeprom.c @@ -0,0 +1,268 @@ +/* + * A driver for alphanetworks_snh60a0_320fv2 onie eeprom + * + * Copyright (C) 2018 Alphanetworks Technology Corporation. + * Robin Chen + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define EEPROM_SIZE 256 + +#define SYS_LED_REG 0x8 +#define FAN12_LED_REG 0x9 +#define FAN34_LED_REG 0xA +#define FAN56_LED_REG 0xB +#define SYS_RESET1_REG 0x2 + +#define SYS_LOCATOR_LED_BITS 0x01 +#define SYS_PWR_LED_BITS 0x0E +#define SYS_STATUS_LED_BITS 0x70 +#define FAN135_LED_BITS 0x07 +#define FAN246_LED_BITS 0x38 + + +extern int alpha_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int alpha_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +static ssize_t onie_read(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t onie_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for alphanetworks_snh60a0_320fv2_onie_eeprom */ +static const unsigned short normal_i2c[] = { 0x56, I2C_CLIENT_END }; + + +enum sysfs_onie_attributes { + ONIE_RW, +}; + +static SENSOR_DEVICE_ATTR(eeprom, (0660), onie_read, onie_write, ONIE_RW); + +static struct attribute *alphanetworks_snh60a0_320fv2_onie_attributes[] = { + &sensor_dev_attr_eeprom.dev_attr.attr, + NULL +}; + +static const struct attribute_group alphanetworks_snh60a0_320fv2_onie_group = { + .attrs = alphanetworks_snh60a0_320fv2_onie_attributes, +}; + + +static ssize_t onie_read(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0, res = 0; + u8 command; + struct i2c_client *client = to_i2c_client(dev); + __u8 read_write; + unsigned short offset = 0; + union i2c_smbus_data temp; + char rbuf[EEPROM_SIZE]; + + for( offset=0 ; offset < EEPROM_SIZE ; ++offset ) + { + read_write = I2C_SMBUS_WRITE; + offset = offset & 0x3fff; + temp.byte = (u8)offset; + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 2, &temp); + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 2, &temp); + + read_write = I2C_SMBUS_READ; + temp.byte = 0xaa; + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 1, &temp); + if (!res) + { + res = temp.byte; + rbuf[offset] = (char)temp.byte; + } + + read_write = I2C_SMBUS_READ; + temp.byte = 0xbb; + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 1, &temp); + if (!res) + { + res = temp.byte; + } + } + + memcpy(buf, rbuf, EEPROM_SIZE); + return EEPROM_SIZE; +} + +static ssize_t onie_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + int error, write, command, read; + + error = kstrtoint(buf, 10, &write); + if (error) + return error; + + if (write < 0 || write > 255) + return -EINVAL; + + /* Not support yet */ + + return count; +} + + + +static void alpha_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void alpha_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int onie_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + status = sysfs_create_group(&client->dev.kobj, &alphanetworks_snh60a0_320fv2_onie_group); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + alpha_i2c_cpld_add_client(client); + + return 0; + +exit: + return status; +} + +static int onie_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_group(&client->dev.kobj, &alphanetworks_snh60a0_320fv2_onie_group); + alpha_i2c_cpld_remove_client(client); + + return 0; +} + +static const struct i2c_device_id onie_eeprom_id[] = { + { "snh60a0_onie_eeprom", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, onie_eeprom_id); + +static struct i2c_driver onie_eeprom_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "snh60a0_onie_eeprom", + }, + .probe = onie_eeprom_probe, + .remove = onie_eeprom_remove, + .id_table = onie_eeprom_id, + .address_list = normal_i2c, +}; + + +static int __init onie_eeprom_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&onie_eeprom_driver); +} + +static void __exit onie_eeprom_exit(void) + +{ + i2c_del_driver(&onie_eeprom_driver); +} + + +MODULE_AUTHOR("Alpha-SID6"); +MODULE_DESCRIPTION("onie eeprom driver"); +MODULE_LICENSE("GPL"); + +module_init(onie_eeprom_init); +module_exit(onie_eeprom_exit); diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_power_cpld.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_power_cpld.c new file mode 100644 index 000000000000..c9a9104d266f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_power_cpld.c @@ -0,0 +1,507 @@ +/* + * A hwmon driver for the alphanetworks_snh60a0_320fv2_power_cpld + * + * Copyright (C) 2018 Alphanetworks Technology Corporation. + * Robin Chen + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define DRIVER_NAME "snh60a0_power_cpld" +#define PSU1_STATUS_REG 0x3 +#define PSU2_STATUS_REG 0x4 +#define FAN_PWM_REG 0x23 + +#define PSU_PRESENT_BIT 0x4 +#define PSU_POWER_BIT 0x2 +#define FAN_PRESENT_BIT 0x2 + + +static ssize_t psu_show_status(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t fan_pwm_show(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t set_fan_pwm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); +static ssize_t fan_show_status(struct device *dev, struct device_attribute *attr, char *buf); + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for alphanetworks_snh60a0_320fv2_power_cpld */ +static const unsigned short normal_i2c[] = { 0x5E, I2C_CLIENT_END }; + +struct alphanetworks_snh60a0_320fv2_pwr_cpld_data { + struct device *hwmon_dev; + struct mutex update_lock; + char model_name[9]; /* Model name, read from eeprom */ +}; + + +enum sysfs_psu_attributes { + PSU1_PRESENT, + PSU2_PRESENT, + PSU1_POWER_GOOD, + PSU2_POWER_GOOD, + FAN_PWM, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, + FAN6_FAULT, + FAN1_PRESENT=0x10, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN6_PRESENT, + FAN1_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN6_FRONT_SPEED_RPM, + FAN6_REAR_SPEED_RPM, +}; + +static SENSOR_DEVICE_ATTR(psu1_present, S_IRUGO, psu_show_status, NULL, PSU1_PRESENT); +static SENSOR_DEVICE_ATTR(psu2_present, S_IRUGO, psu_show_status, NULL, PSU2_PRESENT); +static SENSOR_DEVICE_ATTR(psu1_power_good, S_IRUGO, psu_show_status, NULL, PSU1_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu2_power_good, S_IRUGO, psu_show_status, NULL, PSU2_POWER_GOOD); +static SENSOR_DEVICE_ATTR(fan_pwm, (0660), fan_pwm_show, set_fan_pwm, FAN_PWM); +static SENSOR_DEVICE_ATTR(fan1_present, S_IRUGO, fan_show_status, NULL, FAN1_PRESENT); +static SENSOR_DEVICE_ATTR(fan2_present, S_IRUGO, fan_show_status, NULL, FAN2_PRESENT); +static SENSOR_DEVICE_ATTR(fan3_present, S_IRUGO, fan_show_status, NULL, FAN3_PRESENT); +static SENSOR_DEVICE_ATTR(fan4_present, S_IRUGO, fan_show_status, NULL, FAN4_PRESENT); +static SENSOR_DEVICE_ATTR(fan5_present, S_IRUGO, fan_show_status, NULL, FAN5_PRESENT); +static SENSOR_DEVICE_ATTR(fan6_present, S_IRUGO, fan_show_status, NULL, FAN6_PRESENT); +static SENSOR_DEVICE_ATTR(fan1_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN1_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan2_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN2_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan3_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN3_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan4_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN4_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan5_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN5_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan6_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN6_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan1_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN1_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan2_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN2_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan3_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN3_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan4_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN4_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan5_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN5_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan6_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN6_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, fan_show_status, NULL, FAN1_FAULT); static SENSOR_DEVICE_ATTR(fan11_fault, S_IRUGO, fan_show_status, NULL, FAN1_FAULT); +static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, fan_show_status, NULL, FAN2_FAULT); static SENSOR_DEVICE_ATTR(fan12_fault, S_IRUGO, fan_show_status, NULL, FAN2_FAULT); +static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, fan_show_status, NULL, FAN3_FAULT); static SENSOR_DEVICE_ATTR(fan13_fault, S_IRUGO, fan_show_status, NULL, FAN3_FAULT); +static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, fan_show_status, NULL, FAN4_FAULT); static SENSOR_DEVICE_ATTR(fan14_fault, S_IRUGO, fan_show_status, NULL, FAN4_FAULT); +static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, fan_show_status, NULL, FAN5_FAULT); static SENSOR_DEVICE_ATTR(fan15_fault, S_IRUGO, fan_show_status, NULL, FAN5_FAULT); +static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, fan_show_status, NULL, FAN6_FAULT); static SENSOR_DEVICE_ATTR(fan16_fault, S_IRUGO, fan_show_status, NULL, FAN6_FAULT); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, fan_show_status, NULL, FAN1_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan11_input, S_IRUGO, fan_show_status, NULL, FAN1_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, fan_show_status, NULL, FAN2_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan12_input, S_IRUGO, fan_show_status, NULL, FAN2_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, fan_show_status, NULL, FAN3_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan13_input, S_IRUGO, fan_show_status, NULL, FAN3_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, fan_show_status, NULL, FAN4_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan14_input, S_IRUGO, fan_show_status, NULL, FAN4_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, fan_show_status, NULL, FAN5_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan15_input, S_IRUGO, fan_show_status, NULL, FAN5_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, fan_show_status, NULL, FAN6_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan16_input, S_IRUGO, fan_show_status, NULL, FAN6_REAR_SPEED_RPM); + + +static struct attribute *alphanetworks_snh60a0_320fv2_psu_attributes[] = { + &sensor_dev_attr_psu1_present.dev_attr.attr, + &sensor_dev_attr_psu2_present.dev_attr.attr, + &sensor_dev_attr_psu1_power_good.dev_attr.attr, + &sensor_dev_attr_psu2_power_good.dev_attr.attr, + &sensor_dev_attr_fan_pwm.dev_attr.attr, + &sensor_dev_attr_fan1_present.dev_attr.attr, + &sensor_dev_attr_fan2_present.dev_attr.attr, + &sensor_dev_attr_fan3_present.dev_attr.attr, + &sensor_dev_attr_fan4_present.dev_attr.attr, + &sensor_dev_attr_fan5_present.dev_attr.attr, + &sensor_dev_attr_fan6_present.dev_attr.attr, + &sensor_dev_attr_fan1_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan2_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan3_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan4_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan5_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan6_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan1_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan2_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan3_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan4_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan5_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan6_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan1_fault.dev_attr.attr, &sensor_dev_attr_fan11_fault.dev_attr.attr, + &sensor_dev_attr_fan2_fault.dev_attr.attr, &sensor_dev_attr_fan12_fault.dev_attr.attr, + &sensor_dev_attr_fan3_fault.dev_attr.attr, &sensor_dev_attr_fan13_fault.dev_attr.attr, + &sensor_dev_attr_fan4_fault.dev_attr.attr, &sensor_dev_attr_fan14_fault.dev_attr.attr, + &sensor_dev_attr_fan5_fault.dev_attr.attr, &sensor_dev_attr_fan15_fault.dev_attr.attr, + &sensor_dev_attr_fan6_fault.dev_attr.attr, &sensor_dev_attr_fan16_fault.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, &sensor_dev_attr_fan11_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, &sensor_dev_attr_fan12_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, &sensor_dev_attr_fan13_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, &sensor_dev_attr_fan14_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, &sensor_dev_attr_fan15_input.dev_attr.attr, + &sensor_dev_attr_fan6_input.dev_attr.attr, &sensor_dev_attr_fan16_input.dev_attr.attr, + NULL +}; + +static const struct attribute_group alphanetworks_snh60a0_320fv2_psu_group = { + .attrs = alphanetworks_snh60a0_320fv2_psu_attributes, +}; + + +static ssize_t psu_show_status(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0, res = 0; + u8 command; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + + switch(sda->index) { + case PSU1_PRESENT: + case PSU1_POWER_GOOD: + command = PSU1_STATUS_REG; + break; + case PSU2_PRESENT: + case PSU2_POWER_GOOD: + command = PSU2_STATUS_REG; + break; + } + + val = i2c_smbus_read_byte_data(client, command); + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + switch(sda->index) { + case PSU1_PRESENT: + case PSU2_PRESENT: + res = (val & PSU_PRESENT_BIT ? 1 : 0 ); + break; + case PSU1_POWER_GOOD: + case PSU2_POWER_GOOD: + res = (val & PSU_POWER_BIT ? 1 : 0 ); + break; + } + + return sprintf(buf, "%d\n", res); +} + +static ssize_t fan_pwm_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, FAN_PWM_REG); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d", val); +} + +static ssize_t set_fan_pwm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 0xFF) + return -EINVAL; + + i2c_smbus_write_byte_data(client, FAN_PWM_REG, value); + + return count; +} + +static ssize_t fan_show_status(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + struct i2c_client *client = to_i2c_client(dev); + // struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev); + ssize_t ret = 0; + int val, val2; + + switch (sda->index) { + /* case FAN_DUTY_CYCLE_PERCENTAGE: */ + /* { */ + /* u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); */ + /* ret = sprintf(buf, "%u\n", duty_cycle); */ + /* break; */ + /* } */ + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + val = i2c_smbus_read_byte_data(client, sda->index); + ret = sprintf(buf, "%d\n", val * 150); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + val = i2c_smbus_read_byte_data(client, sda->index); + ret = sprintf(buf, "%d\n", (val & FAN_PRESENT_BIT) ? 1 : 0); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + val = i2c_smbus_read_byte_data(client, (sda->index - FAN1_FAULT)*2 + FAN1_FRONT_SPEED_RPM); + val2 = i2c_smbus_read_byte_data(client, (sda->index - FAN1_FAULT)*2 + FAN1_REAR_SPEED_RPM); + ret = sprintf(buf, "%d\n", (val|val2) ? 0 : 1); + break; + default: + break; + } + + return ret; +} + + +static void alpha_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void alpha_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int alpha_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct alphanetworks_snh60a0_320fv2_pwr_cpld_data* data; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct alphanetworks_snh60a0_320fv2_pwr_cpld_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + status = sysfs_create_group(&client->dev.kobj, &alphanetworks_snh60a0_320fv2_psu_group); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + alpha_i2c_cpld_add_client(client); + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit; + } + + dev_info(&client->dev, "%s: pwr_cpld '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit: + return status; +} + +static int alpha_i2c_cpld_remove(struct i2c_client *client) +{ + struct alphanetworks_snh60a0_320fv2_pwr_cpld_data *data = i2c_get_clientdata(client); + sysfs_remove_group(&client->dev.kobj, &alphanetworks_snh60a0_320fv2_psu_group); + alpha_i2c_cpld_remove_client(client); + kfree(data); + + return 0; +} + +static const struct i2c_device_id alpha_i2c_cpld_id[] = { + { DRIVER_NAME, 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, alpha_i2c_cpld_id); + +static struct i2c_driver alpha_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRIVER_NAME, + }, + .probe = alpha_i2c_cpld_probe, + .remove = alpha_i2c_cpld_remove, + .id_table = alpha_i2c_cpld_id, + .address_list = normal_i2c, +}; + +int alpha_i2c_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(alpha_i2c_cpld_read); + +int alpha_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(alpha_i2c_cpld_write); + +static int __init alpha_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&alpha_i2c_cpld_driver); +} + +static void __exit alpha_i2c_cpld_exit(void) +{ + i2c_del_driver(&alpha_i2c_cpld_driver); +} + +static struct dmi_system_id alphanetworks_snh60a0_320fv2_dmi_table[] = { + { + .ident = "Alpha Zion", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alpha"), + DMI_MATCH(DMI_PRODUCT_NAME, "Zion"), + }, + } +}; + +int platform_alphanetworks_snh60a0_320fv2(void) +{ + return dmi_check_system(alphanetworks_snh60a0_320fv2_dmi_table); +} +EXPORT_SYMBOL(platform_alphanetworks_snh60a0_320fv2); + +MODULE_AUTHOR("Alpha-SID6"); +MODULE_DESCRIPTION("alpha_power_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(alpha_i2c_cpld_init); +module_exit(alpha_i2c_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_system_cpld.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_system_cpld.c new file mode 100644 index 000000000000..13c302b35696 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/modules/snh60a0_system_cpld.c @@ -0,0 +1,380 @@ +/* + * A hwmon driver for the alphanetworks_snh60a0_320fv2_system_cpld + * + * Copyright (C) 2018 Alphanetworks Technology Corporation. + * Robin Chen + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define SYS_LED_REG 0x8 +#define FAN12_LED_REG 0x9 +#define FAN34_LED_REG 0xA +#define FAN56_LED_REG 0xB +#define SYS_RESET1_REG 0x2 +#define SWI_CTRL_REG 0x4 + +#define SYS_LOCATOR_LED_BITS 0x01 +#define SYS_PWR_LED_BITS 0x0E +#define SYS_STATUS_LED_BITS 0x70 +#define FAN135_LED_BITS 0x07 +#define FAN246_LED_BITS 0x38 +#define REST_BUTTON_BITS 0x0 + + +extern int alpha_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int alpha_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +static ssize_t sys_led_read(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t sys_led_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for alphanetworks_snh60a0_320fv2_system_cpld */ +static const unsigned short normal_i2c[] = { 0x5F, I2C_CLIENT_END }; + + +enum sysfs_sys_attributes { + SYS_LOCATOR, + SYS_PWR, + SYS_STATUS, + FAN1_LED, + FAN2_LED, + FAN3_LED, + FAN4_LED, + FAN5_LED, + FAN6_LED, + SYS_REST1, + SWI_CTRL, +}; + +static SENSOR_DEVICE_ATTR(sys_locator, (0660), sys_led_read, sys_led_write, SYS_LOCATOR); +static SENSOR_DEVICE_ATTR(sys_pwr, (0660), sys_led_read, sys_led_write, SYS_PWR); +static SENSOR_DEVICE_ATTR(sys_status, (0600), sys_led_read, sys_led_write, SYS_STATUS); +static SENSOR_DEVICE_ATTR(fan1_led, (0660), sys_led_read, sys_led_write, FAN1_LED); +static SENSOR_DEVICE_ATTR(fan2_led, (0660), sys_led_read, sys_led_write, FAN2_LED); +static SENSOR_DEVICE_ATTR(fan3_led, (0660), sys_led_read, sys_led_write, FAN3_LED); +static SENSOR_DEVICE_ATTR(fan4_led, (0660), sys_led_read, sys_led_write, FAN4_LED); +static SENSOR_DEVICE_ATTR(fan5_led, (0660), sys_led_read, sys_led_write, FAN5_LED); +static SENSOR_DEVICE_ATTR(fan6_led, (0660), sys_led_read, sys_led_write, FAN6_LED); +static SENSOR_DEVICE_ATTR(sys_reset1, (0660), sys_led_read, sys_led_write, SYS_REST1); +static SENSOR_DEVICE_ATTR(swi_ctrl, (0660), sys_led_read, NULL, SWI_CTRL); + +static struct attribute *alphanetworks_snh60a0_320fv2_sys_attributes[] = { + &sensor_dev_attr_sys_locator.dev_attr.attr, + &sensor_dev_attr_sys_pwr.dev_attr.attr, + &sensor_dev_attr_sys_status.dev_attr.attr, + &sensor_dev_attr_fan1_led.dev_attr.attr, + &sensor_dev_attr_fan2_led.dev_attr.attr, + &sensor_dev_attr_fan3_led.dev_attr.attr, + &sensor_dev_attr_fan4_led.dev_attr.attr, + &sensor_dev_attr_fan5_led.dev_attr.attr, + &sensor_dev_attr_fan6_led.dev_attr.attr, + &sensor_dev_attr_sys_reset1.dev_attr.attr, + &sensor_dev_attr_swi_ctrl.dev_attr.attr, + NULL +}; + +static const struct attribute_group alphanetworks_snh60a0_320fv2_sys_group = { + .attrs = alphanetworks_snh60a0_320fv2_sys_attributes, +}; + + +static ssize_t sys_led_read(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0, res = 0; + u8 command; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + + switch(sda->index) { + case SYS_LOCATOR: + case SYS_PWR: + case SYS_STATUS: + command = SYS_LED_REG; + break; + case FAN1_LED: + case FAN2_LED: + case FAN3_LED: + case FAN4_LED: + case FAN5_LED: + case FAN6_LED: + command = FAN12_LED_REG + (sda->index - FAN1_LED)/2; + break; + case SYS_REST1: + command = SYS_RESET1_REG; + break; + case SWI_CTRL: + command = SWI_CTRL_REG; + break; + } + + val = i2c_smbus_read_byte_data(client, command); + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + switch(sda->index) { + case SYS_LOCATOR: + res = (val & SYS_LOCATOR_LED_BITS) >> 0; + break; + case SYS_PWR: + res = (val & SYS_PWR_LED_BITS) >> 1; + break; + case SYS_STATUS: + res = (val & SYS_STATUS_LED_BITS) >> 4; + break; + case FAN1_LED: + case FAN3_LED: + case FAN5_LED: + res = (val & FAN135_LED_BITS) >> 0; + break; + case FAN2_LED: + case FAN4_LED: + case FAN6_LED: + res = (val & FAN246_LED_BITS) >> 3; + break; + case SYS_REST1: + res = val; + break; + case SWI_CTRL: + res = (val & REST_BUTTON_BITS) >> 0; + break; + } + + return sprintf(buf, "%d\n", res); +} + +static ssize_t sys_led_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + int error, write, command, read; + + error = kstrtoint(buf, 10, &write); + if (error) + return error; + + + switch(sda->index) { + case SYS_LOCATOR: + if(write < 0 || write > 2) + return -EINVAL; + case SYS_PWR: + case SYS_STATUS: + if (write < 0 || write > 7) + return -EINVAL; + command = SYS_LED_REG; + break; + case FAN1_LED: + case FAN2_LED: + case FAN3_LED: + case FAN4_LED: + case FAN5_LED: + case FAN6_LED: + if (write < 0 || write > 7) + return -EINVAL; + command = FAN12_LED_REG + (sda->index - FAN1_LED)/2; + break; + case SYS_REST1: + if (write < 0 || write > 15) + return -EINVAL; + command = SYS_RESET1_REG; + break; + } + + read = i2c_smbus_read_byte_data(client, command); + if (read < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, read); + } + + switch(sda->index) { + case SYS_LOCATOR: + read &= ~SYS_LOCATOR_LED_BITS; + read |= write << 0; + break; + case SYS_PWR: + read &= ~SYS_PWR_LED_BITS; + read |= write << 1; + break; + case SYS_STATUS: + read &= ~SYS_STATUS_LED_BITS; + read |= write << 4; + break; + case FAN1_LED: + case FAN3_LED: + case FAN5_LED: + read &= ~FAN135_LED_BITS; + read |= write << 0; + break; + case FAN2_LED: + case FAN4_LED: + case FAN6_LED: + read &= ~FAN246_LED_BITS; + read |= write << 3; + break; + case SYS_REST1: + read = write; + break; + } + + i2c_smbus_write_byte_data(client, command, read); + + return count; +} + + + +static void alpha_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void alpha_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int alpha_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + status = sysfs_create_group(&client->dev.kobj, &alphanetworks_snh60a0_320fv2_sys_group); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + alpha_i2c_cpld_add_client(client); + + return 0; + +exit: + return status; +} + +static int alpha_i2c_cpld_remove(struct i2c_client *client) +{ + sysfs_remove_group(&client->dev.kobj, &alphanetworks_snh60a0_320fv2_sys_group); + alpha_i2c_cpld_remove_client(client); + + return 0; +} + +static const struct i2c_device_id alpha_i2c_cpld_id[] = { + { "snh60a0_system_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, alpha_i2c_cpld_id); + +static struct i2c_driver alpha_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "snh60a0_system_cpld", + }, + .probe = alpha_i2c_cpld_probe, + .remove = alpha_i2c_cpld_remove, + .id_table = alpha_i2c_cpld_id, + .address_list = normal_i2c, +}; + + +static int __init alpha_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&alpha_i2c_cpld_driver); +} + +static void __exit alpha_i2c_cpld_exit(void) +{ + i2c_del_driver(&alpha_i2c_cpld_driver); +} + + +MODULE_AUTHOR("Alpha-SID6"); +MODULE_DESCRIPTION("alpha_system_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(alpha_i2c_cpld_init); +module_exit(alpha_i2c_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/service/snh60a0-platform-init.service b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/service/snh60a0-platform-init.service new file mode 100644 index 000000000000..564a8dcdb7a4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/service/snh60a0-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Alphanetworks SNH60A0-320F Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/alphanetworks_snh60a0_util.py install +ExecStop=/usr/local/bin/alphanetworks_snh60a0_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/setup.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/setup.py new file mode 100644 index 000000000000..94435eef3c0e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='snh60a0_320fv2', + version='1.0', + description='Module to initialize Alphanetworks SNH60A0-320FV2 platforms', + + packages=['snh60a0_320fv2'], + package_dir={'snh60a0_320fv2': 'snh60a0-320fv2/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/utils/alphanetworks_snh60a0_util.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/utils/alphanetworks_snh60a0_util.py new file mode 100755 index 000000000000..870267e31c26 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60a0-320fv2/utils/alphanetworks_snh60a0_util.py @@ -0,0 +1,399 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Alphanetworks Technology Corporation. +# Robin Chen +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# see +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'snh60a0-320fv2' +device_path = "x86_64-alphanetworks_snh60a0_320fv2-r0" +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +FORCE = 0 + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print PROJECT_NAME.upper()+": "+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + show_log (cmd +" with result: " + str(status)) + show_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("lsmod | grep alphanetworks", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + +kos = [ +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x', +'modprobe optoe' , +'modprobe snh60a0_power_cpld' , +'modprobe snh60a0_system_cpld' , +'modprobe snh60a0_onie_eeprom' , +'modprobe alphanetworks_snh60a0_320fv2_sfp' ] + +def driver_install(): + global FORCE + status, output = log_os_system("depmod", 1) + for i in range(0,len(kos)): + if kos[i].find('pca954') != -1: + status, output = log_os_system(kos[i]+ " force_deselect_on_exit=1", 1) + else: + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +i2c_prefix = '/sys/bus/i2c/devices/' + +sfp_map = [14,15,16,17] +mknod =[ +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-6/new_device', +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-8/new_device', +'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-7/new_device', +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-21/new_device', +'echo 24c02 0x51 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo 24c02 0x51 > /sys/bus/i2c/devices/i2c-12/new_device', +'echo snh60a0_onie_eeprom 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo snh60a0_power_cpld 0x5e > /sys/bus/i2c/devices/i2c-0/new_device', +'echo snh60a0_system_cpld 0x5f > /sys/bus/i2c/devices/i2c-9/new_device', +'echo lm75 0x4D > /sys/bus/i2c/devices/i2c-4/new_device', +'echo lm75 0x4C > /sys/bus/i2c/devices/i2c-5/new_device', +'echo lm75 0x4F > /sys/bus/i2c/devices/i2c-0/new_device' ] + +mknod2 =[ +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-6/new_device', +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-8/new_device', +'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-7/new_device', +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-21/new_device', +'echo 24c02 0x51 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo 24c02 0x51 > /sys/bus/i2c/devices/i2c-12/new_device', +'echo snh60a0_onie_eeprom 0x56 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo snh60a0_power_cpld 0x5e > /sys/bus/i2c/devices/i2c-1/new_device', +'echo snh60a0_system_cpld 0x5f > /sys/bus/i2c/devices/i2c-9/new_device', +'echo lm75 0x4D > /sys/bus/i2c/devices/i2c-4/new_device', +'echo lm75 0x4C > /sys/bus/i2c/devices/i2c-5/new_device', +'echo lm75 0x4F > /sys/bus/i2c/devices/i2c-1/new_device' ] + + + +def i2c_order_check(): + # i2c bus 0 and 1 might be installed in different order. + # Here check if 0x76 is exist @ i2c-0 + + status, output = log_os_system("i2cdetect -l | grep I801 | grep i2c-0", 0) + if not output: + order = 1 + else: + order = 0 + + if not device_exist(): + #order = 1 + tmp = "sed -i 's/0-/1-/g' /usr/share/sonic/device/"+device_path+"/fancontrol" + status, output = log_os_system(tmp, 0) + tmp = "sed -i 's/0-/1-/g' /usr/share/sonic/device/"+device_path+"/plugins/led_control.py" + status, output = log_os_system(tmp, 0) + else: + #order = 0 + tmp = "sed -i 's/1-/0-/g' /usr/share/sonic/device/"+device_path+"/fancontrol" + status, output = log_os_system(tmp, 0) + tmp = "sed -i 's/1-/0-/g' /usr/share/sonic/device/"+device_path+"/plugins/led_control.py" + status, output = log_os_system(tmp, 0) + + + return order + +def device_install(): + global FORCE + + order = i2c_order_check() + + # if 0x76 is not exist @i2c-0, use reversed bus order + if order: + for i in range(0,len(mknod2)): + #for pca954x need times to built new i2c buses + if mknod2[i].find('pca954') != -1: + time.sleep(1) + + if mknod2[i].find('lm75') != -1: + time.sleep(1) + + status, output = log_os_system(mknod2[i], 1) + if status: + print output + if FORCE == 0: + return status + else: + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + if mknod[i].find('lm75') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + status, output =log_os_system("echo 0 > /sys/bus/i2c/devices/9-005f/sys_reset1", 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0, 32): + index = i / 8 + port = i % 8 + reg_sfp = 0 + if port == 0: + reg_sfp = 1 + + if reg_sfp == 1: + status, output =log_os_system("echo sfpcpld"+str(i+1)+" 0x5f > /sys/bus/i2c/devices/i2c-"+str(sfp_map[index])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + status, output =log_os_system("echo sfpcpld"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[index])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + + return + +def device_uninstall(): + global FORCE + + status, output = log_os_system("i2cdetect -l | grep I801 | grep i2c-0", 0) + + if not output: + I2C_ORDER=1 + else: + I2C_ORDER=0 + + for i in range(0, 32): + index = i / 8 + port = i % 8 + reg_sfp = 0 + if port == 0: + reg_sfp = 1 + + if reg_sfp == 1: + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[index])+"/delete_device" + status, output =log_os_system("echo 0x5f > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[index])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + if I2C_ORDER==0: + nodelist = mknod + else: + nodelist = mknod2 + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + tmp = "find /var/lib/docker/overlay -iname fancontrol | grep usr/sbin/fancontrol | xargs cat | sed '429d' | sed '428a if \[ $? -ne 1 \]' | sed '425d' | sed '424a return' > /tmp/tmp_fancontrol" + status, output = log_os_system(tmp, 1) + tmp = "fancontrol_tmp=`find /var/lib/docker/overlay -iname fancontrol | grep usr/sbin/fancontrol` ; cp /tmp/tmp_fancontrol $fancontrol_tmp" + status, output = log_os_system(tmp, 1) + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0070", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/classes/__init__.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/classes/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/Makefile b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/Makefile new file mode 100644 index 000000000000..ec14f1229d66 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/Makefile @@ -0,0 +1,8 @@ +# obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \ +# goreme_system_cpld.o ym2651y.o optoe.o + +obj-m:=alphanetworks_snh60b0-640f_sfp.o snh60b0-640f_system_cpld.o snh60b0-640f_power_cpld.o snh60b0-640f_onie_eeprom.o + + +# obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \ +# accton_as7712_32x_psu.o accton_i2c_cpld.o ym2651y.o optoe.o diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/alphanetworks_snh60b0-640f_sfp.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/alphanetworks_snh60b0-640f_sfp.c new file mode 100644 index 000000000000..8985790cce6c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/alphanetworks_snh60b0-640f_sfp.c @@ -0,0 +1,2076 @@ +/* + * SFP driver for alphanetworks snh60b0-640f sfp + * + * Copyright (C) 2018 Alphanetworks Technology Corporation. + * Philip Wang + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "snh60b0_640f_sfp" + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s[%s,%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define NUM_OF_SFP_PORT 64 +#define EEPROM_NAME "sfp_eeprom" +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define BIT_INDEX(i) (1ULL << (i)) +#define USE_I2C_BLOCK_READ 1 +#define I2C_RW_RETRY_COUNT 3 +#define I2C_RW_RETRY_INTERVAL 100 /* ms */ + +#define SFP_CPLD_I2C_ADDR 0x5F +#define SFP_EEPROM_A0_I2C_ADDR 0x50 +#define SFP_EEPROM_A2_I2C_ADDR 0x68 +#define SFP_PCA9506_I2C_ADDR 0x20 + + +#define SFPPLUS_1_PORT_NUMBER 64 +#define SFPPLUS_2_PORT_NUMBER 65 + +#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 +#define SFF8024_DEVICE_ID_SFP 0x3 +#define SFF8024_DEVICE_ID_QSFP 0xC +#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD +#define SFF8024_DEVICE_ID_QSFP28 0x11 + +#define SFF8472_DIAG_MON_TYPE_ADDR 92 +#define SFF8472_DIAG_MON_TYPE_DDM_MASK 0x40 +#define SFF8472_10G_ETH_COMPLIANCE_ADDR 0x3 +#define SFF8472_10G_BASE_MASK 0xF0 + +#define SFF8436_RX_LOS_ADDR 3 +#define SFF8436_TX_FAULT_ADDR 4 +#define SFF8436_TX_DISABLE_ADDR 86 + +static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); +/* extern int alpha_i2c_cpld_read(unsigned short cpld_addr, u8 reg); */ +extern int alpha_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { SFP_EEPROM_A0_I2C_ADDR, SFP_EEPROM_A2_I2C_ADDR, SFP_CPLD_I2C_ADDR, SFP_PCA9506_I2C_ADDR, I2C_CLIENT_END }; + +#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) + +enum port_numbers { +sfp1, sfp2, sfp3, sfp4, sfp5, sfp6, sfp7, sfp8, +sfp9, sfp10, sfp11, sfp12, sfp13, sfp14, sfp15, sfp16, +sfp17, sfp18, sfp19, sfp20, sfp21, sfp22, sfp23, sfp24, +sfp25, sfp26, sfp27, sfp28, sfp29, sfp30, sfp31, sfp32, +sfp33, sfp34, sfp35, sfp36, sfp37, sfp38, sfp39, sfp40, +sfp41, sfp42, sfp43, sfp44, sfp45, sfp46, sfp47, sfp48, +sfp49, sfp50, sfp51, sfp52, sfp53, sfp54, sfp55, sfp56, +sfp57, sfp58, sfp59, sfp60, sfp61, sfp62, sfp63, sfp64, +sfp65, sfp66 +}; + +static const struct i2c_device_id sfp_device_id[] = { +{ "sfpcpld1", sfp1 }, { "sfpcpld2", sfp2 }, { "sfpcpld3", sfp3 }, { "sfpcpld4", sfp4 }, +{ "sfpcpld5", sfp5 }, { "sfpcpld6", sfp6 }, { "sfpcpld7", sfp7 }, { "sfpcpld8", sfp8 }, +{ "sfpcpld9", sfp9 }, { "sfpcpld10", sfp10 }, { "sfpcpld11", sfp11 }, { "sfpcpld12", sfp12 }, +{ "sfpcpld13", sfp13 }, { "sfpcpld14", sfp14 }, { "sfpcpld15", sfp15 }, { "sfpcpld16", sfp16 }, +{ "sfpcpld17", sfp17 }, { "sfpcpld18", sfp18 }, { "sfpcpld19", sfp19 }, { "sfpcpld20", sfp20 }, +{ "sfpcpld21", sfp21 }, { "sfpcpld22", sfp22 }, { "sfpcpld23", sfp23 }, { "sfpcpld24", sfp24 }, +{ "sfpcpld25", sfp25 }, { "sfpcpld26", sfp26 }, { "sfpcpld27", sfp27 }, { "sfpcpld28", sfp28 }, +{ "sfpcpld29", sfp29 }, { "sfpcpld30", sfp30 }, { "sfpcpld31", sfp31 }, { "sfpcpld32", sfp32 }, +{ "sfpcpld33", sfp33 }, { "sfpcpld34", sfp34 }, { "sfpcpld35", sfp35 }, { "sfpcpld36", sfp36 }, +{ "sfpcpld37", sfp37 }, { "sfpcpld38", sfp38 }, { "sfpcpld39", sfp39 }, { "sfpcpld40", sfp40 }, +{ "sfpcpld41", sfp41 }, { "sfpcpld42", sfp42 }, { "sfpcpld43", sfp43 }, { "sfpcpld44", sfp44 }, +{ "sfpcpld45", sfp45 }, { "sfpcpld46", sfp46 }, { "sfpcpld47", sfp47 }, { "sfpcpld48", sfp48 }, +{ "sfpcpld49", sfp49 }, { "sfpcpld50", sfp50 }, { "sfpcpld51", sfp51 }, { "sfpcpld52", sfp52 }, +{ "sfpcpld53", sfp53 }, { "sfpcpld54", sfp54 }, { "sfpcpld55", sfp55 }, { "sfpcpld56", sfp56 }, +{ "sfpcpld57", sfp57 }, { "sfpcpld58", sfp58 }, { "sfpcpld59", sfp59 }, { "sfpcpld60", sfp60 }, +{ "sfpcpld61", sfp61 }, { "sfpcpld62", sfp62 }, { "sfpcpld63", sfp63 }, { "sfpcpld64", sfp64 }, +{ "sfpcpld65", sfp65 }, { "sfpcpld66", sfp66 }, {} +}; +MODULE_DEVICE_TABLE(i2c, sfp_device_id); + +/* + * list of valid port types + * note OOM_PORT_TYPE_NOT_PRESENT to indicate no + * module is present in this port + */ +typedef enum oom_driver_port_type_e { + OOM_DRIVER_PORT_TYPE_INVALID, + OOM_DRIVER_PORT_TYPE_NOT_PRESENT, + OOM_DRIVER_PORT_TYPE_SFP, + OOM_DRIVER_PORT_TYPE_SFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP, + OOM_DRIVER_PORT_TYPE_QSFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP28 +} oom_driver_port_type_t; + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_SFP_DDM, + DRIVER_TYPE_QSFP +}; + +/* Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct sfp_msa_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[2]; /* index 0 => device id + 1 => 10G Ethernet Compliance Codes + to distinguish SFP or SFP+ + 2 => DIAGNOSTIC MONITORING TYPE */ + struct eeprom_data eeprom; +}; + +struct sfp_ddm_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + struct eeprom_data eeprom; +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + oom_driver_port_type_t port_type; + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + u64 port_reset; /* reset status, bit0:port0, bit1:port1 and so on */ + + struct sfp_msa_data *msa; + struct sfp_ddm_data *ddm; + struct qsfp_data *qsfp; + + struct i2c_client *client; +}; + +enum sfp_sysfs_port_num_attributes { + PORT1_NUMBER, + PORT2_NUMBER, + PORT3_NUMBER, + PORT4_NUMBER, + PORT5_NUMBER, + PORT6_NUMBER, + PORT7_NUMBER, + PORT8_NUMBER, + PORT9_NUMBER, + PORT10_NUMBER, + PORT11_NUMBER, + PORT12_NUMBER, + PORT13_NUMBER, + PORT14_NUMBER, + PORT15_NUMBER, + PORT16_NUMBER, + PORT_NUMBER_MAX +}; + +enum sfp_sysfs_present_attributes { + PORT1_PRESENT, + PORT2_PRESENT, + PORT3_PRESENT, + PORT4_PRESENT, + PORT5_PRESENT, + PORT6_PRESENT, + PORT7_PRESENT, + PORT8_PRESENT, + PORT9_PRESENT, + PORT10_PRESENT, + PORT11_PRESENT, + PORT12_PRESENT, + PORT13_PRESENT, + PORT14_PRESENT, + PORT15_PRESENT, + PORT16_PRESENT, + PORT1_PRESENT_ALL, + PORT2_PRESENT_ALL, + PORT3_PRESENT_ALL, + PORT4_PRESENT_ALL, + PORT5_PRESENT_ALL, + PORT6_PRESENT_ALL, + PORT7_PRESENT_ALL, + PORT8_PRESENT_ALL, + PORT9_PRESENT_ALL, + PORT10_PRESENT_ALL, + PORT11_PRESENT_ALL, + PORT12_PRESENT_ALL, + PORT13_PRESENT_ALL, + PORT14_PRESENT_ALL, + PORT15_PRESENT_ALL, + PORT16_PRESENT_ALL, + PORT_PRESENT_MAX +}; + +enum sfp_sysfs_type_attributes { + PORT1_TYPE, + PORT2_TYPE, + PORT3_TYPE, + PORT4_TYPE, + PORT5_TYPE, + PORT6_TYPE, + PORT7_TYPE, + PORT8_TYPE, + PORT9_TYPE, + PORT10_TYPE, + PORT11_TYPE, + PORT12_TYPE, + PORT13_TYPE, + PORT14_TYPE, + PORT15_TYPE, + PORT16_TYPE, + PORT_TYPE_MAX +}; + +enum sfp_sysfs_reset_attributes { + PORT1_RESET, + PORT2_RESET, + PORT3_RESET, + PORT4_RESET, + PORT5_RESET, + PORT6_RESET, + PORT7_RESET, + PORT8_RESET, + PORT9_RESET, + PORT10_RESET, + PORT11_RESET, + PORT12_RESET, + PORT13_RESET, + PORT14_RESET, + PORT15_RESET, + PORT16_RESET, + PORT_RESET_MAX +}; + +enum sfp_sysfs_rx_los_attributes { + PORT1_RX_LOS, + PORT2_RX_LOS, + PORT3_RX_LOS, + PORT4_RX_LOS, + PORT5_RX_LOS, + PORT6_RX_LOS, + PORT7_RX_LOS, + PORT8_RX_LOS, + PORT9_RX_LOS, + PORT10_RX_LOS, + PORT11_RX_LOS, + PORT12_RX_LOS, + PORT13_RX_LOS, + PORT14_RX_LOS, + PORT15_RX_LOS, + PORT16_RX_LOS, + PORT_RX_LOS_MAX +}; + +enum sfp_sysfs_rx_los1_attributes { + PORT1_RX_LOS1 = PORT_RX_LOS_MAX, + PORT2_RX_LOS1, + PORT3_RX_LOS1, + PORT4_RX_LOS1, + PORT5_RX_LOS1, + PORT6_RX_LOS1, + PORT7_RX_LOS1, + PORT8_RX_LOS1, + PORT9_RX_LOS1, + PORT10_RX_LOS1, + PORT11_RX_LOS1, + PORT12_RX_LOS1, + PORT13_RX_LOS1, + PORT14_RX_LOS1, + PORT15_RX_LOS1, + PORT16_RX_LOS1, + PORT_RX_LOS1_MAX +}; + +enum sfp_sysfs_rx_los2_attributes { + PORT1_RX_LOS2 = PORT_RX_LOS1_MAX, + PORT2_RX_LOS2, + PORT3_RX_LOS2, + PORT4_RX_LOS2, + PORT5_RX_LOS2, + PORT6_RX_LOS2, + PORT7_RX_LOS2, + PORT8_RX_LOS2, + PORT9_RX_LOS2, + PORT10_RX_LOS2, + PORT11_RX_LOS2, + PORT12_RX_LOS2, + PORT13_RX_LOS2, + PORT14_RX_LOS2, + PORT15_RX_LOS2, + PORT16_RX_LOS2, + PORT_RX_LOS2_MAX +}; + +enum sfp_sysfs_rx_los3_attributes { + PORT1_RX_LOS3 = PORT_RX_LOS2_MAX, + PORT2_RX_LOS3, + PORT3_RX_LOS3, + PORT4_RX_LOS3, + PORT5_RX_LOS3, + PORT6_RX_LOS3, + PORT7_RX_LOS3, + PORT8_RX_LOS3, + PORT9_RX_LOS3, + PORT10_RX_LOS3, + PORT11_RX_LOS3, + PORT12_RX_LOS3, + PORT13_RX_LOS3, + PORT14_RX_LOS3, + PORT15_RX_LOS3, + PORT16_RX_LOS3, + PORT_RX_LOS3_MAX +}; + +enum sfp_sysfs_rx_los4_attributes { + PORT1_RX_LOS4 = PORT_RX_LOS3_MAX, + PORT2_RX_LOS4, + PORT3_RX_LOS4, + PORT4_RX_LOS4, + PORT5_RX_LOS4, + PORT6_RX_LOS4, + PORT7_RX_LOS4, + PORT8_RX_LOS4, + PORT9_RX_LOS4, + PORT10_RX_LOS4, + PORT11_RX_LOS4, + PORT12_RX_LOS4, + PORT13_RX_LOS4, + PORT14_RX_LOS4, + PORT15_RX_LOS4, + PORT16_RX_LOS4, + PORT_RX_LOS4_MAX +}; + +enum sfp_sysfs_rx_los_all_attributes { + PORT1_RX_LOS_ALL = PORT_RX_LOS4_MAX, + PORT2_RX_LOS_ALL, + PORT3_RX_LOS_ALL, + PORT4_RX_LOS_ALL, + PORT5_RX_LOS_ALL, + PORT6_RX_LOS_ALL, + PORT7_RX_LOS_ALL, + PORT8_RX_LOS_ALL, + PORT9_RX_LOS_ALL, + PORT10_RX_LOS_ALL, + PORT11_RX_LOS_ALL, + PORT12_RX_LOS_ALL, + PORT13_RX_LOS_ALL, + PORT14_RX_LOS_ALL, + PORT15_RX_LOS_ALL, + PORT16_RX_LOS_ALL, + PORT_RX_LOS_ALL_MAX +}; + +enum sfp_sysfs_tx_disable_attributes { + PORT1_TX_DISABLE = PORT_RX_LOS_ALL_MAX, + PORT2_TX_DISABLE, + PORT3_TX_DISABLE, + PORT4_TX_DISABLE, + PORT5_TX_DISABLE, + PORT6_TX_DISABLE, + PORT7_TX_DISABLE, + PORT8_TX_DISABLE, + PORT9_TX_DISABLE, + PORT10_TX_DISABLE, + PORT11_TX_DISABLE, + PORT12_TX_DISABLE, + PORT13_TX_DISABLE, + PORT14_TX_DISABLE, + PORT15_TX_DISABLE, + PORT16_TX_DISABLE, + PORT_TX_DISABLE_MAX +}; + +enum sfp_sysfs_tx_disable1_attributes { + PORT1_TX_DISABLE1 = PORT_TX_DISABLE_MAX, + PORT2_TX_DISABLE1, + PORT3_TX_DISABLE1, + PORT4_TX_DISABLE1, + PORT5_TX_DISABLE1, + PORT6_TX_DISABLE1, + PORT7_TX_DISABLE1, + PORT8_TX_DISABLE1, + PORT9_TX_DISABLE1, + PORT10_TX_DISABLE1, + PORT11_TX_DISABLE1, + PORT12_TX_DISABLE1, + PORT13_TX_DISABLE1, + PORT14_TX_DISABLE1, + PORT15_TX_DISABLE1, + PORT16_TX_DISABLE1, + PORT_TX_DISABLE1_MAX +}; + +enum sfp_sysfs_tx_disable2_attributes { + PORT1_TX_DISABLE2 = PORT_TX_DISABLE1_MAX, + PORT2_TX_DISABLE2, + PORT3_TX_DISABLE2, + PORT4_TX_DISABLE2, + PORT5_TX_DISABLE2, + PORT6_TX_DISABLE2, + PORT7_TX_DISABLE2, + PORT8_TX_DISABLE2, + PORT9_TX_DISABLE2, + PORT10_TX_DISABLE2, + PORT11_TX_DISABLE2, + PORT12_TX_DISABLE2, + PORT13_TX_DISABLE2, + PORT14_TX_DISABLE2, + PORT15_TX_DISABLE2, + PORT16_TX_DISABLE2, + PORT_TX_DISABLE2_MAX +}; + +enum sfp_sysfs_tx_disable3_attributes { + PORT1_TX_DISABLE3 = PORT_TX_DISABLE2_MAX, + PORT2_TX_DISABLE3, + PORT3_TX_DISABLE3, + PORT4_TX_DISABLE3, + PORT5_TX_DISABLE3, + PORT6_TX_DISABLE3, + PORT7_TX_DISABLE3, + PORT8_TX_DISABLE3, + PORT9_TX_DISABLE3, + PORT10_TX_DISABLE3, + PORT11_TX_DISABLE3, + PORT12_TX_DISABLE3, + PORT13_TX_DISABLE3, + PORT14_TX_DISABLE3, + PORT15_TX_DISABLE3, + PORT16_TX_DISABLE3, + PORT_TX_DISABLE3_MAX +}; + +enum sfp_sysfs_tx_disable4_attributes { + PORT1_TX_DISABLE4 = PORT_TX_DISABLE3_MAX, + PORT2_TX_DISABLE4, + PORT3_TX_DISABLE4, + PORT4_TX_DISABLE4, + PORT5_TX_DISABLE4, + PORT6_TX_DISABLE4, + PORT7_TX_DISABLE4, + PORT8_TX_DISABLE4, + PORT9_TX_DISABLE4, + PORT10_TX_DISABLE4, + PORT11_TX_DISABLE4, + PORT12_TX_DISABLE4, + PORT13_TX_DISABLE4, + PORT14_TX_DISABLE4, + PORT15_TX_DISABLE4, + PORT16_TX_DISABLE4, + PORT_TX_DISABLE4_MAX +}; + +enum sfp_sysfs_tx_disable_all_attributes { + PORT1_TX_DISABLE_ALL = PORT_TX_DISABLE4_MAX, + PORT2_TX_DISABLE_ALL, + PORT3_TX_DISABLE_ALL, + PORT4_TX_DISABLE_ALL, + PORT5_TX_DISABLE_ALL, + PORT6_TX_DISABLE_ALL, + PORT7_TX_DISABLE_ALL, + PORT8_TX_DISABLE_ALL, + PORT9_TX_DISABLE_ALL, + PORT10_TX_DISABLE_ALL, + PORT11_TX_DISABLE_ALL, + PORT12_TX_DISABLE_ALL, + PORT13_TX_DISABLE_ALL, + PORT14_TX_DISABLE_ALL, + PORT15_TX_DISABLE_ALL, + PORT16_TX_DISABLE_ALL, + PORT_TX_DISABLE_ALL_MAX +}; + +enum sfp_sysfs_tx_fault_attributes { + PORT1_TX_FAULT = PORT_TX_DISABLE_ALL_MAX, + PORT2_TX_FAULT, + PORT3_TX_FAULT, + PORT4_TX_FAULT, + PORT5_TX_FAULT, + PORT6_TX_FAULT, + PORT7_TX_FAULT, + PORT8_TX_FAULT, + PORT9_TX_FAULT, + PORT10_TX_FAULT, + PORT11_TX_FAULT, + PORT12_TX_FAULT, + PORT13_TX_FAULT, + PORT14_TX_FAULT, + PORT15_TX_FAULT, + PORT16_TX_FAULT, + PORT_TX_FAULT_MAX +}; + +enum sfp_sysfs_tx_fault1_attributes { + PORT1_TX_FAULT1 = PORT_TX_FAULT_MAX, + PORT2_TX_FAULT1, + PORT3_TX_FAULT1, + PORT4_TX_FAULT1, + PORT5_TX_FAULT1, + PORT6_TX_FAULT1, + PORT7_TX_FAULT1, + PORT8_TX_FAULT1, + PORT9_TX_FAULT1, + PORT10_TX_FAULT1, + PORT11_TX_FAULT1, + PORT12_TX_FAULT1, + PORT13_TX_FAULT1, + PORT14_TX_FAULT1, + PORT15_TX_FAULT1, + PORT16_TX_FAULT1, + PORT_TX_FAULT1_MAX +}; + +enum sfp_sysfs_tx_fault2_attributes { + PORT1_TX_FAULT2 = PORT_TX_FAULT1_MAX, + PORT2_TX_FAULT2, + PORT3_TX_FAULT2, + PORT4_TX_FAULT2, + PORT5_TX_FAULT2, + PORT6_TX_FAULT2, + PORT7_TX_FAULT2, + PORT8_TX_FAULT2, + PORT9_TX_FAULT2, + PORT10_TX_FAULT2, + PORT11_TX_FAULT2, + PORT12_TX_FAULT2, + PORT13_TX_FAULT2, + PORT14_TX_FAULT2, + PORT15_TX_FAULT2, + PORT16_TX_FAULT2, + PORT_TX_FAULT2_MAX +}; + +enum sfp_sysfs_tx_fault3_attributes { + PORT1_TX_FAULT3 = PORT_TX_FAULT2_MAX, + PORT2_TX_FAULT3, + PORT3_TX_FAULT3, + PORT4_TX_FAULT3, + PORT5_TX_FAULT3, + PORT6_TX_FAULT3, + PORT7_TX_FAULT3, + PORT8_TX_FAULT3, + PORT9_TX_FAULT3, + PORT10_TX_FAULT3, + PORT11_TX_FAULT3, + PORT12_TX_FAULT3, + PORT13_TX_FAULT3, + PORT14_TX_FAULT3, + PORT15_TX_FAULT3, + PORT16_TX_FAULT3, + PORT_TX_FAULT3_MAX +}; + +enum sfp_sysfs_tx_fault4_attributes { + PORT1_TX_FAULT4 = PORT_TX_FAULT3_MAX, + PORT2_TX_FAULT4, + PORT3_TX_FAULT4, + PORT4_TX_FAULT4, + PORT5_TX_FAULT4, + PORT6_TX_FAULT4, + PORT7_TX_FAULT4, + PORT8_TX_FAULT4, + PORT9_TX_FAULT4, + PORT10_TX_FAULT4, + PORT11_TX_FAULT4, + PORT12_TX_FAULT4, + PORT13_TX_FAULT4, + PORT14_TX_FAULT4, + PORT15_TX_FAULT4, + PORT16_TX_FAULT4, + PORT_TX_FAULT4_MAX +}; + +enum sfp_sysfs_eeprom_attributes { + PORT1_EEPROM, + PORT2_EEPROM, + PORT3_EEPROM, + PORT4_EEPROM, + PORT5_EEPROM, + PORT6_EEPROM, + PORT7_EEPROM, + PORT8_EEPROM, + PORT9_EEPROM, + PORT10_EEPROM, + PORT11_EEPROM, + PORT12_EEPROM, + PORT13_EEPROM, + PORT14_EEPROM, + PORT15_EEPROM, + PORT16_EEPROM, + PORT_EEPROM_MAX +}; + +enum sfp_sysfs_ddm_implemented_attributes { + PORT1_DDM_IMPLEMENTED, + PORT2_DDM_IMPLEMENTED, + PORT3_DDM_IMPLEMENTED, + PORT4_DDM_IMPLEMENTED, + PORT5_DDM_IMPLEMENTED, + PORT6_DDM_IMPLEMENTED, + PORT7_DDM_IMPLEMENTED, + PORT8_DDM_IMPLEMENTED, + PORT9_DDM_IMPLEMENTED, + PORT10_DDM_IMPLEMENTED, + PORT11_DDM_IMPLEMENTED, + PORT12_DDM_IMPLEMENTED, + PORT13_DDM_IMPLEMENTED, + PORT14_DDM_IMPLEMENTED, + PORT15_DDM_IMPLEMENTED, + PORT16_DDM_IMPLEMENTED, + PORT_DDM_IMPLEMENTED_MAX +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + DEBUG_PRINT("show_port_number port number:%d", data->port + attr->index); + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port + attr->index)); +} + +static struct sfp_port_data *sfp_pca9506_update_present(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {0x03}; + + DEBUG_PRINT("Starting pca9506 sfp present status update"); + mutex_lock(&data->update_lock); + + /* Read present status of port */ + data->present = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + /* status = alpha_i2c_cpld_read(0x5f, regs[i]); */ + status = i2c_smbus_read_byte_data(client, regs[i]); + + if (status < 0) { + DEBUG_PRINT("pca9506(0x20) reg(0x%x) err %d", regs[i], status); + goto exit; + } + + data->present = status; + } + + DEBUG_PRINT("Present status = 0x%llx", data->present); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static struct sfp_port_data *sfp_update_present(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {0x05, 0x06}; + + if(data->port >= SFPPLUS_1_PORT_NUMBER){ + return sfp_pca9506_update_present(client); + } + + DEBUG_PRINT("Starting sfp present status update"); + mutex_lock(&data->update_lock); + + /* Read present status of port 1~32 */ + data->present = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + /* status = alpha_i2c_cpld_read(0x5f, regs[i]); */ + status = i2c_smbus_read_byte_data(client, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld(0x5f) reg(0x%x) err %d", regs[i], status); + goto exit; + } + + data->present |= (u64)status << (i*8); + DEBUG_PRINT("Present status = 0x%llx", data->present); + } + + DEBUG_PRINT("Present status = 0x%llx", data->present); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static struct sfp_port_data *sfp_update_tx_rx_status(struct device *dev) +{ + return NULL; +} + +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + return 0; +} + +static int sfp_is_port_present(struct i2c_client *client, int port) +{ + struct sfp_port_data *data = sfp_update_present(client); + + if(data->port >= SFPPLUS_1_PORT_NUMBER) + return (data->present & BIT_INDEX(port)) ? 0 : 1; + else + return (data->present & BIT_INDEX(port)) ? 1 : 0; +} + +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + + if ((attr->index >= PORT1_PRESENT_ALL) && (attr->index <= PORT8_PRESENT_ALL)) { + + } + + /* PRESENT */ + return sprintf(buf, "%d\n", sfp_is_port_present(client, attr->index)); +} + +static struct sfp_port_data *sfp_update_port_type(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 buf = 0; + int status; + + mutex_lock(&data->update_lock); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + { + status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + if (buf != SFF8024_DEVICE_ID_SFP) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + status = sfp_eeprom_read(data->client, SFF8472_10G_ETH_COMPLIANCE_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("sfp port type (0x3) data = (0x%x)", buf); + data->port_type = buf & SFF8472_10G_BASE_MASK ? OOM_DRIVER_PORT_TYPE_SFP_PLUS : OOM_DRIVER_PORT_TYPE_SFP; + break; + } + case DRIVER_TYPE_QSFP: + { + status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("qsfp port type (0x0) buf = (0x%x)", buf); + switch (buf) { + case SFF8024_DEVICE_ID_QSFP: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP; + break; + case SFF8024_DEVICE_ID_QSFP_PLUS: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + case SFF8024_DEVICE_ID_QSFP28: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + default: + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + break; + } + default: + break; + } + + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_type(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (!sfp_is_port_present(client, attr->index)) { + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_type(dev); + return sprintf(buf, "%d\n", data->port_type); +} + + +static struct sfp_port_data *sfp_update_port_reset(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {0x07, 0x08}; + + mutex_lock(&data->update_lock); + + /* Read reset status of port 1~32 */ + data->port_reset = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = i2c_smbus_read_byte_data(client, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld(0x60) reg(0x%x) err %d", regs[i], status); + goto exit; + } + + DEBUG_PRINT("reset status = 0x%x", status); + data->port_reset |= (u64)status << (i*8); + } + + DEBUG_PRINT("reset status = 0x%llx", data->port_reset); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_reset(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + int is_reset = 0; + + if (!sfp_is_port_present(client, attr->index)) { + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_reset(client); + is_reset = (data->port_reset & BIT_INDEX(attr->index))? 0 : 1; + + return sprintf(buf, "%d\n", is_reset); +} + +static ssize_t sfp_set_port_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 cpld_reg = 0, cpld_val = 0; /*, cpld_bit = 0; //remove unused variable */ + long is_reset; + int error; + + error = kstrtol(buf, 10, &is_reset); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + cpld_reg = 0x07; + + cpld_val = i2c_smbus_read_byte_data(client, cpld_reg); + + DEBUG_PRINT("current cpld reg = 0x%x value = 0x%x", cpld_reg, cpld_val); + + /* Update reset status. CPLD defined 0 is reset state, 1 is normal state. + * is_reset: 0 is not reset. 1 is reset. + */ + if (is_reset == 0) { + data->port_reset |= BIT_INDEX(attr->index); + } + else { + data->port_reset &= ~BIT_INDEX(attr->index); + } + + alpha_i2c_cpld_write(0x5f, cpld_reg, cpld_val); + DEBUG_PRINT("write cpld reg = 0x%x value = 0x%x", cpld_reg, cpld_val); + + mutex_unlock(&data->update_lock); + + return count; +} + +static struct sfp_port_data *qsfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i, status = -1; + u8 buf = 0; + u8 reg[] = {SFF8436_TX_FAULT_ADDR, SFF8436_TX_DISABLE_ADDR, SFF8436_RX_LOS_ADDR}; + + if (time_before(jiffies, data->qsfp->last_updated + HZ + HZ / 2) && data->qsfp->valid) { + return data; + } + + dev_dbg(dev, "Starting sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->qsfp->valid = 0; + memset(data->qsfp->status, 0, sizeof(data->qsfp->status)); + + /* Notify device to update tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(data->client, reg[i], &buf, sizeof(buf)); + if (status < 0) { + goto exit; + } + } + msleep(200); + + /* Read actual tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(data->client, reg[i], &buf, sizeof(buf)); + if (status < 0) { + goto exit; + } + + DEBUG_PRINT("qsfp reg(0x%x) status = (0x%x)", reg[i], data->qsfp->status[i]); + data->qsfp->status[i] = (buf & 0xF); + } + + data->qsfp->valid = 1; + data->qsfp->last_updated = jiffies; + mutex_unlock(&data->update_lock); + return data; + +exit: + mutex_unlock(&data->update_lock); + return NULL; +} + +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (!sfp_is_port_present(client, attr->index)) { + return -ENODEV; + } + + data = qsfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + + if ((attr->index >= PORT1_TX_FAULT1) && (attr->index < PORT_TX_FAULT4_MAX)){ + val = (data->qsfp->status[2] & BIT_INDEX(attr->index - PORT1_TX_FAULT1)) ? 1 : 0; + } + else if ((attr->index >= PORT1_TX_DISABLE1) && (attr->index < PORT_TX_DISABLE4_MAX)){ + val = (data->qsfp->status[1] & BIT_INDEX(attr->index - PORT1_TX_DISABLE1)) ? 1 : 0; + } + else if ((attr->index >= PORT1_TX_DISABLE_ALL) && (attr->index < PORT_TX_DISABLE_ALL_MAX)){ + val = ((data->qsfp->status[1] & 0xF) == 0xF) ? 1 : 0; + } + if ((attr->index >= PORT1_RX_LOS1) && (attr->index < PORT_RX_LOS4_MAX)){ + val = (data->qsfp->status[0] & BIT_INDEX(attr->index - PORT1_RX_LOS1)) ? 1 : 0; + } + + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + long disable; + int result; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data; + + result = kstrtol(buf, 10, &disable); + if (result) { + return result; + } + + data = qsfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + + mutex_lock(&data->update_lock); + + if((attr->index >= PORT1_TX_DISABLE_ALL) && (attr->index < PORT_TX_DISABLE_ALL_MAX)){ + DEBUG_PRINT ("disable:%ld %d==TX_DISABLE_ALL %u\r\n", disable, attr->index, data->qsfp->status[1]); + data->qsfp->status[1] = disable? 0xF:0; + } + else{ + if (disable) { + data->qsfp->status[1] |= (1 << (attr->index - PORT1_TX_DISABLE1)); + } + else { + data->qsfp->status[1] &= ~(1 << (attr->index - PORT1_TX_DISABLE1)); + } + } + + DEBUG_PRINT("index = (%d), status = (0x%x)", attr->index, data->qsfp->status[1]); + result = sfp_eeprom_write(client, SFF8436_TX_DISABLE_ADDR, &data->qsfp->status[1], sizeof(data->qsfp->status[1])); + mutex_unlock(&data->update_lock); + return count; +} + +static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + char ddm; + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (!sfp_is_port_present(client, attr->index)) { + return -ENODEV; + } + + status = sfp_eeprom_read(data->client, SFF8472_DIAG_MON_TYPE_ADDR, &ddm, sizeof(ddm)); + if (status < 0) { + return -EIO; + } + + return sprintf(buf, "%d\n", (ddm & SFF8472_DIAG_MON_TYPE_DDM_MASK) ? 1 : 0); +} + +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0, index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct sfp_port_data *data; + + data = sfp_update_tx_rx_status(dev); + if (!data) { + return -EIO; + } + if ((attr->index >= PORT1_TX_FAULT) && (attr->index < PORT_TX_FAULT_MAX)){ + index = 0; + } + else if ((attr->index >= PORT1_TX_DISABLE) && (attr->index < PORT_TX_DISABLE_MAX)){ + index = 1; + } + if ((attr->index >= PORT1_RX_LOS) && (attr->index < PORT_RX_LOS_MAX)){ + index = 2; + } + + if(data->port == SFPPLUS_1_PORT_NUMBER) + val = (data->ddm->status[index] & BIT_INDEX(0)) ? 1 : 0; + else if(data->port == SFPPLUS_1_PORT_NUMBER) + val = (data->ddm->status[index] & BIT_INDEX(1)) ? 1 : 0; + else + val = (data->ddm->status[index] & BIT_INDEX(attr->index)) ? 1 : 0; + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_show_eeprom(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + char devfile[96]; + struct file *sfd; + int i2c_index = 0; + int result; + int offset[] = {0x0b, 0x0c}; + int rdlen, rc; + mm_segment_t old_fs; + char buffer[256]; + + if (!sfp_is_port_present(client, attr->index)) { + return 0; + } + + if(strcmp(client->name, "sfpcpld1") == 0) + i2c_index = 13; + else if(strcmp(client->name, "sfpcpld17") == 0) + i2c_index = 14; + else if(strcmp(client->name, "sfpcpld33") == 0) + i2c_index = 15; + else if(strcmp(client->name, "sfpcpld49") == 0) + i2c_index = 16; + else if(strcmp(client->name, "sfpcpld65") == 0){ + if(attr->index == 0) + i2c_index = 21; + else if(attr->index == 1) + i2c_index = 22; + } + + snprintf(devfile, sizeof(devfile), "/sys/bus/i2c/devices/%d-0050/sfp_eeprom", i2c_index); + + /* Set module select register */ + switch(i2c_index){ + case 13: + case 14: + case 15: + case 16: + if((attr->index/8) == 0){ + /* Port number is 1-8 */ + result = i2c_smbus_write_byte_data(client, offset[0], BIT_INDEX(attr->index)); + if (result < 0) { + dev_info(&client->dev, "i2c_smbus_write_byte_data fail(%d)", result); + } + } + else if((attr->index/8) == 1){ + /* Port number is 9-16 */ + result = i2c_smbus_write_byte_data(client, offset[1], BIT_INDEX((attr->index)%8)); + if (result < 0) { + dev_info(&client->dev, "i2c_smbus_write_byte_data fail(%d)", result); + } + } + break; + default: + break; + } + + /* Read SFP EEPROM */ + sfd = filp_open(devfile, O_RDONLY, 0); + if (IS_ERR(sfd)) { + dev_info(&client->dev, "Failed to open file(%s)#%d", devfile, __LINE__); + return 0; + } + + if(!(sfd->f_op) || !(sfd->f_op->read) ) { + dev_info(&client->dev, "file %s cann't readable ?\n", devfile); + return 0; + } + + old_fs = get_fs(); + set_fs(KERNEL_DS); + rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); + if (rdlen == 0) { + dev_info(&client->dev, "File(%s) empty!\n", devfile); + rc = 0; + goto exit; + } + + rc = sizeof(buffer); + memcpy(buf, buffer, rc); + + /* Reset module select register */ + switch(i2c_index){ + case 13: + case 14: + case 15: + case 16: + if((attr->index/8) == 0){ + /* Port number is 1-8 */ + result = i2c_smbus_write_byte_data(client, offset[0], 0); + if (result < 0) { + dev_info(&client->dev, "i2c_smbus_write_byte_data fail(%d)", result); + } + } + else if((attr->index/8) == 1){ + /* Port number is 9-16 */ + result = i2c_smbus_write_byte_data(client, offset[1], 0); + if (result < 0) { + dev_info(&client->dev, "i2c_smbus_write_byte_data fail(%d)", result); + } + } + break; + default: + break; + } + +exit: + set_fs(old_fs); + filp_close(sfd, 0); + + return rc; +} + +#if 0 +static ssize_t qsfp_set_eeprom(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + DEBUG_PRINT("data->port:%d attr index:%d", data->port, attr->index); + return 1; +} +#endif + +/* SFP/QSFP common attributes for sysfs */ +#define DECLARE_PORT_NUMBER_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT1##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT2##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT3##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT4##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT5##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT6##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT7##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT8##_NUMBER); +#define DECLARE_PORT_NUMBER_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_port_number.dev_attr.attr, +DECLARE_PORT_NUMBER_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_NUMBER_SENSOR_DEVICE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + +#define DECLARE_PORT_IS_PRESENT_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_is_present, S_IRUGO, show_present, NULL, PORT##PORT1##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_is_present, S_IRUGO, show_present, NULL, PORT##PORT2##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_is_present, S_IRUGO, show_present, NULL, PORT##PORT3##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_is_present, S_IRUGO, show_present, NULL, PORT##PORT4##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_is_present, S_IRUGO, show_present, NULL, PORT##PORT5##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_is_present, S_IRUGO, show_present, NULL, PORT##PORT6##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_is_present, S_IRUGO, show_present, NULL, PORT##PORT7##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_is_present, S_IRUGO, show_present, NULL, PORT##PORT8##_PRESENT); +#define DECLARE_PORT_IS_PRESENT_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_is_present.dev_attr.attr, +DECLARE_PORT_IS_PRESENT_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_IS_PRESENT_SENSOR_DEVICE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + +#define DECLARE_PORT_TYPE_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT1##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT2##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT3##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT4##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT5##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT6##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT7##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_port_type, S_IRUGO, show_port_type, NULL, PORT##PORT8##_TYPE); +#define DECLARE_PORT_TYPE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_port_type.dev_attr.attr, +DECLARE_PORT_TYPE_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TYPE_SENSOR_DEVICE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + +#define DECLARE_PORT_RESET_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT1##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT2##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT3##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT4##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT5##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT6##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT7##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, sfp_set_port_reset, PORT##PORT8##_RESET); +#define DECLARE_PORT_RESET_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_port_reset.dev_attr.attr, +DECLARE_PORT_RESET_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_RESET_SENSOR_DEVICE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + +/* QSFP attributes for sysfs */ +#define DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT1##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT2##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT3##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT4##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT5##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT6##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT7##_RX_LOS##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_rx_los##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT8##_RX_LOS##INDEX); +#define DECLARE_PORT_RX_LOSn_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_rx_los##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_rx_los##INDEX.dev_attr.attr, +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(1, 9, 10, 11, 12, 13, 14, 15, 16) +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(2, 9, 10, 11, 12, 13, 14, 15, 16) +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(3, 9, 10, 11, 12, 13, 14, 15, 16) +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_RX_LOSn_SENSOR_DEVICE_ATTR(4, 9, 10, 11, 12, 13, 14, 15, 16) + +#define DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT1##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT2##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT3##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT4##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT5##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT6##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT7##_TX_DISABLE##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_tx_disable##INDEX, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, PORT##PORT8##_TX_DISABLE##INDEX); + +#define DECLARE_PORT_TX_DISABLEn_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_tx_disable##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_tx_disable##INDEX.dev_attr.attr, +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(1, 9, 10, 11, 12, 13, 14, 15, 16) +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(2, 9, 10, 11, 12, 13, 14, 15, 16) +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(3, 9, 10, 11, 12, 13, 14, 15, 16) +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_DISABLEn_SENSOR_DEVICE_ATTR(4, 9, 10, 11, 12, 13, 14, 15, 16) + +#define DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT1##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT2##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT3##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT4##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT5##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT6##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT7##_TX_FAULT##INDEX); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_tx_fault##INDEX, S_IRUGO, qsfp_show_tx_rx_status, NULL, PORT##PORT8##_TX_FAULT##INDEX); +#define DECLARE_PORT_TX_FAULTn_ATTR(INDEX, PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_tx_fault##INDEX.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_tx_fault##INDEX.dev_attr.attr, +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(1, 9, 10, 11, 12, 13, 14, 15, 16) +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(2, 9, 10, 11, 12, 13, 14, 15, 16) +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(3, 9, 10, 11, 12, 13, 14, 15, 16) +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_TX_FAULTn_SENSOR_DEVICE_ATTR(4, 9, 10, 11, 12, 13, 14, 15, 16) + +#define DECLARE_PORT_EEPROMn_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT1##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT2##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT3##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT4##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT5##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT6##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT7##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_eeprom, S_IRUGO, qsfp_show_eeprom, NULL, PORT##PORT8##_EEPROM); +#define DECLARE_PORT_EEPROMTn_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_eeprom.dev_attr.attr, +DECLARE_PORT_EEPROMn_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_PORT_EEPROMn_SENSOR_DEVICE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + +static struct attribute *qsfp_attributes[] = { + DECLARE_PORT_NUMBER_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_NUMBER_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_TYPE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TYPE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_IS_PRESENT_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_IS_PRESENT_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_RESET_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RESET_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_RX_LOSn_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RX_LOSn_ATTR(1, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_RX_LOSn_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RX_LOSn_ATTR(2, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_RX_LOSn_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RX_LOSn_ATTR(3, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_RX_LOSn_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RX_LOSn_ATTR(4, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_TX_DISABLEn_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_DISABLEn_ATTR(1, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_TX_DISABLEn_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_DISABLEn_ATTR(2, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_TX_DISABLEn_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_DISABLEn_ATTR(3, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_TX_DISABLEn_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_DISABLEn_ATTR(4, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_TX_FAULTn_ATTR(1, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_FAULTn_ATTR(1, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_TX_FAULTn_ATTR(2, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_FAULTn_ATTR(2, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_TX_FAULTn_ATTR(3, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_FAULTn_ATTR(3, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_TX_FAULTn_ATTR(4, 1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TX_FAULTn_ATTR(4, 9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_EEPROMTn_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_EEPROMTn_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + NULL +}; + + +/* SFP msa attributes for sysfs */ +static struct attribute *sfp_msa_attributes[] = { + DECLARE_PORT_NUMBER_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_NUMBER_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_TYPE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TYPE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_IS_PRESENT_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_IS_PRESENT_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_PORT_RESET_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RESET_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + NULL +}; + +/* SFP ddm attributes for sysfs */ +#define DECLARE_RX_LOS_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT1##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT2##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT3##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT4##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT5##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT6##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT7##_RX_LOS); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT8##_RX_LOS); +#define DECLARE_RX_LOS_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_rx_los.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_rx_los.dev_attr.attr, +DECLARE_RX_LOS_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_RX_LOS_SENSOR_DEVICE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + +#define DECLARE_TX_DISABLE_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT1##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT2##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT3##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT4##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT5##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT6##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT7##_TX_DISABLE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, PORT##PORT8##_TX_DISABLE); +#define DECLARE_TX_DISABLE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_tx_disable.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_tx_disable.dev_attr.attr, +DECLARE_TX_DISABLE_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_TX_DISABLE_SENSOR_DEVICE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + +#define DECLARE_TX_FAULT_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT1##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT2##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT3##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT4##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT5##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT6##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT7##_TX_FAULT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, PORT##PORT8##_TX_FAULT); +#define DECLARE_TX_FAULT_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_tx_fault.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_tx_fault.dev_attr.attr, +DECLARE_TX_FAULT_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) +DECLARE_TX_FAULT_SENSOR_DEVICE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) +static struct attribute *sfp_ddm_attributes[] = { + DECLARE_RX_LOS_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_RX_LOS_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_TX_DISABLE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_TX_DISABLE_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + DECLARE_TX_FAULT_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_TX_FAULT_ATTR(9, 10, 11, 12, 13, 14, 15, 16) + NULL +}; + +static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return data_len; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_write_byte_data(client, command, *data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return 1; +#endif + + +} + + +static ssize_t sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; +} + + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", (int)off, (int)count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return sfp_port_write(data, buf, off, count); +} + +static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + /* result = data_len; */ + +abort: + return result; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_read_byte_data(client, command); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, result); + goto abort; + } + + *data = (u8)result; + result = 1; + +abort: + return result; +#endif +} + +static ssize_t sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; + +} + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", (int)off, (int)count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return sfp_port_read(data, buf, off, count); +} + +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; + eeprom->size = EEPROM_SIZE; + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + return 0; +} + +static const struct attribute_group sfp_msa_group = { + .attrs = sfp_msa_attributes, +}; + +static int sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} + +static int sfp_msa_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_msa_data **data) +{ + int status; + struct sfp_msa_data *msa; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + msa = kzalloc(sizeof(struct sfp_msa_data), GFP_KERNEL); + if (!msa) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_msa_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &msa->eeprom.bin); + if (status) { + dev_info(&client->dev, "sfp msa '%s' (sfp_sysfs_eeprom_init fail...)\n", client->name); + /* goto exit_remove; */ + } + + *data = msa; + dev_info(&client->dev, "sfp msa '%s'\n", client->name); + + return 0; + +/* exit_remove: */ + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); +exit_free: + kfree(msa); +exit: + + return status; +} + +static const struct attribute_group sfp_ddm_group = { + .attrs = sfp_ddm_attributes, +}; + +static int sfp_ddm_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_ddm_data **data) +{ + int status; + struct sfp_ddm_data *ddm; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + ddm = kzalloc(sizeof(struct sfp_ddm_data), GFP_KERNEL); + if (!ddm) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_ddm_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &ddm->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = ddm; + dev_info(&client->dev, "sfp ddm '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); +exit_free: + kfree(ddm); +exit: + + return status; +} + +static const struct attribute_group qsfp_group = { + .attrs = qsfp_attributes, +}; + +static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + goto exit; + } + + if ((client->addr == SFP_CPLD_I2C_ADDR) || (client->addr == SFP_PCA9506_I2C_ADDR)){ + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } + } + + if (client->addr == SFP_EEPROM_A0_I2C_ADDR){ + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); + if (status) { + goto exit_remove; + } + } + + /* Bring QSFPs out of reset */ + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &qsfp_group); +exit_free: + kfree(qsfp); +exit: + + return status; +} + +static int sfp_device_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct sfp_port_data *data = NULL; + + data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + data->client = client; + + DEBUG_PRINT("data->port:%d client->addr:0x%0x\n", data->port, client->addr); + if ((client->addr == SFP_CPLD_I2C_ADDR) || (client->addr == SFP_PCA9506_I2C_ADDR)){ + if(data->port >= SFPPLUS_1_PORT_NUMBER){ + if(client->addr != SFP_PCA9506_I2C_ADDR){ + DEBUG_PRINT("client->addr:0x%0x\n", client->addr); + return -ENODEV; + } + } + else if(client->addr != SFP_CPLD_I2C_ADDR){ + DEBUG_PRINT("client->addr:0x%0x\n", client->addr); + return -ENODEV; + } + } + + data->driver_type = DRIVER_TYPE_QSFP; + return qsfp_probe(client, dev_id, &data->qsfp); +} + +static int sfp_msa_remove(struct i2c_client *client, struct sfp_msa_data *data) +{ + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + if ((client->addr == SFP_CPLD_I2C_ADDR) || (client->addr == SFP_PCA9506_I2C_ADDR)) + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); + kfree(data); + return 0; +} + +static int sfp_ddm_remove(struct i2c_client *client, struct sfp_ddm_data *data) +{ + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + if ((client->addr == SFP_CPLD_I2C_ADDR) || (client->addr == SFP_PCA9506_I2C_ADDR)) + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); + kfree(data); + return 0; +} + +static int qfp_remove(struct i2c_client *client, struct qsfp_data *data) +{ + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + if ((client->addr == SFP_CPLD_I2C_ADDR) || (client->addr == SFP_PCA9506_I2C_ADDR)) + sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + return 0; +} + +static int sfp_device_remove(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + return sfp_msa_remove(client, data->msa); + case DRIVER_TYPE_SFP_DDM: + return sfp_ddm_remove(client, data->ddm); + case DRIVER_TYPE_QSFP: + return qfp_remove(client, data->qsfp); + } + + return 0; +} + +static struct i2c_driver sfp_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = sfp_device_probe, + .remove = sfp_device_remove, + .id_table = sfp_device_id, + .address_list = normal_i2c, +}; + +static int __init sfp_init(void) +{ + return i2c_add_driver(&sfp_driver); +} + +static void __exit sfp_exit(void) +{ + i2c_del_driver(&sfp_driver); +} + +MODULE_AUTHOR("Philip Wang "); +MODULE_DESCRIPTION("alphanetworks snh60b0-640f driver"); +MODULE_LICENSE("GPL"); + +module_init(sfp_init); +module_exit(sfp_exit); + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_onie_eeprom.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_onie_eeprom.c new file mode 100644 index 000000000000..f259abdca8fc --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_onie_eeprom.c @@ -0,0 +1,268 @@ +/* + * A driver for snh60b0-640f onie eeprom + * + * Copyright (C) 2018 Alphanetworks Technology Corporation. + * Robin Chen + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define EEPROM_SIZE 256 + +#define SYS_LED_REG 0x8 +#define FAN12_LED_REG 0x9 +#define FAN34_LED_REG 0xA +#define FAN56_LED_REG 0xB +#define SYS_RESET1_REG 0x2 + +#define SYS_LOCATOR_LED_BITS 0x01 +#define SYS_PWR_LED_BITS 0x0E +#define SYS_STATUS_LED_BITS 0x70 +#define FAN135_LED_BITS 0x07 +#define FAN246_LED_BITS 0x38 + + +extern int alpha_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int alpha_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +static ssize_t onie_read(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t onie_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for snh60b0-640f_onie_eeprom */ +static const unsigned short normal_i2c[] = { 0x56, I2C_CLIENT_END }; + + +enum sysfs_onie_attributes { + ONIE_RW, +}; + +static SENSOR_DEVICE_ATTR(eeprom, (0660), onie_read, onie_write, ONIE_RW); + +static struct attribute *snh60b0_onie_attributes[] = { + &sensor_dev_attr_eeprom.dev_attr.attr, + NULL +}; + +static const struct attribute_group snh60b0_onie_group = { + .attrs = snh60b0_onie_attributes, +}; + + +static ssize_t onie_read(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0, res = 0; + u8 command; + struct i2c_client *client = to_i2c_client(dev); + __u8 read_write; + unsigned short offset = 0; + union i2c_smbus_data temp; + char rbuf[EEPROM_SIZE]; + + for( offset=0 ; offset < EEPROM_SIZE ; ++offset ) + { + read_write = I2C_SMBUS_WRITE; + offset = offset & 0x3fff; + temp.byte = (u8)offset; + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 2, &temp); + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 2, &temp); + + read_write = I2C_SMBUS_READ; + temp.byte = 0xaa; + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 1, &temp); + if (!res) + { + res = temp.byte; + rbuf[offset] = (char)temp.byte; + } + + read_write = I2C_SMBUS_READ; + temp.byte = 0xbb; + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 1, &temp); + if (!res) + { + res = temp.byte; + } + } + + memcpy(buf, rbuf, EEPROM_SIZE); + return EEPROM_SIZE; +} + +static ssize_t onie_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + int error, write, command, read; + + error = kstrtoint(buf, 10, &write); + if (error) + return error; + + if (write < 0 || write > 255) + return -EINVAL; + + /* Not support yet */ + + return count; +} + + + +static void alpha_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void alpha_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int onie_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + status = sysfs_create_group(&client->dev.kobj, &snh60b0_onie_group); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + alpha_i2c_cpld_add_client(client); + + return 0; + +exit: + return status; +} + +static int onie_eeprom_remove(struct i2c_client *client) +{ + sysfs_remove_group(&client->dev.kobj, &snh60b0_onie_group); + alpha_i2c_cpld_remove_client(client); + + return 0; +} + +static const struct i2c_device_id onie_eeprom_id[] = { + { "snh60b0_onie_eeprom", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, onie_eeprom_id); + +static struct i2c_driver onie_eeprom_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "snh60b0_onie_eeprom", + }, + .probe = onie_eeprom_probe, + .remove = onie_eeprom_remove, + .id_table = onie_eeprom_id, + .address_list = normal_i2c, +}; + + +static int __init onie_eeprom_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&onie_eeprom_driver); +} + +static void __exit onie_eeprom_exit(void) + +{ + i2c_del_driver(&onie_eeprom_driver); +} + + +MODULE_AUTHOR("Alpha-SID6"); +MODULE_DESCRIPTION("onie eeprom driver"); +MODULE_LICENSE("GPL"); + +module_init(onie_eeprom_init); +module_exit(onie_eeprom_exit); diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_power_cpld.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_power_cpld.c new file mode 100644 index 000000000000..00b8779ad50c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_power_cpld.c @@ -0,0 +1,501 @@ +/* + * A hwmon driver for the snh60b0-640f_power_cpld + * + * Copyright (C) 2018 Alphanetworks Technology Corporation. + * Robin Chen + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define DRIVER_NAME "snh60b0_power_cpld" +#define PSU1_STATUS_REG 0x3 +#define PSU2_STATUS_REG 0x4 +#define FAN_PWM_REG 0x23 + +#define PSU_PRESENT_BIT 0x4 +#define PSU_POWER_BIT 0x2 +#define FAN_PRESENT_BIT 0x2 + + +static ssize_t psu_show_status(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t fan_pwm_show(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t set_fan_pwm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); +static ssize_t fan_show_status(struct device *dev, struct device_attribute *attr, char *buf); + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for snh60b0-640f_power_cpld */ +static const unsigned short normal_i2c[] = { 0x5E, I2C_CLIENT_END }; + +struct snh60b0_pwr_cpld_data { + struct device *hwmon_dev; + struct mutex update_lock; + char model_name[9]; /* Model name, read from eeprom */ +}; + + +enum sysfs_psu_attributes { + PSU1_PRESENT, + PSU2_PRESENT, + PSU1_POWER_GOOD, + PSU2_POWER_GOOD, + FAN_PWM, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + /* FAN5_FAULT, */ + /* FAN6_FAULT, */ + FAN1_PRESENT=0x12, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + /* FAN5_PRESENT, */ + /* FAN6_PRESENT, */ + FAN1_FRONT_SPEED_RPM=0x1A, + FAN1_REAR_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + /* FAN5_FRONT_SPEED_RPM, */ + /* FAN5_REAR_SPEED_RPM, */ + /* FAN6_FRONT_SPEED_RPM, */ + /* FAN6_REAR_SPEED_RPM, */ +}; + +static SENSOR_DEVICE_ATTR(psu1_present, S_IRUGO, psu_show_status, NULL, PSU1_PRESENT); +static SENSOR_DEVICE_ATTR(psu2_present, S_IRUGO, psu_show_status, NULL, PSU2_PRESENT); +static SENSOR_DEVICE_ATTR(psu1_power_good, S_IRUGO, psu_show_status, NULL, PSU1_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu2_power_good, S_IRUGO, psu_show_status, NULL, PSU2_POWER_GOOD); +static SENSOR_DEVICE_ATTR(fan_pwm, (0660), fan_pwm_show, set_fan_pwm, FAN_PWM); +static SENSOR_DEVICE_ATTR(fan1_present, S_IRUGO, fan_show_status, NULL, FAN1_PRESENT); +static SENSOR_DEVICE_ATTR(fan2_present, S_IRUGO, fan_show_status, NULL, FAN2_PRESENT); +static SENSOR_DEVICE_ATTR(fan3_present, S_IRUGO, fan_show_status, NULL, FAN3_PRESENT); +static SENSOR_DEVICE_ATTR(fan4_present, S_IRUGO, fan_show_status, NULL, FAN4_PRESENT); +/* static SENSOR_DEVICE_ATTR(fan5_present, S_IRUGO, fan_show_status, NULL, FAN5_PRESENT); */ +/* static SENSOR_DEVICE_ATTR(fan6_present, S_IRUGO, fan_show_status, NULL, FAN6_PRESENT); */ +static SENSOR_DEVICE_ATTR(fan1_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN1_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan2_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN2_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan3_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN3_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan4_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN4_FRONT_SPEED_RPM); +/* static SENSOR_DEVICE_ATTR(fan5_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN5_FRONT_SPEED_RPM); */ +/* static SENSOR_DEVICE_ATTR(fan6_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN6_FRONT_SPEED_RPM); */ +static SENSOR_DEVICE_ATTR(fan1_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN1_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan2_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN2_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan3_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN3_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan4_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN4_REAR_SPEED_RPM); +/* static SENSOR_DEVICE_ATTR(fan5_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN5_REAR_SPEED_RPM); */ +/* static SENSOR_DEVICE_ATTR(fan6_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN6_REAR_SPEED_RPM); */ +static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, fan_show_status, NULL, FAN1_FAULT); static SENSOR_DEVICE_ATTR(fan11_fault, S_IRUGO, fan_show_status, NULL, FAN1_FAULT); +static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, fan_show_status, NULL, FAN2_FAULT); static SENSOR_DEVICE_ATTR(fan12_fault, S_IRUGO, fan_show_status, NULL, FAN2_FAULT); +static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, fan_show_status, NULL, FAN3_FAULT); static SENSOR_DEVICE_ATTR(fan13_fault, S_IRUGO, fan_show_status, NULL, FAN3_FAULT); +static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, fan_show_status, NULL, FAN4_FAULT); static SENSOR_DEVICE_ATTR(fan14_fault, S_IRUGO, fan_show_status, NULL, FAN4_FAULT); +/* static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, fan_show_status, NULL, FAN5_FAULT); static SENSOR_DEVICE_ATTR(fan15_fault, S_IRUGO, fan_show_status, NULL, FAN5_FAULT); */ +/* static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, fan_show_status, NULL, FAN6_FAULT); static SENSOR_DEVICE_ATTR(fan16_fault, S_IRUGO, fan_show_status, NULL, FAN6_FAULT); */ +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, fan_show_status, NULL, FAN1_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan11_input, S_IRUGO, fan_show_status, NULL, FAN1_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, fan_show_status, NULL, FAN2_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan12_input, S_IRUGO, fan_show_status, NULL, FAN2_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, fan_show_status, NULL, FAN3_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan13_input, S_IRUGO, fan_show_status, NULL, FAN3_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, fan_show_status, NULL, FAN4_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan14_input, S_IRUGO, fan_show_status, NULL, FAN4_REAR_SPEED_RPM); +/* static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, fan_show_status, NULL, FAN5_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan15_input, S_IRUGO, fan_show_status, NULL, FAN5_REAR_SPEED_RPM); */ +/* static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, fan_show_status, NULL, FAN6_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan16_input, S_IRUGO, fan_show_status, NULL, FAN6_REAR_SPEED_RPM); */ + + +static struct attribute *snh60b0_psu_attributes[] = { + &sensor_dev_attr_psu1_present.dev_attr.attr, + &sensor_dev_attr_psu2_present.dev_attr.attr, + &sensor_dev_attr_psu1_power_good.dev_attr.attr, + &sensor_dev_attr_psu2_power_good.dev_attr.attr, + &sensor_dev_attr_fan_pwm.dev_attr.attr, + &sensor_dev_attr_fan1_present.dev_attr.attr, + &sensor_dev_attr_fan2_present.dev_attr.attr, + &sensor_dev_attr_fan3_present.dev_attr.attr, + &sensor_dev_attr_fan4_present.dev_attr.attr, + /* &sensor_dev_attr_fan5_present.dev_attr.attr, */ + /* &sensor_dev_attr_fan6_present.dev_attr.attr, */ + &sensor_dev_attr_fan1_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan2_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan3_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan4_front_speed_rpm.dev_attr.attr, + /* &sensor_dev_attr_fan5_front_speed_rpm.dev_attr.attr, */ + /* &sensor_dev_attr_fan6_front_speed_rpm.dev_attr.attr, */ + &sensor_dev_attr_fan1_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan2_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan3_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan4_rear_speed_rpm.dev_attr.attr, + /* &sensor_dev_attr_fan5_rear_speed_rpm.dev_attr.attr, */ + /* &sensor_dev_attr_fan6_rear_speed_rpm.dev_attr.attr, */ + &sensor_dev_attr_fan1_fault.dev_attr.attr, &sensor_dev_attr_fan11_fault.dev_attr.attr, + &sensor_dev_attr_fan2_fault.dev_attr.attr, &sensor_dev_attr_fan12_fault.dev_attr.attr, + &sensor_dev_attr_fan3_fault.dev_attr.attr, &sensor_dev_attr_fan13_fault.dev_attr.attr, + &sensor_dev_attr_fan4_fault.dev_attr.attr, &sensor_dev_attr_fan14_fault.dev_attr.attr, + /* &sensor_dev_attr_fan5_fault.dev_attr.attr, &sensor_dev_attr_fan15_fault.dev_attr.attr, */ + /* &sensor_dev_attr_fan6_fault.dev_attr.attr, &sensor_dev_attr_fan16_fault.dev_attr.attr, */ + &sensor_dev_attr_fan1_input.dev_attr.attr, &sensor_dev_attr_fan11_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, &sensor_dev_attr_fan12_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, &sensor_dev_attr_fan13_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, &sensor_dev_attr_fan14_input.dev_attr.attr, + /* &sensor_dev_attr_fan5_input.dev_attr.attr, &sensor_dev_attr_fan15_input.dev_attr.attr, */ + /* &sensor_dev_attr_fan6_input.dev_attr.attr, &sensor_dev_attr_fan16_input.dev_attr.attr, */ + NULL +}; + +static const struct attribute_group snh60b0_psu_group = { + .attrs = snh60b0_psu_attributes, +}; + + +static ssize_t psu_show_status(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0, res = 0; + u8 command; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + + switch(sda->index) { + case PSU1_PRESENT: + case PSU1_POWER_GOOD: + command = PSU1_STATUS_REG; + break; + case PSU2_PRESENT: + case PSU2_POWER_GOOD: + command = PSU2_STATUS_REG; + break; + } + + val = i2c_smbus_read_byte_data(client, command); + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + switch(sda->index) { + case PSU1_PRESENT: + case PSU2_PRESENT: + res = (val & PSU_PRESENT_BIT ? 1 : 0 ); + break; + case PSU1_POWER_GOOD: + case PSU2_POWER_GOOD: + res = (val & PSU_POWER_BIT ? 1 : 0 ); + break; + } + + return sprintf(buf, "%d\n", res); +} + +static ssize_t fan_pwm_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, FAN_PWM_REG); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d", val); +} + +static ssize_t set_fan_pwm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 0xFF) + return -EINVAL; + + i2c_smbus_write_byte_data(client, FAN_PWM_REG, value); + + return count; +} + +static ssize_t fan_show_status(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + struct i2c_client *client = to_i2c_client(dev); + // struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev); + ssize_t ret = 0; + int val, val2; + + switch (sda->index) { + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + /* case FAN5_FRONT_SPEED_RPM: */ + /* case FAN6_FRONT_SPEED_RPM: */ + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + /* case FAN5_REAR_SPEED_RPM: */ + /* case FAN6_REAR_SPEED_RPM: */ + val = i2c_smbus_read_byte_data(client, sda->index); + ret = sprintf(buf, "%d\n", val * 150); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + /* case FAN5_PRESENT: */ + /* case FAN6_PRESENT: */ + val = i2c_smbus_read_byte_data(client, sda->index); + ret = sprintf(buf, "%d\n", (val & FAN_PRESENT_BIT) ? 1 : 0); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + /* case FAN5_FAULT: */ + /* case FAN6_FAULT: */ + val = i2c_smbus_read_byte_data(client, (sda->index - FAN1_FAULT)*2 + FAN1_FRONT_SPEED_RPM); + val2 = i2c_smbus_read_byte_data(client, (sda->index - FAN1_FAULT)*2 + FAN1_REAR_SPEED_RPM); + ret = sprintf(buf, "%d\n", (val|val2) ? 0 : 1); + break; + default: + break; + } + + return ret; +} + + +static void alpha_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void alpha_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int alpha_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct snh60b0_pwr_cpld_data* data; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct snh60b0_pwr_cpld_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + status = sysfs_create_group(&client->dev.kobj, &snh60b0_psu_group); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + alpha_i2c_cpld_add_client(client); + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit; + } + + dev_info(&client->dev, "%s: pwr_cpld '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit: + return status; +} + +static int alpha_i2c_cpld_remove(struct i2c_client *client) +{ + struct snh60b0_pwr_cpld_data *data = i2c_get_clientdata(client); + sysfs_remove_group(&client->dev.kobj, &snh60b0_psu_group); + alpha_i2c_cpld_remove_client(client); + kfree(data); + + return 0; +} + +static const struct i2c_device_id alpha_i2c_cpld_id[] = { + { DRIVER_NAME, 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, alpha_i2c_cpld_id); + +static struct i2c_driver alpha_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRIVER_NAME, + }, + .probe = alpha_i2c_cpld_probe, + .remove = alpha_i2c_cpld_remove, + .id_table = alpha_i2c_cpld_id, + .address_list = normal_i2c, +}; + +int alpha_i2c_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(alpha_i2c_cpld_read); + +int alpha_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(alpha_i2c_cpld_write); + +static int __init alpha_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&alpha_i2c_cpld_driver); +} + +static void __exit alpha_i2c_cpld_exit(void) +{ + i2c_del_driver(&alpha_i2c_cpld_driver); +} + +static struct dmi_system_id snh60b0_dmi_table[] = { + { + .ident = "Alpha snh60b0-640f", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alpha"), + DMI_MATCH(DMI_PRODUCT_NAME, "snh60b0-640f"), + }, + } +}; + +int platform_alpha_snh60b0(void) +{ + return dmi_check_system(snh60b0_dmi_table); +} +EXPORT_SYMBOL(platform_alpha_snh60b0); + +MODULE_AUTHOR("Alpha-SID6"); +MODULE_DESCRIPTION("alpha_power_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(alpha_i2c_cpld_init); +module_exit(alpha_i2c_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_system_cpld.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_system_cpld.c new file mode 100644 index 000000000000..ddba09370ca2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/modules/snh60b0-640f_system_cpld.c @@ -0,0 +1,365 @@ +/* + * A hwmon driver for the snh60b0-640f_system_cpld + * + * Copyright (C) 2018 Alphanetworks Technology Corporation. + * Robin Chen + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define SYS_LED_REG 0x8 +#define FAN12_LED_REG 0x9 +#define FAN34_LED_REG 0xA +#define SYS_RESET1_REG 0x2 +#define SWI_CTRL_REG 0x4 + +#define SYS_LOCATOR_LED_BITS 0x01 +#define SYS_PWR_LED_BITS 0x0E +#define SYS_STATUS_LED_BITS 0x70 +#define FAN135_LED_BITS 0x07 +#define FAN246_LED_BITS 0x38 +#define REST_BUTTON_BITS 0x0 + + +extern int alpha_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int alpha_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +static ssize_t sys_led_read(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t sys_led_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for snh60b0-640f_system_cpld */ +static const unsigned short normal_i2c[] = { 0x5F, I2C_CLIENT_END }; + + +enum sysfs_sys_attributes { + SYS_LOCATOR, + SYS_PWR, + SYS_STATUS, + FAN1_LED, + FAN2_LED, + FAN3_LED, + FAN4_LED, + SYS_REST1, + SWI_CTRL, +}; + +static SENSOR_DEVICE_ATTR(sys_locator, (0660), sys_led_read, sys_led_write, SYS_LOCATOR); +static SENSOR_DEVICE_ATTR(sys_pwr, (0660), sys_led_read, sys_led_write, SYS_PWR); +static SENSOR_DEVICE_ATTR(sys_status, (0600), sys_led_read, sys_led_write, SYS_STATUS); +static SENSOR_DEVICE_ATTR(fan1_led, (0660), sys_led_read, sys_led_write, FAN1_LED); +static SENSOR_DEVICE_ATTR(fan2_led, (0660), sys_led_read, sys_led_write, FAN2_LED); +static SENSOR_DEVICE_ATTR(fan3_led, (0660), sys_led_read, sys_led_write, FAN3_LED); +static SENSOR_DEVICE_ATTR(fan4_led, (0660), sys_led_read, sys_led_write, FAN4_LED); +static SENSOR_DEVICE_ATTR(sys_reset1, (0660), sys_led_read, sys_led_write, SYS_REST1); +static SENSOR_DEVICE_ATTR(swi_ctrl, (0660), sys_led_read, NULL, SWI_CTRL); + +static struct attribute *snh60b0_sys_attributes[] = { + &sensor_dev_attr_sys_locator.dev_attr.attr, + &sensor_dev_attr_sys_pwr.dev_attr.attr, + &sensor_dev_attr_sys_status.dev_attr.attr, + &sensor_dev_attr_fan1_led.dev_attr.attr, + &sensor_dev_attr_fan2_led.dev_attr.attr, + &sensor_dev_attr_fan3_led.dev_attr.attr, + &sensor_dev_attr_fan4_led.dev_attr.attr, + &sensor_dev_attr_sys_reset1.dev_attr.attr, + &sensor_dev_attr_swi_ctrl.dev_attr.attr, + NULL +}; + +static const struct attribute_group snh60b0_sys_group = { + .attrs = snh60b0_sys_attributes, +}; + + +static ssize_t sys_led_read(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0, res = 0; + u8 command; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + + switch(sda->index) { + case SYS_LOCATOR: + case SYS_PWR: + case SYS_STATUS: + command = SYS_LED_REG; + break; + case FAN1_LED: + case FAN2_LED: + case FAN3_LED: + case FAN4_LED: + command = FAN12_LED_REG + (sda->index - FAN1_LED)/2; + break; + case SYS_REST1: + command = SYS_RESET1_REG; + break; + case SWI_CTRL: + command = SWI_CTRL_REG; + break; + } + + val = i2c_smbus_read_byte_data(client, command); + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + switch(sda->index) { + case SYS_LOCATOR: + res = (val & SYS_LOCATOR_LED_BITS) >> 0; + break; + case SYS_PWR: + res = (val & SYS_PWR_LED_BITS) >> 1; + break; + case SYS_STATUS: + res = (val & SYS_STATUS_LED_BITS) >> 4; + break; + case FAN1_LED: + case FAN3_LED: + res = (val & FAN135_LED_BITS) >> 0; + break; + case FAN2_LED: + case FAN4_LED: + res = (val & FAN246_LED_BITS) >> 3; + break; + case SYS_REST1: + res = val; + break; + case SWI_CTRL: + res = (val & REST_BUTTON_BITS) >> 0; + break; + } + + return sprintf(buf, "%d\n", res); +} + +static ssize_t sys_led_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + int error, write, command, read; + + error = kstrtoint(buf, 10, &write); + if (error) + return error; + + + switch(sda->index) { + case SYS_LOCATOR: + if(write < 0 || write > 2) + return -EINVAL; + case SYS_PWR: + case SYS_STATUS: + if (write < 0 || write > 7) + return -EINVAL; + command = SYS_LED_REG; + break; + case FAN1_LED: + case FAN2_LED: + case FAN3_LED: + case FAN4_LED: + if (write < 0 || write > 7) + return -EINVAL; + command = FAN12_LED_REG + (sda->index - FAN1_LED)/2; + break; + case SYS_REST1: + if (write < 0 || write > 15) + return -EINVAL; + command = SYS_RESET1_REG; + break; + } + + read = i2c_smbus_read_byte_data(client, command); + if (read < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, read); + } + + switch(sda->index) { + case SYS_LOCATOR: + read &= ~SYS_LOCATOR_LED_BITS; + read |= write << 0; + break; + case SYS_PWR: + read &= ~SYS_PWR_LED_BITS; + read |= write << 1; + break; + case SYS_STATUS: + read &= ~SYS_STATUS_LED_BITS; + read |= write << 4; + break; + case FAN1_LED: + case FAN3_LED: + read &= ~FAN135_LED_BITS; + read |= write << 0; + break; + case FAN2_LED: + case FAN4_LED: + read &= ~FAN246_LED_BITS; + read |= write << 3; + break; + case SYS_REST1: + read = write; + break; + } + + i2c_smbus_write_byte_data(client, command, read); + + return count; +} + + + +static void alpha_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void alpha_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int alpha_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + status = sysfs_create_group(&client->dev.kobj, &snh60b0_sys_group); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + alpha_i2c_cpld_add_client(client); + + return 0; + +exit: + return status; +} + +static int alpha_i2c_cpld_remove(struct i2c_client *client) +{ + sysfs_remove_group(&client->dev.kobj, &snh60b0_sys_group); + alpha_i2c_cpld_remove_client(client); + + return 0; +} + +static const struct i2c_device_id alpha_i2c_cpld_id[] = { + { "snh60b0_system_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, alpha_i2c_cpld_id); + +static struct i2c_driver alpha_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "snh60b0_system_cpld", + }, + .probe = alpha_i2c_cpld_probe, + .remove = alpha_i2c_cpld_remove, + .id_table = alpha_i2c_cpld_id, + .address_list = normal_i2c, +}; + + +static int __init alpha_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&alpha_i2c_cpld_driver); +} + +static void __exit alpha_i2c_cpld_exit(void) +{ + i2c_del_driver(&alpha_i2c_cpld_driver); +} + + +MODULE_AUTHOR("Alpha-SID6"); +MODULE_DESCRIPTION("alpha_system_cpld driver"); +MODULE_LICENSE("GPL"); + +module_init(alpha_i2c_cpld_init); +module_exit(alpha_i2c_cpld_exit); diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/service/snh60b0-platform-init.service b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/service/snh60b0-platform-init.service new file mode 100644 index 000000000000..fa2e849c7c34 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/service/snh60b0-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Alphanetworks SNH60B0-640F Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/alphanetworks_snh60b0_util.py -f install +ExecStop=/usr/local/bin/alphanetworks_snh60b0_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/setup.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/setup.py new file mode 100644 index 000000000000..785a36660182 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='snh60b0_640f', + version='1.0', + description='Module to initialize Alphanetworks SNH60B0-640F platforms', + + packages=['snh60b0_640f'], + package_dir={'snh60b0_640f': 'snh60b0-640f/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/utils/alphanetworks_snh60b0_util.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/utils/alphanetworks_snh60b0_util.py new file mode 100755 index 000000000000..4b64a2e12a1f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snh60b0-640f/utils/alphanetworks_snh60b0_util.py @@ -0,0 +1,427 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Alphanetworks Technology Corporation. +# Robin Chen +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# see +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'snh60b0-640f' +device_path = "x86_64-alphanetworks_snh60b0_640f-r0" +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +FORCE = 0 + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print PROJECT_NAME.upper()+": "+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + show_log (cmd +" with result: " + str(status)) + show_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep alphanetworks", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + +kos = [ +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x', +'modprobe optoe' , +'modprobe snh60b0-640f_power_cpld' , +'modprobe snh60b0-640f_system_cpld' , +'modprobe snh60b0-640f_onie_eeprom' , +'modprobe alphanetworks_snh60b0_640f_sfp' ] + +def driver_install(): + global FORCE + status, output = log_os_system("depmod", 1) + for i in range(0,len(kos)): + if kos[i].find('pca954') != -1: + status, output = log_os_system(kos[i]+ " force_deselect_on_exit=1", 1) + else: + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +i2c_prefix = '/sys/bus/i2c/devices/' + +sfp_map = [13,14,15,16,23] +mknod =[ +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-5/new_device', +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-7/new_device', +'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-6/new_device', +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-20/new_device', +'echo 24c02 0x51 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo 24c02 0x51 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo snh60b0_onie_eeprom 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo snh60b0_power_cpld 0x5e > /sys/bus/i2c/devices/i2c-0/new_device', +'echo snh60b0_system_cpld 0x5f > /sys/bus/i2c/devices/i2c-8/new_device', +'echo lm75 0x4D > /sys/bus/i2c/devices/i2c-3/new_device', +'echo lm75 0x4C > /sys/bus/i2c/devices/i2c-4/new_device', +'echo lm75 0x4F > /sys/bus/i2c/devices/i2c-0/new_device' ] + +mknod2 =[ +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-6/new_device', +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-8/new_device', +'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-7/new_device', +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-21/new_device', +'echo 24c02 0x51 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo 24c02 0x51 > /sys/bus/i2c/devices/i2c-12/new_device', +'echo snh60b0_onie_eeprom 0x56 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo snh60b0_power_cpld 0x5e > /sys/bus/i2c/devices/i2c-1/new_device', +'echo snh60b0_system_cpld 0x5f > /sys/bus/i2c/devices/i2c-9/new_device', +'echo lm75 0x4D > /sys/bus/i2c/devices/i2c-4/new_device', +'echo lm75 0x4C > /sys/bus/i2c/devices/i2c-5/new_device', +'echo lm75 0x4F > /sys/bus/i2c/devices/i2c-1/new_device' ] + + +def i2c_order_check(): + # i2c bus 0 and 1 might be installed in different order. + # Here check if 0x76 is exist @ i2c-0 + tmp = "echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device" + status, output = log_os_system(tmp, 0) + if not device_exist(): + order = 1 + tmp = "sed -i 's/0-/1-/g' /usr/share/sonic/device/"+device_path+"/fancontrol" + status, output = log_os_system(tmp, 0) + else: + order = 0 + tmp = "sed -i 's/1-/0-/g' /usr/share/sonic/device/"+device_path+"/fancontrol" + status, output = log_os_system(tmp, 0) + tmp = "echo 0x70 > /sys/bus/i2c/devices/i2c-0/delete_device" + status, output = log_os_system(tmp, 0) + return order + +def device_install(): + global FORCE + + order = i2c_order_check() + + # if 0x76 is not exist @i2c-0, use reversed bus order + if order: + for i in range(0,len(mknod2)): + #for pca954x need times to built new i2c buses + if mknod2[i].find('pca954') != -1: + time.sleep(1) + + if mknod2[i].find('lm75') != -1: + time.sleep(1) + + status, output = log_os_system(mknod2[i], 1) + if status: + print output + if FORCE == 0: + return status + else: + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + if mknod[i].find('lm75') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + status, output =log_os_system("echo 0 > /sys/bus/i2c/devices/8-005f/sys_reset1", 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0, 66): + index = i / 16 + port = i % 16 + reg_sfp = 0 + if port == 0: + reg_sfp = 1 + + if reg_sfp == 1: + if i == 64: + status, output =log_os_system("echo sfpcpld"+str(i+1)+" 0x20 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[index])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + if i < 64: + status, output =log_os_system("echo sfpcpld"+str(i+1)+" 0x5f > /sys/bus/i2c/devices/i2c-"+str(sfp_map[index])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + status, output =log_os_system("echo sfpcpld"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[index])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + + if i == 64: + status, output =log_os_system("echo sfpcpld"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-21/new_device", 1) + if status: + print output + if FORCE == 0: + return status + if i == 65: + status, output =log_os_system("echo sfpcpld"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-22/new_device", 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/1-0070", 0) + if status==0: + I2C_ORDER=1 + else: + I2C_ORDER=0 + + for i in range(0, 66): + index = i / 16 + port = i % 16 + reg_sfp = 0 + if port == 0: + reg_sfp = 1 + + if reg_sfp == 1: + if i == 64: + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[index])+"/delete_device" + status, output =log_os_system("echo 0x20 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + if i < 64: + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[index])+"/delete_device" + status, output =log_os_system("echo 0x5f > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[index])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + if i == 64: + status, output =log_os_system("echo 0x50 > /sys/bus/i2c/devices/i2c-21/delete_device", 1) + if status: + print output + if FORCE == 0: + return status + if i == 65: + status, output =log_os_system("echo 0x50 > /sys/bus/i2c/devices/i2c-22/delete_device", 1) + if status: + print output + if FORCE == 0: + return status + if I2C_ORDER==0: + nodelist = mknod + else: + nodelist = mknod2 + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + tmp = "find /var/lib/docker/overlay -iname fancontrol | grep usr/sbin/fancontrol | xargs cat | sed '429d' | sed '428a if \[ $? -ne 1 \]' | sed '425d' | sed '424a return' > /tmp/tmp_fancontrol" + status, output = log_os_system(tmp, 1) + tmp = "fancontrol_tmp=`find /var/lib/docker/overlay -iname fancontrol | grep usr/sbin/fancontrol` ; cp /tmp/tmp_fancontrol $fancontrol_tmp" + status, output = log_os_system(tmp, 1) + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0070", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() From 0d4a6b7960d3e0dc0204746594f5b22a2924a038 Mon Sep 17 00:00:00 2001 From: Mykola Faryma Date: Thu, 11 Oct 2018 10:33:25 +0300 Subject: [PATCH 1671/1833] [submodule] update sonic-py-swsssdk (pick up fix for issue #254) Signed-off-by: Mykola Faryma --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index d67519c4a3af..7ce52d861019 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit d67519c4a3affb94da858f8fe96c37045d0d7e92 +Subproject commit 7ce52d86101906e404af96fe76e04079f4afd863 From d3a9eed21e1e7c7f62cbc3a85e60bfda77a119ed Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 11 Oct 2018 16:36:00 -0700 Subject: [PATCH 1672/1833] [docker-sonic-mgmt]: fix azure kusto library version to 0.0.13 (#2138) Signed-off-by: Guohan Lu --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index 2feac5403539..aa02a701f510 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -48,8 +48,8 @@ RUN pip install ipaddr \ paramiko==2.1.2 # Install Microsoft Azure Kusto Library for Python -RUN pip install azure-kusto-data \ - azure-kusto-ingest +RUN pip install azure-kusto-data==0.0.13 \ + azure-kusto-ingest==0.0.13 ## Copy and install sonic-mgmt docker dependencies COPY \ From 5ab66b191a4c77697943674708bceb266b8a0344 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 12 Oct 2018 08:05:38 -0700 Subject: [PATCH 1673/1833] [bcm config] remove scache_filename config entry (#2140) Warm boot is managed by SAI. This configuration entry shouldn't be included in bcm config. Signed-off-by: Ying Xie --- .../Accton-AS5712-54X/td2-as5712-72x10G.config.bcm | 1 - .../td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm | 1 - .../Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm | 1 - .../Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm | 1 - .../td2-a7050-q31s4-31x40G-4x10G.config.bcm | 1 - .../Arista-7260CX3-C64/th2-a7260cx3-64-64x100G.config.bcm | 2 -- .../th2-a7260cx3-64-112x50G+8x100G.config.bcm | 2 -- .../Force10-S6000/td2-s6000-32x40G.config.bcm | 1 - .../Force10-Z9100/th-z9100-32x100G.config.bcm | 2 -- .../DellEMC-Z9264f/th2-z9264f-64x100G.config.bcm | 2 -- .../Delta-ag9064/th2-ag9064-64x100G.config.bcm | 1 - .../INGRASYS-S8810-32Q/td2-s8810-32x40G.config.bcm | 1 - .../INGRASYS-S8900-54XC/th-s8900-48x25G+6x100G.config.bcm | 2 -- .../INGRASYS-S8900-64XC/th-s8900-48x25G+16x100G.config.bcm | 2 -- .../INGRASYS-S9100-C32/th-s9100-32x100G.config.bcm | 2 -- src/sonic-device-data/tests/permitted_list | 1 - 16 files changed, 23 deletions(-) diff --git a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/td2-as5712-72x10G.config.bcm b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/td2-as5712-72x10G.config.bcm index 715468c621a1..85ad634792c5 100644 --- a/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/td2-as5712-72x10G.config.bcm +++ b/device/accton/x86_64-accton_as5712_54x-r0/Accton-AS5712-54X/td2-as5712-72x10G.config.bcm @@ -142,4 +142,3 @@ l3_max_ecmp_mode=1 max_vp_lags=0 stable_size=0x2000000 -scache_filename=/tmp/scache diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm index 6d72e20b2104..4ce6b2d4a9d6 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm @@ -44,7 +44,6 @@ max_vp_lags=0 miim_intr_enable=0 mmu_lossless=0 module_64ports=0 -scache_filename=/tmp/scache schan_intr_enable=0 stable_size=0x2000000 tdma_timeout_usec=5000000 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm index 701a8480dcb3..76b1af3aba16 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm @@ -44,7 +44,6 @@ max_vp_lags=0 miim_intr_enable=0 mmu_lossless=0 module_64ports=0 -scache_filename=/tmp/scache schan_intr_enable=0 stable_size=0x2000000 tdma_timeout_usec=5000000 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm index c898369b035d..3b1a4514409c 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/td2-a7050-qx32s-32x40G.config.bcm @@ -39,7 +39,6 @@ miim_intr_enable=0 mmu_lossless=0 module_64ports=0 -scache_filename=/tmp/scache stable_size=0x2000000 schan_intr_enable=0 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm index e34b925da2ce..4819c7929ecd 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm @@ -210,7 +210,6 @@ portmap_101.0=117:40 portmap_102.0=113:40 portmap_103.0=1:40 portmap_104.0=5:40 -scache_filename=/tmp/scache schan_intr_enable=0 serdes_firmware_mode_1.0=2 serdes_firmware_mode_5.0=2 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/th2-a7260cx3-64-64x100G.config.bcm b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/th2-a7260cx3-64-64x100G.config.bcm index 1197bca761b6..4c9e65869318 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/th2-a7260cx3-64-64x100G.config.bcm +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/th2-a7260cx3-64-64x100G.config.bcm @@ -939,8 +939,6 @@ portmap_9=17:100 robust_hash_disable_egress_vlan=1 robust_hash_disable_mpls=1 robust_hash_disable_vlan=1 -scache_filename=/tmp/scache -scache_filename=/tmp/scache sram_scan_enable=0 stable_size=0x5500000 stable_size=0x5500000 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/th2-a7260cx3-64-112x50G+8x100G.config.bcm b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/th2-a7260cx3-64-112x50G+8x100G.config.bcm index 120b13c037aa..456148f06716 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/th2-a7260cx3-64-112x50G+8x100G.config.bcm +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/th2-a7260cx3-64-112x50G+8x100G.config.bcm @@ -681,8 +681,6 @@ port_init_cl72_hg=1 robust_hash_disable_egress_vlan=1 robust_hash_disable_mpls=1 robust_hash_disable_vlan=1 -scache_filename=/tmp/scache -scache_filename=/tmp/scache sram_scan_enable=0 stable_size=0x5500000 stable_size=0x5500000 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm index 9ab9c29a32bc..068b587202bd 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm @@ -29,7 +29,6 @@ max_vp_lags=0 miim_intr_enable=0 mmu_lossless=0 module_64ports=0 -scache_filename=/tmp/scache schan_intr_enable=0 stable_size=0x2000000 tdma_timeout_usec=5000000 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/th-z9100-32x100G.config.bcm b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/th-z9100-32x100G.config.bcm index a1c51ef225f1..ea335c15d628 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/th-z9100-32x100G.config.bcm +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/th-z9100-32x100G.config.bcm @@ -13,8 +13,6 @@ os=unix parity_correction=1 parity_enable=1 -scache_filename=/tmp/scache - #Port configuration portmap_38=49:100 portmap_39=53:100 diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/th2-z9264f-64x100G.config.bcm b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/th2-z9264f-64x100G.config.bcm index 5231b526c112..fdd3b3fc076d 100644 --- a/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/th2-z9264f-64x100G.config.bcm +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/DellEMC-Z9264f/th2-z9264f-64x100G.config.bcm @@ -18,8 +18,6 @@ ipv6_lpm_128b_enable=1 parity_correction=1 parity_enable=1 -scache_filename=/tmp/scache - dport_map_enable=1 dport_map_enable=1 diff --git a/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/th2-ag9064-64x100G.config.bcm b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/th2-ag9064-64x100G.config.bcm index 4cc15059e8ba..859196d8e5c8 100644 --- a/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/th2-ag9064-64x100G.config.bcm +++ b/device/delta/x86_64-delta_ag9064-r0/Delta-ag9064/th2-ag9064-64x100G.config.bcm @@ -797,7 +797,6 @@ phy_an_allow_pll_change_hg=0 robust_hash_disable_egress_vlan=1 robust_hash_disable_mpls=1 robust_hash_disable_vlan=1 -scache_filename=/tmp/scache sram_scan_enable=0 stable_size=0x5500000 mmu_lossless=1 diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/td2-s8810-32x40G.config.bcm b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/td2-s8810-32x40G.config.bcm index daa4b7a7ed24..894f60345a73 100644 --- a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/td2-s8810-32x40G.config.bcm +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/INGRASYS-S8810-32Q/td2-s8810-32x40G.config.bcm @@ -2,7 +2,6 @@ os=unix module_64ports=0 -scache_filename=/tmp/scache schan_intr_enable=0 stable_size=0x2000000 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/th-s8900-48x25G+6x100G.config.bcm b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/th-s8900-48x25G+6x100G.config.bcm index 9248b066561b..8440176b200a 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/th-s8900-48x25G+6x100G.config.bcm +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/INGRASYS-S8900-54XC/th-s8900-48x25G+6x100G.config.bcm @@ -12,8 +12,6 @@ lpm_ipv6_128b_reserved=0 parity_correction=1 parity_enable=1 -scache_filename=/tmp/scach - #PIPE0 portmap_1=1:25 portmap_2=2:25 diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/th-s8900-48x25G+16x100G.config.bcm b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/th-s8900-48x25G+16x100G.config.bcm index 11d8e30a2aa8..562e584012d5 100644 --- a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/th-s8900-48x25G+16x100G.config.bcm +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/INGRASYS-S8900-64XC/th-s8900-48x25G+16x100G.config.bcm @@ -12,8 +12,6 @@ lpm_ipv6_128b_reserved=0 parity_correction=1 parity_enable=1 -scache_filename=/tmp/scach - #PIPE0 portmap_1=17:25 portmap_2=18:25 diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/th-s9100-32x100G.config.bcm b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/th-s9100-32x100G.config.bcm index 3f4ce8faa740..46b8799efef2 100644 --- a/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/th-s9100-32x100G.config.bcm +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/INGRASYS-S9100-C32/th-s9100-32x100G.config.bcm @@ -18,8 +18,6 @@ mmu_lossless=0 parity_correction=1 parity_enable=1 -scache_filename=/tmp/scach - #PIPE0 portmap_1=5:100 portmap_2=1:100 diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list index ea78b8165f3a..a52e1c0d8ebe 100644 --- a/src/sonic-device-data/tests/permitted_list +++ b/src/sonic-device-data/tests/permitted_list @@ -109,7 +109,6 @@ rate_ext_mdio_divisor robust_hash_disable_egress_vlan robust_hash_disable_mpls robust_hash_disable_vlan -scache_filename schan_intr_enable schan_timeout_usec serdes_automed From cd1167d76736c074a7443283efad61cdbee5c159 Mon Sep 17 00:00:00 2001 From: "Kevin(Shengkai) Wang" Date: Fri, 12 Oct 2018 23:32:39 +0800 Subject: [PATCH 1674/1833] [mellanox]: Fix sysfs path for PSU devices in psuutil plugin (#2143) Snmp container needs to access the PSU path, but /bsp doesn't mount into the container, so need to use the real path rather than a symlink. Signed-off-by: Kevin Wang --- .../x86_64-mlnx_msn2010-r0/plugins/psuutil.py | 12 ++++++++---- .../x86_64-mlnx_msn2100-r0/plugins/psuutil.py | 11 ++++++++--- .../x86_64-mlnx_msn2410-r0/plugins/psuutil.py | 11 ++++++++--- .../x86_64-mlnx_msn2700-r0/plugins/psuutil.py | 11 ++++++++--- .../x86_64-mlnx_msn2740-r0/plugins/psuutil.py | 12 ++++++++---- 5 files changed, 40 insertions(+), 17 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py index d89a046940d0..914ef050d2c7 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py @@ -20,10 +20,14 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - - self.psu_path = "/bsp/module/" - self.psu_presence = "psu{}_pwr_status" - self.psu_oper_status = "psu{}_pwr_status" + self.psu_path = "" + for index in range(0, 100): + hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index) + if os.path.exists(hwmon_path): + self.psu_path = hwmon_path + break + self.psu_presence = "pwr{}" + self.psu_oper_status = "pwr{}" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py index 01954dededf7..b9bb580d7c57 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py @@ -21,9 +21,14 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_path = "/bsp/module/" - self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pwr_status" + self.psu_path = "" + for index in range(0, 100): + hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index) + if os.path.exists(hwmon_path): + self.psu_path = hwmon_path + break + self.psu_presence = "pwr{}" + self.psu_oper_status = "pwr{}" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py index 13738bb77f46..954045dde59c 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py @@ -21,9 +21,14 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_path = "/bsp/module/" - self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pwr_status" + self.psu_path = "" + for index in range(0, 100): + hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index) + if os.path.exists(hwmon_path): + self.psu_path = hwmon_path + break + self.psu_presence = "psu{}" + self.psu_oper_status = "pwr{}" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py index 13738bb77f46..954045dde59c 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py @@ -21,9 +21,14 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_path = "/bsp/module/" - self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pwr_status" + self.psu_path = "" + for index in range(0, 100): + hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index) + if os.path.exists(hwmon_path): + self.psu_path = hwmon_path + break + self.psu_presence = "psu{}" + self.psu_oper_status = "pwr{}" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py index 13738bb77f46..8c47a0083249 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py @@ -20,10 +20,14 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - - self.psu_path = "/bsp/module/" - self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pwr_status" + self.psu_path = "" + for index in range(0, 100): + hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index) + if os.path.exists(hwmon_path): + self.psu_path = hwmon_path + break + self.psu_presence = "psu{}" + self.psu_oper_status = "pwr{}" def get_num_psus(self): """ From 7d51f8363fb2a5299a5b5f5fa1ca8855be54de1b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 12 Oct 2018 08:39:06 -0700 Subject: [PATCH 1675/1833] Fix bug: if all containers killed, service stop will throw exception because no redis (#2139) Signed-off-by: Qi Luo --- files/build_templates/docker_image_ctl.j2 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 61f32f16b7b9..813f60da21e0 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -39,18 +39,18 @@ function postStartAction() {%- endif %} } -# Obtain our platform as we will mount directories with these names in each docker -PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform` +start() { + # Obtain our platform as we will mount directories with these names in each docker + PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform` -{%- if docker_container_name == "database" %} -# Don't mount HWSKU in {{docker_container_name}} container. -HWSKU="" -{%- else %} -# Obtain our HWSKU as we will mount directories with these names in each docker -HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'` -{%- endif %} + {%- if docker_container_name == "database" %} + # Don't mount HWSKU in {{docker_container_name}} container. + HWSKU="" + {%- else %} + # Obtain our HWSKU as we will mount directories with these names in each docker + HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'` + {%- endif %} -start() { DOCKERCHECK=`docker inspect --type container {{docker_container_name}} 2>/dev/null` if [ "$?" -eq "0" ]; then DOCKERMOUNT=`getMountPoint "$DOCKERCHECK"` From 33d4140f2719cee6ed2fddae75bd96334bc524ed Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Sat, 13 Oct 2018 02:00:30 +0300 Subject: [PATCH 1676/1833] [devices]: Fixed trancevier presence getter on Mellanox. (#2144) Signed-off-by: Nazarii Hnydyn --- device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py | 5 ++++- device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py | 5 ++++- device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py | 5 ++++- device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 5 ++++- device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py | 5 ++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py index 053b591b70fb..7fd349f6ead9 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py @@ -15,6 +15,9 @@ REDIS_PORT = 6379 REDIS_TIMEOUT_USECS = 0 +# parameters for SFP presence +SFP_STATUS_INSERTED = '1' + class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" PORT_START = 0 @@ -71,7 +74,7 @@ def get_presence(self, port_num): content = reg_file.readline().rstrip() # content is a string with the qsfp status - if content == "1": + if content == SFP_STATUS_INSERTED: return True return False diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py index d534386e2fbe..a4cb383a8126 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py @@ -15,6 +15,9 @@ REDIS_PORT = 6379 REDIS_TIMEOUT_USECS = 0 +# parameters for SFP presence +SFP_STATUS_INSERTED = '1' + class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" PORT_START = 0 @@ -70,7 +73,7 @@ def get_presence(self, port_num): content = reg_file.readline().rstrip() # content is a string with the qsfp status - if content == "good": + if content == SFP_STATUS_INSERTED: return True return False diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py index bc61073ba10b..f437ce5f3679 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py @@ -15,6 +15,9 @@ REDIS_PORT = 6379 REDIS_TIMEOUT_USECS = 0 +# parameters for SFP presence +SFP_STATUS_INSERTED = '1' + class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" PORT_START = 0 @@ -71,7 +74,7 @@ def get_presence(self, port_num): content = reg_file.readline().rstrip() # content is a string with the qsfp status - if content == "good": + if content == SFP_STATUS_INSERTED: return True return False 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 f85fcc4d9040..63ede4259058 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -15,6 +15,9 @@ REDIS_PORT = 6379 REDIS_TIMEOUT_USECS = 0 +# parameters for SFP presence +SFP_STATUS_INSERTED = '1' + class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" PORT_START = 0 @@ -70,7 +73,7 @@ def get_presence(self, port_num): content = reg_file.readline().rstrip() # content is a string with the qsfp status - if content == "good": + if content == SFP_STATUS_INSERTED: return True return False diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py index f85fcc4d9040..63ede4259058 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py @@ -15,6 +15,9 @@ REDIS_PORT = 6379 REDIS_TIMEOUT_USECS = 0 +# parameters for SFP presence +SFP_STATUS_INSERTED = '1' + class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" PORT_START = 0 @@ -70,7 +73,7 @@ def get_presence(self, port_num): content = reg_file.readline().rstrip() # content is a string with the qsfp status - if content == "good": + if content == SFP_STATUS_INSERTED: return True return False From 999408a95413776041af88fde60767860a251b4b Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Fri, 12 Oct 2018 16:00:51 -0700 Subject: [PATCH 1677/1833] [security] patch the code for DSA-4133-1 isc-dhcp -- security update (#2142) https://security-tracker.debian.org/tracker/CVE-2017-3144 https://security-tracker.debian.org/tracker/CVE-2018-5732 https://security-tracker.debian.org/tracker/CVE-2018-5733 --- src/isc-dhcp/patch/0005-CVE-2017-3144.patch | 47 +++++++ src/isc-dhcp/patch/0006-CVE-2018-5733.patch | 145 ++++++++++++++++++++ src/isc-dhcp/patch/0007-CVE-2018-5732.patch | 144 +++++++++++++++++++ src/isc-dhcp/patch/series | 4 + 4 files changed, 340 insertions(+) create mode 100644 src/isc-dhcp/patch/0005-CVE-2017-3144.patch create mode 100644 src/isc-dhcp/patch/0006-CVE-2018-5733.patch create mode 100644 src/isc-dhcp/patch/0007-CVE-2018-5732.patch diff --git a/src/isc-dhcp/patch/0005-CVE-2017-3144.patch b/src/isc-dhcp/patch/0005-CVE-2017-3144.patch new file mode 100644 index 000000000000..fe066e177a8c --- /dev/null +++ b/src/isc-dhcp/patch/0005-CVE-2017-3144.patch @@ -0,0 +1,47 @@ +From: Thomas Markwalder +Date: Thu, 7 Dec 2017 11:23:36 -0500 +Subject: [master] Plugs a socket descriptor leak in OMAPI +Origin: https://source.isc.org/cgi-bin/gitweb.cgi?p=dhcp.git;a=commit;h=1a6b62fe17a42b00fa234d06b6dfde3d03451894 +Bug: https://bugs.isc.org/Public/Bug/Display.html?id=46767 +Bug-Debian: https://bugs.debian.org/887413 +Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-3144 + + Merges in rt46767. +--- + +diff --git a/omapip/buffer.c b/omapip/buffer.c +index 6e0621b5..a21f0a80 100644 +--- a/omapip/buffer.c ++++ b/omapip/buffer.c +@@ -565,6 +565,15 @@ isc_result_t omapi_connection_writer (omapi_object_t *h) + omapi_buffer_dereference (&buffer, MDL); + } + } ++ ++ /* If we had data left to write when we're told to disconnect, ++ * we need recall disconnect, now that we're done writing. ++ * See rt46767. */ ++ if (c->out_bytes == 0 && c->state == omapi_connection_disconnecting) { ++ omapi_disconnect (h, 1); ++ return ISC_R_SHUTTINGDOWN; ++ } ++ + return ISC_R_SUCCESS; + } + +diff --git a/omapip/message.c b/omapip/message.c +index ee15d821..37abbd25 100644 +--- a/omapip/message.c ++++ b/omapip/message.c +@@ -339,7 +339,7 @@ isc_result_t omapi_message_unregister (omapi_object_t *mo) + } + + #ifdef DEBUG_PROTOCOL +-static const char *omapi_message_op_name(int op) { ++const char *omapi_message_op_name(int op) { + switch (op) { + case OMAPI_OP_OPEN: return "OMAPI_OP_OPEN"; + case OMAPI_OP_REFRESH: return "OMAPI_OP_REFRESH"; +-- +2.16.2 + diff --git a/src/isc-dhcp/patch/0006-CVE-2018-5733.patch b/src/isc-dhcp/patch/0006-CVE-2018-5733.patch new file mode 100644 index 000000000000..f2ddff0503eb --- /dev/null +++ b/src/isc-dhcp/patch/0006-CVE-2018-5733.patch @@ -0,0 +1,145 @@ +From: Zhenggen Xu +Date: Thu, 11 Oct 2018 17:18:32 -0700 +Subject: [PATCH] Subject: [master] Corrected refcnt loss in option parsing + Origin: + https://source.isc.org/cgi-bin/gitweb.cgi?p=dhcp.git;a=commit;h=197b26f25309f947b97a83b8fdfc414b767798f8 + Bug: https://bugs.isc.org/Public/Bug/Display.html?id=47140 Bug-Debian: + https://bugs.debian.org/891785 Bug-Debian-Security: + https://security-tracker.debian.org/tracker/CVE-2018-5733 + + Merges in 47140. +--- + common/options.c | 2 + + common/tests/Makefile.am | 11 ++++- + common/tests/option_unittest.c | 79 ++++++++++++++++++++++++++++++++++ + 3 files changed, 91 insertions(+), 1 deletion(-) + create mode 100644 common/tests/option_unittest.c + +diff --git a/common/options.c b/common/options.c +index 74f1fb5..db28b5c 100644 +--- a/common/options.c ++++ b/common/options.c +@@ -177,6 +177,8 @@ int parse_option_buffer (options, buffer, length, universe) + + /* If the length is outrageous, the options are bad. */ + if (offset + len > length) { ++ /* Avoid reference count overflow */ ++ option_dereference(&option, MDL); + reason = "option length exceeds option buffer length"; + bogus: + log_error("parse_option_buffer: malformed option " +diff --git a/common/tests/Makefile.am b/common/tests/Makefile.am +index 32e055c..19521c9 100644 +--- a/common/tests/Makefile.am ++++ b/common/tests/Makefile.am +@@ -8,7 +8,8 @@ ATF_TESTS = + + if HAVE_ATF + +-ATF_TESTS += alloc_unittest dns_unittest misc_unittest ns_name_unittest ++ATF_TESTS += alloc_unittest dns_unittest misc_unittest ns_name_unittest \ ++ option_unittest + + alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c + alloc_unittest_LDADD = $(ATF_LDFLAGS) +@@ -34,6 +35,14 @@ ns_name_unittest_LDADD += ../libdhcp.a \ + ../../omapip/libomapi.a ../../bind/lib/libirs.a \ + ../../bind/lib/libdns.a ../../bind/lib/libisccfg.a ../../bind/lib/libisc.a + ++option_unittest_SOURCES = option_unittest.c $(top_srcdir)/tests/t_api_dhcp.c ++option_unittest_LDADD = $(ATF_LDFLAGS) ++option_unittest_LDADD += ../libdhcp.@A@ ../../omapip/libomapi.@A@ \ ++ @BINDLIBIRSDIR@/libirs.@A@ \ ++ @BINDLIBDNSDIR@/libdns.@A@ \ ++ @BINDLIBISCCFGDIR@/libisccfg.@A@ \ ++ @BINDLIBISCDIR@/libisc.@A@ ++ + check: $(ATF_TESTS) + sh ${top_srcdir}/tests/unittest.sh + +diff --git a/common/tests/option_unittest.c b/common/tests/option_unittest.c +new file mode 100644 +index 0000000..36236b8 +--- /dev/null ++++ b/common/tests/option_unittest.c +@@ -0,0 +1,79 @@ ++/* ++ * Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC") ++ * ++ * This Source Code Form is subject to the terms of the Mozilla Public ++ * License, v. 2.0. If a copy of the MPL was not distributed with this ++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH ++ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY ++ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, ++ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM ++ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE ++ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ++ * PERFORMANCE OF THIS SOFTWARE. ++ */ ++ ++#include ++#include ++#include "dhcpd.h" ++ ++ATF_TC(option_refcnt); ++ ++ATF_TC_HEAD(option_refcnt, tc) ++{ ++ atf_tc_set_md_var(tc, "descr", ++ "Verify option reference count does not overflow."); ++} ++ ++/* This test does a simple check to see if option reference count is ++ * decremented even an error path exiting parse_option_buffer() ++ */ ++ATF_TC_BODY(option_refcnt, tc) ++{ ++ struct option_state *options; ++ struct option *option; ++ unsigned code; ++ int refcnt; ++ unsigned char buffer[3] = { 15, 255, 0 }; ++ ++ initialize_common_option_spaces(); ++ ++ options = NULL; ++ if (!option_state_allocate(&options, MDL)) { ++ atf_tc_fail("can't allocate option state"); ++ } ++ ++ option = NULL; ++ code = 15; /* domain-name */ ++ if (!option_code_hash_lookup(&option, dhcp_universe.code_hash, ++ &code, 0, MDL)) { ++ atf_tc_fail("can't find option 15"); ++ } ++ if (option == NULL) { ++ atf_tc_fail("option is NULL"); ++ } ++ refcnt = option->refcnt; ++ ++ buffer[0] = 15; ++ buffer[1] = 255; /* invalid */ ++ buffer[2] = 0; ++ ++ if (parse_option_buffer(options, buffer, 3, &dhcp_universe)) { ++ atf_tc_fail("parse_option_buffer is expected to fail"); ++ } ++ ++ if (refcnt != option->refcnt) { ++ atf_tc_fail("refcnt changed from %d to %d", refcnt, option->refcnt); ++ } ++} ++ ++/* This macro defines main() method that will call specified ++ test cases. tp and simple_test_case names can be whatever you want ++ as long as it is a valid variable identifier. */ ++ATF_TP_ADD_TCS(tp) ++{ ++ ATF_TP_ADD_TC(tp, option_refcnt); ++ ++ return (atf_no_error()); ++} + diff --git a/src/isc-dhcp/patch/0007-CVE-2018-5732.patch b/src/isc-dhcp/patch/0007-CVE-2018-5732.patch new file mode 100644 index 000000000000..d6c10e2e6532 --- /dev/null +++ b/src/isc-dhcp/patch/0007-CVE-2018-5732.patch @@ -0,0 +1,144 @@ +From: Thomas Markwalder +Date: Sat, 10 Feb 2018 12:15:27 -0500 +Subject: [master] Correct buffer overrun in pretty_print_option +Origin: https://source.isc.org/cgi-bin/gitweb.cgi?p=dhcp.git;a=commit;h=c5931725b48b121d232df4ba9e45bc41e0ba114d +Bug: https://bugs.isc.org/Public/Bug/Display.html?id=47139 +Bug-Debian: https://bugs.debian.org/891786 +Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2018-5732 + + Merges in rt47139. +--- + +diff --git a/common/options.c b/common/options.c +index 6f23bc15..fc0e0889 100644 +--- a/common/options.c ++++ b/common/options.c +@@ -1776,7 +1776,8 @@ format_min_length(format, oc) + + + /* Format the specified option so that a human can easily read it. */ +- ++/* Maximum pretty printed size */ ++#define MAX_OUTPUT_SIZE 32*1024 + const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) + struct option *option; + const unsigned char *data; +@@ -1784,8 +1785,9 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) + int emit_commas; + int emit_quotes; + { +- static char optbuf [32768]; /* XXX */ +- static char *endbuf = &optbuf[sizeof(optbuf)]; ++ /* We add 128 byte pad so we don't have to add checks everywhere. */ ++ static char optbuf [MAX_OUTPUT_SIZE + 128]; /* XXX */ ++ static char *endbuf = optbuf + MAX_OUTPUT_SIZE; + int hunksize = 0; + int opthunk = 0; + int hunkinc = 0; +@@ -2211,7 +2213,14 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) + log_error ("Unexpected format code %c", + fmtbuf [j]); + } ++ + op += strlen (op); ++ if (op >= endbuf) { ++ log_error ("Option data exceeds" ++ " maximum size %d", MAX_OUTPUT_SIZE); ++ return (""); ++ } ++ + if (dp == data + len) + break; + if (j + 1 < numelem && comma != ':') +diff --git a/common/tests/option_unittest.c b/common/tests/option_unittest.c +index 36236b84..cd52cfb4 100644 +--- a/common/tests/option_unittest.c ++++ b/common/tests/option_unittest.c +@@ -43,7 +43,7 @@ ATF_TC_BODY(option_refcnt, tc) + if (!option_state_allocate(&options, MDL)) { + atf_tc_fail("can't allocate option state"); + } +- ++ + option = NULL; + code = 15; /* domain-name */ + if (!option_code_hash_lookup(&option, dhcp_universe.code_hash, +@@ -68,12 +68,75 @@ ATF_TC_BODY(option_refcnt, tc) + } + } + ++ATF_TC(pretty_print_option); ++ ++ATF_TC_HEAD(pretty_print_option, tc) ++{ ++ atf_tc_set_md_var(tc, "descr", ++ "Verify pretty_print_option does not overrun its buffer."); ++} ++ ++ ++/* ++ * This test verifies that pretty_print_option() will not overrun its ++ * internal, static buffer when given large 'x/X' format options. ++ * ++ */ ++ATF_TC_BODY(pretty_print_option, tc) ++{ ++ struct option *option; ++ unsigned code; ++ unsigned char bad_data[32*1024]; ++ unsigned char good_data[] = { 1,2,3,4,5,6 }; ++ int emit_commas = 1; ++ int emit_quotes = 1; ++ const char *output_buf; ++ ++ /* Initialize whole thing to non-printable chars */ ++ memset(bad_data, 0x1f, sizeof(bad_data)); ++ ++ initialize_common_option_spaces(); ++ ++ /* We'll use dhcp_client_identitifer because it happens to be format X */ ++ code = 61; ++ option = NULL; ++ if (!option_code_hash_lookup(&option, dhcp_universe.code_hash, ++ &code, 0, MDL)) { ++ atf_tc_fail("can't find option %d", code); ++ } ++ ++ if (option == NULL) { ++ atf_tc_fail("option is NULL"); ++ } ++ ++ /* First we will try a good value we know should fit. */ ++ output_buf = pretty_print_option (option, good_data, sizeof(good_data), ++ emit_commas, emit_quotes); ++ ++ /* Make sure we get what we expect */ ++ if (!output_buf || strcmp(output_buf, "1:2:3:4:5:6")) { ++ atf_tc_fail("pretty_print_option did not return \"\""); ++ } ++ ++ ++ /* Now we'll try a data value that's too large */ ++ output_buf = pretty_print_option (option, bad_data, sizeof(bad_data), ++ emit_commas, emit_quotes); ++ ++ /* Make sure we safely get an error */ ++ if (!output_buf || strcmp(output_buf, "")) { ++ atf_tc_fail("pretty_print_option did not return \"\""); ++ } ++} ++ ++ + /* This macro defines main() method that will call specified + test cases. tp and simple_test_case names can be whatever you want + as long as it is a valid variable identifier. */ + ATF_TP_ADD_TCS(tp) + { + ATF_TP_ADD_TC(tp, option_refcnt); ++ ATF_TP_ADD_TC(tp, pretty_print_option); + + return (atf_no_error()); + } +-- +2.16.2 + diff --git a/src/isc-dhcp/patch/series b/src/isc-dhcp/patch/series index 17e5e152483b..3e1c15338687 100644 --- a/src/isc-dhcp/patch/series +++ b/src/isc-dhcp/patch/series @@ -3,3 +3,7 @@ 0002-Support-for-obtaining-name-of-physical-interface-tha.patch 0003-Support-for-loading-port-alias-map-file-to-replace-p.patch 0004-Bugfix-Don-t-print-log-messages-to-stderr-in-release.patch +0005-CVE-2017-3144.patch +0006-CVE-2018-5733.patch +0007-CVE-2018-5732.patch + From dcb7b92e0bb87dcd75cb6af14162d7c6fdb2ec63 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 12 Oct 2018 19:41:22 -0700 Subject: [PATCH 1678/1833] [devices]: Add index column to Mellanox-SN2700-D48C8/port_config.ini (#2146) Signed-off-by: Qi Luo --- .../Mellanox-SN2700-D48C8/port_config.ini | 114 +++++++++--------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini index ffe3fe0ce6d9..9e01da79f449 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini @@ -1,57 +1,57 @@ -# name lanes speed alias -Ethernet0 0,1 50000 etp1a -Ethernet2 2,3 50000 etp1b -Ethernet4 4,5 50000 etp2a -Ethernet6 6,7 50000 etp2b -Ethernet8 8,9 50000 etp3a -Ethernet10 10,11 50000 etp3b -Ethernet12 12,13 50000 etp4a -Ethernet14 14,15 50000 etp4b -Ethernet16 16,17 50000 etp5a -Ethernet18 18,19 50000 etp5b -Ethernet20 20,21 50000 etp6a -Ethernet22 22,23 50000 etp6b -Ethernet24 24,25,26,27 100000 etp7 -Ethernet28 28,29,30,31 100000 etp8 -Ethernet32 32,33,34,35 100000 etp9 -Ethernet36 36,37,38,39 100000 etp10 -Ethernet40 40,41 50000 etp11a -Ethernet42 42,43 50000 etp11b -Ethernet44 44,45 50000 etp12a -Ethernet46 46,47 50000 etp12b -Ethernet48 48,49 50000 etp13a -Ethernet50 50,51 50000 etp13b -Ethernet52 52,53 50000 etp14a -Ethernet54 54,55 50000 etp14b -Ethernet56 56,57 50000 etp15a -Ethernet58 58,59 50000 etp15b -Ethernet60 60,61 50000 etp16a -Ethernet62 62,63 50000 etp16b -Ethernet64 64,65 50000 etp17a -Ethernet66 66,67 50000 etp17b -Ethernet68 68,69 50000 etp18a -Ethernet70 70,71 50000 etp18b -Ethernet72 72,73 50000 etp19a -Ethernet74 74,75 50000 etp19b -Ethernet76 76,77 50000 etp20a -Ethernet78 78,79 50000 etp20b -Ethernet80 80,81 50000 etp21a -Ethernet82 82,83 50000 etp21b -Ethernet84 84,85 50000 etp22a -Ethernet86 86,87 50000 etp22b -Ethernet88 88,89,90,91 100000 etp23 -Ethernet92 92,93,94,95 100000 etp24 -Ethernet96 96,97,98,99 100000 etp25 -Ethernet100 100,101,102,103 100000 etp26 -Ethernet104 104,105 50000 etp27a -Ethernet106 106,107 50000 etp27b -Ethernet108 108,109 50000 etp28a -Ethernet110 110,111 50000 etp28b -Ethernet112 112,113 50000 etp29a -Ethernet114 114,115 50000 etp29b -Ethernet116 116,117 50000 etp30a -Ethernet118 118,119 50000 etp30b -Ethernet120 120,121 50000 etp31a -Ethernet122 122,123 50000 etp31b -Ethernet124 124,125 50000 etp32a -Ethernet126 126,127 50000 etp32b +# name lanes speed alias index +Ethernet0 0,1 50000 etp1a 1 +Ethernet2 2,3 50000 etp1b 1 +Ethernet4 4,5 50000 etp2a 2 +Ethernet6 6,7 50000 etp2b 2 +Ethernet8 8,9 50000 etp3a 3 +Ethernet10 10,11 50000 etp3b 3 +Ethernet12 12,13 50000 etp4a 4 +Ethernet14 14,15 50000 etp4b 4 +Ethernet16 16,17 50000 etp5a 5 +Ethernet18 18,19 50000 etp5b 5 +Ethernet20 20,21 50000 etp6a 6 +Ethernet22 22,23 50000 etp6b 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 50000 etp11a 11 +Ethernet42 42,43 50000 etp11b 11 +Ethernet44 44,45 50000 etp12a 12 +Ethernet46 46,47 50000 etp12b 12 +Ethernet48 48,49 50000 etp13a 13 +Ethernet50 50,51 50000 etp13b 13 +Ethernet52 52,53 50000 etp14a 14 +Ethernet54 54,55 50000 etp14b 14 +Ethernet56 56,57 50000 etp15a 15 +Ethernet58 58,59 50000 etp15b 15 +Ethernet60 60,61 50000 etp16a 16 +Ethernet62 62,63 50000 etp16b 16 +Ethernet64 64,65 50000 etp17a 17 +Ethernet66 66,67 50000 etp17b 17 +Ethernet68 68,69 50000 etp18a 18 +Ethernet70 70,71 50000 etp18b 18 +Ethernet72 72,73 50000 etp19a 19 +Ethernet74 74,75 50000 etp19b 19 +Ethernet76 76,77 50000 etp20a 20 +Ethernet78 78,79 50000 etp20b 20 +Ethernet80 80,81 50000 etp21a 21 +Ethernet82 82,83 50000 etp21b 21 +Ethernet84 84,85 50000 etp22a 22 +Ethernet86 86,87 50000 etp22b 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 50000 etp27a 27 +Ethernet106 106,107 50000 etp27b 27 +Ethernet108 108,109 50000 etp28a 28 +Ethernet110 110,111 50000 etp28b 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 From a7701feb6f0deaa3aa53fcf6df5b07e8496fcc1c Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 14 Oct 2018 09:03:23 -0700 Subject: [PATCH 1679/1833] [submodule]: update sonic-utilities (#2150) * 6d00d14 2018-10-13 | pfcwd cmd check (#342) (HEAD, origin/master, origin/HEAD) [Wenda Ni] * eb92560 2018-10-12 | [show] Refactor show vlan brief to use configdb and update the output (#340) [Deva Nandhagopal] * 9a139ab 2018-10-10 | Remove explicit dependency on tabulate; Add comments (#336) [Joe LeVeque] * 7874b8f 2018-10-09 | Update restart_count to restore_count for warm restart (#326) [Jipan Yang] * 7a51a85 2018-10-08 | [acl_loader] fix show acl table (#329) [ironjosh] * 54ebfc8 2018-10-05 | Add a "-l/--load-sysinfo" option for "config reload" to merge the system info on device (#324) [zhenggen-xu] * 34810df 2018-10-05 | [show] Eliminate need for writing template files for 'show platform summary' and 'show version' (#335) [Joe LeVeque] * 4258287 2018-10-05 | Added argument forwarder for platform reboot. (#333) [Nazarii Hnydyn] * e2b4bd5 2018-10-03 | Warm reboot: Add support for docker upgrade (#292) [Jipan Yang] * f1236aa 2018-10-01 | Root priviliege for ecn configuration set commands (#332) [Wenda Ni] * 3098b8a 2018-10-01 | require root privilege for all pfcwd configuration commands (#330) [lguohan] * 7627d08 2018-09-27 | [config]: Add portchannel related commands (#328) [Shuotian Cheng] * b8a62d7 2018-09-27 | Add 'alias mode' support for show commands (#298) [paavaanan] * 4383300 2018-09-26 | [aclshow]: Fix the KeyError issue in aclshow (#325) [Shuotian Cheng] Signed-off-by: Guohan Lu --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index f78bba447a1a..6d00d1413d7e 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit f78bba447a1aabac0d97801455bf144e9f4f1ece +Subproject commit 6d00d1413d7e4a8e8ac826ad1add3403402c1a60 From 36ca171c6efc6eb77799bec7d4d72c58bb015bcd Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Mon, 15 Oct 2018 13:00:57 -0700 Subject: [PATCH 1680/1833] [ipinip config] Add v6 ip and peering ip besides currect v4 loopback (#2145) [ipinip config] Add v6 ip and peering ip besides currect v4 loopback --- dockers/docker-orchagent/ipinip.json.j2 | 57 ++++++++++++++++++- .../tests/sample_output/ipinip.json | 14 ++++- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index 36fccddc237a..6fd5f5a7f15c 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -1,16 +1,68 @@ -{# only IPv4 decapsulation is supported #} +{% set ipv4_addresses = [] %} +{% set ipv6_addresses = [] %} {% set ipv4_loopback_addresses = [] %} +{% set ipv6_loopback_addresses = [] %} {% for (name, prefix) in LOOPBACK_INTERFACE %} {%- if prefix | ipv4 and name == 'Loopback0' %} + {%- set ipv4_addresses = ipv4_addresses.append(prefix) %} {%- set ipv4_loopback_addresses = ipv4_loopback_addresses.append(prefix) %} {%- endif %} + {%- if prefix | ipv6 and name == 'Loopback0' %} + {%- set ipv6_addresses = ipv6_addresses.append(prefix) %} + {%- set ipv6_loopback_addresses = ipv6_loopback_addresses.append(prefix) %} + {%- endif %} +{% endfor %} +{% for (name, prefix) in INTERFACE %} + {%- if prefix | ipv4 %} + {%- set ipv4_addresses = ipv4_addresses.append(prefix) %} + {%- endif %} + {%- if prefix | ipv6 %} + {%- set ipv6_addresses = ipv6_addresses.append(prefix) %} + {%- endif %} +{% endfor %} +{% for (name, prefix) in PORTCHANNEL_INTERFACE %} + {%- if prefix | ipv4 %} + {%- set ipv4_addresses = ipv4_addresses.append(prefix) %} + {%- endif %} + {%- if prefix | ipv6 %} + {%- set ipv6_addresses = ipv6_addresses.append(prefix) %} + {%- endif %} +{% endfor %} +{% for (name, prefix) in VLAN_INTERFACE %} + {%- if prefix | ipv4 %} + {%- set ipv4_addresses = ipv4_addresses.append(prefix) %} + {%- endif %} + {%- if prefix | ipv6 %} + {%- set ipv6_addresses = ipv6_addresses.append(prefix) %} + {%- endif %} {% endfor %} [ +{% if ipv4_loopback_addresses %} { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", "src_ip":"{{ ipv4_loopback_addresses | first | ip }}", - "dst_ip":"{% for prefix in ipv4_loopback_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", + "dst_ip":"{% for prefix in ipv4_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", +{% if "mlnx" in DEVICE_METADATA.localhost.platform %} + "dscp_mode":"uniform", + "ecn_mode":"standard", +{% else %} + "dscp_mode":"pipe", + "ecn_mode":"copy_from_outer", +{% endif %} + "ttl_mode":"pipe" + }, + "OP": "SET" + } +{% endif %} +{% if ipv4_loopback_addresses and ipv6_loopback_addresses %} , +{% endif %} +{% if ipv6_loopback_addresses %} + { + "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { + "tunnel_type":"IPINIP", + "src_ip":"{{ ipv6_loopback_addresses | first | ip }}", + "dst_ip":"{% for prefix in ipv6_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", {% if "mlnx" in DEVICE_METADATA.localhost.platform %} "dscp_mode":"uniform", "ecn_mode":"standard", @@ -22,4 +74,5 @@ }, "OP": "SET" } +{% endif %} ] diff --git a/src/sonic-config-engine/tests/sample_output/ipinip.json b/src/sonic-config-engine/tests/sample_output/ipinip.json index 5a7ac1b6063b..24fbf2955a2f 100644 --- a/src/sonic-config-engine/tests/sample_output/ipinip.json +++ b/src/sonic-config-engine/tests/sample_output/ipinip.json @@ -3,7 +3,19 @@ "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", "src_ip":"10.1.0.32", - "dst_ip":"10.1.0.32", + "dst_ip":"10.1.0.32,10.0.0.56,10.0.0.58,10.0.0.60,10.0.0.62,192.168.0.1", + "dscp_mode":"pipe", + "ecn_mode":"copy_from_outer", + "ttl_mode":"pipe" + }, + "OP": "SET" + } + , + { + "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { + "tunnel_type":"IPINIP", + "src_ip":"fc00:1::32", + "dst_ip":"fc00:1::32,fc00::71,fc00::75,fc00::79,fc00::7d", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" From a401ee7fa8699bc408492314f5344b997aa8ab5f Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 15 Oct 2018 13:49:35 -0700 Subject: [PATCH 1681/1833] [build]: do not override ENABLE_SYNCD_RPC in rules/config (#2151) Signed-off-by: Guohan Lu --- Makefile.work | 2 +- slave.mk | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.work b/Makefile.work index cce9d4f9add1..ba61b48059ad 100644 --- a/Makefile.work +++ b/Makefile.work @@ -94,7 +94,7 @@ SONIC_BUILD_INSTRUCTION := make \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \ - ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ + SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ diff --git a/slave.mk b/slave.mk index 28833e3605dd..e88352f7cbdb 100644 --- a/slave.mk +++ b/slave.mk @@ -70,6 +70,10 @@ ifeq ($(SONIC_ENABLE_SYSTEM_TELEMETRY),y) ENABLE_SYSTEM_TELEMETRY = y endif +ifeq ($(SONIC_ENABLE_SYNCD_RPC),y) +ENABLE_SYNCD_RPC = y +endif + include $(RULES_PATH)/config include $(RULES_PATH)/functions include $(RULES_PATH)/*.mk From e2ffb589ed5fc2d775859ad0b1c45b0d389b961e Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Mon, 15 Oct 2018 15:01:39 -0700 Subject: [PATCH 1682/1833] [security] Fixes for DSA-4314-1 net-snmp (#2152) CVE-case: https://security-tracker.debian.org/tracker/CVE-2018-18065 --- ...-snmpd-crashes-when-receiving-a-GetN.patch | 36 +++++++++++++++++++ src/snmpd/patch-5.7.3+dfsg/series | 1 + 2 files changed, 37 insertions(+) create mode 100644 src/snmpd/patch-5.7.3+dfsg/0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch diff --git a/src/snmpd/patch-5.7.3+dfsg/0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch b/src/snmpd/patch-5.7.3+dfsg/0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch new file mode 100644 index 000000000000..cdf9b94be934 --- /dev/null +++ b/src/snmpd/patch-5.7.3+dfsg/0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch @@ -0,0 +1,36 @@ +From 2170e345858738e65d3156a49d3186e4a9288821 Mon Sep 17 00:00:00 2001 +From: Zhenggen Xu +Date: Fri, 12 Oct 2018 17:13:54 -0700 +Subject: [PATCH] Subject: [PATCH] CHANGES: BUG: 2743: snmpd crashes when + receiving a GetNext PDU with multiple Varbinds + +skip out-of-range varbinds when calling next handler +--- + agent/helpers/table.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/agent/helpers/table.c b/agent/helpers/table.c +index 882e84c..b943d6e 100644 +--- a/agent/helpers/table.c ++++ b/agent/helpers/table.c +@@ -406,6 +406,8 @@ table_helper_handler(netsnmp_mib_handler *handler, + if (reqinfo->mode == MODE_GET) + table_helper_cleanup(reqinfo, request, + SNMP_NOSUCHOBJECT); ++ else ++ request->processed = 1; /* skip if next handler called */ + continue; + } + +@@ -483,6 +485,8 @@ table_helper_handler(netsnmp_mib_handler *handler, + #endif /* NETSNMP_NO_WRITE_SUPPORT */ + table_helper_cleanup(reqinfo, request, + SNMP_NOSUCHOBJECT); ++ else ++ request->processed = 1; /* skip if next handler called */ + continue; + } + /* +-- +2.18.0 + diff --git a/src/snmpd/patch-5.7.3+dfsg/series b/src/snmpd/patch-5.7.3+dfsg/series index 6da32966e731..edc25f4890e7 100644 --- a/src/snmpd/patch-5.7.3+dfsg/series +++ b/src/snmpd/patch-5.7.3+dfsg/series @@ -1,2 +1,3 @@ 0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch 0002-at.c-properly-check-return-status-from-realloc.-Than.patch +0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch From bcea4b3fa9b74a9f0425e56d0538a8787ef83c8e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 15 Oct 2018 18:28:58 -0700 Subject: [PATCH 1683/1833] [sonic-cfggen]: Fix minigraph DhcpRelays parsing issue (#2154) * Check that we have dhcprelays text before using it * Add additional variable to avoid extracting node again and again --- src/sonic-config-engine/minigraph.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index a72eed754b8c..bfb478ba381b 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -211,8 +211,9 @@ def parse_dpg(dpg, hname): # If this VLAN requires a DHCP relay agent, it will contain a element # containing a list of DHCP server IPs - if vintf.find(str(QName(ns, "DhcpRelays"))) is not None: - vintfdhcpservers = vintf.find(str(QName(ns, "DhcpRelays"))).text + vintf_node = vintf.find(str(QName(ns, "DhcpRelays"))) + if vintf_node is not None and vintf_node.text is not None: + vintfdhcpservers = vintf_node.text vdhcpserver_list = vintfdhcpservers.split(';') vlan_attributes['dhcp_servers'] = vdhcpserver_list From 3fb150a275e92b1c195281b006048ba96cfa4cb0 Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Tue, 16 Oct 2018 00:10:55 -0700 Subject: [PATCH 1684/1833] [devices]: Add platform code for 7170 barefoot (#2158) --- .../Arista-7170-64C/board_lane_map.json | 9368 +++++++++++++++++ .../Arista-7170-64C/port_config.ini | 132 +- .../Arista-7170-64C/switch-sai.conf | 32 + 3 files changed, 9465 insertions(+), 67 deletions(-) create mode 100644 device/arista/x86_64-arista_7170_64c/Arista-7170-64C/board_lane_map.json create mode 100644 device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-sai.conf diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/board_lane_map.json b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/board_lane_map.json new file mode 100644 index 000000000000..41af3f9ba73f --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/board_lane_map.json @@ -0,0 +1,9368 @@ +{ + "board_name": "7170-64C", + "version": "0.1", + "is_hardware": 1, + "num_of_connectors": 68, + "board_lane_map_entry": [ + { + "connector": 1, + "lane": 0, + "mac_block": 63, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 1, + "lane": 1, + "mac_block": 63, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 1, + "lane": 2, + "mac_block": 63, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 1, + "lane": 3, + "mac_block": 63, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 2, + "lane": 0, + "mac_block": 2, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 2, + "lane": 1, + "mac_block": 2, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 2, + "lane": 2, + "mac_block": 2, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 2, + "lane": 3, + "mac_block": 2, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 3, + "lane": 0, + "mac_block": 61, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 3, + "lane": 1, + "mac_block": 61, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 3, + "lane": 2, + "mac_block": 61, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 3, + "lane": 3, + "mac_block": 61, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 4, + "lane": 0, + "mac_block": 60, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 4, + "lane": 1, + "mac_block": 60, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 4, + "lane": 2, + "mac_block": 60, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 4, + "lane": 3, + "mac_block": 60, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 5, + "lane": 0, + "mac_block": 55, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 5, + "lane": 1, + "mac_block": 55, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 5, + "lane": 2, + "mac_block": 55, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 5, + "lane": 3, + "mac_block": 55, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 6, + "lane": 0, + "mac_block": 58, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 6, + "lane": 1, + "mac_block": 58, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 6, + "lane": 2, + "mac_block": 58, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 6, + "lane": 3, + "mac_block": 58, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 7, + "lane": 0, + "mac_block": 53, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 7, + "lane": 1, + "mac_block": 53, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 7, + "lane": 2, + "mac_block": 53, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 7, + "lane": 3, + "mac_block": 53, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 8, + "lane": 0, + "mac_block": 15, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 8, + "lane": 1, + "mac_block": 15, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 8, + "lane": 2, + "mac_block": 15, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 8, + "lane": 3, + "mac_block": 15, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 9, + "lane": 0, + "mac_block": 12, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 9, + "lane": 1, + "mac_block": 12, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 9, + "lane": 2, + "mac_block": 12, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 9, + "lane": 3, + "mac_block": 12, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 10, + "lane": 0, + "mac_block": 13, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 10, + "lane": 1, + "mac_block": 13, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 10, + "lane": 2, + "mac_block": 13, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 10, + "lane": 3, + "mac_block": 13, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 11, + "lane": 0, + "mac_block": 9, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 11, + "lane": 1, + "mac_block": 9, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 11, + "lane": 2, + "mac_block": 9, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 11, + "lane": 3, + "mac_block": 9, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 12, + "lane": 0, + "mac_block": 7, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 12, + "lane": 1, + "mac_block": 7, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 12, + "lane": 2, + "mac_block": 7, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 12, + "lane": 3, + "mac_block": 7, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 13, + "lane": 0, + "mac_block": 4, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 3 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 13, + "lane": 1, + "mac_block": 4, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 3 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 13, + "lane": 2, + "mac_block": 4, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 3 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 13, + "lane": 3, + "mac_block": 4, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 3 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 14, + "lane": 0, + "mac_block": 5, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 3 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 14, + "lane": 1, + "mac_block": 5, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 3 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 14, + "lane": 2, + "mac_block": 5, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 3 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 14, + "lane": 3, + "mac_block": 5, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 3 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 15, + "lane": 0, + "mac_block": 51, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 15, + "lane": 1, + "mac_block": 51, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 15, + "lane": 2, + "mac_block": 51, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 15, + "lane": 3, + "mac_block": 51, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 16, + "lane": 0, + "mac_block": 50, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 16, + "lane": 1, + "mac_block": 50, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 16, + "lane": 2, + "mac_block": 50, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 16, + "lane": 3, + "mac_block": 50, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 17, + "lane": 0, + "mac_block": 46, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 17, + "lane": 1, + "mac_block": 46, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 17, + "lane": 2, + "mac_block": 46, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 17, + "lane": 3, + "mac_block": 46, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 18, + "lane": 0, + "mac_block": 48, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 18, + "lane": 1, + "mac_block": 48, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 18, + "lane": 2, + "mac_block": 48, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 18, + "lane": 3, + "mac_block": 48, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 5 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 19, + "lane": 0, + "mac_block": 29, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 1 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 19, + "lane": 1, + "mac_block": 29, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 1 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 19, + "lane": 2, + "mac_block": 29, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 1 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 19, + "lane": 3, + "mac_block": 29, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 1 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 20, + "lane": 0, + "mac_block": 27, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 1 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 20, + "lane": 1, + "mac_block": 27, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 1 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 20, + "lane": 2, + "mac_block": 27, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 1 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 20, + "lane": 3, + "mac_block": 27, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 1 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 21, + "lane": 0, + "mac_block": 24, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 21, + "lane": 1, + "mac_block": 24, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 21, + "lane": 2, + "mac_block": 24, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 21, + "lane": 3, + "mac_block": 24, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 22, + "lane": 0, + "mac_block": 25, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 22, + "lane": 1, + "mac_block": 25, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 22, + "lane": 2, + "mac_block": 25, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 22, + "lane": 3, + "mac_block": 25, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 23, + "lane": 0, + "mac_block": 21, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 23, + "lane": 1, + "mac_block": 21, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 23, + "lane": 2, + "mac_block": 21, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 23, + "lane": 3, + "mac_block": 21, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 24, + "lane": 0, + "mac_block": 19, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 24, + "lane": 1, + "mac_block": 19, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 24, + "lane": 2, + "mac_block": 19, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 24, + "lane": 3, + "mac_block": 19, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 25, + "lane": 0, + "mac_block": 43, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 25, + "lane": 1, + "mac_block": 43, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 25, + "lane": 2, + "mac_block": 43, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 25, + "lane": 3, + "mac_block": 43, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 26, + "lane": 0, + "mac_block": 17, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 26, + "lane": 1, + "mac_block": 17, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 26, + "lane": 2, + "mac_block": 17, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 26, + "lane": 3, + "mac_block": 17, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 27, + "lane": 0, + "mac_block": 41, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 27, + "lane": 1, + "mac_block": 41, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 27, + "lane": 2, + "mac_block": 41, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 27, + "lane": 3, + "mac_block": 41, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 28, + "lane": 0, + "mac_block": 40, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 28, + "lane": 1, + "mac_block": 40, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 28, + "lane": 2, + "mac_block": 40, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 28, + "lane": 3, + "mac_block": 40, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 29, + "lane": 0, + "mac_block": 35, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 29, + "lane": 1, + "mac_block": 35, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 29, + "lane": 2, + "mac_block": 35, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 29, + "lane": 3, + "mac_block": 35, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 30, + "lane": 0, + "mac_block": 38, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 30, + "lane": 1, + "mac_block": 38, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 30, + "lane": 2, + "mac_block": 38, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 30, + "lane": 3, + "mac_block": 38, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 31, + "lane": 0, + "mac_block": 33, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 31, + "lane": 1, + "mac_block": 33, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 31, + "lane": 2, + "mac_block": 33, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 31, + "lane": 3, + "mac_block": 33, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 32, + "lane": 0, + "mac_block": 32, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 32, + "lane": 1, + "mac_block": 32, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 32, + "lane": 2, + "mac_block": 32, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 32, + "lane": 3, + "mac_block": 32, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 33, + "lane": 0, + "mac_block": 1, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 33, + "lane": 1, + "mac_block": 1, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 33, + "lane": 2, + "mac_block": 1, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 33, + "lane": 3, + "mac_block": 1, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 34, + "lane": 0, + "mac_block": 0, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 34, + "lane": 1, + "mac_block": 0, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 34, + "lane": 2, + "mac_block": 0, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 34, + "lane": 3, + "mac_block": 0, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 35, + "lane": 0, + "mac_block": 59, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 35, + "lane": 1, + "mac_block": 59, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 35, + "lane": 2, + "mac_block": 59, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 35, + "lane": 3, + "mac_block": 59, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 36, + "lane": 0, + "mac_block": 62, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 36, + "lane": 1, + "mac_block": 62, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 36, + "lane": 2, + "mac_block": 62, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 36, + "lane": 3, + "mac_block": 62, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 37, + "lane": 0, + "mac_block": 57, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 37, + "lane": 1, + "mac_block": 57, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 37, + "lane": 2, + "mac_block": 57, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 37, + "lane": 3, + "mac_block": 57, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 38, + "lane": 0, + "mac_block": 56, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 38, + "lane": 1, + "mac_block": 56, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 38, + "lane": 2, + "mac_block": 56, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 38, + "lane": 3, + "mac_block": 56, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 39, + "lane": 0, + "mac_block": 16, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 39, + "lane": 1, + "mac_block": 16, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 39, + "lane": 2, + "mac_block": 16, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 39, + "lane": 3, + "mac_block": 16, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 40, + "lane": 0, + "mac_block": 54, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 40, + "lane": 1, + "mac_block": 54, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 40, + "lane": 2, + "mac_block": 54, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 40, + "lane": 3, + "mac_block": 54, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 41, + "lane": 0, + "mac_block": 14, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 41, + "lane": 1, + "mac_block": 14, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 41, + "lane": 2, + "mac_block": 14, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 41, + "lane": 3, + "mac_block": 14, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 42, + "lane": 0, + "mac_block": 11, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 42, + "lane": 1, + "mac_block": 11, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 42, + "lane": 2, + "mac_block": 11, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 42, + "lane": 3, + "mac_block": 11, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 43, + "lane": 0, + "mac_block": 8, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 43, + "lane": 1, + "mac_block": 8, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 43, + "lane": 2, + "mac_block": 8, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 43, + "lane": 3, + "mac_block": 8, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 44, + "lane": 0, + "mac_block": 10, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 44, + "lane": 1, + "mac_block": 10, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 44, + "lane": 2, + "mac_block": 10, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 44, + "lane": 3, + "mac_block": 10, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 45, + "lane": 0, + "mac_block": 6, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 45, + "lane": 1, + "mac_block": 6, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 45, + "lane": 2, + "mac_block": 6, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 45, + "lane": 3, + "mac_block": 6, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 46, + "lane": 0, + "mac_block": 3, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 46, + "lane": 1, + "mac_block": 3, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 46, + "lane": 2, + "mac_block": 3, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 46, + "lane": 3, + "mac_block": 3, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 47, + "lane": 0, + "mac_block": 49, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 47, + "lane": 1, + "mac_block": 49, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 47, + "lane": 2, + "mac_block": 49, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 47, + "lane": 3, + "mac_block": 49, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 48, + "lane": 0, + "mac_block": 52, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 48, + "lane": 1, + "mac_block": 52, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 48, + "lane": 2, + "mac_block": 52, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 48, + "lane": 3, + "mac_block": 52, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 3 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 49, + "lane": 0, + "mac_block": 47, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 49, + "lane": 1, + "mac_block": 47, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 49, + "lane": 2, + "mac_block": 47, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 49, + "lane": 3, + "mac_block": 47, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 50, + "lane": 0, + "mac_block": 45, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 50, + "lane": 1, + "mac_block": 45, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 50, + "lane": 2, + "mac_block": 45, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 50, + "lane": 3, + "mac_block": 45, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 51, + "lane": 0, + "mac_block": 28, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 51, + "lane": 1, + "mac_block": 28, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 51, + "lane": 2, + "mac_block": 28, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 51, + "lane": 3, + "mac_block": 28, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 52, + "lane": 0, + "mac_block": 30, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 52, + "lane": 1, + "mac_block": 30, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 52, + "lane": 2, + "mac_block": 30, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 52, + "lane": 3, + "mac_block": 30, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 10, + "cu_1m": 10, + "cu_2m": 10, + "cu_3m": 10, + "cu_loop_0db": 10, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 53, + "lane": 0, + "mac_block": 26, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 53, + "lane": 1, + "mac_block": 26, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 53, + "lane": 2, + "mac_block": 26, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 53, + "lane": 3, + "mac_block": 26, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 54, + "lane": 0, + "mac_block": 23, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 54, + "lane": 1, + "mac_block": 23, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 54, + "lane": 2, + "mac_block": 23, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 54, + "lane": 3, + "mac_block": 23, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 55, + "lane": 0, + "mac_block": 20, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 55, + "lane": 1, + "mac_block": 20, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 55, + "lane": 2, + "mac_block": 20, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 55, + "lane": 3, + "mac_block": 20, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 56, + "lane": 0, + "mac_block": 22, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 56, + "lane": 1, + "mac_block": 22, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 56, + "lane": 2, + "mac_block": 22, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 56, + "lane": 3, + "mac_block": 22, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 57, + "lane": 0, + "mac_block": 18, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 57, + "lane": 1, + "mac_block": 18, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 57, + "lane": 2, + "mac_block": 18, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 57, + "lane": 3, + "mac_block": 18, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 1, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 58, + "lane": 0, + "mac_block": 44, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 58, + "lane": 1, + "mac_block": 44, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 58, + "lane": 2, + "mac_block": 44, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 58, + "lane": 3, + "mac_block": 44, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 59, + "lane": 0, + "mac_block": 39, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 59, + "lane": 1, + "mac_block": 39, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 59, + "lane": 2, + "mac_block": 39, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 59, + "lane": 3, + "mac_block": 39, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 60, + "lane": 0, + "mac_block": 42, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 60, + "lane": 1, + "mac_block": 42, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 60, + "lane": 2, + "mac_block": 42, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 60, + "lane": 3, + "mac_block": 42, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 61, + "lane": 0, + "mac_block": 37, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 61, + "lane": 1, + "mac_block": 37, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 61, + "lane": 2, + "mac_block": 37, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 61, + "lane": 3, + "mac_block": 37, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 62, + "lane": 0, + "mac_block": 36, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 62, + "lane": 1, + "mac_block": 36, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 62, + "lane": 2, + "mac_block": 36, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 62, + "lane": 3, + "mac_block": 36, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 7, + "cu_1m": 7, + "cu_2m": 7, + "cu_3m": 7, + "cu_loop_0db": 7, + "optical": 4 + }, + "tx_eq_post": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 63, + "lane": 0, + "mac_block": 31, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 63, + "lane": 1, + "mac_block": 31, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 63, + "lane": 2, + "mac_block": 31, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 1, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 63, + "lane": 3, + "mac_block": 31, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 8, + "cu_1m": 8, + "cu_2m": 8, + "cu_3m": 8, + "cu_loop_0db": 8, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 2, + "cu_1m": 2, + "cu_2m": 2, + "cu_3m": 2, + "cu_loop_0db": 2, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 1, + "cu_1m": 1, + "cu_2m": 1, + "cu_3m": 1, + "cu_loop_0db": 1, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 64, + "lane": 0, + "mac_block": 34, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 1, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 64, + "lane": 1, + "mac_block": 34, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 1, + "rx_lane": 1, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 64, + "lane": 2, + "mac_block": 34, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 64, + "lane": 3, + "mac_block": 34, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 1, + "tx_eq_pre": { + "cu_short": 9, + "cu_1m": 9, + "cu_2m": 9, + "cu_3m": 9, + "cu_loop_0db": 9, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 3, + "cu_1m": 3, + "cu_2m": 3, + "cu_3m": 3, + "cu_loop_0db": 3, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 65, + "lane": 0, + "mac_block": 64, + "mac_ch": 0, + "tx_lane": 0, + "tx_pn_swap": 0, + "rx_lane": 0, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 5, + "cu_1m": 5, + "cu_2m": 5, + "cu_3m": 5, + "cu_loop_0db": 5, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 66, + "lane": 0, + "mac_block": 64, + "mac_ch": 1, + "tx_lane": 1, + "tx_pn_swap": 0, + "rx_lane": 1, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 5, + "cu_1m": 5, + "cu_2m": 5, + "cu_3m": 5, + "cu_loop_0db": 5, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 67, + "lane": 0, + "mac_block": 64, + "mac_ch": 2, + "tx_lane": 2, + "tx_pn_swap": 0, + "rx_lane": 2, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 5, + "cu_1m": 5, + "cu_2m": 5, + "cu_3m": 5, + "cu_loop_0db": 5, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + }, + { + "connector": 68, + "lane": 0, + "mac_block": 64, + "mac_ch": 3, + "tx_lane": 3, + "tx_pn_swap": 0, + "rx_lane": 3, + "rx_pn_swap": 0, + "tx_eq_pre": { + "cu_short": 5, + "cu_1m": 5, + "cu_2m": 5, + "cu_3m": 5, + "cu_loop_0db": 5, + "optical": 5 + }, + "tx_eq_post": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 15 + }, + "tx_eq_attn": { + "cu_short": 0, + "cu_1m": 0, + "cu_2m": 0, + "cu_3m": 0, + "cu_loop_0db": 0, + "optical": 0 + }, + "has_repeater": 0, + "has_retimer": 0 + } + ] +} \ No newline at end of file diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini index 1020ea1382c2..f6d93ade344f 100644 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini @@ -1,67 +1,65 @@ -# name lanes alias port -Ethernet0 444,445,446,447 Ethernet1/1 1 -Ethernet4 52,53,54,55 Ethernet2/1 2 -Ethernet8 436,437,438,439 Ethernet3/1 3 -Ethernet12 432,433,434,435 Ethernet4/1 4 -Ethernet16 412,413,414,415 Ethernet5/1 5 -Ethernet20 424,425,426,427 Ethernet6/1 6 -Ethernet24 404,405,406,407 Ethernet7/1 7 -Ethernet28 0,1,2,3 Ethernet8/1 8 -Ethernet32 12,13,14,15 Ethernet9/1 9 -Ethernet36 8,9,10,11 Ethernet10/1 10 -Ethernet40 24,25,26,27 Ethernet11/1 11 -Ethernet44 32,33,34,35 Ethernet12/1 12 -Ethernet48 44,45,46,47 Ethernet13/1 13 -Ethernet52 40,41,42,43 Ethernet14/1 14 -Ethernet56 396,397,398,399 Ethernet15/1 15 -Ethernet60 392,393,394,395 Ethernet16/1 16 -Ethernet64 260,261,262,263 Ethernet17/1 17 -Ethernet68 384,385,386,387 Ethernet18/1 18 -Ethernet72 180,181,182,183 Ethernet19/1 19 -Ethernet76 172,173,174,175 Ethernet20/1 20 -Ethernet80 160,161,162,163 Ethernet21/1 21 -Ethernet84 164,165,166,167 Ethernet22/1 22 -Ethernet88 148,149,150,151 Ethernet23/1 23 -Ethernet92 140,141,142,143 Ethernet24/1 24 -Ethernet96 272,273,274,275 Ethernet25/1 25 -Ethernet100 132,133,134,135 Ethernet26/1 26 -Ethernet104 280,281,282,283 Ethernet27/1 27 -Ethernet108 284,285,286,287 Ethernet28/1 28 -Ethernet112 304,305,306,307 Ethernet29/1 29 -Ethernet116 292,293,294,295 Ethernet30/1 30 -Ethernet120 312,313,314,315 Ethernet31/1 31 -Ethernet124 316,317,318,319 Ethernet32/1 32 -Ethernet128 56,57,58,59 Ethernet33/1 33 -Ethernet132 60,61,62,63 Ethernet34/1 34 -Ethernet136 428,429,430,431 Ethernet35/1 35 -Ethernet140 440,441,442,443 Ethernet36/1 36 -Ethernet144 420,421,422,423 Ethernet37/1 37 -Ethernet148 416,417,418,419 Ethernet38/1 38 -Ethernet152 128,129,130,131 Ethernet39/1 39 -Ethernet156 408,409,410,411 Ethernet40/1 40 -Ethernet160 4,5,6,7 Ethernet41/1 41 -Ethernet164 16,17,18,19 Ethernet42/1 42 -Ethernet168 28,29,30,31 Ethernet43/1 43 -Ethernet172 20,21,22,23 Ethernet44/1 44 -Ethernet176 36,37,38,39 Ethernet45/1 45 -Ethernet180 48,49,50,51 Ethernet46/1 46 -Ethernet184 388,389,390,391 Ethernet47/1 47 -Ethernet188 400,401,402,403 Ethernet48/1 48 -Ethernet192 256,257,258,259 Ethernet49/1 49 -Ethernet196 264,265,266,267 Ethernet50/1 50 -Ethernet200 176,177,178,179 Ethernet51/1 51 -Ethernet204 184,185,186,187 Ethernet52/1 52 -Ethernet208 168,169,170,171 Ethernet53/1 53 -Ethernet212 156,157,158,159 Ethernet54/1 54 -Ethernet216 144,145,146,147 Ethernet55/1 55 -Ethernet220 152,153,154,155 Ethernet56/1 56 -Ethernet224 136,137,138,139 Ethernet57/1 57 -Ethernet228 268,269,270,271 Ethernet58/1 58 -Ethernet232 288,289,290,291 Ethernet59/1 59 -Ethernet236 276,277,278,279 Ethernet60/1 60 -Ethernet240 296,297,298,299 Ethernet61/1 61 -Ethernet244 300,301,302,303 Ethernet62/1 62 -Ethernet248 188,189,190,191 Ethernet63/1 63 -Ethernet252 308,309,310,311 Ethernet64/1 64 -Ethernet256 64 Ethernet65 65 -Ethernet260 65 Ethernet66 66 +# name lanes alias speed +Ethernet0 0,1,2,3 Ethernet1/1 100000 +Ethernet4 4,5,6,7 Ethernet2/1 100000 +Ethernet8 8,9,10,11 Ethernet3/1 100000 +Ethernet12 12,13,14,15 Ethernet4/1 100000 +Ethernet16 16,17,18,19 Ethernet5/1 100000 +Ethernet20 20,21,22,23 Ethernet6/1 100000 +Ethernet24 24,25,26,27 Ethernet7/1 100000 +Ethernet28 28,29,30,31 Ethernet8/1 100000 +Ethernet32 32,33,34,35 Ethernet9/1 100000 +Ethernet36 36,37,38,39 Ethernet10/1 100000 +Ethernet40 40,41,42,43 Ethernet11/1 100000 +Ethernet44 44,45,46,47 Ethernet12/1 100000 +Ethernet48 48,49,50,51 Ethernet13/1 100000 +Ethernet52 52,53,54,55 Ethernet14/1 100000 +Ethernet56 56,57,58,59 Ethernet15/1 100000 +Ethernet60 60,61,62,63 Ethernet16/1 100000 +Ethernet64 64,65,66,67 Ethernet17/1 100000 +Ethernet68 68,69,70,71 Ethernet18/1 100000 +Ethernet72 72,73,74,75 Ethernet19/1 100000 +Ethernet76 76,77,78,79 Ethernet20/1 100000 +Ethernet80 80,81,82,83 Ethernet21/1 100000 +Ethernet84 84,85,86,87 Ethernet22/1 100000 +Ethernet88 88,89,90,91 Ethernet23/1 100000 +Ethernet92 92,93,94,95 Ethernet24/1 100000 +Ethernet96 96,97,98,99 Ethernet25/1 100000 +Ethernet100 100,101,102,103 Ethernet26/1 100000 +Ethernet104 104,105,106,107 Ethernet27/1 100000 +Ethernet108 108,109,110,111 Ethernet28/1 100000 +Ethernet112 112,113,114,115 Ethernet29/1 100000 +Ethernet116 116,117,118,119 Ethernet30/1 100000 +Ethernet120 120,121,122,123 Ethernet31/1 100000 +Ethernet124 124,125,126,127 Ethernet32/1 100000 +Ethernet128 128,129,130,131 Ethernet33/1 100000 +Ethernet132 132,133,134,135 Ethernet34/1 100000 +Ethernet136 136,137,138,139 Ethernet35/1 100000 +Ethernet140 140,141,142,143 Ethernet36/1 100000 +Ethernet144 144,145,146,147 Ethernet37/1 100000 +Ethernet148 148,149,150,151 Ethernet38/1 100000 +Ethernet152 152,153,154,155 Ethernet39/1 100000 +Ethernet156 156,157,158,159 Ethernet40/1 100000 +Ethernet160 160,161,162,163 Ethernet41/1 100000 +Ethernet164 164,165,166,167 Ethernet42/1 100000 +Ethernet168 168,169,170,171 Ethernet43/1 100000 +Ethernet172 172,173,174,175 Ethernet44/1 100000 +Ethernet176 176,177,178,179 Ethernet45/1 100000 +Ethernet180 180,181,182,183 Ethernet46/1 100000 +Ethernet184 184,185,186,187 Ethernet47/1 100000 +Ethernet188 188,189,190,191 Ethernet48/1 100000 +Ethernet192 192,193,194,195 Ethernet49/1 100000 +Ethernet196 196,197,198,199 Ethernet50/1 100000 +Ethernet200 200,201,202,203 Ethernet51/1 100000 +Ethernet204 204,205,206,207 Ethernet52/1 100000 +Ethernet208 208,209,210,211 Ethernet53/1 100000 +Ethernet212 212,213,214,215 Ethernet54/1 100000 +Ethernet216 216,217,218,219 Ethernet55/1 100000 +Ethernet220 220,221,222,223 Ethernet56/1 100000 +Ethernet224 224,225,226,227 Ethernet57/1 100000 +Ethernet228 228,229,230,231 Ethernet58/1 100000 +Ethernet232 232,233,234,235 Ethernet59/1 100000 +Ethernet236 236,237,238,239 Ethernet60/1 100000 +Ethernet240 240,241,242,243 Ethernet61/1 100000 +Ethernet244 244,245,246,247 Ethernet62/1 100000 +Ethernet248 248,249,250,251 Ethernet63/1 100000 +Ethernet252 252,253,254,255 Ethernet64/1 100000 diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-sai.conf new file mode 100644 index 000000000000..f64f5f88ec1b --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/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 + } + ] +} From 7757bc2ddfe311188db76008bedf127aacd64c21 Mon Sep 17 00:00:00 2001 From: stepanblyschak <38952541+stepanblyschak@users.noreply.github.com> Date: Tue, 16 Oct 2018 19:33:59 +0300 Subject: [PATCH 1685/1833] [docker-snmp]: Remove alias_map json since it is not needed anymore (#2159) Signed-off-by: Stepan Blyschak --- dockers/docker-snmp-sv2/alias_map.j2 | 5 ----- dockers/docker-snmp-sv2/start.sh | 1 - src/sonic-config-engine/tests/test_j2files.py | 7 ------- 3 files changed, 13 deletions(-) delete mode 100644 dockers/docker-snmp-sv2/alias_map.j2 diff --git a/dockers/docker-snmp-sv2/alias_map.j2 b/dockers/docker-snmp-sv2/alias_map.j2 deleted file mode 100644 index bd68353a91e3..000000000000 --- a/dockers/docker-snmp-sv2/alias_map.j2 +++ /dev/null @@ -1,5 +0,0 @@ -{ -{% for member in PORT %} - "{{member}}": "{{PORT[member]['alias']}}"{% if not loop.last %},{% endif %} -{% endfor %} -} diff --git a/dockers/docker-snmp-sv2/start.sh b/dockers/docker-snmp-sv2/start.sh index 1b83624068a0..5ac31c5b43d8 100755 --- a/dockers/docker-snmp-sv2/start.sh +++ b/dockers/docker-snmp-sv2/start.sh @@ -5,7 +5,6 @@ sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sy mkdir -p /etc/snmp sonic-cfggen -d -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 > /etc/snmp/snmpd.conf -sonic-cfggen -d -t /usr/share/sonic/templates/alias_map.j2 > /etc/snmp/alias_map.json mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 06c26b03cab1..3e7e68c81c00 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -32,13 +32,6 @@ def test_interfaces(self): self.run_script(argument) self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'interfaces'), self.output_file)) - def test_alias_map(self): - alias_map_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-snmp-sv2', 'alias_map.j2') - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + alias_map_template - output = self.run_script(argument) - data = json.loads(output) - self.assertEqual(data["Ethernet4"], "fortyGigE0/4") - def test_ports_json(self): ports_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ports.json.j2') argument = '-m ' + self.simple_minigraph + ' -p ' + self.t0_port_config + ' -t ' + ports_template + ' > ' + self.output_file From 60ce8fcea959ef0b161158876820fe2966b060ce Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Tue, 16 Oct 2018 09:34:24 -0700 Subject: [PATCH 1686/1833] [devices]: Remove the console speed for Seastone platforms (#2153) * Change the baud-rate back to 115200 * Remove the console speed to let the system inherit from ONIE --- device/celestica/x86_64-cel_seastone-r0/installer.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/installer.conf b/device/celestica/x86_64-cel_seastone-r0/installer.conf index 306c42218785..924e0fb81963 100644 --- a/device/celestica/x86_64-cel_seastone-r0/installer.conf +++ b/device/celestica/x86_64-cel_seastone-r0/installer.conf @@ -1,3 +1,2 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 -CONSOLE_SPEED=9600 From 5f2b1a789614a237f0e0c7f1b49c7660dd8161f3 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Tue, 16 Oct 2018 11:19:03 -0700 Subject: [PATCH 1687/1833] [devices]: Add 96x25 + 16x50G profile for Seastone platform (#2157) --- .../Seastone-DX010-25-50/minigraph.xml | 1253 +++++++++++++++++ .../Seastone-DX010-25-50/port_config.ini | 113 ++ .../Seastone-DX010-25-50/sai.profile | 1 + ...th-seastone-dx010-96x25G-16x50G.config.bcm | 916 ++++++++++++ 4 files changed, 2283 insertions(+) create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/minigraph.xml create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/port_config.ini create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/sai.profile create mode 100644 device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/th-seastone-dx010-96x25G-16x50G.config.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/minigraph.xml b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/minigraph.xml new file mode 100644 index 000000000000..71f11f6e4d4a --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/minigraph.xml @@ -0,0 +1,1253 @@ + + + + + + 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 + + + + + + Eth1/1 + 10.0.0.0/31 + + + + Eth1/2 + 10.0.0.2/31 + + + + Eth1/3 + 10.0.0.4/31 + + + + Eth1/4 + 10.0.0.6/31 + + + + Eth2/1 + 10.0.0.8/31 + + + + Eth2/2 + 10.0.0.10/31 + + + + Eth2/3 + 10.0.0.12/31 + + + + Eth2/4 + 10.0.0.14/31 + + + + Eth3/1 + 10.0.0.16/31 + + + + Eth3/2 + 10.0.0.18/31 + + + + Eth3/3 + 10.0.0.20/31 + + + + Eth3/4 + 10.0.0.22/31 + + + + Eth4/1 + 10.0.0.24/31 + + + + Eth4/2 + 10.0.0.26/31 + + + + Eth4/3 + 10.0.0.28/31 + + + + Eth4/4 + 10.0.0.30/31 + + + + Eth5/1 + 10.0.0.32/31 + + + + Eth5/2 + 10.0.0.34/31 + + + + Eth5/3 + 10.0.0.36/31 + + + + Eth5/4 + 10.0.0.38/31 + + + + Eth6/1 + 10.0.0.40/31 + + + + Eth6/2 + 10.0.0.42/31 + + + + Eth6/3 + 10.0.0.44/31 + + + + Eth6/4 + 10.0.0.46/31 + + + + Eth7/1 + 10.0.0.48/31 + + + + Eth7/2 + 10.0.0.50/31 + + + + Eth7/3 + 10.0.0.52/31 + + + + Eth7/4 + 10.0.0.54/31 + + + + Eth8/1 + 10.0.0.56/31 + + + + Eth8/2 + 10.0.0.58/31 + + + + Eth8/3 + 10.0.0.60/31 + + + + Eth8/4 + 10.0.0.62/31 + + + + Eth9/1 + 10.0.0.64/31 + + + + Eth9/2 + 10.0.0.66/31 + + + + Eth9/3 + 10.0.0.68/31 + + + + Eth9/4 + 10.0.0.70/31 + + + + Eth10/1 + 10.0.0.72/31 + + + + Eth10/2 + 10.0.0.74/31 + + + + Eth10/3 + 10.0.0.76/31 + + + + Eth10/4 + 10.0.0.78/31 + + + + Eth11/1 + 10.0.0.80/31 + + + + Eth11/2 + 10.0.0.82/31 + + + + Eth11/3 + 10.0.0.84/31 + + + + Eth11/4 + 10.0.0.86/31 + + + + Eth12/1 + 10.0.0.88/31 + + + + Eth12/2 + 10.0.0.90/31 + + + + Eth12/3 + 10.0.0.92/31 + + + + Eth12/4 + 10.0.0.94/31 + + + + Eth13/1 + 10.0.0.96/31 + + + + Eth13/2 + 10.0.0.98/31 + + + + Eth13/3 + 10.0.0.100/31 + + + + Eth13/4 + 10.0.0.102/31 + + + + Eth14/1 + 10.0.0.104/31 + + + + Eth14/2 + 10.0.0.106/31 + + + + Eth14/3 + 10.0.0.108/31 + + + + Eth14/4 + 10.0.0.110/31 + + + + Eth15/1 + 10.0.0.112/31 + + + + Eth15/2 + 10.0.0.114/31 + + + + Eth15/3 + 10.0.0.116/31 + + + + Eth15/4 + 10.0.0.118/31 + + + + Eth16/1 + 10.0.0.120/31 + + + + Eth16/2 + 10.0.0.122/31 + + + + Eth16/3 + 10.0.0.124/31 + + + + Eth16/4 + 10.0.0.126/31 + + + + Eth17/1 + 10.0.0.128/31 + + + + Eth17/2 + 10.0.0.130/31 + + + + Eth17/3 + 10.0.0.132/31 + + + + Eth17/4 + 10.0.0.134/31 + + + + Eth18/1 + 10.0.0.136/31 + + + + Eth18/2 + 10.0.0.138/31 + + + + Eth18/3 + 10.0.0.140/31 + + + + Eth18/4 + 10.0.0.142/31 + + + + Eth19/1 + 10.0.0.144/31 + + + + Eth19/2 + 10.0.0.146/31 + + + + Eth19/3 + 10.0.0.148/31 + + + + Eth19/4 + 10.0.0.150/31 + + + + Eth20/1 + 10.0.0.152/31 + + + + Eth20/2 + 10.0.0.154/31 + + + + Eth20/3 + 10.0.0.156/31 + + + + Eth20/4 + 10.0.0.158/31 + + + + Eth21/1 + 10.0.0.160/31 + + + + Eth21/2 + 10.0.0.162/31 + + + + Eth21/3 + 10.0.0.164/31 + + + + Eth21/4 + 10.0.0.166/31 + + + + Eth22/1 + 10.0.0.168/31 + + + + Eth22/2 + 10.0.0.170/31 + + + + Eth22/3 + 10.0.0.172/31 + + + + Eth22/4 + 10.0.0.174/31 + + + + Eth23/1 + 10.0.0.176/31 + + + + Eth23/2 + 10.0.0.178/31 + + + + Eth23/3 + 10.0.0.180/31 + + + + Eth23/4 + 10.0.0.182/31 + + + + Eth24/1 + 10.0.0.184/31 + + + + Eth24/2 + 10.0.0.186/31 + + + + Eth24/3 + 10.0.0.188/31 + + + + Eth24/4 + 10.0.0.190/31 + + + + Eth25/1 + 10.0.1.0/31 + + + + Eth25/2 + 10.0.1.2/31 + + + + Eth26/1 + 10.0.1.4/31 + + + + Eth26/2 + 10.0.1.6/31 + + + + Eth27/1 + 10.0.1.8/31 + + + + Eth27/2 + 10.0.1.10/31 + + + + Eth28/1 + 10.0.1.12/31 + + + + Eth28/2 + 10.0.1.14/31 + + + + Eth29/1 + 10.0.1.16/31 + + + + Eth29/2 + 10.0.1.18/31 + + + + Eth30/1 + 10.0.1.20/31 + + + + Eth30/2 + 10.0.1.22/31 + + + + Eth31/1 + 10.0.1.24/31 + + + + Eth31/2 + 10.0.1.26/31 + + + + Eth32/1 + 10.0.1.28/31 + + + + Eth32/2 + 10.0.1.30/31 + + + + + + + + + + + + sonic + Seastone-DX010-25-50 + + + + + + + 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 + Seastone-DX010-25-50 +
diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/port_config.ini new file mode 100644 index 000000000000..e1af29b0262f --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/port_config.ini @@ -0,0 +1,113 @@ +# name lanes alias index speed +Ethernet0 65 Eth1/1 0 25000 +Ethernet1 66 Eth1/2 0 25000 +Ethernet2 67 Eth1/3 0 25000 +Ethernet3 68 Eth1/4 0 25000 +Ethernet4 69 Eth2/1 1 25000 +Ethernet5 70 Eth2/2 1 25000 +Ethernet6 71 Eth2/3 1 25000 +Ethernet7 72 Eth2/4 1 25000 +Ethernet8 73 Eth3/1 2 25000 +Ethernet9 74 Eth3/2 2 25000 +Ethernet10 75 Eth3/3 2 25000 +Ethernet11 76 Eth3/4 2 25000 +Ethernet12 77 Eth4/1 3 25000 +Ethernet13 78 Eth4/2 3 25000 +Ethernet14 79 Eth4/3 3 25000 +Ethernet15 80 Eth4/4 3 25000 +Ethernet16 33 Eth5/1 4 25000 +Ethernet17 34 Eth5/2 4 25000 +Ethernet18 35 Eth5/3 4 25000 +Ethernet19 36 Eth5/4 4 25000 +Ethernet20 37 Eth6/1 5 25000 +Ethernet21 38 Eth6/2 5 25000 +Ethernet22 39 Eth6/3 5 25000 +Ethernet23 40 Eth6/4 5 25000 +Ethernet24 41 Eth7/1 6 25000 +Ethernet25 42 Eth7/2 6 25000 +Ethernet26 43 Eth7/3 6 25000 +Ethernet27 44 Eth7/4 6 25000 +Ethernet28 45 Eth8/1 7 25000 +Ethernet29 46 Eth8/2 7 25000 +Ethernet30 47 Eth8/3 7 25000 +Ethernet31 48 Eth8/4 7 25000 +Ethernet32 49 Eth9/1 8 25000 +Ethernet33 50 Eth9/2 8 25000 +Ethernet34 51 Eth9/3 8 25000 +Ethernet35 52 Eth9/4 8 25000 +Ethernet36 53 Eth10/1 9 25000 +Ethernet37 54 Eth10/2 9 25000 +Ethernet38 55 Eth10/3 9 25000 +Ethernet39 56 Eth10/4 9 25000 +Ethernet40 57 Eth11/1 10 25000 +Ethernet41 58 Eth11/2 10 25000 +Ethernet42 59 Eth11/3 10 25000 +Ethernet43 60 Eth11/4 10 25000 +Ethernet44 61 Eth12/1 11 25000 +Ethernet45 62 Eth12/2 11 25000 +Ethernet46 63 Eth12/3 11 25000 +Ethernet47 64 Eth12/4 11 25000 +Ethernet48 81 Eth13/1 12 25000 +Ethernet49 82 Eth13/2 12 25000 +Ethernet50 83 Eth13/3 12 25000 +Ethernet51 84 Eth13/4 12 25000 +Ethernet52 85 Eth14/1 13 25000 +Ethernet53 86 Eth14/2 13 25000 +Ethernet54 87 Eth14/3 13 25000 +Ethernet55 88 Eth14/4 13 25000 +Ethernet56 89 Eth15/1 14 25000 +Ethernet57 90 Eth15/2 14 25000 +Ethernet58 91 Eth15/3 14 25000 +Ethernet59 92 Eth15/4 14 25000 +Ethernet60 93 Eth16/1 15 25000 +Ethernet61 94 Eth16/2 15 25000 +Ethernet62 95 Eth16/3 15 25000 +Ethernet63 96 Eth16/4 15 25000 +Ethernet64 97 Eth17/1 16 25000 +Ethernet65 98 Eth17/2 16 25000 +Ethernet66 99 Eth17/3 16 25000 +Ethernet67 100 Eth17/4 16 25000 +Ethernet68 101 Eth18/1 17 25000 +Ethernet69 102 Eth18/2 17 25000 +Ethernet70 103 Eth18/3 17 25000 +Ethernet71 104 Eth18/4 17 25000 +Ethernet72 105 Eth19/1 18 25000 +Ethernet73 106 Eth19/2 18 25000 +Ethernet74 107 Eth19/3 18 25000 +Ethernet75 108 Eth19/4 18 25000 +Ethernet76 109 Eth20/1 19 25000 +Ethernet77 110 Eth20/2 19 25000 +Ethernet78 111 Eth20/3 19 25000 +Ethernet79 112 Eth20/4 19 25000 +Ethernet80 1 Eth21/1 20 25000 +Ethernet81 2 Eth21/2 20 25000 +Ethernet82 3 Eth21/3 20 25000 +Ethernet83 4 Eth21/4 20 25000 +Ethernet84 5 Eth22/1 21 25000 +Ethernet85 6 Eth22/2 21 25000 +Ethernet86 7 Eth22/3 21 25000 +Ethernet87 8 Eth22/4 21 25000 +Ethernet88 9 Eth23/1 22 25000 +Ethernet89 10 Eth23/2 22 25000 +Ethernet90 11 Eth23/3 22 25000 +Ethernet91 12 Eth23/4 22 25000 +Ethernet92 13 Eth24/1 23 25000 +Ethernet93 14 Eth24/2 23 25000 +Ethernet94 15 Eth24/3 23 25000 +Ethernet95 16 Eth24/4 23 25000 +Ethernet96 17,18 Eth25/1 24 50000 +Ethernet98 19,20 Eth25/2 24 50000 +Ethernet100 21,22 Eth26/1 25 50000 +Ethernet102 23,24 Eth26/2 25 50000 +Ethernet104 25,26 Eth27/1 26 50000 +Ethernet106 27,28 Eth27/2 26 50000 +Ethernet108 29,30 Eth28/1 27 50000 +Ethernet110 31,32 Eth28/2 27 50000 +Ethernet112 113,114 Eth29/1 28 50000 +Ethernet114 115,116 Eth29/2 28 50000 +Ethernet116 117,118 Eth30/1 29 50000 +Ethernet118 119,120 Eth30/2 29 50000 +Ethernet120 121,122 Eth31/1 30 50000 +Ethernet122 123,124 Eth31/2 30 50000 +Ethernet124 125,126 Eth32/1 31 50000 +Ethernet126 127,128 Eth32/2 31 50000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/sai.profile new file mode 100644 index 000000000000..053313a6574f --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-96x25G-16x50G.config.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/th-seastone-dx010-96x25G-16x50G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/th-seastone-dx010-96x25G-16x50G.config.bcm new file mode 100644 index 000000000000..4e772d4eab4d --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/th-seastone-dx010-96x25G-16x50G.config.bcm @@ -0,0 +1,916 @@ +# 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_70=3 +dport_map_port_71=4 + +dport_map_port_72=5 +dport_map_port_73=6 +dport_map_port_74=7 +dport_map_port_75=8 + +dport_map_port_76=9 +dport_map_port_77=10 +dport_map_port_78=11 +dport_map_port_79=12 + +dport_map_port_80=13 +dport_map_port_81=14 +dport_map_port_82=15 +dport_map_port_83=16 + +dport_map_port_34=17 +dport_map_port_35=18 +dport_map_port_36=19 +dport_map_port_37=20 + +dport_map_port_38=21 +dport_map_port_39=22 +dport_map_port_40=23 +dport_map_port_41=24 + +dport_map_port_42=25 +dport_map_port_43=26 +dport_map_port_44=27 +dport_map_port_45=28 + +dport_map_port_46=29 +dport_map_port_47=30 +dport_map_port_48=31 +dport_map_port_49=32 + +dport_map_port_50=33 +dport_map_port_51=34 +dport_map_port_52=35 +dport_map_port_53=36 + +dport_map_port_54=37 +dport_map_port_55=38 +dport_map_port_56=39 +dport_map_port_57=40 + +dport_map_port_58=41 +dport_map_port_59=42 +dport_map_port_60=43 +dport_map_port_61=44 + +dport_map_port_62=45 +dport_map_port_63=46 +dport_map_port_64=47 +dport_map_port_65=48 + +dport_map_port_84=49 +dport_map_port_85=50 +dport_map_port_86=51 +dport_map_port_87=52 + +dport_map_port_88=53 +dport_map_port_89=54 +dport_map_port_90=55 +dport_map_port_91=56 + +dport_map_port_92=57 +dport_map_port_93=58 +dport_map_port_94=59 +dport_map_port_95=60 + +dport_map_port_96=61 +dport_map_port_97=62 +dport_map_port_98=63 +dport_map_port_99=64 + +dport_map_port_102=65 +dport_map_port_103=66 +dport_map_port_104=67 +dport_map_port_105=68 + +dport_map_port_106=69 +dport_map_port_107=70 +dport_map_port_108=71 +dport_map_port_109=72 + +dport_map_port_110=73 +dport_map_port_111=74 +dport_map_port_112=75 +dport_map_port_113=76 + +dport_map_port_114=77 +dport_map_port_115=78 +dport_map_port_116=79 +dport_map_port_117=80 + +dport_map_port_1=81 +dport_map_port_2=82 +dport_map_port_3=83 +dport_map_port_4=84 + +dport_map_port_5=85 +dport_map_port_6=86 +dport_map_port_7=87 +dport_map_port_8=88 + +dport_map_port_9=89 +dport_map_port_10=90 +dport_map_port_11=91 +dport_map_port_12=92 + +dport_map_port_13=93 +dport_map_port_14=94 +dport_map_port_15=95 +dport_map_port_16=96 + +dport_map_port_17=97 +dport_map_port_18=98 + +dport_map_port_21=101 +dport_map_port_22=102 + +dport_map_port_25=105 +dport_map_port_26=106 + +dport_map_port_29=109 +dport_map_port_30=110 + +dport_map_port_118=113 +dport_map_port_119=114 + +dport_map_port_122=117 +dport_map_port_123=118 + +dport_map_port_126=121 +dport_map_port_127=122 + +dport_map_port_130=125 +dport_map_port_131=126 + + +# port/lane mapping, 96x25G + 16x50G +portmap_68=65:25 +portmap_69=66:25 +portmap_70=67:25 +portmap_71=68:25 + +portmap_72=69:25 +portmap_73=70:25 +portmap_74=71:25 +portmap_75=72:25 + +portmap_76=73:25 +portmap_77=74:25 +portmap_78=75:25 +portmap_79=76:25 + +portmap_80=77:25 +portmap_81=78:25 +portmap_82=79:25 +portmap_83=80:25 + +portmap_34=33:25 +portmap_35=34:25 +portmap_36=35:25 +portmap_37=36:25 + +portmap_38=37:25 +portmap_39=38:25 +portmap_40=39:25 +portmap_41=40:25 + +portmap_42=41:25 +portmap_43=42:25 +portmap_44=43:25 +portmap_45=44:25 + +portmap_46=45:25 +portmap_47=46:25 +portmap_48=47:25 +portmap_49=48:25 + +portmap_50=49:25 +portmap_51=50:25 +portmap_52=51:25 +portmap_53=52:25 + +portmap_54=53:25 +portmap_55=54:25 +portmap_56=55:25 +portmap_57=56:25 + +portmap_58=57:25 +portmap_59=58:25 +portmap_60=59:25 +portmap_61=60:25 + +portmap_62=61:25 +portmap_63=62:25 +portmap_64=63:25 +portmap_65=64:25 + +portmap_84=81:25 +portmap_85=82:25 +portmap_86=83:25 +portmap_87=84:25 + +portmap_88=85:25 +portmap_89=86:25 +portmap_90=87:25 +portmap_91=88:25 + +portmap_92=89:25 +portmap_93=90:25 +portmap_94=91:25 +portmap_95=92:25 + +portmap_96=93:25 +portmap_97=94:25 +portmap_98=95:25 +portmap_99=96:25 + +portmap_102=97:25 +portmap_103=98:25 +portmap_104=99:25 +portmap_105=100:25 + +portmap_106=101:25 +portmap_107=102:25 +portmap_108=103:25 +portmap_109=104:25 + +portmap_110=105:25 +portmap_111=106:25 +portmap_112=107:25 +portmap_113=108:25 + +portmap_114=109:25 +portmap_115=110:25 +portmap_116=111:25 +portmap_117=112:25 + +portmap_1=1:25 +portmap_2=2:25 +portmap_3=3:25 +portmap_4=4:25 + +portmap_5=5:25 +portmap_6=6:25 +portmap_7=7:25 +portmap_8=8:25 + +portmap_9=9:25 +portmap_10=10:25 +portmap_11=11:25 +portmap_12=12:25 + +portmap_13=13:25 +portmap_14=14:25 +portmap_15=15:25 +portmap_16=16:25 + + +portmap_17=17:50:2 +portmap_18=19:50:2 + +portmap_21=21:50:2 +portmap_22=23:50:2 + +portmap_25=25:50:2 +portmap_26=27:50:2 + +portmap_29=29:50:2 +portmap_30=31:50:2 + +portmap_118=113:50:2 +portmap_119=115:50:2 + +portmap_122=117:50:2 +portmap_123=119:50:2 + +portmap_126=121:50:2 +portmap_127=123:50:2 + +portmap_130=125:50:2 +portmap_131=127:50:2 + +#portmap_66=129:10 +#portmap_100=131:10 + +#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 +xgxs_tx_lane_map_70=0x3201 +xgxs_rx_lane_map_70=0x2310 +xgxs_tx_lane_map_71=0x3201 +xgxs_rx_lane_map_71=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 +xgxs_tx_lane_map_74=0x3201 +xgxs_rx_lane_map_74=0x2301 +xgxs_tx_lane_map_75=0x3201 +xgxs_rx_lane_map_75=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 +xgxs_tx_lane_map_78=0x0132 +xgxs_rx_lane_map_78=0x0123 +xgxs_tx_lane_map_79=0x0132 +xgxs_rx_lane_map_79=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 +xgxs_tx_lane_map_82=0x2031 +xgxs_rx_lane_map_82=0x1320 +xgxs_tx_lane_map_83=0x2031 +xgxs_rx_lane_map_83=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 +xgxs_tx_lane_map_36=0x3021 +xgxs_rx_lane_map_36=0x0213 +xgxs_tx_lane_map_37=0x3021 +xgxs_rx_lane_map_37=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 +xgxs_tx_lane_map_40=0x3210 +xgxs_rx_lane_map_40=0x1023 +xgxs_tx_lane_map_41=0x3210 +xgxs_rx_lane_map_41=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 +xgxs_tx_lane_map_44=0x2310 +xgxs_rx_lane_map_44=0x3210 +xgxs_tx_lane_map_45=0x2310 +xgxs_rx_lane_map_45=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 +xgxs_tx_lane_map_48=0x1032 +xgxs_rx_lane_map_48=0x1302 +xgxs_tx_lane_map_49=0x1032 +xgxs_rx_lane_map_49=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 +xgxs_tx_lane_map_52=0x3201 +xgxs_rx_lane_map_52=0x0213 +xgxs_tx_lane_map_53=0x3201 +xgxs_rx_lane_map_53=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 +xgxs_tx_lane_map_56=0x2301 +xgxs_rx_lane_map_56=0x2310 +xgxs_tx_lane_map_57=0x2301 +xgxs_rx_lane_map_57=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 +xgxs_tx_lane_map_60=0x3201 +xgxs_rx_lane_map_60=0x0213 +xgxs_tx_lane_map_61=0x3201 +xgxs_rx_lane_map_61=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 +xgxs_tx_lane_map_64=0x1302 +xgxs_rx_lane_map_64=0x2310 +xgxs_tx_lane_map_65=0x1302 +xgxs_rx_lane_map_65=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 +xgxs_tx_lane_map_86=0x0213 +xgxs_rx_lane_map_86=0x2301 +xgxs_tx_lane_map_87=0x0213 +xgxs_rx_lane_map_87=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 +xgxs_tx_lane_map_90=0x0132 +xgxs_rx_lane_map_90=0x3210 +xgxs_tx_lane_map_91=0x0132 +xgxs_rx_lane_map_91=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 +xgxs_tx_lane_map_94=0x0132 +xgxs_rx_lane_map_94=0x2031 +xgxs_tx_lane_map_95=0x0132 +xgxs_rx_lane_map_95=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 +xgxs_tx_lane_map_98=0x2031 +xgxs_rx_lane_map_98=0x3201 +xgxs_tx_lane_map_99=0x2031 +xgxs_rx_lane_map_99=0x3201 + +#WC24 +xgxs_tx_lane_map_102=0x0132 +xgxs_rx_lane_map_102=0x2301 +xgxs_tx_lane_map_103=0x0132 +xgxs_rx_lane_map_103=0x2301 +xgxs_tx_lane_map_104=0x0132 +xgxs_rx_lane_map_104=0x2301 +xgxs_tx_lane_map_105=0x0132 +xgxs_rx_lane_map_105=0x2301 + +#WC25 +xgxs_tx_lane_map_106=0x0132 +xgxs_rx_lane_map_106=0x3201 +xgxs_tx_lane_map_107=0x0132 +xgxs_rx_lane_map_107=0x3201 +xgxs_tx_lane_map_108=0x0132 +xgxs_rx_lane_map_108=0x3201 +xgxs_tx_lane_map_109=0x0132 +xgxs_rx_lane_map_109=0x3201 + +#WC26 +xgxs_tx_lane_map_110=0x0132 +xgxs_rx_lane_map_110=0x2031 +xgxs_tx_lane_map_111=0x0132 +xgxs_rx_lane_map_111=0x2031 +xgxs_tx_lane_map_112=0x0132 +xgxs_rx_lane_map_112=0x2031 +xgxs_tx_lane_map_113=0x0132 +xgxs_rx_lane_map_113=0x2031 + +#WC27 +xgxs_tx_lane_map_114=0x2031 +xgxs_rx_lane_map_114=0x2301 +xgxs_tx_lane_map_115=0x2031 +xgxs_rx_lane_map_115=0x2301 +xgxs_tx_lane_map_116=0x2031 +xgxs_rx_lane_map_116=0x2301 +xgxs_tx_lane_map_117=0x2031 +xgxs_rx_lane_map_117=0x2301 + + +#WC0 +xgxs_tx_lane_map_1=0x3210 +xgxs_rx_lane_map_1=0x3120 +xgxs_tx_lane_map_2=0x3210 +xgxs_rx_lane_map_2=0x3120 +xgxs_tx_lane_map_3=0x3210 +xgxs_rx_lane_map_3=0x3120 +xgxs_tx_lane_map_4=0x3210 +xgxs_rx_lane_map_4=0x3120 + +#WC1 +xgxs_tx_lane_map_5=0x0132 +xgxs_rx_lane_map_5=0x1023 +xgxs_tx_lane_map_6=0x0132 +xgxs_rx_lane_map_6=0x1023 +xgxs_tx_lane_map_7=0x0132 +xgxs_rx_lane_map_7=0x1023 +xgxs_tx_lane_map_8=0x0132 +xgxs_rx_lane_map_8=0x1023 + +#WC2 +xgxs_tx_lane_map_9=0x3201 +xgxs_rx_lane_map_9=0x3120 +xgxs_tx_lane_map_10=0x3201 +xgxs_rx_lane_map_10=0x3120 +xgxs_tx_lane_map_11=0x3201 +xgxs_rx_lane_map_11=0x3120 +xgxs_tx_lane_map_12=0x3201 +xgxs_rx_lane_map_12=0x3120 + +#WC3 +xgxs_tx_lane_map_13=0x2031 +xgxs_rx_lane_map_13=0x1032 +xgxs_tx_lane_map_14=0x2031 +xgxs_rx_lane_map_14=0x1032 +xgxs_tx_lane_map_15=0x2031 +xgxs_rx_lane_map_15=0x1032 +xgxs_tx_lane_map_16=0x2031 +xgxs_rx_lane_map_16=0x1032 + +#WC4 +xgxs_tx_lane_map_17=0x2310 +xgxs_rx_lane_map_17=0x3210 +xgxs_tx_lane_map_18=0x2310 +xgxs_rx_lane_map_18=0x3210 + +#WC5 +xgxs_tx_lane_map_21=0x2301 +xgxs_rx_lane_map_21=0x3120 +xgxs_tx_lane_map_22=0x2301 +xgxs_rx_lane_map_22=0x3120 + +#WC6 +xgxs_tx_lane_map_25=0x3201 +xgxs_rx_lane_map_25=0x0213 +xgxs_tx_lane_map_26=0x3201 +xgxs_rx_lane_map_26=0x0213 + +#WC7 +xgxs_tx_lane_map_29=0x1302 +xgxs_rx_lane_map_29=0x1023 +xgxs_tx_lane_map_30=0x1302 +xgxs_rx_lane_map_30=0x1023 + +#WC28 +xgxs_tx_lane_map_118=0x1320 +xgxs_rx_lane_map_118=0x1302 +xgxs_tx_lane_map_119=0x1320 +xgxs_rx_lane_map_119=0x1302 + +#WC29 +xgxs_tx_lane_map_122=0x1032 +xgxs_rx_lane_map_122=0x1023 +xgxs_tx_lane_map_123=0x1032 +xgxs_rx_lane_map_123=0x1023 + +#WC30 +xgxs_tx_lane_map_126=0x3120 +xgxs_rx_lane_map_126=0x3120 +xgxs_tx_lane_map_127=0x3120 +xgxs_rx_lane_map_127=0x3120 + +#WC31 +xgxs_tx_lane_map_130=0x1302 +xgxs_rx_lane_map_130=0x2310 +xgxs_tx_lane_map_131=0x1302 +xgxs_rx_lane_map_131=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 +phy_xaui_tx_polarity_flip_70=0x0000 +phy_xaui_rx_polarity_flip_70=0x0000 +phy_xaui_tx_polarity_flip_71=0x0000 +phy_xaui_rx_polarity_flip_71=0x0000 + +#WC17 +phy_xaui_tx_polarity_flip_72=0x0001 +phy_xaui_rx_polarity_flip_72=0x0000 +phy_xaui_tx_polarity_flip_73=0x0000 +phy_xaui_rx_polarity_flip_73=0x0001 +phy_xaui_tx_polarity_flip_74=0x0001 +phy_xaui_rx_polarity_flip_74=0x0000 +phy_xaui_tx_polarity_flip_75=0x0001 +phy_xaui_rx_polarity_flip_75=0x0000 + +#WC18 +phy_xaui_tx_polarity_flip_76=0x0001 +phy_xaui_rx_polarity_flip_76=0x0000 +phy_xaui_tx_polarity_flip_77=0x0001 +phy_xaui_rx_polarity_flip_77=0x0000 +phy_xaui_tx_polarity_flip_78=0x0001 +phy_xaui_rx_polarity_flip_78=0x0000 +phy_xaui_tx_polarity_flip_79=0x0001 +phy_xaui_rx_polarity_flip_79=0x0000 + +#WC19 +phy_xaui_tx_polarity_flip_80=0x0001 +phy_xaui_rx_polarity_flip_80=0x0001 +phy_xaui_tx_polarity_flip_81=0x0001 +phy_xaui_rx_polarity_flip_81=0x0001 +phy_xaui_tx_polarity_flip_82=0x0001 +phy_xaui_rx_polarity_flip_82=0x0001 +phy_xaui_tx_polarity_flip_83=0x0001 +phy_xaui_rx_polarity_flip_83=0x0001 + +#WC8 +phy_xaui_tx_polarity_flip_34=0x0000 +phy_xaui_rx_polarity_flip_34=0x0000 +phy_xaui_tx_polarity_flip_35=0x0001 +phy_xaui_rx_polarity_flip_35=0x0000 +phy_xaui_tx_polarity_flip_36=0x0001 +phy_xaui_rx_polarity_flip_36=0x0000 +phy_xaui_tx_polarity_flip_37=0x0001 +phy_xaui_rx_polarity_flip_37=0x0000 + +#WC9 +phy_xaui_tx_polarity_flip_38=0x0000 +phy_xaui_rx_polarity_flip_38=0x0000 +phy_xaui_tx_polarity_flip_39=0x0000 +phy_xaui_rx_polarity_flip_39=0x0000 +phy_xaui_tx_polarity_flip_40=0x0000 +phy_xaui_rx_polarity_flip_40=0x0000 +phy_xaui_tx_polarity_flip_41=0x0001 +phy_xaui_rx_polarity_flip_41=0x0000 + +#WC10 +phy_xaui_tx_polarity_flip_42=0x0001 +phy_xaui_rx_polarity_flip_42=0x0000 +phy_xaui_tx_polarity_flip_43=0x0000 +phy_xaui_rx_polarity_flip_43=0x0000 +phy_xaui_tx_polarity_flip_44=0x0001 +phy_xaui_rx_polarity_flip_44=0x0000 +phy_xaui_tx_polarity_flip_45=0x0001 +phy_xaui_rx_polarity_flip_45=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 +phy_xaui_tx_polarity_flip_48=0x0000 +phy_xaui_rx_polarity_flip_48=0x0000 +phy_xaui_tx_polarity_flip_49=0x0000 +phy_xaui_rx_polarity_flip_49=0x0000 + +#WC12 +phy_xaui_tx_polarity_flip_50=0x0000 +phy_xaui_rx_polarity_flip_50=0x0000 +phy_xaui_tx_polarity_flip_51=0x0001 +phy_xaui_rx_polarity_flip_51=0x0000 +phy_xaui_tx_polarity_flip_52=0x0000 +phy_xaui_rx_polarity_flip_52=0x0000 +phy_xaui_tx_polarity_flip_53=0x0000 +phy_xaui_rx_polarity_flip_53=0x0000 + +#WC13 +phy_xaui_tx_polarity_flip_54=0x0000 +phy_xaui_rx_polarity_flip_54=0x0000 +phy_xaui_tx_polarity_flip_55=0x0001 +phy_xaui_rx_polarity_flip_55=0x0000 +phy_xaui_tx_polarity_flip_56=0x0000 +phy_xaui_rx_polarity_flip_56=0x0000 +phy_xaui_tx_polarity_flip_57=0x0000 +phy_xaui_rx_polarity_flip_57=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 +phy_xaui_tx_polarity_flip_60=0x0000 +phy_xaui_rx_polarity_flip_60=0x0000 +phy_xaui_tx_polarity_flip_61=0x0000 +phy_xaui_rx_polarity_flip_61=0x0000 + +#WC15 +phy_xaui_tx_polarity_flip_62=0x0000 +phy_xaui_rx_polarity_flip_62=0x0001 +phy_xaui_tx_polarity_flip_63=0x0001 +phy_xaui_rx_polarity_flip_63=0x0001 +phy_xaui_tx_polarity_flip_64=0x0000 +phy_xaui_rx_polarity_flip_64=0x0001 +phy_xaui_tx_polarity_flip_65=0x0001 +phy_xaui_rx_polarity_flip_65=0x0001 + +#WC20 +phy_xaui_tx_polarity_flip_84=0x0001 +phy_xaui_rx_polarity_flip_84=0x0000 +phy_xaui_tx_polarity_flip_85=0x0001 +phy_xaui_rx_polarity_flip_85=0x0001 +phy_xaui_tx_polarity_flip_86=0x0001 +phy_xaui_rx_polarity_flip_86=0x0001 +phy_xaui_tx_polarity_flip_87=0x0000 +phy_xaui_rx_polarity_flip_87=0x0001 + +#WC21 +phy_xaui_tx_polarity_flip_88=0x0001 +phy_xaui_rx_polarity_flip_88=0x0001 +phy_xaui_tx_polarity_flip_89=0x0000 +phy_xaui_rx_polarity_flip_89=0x0000 +phy_xaui_tx_polarity_flip_90=0x0001 +phy_xaui_rx_polarity_flip_90=0x0001 +phy_xaui_tx_polarity_flip_91=0x0001 +phy_xaui_rx_polarity_flip_91=0x0001 + +#WC22 +phy_xaui_tx_polarity_flip_92=0x0001 +phy_xaui_rx_polarity_flip_92=0x0000 +phy_xaui_tx_polarity_flip_93=0x0001 +phy_xaui_rx_polarity_flip_93=0x0000 +phy_xaui_tx_polarity_flip_94=0x0001 +phy_xaui_rx_polarity_flip_94=0x0000 +phy_xaui_tx_polarity_flip_95=0x0001 +phy_xaui_rx_polarity_flip_95=0x0001 + +#WC23 +phy_xaui_tx_polarity_flip_96=0x0001 +phy_xaui_rx_polarity_flip_96=0x0000 +phy_xaui_tx_polarity_flip_97=0x0000 +phy_xaui_rx_polarity_flip_97=0x0000 +phy_xaui_tx_polarity_flip_98=0x0001 +phy_xaui_rx_polarity_flip_98=0x0000 +phy_xaui_tx_polarity_flip_99=0x0000 +phy_xaui_rx_polarity_flip_99=0x0000 + +#WC24 +phy_xaui_tx_polarity_flip_102=0x0000 +phy_xaui_rx_polarity_flip_102=0x0001 +phy_xaui_tx_polarity_flip_103=0x0000 +phy_xaui_rx_polarity_flip_103=0x0001 +phy_xaui_tx_polarity_flip_104=0x0000 +phy_xaui_rx_polarity_flip_104=0x0001 +phy_xaui_tx_polarity_flip_105=0x0000 +phy_xaui_rx_polarity_flip_105=0x0001 + +#WC25 +phy_xaui_tx_polarity_flip_106=0x0001 +phy_xaui_rx_polarity_flip_106=0x0000 +phy_xaui_tx_polarity_flip_107=0x0001 +phy_xaui_rx_polarity_flip_107=0x0000 +phy_xaui_tx_polarity_flip_108=0x0001 +phy_xaui_rx_polarity_flip_108=0x0000 +phy_xaui_tx_polarity_flip_109=0x0001 +phy_xaui_rx_polarity_flip_109=0x0000 + +#WC26 +phy_xaui_tx_polarity_flip_110=0x0001 +phy_xaui_rx_polarity_flip_110=0x0001 +phy_xaui_tx_polarity_flip_111=0x0001 +phy_xaui_rx_polarity_flip_111=0x0001 +phy_xaui_tx_polarity_flip_112=0x0001 +phy_xaui_rx_polarity_flip_112=0x0001 +phy_xaui_tx_polarity_flip_113=0x0001 +phy_xaui_rx_polarity_flip_113=0x0001 + +#WC27 +phy_xaui_tx_polarity_flip_114=0x0001 +phy_xaui_rx_polarity_flip_114=0x0001 +phy_xaui_tx_polarity_flip_115=0x0001 +phy_xaui_rx_polarity_flip_115=0x0001 +phy_xaui_tx_polarity_flip_116=0x0001 +phy_xaui_rx_polarity_flip_116=0x0001 +phy_xaui_tx_polarity_flip_117=0x0001 +phy_xaui_rx_polarity_flip_117=0x0000 + +#WC0 +phy_xaui_tx_polarity_flip_1=0x0001 +phy_xaui_rx_polarity_flip_1=0x0001 +phy_xaui_tx_polarity_flip_2=0x0001 +phy_xaui_rx_polarity_flip_2=0x0001 +phy_xaui_tx_polarity_flip_3=0x0000 +phy_xaui_rx_polarity_flip_3=0x0001 +phy_xaui_tx_polarity_flip_4=0x0000 +phy_xaui_rx_polarity_flip_4=0x0001 + +#WC1 +phy_xaui_tx_polarity_flip_5=0x0001 +phy_xaui_rx_polarity_flip_5=0x0000 +phy_xaui_tx_polarity_flip_6=0x0001 +phy_xaui_rx_polarity_flip_6=0x0000 +phy_xaui_tx_polarity_flip_7=0x0001 +phy_xaui_rx_polarity_flip_7=0x0000 +phy_xaui_tx_polarity_flip_8=0x0000 +phy_xaui_rx_polarity_flip_8=0x0000 + +#WC2 +phy_xaui_tx_polarity_flip_9=0x0000 +phy_xaui_rx_polarity_flip_9=0x0000 +phy_xaui_tx_polarity_flip_10=0x0001 +phy_xaui_rx_polarity_flip_10=0x0000 +phy_xaui_tx_polarity_flip_11=0x0000 +phy_xaui_rx_polarity_flip_11=0x0000 +phy_xaui_tx_polarity_flip_12=0x0000 +phy_xaui_rx_polarity_flip_12=0x0001 + +#WC3 +phy_xaui_tx_polarity_flip_13=0x0001 +phy_xaui_rx_polarity_flip_13=0x0000 +phy_xaui_tx_polarity_flip_14=0x0001 +phy_xaui_rx_polarity_flip_14=0x0000 +phy_xaui_tx_polarity_flip_15=0x0001 +phy_xaui_rx_polarity_flip_15=0x0000 +phy_xaui_tx_polarity_flip_16=0x0001 +phy_xaui_rx_polarity_flip_16=0x0000 + +#WC4 +phy_xaui_tx_polarity_flip_17=0x0003 +phy_xaui_rx_polarity_flip_17=0x0000 +phy_xaui_tx_polarity_flip_18=0x0001 +phy_xaui_rx_polarity_flip_18=0x0000 + +#WC5 +phy_xaui_tx_polarity_flip_21=0x0000 +phy_xaui_rx_polarity_flip_21=0x0000 +phy_xaui_tx_polarity_flip_22=0x0000 +phy_xaui_rx_polarity_flip_22=0x0000 + +#WC6 +phy_xaui_tx_polarity_flip_25=0x0002 +phy_xaui_rx_polarity_flip_25=0x0001 +phy_xaui_tx_polarity_flip_26=0x0000 +phy_xaui_rx_polarity_flip_26=0x0001 + +#WC7 +phy_xaui_tx_polarity_flip_29=0x0002 +phy_xaui_rx_polarity_flip_29=0x0000 +phy_xaui_tx_polarity_flip_30=0x0000 +phy_xaui_rx_polarity_flip_30=0x0000 + +#WC28 +phy_xaui_tx_polarity_flip_118=0x0003 +phy_xaui_rx_polarity_flip_118=0x0003 +phy_xaui_tx_polarity_flip_119=0x0003 +phy_xaui_rx_polarity_flip_119=0x0003 + +#WC29 +phy_xaui_tx_polarity_flip_122=0x0000 +phy_xaui_rx_polarity_flip_122=0x0000 +phy_xaui_tx_polarity_flip_123=0x0001 +phy_xaui_rx_polarity_flip_123=0x0000 + +#WC30 +phy_xaui_tx_polarity_flip_126=0x0003 +phy_xaui_rx_polarity_flip_126=0x0000 +phy_xaui_tx_polarity_flip_127=0x0003 +phy_xaui_rx_polarity_flip_127=0x0000 + +#WC31 +phy_xaui_tx_polarity_flip_130=0x0002 +phy_xaui_rx_polarity_flip_130=0x0000 +phy_xaui_tx_polarity_flip_131=0x0001 +phy_xaui_rx_polarity_flip_131=0x0000 + From f3ab8cdf9adb393a48eb0b11b02ef423afd1c1f2 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 16 Oct 2018 11:20:39 -0700 Subject: [PATCH 1688/1833] [warm boot] syncd warm start could be individual warm start (#2147) Signed-off-by: Ying Xie --- files/scripts/syncd.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index b7d23209557f..08c50a2c37c5 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -30,8 +30,9 @@ 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 could be empty, always make WARM_BOOT meaningful. - if [[ x"$SYSTEM_WARM_START" == x"true" ]]; then + if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then WARM_BOOT="true" else WARM_BOOT="false" From 1086cb4b960206b0d8dd627ff9b4251185e0c02a Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Tue, 16 Oct 2018 21:56:44 -0700 Subject: [PATCH 1689/1833] Update submodules (#2160) --- src/sonic-sairedis | 2 +- src/sonic-snmpagent | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 5ef97caffc42..6fdf6ff1ce19 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 5ef97caffc427c9b6f8cbee3804a3e1d7de6e3c4 +Subproject commit 6fdf6ff1ce19beea610de918a02ceb76d37105c2 diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 8a628a527558..c675724961e8 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 8a628a5275582123ce43e50ae4b7348790f1d2ef +Subproject commit c675724961e8c7dd8263c0b040d2d2d10e9accfc diff --git a/src/sonic-swss b/src/sonic-swss index f13aaed9f21f..e1cc0de6159d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit f13aaed9f21f457419e96a5d28a52d319fbee9ed +Subproject commit e1cc0de6159d03bd3def4d4715ae1c93cd12a1e8 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 35b003dda673..149f9858142f 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 35b003dda6731810bb6564af707da5bc39a4b5c8 +Subproject commit 149f9858142fae66e6e709e09cbc968835cf1d12 From 77652c55fd944c9805c79f224bab40a6a98a4c45 Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Wed, 17 Oct 2018 14:10:34 -0700 Subject: [PATCH 1690/1833] [QoS]: Unify qos json by using qos_config.j2 template (#2023) * Unify qos config with qos_config.j2 template Signed-off-by: Wenda * Change 7050 to use qos config template Signed-off-by: Wenda modified: device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 modified: device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 * Change a7060, a7260, s6000, s6100, z9100 to use qos config template Signed-off-by: Wenda * Change mlnx devices to use qos config template Signed-off-by: Wenda modified: ../../../mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 modified: ../../../mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 modified: ../../../mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 modified: ../../../mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 * Change barefoot devices to use qos config template Signed-off-by: Wenda modified: barefoot/x86_64-accton_wedge100bf_32x-r0/montara/qos.json.j2 modified: barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/qos.json.j2 * Change accton as7212 to use qos config template Signed-off-by: Wenda modified: accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json.j2 * Apply PORT_QOS_MAP to active ports only Signed-off-by: Wenda * Update qos config test with qos_config.j2 template Signed-off-by: Wenda * Update sample output of qos-dell6100.json Signed-off-by: Wenda * Remove generating the default port name and index list, i.e., remove the generate_port_lists macro, because PORT is always defined Signed-off-by: Wenda * Include pfc_to_pg_map according to platform asic type obtained from /etc/sonic/sonic_version.yml rather than specifying per hwsku Signed-off-by: Wenda Ni * Customize TC_TO_PRIORITY_GROUP_MAP and PFC_PRIORITY_TO_PRIORITY_GROUP_MAP for barefoot Signed-off-by: Wenda * Unify PFC_PRIORITY_TO_PRIORITY_GROUP_MAP: remove "0":"0", "1":"1" as these two pgs do not generate PFC frames. Signed-off-by: Wenda --- .../AS7212-54x/qos.json.j2 | 167 +---- .../Arista-7050-QX32/qos.json.j2 | 149 +--- .../Arista-7050-QX-32S/qos.json.j2 | 149 +--- .../Arista-7060CX-32S-C32/qos.json.j2 | 156 +--- .../Arista-7060CX-32S-D48C8/qos.json.j2 | 156 +--- .../Arista-7060CX-32S-Q32/qos.json.j2 | 156 +--- .../Arista-7260CX3-D108C8/qos.json.j2 | 156 +--- .../montara/qos.json.j2 | 159 +--- .../mavericks/qos.json.j2 | 159 +--- .../Force10-S6000/qos.json.j2 | 144 +--- .../Force10-S6100/qos.json.j2 | 183 +---- .../Force10-Z9100-T0/qos.json.j2 | 156 +--- .../Force10-Z9100/qos.json.j2 | 156 +--- .../ACS-MSN2100/qos.json.j2 | 192 +---- .../ACS-MSN2410/qos.json.j2 | 192 +---- .../ACS-MSN2700/qos.json.j2 | 195 +---- .../Mellanox-SN2700-D48C8/qos.json.j2 | 192 +---- files/build_templates/qos_config.j2 | 214 ++++++ .../build_templates/sonic_debian_extension.j2 | 3 + src/sonic-config-engine/sonic-cfggen | 7 + .../tests/sample_output/qos-dell6100.json | 695 +++++++++++++++--- src/sonic-config-engine/tests/test_j2files.py | 9 + 22 files changed, 862 insertions(+), 2883 deletions(-) create mode 100644 files/build_templates/qos_config.j2 diff --git a/device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json.j2 b/device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json.j2 index 3e01af3f2c64..3e548325ea30 100755 --- a/device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json.j2 +++ b/device/accton/x86_64-accton_as7212_54x-r0/AS7212-54x/qos.json.j2 @@ -1,166 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { - "scheduler" : "[SCHEDULER|scheduler.2]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - } - } -} - +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 index 698811c610ff..3e548325ea30 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/qos.json.j2 @@ -1,148 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold":"312000", - "green_min_threshold":"104000" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|4" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 index 698811c610ff..3e548325ea30 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/qos.json.j2 @@ -1,148 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold":"312000", - "green_min_threshold":"104000" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|4" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 index 84f74ecab3be..3e548325ea30 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/qos.json.j2 @@ -1,155 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold": "312000", - "green_min_threshold": "104000" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 index 5142832ecae4..3e548325ea30 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/qos.json.j2 @@ -1,155 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold": "312000", - "green_min_threshold": "104000" - } - }, - "QUEUE": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0": { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126|1": { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 index 84f74ecab3be..3e548325ea30 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/qos.json.j2 @@ -1,155 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold": "312000", - "green_min_threshold": "104000" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 index 06efa3591771..3e548325ea30 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 @@ -1,155 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet26,Ethernet28,Ethernet30,Ethernet32,Ethernet34,Ethernet36,Ethernet38,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126,Ethernet128,Ethernet130,Ethernet132,Ethernet134,Ethernet136,Ethernet138,Ethernet140,Ethernet142,Ethernet144,Ethernet146,Ethernet148,Ethernet150,Ethernet152,Ethernet154,Ethernet156,Ethernet158,Ethernet160,Ethernet162,Ethernet164,Ethernet166,Ethernet168,Ethernet170,Ethernet172,Ethernet174,Ethernet176,Ethernet178,Ethernet180,Ethernet182,Ethernet184,Ethernet186,Ethernet188,Ethernet190,Ethernet192,Ethernet194,Ethernet196,Ethernet198,Ethernet200,Ethernet202,Ethernet204,Ethernet206,Ethernet208,Ethernet210,Ethernet212,Ethernet214,Ethernet216,Ethernet218,Ethernet220,Ethernet222,Ethernet224,Ethernet226,Ethernet228,Ethernet230,Ethernet232,Ethernet234,Ethernet236,Ethernet238,Ethernet240,Ethernet242,Ethernet244,Ethernet246,Ethernet248,Ethernet250,Ethernet252,Ethernet254": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold": "312000", - "green_min_threshold": "104000" - } - }, - "QUEUE": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet26,Ethernet28,Ethernet30,Ethernet32,Ethernet34,Ethernet36,Ethernet38,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126,Ethernet128,Ethernet130,Ethernet132,Ethernet134,Ethernet136,Ethernet138,Ethernet140,Ethernet142,Ethernet144,Ethernet146,Ethernet148,Ethernet150,Ethernet152,Ethernet154,Ethernet156,Ethernet158,Ethernet160,Ethernet162,Ethernet164,Ethernet166,Ethernet168,Ethernet170,Ethernet172,Ethernet174,Ethernet176,Ethernet178,Ethernet180,Ethernet182,Ethernet184,Ethernet186,Ethernet188,Ethernet190,Ethernet192,Ethernet194,Ethernet196,Ethernet198,Ethernet200,Ethernet202,Ethernet204,Ethernet206,Ethernet208,Ethernet210,Ethernet212,Ethernet214,Ethernet216,Ethernet218,Ethernet220,Ethernet222,Ethernet224,Ethernet226,Ethernet228,Ethernet230,Ethernet232,Ethernet234,Ethernet236,Ethernet238,Ethernet240,Ethernet242,Ethernet244,Ethernet246,Ethernet248,Ethernet250,Ethernet252,Ethernet254|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet26,Ethernet28,Ethernet30,Ethernet32,Ethernet34,Ethernet36,Ethernet38,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126,Ethernet128,Ethernet130,Ethernet132,Ethernet134,Ethernet136,Ethernet138,Ethernet140,Ethernet142,Ethernet144,Ethernet146,Ethernet148,Ethernet150,Ethernet152,Ethernet154,Ethernet156,Ethernet158,Ethernet160,Ethernet162,Ethernet164,Ethernet166,Ethernet168,Ethernet170,Ethernet172,Ethernet174,Ethernet176,Ethernet178,Ethernet180,Ethernet182,Ethernet184,Ethernet186,Ethernet188,Ethernet190,Ethernet192,Ethernet194,Ethernet196,Ethernet198,Ethernet200,Ethernet202,Ethernet204,Ethernet206,Ethernet208,Ethernet210,Ethernet212,Ethernet214,Ethernet216,Ethernet218,Ethernet220,Ethernet222,Ethernet224,Ethernet226,Ethernet228,Ethernet230,Ethernet232,Ethernet234,Ethernet236,Ethernet238,Ethernet240,Ethernet242,Ethernet244,Ethernet246,Ethernet248,Ethernet250,Ethernet252,Ethernet254|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet26,Ethernet28,Ethernet30,Ethernet32,Ethernet34,Ethernet36,Ethernet38,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet106,Ethernet108,Ethernet110,Ethernet112,Ethernet114,Ethernet116,Ethernet118,Ethernet120,Ethernet122,Ethernet124,Ethernet126,Ethernet128,Ethernet130,Ethernet132,Ethernet134,Ethernet136,Ethernet138,Ethernet140,Ethernet142,Ethernet144,Ethernet146,Ethernet148,Ethernet150,Ethernet152,Ethernet154,Ethernet156,Ethernet158,Ethernet160,Ethernet162,Ethernet164,Ethernet166,Ethernet168,Ethernet170,Ethernet172,Ethernet174,Ethernet176,Ethernet178,Ethernet180,Ethernet182,Ethernet184,Ethernet186,Ethernet188,Ethernet190,Ethernet192,Ethernet194,Ethernet196,Ethernet198,Ethernet200,Ethernet202,Ethernet204,Ethernet206,Ethernet208,Ethernet210,Ethernet212,Ethernet214,Ethernet216,Ethernet218,Ethernet220,Ethernet222,Ethernet224,Ethernet226,Ethernet228,Ethernet230,Ethernet232,Ethernet234,Ethernet236,Ethernet238,Ethernet240,Ethernet242,Ethernet244,Ethernet246,Ethernet248,Ethernet250,Ethernet252,Ethernet254|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/qos.json.j2 b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/qos.json.j2 index 7b8732e2e125..a685277448f1 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/qos.json.j2 +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/qos.json.j2 @@ -1,161 +1,10 @@ -{ +{%- macro generate_tc_to_pg_map() %} "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { "3": "3", "4": "4" } }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "3": "3", - "4": "4" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { - "scheduler" : "[SCHEDULER|scheduler.2]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - } - } -} +{%- endmacro %} + +{%- include 'qos_config.j2' %} diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/qos.json.j2 b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/qos.json.j2 index 7b8732e2e125..a685277448f1 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/qos.json.j2 +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/qos.json.j2 @@ -1,161 +1,10 @@ -{ +{%- macro generate_tc_to_pg_map() %} "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { "3": "3", "4": "4" } }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "3": "3", - "4": "4" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0": { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1": { - "scheduler" : "[SCHEDULER|scheduler.2]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0-1": { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - } - } -} +{%- endmacro %} + +{%- include 'qos_config.j2' %} diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json.j2 index 926911ab59d0..3e548325ea30 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json.j2 +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/qos.json.j2 @@ -1,143 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold":"312000", - "green_min_threshold":"104000" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 index 054a8f832cd4..3e548325ea30 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/qos.json.j2 @@ -1,182 +1 @@ -{%- set PORT_ALL = [] %} - -{%- if PORT is not defined %} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- else %} - {%- for port in PORT %} - {%- if PORT_ALL.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set PORT_ACTIVE = [] %} -{%- if DEVICE_NEIGHBOR is not defined %} - {%- set PORT_ACTIVE = PORT_ALL %} -{%- else %} - {%- for port in DEVICE_NEIGHBOR.keys() %} - {%- if PORT_ACTIVE.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set port_names_list_active = [] %} -{%- for port in PORT_ACTIVE %} - {%- if port_names_list_active.append(port) %}{%- endif %} -{%- endfor %} -{%- set port_names_active = port_names_list_active | join(',') %} - -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "{{ port_names_active }}": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold": "312000", - "green_min_threshold": "104000" - } - }, - "QUEUE": { - "{{ port_names_active }}|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "{{ port_names_active }}|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "{{ port_names_active }}|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 index 57bb4c532177..3e548325ea30 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-T0/qos.json.j2 @@ -1,155 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold": "312000", - "green_min_threshold": "104000" - } - }, - "QUEUE": { - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|3-4": { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|0": { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet2,Ethernet4,Ethernet6,Ethernet8,Ethernet10,Ethernet12,Ethernet14,Ethernet16,Ethernet18,Ethernet20,Ethernet22,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet42,Ethernet44,Ethernet46,Ethernet48,Ethernet50,Ethernet52,Ethernet54,Ethernet56,Ethernet58,Ethernet60,Ethernet62,Ethernet64,Ethernet66,Ethernet68,Ethernet70,Ethernet72,Ethernet74,Ethernet76,Ethernet78,Ethernet80,Ethernet82,Ethernet84,Ethernet86,Ethernet88,Ethernet90,Ethernet92,Ethernet94,Ethernet96,Ethernet98,Ethernet100,Ethernet102,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet122,Ethernet124,Ethernet126|1": { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 index 84f74ecab3be..3e548325ea30 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100/qos.json.j2 @@ -1,155 +1 @@ -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2" : { - "type":"DWRR", - "weight": "20" - } - }, - "PORT_QOS_MAP": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold": "312000", - "green_min_threshold": "104000" - } - }, - "QUEUE": { - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 index a11c77f7cc24..3e548325ea30 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 @@ -1,191 +1 @@ -{%- set PORT_ALL = [] %} - -{%- if PORT is not defined %} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- else %} - {%- for port in PORT %} - {%- if PORT_ALL.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set PORT_ACTIVE = [] %} -{%- if DEVICE_NEIGHBOR is not defined %} - {%- set PORT_ACTIVE = PORT_ALL %} -{%- else %} - {%- for port in DEVICE_NEIGHBOR.keys() %} - {%- if PORT_ACTIVE.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set port_names_list_active = [] %} -{%- for port in PORT_ACTIVE %} - {%- if port_names_list_active.append(port) %}{%- endif %} -{%- endfor %} -{%- set port_names_active = port_names_list_active | join(',') %} - -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "PORT_QOS_MAP": { - "{{ port_names_active }}": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "{{ port_names_active }}|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "{{ port_names_active }}|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "{{ port_names_active }}|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 index a11c77f7cc24..3e548325ea30 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 @@ -1,191 +1 @@ -{%- set PORT_ALL = [] %} - -{%- if PORT is not defined %} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- else %} - {%- for port in PORT %} - {%- if PORT_ALL.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set PORT_ACTIVE = [] %} -{%- if DEVICE_NEIGHBOR is not defined %} - {%- set PORT_ACTIVE = PORT_ALL %} -{%- else %} - {%- for port in DEVICE_NEIGHBOR.keys() %} - {%- if PORT_ACTIVE.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set port_names_list_active = [] %} -{%- for port in PORT_ACTIVE %} - {%- if port_names_list_active.append(port) %}{%- endif %} -{%- endfor %} -{%- set port_names_active = port_names_list_active | join(',') %} - -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "PORT_QOS_MAP": { - "{{ port_names_active }}": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "{{ port_names_active }}|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "{{ port_names_active }}|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "{{ port_names_active }}|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 index 55fd79a875ea..3e548325ea30 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 @@ -1,194 +1 @@ -{%- set PORT_ALL = [] %} - -{%- if PORT is not defined %} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- else %} - {%- for port in PORT %} - {%- if PORT_ALL.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set PORT_ACTIVE = [] %} -{%- if DEVICE_NEIGHBOR is not defined %} - {%- set PORT_ACTIVE = PORT_ALL %} -{%- else %} - {%- for port in DEVICE_NEIGHBOR.keys() %} - {%- if PORT_ACTIVE.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set port_names_list_active = [] %} -{%- for port in PORT_ACTIVE %} - {%- if port_names_list_active.append(port) %}{%- endif %} -{%- endfor %} -{%- set port_names_active = port_names_list_active | join(',') %} - -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "PORT_QOS_MAP": { - "{{ port_names_active }}": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "{{ port_names_active }}|0-1" : { - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]" - }, - "{{ port_names_active }}|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "{{ port_names_active }}|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "{{ port_names_active }}|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 index a11c77f7cc24..3e548325ea30 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 @@ -1,191 +1 @@ -{%- set PORT_ALL = [] %} - -{%- if PORT is not defined %} - {%- for port_idx in range(0,64) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- else %} - {%- for port in PORT %} - {%- if PORT_ALL.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set PORT_ACTIVE = [] %} -{%- if DEVICE_NEIGHBOR is not defined %} - {%- set PORT_ACTIVE = PORT_ALL %} -{%- else %} - {%- for port in DEVICE_NEIGHBOR.keys() %} - {%- if PORT_ACTIVE.append(port) %}{%- endif %} - {%- endfor %} -{%- endif %} - -{%- set port_names_list_active = [] %} -{%- for port in PORT_ACTIVE %} - {%- if port_names_list_active.append(port) %}{%- endif %} -{%- endfor %} -{%- set port_names_active = port_names_list_active | join(',') %} - -{ - "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "TC_TO_QUEUE_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "DSCP_TO_TC_MAP": { - "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - } - }, - "SCHEDULER": { - "scheduler.0": { - "type":"DWRR", - "weight": "25" - }, - "scheduler.1": { - "type":"DWRR", - "weight": "30" - }, - "scheduler.2": { - "type":"DWRR", - "weight": "20" - } - }, - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - } - }, - "PORT_QOS_MAP": { - "{{ port_names_active }}": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", - "pfc_enable": "3,4" - } - }, - "WRED_PROFILE": { - "AZURE_LOSSY": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "AZURE_LOSSLESS": { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"516096", - "red_min_threshold":"516096", - "yellow_max_threshold":"516096", - "yellow_min_threshold":"516096", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - } - }, - "QUEUE": { - "{{ port_names_active }}|3-4" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" - }, - "{{ port_names_active }}|0" : { - "scheduler" : "[SCHEDULER|scheduler.1]" - }, - "{{ port_names_active }}|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" - } - } -} +{%- include 'qos_config.j2' %} diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 new file mode 100644 index 000000000000..9a5c4826217c --- /dev/null +++ b/files/build_templates/qos_config.j2 @@ -0,0 +1,214 @@ +{%- set PORT_ALL = [] %} +{%- for port in PORT %} + {%- if PORT_ALL.append(port) %}{% endif %} +{%- endfor %} +{%- if PORT_ALL | sort_by_port_index %}{% endif %} + +{%- set port_names_list_all = [] %} +{%- for port in PORT_ALL %} + {%- if port_names_list_all.append(port) %}{% endif %} +{%- endfor %} +{%- set port_names_all = port_names_list_all | join(',') -%} + + +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} +{%- if PORT_ACTIVE | sort_by_port_index %}{% endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} +{%- endfor %} +{%- set port_names_active = port_names_list_active | join(',') -%} + + +{%- set pfc_to_pg_map_supported_asics = ['mellanox', 'barefoot', 'marvell'] -%} + + +{ +{% if generate_tc_to_pg_map is defined %} + {{- generate_tc_to_pg_map() }} +{% else %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, +{% endif %} + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "0", + "1" : "0", + "2" : "0", + "3" : "3", + "4" : "4", + "5" : "0", + "6" : "0", + "7" : "0", + "8" : "1", + "9" : "0", + "10": "0", + "11": "0", + "12": "0", + "13": "0", + "14": "0", + "15": "0", + "16": "0", + "17": "0", + "18": "0", + "19": "0", + "20": "0", + "21": "0", + "22": "0", + "23": "0", + "24": "0", + "25": "0", + "26": "0", + "27": "0", + "28": "0", + "29": "0", + "30": "0", + "31": "0", + "32": "0", + "33": "0", + "34": "0", + "35": "0", + "36": "0", + "37": "0", + "38": "0", + "39": "0", + "40": "0", + "41": "0", + "42": "0", + "43": "0", + "44": "0", + "45": "0", + "46": "0", + "47": "0", + "48": "0", + "49": "0", + "50": "0", + "51": "0", + "52": "0", + "53": "0", + "54": "0", + "55": "0", + "56": "0", + "57": "0", + "58": "0", + "59": "0", + "60": "0", + "61": "0", + "62": "0", + "63": "0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "25" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "30" + }, + "scheduler.2": { + "type" : "DWRR", + "weight": "20" + } + }, +{% if asic_type in pfc_to_pg_map_supported_asics %} + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "3": "3", + "4": "4" + } + }, +{% endif %} + "PORT_QOS_MAP": { + "{{ port_names_active }}": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", +{% if asic_type in pfc_to_pg_map_supported_asics %} + "pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]", +{% endif %} + "pfc_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "312000", + "green_min_threshold" : "104000", + "yellow_max_threshold": "312000", + "yellow_min_threshold": "104000", + "red_max_threshold" : "312000", + "red_min_threshold" : "104000" + } + }, + "QUEUE": { +{% for port in PORT_ACTIVE %} + "{{ port }}|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }{% if not loop.last %},{% endif %} + +{% endfor %} + } +} diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index bb1631abd147..e815e136fc3b 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -168,6 +168,9 @@ sudo cp $IMAGE_CONFIGS/hostcfgd/*.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ # Copy the buffer configuration template sudo cp $BUILD_TEMPLATES/buffers_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ +# Copy the qos configuration template +sudo cp $BUILD_TEMPLATES/qos_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ + # Copy hostname configuration scripts sudo cp $IMAGE_CONFIGS/hostname/hostname-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable hostname-config.service diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index 463b69c8f167..f923cc4bc6c2 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -37,6 +37,12 @@ from swsssdk import ConfigDBConnector from collections import OrderedDict from natsort import natsorted +def sort_by_port_index(value): + if not value: + return + if isinstance(value, list): + value.sort(key = lambda k: int(k[8:])) + def is_ipv4(value): if not value: return False @@ -224,6 +230,7 @@ def main(): loader = jinja2.FileSystemLoader(paths) env = jinja2.Environment(loader=loader, trim_blocks=True) + env.filters['sort_by_port_index'] = sort_by_port_index env.filters['ipv4'] = is_ipv4 env.filters['ipv6'] = is_ipv6 env.filters['unique_name'] = unique_name 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 0db51148bdc5..b4a377ef9703 100644 --- a/src/sonic-config-engine/tests/sample_output/qos-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json @@ -1,4 +1,3 @@ - { "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { @@ -38,83 +37,83 @@ }, "DSCP_TO_TC_MAP": { "AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" + "0" : "0", + "1" : "0", + "2" : "0", + "3" : "3", + "4" : "4", + "5" : "0", + "6" : "0", + "7" : "0", + "8" : "1", + "9" : "0", + "10": "0", + "11": "0", + "12": "0", + "13": "0", + "14": "0", + "15": "0", + "16": "0", + "17": "0", + "18": "0", + "19": "0", + "20": "0", + "21": "0", + "22": "0", + "23": "0", + "24": "0", + "25": "0", + "26": "0", + "27": "0", + "28": "0", + "29": "0", + "30": "0", + "31": "0", + "32": "0", + "33": "0", + "34": "0", + "35": "0", + "36": "0", + "37": "0", + "38": "0", + "39": "0", + "40": "0", + "41": "0", + "42": "0", + "43": "0", + "44": "0", + "45": "0", + "46": "0", + "47": "0", + "48": "0", + "49": "0", + "50": "0", + "51": "0", + "52": "0", + "53": "0", + "54": "0", + "55": "0", + "56": "0", + "57": "0", + "58": "0", + "59": "0", + "60": "0", + "61": "0", + "62": "0", + "63": "0" } }, "SCHEDULER": { - "scheduler.0" : { - "type":"DWRR", + "scheduler.0": { + "type" : "DWRR", "weight": "25" }, - "scheduler.1" : { - "type":"DWRR", + "scheduler.1": { + "type" : "DWRR", "weight": "30" }, - "scheduler.2" : { - "type":"DWRR", + "scheduler.2": { + "type" : "DWRR", "weight": "20" } }, @@ -124,33 +123,551 @@ "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", - "pfc_enable": "3,4" + "pfc_enable" : "3,4" } }, "WRED_PROFILE": { "AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "wred_red_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"312000", - "red_min_threshold":"104000", - "yellow_max_threshold":"312000", - "yellow_min_threshold":"104000", - "green_max_threshold": "312000", - "green_min_threshold": "104000" + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "312000", + "green_min_threshold" : "104000", + "yellow_max_threshold": "312000", + "yellow_min_threshold": "104000", + "red_max_threshold" : "312000", + "red_min_threshold" : "104000" } }, "QUEUE": { - "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" : { - "scheduler" : "[SCHEDULER|scheduler.0]", - "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" + "Ethernet0|3": { + "scheduler": "[SCHEDULER|scheduler.0]" }, - "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" : { - "scheduler" : "[SCHEDULER|scheduler.1]" + "Ethernet1|3": { + "scheduler": "[SCHEDULER|scheduler.0]" }, - "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|1" : { - "scheduler" : "[SCHEDULER|scheduler.2]" + "Ethernet4|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet5|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet6|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet7|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet8|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet9|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet10|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet11|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet12|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet13|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet14|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet15|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet16|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet17|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet20|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet21|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet22|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet23|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet24|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet25|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet26|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet27|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet28|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet29|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet30|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet31|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet32|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet36|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet37|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet38|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet39|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet40|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet41|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet42|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet48|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet52|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet53|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet54|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet55|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet56|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet57|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet58|3": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet0|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet1|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet4|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet5|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet6|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet7|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet8|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet9|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet10|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet11|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet12|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet13|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet14|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet15|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet16|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet17|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet20|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet21|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet22|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet23|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet24|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet25|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet26|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet27|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet28|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet29|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet30|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet31|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet32|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet36|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet37|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet38|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet39|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet40|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet41|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet42|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet48|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet52|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet53|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet54|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet55|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet56|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet57|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet58|4": { + "scheduler": "[SCHEDULER|scheduler.0]" + }, + "Ethernet0|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet1|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet4|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet5|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet6|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet7|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet8|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet9|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet10|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet11|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet12|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet13|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet14|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet15|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet16|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet17|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet20|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet21|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet22|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet23|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet24|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet25|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet26|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet27|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet28|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet29|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet30|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet31|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet32|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet36|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet37|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet38|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet39|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet40|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet41|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet42|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet48|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet52|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet53|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet54|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet55|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet56|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet57|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet58|0": { + "scheduler": "[SCHEDULER|scheduler.1]" + }, + "Ethernet0|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet1|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet4|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet5|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet6|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet7|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet8|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet9|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet10|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet11|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet12|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet13|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet14|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet15|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet16|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet17|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet20|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet21|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet22|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet23|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet24|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet25|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet26|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet27|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet28|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet29|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet30|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet31|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet32|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet36|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet37|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet38|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet39|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet40|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet41|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet42|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet48|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet52|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet53|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet54|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet55|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet56|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet57|1": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, + "Ethernet58|1": { + "scheduler": "[SCHEDULER|scheduler.2]" } } } diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 3e7e68c81c00..74e419e0c79e 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -124,9 +124,18 @@ def test_qos_dell6100_render_template(self): dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100') qos_file = os.path.join(dell_dir_path, 'qos.json.j2') port_config_ini_file = os.path.join(dell_dir_path, 'port_config.ini') + + # copy qos_config.j2 to the Dell S6100 directory to have all templates in one directory + qos_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'qos_config.j2') + shutil.copy2(qos_config_file, dell_dir_path) + argument = '-m ' + self.dell6100_t0_minigraph + ' -p ' + port_config_ini_file + ' -t ' + qos_file + ' > ' + self.output_file self.run_script(argument) + # cleanup + qos_config_file_new = os.path.join(dell_dir_path, 'qos_config.j2') + os.remove(qos_config_file_new) + sample_output_file = os.path.join(self.test_dir, 'sample_output', 'qos-dell6100.json') assert filecmp.cmp(sample_output_file, self.output_file) From 4a22de42c60d1d954e5466beb447bf399597e0fd Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Wed, 17 Oct 2018 18:31:19 -0700 Subject: [PATCH 1691/1833] Encap src_ip is not required for the IPinIP decap tunnels (#2162) * Encap src_ip is not required for the IPinIP decap tunnels * Removed unused variables --- dockers/docker-orchagent/ipinip.json.j2 | 12 +++--------- .../tests/sample_output/ipinip.json | 2 -- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index 6fd5f5a7f15c..cecb62dae2a7 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -1,15 +1,11 @@ {% set ipv4_addresses = [] %} {% set ipv6_addresses = [] %} -{% set ipv4_loopback_addresses = [] %} -{% set ipv6_loopback_addresses = [] %} {% for (name, prefix) in LOOPBACK_INTERFACE %} {%- if prefix | ipv4 and name == 'Loopback0' %} {%- set ipv4_addresses = ipv4_addresses.append(prefix) %} - {%- set ipv4_loopback_addresses = ipv4_loopback_addresses.append(prefix) %} {%- endif %} {%- if prefix | ipv6 and name == 'Loopback0' %} {%- set ipv6_addresses = ipv6_addresses.append(prefix) %} - {%- set ipv6_loopback_addresses = ipv6_loopback_addresses.append(prefix) %} {%- endif %} {% endfor %} {% for (name, prefix) in INTERFACE %} @@ -37,11 +33,10 @@ {%- endif %} {% endfor %} [ -{% if ipv4_loopback_addresses %} +{% if ipv4_addresses %} { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "src_ip":"{{ ipv4_loopback_addresses | first | ip }}", "dst_ip":"{% for prefix in ipv4_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", {% if "mlnx" in DEVICE_METADATA.localhost.platform %} "dscp_mode":"uniform", @@ -55,13 +50,12 @@ "OP": "SET" } {% endif %} -{% if ipv4_loopback_addresses and ipv6_loopback_addresses %} , +{% if ipv4_addresses and ipv6_addresses %} , {% endif %} -{% if ipv6_loopback_addresses %} +{% if ipv6_addresses %} { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "src_ip":"{{ ipv6_loopback_addresses | first | ip }}", "dst_ip":"{% for prefix in ipv6_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", {% if "mlnx" in DEVICE_METADATA.localhost.platform %} "dscp_mode":"uniform", diff --git a/src/sonic-config-engine/tests/sample_output/ipinip.json b/src/sonic-config-engine/tests/sample_output/ipinip.json index 24fbf2955a2f..e4028ea01a2d 100644 --- a/src/sonic-config-engine/tests/sample_output/ipinip.json +++ b/src/sonic-config-engine/tests/sample_output/ipinip.json @@ -2,7 +2,6 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "src_ip":"10.1.0.32", "dst_ip":"10.1.0.32,10.0.0.56,10.0.0.58,10.0.0.60,10.0.0.62,192.168.0.1", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", @@ -14,7 +13,6 @@ { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "src_ip":"fc00:1::32", "dst_ip":"fc00:1::32,fc00::71,fc00::75,fc00::79,fc00::7d", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", From 891e2568dd16f16d7e36177bd89c16a5af71b5f0 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 17 Oct 2018 19:32:27 -0700 Subject: [PATCH 1692/1833] [lldpd]: Use kernel autoprobe for netlink socket .nl_pid portion of the address (#2164) --- ...el-to-find-appropriate-nl_pid-automa.patch | 25 +++++++++++++++++++ src/lldpd/patch/series | 1 + 2 files changed, 26 insertions(+) create mode 100644 src/lldpd/patch/0002-Let-linux-kernel-to-find-appropriate-nl_pid-automa.patch diff --git a/src/lldpd/patch/0002-Let-linux-kernel-to-find-appropriate-nl_pid-automa.patch b/src/lldpd/patch/0002-Let-linux-kernel-to-find-appropriate-nl_pid-automa.patch new file mode 100644 index 000000000000..801fdd8ec96e --- /dev/null +++ b/src/lldpd/patch/0002-Let-linux-kernel-to-find-appropriate-nl_pid-automa.patch @@ -0,0 +1,25 @@ +From 2ee8585e8b716719a11235ab5c291b2f6ac9ce1a Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Wed, 17 Oct 2018 21:05:58 +0000 +Subject: [PATCH] Let linux kernel to find appropriate nl_pid automatically + +--- + src/daemon/netlink.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/daemon/netlink.c b/src/daemon/netlink.c +index 1a64a23..f4227b8 100644 +--- a/src/daemon/netlink.c ++++ b/src/daemon/netlink.c +@@ -93,7 +93,7 @@ netlink_connect(struct lldpd *cfg, int protocol, unsigned groups) + int s; + struct sockaddr_nl local = { + .nl_family = AF_NETLINK, +- .nl_pid = getpid(), ++ .nl_pid = 0, + .nl_groups = groups + }; + +-- +2.7.4 + diff --git a/src/lldpd/patch/series b/src/lldpd/patch/series index 8aa5ab8d8f3f..2ca46b575396 100644 --- a/src/lldpd/patch/series +++ b/src/lldpd/patch/series @@ -1,2 +1,3 @@ # This series applies on GIT commit 396961a038a38675d46f96eaa7b430b2a1f8701b 0001-return-error-when-port-does-not-exist.patch +0002-Let-linux-kernel-to-find-appropriate-nl_pid-automa.patch From 2a24a303ec179e2b10bb20ac361c83046bdefbae Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Thu, 18 Oct 2018 12:42:24 -0700 Subject: [PATCH 1693/1833] [tacplus nss conf] tacplus should be before compat (#2163) --- files/image_config/hostcfgd/hostcfgd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index 8c03f2234a94..f156f7e9402c 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -127,10 +127,10 @@ class AaaCfg(object): # Add tacplus in nsswitch.conf if TACACS+ enable if 'tacacs+' in auth['login']: if os.path.isfile(NSS_CONF): - os.system("sed -i -e '/tacplus/b' -e '/^passwd/s/compat/& tacplus/' /etc/nsswitch.conf") + os.system("sed -i -e '/tacplus/b' -e '/^passwd/s/compat/tacplus &/' /etc/nsswitch.conf") else: if os.path.isfile(NSS_CONF): - os.system("sed -i -e '/^passwd/s/ tacplus//' /etc/nsswitch.conf") + os.system("sed -i -e '/^passwd/s/tacplus //' /etc/nsswitch.conf") # Set tacacs+ server in nss-tacplus conf template_file = os.path.abspath(NSS_TACPLUS_CONF_TEMPLATE) From 164a1d3326119d0c3c42d9f27485680093265840 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 18 Oct 2018 14:07:30 -0700 Subject: [PATCH 1694/1833] [docker-syncd-brcm] Reorganize start.sh (#2161) --- platform/broadcom/docker-syncd-brcm/start.sh | 32 +++++++++++--------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index c52e5cb20271..98c7d9c15a0d 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -3,7 +3,25 @@ PLATFORM_DIR=/usr/share/sonic/platform HWSKU_DIR=/usr/share/sonic/hwsku +SYNCD_SOCKET_FILE=/var/run/sswsyncd/sswsyncd.socket + +# Function: wait until syncd has created the socket for bcmcmd to connect to +wait_syncd() { + while true; do + if [ -e ${SYNCD_SOCKET_FILE} ]; then + break + fi + sleep 1 + done + + # wait until bcm sdk is ready to get a request + sleep 3 +} + + +# Remove stale files if they exist rm -f /var/run/rsyslogd.pid +rm -f ${SYNCD_SOCKET_FILE} supervisorctl start rsyslogd @@ -18,22 +36,8 @@ else fi fi -rm -f /var/run/sswsyncd/sswsyncd.socket supervisorctl start syncd -# Function: wait until syncd has created the socket for bcmcmd to connect to -wait_syncd() { - while true; do - if [ -e /var/run/sswsyncd/sswsyncd.socket ]; then - break - fi - sleep 1 - done - - # wait until bcm sdk is ready to get a request - sleep 3 -} - # If this platform has an initialization file for the Broadcom LED microprocessor, load it if [ -r ${PLATFORM_DIR}/led_proc_init.soc ]; then wait_syncd From 3e1b9e17b4e906843598b5ee6b1ac2f179d322e2 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 18 Oct 2018 15:22:26 -0700 Subject: [PATCH 1695/1833] [teamd] Force team device recreation in case it already exists (#2168) * Force team device recreation in case it already exists --- dockers/docker-teamd/teamd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-teamd/teamd.sh b/dockers/docker-teamd/teamd.sh index 2b6d9fb53970..1c080d24bb27 100755 --- a/dockers/docker-teamd/teamd.sh +++ b/dockers/docker-teamd/teamd.sh @@ -6,7 +6,7 @@ function start_app { rm -f /var/run/teamd/* if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then for f in $TEAMD_CONF_PATH/*; do - teamd -f $f -d + teamd -f $f -d -r done fi teamsyncd & From 890baedeb6e796d94c93cd82a89344ed75682abe Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 18 Oct 2018 18:16:18 -0700 Subject: [PATCH 1696/1833] [vs]: generate port table in config db for virtual switch (#2169) Signed-off-by: Guohan Lu --- platform/vs/docker-sonic-vs/start.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 6180c0b66b1c..f08888d8d797 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -13,7 +13,8 @@ if [ -f /etc/sonic/config_db.json ]; then else # generate and merge buffers configuration into config file sonic-cfggen -t /usr/share/sonic/device/vswitch/buffers.json.j2 > /tmp/buffers.json - sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json --print-data > /etc/sonic/config_db.json + sonic-cfggen -p /usr/share/sonic/device/x86_64-dell_s6000_s1220-r0/Force10-S6000/port_config.ini -k Force10-S6000 --print-data > /tmp/ports.json + sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json -j /tmp/ports.json --print-data > /etc/sonic/config_db.json fi mkdir -p /etc/swss/config.d/ From 7313e7d9bc62b7443c1229c6b305ead0369c8405 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 19 Oct 2018 03:41:53 -0700 Subject: [PATCH 1697/1833] [teamd]: Add teammgrd in docker-teamd (#2064) Remove the teamd.j2 templates used for starting the teamd. Add teammgrd instead to manage all port channel related configuration changes. Remove front panel port related configurations in interfaces.j2 templates as well. Remove teamd.sh script and use teammgrd to start all the teamd processes. Remove all the logics in the start.sh script as well. Update the sonic-swss submodule. Signed-off-by: Shu0T1an ChenG --- dockers/docker-teamd/Dockerfile.j2 | 3 +- dockers/docker-teamd/start.sh | 38 ++----------------- dockers/docker-teamd/supervisord.conf | 12 +++++- dockers/docker-teamd/teamd.j2 | 25 ------------ dockers/docker-teamd/teamd.sh | 28 -------------- files/image_config/interfaces/interfaces.j2 | 16 -------- platform/vs/docker-sonic-vs/start.sh | 2 + platform/vs/docker-sonic-vs/supervisord.conf | 8 ++++ .../tests/sample_output/interfaces | 26 ------------- .../pc_sample_output/PortChannel01.conf | 20 ---------- src/sonic-config-engine/tests/test_j2files.py | 29 -------------- src/sonic-swss | 2 +- 12 files changed, 26 insertions(+), 183 deletions(-) delete mode 100644 dockers/docker-teamd/teamd.j2 delete mode 100755 dockers/docker-teamd/teamd.sh delete mode 100644 src/sonic-config-engine/tests/sample_output/pc_sample_output/PortChannel01.conf diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 1c3d9eea462a..f18ff9eabb61 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -25,9 +25,8 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY ["start.sh", "teamd.sh", "/usr/bin/"] +COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["teamd.j2", "/usr/share/sonic/templates/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs diff --git a/dockers/docker-teamd/start.sh b/dockers/docker-teamd/start.sh index fb3b7c3dadf8..cfa2bdc2cb13 100755 --- a/dockers/docker-teamd/start.sh +++ b/dockers/docker-teamd/start.sh @@ -1,40 +1,10 @@ #!/usr/bin/env bash -TEAMD_CONF_PATH=/etc/teamd - -rm -rf $TEAMD_CONF_PATH -mkdir -p $TEAMD_CONF_PATH - -SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) - -if [ "$SONIC_ASIC_TYPE" == "mellanox" ]; then - MAC_ADDRESS=$(sonic-cfggen -d -v DEVICE_METADATA.localhost.mac) -else - MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') -fi - -# Align last byte -if [ "$SONIC_ASIC_TYPE" == "mellanox" -o "$SONIC_ASIC_TYPE" == "centec" ]; then - last_byte=$(python -c "print '$MAC_ADDRESS'[-2:]") - aligned_last_byte=$(python -c "print format(int(int('$last_byte', 16) & 0b11000000), '02x')") # put mask and take away the 0x prefix - MAC_ADDRESS=$(python -c "print '$MAC_ADDRESS'[:-2] + '$aligned_last_byte'") # put aligned byte into the end of MAC -fi - -for pc in `sonic-cfggen -d -v "PORTCHANNEL.keys() | join(' ') if PORTCHANNEL"`; do - sonic-cfggen -d -a '{"pc":"'$pc'","hwaddr":"'$MAC_ADDRESS'"}' -t /usr/share/sonic/templates/teamd.j2 > $TEAMD_CONF_PATH/$pc.conf - # bring down all member ports before starting teamd - for member in $(sonic-cfggen -d -v "PORTCHANNEL['$pc']['members'] | join(' ')" ); do - if [ -L /sys/class/net/$member ]; then - ip link set $member down - fi - done -done - -mkdir -p /var/sonic -echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status - rm -f /var/run/rsyslogd.pid +rm -f /var/run/teamd/* supervisorctl start rsyslogd -supervisorctl start teamd +supervisorctl start teammgrd + +supervisorctl start teamsyncd diff --git a/dockers/docker-teamd/supervisord.conf b/dockers/docker-teamd/supervisord.conf index 48ef0ca9f29e..738751d0a59f 100644 --- a/dockers/docker-teamd/supervisord.conf +++ b/dockers/docker-teamd/supervisord.conf @@ -19,8 +19,16 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog -[program:teamd] -command=/usr/bin/teamd.sh +[program:teammgrd] +command=/usr/bin/teammgrd +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:teamsyncd] +command=/usr/bin/teamsyncd priority=3 autostart=false autorestart=false diff --git a/dockers/docker-teamd/teamd.j2 b/dockers/docker-teamd/teamd.j2 deleted file mode 100644 index 9f53534a808b..000000000000 --- a/dockers/docker-teamd/teamd.j2 +++ /dev/null @@ -1,25 +0,0 @@ -{ - "device": "{{ pc }}", - "hwaddr": "{{ hwaddr }}", - "runner": { - "name": "lacp", - "active": true, -{% if PORTCHANNEL[pc]['fallback'] and ((PORTCHANNEL[pc]['members'] | length) == 1) %} - "fallback": {{ PORTCHANNEL[pc]['fallback'] }}, -{% else %} -{# Use 75% links upperbound as min-links #} - "min_ports": {{ (PORTCHANNEL[pc]['members'] | length * 0.75) | round(0, 'ceil') | int }}, -{% endif %} - "tx_hash": ["eth", "ipv4", "ipv6"] - }, - "link_watch": { - "name": "ethtool" - }, - "ports": { -{% for member in PORTCHANNEL[pc]['members'] %} - "{{ member }}": {}{% if not loop.last %},{% endif %} - -{% endfor %} - } -} - diff --git a/dockers/docker-teamd/teamd.sh b/dockers/docker-teamd/teamd.sh deleted file mode 100755 index 1c080d24bb27..000000000000 --- a/dockers/docker-teamd/teamd.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -TEAMD_CONF_PATH=/etc/teamd - -function start_app { - rm -f /var/run/teamd/* - if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then - for f in $TEAMD_CONF_PATH/*; do - teamd -f $f -d -r - done - fi - teamsyncd & -} - -function clean_up { - if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then - for f in $TEAMD_CONF_PATH/*; do - teamd -f $f -k - done - fi - pkill -9 teamsyncd - exit -} - -trap clean_up SIGTERM SIGKILL - -start_app -read diff --git a/files/image_config/interfaces/interfaces.j2 b/files/image_config/interfaces/interfaces.j2 index da2499ee5047..e2ee58e9c320 100644 --- a/files/image_config/interfaces/interfaces.j2 +++ b/files/image_config/interfaces/interfaces.j2 @@ -48,19 +48,3 @@ iface eth0 inet dhcp {% endif %} # {% endblock mgmt_interface %} -{% block front_panel_interfaces %} -{% if PORTCHANNEL %} -# "|| true" is added to suppress the error when interface is already a member of LAG -# "ip link show | grep -q master" is added to ensure interface is enslaved -{% for pc in PORTCHANNEL.keys()|sort %} -{% for member in PORTCHANNEL[pc]['members'] %} -allow-hotplug {{ member }} -iface {{ member }} inet manual - pre-up teamdctl {{ pc }} port add {{ member }} || true - post-up ip link show {{ member }} | grep -q master && ifconfig {{ member }} up - post-down ifconfig {{ member }} down -# -{% endfor %} -{% endfor %} -{% endif %} -{% endblock front_panel_interfaces %} diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index f08888d8d797..83e818fe0874 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -43,6 +43,8 @@ supervisorctl start teamsyncd supervisorctl start fpmsyncd +supervisorctl start teammgrd + supervisorctl start portmgrd supervisorctl start intfmgrd diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index 29283c7102a3..088684293cd9 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -99,6 +99,14 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog +[program:teammgrd] +command=/usr/bin/teammgrd +priority=12 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + [program:zebra] command=/usr/lib/quagga/zebra -A 127.0.0.1 priority=13 diff --git a/src/sonic-config-engine/tests/sample_output/interfaces b/src/sonic-config-engine/tests/sample_output/interfaces index c471c0aa8d60..4e53e2a5189a 100644 --- a/src/sonic-config-engine/tests/sample_output/interfaces +++ b/src/sonic-config-engine/tests/sample_output/interfaces @@ -47,30 +47,4 @@ iface eth0 inet6 static down ip -6 route delete 2603:10e2:0:2902::/64 dev eth0 table default down ip -6 rule delete from 2603:10e2:0:2902::8/128 table default # -# "|| true" is added to suppress the error when interface is already a member of LAG -# "ip link show | grep -q master" is added to ensure interface is enslaved -allow-hotplug fortyGigE0/112 -iface fortyGigE0/112 inet manual - pre-up teamdctl PortChannel01 port add fortyGigE0/112 || true - post-up ip link show fortyGigE0/112 | grep -q master && ifconfig fortyGigE0/112 up - post-down ifconfig fortyGigE0/112 down -# -allow-hotplug fortyGigE0/116 -iface fortyGigE0/116 inet manual - pre-up teamdctl PortChannel02 port add fortyGigE0/116 || true - post-up ip link show fortyGigE0/116 | grep -q master && ifconfig fortyGigE0/116 up - post-down ifconfig fortyGigE0/116 down -# -allow-hotplug fortyGigE0/120 -iface fortyGigE0/120 inet manual - pre-up teamdctl PortChannel03 port add fortyGigE0/120 || true - post-up ip link show fortyGigE0/120 | grep -q master && ifconfig fortyGigE0/120 up - post-down ifconfig fortyGigE0/120 down -# -allow-hotplug fortyGigE0/124 -iface fortyGigE0/124 inet manual - pre-up teamdctl PortChannel04 port add fortyGigE0/124 || true - post-up ip link show fortyGigE0/124 | grep -q master && ifconfig fortyGigE0/124 up - post-down ifconfig fortyGigE0/124 down -# diff --git a/src/sonic-config-engine/tests/sample_output/pc_sample_output/PortChannel01.conf b/src/sonic-config-engine/tests/sample_output/pc_sample_output/PortChannel01.conf deleted file mode 100644 index 618e9baad6a7..000000000000 --- a/src/sonic-config-engine/tests/sample_output/pc_sample_output/PortChannel01.conf +++ /dev/null @@ -1,20 +0,0 @@ -{ - "device": "PortChannel01", - "hwaddr": "e4:1d:2d:a5:f3:ad", - "runner": { - "name": "lacp", - "active": true, - "min_ports": 3, - "tx_hash": ["eth", "ipv4", "ipv6"] - }, - "link_watch": { - "name": "ethtool" - }, - "ports": { - "Ethernet112": {}, - "Ethernet116": {}, - "Ethernet120": {}, - "Ethernet124": {} - } -} - diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 74e419e0c79e..d6066b628e61 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -75,35 +75,6 @@ def test_config_frr(self): self.run_script(argument) self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'frr.conf'), self.output_file)) - def test_teamd(self): - - def test_render_teamd(self, pc, minigraph, sample_output): - teamd_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-teamd', 'teamd.j2') - argument = '-m ' + minigraph + ' -p ' + self.t0_port_config + ' -a \'{\"pc\":\"' + pc + '\",\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + teamd_file + ' > ' + self.output_file - self.run_script(argument) - self.assertTrue(filecmp.cmp(sample_output, self.output_file)) - - # Test T0 minigraph - argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "PORTCHANNEL.keys() | join(\' \') if PORTCHANNEL"' - output = self.run_script(argument) # Mock the output via config.sh in docker-teamd - pc_list = output.split() - - for i in range(1, 5): - pc_name = 'PortChannel0' + str(i) - self.assertTrue(pc_name in pc_list) - sample_output = os.path.join(self.test_dir, 'sample_output', 't0_sample_output', pc_name + '.conf') - test_render_teamd(self, pc_name, self.t0_minigraph, sample_output) - - # Test port channel test minigraph - argument = '-m ' + self.pc_minigraph + ' -p ' + self.t0_port_config + ' -v "PORTCHANNEL.keys() | join(\' \') if PORTCHANNEL"' - output = self.run_script(argument) # Mock the output via config.sh in docker-teamd - pc_list = output.split() - - pc_name = 'PortChannel01' - self.assertTrue(pc_name in pc_list) - sample_output = os.path.join(self.test_dir, 'sample_output', 'pc_sample_output', pc_name + '.conf') - test_render_teamd(self, pc_name, self.pc_minigraph, sample_output) - def test_ipinip(self): ipinip_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ipinip.json.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + ipinip_file + ' > ' + self.output_file diff --git a/src/sonic-swss b/src/sonic-swss index e1cc0de6159d..68a962903ae2 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit e1cc0de6159d03bd3def4d4715ae1c93cd12a1e8 +Subproject commit 68a962903ae227d76c5367a7a3cacd4063893922 From babf2a9bbe3c38e2d2983a3ccc128103e62eb668 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 19 Oct 2018 09:43:35 -0700 Subject: [PATCH 1698/1833] [sonic-utilities]: Update submodule (#2170) Signed-off-by: Qi Luo --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 6d00d1413d7e..4562d570eb37 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 6d00d1413d7e4a8e8ac826ad1add3403402c1a60 +Subproject commit 4562d570eb3739ffa47b45ffd79919ebe31595db From 5c65c7730db250117f17ebd34fc9541cf466b6e2 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 20 Oct 2018 14:39:04 -0700 Subject: [PATCH 1699/1833] [build]: Eliminate build warning messages (#2172) --- platform/broadcom/sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 980b5775dba9..f0d9a55d8fb9 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -5,5 +5,5 @@ BRCM_SAI_DEV = libsaibcm-dev_3.1.3.5-11_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) $(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/libsaibcm-dev_3.1.3.5-11_amd64.deb?sv=2015-04-05&sr=b&sig=YE%2BCpURwLGSzE8qBVandbERncFUkm5CEvCdMB9YrKZM%3D&se=2155-09-02T02%3A43%3A51Z&sp=r" -SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV) +SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 90783770286ef6905bdea05c480c8ca759cbf230 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sun, 21 Oct 2018 17:20:27 -0700 Subject: [PATCH 1700/1833] [build]: install debug symbols packages when INSTALL_DEBUG_TOOLS=y (#2175) [build]: install debug symbols packages when INSTALL_DEBUG_TOOLS=y --- Makefile.work | 4 +++- platform/barefoot/docker-orchagent-bfn.mk | 5 +++++ platform/broadcom/docker-orchagent-brcm.mk | 5 +++++ platform/cavium/docker-orchagent-cavm.mk | 5 +++++ platform/centec/docker-orchagent-centec.mk | 5 +++++ platform/marvell/docker-orchagent-mrvl.mk | 5 +++++ platform/mellanox/docker-orchagent-mlnx.mk | 5 +++++ platform/nephos/docker-orchagent-nephos.mk | 5 +++++ platform/vs/docker-sonic-vs.mk | 7 +++++++ rules/docker-base.mk | 2 +- slave.mk | 6 +++++- 11 files changed, 51 insertions(+), 3 deletions(-) diff --git a/Makefile.work b/Makefile.work index ba61b48059ad..1809e2b6c0d8 100644 --- a/Makefile.work +++ b/Makefile.work @@ -10,7 +10,8 @@ # * SHUTDOWN_BGP_ON_START: Sets admin-down state for all bgp peerings after restart. # * ENABLE_PFCWD_ON_START: Enable PFC Watchdog (PFCWD) on server-facing ports # * by default for TOR switch. -# * SONIC_ENABLE_SYNCD_RPC: Enables rpc-based syncd builds. +# * ENABLE_SYNCD_RPC: Enables rpc-based syncd builds. +# * INSTALL_DEBUG_TOOLS: Install debug tools and debug symbol packeages. # * USERNAME: Desired username -- default at rules/config # * PASSWORD: Desired password -- default at rules/config # * KEEP_SLAVE_ON: Keeps slave container up and active after building process concludes. @@ -95,6 +96,7 @@ SONIC_BUILD_INSTRUCTION := make \ SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \ SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ + SONIC_INSTALL_DEBUG_TOOLS=$(INSTALL_DEBUG_TOOLS) \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ diff --git a/platform/barefoot/docker-orchagent-bfn.mk b/platform/barefoot/docker-orchagent-bfn.mk index 67069a6060c4..fefd39691855 100644 --- a/platform/barefoot/docker-orchagent-bfn.mk +++ b/platform/barefoot/docker-orchagent-bfn.mk @@ -3,6 +3,11 @@ DOCKER_ORCHAGENT_BFN = docker-orchagent-bfn.gz $(DOCKER_ORCHAGENT_BFN)_PATH = $(DOCKERS_PATH)/docker-orchagent $(DOCKER_ORCHAGENT_BFN)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) +ifeq ($(INSTALL_DEBUG_TOOLS), y) +$(DOCKER_ORCHAGENT_BFN)_DEPENDS += $(SWSS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIREDIS_DBG) +endif $(DOCKER_ORCHAGENT_BFN)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BFN) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BFN) diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index 5b4cd31f8b39..dc3c31f43d5b 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -3,6 +3,11 @@ DOCKER_ORCHAGENT_BRCM = docker-orchagent-brcm.gz $(DOCKER_ORCHAGENT_BRCM)_PATH = $(DOCKERS_PATH)/docker-orchagent $(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) +ifeq ($(INSTALL_DEBUG_TOOLS), y) +$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIREDIS_DBG) +endif $(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index 6513fbabf4f3..282cdaa9172d 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -3,6 +3,11 @@ DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz $(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent $(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) +ifeq ($(INSTALL_DEBUG_TOOLS), y) +$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIREDIS_DBG) +endif $(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk index c6ee277f7ed7..891f5550bac6 100644 --- a/platform/centec/docker-orchagent-centec.mk +++ b/platform/centec/docker-orchagent-centec.mk @@ -3,6 +3,11 @@ DOCKER_ORCHAGENT_CENTEC = docker-orchagent-centec.gz $(DOCKER_ORCHAGENT_CENTEC)_PATH = $(DOCKERS_PATH)/docker-orchagent $(DOCKER_ORCHAGENT_CENTEC)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) +ifeq ($(INSTALL_DEBUG_TOOLS), y) +$(DOCKER_ORCHAGENT_CENTEC)_DEPENDS += $(SWSS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIREDIS_DBG) +endif $(DOCKER_ORCHAGENT_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC) diff --git a/platform/marvell/docker-orchagent-mrvl.mk b/platform/marvell/docker-orchagent-mrvl.mk index 1106aedac05d..9c3c4c13a8f9 100644 --- a/platform/marvell/docker-orchagent-mrvl.mk +++ b/platform/marvell/docker-orchagent-mrvl.mk @@ -3,6 +3,11 @@ DOCKER_ORCHAGENT_MRVL = docker-orchagent-mrvl.gz $(DOCKER_ORCHAGENT_MRVL)_PATH = $(DOCKERS_PATH)/docker-orchagent $(DOCKER_ORCHAGENT_MRVL)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) +ifeq ($(INSTALL_DEBUG_TOOLS), y) +$(DOCKER_ORCHAGENT_MRVL)_DEPENDS += $(SWSS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIREDIS_DBG) +endif $(DOCKER_ORCHAGENT_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MRVL) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MRVL) diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index f43f986527a3..5e72beb4c300 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -3,6 +3,11 @@ DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz $(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent $(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) +ifeq ($(INSTALL_DEBUG_TOOLS), y) +$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIREDIS_DBG) +endif $(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) diff --git a/platform/nephos/docker-orchagent-nephos.mk b/platform/nephos/docker-orchagent-nephos.mk index 098a94772b5c..f7719b3df5dd 100644 --- a/platform/nephos/docker-orchagent-nephos.mk +++ b/platform/nephos/docker-orchagent-nephos.mk @@ -3,6 +3,11 @@ DOCKER_ORCHAGENT_NEPHOS = docker-orchagent-nephos.gz $(DOCKER_ORCHAGENT_NEPHOS)_PATH = $(DOCKERS_PATH)/docker-orchagent $(DOCKER_ORCHAGENT_NEPHOS)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) +ifeq ($(INSTALL_DEBUG_TOOLS), y) +$(DOCKER_ORCHAGENT_NEPHOS)_DEPENDS += $(SWSS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIREDIS_DBG) +endif $(DOCKER_ORCHAGENT_NEPHOS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_NEPHOS) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_NEPHOS) diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index ce0f4f3dea09..e534a5392c8c 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -13,6 +13,13 @@ $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \ $(SONIC_UTILS) \ $(IPROUTE2) +ifeq ($(INSTALL_DEBUG_TOOLS), y) +$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIREDIS_DBG) \ + $(SYNCD_VS_DBG) +endif + ifeq ($(SONIC_ROUTING_STACK), quagga) $(DOCKER_SONIC_VS)_DEPENDS += $(QUAGGA) else ifeq ($(SONIC_ROUTING_STACK), frr) diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 55e44e7f3447..523b64c29181 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -7,7 +7,7 @@ $(DOCKER_BASE)_DEPENDS += $(LIBWRAP) $(DOCKER_BASE)_DEPENDS += $(BASH) $(DOCKER_BASE)_DEPENDS += $(SOCAT) -ifeq ($(SONIC_INSTALL_DEBUG_TOOLS),y) +ifeq ($(INSTALL_DEBUG_TOOLS),y) GDB = gdb VIM = vim OPENSSH = openssh-client diff --git a/slave.mk b/slave.mk index e88352f7cbdb..ba146b20a111 100644 --- a/slave.mk +++ b/slave.mk @@ -74,6 +74,10 @@ ifeq ($(SONIC_ENABLE_SYNCD_RPC),y) ENABLE_SYNCD_RPC = y endif +ifeq ($(SONIC_INSTALL_DEBUG_TOOLS),y) +INSTALL_DEBUG_TOOLS = y +endif + include $(RULES_PATH)/config include $(RULES_PATH)/functions include $(RULES_PATH)/*.mk @@ -128,7 +132,7 @@ $(info "PASSWORD" : "$(PASSWORD)") $(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)") $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)") $(info "ENABLE_PFCWD_ON_START" : "$(ENABLE_PFCWD_ON_START)") -$(info "SONIC_INSTALL_DEBUG_TOOLS" : "$(SONIC_INSTALL_DEBUG_TOOLS)") +$(info "INSTALL_DEBUG_TOOLS" : "$(INSTALL_DEBUG_TOOLS)") $(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)") $(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)") $(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)") From e970cf174833a257188992bbbb494b3f6fa65ed2 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 22 Oct 2018 21:17:08 -0700 Subject: [PATCH 1701/1833] [docker-sonic-vs]: add libsaivs-dbg package in docker-sonic-vs (#2177) Signed-off-by: Guohan Lu --- platform/vs/docker-sonic-vs.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index e534a5392c8c..ea0d15134f5a 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -17,6 +17,7 @@ ifeq ($(INSTALL_DEBUG_TOOLS), y) $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS_DBG) \ $(LIBSWSSCOMMON_DBG) \ $(LIBSAIREDIS_DBG) \ + $(LIBSAIVS_DBG) \ $(SYNCD_VS_DBG) endif From 709cd5a9f5532d95d7913a02dd76bd358f037a7b Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 22 Oct 2018 23:40:24 -0700 Subject: [PATCH 1702/1833] Set swssconfig.sh startsecs=0 for quick exit (#2181) The default startsecs is 1 second. However, swssconfig.sh will quickly exit with expected exit code 0 during warm starting. This case should not be treated as a failure --- dockers/docker-orchagent/supervisord.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 6a0b18cb70d0..71748ad4fba6 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -57,6 +57,7 @@ priority=7 autostart=false autorestart=unexpected startretries=0 +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog From 973f83de2763cd0cb48d298af2711135404daa6b Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Wed, 24 Oct 2018 11:56:31 +0800 Subject: [PATCH 1703/1833] [mellanox] unify the sfp and eeprom plugin for all the mellanox platform (#2174) --- .../x86_64-mlnx_msn2010-r0/plugins/eeprom.py | 33 +-- .../plugins/sfplpmget.py | 44 +--- .../plugins/sfplpmset.py | 108 +--------- .../plugins/sfpreset.py | 46 +--- .../x86_64-mlnx_msn2010-r0/plugins/sfputil.py | 202 +----------------- .../x86_64-mlnx_msn2100-r0/plugins/eeprom.py | 33 +-- .../plugins/sfplpmget.py | 44 +--- .../plugins/sfplpmset.py | 108 +--------- .../plugins/sfpreset.py | 46 +--- .../x86_64-mlnx_msn2100-r0/plugins/sfputil.py | 201 +---------------- .../x86_64-mlnx_msn2410-r0/plugins/eeprom.py | 33 +-- .../plugins/sfplpmget.py | 44 +--- .../plugins/sfplpmset.py | 108 +--------- .../plugins/sfpreset.py | 46 +--- .../x86_64-mlnx_msn2410-r0/plugins/sfputil.py | 202 +----------------- .../x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 35 ++- .../x86_64-mlnx_msn2740-r0/plugins/eeprom.py | 33 +-- .../plugins/sfplpmget.py | 44 +--- .../plugins/sfplpmset.py | 108 +--------- .../plugins/sfpreset.py | 46 +--- .../x86_64-mlnx_msn2740-r0/plugins/sfputil.py | 201 +---------------- 21 files changed, 47 insertions(+), 1718 deletions(-) mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmget.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmset.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfpreset.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmget.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmset.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfpreset.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmget.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmset.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfpreset.py mode change 100644 => 120000 device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py deleted file mode 100644 index 61e37b51db71..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -############################################################################# -# Mellanox -# -# Platform and model specific eeprom subclass, inherits from the base class, -# and provides the followings: -# - the eeprom format definition -# - specific encoder/decoder if there is special need -############################################################################# - -try: - import exceptions - import binascii - import time - import optparse - import warnings - import os - import sys - from sonic_eeprom import eeprom_base - from sonic_eeprom import eeprom_tlvinfo - import subprocess -except ImportError, e: - raise ImportError (str(e) + "- required module not found") - -class board(eeprom_tlvinfo.TlvInfoDecoder): - - _TLV_INFO_MAX_LEN = 256 - - def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/bsp/eeprom/vpd_info" - super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py new file mode 120000 index 000000000000..b4e2a6a61671 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/eeprom.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/eeprom.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py deleted file mode 100644 index 170766e9bce4..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -# Check if SFP port number is provided -if len(sys.argv) < 2: - print "SFP module number is missed." - print "Usage: sfplpmget.py " - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -# Get SFP module number -sfp_module = int(sys.argv[1]) - -# Get MCION -mcion = ku_mcion_reg() -mcion.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET - -rc = sxd_access_reg_mcion(mcion, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_mcion failed, rc = %d" % rc - -# Get low power mode status -lpm_mask = 1 << 8 -lpm_status = (lpm_mask & mcion.module_status_bits) != 0 -print "LPM ON" if lpm_status else "LPM OFF" diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py new file mode 120000 index 000000000000..2e84f435abd9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmget.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py deleted file mode 100644 index 3f31af9f2944..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import time -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -def get_log_ports(handle, sfp_module): - port_attributes_list = new_sx_port_attributes_t_arr(64) - port_cnt_p = new_uint32_t_p() - uint32_t_p_assign(port_cnt_p, 64) - - rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) - assert rc == SX_STATUS_SUCCESS, "sx_api_port_device_get failed, rc = %d" % rc - - port_cnt = uint32_t_p_value(port_cnt_p) - 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: - log_port_list.append(port_attributes.log_port) - - return log_port_list - -def set_sfp_admin_status(handle, meta, sfp_module, sfp_log_port_list, admin_status): - # Get PMAOS - pmaos = ku_pmaos_reg() - pmaos.module = sfp_module - meta.access_cmd = SXD_ACCESS_CMD_GET - rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) - assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - - # Set admin status to PMAOS - pmaos.ase = 1 - pmaos.ee = 1 - pmaos.e = 2 - pmaos.rst = 0 - if admin_status == SX_PORT_ADMIN_STATUS_DOWN: - pmaos.admin_status = 2 - else: - pmaos.admin_status = 1 - - meta.access_cmd = SXD_ACCESS_CMD_SET - rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) - assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - -# Check if SFP port number is provided -if len(sys.argv) < 3: - print "SFP module number or LPM is missed." - print "Usage: sfplpmset.py " - sys.exit(errno.EINVAL) - -lpm_enable = None -if sys.argv[2] == 'on': - lpm_enable = True -elif sys.argv[2] == 'off': - lpm_enable = False -else: - print "Unrecognized LPM parameter. Please use or values" - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES); - -# Get SFP module and log ports number and LPM status -sfp_module = int(sys.argv[1]) -log_port_list = get_log_ports(handle, sfp_module) -if not log_port_list: - print "Failed to get log ports" - sys.exit(errno.EACCES) - -# Get PMMP -pmmp = ku_pmmp_reg() -pmmp.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET -rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc - -# Disable admin status before LPM settings -set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_DOWN) - -# Set low power mode status -lpm_mask = 1 << 8 -if lpm_enable: - pmmp.eeprom_override = pmmp.eeprom_override | lpm_mask -else: - pmmp.eeprom_override = pmmp.eeprom_override & (~lpm_mask) - -meta.access_cmd = SXD_ACCESS_CMD_SET -rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc - -# Enable admin status after LPM settings -set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_UP) diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py new file mode 120000 index 000000000000..6a88bac30467 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfplpmset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py deleted file mode 100644 index 69fa2be614c2..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -# Check if SFP port number is provided -if len(sys.argv) < 2: - print "SFP module number or LPM is missed." - print "Usage: sfpreset.py " - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -# Get SFP module number -sfp_module = int(sys.argv[1]) - -# Get PMAOS -pmaos = ku_pmaos_reg() -pmaos.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET - -rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - -# Reset SFP -pmaos.rst = 1 -meta.access_cmd = SXD_ACCESS_CMD_SET -rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc -print "Reset flag is set" diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py new file mode 120000 index 000000000000..fef2063e3496 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfpreset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfpreset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py deleted file mode 100644 index 7fd349f6ead9..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py +++ /dev/null @@ -1,201 +0,0 @@ -# sfputil.py -# -# Platform-specific SFP transceiver interface for SONiC -# - -try: - import time - import subprocess - from sonic_sfp.sfputilbase import SfpUtilBase -except ImportError as e: - raise ImportError("%s - required module not found" % str(e)) - -# parameters for DB connection -REDIS_HOSTNAME = "localhost" -REDIS_PORT = 6379 -REDIS_TIMEOUT_USECS = 0 - -# parameters for SFP presence -SFP_STATUS_INSERTED = '1' - -class SfpUtil(SfpUtilBase): - """Platform-specific SfpUtil class""" - PORT_START = 0 - PORT_END = 21 - PORTS_IN_BLOCK = 22 - QSFP_PORT_START = 18 - EEPROM_OFFSET = 1 - - _port_to_eeprom_mapping = {} - - db_sel = None - db_sel_timeout = None - db_sel_object = None - db_sel_tbl = None - state_db = None - sfpd_status_tbl = None - - @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.PORTS_IN_BLOCK + 1) - - @property - def port_to_eeprom_mapping(self): - return self._port_to_eeprom_mapping - - def __init__(self): - eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" - - for x in range(0, self.port_end + 1): - self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) - - SfpUtilBase.__init__(self) - - - def get_presence(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - try: - reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) - except IOError as e: - print "Error: unable to open file: %s" % str(e) - return False - - content = reg_file.readline().rstrip() - - # content is a string with the qsfp status - if content == SFP_STATUS_INSERTED: - return True - - return False - - def get_low_power_mode(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmget.py {}".format(port_num) - - try: - output = subprocess.check_output(lpm_cmd, shell=True) - if 'LPM ON' in output: - return True - except subprocess.CalledProcessError as e: - print "Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - return False - - def set_low_power_mode(self, port_num, lpmode): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - curr_lpmode = self.get_low_power_mode(port_num) - if curr_lpmode == lpmode: - return True - - lpm = 'on' if lpmode else 'off' - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmset.py {} {}".format(port_num, lpm) - sfp_port_names = self.physical_to_logical[port_num] - - # Get port admin status - try: - enabled_ports = subprocess.check_output("ip link show up", shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to get ports status, err msg: {}".format(e.output) - return False - - port_to_disable = [] - for port in sfp_port_names: - if port in enabled_ports: - port_to_disable.append(port) - - # Disable ports before LPM settings - for port in port_to_disable: - try: - subprocess.check_output("ifconfig {} down".format(port), shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set admin status to DOWN for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) - return False - - time.sleep(3) - - # Set LPM - try: - subprocess.check_output(lpm_cmd, shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - # Enable ports after LPM settings - for port in port_to_disable: - try: - subprocess.check_output("ifconfig {} up".format(port), shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set admin status to UP for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) - return False - - return True - - def reset(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfpreset.py {}".format(port_num) - - try: - subprocess.check_output(lpm_cmd, shell=True) - return True - except subprocess.CalledProcessError as e: - print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - return False - - def get_transceiver_change_event(self, timeout=0): - phy_port_dict = {} - status = True - - if self.db_sel == None: - from swsscommon import swsscommon - self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, - REDIS_HOSTNAME, - REDIS_PORT, - REDIS_TIMEOUT_USECS) - - # Subscribe to state table for SFP change notifications - self.db_sel = swsscommon.Select() - self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') - self.db_sel.addSelectable(self.db_sel_tbl) - self.db_sel_timeout = swsscommon.Select.TIMEOUT - self.db_sel_object = swsscommon.Select.OBJECT - self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') - - # Check the liveness of mlnx-sfpd, if it failed, return false - keys = self.sfpd_status_tbl.getKeys() - if 'LIVENESS' not in keys: - return False, phy_port_dict - - (state, c) = self.db_sel.select(timeout) - if state == self.db_sel_timeout: - status = True - elif state != self.db_sel_object: - status = False - else: - (key, op, fvp) = self.db_sel_tbl.pop() - phy_port_dict[key] = op - - return status, phy_port_dict - diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py new file mode 120000 index 000000000000..45909b880fc9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfputil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py deleted file mode 100644 index 61e37b51db71..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -############################################################################# -# Mellanox -# -# Platform and model specific eeprom subclass, inherits from the base class, -# and provides the followings: -# - the eeprom format definition -# - specific encoder/decoder if there is special need -############################################################################# - -try: - import exceptions - import binascii - import time - import optparse - import warnings - import os - import sys - from sonic_eeprom import eeprom_base - from sonic_eeprom import eeprom_tlvinfo - import subprocess -except ImportError, e: - raise ImportError (str(e) + "- required module not found") - -class board(eeprom_tlvinfo.TlvInfoDecoder): - - _TLV_INFO_MAX_LEN = 256 - - def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/bsp/eeprom/vpd_info" - super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py new file mode 120000 index 000000000000..b4e2a6a61671 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/eeprom.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/eeprom.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmget.py deleted file mode 100644 index 170766e9bce4..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmget.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -# Check if SFP port number is provided -if len(sys.argv) < 2: - print "SFP module number is missed." - print "Usage: sfplpmget.py " - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -# Get SFP module number -sfp_module = int(sys.argv[1]) - -# Get MCION -mcion = ku_mcion_reg() -mcion.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET - -rc = sxd_access_reg_mcion(mcion, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_mcion failed, rc = %d" % rc - -# Get low power mode status -lpm_mask = 1 << 8 -lpm_status = (lpm_mask & mcion.module_status_bits) != 0 -print "LPM ON" if lpm_status else "LPM OFF" diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmget.py new file mode 120000 index 000000000000..2e84f435abd9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmget.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmset.py deleted file mode 100644 index 3f31af9f2944..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmset.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import time -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -def get_log_ports(handle, sfp_module): - port_attributes_list = new_sx_port_attributes_t_arr(64) - port_cnt_p = new_uint32_t_p() - uint32_t_p_assign(port_cnt_p, 64) - - rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) - assert rc == SX_STATUS_SUCCESS, "sx_api_port_device_get failed, rc = %d" % rc - - port_cnt = uint32_t_p_value(port_cnt_p) - 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: - log_port_list.append(port_attributes.log_port) - - return log_port_list - -def set_sfp_admin_status(handle, meta, sfp_module, sfp_log_port_list, admin_status): - # Get PMAOS - pmaos = ku_pmaos_reg() - pmaos.module = sfp_module - meta.access_cmd = SXD_ACCESS_CMD_GET - rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) - assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - - # Set admin status to PMAOS - pmaos.ase = 1 - pmaos.ee = 1 - pmaos.e = 2 - pmaos.rst = 0 - if admin_status == SX_PORT_ADMIN_STATUS_DOWN: - pmaos.admin_status = 2 - else: - pmaos.admin_status = 1 - - meta.access_cmd = SXD_ACCESS_CMD_SET - rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) - assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - -# Check if SFP port number is provided -if len(sys.argv) < 3: - print "SFP module number or LPM is missed." - print "Usage: sfplpmset.py " - sys.exit(errno.EINVAL) - -lpm_enable = None -if sys.argv[2] == 'on': - lpm_enable = True -elif sys.argv[2] == 'off': - lpm_enable = False -else: - print "Unrecognized LPM parameter. Please use or values" - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES); - -# Get SFP module and log ports number and LPM status -sfp_module = int(sys.argv[1]) -log_port_list = get_log_ports(handle, sfp_module) -if not log_port_list: - print "Failed to get log ports" - sys.exit(errno.EACCES) - -# Get PMMP -pmmp = ku_pmmp_reg() -pmmp.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET -rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc - -# Disable admin status before LPM settings -set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_DOWN) - -# Set low power mode status -lpm_mask = 1 << 8 -if lpm_enable: - pmmp.eeprom_override = pmmp.eeprom_override | lpm_mask -else: - pmmp.eeprom_override = pmmp.eeprom_override & (~lpm_mask) - -meta.access_cmd = SXD_ACCESS_CMD_SET -rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc - -# Enable admin status after LPM settings -set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_UP) diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmset.py new file mode 120000 index 000000000000..6a88bac30467 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfplpmset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfpreset.py deleted file mode 100644 index 69fa2be614c2..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfpreset.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -# Check if SFP port number is provided -if len(sys.argv) < 2: - print "SFP module number or LPM is missed." - print "Usage: sfpreset.py " - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -# Get SFP module number -sfp_module = int(sys.argv[1]) - -# Get PMAOS -pmaos = ku_pmaos_reg() -pmaos.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET - -rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - -# Reset SFP -pmaos.rst = 1 -meta.access_cmd = SXD_ACCESS_CMD_SET -rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc -print "Reset flag is set" diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfpreset.py new file mode 120000 index 000000000000..fef2063e3496 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfpreset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfpreset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py deleted file mode 100644 index a4cb383a8126..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py +++ /dev/null @@ -1,200 +0,0 @@ -# sfputil.py -# -# Platform-specific SFP transceiver interface for SONiC -# - -try: - import time - import subprocess - from sonic_sfp.sfputilbase import SfpUtilBase -except ImportError as e: - raise ImportError("%s - required module not found" % str(e)) - -# parameters for DB connection -REDIS_HOSTNAME = "localhost" -REDIS_PORT = 6379 -REDIS_TIMEOUT_USECS = 0 - -# parameters for SFP presence -SFP_STATUS_INSERTED = '1' - -class SfpUtil(SfpUtilBase): - """Platform-specific SfpUtil class""" - PORT_START = 0 - PORT_END = 15 - PORTS_IN_BLOCK = 16 - - EEPROM_OFFSET = 1 - - _port_to_eeprom_mapping = {} - - db_sel = None - db_sel_timeout = None - db_sel_object = None - db_sel_tbl = None - state_db = None - sfpd_status_tbl = None - - @property - def port_start(self): - return self.PORT_START - - @property - def port_end(self): - return self.PORT_END - - @property - def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) - - @property - def port_to_eeprom_mapping(self): - return self._port_to_eeprom_mapping - - def __init__(self): - eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" - - for x in range(0, self.port_end + 1): - self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) - - SfpUtilBase.__init__(self) - - def get_presence(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - try: - reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) - except IOError as e: - print "Error: unable to open file: %s" % str(e) - return False - - content = reg_file.readline().rstrip() - - # content is a string with the qsfp status - if content == SFP_STATUS_INSERTED: - return True - - return False - - def get_low_power_mode(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmget.py {}".format(port_num) - - try: - output = subprocess.check_output(lpm_cmd, shell=True) - if 'LPM ON' in output: - return True - except subprocess.CalledProcessError as e: - print "Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - return False - - def set_low_power_mode(self, port_num, lpmode): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - curr_lpmode = self.get_low_power_mode(port_num) - if curr_lpmode == lpmode: - return True - - lpm = 'on' if lpmode else 'off' - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmset.py {} {}".format(port_num, lpm) - sfp_port_names = self.physical_to_logical[port_num] - - # Get port admin status - try: - enabled_ports = subprocess.check_output("ip link show up", shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to get ports status, err msg: {}".format(e.output) - return False - - port_to_disable = [] - for port in sfp_port_names: - if port in enabled_ports: - port_to_disable.append(port) - - # Disable ports before LPM settings - for port in port_to_disable: - try: - subprocess.check_output("ifconfig {} down".format(port), shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set admin status to DOWN for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) - return False - - time.sleep(3) - - # Set LPM - try: - subprocess.check_output(lpm_cmd, shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - # Enable ports after LPM settings - for port in port_to_disable: - try: - subprocess.check_output("ifconfig {} up".format(port), shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set admin status to UP for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) - return False - - return True - - def reset(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfpreset.py {}".format(port_num) - - try: - subprocess.check_output(lpm_cmd, shell=True) - return True - except subprocess.CalledProcessError as e: - print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - return False - - def get_transceiver_change_event(self, timeout=0): - phy_port_dict = {} - status = True - - if self.db_sel == None: - from swsscommon import swsscommon - self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, - REDIS_HOSTNAME, - REDIS_PORT, - REDIS_TIMEOUT_USECS) - - # Subscribe to state table for SFP change notifications - self.db_sel = swsscommon.Select() - self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') - self.db_sel.addSelectable(self.db_sel_tbl) - self.db_sel_timeout = swsscommon.Select.TIMEOUT - self.db_sel_object = swsscommon.Select.OBJECT - self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') - - # Check the liveness of mlnx-sfpd, if it failed, return false - keys = self.sfpd_status_tbl.getKeys() - if 'LIVENESS' not in keys: - return False, phy_port_dict - - (state, c) = self.db_sel.select(timeout) - if state == self.db_sel_timeout: - status = True - elif state != self.db_sel_object: - status = False - else: - (key, op, fvp) = self.db_sel_tbl.pop() - phy_port_dict[key] = op - - return status, phy_port_dict - diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py new file mode 120000 index 000000000000..45909b880fc9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfputil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py deleted file mode 100644 index 61e37b51db71..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -############################################################################# -# Mellanox -# -# Platform and model specific eeprom subclass, inherits from the base class, -# and provides the followings: -# - the eeprom format definition -# - specific encoder/decoder if there is special need -############################################################################# - -try: - import exceptions - import binascii - import time - import optparse - import warnings - import os - import sys - from sonic_eeprom import eeprom_base - from sonic_eeprom import eeprom_tlvinfo - import subprocess -except ImportError, e: - raise ImportError (str(e) + "- required module not found") - -class board(eeprom_tlvinfo.TlvInfoDecoder): - - _TLV_INFO_MAX_LEN = 256 - - def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/bsp/eeprom/vpd_info" - super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py new file mode 120000 index 000000000000..b4e2a6a61671 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/eeprom.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/eeprom.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmget.py deleted file mode 100644 index 170766e9bce4..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmget.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -# Check if SFP port number is provided -if len(sys.argv) < 2: - print "SFP module number is missed." - print "Usage: sfplpmget.py " - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -# Get SFP module number -sfp_module = int(sys.argv[1]) - -# Get MCION -mcion = ku_mcion_reg() -mcion.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET - -rc = sxd_access_reg_mcion(mcion, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_mcion failed, rc = %d" % rc - -# Get low power mode status -lpm_mask = 1 << 8 -lpm_status = (lpm_mask & mcion.module_status_bits) != 0 -print "LPM ON" if lpm_status else "LPM OFF" diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmget.py new file mode 120000 index 000000000000..2e84f435abd9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmget.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmset.py deleted file mode 100644 index 3f31af9f2944..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmset.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import time -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -def get_log_ports(handle, sfp_module): - port_attributes_list = new_sx_port_attributes_t_arr(64) - port_cnt_p = new_uint32_t_p() - uint32_t_p_assign(port_cnt_p, 64) - - rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) - assert rc == SX_STATUS_SUCCESS, "sx_api_port_device_get failed, rc = %d" % rc - - port_cnt = uint32_t_p_value(port_cnt_p) - 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: - log_port_list.append(port_attributes.log_port) - - return log_port_list - -def set_sfp_admin_status(handle, meta, sfp_module, sfp_log_port_list, admin_status): - # Get PMAOS - pmaos = ku_pmaos_reg() - pmaos.module = sfp_module - meta.access_cmd = SXD_ACCESS_CMD_GET - rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) - assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - - # Set admin status to PMAOS - pmaos.ase = 1 - pmaos.ee = 1 - pmaos.e = 2 - pmaos.rst = 0 - if admin_status == SX_PORT_ADMIN_STATUS_DOWN: - pmaos.admin_status = 2 - else: - pmaos.admin_status = 1 - - meta.access_cmd = SXD_ACCESS_CMD_SET - rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) - assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - -# Check if SFP port number is provided -if len(sys.argv) < 3: - print "SFP module number or LPM is missed." - print "Usage: sfplpmset.py " - sys.exit(errno.EINVAL) - -lpm_enable = None -if sys.argv[2] == 'on': - lpm_enable = True -elif sys.argv[2] == 'off': - lpm_enable = False -else: - print "Unrecognized LPM parameter. Please use or values" - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES); - -# Get SFP module and log ports number and LPM status -sfp_module = int(sys.argv[1]) -log_port_list = get_log_ports(handle, sfp_module) -if not log_port_list: - print "Failed to get log ports" - sys.exit(errno.EACCES) - -# Get PMMP -pmmp = ku_pmmp_reg() -pmmp.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET -rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc - -# Disable admin status before LPM settings -set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_DOWN) - -# Set low power mode status -lpm_mask = 1 << 8 -if lpm_enable: - pmmp.eeprom_override = pmmp.eeprom_override | lpm_mask -else: - pmmp.eeprom_override = pmmp.eeprom_override & (~lpm_mask) - -meta.access_cmd = SXD_ACCESS_CMD_SET -rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc - -# Enable admin status after LPM settings -set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_UP) diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmset.py new file mode 120000 index 000000000000..6a88bac30467 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfplpmset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfpreset.py deleted file mode 100644 index 69fa2be614c2..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfpreset.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -# Check if SFP port number is provided -if len(sys.argv) < 2: - print "SFP module number or LPM is missed." - print "Usage: sfpreset.py " - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -# Get SFP module number -sfp_module = int(sys.argv[1]) - -# Get PMAOS -pmaos = ku_pmaos_reg() -pmaos.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET - -rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - -# Reset SFP -pmaos.rst = 1 -meta.access_cmd = SXD_ACCESS_CMD_SET -rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc -print "Reset flag is set" diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfpreset.py new file mode 120000 index 000000000000..fef2063e3496 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfpreset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfpreset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py deleted file mode 100644 index f437ce5f3679..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py +++ /dev/null @@ -1,201 +0,0 @@ -# sfputil.py -# -# Platform-specific SFP transceiver interface for SONiC -# - -try: - import time - import subprocess - from sonic_sfp.sfputilbase import SfpUtilBase -except ImportError as e: - raise ImportError("%s - required module not found" % str(e)) - -# parameters for DB connection -REDIS_HOSTNAME = "localhost" -REDIS_PORT = 6379 -REDIS_TIMEOUT_USECS = 0 - -# parameters for SFP presence -SFP_STATUS_INSERTED = '1' - -class SfpUtil(SfpUtilBase): - """Platform-specific SfpUtil class""" - PORT_START = 0 - PORT_END = 55 - PORTS_IN_BLOCK = 56 - QSFP_PORT_START = 48 - EEPROM_OFFSET = 1 - - _port_to_eeprom_mapping = {} - - db_sel = None - db_sel_timeout = None - db_sel_object = None - db_sel_tbl = None - state_db = None - sfpd_status_tbl = None - - @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.PORTS_IN_BLOCK + 1) - - @property - def port_to_eeprom_mapping(self): - return self._port_to_eeprom_mapping - - def __init__(self): - eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" - - for x in range(0, self.port_end + 1): - self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) - - SfpUtilBase.__init__(self) - - - def get_presence(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - try: - reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) - except IOError as e: - print "Error: unable to open file: %s" % str(e) - return False - - content = reg_file.readline().rstrip() - - # content is a string with the qsfp status - if content == SFP_STATUS_INSERTED: - return True - - return False - - def get_low_power_mode(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmget.py {}".format(port_num) - - try: - output = subprocess.check_output(lpm_cmd, shell=True) - if 'LPM ON' in output: - return True - except subprocess.CalledProcessError as e: - print "Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - return False - - def set_low_power_mode(self, port_num, lpmode): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - curr_lpmode = self.get_low_power_mode(port_num) - if curr_lpmode == lpmode: - return True - - lpm = 'on' if lpmode else 'off' - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmset.py {} {}".format(port_num, lpm) - sfp_port_names = self.physical_to_logical[port_num] - - # Get port admin status - try: - enabled_ports = subprocess.check_output("ip link show up", shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to get ports status, err msg: {}".format(e.output) - return False - - port_to_disable = [] - for port in sfp_port_names: - if port in enabled_ports: - port_to_disable.append(port) - - # Disable ports before LPM settings - for port in port_to_disable: - try: - subprocess.check_output("ifconfig {} down".format(port), shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set admin status to DOWN for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) - return False - - time.sleep(3) - - # Set LPM - try: - subprocess.check_output(lpm_cmd, shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - # Enable ports after LPM settings - for port in port_to_disable: - try: - subprocess.check_output("ifconfig {} up".format(port), shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set admin status to UP for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) - return False - - return True - - def reset(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfpreset.py {}".format(port_num) - - try: - subprocess.check_output(lpm_cmd, shell=True) - return True - except subprocess.CalledProcessError as e: - print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - return False - - def get_transceiver_change_event(self, timeout=0): - phy_port_dict = {} - status = True - - if self.db_sel == None: - from swsscommon import swsscommon - self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, - REDIS_HOSTNAME, - REDIS_PORT, - REDIS_TIMEOUT_USECS) - - # Subscribe to state table for SFP change notifications - self.db_sel = swsscommon.Select() - self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') - self.db_sel.addSelectable(self.db_sel_tbl) - self.db_sel_timeout = swsscommon.Select.TIMEOUT - self.db_sel_object = swsscommon.Select.OBJECT - self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') - - # Check the liveness of mlnx-sfpd, if it failed, return false - keys = self.sfpd_status_tbl.getKeys() - if 'LIVENESS' not in keys: - return False, phy_port_dict - - (state, c) = self.db_sel.select(timeout) - if state == self.db_sel_timeout: - status = True - elif state != self.db_sel_object: - status = False - else: - (key, op, fvp) = self.db_sel_tbl.pop() - phy_port_dict[key] = op - - return status, phy_port_dict - diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py new file mode 120000 index 000000000000..45909b880fc9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfputil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index 63ede4259058..98a7477aa601 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -18,13 +18,20 @@ # parameters for SFP presence SFP_STATUS_INSERTED = '1' +GET_HWSKU_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku" + +# 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, } +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): """Platform-specific SfpUtil class""" PORT_START = 0 - PORT_END = 31 - PORTS_IN_BLOCK = 32 - - EEPROM_OFFSET = 1 + QSFP_PORT_START = 0 + PORT_END = 0 + PORTS_IN_BLOCK = 0 + EEPROM_OFFSET = 0 _port_to_eeprom_mapping = {} @@ -34,6 +41,7 @@ class SfpUtil(SfpUtilBase): db_sel_tbl = None state_db = None sfpd_status_tbl = None + qsfp_sysfs_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/" @property def port_start(self): @@ -45,17 +53,28 @@ def port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping + def get_port_position_tuple_by_sku_name(self): + p = subprocess.Popen(GET_HWSKU_CMD, shell=True, stdout=subprocess.PIPE) + out, err = p.communicate() + position_tuple = port_position_tuple_list[hwsku_dict[out.rstrip('\n')]] + return position_tuple + def __init__(self): - eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" + port_position_tuple = self.get_port_position_tuple_by_sku_name() + self.PORT_START = port_position_tuple[0] + self.QSFP_PORT_START = port_position_tuple[1] + self.PORT_END = port_position_tuple[2] + self.PORTS_IN_BLOCK = port_position_tuple[3] + self.EEPROM_OFFSET = port_position_tuple[4] for x in range(0, self.port_end + 1): - self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + self._port_to_eeprom_mapping[x] = self.qsfp_sysfs_path + "qsfp{}".format(x + self.EEPROM_OFFSET) SfpUtilBase.__init__(self) @@ -65,7 +84,7 @@ def get_presence(self, port_num): return False try: - reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) + reg_file = open(self.qsfp_sysfs_path + "qsfp{}_status".format(port_num + 1)) except IOError as e: print "Error: unable to open file: %s" % str(e) return False diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py deleted file mode 100644 index 61e37b51db71..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -############################################################################# -# Mellanox -# -# Platform and model specific eeprom subclass, inherits from the base class, -# and provides the followings: -# - the eeprom format definition -# - specific encoder/decoder if there is special need -############################################################################# - -try: - import exceptions - import binascii - import time - import optparse - import warnings - import os - import sys - from sonic_eeprom import eeprom_base - from sonic_eeprom import eeprom_tlvinfo - import subprocess -except ImportError, e: - raise ImportError (str(e) + "- required module not found") - -class board(eeprom_tlvinfo.TlvInfoDecoder): - - _TLV_INFO_MAX_LEN = 256 - - def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/bsp/eeprom/vpd_info" - super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py new file mode 120000 index 000000000000..b4e2a6a61671 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/eeprom.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/eeprom.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmget.py deleted file mode 100644 index 170766e9bce4..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmget.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -# Check if SFP port number is provided -if len(sys.argv) < 2: - print "SFP module number is missed." - print "Usage: sfplpmget.py " - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -# Get SFP module number -sfp_module = int(sys.argv[1]) - -# Get MCION -mcion = ku_mcion_reg() -mcion.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET - -rc = sxd_access_reg_mcion(mcion, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_mcion failed, rc = %d" % rc - -# Get low power mode status -lpm_mask = 1 << 8 -lpm_status = (lpm_mask & mcion.module_status_bits) != 0 -print "LPM ON" if lpm_status else "LPM OFF" diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmget.py new file mode 120000 index 000000000000..2e84f435abd9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmget.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmset.py deleted file mode 100644 index 3f31af9f2944..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmset.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import time -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -def get_log_ports(handle, sfp_module): - port_attributes_list = new_sx_port_attributes_t_arr(64) - port_cnt_p = new_uint32_t_p() - uint32_t_p_assign(port_cnt_p, 64) - - rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) - assert rc == SX_STATUS_SUCCESS, "sx_api_port_device_get failed, rc = %d" % rc - - port_cnt = uint32_t_p_value(port_cnt_p) - 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: - log_port_list.append(port_attributes.log_port) - - return log_port_list - -def set_sfp_admin_status(handle, meta, sfp_module, sfp_log_port_list, admin_status): - # Get PMAOS - pmaos = ku_pmaos_reg() - pmaos.module = sfp_module - meta.access_cmd = SXD_ACCESS_CMD_GET - rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) - assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - - # Set admin status to PMAOS - pmaos.ase = 1 - pmaos.ee = 1 - pmaos.e = 2 - pmaos.rst = 0 - if admin_status == SX_PORT_ADMIN_STATUS_DOWN: - pmaos.admin_status = 2 - else: - pmaos.admin_status = 1 - - meta.access_cmd = SXD_ACCESS_CMD_SET - rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) - assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - -# Check if SFP port number is provided -if len(sys.argv) < 3: - print "SFP module number or LPM is missed." - print "Usage: sfplpmset.py " - sys.exit(errno.EINVAL) - -lpm_enable = None -if sys.argv[2] == 'on': - lpm_enable = True -elif sys.argv[2] == 'off': - lpm_enable = False -else: - print "Unrecognized LPM parameter. Please use or values" - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES); - -# Get SFP module and log ports number and LPM status -sfp_module = int(sys.argv[1]) -log_port_list = get_log_ports(handle, sfp_module) -if not log_port_list: - print "Failed to get log ports" - sys.exit(errno.EACCES) - -# Get PMMP -pmmp = ku_pmmp_reg() -pmmp.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET -rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc - -# Disable admin status before LPM settings -set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_DOWN) - -# Set low power mode status -lpm_mask = 1 << 8 -if lpm_enable: - pmmp.eeprom_override = pmmp.eeprom_override | lpm_mask -else: - pmmp.eeprom_override = pmmp.eeprom_override & (~lpm_mask) - -meta.access_cmd = SXD_ACCESS_CMD_SET -rc = sxd_access_reg_pmmp(pmmp, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmmp failed, rc = %d" % rc - -# Enable admin status after LPM settings -set_sfp_admin_status(handle, meta, sfp_module, log_port_list, SX_PORT_ADMIN_STATUS_UP) diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmset.py new file mode 120000 index 000000000000..6a88bac30467 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfplpmset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfpreset.py deleted file mode 100644 index 69fa2be614c2..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfpreset.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python - -import sys, errno -import os -from python_sdk_api.sxd_api import * -from python_sdk_api.sx_api import * - -# Check if SFP port number is provided -if len(sys.argv) < 2: - print "SFP module number or LPM is missed." - print "Usage: sfpreset.py " - sys.exit(errno.EINVAL) - -# Init SDK API -rc, handle = sx_api_open(None) -if (rc != SX_STATUS_SUCCESS): - print "Failed to open api handle.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -pid = os.getpid() -rc = sxd_access_reg_init(pid, None, 0) -if (rc != 0): - print "Failed to initializing register access.\nPlease check that SDK is running." - sys.exit(errno.EACCES) - -# Get SFP module number -sfp_module = int(sys.argv[1]) - -# Get PMAOS -pmaos = ku_pmaos_reg() -pmaos.module = sfp_module -meta = sxd_reg_meta_t() -meta.dev_id = 1 -meta.swid = 0 -meta.access_cmd = SXD_ACCESS_CMD_GET - -rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc - -# Reset SFP -pmaos.rst = 1 -meta.access_cmd = SXD_ACCESS_CMD_SET -rc = sxd_access_reg_pmaos(pmaos, meta, 1, None, None) -assert rc == SXD_STATUS_SUCCESS, "sxd_access_reg_pmaos failed, rc = %d" % rc -print "Reset flag is set" diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfpreset.py new file mode 120000 index 000000000000..fef2063e3496 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfpreset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfpreset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py deleted file mode 100644 index 63ede4259058..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py +++ /dev/null @@ -1,200 +0,0 @@ -# sfputil.py -# -# Platform-specific SFP transceiver interface for SONiC -# - -try: - import time - import subprocess - from sonic_sfp.sfputilbase import SfpUtilBase -except ImportError as e: - raise ImportError("%s - required module not found" % str(e)) - -# parameters for DB connection -REDIS_HOSTNAME = "localhost" -REDIS_PORT = 6379 -REDIS_TIMEOUT_USECS = 0 - -# parameters for SFP presence -SFP_STATUS_INSERTED = '1' - -class SfpUtil(SfpUtilBase): - """Platform-specific SfpUtil class""" - PORT_START = 0 - PORT_END = 31 - PORTS_IN_BLOCK = 32 - - EEPROM_OFFSET = 1 - - _port_to_eeprom_mapping = {} - - db_sel = None - db_sel_timeout = None - db_sel_object = None - db_sel_tbl = None - state_db = None - sfpd_status_tbl = None - - @property - def port_start(self): - return self.PORT_START - - @property - def port_end(self): - return self.PORT_END - - @property - def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) - - @property - def port_to_eeprom_mapping(self): - return self._port_to_eeprom_mapping - - def __init__(self): - eeprom_path = "/sys/devices/platform/i2c_mlxcpld.1/i2c-1/i2c-2/2-0048/qsfp{0}" - - for x in range(0, self.port_end + 1): - self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) - - SfpUtilBase.__init__(self) - - def get_presence(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - try: - reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1)) - except IOError as e: - print "Error: unable to open file: %s" % str(e) - return False - - content = reg_file.readline().rstrip() - - # content is a string with the qsfp status - if content == SFP_STATUS_INSERTED: - return True - - return False - - def get_low_power_mode(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmget.py {}".format(port_num) - - try: - output = subprocess.check_output(lpm_cmd, shell=True) - if 'LPM ON' in output: - return True - except subprocess.CalledProcessError as e: - print "Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - return False - - def set_low_power_mode(self, port_num, lpmode): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - curr_lpmode = self.get_low_power_mode(port_num) - if curr_lpmode == lpmode: - return True - - lpm = 'on' if lpmode else 'off' - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfplpmset.py {} {}".format(port_num, lpm) - sfp_port_names = self.physical_to_logical[port_num] - - # Get port admin status - try: - enabled_ports = subprocess.check_output("ip link show up", shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to get ports status, err msg: {}".format(e.output) - return False - - port_to_disable = [] - for port in sfp_port_names: - if port in enabled_ports: - port_to_disable.append(port) - - # Disable ports before LPM settings - for port in port_to_disable: - try: - subprocess.check_output("ifconfig {} down".format(port), shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set admin status to DOWN for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) - return False - - time.sleep(3) - - # Set LPM - try: - subprocess.check_output(lpm_cmd, shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - # Enable ports after LPM settings - for port in port_to_disable: - try: - subprocess.check_output("ifconfig {} up".format(port), shell=True) - except subprocess.CalledProcessError as e: - print "Error! Unable to set admin status to UP for {}, rc = {}, err msg: {}".format(port, e.returncode, e.output) - return False - - return True - - def reset(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - lpm_cmd = "docker exec syncd python /usr/share/sonic/platform/plugins/sfpreset.py {}".format(port_num) - - try: - subprocess.check_output(lpm_cmd, shell=True) - return True - except subprocess.CalledProcessError as e: - print "Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(port_num, e.returncode, e.output) - return False - - return False - - def get_transceiver_change_event(self, timeout=0): - phy_port_dict = {} - status = True - - if self.db_sel == None: - from swsscommon import swsscommon - self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, - REDIS_HOSTNAME, - REDIS_PORT, - REDIS_TIMEOUT_USECS) - - # Subscribe to state table for SFP change notifications - self.db_sel = swsscommon.Select() - self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY') - self.db_sel.addSelectable(self.db_sel_tbl) - self.db_sel_timeout = swsscommon.Select.TIMEOUT - self.db_sel_object = swsscommon.Select.OBJECT - self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') - - # Check the liveness of mlnx-sfpd, if it failed, return false - keys = self.sfpd_status_tbl.getKeys() - if 'LIVENESS' not in keys: - return False, phy_port_dict - - (state, c) = self.db_sel.select(timeout) - if state == self.db_sel_timeout: - status = True - elif state != self.db_sel_object: - status = False - else: - (key, op, fvp) = self.db_sel_tbl.pop() - phy_port_dict[key] = op - - return status, phy_port_dict - diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py new file mode 120000 index 000000000000..45909b880fc9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfputil.py \ No newline at end of file From 86189ca78645d67880e67565b7b71acbd39ef77e Mon Sep 17 00:00:00 2001 From: Sagar Balani Date: Wed, 24 Oct 2018 06:27:04 -0700 Subject: [PATCH 1704/1833] [barefoot]: Move bfn asic drivers out of platform package (#30) (#2183) * Move bfn asic drivers out of platform package (#30) * Move bfn asic drivers out of platform package * Change debian pkg name for bfn modules * Change license file * Fix build breakage due to dependency issue * Minor changes to debian bld files (#31) --- platform/barefoot/bfn-modules.mk | 10 + platform/barefoot/bfn-modules/LICENSE | 37 + platform/barefoot/bfn-modules/MAINTAINERS | 4 + platform/barefoot/bfn-modules/README.md | 2 + .../barefoot/bfn-modules/debian/changelog | 5 + platform/barefoot/bfn-modules/debian/compat | 1 + platform/barefoot/bfn-modules/debian/control | 12 + .../barefoot/bfn-modules/debian/copyright | 15 + platform/barefoot/bfn-modules/debian/files | 1 + platform/barefoot/bfn-modules/debian/rules | 30 + .../modules/Makefile | 0 .../barefoot/bfn-modules/modules/bf_ioctl.h | 49 + .../modules/bf_kdrv.c | 138 +- .../modules/bf_tun.c | 0 platform/barefoot/one-image.mk | 3 +- .../barefoot/platform-modules-bfn-montara.mk | 4 +- platform/barefoot/platform-modules-bfn.mk | 4 +- platform/barefoot/rules.mk | 1 + .../MAINTAINERS | 2 +- .../README.md | 2 +- .../debian/changelog | 8 +- .../debian/control | 4 +- .../debian/rules | 15 +- .../modules/Makefile | 1 - .../modules/bf_kdrv.c | 1 - .../modules/bf_tun.c | 1 - .../debian/changelog | 8 +- .../sonic-platform-modules-bfn/debian/control | 4 +- .../sonic-platform-modules-bfn/debian/rules | 15 +- .../modules/bf_kdrv.c | 1254 -------- .../modules/Makefile | 2 - .../modules/bf_tun.c | 2616 ----------------- 32 files changed, 328 insertions(+), 3921 deletions(-) create mode 100644 platform/barefoot/bfn-modules.mk create mode 100644 platform/barefoot/bfn-modules/LICENSE create mode 100644 platform/barefoot/bfn-modules/MAINTAINERS create mode 100644 platform/barefoot/bfn-modules/README.md create mode 100644 platform/barefoot/bfn-modules/debian/changelog create mode 100644 platform/barefoot/bfn-modules/debian/compat create mode 100644 platform/barefoot/bfn-modules/debian/control create mode 100644 platform/barefoot/bfn-modules/debian/copyright create mode 100644 platform/barefoot/bfn-modules/debian/files create mode 100755 platform/barefoot/bfn-modules/debian/rules rename platform/barefoot/{sonic-platform-modules-bfn => bfn-modules}/modules/Makefile (100%) create mode 100644 platform/barefoot/bfn-modules/modules/bf_ioctl.h rename platform/barefoot/{sonic-platform-modules-wnc-osw1800 => bfn-modules}/modules/bf_kdrv.c (89%) rename platform/barefoot/{sonic-platform-modules-bfn => bfn-modules}/modules/bf_tun.c (100%) delete mode 120000 platform/barefoot/sonic-platform-modules-bfn-montara/modules/Makefile delete mode 120000 platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_kdrv.c delete mode 120000 platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_tun.c delete mode 100644 platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c delete mode 100644 platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c diff --git a/platform/barefoot/bfn-modules.mk b/platform/barefoot/bfn-modules.mk new file mode 100644 index 000000000000..67b7fa924da1 --- /dev/null +++ b/platform/barefoot/bfn-modules.mk @@ -0,0 +1,10 @@ +# BFN Platform modules + +VERSION = 1.0 + +BFN_MODULE = bfn-modules_$(VERSION)_amd64.deb +$(BFN_MODULE)_SRC_PATH = $(PLATFORM_PATH)/bfn-modules +$(BFN_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_DPKG_DEBS += $(BFN_MODULE) + +SONIC_STRETCH_DEBS += $(BFN_MODULE) diff --git a/platform/barefoot/bfn-modules/LICENSE b/platform/barefoot/bfn-modules/LICENSE new file mode 100644 index 000000000000..e9d73a1c63cc --- /dev/null +++ b/platform/barefoot/bfn-modules/LICENSE @@ -0,0 +1,37 @@ +BAREFOOT NETWORKS CONFIDENTIAL & PROPRIETARY + + Copyright (c) 2015-2016 Barefoot Networks, Inc. + + All Rights Reserved. + + NOTICE: All information contained herein is, and remains the property of + Barefoot Networks, Inc. and its suppliers, if any. The intellectual and + technical concepts contained herein are proprietary to Barefoot Networks, + Inc. + and its suppliers and may be covered by U.S. and Foreign Patents, patents in + process, and are protected by trade secret or copyright law. + Dissemination of this information or reproduction of this material is + strictly forbidden unless prior written permission is obtained from + Barefoot Networks, Inc. + + No warranty, explicit or implicit is provided, unless granted under a + written agreement with Barefoot Networks, Inc. + + +GPL LICENSE SUMMARY + + Copyright(c) 2015 Barefoot Networks. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the... + + diff --git a/platform/barefoot/bfn-modules/MAINTAINERS b/platform/barefoot/bfn-modules/MAINTAINERS new file mode 100644 index 000000000000..b9c62ce01546 --- /dev/null +++ b/platform/barefoot/bfn-modules/MAINTAINERS @@ -0,0 +1,4 @@ +# This file describes the maintainers for sonic-platform-modules-bfn +# See the SONiC project governance document for more information + +Mailinglist = sonicproject@googlegroups.com diff --git a/platform/barefoot/bfn-modules/README.md b/platform/barefoot/bfn-modules/README.md new file mode 100644 index 000000000000..6c47cbed2a5d --- /dev/null +++ b/platform/barefoot/bfn-modules/README.md @@ -0,0 +1,2 @@ +# bfn-modules +Device drivers for support of BFN platform for the SONiC project diff --git a/platform/barefoot/bfn-modules/debian/changelog b/platform/barefoot/bfn-modules/debian/changelog new file mode 100644 index 000000000000..85ab933da304 --- /dev/null +++ b/platform/barefoot/bfn-modules/debian/changelog @@ -0,0 +1,5 @@ +bfn-modules (1.0) unstable; urgency=low + + * Initial release + + -- Support Mon, 22 Oct 2018 11:11:11 -0800 diff --git a/platform/barefoot/bfn-modules/debian/compat b/platform/barefoot/bfn-modules/debian/compat new file mode 100644 index 000000000000..45a4fb75db86 --- /dev/null +++ b/platform/barefoot/bfn-modules/debian/compat @@ -0,0 +1 @@ +8 diff --git a/platform/barefoot/bfn-modules/debian/control b/platform/barefoot/bfn-modules/debian/control new file mode 100644 index 000000000000..7e0ae5cf5003 --- /dev/null +++ b/platform/barefoot/bfn-modules/debian/control @@ -0,0 +1,12 @@ +Source: bfn-modules +Section: main +Priority: extra +Maintainer: support +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: bfn-modules +Architecture: amd64 +Depends: linux-image-4.9.0-7-amd64 +Description: kernel modules for bfn asic for mmap + diff --git a/platform/barefoot/bfn-modules/debian/copyright b/platform/barefoot/bfn-modules/debian/copyright new file mode 100644 index 000000000000..ade42b7aa75a --- /dev/null +++ b/platform/barefoot/bfn-modules/debian/copyright @@ -0,0 +1,15 @@ +Provides linux kernel driver for BF PCIe devices + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/barefoot/bfn-modules/debian/files b/platform/barefoot/bfn-modules/debian/files new file mode 100644 index 000000000000..cffeb8a7d9c9 --- /dev/null +++ b/platform/barefoot/bfn-modules/debian/files @@ -0,0 +1 @@ +bfn-modules_1.0_amd64.deb main extra diff --git a/platform/barefoot/bfn-modules/debian/rules b/platform/barefoot/bfn-modules/debian/rules new file mode 100755 index 000000000000..c588b075e5e7 --- /dev/null +++ b/platform/barefoot/bfn-modules/debian/rules @@ -0,0 +1,30 @@ +#!/usr/bin/make -f + +export INSTALL_MOD_DIR:=extra + +PACKAGE_NAME := bfn-modules +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MODULE_SRC := $(shell pwd)/modules + +%: + dh $@ + +override_dh_auto_build: + make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + +override_dh_auto_install: + dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR) + cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) + dh_installdirs -p$(PACKAGE_NAME) usr/local/bin + +override_dh_usrlocal: + +override_dh_pysupport: + +override_dh_clean: + dh_clean + rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd + rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order + rm -rf $(MODULE_SRC)/.tmp_versions + diff --git a/platform/barefoot/sonic-platform-modules-bfn/modules/Makefile b/platform/barefoot/bfn-modules/modules/Makefile similarity index 100% rename from platform/barefoot/sonic-platform-modules-bfn/modules/Makefile rename to platform/barefoot/bfn-modules/modules/Makefile diff --git a/platform/barefoot/bfn-modules/modules/bf_ioctl.h b/platform/barefoot/bfn-modules/modules/bf_ioctl.h new file mode 100644 index 000000000000..e14716f50fa3 --- /dev/null +++ b/platform/barefoot/bfn-modules/modules/bf_ioctl.h @@ -0,0 +1,49 @@ +/******************************************************************************* + * BAREFOOT NETWORKS CONFIDENTIAL & PROPRIETARY + * + * Copyright (c) 2018-2018 Barefoot Networks, Inc. + * + * NOTICE: All information contained herein is, and remains the property of + * Barefoot Networks, Inc. and its suppliers, if any. The intellectual and + * technical concepts contained herein are proprietary to Barefoot Networks, + * Inc. + * and its suppliers and may be covered by U.S. and Foreign Patents, patents in + * process, and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from + * Barefoot Networks, Inc. + * + * No warranty, explicit or implicit is provided, unless granted under a + * written agreement with Barefoot Networks, Inc. + * + * $Id: $ + * + ******************************************************************************/ + +#ifndef _BF_IOCTL_H_ +#define _BF_IOCTL_H_ + +#ifdef __KERNEL__ +#include +#else +#include + +#ifndef phys_addr_t +typedef uint64_t phys_addr_t; +#endif + +#endif /* __KERNEL__ */ + +#define BF_IOC_MAGIC 'b' + +typedef struct bf_dma_bus_map_s +{ + phys_addr_t phy_addr; + void *dma_addr; + size_t size; +} bf_dma_bus_map_t; + +#define BF_IOCMAPDMAADDR _IOWR(BF_IOC_MAGIC, 0, bf_dma_bus_map_t) +#define BF_IOCUNMAPDMAADDR _IOW(BF_IOC_MAGIC, 0, bf_dma_bus_map_t) + +#endif /* _BF_IOCTL_H_ */ diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c b/platform/barefoot/bfn-modules/modules/bf_kdrv.c similarity index 89% rename from platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c rename to platform/barefoot/bfn-modules/modules/bf_kdrv.c index fd66ad09493a..a9e8e65f968b 100644 --- a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c +++ b/platform/barefoot/bfn-modules/modules/bf_kdrv.c @@ -58,6 +58,8 @@ #include #include #include +#include +#include "bf_ioctl.h" #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) #include @@ -74,12 +76,18 @@ #endif /* TBD: Need to build with CONFIG_PCI_MSI */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) +extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); +extern int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); +#else extern int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); extern int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, int minvec, int maxvec); +#endif #define PCI_VENDOR_ID_BF 0x1d1c #define TOFINO_DEV_ID_A0 0x01 #define TOFINO_DEV_ID_B0 0x10 +#define TOFINO2_DEV_ID_A0 0x0100 #ifndef PCI_MSIX_ENTRY_SIZE #define PCI_MSIX_ENTRY_SIZE 16 @@ -671,10 +679,62 @@ static ssize_t bf_write(struct file *filep, const char __user *buf, return ret ? ret : sizeof(s32); } +static long bf_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) +{ + struct bf_listener *listener = filep->private_data; + struct bf_pci_dev *bfdev = listener->bfdev; + bf_dma_bus_map_t dma_map; + void *addr = (void __user *)arg; + dma_addr_t dma_hndl; + + if (!bfdev || !addr) { + return EFAULT; + } + switch(cmd) { + case BF_IOCMAPDMAADDR: + if (access_ok(VERIFY_WRITE, addr, sizeof(bf_dma_bus_map_t))) { + if (copy_from_user(&dma_map, addr, sizeof(bf_dma_bus_map_t))) { + return EFAULT; + } + if (!dma_map.phy_addr || !dma_map.size) { + return EFAULT; + } + dma_hndl = dma_map_single(&bfdev->pdev->dev, phys_to_virt(dma_map.phy_addr), dma_map.size, DMA_BIDIRECTIONAL); + if (dma_mapping_error(&bfdev->pdev->dev, dma_hndl)) { + return EFAULT; + } + dma_map.dma_addr = (void *)dma_hndl; + if (copy_to_user(addr, &dma_map, sizeof(bf_dma_bus_map_t))) { + return EFAULT; + } + } else { + return EFAULT; + } + break; + case BF_IOCUNMAPDMAADDR: + if (access_ok(VERIFY_READ, addr, sizeof(bf_dma_bus_map_t))) { + if (copy_from_user(&dma_map, addr, sizeof(bf_dma_bus_map_t))) { + return EFAULT; + } + if (!dma_map.dma_addr || !dma_map.size) { + return EFAULT; + } + dma_unmap_single(&bfdev->pdev->dev, (dma_addr_t)dma_map.dma_addr, dma_map.size, DMA_BIDIRECTIONAL); + } else { + return EFAULT; + } + break; + default: + return EINVAL; + } + return 0; +} + static const struct file_operations bf_fops = { .owner = THIS_MODULE, .open = bf_open, .release = bf_release, + .unlocked_ioctl = bf_ioctl, .read = bf_read, .write = bf_write, .mmap = bf_mmap, @@ -883,11 +943,35 @@ static inline struct device *pci_dev_to_dev(struct pci_dev *pdev) return &pdev->dev; } +static void bf_disable_int_dma(struct bf_pci_dev *bfdev) { + u8 *bf_base_addr, i; + u32 *bf_addr; + volatile u32 val; + + /* maskinterrupts and DMA */ + bf_base_addr = (bfdev->info.mem[0].internal_addr); + /* return if called before mmap */ + if (!bf_base_addr) { + return; + } + /* mask interrupt at shadow level */ + bf_addr = (u32 *)((u8 *)bf_base_addr + 0xc0); + for (i = 0; i < 16; i++) { + *bf_addr = 0xffffffff; + bf_addr++; + } + /* mask DMA */ + bf_addr = (u32 *)((u8 *)bf_base_addr + 0x14); + val = *bf_addr; + val &= 0xfffffffeUL; + *bf_addr = val; +} + static int bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct bf_pci_dev *bfdev; - int err, pci_use_highmem; + int err; int i, num_irq; memset(bf_global, 0, sizeof(bf_global)); @@ -933,7 +1017,6 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (!dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64)) && !dma_set_coherent_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64))) { - pci_use_highmem = 1; } else { err = dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(32)); if (err) { @@ -945,7 +1028,6 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto fail_release_iomem; } } - pci_use_highmem = 0; } /* enable pci error reporting */ @@ -960,6 +1042,8 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) */ pci_enable_pcie_error_reporting(pdev); + bf_disable_int_dma(bfdev); + /* enable bus mastering on the device */ pci_set_master(pdev); @@ -981,6 +1065,19 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) { bfdev->info.msix_entries[i].entry= i; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) + num_irq = pci_enable_msix(pdev, bfdev->info.msix_entries, + BF_MSIX_ENTRY_CNT); + if (num_irq == 0) { + dev_dbg(&pdev->dev, "using MSI-X"); + bfdev->info.num_irq = BF_MSIX_ENTRY_CNT; + bfdev->info.irq = bfdev->info.msix_entries[0].vector; + bfdev->mode = BF_INTR_MODE_MSIX; + printk(KERN_DEBUG "bf using %d MSIX irq from %ld\n", num_irq, + bfdev->info.irq); + break; + } +#else num_irq = pci_enable_msix_range(pdev, bfdev->info.msix_entries, BF_MSIX_ENTRY_CNT, BF_MSIX_ENTRY_CNT); if (num_irq == BF_MSIX_ENTRY_CNT) { @@ -999,8 +1096,22 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) printk(KERN_ERR "bf error allocating MSIX vectors. Trying MSI...\n"); /* and, fall back to MSI */ } +#endif /* LINUX_VERSION_CODE */ /* ** intentional no-break */ case BF_INTR_MODE_MSI: +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) + num_irq = pci_enable_msi_block(pdev, BF_MSI_ENTRY_CNT); + /* we must get requested number of MSI vectors enabled */ + if (num_irq == 0) { + dev_dbg(&pdev->dev, "using MSI"); + bfdev->info.num_irq = BF_MSI_ENTRY_CNT; + bfdev->info.irq = pdev->irq; + bfdev->mode = BF_INTR_MODE_MSI; + printk(KERN_DEBUG "bf using %d MSI irq from %ld\n", bfdev->info.num_irq, + bfdev->info.irq); + break; + } +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) num_irq = pci_enable_msi_range(pdev, BF_MSI_ENTRY_CNT, BF_MSI_ENTRY_CNT); if (num_irq > 0) { dev_dbg(&pdev->dev, "using MSI"); @@ -1011,6 +1122,19 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) bfdev->info.irq); break; } +#else + num_irq = pci_alloc_irq_vectors_affinity(pdev, BF_MSI_ENTRY_CNT, + BF_MSI_ENTRY_CNT, PCI_IRQ_MSI | PCI_IRQ_AFFINITY, NULL); + if (num_irq > 0) { + dev_dbg(&pdev->dev, "using MSI"); + bfdev->info.num_irq = num_irq; + bfdev->info.irq = pci_irq_vector(pdev, 0); + bfdev->mode = BF_INTR_MODE_MSI; + printk(KERN_DEBUG "bf using %d MSI irq from %ld\n", bfdev->info.num_irq, + bfdev->info.irq); + break; + } +#endif /* LINUX_VERSION_CODE */ #endif /* CONFIG_PCI_MSI */ /* fall back to Legacy Interrupt, intentional no-break */ @@ -1075,12 +1199,14 @@ bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) return err; } + static void bf_pci_remove(struct pci_dev *pdev) { struct bf_pci_dev *bfdev = pci_get_drvdata(pdev); struct bf_listener *cur_listener; + bf_disable_int_dma(bfdev); bf_unregister_device(bfdev); if (bfdev->mode == BF_INTR_MODE_MSIX) { pci_disable_msix(pdev); @@ -1189,9 +1315,10 @@ bf_config_intr_mode(char *intr_str) bf_intr_mode_default = BF_INTR_MODE_LEGACY; pr_info("Use legacy interrupt\n"); } else { - pr_info("Error: bad parameter - %s\n", intr_str); - return -EINVAL; + bf_intr_mode_default = BF_INTR_MODE_NONE; + pr_info(" No Interrupt \n"); } + return 0; } @@ -1199,6 +1326,7 @@ bf_config_intr_mode(char *intr_str) static const struct pci_device_id bf_pci_tbl[] = { {PCI_VDEVICE(BF, TOFINO_DEV_ID_A0), 0}, {PCI_VDEVICE(BF, TOFINO_DEV_ID_B0), 0}, + {PCI_VDEVICE(BF, TOFINO2_DEV_ID_A0), 0}, /* required last entry */ { .device = 0 } }; diff --git a/platform/barefoot/sonic-platform-modules-bfn/modules/bf_tun.c b/platform/barefoot/bfn-modules/modules/bf_tun.c similarity index 100% rename from platform/barefoot/sonic-platform-modules-bfn/modules/bf_tun.c rename to platform/barefoot/bfn-modules/modules/bf_tun.c diff --git a/platform/barefoot/one-image.mk b/platform/barefoot/one-image.mk index 490712f6818e..fc4e197cd5cb 100644 --- a/platform/barefoot/one-image.mk +++ b/platform/barefoot/one-image.mk @@ -3,7 +3,8 @@ SONIC_ONE_IMAGE = sonic-barefoot.bin $(SONIC_ONE_IMAGE)_MACHINE = barefoot $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_INSTALLS += $(BFN_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_INSTALLS += $(BFN_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(WNC_OSW1800_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9180_32X_PLATFORM_MODULE) diff --git a/platform/barefoot/platform-modules-bfn-montara.mk b/platform/barefoot/platform-modules-bfn-montara.mk index c1b401ad3fb7..d089218c9454 100644 --- a/platform/barefoot/platform-modules-bfn-montara.mk +++ b/platform/barefoot/platform-modules-bfn-montara.mk @@ -1,10 +1,10 @@ # BFN Platform modules -BFN_MONTARA_PLATFORM_MODULE_VERSION = 1.0 +BFN_MONTARA_PLATFORM_MODULE_VERSION = 1.1 export BFN_MONTARA_PLATFORM_MODULE_VERSION -BFN_MONTARA_PLATFORM_MODULE = platform-modules-bfn-montara_$(BFN_MONTARA_PLATFORM_MODULE_VERSION)_amd64.deb +BFN_MONTARA_PLATFORM_MODULE = sonic-platform-modules-bfn-montara_$(BFN_MONTARA_PLATFORM_MODULE_VERSION)_amd64.deb $(BFN_MONTARA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-bfn-montara $(BFN_MONTARA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(BFN_MONTARA_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_32x-r0 diff --git a/platform/barefoot/platform-modules-bfn.mk b/platform/barefoot/platform-modules-bfn.mk index 5c3df75c1b88..1caa92c8f2b3 100644 --- a/platform/barefoot/platform-modules-bfn.mk +++ b/platform/barefoot/platform-modules-bfn.mk @@ -1,10 +1,10 @@ # BFN Platform modules -BFN_PLATFORM_MODULE_VERSION = 1.0 +BFN_PLATFORM_MODULE_VERSION = 1.1 export BFN_PLATFORM_MODULE_VERSION -BFN_PLATFORM_MODULE = platform-modules-bfn_$(BFN_PLATFORM_MODULE_VERSION)_amd64.deb +BFN_PLATFORM_MODULE = sonic-platform-modules-bfn_$(BFN_PLATFORM_MODULE_VERSION)_amd64.deb $(BFN_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-bfn $(BFN_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(BFN_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_65x-r0 diff --git a/platform/barefoot/rules.mk b/platform/barefoot/rules.mk index 2ee49adb8a0f..4937b747c2ed 100644 --- a/platform/barefoot/rules.mk +++ b/platform/barefoot/rules.mk @@ -15,6 +15,7 @@ include $(PLATFORM_PATH)/docker-ptf-bfn.mk include $(PLATFORM_PATH)/bfn-platform.mk include $(PLATFORM_PATH)/bfn-platform-wnc.mk include $(PLATFORM_PATH)/bfn-platform-ingrasys.mk +include $(PLATFORM_PATH)/bfn-modules.mk SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT) \ $(DOCKER_FPM) diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS b/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS index ed64c7824250..6396065f4ab0 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS @@ -1,3 +1,3 @@ -# This file describes the maintainers for sonic-platform-modules-bfn +# This file describes the maintainers for sonic-platform-modules-bfn-montara # See the SONiC project governance document for more information Mailinglist = sonicproject@googlegroups.com diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/README.md b/platform/barefoot/sonic-platform-modules-bfn-montara/README.md index 5dc055a1d9c3..ac1fffb7dc43 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/README.md +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/README.md @@ -1,2 +1,2 @@ -# sonic-platform-modules-bfn +# sonic-platform-modules-bfn-montara Device drivers for support of BFN platform for the SONiC project diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/changelog b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/changelog index 80c1d96d3445..07fbc7081419 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/changelog +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/changelog @@ -1,4 +1,10 @@ -platform-modules-bfn-montara (1.0) unstable; urgency=low +sonic-platform-modules-bfn-montara (1.1) unstable; urgency=low + + * Remove bfn asic kernel modules from platform package + + -- Support Mon, 22 Oct 2018 15:40:00 -0800 + +sonic-platform-modules-bfn-montara (1.0) unstable; urgency=low * Initial release diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control index 589f03d2f484..d3a1f02495a5 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control @@ -1,11 +1,11 @@ -Source: platform-modules-bfn-montara +Source: sonic-platform-modules-bfn-montara Section: main Priority: extra Maintainer: Support Build-Depends: debhelper (>= 8.0.0), bzip2 Standards-Version: 3.9.3 -Package: platform-modules-bfn-montara +Package: sonic-platform-modules-bfn-montara Architecture: amd64 Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules index e48edc304904..479f7f489687 100755 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules @@ -1,22 +1,12 @@ #!/usr/bin/make -f -export INSTALL_MOD_DIR:=extra - -PACKAGE_NAME := platform-modules-bfn-montara -KVERSION ?= $(shell uname -r) -KERNEL_SRC := /lib/modules/$(KVERSION) -MODULE_SRC := $(shell pwd)/modules +PACKAGE_NAME := sonic-platform-modules-bfn-montara SCRIPT_SRC := $(shell pwd)/scripts %: dh $@ -override_dh_auto_build: - make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) - override_dh_auto_install: - dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR) - cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) dh_installdirs -p$(PACKAGE_NAME) usr/local/bin cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin @@ -26,7 +16,4 @@ override_dh_pysupport: override_dh_clean: dh_clean - rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd - rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order - rm -rf $(MODULE_SRC)/.tmp_versions diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/modules/Makefile b/platform/barefoot/sonic-platform-modules-bfn-montara/modules/Makefile deleted file mode 120000 index d394585dd286..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/modules/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../sonic-platform-modules-bfn/modules/Makefile \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_kdrv.c b/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_kdrv.c deleted file mode 120000 index 959d811823c0..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_kdrv.c +++ /dev/null @@ -1 +0,0 @@ -../../sonic-platform-modules-bfn/modules/bf_kdrv.c \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_tun.c b/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_tun.c deleted file mode 120000 index ea380c3075a7..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/modules/bf_tun.c +++ /dev/null @@ -1 +0,0 @@ -../../sonic-platform-modules-bfn/modules/bf_tun.c \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/changelog b/platform/barefoot/sonic-platform-modules-bfn/debian/changelog index d5df34112672..984cc0dbfb69 100644 --- a/platform/barefoot/sonic-platform-modules-bfn/debian/changelog +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/changelog @@ -1,4 +1,10 @@ -platform-modules-bfn (1.0) unstable; urgency=low +sonic-platform-modules-bfn (1.1) unstable; urgency=low + + * Remove bfn asic kernel modules from platform package + + -- Support Mon, 22 Oct 2018 15:40:00 -0800 + +sonic-platform-modules-bfn (1.0) unstable; urgency=low * Initial release diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/control b/platform/barefoot/sonic-platform-modules-bfn/debian/control index d4fd702298d3..fe82a2336d4e 100644 --- a/platform/barefoot/sonic-platform-modules-bfn/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/control @@ -1,11 +1,11 @@ -Source: platform-modules-bfn +Source: sonic-platform-modules-bfn Section: main Priority: extra Maintainer: support Build-Depends: debhelper (>= 8.0.0), bzip2 Standards-Version: 3.9.3 -Package: platform-modules-bfn +Package: sonic-platform-modules-bfn Architecture: amd64 Depends: linux-image-4.9.0-7-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/rules b/platform/barefoot/sonic-platform-modules-bfn/debian/rules index 73aa5d84da0b..69946c33571e 100755 --- a/platform/barefoot/sonic-platform-modules-bfn/debian/rules +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/rules @@ -1,22 +1,12 @@ #!/usr/bin/make -f -export INSTALL_MOD_DIR:=extra - -PACKAGE_NAME := platform-modules-bfn -KVERSION ?= $(shell uname -r) -KERNEL_SRC := /lib/modules/$(KVERSION) -MODULE_SRC := $(shell pwd)/modules +PACKAGE_NAME := sonic-platform-modules-bfn SCRIPT_SRC := $(shell pwd)/scripts %: dh $@ -override_dh_auto_build: - make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) - override_dh_auto_install: - dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR) - cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) dh_installdirs -p$(PACKAGE_NAME) usr/local/bin cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin @@ -26,7 +16,4 @@ override_dh_pysupport: override_dh_clean: dh_clean - rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd - rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order - rm -rf $(MODULE_SRC)/.tmp_versions diff --git a/platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c b/platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c deleted file mode 100644 index fd66ad09493a..000000000000 --- a/platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c +++ /dev/null @@ -1,1254 +0,0 @@ -/******************************************************************************* - * BAREFOOT NETWORKS CONFIDENTIAL & PROPRIETARY - * - * Copyright (c) 2015-2016 Barefoot Networks, Inc. - - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains the property of - * Barefoot Networks, Inc. and its suppliers, if any. The intellectual and - * technical concepts contained herein are proprietary to Barefoot Networks, - * Inc. - * and its suppliers and may be covered by U.S. and Foreign Patents, patents in - * process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material is - * strictly forbidden unless prior written permission is obtained from - * Barefoot Networks, Inc. - * - * No warranty, explicit or implicit is provided, unless granted under a - * written agreement with Barefoot Networks, Inc. - * - * $Id: $ - * - ******************************************************************************/ -/** - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2015 Barefoot Networks. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the... - * - **/ - -/* bf_drv kernel module - * - * This is kernel mode driver for Tofino chip. - * Provides user space mmap service and user space "wait for interrupt" - * and "enable interrupt" services. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - #include -#else - #include -#endif - -#include -#include -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) -//#error unsupported linux kernel version -#endif - -/* TBD: Need to build with CONFIG_PCI_MSI */ -extern int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); -extern int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, int minvec, int maxvec); - -#define PCI_VENDOR_ID_BF 0x1d1c -#define TOFINO_DEV_ID_A0 0x01 -#define TOFINO_DEV_ID_B0 0x10 - -#ifndef PCI_MSIX_ENTRY_SIZE -#define PCI_MSIX_ENTRY_SIZE 16 -#define PCI_MSIX_ENTRY_LOWER_ADDR 0 -#define PCI_MSIX_ENTRY_UPPER_ADDR 4 -#define PCI_MSIX_ENTRY_DATA 8 -#define PCI_MSIX_ENTRY_VECTOR_CTRL 12 -#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 -#endif - -#define BF_CLASS_NAME "bf" -#define BF_MAX_DEVICE_CNT 256 -#define BF_INTR_MODE_NONE_NAME "none" -#define BF_INTR_MODE_LEGACY_NAME "legacy" -#define BF_INTR_MODE_MSI_NAME "msi" -#define BF_INTR_MODE_MSIX_NAME "msix" -#define BF_MAX_BAR_MAPS 6 -#define BF_MSIX_ENTRY_CNT 128 /* TBD make it 512 */ -#define BF_MSI_ENTRY_CNT 2 - -/* interrupt mode */ -enum bf_intr_mode { - BF_INTR_MODE_NONE = 0, - BF_INTR_MODE_LEGACY, - BF_INTR_MODE_MSI, - BF_INTR_MODE_MSIX -}; - -/* device memory */ -struct bf_dev_mem { - const char *name; - phys_addr_t addr; - resource_size_t size; - void __iomem *internal_addr; -}; - -struct bf_listener { - struct bf_pci_dev *bfdev; - s32 event_count[BF_MSIX_ENTRY_CNT]; - int minor; - struct bf_listener *next; -}; - -/* device information */ -struct bf_dev_info { - struct module *owner; - struct device *dev; - int minor; - atomic_t event[BF_MSIX_ENTRY_CNT]; - wait_queue_head_t wait; - const char *version; - struct bf_dev_mem mem[BF_MAX_BAR_MAPS]; - struct msix_entry *msix_entries; - long irq; /* first irq vector */ - int num_irq; /* number of irq vectors */ - unsigned long irq_flags;/* sharable ?? */ - int pci_error_state; /* was there a pci bus error */ -}; - -/* cookie to be passed to IRQ handler, useful especially with MSIX */ -struct bf_int_vector { - struct bf_pci_dev *bf_dev; - int int_vec_offset; -}; - - -/** - * A structure describing the private information for a BF pcie device. - */ -struct bf_pci_dev { - struct bf_dev_info info; - struct pci_dev *pdev; - enum bf_intr_mode mode; - u8 instance; - char name[16]; - struct bf_int_vector bf_int_vec[BF_MSIX_ENTRY_CNT]; - struct bf_listener *listener_head; /* head of a singly linked list of - listeners */ -}; - -/* Keep any global information here that must survive even after the - * bf_pci_dev is free-ed up. - */ -struct bf_global { - struct bf_pci_dev *bfdev ; - struct cdev *bf_cdev; - struct fasync_struct *async_queue; -}; - -static int bf_major; -static int bf_minor[BF_MAX_DEVICE_CNT] = {0}; -static struct class *bf_class = NULL; -static char *intr_mode = NULL; -static enum bf_intr_mode bf_intr_mode_default = BF_INTR_MODE_MSI; -static spinlock_t bf_nonisr_lock; -/* dev->minor should index into this array */ -static struct bf_global bf_global[BF_MAX_DEVICE_CNT]; - -static void bf_add_listener(struct bf_pci_dev *bfdev, - struct bf_listener *listener) -{ - struct bf_listener **cur_listener = &bfdev->listener_head; - - if (!listener) { - return; - } - spin_lock(&bf_nonisr_lock); - - while (*cur_listener) { - cur_listener = &((*cur_listener)->next); - } - *cur_listener = listener; - listener->next = NULL; - - spin_unlock(&bf_nonisr_lock); -} - -static void bf_remove_listener(struct bf_pci_dev *bfdev, - struct bf_listener *listener) -{ - struct bf_listener **cur_listener = &bfdev->listener_head; - - /* in case of certain error conditions, this function might be called after bf_pci_remove() - */ - if (!bfdev || !listener) { - return; - } - spin_lock(&bf_nonisr_lock); - - if (*cur_listener == listener) { - *cur_listener = listener->next; - } else { - while (*cur_listener) { - if ((*cur_listener)->next == listener) { - (*cur_listener)->next = listener->next; - break; - } - cur_listener = &((*cur_listener)->next); - } - listener->next = NULL; - } - - spin_unlock(&bf_nonisr_lock); -} - -/* a pool of minor numbers is maintained */ -/* return the first available minor number */ -static int bf_get_next_minor_no(int *minor) -{ - int i; - - spin_lock(&bf_nonisr_lock); - for(i = 0; i < BF_MAX_DEVICE_CNT; i++) { - if (bf_minor[i] == 0) { - *minor = i; - bf_minor[i] = 1; /* mark it as taken */ - spin_unlock(&bf_nonisr_lock); - return 0; - } - } - *minor = -1; - spin_unlock(&bf_nonisr_lock); - return -1; -} - -/* return a minor number back to the pool for recycling */ -static int bf_return_minor_no(int minor) -{ - int err; - - spin_lock(&bf_nonisr_lock); - if (bf_minor[minor] == 0) { /* was already returned */ - err = -1; /* don't change anything, but return error */ - } else { - bf_minor[minor] = 0; /* mark it as available */ - err = 0; - } - spin_unlock(&bf_nonisr_lock); - return err; -} - -static inline struct bf_pci_dev *bf_get_pci_dev(struct bf_dev_info *info) -{ - return container_of(info, struct bf_pci_dev, info); -} - -/* - * It masks the msix on/off of generating MSI-X messages. - */ -static void -bf_msix_mask_irq(struct msi_desc *desc, int32_t state) -{ - u32 mask_bits = desc->masked; - unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + - PCI_MSIX_ENTRY_VECTOR_CTRL; - - if (state != 0) - mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT; - else - mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT; - - if (mask_bits != desc->masked) { - writel(mask_bits, desc->mask_base + offset); - readl(desc->mask_base); - desc->masked = mask_bits; - } -} - -/** - * irqcontrol can be used to disable/enable interrupt from user space processes. - * - * @param bf_dev - * pointer to bf_pci_dev - * @param irq_state - * state value. 1 to enable interrupt, 0 to disable interrupt. - * - * @return - * - On success, 0. - * - On failure, a negative value. - */ -static int -bf_pci_irqcontrol(struct bf_pci_dev *bfdev, s32 irq_state) -{ - struct pci_dev *pdev = bfdev->pdev; - - pci_cfg_access_lock(pdev); - if (bfdev->mode == BF_INTR_MODE_LEGACY) - pci_intx(pdev, !!irq_state); - - else if (bfdev->mode == BF_INTR_MODE_MSIX) { - struct msi_desc *desc; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) - list_for_each_entry(desc, &pdev->msi_list, list) - bf_msix_mask_irq(desc, irq_state); -#else - for_each_pci_msi_entry(desc, pdev) - bf_msix_mask_irq(desc, irq_state); -#endif - } - pci_cfg_access_unlock(pdev); - - return 0; -} - -/** - * interrupt handler which will check if the interrupt is from the right - * device. If so, disable it here and will be enabled later. - */ -static irqreturn_t bf_pci_irqhandler(int irq, struct bf_pci_dev *bfdev) -{ - /* Legacy mode need to mask in hardware */ - if (bfdev->mode == BF_INTR_MODE_LEGACY && - !pci_check_and_mask_intx(bfdev->pdev)) - return IRQ_NONE; - - /* NOTE : if bfdev->info.pci_error_state == 1, then do not access the - * device and return IRQ_NOTHANDLED. - */ - /* Message signal mode, no share IRQ and automasked */ - return IRQ_HANDLED; -} - -/* Remap pci resources described by bar #pci_bar */ -static int -bf_pci_setup_iomem(struct pci_dev *dev, struct bf_dev_info *info, - int n, int pci_bar, const char *name) -{ - unsigned long addr, len; - void *internal_addr; - - if (sizeof(info->mem) / sizeof(info->mem[0]) <= n) - return -EINVAL; - - addr = pci_resource_start(dev, pci_bar); - len = pci_resource_len(dev, pci_bar); - if (addr == 0 || len == 0) - return -1; - internal_addr = pci_ioremap_bar(dev, pci_bar); - if (internal_addr == NULL) - return -1; - info->mem[n].name = name; - info->mem[n].addr = addr; - info->mem[n].internal_addr = internal_addr; - info->mem[n].size = len; - return 0; -} - -/* Unmap previously ioremap'd resources */ -static void -bf_pci_release_iomem(struct bf_dev_info *info) -{ - int i; - - for (i = 0; i < BF_MAX_BAR_MAPS; i++) { - if (info->mem[i].internal_addr) - iounmap(info->mem[i].internal_addr); - } -} - -static int -bf_setup_bars(struct pci_dev *dev, struct bf_dev_info *info) -{ - int i, iom, ret; - unsigned long flags; - static const char *bar_names[BF_MAX_BAR_MAPS] = { - "BAR0", "BAR1", "BAR2", "BAR3", "BAR4", "BAR5", - }; - - iom = 0; - - for (i = 0; i < BF_MAX_BAR_MAPS; i++) { - if (pci_resource_len(dev, i) != 0 && - pci_resource_start(dev, i) != 0) { - flags = pci_resource_flags(dev, i); - if (flags & IORESOURCE_MEM) { - ret = bf_pci_setup_iomem(dev, info, iom, i, bar_names[i]); - if (ret != 0) - return ret; - iom++; - } - } - } - return (iom != 0) ? ret : -ENOENT; -} - -static irqreturn_t bf_interrupt(int irq, void *bfdev_id) -{ - struct bf_pci_dev *bfdev = ((struct bf_int_vector *)bfdev_id)->bf_dev; - int vect_off = ((struct bf_int_vector *)bfdev_id)->int_vec_offset; - - irqreturn_t ret = bf_pci_irqhandler(irq, bfdev); - - if (ret == IRQ_HANDLED) - atomic_inc(&(bfdev->info.event[vect_off])); - - return ret; -} - -static unsigned int bf_poll(struct file *filep, poll_table *wait) -{ - struct bf_listener *listener = (struct bf_listener *)filep->private_data; - struct bf_pci_dev *bfdev = listener->bfdev; - int i; - - if (!bfdev) { - return -ENODEV; - } - if (!bfdev->info.irq) - return -EIO; - - poll_wait(filep, &bfdev->info.wait, wait); - - for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) - if (listener->event_count[i] != atomic_read(&bfdev->info.event[i])) - return POLLIN | POLLRDNORM; - return 0; -} - -static int bf_find_mem_index(struct vm_area_struct *vma) -{ - struct bf_pci_dev *bfdev = vma->vm_private_data; - if (vma->vm_pgoff < BF_MAX_BAR_MAPS) { - if (bfdev->info.mem[vma->vm_pgoff].size == 0) - return -1; - return (int)vma->vm_pgoff; - } - return -1; -} - -static const struct vm_operations_struct bf_physical_vm_ops = { -#ifdef CONFIG_HAVE_IOREMAP_PROT - .access = generic_access_phys, -#endif -}; - -static int bf_mmap_physical(struct vm_area_struct *vma) -{ - struct bf_pci_dev *bfdev = vma->vm_private_data; - int bar = bf_find_mem_index(vma); - struct bf_dev_mem *mem; - if (bar < 0) - return -EINVAL; - - mem = bfdev->info.mem + bar; - - if (mem->addr & ~PAGE_MASK) - return -ENODEV; - if (vma->vm_end - vma->vm_start > mem->size) - return -EINVAL; - - vma->vm_ops = &bf_physical_vm_ops; - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - - /* - * We cannot use the vm_iomap_memory() helper here, - * because vma->vm_pgoff is the map index we looked - * up above in bf_find_mem_index(), rather than an - * actual page offset into the mmap. - * - * So we just do the physical mmap without a page - * offset. - */ - return remap_pfn_range(vma, vma->vm_start, mem->addr >> PAGE_SHIFT, - vma->vm_end - vma->vm_start, vma->vm_page_prot); -} - -static int bf_mmap(struct file *filep, struct vm_area_struct *vma) -{ - struct bf_listener *listener = filep->private_data; - struct bf_pci_dev *bfdev = listener->bfdev; - int bar; - unsigned long requested_pages, actual_pages; - - if (!bfdev) { - return -ENODEV; - } - if (vma->vm_end < vma->vm_start) - return -EINVAL; - - vma->vm_private_data = bfdev; - - bar = bf_find_mem_index(vma); - if (bar < 0) - return -EINVAL; - - requested_pages = vma_pages(vma); - actual_pages = ((bfdev->info.mem[bar].addr & ~PAGE_MASK) - + bfdev->info.mem[bar].size + PAGE_SIZE -1) >> PAGE_SHIFT; - if (requested_pages > actual_pages) - return -EINVAL; - - return bf_mmap_physical(vma); -} - -static int bf_fasync(int fd, struct file *filep, int mode) -{ - int minor; - - if (!filep->private_data) { - return (-EINVAL); - } - minor = ((struct bf_listener *)filep->private_data)->minor; - if (minor >= BF_MAX_DEVICE_CNT) { - return (-EINVAL); - } - if (mode == 0 && &bf_global[minor].async_queue == NULL) { - return 0; /* nothing to do */ - } - return (fasync_helper(fd, filep, mode, &bf_global[minor].async_queue)); -} - -static int bf_open(struct inode *inode, struct file *filep) -{ - struct bf_pci_dev *bfdev; - struct bf_listener *listener; - int i; - - bfdev = bf_global[iminor(inode)].bfdev; - listener = kmalloc(sizeof(*listener), GFP_KERNEL); - if (listener) { - listener->bfdev = bfdev; - listener->minor = bfdev->info.minor; - listener->next = NULL; - bf_add_listener(bfdev, listener); - for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) - listener->event_count[i] = atomic_read(&bfdev->info.event[i]); - filep->private_data = listener; - return 0; - } else { - return(-ENOMEM); - } -} - -static int bf_release(struct inode *inode, struct file *filep) -{ - struct bf_listener *listener = filep->private_data; - - bf_fasync(-1, filep, 0); /* empty any process id in the notification list */ - if (listener->bfdev) { - bf_remove_listener(listener->bfdev, listener); - } - kfree(listener); - return 0; -} - -/* user space support: make read() system call after poll() of select() */ -static ssize_t bf_read(struct file *filep, char __user *buf, - size_t count, loff_t *ppos) -{ - struct bf_listener *listener = filep->private_data; - struct bf_pci_dev *bfdev = listener->bfdev; - int retval, event_count[BF_MSIX_ENTRY_CNT]; - int i, mismatch_found = 0; /* OR of per vector mismatch */ - unsigned char cnt_match[BF_MSIX_ENTRY_CNT]; /* per vector mismatch */ - - if (!bfdev) { - return -ENODEV; - } - /* irq must be setup for read() to work */ - if (!bfdev->info.irq) - return -EIO; - - /* ensure that there is enough space on user buffer for the given interrupt - * mode */ - if (bfdev->mode == BF_INTR_MODE_MSIX) { - if (count < sizeof(s32)*BF_MSIX_ENTRY_CNT) - return -EINVAL; - count = sizeof(s32)*BF_MSIX_ENTRY_CNT; - } else if (bfdev->mode == BF_INTR_MODE_MSI) { - if (count < sizeof(s32)*BF_MSI_ENTRY_CNT) - return -EINVAL; - count = sizeof(s32)*BF_MSI_ENTRY_CNT; - } else { - if (count < sizeof(s32)) - return -EINVAL; - count = sizeof(s32); - } - - do { - set_current_state(TASK_INTERRUPTIBLE); - - for (i = 0; i < (count/sizeof(s32)); i++) { - event_count[i] = atomic_read(&(bfdev->info.event[i])); - if (event_count[i] != listener->event_count[i]) { - mismatch_found |= 1; - cnt_match[i] = 1; - } else { - event_count[i] = 0; - cnt_match[i] = 0; - } - } - if (mismatch_found) { - __set_current_state(TASK_RUNNING); - if (copy_to_user(buf, &event_count, count)) - retval = -EFAULT; - else { /* adjust the listener->event_count; */ - for (i = 0 ; i < (count/sizeof(s32)); i++) { - if (cnt_match[i]) { - listener->event_count[i] = event_count[i]; - } - } - retval = count; - } - break; - } - - if (filep->f_flags & O_NONBLOCK) { - retval = -EAGAIN; - break; - } - - if (signal_pending(current)) { - retval = -ERESTARTSYS; - break; - } - schedule(); - } while (1); - - __set_current_state(TASK_RUNNING); - - return retval; -} - -/* user space is supposed to call this after it is done with interrupt - * processing - */ -static ssize_t bf_write(struct file *filep, const char __user *buf, - size_t count, loff_t *ppos) -{ - struct bf_listener *listener = filep->private_data; - struct bf_pci_dev *bfdev = listener->bfdev; - ssize_t ret; - s32 int_en; - - if (!bfdev || !bfdev->info.irq) - return -EIO; - - if (count != sizeof(s32)) - return -EINVAL; - - if (copy_from_user(&int_en, buf, count)) - return -EFAULT; - - /* clear pci_error_state */ - bfdev->info.pci_error_state = 0; - - ret = bf_pci_irqcontrol(bfdev, int_en); - - return ret ? ret : sizeof(s32); -} - -static const struct file_operations bf_fops = { - .owner = THIS_MODULE, - .open = bf_open, - .release = bf_release, - .read = bf_read, - .write = bf_write, - .mmap = bf_mmap, - .poll = bf_poll, - .fasync = bf_fasync, -}; - -static int bf_major_init(struct bf_pci_dev *bfdev, int minor) -{ - struct cdev *cdev; - static const char name[] = "bf"; - dev_t bf_dev = 0; - int result; - - result = alloc_chrdev_region(&bf_dev, 0, BF_MAX_DEVICE_CNT, name); - if (result) - return result; - - result = -ENOMEM; - cdev = cdev_alloc(); - if (!cdev) { - goto fail_dev_add; - } - cdev->ops = &bf_fops; - cdev->owner = THIS_MODULE; - kobject_set_name(&cdev->kobj, "%s", name); - result = cdev_add(cdev, bf_dev, BF_MAX_DEVICE_CNT); - - if (result) - goto fail_dev_add; - - bf_major = MAJOR(bf_dev); - bf_global[minor].bf_cdev = cdev; - return 0; - -fail_dev_add: - unregister_chrdev_region(bf_dev, BF_MAX_DEVICE_CNT); - return result; -} - -static void bf_major_cleanup(struct bf_pci_dev *bfdev, int minor) -{ - unregister_chrdev_region(MKDEV(bf_major, 0), BF_MAX_DEVICE_CNT); - cdev_del(bf_global[minor].bf_cdev); -} - -static int bf_init_cdev(struct bf_pci_dev *bfdev, int minor) -{ - int ret; - ret = bf_major_init(bfdev, minor); - if (ret) - return ret; - - bf_class = class_create(THIS_MODULE, BF_CLASS_NAME); - if (!bf_class) { - printk(KERN_ERR "create_class failed for bf_dev\n"); - ret = -ENODEV; - goto err_class_register; - } - return 0; - -err_class_register: - bf_major_cleanup(bfdev, minor); - return ret; -} - -static void bf_remove_cdev(struct bf_pci_dev *bfdev) -{ - class_destroy(bf_class); - bf_major_cleanup(bfdev, bfdev->info.minor); -} - - -/** - * bf_register_device - register a new userspace mem device - * @parent: parent device - * @bfdev: bf pci device - * - * returns zero on success or a negative error code. - */ -int bf_register_device(struct device *parent, struct bf_pci_dev *bfdev) -{ - struct bf_dev_info *info = &bfdev->info; - int i, j, ret = 0; - int minor; - - if (!parent || !info || !info->version) - return -EINVAL; - - init_waitqueue_head(&info->wait); - - for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) { - atomic_set(&info->event[i], 0); - } - - if (bf_get_next_minor_no(&minor)) { - return -EINVAL; - } - - ret = bf_init_cdev(bfdev, minor); - if (ret) { - printk(KERN_ERR "BF: device cdev creation failed\n"); - return ret; - } - - info->dev = device_create(bf_class, parent, - MKDEV(bf_major, minor), bfdev, - "bf%d", minor); - if (!info->dev) { - printk(KERN_ERR "BF: device creation failed\n"); - return -ENODEV; - } - - info->minor = minor; - - /* bind ISRs and request interrupts */ - if (info->irq && (bfdev->mode != BF_INTR_MODE_NONE)) { - /* - * Note that we deliberately don't use devm_request_irq - * here. The parent module can unregister the UIO device - * and call pci_disable_msi, which requires that this - * irq has been freed. However, the device may have open - * FDs at the time of unregister and therefore may not be - * freed until they are released. - */ - if (bfdev->mode == BF_INTR_MODE_LEGACY) { - ret = request_irq(info->irq, bf_interrupt, - info->irq_flags, bfdev->name, - (void *)&(bfdev->bf_int_vec[0])); - if (ret) { - printk(KERN_ERR "bf failed to request legacy irq %ld error %d\n", - info->irq, ret); - return ret; - } - printk(KERN_NOTICE "BF allocating legacy int vector %ld\n", info->irq); - } else if (bfdev->mode == BF_INTR_MODE_MSIX) { - for (i = 0; i < info->num_irq; i++) { - ret = request_irq(info->msix_entries[i].vector, bf_interrupt, - info->irq_flags, bfdev->name, - (void *)&(bfdev->bf_int_vec[i])); - if (ret) { - /* undo all other previous bindings */ - printk(KERN_ERR "bf failed to request MSIX ret %d itr %d\n", ret, i); - for (j = i - 1; j >= 0; j--) { - free_irq(info->msix_entries[j].vector, - (void *)&(bfdev->bf_int_vec[j])); - } - return ret; - } - } - printk(KERN_NOTICE "BF allocating %d MSIx vectors from %ld\n", - info->num_irq, info->irq); - } else if (bfdev->mode == BF_INTR_MODE_MSI) { - for (i = 0; i < info->num_irq; i++) { - ret = request_irq(info->irq + i, bf_interrupt, - info->irq_flags, bfdev->name, - (void *)&(bfdev->bf_int_vec[i])); - if (ret) { - /* undo all other previous bindings */ - printk(KERN_ERR "bf failed to request MSI ret %d itr %d\n", ret, i); - for (j = i - 1; j >= 0; j--) { - free_irq(info->irq + j, (void *)&(bfdev->bf_int_vec[j])); - } - return ret; - } - } - printk(KERN_NOTICE "BF allocating %d MSI vectors from %ld\n", - info->num_irq, info->irq); - } - } - return 0; -} - -/** - * bf_unregister_device - register a new userspace mem device - * @bfdev: bf pci device - * - * returns none - */ -void bf_unregister_device(struct bf_pci_dev *bfdev) -{ - struct bf_dev_info *info = &bfdev->info; - int i; - - if (info->irq) { - if (bfdev->mode == BF_INTR_MODE_LEGACY) { - free_irq(info->irq, (void *)&(bfdev->bf_int_vec[0])); - } else if (bfdev->mode == BF_INTR_MODE_MSIX) { - for (i = 0; i < info->num_irq; i++) { - free_irq(info->msix_entries[i].vector, (void *)&(bfdev->bf_int_vec[i])); - } - } else if (bfdev->mode == BF_INTR_MODE_MSI) { - for (i = 0; i < info->num_irq; i++) { - free_irq(info->irq + i, (void *)&(bfdev->bf_int_vec[i])); - } - } - } - device_destroy(bf_class, MKDEV(bf_major, info->minor)); - bf_remove_cdev(bfdev); - bf_return_minor_no(info->minor); - return; -} - -static inline struct device *pci_dev_to_dev(struct pci_dev *pdev) -{ - return &pdev->dev; -} - -static int -bf_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) -{ - struct bf_pci_dev *bfdev; - int err, pci_use_highmem; - int i, num_irq; - - memset(bf_global, 0, sizeof(bf_global)); - - bfdev = kzalloc(sizeof(struct bf_pci_dev), GFP_KERNEL); - if (!bfdev) - return -ENOMEM; - - /* init the cookies to be passed to ISRs */ - for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) { - bfdev->bf_int_vec[i].int_vec_offset = i; - bfdev->bf_int_vec[i].bf_dev = bfdev; - } - - /* initialize intr_mode to none */ - bfdev->mode = BF_INTR_MODE_NONE; - - /* clear pci_error_state */ - bfdev->info.pci_error_state = 0; - - /* - * enable device - */ - err = pci_enable_device(pdev); - if (err != 0) { - dev_err(&pdev->dev, "Cannot enable PCI device\n"); - goto fail_free; - } - - /* - * reserve device's PCI memory regions for use by this - * module - */ - err = pci_request_regions(pdev, "bf_umem"); - if (err != 0) { - dev_err(&pdev->dev, "Cannot request regions\n"); - goto fail_pci_disable; - } - /* remap IO memory */ - err = bf_setup_bars(pdev, &bfdev->info); - if (err != 0) - goto fail_release_iomem; - - if (!dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64)) && - !dma_set_coherent_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(64))) { - pci_use_highmem = 1; - } else { - err = dma_set_mask(pci_dev_to_dev(pdev), DMA_BIT_MASK(32)); - if (err) { - err = dma_set_coherent_mask(pci_dev_to_dev(pdev), - DMA_BIT_MASK(32)); - if (err) { - dev_err(pci_dev_to_dev(pdev), "No usable DMA " - "configuration, aborting\n"); - goto fail_release_iomem; - } - } - pci_use_highmem = 0; - } - - /* enable pci error reporting */ - /* for the current kernel version, kernel config must have set the followings: - * CONFIG_PCIEPORTBUS=y and CONFIG_PCIEAER = y - * we have pci_error_handlers defined that gets invoked by kernel AER module - * upon detecting the pcie error on this device's addresses. - * However, there seems no way that AER would pass the offending addresses - * to the callback functions. AER logs the error messages on the console. - * This driver's calback function send the SIGIO signal to the user space - * to indicate the error condition. - */ - pci_enable_pcie_error_reporting(pdev); - - /* enable bus mastering on the device */ - pci_set_master(pdev); - - /* fill in bfdev info */ - bfdev->info.version = "0.2"; - bfdev->info.owner = THIS_MODULE; - bfdev->pdev = pdev; - - switch (bf_intr_mode_default) { -#ifdef CONFIG_PCI_MSI - case BF_INTR_MODE_MSIX: - /* Only 1 msi-x vector needed */ - bfdev->info.msix_entries = kcalloc(BF_MSIX_ENTRY_CNT, - sizeof(struct msix_entry), GFP_KERNEL); - if (!bfdev->info.msix_entries) { - err = -ENOMEM; - goto fail_clear_pci_master; - } - for (i = 0; i < BF_MSIX_ENTRY_CNT; i++) { - bfdev->info.msix_entries[i].entry= i; - } - num_irq = pci_enable_msix_range(pdev, bfdev->info.msix_entries, - BF_MSIX_ENTRY_CNT, BF_MSIX_ENTRY_CNT); - if (num_irq == BF_MSIX_ENTRY_CNT) { - dev_dbg(&pdev->dev, "using MSI-X"); - bfdev->info.num_irq = num_irq; - bfdev->info.irq = bfdev->info.msix_entries[0].vector; - bfdev->mode = BF_INTR_MODE_MSIX; - printk(KERN_DEBUG "bf using %d MSIX irq from %ld\n", num_irq, - bfdev->info.irq); - break; - } else { - if (num_irq) - pci_disable_msix(pdev); - kfree(bfdev->info.msix_entries); - bfdev->info.msix_entries = NULL; - printk(KERN_ERR "bf error allocating MSIX vectors. Trying MSI...\n"); - /* and, fall back to MSI */ - } - /* ** intentional no-break */ - case BF_INTR_MODE_MSI: - num_irq = pci_enable_msi_range(pdev, BF_MSI_ENTRY_CNT, BF_MSI_ENTRY_CNT); - if (num_irq > 0) { - dev_dbg(&pdev->dev, "using MSI"); - bfdev->info.num_irq = num_irq; - bfdev->info.irq = pdev->irq; - bfdev->mode = BF_INTR_MODE_MSI; - printk(KERN_DEBUG "bf using %d MSI irq from %ld\n", bfdev->info.num_irq, - bfdev->info.irq); - break; - } -#endif /* CONFIG_PCI_MSI */ - /* fall back to Legacy Interrupt, intentional no-break */ - - case BF_INTR_MODE_LEGACY: - if (pci_intx_mask_supported(pdev)) { - dev_dbg(&pdev->dev, "using INTX"); - bfdev->info.irq_flags = IRQF_SHARED; - bfdev->info.irq = pdev->irq; - bfdev->mode = BF_INTR_MODE_LEGACY; - printk(KERN_DEBUG "bf using LEGACY irq %ld\n", bfdev->info.irq); - break; - } - dev_notice(&pdev->dev, "PCI INTx mask not supported\n"); - /* fall back to no Interrupt, intentional no-break */ - case BF_INTR_MODE_NONE: - bfdev->info.irq = 0; - bfdev->info.num_irq = 0; - bfdev->mode = BF_INTR_MODE_NONE; - break; - - default: - dev_err(&pdev->dev, "invalid IRQ mode %u", bf_intr_mode_default); - err = -EINVAL; - goto fail_clear_pci_master; - } - - pci_set_drvdata(pdev, bfdev); - sprintf(bfdev->name, "bf_%d", bfdev->info.minor); - /* register bf driver */ - err = bf_register_device(&pdev->dev, bfdev); - if (err != 0) - goto fail_release_irq; - - bf_global[bfdev->info.minor].async_queue = NULL; - bf_global[bfdev->info.minor].bfdev = bfdev; - - dev_info(&pdev->dev, "bf device %d registered with irq %ld\n", - bfdev->instance, bfdev->info.irq); - printk(KERN_ALERT "bf probe ok\n"); - return 0; - -fail_release_irq: - pci_set_drvdata(pdev, NULL); - if (bfdev->mode == BF_INTR_MODE_MSIX) { - pci_disable_msix(bfdev->pdev); - kfree(bfdev->info.msix_entries); - bfdev->info.msix_entries = NULL; - } - else if (bfdev->mode == BF_INTR_MODE_MSI) - pci_disable_msi(bfdev->pdev); -fail_clear_pci_master: - pci_clear_master(pdev); -fail_release_iomem: - bf_pci_release_iomem(&bfdev->info); - pci_release_regions(pdev); -fail_pci_disable: - pci_disable_device(pdev); -fail_free: - kfree(bfdev); - - printk(KERN_ERR "bf probe not ok\n"); - return err; -} - -static void -bf_pci_remove(struct pci_dev *pdev) -{ - struct bf_pci_dev *bfdev = pci_get_drvdata(pdev); - struct bf_listener *cur_listener; - - bf_unregister_device(bfdev); - if (bfdev->mode == BF_INTR_MODE_MSIX) { - pci_disable_msix(pdev); - kfree(bfdev->info.msix_entries); - bfdev->info.msix_entries = NULL; - } - else if (bfdev->mode == BF_INTR_MODE_MSI) - pci_disable_msi(pdev); - pci_clear_master(pdev); - bf_pci_release_iomem(&bfdev->info); - pci_release_regions(pdev); - pci_disable_pcie_error_reporting(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - bf_global[bfdev->info.minor].bfdev = NULL; - /* existing filep structures in open file(s) must be informed that - * bf_pci_dev is no longer valid */ - spin_lock(&bf_nonisr_lock); - cur_listener = bfdev->listener_head; - while (cur_listener) { - cur_listener->bfdev = NULL; - cur_listener = cur_listener->next; - } - spin_unlock(&bf_nonisr_lock); - kfree(bfdev); -} - -/** - * bf_pci_error_detected - called when PCI error is detected - * @pdev: Pointer to PCI device - * @state: The current pci connection state - * - * called when root complex detects pci error associated with the device - */ -static pci_ers_result_t bf_pci_error_detected(struct pci_dev *pdev, - pci_channel_state_t state) -{ - struct bf_pci_dev *bfdev = pci_get_drvdata(pdev); - int minor; - - if (!bfdev) { - return PCI_ERS_RESULT_NONE; - } - printk(KERN_ERR "pci_err_detected state %d\n", state); - if (state == pci_channel_io_perm_failure || state == pci_channel_io_frozen) { - bfdev->info.pci_error_state = 1; - /* send a signal to the user space program of the error */ - minor = bfdev->info.minor; - if (minor < BF_MAX_DEVICE_CNT && bf_global[minor].async_queue) { - kill_fasync(&bf_global[minor].async_queue, SIGIO, POLL_ERR); - } - return PCI_ERS_RESULT_DISCONNECT; - } else { - return PCI_ERS_RESULT_NONE; - } -} - -/** - * bf_pci_slot_reset - called after the pci bus has been reset. - * @pdev: Pointer to PCI device - * - * Restart the card from scratch, as if from a cold-boot. - */ -static pci_ers_result_t bf_pci_slot_reset(struct pci_dev *pdev) -{ - /* nothing to do for now as we do not expect to get backto normal after - * a pcie link reset - * TBD: fill in this function if tofino can recover after an error - */ - return PCI_ERS_RESULT_DISCONNECT; -} - -/** - * bf_pci_resume - called when kernel thinks the device is up on PCIe. - * @pdev: Pointer to PCI device - * - * This callback is called when the error recovery driver tells us that - * its OK to resume normal operation. - */ -static void bf_pci_resume(struct pci_dev *pdev) -{ - /* this function should never be called for Tofinoi */ - struct bf_pci_dev *bfdev = pci_get_drvdata(pdev); - - printk(KERN_ERR "BF io_resume invoked after pci error\n"); - if (bfdev) { - bfdev->info.pci_error_state = 0; - } -} - -static int -bf_config_intr_mode(char *intr_str) -{ - if (!intr_str) { - pr_info("Use MSIX interrupt by default\n"); - return 0; - } - - if (!strcmp(intr_str, BF_INTR_MODE_MSIX_NAME)) { - bf_intr_mode_default = BF_INTR_MODE_MSIX; - pr_info("Use MSIX interrupt\n"); - } else if (!strcmp(intr_str, BF_INTR_MODE_MSI_NAME)) { - bf_intr_mode_default = BF_INTR_MODE_MSI; - pr_info("Use MSI interrupt\n"); - } else if (!strcmp(intr_str, BF_INTR_MODE_LEGACY_NAME)) { - bf_intr_mode_default = BF_INTR_MODE_LEGACY; - pr_info("Use legacy interrupt\n"); - } else { - pr_info("Error: bad parameter - %s\n", intr_str); - return -EINVAL; - } - - return 0; -} - -static const struct pci_device_id bf_pci_tbl[] = { - {PCI_VDEVICE(BF, TOFINO_DEV_ID_A0), 0}, - {PCI_VDEVICE(BF, TOFINO_DEV_ID_B0), 0}, - /* required last entry */ - { .device = 0 } -}; - -/* PCI bus error handlers */ -static struct pci_error_handlers bf_pci_err_handler = { - .error_detected = bf_pci_error_detected, - .slot_reset = bf_pci_slot_reset, - .resume = bf_pci_resume, -}; - -static struct pci_driver bf_pci_driver = { - .name = "bf", - .id_table = bf_pci_tbl, - .probe = bf_pci_probe, - .remove = bf_pci_remove, - .err_handler = &bf_pci_err_handler -}; - -static int __init -bfdrv_init(void) -{ - int ret; - - ret = bf_config_intr_mode(intr_mode); - if (ret < 0) - return ret; - - spin_lock_init(&bf_nonisr_lock); - return pci_register_driver(&bf_pci_driver); -} - -static void __exit -bfdrv_exit(void) -{ - pci_unregister_driver(&bf_pci_driver); -} - -module_init(bfdrv_init); -module_exit(bfdrv_exit); - -module_param(intr_mode, charp, S_IRUGO); -MODULE_PARM_DESC(intr_mode, -"bf interrupt mode (default=msix):\n" -" " BF_INTR_MODE_MSIX_NAME " Use MSIX interrupt\n" -" " BF_INTR_MODE_MSI_NAME " Use MSI interrupt\n" -" " BF_INTR_MODE_LEGACY_NAME " Use Legacy interrupt\n" -"\n"); - -MODULE_DEVICE_TABLE(pci, bf_pci_tbl); -MODULE_DESCRIPTION("Barefoot Tofino PCI device"); -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Barefoot Networks"); diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/Makefile b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/Makefile index 29b904dd3232..f01694d73eaf 100644 --- a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/Makefile +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/Makefile @@ -1,5 +1,3 @@ -obj-m := bf_kdrv.o -obj-m += bf_tun.o obj-m += i2c-mcp2221.o obj-m += wnc_cpld.o obj-m += wnc_cpld3.o diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c deleted file mode 100644 index abb906a24618..000000000000 --- a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_tun.c +++ /dev/null @@ -1,2616 +0,0 @@ -/* - * TUN - Universal TUN/TAP device driver. - * Copyright (C) 1999-2002 Maxim Krasnyansky - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * $Id: tun.c,v 1.15 2002/03/01 02:44:24 maxk Exp $ - */ - -/* - * Changes: - * - * Mike Kershaw 2005/08/14 - * Add TUNSETLINK ioctl to set the link encapsulation - * - * Mark Smith - * Use eth_random_addr() for tap MAC address. - * - * Harald Roelle 2004/04/20 - * Fixes in packet dropping, queue length setting and queue wakeup. - * Increased default tx queue length. - * Added ethtool API. - * Minor cleanups - * - * Daniel Podlejski - * Modifications for 2.3.99-pre5 kernel. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#define DRV_NAME "bf_tun" -#define DRV_VERSION "1.6" -#define DRV_DESCRIPTION "Universal TUN/TAP device driver" -#define DRV_COPYRIGHT "(C) 1999-2004 Max Krasnyansky " - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define TUN_MINOR1 201 - -/* Uncomment to enable debugging */ -/* #define TUN_DEBUG 1 */ - -#ifdef TUN_DEBUG -static int debug; - -#define tun_debug(level, tun, fmt, args...) \ -do { \ - if (tun->debug) \ - netdev_printk(level, tun->dev, fmt, ##args); \ -} while (0) -#define DBG1(level, fmt, args...) \ -do { \ - if (debug == 2) \ - printk(level fmt, ##args); \ -} while (0) -#else -#define tun_debug(level, tun, fmt, args...) \ -do { \ - if (0) \ - netdev_printk(level, tun->dev, fmt, ##args); \ -} while (0) -#define DBG1(level, fmt, args...) \ -do { \ - if (0) \ - printk(level fmt, ##args); \ -} while (0) -#endif - -/* TUN device flags */ - -/* IFF_ATTACH_QUEUE is never stored in device flags, - * overload it to mean fasync when stored there. - */ -#define TUN_FASYNC IFF_ATTACH_QUEUE -/* High bits in flags field are unused. */ -#define TUN_VNET_LE 0x80000000 -#define TUN_VNET_BE 0x40000000 - -#define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | \ - IFF_MULTI_QUEUE) -#define GOODCOPY_LEN 128 - -#define FLT_EXACT_COUNT 8 -struct tap_filter { - unsigned int count; /* Number of addrs. Zero means disabled */ - u32 mask[2]; /* Mask of the hashed addrs */ - unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN]; -}; - -/* MAX_TAP_QUEUES 256 is chosen to allow rx/tx queues to be equal - * to max number of VCPUs in guest. */ -#define MAX_TAP_QUEUES 256 -#define MAX_TAP_FLOWS 4096 - -#define TUN_FLOW_EXPIRE (3 * HZ) - -struct tun_pcpu_stats { - u64 rx_packets; - u64 rx_bytes; - u64 tx_packets; - u64 tx_bytes; - struct u64_stats_sync syncp; - u32 rx_dropped; - u32 tx_dropped; - u32 rx_frame_errors; -}; - -/* A tun_file connects an open character device to a tuntap netdevice. It - * also contains all socket related structures (except sock_fprog and tap_filter) - * to serve as one transmit queue for tuntap device. The sock_fprog and - * tap_filter were kept in tun_struct since they were used for filtering for the - * netdevice not for a specific queue (at least I didn't see the requirement for - * this). - * - * RCU usage: - * The tun_file and tun_struct are loosely coupled, the pointer from one to the - * other can only be read while rcu_read_lock or rtnl_lock is held. - */ -struct tun_file { - struct sock sk; - struct socket socket; - struct socket_wq wq; - struct tun_struct __rcu *tun; - struct fasync_struct *fasync; - /* only used for fasnyc */ - unsigned int flags; - union { - u16 queue_index; - unsigned int ifindex; - }; - struct list_head next; - struct tun_struct *detached; - struct skb_array tx_array; -}; - -struct tun_flow_entry { - struct hlist_node hash_link; - struct rcu_head rcu; - struct tun_struct *tun; - - u32 rxhash; - u32 rps_rxhash; - int queue_index; - unsigned long updated; -}; - -#define TUN_NUM_FLOW_ENTRIES 1024 - -/* Since the socket were moved to tun_file, to preserve the behavior of persist - * device, socket filter, sndbuf and vnet header size were restore when the - * file were attached to a persist device. - */ -struct tun_struct { - struct tun_file __rcu *tfiles[MAX_TAP_QUEUES]; - unsigned int numqueues; - unsigned int flags; - kuid_t owner; - kgid_t group; - - struct net_device *dev; - netdev_features_t set_features; -#define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ - NETIF_F_TSO6|NETIF_F_UFO) - - int align; - int vnet_hdr_sz; - int sndbuf; - struct tap_filter txflt; - struct sock_fprog fprog; - /* protected by rtnl lock */ - bool filter_attached; -#ifdef TUN_DEBUG - int debug; -#endif - spinlock_t lock; - struct hlist_head flows[TUN_NUM_FLOW_ENTRIES]; - struct timer_list flow_gc_timer; - unsigned long ageing_time; - unsigned int numdisabled; - struct list_head disabled; - void *security; - u32 flow_count; - struct tun_pcpu_stats __percpu *pcpu_stats; -}; - -#ifdef CONFIG_TUN_VNET_CROSS_LE -static inline bool tun_legacy_is_little_endian(struct tun_struct *tun) -{ - return tun->flags & TUN_VNET_BE ? false : - virtio_legacy_is_little_endian(); -} - -static long tun_get_vnet_be(struct tun_struct *tun, int __user *argp) -{ - int be = !!(tun->flags & TUN_VNET_BE); - - if (put_user(be, argp)) - return -EFAULT; - - return 0; -} - -static long tun_set_vnet_be(struct tun_struct *tun, int __user *argp) -{ - int be; - - if (get_user(be, argp)) - return -EFAULT; - - if (be) - tun->flags |= TUN_VNET_BE; - else - tun->flags &= ~TUN_VNET_BE; - - return 0; -} -#else -static inline bool tun_legacy_is_little_endian(struct tun_struct *tun) -{ - return virtio_legacy_is_little_endian(); -} - -static long tun_get_vnet_be(struct tun_struct *tun, int __user *argp) -{ - return -EINVAL; -} - -static long tun_set_vnet_be(struct tun_struct *tun, int __user *argp) -{ - return -EINVAL; -} -#endif /* CONFIG_TUN_VNET_CROSS_LE */ - -static inline bool tun_is_little_endian(struct tun_struct *tun) -{ - return tun->flags & TUN_VNET_LE || - tun_legacy_is_little_endian(tun); -} - -static inline u16 tun16_to_cpu(struct tun_struct *tun, __virtio16 val) -{ - return __virtio16_to_cpu(tun_is_little_endian(tun), val); -} - -static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val) -{ - return __cpu_to_virtio16(tun_is_little_endian(tun), val); -} - -static inline u32 tun_hashfn(u32 rxhash) -{ - return rxhash & 0x3ff; -} - -static struct tun_flow_entry *tun_flow_find(struct hlist_head *head, u32 rxhash) -{ - struct tun_flow_entry *e; - - hlist_for_each_entry_rcu(e, head, hash_link) { - if (e->rxhash == rxhash) - return e; - } - return NULL; -} - -static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun, - struct hlist_head *head, - u32 rxhash, u16 queue_index) -{ - struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC); - - if (e) { - tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n", - rxhash, queue_index); - e->updated = jiffies; - e->rxhash = rxhash; - e->rps_rxhash = 0; - e->queue_index = queue_index; - e->tun = tun; - hlist_add_head_rcu(&e->hash_link, head); - ++tun->flow_count; - } - return e; -} - -static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) -{ - tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", - e->rxhash, e->queue_index); - hlist_del_rcu(&e->hash_link); - kfree_rcu(e, rcu); - --tun->flow_count; -} - -static void tun_flow_flush(struct tun_struct *tun) -{ - int i; - - spin_lock_bh(&tun->lock); - for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { - struct tun_flow_entry *e; - struct hlist_node *n; - - hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) - tun_flow_delete(tun, e); - } - spin_unlock_bh(&tun->lock); -} - -static void tun_flow_delete_by_queue(struct tun_struct *tun, u16 queue_index) -{ - int i; - - spin_lock_bh(&tun->lock); - for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { - struct tun_flow_entry *e; - struct hlist_node *n; - - hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) { - if (e->queue_index == queue_index) - tun_flow_delete(tun, e); - } - } - spin_unlock_bh(&tun->lock); -} - -static void tun_flow_cleanup(unsigned long data) -{ - struct tun_struct *tun = (struct tun_struct *)data; - unsigned long delay = tun->ageing_time; - unsigned long next_timer = jiffies + delay; - unsigned long count = 0; - int i; - - tun_debug(KERN_INFO, tun, "tun_flow_cleanup\n"); - - spin_lock_bh(&tun->lock); - for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { - struct tun_flow_entry *e; - struct hlist_node *n; - - hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) { - unsigned long this_timer; - count++; - this_timer = e->updated + delay; - if (time_before_eq(this_timer, jiffies)) - tun_flow_delete(tun, e); - else if (time_before(this_timer, next_timer)) - next_timer = this_timer; - } - } - - if (count) - mod_timer(&tun->flow_gc_timer, round_jiffies_up(next_timer)); - spin_unlock_bh(&tun->lock); -} - -static void tun_flow_update(struct tun_struct *tun, u32 rxhash, - struct tun_file *tfile) -{ - struct hlist_head *head; - struct tun_flow_entry *e; - unsigned long delay = tun->ageing_time; - u16 queue_index = tfile->queue_index; - - if (!rxhash) - return; - else - head = &tun->flows[tun_hashfn(rxhash)]; - - rcu_read_lock(); - - /* We may get a very small possibility of OOO during switching, not - * worth to optimize.*/ - if (tun->numqueues == 1 || tfile->detached) - goto unlock; - - e = tun_flow_find(head, rxhash); - if (likely(e)) { - /* TODO: keep queueing to old queue until it's empty? */ - e->queue_index = queue_index; - e->updated = jiffies; - sock_rps_record_flow_hash(e->rps_rxhash); - } else { - spin_lock_bh(&tun->lock); - if (!tun_flow_find(head, rxhash) && - tun->flow_count < MAX_TAP_FLOWS) - tun_flow_create(tun, head, rxhash, queue_index); - - if (!timer_pending(&tun->flow_gc_timer)) - mod_timer(&tun->flow_gc_timer, - round_jiffies_up(jiffies + delay)); - spin_unlock_bh(&tun->lock); - } - -unlock: - rcu_read_unlock(); -} - -/** - * Save the hash received in the stack receive path and update the - * flow_hash table accordingly. - */ -static inline void tun_flow_save_rps_rxhash(struct tun_flow_entry *e, u32 hash) -{ - if (unlikely(e->rps_rxhash != hash)) - e->rps_rxhash = hash; -} - -/* We try to identify a flow through its rxhash first. The reason that - * we do not check rxq no. is because some cards(e.g 82599), chooses - * the rxq based on the txq where the last packet of the flow comes. As - * the userspace application move between processors, we may get a - * different rxq no. here. If we could not get rxhash, then we would - * hope the rxq no. may help here. - */ -static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb, - void *accel_priv, select_queue_fallback_t fallback) -{ - struct tun_struct *tun = netdev_priv(dev); - struct tun_flow_entry *e; - u32 txq = 0; - u32 numqueues = 0; - - rcu_read_lock(); - numqueues = ACCESS_ONCE(tun->numqueues); - - txq = skb_get_hash(skb); - if (txq) { - e = tun_flow_find(&tun->flows[tun_hashfn(txq)], txq); - if (e) { - tun_flow_save_rps_rxhash(e, txq); - txq = e->queue_index; - } else - /* use multiply and shift instead of expensive divide */ - txq = ((u64)txq * numqueues) >> 32; - } else if (likely(skb_rx_queue_recorded(skb))) { - txq = skb_get_rx_queue(skb); - while (unlikely(txq >= numqueues)) - txq -= numqueues; - } - - rcu_read_unlock(); - return txq; -} - -static inline bool tun_not_capable(struct tun_struct *tun) -{ - const struct cred *cred = current_cred(); - struct net *net = dev_net(tun->dev); - - return ((uid_valid(tun->owner) && !uid_eq(cred->euid, tun->owner)) || - (gid_valid(tun->group) && !in_egroup_p(tun->group))) && - !ns_capable(net->user_ns, CAP_NET_ADMIN); -} - -static void tun_set_real_num_queues(struct tun_struct *tun) -{ - netif_set_real_num_tx_queues(tun->dev, tun->numqueues); - netif_set_real_num_rx_queues(tun->dev, tun->numqueues); -} - -static void tun_disable_queue(struct tun_struct *tun, struct tun_file *tfile) -{ - tfile->detached = tun; - list_add_tail(&tfile->next, &tun->disabled); - ++tun->numdisabled; -} - -static struct tun_struct *tun_enable_queue(struct tun_file *tfile) -{ - struct tun_struct *tun = tfile->detached; - - tfile->detached = NULL; - list_del_init(&tfile->next); - --tun->numdisabled; - return tun; -} - -static void tun_queue_purge(struct tun_file *tfile) -{ - struct sk_buff *skb; - - while ((skb = skb_array_consume(&tfile->tx_array)) != NULL) - kfree_skb(skb); - - skb_queue_purge(&tfile->sk.sk_error_queue); -} - -static void tun_cleanup_tx_array(struct tun_file *tfile) -{ - if (tfile->tx_array.ring.queue) { - skb_array_cleanup(&tfile->tx_array); - memset(&tfile->tx_array, 0, sizeof(tfile->tx_array)); - } -} - -static void __tun_detach(struct tun_file *tfile, bool clean) -{ - struct tun_file *ntfile; - struct tun_struct *tun; - - tun = rtnl_dereference(tfile->tun); - - if (tun && !tfile->detached) { - u16 index = tfile->queue_index; - BUG_ON(index >= tun->numqueues); - - rcu_assign_pointer(tun->tfiles[index], - tun->tfiles[tun->numqueues - 1]); - ntfile = rtnl_dereference(tun->tfiles[index]); - ntfile->queue_index = index; - - --tun->numqueues; - if (clean) { - RCU_INIT_POINTER(tfile->tun, NULL); - sock_put(&tfile->sk); - } else - tun_disable_queue(tun, tfile); - - synchronize_net(); - tun_flow_delete_by_queue(tun, tun->numqueues + 1); - /* Drop read queue */ - tun_queue_purge(tfile); - tun_set_real_num_queues(tun); - } else if (tfile->detached && clean) { - tun = tun_enable_queue(tfile); - sock_put(&tfile->sk); - } - - if (clean) { - if (tun && tun->numqueues == 0 && tun->numdisabled == 0) { - netif_carrier_off(tun->dev); - - if (!(tun->flags & IFF_PERSIST) && - tun->dev->reg_state == NETREG_REGISTERED) - unregister_netdevice(tun->dev); - } - tun_cleanup_tx_array(tfile); - sock_put(&tfile->sk); - } -} - -static void tun_detach(struct tun_file *tfile, bool clean) -{ - rtnl_lock(); - __tun_detach(tfile, clean); - rtnl_unlock(); -} - -static void tun_detach_all(struct net_device *dev) -{ - struct tun_struct *tun = netdev_priv(dev); - struct tun_file *tfile, *tmp; - int i, n = tun->numqueues; - - for (i = 0; i < n; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); - BUG_ON(!tfile); - tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN; - tfile->socket.sk->sk_data_ready(tfile->socket.sk); - RCU_INIT_POINTER(tfile->tun, NULL); - --tun->numqueues; - } - list_for_each_entry(tfile, &tun->disabled, next) { - tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN; - tfile->socket.sk->sk_data_ready(tfile->socket.sk); - RCU_INIT_POINTER(tfile->tun, NULL); - } - BUG_ON(tun->numqueues != 0); - - synchronize_net(); - for (i = 0; i < n; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); - /* Drop read queue */ - tun_queue_purge(tfile); - sock_put(&tfile->sk); - tun_cleanup_tx_array(tfile); - } - list_for_each_entry_safe(tfile, tmp, &tun->disabled, next) { - tun_enable_queue(tfile); - tun_queue_purge(tfile); - sock_put(&tfile->sk); - tun_cleanup_tx_array(tfile); - } - BUG_ON(tun->numdisabled != 0); - - if (tun->flags & IFF_PERSIST) - module_put(THIS_MODULE); -} - -static int tun_attach(struct tun_struct *tun, struct file *file, bool skip_filter) -{ - struct tun_file *tfile = file->private_data; - struct net_device *dev = tun->dev; - int err; - - err = security_tun_dev_attach(tfile->socket.sk, tun->security); - if (err < 0) - goto out; - - err = -EINVAL; - if (rtnl_dereference(tfile->tun) && !tfile->detached) - goto out; - - err = -EBUSY; - if (!(tun->flags & IFF_MULTI_QUEUE) && tun->numqueues == 1) - goto out; - - err = -E2BIG; - if (!tfile->detached && - tun->numqueues + tun->numdisabled == MAX_TAP_QUEUES) - goto out; - - err = 0; - - /* Re-attach the filter to persist device */ - if (!skip_filter && (tun->filter_attached == true)) { - lock_sock(tfile->socket.sk); - err = sk_attach_filter(&tun->fprog, tfile->socket.sk); - release_sock(tfile->socket.sk); - if (!err) - goto out; - } - - if (!tfile->detached && - skb_array_init(&tfile->tx_array, dev->tx_queue_len, GFP_KERNEL)) { - err = -ENOMEM; - goto out; - } - - tfile->queue_index = tun->numqueues; - tfile->socket.sk->sk_shutdown &= ~RCV_SHUTDOWN; - rcu_assign_pointer(tfile->tun, tun); - rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); - tun->numqueues++; - - if (tfile->detached) - tun_enable_queue(tfile); - else - sock_hold(&tfile->sk); - - tun_set_real_num_queues(tun); - - /* device is allowed to go away first, so no need to hold extra - * refcnt. - */ - -out: - return err; -} - -static struct tun_struct *__tun_get(struct tun_file *tfile) -{ - struct tun_struct *tun; - - rcu_read_lock(); - tun = rcu_dereference(tfile->tun); - if (tun) - dev_hold(tun->dev); - rcu_read_unlock(); - - return tun; -} - -static struct tun_struct *tun_get(struct file *file) -{ - return __tun_get(file->private_data); -} - -static void tun_put(struct tun_struct *tun) -{ - dev_put(tun->dev); -} - -/* TAP filtering */ -static void addr_hash_set(u32 *mask, const u8 *addr) -{ - int n = ether_crc(ETH_ALEN, addr) >> 26; - mask[n >> 5] |= (1 << (n & 31)); -} - -static unsigned int addr_hash_test(const u32 *mask, const u8 *addr) -{ - int n = ether_crc(ETH_ALEN, addr) >> 26; - return mask[n >> 5] & (1 << (n & 31)); -} - -static int update_filter(struct tap_filter *filter, void __user *arg) -{ - struct { u8 u[ETH_ALEN]; } *addr; - struct tun_filter uf; - int err, alen, n, nexact; - - if (copy_from_user(&uf, arg, sizeof(uf))) - return -EFAULT; - - if (!uf.count) { - /* Disabled */ - filter->count = 0; - return 0; - } - - alen = ETH_ALEN * uf.count; - addr = memdup_user(arg + sizeof(uf), alen); - if (IS_ERR(addr)) - return PTR_ERR(addr); - - /* The filter is updated without holding any locks. Which is - * perfectly safe. We disable it first and in the worst - * case we'll accept a few undesired packets. */ - filter->count = 0; - wmb(); - - /* Use first set of addresses as an exact filter */ - for (n = 0; n < uf.count && n < FLT_EXACT_COUNT; n++) - memcpy(filter->addr[n], addr[n].u, ETH_ALEN); - - nexact = n; - - /* Remaining multicast addresses are hashed, - * unicast will leave the filter disabled. */ - memset(filter->mask, 0, sizeof(filter->mask)); - for (; n < uf.count; n++) { - if (!is_multicast_ether_addr(addr[n].u)) { - err = 0; /* no filter */ - goto free_addr; - } - addr_hash_set(filter->mask, addr[n].u); - } - - /* For ALLMULTI just set the mask to all ones. - * This overrides the mask populated above. */ - if ((uf.flags & TUN_FLT_ALLMULTI)) - memset(filter->mask, ~0, sizeof(filter->mask)); - - /* Now enable the filter */ - wmb(); - filter->count = nexact; - - /* Return the number of exact filters */ - err = nexact; -free_addr: - kfree(addr); - return err; -} - -/* Returns: 0 - drop, !=0 - accept */ -static int run_filter(struct tap_filter *filter, const struct sk_buff *skb) -{ - /* Cannot use eth_hdr(skb) here because skb_mac_hdr() is incorrect - * at this point. */ - struct ethhdr *eh = (struct ethhdr *) skb->data; - int i; - - /* Exact match */ - for (i = 0; i < filter->count; i++) - if (ether_addr_equal(eh->h_dest, filter->addr[i])) - return 1; - - /* Inexact match (multicast only) */ - if (is_multicast_ether_addr(eh->h_dest)) - return addr_hash_test(filter->mask, eh->h_dest); - - return 0; -} - -/* - * Checks whether the packet is accepted or not. - * Returns: 0 - drop, !=0 - accept - */ -static int check_filter(struct tap_filter *filter, const struct sk_buff *skb) -{ - if (!filter->count) - return 1; - - return run_filter(filter, skb); -} - -/* Network device part of the driver */ - -static const struct ethtool_ops tun_ethtool_ops; - -/* Net device detach from fd. */ -static void tun_net_uninit(struct net_device *dev) -{ - tun_detach_all(dev); -} - -/* Net device open. */ -static int tun_net_open(struct net_device *dev) -{ - struct tun_struct *tun = netdev_priv(dev); - int i; - - netif_tx_start_all_queues(dev); - - for (i = 0; i < tun->numqueues; i++) { - struct tun_file *tfile; - - tfile = rtnl_dereference(tun->tfiles[i]); - tfile->socket.sk->sk_write_space(tfile->socket.sk); - } - - return 0; -} - -/* Net device close. */ -static int tun_net_close(struct net_device *dev) -{ - netif_tx_stop_all_queues(dev); - return 0; -} - -/* Net device start xmit */ -static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct tun_struct *tun = netdev_priv(dev); - int txq = skb->queue_mapping; - struct tun_file *tfile; - u32 numqueues = 0; - - rcu_read_lock(); - tfile = rcu_dereference(tun->tfiles[txq]); - numqueues = ACCESS_ONCE(tun->numqueues); - - /* Drop packet if interface is not attached */ - if (txq >= numqueues) - goto drop; - -#ifdef CONFIG_RPS - if (numqueues == 1 && static_key_false(&rps_needed)) { - /* Select queue was not called for the skbuff, so we extract the - * RPS hash and save it into the flow_table here. - */ - __u32 rxhash; - - rxhash = skb_get_hash(skb); - if (rxhash) { - struct tun_flow_entry *e; - e = tun_flow_find(&tun->flows[tun_hashfn(rxhash)], - rxhash); - if (e) - tun_flow_save_rps_rxhash(e, rxhash); - } - } -#endif - - tun_debug(KERN_INFO, tun, "tun_net_xmit %d\n", skb->len); - - BUG_ON(!tfile); - - /* Drop if the filter does not like it. - * This is a noop if the filter is disabled. - * Filter can be enabled only for the TAP devices. */ - if (!check_filter(&tun->txflt, skb)) - goto drop; - - if (tfile->socket.sk->sk_filter && - sk_filter(tfile->socket.sk, skb)) - goto drop; - - /* Limit the number of packets queued by dividing txq length with the - * number of queues. - */ - if (skb_queue_len(&tfile->socket.sk->sk_receive_queue) * numqueues - >= dev->tx_queue_len) - goto drop; - - if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) - goto drop; - - skb_tx_timestamp(skb); - - /* Orphan the skb - required as we might hang on to it - * for indefinite time. - */ - skb_orphan(skb); - - nf_reset(skb); - - if (skb_array_produce(&tfile->tx_array, skb)) - goto drop; - - /* Notify and wake up reader process */ - if (tfile->flags & TUN_FASYNC) - kill_fasync(&tfile->fasync, SIGIO, POLL_IN); - tfile->socket.sk->sk_data_ready(tfile->socket.sk); - - rcu_read_unlock(); - return NETDEV_TX_OK; - -drop: - this_cpu_inc(tun->pcpu_stats->tx_dropped); - skb_tx_error(skb); - kfree_skb(skb); - rcu_read_unlock(); - return NET_XMIT_DROP; -} - -static void tun_net_mclist(struct net_device *dev) -{ - /* - * This callback is supposed to deal with mc filter in - * _rx_ path and has nothing to do with the _tx_ path. - * In rx path we always accept everything userspace gives us. - */ -} - -#define MIN_MTU 68 -#define MAX_MTU 65535 - -static int -tun_net_change_mtu(struct net_device *dev, int new_mtu) -{ - if (new_mtu < MIN_MTU || new_mtu + dev->hard_header_len > MAX_MTU) - return -EINVAL; - dev->mtu = new_mtu; - return 0; -} - -static netdev_features_t tun_net_fix_features(struct net_device *dev, - netdev_features_t features) -{ - struct tun_struct *tun = netdev_priv(dev); - - return (features & tun->set_features) | (features & ~TUN_USER_FEATURES); -} -#ifdef CONFIG_NET_POLL_CONTROLLER -static void tun_poll_controller(struct net_device *dev) -{ - /* - * Tun only receives frames when: - * 1) the char device endpoint gets data from user space - * 2) the tun socket gets a sendmsg call from user space - * Since both of those are synchronous operations, we are guaranteed - * never to have pending data when we poll for it - * so there is nothing to do here but return. - * We need this though so netpoll recognizes us as an interface that - * supports polling, which enables bridge devices in virt setups to - * still use netconsole - */ - return; -} -#endif - -static void tun_set_headroom(struct net_device *dev, int new_hr) -{ - struct tun_struct *tun = netdev_priv(dev); - - if (new_hr < NET_SKB_PAD) - new_hr = NET_SKB_PAD; - - tun->align = new_hr; -} - -static struct rtnl_link_stats64 * -tun_net_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) -{ - u32 rx_dropped = 0, tx_dropped = 0, rx_frame_errors = 0; - struct tun_struct *tun = netdev_priv(dev); - struct tun_pcpu_stats *p; - int i; - - for_each_possible_cpu(i) { - u64 rxpackets, rxbytes, txpackets, txbytes; - unsigned int start; - - p = per_cpu_ptr(tun->pcpu_stats, i); - do { - start = u64_stats_fetch_begin(&p->syncp); - rxpackets = p->rx_packets; - rxbytes = p->rx_bytes; - txpackets = p->tx_packets; - txbytes = p->tx_bytes; - } while (u64_stats_fetch_retry(&p->syncp, start)); - - stats->rx_packets += rxpackets; - stats->rx_bytes += rxbytes; - stats->tx_packets += txpackets; - stats->tx_bytes += txbytes; - - /* u32 counters */ - rx_dropped += p->rx_dropped; - rx_frame_errors += p->rx_frame_errors; - tx_dropped += p->tx_dropped; - } - stats->rx_dropped = rx_dropped; - stats->rx_frame_errors = rx_frame_errors; - stats->tx_dropped = tx_dropped; - return stats; -} - -static int -tun_change_carrier(struct net_device *dev, bool new_carrier) { - if (new_carrier) - netif_carrier_on(dev); - else - netif_carrier_off(dev); - return 0; -} - -static const struct net_device_ops tun_netdev_ops = { - .ndo_uninit = tun_net_uninit, - .ndo_open = tun_net_open, - .ndo_stop = tun_net_close, - .ndo_start_xmit = tun_net_xmit, - .ndo_change_mtu = tun_net_change_mtu, - .ndo_fix_features = tun_net_fix_features, - .ndo_select_queue = tun_select_queue, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = tun_poll_controller, -#endif - .ndo_set_rx_headroom = tun_set_headroom, - .ndo_get_stats64 = tun_net_get_stats64, - .ndo_change_carrier = tun_change_carrier, -}; - -static const struct net_device_ops tap_netdev_ops = { - .ndo_uninit = tun_net_uninit, - .ndo_open = tun_net_open, - .ndo_stop = tun_net_close, - .ndo_start_xmit = tun_net_xmit, - .ndo_change_mtu = tun_net_change_mtu, - .ndo_fix_features = tun_net_fix_features, - .ndo_set_rx_mode = tun_net_mclist, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, - .ndo_select_queue = tun_select_queue, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = tun_poll_controller, -#endif - .ndo_features_check = passthru_features_check, - .ndo_set_rx_headroom = tun_set_headroom, - .ndo_get_stats64 = tun_net_get_stats64, -}; - -static void tun_flow_init(struct tun_struct *tun) -{ - int i; - - for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) - INIT_HLIST_HEAD(&tun->flows[i]); - - tun->ageing_time = TUN_FLOW_EXPIRE; - setup_timer(&tun->flow_gc_timer, tun_flow_cleanup, (unsigned long)tun); - mod_timer(&tun->flow_gc_timer, - round_jiffies_up(jiffies + tun->ageing_time)); -} - -static void tun_flow_uninit(struct tun_struct *tun) -{ - del_timer_sync(&tun->flow_gc_timer); - tun_flow_flush(tun); -} - -/* Initialize net device. */ -static void tun_net_init(struct net_device *dev) -{ - struct tun_struct *tun = netdev_priv(dev); - - switch (tun->flags & TUN_TYPE_MASK) { - case IFF_TUN: - dev->netdev_ops = &tun_netdev_ops; - - /* Point-to-Point TUN Device */ - dev->hard_header_len = 0; - dev->addr_len = 0; - dev->mtu = 1500; - - /* Zero header length */ - dev->type = ARPHRD_NONE; - dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; - break; - - case IFF_TAP: - dev->netdev_ops = &tap_netdev_ops; - /* Ethernet TAP Device */ - ether_setup(dev); - dev->priv_flags &= ~IFF_TX_SKB_SHARING; - dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; - - eth_hw_addr_random(dev); - - break; - } -} - -/* Character device part */ - -/* Poll */ -static unsigned int tun_chr_poll(struct file *file, poll_table *wait) -{ - struct tun_file *tfile = file->private_data; - struct tun_struct *tun = __tun_get(tfile); - struct sock *sk; - unsigned int mask = 0; - - if (!tun) - return POLLERR; - - sk = tfile->socket.sk; - - tun_debug(KERN_INFO, tun, "tun_chr_poll\n"); - - poll_wait(file, sk_sleep(sk), wait); - - if (!skb_array_empty(&tfile->tx_array)) - mask |= POLLIN | POLLRDNORM; - - if (tun->dev->flags & IFF_UP && - (sock_writeable(sk) || - (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) && - sock_writeable(sk)))) - mask |= POLLOUT | POLLWRNORM; - - if (tun->dev->reg_state != NETREG_REGISTERED) - mask = POLLERR; - - tun_put(tun); - return mask; -} - -/* prepad is the amount to reserve at front. len is length after that. - * linear is a hint as to how much to copy (usually headers). */ -static struct sk_buff *tun_alloc_skb(struct tun_file *tfile, - size_t prepad, size_t len, - size_t linear, int noblock) -{ - struct sock *sk = tfile->socket.sk; - struct sk_buff *skb; - int err; - - /* Under a page? Don't bother with paged skb. */ - if (prepad + len < PAGE_SIZE || !linear) - linear = len; - - skb = sock_alloc_send_pskb(sk, prepad + linear, len - linear, noblock, - &err, 0); - if (!skb) - return ERR_PTR(err); - - skb_reserve(skb, prepad); - skb_put(skb, linear); - skb->data_len = len - linear; - skb->len += len - linear; - - return skb; -} - -/* Get packet from user space buffer */ -static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, - void *msg_control, struct iov_iter *from, - int noblock) -{ - struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) }; - struct sk_buff *skb; - size_t total_len = iov_iter_count(from); - size_t len = total_len, align = tun->align, linear; - struct virtio_net_hdr gso = { 0 }; - struct tun_pcpu_stats *stats; - int good_linear; - int copylen; - bool zerocopy = false; - int err; - u32 rxhash; - ssize_t n; - - if (!(tun->dev->flags & IFF_UP)) - return -EIO; - - if (!(tun->flags & IFF_NO_PI)) { - if (len < sizeof(pi)) - return -EINVAL; - len -= sizeof(pi); - - n = copy_from_iter(&pi, sizeof(pi), from); - if (n != sizeof(pi)) - return -EFAULT; - } - - if (tun->flags & IFF_VNET_HDR) { - int vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz); - - if (len < vnet_hdr_sz) - return -EINVAL; - len -= vnet_hdr_sz; - - n = copy_from_iter(&gso, sizeof(gso), from); - if (n != sizeof(gso)) - return -EFAULT; - - if ((gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && - tun16_to_cpu(tun, gso.csum_start) + tun16_to_cpu(tun, gso.csum_offset) + 2 > tun16_to_cpu(tun, gso.hdr_len)) - gso.hdr_len = cpu_to_tun16(tun, tun16_to_cpu(tun, gso.csum_start) + tun16_to_cpu(tun, gso.csum_offset) + 2); - - if (tun16_to_cpu(tun, gso.hdr_len) > len) - return -EINVAL; - iov_iter_advance(from, vnet_hdr_sz - sizeof(gso)); - } - - if ((tun->flags & TUN_TYPE_MASK) == IFF_TAP) { - align += NET_IP_ALIGN; - if (unlikely(len < ETH_HLEN || - (gso.hdr_len && tun16_to_cpu(tun, gso.hdr_len) < ETH_HLEN))) - return -EINVAL; - } - - good_linear = SKB_MAX_HEAD(align); - - if (msg_control) { - struct iov_iter i = *from; - - /* There are 256 bytes to be copied in skb, so there is - * enough room for skb expand head in case it is used. - * The rest of the buffer is mapped from userspace. - */ - copylen = gso.hdr_len ? tun16_to_cpu(tun, gso.hdr_len) : GOODCOPY_LEN; - if (copylen > good_linear) - copylen = good_linear; - linear = copylen; - iov_iter_advance(&i, copylen); - if (iov_iter_npages(&i, INT_MAX) <= MAX_SKB_FRAGS) - zerocopy = true; - } - - if (!zerocopy) { - copylen = len; - if (tun16_to_cpu(tun, gso.hdr_len) > good_linear) - linear = good_linear; - else - linear = tun16_to_cpu(tun, gso.hdr_len); - } - - skb = tun_alloc_skb(tfile, align, copylen, linear, noblock); - if (IS_ERR(skb)) { - if (PTR_ERR(skb) != -EAGAIN) - this_cpu_inc(tun->pcpu_stats->rx_dropped); - return PTR_ERR(skb); - } - - if (zerocopy) - err = zerocopy_sg_from_iter(skb, from); - else - err = skb_copy_datagram_from_iter(skb, 0, from, len); - - if (err) { - this_cpu_inc(tun->pcpu_stats->rx_dropped); - kfree_skb(skb); - return -EFAULT; - } - - err = virtio_net_hdr_to_skb(skb, &gso, tun_is_little_endian(tun)); - if (err) { - this_cpu_inc(tun->pcpu_stats->rx_frame_errors); - kfree_skb(skb); - return -EINVAL; - } - - switch (tun->flags & TUN_TYPE_MASK) { - case IFF_TUN: - if (tun->flags & IFF_NO_PI) { - u8 ip_version = skb->len ? (skb->data[0] >> 4) : 0; - - switch (ip_version) { - case 4: - pi.proto = htons(ETH_P_IP); - break; - case 6: - pi.proto = htons(ETH_P_IPV6); - break; - default: - this_cpu_inc(tun->pcpu_stats->rx_dropped); - kfree_skb(skb); - return -EINVAL; - } - } - - skb_reset_mac_header(skb); - skb->protocol = pi.proto; - skb->dev = tun->dev; - break; - case IFF_TAP: - skb->protocol = eth_type_trans(skb, tun->dev); - break; - } - - /* copy skb_ubuf_info for callback when skb has no error */ - if (zerocopy) { - skb_shinfo(skb)->destructor_arg = msg_control; - skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; - skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; - } else if (msg_control) { - struct ubuf_info *uarg = msg_control; - uarg->callback(uarg, false); - } - - skb_reset_network_header(skb); - skb_probe_transport_header(skb, 0); - - rxhash = skb_get_hash(skb); - netif_rx_ni(skb); - - stats = get_cpu_ptr(tun->pcpu_stats); - u64_stats_update_begin(&stats->syncp); - stats->rx_packets++; - stats->rx_bytes += len; - u64_stats_update_end(&stats->syncp); - put_cpu_ptr(stats); - - tun_flow_update(tun, rxhash, tfile); - return total_len; -} - -static ssize_t tun_chr_write_iter(struct kiocb *iocb, struct iov_iter *from) -{ - struct file *file = iocb->ki_filp; - struct tun_struct *tun = tun_get(file); - struct tun_file *tfile = file->private_data; - ssize_t result; - - if (!tun) - return -EBADFD; - - result = tun_get_user(tun, tfile, NULL, from, file->f_flags & O_NONBLOCK); - - tun_put(tun); - return result; -} - -/* Put packet to the user space buffer */ -static ssize_t tun_put_user(struct tun_struct *tun, - struct tun_file *tfile, - struct sk_buff *skb, - struct iov_iter *iter) -{ - struct tun_pi pi = { 0, skb->protocol }; - struct tun_pcpu_stats *stats; - ssize_t total; - int vlan_offset = 0; - int vlan_hlen = 0; - int vnet_hdr_sz = 0; - - if (skb_vlan_tag_present(skb)) - vlan_hlen = VLAN_HLEN; - - if (tun->flags & IFF_VNET_HDR) - vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz); - - total = skb->len + vlan_hlen + vnet_hdr_sz; - - if (!(tun->flags & IFF_NO_PI)) { - if (iov_iter_count(iter) < sizeof(pi)) - return -EINVAL; - - total += sizeof(pi); - if (iov_iter_count(iter) < total) { - /* Packet will be striped */ - pi.flags |= TUN_PKT_STRIP; - } - - if (copy_to_iter(&pi, sizeof(pi), iter) != sizeof(pi)) - return -EFAULT; - } - - if (vnet_hdr_sz) { - struct virtio_net_hdr gso = { 0 }; /* no info leak */ - int ret; - - if (iov_iter_count(iter) < vnet_hdr_sz) - return -EINVAL; - - ret = virtio_net_hdr_from_skb(skb, &gso, - tun_is_little_endian(tun), true); - if (ret) { - struct skb_shared_info *sinfo = skb_shinfo(skb); - pr_err("unexpected GSO type: " - "0x%x, gso_size %d, hdr_len %d\n", - sinfo->gso_type, tun16_to_cpu(tun, gso.gso_size), - tun16_to_cpu(tun, gso.hdr_len)); - print_hex_dump(KERN_ERR, "tun: ", - DUMP_PREFIX_NONE, - 16, 1, skb->head, - min((int)tun16_to_cpu(tun, gso.hdr_len), 64), true); - WARN_ON_ONCE(1); - return -EINVAL; - } - - if (copy_to_iter(&gso, sizeof(gso), iter) != sizeof(gso)) - return -EFAULT; - - iov_iter_advance(iter, vnet_hdr_sz - sizeof(gso)); - } - - if (vlan_hlen) { - int ret; - struct { - __be16 h_vlan_proto; - __be16 h_vlan_TCI; - } veth; - - veth.h_vlan_proto = skb->vlan_proto; - veth.h_vlan_TCI = htons(skb_vlan_tag_get(skb)); - - vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); - - ret = skb_copy_datagram_iter(skb, 0, iter, vlan_offset); - if (ret || !iov_iter_count(iter)) - goto done; - - ret = copy_to_iter(&veth, sizeof(veth), iter); - if (ret != sizeof(veth) || !iov_iter_count(iter)) - goto done; - } - - skb_copy_datagram_iter(skb, vlan_offset, iter, skb->len - vlan_offset); - -done: - /* caller is in process context, */ - stats = get_cpu_ptr(tun->pcpu_stats); - u64_stats_update_begin(&stats->syncp); - stats->tx_packets++; - stats->tx_bytes += skb->len + vlan_hlen; - u64_stats_update_end(&stats->syncp); - put_cpu_ptr(tun->pcpu_stats); - - return total; -} - -static struct sk_buff *tun_ring_recv(struct tun_file *tfile, int noblock, - int *err) -{ - DECLARE_WAITQUEUE(wait, current); - struct sk_buff *skb = NULL; - int error = 0; - - skb = skb_array_consume(&tfile->tx_array); - if (skb) - goto out; - if (noblock) { - error = -EAGAIN; - goto out; - } - - add_wait_queue(&tfile->wq.wait, &wait); - current->state = TASK_INTERRUPTIBLE; - - while (1) { - skb = skb_array_consume(&tfile->tx_array); - if (skb) - break; - if (signal_pending(current)) { - error = -ERESTARTSYS; - break; - } - if (tfile->socket.sk->sk_shutdown & RCV_SHUTDOWN) { - error = -EFAULT; - break; - } - - schedule(); - } - - current->state = TASK_RUNNING; - remove_wait_queue(&tfile->wq.wait, &wait); - -out: - *err = error; - return skb; -} - -static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile, - struct iov_iter *to, - int noblock) -{ - struct sk_buff *skb; - ssize_t ret; - int err; - - tun_debug(KERN_INFO, tun, "tun_do_read\n"); - - if (!iov_iter_count(to)) - return 0; - - /* Read frames from ring */ - skb = tun_ring_recv(tfile, noblock, &err); - if (!skb) - return err; - - ret = tun_put_user(tun, tfile, skb, to); - if (unlikely(ret < 0)) - kfree_skb(skb); - else - consume_skb(skb); - - return ret; -} - -static ssize_t tun_chr_read_iter(struct kiocb *iocb, struct iov_iter *to) -{ - struct file *file = iocb->ki_filp; - struct tun_file *tfile = file->private_data; - struct tun_struct *tun = __tun_get(tfile); - ssize_t len = iov_iter_count(to), ret; - - if (!tun) - return -EBADFD; - ret = tun_do_read(tun, tfile, to, file->f_flags & O_NONBLOCK); - ret = min_t(ssize_t, ret, len); - if (ret > 0) - iocb->ki_pos = ret; - tun_put(tun); - return ret; -} - -static void tun_free_netdev(struct net_device *dev) -{ - struct tun_struct *tun = netdev_priv(dev); - - BUG_ON(!(list_empty(&tun->disabled))); - free_percpu(tun->pcpu_stats); - tun_flow_uninit(tun); - security_tun_dev_free_security(tun->security); - free_netdev(dev); -} - -static void tun_setup(struct net_device *dev) -{ - struct tun_struct *tun = netdev_priv(dev); - - tun->owner = INVALID_UID; - tun->group = INVALID_GID; - - dev->ethtool_ops = &tun_ethtool_ops; - dev->destructor = tun_free_netdev; - /* We prefer our own queue length */ - dev->tx_queue_len = TUN_READQ_SIZE; -} - -/* Trivial set of netlink ops to allow deleting tun or tap - * device with netlink. - */ -static int tun_validate(struct nlattr *tb[], struct nlattr *data[]) -{ - return -EINVAL; -} - -static struct rtnl_link_ops tun_link_ops __read_mostly = { - .kind = DRV_NAME, - .priv_size = sizeof(struct tun_struct), - .setup = tun_setup, - .validate = tun_validate, -}; - -static void tun_sock_write_space(struct sock *sk) -{ - struct tun_file *tfile; - wait_queue_head_t *wqueue; - - if (!sock_writeable(sk)) - return; - - if (!test_and_clear_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags)) - return; - - wqueue = sk_sleep(sk); - if (wqueue && waitqueue_active(wqueue)) - wake_up_interruptible_sync_poll(wqueue, POLLOUT | - POLLWRNORM | POLLWRBAND); - - tfile = container_of(sk, struct tun_file, sk); - kill_fasync(&tfile->fasync, SIGIO, POLL_OUT); -} - -static int tun_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) -{ - int ret; - struct tun_file *tfile = container_of(sock, struct tun_file, socket); - struct tun_struct *tun = __tun_get(tfile); - - if (!tun) - return -EBADFD; - - ret = tun_get_user(tun, tfile, m->msg_control, &m->msg_iter, - m->msg_flags & MSG_DONTWAIT); - tun_put(tun); - return ret; -} - -static int tun_recvmsg(struct socket *sock, struct msghdr *m, size_t total_len, - int flags) -{ - struct tun_file *tfile = container_of(sock, struct tun_file, socket); - struct tun_struct *tun = __tun_get(tfile); - int ret; - - if (!tun) - return -EBADFD; - - if (flags & ~(MSG_DONTWAIT|MSG_TRUNC|MSG_ERRQUEUE)) { - ret = -EINVAL; - goto out; - } - if (flags & MSG_ERRQUEUE) { - ret = sock_recv_errqueue(sock->sk, m, total_len, - SOL_PACKET, TUN_TX_TIMESTAMP); - goto out; - } - ret = tun_do_read(tun, tfile, &m->msg_iter, flags & MSG_DONTWAIT); - if (ret > (ssize_t)total_len) { - m->msg_flags |= MSG_TRUNC; - ret = flags & MSG_TRUNC ? ret : total_len; - } -out: - tun_put(tun); - return ret; -} - -static int tun_peek_len(struct socket *sock) -{ - struct tun_file *tfile = container_of(sock, struct tun_file, socket); - struct tun_struct *tun; - int ret = 0; - - tun = __tun_get(tfile); - if (!tun) - return 0; - - ret = skb_array_peek_len(&tfile->tx_array); - tun_put(tun); - - return ret; -} - -/* Ops structure to mimic raw sockets with tun */ -static const struct proto_ops tun_socket_ops = { - .peek_len = tun_peek_len, - .sendmsg = tun_sendmsg, - .recvmsg = tun_recvmsg, -}; - -static struct proto tun_proto = { - .name = "tun", - .owner = THIS_MODULE, - .obj_size = sizeof(struct tun_file), -}; - -static int tun_flags(struct tun_struct *tun) -{ - return tun->flags & (TUN_FEATURES | IFF_PERSIST | IFF_TUN | IFF_TAP); -} - -static ssize_t tun_show_flags(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct tun_struct *tun = netdev_priv(to_net_dev(dev)); - return sprintf(buf, "0x%x\n", tun_flags(tun)); -} - -static ssize_t tun_show_owner(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct tun_struct *tun = netdev_priv(to_net_dev(dev)); - return uid_valid(tun->owner)? - sprintf(buf, "%u\n", - from_kuid_munged(current_user_ns(), tun->owner)): - sprintf(buf, "-1\n"); -} - -static ssize_t tun_show_group(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct tun_struct *tun = netdev_priv(to_net_dev(dev)); - return gid_valid(tun->group) ? - sprintf(buf, "%u\n", - from_kgid_munged(current_user_ns(), tun->group)): - sprintf(buf, "-1\n"); -} - -static DEVICE_ATTR(tun_flags, 0444, tun_show_flags, NULL); -static DEVICE_ATTR(owner, 0444, tun_show_owner, NULL); -static DEVICE_ATTR(group, 0444, tun_show_group, NULL); - -static struct attribute *tun_dev_attrs[] = { - &dev_attr_tun_flags.attr, - &dev_attr_owner.attr, - &dev_attr_group.attr, - NULL -}; - -static const struct attribute_group tun_attr_group = { - .attrs = tun_dev_attrs -}; - -static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) -{ - struct tun_struct *tun; - struct tun_file *tfile = file->private_data; - struct net_device *dev; - int err; - - if (tfile->detached) - return -EINVAL; - - dev = __dev_get_by_name(net, ifr->ifr_name); - if (dev) { - if (ifr->ifr_flags & IFF_TUN_EXCL) - return -EBUSY; - if ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops) - tun = netdev_priv(dev); - else if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops) - tun = netdev_priv(dev); - else - return -EINVAL; - - if (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) != - !!(tun->flags & IFF_MULTI_QUEUE)) - return -EINVAL; - - if (tun_not_capable(tun)) - return -EPERM; - err = security_tun_dev_open(tun->security); - if (err < 0) - return err; - - err = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER); - if (err < 0) - return err; - - if (tun->flags & IFF_MULTI_QUEUE && - (tun->numqueues + tun->numdisabled > 1)) { - /* One or more queue has already been attached, no need - * to initialize the device again. - */ - return 0; - } - } - else { - char *name; - unsigned long flags = 0; - int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ? - MAX_TAP_QUEUES : 1; - - if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) - return -EPERM; - err = security_tun_dev_create(); - if (err < 0) - return err; - - /* Set dev type */ - if (ifr->ifr_flags & IFF_TUN) { - /* TUN device */ - flags |= IFF_TUN; - name = "tun%d"; - } else if (ifr->ifr_flags & IFF_TAP) { - /* TAP device */ - flags |= IFF_TAP; - name = "tap%d"; - } else - return -EINVAL; - - if (*ifr->ifr_name) - name = ifr->ifr_name; - - dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, - NET_NAME_UNKNOWN, tun_setup, queues, - queues); - - if (!dev) - return -ENOMEM; -#if 0 - err = dev_get_valid_name(net, dev, name); - if (err < 0) - goto err_free_dev; -#endif - dev_net_set(dev, net); - dev->rtnl_link_ops = &tun_link_ops; - dev->ifindex = tfile->ifindex; - dev->sysfs_groups[0] = &tun_attr_group; - - tun = netdev_priv(dev); - tun->dev = dev; - tun->flags = flags; - tun->txflt.count = 0; - tun->vnet_hdr_sz = sizeof(struct virtio_net_hdr); - - tun->align = NET_SKB_PAD; - tun->filter_attached = false; - tun->sndbuf = tfile->socket.sk->sk_sndbuf; - - tun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats); - if (!tun->pcpu_stats) { - err = -ENOMEM; - goto err_free_dev; - } - - spin_lock_init(&tun->lock); - - err = security_tun_dev_alloc_security(&tun->security); - if (err < 0) - goto err_free_stat; - - tun_net_init(dev); - tun_flow_init(tun); - - dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | - TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX; - dev->features = dev->hw_features | NETIF_F_LLTX; - dev->vlan_features = dev->features & - ~(NETIF_F_HW_VLAN_CTAG_TX | - NETIF_F_HW_VLAN_STAG_TX); - - INIT_LIST_HEAD(&tun->disabled); - err = tun_attach(tun, file, false); - if (err < 0) - goto err_free_flow; - - err = register_netdevice(tun->dev); - if (err < 0) - goto err_detach; - } - - netif_carrier_on(tun->dev); - - tun_debug(KERN_INFO, tun, "tun_set_iff\n"); - - tun->flags = (tun->flags & ~TUN_FEATURES) | - (ifr->ifr_flags & TUN_FEATURES); - - /* Make sure persistent devices do not get stuck in - * xoff state. - */ - if (netif_running(tun->dev)) - netif_tx_wake_all_queues(tun->dev); - - strcpy(ifr->ifr_name, tun->dev->name); - return 0; - -err_detach: - tun_detach_all(dev); -err_free_flow: - tun_flow_uninit(tun); - security_tun_dev_free_security(tun->security); -err_free_stat: - free_percpu(tun->pcpu_stats); -err_free_dev: - free_netdev(dev); - return err; -} - -static void tun_get_iff(struct net *net, struct tun_struct *tun, - struct ifreq *ifr) -{ - tun_debug(KERN_INFO, tun, "tun_get_iff\n"); - - strcpy(ifr->ifr_name, tun->dev->name); - - ifr->ifr_flags = tun_flags(tun); - -} - -/* This is like a cut-down ethtool ops, except done via tun fd so no - * privs required. */ -static int set_offload(struct tun_struct *tun, unsigned long arg) -{ - netdev_features_t features = 0; - - if (arg & TUN_F_CSUM) { - features |= NETIF_F_HW_CSUM; - arg &= ~TUN_F_CSUM; - - if (arg & (TUN_F_TSO4|TUN_F_TSO6)) { - if (arg & TUN_F_TSO_ECN) { - features |= NETIF_F_TSO_ECN; - arg &= ~TUN_F_TSO_ECN; - } - if (arg & TUN_F_TSO4) - features |= NETIF_F_TSO; - if (arg & TUN_F_TSO6) - features |= NETIF_F_TSO6; - arg &= ~(TUN_F_TSO4|TUN_F_TSO6); - } - - if (arg & TUN_F_UFO) { - features |= NETIF_F_UFO; - arg &= ~TUN_F_UFO; - } - } - - /* This gives the user a way to test for new features in future by - * trying to set them. */ - if (arg) - return -EINVAL; - - tun->set_features = features; - netdev_update_features(tun->dev); - - return 0; -} - -static void tun_detach_filter(struct tun_struct *tun, int n) -{ - int i; - struct tun_file *tfile; - - for (i = 0; i < n; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); - lock_sock(tfile->socket.sk); - sk_detach_filter(tfile->socket.sk); - release_sock(tfile->socket.sk); - } - - tun->filter_attached = false; -} - -static int tun_attach_filter(struct tun_struct *tun) -{ - int i, ret = 0; - struct tun_file *tfile; - - for (i = 0; i < tun->numqueues; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); - lock_sock(tfile->socket.sk); - ret = sk_attach_filter(&tun->fprog, tfile->socket.sk); - release_sock(tfile->socket.sk); - if (ret) { - tun_detach_filter(tun, i); - return ret; - } - } - - tun->filter_attached = true; - return ret; -} - -static void tun_set_sndbuf(struct tun_struct *tun) -{ - struct tun_file *tfile; - int i; - - for (i = 0; i < tun->numqueues; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); - tfile->socket.sk->sk_sndbuf = tun->sndbuf; - } -} - -static int tun_set_queue(struct file *file, struct ifreq *ifr) -{ - struct tun_file *tfile = file->private_data; - struct tun_struct *tun; - int ret = 0; - - rtnl_lock(); - - if (ifr->ifr_flags & IFF_ATTACH_QUEUE) { - tun = tfile->detached; - if (!tun) { - ret = -EINVAL; - goto unlock; - } - ret = security_tun_dev_attach_queue(tun->security); - if (ret < 0) - goto unlock; - ret = tun_attach(tun, file, false); - } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { - tun = rtnl_dereference(tfile->tun); - if (!tun || !(tun->flags & IFF_MULTI_QUEUE) || tfile->detached) - ret = -EINVAL; - else - __tun_detach(tfile, false); - } else - ret = -EINVAL; - -unlock: - rtnl_unlock(); - return ret; -} - -static long __tun_chr_ioctl(struct file *file, unsigned int cmd, - unsigned long arg, int ifreq_len) -{ - struct tun_file *tfile = file->private_data; - struct tun_struct *tun; - void __user* argp = (void __user*)arg; - struct ifreq ifr; - kuid_t owner; - kgid_t group; - int sndbuf; - int vnet_hdr_sz; - unsigned int ifindex; - int le; - int ret; - - if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == 0x89) { - if (copy_from_user(&ifr, argp, ifreq_len)) - return -EFAULT; - } else { - memset(&ifr, 0, sizeof(ifr)); - } - if (cmd == TUNGETFEATURES) { - /* Currently this just means: "what IFF flags are valid?". - * This is needed because we never checked for invalid flags on - * TUNSETIFF. - */ - return put_user(IFF_TUN | IFF_TAP | TUN_FEATURES, - (unsigned int __user*)argp); - } else if (cmd == TUNSETQUEUE) - return tun_set_queue(file, &ifr); - - ret = 0; - rtnl_lock(); - - tun = __tun_get(tfile); - if (cmd == TUNSETIFF && !tun) { - ifr.ifr_name[IFNAMSIZ-1] = '\0'; - - ret = tun_set_iff(sock_net(&tfile->sk), file, &ifr); - - if (ret) - goto unlock; - - if (copy_to_user(argp, &ifr, ifreq_len)) - ret = -EFAULT; - goto unlock; - } - if (cmd == TUNSETIFINDEX) { - ret = -EPERM; - if (tun) - goto unlock; - - ret = -EFAULT; - if (copy_from_user(&ifindex, argp, sizeof(ifindex))) - goto unlock; - - ret = 0; - tfile->ifindex = ifindex; - goto unlock; - } - - ret = -EBADFD; - if (!tun) - goto unlock; - - tun_debug(KERN_INFO, tun, "tun_chr_ioctl cmd %u\n", cmd); - - ret = 0; - switch (cmd) { - case TUNGETIFF: - tun_get_iff(current->nsproxy->net_ns, tun, &ifr); - - if (tfile->detached) - ifr.ifr_flags |= IFF_DETACH_QUEUE; - if (!tfile->socket.sk->sk_filter) - ifr.ifr_flags |= IFF_NOFILTER; - - if (copy_to_user(argp, &ifr, ifreq_len)) - ret = -EFAULT; - break; - - case TUNSETNOCSUM: - /* Disable/Enable checksum */ - - /* [unimplemented] */ - tun_debug(KERN_INFO, tun, "ignored: set checksum %s\n", - arg ? "disabled" : "enabled"); - break; - - case TUNSETPERSIST: - /* Disable/Enable persist mode. Keep an extra reference to the - * module to prevent the module being unprobed. - */ - if (arg && !(tun->flags & IFF_PERSIST)) { - tun->flags |= IFF_PERSIST; - __module_get(THIS_MODULE); - } - if (!arg && (tun->flags & IFF_PERSIST)) { - tun->flags &= ~IFF_PERSIST; - module_put(THIS_MODULE); - } - - tun_debug(KERN_INFO, tun, "persist %s\n", - arg ? "enabled" : "disabled"); - break; - - case TUNSETOWNER: - /* Set owner of the device */ - owner = make_kuid(current_user_ns(), arg); - if (!uid_valid(owner)) { - ret = -EINVAL; - break; - } - tun->owner = owner; - tun_debug(KERN_INFO, tun, "owner set to %u\n", - from_kuid(&init_user_ns, tun->owner)); - break; - - case TUNSETGROUP: - /* Set group of the device */ - group = make_kgid(current_user_ns(), arg); - if (!gid_valid(group)) { - ret = -EINVAL; - break; - } - tun->group = group; - tun_debug(KERN_INFO, tun, "group set to %u\n", - from_kgid(&init_user_ns, tun->group)); - break; - - case TUNSETLINK: - /* Only allow setting the type when the interface is down */ - if (tun->dev->flags & IFF_UP) { - tun_debug(KERN_INFO, tun, - "Linktype set failed because interface is up\n"); - ret = -EBUSY; - } else { - tun->dev->type = (int) arg; - tun_debug(KERN_INFO, tun, "linktype set to %d\n", - tun->dev->type); - ret = 0; - } - break; - -#ifdef TUN_DEBUG - case TUNSETDEBUG: - tun->debug = arg; - break; -#endif - case TUNSETOFFLOAD: - ret = set_offload(tun, arg); - break; - - case TUNSETTXFILTER: - /* Can be set only for TAPs */ - ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) - break; - ret = update_filter(&tun->txflt, (void __user *)arg); - break; - - case SIOCGIFHWADDR: - /* Get hw address */ - memcpy(ifr.ifr_hwaddr.sa_data, tun->dev->dev_addr, ETH_ALEN); - ifr.ifr_hwaddr.sa_family = tun->dev->type; - if (copy_to_user(argp, &ifr, ifreq_len)) - ret = -EFAULT; - break; - - case SIOCSIFHWADDR: - /* Set hw address */ - tun_debug(KERN_DEBUG, tun, "set hw address: %pM\n", - ifr.ifr_hwaddr.sa_data); - - ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); - break; - - case TUNGETSNDBUF: - sndbuf = tfile->socket.sk->sk_sndbuf; - if (copy_to_user(argp, &sndbuf, sizeof(sndbuf))) - ret = -EFAULT; - break; - - case TUNSETSNDBUF: - if (copy_from_user(&sndbuf, argp, sizeof(sndbuf))) { - ret = -EFAULT; - break; - } - if (sndbuf <= 0) { - ret = -EINVAL; - break; - } - - tun->sndbuf = sndbuf; - tun_set_sndbuf(tun); - break; - - case TUNGETVNETHDRSZ: - vnet_hdr_sz = tun->vnet_hdr_sz; - if (copy_to_user(argp, &vnet_hdr_sz, sizeof(vnet_hdr_sz))) - ret = -EFAULT; - break; - - case TUNSETVNETHDRSZ: - if (copy_from_user(&vnet_hdr_sz, argp, sizeof(vnet_hdr_sz))) { - ret = -EFAULT; - break; - } - if (vnet_hdr_sz < (int)sizeof(struct virtio_net_hdr)) { - ret = -EINVAL; - break; - } - - tun->vnet_hdr_sz = vnet_hdr_sz; - break; - - case TUNGETVNETLE: - le = !!(tun->flags & TUN_VNET_LE); - if (put_user(le, (int __user *)argp)) - ret = -EFAULT; - break; - - case TUNSETVNETLE: - if (get_user(le, (int __user *)argp)) { - ret = -EFAULT; - break; - } - if (le) - tun->flags |= TUN_VNET_LE; - else - tun->flags &= ~TUN_VNET_LE; - break; - - case TUNGETVNETBE: - ret = tun_get_vnet_be(tun, argp); - break; - - case TUNSETVNETBE: - ret = tun_set_vnet_be(tun, argp); - break; - - case TUNATTACHFILTER: - /* Can be set only for TAPs */ - ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) - break; - ret = -EFAULT; - if (copy_from_user(&tun->fprog, argp, sizeof(tun->fprog))) - break; - - ret = tun_attach_filter(tun); - break; - - case TUNDETACHFILTER: - /* Can be set only for TAPs */ - ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) - break; - ret = 0; - tun_detach_filter(tun, tun->numqueues); - break; - - case TUNGETFILTER: - ret = -EINVAL; - if ((tun->flags & TUN_TYPE_MASK) != IFF_TAP) - break; - ret = -EFAULT; - if (copy_to_user(argp, &tun->fprog, sizeof(tun->fprog))) - break; - ret = 0; - break; - - default: - ret = -EINVAL; - break; - } - -unlock: - rtnl_unlock(); - if (tun) - tun_put(tun); - return ret; -} - -static long tun_chr_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) -{ - return __tun_chr_ioctl(file, cmd, arg, sizeof (struct ifreq)); -} - -#ifdef CONFIG_COMPAT -static long tun_chr_compat_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) -{ - switch (cmd) { - case TUNSETIFF: - case TUNGETIFF: - case TUNSETTXFILTER: - case TUNGETSNDBUF: - case TUNSETSNDBUF: - case SIOCGIFHWADDR: - case SIOCSIFHWADDR: - arg = (unsigned long)compat_ptr(arg); - break; - default: - arg = (compat_ulong_t)arg; - break; - } - - /* - * compat_ifreq is shorter than ifreq, so we must not access beyond - * the end of that structure. All fields that are used in this - * driver are compatible though, we don't need to convert the - * contents. - */ - return __tun_chr_ioctl(file, cmd, arg, sizeof(struct compat_ifreq)); -} -#endif /* CONFIG_COMPAT */ - -static int tun_chr_fasync(int fd, struct file *file, int on) -{ - struct tun_file *tfile = file->private_data; - int ret; - - if ((ret = fasync_helper(fd, file, on, &tfile->fasync)) < 0) - goto out; - - if (on) { - __f_setown(file, task_pid(current), PIDTYPE_PID, 0); - tfile->flags |= TUN_FASYNC; - } else - tfile->flags &= ~TUN_FASYNC; - ret = 0; -out: - return ret; -} - -static int tun_chr_open(struct inode *inode, struct file * file) -{ - struct net *net = current->nsproxy->net_ns; - struct tun_file *tfile; - - DBG1(KERN_INFO, "tunX: tun_chr_open\n"); - - tfile = (struct tun_file *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL, - &tun_proto, 0); - if (!tfile) - return -ENOMEM; - RCU_INIT_POINTER(tfile->tun, NULL); - tfile->flags = 0; - tfile->ifindex = 0; - - init_waitqueue_head(&tfile->wq.wait); - RCU_INIT_POINTER(tfile->socket.wq, &tfile->wq); - - tfile->socket.file = file; - tfile->socket.ops = &tun_socket_ops; - - sock_init_data(&tfile->socket, &tfile->sk); - - tfile->sk.sk_write_space = tun_sock_write_space; - tfile->sk.sk_sndbuf = INT_MAX; - - file->private_data = tfile; - INIT_LIST_HEAD(&tfile->next); - - sock_set_flag(&tfile->sk, SOCK_ZEROCOPY); - - memset(&tfile->tx_array, 0, sizeof(tfile->tx_array)); - - return 0; -} - -static int tun_chr_close(struct inode *inode, struct file *file) -{ - struct tun_file *tfile = file->private_data; - - tun_detach(tfile, true); - - return 0; -} - -#ifdef CONFIG_PROC_FS -static void tun_chr_show_fdinfo(struct seq_file *m, struct file *f) -{ - struct tun_struct *tun; - struct ifreq ifr; - - memset(&ifr, 0, sizeof(ifr)); - - rtnl_lock(); - tun = tun_get(f); - if (tun) - tun_get_iff(current->nsproxy->net_ns, tun, &ifr); - rtnl_unlock(); - - if (tun) - tun_put(tun); - - seq_printf(m, "iff:\t%s\n", ifr.ifr_name); -} -#endif - -static const struct file_operations tun_fops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .read_iter = tun_chr_read_iter, - .write_iter = tun_chr_write_iter, - .poll = tun_chr_poll, - .unlocked_ioctl = tun_chr_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = tun_chr_compat_ioctl, -#endif - .open = tun_chr_open, - .release = tun_chr_close, - .fasync = tun_chr_fasync, -#ifdef CONFIG_PROC_FS - .show_fdinfo = tun_chr_show_fdinfo, -#endif -}; - -static struct miscdevice tun_miscdev = { - .minor = TUN_MINOR1, - .name = "bf_tun", - .nodename = "net/bf_tun", - .fops = &tun_fops, -}; - -/* ethtool interface */ - -static int tun_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) -{ - cmd->supported = 0; - cmd->advertising = 0; - ethtool_cmd_speed_set(cmd, SPEED_10); - cmd->duplex = DUPLEX_FULL; - cmd->port = PORT_TP; - cmd->phy_address = 0; - cmd->transceiver = XCVR_INTERNAL; - cmd->autoneg = AUTONEG_DISABLE; - cmd->maxtxpkt = 0; - cmd->maxrxpkt = 0; - return 0; -} - -static void tun_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) -{ - struct tun_struct *tun = netdev_priv(dev); - - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); - - switch (tun->flags & TUN_TYPE_MASK) { - case IFF_TUN: - strlcpy(info->bus_info, "tun", sizeof(info->bus_info)); - break; - case IFF_TAP: - strlcpy(info->bus_info, "tap", sizeof(info->bus_info)); - break; - } -} - -static u32 tun_get_msglevel(struct net_device *dev) -{ -#ifdef TUN_DEBUG - struct tun_struct *tun = netdev_priv(dev); - return tun->debug; -#else - return -EOPNOTSUPP; -#endif -} - -static void tun_set_msglevel(struct net_device *dev, u32 value) -{ -#ifdef TUN_DEBUG - struct tun_struct *tun = netdev_priv(dev); - tun->debug = value; -#endif -} - -static const struct ethtool_ops tun_ethtool_ops = { - .get_settings = tun_get_settings, - .get_drvinfo = tun_get_drvinfo, - .get_msglevel = tun_get_msglevel, - .set_msglevel = tun_set_msglevel, - .get_link = ethtool_op_get_link, - .get_ts_info = ethtool_op_get_ts_info, -}; - -static int tun_queue_resize(struct tun_struct *tun) -{ - struct net_device *dev = tun->dev; - struct tun_file *tfile; - struct skb_array **arrays; - int n = tun->numqueues + tun->numdisabled; - int ret, i; - - arrays = kmalloc(sizeof *arrays * n, GFP_KERNEL); - if (!arrays) - return -ENOMEM; - - for (i = 0; i < tun->numqueues; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); - arrays[i] = &tfile->tx_array; - } - list_for_each_entry(tfile, &tun->disabled, next) - arrays[i++] = &tfile->tx_array; - - ret = skb_array_resize_multiple(arrays, n, - dev->tx_queue_len, GFP_KERNEL); - - kfree(arrays); - return ret; -} - -static int tun_device_event(struct notifier_block *unused, - unsigned long event, void *ptr) -{ - struct net_device *dev = netdev_notifier_info_to_dev(ptr); - struct tun_struct *tun = netdev_priv(dev); - - if (dev->rtnl_link_ops != &tun_link_ops) - return NOTIFY_DONE; - - switch (event) { - case NETDEV_CHANGE_TX_QUEUE_LEN: - if (tun_queue_resize(tun)) - return NOTIFY_BAD; - break; - default: - break; - } - - return NOTIFY_DONE; -} - -static struct notifier_block tun_notifier_block __read_mostly = { - .notifier_call = tun_device_event, -}; - -static int __init tun_init(void) -{ - int ret = 0; - - pr_info("%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); - pr_info("%s\n", DRV_COPYRIGHT); - - ret = rtnl_link_register(&tun_link_ops); - if (ret) { - pr_err("Can't register link_ops\n"); - goto err_linkops; - } - - ret = misc_register(&tun_miscdev); - if (ret) { - pr_err("Can't register misc device %d\n", TUN_MINOR1); - goto err_misc; - } - - register_netdevice_notifier(&tun_notifier_block); - return 0; -err_misc: - rtnl_link_unregister(&tun_link_ops); -err_linkops: - return ret; -} - -static void tun_cleanup(void) -{ - misc_deregister(&tun_miscdev); - rtnl_link_unregister(&tun_link_ops); - unregister_netdevice_notifier(&tun_notifier_block); -} - -/* Get an underlying socket object from tun file. Returns error unless file is - * attached to a device. The returned object works like a packet socket, it - * can be used for sock_sendmsg/sock_recvmsg. The caller is responsible for - * holding a reference to the file for as long as the socket is in use. */ -struct socket *tun_get_socket(struct file *file) -{ - struct tun_file *tfile; - if (file->f_op != &tun_fops) - return ERR_PTR(-EINVAL); - tfile = file->private_data; - if (!tfile) - return ERR_PTR(-EBADFD); - return &tfile->socket; -} -EXPORT_SYMBOL_GPL(tun_get_socket); - -module_init(tun_init); -module_exit(tun_cleanup); -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_AUTHOR(DRV_COPYRIGHT); -MODULE_LICENSE("GPL"); -MODULE_ALIAS_MISCDEV(TUN_MINOR1); -MODULE_ALIAS("devname:net/bf_tun"); From b6a78c332b3bf74a6c03f9c09e7bd6c725a60b49 Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Thu, 25 Oct 2018 09:36:38 -0700 Subject: [PATCH 1705/1833] [barefoot]: Fix deb not included in aboot SWI (#2193) --- platform/barefoot/one-aboot.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/barefoot/one-aboot.mk b/platform/barefoot/one-aboot.mk index 4c4a6b6f626a..71e3a95da3ab 100644 --- a/platform/barefoot/one-aboot.mk +++ b/platform/barefoot/one-aboot.mk @@ -3,7 +3,8 @@ SONIC_ONE_ABOOT_IMAGE = sonic-aboot-barefoot.swi $(SONIC_ONE_ABOOT_IMAGE)_MACHINE = barefoot $(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot -$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(BFN_PLATFORM_MODULE) +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(BFN_MODULE) +$(SONIC_ONE_ABOOT_IMAGE)_LAZY_INSTALLS += $(BFN_PLATFORM_MODULE) $(SONIC_ONE_ABOOT_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_PLATFORM_MODULE) $(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_DRIVERS) \ $(ARISTA_PLATFORM_MODULE_PYTHON2) \ From c3c6de4e5fc75c9c02a5de68bf84e6a857becd12 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 25 Oct 2018 13:10:38 -0700 Subject: [PATCH 1706/1833] [submodule]: update sonic-swss (#2190) * 6e76e9b 2018-10-22 | [vstest]: fix redis mount point with --dvsname option (#654) (HEAD, origin/master, origin/HEAD) [lguohan] * 3d4bed1 2018-10-22 | [mirrororch]: Fix bug when no need to update session type (#648) [Shuotian Cheng] * 4bf28ed 2018-10-22 | Merge pull request #649 from lguohan/vstest [lguohan] |\ | * 8620a51 2018-10-22 | [vstest]: disable ipv6 in test_crm.py::test_CrmFdbEntry [Guohan Lu] | * f684d65 2018-10-21 | change mode to 644 for test_setro.py [Guohan Lu] | * 51e0d40 2018-10-22 | Enable aclfield.data for SAI_DTEL_ATTR_INT_L4_DSCP [Guohan Lu] | * 9290950 2018-10-21 | use unique directory to mount redis.sock [Guohan Lu] | * 7d1b09e 2018-10-21 | add --keeptb option to keep testbed after test [Guohan Lu] | * 6ee779c 2018-10-22 | gather logs from vs container [Guohan Lu] | * 9b49555 2018-10-21 | make sure delete the srv namespace after test [Guohan Lu] | * e04bd2d 2018-10-20 | add testlog for all tests [Guohan Lu] | * a2d9be4 2018-10-20 | simplify start_swss/stop_swss [Guohan Lu] | * d76a560 2018-10-21 | add ingore object type to CountSubscribedObjects [Guohan Lu] | * 5e2c1de 2018-10-20 | refactor test_swss_neighbor_syncup test [Guohan Lu] | * 9e9a553 2018-10-20 | ensure vrfmgrd, teammgrd, portmgrd are running before test [Guohan Lu] |/ * e8e3ddc 2018-10-21 | disable ipv6 for vEthernet interface in virtual switch (#650) [lguohan] * 7c90bb3 2018-10-19 | Fix portorch bake: get port count from db (#645) [Qi Luo] Signed-off-by: Guohan Lu --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 68a962903ae2..6e76e9b9b29e 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 68a962903ae227d76c5367a7a3cacd4063893922 +Subproject commit 6e76e9b9b29e0c31da7f05e87f59f871e15c9674 From b954fa9c13b4d5abac1206a9d6b8dace4dac22d4 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Thu, 25 Oct 2018 13:13:26 -0700 Subject: [PATCH 1707/1833] [ipdecap]: Setup decap destination IP based on platform (#2191) --- dockers/docker-orchagent/ipinip.json.j2 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index cecb62dae2a7..ec4b6f159abe 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -1,11 +1,15 @@ {% set ipv4_addresses = [] %} {% set ipv6_addresses = [] %} +{% set ipv4_loopback_addresses = [] %} +{% set ipv6_loopback_addresses = [] %} {% for (name, prefix) in LOOPBACK_INTERFACE %} {%- if prefix | ipv4 and name == 'Loopback0' %} {%- set ipv4_addresses = ipv4_addresses.append(prefix) %} + {%- set ipv4_loopback_addresses = ipv4_loopback_addresses.append(prefix) %} {%- endif %} {%- if prefix | ipv6 and name == 'Loopback0' %} {%- set ipv6_addresses = ipv6_addresses.append(prefix) %} + {%- set ipv6_loopback_addresses = ipv6_loopback_addresses.append(prefix) %} {%- endif %} {% endfor %} {% for (name, prefix) in INTERFACE %} @@ -33,15 +37,16 @@ {%- endif %} {% endfor %} [ -{% if ipv4_addresses %} +{% if ipv4_loopback_addresses %} { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"{% for prefix in ipv4_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", {% if "mlnx" in DEVICE_METADATA.localhost.platform %} + "dst_ip":"{% for prefix in ipv4_loopback_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}, "dscp_mode":"uniform", "ecn_mode":"standard", {% else %} + "dst_ip":"{% for prefix in ipv4_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", {% endif %} @@ -50,17 +55,18 @@ "OP": "SET" } {% endif %} -{% if ipv4_addresses and ipv6_addresses %} , +{% if ipv4_loopback_addresses and ipv6_loopback_addresses %} , {% endif %} -{% if ipv6_addresses %} +{% if ipv6_loopback_addresses %} { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"{% for prefix in ipv6_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", {% if "mlnx" in DEVICE_METADATA.localhost.platform %} + "dst_ip":"{% for prefix in ipv6_loopback_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}, "dscp_mode":"uniform", "ecn_mode":"standard", {% else %} + "dst_ip":"{% for prefix in ipv6_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", {% endif %} From c904baf579d6b51d7cd272ebfcf42404fecdab09 Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Fri, 26 Oct 2018 09:06:26 -0700 Subject: [PATCH 1708/1833] [devices]: Add index column for 7170 port config (#2195) --- .../Arista-7170-64C/port_config.ini | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini index f6d93ade344f..cbff872de9c8 100644 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/port_config.ini @@ -1,65 +1,65 @@ -# name lanes alias speed -Ethernet0 0,1,2,3 Ethernet1/1 100000 -Ethernet4 4,5,6,7 Ethernet2/1 100000 -Ethernet8 8,9,10,11 Ethernet3/1 100000 -Ethernet12 12,13,14,15 Ethernet4/1 100000 -Ethernet16 16,17,18,19 Ethernet5/1 100000 -Ethernet20 20,21,22,23 Ethernet6/1 100000 -Ethernet24 24,25,26,27 Ethernet7/1 100000 -Ethernet28 28,29,30,31 Ethernet8/1 100000 -Ethernet32 32,33,34,35 Ethernet9/1 100000 -Ethernet36 36,37,38,39 Ethernet10/1 100000 -Ethernet40 40,41,42,43 Ethernet11/1 100000 -Ethernet44 44,45,46,47 Ethernet12/1 100000 -Ethernet48 48,49,50,51 Ethernet13/1 100000 -Ethernet52 52,53,54,55 Ethernet14/1 100000 -Ethernet56 56,57,58,59 Ethernet15/1 100000 -Ethernet60 60,61,62,63 Ethernet16/1 100000 -Ethernet64 64,65,66,67 Ethernet17/1 100000 -Ethernet68 68,69,70,71 Ethernet18/1 100000 -Ethernet72 72,73,74,75 Ethernet19/1 100000 -Ethernet76 76,77,78,79 Ethernet20/1 100000 -Ethernet80 80,81,82,83 Ethernet21/1 100000 -Ethernet84 84,85,86,87 Ethernet22/1 100000 -Ethernet88 88,89,90,91 Ethernet23/1 100000 -Ethernet92 92,93,94,95 Ethernet24/1 100000 -Ethernet96 96,97,98,99 Ethernet25/1 100000 -Ethernet100 100,101,102,103 Ethernet26/1 100000 -Ethernet104 104,105,106,107 Ethernet27/1 100000 -Ethernet108 108,109,110,111 Ethernet28/1 100000 -Ethernet112 112,113,114,115 Ethernet29/1 100000 -Ethernet116 116,117,118,119 Ethernet30/1 100000 -Ethernet120 120,121,122,123 Ethernet31/1 100000 -Ethernet124 124,125,126,127 Ethernet32/1 100000 -Ethernet128 128,129,130,131 Ethernet33/1 100000 -Ethernet132 132,133,134,135 Ethernet34/1 100000 -Ethernet136 136,137,138,139 Ethernet35/1 100000 -Ethernet140 140,141,142,143 Ethernet36/1 100000 -Ethernet144 144,145,146,147 Ethernet37/1 100000 -Ethernet148 148,149,150,151 Ethernet38/1 100000 -Ethernet152 152,153,154,155 Ethernet39/1 100000 -Ethernet156 156,157,158,159 Ethernet40/1 100000 -Ethernet160 160,161,162,163 Ethernet41/1 100000 -Ethernet164 164,165,166,167 Ethernet42/1 100000 -Ethernet168 168,169,170,171 Ethernet43/1 100000 -Ethernet172 172,173,174,175 Ethernet44/1 100000 -Ethernet176 176,177,178,179 Ethernet45/1 100000 -Ethernet180 180,181,182,183 Ethernet46/1 100000 -Ethernet184 184,185,186,187 Ethernet47/1 100000 -Ethernet188 188,189,190,191 Ethernet48/1 100000 -Ethernet192 192,193,194,195 Ethernet49/1 100000 -Ethernet196 196,197,198,199 Ethernet50/1 100000 -Ethernet200 200,201,202,203 Ethernet51/1 100000 -Ethernet204 204,205,206,207 Ethernet52/1 100000 -Ethernet208 208,209,210,211 Ethernet53/1 100000 -Ethernet212 212,213,214,215 Ethernet54/1 100000 -Ethernet216 216,217,218,219 Ethernet55/1 100000 -Ethernet220 220,221,222,223 Ethernet56/1 100000 -Ethernet224 224,225,226,227 Ethernet57/1 100000 -Ethernet228 228,229,230,231 Ethernet58/1 100000 -Ethernet232 232,233,234,235 Ethernet59/1 100000 -Ethernet236 236,237,238,239 Ethernet60/1 100000 -Ethernet240 240,241,242,243 Ethernet61/1 100000 -Ethernet244 244,245,246,247 Ethernet62/1 100000 -Ethernet248 248,249,250,251 Ethernet63/1 100000 -Ethernet252 252,253,254,255 Ethernet64/1 100000 +# name lanes alias speed index +Ethernet0 0,1,2,3 Ethernet1/1 100000 1 +Ethernet4 4,5,6,7 Ethernet2/1 100000 2 +Ethernet8 8,9,10,11 Ethernet3/1 100000 3 +Ethernet12 12,13,14,15 Ethernet4/1 100000 4 +Ethernet16 16,17,18,19 Ethernet5/1 100000 5 +Ethernet20 20,21,22,23 Ethernet6/1 100000 6 +Ethernet24 24,25,26,27 Ethernet7/1 100000 7 +Ethernet28 28,29,30,31 Ethernet8/1 100000 8 +Ethernet32 32,33,34,35 Ethernet9/1 100000 9 +Ethernet36 36,37,38,39 Ethernet10/1 100000 10 +Ethernet40 40,41,42,43 Ethernet11/1 100000 11 +Ethernet44 44,45,46,47 Ethernet12/1 100000 12 +Ethernet48 48,49,50,51 Ethernet13/1 100000 13 +Ethernet52 52,53,54,55 Ethernet14/1 100000 14 +Ethernet56 56,57,58,59 Ethernet15/1 100000 15 +Ethernet60 60,61,62,63 Ethernet16/1 100000 16 +Ethernet64 64,65,66,67 Ethernet17/1 100000 17 +Ethernet68 68,69,70,71 Ethernet18/1 100000 18 +Ethernet72 72,73,74,75 Ethernet19/1 100000 19 +Ethernet76 76,77,78,79 Ethernet20/1 100000 20 +Ethernet80 80,81,82,83 Ethernet21/1 100000 21 +Ethernet84 84,85,86,87 Ethernet22/1 100000 22 +Ethernet88 88,89,90,91 Ethernet23/1 100000 23 +Ethernet92 92,93,94,95 Ethernet24/1 100000 24 +Ethernet96 96,97,98,99 Ethernet25/1 100000 25 +Ethernet100 100,101,102,103 Ethernet26/1 100000 26 +Ethernet104 104,105,106,107 Ethernet27/1 100000 27 +Ethernet108 108,109,110,111 Ethernet28/1 100000 28 +Ethernet112 112,113,114,115 Ethernet29/1 100000 29 +Ethernet116 116,117,118,119 Ethernet30/1 100000 30 +Ethernet120 120,121,122,123 Ethernet31/1 100000 31 +Ethernet124 124,125,126,127 Ethernet32/1 100000 32 +Ethernet128 128,129,130,131 Ethernet33/1 100000 33 +Ethernet132 132,133,134,135 Ethernet34/1 100000 34 +Ethernet136 136,137,138,139 Ethernet35/1 100000 35 +Ethernet140 140,141,142,143 Ethernet36/1 100000 36 +Ethernet144 144,145,146,147 Ethernet37/1 100000 37 +Ethernet148 148,149,150,151 Ethernet38/1 100000 38 +Ethernet152 152,153,154,155 Ethernet39/1 100000 39 +Ethernet156 156,157,158,159 Ethernet40/1 100000 40 +Ethernet160 160,161,162,163 Ethernet41/1 100000 41 +Ethernet164 164,165,166,167 Ethernet42/1 100000 42 +Ethernet168 168,169,170,171 Ethernet43/1 100000 43 +Ethernet172 172,173,174,175 Ethernet44/1 100000 44 +Ethernet176 176,177,178,179 Ethernet45/1 100000 45 +Ethernet180 180,181,182,183 Ethernet46/1 100000 46 +Ethernet184 184,185,186,187 Ethernet47/1 100000 47 +Ethernet188 188,189,190,191 Ethernet48/1 100000 48 +Ethernet192 192,193,194,195 Ethernet49/1 100000 49 +Ethernet196 196,197,198,199 Ethernet50/1 100000 50 +Ethernet200 200,201,202,203 Ethernet51/1 100000 51 +Ethernet204 204,205,206,207 Ethernet52/1 100000 52 +Ethernet208 208,209,210,211 Ethernet53/1 100000 53 +Ethernet212 212,213,214,215 Ethernet54/1 100000 54 +Ethernet216 216,217,218,219 Ethernet55/1 100000 55 +Ethernet220 220,221,222,223 Ethernet56/1 100000 56 +Ethernet224 224,225,226,227 Ethernet57/1 100000 57 +Ethernet228 228,229,230,231 Ethernet58/1 100000 58 +Ethernet232 232,233,234,235 Ethernet59/1 100000 59 +Ethernet236 236,237,238,239 Ethernet60/1 100000 60 +Ethernet240 240,241,242,243 Ethernet61/1 100000 61 +Ethernet244 244,245,246,247 Ethernet62/1 100000 62 +Ethernet248 248,249,250,251 Ethernet63/1 100000 63 +Ethernet252 252,253,254,255 Ethernet64/1 100000 64 From 09ae9a896507e71c66a4eaea9d62b808ec46ab79 Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Fri, 26 Oct 2018 09:13:45 -0700 Subject: [PATCH 1709/1833] In the case of upgrade, have pfcwd enabled on the upgraded sonic (#2192) Signed-off-by: Wenda --- files/image_config/updategraph/updategraph | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 4c084fa8c272..88de38d30668 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -15,6 +15,7 @@ reload_minigraph() acl-loader update full /etc/sonic/acl.json fi config qos reload + pfcwd start_default } From c677fc7091e2d2f63dcbfd762bfde7681ed79905 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Fri, 26 Oct 2018 11:37:57 -0700 Subject: [PATCH 1710/1833] Submodule update for sairedis (#2198) --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 6fdf6ff1ce19..85a579b3c5e1 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 6fdf6ff1ce19beea610de918a02ceb76d37105c2 +Subproject commit 85a579b3c5e172b5d74833c9bd6a7e8f0eff0c4f From 251a850a5029622b6d64814b4109701c332c0f7e Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sat, 27 Oct 2018 07:32:39 +0800 Subject: [PATCH 1711/1833] [submodules]: update sonic-utilities and sonic-platform-daemons (#2200) --- src/sonic-platform-daemons | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index b1b9169bf4cf..bc23ab0b0b87 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit b1b9169bf4cf5b3d0e4778dc51c03b99b15c0c6b +Subproject commit bc23ab0b0b87b3ed022a7728c069e580b70bf23d diff --git a/src/sonic-utilities b/src/sonic-utilities index 4562d570eb37..e3a2febd6a1d 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 4562d570eb3739ffa47b45ffd79919ebe31595db +Subproject commit e3a2febd6a1d318a9f79b4adef029a7232502140 From 483bd9bbd882b8d4fb0513067f55104ed5efb1f7 Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Sat, 27 Oct 2018 07:34:07 +0800 Subject: [PATCH 1712/1833] [platform][Broadcom]Accton, fix building error of kernel modules. (#2197) * [platform]accton, fix building error of kernel modules at platform broadcom. Signed-off-by: roy_lee * Refine codes by formatter. Signed-off-by: roy_lee --- .../modules/accton_as7712_32x_fan.c | 248 +--- .../as7716-32x/modules/Makefile | 2 +- .../modules/accton_as7716_32x_fan.c | 409 ++---- .../modules/accton_as7716_32xb_cpld1.c | 1154 ++++++++--------- .../modules/accton_as7716_32xb_fan.c | 673 +++------- 5 files changed, 913 insertions(+), 1573 deletions(-) mode change 100644 => 100755 platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c mode change 100755 => 100644 platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_fan.c mode change 100755 => 100644 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_cpld1.c mode change 100755 => 100644 platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_fan.c diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c old mode 100644 new mode 100755 index 3eae51cbcea7..73dd36c2883e --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_fan.c @@ -49,8 +49,7 @@ static ssize_t get_enable(struct device *dev, struct device_attribute *da, char static ssize_t set_enable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); -extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); -extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + /* fan related data, the index should match sysfs_fan_attributes */ @@ -291,7 +290,6 @@ static ssize_t set_enable(struct device *dev, struct device_attribute *da, return count; } - static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf) { @@ -299,6 +297,7 @@ static ssize_t get_enable(struct device *dev, struct device_attribute *da, return sprintf(buf, "%u\n", data->enable); } + static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count) { @@ -319,238 +318,97 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, return count; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) +static bool lm75_addr_mached(unsigned short addr) { - struct lm75_data *data = NULL; + int i; + unsigned short addrs[] = THERMAL_SENSORS_ADDRS; - data = i2c_get_clientdata(client); - if(data) + for (i = 0; i < ARRAY_SIZE(addrs); i++) { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - + if( addr == addrs[i]) + return 1; } - return NULL; + return 0; } -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - OUT int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; +/* Struct and define are copied from drivers/hwmon/hwmon.c. */ +struct hwmon_device { + const char *name; + struct device dev; + const struct hwmon_chip_info *chip; -#undef MAX_HWMON_DEVICE -} + struct attribute_group group; + const struct attribute_group **groups; +}; +#define to_hwmon_device(d) container_of(d, struct hwmon_device, dev) -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) +/*Find the 1st valid dev of all childs, it supposes to have only 1 child.*/ +static int is_valid_dev(struct device *dev, void *data) { - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; + struct hwmon_device *hwmon_dev; + + if(dev) { + hwmon_dev = to_hwmon_device(dev); + if(hwmon_dev) { + int ret; + long t; + ret = hwmon_dev->chip->ops->read(dev, hwmon_temp, hwmon_temp_input, + 0, &t); + return !ret; } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); } return 0; } -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} -static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) +static int hwmon_get_temp(struct device *dev, long *mini_cel) { - struct lm75_data *data = NULL; + struct hwmon_device *hwmon_dev = to_hwmon_device(dev); + int ret = 0; - data = i2c_get_clientdata(client); - *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); + if(hwmon_dev) { + long t; + ret = hwmon_dev->chip->ops->read(dev, hwmon_temp, hwmon_temp_input, + 0, &t); + if (ret < 0) + return ret; - return 0; -} - -static bool lm75_addr_mached(unsigned short addr) -{ - int i; - unsigned short addrs[] = THERMAL_SENSORS_ADDRS; - - for (i = 0; i < ARRAY_SIZE(addrs); i++) - { - if( addr == addrs[i]) - return 1; + *mini_cel = t; } - return 0; + return ret; } +/* Find devices under i2c_bus which with driver = lm75. + * Use the device to find its descendent hwmon_dev and read the temperature. + */ static int _find_lm75_device(struct device *dev, void *data) { struct device_driver *driver; struct as7712_32x_fan_data *prv = data; char *driver_name = THERMAL_SENSORS_DRIVER; + struct i2c_client *client; driver = dev->driver; if (driver && driver->name && strcmp(driver->name, driver_name) == 0) { - struct i2c_client *client; + client = to_i2c_client(dev); if (client) { - /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ - struct i2c_adapter *adap = client->adapter; - int miniCelsius = 0; + long miniCelsius = 0; + struct device *child_dev; if (! lm75_addr_mached(client->addr)) { return 0; } - if (!adap) { - return -ENXIO; - } - - /* If the data is not updated, read them from devfile - to drive them updateing data from chip.*/ - if (is_lm75_data_due(client)) - { - struct device *hwmon_dev; - - hwmon_dev = get_hwmon_dev(client); - if(0 == read_devfile_temp1_input(dev, adap->nr, - client->addr, hwmon_dev, &miniCelsius)) - { - prv->system_temp += miniCelsius; - prv->sensors_found++; - } + child_dev = device_find_child(dev, NULL, is_valid_dev); + if(child_dev) { + int ret = hwmon_get_temp(child_dev, &miniCelsius); + if (ret < 0) + return ret; - } - else - { - get_lm75_temp(client, &miniCelsius); prv->system_temp += miniCelsius; prv->sensors_found++; diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/Makefile index 4c0942afb97e..6cdbdd81ac1e 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/Makefile @@ -1,7 +1,7 @@ ifneq ($(KERNELRELEASE),) obj-m:= accton_as7716_32x_cpld1.o accton_as7716_32x_fan.o \ accton_as7716_32x_leds.o accton_as7716_32x_psu.o cpr_4011_4mxx.o ym2651y.o \ - optoe.o accton_i2c_cpld.o + accton_i2c_cpld.o else ifeq (,$(KERNEL_SRC)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_fan.c old mode 100755 new mode 100644 index 83b7bceeb99e..3a0610fe370d --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_fan.c @@ -34,22 +34,16 @@ #define DRVNAME "as7716_32x_fan" -#define NUM_THERMAL_SENSORS (3) /* Get sum of this number of sensors.*/ -#define THERMAL_SENSORS_DRIVER "lm75" - #define IN #define OUT static struct as7716_32x_fan_data *as7716_32x_fan_update_device(struct device *dev); static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, - const char *buf, size_t count); + const char *buf, size_t count); static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_enable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); -extern int as7716_32x_cpld_read(unsigned short cpld_addr, u8 reg); -extern int as7716_32x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); /* fan related data, the index should match sysfs_fan_attributes */ @@ -79,8 +73,6 @@ struct as7716_32x_fan_data { unsigned long last_updated; /* In jiffies */ u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ u8 enable; - int system_temp; /*In unit of mini-Celsius*/ - int sensors_found; }; enum fan_id { @@ -149,12 +141,6 @@ enum sysfs_fan_attributes { &sensor_dev_attr_pwm##index.dev_attr.attr, \ &sensor_dev_attr_pwm##index##_enable.dev_attr.attr -#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ - static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) - -#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr - - #define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) #define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr @@ -200,8 +186,6 @@ DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); /* 1 fan duty cycle attribute in this platform */ DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); -/* System temperature for fancontrol */ -DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); static struct attribute *as7716_32x_fan_attributes[] = { /* fan related attributes */ @@ -230,7 +214,6 @@ static struct attribute *as7716_32x_fan_attributes[] = { DECLARE_FAN_DIRECTION_ATTR(5), DECLARE_FAN_DIRECTION_ATTR(6), DECLARE_FAN_DUTY_CYCLE_ATTR(1), - DECLARE_FAN_SYSTEM_TEMP_ATTR(), NULL }; @@ -250,13 +233,13 @@ static int as7716_32x_fan_write_value(struct i2c_client *client, u8 reg, u8 valu /* fan utility functions */ -static u32 reg_val_to_duty_cycle(u8 reg_val) +static u32 reg_val_to_duty_cycle(u8 reg_val) { reg_val &= FAN_DUTY_CYCLE_REG_MASK; return ((u32)(reg_val+1) * 625 + 75)/ 100; } -static u8 duty_cycle_to_reg_val(u8 duty_cycle) +static u8 duty_cycle_to_reg_val(u8 duty_cycle) { return ((u32)duty_cycle * 100 / 625) - 1; } @@ -289,10 +272,10 @@ static u8 is_fan_fault(struct as7716_32x_fan_data *data, enum fan_id id) int front_fan_index = FAN1_FRONT_SPEED_RPM + id; int rear_fan_index = FAN1_REAR_SPEED_RPM + id; - /* Check if the speed of front or rear fan is ZERO, + /* Check if the speed of front or rear fan is ZERO, */ if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && - reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { ret = 0; } @@ -328,329 +311,87 @@ static ssize_t get_enable(struct device *dev, struct device_attribute *da, return sprintf(buf, "%u\n", data->enable); } + static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) + const char *buf, size_t count) { int error, value; struct i2c_client *client = to_i2c_client(dev); - + error = kstrtoint(buf, 10, &value); if (error) return error; - + if (value < 0 || value > FAN_MAX_DUTY_CYCLE) return -EINVAL; - + as7716_32x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ as7716_32x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); return count; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if(data) - { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - - } - return NULL; -} - -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - OUT int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; - -#undef MAX_HWMON_DEVICE -} - -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) -{ - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; - } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - } - return 0; -} - -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} -static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); - - return 0; -} - -static int _find_lm75_device(struct device *dev, void *data) -{ - struct device_driver *driver; - struct as7716_32x_fan_data *prv = data; - char *driver_name = THERMAL_SENSORS_DRIVER; - - driver = dev->driver; - if (driver && driver->name && - strcmp(driver->name, driver_name) == 0) - { - struct i2c_client *client; - client = to_i2c_client(dev); - if (client) - { - /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ - struct i2c_adapter *adap = client->adapter; - int miniCelsius = 0; - - - if (!adap) { - return -ENXIO; - } - - /* If the data is not updated, read them from devfile - to drive them updateing data from chip.*/ - if (is_lm75_data_due(client)) - { - struct device *hwmon_dev; - - hwmon_dev = get_hwmon_dev(client); - if(0 == read_devfile_temp1_input(dev, adap->nr, - client->addr, hwmon_dev, &miniCelsius)) - { - prv->system_temp += miniCelsius; - prv->sensors_found++; - } - - } - else - { - get_lm75_temp(client, &miniCelsius); - prv->system_temp += miniCelsius; - prv->sensors_found++; - - } - } - } - return 0; -} - -/*Find all lm75 devices and return sum of temperatures.*/ -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, - char *buf) -{ - ssize_t ret = 0; - struct as7716_32x_fan_data *data = as7716_32x_fan_update_device(dev); - - data->system_temp=0; - data->sensors_found=0; - i2c_for_each_dev(data, _find_lm75_device); - if (NUM_THERMAL_SENSORS != data->sensors_found) - { - dev_dbg(dev,"only %d of %d temps are found\n", - data->sensors_found, NUM_THERMAL_SENSORS); - data->system_temp = 0; - } - ret = sprintf(buf, "%d\n",data->system_temp); - return ret; -} static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, - char *buf) + char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct as7716_32x_fan_data *data = as7716_32x_fan_update_device(dev); ssize_t ret = 0; - + if (data->valid) { switch (attr->index) { - case FAN_DUTY_CYCLE_PERCENTAGE: - { - u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); - ret = sprintf(buf, "%u\n", duty_cycle); - break; - } - case FAN1_FRONT_SPEED_RPM: - case FAN2_FRONT_SPEED_RPM: - case FAN3_FRONT_SPEED_RPM: - case FAN4_FRONT_SPEED_RPM: - case FAN5_FRONT_SPEED_RPM: - case FAN6_FRONT_SPEED_RPM: - case FAN1_REAR_SPEED_RPM: - case FAN2_REAR_SPEED_RPM: - case FAN3_REAR_SPEED_RPM: - case FAN4_REAR_SPEED_RPM: - case FAN5_REAR_SPEED_RPM: - case FAN6_REAR_SPEED_RPM: - ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); - break; - case FAN1_PRESENT: - case FAN2_PRESENT: - case FAN3_PRESENT: - case FAN4_PRESENT: - case FAN5_PRESENT: - case FAN6_PRESENT: - ret = sprintf(buf, "%d\n", - reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], - attr->index - FAN1_PRESENT)); - break; - case FAN1_FAULT: - case FAN2_FAULT: - case FAN3_FAULT: - case FAN4_FAULT: - case FAN5_FAULT: - case FAN6_FAULT: - ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); - break; - case FAN1_DIRECTION: - case FAN2_DIRECTION: - case FAN3_DIRECTION: - case FAN4_DIRECTION: - case FAN5_DIRECTION: - case FAN6_DIRECTION: - ret = sprintf(buf, "%d\n", - reg_val_to_direction(data->reg_val[FAN_DIRECTION_REG], - attr->index - FAN1_DIRECTION)); - break; - default: - break; - } + case FAN_DUTY_CYCLE_PERCENTAGE: + { + u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + ret = sprintf(buf, "%d\n", + reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], + attr->index - FAN1_PRESENT)); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + case FAN6_DIRECTION: + ret = sprintf(buf, "%d\n", + reg_val_to_direction(data->reg_val[FAN_DIRECTION_REG], + attr->index - FAN1_DIRECTION)); + break; + default: + break; + } } - + return ret; } @@ -665,18 +406,18 @@ static struct as7716_32x_fan_data *as7716_32x_fan_update_device(struct device *d mutex_lock(&data->update_lock); - if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || - !data->valid) { + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { int i; dev_dbg(&client->dev, "Starting as7716_32x_fan update\n"); data->valid = 0; - + /* Update fan data */ for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { int status = as7716_32x_fan_read_value(client, fan_reg[i]); - + if (status < 0) { data->valid = 0; mutex_unlock(&data->update_lock); @@ -687,18 +428,18 @@ static struct as7716_32x_fan_data *as7716_32x_fan_update_device(struct device *d data->reg_val[i] = status; } } - + data->last_updated = jiffies; data->valid = 1; } - + mutex_unlock(&data->update_lock); return data; } static int as7716_32x_fan_probe(struct i2c_client *client, - const struct i2c_device_id *dev_id) + const struct i2c_device_id *dev_id) { struct as7716_32x_fan_data *data; int status; @@ -733,8 +474,8 @@ static int as7716_32x_fan_probe(struct i2c_client *client, } dev_info(&client->dev, "%s: fan '%s'\n", - dev_name(data->hwmon_dev), client->name); - + dev_name(data->hwmon_dev), client->name); + return 0; exit_remove: @@ -742,7 +483,7 @@ static int as7716_32x_fan_probe(struct i2c_client *client, exit_free: kfree(data); exit: - + return status; } @@ -751,7 +492,7 @@ static int as7716_32x_fan_remove(struct i2c_client *client) struct as7716_32x_fan_data *data = i2c_get_clientdata(client); hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&client->dev.kobj, &as7716_32x_fan_group); - + return 0; } diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_cpld1.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_cpld1.c old mode 100755 new mode 100644 index d2db4fb1f484..c322972481ba --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_cpld1.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_cpld1.c @@ -38,8 +38,8 @@ static LIST_HEAD(cpld_client_list); static struct mutex list_lock; struct cpld_client_node { - struct i2c_client *client; - struct list_head list; + struct i2c_client *client; + struct list_head list; }; #define I2C_RW_RETRY_COUNT 10 @@ -47,25 +47,25 @@ struct cpld_client_node { #define STRING_TO_DEC_VALUE 10 static ssize_t show_present(struct device *dev, struct device_attribute *da, - char *buf); + char *buf); static ssize_t show_present_all(struct device *dev, struct device_attribute *da, - char *buf); + char *buf); static ssize_t access(struct device *dev, struct device_attribute *da, - const char *buf, size_t count); + const char *buf, size_t count); static ssize_t show_version(struct device *dev, struct device_attribute *da, - char *buf); + char *buf); static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, - char *buf); + char *buf); static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, - const char *buf, size_t count); + const char *buf, size_t count); static int as7716_32xb_cpld_read_internal(struct i2c_client *client, u8 reg); static int as7716_32xb_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value); static ssize_t sfp_value_show(struct device *dev, struct device_attribute *da, - char *buf); + char *buf); static ssize_t sfp_value_store(struct device *dev, struct device_attribute *da, - char *buf, size_t size); + const char *buf, size_t size); #define PORT_NUM_MAX 32 @@ -119,77 +119,77 @@ static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; #define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index enum as7716_32xb_cpld_sysfs_attributes { - CPLD_VERSION, - ACCESS, - MODULE_PRESENT_ALL, - /* transceiver attributes */ - TRANSCEIVER_PRESENT_ATTR_ID(1), - TRANSCEIVER_PRESENT_ATTR_ID(2), - TRANSCEIVER_PRESENT_ATTR_ID(3), - TRANSCEIVER_PRESENT_ATTR_ID(4), - TRANSCEIVER_PRESENT_ATTR_ID(5), - TRANSCEIVER_PRESENT_ATTR_ID(6), - TRANSCEIVER_PRESENT_ATTR_ID(7), - TRANSCEIVER_PRESENT_ATTR_ID(8), - TRANSCEIVER_PRESENT_ATTR_ID(9), - TRANSCEIVER_PRESENT_ATTR_ID(10), - TRANSCEIVER_PRESENT_ATTR_ID(11), - TRANSCEIVER_PRESENT_ATTR_ID(12), - TRANSCEIVER_PRESENT_ATTR_ID(13), - TRANSCEIVER_PRESENT_ATTR_ID(14), - TRANSCEIVER_PRESENT_ATTR_ID(15), - TRANSCEIVER_PRESENT_ATTR_ID(16), - TRANSCEIVER_PRESENT_ATTR_ID(17), - TRANSCEIVER_PRESENT_ATTR_ID(18), - TRANSCEIVER_PRESENT_ATTR_ID(19), - TRANSCEIVER_PRESENT_ATTR_ID(20), - TRANSCEIVER_PRESENT_ATTR_ID(21), - TRANSCEIVER_PRESENT_ATTR_ID(22), - TRANSCEIVER_PRESENT_ATTR_ID(23), - TRANSCEIVER_PRESENT_ATTR_ID(24), - TRANSCEIVER_PRESENT_ATTR_ID(25), - TRANSCEIVER_PRESENT_ATTR_ID(26), - TRANSCEIVER_PRESENT_ATTR_ID(27), - TRANSCEIVER_PRESENT_ATTR_ID(28), - TRANSCEIVER_PRESENT_ATTR_ID(29), - TRANSCEIVER_PRESENT_ATTR_ID(30), - TRANSCEIVER_PRESENT_ATTR_ID(31), - TRANSCEIVER_PRESENT_ATTR_ID(32), - TRANSCEIVER_RESET_ATTR_ID(1), - TRANSCEIVER_RESET_ATTR_ID(2), - TRANSCEIVER_RESET_ATTR_ID(3), - TRANSCEIVER_RESET_ATTR_ID(4), - TRANSCEIVER_RESET_ATTR_ID(5), - TRANSCEIVER_RESET_ATTR_ID(6), - TRANSCEIVER_RESET_ATTR_ID(7), - TRANSCEIVER_RESET_ATTR_ID(8), - TRANSCEIVER_RESET_ATTR_ID(9), - TRANSCEIVER_RESET_ATTR_ID(10), - TRANSCEIVER_RESET_ATTR_ID(11), - TRANSCEIVER_RESET_ATTR_ID(12), - TRANSCEIVER_RESET_ATTR_ID(13), - TRANSCEIVER_RESET_ATTR_ID(14), - TRANSCEIVER_RESET_ATTR_ID(15), - TRANSCEIVER_RESET_ATTR_ID(16), - TRANSCEIVER_RESET_ATTR_ID(17), - TRANSCEIVER_RESET_ATTR_ID(18), - TRANSCEIVER_RESET_ATTR_ID(19), - TRANSCEIVER_RESET_ATTR_ID(20), - TRANSCEIVER_RESET_ATTR_ID(21), - TRANSCEIVER_RESET_ATTR_ID(22), - TRANSCEIVER_RESET_ATTR_ID(23), - TRANSCEIVER_RESET_ATTR_ID(24), - TRANSCEIVER_RESET_ATTR_ID(25), - TRANSCEIVER_RESET_ATTR_ID(26), - TRANSCEIVER_RESET_ATTR_ID(27), - TRANSCEIVER_RESET_ATTR_ID(28), - TRANSCEIVER_RESET_ATTR_ID(29), - TRANSCEIVER_RESET_ATTR_ID(30), - TRANSCEIVER_RESET_ATTR_ID(31), - TRANSCEIVER_RESET_ATTR_ID(32), + CPLD_VERSION, + ACCESS, + MODULE_PRESENT_ALL, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + TRANSCEIVER_RESET_ATTR_ID(1), + TRANSCEIVER_RESET_ATTR_ID(2), + TRANSCEIVER_RESET_ATTR_ID(3), + TRANSCEIVER_RESET_ATTR_ID(4), + TRANSCEIVER_RESET_ATTR_ID(5), + TRANSCEIVER_RESET_ATTR_ID(6), + TRANSCEIVER_RESET_ATTR_ID(7), + TRANSCEIVER_RESET_ATTR_ID(8), + TRANSCEIVER_RESET_ATTR_ID(9), + TRANSCEIVER_RESET_ATTR_ID(10), + TRANSCEIVER_RESET_ATTR_ID(11), + TRANSCEIVER_RESET_ATTR_ID(12), + TRANSCEIVER_RESET_ATTR_ID(13), + TRANSCEIVER_RESET_ATTR_ID(14), + TRANSCEIVER_RESET_ATTR_ID(15), + TRANSCEIVER_RESET_ATTR_ID(16), + TRANSCEIVER_RESET_ATTR_ID(17), + TRANSCEIVER_RESET_ATTR_ID(18), + TRANSCEIVER_RESET_ATTR_ID(19), + TRANSCEIVER_RESET_ATTR_ID(20), + TRANSCEIVER_RESET_ATTR_ID(21), + TRANSCEIVER_RESET_ATTR_ID(22), + TRANSCEIVER_RESET_ATTR_ID(23), + TRANSCEIVER_RESET_ATTR_ID(24), + TRANSCEIVER_RESET_ATTR_ID(25), + TRANSCEIVER_RESET_ATTR_ID(26), + TRANSCEIVER_RESET_ATTR_ID(27), + TRANSCEIVER_RESET_ATTR_ID(28), + TRANSCEIVER_RESET_ATTR_ID(29), + TRANSCEIVER_RESET_ATTR_ID(30), + TRANSCEIVER_RESET_ATTR_ID(31), + TRANSCEIVER_RESET_ATTR_ID(32), }; -/* sysfs attributes for hwmon +/* sysfs attributes for hwmon */ /* transceiver attributes */ @@ -283,93 +283,93 @@ DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(32); static struct attribute *as7716_32xb_cpld_attributes[] = { &sensor_dev_attr_version.dev_attr.attr, &sensor_dev_attr_access.dev_attr.attr, - /* transceiver attributes */ - &sensor_dev_attr_module_present_all.dev_attr.attr, - DECLARE_TRANSCEIVER_ATTR(1), - DECLARE_TRANSCEIVER_ATTR(2), - DECLARE_TRANSCEIVER_ATTR(3), - DECLARE_TRANSCEIVER_ATTR(4), - DECLARE_TRANSCEIVER_ATTR(5), - DECLARE_TRANSCEIVER_ATTR(6), - DECLARE_TRANSCEIVER_ATTR(7), - DECLARE_TRANSCEIVER_ATTR(8), - DECLARE_TRANSCEIVER_ATTR(9), - DECLARE_TRANSCEIVER_ATTR(10), - DECLARE_TRANSCEIVER_ATTR(11), - DECLARE_TRANSCEIVER_ATTR(12), - DECLARE_TRANSCEIVER_ATTR(13), - DECLARE_TRANSCEIVER_ATTR(14), - DECLARE_TRANSCEIVER_ATTR(15), - DECLARE_TRANSCEIVER_ATTR(16), - DECLARE_TRANSCEIVER_ATTR(17), - DECLARE_TRANSCEIVER_ATTR(18), - DECLARE_TRANSCEIVER_ATTR(19), - DECLARE_TRANSCEIVER_ATTR(20), - DECLARE_TRANSCEIVER_ATTR(21), - DECLARE_TRANSCEIVER_ATTR(22), - DECLARE_TRANSCEIVER_ATTR(23), - DECLARE_TRANSCEIVER_ATTR(24), - DECLARE_TRANSCEIVER_ATTR(25), - DECLARE_TRANSCEIVER_ATTR(26), - DECLARE_TRANSCEIVER_ATTR(27), - DECLARE_TRANSCEIVER_ATTR(28), - DECLARE_TRANSCEIVER_ATTR(29), - DECLARE_TRANSCEIVER_ATTR(30), - DECLARE_TRANSCEIVER_ATTR(31), - DECLARE_TRANSCEIVER_ATTR(32), - DECLARE_TRANSCEIVER_RESET_ATTR(1), - DECLARE_TRANSCEIVER_RESET_ATTR(2), - DECLARE_TRANSCEIVER_RESET_ATTR(3), - DECLARE_TRANSCEIVER_RESET_ATTR(4), - DECLARE_TRANSCEIVER_RESET_ATTR(5), - DECLARE_TRANSCEIVER_RESET_ATTR(6), - DECLARE_TRANSCEIVER_RESET_ATTR(7), - DECLARE_TRANSCEIVER_RESET_ATTR(8), - DECLARE_TRANSCEIVER_RESET_ATTR(9), - DECLARE_TRANSCEIVER_RESET_ATTR(10), - DECLARE_TRANSCEIVER_RESET_ATTR(11), - DECLARE_TRANSCEIVER_RESET_ATTR(12), - DECLARE_TRANSCEIVER_RESET_ATTR(13), - DECLARE_TRANSCEIVER_RESET_ATTR(14), - DECLARE_TRANSCEIVER_RESET_ATTR(15), - DECLARE_TRANSCEIVER_RESET_ATTR(16), - DECLARE_TRANSCEIVER_RESET_ATTR(17), - DECLARE_TRANSCEIVER_RESET_ATTR(18), - DECLARE_TRANSCEIVER_RESET_ATTR(19), - DECLARE_TRANSCEIVER_RESET_ATTR(20), - DECLARE_TRANSCEIVER_RESET_ATTR(21), - DECLARE_TRANSCEIVER_RESET_ATTR(22), - DECLARE_TRANSCEIVER_RESET_ATTR(23), - DECLARE_TRANSCEIVER_RESET_ATTR(24), - DECLARE_TRANSCEIVER_RESET_ATTR(25), - DECLARE_TRANSCEIVER_RESET_ATTR(26), - DECLARE_TRANSCEIVER_RESET_ATTR(27), - DECLARE_TRANSCEIVER_RESET_ATTR(28), - DECLARE_TRANSCEIVER_RESET_ATTR(29), - DECLARE_TRANSCEIVER_RESET_ATTR(30), - DECLARE_TRANSCEIVER_RESET_ATTR(31), - DECLARE_TRANSCEIVER_RESET_ATTR(32), - NULL + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + DECLARE_TRANSCEIVER_ATTR(1), + DECLARE_TRANSCEIVER_ATTR(2), + DECLARE_TRANSCEIVER_ATTR(3), + DECLARE_TRANSCEIVER_ATTR(4), + DECLARE_TRANSCEIVER_ATTR(5), + DECLARE_TRANSCEIVER_ATTR(6), + DECLARE_TRANSCEIVER_ATTR(7), + DECLARE_TRANSCEIVER_ATTR(8), + DECLARE_TRANSCEIVER_ATTR(9), + DECLARE_TRANSCEIVER_ATTR(10), + DECLARE_TRANSCEIVER_ATTR(11), + DECLARE_TRANSCEIVER_ATTR(12), + DECLARE_TRANSCEIVER_ATTR(13), + DECLARE_TRANSCEIVER_ATTR(14), + DECLARE_TRANSCEIVER_ATTR(15), + DECLARE_TRANSCEIVER_ATTR(16), + DECLARE_TRANSCEIVER_ATTR(17), + DECLARE_TRANSCEIVER_ATTR(18), + DECLARE_TRANSCEIVER_ATTR(19), + DECLARE_TRANSCEIVER_ATTR(20), + DECLARE_TRANSCEIVER_ATTR(21), + DECLARE_TRANSCEIVER_ATTR(22), + DECLARE_TRANSCEIVER_ATTR(23), + DECLARE_TRANSCEIVER_ATTR(24), + DECLARE_TRANSCEIVER_ATTR(25), + DECLARE_TRANSCEIVER_ATTR(26), + DECLARE_TRANSCEIVER_ATTR(27), + DECLARE_TRANSCEIVER_ATTR(28), + DECLARE_TRANSCEIVER_ATTR(29), + DECLARE_TRANSCEIVER_ATTR(30), + DECLARE_TRANSCEIVER_ATTR(31), + DECLARE_TRANSCEIVER_ATTR(32), + DECLARE_TRANSCEIVER_RESET_ATTR(1), + DECLARE_TRANSCEIVER_RESET_ATTR(2), + DECLARE_TRANSCEIVER_RESET_ATTR(3), + DECLARE_TRANSCEIVER_RESET_ATTR(4), + DECLARE_TRANSCEIVER_RESET_ATTR(5), + DECLARE_TRANSCEIVER_RESET_ATTR(6), + DECLARE_TRANSCEIVER_RESET_ATTR(7), + DECLARE_TRANSCEIVER_RESET_ATTR(8), + DECLARE_TRANSCEIVER_RESET_ATTR(9), + DECLARE_TRANSCEIVER_RESET_ATTR(10), + DECLARE_TRANSCEIVER_RESET_ATTR(11), + DECLARE_TRANSCEIVER_RESET_ATTR(12), + DECLARE_TRANSCEIVER_RESET_ATTR(13), + DECLARE_TRANSCEIVER_RESET_ATTR(14), + DECLARE_TRANSCEIVER_RESET_ATTR(15), + DECLARE_TRANSCEIVER_RESET_ATTR(16), + DECLARE_TRANSCEIVER_RESET_ATTR(17), + DECLARE_TRANSCEIVER_RESET_ATTR(18), + DECLARE_TRANSCEIVER_RESET_ATTR(19), + DECLARE_TRANSCEIVER_RESET_ATTR(20), + DECLARE_TRANSCEIVER_RESET_ATTR(21), + DECLARE_TRANSCEIVER_RESET_ATTR(22), + DECLARE_TRANSCEIVER_RESET_ATTR(23), + DECLARE_TRANSCEIVER_RESET_ATTR(24), + DECLARE_TRANSCEIVER_RESET_ATTR(25), + DECLARE_TRANSCEIVER_RESET_ATTR(26), + DECLARE_TRANSCEIVER_RESET_ATTR(27), + DECLARE_TRANSCEIVER_RESET_ATTR(28), + DECLARE_TRANSCEIVER_RESET_ATTR(29), + DECLARE_TRANSCEIVER_RESET_ATTR(30), + DECLARE_TRANSCEIVER_RESET_ATTR(31), + DECLARE_TRANSCEIVER_RESET_ATTR(32), + NULL }; static const struct attribute_group as7716_32xb_cpld_group = { - .attrs = as7716_32xb_cpld_attributes, + .attrs = as7716_32xb_cpld_attributes, }; static ssize_t show_present_all(struct device *dev, struct device_attribute *da, - char *buf) + char *buf) { - int i, status; - u8 values[4] = {0}; - u8 regs[] = {0x30, 0x31, 0x32, 0x33}; - struct i2c_client *client = to_i2c_client(dev); - struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); + int i, status; + u8 values[4] = {0}; + u8 regs[] = {0x30, 0x31, 0x32, 0x33}; + struct i2c_client *client = to_i2c_client(dev); + struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); - mutex_lock(&data->update_lock); + mutex_lock(&data->update_lock); for (i = 0; i < ARRAY_SIZE(regs); i++) { status = as7716_32xb_cpld_read_internal(client, regs[i]); - + if (status < 0) { goto exit; } @@ -377,7 +377,7 @@ static ssize_t show_present_all(struct device *dev, struct device_attribute *da, values[i] = ~(u8)status; } - mutex_unlock(&data->update_lock); + mutex_unlock(&data->update_lock); /* Return values 1 -> 32 in order */ return sprintf(buf, "%.2x %.2x %.2x %.2x\n", @@ -385,118 +385,118 @@ static ssize_t show_present_all(struct device *dev, struct device_attribute *da, values[3]); exit: - mutex_unlock(&data->update_lock); - return status; + mutex_unlock(&data->update_lock); + return status; } static int sfp_array_index_get(int attr_idx) -{ - switch(attr_idx) - { - case TRANSCEIVER_PRESENT_ATTR_ID(1): - case TRANSCEIVER_RESET_ATTR_ID(1): - return PORT1_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(2): - case TRANSCEIVER_RESET_ATTR_ID(2): - return PORT2_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(3): - case TRANSCEIVER_RESET_ATTR_ID(3): - return PORT3_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(4): - case TRANSCEIVER_RESET_ATTR_ID(4): - return PORT4_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(5): - case TRANSCEIVER_RESET_ATTR_ID(5): - return PORT5_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(6): - case TRANSCEIVER_RESET_ATTR_ID(6): - return PORT6_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(7): - case TRANSCEIVER_RESET_ATTR_ID(7): - return PORT7_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(8): - case TRANSCEIVER_RESET_ATTR_ID(8): - return PORT8_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(9): - case TRANSCEIVER_RESET_ATTR_ID(9): - return PORT9_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(10): - case TRANSCEIVER_RESET_ATTR_ID(10): - return PORT10_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(11): - case TRANSCEIVER_RESET_ATTR_ID(11): - return PORT11_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(12): - case TRANSCEIVER_RESET_ATTR_ID(12): - return PORT12_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(13): - case TRANSCEIVER_RESET_ATTR_ID(13): - return PORT13_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(14): - case TRANSCEIVER_RESET_ATTR_ID(14): - return PORT14_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(15): - case TRANSCEIVER_RESET_ATTR_ID(15): - return PORT15_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(16): - case TRANSCEIVER_RESET_ATTR_ID(16): - return PORT16_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(17): - case TRANSCEIVER_RESET_ATTR_ID(17): - return PORT17_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(18): - case TRANSCEIVER_RESET_ATTR_ID(18): - return PORT18_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(19): - case TRANSCEIVER_RESET_ATTR_ID(19): - return PORT19_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(20): - case TRANSCEIVER_RESET_ATTR_ID(20): - return PORT20_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(21): - case TRANSCEIVER_RESET_ATTR_ID(21): - return PORT21_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(22): - case TRANSCEIVER_RESET_ATTR_ID(22): - return PORT22_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(23): - case TRANSCEIVER_RESET_ATTR_ID(23): - return PORT23_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(24): - case TRANSCEIVER_RESET_ATTR_ID(24): - return PORT24_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(25): - case TRANSCEIVER_RESET_ATTR_ID(25): - return PORT25_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(26): - case TRANSCEIVER_RESET_ATTR_ID(26): - return PORT26_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(27): - case TRANSCEIVER_RESET_ATTR_ID(27): - return PORT27_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(28): - case TRANSCEIVER_RESET_ATTR_ID(28): - return PORT28_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(29): - case TRANSCEIVER_RESET_ATTR_ID(29): - return PORT29_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(30): - case TRANSCEIVER_RESET_ATTR_ID(30): - return PORT30_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(31): - case TRANSCEIVER_RESET_ATTR_ID(31): - return PORT31_ID; - case TRANSCEIVER_PRESENT_ATTR_ID(32): - case TRANSCEIVER_RESET_ATTR_ID(32): - return PORT32_ID; - default : - return -1; - } +{ + switch(attr_idx) + { + case TRANSCEIVER_PRESENT_ATTR_ID(1): + case TRANSCEIVER_RESET_ATTR_ID(1): + return PORT1_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(2): + case TRANSCEIVER_RESET_ATTR_ID(2): + return PORT2_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(3): + case TRANSCEIVER_RESET_ATTR_ID(3): + return PORT3_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(4): + case TRANSCEIVER_RESET_ATTR_ID(4): + return PORT4_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(5): + case TRANSCEIVER_RESET_ATTR_ID(5): + return PORT5_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(6): + case TRANSCEIVER_RESET_ATTR_ID(6): + return PORT6_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(7): + case TRANSCEIVER_RESET_ATTR_ID(7): + return PORT7_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(8): + case TRANSCEIVER_RESET_ATTR_ID(8): + return PORT8_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(9): + case TRANSCEIVER_RESET_ATTR_ID(9): + return PORT9_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(10): + case TRANSCEIVER_RESET_ATTR_ID(10): + return PORT10_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(11): + case TRANSCEIVER_RESET_ATTR_ID(11): + return PORT11_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(12): + case TRANSCEIVER_RESET_ATTR_ID(12): + return PORT12_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(13): + case TRANSCEIVER_RESET_ATTR_ID(13): + return PORT13_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(14): + case TRANSCEIVER_RESET_ATTR_ID(14): + return PORT14_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(15): + case TRANSCEIVER_RESET_ATTR_ID(15): + return PORT15_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(16): + case TRANSCEIVER_RESET_ATTR_ID(16): + return PORT16_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(17): + case TRANSCEIVER_RESET_ATTR_ID(17): + return PORT17_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(18): + case TRANSCEIVER_RESET_ATTR_ID(18): + return PORT18_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(19): + case TRANSCEIVER_RESET_ATTR_ID(19): + return PORT19_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(20): + case TRANSCEIVER_RESET_ATTR_ID(20): + return PORT20_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(21): + case TRANSCEIVER_RESET_ATTR_ID(21): + return PORT21_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(22): + case TRANSCEIVER_RESET_ATTR_ID(22): + return PORT22_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(23): + case TRANSCEIVER_RESET_ATTR_ID(23): + return PORT23_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(24): + case TRANSCEIVER_RESET_ATTR_ID(24): + return PORT24_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(25): + case TRANSCEIVER_RESET_ATTR_ID(25): + return PORT25_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(26): + case TRANSCEIVER_RESET_ATTR_ID(26): + return PORT26_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(27): + case TRANSCEIVER_RESET_ATTR_ID(27): + return PORT27_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(28): + case TRANSCEIVER_RESET_ATTR_ID(28): + return PORT28_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(29): + case TRANSCEIVER_RESET_ATTR_ID(29): + return PORT29_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(30): + case TRANSCEIVER_RESET_ATTR_ID(30): + return PORT30_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(31): + case TRANSCEIVER_RESET_ATTR_ID(31): + return PORT31_ID; + case TRANSCEIVER_PRESENT_ATTR_ID(32): + case TRANSCEIVER_RESET_ATTR_ID(32): + return PORT32_ID; + default : + return -1; + } } - + static ssize_t sfp_value_store(struct device *dev, struct device_attribute *da, - char *buf, size_t size) + const char *buf, size_t size) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct i2c_client *client = to_i2c_client(dev); @@ -504,272 +504,272 @@ static ssize_t sfp_value_store(struct device *dev, struct device_attribute *da, int status = -EINVAL; int index; long keyin = 0; - + //printk("sfp_value_store\n"); //printk("attr->index=%d\n", attr->index); mutex_lock(&data->update_lock); switch (attr->index) - { - case MODULE_PRESENT_1 ... MODULE_PRESENT_8: - case MODULE_PRESENT_9 ... MODULE_PRESENT_16: - case MODULE_PRESENT_17 ... MODULE_PRESENT_24: - case MODULE_PRESENT_25 ... MODULE_PRESENT_32: - index=sfp_array_index_get(attr->index); - if(index < 0 || index > PORT_NUM_MAX -1) - break; - status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); - if(keyin < 0 || keyin > 1) - break; - data->present[index]=keyin; - break; - case MODULE_RESET_1 ... MODULE_RESET_8: - case MODULE_RESET_9 ... MODULE_RESET_16: - case MODULE_RESET_17 ... MODULE_RESET_24: - case MODULE_RESET_25 ... MODULE_RESET_32: - index=sfp_array_index_get(attr->index); - if(index < 0 || index > PORT_NUM_MAX -1) - break; - status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); - if(keyin < 0 || keyin > 1) - break; - data->reset[index]=keyin; - break; - default : - break; + { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + index=sfp_array_index_get(attr->index); + if(index < 0 || index > PORT_NUM_MAX -1) + break; + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if(keyin < 0 || keyin > 1) + break; + data->present[index]=keyin; + break; + case MODULE_RESET_1 ... MODULE_RESET_8: + case MODULE_RESET_9 ... MODULE_RESET_16: + case MODULE_RESET_17 ... MODULE_RESET_24: + case MODULE_RESET_25 ... MODULE_RESET_32: + index=sfp_array_index_get(attr->index); + if(index < 0 || index > PORT_NUM_MAX -1) + break; + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if(keyin < 0 || keyin > 1) + break; + data->reset[index]=keyin; + break; + default : + break; } - mutex_unlock(&data->update_lock); + mutex_unlock(&data->update_lock); return size; } static ssize_t sfp_value_show(struct device *dev, struct device_attribute *da, - char *buf) + char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct i2c_client *client = to_i2c_client(dev); struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); ssize_t ret = 0; - int index; + int index; int status = -EINVAL; - + //printk("sfp_value_show, attr->index=%d\n", attr->index); //printk("TRANSCEIVER_PRESENT_ATTR_ID(1)=%d, TRANSCEIVER_RESET_ATTR_ID(1)=%d\n", TRANSCEIVER_PRESENT_ATTR_ID(1), TRANSCEIVER_RESET_ATTR_ID(1)); mutex_lock(&data->update_lock); switch (attr->index) { - case MODULE_PRESENT_1 ... MODULE_PRESENT_8: - case MODULE_PRESENT_9 ... MODULE_PRESENT_16: - case MODULE_PRESENT_17 ... MODULE_PRESENT_24: - case MODULE_PRESENT_25 ... MODULE_PRESENT_32: - index=sfp_array_index_get(attr->index); - if(index < 0 || index > PORT_NUM_MAX -1) - break; - status = sprintf(buf, "%u\n", data->present[index]); - break; - case MODULE_RESET_1 ... MODULE_RESET_8: - case MODULE_RESET_9 ... MODULE_RESET_16: - case MODULE_RESET_17 ... MODULE_RESET_24: - case MODULE_RESET_25 ... MODULE_RESET_32: - index=sfp_array_index_get(attr->index); - //printk("rst:attr->index=%d, index=%d\n",attr->index, index); - if(index < 0 || index > PORT_NUM_MAX -1) - break; - status = sprintf(buf, "%u\n", data->reset[index]); - break; - default : - break; - } - + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + index=sfp_array_index_get(attr->index); + if(index < 0 || index > PORT_NUM_MAX -1) + break; + status = sprintf(buf, "%u\n", data->present[index]); + break; + case MODULE_RESET_1 ... MODULE_RESET_8: + case MODULE_RESET_9 ... MODULE_RESET_16: + case MODULE_RESET_17 ... MODULE_RESET_24: + case MODULE_RESET_25 ... MODULE_RESET_32: + index=sfp_array_index_get(attr->index); + //printk("rst:attr->index=%d, index=%d\n",attr->index, index); + if(index < 0 || index > PORT_NUM_MAX -1) + break; + status = sprintf(buf, "%u\n", data->reset[index]); + break; + default : + break; + } + mutex_unlock(&data->update_lock); return status; } static ssize_t show_present(struct device *dev, struct device_attribute *da, - char *buf) + char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct i2c_client *client = to_i2c_client(dev); struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); - int status = 0; - u8 reg = 0, mask = 0; - - switch (attr->index) { - case MODULE_PRESENT_1 ... MODULE_PRESENT_8: - reg = 0x30; - mask = 0x1 << (attr->index - MODULE_PRESENT_1); - break; - case MODULE_PRESENT_9 ... MODULE_PRESENT_16: - reg = 0x31; - mask = 0x1 << (attr->index - MODULE_PRESENT_9); - break; - case MODULE_PRESENT_17 ... MODULE_PRESENT_24: - reg = 0x32; - mask = 0x1 << (attr->index - MODULE_PRESENT_17); - break; - case MODULE_PRESENT_25 ... MODULE_PRESENT_32: - reg = 0x33; - mask = 0x1 << (attr->index - MODULE_PRESENT_25); - break; - default: - return 0; - } + int status = 0; + u8 reg = 0, mask = 0; + + switch (attr->index) { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + reg = 0x30; + mask = 0x1 << (attr->index - MODULE_PRESENT_1); + break; + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + reg = 0x31; + mask = 0x1 << (attr->index - MODULE_PRESENT_9); + break; + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + reg = 0x32; + mask = 0x1 << (attr->index - MODULE_PRESENT_17); + break; + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + reg = 0x33; + mask = 0x1 << (attr->index - MODULE_PRESENT_25); + break; + default: + return 0; + } mutex_lock(&data->update_lock); - status = as7716_32xb_cpld_read_internal(client, reg); - if (unlikely(status < 0)) { - goto exit; - } - mutex_unlock(&data->update_lock); + status = as7716_32xb_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); - return sprintf(buf, "%d\n", !(status & mask)); + return sprintf(buf, "%d\n", !(status & mask)); exit: - mutex_unlock(&data->update_lock); - return status; + mutex_unlock(&data->update_lock); + return status; } static ssize_t show_version(struct device *dev, struct device_attribute *da, - char *buf) + char *buf) { - u8 reg = 0, mask = 0; + u8 reg = 0, mask = 0; struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct i2c_client *client = to_i2c_client(dev); struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); - int status = 0; + int status = 0; - switch (attr->index) { - case CPLD_VERSION: - reg = 0x1; - mask = 0xFF; - break; - default: - break; - } + switch (attr->index) { + case CPLD_VERSION: + reg = 0x1; + mask = 0xFF; + break; + default: + break; + } mutex_lock(&data->update_lock); - status = as7716_32xb_cpld_read_internal(client, reg); - if (unlikely(status < 0)) { - goto exit; - } - mutex_unlock(&data->update_lock); - return sprintf(buf, "%d\n", (status & mask)); + status = as7716_32xb_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%d\n", (status & mask)); exit: - mutex_unlock(&data->update_lock); - return status; + mutex_unlock(&data->update_lock); + return status; } static ssize_t access(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) + const char *buf, size_t count) { - int status; - u32 addr, val; + int status; + u32 addr, val; struct i2c_client *client = to_i2c_client(dev); struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); - if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { - return -EINVAL; - } + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } - if (addr > 0xFF || val > 0xFF) { - return -EINVAL; - } + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } - mutex_lock(&data->update_lock); - status = as7716_32xb_cpld_write_internal(client, addr, val); - if (unlikely(status < 0)) { - goto exit; - } - mutex_unlock(&data->update_lock); - return count; + mutex_lock(&data->update_lock); + status = as7716_32xb_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; exit: - mutex_unlock(&data->update_lock); - return status; + mutex_unlock(&data->update_lock); + return status; } static int as7716_32xb_cpld_read_internal(struct i2c_client *client, u8 reg) { - int status = 0, retry = I2C_RW_RETRY_COUNT; - - while (retry) { - status = i2c_smbus_read_byte_data(client, reg); - if (unlikely(status < 0)) { - msleep(I2C_RW_RETRY_INTERVAL); - retry--; - continue; - } + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } - break; - } + break; + } return status; } static int as7716_32xb_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value) { - int status = 0, retry = I2C_RW_RETRY_COUNT; - - while (retry) { - status = i2c_smbus_write_byte_data(client, reg, value); - if (unlikely(status < 0)) { - msleep(I2C_RW_RETRY_INTERVAL); - retry--; - continue; - } + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } - break; - } + break; + } return status; } static void as7716_32xb_cpld_add_client(struct i2c_client *client) { - struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); - - if (!node) { - dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); - return; - } - - node->client = client; - - mutex_lock(&list_lock); - list_add(&node->list, &cpld_client_list); - mutex_unlock(&list_lock); + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); } static void as7716_32xb_cpld_remove_client(struct i2c_client *client) { - struct list_head *list_node = NULL; - struct cpld_client_node *cpld_node = NULL; - int found = 0; - - mutex_lock(&list_lock); - - list_for_each(list_node, &cpld_client_list) - { - cpld_node = list_entry(list_node, struct cpld_client_node, list); - - if (cpld_node->client == client) { - found = 1; - break; - } - } - - if (found) { - list_del(list_node); - kfree(cpld_node); - } - - mutex_unlock(&list_lock); + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); } static int as7716_32xb_cpld_probe(struct i2c_client *client, - const struct i2c_device_id *dev_id) + const struct i2c_device_id *dev_id) { int status; - struct as7716_32xb_cpld_data *data = NULL; + struct as7716_32xb_cpld_data *data = NULL; data = kzalloc(sizeof(struct as7716_32xb_cpld_data), GFP_KERNEL); if (!data) { @@ -781,22 +781,22 @@ static int as7716_32xb_cpld_probe(struct i2c_client *client, mutex_init(&data->update_lock); dev_info(&client->dev, "chip found\n"); - /* Register sysfs hooks */ - status = sysfs_create_group(&client->dev.kobj, &as7716_32xb_cpld_group); - if (status) { - goto exit_free; - } + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7716_32xb_cpld_group); + if (status) { + goto exit_free; + } - data->hwmon_dev = hwmon_device_register(&client->dev); - if (IS_ERR(data->hwmon_dev)) { - status = PTR_ERR(data->hwmon_dev); - goto exit_remove; - } + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } - as7716_32xb_cpld_add_client(client); + as7716_32xb_cpld_add_client(client); - dev_info(&client->dev, "%s: cpld '%s'\n", - dev_name(data->hwmon_dev), client->name); + dev_info(&client->dev, "%s: cpld '%s'\n", + dev_name(data->hwmon_dev), client->name); return 0; @@ -805,7 +805,7 @@ static int as7716_32xb_cpld_probe(struct i2c_client *client, exit_free: kfree(data); exit: - + return status; } @@ -816,115 +816,115 @@ static int as7716_32xb_cpld_remove(struct i2c_client *client) hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&client->dev.kobj, &as7716_32xb_cpld_group); kfree(data); - as7716_32xb_cpld_remove_client(client); + as7716_32xb_cpld_remove_client(client); return 0; } int as7716_32xb_cpld_read(unsigned short cpld_addr, u8 reg) { - struct list_head *list_node = NULL; - struct cpld_client_node *cpld_node = NULL; - int ret = -EPERM; - - mutex_lock(&list_lock); - - list_for_each(list_node, &cpld_client_list) - { - cpld_node = list_entry(list_node, struct cpld_client_node, list); - - if (cpld_node->client->addr == cpld_addr) { - ret = i2c_smbus_read_byte_data(cpld_node->client, reg); - break; - } - } - - mutex_unlock(&list_lock); - - return ret; + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; } EXPORT_SYMBOL(as7716_32xb_cpld_read); int as7716_32xb_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) { - struct list_head *list_node = NULL; - struct cpld_client_node *cpld_node = NULL; - int ret = -EIO; - - mutex_lock(&list_lock); - - list_for_each(list_node, &cpld_client_list) - { - cpld_node = list_entry(list_node, struct cpld_client_node, list); - - if (cpld_node->client->addr == cpld_addr) { - ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); - break; - } - } - - mutex_unlock(&list_lock); - - return ret; + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; } EXPORT_SYMBOL(as7716_32xb_cpld_write); static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, - char *buf) + char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct i2c_client *client = to_i2c_client(dev); struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); - int status = 0; - u8 reg = 0, mask = 0; - - switch (attr->index) { - case MODULE_RESET_1 ... MODULE_RESET_8: - reg = 0x04; - mask = 0x1 << (attr->index - MODULE_RESET_1); - break; - case MODULE_RESET_9 ... MODULE_RESET_16: - reg = 0x05; - mask = 0x1 << (attr->index - MODULE_RESET_9); - break; - case MODULE_RESET_17 ... MODULE_RESET_24: - reg = 0x06; - mask = 0x1 << (attr->index - MODULE_RESET_17); - break; - case MODULE_RESET_25 ... MODULE_RESET_32: - reg = 0x07; - mask = 0x1 << (attr->index - MODULE_RESET_25); - break; - default: - return 0; - } + int status = 0; + u8 reg = 0, mask = 0; + + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = 0x04; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = 0x05; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = 0x06; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = 0x07; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } mutex_lock(&data->update_lock); - status = as7716_32xb_cpld_read_internal(client, reg); - - if (unlikely(status < 0)) { - goto exit; - } - mutex_unlock(&data->update_lock); - - return sprintf(buf, "%d\r\n", !(status & mask)); - + status = as7716_32xb_cpld_read_internal(client, reg); + + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\r\n", !(status & mask)); + exit: - mutex_unlock(&data->update_lock); - return status; + mutex_unlock(&data->update_lock); + return status; } static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) -{ + const char *buf, size_t count) +{ struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct i2c_client *client = to_i2c_client(dev); struct as7716_32xb_cpld_data *data = i2c_get_clientdata(client); long reset; int status=0, val, error; - u8 reg = 0, mask = 0; - + u8 reg = 0, mask = 0; + error = kstrtol(buf, 10, &reset); if (error) { @@ -932,54 +932,54 @@ static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, } //printk("set_mode_reset:attr->index=%d\n",attr->index); switch (attr->index) { - case MODULE_RESET_1 ... MODULE_RESET_8: - reg = 0x04; - mask = 0x1 << (attr->index - MODULE_RESET_1); - break; - case MODULE_RESET_9 ... MODULE_RESET_16: - reg = 0x05; - mask = 0x1 << (attr->index - MODULE_RESET_9); - break; - case MODULE_RESET_17 ... MODULE_RESET_24: - reg = 0x06; - mask = 0x1 << (attr->index - MODULE_RESET_17); - break; - case MODULE_RESET_25 ... MODULE_RESET_32: - reg = 0x07; - mask = 0x1 << (attr->index - MODULE_RESET_25); - break; - default: - return 0; - } - mutex_lock(&data->update_lock); - - status = as7716_32xb_cpld_read_internal(client, reg); - if (unlikely(status < 0)) { - goto exit; - } - //printk("set_mode_reset:reset=%d, reg=0x%x, mask=0x%x, ori_val=0x%x\n", reset, reg, mask, status); - /* Update lp_mode status */ + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = 0x04; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = 0x05; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = 0x06; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = 0x07; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + mutex_lock(&data->update_lock); + + status = as7716_32xb_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + //printk("set_mode_reset:reset=%d, reg=0x%x, mask=0x%x, ori_val=0x%x\n", reset, reg, mask, status); + /* Update lp_mode status */ if (reset) - { + { val = status&(~mask); //printk("1:new val=0x%x\n", val); } else - { + { val =status | (mask); //printk("0:new val=0x%x\n", val); } - - status = as7716_32xb_cpld_write_internal(client, reg, val); - if (unlikely(status < 0)) { - goto exit; - } - mutex_unlock(&data->update_lock); - return count; + + status = as7716_32xb_cpld_write_internal(client, reg, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; exit: - mutex_unlock(&data->update_lock); - return status; + mutex_unlock(&data->update_lock); + return status; } @@ -1003,13 +1003,13 @@ static struct i2c_driver as7716_32xb_cpld_driver = { static int __init as7716_32xb_cpld_init(void) { - mutex_init(&list_lock); - return i2c_add_driver(&as7716_32xb_cpld_driver); + mutex_init(&list_lock); + return i2c_add_driver(&as7716_32xb_cpld_driver); } static void __exit as7716_32xb_cpld_exit(void) { - i2c_del_driver(&as7716_32xb_cpld_driver); + i2c_del_driver(&as7716_32xb_cpld_driver); } module_init(as7716_32xb_cpld_init); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_fan.c old mode 100755 new mode 100644 index 5c1c3016c3a1..65f3251c00ec --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/modules/accton_as7716_32xb_fan.c @@ -43,17 +43,15 @@ static struct as7716_32xb_fan_data *as7716_32xb_fan_update_device(struct device *dev); static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, - const char *buf, size_t count); + const char *buf, size_t count); static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_enable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); - static ssize_t fan_value_show(struct device *dev, struct device_attribute *da, - char *buf); + char *buf); static ssize_t fan_value_store(struct device *dev, struct device_attribute *da, - char *buf, size_t size); + const char *buf, size_t size); /* fan related data, the index should match sysfs_fan_attributes */ @@ -85,12 +83,10 @@ struct as7716_32xb_fan_data { u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ u8 enable; u8 duty_cycle; - int system_temp; /*In unit of mini-Celsius*/ - int sensors_found; unsigned int present[FAN_NUM_MAX]; unsigned int front_speed_rpm[FAN_NUM_MAX]; unsigned int rear_speed_rpm[FAN_NUM_MAX]; - unsigned int direction[FAN_NUM_MAX]; + unsigned int direction[FAN_NUM_MAX]; unsigned int fault[FAN_NUM_MAX]; unsigned int input[FAN_NUM_MAX]; }; @@ -153,7 +149,7 @@ enum sysfs_fan_attributes { #define DECLARE_FAN_DIRECTION_ATTR(index) &sensor_dev_attr_fan##index##_direction.dev_attr.attr -#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ static SENSOR_DEVICE_ATTR(fan_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_value_show, fan_value_store, FAN_DUTY_CYCLE_PERCENTAGE);\ static SENSOR_DEVICE_ATTR(pwm##index, S_IWUSR | S_IRUGO, fan_value_show, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE);\ static SENSOR_DEVICE_ATTR(pwm##index##_enable, S_IWUSR | S_IRUGO, get_enable, set_enable, FAN_DUTY_CYCLE_PERCENTAGE) @@ -162,18 +158,11 @@ enum sysfs_fan_attributes { &sensor_dev_attr_pwm##index.dev_attr.attr, \ &sensor_dev_attr_pwm##index##_enable.dev_attr.attr -#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ - static SENSOR_DEVICE_ATTR(sys_temp, S_IWUSR|S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) - -#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr - - - #define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ static SENSOR_DEVICE_ATTR(fan##index##_present, S_IWUSR|S_IRUGO, fan_value_show, fan_value_store, FAN##index##_PRESENT) #define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr - + #define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index, index2) \ static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IWUSR|S_IRUGO, fan_value_show, fan_value_store, FAN##index##_FRONT_SPEED_RPM);\ static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IWUSR|S_IRUGO, fan_value_show, fan_value_store, FAN##index##_REAR_SPEED_RPM);\ @@ -182,7 +171,7 @@ enum sysfs_fan_attributes { #define DECLARE_FAN_SPEED_RPM_ATTR(index, index2) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr, \ &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ - &sensor_dev_attr_fan##index2##_input.dev_attr.attr + &sensor_dev_attr_fan##index2##_input.dev_attr.attr /* 6 fan fault attributes in this platform */ DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1,11); @@ -215,8 +204,6 @@ DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); /* 1 fan duty cycle attribute in this platform */ DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); -/* System temperature for fancontrol */ -DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); static struct attribute *as7716_32xb_fan_attributes[] = { /* fan related attributes */ @@ -245,7 +232,6 @@ static struct attribute *as7716_32xb_fan_attributes[] = { DECLARE_FAN_DIRECTION_ATTR(5), DECLARE_FAN_DIRECTION_ATTR(6), DECLARE_FAN_DUTY_CYCLE_ATTR(1), - DECLARE_FAN_SYSTEM_TEMP_ATTR(), NULL }; @@ -265,13 +251,13 @@ static int as7716_32xb_fan_write_value(struct i2c_client *client, u8 reg, u8 val /* fan utility functions */ -static u32 reg_val_to_duty_cycle(u8 reg_val) +static u32 reg_val_to_duty_cycle(u8 reg_val) { reg_val &= FAN_DUTY_CYCLE_REG_MASK; return ((u32)(reg_val+1) * 625 + 75)/ 100; } -static u8 duty_cycle_to_reg_val(u8 duty_cycle) +static u8 duty_cycle_to_reg_val(u8 duty_cycle) { return ((u32)duty_cycle * 100 / 625) - 1; } @@ -301,11 +287,11 @@ static u8 reg_val_to_is_present(u8 reg_val, enum FAN_ID id) static u8 is_fan_fault(struct as7716_32xb_fan_data *data, enum FAN_ID id) { u8 ret = 0; - - /* Check if the speed of front or rear fan is ZERO, + + /* Check if the speed of front or rear fan is ZERO, */ if (!data->front_speed_rpm[id] && - !data->rear_speed_rpm[id] ) + !data->rear_speed_rpm[id] ) { ret = 1; } @@ -334,7 +320,7 @@ static ssize_t set_enable(struct device *dev, struct device_attribute *da, } return count; } - + static ssize_t get_enable(struct device *dev, struct device_attribute *da, @@ -346,315 +332,70 @@ static ssize_t get_enable(struct device *dev, struct device_attribute *da, } static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) + const char *buf, size_t count) { int error, value; struct i2c_client *client = to_i2c_client(dev); - + error = kstrtoint(buf, 10, &value); if (error) return error; - + if (value < 0 || value > FAN_MAX_DUTY_CYCLE) return -EINVAL; - + as7716_32xb_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ as7716_32xb_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); return count; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if(data) - { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - - } - return NULL; -} - -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - OUT int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; - -#undef MAX_HWMON_DEVICE -} - -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) -{ - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; - } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - } - return 0; -} - -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} -static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); - - return 0; -} - -static int _find_lm75_device(struct device *dev, void *data) -{ - struct device_driver *driver; - struct as7716_32xb_fan_data *prv = data; - char *driver_name = THERMAL_SENSORS_DRIVER; - - driver = dev->driver; - if (driver && driver->name && - strcmp(driver->name, driver_name) == 0) - { - struct i2c_client *client; - client = to_i2c_client(dev); - if (client) - { - /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ - struct i2c_adapter *adap = client->adapter; - int miniCelsius = 0; - - - if (!adap) { - return -ENXIO; - } - - /* If the data is not updated, read them from devfile - to drive them updateing data from chip.*/ - if (is_lm75_data_due(client)) - { - struct device *hwmon_dev; - - hwmon_dev = get_hwmon_dev(client); - if(0 == read_devfile_temp1_input(dev, adap->nr, - client->addr, hwmon_dev, &miniCelsius)) - { - prv->system_temp += miniCelsius; - prv->sensors_found++; - } - - } - else - { - get_lm75_temp(client, &miniCelsius); - prv->system_temp += miniCelsius; - prv->sensors_found++; - - } - } - } - return 0; -} - -/*Find all lm75 devices and return sum of temperatures.*/ -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, - char *buf) +static int fan_array_index_get(int attr_idx) { - ssize_t ret = 0; - struct as7716_32xb_fan_data *data = as7716_32xb_fan_update_device(dev); - - data->system_temp=0; - data->sensors_found=0; - i2c_for_each_dev(data, _find_lm75_device); - if (NUM_THERMAL_SENSORS != data->sensors_found) + switch(attr_idx) { - dev_dbg(dev,"only %d of %d temps are found\n", - data->sensors_found, NUM_THERMAL_SENSORS); - data->system_temp = 0; + case FAN1_PRESENT: + case FAN1_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN1_FAULT: + case FAN1_DIRECTION: + return FAN1_ID; + case FAN2_PRESENT: + case FAN2_FRONT_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN2_FAULT: + case FAN2_DIRECTION: + return FAN2_ID; + case FAN3_PRESENT: + case FAN3_FRONT_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN3_FAULT: + case FAN3_DIRECTION: + return FAN3_ID; + case FAN4_PRESENT: + case FAN4_FRONT_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN4_FAULT: + case FAN4_DIRECTION: + return FAN4_ID; + case FAN5_PRESENT: + case FAN5_FRONT_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN5_FAULT: + case FAN5_DIRECTION: + return FAN5_ID; + case FAN6_PRESENT: + case FAN6_FRONT_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + case FAN6_FAULT: + case FAN6_DIRECTION: + return FAN6_ID; + default : + return -1; } - ret = sprintf(buf, "%d\n",data->system_temp); - return ret; } - -static int fan_array_index_get(int attr_idx) -{ - switch(attr_idx) - { - case FAN1_PRESENT: - case FAN1_FRONT_SPEED_RPM: - case FAN1_REAR_SPEED_RPM: - case FAN1_FAULT: - case FAN1_DIRECTION: - return FAN1_ID; - case FAN2_PRESENT: - case FAN2_FRONT_SPEED_RPM: - case FAN2_REAR_SPEED_RPM: - case FAN2_FAULT: - case FAN2_DIRECTION: - return FAN2_ID; - case FAN3_PRESENT: - case FAN3_FRONT_SPEED_RPM: - case FAN3_REAR_SPEED_RPM: - case FAN3_FAULT: - case FAN3_DIRECTION: - return FAN3_ID; - case FAN4_PRESENT: - case FAN4_FRONT_SPEED_RPM: - case FAN4_REAR_SPEED_RPM: - case FAN4_FAULT: - case FAN4_DIRECTION: - return FAN4_ID; - case FAN5_PRESENT: - case FAN5_FRONT_SPEED_RPM: - case FAN5_REAR_SPEED_RPM: - case FAN5_FAULT: - case FAN5_DIRECTION: - return FAN5_ID; - case FAN6_PRESENT: - case FAN6_FRONT_SPEED_RPM: - case FAN6_REAR_SPEED_RPM: - case FAN6_FAULT: - case FAN6_DIRECTION: - return FAN6_ID; - default : - return -1; - } -} - static ssize_t fan_value_store(struct device *dev, struct device_attribute *da, - char *buf, size_t size) + const char *buf, size_t size) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct i2c_client *client = to_i2c_client(dev); @@ -667,97 +408,97 @@ static ssize_t fan_value_store(struct device *dev, struct device_attribute *da, mutex_lock(&data->update_lock); switch (attr->index) { - case FAN_DUTY_CYCLE_PERCENTAGE: - status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); - if (status) - break; - if (keyin > 1 || keyin < 0) - break; - data->duty_cycle=keyin; + case FAN_DUTY_CYCLE_PERCENTAGE: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + break; + if (keyin > 1 || keyin < 0) + break; + data->duty_cycle=keyin; + break; + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + break; + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + data->front_speed_rpm[index]=keyin; + break; + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + break; + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + data->rear_speed_rpm[index]=keyin; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) break; - case FAN1_FRONT_SPEED_RPM: - case FAN2_FRONT_SPEED_RPM: - case FAN3_FRONT_SPEED_RPM: - case FAN4_FRONT_SPEED_RPM: - case FAN5_FRONT_SPEED_RPM: - case FAN6_FRONT_SPEED_RPM: - status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); - if (status) - break; - index=fan_array_index_get(attr->index); - if(index < 0 || index > (FAN_NUM_MAX-1)) - break; - data->front_speed_rpm[index]=keyin; - break; - case FAN1_REAR_SPEED_RPM: - case FAN2_REAR_SPEED_RPM: - case FAN3_REAR_SPEED_RPM: - case FAN4_REAR_SPEED_RPM: - case FAN5_REAR_SPEED_RPM: - case FAN6_REAR_SPEED_RPM: - status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); - if (status) - break; - index=fan_array_index_get(attr->index); - if(index < 0 || index > (FAN_NUM_MAX-1)) - break; - data->rear_speed_rpm[index]=keyin; - case FAN1_PRESENT: - case FAN2_PRESENT: - case FAN3_PRESENT: - case FAN4_PRESENT: - case FAN5_PRESENT: - case FAN6_PRESENT: - status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); - if (status) - break; - index=fan_array_index_get(attr->index); - if(index < 0 || index > (FAN_NUM_MAX-1)) - break; - if(keyin < 0 || keyin > 1) - break; - data->present[index]=keyin; + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) break; - case FAN1_FAULT: - case FAN2_FAULT: - case FAN3_FAULT: - case FAN4_FAULT: - case FAN5_FAULT: - case FAN6_FAULT: - status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); - if (status) - break; - index=fan_array_index_get(attr->index); - if(index < 0 || index > (FAN_NUM_MAX-1)) - break; - if(keyin < 0 || keyin > 1) - break; - data->fault[index]=keyin; + if(keyin < 0 || keyin > 1) break; - case FAN1_DIRECTION: - case FAN2_DIRECTION: - case FAN3_DIRECTION: - case FAN4_DIRECTION: - case FAN5_DIRECTION: - case FAN6_DIRECTION: - status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); - if (status) - break; - index=fan_array_index_get(attr->index); - if(index < 0 || index > (FAN_NUM_MAX-1)) - break; - if(keyin < 0 || keyin > 1) - break; - data->direction[index]=keyin; + data->present[index]=keyin; + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) break; - default: + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) break; + if(keyin < 0 || keyin > 1) + break; + data->fault[index]=keyin; + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + case FAN6_DIRECTION: + status = kstrtol(buf, STRING_TO_DEC_VALUE, &keyin); + if (status) + break; + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + if(keyin < 0 || keyin > 1) + break; + data->direction[index]=keyin; + break; + default: + break; } - mutex_unlock(&data->update_lock); + mutex_unlock(&data->update_lock); return size; } static ssize_t fan_value_show(struct device *dev, struct device_attribute *da, - char *buf) + char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct i2c_client *client = to_i2c_client(dev); @@ -769,66 +510,66 @@ static ssize_t fan_value_show(struct device *dev, struct device_attribute *da, mutex_lock(&data->update_lock); switch (attr->index) { - case FAN_DUTY_CYCLE_PERCENTAGE: - status = sprintf(buf, "%u\n", data->duty_cycle); - break; - case FAN1_FRONT_SPEED_RPM: - case FAN2_FRONT_SPEED_RPM: - case FAN3_FRONT_SPEED_RPM: - case FAN4_FRONT_SPEED_RPM: - case FAN5_FRONT_SPEED_RPM: - case FAN6_FRONT_SPEED_RPM: - index=fan_array_index_get(attr->index); - if(index < 0 || index > (FAN_NUM_MAX-1)) - break; - status = sprintf(buf, "%u\n", data->front_speed_rpm[index]); - break; - case FAN1_REAR_SPEED_RPM: - case FAN2_REAR_SPEED_RPM: - case FAN3_REAR_SPEED_RPM: - case FAN4_REAR_SPEED_RPM: - case FAN5_REAR_SPEED_RPM: - case FAN6_REAR_SPEED_RPM: - index=fan_array_index_get(attr->index); - if(index < 0 || index > (FAN_NUM_MAX-1)) - break; - status = sprintf(buf, "%u\n", data->rear_speed_rpm[index]); - break; - case FAN1_PRESENT: - case FAN2_PRESENT: - case FAN3_PRESENT: - case FAN4_PRESENT: - case FAN5_PRESENT: - case FAN6_PRESENT: - index=fan_array_index_get(attr->index); - if(index < 0 || index > (FAN_NUM_MAX-1)) - break; - status = sprintf(buf, "%d\n", data->present[index]); + case FAN_DUTY_CYCLE_PERCENTAGE: + status = sprintf(buf, "%u\n", data->duty_cycle); + break; + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) + break; + status = sprintf(buf, "%u\n", data->front_speed_rpm[index]); + break; + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) break; - case FAN1_FAULT: - case FAN2_FAULT: - case FAN3_FAULT: - case FAN4_FAULT: - case FAN5_FAULT: - case FAN6_FAULT: - index=fan_array_index_get(attr->index); - if(index < 0 || index > (FAN_NUM_MAX-1)) - break; - status = sprintf(buf, "%d\n", is_fan_fault(data, index)); + status = sprintf(buf, "%u\n", data->rear_speed_rpm[index]); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) break; - case FAN1_DIRECTION: - case FAN2_DIRECTION: - case FAN3_DIRECTION: - case FAN4_DIRECTION: - case FAN5_DIRECTION: - case FAN6_DIRECTION: - index=fan_array_index_get(attr->index);; - if(index < 0 || index > (FAN_NUM_MAX-1)) - break; - status = sprintf(buf, "%d\n", data->direction[index]); + status = sprintf(buf, "%d\n", data->present[index]); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + index=fan_array_index_get(attr->index); + if(index < 0 || index > (FAN_NUM_MAX-1)) break; - default: + status = sprintf(buf, "%d\n", is_fan_fault(data, index)); + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + case FAN6_DIRECTION: + index=fan_array_index_get(attr->index);; + if(index < 0 || index > (FAN_NUM_MAX-1)) break; + status = sprintf(buf, "%d\n", data->direction[index]); + break; + default: + break; } mutex_unlock(&data->update_lock); return status; @@ -845,18 +586,18 @@ static struct as7716_32xb_fan_data *as7716_32xb_fan_update_device(struct device mutex_lock(&data->update_lock); - if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || - !data->valid) { + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { int i; dev_dbg(&client->dev, "Starting as7716_32xb_fan update\n"); data->valid = 0; - + /* Update fan data */ for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { int status = as7716_32xb_fan_read_value(client, fan_reg[i]); - + if (status < 0) { data->valid = 0; mutex_unlock(&data->update_lock); @@ -867,18 +608,18 @@ static struct as7716_32xb_fan_data *as7716_32xb_fan_update_device(struct device data->reg_val[i] = status; } } - + data->last_updated = jiffies; data->valid = 1; } - + mutex_unlock(&data->update_lock); return data; } static int as7716_32xb_fan_probe(struct i2c_client *client, - const struct i2c_device_id *dev_id) + const struct i2c_device_id *dev_id) { struct as7716_32xb_fan_data *data; int status; @@ -908,8 +649,8 @@ static int as7716_32xb_fan_probe(struct i2c_client *client, } dev_info(&client->dev, "%s: fan '%s'\n", - dev_name(data->hwmon_dev), client->name); - + dev_name(data->hwmon_dev), client->name); + return 0; exit_remove: @@ -917,7 +658,7 @@ static int as7716_32xb_fan_probe(struct i2c_client *client, exit_free: kfree(data); exit: - + return status; } @@ -926,7 +667,7 @@ static int as7716_32xb_fan_remove(struct i2c_client *client) struct as7716_32xb_fan_data *data = i2c_get_clientdata(client); hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&client->dev.kobj, &as7716_32xb_fan_group); - + return 0; } From 7f76d3bf7449452bc0c8c11d0b8a1c539080ceee Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Sat, 27 Oct 2018 08:10:47 +0800 Subject: [PATCH 1713/1833] [platform]Accton, add platform as6712-32x. (#2178) * [platform] Add 6712 dpkg on building. Signed-off-by: roy_lee * [platform] remove scache_filename for it failed the bcm checker. Signed-off-by: roy_lee * [plaform] add platform/device as6712-32x. Signed-off-by: roy_lee * [platform] fix error on private data reference at cpld.c. Signed-off-by: roy_lee --- .../Accton-AS6712-32X/port_config.ini | 33 + .../Accton-AS6712-32X/sai.profile | 1 + .../td2-as6712-32x40G.config.bcm | 132 +++ .../x86_64-accton_as6712_32x-r0/default_sku | 1 + .../installer.conf | 3 + .../led_proc_init.soc | 104 ++ .../plugins/eeprom.py | 24 + .../plugins/psuutil.py | 61 ++ .../plugins/sfputil.py | 215 +++++ .../x86_64-accton_as6712_32x-r0/sensors.conf | 23 + platform/broadcom/one-image.mk | 1 + platform/broadcom/platform-modules-accton.mk | 6 + .../as6712-32x/classes/__init__.py | 0 .../as6712-32x/classes/fanutil.py | 253 +++++ .../as6712-32x/classes/thermalutil.py | 124 +++ .../as6712-32x/modules/Makefile | 2 + .../modules/accton-as6712-32x-cpld.c | 887 ++++++++++++++++++ .../modules/accton_as6712_32x_fan.c | 463 +++++++++ .../modules/accton_as6712_32x_psu.c | 364 +++++++ .../as6712-32x/modules/cpr_4011_4mxx.c | 439 +++++++++ .../modules/leds-accton_as6712_32x.c | 612 ++++++++++++ .../service/as6712-platform-init.service | 17 + .../as6712-32x/setup.py | 16 + .../as6712-32x/utils/README | 74 ++ .../as6712-32x/utils/accton_as6712_monitor.py | 208 ++++ .../as6712-32x/utils/accton_as6712_util.py | 627 +++++++++++++ .../debian/control | 4 + .../debian/rules | 2 +- .../debian/rules | 0 29 files changed, 4695 insertions(+), 1 deletion(-) create mode 100644 device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/port_config.ini create mode 100644 device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/sai.profile create mode 100644 device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/td2-as6712-32x40G.config.bcm create mode 100644 device/accton/x86_64-accton_as6712_32x-r0/default_sku create mode 100644 device/accton/x86_64-accton_as6712_32x-r0/installer.conf create mode 100644 device/accton/x86_64-accton_as6712_32x-r0/led_proc_init.soc create mode 100644 device/accton/x86_64-accton_as6712_32x-r0/plugins/eeprom.py create mode 100644 device/accton/x86_64-accton_as6712_32x-r0/plugins/psuutil.py create mode 100644 device/accton/x86_64-accton_as6712_32x-r0/plugins/sfputil.py create mode 100644 device/accton/x86_64-accton_as6712_32x-r0/sensors.conf create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/__init__.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/fanutil.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/thermalutil.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/Makefile create mode 100755 platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton-as6712-32x-cpld.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton_as6712_32x_fan.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton_as6712_32x_psu.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/cpr_4011_4mxx.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/leds-accton_as6712_32x.c create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/service/as6712-platform-init.service create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/setup.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/README create mode 100755 platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py mode change 100644 => 100755 platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules diff --git a/device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/port_config.ini b/device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/port_config.ini new file mode 100644 index 000000000000..fd2022dc2c9d --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias +Ethernet0 49,50,51,52 fortyGigE1 +Ethernet4 53,54,55,56 fortyGigE2 +Ethernet8 57,58,59,60 fortyGigE3 +Ethernet12 61,62,63,64 fortyGigE4 +Ethernet16 65,66,67,68 fortyGigE5 +Ethernet20 69,70,71,72 fortyGigE6 +Ethernet24 73,74,75,76 fortyGigE7 +Ethernet28 77,78,79,80 fortyGigE8 +Ethernet32 33,34,35,36 fortyGigE9 +Ethernet36 37,38,39,40 fortyGigE10 +Ethernet40 41,42,43,44 fortyGigE11 +Ethernet44 45,46,47,48 fortyGigE12 +Ethernet48 81,82,83,84 fortyGigE13 +Ethernet52 85,86,87,88 fortyGigE14 +Ethernet56 89,90,91,92 fortyGigE15 +Ethernet60 93,94,95,96 fortyGigE16 +Ethernet64 97,98,99,100 fortyGigE17 +Ethernet68 101,102,103,104 fortyGigE18 +Ethernet72 105,106,107,108 fortyGigE19 +Ethernet76 109,110,111,112 fortyGigE20 +Ethernet80 17,18,19,20 fortyGigE21 +Ethernet84 21,22,23,24 fortyGigE22 +Ethernet88 25,26,27,28 fortyGigE23 +Ethernet92 29,30,31,32 fortyGigE24 +Ethernet96 113,114,115,116 fortyGigE25 +Ethernet100 117,118,119,120 fortyGigE26 +Ethernet104 121,122,123,124 fortyGigE27 +Ethernet108 125,126,127,128 fortyGigE28 +Ethernet112 1,2,3,4 fortyGigE29 +Ethernet116 5,6,7,8 fortyGigE30 +Ethernet120 9,10,11,12 fortyGigE31 +Ethernet124 13,14,15,16 fortyGigE32 diff --git a/device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/sai.profile b/device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/sai.profile new file mode 100644 index 000000000000..22432e548b4a --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td2-as6712-32x40G.config.bcm diff --git a/device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/td2-as6712-32x40G.config.bcm b/device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/td2-as6712-32x40G.config.bcm new file mode 100644 index 000000000000..54f3c366fdc4 --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/Accton-AS6712-32X/td2-as6712-32x40G.config.bcm @@ -0,0 +1,132 @@ +os=unix +bcm_stat_flags=0 +parity_enable=0 +parity_correction=0 + +l2_mem_entries=163840 +l3_mem_entries=81920 +mmu_lossless=0 +lls_num_l2uc=12 +module_64ports=0 + +#SFI +serdes_if_type=9 + +port_init_cl72=0 +phy_an_c73=5 # TSCMOD_CL73_CL37 + +#sdk6.5.5 only supports 156(default) or 125 +#xgxs_lcpll_xtal_refclk=1 +tslam_dma_enable=1 +table_dma_enable=1 + +#for 32x40G ports for breakout mode +pbmp_oversubscribe=0x1fffffffe +pbmp_xport_xe=0x1fffffffe + +rate_ext_mdio_divisor=96 + +#QSFP+ 1 from WC0 +portmap_1=1:40 + +#QSFP+ 2 from WC1 +portmap_2=5:40 + +#QSFP+ 3 from WC2 +portmap_3=9:40 + +#QSFP+ 4 from WC3 +portmap_4=13:40 + +#QSFP+ 5 from WC4 +portmap_5=17:40 + +#QSFP+ 6 from WC5 +portmap_6=21:40 + +#QSFP+ 7 from WC6 +portmap_7=25:40 + +#QSFP+ 8 from WC7 +portmap_8=29:40 + +#QSFP+ 9 from WC8 +portmap_9=33:40 + +#QSFP+ 10 from WC9 +portmap_10=37:40 + +#QSFP+ 11 from WC10 +portmap_11=41:40 + +#QSFP+ 12 from WC11 +portmap_12=45:40 + +#QSFP+ 13 from WC12 +portmap_13=49:40 + +#QSFP+ 14 from WC13 +portmap_14=53:40 + +#QSFP+ 15 from WC14 +portmap_15=57:40 + +#QSFP+ 16 from WC15 +portmap_16=61:40 + +#QSFP+ 17 from WC16 +portmap_17=65:40 + +#QSFP+ 18 from WC17 +portmap_18=69:40 + +#QSFP+ 19 from WC18 +portmap_19=73:40 + +#QSFP+ 20 from WC19 +portmap_20=77:40 + +#QSFP+ 21 from WC20 +portmap_21=81:40 + +#QSFP+ 22 from WC21 +portmap_22=85:40 + +#QSFP+ 23 from WC22 +portmap_23=89:40 + +#QSFP+ 24 from WC23 +portmap_24=93:40 + +#QSFP+ 25 from WC24 +portmap_25=97:40 + +#QSFP+ 26 from WC25 +portmap_26=101:40 + +#QSFP+ 27 from WC26 +portmap_27=105:40 + +#QSFP+ 28 from WC27 +portmap_28=109:40 + +#QSFP+ 29 from WC28 +portmap_29=113:40 + +#QSFP+ 30 from WC29 +portmap_30=117:40 + +#QSFP+ 31 from WC30 +portmap_31=121:40 + +#QSFP+ 32 from WC31 +portmap_32=125:40 + +# L3 ECMP +# - In Trident2, VP LAGs share the same table as ECMP group table. +# The first N entries are reserved for VP LAGs, where N is the value of the +# config property "max_vp_lags". By default this was set to 256 +l3_max_ecmp_mode=1 +max_vp_lags=0 + +stable_size=0x2000000 diff --git a/device/accton/x86_64-accton_as6712_32x-r0/default_sku b/device/accton/x86_64-accton_as6712_32x-r0/default_sku new file mode 100644 index 000000000000..d8cdd655905b --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/default_sku @@ -0,0 +1 @@ +Accton-AS6712-32X t1 diff --git a/device/accton/x86_64-accton_as6712_32x-r0/installer.conf b/device/accton/x86_64-accton_as6712_32x-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/accton/x86_64-accton_as6712_32x-r0/led_proc_init.soc b/device/accton/x86_64-accton_as6712_32x-r0/led_proc_init.soc new file mode 100644 index 000000000000..9e29adf790de --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/led_proc_init.soc @@ -0,0 +1,104 @@ +# LED setting for active +# ----------------------------------------------------------------------------- +# for as6712_32x (32 qxg) +# ----------------------------------------------------------------------------- + +s CMIC_LEDUP0_DATA_RAM 0 +s CMIC_LEDUP1_DATA_RAM 0 + +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=0 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=1 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=2 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=3 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=4 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=5 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=6 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=7 + +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=8 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=9 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=10 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=11 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=12 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=13 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=14 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=15 + + +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_62=63 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_61=62 +m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=61 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_58=60 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_57=59 +m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=58 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_54=57 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_53=56 +m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_50=54 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_49=53 +m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=52 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_46=51 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_45=50 +m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=49 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_42=48 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_41=47 +m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=46 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_38=45 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_37=44 +m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=43 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_34=42 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_33=41 +m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=40 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_30=39 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_29=38 +m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=37 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_26=36 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_25=35 +m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=34 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_22=33 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_21=32 +m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=31 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_18=30 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_17=29 +m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=28 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_14=27 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_13=26 +m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=25 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_10=24 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=23 +m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=22 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_6=21 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_5=20 +m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=19 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_2=18 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_1=17 +m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=16 + + +led 0 stop +led 0 prog \ + 02 F9 42 80 02 F7 42 00 02 F8 42 00 02 F4 42 90 02 \ + F3 42 10 67 6A 67 6A 67 38 67 6A 67 6A 67 6A 67 6A \ + 67 6A 67 6A 86 F8 06 F3 D6 F8 74 14 86 F0 3E F4 67 \ + 6A 57 67 7E 57 06 F8 88 80 4A 00 27 97 75 35 90 4A \ + 00 27 4A 01 27 B7 97 71 4F 77 32 06 F5 D6 F0 74 62 \ + 02 F5 4A 07 37 4E 07 02 F0 42 00 4E 07 02 F5 4A 07 \ + 71 32 77 35 16 F7 06 F9 17 4D DA 07 74 7B 12 F7 52 \ + 00 86 F9 57 86 F7 57 16 F7 06 F9 07 4D DA 07 74 8F \ + 12 F7 52 00 86 F9 57 86 F7 57 00 00 00 00 00 00 00 \ + 00 00 00 00 00 00 00 +led 0 start + +led 1 stop +led 1 prog \ + 02 F9 42 80 02 F7 42 00 02 F8 42 01 02 F4 42 90 02 \ + F3 42 11 67 6A 67 6A 67 38 67 6A 67 6A 67 6A 67 6A \ + 67 6A 67 6A 86 F8 06 F3 D6 F8 74 14 86 F0 3E F4 67 \ + 6A 57 67 7E 57 06 F8 88 80 4A 00 27 97 75 35 90 4A \ + 00 27 4A 01 27 B7 97 71 4F 77 32 06 F5 D6 F0 74 62 \ + 02 F5 4A 07 37 4E 07 02 F0 42 00 4E 07 02 F5 4A 07 \ + 71 32 77 35 16 F7 06 F9 17 4D DA 07 74 7B 12 F7 52 \ + 00 86 F9 57 86 F7 57 16 F7 06 F9 07 4D DA 07 74 8F \ + 12 F7 52 00 86 F9 57 86 F7 57 00 00 00 00 00 00 00 \ + 00 00 00 00 00 00 00 +led 1 start diff --git a/device/accton/x86_64-accton_as6712_32x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as6712_32x-r0/plugins/eeprom.py new file mode 100644 index 000000000000..7681caafeef4 --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/plugins/eeprom.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + #Two i2c buses might get flipped order, check them both. + if not os.path.exists(self.eeprom_path): + self.eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as6712_32x-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as6712_32x-r0/plugins/psuutil.py new file mode 100644 index 000000000000..191654429e6b --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "35-0038", + 2: "36-003b", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as6712_32x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as6712_32x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..3c93649d760e --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/plugins/sfputil.py @@ -0,0 +1,215 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + import os + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + QSFP_PORT_START = 0 + QSFP_PORT_END = 32 + + I2C_DEV_PATH = "/sys/bus/i2c/devices/" + BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/" + BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" + CPLD_ADDRESS = ['-0062', '-0064'] + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0: [1, 2], + 1: [2, 3], + 2: [3, 4], + 3: [4, 5], + 4: [5, 6], + 5: [6, 7], + 6: [7, 8], + 7: [8, 9], + 8: [9, 10], + 9: [10, 11], + 10: [11, 12], + 11: [12, 13], + 12: [13, 14], + 13: [14, 15], + 14: [15, 16], + 15: [16, 17], + 16: [17, 18], + 17: [18, 19], + 18: [19, 20], + 19: [20, 21], + 20: [21, 22], + 21: [22, 23], + 22: [23, 24], + 23: [24, 25], + 24: [25, 26], + 25: [26, 27], + 26: [27, 28], + 27: [28, 29], + 28: [29, 30], + 29: [30, 31], + 30: [31, 32], + 31: [32, 33], + 32: [33, 34], + 33: [34, 35], + 34: [35, 36], + 35: [36, 37], + 36: [37, 38], + 37: [38, 39], + 38: [39, 40], + 39: [40, 41], + 40: [41, 42], + 41: [42, 43], + 42: [43, 44], + 43: [44, 45], + 44: [45, 46], + 45: [46, 47], + 46: [47, 48], + 47: [48, 49], + 48: [49, 50],#QSFP49 + 49: [49, 50], + 50: [49, 50], + 51: [49, 50], + 52: [50, 52],#QSFP50 + 53: [50, 52], + 54: [50, 52], + 55: [50, 52], + 56: [51, 54],#QSFP51 + 57: [51, 54], + 58: [51, 54], + 59: [51, 54], + 60: [52, 51],#QSFP52 + 61: [52, 51], + 62: [52, 51], + 63: [52, 51], + 64: [53, 53], #QSFP53 + 65: [53, 53], + 66: [53, 53], + 67: [53, 53], + 68: [54, 55],#QSFP54 + 69: [54, 55], + 70: [54, 55], + 71: [54, 55], + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = self.BASE_OOM_PATH + "eeprom" + + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x][1] + ) + + SfpUtilBase.__init__(self) + + def get_cpld_dev_path(self, port_num): + if port_num < 16: + cpld_num = 0 + else: + cpld_num = 1 + + #cpld can be at either bus 0 or bus 1. + cpld_path = self.I2C_DEV_PATH + str(0) + self.CPLD_ADDRESS[cpld_num] + if not os.path.exists(cpld_path): + cpld_path = self.I2C_DEV_PATH + str(1) + self.CPLD_ADDRESS[cpld_num] + return cpld_path + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + cpld_path = self.get_cpld_dev_path(port_num) + present_path = cpld_path + "/module_present_" + present_path += str(self._port_to_i2c_mapping[port_num][0]) + + self.__port_to_is_present = present_path + + try: + val_file = open(self.__port_to_is_present) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def set_low_power_mode(self, port_num, lpmode): + raise NotImplementedError + + def reset(self, port_num): + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + cpld_path = self.get_cpld_dev_path(port_num) + _path = cpld_path + "/module_reset_" + _path += str(self._port_to_i2c_mapping[port_num][0]) + + try: + reg_file = open(_path, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + + return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError + diff --git a/device/accton/x86_64-accton_as6712_32x-r0/sensors.conf b/device/accton/x86_64-accton_as6712_32x-r0/sensors.conf new file mode 100644 index 000000000000..84ee0fd9f333 --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/sensors.conf @@ -0,0 +1,23 @@ +# libsensors configuration file for AS6712-32X +# ------------------------------------------------ + +chip "cpr_4011_4mxx-i2c-*-3c" + label in1 "PSU1_VIN" + label in2 "PSU1_VOUT" + label curr1 "PSU1_IIN" + label curr2 "PSU1_IOUT" + label power1 "PSU1_PIN" + label power2 "PSU1_POUT" + label fan1 "PSU1_FAN" + label temp1 "PSU1_TEMP" + +chip "cpr_4011_4mxx-i2c-*-3f" + label in1 "PSU2_VIN" + label in2 "PSU2_VOUT" + label curr1 "PSU2_IIN" + label curr2 "PSU2_IOUT" + label power1 "PSU2_PIN" + label power2 "PSU2_POUT" + label fan1 "PSU2_FAN" + label temp1 "PSU2_TEMP" + diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 8f56a6cf50ad..61794979a753 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -20,6 +20,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(ACCTON_AS7312_54X_PLATFORM_MODULE) \ $(ACCTON_AS7326_56X_PLATFORM_MODULE) \ $(ACCTON_AS7716_32XB_PLATFORM_MODULE) \ + $(ACCTON_AS6712_32X_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7264Q28B_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index 729e76e3ed1d..72c2453c5359 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -7,6 +7,7 @@ ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7312_54X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7326_56X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7716_32XB_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS6712_32X_PLATFORM_MODULE_VERSION = 1.1 export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION export ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION @@ -15,6 +16,7 @@ export ACCTON_AS7716_32X_PLATFORM_MODULE_VERSION export ACCTON_AS7312_54X_PLATFORM_MODULE_VERSION export ACCTON_AS7326_56X_PLATFORM_MODULE_VERSION export ACCTON_AS7716_32XB_PLATFORM_MODULE_VERSION +export ACCTON_AS6712_32X_PLATFORM_MODULE_VERSION ACCTON_AS7712_32X_PLATFORM_MODULE = sonic-platform-accton-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7712_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton @@ -46,4 +48,8 @@ ACCTON_AS7716_32XB_PLATFORM_MODULE = sonic-platform-accton-as7716-32xb_$(ACCTON_ $(ACCTON_AS7716_32XB_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7716_32xb-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7716_32XB_PLATFORM_MODULE))) +ACCTON_AS6712_32X_PLATFORM_MODULE = sonic-platform-accton-as6712-32x_$(ACCTON_AS6712_32X_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS6712_32X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as6712_32x-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS6712_32X_PLATFORM_MODULE))) + SONIC_STRETCH_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/fanutil.py new file mode 100644 index 000000000000..73d020acccce --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/fanutil.py @@ -0,0 +1,253 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# 3/32/2018: Roy Lee modify for as7326_56x +# ------------------------------------------------------------------ + +try: + import time + import logging + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class FanUtil(object): + """Platform-specific FanUtil class""" + + FAN_NUM_ON_MAIN_BROAD = 5 + FAN_NUM_1_IDX = 1 + FAN_NUM_2_IDX = 2 + FAN_NUM_3_IDX = 3 + FAN_NUM_4_IDX = 4 + FAN_NUM_5_IDX = 5 + + FAN_NODE_NUM_OF_MAP = 2 + FAN_NODE_FAULT_IDX_OF_MAP = 1 + #FAN_NODE_SPEED_IDX_OF_MAP = 2 + FAN_NODE_DIR_IDX_OF_MAP = 2 + #FAN_NODE_DUTY_IDX_OF_MAP = 4 + #FANR_NODE_FAULT_IDX_OF_MAP = 5 + + #BASE_VAL_PATH = '/sys/bus/i2c/devices/11-0066/{0}' + #FAN_DUTY_PATH = '/sys/bus/i2c/devices/11-0066/fan_duty_cycle_percentage' + BASE_VAL_PATH = '/sys/devices/platform/as6712_32x_fan/{0}' + FAN_DUTY_PATH = '/sys/devices/platform/as6712_32x_fan/fan1_duty_cycle_percentage' + + #logfile = '' + #loglevel = logging.INFO + + """ Dictionary where + key1 = fan id index (integer) starting from 1 + key2 = fan node index (interger) starting from 1 + value = path to fan device file (string) """ + _fan_to_device_path_mapping = {} + +#fan1_direction +#fan1_fault +#fan1_present + + #(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage', + _fan_to_device_node_mapping = { + (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault', + (FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction', + + (FAN_NUM_2_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan2_fault', + (FAN_NUM_2_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan2_direction', + + (FAN_NUM_3_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan3_fault', + (FAN_NUM_3_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan3_direction', + + (FAN_NUM_4_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan4_fault', + (FAN_NUM_4_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan4_direction', + + (FAN_NUM_5_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan5_fault', + (FAN_NUM_5_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan5_direction', + + } + + def _get_fan_to_device_node(self, fan_num, node_num): + return self._fan_to_device_node_mapping[(fan_num, node_num)] + + def _get_fan_node_val(self, fan_num, node_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + + try: + val_file = open(device_path, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + def _set_fan_node_val(self, fan_num, node_num, val): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + content = str(val) + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'w') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + val_file.write(content) + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return True + + def __init__(self): + fan_path = self.BASE_VAL_PATH + + for fan_num in range(self.FAN_NUM_1_IDX, self.FAN_NUM_ON_MAIN_BROAD+1): + for node_num in range(self.FAN_NODE_FAULT_IDX_OF_MAP, self.FAN_NODE_NUM_OF_MAP+1): + self._fan_to_device_path_mapping[(fan_num, node_num)] = fan_path.format( + self._fan_to_device_node_mapping[(fan_num, node_num)]) + + def get_num_fans(self): + return self.FAN_NUM_ON_MAIN_BROAD + + def get_idx_fan_start(self): + return self.FAN_NUM_1_IDX + + def get_num_nodes(self): + return self.FAN_NODE_NUM_OF_MAP + + def get_idx_node_start(self): + return self.FAN_NODE_FAULT_IDX_OF_MAP + + def get_size_node_map(self): + return len(self._fan_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._fan_to_device_path_mapping) + + def get_fan_to_device_path(self, fan_num, node_num): + return self._fan_to_device_path_mapping[(fan_num, node_num)] + + def get_fan_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP) + + #def get_fan_speed(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP) + + def get_fan_dir(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP) + + def get_fan_duty_cycle(self): + #duty_path = self.FAN_DUTY_PATH + try: + val_file = open(self.FAN_DUTY_PATH) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + return int(content) + #self._get_fan_node_val(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP) +#static u32 reg_val_to_duty_cycle(u8 reg_val) +#{ +# reg_val &= FAN_DUTY_CYCLE_REG_MASK; +# return ((u32)(reg_val+1) * 625 + 75)/ 100; +#} +# + def set_fan_duty_cycle(self, val): + + try: + fan_file = open(self.FAN_DUTY_PATH, 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + #val = ((val + 1 ) * 625 +75 ) / 100 + fan_file.write(str(val)) + fan_file.close() + return True + + #def get_fanr_fault(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP) + + def get_fanr_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP) + + def get_fan_status(self, fan_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num, %d', fan_num) + return None + + if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0: + logging.debug('GET. FAN fault. fan_num, %d', fan_num) + return False + + #if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0: + # logging.debug('GET. FANR fault. fan_num, %d', fan_num) + # return False + + return True + +#def main(): +# fan = FanUtil() +# +# print 'get_size_node_map : %d' % fan.get_size_node_map() +# print 'get_size_path_map : %d' % fan.get_size_path_map() +# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): +# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1): +# print fan.get_fan_to_device_path(x, y) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/thermalutil.py new file mode 100644 index 000000000000..8fdb01ecc564 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/thermalutil.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018:Jostar modify for as7716_32x +# 3/23/2018: Roy Lee modify for as7326_56x +# ------------------------------------------------------------------ + +try: + import time + import logging + import glob + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class ThermalUtil(object): + """Platform-specific ThermalUtil class""" + + THERMAL_NUM_ON_MAIN_BROAD = 3 + THERMAL_NUM_1_IDX = 1 # 1_ON_MAIN_BROAD + THERMAL_NUM_2_IDX = 2 # 2_ON_MAIN_BROAD + THERMAL_NUM_3_IDX = 3 # 3_ON_MAIN_BROAD + + BASE_VAL_PATH = '/sys/bus/i2c/devices/{0}-00{1}/hwmon/hwmon*/temp1_input' + + """ Dictionary where + key1 = thermal id index (integer) starting from 1 + value = path to fan device file (string) """ + _thermal_to_device_path_mapping = {} + + _thermal_to_device_node_mapping = { + THERMAL_NUM_1_IDX: ['38', '48'], + THERMAL_NUM_2_IDX: ['39', '49'], + THERMAL_NUM_3_IDX: ['40', '4a'], + } + + def __init__(self): + thermal_path = self.BASE_VAL_PATH + + for x in range(self.THERMAL_NUM_1_IDX, self.THERMAL_NUM_ON_MAIN_BROAD+1): + self._thermal_to_device_path_mapping[x] = thermal_path.format( + self._thermal_to_device_node_mapping[x][0], + self._thermal_to_device_node_mapping[x][1]) + + def _get_thermal_node_val(self, thermal_num): + if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. thermal_num, %d', thermal_num) + return None + + device_path = self.get_thermal_to_device_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + + def get_num_thermals(self): + return self.THERMAL_NUM_ON_MAIN_BROAD + + def get_idx_thermal_start(self): + return self.THERMAL_NUM_1_IDX + + def get_size_node_map(self): + return len(self._thermal_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._thermal_to_device_path_mapping) + + def get_thermal_to_device_path(self, thermal_num): + return self._thermal_to_device_path_mapping[thermal_num] + + def get_thermal_1_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + + def get_thermal_2_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) + def get_thermal_temp(self): + return (self._get_thermal_node_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_node_val(self.THERMAL_NUM_3_IDX)) + +#def main(): +# thermal = ThermalUtil() +# +# print 'get_size_node_map : %d' % thermal.get_size_node_map() +# print 'get_size_path_map : %d' % thermal.get_size_path_map() +# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): +# print thermal.get_thermal_to_device_path(x) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/Makefile new file mode 100644 index 000000000000..d052ddaf04e6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/Makefile @@ -0,0 +1,2 @@ +obj-m:= accton_as6712_32x_psu.o accton-as6712-32x-cpld.o \ + accton_as6712_32x_fan.o cpr_4011_4mxx.o leds-accton_as6712_32x.o diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton-as6712-32x-cpld.c b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton-as6712-32x-cpld.c new file mode 100755 index 000000000000..ff350597a718 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton-as6712-32x-cpld.c @@ -0,0 +1,887 @@ +/* + * I2C multiplexer + * + * Copyright (C) 2014 Accton Technology Corporation. + * + * This module supports the accton cpld that hold the channel select + * mechanism for other i2c slave devices, such as SFP. + * This includes the: + * Accton as6712_32x CPLD1/CPLD2/CPLD3 + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +#define NUM_OF_CPLD1_CHANS 0x0 +#define NUM_OF_CPLD2_CHANS 0x10 +#define NUM_OF_CPLD3_CHANS 0x10 +#define CPLD_CHANNEL_SELECT_REG 0x2 +#define CPLD_DESELECT_CHANNEL 0xFF + +#define ACCTON_I2C_CPLD_MUX_MAX_NCHANS NUM_OF_CPLD3_CHANS + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +enum cpld_mux_type { + as6712_32x_cpld2, + as6712_32x_cpld3, + as6712_32x_cpld1 +}; + +struct as6712_32x_cpld_data { + enum cpld_mux_type type; + struct i2c_client *client; + u8 last_chan; /* last register value */ + struct device *hwmon_dev; + struct mutex update_lock; +}; + +struct chip_desc { + u8 nchans; + u8 deselectChan; +}; + +/* Provide specs for the PCA954x types we know about */ +static const struct chip_desc chips[] = { + [as6712_32x_cpld1] = { + .nchans = NUM_OF_CPLD1_CHANS, + .deselectChan = NUM_OF_CPLD1_CHANS, + }, + [as6712_32x_cpld2] = { + .nchans = NUM_OF_CPLD2_CHANS, + .deselectChan = NUM_OF_CPLD2_CHANS, + }, + [as6712_32x_cpld3] = { + .nchans = NUM_OF_CPLD3_CHANS, + .deselectChan = NUM_OF_CPLD3_CHANS, + } +}; + +static const struct i2c_device_id as6712_32x_cpld_mux_id[] = { + { "as6712_32x_cpld1", as6712_32x_cpld1 }, + { "as6712_32x_cpld2", as6712_32x_cpld2 }, + { "as6712_32x_cpld3", as6712_32x_cpld3 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, as6712_32x_cpld_mux_id); + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_TXDISABLE_ATTR_ID(index) MODULE_TXDISABLE_##index +#define TRANSCEIVER_RXLOS_ATTR_ID(index) MODULE_RXLOS_##index +#define TRANSCEIVER_TXFAULT_ATTR_ID(index) MODULE_TXFAULT_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index + +enum as6712_32x_cpld_sysfs_attributes { + CPLD_VERSION, + ACCESS, + MODULE_PRESENT_ALL, + MODULE_RXLOS_ALL, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + /*Reset*/ + TRANSCEIVER_RESET_ATTR_ID(1), + TRANSCEIVER_RESET_ATTR_ID(2), + TRANSCEIVER_RESET_ATTR_ID(3), + TRANSCEIVER_RESET_ATTR_ID(4), + TRANSCEIVER_RESET_ATTR_ID(5), + TRANSCEIVER_RESET_ATTR_ID(6), + TRANSCEIVER_RESET_ATTR_ID(7), + TRANSCEIVER_RESET_ATTR_ID(8), + TRANSCEIVER_RESET_ATTR_ID(9), + TRANSCEIVER_RESET_ATTR_ID(10), + TRANSCEIVER_RESET_ATTR_ID(11), + TRANSCEIVER_RESET_ATTR_ID(12), + TRANSCEIVER_RESET_ATTR_ID(13), + TRANSCEIVER_RESET_ATTR_ID(14), + TRANSCEIVER_RESET_ATTR_ID(15), + TRANSCEIVER_RESET_ATTR_ID(16), + TRANSCEIVER_RESET_ATTR_ID(17), + TRANSCEIVER_RESET_ATTR_ID(18), + TRANSCEIVER_RESET_ATTR_ID(19), + TRANSCEIVER_RESET_ATTR_ID(20), + TRANSCEIVER_RESET_ATTR_ID(21), + TRANSCEIVER_RESET_ATTR_ID(22), + TRANSCEIVER_RESET_ATTR_ID(23), + TRANSCEIVER_RESET_ATTR_ID(24), + TRANSCEIVER_RESET_ATTR_ID(25), + TRANSCEIVER_RESET_ATTR_ID(26), + TRANSCEIVER_RESET_ATTR_ID(27), + TRANSCEIVER_RESET_ATTR_ID(28), + TRANSCEIVER_RESET_ATTR_ID(29), + TRANSCEIVER_RESET_ATTR_ID(30), + TRANSCEIVER_RESET_ATTR_ID(31), + TRANSCEIVER_RESET_ATTR_ID(32), +}; + +/* sysfs attributes for hwmon + */ +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_status(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf); +static int as6712_32x_cpld_read_internal(struct i2c_client *client, u8 reg); +static int as6712_32x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value); + +/* transceiver attributes */ +#define DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index) +#define DECLARE_TRANSCEIVER_PRESENT_ATTR(index) &sensor_dev_attr_module_present_##index.dev_attr.attr + +#define DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IWUSR|S_IRUGO, show_status, set_status, MODULE_RESET_##index) +#define DECLARE_TRANSCEIVER_RESET_ATTR(index) &sensor_dev_attr_module_reset_##index.dev_attr.attr + +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); +/* transceiver attributes */ +static SENSOR_DEVICE_ATTR(module_present_all, S_IRUGO, show_present_all, NULL, MODULE_PRESENT_ALL); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(32); + +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_RESET_SENSOR_DEVICE_ATTR(32); + + +static struct attribute *as6712_32x_cpld1_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + NULL +}; + +static const struct attribute_group as6712_32x_cpld1_group = { + .attrs = as6712_32x_cpld1_attributes, +}; + +static struct attribute *as6712_32x_cpld2_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(1), + DECLARE_TRANSCEIVER_PRESENT_ATTR(2), + DECLARE_TRANSCEIVER_PRESENT_ATTR(3), + DECLARE_TRANSCEIVER_PRESENT_ATTR(4), + DECLARE_TRANSCEIVER_PRESENT_ATTR(5), + DECLARE_TRANSCEIVER_PRESENT_ATTR(6), + DECLARE_TRANSCEIVER_PRESENT_ATTR(7), + DECLARE_TRANSCEIVER_PRESENT_ATTR(8), + DECLARE_TRANSCEIVER_PRESENT_ATTR(9), + DECLARE_TRANSCEIVER_PRESENT_ATTR(10), + DECLARE_TRANSCEIVER_PRESENT_ATTR(11), + DECLARE_TRANSCEIVER_PRESENT_ATTR(12), + DECLARE_TRANSCEIVER_PRESENT_ATTR(13), + DECLARE_TRANSCEIVER_PRESENT_ATTR(14), + DECLARE_TRANSCEIVER_PRESENT_ATTR(15), + DECLARE_TRANSCEIVER_PRESENT_ATTR(16), + DECLARE_TRANSCEIVER_RESET_ATTR(1), + DECLARE_TRANSCEIVER_RESET_ATTR(2), + DECLARE_TRANSCEIVER_RESET_ATTR(3), + DECLARE_TRANSCEIVER_RESET_ATTR(4), + DECLARE_TRANSCEIVER_RESET_ATTR(5), + DECLARE_TRANSCEIVER_RESET_ATTR(6), + DECLARE_TRANSCEIVER_RESET_ATTR(7), + DECLARE_TRANSCEIVER_RESET_ATTR(8), + DECLARE_TRANSCEIVER_RESET_ATTR(9), + DECLARE_TRANSCEIVER_RESET_ATTR(10), + DECLARE_TRANSCEIVER_RESET_ATTR(11), + DECLARE_TRANSCEIVER_RESET_ATTR(12), + DECLARE_TRANSCEIVER_RESET_ATTR(13), + DECLARE_TRANSCEIVER_RESET_ATTR(14), + DECLARE_TRANSCEIVER_RESET_ATTR(15), + DECLARE_TRANSCEIVER_RESET_ATTR(16), + NULL +}; + +static const struct attribute_group as6712_32x_cpld2_group = { + .attrs = as6712_32x_cpld2_attributes, +}; + +static struct attribute *as6712_32x_cpld3_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(17), + DECLARE_TRANSCEIVER_PRESENT_ATTR(18), + DECLARE_TRANSCEIVER_PRESENT_ATTR(19), + DECLARE_TRANSCEIVER_PRESENT_ATTR(20), + DECLARE_TRANSCEIVER_PRESENT_ATTR(21), + DECLARE_TRANSCEIVER_PRESENT_ATTR(22), + DECLARE_TRANSCEIVER_PRESENT_ATTR(23), + DECLARE_TRANSCEIVER_PRESENT_ATTR(24), + DECLARE_TRANSCEIVER_PRESENT_ATTR(25), + DECLARE_TRANSCEIVER_PRESENT_ATTR(26), + DECLARE_TRANSCEIVER_PRESENT_ATTR(27), + DECLARE_TRANSCEIVER_PRESENT_ATTR(28), + DECLARE_TRANSCEIVER_PRESENT_ATTR(29), + DECLARE_TRANSCEIVER_PRESENT_ATTR(30), + DECLARE_TRANSCEIVER_PRESENT_ATTR(31), + DECLARE_TRANSCEIVER_PRESENT_ATTR(32), + DECLARE_TRANSCEIVER_RESET_ATTR(17), + DECLARE_TRANSCEIVER_RESET_ATTR(18), + DECLARE_TRANSCEIVER_RESET_ATTR(19), + DECLARE_TRANSCEIVER_RESET_ATTR(20), + DECLARE_TRANSCEIVER_RESET_ATTR(21), + DECLARE_TRANSCEIVER_RESET_ATTR(22), + DECLARE_TRANSCEIVER_RESET_ATTR(23), + DECLARE_TRANSCEIVER_RESET_ATTR(24), + DECLARE_TRANSCEIVER_RESET_ATTR(25), + DECLARE_TRANSCEIVER_RESET_ATTR(26), + DECLARE_TRANSCEIVER_RESET_ATTR(27), + DECLARE_TRANSCEIVER_RESET_ATTR(28), + DECLARE_TRANSCEIVER_RESET_ATTR(29), + DECLARE_TRANSCEIVER_RESET_ATTR(30), + DECLARE_TRANSCEIVER_RESET_ATTR(31), + DECLARE_TRANSCEIVER_RESET_ATTR(32), + NULL +}; + +static const struct attribute_group as6712_32x_cpld3_group = { + .attrs = as6712_32x_cpld3_attributes, +}; + +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i, status; + u8 values[2] = {0}; + u8 regs[] = {0xA, 0xB}; + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as6712_32x_cpld_data *data = i2c_mux_priv(muxc); + + mutex_lock(&data->update_lock); + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = as6712_32x_cpld_read_internal(client, regs[i]); + + if (status < 0) { + goto exit; + } + + values[i] = ~(u8)status; + } + + mutex_unlock(&data->update_lock); + + /* Return values 1 -> 32 in order */ + return sprintf(buf, "%.2x %.2x\n", values[0], values[1]); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_status(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as6712_32x_cpld_data *data = i2c_mux_priv(muxc); + + int status = 0; + u8 reg = 0, mask = 0; + u32 val, para; + + if (sscanf(buf, "%d", ¶) != 1) { + return -EINVAL; + } + + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_32: + reg = 0x4 + (((attr->index - MODULE_PRESENT_1)/8)%2); + mask = 0x1 << ((attr->index - MODULE_PRESENT_1)%8); + break; + default: + return 0; + } + + mutex_lock(&data->update_lock); + status = as6712_32x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + val = status & ~mask; + if (!para) { /*0 means reset*/ + val |= mask; + } + status = as6712_32x_cpld_write_internal(client, reg, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as6712_32x_cpld_data *data = i2c_mux_priv(muxc); + int status = 0; + u8 reg = 0, mask = 0; + + switch (attr->index) { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + reg = 0xA; + mask = 0x1 << (attr->index - MODULE_PRESENT_1); + break; + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + reg = 0xB; + mask = 0x1 << (attr->index - MODULE_PRESENT_9); + break; + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + reg = 0xA; + mask = 0x1 << (attr->index - MODULE_PRESENT_17); + break; + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + reg = 0xB; + mask = 0x1 << (attr->index - MODULE_PRESENT_25); + break; + case MODULE_RESET_1 ... MODULE_RESET_32: + reg = 0x4 + (((attr->index - MODULE_PRESENT_1)/8)%2); + mask = 0x1 << ((attr->index - MODULE_PRESENT_1)%8); + break; + default: + return 0; + } + + mutex_lock(&data->update_lock); + status = as6712_32x_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", !(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as6712_32x_cpld_data *data = i2c_mux_priv(muxc); + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = as6712_32x_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() + for this as they will try to lock adapter a second time */ +static int as6712_32x_cpld_mux_reg_write(struct i2c_adapter *adap, + struct i2c_client *client, u8 val) +{ + unsigned long orig_jiffies; + unsigned short flags; + union i2c_smbus_data data; + int try; + s32 res = -EIO; + + data.byte = val; + flags = client->flags; + flags &= I2C_M_TEN | I2C_CLIENT_PEC; + + if (adap->algo->smbus_xfer) { + /* Retry automatically on arbitration loss */ + orig_jiffies = jiffies; + for (res = 0, try = 0; try <= adap->retries; try++) { + res = adap->algo->smbus_xfer(adap, client->addr, flags, + I2C_SMBUS_WRITE, CPLD_CHANNEL_SELECT_REG, + I2C_SMBUS_BYTE_DATA, &data); + if (res != -EAGAIN) + break; + if (time_after(jiffies, + orig_jiffies + adap->timeout)) + break; + } + } + + return res; +} + +static int as6712_32x_cpld_mux_select_chan(struct i2c_mux_core *muxc, + u32 chan) +{ + struct as6712_32x_cpld_data *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + u8 regval; + int ret = 0; + regval = chan; + + /* Only select the channel if its different from the last channel */ + if (data->last_chan != regval) { + ret = as6712_32x_cpld_mux_reg_write(muxc->parent, client, regval); + data->last_chan = regval; + } + + return ret; +} + +static int as6712_32x_cpld_mux_deselect_mux(struct i2c_mux_core *muxc, + u32 chan) +{ + struct as6712_32x_cpld_data *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + + /* Deselect active channel */ + data->last_chan = chips[data->type].deselectChan; + + return as6712_32x_cpld_mux_reg_write(muxc->parent, client, data->last_chan); +} + +static void as6712_32x_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void as6712_32x_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static ssize_t show_version(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, 0x1); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d", val); +} + +/* + * I2C init/probing/exit functions + */ +static int as6712_32x_cpld_mux_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + int force, class; + struct i2c_mux_core *muxc; + struct as6712_32x_cpld_data *data; + int chan = 0; + int ret = -ENODEV; + const struct attribute_group *group = NULL; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + return -ENODEV; + + muxc = i2c_mux_alloc(adap, &client->dev, + chips[id->driver_data].nchans, + sizeof(*data), 0, + as6712_32x_cpld_mux_select_chan, + as6712_32x_cpld_mux_deselect_mux); + if (!muxc) + return -ENOMEM; + + i2c_set_clientdata(client, muxc); + data = i2c_mux_priv(muxc); + data->client = client; + mutex_init(&data->update_lock); + + if (data->type == as6712_32x_cpld2 || data->type == as6712_32x_cpld3) { + data->type = id->driver_data; + data->last_chan = chips[data->type].deselectChan; /* force the first selection */ + + /* Now create an adapter for each channel */ + for (chan = 0; chan < chips[data->type].nchans; chan++) { + force = 0; /* dynamic adap number */ + class = 0; /* no class by default */ + + ret = i2c_mux_add_adapter(muxc, force, chan, class); + + if (ret) { + ret = -ENODEV; + dev_err(&client->dev, "failed to register multiplexed adapter %d\n", chan); + goto exit_mux_register; + } + } + + dev_info(&client->dev, "registered %d multiplexed busses for I2C mux %s\n", + chan, client->name); + } + + /* Register sysfs hooks */ + switch (data->type) { + case as6712_32x_cpld1: + group = &as6712_32x_cpld1_group; + break; + case as6712_32x_cpld2: + group = &as6712_32x_cpld2_group; + break; + case as6712_32x_cpld3: + group = &as6712_32x_cpld3_group; + break; + default: + break; + } + + if (group) { + ret = sysfs_create_group(&client->dev.kobj, group); + if (ret) { + goto exit_mux_register; + } + } + + if (chips[data->type].nchans) { + dev_info(&client->dev, + "registered %d multiplexed busses for I2C %s\n", + chan, client->name); + } + else { + dev_info(&client->dev, + "device %s registered\n", client->name); + } + + as6712_32x_cpld_add_client(client); + + return 0; + +exit_mux_register: + i2c_mux_del_adapters(muxc); + kfree(data); + return ret; +} + +static int as6712_32x_cpld_mux_remove(struct i2c_client *client) +{ + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct as6712_32x_cpld_data *data = i2c_mux_priv(muxc); + const struct attribute_group *group = NULL; + + as6712_32x_cpld_remove_client(client); + + /* Remove sysfs hooks */ + switch (data->type) { + case as6712_32x_cpld1: + group = &as6712_32x_cpld1_group; + break; + case as6712_32x_cpld2: + group = &as6712_32x_cpld2_group; + break; + case as6712_32x_cpld3: + group = &as6712_32x_cpld3_group; + break; + default: + break; + } + + if (group) { + sysfs_remove_group(&client->dev.kobj, group); + } + + i2c_mux_del_adapters(muxc); + + return 0; +} + +static int as6712_32x_cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static int as6712_32x_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +int as6712_32x_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as6712_32x_cpld_read_internal(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as6712_32x_cpld_read); + +int as6712_32x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as6712_32x_cpld_write_internal(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as6712_32x_cpld_write); + +static struct i2c_driver as6712_32x_cpld_mux_driver = { + .driver = { + .name = "as6712_32x_cpld", + .owner = THIS_MODULE, + }, + .probe = as6712_32x_cpld_mux_probe, + .remove = as6712_32x_cpld_mux_remove, + .id_table = as6712_32x_cpld_mux_id, +}; + +static int __init as6712_32x_cpld_mux_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as6712_32x_cpld_mux_driver); +} + +static void __exit as6712_32x_cpld_mux_exit(void) +{ + i2c_del_driver(&as6712_32x_cpld_mux_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("Accton as6712-32x CPLD driver"); +MODULE_LICENSE("GPL"); + +module_init(as6712_32x_cpld_mux_init); +module_exit(as6712_32x_cpld_mux_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton_as6712_32x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton_as6712_32x_fan.c new file mode 100644 index 000000000000..7033d8b75687 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton_as6712_32x_fan.c @@ -0,0 +1,463 @@ +/* + * A hwmon driver for the Accton as6712 32x fan contrl + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as6712_32x_fan" + +#define FAN_MAX_NUMBER 5 +#define FAN_SPEED_CPLD_TO_RPM_STEP 150 +#define FAN_SPEED_PRECENT_TO_CPLD_STEP 5 +#define FAN_DUTY_CYCLE_MIN 0 /* 10% ??*/ +#define FAN_DUTY_CYCLE_MAX 100 /* 100% */ + +#define CPLD_REG_FAN_STATUS_OFFSET 0xC +#define CPLD_REG_FANR_STATUS_OFFSET 0x17 +#define CPLD_REG_FAN_DIRECTION_OFFSET 0x1E + +#define CPLD_FAN1_REG_SPEED_OFFSET 0x10 +#define CPLD_FAN2_REG_SPEED_OFFSET 0x11 +#define CPLD_FAN3_REG_SPEED_OFFSET 0x12 +#define CPLD_FAN4_REG_SPEED_OFFSET 0x13 +#define CPLD_FAN5_REG_SPEED_OFFSET 0x14 + +#define CPLD_FANR1_REG_SPEED_OFFSET 0x18 +#define CPLD_FANR2_REG_SPEED_OFFSET 0x19 +#define CPLD_FANR3_REG_SPEED_OFFSET 0x1A +#define CPLD_FANR4_REG_SPEED_OFFSET 0x1B +#define CPLD_FANR5_REG_SPEED_OFFSET 0x1C + +#define CPLD_REG_FAN_PWM_CYCLE_OFFSET 0xD + +#define CPLD_FAN1_INFO_BIT_MASK 0x1 +#define CPLD_FAN2_INFO_BIT_MASK 0x2 +#define CPLD_FAN3_INFO_BIT_MASK 0x4 +#define CPLD_FAN4_INFO_BIT_MASK 0x8 +#define CPLD_FAN5_INFO_BIT_MASK 0x10 + +#define PROJECT_NAME + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(format, ...) printk(format, __VA_ARGS__) +#else + #define DEBUG_PRINT(format, ...) +#endif + +static struct accton_as6712_32x_fan *fan_data = NULL; + +struct accton_as6712_32x_fan { + struct platform_device *pdev; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[FAN_MAX_NUMBER]; /* inner first fan status */ + u32 speed[FAN_MAX_NUMBER]; /* inner first fan speed */ + u8 direction[FAN_MAX_NUMBER]; /* reconrd the direction of inner first and second fans */ + u32 duty_cycle[FAN_MAX_NUMBER]; /* control the speed of inner first and second fans */ + u8 r_status[FAN_MAX_NUMBER]; /* inner second fan status */ + u32 r_speed[FAN_MAX_NUMBER]; /* inner second fan speed */ +}; + +/*******************/ +#define MAKE_FAN_MASK_OR_REG(name,type) \ + CPLD_FAN##type##1_##name, \ + CPLD_FAN##type##2_##name, \ + CPLD_FAN##type##3_##name, \ + CPLD_FAN##type##4_##name, \ + CPLD_FAN##type##5_##name, + +/* fan related data + */ +static const u8 fan_info_mask[] = { + MAKE_FAN_MASK_OR_REG(INFO_BIT_MASK,) +}; + +static const u8 fan_speed_reg[] = { + MAKE_FAN_MASK_OR_REG(REG_SPEED_OFFSET,) +}; + +static const u8 fanr_speed_reg[] = { + MAKE_FAN_MASK_OR_REG(REG_SPEED_OFFSET,R) +}; + +/*******************/ +#define DEF_FAN_SET(id) \ + FAN##id##_FAULT, \ + FAN##id##_SPEED, \ + FAN##id##_DUTY_CYCLE, \ + FAN##id##_DIRECTION, \ + FANR##id##_FAULT, \ + FANR##id##_SPEED, + +enum sysfs_fan_attributes { + DEF_FAN_SET(1) + DEF_FAN_SET(2) + DEF_FAN_SET(3) + DEF_FAN_SET(4) + DEF_FAN_SET(5) +}; +/*******************/ +static void accton_as6712_32x_fan_update_device(struct device *dev); +static int accton_as6712_32x_fan_read_value(u8 reg); +static int accton_as6712_32x_fan_write_value(u8 reg, u8 value); + +static ssize_t fan_set_duty_cycle(struct device *dev, + struct device_attribute *da,const char *buf, size_t count); +static ssize_t fan_show_value(struct device *dev, + struct device_attribute *da, char *buf); +static ssize_t show_name(struct device *dev, + struct device_attribute *da, char *buf); + +extern int as6712_32x_cpld_read(unsigned short cpld_addr, u8 reg); +extern int as6712_32x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + + +/*******************/ +#define _MAKE_SENSOR_DEVICE_ATTR(prj, id, id2) \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##id##_SPEED); \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, \ + fan_set_duty_cycle, FAN##id##_DUTY_CYCLE); \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_direction, S_IRUGO, fan_show_value, NULL, FAN##id##_DIRECTION); \ + static SENSOR_DEVICE_ATTR(prj##fanr##id##_fault, S_IRUGO, fan_show_value, NULL, FANR##id##_FAULT); \ + static SENSOR_DEVICE_ATTR(prj##fanr##id##_speed_rpm, S_IRUGO, fan_show_value, NULL, FANR##id##_SPEED); \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_input, S_IRUGO, fan_show_value, NULL, FAN##id##_SPEED); \ + static SENSOR_DEVICE_ATTR(prj##fan##id2##_input, S_IRUGO, fan_show_value, NULL, FANR##id##_SPEED); \ + static SENSOR_DEVICE_ATTR(prj##fan##id##_fault, S_IRUGO, fan_show_value, NULL, FAN##id##_FAULT); \ + static SENSOR_DEVICE_ATTR(prj##fan##id2##_fault, S_IRUGO, fan_show_value, NULL, FAN##id##_FAULT); + +#define MAKE_SENSOR_DEVICE_ATTR(prj,id, id2) _MAKE_SENSOR_DEVICE_ATTR(prj,id, id2) + +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME ,1 ,11) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME ,2 ,12) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME ,3 ,13) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME ,4 ,14) +MAKE_SENSOR_DEVICE_ATTR(PROJECT_NAME ,5 ,15) + +static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); +/*******************/ + +#define _MAKE_FAN_ATTR(prj, id, id2) \ + &sensor_dev_attr_##prj##fan##id##_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_##prj##fan##id##_duty_cycle_percentage.dev_attr.attr,\ + &sensor_dev_attr_##prj##fan##id##_direction.dev_attr.attr, \ + &sensor_dev_attr_##prj##fanr##id##_fault.dev_attr.attr, \ + &sensor_dev_attr_##prj##fanr##id##_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_##prj##fan##id##_input.dev_attr.attr, \ + &sensor_dev_attr_##prj##fan##id2##_input.dev_attr.attr, \ + &sensor_dev_attr_##prj##fan##id##_fault.dev_attr.attr, \ + &sensor_dev_attr_##prj##fan##id2##_fault.dev_attr.attr, + + +#define MAKE_FAN_ATTR(prj, id, id2) _MAKE_FAN_ATTR(prj, id, id2) + +static struct attribute *accton_as6712_32x_fan_attributes[] = { + /* fan related attributes */ + MAKE_FAN_ATTR(PROJECT_NAME,1 ,11) + MAKE_FAN_ATTR(PROJECT_NAME,2 ,12) + MAKE_FAN_ATTR(PROJECT_NAME,3 ,13) + MAKE_FAN_ATTR(PROJECT_NAME,4 ,14) + MAKE_FAN_ATTR(PROJECT_NAME,5 ,15) + &sensor_dev_attr_name.dev_attr.attr, + NULL +}; +/*******************/ + +/* fan related functions + */ +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + ssize_t ret = 0; + int data_index, type_index; + + accton_as6712_32x_fan_update_device(dev); + + if (fan_data->valid == 0) { + return ret; + } + + type_index = attr->index%FAN2_FAULT; + data_index = attr->index/FAN2_FAULT; + + switch (type_index) { + case FAN1_FAULT: + ret = sprintf(buf, "%d\n", fan_data->status[data_index]); + DEBUG_PRINT("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FAN1_SPEED: + ret = sprintf(buf, "%d\n", fan_data->speed[data_index]); + DEBUG_PRINT("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FAN1_DUTY_CYCLE: + ret = sprintf(buf, "%d\n", fan_data->duty_cycle[data_index]); + DEBUG_PRINT("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FAN1_DIRECTION: + ret = sprintf(buf, "%d\n", fan_data->direction[data_index]); /* presnet, need to modify*/ + DEBUG_PRINT("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FANR1_FAULT: + ret = sprintf(buf, "%d\n", fan_data->r_status[data_index]); + DEBUG_PRINT("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + case FANR1_SPEED: + ret = sprintf(buf, "%d\n", fan_data->r_speed[data_index]); + DEBUG_PRINT("[Check !!][%s][%d][type->index=%d][data->index=%d]\n", __FUNCTION__, __LINE__, type_index, data_index); + break; + default: + DEBUG_PRINT("[Check !!][%s][%d] \n", __FUNCTION__, __LINE__); + break; + } + + return ret; +} + +static ssize_t show_name(struct device *dev, struct device_attribute *da, + char *buf) +{ + return sprintf(buf, "%s\n", DRVNAME); +} +/*******************/ +static ssize_t fan_set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) { + + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < FAN_DUTY_CYCLE_MIN || value > FAN_DUTY_CYCLE_MAX) + return -EINVAL; + + accton_as6712_32x_fan_write_value(CPLD_REG_FAN_PWM_CYCLE_OFFSET, value/FAN_SPEED_PRECENT_TO_CPLD_STEP); + + fan_data->valid = 0; + + return count; +} + +static const struct attribute_group accton_as6712_32x_fan_group = { + .attrs = accton_as6712_32x_fan_attributes, +}; + +static int accton_as6712_32x_fan_read_value(u8 reg) +{ + return as6712_32x_cpld_read(0x60, reg); +} + +static int accton_as6712_32x_fan_write_value(u8 reg, u8 value) +{ + return as6712_32x_cpld_write(0x60, reg, value); +} + +static void accton_as6712_32x_fan_update_device(struct device *dev) +{ + int speed, r_speed, fault, r_fault, direction, ctrl_speed; + int i; + int retry_count; + + mutex_lock(&fan_data->update_lock); + + DEBUG_PRINT("Starting accton_as6712_32x_fan update \n"); + + if (!(time_after(jiffies, fan_data->last_updated + HZ + HZ / 2) || !fan_data->valid)) { + /* do nothing */ + goto _exit; + } + + fan_data->valid = 0; + + DEBUG_PRINT("Starting accton_as6712_32x_fan update 2 \n"); + + fault = accton_as6712_32x_fan_read_value(CPLD_REG_FAN_STATUS_OFFSET); + r_fault = accton_as6712_32x_fan_read_value(CPLD_REG_FANR_STATUS_OFFSET); + direction = accton_as6712_32x_fan_read_value(CPLD_REG_FAN_DIRECTION_OFFSET); + ctrl_speed = accton_as6712_32x_fan_read_value(CPLD_REG_FAN_PWM_CYCLE_OFFSET); + + if ( (fault < 0) || (r_fault < 0) || (ctrl_speed < 0) ) + { + DEBUG_PRINT("[Error!!][%s][%d] \n", __FUNCTION__, __LINE__); + goto _exit; /* error */ + } + + DEBUG_PRINT("[fan:] fault:%d, r_fault=%d, ctrl_speed=%d \n",fault, r_fault, ctrl_speed); + + for (i = 0; i < FAN_MAX_NUMBER; i++) + { + /* Update fan data + */ + + /* fan fault + * 0: normal, 1:abnormal + * Each FAN-tray module has two fans. + */ + fan_data->status[i] = (fault & fan_info_mask[i]) >> i; + DEBUG_PRINT("[fan%d:] fail=%d \n",i, fan_data->status[i]); + + fan_data->r_status[i] = (r_fault & fan_info_mask[i]) >> i; + fan_data->direction[i] = (direction & fan_info_mask[i]) >> i; + fan_data->duty_cycle[i] = ctrl_speed * FAN_SPEED_PRECENT_TO_CPLD_STEP; + + /* fan speed + */ + speed = 0; + r_speed = 0; + retry_count = 3; + while (retry_count) { + retry_count--; + speed = accton_as6712_32x_fan_read_value(fan_speed_reg[i]); + r_speed = accton_as6712_32x_fan_read_value(fanr_speed_reg[i]); + if ( (speed < 0) || (r_speed < 0) ) + { + DEBUG_PRINT("[Error!!][%s][%d] \n", __FUNCTION__, __LINE__); + goto _exit; /* error */ + } + if ( (speed == 0) || (r_speed == 0) ) + { + msleep(50); + continue; + } + break; + } + + DEBUG_PRINT("[fan%d:] speed:%d, r_speed=%d \n", i, speed, r_speed); + + fan_data->speed[i] = speed * FAN_SPEED_CPLD_TO_RPM_STEP; + fan_data->r_speed[i] = r_speed * FAN_SPEED_CPLD_TO_RPM_STEP; + } + + /* finish to update */ + fan_data->last_updated = jiffies; + fan_data->valid = 1; + +_exit: + mutex_unlock(&fan_data->update_lock); +} + +static int accton_as6712_32x_fan_probe(struct platform_device *pdev) +{ + int status = -1; + + /* Register sysfs hooks */ + status = sysfs_create_group(&pdev->dev.kobj, &accton_as6712_32x_fan_group); + if (status) { + goto exit; + + } + + fan_data->hwmon_dev = hwmon_device_register(&pdev->dev); + if (IS_ERR(fan_data->hwmon_dev)) { + status = PTR_ERR(fan_data->hwmon_dev); + goto exit_remove; + } + + dev_info(&pdev->dev, "accton_as6712_32x_fan\n"); + + return 0; + +exit_remove: + sysfs_remove_group(&pdev->dev.kobj, &accton_as6712_32x_fan_group); +exit: + return status; +} + +static int accton_as6712_32x_fan_remove(struct platform_device *pdev) +{ + hwmon_device_unregister(fan_data->hwmon_dev); + sysfs_remove_group(&fan_data->pdev->dev.kobj, &accton_as6712_32x_fan_group); + + return 0; +} + + + +static struct platform_driver accton_as6712_32x_fan_driver = { + .probe = accton_as6712_32x_fan_probe, + .remove = accton_as6712_32x_fan_remove, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as6712_32x_fan_init(void) +{ + int ret; + + ret = platform_driver_register(&accton_as6712_32x_fan_driver); + if (ret < 0) { + goto exit; + } + + fan_data = kzalloc(sizeof(struct accton_as6712_32x_fan), GFP_KERNEL); + if (!fan_data) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as6712_32x_fan_driver); + goto exit; + } + + mutex_init(&fan_data->update_lock); + fan_data->valid = 0; + + fan_data->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(fan_data->pdev)) { + ret = PTR_ERR(fan_data->pdev); + platform_driver_unregister(&accton_as6712_32x_fan_driver); + kfree(fan_data); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as6712_32x_fan_exit(void) +{ + platform_device_unregister(fan_data->pdev); + platform_driver_unregister(&accton_as6712_32x_fan_driver); + kfree(fan_data); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as6712_32x_fan driver"); +MODULE_LICENSE("GPL"); + +module_init(accton_as6712_32x_fan_init); +module_exit(accton_as6712_32x_fan_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton_as6712_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton_as6712_32x_psu.c new file mode 100644 index 000000000000..5b9eda261489 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/accton_as6712_32x_psu.c @@ -0,0 +1,364 @@ +/* + * An hwmon driver for accton as6712_32x Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PSU_STATUS_I2C_ADDR 0x60 +#define PSU_STATUS_I2C_REG_OFFSET 0x2 + +#define IS_POWER_GOOD(id, value) (!!(value & BIT(id*4 + 1))) +#define IS_PRESENT(id, value) (!(value & BIT(id*4))) + +static ssize_t show_index(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static int as6712_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as6712_32x_cpld_read(unsigned short cpld_addr, u8 reg); +static int as6712_32x_psu_model_name_get(struct device *dev); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as6712_32x_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char model_name[14]; /* Model name, read from eeprom */ +}; + +static struct as6712_32x_psu_data *as6712_32x_psu_update_device(struct device *dev); + +enum as6712_32x_psu_sysfs_attributes { + PSU_INDEX, + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_index, S_IRUGO, show_index, NULL, PSU_INDEX); +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); + +static struct attribute *as6712_32x_psu_attributes[] = { + &sensor_dev_attr_psu_index.dev_attr.attr, + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static ssize_t show_index(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as6712_32x_psu_data *data = i2c_get_clientdata(client); + + return sprintf(buf, "%d\n", data->index); +} + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as6712_32x_psu_data *data = as6712_32x_psu_update_device(dev); + u8 status = 0; + + if (!data->valid) { + return sprintf(buf, "0\n"); + } + + if (attr->index == PSU_PRESENT) { + status = IS_PRESENT(data->index, data->status); + } + else { /* PSU_POWER_GOOD */ + status = IS_POWER_GOOD(data->index, data->status); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as6712_32x_psu_data *data = as6712_32x_psu_update_device(dev); + + if (!data->valid) { + return 0; + } + + if (!IS_PRESENT(data->index, data->status)) { + return 0; + } + + if (as6712_32x_psu_model_name_get(dev) < 0) { + return -ENXIO; + } + return sprintf(buf, "%s\n", data->model_name); +} + +static const struct attribute_group as6712_32x_psu_group = { + .attrs = as6712_32x_psu_attributes, +}; + +static int as6712_32x_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as6712_32x_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as6712_32x_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as6712_32x_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as6712_32x_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as6712_32x_psu_remove(struct i2c_client *client) +{ + struct as6712_32x_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as6712_32x_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as6712_32x_psu1, + as6712_32x_psu2 +}; + +static const struct i2c_device_id as6712_32x_psu_id[] = { + { "as6712_32x_psu1", as6712_32x_psu1 }, + { "as6712_32x_psu2", as6712_32x_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as6712_32x_psu_id); + +static struct i2c_driver as6712_32x_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as6712_32x_psu", + }, + .probe = as6712_32x_psu_probe, + .remove = as6712_32x_psu_remove, + .id_table = as6712_32x_psu_id, + .address_list = normal_i2c, +}; + +static int as6712_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +enum psu_type { + PSU_YM_2401_JCR, /* AC110V - F2B */ + PSU_YM_2401_JDR, /* AC110V - B2F */ + PSU_CPR_4011_4M11, /* AC110V - F2B */ + PSU_CPR_4011_4M21, /* AC110V - B2F */ + PSU_CPR_6011_2M11, /* AC110V - F2B */ + PSU_CPR_6011_2M21, /* AC110V - B2F */ + PSU_UM400D_01G, /* DC48V - F2B */ + PSU_UM400D01_01G /* DC48V - B2F */ +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + char* model_name; +}; + +struct model_name_info models[] = { +{PSU_YM_2401_JCR, 0x20, 11, "YM-2401JCR"}, +{PSU_YM_2401_JDR, 0x20, 11, "YM-2401JDR"}, +{PSU_CPR_4011_4M11, 0x26, 13, "CPR-4011-4M11"}, +{PSU_CPR_4011_4M21, 0x26, 13, "CPR-4011-4M21"}, +{PSU_CPR_6011_2M11, 0x26, 13, "CPR-6011-2M11"}, +{PSU_CPR_6011_2M21, 0x26, 13, "CPR-6011-2M21"}, +{PSU_UM400D_01G, 0x50, 9, "um400d01G"}, +{PSU_UM400D01_01G, 0x50, 12, "um400d01-01G"}, +}; + +static int as6712_32x_psu_model_name_get(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as6712_32x_psu_data *data = i2c_get_clientdata(client); + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->model_name, 0, sizeof(data->model_name)); + + status = as6712_32x_psu_read_block(client, models[i].offset, + data->model_name, models[i].length); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data->model_name[models[i].length] = '\0'; + } + + if (i == PSU_YM_2401_JCR || i == PSU_YM_2401_JDR) { + /* Skip the meaningless data byte 8*/ + data->model_name[8] = data->model_name[9]; + data->model_name[9] = data->model_name[10]; + data->model_name[10] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, models[i].length) == 0) { + return 0; + } + else { + data->model_name[0] = '\0'; + } + } + + return -ENODATA; +} +static struct as6712_32x_psu_data *as6712_32x_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as6712_32x_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status = -1; + + dev_dbg(&client->dev, "Starting as6812_32x update\n"); + data->valid = 0; + + /* Read psu status */ + status = as6712_32x_cpld_read(PSU_STATUS_I2C_ADDR, PSU_STATUS_I2C_REG_OFFSET); + + if (status < 0) { + dev_dbg(&client->dev, "cpld reg (0x%x) err %d\n", PSU_STATUS_I2C_ADDR, status); + goto exit; + } + else { + data->status = status; + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(as6712_32x_psu_driver); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("as6712_32x_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/cpr_4011_4mxx.c b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/cpr_4011_4mxx.c new file mode 100644 index 000000000000..15cef4ef50d7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/cpr_4011_4mxx.c @@ -0,0 +1,439 @@ +/* + * An hwmon driver for the CPR-4011-4Mxx Redundant Power Module + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#if 0 +#define DEBUG +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x3c, 0x3d, 0x3e, 0x3f, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct cpr_4011_4mxx_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 vout_mode; /* Register value */ + u16 v_in; /* Register value */ + u16 v_out; /* Register value */ + u16 i_in; /* Register value */ + u16 i_out; /* Register value */ + u16 p_in; /* Register value */ + u16 p_out; /* Register value */ + u16 temp_input[2]; /* Register value */ + u8 fan_fault; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u16 fan_speed[2]; /* Register value */ +}; + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_vout(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static int cpr_4011_4mxx_write_word(struct i2c_client *client, u8 reg, u16 value); +static struct cpr_4011_4mxx_data *cpr_4011_4mxx_update_device(struct device *dev); + +enum cpr_4011_4mxx_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT, + PSU_P_IN_UV, + PSU_P_OUT_UV, + PSU_TEMP1_INPUT, + PSU_FAN1_FAULT, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_v_in, S_IRUGO, show_linear, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_in, S_IRUGO, show_linear, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_in, S_IRUGO, show_linear, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); + +/*Duplicate nodes for lm-sensors. 1 for input, 2 for output.*/ +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_linear, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_vout, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, show_linear, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, show_linear, NULL, PSU_P_IN_UV); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_linear, NULL, PSU_P_OUT_UV); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); + + + + + +static struct attribute *cpr_4011_4mxx_attributes[] = { + &sensor_dev_attr_psu_v_in.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_in.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_in.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + /*Duplicate nodes for lm-sensors.*/ + &sensor_dev_attr_curr1_input.dev_attr.attr, + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_power1_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan1_fault.dev_attr.attr, + NULL +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + cpr_4011_4mxx_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_IN: + value = data->v_in; + break; + case PSU_I_IN: + value = data->i_in; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_IN_UV: + multiplier = 1000000; /*For lm-sensors, unit is micro-Volt.*/ + /*Passing through*/ + case PSU_P_IN: + value = data->p_in; + break; + case PSU_P_OUT_UV: + multiplier = 1000000; /*For lm-sensors, unit is micro-Volt.*/ + /*Passing through*/ + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp_input[0]; + break; + case PSU_FAN1_DUTY_CYCLE: + multiplier = 1; + value = data->fan_duty_cycle[0]; + break; + case PSU_FAN1_SPEED: + multiplier = 1; + value = data->fan_speed[0]; + break; + default: + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_vout(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct cpr_4011_4mxx_data *data = cpr_4011_4mxx_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->v_out; + + return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static const struct attribute_group cpr_4011_4mxx_group = { + .attrs = cpr_4011_4mxx_attributes, +}; + +static int cpr_4011_4mxx_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct cpr_4011_4mxx_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct cpr_4011_4mxx_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cpr_4011_4mxx_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int cpr_4011_4mxx_remove(struct i2c_client *client) +{ + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cpr_4011_4mxx_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id cpr_4011_4mxx_id[] = { + { "cpr_4011_4mxx", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, cpr_4011_4mxx_id); + +static struct i2c_driver cpr_4011_4mxx_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "cpr_4011_4mxx", + }, + .probe = cpr_4011_4mxx_probe, + .remove = cpr_4011_4mxx_remove, + .id_table = cpr_4011_4mxx_id, + .address_list = normal_i2c, +}; + +static int cpr_4011_4mxx_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int cpr_4011_4mxx_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int cpr_4011_4mxx_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct cpr_4011_4mxx_data *cpr_4011_4mxx_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpr_4011_4mxx_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int i, status; + struct reg_data_byte regs_byte[] = { {0x20, &data->vout_mode}, + {0x81, &data->fan_fault}}; + struct reg_data_word regs_word[] = { {0x96, &data->p_out}, /*p_out must be the first one.*/ + {0x97, &data->p_in}, + {0x8b, &data->v_out}, + {0x89, &data->i_in}, + {0x8c, &data->i_out}, + {0x8d, &(data->temp_input[0])}, + {0x8e, &(data->temp_input[1])}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x3c, &(data->fan_duty_cycle[1])}, + {0x90, &(data->fan_speed[0])}, + {0x91, &(data->fan_speed[1])}}; + + dev_dbg(&client->dev, "Starting cpr_4011_4mxx update\n"); + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = cpr_4011_4mxx_read_byte(client, regs_byte[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + *(regs_byte[i].value) = 0; + } + else { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = cpr_4011_4mxx_read_word(client, regs_word[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + *(regs_word[i].value) = 0; + } + else { + *(regs_word[i].value) = status; + } + + /*Elimated false values. so p_out must be updated at first. */ + if (data->p_out == 0) { + *(regs_word[i].value) = 0; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init cpr_4011_4mxx_init(void) +{ + return i2c_add_driver(&cpr_4011_4mxx_driver); +} + +static void __exit cpr_4011_4mxx_exit(void) +{ + i2c_del_driver(&cpr_4011_4mxx_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("CPR_4011_4MXX driver"); +MODULE_LICENSE("GPL"); + +module_init(cpr_4011_4mxx_init); +module_exit(cpr_4011_4mxx_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/leds-accton_as6712_32x.c b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/leds-accton_as6712_32x.c new file mode 100644 index 000000000000..2b45bc8777c8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/modules/leds-accton_as6712_32x.c @@ -0,0 +1,612 @@ +/* + * A LED driver for the accton_as6712_32x_led + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include + +extern int as6712_32x_cpld_read (unsigned short cpld_addr, u8 reg); +extern int as6712_32x_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "as6712_32x_led" + +struct accton_as6712_32x_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[4]; /* Register value, 0 = LOC/DIAG/FAN LED + 1 = PSU1/PSU2 LED + 2 = FAN1-4 LED + 3 = FAN5-6 LED */ +}; + +static struct accton_as6712_32x_led_data *ledctl = NULL; + +/* LED related data + */ +#define LED_TYPE_PSU1_REG_MASK 0x03 +#define LED_MODE_PSU1_GREEN_MASK 0x02 +#define LED_MODE_PSU1_AMBER_MASK 0x01 +#define LED_MODE_PSU1_OFF_MASK 0x03 +#define LED_MODE_PSU1_AUTO_MASK 0x00 + +#define LED_TYPE_PSU2_REG_MASK 0x0C +#define LED_MODE_PSU2_GREEN_MASK 0x08 +#define LED_MODE_PSU2_AMBER_MASK 0x04 +#define LED_MODE_PSU2_OFF_MASK 0x0C +#define LED_MODE_PSU2_AUTO_MASK 0x00 + +#define LED_TYPE_DIAG_REG_MASK 0x0C +#define LED_MODE_DIAG_GREEN_MASK 0x08 +#define LED_MODE_DIAG_AMBER_MASK 0x04 +#define LED_MODE_DIAG_OFF_MASK 0x0C +#define LED_MODE_DIAG_BLINK_MASK 0x48 + +#define LED_TYPE_FAN_REG_MASK 0x03 +#define LED_MODE_FAN_GREEN_MASK 0x02 +#define LED_MODE_FAN_AMBER_MASK 0x01 +#define LED_MODE_FAN_OFF_MASK 0x03 +#define LED_MODE_FAN_AUTO_MASK 0x00 + +#define LED_TYPE_FAN1_REG_MASK 0x03 +#define LED_TYPE_FAN2_REG_MASK 0xC0 +#define LED_TYPE_FAN3_REG_MASK 0x30 +#define LED_TYPE_FAN4_REG_MASK 0x0C +#define LED_TYPE_FAN5_REG_MASK 0x03 + +#define LED_MODE_FANX_GREEN_MASK 0x01 +#define LED_MODE_FANX_RED_MASK 0x02 +#define LED_MODE_FANX_OFF_MASK 0x00 + +#define LED_TYPE_LOC_REG_MASK 0x30 +#define LED_MODE_LOC_ON_MASK 0x00 +#define LED_MODE_LOC_OFF_MASK 0x10 +#define LED_MODE_LOC_BLINK_MASK 0x20 + +static const u8 led_reg[] = { + 0xA, /* LOC/DIAG/FAN LED*/ + 0xB, /* PSU1/PSU2 LED */ + 0xE, /* FAN2-5 LED */ + 0xF, /* FAN1 LED */ +}; + +enum led_type { + LED_TYPE_PSU1, + LED_TYPE_PSU2, + LED_TYPE_DIAG, + LED_TYPE_FAN, + LED_TYPE_FAN1, + LED_TYPE_FAN2, + LED_TYPE_FAN3, + LED_TYPE_FAN4, + LED_TYPE_FAN5, + LED_TYPE_LOC +}; + +enum led_light_mode { + LED_MODE_OFF = 0, + LED_MODE_GREEN, + LED_MODE_AMBER, + LED_MODE_RED, + LED_MODE_GREEN_BLINK, + LED_MODE_AMBER_BLINK, + LED_MODE_RED_BLINK, + LED_MODE_AUTO, +}; + +struct led_type_mode { + enum led_type type; + int type_mask; + enum led_light_mode mode; + int mode_mask; +}; + +struct led_type_mode led_type_mode_data[] = { +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_GREEN, LED_MODE_PSU1_GREEN_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_AMBER, LED_MODE_PSU1_AMBER_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_AUTO, LED_MODE_PSU1_AUTO_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_OFF, LED_MODE_PSU1_OFF_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_GREEN, LED_MODE_PSU2_GREEN_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_AMBER, LED_MODE_PSU2_AMBER_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_AUTO, LED_MODE_PSU2_AUTO_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_OFF, LED_MODE_PSU2_OFF_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_GREEN, LED_MODE_FAN_GREEN_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_AMBER, LED_MODE_FAN_AMBER_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_AUTO, LED_MODE_FAN_AUTO_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_OFF, LED_MODE_FAN_OFF_MASK}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 0}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 6}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 6}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 6}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 4}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 2}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 2}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 2}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 0}, +{LED_TYPE_DIAG, LED_TYPE_DIAG_REG_MASK, LED_MODE_GREEN, LED_MODE_DIAG_GREEN_MASK}, +{LED_TYPE_DIAG, LED_TYPE_DIAG_REG_MASK, LED_MODE_AMBER, LED_MODE_DIAG_AMBER_MASK}, +{LED_TYPE_DIAG, LED_TYPE_DIAG_REG_MASK, LED_MODE_OFF, LED_MODE_DIAG_OFF_MASK}, +{LED_TYPE_DIAG, LED_TYPE_DIAG_REG_MASK, LED_MODE_GREEN_BLINK, LED_MODE_DIAG_BLINK_MASK}, +{LED_TYPE_LOC, LED_TYPE_LOC_REG_MASK, LED_MODE_AMBER, LED_MODE_LOC_ON_MASK}, +{LED_TYPE_LOC, LED_TYPE_LOC_REG_MASK, LED_MODE_OFF, LED_MODE_LOC_OFF_MASK}, +{LED_TYPE_LOC, LED_TYPE_LOC_REG_MASK, LED_MODE_AMBER_BLINK, LED_MODE_LOC_BLINK_MASK} +}; + + +struct fanx_info_s { + u8 cname; /* device name */ + enum led_type type; + u8 reg_id; /* map to led_reg & reg_val */ +}; + +static struct fanx_info_s fanx_info[] = { + {'1', LED_TYPE_FAN1, 3}, + {'2', LED_TYPE_FAN2, 2}, + {'3', LED_TYPE_FAN3, 2}, + {'4', LED_TYPE_FAN4, 2}, + {'5', LED_TYPE_FAN5, 2}, +}; + +static int led_reg_val_to_light_mode(enum led_type type, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + + if (type != led_type_mode_data[i].type) + continue; + + if (type == LED_TYPE_DIAG) + { /* special case : bit 6 - meaning blinking */ + if (0x40 & reg_val) + return LED_MODE_GREEN_BLINK; + } + if ((led_type_mode_data[i].type_mask & reg_val) == + led_type_mode_data[i].mode_mask) + { + return led_type_mode_data[i].mode; + } + } + + return 0; +} + +static u8 led_light_mode_to_reg_val(enum led_type type, + enum led_light_mode mode, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + if (type != led_type_mode_data[i].type) + continue; + + if (mode != led_type_mode_data[i].mode) + continue; + + if (type == LED_TYPE_DIAG) + { + if (mode == LED_MODE_GREEN_BLINK) + { /* special case : bit 6 - meaning blinking */ + reg_val = 0x48 | (reg_val & ~0x4C); + break; + } + else + { /* for diag led, other case must cancel bit 6 first */ + reg_val = reg_val & ~0x40; + } + } + reg_val = led_type_mode_data[i].mode_mask | + (reg_val & (~led_type_mode_data[i].type_mask)); + break; + } + + return reg_val; +} + +static int accton_as6712_32x_led_read_value(u8 reg) +{ + return as6712_32x_cpld_read(0x60, reg); +} + +static int accton_as6712_32x_led_write_value(u8 reg, u8 value) +{ + return as6712_32x_cpld_write(0x60, reg, value); +} + +static void accton_as6712_32x_led_update(void) +{ + mutex_lock(&ledctl->update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting accton_as6712_32x_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status = accton_as6712_32x_led_read_value(led_reg[i]); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg[i], status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as6712_32x_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + u8 reg, enum led_type type) +{ + int reg_val; + + mutex_lock(&ledctl->update_lock); + + reg_val = accton_as6712_32x_led_read_value(reg); + + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + accton_as6712_32x_led_write_value(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as6712_32x_led_psu_1_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as6712_32x_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU1); +} + +static enum led_brightness accton_as6712_32x_led_psu_1_get(struct led_classdev *cdev) +{ + accton_as6712_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU1, ledctl->reg_val[1]); +} + +static void accton_as6712_32x_led_psu_2_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as6712_32x_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU2); +} + +static enum led_brightness accton_as6712_32x_led_psu_2_get(struct led_classdev *cdev) +{ + accton_as6712_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[1]); +} + +static void accton_as6712_32x_led_fan_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as6712_32x_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_FAN); +} + +static enum led_brightness accton_as6712_32x_led_fan_get(struct led_classdev *cdev) +{ + accton_as6712_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[0]); +} + + +static void accton_as6712_32x_led_fanx_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + enum led_type led_type1; + int reg_id; + int i, nsize; + int ncount = sizeof(fanx_info)/sizeof(struct fanx_info_s); + + for(i=0;iname); + + if (led_cdev->name[nsize-1] == fanx_info[i].cname) + { + led_type1 = fanx_info[i].type; + reg_id = fanx_info[i].reg_id; + accton_as6712_32x_led_set(led_cdev, led_light_mode, led_reg[reg_id], led_type1); + return; + } + } +} + + +static enum led_brightness accton_as6712_32x_led_fanx_get(struct led_classdev *cdev) +{ + enum led_type led_type1; + int reg_id; + int i, nsize; + int ncount = sizeof(fanx_info)/sizeof(struct fanx_info_s); + + for(i=0;iname); + + if (cdev->name[nsize-1] == fanx_info[i].cname) + { + led_type1 = fanx_info[i].type; + reg_id = fanx_info[i].reg_id; + accton_as6712_32x_led_update(); + return led_reg_val_to_light_mode(led_type1, ledctl->reg_val[reg_id]); + } + } + + + return led_reg_val_to_light_mode(LED_TYPE_FAN1, ledctl->reg_val[2]); +} + + +static void accton_as6712_32x_led_diag_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as6712_32x_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_DIAG); +} + +static enum led_brightness accton_as6712_32x_led_diag_get(struct led_classdev *cdev) +{ + accton_as6712_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_DIAG, ledctl->reg_val[0]); +} + +static void accton_as6712_32x_led_loc_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + accton_as6712_32x_led_set(led_cdev, led_light_mode, led_reg[0], LED_TYPE_LOC); +} + +static enum led_brightness accton_as6712_32x_led_loc_get(struct led_classdev *cdev) +{ + accton_as6712_32x_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_LOC, ledctl->reg_val[0]); +} + +static struct led_classdev accton_as6712_32x_leds[] = { + [LED_TYPE_PSU1] = { + .name = "accton_as6712_32x_led::psu1", + .default_trigger = "unused", + .brightness_set = accton_as6712_32x_led_psu_1_set, + .brightness_get = accton_as6712_32x_led_psu_1_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "accton_as6712_32x_led::psu2", + .default_trigger = "unused", + .brightness_set = accton_as6712_32x_led_psu_2_set, + .brightness_get = accton_as6712_32x_led_psu_2_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN] = { + .name = "accton_as6712_32x_led::fan", + .default_trigger = "unused", + .brightness_set = accton_as6712_32x_led_fan_set, + .brightness_get = accton_as6712_32x_led_fan_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN1] = { + .name = "accton_as6712_32x_led::fan1", + .default_trigger = "unused", + .brightness_set = accton_as6712_32x_led_fanx_set, + .brightness_get = accton_as6712_32x_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN2] = { + .name = "accton_as6712_32x_led::fan2", + .default_trigger = "unused", + .brightness_set = accton_as6712_32x_led_fanx_set, + .brightness_get = accton_as6712_32x_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN3] = { + .name = "accton_as6712_32x_led::fan3", + .default_trigger = "unused", + .brightness_set = accton_as6712_32x_led_fanx_set, + .brightness_get = accton_as6712_32x_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN4] = { + .name = "accton_as6712_32x_led::fan4", + .default_trigger = "unused", + .brightness_set = accton_as6712_32x_led_fanx_set, + .brightness_get = accton_as6712_32x_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN5] = { + .name = "accton_as6712_32x_led::fan5", + .default_trigger = "unused", + .brightness_set = accton_as6712_32x_led_fanx_set, + .brightness_get = accton_as6712_32x_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_DIAG] = { + .name = "accton_as6712_32x_led::diag", + .default_trigger = "unused", + .brightness_set = accton_as6712_32x_led_diag_set, + .brightness_get = accton_as6712_32x_led_diag_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_LOC] = { + .name = "accton_as6712_32x_led::loc", + .default_trigger = "unused", + .brightness_set = accton_as6712_32x_led_loc_set, + .brightness_get = accton_as6712_32x_led_loc_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, +}; + +static int accton_as6712_32x_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as6712_32x_leds); i++) { + led_classdev_suspend(&accton_as6712_32x_leds[i]); + } + + return 0; +} + +static int accton_as6712_32x_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as6712_32x_leds); i++) { + led_classdev_resume(&accton_as6712_32x_leds[i]); + } + + return 0; +} + +static int accton_as6712_32x_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(accton_as6712_32x_leds); i++) { + ret = led_classdev_register(&pdev->dev, &accton_as6712_32x_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(accton_as6712_32x_leds)){ + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&accton_as6712_32x_leds[i]); + } + } + + return ret; +} + +static int accton_as6712_32x_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(accton_as6712_32x_leds); i++) { + led_classdev_unregister(&accton_as6712_32x_leds[i]); + } + + return 0; +} + +static struct platform_driver accton_as6712_32x_led_driver = { + .probe = accton_as6712_32x_led_probe, + .remove = accton_as6712_32x_led_remove, + .suspend = accton_as6712_32x_led_suspend, + .resume = accton_as6712_32x_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as6712_32x_led_init(void) +{ + int ret; + + ret = platform_driver_register(&accton_as6712_32x_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct accton_as6712_32x_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as6712_32x_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&accton_as6712_32x_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as6712_32x_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&accton_as6712_32x_led_driver); + kfree(ledctl); +} + +module_init(accton_as6712_32x_led_init); +module_exit(accton_as6712_32x_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as6712_32x_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/service/as6712-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/service/as6712-platform-init.service new file mode 100644 index 000000000000..ffdd6e1cee74 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/service/as6712-platform-init.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS6712-32X Platform Monitoring service +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/local/bin/accton_as6712_util.py install +ExecStart=/usr/local/bin/accton_as6712_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/setup.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/setup.py new file mode 100644 index 000000000000..114b0837be69 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='as6712_32x', + version='1.0', + description='Module to initialize Accton AS6712-32X platforms', + + packages=['as6712_32x'], + package_dir={'as6712_32x': 'as6712-32x/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/README b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/README new file mode 100644 index 000000000000..bfa90e6b68e1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/README @@ -0,0 +1,74 @@ +Copyright (C) 2016 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Contents of this package: + module - Contains source code of as6712 kernel driver modules. + util - operational scripts. + +Sonic creates a docker container and run building process under it. +If user tries to built new drivers, please get into that docker and +dpkg-buildpackage for them. + +All Linux kernel code is licensed under the GPLv1. All other code is +licensed under the GPLv3. Please see the LICENSE file for copies of +both licenses. + +The code for integacting with Accton AS6712-32X has 2 parts, +kernel drivers and operational script. +The kernel drivers of peripherals are under module/ directory. +1. These drivers can be built to individual ko during dpkg-buildpackage. +2. A operational script, accton_as6712_util.py, for device initializatian. + Run "accton_as6712_util.py install" to install drivers. + +To initialize the system, run "accton_as6712_util.py install". +To clean up the drivers & devices, run "accton_as6712_util.py clean". +To dump information of sensors, run "accton_as6712_util.py show". +To dump SFP EEPROM, run "accton_as6712_util.py sff". +To set fan speed, run "accton_as6712_util.py set fan". +To enable/disable SFP emission, run "accton_as6712_util.py set sfp". +To set system LEDs' color, run "accton_as6712_util.py set led" +For more information, run "accton_as6712_util.py --help". + +==================================================================== +Besides applying accton_as6712_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +System LED: + There are 5 system LEDs at the lower-left corner of front panel. + They are loc, diag, fan, ps1, and ps2. + The sysfs interface color mappings are as follows: + Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + But not all colors are available for each LED. + +Fan Control: + There are 10 fans inside 5 fan modules. + All fans share 1 duty setting, ranged from 0~100. + +Thermal sensers: + 3 temperature sensors are controlled by the lm75 kernel modules. + +PSUs: + There 2 power supplies slot at the left/right side of the back. + Once if a PSU is not plugged, the status of it is shown failed. + +There are 32 QSFP modules are equipped. +Before operating on PSU and QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py new file mode 100755 index 000000000000..fbcc74565d62 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py @@ -0,0 +1,208 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# 4/10/2018: Roy Lee modify for as6712_32x +# ------------------------------------------------------------------ + +try: + import os + import sys, getopt + import subprocess + import click + import imp + import logging + import logging.config + import types + import time # this is only being used as part of the example + import traceback + from tabulate import tabulate + from as6712_32x.fanutil import FanUtil + from as6712_32x.thermalutil import ThermalUtil +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = 'accton_as6712_monitor' + +global log_file +global log_level + +# (LM75_1+ LM75_2+ LM75_3) is LM75 at i2c addresses 0x48, 0x49, and 0x4A. +# TMP = (LM75_1+ LM75_2+ LM75_3)/3 +#1. If TMP < 35, All fans run with duty 30%. +#2. If TMP>=35 or the temperature of any one of fan is higher than 40, +# All fans run with duty 50% +#3. If TMP >= 40 or the temperature of any one of fan is higher than 45, +# All fans run with duty 65%. +#4. If TMP >= 45 or the temperature of any one of fan is higher than 50, +# All fans run with duty 100%. +#5. Any one of 5 fans is fault, set duty = 100%. +#6. Direction factor. If it is B2F direction, duty + 10%. + + # MISC: + # 1.Check single LM75 before applied average. + # 2.If no matched fan speed is found from the policy, + # use FAN_DUTY_CYCLE_MIN as default speed + # Get current temperature + # 4.Decision 3: Decide new fan speed depend on fan direction/current fan speed/temperature + + + + +# Make a class we can use to capture stdout and sterr in the log +class accton_as6712_monitor(object): + # static temp var + _ori_temp = 0 + _new_perc = 0 + _ori_perc = 0 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_fans(self): + max_duty = 100 + fan_policy_f2b = { + 0: [30, 0, 105000], + 1: [50, 105000, 120000], + 2: [65, 120000, 135000], + 3: [max_duty, 135000, sys.maxsize], + } + fan_policy_b2f = { + 0: [40, 0, 105000], + 1: [60, 105000, 120000], + 2: [75, 120000, 135000], + 3: [max_duty, 135000, sys.maxsize], + } + fan_policy_single = { + 0: 40000, + 1: 45000, + 2: 50000, + } + + thermal = ThermalUtil() + fan = FanUtil() + for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): + fan_status = fan.get_fan_status(x) + if fan_status is None: + logging.debug('INFO. SET new_perc to %d (FAN stauts is None. fan_num:%d)', max_duty, x) + return False + if fan_status is False: + logging.debug('INFO. SET new_perc to %d (FAN fault. fan_num:%d)', max_duty, x) + fan.set_fan_duty_cycle(max_duty) + return True + #logging.debug('INFO. fan_status is True (fan_num:%d)', x) + + fan_dir=fan.get_fan_dir(1) + if fan_dir == 0: + fan_policy = fan_policy_f2b + else: + fan_policy = fan_policy_b2f + + #Decide fan duty by if any of sensors > fan_policy_single. + new_duty_cycle = fan_policy[0][0] + for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): + single_thm = thermal._get_thermal_node_val(x) + for y in range(0, len(fan_policy_single)): + if single_thm > fan_policy_single[y]: + if fan_policy[y+1][0] > new_duty_cycle: + new_duty_cycle = fan_policy[y+1][0] + logging.debug('INFO. Single thermal sensor %d with temp %d > %d , new_duty_cycle=%d', + x, single_thm, fan_policy_single[y], new_duty_cycle) + single_result = new_duty_cycle + + + #Find if current duty matched any of define duty. + #If not, set it to highest one. + cur_duty_cycle = fan.get_fan_duty_cycle() + for x in range(0, len(fan_policy)): + if cur_duty_cycle == fan_policy[x][0]: + break + if x == len(fan_policy) : + fan.set_fan_duty_cycle(fan_policy[0][0]) + cur_duty_cycle = max_duty + + #Decide fan duty by if sum of sensors falls into any of fan_policy{} + get_temp = thermal.get_thermal_temp() + new_duty_cycle = cur_duty_cycle + for x in range(0, len(fan_policy)): + y = len(fan_policy) - x -1 #checked from highest + if get_temp > fan_policy[y][1] and get_temp <= fan_policy[y][2] : + new_duty_cycle= fan_policy[y][0] + logging.debug('INFO. Sum of temp %d > %d , new_duty_cycle=%d', get_temp, fan_policy[y][1], new_duty_cycle) + + sum_result = new_duty_cycle + if (sum_result>single_result): + new_duty_cycle = sum_result; + else: + new_duty_cycle = single_result + + logging.debug('INFO. Final duty_cycle=%d', new_duty_cycle) + if(new_duty_cycle != cur_duty_cycle): + fan.set_fan_duty_cycle(new_duty_cycle) + return True + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['lfile=']) + except getopt.GetoptError: + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l ]' % sys.argv[0] + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + monitor = accton_as6712_monitor(log_file, log_level) + + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(10) + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py new file mode 100755 index 000000000000..a77841857e6c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py @@ -0,0 +1,627 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Description: +# Due to adoption of optoe drivers, sideband signals of SFPs are moved +# into cpld drivers. Add a new dict, cpld_of_module, for mapping this +# attributes to corresponding cpld nodes. +# + + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +PROJECT_NAME = 'as6712_32x' +version = '0.2.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':5, 'fan1':1, 'fan2':1,'fan3':1,'fan4':1,'fan5':1,'thermal':4, 'psu':2, 'sfp':32} + + +led_prefix ='/sys/devices/platform/as6712_32x_led/leds/accton_'+PROJECT_NAME+'_led::' +fan_prefix ='/sys/devices/platform/as6712_32x_' +hwmon_types = {'led': ['diag','fan','loc','psu1','psu2'], + 'fan1': ['fan'], + 'fan2': ['fan'], + 'fan3': ['fan'], + 'fan4': ['fan'], + 'fan5': ['fan'], + } +hwmon_nodes = {'led': ['brightness'] , + 'fan1': ['fan1_duty_cycle_percentage', 'fan1_fault', 'fan1_speed_rpm', 'fan1_direction', 'fanr1_fault', 'fanr1_speed_rpm'], + 'fan2': ['fan2_duty_cycle_percentage','fan2_fault', 'fan2_speed_rpm', 'fan2_direction', 'fanr2_fault', 'fanr2_speed_rpm'], + 'fan3': ['fan3_duty_cycle_percentage','fan3_fault', 'fan3_speed_rpm', 'fan3_direction', 'fanr3_fault', 'fanr3_speed_rpm'], + 'fan4': ['fan4_duty_cycle_percentage','fan4_fault', 'fan4_speed_rpm', 'fan4_direction', 'fanr4_fault', 'fanr4_speed_rpm'], + 'fan5': ['fan5_duty_cycle_percentage','fan5_fault', 'fan5_speed_rpm', 'fan5_direction', 'fanr5_fault', 'fanr5_speed_rpm'], + } +hwmon_prefix ={'led': led_prefix, + 'fan1': fan_prefix, + 'fan2': fan_prefix, + 'fan3': fan_prefix, + 'fan4': fan_prefix, + 'fan5': fan_prefix, + } + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'thermal': ['38-0048','39-0049', '40-004a', '41-004b'] , + 'psu': ['35-0038','36-003b'], + 'sfp': ['-0050']} +i2c_nodes = { + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['module_present_', 'sfp_tx_disable']} + +sfp_map = [ 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33 + ] + +#For sideband signals of SFP/QSFP modules. +bus_of_cpld = [0, 1] +cpld_of_module = {'-0062': list(range(0,16)), + '-0064': list(range(16,32)) } + + +mknod =[ +'echo as6712_32x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo as6712_32x_cpld2 0x62 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo as6712_32x_cpld3 0x64 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-1/new_device', + +# PSU-1 +'echo as6712_32x_psu1 0x38 > /sys/bus/i2c/devices/i2c-35/new_device', +'echo cpr_4011_4mxx 0x3c > /sys/bus/i2c/devices/i2c-35/new_device', +#'echo as6712_32x_psu1 0x50 > /sys/bus/i2c/devices/i2c-35/new_device', +#'echo ym2401 0x58 > /sys/bus/i2c/devices/i2c-35/new_device', + +# PSU-2 +'echo as6712_32x_psu2 0x3b > /sys/bus/i2c/devices/i2c-36/new_device', +'echo cpr_4011_4mxx 0x3f > /sys/bus/i2c/devices/i2c-36/new_device', +#'echo as6712_32x_psu2 0x53 > /sys/bus/i2c/devices/i2c-36/new_device', +#'echo ym2401 0x5b > /sys/bus/i2c/devices/i2c-36/new_device', + +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-38/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-39/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-40/new_device', +'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-41/new_device', +] + +mknod2 =[ +'echo as6712_32x_cpld1 0x60 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo as6712_32x_cpld2 0x62 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo as6712_32x_cpld3 0x64 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-0/new_device', + +# PSU-1 +'echo as6712_32x_psu1 0x38 > /sys/bus/i2c/devices/i2c-35/new_device', +'echo cpr_4011_4mxx 0x3c > /sys/bus/i2c/devices/i2c-35/new_device', +#'echo as6712_32x_psu1 0x50 > /sys/bus/i2c/devices/i2c-35/new_device', +#'echo ym2401 0x58 > /sys/bus/i2c/devices/i2c-35/new_device', + +# PSU-2 +'echo as6712_32x_psu2 0x3b > /sys/bus/i2c/devices/i2c-36/new_device', +'echo cpr_4011_4mxx 0x3f > /sys/bus/i2c/devices/i2c-36/new_device', +#'echo as6712_32x_psu2 0x53 > /sys/bus/i2c/devices/i2c-36/new_device', +#'echo ym2401 0x5b > /sys/bus/i2c/devices/i2c-36/new_device', + +'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-38/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-39/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-40/new_device', +'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-41/new_device', +] + +FORCE = 0 + + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-54 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ACCTON DBG]: "+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status = 1 + output = "" + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log ("cmd:" + cmd) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_inserted(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + + + +kos = [ +'depmod -ae', +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x', +'modprobe optoe', +'modprobe accton_as6712_32x_cpld', +'modprobe cpr_4011_4mxx', +#'modprobe ym2651y', +'modprobe accton_as6712_32x_fan', +'modprobe leds-accton_as6712_32x', +'modprobe accton_as6712_32x_psu'] + +def driver_install(): + global FORCE + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +def cpld_bus_check(): + tmp = "i2cget -y -f 0 0x60" + status, output = log_os_system(tmp, 0) + if status: + return 1 + else: + return 0 + +def i2c_order_check(): + # i2c bus 0 and 1 might be installed in different order. + # Here check if 0x70 is exist @ i2c-0 + tmp = "echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device" + status, output = log_os_system(tmp, 0) + if not device_exist(): + order = 1 + else: + order = 0 + tmp = "echo 0x70 > /sys/bus/i2c/devices/i2c-1/delete_device" + status, output = log_os_system(tmp, 0) + return order + +def device_install(): + global FORCE + + order = i2c_order_check() + # if 0x76 is not exist @i2c-0, use reversed bus order + if order: + for i in range(0,len(mknod2)): + #for pca932x need times to built new i2c buses + if mknod2[i].find('pca954') != -1: + time.sleep(2) + + status, output = log_os_system(mknod2[i], 1) + if status: + print output + if FORCE == 0: + return status + else: + for i in range(0,len(mknod)): + #for pca932x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(2) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0,len(sfp_map)): + status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + status, output =log_os_system("echo port"+str(i)+" > /sys/bus/i2c/devices/"+str(sfp_map[i])+"-0050/port_name", 1) + if status: + print output + if FORCE == 0: + return status + + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/0-0070", 0) + if status==0: + I2C_ORDER=1 + else: + I2C_ORDER=0 + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + if I2C_ORDER==0: + nodelist = mknod + else: + nodelist = mknod2 + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_inserted() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_inserted() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_inserted()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + order = cpld_bus_check() + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + for lk in cpld_of_module: + if k in cpld_of_module[lk]: + bus = bus_of_cpld[order] + node = key+str(k+1) + path = i2c_prefix + str(bus) + lk + "/"+ nodes[j] + str(k+1) + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan1'] ['fan11'][0] + node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0070", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/control b/platform/broadcom/sonic-platform-modules-accton/debian/control index 8b020a6644e0..c2e4ccc795df 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/control +++ b/platform/broadcom/sonic-platform-modules-accton/debian/control @@ -32,3 +32,7 @@ Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-accton-as7326-56x Architecture: amd64 Description: kernel modules for platform devices such as fan, led, sfp + +Package: sonic-platform-accton-as6712-32x +Architecture: amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules index 8274607f27b5..2ac628b45cb3 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/rules +++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules @@ -19,7 +19,7 @@ PACKAGE_PRE_NAME := sonic-platform-accton KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= as7712-32x as5712-54x as7816-64x as7716-32x as7716-32xb as7312-54x as7326-56x +MODULE_DIRS:= as7712-32x as5712-54x as7816-64x as7716-32x as7716-32xb as7312-54x as7326-56x as6712-32x MODULE_DIR := modules UTILS_DIR := utils SERVICE_DIR := service diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules old mode 100644 new mode 100755 From 1ab23016fbe68c63a9cc4ba6ce938b06db70fa77 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Mon, 29 Oct 2018 05:20:15 +0200 Subject: [PATCH 1714/1833] [mellanox]: Update SDK to v4.2.9102 (#2204) Signed-off-by: Andriy Moroz --- platform/mellanox/fw.mk | 2 +- platform/mellanox/mlnx-sai.mk | 2 +- platform/mellanox/sdk.mk | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 4b778b08ae00..a7bf49a4525f 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1703.0000 +MLNX_FW_VERSION = 13.1910.0016 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/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index cdd76035703b..cf9991ba2b1c 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.12.3-master -MLNX_SAI_REVISION = 9b27abc4d69e86c39202d6d2f5e794aeb2974ba0 +MLNX_SAI_REVISION = bbc4fc48e81cb4062f59b79e54b44871f608f54e export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index c8f80e94f914..a4075c64dda7 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/71ae8c6d386f57a89742fc3261775b338bfc9c25/sdk -MLNX_SDK_VERSION = 4.2.8300 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/bbc4fc48e81cb4062f59b79e54b44871f608f54e/sdk +MLNX_SDK_VERSION = 4.2.9102 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) From 6a37365d93216287d5baffe7ba16ddecff69cb86 Mon Sep 17 00:00:00 2001 From: Taoyu Li Date: Sun, 28 Oct 2018 22:32:31 -0700 Subject: [PATCH 1715/1833] [zebra.conf] Avoid zebra crash upon empty configuration (#2203) --- dockers/docker-fpm-quagga/zebra.conf.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-fpm-quagga/zebra.conf.j2 b/dockers/docker-fpm-quagga/zebra.conf.j2 index e4586e72dd62..4acb474b0e35 100644 --- a/dockers/docker-fpm-quagga/zebra.conf.j2 +++ b/dockers/docker-fpm-quagga/zebra.conf.j2 @@ -52,9 +52,11 @@ ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 {% endfor %} {% endif %} ! Set ip source to loopback for bgp learned routes +{% if lo_ipv4_addrs|length > 0 -%} route-map RM_SET_SRC permit 10 set src {{ lo_ipv4_addrs[0] | ip }} ! +{% endif %} {% if lo_ipv6_addrs|length > 0 %} route-map RM_SET_SRC6 permit 10 set src {{ lo_ipv6_addrs[0] | ip }} From 1e1add90f9d17fc43087fc4b6eb81c5ee7f3f639 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 29 Oct 2018 10:25:18 -0700 Subject: [PATCH 1716/1833] Remove Arista-specific service ACL solution; All platforms now use caclmgrd (#2202) --- build_debian.sh | 3 - dockers/docker-snmp-sv2/Dockerfile.j2 | 2 - dockers/docker-snmp-sv2/snmpd-config-updater | 263 --------------- dockers/docker-snmp-sv2/start.sh | 1 - dockers/docker-snmp-sv2/supervisord.conf | 13 +- .../build_templates/sonic_debian_extension.j2 | 16 - files/image_config/caclmgrd/caclmgrd-start.sh | 10 - files/image_config/caclmgrd/caclmgrd.service | 2 +- .../ssh/sshd-clear-denied-sessions | 81 ----- files/image_config/ssh/sshd-config-updater | 185 ----------- .../ssh/sshd-config-updater.service | 14 - rules/docker-base.mk | 1 - rules/docker-snmp-sv2.mk | 1 - rules/libwrap.mk | 14 - slave.mk | 1 - src/libwrap/Makefile | 31 -- src/libwrap/tcp_wrappers-7.6-allowlist.patch | 306 ------------------ 17 files changed, 3 insertions(+), 941 deletions(-) delete mode 100755 dockers/docker-snmp-sv2/snmpd-config-updater delete mode 100755 files/image_config/caclmgrd/caclmgrd-start.sh delete mode 100755 files/image_config/ssh/sshd-clear-denied-sessions delete mode 100755 files/image_config/ssh/sshd-config-updater delete mode 100644 files/image_config/ssh/sshd-config-updater.service delete mode 100644 rules/libwrap.mk delete mode 100644 src/libwrap/Makefile delete mode 100644 src/libwrap/tcp_wrappers-7.6-allowlist.patch diff --git a/build_debian.sh b/build_debian.sh index 78f40cc20c32..24552cfe4441 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -246,9 +246,6 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y do sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libwrap0_*.deb || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f - ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 02d0679f8f9c..f8deee49d37c 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -58,8 +58,6 @@ RUN rm -rf /debs /python-wheels ~/.cache COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["*.j2", "/usr/share/sonic/templates/"] -COPY ["snmpd-config-updater", "/usr/bin/snmpd-config-updater"] -RUN chmod +x /usr/bin/snmpd-config-updater # Although exposing ports is not needed for host net mode, keep it for possible bridge mode EXPOSE 161/udp 162/udp diff --git a/dockers/docker-snmp-sv2/snmpd-config-updater b/dockers/docker-snmp-sv2/snmpd-config-updater deleted file mode 100755 index 19702451495c..000000000000 --- a/dockers/docker-snmp-sv2/snmpd-config-updater +++ /dev/null @@ -1,263 +0,0 @@ -#!/usr/bin/env python - -# Daemon that listens to updates from ConfigDB about the source IP prefixes from which -# SNMP connections are allowed. In case of change, it will update the SNMP configuration -# file accordingly. After a change, it will notify snmpd to re-read its config file -# via SIGHUP. -# -# This daemon is meant to be run on Arista platforms only. Service ACLs on all other -# platforms will be managed by caclmgrd. -# - -import os -import re -import signal -import subprocess -import sys -import syslog -import time -from swsssdk import ConfigDBConnector - -VERSION = "1.0" - -SYSLOG_IDENTIFIER = "snmpd-config-updater" - - -# ============================== Classes ============================== - -class Process(object): - def __init__(self, pid): - self.pid = pid - self.path = '/proc/%d/status' % pid - self.status = None - - def read_proc_status(self): - data = {} - with open(self.path) as f: - for line in f.readlines(): - key, value = line.split(':', 1) - data[ key ] = value.strip() - self.status = data - - def get_proc_signals(self): - assert self.status - sigBlk = int(self.status[ 'SigBlk' ], 16) - sigIgn = int(self.status[ 'SigIgn' ], 16) - sigCgt = int(self.status[ 'SigCgt' ], 16) - return (sigBlk, sigIgn, sigCgt) - - def handle_signal(self, sig): - sigBlk, sigIgn, sigCgt = self.get_proc_signals() - mask = 1 << ( sig - 1 ) - if mask & sigBlk: - return True - if mask & sigIgn: - return True - if mask & sigCgt: - return True - return False - - def send_signal(self, sig): - log_info('Sending signal %s to %d' % (sig, self.pid)) - os.kill(self.pid, sig) - - def safe_send_signal(self, sig): - self.read_proc_status() - if not self.handle_signal(sig): - return False - self.send_signal(sig) - return True - - def wait_send_signal(self, sig, interval=0.1): - while not self.safe_send_signal(sig): - log_info('Process %s has not yet registered %s' % (self.pid, sig)) - time.sleep(interval) - - @staticmethod - def by_name(name): - try: - pid = subprocess.check_output([ 'pidof', '-s', name ]) - except subprocess.CalledProcessError: - return None - return Process(int(pid.rstrip())) - -class ConfigUpdater(object): - SERVICE = "snmpd" - CONFIG_FILE_PATH = "/etc/snmp" - - ACL_TABLE = "ACL_TABLE" - ACL_RULE = "ACL_RULE" - - ACL_TABLE_TYPE_CTRLPLANE = "CTRLPLANE" - - ACL_SERVICE_SNMP = "SNMP" - - def get_src_ip_allow_list(self): - src_ip_allow_list = [] - - # Get current ACL tables and rules from Config DB - tables_db_info = self.config_db.get_table(self.ACL_TABLE) - rules_db_info = self.config_db.get_table(self.ACL_RULE) - - # Walk the ACL tables - for (table_name, table_data) in tables_db_info.iteritems(): - # Ignore non-control-plane ACL tables - if table_data["type"] != self.ACL_TABLE_TYPE_CTRLPLANE: - continue - - # Ignore non-SNMP service ACLs - if self.ACL_SERVICE_SNMP not in table_data["services"]: - continue - - acl_rules = {} - - for ((rule_table_name, rule_id), rule_props) in rules_db_info.iteritems(): - if rule_table_name == table_name: - acl_rules[rule_props["PRIORITY"]] = rule_props - - # For each ACL rule in this table (in descending order of priority) - for priority in sorted(acl_rules.iterkeys(), reverse=True): - rule_props = acl_rules[priority] - - if "PACKET_ACTION" not in rule_props: - log_error("ACL rule does not contain PACKET_ACTION property") - continue - - # We're only interested in ACCEPT rules - if rule_props["PACKET_ACTION"] != "ACCEPT": - continue - - if "SRC_IP" in rule_props and rule_props["SRC_IP"]: - src_ip_allow_list.append(rule_props["SRC_IP"]) - - return src_ip_allow_list - - # To update the configuration file - # - # Example config file for reference: - # root@sonic:/# cat /etc/snmp/snmpd.conf - # <...some snmp config, like udp port to use etc...> - # rocommunity public 172.20.61.0/24 - # rocommunity public 172.20.60.0/24 - # rocommunity public 127.00.00.0/8 - # <...some more snmp config...> - # root@sonic:/# - # - # snmpd.conf supports include file, like so: - # includeFile /etc/snmp/community.conf - # includeDir /etc/snmp/config.d - # which could make file massaging simpler, but even then we still deal with lines - # that have shared "masters", since some other entity controls the community strings - # part of that line. - # If other database attributes need to be written to the snmp config file, then - # it should be done by this daemon as well (sure, we could inotify on the file - # and correct it back, but that's glitchy). - # - # src_ip_allow_list may contain individual IP addresses or blocks of - # IP addresses using CIDR notation. - def write_configuration_file(self, src_ip_allow_list): - filename = "%s/%s.conf" % (self.CONFIG_FILE_PATH, self.SERVICE) - filename_tmp = filename + ".tmp" - - f = open(filename, "r") - snmpd_config = f.read() - f.close() - - f = open(filename_tmp, "w") - this_community = "not_a_community" - for line in snmpd_config.split('\n'): - m = re.match("^(..)community (\S+)", line) - if not m: - f.write(line) - f.write("\n") - else: - if not line.startswith(this_community): # already handled community (each community is duplicated per allow entry) - this_community = "%scommunity %s" % (m.group(1), m.group(2)) - if len(src_ip_allow_list): - for value in src_ip_allow_list: - f.write("%s %s\n" % (this_community, value)) - else: - f.write("%s\n" % this_community) - f.close() - - os.rename(filename_tmp, filename) - - # Force snmpd process to reload its configuration if it is running - proc = Process.by_name(self.SERVICE) - if proc: - proc.wait_send_signal(signal.SIGHUP) - - def notification_handler(self, key, data): - log_info("ACL configuration changed. Updating {} config accordingly...".format(self.SERVICE)) - self.write_configuration_file(self.get_src_ip_allow_list()) - - def run(self): - # Open a handle to the Config database - self.config_db = ConfigDBConnector() - self.config_db.connect() - - # Write initial configuration - self.write_configuration_file(self.get_src_ip_allow_list()) - - # Subscribe to notifications when ACL tables or rules change - self.config_db.subscribe(self.ACL_TABLE, - lambda table, key, data: self.notification_handler(key, data)) - self.config_db.subscribe(self.ACL_RULE, - lambda table, key, data: self.notification_handler(key, data)) - - # Indefinitely listen for Config DB notifications - self.config_db.listen() - - -# ========================== Syslog wrappers ========================== - -def log_info(msg): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - - -def log_warning(msg): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_WARNING, msg) - syslog.closelog() - - -def log_error(msg): - syslog.openlog(SYSLOG_IDENTIFIER) - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - - -# Determine whether we are running on an Arista platform -def is_platform_arista(): - proc = subprocess.Popen(["sonic-cfggen", "-H", "-v", "DEVICE_METADATA.localhost.platform"], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - (stdout, stderr) = proc.communicate() - - if proc.returncode != 0: - log_error("Failed to retrieve platform string") - return False - - return "arista" in stdout - - -def main(): - log_info("Starting up...") - - if not os.geteuid() == 0: - log_error("Must be root to run this daemon") - print "Error: Must be root to run this daemon" - sys.exit(1) - - if not is_platform_arista(): - log_info("Platform is not an Arista platform. Exiting...") - sys.exit(0) - - # Instantiate a ConfigUpdater object - config_updater = ConfigUpdater() - config_updater.run() - -if __name__ == "__main__": - main() diff --git a/dockers/docker-snmp-sv2/start.sh b/dockers/docker-snmp-sv2/start.sh index 5ac31c5b43d8..6ec3379df58f 100755 --- a/dockers/docker-snmp-sv2/start.sh +++ b/dockers/docker-snmp-sv2/start.sh @@ -12,6 +12,5 @@ echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd -supervisorctl start snmpd-config-updater supervisorctl start snmpd supervisorctl start snmp-subagent diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index b3db3be95a2f..d80579506100 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -19,18 +19,9 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog -[program:snmpd-config-updater] -command=/usr/bin/snmpd-config-updater -priority=3 -autostart=false -autorestart=unexpected -startsecs=0 -stdout_logfile=syslog -stderr_logfile=syslog - [program:snmpd] command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip,disk_hw -p /run/snmpd.pid -priority=4 +priority=3 autostart=false autorestart=false stdout_logfile=syslog @@ -38,7 +29,7 @@ stderr_logfile=syslog [program:snmp-subagent] command=/usr/bin/env python3.6 -m sonic_ax_impl -priority=5 +priority=4 autostart=false autorestart=false stdout_logfile=syslog diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index e815e136fc3b..f04a214ad7c3 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -206,7 +206,6 @@ sudo cp $IMAGE_CONFIGS/sudoers/sudoers.lecture $FILESYSTEM_ROOT/etc/ # Copy control plane ACL management daemon files sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable caclmgrd.service -sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd-start.sh $FILESYSTEM_ROOT/usr/bin/ sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd $FILESYSTEM_ROOT/usr/bin/ ## Install package without starting service @@ -259,21 +258,6 @@ if [ "$image_type" = "aboot" ]; then sudo sed -i 's/udevadm settle/udevadm settle -E \/sys\/class\/net\/eth0/' $FILESYSTEM_ROOT/etc/init.d/networking fi -# Service to update the sshd config file based on database changes for Arista devices -sudo cp $IMAGE_CONFIGS/ssh/sshd-config-updater.service $FILESYSTEM_ROOT/etc/systemd/system -sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/multi-user.target.wants -cd $FILESYSTEM_ROOT/etc/systemd/system/multi-user.target.wants/ -sudo ln -s ../sshd-config-updater.service sshd-config-updater.service -cd - -sudo cp $IMAGE_CONFIGS/ssh/sshd-config-updater $FILESYSTEM_ROOT/usr/bin/ -sudo chmod +x $FILESYSTEM_ROOT/usr/bin/sshd-config-updater -sudo cp $IMAGE_CONFIGS/ssh/sshd-clear-denied-sessions $FILESYSTEM_ROOT/usr/bin -sudo chmod +x $FILESYSTEM_ROOT/usr/bin/sshd-clear-denied-sessions -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libwrap0_*_amd64.deb || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f -sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/tcpd_*_amd64.deb || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f - ## copy platform rc.local sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/ diff --git a/files/image_config/caclmgrd/caclmgrd-start.sh b/files/image_config/caclmgrd/caclmgrd-start.sh deleted file mode 100755 index 6bca9a81267d..000000000000 --- a/files/image_config/caclmgrd/caclmgrd-start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -# Only start control plance ACL manager daemon if not an Arista platform. -# Arista devices will use their own service ACL manager daemon(s) instead. -if [ "$(sonic-cfggen -H -v "DEVICE_METADATA.localhost.platform" | grep -c "arista")" -gt 0 ]; then - echo "Not starting caclmgrd - unsupported platform" - exit 0 -fi - -exec /usr/bin/caclmgrd diff --git a/files/image_config/caclmgrd/caclmgrd.service b/files/image_config/caclmgrd/caclmgrd.service index c63f1f7c5c7f..f385384375c0 100644 --- a/files/image_config/caclmgrd/caclmgrd.service +++ b/files/image_config/caclmgrd/caclmgrd.service @@ -5,7 +5,7 @@ After=updategraph.service [Service] Type=simple -ExecStart=/usr/bin/caclmgrd-start.sh +ExecStart=/usr/bin/caclmgrd [Install] WantedBy=multi-user.target diff --git a/files/image_config/ssh/sshd-clear-denied-sessions b/files/image_config/ssh/sshd-clear-denied-sessions deleted file mode 100755 index d0ca65502396..000000000000 --- a/files/image_config/ssh/sshd-clear-denied-sessions +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python - -""" -This utility will find the ip addresses of all hosts that have connected to -this device via ssh, then validate they are still in the list of allowed prefixes, -and if not kill the ssh session with a SIGHUP. -""" - -import os -import re -import subprocess - -# Run utmpdump, capture and return its output -def run_utmpdump(_utmpFilename): - devnull = file("/dev/null", "w" ) - p = subprocess.Popen(args=["utmpdump", _utmpFilename], stdout=subprocess.PIPE, stderr=devnull) - (stdout, stderr) = p.communicate() - rc = p.returncode - assert rc is not None # because p.communicate() should wait. - out = (stdout or '') + (stderr or '') - if rc: - e = SystemCommandError("%r: error code %d" % (" ".join(argv), rc)) - e.error = rc - e.output = out - raise e - return stdout - -# Run utmpdump and parse its output into a list of dicts and return that -def get_utmp_data(utmpFileName=None): - """Reads the specified utmp file. - Returns a list of dictionaries, one for each utmp entry. - All dictionary keys and values are strings - Values are right padded with spaces and may contain all - spaces if that utmp field is empty. - Dictionary keys: - "type": See UTMP_TYPE_* above - "pid": Process ID as a string - "tty": TTY (line) name - device name of tty w/o "/dev/" - "tty4": 4 char abbreivated TTY (line) name - "user": User ID - "host": Hostname for remote login, - kernel release for Run Level and Boot Time - "ipAddr": IP Address - "time": Time and date entry was made - See linux docs on utmp and utmpdemp for more info. - Example output from utmpdump: - pid tty4 user tty host ipAddr time - [7] [22953] [/238] [myname ] [pts/238 ] [example.com] [253.122.98.159 ] [Mon Dec 18 21:08:09 2017 PST] - """ - if not utmpFileName: - utmpFileName = os.environ.get( "DEFAULT_UTMP_FILE", "/var/run/utmp" ) - if not os.path.exists(utmpFileName): - return [] - output = run_utmpdump(utmpFileName) - lines = re.split("\n", output) - regExp = re.compile( - r"\[(?P" r"[^\]]*?)\s*\] \[(?P" r"[^\]]*?)\s*\] " \ - r"\[(?P" r"[^\]]*?)\s*\] \[(?P" r"[^\]]*?)\s*\] " \ - r"\[(?P" r"[^\]]*?)\s*\] \[(?P" r"[^\]]*?)\s*\] " \ - r"\[(?P" r"[^\]]*?)\s*\] \[(?P

UCM}yocoz1wzq-Y3g~I ze**1J-CwsPTpE8WnwhzDN^;WAYwuXyxzXSkft}$EE-CEq>8+79q41@lHEp3wLouhW z4bf}->&e3-1Z+AhK-TY#n$H7>vUBA9l69Wpv_A^L?t3MSlbeXl7)?KV56wu^JCLethQ3w1!@(7y9>F!E>K%q`Y3&{ zA6li-ZzTd6Oi&2;h);-*p!MNiq8712KqbHTIdktm1k`?i|9yFB_TD=)XJ*bhbLPyM zGiM6s8?0Cz|HcsTZkWrUnSIDy7Ha96e6#C0)t5CLlai$OD@wmt(^o(CsQH(x*VOtd z*KHBmt?af~xII?gNn9y`Jdy*>0O!=pPE?X;D0F^7cN#Fgr{1o_g~{}b!46Z=H||~1 z2l}T+0}~fhnUPmm;XbjS>{3+5h!pq5SoTcZb1tj;QXIuq_UvA86BmnL3%+#E!)cY6 zcP};VQTW1t2kG~q5a@fe>wmT1azrtg?_l`zZi2}cnWKz3BrQ^_p-|=1@#BpVcE)Zj z`r2gs15pT7V{;}9l{-;l&I8*)iJVrd-bFMx4A2v5W)PJs!V+@a(7KlDI;(ZPs20A4 zl*5-Ze=7y!O>pLp9(IV?4$aoF_U!(6=KtVu2P(LS;30pn+kFHekA1(IMrsnJo?;ZR~A zOZZbcxq2?zV}E_TgvXeZlCnOCxE(7`jV%kuo#on2C#7@}zo%`D)o=LJs$Jii8A{XS zpOwCs;(JQ9C5QT8Qr{~JCoXZcdxF^6WO1~}0gLEnlDO~$IJY8m4Pjphe66;*yUrFw z^!9Tk7>>-8=(g9O!-f(AcJ>^?QK^aatX!Uc%TuoQ^er^gN9Ks#?xI2W^?27y%ZG#- z@ZgmRZsD)MCti#~l&HO2`X(pb)5lB6)acg*e^zER)aLCK^LC1PTO!Lx&OGq8A!AVx z{>r$hyVAbS%uBhaa!KPK$=!UEe>`sY(_`F#%hBL?Ho37gvm#gMo*>y?EN#QG9A5Ln z7wQ4LHJ4{q?n(AqOtp9Ap5z>=`L@}AYRQBEm2xXPGt2x>qb}*pY|LeB=Slu`W^VPr zZO9x(k;<9JT5E&CL@;V?uIoPmv<+HcS3V)s^IBd%@rPI>^;l)p9)?08-a<-SJr5F$ zK;x@#zW)nKfDhq#;r5vQyNx`0gY~oeasXxmU_8A+sk40QhZ)|(QO0lN88r&au0!%VHry;2q3mB{c z?pM}xU=9{V<*{`0GU{ZS$r-6`PqoDbMagOPgsi!?v1#MlN~zc078jS-tmI;>Pvs|S zXQuJvUcE4kxlB_UYCDoQIa%Shxj0?Jhw~?$f==vcPC?6@Xjn&0^+p;eP$ISM*8Blv zO0`L`kkzt|7sjv*Q@;uk$EIq3gK^?WN=s9G$n0HN=~6AH=*ti0<~HTv#6WyH1v&0N zXQSYx+FS~Ul1Iv6zVzW}3gQ>Pge3LW7S~zn*?c~9y##HAG7%!K+II+}{g=c^?W>`H z@Tiq4>4W?9=7!R1#`(Z9{C1vzxDHV>8GsvjZQ`;i)jCi12Qrr;NO;dvZuLC1-F%MqODjFaY^~A zka^tD*cs!%*FZkY)I)gHp<O=PF+cnXI(j50_H9u-#{nk+>nK{~Evk#*kt*PXOq!tZ4==T)Xk=|$*+8y{$8%`lG3bT#ti38YikOns{k;=&K>X*m8$ZE z5kM3V9*T!_!`BOjvR4Ua+k8y@=VRnbd)UWJ=BsqUd!@SJRnwn&UWj#z}}y)g@-a%P=B6i*8CAvSwOC6Sb2{)fYyBV zq%%rRk%seSq5gFxzx9cWr1j??y!E%tD{lQ#iWd*W zAD-a1-*0*KMs52eOa?j+t)wl^Vi`}Ek6ON@P1h*_q=-%;<1t%?qw~of{vhQBdVG*4 zSF#9|DVL{)VUq{z%)?3h<7mMe;l*JJ)Sq6AUL|oPIgP*YY%2G)LoKEw%$oO(x<{B= zsgjM!4y*Odf%dxg9i{e@_PW%o;r1P6b~XlibMJj@)zotDeeJC1h`INEcJ?aXt=5ML zcAOn0NgbPa0E+W>n$K#z;81;?sISzu+0*wr&D-vk=$mkub2haLb2*3E*;$%B)^x$i zntmFuR_oanseL^y*`H|Uayxqw4=q`Tzlk9rbSDq7j@QbZL5B;ruYDEN}~%qT0Q*Q*fDw|6tosZ$&+fYj5oQgvdpg84n8%c z)*ojw>jBH^x5bTmc#M$Tle^ZyeZEVk=tptcnoF$!p7H5dUfp|OZT$5)k!%=Y4yssU& zX89FmS#Mgc86m)$+m5Oau>c!&i8X({Z1=C#&wMFfRh7u9N|uBmz~gjjPiJ51V_hb= zk$>JCKJIxTwUM=)Fc~cp`nABLNi*rLD z>bDD!0`0p{)Zenjj6nC{ZXdvAJ}mN9Q(h*o)D3cWGUT0M76}}D97@&hNAJp+C#F_; zvohTvh}=Qy(_rKtj>ndMudiR0@b@=*xj30eTqg*IoiN5b^0H=-619IrMlHodbYu zWpwJAPhL>)WTX-DdMbDHDqi04^n^82iQFvd{KUFlpM?Lu&W`bbp;ELwW@8xEgToZm6 zG-0aWgyfZZSSLWwJgg!`a|E#R8SfTcx2m)Y^0$;14B>Q1uIdtSA^4GX{M8Mt<9$st zKQXhq7Bsp`=M>LyYdMlsJj49~qJd$_trK-_5wENF*BCH4jq`G{!t_E$e==iqHdJHm z*QrdDwkv>t;CydZiVGe_Iq()KMCCr*t_9J#iT%zZv=7q_5T(vrMbs%PnE!h%1Gcff z6U_h1n`x)4285#tbrcZk`hZAN@-+`G0$D_)TLGER_!M*RrxNM%TnkE4+JX{CNd=`Y z;>2w+rKDx<$2Tj9%7FhrSrA91EQ9E15llAis_nkLLNVRqID$+(kL>-fw zd6sGndmMu9FLgHQ$Pi1(u*H&9H88O;1dPR2rE;_{5I?UkQaJ*#T=E&Yw;{r+n*|Vy zYi;y9} zBVYihZm$Y>W(M4!n*r5)()QJ0YRo6-)c9u-lpo&)g(3wj4L%B`plY*$F#Oq##lr9( zU4=T5F9hKQnTTfIS|G+$6g~%w`odAdIjpB+dAtQ(yK1N6DAzTS(q04gtR3bP>zgKr zmBA|1<9&ssRNGW?F_}(Ob_rPi7AcTp`ATmPsk<|xD6=lblTEl=s0?rB8QlGM2{$Yl zcJ`Uu8%f?&o3w;Fj?;qK?Yv?7l0l$$*G_j`_<(}DpmTs!ciz8!>fcHkZ^n*%mx8{3 z+vLdgU2a?V8p)XJpiBUPES(-H?A)(N2^cMaH>el94uSWv$Fv9f&y)f_!Gi+-B4!&p za;^bUDex!-{5b%fF);}P!E~;e$lGhNx_!Dfzg_Uq(;WH``sHTz%spNlnjWw-Q33Baj?Efn(puf3Kgtbl$#${y})|YasvQ!re zLUD4r`!JNrB4D!{OeMh_@=r**23a%5H`PBZOMp{REWB=%*uq|U4JwjUj#!y*F~qcE zF&+v#_L<0Afq!~DyRw;fjc8xZ4A16@s6N3$2*GaX_tZPFENPC60K~`Ax4RiaYgV}u*3uV z1vQupjVg3L^NMOUnrLOl@nS}u?qgT*DlQ&P_yMbW=Du^AnldGOgT2mx7ofgnknJBy zs;}N+wIoF<_*TLMcDBUz2eq@YnI$8S3S@Y?1999#D{AIh72cCx?=7W1Jfhg@hGkVs zR&QhzOdzQZ?kv%?gN?;&J_joW`~R|gCiw{*mD|>o{VfUnDxZT5O=8&n{a*)BhY2sR zL-kkbs1cNbHSs!nX}XcPy0K|PFar@&g}^M*qX3I1-XK`iPYt#0R;HeciWK6b=%eYD zZ(5{TQlBWqk6ZJvp#i}%JpEI&1c>B5bv4%Zw5kkZa%6%2L!cD(+qB_vMylzsyt8M> zF~!%4R%WI$v#lUYfOXcqVF32tdq?E71ooxEU4PG$KW0B3+p{H}y`ab2#aK5iB)t_L zH3PC>Gh1dKbqi_Q9Gkn(7}QMk`?1Frz%=oKB@6^71ztspu2gXL6KrJ!m~31IyTGe3 zqmLphGmRE_yNIK)dt9O{acHXTCAx`r^LzO8U{c7_??t=jzD^**h(P9=t|nK426r;r=@~8B&d(Z`1)@8B8JEfB1{tnU80xId;@oKLGv_=*vYtdkzLU6@MpoOq$A`Q% z&+D~=%5-Qh|2cw7B1Ec*-u^#hy5-oNe-ANq>~+82tfL6$PMuO-R*f!10l z-A;^V1{8j1DfhlxtnHj7Gs++NX66-MqJ4Mu7M_`MXnH?L}`-<6cJqu36-AOE`%kmOp*7GUv#grl~S8 z-DfWJEq^#9%-B}Ae4~Wq@J2}iGxKvlBO^$dSRfO>go#cjF?aSIId&#q17K2Z&2(3G zk0hs+83;y1HTK6=Zup4GAwjnDoRvFh6AT|`rBuPd)tY@7Xry{Ss`ZDDF9y9~aJDnz(XQ-~~NEqyCMi|Lw<2zSHt1-PRMK?v~^;blNF9+=4oF z3mRmLal6=*tqwv5I!IyI{=e{%n)`Nz7-Bm!bwXYxp6ngi>c|sI-BH13O#MWh4vCIr zEE1@ee^)D8q34}?cfBB=?M|c#BE;$oqwc@)J69-=f&t1x0gBEdH zh7rJ{2e4};v0R>L48Il2W~E_z(rup{XLBE#gz?5Xhdm7LRLa(n*j$TDT~5>E*?})M zpj0>3KHg|QF|%z#_O!3Z0 zdYES=r}sHBV$X+pOwSYt;A#n|0VB$-j=`KU3^mq1+h~n@wqfqR$&)AdvF1Mm_Beoc zUPH$lrT#upqy4Tme;VI0YzG0?%qEa+mRzYjXmt4}0h8LaOUspHKr zcI+PlD#h2*(C-O%;Zt-Y)h11((;aa~*Lie73K95M5NiKUh#R->5bXu(;(HFkuhMUt zk2oOsKne`X3*@d7#b2=LtQth*Y4)I$|5z8X2h9@~_J&kvtg-g(#3T|g>5JpGuRuJ0$7-Kl_km?Pjh z?+55sd4ED@@ltZjOj*yNi&Ax~#Wl><&&W_YXL%oR^7*D7n9m^&W#6u!tKYQWBIYl@ zC0(oKJ9n4N8RsniGnM(Pzl#dsRM?uLOTdVAcwevHNJ#Bm0jOUr+WiowO1Ua4=6rtE zGqP>TNr?Y|is#>@!``6>FZY)RLhSgtL$JQ$zOaf+zV94|1Y(4!p9qt8Lt%;4V5_}p z)SN_l8dZ3Rpx5}7Qc1{@0nfV*0p5{tT%h1_oC{tjpkY=L03qzcCY+3P_u{AhEjoGg zr2w%d)G?g)J^N!;mDBbwG1XX9;9?w|QWV6wAPl_KhMHp$}|D}o@2 zEU}EkRrpmid;_a2DOb=h6rclzo@M?|;}`cW8NGQQa5JRnt&Vl)&dm zqfA@AY-%I|`{(p7UvpYgbH%@cM-Xf^ha+syLNwC^Rv2O<&~sEHHfaS-Bi-0zWU$wv zOiCh@oCTh{M(CND0B5b^@jjL4T`^phV)pc*E#_M{*<{iUFJ)1`TblVIkwV{+aCy7Te3V?NApD7^EW zkE?DZruXtwJw3}f{j*QRr_U+V&&(sc(tDDWwg2NIdPPw9aw)u&!og;ZyEsUCRFX21 zROy$xF-Xct()UP;==lwAsK7qn&owE?^(-vxMafmP+VH^D+7tb}Lxa3>q|6&kUIZdy zS0uE1?PDVC(JAE3%G`iy+@y-|aYv8W#ROx-_tG4yOJ zy0Jx5{0YiS6+u-8%M*cGgq5jV1DfYoJWBJ{!CWZ0R)!z91qEBT*w1DzH%6SmLUn;S z1)O`(?J)PYD~l~}f8AVUl$tq@trMA;BGnt}Yj;}nMY-{}yl}o25#;rK{=oL>Hr=fjvr2BJUiZS;x_*^swMvG- zIArntk1h?2e!6`t~9CW)46&;1T_&2wUUW>eJuoq+T`^%Gb3#(;X) z8>f7C_T_%p|Ma*5m4-#;ivJe7_A{8LqK*PHSOE!w==$oX>$9gF60LonNUTVyls|CN zSHe+ZsT|sfDsvt$IScKpycFR=D2RnNhXi@oejh_aOl>;bV0V@(@w^mIWwli91vB2c z)EijS)KVF+M1iI96=aNIE8m)Oa7$$$nFI?gm46Ybq^6b}%+Ih?N(9-^WW3pukd83?Bt_5isPVVIZ~RSMS$M|6rem@Kn^7o+ ze9w1Tf;DXs^XEUH%R%hC&TV4nmD+?jpv?OwXb5<%$Z}irOrhoWMo{QQFdi3@u&X82 zwoG7I>92~&6RYRZJQTK!Ci#tvw$ymXi1HWA-E;DD_why>6NzA@|MM`|H?Gd!4;cyv zt^urcTF6_x`4+fCUFPq?{pfT(X>t(_EIMg2jSt>`o-3HnGf((>#ti9YlIodhC0pJb zQDU;RQzkGMpUhQsW#O(R1^e%{LX{JG_1&8e$iQdi^jK3_*t?o9MOfS#06kS83@L(O ztqplK6o^?5Q1pb}MYrY5&N~fTSg9>M6oF_mw=?I*6P*(daNm8XU|7L@@{u?XX6!MU z2sg4U*S!BHk{@J~HXUS;1>9><+-P?BvqEau+>BOH*lq7Ma{32al9x-*#}_u+h)K97 zVn2>$_Em^dR9cRNN};m~3xTDO7e>GrX6?F1@(nM_mt)E)QM<-V_X6H^Z&7)I7X)j$ z@rN2AV9x0r?{ju;ZE^ZWW*AZVPZbt!lc|!iu}XKc0uU*A%dHTGc@@Z-;ItAxULtJp z@w!WJ@91$K;{qe&Onkih6Trf^sIs0=LgEyoshP(P7yUqr;^Sq>g0@K&598w{bW|TN zPZ&HnSCxKIo4SHTn)=9bNgNX8QRJ-pc&R(%E}3p}*g954 zW3U)1I@MIs34;9N49jI=&L3{Vol#qpz@1TAQjsihXWUu@vdEpWZG$v7K=W;6M155$ z?_;~z=X3$tO$%^mlosI5C}=#WJEMSczcN{MOa&jmR73j60{WG2roRR0g_?k&;`F^?BHrzb}x(`{1E`lCQ+RzDY9} zz0}IQOkwYFvKc{h6Ppai;ary!-yO&$GaPJ^iSnRFPr=DnI^>@~z36;Vzk?H~R%Qlp z^R@w_8G{xnF>_&okpK>uzYIxe)MTcI<7rjz2I=}?%YYAiNbf^BZgt8&EQl*ipRCMx zrPCqlbPX+*weklWeSCaTlHPcbq`=4Sg&^r}Sxr7nQmRc4rxSaRFM0kC6N@E}{7P>Q zsj0SG=>^05b!d!q5lZBI>=yCjIxp@M9*}2WxOl5HubwtF@D8^9G;>yN>q%Gv!hgcn z6ULev0jO+oP)MVFNWM%oC+t5NV5gq4lyqopWF%6#vsB?Z~<-h)qL|MI#xCb6!qE7P3D>_r21s+d?qAo z{#+51!M>sJ$0tMU%mlT0cm4ZdSVdcC1}zdEA?4Pjy8B!6C8ev77ll*~`+M7vjJan63Sz zO`Ku!F@o*BX!rCboKk!&9I$8FPmcfCo7w0P*GfDCbiR{_1b5vh8dUNp^1NuIuOY3s z(x*aUPRMlKMz{+>i2K2oeda=;839?&BA*}hMDES$^Z}`9HJ+ZOVU!}exENpp)R>*Bg(xE5TXy@*f=YM`9-?_;Tn9lw4 zzuz1=CEcDF#+Ivp>bhRHPY^KOkk2~|A!kBd=x{iXHWcom{9DDEks4w)CJwfL_Pup{ zxOwkM>?G<`|D@4JV6jkYM-7qbXUyqMC^Vmx z-Oud9yHb=T_96)GhR~j?`hp(No7V|MM~PgknXCmX`C@Vi18@?85-__!C}4JL{uJ{4 zwrim+3%k@uYb^qdyU@E!XUQP-M(=1b^&V23O*SdsP zikl@Myf2XOnbe#4<6JA2<$5MG{Nz@AHq5#l%%E8Z2#`|2k%{tR`V-XYeP>5uf4mEL zHD?2}V@rHC=f}v@u_Z>P&WIU#dcvUD}NqR5tpjYhNaeyIaX>XKT$z4$&AO0lj- z1L<_(Q@(WCirga9-tBqGl>C`@C`>3a;DJ_=2Si8$ti0d;)x1m)V;%y}$Cj5;WkYZr zN{o}$S549COBS{7w4v1m_VluLU*WlP7YO*znqCXI$AiU6=6n`4z_U`dJQTrXmHTTz z<|9kwZ6=8`v`Ag=BI4jJ+KNzL-E&ou;sulo*1YQgn6q%4gd?iLsolYpTB+E>TxQ2&5AzUH zOK%VJ735MMa_N4thxt~%1Rmzn!(tEfMVfkmhq>qwy*$iYHEvPhVJ?dw?e+f;5A%Jv zK){48o6*Gct8YXbV)EVh{SyGu>RplW2J!#@+ZxDNviAQSEan`mi&6Fn-0?$Z+ z>{xvi5r#mS%~n&7x8z<{cm7_+>i{ieWQ;B9y#D9>5ZIvhS>wDel+cx{HG>+ol)HjP^ zct`aD>a7D|BBH()G+BK~#gH@}iE75H9*((_jD^kd?(6lTYg2xC=Pz7`k%vh?Shy|) zOWx;O^GiKHTUl|o2FdpBO4`+?NXJ6}^%PUgb~=YqyPF@SaVJYz$>DB$^ni8S`{+?? zE5V7ZDF3v^7qGJc#b?-WDfxo(J=1Z`;oPL#A<4CNUO79#} zity4!ivq*mwSrolck+jlK2z%MhDC#h2kZaUMQD7P!S6kOPjR(ff03$AEv!ndKOdqnmQ7b__-FiMDr5FgAvMADRnXDI@(|TLFS#=#|EaWrf1DoSM7SS zkMwXleY*)nm^ibZfZvCVAY9d3?(Gk)kucSQ$EdyCk3?zw*R&W0m9!ic^7G_ERYs*f z8dy=n877zKgAV@ZPU%8Ff(|CH?JDE%ce)nFI?Jj|;5x2-@(AY6it6+rQue676N-KA zLm(&QIiRy3>D+>(hP#WB`W7U;Rt)gid{S46`=`&3+fPem&WJO%21RN>Bz5D-Q_TGf zac4rMZWVV@d(1h1a6|2rv%g7@&5Aa$BCOV!2ljrqo5Q(?;lv=x6U&Yl|CPZ6-o&-C z>`95?X}gyan_T_=i0viUVw1BX?vxT#(aBKQIlq$pl$l;0tLDB*ZZRt(#MoCbS`U`! z>s;TI9goT3rsujtiK9Hdy>5u$1cOln-$y+WO5V(+;+!^3z7y*lHyDm!Z|tG+)cTrB zZC5K#OLpysz%z}{UiMsfj2pC5J8(i8=AI%Qu?ZHNF9=$OYHza>Q6(exc|)xQuM0+l zZUy&t(NZe&-Xg7VJm&Ayh)l`{6CFzXh_G^KXMMXgiqnWNp*-0e+uagW5!4o|wcBpH zjPF+Fe@WruTH!fD@LpFn5br)B^b*?S>oI3`UCeG9Op-JEBD-y<6tLfv0?rKF{#K6U z15S8W>lk}~T}xXXuY?maA%h8`cbgZ*eIzj3f{cldL?Q55Sl1z{3K=P>K zjLsatXQub`+-lj+u%{G_51CSCq7C`<&mJPkhUao{fk4NZ+~%A)r*P&xBiwA zG>jLQ3p%W{hBWA0=kn6fMEK>%+9iaJi#+fH{?gVXUc9;4x_8icr@m$NEIxI(79^T7 z_q9-X%@p2kC12dCe~{fw9I$sW3@u3Ne`f(gp4kzOF*&= zkzA1n1fEn$@X0X-uGG9*+G8q|HW6Q#s-pW~NTNlTCHvCLiHTAP>E)G1Qg2jRnJ-{( z5|gsrKaSIYkT~AtaqwOq>>X<>1x@xg4NuN($sxCNbQu2)O|EsV%xPGt9qm`deoWR- zTUfbAtk!7Nz-4vZb6X~0vxakUCXstNk*!Mws`PRu@MF%z%Genbhgzv?Db#h)lnvq3$v&B z5r*)|ul|pCrVi2HxcS9NH74h-?3~DFh&OGCho6kw136Df$b}A8Z?Q1Y>zAeW zjhX#59Le=c@R&n&);U{7a0DP*Bc1Pft<>;|JLgZ_WMX*2(X>cgcVYqqP1r>G8hL;g zu@a>$kwbqc#k|Uobv+HLt-hgf!|264DAc*6sN_#Rq2zfopi}Eh3G!bxu##xc zi7~_hJi|-}@upX89o=%@oV_ixTLp%d5#`O@%2{DE_T~15On(8CjUGz-dPQ4~N)OoH ztQ}W_=s3!nw@TaMJIGcPq+J-c=CvP~NTf*$URYwKHWnqSIhzUYs{91!9kZ8V4le}T zsd6|zuk;W1&J{7RNZc_e@Pu=nAv*Zlm?xX!uaDG~6JC3c6*z(Ls)XozvyVUTyZ6-v z$nf3;u6w7x%K-8I$*Mx8Q*B9Shd=Z6k2(FFA6{jzl-V;S7lsh}BtKzUnFcxnQ>1^} zEq*R$mZet2wN7>XR0#Ah_v-H$ZD+7`JHY%Y170NLIJ}SL)X`sD@Lq8qw z9+Mq-YU|VR`b9CTExNheezN1$zR~PI=76K9y*HNHIR?K_b#8rndw->; zCpYCRGI|6evOyGWmB?JlW-ZWzj8YHLmE}mu(xZgO8<)mX94pKGlQ()&t^m7^hK>!X zcJ3b<)uBVk$~=gi7Ym6~K{T~^cGP-d$T*WAviOprGACNI;j*_*kLHeT(rZs_O^A^iz6 zT))ilTZFqS%IaAemfM-_Fb?YOc5vI!^sKO;Q?_W-ckIko60CGJx^8ouJhLu3Zvev1 zDXZdy@CK{p7j#r{X4P-t#4uSLxy{W=pVc4J>&>gmtcCx}Q)m7CQ|NAI<|A_O5OUfi zZ=_AW+TFwSJ6l9FAlB5$0hT^6ze|o0?JAvVqx99P*DQ7>BpDqe4WzdFX_VS@yM6d9 zR$4NZMZsF*tUFys{<3IT)VdY@n5c;uGs^VZCKRbaZzwzv>az#|)kVxud zuzCm`U?C#tVPY1ZSa2AgL7Wwmexq4PU*dL`98@Du)M=Bf9J8Cqchxr>jpkiOvOZl z{JYPwb)M?}8b>*Kb2KF}fVP-W*va$bjK>DObn1Gzoi42Kqhu#X%IQM;xx`5#A19=4 z+RXZWaMzdf^1LB+Q+GEKsJ}RWp#CM_MNdWkJTFVGo13T1eJeC@%G{n1w-9Y)b!yFf zkp+!>;E2<2_#lr1t&GECr1pb3pYJ-xAK$5WI2ZVC86OkgjJS*n*W>trSYX>_9ubsdn$|J&{%4#l9eScsENU?C0!_9eY_PY$%KDaqaGo zeI?Zo+fV*#&)!sfjeX`vEKKBi?;-Z&Rdb$7t*eP=XO!7T`b#^jbyC$p_^8kBbrTc) zQp-gWGM(*-S2O7Lvuqb8blOxvcI+>y-jjN*(u_%Nouc-LTt%GP&#^7B_n`tWxRqa{ zT8Ut)!uc@X#NufiYfg93H}G3xahX2VBGXEd7jo_ACMI}9k_>G3=HosxH+gt>e;^~9 zfRJpRoQ3cimmS!bnVFf|-8xgI0ffAoni_p!U-o3De>G;MPQPhdqPt|$knh1Y`DV%a zuEN!7R0Ea-tJSZ|TTbCqEnnBY5v~$jR+$_a;f8QIsrE7~>o2W!8NCF7Al!9mc|?{G zp~UBzRF;82U#W>Y%a-w(t`6oSc5oT-?y&F5T;Eo~Gs03Bkae}B=;ek_gDJOMvT*#* z3}|GuFjtVvy1O%O-Mw4|Ix(9lI6gb+l#*C@9sI1q*~;9ZJsKMvnT}_#s~RFPbdi6b z4>i_8Xq6e(ywy~vr+Jo#q#*?T)%GkG@qiSTALn=F{N?5HYAI1>)$$35m3+Pki&mCvWZM42|I zmFhmtT2L)I+h&X{1g963_-NjlF^Ca-5`!(`%=n0d7XTU2BZIhhOY+#RlC!AU=UG1q|Dd30-%!GvOwQI}= zXQh;~(hjwju9TeK0#)K@!v)=*>{|Ncv7xD~Dr$fKeu*HWWm+y2W)p47OzB2c=O+My z7(h+_%`xhMPBTgl@91tJ^I~C!`pi?akJh=tTG)i*5Bo2TrA|k1PUfw_-jD~#oYeI> zkYM;f|2=xfa)ESnqnTp9o||Iy0CkzWi_LcAkIpfh;I2BYc2ly=pHRBisvaNABkcyy z1~d7&&%2BE}ZsyD>#_IP-M_FF93Fg?nD?aqiZaG@P5OLoQfY^$$+jA#$5 zqV}|p>aDfoxdXATyFR^X)*voCoRc_=$3(OtwJuy=>)r4h)GTQR+jr6fg$q^~&2AYz zZLIA?1D+qT>&k9$8?&b^@Q#J%KK}#!kghdul5qNjhoZF1cHe@LWjx>B&N%jP!hmR+ zwkhd)^(4xu@hO`hIA4WQ{&cCqXqzUlG8%K9r}KjcZL^{zdxLmdi6}Iq%vO!k(9U~A z4*c2cSgb^4v9fav)>C`Em3b6t#nMKU&h(q?$2V5L$EL^l?7$~xe@^TPgHXsj8NC;F z$7-KQ{+sp3vbf#2B3``*2|c?~M`HH0eYy4CKm_kP@{cF~F7mTX^cDaYu~(@`U0K18 z`#(QbvFAOH?8xgB-c`~{qa_pbnvALMuOj}aC>28N&bo4uYiOkv_OyZC511rnK_s@l z)R>T!UJp-tKjx3Y3^P*5lZeallBi*~`a|h@;-%;2 zrJsus_svfmS;nycn^$hF1$XgojBD|x<-(BEbQwRYb!4O(vy=JPh*_EWHd1|wC>X)!`eV#}qFAMEr_A9aKEyBd*>|E`V^UZ`z zRC|C8KX*ptFCN3!RYMyWK7Q6Jmf*b)hvx^O$?Z{l3x-e>cjZSG`KZx4h z(w}HGL*c2Y6_aa+t<00KP(${|zGa|n5jPFSoqoD!#-QMsUUuMmX;(ZO;|})r#I{JP zXN;9*dnL4L4By{xwC-<@R(FdS*d&dSW&Q|&#;Ttd&b2$_Hp3&Kh0uXZr-Svm$eX$Q zw~8q^eKpW%l(kSUJ@>5|hQ!!5yb(Lqh-BtFI!n*nlMhHo!F|hw+US68>lTrx$-nWT zSw8HXe!I6DSTeqoOO+Z~V?S;nY6te8#Wcv9LXK4TC~Kj_Twgtk-eBWz<|kC$u}U{T zpWco|p~d^PG^_fFSgL1GgWYW{zz7kH5jp?J81bG%=!xy|K1OVQLY!;{(^5dH<#DV| zkbxq4n!M#E#7Z)GH|T&5Oq|CtyB3-_Cy~m4yNJHBHV*LvvP6gwa7Pf}^`RC1#N(_K znL_kdnK0`_Ly`G1!cX=7q6za`blzG!lGqb3Vuz9G(mN7~B81F-Lol?1B}`&Kw^+}r zpY~1^T%_7ddW-5J!JL=d`I*)i(^afB&AQU-W<4)vp{&Q)t#S@&vQxNv zb)Dp}cT{({!>(m`GcdTtYx2_ZcG(VzSQEFuzbvI1R@nP0b@}qmUnkA_QaI#2jbC9l zLcEhbyThH{xrng1-JPEZyn1nG@6^eTbqG>R$gT4J*TN$iltTV{oU2EfVDkDo@|^up z!$7EM7ZA1L9vO{6)QXC6*|HJU8^Lrq`E-QSmS;m=%#VPWyr1qO(Pfr!<*sHZ0`tl%CgrYGM!yW& zYNZ~Ru~Kk0=eyKl%yQr56c{Ao2A#8+Jy!`53ed3{)LEIme2v>XIT8f?+So_2?5vNF ztDW-OP}?(exKoGbTbnr2b10t2m(!20$s0TSndQX4%g8)qN9yMLSF5S z(cnYc=SkEH`4q{XgNDZ?pRZ_;v?so+Q|D3{!)E%3zR>M;(DXdpyaH$B*{0H~p#hZV zn)LP&PkCo+H-!SVs$==2G*^>irY!5MD-(*QG&Stil2i9O_cM9A=V<-DJ=*q|72Q$t zNh}V(VL7EDq?eJxyM+XfFL$b8P)Oj7qDgM*i-ih|ce)rw?EUp}-Hb$FTH=!DN|Q$r z>-|yWtY(np6BzR>+`TGU#;D=4GbHV{X9f1nK2U1*F&Ga-?EB^x*}d$H&R1e!tDp)r z@te4Qx>T)Lsrpr1=c(X;j9#o}(T4=ROR2aW+eSiZ1zi*jSX}TAtL{X;g zKP}31l4N@6^ zM>AUt@-~w@z@wl>@c8UWfxH$}3US2`F32U=?%Jv=;yHtjq^Mp8tO{8dyVca?{kRuU z?+O`N#lT6YZqb6|l@+YE zFLMIpJk_Q<6ju5oVKl?nw(bJEeYyYHXl33v2xMz&S9ovtSM!`2C%5zL1NQ1^fX^<% z9^MrPDg}#oJ*^b z{=8kH<@JUm{XzpI-O7yNXpr|1$1eh`Ydel&2o`-f8@%F-z})B6h)R^ZQ}D}DX(P?S zoSdKUtk%BhgdlH3JKIJxzT7p;pNG*Ktkxq{KYRlHutE$f1JX|=jXs8RomOz; z^w;j0c_Id`2guNMD6ek7&5^tm;yS9&GRirFV`Z`Sp~{_5_jM! z#bPt&kRxXIDJMm5NvGd=yt0L z{14it556fn?o6#?i=F%xk>;BrL;7YmB%(NzRp_Dk>t%bwYMnYTPL>+{=jw2yvog%< zg^q2vRxP4Cc(}!@D&6Uq$mTZA1-!)BT*W{>O|;=)TA5fLc|g3_FlyaZ^-IdF_Py&u zk&btUFr!RdBaUz~t*jC!xHztKF)k;SO`E<{KQU1z_aO3rsXDkFOIviK@CY6nn;x&v zye^HcjM?$3!A#L{ek;~iQW5eBe>j%*?vNwp;Iw3-r-S3t-FWTBsQm#7BpGELq=d%d zR*-7^dBul8m^w`k?azuLJWh0)mylObsU8SEKdHOn{fZ#ta)z6=`^3e9BgM{(*Hu*# zUiM%Z$|2^Hk@DjGRoiJy)VZt5FXhH5rn2bF5It;M%*-cWfv$Pz&Pq61&3nZ~8*y`WMp z`7f>Xz{SIl=tQo{nZ~8*=%O8(0lJ@YV97C*RF9^*ft5Dd4fQ;7B)=-l>9eip;taJz(}FmGUVj)e;7{>6 z)j{hI%imtmdst?ENKc&m)kA;v_B$s~%UxAhLFOsea~(2*oV2p-+_!)l>VQxCu`H=f zeY>hM9P8i7TpvlzDhDs^A{$oK2?Q&;F^1to>iWY&5nI^Vkb+U+Gl65T@kOU z!(Ibm4BYGkm<^uVXE%guW_qzbPmRx(9YWRE-PiHfkUjaQ4dJJ)d(&0Fpe}nI-m^RB zOktDy=$>_d_+O{$Op zJGDD!d_z1)1NkP`Vv%=4xF%NnUS~-S%}BD>fFZMbbFBJdMRateg}>4--6_B+7_C!D0P38JfXRoKs9M? zbUb^j3OJ#+Th<_s&9m6S-vumW`^I?nRy-)J^bi?}vN6iBlUUP+SZ%kJbpXr!JQ#D~ zf|rp^5o_(F(w^-22Y4teZQe^{>B$4|oE^U@JMn?$eY{>GuM;=zUe`}mkmMjRI(Wox z)O)#$8PMzzZg}2MOZvD}8h$)(3B)UA7nnM%dEWvC@8wqd9^QGvC*cmB7R6al)y1;+ zRAneNVv|M|m4MAOIVMw7UEIE`s>Xd|mQa!>W%C%_zlZ!n+ZdZav9*sqYW`t=W$(f( zi|u(c*0H0MJ)qlS;r52=P8_kuI%RFb0uA^Cgp*t3u#Qw3x1Yjoe%8QPHSSN~ADET0 zKz$91h;> zW=TEMq@Jn1u#QWOm&qBVZL9{Y^cxIDcid4jm-AJsqfW9*6Q&8yX2oS~G@=_-SjKeF z;|gk05q={5^Jf^H(QZQ=<@X`e@|H8Z%48T}8&L}$2ZX|cXB2H<4lmlkl#vs0>dGmY zoyJY`CB4e7Dk}RoEqkDU?{(M#sJj7X=^Vvh6&TP4J=V*BJnzuLp3LISTAM(E z;yEl1$Bdes&+!pJ1~ZU;W?1NOs*jz_kFc2dG`~t{0i`EZjTD+!3K=TgS!eodl1?E& zg%F@p2ryCz06n5rS0%oY+ZU1Z7dd<5WbBPgWz^>EjpE{@*2ZU5zDkRvHGczpvc16j z#76t&Mz$}*&$5q#t2+A=uUna)NzcW(=;eBQPvZ1Ol)NEPKB2e-^;xY+s@pD}McG-{ zjeb0|uBFCy*^R)NT+aL?pJc~GqW&*%frhmyuxbe(R{EOcBzpWNr#7TtmC{2LN4}|L z>v7C31Q+U;qqAkD|JI8nZz2Zr%(YeCphj;G@HCL9;4-nOJe7KFe`?)udEA|PbAM{X zaC&U-w9?;K&_7!$xIw<9Yn9qJa?0XHPFW0-w=AlbeM6<)Pfoqnf!vaK^|OkwMn%{= zjrOyRc4q=BZZlvsetLi}=5(P?E3z!cc8(u~SPaH&#w01$tz1aRQ!D*Emez^GfyxVv-bj$f|3vcHQcEfec zBfkWaJ(MQFx+t|*%KT<@OdZDw;jEnF_7vr_K&h>yvuY+Y`mtL|bG$OlW&Zp7tRsYz zD|`||Y;T)b84R9^)-iGdW%c*?;~T>!uF<0>vUIsYmo8D3F42wNWbIuuHM0)#kNm_~ z2T6H~e!{7hy$Tut56f{Ed%d?8OLuO5&f#e~T1p;I!@TiSHf7Q1{VXZwTq6^04^P$n ziV`D}EuE{uB`s|u7j;@f$HA3pFg5`OnKaVMoQIu+x54t})fX93FIKk5`%}LFa;7XA zF11JvQbMMet|dxOKGjK6BuOgwK1Z!8z*#7{zZk6MBN3a?;oUAWvaiK&AVJH{wjFRG1YGr>j6^@qmcKC06dUB`-|vPpw}F_~EHUA9vYP#2nuS{1INe+%x0z2+k8 zN_Yzx(W}rEoXiLC{j<4>Z_;^Rk9zm}C=NHjun0J<$-&M!j%yXfRRiMl1l$TTJ znDmT}wH~ax+c@qcQ#`Y~PV6Xm(h%B!I;c9@O&Vl`Rif^DyC8El*b7{5A4T0pQC-BG`fYq{jU#*q?3!fS~*KJ1<5D9hNw;P?) zBdJmIzhf=YlEX%{a4K2bBV*6c~vsC{#k>htVg{%0{((XZ94< zPAq-nwcQ)~)^tX*x++a>5)9QeGkB?ZzkoN#3n+`4B(p|p)S~ZL3*}_ItU|-yGe|%! z1Uz9-8&LAw($`yEkc7KO%aJM4!rmYGtl+#MJY~mk_J+yt#LeER{5EFKsq`L0EV?Ig zJYEUrlde!huk^l-al-8+{vZvOWkE(P>w@0f+xzeI{!A(augq*pc6lR6S>(Q0!n}DJ zW1j+-iF#ef=Jp6q?v>T!4s~8*Q_lujR_Ek?h*BbC%XI+CI?;QFW}(xTX+{coFY#gZ zGfawWgcNICo*pP4z(K*Y@7vcC*|RMNkyLDbJ)Q*J5gl!?=x7zWb4l0F;{Frbi%Low z3pjszI8jXHCt>|QNSOi5`?A!_6{Aeo!)9+mvL9Rp?n6zK`b7QL%2c7Gcz& z;qc-~ucEj?I+uJ;xKoB;vHm$FD2n1KEgeiFrH_@~TOwslfeLp_kj(`Qv<~!X}SYbd}UH)ms9+0ph+=pQd-e5jY!)Pk17s(Ot}QY_6(Q}C@44)y*lvyZO3J`FcN<+!M~jS*I7wQ{aZ ziGJ|D|1$a6SbTyldedijs>yC;>JW+EN$fYvY2^c$DiT2L%~YaM{fEt9ZG1pzJvg;i3zSBne0KNNP6yx@0N9&@zQXAG>@jhU z)by74Mi}Zc7G){U0Ea`R!B+rZg&QxjY8@=x&p;GwU1k^f@&;n%Wd%I@>VvL+Sy~IU z3inx6M0ir^V?@tB!ME`Hr&93FfwXZPZIsyzoy*%U8l3K>=R57Lyuoj1AiOyd1mAk! zXHztvxx&qweA0jlD^nq4A5WG7eSUIe5-~SEK3`&*;Jo98N6Y+c&DXdK_J>`E8+~+i zkAD3?n$H0%rxb^zF6Yq3OHT}C&)q2#;Jjfd8vdr_=qV=#o06xH!^%92QmvbkmHK)g zuW@I1&v#D@i8&#Czksdoie-OX;hyvclak!8_>jNL)LI{M4t@O+_5Fpe9V@vYY>M#p}$taI~enCZXyJ~X;nwFv;un!1DSS4ti~$69pZ&;x=Z_e1V+r}=Dmeu+xi zhqf|bhGB#C&KjP3ydUug6{npaE_L|=PNgT-pN+$3;w#hK8-2=+<}Q15hub)rNnf6_UhyIRz2c?ejjy8 zI3kodCQ`dGIovoga{O;yS$b3Qb?1o8Q%Od`x`w7lW7RuiwGYoeq~5uPXj#wT$kyoe zrwPg5vrndIP8>2N+W!ZK)wIX$Zv;Dk4@ym|YJs$bAE26U-^y>oTB{VbI6d-Pk@e)%3v(H@=R6ILp^S34yiOm8lKkp1b4 zF3RsuZ~RVvfBFQGl-bd>1fAAGE*&Ns)(?GHz^r$+Z}$_<;3E)>T687R?V z^Nzlzc?EroU|(1)G0yq?$6r4+Miyu@T2r|d)D=0mKB;1ZW@1mMbV3BUm``dt7> zPU$M|IrNY6#6|6w>N#`6x!nMEBX0+sdkPgK|CoBXr|W*7OOOfdQt66?p)hJR{^`xq4R`qYI zn#pce|5^9gtm?a}mg@UGRV(z@?2n1U~Mp7N;Xw&zO7Xr5# z@E4ZHoEz(6cH2^|pZoYqhHiN?j}?Ai`gWC6 z)>>L`KTDR)`7B%WkL~$Ku_^g5midpJnV~+kbbDu}%zw7h&yvrVXUm#7H=elw29IUO zNf@T%skoe+oP(5)23hDIgnd3|>h5SHTxn%)CncggUiGYsCHh;#8D~{ksh`IL%*1em zePKCLv_@_dMVuwh6gNiN1nr&JRP41_(sxJC4Ob>k%oqNAZN9MV;x%oS;+ie_JV7Ar zSELnkyL;wA>Oq3x9<42HEfo#%ROmh8MfEb+hM|vIqRt)Cf3ivCT{U74$=6r;ox=Jm ztk!k0Fdo+vrV_j7@a8uw6IEFBl22eLm1#s0z8$r{%qt+d$XfFxUmEcuxv+#&qt(hq zuRZQhSc-X<%e&hDS*2_p&i+Jpv2cN2m$S{Cg69hCx42(bNQoopEhU|@+2s>vAea73;O}Z=dTdL zX3sCNS}!fJJBc>{cC6M%vXRZi8=qMv8|PHDE^M_PlPzn`MkAXg^@p2N`}@y$%Vcl< zu!^8cc;z@+8uw-@67K8NcX_fqGv?^5RZks*NzabEC!QS}9`zM#{+DStd&fOh>sPR@ zroL2GAW-Ec;WPtvEFFiG4Ve9tlbS!g)JpdtGVHCX?b}9;V*@kZ*BVv@LL z6nBS7?5E}rr(5akcmPP;?zr!2GI5k*mHZ~wNdF93@m>=a5tigAKX|}J{o7IJq;Gdp zo$dzLzQ6tFCgZvq{@ImvHr z;){k$IC)n|ihDWBI8G+Xb3^LwaH{M0<`2)e=FdA;`t)K?)yqQ<74*~<;1wT2={FGp zacJl4k_f3#^60K}l+L40N*pt)AvtyK;~|EoWU*Q!aNoH-qfSh|M(UZP8WOMByP6+v z9(5wy@?9?({d3fbTCV0GQ(Y^b7G| zZlI>TlM&I(q|G5G70iV4n>Kw7KBg*ZxzkbIVlpzx$lPAie{iZzs(`#DQE6wJid8G~ z7v4ZE~-g6*U)5|dD2Ch&qL1d1mC#7%TMZGn09|VSj5O17~mfP@*Xo7za-e%G&~rh zGCN-WW8M}|lVTD9`a3YPUJBeSU)Gg#Q6>*&-W6m7IPsa)O8;RhTKFPp;=Zv}EL(~) zRmL+i5yk9&82ibCxR)u&XKXTX<)nTF&E1tULlC}SKeS0chMrbu9~H9`ofZCM_idqa z^Q`a{8+3TknX68s`E4ReM4O+3XFx+|Y;IdOAVl^UA!E%ujBK<`Cejh@t1C%)KXxZg zl2OBW9W~racYQGw8g;pq{ujTTgOn5+AtkyFG5o!utS^I0cz3J@Kf2p5@wEI7Pj0tb zPp?b&B(`!^`|`w7R_plvbtCuA+%)|WpFgeE4#u898F|ReU0k4~vxFGP4-$~bXNhme zow5U?jGl|Cn~O5Ka1LD2-}=X?Rwm73gEPN{{`uwOcAZ8U^=_e_<_~{hWsVdRwl61_ zs)6j1aPx=P5fA2n*rZUA8v;R|4M&R%)wGLA^Tn|@EtfErz%#joGVekXOr}yP=$*xT zWcOJKR>1WRX6lpBd-*Bvkt-lcfet~QVU4JrVTsMM zf4G&|D7s@xsSZy(CfT{-9q`WYgf+M$ZA3e|-tFzxI_cyg|E%Ev$Tb4FWHrqUMeY}g zZ)JYWkE11pZNJYOzqhwDSs8e-+N>}f`$huJ)V!grye41I=PoU-M~*QQmq8jwT!zHa z6q1=HVzqAJDBd(I@3Xl5@=G#TwXZ6t5m773qVLs6s+&uw{zKy=6pVDuOd8Bt0*lcl z4T;SCSF@C{wF2&J7F6VyK)BB)xI=e;PvWFhTO~>C$F1r|ce7{8Y;Vo~95wRtWUY=e zD|-)#40r*}5gaMOET;9@3Yx%41XCVB7gKu~#wq*<1bn0YOyXp^MC3i;IHiPXuFPw0 z@_LaM=CgsC!{d`N5U&06v6=c;9SDWC|DhIcQ=$p6?8-WA2`)pOb6=GXyXT!FgI0%m z?2I-^CJZFoz9@#fRRSUoU%==sdjFBM(tM=JgK=#EqoVa_oQ&J5q?%~}NbN-`zI7a; z>IJV*#kyTlW>UBmWu((8yGyR- z3kTH+7Z7h|%>QM40hAX+nNwqt{e$-xGDJaPPZUsM_